[
  {
    "path": ".gitignore",
    "content": "# build environment/text editor things\n.gradle/\n.idea/\nlocal.properties\n*.vshost.*\n*.suo\n*.vcxproj.user\n*.csproj.user\n*.swp\n*.iml\n\n# OS specific temp files\n.DS_Store\nThumbs.db\n__MACOSX/\n\n# Android template project things\n/Engine/porting/Android/.classpath\n/Engine/porting/Android/.project\n/Engine/porting/Android/.settings/\n/Engine/porting/Android/gen/\n\n# Android concrete project things\n/Engine/porting/Android/GameEngine-android/bin/\n/Engine/porting/Android/GameEngine-android/build/\n/Engine/porting/Android/GameEngine-android/gen/\n/Engine/porting/Android/GameEngine-android/jni/\n/Engine/porting/Android/GameEngine-android/libs/\n/Engine/porting/Android/GameEngine-android/obj/\n/Engine/porting/Android/GameEngine-android/src/\n\n# iOS \n/Engine/porting/iOS/Project/\nxcuserdata/\nproject.xcworkspace/\n\n# object files things\n*.exe\n*.pdb\n*.a\n!libcurl.a\n*.so\n*.dll\n"
  },
  {
    "path": ".travis.yml",
    "content": "# ref: http://blog.crowdint.com/2013/05/17/android-builds-on-travis-ci-with-maven.html\n# ref: http://blog.crowdint.com/2013/05/24/android-builds-on-travis-ci-with-gradle.html\n# with some modifications to support Android 4.3\n\nlanguage: java\njdk: oraclejdk7\nenv:\n matrix:\n   # android-17 is always included\n   ## note: we're using android-17 for building, so android-16 env is disabled here.\n   # - ANDROID_SDKS=sysimg-16           ANDROID_TARGET=android-16  ANDROID_ABI=armeabi-v7a\n   - ANDROID_SDKS=android-17,sysimg-17 ANDROID_TARGET=android-17  ANDROID_ABI=armeabi-v7a\n   - ANDROID_SDKS=android-18,sysimg-18 ANDROID_TARGET=android-18  ANDROID_ABI=armeabi-v7a\n\nbefore_install:\n  # Install base Android SDK\n  - sudo apt-get update -qq\n  - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi\n  - wget http://dl.google.com/android/android-sdk_r22.2.1-linux.tgz\n  - tar xzf android-sdk_r22.2.1-linux.tgz\n  - export ANDROID_HOME=$PWD/android-sdk-linux\n  - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools\n\n  # Install required components.\n  # For a full list, run `android list sdk -a --extended`\n  # Note that sysimg-16 downloads the ARM, x86 and MIPS images (we should optimize this).\n  # Other relevant API's:\n  #  addon-google_apis-google-16\n  # yes, we do agree SDK EULA\n  - echo 'y' | android update sdk --filter platform-tools,android-17,extra-android-support,$ANDROID_SDKS --no-ui --force\n  - BUILD_TOOLS_ID=`android list sdk --extended -a | grep \"build-tools-18.1.0\" |cut -d ' ' -f 2`\n  - echo 'y' | android update sdk -a --filter $BUILD_TOOLS_ID --no-ui --force\n  - export PATH=${PATH}:${ANDROID_HOME}/build-tools/18.1.0\n\n## disable emulator related things for now\n#   # Create and start emulator\n#   - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI\n#   - emulator -avd test -no-skin -no-audio -no-window &\n\n## disable emulator related things for now\n# before_script:\n#   - chmod +x wait_for_emulator\n#   - ./wait_for_emulator\n\n  # NDK\n  - wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2\n  - tar jxf android-ndk-r9-linux-x86_64.tar.bz2\n  - export ANDROID_NDK_ROOT=$PWD/android-ndk-r9\n  - export PATH=$ANDROID_NDK_ROOT:$PATH\n\n# Android NDK & SDK build\nscript: ./Engine/porting/Android/GameEngine-android/build.py --rebuild --assemble --project SampleProject\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/AbstractContainer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\n// Class and struct can have inner class/struct/interface\r\n// They act as a kind of namespace.\r\n// Support Interface inheritance mecanism\r\nAbstractContainer::AbstractContainer()\r\n:m_methods\t\t\t(NULL)\r\n,m_methodCount\t\t(0)\r\n,m_members\t\t\t(NULL)\r\n,m_memberCount\t\t(0)\r\n,m_accessors\t\t(NULL)\r\n,m_accessorCount\t(0)\r\n,m_pVariables\t\t(NULL)\r\n,m_modifier\t\t\t(0)\r\n,m_attribute\t\t(NULL)\r\n,m_inheritancesCount\t(0)\r\n,m_inheritances\t\t(NULL)\r\n,m_ancestor\t\t\t(NULL)\r\n,m_bCreateDefaultCtor\t(false)\r\n,m_bAsGCAbleMember\t\t(true)\r\n,m_cacheFullName\t(NULL)\r\n,m_operator\t\t\t(0)\r\n,m_genericParam\t\t(NULL)\r\n,m_ownerInner\t\t\t(NULL)\r\n,m_cppRepresentation\t(NULL)\r\n,m_csharpRepresentation\t(NULL)\r\n,m_referenceModifCount(0)\r\n{\r\n\tm_bIsAbstract = true;\r\n\tgGlobalClassID++;\r\n}\r\n\r\nvoid AbstractContainer::setGenericParam() {\r\n\tm_genericParam = popGenericNameList();\r\n}\r\n\r\nTypeObject* AbstractContainer::getGenericType(TypeGenericDefinitionEntry* genericSymbol, TypeGenericEntry* genericParams) {\r\n\tif(m_genericParam) {\r\n\t\tTypeGenericDefinitionEntry * pDefGen = m_genericParam;\r\n\t\tTypeGenericEntry* pGen = genericParams;\r\n\t\twhile(pGen && pDefGen && strcmp(pDefGen->m_genericName, genericSymbol->m_genericName)) {\r\n\t\t\tpDefGen = pDefGen->m_pNextGenericEntry;\r\n\t\t\tpGen = pGen->m_pNext;\r\n\t\t}\r\n\t\tif(!pDefGen && !pGen) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Generic symbol was not found\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tif(!pDefGen || !pGen) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Wrong number of generic parameters\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\treturn pGen->m_instanceType;\r\n\t}\r\n\telse {\r\n\t\t// Template definition => no instance\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nTypeObject* AbstractContainer::getType() {\r\n\tif (myType.m_typeID == TYPE_UNRESOLVED) {\r\n\t\tmyType.m_definitionAC\t= this;\r\n\t\tmyType.m_isGC_Able\t\t= ((this->m_modifier & (ATT_CLASS | ATT_INTERFACE)) != 0);\r\n\t\tmyType.m_genreID\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tmyType.m_name\t\t\t= this->getName();\r\n\t\tmyType.m_typeID\t\t\t= (EnumTypeObject)this->m_uniqueId;\r\n\t\tmyType.m_res.pSymbol\t= this;\r\n\t\tmyType.m_res.pType\t\t= &myType;\r\n\t\tmyType.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t}\r\n\treturn &myType;\r\n}\r\n\r\nvoid AbstractContainer::overrideType(TypeObject* pSolvedType) {\r\n\tmyType.m_definitionAC\t= this;\r\n\tmyType.m_genreID\t\t= pSolvedType->m_genreID;\r\n\tmyType.m_isGC_Able\t\t= pSolvedType->m_isGC_Able;\r\n\tmyType.m_name\t\t\t= pSolvedType->m_name;\r\n\tmyType.m_res\t\t\t= pSolvedType->m_res;\r\n\tmyType.m_typeID\t\t\t= pSolvedType->m_typeID;\r\n}\r\n\r\nAbstractContainer::~AbstractContainer() {\r\n\tdelete[] m_inheritances;\r\n\tCLEAR(m_methods,m_methodCount);\r\n\tCLEAR(m_members,m_memberCount);\r\n\tCLEAR(m_accessors,m_accessorCount);\r\n}\r\n\r\n/*virtual*/\r\nint AbstractContainer::getGenre() {\r\n\treturn EGENRE::_ABSTRACTCONTAINER;\r\n}\r\n\r\n/*virtual*/\r\nconst char*\tAbstractContainer::getName() {\r\n\tif(m_cppRepresentation) {\r\n\t\t// Nested\r\n\t\treturn m_cppRepresentation->m_name;\r\n\t}\r\n\telse {\r\n\t\treturn m_name;\r\n\t}\r\n}\r\n\r\nTypeObject*\tAbstractContainer::getAncestor()\r\n{\r\n\tNameSpace* nameSpaceContext = this->m_pParent;\r\n\r\n\t//\r\n\t// Use cached result to speed up, as resolution can be costly and getAncestor is called a lot.\r\n\t//\r\n\tif (!m_ancestor) {\r\n\t\tint search = 0;\r\n\t\twhile (search < m_inheritancesCount) {\r\n\t\t\tTypeObject* pType = m_inheritances[search];\r\n\t\t\tpType->getResolvedType(nameSpaceContext);\r\n\t\t\tif (pType->m_definitionAC) {\r\n\t\t\t\tif (pType->m_definitionAC->m_modifier & (ATT_CLASS | ATT_STRUCT)) {\t// Struct or Class but not interface.\r\n\t\t\t\t\tm_ancestor = pType;\r\n\t\t\t\t\treturn pType;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsearch++;\r\n\t\t}\r\n\r\n\t\treturn NULL;\r\n\t} else {\r\n\t\treturn m_ancestor;\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::addMethod\t\t\t(Method*\tpMethod) {\r\n\tEXPAND(m_methodCount, m_methods, pMethod);\r\n\tpMethod->m_pOwner = this;\r\n}\r\n\r\nvoid AbstractContainer::addMember\t\t\t(Variable*\tpMember) {\r\n\tEXPAND(m_memberCount, m_members, pMember);\r\n\tpMember->m_ownerClass = this;\r\n}\r\n\r\nvoid AbstractContainer::addAccessor\t\t\t(Accessor*\tpAccess) {\r\n\tEXPAND(m_accessorCount, m_accessors, pAccess);\r\n\tpAccess->m_ownerClass = this;\r\n}\r\n\r\nAbstractContainer*\tAbstractContainer::addInheritance(TypeObject* type) {\r\n\tEXPAND(m_inheritancesCount, m_inheritances, type);\r\n\treturn this;\r\n}\r\n\r\nvoid AbstractContainer::fixInheritance() {\r\n\tif (m_inheritancesCount == 0) {\r\n\t\taddInheritance(&t_OBJECT);\r\n\t}\r\n}\r\n\r\nVariable*\t\t\tAbstractContainer::addVariable(Attribute* attribute, u32 modifier, TypeObject* type, Variable* variable) {\r\n\t// Member\r\n\tVariable* pVar = variable;\r\n\twhile (pVar) {\r\n\t\tEXPAND(m_memberCount, m_members, pVar);\r\n\t\tpVar->setType(type);\r\n\t\tpVar->setModifier(modifier);\r\n\t\tpVar->setAttribute(attribute);\r\n\t\tpVar->m_ownerClass = this;\r\n\t\tpVar = pVar->m_pNextVariable;\r\n\t}\r\n\treturn variable;\r\n}\r\n\r\nAbstractContainer*\tAbstractContainer::addProperty(Attribute* attribute, u32 modifier, TypeObject* type, const char* name, Accessor* accessor) {\r\n\tfor(int i = 0 ; i < strlen(name) ; i ++) {\r\n\t\tif(name[i] == '.') {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Explicit implementation of interfaces is not supported yet\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tbool hasEmptyGetter = accessor->m_get && accessor->m_get->m_statement == NULL;\r\n\tbool hasEmptySetter = accessor->m_set && accessor->m_set->m_statement == NULL;\r\n\tif((hasEmptyGetter || hasEmptySetter) && !(m_modifier & ATT_INTERFACE) && !(m_modifier & ATT_ABSTRACT)) {\r\n\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Auto-properties are not supported\");\r\n\t}\r\n\taccessor->setName(name);\r\n\taccessor->m_type\t\t= type;\r\n\taccessor->m_attribute\t= attribute;\r\n\taccessor->m_modifier\t= modifier;\r\n\taccessor->m_ownerClass  = this;\r\n\tEXPAND(m_accessorCount, m_accessors, accessor);\r\n\treturn this;\r\n}\r\n\r\nAbstractContainer*\tAbstractContainer::addProperty(Attribute* attribute, u32 modifier, Accessor* indexer) {\r\n\tbool hasEmptyGetter = indexer->m_get && indexer->m_get->m_statement == NULL;\r\n\tbool hasEmptySetter = indexer->m_set && indexer->m_set->m_statement == NULL;\r\n\tif((hasEmptyGetter || hasEmptySetter) && !(m_modifier & ATT_INTERFACE)) {\r\n\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Auto-properties are not supported\");\r\n\t}\r\n\tindexer->m_attribute = attribute;\r\n\tindexer->m_modifier\t= modifier | ATT_OPERATOR;\r\n\tindexer->m_ownerClass  = this;\r\n\tEXPAND(m_accessorCount, m_accessors, indexer);\r\n\tthis->m_operator |= OPOVR_INDEXER;\r\n\treturn this;\r\n}\r\n\r\nMethod* AbstractContainer::addConstructor(Attribute* attribute, u32 modifier, const char* name, Variable* params, Statement* code, Expression* initializerOpt, s32 optType) {\r\n\tif(strcmp(m_name, name) != 0) {\r\n\t\tcompilerError(ERR_INTERNAL, \"The class and its constructor have different names\");\r\n\t}\r\n\tMethod* m = new Method();\r\n\tm->m_codeBlock\t= code;\r\n\tm->m_parameters = params;\r\n\tm->setupHasDefaultParams();\r\n\tm->m_attribute\t= attribute;\r\n\tm->m_modifier\t= modifier | ATT_CTOR;\r\n\tm->setName(name);\r\n\tm->m_pOwner\t\t= this;\r\n\tm->m_initializerOpt\t= initializerOpt;\r\n\tm->m_initializerType = optType;\r\n\tEXPAND(m_methodCount, m_methods, m);\r\n\treturn m;\r\n}\r\n\r\nMethod* AbstractContainer::addDestructor(Attribute* attribute, u32 modifier, const char* name, Statement* code) {\r\n\tif(strcmp(m_name, name) != 0) {\r\n\t\tcompilerError(ERR_INTERNAL, \"The class and its destructor have different names\");\r\n\t}\r\n\tMethod* m = new Method();\r\n\tm->m_codeBlock\t= code;\r\n\tm->m_attribute\t= attribute;\r\n\tm->m_modifier\t= modifier | ATT_DTOR;\r\n\tm->m_pOwner\t\t= this;\r\n\tm->setName(name);\r\n\tEXPAND(m_methodCount, m_methods, m);\r\n\treturn m;\r\n}\r\n\r\nMethod* AbstractContainer::addMethod(Attribute* attribute, u32 modifier, const char* name, Variable* params, Statement* code, TypeObject* returnType) {\r\n\tfor(int i = 0 ; i < strlen(name) ; i ++) {\r\n\t\tif(name[i] == '.') {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Explicit implementation of interfaces is not supported yet\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tMethod* m = new Method();\r\n\tm->setName(name);\r\n\tm->m_returnType = returnType;\r\n\tm->m_codeBlock\t= code;\r\n\tm->m_parameters = params;\r\n\tm->setupHasDefaultParams();\r\n\tm->m_attribute\t= attribute;\r\n\tm->m_modifier\t= modifier;\r\n\tm->m_pOwner\t\t= this;\r\n\tEXPAND(m_methodCount, m_methods, m);\r\n\treturn m;\r\n}\r\n\r\n//Finds a local member\r\nVariable* AbstractContainer::findMember(const char* name)\r\n{\r\n\tint n=0;\r\n\twhile (n < this->m_memberCount) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tif (strcmp(pVar->m_name,name)==0) {\r\n\t\t\treturn pVar;\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\n//Finds a local method\r\nMethod* AbstractContainer::findMethod(const char* name, Expression* signature, TypeGenericEntry* genParams)\r\n{\r\n\tMethod* ret = NULL;\r\n\tMethodList* overloadings = new MethodList();\r\n\tfor(int n = 0 ; n < m_methodCount ; n++) {\r\n\t\tMethod* pMethod = m_methods[n];\r\n\t\tif (strcmp(pMethod->m_name,name)==0) {\r\n\t\t\t// Resolve parameters.\r\n\t\t\tVariable* pParameter = pMethod->m_parameters;\r\n\t\t\twhile(pParameter) {\r\n\t\t\t\tpParameter->m_type->m_res = pParameter->m_type->getResolvedType(this, pMethod);\r\n\t\t\t\tif(pParameter->m_expression) {\r\n\t\t\t\t\t// Resolve default value.\r\n\t\t\t\t\t// gCurrentMethod and gCurrentAC need to be updated as it can be an external context.\r\n\t\t\t\t\tMethod*\t\t\t\toldCurrentMethod\t= gCurrentMethod;\r\n\t\t\t\t\tAbstractContainer*\toldCurrentAC\t\t= gCurrentAC;\r\n\t\t\t\t\tgCurrentMethod\t=\tpMethod;\r\n\t\t\t\t\tgCurrentAC\t\t=\tpMethod->m_pOwner;\r\n\t\t\t\t\tpParameter->m_expression->AnalysisAndTransform();\r\n\t\t\t\t\tgCurrentMethod\t=\toldCurrentMethod;\r\n\t\t\t\t\tgCurrentAC\t\t=\toldCurrentAC;\r\n\t\t\t\t}\r\n\t\t\t\tpParameter = pParameter->m_pNextVariable;\r\n\t\t\t}\r\n\r\n\t\t\toverloadings->add(pMethod);\r\n\t\t\tif((genParams != NULL) && (pMethod->m_genericParam == NULL)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tswitch(compareSignatures(pMethod->m_parameters, signature)) {\r\n\t\t\tcase EMATCH::M_IDENTICAL :\r\n\t\t\t\treturn pMethod;\r\n\t\t\tcase EMATCH::M_APPLICABLE :\r\n\t\t\t\tif(!ret || isBetterFunctionMember(pMethod->m_parameters, ret->m_parameters, signature)) {\r\n\t\t\t\t\tret = pMethod;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EMATCH::M_MISMATCH :\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Unknown comparison result\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(ret) {\r\n\t\treturn ret;\r\n\t}\r\n\telse if(overloadings->m_count == 1) {\r\n\t\treturn overloadings->m_method;\r\n\t}\r\n\telse if(overloadings->m_count > 0) {\r\n\t\treturn overloadings;\r\n\t}\r\n\telse {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\n//Version for delegate signatures\r\nMethod* AbstractContainer::findMethod(const char* name, Variable* signature, TypeGenericEntry* genParams)\r\n{\r\n\tMethod* ret = NULL;\r\n\tMethodList* overloadings = new MethodList();\r\n\tfor(int n = 0 ; n < m_methodCount ; n++) {\r\n\t\tMethod* pMethod = m_methods[n];\r\n\t\tif (strcmp(pMethod->m_name,name)==0) {\r\n\t\t\t// Resolve parameters.\r\n\t\t\tVariable* pParameter = pMethod->m_parameters;\r\n\t\t\twhile(pParameter) {\r\n\t\t\t\tpParameter->m_type->m_res = pParameter->m_type->getResolvedType(this, pMethod);\r\n\t\t\t\tif(pParameter->m_expression) {\r\n\t\t\t\t\t// Resolve default value.\r\n\t\t\t\t\t// gCurrentMethod and gCurrentAC need to be updated as it can be an external context.\r\n\t\t\t\t\tMethod*\t\t\t\toldCurrentMethod\t= gCurrentMethod;\r\n\t\t\t\t\tAbstractContainer*\toldCurrentAC\t\t= gCurrentAC;\r\n\t\t\t\t\tgCurrentMethod\t=\tpMethod;\r\n\t\t\t\t\tgCurrentAC\t\t=\tpMethod->m_pOwner;\r\n\t\t\t\t\tpParameter->m_expression->AnalysisAndTransform();\r\n\t\t\t\t\tgCurrentMethod\t=\toldCurrentMethod;\r\n\t\t\t\t\tgCurrentAC\t\t=\toldCurrentAC;\r\n\t\t\t\t}\r\n\t\t\t\tpParameter = pParameter->m_pNextVariable;\r\n\t\t\t}\r\n\t\t\r\n\t\t\toverloadings->add(pMethod);\r\n\t\t\tif(genParams != NULL) {\r\n\t\t\t\t// TODO : use getGenericType()\r\n\t\t\t}\r\n\t\t\tswitch(compareSignatures(pMethod->m_parameters, signature)) {\r\n\t\t\tcase EMATCH::M_IDENTICAL :\r\n\t\t\t\treturn pMethod;\r\n\t\t\tcase EMATCH::M_APPLICABLE :\r\n\t\t\t\tif(!ret || isBetterFunctionMember(pMethod->m_parameters, ret->m_parameters, signature)) {\r\n\t\t\t\t\tret = pMethod;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EMATCH::M_MISMATCH :\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Unknown comparison result\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(ret) {\r\n\t\treturn ret;\r\n\t}\r\n\telse if(overloadings->m_count == 1) {\r\n\t\treturn overloadings->m_method;\r\n\t}\r\n\telse if(overloadings->m_count > 0) {\r\n\t\treturn overloadings;\r\n\t}\r\n\telse {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nMethod* AbstractContainer::findDestructor()\r\n{\r\n\tfor(int n = 0 ; n < m_methodCount ; n++) {\r\n\t\tif(m_methods[n]->m_modifier & ATT_DTOR) {\r\n\t\t\treturn m_methods[n];\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n//Finds a local property\r\nAccessor* AbstractContainer::findProperty(const char* name)\r\n{\r\n\tint n=0;\r\n\twhile (n < this->m_accessorCount) {\r\n\t\tAccessor* pProperty = this->m_accessors[n];\r\n\t\tif(pProperty->m_variable == NULL) {\r\n\t\t\tif (strcmp(pProperty->m_name,name)==0) {\r\n\t\t\t\treturn pProperty;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// Indexer accessors do not have a name\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nAccessor* AbstractContainer::findPropertyIndexer(Expression* solvedSignatureList) {\r\n\tfor (int n=0; n < this->m_accessorCount; n++) {\r\n\t\tAccessor* pAcc = this->m_accessors[n];\r\n\t\tif ((pAcc->m_modifier & ATT_OPERATOR) != 0) {\r\n\t\t\tint count = 0;\r\n\t\t\tVariable* pVar = pAcc->m_variable;\r\n\t\t\twhile (pVar) { count++; pVar = pVar->m_pNextVariable; }\r\n\t\t\t// TODO : differentiate only with parameter count, not with type !\r\n\t\t\tif (solvedSignatureList->m_expressionCount == count) {\r\n\t\t\t\treturn pAcc;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n\r\nAbstractContainer*\tCreateInternal(Attribute* attribute, u32 modifier, const char* name) {\r\n\t// Find name in current name space ? --> Partial definition.\r\n\tNameSpace* fNewWorkingSpace = gCurrentNameSpace->findNameSpace(name);\r\n\tAbstractContainer* pCnt;\r\n\tif (!fNewWorkingSpace) {\r\n\t\tpCnt = new AbstractContainer();\r\n\t\tpCnt->m_attribute\t= attribute;\r\n\t\tpCnt->m_modifier\t= modifier;\r\n\t\tpCnt->m_noDump\t\t= g_noDump;\r\n\t\tpCnt->setName(name);\r\n\r\n\t\tgCurrentNameSpace->addAbstractContainer(pCnt);\r\n\r\n\t\tif (gCurrentNameSpace->getGenre() == EGENRE::_ABSTRACTCONTAINER && ((modifier & ATTRB_ANONDELEGATE) == 0)) {\r\n\t\t\t// Create an unnested C++ equivalent\r\n\t\t\tpCnt->m_ownerInner = (AbstractContainer*)gCurrentNameSpace;\r\n\t\t\t\r\n\t\t\tAbstractContainer* pCntCpp = new AbstractContainer();\r\n\t\t\tchar buff[1024];\r\n\t\t\tstatic int gInnerClassOut = 0;\r\n\t\t\tsprintf(buff,\"%s_inner%i\",name,gInnerClassOut++);\r\n\t\t\tpCntCpp->setName(buff);\r\n\t\t\tpCntCpp->m_csharpRepresentation\t= pCnt;\r\n\t\t\tpCnt->m_cppRepresentation\t\t= pCntCpp;\r\n\r\n\t\t\tpCntCpp->m_attribute\t= attribute;\r\n\t\t\tpCntCpp->m_modifier\t\t= modifier;\r\n\t\t\tpCntCpp->m_noDump\t\t= g_noDump;\r\n\r\n\t\t\tNameSpace* pureNameSpace = gCurrentNameSpace;\r\n\t\t\twhile (pureNameSpace->getGenre() == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\t\tpureNameSpace = pureNameSpace->m_pParent;\r\n\t\t\t}\r\n\r\n\t\t\tpureNameSpace->addAbstractContainer(pCntCpp);\r\n\t\t}\r\n\t} else {\r\n\t\t// Previous class definition is reused.\r\n\t\tpCnt = (AbstractContainer*)fNewWorkingSpace;\r\n\t}\r\n\r\n\tPushSpace(gCurrentNameSpace);\r\n\tgCurrentNameSpace = pCnt;\r\n\r\n\treturn pCnt;\r\n}\r\n\r\nAbstractContainer*\tCreateClass\t(Attribute* attribute, u32 modifier, const char* name) {\r\n\treturn CreateInternal(attribute, modifier | ATT_CLASS, name);\r\n}\r\n\r\nAbstractContainer*\tCreateStruct(Attribute* attribute, u32 modifier, const char* name) {\r\n\treturn CreateInternal(attribute, modifier | ATT_STRUCT, name);\r\n}\r\n\r\nAbstractContainer*\tCreateInterface(Attribute* attribute, u32 modifier, const char* name) {\r\n\treturn CreateInternal(attribute, modifier | ATT_INTERFACE, name);\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/AbstractContainer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef ABSTRACTCONTAINER_H\r\n#define ABSTRACTCONTAINER_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"NameSpace.h\"\r\n#include \"TypeObject.h\"\r\n\r\n// Class and struct can have inner class/struct/interface\r\n// They act as a kind of namespace.\r\n// Support Interface inheritance mecanism\r\nclass AbstractContainer : public NameSpace {\r\npublic:\r\n\tAbstractContainer();\r\n\t~AbstractContainer();\r\n\r\n\tvirtual int getGenre();\r\n\tvirtual const char*\tgetName();\r\n\r\n\tTypeObject*\t\t\tgetType();\r\n\tAbstractContainer*\taddInheritance(TypeObject* type);\r\n\tvoid\t\t\t\tfixInheritance();\r\n\tVariable*\t\t\taddVariable(Attribute* attribute, u32 modifier, TypeObject* type, Variable* variable);\r\n\tAbstractContainer*\taddProperty(Attribute* attribute, u32 modifier, TypeObject* type, const char* name, Accessor* accessor);\r\n\tAbstractContainer*\taddProperty(Attribute* attribute, u32 modifier, Accessor* indexer);\r\n\tMethod*\t\t\t\taddConstructor(Attribute* attribute, u32 modifier, const char* name, Variable* params, Statement* code, Expression* initializerOpt, s32 optType);\r\n\tMethod*\t\t\t\taddDestructor(Attribute* attribute, u32 modifier, const char* name, Statement* code);\r\n\tMethod*\t\t\t\taddMethod(Attribute* attribute, u32 modifier, const char* name, Variable* params, Statement* code, TypeObject* returnType);\r\n\tVariable*\t\t\tfindMember(const char* name);\r\n\tMethod*\t\t\t\tfindMethod(const char* name, Expression* signature,\tTypeGenericEntry* genParams);\r\n\tMethod*\t\t\t\tfindMethod(const char* name, Variable* signature,\tTypeGenericEntry* genParams);\r\n\tMethod*\t\t\t\tfindDestructor();\r\n\tAccessor*\t\t\tfindProperty(const char* name);\r\n\tAccessor*\t\t\tfindPropertyIndexer(Expression* solvedSignatureList);\r\n\r\n\tvoid\t\t\t\tsetGenericParam();\r\n\tTypeObject*\t\t\tgetGenericType(TypeGenericDefinitionEntry* genericSymbol, TypeGenericEntry* genericParams);\r\n\r\n\tvoid\t\taddMethod\t\t\t(Method*\t\tpMethod);\r\n\tvoid\t\taddMember\t\t\t(Variable*\t\tpMember);\r\n\tvoid\t\taddAccessor\t\t\t(Accessor*\t\tpAccess);\r\n\tTypeObject*\tgetAncestor\t\t\t();\r\n\t\r\n\tconst char*\tgetTemplateParams\t();\r\n\tvoid\t\tdumpTemplateLabel\t();\r\n\tvoid\t\tdumpFriends\t\t\t();\r\n\tvoid\t\tdumpNested\t\t\t();\r\n\tvoid\t\tdumpPrototype\t\t(bool isInnerClass);\r\n\tvoid\t\trealDumpPrototype\t(bool isInnerClass, const char* fullName);\r\n\tvoid\t\tanalyzeComplete\t\t();\r\n\tvoid\t\tdumpInlineMethods\t(const char* prefix);\r\n\tvoid\t\tdumpAccessors\t\t(const char* prefix);\r\n\tvoid\t\tdumpImplementation\t(const char* prevNameSpace);\r\n\tvoid\t\tdumpMarshalledStruct(Variable* pVar);\r\n\tvoid\t\tgenerateMemberProcessGCCode();\r\n\tvoid\t\tgenerateMemberReleaseGCCode();\r\n\tvoid\t\tgenerateMemberAssignCode();\r\n\tvoid\t\tgenerateMemberMoveRefCode();\r\n\tvoid\t\tgenerateMemberRefCode(AbstractContainer* pCtx);\r\n\tconst char*\tgenerateTypeID();\r\n\r\n\tTypeGenericDefinitionEntry*\tm_genericParam;\r\n\r\n\tMethod**\t\t\tm_methods;\r\n\tint\t\t\t\t\tm_methodCount;\r\n\tVariable**\t\t\tm_members;\r\n\tint\t\t\t\t\tm_memberCount;\r\n\tAccessor**\t\t\tm_accessors;\r\n\tint\t\t\t\t\tm_accessorCount;\r\n\tTypeObject**\t\tm_inheritances;\r\n\tint\t\t\t\t\tm_inheritancesCount;\r\n\r\n\tAbstractContainer*\tm_ownerInner;\r\n\tAbstractContainer*\tm_cppRepresentation;\r\n\tAbstractContainer*\tm_csharpRepresentation;\r\n\r\n\tTypeObject*\t\t\tm_ancestor;\r\n\tAttribute*\t\t\tm_attribute;\r\n\tu32\t\t\t\t\tm_modifier;\r\n\tu32\t\t\t\t\tm_operator;\r\n\t\r\n\tu32\t\t\t\t\tm_referenceModifCount;\r\n\r\n\tbool\t\t\t\tm_bCreateDefaultCtor;\r\n\tbool\t\t\t\tm_bAsGCAbleMember;\r\n\r\n\tconst char*\t\t\tm_cacheFullName;\r\n\tVariable*\t\t\tm_pVariables;\r\n\r\n\tTypeObject\t\t\tmyType;\r\n\tvoid overrideType(TypeObject* pSolvedType);\r\n};\r\n\r\n/*\r\nclass Member {\r\npublic:\r\n\tbool\t\t\t\tm_isConst;\r\n\tTypeObject*\t\t\tm_type;\r\n\tu32\t\t\t\t\tm_attribute;\r\n\r\n};*/\r\n\r\nAbstractContainer*\tCreateClass\t(Attribute* attribute, u32 modifier, const char* name);\r\nAbstractContainer*\tCreateStruct(Attribute* attribute, u32 modified, const char* name);\r\nAbstractContainer*\tCreateInterface(Attribute* attribute, u32 modified, const char* name);\r\n\r\n#endif\tABSTRACT_CONTAINER_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Accessor.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"compilerLibrary.h\"\r\n\r\nAccessor::Accessor\t()\r\n:m_attribute\t\t(NULL)\r\n,m_type\t\t\t\t(NULL)\r\n,m_get\t\t\t\t(NULL)\r\n,m_set\t\t\t\t(NULL)\r\n,m_indexer\t\t\t(NULL)\r\n,m_statement\t\t(NULL)\r\n,m_ownerClass\t\t(NULL)\r\n,m_variable\t\t\t(NULL)\r\n,m_modifier\t\t\t(0)\r\n{\r\n}\r\n\r\nAccessor::~Accessor()\r\n{\r\n}\r\n\r\n/*virtual*/\r\nint Accessor::getGenre() {\r\n\treturn EGENRE::_ACCESSOR;\r\n}\r\n\r\nvoid Accessor::dumpParams(bool call, bool addComma) {\r\n\tVariable* pVar = m_variable;\r\n\tif(pVar) {\r\n\t\tNameSpace* context = (NameSpace*)m_ownerClass;\r\n\t\twhile(pVar) {\r\n\t\t\tif(!call) {\r\n\t\t\t\tprintf(\"%s \", pVar->m_type->dumpTypeForCode(context));\r\n\t\t\t}\r\n\t\t\tprintf(\"%s\", pVar->m_name);\r\n\t\t\tpVar = pVar->m_pNextVariable;\r\n\t\t\tif(pVar) {\r\n\t\t\t\tprintf(\", \");\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(addComma) {\r\n\t\t\tprintf(\", \");\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Attribute.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nSStructInfo::SStructInfo()\r\n:m_charSet\t\t(-1)\r\n,m_pack\t\t\t(-1)\r\n,m_layoutKind\t(-1)\r\n{\r\n}\r\n\r\nAttribute::Attribute() \r\n:m_expression\t\t(NULL)\r\n,m_type\t\t\t\t(NULL)\r\n,m_next\t\t\t\t(NULL)\r\n,m_child\t\t\t(NULL)\r\n,m_specifier\t\t(0)\r\n{\r\n}\r\n\r\nAttribute::~Attribute() \r\n{\r\n\tdelete m_expression;\r\n\tdelete m_type;\r\n\tdelete m_next;\r\n\tdelete m_child;\r\n}\r\n\r\nAttribute* Attribute::addChildAttribute(Attribute* pChild) {\r\n\tAttribute* p = m_child;\r\n\tif (p) {\r\n\t\twhile (p->m_next) { p = p->m_next; }\r\n\t\tp->m_next = pChild;\r\n\t} else {\r\n\t\tm_child = pChild;\r\n\t}\r\n\treturn this;\r\n}\r\n\r\nAttribute* Attribute::addAttribute(TypeObject* type, Expression* expr)\r\n{\r\n\tAttribute* pNewAttr = new Attribute();\r\n\tAttribute* p = this;\r\n\twhile (p->m_next) { p = p->m_next; }\r\n\tp->m_next = pNewAttr;\r\n\r\n\tthis->m_expression\t= expr;\r\n\tthis->m_type\t\t= type;\r\n\treturn this;\r\n}\r\n\r\nAttribute* Attribute::setSpecifier(u32 specifierAttrb) \r\n{\r\n\tthis->m_specifier |= specifierAttrb;\r\n\treturn this;\r\n}\r\n\r\nvoid Attribute::getMarshallingInfo(SMarshallingInfo& out_marshallingInfo) {\r\n\t//TODO : complete\r\n\tif(m_child) {\r\n\t\tm_child->getMarshallingInfo(out_marshallingInfo);\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->getMarshallingInfo(out_marshallingInfo);\r\n\t}\r\n\tif(m_expression) {\r\n\t\tif(strcmp(m_type->m_name, \"StructLayout\") == 0) {\r\n\t\t\tm_expression->getStructInfo(out_marshallingInfo.m_structInfo);\r\n\t\t} else {\r\n\t\t\t//TODO\r\n\t\t}\r\n\t}\r\n}\r\n\r\nAttribute*  CreateAttribute(TypeObject* type, Expression* expr) {\r\n\tAttribute* attr\t\t= new Attribute();\r\n\tattr->m_expression\t= expr;\r\n\tattr->m_type\t\t= type;\r\n\tif (type) {\r\n\t\tif (strcmp(type->getName(),\"DllImport\") == 0) {\r\n\t\t\t// Mark the attribute with an \"external\" tag as hint.\r\n\t\t\tattr->m_specifier |= ATT_EXTERN;\r\n\t\t\tbool callConv = false;\r\n\t\t\tif (expr) {\r\n\t\t\t\tif (expr->m_expressionType == EXPR_LIST) {\r\n\t\t\t\t\tint n = 0;\r\n\t\t\t\t\twhile (n < expr->m_expressionCount) {\r\n\t\t\t\t\t\tExpression* p = expr->m_expressions[n];\r\n\t\t\t\t\t\tif (p->m_expressionType == EXPR_ASS_EQ) {\r\n\t\t\t\t\t\t\tif (p->m_expressionCount == 2) {\r\n\t\t\t\t\t\t\t\tif ((p->m_expressions[0]->m_expressionType == EXPR_IDENT) && (p->m_expressions[1]->m_expressionType == EXPR_DOT)) {\r\n\t\t\t\t\t\t\t\t\tif (strcmp(p->m_expressions[0]->m_text, \"CallingConvention\") == 0) {\r\n\t\t\t\t\t\t\t\t\t\tif (strcmp(p->m_expressions[1]->m_text, \"Cdecl\")!=0) {\r\n\t\t\t\t\t\t\t\t\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Do NOT support other interface convention than Cdecl for now, please check your DllImport attribute\");\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tcallConv = true;\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tn++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (callConv == false) {\r\n\t\t\t\tcompilerError(ERR_USER, \"Calling convention not defined at all, for now 'Cdecl' is the only supported convention.\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn attr;\r\n}\r\n\r\nAttribute*\tCreateAttributeWithChild(Attribute* attr) {\r\n\tAttribute* newAttr\t\t= new Attribute();\r\n\tnewAttr->addChildAttribute(attr);\r\n\treturn newAttr;\r\n}"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Attribute.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef ATTRIBUTE_H\r\n#define ATTRIBUTE_H\r\n\r\n#include \"BaseType.h\"\r\n\r\ntypedef struct SStructInfo {\r\npublic:\r\n\ts32 m_charSet;\r\n\ts32 m_pack;\r\n\ts32 m_layoutKind;\r\n\r\n\tSStructInfo();\r\n} SStructInfo ;\r\n\r\ntypedef struct {\r\npublic:\r\n\tSStructInfo m_structInfo;\r\n} SMarshallingInfo ;\r\n\r\nclass Attribute {\r\npublic:\r\n\tAttribute();\r\n\t~Attribute();\r\n\r\n\tAttribute*\taddAttribute(TypeObject* type, Expression* expr);\t// return this\r\n\tAttribute*\taddChildAttribute(Attribute* attr);\r\n\tAttribute*\tsetSpecifier(u32 specifierAttrb);\r\n\r\n\tvoid\t\tgetMarshallingInfo(SMarshallingInfo& out_marshallingInfo);\r\n\r\n\tTypeObject*\tm_type;\r\n\tExpression*\tm_expression;\r\n\tAttribute*\tm_next;\r\n\tAttribute*\tm_child;\r\n\tu32\t\t\tm_specifier;\r\n};\r\n\r\nAttribute*  CreateAttribute(TypeObject* type, Expression* expr);\r\nAttribute*\tCreateAttributeWithChild(Attribute* attr);\r\n\r\n#endif\t//ATTRIBUTE_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/BaseType.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef BASETYPE_H\r\n#define BASETYPE_H\r\n\r\n#include <string>\r\n#include <iostream>\r\n\r\n#pragma warning( disable : 4996 )\r\n#pragma warning( disable : 4482 )\r\n\r\n#define EXPAND(count,arr,item)\texpand(&count,(void***)&arr,(void*)item)\r\n\r\n#define CLEAR(a,b)\t\tfor (int n=0; n < b; n++) {\\\r\n\t\t\t\t\t\t\tdelete a[n];\\\r\n\t\t\t\t\t\t} delete[] a; b\t= 0; a = NULL\r\n\r\n#define CS_Assert(a,b)\t\t;\r\n#define CS_assertAlways(a)\t;\r\n\r\n// -----------------------------------------------------------------------\r\n// Global Types\r\n// -----------------------------------------------------------------------\r\ntypedef int\t\t\t\t\ts32;\r\ntypedef unsigned int\t\tu32;\r\ntypedef short\t\t\t\ts16;\r\ntypedef unsigned short\t\tu16;\r\ntypedef char\t\t\t\ts8;\r\ntypedef unsigned char\t\tu8;\r\ntypedef long long           s64;\r\ntypedef unsigned long long  u64;\r\ntypedef unsigned int\t\tptrAsInt;\r\ntypedef u16\t\t\t\t\tuniChar;\r\ntypedef\tu32\t\t\t\t\tuint;\r\ntypedef u8\t\t\t\t\tbyte;\r\ntypedef s8\t\t\t\t\tsbyte;\r\n#ifndef NULL\r\n\t#define NULL\t\t\t(0)\r\n#endif\r\n\r\n// -----------------------------------------------------------------------\r\n//  Classes used by the compiler to describe all the item in the C# Language.\r\n// -----------------------------------------------------------------------\r\n/** Base class for all named symbol **/\r\nclass SymbolDictionnary;\r\nclass Symbol;\r\nclass AbstractContainer;\t// Struct, Class, Interface use same holder to simplify implementation.\r\nclass Accessor;\r\nclass Attribute;\r\nclass Argument;\r\nclass Enum;\r\nclass Method;\r\nclass NameSpace;\r\nclass Uses;\r\nclass TypeObject;\r\nclass Expression;\r\nclass Statement;\r\nclass Variable;\r\nclass Indexer;\r\nclass Delegate;\r\n\r\nenum EGENRE {\r\n\t_UNDEFGENRE\t\t\t= 0,\r\n\t_ABSTRACTCONTAINER\t= 0x0001,\r\n\t_DELEGATE\t\t\t= 0x0002,\r\n\t_ENUM\t\t\t\t= 0x0004,\r\n\t_MEMBER\t\t\t\t= 0x0008,\r\n\t_VARIABLE\t\t\t= 0x0010,\r\n\t_METHOD\t\t\t\t= 0x0020,\r\n\t_ACCESSOR\t\t\t= 0x0040,\r\n\t_STATEMENT\t\t\t= 0x0080,\r\n\t_NAMESPACE\t\t\t= 0x0100,\r\n\t_ENUMENTRY\t\t\t= 0x0200,\r\n\t_GENDEFENTRY\t\t= 0x0400,\r\n\t_METHODLIST\t\t\t= 0x0800,\r\n};\r\n\r\nstruct SRSymbol {\r\n\tSymbol*\t\tpSymbol;\r\n\tEGENRE\t\tsymbolType;\r\n\tTypeObject*\tpType;\r\n\r\n\tvoid dump(bool assignSide);\r\n};\r\n\r\nstruct StringID {\r\n\tint\t\t\tm_id;\r\n\tconst char*\tm_str;\r\n\tStringID*\tm_next;\r\n\tbool\t\tm_isDumped;\r\n};\r\n\r\nstruct SValue {\r\n\tSValue();\r\n\r\n\tunion {\r\n\t\tdouble\t\t\t\td;\r\n\t\tfloat\t\t\t\tf;\r\n\t\ts64\t\t\t\t\tl;\r\n\t\tu64\t\t\t\t\tul;\r\n\t\ts32\t\t\t\t\ti;\r\n\t\tu32\t\t\t\t\tui;\r\n\t\tconst char*\t\t\tstr;\r\n\t\tvoid*\t\t\t\tptr;\r\n\t} v;\r\n\tint type;\r\n\tint strLen;\r\n\tStringID* pString;\r\n\r\n\tstatic int\t\toperatorType(SValue& a, SValue& b);\r\n\tSValue\tToType\t\t(int type);\r\n};\r\n\r\n// -----------------------------------------------------------------------\r\n//\tDefined Type used by the compiler for :\r\n//\t- Differenciate type within an abstract container\r\n//  - Differenciate user type from predefined type\r\n//  - Native type from instances of objets/ref\r\n// -----------------------------------------------------------------------\r\n\r\nconst u32\tET_CLASS\t\t= 0x01000000;\r\nconst u32\tET_INTERFACE\t= 0x02000000;\r\nconst u32\tET_STRUCT\t\t= 0x03000000;\r\n\r\nconst u32\tET_COMPLEXMASK\t= 0x0000FFFF;\r\nconst u32\tET_INFOMASK\t\t= 0x00F00000;\r\nconst u32\tET_PRIMITIVEMASK= 0xFF000000;\r\n\r\nconst u32\tET_USERSPACE\t= 0x00800000;\r\nconst u32\t_TYPE_USEROBJECT= ET_USERSPACE;\r\nconst u32\tET_PREINSTALL\t= 0x00400000;\r\nconst u32\tET_ARRAY\t\t= 0x00200000;\r\n\r\nconst u32\tET_BASETYPE\t\t= 0x80000000;\r\nconst u32\tET_SIGNEDTYPE\t= 0x40000000;\r\nconst u32\tET_NUMBER\t\t= 0x20000000;\r\nconst u32\tET_POINTER\t\t= 0x10000000;\r\n\r\nconst u32\tET_SIZE_1\t\t= 1;\r\nconst u32\tET_SIZE_2\t\t= 2;\r\nconst u32\tET_SIZE_4\t\t= 4;\r\nconst u32\tET_SIZE_8\t\t= 8;\r\n\r\nconst u32\tET_VOID\t\t\t= ET_BASETYPE\t| 0;\r\nconst u32\tET_BOOL\t\t\t= ET_BASETYPE\t| 0x11;\r\nconst u32\tET_NULL\t\t\t= ET_BASETYPE\t| 0x12;\r\nconst u32\tET_INTPTR\t\t= ET_BASETYPE\t| 0x13;\r\nconst u32\tET_INT8\t\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_1;\r\nconst u32\tET_INT16\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_2;\r\nconst u32\tET_INT32\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_4;\r\nconst u32\tET_INT64\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_8;\r\nconst u32\tET_UINT8\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_1;\r\nconst u32\tET_UINT16\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_2;\r\nconst u32\tET_UINT32\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_4;\r\nconst u32\tET_UINT64\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_8;\r\nconst u32\tET_CHAR\t\t\t= ET_UINT16\t\t| 0x20; // Just to make sure that CHAR and UINT16 have actually a unique code.\r\nconst u32\tET_FLOAT\t\t= ET_BASETYPE\t| ET_NUMBER\t\t|\tET_SIZE_4;\r\nconst u32\tET_DOUBLE\t\t= ET_BASETYPE\t| ET_NUMBER\t\t|\tET_SIZE_8;\r\n\r\n//\r\n// Standard Types\r\n//\r\nenum EnumTypeObject {\r\n\tTYPE_UNRESOLVED\t\t= 0x7FFFFFFF,\r\n\tTYPE_UNDEFINED\t\t= TYPE_UNRESOLVED,\r\n\tTYPE_SBYTE\t\t\t= ET_INT8,\r\n\tTYPE_BYTE\t\t\t= ET_UINT8,\r\n\tTYPE_SHORT\t\t\t= ET_INT16,\r\n\tTYPE_USHORT\t\t\t= ET_UINT16,\r\n\tTYPE_INT\t\t\t= ET_INT32,\r\n\tTYPE_UINT\t\t\t= ET_UINT32,\r\n\tTYPE_LONG\t\t\t= ET_INT64,\r\n\tTYPE_ULONG\t\t\t= ET_UINT64,\r\n\tTYPE_CHAR\t\t\t= ET_CHAR,\r\n\tTYPE_FLOAT\t\t\t= ET_FLOAT,\r\n\tTYPE_DOUBLE\t\t\t= ET_DOUBLE,\r\n\tTYPE_BOOL\t\t\t= ET_BOOL,\r\n\tTYPE_OBJECT\t\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFF,\t// Object\tis 0xFFFF\r\n\tTYPE_STRING\t\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFC,\t// String\tis 0xFFFC\r\n\tTYPE_ARRAY\t\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFB,\t// Array\tis 0xFFFB\r\n\tTYPE_DELEGATE\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFA,\t// Delegate\tis 0xFFFA\r\n\tTYPE_VOID\t\t\t= ET_VOID,\r\n\tTYPE_INTPTR\t\t\t= ET_INTPTR,\r\n\tTYPE_NULL\t\t\t= ET_NULL\t// Only in constant int type.\r\n};\r\n\r\n\r\n//\r\n// Standard Attributes\r\n//\r\nenum EATTRIBUTE {\r\n\tATT_STATIC\t\t= 0x00000001,\r\n\tATT_PUBLIC\t\t= 0x00000002,\r\n\tATT_PRIVATE\t\t= 0x00000004,\r\n\tATT_PROTECTED\t= 0x00000008,\r\n\tATT_INTERNAL\t= 0x00000010,\r\n\tATT_UNSAFE\t\t= 0x00000020,\r\n\tATT_VIRTUAL\t\t= 0x00000040,\r\n\tATT_FINAL\t\t= 0x00000080,\r\n\tATT_NATIVE\t\t= 0x00000100,\r\n\tATT_ABSTRACT\t= 0x00000200,\r\n\tATT_OPERATOR\t= 0x00000400,\r\n\tATT_READONLY\t= 0x00000800,\r\n\tATT_VOLATILE\t= 0x00001000,\r\n\tATT_CTOR\t\t= 0x00002000,\r\n\tATT_DTOR\t\t= 0x00004000,\r\n\tATT_NEW\t\t\t= 0x00008000,\r\n\tATT_CONST\t\t= 0x00010000,\t// Same as read only ?\r\n\tATT_SEALED\t\t= 0x00000080,\t// Same as FINAL\r\n\tATT_EXTERN\t\t= 0x00020000,\r\n\tATT_PARTIAL\t\t= 0x00000400,\t// Same as OPERATOR but no conflict : use only for class/interface/struct.\r\n\r\n\tATTR_NEW\t\t= 0x00040000,\r\n\t// Attribute type\r\n\tATTRB_ASSEMBLY\t= 0x80000000,\r\n\tATTRB_ANONDELEGATE\t= 0x40000000,\t// Same as FIELD.\r\n\tATTRB_FIELD\t\t= 0x40000000,\r\n\tATTRB_EVENT\t\t= 0x20000000,\r\n\tATTRB_METHOD\t= 0x10000000,\r\n\tATTRB_MODULE\t= 0x08000000,\r\n\tATTRB_PARAM\t\t= 0x04000000,\r\n\tATTRB_PROPERTY\t= 0x02000000,\r\n\tATTRB_RETURN\t= 0x01000000,\r\n\tATTRB_TYPE\t\t= 0x00800000,\r\n\r\n\t// Attribute for param.\r\n\tATT_REF\t\t\t= 0x00400000,\r\n\tATT_OUT\t\t\t= 0x00200000,\r\n\r\n\tATT_CLASS\t\t= 0x00100000,\r\n\tATT_STRUCT\t\t= 0x00080000,\r\n\tATT_INTERFACE\t= 0x00040000,\t// Same as new.\r\n};\r\n\r\n//\r\n// All possible expression AST type.\r\n//\r\nenum EnumExpressionType {\r\n\t// Multiple\r\n\tEXPR_LIST,\r\n\tEXPR_LIST_INIT,\r\n\r\n\t// Create a delegate code, class definition, etc...\r\n\tEXPR_DELEGATECREATE,\r\n\r\n\t// Leaf\r\n\tEXPR_THIS,\r\n\tEXPR_UNDER_THIS,\t// Internal special this for delegate implementation.\r\n\tEXPR_TYPEOF,\t// + Type\r\n\tEXPR_BASE,\r\n\tEXPR_CTE,\r\n\tEXPR_IDENT,\r\n\r\n\t// Single\r\n\tEXPR_REF,\r\n\tEXPR_PLUSPLUS,\r\n\tEXPR_MINUSMINUS,\r\n\tEXPR_ARROW,\t\t// + Id\r\n\tEXPR_NOT,\t\t// !\r\n\tEXPR_LNOT,\t\t// ~\r\n\tEXPR_ADRESSOF,\r\n\tEXPR_SIZEOF,\t// + Type\r\n\tEXPR_PREINCR,\r\n\tEXPR_PREDECR,\r\n\tEXPR_UNARYPLUS,\r\n\tEXPR_UNARYMINUS,\r\n\tEXPR_UNARYMULT,\r\n\tEXPR_IS,\r\n\tEXPR_AS,\r\n\tEXPR_UNCHECKED,\r\n\tEXPR_CHECKED,\r\n\r\n\t// Double & Single\r\n\tEXPR_ACCESS,\t// + Expr|Id\r\n\tEXPR_NEW,\t\t// + Type\r\n\t\r\n\t// Double\r\n\tEXPR_DOT,\r\n\tEXPR_INVOKE,\r\n\tEXPR_CAST,\r\n\tEXPR_CAST_PTR,\r\n\tEXPR_MULT,\r\n\tEXPR_DIV,\r\n\tEXPR_MOD,\r\n\tEXPR_PLUS,\r\n\tEXPR_MINUS,\r\n\tEXPR_LSHFT,\r\n\tEXPR_RSHFT,\r\n\tEXPR_LESS,\r\n\tEXPR_MORE,\r\n\tEXPR_LESSEQ,\r\n\tEXPR_MOREEQ,\r\n\tEXPR_EQUTST,\r\n\tEXPR_DIFFTST,\r\n\tEXPR_LAND,\r\n\tEXPR_LXOR,\r\n\tEXPR_LOR,\r\n\tEXPR_AND,\r\n\tEXPR_OR,\r\n\tEXPR_XOR,\r\n\t\r\n\t// Double (Assignment)\r\n\tEXPR_ASS_EQ,\r\n\tEXPR_ASS_PLUSEQ,\r\n\tEXPR_ASS_MINUSEQ,\r\n\tEXPR_ASS_STAREQ,\r\n\tEXPR_ASS_DIVEQ,\r\n\tEXPR_ASS_MODEQ,\r\n\tEXPR_ASS_XOREQ,\r\n\tEXPR_ASS_ANDEQ,\r\n\tEXPR_ASS_OREQ,\r\n\tEXPR_ASS_RSHFTEQ,\r\n\tEXPR_ASS_LSHFTEQ,\r\n\t\r\n\t// Triple\r\n\tEXPR_COND,\r\n\t\r\n};\r\n\r\nenum EnumStatementType {\r\n\tSTM_UNDEFINED,\r\n\r\n\tSTM_BLOCK,\r\n\tSTM_NILWRAPPER,\t// Empty expression.\r\n\tSTM_NULL,\r\n\tSTM_LABEL,\r\n\tSTM_LOCALVAR,\r\n\tSTM_LOCAL_PERVAR,\r\n\tSTM_WRAP_EXP,\r\n\tSTM_ASSIGN_EXPR,\r\n\tSTM_WRAPPER_POSTINCR,\r\n\tSTM_WRAPPER_POSTDECR,\r\n\tSTM_WRAPPER_PREINCR,\r\n\tSTM_WRAPPER_PREDECR,\r\n\tSTM_IF,\r\n\tSTM_SWITCH,\r\n\tSTM_CASE,\r\n\tSTM_CASEDEFAULT,\r\n\tSTM_UNSAFE,\r\n\tSTM_WHILE,\r\n\tSTM_DOWHILE,\r\n\tSTM_FOR,\r\n\tSTM_FOREACH,\r\n\tSTM_BREAK,\r\n\tSTM_CONTINUE,\r\n\tSTM_GOTO,\r\n\tSTM_GOTOCASE,\r\n\tSTM_GOTODEFAULT,\r\n\tSTM_RETURN,\r\n\tSTM_THROW,\r\n\tSTM_TRY,\r\n\tSTM_CATCH,\r\n\tSTM_FINALLY,\r\n\tSTM_CHECKED,\r\n\tSTM_UNCHECKED,\r\n\tSTM_LOCK,\r\n\tSTM_USING,\r\n};\r\n\r\nenum EOVEROP {\r\n\tOP_PLUS,\r\n\tOP_MINUS,\r\n\tOP_LNOT,\r\n\tOP_NOT,\r\n\tOP_PLUSPLUS,\r\n\tOP_MINUSMINUS,\r\n\tOP_TRUE,\r\n\tOP_FALSE,\r\n\tOP_MULT,\r\n\tOP_DIV,\r\n\tOP_MOD,\r\n\tOP_AND,\r\n\tOP_OR,\r\n\tOP_XOR,\r\n\tOP_LSHFT,\r\n\tOP_RSHFT,\r\n\tOP_EQUAL,\r\n\tOP_DIFF,\r\n\tOP_MORE,\r\n\tOP_LESS,\r\n\tOP_MOREEQ,\r\n\tOP_LESSEQ,\r\n};\r\n\r\nenum ECOMPARISON {\r\n\tCOMP_BETTER,\r\n\tCOMP_EQUIVALENT,\r\n\tCOMP_WORSE,\r\n};\r\n\r\nenum EMATCH {\r\n\tM_IDENTICAL, \r\n\tM_APPLICABLE,\r\n\tM_MISMATCH,\r\n};\r\n\r\n// -----------------------------------------------------------------------\r\n// Compiler Specific Define & Functions\r\n// -----------------------------------------------------------------------\r\nenum EnumError {\r\n\tERR_INTERNAL,\r\n\tERR_NOT_SUPPORTED,\r\n\tERR_NOT_SUPPORTED_YET,\r\n\tERR_USER,\r\n\tERR_COMMAND_LINE,\r\n};\r\n\r\n// Compiler options\r\nconst u32\tCOMPIL_USE_FRAMEWORK\t= 0x00000001;\r\nconst u32\tCOMPIL_IS_FRAMEWORK\t\t= 0x00000002;\r\nconst u32\tCOMPIL_MODE_IGNORE\t\t= 0x00000004;\r\n\r\nvoid compilerError(EnumError err, const char* format, int lineNumber = -1);\r\nvoid expand(int* count, void*** array_, void* newEntry);\r\n\r\n#endif\t//BASETYPE_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/CompilerProject.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// CompilerProject.cpp : Defines the entry point for the console application.\r\n//\r\n\r\n#include \"stdafx.h\"\r\n#include \"y.tab.h\"\r\n#include \"dirent.h\"\r\n#include \"compilerLibrary.h\"\r\nextern int yylineno;\r\n\r\nstruct SCmdLineInfos {\r\npublic :\r\n\tconst char*\t\tuserPath;\r\n\tconst char*\t\tframeworkPath;\r\n\tconst char*\t\toutputPath;\r\n\tconst char*\t\tparsedFiles[50];\r\n\tint\t\t\t\tparsedFileCount;\r\n\tbool\t\t\tcompileFramework;\r\n\tbool\t\t\tignoreMode;\r\n\r\n\tSCmdLineInfos()\r\n\t\t:userPath\t\t\t(NULL)\r\n\t\t,frameworkPath\t\t(NULL)\r\n\t\t,outputPath\t\t\t(NULL)\r\n\t\t,parsedFileCount\t(0)\r\n\t\t,compileFramework\t(false)\r\n\t\t,ignoreMode\t\t\t(false)\r\n\t{\r\n\t}\r\n};\r\n\r\nbool contains(const char** nameArray, int size, const char* name)\r\n{\r\n\tif(nameArray && name)\r\n\t{\r\n\t\tfor(int i=0 ; i<size ; i++)\r\n\t\t{\r\n\t\t\tif(strcmp(nameArray[i], name) == 0)\r\n\t\t\t{\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool isFile(const char* path)\r\n{\r\n\tfor(int i = strlen(path); i >= 0 && path[i] != '\\\\' ; i--) {\r\n\t\tif(path[i] == '.')\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool isValid(const char* path)\r\n{\r\n\tfor(int i = 0 ; i < (int)strlen(path) ; i++) {\r\n\t\tif(path[i] == '/') {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n}\r\n\r\n// Returns the name of the file without its path.\r\nconst char* fileName(const char* path)\r\n{\r\n\tchar buf[500];\r\n\tint i = strlen(path);\r\n\tfor(; i >= 0 && path[i] != '\\\\' ; i--);\r\n\tif(path[i] == '\\\\')\r\n\t{\r\n\t\tmemcpy(buf, path + (++i)*sizeof(char), strlen(path) + 1 - i);\r\n\t\treturn strdup(buf);\r\n\t}\r\n\treturn strdup(path);\r\n}\r\n\r\nu16*  g_stack[500];\r\nu16   g_level;\r\n\r\nstatic const int START_GENERIC = 256;\r\nstatic const int END_GENERIC = 257;\r\n\r\n// a << b > c\r\n// a < b >> c\r\n\r\nbool analyzeText(u16* firstChar, u16* lastChar) {\r\n\tbool inComment = false;\r\n\t// Only < > , . [ ] a-zA-Z0-9\r\n\twhile (firstChar <= lastChar) {\r\n\t\tbool isValid \r\n\t\t\t    = \t(*firstChar == '<') || (*firstChar == '>') || (*firstChar == ',') || \r\n\t\t\t\t\t(*firstChar == '[') || (*firstChar == ']') || (*firstChar == '.');\r\n\t\t\t\t\t\t\r\n\t\tisValid = isValid \t|| ((*firstChar >= 'A') && (*firstChar <= 'Z')) \r\n\t\t\t\t\t\t\t|| ((*firstChar >= 'a') && (*firstChar <= 'z')) \r\n\t\t\t\t\t\t\t|| ((*firstChar >= '0') && (*firstChar <= '9'));\r\n\t\t\t\t\t\t\t\t\r\n\t\tisValid = isValid || (*firstChar <= ' ');\t// Less than space.\r\n\t\tisValid = isValid || (*firstChar == '@');\r\n\r\n\t\tif (*firstChar == '/') {\r\n\t\t\tif (inComment == false) {\r\n\t\t\t\tif ((firstChar < lastChar) && (firstChar[1]=='*')) {\r\n\t\t\t\t\tinComment = true;\r\n\t\t\t\t\tfirstChar += 2;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (*firstChar == '*') {\r\n\t\t\tif (inComment == true) {\r\n\t\t\t\tif ((firstChar < lastChar) && (firstChar[1]=='/')) {\r\n\t\t\t\t\tinComment = false;\r\n\t\t\t\t\tfirstChar += 2;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ((isValid == false) && (inComment == false)) {\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tfirstChar++;\r\n\t}\r\n\t\t\r\n\treturn true;\r\n}\r\n\r\nbool patchBlock(int level, u16* pChar) {\r\n\tif (analyzeText(g_stack[level],pChar-1) == true) {\r\n\t\t*(g_stack[level]-1)\t= START_GENERIC;\r\n\t\t*pChar\t\t\t\t= END_GENERIC;\r\n\t\treturn true;\r\n\t} else {\r\n\t\t// Do nothing.\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid patchFile(u16* file, int length) {\r\n\tu16* pChar = file;\r\n\twhile (pChar != &file[length]) {\r\n\t\tif (*pChar == '<') {\r\n\t\t\t// Guard against a << b > c pattern.\r\n\t\t\t// << force next > to be non related.\r\n\t\t\tif ((&pChar[1] != &file[length]) && (pChar[1] == '<')) {\r\n\t\t\t\t// Do nothing.\r\n\t\t\t} else {\r\n\t\t\t\tg_stack[g_level++] = pChar+1;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\tif (*pChar == '>') {\r\n\t\t\tif ((&pChar[1] != &file[length]) && (pChar[1] == '>')) {\r\n\t\t\t\tif (g_level >= 2) {\r\n\t\t\t\t\t// Perform patch parent FIRST\r\n\t\t\t\t\t// Then decide from patch or not for child\r\n\t\t\t\t\tbool isGeneric = patchBlock(g_level-2, &pChar[1]);\r\n\t\t\t\t\tif (isGeneric) {\r\n\t\t\t\t\t\t// Patch\r\n\t\t\t\t\t\tpatchBlock(g_level-1, pChar);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Do nothing.\r\n\t\t\t\t\t}\r\n\t\t\t\t\tg_level -= 2;\r\n\t\t\t\t} else if (g_level == 1) {\r\n\t\t\t\t\tg_level--;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (g_level > 0) {\r\n\t\t\t\t\tg_level--;\r\n\t\t\t\t\tpatchBlock(g_level, pChar);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\tif (*pChar == 0xD) {\r\n\t\t\twhile (g_level != 0) {\r\n\t\t\t\tg_level--;\r\n\t\t\t\tpatchBlock(g_level, pChar);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\tpChar++;\r\n\t}\r\n}\r\n\t\r\nvoid generate(u16* file, int length, char* result) {\r\n\tu16* pChar = file;\r\n\twhile (pChar != &file[length]) {\r\n\t\tif (*pChar == START_GENERIC) {\r\n\t\t\t*result++ = '$';\r\n\t\t\t*result++ = '<';\r\n\t\t} else if (*pChar == END_GENERIC) {\r\n\t\t\t*result++ = '$';\r\n\t\t\t*result++ = '>';\r\n\t\t} else {\r\n\t\t\t*result++ = (char)*pChar;\r\n\t\t}\r\n\t\tpChar++;\r\n\t}\r\n\t*result++ = 0;\r\n}\r\n\r\nconst char* preprocess(const char* input, const char*& allocated8Buff) {\r\n\tint length = strlen(input) + 1;\r\n\t// 1. Allocate u16 buffer\r\n\tu16* pu16 = new u16[length];\r\n\tu16* fill = pu16;\r\n\r\n\t// 2. Copy 8->16 bit\r\n\tconst char* pOrig = input;\r\n\twhile (*pOrig) {\r\n\t\t*fill++ = *pOrig++;\r\n\t}\r\n\t*fill++ = 0;\r\n\r\n\t// 3. Parse\r\n\tpatchFile(pu16, length);\r\n\r\n\t// 4. Generate\r\n\tchar* p8 = new char[length*2];\t// Need to allocate more in case of.\r\n\tallocated8Buff = p8;\r\n\tgenerate(pu16, length, p8);\r\n\treturn p8;\r\n}\r\n\r\nvoid recurse(const char* folder, const char** parsedFiles, int parsedFileCount, u32 compilerOptions) {\r\n\tDIR *pDIR;\r\n\tstruct dirent *entry;\r\n\tbool ignoreMode = ((compilerOptions & COMPIL_MODE_IGNORE) != 0);\r\n\tif (pDIR=opendir(folder)) {\r\n\t\t// Force all the entries in the directory...\r\n\t\twhile(entry = readdir(pDIR)){\r\n\t\t\tif( strcmp(entry->d_name, \".\") != 0 && strcmp(entry->d_name, \"..\") != 0 ) {\r\n\t\t\t\tchar buff[1000];\r\n\t\t\t\tsprintf(buff, \"%s\\\\%s\",folder, entry->d_name);\r\n\t\t\t\trecurse(buff, parsedFiles, parsedFileCount, compilerOptions);\r\n\t\t\t}\r\n\t\t}\r\n\t\tclosedir(pDIR);\r\n    } else {\r\n\t\t// May be a file ?\r\n\t\tint strLen = strlen(folder);\r\n\t\tif (folder[strLen-3]=='.' \r\n\t\t\t&& folder[strLen-2]=='c' \r\n\t\t\t&& folder[strLen-1]=='s'\r\n\t\t\t&& (parsedFileCount == 0\r\n\t\t\t\t|| (contains(parsedFiles, parsedFileCount, fileName(folder)) != ignoreMode))) {\r\n\t\t\tfprintf(stderr,\"### Try Process File : %s ###\\n\", folder);\r\n\t\t\t// Load file in memory\r\n\t\t\tFILE* pFile = fopen((const char*)folder, \"rb\");\r\n\t\t\tif (pFile) {\r\n\t\t\t\tfprintf(stderr,\"### Do Process File : %s ###\\n\", folder);\r\n\t\t\t\tfseek (pFile, 0, SEEK_END);   // non-portable\r\n\t\t\t\tint size=ftell (pFile);\r\n\r\n\t\t\t\tchar* buff = new char[size+1];\r\n\t\t\t\tbuff[size] = 0; // close file as C string.\r\n\r\n\t\t\t\trewind (pFile);\r\n\t\t\t\tfread(buff, size, 1, pFile);\r\n\r\n\t\t\t\tfclose (pFile);\r\n\r\n\t\t\t\t// Test Header.\r\n\t\t\t\tunsigned char* input = (unsigned char*) buff;\r\n\t\t\t\tif ((input[0] == 0xEF) && (input[1] == 0xBB) && (input[2] == 0xBF)) {\r\n\t\t\t\t\tinput += 3;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Pass the stream.\r\n\t\t\t\tresetLocalFileInfo();\r\n\t\t\t\tyylineno = 1;\r\n\t\t\t\tconst char* pDelete;\r\n\t\t\t\tint result = runCompiler(preprocess((const char*)input,pDelete));\r\n\t\t\t\tdelete[] pDelete;\r\n\t\t\t\tdelete[] buff;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tfprintf(stderr,\"### Failed to Open File : %s ###\\n\", folder);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid displayHelp() {\r\n\tprintf(\"\\n\");\r\n\tprintf(\"##############################################################\\n\");\r\n\tprintf(\"#                            Help                            #\\n\");\r\n\tprintf(\"##############################################################\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"* Command line options\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-o or -or\\n\");\r\n\tprintf(\"Description : Tells the output path (relative).\\n\");\r\n\tprintf(\"              If no output option is used, the result will be displayed in the console.\\n\");\r\n\tprintf(\"Argument : Output path, including the file name\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-oa\\n\");\r\n\tprintf(\"Description :  Tells the output path (absolute).\\n\");\r\n\tprintf(\"               If no output option is used, the result will be displayed in the console.\\n\");\r\n\tprintf(\"Argument : Full output path, including the file name\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-user\\n\");\r\n\tprintf(\"Description : Tells the path to the user project directory.\\n\");\r\n\tprintf(\"              If this option is not used, the first command line argument needs to be this path.\\n\");\r\n\tprintf(\"Argument : Full path to the project directory.\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-framework\\n\");\r\n\tprintf(\"Description : When a project which uses the framework is compiled, tells the path to the framework directory.\\n\");\r\n\tprintf(\"Argument : Full path to the framework directory.\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-compileframework\\n\");\r\n\tprintf(\"Description : Used to compile the framework only.\\n\");\r\n\tprintf(\"              In this case, -framework is not used and -user is the path to the framework.\\n\");\r\n\tprintf(\"Argument : None.\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-ignore\\n\");\r\n\tprintf(\"Description : Rather than parsing the mentioned files only, the compiler will parse all the files \\n\");\r\n\tprintf(\"              except the ones which have been enumerated.\\n\");\r\n\tprintf(\"Argument : None.\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"-h or -help\\n\");\r\n\tprintf(\"Description : Displays this menu.\\n\");\r\n\tprintf(\"Argument : None.\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"* Compilation process\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"- Make sure that your C# project compiles in C#.\\n\");\r\n\tprintf(\"- Check that it does not contain restricted functionalities.\\n\");\r\n\tprintf(\"- Launch the compilation. The basic syntax for the command line is :\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"  CompilerProject.exe <path to the project> [<C# file to parse 1> <C# file to parse 2> <...>] [-o <output file name>]\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"  If no parsed file is explicited, every C# file of the folder will be recursively parsed.\\n\");\r\n\tprintf(\"  For further explanation, see the description of the command line options above.\\n\");\r\n\tprintf(\"- Place the inline (.inl) files generated by the compiler into the \\\"inline\\\" folder of the \\\"RuntimeLibrary\\\" folder.\\n\");\r\n\tprintf(\"- If your project uses the game engine framework, you also need to compile it once, as described below.\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"* How to compile the framework\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"- Launch the compiler with the following command line :\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"  CompilerProject.exe <path to the framework folder> -oa <output path> -compileframework\\n\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"- Include the generated files (framework.h and framework.cpp) in your C++ project.\\n\");\r\n\tprintf(\"- Do not forget to compile the framework again if changes are made in C#.\\n\");\r\n\tprintf(\"\\n\");\r\n\tsystem(\"Pause\");\r\n}\r\n\r\nbool extractArgs(int argc, const char** argv, SCmdLineInfos* infos)\r\n{\r\n\tbool relativePath = false;\r\n\tint i = 1;\r\n\r\n\tif(argc < 2) {\r\n\t\tcompilerError(ERR_COMMAND_LINE, \"No argument for the command line\");\r\n\t\treturn false;\r\n\t}\r\n\r\n\t//\r\n\t//\tList of the avalaible options\r\n\t//\tN.B. : Must remain up-to-date, so does optionCount\r\n\t//\r\n\tconst char* options[] = {\r\n\t\t\"-compileframework\",\r\n\t\t\"-o\",\r\n\t\t\"-or\",\r\n\t\t\"-oa\",\r\n\t\t\"-user\",\r\n\t\t\"-framework\",\r\n\t\t\"-ignore\",\r\n\t\t\"-h\",\r\n\t\t\"-help\",\r\n\t\t// Important : Do not forget to update optionCount\r\n\t};\r\n\tint optionCount = 9;\r\n\r\n\t// First, check every argument to make sure that paths are written using '\\'\r\n\tfor(int n = 0 ; n < argc ; n++) {\r\n\t\tif(!isValid(argv[n])) {\r\n\t\t\tcompilerError(ERR_COMMAND_LINE, \"Please use '\\\\' rather than '/'\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tif(!contains(argv, argc, \"-user\")) {\r\n\t\tif(argv[1][0] == '-') {\r\n\t\t\tcompilerError(ERR_COMMAND_LINE, \"Since -user is not used, the first argument should be the path to the solution\");\r\n\t\t}\r\n\t\t// The first argument is the user path\r\n\t\tinfos->userPath = concat(argv[i++]);\r\n\t}\r\n\tfor(; i < argc ; i++) {\r\n\t\tif(argv[i][0] == '-') {\r\n\t\t\t//\r\n\t\t\t//\tOptions\r\n\t\t\t//\r\n\t\t\tif(!contains(options, optionCount, argv[i])) {\r\n\t\t\t\tcompilerError(ERR_COMMAND_LINE, concat2(argv[i], \" : unknown command line option\"));\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t//\tOptions with no argument\r\n\t\t\telse if(!strcmp(argv[i], \"-compileframework\")) {\t\t\t\t// Recompile the framework\r\n\t\t\t\tinfos->compileFramework = true;\r\n\t\t\t\tif(contains(argv, argc, \"-framework\")) {\r\n\t\t\t\t\tcompilerError(ERR_COMMAND_LINE, \"When using -compileframework, use -user instead of -framework to tell the path to the framework\");\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(!strcmp(argv[i], \"-ignore\")) {\t\t\t\t\t\t\t// The enumerated files will be ignored\r\n\t\t\t\tinfos->ignoreMode = true;\r\n\t\t\t}\r\n\t\t\telse if(!strcmp(argv[i], \"-h\") || !strcmp(argv[i], \"-help\")) {\t// The enumerated files will be ignored\r\n\t\t\t\tdisplayHelp();\r\n\t\t\t}\r\n\r\n\t\t\t//\tOptions with one argument\r\n\t\t\telse if(i + 1 >= argc) {\r\n\t\t\t\tcompilerError(ERR_COMMAND_LINE, concat2(\"Missing argument for \", argv[i]));\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\telse if(!strcmp(argv[i], \"-o\") || !strcmp(argv[i], \"-or\")) {\t// Output path (relative)\r\n\t\t\t\tinfos->outputPath = concat(argv[++i]);\r\n\t\t\t\trelativePath = true;\r\n\t\t\t}\r\n\t\t\telse if(!strcmp(argv[i], \"-oa\")) {\t\t\t\t\t\t\t\t// Output path (absolute)\r\n\t\t\t\tinfos->outputPath = concat(argv[++i]);\r\n\t\t\t}\r\n\t\t\telse if(!strcmp(argv[i], \"-user\")) {\t\t\t\t\t\t\t// User file path\r\n\t\t\t\tinfos->userPath = concat(argv[++i]);\r\n\t\t\t} \r\n\t\t\telse if(!strcmp(argv[i], \"-framework\")) {\t\t\t\t\t\t// Framework file path\r\n\t\t\t\tinfos->frameworkPath = concat(argv[++i]);\r\n\t\t\t}\r\n\r\n\t\t\t//\tOptions with two arguments\r\n\t\t\telse if(i + 2 >= argc) {\r\n\t\t\t\tcompilerError(ERR_COMMAND_LINE, concat2(\"Missing argument for \", argv[i]));\r\n\t\t\t\treturn false;\r\n\t\t\t}/*\r\n\t\t\telse\r\n\t\t\t\t...\r\n\t\t\t*/\r\n\r\n\t\t\telse {\r\n\t\t\t\tcompilerError(ERR_COMMAND_LINE, concat3(\"Option \", argv[i], \"exists but has not been implemented yet\"));\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// Parsed file name\r\n\t\t\tif(infos->parsedFileCount + 1 > 50) {\r\n\t\t\t\tcompilerError(ERR_COMMAND_LINE, \"The number of selected parsed files cannot be greater than 50\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tinfos->parsedFiles[infos->parsedFileCount++] = concat(argv[i]);\r\n\t\t}\r\n\t}\r\n\r\n\tif(infos->compileFramework && infos->outputPath) {\r\n\t\tif(isFile(infos->outputPath)) {\r\n\t\t\tcompilerError(ERR_COMMAND_LINE, \"When using -compileframework, -o should designate a folder\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(infos->outputPath[strlen(infos->outputPath) - 1] != '\\\\') {\r\n\t\t\tinfos->outputPath = concat2(infos->outputPath, \"\\\\\");\r\n\t\t}\r\n\t}\r\n\r\n\tif(relativePath) {\r\n\t\tif(infos->userPath[strlen(infos->userPath) - 1] == '\\\\') {\r\n\t\t\tinfos->outputPath = concat2(infos->userPath, infos->outputPath);\r\n\t\t}\r\n\t\telse{\r\n\t\t\tinfos->outputPath = concat3(infos->userPath, \"\\\\\", infos->outputPath);\r\n\t\t}\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nu32 getCompilerOptions(SCmdLineInfos* infos) {\r\n\tu32 options = 0;\r\n\tif(infos->frameworkPath != NULL) {\r\n\t\toptions |= COMPIL_USE_FRAMEWORK;\r\n\t}\r\n\tif(infos->compileFramework) {\r\n\t\toptions |= COMPIL_IS_FRAMEWORK;\r\n\t}\r\n\tif(infos->ignoreMode) {\r\n\t\toptions |= COMPIL_MODE_IGNORE;\r\n\t}\r\n\treturn options;\r\n}\r\n\r\nint _tmain(int argc, const char* argv[])\r\n{\r\n\tu32 compilerOptions;\r\n\tSCmdLineInfos* infos = new SCmdLineInfos();\r\n\r\n\tif(extractArgs(argc, argv, infos)) {\r\n\t\tcompilerOptions = getCompilerOptions(infos);\r\n\r\n\t\t// Init code generator.\r\n\t\tinitBaseType();\r\n\t\tg_noDump = true;\r\n\t\tg_registerClasses = false;\r\n\t\t//\r\n\t\t// Load always needed library.\r\n\t\t//\r\n\t\trecurse(\"supported.cs\", NULL, 0, compilerOptions | ~COMPIL_MODE_IGNORE);\r\n\t\tg_registerClasses = true;\r\n\t\tif((compilerOptions & COMPIL_USE_FRAMEWORK) != 0) {\r\n\t\t\t// Load the framework librairies\r\n\t\t\trecurse(infos->frameworkPath, NULL, 0, compilerOptions);\r\n\t\t}\r\n\t\tg_noDump = false;\r\n\r\n\t\trecurse(infos->userPath, infos->parsedFiles, infos->parsedFileCount, compilerOptions | ~COMPIL_MODE_IGNORE);\r\n\t\tyylineno = -1; // Do not parse anymore.\r\n\r\n\t\tgenerateOutput(infos->outputPath, compilerOptions);\r\n\t\tfreopen( \"CON\", \"w\", stdout );\r\n\t}\r\n\telse {\r\n\t\tsystem(\"Pause\");\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/CompilerProject.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 11.00\r\n# Visual C++ Express 2010\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"CompilerProject\", \"CompilerProject.vcxproj\", \"{9F524797-7C48-47EA-86FB-445AEC76533C}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Win32 = Debug|Win32\r\n\t\tRelease|Win32 = Release|Win32\r\n\t\tTestAll|Win32 = TestAll|Win32\r\n\t\tTestAssignment|Win32 = TestAssignment|Win32\r\n\t\tTestDelegate|Win32 = TestDelegate|Win32\r\n\t\tTestDllImport|Win32 = TestDllImport|Win32\r\n\t\tTestExpression|Win32 = TestExpression|Win32\r\n\t\tTestFramework|Win32 = TestFramework|Win32\r\n\t\tTestGeneric|Win32 = TestGeneric|Win32\r\n\t\tTestInterface|Win32 = TestInterface|Win32\r\n\t\tTestInvoke|Win32 = TestInvoke|Win32\r\n\t\tTestRef|Win32 = TestRef|Win32\r\n\t\tTestResolution|Win32 = TestResolution|Win32\r\n\t\tTestStatement|Win32 = TestStatement|Win32\r\n\t\tTestStruct|Win32 = TestStruct|Win32\r\n\t\tTestTestSuite|Win32 = TestTestSuite|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.Release|Win32.Build.0 = Release|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestAll|Win32.ActiveCfg = TestAll|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestAll|Win32.Build.0 = TestAll|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestAssignment|Win32.ActiveCfg = TestAssignment|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestAssignment|Win32.Build.0 = TestAssignment|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestDelegate|Win32.ActiveCfg = TestDelegate|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestDelegate|Win32.Build.0 = TestDelegate|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestDllImport|Win32.ActiveCfg = TestDLLImport|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestDllImport|Win32.Build.0 = TestDLLImport|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestExpression|Win32.ActiveCfg = TestExpression|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestExpression|Win32.Build.0 = TestExpression|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestFramework|Win32.ActiveCfg = TestFramework|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestFramework|Win32.Build.0 = TestFramework|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestGeneric|Win32.ActiveCfg = TestGeneric|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestGeneric|Win32.Build.0 = TestGeneric|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestInterface|Win32.ActiveCfg = TestInterface|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestInterface|Win32.Build.0 = TestInterface|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestInvoke|Win32.ActiveCfg = TestInvoke|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestInvoke|Win32.Build.0 = TestInvoke|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestRef|Win32.ActiveCfg = TestRef|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestRef|Win32.Build.0 = TestRef|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestResolution|Win32.ActiveCfg = TestResolution|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestResolution|Win32.Build.0 = TestResolution|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestStatement|Win32.ActiveCfg = TestStatement|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestStatement|Win32.Build.0 = TestStatement|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestStruct|Win32.ActiveCfg = TestStruct|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestStruct|Win32.Build.0 = TestStruct|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestTestSuite|Win32.ActiveCfg = TestTestSuite|Win32\r\n\t\t{9F524797-7C48-47EA-86FB-445AEC76533C}.TestTestSuite|Win32.Build.0 = TestTestSuite|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/CompilerProject.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestAll|Win32\">\r\n      <Configuration>TestAll</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestAssignment|Win32\">\r\n      <Configuration>TestAssignment</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestDelegate|Win32\">\r\n      <Configuration>TestDelegate</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestDLLImport|Win32\">\r\n      <Configuration>TestDLLImport</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestExpression|Win32\">\r\n      <Configuration>TestExpression</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestFramework|Win32\">\r\n      <Configuration>TestFramework</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestGeneric|Win32\">\r\n      <Configuration>TestGeneric</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestInterface|Win32\">\r\n      <Configuration>TestInterface</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestInvoke|Win32\">\r\n      <Configuration>TestInvoke</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestRef|Win32\">\r\n      <Configuration>TestRef</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestResolution|Win32\">\r\n      <Configuration>TestResolution</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestStatement|Win32\">\r\n      <Configuration>TestStatement</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestStruct|Win32\">\r\n      <Configuration>TestStruct</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"TestTestSuite|Win32\">\r\n      <Configuration>TestTestSuite</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{9F524797-7C48-47EA-86FB-445AEC76533C}</ProjectGuid>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <RootNamespace>CompilerProject</RootNamespace>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInterface|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAll|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestFramework|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAssignment|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDelegate|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStruct|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDLLImport|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestRef|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestGeneric|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStatement|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestResolution|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInvoke|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestExpression|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>NotSet</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInterface|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAll|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestFramework|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAssignment|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDelegate|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStruct|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDLLImport|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestRef|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestGeneric|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStatement|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestResolution|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInvoke|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TestExpression|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInterface|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAll|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestFramework|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAssignment|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDelegate|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStruct|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDLLImport|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestRef|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestGeneric|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStatement|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestResolution|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInvoke|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TestExpression|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInterface|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAll|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestFramework|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestAssignment|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDelegate|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStruct|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestDLLImport|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestRef|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestGeneric|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestStatement|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestResolution|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestInvoke|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestExpression|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AssemblerOutput>NoListing</AssemblerOutput>\r\n      <ExpandAttributedSource>false</ExpandAttributedSource>\r\n      <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PreBuildEvent>\r\n      <Command>build.bat</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PrecompiledHeader>\r\n      </PrecompiledHeader>\r\n      <Optimization>MaxSpeed</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='TestTestSuite|Win32'\">\r\n    <ClCompile>\r\n      <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <Optimization>Disabled</Optimization>\r\n    </ClCompile>\r\n    <Link>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <None Include=\"csharp.l\" />\r\n    <None Include=\"csharp.y\" />\r\n    <None Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"AbstractContainer.h\" />\r\n    <ClInclude Include=\"Attribute.h\" />\r\n    <ClInclude Include=\"BaseType.h\" />\r\n    <ClInclude Include=\"compilerLibrary.h\" />\r\n    <ClInclude Include=\"Expression.h\" />\r\n    <ClInclude Include=\"include.h\" />\r\n    <ClInclude Include=\"NameSpace.h\" />\r\n    <ClInclude Include=\"Statement.h\" />\r\n    <ClInclude Include=\"stdafx.h\" />\r\n    <ClInclude Include=\"Symbol.h\" />\r\n    <ClInclude Include=\"targetver.h\" />\r\n    <ClInclude Include=\"TypeObject.h\" />\r\n    <ClInclude Include=\"UTF8Parse.h\" />\r\n    <ClInclude Include=\"Variable.h\" />\r\n    <ClInclude Include=\"y.tab.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"AbstractContainer.cpp\" />\r\n    <ClCompile Include=\"Accessor.cpp\" />\r\n    <ClCompile Include=\"Attribute.cpp\" />\r\n    <ClCompile Include=\"compilerLibrary.cpp\" />\r\n    <ClCompile Include=\"CompilerProject.cpp\" />\r\n    <ClCompile Include=\"csharpcompiler.cpp\" />\r\n    <ClCompile Include=\"dirent.c\" />\r\n    <ClCompile Include=\"Dump.cpp\" />\r\n    <ClCompile Include=\"Expression.cpp\" />\r\n    <ClCompile Include=\"Method.cpp\" />\r\n    <ClCompile Include=\"NameSpace.cpp\" />\r\n    <ClCompile Include=\"Statement.cpp\" />\r\n    <ClCompile Include=\"stdafx.cpp\" />\r\n    <ClCompile Include=\"Symbol.cpp\" />\r\n    <ClCompile Include=\"TypeObject.cpp\" />\r\n    <ClCompile Include=\"UTF8Parser.cpp\" />\r\n    <ClCompile Include=\"Variable.cpp\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/CompilerProject.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Parser\">\r\n      <UniqueIdentifier>{5f7fee26-b49c-4cd7-8b91-f97d89eb3dbf}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"ParserLibrary\">\r\n      <UniqueIdentifier>{2dd10776-1a21-4c47-857b-99affa50979f}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"ParserLibrary\\Source\">\r\n      <UniqueIdentifier>{cc6f60d2-70d1-49fc-bf0a-ca6ca4cb4a90}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"ParserLibrary\\Header\">\r\n      <UniqueIdentifier>{1f619903-4890-4af5-9d3f-7e2ee9ef4361}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Dump\">\r\n      <UniqueIdentifier>{afc5e584-0b9d-4ef0-b56c-a37c37a32d40}</UniqueIdentifier>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"ReadMe.txt\" />\r\n    <None Include=\"csharp.l\">\r\n      <Filter>Parser</Filter>\r\n    </None>\r\n    <None Include=\"csharp.y\">\r\n      <Filter>Parser</Filter>\r\n    </None>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"stdafx.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"targetver.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"y.tab.h\">\r\n      <Filter>Parser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"include.h\">\r\n      <Filter>ParserLibrary</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"AbstractContainer.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Attribute.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"BaseType.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"compilerLibrary.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Expression.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"NameSpace.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Statement.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Symbol.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"TypeObject.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Variable.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"UTF8Parse.h\">\r\n      <Filter>ParserLibrary\\Header</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"CompilerProject.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"csharpcompiler.cpp\">\r\n      <Filter>Parser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"dirent.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"AbstractContainer.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Attribute.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"compilerLibrary.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Expression.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"NameSpace.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Statement.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Symbol.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"TypeObject.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Variable.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Accessor.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Method.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Dump.cpp\">\r\n      <Filter>Dump</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"UTF8Parser.cpp\">\r\n      <Filter>ParserLibrary\\Source</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Dump.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <unistd.h>\r\n#include \"UTF8Parse.h\"\r\n\r\n\t\t\t\t\r\nclass GCSupport {\r\npublic:\r\n\tstatic void dumpMemberGC(Variable* var);\r\n\tstatic void memberReleaseGC(Variable* var);\r\n\r\n\tstatic void dumpStructGC(Variable* var, AbstractContainer* cnt);\r\n\tstatic void structReleaseGC(Variable* var, AbstractContainer* cnt);\r\n};\r\n\r\nvoid GCSupport::dumpMemberGC(Variable* var) \r\n{ printf(\"if (%s) { System::Memory::pushList(%s,0); }\\n\",var->getName(),var->getName()); }\r\n\r\nvoid GCSupport::dumpStructGC(Variable* var, AbstractContainer* cnt) \r\n{ printf(\"%s._processGC();\\n\",var->getName()); }\r\n\r\nvoid GCSupport::memberReleaseGC(Variable* var) \r\n{ printf(\"if (%s && !%s->isFreed()) { %s->_removeRef((System::__GCObject**)&%s); }\\n\",var->getName(),var->getName(),var->getName(),var->getName()); }\r\n\r\nvoid GCSupport::structReleaseGC(Variable* var, AbstractContainer* cnt) \r\n{ printf(\"%s._releaseGC();\\n\",var->getName()); }\r\n\r\n//\r\n// Dump Code.\r\n//\r\n\r\nvoid dumpWrapper(Expression* expr, bool safe = false);\r\nvoid dumpAccessorWrappers(const char* pName, const char* pStrType, bool isNonNum, const char* testDiv, bool isEnum, bool isStatic, bool isNativePtr);\r\nvoid dumpGlobalInitializerPrototype();\r\nvoid dumpGlobalInitializerImplementation();\r\n\r\nint depth = 0;\r\nvoid tab() { for (int n=0; n < depth; n++) { printf(\"    \"); } }\r\n\r\nvoid dumpUtf8ToUniChar(const char* str) {\r\n\tint len = strlen(str);\r\n\tu16 dst[5000];\r\n\tint count = toUtf16((const u8*)str, len, dst, 5000);\r\n\r\n\tbool first = true;\r\n\tint n=0;\r\n\twhile (n < count) {\r\n\t\tif (!first) { printf(\",\"); } else first = false;\r\n\t\tprintf(\"%i\", dst[n]);\r\n\t\tn++;\r\n\t}\r\n}\r\n\r\nvoid exportConstants() {\r\n\tStringID* p = gStrList;\r\n\twhile (p) {\r\n\t\tif(p->m_isDumped) {\r\n\t\t\ttab(); printf(\"/* %s */\\n\",p->m_str);\r\n\t\t\tif(strcmp(p->m_str, \"\") != 0) {\r\n\t\t\t\ttab(); printf(\"static const uniChar _$_cteStr%i[] = {\",p->m_id); dumpUtf8ToUniChar(p->m_str); printf(\"};\\n\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// String is initialised with String::Empty\r\n\t\t\t}\r\n\t\t\ttab(); printf(\"static System::String* _$_cteStr%iObj;\\n\\n\", p->m_id);\r\n\t\t}\r\n\t\tp = p->m_next;\r\n\t}\r\n\r\n\tdumpGlobalInitializerPrototype();\r\n}\r\n\r\nvoid exportInlineFiles(const char* outputPath, ClassDictionary* CD) {\r\n\t// Export class prototypes\r\n\tfreopen(concat2(outputPath, \"classPrototypes.inl\"), \"w\", stdout);\r\n\texportNameSpaceHeader(gRootNameSpace, true);\r\n\r\n\t// Export __InternalUtils::GetTypeID specializations\r\n\tfreopen(concat2(outputPath, \"__InternalUtilsGetTypeID_specializations.inl\"), \"w\", stdout);\r\n\tconst char* templateList = \"template<> struct __InternalUtilsGetTypeID<<T>> { \";\r\n\tconst char* bodyCsteList = \"static u32 getIt() { return _TYPE_USEROBJECT | <BODY>; }\";\r\n\tconst char* templateEndList = \" };\";\r\n\ttemplateClassSpecializationDumpForOneGenericType(&templateList, &bodyCsteList, &templateEndList, 1,\r\n\t\tCD->classes, CD->IDs, CD->count);\r\n}\r\n\r\nvoid exportStatics(NameSpace* nSpace, const char* precNameSpace) {\r\n\tchar prefix[1000];\r\n\tif (precNameSpace[0] != 0) {\r\n\t\tsprintf(prefix,\"%s%s::\",precNameSpace, nSpace->getName());\r\n\t} else {\r\n\t\tif (nSpace->getName()[0]) {\r\n\t\t\tsprintf(prefix,\"%s::\", nSpace->getName());\r\n\t\t} else {\r\n\t\t\tsprintf(prefix,\"\");\r\n\t\t}\r\n\t}\r\n\r\n\tNameSpace* pCurrSpace = nSpace;\r\n\r\n\t// Export all static\r\n\tAbstractContainer** pCnt = pCurrSpace->m_pInner;\r\n\tif (pCurrSpace->m_innerCount && (pCurrSpace->m_noDump == false)) {\r\n\t\tfor (int n=0; n < pCurrSpace->m_innerCount; n++) {\r\n\t\t\tAbstractContainer* pAC = pCnt[n];\r\n\t\t\tgCurrentAC = pAC;\r\n\t\t\tfor (int n=0; n < pAC->m_memberCount; n++) {\r\n\t\t\t\tVariable* pVar = pAC->m_members[n];\r\n\t\t\t\tif ((pVar->m_modifier & ATT_STATIC) != 0) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (pVar->m_expression) {\r\n\t\t\t\t\t\tExpression::patchExpressionsForListExpressions(&pVar->m_expression, pVar->m_type);\r\n\t\t\t\t\t\tpVar->m_expression->AnalysisAndTransform();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (prefix[0]) {\r\n\t\t\t\t\t\tprintf(\"%s %s%s::%s;\\n\", pVar->m_type->dumpTypeForCode(NULL), prefix, pAC->getName(), pVar->getName());\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprintf(\"%s %s::%s;\\n\",pVar->m_type->dumpTypeForCode(NULL), pAC->getName(), pVar->getName());\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Analysis of expression for dependancy.\r\n\t\t\t\t\tgCurrVar = pVar;\r\n\t\t\t\t\tpVar->markSetupDependancy();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tgCurrentAC = NULL;\r\n\t\t\texportStatics(pAC, prefix);\r\n\t\t}\r\n\t}\r\n\r\n\t// Export inner name space first\r\n\tNameSpace* p = pCurrSpace->m_pChildSpace;\r\n\twhile (p)\t{ exportStatics(p,prefix); p = p->m_pNextSpace; }\r\n}\r\n\r\nvoid initStaticVar(Variable* pVar) {\r\n\tprintf(\" = \");\r\n\tif (pVar->m_expression) {\r\n\t\tgStaticContextAC = pVar->m_ownerClass;\r\n\t\t// Expression::analysisTransformAndDump(&pVar->m_expression, pVar->m_type);\r\n\t\tpVar->m_expression->dumpExpression();\r\n\t\tgStaticContextAC = NULL;\r\n\t} else {\r\n\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\tprintf(\"NULL\");\r\n\t\t} else {\r\n\t\t\tswitch (pVar->m_type->m_typeID) {\r\n\t\t\tcase TYPE_SBYTE\t\t:\t\r\n\t\t\tcase TYPE_BYTE\t\t:\r\n\t\t\tcase TYPE_SHORT\t\t:\r\n\t\t\tcase TYPE_USHORT\t:\r\n\t\t\tcase TYPE_INT\t\t:\r\n\t\t\tcase TYPE_UINT\t\t:\r\n\t\t\tcase TYPE_LONG\t\t:\r\n\t\t\tcase TYPE_ULONG\t\t:\r\n\t\t\t\tprintf(\"0\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase TYPE_CHAR\t\t:\r\n\t\t\t\tprintf(\"0\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase TYPE_FLOAT\t\t:\r\n\t\t\t\tprintf(\"0.0f\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase TYPE_DOUBLE\t:\r\n\t\t\t\tprintf(\"0.0\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase TYPE_BOOL\t\t:\r\n\t\t\t\tprintf(\"false\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase TYPE_INTPTR\t:\r\n\t\t\t\tprintf(\"NULL\");\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tif (pVar->m_type->m_genreID == EGENRE::_ENUM) {\r\n\t\t\t\t\tprintf(\"(%s)0\",pVar->m_type->getFullName(NULL));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL,\"Error default GC type\", pVar->m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tprintf(\";\\n\");\r\n}\r\n\r\nVariable* structNest[50];\t// More than enough.\r\n\r\nvoid setStaticsVarRec(int nestCount, Variable* pVar) {\r\n\tAbstractContainer* pCls = pVar->m_ownerClass;\r\n\r\n\t//\r\n\t// Dump\r\n\t//\r\n\tSRSymbol v = pVar->m_type->getResolvedType(pCls);\r\n\tAbstractContainer* cnt = (AbstractContainer*)v.pSymbol;\r\n\tif (v.symbolType == EGENRE::_ABSTRACTCONTAINER && ((cnt)->m_modifier & ATT_STRUCT)) {\r\n\t\tfor (int n=0; n < cnt->m_memberCount; n++) {\r\n\t\t\tVariable* pVarL = cnt->m_members[n];\r\n\t\t\tstructNest[nestCount] = pVarL;\r\n\t\t\tsetStaticsVarRec(nestCount+1, pVarL);\r\n\t\t}\r\n\t} else {\r\n\t\tconst char* pSrc = structNest[0]->m_ownerClass->getFullName(NULL);\t// From root\r\n\t\ttab(); printf(\"%s::%s\", pSrc, structNest[0]->m_name);\r\n\t\tfor (int m=1; m < nestCount; m++) {\r\n\t\t\tprintf(\".%s\", structNest[m]->m_name);\r\n\t\t}\r\n\t\tinitStaticVar(structNest[nestCount-1]);\r\n\t}\r\n}\r\n\r\nvoid setStatics() {\r\n\tVariable* pVar;\r\n\t//\r\n\t// This system allow to solve dependancy between static / const C# expression and dump them in correct other.\r\n\t//\r\n\twhile (pVar = gStaticDepMatrix->popIndependantVariable()) {\r\n\t\tstructNest[0] = pVar;\r\n\t\tsetStaticsVarRec(1, pVar);\r\n\t}\r\n}\r\n\r\nvoid registerStaticsRec(int nestCount, char* prefix, AbstractContainer* pAC, Variable* v) {\r\n\tAbstractContainer* localContainer;\r\n\tif (v) {\r\n\t\tlocalContainer = v->m_type->m_definitionAC;\r\n\t} else {\r\n\t\tlocalContainer = pAC;\r\n\t}\r\n\r\n\t//\r\n\t// For nextCount >= 1 : Struct inheritance is not supported, just parse sub structures.\r\n\t//\r\n\tfor (int n=0; n < localContainer->m_memberCount; n++) {\r\n\t\tVariable* pVar = localContainer->m_members[n];\r\n\t\t// First level variable are static,\r\n\t\t// But deeper level are inside a struct and do NOT depend on static flag !\r\n\t\tif ((((pVar->m_modifier & ATT_STATIC) != 0) && nestCount == 0) || (nestCount)) {\r\n\t\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\t\tstructNest[nestCount] = pVar;\r\n\t\t\t\t\r\n\t\t\t\ttab(); printf(\"System::Memory::registerGCRoot(&%s%s::\",prefix, pAC->getName());\r\n\t\t\t\t\r\n\t\t\t\tfor (int m=0; m <= nestCount; m++) {\r\n\t\t\t\t\tif (m != 0) {\r\n\t\t\t\t\t\tprintf(\".\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tprintf(\"%s\", structNest[m]->m_name);\r\n\t\t\t\t}\r\n\t\t\t\tprintf(\");\\n\");\r\n\t\t\t} else if (pVar->m_type->m_definitionAC && pVar->m_type->m_definitionAC->m_modifier & ATT_STRUCT) {\r\n\t\t\t\tstructNest[nestCount] = pVar;\r\n\t\t\t\tregisterStaticsRec(nestCount + 1, prefix, pAC, pVar);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid registerStatics(NameSpace* nSpace, const char* precNameSpace) {\r\n\tif(nSpace->m_noDump) {\r\n\t\t// Do not register the static members.\r\n\t\treturn;\r\n\t}\r\n\tchar prefix[1000];\r\n\tint strl = strlen(precNameSpace);\r\n\tif (strl) {\r\n\t\tsprintf(prefix,\"%s%s::\",precNameSpace,nSpace->getName());\r\n\t} else if(strlen(nSpace->getName())){\r\n\t\tsprintf(prefix,\"%s::\",nSpace->getName());\r\n\t}\r\n\telse {\r\n\t\tsprintf(prefix,\"\");\r\n\t}\r\n\r\n\tNameSpace* pCurrSpace = nSpace;\r\n\r\n\t// Export all static\r\n\tAbstractContainer** pCnt = pCurrSpace->m_pInner;\r\n\tif (pCurrSpace->m_innerCount) {\r\n\t\tfor (int n=0; n < pCurrSpace->m_innerCount; n++) {\r\n\t\t\tAbstractContainer* pAC = pCnt[n];\r\n\t\t\tregisterStaticsRec(0, prefix,pAC,NULL);\r\n\t\t\tregisterStatics(pAC,prefix);\r\n\t\t}\r\n\t}\r\n\r\n\t// Export inner name space first\r\n\tNameSpace* p = pCurrSpace->m_pChildSpace;\r\n\twhile (p)\t{ registerStatics(p,prefix); p = p->m_pNextSpace; }\r\n}\r\n\r\nvoid registerGCWorld(NameSpace* root, u32 compilerOptions) {\r\n\tbool isFramework = (compilerOptions & COMPIL_IS_FRAMEWORK) != 0;\r\n\r\n\t// Declate all static variables.\r\n\texportStatics(root,\"\");\r\n\r\n\tdumpGlobalInitializerImplementation();\r\n\r\n\tprintf(isFramework ? \"\\n#include \\\"callbackDef.inl\\\"\\n\\nvoid initFrameworkStatic() {\\n\" : \"\\nvoid initAllStatic() {\\n\");\r\n\r\n\tdepth++;\r\n\tsetStatics();\r\n\tdepth--;\r\n\tprintf(\"}\\n\\n\");\r\n\r\n\tprintf(isFramework ? \"void initFramework() {\\n\" : \"void registerWorldGC() {\\n\");\r\n\r\n\tdepth++;\r\n\tif(compilerOptions & COMPIL_USE_FRAMEWORK) {\r\n\t\ttab(); printf(\"initFramework();\\n\");\r\n\t}\r\n\r\n\tStringID* p = gStrList;\r\n\tbool first = true;\r\n\twhile (p) {\r\n\t\tif(p->m_isDumped) {\r\n\t\t\tif (first) {\r\n\t\t\t\tfirst = false;\r\n\t\t\t\ttab(); printf(\"// Register Strings into the GC.\\n\");\r\n\t\t\t}\r\n\t\t\tif(strcmp(p->m_str, \"\") != 0) {\r\n\t\t\t\ttab(); printf(\"_$_cteStr%iObj = CS_NEW System::String(_$_cteStr%i,sizeof(_$_cteStr%i) / sizeof(uniChar));\\n\",p->m_id,p->m_id,p->m_id);\r\n\t\t\t\ttab(); printf(\"System::Memory::registerGCRoot(&_$_cteStr%iObj);\\n\\n\",p->m_id);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\ttab(); printf(\"System::__GCObject::_RefSetValue((System::__GCObject**)&_$_cteStr%iObj, System::String::Empty);\\n\",p->m_id);\r\n\t\t\t\t// String::Empty is registered somewhere else\r\n\t\t\t}\r\n\t\t}\r\n\t\tp = p->m_next;\r\n\t}\r\n\r\n\tprintf(\"\\n\");\r\n\r\n\ttab();\r\n\tif(isFramework) {\r\n\t\tprintf(\"initFrameworkStatic();\\n\");\r\n\t\ttab(); printf(\"initCallbacks();\\n\");\r\n\t}\r\n\telse {\r\n\t\tprintf(\"initAllStatic();\\n\");\r\n\t}\r\n\r\n\tprintf(\"\\n\");\r\n\tregisterStatics(root,\"\");\r\n\tprintf(\"\\n\");\r\n\r\n\tdepth--;\r\n\tprintf(\"}\\n\");\r\n}\r\n\r\nconst char* dotToColon(const char* str) {\r\n\tchar buf[500];\r\n\tchar* pStr = (char*)str;\r\n\tchar* pBuf = buf;\r\n\twhile(*pStr) {\r\n\t\tif(*pStr == '.') {\r\n\t\t\tfor(int n = 0 ; n < 2 ; n++, pBuf++) {\r\n\t\t\t\t*pBuf = ':';\r\n\t\t\t}\r\n\t\t\tpStr++;\r\n\t\t}\r\n\t\telse {\r\n\t\t\t*(pBuf++) = *(pStr++);\r\n\t\t}\r\n\t}\r\n\t*pBuf = 0;\r\n\treturn concat(buf);\r\n}\r\n\r\nvoid dumpUsings(NameSpace* nSpace) {\r\n\tfor(int n=0; n < nSpace->m_usingCount ; n++) {\r\n\t\tif(strcmp(nSpace->m_usings[n], \"System.Runtime\") != 0 &&\r\n\t\tstrcmp(nSpace->m_usings[n], \"System.Runtime.InteropServices\") != 0 &&\r\n\t\tstrcmp(nSpace->m_usings[n], \"System.Text\") != 0) {\r\n\t\t\tbool isSupported = (nSpace->resolve(nSpace->m_usings[n]) != NULL);\r\n\t\t\tif(isSupported) {\r\n\t\t\t\ttab(); printf(\"using namespace %s;\\n\", dotToColon(nSpace->m_usings[n]));\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// Special case : those namespaces are used in C#, but must not be dumped in C++.\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\nvoid dumpEnums(NameSpace* nSpace) {\r\n\tfor (int n=0; n < nSpace->m_enumCount; n++) {\r\n\t\tEnum* pEnum = nSpace->m_enums[n];\r\n\t\tif(pEnum->getType()->m_typeID == TYPE_LONG || pEnum->getType()->m_typeID == TYPE_ULONG) {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Only byte, sbyte, short, ushort, int and uint types can be used for enums\", pEnum->m_line);\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\ttab(); printf(\"enum %s {\\n\", pEnum->getName());\r\n\t\tEnum::EnumEntry* pEntry = pEnum->m_list;\r\n\t\tdepth++;\r\n\t\twhile (pEntry) {\r\n\t\t\ttab();printf(pEntry->m_name);\r\n\t\t\tif (pEntry->m_expression) {\r\n\t\t\t\tprintf(\" = \");\r\n\t\t\t\tExpression::analysisTransformAndDump(&pEntry->m_expression, pEnum->getType());\r\n\t\t\t}\r\n\t\t\tprintf(\",\\n\");\r\n\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t}\r\n\t\ttab(); printf(\"_ForceWORD_%s = 0x7FFFFFFF\\n\", pEnum->m_name);\r\n\t\tdepth--;\r\n\t\ttab(); printf(\"};\\n\\n\");\r\n\t}\r\n}\r\n\r\nvoid dumpDelegatePrototypes(NameSpace* nSpace) {\r\n\tfor(int n=0 ; n < nSpace->m_delegateCount ; n++) {\r\n\t\tDelegate* pDelegate = nSpace->m_delegates[n];\r\n\t\tgCurrentMethod = pDelegate;\r\n\t\ttab(); printf(\"class _Delegate_Base_%s;\\n\",pDelegate->getName());\r\n\t\ttab(); printf(\"template <class TClass> class _DelegateI_%s;\\n\",pDelegate->getName());\r\n\t\ttab(); printf(\"class _DelegateS_%s;\\n\",pDelegate->getName());\r\n\t}\r\n\tgCurrentMethod = NULL;\r\n}\r\n\r\nvoid dumpClassPrototypes(NameSpace* nSpace, bool forExport) {\r\n\tAbstractContainer** pCnt = nSpace->m_pInner;\r\n\tfor (int n=0; n < nSpace->m_innerCount; n++) {\r\n\t\tAbstractContainer* currCnt = pCnt[n];\r\n\t\tif (currCnt->m_noDump == false || forExport) {\r\n\t\t\ttab(); currCnt->dumpTemplateLabel();\r\n\t\t\tif(currCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\tprintf(\"struct %s;\\n\", currCnt->getName());\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tprintf(\"class %s;\\n\", currCnt->getName());\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\nvoid recursiveRegisterClassDependancy(NameSpace* pCurrSpace) {\r\n\tif (pCurrSpace->getGenre() == EGENRE::_NAMESPACE || pCurrSpace->getGenre() == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\tif(pCurrSpace->m_noDump) {\r\n\t\t\t// No registration\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tNameSpace* p = pCurrSpace->m_pChildSpace;\r\n\t\twhile (p)\t{ recursiveRegisterClassDependancy(p); p = p->m_pNextSpace; }\r\n\r\n\t\tAbstractContainer** pCnt = pCurrSpace->m_pInner;\r\n\t\tfor (int n=0; n < pCurrSpace->m_innerCount; n++) {\r\n\t\t\tAbstractContainer* currCnt = pCnt[n];\r\n\t\t\tif (pCurrSpace->getGenre() == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\t\tgStaticDepMatrix->createDependancy(currCnt, (AbstractContainer*)pCurrSpace);\r\n\t\t\t}\r\n\t\t\tif (!currCnt->m_noDump) {\r\n\t\t\t\tgStaticDepMatrix->registerAbstractContainer(currCnt);\r\n\t\t\t\tfor (int m=0; m < currCnt->m_inheritancesCount; m++) {\r\n\t\t\t\t\tTypeObject* type = currCnt->m_inheritances[m];\r\n\t\t\t\t\ttype->getResolvedType(pCurrSpace);\r\n\t\t\t\t\tAbstractContainer* pDep = type->m_definitionAC;\r\n\t\t\t\t\tif(!pDep->isSubSystem()) {\r\n\t\t\t\t\t\tgStaticDepMatrix->createDependancy(currCnt, pDep);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int m=0; m < currCnt->m_accessorCount; m++) {\r\n\t\t\t\t\tTypeObject* type = currCnt->m_accessors[m]->m_type;\r\n\t\t\t\t\tSRSymbol sr = type->getResolvedType(currCnt);\r\n\t\t\t\t\tswitch (sr.symbolType) {\r\n\t\t\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sr.pSymbol;\r\n\t\t\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\t\t\tgStaticDepMatrix->createDependancy(currCnt, pCnt);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int m=0; m < currCnt->m_memberCount; m++) {\r\n\t\t\t\t\tTypeObject* type = currCnt->m_members[m]->m_type;\r\n\t\t\t\t\tSRSymbol sr = type->getResolvedType(currCnt);\r\n\t\t\t\t\tswitch (sr.symbolType) {\r\n\t\t\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sr.pSymbol;\r\n\t\t\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\t\t\tgStaticDepMatrix->createDependancy(currCnt, pCnt);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// TODO Struct in func call.\r\n\r\n\t\t\t\tif(currCnt->m_innerCount) {\r\n\t\t\t\t\trecursiveRegisterClassDependancy(currCnt);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid exportPrototypes() {\r\n\t// 1. Register all classes with dependancies\r\n\trecursiveRegisterClassDependancy(gRootNameSpace);\r\n\r\n\t// 2. Dump each class based on dependancy\r\n\tAbstractContainer* pCnt;\r\n\twhile (pCnt = gStaticDepMatrix->popIndependantAbstractContainer()) {\r\n\t\tpCnt->dumpPrototype(false);\r\n\t}\r\n\tif(gStaticDepMatrix->hasRemainingAC()) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Dependant classes remaining\");\r\n\t}\r\n}\r\n\r\nvoid dumpDelegates(const char* prefix, NameSpace* nSpace) {\r\n\tint count;\r\n\tfor (count = 0; count < nSpace->m_delegateCount; count++) {\r\n\t\tgCurrentMethod = nSpace->m_delegates[count];\r\n\t\tnSpace->m_delegates[count]->dumpDefinition(prefix);\r\n\t}\r\n\tgCurrentMethod = NULL;\r\n}\r\n\r\nvoid exportRuntimeIncludes() {\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_Array.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_Console.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_Marshal.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_Memory.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_Object.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_String.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/CS_System.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/Collections/Collections.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/Collections/Generic/CS_Dictionary.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/Collections/Generic/CS_List.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/Collections/Generic/Generic.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/InternalUtils.h\\\"\\n\");\r\n\tprintf(\"#include \\\"RuntimeLibrary/MarshallingUtils.h\\\"\\n\");\r\n}\r\n\r\nvoid exportFrameworkHeader(){\r\n\tprintf(\"#ifndef _FRAMEWORK_H\\n\");\r\n\tprintf(\"#define _FRAMEWORK_H\\n\\n\");\r\n\texportRuntimeIncludes();\r\n\tprintf(\"#include \\\"ExportListC_Likefunction.h\\\"\\n\");\r\n\tprintf(\"\\n\");\r\n}\r\n\r\nvoid exportFrameworkFooter(){\r\n\tprintf(\"\\nvoid initFramework();\\n\\n\");\r\n\tprintf(\"class Program : public System::Object {\\n\");\r\n\tdepth++;\r\n\tprintf(\"public:\\n\");\r\n\ttab(); printf(\"void _ctor_Program();\\n\\n\");\r\n\ttab(); printf(\"Program();\\n\");\r\n\ttab(); printf(\"static void start();\\n\");\r\n\ttab(); printf(\"virtual u32 _processGC();\\n\");\r\n\ttab(); printf(\"virtual void _releaseGC();\\n\");\r\n\ttab(); printf(\"virtual bool _isInstanceOf(u32 typeID);\\n\");\r\n\ttab(); printf(\"virtual inline void _moveAlert(u32 offset);\\n\");\r\n\tprintf(\"private:\\n\");\r\n\ttab(); printf(\"static const u32 _TYPEID = 0xFFFFFFFF;\\n\");\r\n\tdepth--;\r\n\tprintf(\"};\\n\\n\");\r\n\tprintf(\"\\n#endif // _FRAMEWORK_H\\n\\n\");\r\n}\r\n\r\nvoid exportNameSpaceHeader(NameSpace* nSpace, bool forExport) {\r\n\tNameSpace* pCurrSpace = nSpace;\r\n\tbool hasNameSpace = strlen(pCurrSpace->getName()) != 0;\r\n\tbool isDumped = (pCurrSpace->m_noDump == false) || (forExport && !nSpace->isSubSystem());\r\n\tif (hasNameSpace && isDumped) { tab(); printf(\"namespace %s {\\n\", pCurrSpace->getName()); depth++; }\r\n\r\n\tif(isDumped) {\r\n\t\t//dumpUsings(nSpace);\r\n\t\tif(!forExport) {\r\n\t\t\tdumpEnums(nSpace);\r\n\t\t}\r\n\t\tdumpDelegatePrototypes(nSpace);\r\n\t\tdumpClassPrototypes(nSpace, forExport);\r\n\t}\r\n\r\n\t// Export inner name space first\r\n\tNameSpace* p = pCurrSpace->m_pChildSpace;\r\n\twhile (p)\t{ exportNameSpaceHeader(p, forExport); p = p->m_pNextSpace; }\r\n\r\n\tif (hasNameSpace && isDumped) { depth--; tab(); printf(\"}\\n\"); }\r\n}\r\n\r\nvoid exportNameSpaceImplementation(NameSpace* nSpace) {\r\n#ifdef __FULLNAMES__\r\n\tbool dumpName = false;\r\n#else\r\n\tbool dumpName = true;\r\n#endif\r\n\r\n\tNameSpace* pCurrSpace = nSpace;\r\n\tbool hasNameSpace = strlen(pCurrSpace->getName()) != 0;\r\n\tbool isDumped = (pCurrSpace->m_noDump == false);\r\n\tif(isDumped) {\r\n\t\tif (hasNameSpace && dumpName) { tab(); printf(\"namespace %s {\\n\", pCurrSpace->getName()); depth++; }\r\n\r\n\t\t// Export inner name space first\r\n\t\tNameSpace* p = pCurrSpace->m_pChildSpace;\r\n\t\twhile (p)\t{ exportNameSpaceImplementation(p); p = p->m_pNextSpace; }\r\n\r\n\t\t//dumpUsings(nSpace);\r\n\r\n\t\tif (pCurrSpace->m_delegateCount) {\r\n\t\t\ttab(); printf(\"//\\n\");\r\n\t\t\ttab(); printf(\"// Delegate Implementation\\n\");\r\n\t\t\ttab(); printf(\"//\\n\\n\");\r\n\t\t\tdumpDelegates(dumpName ? \"\" : nSpace->getFullName(gRootNameSpace), nSpace);\r\n\t\t}\r\n\r\n\t\tif (pCurrSpace->m_innerCount) {\r\n\t\t\ttab(); printf(\"//\\n\");\r\n\t\t\ttab(); printf(\"// Class/Struct Implementation\\n\");\r\n\t\t\ttab(); printf(\"//\\n\\n\");\r\n\t\t}\r\n\r\n\t\tAbstractContainer** pCnt = pCurrSpace->m_pInner;\r\n\t\tfor (int n=0; n < pCurrSpace->m_innerCount; n++) {\r\n\t\t\tif (!pCnt[n]->m_noDump) {\r\n\t\t\t\ttab(); printf(\"//=============================\\n\");\r\n\t\t\t\ttab(); printf(\"// Implementation of '%s'\\n\",pCnt[n]->getName());\r\n\t\t\t\ttab(); printf(\"//=============================\\n\\n\");\r\n\t\t\t\tgCurrentAC = pCnt[n];\r\n\t\t\t\tpCnt[n]->dumpImplementation(dumpName ? \"\" : nSpace->getFullName(gRootNameSpace)); // Classes relative to current namespace.\r\n\t\t\t\tgCurrentAC = NULL;\r\n\t\t\t\tprintf(\"\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Phase 2 : Dump implementation.\r\n\r\n\t\tif (hasNameSpace && dumpName) { depth--; tab(); printf(\"}\\n\"); }\r\n\t}\r\n}\r\n\r\nvoid processDelegateAssignment(Expression*& expression,TypeObject* typeOfDelegate, bool assignDelegate) {\r\nloop:\r\n\t// Second resolve right side\r\n\texpression->AnalysisAndTransform();\r\n\tif(expression->m_expressionType == EXPR_CAST) {\r\n\t\texpression->m_item = expression->m_expressions[expression->m_expressionCount - 1]->m_item;\r\n\t}\r\n\r\n\t// Third check right side\r\n\tif (assignDelegate) {\r\n\t\tif (expression->m_item.symbolType == EGENRE::_DELEGATE) {\r\n\t\t\t// Do nothing, delegate operator created the delegate.\r\n\t\t} else if (expression->m_item.symbolType == EGENRE::_METHOD) {\r\n\t\t\t// Forbid for now to assign directly function to delegate\r\n\t\t\t// Later version of the compiler could generate the missing new automatically.\r\n\t\t\tswitch(expression->m_expressionType) {\r\n\t\t\tcase EXPR_IDENT :\r\n\t\t\tcase EXPR_DOT:\r\n\t\t\t\tif(expression->m_expressionType == EXPR_DOT && expression->m_expressions[0]->m_runtimeType->isGC_Able() == false) {\r\n\t\t\t\t\tcompilerError(ERR_USER, \"Delegate assignments can use methods from pointer types only\", expression->m_line);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// Modify expression tree and patch.\r\n\t\t\t\t// Generate the new.\r\n\t\t\t\texpression = CreateSingleExpr(EXPR_NEW, CreateMultipleExpr(expression))->setType(typeOfDelegate);\r\n\t\t\t\tgoto loop;\r\n\t\t\tcase EXPR_CAST:\r\n\t\t\t\tif(expression->m_expressions[expression->m_expressionCount - 1]->isMethodAsDelegate()) {\r\n\t\t\t\t\tprocessDelegateAssignment(expression->m_expressions[1], expression->m_runtimeType, assignDelegate);\r\n\t\t\t\t\texpression->m_expressions[expression->m_expressionCount - 1]->m_hasParenthesis = true;\r\n\t\t\t\t\tgoto loop;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\t// Else call to a function returned a delegate.\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else if ((expression->m_item.symbolType == EGENRE::_VARIABLE) || (expression->m_item.symbolType == EGENRE::_MEMBER)) {\r\n\t\t\t// Do nothing\r\n\t\t\t// Delegate a = v; // v is a variable or member.\r\n\t\t} else if (expression->m_expressionType == EXPR_CTE) {\r\n\t\t\t// Do nothing\r\n\t\t\t// => Stick NULL.\r\n\t\t} else {\r\n\t\t\tif (expression->m_runtimeType->m_genreID == EGENRE::_DELEGATE) {\r\n\t\t\t\t// Do nothing, new operator created the delegate. \r\n\t\t\t} else {\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Delegate was not wrapped properly\", expression->m_line);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nStatement* Statement::wrapCaseBody() {\r\n\tbool hasLocalVariable = false;\r\n\tStatement* pInstruction = this;\r\n\twhile(pInstruction && !hasLocalVariable) {\r\n\t\tif(pInstruction->m_statementType == STM_LOCALVAR) {\r\n\t\t\thasLocalVariable = true;\r\n\t\t}\r\n\t\tpInstruction = pInstruction->m_pNext;\r\n\t}\r\n\tif(hasLocalVariable) {\r\n\t\treturn CreateStatement(STM_BLOCK, NULL, this);\r\n\t}\r\n\treturn this;\r\n}\r\n\r\nvoid Statement::analysis(bool processBrother) {\r\n\t// Force to stop recursion, without test each\r\n\tif (this == NULL) { return; }\r\n\r\n\tStatement* p = m_pChild;\r\n\r\n\tswitch (m_statementType) {\r\n\tcase STM_UNDEFINED: \r\n\t\tcompilerError(ERR_INTERNAL, \"Invalid Statement here\", m_line);\r\n\r\n\t\tbreak;\r\n\tcase STM_BLOCK: \r\n\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\tdepth++;\r\n\t\t\tp->analysis();\r\n\t\tdepth--;\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\tbreak;\r\n\tcase STM_NILWRAPPER: \r\n\t\t// Use by STM_FOR and act only as a \"wrapper\" to maintain order.\r\n\t\tp->analysis();\r\n\r\n\t\tbreak;\r\n\tcase STM_NULL: \r\n\r\n\t\tbreak;\r\n\tcase STM_LABEL: \r\n\t\tm_pChild->analysis();\r\n\r\n\t\tbreak;\r\n\tcase STM_LOCAL_PERVAR:\r\n\t\tif (m_expr) {\r\n\t\t\tm_expr->AnalysisAndTransform();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase STM_LOCALVAR:\r\n\t\t{\r\n\t\t\t// Forbid variable usage as long as not assigned.\r\n\t\t\tVariable* pVar = this->m_vars;\r\n\t\t\twhile (pVar) {\r\n\t\t\t\tgCurrentSD->addVariable(pVar);\r\n\t\t\t\tpVar->m_ignoreDelegate = true;\r\n\t\t\t\tpVar = pVar->m_pNextVariable;\r\n\t\t\t}\r\n\r\n\t\t\tStatement* pCaseCode = p->m_pChild; \r\n\t\t\twhile (p) {\r\n\t\t\t\t// Copy the flag here.\r\n\t\t\t\tp->m_bConstant = m_bConstant;\r\n\t\t\t\tp->analysis(false);\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t}\r\n\r\n\t\t\t// Allow variable usage.\r\n\t\t\tpVar = this->m_vars;\r\n\t\t\twhile (pVar) {\r\n\t\t\t\tpVar->m_ignoreDelegate = false;\r\n\t\t\t\tpVar = pVar->m_pNextVariable;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_WRAP_EXP:\t\t\tm_expr->AnalysisAndTransform(); break;\r\n\tcase STM_ASSIGN_EXPR:\t\tm_expr->AnalysisAndTransform(); break;\r\n\tcase STM_WRAPPER_POSTINCR:\tm_expr->AnalysisAndTransform(); break;\r\n\tcase STM_WRAPPER_POSTDECR:\tm_expr->AnalysisAndTransform(); break;\r\n\tcase STM_WRAPPER_PREINCR:\tm_expr->AnalysisAndTransform(); break;\r\n\tcase STM_WRAPPER_PREDECR:\tm_expr->AnalysisAndTransform(); break;\r\n\r\n\tcase STM_IF: \r\n\t\t{\r\n\t\t\tm_expr->AnalysisAndTransform();\r\n\t\t\t// If code\r\n\t\t\tp->analysis(false);\r\n\t\t\t// else code\r\n\t\t\tp = p->m_pNext;\r\n\t\t\tif (p) {\r\n\t\t\t\tp->analysis(false);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_SWITCH:\r\n\t\tm_expr->AnalysisAndTransform();\r\n\t\tif(m_expr->m_runtimeType->m_typeID == TYPE_STRING) {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Switch statements with strings are not supported at the moment\", m_line);\r\n\t\t}\r\n\t\t{\r\n\t\t\tint count = 0;\r\n\t\t\tStatement* pCaseCode = p->m_pChild; \r\n\t\t\twhile (p) {\r\n\t\t\t\t//\r\n\t\t\t\t// Dump Case inner code WHEN case list is completed.\r\n\t\t\t\t//\r\n\t\t\t\tif (pCaseCode != p->m_pChild) {\r\n\t\t\t\t\tpCaseCode->analysis(true);\r\n\t\t\t\t\tpCaseCode = p->m_pChild;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (p->m_statementType == STM_CASE) {\r\n\t\t\t\t\tp->m_counter = count++;\r\n\t\t\t\t\tp->m_expr->AnalysisAndTransform();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t}\r\n\r\n\t\t\t// Code for last case list block.\r\n\t\t\tdepth++;\r\n\t\t\tpCaseCode->analysis(true);\r\n\t\t\tdepth--;\r\n\r\n\t\t\t// Second loop to get the label number of the expressions referenced in the gotocases.\r\n\t\t\tp = m_pChild;\t// Pointer roaming the cases of the switch\r\n\t\t\twhile(p) {\r\n\t\t\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\t\t\tStatement* pInstruction = p->m_pChild;\t// Pointer roaming the instructions of the case\r\n\t\t\t\tif(pInstruction && pInstruction->m_statementType != STM_BLOCK) {\r\n\t\t\t\t\t// Wrap case instruction into a block to be compatible with C++ if it contains local variables\r\n\t\t\t\t\tp->m_pChild = pInstruction->wrapCaseBody();\r\n\t\t\t\t}\r\n\t\t\t\twhile(pInstruction) {\r\n\t\t\t\t\tif (pInstruction->m_statementType == STM_GOTOCASE) {\r\n\t\t\t\t\t\tpInstruction->m_expr->AnalysisAndTransform();\r\n\r\n\t\t\t\t\t\t// Fetch the corresponding case\r\n\t\t\t\t\t\tStatement* pCase = m_pChild;\r\n\t\t\t\t\t\tbool matched = false;\r\n\t\t\t\t\t\twhile(pCase && !matched) {\r\n\t\t\t\t\t\t\tif(pInstruction->m_expr->m_expressionType == EXPR_CTE) { // Constant --> compare values\r\n\t\t\t\t\t\t\t\tmatched = pCase->m_expr->compareValues(pInstruction->m_expr);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\t// Enum --> compare texts\r\n\t\t\t\t\t\t\t\tmatched = (strcmp(pCase->m_expr->m_text, pInstruction->m_expr->m_text) == 0);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(!matched) {\r\n\t\t\t\t\t\t\t\tpCase = pCase->m_pNext;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(matched) {\r\n\t\t\t\t\t\t\tpInstruction->m_counter = pCase->m_counter;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tcompilerError(ERR_USER, \"Case not found\", pInstruction->m_line);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpInstruction = pInstruction->m_pNext;\r\n\t\t\t\t}\r\n\t\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase STM_GOTOCASE: \r\n\t\tm_expr->AnalysisAndTransform();\r\n\t\tbreak;\r\n\tcase STM_GOTODEFAULT:\r\n\t\tbreak;\r\n\tcase STM_CASE: \r\n\t\t// Nothing to do --> See Switch implementation.\r\n\t\tbreak;\r\n\tcase STM_CASEDEFAULT: \r\n\t\t// Nothing to do --> See Switch implementation.\r\n\t\tbreak;\r\n\r\n\tcase STM_UNSAFE:\r\n\t\t{\r\n\t\t\tbool unsafe = g_unsafe;\r\n\t\t\tg_unsafe = true;\r\n\t\t\tm_pChild->analysis();\r\n\t\t\tg_unsafe = unsafe;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_WHILE: \r\n\t\tthis->m_expr->AnalysisAndTransform();\r\n\t\tthis->m_pChild->analysis();\r\n\t\tbreak;\r\n\tcase STM_DOWHILE: \r\n\t\tthis->m_pChild->analysis();\r\n\t\tthis->m_expr->AnalysisAndTransform();\r\n\t\tbreak;\r\n\r\n\tcase STM_FOR: \r\n\t\t// Expr : condition opt\r\n\t\t{\r\n\t\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\t\tStatement* p = m_pChild;\r\n\t\t\t\tp->analysis(false);\r\n\t\t\t\tthis->m_expr->AnalysisAndTransform();\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t\tp->analysis(false);\r\n\t\t\tp = p->m_pNext;\r\n\t\t\tp->analysis(false);\r\n\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase STM_FOREACH: \r\n\t\tbreak;\r\n\tcase STM_BREAK: \r\n\t\tbreak;\r\n\tcase STM_CONTINUE: \r\n\t\tbreak;\r\n\tcase STM_GOTO: \r\n\t\tbreak;\r\n\r\n\tcase STM_RETURN: \r\n\t\t{\r\n\t\t\tTypeObject* typeOfDelegate = NULL;\r\n\t\t\tbool assignDelegate = false;\r\n\r\n\t\t\tif (m_expr) { \r\n\t\t\t\tm_expr->AnalysisAndTransform(); \r\n\t\t\t\tif ((m_expr->m_item.symbolType == EGENRE::_METHOD) && (m_expr->m_expressionType != EXPR_INVOKE)) {\r\n\t\t\t\t\tassignDelegate = true;\r\n\t\t\t\t\ttypeOfDelegate = gReturnType;\r\n\t\t\t\t\tprocessDelegateAssignment(m_expr,typeOfDelegate, assignDelegate);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_THROW: \r\n\t\tif (m_expr) {\r\n\t\t\tm_expr->AnalysisAndTransform();\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_TRY: \r\n\t\t// First child is code\r\n\t\tdepth++;\r\n\t\t\tp->analysis();\r\n\t\tdepth--;\r\n\r\n\r\n\t\t// Parse the list of CATCH / FINALLY\r\n\t\t{\r\n\t\t\tStatement* p2 = m_pNext;\r\n\t\t\tbool firstCatch = true;\r\n\t\t\twhile (p2 && (p2->m_statementType == STM_CATCH || p2->m_statementType == STM_FINALLY)) {\r\n\t\t\t\tdepth++;\r\n\t\t\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\t\t\tif(p2->lbl) {\r\n\t\t\t\t\tp2->m_type->getResolvedType(gCurrentAC);\r\n\t\t\t\t\tVariable* exception = CreateVarInstance(p2->lbl);\r\n\t\t\t\t\texception->m_type = p2->m_type;\r\n\t\t\t\t\tgCurrentSD->addVariable(exception);\r\n\t\t\t\t}\r\n\t\t\t\tp2->m_pChild->analysis();\r\n\t\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\t\t\tdepth--;\r\n\t\t\t\tp2 = p2->m_pNext;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase STM_CATCH: \r\n\tcase STM_FINALLY: \r\n\t\t//\r\n\t\t// Do nothing, See STM_TRY\r\n\t\t//\r\n\t\tbreak;\r\n\tcase STM_CHECKED: \r\n\tcase STM_UNCHECKED: \r\n\t\t// Unsupported, generate compiler error in parser for CHECKED, jump dump sub expression in C++\r\n\t\tp->analysis();\r\n\t\tbreak;\r\n\tcase STM_LOCK:\r\n\t\t// Unsupported, generate compiler error in parser for LOCK.\r\n\t\tbreak;\r\n\tcase STM_USING: \r\n\t\t// Unsupported, generate compiler error in parser for USING as statement.\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Invalid Statement here\", m_line);\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// Dump all brother\r\n\tif (processBrother) {\r\n\t\tm_pNext->analysis();\r\n\t}\r\n}\r\n\r\nvoid Statement::dumpStatement(bool processBrother) {\r\n\t// Force to stop recursion, without test each\r\n\tif (this == NULL) { return; }\r\n\r\n\tStatement* p = m_pChild;\r\n\r\n\tswitch (m_statementType) {\r\n\tcase STM_UNDEFINED: \r\n\t\tcompilerError(ERR_INTERNAL, \"Invalid Statement here\", m_line);\r\n\r\n\t\tbreak;\r\n\tcase STM_BLOCK: \r\n\t\ttab(); printf(\"{\\n\");\r\n\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\tdepth++;\r\n\t\t\tp->dumpStatement();\r\n\t\tdepth--;\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\ttab();printf(\"}\\n\");\r\n\t\tbreak;\r\n\tcase STM_NILWRAPPER: \r\n\t\t// Use by STM_FOR and act only as a \"wrapper\" to maintain order.\r\n\t\tp->dumpStatement();\r\n\r\n\t\tbreak;\r\n\tcase STM_NULL: \r\n\t\tif(!g_forArgument) {\r\n\t\t\tprintf(\";\\n\");\r\n\t\t}\r\n\r\n\t\tbreak;\r\n\tcase STM_LABEL: \r\n\t\tdepth--;\r\n\t\ttab(); printf(\"%s:\\n\", this->lbl);\r\n\t\tdepth++;\r\n\t\tm_pChild->dumpStatement();\r\n\r\n\t\tbreak;\r\n\tcase STM_LOCAL_PERVAR:\r\n\t\tif(!g_forArgument) {\r\n\t\t\ttab();\r\n\t\t}\r\n\t\tgCurrentSD->addVariable(m_vars);\r\n\t\tif (this->m_bConstant) {\r\n\t\t\t// Const var in C# -> static const var in C++ ?\r\n\t\t\tprintf(\"static const \");\r\n\t\t}\r\n\t\tprintf(m_vars->m_type->dumpTypeForCode(gCurrentAC));\r\n\t\t// No need to dump \"var_name = \" anymore, now as expression.\r\n\t\tif (this->m_expr) {\r\n\t\t\tprintf(\" \");\r\n\t\t\tthis->m_expr->dumpExpression();\r\n\t\t} else {\r\n\t\t\tprintf(\" %s\",this->m_vars->getName());\r\n\t\t}\r\n\r\n\t\tif(!g_forArgument) {\r\n\t\t\tprintf(\";\\n\");\r\n\t\t}\r\n\t\telse if(this->m_pNext) {\r\n\t\t\tprintf(\", \");\r\n\t\t}\r\n\t\tbreak;\r\n\tcase STM_LOCALVAR:\r\n\t\t{\r\n\t\t\tStatement* pCaseCode = p->m_pChild; \r\n\t\t\twhile (p) {\r\n\t\t\t\tp->dumpStatement(false);\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_WRAP_EXP:\t\t\tif(!g_forArgument) tab(); m_expr->dumpExpression(); if(!g_forArgument) printf(\";\\n\"); else if(m_pNext) printf(\", \"); break;\r\n\tcase STM_ASSIGN_EXPR:\t\tif(!g_forArgument) tab(); dumpWrapper(m_expr, !g_unsafe); if(!g_forArgument) printf(\";\\n\"); else if(m_pNext) printf(\", \"); break;\r\n\tcase STM_WRAPPER_POSTINCR:\tif(!g_forArgument) tab(); dumpWrapper(m_expr, !g_unsafe); if(!g_forArgument) printf(\";\\n\"); else if(m_pNext) printf(\", \"); break;\r\n\tcase STM_WRAPPER_POSTDECR:\tif(!g_forArgument) tab(); dumpWrapper(m_expr, !g_unsafe); if(!g_forArgument) printf(\";\\n\"); else if(m_pNext) printf(\", \"); break;\r\n\tcase STM_WRAPPER_PREINCR:\tif(!g_forArgument) tab(); dumpWrapper(m_expr, !g_unsafe); if(!g_forArgument) printf(\";\\n\"); else if(m_pNext) printf(\", \"); break;\r\n\tcase STM_WRAPPER_PREDECR:\tif(!g_forArgument) tab(); dumpWrapper(m_expr, !g_unsafe); if(!g_forArgument) printf(\";\\n\"); else if(m_pNext) printf(\", \"); break;\r\n\r\n\tcase STM_IF: \r\n\t\t{\r\n\t\t\ttab(); printf(\"if (\"); m_expr->dumpExpression(); printf(\")\\n\");\r\n\t\t\t// If code\r\n\t\t\tp->dumpStatement(false);\r\n\t\t\t// else code\r\n\t\t\tp = p->m_pNext;\r\n\t\t\tif (p) {\r\n\t\t\t\ttab(); printf(\"else\\n\");\r\n\t\t\t\tp->dumpStatement(false);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_SWITCH:\r\n\t\t// TODO SWITCH : Check data type --> Switch in C++ are only using int.\r\n\t\t//\t==> Perform a conversion of all cases ? -> If / elseIf tree ? => Better than generate an error and complain.\r\n\t\t// Note : If a class as a conversion operator to a int/string, then it become possible.\r\n\t\t// this->m_expr->solveExpressionType();\r\n\t\tgSwitchCount++;\r\n\r\n\t\ttab(); printf(\"switch (\"); m_expr->dumpExpression(); printf(\") {\\n\");\r\n\t\t{\r\n\t\t\tStatement* pCaseCode = p->m_pChild; \r\n\t\t\twhile (p) {\r\n\t\t\t\t//\r\n\t\t\t\t// Dump Case inner code WHEN case list is completed.\r\n\t\t\t\t//\r\n\t\t\t\tif (pCaseCode != p->m_pChild) {\r\n\t\t\t\t\tdepth++;\r\n\t\t\t\t\tpCaseCode->dumpStatement(true);\r\n\t\t\t\t\tpCaseCode = p->m_pChild;\r\n\t\t\t\t\tdepth--;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (p->m_statementType == STM_CASE) {\r\n\t\t\t\t\ttab(); printf(\"case \"); p->m_expr->dumpExpression(); printf(\": sw_$lbl_%i_%i\",gSwitchCount, p->m_counter); printf(\":\\n\");\r\n\t\t\t\t} else\r\n\t\t\t\tif (p->m_statementType == STM_CASEDEFAULT) {\r\n\t\t\t\t\ttab(); printf(\"default : sw_$lbl_%i_default:\\n\",gSwitchCount);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t}\r\n\r\n\t\t\t// Code for last case list block.\r\n\t\t\tdepth++;\r\n\t\t\tpCaseCode->dumpStatement(true);\r\n\t\t\tdepth--;\r\n\t\t}\r\n\t\ttab(); printf(\"}\\n\");\r\n\t\tbreak;\r\n\tcase STM_GOTOCASE: \r\n\t\ttab(); printf(\"goto sw_$lbl_%i_%i;\\n\",gSwitchCount,m_counter);\r\n\t\tbreak;\r\n\tcase STM_GOTODEFAULT:\r\n\t\ttab(); printf(\"goto sw_$lbl_%i_default;\\n\",gSwitchCount);\r\n\t\tbreak;\r\n\tcase STM_CASE: \r\n\t\t// Nothing to do --> See Switch implementation.\r\n\t\tbreak;\r\n\tcase STM_CASEDEFAULT: \r\n\t\t// Nothing to do --> See Switch implementation.\r\n\t\tbreak;\r\n\r\n\tcase STM_UNSAFE:\r\n\t\t{\r\n\t\t\tbool unsafe = g_unsafe;\r\n\t\t\tg_unsafe = true;\r\n\t\t\tm_pChild->dumpStatement();\r\n\t\t\tg_unsafe = unsafe;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_WHILE: \r\n\t\ttab(); printf(\"while (\");\r\n\t\tthis->m_expr->dumpExpression(); printf(\")\");\r\n\t\tif(this->m_pChild->m_statementType != STM_NULL) {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t}\r\n\t\tif(this->m_pChild->m_statementType != STM_BLOCK && this->m_pChild->m_statementType != STM_NULL) {\r\n\t\t\tdepth--;\r\n\t\t\ttab();\r\n\t\t\tdepth++;\r\n\t\t}\r\n\t\tthis->m_pChild->dumpStatement();\r\n\t\tbreak;\r\n\tcase STM_DOWHILE: \r\n\t\ttab(); printf(\"do\");\r\n\t\tif(this->m_pChild->m_statementType != STM_NULL) {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t}\r\n\t\tif(this->m_pChild->m_statementType != STM_BLOCK && this->m_pChild->m_statementType != STM_NULL) {\r\n\t\t\tdepth--;\r\n\t\t\ttab();\r\n\t\t\tdepth++;\r\n\t\t}\r\n\t\tthis->m_pChild->dumpStatement();\r\n\t\ttab(); printf(\"while (\"); this->m_expr->dumpExpression(); printf(\");\\n\");\r\n\t\tbreak;\r\n\r\n\tcase STM_FOR: \r\n\t\t// Expr : condition opt\r\n\t\t{\r\n\t\t\tStatement* p = m_pChild;\r\n\r\n\t\t\t// Init section\r\n\t\t\tbool multipleInit = (p->m_pChild && p->m_pChild->m_pChild->m_pNext);\r\n\t\t\tif(multipleInit) {\r\n\t\t\t\ttab(); printf(\"{\\n\");\r\n\t\t\t\tdepth++;\r\n\t\t\t\tp->dumpStatement(false);\r\n\t\t\t\ttab(); printf(\"for (;\");\r\n\t\t\t\tg_forArgument = true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tg_forArgument = true;\r\n\t\t\t\ttab(); printf(\"for (\"); \r\n\t\t\t\tp->dumpStatement(false); printf(\";\");\r\n\t\t\t}\r\n\t\t\t// Condition section\r\n\t\t\tif(this->m_expr) {\r\n\t\t\t\tthis->m_expr->dumpExpression();\r\n\t\t\t}\r\n\t\t\tprintf(\";\"); \r\n\t\t\t// Next Section\r\n\t\t\tp = p->m_pNext;\r\n\t\t\tp->dumpStatement(false);\r\n\t\t\tprintf(\")\");\r\n\t\t\tif(p->m_pNext->m_pChild->m_statementType != STM_NULL) {\r\n\t\t\t\tprintf(\"\\n\");\r\n\t\t\t}\r\n\t\t\t// Code inside the for.\r\n\t\t\tg_forArgument = false;\r\n\t\t\tp = p->m_pNext;\r\n\t\t\tif(p->m_pChild->m_statementType != STM_BLOCK && p->m_pChild->m_statementType != STM_NULL) {\r\n\t\t\t\tdepth--;\r\n\t\t\t\ttab();\r\n\t\t\t\tdepth++;\r\n\t\t\t}\r\n\t\t\tp->dumpStatement(false);\r\n\t\t\tif(multipleInit) {\r\n\t\t\t\tdepth--;\r\n\t\t\t\ttab(); printf(\"}\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase STM_FOREACH: \r\n\t\t// TODO FOR EACH\r\n\t\tbreak;\r\n\r\n\tcase STM_BREAK: \r\n\t\ttab(); printf(\"break;\\n\"); // TO DO check. Is valid same as C++ ?\r\n\t\tbreak;\r\n\tcase STM_CONTINUE: \r\n\t\ttab(); printf(\"continue;\\n\"); // TO DO check.\r\n\t\tbreak;\r\n\tcase STM_GOTO: \r\n\t\ttab(); printf(\"goto %s;\\n\",this->lbl);\r\n\t\tbreak;\r\n\r\n\tcase STM_RETURN: \r\n\t\ttab(); printf(\"return \"); if (m_expr) { \r\n\t\t\t// printf(\"/*\\n\");\r\n\t\t\t// m_expr->dumpTree();\r\n\t\t\t// printf(\"*/\\n\");\r\n\t\t\tm_expr->dumpExpression(); \r\n\t\t} printf(\";\\n\");\r\n\t\tbreak;\r\n\r\n\tcase STM_THROW: \r\n\t\tif (m_expr) {\r\n\t\t\ttab(); printf(\"THROW(\"); m_expr->dumpExpression(); printf(\");\\n\");\r\n\t\t} else {\r\n\t\t\t// throw; -> use hidden variable.\r\n\t\t\ttab(); printf(\"THROW(_$hiddenExcep);\\n\");\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase STM_TRY: \r\n\t\ttab(); printf(\"TRY\\n\");\r\n\t\t// First child is code\r\n\t\tp->dumpStatement();\r\n\t\tp = m_pNext;\r\n\r\n\t\ttab(); printf(\"CTRY\\n\");\r\n\t\t\r\n\t\t// \"FIRSTCATCH(x)\", \"ELSECATCH(x)\", \"FINALLY\"\r\n\r\n\t\t// Parse the list of CATCH / FINALLY\r\n\t\t{\r\n\t\t\tbool firstCatch = true;\r\n\t\t\tbool hasFinally = false;\r\n\t\t\twhile (p && (p->m_statementType == STM_TRY || p->m_statementType == STM_CATCH || \r\n\t\t\t\t         p->m_statementType == STM_FINALLY)) {\r\n\t\t\t\tif (p->m_statementType == STM_CATCH) {\r\n\t\t\t\t\tif (firstCatch) {\r\n\t\t\t\t\t\tfirstCatch = false;\r\n\t\t\t\t\t\ttab(); printf(\"FIRSTCATCH(\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttab(); printf(\"ELSECATCH(\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (p->m_type) {\r\n\t\t\t\t\t\tprintf(p->m_type->getFullName(gCurrentAC)); printf(\",\"); printf(p->lbl ? p->lbl : \"_$hiddenExcep\"); /*dumpTypeForCode(); // TODO : do not * the type*/\r\n\t\t\t\t\t\tprintf(\")\\n\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprintf(\"System::Exception,_$hiddenExcep)\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t} else { // Finally\r\n\t\t\t\t\thasFinally = true;\r\n\t\t\t\t\ttab(); printf(\"FINALLY\\n\");\r\n\t\t\t\t}\r\n\t\t\t\tp->m_pChild->dumpStatement();\r\n\r\n\t\t\t\t// Handle Type here to simplify structure and counting.\r\n\t\t\t\tp = p->m_pNext;\r\n\t\t\t}\r\n\t\t\tif(!hasFinally) {\r\n\t\t\t\t// Dump FINALLY anyway to close the CATCH statement.\r\n\t\t\t\ttab(); printf(\"FINALLY\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\ttab(); printf(\"ETRY\\n\");\r\n\r\n\t\tbreak;\r\n\tcase STM_CATCH: \r\n\tcase STM_FINALLY: \r\n\t\t//\r\n\t\t// Do nothing, See STM_TRY\r\n\t\t//\r\n\t\tbreak;\r\n\tcase STM_CHECKED: \r\n\tcase STM_UNCHECKED: \r\n\t\t// Unsupported, generate compiler error in parser for CHECKED, jump dump sub expression in C++\r\n\t\tp->dumpStatement();\r\n\t\tbreak;\r\n\tcase STM_LOCK:\r\n\t\t// Unsupported, generate compiler error in parser for LOCK.\r\n\t\tbreak;\r\n\tcase STM_USING: \r\n\t\t// Unsupported, generate compiler error in parser for USING as statement.\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Invalid Statement here\", m_line);\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// Dump all brother\r\n\tif (processBrother) {\r\n\t\tm_pNext->dumpStatement();\r\n\t}\r\n}\r\n\r\nvoid SRSymbol::dump(bool assign) {\r\n\tswitch (symbolType) {\r\n\tcase EGENRE::_VARIABLE: \r\n\t\tprintf(pSymbol->getName());\r\n\t\tbreak;\r\n\tcase EGENRE::_MEMBER:\r\n\t\t{\r\n\t\t\t//\r\n\t\t\t// If member is static or const, safe access.\r\n\t\t\t//\r\n\r\n\t\t\tVariable* pVar = (Variable*)this->pSymbol;\r\n\t\t\tif (g_unsafe || (pVar->m_modifier & ATT_STATIC)) {\r\n\t\t\t\tprintf(pSymbol->getName());\r\n\t\t\t} else {\r\n\t\t\t\t// Convert into safe getter\r\n\t\t\t\tprintf(\"_g$%s()\",pSymbol->getName());\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_METHOD: \r\n\t\tbreak;\r\n\tcase EGENRE::_ACCESSOR:\r\n\t\t{\r\n\t\t\tAccessor* pAcc = (Accessor*)this->pSymbol;\r\n\t\t\tprintf(\"_acc_g%s\",pSymbol->m_name);\r\n\t\t\tif (!(g_unsafe || (pAcc->m_modifier & ATT_STATIC))) { printf(\"$\"); }\r\n\t\t\tprintf(\"()\");\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_DELEGATE:\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUM:\r\n\t\tbreak;\r\n\tcase EGENRE::_ABSTRACTCONTAINER: \r\n\t\tbreak;\r\n\tcase EGENRE::_NAMESPACE:\r\n\t\tbreak;\r\n\tdefault: \r\n\t\tprintf(\"###UNRESOLVED###\");\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nconst char* getExpressionString(EnumExpressionType e) {\r\n\tswitch (e) {\r\n\tcase EXPR_LIST: return \"EXPR_LIST\";\r\n\tcase EXPR_THIS: return \"EXPR_THIS\";\r\n\tcase EXPR_TYPEOF: return \"EXPR_TYPEOF\";\t// + Type\r\n\tcase EXPR_BASE: return \"EXPR_BASE\";\r\n\tcase EXPR_CTE: return \"EXPR_CTE\";\r\n\tcase EXPR_IDENT: return \"EXPR_IDENT\";\r\n\tcase EXPR_REF: return \"EXPR_REF\";\r\n\tcase EXPR_PLUSPLUS: return \"EXPR_PLUSPLUS\";\r\n\tcase EXPR_MINUSMINUS: return \"EXPR_MINUSMINUS\";\r\n\tcase EXPR_ARROW: return \"EXPR_ARROW\";\t\t// + Id\r\n\tcase EXPR_NOT: return \"EXPR_NOT\";\t\t// !\r\n\tcase EXPR_LNOT: return \"EXPR_LNOT\";\t\t// ~\r\n\tcase EXPR_ADRESSOF: return \"EXPR_ADRESSOF\";\r\n\tcase EXPR_SIZEOF: return \"EXPR_SIZEOF\";\t// + Type\r\n\tcase EXPR_PREINCR: return \"EXPR_PREINCR\";\r\n\tcase EXPR_PREDECR: return \"EXPR_PREDECR\";\r\n\tcase EXPR_UNARYPLUS: return \"EXPR_UNARYPLUS\";\r\n\tcase EXPR_UNARYMINUS: return \"EXPR_UNARYMINUS\";\r\n\tcase EXPR_UNARYMULT: return \"EXPR_MULT\";\r\n\tcase EXPR_IS: return \"EXPR_IS\";\r\n\tcase EXPR_AS: return \"EXPR_AS\";\r\n\tcase EXPR_UNCHECKED: return \"EXPR_UNCHECKED\";\r\n\tcase EXPR_CHECKED: return \"EXPR_CHECKED\";\r\n\tcase EXPR_ACCESS: return \"EXPR_ACCESS\";\t// + Expr|Id\r\n\tcase EXPR_NEW: return \"EXPR_NEW\";\t\t// + Type\r\n\tcase EXPR_DOT: return \"EXPR_DOT\";\r\n\tcase EXPR_INVOKE: return \"EXPR_INVOKE\";\r\n\tcase EXPR_CAST: return \"EXPR_CAST\";\r\n\tcase EXPR_CAST_PTR: return \"EXPR_CAST_PTR\";\r\n\tcase EXPR_MULT: return \"EXPR_MULT\";\r\n\tcase EXPR_DIV: return \"EXPR_DIV\";\r\n\tcase EXPR_MOD: return \"EXPR_MOD\";\r\n\tcase EXPR_PLUS: return \"EXPR_PLUS\";\r\n\tcase EXPR_MINUS: return \"EXPR_MINUS\";\r\n\tcase EXPR_LSHFT: return \"EXPR_LSHFT\";\r\n\tcase EXPR_RSHFT: return \"EXPR_RSHFT\";\r\n\tcase EXPR_LESS: return \"EXPR_LESS\";\r\n\tcase EXPR_MORE: return \"EXPR_MORE\";\r\n\tcase EXPR_LESSEQ: return \"EXPR_LESSEQ\";\r\n\tcase EXPR_MOREEQ: return \"EXPR_MOREEQ\";\r\n\tcase EXPR_EQUTST: return \"EXPR_EQUTST\";\r\n\tcase EXPR_DIFFTST: return \"EXPR_DIFFTST\";\r\n\tcase EXPR_LAND: return \"EXPR_LAND\";\r\n\tcase EXPR_LXOR: return \"EXPR_LXOR\";\r\n\tcase EXPR_LOR: return \"EXPR_LOR\";\r\n\tcase EXPR_AND: return \"EXPR_AND\";\r\n\tcase EXPR_OR: return \"EXPR_OR\";\r\n\tcase EXPR_XOR: return \"EXPR_XOR\";\r\n\tcase EXPR_ASS_EQ: return \"EXPR_ASS_EQ\";\r\n\tcase EXPR_ASS_PLUSEQ: return \"EXPR_ASS_PLUSEQ\";\r\n\tcase EXPR_ASS_MINUSEQ: return \"EXPR_ASS_MINUSEQ\";\r\n\tcase EXPR_ASS_STAREQ: return \"EXPR_ASS_STAREQ\";\r\n\tcase EXPR_ASS_DIVEQ: return \"EXPR_ASS_DIVEQ\";\r\n\tcase EXPR_ASS_MODEQ: return \"EXPR_ASS_MODEQ\";\r\n\tcase EXPR_ASS_XOREQ: return \"EXPR_ASS_XOREQ\";\r\n\tcase EXPR_ASS_ANDEQ: return \"EXPR_ASS_ANDEQ\";\r\n\tcase EXPR_ASS_OREQ: return \"EXPR_ASS_OREQ\";\r\n\tcase EXPR_ASS_RSHFTEQ: return \"EXPR_ASS_RSHFTEQ\";\r\n\tcase EXPR_ASS_LSHFTEQ: return \"EXPR_ASS_LSHFTEQ\";\r\n\tcase EXPR_COND: return \"EXPR_COND\";\r\n\tdefault: return \"UNKOWN EXPRESSION\";\r\n\t}\r\n}\r\n\r\nint dumpDepth = 0;\r\nvoid Expression::dumpTree() {\r\n\tfor (int m=0; m < dumpDepth; m++) { printf(\" \"); }\t\r\n\tprintf(getExpressionString(this->m_expressionType));\r\n\tif ((this->m_expressionType == EXPR_IDENT) || (this->m_expressionType == EXPR_INVOKE) || (this->m_expressionType == EXPR_DOT)) {\r\n\t\tprintf(\" %s \", this->m_text);\r\n\t}\r\n\tprintf(\"\\n\");\r\n\tdumpDepth++;\r\n\tfor (int n=0; n < m_expressionCount; n++) {\r\n\t\tif (m_expressions[n]) {\r\n\t\t\tm_expressions[n]->dumpTree();\r\n\t\t} else {\r\n\t\t\tfor (int m=0; m < dumpDepth; m++) { printf(\" \"); }\t\r\n\t\t\tprintf(\"(null)\\n\");\r\n\t\t}\r\n\t}\r\n\tdumpDepth--;\r\n}\r\n\r\nSRSymbol Expression::resolveIteration(const char* text, SRSymbol input, TypeObject*& lastType, SRSymbol& item, u8 searchMask, Expression* methodSignature, Variable* delegateSignature, TypeGenericEntry* genParams) {\r\n\tSRSymbol res;\r\n\t/*\r\n\tif(searchFunction) {\r\n\t\titem = resolveSimpleSymbol(input,text,SEARCH_FUNCTION | SEARCH_INHERITANCE | SEARCH_HIERARCHY);\r\n\t}\r\n\telse {*/\r\n\titem = resolveSimpleSymbol(input, text, searchMask, methodSignature, delegateSignature, genParams);\r\n\t\r\n\tswitch (item.symbolType) {\r\n\tcase EGENRE::_MEMBER:\r\n\t\t{\r\n\t\t\t// Get Member\r\n\t\t\tVariable* pVar = (Variable*)item.pSymbol;\r\n\r\n\t\t\t// Get Type of Member & Resolve relative to member owner.\r\n\t\t\tres = pVar->m_type->getResolvedType(pVar->m_ownerClass);\r\n\r\n\t\t\t// Copy type here.\r\n\t\t\tlastType = pVar->m_type;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_VARIABLE:\r\n\t\t{\r\n\t\t\t// Get Local Variable\r\n\t\t\tVariable* pVar = (Variable*)item.pSymbol;\r\n\r\n\t\t\t// Get Type of Member & Resolve relative to this class.\r\n\t\t\t// A method context is required as the type of the variable can be a local generic symbol.\r\n\t\t\tres = pVar->m_type->getResolvedType(gCurrentAC, gCurrentMethod);\r\n\r\n\t\t\t// Copy type here.\r\n\t\t\tlastType = pVar->m_type;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ACCESSOR:\r\n\t\t{\r\n\t\t\tAccessor* pAccessor = (Accessor*)item.pSymbol;\r\n\t\t\tres = pAccessor->m_type->getResolvedType(pAccessor->m_ownerClass);\r\n\t\t\t// Copy type\r\n\t\t\tlastType = pAccessor->m_type;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t{\r\n\t\t\tAbstractContainer* pCnt = (AbstractContainer*)item.pSymbol;\r\n\t\t\tlastType = pCnt->getType();\r\n\t\t\tres = item;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_NAMESPACE:\r\n\t\t{\r\n\t\t\tres = item;\r\n\t\t\tm_item = item;\r\n\t\t\tlastType = NULL;\t// Expression should NEVER stop here.\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUM:\r\n\t\t{\r\n\t\t\tEnum* pEnum = (Enum*)item.pSymbol;\r\n\t\t\tlastType = pEnum->getType();\r\n\t\t\tres = item;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUMENTRY:\r\n\t\t{\r\n\t\t\tEnum::EnumEntry* pEntry = (Enum::EnumEntry*)item.pSymbol;\r\n\t\t\tlastType = pEntry->m_parent->getType();\r\n\t\t\tres = item;\r\n\t\t}\r\n\t\tbreak;\r\n    \r\n\tcase EGENRE::_DELEGATE:\r\n\t\t{\r\n\t\t\tDelegate* pDelegate = (Delegate*)item.pSymbol;\r\n\t\t\tlastType = pDelegate->getType();\r\n\t\t\tres = item;\r\n\t\t}\r\n\t\tbreak;\r\n    \r\n\tcase EGENRE::_METHOD:\r\n\t\t{\r\n\t\t\t// Found a function.\r\n\t\t\tMethod* pM = (Method*)item.pSymbol; // Workd for delegate.\r\n\t\t\tif(!pM->m_returnType) {\r\n\t\t\t\tif(pM->m_modifier & ATT_CTOR) {\r\n\t\t\t\t\t// Constructor\r\n\t\t\t\t\tres = pM->m_pOwner->getType()->m_res;\r\n\t\t\t\t\tpM->m_returnType = res.pType;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, concat2(\"No return type for the method \", pM->getName()), m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Resolve return type.\r\n\t\t\t\tres = pM->m_returnType->getResolvedType(pM->m_pOwner);\r\n\t\t\t}\r\n\t\t\t// Save type\r\n\t\t\tlastType = pM->m_returnType;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_GENDEFENTRY:\r\n\t\t// Nothing to do\r\n\t\tbreak;\r\n\tcase EGENRE::_METHODLIST:\r\n\t\tres = item;\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL,\"Error EXPR_IDENT not solved.\", m_line);\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\nvoid transformIn_This(Expression* expr) {\r\n\texpr->m_expressionType = EXPR_DOT;\r\n\r\n\tExpression* sub = CreateLeafExpr(EXPR_UNDER_THIS);\r\n\tsub->m_runtimeType = gCurrentAC->getType();\r\n\r\n\texpr->addExpression(sub);\r\n}\r\n\r\nvoid Expression::AnalysisAndTransform() {\r\n\tif (this == NULL) { return; }\r\n\r\n\tif (this->m_expressionType == EXPR_DOT) {\r\n\t\tfor(int n = 0 ; n < m_expressionCount ; n++) {\r\n\t\t\tm_expressions[n]->m_isDotRoot = false;\r\n\t\t}\r\n\t}\r\n\r\n\tif(this->m_expressionType != EXPR_INVOKE && this->m_delegateDef) {\r\n\t\t// Pass on delegate signature\r\n\t\tfor(int n = 0 ; n < m_expressionCount ; n++) {\r\n\t\t\tm_expressions[n]->m_delegateDef = m_delegateDef;\r\n\t\t}\r\n\t}\r\n\r\n\t//\r\n\t// Those specifically need to control the recursion.\r\n\t//\r\n\tswitch (this->m_expressionType) {\r\n\tcase EXPR_INVOKE:\r\n\tcase EXPR_PLUS:\r\n\tcase EXPR_ASS_EQ:\r\n\tcase EXPR_DELEGATECREATE:\r\n\tcase EXPR_NEW:\r\n\tcase EXPR_CAST:\r\n\t\tbreak;\r\n\tdefault:\r\n\t\t// Parse all sub expression\r\n\t\tfor (int n=0; n < this->m_expressionCount; n++) {\r\n\t\t\tm_expressions[n]->AnalysisAndTransform();\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// . Transform indexer to get / set --> Really !? C++ not OK ?\r\n\tswitch (this->m_expressionType) {\r\n\t// Multiple\r\n\tcase EXPR_LIST:\r\n\tcase EXPR_LIST_INIT:\r\n\t\tbreak;\r\n\t\r\n\tcase EXPR_DELEGATECREATE:\r\n\t\t{\r\n\t\t\tif(this->m_item.symbolType == EGENRE::_DELEGATE) {\r\n\t\t\t\t// The expression has already been analysed.\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tVariable* pList = NULL;\r\n\t\t\tVariable* pListStart = NULL;\r\n\r\n\t\t\tif (!gIsStaticFunc) {\r\n\t\t\t\tVariable* pNew = new Variable();\r\n\t\t\t\tpNew->setType(gCurrentAC->getType());\r\n\t\t\t\tpNew->setName(\"_this__\");\r\n\t\t\t\tthis->m_anonymousClass->addMember(pNew);\r\n\t\t\t\tpList = pNew;\r\n\t\t\t\tpListStart = pList;\r\n\t\t\t}\r\n\t\t\r\n\t\t\tSymbolDictionary* pDic = gCurrentSD;\r\n\t\t\twhile (pDic) {\r\n\t\t\t\tSymbolDictionary::VariableList* pVariable = pDic->m_list;\r\n\t\t\t\twhile (pVariable) {\r\n\t\t\t\t\tif (pVariable->content) {\r\n\t\t\t\t\t\tif (pVariable->content->m_ignoreDelegate == false) {\r\n\t\t\t\t\t\t\tVariable* pNew = new Variable();\r\n\r\n\t\t\t\t\t\t\tif (pList) {\r\n\t\t\t\t\t\t\t\tpList->m_pNextVariable = pNew;\r\n\t\t\t\t\t\t\t\tpList = pNew;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tpList = pNew;\r\n\t\t\t\t\t\t\t\tpListStart = pList;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tpNew->setName(pVariable->content->getName());\r\n\t\t\t\t\t\t\tpNew->setType(pVariable->content->m_type);\r\n\r\n\t\t\t\t\t\t\tthis->m_anonymousClass->addMember(pNew);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpVariable = pVariable->pNext;\r\n\t\t\t\t}\r\n\t\t\t\tpDic = pDic->m_parent;\r\n\t\t\t}\r\n\r\n\t\t\t// Create Ctor with all member.\r\n\t\t\tMethod* pMCtor = new Method();\r\n\t\t\tpMCtor->setName(this->m_anonymousClass->getName());\r\n\t\t\tpMCtor->m_modifier |= ATT_CTOR;\r\n\t\t\tpMCtor->m_parameters = pListStart;\r\n\t\t\tthis->m_anonymousClass->addMethod(pMCtor);\r\n\r\n\t\t\t// Create calling method.\r\n\t\t\tMethod* pM = new Method();\r\n\t\t\tpM->setName(\"_delegate\");\r\n\r\n\t\t\tgTransformAsDelegate = true;\r\n\t\t\tpM->m_codeBlock\t\t= this->m_delegateCode;\r\n\t\t\tpM->m_parameters\t= this->m_delegateSignature;\r\n\r\n\t\t\tAbstractContainer* currClass = gCurrentAC;\r\n\r\n\t\t\tgCurrentAC = this->m_anonymousClass;\r\n\t\t\t// Create global dico + Add function parameters to dictionnary.\r\n\t\t\tif (gCurrentSD) {\r\n\t\t\t\tgCurrentSD = gCurrentSD->addDictionary();\t// Inside a function.\r\n\t\t\t} else {\r\n\t\t\t\tgCurrentSD = new SymbolDictionary();\t\t// Member init.\r\n\t\t\t}\r\n\r\n\t\t\tVariable* pParameter = pM->m_parameters;\r\n\t\t\twhile(pParameter) {\r\n\t\t\t\t// Register variable as local symbols for code.\r\n\t\t\t\tgCurrentSD->addVariable(pParameter);\r\n\t\t\t\tpParameter = pParameter->m_pNextVariable;\r\n\t\t\t}\r\n\r\n\t\t\tpM->m_codeBlock->analysis();\r\n\t\t\tgCurrentAC = currClass;\r\n\t\t\tgTransformAsDelegate = false;\r\n\r\n\t\t\t// Destroy dico + Remove variable/parameters from dictionnary.\r\n\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\r\n\r\n\t\t\tpM->m_parameters\t= this->m_delegateSignature;\r\n\t\t\t// Get return type from recursion.\r\n\t\t\tpM->m_returnType\t= this->m_delegateDef->m_returnType;\r\n\r\n\t\t\tthis->m_anonymousClass->addMethod(pM);\r\n\r\n\t\t\t// Necessary for assignment operator test. (resolved like EXPR_DOT or EXPR_IDENT)\r\n\t\t\tthis->m_item.symbolType = EGENRE::_DELEGATE;\r\n\t\t}\r\n\r\n\t\tbreak;\r\n\t// Leaf\r\n\tcase EXPR_UNDER_THIS:\r\n\t\t// Do nothing.\r\n\t\tbreak;\r\n\tcase EXPR_THIS:\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = gCurrentAC->getType();\r\n\t\tif (!gTransformAsDelegate) {\r\n\t\t\t// Do nothing.\r\n\t\t} else {\r\n\t\t\t//\r\n\t\t\t// Morphed itself into _this__ ! Yeah ! => Delegate\r\n\t\t\t//\r\n\t\t\tthis->m_expressionType = EXPR_UNDER_THIS;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_BASE: \r\n\t\t{\r\n\t\t\tTypeObject* pParent = gCurrentAC->getAncestor(); \r\n\t\t\t// Return type DONE\r\n\t\t\tthis->m_runtimeType = pParent ? pParent : &t_OBJECT;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_IDENT:\r\n\tcase EXPR_DOT: \r\n\t\t{\r\n\t\t\tif(m_delegateDef) {\r\n\t\t\t\tAnalysisMethodForDelegate(this->m_genericCall);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tSRSymbol res;\r\n\t\t\t\tu8 searchMask;\r\n\r\n\t\t\t\t// Handle DOT or IDENT\r\n\t\t\t\tif (m_expressionCount == 0 || m_expressions[0] == NULL) {\r\n\t\t\t\t\tres.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\t\t\t\tres.pSymbol\t\t= gCurrentAC;\r\n\t\t\t\t\tsearchMask\t\t= SEARCH_ALL;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(m_expressions[0]->m_runtimeType) {\r\n\t\t\t\t\t\t// Class / Enum / Namespace could be possible.\r\n\t\t\t\t\t\tres = m_expressions[0]->m_runtimeType->m_res;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// Namespaces don't have a runtime type\r\n\t\t\t\t\t\tres = m_expressions[0]->m_item;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsearchMask = SEARCH_ALL & ~SEARCH_VARIABLE;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(!m_isInvoked && !m_isDotRoot) {\r\n\t\t\t\t\t// Can't be a method\r\n\t\t\t\t\tsearchMask &= ~SEARCH_FUNCTION;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tres = resolveIteration(this->m_text, res, this->m_runtimeType,this->m_item, searchMask);\r\n\t\t\t}\r\n\r\n\t\t\tif (this->m_runtimeType && this->m_runtimeType->m_res.symbolType == EGENRE::_GENDEFENTRY && m_expressions[0]) {\r\n\t\t\t\t// Substitute generic type\r\n\t\t\t\tif(m_expressions[0]->m_runtimeType->m_res.symbolType == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\t\t\tAbstractContainer* pAC = (AbstractContainer*)m_expressions[0]->m_runtimeType->m_res.pSymbol;\r\n\t\t\t\t\tTypeGenericDefinitionEntry* pGen = this->m_runtimeType->m_definitionGeneric;\r\n\t\t\t\t\tthis->m_runtimeType = pAC->getGenericType(pGen, m_expressions[0]->m_runtimeType->m_generic);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Template is not a class\", m_expressions[0]->m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (gTransformAsDelegate) { \r\n\t\t\t\t// Insert a \"_this + .\" !, transform into EXPR_DOT.\r\n\t\t\t\tif (this->m_expressionType == EXPR_IDENT) {\r\n\t\t\t\t\tswitch (this->m_item.symbolType) {\r\n\t\t\t\t\tcase EGENRE::_MEMBER:\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tVariable* pVar = (Variable*)this->m_item.pSymbol;\r\n\t\t\t\t\t\t\tif ((pVar->m_modifier & ATT_STATIC) == 0) {\r\n\t\t\t\t\t\t\t\ttransformIn_This(this);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase EGENRE::_METHOD:\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tMethod* pM = (Method*)this->m_item.pSymbol;\r\n\t\t\t\t\t\t\tif ((pM->m_modifier & ATT_STATIC) == 0) {\r\n\t\t\t\t\t\t\t\ttransformIn_This(this);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (g_analysis_static) {\r\n\t\t\t\tswitch (this->m_item.symbolType) {\r\n\t\t\t\tcase EGENRE::_MEMBER:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tVariable* pVar = (Variable*)this->m_item.pSymbol;\r\n\t\t\t\t\t\tif (pVar->m_modifier & ATT_STATIC) {\r\n\t\t\t\t\t\t\tgStaticDepMatrix->createDependancy(gCurrVar, pVar);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tcompilerError(ERR_INTERNAL,\"Non static member used in static assignement, WTF.\", m_line);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EGENRE::_ACCESSOR:\r\n\t\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\tcase EGENRE::_NAMESPACE:\r\n\t\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\tcase EGENRE::_ENUMENTRY:\r\n\t\t\t\tcase EGENRE::_METHOD:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// No dependancy.\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL,\"Unprocessed case\", m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(this->m_expressionCount > 0) {\r\n\t\t\t\t\tif(this->m_expressions[0]->m_item.symbolType == EGENRE::_ABSTRACTCONTAINER\r\n\t\t\t\t\t&& this->m_item.symbolType == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\t\t\t\t// This inner class will be unnested, so its container should not be dumped.\r\n\t\t\t\t\t\tthis->m_expressions[0]->m_bSkip = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_INVOKE:\r\n\t\t{\r\n\t\t\t//Analyze generic symbols\r\n\t\t\tTypeGenericEntry* pGen = this->m_genericCall;\r\n\t\t\twhile(pGen) {\r\n\t\t\t\tpGen->m_instanceType->getResolvedType(gCurrentAC, gCurrentMethod);\r\n\t\t\t\tpGen->m_genericName = pGen->m_instanceType->dumpTypeForCode(gCurrentAC, gCurrentMethod);\r\n\t\t\t\tpGen = pGen->m_pNext;\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Descending and solving sub systems.\r\n\t\t\t//\r\n\t\t\tm_expressions[1]->AnalysisAndTransform();\r\n\t\t\tif(m_expressions[1]->isAmbiguous()) {\r\n\t\t\t\t// TODO : try every combinaison\r\n\t\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Overloaded methods as method parameters are not supported yet\", m_expressions[1]->m_line);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tm_expressions[0]->AnalysisInvokeMethod(m_expressions[1], m_genericCall);\r\n\t\t\t}\r\n\r\n\t\t\tif (m_expressions[0]->m_runtimeType->m_res.symbolType == EGENRE::_GENDEFENTRY) {\r\n\t\t\t\tTypeGenericDefinitionEntry* pGen = m_expressions[0]->m_runtimeType->m_definitionGeneric;\r\n\t\t\t\tMethod* pMethod = (Method*)m_expressions[0]->m_item.pSymbol;\r\n\t\t\t\tm_expressions[0]->m_runtimeType = pMethod->getGenericType(pGen, this->m_runtimeType->m_generic);\r\n\t\t\t}\r\n\r\n\t\t\t// Special case : method which returns a delegate\r\n\t\t\tif (m_expressions[0]->m_item.symbolType == EGENRE::_METHOD && m_expressions[0]->m_runtimeType->m_genreID == EGENRE::_DELEGATE) {\r\n\t\t\t\tswitch(m_expressions[0]->m_expressionType)\r\n\t\t\t\t{\r\n\t\t\t\tcase EXPR_IDENT :\r\n\t\t\t\tcase EXPR_DOT :\r\n\t\t\t\t\t// Still a method at this level of the tree\r\n\t\t\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\t\t\t\tthis->m_item\t\t= m_expressions[0]->m_item;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EXPR_INVOKE :\t//getDelegate()() style\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tDelegate* pDelegate = m_expressions[0]->m_runtimeType->m_definitionDelegate;\r\n\t\t\t\t\t\tSRSymbol symbol;\r\n\t\t\t\t\t\tsymbol.pSymbol = (Symbol*)pDelegate;\r\n\t\t\t\t\t\tsymbol.pType = m_expressions[0]->m_runtimeType;\r\n\t\t\t\t\t\tsymbol.symbolType = EGENRE::_DELEGATE;\r\n\t\t\t\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\t\t\t\t\tthis->m_item = symbol;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL,\"The method is neither an identifier, an invoke nor a dot expression ?\", m_expressions[0]->m_line);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (m_expressions[0]->m_runtimeType == NULL) {\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Unresolved invoke symbol\", m_expressions[0]->m_line);\r\n\t\t\t\tSRSymbol notFound;\r\n\t\t\t\tnotFound.symbolType\t= EGENRE::_UNDEFGENRE;\r\n\t\t\t\tnotFound.pSymbol\t= createNotFoundSymbol();\r\n\t\t\t\tm_item = notFound;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\telse if (m_expressions[0]->m_runtimeType->m_genreID == EGENRE::_DELEGATE) {\r\n\t\t\t\tDelegate* pDelegate = m_expressions[0]->m_runtimeType->m_definitionDelegate;\r\n\t\t\t\tSRSymbol symbol;\r\n\t\t\t\tsymbol.pSymbol = (Symbol*)pDelegate;\r\n\t\t\t\tsymbol.pType = m_expressions[0]->m_runtimeType;\r\n\t\t\t\tsymbol.symbolType = EGENRE::_DELEGATE;\r\n\t\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\t\t\tthis->m_item = symbol;\r\n\t\t\t} \r\n\t\t\telse {\r\n\t\t\t\t//\r\n\t\t\t\t// Get the result of sub (EXPR_DOT) m_expressions[0].m_item.symbolType == EGENRE::_METHOD\r\n\t\t\t\t//\r\n\t\t\t\tif (m_expressions[0]->m_item.symbolType == EGENRE::_METHOD) {\r\n\t\t\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\t\t\t\tthis->m_item\t\t= m_expressions[0]->m_item;\r\n\t\t\t\t\tMethod* pMethod = (Method*)this->m_item.pSymbol;\r\n\t\t\t\t\tpMethod->resolveDefaultParams();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Invoke not on a method, and it does not return a delegate\", m_expressions[0]->m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(m_expressions[1]) {\r\n\t\t\t\t// Transform the function parameters into delegates\r\n\t\t\t\tif(m_expressions[1]->m_expressionType == EXPR_LIST) {\r\n\t\t\t\t\tfor(int n = 0 ; n < m_expressions[1]->m_expressionCount ; n++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tExpression*& pParam = m_expressions[1]->m_expressions[n];\r\n\t\t\t\t\t\tif(pParam->isMethodAsDelegate()) {\r\n\t\t\t\t\t\t\ttransformMethodAsDelegate(pParam, n);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(pParam->m_expressionType == EXPR_COND) {\r\n\t\t\t\t\t\t\tfor(int i = 1 ; i <= 2 ; i++) {\r\n\t\t\t\t\t\t\t\tExpression*& subExpr = pParam->m_expressions[i];\r\n\t\t\t\t\t\t\t\tif(subExpr->isMethodAsDelegate()) {\r\n\t\t\t\t\t\t\t\t\tif(subExpr->m_expressionType == EXPR_IDENT || subExpr->m_expressionType == EXPR_DOT) {\r\n\t\t\t\t\t\t\t\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Please do not use the conditional operator with functions as a delegate-typed parameter\", m_expressions[1]->m_line);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\ttransformMethodAsDelegate(subExpr, n);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Method parameters are supposed to be a list\", m_expressions[1]->m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Return type DONE EXPR_INVOKE.\r\n\t\t\t//\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\t// Double\r\n\tcase EXPR_ACCESS:\r\n\t\t{\r\n\t\t\t// Same as invoke.\r\n\r\n\t\t\t//\r\n\t\t\t// Descending and solving sub systems.\r\n\t\t\t//\r\n\t\t\tm_expressions[0]->AnalysisAndTransform();\r\n\t\t\tm_expressions[1]->AnalysisAndTransform();\r\n\r\n\t\t\tTypeObject* classType = m_expressions[0]->m_runtimeType;\r\n\r\n\t\t\t// Solve which accessor need to be called.\r\n\t\t\tAccessor* pAccessor = classType->m_definitionAC->findPropertyIndexer(m_expressions[1]);\r\n\t\t\tpAccessor->m_type->getResolvedType(classType->m_definitionAC);\r\n\t\t\tif(pAccessor->m_type->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\t\t\tif(classType->m_originalType) {\r\n\t\t\t\t\t// Get the type of the array\r\n\t\t\t\t\tthis->m_runtimeType = classType->m_originalType;\r\n\t\t\t\t}\r\n\t\t\t\telse if(classType->m_generic) {\r\n\t\t\t\t\tAbstractContainer* pAC = classType->m_definitionAC;\r\n\t\t\t\t\tTypeGenericDefinitionEntry *pGen = pAccessor->m_type->m_definitionGeneric;\r\n\t\t\t\t\tthis->m_runtimeType = pAC->getGenericType(pGen, classType->m_generic);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"The class uses a generic variable, but its instance has no generic parameter\", m_expressions[0]->m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Get the output type of the accessor.\r\n\t\t\t\tthis->m_runtimeType\t= pAccessor->m_type;\r\n\t\t\t}\r\n\r\n\t\t\tif(classType->m_originalType) {\r\n\t\t\t\t// Local resolution context\r\n\t\t\t\tNameSpace*\tcontextNameSpace\t= NULL;\r\n\t\t\t\tMethod*\t\tcontextMethod\t\t= NULL;\r\n\t\t\t\tgetContext(this->m_expressions[0]->m_item.pSymbol, contextNameSpace, contextMethod);\r\n\t\t\t\tthis->m_item = this->m_runtimeType->getResolvedType(contextNameSpace, contextMethod);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis->m_item = this->m_runtimeType->getResolvedType(pAccessor->m_ownerClass);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_CTE: \r\n\t\tswitch (this->m_value.type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tthis->m_runtimeType = &t_BOOL;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_STRING:\r\n\t\t\tthis->m_runtimeType = &t_STRING;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_NULL: \r\n\t\t\tthis->m_runtimeType = &t_NULL;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tthis->m_runtimeType = &t_DOUBLE;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tthis->m_runtimeType = &t_FLOAT;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tthis->m_runtimeType = &t_INT;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tthis->m_runtimeType = &t_UINT;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tthis->m_runtimeType = &t_LONG;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tthis->m_runtimeType = &t_ULONG;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_CHAR:\r\n\t\t\tthis->m_runtimeType = &t_CHAR;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"internal error dump expression CTE\", m_line);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t// Return type DONE (for each case)\r\n\t\tbreak;\r\n\r\n\tcase EXPR_NOT: \r\n\t\t// Return type DONE\r\n\t\tm_runtimeType = &t_BOOL;\r\n\t\tbreak;\t\t// !\r\n\tcase EXPR_PLUSPLUS: \r\n\tcase EXPR_MINUSMINUS: \r\n\tcase EXPR_PREINCR:\r\n\tcase EXPR_PREDECR: \r\n\t\t// Return type DONE (same type)\r\n\t\tm_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\tif(m_expressions[0]->m_expressionType != EXPR_ACCESS) {\r\n\t\t\tm_expressions[0]->m_isAssignmentSide = true;\r\n\t\t}\r\n\t\tm_item = m_expressions[0]->m_item;\r\n\t\tbreak;\r\n\tcase EXPR_LNOT: \r\n\tcase EXPR_UNARYPLUS: \r\n\tcase EXPR_UNARYMINUS: \r\n\t\t// Return type DONE (same type)\r\n\t\tm_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\tbreak;\r\n\r\n\tcase EXPR_IS:\r\n\t\t// Return type DONE (Override Type by result of IS)\r\n\t\tthis->m_typeParam->getResolvedType(gCurrentAC);\r\n\t\tthis->m_runtimeType = &t_BOOL;\r\n\t\tbreak;\r\n\tcase EXPR_AS: \r\n\t\t// Return type DONE\r\n\t\tthis->m_typeParam->getResolvedType(gCurrentAC);\r\n\t\tthis->m_runtimeType = this->m_typeParam;\r\n\t\tbreak;\r\n\r\n\tcase EXPR_NEW: \r\n\t\t// The parameter type is actually stored in m_runtimeType\r\n\t\tthis->m_typeParam = this->m_runtimeType;\r\n\t\tthis->m_typeParam->getResolvedType(gCurrentAC);\r\n\r\n\t\tm_expressions[0]->AnalysisAndTransform();\r\n\r\n\t\tif (m_expressionCount == 2) {\r\n\t\t\tm_expressions[1]->AnalysisAndTransform();\r\n\t\t\tbool hasInitializer = (m_expressions[1] != NULL);\r\n\r\n\t\t\tif (hasInitializer) {\r\n\t\t\t\t// Already done. m_expressions[1]->AnalysisAndTransform();\r\n\t\t\t\tm_expressions[1]->m_initializerInfo->m_typeArray = this->m_typeParam;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (this->m_typeParam->isGC_Able()) {\r\n\t\t\t\t// Ok.\r\n\t\t\t} else {\r\n\t\t\t\tcompilerError(ERR_NOT_SUPPORTED, \"Impossible to use new with struct or basic type\", m_line);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\t\t// + Type\r\n\t\r\n\t// Double\r\n\tcase EXPR_CAST: \r\n\t\tif (this->m_expressionCount == 2) {\r\n\t\t\t// Look for a type only\r\n\t\t\tSRSymbol context;\r\n\t\t\tExpression* castTypeExpr = this->m_expressions[0];\r\n\t\t\tif(castTypeExpr->m_expressionCount > 0) {\r\n\t\t\t\tExpression* dotPrefix = castTypeExpr->m_expressions[0];\r\n\t\t\t\tdotPrefix->AnalysisAndTransform();\r\n\t\t\t\tcontext = dotPrefix->m_runtimeType ? dotPrefix->m_runtimeType->m_res : dotPrefix->m_item;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcontext.pSymbol\t\t\t= gCurrentAC;\r\n\t\t\t\tcontext.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\t\t}\r\n\t\t\tu8 searchMask = SEARCH_TYPE | SEARCH_INHERITANCE | SEARCH_HIERARCHY; // Look for a type only.\r\n\r\n\t\t\tcastTypeExpr->m_item = resolveIteration(castTypeExpr->m_text, context, castTypeExpr->m_runtimeType, castTypeExpr->m_item, searchMask);\r\n\t\t\tthis->m_expressions[1]->AnalysisAndTransform();\r\n\t\t\tthis->m_expressions[0]->m_runtimeType->getResolvedType(gCurrentAC);\r\n\t\t\tthis->m_runtimeType = this->m_expressions[0]->m_runtimeType;\r\n\t\t\tthis->m_item = this->m_expressions[1]->m_item;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tm_expressions[0]->AnalysisAndTransform();\r\n\t\t\tm_item = m_expressions[0]->m_item;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_PLUS: \r\n\t\t// Return type DONE\r\n\t\t{\r\n\r\n\t\t\tm_expressions[0]->AnalysisAndTransform();\r\n\t\t\tm_expressions[1]->AnalysisAndTransform();\r\n\r\n\t\t\tbool left_IsString = (m_expressions[0]->m_runtimeType->m_typeID == TYPE_STRING); \r\n\t\t\tbool rightIsString = (m_expressions[1]->m_runtimeType->m_typeID == TYPE_STRING);\r\n\t\t\tbool left_IsAdd\t   = (m_expressions[0]->m_expressionType == EXPR_PLUS);\r\n\t\t\tbool rightIsAdd\t   = (m_expressions[1]->m_expressionType == EXPR_PLUS);\r\n\t\r\n\t\t\tif (left_IsString) {\r\n\t\t\t\tif (!left_IsAdd) {\r\n\t\t\t\t\tthis->wrapStringStart = true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (rightIsString && rightIsAdd) {\r\n\t\t\t\t\t\t// TODO STRING Rebalance tree.\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (m_expressions[1]->m_runtimeType->m_genreID == EGENRE::_ENUM) {\r\n\t\t\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Impossible to use Enum with String concatenation in C++ version.\", m_line);\r\n\t\t\t\t}\r\n\t\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\t\t} else {\r\n\t\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType->getResolvedBlend(m_expressions[1]->m_runtimeType);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_MULT: \r\n\tcase EXPR_DIV: \r\n\tcase EXPR_MOD: \r\n\tcase EXPR_MINUS: \r\n\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType->getResolvedBlend(m_expressions[1]->m_runtimeType);\r\n\t\tbreak;\r\n\r\n\tcase EXPR_LSHFT: \r\n\tcase EXPR_RSHFT: \r\n\t\t// Just copy from left side\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\tbreak;\r\n\r\n\tcase EXPR_LESS: \r\n\tcase EXPR_MORE: \r\n\tcase EXPR_LESSEQ: \r\n\tcase EXPR_MOREEQ: \r\n\tcase EXPR_EQUTST: \r\n\tcase EXPR_DIFFTST: \r\n\t\t// Just copy from left side\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = &t_BOOL;\r\n\t\tbreak;\r\n\r\n\tcase EXPR_LAND: \r\n\tcase EXPR_LXOR: \r\n\tcase EXPR_LOR: \r\n\t\t// Operator\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType->getResolvedBlend(m_expressions[1]->m_runtimeType);\r\n\t\tbreak;\r\n\r\n\tcase EXPR_AND: \r\n\tcase EXPR_OR: \r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = &t_BOOL;\r\n\t\tbreak;\r\n\r\n\t// Double (Assignment)\r\n\tcase EXPR_ASS_EQ:\r\n\t\t{\r\n\t\t\tm_expressions[0]->m_isAssignmentSide = true;\r\n\r\n\t\t\tbool assignDelegate = false;\r\n\r\n\t\t\tm_expressions[0]->AnalysisAndTransform();\r\n\r\n\t\t\t// After resolution.\r\n\t\t\tm_item = m_expressions[0]->m_item;\r\n\t\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\r\n\t\t\tif (m_expressions[0]->m_runtimeType->m_genreID == EGENRE::_DELEGATE) {\r\n\t\t\t\t// FIRST, Pass delegate signature to sub expression on left.\r\n\t\t\t\tm_expressions[1]->m_delegateDef = m_expressions[0]->m_runtimeType->m_definitionDelegate;\r\n\t\t\t\tassignDelegate = true;\r\n\t\t\t}\r\n\r\n\t\t\tprocessDelegateAssignment(m_expressions[1], m_expressions[0]->m_runtimeType, assignDelegate);\r\n\r\n\t\t\tExpression::patchExpressionsForListExpressions(&m_expressions[1],this->m_runtimeType);\r\n\t\t\tm_expressions[1]->AnalysisAndTransform();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_ASS_PLUSEQ: \r\n\tcase EXPR_ASS_MINUSEQ:\r\n\tcase EXPR_ASS_STAREQ: \r\n\tcase EXPR_ASS_DIVEQ: \r\n\tcase EXPR_ASS_MODEQ: \r\n\tcase EXPR_ASS_XOREQ: \r\n\tcase EXPR_ASS_ANDEQ: \r\n\tcase EXPR_ASS_OREQ: \r\n\tcase EXPR_ASS_RSHFTEQ: \r\n\tcase EXPR_ASS_LSHFTEQ: \r\n\t\t// Just copy from left side\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\tif(m_expressions[0]->m_expressionType != EXPR_ACCESS) {\r\n\t\t\tm_expressions[0]->m_isAssignmentSide = true;\r\n\t\t}\r\n\t\tm_item = m_expressions[0]->m_item;\r\n\t\tbreak;\r\n\tcase EXPR_REF:\r\n\t\tthis->m_runtimeType = m_expressions[0]->m_runtimeType;\r\n\t\tm_item = m_expressions[0]->m_item;\r\n\t\tbreak;\r\n\r\n\t// Triple\r\n\tcase EXPR_COND:\r\n\t\t// Return type DONE\r\n\t\tthis->m_runtimeType = m_expressions[1]->m_runtimeType->getResolvedBlend(m_expressions[2]->m_runtimeType);\r\n\t\tbreak;\r\n\tcase EXPR_UNARYMULT:\r\n\tcase EXPR_CAST_PTR:\r\n\tcase EXPR_UNCHECKED: \r\n\tcase EXPR_ADRESSOF:\r\n\tcase EXPR_ARROW: \r\n\tcase EXPR_SIZEOF:\r\n\tcase EXPR_TYPEOF:\r\n\tcase EXPR_CHECKED: \r\n\t\t// Not Supported, error handled at parser level.\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Internal Error, unknown Expression Type\", m_line);\r\n\t}\r\n\r\n\tif (this->m_expressionType != EXPR_PLUS) {\r\n\t\tfor (int n=0; n < this->m_expressionCount; n++) {\r\n\t\t\tExpression* expr = m_expressions[n];\r\n\t\t\tif (expr) {\r\n\t\t\t\tif (expr->m_expressionType == EXPR_PLUS) {\r\n\t\t\t\t\tbool left_IsString = (expr->m_expressions[0]->m_runtimeType->m_typeID == TYPE_STRING);\r\n\t\t\t\t\tif (left_IsString) {\r\n\t\t\t\t\t\texpr->wrapStringEnd = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\t\r\n\r\nvoid Expression::AnalysisMethodForDelegate(TypeGenericEntry* genParams) {\r\n\tif(m_delegateDef) {\r\n\t\t// Analyse the delegate signature\r\n\t\tVariable* pParam = m_delegateDef->m_parameters;\r\n\t\twhile(pParam) {\r\n\t\t\tpParam->m_type->getResolvedType(m_delegateDef->m_pOwner);\r\n\t\t\tpParam = pParam->m_pNextVariable;\r\n\t\t}\r\n\r\n\t\t// Resolve the method parameters\r\n\t\tif(this->m_expressionType == EXPR_LIST) {\r\n\t\t\tfor(int n = 0 ; n < m_expressionCount ; n++) {\r\n\t\t\t\tm_expressions[n]->m_delegateDef = this->m_delegateDef;\r\n\t\t\t\tm_expressions[n]->AnalysisMethodForDelegate(genParams);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tSRSymbol context;\r\n\t\t\tif(this->m_expressionCount > 0) {\r\n\t\t\t\tm_expressions[0]->AnalysisAndTransform();\r\n\t\t\t\tcontext = m_expressions[0]->m_runtimeType->m_res;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcontext.pSymbol\t\t= (AbstractContainer*)gCurrentAC;\r\n\t\t\t\tcontext.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\t\t}\r\n\t\t\tresolveIteration(this->m_text, context, this->m_runtimeType,this->m_item, SEARCH_ALL, NULL, m_delegateDef->m_parameters, genParams);\r\n\t\t\tif(this->m_item.symbolType == EGENRE::_UNDEFGENRE) {\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Method not found\", m_line);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tcompilerError(ERR_INTERNAL, \"No delegate definition\", m_line);\r\n\t}\r\n}\r\n\r\nvoid Expression::AnalysisInvokeMethod(Expression* signature, TypeGenericEntry* genParams) {\r\n\tif(this == NULL) {\r\n\t\treturn;\r\n\t}\r\n\tif(!this->m_text) {\r\n\t\tAnalysisAndTransform();\r\n\t\treturn;\r\n\t}\r\n\tSRSymbol context;\r\n\tif(this->m_expressionCount > 0) {\r\n\t\tm_expressions[0]->AnalysisAndTransform();\r\n\t\tcontext = m_expressions[0]->m_runtimeType->m_res;\r\n\t}\r\n\telse {\r\n\t\tcontext.pSymbol\t\t= (AbstractContainer*)gCurrentAC;\r\n\t\tcontext.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t}\r\n\tresolveIteration(this->m_text, context, this->m_runtimeType,this->m_item, SEARCH_ALL, signature, NULL, genParams);\r\n\tif(this->m_item.symbolType == EGENRE::_UNDEFGENRE) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Method not found\", m_line);\r\n\t}\r\n}\r\n\r\n// \"this\" needs to be the invocation expression.\r\nvoid Expression::transformMethodAsDelegate(Expression*& methodParam, int paramRank) {\r\n\tMethod* callingMethod = (Method*)m_expressions[0]->m_item.pSymbol;\r\n\tVariable* pMatchingParam = callingMethod->m_parameters;\r\n\tfor(int i = 0 ; i < paramRank ; i++) {\r\n\t\tpMatchingParam = pMatchingParam->m_pNextVariable;\r\n\t}\r\n\tprocessDelegateAssignment(methodParam, pMatchingParam->m_type, true);\r\n}\r\n\r\nvoid dumpStringWrapper(Expression* expr) {\r\n\tif(expr->m_expressionType == EXPR_ASS_EQ) {\r\n\t\t// TODO : if str = a + b -> new else if str1 = str2 simple pointer copy => no CS_NEW\r\n\t\texpr->m_expressions[0]->dumpExpressionInternal(); printf(\" = CS_NEW System::String()->appendStr(\"); expr->m_expressions[1]->dumpExpressionInternal(); printf(\")->appendClose()\");\r\n\t\t// TODO : Update reference counting\r\n\t}\r\n\telse if(expr->m_expressionType == EXPR_ASS_PLUSEQ) {\r\n\t\tconst char* wrapperFunction;\r\n\r\n\t\tswitch(expr->m_expressions[1]->m_runtimeType->m_typeID) {\r\n\t\tcase TYPE_STRING :\r\n\t\t\twrapperFunction = \"_appendStr\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_CHAR :\r\n\t\t\twrapperFunction = \"_appendC\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG :\r\n\t\t\twrapperFunction = \"_appendL\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG :\r\n\t\t\twrapperFunction = \"_appendUL\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT :\r\n\t\t\twrapperFunction = \"_appendI\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT :\r\n\t\t\twrapperFunction = \"_appendU\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_SHORT :\r\n\t\t\twrapperFunction = \"_appendS\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_USHORT :\r\n\t\t\twrapperFunction = \"_appendUS\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_SBYTE :\r\n\t\t\twrapperFunction = \"_appendS8\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_BYTE :\r\n\t\t\twrapperFunction = \"_appendU8\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT :\r\n\t\t\twrapperFunction = \"_appendF\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE :\r\n\t\t\twrapperFunction = \"_appendD\";\r\n\t\t\tbreak;\r\n\t\tcase TYPE_BOOL :\r\n\t\t\twrapperFunction = \"_appendB\";\r\n\t\t\tbreak;\r\n\t\tdefault :\r\n\t\t\tcompilerError(ERR_INTERNAL, \"String concatenation with an unknown type\", expr->m_expressions[1]->m_line);\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\texpr->m_expressions[0]->m_isAssignmentSide = false;\r\n\t\texpr->m_expressions[0]->dumpExpressionInternal();\r\n\t\tprintf(\" = \");\r\n\t\texpr->m_expressions[0]->dumpExpressionInternal();\r\n\t\tVariable* pVar = (Variable*)expr->m_expressions[0];\r\n\t\tif(pVar->m_modifier & ATT_STATIC) {\r\n\t\t\tprintf(\"::\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\tprintf(\"->\");\r\n\t\t}\r\n\t\tprintf(wrapperFunction); printf(\"(\"); expr->m_expressions[1]->dumpExpressionInternal(); printf(\")->_appendClose()\");\r\n\t}\r\n\telse {\r\n\t\tcompilerError(ERR_INTERNAL, \"Only = and += operators should be wrapped for strings\", expr->m_line);\r\n\t}\r\n}\r\n\r\nvoid dumpWrapper(Expression* expr, bool safe) {\r\n\tconst char* preStd;\t\t// Pre\r\n\tconst char* postStd;\t// Post\r\n\tconst char* opt;\r\n\tconst char* safeS = safe ? \"$\" : \"\";\r\n\r\n\tif(expr->m_runtimeType->m_typeID == TYPE_STRING && expr->m_expressionType == EXPR_ASS_PLUSEQ) {\r\n\t\t// Specific string wrapping\r\n\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"TODO : String wrapper\", expr->m_line);\r\n\t\tdumpStringWrapper(expr);\r\n\r\n\t\t// Ignore the rest of the function\r\n\t\treturn;\r\n\t}\r\n\r\n\tif(expr->m_expressionType == EXPR_ASS_EQ && expr->m_expressions[0]->m_expressionType == EXPR_ACCESS) {\r\n\t\t// Special wrapping for array[i] = value\r\n\t\texpr->m_expressions[0]->dumpExpressionInternal();\r\n\t\texpr->m_expressions[1]->dumpExpressionInternal();\r\n\t\tprintf(\")\");\r\n\r\n\t\t// Early return\r\n\t\treturn;\r\n\t}\r\n\r\n\tbool testDiv = ((expr->m_runtimeType->m_typeID & (ET_BASETYPE | ET_NUMBER))==ET_BASETYPE);\r\n\r\n\tbool forceWrapper = false;\r\n\tpreStd=\"\";\r\n\tswitch (expr->m_expressionType) {\r\n\tcase EXPR_PLUSPLUS:\t\topt = \"postInc\";\tpreStd=\"\";\t\tpostStd=\"++\";\r\n\t\tbreak;\r\n\tcase EXPR_MINUSMINUS:\topt = \"postDec\";\tpreStd=\"\";\t\tpostStd=\"--\";\r\n\t\tbreak;\r\n\tcase EXPR_PREINCR:\t\topt = \"preInc\";\t\tpreStd=\"++\";\tpostStd=\"\";\r\n\t\tbreak;\r\n\tcase EXPR_PREDECR:\t\topt = \"preDec\";\t\tpreStd=\"--\";\tpostStd=\"\";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_EQ:\t\topt = \"\";\t\t\t\t\t\t\tpostStd=\" = \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_PLUSEQ:\topt = \"AddEq\";\t\t\t\t\t\tpostStd=\" += \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_MINUSEQ:\topt = \"SubEq\";\t\t\t\t\t\tpostStd=\" -= \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_STAREQ:\topt = \"MulEq\";\t\t\t\t\t\tpostStd=\" *= \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_DIVEQ:\topt = \"DivEq\";\t\t\t\t\t\tpostStd=\" /= \";\tforceWrapper = testDiv; // Div 0 except\r\n\t\tbreak;\r\n\tcase EXPR_ASS_MODEQ:\topt = \"ModEq\";\t\t\t\t\t\tpostStd=\" %%= \"; forceWrapper = testDiv; // Div 0 except\r\n\t\tbreak;\r\n\tcase EXPR_ASS_XOREQ:\topt = \"XorEq\";\t\t\t\t\t\tpostStd=\" ^= \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_ANDEQ:\topt = \"AndEq\";\t\t\t\t\t\tpostStd=\" &= \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_OREQ:\t\topt = \"OrEq\";\t\t\t\t\t\tpostStd=\" |= \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_RSHFTEQ:\topt = \"RShiftEq\";\t\t\t\t\tpostStd=\" >>= \";\r\n\t\tbreak;\r\n\tcase EXPR_ASS_LSHFTEQ:\topt = \"LShiftEq\";\t\t\t\t\tpostStd=\" <<= \";\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL,\"Unknown case\", expr->m_line);\r\n\t\tbreak;\r\n\t}\r\n\r\n\t/*\r\n\t\t-> Accessor if safe\t\tmode -> call safe\r\n\t\t\t\t\tif unsafe\tmode -> call unsafe\r\n\r\n\t\t-> Member : if safe \tmode -> call safe\r\n\t\t\t\t\tif unsafe\tmode -> generate C++ directly\r\n\r\n\t\t-> Static member : no safe operator do += directly\r\n\r\n\t\t-> Variable : always generate C++ directly\r\n\t */\r\n\tconst char* prefix = \"\";\r\n\tconst char* name   = \"\";\r\n\tbool isStatic\t= false;\r\n\tbool useWrapper = false;\r\n\tbool useRefWrapper = false;\r\n\tAbstractContainer* structDef = NULL;\r\n\r\n\tswitch (expr->m_item.symbolType) {\r\n\tcase EGENRE::_ACCESSOR:\r\n\t\t{\r\n\t\t\tprefix = \"_acc\";\r\n\t\t\tAccessor* pAcc = (Accessor*)expr->m_item.pSymbol;\r\n\t\t\tif (pAcc->m_modifier & ATT_STATIC) {\r\n\t\t\t\tisStatic = true;\t\t\t\t\r\n\t\t\t}\r\n\t\t\tname = pAcc->getName();\r\n\t\t\tuseWrapper = true;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_MEMBER:\r\n\t\t{\r\n\t\t\tprefix = \"\";\r\n\r\n\t\t\tVariable* pVar = (Variable*)expr->m_item.pSymbol;\r\n\r\n\t\t\tbool isEnum\t\t\t\t\t= (pVar->m_type->m_genreID == EGENRE::_ENUM);\r\n\t\t\tbool isNonNum\t\t\t\t= ((pVar->m_type->m_typeID & (ET_BASETYPE | ET_NUMBER))==ET_BASETYPE);\r\n\t\t\tbool isPtr\t\t\t\t\t= (pVar->m_type->isGC_Able());\r\n\t\t\tEnumExpressionType EType\t= expr->m_expressionType;\r\n\t\t\tbool isEnumSpecialWrapper\t\t= (isEnum && (EType == EXPR_PLUSPLUS || EType == EXPR_MINUSMINUS || EType == EXPR_PREINCR || EType == EXPR_PREDECR || EType == EXPR_ASS_PLUSEQ || EType == EXPR_ASS_MINUSEQ));\r\n\t\t\tbool isNumSpecialWrapper\t\t= ((isNonNum == false && isPtr == false) && (EType == EXPR_ASS_MODEQ));\r\n\t\t\tbool isSpecialWrapper\t\t\t= isEnumSpecialWrapper || isNumSpecialWrapper;\r\n\r\n\t\t\tbool isStruct\t\t\t\t= (pVar->m_ownerClass->m_modifier & ATT_STRUCT) != 0;\r\n\r\n\t\t\tuseRefWrapper = (isPtr || isStruct) && (expr->m_expressionType == EXPR_ASS_EQ);\r\n\t\t\t\r\n\t\t\tif (isStruct) {\r\n\t\t\t\tstructDef = pVar->m_ownerClass;\r\n\t\t\t}\r\n\r\n\t\t\tif (pVar->m_modifier & ATT_STATIC) {\r\n\t\t\t\tisStatic = true;\r\n\t\t\t\tif(isSpecialWrapper) {\r\n\t\t\t\t\t// Wrap operators which only exist in C#\r\n\t\t\t\t\tuseWrapper = true;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tuseWrapper = (safe || isSpecialWrapper);\r\n\t\t\t}\r\n\t\t\tname = pVar->getName();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_VARIABLE:\r\n\t\t// useWrapper = false\r\n\t\t{\r\n\t\t\tVariable* pVar = (Variable*)expr->m_item.pSymbol;\r\n\t\t\tname = pVar->getName();\r\n\r\n\t\t\t// If variable is int/long like -> Need to have a wrapper for divide and modulo for exception.\r\n\t\t\tif (testDiv && ((expr->m_expressionType == EXPR_ASS_DIVEQ) || (expr->m_expressionType == EXPR_ASS_MODEQ))) {\r\n\t\t\t\tif (expr->m_expressionType == EXPR_ASS_DIVEQ) {\r\n\t\t\t\t\tprintf(\"UtilDiv::_divBy(\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (expr->m_expressionType == EXPR_ASS_MODEQ) {\r\n\t\t\t\t\tprintf(\"UtilDiv::_modBy(\");\r\n\t\t\t\t}\r\n\t\t\t\tprintf(name);\r\n\t\t\t\tprintf(\",\");\r\n\t\t\t\texpr->m_expressions[1]->dumpExpressionInternal();\r\n\t\t\t\tprintf(\")\");\r\n\t\t\t\r\n\t\t\t\t// Stop here.\r\n\t\t\t\treturn;\r\n\t\t\t} else if (!testDiv && (expr->m_expressionType == EXPR_ASS_MODEQ)) {\r\n\t\t\t\t// Wrap %= operator for float types\r\n\t\t\t\tprintf(\"UtilDiv::_modBy(\");\r\n\t\t\t\tprintf(name);\r\n\t\t\t\tprintf(\",\");\r\n\t\t\t\texpr->m_expressions[1]->dumpExpressionInternal();\r\n\t\t\t\tprintf(\")\");\r\n\r\n\t\t\t\t// Stop here.\r\n\t\t\t\treturn;\r\n\t\t\t} else if ((pVar->m_type->m_genreID == EGENRE::_ENUM) &&\r\n\t\t\t\t(expr->m_expressionType == EXPR_PLUSPLUS || expr->m_expressionType == EXPR_MINUSMINUS || expr->m_expressionType == EXPR_PREINCR ||\r\n\t\t\t\texpr->m_expressionType == EXPR_PREDECR || expr->m_expressionType == EXPR_ASS_PLUSEQ || expr->m_expressionType == EXPR_ASS_MINUSEQ)) {\r\n\t\t\t\t// Wrap additive operator for enum type\r\n\t\t\t\tconst char* pStrType = pVar->m_type->getFullName(pVar->m_ownerClass);\r\n\t\t\t\tswitch(expr->m_expressionType) {\r\n\t\t\t\tcase EXPR_PLUSPLUS :\r\n\t\t\t\t\tprintf(\"(\");printf(pStrType);printf(\")(((s32&)\");printf(name);printf(\")++)\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EXPR_MINUSMINUS :\r\n\t\t\t\t\tprintf(\"(\");printf(pStrType);printf(\")(((s32&)\");printf(name);printf(\")--)\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EXPR_PREINCR :\r\n\t\t\t\t\tprintf(\"(\");printf(pStrType);printf(\")(++((s32&)\");printf(name);printf(\"))\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EXPR_PREDECR :\r\n\t\t\t\t\tprintf(\"(\");printf(pStrType);printf(\")(--((s32&)\");printf(name);printf(\"))\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EXPR_ASS_PLUSEQ :\r\n\t\t\t\t\tprintf(name);printf(\" = (\");printf(pStrType);printf(\")((s32)\");printf(name);printf(\" + \");expr->m_expressions[1]->dumpExpressionInternal();printf(\")\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EXPR_ASS_MINUSEQ :\r\n\t\t\t\t\tprintf(name);printf(\" = (\");printf(pStrType);printf(\")((s32)\");printf(name);printf(\" - \");expr->m_expressions[1]->dumpExpressionInternal();printf(\")\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Only ++, --, += and -= operators should be wrapped for enum variables\", expr->m_line);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Stop here.\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_METHOD:\r\n\t\t// Generate an L-Value, normal operation.\r\n\t\t// useWrapper = false\r\n\t\tbreak;\r\n\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\tif(expr->m_expressions[0]->m_expressionType == EXPR_ACCESS) {\r\n\t\t\t// identifier[index]++ syntax\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcompilerError(ERR_INTERNAL,\" Assignment operator on unknown type\", expr->m_expressions[0]->m_line);\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL,\" Assignment operator on unknown type\", expr->m_line);\r\n\t}\r\n\r\n\tbool finalUseWrapper = useWrapper || forceWrapper || useRefWrapper;\r\n\r\n\tif (finalUseWrapper) {\r\n\t\texpr->m_expressions[0]->dumpExpressionInternal();\r\n\t\tprintf(prefix);\r\n\t\tprintf(\"_s\");\r\n\t\tprintf(name);\r\n\t\tif (useWrapper && !isStatic) { // use $ only when \r\n\t\t\tprintf(safeS);\r\n\t\t}\r\n\t\tprintf(opt);\r\n\t\tprintf(\"(\");\r\n\t\tif (expr->m_expressionCount == 2) {\r\n\t\t\texpr->m_expressions[1]->dumpExpressionInternal();\r\n\t\t}\r\n\t\tprintf(\")\");\r\n\t} else {\r\n\t\tprintf(preStd);\r\n\t\texpr->m_expressions[0]->dumpExpressionInternal();\r\n\t\tprintf(name);\r\n\t\tprintf(postStd);\r\n\t\tif (expr->m_expressionCount == 2) {\r\n\t\t\texpr->m_expressions[1]->dumpExpressionInternal();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid writeMemberOrAccessor(u32 modifier, bool isAccessor, const char* name, bool hasPrevious, bool isAssign, bool isStruct) {\r\n\tconst char* prefix = isAccessor ? \"_acc\" : \"\";\r\n\tbool isStatic\t\t\t= (modifier & ATT_STATIC);\r\n\tif (hasPrevious) {\r\n\t\tif (isStatic) {\r\n\t\t\tprintf(\"::\");\t\r\n\t\t} else {\r\n\t\t\tif (!isStruct) {\r\n\t\t\t\tprintf(\"->\");\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\".\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif(!isAssign) {\r\n\t\tif (g_unsafe == true || isStatic == true) {\r\n\t\t\tif(isAccessor) {\r\n\t\t\t\tprintf(\"_acc_g%s()\", name);\r\n\t\t\t} else {\r\n\t\t\t\tprintf(name);\t\t// member name\r\n\t\t\t}\r\n\t\t\tif(g_unsafeEphemeral) { g_unsafe = false; g_unsafeEphemeral = false; }\r\n\t\t} else {\r\n\t\t\tprintf(prefix);\r\n\t\t\tprintf(\"_g%s$()\", name);\r\n\t\t}\r\n\t} else {\r\n\t\t// We generate the last dump at the affectation level.\r\n\t}\r\n}\r\n\r\nvoid Expression::dumpTokens(SRSymbol res, const char* id, bool hasPrevious) {\r\n\tSRSymbol item = m_item;\r\n\r\n\t//res = resolveIteration(id, res, this->m_runtimeType, item);\r\n\r\n\tswitch (item.symbolType) {\r\n\tcase EGENRE::_METHOD:\r\n\t\t{\r\n\t\t\tMethod* pM = (Method*)item.pSymbol;\r\n\t\t\t// EXPR_INVOKE\r\n\t\t\tif (this->m_expressionCount == 2) {\r\n\t\t\t\tif (hasPrevious) {\r\n\t\t\t\t\tpM->preFunc();\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tpM->dumpCall(m_expressions[1], false, m_genericCall);\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"The compiler is not supposed to stop here.\", m_line);\r\n\t\t\t} else {\r\n\t\t\t\tif(this->m_isInvoked) {\r\n\t\t\t\t\tif(!hasPrevious && pM->m_pOwner != gCurrentAC) {\r\n\t\t\t\t\t\tprintf(\"%s::\", pM->m_pOwner->getFullName(gCurrentAC));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Method as a delegate\r\n\t\t\t\t\tif(pM->m_pOwner == gCurrentAC) {\r\n\t\t\t\t\t\tprintf(\"&%s\", pM->getName());\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tprintf(\"&%s::%s\", pM->m_pOwner->getFullName(gCurrentAC), pM->getName());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_VARIABLE:\r\n\t\t{\r\n\t\t\tif (!m_isAssignmentSide) {\r\n\t\t\t\t// Local variable\r\n\t\t\t\tprintf(id);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_MEMBER:\r\n\t\t{\r\n\t\t\t//\r\n\t\t\t// ::member\t\t\t(CLASS Static)\r\n\t\t\t// member\t\t\t(CLASS Instance / Class Static) Unsafe\r\n\t\t\t// ->member\t\t\t(CLASS)\t\t\t\t\t\t\tUnsafe\r\n\t\t\t// ->_g$member()\t(CLASS)\t\t\t\t\t\t\tSafe Read\r\n\t\t\t//   _s$member(val)\t(CLASS)\t\t\t\t\t\t\tSafe Write\r\n\t\t\t// .member\t\t\t(STRUCT)\r\n\t\t\t// this->member\t\t(STRUCT with this)\r\n\t\t\t//\r\n\t\t\tVariable* pVar = (Variable*)item.pSymbol;\r\n\t\t\tif(!hasPrevious) {\r\n\t\t\t\t// Dump prefix\r\n\t\t\t\tif(pVar->m_ownerClass != gCurrentAC) {\r\n\t\t\t\t\tprintf(\"%s::\", pVar->m_ownerClass->getFullName(gCurrentAC));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twriteMemberOrAccessor(pVar->m_modifier, false, id, hasPrevious, m_isAssignmentSide,((pVar->m_ownerClass->m_modifier & ATT_STRUCT) != 0));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ACCESSOR:\r\n\t\t{\r\n\t\t\tAccessor* pAcc = (Accessor*)item.pSymbol;\r\n\t\t\tif(!hasPrevious) {\r\n\t\t\t\t// Dump prefix\r\n\t\t\t\tif(pAcc->m_ownerClass != gCurrentAC) {\r\n\t\t\t\t\tprintf(\"%s::\", pAcc->m_ownerClass->getFullName(gCurrentAC));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twriteMemberOrAccessor(pAcc->m_modifier, true, id, hasPrevious, m_isAssignmentSide,((pAcc->m_ownerClass->m_modifier & ATT_STRUCT) != 0));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\tcase EGENRE::_NAMESPACE:\r\n\t\t{\r\n\t\t\tif (hasPrevious) {\r\n\t\t\t\tprintf(\"::\");\r\n\t\t\t}\r\n\t\t\tbool arrayDump = false;\r\n\t\t\tif(item.symbolType == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\t\tAbstractContainer* pSpace = (AbstractContainer*)item.pSymbol;\r\n\t\t\t\tif(pSpace->myType.m_typeID == TYPE_ARRAY) {\r\n\t\t\t\t\tarrayDump = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tNameSpace* pSpace = (NameSpace*)item.pSymbol;\r\n\t\t\tif(arrayDump) {\r\n\t\t\t\tprintf(\"System::AbstractArray\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tprintf(\"%s\", hasPrevious ? pSpace->getName() : pSpace->getFullName(gCurrentAC));\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUM:\r\n\t\t{\r\n\t\t\t// No dependancy.\r\n\t\t\tEnum* pEnum = (Enum*)item.pSymbol;\r\n\t\t\tif (hasPrevious) {\r\n\t\t\t\tprintf(\"::\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Dump prefix\r\n\t\t\t\tif(pEnum->m_parent != gCurrentAC) {\r\n\t\t\t\t\tprintf(\"%s::\", pEnum->m_parent->getFullName(gCurrentAC));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintf(\"%s\", pEnum->m_name);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUMENTRY:\r\n\t\t{\r\n\t\t\t// No dependancy.\r\n\t\t\tEnum::EnumEntry* pEnumEntry = (Enum::EnumEntry*)item.pSymbol;\r\n\t\t\tif (hasPrevious) {\r\n\t\t\t\tprintf(\"::\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Should not happen\r\n\t\t\t\tprintf(\"%s::\", pEnumEntry->m_parent->getFullName(gCurrentAC));\r\n\t\t\t}\r\n\t\t\tprintf(\"%s\", pEnumEntry->m_name);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EGENRE::_DELEGATE:\r\n\t\t{\r\n\t\t\tDelegate* pDelegate = (Delegate*)item.pSymbol;\r\n\t\t\tif (hasPrevious) {\r\n\t\t\t\tprintf(\"::\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Dump prefix\r\n\t\t\t\tif(pDelegate->getOwner() != gCurrentAC) {\r\n\t\t\t\t\tprintf(\"%s::\", pDelegate->getOwner()->getFullName(gCurrentAC));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintf(\"_Delegate_Base_%s\", pDelegate->getName());\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL,\"Unprocessed case\", m_line);\r\n\t}\r\n\r\n\thasPrevious\t= true;\r\n\r\n}\r\n\r\nconst char* Method::getTemplateParams() {\r\n\tchar buff[500];\r\n\tbuff[0] = 0;\r\n\tchar* ptr = buff;\r\n\tint delta;\r\n\r\n\tif(m_genericParam) {\r\n\t\tTypeGenericDefinitionEntry* genericSymbol = m_genericParam;\r\n\t\tsprintf(ptr++, \"<\");\r\n\t\twhile(genericSymbol) {\r\n\t\t\tdelta = sprintf(ptr, \"%s\", genericSymbol->m_genericName);\r\n\t\t\tptr += delta;\r\n\t\t\tif(genericSymbol = genericSymbol->m_pNextGenericEntry) {\r\n\t\t\t\tsprintf(ptr, \", \");\r\n\t\t\t\tptr += 2;\r\n\t\t\t}\r\n\t\t}\r\n\t\tsprintf(ptr, \">\");\r\n\t}\r\n\telse {\r\n\t\t// The method is not a template.\r\n\t}\r\n\treturn concat(buff);\r\n}\r\n\r\nvoid Method::dumpTemplateLabel() {\r\n\tif(m_genericParam) {\r\n\t\tTypeGenericDefinitionEntry* genericSymbol = m_genericParam;\r\n\t\tprintf(\"template <\");\r\n\t\twhile(genericSymbol) {\r\n\t\t\tprintf(\"typename %s\", genericSymbol->m_genericName);\r\n\t\t\tif(genericSymbol = genericSymbol->m_pNextGenericEntry) {\r\n\t\t\t\tprintf(\", \");\r\n\t\t\t}\r\n\t\t}\r\n\t\tprintf(\"> \");\r\n\t}\r\n\telse {\r\n\t\t// The class is not a template.\r\n\t}\r\n}\r\n\r\n\r\nvoid Method::preFunc() {\r\n\tif (this->m_modifier & ATT_STATIC) {\r\n\t\tprintf(\"::\");\r\n\t} else {\r\n\t\tif (this->m_pOwner->m_modifier & ATT_STRUCT) {\r\n\t\t\tprintf(\".\");\r\n\t\t} else {\r\n\t\t\tprintf(\"->\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid Method::dumpMarshalling() {\r\n\ttab(); printf(\"{\\n\");\r\n\tdepth++;\r\n\r\n\t// Convention for ref/out parameters : use pointers on the C++ side\r\n\r\n\t// int, uint, float, double, bool, long, ...\r\n\t// struct\r\n\t// ref\r\n\t// IntPtr\r\n\t// []BaseType ou []IntPtr\r\n\t//\r\n\tbool isVoid = (this->m_returnType->m_typeID == TYPE_VOID);\r\n\r\n\ttab();\r\n\tif (!isVoid) {\r\n\t\tprintf(\"return \");\r\n\t}\r\n\r\n\tprintf(this->getName());\r\n\tprintf(\"(\");\r\n\r\n\tVariable* params = this->m_parameters;\r\n\tbool first = true;\r\n\twhile (params) {\r\n\t\tTypeObject* pType = params->m_type;\r\n\t\tif (!first) {\r\n\t\t\tprintf(\",\");\r\n\t\t} else {\r\n\t\t\tfirst = false;\r\n\t\t}\r\n\r\n\t\tif (pType->m_genreID == EGENRE::_ABSTRACTCONTAINER && pType->m_definitionAC->m_modifier & ATT_STRUCT) {\r\n\t\t\t// Poor struct marshalling (1/2)\r\n\t\t\t// TODO : struct marshalling method\r\n\t\t\tprintf(\"(s32%s)\", (params->m_modifier & ATT_REF) == 0 ? \"\" : \"*\");\r\n\t\t}\r\n\r\n\t\tif((params->m_modifier & ATT_REF) != 0) {\r\n\t\t\tprintf(\"&\");\r\n\t\t}\r\n\r\n\t\tif(pType->m_typeID & ET_BASETYPE) {\r\n\t\t\tprintf(params->getName());\r\n\t\t}\r\n\r\n\t\telse if(pType->m_typeID == TYPE_STRING) {\r\n\r\n\t\t\t// For compatibility reason with Mono / .NET auto marshalling issue with string\r\n\t\t\t// Not supported\r\n\t\t\t// InternalUtils::NativeUTF8FromString\r\n\t\t\t// printf(\"%s ? %s->_getUTF8() : NULL\", params->getName(), params->getName());\r\n\t\t\tcompilerError(ERR_USER, \"Please use IntPtr converted String instead of directly use String.\", m_line);\r\n\t\t}\r\n\r\n\t\telse if (pType->m_genreID == EGENRE::_ENUM) {\r\n\t\t\tprintf(params->getName());\r\n\t\t}\r\n\r\n\t\telse if (pType->isArray() && (pType->m_rankCount == 1) && (pType->m_ranks[0].m_dimensionCount == 1)){\r\n\t\t\t// Array of something.\r\n\t\t\tif (pType->m_originalType) {\r\n\t\t\t\tprintf(\"%s ? (%s*)%s->_getPArray() : NULL\", params->getName(), pType->m_originalType->dumpTypeForCode(gCurrentAC, gCurrentMethod), params->getName());\r\n\t\t\t} else {\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Internal compiler error\", m_line);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\telse if (pType->m_genreID == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\tAbstractContainer* pAC = pType->m_definitionAC;\r\n\t\t\tif (pAC->m_modifier & ATT_STRUCT) {\r\n\t\t\t\tpAC->dumpMarshalledStruct(params);\r\n\t\t\t\t// Poor struct marshalling (2/2)\r\n\t\t\t\tprintf(\" + 1\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcompilerError(ERR_USER, \"Class objects need to be marshalled into IntPtr for extern functions\", m_line);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Should never arrive here.\", m_line);\r\n\t\t}\r\n\r\n\t\tparams = params->m_pNextVariable;\r\n\t}\r\n\r\n\tprintf(\");\\n\");\r\n\r\n\tdepth--;\r\n\ttab(); printf(\"}\\n\");\r\n}\r\n\r\nvoid Method::dumpCall(Expression* expr, bool delegateCall, TypeGenericEntry* genericParams) {\r\n\tif (!delegateCall) {\r\n\t\tif (m_modifier & ATT_EXTERN) {\r\n\t\t\tprintf(\"_ext_\");\r\n\t\t\t// Ref extension added to ref only in case that the wrapper does NOT exist.\r\n\t\t\tif (m_referenceModifCount)\t{ printf(\"_ref_\"); }\r\n\t\t}\r\n\t\tprintf(this->getName());\r\n\r\n\t\tif ((g_unsafe == false) && ((this->m_modifier & ATT_STATIC)==0)) {\r\n\t\t\tprintf(\"$\");\r\n\t\t}\r\n\t\tif(g_unsafeEphemeral) { g_unsafe = false; g_unsafeEphemeral = false; }\r\n\t}\r\n\r\n\tif(genericParams) {\r\n\t\tprintf(\"<\");\r\n\t\tTypeGenericEntry* pGen = genericParams;\r\n\t\tdo {\r\n\t\t\tprintf(\"%s\", pGen->m_genericName);\r\n\t\t\tpGen = pGen->m_pNext;\r\n\t\t\tif(pGen) {\r\n\t\t\t\tprintf(\", \");\r\n\t\t\t}\r\n\t\t} while(pGen);\r\n\t\tprintf(\">\");\r\n\t}\r\n\r\n\t// [->] func[$]  (CLASS)\r\n\t// [.]  func\t (STRUCT)\r\n\t// [::] func\t (CLASS static)\r\n\tprintf(\"(\");\r\n\tVariable* pVar = this->m_parameters;\r\n\tif(expr) {\r\n\t\tif (expr->m_expressionType == EXPR_LIST) {\r\n\t\t\tfor (int n=0; n < expr->m_expressionCount; n++) {\r\n\t\t\t\tif (n != 0) { printf(\",\"); }\r\n\t\t\t\tif(expr->m_expressions[n]->m_runtimeType->m_typeID == TYPE_NULL) {\r\n\t\t\t\t\t// Wrap NULL as it is always ambiguous between two class types in C++, but not necessarily in C#\r\n\t\t\t\t\tprintf(\"(%s)\", pVar->m_type->dumpTypeForCode(gCurrentAC));\r\n\t\t\t\t}\r\n\t\t\t\texpr->m_expressions[n]->dumpExpressionInternal();\r\n\t\t\t\tpVar = pVar->m_pNextVariable;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal Error\", expr->m_line);\r\n\t\t}\r\n\t}\r\n\t// Default parameters dump : for loop has LESS parameter than function interface.\r\n\tbool isFirstTime = true;\r\n\twhile (pVar) {\r\n\t\tif (pVar->m_expression) {\r\n\t\t\tif ((!expr && !isFirstTime) || (expr && expr->m_expressionCount != 0)) {\r\n\t\t\t\tprintf(\",\");\r\n\t\t\t}\r\n\t\t\tisFirstTime = false;\r\n\t\t\tpVar->m_expression->dumpExpressionInternal();\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal Error\", expr->m_line);\r\n\t\t}\r\n\t\tpVar = pVar->m_pNextVariable;\r\n\t}\r\n\tprintf(\")\");\r\n}\r\n\r\nconst char*\tDelegate::generateTypeID() {\r\n\tchar buffer[1000];\r\n\tsprintf(buffer, \"ET_CLASS | %i\", this->m_uniqueId);\r\n\treturn concat(buffer);\r\n}\r\n\r\nvoid Delegate::dumpDefinition(const char* prefix) {\r\n\tchar buffer[1000];\r\n\tchar buffer2[1000];\r\n\tchar buffer3[1000];\r\n\r\n\tbuffer[0] = 0;\r\n\tbuffer2[0] = 0;\r\n\tbuffer3[0] = 0;\r\n\r\n\tconst char* name\t\t\t= getName();\r\n\tconst char* retType\t\t\t= this->m_returnType->dumpTypeForCode(getOwner());\r\n\tconst char* signature\t\t= buffer;  this->dumpParamsDef(buffer, false, true);\r\n\tconst char* call\t\t\t= buffer2; this->dumpParamsDef(buffer2, true, false);\r\n\tconst char* signatureSimple\t= buffer3; this->dumpParamsDef(buffer3, false, false);\r\n\r\n\tbool  isVoid = this->m_returnType->m_typeID == TYPE_VOID;\r\n\r\n\tif(strcmp(prefix, \"\") != 0) {\r\n\t\tprefix = concat2(prefix, \"::\");\r\n\t}\r\n\r\n\ttab(); printf(\"class %s_Delegate_Base_%s : public System::Delegate\\n\", prefix, name);\r\n\ttab(); printf(\"{\\n\");\r\n\t\r\n\tprintf(\"private:\\n\");\r\n\ttab(); printf(\"static const u32 _TYPEID = _TYPE_USEROBJECT | %s;\\n\", generateTypeID());\r\n\r\n\ttab(); printf(\"public:\\n\");\r\n\r\n\ttab(); printf(\"    virtual bool _isInstanceOf(u32 typeID) {\\n\");\r\n\ttab(); printf(\"\\t    _INSTANCEOF(_Delegate_Base_%s,%s);\\n\",name, \"System::Delegate\");\r\n\ttab(); printf(\"    }\\n\\n\");\r\n\r\n\tif (isVoid) {\r\n\t\ttab(); printf(\"    inline void call$(%s) { CHCKTHIS; (*this)(%s); }\\n\",signature,call);\r\n\t} else {\r\n\t\ttab(); printf(\"    inline %s call$(%s) { CHCKTHIS; return (*this)(%s); }\\n\",retType,signature,call);\r\n\t}\r\n\ttab(); printf(\"    virtual %s operator() (%s)=0;\\n\", retType, signature);\r\n\ttab(); printf(\"    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\\n\");\r\n\ttab(); printf(\"    virtual void _releaseGC() { }\\n\");\r\n\ttab(); printf(\"};\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\r\n\ttab(); printf(\"template <class TClass> class %s_DelegateI_%s : public %s_Delegate_Base_%s\\n\",prefix,name,prefix,name);\r\n\ttab(); printf(\"{\\n\");\r\n\ttab(); printf(\"private:\\n\");\r\n\ttab(); printf(\"    %s (TClass::*fpt)(%s);\\n\",retType, signatureSimple);\r\n\ttab(); printf(\"    TClass* pt2Object;\\n\");\r\n\ttab(); printf(\"public:\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\ttab(); printf(\"    _DelegateI_%s(TClass* _pt2Object, %s(TClass::*_fpt)(%s)) {\\n\",name,retType,signatureSimple);\r\n\ttab(); printf(\"        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\\n\");\r\n\ttab(); printf(\"        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\\n\");\r\n\ttab(); printf(\"        fpt=_fpt;\\n\");\r\n\ttab(); printf(\"    }\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\ttab(); printf(\"    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\\n\");\r\n\ttab(); printf(\"    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\\n\");\r\n\ttab(); printf(\"    virtual void _moveAlert(u32 offset) { \\n\");\r\n\ttab(); printf(\"        _Delegate_Base_%s::_moveAlert(offset);\\n\", name);\r\n\ttab(); printf(\"        u8* oldPtr; u8* newPtr;\\n\");\r\n\ttab(); printf(\"        if(pt2Object) {\\n\");\r\n\ttab(); printf(\"            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\\n\");\r\n\ttab(); printf(\"            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\\n\");\r\n\ttab(); printf(\"        }\\n\");\r\n\ttab(); printf(\"    }\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\tif (!isVoid) {\r\n\t\ttab(); printf(\"    virtual %s operator()(%s) { return (*pt2Object.*fpt)(%s);}\\n\", retType,signature,call);\r\n\t} else {\r\n\t\ttab(); printf(\"    virtual void operator()(%s) { (*pt2Object.*fpt)(%s);}\\n\", signature, call);\r\n\t}\r\n\ttab(); printf(\"};\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\ttab(); printf(\"class %s_DelegateS_%s : public %s_Delegate_Base_%s\", prefix, name, prefix, name);\r\n\ttab(); printf(\"{\\n\");\r\n\ttab(); printf(\"private:\\n\");\r\n\ttab(); printf(\"    %s (*fpt)(%s);\\n\",retType,signatureSimple);\r\n\ttab(); printf(\"public:\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\ttab(); printf(\"    _DelegateS_%s(%s(*_fpt)(%s))\",name,retType,signatureSimple);\r\n\ttab(); printf(\"    { fpt=_fpt; };\\n\");\r\n\ttab(); printf(\"\\n\");\r\n\tif (!isVoid) {\r\n\t\ttab(); printf(\"    virtual %s operator()(%s) { return (*fpt)(%s); };\\n\",retType,signature,call);\r\n\t} else {\r\n\t\ttab(); printf(\"    virtual void operator()(%s) { (*fpt)(%s); };\\n\",signature,call);\r\n\t}\r\n\ttab(); printf(\"};\\n\");\r\n\ttab(); printf(\"\\n\");\r\n}\r\n\r\nvoid dumpCopyVarDelegate(Variable* pVars) {\r\n\tbool first = true;\r\n\twhile (pVars) {\r\n\t\tif (!first) { printf(\",\"); } else { first = false; }\r\n\t\tif (strcmp(\"_this__\", pVars->m_name) == 0) {\r\n\t\t\tprintf(\"this\");\r\n\t\t} else {\r\n\t\t\tprintf(pVars->m_name);\r\n\t\t}\r\n\t\tpVars = pVars->m_pNextVariable;\r\n\t}\r\n}\r\n\r\nvoid Expression::dumpExpressionInternal() {\r\n\tif(this->m_item.symbolType == _UNDEFGENRE) {\r\n\t\tprintf(\"[Symbol not found]\");\r\n\t\treturn;\r\n\t}\r\n\tif(this->m_hasParenthesis) { printf(\"(\"); }\r\n\tswitch (this->m_expressionType) {\r\n\t// Multiple\r\n\tcase EXPR_LIST:\r\n\t\tfor (int n=0; n < this->m_expressionCount; n++) {\r\n\t\t\tif (n != 0) { printf(\",\"); }\r\n\t\t\tm_expressions[n]->dumpExpressionInternal();\r\n\t\t}\r\n\r\n\t\t// Nothing to solve when going up the expression stack.\r\n\t\t// NO return type to do here. Function will take care.\r\n\t\tbreak;\r\n\r\n\tcase EXPR_DELEGATECREATE:\r\n\t\t{\r\n\t\t\t// DelegateFct p2 = delegate(int a) { return B.myStr.Length; };\r\n\t\t\tconst char * anonName\t\t= this->m_anonymousClass->getName();\r\n\t\t\tconst char * delegateName\t= this->m_delegateDef->getName();\r\n\r\n\t\t\tconst char* anonPrefix\t\t= gStaticContextAC\r\n\t\t\t\t\t\t\t\t\t\t\t? concat2(gStaticContextAC->getFullName(gRootNameSpace), \"::\")\r\n\t\t\t\t\t\t\t\t\t\t\t: \"\";\r\n\t\t\tconst char* delegatePrefix\t= this->m_delegateDef->getOwner() == gCurrentAC\r\n\t\t\t\t\t\t\t\t\t\t\t? \"\" \r\n\t\t\t\t\t\t\t\t\t\t\t: concat2(this->m_delegateDef->getOwner()->getFullName(gCurrentAC), \"::\");\r\n\t\t\t\r\n\t\t\tconst char* prefixedAnonName = concat2(anonPrefix, anonName);\r\n\t\t\tVariable* signature\t\t\t= this->m_delegateSignature;\r\n\r\n\t\t\t/*char prefix[1000];\r\n\t\t\tint strl = strlen(this->m_precNameSpace);\r\n\t\t\tif (strl) {\r\n\t\t\t\tsprintf(prefix,\"%s::%s\",precNameSpace,this->getName());\r\n\t\t\t} else {\r\n\t\t\t\tsprintf(prefix,\"%s\",this->getName());\r\n\t\t\t}*/\r\n\r\n\t\t\tMethod* pM\t\t\t\t= m_anonymousClass->findMethod(anonName, (Variable*)NULL, NULL);\t// There will always be only one constructor, this is why no signature is required.\r\n\t\t\tVariable* pListStart\t= pM->m_parameters;\r\n\r\n\t\t\tif (gIsStaticFunc) {\r\n\t\t\t\tprintf(\"CS_NEW %s_DelegateS_%s(CS_NEW %s(\",\r\n\t\t\t\t\tdelegatePrefix,\r\n\t\t\t\t\tdelegateName,\r\n\t\t\t\t\tprefixedAnonName\r\n\t\t\t\t);\r\n\r\n\t\t\t\tdumpCopyVarDelegate(pListStart);\r\n\r\n\t\t\t\tprintf(\"), &%s_anon_%::_delegate);\",\r\n\t\t\t\t\tanonPrefix,\r\n\t\t\t\t\tanonName\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"CS_NEW %s_DelegateI_%s<%s>(CS_NEW %s(\",\r\n\t\t\t\t\tdelegatePrefix,\r\n\t\t\t\t\t/*DelegateType*/delegateName,\r\n\t\t\t\t\t/*Template*/prefixedAnonName,\r\n\t\t\t\t\t/*new*/prefixedAnonName\r\n\t\t\t\t);\r\n\r\n\t\t\t\tdumpCopyVarDelegate(pListStart);\r\n\r\n\t\t\t\tprintf(\"), &%s::_delegate)\" ,\r\n\t\t\t\t\t/*fct*/prefixedAnonName);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t// Leaf\r\n\tcase EXPR_UNDER_THIS:\r\n\t\tprintf(\"_this__\");\r\n\t\tbreak;\r\n\tcase EXPR_THIS:\r\n\t\tprintf(\"this\");\r\n\t\tbreak;\r\n\tcase EXPR_BASE: \r\n\t\t// TODO : check if base can be used on a type different from \"this\" ?\r\n\t\t// base.funct\r\n\t\t// Constructor Class A(b):base(b)\r\n\t\t\t\r\n\t\t/* In C++, base will be replaced by the prefix of the following dot expression,\r\n\t\t\tso nothing needs to be done at this point */\r\n\t\tbreak;\r\n\tcase EXPR_IDENT:\r\n\tcase EXPR_DOT: \r\n\t\t{\r\n\t\t\tNameSpace* pContext = gCurrentAC;\r\n\t\t\tSRSymbol res;\r\n\r\n\t\t\tbool hasPrevious;\r\n\t\t\tif (m_expressionType == EXPR_IDENT) {\r\n\t\t\t\tres.pSymbol\t\t= pContext;\r\n\t\t\t\tres.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\t\t\thasPrevious = false;\r\n\t\t\t} else {\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\tif(m_expressions[0]->m_runtimeType) {\r\n\t\t\t\t\tres = m_expressions[0]->m_runtimeType->m_res;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Namespaces don't have a runtime type\r\n\t\t\t\t\tres = m_expressions[0]->m_item;\r\n\t\t\t\t}\r\n\t\t\t\tif(m_expressions[0]->m_expressionType == EXPR_BASE) {\r\n\t\t\t\t\thasPrevious = false;\r\n\t\t\t\t\tg_unsafe\t\t\t= true;\r\n\t\t\t\t\tg_unsafeEphemeral\t= true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\thasPrevious = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (!m_bSkip) {\r\n\t\t\t\tdumpTokens(res, this->m_text, hasPrevious);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_INVOKE:\r\n\t\t{\r\n\t\t\t//\r\n\t\t\t// Descending and solving sub systems.\r\n\t\t\t//\r\n\t\t\tMethod* pM = (Method*)m_item.pSymbol;\r\n\t\t\tNameSpace* pContext = gCurrentAC;\r\n\t\t\tif (pM->getGenre() == EGENRE::_DELEGATE) { \r\n\t\t\t\tprintf(\"\");\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\tprintf(\"->call$\");\r\n\t\t\t\tpM->dumpCall(m_expressions[1],true, m_genericCall);\r\n\t\t\t} else {\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\tif(m_expressions[0]->m_expressionType != EXPR_IDENT\r\n\t\t\t\t\t&& !(m_expressions[0]->m_expressionType == EXPR_DOT\r\n\t\t\t\t\t\t&& m_expressions[0]->m_expressions[0]->m_expressionType == EXPR_BASE)) {\r\n\t\t\t\t\tpM->preFunc();\r\n\t\t\t\t}\r\n\t\t\t\tpM->dumpCall(m_expressions[1],false, m_genericCall);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\t// Double\r\n\tcase EXPR_ACCESS: \r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\r\n\t\tif (!m_isAssignmentSide) {\r\n\t\t\tprintf(\"->_idx_g$\");\r\n\t\t} else {\r\n\t\t\tprintf(\"->_idx_s$\");\r\n\t\t}\r\n\r\n\t\tprintf(\"(\");\r\n\t\tif (m_expressions[1]) {\r\n\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t}\r\n\t\tif(!m_isAssignmentSide) {\r\n\t\t\tprintf(\")\");\r\n\t\t} else {\r\n\t\t\tprintf(\",\");\r\n\t\t\t// The rest is dumped by EXPR_ASS_EQ\r\n\t\t}\r\n\r\n\t\tbreak;\r\n\r\n\tcase EXPR_CTE: \r\n\t\tswitch (this->m_value.type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tif (this->m_value.v.i) {\r\n\t\t\t\tprintf(\"true\");\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"false\");\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase TYPE_STRING:\r\n\t\t\t// Generated String* from constant.\r\n\t\t\tprintf(\"_$_cteStr%iObj\",this->m_value.pString->m_id);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_NULL: \r\n\t\t\tprintf(\"NULL\");\r\n\t\t\tthis->m_runtimeType = &t_NULL;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tprintf(\"%f\",this->m_value.v.d);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tprintf(\"%ff\",this->m_value.v.f);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tprintf(\"%i\",this->m_value.v.i);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tprintf(\"%uu\",this->m_value.v.i);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tprintf(\"%il\",this->m_value.v.l);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tprintf(\"%uul\",this->m_value.v.i);\r\n\t\t\tbreak;\r\n\t\tcase TYPE_CHAR:\r\n\t\t\tif (this->m_value.v.i>=32 && this->m_value.v.i<127) {\r\n\t\t\t\tprintf(\"'%c'\",this->m_value.v.i);\r\n\t\t\t} else { \r\n\t\t\t\tprintf(\"0x%4X\",this->m_value.v.i);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"internal error dump expression CTE\", m_line);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_PLUSPLUS: \r\n\tcase EXPR_MINUSMINUS: \r\n\tcase EXPR_PREINCR:\r\n\tcase EXPR_PREDECR: \r\n\tcase EXPR_ASS_EQ:\r\n\tcase EXPR_ASS_PLUSEQ: \r\n\tcase EXPR_ASS_MINUSEQ:\r\n\tcase EXPR_ASS_STAREQ: \r\n\tcase EXPR_ASS_DIVEQ: \r\n\tcase EXPR_ASS_MODEQ: \r\n\tcase EXPR_ASS_XOREQ: \r\n\tcase EXPR_ASS_ANDEQ: \r\n\tcase EXPR_ASS_OREQ: \r\n\tcase EXPR_ASS_RSHFTEQ: \r\n\tcase EXPR_ASS_LSHFTEQ: \r\n\t\tdumpWrapper(this);\r\n\t\tbreak;\r\n\r\n\tcase EXPR_NOT: \r\n\t\tprintf(\"!\");\r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\tbreak;\t\t// !\r\n\r\n\tcase EXPR_LNOT: \r\n\t\tprintf(\"~\");\r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\tbreak;\t\t// ~\r\n\r\n\tcase EXPR_UNARYPLUS: \r\n\t\tprintf(\"+\");\r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\tbreak;\r\n\r\n\tcase EXPR_UNARYMINUS: \r\n\t\tprintf(\"-\");\r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\tbreak;\r\n\tcase EXPR_IS:\r\n\t\tif (this->m_typeParam->isGC_Able()) {\r\n\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\tprintf(\"->_isInstanceOf$(%i)\",this->m_typeParam->m_typeID);\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"IS operator works only with pointer for now.\", m_line);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_AS:\r\n\t\t// TODO Warning for As using non object or struct. (Check how much C# allow)\r\n\t\tprintf(\"(%s)_as_(\", this->m_runtimeType->dumpTypeForCode(gCurrentAC));\r\n\t\tif (this->m_runtimeType->isGC_Able()) {\r\n\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\tprintf(\",%i)\",this->m_runtimeType->m_typeID);\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"AS operator works only with pointer for now.\", m_line);\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_NEW: \r\n\t\tif (this->m_runtimeType->m_genreID == EGENRE::_DELEGATE) {\r\n\t\t\tprintf(\"CS_NEW \");\r\n\t\t\tif (m_expressionCount != 2) {\r\n\t\t\t\tDelegate* pDelegate = this->m_runtimeType->m_definitionDelegate;\r\n\t\t\t\tconst char* nameDelegate = pDelegate->getName();\r\n\t\t\t\tconst char* prefix = pDelegate->getOwner() == gCurrentAC ? \"\" : concat2(pDelegate->getOwner()->getFullName(gCurrentAC), \"::\");\r\n\t\t\t\tif ((m_expressions[0]->m_expressionType == EXPR_LIST) && (m_expressions[0]->m_expressionCount == 1)) {\r\n\t\t\t\t\tExpression* methodExpr = m_expressions[0]->m_expressions[0];\r\n\t\t\t\t\tif (methodExpr->m_item.symbolType == EGENRE::_METHOD) {\r\n\t\t\t\t\t\tMethod* method = (Method*)methodExpr->m_item.pSymbol;\r\n\t\t\t\t\t\tconst char* methodName = method->getName();\r\n\t\t\t\t\t\tbool isStatic = (method->m_modifier & ATT_STATIC) != 0;\r\n\t\t\t\t\t\tconst char* className  = concat2(method->m_pOwner->getName(), m_runtimeType->getGenParams());\r\n\r\n\t\t\t\t\t\tif (isStatic) {\r\n\t\t\t\t\t\t\t// new _DelegateS_xxxx(&Class::Method);\r\n\t\t\t\t\t\t\tprintf(\"%s_DelegateS_%s(&%s::%s)\",prefix, nameDelegate,className,methodName);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (methodExpr->m_expressionType == EXPR_DOT || methodExpr->m_expressionType == EXPR_IDENT) { \r\n\t\t\t\t\t\t\t\t// new _DelegateI_xxxx<class>(ptr, &Class::Method);\r\n\t\t\t\t\t\t\t\tprintf(\"%s_DelegateI_%s<%s>(\",prefix, nameDelegate,className);\r\n\t\t\t\t\t\t\t\tif (methodExpr->m_expressionType == EXPR_IDENT) {\r\n\t\t\t\t\t\t\t\t\tprintf(\"this\");\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t// Do not print the method name !\r\n\t\t\t\t\t\t\t\t\tmethodExpr->m_bSkip = true;\r\n\t\t\t\t\t\t\t\t\tmethodExpr->dumpExpressionInternal();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tprintf(\",&%s::%s)\",className,methodName);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Compiler internal error.\", m_line);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Compiler internal error.\", m_line);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Compiler internal error.\", m_line);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Delegate was not wrapped properly\", m_line);;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_expressionCount == 2) {\r\n\t\t\t\t//\r\n\t\t\t\t// TODO : Support init depending on local variable and other\r\n\t\t\t\t// see dumpGlobalInitializerImplementation comment.\r\n\t\t\t\t//\r\n\t\t\t\tbool hasCountSize   = m_expressions[0] != NULL;\r\n\t\t\t\tbool hasInitializer = m_expressions[1] != NULL;\r\n\t\t\t\tbool hasChainInit\t= false;\r\n\t\t\t\tSInitialization*\tinitor = NULL;\r\n\t\t\t\tbool isArray\t\t= true;\r\n\r\n\t\t\t\tif (hasInitializer) {\r\n\r\n\t\t\t\t\t// Is it array ?\r\n\t\t\t\t\tisArray = this->m_typeParam->isArray();\r\n\t\t\t\t\tinitor = m_expressions[1]->m_initializerInfo;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Patch initialization mode, can NOT do memcpy for non array.\r\n\t\t\t\t\tif (!isArray) {\r\n\t\t\t\t\t\tinitor->m_mode = SInitialization::INIT_CHAINADD;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (initor->m_mode == SInitialization::INIT_WRAP_FUNC || initor->m_mode == SInitialization::INIT_MEMCPY) {\r\n\t\t\t\t\t\tprintf(\"(%s)_global_array_initializer_%i(\",this->m_typeParam->dumpTypeForCode(gCurrentAC),initor->m_expressionCounter);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(initor->m_mode == SInitialization::INIT_CHAIN || initor->m_mode == SInitialization::INIT_CHAINADD) {\r\n\t\t\t\t\t\thasChainInit = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(hasChainInit) {\r\n\t\t\t\t\tprintf(\"(\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isArray) {\r\n\t\t\t\t\tprintf(\"CS_NEW System::Array< \");\r\n\t\t\t\t\tprintf(this->m_typeParam->m_originalType->dumpTypeForCode(gCurrentAC));\r\n\t\t\t\t\tprintf(\" >\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprintf(\"CS_NEW \");\r\n\t\t\t\t\tprintf(this->m_typeParam->dumpTypeForCode(gCurrentAC));\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (hasInitializer) {\r\n\t\t\t\t\tprintf(\"(%i)\",m_expressions[1]->m_expressionCount);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(isArray) {\r\n\t\t\t\t\t\tprintf(\"(\");\r\n\t\t\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\t\t\tprintf(\")\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// Find the associated constructor\r\n\t\t\t\t\t\tMethod* pM = this->m_runtimeType->m_definitionAC->findMethod(this->m_runtimeType->m_name, m_expressions[0], NULL);\r\n\t\t\t\t\t\tpM->dumpCall(m_expressions[0],true, m_genericCall);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (hasInitializer) {\r\n\t\t\t\t\tif (initor->m_mode == SInitialization::INIT_WRAP_FUNC || initor->m_mode == SInitialization::INIT_MEMCPY) {\r\n\t\t\t\t\t\tprintf(\")\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (hasChainInit) {\r\n\t\t\t\t\t\tprintf(\")\");\r\n\t\t\t\t\t\tExpression* pExprList = initor->m_expression;\r\n\t\t\t\t\t\tfor (int n=0; n < pExprList->m_expressionCount; n++) {\r\n\t\t\t\t\t\t\tif (initor->m_mode == SInitialization::INIT_CHAIN) {\r\n\t\t\t\t\t\t\t\tprintf(\"->_s(%i,\",n);\r\n\t\t\t\t\t\t\t} else { // always INIT_CHAINADD here\r\n\t\t\t\t\t\t\t\tprintf(\"->AddRT(\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tpExprList->m_expressions[n]->dumpExpressionInternal();\r\n\t\t\t\t\t\t\tprintf(\")\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t\telse {\r\n\t\t\t\t/* NEW type ( argument_list_opt ) */\r\n\t\t\t\tprintf(\"CS_NEW \");\r\n\t\t\t\tprintf(this->m_runtimeType->getFullName(gCurrentAC));\r\n\t\t\t\tprintf(this->m_runtimeType->getGenParams());\r\n\t\t\t\tif (m_expressions[0] && this->m_typeParam->isArray()) {\r\n\t\t\t\t\tprintf(\"(\");\r\n\t\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\t\tprintf(\")\");\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Dump parameters which fit the constructor (default parameters included)\r\n\t\t\t\t\tMethod* pM = this->m_runtimeType->m_definitionAC->findMethod(this->m_runtimeType->m_name, m_expressions[0], NULL);\r\n\t\t\t\t\tif(pM) {\r\n\t\t\t\t\t\tpM->dumpCall(m_expressions[0],true, m_genericCall);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tprintf(\"()\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\t\t// + Type\r\n\t\r\n\t// Double\r\n\tcase EXPR_CAST: \r\n\t\tif (this->m_expressionCount == 1) {\r\n\t\t\tif (this->m_text) {\r\n\t\t\t\t//\t$$.expr = CreateSingleExpr(EXPR_CAST, $6.expr)->setQuals($4.quals)->setIdentifier($2.text)->setRank($3.tmpValue);\r\n\t\t\t\t// TODO Cast\r\n\t\t\t} else {\r\n\t\t\t\t// $$.expr = CreateSingleExpr(EXPR_CAST, $5.expr)->setQuals($3.quals)->setType($2.type);\r\n\t\t\t\t// $$.expr = CreateSingleExpr(EXPR_CAST, $5.expr)->setQuals($3.quals)->setType($2.type);\r\n\t\t\t\t// $$.expr = CreateSingleExpr(EXPR_CAST, $5.expr)->setType(TypeObject::getTypeObject(TYPE_VOID)); */\r\n\t\t\t\tprintf(\"(\");\r\n\t\t\t\tprintf(this->m_runtimeType->dumpTypeForCode(gCurrentAC));\r\n\t\t\t\t// TODO Quals for cast.\r\n\t\t\t\tprintf(\")\");\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// $$.expr = CreateDoubleExpr(EXPR_CAST, $2.expr, $4.expr);\r\n\t\t\tprintf(\"(\");\r\n\t\t\tif(m_expressions[0]->m_runtimeType->m_typeID == TYPE_INTPTR) {\r\n\t\t\t\tprintf(\"s32*\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\tif(this->m_runtimeType->isGC_Able()) {\r\n\t\t\t\t\tprintf(\"*\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintf(\")\");\r\n\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_PLUS: \r\n\t\tif (wrapStringStart) {\r\n\t\t\tprintf(\"(CS_NEW System::String())->_appendStr(\");\r\n\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\tprintf(\")\");\r\n\t\t} else {\r\n\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Wrap expressions base on left / right type\r\n\t\t//\r\n\t\tif (m_expressions[0]->m_runtimeType->m_typeID == TYPE_STRING) {\r\n\t\t\tconst char* suffix = \"\";\r\n\t\t\tbool skipNull = false;\r\n\t\t\tswitch (m_expressions[1]->m_runtimeType->m_typeID) {\r\n\t\t\tcase TYPE_SBYTE:\tprintf(\"->_appendS8(\"); break;\r\n\t\t\tcase TYPE_BYTE:\t\tprintf(\"->_appendU8(\"); break;\r\n\t\t\tcase TYPE_SHORT:\tprintf(\"->_appendS(\"); break;\r\n\t\t\tcase TYPE_USHORT:\tprintf(\"->_appendUS(\"); break;\r\n\t\t\tcase TYPE_INT:\t\tprintf(\"->_appendI(\"); break;\r\n\t\t\tcase TYPE_UINT:\t\tprintf(\"->_appendU(\"); break;\r\n\t\t\tcase TYPE_LONG:\t\tprintf(\"->_appendL(\"); break;\r\n\t\t\tcase TYPE_ULONG:\tprintf(\"->_appendUL(\"); break;\r\n\t\t\tcase TYPE_CHAR:\t\tprintf(\"->_appendC(\"); break;\r\n\t\t\tcase TYPE_FLOAT:\tprintf(\"->_appendF(\"); break;\r\n\t\t\tcase TYPE_DOUBLE:\tprintf(\"->_appendD(\"); break;\r\n\t\t\tcase TYPE_BOOL:\t\tprintf(\"->_appendB(\"); break;\r\n\t\t\tcase TYPE_OBJECT:\tprintf(\"->_appendStr(\"); suffix = \"->ToString()\"; break;\r\n\t\t\tcase TYPE_STRING:\tprintf(\"->_appendStr(\"); break;\r\n\t\t\tcase TYPE_INTPTR:\tprintf(\"->_appendUL((u64)\"); break;\r\n\t\t\tcase TYPE_NULL:\t\tskipNull = true; break;\r\n\t\t\tdefault:\r\n\t\t\t\tprintf(\"->_appendStr(\"); suffix = \"->ToString()\"; break;\r\n\t\t\t}\r\n\r\n\t\t\tif (!skipNull) {\r\n\t\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t\t\tprintf(suffix);\r\n\t\t\t\tprintf(\")\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tprintf(\" + \");\r\n\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t}\r\n\r\n\t\tif (wrapStringEnd) {\r\n\t\t\tprintf(\"->_appendClose()\");\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase EXPR_DIV: \r\n\tcase EXPR_MOD: \r\n\t\t{\r\n\t\t\tbool wrapOp = ((ET_BASETYPE | ET_NUMBER) & m_expressions[0]->m_runtimeType->m_typeID & m_expressions[1]->m_runtimeType->m_typeID) == ET_BASETYPE;\r\n\t\t\tbool wrapFloatMod = (((m_expressions[0]->m_runtimeType->m_typeID & (ET_BASETYPE | ET_NUMBER))==(ET_BASETYPE | ET_NUMBER)) && this->m_expressionType == EXPR_MOD);\r\n\r\n\t\t\t// Both basic non floating point type or float modulo.\r\n\t\t\tif (wrapOp || wrapFloatMod) {\r\n\t\t\t\tif (this->m_expressionType == EXPR_DIV) {\r\n\t\t\t\t\tprintf(\"UtilDiv::_divByWrp(\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprintf(\"UtilDiv::_modByWrp(\");\r\n\t\t\t\t}\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\tprintf(\",\");\r\n\t\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t\t\tprintf(\")\");\r\n\t\t\t} else {\r\n\t\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\t\tprintf(getOpDump());\r\n\t\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase EXPR_EQUTST:\r\n\t\tif(m_expressions[0]->m_runtimeType->isGC_Able() && (m_expressions[1]->m_runtimeType->m_typeID != TYPE_NULL)) {\r\n\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\t\tprintf(\"->Equals(\");\r\n\t\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\t\tprintf(\")\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// Do not break\r\n\t\t}\r\n\tcase EXPR_MINUS: \r\n\tcase EXPR_MULT: \r\n\tcase EXPR_LSHFT: \r\n\tcase EXPR_RSHFT: \r\n\tcase EXPR_LESS: \r\n\tcase EXPR_MORE: \r\n\tcase EXPR_LESSEQ: \r\n\tcase EXPR_MOREEQ:  \r\n\tcase EXPR_DIFFTST: \r\n\tcase EXPR_LAND: \r\n\tcase EXPR_LXOR: \r\n\tcase EXPR_LOR: \r\n\tcase EXPR_AND: \r\n\tcase EXPR_OR: \r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\tprintf(getOpDump());\r\n\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\tbreak;\r\n\tcase EXPR_REF:\r\n\t\t{\r\n\t\t\tbool wrap = false;\r\n\r\n\t\t\t// Pass a member as parameter.\r\n\t\t\tif (m_item.symbolType == EGENRE::_MEMBER) {\r\n\t\t\t\tif (m_runtimeType->isGC_Able()) {\r\n\t\t\t\t\t// \r\n\t\t\t\t\tprintf(\"(%s&)System::__GCObject::__registerByRef((System::__GCObject*&)\",m_runtimeType->dumpTypeForCode(m_runtimeType->m_definitionAC));\r\n\t\t\t\t\twrap = true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif ((m_runtimeType->m_definitionAC != NULL) && (m_runtimeType->m_definitionAC->m_modifier & ATT_STRUCT)) {\r\n\t\t\t\t\t\tprintf(\"%s::__registerByRef(\",m_runtimeType->getFullName(gCurrentAC));\r\n\t\t\t\t\t\twrap = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tm_expressions[0]->dumpExpressionInternal();\r\n\r\n\t\t\tif (wrap) {\r\n\t\t\t\tprintf(\")\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t\r\n\t// Triple\r\n\tcase EXPR_COND: \r\n\t\tprintf(\"(\");\r\n\t\tm_expressions[0]->dumpExpressionInternal();\r\n\t\tprintf(\" ? \");\r\n\t\tm_expressions[1]->dumpExpressionInternal();\r\n\t\tprintf(\" : \");\r\n\t\tm_expressions[2]->dumpExpressionInternal();\r\n\t\tprintf(\")\");\r\n\t\tbreak;\r\n\tcase EXPR_UNARYMULT:\r\n\tcase EXPR_CAST_PTR:\r\n\tcase EXPR_UNCHECKED: \r\n\tcase EXPR_ADRESSOF:\r\n\tcase EXPR_ARROW: \r\n\tcase EXPR_SIZEOF:\r\n\tcase EXPR_TYPEOF:\r\n\tcase EXPR_CHECKED: \r\n\t\t// Not Supported, error handled at parser level.\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Internal Error, unknown Expression Type\", m_line);\r\n\t}\r\n\tif(this->m_hasParenthesis) { printf(\")\"); }\r\n}\r\n\r\nconst char* Expression::getOpDump() {\r\n\tswitch (this->m_expressionType) {\r\n\tcase EXPR_DIV: \t\t\treturn \" / \";\r\n\tcase EXPR_MOD: \t\t\treturn \" %% \";\r\n\tcase EXPR_MINUS: \t\treturn \" - \";\r\n\tcase EXPR_MULT: \t\treturn \" * \";\r\n\tcase EXPR_LSHFT: \t\treturn \" << \";\r\n\tcase EXPR_RSHFT: \t\treturn \" >> \";\r\n\tcase EXPR_LESS: \t\treturn \" < \";\r\n\tcase EXPR_MORE: \t\treturn \" > \";\r\n\tcase EXPR_LESSEQ: \t\treturn \" <= \";\r\n\tcase EXPR_MOREEQ:\t\treturn \" >= \";\r\n\tcase EXPR_EQUTST:\t\treturn \" == \";\r\n\tcase EXPR_DIFFTST:\t\treturn \" != \";\r\n\tcase EXPR_LAND:\t\t\treturn \" & \";\r\n\tcase EXPR_LXOR:\t\t\treturn \" ^ \";\r\n\tcase EXPR_LOR:\t\t\treturn \" | \";\r\n\tcase EXPR_AND:\t\t\treturn \" && \";\r\n\tcase EXPR_OR:\t\t\treturn \" || \";\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Internal error, should never reach that code\", m_line);\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nconst char* Expression::getAssEqOpDump() {\r\n\tswitch (this->m_expressionType) {\r\n\tcase EXPR_ASS_PLUSEQ:\treturn \" += \";\r\n\tcase EXPR_ASS_MINUSEQ:\treturn \" -= \";\r\n\tcase EXPR_ASS_STAREQ:\treturn \" *= \";\r\n\tcase EXPR_ASS_DIVEQ:\treturn \" /= \";\r\n\tcase EXPR_ASS_MODEQ:\treturn \" %%= \";\r\n\tcase EXPR_ASS_XOREQ:\treturn \" ^= \";\r\n\tcase EXPR_ASS_ANDEQ:\treturn \" &= \";\r\n\tcase EXPR_ASS_OREQ:\t\treturn \" |= \";\r\n\tcase EXPR_ASS_LSHFTEQ:  return \" <<= \";\r\n\tcase EXPR_ASS_RSHFTEQ:\treturn \" >>= \";\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Internal error, should never reach that code\", m_line);\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nvoid Variable::dumpVariable\t()\r\n{\r\n}\r\n\r\nvoid Variable::dumpMember(NameSpace* nameSpaceContext) {\r\n\t//\r\n\t// === Line 1 ===\r\n\t//\r\n\tbool isConst\t= false;\r\n\tbool isStatic\t= false;\r\n\ttab();\r\n\tif (this->m_modifier & ATT_STATIC) {\r\n\t\tprintf(\"static \");\r\n\t\tisStatic = true;\r\n\t}\r\n\r\n\tif (this->m_modifier & ATT_CONST) {\r\n\t\tisConst = true;\r\n\t\tprintf(\"const \");\r\n\t}\r\n\r\n\t// TypeA varA;\r\n\r\n\t// LATER other modifier support ?\r\n\t// ATT_PUBLIC\t\t= 0x00000002,\r\n\t// ATT_PRIVATE\t\t= 0x00000004,\r\n\t// ATT_PROTECTED\t= 0x00000008,\r\n\t// ATT_INTERNAL\t= 0x00000010,\r\n\t// ATT_VOLATILE\t= 0x00001000,\r\n\t// ATT_SEALED\t\t= 0x00000080,\t// Same as FINAL\r\n\r\n\t// Dump Type\r\n\tprintf(this->m_type->dumpTypeForCode(nameSpaceContext)); printf(\" \");\r\n\r\n\t// Dump Variable Name\r\n\tprintf(this->getName());\r\n\r\n\t// Dump Assignment if any.\r\n\t// TODO if CONST and non object value -> put ATT_STATIC to the member.\r\n\t// --> All sub logic and search is going to optimize\r\n\r\n\tif (this->m_expression && isConst) {\r\n\t\tprintf(\" = \");\r\n\t\tExpression::analysisTransformAndDump(&this->m_expression, this->m_type);\r\n\t}\r\n\r\n\tprintf(\";\\n\");\r\n\r\n\t//\r\n\t// Line 2 : Dump equivalent inline safe getter\r\n\t//\r\n\tEnumTypeObject EType = this->m_type->m_typeID;\r\n\tconst char* pStrType = this->m_type->dumpTypeForCode(nameSpaceContext);\r\n\tconst char* name\t = this->m_name;\r\n\tbool\t\tisNonNum = ((EType & (ET_BASETYPE | ET_NUMBER))==ET_BASETYPE);\r\n\tconst char* testDiv\t = isNonNum ? \"if (value == 0) { THROWDIVZERO; }; \" : \"\";\r\n\tbool\t\tisBool\t = (EType == ET_BOOL);\r\n\tbool\t\tisPtr\t = this->m_type->isGC_Able();\r\n\tbool\t\tisEnum\t = (this->m_type->m_genreID == EGENRE::_ENUM) && (isPtr == false);\r\n\tbool\t\tisNativePtr\t= (EType == TYPE_INTPTR);\r\n\tbool\t\tisInteger = (EType == ET_INT8 || EType == ET_INT16 || EType == ET_INT32 || EType == ET_INT64 ||\r\n\t\t\t\t\t\t\tEType == ET_UINT8 || EType == ET_UINT16 || EType == ET_UINT32 || EType == ET_UINT64 ||\r\n\t\t\t\t\t\t\tEType == ET_CHAR) && (isPtr==false);\r\n\r\n\tbool\t\tisStruct;\r\n\t\r\n\tif (this->m_type->m_definitionAC) {\r\n\t\tisStruct = (this->m_type->m_definitionAC->m_modifier & ATT_STRUCT) != 0;\r\n\t} else {\r\n\t\tisStruct = false;\r\n\t}\r\n\r\n\t// For GC-able members, inline function are dumped later to avoid dependancy issues.\r\n\r\n\tif (isStatic) {\r\n\t\tif(isEnum)\r\n\t\t{\r\n\t\t\t// Special case 1 : these operators need to be wrapped as they aren't staple overloaded operators for enums.\r\n\t\t\ttab(); printf(\"inline static %s _s%spostInc()\t\t\t\t{ return (%s)(((s32&)%s)++); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline static %s _s%spostDec()\t\t\t\t{ return (%s)(((s32&)%s)--); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline static %s _s%spreInc()\t\t\t\t{ return (%s)(++(s32&)%s); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline static %s _s%spreDec()\t\t\t\t{ return (%s)(--(s32&)%s); }\\n\", pStrType, name, pStrType, name);\r\n\r\n\t\t\ttab(); printf(\"inline static %s _s%sAddEq(s32 value)\t\t{ return (%s)((s32&)%s += value); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline static %s _s%sSubEq(s32 value)\t\t{ return (%s)((s32&)%s -= value); }\\n\", pStrType, name, pStrType, name);\r\n\t\t}\r\n\t\telse if((isNonNum == false) && (isPtr == false) && (isStruct == false))\r\n\t\t{\r\n\t\t\t// Special case  2 : %= exists in C# for doubles and floats, but not in C++.\r\n\t\t\ttab(); printf(\"inline static %s _s%sModEq(%s value)\t\t{ s32 tmp = ((s32)(%s / value)); return %s = %s-(tmp*value); }\\n\", pStrType, name, pStrType, name, name, name);\r\n\t\t}\r\n\t\telse if(isInteger)\r\n\t\t{\r\n\t\t\t// Special case 3 : integer division needs to be wrapped to handle division by zero.\r\n\t\t\ttab(); printf(\"inline static %s _s%sDivEq(%s value)\t\t{ %s; return %s /= value; }\\n\", pStrType, name, pStrType, testDiv, name);\r\n\t\t\ttab(); printf(\"inline static %s _s%sModEq(%s value)\t\t{ %s; return %s %%= value; }\\n\", pStrType, name, pStrType, testDiv, name);\r\n\t\t}\r\n\t\telse if(isStruct) \r\n\t\t{\r\n\t\t\ttab(); printf(\"inline static %s _s%s(%s _$value);\\n\",pStrType,name,pStrType);\r\n\t\t}\r\n\t\telse if(isPtr)\r\n\t\t{\r\n\t\t\ttab(); printf(\"inline static %s _s%s(%s _$value);\\n\",pStrType,name,pStrType);\r\n\t\t}\r\n\t}\r\n\r\n\telse if ((!isConst) && (!isStatic)) {\r\n\r\n\t\t//\r\n\t\t// Perform ref count analysis here at the same time : member is NOT static, member is NOT const\r\n\t\t// Work recursively as the struct are dumped in dependancy order.\r\n\t\t//\r\n\t\tif (isStruct) {\r\n\t\t\tu32 value = 0;\r\n\t\t\tif (isPtr)\t\t\t{ value = 1; }\r\n\t\t\telse if (isStruct)\t{ value = this->m_type->m_definitionAC->m_referenceModifCount; }\r\n\t\t\tthis->m_ownerClass->m_referenceModifCount += value;\r\n\t\t}\r\n\r\n\t\ttab();\r\n\t\tprintf(\"inline \");\r\n\t\tprintf(\"%s& _g%s$() { CHCKTHIS; return %s; }\\n\",pStrType, name, name);\r\n\t\t\r\n\t\t//\r\n\t\t// Line 3 : Dump equivalent inline safe setter (Note : setter MUST return value because can do assignment in expression)\r\n\t\t//\r\n\t\tif (isPtr) {\r\n\t\t\ttab(); printf(\"inline %s _s%s(%s _$value);\\n\", pStrType, name, pStrType);\r\n\t\t\ttab(); printf(\"inline %s _s%s$(%s _$value);\\n\", pStrType, name, pStrType);\r\n\t\t} else {\r\n\t\t\tif (isStruct) {\r\n\t\t\t\ttab(); printf(\"inline %s _s%s(%s _$value);\\n\", pStrType,name,pStrType);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$(%s _$value);\\n\", pStrType, name, pStrType);\r\n\t\t\t} else {\r\n\t\t\t\ttab(); printf(\"inline \");\r\n\t\t\t\tprintf(\"%s _s%s$(%s _$value) { CHCKTHIS; return %s = _$value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Early return\r\n\t\tif (isBool || isPtr || isStruct) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"inline %s _s%s$postInc()\t\t\t\t{ CHCKTHIS; return (%s)(((s32&)%s)++); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%s$postDec()\t\t\t\t{ CHCKTHIS; return (%s)(((s32&)%s)--); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%s$preInc()\t\t\t\t{ CHCKTHIS; return (%s)(++(s32&)%s); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%s$preDec()\t\t\t\t{ CHCKTHIS; return (%s)(--(s32&)%s); }\\n\", pStrType, name, pStrType, name);\r\n\r\n\t\t\ttab(); printf(\"inline %s _s%s$AddEq(s32 value)\t\t{ CHCKTHIS; return (%s)((s32&)%s += value); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%s$SubEq(s32 value)\t\t{ CHCKTHIS; return (%s)((s32&)%s -= value); }\\n\", pStrType, name, pStrType, name);\r\n\r\n\t\t\ttab(); printf(\"inline %s _s%spostInc()\t\t\t\t{ return (%s)(((s32&)%s)++); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%spostDec()\t\t\t\t{ return (%s)(((s32&)%s)--); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%spreInc()\t\t\t\t{ return (%s)(++(s32&)%s); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%spreDec()\t\t\t\t{ return (%s)(--(s32&)%s); }\\n\", pStrType, name, pStrType, name);\r\n\r\n\t\t\ttab(); printf(\"inline %s _s%sAddEq(s32 value)\t\t{ return (%s)((s32&)%s += value); }\\n\", pStrType, name, pStrType, name);\r\n\t\t\ttab(); printf(\"inline %s _s%sSubEq(s32 value)\t\t{ return (%s)((s32&)%s -= value); }\\n\", pStrType, name, pStrType, name);\r\n\t\t} else {\r\n\t\t\tif (!isNativePtr) {\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$postInc()\t\t\t\t{ CHCKTHIS; return %s++; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$postDec()\t\t\t\t{ CHCKTHIS; return %s--; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$preInc()\t\t\t\t{ CHCKTHIS; return ++%s; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$preDec()\t\t\t\t{ CHCKTHIS; return --%s; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$AddEq(%s value)\t\t{ CHCKTHIS; return %s += value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$SubEq(%s value)\t\t{ CHCKTHIS; return %s -= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t} else {\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$AddEq(s32 value)\t\t{ CHCKTHIS; return %s += value; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$SubEq(s32 value)\t\t{ CHCKTHIS; return %s -= value; }\\n\", pStrType, name, name);\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif (!isNativePtr) {\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$MulEq(%s value)\t\t{ CHCKTHIS; return %s *= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%s$DivEq(%s value)\t\t{ CHCKTHIS; %s; return %s /= value; }\\n\", pStrType, name, pStrType, testDiv, name);\r\n\t\t\t\tif (isNonNum) {\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$ModEq(%s value)\t\t{ CHCKTHIS; %s; return %s %%= value; }\\n\", pStrType, name, pStrType, testDiv, name);\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$ModEq(%s value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(%s / value)); return %s = %s-(tmp*value); }\\n\", \r\n\t\t\t\t\t\tpStrType, name, pStrType, name, name, name);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isNonNum) {\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$XorEq(%s value)\t\t{ CHCKTHIS; return %s ^= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$AndEq(%s value)\t\t{ CHCKTHIS; return %s &= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$OrEq(%s value)\t\t{ CHCKTHIS; return %s |= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$RShiftEq(%s value)\t{ CHCKTHIS; return %s >>= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%s$LShiftEq(%s value)\t{ CHCKTHIS; return %s <<= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttab(); printf(\"inline %s _s%spostInc()\t\t\t\t{ return %s++; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%spostDec()\t\t\t\t{ return %s--; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%spreInc()\t\t\t\t{ return ++%s; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%spreDec()\t\t\t\t{ return --%s; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%sAddEq(%s value)\t\t{ return %s += value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%sSubEq(%s value)\t\t{ return %s -= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t} else {\r\n\t\t\t\ttab(); printf(\"inline %s _s%sAddEq(s32 value)\t\t{ return %s += value; }\\n\", pStrType, name, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%sSubEq(s32 value)\t\t{ return %s -= value; }\\n\", pStrType, name, name);\r\n\t\t\t}\r\n\r\n\t\t\tif (!isNativePtr) {\r\n\t\t\t\ttab(); printf(\"inline %s _s%sMulEq(%s value)\t\t{ return %s *= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\ttab(); printf(\"inline %s _s%sDivEq(%s value)\t\t{ %s; return %s /= value; }\\n\", pStrType, name, pStrType, testDiv, name);\r\n\t\t\t\tif (isNonNum) {\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sModEq(%s value)\t\t{ %s; return %s %%= value; }\\n\", pStrType, name, pStrType, testDiv, name);\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sModEq(%s value)\t\t{ s32 tmp = ((s32)(%s / value)); return %s = %s-(tmp*value); }\\n\", \r\n\t\t\t\t\t\tpStrType, name, pStrType, name, name, name);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isNonNum) {\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sXorEq(%s value)\t\t{ return %s ^= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sAndEq(%s value)\t\t{ return %s &= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sOrEq(%s value)\t\t\t{ return %s |= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sRShiftEq(%s value)\t\t{ return %s >>= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t\ttab(); printf(\"inline %s _s%sLShiftEq(%s value)\t\t{ return %s <<= value; }\\n\", pStrType, name, pStrType, name);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid Method::dumpParamsDef(char* buffer, bool doCall, bool dumpDefault) {\r\n\tVariable* pVar = this->m_parameters;\r\n\tbool first = true;\r\n\twhile (pVar) {\r\n\t\tif (first) {\r\n\t\t\tfirst = false;\r\n\t\t} else {\r\n\t\t\tbuffer += sprintf(buffer,\",\");\r\n\t\t}\r\n\r\n\t\tif (!doCall) {\r\n\t\t\tbuffer += sprintf(buffer, pVar->m_type->dumpTypeForCode(m_pOwner, this));\r\n\t\t\tif (pVar->m_modifier & ATT_REF) { buffer += sprintf(buffer, \"&\"); }\r\n\t\t\tbuffer += sprintf(buffer, \" \");\r\n\t\t}\r\n\t\tbuffer += sprintf(buffer, pVar->getName());\r\n\t\tif (!doCall) {\r\n\t\t\tif (pVar->m_expression && dumpDefault) {\r\n\t\t\t\tbuffer += sprintf(buffer, \" = \");\r\n\t\t\t\tpVar->m_expression->dumpExpression();\r\n\t\t\t}\r\n\t\t}\r\n\t\tpVar = pVar->m_pNextVariable;\r\n\t}\r\n}\r\n\r\nvoid Method::dumpParamsDef() {\r\n\tVariable* pVar = this->m_parameters;\r\n\tbool first = true;\r\n\twhile (pVar) {\r\n\t\tif (first) {\r\n\t\t\tfirst = false;\r\n\t\t} else {\r\n\t\t\tprintf(\",\");\r\n\t\t}\r\n\t\tprintf(pVar->m_type->dumpTypeForCode(m_pOwner, this));\r\n\t\tif (pVar->m_modifier & ATT_REF) { printf(\"&\"); }\r\n\t\tprintf(\" \");\r\n\t\tprintf(pVar->getName());\r\n\t\t/* DO NOT DUMP DEFAULT in C++, make the compiler perform full call instead.\r\n\t\tif (pVar->m_expression) {\r\n\t\t\tprintf(\" = \");\r\n\t\t\tpVar->m_expression->dumpExpression();\r\n\t\t}*/\r\n\t\tpVar = pVar->m_pNextVariable;\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::analyzeComplete() {\r\n\tif(isSubSystem()) {\r\n\t\t// No need to analyse\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Analyze Getter / Setter\r\n\tfor (int n=0; n < this->m_accessorCount; n++) {\r\n\t\tAccessor* pA = this->m_accessors[n];\r\n\r\n\t\t// Create global dico + Add function parameters to dictionnary.\r\n\t\tif(!gCurrentSD) {\t//gCurrentSD is supposed to be always NULL at this point\r\n\t\t\tgCurrentSD = new SymbolDictionary();\r\n\t\t}\r\n\r\n\t\tgIsStaticFunc = (pA->m_modifier & ATT_STATIC) != 0;\r\n\t\tpA->m_type->getResolvedType(this);\r\n\t\tgReturnType   = pA->m_type;\r\n\t\t\r\n\t\t// Register parameters in the dictionary\r\n\t\tVariable* pParam = pA->m_variable;\r\n\t\twhile(pParam) {\r\n\t\t\tgCurrentSD->addVariable(pParam);\r\n\t\t\tpParam = pParam->m_pNextVariable;\r\n\t\t}\r\n\r\n\t\tif (pA->m_get) {\r\n\t\t\tif (pA->m_get->m_statement) {\r\n\t\t\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\t\t\tpA->m_get->m_statement->analysis();\r\n\t\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (pA->m_set) {\r\n\t\t\tif (pA->m_set->m_statement) {\r\n\t\t\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\t\t\tVariable* pParameter = CreateVarInstance(\"value\");\r\n\t\t\t\tpParameter->setType(pA->m_type);\r\n\t\t\t\tgCurrentSD->addVariable(pParameter);\r\n\t\t\t\tpA->m_set->m_statement->analysis();\r\n\t\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Destroy dico + Remove variable/parameters from dictionnary.\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\t\r\n\t}\r\n\r\n\t// Analyze all member that may be delegate related.\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\r\n\t\tif (pVar->m_expression) {\r\n\t\t\tSRSymbol res = pVar->m_type->getResolvedType(this);\r\n\t\t\tif (res.symbolType == EGENRE::_DELEGATE) {\r\n\t\t\t\tgIsStaticFunc = (pVar->m_modifier & ATT_STATIC) != 0;\r\n\t\t\t\tif (pVar->m_expression->m_expressionType == EXPR_DELEGATECREATE) {\r\n\t\t\t\t\tpVar->m_expression->m_delegateDef = (Delegate*)res.pSymbol;\r\n\t\t\t\t\tpVar->m_expression->AnalysisAndTransform();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Analyze functions\r\n\tfor (int n=0; n < this->m_methodCount; n++) {\r\n\t\tMethod* pM = this->m_methods[n];\r\n\t\tgCurrentMethod = pM;\r\n\r\n\t\tgIsStaticFunc = (pM->m_modifier & ATT_STATIC) != 0;\r\n\t\tif (pM->m_returnType) {\t// NULL in case of CTOR & DTOR\r\n\t\t\tpM->m_returnType->getResolvedType(this, gCurrentMethod);\r\n\t\t\tgReturnType   = pM->m_returnType;\r\n\t\t}\r\n\r\n\t\t// Create global dico + Add function parameters to dictionnary.\r\n\t\tif(!gCurrentSD) {\t//gCurrentSD is supposed to be always NULL at this point\r\n\t\t\tgCurrentSD = new SymbolDictionary();\r\n\t\t}\r\n\r\n\t\tVariable* pParameter = pM->m_parameters;\r\n\t\twhile(pParameter) {\r\n\t\t\t// Register variables as local symbols for code.\r\n\t\t\tgCurrentSD->addVariable(pParameter);\r\n\t\t\tpParameter->m_type->m_res = pParameter->m_type->getResolvedType(this, pM);\r\n\t\t\tpParameter = pParameter->m_pNextVariable;\r\n\t\t}\r\n\r\n\t\tif(pM->m_initializerOpt) {\r\n\t\t\t// Analyse base constructor parameters\r\n\t\t\tpM->m_initializerOpt->AnalysisAndTransform();\r\n\t\t}\r\n\r\n\t\tpM->m_codeBlock->analysis();\r\n\r\n\t\t// Destroy dico + Remove variable/parameters from dictionnary.\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\r\n\t}\r\n\tgCurrentMethod = NULL;\r\n}\r\n\r\nconst char* AbstractContainer::getTemplateParams() {\r\n\tchar buff[500];\r\n\tbuff[0] = 0;\r\n\tchar* ptr = buff;\r\n\tint delta;\r\n\r\n\tif(m_genericParam) {\r\n\t\tTypeGenericDefinitionEntry* genericSymbol = m_genericParam;\r\n\t\tsprintf(ptr++, \"<\");\r\n\t\twhile(genericSymbol) {\r\n\t\t\tdelta = sprintf(ptr, \"%s\", genericSymbol->m_genericName);\r\n\t\t\tptr += delta;\r\n\t\t\tif(genericSymbol = genericSymbol->m_pNextGenericEntry) {\r\n\t\t\t\tsprintf(ptr, \", \");\r\n\t\t\t\tptr += 2;\r\n\t\t\t}\r\n\t\t}\r\n\t\tsprintf(ptr, \">\");\r\n\t}\r\n\telse {\r\n\t\t// The class is not a template.\r\n\t}\r\n\treturn concat(buff);\r\n}\r\n\r\nvoid AbstractContainer::dumpTemplateLabel() {\r\n\tif(m_genericParam) {\r\n\t\tTypeGenericDefinitionEntry* genericSymbol = m_genericParam;\r\n\t\tprintf(\"template <\");\r\n\t\twhile(genericSymbol) {\r\n\t\t\tprintf(\"typename %s\", genericSymbol->m_genericName);\r\n\t\t\tif(genericSymbol = genericSymbol->m_pNextGenericEntry) {\r\n\t\t\t\tprintf(\", \");\r\n\t\t\t}\r\n\t\t}\r\n\t\tprintf(\"> \");\r\n\t}\r\n\telse {\r\n\t\t// The class is not a template.\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::dumpFriends() {\r\n\tfor(int n = 0 ; n < m_innerCount ; n++) {\r\n\t\tAbstractContainer* pInner = m_pInner[n];\r\n\t\tif(pInner->m_cppRepresentation) {\r\n\t\t\tprintf(\"friend %s %s;\\n\", ((pInner->m_modifier & ATT_STRUCT) == 0) ? \"class\" : \"struct\", pInner->m_cppRepresentation->m_name);\r\n\t\t\tpInner->dumpFriends();\r\n\t\t}\r\n\t}\r\n\tfor(int n = 0 ; n < m_delegateCount ; n++) {\r\n\t\tif(m_delegates[n]->m_cppRepresentation)\r\n\t\t{\r\n\t\t\tprintf(\"friend class %s;\\n\", m_delegates[n]->m_cppRepresentation->m_name);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Dumps inner classes which are still nested (anonymous delegates).\r\nvoid AbstractContainer::dumpNested() {\r\n\tfor(int n = 0 ; n < m_innerCount ; n++) {\r\n\t\tif(!m_pInner[n]->m_cppRepresentation) {\r\n\t\t\tprintf(\"class %s;\\n\", m_pInner[n]->m_name);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::dumpPrototype(bool isInnerClass) {\r\n\t// If no dump set, do nothing.\r\n\tif (m_noDump) { return ; }\r\n\r\n\tgCurrentAC = this;\r\n\tanalyzeComplete();\r\n\r\n\tif((m_pParent == gRootNameSpace) && strcmp(m_name, \"Program\") == 0) {\r\n\t\t// Dumped in framework.h\r\n\t\treturn;\r\n\t}\r\n\r\n\tchar buff[1000];\r\n\tbuff[0] = 0;\r\n\tchar* pb = buff;\r\n\tint n = 0;\r\n\tAbstractContainer* list[50];\r\n\tlist[n++] = this;\r\n\tAbstractContainer* p = this;\r\n\twhile (p->m_name[0]) {\r\n\t\tlist[n++] = p;\r\n\t\tp = (AbstractContainer*)p->m_pParent;\t\t\r\n\t}\r\n\tfor(n-- ; n > 1 ; n--) {\r\n\t\tpb += sprintf(pb, \"%s::\", list[n]->m_name);\r\n\t}\r\n\tpb += sprintf(pb, this->getName());\r\n\tconst char* fullName = buff;\r\n\r\n\tif (this->m_csharpRepresentation) {\r\n\t\t// class NomMessedup { implement CSharp }\r\n\t\tthis->m_csharpRepresentation->realDumpPrototype(isInnerClass, fullName);\r\n\t} else if (this->m_cppRepresentation) {\r\n\t\t// Skip.\r\n\t\treturn;\r\n\t} else {\r\n\t\t// Normal, no change.\r\n\t\trealDumpPrototype(isInnerClass, fullName);\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::realDumpPrototype(bool isInnerClass, const char* fullName) {\r\n\tint\t\t   nameSpaceCount = 0;\t\r\n\t/*\r\n\tif (!isInnerClass) {\r\n\t\t// === List of name space to the root.\r\n\t\tNameSpace* nameSpace[50];\r\n\t\tNameSpace* current = this->m_pParent;\r\n\t\twhile (current) {\r\n\t\t\tif (current->getGenre() == EGENRE::_NAMESPACE) {\r\n\t\t\t\tnameSpace[nameSpaceCount++] = current;\r\n\t\t\t}\r\n\t\t\tcurrent = current->m_pParent;\r\n\t\t}\r\n\r\n\t\t// Dump root to class name space stack\r\n\t\tint n;\r\n\t\tn = nameSpaceCount-2; while (n >= 0) {\r\n\t\t\tprintf(\"namespace %s { \", nameSpace[n]->m_name); \r\n\t\t\tn--;\r\n\t\t}\r\n\t\tprintf(\"\\n\");\r\n\t\tdepth++;\r\n\t}*/\r\n\r\n\r\n\tbool isInterface = ((this->m_modifier & ATT_INTERFACE) != 0);\r\n\tbool isStruct\t = ((this->m_modifier & ATT_STRUCT) != 0);\r\n\r\n\t//\r\n\t// Header\r\n\t//\r\n\ttab(); \r\n\r\n\tdumpTemplateLabel();\r\n\r\n\tint count = 0;\r\n\tif (this->m_modifier & ATT_CLASS) {\r\n\t\tcount = 1;\r\n\t\tprintf(\"class %s \", fullName);\r\n\t\tif (this->getAncestor())\t{ \r\n\t\t\tprintf(\": public %s \",this->getAncestor()->m_definitionAC->getFullName(this)); \r\n\t\t} else {\r\n\t\t\tprintf(\": public System::Object \");\r\n\t\t}\t\t\t\t\t\t\t// Force because we need GC and inheritance.\r\n\t} else {\r\n\t\tif (isInterface) {\r\n\t\t\tprintf(\"class %s \", fullName); // Interface do NOT inherit from GC.\r\n\t\t} else {\r\n\t\t\t// Struct do not inherit from GCOBject either.\r\n\t\t\t// No real difference with C++ but use it as a convenience for debugging C++ output.\r\n\t\t\tprintf(\"struct %s : public System::__GCStruct \", fullName);\r\n\t\t}\r\n\t}\r\n\r\n\tif (this->m_inheritancesCount) {\r\n\t\tfor (int n=0; n < this->m_inheritancesCount; n++) {\r\n\t\t\tif (this->getAncestor() != m_inheritances[n]) {\r\n\t\t\t\tprintf(\"%s\", (count++ || isStruct) ? \",\" : \": \");\r\n\t\t\t\tprintf(\"public %s \", this->m_inheritances[n]->getFullName(this)); // TODO : resolve\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tprintf(\"{\\n\");\r\n\r\n\tdumpFriends();\r\n\r\n\ttab(); printf(\"\\npublic:\\n\");\r\n\r\n\tdumpNested();\r\n\r\n\t// Inner guts\r\n\tdepth++;\r\n\r\n\tdumpEnums(this);\r\n\t// Inner classes and delegates are unnested.\r\n\t// dumpDelegatePrototypes(this);\r\n\t// dumpClassPrototypes(this, false);\r\n\r\n\tif (!isInterface) {\r\n\t\t// Constructor / Destructor interface\r\n\t\ttab(); printf(\"void _ctor_%s();\\n\",this->getName());\r\n\t}\r\n\r\n\tbool hadDtor = false;\r\n\tbool hadEmptyCtor = false;\r\n\r\n\t// Dump Const & Static\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\r\n\t\tpVar->dumpMember(this);\r\n\r\n\t\tif (pVar->m_modifier & ATT_STATIC) {\r\n\t\t\tgStaticDepMatrix->registerVariable(pVar);\r\n\t\t}\r\n\t\tprintf(\"\\n\");\r\n\t}\r\n\r\n\t// Dump Getter / Setter\r\n\tfor (int n=0; n < this->m_accessorCount; n++) {\r\n\t\tAccessor* pA = this->m_accessors[n];\r\n\r\n\t\t// Create global dico + Add function parameters to dictionnary.\r\n\t\tif(!gCurrentSD) {\t//gCurrentSD is supposed to be always NULL at this point\r\n\t\t\tgCurrentSD = new SymbolDictionary();\r\n\t\t}\r\n\r\n\t\tbool isVirt\t\t = false;\r\n\t\tif ((this->m_modifier & ATT_INTERFACE)) {\r\n\t\t\t// Do nothing.\r\n\t\t} else {\r\n\t\t\tif (pA->m_modifier & ATT_STATIC) {\r\n\t\t\t\tisVirt = false;\r\n\t\t\t} else {\r\n\t\t\t\tisVirt = ((pA->m_modifier & ATT_VIRTUAL) != 0);\r\n\t\t\t\t// TODO : detect interface implementation -> generate virtual ? C++ consider even without rewriting virtual... should work as is.\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tgIsStaticFunc = (pA->m_modifier & ATT_STATIC) != 0;\r\n\r\n\t\tconst char* pStrType\t= pA->m_type->dumpTypeForCode(this);\r\n\t\tconst char* pName\t\t= pA->m_name ? pA->m_name : \"\";\r\n\t\tconst char* testDiv\t\t= ((pA->m_type->m_typeID & (ET_BASETYPE | ET_NUMBER))==ET_BASETYPE) ? \"if (value == 0) { THROWDIVZERO; }; \" : \"\";\r\n\t\tconst char* accType\t\t= pA->m_variable == NULL ? \"acc\" : \"idx\";\r\n\r\n\t\t// getter/setter implementation is dumped later to avoid dependancy issues.\r\n\r\n\t\tif (pA->m_get) {\r\n\t\t\tif (!isInterface && ((pA->m_get->m_modifier & ATT_ABSTRACT)==0) && (pA->m_get->m_statement)) {\r\n\t\t\t\ttab();\r\n\t\t\t\t// Unsafe Getter\r\n\t\t\t\tif (pA->m_modifier & ATT_STATIC) { printf(\"static \"); }\r\n\t\t\t\tprintf(\"%s %s _%s_g%s(\",isVirt ? \"virtual\" : \"inline\",pStrType, accType, pName); pA->dumpParams(false); printf(\");\\n\");\r\n\t\t\t\tif ((pA->m_modifier & ATT_STATIC)==0) {\r\n\t\t\t\t\ttab(); printf(\"inline %s _%s_g%s$(\",pStrType, accType, pName); pA->dumpParams(false); printf(\");\\n\\n\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\ttab();\r\n\t\t\t\tif (pA->m_modifier & ATT_STATIC) {\r\n\t\t\t\t\tprintf(\"static %s _%s_g%s(\",pStrType, accType, pName); pA->dumpParams(false); printf(\") { THROWUNIMPLEMENTED; return (%s)NULL; }\\n\", pStrType);\r\n\t\t\t\t\ttab(); printf(\"static inline %s _%s_g%s$(\",pStrType, accType, pName); pA->dumpParams(false); printf(\");\\n\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprintf(\"virtual %s _%s_g%s(\",pStrType, accType, pName); pA->dumpParams(false); printf(\") = 0;\\n\");\r\n\t\t\t\t\ttab(); printf(\"virtual %s _%s_g%s$(\",pStrType, accType, pName); pA->dumpParams(false); printf(\") = 0;\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (pA->m_set) {\r\n\r\n\t\t\tif (!isInterface && ((pA->m_set->m_modifier & ATT_ABSTRACT)==0) && (pA->m_set->m_statement)) {\r\n\t\t\t\tVariable* pParameter = CreateVarInstance(\"value\");\r\n\t\t\t\tpParameter->setType(pA->m_type);\r\n\t\t\t\tgCurrentSD->addVariable(pParameter);\r\n\r\n\t\t\t\tbool\t\tisNonNum\t= ((pA->m_type->m_typeID & (ET_BASETYPE | ET_NUMBER))==ET_BASETYPE);\r\n\t\t\t\tbool\t\tisBool\t\t= (pA->m_type->m_typeID == ET_BOOL);\r\n\t\t\t\tbool\t\tisEnum\t\t= (pA->m_type->m_genreID == EGENRE::_ENUM);\r\n\t\t\t\tbool\t\tisPtr\t\t= pA->m_type->isGC_Able();\r\n\t\t\t\tbool\t\tisReadable\t= (pA->m_get != NULL);\r\n\t\t\t\tbool\t\tisStatic\t= (pA->m_modifier & ATT_STATIC);\r\n\t\t\t\tbool\t\tisNativePtr\t= (pA->m_type->m_typeID == TYPE_INTPTR);\r\n\t\t\t\t// Unsafe Setter\r\n\t\t\t\ttab(); \r\n\t\t\t\tif (pA->m_modifier & ATT_STATIC) { printf(\"static \"); }\r\n\t\t\t\tprintf(\"%s %s _%s_s%s(\",isVirt ? \"virtual\" : \"inline\",pStrType, accType, pName); pA->dumpParams(false, true); printf(\"%s value);\\n\", pStrType);\r\n\t\t\t\tif (!isStatic) {\r\n\t\t\t\t\ttab(); printf(\"inline %s _%s_s%s$(\",\r\n\t\t\t\t\t\tpStrType, accType, pName);  pA->dumpParams(false, true); printf(\"%s value);\\n\", pStrType);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!isPtr && !isBool && isReadable) {\r\n\t\t\t\t\tdumpAccessorWrappers(pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\t\t\t\ttab();\r\n\t\t\t\tif (pA->m_modifier & ATT_STATIC) {\r\n\t\t\t\t\tprintf(\"static %s _%s_s%s(\",pStrType, accType, pName); pA->dumpParams(false, true); printf(\"%s value) { THROWUNIMPLEMENTED; }\\n\", pStrType);\r\n\t\t\t\t\ttab(); printf(\"static inline %s _%s_s%s$(\",pStrType, accType, pName); pA->dumpParams(false, true); printf(\"%s value);\\n\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprintf(\"virtual %s _%s_s%s(\",pStrType, accType, pName); pA->dumpParams(false, true); printf(\"%s value) = 0;\\n\", pStrType);\r\n\t\t\t\t\ttab(); printf(\"virtual %s _%s_s%s$(\",pStrType, accType, pName); pA->dumpParams(false, true); printf(\"%s value) = 0;\\n\", pStrType);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Destroy dico + Remove variable/parameters from dictionnary.\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\t\r\n\t}\r\n\r\n\t// TODO Dump Indexer\r\n\r\n\t// Dump function\r\n\tfor (int n=0; n < this->m_methodCount; n++) {\r\n\t\tMethod* pM = this->m_methods[n];\r\n\t\tgCurrentMethod = pM;\r\n\t\tif(pM->m_modifier & ATT_DTOR) {\r\n\t\t\t// The destructor body is dumped in _releaseGC().\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// This is a bit complex so we need explaination here :\r\n\t\t// - We have dumped all struct in dependancy order.\r\n\t\t// - We have updated m_referenceModifCount during the dump of each member in dumpPrototype.\r\n\t\t//\r\n\t\t// --> m_referenceModifCount has been successfully evaluated, including recursive inclusion of struct inside struct.\r\n\t\t// --> \"this\" also works because we dump all members before dumping functions.\r\n\t\t//\r\n\t\t// ==> Thus analyzeRef can faithfully access to the type and read the m_referenceModifCount values and cumulate.\r\n\t\t//\r\n\t\tbool hasRef = pM->analyzeRef();\r\n\r\n\t\ttab(); pM->dumpTemplateLabel();\r\n\t\tif (isInterface || (pM->m_modifier & ATT_VIRTUAL) || (pM->m_modifier & ATT_ABSTRACT)) {\r\n\t\t\tprintf(\"virtual \");\r\n\t\t}\r\n\t\tif (pM->m_modifier & ATT_STATIC) {\r\n\t\t\tprintf(\"static \");\r\n\t\t}\r\n\t\t\r\n\t\tif (pM->m_modifier & (ATT_CTOR | ATT_DTOR)) {\r\n\t\t\tif (this->m_modifier & ATT_DTOR) {\r\n\t\t\t\tprintf(\"~\");\r\n\t\t\t\thadDtor = true;\r\n\t\t\t} else if(!pM->m_parameters) {\r\n\t\t\t\thadEmptyCtor = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tprintf(pM->m_returnType->dumpTypeForCode(this)); printf(\" \");\r\n\t\t}\r\n\r\n\t\tgIsStaticFunc = (pM->m_modifier & ATT_STATIC) != 0;\r\n\r\n\t\tconst char* ext = \"\";\r\n\t\tif (pM->m_modifier & ATT_EXTERN)\t{ printf(\"_ext_\"); ext = \"_ext_\"; }\r\n\t\tif (pM->m_referenceModifCount)\t\t{ printf(\"_ref_\"); }\r\n\t\tprintf(pM->getName());\r\n\t\tprintf(\"(\");\r\n\t\t\r\n\t\tpM->dumpParamsDef();\r\n\r\n\t\tprintf(\")\");\r\n\t\tif (isInterface || (pM->m_modifier & ATT_ABSTRACT)) {\r\n\t\t\tprintf(\" = 0\");\r\n\t\t}\r\n\t\tprintf(\";\\n\");\r\n\r\n\t\tif ((pM->m_modifier & ATT_STATIC) == 0) {\r\n\t\t\tif ((pM->m_modifier & (ATT_CTOR | ATT_DTOR)) == 0) {\r\n\t\t\t\ttab();\r\n\t\t\t\tpM->dumpTemplateLabel();\r\n\t\t\t\tprintf(\"inline \");\r\n\t\t\t\tprintf(pM->m_returnType->dumpTypeForCode(this)); printf(\" \"); printf(pM->getName()); printf(\"$(\");\t\t\t\t\r\n\t\t\t\tpM->dumpParamsDef();\r\n\t\t\t\tprintf(\");\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Wrapper for corrected reference counting for the GC.\r\n\t\t//\r\n\t\tif (pM->m_referenceModifCount) {\r\n\t\t\ttab();\r\n\t\t\tprintf(\"inline \");\r\n\t\t\tif (pM->m_modifier & ATT_STATIC) {\r\n\t\t\t\tprintf(\"static \");\r\n\t\t\t}\r\n\t\t\tprintf(pM->m_returnType->dumpTypeForCode(this)); printf(\" \"); printf(pM->getName()); printf(\"(\");\r\n\t\t\tpM->dumpParamsDef();\r\n\t\t\tprintf(\");\\n\");\r\n\t\t}\r\n\t}\r\n\tgCurrentMethod = NULL;\r\n\r\n\tif ((!hadEmptyCtor) && (!isInterface)) {\r\n\t\t// Create default ctor\r\n\t\ttab(); printf(\"%s();\\n\",this->getName());\r\n\t\tthis->m_bCreateDefaultCtor = true;\r\n\t}\r\n\r\n\tif (!isInterface && !isStruct) {\r\n\t\ttab(); printf(\"virtual u32 _processGC();\\n\");\r\n\t\ttab(); printf(\"virtual void _releaseGC();\\n\");\r\n\t\ttab(); printf(\"virtual bool _isInstanceOf(u32 typeID);\\n\");\r\n\t\ttab(); printf(\"virtual inline void _moveAlert(u32 offset);\\n\");\r\n\t}\r\n\r\n\tif (isStruct) {\r\n\t\t//\r\n\t\t// 1. Check for need\r\n\t\t//\r\n\t\t// The function bodies are declared later\r\n\t\ttab(); printf(\"inline u32 _processGC();\\n\");\r\n\t\ttab(); printf(\"inline void _releaseGC();\\n\");\r\n\t\t\r\n\t\ttab(); printf(\"inline void* _RefSetValue(void* newStruct);\\n\");\r\n\t\ttab(); printf(\"virtual inline void _moveAlert(u32 offset);\\n\");\r\n\t\ttab(); printf(\"inline static %s& __registerByRef(%s& m);\\n\",this->getName(), this->getName());\r\n\t}\r\n\r\n\tdepth--; tab(); depth++; \r\n\tprintf(\"private:\\n\");\r\n\r\n\ttab(); printf(\"static const u32 _TYPEID = _TYPE_USEROBJECT | %s;\\n\", generateTypeID());\r\n\r\n\tdepth--;\r\n\t//\r\n\t// Footer\r\n\t//\r\n\ttab(); printf(\"};\\n\");\r\n\r\n\t/*\r\n\tif (!isInnerClass) {\r\n\t\t// Dump root to class name space stack\r\n\t\tint n = nameSpaceCount-2; while (n >= 0) {\r\n\t\t\tprintf(\"} \");\r\n\t\t\tn--;\r\n\t\t}\r\n\t\tprintf(\"\\n\");\r\n\t\tdepth--;\r\n\t}*/\r\n\r\n\tgCurrentAC = NULL;\r\n}\r\n\r\nvoid AbstractContainer::dumpInlineMethods(const char* prefix) {\r\n\tNameSpace* currSpace = this->m_pParent;\r\n\tconst char* className = concat2(prefix, getTemplateParams());\r\n\twhile(currSpace->getGenre() != EGENRE::_NAMESPACE) {\r\n\t\tcurrSpace = currSpace->m_pParent;\r\n\t}\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tconst char* pStrType = pVar->m_type->dumpTypeForCode(currSpace);\r\n\t\tconst char* name\t = pVar->m_name;\r\n\t\tbool isStatic\t= pVar->m_modifier & ATT_STATIC;\r\n\t\tbool isPtr\t\t= pVar->m_type->isGC_Able();\r\n\t\tbool isStruct;\t\r\n\t\tif (pVar->m_type->m_definitionAC) {\r\n\t\t\tisStruct = (pVar->m_type->m_definitionAC->m_modifier & ATT_STRUCT) != 0;\r\n\t\t} else {\r\n\t\t\tisStruct = false;\r\n\t\t}\r\n\r\n\t\tif(isStatic) {\r\n\t\t\tif(isStruct) {\r\n\t\t\t\ttab(); dumpTemplateLabel(); printf(\"inline %s %s::_s%s(%s _$value)\t\t{ return *(%s*)%s._RefSetValue(&_$value); }\\n\", pStrType, className , name, pStrType, pStrType, name);\r\n\t\t\t} else if(isPtr) {\r\n\t\t\t\ttab(); dumpTemplateLabel(); printf(\"inline %s %s::_s%s(%s _$value)\t\t{ return (%s)System::__GCObject::_RefSetValue((System::__GCObject**)&%s,_$value); }\\n\",pStrType, className, name, pStrType, pStrType, name);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (isPtr) {\r\n\t\t\ttab(); dumpTemplateLabel(); printf(\"inline \");\r\n\t\t\tprintf(\"%s %s::_s%s(%s _$value)  { return (%s)System::__GCObject::_RefSetValue((System::__GCObject**)&%s,_$value); }\\n\", pStrType, className, name, pStrType, pStrType, name);\r\n\t\t\ttab(); dumpTemplateLabel(); printf(\"inline \");\r\n\t\t\tprintf(\"%s %s::_s%s$(%s _$value) { CHCKTHIS; return _s%s(_$value); }\\n\", pStrType, className, name, pStrType, name);\r\n\t\t} else {\r\n\t\t\tif (isStruct) {\r\n\t\t\t\ttab(); dumpTemplateLabel(); printf(\"inline %s %s::_s%s(%s _$value)  { return *(%s*)%s._RefSetValue(&_$value); }\\n\", pStrType, className, name, pStrType, pStrType, name);\r\n\t\t\t\ttab(); dumpTemplateLabel(); printf(\"inline %s %s::_s%s$(%s _$value) { CHCKTHIS; return _s%s(_$value); }\\n\", pStrType, className , name, pStrType, name);\r\n\t\t\t} \r\n\t\t}\r\n\t}\r\n\r\n\tprintf(\"\\n\");\r\n\r\n\tif(this->m_modifier & ATT_STRUCT) {\r\n\t\t// GC Support for structures\r\n\t\ttab(); dumpTemplateLabel(); printf(\"inline u32 %s::_processGC() {\\n\", className);\r\n\t\tthis->generateMemberProcessGCCode();\r\n\t\ttab(); printf(\"}\\n\");\r\n\t\ttab(); dumpTemplateLabel(); printf(\"inline void %s::_releaseGC() {\\n\", className);\r\n\t\tthis->generateMemberReleaseGCCode();\r\n\t\ttab(); printf(\"}\\n\");\r\n\t\t\r\n\t\ttab(); dumpTemplateLabel(); printf(\"inline void* %s::_RefSetValue(void* newStruct) {\\n\", className);\r\n\t\tthis->generateMemberAssignCode();\r\n\t\tdepth++;\r\n\t\ttab(); (this->m_modifier & ATT_STRUCT) ? printf(\"return newStruct;\\n\") : printf(\"return newVal;\\n\");\r\n\t\tdepth--;\r\n\t\ttab(); printf(\"}\\n\");\r\n\r\n\t\t// void  = 0;\r\n\t\ttab(); dumpTemplateLabel(); printf(\"inline void %s::_moveAlert(u32 offset) {\\n\", className);\r\n\t\tthis->generateMemberMoveRefCode();\r\n\t\ttab(); printf(\"}\\n\");\r\n\r\n\t\ttab(); dumpTemplateLabel(); printf(\"inline %s& %s::__registerByRef(%s& m) {\\n\", className, className, className);\r\n\t\tthis->generateMemberRefCode(this);\r\n\t\tdepth++;\r\n\t\ttab(); printf(\"return m;\\n\");\r\n\t\tdepth--;\r\n\t\ttab(); printf(\"}\\n\");\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::dumpAccessors(const char* prefix) {\r\n\tbool isInterface = ((this->m_modifier & ATT_INTERFACE) != 0);\r\n\tbool isStruct\t = ((this->m_modifier & ATT_STRUCT) != 0);\r\n\r\n\tfor (int n=0; n < this->m_accessorCount; n++) {\r\n\t\tAccessor* pA = this->m_accessors[n];\r\n\t\tconst char* pStrType\t= pA->m_type->dumpTypeForCode(this->m_pParent);\r\n\t\tconst char* pName\t\t= pA->m_name ? pA->m_name : \"\";\r\n\t\tconst char* accType\t\t= pA->m_variable ? \"idx\" : \"acc\";\r\n\r\n\t\t// Create global dico + Add function parameters to dictionnary.\r\n\t\tif(!gCurrentSD) {\t//gCurrentSD is supposed to be always NULL at this point\r\n\t\t\tgCurrentSD = new SymbolDictionary();\r\n\t\t}\r\n\r\n\t\tbool isVirt\t\t = false;\r\n\t\tif ((this->m_modifier & ATT_INTERFACE)) {\r\n\t\t\t// Do nothing.\r\n\t\t} else {\r\n\t\t\tif (pA->m_modifier & ATT_STATIC) {\r\n\t\t\t\tisVirt = false;\r\n\t\t\t} else {\r\n\t\t\t\tisVirt = ((pA->m_modifier & ATT_VIRTUAL) != 0);\r\n\t\t\t\t// TODO : detect interface implementation -> generate virtual ? C++ consider even without rewriting virtual... should work as is.\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (pA->m_get) {\r\n\t\t\t\tif (!isInterface && ((pA->m_get->m_modifier & ATT_ABSTRACT)==0) && (pA->m_get->m_statement)) {\r\n\t\t\t\t\ttab();\r\n\t\t\t\t\t// Unsafe Getter\r\n\t\t\t\t\tprintf(\"%s %s %s::_%s_g%s(\",isVirt ? \"\" : \"inline\", pStrType, prefix, accType, pName); pA->dumpParams(false); printf(\")\");\r\n\t\t\t\t\tpA->m_get->m_statement->dumpStatement(); printf(\"\\n\");\r\n\t\t\t\t\tif ((pA->m_modifier & ATT_STATIC)==0) {\r\n\t\t\t\t\t\ttab(); printf(\"inline %s %s::_%s_g%s$(\",pStrType, prefix, accType, pName); pA->dumpParams(false);\r\n\t\t\t\t\t\tprintf(\") { CHCKTHIS; return _%s_g%s(\", accType, pName); pA->dumpParams(true); printf(\"); }\\n\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (pA->m_set) {\r\n\t\t\t\tif (!isInterface && ((pA->m_set->m_modifier & ATT_ABSTRACT)==0) && (pA->m_set->m_statement)) {\r\n\t\t\t\t\tVariable* pParameter = CreateVarInstance(\"value\");\r\n\t\t\t\t\tpParameter->setType(pA->m_type);\r\n\t\t\t\t\tgCurrentSD->addVariable(pParameter);\r\n\r\n\t\t\t\t\tbool\t\tisStatic\t= (pA->m_modifier & ATT_STATIC);\r\n\r\n\t\t\t\t\t// Unsafe Setter\r\n\t\t\t\t\ttab(); \r\n\t\t\t\t\tprintf(\"%s %s %s::_%s_s%s(\",isVirt ? \"\" : \"inline\",pStrType, prefix, accType, pName); pA->dumpParams(false, true); printf(\"%s value)\", pStrType); tab(); printf(\"{\\n\");\r\n\t\t\t\t\tgCurrentSD = gCurrentSD->addDictionary();\r\n\t\t\t\t\tdepth++;\r\n\t\t\t\t\ttab(); printf(\"%s _returnValue_ = value;\\n\", pStrType);\r\n\t\t\t\t\tpA->m_set->m_statement->m_pChild->dumpStatement();\r\n\t\t\t\t\ttab(); printf(\"return _returnValue_;\\n\");\r\n\t\t\t\t\tdepth--;\r\n\t\t\t\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t\t\t\t\ttab(); printf(\"}\\n\");\r\n\t\t\t\t\tif (!isStatic) {\r\n\t\t\t\t\t\ttab(); printf(\"inline %s %s::_%s_s%s$(\", pStrType, prefix, accType, pName);\r\n\t\t\t\t\t\tpA->dumpParams(false, true); printf(\"%s value)\t\t{ CHCKTHIS; return _%s_s%s(\", pStrType, accType, pName);\r\n\t\t\t\t\t\tpA->dumpParams(false, true); printf(\"value); }\\n\");\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t// Destroy dico + Remove variable/parameters from dictionnary.\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::dumpImplementation(const char* precNameSpace) {\r\n\t// If no dump set, do nothing.\r\n\tif (m_noDump) { return ; }\r\n\r\n\tif(m_csharpRepresentation) {\r\n\t\tm_csharpRepresentation->dumpImplementation(precNameSpace);\r\n\t\treturn;\r\n\t}\r\n\r\n\tbool isInterface = ((this->m_modifier & ATT_INTERFACE) != 0);\r\n\r\n\tchar prefix[1000];\r\n\tint strl = strlen(precNameSpace);\r\n\tif (strl) {\r\n\t\tsprintf(prefix,\"%s::%s\",precNameSpace,this->getName());\r\n\t} else {\r\n\t\tsprintf(prefix,\"%s\",this->getName());\r\n\t}\r\n\r\n\tconst char* className = concat2(prefix, getTemplateParams());\r\n\r\n\t// Delegates are unnested.\r\n\t//dumpDelegates(prefix, this);\r\n\r\n\t//\r\n\t// Common initializer.\r\n\t//\r\n\tif(!isInterface) {\r\n\t\tgIsStaticFunc = false;\r\n\t\ttab(); dumpTemplateLabel(); printf(\"void %s::_ctor_%s() {\\n\",className, this->getName());\r\n\t\tdepth++;\r\n\t\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\t\tVariable* pVar = this->m_members[n];\r\n\t\t\tif ((pVar->m_modifier & (ATT_CONST | ATT_STATIC)) == 0) {\r\n\t\t\t\tif (pVar->m_expression) {\r\n\t\t\t\t\tif(pVar->m_type->isGC_Able()) {\r\n\t\t\t\t\t\ttab(); printf(\"_s%s(\", pVar->m_name);\r\n\t\t\t\t\t\tExpression::analysisTransformAndDump(&pVar->m_expression, pVar->m_type);\r\n\t\t\t\t\t\tprintf(\");\\n\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttab(); printf(\"%s = \",pVar->m_name);\r\n\t\t\t\t\t\tExpression::analysisTransformAndDump(&pVar->m_expression, pVar->m_type);\r\n\t\t\t\t\t\tprintf(\";\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tdepth--;\r\n\t\ttab(); printf(\"}\\n\\n\");\r\n\t}\r\n\r\n\t//\r\n\t// Dump all functions.\r\n\t//\r\n\tgCurrentAC = this;\r\n\r\n\tfor (int m=0; m < this->m_methodCount; m++) {\r\n\t\tMethod* pMethod = this->m_methods[m];\r\n\t\tgCurrentMethod = pMethod;\r\n\t\tif ((pMethod->m_modifier & ATT_DTOR) != 0) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\t// Create global dico + Add function parameters to dictionnary.\r\n\t\tif(!gCurrentSD) {\t//gCurrentSD is supposed to be always NULL at this point\r\n\t\t\tgCurrentSD = new SymbolDictionary();\r\n\t\t}\r\n\r\n\t\tg_unsafe = ((pMethod->m_modifier & ATT_UNSAFE) != 0);\r\n\t\tgIsStaticFunc = (pMethod->m_modifier & ATT_STATIC) != 0;\r\n\r\n\t\tif (pMethod->m_modifier & ATT_VIRTUAL)\t{\ttab(); printf(\"/*virtual*/\\n\");\t\t}\r\n\t\tif (pMethod->m_modifier & ATT_STATIC)\t{\ttab(); printf(\"/*static*/\\n\");\t\t}\r\n\r\n\t\tconst char* extensionA = \"\";\r\n\t\tconst char* extensionB = \"\";\r\n\r\n\t\tif (pMethod->m_modifier & ATT_EXTERN)\t{ extensionA = \"_ext_\"; }\r\n\t\tif (pMethod->m_referenceModifCount)\t\t{ extensionB = \"_ref_\"; }\r\n\r\n\t\tif ((pMethod->m_modifier & ATT_ABSTRACT) == 0 && !isInterface) {\r\n\t\t\ttab();\r\n\t\t\tdumpTemplateLabel();\r\n\t\t\tpMethod->dumpTemplateLabel();\r\n\t\t\tif (pMethod->m_modifier & ATT_CTOR) {\r\n\t\t\t\t// No return type.\r\n\t\t\t} else {\r\n\t\t\t\tprintf(pMethod->m_returnType->dumpTypeForCode(this->m_pParent)); printf(\" \");\r\n\t\t\t}\r\n\r\n\t\t\tprintf(\"%s::%s%s%s(\", className, extensionA, extensionB,pMethod->getName());\r\n\r\n\t\t\tVariable* pParameter = pMethod->m_parameters;\r\n\t\t\tbool first = true;\r\n\t\t\twhile(pParameter) {\r\n\t\t\t\t// Register variable as local symbols for code.\r\n\t\t\t\tgCurrentSD->addVariable(pParameter);\r\n\r\n\t\t\t\t// Dump function parameters\r\n\t\t\t\tif (first) { first = false; } else { printf(\",\"); }\r\n\t\t\t\tprintf(pParameter->m_type->dumpTypeForCode(this));\r\n\t\t\t\tif (pParameter->m_modifier & ATT_REF) { printf(\"&\"); }\r\n\t\t\t\tprintf(\" \");\r\n\t\t\t\tprintf(pParameter->m_name);\r\n\r\n\t\t\t\tpParameter = pParameter->m_pNextVariable;\r\n\t\t\t}\r\n\t\t\tprintf(\")\");\r\n\r\n\t\t\tgIsStaticFunc = false;\r\n\t\t\tif (pMethod->m_modifier & ATT_CTOR) {\r\n\t\t\t\tif (pMethod->m_initializerType >= 0) {\t// -1 is none.\r\n\t\t\t\t\t// For now only accept BASE, and if pointer is not NULL -> Obvious call.\r\n\t\t\t\t\tconst char* name = this->getAncestor()->getFullName(this);\r\n\t\t\t\t\tprintf(\" : %s(\",name);\r\n\t\t\t\t\tif (pMethod->m_initializerOpt) {\r\n\t\t\t\t\t\tpMethod->m_initializerOpt->dumpExpression();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tprintf(\")\\n\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprintf(\"\\n\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttab(); printf(\"{\\n\");\r\n\t\t\t\tdepth++;\r\n\t\t\t\ttab(); printf(\"_ctor_%s%s();\\n\", this->getName(), getTemplateParams());\r\n\t\t\t\r\n\t\t\t\tif (this->m_modifier & ATTRB_ANONDELEGATE) {\r\n\t\t\t\t\t// Constructor of anonymous delegate : copy parameter to member.\r\n\t\t\t\t\tVariable* pParameter = pMethod->m_parameters;\r\n\t\t\t\t\twhile(pParameter) {\r\n\t\t\t\t\t\tif(pParameter->m_type->isGC_Able()) {\r\n\t\t\t\t\t\t\ttab(); printf(\"_s%s(%s);\\n\", pParameter->m_name, pParameter->m_name);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ttab(); printf(\"%s = %s;\\n\", pParameter->m_name, pParameter->m_name);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpParameter = pParameter->m_pNextVariable;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(pMethod->m_codeBlock && pMethod->m_codeBlock->m_statementType == STM_BLOCK) {\r\n\t\t\t\t\tpMethod->m_codeBlock->m_pChild->dumpStatement();\r\n\t\t\t\t\tdepth--;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tdepth--;\r\n\t\t\t\t\tpMethod->m_codeBlock->dumpStatement();\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttab(); printf(\"}\\n\");\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"\\n\");\r\n\r\n\t\t\t\tif (pMethod->m_codeBlock) {\r\n\t\t\t\t\tpMethod->m_codeBlock->dumpStatement();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (pMethod->m_modifier & ATT_EXTERN) {\r\n\t\t\t\t\t\tpMethod->dumpMarshalling();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintf(\"\\n\");\r\n\t\t}\r\n\r\n\t\t// Dump Wrapper\r\n\r\n\t\tif ((pMethod->m_modifier & ATT_STATIC) == 0) {\r\n\t\t\tif ((pMethod->m_modifier & (ATT_CTOR | ATT_DTOR)) == 0) {\r\n\t\t\t\ttab();\r\n\t\t\t\tpMethod->dumpTemplateLabel();\r\n\t\t\t\tprintf(\"inline \");\r\n\t\t\t\tprintf(pMethod->m_returnType->dumpTypeForCode(this->m_pParent)); printf(\" \"); printf(\"%s::%s\",className, pMethod->getName()); printf(\"$(\");\r\n\t\t\t\t\r\n\t\t\t\tpMethod->dumpParamsDef();\r\n\r\n\t\t\t\tif (pMethod->m_returnType) {\r\n\t\t\t\t\tprintf(\") { CHCKTHIS; return %s%s(\", pMethod->getName(), pMethod->getTemplateParams());\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprintf(\") { CHCKTHIS; %s%s(\", pMethod->getName(), pMethod->getTemplateParams());\r\n\t\t\t\t}\r\n\r\n\t\t\t\tVariable* pVar = pMethod->m_parameters;\r\n\t\t\t\tbool first = true;\r\n\t\t\t\twhile (pVar) {\r\n\t\t\t\t\tif (first) { first = false; } else { printf(\",\"); }\r\n\t\t\t\t\tprintf(pVar->getName());\r\n\t\t\t\t\tpVar = pVar->m_pNextVariable;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tprintf(\"); }\\n\\n\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Wrapper for corrected reference counting for the GC.\r\n\t\t//\r\n\t\tif (pMethod->m_referenceModifCount) {\r\n\t\t\ttab();\r\n\t\t\tprintf(\"inline \");\r\n\t\t\tprintf(pMethod->m_returnType->dumpTypeForCode(this)); printf(\" \"); printf(\"%s::%s\",className, pMethod->getName()); printf(\"(\");\r\n\t\t\t\t\r\n\t\t\tpMethod->dumpParamsDef();\r\n\r\n\t\t\tif (pMethod->m_returnType->m_typeID == TYPE_VOID) {\r\n\t\t\t\tprintf(\") { System::RefHolder _cs_refholder_loc_array[%i]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); %s_ref_%s(\", pMethod->m_referenceModifCount, extensionA, pMethod->getName());\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\") { System::RefHolder _cs_refholder_loc_array[%i]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); %s r = %s_ref_%s(\", pMethod->m_referenceModifCount, pMethod->m_returnType->dumpTypeForCode(this), extensionA, pMethod->getName());\r\n\t\t\t}\r\n\r\n\t\t\tVariable* pVar = pMethod->m_parameters;\r\n\t\t\tbool first = true;\r\n\t\t\twhile (pVar) {\r\n\t\t\t\tif (first) { first = false; } else { printf(\",\"); }\r\n\t\t\t\tprintf(pVar->getName());\r\n\t\t\t\tpVar = pVar->m_pNextVariable;\r\n\t\t\t}\r\n\r\n\t\t\tif (pMethod->m_returnType->m_typeID == TYPE_VOID) {\r\n\t\t\t\tprintf(\"); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); }\\n\\n\");\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\\n\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Destroy dico + Remove variable/parameters from dictionnary.\r\n\t\tgCurrentSD = gCurrentSD->removeDictionary();\r\n\t}\r\n\tgCurrentMethod = NULL;\r\n\r\n\tif(!isInterface) {\r\n\t\tif (this->m_bCreateDefaultCtor) {\r\n\t\t\t// No default constructor existed, so we implement one.\r\n\t\t\ttab();\r\n\t\t\tdumpTemplateLabel();\r\n\t\t\tprintf(\"%s::%s() { _ctor_%s(); }\\n\\n\",prefix,getName(),getName());\r\n\t\t}\r\n\r\n\t\tdumpInlineMethods(prefix);\r\n\t\tprintf(\"\\n\");\r\n\t\tdumpAccessors(prefix);\r\n\r\n\t\tif (this->m_modifier & ATT_CLASS) {\r\n\t\t\ttab(); printf(\"/*virtual*/\\n\");\r\n\t\t\ttab(); dumpTemplateLabel(); printf(\"bool %s::_isInstanceOf(u32 typeID) {\\n\", className);\r\n\t\t\ttab(); printf(\"\\t_INSTANCEOF(%s,%s);\\n\",getName(), this->getAncestor() ? this->getAncestor()->m_definitionAC->getFullName(this) : \"System::Object\");\r\n\t\t\ttab(); printf(\"}\\n\\n\");\r\n\r\n\t\t\t//\r\n\t\t\t// GC Support\r\n\t\t\t//\r\n\r\n\t\t\ttab(); printf(\"/*virtual*/\\n\");\r\n\t\t\ttab(); dumpTemplateLabel(); printf(\"u32 %s::_processGC() {\\n\", className);\r\n\t\t\tthis->generateMemberProcessGCCode();\r\n\t\t\ttab(); printf(\"}\\n\");\r\n\r\n\r\n\t\t\ttab(); printf(\"/*virtual*/\\n\");\r\n\t\t\ttab(); dumpTemplateLabel(); printf(\"void %s::_releaseGC() {\\n\", className);\r\n\t\t\tthis->generateMemberReleaseGCCode();\r\n\t\t\ttab(); printf(\"}\\n\");\r\n\r\n\t\t\ttab(); printf(\"/*virtual*/\\n\");\r\n\t\t\ttab(); dumpTemplateLabel(); printf(\"void %s::_moveAlert(u32 offset) {\\n\", className);\r\n\t\t\tthis->generateMemberMoveRefCode();\r\n\t\t\ttab(); printf(\"}\\n\");\r\n\t\t}\r\n\t}\r\n\r\n\t// Sub Classes which are still nested (anonymous delegates)\r\n\tfor (int n=0; n < this->m_innerCount; n++) {\r\n\t\tif((m_pInner[n]->m_modifier & ATTRB_ANONDELEGATE) != 0) {\r\n\t\t\tthis->m_pInner[n]->dumpImplementation(prefix);\r\n\t\t}\r\n\t}\r\n\r\n\tgCurrentAC = NULL;\r\n}\r\n\r\nvoid AbstractContainer::dumpMarshalledStruct(Variable* pVar) {\r\n\tif(!(m_modifier & ATT_STRUCT)) {\r\n\t\tcompilerError(ERR_INTERNAL, \"dumpMarshalledStruct() called on a class\");\r\n\t}\r\n\tif(!(pVar->m_modifier & (ATT_REF | ATT_OUT))) {\r\n\t\tcompilerError(ERR_USER, \"Please pass structures to extern functions via references only\", pVar->m_line);\r\n\t}\r\n\tAttribute* pAtt = m_attribute;\r\n\tif(!pAtt) {\r\n\t\tcompilerError(ERR_USER, \"Please use attributes for structure marshalling\", m_line);\r\n\t}\r\n\telse {\r\n\t\tSMarshallingInfo info;\r\n\t\tpAtt->getMarshallingInfo(info);\r\n\t\tSStructInfo sInfo = info.m_structInfo;\r\n\t\tif(sInfo.m_layoutKind == 0 && sInfo.m_pack == 1) {\r\n\t\t\t// TODO : proper marshalling\r\n\t\t\tprintf(pVar->m_name);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Only StructLayout(LayoutKind.Sequential, Pack = 1) is supported for now\", m_line);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid AbstractContainer::generateMemberProcessGCCode() {\r\n\tdepth++;\r\n\tif (this->getAncestor()) {\r\n\t\ttab();printf(\"%s::_processGC();\\n\\n\", this->getAncestor()->m_definitionAC->getFullName(this)); // TODO : verify if ancestor different package.\r\n\t}\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tif ((pVar->m_modifier & ATT_STATIC)==0) {\r\n\t\t\tSRSymbol sym = pVar->m_type->getResolvedType(this);\r\n\t\t\tswitch (sym.symbolType) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t{\r\n\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sym.pSymbol;\r\n\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\ttab(); GCSupport::dumpStructGC(pVar, pCnt);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\t\t\t\t\ttab(); GCSupport::dumpMemberGC(pVar);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\ttab(); GCSupport::dumpMemberGC(pVar);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\ttab(); printf(\"return System::__GCObject::COMPLETE;\\n\");\r\n\tdepth--;\r\n}\r\n\r\nvoid AbstractContainer::generateMemberReleaseGCCode() {\r\n\tdepth++;\r\n\tif (this->getAncestor()) {\r\n\t\ttab();printf(\"%s::_releaseGC();\\n\\n\", this->getAncestor()->m_definitionAC->getFullName(this)); // TODO : verify if ancestor different package.\r\n\t}\r\n\tMethod* pDtor = findDestructor();\r\n\tif(pDtor) {\r\n\t\tStatement* pCode = pDtor->m_codeBlock;\r\n\t\tif(pCode && pCode->m_statementType == STM_BLOCK) {\r\n\t\t\tpCode->m_pChild->dumpStatement();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tpCode->dumpStatement();\r\n\t\t}\r\n\t}\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tif ((pVar->m_modifier & ATT_STATIC)==0) {\r\n\t\t\tSRSymbol sym = pVar->m_type->getResolvedType(this);\r\n\t\t\tswitch (sym.symbolType) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t{\r\n\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sym.pSymbol;\r\n\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\ttab(); GCSupport::structReleaseGC(pVar, pCnt);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\t\t\t\t\ttab(); GCSupport::memberReleaseGC(pVar);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\ttab(); GCSupport::memberReleaseGC(pVar);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tdepth--;\r\n}\r\n\r\n\r\nvoid AbstractContainer::generateMemberMoveRefCode() {\r\n\tdepth++;\r\n\tif (this->getAncestor()) {\r\n\t\ttab();printf(\"%s::_moveAlert(offset);\\n\\n\", this->getAncestor()->m_definitionAC->getFullName(this)); // TODO : verify if ancestor different package.\r\n\t}\r\n\tbool isFirstTime = true;\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tif ((pVar->m_modifier & ATT_STATIC)==0) {\r\n\t\t\tSRSymbol sym = pVar->m_type->getResolvedType(this);\r\n\t\t\tswitch (sym.symbolType) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t{\r\n\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sym.pSymbol;\r\n\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\t// StructC::_RefSetValue(newVal.m_C);\r\n\t\t\t\t\t\ttab(); printf(\"%s._moveAlert(offset);\\n\",pVar->m_name);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\t\t\t\t\tif(isFirstTime) {\r\n\t\t\t\t\t\t\t\ttab(); printf(\"u8* oldPtr; u8* newPtr;\\n\");\r\n\t\t\t\t\t\t\t\tisFirstTime = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttab(); printf(\"if (%s) {\\n\",pVar->m_name);\r\n\t\t\t\t\t\t\ttab(); printf(\"  newPtr = (u8*)(&%s); oldPtr = newPtr - offset;\\n\",pVar->m_name);\r\n\t\t\t\t\t\t\ttab(); printf(\"  %s->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\\n\",pVar->m_name);\r\n\t\t\t\t\t\t\ttab(); printf(\"}\\n\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\t{\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\tif(isFirstTime) {\r\n\t\t\t\t\ttab(); printf(\"u8* oldPtr; u8* newPtr;\\n\");\r\n\t\t\t\t\tisFirstTime = false;\r\n\t\t\t\t}\r\n\t\t\t\ttab(); printf(\"if (%s) {\\n\",pVar->m_name);\r\n\t\t\t\ttab(); printf(\"  newPtr = (u8*)(&%s); oldPtr = newPtr - offset;\\n\",pVar->m_name);\r\n\t\t\t\ttab(); printf(\"  %s->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\\n\",pVar->m_name);\r\n\t\t\t\ttab(); printf(\"}\\n\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tdepth--;\r\n}\r\n\r\n\r\nvoid AbstractContainer::generateMemberAssignCode() {\r\n\tdepth++;\r\n\tbool isStruct = (this->m_modifier & ATT_STRUCT) != 0;\r\n\tif(isStruct) {\r\n\t\ttab(); printf(\"%s* pStruct = (%s*)newStruct;\\n\", this->getName(), this->getName());\r\n\t}\r\n\tconst char* newName = isStruct ? \"pStruct->\" : \"newVal.\";\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tif ((pVar->m_modifier & ATT_STATIC)==0) {\r\n\t\t\tSRSymbol sym = pVar->m_type->getResolvedType(this);\r\n\t\t\tswitch (sym.symbolType) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t{\r\n\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sym.pSymbol;\r\n\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\ttab(); printf(\"this->%s._RefSetValue(&%s%s);\\n\",pVar->m_name, newName, pVar->m_name);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\t\t\t\t\t// _RefSetValue(this->m_B, newVal.m_B);\r\n\t\t\t\t\t\t\ttab(); printf(\"System::__GCObject::_RefSetValue((System::__GCObject**)&this->%s,%s%s);\\n\",pVar->m_name, newName, pVar->m_name);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ttab(); printf(\"this->%s = %s%s;\\n\",pVar->m_name, newName, pVar->m_name);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\t{\r\n\t\t\t\t\ttab(); printf(\"this->%s = %s%s;\\n\",pVar->m_name, newName, pVar->m_name);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\ttab(); printf(\"System::__GCObject::_RefSetValue((System::__GCObject**)&this->%s,%s%s);\\n\",pVar->m_name, newName, pVar->m_name);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tdepth--;\r\n}\r\n\r\nvoid AbstractContainer::generateMemberRefCode(AbstractContainer* pCtx) {\r\n\tdepth++;\r\n\tfor (int n=0; n < this->m_memberCount; n++) {\r\n\t\tVariable* pVar = this->m_members[n];\r\n\t\tif ((pVar->m_modifier & ATT_STATIC)==0) {\r\n\t\t\tSRSymbol sym = pVar->m_type->getResolvedType(this);\r\n\t\t\tswitch (sym.symbolType) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t{\r\n\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)sym.pSymbol;\r\n\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\t// StructC::_RefSetValue(newVal.m_C);\r\n\t\t\t\t\t\ttab(); printf(\"%s::__registerByRef(m.%s);\\n\",pCnt->getFullName(pCtx), pVar->m_name);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (pVar->m_type->isGC_Able()) {\r\n\t\t\t\t\t\t\t// _RefSetValue(this->m_B, newVal.m_B);\r\n\t\t\t\t\t\t\ttab(); printf(\"System::__GCObject::__registerByRef((System::__GCObject*&)m.%s);\\n\",pVar->m_name);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\t{\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\ttab(); printf(\"System::__GCObject::__registerByRef((System::__GCObject*&)m.%s);\\n\",pVar->m_name);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tdepth--;\r\n}\r\n\r\nconst char* AbstractContainer::generateTypeID() {\r\n\tchar buf[16];\r\n\tsprintf(buf, \"%s | %i\", ((m_modifier & ATT_STRUCT) == 0) ? \"ET_CLASS\" : \"ET_STRUCT\" , m_uniqueId);\r\n\treturn concat(buf);\r\n}\r\n\r\n//Transforms a a::b::c string into a_b_c to be used as a label (deprecated)\r\n/*\r\nconst char* labelize(const char* str)\r\n{\r\n\tif(str)\r\n\t{\r\n\t\tchar buf[100];\r\n\t\tint i = 0;\r\n\t\tint j = 0;\r\n\t\twhile(str[i])\r\n\t\t{\r\n\t\t\tif(str[i]==':')\r\n\t\t\t{\r\n\t\t\t\tif(str[++i]==':')\r\n\t\t\t\t{\r\n\t\t\t\t\tbuf[j] = '_';\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Invalid string : uses \\\":\\\" instead of \\\"::\\\"\");\r\n\t\t\t\t\treturn NULL;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tbuf[j] = str[i];\r\n\t\t\t}\r\n\t\t\ti++;\r\n\t\t\tj++;\r\n\t\t}\r\n\t\tbuf[j] = 0;\r\n\t\treturn strdup(buf);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tcompilerError(ERR_INTERNAL, \"Null string\");\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n*/\r\n\r\n\r\nvoid dumpSafeWrapper(const char* pName, const char* pStrType, const char* wrapperName, bool isStatic, bool isUnary, bool isEnum, bool isNativePtr)\r\n{\r\n\tconst char* typedParam;\r\n\tif(isUnary) {\r\n\t\ttypedParam = \"\";\r\n\t} else if(isEnum || isNativePtr) {\r\n\t\ttypedParam = \"s32 value\";\r\n\t} else {\r\n\t\ttypedParam = concat2(pStrType, \" value\");\r\n\t}\r\n\tconst char* param = isUnary ? \"\" : \"value\";\r\n\tif(!isStatic) {\r\n\t\ttab(); printf(\"inline %s _acc_s%s$%s(%s)\t\t\t{ CHCKTHIS; return _acc_s%s%s(%s); }\\n\", \r\n\t\t\t\t\t\tpStrType, pName, wrapperName, typedParam, pName, wrapperName, param);\r\n\t}\r\n}\r\n\r\nvoid dumpAccessorWrapper(EnumExpressionType type, const char* pName, const char* pStrType, bool isNonNum, const char* testDiv, bool isEnum, bool isStatic, bool isNativePtr)\r\n{\r\n\tconst char* modifier = isStatic ? \"static inline\" : \"inline\";\r\n\r\n\tswitch(type) {\r\n\tcase EXPR_ASS_EQ :\r\n\t\tcompilerError(ERR_INTERNAL, \"The dumpAccessorWrapper() function cannot be used to dump simple assignment wrappers\");\r\n\t\tbreak;\r\n\tcase EXPR_PLUSPLUS :\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spostInc()\t\t\t{ %s tmp = _acc_g%s(); _acc_s%s((%s)((s32)tmp + 1)); return tmp; }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName, pStrType);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spostInc()\t\t\t{ %s tmp; _acc_s%s((tmp = _acc_g%s())+1); return tmp; }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"postInc\", isStatic, true, isEnum, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_MINUSMINUS :\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spostDec()\t\t\t{ %s tmp = _acc_g%s(); _acc_s%s((%s)((s32)tmp - 1)); return tmp; }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName, pStrType);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spostDec()\t\t\t{ %s tmp; _acc_s%s((tmp = _acc_g%s())-1); return tmp; }\\n\",\r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"postDec\", isStatic, true, isEnum, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_PREINCR :\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spreInc()\t\t\t{ return _acc_s%s((%s)((s32)_acc_g%s()+1)); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pName, pStrType, pName);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spreInc()\t\t\t{ return _acc_s%s(_acc_g%s()+1); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"preInc\", isStatic, true, isEnum, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_PREDECR :\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spreDec()\t\t\t{ return _acc_s%s((%s)((s32)_acc_g%s()-1)); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pName, pStrType, pName);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%spreDec()\t\t\t{ return _acc_s%s(_acc_g%s()-1); }\\n\",\r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"preDec\", isStatic, true, isEnum, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_PLUSEQ :\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sAddEq(s32 value)\t{ return _acc_s%s((%s)((s32)_acc_g%s() + value)); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pName, pStrType, pName);\r\n\t\t}\r\n\t\telse if(isNativePtr) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sAddEq(s32 value)\t{ return _acc_s%s(_acc_g%s() + value); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pName, pName);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sAddEq(%s value)\t{ return _acc_s%s(_acc_g%s() + value); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"AddEq\", isStatic, false, isEnum, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_MINUSEQ :\r\n\t\tif(isEnum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sSubEq(s32 value)\t{ return _acc_s%s((%s)((s32)_acc_g%s() - value)); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pName, pStrType, pName);\r\n\t\t} else if(isNativePtr) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sSubEq(s32 value)\t{ return _acc_s%s(_acc_g%s() - value); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pName, pName);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sSubEq(%s value)\t{ return _acc_s%s(_acc_g%s() - value); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"SubEq\", isStatic, false, isEnum, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_STAREQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sMulEq(%s value)\t{ return _acc_s%s(_acc_g%s() * value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"MulEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_DIVEQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sDivEq(%s value)\t{ %sreturn _acc_s%s(_acc_g%s() / value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, testDiv , pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"DivEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_MODEQ :\r\n\t\tif (isNonNum) {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sModEq(%s value)\t{ %sreturn _acc_s%s(_acc_g%s() %% value); }\\n\", \r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, testDiv , pName, pName);\r\n\t\t} else {\r\n\t\t\ttab(); printf(\"%s %s _acc_s%sModEq(%s value)\t{ %s %s orig = _acc_g%s(); s32 tmp = (s32)(orig / value); return _acc_s%s(orig - (tmp * value)); }\\n\",\r\n\t\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, testDiv , pStrType, pName, pName);\r\n\t\t}\r\n\t\tdumpSafeWrapper(pName, pStrType, \"ModEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_XOREQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sXorEq(%s value)\t{ return _acc_s%s(_acc_g%s() ^ value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"XorEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_ANDEQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sAndEq(%s value)\t{ return _acc_s%s(_acc_g%s() & value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"AndEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_OREQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sOrEq(%s value)\t\t{ return _acc_s%s(_acc_g%s() | value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"OrEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_RSHFTEQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sRShiftEq(%s value)\t{ return _acc_s%s(_acc_g%s() >> value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"RShiftEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tcase EXPR_ASS_LSHFTEQ :\r\n\t\ttab(); printf(\"%s %s _acc_s%sLShiftEq(%s value)\t{ return _acc_s%s(_acc_g%s() << value); }\\n\", \r\n\t\t\t\t\t\tmodifier, pStrType, pName, pStrType, pName, pName);\r\n\t\tdumpSafeWrapper(pName, pStrType, \"LShiftEq\", isStatic, false, false, isNativePtr);\r\n\t\tbreak;\r\n\tdefault :\r\n\t\tcompilerError(ERR_INTERNAL, \"Unknown assignment expression\");\r\n\t}\r\n}\r\n\r\nvoid dumpAccessorWrappers(const char* pName, const char* pStrType, bool isNonNum, const char* testDiv, bool isEnum, bool isStatic, bool isNativePtr)\r\n{\r\n\tif(!isNativePtr) {\r\n\t\tdumpAccessorWrapper(EXPR_PLUSPLUS, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\tdumpAccessorWrapper(EXPR_MINUSMINUS, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\tdumpAccessorWrapper(EXPR_PREINCR, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\tdumpAccessorWrapper(EXPR_PREDECR, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t}\r\n\r\n\tdumpAccessorWrapper(EXPR_ASS_PLUSEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\tdumpAccessorWrapper(EXPR_ASS_MINUSEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\r\n\tif(!isEnum && !isNativePtr) {\r\n\t\tdumpAccessorWrapper(EXPR_ASS_STAREQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\tdumpAccessorWrapper(EXPR_ASS_DIVEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\tdumpAccessorWrapper(EXPR_ASS_MODEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\tif(isNonNum) {\r\n\t\t\tdumpAccessorWrapper(EXPR_ASS_XOREQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\t\tdumpAccessorWrapper(EXPR_ASS_ANDEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\t\tdumpAccessorWrapper(EXPR_ASS_OREQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\t\tdumpAccessorWrapper(EXPR_ASS_RSHFTEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\t\tdumpAccessorWrapper(EXPR_ASS_LSHFTEQ, pName, pStrType, isNonNum, testDiv, isEnum, isStatic, isNativePtr);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid dumpGlobalInitializerPrototype() {\r\n\tSInitialization* p = gGlobalInitList;\r\n\twhile (p) {\r\n\t\tif(p->m_isDumped) {\r\n\t\t\tif ((p->m_mode == SInitialization::INIT_WRAP_FUNC) || (p->m_mode == SInitialization::INIT_MEMCPY)) {\r\n\t\t\t\ttab(); printf(\"void* _global_array_initializer_%i(void* array_);\\n\",p->m_expressionCounter);\r\n\t\t\t}\r\n\t\t}\r\n\t\tp = p->m_next;\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\n// = MemCpy\r\n// EXPR_CTE\r\n// EXPR_NULL\r\n\r\n// = Chaining for now.\r\n// \r\n//\r\n\r\nvoid dumpGlobalInitializerImplementation() {\r\n\t//\r\n\t// TODO support also : _array_->_setChain(idx, value)->_setChain(idx,value)->...\r\n\t// TODO optimize complete static array with memcpy.\r\n\t//\r\n\tSInitialization* p = gGlobalInitList;\r\n\twhile (p) {\r\n\t\tif(p->m_isDumped) {\r\n\t\t\tif ((p->m_mode == SInitialization::INIT_WRAP_FUNC) || (p->m_mode == SInitialization::INIT_MEMCPY)) {\r\n\t\t\t\ttab(); printf(\"void* _global_array_initializer_%i(void* array_) {\\n\",p->m_expressionCounter);\r\n\t\t\t\tdepth++;\r\n\t\t\t\tconst char* type = p->m_typeArray->dumpTypeForCode(gRootNameSpace);\r\n\t\t\t\ttab(); printf(\"%s _array = (%s)array_;\\n\\n\",type,type);\r\n\r\n\t\t\t\tif (p->m_mode == SInitialization::INIT_WRAP_FUNC) {\r\n\t\t\t\t\tfor (int n=0; n < p->m_expression->m_expressionCount; n++) {\r\n\t\t\t\t\t\ttab();printf(\"_array->_idx_s(%i,\",n);\r\n\t\t\t\t\t\tp->m_expression->m_expressions[n]->dumpExpressionInternal();\r\n\t\t\t\t\t\tprintf(\");\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (p->m_mode == SInitialization::INIT_MEMCPY) {\r\n\t\t\t\t\ttab();printf(\"static const %s _arrayCTE[] = {\",p->m_typeArray->m_originalType->dumpTypeForCode(gRootNameSpace));\r\n\t\t\t\t\tfor (int n=0; n < p->m_expression->m_expressionCount; n++) {\r\n\t\t\t\t\t\tif (n != 0) { printf(\",\"); }\r\n\t\t\t\t\t\tp->m_expression->m_expressions[n]->dumpExpressionInternal();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tprintf(\"};\\n\");\r\n\t\t\t\t\ttab();printf(\"_array->_setMemCpy(_arrayCTE);\\n\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttab(); printf(\"return array_;\\n\");\r\n\t\t\t\tdepth--;\r\n\t\t\t\ttab(); printf(\"}\\n\",p->m_expressionCounter);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tp = p->m_next;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Expression.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nExpression::Expression()\r\n:m_expressionCount\t(0)\r\n,m_expressions\t\t(NULL)\r\n,m_hasParenthesis\t(false)\r\n,m_typeParam\t\t(NULL)\r\n,m_runtimeType\t\t(NULL)\r\n,m_text\t\t\t\t(NULL)\r\n,m_arrayNew\t\t\t(false)\r\n,m_rank\t\t\t\t(0)\r\n,m_isAssignmentSide\t(NULL)\r\n,m_quals\t\t\t(NULL)\r\n,wrapStringStart\t(false)\r\n,wrapStringEnd\t\t(false)\r\n,m_bSkip\t\t\t(false)\r\n,m_delegateCode\t\t(NULL)\r\n,m_delegateSignature(NULL)\r\n,m_anonymousClass\t(NULL)\r\n,m_delegateDef\t\t(NULL)\r\n,m_initializerInfo\t(NULL)\r\n,m_genericCall\t\t(NULL)\r\n,m_asRef\t\t\t(false)\r\n,m_isInvoked\t\t(false)\r\n,m_isDotRoot\t\t(true)\r\n{\r\n\tm_value.type\t= TYPE_UNRESOLVED;\r\n\tm_line\t\t\t= yylineno;\r\n}\r\n\r\nbool Expression::isConstant()\r\n{\r\n\tif (this->m_expressionType == EXPR_CTE) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nExpression* Expression::patchSubInvoke() {\r\n\tm_expressions[0]->m_isInvoked = true;\r\n\treturn this;\r\n}\r\n\r\nSValue Expression::getValue()\r\n{\r\n\treturn this->m_value;\r\n}\r\n\r\nvoid Expression::inverseValue() {\r\n\tswitch(m_value.type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\tcase TYPE_STRING:\r\n\t\tcase TYPE_NULL: \r\n\t\tcase TYPE_UINT:\r\n\t\tcase TYPE_ULONG:\r\n\t\tcase TYPE_CHAR:\r\n\t\t\t// Do nothing\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tm_value.v.d = -m_value.v.d;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tm_value.v.f = -m_value.v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tm_value.v.i = -m_value.v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tm_value.v.l = -m_value.v.l;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Unknown constant type\", m_line);\r\n\t}\r\n}\r\n\r\nbool Expression::compareValues(Expression* exp)\r\n{\r\n\tif(!isConstant() || !exp->isConstant()) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Can only compare values of constant expressions\", exp->m_line);\r\n\t\treturn false;\r\n\t}\r\n\tswitch(m_value.type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\treturn m_value.v.i == exp->m_value.v.i;\r\n\t\tcase TYPE_STRING:\r\n\t\t\treturn (strcmp(m_value.v.str,exp->m_value.v.str)==0);\r\n\t\tcase TYPE_NULL: \r\n\t\t\treturn m_value.v.ptr == exp->m_value.v.ptr;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\treturn m_value.v.d == exp->m_value.v.d;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\treturn m_value.v.f == exp->m_value.v.f;\r\n\t\tcase TYPE_INT:\r\n\t\t\treturn m_value.v.i == exp->m_value.v.i;\r\n\t\tcase TYPE_UINT:\r\n\t\t\treturn m_value.v.ui == exp->m_value.v.ui;\r\n\t\tcase TYPE_LONG:\r\n\t\t\treturn m_value.v.l == exp->m_value.v.l;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\treturn m_value.v.ul == exp->m_value.v.ul;\r\n\t\tcase TYPE_CHAR:\r\n\t\t\treturn m_value.v.i == exp->m_value.v.i;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Unknown constant type\", exp->m_line);\r\n\t\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool Expression::isAmbiguous() {\r\n\tif(this == NULL) {\r\n\t\treturn false;\r\n\t}\r\n\tfor(int n = 0 ; n < m_expressionCount ; n++) {\r\n\t\tif(!m_expressions[n]->m_runtimeType) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(m_expressions[n]->m_runtimeType->m_res.symbolType == EGENRE::_METHODLIST) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool Expression::isMethodAsDelegate() {\r\n\treturn (m_item.symbolType == EGENRE::_METHOD && m_expressionType != EXPR_INVOKE);\r\n}\r\n\r\nvoid Expression::getStructInfo(SStructInfo& out_structInfo) {\r\n\tif(m_expressionType != EXPR_LIST) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Parameter list expected\", m_line);\r\n\t}\r\n\tfor(int n = 0; n < m_expressionCount ; n++) {\r\n\t\tExpression* pExpr = m_expressions[n];\r\n\t\tswitch(pExpr->m_expressionType) {\r\n\t\tcase EXPR_DOT :\r\n\t\t\tif(strcmp(pExpr->m_expressions[0]->m_text, \"LayoutKind\") != 0) {\r\n\t\t\t\tcompilerError(ERR_USER, \"Unknown parameter for StructLayout\", pExpr->m_expressions[0]->m_line);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Get the value of the enum entry\r\n\t\t\t\tpExpr->AnalysisAndTransform();\r\n\t\t\t\tif(pExpr->m_item.symbolType == EGENRE::_ENUMENTRY) {\r\n\t\t\t\t\tEnum::EnumEntry* pEntry = (Enum::EnumEntry*)pExpr->m_item.pSymbol;\r\n\t\t\t\t\tout_structInfo.m_layoutKind = pEntry->m_expression->m_value.v.i;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"Enum entry not found\", pExpr->m_line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase EXPR_ASS_EQ :\r\n\t\t{\r\n\t\t\ts32* field = NULL;\r\n\t\t\tif(strcmp(pExpr->m_expressions[0]->m_text, \"Pack\") == 0) {\r\n\t\t\t\tfield = &out_structInfo.m_pack;\r\n\t\t\t} else if(strcmp(pExpr->m_expressions[0]->m_text, \"Charset\") == 0) {\r\n\t\t\t\tfield = &out_structInfo.m_charSet;\r\n\t\t\t} else {\r\n\t\t\t\tcompilerError(ERR_USER, \"Unknown parameter for StructLayout\", pExpr->m_expressions[0]->m_line);\r\n\t\t\t}\r\n\t\t\tif(pExpr->m_expressions[1]->m_expressionType == EXPR_CTE) {\r\n\t\t\t\tif(field) {\r\n\t\t\t\t\t*field = pExpr->m_expressions[1]->m_value.v.i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcompilerError(ERR_USER, \"Attribute field value is not a constant\", pExpr->m_expressions[1]->m_line);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault :\r\n\t\t\tcompilerError(ERR_USER, \"Unknown attribute syntax\", pExpr->m_line);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nExpression::~Expression() {\r\n\tCLEAR(m_expressions,m_expressionCount);\r\n}\r\n\r\nExpression*\tExpression::addExpression\t(Expression* newExpr) {\r\n\tEXPAND(m_expressionCount, m_expressions, newExpr);\r\n\treturn this;\r\n}\r\n\r\nExpression* Expression::setIdentifier\t(const char* id) {\r\n\tthis->m_text = concat(id);\r\n\treturn this;\r\n}\r\n\r\nExpression* Expression::setType\t\t\t(TypeObject* type) {\r\n\tthis->m_runtimeType = type;\r\n\treturn this;\r\n}\r\n\r\nExpression* Expression::setType\t\t\t(TypeObject* type, Quals* quals) {\r\n\tif (quals == NULL) {\r\n\t\treturn setType(type);\r\n\t} else {\r\n\t\tTypeObject* newType = type;\r\n\t\tQuals* pQuals = quals;\r\n\t\twhile (pQuals) {\r\n\t\t\tnewType = newType->addRank(pQuals->rank);\r\n\t\t\tpQuals = pQuals->m_pNext;\r\n\t\t}\r\n\t\tthis->m_runtimeType = newType;\r\n\t\treturn this;\r\n\t}\r\n}\r\n\r\nExpression* Expression::addParenthesis\t() {\r\n\tthis->m_hasParenthesis = true;\r\n\treturn this;\r\n}\r\n\r\nExpression* Expression::setArrayNew(bool generateArrayType) {\r\n\t// Generate different TypeObject and wrap original one.\r\n\tthis->m_arrayNew = true;\r\n\tif (generateArrayType) {\r\n\t\tm_runtimeType = m_runtimeType->createArrayType(1);\r\n\t}\r\n\treturn this;\r\n}\r\n\r\nExpression* Expression::setRank(u32 rank) {\r\n\tthis->m_rank = rank;\r\n\treturn this;\r\n}\r\n\r\nExpression* Expression::setValue(SValue val) {\r\n\tthis->m_value = val;\r\n\treturn this;\r\n}\r\n\r\n/*static*/\r\nvoid Expression::patchExpressionsForListExpressions(Expression** expr, TypeObject* type) {\r\n\tif ((*expr)->m_expressionType == EXPR_LIST_INIT) {\r\n\t\t//\r\n\t\t// Transform Var a = {....} into Var a = new type[count] { .... } \r\n\t\t//\r\n\t\tSValue v;\r\n\t\tv.v.i = (*expr)->m_expressionCount;\r\n\t\tv.type\t= TYPE_INT;\r\n\r\n\t\tExpression* sizeExpr\t= CreateLeafExpr(EXPR_CTE)->setValue(v);\r\n\t\tExpression* initialized = *expr;\r\n\t\tExpression* exprNEW = CreateDoubleExpr(EXPR_NEW, sizeExpr, initialized)->setType(type);\t// Set variable type.\r\n\t\t*expr = exprNEW;\r\n\t}\r\n}\r\n\r\nExpression*\tCreateMultipleExpr\t(Expression* first) {\r\n\tExpression* pexpr = new Expression();\r\n\tpexpr->m_expressionType = EXPR_LIST;\r\n\tpexpr->addExpression(first);\r\n\treturn pexpr;\r\n}\r\n\r\nbool contains(const char* str, int char_) {\r\n\twhile (*str) {\r\n\t\tif (*str++ == char_) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nExpression*\tCreateLeafExpr\t\t(EnumExpressionType type, const char* ident) {\r\n\tExpression* pLeafexpr = new Expression();\r\n\tpLeafexpr->m_expressionType = type;\r\n\r\n\tif (ident) {\r\n\t\tExpression* pExpr = pLeafexpr;\r\n\t\tif (contains(ident, '.') && (type == EXPR_IDENT)) {\r\n\t\t\tStringList* pList = split(ident);\r\n\t\t\tpLeafexpr->setIdentifier(pList->content);\r\n\t\t\t// start from next item.\r\n\t\t\tpList = pList->pNext;\r\n\t\t\twhile (pList) {\r\n\t\t\t\tExpression* newExpr = CreateSingleExpr(EXPR_DOT, pExpr)->setIdentifier(pList->content);\r\n\t\t\t\tpExpr = newExpr;\r\n\t\t\t\tpList = pList->pNext;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tpLeafexpr->setIdentifier(ident);\r\n\t\t}\r\n\r\n\t\treturn pExpr;\r\n\t}\r\n\treturn pLeafexpr;\r\n}\r\n\r\nint gGlobalInitializeCount = 0;\r\nSInitialization* gGlobalInitList = NULL;\r\n\r\nExpression*\tgInitializerStack[50];\r\nint gInitializerCount = 0;\r\n\r\nSInitialization* registerGlobalInitializer(Expression* expr) {\r\n\tSInitialization* init = new SInitialization();\r\n\r\n\tinit->m_mode\t\t= SInitialization::INIT_CHAIN;\t// Default mode.\r\n\tinit->m_expression\t= expr;\r\n\tinit->m_typeArray\t= NULL;\r\n\tinit->m_next\t\t= gGlobalInitList;\r\n\tinit->m_expressionCounter = gGlobalInitializeCount++;\r\n\tinit->m_isDumped\t= !g_noDump;\r\n\r\n\tgGlobalInitList = init;\r\n\treturn init;\r\n}\r\n\r\nvoid GenerateInitList() {\r\n\tExpression* pExpr = CreateLeafExpr(EXPR_LIST_INIT,NULL);\r\n\tpExpr->m_initializerInfo = registerGlobalInitializer(pExpr);\r\n\tgInitializerStack[gInitializerCount++] = pExpr;\r\n}\r\n\r\nvoid PopInitList() {\r\n\tExpression* pExpr\t\t= gInitializerStack[--gInitializerCount];\r\n\tbool allCte = true;\r\n\tfor (int n=0; n < pExpr->m_expressionCount; n++) {\r\n\t\tExpression* pExp = pExpr->m_expressions[n];\r\n\t\tif ((!pExp->isConstant()) || (pExp->m_value.type == TYPE_STRING)) {\r\n\t\t\tallCte = false;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tSInitialization* pInit  = pExpr->m_initializerInfo;\r\n\t\r\n\tif (allCte) {\r\n\t\tpInit->m_mode = SInitialization::INIT_MEMCPY;\r\n\t}\r\n}\r\n\r\nExpression* getInitList() {\r\n\treturn gInitializerStack[gInitializerCount-1];\r\n}\r\n\r\nExpression*\tCreateSingleExpr\t(EnumExpressionType type, Expression* child) {\r\n\tif (EXPR_UNARYMINUS==type) {\r\n\t\tif (child->m_expressionType == EXPR_CTE) {\r\n\t\t\tchild->inverseValue();\r\n\t\t\treturn child;\r\n\t\t}\r\n\t}\r\n\tExpression* pexpr = new Expression();\r\n\tpexpr->m_expressionType = type;\r\n\tpexpr->addExpression(child);\r\n\treturn pexpr;\r\n}\r\n\r\nExpression*\tCreateDoubleExpr\t(EnumExpressionType type, Expression* pre, Expression* post) {\r\n\tExpression* pexpr = new Expression();\r\n\tpexpr->m_expressionType = type;\r\n\tpexpr->addExpression(pre);\r\n\tpexpr->addExpression(post);\r\n\treturn pexpr;\r\n}\r\n\r\nExpression*\tCreateTripleExpr\t(EnumExpressionType type, Expression* cond, Expression* tExpr, Expression* fExpr) {\r\n\tExpression* pexpr = new Expression();\r\n\tpexpr->m_expressionType = type;\r\n\tpexpr->addExpression(cond);\r\n\tpexpr->addExpression(tExpr);\r\n\tpexpr->addExpression(fExpr);\r\n\treturn pexpr;\r\n}\r\n\r\n/*\r\nExpression*\tCreateNewObj\t\t(EnumStatementType statementType) {\r\n\tExpression* expr = new Expression();\r\n\texpr->\r\n\treturn expr;\r\n}\r\n\r\nExpression*\tCreateNewObj\t\t(EnumExpressionType expr_type) {\r\n\tExpression* expr = new Expression();\r\n\texpr->m_expressionType = expr_type;\r\n\treturn expr;\r\n}\r\n*/\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Expression.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef EXPRESSION_H\r\n#define EXPRESSION_H\r\n\r\n#include \"BaseType.h\"\r\n\r\nstruct SInitialization {\r\n\t//\r\n\t// Used by m_mode\r\n\t//\r\n\tstatic const int\tINIT_WRAP_FUNC\t\t\t= 1;\r\n\tstatic const int\tINIT_CHAIN\t\t\t\t= 2;\r\n\tstatic const int\tINIT_MEMCPY\t\t\t\t= 3;\r\n\tstatic const int\tINIT_CHAINADD\t\t\t= 4;\r\n\r\n\tSInitialization*\tm_next;\r\n\tTypeObject*\t\t\tm_typeArray;\r\n\tExpression*\t\t\tm_expression;\r\n\tint\t\t\t\t\tm_expressionCounter;\r\n\tint\t\t\t\t\tm_mode;\r\n\tbool\t\t\t\tm_isDumped;\r\n};\r\n\r\nclass Expression {\r\npublic:\r\n\tExpression();\r\n\t~Expression();\r\n\tExpression* addGenericType\t(TypeGenericEntry* genericParam) { m_genericCall = genericParam; return this; }\r\n\tstatic void patchExpressionsForListExpressions(Expression** expr, TypeObject* type);\r\n\tExpression*\taddExpression\t(Expression*);\t\t// return this\r\n\tExpression* setIdentifier\t(const char* id);\t// return this\r\n\tExpression* setType\t\t\t(TypeObject* type);\t// return this\r\n\tExpression* setType\t\t\t(TypeObject* type, Quals* quals);\t// return this\r\n\tExpression* addParenthesis\t();\t\t\t\t\t// return this\r\n\tExpression* setValue\t\t(SValue v);\r\n\tExpression* setRank\t\t\t(u32 rank);\r\n\tExpression* setArrayNew\t\t(bool generateArrayType);\r\n\tExpression* setAsRef\t\t()\t{ m_asRef = true; return this; }\r\n\tExpression* patchSubInvoke\t();\r\n\r\n\tSRSymbol\tresolveIteration(const char* text, SRSymbol input, TypeObject*& lastType, SRSymbol& item, u8 searchMask, Expression* methodSignature = NULL, Variable* delegateSignature = NULL, TypeGenericEntry* genParams = NULL);\r\n\tvoid\t\tdumpExpression\t\t() {\r\n\t\tdumpExpressionInternal();\r\n\t}\r\n\r\n\tstatic void\tanalysisTransformAndDump(Expression** expr, TypeObject* type) {\r\n\t\tpatchExpressionsForListExpressions(expr, type);\r\n\t\t(*expr)->AnalysisAndTransform();\r\n\t\t(*expr)->dumpExpressionInternal();\r\n\t}\r\n\r\n\tvoid\t\tdumpExpressionInternal();\r\n\tvoid\t\tAnalysisAndTransform();\r\n\tvoid\t\tAnalysisMethodForDelegate(TypeGenericEntry* genParams);\r\n\tvoid\t\tAnalysisInvokeMethod(Expression* signature, TypeGenericEntry* genParams);\r\n\tvoid\t\ttransformMethodAsDelegate(Expression*& methodParam, int paramRank);\r\n\tvoid\t\tdumpTokens(SRSymbol res, const char* text, bool hasPrevious);\r\n\r\n\tvoid\t\tdumpTree\t\t\t();\t\t\t// For debug purpose\r\n\tconst char*\tgetOpDump\t\t\t();\r\n\tconst char*\tgetAssEqOpDump\t\t();\r\n\r\n\tbool\t\tisConstant\t\t\t();\r\n\tSValue\t\tgetValue\t\t\t();\r\n\tvoid\t\tinverseValue\t\t();\r\n\tbool\t\tcompareValues\t\t(Expression* exp);\r\n\r\n\tbool\t\tisAmbiguous\t\t\t();\r\n\tbool\t\tisMethodAsDelegate\t();\r\n\r\n\tvoid\t\tgetStructInfo\t\t(SStructInfo& out_structInfo);\r\npublic:\r\n\tTypeGenericEntry*\tm_genericCall;\r\n\tint\t\t\t\t\tm_expressionCount;\r\n\tExpression**\t\tm_expressions;\r\n\tbool\t\t\t\tm_hasParenthesis;\r\n\tQuals*\t\t\t\tm_quals;\r\n\tTypeObject*\t\t\tm_typeParam;\r\n\tTypeObject*\t\t\tm_runtimeType;\r\n\tVariable*\t\t\tm_delegateSignature;\r\n\tStatement*\t\t\tm_delegateCode;\r\n\tAbstractContainer*\tm_anonymousClass;\r\n\tconst char*\t\t\tm_text;\r\n\tEnumExpressionType\tm_expressionType;\r\n\tbool\t\t\t\tm_arrayNew;\r\n\tu32\t\t\t\t\tm_rank;\r\n\tSValue\t\t\t\tm_value;\r\n\tbool\t\t\t\tm_isAssignmentSide;\r\n\tbool\t\t\t\twrapStringStart;\r\n\tbool\t\t\t\twrapStringEnd;\r\n\tbool\t\t\t\tm_bSkip;\t// Used to skip printing the method name when dumping expression for delegate creation in new, or the container class of a nested one.\r\n\tbool\t\t\t\tm_asRef;\r\n\tbool\t\t\t\tm_isInvoked;\r\n\tbool\t\t\t\tm_isDotRoot;\r\n\tDelegate*\t\t\tm_delegateDef;\r\n\tSInitialization*\tm_initializerInfo;\r\n\tSRSymbol\t\t\tm_item;\r\n\tu32\t\t\t\t\tm_line;\r\n};\r\n\r\nExpression*\tCreateMultipleExpr\t(Expression* first);\r\nExpression*\tCreateLeafExpr\t\t(EnumExpressionType type, const char* ident = NULL);\r\nExpression*\tCreateSingleExpr\t(EnumExpressionType type, Expression* child);\r\nExpression*\tCreateDoubleExpr\t(EnumExpressionType type, Expression* pre, Expression* post);\r\nExpression*\tCreateTripleExpr\t(EnumExpressionType type, Expression* cond, Expression* tExpr, Expression* fExpr);\r\n\r\n/*\r\nExpression*\tCreateNewObj\t\t(EnumStatementType statementType);\r\nExpression*\tCreateNewObj\t\t(EnumExpressionType expr_type);\r\n*/\r\n\r\n#endif\t//EXPRESSION_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Method.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nMethod::Method()\r\n:Symbol()\r\n,m_attribute\t\t(NULL)\r\n,m_parameters\t\t(NULL)\r\n,m_returnType\t\t(NULL)\r\n,m_codeBlock\t\t(NULL)\r\n,m_pOwner\t\t\t(NULL)\r\n,m_modifier\t\t\t(0)\r\n,m_referenceModifCount\t(0)\r\n,m_initializerOpt\t(NULL)\r\n,m_initializerType\t(-1)\r\n,m_genericParam\t\t(NULL)\r\n,m_bResolvedParam\t(true)\r\n{\r\n}\r\n\r\nint Method::getGenre() {\r\n\treturn EGENRE::_METHOD;\r\n}\r\n\r\nconst char* Method::getName() {\r\n\tif(((m_modifier & (ATT_CTOR | ATT_DTOR)) != 0) && m_pOwner->m_cppRepresentation) {\r\n\t\treturn m_pOwner->m_cppRepresentation->m_name;\r\n\t}\r\n\treturn m_name;\r\n}\r\n\r\nvoid Method::setupHasDefaultParams() {\r\n\t//\r\n\t// Setup unresolved flag if default expression is associated with variables.\r\n\t//\r\n\tVariable* p = m_parameters;\r\n\twhile (p) {\r\n\t\tif (p->m_expression) {\r\n\t\t\tm_bResolvedParam = false;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tp = p->m_pNextVariable;\r\n\t}\r\n}\r\n\r\nvoid Method::resolveDefaultParams() {\r\n\tif (m_bResolvedParam == false) {\r\n\t\tAbstractContainer* backup = gCurrentAC;\r\n\t\tgCurrentAC = this->m_pOwner;\r\n\t\tVariable* p = m_parameters;\r\n\t\twhile (p) {\r\n\t\t\tif (p->m_expression) {\r\n\t\t\t\tp->m_expression->AnalysisAndTransform();\r\n\t\t\t}\r\n\t\t\tp = p->m_pNextVariable;\r\n\t\t}\r\n\t\tm_bResolvedParam = true;\r\n\t\tgCurrentAC = backup;\r\n\t}\r\n}\r\n\r\nvoid Method::setGenericParam() {\r\n\tm_genericParam = popGenericNameList();\r\n\tif(m_genericParam != NULL && getGenre() == EGENRE::_DELEGATE) {\r\n\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Generic delegates are not supported yet\");\r\n\t}\r\n}\r\n\r\nTypeObject* Method::getGenericType(TypeGenericDefinitionEntry* genericSymbol, TypeGenericEntry* genericParams) {\r\n\tif(m_genericParam) {\r\n\t\tTypeGenericDefinitionEntry * pDefGen = m_genericParam;\r\n\t\tTypeGenericEntry* pGen = genericParams;\r\n\t\twhile(pGen && pDefGen && strcmp(pDefGen->m_genericName, genericSymbol->m_genericName)) {\r\n\t\t\tpDefGen = pDefGen->m_pNextGenericEntry;\r\n\t\t\tpGen = pGen->m_pNext;\r\n\t\t}\r\n\t\tif(!pDefGen && !pGen) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Generic symbol was not found\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tif(!pDefGen || pGen) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Wrong number of generic parameters\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\treturn pGen->m_instanceType;\r\n\t}\r\n\telse {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nbool Method::analyzeRef() {\r\n\t//\r\n\t// Compute the maximum amount of space necessary on the stack to track references for GC during a call.\r\n\t//\r\n\tm_referenceModifCount = 0;\r\n\tVariable* pVar = m_parameters;\r\n\twhile (pVar) {\r\n\t\t// For each param by REFERENCE.\r\n\t\tif (pVar->m_modifier & ATT_REF) {\r\n\t\t\t// Not a ref on a base type : pointer on class or struct.\r\n\t\t\tif ((pVar->m_type->m_typeID &  ET_BASETYPE) == 0) {\r\n\t\t\t\t//\r\n\t\t\t\t// Check for a type to an object ptr, or a struct.\r\n\t\t\t\t//\r\n\t\t\t\tSRSymbol v = pVar->m_type->getResolvedType(this->m_pOwner);\r\n\t\t\t\tswitch (v.symbolType) {\r\n\t\t\t\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tAbstractContainer* pCnt = (AbstractContainer*)v.pSymbol;\r\n\t\t\t\t\t\tif (pCnt->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\t\t\tm_referenceModifCount += pCnt->m_referenceModifCount;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (pCnt->getType()->isGC_Able()) {\r\n\t\t\t\t\t\t\t\tm_referenceModifCount++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// Do nothing\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpVar = pVar->m_pNextVariable;\r\n\t}\r\n\r\n\treturn m_referenceModifCount != 0;\r\n}\r\n\r\nTypeGenericDefinitionEntry*\tMethod::findGenericSymbol(const char* name) {\r\n\tTypeGenericDefinitionEntry* pGenericEntry = m_genericParam;\r\n\twhile(pGenericEntry) {\r\n\t\tif(strcmp(pGenericEntry->m_genericName, name) == 0) {\r\n\t\t\treturn pGenericEntry;\r\n\t\t}\r\n\t\tpGenericEntry = pGenericEntry->m_pNextGenericEntry;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nMethodList::MethodList(Method* head)\r\n:Method()\r\n,m_method\t\t(NULL)\r\n,m_nextMethod\t(NULL)\r\n,m_count\t\t(0)\r\n{\r\n}\r\n\r\nint MethodList::getGenre() {\r\n\treturn EGENRE::_METHODLIST;\r\n}\r\n\r\nvoid MethodList::add(Method* method) {\t\r\n\tif(!m_method) {\r\n\t\tm_method = method;\r\n\t}\r\n\telse {\r\n\t\tMethodList* pMethod = this;\r\n\t\twhile(pMethod->m_nextMethod) {\r\n\t\t\tpMethod = pMethod->m_nextMethod;\r\n\t\t}\r\n\t\tMethodList* pNewMethod = new MethodList(method);\r\n\t\tpMethod->m_nextMethod = pNewMethod;\r\n\t}\r\n\tm_count++;\r\n}"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/NameSpace.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nNameSpace::NameSpace()\r\n:m_pInner\t\t\t(NULL)\r\n,m_innerCount\t\t(0)\r\n,m_pChildSpace\t\t(NULL)\r\n,m_pNextSpace\t\t(NULL)\r\n,m_enums\t\t\t(NULL)\r\n,m_enumCount\t\t(0)\r\n,m_delegates\t\t(NULL)\r\n,m_delegateCount\t(0)\r\n,m_usingCount\t\t(0)\r\n,m_usings\t\t\t(NULL)\r\n,m_attribute\t\t(NULL)\r\n,m_pParent\t\t\t(NULL)\r\n,m_bIsAbstract\t\t(false)\r\n,m_noDump\t\t\t(false)\r\n{\r\n}\r\n\r\nint NameSpace::getGenre() { return EGENRE::_NAMESPACE; }\r\n\r\nconst char*\tNameSpace::getFullName(NameSpace* ctx) {\r\n#ifdef __FULLNAMES__\r\n\tctx = gRootNameSpace;\r\n#endif\r\n\tif(getGenre() == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\tAbstractContainer* pAC = (AbstractContainer*)this;\r\n\t\tif(pAC->m_cppRepresentation) {\r\n\t\t\treturn pAC->m_cppRepresentation->getFullName(ctx);\r\n\t\t}\r\n\t}\r\n\r\n\tchar prefix[1000];\r\n\tchar prefix2[1000];\r\n\r\n\tNameSpace* stack[50];\r\n\tint countNameSpace = 0;\r\n\r\n\t//\r\n\t// Compute full identifier\r\n\t//\r\n\tNameSpace* p = this;\r\n\twhile (p) {\r\n\t\tif (p == ctx) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tstack[countNameSpace++] = p;\r\n\t\tp = p->m_pParent;\r\n\t}\r\n\r\n\tchar* pSrc = prefix;\r\n\tchar* pDst = prefix2;\r\n\tpSrc[0] = 0;\r\n\tpDst[0] = 0;\r\n\tif (countNameSpace) {\r\n\t\twhile (countNameSpace) {\r\n\t\t\tcountNameSpace--;\r\n\t\t\tif (!pSrc[0]) {\r\n\t\t\t\tsprintf(pDst, \"%s\", stack[countNameSpace]->getName());\r\n\t\t\t} else {\r\n\t\t\t\tsprintf(pDst, \"%s::%s\", pSrc, stack[countNameSpace]->getName());\r\n\t\t\t}\r\n\r\n\t\t\tchar* swap = pSrc;\r\n\t\t\tpSrc = pDst;\r\n\t\t\tpDst = swap;\r\n\t\t}\r\n\t\treturn strdup(pSrc);\r\n\t} else {\r\n\t\tif (ctx == this) {\r\n\t\t\treturn m_name;\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"no Common node but pointer is different !?\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nDelegate* NameSpace::addDelegate(Attribute* attribute, u32 modifier, TypeObject* type, const char* name, Variable* variable) {\r\n\tDelegate* d\t\t= new Delegate();\r\n\td->m_attribute\t= attribute;\r\n\td->m_modifier\t= modifier;\r\n\td->m_returnType\t= type;\r\n\td->setName(name);\r\n\td->m_parameters\t= variable;\r\n\td->setupHasDefaultParams();\r\n\td->m_pOwner\t\t= (AbstractContainer*)this;\r\n\tEXPAND(m_delegateCount, m_delegates, d);\r\n\r\n\tif (this->getGenre() == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t// Create an unnested C++ equivalent\t\t\r\n\t\tchar buff[1024];\r\n\t\tstatic int gInnerClassOut = 0;\r\n\t\tsprintf(buff,\"%s_inner%i\",name,gInnerClassOut++);\r\n\t\t\r\n\t\tNameSpace* pureNameSpace = gCurrentNameSpace;\r\n\t\twhile (pureNameSpace->getGenre() == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\tpureNameSpace = pureNameSpace->m_pParent;\r\n\t\t}\r\n\r\n\t\tDelegate* dCpp = pureNameSpace->addDelegate(attribute, modifier, type, buff, variable);\r\n\t\tdCpp->m_csharpRepresentation\t= d;\r\n\t\td->m_cppRepresentation\t\t\t= dCpp;\r\n\t}\r\n\telse if(g_registerClasses) {\r\n\t\tgClassDictionary->add(concat2(d->getFullName(gRootNameSpace), \"*\"), d->generateTypeID());\r\n\t}\r\n\r\n\treturn d;\r\n}\r\n\r\nvoid NameSpace::addNameSpace(NameSpace* pNameSpace)\r\n{\r\n\t// Update\r\n\tpNameSpace->m_pParent = this;\r\n\r\n\t// Link list\r\n\tif (m_pChildSpace) {\r\n\t\tNameSpace* p = m_pChildSpace;\r\n\t\twhile (p->m_pNextSpace) {\tp = p->m_pNextSpace;\t}\r\n\t\tp->m_pNextSpace = pNameSpace;\r\n\t} else {\r\n\t\tm_pChildSpace = pNameSpace;\r\n\t}\r\n}\r\n\r\nEnum* NameSpace::addEnum(Attribute* pAttrib, u32 modifier, const char* name, TypeObject* type)\r\n{\r\n\tEnum* pEnum = new Enum();\r\n\tpEnum->m_attribute\t= pAttrib;\r\n\tpEnum->m_modifier\t= modifier;\r\n\tpEnum->setName(name);\r\n\tpEnum->m_type\t\t= type;\r\n\tpEnum->m_parent\t\t= this;\r\n\t\r\n\tEXPAND(m_enumCount,m_enums,pEnum);\r\n\r\n\treturn pEnum;\r\n}\r\n\r\nvoid NameSpace::addAbstractContainer(AbstractContainer* pCnt) {\r\n\tEXPAND(m_innerCount,m_pInner,pCnt);\r\n\tpCnt->m_pParent = this;\r\n\tif(g_registerClasses\r\n\t\t&& !pCnt->isSubSystem()\r\n\t\t&& !((pCnt->m_modifier & ATTRB_ANONDELEGATE) == ATTRB_ANONDELEGATE)\r\n\t\t&& (this->getGenre() != EGENRE::_ABSTRACTCONTAINER)\r\n\t) {\r\n\t\tgClassDictionary->add(concat2(pCnt->getFullName(gRootNameSpace), (pCnt->m_modifier & ATT_STRUCT) ? \"\" : \"*\"),\r\n\t\t\t\t\t\t\t  pCnt->generateTypeID());\r\n\t}\r\n}\r\n\r\nvoid NameSpace::addUsing(const char* using_) {\r\n\tfor(int n = 0; n < m_usingCount ; n ++) {\r\n\t\tif(strcmp(m_usings[n], using_) == 0) {\r\n\t\t\t// The namespace already has this using\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\tEXPAND(m_usingCount,m_usings,using_);\r\n}\r\n\r\nNameSpace* NameSpace::setup(Attribute* attribute, const char* nameSpace) \r\n{\r\n\tthis->m_attribute = attribute;\r\n\tthis->setName(nameSpace);\r\n\treturn this;\r\n}\r\n\r\nbool NameSpace::isSubSystem()\r\n{\r\n\tNameSpace* lastParent = this;\r\n\twhile(lastParent->m_pParent->m_name[0]) {\r\n\t\tlastParent = lastParent->m_pParent;\r\n\t}\r\n\tif(strcmp(lastParent->m_name, \"System\") == 0) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nNameSpace* NameSpace::findNameSpace(const char* name)\r\n{\r\n\t// Search in name space\r\n\tNameSpace* p = this->m_pChildSpace;\r\n\twhile (p) {\r\n\t\tif (strcmp(p->m_name,name)==0) {\r\n\t\t\treturn p;\r\n\t\t}\r\n\t\tp = p->m_pNextSpace;\r\n\t} \r\n\t\r\n\t// Search in list of abstract container\r\n\tint n=0;\r\n\twhile (n < this->m_innerCount) {\r\n\t\tAbstractContainer* p = this->m_pInner[n];\r\n\t\tif (strcmp(p->m_name,name)==0) {\r\n\t\t\treturn p;\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nEnum* NameSpace::findEnum(const char* name)\r\n{\r\n\tint n=0;\r\n\twhile (n < this->m_enumCount) {\r\n\t\tEnum* pEnum = this->m_enums[n];\r\n\t\tif (strcmp(pEnum->m_name,name)==0) {\r\n\t\t\treturn pEnum;\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nDelegate* NameSpace::findDelegate(const char* name) {\r\n\tint n=0;\r\n\twhile (n < this->m_delegateCount) {\r\n\t\tDelegate* pDelegate = this->m_delegates[n];\r\n\t\tif (strcmp(pDelegate->m_name,name)==0) {\r\n\t\t\treturn pDelegate;\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\n//name is an atomic name, ie it does not compose several namespace/class names\r\n//searchMask : do the nth search phase if the nth bit is set to 1\r\nSymbol* NameSpace::findContext(const char* name, u8 searchMask, int iteration)\r\n{\r\n\tif(iteration > 100)\r\n\t{\r\n\t\tcompilerError(ERR_INTERNAL, \"Maximum iteration number reached\");\r\n\t}\r\n\tNameSpace* nameSpaceRes\t\t= NULL;\r\n\tEnum* enumRes\t\t\t\t= NULL;\r\n\tSymbol* symbolRes\t\t\t= NULL;\r\n\tDelegate* delegateRes\t\t= NULL;\r\n\r\n\t//note : the order is important\r\n\r\n\t// Step 1 : search in the local namespace\r\n\tif(searchMask & PHASE_LOCAL)\r\n\t{\r\n\t\tif(nameSpaceRes = findNameSpace(name)) {\r\n\t\t\t// if source namespace & target namespace visibility compatible.\r\n\t\t\treturn nameSpaceRes;\r\n\t\t}\r\n\t\tif(enumRes = findEnum(name)) {\r\n\t\t\t// if source namespace & target namespace visibility compatible.\r\n\t\t\treturn enumRes;\r\n\t\t}\r\n\t\tif (delegateRes = findDelegate(name)) {\r\n\t\t\treturn delegateRes;\r\n\t\t}\r\n\t\tif(strcmp(m_name,name)==0) {\r\n\t\t\t// if source namespace & target namespace visibility compatible.\r\n\t\t\treturn this;\r\n\t\t}\r\n\t}\r\n\r\n\t// Step 2 : search in the local generic symbols\r\n\tif((searchMask & PHASE_GENERIC) && (getGenre() == EGENRE::_ABSTRACTCONTAINER))\r\n\t{\r\n\t\tAbstractContainer* localAC = (AbstractContainer*)this;\r\n\t\tTypeGenericDefinitionEntry* pGen = localAC->m_genericParam;\r\n\t\twhile(pGen) {\r\n\t\t\tif(strcmp(pGen->m_genericName, name) == 0) {\r\n\t\t\t\treturn pGen;\r\n\t\t\t}\r\n\t\t\tpGen = pGen->m_pNextGenericEntry;\r\n\t\t}\r\n\t}\r\n\r\n\t// Step 3 : search in the mother class / interfaces\r\n\tif((searchMask & PHASE_INHERITANCE) && (getGenre() == EGENRE::_ABSTRACTCONTAINER))\r\n\t{\r\n\t\tAbstractContainer* localAC = (AbstractContainer*)this;\r\n\t\tint n=0;\r\n\t\twhile (n < localAC->m_inheritancesCount) {\r\n\t\t\tTypeObject* parentType = localAC->m_inheritances[n];\r\n\t\t\tAbstractContainer* mother;\r\n\t\t\tif(parentType->m_definitionAC) {\r\n\t\t\t\tmother = parentType->m_definitionAC;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tmother = (AbstractContainer*)this->resolve(localAC->m_inheritances[n]->m_name,PHASE_LOCAL | PHASE_USING | PHASE_HIERARCHY, iteration + 1);\r\n\t\t\t}\r\n\t\t\tsymbolRes = mother->resolve(name,PHASE_LOCAL | PHASE_INHERITANCE, iteration + 1);\r\n\t\t\tif(symbolRes) {\r\n\t\t\t\treturn symbolRes;\r\n\t\t\t}\r\n\t\t\tn++;\r\n\t\t}\r\n\t}\r\n\r\n\t// Step 4 : search in the usings\r\n\tif(searchMask & PHASE_USING)\r\n\t{\r\n\t\t//search in usings\r\n\t\tint n=0;\r\n\t\twhile (n < this->m_usingCount) {\r\n\t\t\tconst char* usingName = this->m_usings[n];\r\n\t\t\tNameSpace* usingNameSpace = (NameSpace*)resolve(usingName,PHASE_LOCAL | PHASE_HIERARCHY, iteration + 1);\r\n\t\t\tif(usingNameSpace) {\t//The used namespace has been resolved, is supposed to be always true.\r\n\t\t\t\tsymbolRes = usingNameSpace->findContext(name,PHASE_LOCAL,iteration + 1);\r\n\t\t\t\tif(symbolRes) {\r\n\t\t\t\t\treturn symbolRes;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tn++;\r\n\t\t}\r\n\t}\r\n\r\n\t// Step 5 : search in the higher hierarchy\r\n\tif(searchMask & PHASE_HIERARCHY)\r\n\t{\r\n\t\tif(m_pParent)\r\n\t\t{\r\n\t\t\tsymbolRes = m_pParent->resolve(name,PHASE_LOCAL | PHASE_INHERITANCE | PHASE_USING | PHASE_HIERARCHY, iteration + 1);\r\n\t\t\tif(symbolRes) {\r\n\t\t\t\treturn symbolRes;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nSymbol* NameSpace::resolve(const char* name, u8 searchMask, int iteration)\r\n{\r\n\tif(iteration > 100)\t{\r\n\t\tcompilerError(ERR_INTERNAL, \"Maximum iteration number reached\");\r\n\t\treturn NULL;\r\n\t}\r\n\tif (!this) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Null NameSpace for resolve\");\r\n\t}\r\n\tSymbol* pResult = NULL;\r\n\tNameSpace* pCurrNameSpace = this;\r\n\tStringList* splitList = split(name);\r\n\twhile(splitList && pCurrNameSpace) {\r\n\t\tpResult = pCurrNameSpace->findContext(splitList->content, searchMask, iteration + 1);\r\n\t\tif(splitList = splitList->pNext) {\r\n\t\t\tsearchMask = PHASE_LOCAL | PHASE_INHERITANCE;// (useless since the file is precompiled)\r\n\t\t\tpCurrNameSpace = (NameSpace*)pResult;\r\n\t\t}\r\n\t}\r\n\tif(iteration == 0 && !pResult)\r\n\t{\r\n\t\tchar buf[100];\r\n\t\tsprintf(buf, \"\\\"%s\\\" was not found\", name);\r\n\t\tcompilerError(ERR_INTERNAL, buf);\r\n\t}\r\n\treturn pResult;\r\n}"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/NameSpace.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef NAMESPACE_H\r\n#define NAMESPACE_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"Symbol.h\"\r\n\r\nextern NameSpace* gCurrentNameSpace;\r\n\r\n// NameSpace store list of definitions.\r\nclass NameSpace : public Symbol {\r\npublic:\r\n\tstatic const int\tPHASE_LOCAL\t\t\t= 0x01;\r\n\tstatic const int\tPHASE_GENERIC\t\t= 0x02;\r\n\tstatic const int\tPHASE_INHERITANCE\t= 0x04;\r\n\tstatic const int\tPHASE_USING\t\t\t= 0x08;\r\n\tstatic const int\tPHASE_HIERARCHY\t\t= 0x10;\r\n\tstatic const int\tPHASE_ALL\t\t\t= PHASE_LOCAL | PHASE_GENERIC | PHASE_INHERITANCE | PHASE_USING | PHASE_HIERARCHY;\r\n\r\n\tNameSpace();\r\n\tvirtual int getGenre();\r\n\tvirtual const char* getFullName(NameSpace* ref);\r\n\r\n\tvoid\taddUsing(const char* using_);\r\n\tvoid\taddNameSpace(NameSpace* pNameSpace);\r\n\tvoid\taddAbstractContainer(AbstractContainer* pCnt);\r\n\tEnum*\taddEnum(Attribute* pAttrib, u32 modified, const char* name, TypeObject* type);\r\n\tDelegate*\taddDelegate(Attribute* attribute, u32 modifier, TypeObject* type, const char* name, Variable* variable);\r\n\r\n\tbool isSubSystem();\r\n\tNameSpace*\tfindNameSpace(const char* name);\r\n\tNameSpace*\tsetup(Attribute* attribute, const char* nameSpace);\r\n\tEnum* findEnum(const char* name);\r\n\tDelegate* findDelegate(const char* name);\r\n\r\n\tSymbol* findContext(const char* name, u8 searchMask, int interation = 0);\r\n\tSymbol* resolve(const char* name, u8 searchMask = PHASE_ALL, int iteration = 0);\r\n\r\n\tAbstractContainer**\tm_pInner;\r\n\tint\t\t\t\t\tm_innerCount;\r\n\tEnum**\t\t\t\tm_enums;\r\n\tint\t\t\t\t\tm_enumCount;\r\n\tAttribute*\t\t\tm_attribute;\r\n\r\n\tDelegate**\t\t\tm_delegates;\r\n\tint\t\t\t\t\tm_delegateCount;\r\n\r\n\tint\t\t\t\t\tm_usingCount;\r\n\tconst char**\t\tm_usings;\r\n\r\n\tNameSpace*\t\t\tm_pParent;\r\n\tNameSpace*\t\t\tm_pChildSpace;\r\n\tNameSpace*\t\t\tm_pNextSpace;\r\n\tbool\t\t\t\tm_bIsAbstract;\r\n\tbool\t\t\t\tm_noDump;\r\n\r\n\t// List of symbol.\r\n\tSymbol*\tm_pNext;\r\n};\r\n\r\n#endif\t//NAMESPACE_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Statement.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nStatement::Statement()\r\n:m_bConstant\t\t\t(false)\r\n,m_statementType\t\t(STM_UNDEFINED)\r\n,lbl\t\t\t\t\t(NULL)\r\n,m_pNext\t\t\t\t(NULL)\r\n,m_pChild\t\t\t\t(NULL)\r\n,m_type\t\t\t\t\t(NULL)\r\n,m_expr\t\t\t\t\t(NULL)\r\n,m_vars\t\t\t\t\t(NULL)\r\n,m_counter\t\t\t\t(-1)\r\n{\r\n\tm_line = yylineno;\r\n}\r\n\r\nStatement::~Statement() \r\n{\r\n\tdelete[] lbl;\r\n\tdelete m_pChild;\r\n\tdelete m_pNext;\r\n\tdelete m_type;\r\n\tdelete m_expr;\r\n\tdelete m_vars;\r\n}\r\n\r\nStatement* Statement::setExpression(Expression* expr) {\r\n\tm_expr = expr;\r\n\treturn this;\r\n}\r\n\r\n// LATER : Change to setLabel\r\nStatement* Statement::addLabel(const char* label) {\r\n\tlbl = concat(label);\r\n\treturn this;\r\n}\r\n\r\n// LATER : Change to setType most likely\r\nStatement* Statement::addType(TypeObject* type) {\r\n\tthis->m_type = type;\r\n\treturn this;\r\n}\r\n\r\nStatement* Statement::addNext(Statement* next) {\r\n\tStatement* p = this;\r\n\twhile (p->m_pNext) {\r\n\t\tp = p->m_pNext;\r\n\t}\r\n\tp->m_pNext = next;\r\n\r\n\treturn this;\r\n}\r\n\r\nStatement* Statement::addChild(Statement* child) {\r\n\tStatement* p = this->m_pChild;\r\n\tif (p) {\r\n\t\twhile (p->m_pNext) { p = p->m_pNext; }\r\n\t\tp->m_pNext = child;\r\n\t} else {\r\n\t\tm_pChild = child;\r\n\t}\r\n\treturn this;\r\n}\r\n\r\nStatement* Statement::addChildNilWrap(Statement* child) {\r\n\tStatement* childW = new Statement();\r\n\tchildW->m_statementType = STM_NILWRAPPER;\r\n\tchildW->addChild(child);\r\n\tthis->addChild(childW);\r\n\treturn this;\r\n}\r\n\r\nStatement* Statement::setConstant() {\r\n\tthis->m_bConstant = true;\r\n\treturn this;\r\n}\r\n\r\nStatement* CreateStatement(EnumStatementType statementType, Statement* brother, Statement* child) {\r\n\tStatement* pN\t= new Statement();\r\n\tpN->m_statementType\t\t= statementType;\r\n\tpN->m_pNext\t\t\t\t= brother;\r\n\tpN->m_pChild\t\t\t= child;\r\n\treturn pN;\r\n}"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Statement.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef STATEMENT_H\r\n#define STATEMENT_H\r\n\r\n#include \"BaseType.h\"\r\n\r\n//Constants for the search mask\r\nconst u8 SEARCH_VARIABLE\t\t= 0x80;\r\nconst u8 SEARCH_MEMBER\t\t\t= 0x40;\r\nconst u8 SEARCH_PROPERTY\t\t= 0x20;\r\nconst u8 SEARCH_INSTANCE\t\t= SEARCH_VARIABLE | SEARCH_MEMBER | SEARCH_PROPERTY;\r\nconst u8 SEARCH_INHERITANCE\t\t= 0x10;\r\nconst u8 SEARCH_HIERARCHY\t\t= 0x08;\r\nconst u8 SEARCH_FUNCTION\t\t= 0x04;\r\nconst u8 SEARCH_TYPE\t\t\t= 0x02;\r\nconst u8 SEARCH_ALL\t\t\t\t= SEARCH_FUNCTION | SEARCH_INSTANCE | SEARCH_TYPE | SEARCH_INHERITANCE | SEARCH_HIERARCHY;\r\n\r\nclass Statement {\r\npublic:\r\n\tStatement();\r\n\t~Statement();\r\n\r\n\tStatement* setExpression(Expression* expr);\r\n\tStatement* addLabel(const char* label);\r\n\tStatement* addType(TypeObject* type);\r\n\tStatement* addNext(Statement* next);\t// Return THIS, not NEXT !\r\n\tStatement* addChild(Statement* child);\r\n\tStatement* addChildNilWrap(Statement* child);\t// If NULL, create a default NULL statement \r\n\tStatement* setConstant();\t// For variable create statement\r\n\r\n\tStatement* wrapCaseBody();\r\n\tvoid analysis(bool processBrother = true);\r\n\tvoid dumpStatement(bool processBrother = true);\r\npublic:\r\n\tbool\t\t\t\tm_bConstant;\r\n\tEnumStatementType\tm_statementType;\r\n\tconst char*\t\t\tlbl;\r\n\tStatement*\t\t\tm_pNext;\r\n\tStatement*\t\t\tm_pChild;\r\n\tTypeObject*\t\t\tm_type;\t// CATCH statement\r\n\tExpression*\t\t\tm_expr;\r\n\tVariable*\t\t\tm_vars;\r\n\tint\t\t\t\t\tm_counter;\r\n\tu32\t\t\t\t\tm_line;\r\n};\r\n\r\nStatement*  CreateStatement\t\t(EnumStatementType statementType, Statement* brother, Statement* child);\r\n\r\n#endif\t//STATEMENT_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Symbol.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nSymbol::Symbol() \r\n:m_pNext\t\t\t(NULL)\r\n,m_pAlias\t\t\t(NULL)\r\n,m_name\t\t\t\t(NULL)\r\n,m_dependancyList\t(NULL)\r\n,m_stdAttribute\t\t(0)\r\n{\r\n\tm_uniqueId\t= gGlobalClassID;\r\n\tm_line\t\t= yylineno;\r\n}\r\n\r\nSymbol::~Symbol()\r\n{\r\n\tdelete[] m_name;\r\n}\r\n\r\nconst char*\tSymbol::getName() {\r\n\treturn m_name;\r\n}\r\n\r\nvoid Symbol::setName(const char* name) {\r\n\tm_name = concat(name);\r\n}\r\n\r\n/**\r\n\tAbstract container or enum\r\n */\r\nvoid Symbol::use(Symbol* v) {\r\n\t// Check if already used to avoid double registration.\r\n\tDependancy* p = m_dependancyList;\r\n\twhile (p) {\r\n\t\tif (p->m_uses == v) { return ; }\r\n\t\tp = p->m_pNext;\r\n\t}\r\n\r\n\t// Insert only new element\r\n\tp = new Dependancy();\r\n\tp->m_uses = v;\r\n\tp->m_pNext = m_dependancyList;\r\n\tm_dependancyList = p;\r\n}\r\n\r\nvoid Symbol::unuseAll() {\r\n\tDependancy* p\t= m_dependancyList;\r\n\twhile (p) {\r\n\t\tDependancy* n\t= p->m_pNext;\r\n\t\tdelete p;\r\n\t\tp = n;\r\n\t}\r\n}\r\n\r\nvoid Symbol::unuse(Symbol* v) {\r\n\tDependancy* p\t= m_dependancyList;\r\n\tDependancy* prev\t= NULL;\r\n\r\n\t// multiple registration checked, so we delete only once.\r\n\twhile (p) {\r\n\t\tif (p->m_uses == v) {\r\n\t\t\tif (prev) {\r\n\t\t\t\tprev->m_pNext = p->m_pNext;\r\n\t\t\t} else {\r\n\t\t\t\tm_dependancyList = p->m_pNext;\r\n\t\t\t}\r\n\r\n\t\t\tdelete p;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tprev = p;\r\n\t\tp = p->m_pNext;\r\n\t}\r\n}\r\n\r\nbool Symbol::stillUsing(u32 mask) {\r\n\tif (mask == 0xFFFF) {\r\n\t\treturn m_dependancyList != NULL;\r\n\t} else {\r\n\t\tDependancy* p = m_dependancyList;\r\n\t\twhile (p) {\r\n\t\t\tif (p->m_uses->getGenre() & mask) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tp = p->m_pNext;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nSymbol* createNotFoundSymbol() {\r\n\tSymbol* notFound = new Symbol();\r\n\tnotFound->setName(\"[Symbol not found]\");\r\n\treturn notFound;\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Symbol.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef SYMBOL_H\r\n#define SYMBOL_H\r\n\r\n#include \"BaseType.h\"\r\n\r\n\r\nclass NameSpace;\r\n\r\nclass Symbol {\r\npublic:\r\n\tSymbol();\r\n\t~Symbol();\r\n\r\n\tvoid\tuse\t\t\t\t\t(Symbol* v);\r\n\tvoid\tunuse\t\t\t\t(Symbol* v);\r\n\tbool\tstillUsing\t\t\t(u32 mask = 0xFFFF);\r\n\tvoid\tunuseAll\t\t\t();\r\n\tvoid\tmarkSetupDependancy\t();\r\n\r\n\tvirtual int\t\t\tgetGenre() { return EGENRE::_UNDEFGENRE; }\r\n//\tvirtual TypeObject*\tgetSymbolType() = 0;\r\n\tvirtual const char*\tgetName\t();\r\n\tvirtual const char* getFullName(NameSpace* ref = NULL)\r\n\t{\r\n\t\tcompilerError(ERR_INTERNAL,\"Internal Error : invalid getFullName\");\r\n\t\treturn NULL;\r\n\t}\r\n\tvoid\t\tsetName\t(const char* name);\r\n\r\n\tu32\t\t\tm_stdAttribute;\r\n\tconst char*\tm_name;\r\n\tSymbol*\t\tm_pNext;\r\n\tSymbol*\t\tm_pAlias;\r\n\tu32\t\t\tm_uniqueId;\r\n\tu32\t\t\tm_line;\r\nprotected:\r\n\tstruct Dependancy {\r\n\t\tDependancy*\tm_pNext;\r\n\t\tSymbol*\t\tm_uses;\r\n\t};\r\n\tDependancy*\tm_dependancyList;\r\n};\r\n\r\nSymbol* createNotFoundSymbol();\r\n\r\n#endif\t//SYMBOL_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/TypeObject.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nint TypeGenericDefinitionEntry::getGenre() {\r\n\treturn EGENRE::_GENDEFENTRY;\r\n}\r\n\r\nint TypeGenericDefinitionEntry::nbEntries() {\r\n\tint n = 0;\r\n\tTypeGenericDefinitionEntry* pEntry = this;\r\n\twhile(pEntry) {\r\n\t\tpEntry = pEntry->m_pNextGenericEntry;\r\n\t\tn++;\r\n\t}\r\n\treturn n;\r\n}\r\n\r\nTypeObject::TypeObject(EnumTypeObject defType)\r\n:m_ranks\t\t(NULL)\r\n,m_rankCount\t(0)\r\n,m_ptrLevel\t\t(0)\r\n,m_originalType\t(0)\r\n,m_typeID\t\t(defType)\r\n,m_typeForCodeCache\t\t(NULL)\r\n,m_generic\t\t(NULL)\r\n,m_isGC_Able\t(true)\r\n,m_definitionNameSpace\t(NULL)\r\n,m_definitionAC\t\t\t(NULL)\r\n,m_definitionEnum\t\t(NULL)\r\n,m_definitionDelegate\t(NULL)\r\n,m_definitionGeneric\t(NULL)\r\n,m_genreID\t\t(-1)\r\n{\r\n}\r\n\r\nTypeObject::TypeObject()\r\n:m_ranks\t\t(NULL)\r\n,m_rankCount\t(0)\r\n,m_ptrLevel\t\t(0)\r\n,m_originalType\t(0)\r\n,m_typeID\t\t(TYPE_UNRESOLVED)\r\n,m_typeForCodeCache\t(NULL)\r\n,m_generic\t\t(NULL)\r\n,m_isGC_Able\t(true)\r\n,m_definitionNameSpace\t(NULL)\r\n,m_definitionAC\t(NULL)\r\n,m_definitionEnum(NULL)\r\n,m_definitionDelegate(NULL)\r\n,m_definitionGeneric(NULL)\r\n,m_genreID\t\t(-1)\r\n{\r\n}\r\n\r\nTypeObject::~TypeObject() {\r\n\tdelete[] m_ranks;\r\n}\r\n\r\n// TYPE_UNRESOLVED\t\r\nTypeObject\tt_SBYTE\t\t(TYPE_SBYTE);\r\nTypeObject\tt_BYTE\t\t(TYPE_BYTE);\r\nTypeObject\tt_SHORT\t\t(TYPE_SHORT);\r\nTypeObject\tt_USHORT\t(TYPE_USHORT);\r\nTypeObject\tt_INT\t\t(TYPE_INT);\r\nTypeObject\tt_UINT\t\t(TYPE_UINT);\r\nTypeObject\tt_LONG\t\t(TYPE_LONG);\r\nTypeObject\tt_ULONG\t\t(TYPE_ULONG);\r\nTypeObject\tt_CHAR\t\t(TYPE_CHAR);\r\nTypeObject\tt_FLOAT\t\t(TYPE_FLOAT);\r\nTypeObject\tt_DOUBLE\t(TYPE_DOUBLE);\r\nTypeObject\tt_BOOL\t\t(TYPE_BOOL);\r\nTypeObject\tt_OBJECT\t(TYPE_OBJECT);\r\nTypeObject\tt_STRING\t(TYPE_STRING);\r\nTypeObject\tt_VOID\t\t(TYPE_VOID);\r\nTypeObject\tt_NULL\t\t(TYPE_NULL);\r\nTypeObject\tt_INTPTR\t(TYPE_INTPTR);\r\nTypeObject\tt_ARRAY\t\t(TYPE_ARRAY);\r\nTypeObject\tt_DELEGATE\t(TYPE_DELEGATE);\r\n\r\nvoid initBaseType() {\r\n\tgGlobalClassID\t\t\t= 0;\r\n\tt_SBYTE.m_isGC_Able\t\t= false;\r\n\r\n\tt_BYTE.m_isGC_Able\t\t= false;\r\n\tt_SHORT.m_isGC_Able\t\t= false;\r\n\tt_USHORT.m_isGC_Able\t= false;\r\n\tt_INT.m_isGC_Able\t\t= false;\r\n\tt_UINT.m_isGC_Able\t\t= false;\r\n\tt_LONG.m_isGC_Able\t\t= false;\r\n\tt_ULONG.m_isGC_Able\t\t= false;\r\n\tt_CHAR.m_isGC_Able\t\t= false;\r\n\tt_FLOAT.m_isGC_Able\t\t= false;\r\n\tt_DOUBLE.m_isGC_Able\t= false;\r\n\tt_BOOL.m_isGC_Able\t\t= false;\r\n\tt_INTPTR.m_isGC_Able\t= false;\r\n\t/* TRUE BY DEFAULT\r\n\tt_OBJECT\r\n\tt_STRING\t\r\n\t*/\r\n\tt_VOID.m_isGC_Able\t\t= false;\r\n\tt_NULL.m_isGC_Able\t\t= false;\r\n\r\n\t// Forbid the defined classes to be exported.\r\n\tg_noDump = true;\r\n\r\n\tuseOrCreateNameSpace(NULL, \"System\");\r\n\r\n\t{\r\n\t\tAbstractContainer* pInt\t\t= CreateClass(NULL, ATT_PUBLIC, \"int\");\r\n\t\tt_INT.m_res.pSymbol\t\t\t= pInt;\r\n\t\tt_INT.m_name\t\t\t\t= pInt->m_name;\r\n\t\tt_INT.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_INT.m_genreID\t\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_INT.m_definitionAC\t\t= pInt;\r\n\t\tpInt->overrideType(&t_INT);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pUInt\t\t= CreateClass(NULL, ATT_PUBLIC, \"uint\");\r\n\t\tt_UINT.m_res.pSymbol\t\t= pUInt;\r\n\t\tt_UINT.m_name\t\t\t\t= pUInt->m_name;\r\n\t\tt_UINT.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_UINT.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_UINT.m_definitionAC\t\t= pUInt;\r\n\t\tpUInt->overrideType(&t_UINT);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pInt16\t= CreateClass(NULL, ATT_PUBLIC, \"short\");\r\n\t\tt_SHORT.m_res.pSymbol\t\t= pInt16;\r\n\t\tt_SHORT.m_name\t\t\t\t= pInt16->m_name;\r\n\t\tt_SHORT.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_SHORT.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_SHORT.m_definitionAC\t\t= pInt16;\r\n\t\tpInt16->overrideType(&t_SHORT);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pUInt16\t= CreateClass(NULL, ATT_PUBLIC, \"ushort\");\r\n\t\tt_USHORT.m_res.pSymbol\t\t= pUInt16;\r\n\t\tt_USHORT.m_name\t\t\t\t= pUInt16->m_name;\r\n\t\tt_USHORT.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_USHORT.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_USHORT.m_definitionAC\t\t= pUInt16;\r\n\t\tpUInt16->overrideType(&t_USHORT);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pInt8\t= CreateClass(NULL, ATT_PUBLIC, \"sbyte\");\r\n\t\tt_SBYTE.m_res.pSymbol\t\t= pInt8;\r\n\t\tt_SBYTE.m_name\t\t\t\t= pInt8->m_name;\r\n\t\tt_SBYTE.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_SBYTE.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_SBYTE.m_definitionAC\t\t= pInt8;\r\n\t\tpInt8->overrideType(&t_SBYTE);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pUInt8\t= CreateClass(NULL, ATT_PUBLIC, \"byte\");\r\n\t\tt_BYTE.m_res.pSymbol\t\t= pUInt8;\r\n\t\tt_BYTE.m_name\t\t\t\t= pUInt8->m_name;\r\n\t\tt_BYTE.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_BYTE.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_BYTE.m_definitionAC\t\t= pUInt8;\r\n\t\tpUInt8->overrideType(&t_BYTE);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pInt64\t= CreateClass(NULL, ATT_PUBLIC, \"long\");\r\n\t\tt_LONG.m_res.pSymbol\t\t= pInt64;\r\n\t\tt_LONG.m_name\t\t\t\t= pInt64->m_name;\r\n\t\tt_LONG.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_LONG.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_LONG.m_definitionAC\t\t= pInt64;\r\n\t\tpInt64->overrideType(&t_LONG);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pUInt64\t= CreateClass(NULL, ATT_PUBLIC, \"ulong\");\r\n\t\tt_ULONG.m_res.pSymbol\t\t= pUInt64;\r\n\t\tt_ULONG.m_name\t\t\t\t= pUInt64->m_name;\r\n\t\tt_ULONG.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_ULONG.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_ULONG.m_definitionAC\t\t= pUInt64;\r\n\t\tpUInt64->overrideType(&t_ULONG);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pFloat\t= CreateClass(NULL, ATT_PUBLIC, \"float\");\r\n\t\tt_FLOAT.m_res.pSymbol\t\t= pFloat;\r\n\t\tt_FLOAT.m_name\t\t\t\t= pFloat->m_name;\r\n\t\tt_FLOAT.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_FLOAT.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_FLOAT.m_definitionAC\t\t= pFloat;\r\n\t\tpFloat->overrideType(&t_FLOAT);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pDouble\t= CreateClass(NULL, ATT_PUBLIC, \"double\");\r\n\t\tt_DOUBLE.m_res.pSymbol\t\t= pDouble;\r\n\t\tt_DOUBLE.m_name\t\t\t\t= pDouble->m_name;\r\n\t\tt_DOUBLE.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_DOUBLE.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_DOUBLE.m_definitionAC\t\t= pDouble;\r\n\t\tpDouble->overrideType(&t_DOUBLE);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pChar\t= CreateClass(NULL, ATT_PUBLIC, \"char\");\r\n\t\tt_CHAR.m_res.pSymbol\t\t= pChar;\r\n\t\tt_CHAR.m_name\t\t\t\t= pChar->m_name;\r\n\t\tt_CHAR.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_CHAR.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_CHAR.m_definitionAC\t\t= pChar;\r\n\t\tpChar->overrideType(&t_CHAR);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pBool\t= CreateClass(NULL, ATT_PUBLIC, \"bool\");\r\n\t\tt_BOOL.m_res.pSymbol\t\t= pBool;\r\n\t\tt_BOOL.m_name\t\t\t\t= pBool->m_name;\r\n\t\tt_BOOL.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_BOOL.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_BOOL.m_definitionAC\t\t= pBool;\r\n\t\tpBool->overrideType(&t_BOOL);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pObject\t= CreateClass(NULL, ATT_PUBLIC, \"Object\");\r\n\t\tt_OBJECT.m_res.pSymbol\t\t= pObject;\r\n\t\tt_OBJECT.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_OBJECT.m_name\t\t\t\t= pObject->m_name;\r\n\t\tt_OBJECT.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_OBJECT.m_definitionAC\t\t= pObject;\r\n\t\tt_OBJECT.m_typeID\t\t\t= TYPE_OBJECT;\r\n\t\tpObject->m_uniqueId\t\t\t= TYPE_OBJECT;\r\n\t\tpObject->overrideType(&t_OBJECT);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pString\t= CreateClass(NULL, ATT_PUBLIC, \"String\");\r\n\t\tt_STRING.m_res.pSymbol\t\t= pString;\r\n\t\tt_STRING.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_STRING.m_name\t\t\t\t= pString->m_name;\r\n\t\tt_STRING.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_STRING.m_typeID\t\t\t= TYPE_STRING;\r\n\t\tt_STRING.m_definitionAC\t\t= pString;\r\n\t\tpString->m_uniqueId\t\t\t= TYPE_STRING;\r\n\t\tpString->overrideType(&t_STRING);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pArray\t= CreateClass(NULL, ATT_PUBLIC, \"Array\");\r\n\t\tt_ARRAY.m_res.pSymbol\t\t= pArray;\r\n\t\tt_ARRAY.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_ARRAY.m_name\t\t\t\t= pArray->m_name;\r\n\t\tt_ARRAY.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_ARRAY.m_typeID\t\t\t= TYPE_ARRAY;\r\n\t\tt_ARRAY.m_definitionAC\t\t= pArray;\r\n\t\tpArray->m_uniqueId\t\t\t= TYPE_ARRAY;\r\n\t\tpArray->overrideType(&t_ARRAY);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pIntPtr\t= CreateClass(NULL, ATT_PUBLIC, \"IntPtr\");\r\n\t\tt_INTPTR.m_res.pSymbol\t\t= pIntPtr;\r\n\t\tt_INTPTR.m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_INTPTR.m_name\t\t\t\t= pIntPtr->m_name;\r\n\t\tt_INTPTR.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_INTPTR.m_definitionAC\t\t= pIntPtr;\r\n\t\tpIntPtr->m_bAsGCAbleMember\t= false;\r\n\t\tpIntPtr->m_uniqueId\t\t\t= TYPE_INTPTR;\r\n\t\tpIntPtr->overrideType(&t_INTPTR);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\t{\r\n\t\tAbstractContainer* pDelegate\t= CreateClass(NULL, ATT_PUBLIC, \"Delegate\");\r\n\t\tt_DELEGATE.m_res.pSymbol\t\t= pDelegate;\r\n\t\tt_DELEGATE.m_res.symbolType\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_DELEGATE.m_name\t\t\t\t= pDelegate->m_name;\r\n\t\tt_DELEGATE.m_genreID\t\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\tt_DELEGATE.m_definitionAC\t\t= pDelegate;\r\n\t\tpDelegate->m_uniqueId\t\t\t= TYPE_DELEGATE;\r\n\t\tpDelegate->overrideType(&t_DELEGATE);\r\n\t\tunuseNameSpace();\r\n\t}\r\n\r\n\tunuseNameSpace(); // Pop \"System\"\r\n\r\n\t// Release the limitation.\r\n\tg_noDump = false;\r\n\r\n\t/*\r\n\tPushSpace(gCurrentNameSpace);\r\n\t\tgCurrentNameSpace = new NameSpace();\r\n\t\tgCurrentNameSpace->setName(\"System\");\r\n\r\n\t\t// double\r\n\t\t\t// float\r\n\t\t\t\t// long\r\n\t\t\t\t\t// int\r\n\t\t\t\t\t\t// u16 / char\r\n\t\t\t\t\t\t// s16 \r\n\t\t\t\t\t\t// u8\r\n\t\t\t\t\t\t// s8\r\n\t\t\t\t\t// uint\r\n\t\t\t\t\t\t// u8\r\n\t\t\t\t\t\t// u16 / char\r\n\t\t\t\t\t// ulong\r\n\t\t\t\t\t\t// int again\r\n\t\t\t\t\t\t\t// [subs]\r\n\t\t\t\t\t\t// uint again\r\n\t\t\t\t\t\t\t// [subs]\r\n\t\t// bool\r\n\r\n\t\tAbstractContainer* pBool = CreateClass(NULL, ATT_PUBLIC, \"Bool\");\r\n\t\tpBool->overrideType(&t_BOOL);\r\n\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pUInt = CreateClass(NULL, ATT_PUBLIC, \"UInt32\");\r\n\t\tpUInt->overrideType(&t_UINT);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pByte = CreateClass(NULL, ATT_PUBLIC, \"Byte\");\t\r\n\t\tpByte->overrideType(&t_BYTE);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pSByte = CreateClass(NULL, ATT_PUBLIC, \"SByte\");\t\r\n\t\tpSByte->overrideType(&t_SBYTE);\r\n\t\tunuseNameSpace();\r\n\r\n\r\n\t\tAbstractContainer* pInt16 = CreateClass(NULL, ATT_PUBLIC, \"Int16\");\r\n\t\tpInt16->overrideType(&t_SHORT);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pUInt16 = CreateClass(NULL, ATT_PUBLIC, \"UInt16\");\r\n\t\tpUInt16->overrideType(&t_USHORT);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pFloat = CreateClass(NULL, ATT_PUBLIC, \"Single\");\t\r\n\t\tpFloat->overrideType(&t_FLOAT);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pDouble = CreateClass(NULL, ATT_PUBLIC, \"Double\");\t\r\n\t\tpDouble->overrideType(&t_DOUBLE);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pInt64 = CreateClass(NULL, ATT_PUBLIC, \"Int64\");\r\n\t\tpInt64->overrideType(&t_LONG);\r\n\t\tunuseNameSpace();\r\n\r\n\t\tAbstractContainer* pUInt64 = CreateClass(NULL, ATT_PUBLIC, \"UInt64\");\r\n\t\tpInt64->overrideType(&t_ULONG);\r\n\t\tunuseNameSpace();\r\n\r\n\tPopSpace();\r\n\t*/\r\n}\r\n\r\n/* static */\r\nTypeObject* TypeObject::getTypeObject(EnumTypeObject defType) {\r\n\tswitch (defType) {\r\n\tcase TYPE_SBYTE:\treturn &t_SBYTE;\r\n\tcase TYPE_BYTE:\t\treturn &t_BYTE;\r\n\tcase TYPE_SHORT:\treturn &t_SHORT;\r\n\tcase TYPE_USHORT:\treturn &t_USHORT;\r\n\tcase TYPE_CHAR:\t\treturn &t_CHAR;\r\n\tcase TYPE_INT:\t\treturn &t_INT;\r\n\tcase TYPE_UINT:\t\treturn &t_UINT;\r\n\tcase TYPE_LONG:\t\treturn &t_LONG;\r\n\tcase TYPE_ULONG:\treturn &t_ULONG;\r\n\tcase TYPE_FLOAT:\treturn &t_FLOAT;\r\n\tcase TYPE_DOUBLE:\treturn &t_DOUBLE;\r\n\tcase TYPE_BOOL:\t\treturn &t_BOOL;\r\n\tcase TYPE_OBJECT:\treturn &t_OBJECT;\r\n\tcase TYPE_STRING:\treturn &t_STRING;\r\n\tcase TYPE_VOID:\t\treturn &t_VOID;\r\n\tcase TYPE_NULL:\t\treturn &t_NULL;\r\n\tcase TYPE_INTPTR:\treturn &t_INTPTR;\r\n\tcase TYPE_DELEGATE:\treturn &t_DELEGATE;\r\n\tdefault:\t\t\t\r\n\t\tcompilerError(ERR_INTERNAL,\"Invalid type retrieval\");\r\n\t\treturn NULL;\t// Generate a problem on purpose.\r\n\t}\r\n}\r\n\r\n/* static */\r\nTypeObject* TypeObject::getTypeObject(const char* typeName, EnumTypeObject defType) {\r\n\t// Always unresolved for now.\r\n\tif (defType == TYPE_UNRESOLVED) {\r\n\t\t// Search in current name space first\r\n\t\tTypeObject* pType = new TypeObject(defType);\r\n\t\tpType->setName(typeName);\r\n\t\treturn pType;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\t\r\nNameSpace* common(NameSpace* ref, NameSpace* nm) {\r\n\tNameSpace* obj0[50];\r\n\tNameSpace* obj1[50];\r\n\tint obj0Cnt = 0;\r\n\tint obj1Cnt = 0;\r\n\r\n\tNameSpace* p;\r\n\tp = ref;\r\n\twhile (p) { obj0[obj0Cnt++] = p; p = p->m_pParent; }\r\n\tp = nm;\r\n\twhile (p) { obj1[obj1Cnt++] = p; p = p->m_pParent; }\r\n\r\n\tNameSpace* result = NULL;\r\n\twhile ((obj0Cnt > 0) && (obj1Cnt > 0) && (obj0[--obj0Cnt] == obj1[--obj1Cnt])) {\r\n\t\tresult = obj0[obj0Cnt];\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\nNameSpace* common(NameSpace* ref, Delegate* delegate_) {\r\n\treturn common(ref, (NameSpace*)delegate_->getOwner());\r\n}\r\n\r\nNameSpace* common(NameSpace* ref, Enum* enum_) {\r\n\treturn common(ref, enum_->m_parent);\r\n}\r\n\r\n/*virtual*/\r\nconst char* TypeObject::getFullName(NameSpace* ref) {\r\n#ifdef __FULLNAMES__\r\n\tref = gRootNameSpace;\r\n#endif\r\n\tif (this->m_typeID == TYPE_UNRESOLVED) {\r\n\t\tgetResolvedType(ref);\r\n\t\tif (this->m_typeID != TYPE_UNRESOLVED) {\r\n\t\t\treturn getFullName(ref);\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Could not resolve.\");\r\n\t\t}\r\n\t} else {\r\n\t\tif (m_definitionEnum)\t\t{ return m_definitionEnum->getFullName(common(ref, m_definitionEnum));\t}\r\n\t\tif (m_definitionAC)\t\t\t{\r\n\t\t\tif (m_definitionAC->m_cppRepresentation) {\r\n\t\t\t\treturn m_definitionAC->m_cppRepresentation->getFullName(common(ref, m_definitionAC->m_cppRepresentation));\t\t\r\n\t\t\t} else {\r\n\t\t\t\treturn m_definitionAC->getFullName(common(ref, m_definitionAC));\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (m_definitionDelegate)\t{ return m_definitionDelegate->getFullName(common(ref, m_definitionDelegate)); }\r\n\r\n\t\tcompilerError(ERR_INTERNAL,\"Internal error : Trying to getFullName on a solved TypeObject but not enum or abstract container\");\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nint isStdType(TypeObject* type) {\r\n\tint res = -1;\r\n\tif (type->m_typeID == t_BOOL.m_typeID)\t\t{ res = 0;\t}\r\n\tif (type->m_typeID == t_BYTE.m_typeID)\t\t{ res = 1;\t}\r\n\tif (type->m_typeID == t_SBYTE.m_typeID)\t\t{ res = 2;\t}\r\n\tif (type->m_typeID == t_USHORT.m_typeID)\t{ res = 3;\t}\r\n\tif (type->m_typeID == t_CHAR.m_typeID)\t\t{ res = 3;\t}\r\n\tif (type->m_typeID == t_SHORT.m_typeID)\t\t{ res = 4;\t}\r\n\tif (type->m_typeID == t_UINT.m_typeID)\t\t{ res = 5;\t}\r\n\tif (type->m_typeID == t_INT.m_typeID)\t\t{ res = 6;\t}\r\n\tif (type->m_typeID == t_ULONG.m_typeID)\t\t{ res = 7;\t}\r\n\tif (type->m_typeID == t_LONG.m_typeID)\t\t{ res = 8;\t}\r\n\tif (type->m_typeID == t_FLOAT.m_typeID)\t\t{ res = 9;\t}\r\n\tif (type->m_typeID == t_DOUBLE.m_typeID)\t{ res = 10;\t}\r\n\tif (type->m_typeID == t_STRING.m_typeID)\t{ res = -2; }\r\n\treturn res;\r\n}\r\n\r\nTypeObject* TypeObject::getResolvedBlend(TypeObject* other) {\r\n\tif(m_res.pSymbol == other->m_res.pSymbol) {\r\n\t\t// No blend\r\n\t\treturn this;\r\n\t}\r\n\tif(m_typeID == TYPE_NULL) {\r\n\t\treturn other;\r\n\t}\r\n\tif(other->m_typeID == TYPE_NULL) {\r\n\t\treturn this;\r\n\t}\r\n\t//\r\n\t// - Signed over unsigned.\r\n\t// - Biggest over smallest.\r\n\t// - Filter all to be sure than only base type are compared.\r\n\t//\r\n\tint resThis\t\t= isStdType(this);\r\n\tint resOther\t= isStdType(other);\r\n\tif (resThis > -1 && resOther > -1) {\r\n\t\tint res = resThis > resOther ? resThis : resOther;\r\n\t\tswitch (res) {\r\n\t\tcase 0:\treturn &t_BOOL;\r\n\t\tcase 1:\treturn &t_BYTE;\r\n\t\tcase 2:\treturn &t_SBYTE;\r\n\t\tcase 3:\treturn &t_USHORT;\r\n\t\tcase 4:\treturn &t_SHORT;\t\r\n\t\tcase 5:\treturn &t_UINT;\t\r\n\t\tcase 6:\treturn &t_INT;\t\t\r\n\t\tcase 7:\treturn &t_ULONG;\t\r\n\t\tcase 8:\treturn &t_LONG;\t\r\n\t\tcase 9:\treturn &t_FLOAT;\t\r\n\t\tcase 10:return &t_DOUBLE;\t\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"impossible case\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t} else {\r\n\t\t// Trick : operator with String always return a string ! So we ignore the other parameter.\r\n\t\tif (resThis == -2) {\r\n\t\t\treturn &t_STRING;\r\n\t\t}\r\n\t\tcompilerError(ERR_INTERNAL,\"Expression used operator with unknown type\");\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nSRSymbol TypeObject::getResolvedType(NameSpace* nameSpaceContext, Method* localMethod) {\r\n\t// Resolve generic parameters\r\n\tTypeGenericEntry* pGen = m_generic;\r\n\twhile(pGen) {\r\n\t\tpGen->m_instanceType->getResolvedType(nameSpaceContext, localMethod);\r\n\t\tpGen->m_genericName = pGen->m_instanceType->dumpTypeForCode(nameSpaceContext, localMethod);\r\n\t\tpGen = pGen->m_pNext;\r\n\t}\r\n\tif(m_originalType) {\r\n\t// Resolve array sub type\r\n\t\tm_originalType->getResolvedType(nameSpaceContext, localMethod);\r\n\t}\r\n\r\n\tif (this->m_typeID == TYPE_UNRESOLVED) {\r\n\t\tif (this->m_originalType) {\r\n\t\t\tif (this->m_originalType->m_typeID == TYPE_UNRESOLVED) {\r\n\t\t\t\tthis->m_originalType->getResolvedType(nameSpaceContext, localMethod);\r\n\t\t\t}\r\n\r\n\t\t\tm_genreID\t= m_originalType->m_genreID;\r\n\t\t\tm_typeID\t= m_originalType->m_typeID;\r\n\t\t\tm_res\t\t= m_originalType->m_res;\r\n\r\n\t\t\t// Early return.\r\n\t\t\treturn m_res;\r\n\t\t}\r\n\r\n\t\tSymbol* result;\r\n\r\n\t\tif(localMethod) {\r\n\t\t\t// First check whether the type is a local generic symbol.\r\n\t\t\tresult = localMethod->findGenericSymbol(getName());\r\n\t\t\tif(!result) {\r\n\t\t\t\tif(nameSpaceContext != localMethod->m_pOwner &&\r\n\t\t\t\t// Special case (anonymous delegates)\r\n\t\t\t\tnameSpaceContext->m_pParent != localMethod->m_pOwner) {\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL, \"The namespace context should be the class directly above the method\");\r\n\t\t\t\t}\r\n\t\t\t\tresult = nameSpaceContext->resolve(getName());\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tresult = nameSpaceContext->resolve(getName());\r\n\t\t}\r\n\t\tSRSymbol res;\r\n\r\n\t\tif (result) {\r\n\t\t\tswitch (result->getGenre()) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER: // struct, class, interface\r\n\t\t\t\tthis->m_definitionAC = (AbstractContainer*)result;\r\n\t\t\t\tthis->m_isGC_Able    = ((this->m_definitionAC->m_modifier & (ATT_CLASS | ATT_INTERFACE)) != 0) && (this->m_definitionAC->m_bAsGCAbleMember);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM: // Enum\r\n\t\t\t\tthis->m_isGC_Able      = false;\r\n\t\t\t\tthis->m_definitionEnum = (Enum*)result;\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE: // Delegate\r\n\t\t\t\tthis->m_definitionDelegate = (Delegate*)result;\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_NAMESPACE: // NameSpace\r\n\t\t\t\tthis->m_definitionNameSpace = (NameSpace*)result;\r\n\t\t\tcase EGENRE::_GENDEFENTRY: // Generic definition entry\r\n\t\t\t\tthis->m_definitionGeneric = (TypeGenericDefinitionEntry*)result;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Undefined genre\");\r\n\t\t\t\tres.symbolType = EGENRE::_UNDEFGENRE;\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t\tm_genreID\t= result->getGenre();\r\n\t\t\tm_typeID\t= (EnumTypeObject)result->m_uniqueId;\r\n\t\t\tres.symbolType\t= (EGENRE)m_genreID;\r\n\t\t\tres.pSymbol\t\t= result;\r\n\t\t\tres.pType\t\t= this;\r\n\t\t\tm_res = res;\r\n\t\t\treturn res;\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_USER, concat2(m_name,\" is not supported\"));\r\n\t\t\t\r\n\t\t\tres.symbolType = EGENRE::_UNDEFGENRE;\r\n\t\t\treturn res;\r\n\t\t}\r\n\t} else {\r\n\t\treturn this->m_res;\r\n\t}\r\n}\r\n\r\nTypeObject* TypeObject::clone()\r\n{\r\n\tTypeObject* pNew = new TypeObject(this->m_typeID);\r\n\tpNew->m_ptrLevel\t\t= this->m_ptrLevel;\r\n\tpNew->m_generic\t\t\t= this->m_generic;\r\n\r\n\tfor (int n=0; n < this->m_rankCount; n++) {\r\n\t\tpNew->addRankInternal(this->m_ranks[n]);\r\n\t}\r\n\treturn pNew;\r\n}\r\n\r\nTypeObject* TypeObject::addPointer() \r\n{\r\n\tTypeObject* pObj = this;\r\n\tif (this->m_typeID != TYPE_UNRESOLVED) {\r\n\t\tpObj = this->clone();\r\n\t}\r\n\tpObj->m_ptrLevel++; return pObj;\r\n}\r\n\r\nTypeGenericDefinitionEntry* gNameListEntry = NULL;\r\n\r\nTypeGenericDefinitionEntry* popGenericNameList() {\r\n\tTypeGenericDefinitionEntry* result = gNameListEntry;\r\n\tgNameListEntry = NULL;\r\n\treturn result;\r\n}\r\n\r\nvoid addGenericName(const char* name) {\r\n\tTypeGenericDefinitionEntry* pEntry = new TypeGenericDefinitionEntry();\r\n\tpEntry->m_genericName\t\t\t\t= concat(name);\r\n\tpEntry->m_pNextGenericEntry\t= NULL;\r\n\tif (gNameListEntry == NULL) {\r\n\t\tgNameListEntry = pEntry;\r\n\t} else {\r\n\t\tTypeGenericDefinitionEntry* pList = gNameListEntry;\r\n\t\twhile (pList->m_pNextGenericEntry) {\r\n\t\t\tpList = pList->m_pNextGenericEntry;\r\n\t\t}\r\n\t\tpList->m_pNextGenericEntry = pEntry;\r\n\t}\r\n}\r\n\r\nTypeGenericEntry*\tgListEntry = NULL;\r\n\r\nvoid addGenericType(TypeObject* type) {\r\n\tTypeGenericEntry*\tpEntry = new TypeGenericEntry();\r\n\tpEntry->m_genericName\t= NULL;\r\n\tpEntry->m_instanceType\t= type;\r\n\tpEntry->m_pNext\t\t\t= NULL;\r\n\tif (gListEntry == NULL) {\r\n\t\tgListEntry = pEntry;\r\n\t} else {\r\n\t\tTypeGenericEntry* pList = gListEntry;\r\n\t\twhile (pList->m_pNext) {\r\n\t\t\tpList = pList->m_pNext;\r\n\t\t}\r\n\t\tpList->m_pNext = pEntry;\r\n\t}\r\n}\r\n\r\nTypeGenericEntry* g_stackGenEntry[100];\r\nint g_stackGenEntryCount = 0;\r\nvoid PushGenericType(TypeGenericEntry* data) {\r\n\tg_stackGenEntry[g_stackGenEntryCount++] = data;\r\n\tgListEntry = NULL;\r\n}\r\n\r\nTypeGenericEntry* PopGenericType() {\r\n\treturn gListEntry = g_stackGenEntry[--g_stackGenEntryCount];\r\n}\r\n\r\nTypeGenericEntry* GetGenericType() {\r\n\tTypeGenericEntry* result = gListEntry;\r\n\tgListEntry = NULL;\r\n\treturn result;\r\n}\r\n\r\nTypeObject* TypeObject::setGeneric(TypeGenericEntry* genericList) {\r\n\tm_generic = genericList;\r\n\treturn this;\r\n}\r\n\r\nTypeObject* TypeObject::createArrayType(int dimension) {\r\n\tTypeObject* newType = new TypeObject();\r\n\tnewType->m_originalType = this;\r\n\tnewType->m_rankCount\t= 1;\r\n\tnewType->m_ranks\t\t= new TypeObject::SRank();\r\n\tnewType->m_ranks->m_dimensionCount = dimension;\r\n\r\n\tAbstractContainer* array_ = t_ARRAY.m_definitionAC;\r\n\tnewType->m_definitionAC\t= array_;\r\n\tnewType->m_isGC_Able\t= true;\r\n\tnewType->m_genreID\t\t= EGENRE::_ABSTRACTCONTAINER;\r\n\tnewType->m_name\t\t\t= array_->getName();\r\n\tnewType->m_typeID\t\t= (EnumTypeObject)array_->m_uniqueId;\r\n\tnewType->m_res.pSymbol\t= array_;\r\n\tnewType->m_res.pType\t= newType;\r\n\tnewType->m_res.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\r\n\treturn newType;\r\n}\r\n\r\nvoid TypeObject::addRankInternal(SRank rank) {\r\n\t// Get old information.\r\n\tSRank* oldArray = m_ranks;\r\n\tint oldCount\t= m_rankCount;\r\n\r\n\t// Allocate new array and copy old array into new array.\r\n\tSRank* newArray = new SRank[oldCount+1];\r\n\tif (oldArray) {\r\n\t\tmemcpy(newArray,oldArray,oldCount * sizeof(void*));\r\n\t}\r\n\r\n\t// Add new element\r\n\tnewArray[oldCount] = rank;\r\n\tm_rankCount++;\r\n\r\n\t// Delete old array\r\n\tif (oldArray) { delete[] oldArray; }\r\n\r\n\tm_ranks = newArray;\r\n}\r\n\r\nTypeObject* TypeObject::addRank(int dimensions)\r\n{\r\n\tTypeObject* pObj = this;\r\n\tif (this->m_rankCount == 0) {\r\n\t\tpObj = createArrayType(dimensions);\r\n\t} else {\r\n\t\tpObj = this->clone();\r\n\t\tpObj->m_originalType = this;\r\n\r\n\t\tSRank rankV;\r\n\t\trankV.m_dimensionCount = dimensions;\r\n\t\tpObj->addRankInternal(rankV);\r\n\t}\r\n\r\n\treturn pObj;\r\n}\r\n\r\nconst char* TypeObject::getGenParams() {\r\n\tchar buff[500];\r\n\tbuff[0] = 0;\r\n\tchar* ptr = buff;\r\n\r\n\tif(m_generic) {\r\n\t\tsprintf(ptr++, \"<\");\r\n\t\tTypeGenericEntry* pGen = m_generic;\r\n\t\tdo {\r\n\t\t\tptr += sprintf(ptr, \"%s%s\", pGen->m_genericName, pGen->m_pNext ? \", \" : \"\");\r\n\t\t\tpGen = pGen->m_pNext;\r\n\t\t} while(pGen);\r\n\t\tsprintf(ptr, \">\");\r\n\t}\r\n\treturn concat(buff);\r\n}\r\n\r\nconst char* TypeObject::dumpTypeForCode(NameSpace* ctx, Method* localMethod) {\r\n\t// Trick : dump return type, if pointer is null -> void.\r\n\tif (this == NULL) { \r\n\t\treturn \"void\";\r\n\t}\r\n\r\n\tif (!ctx) {\r\n\t\tctx = gRootNameSpace;\r\n\t}\r\n\r\n\tchar buffA[500];\r\n\tchar* ptr = buffA;\r\n\tfor (int n=0; n < this->m_ptrLevel; n++) {\r\n\t\tint v = sprintf(ptr, \"*\");\r\n\t\tptr += v;\r\n\t}\r\n\r\n\tif (this->m_originalType) {\r\n\t\tthis->m_originalType->getResolvedType(ctx, localMethod);\r\n\r\n\t\tint v = sprintf(ptr,this->m_originalType->dumpTypeForCode(ctx, localMethod));\r\n\t\tptr += v;\r\n\t} else {\r\n\r\n\t\tint v;\r\n\r\n\t\tthis->getResolvedType(ctx, localMethod);\r\n\r\n\t\tswitch (this->m_typeID) {\r\n\t\tcase TYPE_SBYTE:\tv = sprintf(ptr,\"s8\"); break;\r\n\t\tcase TYPE_BYTE:\t\tv = sprintf(ptr,\"u8\"); break;\r\n\t\tcase TYPE_SHORT:\tv = sprintf(ptr,\"s16\"); break;\r\n\t\tcase TYPE_USHORT:\tv = sprintf(ptr,\"u16\"); break;\r\n\t\tcase TYPE_CHAR:\t\tv = sprintf(ptr,\"u16\"); break;\r\n\t\tcase TYPE_INT:\t\tv = sprintf(ptr,\"s32\"); break;\r\n\t\tcase TYPE_UINT:\t\tv = sprintf(ptr,\"u32\"); break;\r\n\t\tcase TYPE_LONG:\t\tv = sprintf(ptr,\"s64\"); break;\r\n\t\tcase TYPE_ULONG:\tv = sprintf(ptr,\"u64\"); break;\r\n\t\tcase TYPE_FLOAT:\tv = sprintf(ptr,\"float\"); break;\r\n\t\tcase TYPE_DOUBLE:\tv = sprintf(ptr,\"double\"); break;\r\n\t\tcase TYPE_BOOL:\t\tv = sprintf(ptr,\"bool\"); break;\r\n\t\tcase TYPE_OBJECT:\tv = sprintf(ptr,\"System::Object*\"); break;\r\n\t\tcase TYPE_STRING:\tv = sprintf(ptr,\"System::String*\"); break;\r\n\t\tcase TYPE_VOID:\t\tv = sprintf(ptr,\"void\"); break;\r\n\t\tcase TYPE_NULL:\t\tv = sprintf(ptr,\"NULL\"); break;\r\n\t\tcase TYPE_INTPTR:\tv = sprintf(ptr,\"s32*\"); break;\r\n\t\tdefault:\t\t\t\r\n\t\t\tswitch (this->m_genreID) {\r\n\t\t\tcase EGENRE::_ABSTRACTCONTAINER: // Interface / Class / Struct\r\n\t\t\t\tif (this->m_definitionAC->m_modifier & ATT_STRUCT) {\r\n\t\t\t\t\tv = sprintf(ptr,\"%s%s\",this->getFullName(ctx), getGenParams());\r\n\t\t\t\t} else {\r\n\t\t\t\t\tv = sprintf(ptr,\"%s%s*\",this->getFullName(ctx), getGenParams());\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_DELEGATE:\r\n\t\t\t\t// Delegate\r\n\t\t\t\t// Interface / Class\r\n\t\t\t\tv = sprintf(ptr,\"%s*\",this->getFullName(ctx));\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_ENUM:\r\n\t\t\t\t// All the enum types are replaced with s32 to avoid dependency issues.\r\n\t\t\t\tv = sprintf(ptr,\"%s\",Enum::substitute());\r\n\t\t\t\tbreak;\r\n\t\t\tcase EGENRE::_GENDEFENTRY:\r\n\t\t\t\t// Generic definition entry\r\n\t\t\t\tv = sprintf(ptr,\"%s\",this->m_name);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"internal error\");\r\n\t\t\t\tv = 0;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tptr += v;\r\n\t}\r\n\r\n\t/*\r\n\tfor (int n=0; n< this->m_rankCount; n++) {\r\n\t\tint v;\r\n\t\tv = sprintf(ptr,\"[\"); ptr += v;\r\n\t\tfor (int m=1; m < this->m_ranks[n].m_dimensionCount; m++) {\r\n\t\t\tv = sprintf(ptr,\",\"); ptr += v;\r\n\t\t}\r\n\t\tv = sprintf(ptr,\"]\"); ptr += v;\r\n\t}*/\r\n\tif (this->isArray()) {\r\n\t\t// TODO : support rank count > 1\r\n\t\tif (this->m_rankCount == 1) {\r\n\t\t\tchar buff2[500];\r\n\t\t\tsprintf(buff2, \"System::Array<%s>*\", buffA);\r\n\t\t\tm_typeForCodeCache = strdup(buff2);\r\n\t\t} else {\r\n\t\t\treturn NULL;\t// Force invalid type for unsupported type.\r\n\t\t}\r\n\t} else {\r\n\t\tm_typeForCodeCache = strdup(buffA);\r\n\t}\r\n\treturn m_typeForCodeCache;\r\n}\r\n\r\nbool TypeObject::hasCompatibleGenerics(TypeObject* type, bool* out_identical) {\r\n\tbool compatible\t= true;\r\n\tbool identical\t= true;\r\n\tif(m_generic) {\r\n\t\tTypeGenericEntry* thisGen = m_generic;\r\n\t\tTypeGenericEntry* typeGen = type->m_generic;\r\n\t\tfor(; thisGen && typeGen ; thisGen = thisGen->m_pNext, typeGen = typeGen->m_pNext) {\r\n\t\t\tif(typeGen->m_instanceType->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\t\t\tidentical = false;\r\n\t\t\t} else if(thisGen->m_instanceType->m_res.pSymbol == typeGen->m_instanceType->m_res.pSymbol\r\n\t\t\t\t\t\t&& thisGen->m_instanceType->hasCompatibleGenerics(typeGen->m_instanceType, &identical)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcompatible = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif((thisGen != NULL) || (typeGen != NULL)) {\r\n\t\t\tcompatible = false;\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tcompatible = (type->m_generic == NULL);\r\n\t}\r\n\tif(out_identical) {\r\n\t\t*out_identical = (compatible && identical);\r\n\t}\r\n\treturn compatible;\r\n}\r\n\r\n// Returns true if the variable can be implicitly converted to the parameter type\r\n// TODO : support user-defined implicit conversions\r\nbool TypeObject::hasImplicitConversion(TypeObject* type) {\r\n\tu32 thisID = this->m_typeID;\r\n\tu32 typeID = type->m_typeID;\r\n\tif(thisID == TYPE_UNRESOLVED || typeID == TYPE_UNRESOLVED) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Tried to match an unresolved type\");\r\n\t\treturn false;\r\n\t}\r\n\tif(type->m_genreID == EGENRE::_ENUM) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Cannot test conversions to enum (the variable value is required)\");\r\n\t}\r\n\tif(thisID == typeID) {\r\n\t\tif(thisID == TYPE_ARRAY) {\r\n\t\t\tif(this->m_originalType) {\r\n\t\t\t\tif(type->m_originalType) {\r\n\t\t\t\t\treturn this->m_originalType->hasImplicitConversion(type->m_originalType);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn (type->m_originalType == NULL);\r\n\t\t}\r\n\t\treturn this->hasCompatibleGenerics(type);\r\n\t}\r\n\tif(type->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\treturn true;\r\n\t}\r\n\tif(this->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\treturn false;\r\n\t}\r\n\tif(this->m_typeID == TYPE_NULL) {\r\n\t\treturn type->isGC_Able();\r\n\t}\r\n\tif((thisID & ET_BASETYPE) || (typeID & ET_BASETYPE)) {\r\n\t\tif(!(thisID & ET_BASETYPE) || !(typeID & ET_BASETYPE)) {\r\n\t\t\treturn (this->m_genreID == EGENRE::_ENUM);\r\n\t\t}\r\n\t\tswitch(thisID) {\r\n\t\tcase TYPE_SBYTE :\r\n\t\t\treturn ((typeID & (TYPE_SHORT | TYPE_INT | TYPE_LONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_BYTE :\r\n\t\t\treturn ((typeID & (TYPE_SHORT | TYPE_USHORT | TYPE_INT | TYPE_UINT | TYPE_LONG | TYPE_ULONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_SHORT :\r\n\t\t\treturn ((typeID & (TYPE_INT | TYPE_LONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_USHORT :\r\n\t\t\treturn ((typeID & (TYPE_INT | TYPE_UINT | TYPE_LONG | TYPE_ULONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_INT :\r\n\t\t\treturn ((typeID & (TYPE_LONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_UINT :\r\n\t\t\treturn ((typeID & (TYPE_LONG | TYPE_ULONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_LONG :\r\n\t\t\treturn ((typeID & (TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_ULONG :\r\n\t\t\treturn ((typeID & (TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_CHAR :\r\n\t\t\treturn ((typeID & (TYPE_USHORT | TYPE_INT | TYPE_UINT | TYPE_LONG | TYPE_ULONG | TYPE_FLOAT | TYPE_DOUBLE)) == typeID);\r\n\t\tcase TYPE_FLOAT :\r\n\t\t\treturn (typeID == TYPE_DOUBLE);\r\n\t\tdefault :\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\tif(this->m_genreID == EGENRE::_ENUMENTRY || type->m_genreID == EGENRE::_ENUMENTRY) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Tested a conversion with an enum entry instead of an enum type\");\r\n\t\treturn false;\r\n\t}\r\n\tif(type->m_genreID == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\tif(typeID == TYPE_DELEGATE) {\r\n\t\t\t// Special case : delegate type as a System.Delegate class type parameter\r\n\t\t\tif(this->m_genreID == EGENRE::_DELEGATE) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(this->m_genreID != EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Class type expected\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tAbstractContainer* pAC = (AbstractContainer*)this->m_definitionAC;\r\n\t\tfor(int n = 0 ; n < pAC->m_inheritancesCount ; n++) {\r\n\t\t\tTypeObject* ancestorType = pAC->m_inheritances[n];\r\n\t\t\tancestorType->getResolvedType(pAC);\r\n\t\t\tif(ancestorType->hasImplicitConversion(type)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\tif(type->m_genreID == EGENRE::_DELEGATE) {\r\n\t\tif(this->m_genreID == EGENRE::_METHOD) {\r\n\t\t\treturn (compareSignatures(((Method*)this->m_res.pSymbol)->m_parameters, type->m_definitionDelegate->m_parameters) != EMATCH::M_MISMATCH);\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tcompilerError(ERR_INTERNAL, \"Unknown conversion test case\");\r\n\treturn false;\r\n}\r\n\r\n// Tells if conversion from type to type1 is better or worse than conversion from type to type2\r\nECOMPARISON\tcompareConversions(TypeObject* type, TypeObject* type1, TypeObject* type2) {\r\n\tif(type1->isAbstractArray() && type2->isAbstractArray()) {\r\n\t\treturn ECOMPARISON::COMP_EQUIVALENT;\r\n\t}\r\n\telse if(type->isAbstractArray() && type1->isAbstractArray() || !type->isAbstractArray() && !type1->isAbstractArray() && type2->isAbstractArray()) {\r\n\t\tif(type->m_typeID != type1->m_typeID) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Cannot compare impossible conversions\");\r\n\t\t}\r\n\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t}\r\n\telse if(type->isAbstractArray() && type2->isAbstractArray() || !type->isAbstractArray() && !type2->isAbstractArray() && type1->isAbstractArray()) {\r\n\t\tif(type->m_typeID != type2->m_typeID) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Cannot compare impossible conversions\");\r\n\t\t}\r\n\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t}\r\n\r\n\tif(!type->hasImplicitConversion(type1) || !type->hasImplicitConversion(type2)) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Cannot compare impossible conversions\");\r\n\t\treturn ECOMPARISON::COMP_EQUIVALENT;\r\n\t}\r\n\tu32 typeID1\t= type1->m_typeID;\r\n\tu32 typeID2\t= type2->m_typeID;\r\n\tu32 typeID\t= type->m_typeID;\r\n\tif(typeID1 == typeID2) {\r\n\t\tif((typeID == typeID1) && (typeID == TYPE_ARRAY)) {\r\n\t\t\treturn compareConversions(type->m_originalType, type1->m_originalType, type2->m_originalType);\r\n\t\t}\r\n\t\tbool identical;\r\n\t\tif(!type1->hasCompatibleGenerics(type2, &identical)) {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"There are no implicit conversions between generic arguments\");\r\n\t\t}\r\n\t\tif(identical) {\r\n\t\t\treturn ECOMPARISON::COMP_EQUIVALENT;\r\n\t\t}\r\n\t\treturn compareGenerics(type1, type2);\r\n\t}\r\n\tif(typeID == typeID1) {\r\n\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t}\r\n\tif(typeID == typeID2) {\r\n\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t}\r\n\tif(type1->hasImplicitConversion(type2) && !type2->hasImplicitConversion(type1)) {\r\n\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t}\r\n\tif(type2->hasImplicitConversion(type1) && !type1->hasImplicitConversion(type2)) {\r\n\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t}\r\n\tif((typeID1 & ET_BASETYPE) && (typeID2 & ET_BASETYPE)) {\r\n\t\tif((typeID1 == TYPE_SBYTE) && ((typeID2 & (TYPE_BYTE | TYPE_USHORT | TYPE_UINT | TYPE_ULONG)) == typeID2)) {\r\n\t\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t\t}\r\n\t\tif((typeID2 == TYPE_SBYTE) && ((typeID1 & (TYPE_BYTE | TYPE_USHORT | TYPE_UINT | TYPE_ULONG)) == typeID1)) {\r\n\t\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t\t}\r\n\t\tif((typeID1 == TYPE_SHORT) && ((typeID2 & (TYPE_USHORT | TYPE_UINT | TYPE_ULONG)) == typeID2)) {\r\n\t\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t\t}\r\n\t\tif((typeID2 == TYPE_SHORT) && ((typeID1 & (TYPE_USHORT | TYPE_UINT | TYPE_ULONG)) == typeID1)) {\r\n\t\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t\t}\r\n\t\tif((typeID1 == TYPE_INT) && ((typeID2 & (TYPE_UINT | TYPE_ULONG)) == typeID2)) {\r\n\t\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t\t}\r\n\t\tif((typeID2 == TYPE_INT) && ((typeID1 & (TYPE_UINT | TYPE_ULONG)) == typeID1)) {\r\n\t\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t\t}\r\n\t\tif((typeID1 == TYPE_LONG) && (typeID2 == TYPE_ULONG)) {\r\n\t\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t\t}\r\n\t\tif((typeID2 == TYPE_LONG) && (typeID1 == TYPE_ULONG)) {\r\n\t\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t\t}\r\n\t}\r\n\treturn ECOMPARISON::COMP_EQUIVALENT;\r\n}\r\n\r\n// COMP_BETTER means that type1 is more specialised than type2\r\nECOMPARISON compareGenerics(TypeObject* type1, TypeObject* type2) {\r\n\tTypeGenericEntry* pGen1 = type1->m_generic;\r\n\tTypeGenericEntry* pGen2 = type2->m_generic;\r\n\tif(pGen1 == NULL) {\r\n\t\tif(pGen2 == NULL) {\r\n\t\t\treturn ECOMPARISON::COMP_EQUIVALENT;\r\n\t\t}\r\n\t\treturn ECOMPARISON::COMP_BETTER;\r\n\t}\r\n\tif(pGen2 == NULL) {\r\n\t\treturn ECOMPARISON::COMP_WORSE;\r\n\t}\r\n\t\r\n\tECOMPARISON res = ECOMPARISON::COMP_EQUIVALENT;\r\n\r\n\tfor(; pGen1 && pGen2 ; pGen1 = pGen1->m_pNext, pGen2 = pGen2->m_pNext) {\r\n\t\tTypeObject* type1 = pGen1->m_instanceType;\r\n\t\tTypeObject* type2 = pGen2->m_instanceType;\r\n\t\tECOMPARISON currentComparison;\r\n\r\n\t\tif(type1->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\t\tif(type2->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\t\t\tcurrentComparison = ECOMPARISON::COMP_EQUIVALENT;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcurrentComparison = ECOMPARISON::COMP_WORSE;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(type2->m_genreID == EGENRE::_GENDEFENTRY) {\r\n\t\t\tcurrentComparison = ECOMPARISON::COMP_BETTER;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcurrentComparison = compareGenerics(type1, type2);\r\n\t\t}\r\n\r\n\t\tif(currentComparison == res || currentComparison == ECOMPARISON::COMP_EQUIVALENT) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif(res == ECOMPARISON::COMP_EQUIVALENT) {\r\n\t\t\t\tres = currentComparison;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn ECOMPARISON::COMP_EQUIVALENT;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif(pGen1 || pGen2) {\r\n\t\tcompilerError(ERR_INTERNAL, \"The number of argument does not match\");\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\nbool TypeObject::isAbstractArray() {\r\n\treturn (this->m_typeID == TYPE_ARRAY && !this->m_originalType);\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/TypeObject.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef TYPEOBJECT_H\r\n#define TYPEOBJECT_H\r\n\r\n#include \"BaseType.h\"\r\n\r\nclass TypeGenericDefinitionEntry : public Symbol {\r\npublic :\r\n\tconst char*\t\t\t\t\tm_genericName;\r\n\tTypeGenericDefinitionEntry*\tm_pNextGenericEntry;\r\n\r\n\tvirtual int getGenre();\r\n\tint\t\t\tnbEntries();\r\n};\r\n\r\nstruct TypeGenericEntry {\r\n\tconst char*\tm_genericName;\t\t// Not solved until we solve the owner TypeObject\r\n\tTypeObject*\tm_instanceType;\t\t// Not solved until resolution.\r\n\tTypeGenericEntry*\tm_pNext;\r\n};\r\n\r\nclass TypeObject : public Symbol {\r\npublic:\r\n\tTypeObject();\r\n\tTypeObject(EnumTypeObject defType);\r\n\t~TypeObject();\r\n\r\n\tvirtual int getGenre() { compilerError(ERR_INTERNAL,\"Internal Error : never use TypeObject::getGenre() !\"); return -1; }\r\n\tvirtual const char* getFullName(NameSpace* ref);\r\n\r\n\t// Helper functions for parser\r\n\tstatic TypeObject* getTypeObject(EnumTypeObject defType);\r\n\tstatic TypeObject* getTypeObject(const char* typeName, EnumTypeObject defType);\r\n\t\r\n\tTypeObject* getResolvedBlend(TypeObject* other);\r\n\tTypeObject* setGeneric(TypeGenericEntry* listGeneric);\r\n\tTypeObject* clone();\r\n\tTypeObject* createArrayType(int dimension);\r\n\tTypeObject* addPointer\t();\r\n\tTypeObject* addRank\t\t(int rank);\t// Null return this.\r\n\tTypeObject* addType\t\t(TypeObject* type);\r\n\tconst char*\tgetGenParams();\r\n\tconst char* dumpTypeForCode(NameSpace* ctx, Method* localMethod = NULL);\r\n\tSRSymbol\tgetResolvedType(NameSpace* nameSpaceContext, Method* localMethod = NULL);\r\n\tbool\t\thasCompatibleGenerics(TypeObject* type, bool* out_identical = NULL);\r\n\tbool\t\thasImplicitConversion(TypeObject* type);\r\n\tbool\t\tisArray\t\t()\t{ return m_rankCount >= 1; }\r\n\tTypeObject*\tgetArrayType();\r\n\r\n\tinline\r\n\tbool\t\tisGC_Able\t() { return m_isGC_Able; }\r\n\r\n\tbool\tm_isGC_Able;\r\n\tEnumTypeObject\tm_typeID;\r\n\tint\t\t\t\tm_genreID;\r\n\r\n\tNameSpace*\t\t\t\t\tm_definitionNameSpace;\r\n\tAbstractContainer*\t\t\tm_definitionAC;\r\n\tEnum*\t\t\t\t\t\tm_definitionEnum;\r\n\tDelegate*\t\t\t\t\tm_definitionDelegate;\r\n\tTypeGenericDefinitionEntry*\tm_definitionGeneric;\r\n\tSRSymbol\t\t\t\t\tm_res;\r\n\tTypeObject*\t\t\t\t\tm_originalType;\r\n\r\n\tstruct SRank {\r\n\t\tint\tm_dimensionCount;\r\n\t};\r\n\tSRank*\tm_ranks;\r\n\tint\t\tm_rankCount;\r\n\tint\t\tm_ptrLevel;\r\n\tconst char*\tm_typeForCodeCache;\r\n\r\n\tTypeGenericEntry* m_generic;\r\n\r\n\tvoid addRankInternal(SRank rank);\r\n\r\n\tbool isAbstractArray();\r\n};\r\n\r\nvoid addGenericType(TypeObject* type);\r\nTypeGenericEntry* GetGenericType();\r\n\r\nECOMPARISON\tcompareConversions(TypeObject* type, TypeObject* type1, TypeObject* type2);\r\nECOMPARISON compareGenerics(TypeObject* type1, TypeObject* type2);\r\n\r\n#endif\t//TYPEOBJECT_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/UTF8Parse.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __NVM_UTF8_CONV__\r\n#define __NVM_UTF8_CONV__\r\n\r\n// #include \"NVMtypes.h\"\r\n#include \"BaseType.h\"\r\n\r\n#define UTF8_ACCEPT 0\r\n#define UTF8_REJECT 1\r\n\r\nu32 toUtf16(const u8* src, u32 srcSizeByte, u16* dst, u32 dstSizeWord);\r\n\r\n#endif\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/UTF8Parser.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>\r\n// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.\r\n// Further optimization commited by R.Piquois <laxer3a@hotmail.com>\r\n//\r\n#include \"UTF8Parse.h\"\r\n\r\n// 10x4 + 11x4 = 84 byte\r\nstatic const u32 utf8d[] = {\r\n\t/* Original compacted table ==> Need to reverse the BIT by quad.\r\n\t0x00000000,\t// 0\r\n\t0x11111111,\t// 1\r\n\t0x22222222,\t// 2\r\n\t0x33333433,\t// 3\t--> Special pattern.\r\n\t0x88222222,\t// 4\t--> Special pattern.\r\n\t0xA3333333,\t// 5\t--> Special pattern.\r\n\t0xB6665888,\t// 6\t--> Special pattern.\r\n\t0x77777777,\t// 7\r\n\t0x88888888,\t// 8\r\n\t0x99999999,\t// 9\r\n\t*/\r\n\t0x00000000,\t// 0\r\n\t0x11111111,\t// 1\r\n\t0x22222222,\t// 2\r\n\t0x33433333,\t// 3\t--> Special pattern.\r\n\t0x22222288,\t// 4\t--> Special pattern.\r\n\t0x3333333A,\t// 5\t--> Special pattern.\r\n\t0x8885666B,\t// 6\t--> Special pattern.\r\n\t0x77777777,\t// 7\r\n\t0x88888888,\t// 8\r\n\t0x99999999,\t// 9\r\n\r\n\t// State Table Compressed Entry.\r\n\t0x17853210,\t// IT0\r\n\t0x11116411,\t// IT1\r\n\t0x11111111,\t// IT2\r\n\t0x01111101,\t// IT3\r\n\t0x11111101,\t// IT4\r\n\t0x21111121,\t// IT5\r\n\t0x11111121,\t// IT6\r\n\t0x21111111,\t// IT7\r\n\t0x31111111,\t// IT8\r\n\t0x11111131,\t// IT9\r\n\t0x31111131,\t// ITA\r\n};             \r\n\r\n#define IT0\t(10)\r\n#define IT1\t(11)\r\n#define IT2\t(12)\r\n#define IT3\t(13)\r\n#define IT4\t(14)\r\n#define IT5\t(15)\r\n#define IT6\t(16)\r\n#define IT7\t(17)\r\n#define IT8\t(18)\r\n#define IT9\t(19)\r\n#define ITA\t(20)\r\n\r\n// Could compact this table in 16 bytes, but overhead of shift and decode is pretty pointless.\r\n// 32 Bytes.\r\nstatic const u8 code[] = {\r\n\t/*\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 00..1f\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 20..3f\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 40..5f\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 60..7f\r\n\t1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9, // 80..9f\r\n\t7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, // a0..bf\r\n\t8,8,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, // c0..df\r\n\tA,3,3,3,3,3,3,3, 3,3,3,3,3,4,3,3, // e0..ef\r\n\tB,6,6,6,5,8,8,8, 8,8,8,8,8,8,8,8, // f0..ff\r\n\t*/\r\n\t0,0,0,0, // 00..1f\r\n\t0,0,0,0, // 20..3f\r\n\t0,0,0,0, // 40..5f\r\n\t0,0,0,0, // 60..7f\r\n\t1,1,9,9, // 80..9f\r\n\t7,7,7,7, // A0..BF\r\n\t4,2,2,2, // C0..DF\r\n\t5,3,6,8, // E0..FF\r\n};\r\n\r\n// 18 Byte table.\r\nstatic const u8 code2[] = {\r\n/*\tOriginal, non reverse packed.\r\n\t0x01,0x23,0x58,0x71,0x11,0x46,0x11,0x11, // s0..s0\r\n\t0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,\r\n\t0x10,0x11,0x11,0x10,0x10,0x11,0x11,0x11, // s1..s2\r\n\t0x12,0x11,0x11,0x12,0x12,0x11,0x11,0x11,\r\n\t0x11,0x11,0x11,0x12,0x11,0x11,0x11,0x11, // s3..s4\r\n\t0x12,0x11,0x11,0x11,0x12,0x11,0x11,0x11,\r\n\t0x11,0x11,0x11,0x13,0x13,0x11,0x11,0x11, // s5..s6\r\n\t0x13,0x11,0x11,0x13,0x13,0x11,0x11,0x11,\r\n\t0x13,0x11,0x11,0x11,0x11,0x11,0x11,0x11,  // s7 ..s8\r\n\t*/\r\n\r\n\t/* Compressed Version Non Reverse\r\n\t0x01235871,0x11461111, // s0..s0\r\n\t0x11111111,0x11111111,\r\n\t0x10111110,0x10111111, // s1..s2\r\n\t0x12111112,0x12111111,\r\n\t0x11111112,0x11111111, // s3..s4\r\n\t0x12111111,0x12111111,\r\n\t0x11111113,0x13111111, // s5..s6\r\n\t0x13111113,0x13111111,\r\n\t0x13111111,0x11111111,  // s7 ..s8*/\r\n\r\n\tIT0,IT1, // s0..s0\r\n\tIT2,IT2,\r\n\tIT3,IT4, // s1..s2\r\n\tIT5,IT6,\r\n\tIT7,IT2, // s3..s4\r\n\tIT6,IT6,\r\n\tIT8,IT9, // s5..s6\r\n\tITA,IT9,\r\n\tIT9,IT2, // s7..s8\r\n};\r\n\r\nu32 decode(u32* state, u32* codep, u8 byte) {\r\n  u32 type = (utf8d[code[byte>>3]]>>((byte & 7)<<2)) & 0xF;\r\n\r\n  *codep = (*state != UTF8_ACCEPT) ?\r\n    (byte & 0x3fu) | (*codep << 6) :\r\n    (0xff >> type) & (byte);\r\n\r\n  byte = (u8)((*state)*16 + type);\r\n  *state = (utf8d[code2[byte>>3]]>>((byte & 7)<<2)) & 0xF;\r\n  return *state;\r\n}\r\n\r\nu32 toUtf16(const u8* src, u32 srcSizeBytes, u16* dst, u32 dstSizeWord) {\r\n\tconst u8* src_actual_end = src + srcSizeBytes;\r\n\tconst u8* s = src;\r\n\tu16* d = dst;\r\n\tu32 codepoint;\r\n\tu32 state = 0;\r\n\tu32 count = 0;\r\n\r\n\twhile (s < src_actual_end) {\r\n\t\tu32 dst_words_free = dstSizeWord - (d - dst);\r\n\t\tconst u8* src_current_end = s + dst_words_free;\r\n\r\n\t\tif (src_actual_end < src_current_end)\r\n\t\t\tsrc_current_end = src_actual_end;\r\n\r\n\t\tif (src_current_end <= s) {\r\n\t\t\tgoto toosmall;\r\n\t\t}\r\n\r\n\t\twhile (s < src_current_end) {\r\n\r\n\t\t\tif (decode(&state, &codepoint, *s++))\r\n\t\t\tcontinue;\r\n\r\n\t\t\tif (codepoint > 0xffff) {\r\n\t\t\t\t*d++ = (u16)(0xD7C0 + (codepoint >> 10));\r\n\t\t\t\t*d++ = (u16)(0xDC00 + (codepoint & 0x3FF));\r\n\t\t\t\tcount += 2;\r\n\t\t\t} else {\r\n\t\t\t\t*d++ = (u16)codepoint;\r\n\t\t\t\tcount += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\ntoosmall:\r\n  /*\r\n  if (state != UTF8_ACCEPT) {\r\n    ...\r\n  }\r\n\r\n  if ((dstWords - (d - dst)) == 0)\r\n    goto toosmall;\r\n\r\n  *d++ = 0;\r\n  ...\r\n\r\n  ...\r\n  */\r\n  return count;\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Variable.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n\r\nVariable::Variable\t() \r\n:m_pNextVariable\t(NULL)\r\n,m_expression\t\t(NULL)\r\n,m_attribute\t\t(NULL)\r\n,m_modifier\t\t\t(0)\r\n,m_type\t\t\t\t(NULL)\r\n,m_bEndless\t\t\t(false)\r\n,m_ignoreDelegate\t(false)\r\n,m_dependancyList\t(NULL)\r\n,m_ownerClass\t\t(NULL)\r\n{\r\n\t// Invalid for a constant.\r\n\tm_value.type = TYPE_UNRESOLVED;\r\n}\r\n\r\nVariable::~Variable() {\r\n}\r\n\r\nvoid Variable::markSetupDependancy() {\r\n\tbool analysis = g_analysis_static;\r\n\tg_analysis_static = true;\r\n\r\n\tif (m_expression) { m_expression->AnalysisAndTransform(); }\r\n\r\n\tg_analysis_static = analysis;\r\n}\r\n\r\nVariable* Variable::addVariable\t(Variable* pNextVariable) {\r\n\tVariable* p = this;\r\n\twhile (p->m_pNextVariable) {\r\n\t\tp = p->m_pNextVariable;\r\n\t}\r\n\tp->m_pNextVariable = pNextVariable;\r\n\treturn this;\r\n}\r\n\r\nVariable* Variable::setInitializer(Expression* pExpr) {\r\n\tthis->m_expression = pExpr;\r\n\treturn this;\r\n}\r\n\r\nVariable* Variable::setAttribute\t(Attribute* attrib) {\r\n\tthis->m_attribute = attrib;\r\n\treturn this;\r\n}\r\n\r\nVariable* Variable::setModifier\t(u32 modifier) {\r\n\tthis->m_modifier |= modifier;\r\n\treturn this;\r\n}\r\n\r\nVariable* Variable::setType\t\t(TypeObject* type) {\r\n\tthis->m_type = type;\r\n\treturn this;\r\n}\r\n\r\nVariable* Variable::setIsEndLessParam\t() {\r\n\tthis->m_bEndless = true;\r\n\treturn this;\r\n}\r\n\r\nVariable* Variable::setValue\t\t(SValue v) {\r\n\tm_value = v;\r\n\treturn this;\r\n}\r\n\r\nbool Variable::hasImplicitConversion(TypeObject* type) {\r\n\tif(this->m_type->hasImplicitConversion(type)) {\r\n\t\treturn true;\r\n\t}\r\n\tif((this->m_expression->m_expressionType == EXPR_CTE) && (this->m_value.v.i == 0) && (type->getGenre() == EGENRE::_ENUM)) {\r\n\t\t// 0 can be implicitly casted into any enum\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nStatement*  CreateVarStatement\t(EnumStatementType statementType, Statement* brother, Statement* child, Variable* vars, TypeObject* type) {\r\n\tStatement* pStatement = new Statement();\r\n\tpStatement->m_statementType = statementType;\r\n\tpStatement->addChild(child);\r\n\tpStatement->addNext(brother);\r\n\tpStatement->m_type = type;\r\n\tpStatement->m_vars = vars;\r\n\t\r\n\t// Assign type to all variables.\r\n\tVariable* pVar = vars;\r\n\tVariable* pPrevVar = NULL;\r\n\twhile (pVar) {\r\n\t\tpVar->m_type = type;\r\n\t\tStatement* pSubStatement = new Statement();\r\n\t\tpSubStatement->m_statementType = STM_LOCAL_PERVAR;\r\n\r\n\t\t// var = ...\r\n\t\tif (pVar->m_expression) {\r\n\t\t\tExpression* assign = CreateDoubleExpr(EXPR_ASS_EQ, \r\n\t\t\t\tCreateLeafExpr(EXPR_IDENT)->setIdentifier(pVar->getName()),\r\n\t\t\t\tpVar->m_expression\r\n\t\t\t);\r\n\t\t\tpSubStatement->setExpression(assign);\r\n\t\t}\r\n\t\t\r\n\t\tpStatement->addChild(pSubStatement);\r\n\t\tpSubStatement->m_vars = pVar;\r\n\t\tpSubStatement->m_bConstant;\r\n\t\tpPrevVar = pVar;\r\n\t\tpVar = pVar->m_pNextVariable;\r\n\t}\r\n\treturn pStatement;\r\n}\r\n\r\nVariable*   CreateVarInstance\t(const char* varName) {\r\n\tVariable* var = new Variable();\r\n\tvar->setName(varName);\r\n\treturn var;\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/Variable.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef VARIABLE_H\r\n#define VARIABLE_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"Symbol.h\"\r\n\r\nclass Attribute;\r\nclass Expression;\r\nclass Statement;\r\nclass Symbol;\r\nclass TypeObject;\r\n\r\nclass Variable : public Symbol {\r\npublic:\r\n\tVariable();\r\n\t~Variable();\r\n\r\n\tvirtual int getGenre() { return EGENRE::_VARIABLE; }\r\n\r\n\tVariable* addVariable\t(Variable* pNextVariable);\r\n\tVariable* setInitializer(Expression* pExpr);\r\n\r\n\tVariable* setAttribute\t(Attribute* attrib);\r\n\tVariable* setModifier\t(u32 modified);\r\n\tVariable* setType\t\t(TypeObject* type);\r\n\tVariable* setIsEndLessParam\t();\r\n\tVariable* setValue\t\t(SValue v);\r\n\r\n\tvoid\tmarkSetupDependancy\t();\r\n\r\n\tvoid\t\tdumpVariable();\r\n\tvoid\t\tdumpMember\t(NameSpace* nameSpaceContext);\r\n\r\n\tbool\thasImplicitConversion(TypeObject* type);\r\n\r\n\tAbstractContainer*\tm_ownerClass;\r\n\tVariable*\tm_pNextVariable;\r\n\tExpression*\tm_expression;\r\n\tAttribute*\tm_attribute;\r\n\tu32\t\t\tm_modifier;\r\n\tTypeObject*\tm_type;\r\n\tbool\t\tm_bEndless;\r\n\tbool\t\tm_ignoreDelegate;\r\n\tSValue\t\tm_value;\r\nprotected:\r\n\tstruct VarDependancy {\r\n\t\tVarDependancy*\tm_pNext;\r\n\t\tVariable*\t\tm_uses;\r\n\t};\r\n\tVarDependancy*\tm_dependancyList;\r\n};\r\n\r\nStatement*  CreateVarStatement\t(EnumStatementType statementType, Statement* brother, Statement* child, Variable* vars, TypeObject* type);\r\n\r\nVariable*   CreateVarInstance\t(const char* varName);\r\n\r\n#endif\t//VARIABLE_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/bison.simple",
    "content": "/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */\r\n#line 3 \"bison.simple\"\r\n\r\n/* Skeleton output parser for bison,\r\n   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.\r\n\r\n   This program is free software; you can redistribute it and/or modify\r\n   it under the terms of the GNU General Public License as published by\r\n   the Free Software Foundation; either version 2, or (at your option)\r\n   any later version.\r\n\r\n   This program is distributed in the hope that it will be useful,\r\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n   GNU General Public License for more details.\r\n\r\n   You should have received a copy of the GNU General Public License\r\n   along with this program; if not, write to the Free Software\r\n   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */\r\n\r\n/* As a special exception, when this file is copied by Bison into a\r\n   Bison output file, you may use that output file without restriction.\r\n   This special exception was added by the Free Software Foundation\r\n   in version 1.24 of Bison.  */\r\n\r\n#ifndef alloca\r\n#ifdef __GNUC__\r\n#define alloca __builtin_alloca\r\n#else /* not GNU C.  */\r\n#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)\r\n#include <alloca.h>\r\n#else /* not sparc */\r\n#if defined (MSDOS) && !defined (__TURBOC__)\r\n#include <malloc.h>\r\n#else /* not MSDOS, or __TURBOC__ */\r\n#if defined(_AIX)\r\n#include <malloc.h>\r\n #pragma alloca\r\n#else /* not MSDOS, __TURBOC__, or _AIX */\r\n#ifdef __hpux\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\nvoid *alloca (unsigned int);\r\n};\r\n#else /* not __cplusplus */\r\nvoid *alloca ();\r\n#endif /* not __cplusplus */\r\n#endif /* __hpux */\r\n#endif /* not _AIX */\r\n#endif /* not MSDOS, or __TURBOC__ */\r\n#endif /* not sparc.  */\r\n#endif /* not GNU C.  */\r\n#endif /* alloca not defined.  */\r\n\r\n/* This is the parser code that is written into each bison parser\r\n  when the %semantic_parser declaration is not specified in the grammar.\r\n  It was written by Richard Stallman by simplifying the hairy parser\r\n  used when %semantic_parser is specified.  */\r\n\r\n/* Note: there must be only one dollar sign in this file.\r\n   It is replaced by the list of actions, each action\r\n   as one case of the switch.  */\r\n\r\n#define yyerrok\t\t(yyerrstatus = 0)\r\n#define yyclearin\t(yychar = YYEMPTY)\r\n#define YYEMPTY\t\t-2\r\n#define YYEOF\t\t0\r\n#define YYACCEPT\treturn(0)\r\n#define YYABORT \treturn(1)\r\n#define YYERROR\t\tgoto yyerrlab1\r\n/* Like YYERROR except do call yyerror.\r\n   This remains here temporarily to ease the\r\n   transition to the new meaning of YYERROR, for GCC.\r\n   Once GCC version 2 has supplanted version 1, this can go.  */\r\n#define YYFAIL\t\tgoto yyerrlab\r\n#define YYRECOVERING()  (!!yyerrstatus)\r\n#define YYBACKUP(token, value) \\\r\ndo\t\t\t\t\t\t\t\t\\\r\n  if (yychar == YYEMPTY && yylen == 1)\t\t\t\t\\\r\n    { yychar = (token), yylval = (value);\t\t\t\\\r\n      yychar1 = YYTRANSLATE (yychar);\t\t\t\t\\\r\n      YYPOPSTACK;\t\t\t\t\t\t\\\r\n      goto yybackup;\t\t\t\t\t\t\\\r\n    }\t\t\t\t\t\t\t\t\\\r\n  else\t\t\t\t\t\t\t\t\\\r\n    { yyerror (\"syntax error: cannot back up\"); YYERROR; }\t\\\r\nwhile (0)\r\n\r\n#define YYTERROR\t1\r\n#define YYERRCODE\t256\r\n\r\n#ifndef YYPURE\r\n#define YYLEX\t\tyylex()\r\n#endif\r\n\r\n#ifdef YYPURE\r\n#ifdef YYLSP_NEEDED\r\n#ifdef YYLEX_PARAM\r\n#define YYLEX\t\tyylex(&yylval, &yylloc, YYLEX_PARAM)\r\n#else\r\n#define YYLEX\t\tyylex(&yylval, &yylloc)\r\n#endif\r\n#else /* not YYLSP_NEEDED */\r\n#ifdef YYLEX_PARAM\r\n#define YYLEX\t\tyylex(&yylval, YYLEX_PARAM)\r\n#else\r\n#define YYLEX\t\tyylex(&yylval)\r\n#endif\r\n#endif /* not YYLSP_NEEDED */\r\n#endif\r\n\r\n/* If nonreentrant, generate the variables here */\r\n\r\n#ifndef YYPURE\r\n\r\nint\tyychar;\t\t\t/*  the lookahead symbol\t\t*/\r\nYYSTYPE\tyylval;\t\t\t/*  the semantic value of the\t\t*/\r\n\t\t\t\t/*  lookahead symbol\t\t\t*/\r\n\r\n#ifdef YYLSP_NEEDED\r\nYYLTYPE yylloc;\t\t\t/*  location data for the lookahead\t*/\r\n\t\t\t\t/*  symbol\t\t\t\t*/\r\n#endif\r\n\r\nint yynerrs;\t\t\t/*  number of parse errors so far       */\r\n#endif  /* not YYPURE */\r\n\r\n#if YYDEBUG != 0\r\nint yydebug;\t\t\t/*  nonzero means print parse trace\t*/\r\n/* Since this is uninitialized, it does not stop multiple parsers\r\n   from coexisting.  */\r\n#endif\r\n\r\n/*  YYINITDEPTH indicates the initial size of the parser's stacks\t*/\r\n\r\n#ifndef\tYYINITDEPTH\r\n#define YYINITDEPTH 200\r\n#endif\r\n\r\n/*  YYMAXDEPTH is the maximum size the stacks can grow to\r\n    (effective only if the built-in stack extension method is used).  */\r\n\r\n#if YYMAXDEPTH == 0\r\n#undef YYMAXDEPTH\r\n#endif\r\n\r\n#ifndef YYMAXDEPTH\r\n#define YYMAXDEPTH 10000\r\n#endif\r\n\r\n/* Prevent warning if -Wstrict-prototypes.  */\r\n#ifdef __GNUC__\r\nint yyparse (void);\r\n#endif\r\n\f\r\n#if __GNUC__ > 1\t\t/* GNU C and GNU C++ define this.  */\r\n#define __yy_memcpy(FROM,TO,COUNT)\t__builtin_memcpy(TO,FROM,COUNT)\r\n#else\t\t\t\t/* not GNU C or C++ */\r\n#ifndef __cplusplus\r\n\r\n/* This is the most reliable way to avoid incompatibilities\r\n   in available built-in functions on various systems.  */\r\nstatic void\r\n__yy_memcpy (from, to, count)\r\n     char *from;\r\n     char *to;\r\n     int count;\r\n{\r\n  register char *f = from;\r\n  register char *t = to;\r\n  register int i = count;\r\n\r\n  while (i-- > 0)\r\n    *t++ = *f++;\r\n}\r\n\r\n#else /* __cplusplus */\r\n\r\n/* This is the most reliable way to avoid incompatibilities\r\n   in available built-in functions on various systems.  */\r\nstatic void\r\n__yy_memcpy (char *from, char *to, int count)\r\n{\r\n  register char *f = from;\r\n  register char *t = to;\r\n  register int i = count;\r\n\r\n  while (i-- > 0)\r\n    *t++ = *f++;\r\n}\r\n\r\n#endif\r\n#endif\r\n\f\r\n#line 192 \"bison.simple\"\r\n\r\n/* The user can define YYPARSE_PARAM as the name of an argument to be passed\r\n   into yyparse.  The argument should have type void *.\r\n   It should actually point to an object.\r\n   Grammar actions can access the variable by casting it\r\n   to the proper pointer type.  */\r\n\r\n#ifdef YYPARSE_PARAM\r\n#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;\r\n#else\r\n#define YYPARSE_PARAM\r\n#define YYPARSE_PARAM_DECL\r\n#endif\r\n\r\nint\r\nyyparse(YYPARSE_PARAM)\r\n     YYPARSE_PARAM_DECL\r\n{\r\n  register int yystate;\r\n  register int yyn;\r\n  register short *yyssp;\r\n  register YYSTYPE *yyvsp;\r\n  int yyerrstatus;\t/*  number of tokens to shift before error messages enabled */\r\n  int yychar1 = 0;\t\t/*  lookahead token as an internal (translated) token number */\r\n\r\n  short\tyyssa[YYINITDEPTH];\t/*  the state stack\t\t\t*/\r\n  YYSTYPE yyvsa[YYINITDEPTH];\t/*  the semantic value stack\t\t*/\r\n\r\n  short *yyss = yyssa;\t\t/*  refer to the stacks thru separate pointers */\r\n  YYSTYPE *yyvs = yyvsa;\t/*  to allow yyoverflow to reallocate them elsewhere */\r\n\r\n#ifdef YYLSP_NEEDED\r\n  YYLTYPE yylsa[YYINITDEPTH];\t/*  the location stack\t\t\t*/\r\n  YYLTYPE *yyls = yylsa;\r\n  YYLTYPE *yylsp;\r\n\r\n#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)\r\n#else\r\n#define YYPOPSTACK   (yyvsp--, yyssp--)\r\n#endif\r\n\r\n  int yystacksize = YYINITDEPTH;\r\n\r\n#ifdef YYPURE\r\n  int yychar;\r\n  YYSTYPE yylval;\r\n  int yynerrs;\r\n#ifdef YYLSP_NEEDED\r\n  YYLTYPE yylloc;\r\n#endif\r\n#endif\r\n\r\n  YYSTYPE yyval;\t\t/*  the variable used to return\t\t*/\r\n\t\t\t\t/*  semantic values from the action\t*/\r\n\t\t\t\t/*  routines\t\t\t\t*/\r\n\r\n  int yylen;\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Starting parse\\n\");\r\n#endif\r\n\r\n  yystate = 0;\r\n  yyerrstatus = 0;\r\n  yynerrs = 0;\r\n  yychar = YYEMPTY;\t\t/* Cause a token to be read.  */\r\n\r\n  /* Initialize stack pointers.\r\n     Waste one element of value and location stack\r\n     so that they stay on the same level as the state stack.\r\n     The wasted elements are never initialized.  */\r\n\r\n  yyssp = yyss - 1;\r\n  yyvsp = yyvs;\r\n#ifdef YYLSP_NEEDED\r\n  yylsp = yyls;\r\n#endif\r\n\r\n/* Push a new state, which is found in  yystate  .  */\r\n/* In all cases, when you get here, the value and location stacks\r\n   have just been pushed. so pushing a state here evens the stacks.  */\r\nyynewstate:\r\n\r\n  *++yyssp = yystate;\r\n\r\n  if (yyssp >= yyss + yystacksize - 1)\r\n    {\r\n      /* Give user a chance to reallocate the stack */\r\n      /* Use copies of these so that the &'s don't force the real ones into memory. */\r\n      YYSTYPE *yyvs1 = yyvs;\r\n      short *yyss1 = yyss;\r\n#ifdef YYLSP_NEEDED\r\n      YYLTYPE *yyls1 = yyls;\r\n#endif\r\n\r\n      /* Get the current used size of the three stacks, in elements.  */\r\n      int size = yyssp - yyss + 1;\r\n\r\n#ifdef yyoverflow\r\n      /* Each stack pointer address is followed by the size of\r\n\t the data in use in that stack, in bytes.  */\r\n#ifdef YYLSP_NEEDED\r\n      /* This used to be a conditional around just the two extra args,\r\n\t but that might be undefined if yyoverflow is a macro.  */\r\n      yyoverflow(\"parser stack overflow\",\r\n\t\t &yyss1, size * sizeof (*yyssp),\r\n\t\t &yyvs1, size * sizeof (*yyvsp),\r\n\t\t &yyls1, size * sizeof (*yylsp),\r\n\t\t &yystacksize);\r\n#else\r\n      yyoverflow(\"parser stack overflow\",\r\n\t\t &yyss1, size * sizeof (*yyssp),\r\n\t\t &yyvs1, size * sizeof (*yyvsp),\r\n\t\t &yystacksize);\r\n#endif\r\n\r\n      yyss = yyss1; yyvs = yyvs1;\r\n#ifdef YYLSP_NEEDED\r\n      yyls = yyls1;\r\n#endif\r\n#else /* no yyoverflow */\r\n      /* Extend the stack our own way.  */\r\n      if (yystacksize >= YYMAXDEPTH)\r\n\t{\r\n\t  yyerror(\"parser stack overflow\");\r\n\t  return 2;\r\n\t}\r\n      yystacksize *= 2;\r\n      if (yystacksize > YYMAXDEPTH)\r\n\tyystacksize = YYMAXDEPTH;\r\n      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));\r\n      __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));\r\n      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));\r\n      __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));\r\n#ifdef YYLSP_NEEDED\r\n      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));\r\n      __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));\r\n#endif\r\n#endif /* no yyoverflow */\r\n\r\n      yyssp = yyss + size - 1;\r\n      yyvsp = yyvs + size - 1;\r\n#ifdef YYLSP_NEEDED\r\n      yylsp = yyls + size - 1;\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Stack size increased to %d\\n\", yystacksize);\r\n#endif\r\n\r\n      if (yyssp >= yyss + yystacksize - 1)\r\n\tYYABORT;\r\n    }\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Entering state %d\\n\", yystate);\r\n#endif\r\n\r\n  goto yybackup;\r\n yybackup:\r\n\r\n/* Do appropriate processing given the current state.  */\r\n/* Read a lookahead token if we need one and don't already have one.  */\r\n/* yyresume: */\r\n\r\n  /* First try to decide what to do without reference to lookahead token.  */\r\n\r\n  yyn = yypact[yystate];\r\n  if (yyn == YYFLAG)\r\n    goto yydefault;\r\n\r\n  /* Not known => get a lookahead token if don't already have one.  */\r\n\r\n  /* yychar is either YYEMPTY or YYEOF\r\n     or a valid token in external form.  */\r\n\r\n  if (yychar == YYEMPTY)\r\n    {\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Reading a token: \");\r\n#endif\r\n      yychar = YYLEX;\r\n    }\r\n\r\n  /* Convert token to internal form (in yychar1) for indexing tables with */\r\n\r\n  if (yychar <= 0)\t\t/* This means end of input. */\r\n    {\r\n      yychar1 = 0;\r\n      yychar = YYEOF;\t\t/* Don't call YYLEX any more */\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Now at end of input.\\n\");\r\n#endif\r\n    }\r\n  else\r\n    {\r\n      yychar1 = YYTRANSLATE(yychar);\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\t{\r\n\t  fprintf (stderr, \"Next token is %d (%s\", yychar, yytname[yychar1]);\r\n\t  /* Give the individual parser a way to print the precise meaning\r\n\t     of a token, for further debugging info.  */\r\n#ifdef YYPRINT\r\n\t  YYPRINT (stderr, yychar, yylval);\r\n#endif\r\n\t  fprintf (stderr, \")\\n\");\r\n\t}\r\n#endif\r\n    }\r\n\r\n  yyn += yychar1;\r\n  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)\r\n    goto yydefault;\r\n\r\n  yyn = yytable[yyn];\r\n\r\n  /* yyn is what to do for this token type in this state.\r\n     Negative => reduce, -yyn is rule number.\r\n     Positive => shift, yyn is new state.\r\n       New state is final state => don't bother to shift,\r\n       just return success.\r\n     0, or most negative number => error.  */\r\n\r\n  if (yyn < 0)\r\n    {\r\n      if (yyn == YYFLAG)\r\n\tgoto yyerrlab;\r\n      yyn = -yyn;\r\n      goto yyreduce;\r\n    }\r\n  else if (yyn == 0)\r\n    goto yyerrlab;\r\n\r\n  if (yyn == YYFINAL)\r\n    YYACCEPT;\r\n\r\n  /* Shift the lookahead token.  */\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Shifting token %d (%s), \", yychar, yytname[yychar1]);\r\n#endif\r\n\r\n  /* Discard the token being shifted unless it is eof.  */\r\n  if (yychar != YYEOF)\r\n    yychar = YYEMPTY;\r\n\r\n  *++yyvsp = yylval;\r\n#ifdef YYLSP_NEEDED\r\n  *++yylsp = yylloc;\r\n#endif\r\n\r\n  /* count tokens shifted since error; after three, turn off error status.  */\r\n  if (yyerrstatus) yyerrstatus--;\r\n\r\n  yystate = yyn;\r\n  goto yynewstate;\r\n\r\n/* Do the default action for the current state.  */\r\nyydefault:\r\n\r\n  yyn = yydefact[yystate];\r\n  if (yyn == 0)\r\n    goto yyerrlab;\r\n\r\n/* Do a reduction.  yyn is the number of a rule to reduce with.  */\r\nyyreduce:\r\n  yylen = yyr2[yyn];\r\n  if (yylen > 0)\r\n    yyval = yyvsp[1-yylen]; /* implement default value of the action */\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    {\r\n      int i;\r\n\r\n      fprintf (stderr, \"Reducing via rule %d (line %d), \",\r\n\t       yyn, yyrline[yyn]);\r\n\r\n      /* Print the symbols being reduced, and their result.  */\r\n      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)\r\n\tfprintf (stderr, \"%s \", yytname[yyrhs[i]]);\r\n      fprintf (stderr, \" -> %s\\n\", yytname[yyr1[yyn]]);\r\n    }\r\n#endif\r\n\r\n$   /* the action file gets copied in in place of this dollarsign */\r\n#line 487 \"bison.simple\"\r\n\f\r\n  yyvsp -= yylen;\r\n  yyssp -= yylen;\r\n#ifdef YYLSP_NEEDED\r\n  yylsp -= yylen;\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    {\r\n      short *ssp1 = yyss - 1;\r\n      fprintf (stderr, \"state stack now\");\r\n      while (ssp1 != yyssp)\r\n\tfprintf (stderr, \" %d\", *++ssp1);\r\n      fprintf (stderr, \"\\n\");\r\n    }\r\n#endif\r\n\r\n  *++yyvsp = yyval;\r\n\r\n#ifdef YYLSP_NEEDED\r\n  yylsp++;\r\n  if (yylen == 0)\r\n    {\r\n      yylsp->first_line = yylloc.first_line;\r\n      yylsp->first_column = yylloc.first_column;\r\n      yylsp->last_line = (yylsp-1)->last_line;\r\n      yylsp->last_column = (yylsp-1)->last_column;\r\n      yylsp->text = 0;\r\n    }\r\n  else\r\n    {\r\n      yylsp->last_line = (yylsp+yylen-1)->last_line;\r\n      yylsp->last_column = (yylsp+yylen-1)->last_column;\r\n    }\r\n#endif\r\n\r\n  /* Now \"shift\" the result of the reduction.\r\n     Determine what state that goes to,\r\n     based on the state we popped back to\r\n     and the rule number reduced by.  */\r\n\r\n  yyn = yyr1[yyn];\r\n\r\n  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;\r\n  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)\r\n    yystate = yytable[yystate];\r\n  else\r\n    yystate = yydefgoto[yyn - YYNTBASE];\r\n\r\n  goto yynewstate;\r\n\r\nyyerrlab:   /* here on detecting error */\r\n\r\n  if (! yyerrstatus)\r\n    /* If not already recovering from an error, report this error.  */\r\n    {\r\n      ++yynerrs;\r\n\r\n#ifdef YYERROR_VERBOSE\r\n      yyn = yypact[yystate];\r\n\r\n      if (yyn > YYFLAG && yyn < YYLAST)\r\n\t{\r\n\t  int size = 0;\r\n\t  char *msg;\r\n\t  int x, count;\r\n\r\n\t  count = 0;\r\n\t  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */\r\n\t  for (x = (yyn < 0 ? -yyn : 0);\r\n\t       x < (sizeof(yytname) / sizeof(char *)); x++)\r\n\t    if (yycheck[x + yyn] == x)\r\n\t      size += strlen(yytname[x]) + 15, count++;\r\n\t  msg = (char *) malloc(size + 15);\r\n\t  if (msg != 0)\r\n\t    {\r\n\t      strcpy(msg, \"parse error\");\r\n\r\n\t      if (count < 5)\r\n\t\t{\r\n\t\t  count = 0;\r\n\t\t  for (x = (yyn < 0 ? -yyn : 0);\r\n\t\t       x < (sizeof(yytname) / sizeof(char *)); x++)\r\n\t\t    if (yycheck[x + yyn] == x)\r\n\t\t      {\r\n\t\t\tstrcat(msg, count == 0 ? \", expecting `\" : \" or `\");\r\n\t\t\tstrcat(msg, yytname[x]);\r\n\t\t\tstrcat(msg, \"'\");\r\n\t\t\tcount++;\r\n\t\t      }\r\n\t\t}\r\n\t      yyerror(msg);\r\n\t      free(msg);\r\n\t    }\r\n\t  else\r\n\t    yyerror (\"parse error; also virtual memory exceeded\");\r\n\t}\r\n      else\r\n#endif /* YYERROR_VERBOSE */\r\n\tyyerror(\"parse error\");\r\n    }\r\n\r\n  goto yyerrlab1;\r\nyyerrlab1:   /* here on error raised explicitly by an action */\r\n\r\n  if (yyerrstatus == 3)\r\n    {\r\n      /* if just tried and failed to reuse lookahead token after an error, discard it.  */\r\n\r\n      /* return failure if at end of input */\r\n      if (yychar == YYEOF)\r\n\tYYABORT;\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Discarding token %d (%s).\\n\", yychar, yytname[yychar1]);\r\n#endif\r\n\r\n      yychar = YYEMPTY;\r\n    }\r\n\r\n  /* Else will try to reuse lookahead token\r\n     after shifting the error token.  */\r\n\r\n  yyerrstatus = 3;\t\t/* Each real token shifted decrements this */\r\n\r\n  goto yyerrhandle;\r\n\r\nyyerrdefault:  /* current state does not do anything special for the error token. */\r\n\r\n#if 0\r\n  /* This is wrong; only states that explicitly want error tokens\r\n     should shift them.  */\r\n  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/\r\n  if (yyn) goto yydefault;\r\n#endif\r\n\r\nyyerrpop:   /* pop the current state because it cannot handle the error token */\r\n\r\n  if (yyssp == yyss) YYABORT;\r\n  yyvsp--;\r\n  yystate = *--yyssp;\r\n#ifdef YYLSP_NEEDED\r\n  yylsp--;\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    {\r\n      short *ssp1 = yyss - 1;\r\n      fprintf (stderr, \"Error: state stack now\");\r\n      while (ssp1 != yyssp)\r\n\tfprintf (stderr, \" %d\", *++ssp1);\r\n      fprintf (stderr, \"\\n\");\r\n    }\r\n#endif\r\n\r\nyyerrhandle:\r\n\r\n  yyn = yypact[yystate];\r\n  if (yyn == YYFLAG)\r\n    goto yyerrdefault;\r\n\r\n  yyn += YYTERROR;\r\n  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)\r\n    goto yyerrdefault;\r\n\r\n  yyn = yytable[yyn];\r\n  if (yyn < 0)\r\n    {\r\n      if (yyn == YYFLAG)\r\n\tgoto yyerrpop;\r\n      yyn = -yyn;\r\n      goto yyreduce;\r\n    }\r\n  else if (yyn == 0)\r\n    goto yyerrpop;\r\n\r\n  if (yyn == YYFINAL)\r\n    YYACCEPT;\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Shifting error token, \");\r\n#endif\r\n\r\n  *++yyvsp = yylval;\r\n#ifdef YYLSP_NEEDED\r\n  *++yylsp = yylloc;\r\n#endif\r\n\r\n  yystate = yyn;\r\n  goto yynewstate;\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/build.bat",
    "content": "cls\r\nflex.exe -i -c -n -I -olexParser.inc csharp.l\r\nbison.exe -t --debug --verbose --yacc --output=csharpCompiler.cpp csharp.y\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/compilerLibrary.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"include.h\"\r\n#include <memory.h>\r\n#include <stdio.h>\r\n#include <varargs.h>\r\n\r\n//------------------------------------------\r\n//\r\n// Helper Functions.\r\n//\r\n//------------------------------------------\r\n\r\nvoid expand(int* count, void*** array_, void* newEntry) {\r\n\t// Get old information.\r\n\tvoid** oldArray = *array_;\r\n\tint oldCount\t= *count;\r\n\r\n\t// Allocate new array and copy old array into new array.\r\n\tvoid** newArray = new void*[oldCount+1];\r\n\tif (oldArray) {\r\n\t\tmemcpy(newArray,oldArray,oldCount * sizeof(void*));\r\n\t}\r\n\r\n\t// Add new element\r\n\t*count = (*count)+1;\r\n\tnewArray[oldCount] = newEntry;\r\n\r\n\t// Delete old array\r\n\tif (oldArray) { delete[] oldArray; }\r\n\t*array_ = newArray;\r\n}\r\n\r\nextern int yylineno;\r\nvoid compilerError(EnumError err, const char* format, int lineNumber) {\r\n\tint line = (lineNumber != -1) ? lineNumber : yylineno;\r\n\tconst char* errorType;\r\n\tswitch(err) {\r\n\tcase ERR_NOT_SUPPORTED:\r\n\t\terrorType = \"NOT SUPPORTED\";\r\n\t\tbreak;\r\n\tcase ERR_NOT_SUPPORTED_YET:\r\n\t\terrorType = \"NOT SUPPORTED YET\";\r\n\t\tbreak;\r\n\tcase ERR_INTERNAL:\r\n\t\terrorType = \"INTERNAL\";\r\n\t\tbreak;\r\n\tcase ERR_USER:\r\n\t\terrorType = \"USER\";\r\n\t\tbreak;\r\n\tdefault:\r\n\t\terrorType = \"ERROR\";\r\n\t\tbreak;\r\n\t}\r\n\tprintf(\"[%s] Compiler Error\",errorType);\r\n\tif(line != -1) {\r\n\t\tprintf(\" @line %i\",line);\r\n\t}\r\n\tprintf(\" : %s%s\\n\",format,format[strlen(format) - 1] == '.' ? \"\" : \".\");\r\n}\r\n\r\n\r\nSValue::SValue()\r\n{\r\n\tpString = NULL;\r\n\tv.l = 0; // Fill memory with 0.\r\n}\r\n\r\nint SValue::operatorType(SValue &a, SValue &b)\r\n{\r\n\tint default_ = 0;\r\n\r\n\t// In order !\r\n\r\n\tif ((a.type == TYPE_BOOL)  || (b.type == TYPE_BOOL ))\t{ default_ = TYPE_BOOL;\t}\r\n\tif ((a.type == TYPE_UINT)  || (b.type == TYPE_UINT ))\t{ default_ = TYPE_UINT;\t}\r\n\tif ((a.type == TYPE_INT )  || (b.type == TYPE_INT  ))\t{ default_ = TYPE_INT;\t}\r\n\tif ((a.type == TYPE_ULONG) || (b.type == TYPE_ULONG))\t{ default_ = TYPE_ULONG;}\r\n\tif ((a.type == TYPE_LONG ) || (b.type == TYPE_LONG ))\t{ default_ = TYPE_LONG; }\r\n\tif ((a.type == TYPE_FLOAT) || (b.type == TYPE_FLOAT))\t{ default_ = TYPE_FLOAT;}\r\n\tif ((a.type == TYPE_DOUBLE)|| (b.type == TYPE_DOUBLE))\t{ default_ = TYPE_DOUBLE;}\r\n\r\n\treturn default_;\r\n}\r\n\r\nSValue SValue::ToType(int type) {\r\n\tSValue res;\r\n\tres.type = type;\r\n\tswitch (type) {\r\n\tcase TYPE_BOOL:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.i = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.i = this->v.i ? 1 : 0;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.i = this->v.ui ? 1 : 0;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.i = this->v.l ? 1 : 0;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.i = this->v.ul ? 1 : 0;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.i = (this->v.f != 0.0f) ? 1 : 0;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.i = (this->v.d != 0.0f) ? 1 : 0;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TYPE_INT:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.i = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.i = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.i = this->v.ui;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.i = (s32)this->v.l;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.i = (s32)this->v.ul;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.i = (s32)this->v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.i = (s32)this->v.d;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TYPE_UINT:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.ui = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.ui = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.ui = this->v.ui;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.ui = (u32)this->v.l;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.ui = (u32)this->v.ul;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.ui = (u32)this->v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.ui = (u32)this->v.d;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TYPE_LONG:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.l = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.l = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.l = this->v.ui;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.l = this->v.l;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.l = this->v.ul;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.l = (s64)this->v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.l = (s64)this->v.d;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TYPE_ULONG:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.ul = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.ul = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.ul = this->v.ui;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.ul = this->v.l;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.ul = this->v.ul;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.ul = (u64)this->v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.ul = (u64)this->v.d;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TYPE_FLOAT:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.f = (float)this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.f = (float)this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.f = (float)this->v.ui;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.f = (float)this->v.l;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.f = (float)this->v.ul;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.f = this->v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.f = (float)this->v.d;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TYPE_DOUBLE:\r\n\t\tswitch (this->type) {\r\n\t\tcase TYPE_BOOL:\r\n\t\t\tres.v.d = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_INT:\r\n\t\t\tres.v.d = this->v.i;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_UINT:\r\n\t\t\tres.v.d = this->v.ui;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_LONG:\r\n\t\t\tres.v.d = (double)this->v.l;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_ULONG:\r\n\t\t\tres.v.d = (double)this->v.ul;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_FLOAT:\r\n\t\t\tres.v.d = this->v.f;\r\n\t\t\tbreak;\r\n\t\tcase TYPE_DOUBLE:\r\n\t\t\tres.v.d = this->v.d;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\tbreak;\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nDelegate::Delegate()\r\n:Method()\r\n,m_cppRepresentation\t(NULL)\r\n,m_csharpRepresentation\t(NULL)\r\n{\r\n\tm_type = new TypeObject();\r\n\tgGlobalClassID++;\r\n}\r\n\r\n/*virtual*/\r\nint Delegate::getGenre() {\r\n\treturn EGENRE::_DELEGATE;\r\n}\r\n\r\n/*virtual*/\r\nconst char* Delegate::getName() {\r\n\tif(m_cppRepresentation) {\r\n\t\treturn m_cppRepresentation->m_name;\r\n\t}\r\n\treturn m_name;\r\n}\r\n\r\n/*virtual*/\r\nconst char* Delegate::getFullName(NameSpace* ref) {\r\n#ifdef __FULLNAMES__\r\n\tref = gRootNameSpace;\r\n#endif\r\n\tchar buff[1000];\r\n\tconst char* res = getOwner()->getFullName(ref);\r\n\tif (res[0] == 0) {\r\n\t\tsprintf(buff, \"%s\", this->getName());\r\n\t} else {\r\n\t\tsprintf(buff, \"%s::_Delegate_Base_%s\", res, this->getName());\r\n\t}\r\n\treturn strdup(buff);\r\n}\r\n\r\nTypeObject* Delegate::getType() {\r\n\tif (m_type->m_typeID == TYPE_UNRESOLVED) {\r\n\t\tm_type->m_name\t\t\t\t\t= m_name;\r\n\t\tm_type->m_definitionDelegate\t= this;\r\n\t\tm_type->m_isGC_Able\t\t\t\t= true;\r\n\t\tm_type->m_genreID\t\t\t\t= EGENRE::_DELEGATE;\r\n\t\tm_type->m_name\t\t\t\t\t= this->getName();\r\n\t\tm_type->m_typeID\t\t\t\t= (EnumTypeObject)this->m_uniqueId;\r\n\t\tm_type->m_res.pSymbol\t\t\t= this;\r\n\t\tm_type->m_res.pType\t\t\t\t= m_type;\r\n\t\tm_type->m_res.symbolType\t\t= EGENRE::_DELEGATE;\r\n\t}\r\n\treturn m_type;\r\n}\r\n\r\n/*static*/ \r\nvoid DependancyMatrix::registerVariable(Variable* pVar, int domain) {\r\n\t// Insert at the end to have cleaner dump at the end.\r\n\tfor (int n=0; n < 5; n++) {\r\n\t\tif (domain & (1<<n)) {\r\n\t\t\tStorage* p = new Storage();\r\n\t\t\tp->m_pSymbol\t= pVar;\r\n\t\t\tp->m_next\t\t= NULL;\r\n\t\t\tif (m_dependancyStorageEnd[n] == NULL) {\r\n\t\t\t\tm_dependancyStorage[n] = p;\r\n\t\t\t} else {\r\n\t\t\t\tm_dependancyStorageEnd[n]->m_next = p;\r\n\t\t\t}\r\n\t\t\tm_dependancyStorageEnd[n] = p;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid DependancyMatrix::registerAbstractContainer(AbstractContainer* pCnt, int domain) {\r\n\t// Insert at the end to have cleaner dump at the end.\r\n\tfor (int n=0; n < 5; n++) {\r\n\t\tif (domain & (1<<n)) {\r\n\t\t\tStorage* p = new Storage();\r\n\t\t\tp->m_pSymbol\t= pCnt;\r\n\t\t\tp->m_next\t\t= NULL;\r\n\t\t\tif (m_dependancyStorageEnd[n] == NULL) {\r\n\t\t\t\tm_dependancyStorage[n] = p;\r\n\t\t\t} else {\r\n\t\t\t\tm_dependancyStorageEnd[n]->m_next = p;\r\n\t\t\t}\r\n\t\t\tm_dependancyStorageEnd[n] = p;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nNameSpace* Delegate::getOwner() {\r\n\tif(m_cppRepresentation) {\r\n\t\treturn m_cppRepresentation->m_pOwner;\r\n\t}\r\n\treturn m_pOwner;\r\n}\r\n\r\n/*static*/ \r\nvoid DependancyMatrix::createDependancy(Variable* pVar, Variable* uses) {\r\n\tif (uses) {\r\n\t\tpVar->use(uses);\r\n\t} else {\r\n\t\tcompilerError(ERR_INTERNAL, \"Dependancy on null variable\");\r\n\t}\r\n}\r\n\r\n/*static*/\r\nvoid DependancyMatrix::createDependancy(AbstractContainer* pContainer, AbstractContainer* uses) {\r\n\tif(uses->m_noDump == false) {\r\n\t\tif (uses) {\r\n\t\t\tpContainer->use(uses);\r\n\t\t} else {\r\n\t\t\tcompilerError(ERR_INTERNAL, \"Dependancy on null abstract container\");\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\t// Do not register the dependancy\r\n\t}\r\n}\r\n\r\nVariable* DependancyMatrix::popIndependantVariable(int domain) {\r\n\treturn (Variable*)popIndependantSymbol(EGENRE::_VARIABLE, EGENRE::_VARIABLE, domain);\r\n}\r\n\r\nAbstractContainer* DependancyMatrix::popIndependantAbstractContainer(int domain) {\r\n\treturn (AbstractContainer*)popIndependantSymbol(EGENRE::_ABSTRACTCONTAINER, EGENRE::_ABSTRACTCONTAINER, domain);\r\n}\r\n\r\n/*static*/ \r\nSymbol* DependancyMatrix::popIndependantSymbol(EGENRE genre, u32 mask, int domain) {\r\n\tfor (int n=0; n < 5; n++) {\r\n\t\tif (domain & (1<<n)) {\r\n\t\t\tStorage* pStorage\t= m_dependancyStorage[n];\r\n\t\t\tStorage* pPrev\t\t= NULL;\r\n\t\t\tSymbol* result = NULL;\r\n\r\n\t\t\t// 1. Find independant variable if any.\r\n\t\t\twhile (pStorage) {\r\n\t\t\t\tif (pStorage->m_pSymbol->getGenre() == genre) {\r\n\t\t\t\t\tif (!pStorage->m_pSymbol->stillUsing(mask)) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tpPrev\t\t= pStorage;\r\n\t\t\t\tpStorage\t= pStorage->m_next; \r\n\t\t\t}\r\n\r\n\t\t\t// 2. Remove from link list if found\r\n\t\t\tif (pStorage) {\r\n\t\t\t\tresult = pStorage->m_pSymbol;\r\n\t\t\t\tif (pPrev) {\r\n\t\t\t\t\tpPrev->m_next = pStorage->m_next;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_dependancyStorage[n] = pStorage->m_next;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdelete pStorage;\r\n\t\t\t}\r\n\r\n\t\t\t// 3. Remove possible dependancy now that we export the variable.\r\n\t\t\tpStorage\t= m_dependancyStorage[n];\r\n\t\t\twhile (pStorage) {\r\n\t\t\t\tpStorage->m_pSymbol->unuse(result);\r\n\t\t\t\tpStorage\t= pStorage->m_next; \r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n/*static*/ \r\nvoid DependancyMatrix::clear() {\r\n\tfor (int n=0; n < 5; n++) {\r\n\t\tStorage* pStore = m_dependancyStorage[n];\r\n\t\twhile (pStore) {\r\n\t\t\tStorage* pNext = pStore->m_next;\r\n\t\t\tpStore->m_pSymbol->unuseAll();\r\n\t\t\tdelete pStore;\r\n\t\t\tpStore = pNext;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nQuals::Quals(u32 rank)\r\n:m_pNext(NULL)\r\n{\r\n\tthis->rank = rank;\r\n}\r\n\r\nQuals* Quals::addQuals(u32 rank) {\r\n\tQuals* p\t\t= this;\r\n\twhile (p->m_pNext) {\r\n\t\tp\t = p->m_pNext;\r\n\t}\r\n\r\n\tp->m_pNext = new Quals(rank);\r\n\treturn this;\r\n}\r\n\r\nEnum::Enum()\r\n:m_list\t\t(NULL)\r\n,m_attribute(NULL)\r\n,m_type\t\t(NULL)\r\n,m_parent\t(NULL)\r\n,m_modifier\t(0)\r\n{\r\n\tgGlobalClassID++;\r\n}\r\n\r\n/*virtual*/\r\nint Enum::getGenre() {\r\n\treturn EGENRE::_ENUM;\r\n}\r\n\r\n/*virtual*/\r\nconst char* Enum::getFullName(NameSpace* ref) {\r\n#ifdef __FULLNAMES__\r\n\tref = gRootNameSpace;\r\n#endif\r\n\tchar buff[1000];\r\n\tconst char* res = (m_parent == ref) ? \"\" : m_parent->getFullName(ref);\r\n\tif (res[0] == 0) {\r\n\t\tsprintf(buff, \"%s\", this->getName());\r\n\t} else {\r\n\t\tsprintf(buff, \"%s::%s\", res, this->getName());\r\n\t}\r\n\treturn strdup(buff);\r\n}\r\n\r\nEnum::EnumEntry::EnumEntry() \r\n:m_pNext\t\t(NULL)\r\n,m_pAttrib\t\t(NULL)\r\n,m_name\t\t\t(NULL)\r\n,m_expression\t(NULL)\r\n,m_parent\t\t(NULL)\r\n{\r\n}\r\n\r\nTypeObject* Enum::getType() {\r\n\tif (m_rtype.m_typeID == TYPE_UNRESOLVED) {\r\n\t\tif (m_type != NULL) {\r\n\t\t\tm_type->getResolvedType(this->m_parent);\r\n\t\t}\r\n\t\tm_rtype.m_definitionEnum\t= this;\r\n\t\tm_rtype.m_isGC_Able\t\t\t= false;\r\n\t\tm_rtype.m_genreID\t\t\t= EGENRE::_ENUM;\r\n\t\tm_rtype.m_name\t\t\t\t= this->getName();\r\n\t\tm_rtype.m_typeID\t\t\t= (EnumTypeObject)this->m_uniqueId;\r\n\t\tm_rtype.m_res.pSymbol\t\t= this;\r\n\t\tm_rtype.m_res.pType\t\t\t= &m_rtype;\r\n\t\tm_rtype.m_res.symbolType\t= EGENRE::_ENUM;\r\n\t}\r\n\treturn &m_rtype;\r\n}\r\n\r\nvoid Enum::addEntry(Attribute* pAttri,const char* name, Expression* expr) {\r\n\tEnumEntry* pEntry = new EnumEntry();\r\n\r\n\tpEntry->m_name\t\t\t= concat(name);\r\n\tif (expr) {\r\n\t\tif (expr->m_expressionType == EXPR_UNARYMINUS) {\r\n\t\t\tif (expr->m_expressions[0]->m_expressionType == EXPR_CTE) {\r\n\t\t\t\texpr->m_expressionType = EXPR_CTE;\r\n\r\n\t\t\t\tSValue v = expr->m_expressions[0]->m_value;\r\n\r\n\t\t\t\tswitch (v.type) {\r\n\t\t\t\tcase TYPE_INT:\tv.v.i = -v.v.i; break;\r\n\t\t\t\tcase TYPE_LONG:\tv.v.l = -v.v.l; break;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tcompilerError(ERR_INTERNAL,\"Internal type error conversion\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\texpr->m_value = v;\r\n\t\t\t} else {\r\n\t\t\t\tcompilerError(ERR_INTERNAL, \"Wrong enum\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (expr->m_expressionType != EXPR_CTE) {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Does not support enum entries initialization different from CONSTANT INTEGER value.\");\r\n\t\t}\r\n\t}\r\n\r\n\tpEntry->m_expression\t= expr;\r\n\tpEntry->m_pAttrib\t\t= pAttri;\r\n\tpEntry->m_parent\t\t= this;\r\n\r\n\tif (m_list) {\r\n\t\tEnumEntry* p = m_list;\r\n\t\twhile (p->m_pNext) {\r\n\t\t\tp = p->m_pNext;\r\n\t\t}\r\n\t\tp->m_pNext = pEntry;\r\n\t} else {\r\n\t\tm_list = pEntry;\r\n\t}\r\n}\r\n\r\nEnum::EnumEntry* Enum::findValue(const char* name)\r\n{\r\n\tEnumEntry* pEnumEntry = m_list;\r\n\twhile(pEnumEntry) {\r\n\t\tif (strcmp(pEnumEntry->m_name,name) == 0) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tpEnumEntry = pEnumEntry->m_pNext;\r\n\t}\r\n\treturn pEnumEntry;\r\n}\r\n\r\nvoid\t\tcreateAlias\t\t\t(const char* alias, const char* originalName) {\r\n\t// \t\t\r\n}\r\n\r\nvoid\t\taddUsingNameSpace\t(const char* nameSpace) {\r\n\tgCurrentNameSpace->addUsing(nameSpace);\r\n}\r\n\r\nAccessor*\tCreateAccessor\t\t(Attribute* attribute, Statement* pStatement) {\r\n\tAccessor*\tpAcc = new Accessor();\r\n\tpAcc->m_attribute = attribute;\r\n\tpAcc->m_statement = pStatement;\r\n\treturn pAcc;\r\n}\r\n\r\nAccessor*\tCreateAccessor\t\t(Accessor* get_, Accessor* _set) {\r\n\tAccessor*\tpAcc = new Accessor();\r\n\tpAcc->m_get = get_;\r\n\tpAcc->m_set = _set;\r\n\treturn pAcc;\r\n}\r\n\r\nEnum*\t\tCreateEnum\t\t\t(Attribute* attribute, u32 modifier, const char* name, TypeObject* type) {\r\n\treturn gCurrentNameSpace->addEnum(attribute, modifier, name, type);\r\n}\r\n\r\nExpression* CreateDelegateExpr(Variable* params, Statement* code) {\r\n\tchar buff[200];\r\n\tsprintf(buff, \"_anon_%i\", gAnonymous++);\r\n\tExpression* pExpr = new Expression();\r\n\r\n\t// Create anon class and change name space, add it to the class\r\n\tAbstractContainer* anonClass = \tCreateClass(NULL, ATTRB_ANONDELEGATE, buff);\r\n\t// Pop back from anon name space.\r\n\tunuseNameSpace();\r\n\r\n\tpExpr->m_expressionType\t\t= EXPR_DELEGATECREATE;\r\n\tpExpr->m_anonymousClass\t\t= anonClass;\r\n\tpExpr->m_delegateSignature\t= params;\r\n\tpExpr->m_delegateCode\t\t= code;\r\n\r\n\treturn pExpr;\r\n}\r\n\r\nDelegate*\tCreateDelegate\t\t(Attribute* attribute, u32 modifier, TypeObject* type, const char* name, Variable* params) {\r\n\treturn gCurrentNameSpace->addDelegate(attribute, modifier, type, name, params);\r\n}\r\n\r\nSymbolDictionary::SymbolDictionary(SymbolDictionary* parent) : m_parent(parent), m_child(NULL) {\r\n\tm_list = new VariableList();\r\n\tm_list->content = NULL;\r\n\tm_list->pNext = NULL;\r\n}\r\n\r\nSymbolDictionary::~SymbolDictionary() {\r\n\tdelete m_child;\r\n\tVariableList* toDestroy = m_list;\r\n\tVariableList* next;\t\r\n\twhile(toDestroy) {\r\n\t\tnext = toDestroy->pNext;\r\n\t\tdelete toDestroy;\r\n\t\ttoDestroy = next;\r\n\t}\r\n}\r\n\r\nvoid SymbolDictionary::addVariable(Variable* var) {\r\n\tVariableList* pVarList = m_list;\r\n\tif(!pVarList->content) {\r\n\t\tpVarList->content = var;\r\n\t} else {\r\n\t\twhile(pVarList->pNext) {\r\n\t\t\tpVarList = pVarList->pNext;\r\n\t\t}\r\n\t\tpVarList->pNext = new VariableList();\r\n\t\tpVarList->pNext->content = var;\r\n\t}\r\n}\r\n\r\nSymbolDictionary* SymbolDictionary::addDictionary() {\r\n\tSymbolDictionary* last= this;\r\n\twhile(last->m_child) {\r\n\t\tlast = last->m_child;\r\n\t}\r\n\tlast->m_child = new SymbolDictionary(last);\r\n\treturn last->m_child;\r\n}\r\n\r\nSymbolDictionary* SymbolDictionary::removeDictionary() {\r\n\tSymbolDictionary* last = this;\r\n\tSymbolDictionary* parent;\r\n\twhile(last->m_child) {\r\n\t\tlast = last->m_child;\r\n\t}\r\n\tparent = last->m_parent;\r\n\tdelete last;\r\n\tif(parent) {\r\n\t\tparent->m_child = NULL;\r\n\t}\r\n\treturn parent;\r\n}\r\n\r\nVariable* SymbolDictionary::findVariable(const char* name) {\r\n\tSymbolDictionary* pDictionary = this;\r\n\twhile(pDictionary) {\r\n\t\tVariableList* pVarList = pDictionary->m_list;\r\n\t\tif(pVarList->content) {\t\t//No need to check the list if it is empty\r\n\t\t\twhile(pVarList){\r\n\t\t\t\tif(strcmp(pVarList->content->m_name, name)==0) {\r\n\t\t\t\t\treturn pVarList->content;\r\n\t\t\t\t}\r\n\t\t\t\tpVarList = pVarList->pNext;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpDictionary = pDictionary->m_parent;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nClassDictionary::ClassDictionary()\r\n:count(0)\r\n{\r\n\tclasses\t= new const char*[500];\r\n\tIDs\t\t= new const char*[500];\r\n}\r\n\r\nvoid ClassDictionary::add(const char* name, const char* IDExpression) {\r\n\tif(count == 500) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Maximum number of classes exceeded\");\r\n\t}\r\n\telse {\r\n\t\tclasses[count]\t= concat(name);\r\n\t\tIDs[count]\t\t= concat(IDExpression);\r\n\t\tcount++;\r\n\t}\r\n}\r\n\r\nvoid useOrCreateNameSpace(Attribute* attribute, const char* nameSpace) {\r\n\tStringList* splitList = split(nameSpace);\r\n\tNameSpace* fNewWorkingSpace;\r\n\tNameSpace* pParentWorkSpace = gCurrentNameSpace;\r\n\t/*\r\n\tif(strcmp(splitList->content, \"System\") == 0) {\r\n\t\tg_noDump = true;\r\n\t}*/\r\n\twhile(splitList) {\r\n\t\tfNewWorkingSpace = pParentWorkSpace->findNameSpace(splitList->content);\r\n\t\tif (!fNewWorkingSpace) {\r\n\t\t\tfNewWorkingSpace = new NameSpace();\r\n\t\t\tfNewWorkingSpace->setup(attribute, splitList->content);\r\n\t\t\tfNewWorkingSpace->m_noDump = g_noDump;\r\n\t\t\tpParentWorkSpace->addNameSpace(fNewWorkingSpace);\r\n\t\t}\r\n\t\tpParentWorkSpace = fNewWorkingSpace;\r\n\t\tsplitList = splitList->pNext;\r\n\t}\r\n\r\n\tPushSpace(gCurrentNameSpace);\r\n\tgCurrentNameSpace = fNewWorkingSpace;\r\n}\r\n\r\nvoid unuseNameSpace\t\t() {\r\n\t/*\r\n\tif(strcmp(gCurrentNameSpace->m_name, \"System\") == 0) {\r\n\t\tg_noDump = false;\r\n\t}*/\r\n\tgCurrentNameSpace = PopSpace();\r\n\tif (gCurrentNameSpace->m_bIsAbstract) {// Is abstract container\r\n\t\tgCurrentAC = (AbstractContainer*)gCurrentNameSpace;\r\n\t\tgCurrentAC->fixInheritance();\r\n\t}\r\n}\r\n\r\nconst char* concat2(const char* a, const char* b) {\r\n\tchar buff[1000];\r\n\tchar* dst = buff;\r\n\tint strl = strlen(a);\r\n\tint strr = strlen(b);\r\n\tif (strl) { memcpy(buff, a, strl); dst += strl; }\r\n\tif (strr) { memcpy(dst, b, strr); dst += strr; }\r\n\t*dst = 0;\r\n\treturn strdup(buff);\r\n}\r\n\r\nconst char* concat3(const char* a, const char* b, const char* c) {\r\n\tchar buff[1000];\r\n\tchar* dst = buff;\r\n\tint strl = strlen(a);\r\n\tint strr = strlen(b);\r\n\tint str3 = strlen(c);\r\n\tif (strl) { memcpy(buff, a, strl); dst += strl; }\r\n\tif (strr) { memcpy(dst, b, strr); dst += strr; }\r\n\tif (str3) { memcpy(dst, c, str3); dst += str3; }\r\n\t*dst = 0;\r\n\treturn strdup(buff);\r\n}\r\n\r\nconst char* concat(const char* a) {\r\n\treturn strdup(a);\r\n}\r\n\r\nvoid traceFunc(int line, int input, const char* token) {\r\n\tfprintf(stderr,\"Rule Y@%i Input:%i Token:%s\\n\",line, input,token);\r\n}\r\n\r\nNameSpace*\tnameSpaceStack[100];\r\nint\t\t\tnameSpaceStackIndex\t= 0;\r\nvoid\t\tPushSpace(NameSpace* p) {\tnameSpaceStack[nameSpaceStackIndex++] = p;\t\t}\r\nNameSpace*\tPopSpace()\t\t\t\t{\treturn nameSpaceStack[--nameSpaceStackIndex];\t}\r\n\r\nvoid display (const char* str)\r\n{\r\n\t//printf(\"%s\\n\",str);\r\n}\r\n\r\nStringList*\tsplit (const char* str)\r\n{\r\n\tif(!str) {\r\n\t\treturn NULL;\r\n\t}\r\n\tStringList* head = new StringList();\r\n\tStringList* current = head;\r\n\tchar buf[100];\r\n\tbuf[0] = 0;\r\n\tchar* ptr = buf;\r\n\tfor(int i = 0 ; str[i] ; i++) {\r\n\t\tif(str[i] == '.') {\r\n\t\t\t*ptr = 0;\r\n\t\t\tcurrent->content = (char*)concat(buf);\r\n\t\t\tcurrent = current->pNext = new StringList();\r\n\t\t\tptr = buf;\r\n\t\t}\r\n\t\telse {\r\n\t\t\t*ptr++ = str[i];\r\n\t\t}\r\n\t}\r\n\t*ptr = 0;\r\n\tcurrent->content = (char*)concat(buf);\r\n\treturn head;\r\n}\r\n\r\nvoid resetLocalFileInfo() {\r\n\t// Reset Temp String Concat allocation.\r\n\t// Reset Using list.\r\n\t// Reset Alias list.\r\n}\r\n\r\nbool checkEntryPoint(u32 compilerOptions) {\r\n\tAbstractContainer* pProgram = (AbstractContainer*)(gRootNameSpace->findNameSpace(\"Program\"));\r\n\tif(compilerOptions & COMPIL_USE_FRAMEWORK) {\r\n\t\tif(pProgram) {\r\n\t\t\tif(pProgram->m_accessorCount\t!= 0\r\n\t\t\t|| pProgram->m_delegateCount\t!= 0\r\n\t\t\t|| pProgram->m_enumCount\t\t!= 0\r\n\t\t\t|| pProgram->m_memberCount\t\t!= 0\r\n\t\t\t|| pProgram->m_methodCount\t\t> 1) {\r\n\t\t\t\tcompilerError(ERR_USER, \"The Program class should only contain a static method named start\", pProgram->m_line);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tMethod* pStart = pProgram->findMethod(\"start\", (Expression*)NULL, NULL);\r\n\t\t\tif(pStart) {\r\n\t\t\t\tif((pStart->m_modifier & ATT_STATIC) == 0) {\r\n\t\t\t\t\tcompilerError(ERR_USER, \"Program::start() should be static\", pProgram->m_line);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tcompilerError(ERR_USER, \"start() entry point was not found in the Program class\", pProgram->m_line);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tcompilerError(ERR_USER, \"Entry point was not found. There should be a class named Program, with a static start() method\");\r\n\t\treturn false;\r\n\t}\r\n\tif(pProgram) {\r\n\t\tcompilerError(ERR_USER, \"There should be a Program class only if the program is called by the game engine\");\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid generateOutput(const char* outputPath, u32 compilerOptions) {\r\n\tbool isFramework\t= (compilerOptions & COMPIL_IS_FRAMEWORK)\t!= 0;\r\n\tbool useFramework\t= (compilerOptions & COMPIL_USE_FRAMEWORK)\t!= 0;\r\n\r\n\tif(checkEntryPoint(compilerOptions)) {\r\n\r\n\t\tif(outputPath) {\r\n\t\t\tfreopen(isFramework ? concat2(outputPath, \"framework.h\") : outputPath, \"w\", stdout);\r\n\t\t}\r\n\r\n\t\tif(isFramework) {\r\n\t\t\texportFrameworkHeader();\r\n\t\t}\r\n\t\telse if(useFramework) {\r\n\t\t\tprintf(\"#include \\\"framework.cpp\\\"\\n\\n\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\texportRuntimeIncludes();\r\n\t\t\tprintf(\"\\n\");\r\n\t\t}\r\n\r\n\t\t// Parser complete, gCurrentNameSpace is current.\r\n\t\tgCurrentNameSpace = NULL;\r\n\t\texportConstants();\r\n\r\n\t\texportNameSpaceHeader(gRootNameSpace, false);\r\n\t\texportPrototypes();\r\n\r\n\t\tif(isFramework) {\r\n\t\t\texportFrameworkFooter();\r\n\t\t\tif(outputPath) {\r\n\t\t\t\tfreopen(concat2(outputPath, \"framework.cpp\"), \"w\", stdout);\r\n\t\t\t}\r\n\t\t\tprintf(\"#include \\\"framework.h\\\"\\n\\n\");\r\n\t\t}\r\n\t\t\r\n\t\texportNameSpaceImplementation(gRootNameSpace);\r\n\t\tregisterGCWorld(gRootNameSpace, compilerOptions);\r\n\r\n\t\tif(outputPath && !isFramework) {\r\n\t\t\texportInlineFiles(pathName(outputPath), gClassDictionary);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nSValue registerString(SValue v) {\r\n\tstatic int gStringCounter = 0;\r\n\r\n\t// ==> We do constant pool factorization.\r\n\r\n\t// Find if string is already in the list or not.\r\n\tStringID* pList = gStrList;\r\n\twhile (pList) {\r\n\t\tif (strcmp(pList->m_str, v.v.str) == 0) {\r\n\t\t\tv.pString = pList;\r\n\t\t\treturn v;\r\n\t\t}\r\n\t\tpList = pList->m_next;\r\n\t}\r\n\r\n\tStringID* pID = new StringID();\r\n\tpID->m_id = gStringCounter++;\r\n\tpID->m_str = v.v.str;\r\n\tpID->m_next = gStrList;\r\n\tpID->m_isDumped = !g_noDump;\r\n\tgStrList = pID;\r\n\tv.pString = pID;\r\n\treturn v;\r\n}\r\n\r\n// Fills out_namespace and out_method with the appropriate contexts for the symbol resolution.\r\nvoid getContext(Symbol* symbol, NameSpace*& out_namespace, Method*& out_method) {\r\n\tswitch(symbol->getGenre()) {\r\n\tcase EGENRE::_ABSTRACTCONTAINER:\r\n\t\tout_namespace = (AbstractContainer*)symbol\t\t\t\t\t\t; out_method = NULL;\r\n\t\tbreak;\r\n\tcase EGENRE::_ACCESSOR:\r\n\t\tout_namespace = ((Accessor*)symbol)->m_ownerClass\t\t\t\t; out_method = NULL;\r\n\t\tbreak;\r\n\tcase EGENRE::_DELEGATE:\r\n\t\tout_namespace = ((Delegate*)symbol)->getOwner()\t\t\t\t\t; out_method = NULL;\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUM:\r\n\t\tout_namespace = ((Enum*)symbol)->m_parent\t\t\t\t\t\t; out_method = NULL;\r\n\t\tbreak;\r\n\tcase EGENRE::_ENUMENTRY:\r\n\t\tout_namespace = ((Enum::EnumEntry*)symbol)->m_parent->m_parent\t; out_method = NULL;\r\n\t\tbreak;\r\n\tcase EGENRE::_METHOD:\r\n\t\tout_namespace = ((Method*)symbol)->m_pOwner\t\t\t\t\t\t; out_method = (Method*)symbol;\r\n\t\tbreak;\r\n\tcase EGENRE::_NAMESPACE:\r\n\t\tout_namespace = (NameSpace*)symbol\t\t\t\t\t\t\t\t; out_method = NULL;\r\n\t\tbreak;\r\n\tcase EGENRE::_VARIABLE:\r\n\t{\r\n\t\tAbstractContainer* pOwner = ((Variable*)symbol)->m_ownerClass;\r\n\t\tout_namespace = pOwner ? pOwner : gCurrentMethod->m_pOwner\t\t; out_method = pOwner ? NULL : gCurrentMethod;\r\n\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tcompilerError(ERR_INTERNAL, \"Unknowm symbol type\", symbol->m_line);\r\n\t\tout_namespace = NULL ; out_method = NULL;\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\n//Resolves a symbol which is not composed\r\nSRSymbol resolveSimpleSymbol(SRSymbol baseContext, const char* name, u8 searchMask, Expression* methodSignature, Variable* delegateSignature, TypeGenericEntry* genParams) {\r\n\tVariable*\t\t\t\t\tvarRes\t\t= NULL;\r\n\tAccessor*\t\t\t\t\taccessorRes\t= NULL;\r\n\tMethod*\t\t\t\t\t\tmethodRes\t= NULL;\r\n\tTypeGenericDefinitionEntry*\tgenericRes\t= NULL;\r\n\r\n\tSRSymbol result;\r\n\tresult.symbolType\t= EGENRE::_UNDEFGENRE;\r\n\tresult.pSymbol\t\t= createNotFoundSymbol();\r\n\r\n\tif (baseContext.symbolType == EGENRE::_ABSTRACTCONTAINER) {\r\n\t\t//Search in the local variables\r\n\t\tAbstractContainer* contextAC = (AbstractContainer*)baseContext.pSymbol;\r\n\r\n\t\t// Search in the dictionaries\r\n\t\tif(searchMask & SEARCH_VARIABLE) {\r\n\t\t\tvarRes = gCurrentSD->findVariable(name);\r\n\t\t\tif(varRes) {\r\n\t\t\t\tresult.pSymbol\t\t= varRes;\r\n\t\t\t\tresult.symbolType\t= EGENRE::_VARIABLE;\r\n\t\t\t\treturn result; // Early return\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Search in the local generic symbols\r\n\t\tif((searchMask & SEARCH_TYPE) && baseContext.symbolType == EGENRE::_METHOD) {\r\n\t\t\tMethod* pMethod = (Method*)baseContext.pSymbol;\r\n\t\t\tgenericRes = pMethod->findGenericSymbol(name);\r\n\t\t\tif(genericRes) {\r\n\t\t\t\tresult.pSymbol\t\t= genericRes;\r\n\t\t\t\tresult.symbolType\t= EGENRE::_GENDEFENTRY;\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Search in the class members\r\n\t\tif(searchMask & SEARCH_MEMBER) {\r\n\t\t\tvarRes = contextAC->findMember(name);\r\n\t\t\tif(varRes) {\r\n\t\t\t\tresult.pSymbol\t\t= varRes;\r\n\t\t\t\tresult.symbolType\t= EGENRE::_MEMBER;\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Search in the properties\r\n\t\tif(searchMask & SEARCH_PROPERTY) {\r\n\t\t\taccessorRes = contextAC->findProperty(name);\r\n\t\t\tif(accessorRes) {\r\n\t\t\t\tresult.pSymbol\t\t= accessorRes;\r\n\t\t\t\tresult.symbolType\t= EGENRE::_ACCESSOR;\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Search in the methods\r\n\t\tif(searchMask & SEARCH_FUNCTION) {\r\n\t\t\tif(methodSignature) {\r\n\t\t\t\tmethodRes = contextAC->findMethod(name, methodSignature, genParams);\r\n\t\t\t} else if(delegateSignature) {\r\n\t\t\t\tmethodRes = contextAC->findMethod(name, delegateSignature, genParams);\r\n\t\t\t} else {\r\n\t\t\t\tmethodRes = contextAC->findMethod(name, (Variable*)NULL, NULL);\r\n\t\t\t}\r\n\t\t\tif(methodRes) {\r\n\t\t\t\tresult.pSymbol\t\t= methodRes;\r\n\t\t\t\tresult.symbolType\t= (EGENRE)methodRes->getGenre();\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// =================================================\r\n\t\t//   Inheritance method / member / field\r\n\t\t// =================================================\r\n\r\n\t\t//Search in the parent class / interfaces\r\n\t\tif(searchMask & SEARCH_INHERITANCE) {\r\n\t\t\tint n=0;\r\n\t\t\twhile (n < contextAC->m_inheritancesCount) {\r\n\t\t\t\tTypeObject* pType = contextAC->m_inheritances[n];\r\n\t\t\t\tpType->getResolvedType(contextAC);\r\n\t\t\t\tSRSymbol input;\r\n\t\t\t\tinput.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\t\t\tinput.pSymbol\t\t= pType->m_definitionAC;\r\n\t\t\t\tSRSymbol symbolRes  = resolveSimpleSymbol(input, name ,searchMask & ~SEARCH_HIERARCHY & ~SEARCH_TYPE, methodSignature, delegateSignature, genParams);\r\n\t\t\t\tif (symbolRes.symbolType != EGENRE::_UNDEFGENRE) {\r\n\t\t\t\t\treturn symbolRes;\r\n\t\t\t\t}\r\n\t\t\t\tn++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Search in the embedding class\r\n\t\tif((searchMask & SEARCH_HIERARCHY) && contextAC->m_pParent->getGenre() == EGENRE::_ABSTRACTCONTAINER) {\t//Search in classes only\r\n\t\t\tSRSymbol input;\r\n\t\t\tinput.symbolType\t= EGENRE::_ABSTRACTCONTAINER;\r\n\t\t\tinput.pSymbol\t\t= (AbstractContainer*)contextAC->m_pParent;\r\n\t\t\tSRSymbol symbolRes = resolveSimpleSymbol(input, name, searchMask & ~SEARCH_TYPE, methodSignature, delegateSignature, genParams);\r\n\t\t\tif (symbolRes.symbolType != EGENRE::_UNDEFGENRE) {\r\n\t\t\t\treturn symbolRes;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// =================================================\r\n\t//   End Inheritance method / member / field\r\n\t// =================================================\r\n\r\n\t// Look for a type (different search as it can come from a using)\r\n\tif ((searchMask & SEARCH_TYPE) && ((baseContext.symbolType == EGENRE::_ABSTRACTCONTAINER) || (baseContext.symbolType == EGENRE::_NAMESPACE))) {\r\n\t\tNameSpace* pSpace = (NameSpace*)baseContext.pSymbol;\r\n\t\tSymbol* symbolRes = pSpace->resolve(name);\r\n\t\tif (symbolRes) {\r\n\t\t\tSRSymbol result;\r\n\t\t\tresult.symbolType\t= (EGENRE)symbolRes->getGenre();\r\n\t\t\tresult.pSymbol\t\t= symbolRes;\r\n\t\t\treturn result;\r\n\t\t}\r\n\t}\r\n\r\n\t//Look for a value in an enum type\r\n\tif (baseContext.symbolType == EGENRE::_ENUM) {\r\n\t\tEnum* contextEnum = (Enum*)baseContext.pSymbol;\r\n\t\tSRSymbol result;\r\n\t\tresult.symbolType = EGENRE::_ENUMENTRY;\r\n\t\tresult.pSymbol = contextEnum->findValue(name);\r\n\t\treturn result;\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\n// Returns true if argList1 is a better function member than argList2 for the signature\r\nbool isBetterFunctionMember(Variable* argList1, Variable* argList2, Expression* signature) {\r\n\tif(signature->m_expressionType != EXPR_LIST) {\r\n\t\tcompilerError(ERR_INTERNAL, \"Signature is expected to be a list expression\", signature->m_line);\r\n\t\treturn false;\r\n\t}\r\n\tbool hasFoundBetter = false;\r\n\tVariable* pArg1\t\t= argList1;\r\n\tVariable* pArg2\t\t= argList2;\r\n\tfor(int n = 0 ; n < signature->m_expressionCount ; n++, pArg1 = pArg1->m_pNextVariable, pArg2 = pArg2->m_pNextVariable) {\r\n\t\tif(!pArg1) {\r\n\t\t\treturn false; \r\n\t\t}\r\n\t\t// Handle default args (expr != NULL)\r\n\t\tif(pArg1->m_expression == NULL && pArg2->m_expression != NULL) {\r\n\t\t\t// Default arg\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif(pArg1->m_expression != NULL && pArg2->m_expression == NULL) {\r\n\t\t\t// Default arg\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tExpression* pArg\t= signature->m_expressions[n];\t\r\n\t\tif(pArg->m_runtimeType->m_genreID == EGENRE::_ENUM) {\r\n\t\t\t// Special case : 0 passed as a parameter for an enum\r\n\t\t\tif(pArg1->m_type->m_genreID == EGENRE::_ENUM && \r\n\t\t\t(pArg2->m_expression->m_expressionType == EXPR_CTE) && (pArg2->m_value.v.i == 0)) {\r\n\t\t\t\thasFoundBetter = true;\r\n\t\t\t}\r\n\t\t\tif(pArg2->m_type->m_genreID == EGENRE::_ENUM && \r\n\t\t\t(pArg1->m_expression->m_expressionType == EXPR_CTE) && (pArg1->m_value.v.i == 0)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tECOMPARISON comparison = compareConversions(pArg->m_runtimeType, pArg1->m_type, pArg2->m_type);\r\n\t\tif(comparison == ECOMPARISON::COMP_BETTER) {\r\n\t\t\thasFoundBetter = true;\r\n\t\t}\r\n\t\telse if(comparison == ECOMPARISON::COMP_WORSE) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\treturn hasFoundBetter;\r\n}\r\n\r\nbool isBetterFunctionMember(Variable* argList1, Variable* argList2, Variable* signature) {\r\n\tbool hasFoundBetter = false;\r\n\tVariable* pArg1\t\t= argList1;\r\n\tVariable* pArg2\t\t= argList2;\r\n\tfor(Variable* pSign = signature ; pSign ; pSign = pSign->m_pNextVariable, pArg1 = pArg1->m_pNextVariable, pArg2 = pArg2->m_pNextVariable) {\r\n\t\t// Handle default args (expr != NULL)\r\n\t\tif(pArg1->m_expression == NULL && pArg2->m_expression != NULL) {\r\n\t\t\t// Default arg\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif(pArg1->m_expression != NULL && pArg2->m_expression == NULL) {\r\n\t\t\t// Default arg\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(pSign->m_type->m_genreID == EGENRE::_ENUM) {\r\n\t\t\t// Special case : 0 passed as a parameter for an enum\r\n\t\t\tif(pArg1->m_type->m_genreID == EGENRE::_ENUM && \r\n\t\t\t(pArg2->m_expression->m_expressionType == EXPR_CTE) && (pArg2->m_value.v.i == 0)) {\r\n\t\t\t\thasFoundBetter = true;\r\n\t\t\t}\r\n\t\t\tif(pArg2->m_type->m_genreID == EGENRE::_ENUM && \r\n\t\t\t(pArg1->m_expression->m_expressionType == EXPR_CTE) && (pArg1->m_value.v.i == 0)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tECOMPARISON comparison = compareConversions(pSign->m_type, pArg1->m_type, pArg2->m_type);\r\n\t\tif(comparison == ECOMPARISON::COMP_BETTER) {\r\n\t\t\thasFoundBetter = true;\r\n\t\t}\r\n\t\telse if(comparison == ECOMPARISON::COMP_WORSE) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\treturn hasFoundBetter;\r\n}\r\n\r\nEMATCH compareSignatures(Variable* argList, Expression* signature) {\r\n\tbool identical = true;\r\n\tif(signature == NULL) {\r\n\t\tif(!argList) {\r\n\t\t\treturn EMATCH::M_IDENTICAL;\r\n\t\t}\r\n\t\tif(argList->m_expression) {\r\n\t\t\treturn EMATCH::M_APPLICABLE;\r\n\t\t}\r\n\t\treturn EMATCH::M_MISMATCH;\r\n\t}\r\n\tif(argList == NULL) {\r\n\t\tif(signature->m_expressionCount == 0) {\r\n\t\t\treturn EMATCH::M_IDENTICAL;\r\n\t\t}\r\n\t\treturn EMATCH::M_MISMATCH;\r\n\t}\r\n\tVariable* pMethodArg = argList;\r\n\tfor(int n = 0 ; n < signature->m_expressionCount ; n++, pMethodArg = pMethodArg->m_pNextVariable)\r\n\t{\r\n\t\tif(!pMethodArg) { \r\n\t\t\treturn EMATCH::M_MISMATCH; \r\n\t\t}\r\n\t\tExpression* pExpr = signature->m_expressions[n];\r\n\t\tTypeObject* argType = pMethodArg->m_type;\r\n\t\tTypeObject* signatureType = NULL;\r\n\r\n\t\tif(pMethodArg == NULL) {\r\n\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t}\r\n\t\tif(((pMethodArg->m_modifier & ATT_REF) != 0) && pExpr->m_expressionType != EXPR_REF) {\r\n\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t}\r\n\t\tif(argType->m_genreID == EGENRE::_ENUM) {\r\n\t\t\t// 0 can be implicitly converted to any enum.\r\n\t\t\tif(pExpr->m_expressionType == EXPR_CTE && pExpr->m_value.v.i == 0) {\r\n\t\t\t\tidentical = false;\r\n\t\t\t\tsignatureType = NULL;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse if(pExpr->m_runtimeType->m_definitionEnum == argType->m_definitionEnum) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(argType->isGC_Able() && pExpr->m_expressionType == EXPR_CTE && pExpr->m_value.v.i == 0) {\r\n\t\t\t// null pointer\r\n\t\t\tidentical = false;\r\n\t\t\tsignatureType = NULL;\r\n\t\t}\r\n\t\telse if(pExpr->m_expressionType == EXPR_REF) {\r\n\t\t\tif((pMethodArg->m_modifier & ATT_REF) == 0) {\r\n\t\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t\t}\r\n\t\t\tsignatureType = pExpr->m_expressions[0]->m_runtimeType;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tsignatureType = pExpr->m_runtimeType;\r\n\t\t}\r\n\t\tif(signatureType) {\r\n\t\t\tif(signatureType->m_typeID != argType->m_typeID) {\r\n\t\t\t\tif(signatureType->hasImplicitConversion(argType)) {\r\n\t\t\t\t\tidentical = false;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(signatureType->m_typeID == TYPE_ARRAY) {\r\n\t\t\t\tif(signatureType->hasImplicitConversion(argType)) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\treturn EMATCH::M_MISMATCH;\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(signatureType->hasCompatibleGenerics(argType, &identical)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(identical && pMethodArg == NULL) {\r\n\t\treturn EMATCH::M_IDENTICAL;\r\n\t}\r\n\treturn EMATCH::M_APPLICABLE;\r\n}\r\n\r\nEMATCH compareSignatures(Variable* argList, Variable* signature) {\r\n\tbool identical = true;\r\n\tif(signature == NULL || argList == NULL) {\r\n\t\tif(signature == NULL && argList == NULL) {\r\n\t\t\treturn EMATCH::M_IDENTICAL;\r\n\t\t}\r\n\t\treturn EMATCH::M_MISMATCH;\r\n\t}\r\n\tVariable* pMethodArg = argList;\r\n\tfor(Variable* pSign = signature ;  pSign ;  pSign = pSign->m_pNextVariable, pMethodArg = pMethodArg->m_pNextVariable)\r\n\t{\r\n\t\tTypeObject* signatureType = pSign->m_type;\r\n\t\tTypeObject* argType = pMethodArg->m_type;\r\n\t\tif(pMethodArg == NULL) {\r\n\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t}\r\n\t\tif((pMethodArg->m_modifier & ATT_REF) != (pSign->m_modifier & ATT_REF)) {\r\n\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t}\r\n\t\tif(argType->m_genreID == EGENRE::_ENUM) {\r\n\t\t\t// 0 can be implicitly converted to any enum.\r\n\t\t\tif(pSign->m_expression && pSign->m_expression->m_expressionType == EXPR_CTE && pSign->m_expression->m_value.v.i == 0) {\r\n\t\t\t\tidentical = false;\r\n\t\t\t\tsignatureType = NULL;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse if(signatureType->m_definitionEnum == argType->m_definitionEnum) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(argType->isGC_Able() && pSign->m_expression && pSign->m_expression->m_expressionType == EXPR_CTE && pSign->m_expression->m_value.v.i == 0) {\r\n\t\t\t// null pointer\r\n\t\t\tidentical = false;\r\n\t\t\tsignatureType = NULL;\r\n\t\t}\r\n\t\telse if(signatureType->m_typeID != argType->m_typeID) {\r\n\t\t\tif(signatureType->hasImplicitConversion(argType)) {\r\n\t\t\t\tidentical = false;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn EMATCH::M_MISMATCH;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(signatureType->m_typeID == TYPE_ARRAY) {\r\n\t\t\tif(signatureType->hasImplicitConversion(argType)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn EMATCH::M_MISMATCH;\t\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(identical && pMethodArg == NULL) {\r\n\t\treturn EMATCH::M_IDENTICAL;\r\n\t}\r\n\treturn EMATCH::M_APPLICABLE;\r\n}\r\n\r\n//\r\n// Replaces <<T>> by classList elements and <BODY> by the associated methodBody element.\r\n//\r\n// Sample :\r\n// const char* templateList = \"template<> struct __InternalUtilsGetTypeID<<T>> { \";\r\n// const char* bodyCsteList = \"static u32 getIt() { return <BODY>; }\";\r\n// const char* templateEndList = \" };\";\r\n//\r\nbool templateClassSpecializationDumpForOneGenericType(const char** templateList, const char** bodyCsteList, const char** templateEndList, u32 templateListLength, const char** classList, const char** classBody, u32 classListLenght) {\r\n\tfor(u32 i_template = 0; i_template < templateListLength; ++i_template) {\r\n\t\tfor(u32 i_class = 0; i_class < classListLenght; ++i_class) {\r\n\t\t\tconst char* t = templateList[i_template];\r\n\t\t\tconst char* c = classList[i_class];\r\n\t\t\t// template part (until open bracket).\r\n\t\t\twhile(*t != '\\0') {\r\n\t\t\t\tif(*t == '\\\\') {\r\n\t\t\t\t\tt++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(*t == '<') {\r\n\t\t\t\t\t\tt++;\r\n\t\t\t\t\t\tif(*t=='<') {\r\n\t\t\t\t\t\t\t// Replace <<T>> by <ClassName1, ClassName2, ClassName3>\r\n\t\t\t\t\t\t\tprintf(\"<%s\", c);\r\n\t\t\t\t\t\t\tt += 2;\r\n\t\t\t\t\t\t\tif(*t == '>' && *(t+1) == '>') {\r\n\t\t\t\t\t\t\t\tprintf(\">\");\r\n\t\t\t\t\t\t\t\tt += 2;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if(*t == 'T' && *(t+1) == '>') {\r\n\t\t\t\t\t\t\t// replace <T> by ClassName\r\n\t\t\t\t\t\t\tprintf(\"%s\", c);\r\n\t\t\t\t\t\t\tt += 2;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tprintf(\"<%c\", *t++);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprintf(\"%c\", *t++);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// method body\r\n\t\t\tt = bodyCsteList[i_template];\r\n\t\t\twhile(*t != '\\0') {\r\n\t\t\t\tif(*t == '\\\\') {\r\n\t\t\t\t\tt++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(*t == '<' && *(t+1) == 'B' && *(t+2) == 'O' && *(t+3) == 'D' && *(t+4) == 'Y' && *(t+5) == '>') {\r\n\t\t\t\t\t\t// Replace <BODY> by methodBody\r\n\t\t\t\t\t\tprintf(\"%s\", classBody[i_class]);\r\n\t\t\t\t\t\tt+= 6;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprintf(\"%c\", *t++);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintf(\"%s\\n\", templateEndList[i_template]);\r\n\t\t}\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\n// Returns the path without its file.\r\nconst char* pathName(const char* path)\r\n{\r\n\tchar buf[500];\r\n\tint i = strlen(path);\r\n\tfor(; i >= 0 && path[i] != '\\\\' ; i--);\r\n\tif(path[i] == '\\\\')\r\n\t{\r\n\t\tmemcpy(buf, path, (++i)*sizeof(char));\r\n\t\tbuf[i] = 0;\r\n\t\treturn strdup(buf);\r\n\t}\r\n\treturn strdup(path);\r\n}\r\n\r\n// TODO force enum to have only direct constant expression --> More complex expression are forbidden for dependancy reason.\r\nbool\t\t\t\tg_forArgument\t\t= false;\r\nbool\t\t\t\tg_noDump\t\t\t= false;\r\nbool\t\t\t\tg_registerClasses\t= false;\r\nbool\t\t\t\tg_unsafe\t\t\t= false;\r\nbool\t\t\t\tg_unsafeEphemeral\t= false;\r\nbool\t\t\t\tg_analysis_static\t= false;\r\nbool\t\t\t\tgIsStaticFunc\t\t= false;\r\nbool\t\t\t\tgTransformAsDelegate= false;\r\n\r\nint\t\t\t\t\tgGlobalClassID\t\t= 0;\r\nint\t\t\t\t\tgSwitchCount\t\t= 0;\r\nint\t\t\t\t\tgAnonymous\t\t\t= 0;\r\nVariable*\t\t\tgCurrVar\t\t\t= NULL;\r\nMethod*\t\t\t\tgCurrentMethod\t\t= NULL;\r\nAbstractContainer*\tgCurrentAC\t\t\t= NULL;\r\nEnum*\t\t\t\tgCurrEnum\t\t\t= NULL;\r\nStringID*\t\t\tgStrList\t\t\t= NULL;\r\nSymbolDictionary*\tgCurrentSD\t\t\t= NULL;\r\nTypeObject*\t\t\tgReturnType\t\t\t= NULL;\r\n\r\nNameSpace*\t\t\tgRootNameSpace\t\t= (new NameSpace())->setup(0,\"\");\r\nNameSpace*\t\t\tgCurrentNameSpace\t= gRootNameSpace;\r\nAbstractContainer*\tgStaticContextAC\t= NULL;\r\nDependancyMatrix*\tgStaticDepMatrix\t= new DependancyMatrix();\r\nClassDictionary*\tgClassDictionary\t= new ClassDictionary();\r\n\r\nDependancyMatrix::Storage* DependancyMatrix::m_dependancyStorage[]\t\t= { NULL, NULL, NULL, NULL, NULL };\r\nDependancyMatrix::Storage* DependancyMatrix::m_dependancyStorageEnd[]\t= { NULL, NULL, NULL, NULL, NULL };\r\n\r\n//\r\n// DO NOT PUT CODE HERE, all global variable instance at the end of this file.\r\n//\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/compilerLibrary.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __COMPILER_FRAMEWORK_H\r\n#define __COMPILER_FRAMEWORK_H\r\n\r\n#define __NOTRACE__\r\n#define\t__FULLNAMES__\r\n\r\n#include \"BaseType.h\"\r\n#include \"Variable.h\"\r\n#include \"NameSpace.h\"\r\n#include \"TypeObject.h\"\r\n\r\nvoid lex_in_generic();\r\nvoid lex_out_generic();\r\n\r\n// -----------------------------------------------------------------------\r\n//  Definition of classes\r\n// -----------------------------------------------------------------------\r\n\r\nenum OPOVERRIDE {\r\n\tOPOVR_INDEXER\t\t\t= 0x00000001,\r\n\t// +   -   !   ~   ++   --   true   false\r\n\tOPOVR_UNARYPLUS\t\t\t= 0x00000002,\r\n\tOPOVR_UNARYMINUS\t\t= 0x00000004,\r\n\tOPOVR_UNARYNOT\t\t\t= 0x00000008,\r\n\tOPOVR_UNARYNEG\t\t\t= 0x00000010,\r\n\tOPOVR_UNARYPLUSPLUS\t\t= 0x00000020,\r\n\tOPOVR_UNARYMINUSMINUS\t= 0x00000040,\r\n\tOPOVR_UNARYTRUE\t\t\t= 0x00000080,\r\n\tOPOVR_UNARYFALSE\t\t= 0x00000100,\r\n\t// +   -   *   /   %   &   |   ^   <<   >>   ==   !=   >   <   >=   <=\r\n\tOPOVR_BINARYPLUS\t\t= 0x00001000,\r\n\tOPOVR_BINARYMINUS\t\t= 0x00002000,\r\n\tOPOVR_BINARYMULT\t\t= 0x00004000,\r\n\tOPOVR_BINARYDIV\t\t\t= 0x00008000,\r\n\tOPOVR_BINARYMOD\t\t\t= 0x00010000,\r\n\tOPOVR_BINARYAND\t\t\t= 0x00020000,\r\n\tOPOVR_BINARYOR\t\t\t= 0x00040000,\r\n\tOPOVR_BINARYXOR\t\t\t= 0x00080000,\r\n\tOPOVR_BINARYLSHFT\t\t= 0x00100000,\r\n\tOPOVR_BINARYRSHFT\t\t= 0x00200000,\r\n\tOPOVR_BINARYEQU\t\t\t= 0x00400000,\r\n\tOPOVR_BINARYDIFF\t\t= 0x00800000,\r\n\tOPOVR_BINARYGREATER\t\t= 0x01000000,\r\n\tOPOVR_BINARYLESSER\t\t= 0x02000000,\r\n\tOPOVR_BINARYGREATEREQ\t= 0x04000000,\r\n\tOPOVR_BINARYLESSEREQ\t= 0x08000000,\r\n};\r\n\r\nclass Uses {\r\npublic:\r\n\tUses();\r\n\t~Uses();\r\n\r\n\tvoid\t\taddNameSpace\t\t\t(Symbol* nameSpace);\r\n\r\n\tSymbol**\tm_uses;\r\n\tu32\t\t\tm_useCount;\r\n};\r\n\r\nclass Argument : public Variable {\r\npublic:\r\n\tu32\t\t\t\t\tmode;\t// By reference, in, out, ....\r\n\tTypeObject*\t\t\ttype;\r\n\tconst char*\t\t\tname;\r\n};\r\n\r\n\r\nclass Accessor : public Symbol {\r\npublic:\r\n\tAccessor();\r\n\t~Accessor();\r\n\tvirtual int getGenre();\r\n\r\n\tvoid setAsIndexer(TypeObject* type, Variable* signature) {\r\n\t\tm_type\t\t= type;\r\n\t\tm_variable\t= signature;\r\n\t}\r\n\tvoid dumpParams(bool call, bool addComma = false);\r\n\r\n\tAttribute*\tm_attribute;\r\n\tTypeObject*\tm_type;\r\n\tAccessor*\tm_get;\r\n\tAccessor*\tm_set;\r\n\tIndexer*\tm_indexer;\r\n\tStatement*\tm_statement;\r\n\tAbstractContainer* m_ownerClass;\r\n\tVariable*\tm_variable;\r\n\tu32\t\t\tm_modifier;\r\n};\r\n\r\nclass Method : public Symbol {\r\npublic:\r\n\tMethod();\r\n\tvirtual int\t\t\t\t\tgetGenre();\r\n\tvirtual const char*\t\t\tgetName();\r\n\r\n\tvoid\t\t\t\t\t\tsetupHasDefaultParams();\r\n\tvoid\t\t\t\t\t\tresolveDefaultParams();\r\n\tvoid\t\t\t\t\t\tsetGenericParam();\r\n\tTypeObject*\t\t\t\t\tgetGenericType(TypeGenericDefinitionEntry* genericSymbol, TypeGenericEntry* genericParams);\t\r\n\tconst char*\t\t\t\t\tgetTemplateParams();\r\n\tvoid\t\t\t\t\t\tdumpTemplateLabel();\r\n\tconst char*\t\t\t\t\tgetGenCallParams();\r\n\tvoid\t\t\t\t\t\tpreFunc();\r\n\tvoid\t\t\t\t\t\tdumpMarshalling();\r\n\tvoid\t\t\t\t\t\tdumpParamsDef();\r\n\tvoid\t\t\t\t\t\tdumpParamsDef(char* buffer, bool doCall, bool dumpDefault);\r\n\tvoid\t\t\t\t\t\tdumpCall(Expression* expr, bool delegateCall, TypeGenericEntry* genericParams);\r\n\r\n\tbool\t\t\t\t\t\tanalyzeRef();\r\n\tinline Attribute*\t\t\tgetAttr() { return m_attribute; }\r\n\r\n\tTypeGenericDefinitionEntry*\tfindGenericSymbol(const char* name); \r\n\r\n\tAttribute*\t\t\t\t\tm_attribute;\r\n\tVariable*\t\t\t\t\tm_parameters;\r\n\tTypeObject*\t\t\t\t\tm_returnType;\r\n\tStatement*\t\t\t\t\tm_codeBlock;\r\n\tu32\t\t\t\t\t\t\tm_modifier;\r\n\tu32\t\t\t\t\t\t\tm_referenceModifCount;\r\n\tAbstractContainer*\t\t\tm_pOwner;\r\n\tExpression*\t\t\t\t\tm_initializerOpt;\r\n\ts32\t\t\t\t\t\t\tm_initializerType;\r\n\tTypeGenericDefinitionEntry*\tm_genericParam;\r\n\tbool\t\t\t\t\t\tm_bResolvedParam;\r\n};\r\n\r\nclass MethodList : public Method {\r\npublic:\r\n\tMethod*\t\tm_method;\r\n\tMethodList*\tm_nextMethod;\r\n\tint\t\t\tm_count;\r\n\r\n\tMethodList(Method* head = NULL);\r\n\tvirtual int getGenre();\r\n\tvoid add(Method* method);\r\n};\r\n\r\n// Delegate is just a disguised Method\r\nclass Delegate : public Method {\r\npublic:\r\n\tDelegate();\r\n\tvirtual int getGenre();\r\n\tvirtual const char*\tgetName();\r\n\tvirtual const char* getFullName(NameSpace* ref);\r\n\tNameSpace*\tgetOwner();\r\n\r\n\tconst char*\tgenerateTypeID();\r\n\tvoid\t\tdumpDefinition(const char* prefix);\r\n\tTypeObject*\tgetType();\r\n\r\n\tTypeObject* m_type;\t\r\n\tDelegate*\tm_cppRepresentation;\r\n\tDelegate*\tm_csharpRepresentation;\r\n};\r\n\r\nclass Enum : public NameSpace {\r\npublic:\r\n\tEnum();\r\n\tTypeObject*\tgetType();\r\n\tvirtual int getGenre();\r\n\tvirtual const char* getFullName(NameSpace* ref = NULL);\r\n\tstatic inline const char* substitute() { return \"s32\"; }\r\n\r\n\tclass EnumEntry : public Symbol {\r\n\tpublic:\r\n\t\tEnumEntry();\r\n\r\n\t\tEnumEntry*\tm_pNext;\r\n\t\tAttribute*\tm_pAttrib;\r\n\t\tconst char*\tm_name;\r\n\t\tExpression*\tm_expression;\r\n\t\tEnum*\t\tm_parent;\r\n\t};\r\n\r\n\tvoid\taddEntry(Attribute* pAttrib, const char* name, Expression* pExpr);\r\n\tEnumEntry* findValue(const char* name);\r\n\r\n\tEnumEntry*\tm_list;\r\n\tAttribute*\tm_attribute;\r\n\tu32\t\t\tm_modifier;\r\n\tTypeObject*\tm_type;\r\n\tTypeObject\tm_rtype;\r\n\tNameSpace*\tm_parent;\r\n};\r\n\r\nclass StringList {\r\npublic:\r\n\tchar* content;\r\n\tStringList* pNext;\r\n\r\n\tinline StringList() : content(NULL), pNext(NULL) {}\r\n\tinline ~StringList() {\r\n\t\tdelete[] content;\r\n\t\tdelete pNext;\r\n\t}\r\n};\r\n\r\nclass Quals {\r\npublic:\r\n\tQuals(u32 rank);\r\n\tQuals* addQuals(u32 rank);\r\n\r\n\tu32 rank;\r\n\tQuals*\tm_pNext;\r\n};\r\n\r\n//\r\n// TODO : refactory the dependancy class into a template and instances for each use cases.\r\n//\r\nclass DependancyMatrix {\r\npublic:\r\n\tstatic void clear\t\t\t\t\t\t();\r\n\tstatic void registerVariable\t\t\t(Variable* pVar, int domain = 1);\r\n\tstatic void createDependancy\t\t\t(Variable* pVar, Variable* uses);\r\n\tstatic void createDependancy\t\t\t(AbstractContainer* pContainer, AbstractContainer* uses);\r\n\tstatic Variable* popIndependantVariable\t(int domain = 1);\r\n\tstatic AbstractContainer* popIndependantAbstractContainer\t(int domain = 2);\r\n\tstatic void registerAbstractContainer\t(AbstractContainer* pCnt, int domain = 2);\r\n\tstatic inline bool hasRemainingAC\t\t() { return (m_dependancyStorage[1] != NULL); }\r\nprivate:\r\n\tstatic Symbol* popIndependantSymbol\t\t(EGENRE genre, u32 mask, int domain = 1);\r\n\tstruct Storage {\r\n\t\tStorage*\tm_next;\r\n\t\tSymbol*\t\tm_pSymbol;\r\n\t};\r\n\tstatic Storage*\t\tm_dependancyStorage[5];\r\n\tstatic Storage*\t\tm_dependancyStorageEnd[5];\r\n};\r\n\r\nclass SymbolDictionary {\r\npublic :\r\n\ttypedef struct VariableList{\r\n\t\tVariable* content;\r\n\t\tVariableList* pNext;\r\n\t}VariableList;\r\n\r\n\tSymbolDictionary*\tm_parent;\r\n\tSymbolDictionary*\tm_child;\r\n\tVariableList*\t\tm_list;\r\n\r\n\tSymbolDictionary(SymbolDictionary* parent = NULL);\r\n\t~SymbolDictionary();\r\n\tvoid addVariable(Variable* var);\r\n\tSymbolDictionary* addDictionary();\t\t//returns the new dictionary\r\n\tSymbolDictionary* removeDictionary();\t//returns the parent\r\n\tVariable* findVariable(const char*);\r\n};\r\n\r\nstruct ClassDictionary {\r\npublic :\r\n\tconst char**\tclasses;\r\n\tconst char**\tIDs;\r\n\tint\t\t\t\tcount;\r\n\r\n\tClassDictionary();\r\n\tvoid add(const char* name, const char* IDExpression);\r\n};\r\n\r\n//\r\n// Helper Functions.\r\n//\r\n\r\nExpression*\tCreateDelegateExpr\t(Variable* params, Statement* pStatement);\r\nDelegate*\tCreateDelegate\t\t(Attribute* attribute, u32 modifier, TypeObject* type, const char* name, Variable* params);\r\nAccessor*\tCreateAccessor\t\t(Attribute* attribute, Statement* pStatement);\r\nAccessor*\tCreateAccessor\t\t(Accessor* get_, Accessor* _set);\r\nIndexer*\tCreateIndexer\t\t(TypeObject* type, Variable* variable);\r\nEnum*\t\tCreateEnum\t\t\t(Attribute* attribute, u32 modifier, const char* name, TypeObject* type);\r\nvoid\t\tuseOrCreateNameSpace(Attribute* attribute, const char* nameSpace);\r\nvoid\t\tunuseNameSpace\t\t();\r\n\r\nvoid\t\tcreateAlias\t\t\t(const char* alias, const char* originalName);\r\nvoid\t\taddUsingNameSpace\t(const char* nameSpace);\r\nconst char* concat(const char* a);\r\nconst char* concat2(const char* a, const char* b);\r\nconst char* concat3(const char* a, const char* b, const char* c);\r\n\r\nvoid\t\ttraceFunc\t\t\t(int line, int inputline, const char* token);\r\nvoid\t\ttab\t\t\t\t\t();\r\nNameSpace*\tPopSpace\t\t\t();\r\nvoid\t\tPushSpace\t\t\t(NameSpace* newCurrentSpace);\r\n\r\nvoid\t\tdisplay\t\t\t\t(const char* str);\t//used for debugging\r\nStringList*\tsplit\t\t\t\t(const char* str);\t//splits an \"A.B.C\" string into an A->B->C chain.\r\n\r\nextern  NameSpace*\t\t\tgRootNameSpace;\r\nextern\tAbstractContainer*\tgStaticContextAC;\r\nextern\tAbstractContainer*\tgCurrentAC;\r\nextern  Method*\t\t\t\tgCurrentMethod;\r\nextern\tEnum*\t\t\t\tgCurrEnum;\r\nextern\tVariable*\t\t\tgCurrVar;\r\nextern  TypeObject*\t\t\tgReturnType;\r\nextern\tint\t\t\t\t\tdepth;\r\nextern  int\t\t\t\t\tgGlobalClassID;\r\nextern  int\t\t\t\t\tgSwitchCount;\r\nextern  int\t\t\t\t\tgAnonymous;\r\nextern  bool\t\t\t\tg_unsafe;\r\nextern  bool\t\t\t\tg_unsafeEphemeral;\r\nextern\tStringID*\t\t\tgStrList;\r\nextern\tSymbolDictionary*\tgCurrentSD;\r\nextern  DependancyMatrix*\tgStaticDepMatrix;\r\nextern\tClassDictionary*\tgClassDictionary;\r\nextern  bool\t\t\t\tg_analysis_static;\t// Set as parameter bitmaksk in expression dump.\r\nextern  bool\t\t\t\tg_noDump;\r\nextern\tbool\t\t\t\tg_registerClasses;\r\nextern  bool\t\t\t\tgIsStaticFunc;\r\nextern\tbool\t\t\t\tg_forArgument;\r\nextern  bool\t\t\t\tgTransformAsDelegate;\r\nstruct SInitialization;\r\nextern  SInitialization*\tgGlobalInitList;\r\n\r\nextern  TypeObject\t\t\tt_INT;\r\nextern  TypeObject\t\t\tt_BOOL;\r\nextern  TypeObject\t\t\tt_OBJECT;\r\n\r\nextern  TypeObject\t\t\tt_STRING;\r\nextern  TypeObject\t\t\tt_NULL;\r\nextern  TypeObject\t\t\tt_DOUBLE;\r\nextern  TypeObject\t\t\tt_FLOAT;\r\nextern  TypeObject\t\t\tt_UINT;\r\nextern  TypeObject\t\t\tt_LONG;\r\nextern  TypeObject\t\t\tt_ULONG;\r\nextern  TypeObject\t\t\tt_CHAR;\r\nextern  int\t\t\t\t\tyylineno;\r\n\r\nvoid resetLocalFileInfo();\r\nSValue registerString(SValue v);\r\nbool checkEntryPoint(u32 compilerOptions);\r\nvoid generateOutput(const char* outputPath, u32 compilerOptions);\r\nvoid exportRuntimeIncludes();\r\nvoid exportFrameworkHeader();\r\nvoid exportFrameworkFooter();\r\nvoid exportNameSpaceHeader(NameSpace* nSpace, bool forExport);\r\nvoid exportNameSpaceImplementation(NameSpace* nSpace);\r\nvoid exportPrototypes();\r\nvoid exportConstants();\r\nvoid exportInlineFiles(const char* outputPath, ClassDictionary* CD);\r\nvoid initBaseType();\r\nvoid registerGCWorld(NameSpace* root, u32 compilerOptions);\r\nvoid GenerateInitList();\r\nvoid PopInitList();\r\nExpression* getInitList();\r\n\r\nvoid addGenericName(const char* name);\r\nTypeGenericDefinitionEntry* popGenericNameList();\r\nTypeGenericEntry* PopGenericType();\r\nvoid PushGenericType(TypeGenericEntry* data);\r\n\r\nvoid\t\tgetContext(Symbol* symbol, NameSpace*& out_namespace, Method*& out_method);\r\nSRSymbol\tresolveSimpleSymbol(SRSymbol baseContext, const char*, u8 searchMask, Expression* methodSignature = NULL, Variable* delegateSignature = NULL, TypeGenericEntry* genParams = NULL);\r\nbool\t\tisBetterFunctionMember(Variable* argList1, Variable* argList2, Expression* signature);\r\nbool\t\tisBetterFunctionMember(Variable* argList1, Variable* argList2, Variable* signature);\r\nEMATCH\t\tcompareSignatures(Variable* argList, Expression* signature);\r\nEMATCH\t\tcompareSignatures(Variable* argList, Variable* signature);\r\n\r\nbool templateClassSpecializationDumpForOneGenericType(const char** templateList, const char** bodyCsteList, const char** templateEndList, u32 templateListLength, const char** classList, const char** classBody, u32 classListLenght);\r\nconst char* pathName(const char* path);\r\n\r\n// Trace parser state.\r\n#ifndef __NOTRACE__\r\n#define\tR()\t\t\t\t\ttraceFunc(__LINE__, yylineno, NULL/*yytname[YYTRANSLATE(yychar)]*/);\r\n#else\r\n#define R()\t\t\t\t\t;\r\n#endif\r\n\r\n// do nothing, no debug.\r\n//#define R()\t\t\t\t\t\t{}\r\n#endif\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/csharp.l",
    "content": "/*** \r\n *** C# parser/scanner\r\n *** Copyright 2002 James Power, NUI Maynooth, Ireland <james.power@may.ie>\r\n *** This version: 19 Feb 2002\r\n ***\r\n* Redistribution and use in source and binary forms, with or without\r\n* modification, are permitted provided that the following conditions are met:\r\n*     * Redistributions of source code must retain the above copyright\r\n*       notice, this list of conditions and the following disclaimer.\r\n*     * Redistributions in binary form must reproduce the above copyright\r\n*       notice, this list of conditions and the following disclaimer in the\r\n*       documentation and/or other materials provided with the distribution.\r\n*     * Neither the name of the <organization> nor the\r\n*       names of its contributors may be used to endorse or promote products\r\n*       derived from this software without specific prior written permission.\r\n*\r\n* THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY\r\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY\r\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ***/\r\n%{\r\n#include <string.h>\r\n// #include \"csharp.tab.h\"\r\n#include \"y.tab.h\"\r\n\r\n  void lexical_error(const char *);\r\n  static int token_for(const char *);\r\n  static int is_allowed_char(const char );\r\n  static SValue getValueInt(const char* text);\r\n  static SValue getValueReal(const char* text);\r\n  static SValue getValueChar(const char* text);\r\n  static SValue getValueString(const char* text);\r\n  static SValue getValueNull();\r\n  static int getRank(const char* text);\r\n%}\r\n\r\n%option noyywrap\r\n%option yylineno\r\n%option stack\r\n\r\nsingle_line_comment    \"//\".*\r\n\r\nwhite_space            [ \\t\\n\\r]\r\n\r\npreprocessor           ^[ \\t]*#.*\r\n\r\ndec_digit              [0-9]\r\nhex_digit              [0-9A-Fa-f]\r\nint_suffix             [UuLl]|[Uu][Ll]|[Ll][Uu]\r\ndec_literal            {dec_digit}+{int_suffix}?\r\nhex_literal            0[xX]{hex_digit}+{int_suffix}?\r\ninteger_literal        {dec_literal}|{hex_literal}\r\n\r\nreal_suffix            [FfDdMm]\r\nsign                   [+\\-]\r\nexponent_part          [eE]{sign}?{dec_digit}+\r\nwhole_real1            {dec_digit}+{exponent_part}{real_suffix}?\r\nwhole_real2            {dec_digit}+{real_suffix}\r\npart_real              {dec_digit}*\\.{dec_digit}+{exponent_part}?{real_suffix}?\r\nreal_literal           {whole_real1}|{whole_real2}|{part_real}\r\n\r\nsingle_char            [^\\\\\\']\r\nsimple_esc_seq         \\\\[\\'\\\"\\\\0abfnrtv]\r\nuni_esc_seq1           \\\\u{hex_digit}{4}\r\nuni_esc_seq2           \\\\U{hex_digit}{8}\r\nuni_esc_seq            {uni_esc_seq1}|{uni_esc_seq2}\r\nhex_esc_seq            \\\\x{hex_digit}{1,4}\r\ncharacter              {single_char}|{simple_esc_seq}|{hex_esc_seq}|{uni_esc_seq1}\r\ncharacter_literal      \\'{character}\\'\r\n\r\n\r\nsingle_string_char     [^\\\\\\\"]\r\nreg_string_char        {single_string_char}|{simple_esc_seq}|{hex_esc_seq}|{uni_esc_seq}\r\nregular_string         \\\"{reg_string_char}*\\\"\r\nsingle_verbatim_char   [^\\\"]\r\nquote_esc_seq          \\\"\\\"\r\nverb_string_char       {single_verbatim_char}|{quote_esc_seq}\r\nverbatim_string        @\\\"{verb_string_char}*\\\"\r\nstring_literal         {regular_string}|{verbatim_string}\r\n\r\n\r\nletter_char            [A-Za-z]\r\nident_char             {dec_digit}|{letter_char}|\"_\"|\"@\"\r\nidentifier             ({letter_char}|\"_\"){ident_char}*\r\nat_identifier          \\@{identifier}\r\n\r\n\r\nrank_specifier         \"[\"{white_space}*(\",\"{white_space}*)*\"]\"\r\n\r\n\r\n%x IN_COMMENT IN_GENERIC\r\n\r\n%s IN_ATTRIB IN_ACCESSOR IN_GETSET \r\n\r\n%%\r\n\r\n{preprocessor}        { ; /* ignore */ }\r\n{white_space}         { ; /* ignore */ }\r\n<IN_GENERIC>{preprocessor}        { ; /* ignore */ }\r\n<IN_GENERIC>{white_space}         { ; /* ignore */ }\r\n\r\n\"/*\"                  { yy_push_state(IN_COMMENT); }\r\n<IN_COMMENT>.         { ; /* ignore */ }\r\n<IN_COMMENT>\\n        { ; /* ignore */ }\r\n<IN_COMMENT>\"*/\"      { yy_pop_state();}\r\n\r\n{single_line_comment} { ; /* ignore */ }\r\n<IN_GENERIC>{single_line_comment} { ; /* ignore */ }\r\n\r\n                      /* yytext yylval.xxx */\r\n{integer_literal}     { yylval.value = getValueInt(yytext);\t\treturn INTEGER_LITERAL; \t}\r\n<IN_GENERIC>{integer_literal}     { yylval.value = getValueInt(yytext);\t\treturn INTEGER_LITERAL; \t}\r\n{real_literal}        { yylval.value = getValueReal(yytext);\treturn REAL_LITERAL; \t\t}\r\n<IN_GENERIC>{real_literal}        { yylval.value = getValueReal(yytext);\treturn REAL_LITERAL; \t\t}\r\n{character_literal}   { yylval.value = getValueChar(yytext);\treturn CHARACTER_LITERAL; \t}\r\n<IN_GENERIC>{character_literal}   { yylval.value = getValueChar(yytext);\treturn CHARACTER_LITERAL; \t}\r\n{string_literal}      { yylval.value = getValueString(yytext);\treturn STRING_LITERAL; \t\t}\r\n<IN_GENERIC>{string_literal}      { yylval.value = getValueString(yytext);\treturn STRING_LITERAL; \t\t}\r\n\r\n\",\"   { return COMMA; }\r\n<IN_GENERIC>\",\"   { return COMMA; }\r\n\"[\"   { return LEFT_BRACKET; }\r\n<IN_GENERIC>\"[\"   { return LEFT_BRACKET; }\r\n\"]\"   { return RIGHT_BRACKET; }\r\n<IN_GENERIC>\"]\"   { return RIGHT_BRACKET; }\r\n\r\n{rank_specifier}     { yylval.tmpValue = getRank(yytext); /*printf(\"Rank : %s\\n\",yytext);*/ return RANK_SPECIFIER; }\r\n<IN_GENERIC>{rank_specifier}     { yylval.tmpValue = getRank(yytext); /*printf(\"Rank : %s\\n\",yytext);*/ return RANK_SPECIFIER; }\r\n\r\n                      /*** Multi-Character Operators ***/\r\n\"+=\"  { return PLUSEQ;\t}\r\n\"-=\"  { return MINUSEQ;\t}\r\n\"*=\"  { return STAREQ;\t}\r\n\"/=\"  { return DIVEQ;\t}\r\n\"%=\"  { return MODEQ;\t}\r\n\"^=\"  { return XOREQ;\t}\r\n\"&=\"  { return ANDEQ;\t}\r\n\"|=\"  { return OREQ;\t}\r\n\"<<\"  { return LTLT;\t}\r\n<INITIAL>\">>\"  { return GTGT;\t}\t/* Trick for >> handling in generic */\r\n\">>=\" { return GTGTEQ;\t}\r\n\"<<=\" { return LTLTEQ;\t}\r\n\"==\"  { return EQEQ;\t}\r\n\"!=\"  { return NOTEQ;\t}\r\n\"<=\"  { return LEQ;\t\t}\r\n\">=\"  { return GEQ;\t\t}\r\n\"&&\"  { return ANDAND;\t}\r\n\"||\"  { return OROR;\t}\r\n\"++\"  { return PLUSPLUS;\t}\r\n\"--\"  { return MINUSMINUS;\t}\r\n\"->\"  { return ARROW;\t}\r\n\">\"\t  { return GT;\t  }\r\n<IN_GENERIC>\">\"\t  { return GT;\t  }\r\n\"<\"\t  { return LT;\t  }\r\n<IN_GENERIC>\"<\"\t  { return LT;\t  }\r\n\"$<\"\t{ return GEN_LT; }\r\n\"$>\"\t{ return GEN_GT; }\r\n<IN_GENERIC>\"$<\" { return GEN_LT; }\r\n<IN_GENERIC>\"$>\" { return GEN_GT; }\r\n\r\n                      /*** Those context-sensitive \"keywords\" ***/\r\n\r\n<IN_ATTRIB>\"assembly\"    { return ASSEMBLY; }\r\n<IN_ATTRIB>\"field\"       { return FIELD; }\r\n<IN_ATTRIB>\"method\"      { return METHOD; }\r\n<IN_ATTRIB>\"module\"      { return MODULE; }\r\n<IN_ATTRIB>\"param\"       { return PARAM; }\r\n<IN_ATTRIB>\"property\"    { return PROPERTY; }\r\n<IN_ATTRIB>\"type\"        { return TYPE; }\r\n\r\n<IN_ACCESSOR>\"add\"       { return ADD; }\r\n<IN_ACCESSOR>\"remove\"    { return REMOVE; }\r\n\r\n<IN_GETSET>\"get\"         { return GET; }\r\n<IN_GETSET>\"set\"         { return SET; }\r\n\r\n{identifier}          { return token_for(yytext); }\r\n<IN_GENERIC>{identifier}          { return token_for(yytext); }\r\n\r\n{at_identifier}       { yylval.text = concat(yytext); return IDENTIFIER; }\r\n\r\n\r\n.     { \r\n        if (is_allowed_char(yytext[0])) return yytext[0];\r\n        else lexical_error(\"invalid token\"); \r\n      }\r\n%%\r\n\r\n\r\nstatic struct name_value {\r\n  char *name;\r\n  int value;\r\n} name_value;\r\nstatic struct name_value keywords [] = { \r\n /* This list must remain sorted!!! */\r\n    {\"abstract\", ABSTRACT},\r\n    {\"as\", AS},\r\n    {\"base\", BASE},\r\n    {\"bool\", BOOL},\r\n    {\"break\", BREAK},\r\n    {\"byte\", BYTE},\r\n    {\"case\", CASE},\r\n    {\"catch\", CATCH},\r\n    {\"char\", CHAR},\r\n    {\"checked\", CHECKED},\r\n    {\"class\", CLASS},\r\n    {\"const\", CONST},\r\n    {\"continue\", CONTINUE},\r\n    {\"decimal\", DECIMAL},\r\n    {\"default\", DEFAULT},\r\n    {\"delegate\", DELEGATE},\r\n    {\"do\", DO},\r\n    {\"double\", DOUBLE},\r\n    {\"else\", ELSE},\r\n    {\"enum\", ENUM},\r\n    {\"event\", EVENT},\r\n    {\"explicit\", EXPLICIT},\r\n    {\"extern\", EXTERN},\r\n    {\"false\", FALSE},\r\n    {\"finally\", FINALLY},\r\n    {\"fixed\", FIXED},\r\n    {\"float\", FLOAT},\r\n    {\"for\", FOR},\r\n    {\"foreach\", FOREACH},\r\n    {\"goto\", GOTO},\r\n    {\"if\", IF},\r\n    {\"implicit\", IMPLICIT},\r\n    {\"in\", IN},\r\n    {\"int\", INT},\r\n    {\"interface\", INTERFACE},\r\n    {\"internal\", INTERNAL},\r\n    {\"is\", IS},\r\n    {\"lock\", LOCK},\r\n    {\"long\", LONG},\r\n    {\"namespace\", NAMESPACE},\r\n    {\"new\", NEW},\r\n    {\"null\", NULL_LITERAL},\r\n    {\"object\", OBJECT},\r\n    {\"operator\", OPERATOR},\r\n    {\"out\", OUT},\r\n    {\"override\", OVERRIDE},\r\n    {\"params\", PARAMS},\r\n\t{\"partial\", PARTIAL},\r\n    {\"private\", PRIVATE},\r\n    {\"protected\", PROTECTED},\r\n    {\"public\", PUBLIC},\r\n    {\"readonly\", READONLY},\r\n    {\"ref\", REF},\r\n    {\"return\", RETURN},\r\n    {\"sbyte\", SBYTE},\r\n    {\"sealed\", SEALED},\r\n    {\"short\", SHORT},\r\n    {\"sizeof\", SIZEOF},\r\n    {\"stackalloc\", STACKALLOC},\r\n    {\"static\", STATIC},\r\n    {\"string\", STRING},\r\n    {\"struct\", STRUCT},\r\n    {\"switch\", SWITCH},\r\n    {\"this\", THIS},\r\n    {\"throw\", THROW},\r\n    {\"true\", TRUE},\r\n    {\"try\", TRY},\r\n    {\"typeof\", TYPEOF},\r\n    {\"uint\", UINT},\r\n    {\"ulong\", ULONG},\r\n    {\"unchecked\", UNCHECKED},\r\n    {\"unsafe\", UNSAFE},\r\n    {\"ushort\", USHORT},\r\n    {\"using\", USING},\r\n    {\"virtual\", VIRTUAL},\r\n    {\"void\", VOID},\r\n    {\"volatile\", VOLATILE},\r\n    {\"while\", WHILE}\r\n/* This list must remain sorted!!! */\r\n  };    \r\n\r\n\r\nint checkCppWord(const char* id) {\r\n\tswitch (id[0]) {\r\n\tcase 'a':\r\n\t\tif (id[1] == 'l') {\r\n\t\t\tif (strcmp(\"alignas\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"alignof\", id) == 0) { return 0; }\r\n\t\t} else\r\n\t\tif (id[1] == 'n') {\r\n\t\t\tif (strcmp(\"and\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"and_eq\", id) == 0) { return 0; }\r\n\t\t} else\r\n\t\t{\r\n\t\t\tif (strcmp(\"asm\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"auto\", id) == 0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 'b':\r\n\t\tif (id[1] == 'i') {\r\n\t\t\tif (strcmp(\"bitand\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"bitor\", id) == 0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\t\t// \"bool\"\r\n\t\t// \"break\",\r\n\tcase 'c':\r\n\t\t// \"case\",\r\n\t\t// \"catch\",\r\n\t\t// \"char\",\r\n\r\n\t\tif (id[1] == 'h') {\r\n\t\t\tif (strcmp(\"char16_t\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"char32_t\", id) ==0) { return 0; }\r\n\t\t} else {\r\n\t\t\tif (strcmp(\"compl\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"contexpr\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"const_cast\", id) ==0) { return 0; }\r\n\t\t}\r\n\t\t\r\n\t\t// \"class\",\r\n\t\t// \"compl\",\r\n\t\t// \"const\",\r\n\t\t// \"constexpr\",\r\n\t\t// \"const_cast\",\r\n\t\t// \"continue\",\r\n\t\tbreak;\r\n\tcase 'd':\r\n\t\tif (id[1] == 'e') {\r\n\t\t\tif (strcmp(\"decltype\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"delete\",   id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"deprecated\",   id) ==0) { return 0; }\r\n\t\t} else if (id[1] == 'y') {\r\n\t\t\tif (strcmp(\"dynamic_cast\",   id) ==0) { return 0; }\r\n\t\t} else if (id[1] == 'l') {\r\n\t\t\tif (strcmp(\"dllimport\",   id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"dllexport\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\t// \"decltype\",\r\n\t\t// \"default\",\r\n\t\t// \"delete\",\r\n\t\t// \"do\",\r\n\t\t// \"double\",\r\n\t\t// \"dynamic_cast\",\r\n\t\tbreak;\r\n\tcase 'e':\r\n\t\t// \"else\",\r\n\t\t// \"enum\",\r\n\t\t// \"explicit\",\r\n\t\tif (id[1] == 'x') {\r\n\t\t\tif (strcmp(\"export\",   id) ==0) { return 0; }\r\n\t\t} else if (id[1] == 'a') {\r\n\t\t\tif (strcmp(\"each\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\t// \"export\",\r\n\t\t// \"extern\",\r\n\t\tbreak;\r\n\tcase 'f':\r\n\t\t// \"false\",\r\n\t\t// \"final\",\r\n\t\tif (id[1]=='i') {\r\n\t\t\tif (strcmp(\"final\",   id) ==0) { return 0; }\r\n\t\t} else\r\n\t\t// \"float\",\r\n\t\t// \"for\",\r\n\t\tif (id[1]=='r') {\r\n\t\t\tif (strcmp(\"friend\",   id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"friend_as\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\t//\"friend\",\r\n\t\tbreak;\r\n\tcase 'g':\r\n\t\t// \"goto\",\r\n\t\tif (id[1]=='o') {\r\n\t\t\tif (strcmp(\"goto\",   id) ==0) { return 0; }\r\n\t\t} else if (id[1] == 'c') {\r\n\t\t\tif (strcmp(\"gcnew\",   id) ==0) { return 0; }\r\n\t\t} else if (id[1] == 'e') {\r\n\t\t\tif (strcmp(\"generic\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 'i':\r\n\t\t// \"if\",\r\n\t\t//\"inline\",\r\n\t\tif (id[1]=='n') {\r\n\t\t\tif (strcmp(\"inline\",   id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"initonly\",   id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"interior_ptr\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\t// \"int\",\r\n\t\tbreak;\r\n\tcase 'l':\r\n\t\t// \"long\",\r\n\t\tif (id[1]=='i') {\r\n\t\t\tif (strcmp(\"literal\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 'm':\r\n\t\t// \"mutable\",\r\n\t\tif (id[1]=='u') {\r\n\t\t\tif (strcmp(\"mutable\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 'n':\r\n//\t\t\"namespace\",\r\n//\t\t\"new\",\r\n\t\tif (id[1]=='o') {\r\n\t\t\tint len = strlen(id);\r\n\t\t\tif (len >= 7) {\r\n\t\t\t\tif (strcmp(\"noinline\",   id) ==0) { return 0; }\r\n\t\t\t\tif (strcmp(\"noreturn\",   id) ==0) { return 0; }\r\n\t\t\t\tif (strcmp(\"novtable\",   id) ==0) { return 0; }\r\n\t\t\t\tif (strcmp(\"nothrow\",   id) ==0) { return 0; }\r\n\t\t\t\tif (strcmp(\"noexcept\",   id) ==0) { return 0; }\r\n\t\t\t} else {\r\n\t\t\t\tif (strcmp(\"not\",   id) ==0) { return 0; }\r\n\t\t\t\tif (strcmp(\"not_eq\",   id) ==0) { return 0; }\r\n\t\t\t}\r\n\t\t} else if (id[1]=='u') {\r\n\t\t\tif (strcmp(\"nullptr\",   id) ==0) { return 0; }\r\n\t\t} else if (id[1]=='a') {\r\n\t\t\tif (strcmp(\"naked\",   id) ==0) { return 0; }\r\n\t\t}\r\n\t\t//\"noexcept\",\r\n\t\t//\"not\",\r\n\t\t//\"not_eq\",\r\n\t\t//\"nullptr\",\r\n\t\tbreak;\r\n\tcase 'o':\r\n\t\tif (id[1]=='p') {\r\n\t\t\tif (strcmp(\"operator\",   id) ==0) { return 0; }\r\n\t\t} else\r\n\t\tif (id[1]=='r') {\r\n\t\t\tif (strcmp(\"or\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"or_eq\", id) ==0) { return 0; }\r\n\t\t} else {\r\n\t\t\tif (strcmp(\"override\", id) ==0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 'p':\r\n\t\t// \"private\",\r\n\t\t// \"protected\",\r\n\t\t// \"public\",\r\n\t\tif (strcmp(\"property\", id) ==0) { return 0; }\r\n\t\tbreak;\r\n\tcase 'r':\r\n\t\tif (id[1]=='e') {\r\n\t\t\tif (strcmp(\"register\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"reinterpret_cast\", id) ==0) { return 0; }\r\n\t\t}\r\n\t\t// \"return\"\r\n\t\tbreak;\r\n\tcase 's':\r\n//\t\t\"short\",\r\n//\t\t\"signed\",\r\n\t\tif (id[1]=='i') {\r\n\t\t\tif (strcmp(\"signed\", id) ==0) { return 0; }\r\n\t\t} else\r\n//\t\t\"sizeof\",\r\n//\t\t\"static\",\r\n\t\tif (id[1]=='t') {\r\n\t\t\tif (strcmp(\"static_assert\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"static_cast\", id) ==0) { return 0; }\r\n\t\t} else\r\n\t\tif (id[1]=='a') {\r\n\t\t\tif (strcmp(\"safecast\", id) ==0) { return 0; }\r\n\t\t} else {\r\n\t\t\tif (strcmp(\"selectany\", id) ==0) { return 0; }\r\n\t\t}\r\n//\t\t\"struct\",\r\n//\t\t\"switch\",\r\n\t\tbreak;\r\n\tcase 't':\r\n//\t\tstatic const char* t_keywords [] = { \r\n\t\tif (id[1]=='e') {\r\n\t\t\tif (strcmp(\"template\", id) ==0) { return 0; }\r\n\t\t} else\r\n//\t\t\"this\",\r\n\t\tif (id[1]=='h') {\r\n\t\t\tif (strcmp(\"thread_local\", id) ==0) { return 0; }\r\n\t\t} else\r\n//\t\t\"throw\",\r\n//\t\t\"true\",\r\n//\t\t\"try\",\r\n\t\tif (id[1]=='y') {\r\n\t\t\tif (strcmp(\"typedef\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"typeid\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"typename\", id) ==0) { return 0; }\r\n\t\t};\r\n\t\tbreak;\r\n\tcase 'u':\r\n\t\tif (id[1]=='n') {\r\n\t\t\tif (strcmp(\"union\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"unsigned\", id) ==0) { return 0; }\r\n\t\t} else {\r\n\t\t\tif (strcmp(\"uuid\", id) ==0) { return 0; }\r\n\t\t}\r\n\t\t// \"using\"\r\n\t\tbreak;\r\n\tcase 'v':\r\n//\t\t\"virtual\",\r\n//\t\t\"void\",\r\n//      \"volatile\"\r\n\t\tbreak;\r\n\tcase 'w':\r\n\t\tif (id[1]=='c') {\r\n\t\t\tif (strcmp(\"wchar_t\", id) ==0) { return 0; }\r\n\t\t}\r\n//\t\t\"while\",\r\n\t\tbreak;\r\n\tcase 'x':\r\n\t\tif (id[1]=='o') {\r\n\t\t\tif (strcmp(\"xor\", id) ==0) { return 0; }\r\n\t\t\tif (strcmp(\"xor_eq\", id) ==0) { return 0; }\r\n\t\t}\r\n\t\tbreak;\r\n\tcase '_':\r\n\t\tif (id[1]=='_') {\r\n\t\t\tif (strcmp(\"__abstract\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__alignof\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__asm\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__assume\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__based\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__box\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__cdecl\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__declspec\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__delegate\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__event\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__except\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__fastcall\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__finally\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__forceinline\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__gc\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__hook\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__identifier\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__if_exists\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__if_not_exists\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__inline\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__int8\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__int16\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__int32\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__int64\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__interface\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__leave\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__m64\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__m128\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__m128d\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__m128i\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__multiple_inheritance\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__nogc\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__noop\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__pin\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__property\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__raise\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__sealed\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__single_inheritance\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__stdcall\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__super\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__try\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__try_cast\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__unaligned\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__unhook\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__uuidof\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__value\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__virtual_inheritance\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__w64\", id) == 0) { return 0; }\r\n\t\t\tif (strcmp(\"__wchar_t\", id) == 0) { return 0; }\r\n\t\t}\r\n\t}\r\n\r\n\treturn 1;\r\n};\r\n\r\n/* Conduct a binary search for lexeme in the keywords array\r\n * between indices start (inclusive) and finish (exclusive)\r\n */\r\nstatic int bin_search(const char *lexeme, int start, int finish)\r\n{\r\n  if (start >= finish) {/* Not found */\r\n      if (checkCppWord(lexeme) == 0) {\r\n\t\t  compilerError(ERR_USER,\"C++ keyword used as identifier\");\r\n\t  }\r\n\t  yylval.text = concat(lexeme); \r\n\t  return IDENTIFIER;\r\n  } else {\r\n    int mid = (start+finish)/2;\r\n    int cmp = strcmp(lexeme,keywords[mid].name);\r\n    if (cmp == 0) {\r\n\t  if (keywords[mid].value == OBJECT || keywords[mid].value == STRING) {\r\n\t\tyylval.text = (keywords[mid].value == OBJECT) ? \"System.Object\" : \"System.String\";\r\n\t\treturn IDENTIFIER;\r\n\t  }\r\n      return keywords[mid].value;\r\n    } else if (cmp < 0) {\r\n      return bin_search(lexeme,start,mid);\r\n    } else {\r\n      return bin_search(lexeme,mid+1,finish);\r\n\t}\r\n  }\r\n}\r\n\r\nstatic int token_for(const char *lexeme)\r\n{\r\n\r\n  static int num_keywords = sizeof(keywords) / sizeof(name_value);\r\n  int token = bin_search(lexeme,0,num_keywords);\r\n  if (token == -1) {\r\n    token = IDENTIFIER;\r\n\t/*printf(\"lexeme:%s\\n\",lexeme);*/\r\n\tyylval.text = concat(lexeme); \r\n  } else if (token == NULL_LITERAL) {\r\n\tyylval.value = getValueNull();\r\n  }\r\n  return token;\r\n}\r\n\r\nstatic int is_allowed_char(const char c)\r\n{\r\n  static char allowed [] = {\r\n    '.', ';', ':',\r\n    '(', ')', '{', '}', '<', '>',\r\n    '+', '-', '*', '/', '%', '&', '|', '!', '~', '^',\r\n    '=', '?',\r\n  };\r\n  static int num_allowed = sizeof(allowed) / sizeof(char);\r\n  int i;\r\n  for (i=0; i<num_allowed; i++) {\r\n    if (allowed[i]==c) \r\n      return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\nstatic SValue getValueInt(const char* text) {\r\n\tSValue v;\r\n\tint len = strlen(text);\r\n\tint mode = 0;\r\n\tif ((text[len-1]=='U') || (text[len-1]=='u')) {\tmode |= 1;\t}\r\n\tif ((text[len-1]=='L') || (text[len-1]=='l')) {\tmode |= 2;\t}\r\n\r\n\tif (mode) {\r\n\t\tif ((text[len-2]=='U') || (text[len-2]=='u')) {\tmode |= 1;\t}\r\n\t\tif ((text[len-2]=='L') || (text[len-2]=='l')) {\tmode |= 2;\t}\r\n\t}\r\n\t\t\r\n\tint hexaMode = 10;\r\n\tconst char* p = text;\r\n\tif ((text[0] == '0') && (text[1] == 'x' || text[1]=='X')) {\r\n\t\thexaMode = 16;\r\n\t\tp += 2; // Skip 0x\r\n\t}\r\n\t\r\n\t// We have a valid string anyway.\r\n\tlong out = 0;\r\n\tdo {\r\n\t\tint v = *p++;\r\n\t\tif (v >= '0' && v <= '9') {\r\n\t\t\tv -= '0';\r\n\t\t} else\r\n\t\tif (v >= 'A' && v <= 'F') {\r\n\t\t\tv -= 'A' - 10;\r\n\t\t} else\r\n\t\tif (v >= 'a' && v <= 'f') {\r\n\t\t\tv -= 'a' - 10;\r\n\t\t} else {\r\n\t\t\t// Reach end : char 0, U, L etc...\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tout = (out * hexaMode) + v;\r\n\t} while(1);\r\n\t\r\n\tswitch (mode) {\r\n\tcase 0:\r\n\t\tv.type\t= TYPE_INT;\r\n\t\tv.v.i\t= (int)out;\r\n\t\tbreak;\r\n\tcase 1:\r\n\t\tv.type\t= TYPE_UINT;\r\n\t\tv.v.ui\t= (unsigned int)out;\r\n\t\tbreak;\r\n\tcase 2:\r\n\t\tv.type\t= TYPE_LONG;\r\n\t\tv.v.l\t= (long)out;\r\n\t\tbreak;\r\n\tdefault:\r\n\tcase 3:\r\n\t\tv.type\t= TYPE_ULONG;\r\n\t\tv.v.ul\t= (unsigned long)out;\r\n\t\tbreak;\r\n\t}\r\n\treturn v;\r\n}\r\n\r\nstatic SValue getValueReal(const char* text) {\r\n\tSValue v;\r\n\tdouble d;\r\n\tchar buff[70];\t// Tmp buffer\r\n\tint strL = strlen(text);\r\n\tchar c = text[strL-1];\r\n\tconst char* ptrRead = text;\r\n\tint isFloat = 0;\r\n\tif ((c == 'F') || (c == 'f') || (c == 'D') || (c == 'd') || (c == 'M') || (c == 'm')) {\r\n\t\tif ((c == 'F') || (c == 'f')) {\r\n\t\t\tisFloat = 1;\r\n\t\t}\r\n\t\tmemcpy(buff,text,strL-1);\r\n\t\tbuff[strL] = 0;\r\n\t\tptrRead = buff;\r\n\t}\r\n\tsscanf(ptrRead, \"%lf\", &d);\r\n\tif (!isFloat) {\r\n\t\tv.type\t= TYPE_DOUBLE;\r\n\t\tv.v.d\t= d;\r\n\t} else {\r\n\t\tv.type\t= TYPE_FLOAT;\r\n\t\tv.v.f\t= (float)d;\r\n\t}\r\n\treturn v;\r\n}\r\n\r\nstatic SValue getValueChar(const char* text) {\r\n\tSValue v;\r\n\tv.type\t= TYPE_CHAR;\r\n\tconst char* t = &text[1];\r\n\tu16 ch = 0;\r\n\tif (*t == '\\\\') {\r\n\t\tswitch (t[1]) {\r\n\t\tcase 'U':\r\n\t\t\tv.type = TYPE_STRING;\r\n\t\t\t// TODO : reencode to utf8 !\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \" Support complex unicode.\");\r\n\t\t\tbreak;\r\n\t\tcase 'u':\r\n\t\tcase 'x':\r\n\t\t{\r\n\t\t\tint hexaMode = 16;\r\n\t\t\t// We have a valid string anyway.\r\n\t\t\tint out = 0;\r\n\t\t\tconst char* p = &t[2];\r\n\t\t\tdo {\r\n\t\t\t\tint v = *p++;\r\n\t\t\t\tif (v >= '0' && v <= '9') {\r\n\t\t\t\t\tv -= '0';\r\n\t\t\t\t} else\r\n\t\t\t\tif (v >= 'A' && v <= 'F') {\r\n\t\t\t\t\tv -= 'A';\r\n\t\t\t\t} else\r\n\t\t\t\tif (v >= 'a' && v <= 'f') {\r\n\t\t\t\t\tv -= 'a';\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Reach end : char 0, ' etc...\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tout = (out * hexaMode) + v;\r\n\t\t\t} while(1);\r\n\t\t\t// Read 4 hex char\r\n\t\t\tch = out;\r\n\t\t}\tbreak;\r\n\t\tcase 'a':\tch = 0x0007;\tbreak;\r\n\t\tcase 'b':\tch = 0x0008;\tbreak;\r\n\t\tcase 'f':\tch = 0x000C;\tbreak;\r\n\t\tcase 'n':\tch = 0x000A;\tbreak;\r\n\t\tcase 'r':\tch = 0x000D;\tbreak;\r\n\t\tcase 't':\tch = 0x0009;\tbreak;\r\n\t\tcase 'v':\tch = 0x000B;\tbreak;\r\n\t\tcase '0':\tch = 0;\t\t\tbreak;\r\n\t\tcase '\\'':\tch = 0x0027;\tbreak;\r\n\t\tcase '\\\"':\tch = 0x0022;\tbreak;\r\n\t\tcase '\\\\':\tch = 0x005C;\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_USER, \"Invalid Char sequence /%c .\", t[1]);\r\n\t\t}\r\n\t} else {\r\n\t\tif (*t >= 128) {\r\n\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \" Support UTF8 -> Unicode.\");\r\n\t\t} else {\r\n\t\t\tch = *t;\r\n\t\t}\r\n\t}\r\n\tv.v.i = ch;\r\n\treturn v;\r\n}\r\n\r\nstatic SValue getValueString(const char* text) {\r\n\tSValue v;\r\n\tv.type\t= TYPE_STRING;\r\n\tchar* pchar = strdup(&text[1]);\t\t// For now UTF8 as is., skip '\"'\r\n\tint strl = strlen(pchar);\r\n\tif (strl) {\r\n\t\tpchar[strl-1] = 0; // Patch last '\"'\r\n\t}\r\n\tv.v.str\t= pchar;\r\n\treturn v;\r\n}\r\n\r\nstatic int getRank(const char* text) {\r\n\tint res = 1;\r\n\twhile (*text != 0) {\r\n\t\tif (*text == ',') {\r\n\t\t\tres++;\r\n\t\t}\r\n\t\ttext++;\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nstatic SValue getValueNull() {\r\n\tSValue v;\r\n\tv.type\t= TYPE_NULL;\r\n\treturn v;\r\n}\r\n\r\n\r\nvoid lexical_error(const char *msg)\r\n{\r\n  fprintf(stderr,\"%d:lexical error (%s) [%s]\\n\",yylineno,msg,yytext);\r\n}\r\n\r\n\r\n/*** Switch on/off context-sensitive \"keywords\" ***/\r\n/* I don't like it any more than you do.  */\r\nstatic int genCount = 0;\r\nvoid lex_in_generic(void) {\r\n\tif (genCount == 0) {\r\n\t\tyy_push_state(IN_GENERIC);\r\n\t}\r\n\tgenCount++;\r\n}\r\nvoid lex_out_generic(void) {\r\n\tgenCount--;\r\n\tif (genCount == 0) {\r\n\t\tyy_pop_state();\r\n\t}\r\n}\r\nvoid lex_enter_attrib(void)\r\n{\r\n  yy_push_state(IN_ATTRIB);\r\n}\r\nvoid lex_exit_attrib(void)\r\n{\r\n  yy_pop_state();\r\n}\r\nvoid lex_enter_accessor(void)\r\n{\r\n  yy_push_state(IN_ACCESSOR);\r\n}\r\nvoid lex_exit_accessor(void)\r\n{\r\n  yy_pop_state();\r\n}\r\nvoid lex_enter_getset(void)\r\n{\r\n  yy_push_state(IN_GETSET);\r\n}\r\nvoid lex_exit_getset(void)\r\n{\r\n  yy_pop_state();\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/csharp.y",
    "content": "/***\r\n *** C# parser/scanner\r\n *** Copyright 2002 James Power, NUI Maynooth, Ireland <james.power@may.ie>\r\n *** This version: 19 Feb 2002\r\n ***\r\n* Redistribution and use in source and binary forms, with or without\r\n* modification, are permitted provided that the following conditions are met:\r\n*     * Redistributions of source code must retain the above copyright\r\n*       notice, this list of conditions and the following disclaimer.\r\n*     * Redistributions in binary form must reproduce the above copyright\r\n*       notice, this list of conditions and the following disclaimer in the\r\n*       documentation and/or other materials provided with the distribution.\r\n*     * Neither the name of the <organization> nor the\r\n*       names of its contributors may be used to endorse or promote products\r\n*       derived from this software without specific prior written permission.\r\n*\r\n* THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY\r\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY\r\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \r\n***/\r\n\r\n/* Based on Appendix C of the C# Language Specification,\r\n *  version 0.28 of 5/7/2001\r\n */\r\n%{\r\n#define YYERROR_VERBOSE\r\n\textern int yylineno;\r\n\t#include \"lex.yy.h\"\r\n\r\n\t#include <stdio.h>\r\n\t#include <stdarg.h>\r\n\t#include <string.h>\r\n\t#include <stdlib.h>\r\n\t#include \"y.tab.h\"\r\n\t// Bring the standard library into the\r\n\t// global namespace\r\n\t\r\n#ifdef _WIN32\r\n\t#define alloca\r\n\t#define VSPRINTF(buf, format, ...) vsprintf_s(buf, 1024, format, __VA_ARGS__ )\r\n\t#define SPRINTF(buf, format, ...) sprintf_s(buf, 1024, format, __VA_ARGS__ )\r\n#else\r\n\t#define VSPRINTF(buf, format...) vsprintf(buf, format)\r\n\t#define SPRINTF(buf, format...) sprintf(buf, format)\r\n#endif\r\n\r\n\t// Prototypes to keep the compiler happy\r\n\tvoid yyerror (const char *error);\r\n\t\r\n\textern \"C\" {\r\n\t\tint yyparse(void);\r\n\t\tint yylex(void);\r\n\t\tint yywrap();\r\n\t}\r\n\r\n\t#include \"include.h\"\r\n%}\r\n\r\n%right THEN ELSE\r\n\r\n\r\n/* Special tokens to help disambiguate rank_specifiers */\r\n%token RANK_SPECIFIER\r\n\r\n/* C.1.4 Tokens */\r\n%token IDENTIFIER \r\n%token INTEGER_LITERAL REAL_LITERAL CHARACTER_LITERAL STRING_LITERAL\r\n\r\n\r\n/* C.1.7 KEYWORDS */ \r\n%token  ABSTRACT AS BASE BOOL BREAK\r\n%token  BYTE CASE CATCH CHAR CHECKED\r\n%token  CLASS CONST CONTINUE DECIMAL DEFAULT\r\n%token  DELEGATE DO DOUBLE ENUM\r\n%token  EVENT EXPLICIT EXTERN FALSE FINALLY\r\n%token  FIXED FLOAT FOR FOREACH GOTO\r\n%token  IF IMPLICIT IN INT INTERFACE\r\n%token  INTERNAL IS LOCK LONG NAMESPACE\r\n%token  NEW NULL_LITERAL OPERATOR OUT\r\n%token  OVERRIDE PARAMS PARTIAL PRIVATE PROTECTED PUBLIC\r\n%token  READONLY REF RETURN SBYTE SEALED\r\n%token  SHORT SIZEOF STACKALLOC STATIC\r\n%token  STRUCT SWITCH THIS THROW TRUE\r\n%token  TRY TYPEOF UINT ULONG UNCHECKED\r\n%token  UNSAFE USHORT USING VIRTUAL VOID\r\n%token  VOLATILE WHILE\r\n%token\tSTRING OBJECT\r\n%token  GEN_LT GEN_GT\r\n\r\n/* The ones that seem to be context sensitive */\r\n/* Attribute Targets */\r\n%token ASSEMBLY FIELD METHOD MODULE PARAM PROPERTY TYPE\r\n/* Accessor types */\r\n%token GET SET \r\n/* Event accessor declarations */\r\n%token ADD REMOVE\r\n\r\n/*** PUNCTUATION AND SINGLE CHARACTER OPERATORS ***/\r\n%token COMMA\r\n%token LEFT_BRACKET\r\n%token RIGHT_BRACKET\r\n%token GT GTGT LT\r\n\r\n/*** MULTI-CHARACTER OPERATORS ***/\r\n%token PLUSEQ MINUSEQ STAREQ DIVEQ MODEQ\r\n%token XOREQ  ANDEQ   OREQ LTLT GTGTEQ LTLTEQ EQEQ NOTEQ\r\n%token LEQ GEQ ANDAND OROR PLUSPLUS MINUSMINUS ARROW\r\n\r\n%start compilation_unit  /* I think */\r\n\r\n%%\r\n\r\n/*\r\n *\tLiteral Section Done\r\n */\r\n \r\n/***** C.1.8 Literals *****/\r\nliteral\r\n  : boolean_literal\t\t\t\t{ R(); $$.value = $1.value; }\r\n  | INTEGER_LITERAL\t\t\t\t{ R(); $$.value = $1.value; }\r\n  | REAL_LITERAL\t\t\t\t{ R(); $$.value = $1.value; }\r\n  | CHARACTER_LITERAL\t\t\t{ R(); $$.value = $1.value; }\r\n  | STRING_LITERAL\t\t\t\t{ R(); $$.value = registerString($1.value);}\r\n  | NULL_LITERAL\t\t\t\t{ R(); $$.value = $1.value; }\r\n  ;\r\nboolean_literal\r\n  : TRUE\t\t\t\t\t\t{ R(); $$.value.type = TYPE_BOOL; $$.value.v.i = 1; }\r\n  | FALSE\t\t\t\t\t\t{ R(); $$.value.type = TYPE_BOOL; $$.value.v.i = 0; }\r\n  ;\r\n/********** C.2 Syntactic grammar **********/\r\n\r\n/*\r\n *\tType Section Done\r\n */\r\n\r\n/***** C.2.1 Basic concepts *****/\r\nnamespace_name\r\n  : qualified_identifier\t\t\t\t{ R(); $$.text = $1.text; }\r\n  ;\r\ntype_name\r\n  : qualified_identifier_opt_generic {\r\n\r\n\t\t\t\t\t\t\t R(); $$.type = TypeObject::getTypeObject($1.text, TYPE_UNRESOLVED)->setGeneric(GetGenericType());\r\n\t\t\t\t\t\t\t PopGenericType();\r\n\t\t\t\t\t\t }\r\n  ;\r\nopt_generic\r\n  : /* Nothing */\t\t\t\t\t\t\t\t{ R(); }\r\n  | GEN_LT\t{ \r\n\t\t\tlex_in_generic(); \r\n\t\t} genericlist GEN_GT {\r\n\t\t\tlex_out_generic(); R(); \r\n\t\t}\r\n  ;\r\n\r\nqualified_identifier_opt_generic\r\n  : qualified_identifier { PushGenericType(GetGenericType()); } opt_generic\t{ R(); }\r\n  ;\r\n  \r\ngenericlist\r\n  : type\t\t\t\t\t\t\t\t{ R(); addGenericType($1.type); \t}\r\n  | type COMMA { R(); addGenericType($1.type); } genericlist\r\n  ;\r\n/*\r\ngenericlist\r\n  : type  continuity\t\t\t\t\t{ R(); addGenericType($1.type); }\r\n  ;\r\ncontinuity \r\n  : \t\t\t\t\t\t\t\t\t{ R(); }\r\n  | COMMA genericlist\t\t\t\t\t{ R(); addGenericType($2.type); }\r\n  ;\r\n*/\r\n/***** C.2.2 Types *****/\r\ntype\r\n  : non_array_type\t\t\t\t{ R(); $$.type = $1.type; }\r\n  | array_type\t\t\t\t\t{ R(); $$.type = $1.type; }\r\n  ;\r\nnon_array_type\r\n  : simple_type\t\t\t\t\t{ R(); $$.type = $1.type; }\r\n  | type_name\t\t\t\t\t{ R(); $$.type = $1.type; }\r\n  ;\r\nsimple_type\r\n  : primitive_type\t\t\t\t{ R(); $$.type = $1.type; }\r\n  | pointer_type\t\t\t\t{ R(); $$.type = $1.type; }\r\n  ;\r\nprimitive_type\r\n  : numeric_type\t\t\t\t{ R(); $$.type = $1.type; }\r\n  | BOOL\t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_BOOL); }\r\n  ;\r\nnumeric_type\r\n  : integral_type\t\t\t\t{ R(); $$.type = $1.type; }\r\n  | floating_point_type\t\t\t{ R(); $$.type = $1.type; }\r\n  | DECIMAL\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED,\"Unsupported decimal/Decimal type\"); }\r\n  ;\r\nintegral_type\r\n  : SBYTE \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_SBYTE\t);\t}\r\n  | BYTE \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_BYTE\t);\t}\r\n  | SHORT \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_SHORT\t);\t}\r\n  | USHORT \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_USHORT\t);\t}\r\n  | INT \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_INT\t\t); \t}\r\n  | UINT \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_UINT\t); \t}\r\n  | LONG \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_LONG\t); \t}\r\n  | ULONG \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_ULONG\t); \t}\r\n  | CHAR\t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_CHAR\t); \t}\r\n  ;\r\nfloating_point_type\r\n  : FLOAT \t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_FLOAT); \t}\r\n  | DOUBLE\t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_DOUBLE); \t}\r\n  ;\r\npointer_type\r\n  : type '*'\t\t\t\t\t{ R(); $$.type = $1.type->addPointer();\t\t\t\t\t\t}\r\n  | VOID '*'\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_VOID)->addPointer(); }\r\n  ;\r\narray_type\r\n  : array_type rank_specifier\t{ R(); $$.type = $1.type->addRank($2.tmpValue);\t}\r\n  | simple_type rank_specifier\t{ R(); $$.type = $1.type->addRank($2.tmpValue);\t}\r\n  | qualified_identifier rank_specifier\r\n\t\t\t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject($1.text, TYPE_UNRESOLVED)->addRank($2.tmpValue);\t}\r\n  ;\r\nrank_specifiers_opt\r\n  : /* Nothing */\t\t\t\t{ R(); $$.tmpValue = 0;\t\t}\r\n  | rank_specifier rank_specifiers_opt\t\r\n\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = $1.tmpValue; }\r\n  ;\r\nrank_specifier\r\n  : RANK_SPECIFIER\t\t\t\t{ R(); $$.tmpValue = $1.tmpValue; }\r\n  ;\r\n  \r\n  \r\n  \r\n  \r\n/***** C.2.3 Variables *****/\r\nvariable_reference\r\n  : expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\n/***** C.2.4 Expressions *****/\r\nargument_list\r\n  : argument\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateMultipleExpr($1.expr); \t\t}\r\n  | argument_list COMMA argument\t\t\t\t\t\t{ R(); $$.expr = $1.expr->addExpression($3.expr);\t}\r\n  ;\r\nargument\r\n  : expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; \t\t\t\t\t\t\t\t}\r\n  | REF variable_reference\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_REF, $2.expr);\t}\r\n  | OUT variable_reference\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_REF, $2.expr);\t}\r\n  | IDENTIFIER ':' argument\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET, \"Named arguments are not supported yet\"); }\r\n  ;\r\nprimary_expression\r\n  : parenthesized_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | primary_expression_no_parenthesis\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\nprimary_expression_no_parenthesis\r\n  : literal\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateLeafExpr(EXPR_CTE)->setValue($1.value); }\r\n  | array_creation_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | member_access\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | invocation_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | element_access\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | this_access\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | base_access\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | new_expression\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | delegate_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | typeof_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | sizeof_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | checked_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | unchecked_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\n  \r\ndelegate_expression\r\n  : DELEGATE '(' formal_parameter_list_opt ')' block\t{ R(); $$.expr = CreateDelegateExpr($3.variable, $5.statement); }\r\n  ;\r\n\r\nparenthesized_expression\r\n  : '(' expression ')'\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $2.expr->addParenthesis(); }\r\n  ;\r\nmember_access\r\n  : primary_expression '.' IDENTIFIER\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_DOT, $1.expr)->setIdentifier($3.text);\t}\r\n  | primitive_type '.' IDENTIFIER\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_DOT, CreateLeafExpr(EXPR_IDENT,$1.type->m_definitionAC->m_name))->setIdentifier($3.text);\t}\r\n  ;\r\ninvocation_expression\r\n  : primary_expression_no_parenthesis \topt_generic '(' { PushGenericType(GetGenericType()); } argument_list_opt ')' { R(); $$.expr = CreateDoubleExpr(EXPR_INVOKE, $1.expr, $5.expr)->addGenericType(PopGenericType())->patchSubInvoke();\t}\r\n  | qualified_identifier_opt_generic '(' argument_list_opt ')' { R(); $$.expr = CreateDoubleExpr(EXPR_INVOKE, CreateLeafExpr(EXPR_IDENT,$1.text), $3.expr)->addGenericType(GetGenericType())->patchSubInvoke(); PopGenericType(); }\r\n  ;\r\nargument_list_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = NULL; \t\t}\r\n  | argument_list\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr;\t}\r\n  ;\r\nelement_access\r\n  : primary_expression LEFT_BRACKET expression_list RIGHT_BRACKET\t{ R(); $$.expr = CreateDoubleExpr(EXPR_ACCESS, $1.expr, $3.expr);\t}\r\n  | qualified_identifier LEFT_BRACKET expression_list RIGHT_BRACKET\t{ R(); $$.expr = CreateDoubleExpr(EXPR_ACCESS, CreateLeafExpr(EXPR_IDENT,$1.text), $3.expr); }\r\n  ;\r\n\r\nexpression_list_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = NULL;\t\t\t\t\t\t\t\t}\r\n  | expression_list\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr;\t\t\t\t\t\t\t}\r\n  ;\r\n  \r\nexpression_list\r\n  : expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateMultipleExpr($1.expr); \t\t}\r\n  | expression_list COMMA expression\t\t\t\t\t{ R(); $$.expr = $1.expr->addExpression($3.expr); \t}\r\n  ;\r\nthis_access\r\n  : THIS\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateLeafExpr(EXPR_THIS);\t\t\t}\r\n  ;\r\nbase_access\r\n  : BASE '.' IDENTIFIER\t\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_DOT, CreateLeafExpr(EXPR_BASE))->setIdentifier($3.text); }\r\n  | BASE LEFT_BRACKET expression_list RIGHT_BRACKET\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_ACCESS, CreateLeafExpr(EXPR_BASE), $3.expr);}\r\n  ;\r\npost_increment_expression\r\n  : postfix_expression PLUSPLUS\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_PLUSPLUS, $1.expr);\t}\r\n  ;\r\npost_decrement_expression\r\n  : postfix_expression MINUSMINUS\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_MINUSMINUS, $1.expr);}\r\n  ;\r\nnew_expression\r\n  : object_creation_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr;\t}\r\n  ;\r\nobject_creation_expression\r\n  : NEW type '(' argument_list_opt ')'\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_NEW, $4.expr)->setType($2.type); }\r\n  ;\r\narray_creation_expression\r\n  : NEW non_array_type LEFT_BRACKET expression_list RIGHT_BRACKET rank_specifiers_opt array_initializer_opt\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_NEW, $4.expr, $7.expr)->setType($2.type)->setRank($6.tmpValue)->setArrayNew(true); }\r\n  | NEW array_type array_initializer\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_NEW, NULL, $3.expr)->setType($2.type)->setArrayNew(false); }\r\n  ;\r\narray_initializer_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = NULL; \t\t}\r\n  | array_initializer\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr;\t}\r\n  ;\r\ntypeof_expression\r\n  : TYPEOF '(' type ')'\t\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"typeof()\"); $$.expr = CreateLeafExpr(EXPR_TYPEOF)->setType($3.type); }\r\n  | TYPEOF '(' VOID ')'\t\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"typeof(void)\"); }\r\n  ;\r\nchecked_expression\r\n  : CHECKED '(' expression ')'\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED,\"checked\"); $$.expr = CreateSingleExpr(EXPR_CHECKED, $3.expr); }\r\n  ;\r\nunchecked_expression\r\n  : UNCHECKED '(' expression ')'\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED,\"unchecked\"); $$.expr = CreateSingleExpr(EXPR_UNCHECKED, $3.expr); }\r\n  ;\r\npointer_member_access\r\n  : postfix_expression ARROW IDENTIFIER\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET, \"-> operator not supported yet\"); $$.expr = CreateSingleExpr(EXPR_ARROW, $1.expr)->setIdentifier($3.text); }\r\n  ;\r\naddressof_expression\r\n  : '&' unary_expression\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET, \"& adress operator not supported yet.\"); $$.expr = CreateSingleExpr(EXPR_ADRESSOF, $1.expr);\t\t}\r\n  ;\r\nsizeof_expression\r\n  : SIZEOF '(' type ')'\t\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET, \"sizeof() operator not supported yet\"); $$.expr = CreateLeafExpr(EXPR_SIZEOF)->setType($3.type);\t}\r\n  ;\r\npostfix_expression\r\n  : primary_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | qualified_identifier\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateLeafExpr(EXPR_IDENT,$1.text); }\r\n  | post_increment_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | post_decrement_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | pointer_member_access\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\nunary_expression_not_plusminus\r\n  : postfix_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | '!' unary_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_NOT, $2.expr);\t\t}\r\n  | '~' unary_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_LNOT, $2.expr);\t\t}\r\n  | cast_expression\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\npre_increment_expression\r\n  : PLUSPLUS unary_expression\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_PREINCR, $2.expr);\t}\r\n  ;\r\npre_decrement_expression\r\n  : MINUSMINUS unary_expression\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_PREDECR, $2.expr);\t}\r\n  ;\r\nunary_expression\r\n  : unary_expression_not_plusminus\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | '+' unary_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_UNARYPLUS, $2.expr);\t}\r\n  | '-' unary_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_UNARYMINUS, $2.expr);\t}\r\n  | '*' unary_expression\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"Unary * operator\"); $$.expr = CreateSingleExpr(EXPR_UNARYMULT, $2.expr);\t}\r\n  | pre_increment_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | pre_decrement_expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | addressof_expression\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\n/* For cast_expression we really just want a (type) in the brackets,\r\n * but have to do some factoring to get rid of conflict with expressions.\r\n * The paremtnesised expression in the first three cases below should be \r\n * semantically restricted to an identifier, optionally follwed by qualifiers\r\n */\r\ncast_expression\r\n  : '(' expression ')' unary_expression_not_plusminus\t\t{\r\n\t\tR(); $$.expr = CreateDoubleExpr(EXPR_CAST, $2.expr, $4.expr);\t\t\r\n\t}\r\n  | '(' multiplicative_expression '*' ')' unary_expression\t{\r\n\t\tR(); $$.expr = CreateDoubleExpr(EXPR_CAST_PTR, $2.expr, $5.expr);\t\r\n\t}\r\n  | '(' qualified_identifier rank_specifier type_quals_opt ')' unary_expression\r\n\t{\r\n\t\t$$.expr = CreateSingleExpr(EXPR_CAST, $6.expr)->setType(TypeObject::getTypeObject($2.text, TYPE_UNRESOLVED)->addRank($3.tmpValue),$4.quals);\r\n\t}\r\n  | '(' primitive_type type_quals_opt ')' unary_expression\r\n\t{\tR();\r\n\t\t// $2.type, $3.quals, $5.expr\r\n\t\t$$.expr = CreateSingleExpr(EXPR_CAST, $5.expr)->setType($2.type,$3.quals);\r\n\t}\r\n  | '(' VOID type_quals_opt ')' unary_expression\r\n\t{\tR();\r\n\t\t//  $3.quals, $5.expr\r\n\t\t$$.expr = CreateSingleExpr(EXPR_CAST, $5.expr)->setType(TypeObject::getTypeObject(TYPE_VOID),$3.quals);\r\n\t}\r\n  ;\r\n\t\ttype_quals_opt\r\n\t\t  : /* Nothing */\t\t\t{\tR();\t$$.quals = NULL;\t\t}\r\n\t\t  | type_quals\t\t\t\t{\tR();\t$$.quals = $1.quals;\t}\r\n\t\t  ;\r\n\t\ttype_quals\r\n\t\t  : type_qual\t\t\t\t{\tR();\t$$.quals = new Quals($1.tmpValue);\t}\r\n\t\t  | type_quals type_qual\t{\tR();\t$$.quals = $1.quals->addQuals($2.tmpValue);\t}\r\n\t\t  ;\r\n\t\ttype_qual \r\n\t\t  : rank_specifier \t\t\t{\t$$.tmpValue = $1.tmpValue;\t\t}\r\n\t\t  | '*'\t\t\t\t\t\t{\t$$.tmpValue = -1;\t\t\t\t}\r\n\t\t  ;\r\n\r\nmultiplicative_expression\r\n  : unary_expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | multiplicative_expression '*' unary_expression\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_MULT, $1.expr, $3.expr);\t}\r\n  | multiplicative_expression '/' unary_expression\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_DIV, $1.expr, $3.expr);\t}\r\n  | multiplicative_expression '%' unary_expression\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_MOD, $1.expr, $3.expr);\t}\r\n  ;\r\nadditive_expression\r\n  : multiplicative_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | additive_expression '+' multiplicative_expression\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_PLUS, $1.expr, $3.expr);\t}\r\n  | additive_expression '-' multiplicative_expression\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_MINUS, $1.expr, $3.expr);\t}\r\n  ;\r\nshift_expression\r\n  : additive_expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | shift_expression LTLT additive_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_LSHFT, $1.expr, $3.expr);\t}\r\n  | shift_expression GTGT additive_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_RSHFT, $1.expr, $3.expr);\t}\r\n  ;\r\nrelational_expression\r\n  : shift_expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | relational_expression LT shift_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_LESS, $1.expr, $3.expr);\t\t\t}\r\n  | relational_expression GT shift_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_MORE, $1.expr, $3.expr);\t\t\t}\r\n  | relational_expression LEQ shift_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_LESSEQ, $1.expr, $3.expr);\t\t}\r\n  | relational_expression GEQ shift_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_MOREEQ, $1.expr, $3.expr);\t\t}\r\n  | relational_expression IS type\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_IS, $1.expr)->setType($3.type);\t}\r\n  | relational_expression AS type\t\t\t\t\t\t\t\t{ R(); $$.expr = CreateSingleExpr(EXPR_AS, $1.expr)->setType($3.type);\t}\r\n  ;\r\nequality_expression\r\n  : relational_expression\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | equality_expression EQEQ relational_expression\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_EQUTST, $1.expr, $3.expr);\t}\r\n  | equality_expression NOTEQ relational_expression\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_DIFFTST, $1.expr, $3.expr);\t}\r\n  ;\r\nand_expression\r\n  : equality_expression\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | and_expression '&' equality_expression\t\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_LAND, $1.expr, $3.expr);\t}\r\n  ;\r\nexclusive_or_expression\r\n  : and_expression\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | exclusive_or_expression '^' and_expression\t\t\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_LXOR, $1.expr, $3.expr);\t}\r\n  ;\r\ninclusive_or_expression\r\n  : exclusive_or_expression\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | inclusive_or_expression '|' exclusive_or_expression\t\t\t{ R(); $$.expr = CreateDoubleExpr(EXPR_LOR, $1.expr, $3.expr);\t}\r\n  ;\r\nconditional_and_expression\r\n  : inclusive_or_expression\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | conditional_and_expression ANDAND inclusive_or_expression\t{ R(); $$.expr = CreateDoubleExpr(EXPR_AND, $1.expr, $3.expr);\t}\r\n  ;\r\nconditional_or_expression\r\n  : conditional_and_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | conditional_or_expression OROR conditional_and_expression\t{ R(); $$.expr = CreateDoubleExpr(EXPR_OR, $1.expr, $3.expr);\t}\r\n  ;\r\nconditional_expression\r\n  : conditional_or_expression\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | conditional_or_expression '?' expression ':' expression\t\t{ R(); $$.expr = CreateTripleExpr(EXPR_COND, $1.expr, $3.expr, $5.expr);\t}\r\n  ;\r\nassignment : unary_expression assignment_operator expression\t{ R(); $$.expr = CreateDoubleExpr((EnumExpressionType)$2.tmpValue, $1.expr, $3.expr);\t}\r\n  ;\r\nassignment_operator\r\n  : '='\t\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_EQ;\t\t}\r\n  | PLUSEQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_PLUSEQ;\t}\r\n  | MINUSEQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_MINUSEQ;\t}\r\n  | STAREQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_STAREQ;\t}\r\n  | DIVEQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_DIVEQ;\t}\r\n  | MODEQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_MODEQ;\t}\r\n  | XOREQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_XOREQ;\t}\r\n  | ANDEQ \t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_ANDEQ;\t}\r\n  | OREQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_OREQ;\t}\r\n  | GTGTEQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_RSHFTEQ;\t}\r\n  | LTLTEQ\t\t\t\t{ R(); $$.tmpValue\t= EXPR_ASS_LSHFTEQ;\t}\r\n  ;\r\n  \r\nexpression\r\n  : conditional_expression\t\t{ R(); $$.expr = $1.expr; }\r\n  | assignment\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\nconstant_expression\r\n  : expression\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\nboolean_expression\r\n  : expression\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n/***** C.2.5 Statements *****/\r\nstatement\t\t\t\t\t\t\r\n  : labeled_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | declaration_statement\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | embedded_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  ;\r\nembedded_statement\r\n  : block\t\t\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | empty_statement\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | expression_statement\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | selection_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | iteration_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | jump_statement\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | try_statement\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | checked_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | unchecked_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | lock_statement\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | using_statement\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | unsafe_statement\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  | fixed_statement\t\t\t\t\t{ R(); $$.statement\t= $1.statement; }\r\n  ;\r\nblock\r\n  : '{' statement_list_opt '}'\t\t{ R(); $$.statement = CreateStatement(STM_BLOCK, NULL, $2.statement); }\r\n  ;\r\nstatement_list_opt\r\n  : /* Nothing */\t\t\t\t\t{ R(); $$.statement = NULL; }\r\n  | statement_list\t\t\t\t\t{ R(); $$.statement = $1.statement;\t}\r\n  ;\r\n\r\nstatement_list\r\n  : statement\t\t\t\t\t\t{ R(); $$.statement = $1.statement;\t}\r\n  | statement_list statement\t\t{ R(); $$.statement = $1.statement ? $1.statement->addNext($2.statement) : $2.statement; }\r\n  ;\r\nempty_statement\r\n  : ';'\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_NULL, NULL, NULL); }\r\n  ;\r\nlabeled_statement\r\n  : IDENTIFIER ':' statement\t\t{ R(); $$.statement = CreateStatement(STM_LABEL, NULL, $3.statement)->addLabel($1.text);\t}\r\n  ;\r\ndeclaration_statement\r\n  : local_variable_declaration ';'\t{ R(); $$.statement = $1.statement;\t}\r\n  | local_constant_declaration ';'\t{ R(); $$.statement = $1.statement;\t}\r\n  ;\r\nlocal_variable_declaration\r\n  : type variable_declarators\t\t{ R(); $$.statement = CreateVarStatement(STM_LOCALVAR, NULL, NULL, $2.variable, $1.type); }\r\n  ;\r\nvariable_declarators\r\n  : variable_declarator\t\t\t\t\t\t\t\t\t\t{ R(); $$.variable = $1.variable; }\r\n  | variable_declarators COMMA variable_declarator\t\t\t{ R(); $$.variable = $1.variable->addVariable($3.variable); }\r\n  ;\r\nvariable_declarator\r\n  : IDENTIFIER\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.variable = CreateVarInstance($1.text);\t}\r\n  | IDENTIFIER '=' variable_initializer\t\t\t\t\t\t{ R(); $$.variable = CreateVarInstance($1.text)->setInitializer($3.expr); }\r\n  ;\r\nvariable_initializer\r\n  : expression\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | array_initializer\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  | stackalloc_initializer\t\t\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; }\r\n  ;\r\nstackalloc_initializer\r\n  : STACKALLOC type  LEFT_BRACKET expression RIGHT_BRACKET \t{ R(); /* Only in unsafe code from spec */compilerError(ERR_NOT_SUPPORTED_YET,\"stackalloc\"); }\r\n  ; \r\nlocal_constant_declaration\r\n  : CONST type constant_declarators\t\t\t\t\t\t\t{ R(); $$.statement = CreateVarStatement(STM_LOCALVAR, NULL, NULL, $3.variable, $2.type)->setConstant(); }\r\n  ;\r\nconstant_declarators\r\n  : constant_declarator\t\t\t\t\t\t\t\t\t\t{ R(); $$.variable = $1.variable; }\r\n  | constant_declarators COMMA constant_declarator\t\t\t{ R(); $$.variable = $1.variable->addVariable($3.variable); }\r\n  ;\r\nconstant_declarator\r\n  : IDENTIFIER '=' constant_expression\t\t\t\t\t\t{ R(); $$.variable = CreateVarInstance($1.text)->setInitializer($3.expr); }\r\n  ;\r\nexpression_statement\r\n  : statement_expression ';'\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nstatement_expression\r\n  : invocation_expression\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_WRAP_EXP, NULL, NULL)->setExpression($1.expr); }\r\n  | object_creation_expression\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_WRAP_EXP, NULL, NULL)->setExpression($1.expr); }\r\n  | assignment\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_ASSIGN_EXPR, NULL, NULL)->setExpression($1.expr); }\r\n  | post_increment_expression\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_WRAPPER_POSTINCR,NULL,NULL)->setExpression($1.expr); }\r\n  | post_decrement_expression\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_WRAPPER_POSTDECR,NULL,NULL)->setExpression($1.expr); }\r\n  | pre_increment_expression\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_WRAPPER_PREINCR ,NULL,NULL)->setExpression($1.expr); }\r\n  | pre_decrement_expression\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_WRAPPER_PREDECR ,NULL,NULL)->setExpression($1.expr); }\r\n  ;\r\nselection_statement\r\n  : if_statement\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | switch_statement\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nif_statement\r\n\t// if ( part1 ) statement opt_else\r\n\t\r\n\t: IF ifpart opt_else {\r\n\t\tR();\r\n\t\tif ($3.statement) {\r\n\t\t\t// IF-ELSE\r\n\t\t\t$$.statement = CreateStatement(STM_IF, NULL, $2.statement)->addChild($3.statement)->setExpression($2.expr);\r\n\t\t} else {\r\n\t\t\t// IF\r\n\t\t\t$$.statement = CreateStatement(STM_IF, NULL, $2.statement)->setExpression($2.expr);\r\n\t\t}\r\n\t}\r\n  ;\r\n  \r\nifpart\t: '(' boolean_expression ')' embedded_statement\t{ $$.expr = $2.expr; $$.statement = $4.statement; }\r\n\t\t;\r\n\r\nopt_else: ELSE embedded_statement\t\t{ $$.statement = $2.statement; }\r\n\t\t|\t%prec THEN/* Do nothing */\t{ $$.statement = NULL; }\r\n\t\t;\r\n\t\t\r\nswitch_statement\r\n  : SWITCH '(' expression ')' switch_block\t{ R(); $$.statement = CreateStatement(STM_SWITCH, NULL, $5.statement)->setExpression($3.expr); }\r\n  ;\r\nswitch_block\r\n  : '{' switch_sections_opt '}'\t\t\t\t{ R(); $$.statement = $2.statement; }\r\n  ;\r\nswitch_sections_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t{ R(); $$.statement = NULL; }\r\n  | switch_sections\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nswitch_sections\r\n  : switch_section\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | switch_sections switch_section\t\t\t{ R(); $$.statement = $1.statement->addNext($2.statement); }\r\n  ;\r\nswitch_section\r\n  : switch_labels statement_list\t\t\t{ R(); $$.statement = $1.statement->addChild($2.statement); }\r\n  ;\r\nswitch_labels\r\n  : switch_label\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | switch_labels switch_label\t\t\t\t{ R(); $$.statement = $1.statement->addNext($2.statement); }\r\n  ;\r\nswitch_label\r\n  : CASE constant_expression ':'\t\t\t{ R(); $$.statement = CreateStatement(STM_CASE, NULL, NULL\t\t)->setExpression($2.expr); }\r\n  | DEFAULT ':'\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_CASEDEFAULT, NULL, NULL); }\r\n  ;\r\niteration_statement\r\n  : while_statement\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | do_statement\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | for_statement\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | foreach_statement\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nunsafe_statement\r\n  : UNSAFE block\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_UNSAFE, NULL, $2.statement); }\r\n  ;\r\nwhile_statement\r\n  : WHILE '(' boolean_expression ')' embedded_statement\t\r\n\t{ R(); $$.statement = CreateStatement(STM_WHILE, NULL, $5.statement)->setExpression($3.expr); }\r\n  ;\r\ndo_statement\r\n  : DO embedded_statement WHILE '(' boolean_expression ')' ';'\r\n\t{ R(); $$.statement = CreateStatement(STM_DOWHILE, NULL, $2.statement)->setExpression($5.expr); }\r\n  ;\r\nfor_statement\r\n  : FOR '(' for_initializer_opt ';' for_condition_opt ';' for_iterator_opt ')' embedded_statement\r\n\t{ R(); $$.statement = CreateStatement(STM_FOR, NULL, $2.statement)\t->setExpression\t ($5.expr)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChildNilWrap($3.statement)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChildNilWrap($7.statement)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChildNilWrap($9.statement); }\r\n  ;\r\nfor_initializer_opt\r\n  : /* Nothing */\t\t\t\t{ R(); $$.statement = NULL;\t}\r\n  | for_initializer\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nfor_condition_opt\r\n  : /* Nothing */\t\t\t\t{ R(); $$.expr = NULL;\t\t}\r\n  | for_condition\t\t\t\t{ R(); $$.expr = $1.expr; \t}\r\n  ;\r\nfor_iterator_opt\r\n  : /* Nothing */\t\t\t\t{ R(); $$.statement = NULL;\t}\r\n  | for_iterator\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nfor_initializer\r\n  : local_variable_declaration\t{ R(); $$.statement = $1.statement; }\r\n  | statement_expression_list\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nfor_condition\r\n  : boolean_expression\t\t\t{ R(); $$.expr = $1.expr; \t}\r\n  ;\r\nfor_iterator\r\n  : statement_expression_list\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nstatement_expression_list\r\n  : statement_expression\t\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | statement_expression_list COMMA statement_expression\t{ R(); $$.statement = $1.statement->addNext($3.statement); }\r\n  ;\r\nforeach_statement\r\n  : FOREACH '(' type IDENTIFIER IN expression ')' embedded_statement\r\n\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_FOREACH, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->setExpression($6.expr)\r\n\t\t\t\t\t\t\t\t\t\t\t->addType($3.type)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild($8.statement); \r\n\t\t\t\t\t\t\t\t\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"Foreach not supported yet. Please use 'for' with array or list.\");\r\n\t\t\t\t\t\t\t\t\t\t}\r\n  ;\r\njump_statement\r\n  : break_statement\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | continue_statement\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | goto_statement\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | return_statement\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | throw_statement\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  ;\r\nbreak_statement\r\n  : BREAK ';'\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_BREAK, NULL, NULL); }\r\n  ;\r\ncontinue_statement\r\n  : CONTINUE ';'\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_CONTINUE, NULL, NULL); }\r\n  ;\r\ngoto_statement\r\n  : GOTO IDENTIFIER ';'\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_GOTO, NULL,NULL)->addLabel($2.text);\t}\r\n  | GOTO CASE constant_expression ';'\t{ R(); $$.statement = CreateStatement(STM_GOTOCASE, NULL, NULL)->setExpression($3.expr); }\r\n  | GOTO DEFAULT ';'\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_GOTODEFAULT, NULL,NULL); }\r\n  ;\r\nreturn_statement\r\n  : RETURN expression_opt ';'\t\t\t{ R(); $$.statement = CreateStatement(STM_RETURN, NULL, NULL)->setExpression($2.expr); }\r\n  ;\r\nexpression_opt\r\n  : /* Nothing */\t\t\t\t\t\t{ R(); $$.expr = NULL; \t\t}\r\n  | expression\t\t\t\t\t\t\t{ R(); $$.expr = $1.expr; \t}\r\n  ;\r\nthrow_statement\r\n  : THROW expression_opt ';'\t\t\t{ R(); $$.statement = CreateStatement(STM_THROW, NULL, NULL)->setExpression($2.expr); }\r\n  ;\r\ntry_statement\r\n  : TRY block catch_clauses\t\t\t\t{ R(); $$.statement = CreateStatement(STM_TRY, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild($2.statement)->addNext($3.statement); \r\n\t\t\t\t\t\t\t\t\t\t}\r\n  | TRY block finally_clause\t\t\t{ R(); $$.statement = CreateStatement(STM_TRY, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild($2.statement)->addNext($3.statement);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n  | TRY block catch_clauses finally_clause\r\n\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_TRY, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild($2.statement)->addNext($3.statement)->addNext($4.statement);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n  ;\r\ncatch_clauses\r\n  : catch_clause\t\t\t\t\t\t{ R(); $$.statement = $1.statement; }\r\n  | catch_clauses catch_clause\t\t\t{ R(); $$.statement = $1.statement->addNext($2.statement); }\r\n  ;\r\ncatch_clause\r\n  : CATCH '(' type_name identifier_opt ')' block\t{ R(); $$.statement = CreateStatement(STM_CATCH, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChild($6.statement)->addLabel($4.text)->addType($3.type); \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n  | CATCH block\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_CATCH, NULL, NULL)->addChild($2.statement); }\r\n  ;\r\nidentifier_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t{ R(); $$.text = NULL; }\r\n  | IDENTIFIER\t\t\t\t\t\t\t\t\t\t{ R(); $$.text = $1.text; }\r\n  ;\r\nfinally_clause\r\n  : FINALLY block\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_FINALLY, NULL, NULL)->addChild($2.statement); }\r\n  ;\r\nchecked_statement\r\n  : CHECKED block\t\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED,\"Unsupported 'checked' statement\"); $$.statement = CreateStatement(STM_CHECKED, NULL, NULL)->addChild($2.statement); }\r\n  ;\r\nunchecked_statement\r\n  : UNCHECKED block\t\t\t\t\t\t\t\t\t{ R(); $$.statement = CreateStatement(STM_UNCHECKED, NULL, NULL)->addChild($2.statement); }\r\n  ;\r\nlock_statement\r\n  : LOCK '(' expression ')' embedded_statement\t\t{ R(); compilerError(ERR_NOT_SUPPORTED,\"Unsupported 'lock' statement\"); $$.statement = CreateStatement(STM_LOCK, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChild($5.statement)->setExpression($3.expr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n  ;\r\nusing_statement\r\n  : USING '(' resource_acquisition ')' embedded_statement\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"Unsupported 'using' statement\"); $$.statement = CreateStatement(STM_USING, NULL, NULL)->addChild($3.statement)->addChild($5.statement); }\r\n  ;\r\nresource_acquisition\r\n  : local_variable_declaration\t\t\t\t\t\t{ R(); $$.statement = $1.statement }\r\n  | expression\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement }\r\n  ;\r\nfixed_statement\r\n/*! : FIXED '(' pointer_type fixed_pointer_declarators ')' embedded_statement */\r\n  : FIXED '('  type fixed_pointer_declarators ')' embedded_statement\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"FIXED not supported.\"); }\r\n  ;\r\nfixed_pointer_declarators\r\n  : fixed_pointer_declarator\t\t\t\t\t\t\t\t\t{ R(); /* When FIXED Support */ }\r\n  | fixed_pointer_declarators COMMA fixed_pointer_declarator\t{ R(); /* When FIXED Support */ }\r\n  ;\r\nfixed_pointer_declarator\r\n  : IDENTIFIER '=' expression\t\t\t\t\t\t\t\t\t{ R(); /* When FIXED Support */ }\r\n  ;\r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\ncompilation_unit\r\n  : using_directives_opt attributes_opt \t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | using_directives_opt namespace_member_declarations\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nusing_directives_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | using_directives\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nattributes_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.attribute = NULL; }\r\n  | attributes\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.attribute = $1.attribute; }\r\n  ;\r\nnamespace_member_declarations_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | namespace_member_declarations\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nnamespace_declaration\r\n  : attributes_opt NAMESPACE qualified_identifier { R(); useOrCreateNameSpace($1.attribute, $3.text); } namespace_body comma_opt\r\n\t\t\t\t\t\t\t\t\t{ R();\t// Unstack.\r\n\t\t\t\t\t\t\t\t\t\tunuseNameSpace();\t\t}\r\n  ;\r\ncomma_opt\r\n  : /* Nothing */\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | ';'\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\n/*\r\nqualified_identifier\r\n  : IDENTIFIER\r\n  | qualified_identifier '.' IDENTIFIER\r\n  ;\r\n*/\r\nqualified_identifier\r\n  : IDENTIFIER\t\t\t\t\t\t{ R(); $$.text = $1.text; \tdisplay($1.text);\t\t}\r\n  | qualifier IDENTIFIER\t\t\t{ R(); $$.text = concat2($1.text, $2.text); \t\t}\r\n  ;\r\nqualifier\r\n  : IDENTIFIER '.' \t\t\t\t\t{ R(); $$.text = concat2($1.text, \".\"); \t\t\t}\r\n  | qualifier IDENTIFIER '.' \t\t{ R(); $$.text = concat3($1.text, $2.text, \".\"); \t}\r\n  ;\r\n  \r\nnamespace_body\r\n  : '{' using_directives_opt namespace_member_declarations_opt '}'\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nusing_directives\r\n  : using_directive\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | using_directives using_directive\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nusing_directive\r\n  : using_alias_directive\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | using_namespace_directive\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nusing_alias_directive\r\n  : USING IDENTIFIER '=' qualified_identifier ';' \t\t\t\t{ R(); createAlias($2.text, $4.text); \t}\r\n  ;\r\nusing_namespace_directive\r\n  : USING namespace_name ';' \t\t\t\t\t\t\t\t\t{ R(); addUsingNameSpace($2.text); \t\t}\r\n  ;\r\nnamespace_member_declarations\r\n  : namespace_member_declaration\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | namespace_member_declarations namespace_member_declaration\t{ R(); /* Nothing to do here */ }\r\n  ;\r\nnamespace_member_declaration\r\n  : namespace_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | type_declaration\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\ntype_declaration\r\n  : class_declaration\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | struct_declaration\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | interface_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | enum_declaration\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  | delegate_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Nothing to do here */ }\r\n  ;\r\n\r\n/***** Modifiers *****/\r\n/* This now replaces:\r\n * class_modifier, constant_modifier, field_modifier, method_modifier, \r\n * property_modifier, event_modifier, indexer_modifier, operator_modifier, \r\n * constructor_modifier, struct_modifier, interface_modifier, \r\n * enum_modifier, delegate_modifier\r\n */\r\nmodifiers_opt\r\n  : /* Nothing */\t\t{ R(); $$.tmpValue = 0;\t\t\t\t}\r\n  | modifiers\t\t\t{ R(); $$.tmpValue = $1.tmpValue; \t}\r\n  ;\r\nmodifiers\r\n  : modifier\t\t\t{ R(); $$.tmpValue = $1.tmpValue; \t\t\t\t}\r\n  | modifiers modifier\t{ R(); $$.tmpValue = $2.tmpValue | $1.tmpValue; \t}\r\n  ;\r\nmodifier\r\n  : ABSTRACT\t\t\t{ R(); $$.tmpValue = ATT_ABSTRACT;\t}\r\n  | EXTERN\t\t\t\t{ R(); $$.tmpValue = ATT_EXTERN;\t\t}\r\n  | INTERNAL\t\t\t{ R(); $$.tmpValue = ATT_INTERNAL;\t}\r\n  | NEW\t\t\t\t\t{ R(); $$.tmpValue = ATT_NEW;\t\t}\r\n  | OVERRIDE\t\t\t{ R(); $$.tmpValue = ATT_VIRTUAL;\t}\r\n  | PRIVATE\t\t\t\t{ R(); $$.tmpValue = ATT_PRIVATE;\t}\r\n  | PROTECTED\t\t\t{ R(); $$.tmpValue = ATT_PROTECTED;\t}\r\n  | PUBLIC\t\t\t\t{ R(); $$.tmpValue = ATT_PUBLIC;\t\t}\r\n  | READONLY\t\t\t{ R(); $$.tmpValue = ATT_READONLY;\t}\r\n  | SEALED\t\t\t\t{ R(); $$.tmpValue = ATT_SEALED;\t\t}\r\n  | STATIC\t\t\t\t{ R(); $$.tmpValue = ATT_STATIC;\t\t}\r\n  | UNSAFE\t\t\t\t{ R(); $$.tmpValue = ATT_UNSAFE;\t\t}\r\n  | VIRTUAL\t\t\t\t{ R(); $$.tmpValue = ATT_VIRTUAL;\t}\r\n  | VOLATILE\t\t\t{ R(); $$.tmpValue = ATT_VOLATILE;\t}\r\n  | PARTIAL\t\t\t\t{ R(); $$.tmpValue = ATT_PARTIAL;\t}\r\n  ;\r\n/***** C.2.6 Classes *****/\r\nclass_declaration\r\n  : attributes_opt modifiers_opt CLASS IDENTIFIER opt_generic_fct\r\n\t{ R();\r\n\t\tgCurrentAC = CreateClass(\t$1.attribute, \r\n\t\t\t\t\t\t$2.tmpValue, \r\n\t\t\t\t\t\t$4.text);\r\n\t\t\t\t\t\t\r\n\t\tgCurrentAC->setGenericParam();\r\n\t} class_base_opt class_body comma_opt { R(); unuseNameSpace(); }\r\n  ;\r\n  \r\nclass_base_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | class_base\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\nclass_base\r\n  : ':' interface_type_list\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t\t\t\t\t\t}\r\n  ;\r\ninterface_type_list\r\n  : type_name\t\t\t\t\t\t\t\t\t\t\t{ R(); gCurrentAC->addInheritance($1.type);\t}\r\n  | interface_type_list COMMA type_name\t\t\t\t\t{ R(); gCurrentAC->addInheritance($3.type);\t}\r\n  ;\r\nclass_body\r\n  : '{' class_member_declarations_opt '}'\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\nclass_member_declarations_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | class_member_declarations\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\nclass_member_declarations\r\n  : class_member_declaration\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | class_member_declarations class_member_declaration\t{ R(); /* Do nothing */\t}\r\n  ;\r\nclass_member_declaration\r\n  : constant_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | field_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | method_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | property_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | event_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | indexer_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | operator_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | constructor_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | destructor_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n/*  | static_constructor_declaration */\r\n  | type_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\nconstant_declaration\r\n  : attributes_opt modifiers_opt CONST type constant_declarators ';'\t{ R();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Trick : CONST C# is STATIC member in C++ to match C# behavior.\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgCurrentAC->addVariable($1.attribute, ($2.tmpValue & ~ATT_CONST) | ATT_STATIC, $4.type, $5.variable );\t}\r\n  ;\r\nfield_declaration\r\n  : attributes_opt modifiers_opt type variable_declarators ';'\t\t\t{ R(); gCurrentAC->addVariable($1.attribute, $2.tmpValue, $3.type, $4.variable );\t\t\t\t}\r\n  ;\r\nmethod_declaration\r\n  : method_header method_body\t\t\t\t\t\t\t\t\t\t\t{ R(); gCurrentMethod = gCurrentAC->addMethod(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$1.attribute,\t// Attributes\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$1.tmpValue,\t// Modified REF/OUT\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$1.text,\t\t// Func Name\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$1.variable,\t// Link list of variable\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$2.statement,\t// Code\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$1.type\t\t\t// Return value.\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t );\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  gCurrentMethod->setGenericParam();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n  ;\r\n/* Inline return_type to avoid conflict with field_declaration */\r\nmethod_header\r\n  : attributes_opt modifiers_opt type qualified_identifier opt_generic_fct '(' formal_parameter_list_opt ')'\t\r\n\t{ R(); \t$$.attribute \t= $1.attribute; \r\n\t\t$$.tmpValue  \t= $2.tmpValue;\r\n\t\t$$.text\t\t\t= $4.text;\r\n\t\t$$.variable\t\t= $7.variable;\r\n\t\t$$.type\t\t\t= $3.type;\t\t\t\t\t\t\t\t}\r\n  | attributes_opt modifiers_opt VOID qualified_identifier opt_generic_fct '(' formal_parameter_list_opt ')'\r\n\t{ R(); \t$$.attribute \t= $1.attribute; \r\n\t\t$$.tmpValue  \t= $2.tmpValue;\r\n\t\t$$.text\t\t\t= $4.text;\r\n\t\t$$.variable\t\t= $7.variable;\r\n\t\t$$.type\t\t\t= TypeObject::getTypeObject(TYPE_VOID);\t}\r\n  ;\r\n  \r\nname_list\r\n  : IDENTIFIER\t\t\t\t\t{ R(); addGenericName($1.text); \t}\r\n  | name_list COMMA IDENTIFIER\t{ R(); addGenericName($3.text);\t\t}\r\n  ;\r\nopt_generic_fct\r\n\t:\t/* Nothing */\t\t\t\t{ R(); }\r\n\t|\tGEN_LT name_list GEN_GT\t\t{ R(); }\r\n\t;\r\n\t\r\nformal_parameter_list_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t{ R(); $$.variable = NULL;\t\t\t\t\t\t\t\t}\r\n  | formal_parameter_list\t\t\t\t\t\t\t{ R(); $$.variable = $1.variable;\t\t\t\t\t\t}\r\n  ;\r\nreturn_type\r\n  : type\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.type = $1.type;\t\t\t\t\t\t\t\t}\r\n  | VOID\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.type = TypeObject::getTypeObject(TYPE_VOID);\t}\r\n  ;\r\nmethod_body\r\n  : block\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement;\t\t\t\t\t\t}\r\n  | ';'\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = NULL;\t\t\t\t\t\t\t\t}\r\n  ;\r\nformal_parameter_list\r\n  : formal_parameter\t\t\t\t\t\t\t\t{ R(); $$.variable = $1.variable;\t\t\t\t\t\t\t}\r\n  | formal_parameter_list COMMA formal_parameter\t{ R(); $$.variable = $1.variable->addVariable($3.variable);\t}\r\n  ;\r\nformal_parameter\r\n  : fixed_parameter\t\t\t\t\t\t\t\t\t{ R(); $$.variable = $1.variable ;\t\t\t\t\t\t}\r\n  | parameter_array\t\t\t\t\t\t\t\t\t{ R(); $$.variable = $1.variable ;\t\t\t\t\t\t}\r\n  ;\r\nfixed_parameter\r\n  : attributes_opt parameter_modifier_opt type IDENTIFIER fixed_parameter_opt_default\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.variable = CreateVarInstance($4.text)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setAttribute($1.attribute)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setModifier($2.tmpValue)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setType($3.type)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setInitializer($5.expr);\t\t\t\t\t\t\t}\r\n  ;\r\nfixed_parameter_opt_default\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t{ R();  $$.expr\t\t= NULL;\t\t\t\t\t\t\t\t}\r\n  | '=' expression\t\t\t\t\t\t\t\t\t{ R();  $$.expr\t\t= $2.expr;\t\t\t\t\t\t\t}\r\n  ;\r\nparameter_modifier_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t{ R();\t$$.tmpValue\t= 0;\t\t\t\t\t\t\t\t}\r\n  | REF\t\t\t\t\t\t\t\t\t\t\t\t{ R();\t$$.tmpValue = ATT_REF;\t\t\t\t\t\t\t}\r\n  | OUT\t\t\t\t\t\t\t\t\t\t\t\t{ R();\t$$.tmpValue\t= ATT_REF;\t\t\t\t\t\t\t}\r\n  ;\r\nparameter_array\r\n/*!  : attributes_opt PARAMS array_type IDENTIFIER */\r\n  : attributes_opt PARAMS type IDENTIFIER\t\t\t{ R(); $$.variable = CreateVarInstance($4.text)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setType($3.type)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setAttribute($1.attribute)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setIsEndLessParam();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcompilerError(ERR_NOT_SUPPORTED_YET, \"params keyword is not supported\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n  ;\r\nproperty_declaration\r\n  : attributes_opt modifiers_opt type qualified_identifier \r\n      ENTER_getset\r\n    '{' accessor_declarations '}'\r\n      EXIT_getset\t\t\t\t\t\t\t\t\t\t\t{ R(); gCurrentAC->addProperty($1.attribute, $2.tmpValue, $3.type, $4.text, $7.accessor);\t}\r\n  ;\r\naccessor_declarations\r\n  : get_accessor_declaration set_accessor_declaration_opt\t{ R(); $$.accessor = CreateAccessor($1.accessor, $2.accessor);\t}\r\n  | set_accessor_declaration get_accessor_declaration_opt\t{ R(); $$.accessor = CreateAccessor($2.accessor, $1.accessor);\t}\r\n  | /* None */\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor = CreateAccessor((Accessor*)NULL,(Accessor*)NULL); }\r\n  ;\r\nset_accessor_declaration_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor = NULL;\t\t\t}\r\n  | set_accessor_declaration\t\t\t\t\t\t\t\t{ R(); $$.accessor = $1.accessor;\t}\r\n  ;\r\nget_accessor_declaration_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor = NULL;\t\t\t}\r\n  | get_accessor_declaration\t\t\t\t\t\t\t\t{ R(); $$.accessor = $1.accessor;\t}\r\n  ;\r\nget_accessor_declaration\r\n  : attributes_opt GET \r\n      EXIT_getset\r\n    accessor_body\r\n      ENTER_getset\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor  = CreateAccessor($1.attribute, $4.statement);\t}\r\n  ;\r\nset_accessor_declaration\r\n  : attributes_opt SET \r\n      EXIT_getset\r\n    accessor_body\r\n      ENTER_getset\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor  = CreateAccessor($1.attribute, $4.statement);\t}\r\n  ;\r\naccessor_body\r\n  : block\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = $1.statement; \t}\r\n  | ';'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.statement = NULL;\t\t\t}\r\n  ;\r\nevent_declaration\r\n  : attributes_opt modifiers_opt EVENT type variable_declarators ';'\t{ R();\tcompilerError(ERR_NOT_SUPPORTED,\"event not supported\");\t}\r\n  | attributes_opt modifiers_opt EVENT type qualified_identifier \r\n      ENTER_accessor_decl \r\n    '{' event_accessor_declarations '}'\r\n      EXIT_accessor_decl\t\t\t\t\t\t\t\t\t\t\t\t{ R();\tcompilerError(ERR_NOT_SUPPORTED,\"event not supported\");\t}\r\n  ;\r\nevent_accessor_declarations\r\n  : add_accessor_declaration remove_accessor_declaration\t\t\t\t{ R();\tcompilerError(ERR_NOT_SUPPORTED,\"event not supported\");\t}\r\n  | remove_accessor_declaration add_accessor_declaration\t\t\t\t{ R();\tcompilerError(ERR_NOT_SUPPORTED,\"event not supported\");\t}\r\n  ;\r\nadd_accessor_declaration\r\n  : attributes_opt ADD \t\t\t\t\t\t\t\t\t\r\n      EXIT_accessor_decl \r\n    block \r\n      ENTER_accessor_decl\t\t\t\t\t\t\t\t\t\t\t\t{ R();\tcompilerError(ERR_NOT_SUPPORTED,\"event not supported\");\t}\r\n  ;\r\nremove_accessor_declaration\r\n  : attributes_opt REMOVE \r\n      EXIT_accessor_decl \r\n    block \r\n      ENTER_accessor_decl\t\t\t\t\t\t\t\t\t\t\t\t{ R();\tcompilerError(ERR_NOT_SUPPORTED,\"event not supported\");\t}\r\n  ;\r\nindexer_declaration\r\n  : attributes_opt modifiers_opt indexer_declarator\r\n      ENTER_getset\r\n    '{' accessor_declarations '}'\r\n      EXIT_getset\r\n\t{\tR();\r\n\t\t$6.accessor->setAsIndexer($3.type, $3.variable);\r\n\t\tgCurrentAC->addProperty($1.attribute, $2.tmpValue, $6.accessor);\r\n\t}\r\n  ;\r\nindexer_declarator\r\n  : type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET\t\t\t\t\t{ R(); $$.variable  = $4.variable; $$.type = $1.type; }\r\n/* | type type_name '.' THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET */\r\n  | type qualified_this LEFT_BRACKET formal_parameter_list RIGHT_BRACKET\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"Explicit implementation of an interface indexer is not supported yet\"); }\r\n  ;\r\nqualified_this\r\n  : qualifier THIS\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.text = concat2($1.text, \"this\"); }\r\n  ;\r\n/* Widen operator_declaration to make modifiers optional */\r\noperator_declaration\r\n  : attributes_opt modifiers_opt operator_declarator operator_body\t\t\t\t{ R(); /* TODO When support operator */\t}\r\n  ;\r\noperator_declarator\r\n  : overloadable_operator_declarator\t\t\t\t\t\t\t\t\t\t\t{ R(); /* TODO When support operator */\t}\r\n  | conversion_operator_declarator\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* TODO When support operator */\t}\r\n  ;\r\noverloadable_operator_declarator\r\n  : type OPERATOR overloadable_operator '(' type IDENTIFIER ')'\t\t\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"Overloading operator not supported.\"); }\r\n  | type OPERATOR overloadable_operator '(' type IDENTIFIER COMMA type IDENTIFIER ')'\t{ R(); compilerError(ERR_NOT_SUPPORTED_YET,\"Overloading operator not supported.\"); }\r\n  ;\r\noverloadable_operator\r\n  : '+' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_PLUS;  }\r\n  | '-' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_MINUS; }\r\n  | '!' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_LNOT;  }\r\n  | '~' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_NOT;   }\r\n  | PLUSPLUS \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_PLUSPLUS;   }\r\n  | MINUSMINUS \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_MINUSMINUS; }\r\n  | TRUE \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_TRUE;  }\r\n  | FALSE\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_FALSE; }\r\n  | '*' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_MULT;  }\r\n  | '/' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_DIV;   }\r\n  | '%' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_MOD;   }\r\n  | '&' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_AND;   }\r\n  | '|' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_OR;    }\r\n  | '^' \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_XOR;   }\r\n  | LTLT \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_LSHFT; }\r\n  | GTGT \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_RSHFT; }\r\n  | EQEQ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_EQUAL; }\r\n  | NOTEQ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_DIFF;  }\r\n  | GT \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_MORE;  }\r\n  | LT \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_LESS;  }\r\n  | GEQ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_MOREEQ;}\r\n  | LEQ\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.tmpValue = OP_LESSEQ;}\r\n  ;\r\n  \r\nconversion_operator_declarator\r\n  : IMPLICIT OPERATOR type '(' type IDENTIFIER ')'\t\t\t\t\t\t\t\t\t\t{ R(); /* TODO When support operator */\t}\r\n  | EXPLICIT OPERATOR type '(' type IDENTIFIER ')'\t\t\t\t\t\t\t\t\t\t{ R(); /* TODO When support operator */\t}\r\n  ;\r\nconstructor_declaration\r\n  : attributes_opt modifiers_opt constructor_declarator constructor_body\t\t\t\t{ R();\r\n\t\tgCurrentMethod = gCurrentAC->addConstructor(\r\n\t\t\t$1.attribute,\t// Attributes\r\n\t\t\t$2.tmpValue,\t// Modifier\r\n\t\t\t$3.text,\t\t// Func Name\r\n\t\t\t$3.variable,\t// Link list of variable\r\n\t\t\t$4.statement,\t// Code\r\n\t\t\t$3.expr,\t\t// Call to Base or this with arguments.\r\n\t\t\t$3.tmpValue\t\t// -1 : Nothing, 0 : Base Call, 1 : This Call.\r\n\t\t);\r\n\t}\r\n  ;\r\nconstructor_declarator\r\n  : IDENTIFIER '(' formal_parameter_list_opt ')' constructor_initializer_opt\t{ R(); \t$$.text\t\t= $1.text; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$$.variable = $3.variable; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$$.expr\t\t= $5.expr; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$$.tmpValue\t= $5.tmpValue;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n  ;\r\nconstructor_initializer_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t{ R(); $$.expr\t= NULL;\t\t$$.tmpValue = -1;\t\t\t}\r\n  | constructor_initializer\t\t\t\t\t{ R(); $$.expr\t= $1.expr;\t$$.tmpValue = $1.tmpValue;\t}\r\n  ;\r\nconstructor_initializer\r\n  : ':' BASE '(' argument_list_opt ')'\t\t{ R(); $$.expr\t\t\t= $4.expr;\t$$.tmpValue = 0;\t}\r\n  | ':' THIS '(' argument_list_opt ')'\t\t{ R(); $$.expr\t\t\t= $4.expr;\t$$.tmpValue = 1; compilerError(ERR_NOT_SUPPORTED_YET,\"'this' access in constructor initialization is not supported yet.\"); }\r\n  ;\r\n/* Widen from unsafe_opt STATIC to modifiers_opt */\r\n/* This is now subsumed by constructor_declaration - delete\r\n * static_constructor_declaration\r\n *  : attributes_opt modifiers_opt IDENTIFIER '(' ')' block\r\n *  ;\r\n */\r\n/* No longer needed after modification of static_constructor_declaration\r\n * unsafe_opt\r\n * : \r\n * | UNSAFE\r\n * ;\r\n */\r\n/* Widen from unsafe_opt to modifiers_opt */\r\ndestructor_declaration\r\n  : attributes_opt modifiers_opt '~' IDENTIFIER '(' ')' block { R();\r\n\t\tgCurrentMethod = gCurrentAC->addDestructor(\r\n\t\t\t$1.attribute,\t// Attributes\r\n\t\t\t$2.tmpValue,\t// Modifier\r\n\t\t\t$4.text,\t\t// Func Name\r\n\t\t\t$7.statement\r\n\t\t);\r\n  }\r\n  ;\r\noperator_body\r\n  : block\t\t\t{ R(); $$.statement = $1.statement;\t}\r\n  | ';'\t\t\t\t{ R(); $$.statement = NULL;\t\t\t}\r\n  ;\r\nconstructor_body /*** Added by JP - same as method_body ***/\r\n  : block\t\t\t{ R(); $$.statement = $1.statement;\t}\r\n  | ';'\t\t\t\t{ R(); $$.statement = NULL;\t\t\t}\r\n  ;\r\n\r\n/***** C.2.7 Structs *****/\r\nstruct_declaration\r\n  : attributes_opt modifiers_opt STRUCT IDENTIFIER  { R(); \tgCurrentAC = CreateStruct(\t$1.attribute, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$2.tmpValue, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$4.text\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t); \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\tstruct_interfaces_opt struct_body comma_opt\t\t\t\t{ R(); unuseNameSpace(); }\r\n  ;\r\nstruct_interfaces_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */ \t}\r\n  | struct_interfaces\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */ \t}\r\n  ;\r\nstruct_interfaces\r\n  : ':' interface_type_list\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */ \t}\r\n  ;\r\nstruct_body\r\n  : '{' struct_member_declarations_opt '}'\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\nstruct_member_declarations_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | struct_member_declarations\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\nstruct_member_declarations\r\n  : struct_member_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | struct_member_declarations struct_member_declaration\t{ R(); /* Do nothing */\t}\r\n  ;\r\nstruct_member_declaration\r\n  : constant_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | field_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | method_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | property_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | event_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | indexer_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | operator_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | constructor_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n/*  | static_constructor_declaration */\r\n  | type_declaration\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\n\r\n/***** C.2.8 Arrays *****/\r\narray_initializer\r\n  : '{' { GenerateInitList(); } variable_initializer_list_opt \t'}'\t{ R(); PopInitList(); $$.expr = $3.expr; \t}\r\n  ;\r\nvariable_initializer_list_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.expr = NULL; \t\t\t}\r\n  | variable_initializer_list opt_comma\t\t\t\t\t\t{ R(); $$.expr = $1.expr; \t\t}\r\n  ;\r\n  \r\nopt_comma\t:\tCOMMA\r\n\t\t\t|\t/* Do nothing */\r\n\t\t\t;\r\n\t\t\t\r\nvariable_initializer_list\r\n  : variable_initializer\t\t\t\t\t\t\t\t\t{ R(); $$.expr = getInitList()->addExpression($1.expr);\t}\r\n  | variable_initializer_list COMMA variable_initializer\t{ R(); $$.expr = $1.expr->addExpression($3.expr); \t\t}\r\n  ;\r\n\r\n/***** C.2.9 Interfaces *****/\r\ninterface_declaration\r\n  : attributes_opt modifiers_opt INTERFACE IDENTIFIER\t{ R(); \tgCurrentAC = CreateInterface(\t$1.attribute, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$2.tmpValue, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$4.text);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tinterface_base_opt interface_body comma_opt\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ R();  unuseNameSpace(); }\r\n  ;\r\ninterface_base_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | interface_base\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\ninterface_base\r\n  : ':' interface_type_list\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\ninterface_body\r\n  : '{' interface_member_declarations_opt '}'\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\ninterface_member_declarations_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | interface_member_declarations\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\ninterface_member_declarations\r\n  : interface_member_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | interface_member_declarations interface_member_declaration\t{ R(); /* Do nothing */\t}\r\n  ;\r\ninterface_member_declaration\r\n  : interface_method_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | interface_property_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | interface_event_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  | interface_indexer_declaration\t\t\t\t\t\t\t\t{ R(); /* Do nothing */\t}\r\n  ;\r\n/* inline return_type to avoid conflict with interface_property_declaration */\r\ninterface_method_declaration\r\n  : attributes_opt new_opt type IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body { R();\r\n\t\tgCurrentMethod = gCurrentAC->addMethod(\r\n\t\t\t$1.attribute,\t// Attributes\r\n\t\t\t$2.tmpValue,\r\n\t\t\t$4.text,\t\t// Func Name\r\n\t\t\t$6.variable,\t// Link list of variable\r\n\t\t\t$8.statement,\t// Code\r\n\t\t\t$3.type\t\t\t// Return value.\r\n\t\t);\t\r\n\t}\r\n  | attributes_opt new_opt VOID IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body { R();\r\n\t\tgCurrentMethod = gCurrentAC->addMethod(\r\n\t\t\t$1.attribute,\t// Attributes\r\n\t\t\t$2.tmpValue,\r\n\t\t\t$4.text,\t\t// Func Name\r\n\t\t\t$6.variable,\t// Link list of variable\r\n\t\t\t$8.statement,\t// Code\r\n\t\t\tTypeObject::getTypeObject(TYPE_VOID)\t// Return value.\r\n\t\t);\r\n\t}\r\n  ;\r\nnew_opt\r\n  : /* Nothing */\t\t{ R(); $$.tmpValue = 0; \t\t\t}\r\n  | NEW\t\t\t\t\t{ R(); $$.tmpValue = ATTR_NEW; \t}\r\n  ;\r\ninterface_property_declaration\r\n  : attributes_opt new_opt type IDENTIFIER \r\n      ENTER_getset\r\n    '{' interface_accessors '}'\r\n      EXIT_getset\t\t\t\t\t\t\t\t{ R(); gCurrentAC->addProperty($1.attribute, $2.tmpValue, $3.type, $4.text, $7.accessor);\t}\r\n  ;\r\ninterface_indexer_declaration\r\n  : attributes_opt new_opt type THIS \r\n    LEFT_BRACKET formal_parameter_list RIGHT_BRACKET \r\n      ENTER_getset\r\n    '{' interface_accessors '}'\r\n      EXIT_getset\t\t\t\t\t\t\t\t{ R(); $10.accessor->setAsIndexer($3.type, $6.variable); gCurrentAC->addProperty($1.attribute, $2.tmpValue, $10.accessor);\t}\r\n  ;\r\n\r\ninterface_accessors\r\n  : attributes_opt GET interface_empty_body\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor = CreateAccessor(CreateAccessor($1.attribute,NULL), NULL); }\r\n  | attributes_opt SET interface_empty_body\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.accessor = CreateAccessor(NULL, CreateAccessor($1.attribute,NULL)); }\r\n  | attributes_opt GET interface_empty_body attributes_opt SET interface_empty_body\t\t{ R(); $$.accessor = CreateAccessor(CreateAccessor($1.attribute,NULL), CreateAccessor($4.attribute,NULL)); }\r\n  | attributes_opt SET interface_empty_body attributes_opt GET interface_empty_body\t\t{ R(); $$.accessor = CreateAccessor(CreateAccessor($4.attribute,NULL), CreateAccessor($1.attribute,NULL)); }\r\n  ;\r\ninterface_event_declaration\r\n  : attributes_opt new_opt EVENT type IDENTIFIER interface_empty_body\t\t\t\t\t{ R(); compilerError(ERR_NOT_SUPPORTED,\"event not supported\"); }\r\n  ;\r\n\r\n/* mono seems to allow this */\r\ninterface_empty_body\r\n  : ';'\t\t\t\t\t{ R(); $$.statement = NULL;\t}\r\n  | '{' '}'\t\t\t\t{ R(); $$.statement = NULL;\t}\r\n  ;\r\n\r\n/***** C.2.10 Enums *****/\r\nenum_declaration\r\n  : attributes_opt modifiers_opt ENUM IDENTIFIER enum_base_opt { R();\r\n\t\tgCurrEnum = CreateEnum($1.attribute, $2.tmpValue, $4.text, $5.type);\r\n  } enum_body comma_opt\t\t{ R();\r\n\t// Do nothing.\r\n  }\r\n  ;\r\nenum_base_opt\r\n  : /* Nothing */\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.type = NULL;    }\r\n  | enum_base\t\t\t\t\t\t\t\t\t\t\t\t{ R(); $$.type = $1.type; }\r\n  ;\r\nenum_base\r\n  : ':' integral_type\t\t\t\t\t\t\t\t\t\t{ R(); $$.type = $2.type; }\r\n  ;\r\nenum_body\r\n  : '{' enum_member_declarations_opt '}'\t\t\t\t\t{ R(); /* Do nothing */ }\r\n  | '{' enum_member_declarations COMMA '}'\t\t\t\t\t{ R(); /* Do nothing */ }\r\n  ;\r\nenum_member_declarations_opt\r\n  : /* Nothing */\r\n  | enum_member_declarations\t\t\t\t\t\t\t\t{ R(); /* Do nothing */ }\r\n  ;\r\nenum_member_declarations\r\n  : enum_member_declaration\t\t\t\t\t\t\t\t\t{ R(); /* Do nothing */ }\r\n  | enum_member_declarations COMMA enum_member_declaration\t{ R(); /* Do nothing */ }\r\n  ;\r\nenum_member_declaration\r\n  : attributes_opt IDENTIFIER\t\t\t\t\t\t\t\t{ R(); gCurrEnum->addEntry($1.attribute, $2.text, NULL); }\r\n  | attributes_opt IDENTIFIER '=' constant_expression\t\t{ R(); gCurrEnum->addEntry($1.attribute, $2.text, $4.expr); }\r\n  ;\r\n\r\n/***** C.2.11 Delegates *****/\r\ndelegate_declaration\r\n  : attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER opt_generic_fct '(' formal_parameter_list_opt ')' ';'\r\n\t{ R(); CreateDelegate($1.attribute, $2.tmpValue, $4.type, $5.text, $8.variable)->setGenericParam(); }\r\n  ;\r\n\r\n/***** C.2.12 Attributes *****/\r\nattributes\r\n  : attribute_sections\t\t\t\t\t\t{ R(); $$.attribute = $1.attribute; }\r\n  ;\r\nattribute_sections\r\n  : attribute_section\t\t\t\t\t\t{ R(); $$.attribute = CreateAttributeWithChild($1.attribute); \t\t}\r\n  | attribute_sections attribute_section\t{ R(); $$.attribute = $1.attribute->addChildAttribute($2.attribute); }\r\n  ;\r\nattribute_section\r\n  : ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list RIGHT_BRACKET EXIT_attrib\r\n  { R();\t$$.attribute = $4.attribute->setSpecifier($3.tmpValue); }\r\n  | ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list COMMA RIGHT_BRACKET EXIT_attrib\r\n  { R();\t$$.attribute = $4.attribute->setSpecifier($3.tmpValue); }\r\n  ;\r\nattribute_target_specifier_opt\r\n  : /* Nothing */\t\t\t\t{ R(); $$.tmpValue = 0; \t\t\t\t\t}\r\n  | attribute_target_specifier\t{ R(); $$.tmpValue = $1.tmpValue; \t\t}\r\n  ;\r\nattribute_target_specifier\r\n  : attribute_target ':'\t\t{ R(); $$.tmpValue = $1.tmpValue; \t\t}\r\n  ;\r\nattribute_target\r\n  : ASSEMBLY\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_ASSEMBLY ; \t}\r\n  | FIELD\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_FIELD;\t\t}\r\n  | EVENT\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_EVENT;\t\t}\r\n  | METHOD\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_METHOD;\t\t}\r\n  | MODULE\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_MODULE;\t\t}\r\n  | PARAM\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_PARAM;\t\t}\r\n  | PROPERTY\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_PROPERTY;\t}\r\n  | RETURN\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_RETURN;\t\t}\r\n  | TYPE\t\t\t\t\t\t{ R(); $$.tmpValue = ATTRB_TYPE;\t\t}\r\n  ;\r\nattribute_list\r\n  : attribute\t\t\t\t\t\t\t\t{ R(); $$.attribute = CreateAttribute($1.type, $1.expr);\t\t\t\t}\r\n  | attribute_list COMMA attribute\t\t\t{ R(); $$.attribute = $1.attribute->addAttribute($3.type, $3.expr); }\r\n  ;\r\nattribute\r\n  : attribute_name attribute_arguments_opt\t{ R(); $$.type = $1.type; $$.expr= $2.expr; }\r\n  ;\r\nattribute_arguments_opt\r\n  : /* Nothing */\t\t\t\t{ R(); $$.expr = NULL; \t\t}\r\n  | attribute_arguments\t\t\t{ R(); $$.expr = $1.expr ; \t}\r\n  ;\r\nattribute_name\r\n  : type_name\t\t\t\t\t{ R(); $$.type = $1.type; \t}\r\n  ;\r\nattribute_arguments\r\n  : '(' expression_list_opt ')'\t{ R(); $$.expr = $2.expr ; \t}\r\n  ;\r\n\r\n\r\n\r\n/** Dummy rules for those context-sensitive \"keywords\" **/\r\nENTER_attrib \r\n  : { R(); lex_enter_attrib(); \t/*Do nothing*/ }\r\n  ;\r\nEXIT_attrib \r\n  : { R(); lex_exit_attrib(); \t/*Do nothing*/ }\r\n  ;\r\nENTER_accessor_decl \r\n  : { R(); lex_enter_accessor();\t/*Do nothing*/ }\r\n  ;\r\nEXIT_accessor_decl\r\n  : { R(); lex_exit_accessor();\t/*Do nothing*/ }\r\n  ;\r\nENTER_getset\r\n  : { R(); lex_enter_getset();\t/*Do nothing*/ }\r\n  ;\r\nEXIT_getset\r\n  : { R(); lex_exit_getset();\t/*Do nothing*/ }\r\n  ;\r\n\r\n\r\n%%\r\n\r\n#include <stdio.h>\r\n#include \"lexParser.inc\"\r\n\r\nint runCompiler(const char *str)\r\n{\r\n\t//\r\n\t// Setup to avoid using files in Lex\r\n\t//\r\n\tYY_BUFFER_STATE pState = yy_scan_string(str);\r\n\tyy_switch_to_buffer(pState);\r\n\r\n\tyyparse();\r\n\r\n\t//\r\n\t// Destroy lex read context.\r\n\t//\r\n\tyy_delete_buffer(pState);\r\n\r\n\treturn 0;\r\n}\r\n\r\n\r\nvoid yyerror(const char* s) {\r\n  fprintf(stdout,\"%d:%s LA=[%s]\\n\",yylineno,s,yytname[YYTRANSLATE(yychar)]);\r\n  while (1) {\r\n\t// Endless loop.\r\n  }\r\n}\r\n\r\nint isatty(int fildes) {\r\n\treturn 1;\t// unistd descriptor used by parser, but we use memory stream. Always 1.\r\n}\r\n\r\nvoid error (const char* msg,...) {\r\n\tva_list\targp;\r\n\tchar pszBuf [1024];\r\n\tchar log [1024];\r\n\r\n\tva_start(argp, msg);\r\n\tVSPRINTF( pszBuf, msg, argp);\r\n\tva_end(argp);\r\n\r\n\tSPRINTF(log, \"Line %i : %s @%s\\n\", yylineno, pszBuf, yytext);\r\n\r\n\tprintf(log);\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/csharpcompiler.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n/*  A Bison parser, made from csharp.y with Bison version GNU Bison version 1.24\r\n  */\r\n\r\n#define YYBISON 1  /* Identify Bison output.  */\r\n\r\n#define\tRANK_SPECIFIER\t258\r\n#define\tIDENTIFIER\t259\r\n#define\tINTEGER_LITERAL\t260\r\n#define\tREAL_LITERAL\t261\r\n#define\tCHARACTER_LITERAL\t262\r\n#define\tSTRING_LITERAL\t263\r\n#define\tABSTRACT\t264\r\n#define\tAS\t265\r\n#define\tBASE\t266\r\n#define\tBOOL\t267\r\n#define\tBREAK\t268\r\n#define\tBYTE\t269\r\n#define\tCASE\t270\r\n#define\tCATCH\t271\r\n#define\tCHAR\t272\r\n#define\tCHECKED\t273\r\n#define\tCLASS\t274\r\n#define\tCONST\t275\r\n#define\tCONTINUE\t276\r\n#define\tDECIMAL\t277\r\n#define\tDEFAULT\t278\r\n#define\tDELEGATE\t279\r\n#define\tDO\t280\r\n#define\tDOUBLE\t281\r\n#define\tELSE\t282\r\n#define\tENUM\t283\r\n#define\tEVENT\t284\r\n#define\tEXPLICIT\t285\r\n#define\tEXTERN\t286\r\n#define\tFALSE\t287\r\n#define\tFINALLY\t288\r\n#define\tFIXED\t289\r\n#define\tFLOAT\t290\r\n#define\tFOR\t291\r\n#define\tFOREACH\t292\r\n#define\tGOTO\t293\r\n#define\tIF\t294\r\n#define\tIMPLICIT\t295\r\n#define\tIN\t296\r\n#define\tINT\t297\r\n#define\tINTERFACE\t298\r\n#define\tINTERNAL\t299\r\n#define\tIS\t300\r\n#define\tLOCK\t301\r\n#define\tLONG\t302\r\n#define\tNAMESPACE\t303\r\n#define\tNEW\t304\r\n#define\tNULL_LITERAL\t305\r\n#define\tOBJECT\t306\r\n#define\tOPERATOR\t307\r\n#define\tOUT\t308\r\n#define\tOVERRIDE\t309\r\n#define\tPARAMS\t310\r\n#define\tPRIVATE\t311\r\n#define\tPROTECTED\t312\r\n#define\tPUBLIC\t313\r\n#define\tREADONLY\t314\r\n#define\tREF\t315\r\n#define\tRETURN\t316\r\n#define\tSBYTE\t317\r\n#define\tSEALED\t318\r\n#define\tSHORT\t319\r\n#define\tSIZEOF\t320\r\n#define\tSTACKALLOC\t321\r\n#define\tSTATIC\t322\r\n#define\tSTRING\t323\r\n#define\tSTRUCT\t324\r\n#define\tSWITCH\t325\r\n#define\tTHIS\t326\r\n#define\tTHROW\t327\r\n#define\tTRUE\t328\r\n#define\tTRY\t329\r\n#define\tTYPEOF\t330\r\n#define\tUINT\t331\r\n#define\tULONG\t332\r\n#define\tUNCHECKED\t333\r\n#define\tUNSAFE\t334\r\n#define\tUSHORT\t335\r\n#define\tUSING\t336\r\n#define\tVIRTUAL\t337\r\n#define\tVOID\t338\r\n#define\tVOLATILE\t339\r\n#define\tWHILE\t340\r\n#define\tASSEMBLY\t341\r\n#define\tFIELD\t342\r\n#define\tMETHOD\t343\r\n#define\tMODULE\t344\r\n#define\tPARAM\t345\r\n#define\tPROPERTY\t346\r\n#define\tTYPE\t347\r\n#define\tGET\t348\r\n#define\tSET\t349\r\n#define\tADD\t350\r\n#define\tREMOVE\t351\r\n#define\tCOMMA\t352\r\n#define\tLEFT_BRACKET\t353\r\n#define\tRIGHT_BRACKET\t354\r\n#define\tGT\t355\r\n#define\tPLUSEQ\t356\r\n#define\tMINUSEQ\t357\r\n#define\tSTAREQ\t358\r\n#define\tDIVEQ\t359\r\n#define\tMODEQ\t360\r\n#define\tXOREQ\t361\r\n#define\tANDEQ\t362\r\n#define\tOREQ\t363\r\n#define\tLTLT\t364\r\n#define\tGTGTEQ\t365\r\n#define\tLTLTEQ\t366\r\n#define\tEQEQ\t367\r\n#define\tNOTEQ\t368\r\n#define\tLEQ\t369\r\n#define\tGEQ\t370\r\n#define\tANDAND\t371\r\n#define\tOROR\t372\r\n#define\tPLUSPLUS\t373\r\n#define\tMINUSMINUS\t374\r\n#define\tARROW\t375\r\n\r\n#line 32 \"csharp.y\"\r\n\r\n#define YYERROR_VERBOSE\r\n\textern int yylineno;\r\n\t#include \"lex.yy.h\"\r\n\r\n\t#include <stdio.h>\r\n\t#include <stdarg.h>\r\n\t#include <string.h>\r\n\t#include <stdlib.h>\r\n\t#include \"y.tab.h\"\r\n\t// Bring the standard library into the\r\n\t// global namespace\r\n\t\r\n#ifdef _WIN32\r\n\t#define alloca\r\n\t#define VSPRINTF(buf, format, ...) vsprintf_s(buf, 1024, format, __VA_ARGS__ )\r\n\t#define SPRINTF(buf, format, ...) sprintf_s(buf, 1024, format, __VA_ARGS__ )\r\n#else\r\n\t#define VSPRINTF(buf, format...) vsprintf(buf, format)\r\n\t#define SPRINTF(buf, format...) sprintf(buf, format)\r\n#endif\r\n\r\n\t// Prototypes to keep the compiler happy\r\n\tvoid yyerror (const char *error);\r\n\t\r\n\textern \"C\" {\r\n\t\tint yyparse(void);\r\n\t\tint yylex(void);\r\n\t\tint yywrap();\r\n\t}\r\n\r\n\t#include \"include.h\"\r\n\r\n#ifndef YYLTYPE\r\ntypedef\r\n  struct yyltype\r\n    {\r\n      int timestamp;\r\n      int first_line;\r\n      int first_column;\r\n      int last_line;\r\n      int last_column;\r\n      char *text;\r\n   }\r\n  yyltype;\r\n\r\n#define YYLTYPE yyltype\r\n#endif\r\n\r\n#ifndef YYSTYPE\r\n#define YYSTYPE int\r\n#endif\r\n#ifndef YYDEBUG\r\n#define YYDEBUG 1\r\n#endif\r\n\r\n#include <stdio.h>\r\n\r\n#ifndef __cplusplus\r\n#ifndef __STDC__\r\n#define const\r\n#endif\r\n#endif\r\n\r\n\r\n\r\n#define\tYYFINAL\t\t932\r\n#define\tYYFLAG\t\t-32768\r\n#define\tYYNTBASE\t142\r\n\r\n#define YYTRANSLATE(x) ((unsigned)(x) <= 375 ? yytranslate[x] : 396)\r\n\r\nstatic const short yytranslate[] = {     0,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,   127,     2,     2,     2,   132,   126,     2,   123,\r\n   124,   122,   129,     2,   130,   125,   131,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,   137,   141,   121,\r\n   138,   133,   136,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,   134,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,   139,   135,   140,   128,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r\n     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,\r\n     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,\r\n    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,\r\n    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,\r\n    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,\r\n    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,\r\n    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,\r\n    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,\r\n    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,\r\n    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,\r\n    96,    97,    98,    99,   100,   101,   102,   103,   104,   105,\r\n   106,   107,   108,   109,   110,   111,   112,   113,   114,   115,\r\n   116,   117,   118,   119,   120\r\n};\r\n\r\n#if YYDEBUG != 0\r\nstatic const short yyprhs[] = {     0,\r\n     0,     2,     4,     6,     8,    10,    12,    14,    16,    18,\r\n    21,    22,    25,    29,    32,    36,    37,    38,    40,    42,\r\n    44,    46,    48,    50,    52,    54,    56,    58,    60,    62,\r\n    64,    66,    68,    70,    72,    74,    76,    78,    80,    82,\r\n    84,    86,    88,    91,    94,    97,   100,   103,   104,   107,\r\n   109,   111,   113,   117,   119,   122,   125,   127,   129,   131,\r\n   133,   135,   137,   139,   141,   143,   145,   147,   149,   151,\r\n   153,   157,   161,   165,   169,   174,   179,   180,   182,   187,\r\n   192,   193,   195,   197,   201,   203,   207,   212,   215,   218,\r\n   220,   226,   234,   238,   239,   241,   246,   251,   256,   261,\r\n   265,   268,   273,   275,   277,   279,   281,   283,   285,   288,\r\n   291,   293,   296,   299,   301,   304,   307,   310,   312,   314,\r\n   316,   321,   327,   334,   340,   346,   352,   353,   355,   357,\r\n   360,   362,   364,   366,   370,   374,   378,   380,   384,   388,\r\n   390,   394,   396,   400,   404,   408,   412,   416,   420,   422,\r\n   426,   430,   432,   436,   438,   442,   444,   448,   450,   454,\r\n   456,   460,   462,   468,   472,   474,   476,   478,   480,   482,\r\n   484,   486,   488,   490,   492,   494,   496,   498,   500,   502,\r\n   504,   506,   508,   510,   512,   514,   516,   518,   520,   522,\r\n   524,   526,   528,   530,   532,   534,   538,   539,   541,   543,\r\n   546,   548,   552,   555,   558,   561,   563,   567,   569,   573,\r\n   575,   577,   579,   585,   589,   591,   595,   599,   602,   604,\r\n   606,   608,   610,   612,   614,   616,   618,   620,   626,   634,\r\n   640,   644,   645,   647,   649,   652,   655,   657,   660,   664,\r\n   667,   669,   671,   673,   675,   678,   684,   692,   702,   703,\r\n   705,   706,   708,   709,   711,   713,   715,   717,   719,   721,\r\n   725,   734,   736,   738,   740,   742,   744,   747,   750,   754,\r\n   759,   763,   767,   768,   770,   774,   778,   782,   787,   789,\r\n   792,   799,   806,   809,   810,   812,   815,   818,   821,   827,\r\n   833,   835,   837,   844,   846,   850,   854,   857,   860,   861,\r\n   863,   864,   866,   867,   869,   870,   877,   878,   880,   882,\r\n   885,   888,   892,   897,   899,   902,   904,   906,   912,   916,\r\n   918,   921,   923,   925,   927,   929,   931,   933,   935,   936,\r\n   938,   940,   943,   945,   947,   949,   951,   953,   955,   957,\r\n   959,   961,   963,   965,   967,   969,   971,   972,   981,   982,\r\n   984,   987,   990,   995,   997,  1001,  1005,  1006,  1008,  1010,\r\n  1013,  1015,  1017,  1019,  1021,  1023,  1025,  1027,  1029,  1031,\r\n  1033,  1040,  1046,  1049,  1057,  1065,  1066,  1068,  1070,  1072,\r\n  1074,  1076,  1078,  1082,  1084,  1086,  1092,  1093,  1096,  1097,\r\n  1099,  1101,  1106,  1116,  1119,  1122,  1123,  1124,  1126,  1127,\r\n  1129,  1135,  1141,  1143,  1145,  1152,  1163,  1166,  1169,  1175,\r\n  1181,  1182,  1192,  1198,  1204,  1207,  1212,  1214,  1216,  1224,\r\n  1235,  1237,  1239,  1241,  1243,  1245,  1247,  1249,  1251,  1253,\r\n  1255,  1257,  1259,  1261,  1263,  1265,  1267,  1269,  1272,  1274,\r\n  1276,  1278,  1280,  1281,  1289,  1297,  1302,  1308,  1309,  1311,\r\n  1317,  1323,  1331,  1333,  1335,  1337,  1339,  1340,  1349,  1350,\r\n  1352,  1355,  1359,  1360,  1362,  1364,  1367,  1369,  1371,  1373,\r\n  1375,  1377,  1379,  1381,  1383,  1385,  1389,  1394,  1395,  1397,\r\n  1399,  1403,  1404,  1413,  1414,  1416,  1419,  1423,  1424,  1426,\r\n  1428,  1431,  1433,  1435,  1437,  1439,  1448,  1457,  1458,  1460,\r\n  1470,  1483,  1487,  1491,  1498,  1505,  1512,  1514,  1517,  1518,\r\n  1527,  1528,  1530,  1533,  1537,  1542,  1543,  1545,  1547,  1551,\r\n  1554,  1559,  1569,  1571,  1573,  1576,  1583,  1591,  1592,  1594,\r\n  1597,  1599,  1601,  1603,  1605,  1607,  1609,  1611,  1613,  1615,\r\n  1617,  1621,  1624,  1625,  1627,  1629,  1633,  1634,  1635,  1636,\r\n  1637,  1638\r\n};\r\n\r\nstatic const short yyrhs[] = {   143,\r\n     0,     5,     0,     6,     0,     7,     0,     8,     0,    50,\r\n     0,    73,     0,    32,     0,   281,     0,   281,   146,     0,\r\n     0,   121,   147,     0,   151,   149,   148,     0,   100,   150,\r\n     0,    97,   150,   147,     0,     0,     0,   152,     0,   160,\r\n     0,   153,     0,   145,     0,   154,     0,   158,     0,   159,\r\n     0,   155,     0,    12,     0,   156,     0,   157,     0,    22,\r\n     0,    62,     0,    14,     0,    64,     0,    80,     0,    42,\r\n     0,    76,     0,    47,     0,    77,     0,    17,     0,    35,\r\n     0,    26,     0,    51,     0,    68,     0,   151,   122,     0,\r\n    83,   122,     0,   160,   162,     0,   153,   162,     0,   281,\r\n   162,     0,     0,   162,   161,     0,     3,     0,   211,     0,\r\n   165,     0,   164,    97,   165,     0,   211,     0,    60,   163,\r\n     0,    53,   163,     0,   168,     0,   167,     0,   142,     0,\r\n   181,     0,   169,     0,   170,     0,   172,     0,   175,     0,\r\n   176,     0,   179,     0,   183,     0,   188,     0,   184,     0,\r\n   185,     0,   123,   211,   124,     0,   166,   125,     4,     0,\r\n   154,   125,     4,     0,   158,   125,     4,     0,   167,   123,\r\n   171,   124,     0,   281,   123,   171,   124,     0,     0,   164,\r\n     0,   166,    98,   174,    99,     0,   281,    98,   174,    99,\r\n     0,     0,   174,     0,   211,     0,   174,    97,   211,     0,\r\n    71,     0,    11,   125,     4,     0,    11,    98,   174,    99,\r\n     0,   189,   118,     0,   189,   119,     0,   180,     0,    49,\r\n   151,   123,   171,   124,     0,    49,   152,    98,   174,    99,\r\n   161,   182,     0,    49,   160,   352,     0,     0,   352,     0,\r\n    75,   123,   151,   124,     0,    75,   123,    83,   124,     0,\r\n    18,   123,   211,   124,     0,    78,   123,   211,   124,     0,\r\n   189,   120,     4,     0,   126,   193,     0,    65,   123,   151,\r\n   124,     0,   166,     0,   281,     0,   177,     0,   178,     0,\r\n   186,     0,   189,     0,   127,   193,     0,   128,   193,     0,\r\n   194,     0,   118,   193,     0,   119,   193,     0,   190,     0,\r\n   129,   193,     0,   130,   193,     0,   122,   193,     0,   191,\r\n     0,   192,     0,   187,     0,   123,   211,   124,   190,     0,\r\n   123,   198,   122,   124,   193,     0,   123,   281,   162,   195,\r\n   124,   193,     0,   123,   154,   195,   124,   193,     0,   123,\r\n   158,   195,   124,   193,     0,   123,    83,   195,   124,   193,\r\n     0,     0,   196,     0,   197,     0,   196,   197,     0,   162,\r\n     0,   122,     0,   193,     0,   198,   122,   193,     0,   198,\r\n   131,   193,     0,   198,   132,   193,     0,   198,     0,   199,\r\n   129,   198,     0,   199,   130,   198,     0,   199,     0,   200,\r\n   109,   199,     0,   200,     0,   201,   121,   200,     0,   201,\r\n   133,   200,     0,   201,   114,   200,     0,   201,   115,   200,\r\n     0,   201,    45,   151,     0,   201,    10,   151,     0,   201,\r\n     0,   202,   112,   201,     0,   202,   113,   201,     0,   202,\r\n     0,   203,   126,   202,     0,   203,     0,   204,   134,   203,\r\n     0,   204,     0,   205,   135,   204,     0,   205,     0,   206,\r\n   116,   205,     0,   206,     0,   207,   117,   206,     0,   207,\r\n     0,   207,   136,   211,   137,   211,     0,   193,   210,   211,\r\n     0,   138,     0,   101,     0,   102,     0,   103,     0,   104,\r\n     0,   105,     0,   106,     0,   107,     0,   108,     0,   110,\r\n     0,   111,     0,   208,     0,   209,     0,   211,     0,   211,\r\n     0,   220,     0,   221,     0,   215,     0,   216,     0,   219,\r\n     0,   230,     0,   232,     0,   241,     0,   254,     0,   261,\r\n     0,   266,     0,   267,     0,   268,     0,   269,     0,   242,\r\n     0,   271,     0,   139,   217,   140,     0,     0,   218,     0,\r\n   214,     0,   218,   214,     0,   141,     0,     4,   137,   214,\r\n     0,   222,   141,     0,   227,   141,     0,   151,   223,     0,\r\n   224,     0,   223,    97,   224,     0,     4,     0,     4,   138,\r\n   225,     0,   211,     0,   352,     0,   226,     0,    66,   151,\r\n    98,   211,    99,     0,    20,   151,   228,     0,   229,     0,\r\n   228,    97,   229,     0,     4,   138,   212,     0,   231,   141,\r\n     0,   170,     0,   180,     0,   209,     0,   177,     0,   178,\r\n     0,   191,     0,   192,     0,   233,     0,   234,     0,    39,\r\n   123,   213,   124,   215,     0,    39,   123,   213,   124,   215,\r\n    27,   215,     0,    70,   123,   211,   124,   235,     0,   139,\r\n   236,   140,     0,     0,   237,     0,   238,     0,   237,   238,\r\n     0,   239,   218,     0,   240,     0,   239,   240,     0,    15,\r\n   212,   137,     0,    23,   137,     0,   243,     0,   244,     0,\r\n   245,     0,   253,     0,    79,   216,     0,    85,   123,   213,\r\n   124,   215,     0,    25,   215,    85,   123,   213,   124,   141,\r\n     0,    36,   123,   246,   141,   247,   141,   248,   124,   215,\r\n     0,     0,   249,     0,     0,   250,     0,     0,   251,     0,\r\n   222,     0,   252,     0,   213,     0,   252,     0,   231,     0,\r\n   252,    97,   231,     0,    37,   123,   151,     4,    41,   211,\r\n   124,   215,     0,   255,     0,   256,     0,   257,     0,   258,\r\n     0,   260,     0,    13,   141,     0,    21,   141,     0,    38,\r\n     4,   141,     0,    38,    15,   212,   141,     0,    38,    23,\r\n   141,     0,    61,   259,   141,     0,     0,   211,     0,    72,\r\n   259,   141,     0,    74,   216,   262,     0,    74,   216,   265,\r\n     0,    74,   216,   262,   265,     0,   263,     0,   262,   263,\r\n     0,    16,   123,   158,   264,   124,   216,     0,    16,   123,\r\n   145,   264,   124,   216,     0,    16,   216,     0,     0,     4,\r\n     0,    33,   216,     0,    18,   216,     0,    78,   216,     0,\r\n    46,   123,   211,   124,   215,     0,    81,   123,   270,   124,\r\n   215,     0,   222,     0,   211,     0,    34,   123,   151,   272,\r\n   124,   215,     0,   273,     0,   272,    97,   273,     0,     4,\r\n   138,   211,     0,   275,   276,     0,   275,   288,     0,     0,\r\n   284,     0,     0,   379,     0,     0,   288,     0,     0,   276,\r\n    48,   281,   279,   283,   280,     0,     0,   141,     0,     4,\r\n     0,   282,     4,     0,     4,   125,     0,   282,     4,   125,\r\n     0,   139,   275,   277,   140,     0,   285,     0,   284,   285,\r\n     0,   286,     0,   287,     0,    81,     4,   138,   281,   141,\r\n     0,    81,   144,   141,     0,   289,     0,   288,   289,     0,\r\n   278,     0,   290,     0,   294,     0,   344,     0,   355,     0,\r\n   370,     0,   378,     0,     0,   292,     0,   293,     0,   292,\r\n   293,     0,     9,     0,    31,     0,    44,     0,    49,     0,\r\n    54,     0,    56,     0,    57,     0,    58,     0,    59,     0,\r\n    63,     0,    67,     0,    79,     0,    82,     0,    84,     0,\r\n     0,   276,   291,    19,     4,   295,   296,   299,   280,     0,\r\n     0,   297,     0,   137,   158,     0,   137,   298,     0,   137,\r\n   158,    97,   298,     0,   145,     0,   298,    97,   145,     0,\r\n   139,   300,   140,     0,     0,   301,     0,   302,     0,   301,\r\n   302,     0,   303,     0,   304,     0,   305,     0,   316,     0,\r\n   323,     0,   327,     0,   331,     0,   337,     0,   341,     0,\r\n   290,     0,   276,   291,    20,   151,   228,   141,     0,   276,\r\n   291,   151,   223,   141,     0,   306,   309,     0,   276,   291,\r\n   151,   281,   123,   307,   124,     0,   276,   291,    83,   281,\r\n   123,   307,   124,     0,     0,   310,     0,   151,     0,    83,\r\n     0,   216,     0,   141,     0,   311,     0,   310,    97,   311,\r\n     0,   312,     0,   315,     0,   276,   314,   151,     4,   313,\r\n     0,     0,   138,   142,     0,     0,    60,     0,    53,     0,\r\n   276,    55,   151,     4,     0,   276,   291,   151,   281,   394,\r\n   139,   317,   140,   395,     0,   320,   318,     0,   321,   319,\r\n     0,     0,     0,   321,     0,     0,   320,     0,   276,    93,\r\n   395,   322,   394,     0,   276,    94,   395,   322,   394,     0,\r\n   216,     0,   141,     0,   276,   291,    29,   151,   223,   141,\r\n     0,   276,   291,    29,   151,   281,   392,   139,   324,   140,\r\n   393,     0,   325,   326,     0,   326,   325,     0,   276,    95,\r\n   393,   216,   392,     0,   276,    96,   393,   216,   392,     0,\r\n     0,   276,   291,   329,   328,   394,   139,   317,   140,   395,\r\n     0,   151,    71,    98,   310,    99,     0,   151,   330,    98,\r\n   310,    99,     0,   282,    71,     0,   276,   291,   332,   342,\r\n     0,   333,     0,   336,     0,   151,    52,   334,   123,   151,\r\n     4,   124,     0,   151,    52,   334,   123,   151,     4,    97,\r\n   151,     4,   124,     0,   129,     0,   130,     0,   127,     0,\r\n   128,     0,   118,     0,   119,     0,    73,     0,    32,     0,\r\n   122,     0,   131,     0,   132,     0,   126,     0,   135,     0,\r\n   134,     0,   109,     0,   112,     0,   113,     0,   133,   335,\r\n     0,   121,     0,   115,     0,   114,     0,   100,     0,     0,\r\n    40,    52,   151,   123,   151,     4,   124,     0,    30,    52,\r\n   151,   123,   151,     4,   124,     0,   276,   291,   338,   343,\r\n     0,     4,   123,   307,   124,   339,     0,     0,   340,     0,\r\n   137,    11,   123,   171,   124,     0,   137,    71,   123,   171,\r\n   124,     0,   276,   291,   128,     4,   123,   124,   216,     0,\r\n   216,     0,   141,     0,   216,     0,   141,     0,     0,   276,\r\n   291,    69,     4,   345,   346,   348,   280,     0,     0,   347,\r\n     0,   137,   298,     0,   139,   349,   140,     0,     0,   350,\r\n     0,   351,     0,   350,   351,     0,   303,     0,   304,     0,\r\n   305,     0,   316,     0,   323,     0,   327,     0,   331,     0,\r\n   337,     0,   290,     0,   139,   353,   140,     0,   139,   354,\r\n    97,   140,     0,     0,   354,     0,   225,     0,   354,    97,\r\n   225,     0,     0,   276,   291,    43,     4,   356,   357,   359,\r\n   280,     0,     0,   358,     0,   137,   298,     0,   139,   360,\r\n   140,     0,     0,   361,     0,   362,     0,   361,   362,     0,\r\n   363,     0,   365,     0,   368,     0,   366,     0,   276,   364,\r\n   151,     4,   123,   307,   124,   369,     0,   276,   364,    83,\r\n     4,   123,   307,   124,   369,     0,     0,    49,     0,   276,\r\n   364,   151,     4,   394,   139,   367,   140,   395,     0,   276,\r\n   364,   151,    71,    98,   310,    99,   394,   139,   367,   140,\r\n   395,     0,   276,    93,   369,     0,   276,    94,   369,     0,\r\n   276,    93,   369,   276,    94,   369,     0,   276,    94,   369,\r\n   276,    93,   369,     0,   276,   364,    29,   151,     4,   369,\r\n     0,   141,     0,   139,   140,     0,     0,   276,   291,    28,\r\n     4,   372,   371,   374,   280,     0,     0,   373,     0,   137,\r\n   156,     0,   139,   375,   140,     0,   139,   376,    97,   140,\r\n     0,     0,   376,     0,   377,     0,   376,    97,   377,     0,\r\n   276,     4,     0,   276,     4,   138,   212,     0,   276,   291,\r\n    24,   308,     4,   123,   307,   124,   141,     0,   380,     0,\r\n   381,     0,   380,   381,     0,   390,    98,   382,   385,    99,\r\n   391,     0,   390,    98,   382,   385,    97,    99,   391,     0,\r\n     0,   383,     0,   384,   137,     0,    86,     0,    87,     0,\r\n    29,     0,    88,     0,    89,     0,    90,     0,    91,     0,\r\n    61,     0,    92,     0,   386,     0,   385,    97,   386,     0,\r\n   388,   387,     0,     0,   389,     0,   145,     0,   123,   173,\r\n   124,     0,     0,     0,     0,     0,     0,     0\r\n};\r\n\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\nstatic const short yyrline[] = { 0,\r\n   121,   122,   123,   124,   125,   126,   129,   130,   140,   143,\r\n   146,   147,   151,   154,   155,   158,   159,   163,   164,   167,\r\n   168,   171,   172,   173,   176,   177,   180,   181,   182,   185,\r\n   186,   187,   188,   189,   190,   191,   192,   193,   196,   197,\r\n   200,   201,   204,   205,   208,   209,   210,   214,   215,   219,\r\n   227,   231,   232,   235,   236,   237,   240,   241,   244,   245,\r\n   246,   247,   248,   249,   250,   251,   252,   253,   254,   255,\r\n   258,   261,   262,   263,   266,   267,   272,   273,   276,   277,\r\n   281,   282,   286,   287,   290,   293,   294,   297,   300,   303,\r\n   306,   309,   311,   314,   315,   318,   319,   322,   325,   328,\r\n   331,   334,   337,   338,   339,   340,   341,   344,   345,   346,\r\n   347,   350,   353,   356,   357,   358,   359,   360,   361,   362,\r\n   370,   371,   372,   376,   380,   384,   391,   392,   395,   396,\r\n   399,   400,   404,   405,   406,   407,   410,   411,   412,   415,\r\n   416,   420,   421,   422,   423,   424,   425,   426,   429,   430,\r\n   431,   434,   435,   438,   439,   442,   443,   446,   447,   450,\r\n   451,   454,   455,   457,   460,   461,   462,   463,   464,   465,\r\n   466,   467,   468,   469,   470,   474,   475,   478,   481,   496,\r\n   497,   498,   501,   502,   503,   504,   505,   506,   507,   508,\r\n   509,   510,   511,   512,   513,   516,   519,   520,   524,   525,\r\n   528,   531,   534,   535,   538,   541,   542,   545,   546,   549,\r\n   550,   551,   554,   557,   560,   561,   564,   567,   570,   571,\r\n   572,   573,   574,   575,   576,   579,   580,   583,   584,   587,\r\n   590,   593,   594,   597,   598,   601,   605,   606,   609,   610,\r\n   613,   614,   615,   616,   619,   622,   626,   630,   637,   638,\r\n   641,   642,   645,   646,   649,   650,   653,   656,   659,   660,\r\n   663,   671,   672,   673,   674,   675,   678,   681,   684,   685,\r\n   686,   689,   692,   693,   696,   699,   702,   705,   711,   712,\r\n   715,   718,   721,   724,   725,   728,   731,   734,   737,   742,\r\n   746,   747,   751,   755,   756,   759,   768,   769,   772,   773,\r\n   776,   777,   780,   781,   784,   784,   789,   790,   799,   800,\r\n   803,   804,   808,   811,   812,   815,   816,   819,   822,   825,\r\n   826,   829,   830,   833,   834,   835,   836,   837,   848,   849,\r\n   852,   853,   856,   857,   858,   859,   860,   861,   862,   863,\r\n   864,   865,   866,   867,   868,   869,   873,   881,   884,   885,\r\n   888,   889,   890,   893,   894,   897,   900,   901,   904,   905,\r\n   908,   909,   910,   911,   912,   913,   914,   915,   916,   918,\r\n   921,   924,   927,   939,   945,   953,   954,   957,   958,   961,\r\n   962,   965,   966,   969,   970,   973,   981,   982,   985,   986,\r\n   987,   991,   998,  1004,  1005,  1006,  1009,  1010,  1013,  1014,\r\n  1017,  1023,  1029,  1030,  1033,  1034,  1040,  1041,  1044,  1050,\r\n  1056,  1060,  1064,  1066,  1069,  1073,  1076,  1077,  1080,  1081,\r\n  1084,  1085,  1086,  1087,  1088,  1089,  1090,  1091,  1092,  1093,\r\n  1094,  1095,  1096,  1097,  1098,  1099,  1100,  1101,  1102,  1103,\r\n  1104,  1106,  1107,  1111,  1112,  1115,  1126,  1133,  1134,  1137,\r\n  1138,  1154,  1164,  1165,  1168,  1169,  1174,  1179,  1182,  1183,\r\n  1186,  1189,  1192,  1193,  1196,  1197,  1200,  1201,  1202,  1203,\r\n  1204,  1205,  1206,  1207,  1209,  1214,  1215,  1218,  1219,  1222,\r\n  1223,  1228,  1232,  1236,  1237,  1240,  1243,  1246,  1247,  1250,\r\n  1251,  1254,  1255,  1256,  1257,  1261,  1271,  1283,  1284,  1287,\r\n  1293,  1301,  1302,  1303,  1304,  1307,  1312,  1313,  1318,  1320,\r\n  1325,  1326,  1329,  1332,  1333,  1336,  1337,  1340,  1341,  1344,\r\n  1345,  1350,  1356,  1359,  1360,  1363,  1365,  1369,  1370,  1373,\r\n  1376,  1377,  1378,  1379,  1380,  1381,  1382,  1383,  1384,  1387,\r\n  1388,  1391,  1394,  1395,  1398,  1401,  1408,  1411,  1414,  1417,\r\n  1420,  1423\r\n};\r\n\r\nstatic const char * const yytname[] = {   \"$\",\"error\",\"$undefined.\",\"RANK_SPECIFIER\",\r\n\"IDENTIFIER\",\"INTEGER_LITERAL\",\"REAL_LITERAL\",\"CHARACTER_LITERAL\",\"STRING_LITERAL\",\r\n\"ABSTRACT\",\"AS\",\"BASE\",\"BOOL\",\"BREAK\",\"BYTE\",\"CASE\",\"CATCH\",\"CHAR\",\"CHECKED\",\r\n\"CLASS\",\"CONST\",\"CONTINUE\",\"DECIMAL\",\"DEFAULT\",\"DELEGATE\",\"DO\",\"DOUBLE\",\"ELSE\",\r\n\"ENUM\",\"EVENT\",\"EXPLICIT\",\"EXTERN\",\"FALSE\",\"FINALLY\",\"FIXED\",\"FLOAT\",\"FOR\",\"FOREACH\",\r\n\"GOTO\",\"IF\",\"IMPLICIT\",\"IN\",\"INT\",\"INTERFACE\",\"INTERNAL\",\"IS\",\"LOCK\",\"LONG\",\r\n\"NAMESPACE\",\"NEW\",\"NULL_LITERAL\",\"OBJECT\",\"OPERATOR\",\"OUT\",\"OVERRIDE\",\"PARAMS\",\r\n\"PRIVATE\",\"PROTECTED\",\"PUBLIC\",\"READONLY\",\"REF\",\"RETURN\",\"SBYTE\",\"SEALED\",\"SHORT\",\r\n\"SIZEOF\",\"STACKALLOC\",\"STATIC\",\"STRING\",\"STRUCT\",\"SWITCH\",\"THIS\",\"THROW\",\"TRUE\",\r\n\"TRY\",\"TYPEOF\",\"UINT\",\"ULONG\",\"UNCHECKED\",\"UNSAFE\",\"USHORT\",\"USING\",\"VIRTUAL\",\r\n\"VOID\",\"VOLATILE\",\"WHILE\",\"ASSEMBLY\",\"FIELD\",\"METHOD\",\"MODULE\",\"PARAM\",\"PROPERTY\",\r\n\"TYPE\",\"GET\",\"SET\",\"ADD\",\"REMOVE\",\"COMMA\",\"LEFT_BRACKET\",\"RIGHT_BRACKET\",\"GT\",\r\n\"PLUSEQ\",\"MINUSEQ\",\"STAREQ\",\"DIVEQ\",\"MODEQ\",\"XOREQ\",\"ANDEQ\",\"OREQ\",\"LTLT\",\"GTGTEQ\",\r\n\"LTLTEQ\",\"EQEQ\",\"NOTEQ\",\"LEQ\",\"GEQ\",\"ANDAND\",\"OROR\",\"PLUSPLUS\",\"MINUSMINUS\",\r\n\"ARROW\",\"'<'\",\"'*'\",\"'('\",\"')'\",\"'.'\",\"'&'\",\"'!'\",\"'~'\",\"'+'\",\"'-'\",\"'/'\",\"'%'\",\r\n\"'>'\",\"'^'\",\"'|'\",\"'?'\",\"':'\",\"'='\",\"'{'\",\"'}'\",\"';'\",\"literal\",\"boolean_literal\",\r\n\"namespace_name\",\"type_name\",\"opt_generic\",\"genericlist\",\"continuity\",\"ENTER_generic\",\r\n\"END_generic\",\"type\",\"non_array_type\",\"simple_type\",\"primitive_type\",\"numeric_type\",\r\n\"integral_type\",\"floating_point_type\",\"class_type\",\"pointer_type\",\"array_type\",\r\n\"rank_specifiers_opt\",\"rank_specifier\",\"variable_reference\",\"argument_list\",\r\n\"argument\",\"primary_expression\",\"primary_expression_no_parenthesis\",\"parenthesized_expression\",\r\n\"member_access\",\"invocation_expression\",\"argument_list_opt\",\"element_access\",\r\n\"expression_list_opt\",\"expression_list\",\"this_access\",\"base_access\",\"post_increment_expression\",\r\n\"post_decrement_expression\",\"new_expression\",\"object_creation_expression\",\"array_creation_expression\",\r\n\"array_initializer_opt\",\"typeof_expression\",\"checked_expression\",\"unchecked_expression\",\r\n\"pointer_member_access\",\"addressof_expression\",\"sizeof_expression\",\"postfix_expression\",\r\n\"unary_expression_not_plusminus\",\"pre_increment_expression\",\"pre_decrement_expression\",\r\n\"unary_expression\",\"cast_expression\",\"type_quals_opt\",\"type_quals\",\"type_qual\",\r\n\"multiplicative_expression\",\"additive_expression\",\"shift_expression\",\"relational_expression\",\r\n\"equality_expression\",\"and_expression\",\"exclusive_or_expression\",\"inclusive_or_expression\",\r\n\"conditional_and_expression\",\"conditional_or_expression\",\"conditional_expression\",\r\n\"assignment\",\"assignment_operator\",\"expression\",\"constant_expression\",\"boolean_expression\",\r\n\"statement\",\"embedded_statement\",\"block\",\"statement_list_opt\",\"statement_list\",\r\n\"empty_statement\",\"labeled_statement\",\"declaration_statement\",\"local_variable_declaration\",\r\n\"variable_declarators\",\"variable_declarator\",\"variable_initializer\",\"stackalloc_initializer\",\r\n\"local_constant_declaration\",\"constant_declarators\",\"constant_declarator\",\"expression_statement\",\r\n\"statement_expression\",\"selection_statement\",\"if_statement\",\"switch_statement\",\r\n\"switch_block\",\"switch_sections_opt\",\"switch_sections\",\"switch_section\",\"switch_labels\",\r\n\"switch_label\",\"iteration_statement\",\"unsafe_statement\",\"while_statement\",\"do_statement\",\r\n\"for_statement\",\"for_initializer_opt\",\"for_condition_opt\",\"for_iterator_opt\",\r\n\"for_initializer\",\"for_condition\",\"for_iterator\",\"statement_expression_list\",\r\n\"foreach_statement\",\"jump_statement\",\"break_statement\",\"continue_statement\",\r\n\"goto_statement\",\"return_statement\",\"expression_opt\",\"throw_statement\",\"try_statement\",\r\n\"catch_clauses\",\"catch_clause\",\"identifier_opt\",\"finally_clause\",\"checked_statement\",\r\n\"unchecked_statement\",\"lock_statement\",\"using_statement\",\"resource_acquisition\",\r\n\"fixed_statement\",\"fixed_pointer_declarators\",\"fixed_pointer_declarator\",\"compilation_unit\",\r\n\"using_directives_opt\",\"attributes_opt\",\"namespace_member_declarations_opt\",\r\n\"namespace_declaration\",\"@1\",\"comma_opt\",\"qualified_identifier\",\"qualifier\",\r\n\"namespace_body\",\"using_directives\",\"using_directive\",\"using_alias_directive\",\r\n\"using_namespace_directive\",\"namespace_member_declarations\",\"namespace_member_declaration\",\r\n\"type_declaration\",\"modifiers_opt\",\"modifiers\",\"modifier\",\"class_declaration\",\r\n\"@2\",\"class_base_opt\",\"class_base\",\"interface_type_list\",\"class_body\",\"class_member_declarations_opt\",\r\n\"class_member_declarations\",\"class_member_declaration\",\"constant_declaration\",\r\n\"field_declaration\",\"method_declaration\",\"method_header\",\"formal_parameter_list_opt\",\r\n\"return_type\",\"method_body\",\"formal_parameter_list\",\"formal_parameter\",\"fixed_parameter\",\r\n\"fixed_parameter_opt_default\",\"parameter_modifier_opt\",\"parameter_array\",\"property_declaration\",\r\n\"accessor_declarations\",\"set_accessor_declaration_opt\",\"get_accessor_declaration_opt\",\r\n\"get_accessor_declaration\",\"set_accessor_declaration\",\"accessor_body\",\"event_declaration\",\r\n\"event_accessor_declarations\",\"add_accessor_declaration\",\"remove_accessor_declaration\",\r\n\"indexer_declaration\",\"@3\",\"indexer_declarator\",\"qualified_this\",\"operator_declaration\",\r\n\"operator_declarator\",\"overloadable_operator_declarator\",\"overloadable_operator\",\r\n\"optGT\",\"conversion_operator_declarator\",\"constructor_declaration\",\"constructor_declarator\",\r\n\"constructor_initializer_opt\",\"constructor_initializer\",\"destructor_declaration\",\r\n\"operator_body\",\"constructor_body\",\"struct_declaration\",\"@4\",\"struct_interfaces_opt\",\r\n\"struct_interfaces\",\"struct_body\",\"struct_member_declarations_opt\",\"struct_member_declarations\",\r\n\"struct_member_declaration\",\"array_initializer\",\"variable_initializer_list_opt\",\r\n\"variable_initializer_list\",\"interface_declaration\",\"@5\",\"interface_base_opt\",\r\n\"interface_base\",\"interface_body\",\"interface_member_declarations_opt\",\"interface_member_declarations\",\r\n\"interface_member_declaration\",\"interface_method_declaration\",\"new_opt\",\"interface_property_declaration\",\r\n\"interface_indexer_declaration\",\"interface_accessors\",\"interface_event_declaration\",\r\n\"interface_empty_body\",\"enum_declaration\",\"@6\",\"enum_base_opt\",\"enum_base\",\"enum_body\",\r\n\"enum_member_declarations_opt\",\"enum_member_declarations\",\"enum_member_declaration\",\r\n\"delegate_declaration\",\"attributes\",\"attribute_sections\",\"attribute_section\",\r\n\"attribute_target_specifier_opt\",\"attribute_target_specifier\",\"attribute_target\",\r\n\"attribute_list\",\"attribute\",\"attribute_arguments_opt\",\"attribute_name\",\"attribute_arguments\",\r\n\"ENTER_attrib\",\"EXIT_attrib\",\"ENTER_accessor_decl\",\"EXIT_accessor_decl\",\"ENTER_getset\",\r\n\"EXIT_getset\",\"\"\r\n};\r\n#endif\r\n\r\nstatic const short yyr1[] = {     0,\r\n   142,   142,   142,   142,   142,   142,   143,   143,   144,   145,\r\n   146,   146,   147,   148,   148,   149,   150,   151,   151,   152,\r\n   152,   153,   153,   153,   154,   154,   155,   155,   155,   156,\r\n   156,   156,   156,   156,   156,   156,   156,   156,   157,   157,\r\n   158,   158,   159,   159,   160,   160,   160,   161,   161,   162,\r\n   163,   164,   164,   165,   165,   165,   166,   166,   167,   167,\r\n   167,   167,   167,   167,   167,   167,   167,   167,   167,   167,\r\n   168,   169,   169,   169,   170,   170,   171,   171,   172,   172,\r\n   173,   173,   174,   174,   175,   176,   176,   177,   178,   179,\r\n   180,   181,   181,   182,   182,   183,   183,   184,   185,   186,\r\n   187,   188,   189,   189,   189,   189,   189,   190,   190,   190,\r\n   190,   191,   192,   193,   193,   193,   193,   193,   193,   193,\r\n   194,   194,   194,   194,   194,   194,   195,   195,   196,   196,\r\n   197,   197,   198,   198,   198,   198,   199,   199,   199,   200,\r\n   200,   201,   201,   201,   201,   201,   201,   201,   202,   202,\r\n   202,   203,   203,   204,   204,   205,   205,   206,   206,   207,\r\n   207,   208,   208,   209,   210,   210,   210,   210,   210,   210,\r\n   210,   210,   210,   210,   210,   211,   211,   212,   213,   214,\r\n   214,   214,   215,   215,   215,   215,   215,   215,   215,   215,\r\n   215,   215,   215,   215,   215,   216,   217,   217,   218,   218,\r\n   219,   220,   221,   221,   222,   223,   223,   224,   224,   225,\r\n   225,   225,   226,   227,   228,   228,   229,   230,   231,   231,\r\n   231,   231,   231,   231,   231,   232,   232,   233,   233,   234,\r\n   235,   236,   236,   237,   237,   238,   239,   239,   240,   240,\r\n   241,   241,   241,   241,   242,   243,   244,   245,   246,   246,\r\n   247,   247,   248,   248,   249,   249,   250,   251,   252,   252,\r\n   253,   254,   254,   254,   254,   254,   255,   256,   257,   257,\r\n   257,   258,   259,   259,   260,   261,   261,   261,   262,   262,\r\n   263,   263,   263,   264,   264,   265,   266,   267,   268,   269,\r\n   270,   270,   271,   272,   272,   273,   274,   274,   275,   275,\r\n   276,   276,   277,   277,   279,   278,   280,   280,   281,   281,\r\n   282,   282,   283,   284,   284,   285,   285,   286,   287,   288,\r\n   288,   289,   289,   290,   290,   290,   290,   290,   291,   291,\r\n   292,   292,   293,   293,   293,   293,   293,   293,   293,   293,\r\n   293,   293,   293,   293,   293,   293,   295,   294,   296,   296,\r\n   297,   297,   297,   298,   298,   299,   300,   300,   301,   301,\r\n   302,   302,   302,   302,   302,   302,   302,   302,   302,   302,\r\n   303,   304,   305,   306,   306,   307,   307,   308,   308,   309,\r\n   309,   310,   310,   311,   311,   312,   313,   313,   314,   314,\r\n   314,   315,   316,   317,   317,   317,   318,   318,   319,   319,\r\n   320,   321,   322,   322,   323,   323,   324,   324,   325,   326,\r\n   328,   327,   329,   329,   330,   331,   332,   332,   333,   333,\r\n   334,   334,   334,   334,   334,   334,   334,   334,   334,   334,\r\n   334,   334,   334,   334,   334,   334,   334,   334,   334,   334,\r\n   334,   335,   335,   336,   336,   337,   338,   339,   339,   340,\r\n   340,   341,   342,   342,   343,   343,   345,   344,   346,   346,\r\n   347,   348,   349,   349,   350,   350,   351,   351,   351,   351,\r\n   351,   351,   351,   351,   351,   352,   352,   353,   353,   354,\r\n   354,   356,   355,   357,   357,   358,   359,   360,   360,   361,\r\n   361,   362,   362,   362,   362,   363,   363,   364,   364,   365,\r\n   366,   367,   367,   367,   367,   368,   369,   369,   371,   370,\r\n   372,   372,   373,   374,   374,   375,   375,   376,   376,   377,\r\n   377,   378,   379,   380,   380,   381,   381,   382,   382,   383,\r\n   384,   384,   384,   384,   384,   384,   384,   384,   384,   385,\r\n   385,   386,   387,   387,   388,   389,   390,   391,   392,   393,\r\n   394,   395\r\n};\r\n\r\nstatic const short yyr2[] = {     0,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     2,\r\n     0,     2,     3,     2,     3,     0,     0,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     2,     2,     2,     2,     2,     0,     2,     1,\r\n     1,     1,     3,     1,     2,     2,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     3,     3,     3,     3,     4,     4,     0,     1,     4,     4,\r\n     0,     1,     1,     3,     1,     3,     4,     2,     2,     1,\r\n     5,     7,     3,     0,     1,     4,     4,     4,     4,     3,\r\n     2,     4,     1,     1,     1,     1,     1,     1,     2,     2,\r\n     1,     2,     2,     1,     2,     2,     2,     1,     1,     1,\r\n     4,     5,     6,     5,     5,     5,     0,     1,     1,     2,\r\n     1,     1,     1,     3,     3,     3,     1,     3,     3,     1,\r\n     3,     1,     3,     3,     3,     3,     3,     3,     1,     3,\r\n     3,     1,     3,     1,     3,     1,     3,     1,     3,     1,\r\n     3,     1,     5,     3,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     3,     0,     1,     1,     2,\r\n     1,     3,     2,     2,     2,     1,     3,     1,     3,     1,\r\n     1,     1,     5,     3,     1,     3,     3,     2,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     5,     7,     5,\r\n     3,     0,     1,     1,     2,     2,     1,     2,     3,     2,\r\n     1,     1,     1,     1,     2,     5,     7,     9,     0,     1,\r\n     0,     1,     0,     1,     1,     1,     1,     1,     1,     3,\r\n     8,     1,     1,     1,     1,     1,     2,     2,     3,     4,\r\n     3,     3,     0,     1,     3,     3,     3,     4,     1,     2,\r\n     6,     6,     2,     0,     1,     2,     2,     2,     5,     5,\r\n     1,     1,     6,     1,     3,     3,     2,     2,     0,     1,\r\n     0,     1,     0,     1,     0,     6,     0,     1,     1,     2,\r\n     2,     3,     4,     1,     2,     1,     1,     5,     3,     1,\r\n     2,     1,     1,     1,     1,     1,     1,     1,     0,     1,\r\n     1,     2,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     0,     8,     0,     1,\r\n     2,     2,     4,     1,     3,     3,     0,     1,     1,     2,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     6,     5,     2,     7,     7,     0,     1,     1,     1,     1,\r\n     1,     1,     3,     1,     1,     5,     0,     2,     0,     1,\r\n     1,     4,     9,     2,     2,     0,     0,     1,     0,     1,\r\n     5,     5,     1,     1,     6,    10,     2,     2,     5,     5,\r\n     0,     9,     5,     5,     2,     4,     1,     1,     7,    10,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     1,     1,     2,     1,     1,\r\n     1,     1,     0,     7,     7,     4,     5,     0,     1,     5,\r\n     5,     7,     1,     1,     1,     1,     0,     8,     0,     1,\r\n     2,     3,     0,     1,     1,     2,     1,     1,     1,     1,\r\n     1,     1,     1,     1,     1,     3,     4,     0,     1,     1,\r\n     3,     0,     8,     0,     1,     2,     3,     0,     1,     1,\r\n     2,     1,     1,     1,     1,     8,     8,     0,     1,     9,\r\n    12,     3,     3,     6,     6,     6,     1,     2,     0,     8,\r\n     0,     1,     2,     3,     4,     0,     1,     1,     3,     2,\r\n     4,     9,     1,     1,     2,     6,     7,     0,     1,     2,\r\n     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,\r\n     3,     2,     0,     1,     1,     3,     0,     0,     0,     0,\r\n     0,     0\r\n};\r\n\r\nstatic const short yydefact[] = {   299,\r\n     0,   301,   300,   314,   316,   317,   309,     0,     9,     0,\r\n   329,   322,   301,   320,   323,   324,   325,   326,   327,   328,\r\n   302,   523,   524,     0,   315,   311,     0,   319,   310,   333,\r\n   334,   335,     0,   336,   337,   338,   339,   340,   341,   342,\r\n   343,   344,   345,   346,     0,   330,   331,   329,   321,   525,\r\n   528,   309,     0,   312,   305,     0,     0,     0,     0,     0,\r\n   332,   533,   538,   531,   532,   534,   535,   536,   537,   539,\r\n     0,   529,     0,   318,     0,   347,    26,    31,    38,    29,\r\n    40,    39,    34,    36,    41,    30,    32,    42,    35,    37,\r\n    33,   379,    21,   378,    18,    20,    22,    25,    27,    28,\r\n    23,    24,    19,    11,     0,   511,   482,   457,   545,    11,\r\n     0,   540,   543,   530,   299,   307,   349,    44,    43,    50,\r\n    46,    45,     0,    10,    47,     0,     0,   509,   512,   484,\r\n   459,     0,   548,    81,   542,   544,   301,   308,   306,     0,\r\n     0,   350,     0,    12,    16,   301,   513,     0,     0,     0,\r\n   485,     0,     0,   460,   548,   541,   526,     2,     3,     4,\r\n     5,     0,     0,     8,     0,     6,     0,    85,     7,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n    59,     1,     0,     0,   103,    58,    57,    61,    62,    63,\r\n     0,    82,    64,    65,   105,   106,    66,    90,    60,    67,\r\n    69,    70,   107,   120,    68,   108,   114,   118,   119,   133,\r\n   111,   137,   140,   142,   149,   152,   154,   156,   158,   160,\r\n   162,   176,   177,    83,   104,     0,   301,   354,   351,   352,\r\n   301,   307,     0,   389,     0,   377,   382,   384,   385,   301,\r\n   307,   486,   301,   307,   461,   301,   307,   527,     0,     0,\r\n     0,     0,    18,    19,     0,     0,     0,   112,   113,   117,\r\n   127,   127,   127,   137,     0,   104,   101,   109,   110,   115,\r\n   116,     0,     0,     0,     0,    77,   546,     0,    88,    89,\r\n     0,   166,   167,   168,   169,   170,   171,   172,   173,   174,\r\n   175,   165,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,    77,   313,     0,     0,   329,   370,\r\n     0,   301,   359,   361,   362,   363,     0,   364,   365,   366,\r\n   367,   368,   369,   348,    17,    17,    13,   391,     0,   390,\r\n     0,     0,   301,     0,     0,   517,   518,   510,   498,     0,\r\n   301,   490,   492,   493,   495,   494,   483,   329,   475,   467,\r\n   468,   469,   470,   471,   472,   473,   474,     0,   301,   465,\r\n   458,     0,    86,     0,    77,     0,   478,    93,     0,     0,\r\n     0,     0,   132,   131,     0,   128,   129,     0,     0,     0,\r\n    71,   127,    73,    74,     0,    72,     0,     0,    78,    52,\r\n     0,    54,    84,   100,   164,   134,   135,   136,   133,   138,\r\n   139,   141,   148,   147,   145,   146,   143,   144,   150,   151,\r\n   153,   155,   157,   159,   161,     0,     0,     0,   353,   355,\r\n     0,   356,   360,   197,   381,   380,   373,     0,    14,     0,\r\n     0,   522,   383,   520,   514,   301,   499,     0,   487,   491,\r\n     0,   462,   466,    87,    98,     0,     0,     0,   210,   480,\r\n   212,   211,     0,   479,   102,    97,    96,    99,     0,   130,\r\n     0,     0,     0,   121,     0,    79,    56,    51,    55,     0,\r\n    75,     0,    80,    76,   309,     0,     0,     0,     0,     0,\r\n     0,     0,   411,     0,   417,   418,     0,   309,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,   273,\r\n     0,   273,     0,     0,     0,     0,     0,   201,     0,    22,\r\n    23,    62,   105,   106,    90,   118,   119,     0,   221,   199,\r\n   182,   183,     0,   198,   184,   180,   181,     0,     0,   185,\r\n     0,   186,   226,   227,   187,   194,   241,   242,   243,   244,\r\n   188,   262,   263,   264,   265,   266,   189,   190,   191,   192,\r\n   193,   195,   104,    15,   392,   387,     0,   515,   519,     0,\r\n     0,     0,    91,    48,     0,   476,     0,   126,   124,   125,\r\n   122,     0,    53,   163,   301,     0,     0,     0,     0,     0,\r\n     0,   208,     0,     0,     0,   206,   551,     0,     0,   551,\r\n   454,   453,   416,   456,   455,   446,     0,   267,   287,     0,\r\n   268,     0,     0,   249,     0,     0,     0,     0,     0,     0,\r\n   274,     0,     0,     0,     0,   288,   245,     0,     0,   208,\r\n   205,   196,   200,   203,   204,   218,     0,   386,   178,   521,\r\n     0,     0,   551,     0,    94,    48,     0,   477,   481,   123,\r\n     0,     0,     0,   215,     0,   549,     0,     0,   301,     0,\r\n     0,   428,   427,   435,   436,   437,   441,   440,   425,   426,\r\n   439,   429,   432,   423,   424,   421,   422,   430,   431,   443,\r\n   434,   433,     0,   301,     0,   372,   301,     0,   415,   301,\r\n     0,   202,   214,     0,     0,   255,   259,     0,   250,   256,\r\n     0,   269,     0,   271,   179,     0,     0,   272,     0,   275,\r\n     0,     0,   276,   279,   277,   292,   291,     0,     0,   388,\r\n     0,   301,   301,     0,   301,    92,    95,    49,     0,   448,\r\n     0,     0,   371,   405,     0,     0,     0,     0,     0,   209,\r\n   442,   438,     0,     0,   207,     0,   301,     0,   301,     0,\r\n     0,     0,   294,   251,     0,     0,   270,     0,     0,     0,\r\n     0,   283,   286,   280,   278,     0,     0,     0,   507,   506,\r\n     0,     0,   301,     0,   213,     0,   447,   449,   217,   216,\r\n   301,     0,     0,   375,   452,     0,   413,   374,     0,     0,\r\n   301,   301,   414,     0,     0,     0,     0,     0,   257,     0,\r\n   252,   260,     0,   228,   289,   232,   230,   284,   284,   290,\r\n   246,   508,     0,     0,     0,     0,   551,     0,     0,     0,\r\n     0,   301,   301,     0,     0,     0,   552,   552,   552,     0,\r\n   394,   398,     0,   395,   400,   552,     0,   296,   295,   293,\r\n   253,     0,     0,     0,     0,     0,   233,   234,     0,   237,\r\n   285,     0,     0,   497,   496,     0,     0,   552,     0,    77,\r\n    77,   550,   550,   550,     0,   407,     0,   408,   445,   444,\r\n     0,   419,     0,     0,   393,   412,   247,     0,   254,   258,\r\n     0,   229,     0,   240,   231,   235,   236,   238,     0,     0,\r\n   301,   301,   500,   301,     0,     0,     0,     0,   406,     0,\r\n   404,   403,   551,   551,     0,   261,   239,   282,   281,     0,\r\n     0,     0,   450,   451,   549,   549,     0,   401,   402,   248,\r\n     0,     0,   552,   409,   410,   420,   504,   505,   501,     0,\r\n     0,     0\r\n};\r\n\r\nstatic const short yydefgoto[] = {   181,\r\n   182,     8,    93,   124,   144,   337,   233,   438,   519,    95,\r\n    96,   183,    98,    99,   100,   184,   102,   103,   645,   384,\r\n   477,   399,   400,   185,   186,   187,   188,   189,   401,   190,\r\n   191,   192,   193,   194,   195,   196,   197,   198,   199,   726,\r\n   200,   201,   202,   203,   204,   205,   206,   207,   208,   209,\r\n   210,   211,   385,   386,   387,   212,   213,   214,   215,   216,\r\n   217,   218,   219,   220,   221,   222,   223,   293,   402,   640,\r\n   706,   530,   531,   532,   533,   534,   535,   536,   537,   538,\r\n   595,   596,   460,   461,   539,   653,   654,   540,   541,   542,\r\n   543,   544,   807,   846,   847,   848,   849,   850,   545,   546,\r\n   547,   548,   549,   698,   800,   878,   699,   801,   879,   700,\r\n   550,   551,   552,   553,   554,   555,   622,   556,   557,   713,\r\n   714,   852,   715,   558,   559,   560,   561,   718,   562,   752,\r\n   753,   930,     2,   234,   226,    12,    75,   139,   225,    10,\r\n   116,     3,     4,     5,     6,    13,    14,    15,    45,    46,\r\n    47,    16,   117,   141,   142,   230,   232,   321,   322,   323,\r\n   324,   325,   326,   327,   235,   105,   437,   236,   237,   238,\r\n   638,   341,   239,   328,   790,   831,   834,   791,   792,   903,\r\n   329,   821,   822,   823,   330,   600,   493,   599,   331,   494,\r\n   495,   683,   742,   496,   332,   497,   777,   778,   333,   603,\r\n   606,    17,   131,   153,   154,   247,   368,   369,   370,   462,\r\n   463,   464,    18,   130,   150,   151,   244,   350,   351,   352,\r\n   353,   448,   354,   355,   816,   356,   770,    19,   148,   128,\r\n   129,   241,   345,   346,   347,    20,    21,    22,    23,    71,\r\n    72,    73,   111,   112,   135,   113,   136,    24,   157,   735,\r\n   897,   688,   873\r\n};\r\n\r\nstatic const short yypact[] = {   -30,\r\n    83,    20,   -30,-32768,-32768,-32768,   205,    -4,-32768,   203,\r\n  2508,-32768,    28,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,    20,-32768,   113,-32768,-32768,   253,-32768,   171,-32768,\r\n-32768,-32768,   253,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,   200,  1247,-32768,  2702,-32768,-32768,\r\n   407,   204,   101,-32768,-32768,   286,   343,   340,   369,   391,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n   253,-32768,   264,-32768,   259,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,   287,-32768,   293,-32768,   426,-32768,-32768,-32768,-32768,\r\n-32768,-32768,   426,    65,   442,   295,-32768,-32768,-32768,   297,\r\n   328,-32768,   337,-32768,   -30,   339,   351,-32768,-32768,-32768,\r\n-32768,-32768,  1695,-32768,-32768,   368,   274,-32768,-32768,   370,\r\n   383,    34,-32768,  2308,-32768,-32768,   -33,-32768,-32768,   185,\r\n   388,-32768,   287,-32768,   293,   221,-32768,   396,   253,   403,\r\n-32768,   253,   419,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,    18,   410,-32768,  1695,-32768,   437,-32768,-32768,   438,\r\n   439,  2308,  2308,  2308,  2031,  2308,  2308,  2308,  2308,  2308,\r\n-32768,-32768,   440,   443,   210,   441,-32768,-32768,-32768,-32768,\r\n   445,   466,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,   261,-32768,-32768,-32768,   611,\r\n-32768,   244,   117,   462,    15,   279,   446,   444,   447,   460,\r\n   -81,-32768,-32768,-32768,   104,   450,   -29,-32768,   480,   487,\r\n    47,   339,   -47,    67,   461,   489,-32768,-32768,-32768,    80,\r\n   339,   487,   119,   339,   487,   125,   339,-32768,  2308,   587,\r\n  2308,   211,   494,    19,  1695,  2662,  2308,-32768,-32768,-32768,\r\n    51,    59,    60,   281,   471,    21,-32768,-32768,-32768,-32768,\r\n-32768,   592,   593,  2308,   594,  1942,-32768,  2308,-32768,-32768,\r\n   595,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,  2308,  2308,  2308,  2308,  2308,  2308,  2308,  1695,\r\n  1695,  2308,  2308,  2308,  2308,  2308,  2308,  2308,  2308,  2308,\r\n  2308,  2308,  2308,  2308,  1942,-32768,   253,   253,  1247,-32768,\r\n   463,   137,-32768,-32768,-32768,-32768,   289,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,  1695,-32768,\r\n  1695,   464,    20,   598,   468,   507,-32768,-32768,   557,   469,\r\n   142,-32768,-32768,-32768,-32768,-32768,-32768,  1247,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,   470,   153,-32768,\r\n-32768,   336,-32768,   492,  1942,  2308,  1843,-32768,   315,   323,\r\n   341,   493,-32768,-32768,   497,    51,-32768,   498,   499,  2120,\r\n  2397,    51,-32768,-32768,   373,-32768,  2308,  2308,   527,-32768,\r\n   501,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   244,\r\n   244,   117,   293,   293,   462,   462,   462,   462,    15,    15,\r\n   279,   446,   444,   447,   460,   490,   378,   502,   487,-32768,\r\n  2467,-32768,-32768,  1468,-32768,-32768,-32768,  1695,-32768,    72,\r\n    73,-32768,-32768,   491,-32768,   154,-32768,  2618,-32768,-32768,\r\n  2574,-32768,-32768,-32768,-32768,   509,   379,  1695,-32768,-32768,\r\n-32768,-32768,   495,   537,-32768,-32768,-32768,-32768,  2308,-32768,\r\n  2308,  2308,  2308,-32768,   516,-32768,-32768,-32768,-32768,  1942,\r\n-32768,  2308,-32768,-32768,   360,  1695,  1695,   589,   590,    75,\r\n   639,    57,-32768,   325,-32768,-32768,   363,   246,   504,   217,\r\n  1695,   506,  1606,   525,   526,   530,   359,   531,   532,  2308,\r\n   533,  2308,   511,   238,   511,   534,   535,-32768,    78,   440,\r\n   443,   151,   157,   165,   173,   186,   187,   611,-32768,-32768,\r\n-32768,-32768,   520,  1468,-32768,-32768,-32768,   539,   540,-32768,\r\n   541,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,    82,-32768,-32768,   529,  2308,-32768,-32768,  1695,\r\n    79,    71,-32768,   426,   163,-32768,  1744,-32768,-32768,-32768,\r\n-32768,  2308,-32768,-32768,   221,    86,    87,  1695,  1695,   545,\r\n   561,   283,   950,   588,   -39,-32768,   564,    44,   591,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,  1468,-32768,-32768,    86,\r\n-32768,   603,  1695,  2219,  1695,   549,  2308,   550,  2308,  2308,\r\n-32768,   551,  2308,   553,   326,-32768,-32768,  2219,  2308,   558,\r\n   600,-32768,-32768,-32768,-32768,-32768,   226,-32768,-32768,-32768,\r\n    88,   572,   575,   601,   562,   426,  2308,-32768,-32768,-32768,\r\n   576,   567,   -31,-32768,   -27,-32768,   327,   333,   221,   582,\r\n  1843,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   607,\r\n-32768,-32768,   585,    20,   706,-32768,   221,   581,-32768,    20,\r\n   584,-32768,   627,   602,    90,-32768,-32768,   597,-32768,   629,\r\n    91,-32768,   599,-32768,-32768,   604,   605,-32768,   606,-32768,\r\n   245,   511,   326,-32768,-32768,-32768,-32768,   608,   610,-32768,\r\n   364,   221,   221,   609,    20,-32768,-32768,-32768,   632,   613,\r\n  2308,   735,-32768,-32768,   612,  1695,  1695,   618,   511,-32768,\r\n-32768,-32768,  1695,   409,-32768,   620,   162,   414,   162,  2308,\r\n   614,   228,-32768,  2308,  2308,   705,-32768,  1606,  1606,   616,\r\n   185,-32768,-32768,-32768,-32768,  1606,  1606,   624,-32768,-32768,\r\n   641,   645,    20,   415,-32768,    30,-32768,-32768,-32768,-32768,\r\n    20,    92,    93,-32768,-32768,    94,-32768,-32768,   422,   630,\r\n   175,   182,-32768,   633,   648,  2308,   749,  1606,-32768,   634,\r\n-32768,-32768,  2308,   751,-32768,   102,-32768,   772,   772,-32768,\r\n-32768,-32768,   364,   364,   429,   642,-32768,   658,   663,   430,\r\n   647,    20,    20,   664,   669,   229,-32768,-32768,-32768,   700,\r\n-32768,-32768,   702,-32768,-32768,-32768,   655,-32768,-32768,-32768,\r\n  2308,   675,  1606,  2308,   665,   660,   102,-32768,  1330,-32768,\r\n-32768,   679,   680,-32768,-32768,   364,   364,-32768,   666,  1942,\r\n  1942,-32768,-32768,-32768,   710,-32768,   712,-32768,-32768,-32768,\r\n  1695,-32768,   380,   380,-32768,-32768,-32768,   684,-32768,   629,\r\n  1606,-32768,   672,-32768,-32768,-32768,  1468,-32768,   511,   511,\r\n   197,   206,-32768,    20,   686,   687,   511,   511,-32768,    96,\r\n-32768,-32768,-32768,-32768,  1606,-32768,-32768,-32768,-32768,   718,\r\n   720,   674,-32768,-32768,-32768,-32768,   692,-32768,-32768,-32768,\r\n   364,   364,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   817,\r\n   818,-32768\r\n};\r\n\r\nstatic const short yypgoto[] = {   188,\r\n-32768,-32768,   -68,-32768,   381,-32768,-32768,   486,    31,   659,\r\n-32768,    23,-32768,   699,-32768,   -34,-32768,   662,   183,   -90,\r\n   432,-32768,   352,-32768,-32768,-32768,-32768,    25,  -308,-32768,\r\n-32768,  -215,-32768,-32768,    97,   149,-32768,   251,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,   452,   394,   408,\r\n   367,-32768,  -242,-32768,   448,  -138,   536,   138,   223,   523,\r\n   524,   538,   543,   547,-32768,-32768,   428,-32768,   484,  -607,\r\n  -603,  -529,  -495,  -323,-32768,    -8,-32768,-32768,-32768,  -572,\r\n  -484,   159,  -548,-32768,-32768,   235,   114,-32768,  -602,-32768,\r\n-32768,-32768,-32768,-32768,-32768,     4,-32768,     1,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,     6,\r\n-32768,-32768,-32768,-32768,-32768,-32768,   345,-32768,-32768,-32768,\r\n   156,    58,   160,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r\n    81,-32768,   760,    -2,-32768,-32768,-32768,   155,     0,   384,\r\n-32768,-32768,   874,-32768,-32768,   742,     3,  -214,  -113,-32768,\r\n   834,-32768,-32768,-32768,-32768,  -134,-32768,-32768,-32768,   563,\r\n  -207,  -206,  -203,-32768,  -566,-32768,-32768,  -416,   548,-32768,\r\n-32768,-32768,-32768,  -202,   134,-32768,-32768,   106,    95,    10,\r\n  -201,-32768,    70,    66,  -200,-32768,-32768,-32768,  -199,-32768,\r\n-32768,-32768,-32768,-32768,  -197,-32768,-32768,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   544,  -252,\r\n-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   552,\r\n-32768,-32768,-32768,-32768,     2,-32768,  -783,-32768,-32768,-32768,\r\n-32768,-32768,-32768,-32768,   453,-32768,-32768,-32768,   878,-32768,\r\n-32768,-32768,-32768,   773,-32768,-32768,-32768,-32768,   754,  -378,\r\n  -315,  -591,  -724\r\n};\r\n\r\n\r\n#define\tYYLAST\t\t2786\r\n\r\n\r\nstatic const short yytable[] = {    11,\r\n     9,   378,   109,   436,   633,   121,   428,   612,   691,   703,\r\n    48,   697,   122,   125,   242,    49,   320,   245,   651,   388,\r\n   389,   120,   101,   120,   300,   719,    53,  -298,   649,   854,\r\n   855,   359,    55,   372,   631,   312,   264,    52,   360,   361,\r\n   818,   696,   362,   363,   364,   365,   366,    29,   367,   335,\r\n     1,   724,   336,   120,   313,   717,   104,   685,   395,   301,\r\n   592,   120,   120,   109,  -547,   732,   456,   120,  -547,   685,\r\n   110,   228,   891,   892,   643,   565,   566,   692,    52,    97,\r\n   228,   630,   642,   228,   120,   -11,     7,    94,   101,   652,\r\n   592,   721,   738,   751,   756,   824,   825,   826,   427,   917,\r\n   819,   686,   655,   874,   875,   229,  -303,   320,   593,   733,\r\n  -304,   876,   740,   734,   689,   249,   844,  -547,   314,   338,\r\n   746,   339,   104,   779,   845,  -547,   340,   594,   302,   303,\r\n   101,   110,   155,   893,    48,   304,    28,   927,   928,   110,\r\n   263,   644,   250,   315,  -547,    97,   795,   305,   110,   475,\r\n   799,   110,   802,   145,   359,   771,   772,   377,   410,   411,\r\n   457,   360,   361,   122,   104,   362,   363,   364,   365,   366,\r\n   602,   367,   383,   605,   266,   392,   609,  -547,   119,   314,\r\n   383,   383,   429,   272,   273,   123,  -357,    97,    52,   625,\r\n   626,   627,   119,   119,   119,   252,   118,   262,   929,   119,\r\n   118,   314,   123,   -11,   315,   431,    29,   119,   119,   119,\r\n    51,   119,   119,   119,   119,   119,  -547,   119,    56,  -516,\r\n   101,   101,  -547,    57,    48,   859,   315,    58,   319,    49,\r\n   158,   159,   160,   161,  -547,    85,   883,   344,   697,  -547,\r\n   349,    74,    59,   358,   451,   297,   298,  -219,   228,   430,\r\n  -547,  -547,    88,  -222,   104,   104,    52,   164,  -488,  -547,\r\n   647,  -223,   804,   805,  -463,   101,   101,   744,    60,  -220,\r\n   810,   811,  -547,   748,  -219,   166,  -358,    97,    97,  -547,\r\n  -222,  -489,  -224,  -225,   119,   379,   381,    78,  -223,    76,\r\n    79,  -219,  -464,   568,  -547,    54,  -220,  -222,   169,   104,\r\n   104,  -396,   840,  -547,   101,  -223,   101,   274,   774,  -224,\r\n  -225,   918,   919,  -220,  -397,    83,   110,   110,  -547,   319,\r\n    84,  -399,    97,    97,   797,   871,  -224,  -225,    26,    26,\r\n   413,   414,   119,   375,   275,    86,  -502,    87,   104,   251,\r\n   104,   711,    27,   106,  -376,  -503,    52,   882,   349,    89,\r\n    90,   798,   872,    91,    77,   434,    78,   633,   712,    79,\r\n   257,    97,   616,    97,    80,   294,   358,   761,    81,   440,\r\n    26,   441,   107,   617,   295,   296,   434,    82,   279,   280,\r\n   281,   618,   607,   434,    83,   906,   334,   762,   763,    84,\r\n   306,   307,   727,    85,   108,   348,   101,   115,   357,   521,\r\n   114,   371,   390,   101,    86,  -309,    87,    26,   118,   920,\r\n    88,   295,   296,   101,   119,   785,   101,   123,    89,    90,\r\n   661,  -309,    91,   101,   132,    92,   133,   434,   120,   435,\r\n   104,   127,   278,   563,   454,    62,   119,   104,   465,   415,\r\n   416,   417,   418,   344,   118,   126,   466,   104,   119,   736,\r\n   104,   101,   101,    97,   119,   737,   520,   104,   522,   134,\r\n    97,   492,   119,   434,   467,   601,   101,    63,   145,   278,\r\n    97,   476,   125,    97,   278,   278,   483,   574,   572,   138,\r\n    97,   492,   585,   646,    26,   104,   104,   140,   575,   590,\r\n   146,   597,    64,    65,    66,    67,    68,    69,    70,   521,\r\n   104,   434,   768,   604,   769,   343,   149,   787,    97,    97,\r\n   343,   343,   793,   817,   827,   828,   586,   587,   434,   152,\r\n   901,   856,   857,    97,   862,   863,   231,   522,   419,   420,\r\n   523,   610,   251,   563,   240,   101,   924,   925,   258,   259,\r\n   260,   243,   267,   268,   269,   270,   271,   898,   899,   902,\r\n   902,   895,   896,   101,   101,   646,   520,   246,   522,   255,\r\n   256,   257,   278,   276,   272,   908,   909,   273,   277,   104,\r\n   299,   308,   521,   915,   916,   311,   317,   309,   101,   521,\r\n   101,   310,   524,   318,   342,   343,   656,   104,   104,   316,\r\n   373,   376,    97,   521,   391,   393,   394,   396,   404,   523,\r\n   641,   444,   432,   446,   442,   447,   563,   445,   449,   452,\r\n    97,    97,   104,   563,   104,   455,   468,   224,   657,   658,\r\n   469,   471,   472,   480,   481,   484,   482,   563,   567,   520,\r\n   523,   522,   573,   577,   576,    97,   520,    97,   522,   582,\r\n   588,   589,   591,   695,   608,   701,   611,   613,   614,   434,\r\n   520,   524,   615,   619,   620,   623,   628,   629,   265,   632,\r\n   406,   407,   408,   409,   409,   409,   637,   659,   409,   409,\r\n   409,   409,   409,   409,   409,   409,   409,   409,   409,   634,\r\n   635,   636,   524,   660,   525,   684,   687,   694,   690,   702,\r\n   704,   708,   808,   710,   722,   661,   685,   723,   725,   730,\r\n   377,   101,   101,   523,   731,   739,   741,   743,   101,   630,\r\n   523,   282,   283,   284,   285,   286,   287,   288,   289,   747,\r\n   290,   291,   749,   732,   750,   755,   809,   758,   759,   760,\r\n   775,   766,   224,   767,   374,   104,   104,   754,   652,   757,\r\n   382,   784,   104,   788,   789,   803,   789,   773,   292,   776,\r\n   781,   796,   751,   525,   806,   524,   406,   224,    97,    97,\r\n   110,   403,   524,   812,   813,    97,   782,   783,   814,   829,\r\n   815,   837,   836,   786,   841,   851,   405,   843,   820,   522,\r\n   860,   858,   522,   522,   525,   861,   864,   869,   830,   833,\r\n   522,   522,   870,   828,   827,   877,   426,   224,   881,   885,\r\n   528,   884,   889,   890,   894,   863,   862,   905,   907,   913,\r\n   914,   921,   922,   923,   521,   926,   931,   932,   564,   865,\r\n   867,   439,   522,   253,   720,   147,   254,   526,   728,   479,\r\n   421,   583,   422,   470,   412,   578,   101,   579,   580,   581,\r\n   887,   527,   474,   745,   693,   780,   880,   423,   563,   888,\r\n   886,   523,   521,   424,   523,   523,   624,   525,   425,   224,\r\n   459,   529,   523,   523,   525,   522,   853,   522,   764,   528,\r\n   104,   520,   765,   522,   137,   598,    25,   839,   227,    61,\r\n   478,   478,   794,   904,   433,   832,   563,   866,   910,   911,\r\n   443,   815,   868,    97,   523,   912,   526,   835,   569,    50,\r\n   528,   900,   450,   524,   156,   522,   524,   524,   248,   520,\r\n   527,   522,   453,     0,   524,   524,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,   526,     0,   522,\r\n   529,     0,     0,     0,     0,     0,     0,   523,     0,   523,\r\n     0,   527,     0,     0,     0,   523,   524,     0,   650,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,   529,     0,     0,     0,   584,     0,     0,     0,     0,\r\n     0,     0,     0,   528,     0,     0,     0,   523,     0,     0,\r\n   528,   662,     0,   523,     0,     0,     0,     0,     0,   524,\r\n     0,   524,     0,   621,     0,   621,     0,   524,     0,     0,\r\n   526,   523,     0,     0,     0,   525,     0,   526,   525,   525,\r\n     0,     0,     0,     0,   527,     0,   525,   525,     0,     0,\r\n     0,   527,   663,     0,     0,     0,     0,     0,     0,   524,\r\n     0,     0,     0,     0,   529,   524,     0,     0,     0,     0,\r\n     0,   529,     0,     0,     0,     0,     0,     0,   525,     0,\r\n   639,     0,     0,   524,     0,     0,     0,     0,   664,     0,\r\n   459,   665,   666,   667,   668,     0,     0,   669,   670,     0,\r\n   671,   672,     0,     0,     0,   673,   674,   675,   676,   677,\r\n   678,   679,   680,   681,   682,     0,     0,     0,     0,     0,\r\n     0,   525,     0,   525,     0,     0,     0,     0,     0,   525,\r\n   639,     0,   705,   707,     0,     0,   709,     0,     0,     0,\r\n     0,   716,   705,     0,     0,     0,     0,     0,     0,     0,\r\n     0,   528,     0,     0,   528,   528,     0,     0,     0,     0,\r\n   729,   525,   528,   528,     0,     0,     0,   525,     0,     0,\r\n     0,     0,     0,     0,   459,     0,     0,     0,   526,     0,\r\n     0,   526,   526,     0,     0,   525,     0,     0,     0,   526,\r\n   526,     0,   527,     0,   528,   527,   527,     0,     0,     0,\r\n     0,     0,     0,   527,   527,     0,     0,     0,     0,     0,\r\n     0,     0,   529,     0,     0,   529,   529,     0,     0,     0,\r\n     0,   526,     0,   529,   529,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,   527,     0,   528,     0,   528,\r\n     0,     0,     0,     0,   639,   528,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,   529,     0,     0,     0,     0,\r\n     0,     0,     0,   705,   526,     0,   526,   705,     0,     0,\r\n     0,     0,   526,     0,     0,     0,     0,   528,   527,     0,\r\n   527,     0,     0,   528,     0,    30,   527,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,   529,     0,\r\n   529,   528,     0,     0,   526,     0,   529,    31,     0,   838,\r\n   526,     0,     0,     0,     0,     0,   842,     0,   527,     0,\r\n    32,     0,     0,     0,   527,    34,     0,     0,   526,     0,\r\n    35,     0,    36,    37,    38,    39,     0,     0,   529,    40,\r\n     0,     0,   527,    41,   529,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,    42,     0,   639,    43,     0,\r\n    44,     0,   529,   498,   158,   159,   160,   161,     0,     0,\r\n   162,    77,   499,    78,   844,     0,    79,   500,     0,   501,\r\n   502,    80,   845,     0,   503,    81,     0,     0,     0,     0,\r\n     0,   164,     0,   504,    82,   505,   506,   507,   508,     0,\r\n     0,    83,     0,     0,     0,   509,    84,     0,   165,   166,\r\n    85,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n   510,    86,     0,    87,   167,     0,     0,    88,     0,   511,\r\n   168,   512,   169,   513,   170,    89,    90,   514,   515,    91,\r\n   516,     0,   143,     0,   517,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,   172,   173,     0,\r\n     0,   174,   175,     0,     0,   176,   177,   178,   179,   180,\r\n     0,     0,     0,     0,     0,     0,     0,     0,   434,     0,\r\n   518,   498,   158,   159,   160,   161,     0,     0,   162,    77,\r\n   499,    78,     0,     0,    79,   500,     0,   501,   502,    80,\r\n     0,     0,   503,    81,     0,     0,     0,     0,     0,   164,\r\n     0,   504,    82,   505,   506,   507,   508,     0,     0,    83,\r\n     0,     0,     0,   509,    84,     0,   165,   166,    85,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,   510,    86,\r\n     0,    87,   167,     0,     0,    88,     0,   511,   168,   512,\r\n   169,   513,   170,    89,    90,   514,   515,    91,   516,     0,\r\n   143,     0,   517,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,   172,   173,     0,     0,   174,\r\n   175,     0,     0,   176,   177,   178,   179,   180,     0,     0,\r\n     0,     0,     0,     0,     0,     0,   434,     0,   518,    52,\r\n   158,   159,   160,   161,     0,     0,   162,    77,   499,    78,\r\n     0,     0,    79,   500,     0,     0,   502,    80,     0,     0,\r\n   503,    81,     0,     0,     0,     0,     0,   164,     0,   504,\r\n    82,   505,   506,   507,   508,     0,     0,    83,     0,     0,\r\n     0,   509,    84,     0,   165,   166,    85,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,   510,    86,     0,    87,\r\n   167,     0,     0,    88,     0,   511,   168,   512,   169,   513,\r\n   170,    89,    90,   514,   515,    91,   516,     0,     0,     0,\r\n   517,     0,     0,     0,     0,     0,     0,     0,    52,     0,\r\n     0,     0,     0,     0,     0,     0,    77,     0,    78,     0,\r\n     0,    79,     0,     0,     0,     0,    80,     0,     0,     0,\r\n    81,     0,     0,   172,   173,     0,     0,   174,   175,    82,\r\n     0,   176,   177,   178,   179,   180,    83,     0,     0,     0,\r\n     0,    84,     0,     0,   434,    85,   518,    52,   158,   159,\r\n   160,   161,     0,     0,   162,    77,    86,    78,    87,     0,\r\n    79,   163,    88,     0,     0,    80,     0,     0,     0,    81,\r\n    89,    90,     0,     0,    91,   164,     0,   143,    82,     0,\r\n     0,     0,     0,     0,     0,    83,     0,     0,     0,     0,\r\n    84,     0,   165,   166,    85,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,    86,     0,    87,   167,   458,\r\n     0,    88,     0,     0,   168,     0,   169,     0,   170,    89,\r\n    90,   171,     0,    91,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,    52,   158,   159,   160,\r\n   161,     0,     0,   162,    77,     0,    78,     0,     0,    79,\r\n   163,   172,   173,     0,    80,   174,   175,     0,    81,   176,\r\n   177,   178,   179,   180,   164,     0,     0,    82,     0,     0,\r\n     0,     0,   377,   648,    83,     0,     0,     0,     0,    84,\r\n     0,   165,   166,    85,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,    86,     0,    87,   167,   458,     0,\r\n    88,     0,     0,   168,     0,   169,     0,   170,    89,    90,\r\n   171,     0,    91,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,    52,   158,   159,   160,   161,\r\n     0,     0,   162,    77,     0,    78,     0,     0,    79,   163,\r\n   172,   173,     0,    80,   174,   175,     0,    81,   176,   177,\r\n   178,   179,   180,   164,     0,     0,    82,     0,     0,     0,\r\n     0,   377,     0,    83,     0,     0,     0,     0,    84,     0,\r\n   165,   166,    85,     0,   397,     0,     0,     0,     0,     0,\r\n     0,   398,     0,    86,     0,    87,   167,     0,     0,    88,\r\n     0,     0,   168,     0,   169,     0,   170,    89,    90,   171,\r\n     0,    91,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,    52,   158,   159,   160,   161,     0,\r\n     0,   162,    77,     0,    78,     0,     0,    79,   163,     0,\r\n     0,     0,    80,     0,     0,     0,    81,     0,     0,   172,\r\n   173,     0,   164,   174,   175,    82,     0,   176,   177,   178,\r\n   179,   180,    83,     0,     0,     0,     0,    84,     0,   165,\r\n   166,    85,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,    86,     0,    87,   167,     0,     0,    88,     0,\r\n     0,   168,     0,   169,     0,   170,    89,    90,   171,     0,\r\n    91,     0,     0,   261,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,    52,   158,   159,   160,   161,     0,     0,\r\n   162,    77,     0,    78,     0,     0,    79,   163,     0,     0,\r\n     0,    80,     0,     0,     0,    81,     0,     0,   172,   173,\r\n     0,   164,   174,   175,    82,     0,   176,   177,   178,   179,\r\n   180,    83,     0,     0,     0,     0,    84,     0,   165,   166,\r\n    85,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,    86,     0,    87,   167,     0,     0,    88,     0,     0,\r\n   168,     0,   169,     0,   170,    89,    90,   171,     0,    91,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,    52,   158,   159,   160,   161,     0,     0,   162,\r\n    77,     0,    78,     0,     0,    79,   163,   172,   173,     0,\r\n    80,   174,   175,   473,    81,   176,   177,   178,   179,   180,\r\n   164,     0,     0,    82,     0,     0,     0,     0,     0,     0,\r\n    83,     0,     0,     0,     0,    84,     0,   165,   166,    85,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n    86,     0,    87,   167,     0,     0,    88,     0,     0,   168,\r\n     0,   169,     0,   170,    89,    90,   171,     0,    91,     0,\r\n     0,   143,     0,     0,     0,     0,     0,     0,     0,     0,\r\n     0,    52,   158,   159,   160,   161,     0,     0,   162,    77,\r\n     0,    78,     0,     0,    79,   163,     0,     0,     0,    80,\r\n     0,     0,     0,    81,     0,     0,   172,   173,     0,   164,\r\n   174,   175,    82,     0,   176,   177,   178,   179,   180,    83,\r\n     0,     0,     0,     0,    84,     0,   165,   166,    85,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,    86,\r\n     0,    87,   167,     0,     0,    88,     0,     0,   168,     0,\r\n   169,     0,   170,    89,    90,   171,     0,    91,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n    52,   158,   159,   160,   161,     0,     0,   162,    77,     0,\r\n    78,     0,     0,    79,   163,     0,     0,     0,    80,     0,\r\n     0,     0,    81,     0,     0,   172,   173,     0,   164,   174,\r\n   175,    82,     0,   176,   177,   178,   179,   180,    83,     0,\r\n     0,     0,     0,    84,     0,   165,   166,    85,     0,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,    86,     0,\r\n    87,   167,     0,     0,    88,     0,     0,   168,     0,   169,\r\n   485,   170,    89,    90,   171,     0,    91,     0,    77,     0,\r\n    78,     0,     0,    79,     0,    56,   486,     0,    80,     0,\r\n    57,     0,    81,     0,    58,   487,   488,     0,     0,     0,\r\n     0,    82,     0,     0,     0,     0,   489,  -297,    83,    59,\r\n     0,     0,     0,    84,     0,     0,    30,    85,     0,   175,\r\n     0,     0,     0,   177,   178,     0,     0,     0,    86,     0,\r\n    87,     0,     0,     0,    88,    60,     0,     0,    31,     0,\r\n     0,     0,    89,    90,     0,     0,    91,     0,     0,   490,\r\n     0,    32,     0,     0,     0,    33,    34,     0,     0,     0,\r\n     0,    35,     0,    36,    37,    38,    39,     0,     0,     0,\r\n    40,     0,     0,     0,    41,     0,     0,   485,     0,     0,\r\n     0,     0,     0,     0,     0,    77,    42,    78,     0,    43,\r\n    79,    44,    56,   486,   491,    80,     0,    57,     0,    81,\r\n     0,    58,   487,   488,     0,     0,     0,     0,    82,     0,\r\n     0,     0,     0,   489,     0,    83,    59,     0,     0,     0,\r\n    84,    52,     0,     0,    85,     0,     0,     0,     0,    77,\r\n     0,    78,     0,     0,    79,    86,     0,    87,     0,    80,\r\n     0,    88,    60,    81,     0,     0,   570,     0,     0,    89,\r\n    90,     0,    82,    91,     0,     0,   490,     0,     0,    83,\r\n     0,     0,     0,     0,    84,    52,     0,     0,    85,     0,\r\n     0,     0,     0,    77,     0,    78,     0,     0,    79,    86,\r\n     0,    87,     0,    80,     0,    88,     0,    81,     0,     0,\r\n     0,     0,     0,    89,    90,     0,    82,    91,     0,     0,\r\n   571,     0,     0,    83,     0,     0,     0,     0,    84,     0,\r\n    30,     0,    85,     0,     0,     0,     0,     0,     0,     0,\r\n     0,     0,     0,    86,     0,    87,     0,     0,     0,    88,\r\n     0,     0,    31,     0,     0,     0,     0,    89,    90,     0,\r\n     0,    91,     0,     0,   380,    32,     0,     0,     0,    33,\r\n    34,     0,     0,     0,     0,    35,     0,    36,    37,    38,\r\n    39,     0,     0,     0,    40,     0,     0,     0,    41,     0,\r\n     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r\n    42,     0,     0,    43,     0,    44\r\n};\r\n\r\nstatic const short yycheck[] = {     2,\r\n     1,   254,    71,   327,   534,    96,   315,   503,   600,   617,\r\n    13,   614,   103,   104,   149,    13,   231,   152,   585,   262,\r\n   263,     3,    57,     3,    10,   629,    27,     0,   577,   813,\r\n   814,   246,    33,   249,   519,   117,   175,     4,   246,   246,\r\n    11,   614,   246,   246,   246,   246,   246,     4,   246,    97,\r\n    81,   643,   100,     3,   136,   628,    57,    97,   274,    45,\r\n     4,     3,     3,   132,    98,    97,   375,     3,    98,    97,\r\n    71,   140,   856,   857,     4,     4,     4,   607,     4,    57,\r\n   149,     4,     4,   152,     3,     4,     4,    57,   123,     4,\r\n     4,     4,   659,     4,     4,     4,     4,     4,   314,     4,\r\n    71,   141,   587,   828,   829,   140,   140,   322,    52,   141,\r\n   140,   836,   661,   141,    71,    98,    15,    98,    98,    53,\r\n   687,    55,   123,   731,    23,    98,    60,    71,   114,   115,\r\n   165,   132,    99,   858,   137,   121,   141,   921,   922,   140,\r\n   175,    71,   125,   123,    98,   123,   750,   133,   149,   392,\r\n   754,   152,   755,   123,   369,   722,   723,   139,   297,   298,\r\n   376,   369,   369,   254,   165,   369,   369,   369,   369,   369,\r\n   494,   369,   122,   497,   175,   266,   500,    98,   122,    98,\r\n   122,   122,   317,   125,   125,   121,   140,   165,     4,   513,\r\n   514,   515,   122,   122,   122,   165,   122,   175,   923,   122,\r\n   122,    98,   121,   122,   123,   319,     4,   122,   122,   122,\r\n    98,   122,   122,   122,   122,   122,    98,   122,    19,   140,\r\n   255,   256,    98,    24,   227,   817,   123,    28,   231,   227,\r\n     5,     6,     7,     8,    98,    51,   844,   240,   841,    98,\r\n   243,   141,    43,   246,   358,   129,   130,    97,   317,   318,\r\n    98,    98,    68,    97,   255,   256,     4,    32,   140,    98,\r\n    98,    97,   758,   759,   140,   300,   301,   684,    69,    97,\r\n   766,   767,    98,   690,   124,    50,   140,   255,   256,    98,\r\n   124,   140,    97,    97,   122,   255,   256,    14,   124,     4,\r\n    17,   141,   140,   140,    98,   125,   124,   141,    73,   300,\r\n   301,   140,   798,    98,   339,   141,   341,    98,   725,   124,\r\n   124,   903,   904,   141,   140,    42,   317,   318,    98,   322,\r\n    47,   140,   300,   301,    97,    97,   141,   141,   125,   125,\r\n   300,   301,   122,   123,   125,    62,   140,    64,   339,   123,\r\n   341,    16,   138,     4,   124,   140,     4,   843,   351,    76,\r\n    77,   124,   124,    80,    12,   139,    14,   887,    33,    17,\r\n   123,   339,     4,   341,    22,   122,   369,   123,    26,   339,\r\n   125,   341,     4,    15,   131,   132,   139,    35,   118,   119,\r\n   120,    23,   137,   139,    42,   881,   232,   711,   712,    47,\r\n   112,   113,   645,    51,     4,   241,   431,   139,   244,   434,\r\n   137,   247,   122,   438,    62,   123,    64,   125,   122,   905,\r\n    68,   131,   132,   448,   122,   739,   451,   121,    76,    77,\r\n   138,   139,    80,   458,    97,    83,    99,   139,     3,   141,\r\n   431,   137,    97,   434,    99,    29,   122,   438,   124,   302,\r\n   303,   304,   305,   446,   122,     4,   124,   448,   122,   123,\r\n   451,   486,   487,   431,   122,   123,   434,   458,   434,   123,\r\n   438,   431,   122,   139,   124,   141,   501,    61,   438,    97,\r\n   448,    99,   563,   451,    97,    97,    99,    99,   448,   141,\r\n   458,   451,   123,   574,   125,   486,   487,   137,   458,   490,\r\n   123,   492,    86,    87,    88,    89,    90,    91,    92,   534,\r\n   501,   139,   139,   141,   141,    97,   137,    99,   486,   487,\r\n    97,    97,    99,    99,    93,    94,   486,   487,   139,   137,\r\n   141,    93,    94,   501,    95,    96,   139,   503,   306,   307,\r\n   434,   501,   123,   534,   139,   570,   915,   916,   172,   173,\r\n   174,   139,   176,   177,   178,   179,   180,   863,   864,   873,\r\n   874,   860,   861,   588,   589,   646,   534,   139,   534,   123,\r\n   123,   123,    97,   123,   125,   889,   890,   125,   124,   570,\r\n   109,   126,   607,   897,   898,   116,    97,   134,   613,   614,\r\n   615,   135,   434,    97,   124,    97,   587,   588,   589,   140,\r\n     4,    98,   570,   628,   124,     4,     4,     4,     4,   503,\r\n   570,     4,   140,    97,   141,    49,   607,   140,   140,   140,\r\n   588,   589,   613,   614,   615,   124,   124,   134,   588,   589,\r\n   124,   124,   124,    97,   124,   124,   137,   628,   138,   607,\r\n   534,   607,   124,    97,   140,   613,   614,   615,   614,   124,\r\n    52,    52,     4,   613,   141,   615,   141,   123,   123,   139,\r\n   628,   503,   123,   123,   123,   123,   123,   123,   175,   140,\r\n   294,   295,   296,   297,   298,   299,   138,   123,   302,   303,\r\n   304,   305,   306,   307,   308,   309,   310,   311,   312,   141,\r\n   141,   141,   534,   123,   434,    98,   123,    85,    98,   141,\r\n   141,   141,   761,   141,   123,   138,    97,   123,    98,   124,\r\n   139,   736,   737,   607,   138,   124,   100,   123,   743,     4,\r\n   614,   101,   102,   103,   104,   105,   106,   107,   108,   139,\r\n   110,   111,   139,    97,   123,    97,   761,   124,   124,   124,\r\n    99,   124,   249,   124,   251,   736,   737,   141,     4,   141,\r\n   257,   124,   743,   124,   747,    41,   749,   139,   138,   137,\r\n   139,   138,     4,   503,   139,   607,   390,   274,   736,   737,\r\n   761,   278,   614,   140,   124,   743,   736,   737,   124,   140,\r\n   773,   124,   140,   743,   141,     4,   293,    27,   781,   755,\r\n   123,   140,   758,   759,   534,   123,   140,   124,   791,   792,\r\n   766,   767,   124,    94,    93,   141,   313,   314,   124,   140,\r\n   434,   137,   124,   124,   139,    96,    95,   124,   137,   124,\r\n   124,    94,    93,   140,   849,   124,     0,     0,   438,   822,\r\n   823,   336,   798,   165,   637,   127,   165,   434,   646,   398,\r\n   308,   480,   309,   386,   299,   469,   871,   471,   472,   473,\r\n   849,   434,   391,   685,   610,   732,   841,   310,   849,   849,\r\n   847,   755,   887,   311,   758,   759,   512,   607,   312,   376,\r\n   377,   434,   766,   767,   614,   841,   809,   843,   713,   503,\r\n   871,   849,   713,   849,   115,   492,     3,   797,   137,    46,\r\n   397,   398,   749,   874,   322,   791,   887,   822,   891,   892,\r\n   343,   894,   823,   871,   798,   894,   503,   792,   446,    22,\r\n   534,   871,   351,   755,   132,   881,   758,   759,   155,   887,\r\n   503,   887,   369,    -1,   766,   767,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,   534,    -1,   905,\r\n   503,    -1,    -1,    -1,    -1,    -1,    -1,   841,    -1,   843,\r\n    -1,   534,    -1,    -1,    -1,   849,   798,    -1,   582,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,   534,    -1,    -1,    -1,   482,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,   607,    -1,    -1,    -1,   881,    -1,    -1,\r\n   614,    32,    -1,   887,    -1,    -1,    -1,    -1,    -1,   841,\r\n    -1,   843,    -1,   510,    -1,   512,    -1,   849,    -1,    -1,\r\n   607,   905,    -1,    -1,    -1,   755,    -1,   614,   758,   759,\r\n    -1,    -1,    -1,    -1,   607,    -1,   766,   767,    -1,    -1,\r\n    -1,   614,    73,    -1,    -1,    -1,    -1,    -1,    -1,   881,\r\n    -1,    -1,    -1,    -1,   607,   887,    -1,    -1,    -1,    -1,\r\n    -1,   614,    -1,    -1,    -1,    -1,    -1,    -1,   798,    -1,\r\n   567,    -1,    -1,   905,    -1,    -1,    -1,    -1,   109,    -1,\r\n   577,   112,   113,   114,   115,    -1,    -1,   118,   119,    -1,\r\n   121,   122,    -1,    -1,    -1,   126,   127,   128,   129,   130,\r\n   131,   132,   133,   134,   135,    -1,    -1,    -1,    -1,    -1,\r\n    -1,   841,    -1,   843,    -1,    -1,    -1,    -1,    -1,   849,\r\n   617,    -1,   619,   620,    -1,    -1,   623,    -1,    -1,    -1,\r\n    -1,   628,   629,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,   755,    -1,    -1,   758,   759,    -1,    -1,    -1,    -1,\r\n   647,   881,   766,   767,    -1,    -1,    -1,   887,    -1,    -1,\r\n    -1,    -1,    -1,    -1,   661,    -1,    -1,    -1,   755,    -1,\r\n    -1,   758,   759,    -1,    -1,   905,    -1,    -1,    -1,   766,\r\n   767,    -1,   755,    -1,   798,   758,   759,    -1,    -1,    -1,\r\n    -1,    -1,    -1,   766,   767,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,   755,    -1,    -1,   758,   759,    -1,    -1,    -1,\r\n    -1,   798,    -1,   766,   767,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,   798,    -1,   841,    -1,   843,\r\n    -1,    -1,    -1,    -1,   731,   849,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,   798,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,   750,   841,    -1,   843,   754,    -1,    -1,\r\n    -1,    -1,   849,    -1,    -1,    -1,    -1,   881,   841,    -1,\r\n   843,    -1,    -1,   887,    -1,     9,   849,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   841,    -1,\r\n   843,   905,    -1,    -1,   881,    -1,   849,    31,    -1,   796,\r\n   887,    -1,    -1,    -1,    -1,    -1,   803,    -1,   881,    -1,\r\n    44,    -1,    -1,    -1,   887,    49,    -1,    -1,   905,    -1,\r\n    54,    -1,    56,    57,    58,    59,    -1,    -1,   881,    63,\r\n    -1,    -1,   905,    67,   887,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    79,    -1,   844,    82,    -1,\r\n    84,    -1,   905,     4,     5,     6,     7,     8,    -1,    -1,\r\n    11,    12,    13,    14,    15,    -1,    17,    18,    -1,    20,\r\n    21,    22,    23,    -1,    25,    26,    -1,    -1,    -1,    -1,\r\n    -1,    32,    -1,    34,    35,    36,    37,    38,    39,    -1,\r\n    -1,    42,    -1,    -1,    -1,    46,    47,    -1,    49,    50,\r\n    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    61,    62,    -1,    64,    65,    -1,    -1,    68,    -1,    70,\r\n    71,    72,    73,    74,    75,    76,    77,    78,    79,    80,\r\n    81,    -1,    83,    -1,    85,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,   118,   119,    -1,\r\n    -1,   122,   123,    -1,    -1,   126,   127,   128,   129,   130,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   139,    -1,\r\n   141,     4,     5,     6,     7,     8,    -1,    -1,    11,    12,\r\n    13,    14,    -1,    -1,    17,    18,    -1,    20,    21,    22,\r\n    -1,    -1,    25,    26,    -1,    -1,    -1,    -1,    -1,    32,\r\n    -1,    34,    35,    36,    37,    38,    39,    -1,    -1,    42,\r\n    -1,    -1,    -1,    46,    47,    -1,    49,    50,    51,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    61,    62,\r\n    -1,    64,    65,    -1,    -1,    68,    -1,    70,    71,    72,\r\n    73,    74,    75,    76,    77,    78,    79,    80,    81,    -1,\r\n    83,    -1,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,   118,   119,    -1,    -1,   122,\r\n   123,    -1,    -1,   126,   127,   128,   129,   130,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,   139,    -1,   141,     4,\r\n     5,     6,     7,     8,    -1,    -1,    11,    12,    13,    14,\r\n    -1,    -1,    17,    18,    -1,    -1,    21,    22,    -1,    -1,\r\n    25,    26,    -1,    -1,    -1,    -1,    -1,    32,    -1,    34,\r\n    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,    -1,\r\n    -1,    46,    47,    -1,    49,    50,    51,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    61,    62,    -1,    64,\r\n    65,    -1,    -1,    68,    -1,    70,    71,    72,    73,    74,\r\n    75,    76,    77,    78,    79,    80,    81,    -1,    -1,    -1,\r\n    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     4,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    12,    -1,    14,    -1,\r\n    -1,    17,    -1,    -1,    -1,    -1,    22,    -1,    -1,    -1,\r\n    26,    -1,    -1,   118,   119,    -1,    -1,   122,   123,    35,\r\n    -1,   126,   127,   128,   129,   130,    42,    -1,    -1,    -1,\r\n    -1,    47,    -1,    -1,   139,    51,   141,     4,     5,     6,\r\n     7,     8,    -1,    -1,    11,    12,    62,    14,    64,    -1,\r\n    17,    18,    68,    -1,    -1,    22,    -1,    -1,    -1,    26,\r\n    76,    77,    -1,    -1,    80,    32,    -1,    83,    35,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    42,    -1,    -1,    -1,    -1,\r\n    47,    -1,    49,    50,    51,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    62,    -1,    64,    65,    66,\r\n    -1,    68,    -1,    -1,    71,    -1,    73,    -1,    75,    76,\r\n    77,    78,    -1,    80,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,     4,     5,     6,     7,\r\n     8,    -1,    -1,    11,    12,    -1,    14,    -1,    -1,    17,\r\n    18,   118,   119,    -1,    22,   122,   123,    -1,    26,   126,\r\n   127,   128,   129,   130,    32,    -1,    -1,    35,    -1,    -1,\r\n    -1,    -1,   139,   140,    42,    -1,    -1,    -1,    -1,    47,\r\n    -1,    49,    50,    51,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    62,    -1,    64,    65,    66,    -1,\r\n    68,    -1,    -1,    71,    -1,    73,    -1,    75,    76,    77,\r\n    78,    -1,    80,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,     4,     5,     6,     7,     8,\r\n    -1,    -1,    11,    12,    -1,    14,    -1,    -1,    17,    18,\r\n   118,   119,    -1,    22,   122,   123,    -1,    26,   126,   127,\r\n   128,   129,   130,    32,    -1,    -1,    35,    -1,    -1,    -1,\r\n    -1,   139,    -1,    42,    -1,    -1,    -1,    -1,    47,    -1,\r\n    49,    50,    51,    -1,    53,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    60,    -1,    62,    -1,    64,    65,    -1,    -1,    68,\r\n    -1,    -1,    71,    -1,    73,    -1,    75,    76,    77,    78,\r\n    -1,    80,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,     4,     5,     6,     7,     8,    -1,\r\n    -1,    11,    12,    -1,    14,    -1,    -1,    17,    18,    -1,\r\n    -1,    -1,    22,    -1,    -1,    -1,    26,    -1,    -1,   118,\r\n   119,    -1,    32,   122,   123,    35,    -1,   126,   127,   128,\r\n   129,   130,    42,    -1,    -1,    -1,    -1,    47,    -1,    49,\r\n    50,    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    62,    -1,    64,    65,    -1,    -1,    68,    -1,\r\n    -1,    71,    -1,    73,    -1,    75,    76,    77,    78,    -1,\r\n    80,    -1,    -1,    83,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,     4,     5,     6,     7,     8,    -1,    -1,\r\n    11,    12,    -1,    14,    -1,    -1,    17,    18,    -1,    -1,\r\n    -1,    22,    -1,    -1,    -1,    26,    -1,    -1,   118,   119,\r\n    -1,    32,   122,   123,    35,    -1,   126,   127,   128,   129,\r\n   130,    42,    -1,    -1,    -1,    -1,    47,    -1,    49,    50,\r\n    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    62,    -1,    64,    65,    -1,    -1,    68,    -1,    -1,\r\n    71,    -1,    73,    -1,    75,    76,    77,    78,    -1,    80,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,     4,     5,     6,     7,     8,    -1,    -1,    11,\r\n    12,    -1,    14,    -1,    -1,    17,    18,   118,   119,    -1,\r\n    22,   122,   123,   124,    26,   126,   127,   128,   129,   130,\r\n    32,    -1,    -1,    35,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    42,    -1,    -1,    -1,    -1,    47,    -1,    49,    50,    51,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    62,    -1,    64,    65,    -1,    -1,    68,    -1,    -1,    71,\r\n    -1,    73,    -1,    75,    76,    77,    78,    -1,    80,    -1,\r\n    -1,    83,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,     4,     5,     6,     7,     8,    -1,    -1,    11,    12,\r\n    -1,    14,    -1,    -1,    17,    18,    -1,    -1,    -1,    22,\r\n    -1,    -1,    -1,    26,    -1,    -1,   118,   119,    -1,    32,\r\n   122,   123,    35,    -1,   126,   127,   128,   129,   130,    42,\r\n    -1,    -1,    -1,    -1,    47,    -1,    49,    50,    51,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    62,\r\n    -1,    64,    65,    -1,    -1,    68,    -1,    -1,    71,    -1,\r\n    73,    -1,    75,    76,    77,    78,    -1,    80,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n     4,     5,     6,     7,     8,    -1,    -1,    11,    12,    -1,\r\n    14,    -1,    -1,    17,    18,    -1,    -1,    -1,    22,    -1,\r\n    -1,    -1,    26,    -1,    -1,   118,   119,    -1,    32,   122,\r\n   123,    35,    -1,   126,   127,   128,   129,   130,    42,    -1,\r\n    -1,    -1,    -1,    47,    -1,    49,    50,    51,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    62,    -1,\r\n    64,    65,    -1,    -1,    68,    -1,    -1,    71,    -1,    73,\r\n     4,    75,    76,    77,    78,    -1,    80,    -1,    12,    -1,\r\n    14,    -1,    -1,    17,    -1,    19,    20,    -1,    22,    -1,\r\n    24,    -1,    26,    -1,    28,    29,    30,    -1,    -1,    -1,\r\n    -1,    35,    -1,    -1,    -1,    -1,    40,     0,    42,    43,\r\n    -1,    -1,    -1,    47,    -1,    -1,     9,    51,    -1,   123,\r\n    -1,    -1,    -1,   127,   128,    -1,    -1,    -1,    62,    -1,\r\n    64,    -1,    -1,    -1,    68,    69,    -1,    -1,    31,    -1,\r\n    -1,    -1,    76,    77,    -1,    -1,    80,    -1,    -1,    83,\r\n    -1,    44,    -1,    -1,    -1,    48,    49,    -1,    -1,    -1,\r\n    -1,    54,    -1,    56,    57,    58,    59,    -1,    -1,    -1,\r\n    63,    -1,    -1,    -1,    67,    -1,    -1,     4,    -1,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    12,    79,    14,    -1,    82,\r\n    17,    84,    19,    20,   128,    22,    -1,    24,    -1,    26,\r\n    -1,    28,    29,    30,    -1,    -1,    -1,    -1,    35,    -1,\r\n    -1,    -1,    -1,    40,    -1,    42,    43,    -1,    -1,    -1,\r\n    47,     4,    -1,    -1,    51,    -1,    -1,    -1,    -1,    12,\r\n    -1,    14,    -1,    -1,    17,    62,    -1,    64,    -1,    22,\r\n    -1,    68,    69,    26,    -1,    -1,    29,    -1,    -1,    76,\r\n    77,    -1,    35,    80,    -1,    -1,    83,    -1,    -1,    42,\r\n    -1,    -1,    -1,    -1,    47,     4,    -1,    -1,    51,    -1,\r\n    -1,    -1,    -1,    12,    -1,    14,    -1,    -1,    17,    62,\r\n    -1,    64,    -1,    22,    -1,    68,    -1,    26,    -1,    -1,\r\n    -1,    -1,    -1,    76,    77,    -1,    35,    80,    -1,    -1,\r\n    83,    -1,    -1,    42,    -1,    -1,    -1,    -1,    47,    -1,\r\n     9,    -1,    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    -1,    -1,    -1,    62,    -1,    64,    -1,    -1,    -1,    68,\r\n    -1,    -1,    31,    -1,    -1,    -1,    -1,    76,    77,    -1,\r\n    -1,    80,    -1,    -1,    83,    44,    -1,    -1,    -1,    48,\r\n    49,    -1,    -1,    -1,    -1,    54,    -1,    56,    57,    58,\r\n    59,    -1,    -1,    -1,    63,    -1,    -1,    -1,    67,    -1,\r\n    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r\n    79,    -1,    -1,    82,    -1,    84\r\n};\r\n/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */\r\n#line 3 \"bison.simple\"\r\n\r\n/* Skeleton output parser for bison,\r\n   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.\r\n\r\n   This program is free software; you can redistribute it and/or modify\r\n   it under the terms of the GNU General Public License as published by\r\n   the Free Software Foundation; either version 2, or (at your option)\r\n   any later version.\r\n\r\n   This program is distributed in the hope that it will be useful,\r\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n   GNU General Public License for more details.\r\n\r\n   You should have received a copy of the GNU General Public License\r\n   along with this program; if not, write to the Free Software\r\n   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */\r\n\r\n/* As a special exception, when this file is copied by Bison into a\r\n   Bison output file, you may use that output file without restriction.\r\n   This special exception was added by the Free Software Foundation\r\n   in version 1.24 of Bison.  */\r\n\r\n#ifndef alloca\r\n#ifdef __GNUC__\r\n#define alloca __builtin_alloca\r\n#else /* not GNU C.  */\r\n#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)\r\n#include <alloca.h>\r\n#else /* not sparc */\r\n#if defined (MSDOS) && !defined (__TURBOC__)\r\n#include <malloc.h>\r\n#else /* not MSDOS, or __TURBOC__ */\r\n#if defined(_AIX)\r\n#include <malloc.h>\r\n #pragma alloca\r\n#else /* not MSDOS, __TURBOC__, or _AIX */\r\n#ifdef __hpux\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\nvoid *alloca (unsigned int);\r\n};\r\n#else /* not __cplusplus */\r\nvoid *alloca ();\r\n#endif /* not __cplusplus */\r\n#endif /* __hpux */\r\n#endif /* not _AIX */\r\n#endif /* not MSDOS, or __TURBOC__ */\r\n#endif /* not sparc.  */\r\n#endif /* not GNU C.  */\r\n#endif /* alloca not defined.  */\r\n\r\n/* This is the parser code that is written into each bison parser\r\n  when the %semantic_parser declaration is not specified in the grammar.\r\n  It was written by Richard Stallman by simplifying the hairy parser\r\n  used when %semantic_parser is specified.  */\r\n\r\n/* Note: there must be only one dollar sign in this file.\r\n   It is replaced by the list of actions, each action\r\n   as one case of the switch.  */\r\n\r\n#define yyerrok\t\t(yyerrstatus = 0)\r\n#define yyclearin\t(yychar = YYEMPTY)\r\n#define YYEMPTY\t\t-2\r\n#define YYEOF\t\t0\r\n#define YYACCEPT\treturn(0)\r\n#define YYABORT \treturn(1)\r\n#define YYERROR\t\tgoto yyerrlab1\r\n/* Like YYERROR except do call yyerror.\r\n   This remains here temporarily to ease the\r\n   transition to the new meaning of YYERROR, for GCC.\r\n   Once GCC version 2 has supplanted version 1, this can go.  */\r\n#define YYFAIL\t\tgoto yyerrlab\r\n#define YYRECOVERING()  (!!yyerrstatus)\r\n#define YYBACKUP(token, value) \\\r\ndo\t\t\t\t\t\t\t\t\\\r\n  if (yychar == YYEMPTY && yylen == 1)\t\t\t\t\\\r\n    { yychar = (token), yylval = (value);\t\t\t\\\r\n      yychar1 = YYTRANSLATE (yychar);\t\t\t\t\\\r\n      YYPOPSTACK;\t\t\t\t\t\t\\\r\n      goto yybackup;\t\t\t\t\t\t\\\r\n    }\t\t\t\t\t\t\t\t\\\r\n  else\t\t\t\t\t\t\t\t\\\r\n    { yyerror (\"syntax error: cannot back up\"); YYERROR; }\t\\\r\nwhile (0)\r\n\r\n#define YYTERROR\t1\r\n#define YYERRCODE\t256\r\n\r\n#ifndef YYPURE\r\n#define YYLEX\t\tyylex()\r\n#endif\r\n\r\n#ifdef YYPURE\r\n#ifdef YYLSP_NEEDED\r\n#ifdef YYLEX_PARAM\r\n#define YYLEX\t\tyylex(&yylval, &yylloc, YYLEX_PARAM)\r\n#else\r\n#define YYLEX\t\tyylex(&yylval, &yylloc)\r\n#endif\r\n#else /* not YYLSP_NEEDED */\r\n#ifdef YYLEX_PARAM\r\n#define YYLEX\t\tyylex(&yylval, YYLEX_PARAM)\r\n#else\r\n#define YYLEX\t\tyylex(&yylval)\r\n#endif\r\n#endif /* not YYLSP_NEEDED */\r\n#endif\r\n\r\n/* If nonreentrant, generate the variables here */\r\n\r\n#ifndef YYPURE\r\n\r\nint\tyychar;\t\t\t/*  the lookahead symbol\t\t*/\r\nYYSTYPE\tyylval;\t\t\t/*  the semantic value of the\t\t*/\r\n\t\t\t\t/*  lookahead symbol\t\t\t*/\r\n\r\n#ifdef YYLSP_NEEDED\r\nYYLTYPE yylloc;\t\t\t/*  location data for the lookahead\t*/\r\n\t\t\t\t/*  symbol\t\t\t\t*/\r\n#endif\r\n\r\nint yynerrs;\t\t\t/*  number of parse errors so far       */\r\n#endif  /* not YYPURE */\r\n\r\n#if YYDEBUG != 0\r\nint yydebug;\t\t\t/*  nonzero means print parse trace\t*/\r\n/* Since this is uninitialized, it does not stop multiple parsers\r\n   from coexisting.  */\r\n#endif\r\n\r\n/*  YYINITDEPTH indicates the initial size of the parser's stacks\t*/\r\n\r\n#ifndef\tYYINITDEPTH\r\n#define YYINITDEPTH 200\r\n#endif\r\n\r\n/*  YYMAXDEPTH is the maximum size the stacks can grow to\r\n    (effective only if the built-in stack extension method is used).  */\r\n\r\n#if YYMAXDEPTH == 0\r\n#undef YYMAXDEPTH\r\n#endif\r\n\r\n#ifndef YYMAXDEPTH\r\n#define YYMAXDEPTH 10000\r\n#endif\r\n\r\n/* Prevent warning if -Wstrict-prototypes.  */\r\n#ifdef __GNUC__\r\nint yyparse (void);\r\n#endif\r\n\f\r\n#if __GNUC__ > 1\t\t/* GNU C and GNU C++ define this.  */\r\n#define __yy_memcpy(FROM,TO,COUNT)\t__builtin_memcpy(TO,FROM,COUNT)\r\n#else\t\t\t\t/* not GNU C or C++ */\r\n#ifndef __cplusplus\r\n\r\n/* This is the most reliable way to avoid incompatibilities\r\n   in available built-in functions on various systems.  */\r\nstatic void\r\n__yy_memcpy (from, to, count)\r\n     char *from;\r\n     char *to;\r\n     int count;\r\n{\r\n  register char *f = from;\r\n  register char *t = to;\r\n  register int i = count;\r\n\r\n  while (i-- > 0)\r\n    *t++ = *f++;\r\n}\r\n\r\n#else /* __cplusplus */\r\n\r\n/* This is the most reliable way to avoid incompatibilities\r\n   in available built-in functions on various systems.  */\r\nstatic void\r\n__yy_memcpy (char *from, char *to, int count)\r\n{\r\n  register char *f = from;\r\n  register char *t = to;\r\n  register int i = count;\r\n\r\n  while (i-- > 0)\r\n    *t++ = *f++;\r\n}\r\n\r\n#endif\r\n#endif\r\n\f\r\n#line 192 \"bison.simple\"\r\n\r\n/* The user can define YYPARSE_PARAM as the name of an argument to be passed\r\n   into yyparse.  The argument should have type void *.\r\n   It should actually point to an object.\r\n   Grammar actions can access the variable by casting it\r\n   to the proper pointer type.  */\r\n\r\n#ifdef YYPARSE_PARAM\r\n#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;\r\n#else\r\n#define YYPARSE_PARAM\r\n#define YYPARSE_PARAM_DECL\r\n#endif\r\n\r\nint\r\nyyparse(YYPARSE_PARAM)\r\n     YYPARSE_PARAM_DECL\r\n{\r\n  register int yystate;\r\n  register int yyn;\r\n  register short *yyssp;\r\n  register YYSTYPE *yyvsp;\r\n  int yyerrstatus;\t/*  number of tokens to shift before error messages enabled */\r\n  int yychar1 = 0;\t\t/*  lookahead token as an internal (translated) token number */\r\n\r\n  short\tyyssa[YYINITDEPTH];\t/*  the state stack\t\t\t*/\r\n  YYSTYPE yyvsa[YYINITDEPTH];\t/*  the semantic value stack\t\t*/\r\n\r\n  short *yyss = yyssa;\t\t/*  refer to the stacks thru separate pointers */\r\n  YYSTYPE *yyvs = yyvsa;\t/*  to allow yyoverflow to reallocate them elsewhere */\r\n\r\n#ifdef YYLSP_NEEDED\r\n  YYLTYPE yylsa[YYINITDEPTH];\t/*  the location stack\t\t\t*/\r\n  YYLTYPE *yyls = yylsa;\r\n  YYLTYPE *yylsp;\r\n\r\n#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)\r\n#else\r\n#define YYPOPSTACK   (yyvsp--, yyssp--)\r\n#endif\r\n\r\n  int yystacksize = YYINITDEPTH;\r\n\r\n#ifdef YYPURE\r\n  int yychar;\r\n  YYSTYPE yylval;\r\n  int yynerrs;\r\n#ifdef YYLSP_NEEDED\r\n  YYLTYPE yylloc;\r\n#endif\r\n#endif\r\n\r\n  YYSTYPE yyval;\t\t/*  the variable used to return\t\t*/\r\n\t\t\t\t/*  semantic values from the action\t*/\r\n\t\t\t\t/*  routines\t\t\t\t*/\r\n\r\n  int yylen;\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Starting parse\\n\");\r\n#endif\r\n\r\n  yystate = 0;\r\n  yyerrstatus = 0;\r\n  yynerrs = 0;\r\n  yychar = YYEMPTY;\t\t/* Cause a token to be read.  */\r\n\r\n  /* Initialize stack pointers.\r\n     Waste one element of value and location stack\r\n     so that they stay on the same level as the state stack.\r\n     The wasted elements are never initialized.  */\r\n\r\n  yyssp = yyss - 1;\r\n  yyvsp = yyvs;\r\n#ifdef YYLSP_NEEDED\r\n  yylsp = yyls;\r\n#endif\r\n\r\n/* Push a new state, which is found in  yystate  .  */\r\n/* In all cases, when you get here, the value and location stacks\r\n   have just been pushed. so pushing a state here evens the stacks.  */\r\nyynewstate:\r\n\r\n  *++yyssp = yystate;\r\n\r\n  if (yyssp >= yyss + yystacksize - 1)\r\n    {\r\n      /* Give user a chance to reallocate the stack */\r\n      /* Use copies of these so that the &'s don't force the real ones into memory. */\r\n      YYSTYPE *yyvs1 = yyvs;\r\n      short *yyss1 = yyss;\r\n#ifdef YYLSP_NEEDED\r\n      YYLTYPE *yyls1 = yyls;\r\n#endif\r\n\r\n      /* Get the current used size of the three stacks, in elements.  */\r\n      int size = yyssp - yyss + 1;\r\n\r\n#ifdef yyoverflow\r\n      /* Each stack pointer address is followed by the size of\r\n\t the data in use in that stack, in bytes.  */\r\n#ifdef YYLSP_NEEDED\r\n      /* This used to be a conditional around just the two extra args,\r\n\t but that might be undefined if yyoverflow is a macro.  */\r\n      yyoverflow(\"parser stack overflow\",\r\n\t\t &yyss1, size * sizeof (*yyssp),\r\n\t\t &yyvs1, size * sizeof (*yyvsp),\r\n\t\t &yyls1, size * sizeof (*yylsp),\r\n\t\t &yystacksize);\r\n#else\r\n      yyoverflow(\"parser stack overflow\",\r\n\t\t &yyss1, size * sizeof (*yyssp),\r\n\t\t &yyvs1, size * sizeof (*yyvsp),\r\n\t\t &yystacksize);\r\n#endif\r\n\r\n      yyss = yyss1; yyvs = yyvs1;\r\n#ifdef YYLSP_NEEDED\r\n      yyls = yyls1;\r\n#endif\r\n#else /* no yyoverflow */\r\n      /* Extend the stack our own way.  */\r\n      if (yystacksize >= YYMAXDEPTH)\r\n\t{\r\n\t  yyerror(\"parser stack overflow\");\r\n\t  return 2;\r\n\t}\r\n      yystacksize *= 2;\r\n      if (yystacksize > YYMAXDEPTH)\r\n\tyystacksize = YYMAXDEPTH;\r\n      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));\r\n      __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));\r\n      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));\r\n      __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));\r\n#ifdef YYLSP_NEEDED\r\n      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));\r\n      __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));\r\n#endif\r\n#endif /* no yyoverflow */\r\n\r\n      yyssp = yyss + size - 1;\r\n      yyvsp = yyvs + size - 1;\r\n#ifdef YYLSP_NEEDED\r\n      yylsp = yyls + size - 1;\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Stack size increased to %d\\n\", yystacksize);\r\n#endif\r\n\r\n      if (yyssp >= yyss + yystacksize - 1)\r\n\tYYABORT;\r\n    }\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Entering state %d\\n\", yystate);\r\n#endif\r\n\r\n  goto yybackup;\r\n yybackup:\r\n\r\n/* Do appropriate processing given the current state.  */\r\n/* Read a lookahead token if we need one and don't already have one.  */\r\n/* yyresume: */\r\n\r\n  /* First try to decide what to do without reference to lookahead token.  */\r\n\r\n  yyn = yypact[yystate];\r\n  if (yyn == YYFLAG)\r\n    goto yydefault;\r\n\r\n  /* Not known => get a lookahead token if don't already have one.  */\r\n\r\n  /* yychar is either YYEMPTY or YYEOF\r\n     or a valid token in external form.  */\r\n\r\n  if (yychar == YYEMPTY)\r\n    {\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Reading a token: \");\r\n#endif\r\n      yychar = YYLEX;\r\n    }\r\n\r\n  /* Convert token to internal form (in yychar1) for indexing tables with */\r\n\r\n  if (yychar <= 0)\t\t/* This means end of input. */\r\n    {\r\n      yychar1 = 0;\r\n      yychar = YYEOF;\t\t/* Don't call YYLEX any more */\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Now at end of input.\\n\");\r\n#endif\r\n    }\r\n  else\r\n    {\r\n      yychar1 = YYTRANSLATE(yychar);\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\t{\r\n\t  fprintf (stderr, \"Next token is %d (%s\", yychar, yytname[yychar1]);\r\n\t  /* Give the individual parser a way to print the precise meaning\r\n\t     of a token, for further debugging info.  */\r\n#ifdef YYPRINT\r\n\t  YYPRINT (stderr, yychar, yylval);\r\n#endif\r\n\t  fprintf (stderr, \")\\n\");\r\n\t}\r\n#endif\r\n    }\r\n\r\n  yyn += yychar1;\r\n  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)\r\n    goto yydefault;\r\n\r\n  yyn = yytable[yyn];\r\n\r\n  /* yyn is what to do for this token type in this state.\r\n     Negative => reduce, -yyn is rule number.\r\n     Positive => shift, yyn is new state.\r\n       New state is final state => don't bother to shift,\r\n       just return success.\r\n     0, or most negative number => error.  */\r\n\r\n  if (yyn < 0)\r\n    {\r\n      if (yyn == YYFLAG)\r\n\tgoto yyerrlab;\r\n      yyn = -yyn;\r\n      goto yyreduce;\r\n    }\r\n  else if (yyn == 0)\r\n    goto yyerrlab;\r\n\r\n  if (yyn == YYFINAL)\r\n    YYACCEPT;\r\n\r\n  /* Shift the lookahead token.  */\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Shifting token %d (%s), \", yychar, yytname[yychar1]);\r\n#endif\r\n\r\n  /* Discard the token being shifted unless it is eof.  */\r\n  if (yychar != YYEOF)\r\n    yychar = YYEMPTY;\r\n\r\n  *++yyvsp = yylval;\r\n#ifdef YYLSP_NEEDED\r\n  *++yylsp = yylloc;\r\n#endif\r\n\r\n  /* count tokens shifted since error; after three, turn off error status.  */\r\n  if (yyerrstatus) yyerrstatus--;\r\n\r\n  yystate = yyn;\r\n  goto yynewstate;\r\n\r\n/* Do the default action for the current state.  */\r\nyydefault:\r\n\r\n  yyn = yydefact[yystate];\r\n  if (yyn == 0)\r\n    goto yyerrlab;\r\n\r\n/* Do a reduction.  yyn is the number of a rule to reduce with.  */\r\nyyreduce:\r\n  yylen = yyr2[yyn];\r\n  if (yylen > 0)\r\n    yyval = yyvsp[1-yylen]; /* implement default value of the action */\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    {\r\n      int i;\r\n\r\n      fprintf (stderr, \"Reducing via rule %d (line %d), \",\r\n\t       yyn, yyrline[yyn]);\r\n\r\n      /* Print the symbols being reduced, and their result.  */\r\n      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)\r\n\tfprintf (stderr, \"%s \", yytname[yyrhs[i]]);\r\n      fprintf (stderr, \" -> %s\\n\", yytname[yyr1[yyn]]);\r\n    }\r\n#endif\r\n\r\n\r\n  switch (yyn) {\r\n\r\ncase 1:\r\n#line 121 \"csharp.y\"\r\n{ R(); yyval.value = yyvsp[0].value; ;\r\n    break;}\r\ncase 2:\r\n#line 122 \"csharp.y\"\r\n{ R(); yyval.value = yyvsp[0].value; ;\r\n    break;}\r\ncase 3:\r\n#line 123 \"csharp.y\"\r\n{ R(); yyval.value = yyvsp[0].value; ;\r\n    break;}\r\ncase 4:\r\n#line 124 \"csharp.y\"\r\n{ R(); yyval.value = yyvsp[0].value; ;\r\n    break;}\r\ncase 5:\r\n#line 125 \"csharp.y\"\r\n{ R(); yyval.value = yyvsp[0].value; ;\r\n    break;}\r\ncase 6:\r\n#line 126 \"csharp.y\"\r\n{ R(); yyval.value = yyvsp[0].value; ;\r\n    break;}\r\ncase 7:\r\n#line 129 \"csharp.y\"\r\n{ R(); yyval.value.type = TYPE_BOOL; yyval.value.v.i = 1; ;\r\n    break;}\r\ncase 8:\r\n#line 130 \"csharp.y\"\r\n{ R(); yyval.value.type = TYPE_BOOL; yyval.value.v.i = 0; ;\r\n    break;}\r\ncase 9:\r\n#line 140 \"csharp.y\"\r\n{ R(); yyval.text = yyvsp[0].text; ;\r\n    break;}\r\ncase 10:\r\n#line 143 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(yyvsp[-1].text, TYPE_UNRESOLVED); /* TODO : generic here -> Sub type*/ ;\r\n    break;}\r\ncase 11:\r\n#line 146 \"csharp.y\"\r\n{ R(); yyval.type = NULL;\t\t;\r\n    break;}\r\ncase 12:\r\n#line 147 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type;\t;\r\n    break;}\r\ncase 13:\r\n#line 151 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-2].type; \t;\r\n    break;}\r\ncase 14:\r\n#line 154 \"csharp.y\"\r\n{ R(); ;\r\n    break;}\r\ncase 15:\r\n#line 155 \"csharp.y\"\r\n{ R(); ;\r\n    break;}\r\ncase 16:\r\n#line 158 \"csharp.y\"\r\n{ R(); lex_in_generic();\t\t;\r\n    break;}\r\ncase 17:\r\n#line 159 \"csharp.y\"\r\n{ R(); lex_out_generic();\t;\r\n    break;}\r\ncase 18:\r\n#line 163 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 19:\r\n#line 164 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 20:\r\n#line 167 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 21:\r\n#line 168 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 22:\r\n#line 171 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 23:\r\n#line 172 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 24:\r\n#line 173 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 25:\r\n#line 176 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 26:\r\n#line 177 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 27:\r\n#line 180 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 28:\r\n#line 181 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 30:\r\n#line 185 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_SBYTE);\t\t;\r\n    break;}\r\ncase 31:\r\n#line 186 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_BYTE);\t\t;\r\n    break;}\r\ncase 32:\r\n#line 187 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_SHORT);\t\t;\r\n    break;}\r\ncase 33:\r\n#line 188 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_USHORT);\t\t;\r\n    break;}\r\ncase 34:\r\n#line 189 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_INT); \t\t;\r\n    break;}\r\ncase 35:\r\n#line 190 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_UINT); \t\t;\r\n    break;}\r\ncase 36:\r\n#line 191 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_LONG); \t\t;\r\n    break;}\r\ncase 37:\r\n#line 192 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_ULONG); \t\t;\r\n    break;}\r\ncase 38:\r\n#line 193 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_CHAR); \t\t;\r\n    break;}\r\ncase 39:\r\n#line 196 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_FLOAT); \t\t;\r\n    break;}\r\ncase 40:\r\n#line 197 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_DOUBLE); \t;\r\n    break;}\r\ncase 41:\r\n#line 200 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_OBJECT); \t;\r\n    break;}\r\ncase 42:\r\n#line 201 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_STRING); \t;\r\n    break;}\r\ncase 43:\r\n#line 204 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-1].type->addPointer();\t\t\t\t\t\t;\r\n    break;}\r\ncase 44:\r\n#line 205 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_VOID)->addPointer(); ;\r\n    break;}\r\ncase 45:\r\n#line 208 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-1].type->addRank(yyvsp[0].tmpValue);\t;\r\n    break;}\r\ncase 46:\r\n#line 209 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-1].type->addRank(yyvsp[0].tmpValue);\t;\r\n    break;}\r\ncase 47:\r\n#line 211 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-1].type->addRank(yyvsp[0].tmpValue);\t;\r\n    break;}\r\ncase 48:\r\n#line 214 \"csharp.y\"\r\n{ R(); yyval.tmpValue = 0;\t\t;\r\n    break;}\r\ncase 49:\r\n#line 216 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[-1].tmpValue; ;\r\n    break;}\r\ncase 50:\r\n#line 219 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[0].tmpValue; ;\r\n    break;}\r\ncase 51:\r\n#line 227 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 52:\r\n#line 231 \"csharp.y\"\r\n{ R(); yyval.expr = CreateMultipleExpr(yyvsp[0].expr); \t\t;\r\n    break;}\r\ncase 53:\r\n#line 232 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-2].expr->addExpression(yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 54:\r\n#line 235 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; \t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 55:\r\n#line 236 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_REF, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 56:\r\n#line 237 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_OUT, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 57:\r\n#line 240 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 58:\r\n#line 241 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 59:\r\n#line 244 \"csharp.y\"\r\n{ R(); yyval.expr = CreateLeafExpr(EXPR_CTE)->setValue(yyvsp[0].value); ;\r\n    break;}\r\ncase 60:\r\n#line 245 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 61:\r\n#line 246 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 62:\r\n#line 247 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 63:\r\n#line 248 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 64:\r\n#line 249 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 65:\r\n#line 250 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 66:\r\n#line 251 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 67:\r\n#line 252 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 68:\r\n#line 253 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 69:\r\n#line 254 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 70:\r\n#line 255 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 71:\r\n#line 258 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-1].expr->addParenthesis(); ;\r\n    break;}\r\ncase 72:\r\n#line 261 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_DOT, yyvsp[-2].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 73:\r\n#line 262 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_DOT, yyvsp[-2].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 74:\r\n#line 263 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_DOT, yyvsp[-2].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 75:\r\n#line 266 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_INVOKE, yyvsp[-3].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 76:\r\n#line 267 \"csharp.y\"\r\n{ R();\r\n\tyyval.expr = CreateDoubleExpr(EXPR_INVOKE, NULL, yyvsp[-1].expr)->setIdentifier(yyvsp[-3].text);\r\n  ;\r\n    break;}\r\ncase 77:\r\n#line 272 \"csharp.y\"\r\n{ R(); yyval.expr = NULL; \t\t;\r\n    break;}\r\ncase 78:\r\n#line 273 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr;\t;\r\n    break;}\r\ncase 79:\r\n#line 276 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_ACCESS, yyvsp[-3].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 80:\r\n#line 277 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_ACCESS, yyvsp[-3].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 81:\r\n#line 281 \"csharp.y\"\r\n{ R(); yyval.expr = NULL;\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 82:\r\n#line 282 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr;\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 83:\r\n#line 286 \"csharp.y\"\r\n{ R(); yyval.expr = CreateMultipleExpr(yyvsp[0].expr); \t\t;\r\n    break;}\r\ncase 84:\r\n#line 287 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-2].expr->addExpression(yyvsp[0].expr); \t;\r\n    break;}\r\ncase 85:\r\n#line 290 \"csharp.y\"\r\n{ R(); yyval.expr = CreateLeafExpr(EXPR_THIS);\t\t\t;\r\n    break;}\r\ncase 86:\r\n#line 293 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_ACCESS, CreateLeafExpr(EXPR_BASE))->setIdentifier(yyvsp[0].text); ;\r\n    break;}\r\ncase 87:\r\n#line 294 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_ACCESS, CreateLeafExpr(EXPR_BASE), yyvsp[-1].expr);;\r\n    break;}\r\ncase 88:\r\n#line 297 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_PLUSPLUS, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 89:\r\n#line 300 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_MINUSMINUS, yyvsp[-1].expr);;\r\n    break;}\r\ncase 90:\r\n#line 303 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr;\t;\r\n    break;}\r\ncase 91:\r\n#line 306 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_NEW, yyvsp[-1].expr)->setType(yyvsp[-3].type); ;\r\n    break;}\r\ncase 92:\r\n#line 310 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_NEW, yyvsp[-3].expr, yyvsp[0].expr)->setType(yyvsp[-5].type)->setRank(yyvsp[-1].tmpValue)->setArrayNew(); ;\r\n    break;}\r\ncase 93:\r\n#line 311 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_NEW, NULL, yyvsp[0].expr)->setArrayNew(); ;\r\n    break;}\r\ncase 94:\r\n#line 314 \"csharp.y\"\r\n{ R(); yyval.expr = NULL; \t\t;\r\n    break;}\r\ncase 95:\r\n#line 315 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr;\t;\r\n    break;}\r\ncase 96:\r\n#line 318 \"csharp.y\"\r\n{ R(); yyval.expr = CreateLeafExpr(EXPR_TYPEOF)->setType(yyvsp[-1].type); ;\r\n    break;}\r\ncase 97:\r\n#line 319 \"csharp.y\"\r\n{ R(); compilerError(UNSUPPORTED,\"typeof(void)\"); ;\r\n    break;}\r\ncase 98:\r\n#line 322 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_CHECKED, yyvsp[-1].expr); ;\r\n    break;}\r\ncase 99:\r\n#line 325 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_UNCHECKED, yyvsp[-1].expr); ;\r\n    break;}\r\ncase 100:\r\n#line 328 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_ARROW, yyvsp[-2].expr)->setIdentifier(yyvsp[0].text); ;\r\n    break;}\r\ncase 101:\r\n#line 331 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_ADRESSOF, yyvsp[-1].expr);\t\t;\r\n    break;}\r\ncase 102:\r\n#line 334 \"csharp.y\"\r\n{ R(); yyval.expr = CreateLeafExpr(EXPR_SIZEOF)->setType(yyvsp[-1].type);\t;\r\n    break;}\r\ncase 103:\r\n#line 337 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 104:\r\n#line 338 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 105:\r\n#line 339 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 106:\r\n#line 340 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 107:\r\n#line 341 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 108:\r\n#line 344 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 109:\r\n#line 345 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_NOT, yyvsp[0].expr);\t\t;\r\n    break;}\r\ncase 110:\r\n#line 346 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_LNOT, yyvsp[0].expr);\t\t;\r\n    break;}\r\ncase 111:\r\n#line 347 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 112:\r\n#line 350 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_PREINCR, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 113:\r\n#line 353 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_PREDECR, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 114:\r\n#line 356 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 115:\r\n#line 357 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_UNARYPLUS, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 116:\r\n#line 358 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_UNARYMINUS, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 117:\r\n#line 359 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_UNARYMULT, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 118:\r\n#line 360 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 119:\r\n#line 361 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 120:\r\n#line 362 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 121:\r\n#line 370 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_CAST, yyvsp[-2].expr, yyvsp[0].expr);\t\t;\r\n    break;}\r\ncase 122:\r\n#line 371 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_CAST_PTR, yyvsp[-3].expr, yyvsp[-1].expr);\t;\r\n    break;}\r\ncase 123:\r\n#line 373 \"csharp.y\"\r\n{ R();\r\n\t\t// TODO Cast D\r\n\t;\r\n    break;}\r\ncase 124:\r\n#line 377 \"csharp.y\"\r\n{ R();\r\n\t\t// TODO Cast E\r\n\t;\r\n    break;}\r\ncase 125:\r\n#line 381 \"csharp.y\"\r\n{ R();\r\n\t\t// TODO Cast F\r\n\t;\r\n    break;}\r\ncase 126:\r\n#line 385 \"csharp.y\"\r\n{ R();\r\n\t\t// TODO Cast G\r\n\t;\r\n    break;}\r\ncase 133:\r\n#line 404 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 134:\r\n#line 405 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_MULT, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 135:\r\n#line 406 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_DIV, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 136:\r\n#line 407 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_MOD, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 137:\r\n#line 410 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 138:\r\n#line 411 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_PLUS, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 139:\r\n#line 412 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_MINUS, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 140:\r\n#line 415 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 141:\r\n#line 416 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_LSHFT, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 142:\r\n#line 420 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 143:\r\n#line 421 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_LESS, yyvsp[-2].expr, yyvsp[0].expr);\t\t\t;\r\n    break;}\r\ncase 144:\r\n#line 422 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_MORE, yyvsp[-2].expr, yyvsp[0].expr);\t\t\t;\r\n    break;}\r\ncase 145:\r\n#line 423 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_LESSEQ, yyvsp[-2].expr, yyvsp[0].expr);\t\t;\r\n    break;}\r\ncase 146:\r\n#line 424 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_MOREEQ, yyvsp[-2].expr, yyvsp[0].expr);\t\t;\r\n    break;}\r\ncase 147:\r\n#line 425 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_IS, yyvsp[-2].expr)->setType(yyvsp[0].type);\t;\r\n    break;}\r\ncase 148:\r\n#line 426 \"csharp.y\"\r\n{ R(); yyval.expr = CreateSingleExpr(EXPR_AS, yyvsp[-2].expr)->setType(yyvsp[0].type);\t;\r\n    break;}\r\ncase 149:\r\n#line 429 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 150:\r\n#line 430 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_EQUTST, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 151:\r\n#line 431 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_DIFFTST, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 152:\r\n#line 434 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 153:\r\n#line 435 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_LAND, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 154:\r\n#line 438 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 155:\r\n#line 439 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_LXOR, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 156:\r\n#line 442 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 157:\r\n#line 443 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_LOR, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 158:\r\n#line 446 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 159:\r\n#line 447 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_AND, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 160:\r\n#line 450 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 161:\r\n#line 451 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr(EXPR_OR, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 162:\r\n#line 454 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 163:\r\n#line 455 \"csharp.y\"\r\n{ R(); yyval.expr = CreateTripleExpr(EXPR_COND, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 164:\r\n#line 457 \"csharp.y\"\r\n{ R(); yyval.expr = CreateDoubleExpr((EnumExpressionType)yyvsp[-1].tmpValue, yyvsp[-2].expr, yyvsp[0].expr);\t;\r\n    break;}\r\ncase 165:\r\n#line 460 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_EQ;\t\t;\r\n    break;}\r\ncase 166:\r\n#line 461 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_PLUSEQ;\t;\r\n    break;}\r\ncase 167:\r\n#line 462 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_MINUSEQ;\t;\r\n    break;}\r\ncase 168:\r\n#line 463 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_STAREQ;\t;\r\n    break;}\r\ncase 169:\r\n#line 464 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_DIVEQ;\t;\r\n    break;}\r\ncase 170:\r\n#line 465 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_MODEQ;\t;\r\n    break;}\r\ncase 171:\r\n#line 466 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_XOREQ;\t;\r\n    break;}\r\ncase 172:\r\n#line 467 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_ANDEQ;\t;\r\n    break;}\r\ncase 173:\r\n#line 468 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_OREQ;\t;\r\n    break;}\r\ncase 174:\r\n#line 469 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_RSHFTEQ;\t;\r\n    break;}\r\ncase 175:\r\n#line 470 \"csharp.y\"\r\n{ R(); yyval.tmpValue\t= EXPR_ASS_LSHFTEQ;\t;\r\n    break;}\r\ncase 176:\r\n#line 474 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 177:\r\n#line 475 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 178:\r\n#line 478 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 179:\r\n#line 481 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 180:\r\n#line 496 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 181:\r\n#line 497 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 182:\r\n#line 498 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 183:\r\n#line 501 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 184:\r\n#line 502 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 185:\r\n#line 503 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 186:\r\n#line 504 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 187:\r\n#line 505 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 188:\r\n#line 506 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 189:\r\n#line 507 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 190:\r\n#line 508 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 191:\r\n#line 509 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 192:\r\n#line 510 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 193:\r\n#line 511 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 194:\r\n#line 512 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 195:\r\n#line 513 \"csharp.y\"\r\n{ R(); yyval.statement\t= yyvsp[0].statement; ;\r\n    break;}\r\ncase 196:\r\n#line 516 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_BLOCK, NULL, yyvsp[-1].statement); ;\r\n    break;}\r\ncase 197:\r\n#line 519 \"csharp.y\"\r\n{ R(); yyval.statement = NULL; ;\r\n    break;}\r\ncase 198:\r\n#line 520 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement;\t;\r\n    break;}\r\ncase 199:\r\n#line 524 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement;\t;\r\n    break;}\r\ncase 200:\r\n#line 525 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement ? yyvsp[-1].statement->addNext(yyvsp[0].statement) : yyvsp[0].statement; ;\r\n    break;}\r\ncase 201:\r\n#line 528 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_NULL, NULL, NULL); ;\r\n    break;}\r\ncase 202:\r\n#line 531 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_LABEL, yyvsp[0].statement, NULL)->addLabel(yyvsp[-2].text);\t;\r\n    break;}\r\ncase 203:\r\n#line 534 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement;\t;\r\n    break;}\r\ncase 204:\r\n#line 535 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement;\t;\r\n    break;}\r\ncase 205:\r\n#line 538 \"csharp.y\"\r\n{ R(); yyval.statement = CreateVarStatement(STM_LOCALVAR, NULL, NULL, yyvsp[0].variable, yyvsp[-1].type); ;\r\n    break;}\r\ncase 206:\r\n#line 541 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[0].variable; ;\r\n    break;}\r\ncase 207:\r\n#line 542 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[-2].variable->addVariable(yyvsp[0].variable); ;\r\n    break;}\r\ncase 208:\r\n#line 545 \"csharp.y\"\r\n{ R(); yyval.variable = CreateVarInstance(yyvsp[0].text);\t;\r\n    break;}\r\ncase 209:\r\n#line 546 \"csharp.y\"\r\n{ R(); yyval.variable = CreateVarInstance(yyvsp[-2].text)->setInitializer(yyvsp[0].expr); ;\r\n    break;}\r\ncase 210:\r\n#line 549 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 211:\r\n#line 550 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 212:\r\n#line 551 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; ;\r\n    break;}\r\ncase 213:\r\n#line 554 \"csharp.y\"\r\n{ R(); /* Only in unsafe code from spec */compilerError(UNSUPPORTED,\"stackalloc\"); ;\r\n    break;}\r\ncase 214:\r\n#line 557 \"csharp.y\"\r\n{ R(); yyval.statement = CreateVarStatement(STM_LOCALVAR, NULL, NULL, yyvsp[0].variable, yyvsp[-1].type)->setConstant(); ;\r\n    break;}\r\ncase 215:\r\n#line 560 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[0].variable; ;\r\n    break;}\r\ncase 216:\r\n#line 561 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[-2].variable->addVariable(yyvsp[0].variable); ;\r\n    break;}\r\ncase 217:\r\n#line 564 \"csharp.y\"\r\n{ R(); yyval.variable = CreateVarInstance(yyvsp[-2].text)->setInitializer(yyvsp[0].expr); ;\r\n    break;}\r\ncase 218:\r\n#line 567 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement; ;\r\n    break;}\r\ncase 219:\r\n#line 570 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 220:\r\n#line 571 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 221:\r\n#line 572 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 222:\r\n#line 573 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_WRAPPER_POSTINCR,NULL,NULL)->setExpression(yyvsp[0].expr); ;\r\n    break;}\r\ncase 223:\r\n#line 574 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_WRAPPER_POSTDECR,NULL,NULL)->setExpression(yyvsp[0].expr); ;\r\n    break;}\r\ncase 224:\r\n#line 575 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_WRAPPER_PREINCR ,NULL,NULL)->setExpression(yyvsp[0].expr); ;\r\n    break;}\r\ncase 225:\r\n#line 576 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_WRAPPER_PREDECR ,NULL,NULL)->setExpression(yyvsp[0].expr); ;\r\n    break;}\r\ncase 226:\r\n#line 579 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 227:\r\n#line 580 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 228:\r\n#line 583 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_IF, NULL, yyvsp[0].statement)->setExpression(yyvsp[-2].expr); ;\r\n    break;}\r\ncase 229:\r\n#line 584 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_IF, NULL, yyvsp[-2].statement)->addChild(yyvsp[0].statement)->setExpression(yyvsp[-4].expr); ;\r\n    break;}\r\ncase 230:\r\n#line 587 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_SWITCH, NULL, yyvsp[0].statement)->setExpression(yyvsp[-2].expr); ;\r\n    break;}\r\ncase 231:\r\n#line 590 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement; ;\r\n    break;}\r\ncase 232:\r\n#line 593 \"csharp.y\"\r\n{ R(); yyval.statement = NULL; ;\r\n    break;}\r\ncase 233:\r\n#line 594 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 234:\r\n#line 597 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 235:\r\n#line 598 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement->addNext(yyvsp[0].statement); ;\r\n    break;}\r\ncase 236:\r\n#line 601 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement->addChild(yyvsp[0].statement); ;\r\n    break;}\r\ncase 237:\r\n#line 605 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 238:\r\n#line 606 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement->addNext(yyvsp[0].statement); ;\r\n    break;}\r\ncase 239:\r\n#line 609 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CASE, NULL, NULL\t\t)->setExpression(yyvsp[-1].expr); ;\r\n    break;}\r\ncase 240:\r\n#line 610 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CASEDEFAULT, NULL, NULL); ;\r\n    break;}\r\ncase 241:\r\n#line 613 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 242:\r\n#line 614 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 243:\r\n#line 615 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 244:\r\n#line 616 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 245:\r\n#line 619 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_UNSAFE, NULL, yyvsp[0].statement); ;\r\n    break;}\r\ncase 246:\r\n#line 623 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_WHILE, NULL, yyvsp[0].statement)->setExpression(yyvsp[-2].expr); ;\r\n    break;}\r\ncase 247:\r\n#line 627 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_DOWHILE, NULL, yyvsp[-5].statement)->setExpression(yyvsp[-2].expr); ;\r\n    break;}\r\ncase 248:\r\n#line 631 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_FOR, NULL, yyvsp[-7].statement)\t->setExpression\t (yyvsp[-4].expr)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChildNilWrap(yyvsp[-6].statement)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChildNilWrap(yyvsp[-2].statement)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChildNilWrap(yyvsp[0].statement); ;\r\n    break;}\r\ncase 249:\r\n#line 637 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t;\r\n    break;}\r\ncase 250:\r\n#line 638 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 251:\r\n#line 641 \"csharp.y\"\r\n{ R(); yyval.expr = NULL;\t\t;\r\n    break;}\r\ncase 252:\r\n#line 642 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; \t;\r\n    break;}\r\ncase 253:\r\n#line 645 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t;\r\n    break;}\r\ncase 254:\r\n#line 646 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 255:\r\n#line 649 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 256:\r\n#line 650 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 257:\r\n#line 653 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; \t;\r\n    break;}\r\ncase 258:\r\n#line 656 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 259:\r\n#line 659 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 260:\r\n#line 660 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-2].statement->addNext(yyvsp[0].statement); ;\r\n    break;}\r\ncase 261:\r\n#line 664 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_FOREACH, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->setExpression(yyvsp[-2].expr)\r\n\t\t\t\t\t\t\t\t\t\t\t->addType(yyvsp[-5].type)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[0].statement); \r\n\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 262:\r\n#line 671 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 263:\r\n#line 672 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 264:\r\n#line 673 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 265:\r\n#line 674 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 266:\r\n#line 675 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 267:\r\n#line 678 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_BREAK, NULL, NULL); ;\r\n    break;}\r\ncase 268:\r\n#line 681 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CONTINUE, NULL, NULL); ;\r\n    break;}\r\ncase 269:\r\n#line 684 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_GOTO, NULL,NULL)->addLabel(yyvsp[-1].text);\t;\r\n    break;}\r\ncase 270:\r\n#line 685 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_GOTOCASE, NULL, NULL)->setExpression(yyvsp[-1].expr); ;\r\n    break;}\r\ncase 271:\r\n#line 686 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_GOTODEFAULT, NULL,NULL); ;\r\n    break;}\r\ncase 272:\r\n#line 689 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_RETURN, NULL, NULL)->setExpression(yyvsp[-1].expr); ;\r\n    break;}\r\ncase 273:\r\n#line 692 \"csharp.y\"\r\n{ R(); yyval.expr = NULL; \t\t;\r\n    break;}\r\ncase 274:\r\n#line 693 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr; \t;\r\n    break;}\r\ncase 275:\r\n#line 696 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_THROW, NULL, NULL)->setExpression(yyvsp[-1].expr); ;\r\n    break;}\r\ncase 276:\r\n#line 699 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_TRY, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[-1].statement)->addNext(yyvsp[0].statement); \r\n\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 277:\r\n#line 702 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_TRY, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[-1].statement)->addNext(yyvsp[0].statement);\r\n\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 278:\r\n#line 706 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_TRY, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[-2].statement)->addNext(yyvsp[-1].statement)->addNext(yyvsp[0].statement);\r\n\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 279:\r\n#line 711 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; ;\r\n    break;}\r\ncase 280:\r\n#line 712 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[-1].statement->addNext(yyvsp[0].statement); ;\r\n    break;}\r\ncase 281:\r\n#line 715 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CATCH, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[0].statement)->addLabel(yyvsp[-2].text)->addType(yyvsp[-3].type); \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 282:\r\n#line 718 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CATCH, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[0].statement)->addLabel(yyvsp[-2].text)->addType(yyvsp[-3].type); \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 283:\r\n#line 721 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CATCH, NULL, NULL)->addChild(yyvsp[0].statement); ;\r\n    break;}\r\ncase 284:\r\n#line 724 \"csharp.y\"\r\n{ R(); yyval.text = NULL; ;\r\n    break;}\r\ncase 285:\r\n#line 725 \"csharp.y\"\r\n{ R(); yyval.text = yyvsp[0].text; ;\r\n    break;}\r\ncase 286:\r\n#line 728 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_FINALLY, NULL, NULL)->addChild(yyvsp[0].statement); ;\r\n    break;}\r\ncase 287:\r\n#line 731 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_CHECKED, NULL, NULL)->addChild(yyvsp[0].statement); ;\r\n    break;}\r\ncase 288:\r\n#line 734 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_UNCHECKED, NULL, NULL)->addChild(yyvsp[0].statement); ;\r\n    break;}\r\ncase 289:\r\n#line 737 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_LOCK, NULL, NULL)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->addChild(yyvsp[0].statement)->setExpression(yyvsp[-2].expr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 290:\r\n#line 743 \"csharp.y\"\r\n{ R(); yyval.statement = CreateStatement(STM_USING, NULL, NULL)->addChild(yyvsp[-2].statement)->addChild(yyvsp[0].statement); ;\r\n    break;}\r\ncase 291:\r\n#line 746 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement ;\r\n    break;}\r\ncase 292:\r\n#line 747 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement ;\r\n    break;}\r\ncase 293:\r\n#line 752 \"csharp.y\"\r\n{ R(); compilerError(UNSUPPORTED,\"FIXED not supported.\"); ;\r\n    break;}\r\ncase 294:\r\n#line 755 \"csharp.y\"\r\n{ R(); /* When FIXED Support */ ;\r\n    break;}\r\ncase 295:\r\n#line 756 \"csharp.y\"\r\n{ R(); /* When FIXED Support */ ;\r\n    break;}\r\ncase 296:\r\n#line 759 \"csharp.y\"\r\n{ R(); /* When FIXED Support */ ;\r\n    break;}\r\ncase 297:\r\n#line 768 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 298:\r\n#line 769 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 299:\r\n#line 772 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 300:\r\n#line 773 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 301:\r\n#line 776 \"csharp.y\"\r\n{ R(); yyval.attribute = NULL; ;\r\n    break;}\r\ncase 302:\r\n#line 777 \"csharp.y\"\r\n{ R(); yyval.attribute = yyvsp[0].attribute; ;\r\n    break;}\r\ncase 303:\r\n#line 780 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 304:\r\n#line 781 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 305:\r\n#line 784 \"csharp.y\"\r\n{ R(); useOrCreateNameSpace(yyvsp[-2].attribute, yyvsp[0].text); ;\r\n    break;}\r\ncase 306:\r\n#line 785 \"csharp.y\"\r\n{ R();\t// Unstack.\r\n\t\t\t\t\t\t\t\t\t\tunuseNameSpace();\t\t;\r\n    break;}\r\ncase 307:\r\n#line 789 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 308:\r\n#line 790 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 309:\r\n#line 799 \"csharp.y\"\r\n{ R(); yyval.text = yyvsp[0].text; \tdisplay(yyvsp[0].text);\t\t\t\t\t;\r\n    break;}\r\ncase 310:\r\n#line 800 \"csharp.y\"\r\n{ R(); yyval.text = concat(yyvsp[-1].text, yyvsp[0].text); \t\t;\r\n    break;}\r\ncase 311:\r\n#line 803 \"csharp.y\"\r\n{ R(); yyval.text = concat(yyvsp[-1].text, \".\"); \t\t\t;\r\n    break;}\r\ncase 312:\r\n#line 804 \"csharp.y\"\r\n{ R(); yyval.text = concat(yyvsp[-2].text, yyvsp[-1].text, \".\"); \t;\r\n    break;}\r\ncase 313:\r\n#line 808 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 314:\r\n#line 811 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 315:\r\n#line 812 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 316:\r\n#line 815 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 317:\r\n#line 816 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 318:\r\n#line 819 \"csharp.y\"\r\n{ R(); createAlias(yyvsp[-3].text, yyvsp[-1].text); \t;\r\n    break;}\r\ncase 319:\r\n#line 822 \"csharp.y\"\r\n{ R(); addUsingNameSpace(yyvsp[-1].text); \t\t;\r\n    break;}\r\ncase 320:\r\n#line 825 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 321:\r\n#line 826 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 322:\r\n#line 829 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 323:\r\n#line 830 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 324:\r\n#line 833 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 325:\r\n#line 834 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 326:\r\n#line 835 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 327:\r\n#line 836 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 328:\r\n#line 837 \"csharp.y\"\r\n{ R(); /* Nothing to do here */ ;\r\n    break;}\r\ncase 329:\r\n#line 848 \"csharp.y\"\r\n{ R(); yyval.tmpValue = 0;\t\t\t\t;\r\n    break;}\r\ncase 330:\r\n#line 849 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[0].tmpValue; \t;\r\n    break;}\r\ncase 331:\r\n#line 852 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[0].tmpValue; \t\t\t\t;\r\n    break;}\r\ncase 332:\r\n#line 853 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[0].tmpValue | yyvsp[-1].tmpValue; \t;\r\n    break;}\r\ncase 333:\r\n#line 856 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_ABSTRACT;\t;\r\n    break;}\r\ncase 334:\r\n#line 857 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_EXTERN;\t\t;\r\n    break;}\r\ncase 335:\r\n#line 858 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_INTERNAL;\t;\r\n    break;}\r\ncase 336:\r\n#line 859 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_NEW;\t\t;\r\n    break;}\r\ncase 337:\r\n#line 860 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_VIRTUAL;\t;\r\n    break;}\r\ncase 338:\r\n#line 861 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_PRIVATE;\t;\r\n    break;}\r\ncase 339:\r\n#line 862 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_PROTECTED;\t;\r\n    break;}\r\ncase 340:\r\n#line 863 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_PUBLIC;\t\t;\r\n    break;}\r\ncase 341:\r\n#line 864 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_READONLY;\t;\r\n    break;}\r\ncase 342:\r\n#line 865 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_SEALED;\t\t;\r\n    break;}\r\ncase 343:\r\n#line 866 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_STATIC;\t\t;\r\n    break;}\r\ncase 344:\r\n#line 867 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_UNSAFE;\t\t;\r\n    break;}\r\ncase 345:\r\n#line 868 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_VIRTUAL;\t;\r\n    break;}\r\ncase 346:\r\n#line 869 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATT_VOLATILE;\t;\r\n    break;}\r\ncase 347:\r\n#line 874 \"csharp.y\"\r\n{ R();\r\n\t\t// modify gCurrentNameSpace\r\n\t\tuseOrCreateNameSpace(yyvsp[-3].attribute,yyvsp[0].text);\r\n\t\tgCurrentAC = CreateClass(\tyyvsp[-3].attribute, \r\n\t\t\t\t\t\tyyvsp[-2].tmpValue, \r\n\t\t\t\t\t\tyyvsp[0].text);\r\n\t\t\t\t\t\t\r\n\t;\r\n    break;}\r\ncase 348:\r\n#line 881 \"csharp.y\"\r\n{ R(); unuseNameSpace(); ;\r\n    break;}\r\ncase 349:\r\n#line 884 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 350:\r\n#line 885 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 351:\r\n#line 888 \"csharp.y\"\r\n{ R(); gCurrentAC->setAncestor(yyvsp[0].type);\t;\r\n    break;}\r\ncase 352:\r\n#line 889 \"csharp.y\"\r\n{ R(); /* Do nothing */\t\t\t\t\t\t;\r\n    break;}\r\ncase 353:\r\n#line 890 \"csharp.y\"\r\n{ R(); gCurrentAC->setAncestor(yyvsp[-2].type);\t;\r\n    break;}\r\ncase 354:\r\n#line 893 \"csharp.y\"\r\n{ R(); gCurrentAC->addInterface(yyvsp[0].type);\t;\r\n    break;}\r\ncase 355:\r\n#line 894 \"csharp.y\"\r\n{ R(); gCurrentAC->addInterface(yyvsp[0].type);\t;\r\n    break;}\r\ncase 356:\r\n#line 897 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 357:\r\n#line 900 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 358:\r\n#line 901 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 359:\r\n#line 904 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 360:\r\n#line 905 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 361:\r\n#line 908 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 362:\r\n#line 909 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 363:\r\n#line 910 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 364:\r\n#line 911 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 365:\r\n#line 912 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 366:\r\n#line 913 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 367:\r\n#line 914 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 368:\r\n#line 915 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 369:\r\n#line 916 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 370:\r\n#line 918 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 371:\r\n#line 921 \"csharp.y\"\r\n{ R(); gCurrentAC->addVariable(yyvsp[-5].attribute, yyvsp[-4].tmpValue, yyvsp[-2].type, yyvsp[-1].variable )->setConst();\t;\r\n    break;}\r\ncase 372:\r\n#line 924 \"csharp.y\"\r\n{ R(); gCurrentAC->addVariable(yyvsp[-4].attribute, yyvsp[-3].tmpValue, yyvsp[-2].type, yyvsp[-1].variable );\t\t\t\t;\r\n    break;}\r\ncase 373:\r\n#line 927 \"csharp.y\"\r\n{ R(); gCurrentMethod = gCurrentAC->addMethod(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-1].attribute,\t// Attributes\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-1].tmpValue,\t// Modified REF/OUT\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-1].text,\t\t// Func Name\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-1].variable,\t// Link list of variable\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[0].statement,\t// Code\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-1].type\t\t\t// Return value.\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t );\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 374:\r\n#line 940 \"csharp.y\"\r\n{ R(); \tyyval.attribute \t= yyvsp[-6].attribute; \r\n\t\tyyval.tmpValue  \t= yyvsp[-5].tmpValue;\r\n\t\tyyval.text\t\t\t= yyvsp[-3].text;\r\n\t\tyyval.variable\t\t= yyvsp[-1].variable;\r\n\t\tyyval.type\t\t\t= yyvsp[-4].type;\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 375:\r\n#line 946 \"csharp.y\"\r\n{ R(); \tyyval.attribute \t= yyvsp[-6].attribute; \r\n\t\tyyval.tmpValue  \t= yyvsp[-5].tmpValue;\r\n\t\tyyval.text\t\t\t= yyvsp[-3].text;\r\n\t\tyyval.variable\t\t= yyvsp[-1].variable;\r\n\t\tyyval.type\t\t\t= TypeObject::getTypeObject(TYPE_VOID);\t;\r\n    break;}\r\ncase 376:\r\n#line 953 \"csharp.y\"\r\n{ R(); yyval.variable = NULL;\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 377:\r\n#line 954 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[0].variable;\t\t\t\t\t\t;\r\n    break;}\r\ncase 378:\r\n#line 957 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type;\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 379:\r\n#line 958 \"csharp.y\"\r\n{ R(); yyval.type = TypeObject::getTypeObject(TYPE_VOID);\t;\r\n    break;}\r\ncase 380:\r\n#line 961 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement;\t\t\t\t\t\t;\r\n    break;}\r\ncase 381:\r\n#line 962 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 382:\r\n#line 965 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[0].variable;\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 383:\r\n#line 966 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[-2].variable->addVariable(yyvsp[-1].variable);\t;\r\n    break;}\r\ncase 384:\r\n#line 969 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[0].variable ;\t\t\t\t\t\t;\r\n    break;}\r\ncase 385:\r\n#line 970 \"csharp.y\"\r\n{ R(); yyval.variable = yyvsp[0].variable ;\t\t\t\t\t\t;\r\n    break;}\r\ncase 386:\r\n#line 974 \"csharp.y\"\r\n{ R(); yyval.variable = CreateVarInstance(yyvsp[-1].text)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setAttribute(yyvsp[-4].attribute)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setModifier(yyvsp[-3].tmpValue)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setType(yyvsp[-2].type)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setValue(yyvsp[0].value);\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 387:\r\n#line 981 \"csharp.y\"\r\n{ R();  yyval.value.type = TYPE_UNRESOLVED;\t\t\t\t;\r\n    break;}\r\ncase 388:\r\n#line 982 \"csharp.y\"\r\n{ R();  yyval.value = yyvsp[0].value;\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 389:\r\n#line 985 \"csharp.y\"\r\n{ R();\tyyval.tmpValue\t= 0;\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 390:\r\n#line 986 \"csharp.y\"\r\n{ R();\tyyval.tmpValue = ATT_REF;\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 391:\r\n#line 987 \"csharp.y\"\r\n{ R();\tyyval.tmpValue\t= ATT_OUT;\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 392:\r\n#line 991 \"csharp.y\"\r\n{ R(); yyval.variable = CreateVarInstance(yyvsp[0].text)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setType(yyvsp[-1].type)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setAttribute(yyvsp[-3].attribute)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t->setIsEndLessParam();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 393:\r\n#line 1001 \"csharp.y\"\r\n{ R(); gCurrentAC->addProperty(yyvsp[-8].attribute, yyvsp[-7].tmpValue, yyvsp[-6].type, yyvsp[-5].text, yyvsp[-2].accessor);\t;\r\n    break;}\r\ncase 394:\r\n#line 1004 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor(yyvsp[-1].accessor, yyvsp[0].accessor);\t;\r\n    break;}\r\ncase 395:\r\n#line 1005 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor(yyvsp[0].accessor, yyvsp[-1].accessor);\t;\r\n    break;}\r\ncase 396:\r\n#line 1006 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor((Accessor*)NULL,(Accessor*)NULL); ;\r\n    break;}\r\ncase 397:\r\n#line 1009 \"csharp.y\"\r\n{ R(); yyval.accessor = NULL;\t\t\t;\r\n    break;}\r\ncase 398:\r\n#line 1010 \"csharp.y\"\r\n{ R(); yyval.accessor = yyvsp[0].accessor;\t;\r\n    break;}\r\ncase 399:\r\n#line 1013 \"csharp.y\"\r\n{ R(); yyval.accessor = NULL;\t\t\t;\r\n    break;}\r\ncase 400:\r\n#line 1014 \"csharp.y\"\r\n{ R(); yyval.accessor = yyvsp[0].accessor;\t;\r\n    break;}\r\ncase 401:\r\n#line 1020 \"csharp.y\"\r\n{ R(); yyval.accessor  = CreateAccessor(yyvsp[-4].attribute, yyvsp[-1].statement);\t;\r\n    break;}\r\ncase 402:\r\n#line 1026 \"csharp.y\"\r\n{ R(); yyval.accessor  = CreateAccessor(yyvsp[-4].attribute, yyvsp[-1].statement);\t;\r\n    break;}\r\ncase 403:\r\n#line 1029 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement; \t;\r\n    break;}\r\ncase 404:\r\n#line 1030 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t\t\t;\r\n    break;}\r\ncase 405:\r\n#line 1033 \"csharp.y\"\r\n{ R();\tcompilerError(UNSUPPORTED,\"event not supported\");\t;\r\n    break;}\r\ncase 406:\r\n#line 1037 \"csharp.y\"\r\n{ R();\tcompilerError(UNSUPPORTED,\"event not supported\");\t;\r\n    break;}\r\ncase 407:\r\n#line 1040 \"csharp.y\"\r\n{ R();\tcompilerError(UNSUPPORTED,\"event not supported\");\t;\r\n    break;}\r\ncase 408:\r\n#line 1041 \"csharp.y\"\r\n{ R();\tcompilerError(UNSUPPORTED,\"event not supported\");\t;\r\n    break;}\r\ncase 409:\r\n#line 1047 \"csharp.y\"\r\n{ R();\tcompilerError(UNSUPPORTED,\"event not supported\");\t;\r\n    break;}\r\ncase 410:\r\n#line 1053 \"csharp.y\"\r\n{ R();\tcompilerError(UNSUPPORTED,\"event not supported\");\t;\r\n    break;}\r\ncase 411:\r\n#line 1056 \"csharp.y\"\r\n{ R();\t\r\n\t\tgCurrentAC->addProperty(yyvsp[-2].attribute, yyvsp[-1].tmpValue, yyvsp[0].indexer);\r\n\t;\r\n    break;}\r\ncase 413:\r\n#line 1064 \"csharp.y\"\r\n{ R(); yyval.indexer = CreateIndexer(yyvsp[-4].type, yyvsp[-1].variable);\t;\r\n    break;}\r\ncase 414:\r\n#line 1066 \"csharp.y\"\r\n{ R(); compilerError(UNSUPPORTED,\"qualified this[] accessor property not supported.\"); ;\r\n    break;}\r\ncase 415:\r\n#line 1069 \"csharp.y\"\r\n{ R(); yyval.text = concat(yyvsp[-1].text, \"this\"); ;\r\n    break;}\r\ncase 416:\r\n#line 1073 \"csharp.y\"\r\n{ R(); /* TODO When support operator */\t;\r\n    break;}\r\ncase 417:\r\n#line 1076 \"csharp.y\"\r\n{ R(); /* TODO When support operator */\t;\r\n    break;}\r\ncase 418:\r\n#line 1077 \"csharp.y\"\r\n{ R(); /* TODO When support operator */\t;\r\n    break;}\r\ncase 419:\r\n#line 1080 \"csharp.y\"\r\n{ R(); compilerError(UNSUPPORTED,\"Overloading operator not supported.\"); ;\r\n    break;}\r\ncase 420:\r\n#line 1081 \"csharp.y\"\r\n{ R(); compilerError(UNSUPPORTED,\"Overloading operator not supported.\"); ;\r\n    break;}\r\ncase 421:\r\n#line 1084 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_PLUS;  ;\r\n    break;}\r\ncase 422:\r\n#line 1085 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_MINUS; ;\r\n    break;}\r\ncase 423:\r\n#line 1086 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_LNOT;  ;\r\n    break;}\r\ncase 424:\r\n#line 1087 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_NOT;   ;\r\n    break;}\r\ncase 425:\r\n#line 1088 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_PLUSPLUS;   ;\r\n    break;}\r\ncase 426:\r\n#line 1089 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_MINUSMINUS; ;\r\n    break;}\r\ncase 427:\r\n#line 1090 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_TRUE;  ;\r\n    break;}\r\ncase 428:\r\n#line 1091 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_FALSE; ;\r\n    break;}\r\ncase 429:\r\n#line 1092 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_MULT;  ;\r\n    break;}\r\ncase 430:\r\n#line 1093 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_DIV;   ;\r\n    break;}\r\ncase 431:\r\n#line 1094 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_MOD;   ;\r\n    break;}\r\ncase 432:\r\n#line 1095 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_AND;   ;\r\n    break;}\r\ncase 433:\r\n#line 1096 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_OR;    ;\r\n    break;}\r\ncase 434:\r\n#line 1097 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_XOR;   ;\r\n    break;}\r\ncase 435:\r\n#line 1098 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_LSHFT; ;\r\n    break;}\r\ncase 436:\r\n#line 1099 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_EQUAL; ;\r\n    break;}\r\ncase 437:\r\n#line 1100 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_DIFF;  ;\r\n    break;}\r\ncase 438:\r\n#line 1101 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[0].tmpValue;  ;\r\n    break;}\r\ncase 439:\r\n#line 1102 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_LESS;  ;\r\n    break;}\r\ncase 440:\r\n#line 1103 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_MOREEQ;;\r\n    break;}\r\ncase 441:\r\n#line 1104 \"csharp.y\"\r\n{ R(); yyval.tmpValue = OP_LESSEQ;;\r\n    break;}\r\ncase 442:\r\n#line 1106 \"csharp.y\"\r\n{ yyval.tmpValue = OP_RSHFT;\t;\r\n    break;}\r\ncase 443:\r\n#line 1107 \"csharp.y\"\r\n{ yyval.tmpValue = OP_MORE;\t;\r\n    break;}\r\ncase 444:\r\n#line 1111 \"csharp.y\"\r\n{ R(); /* TODO When support operator */\t;\r\n    break;}\r\ncase 445:\r\n#line 1112 \"csharp.y\"\r\n{ R(); /* TODO When support operator */\t;\r\n    break;}\r\ncase 446:\r\n#line 1115 \"csharp.y\"\r\n{ R();\r\n\t\tgCurrentMethod = gCurrentAC->addConstructor(\r\n\t\t\tyyvsp[-3].attribute,\t// Attributes\r\n\t\t\tyyvsp[-2].tmpValue,\t// Modifier\r\n\t\t\tyyvsp[-1].text,\t\t// Func Name\r\n\t\t\tyyvsp[-1].variable,\t// Link list of variable\r\n\t\t\tyyvsp[0].statement\t// Code\r\n\t\t);\r\n\t;\r\n    break;}\r\ncase 447:\r\n#line 1126 \"csharp.y\"\r\n{ R(); \tyyval.text\t\t= yyvsp[-4].text; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyval.variable = yyvsp[-2].variable; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyval.expr\t\t= yyvsp[0].expr; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyval.tmpValue\t= yyvsp[0].tmpValue;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 448:\r\n#line 1133 \"csharp.y\"\r\n{ R(); yyval.expr\t= NULL;\t\tyyval.tmpValue = -1;\t\t\t;\r\n    break;}\r\ncase 449:\r\n#line 1134 \"csharp.y\"\r\n{ R(); yyval.expr\t= yyvsp[0].expr;\tyyval.tmpValue = yyvsp[0].tmpValue;\t;\r\n    break;}\r\ncase 450:\r\n#line 1137 \"csharp.y\"\r\n{ R(); yyval.expr\t\t\t= yyvsp[-1].expr;\tyyval.tmpValue = 0;\t;\r\n    break;}\r\ncase 451:\r\n#line 1138 \"csharp.y\"\r\n{ R(); yyval.expr\t\t\t= yyvsp[-1].expr;\tyyval.tmpValue = 1;\t;\r\n    break;}\r\ncase 452:\r\n#line 1154 \"csharp.y\"\r\n{ R();\r\n\t\tgCurrentMethod = gCurrentAC->addDestructor(\r\n\t\t\tyyvsp[-6].attribute,\t// Attributes\r\n\t\t\tyyvsp[-6].tmpValue,\t// Modifier\r\n\t\t\tyyvsp[-4].text,\t\t// Func Name\r\n\t\t\tyyvsp[0].statement\r\n\t\t);\r\n  ;\r\n    break;}\r\ncase 453:\r\n#line 1164 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement;\t;\r\n    break;}\r\ncase 454:\r\n#line 1165 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t\t\t;\r\n    break;}\r\ncase 455:\r\n#line 1168 \"csharp.y\"\r\n{ R(); yyval.statement = yyvsp[0].statement;\t;\r\n    break;}\r\ncase 456:\r\n#line 1169 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t\t\t;\r\n    break;}\r\ncase 457:\r\n#line 1174 \"csharp.y\"\r\n{ R(); \tgCurrentAC = CreateStruct(\tyyvsp[-3].attribute, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-2].tmpValue, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[0].text\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t); \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 458:\r\n#line 1179 \"csharp.y\"\r\n{ R(); unuseNameSpace(); ;\r\n    break;}\r\ncase 459:\r\n#line 1182 \"csharp.y\"\r\n{ R(); /* Do nothing */ \t;\r\n    break;}\r\ncase 460:\r\n#line 1183 \"csharp.y\"\r\n{ R(); /* Do nothing */ \t;\r\n    break;}\r\ncase 461:\r\n#line 1186 \"csharp.y\"\r\n{ R(); /* Do nothing */ \t;\r\n    break;}\r\ncase 462:\r\n#line 1189 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 463:\r\n#line 1192 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 464:\r\n#line 1193 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 465:\r\n#line 1196 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 466:\r\n#line 1197 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 467:\r\n#line 1200 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 468:\r\n#line 1201 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 469:\r\n#line 1202 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 470:\r\n#line 1203 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 471:\r\n#line 1204 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 472:\r\n#line 1205 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 473:\r\n#line 1206 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 474:\r\n#line 1207 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 475:\r\n#line 1209 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 476:\r\n#line 1214 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-1].expr; \t;\r\n    break;}\r\ncase 477:\r\n#line 1215 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-2].expr; \t;\r\n    break;}\r\ncase 478:\r\n#line 1218 \"csharp.y\"\r\n{ R(); yyval.expr = NULL; \t\t;\r\n    break;}\r\ncase 479:\r\n#line 1219 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr;\t;\r\n    break;}\r\ncase 480:\r\n#line 1222 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr;\t;\r\n    break;}\r\ncase 481:\r\n#line 1223 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-2].expr->addExpression(yyvsp[-1].expr); ;\r\n    break;}\r\ncase 482:\r\n#line 1228 \"csharp.y\"\r\n{ R(); \tgCurrentAC = CreateInterface(\tyyvsp[-3].attribute, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[-2].tmpValue, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyyvsp[0].text);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\r\n    break;}\r\ncase 483:\r\n#line 1233 \"csharp.y\"\r\n{ R();  unuseNameSpace(); ;\r\n    break;}\r\ncase 484:\r\n#line 1236 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 485:\r\n#line 1237 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 486:\r\n#line 1240 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 487:\r\n#line 1243 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 488:\r\n#line 1246 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 489:\r\n#line 1247 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 490:\r\n#line 1250 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 491:\r\n#line 1251 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 492:\r\n#line 1254 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 493:\r\n#line 1255 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 494:\r\n#line 1256 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 495:\r\n#line 1257 \"csharp.y\"\r\n{ R(); /* Do nothing */\t;\r\n    break;}\r\ncase 496:\r\n#line 1261 \"csharp.y\"\r\n{ R();\r\n\t\tgCurrentMethod = gCurrentAC->addMethod(\r\n\t\t\tyyvsp[-7].attribute,\t// Attributes\r\n\t\t\tyyvsp[-6].tmpValue,\r\n\t\t\tyyvsp[-4].text,\t\t// Func Name\r\n\t\t\tyyvsp[-2].variable,\t// Link list of variable\r\n\t\t\tyyvsp[0].statement,\t// Code\r\n\t\t\tyyvsp[-5].type\t\t\t// Return value.\r\n\t\t);\t\r\n\t;\r\n    break;}\r\ncase 497:\r\n#line 1271 \"csharp.y\"\r\n{ R();\r\n\t\tgCurrentMethod = gCurrentAC->addMethod(\r\n\t\t\tyyvsp[-7].attribute,\t// Attributes\r\n\t\t\tyyvsp[-6].tmpValue,\r\n\t\t\tyyvsp[-4].text,\t\t// Func Name\r\n\t\t\tyyvsp[-2].variable,\t// Link list of variable\r\n\t\t\tyyvsp[0].statement,\t// Code\r\n\t\t\tTypeObject::getTypeObject(TYPE_VOID)\t// Return value.\r\n\t\t);\r\n\t;\r\n    break;}\r\ncase 498:\r\n#line 1283 \"csharp.y\"\r\n{ R(); yyval.tmpValue = 0; \t\t\t;\r\n    break;}\r\ncase 499:\r\n#line 1284 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTR_NEW; \t;\r\n    break;}\r\ncase 500:\r\n#line 1290 \"csharp.y\"\r\n{ R(); gCurrentAC->addProperty(yyvsp[-8].attribute, yyvsp[-7].tmpValue, yyvsp[-6].type, yyvsp[-5].text, yyvsp[-2].accessor);\t;\r\n    break;}\r\ncase 501:\r\n#line 1297 \"csharp.y\"\r\n{ R(); gCurrentAC->addProperty(yyvsp[-11].attribute, yyvsp[-10].tmpValue, yyvsp[-9].type, yyvsp[-8].text, yyvsp[-5].accessor);\t;\r\n    break;}\r\ncase 502:\r\n#line 1301 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor(CreateAccessor(yyvsp[-2].attribute,NULL), NULL); ;\r\n    break;}\r\ncase 503:\r\n#line 1302 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor(NULL, CreateAccessor(yyvsp[-2].attribute,NULL)); ;\r\n    break;}\r\ncase 504:\r\n#line 1303 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor(CreateAccessor(yyvsp[-5].attribute,NULL), CreateAccessor(yyvsp[-2].attribute,NULL)); ;\r\n    break;}\r\ncase 505:\r\n#line 1304 \"csharp.y\"\r\n{ R(); yyval.accessor = CreateAccessor(CreateAccessor(yyvsp[-2].attribute,NULL), CreateAccessor(yyvsp[-5].attribute,NULL)); ;\r\n    break;}\r\ncase 506:\r\n#line 1307 \"csharp.y\"\r\n{ R(); compilerError(UNSUPPORTED,\"event not supported\"); ;\r\n    break;}\r\ncase 507:\r\n#line 1312 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t;\r\n    break;}\r\ncase 508:\r\n#line 1313 \"csharp.y\"\r\n{ R(); yyval.statement = NULL;\t;\r\n    break;}\r\ncase 509:\r\n#line 1318 \"csharp.y\"\r\n{ R();\r\n\t\tgCurrEnum = CreateEnum(yyvsp[-4].attribute, yyvsp[-3].tmpValue, yyvsp[-1].text, yyvsp[0].type);\r\n  ;\r\n    break;}\r\ncase 510:\r\n#line 1320 \"csharp.y\"\r\n{ R();\r\n\t// Do nothing.\r\n  ;\r\n    break;}\r\ncase 511:\r\n#line 1325 \"csharp.y\"\r\n{ R(); yyval.type = NULL;    ;\r\n    break;}\r\ncase 512:\r\n#line 1326 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; ;\r\n    break;}\r\ncase 513:\r\n#line 1329 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-1].type; ;\r\n    break;}\r\ncase 514:\r\n#line 1332 \"csharp.y\"\r\n{ R(); /* Do nothing */ ;\r\n    break;}\r\ncase 515:\r\n#line 1333 \"csharp.y\"\r\n{ R(); /* Do nothing */ ;\r\n    break;}\r\ncase 517:\r\n#line 1337 \"csharp.y\"\r\n{ R(); /* Do nothing */ ;\r\n    break;}\r\ncase 518:\r\n#line 1340 \"csharp.y\"\r\n{ R(); /* Do nothing */ ;\r\n    break;}\r\ncase 519:\r\n#line 1341 \"csharp.y\"\r\n{ R(); /* Do nothing */ ;\r\n    break;}\r\ncase 520:\r\n#line 1344 \"csharp.y\"\r\n{ R(); gCurrEnum->addEntry(yyvsp[-1].attribute, yyvsp[0].text, NULL); ;\r\n    break;}\r\ncase 521:\r\n#line 1345 \"csharp.y\"\r\n{ R(); gCurrEnum->addEntry(yyvsp[-3].attribute, yyvsp[-2].text, yyvsp[0].expr); ;\r\n    break;}\r\ncase 522:\r\n#line 1351 \"csharp.y\"\r\n{ R(); /* TODO V Delegate */ ;\r\n    break;}\r\ncase 523:\r\n#line 1356 \"csharp.y\"\r\n{ R(); yyval.attribute = yyvsp[0].attribute; ;\r\n    break;}\r\ncase 524:\r\n#line 1359 \"csharp.y\"\r\n{ R(); yyval.attribute = CreateAttributeWithChild(yyvsp[0].attribute); \t\t;\r\n    break;}\r\ncase 525:\r\n#line 1360 \"csharp.y\"\r\n{ R(); yyval.attribute = yyvsp[-1].attribute->addChildAttribute(yyvsp[0].attribute); ;\r\n    break;}\r\ncase 526:\r\n#line 1364 \"csharp.y\"\r\n{ R();\tyyval.attribute = yyvsp[-2].attribute->setSpecifier(yyvsp[-3].tmpValue); ;\r\n    break;}\r\ncase 527:\r\n#line 1366 \"csharp.y\"\r\n{ R();\tyyval.attribute = yyvsp[-3].attribute->setSpecifier(yyvsp[-4].tmpValue); ;\r\n    break;}\r\ncase 528:\r\n#line 1369 \"csharp.y\"\r\n{ R(); yyval.tmpValue = 0; \t\t\t\t\t;\r\n    break;}\r\ncase 529:\r\n#line 1370 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[0].tmpValue; \t\t;\r\n    break;}\r\ncase 530:\r\n#line 1373 \"csharp.y\"\r\n{ R(); yyval.tmpValue = yyvsp[-1].tmpValue; \t\t;\r\n    break;}\r\ncase 531:\r\n#line 1376 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_ASSEMBLY ; \t;\r\n    break;}\r\ncase 532:\r\n#line 1377 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_FIELD;\t\t;\r\n    break;}\r\ncase 533:\r\n#line 1378 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_EVENT;\t\t;\r\n    break;}\r\ncase 534:\r\n#line 1379 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_METHOD;\t\t;\r\n    break;}\r\ncase 535:\r\n#line 1380 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_MODULE;\t\t;\r\n    break;}\r\ncase 536:\r\n#line 1381 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_PARAM;\t\t;\r\n    break;}\r\ncase 537:\r\n#line 1382 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_PROPERTY;\t;\r\n    break;}\r\ncase 538:\r\n#line 1383 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_RETURN;\t\t;\r\n    break;}\r\ncase 539:\r\n#line 1384 \"csharp.y\"\r\n{ R(); yyval.tmpValue = ATTRB_TYPE;\t\t;\r\n    break;}\r\ncase 540:\r\n#line 1387 \"csharp.y\"\r\n{ R(); yyval.attribute = CreateAttribute(yyvsp[0].type, yyvsp[0].expr);\t\t\t\t;\r\n    break;}\r\ncase 541:\r\n#line 1388 \"csharp.y\"\r\n{ R(); yyval.attribute = yyvsp[-2].attribute->addAttribute(yyvsp[0].type, yyvsp[0].expr); ;\r\n    break;}\r\ncase 542:\r\n#line 1391 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[-1].type; yyval.expr= yyvsp[0].expr; ;\r\n    break;}\r\ncase 543:\r\n#line 1394 \"csharp.y\"\r\n{ R(); yyval.expr = NULL; \t\t;\r\n    break;}\r\ncase 544:\r\n#line 1395 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[0].expr ; \t;\r\n    break;}\r\ncase 545:\r\n#line 1398 \"csharp.y\"\r\n{ R(); yyval.type = yyvsp[0].type; \t;\r\n    break;}\r\ncase 546:\r\n#line 1401 \"csharp.y\"\r\n{ R(); yyval.expr = yyvsp[-2].expr ; \t;\r\n    break;}\r\ncase 547:\r\n#line 1408 \"csharp.y\"\r\n{ R(); lex_enter_attrib(); \t/*Do nothing*/ ;\r\n    break;}\r\ncase 548:\r\n#line 1411 \"csharp.y\"\r\n{ R(); lex_exit_attrib(); \t/*Do nothing*/ ;\r\n    break;}\r\ncase 549:\r\n#line 1414 \"csharp.y\"\r\n{ R(); lex_enter_accessor();\t/*Do nothing*/ ;\r\n    break;}\r\ncase 550:\r\n#line 1417 \"csharp.y\"\r\n{ R(); lex_exit_accessor();\t/*Do nothing*/ ;\r\n    break;}\r\ncase 551:\r\n#line 1420 \"csharp.y\"\r\n{ R(); lex_enter_getset();\t/*Do nothing*/ ;\r\n    break;}\r\ncase 552:\r\n#line 1423 \"csharp.y\"\r\n{ R(); lex_exit_getset();\t/*Do nothing*/ ;\r\n    break;}\r\n}\r\n   /* the action file gets copied in in place of this dollarsign */\r\n#line 487 \"bison.simple\"\r\n\f\r\n  yyvsp -= yylen;\r\n  yyssp -= yylen;\r\n#ifdef YYLSP_NEEDED\r\n  yylsp -= yylen;\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    {\r\n      short *ssp1 = yyss - 1;\r\n      fprintf (stderr, \"state stack now\");\r\n      while (ssp1 != yyssp)\r\n\tfprintf (stderr, \" %d\", *++ssp1);\r\n      fprintf (stderr, \"\\n\");\r\n    }\r\n#endif\r\n\r\n  *++yyvsp = yyval;\r\n\r\n#ifdef YYLSP_NEEDED\r\n  yylsp++;\r\n  if (yylen == 0)\r\n    {\r\n      yylsp->first_line = yylloc.first_line;\r\n      yylsp->first_column = yylloc.first_column;\r\n      yylsp->last_line = (yylsp-1)->last_line;\r\n      yylsp->last_column = (yylsp-1)->last_column;\r\n      yylsp->text = 0;\r\n    }\r\n  else\r\n    {\r\n      yylsp->last_line = (yylsp+yylen-1)->last_line;\r\n      yylsp->last_column = (yylsp+yylen-1)->last_column;\r\n    }\r\n#endif\r\n\r\n  /* Now \"shift\" the result of the reduction.\r\n     Determine what state that goes to,\r\n     based on the state we popped back to\r\n     and the rule number reduced by.  */\r\n\r\n  yyn = yyr1[yyn];\r\n\r\n  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;\r\n  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)\r\n    yystate = yytable[yystate];\r\n  else\r\n    yystate = yydefgoto[yyn - YYNTBASE];\r\n\r\n  goto yynewstate;\r\n\r\nyyerrlab:   /* here on detecting error */\r\n\r\n  if (! yyerrstatus)\r\n    /* If not already recovering from an error, report this error.  */\r\n    {\r\n      ++yynerrs;\r\n\r\n#ifdef YYERROR_VERBOSE\r\n      yyn = yypact[yystate];\r\n\r\n      if (yyn > YYFLAG && yyn < YYLAST)\r\n\t{\r\n\t  int size = 0;\r\n\t  char *msg;\r\n\t  int x, count;\r\n\r\n\t  count = 0;\r\n\t  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */\r\n\t  for (x = (yyn < 0 ? -yyn : 0);\r\n\t       x < (sizeof(yytname) / sizeof(char *)); x++)\r\n\t    if (yycheck[x + yyn] == x)\r\n\t      size += strlen(yytname[x]) + 15, count++;\r\n\t  msg = (char *) malloc(size + 15);\r\n\t  if (msg != 0)\r\n\t    {\r\n\t      strcpy(msg, \"parse error\");\r\n\r\n\t      if (count < 5)\r\n\t\t{\r\n\t\t  count = 0;\r\n\t\t  for (x = (yyn < 0 ? -yyn : 0);\r\n\t\t       x < (sizeof(yytname) / sizeof(char *)); x++)\r\n\t\t    if (yycheck[x + yyn] == x)\r\n\t\t      {\r\n\t\t\tstrcat(msg, count == 0 ? \", expecting `\" : \" or `\");\r\n\t\t\tstrcat(msg, yytname[x]);\r\n\t\t\tstrcat(msg, \"'\");\r\n\t\t\tcount++;\r\n\t\t      }\r\n\t\t}\r\n\t      yyerror(msg);\r\n\t      free(msg);\r\n\t    }\r\n\t  else\r\n\t    yyerror (\"parse error; also virtual memory exceeded\");\r\n\t}\r\n      else\r\n#endif /* YYERROR_VERBOSE */\r\n\tyyerror(\"parse error\");\r\n    }\r\n\r\n  goto yyerrlab1;\r\nyyerrlab1:   /* here on error raised explicitly by an action */\r\n\r\n  if (yyerrstatus == 3)\r\n    {\r\n      /* if just tried and failed to reuse lookahead token after an error, discard it.  */\r\n\r\n      /* return failure if at end of input */\r\n      if (yychar == YYEOF)\r\n\tYYABORT;\r\n\r\n#if YYDEBUG != 0\r\n      if (yydebug)\r\n\tfprintf(stderr, \"Discarding token %d (%s).\\n\", yychar, yytname[yychar1]);\r\n#endif\r\n\r\n      yychar = YYEMPTY;\r\n    }\r\n\r\n  /* Else will try to reuse lookahead token\r\n     after shifting the error token.  */\r\n\r\n  yyerrstatus = 3;\t\t/* Each real token shifted decrements this */\r\n\r\n  goto yyerrhandle;\r\n\r\nyyerrdefault:  /* current state does not do anything special for the error token. */\r\n\r\n#if 0\r\n  /* This is wrong; only states that explicitly want error tokens\r\n     should shift them.  */\r\n  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/\r\n  if (yyn) goto yydefault;\r\n#endif\r\n\r\nyyerrpop:   /* pop the current state because it cannot handle the error token */\r\n\r\n  if (yyssp == yyss) YYABORT;\r\n  yyvsp--;\r\n  yystate = *--yyssp;\r\n#ifdef YYLSP_NEEDED\r\n  yylsp--;\r\n#endif\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    {\r\n      short *ssp1 = yyss - 1;\r\n      fprintf (stderr, \"Error: state stack now\");\r\n      while (ssp1 != yyssp)\r\n\tfprintf (stderr, \" %d\", *++ssp1);\r\n      fprintf (stderr, \"\\n\");\r\n    }\r\n#endif\r\n\r\nyyerrhandle:\r\n\r\n  yyn = yypact[yystate];\r\n  if (yyn == YYFLAG)\r\n    goto yyerrdefault;\r\n\r\n  yyn += YYTERROR;\r\n  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)\r\n    goto yyerrdefault;\r\n\r\n  yyn = yytable[yyn];\r\n  if (yyn < 0)\r\n    {\r\n      if (yyn == YYFLAG)\r\n\tgoto yyerrpop;\r\n      yyn = -yyn;\r\n      goto yyreduce;\r\n    }\r\n  else if (yyn == 0)\r\n    goto yyerrpop;\r\n\r\n  if (yyn == YYFINAL)\r\n    YYACCEPT;\r\n\r\n#if YYDEBUG != 0\r\n  if (yydebug)\r\n    fprintf(stderr, \"Shifting error token, \");\r\n#endif\r\n\r\n  *++yyvsp = yylval;\r\n#ifdef YYLSP_NEEDED\r\n  *++yylsp = yylloc;\r\n#endif\r\n\r\n  yystate = yyn;\r\n  goto yynewstate;\r\n}\r\n#line 1427 \"csharp.y\"\r\n\r\n\r\n#include <stdio.h>\r\n#include \"lexParser.inc\"\r\n\r\nint runCompiler(const char *str)\r\n{\r\n\t//\r\n\t// Setup to avoid using files in Lex\r\n\t//\r\n\tYY_BUFFER_STATE pState = yy_scan_string(str);\r\n\tyy_switch_to_buffer(pState);\r\n\r\n\tyyparse();\r\n\r\n\t//\r\n\t// Destroy lex read context.\r\n\t//\r\n\tyy_delete_buffer(pState);\r\n\r\n\treturn 0;\r\n}\r\n\r\n\r\nvoid yyerror(const char* s) {\r\n  fprintf(stdout,\"%d:%s LA=[%s]\\n\",yylineno,s,yytname[YYTRANSLATE(yychar)]);\r\n  while (1) {\r\n\t// Endless loop.\r\n  }\r\n}\r\n\r\nint isatty(int fildes) {\r\n\treturn 1;\t// unistd descriptor used by parser, but we use memory stream. Always 1.\r\n}\r\n\r\nvoid error (const char* msg,...) {\r\n\tva_list\targp;\r\n\tchar pszBuf [1024];\r\n\tchar log [1024];\r\n\r\n\tva_start(argp, msg);\r\n\tVSPRINTF( pszBuf, msg, argp);\r\n\tva_end(argp);\r\n\r\n\tSPRINTF(log, \"Line %i : %s @%s\\n\", yylineno, pszBuf, yytext);\r\n\r\n\tprintf(log);\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/csharpcompiler.cpp.output",
    "content": "State 515 contains 1 reduce/reduce conflict.\r\nState 793 contains 1 shift/reduce conflict.\r\n\r\nGrammar\r\nrule 1    literal -> boolean_literal\r\nrule 2    literal -> INTEGER_LITERAL\r\nrule 3    literal -> REAL_LITERAL\r\nrule 4    literal -> CHARACTER_LITERAL\r\nrule 5    literal -> STRING_LITERAL\r\nrule 6    literal -> NULL_LITERAL\r\nrule 7    boolean_literal -> TRUE\r\nrule 8    boolean_literal -> FALSE\r\nrule 9    namespace_name -> qualified_identifier\r\nrule 10   type_name -> qualified_identifier\r\nrule 11   type -> non_array_type\r\nrule 12   type -> array_type\r\nrule 13   non_array_type -> simple_type\r\nrule 14   non_array_type -> type_name\r\nrule 15   simple_type -> primitive_type\r\nrule 16   simple_type -> class_type\r\nrule 17   simple_type -> pointer_type\r\nrule 18   primitive_type -> numeric_type\r\nrule 19   primitive_type -> BOOL\r\nrule 20   numeric_type -> integral_type\r\nrule 21   numeric_type -> floating_point_type\r\nrule 22   numeric_type -> DECIMAL\r\nrule 23   integral_type -> SBYTE\r\nrule 24   integral_type -> BYTE\r\nrule 25   integral_type -> SHORT\r\nrule 26   integral_type -> USHORT\r\nrule 27   integral_type -> INT\r\nrule 28   integral_type -> UINT\r\nrule 29   integral_type -> LONG\r\nrule 30   integral_type -> ULONG\r\nrule 31   integral_type -> CHAR\r\nrule 32   floating_point_type -> FLOAT\r\nrule 33   floating_point_type -> DOUBLE\r\nrule 34   class_type -> OBJECT\r\nrule 35   class_type -> STRING\r\nrule 36   pointer_type -> type '*'\r\nrule 37   pointer_type -> VOID '*'\r\nrule 38   array_type -> array_type rank_specifier\r\nrule 39   array_type -> simple_type rank_specifier\r\nrule 40   array_type -> qualified_identifier rank_specifier\r\nrule 41   rank_specifiers_opt ->\t\t/* empty */\r\nrule 42   rank_specifiers_opt -> rank_specifier rank_specifiers_opt\r\nrule 43   rank_specifier -> RANK_SPECIFIER\r\nrule 44   variable_reference -> expression\r\nrule 45   argument_list -> argument\r\nrule 46   argument_list -> argument_list COMMA argument\r\nrule 47   argument -> expression\r\nrule 48   argument -> REF variable_reference\r\nrule 49   argument -> OUT variable_reference\r\nrule 50   primary_expression -> parenthesized_expression\r\nrule 51   primary_expression -> primary_expression_no_parenthesis\r\nrule 52   primary_expression_no_parenthesis -> literal\r\nrule 53   primary_expression_no_parenthesis -> array_creation_expression\r\nrule 54   primary_expression_no_parenthesis -> member_access\r\nrule 55   primary_expression_no_parenthesis -> invocation_expression\r\nrule 56   primary_expression_no_parenthesis -> element_access\r\nrule 57   primary_expression_no_parenthesis -> this_access\r\nrule 58   primary_expression_no_parenthesis -> base_access\r\nrule 59   primary_expression_no_parenthesis -> new_expression\r\nrule 60   primary_expression_no_parenthesis -> typeof_expression\r\nrule 61   primary_expression_no_parenthesis -> sizeof_expression\r\nrule 62   primary_expression_no_parenthesis -> checked_expression\r\nrule 63   primary_expression_no_parenthesis -> unchecked_expression\r\nrule 64   parenthesized_expression -> '(' expression ')'\r\nrule 65   member_access -> primary_expression '.' IDENTIFIER\r\nrule 66   member_access -> primitive_type '.' IDENTIFIER\r\nrule 67   member_access -> class_type '.' IDENTIFIER\r\nrule 68   invocation_expression -> primary_expression_no_parenthesis '(' argument_list_opt ')'\r\nrule 69   invocation_expression -> qualified_identifier '(' argument_list_opt ')'\r\nrule 70   argument_list_opt ->\t\t/* empty */\r\nrule 71   argument_list_opt -> argument_list\r\nrule 72   element_access -> primary_expression LEFT_BRACKET expression_list RIGHT_BRACKET\r\nrule 73   element_access -> qualified_identifier LEFT_BRACKET expression_list RIGHT_BRACKET\r\nrule 74   expression_list_opt ->\t\t/* empty */\r\nrule 75   expression_list_opt -> expression_list\r\nrule 76   expression_list -> expression\r\nrule 77   expression_list -> expression_list COMMA expression\r\nrule 78   this_access -> THIS\r\nrule 79   base_access -> BASE '.' IDENTIFIER\r\nrule 80   base_access -> BASE LEFT_BRACKET expression_list RIGHT_BRACKET\r\nrule 81   post_increment_expression -> postfix_expression PLUSPLUS\r\nrule 82   post_decrement_expression -> postfix_expression MINUSMINUS\r\nrule 83   new_expression -> object_creation_expression\r\nrule 84   object_creation_expression -> NEW type '(' argument_list_opt ')'\r\nrule 85   array_creation_expression -> NEW non_array_type LEFT_BRACKET expression_list RIGHT_BRACKET rank_specifiers_opt array_initializer_opt\r\nrule 86   array_creation_expression -> NEW array_type array_initializer\r\nrule 87   array_initializer_opt ->\t\t/* empty */\r\nrule 88   array_initializer_opt -> array_initializer\r\nrule 89   typeof_expression -> TYPEOF '(' type ')'\r\nrule 90   typeof_expression -> TYPEOF '(' VOID ')'\r\nrule 91   checked_expression -> CHECKED '(' expression ')'\r\nrule 92   unchecked_expression -> UNCHECKED '(' expression ')'\r\nrule 93   pointer_member_access -> postfix_expression ARROW IDENTIFIER\r\nrule 94   addressof_expression -> '&' unary_expression\r\nrule 95   sizeof_expression -> SIZEOF '(' type ')'\r\nrule 96   postfix_expression -> primary_expression\r\nrule 97   postfix_expression -> qualified_identifier\r\nrule 98   postfix_expression -> post_increment_expression\r\nrule 99   postfix_expression -> post_decrement_expression\r\nrule 100  postfix_expression -> pointer_member_access\r\nrule 101  unary_expression_not_plusminus -> postfix_expression\r\nrule 102  unary_expression_not_plusminus -> '!' unary_expression\r\nrule 103  unary_expression_not_plusminus -> '~' unary_expression\r\nrule 104  unary_expression_not_plusminus -> cast_expression\r\nrule 105  pre_increment_expression -> PLUSPLUS unary_expression\r\nrule 106  pre_decrement_expression -> MINUSMINUS unary_expression\r\nrule 107  unary_expression -> unary_expression_not_plusminus\r\nrule 108  unary_expression -> '+' unary_expression\r\nrule 109  unary_expression -> '-' unary_expression\r\nrule 110  unary_expression -> '*' unary_expression\r\nrule 111  unary_expression -> pre_increment_expression\r\nrule 112  unary_expression -> pre_decrement_expression\r\nrule 113  unary_expression -> addressof_expression\r\nrule 114  cast_expression -> '(' expression ')' unary_expression_not_plusminus\r\nrule 115  cast_expression -> '(' multiplicative_expression '*' ')' unary_expression\r\nrule 116  cast_expression -> '(' qualified_identifier rank_specifier type_quals_opt ')' unary_expression\r\nrule 117  cast_expression -> '(' primitive_type type_quals_opt ')' unary_expression\r\nrule 118  cast_expression -> '(' class_type type_quals_opt ')' unary_expression\r\nrule 119  cast_expression -> '(' VOID type_quals_opt ')' unary_expression\r\nrule 120  type_quals_opt ->\t\t/* empty */\r\nrule 121  type_quals_opt -> type_quals\r\nrule 122  type_quals -> type_qual\r\nrule 123  type_quals -> type_quals type_qual\r\nrule 124  type_qual -> rank_specifier\r\nrule 125  type_qual -> '*'\r\nrule 126  multiplicative_expression -> unary_expression\r\nrule 127  multiplicative_expression -> multiplicative_expression '*' unary_expression\r\nrule 128  multiplicative_expression -> multiplicative_expression '/' unary_expression\r\nrule 129  multiplicative_expression -> multiplicative_expression '%' unary_expression\r\nrule 130  additive_expression -> multiplicative_expression\r\nrule 131  additive_expression -> additive_expression '+' multiplicative_expression\r\nrule 132  additive_expression -> additive_expression '-' multiplicative_expression\r\nrule 133  shift_expression -> additive_expression\r\nrule 134  shift_expression -> shift_expression LTLT additive_expression\r\nrule 135  shift_expression -> shift_expression GTGT additive_expression\r\nrule 136  relational_expression -> shift_expression\r\nrule 137  relational_expression -> relational_expression '<' shift_expression\r\nrule 138  relational_expression -> relational_expression '>' shift_expression\r\nrule 139  relational_expression -> relational_expression LEQ shift_expression\r\nrule 140  relational_expression -> relational_expression GEQ shift_expression\r\nrule 141  relational_expression -> relational_expression IS type\r\nrule 142  relational_expression -> relational_expression AS type\r\nrule 143  equality_expression -> relational_expression\r\nrule 144  equality_expression -> equality_expression EQEQ relational_expression\r\nrule 145  equality_expression -> equality_expression NOTEQ relational_expression\r\nrule 146  and_expression -> equality_expression\r\nrule 147  and_expression -> and_expression '&' equality_expression\r\nrule 148  exclusive_or_expression -> and_expression\r\nrule 149  exclusive_or_expression -> exclusive_or_expression '^' and_expression\r\nrule 150  inclusive_or_expression -> exclusive_or_expression\r\nrule 151  inclusive_or_expression -> inclusive_or_expression '|' exclusive_or_expression\r\nrule 152  conditional_and_expression -> inclusive_or_expression\r\nrule 153  conditional_and_expression -> conditional_and_expression ANDAND inclusive_or_expression\r\nrule 154  conditional_or_expression -> conditional_and_expression\r\nrule 155  conditional_or_expression -> conditional_or_expression OROR conditional_and_expression\r\nrule 156  conditional_expression -> conditional_or_expression\r\nrule 157  conditional_expression -> conditional_or_expression '?' expression ':' expression\r\nrule 158  assignment -> unary_expression assignment_operator expression\r\nrule 159  assignment_operator -> '='\r\nrule 160  assignment_operator -> PLUSEQ\r\nrule 161  assignment_operator -> MINUSEQ\r\nrule 162  assignment_operator -> STAREQ\r\nrule 163  assignment_operator -> DIVEQ\r\nrule 164  assignment_operator -> MODEQ\r\nrule 165  assignment_operator -> XOREQ\r\nrule 166  assignment_operator -> ANDEQ\r\nrule 167  assignment_operator -> OREQ\r\nrule 168  assignment_operator -> GTGTEQ\r\nrule 169  assignment_operator -> LTLTEQ\r\nrule 170  expression -> conditional_expression\r\nrule 171  expression -> assignment\r\nrule 172  constant_expression -> expression\r\nrule 173  boolean_expression -> expression\r\nrule 174  statement -> labeled_statement\r\nrule 175  statement -> declaration_statement\r\nrule 176  statement -> embedded_statement\r\nrule 177  embedded_statement -> block\r\nrule 178  embedded_statement -> empty_statement\r\nrule 179  embedded_statement -> expression_statement\r\nrule 180  embedded_statement -> selection_statement\r\nrule 181  embedded_statement -> iteration_statement\r\nrule 182  embedded_statement -> jump_statement\r\nrule 183  embedded_statement -> try_statement\r\nrule 184  embedded_statement -> checked_statement\r\nrule 185  embedded_statement -> unchecked_statement\r\nrule 186  embedded_statement -> lock_statement\r\nrule 187  embedded_statement -> using_statement\r\nrule 188  embedded_statement -> unsafe_statement\r\nrule 189  embedded_statement -> fixed_statement\r\nrule 190  block -> '{' statement_list_opt '}'\r\nrule 191  statement_list_opt ->\t\t/* empty */\r\nrule 192  statement_list_opt -> statement_list\r\nrule 193  statement_list -> statement\r\nrule 194  statement_list -> statement_list statement\r\nrule 195  empty_statement -> ';'\r\nrule 196  labeled_statement -> IDENTIFIER ':' statement\r\nrule 197  declaration_statement -> local_variable_declaration ';'\r\nrule 198  declaration_statement -> local_constant_declaration ';'\r\nrule 199  local_variable_declaration -> type variable_declarators\r\nrule 200  variable_declarators -> variable_declarator\r\nrule 201  variable_declarators -> variable_declarators COMMA variable_declarator\r\nrule 202  variable_declarator -> IDENTIFIER\r\nrule 203  variable_declarator -> IDENTIFIER '=' variable_initializer\r\nrule 204  variable_initializer -> expression\r\nrule 205  variable_initializer -> array_initializer\r\nrule 206  variable_initializer -> stackalloc_initializer\r\nrule 207  stackalloc_initializer -> STACKALLOC type LEFT_BRACKET expression RIGHT_BRACKET\r\nrule 208  local_constant_declaration -> CONST type constant_declarators\r\nrule 209  constant_declarators -> constant_declarator\r\nrule 210  constant_declarators -> constant_declarators COMMA constant_declarator\r\nrule 211  constant_declarator -> IDENTIFIER '=' constant_expression\r\nrule 212  expression_statement -> statement_expression ';'\r\nrule 213  statement_expression -> invocation_expression\r\nrule 214  statement_expression -> object_creation_expression\r\nrule 215  statement_expression -> assignment\r\nrule 216  statement_expression -> post_increment_expression\r\nrule 217  statement_expression -> post_decrement_expression\r\nrule 218  statement_expression -> pre_increment_expression\r\nrule 219  statement_expression -> pre_decrement_expression\r\nrule 220  selection_statement -> if_statement\r\nrule 221  selection_statement -> switch_statement\r\nrule 222  if_statement -> IF '(' boolean_expression ')' embedded_statement\r\nrule 223  if_statement -> IF '(' boolean_expression ')' embedded_statement ELSE embedded_statement\r\nrule 224  switch_statement -> SWITCH '(' expression ')' switch_block\r\nrule 225  switch_block -> '{' switch_sections_opt '}'\r\nrule 226  switch_sections_opt ->\t\t/* empty */\r\nrule 227  switch_sections_opt -> switch_sections\r\nrule 228  switch_sections -> switch_section\r\nrule 229  switch_sections -> switch_sections switch_section\r\nrule 230  switch_section -> switch_labels statement_list\r\nrule 231  switch_labels -> switch_label\r\nrule 232  switch_labels -> switch_labels switch_label\r\nrule 233  switch_label -> CASE constant_expression ':'\r\nrule 234  switch_label -> DEFAULT ':'\r\nrule 235  iteration_statement -> while_statement\r\nrule 236  iteration_statement -> do_statement\r\nrule 237  iteration_statement -> for_statement\r\nrule 238  iteration_statement -> foreach_statement\r\nrule 239  unsafe_statement -> UNSAFE block\r\nrule 240  while_statement -> WHILE '(' boolean_expression ')' embedded_statement\r\nrule 241  do_statement -> DO embedded_statement WHILE '(' boolean_expression ')' ';'\r\nrule 242  for_statement -> FOR '(' for_initializer_opt ';' for_condition_opt ';' for_iterator_opt ')' embedded_statement\r\nrule 243  for_initializer_opt ->\t\t/* empty */\r\nrule 244  for_initializer_opt -> for_initializer\r\nrule 245  for_condition_opt ->\t\t/* empty */\r\nrule 246  for_condition_opt -> for_condition\r\nrule 247  for_iterator_opt ->\t\t/* empty */\r\nrule 248  for_iterator_opt -> for_iterator\r\nrule 249  for_initializer -> local_variable_declaration\r\nrule 250  for_initializer -> statement_expression_list\r\nrule 251  for_condition -> boolean_expression\r\nrule 252  for_iterator -> statement_expression_list\r\nrule 253  statement_expression_list -> statement_expression\r\nrule 254  statement_expression_list -> statement_expression_list COMMA statement_expression\r\nrule 255  foreach_statement -> FOREACH '(' type IDENTIFIER IN expression ')' embedded_statement\r\nrule 256  jump_statement -> break_statement\r\nrule 257  jump_statement -> continue_statement\r\nrule 258  jump_statement -> goto_statement\r\nrule 259  jump_statement -> return_statement\r\nrule 260  jump_statement -> throw_statement\r\nrule 261  break_statement -> BREAK ';'\r\nrule 262  continue_statement -> CONTINUE ';'\r\nrule 263  goto_statement -> GOTO IDENTIFIER ';'\r\nrule 264  goto_statement -> GOTO CASE constant_expression ';'\r\nrule 265  goto_statement -> GOTO DEFAULT ';'\r\nrule 266  return_statement -> RETURN expression_opt ';'\r\nrule 267  expression_opt ->\t\t/* empty */\r\nrule 268  expression_opt -> expression\r\nrule 269  throw_statement -> THROW expression_opt ';'\r\nrule 270  try_statement -> TRY block catch_clauses\r\nrule 271  try_statement -> TRY block finally_clause\r\nrule 272  try_statement -> TRY block catch_clauses finally_clause\r\nrule 273  catch_clauses -> catch_clause\r\nrule 274  catch_clauses -> catch_clauses catch_clause\r\nrule 275  catch_clause -> CATCH '(' class_type identifier_opt ')' block\r\nrule 276  catch_clause -> CATCH '(' type_name identifier_opt ')' block\r\nrule 277  catch_clause -> CATCH block\r\nrule 278  identifier_opt ->\t\t/* empty */\r\nrule 279  identifier_opt -> IDENTIFIER\r\nrule 280  finally_clause -> FINALLY block\r\nrule 281  checked_statement -> CHECKED block\r\nrule 282  unchecked_statement -> UNCHECKED block\r\nrule 283  lock_statement -> LOCK '(' expression ')' embedded_statement\r\nrule 284  using_statement -> USING '(' resource_acquisition ')' embedded_statement\r\nrule 285  resource_acquisition -> local_variable_declaration\r\nrule 286  resource_acquisition -> expression\r\nrule 287  fixed_statement -> FIXED '(' type fixed_pointer_declarators ')' embedded_statement\r\nrule 288  fixed_pointer_declarators -> fixed_pointer_declarator\r\nrule 289  fixed_pointer_declarators -> fixed_pointer_declarators COMMA fixed_pointer_declarator\r\nrule 290  fixed_pointer_declarator -> IDENTIFIER '=' expression\r\nrule 291  compilation_unit -> using_directives_opt attributes_opt\r\nrule 292  compilation_unit -> using_directives_opt namespace_member_declarations\r\nrule 293  using_directives_opt ->\t\t/* empty */\r\nrule 294  using_directives_opt -> using_directives\r\nrule 295  attributes_opt ->\t\t/* empty */\r\nrule 296  attributes_opt -> attributes\r\nrule 297  namespace_member_declarations_opt ->\t\t/* empty */\r\nrule 298  namespace_member_declarations_opt -> namespace_member_declarations\r\nrule 299  namespace_declaration -> attributes_opt NAMESPACE qualified_identifier namespace_body comma_opt\r\nrule 300  comma_opt ->\t\t/* empty */\r\nrule 301  comma_opt -> ';'\r\nrule 302  qualified_identifier -> IDENTIFIER\r\nrule 303  qualified_identifier -> qualifier IDENTIFIER\r\nrule 304  qualifier -> IDENTIFIER '.'\r\nrule 305  qualifier -> qualifier IDENTIFIER '.'\r\nrule 306  namespace_body -> '{' using_directives_opt namespace_member_declarations_opt '}'\r\nrule 307  using_directives -> using_directive\r\nrule 308  using_directives -> using_directives using_directive\r\nrule 309  using_directive -> using_alias_directive\r\nrule 310  using_directive -> using_namespace_directive\r\nrule 311  using_alias_directive -> USING IDENTIFIER '=' qualified_identifier ';'\r\nrule 312  using_namespace_directive -> USING namespace_name ';'\r\nrule 313  namespace_member_declarations -> namespace_member_declaration\r\nrule 314  namespace_member_declarations -> namespace_member_declarations namespace_member_declaration\r\nrule 315  namespace_member_declaration -> namespace_declaration\r\nrule 316  namespace_member_declaration -> type_declaration\r\nrule 317  type_declaration -> class_declaration\r\nrule 318  type_declaration -> struct_declaration\r\nrule 319  type_declaration -> interface_declaration\r\nrule 320  type_declaration -> enum_declaration\r\nrule 321  type_declaration -> delegate_declaration\r\nrule 322  modifiers_opt ->\t\t/* empty */\r\nrule 323  modifiers_opt -> modifiers\r\nrule 324  modifiers -> modifier\r\nrule 325  modifiers -> modifiers modifier\r\nrule 326  modifier -> ABSTRACT\r\nrule 327  modifier -> EXTERN\r\nrule 328  modifier -> INTERNAL\r\nrule 329  modifier -> NEW\r\nrule 330  modifier -> OVERRIDE\r\nrule 331  modifier -> PRIVATE\r\nrule 332  modifier -> PROTECTED\r\nrule 333  modifier -> PUBLIC\r\nrule 334  modifier -> READONLY\r\nrule 335  modifier -> SEALED\r\nrule 336  modifier -> STATIC\r\nrule 337  modifier -> UNSAFE\r\nrule 338  modifier -> VIRTUAL\r\nrule 339  modifier -> VOLATILE\r\nrule 340  class_declaration -> attributes_opt modifiers_opt CLASS IDENTIFIER class_base_opt class_body comma_opt\r\nrule 341  class_base_opt ->\t\t/* empty */\r\nrule 342  class_base_opt -> class_base\r\nrule 343  class_base -> ':' class_type\r\nrule 344  class_base -> ':' interface_type_list\r\nrule 345  class_base -> ':' class_type COMMA interface_type_list\r\nrule 346  interface_type_list -> type_name\r\nrule 347  interface_type_list -> interface_type_list COMMA type_name\r\nrule 348  class_body -> '{' class_member_declarations_opt '}'\r\nrule 349  class_member_declarations_opt ->\t\t/* empty */\r\nrule 350  class_member_declarations_opt -> class_member_declarations\r\nrule 351  class_member_declarations -> class_member_declaration\r\nrule 352  class_member_declarations -> class_member_declarations class_member_declaration\r\nrule 353  class_member_declaration -> constant_declaration\r\nrule 354  class_member_declaration -> field_declaration\r\nrule 355  class_member_declaration -> method_declaration\r\nrule 356  class_member_declaration -> property_declaration\r\nrule 357  class_member_declaration -> event_declaration\r\nrule 358  class_member_declaration -> indexer_declaration\r\nrule 359  class_member_declaration -> operator_declaration\r\nrule 360  class_member_declaration -> constructor_declaration\r\nrule 361  class_member_declaration -> destructor_declaration\r\nrule 362  class_member_declaration -> type_declaration\r\nrule 363  constant_declaration -> attributes_opt modifiers_opt CONST type constant_declarators ';'\r\nrule 364  field_declaration -> attributes_opt modifiers_opt type variable_declarators ';'\r\nrule 365  method_declaration -> method_header method_body\r\nrule 366  method_header -> attributes_opt modifiers_opt type qualified_identifier '(' formal_parameter_list_opt ')'\r\nrule 367  method_header -> attributes_opt modifiers_opt VOID qualified_identifier '(' formal_parameter_list_opt ')'\r\nrule 368  formal_parameter_list_opt ->\t\t/* empty */\r\nrule 369  formal_parameter_list_opt -> formal_parameter_list\r\nrule 370  return_type -> type\r\nrule 371  return_type -> VOID\r\nrule 372  method_body -> block\r\nrule 373  method_body -> ';'\r\nrule 374  formal_parameter_list -> formal_parameter\r\nrule 375  formal_parameter_list -> formal_parameter_list COMMA formal_parameter\r\nrule 376  formal_parameter -> fixed_parameter\r\nrule 377  formal_parameter -> parameter_array\r\nrule 378  fixed_parameter -> attributes_opt parameter_modifier_opt type IDENTIFIER\r\nrule 379  parameter_modifier_opt ->\t\t/* empty */\r\nrule 380  parameter_modifier_opt -> REF\r\nrule 381  parameter_modifier_opt -> OUT\r\nrule 382  parameter_array -> attributes_opt PARAMS type IDENTIFIER\r\nrule 383  property_declaration -> attributes_opt modifiers_opt type qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset\r\nrule 384  accessor_declarations -> get_accessor_declaration set_accessor_declaration_opt\r\nrule 385  accessor_declarations -> set_accessor_declaration get_accessor_declaration_opt\r\nrule 386  set_accessor_declaration_opt ->\t\t/* empty */\r\nrule 387  set_accessor_declaration_opt -> set_accessor_declaration\r\nrule 388  get_accessor_declaration_opt ->\t\t/* empty */\r\nrule 389  get_accessor_declaration_opt -> get_accessor_declaration\r\nrule 390  get_accessor_declaration -> attributes_opt GET EXIT_getset accessor_body ENTER_getset\r\nrule 391  set_accessor_declaration -> attributes_opt SET EXIT_getset accessor_body ENTER_getset\r\nrule 392  accessor_body -> block\r\nrule 393  accessor_body -> ';'\r\nrule 394  event_declaration -> attributes_opt modifiers_opt EVENT type variable_declarators ';'\r\nrule 395  event_declaration -> attributes_opt modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl\r\nrule 396  event_accessor_declarations -> add_accessor_declaration remove_accessor_declaration\r\nrule 397  event_accessor_declarations -> remove_accessor_declaration add_accessor_declaration\r\nrule 398  add_accessor_declaration -> attributes_opt ADD EXIT_accessor_decl block ENTER_accessor_decl\r\nrule 399  remove_accessor_declaration -> attributes_opt REMOVE EXIT_accessor_decl block ENTER_accessor_decl\r\nrule 400  indexer_declaration -> attributes_opt modifiers_opt indexer_declarator ENTER_getset '{' accessor_declarations '}' EXIT_getset\r\nrule 401  indexer_declarator -> type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET\r\nrule 402  indexer_declarator -> type qualified_this LEFT_BRACKET formal_parameter_list RIGHT_BRACKET\r\nrule 403  qualified_this -> qualifier THIS\r\nrule 404  operator_declaration -> attributes_opt modifiers_opt operator_declarator operator_body\r\nrule 405  operator_declarator -> overloadable_operator_declarator\r\nrule 406  operator_declarator -> conversion_operator_declarator\r\nrule 407  overloadable_operator_declarator -> type OPERATOR overloadable_operator '(' type IDENTIFIER ')'\r\nrule 408  overloadable_operator_declarator -> type OPERATOR overloadable_operator '(' type IDENTIFIER COMMA type IDENTIFIER ')'\r\nrule 409  overloadable_operator -> '+'\r\nrule 410  overloadable_operator -> '-'\r\nrule 411  overloadable_operator -> '!'\r\nrule 412  overloadable_operator -> '~'\r\nrule 413  overloadable_operator -> PLUSPLUS\r\nrule 414  overloadable_operator -> MINUSMINUS\r\nrule 415  overloadable_operator -> TRUE\r\nrule 416  overloadable_operator -> FALSE\r\nrule 417  overloadable_operator -> '*'\r\nrule 418  overloadable_operator -> '/'\r\nrule 419  overloadable_operator -> '%'\r\nrule 420  overloadable_operator -> '&'\r\nrule 421  overloadable_operator -> '|'\r\nrule 422  overloadable_operator -> '^'\r\nrule 423  overloadable_operator -> LTLT\r\nrule 424  overloadable_operator -> GTGT\r\nrule 425  overloadable_operator -> EQEQ\r\nrule 426  overloadable_operator -> NOTEQ\r\nrule 427  overloadable_operator -> '>'\r\nrule 428  overloadable_operator -> '<'\r\nrule 429  overloadable_operator -> GEQ\r\nrule 430  overloadable_operator -> LEQ\r\nrule 431  conversion_operator_declarator -> IMPLICIT OPERATOR type '(' type IDENTIFIER ')'\r\nrule 432  conversion_operator_declarator -> EXPLICIT OPERATOR type '(' type IDENTIFIER ')'\r\nrule 433  constructor_declaration -> attributes_opt modifiers_opt constructor_declarator constructor_body\r\nrule 434  constructor_declarator -> IDENTIFIER '(' formal_parameter_list_opt ')' constructor_initializer_opt\r\nrule 435  constructor_initializer_opt ->\t\t/* empty */\r\nrule 436  constructor_initializer_opt -> constructor_initializer\r\nrule 437  constructor_initializer -> ':' BASE '(' argument_list_opt ')'\r\nrule 438  constructor_initializer -> ':' THIS '(' argument_list_opt ')'\r\nrule 439  destructor_declaration -> attributes_opt modifiers_opt '~' IDENTIFIER '(' ')' block\r\nrule 440  operator_body -> block\r\nrule 441  operator_body -> ';'\r\nrule 442  constructor_body -> block\r\nrule 443  constructor_body -> ';'\r\nrule 444  struct_declaration -> attributes_opt modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt\r\nrule 445  struct_interfaces_opt ->\t\t/* empty */\r\nrule 446  struct_interfaces_opt -> struct_interfaces\r\nrule 447  struct_interfaces -> ':' interface_type_list\r\nrule 448  struct_body -> '{' struct_member_declarations_opt '}'\r\nrule 449  struct_member_declarations_opt ->\t\t/* empty */\r\nrule 450  struct_member_declarations_opt -> struct_member_declarations\r\nrule 451  struct_member_declarations -> struct_member_declaration\r\nrule 452  struct_member_declarations -> struct_member_declarations struct_member_declaration\r\nrule 453  struct_member_declaration -> constant_declaration\r\nrule 454  struct_member_declaration -> field_declaration\r\nrule 455  struct_member_declaration -> method_declaration\r\nrule 456  struct_member_declaration -> property_declaration\r\nrule 457  struct_member_declaration -> event_declaration\r\nrule 458  struct_member_declaration -> indexer_declaration\r\nrule 459  struct_member_declaration -> operator_declaration\r\nrule 460  struct_member_declaration -> constructor_declaration\r\nrule 461  struct_member_declaration -> type_declaration\r\nrule 462  array_initializer -> '{' variable_initializer_list_opt '}'\r\nrule 463  array_initializer -> '{' variable_initializer_list COMMA '}'\r\nrule 464  variable_initializer_list_opt ->\t\t/* empty */\r\nrule 465  variable_initializer_list_opt -> variable_initializer_list\r\nrule 466  variable_initializer_list -> variable_initializer\r\nrule 467  variable_initializer_list -> variable_initializer_list COMMA variable_initializer\r\nrule 468  interface_declaration -> attributes_opt modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt\r\nrule 469  interface_base_opt ->\t\t/* empty */\r\nrule 470  interface_base_opt -> interface_base\r\nrule 471  interface_base -> ':' interface_type_list\r\nrule 472  interface_body -> '{' interface_member_declarations_opt '}'\r\nrule 473  interface_member_declarations_opt ->\t\t/* empty */\r\nrule 474  interface_member_declarations_opt -> interface_member_declarations\r\nrule 475  interface_member_declarations -> interface_member_declaration\r\nrule 476  interface_member_declarations -> interface_member_declarations interface_member_declaration\r\nrule 477  interface_member_declaration -> interface_method_declaration\r\nrule 478  interface_member_declaration -> interface_property_declaration\r\nrule 479  interface_member_declaration -> interface_event_declaration\r\nrule 480  interface_member_declaration -> interface_indexer_declaration\r\nrule 481  interface_method_declaration -> attributes_opt new_opt type IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body\r\nrule 482  interface_method_declaration -> attributes_opt new_opt VOID IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body\r\nrule 483  new_opt ->\t\t/* empty */\r\nrule 484  new_opt -> NEW\r\nrule 485  interface_property_declaration -> attributes_opt new_opt type IDENTIFIER ENTER_getset '{' interface_accessors '}' EXIT_getset\r\nrule 486  interface_indexer_declaration -> attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset\r\nrule 487  interface_accessors -> attributes_opt GET interface_empty_body\r\nrule 488  interface_accessors -> attributes_opt SET interface_empty_body\r\nrule 489  interface_accessors -> attributes_opt GET interface_empty_body attributes_opt SET interface_empty_body\r\nrule 490  interface_accessors -> attributes_opt SET interface_empty_body attributes_opt GET interface_empty_body\r\nrule 491  interface_event_declaration -> attributes_opt new_opt EVENT type IDENTIFIER interface_empty_body\r\nrule 492  interface_empty_body -> ';'\r\nrule 493  interface_empty_body -> '{' '}'\r\nrule 494  enum_declaration -> attributes_opt modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body comma_opt\r\nrule 495  enum_base_opt ->\t\t/* empty */\r\nrule 496  enum_base_opt -> enum_base\r\nrule 497  enum_base -> ':' integral_type\r\nrule 498  enum_body -> '{' enum_member_declarations_opt '}'\r\nrule 499  enum_body -> '{' enum_member_declarations COMMA '}'\r\nrule 500  enum_member_declarations_opt ->\t\t/* empty */\r\nrule 501  enum_member_declarations_opt -> enum_member_declarations\r\nrule 502  enum_member_declarations -> enum_member_declaration\r\nrule 503  enum_member_declarations -> enum_member_declarations COMMA enum_member_declaration\r\nrule 504  enum_member_declaration -> attributes_opt IDENTIFIER\r\nrule 505  enum_member_declaration -> attributes_opt IDENTIFIER '=' constant_expression\r\nrule 506  delegate_declaration -> attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'\r\nrule 507  attributes -> attribute_sections\r\nrule 508  attribute_sections -> attribute_section\r\nrule 509  attribute_sections -> attribute_sections attribute_section\r\nrule 510  attribute_section -> ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list RIGHT_BRACKET EXIT_attrib\r\nrule 511  attribute_section -> ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list COMMA RIGHT_BRACKET EXIT_attrib\r\nrule 512  attribute_target_specifier_opt ->\t\t/* empty */\r\nrule 513  attribute_target_specifier_opt -> attribute_target_specifier\r\nrule 514  attribute_target_specifier -> attribute_target ':'\r\nrule 515  attribute_target -> ASSEMBLY\r\nrule 516  attribute_target -> FIELD\r\nrule 517  attribute_target -> EVENT\r\nrule 518  attribute_target -> METHOD\r\nrule 519  attribute_target -> MODULE\r\nrule 520  attribute_target -> PARAM\r\nrule 521  attribute_target -> PROPERTY\r\nrule 522  attribute_target -> RETURN\r\nrule 523  attribute_target -> TYPE\r\nrule 524  attribute_list -> attribute\r\nrule 525  attribute_list -> attribute_list COMMA attribute\r\nrule 526  attribute -> attribute_name attribute_arguments_opt\r\nrule 527  attribute_arguments_opt ->\t\t/* empty */\r\nrule 528  attribute_arguments_opt -> attribute_arguments\r\nrule 529  attribute_name -> type_name\r\nrule 530  attribute_arguments -> '(' expression_list_opt ')'\r\nrule 531  ENTER_attrib ->\t\t/* empty */\r\nrule 532  EXIT_attrib ->\t\t/* empty */\r\nrule 533  ENTER_accessor_decl ->\t\t/* empty */\r\nrule 534  EXIT_accessor_decl ->\t\t/* empty */\r\nrule 535  ENTER_getset ->\t\t/* empty */\r\nrule 536  EXIT_getset ->\t\t/* empty */\r\n\r\nTerminals, with rules where they appear\r\n\r\n$ (-1)\r\n'!' (33) 102 411\r\n'%' (37) 129 419\r\n'&' (38) 94 147 420\r\n'(' (40) 64 68 69 84 89 90 91 92 95 114 115 116 117 118 119 222 223\r\n    224 240 241 242 255 275 276 283 284 287 366 367 407 408 431 432\r\n    434 437 438 439 481 482 506 530\r\n')' (41) 64 68 69 84 89 90 91 92 95 114 115 116 117 118 119 222 223\r\n    224 240 241 242 255 275 276 283 284 287 366 367 407 408 431 432\r\n    434 437 438 439 481 482 506 530\r\n'*' (42) 36 37 110 115 125 127 417\r\n'+' (43) 108 131 409\r\n'-' (45) 109 132 410\r\n'.' (46) 65 66 67 79 304 305\r\n'/' (47) 128 418\r\n':' (58) 157 196 233 234 343 344 345 437 438 447 471 497 514\r\n';' (59) 195 197 198 212 241 242 261 262 263 264 265 266 269 301 311\r\n    312 363 364 373 393 394 441 443 492 506\r\n'<' (60) 137 428\r\n'=' (61) 159 203 211 290 311 505\r\n'>' (62) 138 427\r\n'?' (63) 157\r\n'^' (94) 149 422\r\n'{' (123) 190 225 306 348 383 395 400 448 462 463 472 485 486 493 498\r\n    499\r\n'|' (124) 151 421\r\n'}' (125) 190 225 306 348 383 395 400 448 462 463 472 485 486 493 498\r\n    499\r\n'~' (126) 103 412 439\r\nerror (256)\r\nRANK_SPECIFIER (258) 43\r\nIDENTIFIER (259) 65 66 67 79 93 196 202 203 211 255 263 279 290 302\r\n    303 304 305 311 340 378 382 407 408 431 432 434 439 444 468 481\r\n    482 485 491 494 504 505 506\r\nINTEGER_LITERAL (260) 2\r\nREAL_LITERAL (261) 3\r\nCHARACTER_LITERAL (262) 4\r\nSTRING_LITERAL (263) 5\r\nABSTRACT (264) 326\r\nAS (265) 142\r\nBASE (266) 79 80 437\r\nBOOL (267) 19\r\nBREAK (268) 261\r\nBYTE (269) 24\r\nCASE (270) 233 264\r\nCATCH (271) 275 276 277\r\nCHAR (272) 31\r\nCHECKED (273) 91 281\r\nCLASS (274) 340\r\nCONST (275) 208 363\r\nCONTINUE (276) 262\r\nDECIMAL (277) 22\r\nDEFAULT (278) 234 265\r\nDELEGATE (279) 506\r\nDO (280) 241\r\nDOUBLE (281) 33\r\nELSE (282) 223\r\nENUM (283) 494\r\nEVENT (284) 394 395 491 517\r\nEXPLICIT (285) 432\r\nEXTERN (286) 327\r\nFALSE (287) 8 416\r\nFINALLY (288) 280\r\nFIXED (289) 287\r\nFLOAT (290) 32\r\nFOR (291) 242\r\nFOREACH (292) 255\r\nGOTO (293) 263 264 265\r\nIF (294) 222 223\r\nIMPLICIT (295) 431\r\nIN (296) 255\r\nINT (297) 27\r\nINTERFACE (298) 468\r\nINTERNAL (299) 328\r\nIS (300) 141\r\nLOCK (301) 283\r\nLONG (302) 29\r\nNAMESPACE (303) 299\r\nNEW (304) 84 85 86 329 484\r\nNULL_LITERAL (305) 6\r\nOBJECT (306) 34\r\nOPERATOR (307) 407 408 431 432\r\nOUT (308) 49 381\r\nOVERRIDE (309) 330\r\nPARAMS (310) 382\r\nPRIVATE (311) 331\r\nPROTECTED (312) 332\r\nPUBLIC (313) 333\r\nREADONLY (314) 334\r\nREF (315) 48 380\r\nRETURN (316) 266 522\r\nSBYTE (317) 23\r\nSEALED (318) 335\r\nSHORT (319) 25\r\nSIZEOF (320) 95\r\nSTACKALLOC (321) 207\r\nSTATIC (322) 336\r\nSTRING (323) 35\r\nSTRUCT (324) 444\r\nSWITCH (325) 224\r\nTHIS (326) 78 401 403 438 486\r\nTHROW (327) 269\r\nTRUE (328) 7 415\r\nTRY (329) 270 271 272\r\nTYPEOF (330) 89 90\r\nUINT (331) 28\r\nULONG (332) 30\r\nUNCHECKED (333) 92 282\r\nUNSAFE (334) 239 337\r\nUSHORT (335) 26\r\nUSING (336) 284 311 312\r\nVIRTUAL (337) 338\r\nVOID (338) 37 90 119 367 371 482\r\nVOLATILE (339) 339\r\nWHILE (340) 240 241\r\nASSEMBLY (341) 515\r\nFIELD (342) 516\r\nMETHOD (343) 518\r\nMODULE (344) 519\r\nPARAM (345) 520\r\nPROPERTY (346) 521\r\nTYPE (347) 523\r\nGET (348) 390 487 489 490\r\nSET (349) 391 488 489 490\r\nADD (350) 398\r\nREMOVE (351) 399\r\nCOMMA (352) 46 77 201 210 254 289 345 347 375 408 463 467 499 503 511\r\n    525\r\nLEFT_BRACKET (353) 72 73 80 85 207 401 402 486 510 511\r\nRIGHT_BRACKET (354) 72 73 80 85 207 401 402 486 510 511\r\nPLUSEQ (355) 160\r\nMINUSEQ (356) 161\r\nSTAREQ (357) 162\r\nDIVEQ (358) 163\r\nMODEQ (359) 164\r\nXOREQ (360) 165\r\nANDEQ (361) 166\r\nOREQ (362) 167\r\nLTLT (363) 134 423\r\nGTGT (364) 135 424\r\nGTGTEQ (365) 168\r\nLTLTEQ (366) 169\r\nEQEQ (367) 144 425\r\nNOTEQ (368) 145 426\r\nLEQ (369) 139 430\r\nGEQ (370) 140 429\r\nANDAND (371) 153\r\nOROR (372) 155\r\nPLUSPLUS (373) 81 105 413\r\nMINUSMINUS (374) 82 106 414\r\nARROW (375) 93\r\n\r\nNonterminals, with rules where they appear\r\n\r\nliteral (142)\r\n    on left: 1 2 3 4 5 6, on right: 52\r\nboolean_literal (143)\r\n    on left: 7 8, on right: 1\r\nnamespace_name (144)\r\n    on left: 9, on right: 312\r\ntype_name (145)\r\n    on left: 10, on right: 14 276 346 347 529\r\ntype (146)\r\n    on left: 11 12, on right: 36 84 89 95 141 142 199 207 208 255 287\r\n    363 364 366 370 378 382 383 394 395 401 402 407 408 431 432 481\r\n    485 486 491\r\nnon_array_type (147)\r\n    on left: 13 14, on right: 11 85\r\nsimple_type (148)\r\n    on left: 15 16 17, on right: 13 39\r\nprimitive_type (149)\r\n    on left: 18 19, on right: 15 66 117\r\nnumeric_type (150)\r\n    on left: 20 21 22, on right: 18\r\nintegral_type (151)\r\n    on left: 23 24 25 26 27 28 29 30 31, on right: 20 497\r\nfloating_point_type (152)\r\n    on left: 32 33, on right: 21\r\nclass_type (153)\r\n    on left: 34 35, on right: 16 67 118 275 343 345\r\npointer_type (154)\r\n    on left: 36 37, on right: 17\r\narray_type (155)\r\n    on left: 38 39 40, on right: 12 38 86\r\nrank_specifiers_opt (156)\r\n    on left: 41 42, on right: 42 85\r\nrank_specifier (157)\r\n    on left: 43, on right: 38 39 40 42 116 124\r\nvariable_reference (158)\r\n    on left: 44, on right: 48 49\r\nargument_list (159)\r\n    on left: 45 46, on right: 46 71\r\nargument (160)\r\n    on left: 47 48 49, on right: 45 46\r\nprimary_expression (161)\r\n    on left: 50 51, on right: 65 72 96\r\nprimary_expression_no_parenthesis (162)\r\n    on left: 52 53 54 55 56 57 58 59 60 61 62 63, on right: 51 68\r\nparenthesized_expression (163)\r\n    on left: 64, on right: 50\r\nmember_access (164)\r\n    on left: 65 66 67, on right: 54\r\ninvocation_expression (165)\r\n    on left: 68 69, on right: 55 213\r\nargument_list_opt (166)\r\n    on left: 70 71, on right: 68 69 84 437 438\r\nelement_access (167)\r\n    on left: 72 73, on right: 56\r\nexpression_list_opt (168)\r\n    on left: 74 75, on right: 530\r\nexpression_list (169)\r\n    on left: 76 77, on right: 72 73 75 77 80 85\r\nthis_access (170)\r\n    on left: 78, on right: 57\r\nbase_access (171)\r\n    on left: 79 80, on right: 58\r\npost_increment_expression (172)\r\n    on left: 81, on right: 98 216\r\npost_decrement_expression (173)\r\n    on left: 82, on right: 99 217\r\nnew_expression (174)\r\n    on left: 83, on right: 59\r\nobject_creation_expression (175)\r\n    on left: 84, on right: 83 214\r\narray_creation_expression (176)\r\n    on left: 85 86, on right: 53\r\narray_initializer_opt (177)\r\n    on left: 87 88, on right: 85\r\ntypeof_expression (178)\r\n    on left: 89 90, on right: 60\r\nchecked_expression (179)\r\n    on left: 91, on right: 62\r\nunchecked_expression (180)\r\n    on left: 92, on right: 63\r\npointer_member_access (181)\r\n    on left: 93, on right: 100\r\naddressof_expression (182)\r\n    on left: 94, on right: 113\r\nsizeof_expression (183)\r\n    on left: 95, on right: 61\r\npostfix_expression (184)\r\n    on left: 96 97 98 99 100, on right: 81 82 93 101\r\nunary_expression_not_plusminus (185)\r\n    on left: 101 102 103 104, on right: 107 114\r\npre_increment_expression (186)\r\n    on left: 105, on right: 111 218\r\npre_decrement_expression (187)\r\n    on left: 106, on right: 112 219\r\nunary_expression (188)\r\n    on left: 107 108 109 110 111 112 113, on right: 94 102 103 105\r\n    106 108 109 110 115 116 117 118 119 126 127 128 129 158\r\ncast_expression (189)\r\n    on left: 114 115 116 117 118 119, on right: 104\r\ntype_quals_opt (190)\r\n    on left: 120 121, on right: 116 117 118 119\r\ntype_quals (191)\r\n    on left: 122 123, on right: 121 123\r\ntype_qual (192)\r\n    on left: 124 125, on right: 122 123\r\nmultiplicative_expression (193)\r\n    on left: 126 127 128 129, on right: 115 127 128 129 130 131 132\r\nadditive_expression (194)\r\n    on left: 130 131 132, on right: 131 132 133 134 135\r\nshift_expression (195)\r\n    on left: 133 134 135, on right: 134 135 136 137 138 139 140\r\nrelational_expression (196)\r\n    on left: 136 137 138 139 140 141 142, on right: 137 138 139 140\r\n    141 142 143 144 145\r\nequality_expression (197)\r\n    on left: 143 144 145, on right: 144 145 146 147\r\nand_expression (198)\r\n    on left: 146 147, on right: 147 148 149\r\nexclusive_or_expression (199)\r\n    on left: 148 149, on right: 149 150 151\r\ninclusive_or_expression (200)\r\n    on left: 150 151, on right: 151 152 153\r\nconditional_and_expression (201)\r\n    on left: 152 153, on right: 153 154 155\r\nconditional_or_expression (202)\r\n    on left: 154 155, on right: 155 156 157\r\nconditional_expression (203)\r\n    on left: 156 157, on right: 170\r\nassignment (204)\r\n    on left: 158, on right: 171 215\r\nassignment_operator (205)\r\n    on left: 159 160 161 162 163 164 165 166 167 168 169,\r\n    on right: 158\r\nexpression (206)\r\n    on left: 170 171, on right: 44 47 64 76 77 91 92 114 157 158 172\r\n    173 204 207 224 255 268 283 286 290\r\nconstant_expression (207)\r\n    on left: 172, on right: 211 233 264 505\r\nboolean_expression (208)\r\n    on left: 173, on right: 222 223 240 241 251\r\nstatement (209)\r\n    on left: 174 175 176, on right: 193 194 196\r\nembedded_statement (210)\r\n    on left: 177 178 179 180 181 182 183 184 185 186 187 188 189,\r\n    on right: 176 222 223 240 241 242 255 283 284 287\r\nblock (211)\r\n    on left: 190, on right: 177 239 270 271 272 275 276 277 280 281\r\n    282 372 392 398 399 439 440 442\r\nstatement_list_opt (212)\r\n    on left: 191 192, on right: 190\r\nstatement_list (213)\r\n    on left: 193 194, on right: 192 194 230\r\nempty_statement (214)\r\n    on left: 195, on right: 178\r\nlabeled_statement (215)\r\n    on left: 196, on right: 174\r\ndeclaration_statement (216)\r\n    on left: 197 198, on right: 175\r\nlocal_variable_declaration (217)\r\n    on left: 199, on right: 197 249 285\r\nvariable_declarators (218)\r\n    on left: 200 201, on right: 199 201 364 394\r\nvariable_declarator (219)\r\n    on left: 202 203, on right: 200 201\r\nvariable_initializer (220)\r\n    on left: 204 205 206, on right: 203 466 467\r\nstackalloc_initializer (221)\r\n    on left: 207, on right: 206\r\nlocal_constant_declaration (222)\r\n    on left: 208, on right: 198\r\nconstant_declarators (223)\r\n    on left: 209 210, on right: 208 210 363\r\nconstant_declarator (224)\r\n    on left: 211, on right: 209 210\r\nexpression_statement (225)\r\n    on left: 212, on right: 179\r\nstatement_expression (226)\r\n    on left: 213 214 215 216 217 218 219, on right: 212 253 254\r\nselection_statement (227)\r\n    on left: 220 221, on right: 180\r\nif_statement (228)\r\n    on left: 222 223, on right: 220\r\nswitch_statement (229)\r\n    on left: 224, on right: 221\r\nswitch_block (230)\r\n    on left: 225, on right: 224\r\nswitch_sections_opt (231)\r\n    on left: 226 227, on right: 225\r\nswitch_sections (232)\r\n    on left: 228 229, on right: 227 229\r\nswitch_section (233)\r\n    on left: 230, on right: 228 229\r\nswitch_labels (234)\r\n    on left: 231 232, on right: 230 232\r\nswitch_label (235)\r\n    on left: 233 234, on right: 231 232\r\niteration_statement (236)\r\n    on left: 235 236 237 238, on right: 181\r\nunsafe_statement (237)\r\n    on left: 239, on right: 188\r\nwhile_statement (238)\r\n    on left: 240, on right: 235\r\ndo_statement (239)\r\n    on left: 241, on right: 236\r\nfor_statement (240)\r\n    on left: 242, on right: 237\r\nfor_initializer_opt (241)\r\n    on left: 243 244, on right: 242\r\nfor_condition_opt (242)\r\n    on left: 245 246, on right: 242\r\nfor_iterator_opt (243)\r\n    on left: 247 248, on right: 242\r\nfor_initializer (244)\r\n    on left: 249 250, on right: 244\r\nfor_condition (245)\r\n    on left: 251, on right: 246\r\nfor_iterator (246)\r\n    on left: 252, on right: 248\r\nstatement_expression_list (247)\r\n    on left: 253 254, on right: 250 252 254\r\nforeach_statement (248)\r\n    on left: 255, on right: 238\r\njump_statement (249)\r\n    on left: 256 257 258 259 260, on right: 182\r\nbreak_statement (250)\r\n    on left: 261, on right: 256\r\ncontinue_statement (251)\r\n    on left: 262, on right: 257\r\ngoto_statement (252)\r\n    on left: 263 264 265, on right: 258\r\nreturn_statement (253)\r\n    on left: 266, on right: 259\r\nexpression_opt (254)\r\n    on left: 267 268, on right: 266 269\r\nthrow_statement (255)\r\n    on left: 269, on right: 260\r\ntry_statement (256)\r\n    on left: 270 271 272, on right: 183\r\ncatch_clauses (257)\r\n    on left: 273 274, on right: 270 272 274\r\ncatch_clause (258)\r\n    on left: 275 276 277, on right: 273 274\r\nidentifier_opt (259)\r\n    on left: 278 279, on right: 275 276\r\nfinally_clause (260)\r\n    on left: 280, on right: 271 272\r\nchecked_statement (261)\r\n    on left: 281, on right: 184\r\nunchecked_statement (262)\r\n    on left: 282, on right: 185\r\nlock_statement (263)\r\n    on left: 283, on right: 186\r\nusing_statement (264)\r\n    on left: 284, on right: 187\r\nresource_acquisition (265)\r\n    on left: 285 286, on right: 284\r\nfixed_statement (266)\r\n    on left: 287, on right: 189\r\nfixed_pointer_declarators (267)\r\n    on left: 288 289, on right: 287 289\r\nfixed_pointer_declarator (268)\r\n    on left: 290, on right: 288 289\r\ncompilation_unit (269)\r\n    on left: 291 292\r\nusing_directives_opt (270)\r\n    on left: 293 294, on right: 291 292 306\r\nattributes_opt (271)\r\n    on left: 295 296, on right: 291 299 340 363 364 366 367 378 382\r\n    383 390 391 394 395 398 399 400 404 433 439 444 468 481 482 485\r\n    486 487 488 489 490 491 494 504 505 506\r\nnamespace_member_declarations_opt (272)\r\n    on left: 297 298, on right: 306\r\nnamespace_declaration (273)\r\n    on left: 299, on right: 315\r\ncomma_opt (274)\r\n    on left: 300 301, on right: 299 340 444 468 494\r\nqualified_identifier (275)\r\n    on left: 302 303, on right: 9 10 40 69 73 97 116 299 311 366 367\r\n    383 395\r\nqualifier (276)\r\n    on left: 304 305, on right: 303 305 403\r\nnamespace_body (277)\r\n    on left: 306, on right: 299\r\nusing_directives (278)\r\n    on left: 307 308, on right: 294 308\r\nusing_directive (279)\r\n    on left: 309 310, on right: 307 308\r\nusing_alias_directive (280)\r\n    on left: 311, on right: 309\r\nusing_namespace_directive (281)\r\n    on left: 312, on right: 310\r\nnamespace_member_declarations (282)\r\n    on left: 313 314, on right: 292 298 314\r\nnamespace_member_declaration (283)\r\n    on left: 315 316, on right: 313 314\r\ntype_declaration (284)\r\n    on left: 317 318 319 320 321, on right: 316 362 461\r\nmodifiers_opt (285)\r\n    on left: 322 323, on right: 340 363 364 366 367 383 394 395 400\r\n    404 433 439 444 468 494 506\r\nmodifiers (286)\r\n    on left: 324 325, on right: 323 325\r\nmodifier (287)\r\n    on left: 326 327 328 329 330 331 332 333 334 335 336 337 338 339\r\n   , on right: 324 325\r\nclass_declaration (288)\r\n    on left: 340, on right: 317\r\nclass_base_opt (289)\r\n    on left: 341 342, on right: 340\r\nclass_base (290)\r\n    on left: 343 344 345, on right: 342\r\ninterface_type_list (291)\r\n    on left: 346 347, on right: 344 345 347 447 471\r\nclass_body (292)\r\n    on left: 348, on right: 340\r\nclass_member_declarations_opt (293)\r\n    on left: 349 350, on right: 348\r\nclass_member_declarations (294)\r\n    on left: 351 352, on right: 350 352\r\nclass_member_declaration (295)\r\n    on left: 353 354 355 356 357 358 359 360 361 362,\r\n    on right: 351 352\r\nconstant_declaration (296)\r\n    on left: 363, on right: 353 453\r\nfield_declaration (297)\r\n    on left: 364, on right: 354 454\r\nmethod_declaration (298)\r\n    on left: 365, on right: 355 455\r\nmethod_header (299)\r\n    on left: 366 367, on right: 365\r\nformal_parameter_list_opt (300)\r\n    on left: 368 369, on right: 366 367 434 481 482 506\r\nreturn_type (301)\r\n    on left: 370 371, on right: 506\r\nmethod_body (302)\r\n    on left: 372 373, on right: 365\r\nformal_parameter_list (303)\r\n    on left: 374 375, on right: 369 375 401 402 486\r\nformal_parameter (304)\r\n    on left: 376 377, on right: 374 375\r\nfixed_parameter (305)\r\n    on left: 378, on right: 376\r\nparameter_modifier_opt (306)\r\n    on left: 379 380 381, on right: 378\r\nparameter_array (307)\r\n    on left: 382, on right: 377\r\nproperty_declaration (308)\r\n    on left: 383, on right: 356 456\r\naccessor_declarations (309)\r\n    on left: 384 385, on right: 383 400\r\nset_accessor_declaration_opt (310)\r\n    on left: 386 387, on right: 384\r\nget_accessor_declaration_opt (311)\r\n    on left: 388 389, on right: 385\r\nget_accessor_declaration (312)\r\n    on left: 390, on right: 384 389\r\nset_accessor_declaration (313)\r\n    on left: 391, on right: 385 387\r\naccessor_body (314)\r\n    on left: 392 393, on right: 390 391\r\nevent_declaration (315)\r\n    on left: 394 395, on right: 357 457\r\nevent_accessor_declarations (316)\r\n    on left: 396 397, on right: 395\r\nadd_accessor_declaration (317)\r\n    on left: 398, on right: 396 397\r\nremove_accessor_declaration (318)\r\n    on left: 399, on right: 396 397\r\nindexer_declaration (319)\r\n    on left: 400, on right: 358 458\r\nindexer_declarator (320)\r\n    on left: 401 402, on right: 400\r\nqualified_this (321)\r\n    on left: 403, on right: 402\r\noperator_declaration (322)\r\n    on left: 404, on right: 359 459\r\noperator_declarator (323)\r\n    on left: 405 406, on right: 404\r\noverloadable_operator_declarator (324)\r\n    on left: 407 408, on right: 405\r\noverloadable_operator (325)\r\n    on left: 409 410 411 412 413 414 415 416 417 418 419 420 421 422\r\n    423 424 425 426 427 428 429 430, on right: 407 408\r\nconversion_operator_declarator (326)\r\n    on left: 431 432, on right: 406\r\nconstructor_declaration (327)\r\n    on left: 433, on right: 360 460\r\nconstructor_declarator (328)\r\n    on left: 434, on right: 433\r\nconstructor_initializer_opt (329)\r\n    on left: 435 436, on right: 434\r\nconstructor_initializer (330)\r\n    on left: 437 438, on right: 436\r\ndestructor_declaration (331)\r\n    on left: 439, on right: 361\r\noperator_body (332)\r\n    on left: 440 441, on right: 404\r\nconstructor_body (333)\r\n    on left: 442 443, on right: 433\r\nstruct_declaration (334)\r\n    on left: 444, on right: 318\r\nstruct_interfaces_opt (335)\r\n    on left: 445 446, on right: 444\r\nstruct_interfaces (336)\r\n    on left: 447, on right: 446\r\nstruct_body (337)\r\n    on left: 448, on right: 444\r\nstruct_member_declarations_opt (338)\r\n    on left: 449 450, on right: 448\r\nstruct_member_declarations (339)\r\n    on left: 451 452, on right: 450 452\r\nstruct_member_declaration (340)\r\n    on left: 453 454 455 456 457 458 459 460 461, on right: 451 452\r\narray_initializer (341)\r\n    on left: 462 463, on right: 86 88 205\r\nvariable_initializer_list_opt (342)\r\n    on left: 464 465, on right: 462\r\nvariable_initializer_list (343)\r\n    on left: 466 467, on right: 463 465 467\r\ninterface_declaration (344)\r\n    on left: 468, on right: 319\r\ninterface_base_opt (345)\r\n    on left: 469 470, on right: 468\r\ninterface_base (346)\r\n    on left: 471, on right: 470\r\ninterface_body (347)\r\n    on left: 472, on right: 468\r\ninterface_member_declarations_opt (348)\r\n    on left: 473 474, on right: 472\r\ninterface_member_declarations (349)\r\n    on left: 475 476, on right: 474 476\r\ninterface_member_declaration (350)\r\n    on left: 477 478 479 480, on right: 475 476\r\ninterface_method_declaration (351)\r\n    on left: 481 482, on right: 477\r\nnew_opt (352)\r\n    on left: 483 484, on right: 481 482 485 486 491\r\ninterface_property_declaration (353)\r\n    on left: 485, on right: 478\r\ninterface_indexer_declaration (354)\r\n    on left: 486, on right: 480\r\ninterface_accessors (355)\r\n    on left: 487 488 489 490, on right: 485 486\r\ninterface_event_declaration (356)\r\n    on left: 491, on right: 479\r\ninterface_empty_body (357)\r\n    on left: 492 493, on right: 481 482 487 488 489 490 491\r\nenum_declaration (358)\r\n    on left: 494, on right: 320\r\nenum_base_opt (359)\r\n    on left: 495 496, on right: 494\r\nenum_base (360)\r\n    on left: 497, on right: 496\r\nenum_body (361)\r\n    on left: 498 499, on right: 494\r\nenum_member_declarations_opt (362)\r\n    on left: 500 501, on right: 498\r\nenum_member_declarations (363)\r\n    on left: 502 503, on right: 499 501 503\r\nenum_member_declaration (364)\r\n    on left: 504 505, on right: 502 503\r\ndelegate_declaration (365)\r\n    on left: 506, on right: 321\r\nattributes (366)\r\n    on left: 507, on right: 296\r\nattribute_sections (367)\r\n    on left: 508 509, on right: 507 509\r\nattribute_section (368)\r\n    on left: 510 511, on right: 508 509\r\nattribute_target_specifier_opt (369)\r\n    on left: 512 513, on right: 510 511\r\nattribute_target_specifier (370)\r\n    on left: 514, on right: 513\r\nattribute_target (371)\r\n    on left: 515 516 517 518 519 520 521 522 523, on right: 514\r\nattribute_list (372)\r\n    on left: 524 525, on right: 510 511 525\r\nattribute (373)\r\n    on left: 526, on right: 524 525\r\nattribute_arguments_opt (374)\r\n    on left: 527 528, on right: 526\r\nattribute_name (375)\r\n    on left: 529, on right: 526\r\nattribute_arguments (376)\r\n    on left: 530, on right: 528\r\nENTER_attrib (377)\r\n    on left: 531, on right: 510 511\r\nEXIT_attrib (378)\r\n    on left: 532, on right: 510 511\r\nENTER_accessor_decl (379)\r\n    on left: 533, on right: 395 398 399\r\nEXIT_accessor_decl (380)\r\n    on left: 534, on right: 395 398 399\r\nENTER_getset (381)\r\n    on left: 535, on right: 383 390 391 400 485 486\r\nEXIT_getset (382)\r\n    on left: 536, on right: 383 390 391 400 485 486\r\n\r\n\r\nstate 0\r\n\r\n    USING\tshift, and go to state 1\r\n\r\n    $default\treduce using rule 293 (using_directives_opt)\r\n\r\n    compilation_unit\tgo to state 911\r\n    using_directives_opt\tgo to state 2\r\n    using_directives\tgo to state 3\r\n    using_directive\tgo to state 4\r\n    using_alias_directive\tgo to state 5\r\n    using_namespace_directive\tgo to state 6\r\n\r\n\r\n\r\nstate 1\r\n\r\n    using_alias_directive  ->  USING . IDENTIFIER '=' qualified_identifier ';'   (rule 311)\r\n    using_namespace_directive  ->  USING . namespace_name ';'   (rule 312)\r\n\r\n    IDENTIFIER\tshift, and go to state 7\r\n\r\n    namespace_name\tgo to state 8\r\n    qualified_identifier\tgo to state 9\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 2\r\n\r\n    compilation_unit  ->  using_directives_opt . attributes_opt   (rule 291)\r\n    compilation_unit  ->  using_directives_opt . namespace_member_declarations   (rule 292)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 11\r\n    namespace_declaration\tgo to state 12\r\n    namespace_member_declarations\tgo to state 13\r\n    namespace_member_declaration\tgo to state 14\r\n    type_declaration\tgo to state 15\r\n    class_declaration\tgo to state 16\r\n    struct_declaration\tgo to state 17\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 3\r\n\r\n    using_directives_opt  ->  using_directives .   (rule 294)\r\n    using_directives  ->  using_directives . using_directive   (rule 308)\r\n\r\n    USING\tshift, and go to state 1\r\n\r\n    $default\treduce using rule 294 (using_directives_opt)\r\n\r\n    using_directive\tgo to state 25\r\n    using_alias_directive\tgo to state 5\r\n    using_namespace_directive\tgo to state 6\r\n\r\n\r\n\r\nstate 4\r\n\r\n    using_directives  ->  using_directive .   (rule 307)\r\n\r\n    $default\treduce using rule 307 (using_directives)\r\n\r\n\r\n\r\nstate 5\r\n\r\n    using_directive  ->  using_alias_directive .   (rule 309)\r\n\r\n    $default\treduce using rule 309 (using_directive)\r\n\r\n\r\n\r\nstate 6\r\n\r\n    using_directive  ->  using_namespace_directive .   (rule 310)\r\n\r\n    $default\treduce using rule 310 (using_directive)\r\n\r\n\r\n\r\nstate 7\r\n\r\n    qualified_identifier  ->  IDENTIFIER .   (rule 302)\r\n    qualifier  ->  IDENTIFIER . '.'   (rule 304)\r\n    using_alias_directive  ->  USING IDENTIFIER . '=' qualified_identifier ';'   (rule 311)\r\n\r\n    '.' \tshift, and go to state 26\r\n    '=' \tshift, and go to state 27\r\n\r\n    $default\treduce using rule 302 (qualified_identifier)\r\n\r\n\r\n\r\nstate 8\r\n\r\n    using_namespace_directive  ->  USING namespace_name . ';'   (rule 312)\r\n\r\n    ';' \tshift, and go to state 28\r\n\r\n\r\n\r\nstate 9\r\n\r\n    namespace_name  ->  qualified_identifier .   (rule 9)\r\n\r\n    $default\treduce using rule 9 (namespace_name)\r\n\r\n\r\n\r\nstate 10\r\n\r\n    qualified_identifier  ->  qualifier . IDENTIFIER   (rule 303)\r\n    qualifier  ->  qualifier . IDENTIFIER '.'   (rule 305)\r\n\r\n    IDENTIFIER\tshift, and go to state 29\r\n\r\n\r\n\r\nstate 11\r\n\r\n    compilation_unit  ->  using_directives_opt attributes_opt .   (rule 291)\r\n    namespace_declaration  ->  attributes_opt . NAMESPACE qualified_identifier namespace_body comma_opt   (rule 299)\r\n    class_declaration  ->  attributes_opt . modifiers_opt CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    struct_declaration  ->  attributes_opt . modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt . modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt . modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt . modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    ABSTRACT\tshift, and go to state 30\r\n    EXTERN\tshift, and go to state 31\r\n    INTERNAL\tshift, and go to state 32\r\n    NAMESPACE\tshift, and go to state 33\r\n    NEW \tshift, and go to state 34\r\n    OVERRIDE\tshift, and go to state 35\r\n    PRIVATE\tshift, and go to state 36\r\n    PROTECTED\tshift, and go to state 37\r\n    PUBLIC\tshift, and go to state 38\r\n    READONLY\tshift, and go to state 39\r\n    SEALED\tshift, and go to state 40\r\n    STATIC\tshift, and go to state 41\r\n    UNSAFE\tshift, and go to state 42\r\n    VIRTUAL\tshift, and go to state 43\r\n    VOLATILE\tshift, and go to state 44\r\n\r\n    $   \treduce using rule 291 (compilation_unit)\r\n    $default\treduce using rule 322 (modifiers_opt)\r\n\r\n    modifiers_opt\tgo to state 45\r\n    modifiers\tgo to state 46\r\n    modifier\tgo to state 47\r\n\r\n\r\n\r\nstate 12\r\n\r\n    namespace_member_declaration  ->  namespace_declaration .   (rule 315)\r\n\r\n    $default\treduce using rule 315 (namespace_member_declaration)\r\n\r\n\r\n\r\nstate 13\r\n\r\n    compilation_unit  ->  using_directives_opt namespace_member_declarations .   (rule 292)\r\n    namespace_member_declarations  ->  namespace_member_declarations . namespace_member_declaration   (rule 314)\r\n\r\n    $   \treduce using rule 292 (compilation_unit)\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 48\r\n    namespace_declaration\tgo to state 12\r\n    namespace_member_declaration\tgo to state 49\r\n    type_declaration\tgo to state 15\r\n    class_declaration\tgo to state 16\r\n    struct_declaration\tgo to state 17\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 14\r\n\r\n    namespace_member_declarations  ->  namespace_member_declaration .   (rule 313)\r\n\r\n    $default\treduce using rule 313 (namespace_member_declarations)\r\n\r\n\r\n\r\nstate 15\r\n\r\n    namespace_member_declaration  ->  type_declaration .   (rule 316)\r\n\r\n    $default\treduce using rule 316 (namespace_member_declaration)\r\n\r\n\r\n\r\nstate 16\r\n\r\n    type_declaration  ->  class_declaration .   (rule 317)\r\n\r\n    $default\treduce using rule 317 (type_declaration)\r\n\r\n\r\n\r\nstate 17\r\n\r\n    type_declaration  ->  struct_declaration .   (rule 318)\r\n\r\n    $default\treduce using rule 318 (type_declaration)\r\n\r\n\r\n\r\nstate 18\r\n\r\n    type_declaration  ->  interface_declaration .   (rule 319)\r\n\r\n    $default\treduce using rule 319 (type_declaration)\r\n\r\n\r\n\r\nstate 19\r\n\r\n    type_declaration  ->  enum_declaration .   (rule 320)\r\n\r\n    $default\treduce using rule 320 (type_declaration)\r\n\r\n\r\n\r\nstate 20\r\n\r\n    type_declaration  ->  delegate_declaration .   (rule 321)\r\n\r\n    $default\treduce using rule 321 (type_declaration)\r\n\r\n\r\n\r\nstate 21\r\n\r\n    attributes_opt  ->  attributes .   (rule 296)\r\n\r\n    $default\treduce using rule 296 (attributes_opt)\r\n\r\n\r\n\r\nstate 22\r\n\r\n    attributes  ->  attribute_sections .   (rule 507)\r\n    attribute_sections  ->  attribute_sections . attribute_section   (rule 509)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 507 (attributes)\r\n\r\n    attribute_section\tgo to state 50\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 23\r\n\r\n    attribute_sections  ->  attribute_section .   (rule 508)\r\n\r\n    $default\treduce using rule 508 (attribute_sections)\r\n\r\n\r\n\r\nstate 24\r\n\r\n    attribute_section  ->  ENTER_attrib . LEFT_BRACKET attribute_target_specifier_opt attribute_list RIGHT_BRACKET EXIT_attrib   (rule 510)\r\n    attribute_section  ->  ENTER_attrib . LEFT_BRACKET attribute_target_specifier_opt attribute_list COMMA RIGHT_BRACKET EXIT_attrib   (rule 511)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 51\r\n\r\n\r\n\r\nstate 25\r\n\r\n    using_directives  ->  using_directives using_directive .   (rule 308)\r\n\r\n    $default\treduce using rule 308 (using_directives)\r\n\r\n\r\n\r\nstate 26\r\n\r\n    qualifier  ->  IDENTIFIER '.' .   (rule 304)\r\n\r\n    $default\treduce using rule 304 (qualifier)\r\n\r\n\r\n\r\nstate 27\r\n\r\n    using_alias_directive  ->  USING IDENTIFIER '=' . qualified_identifier ';'   (rule 311)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    qualified_identifier\tgo to state 53\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 28\r\n\r\n    using_namespace_directive  ->  USING namespace_name ';' .   (rule 312)\r\n\r\n    $default\treduce using rule 312 (using_namespace_directive)\r\n\r\n\r\n\r\nstate 29\r\n\r\n    qualified_identifier  ->  qualifier IDENTIFIER .   (rule 303)\r\n    qualifier  ->  qualifier IDENTIFIER . '.'   (rule 305)\r\n\r\n    '.' \tshift, and go to state 54\r\n\r\n    $default\treduce using rule 303 (qualified_identifier)\r\n\r\n\r\n\r\nstate 30\r\n\r\n    modifier  ->  ABSTRACT .   (rule 326)\r\n\r\n    $default\treduce using rule 326 (modifier)\r\n\r\n\r\n\r\nstate 31\r\n\r\n    modifier  ->  EXTERN .   (rule 327)\r\n\r\n    $default\treduce using rule 327 (modifier)\r\n\r\n\r\n\r\nstate 32\r\n\r\n    modifier  ->  INTERNAL .   (rule 328)\r\n\r\n    $default\treduce using rule 328 (modifier)\r\n\r\n\r\n\r\nstate 33\r\n\r\n    namespace_declaration  ->  attributes_opt NAMESPACE . qualified_identifier namespace_body comma_opt   (rule 299)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    qualified_identifier\tgo to state 55\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 34\r\n\r\n    modifier  ->  NEW .   (rule 329)\r\n\r\n    $default\treduce using rule 329 (modifier)\r\n\r\n\r\n\r\nstate 35\r\n\r\n    modifier  ->  OVERRIDE .   (rule 330)\r\n\r\n    $default\treduce using rule 330 (modifier)\r\n\r\n\r\n\r\nstate 36\r\n\r\n    modifier  ->  PRIVATE .   (rule 331)\r\n\r\n    $default\treduce using rule 331 (modifier)\r\n\r\n\r\n\r\nstate 37\r\n\r\n    modifier  ->  PROTECTED .   (rule 332)\r\n\r\n    $default\treduce using rule 332 (modifier)\r\n\r\n\r\n\r\nstate 38\r\n\r\n    modifier  ->  PUBLIC .   (rule 333)\r\n\r\n    $default\treduce using rule 333 (modifier)\r\n\r\n\r\n\r\nstate 39\r\n\r\n    modifier  ->  READONLY .   (rule 334)\r\n\r\n    $default\treduce using rule 334 (modifier)\r\n\r\n\r\n\r\nstate 40\r\n\r\n    modifier  ->  SEALED .   (rule 335)\r\n\r\n    $default\treduce using rule 335 (modifier)\r\n\r\n\r\n\r\nstate 41\r\n\r\n    modifier  ->  STATIC .   (rule 336)\r\n\r\n    $default\treduce using rule 336 (modifier)\r\n\r\n\r\n\r\nstate 42\r\n\r\n    modifier  ->  UNSAFE .   (rule 337)\r\n\r\n    $default\treduce using rule 337 (modifier)\r\n\r\n\r\n\r\nstate 43\r\n\r\n    modifier  ->  VIRTUAL .   (rule 338)\r\n\r\n    $default\treduce using rule 338 (modifier)\r\n\r\n\r\n\r\nstate 44\r\n\r\n    modifier  ->  VOLATILE .   (rule 339)\r\n\r\n    $default\treduce using rule 339 (modifier)\r\n\r\n\r\n\r\nstate 45\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt . CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    struct_declaration  ->  attributes_opt modifiers_opt . STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt modifiers_opt . INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt modifiers_opt . ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt modifiers_opt . DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    CLASS\tshift, and go to state 56\r\n    DELEGATE\tshift, and go to state 57\r\n    ENUM\tshift, and go to state 58\r\n    INTERFACE\tshift, and go to state 59\r\n    STRUCT\tshift, and go to state 60\r\n\r\n\r\n\r\nstate 46\r\n\r\n    modifiers_opt  ->  modifiers .   (rule 323)\r\n    modifiers  ->  modifiers . modifier   (rule 325)\r\n\r\n    ABSTRACT\tshift, and go to state 30\r\n    EXTERN\tshift, and go to state 31\r\n    INTERNAL\tshift, and go to state 32\r\n    NEW \tshift, and go to state 34\r\n    OVERRIDE\tshift, and go to state 35\r\n    PRIVATE\tshift, and go to state 36\r\n    PROTECTED\tshift, and go to state 37\r\n    PUBLIC\tshift, and go to state 38\r\n    READONLY\tshift, and go to state 39\r\n    SEALED\tshift, and go to state 40\r\n    STATIC\tshift, and go to state 41\r\n    UNSAFE\tshift, and go to state 42\r\n    VIRTUAL\tshift, and go to state 43\r\n    VOLATILE\tshift, and go to state 44\r\n\r\n    $default\treduce using rule 323 (modifiers_opt)\r\n\r\n    modifier\tgo to state 61\r\n\r\n\r\n\r\nstate 47\r\n\r\n    modifiers  ->  modifier .   (rule 324)\r\n\r\n    $default\treduce using rule 324 (modifiers)\r\n\r\n\r\n\r\nstate 48\r\n\r\n    namespace_declaration  ->  attributes_opt . NAMESPACE qualified_identifier namespace_body comma_opt   (rule 299)\r\n    class_declaration  ->  attributes_opt . modifiers_opt CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    struct_declaration  ->  attributes_opt . modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt . modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt . modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt . modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    ABSTRACT\tshift, and go to state 30\r\n    EXTERN\tshift, and go to state 31\r\n    INTERNAL\tshift, and go to state 32\r\n    NAMESPACE\tshift, and go to state 33\r\n    NEW \tshift, and go to state 34\r\n    OVERRIDE\tshift, and go to state 35\r\n    PRIVATE\tshift, and go to state 36\r\n    PROTECTED\tshift, and go to state 37\r\n    PUBLIC\tshift, and go to state 38\r\n    READONLY\tshift, and go to state 39\r\n    SEALED\tshift, and go to state 40\r\n    STATIC\tshift, and go to state 41\r\n    UNSAFE\tshift, and go to state 42\r\n    VIRTUAL\tshift, and go to state 43\r\n    VOLATILE\tshift, and go to state 44\r\n\r\n    $default\treduce using rule 322 (modifiers_opt)\r\n\r\n    modifiers_opt\tgo to state 45\r\n    modifiers\tgo to state 46\r\n    modifier\tgo to state 47\r\n\r\n\r\n\r\nstate 49\r\n\r\n    namespace_member_declarations  ->  namespace_member_declarations namespace_member_declaration .   (rule 314)\r\n\r\n    $default\treduce using rule 314 (namespace_member_declarations)\r\n\r\n\r\n\r\nstate 50\r\n\r\n    attribute_sections  ->  attribute_sections attribute_section .   (rule 509)\r\n\r\n    $default\treduce using rule 509 (attribute_sections)\r\n\r\n\r\n\r\nstate 51\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET . attribute_target_specifier_opt attribute_list RIGHT_BRACKET EXIT_attrib   (rule 510)\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET . attribute_target_specifier_opt attribute_list COMMA RIGHT_BRACKET EXIT_attrib   (rule 511)\r\n\r\n    EVENT\tshift, and go to state 62\r\n    RETURN\tshift, and go to state 63\r\n    ASSEMBLY\tshift, and go to state 64\r\n    FIELD\tshift, and go to state 65\r\n    METHOD\tshift, and go to state 66\r\n    MODULE\tshift, and go to state 67\r\n    PARAM\tshift, and go to state 68\r\n    PROPERTY\tshift, and go to state 69\r\n    TYPE\tshift, and go to state 70\r\n\r\n    $default\treduce using rule 512 (attribute_target_specifier_opt)\r\n\r\n    attribute_target_specifier_opt\tgo to state 71\r\n    attribute_target_specifier\tgo to state 72\r\n    attribute_target\tgo to state 73\r\n\r\n\r\n\r\nstate 52\r\n\r\n    qualified_identifier  ->  IDENTIFIER .   (rule 302)\r\n    qualifier  ->  IDENTIFIER . '.'   (rule 304)\r\n\r\n    '.' \tshift, and go to state 26\r\n\r\n    $default\treduce using rule 302 (qualified_identifier)\r\n\r\n\r\n\r\nstate 53\r\n\r\n    using_alias_directive  ->  USING IDENTIFIER '=' qualified_identifier . ';'   (rule 311)\r\n\r\n    ';' \tshift, and go to state 74\r\n\r\n\r\n\r\nstate 54\r\n\r\n    qualifier  ->  qualifier IDENTIFIER '.' .   (rule 305)\r\n\r\n    $default\treduce using rule 305 (qualifier)\r\n\r\n\r\n\r\nstate 55\r\n\r\n    namespace_declaration  ->  attributes_opt NAMESPACE qualified_identifier . namespace_body comma_opt   (rule 299)\r\n\r\n    '{' \tshift, and go to state 75\r\n\r\n    namespace_body\tgo to state 76\r\n\r\n\r\n\r\nstate 56\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt CLASS . IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n\r\n    IDENTIFIER\tshift, and go to state 77\r\n\r\n\r\n\r\nstate 57\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE . return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 93\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 95\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n    return_type\tgo to state 106\r\n\r\n\r\n\r\nstate 58\r\n\r\n    enum_declaration  ->  attributes_opt modifiers_opt ENUM . IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n\r\n    IDENTIFIER\tshift, and go to state 107\r\n\r\n\r\n\r\nstate 59\r\n\r\n    interface_declaration  ->  attributes_opt modifiers_opt INTERFACE . IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n\r\n    IDENTIFIER\tshift, and go to state 108\r\n\r\n\r\n\r\nstate 60\r\n\r\n    struct_declaration  ->  attributes_opt modifiers_opt STRUCT . IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n\r\n    IDENTIFIER\tshift, and go to state 109\r\n\r\n\r\n\r\nstate 61\r\n\r\n    modifiers  ->  modifiers modifier .   (rule 325)\r\n\r\n    $default\treduce using rule 325 (modifiers)\r\n\r\n\r\n\r\nstate 62\r\n\r\n    attribute_target  ->  EVENT .   (rule 517)\r\n\r\n    $default\treduce using rule 517 (attribute_target)\r\n\r\n\r\n\r\nstate 63\r\n\r\n    attribute_target  ->  RETURN .   (rule 522)\r\n\r\n    $default\treduce using rule 522 (attribute_target)\r\n\r\n\r\n\r\nstate 64\r\n\r\n    attribute_target  ->  ASSEMBLY .   (rule 515)\r\n\r\n    $default\treduce using rule 515 (attribute_target)\r\n\r\n\r\n\r\nstate 65\r\n\r\n    attribute_target  ->  FIELD .   (rule 516)\r\n\r\n    $default\treduce using rule 516 (attribute_target)\r\n\r\n\r\n\r\nstate 66\r\n\r\n    attribute_target  ->  METHOD .   (rule 518)\r\n\r\n    $default\treduce using rule 518 (attribute_target)\r\n\r\n\r\n\r\nstate 67\r\n\r\n    attribute_target  ->  MODULE .   (rule 519)\r\n\r\n    $default\treduce using rule 519 (attribute_target)\r\n\r\n\r\n\r\nstate 68\r\n\r\n    attribute_target  ->  PARAM .   (rule 520)\r\n\r\n    $default\treduce using rule 520 (attribute_target)\r\n\r\n\r\n\r\nstate 69\r\n\r\n    attribute_target  ->  PROPERTY .   (rule 521)\r\n\r\n    $default\treduce using rule 521 (attribute_target)\r\n\r\n\r\n\r\nstate 70\r\n\r\n    attribute_target  ->  TYPE .   (rule 523)\r\n\r\n    $default\treduce using rule 523 (attribute_target)\r\n\r\n\r\n\r\nstate 71\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt . attribute_list RIGHT_BRACKET EXIT_attrib   (rule 510)\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt . attribute_list COMMA RIGHT_BRACKET EXIT_attrib   (rule 511)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    type_name\tgo to state 110\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n    attribute_list\tgo to state 112\r\n    attribute\tgo to state 113\r\n    attribute_name\tgo to state 114\r\n\r\n\r\n\r\nstate 72\r\n\r\n    attribute_target_specifier_opt  ->  attribute_target_specifier .   (rule 513)\r\n\r\n    $default\treduce using rule 513 (attribute_target_specifier_opt)\r\n\r\n\r\n\r\nstate 73\r\n\r\n    attribute_target_specifier  ->  attribute_target . ':'   (rule 514)\r\n\r\n    ':' \tshift, and go to state 115\r\n\r\n\r\n\r\nstate 74\r\n\r\n    using_alias_directive  ->  USING IDENTIFIER '=' qualified_identifier ';' .   (rule 311)\r\n\r\n    $default\treduce using rule 311 (using_alias_directive)\r\n\r\n\r\n\r\nstate 75\r\n\r\n    namespace_body  ->  '{' . using_directives_opt namespace_member_declarations_opt '}'   (rule 306)\r\n\r\n    USING\tshift, and go to state 1\r\n\r\n    $default\treduce using rule 293 (using_directives_opt)\r\n\r\n    using_directives_opt\tgo to state 116\r\n    using_directives\tgo to state 3\r\n    using_directive\tgo to state 4\r\n    using_alias_directive\tgo to state 5\r\n    using_namespace_directive\tgo to state 6\r\n\r\n\r\n\r\nstate 76\r\n\r\n    namespace_declaration  ->  attributes_opt NAMESPACE qualified_identifier namespace_body . comma_opt   (rule 299)\r\n\r\n    ';' \tshift, and go to state 117\r\n\r\n    $default\treduce using rule 300 (comma_opt)\r\n\r\n    comma_opt\tgo to state 118\r\n\r\n\r\n\r\nstate 77\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt CLASS IDENTIFIER . class_base_opt class_body comma_opt   (rule 340)\r\n\r\n    ':' \tshift, and go to state 119\r\n\r\n    $default\treduce using rule 341 (class_base_opt)\r\n\r\n    class_base_opt\tgo to state 120\r\n    class_base\tgo to state 121\r\n\r\n\r\n\r\nstate 78\r\n\r\n    primitive_type  ->  BOOL .   (rule 19)\r\n\r\n    $default\treduce using rule 19 (primitive_type)\r\n\r\n\r\n\r\nstate 79\r\n\r\n    integral_type  ->  BYTE .   (rule 24)\r\n\r\n    $default\treduce using rule 24 (integral_type)\r\n\r\n\r\n\r\nstate 80\r\n\r\n    integral_type  ->  CHAR .   (rule 31)\r\n\r\n    $default\treduce using rule 31 (integral_type)\r\n\r\n\r\n\r\nstate 81\r\n\r\n    numeric_type  ->  DECIMAL .   (rule 22)\r\n\r\n    $default\treduce using rule 22 (numeric_type)\r\n\r\n\r\n\r\nstate 82\r\n\r\n    floating_point_type  ->  DOUBLE .   (rule 33)\r\n\r\n    $default\treduce using rule 33 (floating_point_type)\r\n\r\n\r\n\r\nstate 83\r\n\r\n    floating_point_type  ->  FLOAT .   (rule 32)\r\n\r\n    $default\treduce using rule 32 (floating_point_type)\r\n\r\n\r\n\r\nstate 84\r\n\r\n    integral_type  ->  INT .   (rule 27)\r\n\r\n    $default\treduce using rule 27 (integral_type)\r\n\r\n\r\n\r\nstate 85\r\n\r\n    integral_type  ->  LONG .   (rule 29)\r\n\r\n    $default\treduce using rule 29 (integral_type)\r\n\r\n\r\n\r\nstate 86\r\n\r\n    class_type  ->  OBJECT .   (rule 34)\r\n\r\n    $default\treduce using rule 34 (class_type)\r\n\r\n\r\n\r\nstate 87\r\n\r\n    integral_type  ->  SBYTE .   (rule 23)\r\n\r\n    $default\treduce using rule 23 (integral_type)\r\n\r\n\r\n\r\nstate 88\r\n\r\n    integral_type  ->  SHORT .   (rule 25)\r\n\r\n    $default\treduce using rule 25 (integral_type)\r\n\r\n\r\n\r\nstate 89\r\n\r\n    class_type  ->  STRING .   (rule 35)\r\n\r\n    $default\treduce using rule 35 (class_type)\r\n\r\n\r\n\r\nstate 90\r\n\r\n    integral_type  ->  UINT .   (rule 28)\r\n\r\n    $default\treduce using rule 28 (integral_type)\r\n\r\n\r\n\r\nstate 91\r\n\r\n    integral_type  ->  ULONG .   (rule 30)\r\n\r\n    $default\treduce using rule 30 (integral_type)\r\n\r\n\r\n\r\nstate 92\r\n\r\n    integral_type  ->  USHORT .   (rule 26)\r\n\r\n    $default\treduce using rule 26 (integral_type)\r\n\r\n\r\n\r\nstate 93\r\n\r\n    pointer_type  ->  VOID . '*'   (rule 37)\r\n    return_type  ->  VOID .   (rule 371)\r\n\r\n    '*' \tshift, and go to state 122\r\n\r\n    $default\treduce using rule 371 (return_type)\r\n\r\n\r\n\r\nstate 94\r\n\r\n    non_array_type  ->  type_name .   (rule 14)\r\n\r\n    $default\treduce using rule 14 (non_array_type)\r\n\r\n\r\n\r\nstate 95\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    return_type  ->  type .   (rule 370)\r\n\r\n    '*' \tshift, and go to state 123\r\n\r\n    $default\treduce using rule 370 (return_type)\r\n\r\n\r\n\r\nstate 96\r\n\r\n    type  ->  non_array_type .   (rule 11)\r\n\r\n    $default\treduce using rule 11 (type)\r\n\r\n\r\n\r\nstate 97\r\n\r\n    non_array_type  ->  simple_type .   (rule 13)\r\n    array_type  ->  simple_type . rank_specifier   (rule 39)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n\r\n    $default\treduce using rule 13 (non_array_type)\r\n\r\n    rank_specifier\tgo to state 125\r\n\r\n\r\n\r\nstate 98\r\n\r\n    simple_type  ->  primitive_type .   (rule 15)\r\n\r\n    $default\treduce using rule 15 (simple_type)\r\n\r\n\r\n\r\nstate 99\r\n\r\n    primitive_type  ->  numeric_type .   (rule 18)\r\n\r\n    $default\treduce using rule 18 (primitive_type)\r\n\r\n\r\n\r\nstate 100\r\n\r\n    numeric_type  ->  integral_type .   (rule 20)\r\n\r\n    $default\treduce using rule 20 (numeric_type)\r\n\r\n\r\n\r\nstate 101\r\n\r\n    numeric_type  ->  floating_point_type .   (rule 21)\r\n\r\n    $default\treduce using rule 21 (numeric_type)\r\n\r\n\r\n\r\nstate 102\r\n\r\n    simple_type  ->  class_type .   (rule 16)\r\n\r\n    $default\treduce using rule 16 (simple_type)\r\n\r\n\r\n\r\nstate 103\r\n\r\n    simple_type  ->  pointer_type .   (rule 17)\r\n\r\n    $default\treduce using rule 17 (simple_type)\r\n\r\n\r\n\r\nstate 104\r\n\r\n    type  ->  array_type .   (rule 12)\r\n    array_type  ->  array_type . rank_specifier   (rule 38)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n\r\n    $default\treduce using rule 12 (type)\r\n\r\n    rank_specifier\tgo to state 126\r\n\r\n\r\n\r\nstate 105\r\n\r\n    type_name  ->  qualified_identifier .   (rule 10)\r\n    array_type  ->  qualified_identifier . rank_specifier   (rule 40)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n\r\n    $default\treduce using rule 10 (type_name)\r\n\r\n    rank_specifier\tgo to state 127\r\n\r\n\r\n\r\nstate 106\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE return_type . IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    IDENTIFIER\tshift, and go to state 128\r\n\r\n\r\n\r\nstate 107\r\n\r\n    enum_declaration  ->  attributes_opt modifiers_opt ENUM IDENTIFIER . enum_base_opt enum_body comma_opt   (rule 494)\r\n\r\n    ':' \tshift, and go to state 129\r\n\r\n    $default\treduce using rule 495 (enum_base_opt)\r\n\r\n    enum_base_opt\tgo to state 130\r\n    enum_base\tgo to state 131\r\n\r\n\r\n\r\nstate 108\r\n\r\n    interface_declaration  ->  attributes_opt modifiers_opt INTERFACE IDENTIFIER . interface_base_opt interface_body comma_opt   (rule 468)\r\n\r\n    ':' \tshift, and go to state 132\r\n\r\n    $default\treduce using rule 469 (interface_base_opt)\r\n\r\n    interface_base_opt\tgo to state 133\r\n    interface_base\tgo to state 134\r\n\r\n\r\n\r\nstate 109\r\n\r\n    struct_declaration  ->  attributes_opt modifiers_opt STRUCT IDENTIFIER . struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n\r\n    ':' \tshift, and go to state 135\r\n\r\n    $default\treduce using rule 445 (struct_interfaces_opt)\r\n\r\n    struct_interfaces_opt\tgo to state 136\r\n    struct_interfaces\tgo to state 137\r\n\r\n\r\n\r\nstate 110\r\n\r\n    attribute_name  ->  type_name .   (rule 529)\r\n\r\n    $default\treduce using rule 529 (attribute_name)\r\n\r\n\r\n\r\nstate 111\r\n\r\n    type_name  ->  qualified_identifier .   (rule 10)\r\n\r\n    $default\treduce using rule 10 (type_name)\r\n\r\n\r\n\r\nstate 112\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list . RIGHT_BRACKET EXIT_attrib   (rule 510)\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list . COMMA RIGHT_BRACKET EXIT_attrib   (rule 511)\r\n    attribute_list  ->  attribute_list . COMMA attribute   (rule 525)\r\n\r\n    COMMA\tshift, and go to state 138\r\n    RIGHT_BRACKET\tshift, and go to state 139\r\n\r\n\r\n\r\nstate 113\r\n\r\n    attribute_list  ->  attribute .   (rule 524)\r\n\r\n    $default\treduce using rule 524 (attribute_list)\r\n\r\n\r\n\r\nstate 114\r\n\r\n    attribute  ->  attribute_name . attribute_arguments_opt   (rule 526)\r\n\r\n    '(' \tshift, and go to state 140\r\n\r\n    $default\treduce using rule 527 (attribute_arguments_opt)\r\n\r\n    attribute_arguments_opt\tgo to state 141\r\n    attribute_arguments\tgo to state 142\r\n\r\n\r\n\r\nstate 115\r\n\r\n    attribute_target_specifier  ->  attribute_target ':' .   (rule 514)\r\n\r\n    $default\treduce using rule 514 (attribute_target_specifier)\r\n\r\n\r\n\r\nstate 116\r\n\r\n    namespace_body  ->  '{' using_directives_opt . namespace_member_declarations_opt '}'   (rule 306)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 297 (namespace_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 48\r\n    namespace_member_declarations_opt\tgo to state 143\r\n    namespace_declaration\tgo to state 12\r\n    namespace_member_declarations\tgo to state 144\r\n    namespace_member_declaration\tgo to state 14\r\n    type_declaration\tgo to state 15\r\n    class_declaration\tgo to state 16\r\n    struct_declaration\tgo to state 17\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 117\r\n\r\n    comma_opt  ->  ';' .   (rule 301)\r\n\r\n    $default\treduce using rule 301 (comma_opt)\r\n\r\n\r\n\r\nstate 118\r\n\r\n    namespace_declaration  ->  attributes_opt NAMESPACE qualified_identifier namespace_body comma_opt .   (rule 299)\r\n\r\n    $default\treduce using rule 299 (namespace_declaration)\r\n\r\n\r\n\r\nstate 119\r\n\r\n    class_base  ->  ':' . class_type   (rule 343)\r\n    class_base  ->  ':' . interface_type_list   (rule 344)\r\n    class_base  ->  ':' . class_type COMMA interface_type_list   (rule 345)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    OBJECT\tshift, and go to state 86\r\n    STRING\tshift, and go to state 89\r\n\r\n    type_name\tgo to state 145\r\n    class_type\tgo to state 146\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n    interface_type_list\tgo to state 147\r\n\r\n\r\n\r\nstate 120\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt CLASS IDENTIFIER class_base_opt . class_body comma_opt   (rule 340)\r\n\r\n    '{' \tshift, and go to state 148\r\n\r\n    class_body\tgo to state 149\r\n\r\n\r\n\r\nstate 121\r\n\r\n    class_base_opt  ->  class_base .   (rule 342)\r\n\r\n    $default\treduce using rule 342 (class_base_opt)\r\n\r\n\r\n\r\nstate 122\r\n\r\n    pointer_type  ->  VOID '*' .   (rule 37)\r\n\r\n    $default\treduce using rule 37 (pointer_type)\r\n\r\n\r\n\r\nstate 123\r\n\r\n    pointer_type  ->  type '*' .   (rule 36)\r\n\r\n    $default\treduce using rule 36 (pointer_type)\r\n\r\n\r\n\r\nstate 124\r\n\r\n    rank_specifier  ->  RANK_SPECIFIER .   (rule 43)\r\n\r\n    $default\treduce using rule 43 (rank_specifier)\r\n\r\n\r\n\r\nstate 125\r\n\r\n    array_type  ->  simple_type rank_specifier .   (rule 39)\r\n\r\n    $default\treduce using rule 39 (array_type)\r\n\r\n\r\n\r\nstate 126\r\n\r\n    array_type  ->  array_type rank_specifier .   (rule 38)\r\n\r\n    $default\treduce using rule 38 (array_type)\r\n\r\n\r\n\r\nstate 127\r\n\r\n    array_type  ->  qualified_identifier rank_specifier .   (rule 40)\r\n\r\n    $default\treduce using rule 40 (array_type)\r\n\r\n\r\n\r\nstate 128\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER . '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    '(' \tshift, and go to state 150\r\n\r\n\r\n\r\nstate 129\r\n\r\n    enum_base  ->  ':' . integral_type   (rule 497)\r\n\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n\r\n    integral_type\tgo to state 151\r\n\r\n\r\n\r\nstate 130\r\n\r\n    enum_declaration  ->  attributes_opt modifiers_opt ENUM IDENTIFIER enum_base_opt . enum_body comma_opt   (rule 494)\r\n\r\n    '{' \tshift, and go to state 152\r\n\r\n    enum_body\tgo to state 153\r\n\r\n\r\n\r\nstate 131\r\n\r\n    enum_base_opt  ->  enum_base .   (rule 496)\r\n\r\n    $default\treduce using rule 496 (enum_base_opt)\r\n\r\n\r\n\r\nstate 132\r\n\r\n    interface_base  ->  ':' . interface_type_list   (rule 471)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    type_name\tgo to state 145\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n    interface_type_list\tgo to state 154\r\n\r\n\r\n\r\nstate 133\r\n\r\n    interface_declaration  ->  attributes_opt modifiers_opt INTERFACE IDENTIFIER interface_base_opt . interface_body comma_opt   (rule 468)\r\n\r\n    '{' \tshift, and go to state 155\r\n\r\n    interface_body\tgo to state 156\r\n\r\n\r\n\r\nstate 134\r\n\r\n    interface_base_opt  ->  interface_base .   (rule 470)\r\n\r\n    $default\treduce using rule 470 (interface_base_opt)\r\n\r\n\r\n\r\nstate 135\r\n\r\n    struct_interfaces  ->  ':' . interface_type_list   (rule 447)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    type_name\tgo to state 145\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n    interface_type_list\tgo to state 157\r\n\r\n\r\n\r\nstate 136\r\n\r\n    struct_declaration  ->  attributes_opt modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt . struct_body comma_opt   (rule 444)\r\n\r\n    '{' \tshift, and go to state 158\r\n\r\n    struct_body\tgo to state 159\r\n\r\n\r\n\r\nstate 137\r\n\r\n    struct_interfaces_opt  ->  struct_interfaces .   (rule 446)\r\n\r\n    $default\treduce using rule 446 (struct_interfaces_opt)\r\n\r\n\r\n\r\nstate 138\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list COMMA . RIGHT_BRACKET EXIT_attrib   (rule 511)\r\n    attribute_list  ->  attribute_list COMMA . attribute   (rule 525)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    RIGHT_BRACKET\tshift, and go to state 160\r\n\r\n    type_name\tgo to state 110\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n    attribute\tgo to state 161\r\n    attribute_name\tgo to state 114\r\n\r\n\r\n\r\nstate 139\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list RIGHT_BRACKET . EXIT_attrib   (rule 510)\r\n\r\n    $default\treduce using rule 532 (EXIT_attrib)\r\n\r\n    EXIT_attrib\tgo to state 162\r\n\r\n\r\n\r\nstate 140\r\n\r\n    attribute_arguments  ->  '(' . expression_list_opt ')'   (rule 530)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 74 (expression_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    expression_list_opt\tgo to state 196\r\n    expression_list\tgo to state 197\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 229\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 141\r\n\r\n    attribute  ->  attribute_name attribute_arguments_opt .   (rule 526)\r\n\r\n    $default\treduce using rule 526 (attribute)\r\n\r\n\r\n\r\nstate 142\r\n\r\n    attribute_arguments_opt  ->  attribute_arguments .   (rule 528)\r\n\r\n    $default\treduce using rule 528 (attribute_arguments_opt)\r\n\r\n\r\n\r\nstate 143\r\n\r\n    namespace_body  ->  '{' using_directives_opt namespace_member_declarations_opt . '}'   (rule 306)\r\n\r\n    '}' \tshift, and go to state 231\r\n\r\n\r\n\r\nstate 144\r\n\r\n    namespace_member_declarations_opt  ->  namespace_member_declarations .   (rule 298)\r\n    namespace_member_declarations  ->  namespace_member_declarations . namespace_member_declaration   (rule 314)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 298 (namespace_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 48\r\n    namespace_declaration\tgo to state 12\r\n    namespace_member_declaration\tgo to state 49\r\n    type_declaration\tgo to state 15\r\n    class_declaration\tgo to state 16\r\n    struct_declaration\tgo to state 17\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 145\r\n\r\n    interface_type_list  ->  type_name .   (rule 346)\r\n\r\n    $default\treduce using rule 346 (interface_type_list)\r\n\r\n\r\n\r\nstate 146\r\n\r\n    class_base  ->  ':' class_type .   (rule 343)\r\n    class_base  ->  ':' class_type . COMMA interface_type_list   (rule 345)\r\n\r\n    COMMA\tshift, and go to state 232\r\n\r\n    $default\treduce using rule 343 (class_base)\r\n\r\n\r\n\r\nstate 147\r\n\r\n    class_base  ->  ':' interface_type_list .   (rule 344)\r\n    interface_type_list  ->  interface_type_list . COMMA type_name   (rule 347)\r\n\r\n    COMMA\tshift, and go to state 233\r\n\r\n    $default\treduce using rule 344 (class_base)\r\n\r\n\r\n\r\nstate 148\r\n\r\n    class_body  ->  '{' . class_member_declarations_opt '}'   (rule 348)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 349 (class_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 234\r\n    type_declaration\tgo to state 235\r\n    class_declaration\tgo to state 16\r\n    class_member_declarations_opt\tgo to state 236\r\n    class_member_declarations\tgo to state 237\r\n    class_member_declaration\tgo to state 238\r\n    constant_declaration\tgo to state 239\r\n    field_declaration\tgo to state 240\r\n    method_declaration\tgo to state 241\r\n    method_header\tgo to state 242\r\n    property_declaration\tgo to state 243\r\n    event_declaration\tgo to state 244\r\n    indexer_declaration\tgo to state 245\r\n    operator_declaration\tgo to state 246\r\n    constructor_declaration\tgo to state 247\r\n    destructor_declaration\tgo to state 248\r\n    struct_declaration\tgo to state 17\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 149\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt CLASS IDENTIFIER class_base_opt class_body . comma_opt   (rule 340)\r\n\r\n    ';' \tshift, and go to state 117\r\n\r\n    $default\treduce using rule 300 (comma_opt)\r\n\r\n    comma_opt\tgo to state 249\r\n\r\n\r\n\r\nstate 150\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER '(' . formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    ')' \treduce using rule 368 (formal_parameter_list_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list_opt\tgo to state 251\r\n    formal_parameter_list\tgo to state 252\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 151\r\n\r\n    enum_base  ->  ':' integral_type .   (rule 497)\r\n\r\n    $default\treduce using rule 497 (enum_base)\r\n\r\n\r\n\r\nstate 152\r\n\r\n    enum_body  ->  '{' . enum_member_declarations_opt '}'   (rule 498)\r\n    enum_body  ->  '{' . enum_member_declarations COMMA '}'   (rule 499)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 500 (enum_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 256\r\n    enum_member_declarations_opt\tgo to state 257\r\n    enum_member_declarations\tgo to state 258\r\n    enum_member_declaration\tgo to state 259\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 153\r\n\r\n    enum_declaration  ->  attributes_opt modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body . comma_opt   (rule 494)\r\n\r\n    ';' \tshift, and go to state 117\r\n\r\n    $default\treduce using rule 300 (comma_opt)\r\n\r\n    comma_opt\tgo to state 260\r\n\r\n\r\n\r\nstate 154\r\n\r\n    interface_type_list  ->  interface_type_list . COMMA type_name   (rule 347)\r\n    interface_base  ->  ':' interface_type_list .   (rule 471)\r\n\r\n    COMMA\tshift, and go to state 233\r\n\r\n    $default\treduce using rule 471 (interface_base)\r\n\r\n\r\n\r\nstate 155\r\n\r\n    interface_body  ->  '{' . interface_member_declarations_opt '}'   (rule 472)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 473 (interface_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 261\r\n    interface_member_declarations_opt\tgo to state 262\r\n    interface_member_declarations\tgo to state 263\r\n    interface_member_declaration\tgo to state 264\r\n    interface_method_declaration\tgo to state 265\r\n    interface_property_declaration\tgo to state 266\r\n    interface_indexer_declaration\tgo to state 267\r\n    interface_event_declaration\tgo to state 268\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 156\r\n\r\n    interface_declaration  ->  attributes_opt modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body . comma_opt   (rule 468)\r\n\r\n    ';' \tshift, and go to state 117\r\n\r\n    $default\treduce using rule 300 (comma_opt)\r\n\r\n    comma_opt\tgo to state 269\r\n\r\n\r\n\r\nstate 157\r\n\r\n    interface_type_list  ->  interface_type_list . COMMA type_name   (rule 347)\r\n    struct_interfaces  ->  ':' interface_type_list .   (rule 447)\r\n\r\n    COMMA\tshift, and go to state 233\r\n\r\n    $default\treduce using rule 447 (struct_interfaces)\r\n\r\n\r\n\r\nstate 158\r\n\r\n    struct_body  ->  '{' . struct_member_declarations_opt '}'   (rule 448)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 449 (struct_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 270\r\n    type_declaration\tgo to state 271\r\n    class_declaration\tgo to state 16\r\n    constant_declaration\tgo to state 272\r\n    field_declaration\tgo to state 273\r\n    method_declaration\tgo to state 274\r\n    method_header\tgo to state 242\r\n    property_declaration\tgo to state 275\r\n    event_declaration\tgo to state 276\r\n    indexer_declaration\tgo to state 277\r\n    operator_declaration\tgo to state 278\r\n    constructor_declaration\tgo to state 279\r\n    struct_declaration\tgo to state 17\r\n    struct_member_declarations_opt\tgo to state 280\r\n    struct_member_declarations\tgo to state 281\r\n    struct_member_declaration\tgo to state 282\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 159\r\n\r\n    struct_declaration  ->  attributes_opt modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body . comma_opt   (rule 444)\r\n\r\n    ';' \tshift, and go to state 117\r\n\r\n    $default\treduce using rule 300 (comma_opt)\r\n\r\n    comma_opt\tgo to state 283\r\n\r\n\r\n\r\nstate 160\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list COMMA RIGHT_BRACKET . EXIT_attrib   (rule 511)\r\n\r\n    $default\treduce using rule 532 (EXIT_attrib)\r\n\r\n    EXIT_attrib\tgo to state 284\r\n\r\n\r\n\r\nstate 161\r\n\r\n    attribute_list  ->  attribute_list COMMA attribute .   (rule 525)\r\n\r\n    $default\treduce using rule 525 (attribute_list)\r\n\r\n\r\n\r\nstate 162\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list RIGHT_BRACKET EXIT_attrib .   (rule 510)\r\n\r\n    $default\treduce using rule 510 (attribute_section)\r\n\r\n\r\n\r\nstate 163\r\n\r\n    literal  ->  INTEGER_LITERAL .   (rule 2)\r\n\r\n    $default\treduce using rule 2 (literal)\r\n\r\n\r\n\r\nstate 164\r\n\r\n    literal  ->  REAL_LITERAL .   (rule 3)\r\n\r\n    $default\treduce using rule 3 (literal)\r\n\r\n\r\n\r\nstate 165\r\n\r\n    literal  ->  CHARACTER_LITERAL .   (rule 4)\r\n\r\n    $default\treduce using rule 4 (literal)\r\n\r\n\r\n\r\nstate 166\r\n\r\n    literal  ->  STRING_LITERAL .   (rule 5)\r\n\r\n    $default\treduce using rule 5 (literal)\r\n\r\n\r\n\r\nstate 167\r\n\r\n    base_access  ->  BASE . '.' IDENTIFIER   (rule 79)\r\n    base_access  ->  BASE . LEFT_BRACKET expression_list RIGHT_BRACKET   (rule 80)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 285\r\n    '.' \tshift, and go to state 286\r\n\r\n\r\n\r\nstate 168\r\n\r\n    checked_expression  ->  CHECKED . '(' expression ')'   (rule 91)\r\n\r\n    '(' \tshift, and go to state 287\r\n\r\n\r\n\r\nstate 169\r\n\r\n    boolean_literal  ->  FALSE .   (rule 8)\r\n\r\n    $default\treduce using rule 8 (boolean_literal)\r\n\r\n\r\n\r\nstate 170\r\n\r\n    object_creation_expression  ->  NEW . type '(' argument_list_opt ')'   (rule 84)\r\n    array_creation_expression  ->  NEW . non_array_type LEFT_BRACKET expression_list RIGHT_BRACKET rank_specifiers_opt array_initializer_opt   (rule 85)\r\n    array_creation_expression  ->  NEW . array_type array_initializer   (rule 86)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 289\r\n    non_array_type\tgo to state 290\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 291\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 171\r\n\r\n    literal  ->  NULL_LITERAL .   (rule 6)\r\n\r\n    $default\treduce using rule 6 (literal)\r\n\r\n\r\n\r\nstate 172\r\n\r\n    sizeof_expression  ->  SIZEOF . '(' type ')'   (rule 95)\r\n\r\n    '(' \tshift, and go to state 292\r\n\r\n\r\n\r\nstate 173\r\n\r\n    this_access  ->  THIS .   (rule 78)\r\n\r\n    $default\treduce using rule 78 (this_access)\r\n\r\n\r\n\r\nstate 174\r\n\r\n    boolean_literal  ->  TRUE .   (rule 7)\r\n\r\n    $default\treduce using rule 7 (boolean_literal)\r\n\r\n\r\n\r\nstate 175\r\n\r\n    typeof_expression  ->  TYPEOF . '(' type ')'   (rule 89)\r\n    typeof_expression  ->  TYPEOF . '(' VOID ')'   (rule 90)\r\n\r\n    '(' \tshift, and go to state 293\r\n\r\n\r\n\r\nstate 176\r\n\r\n    unchecked_expression  ->  UNCHECKED . '(' expression ')'   (rule 92)\r\n\r\n    '(' \tshift, and go to state 294\r\n\r\n\r\n\r\nstate 177\r\n\r\n    pre_increment_expression  ->  PLUSPLUS . unary_expression   (rule 105)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 295\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 178\r\n\r\n    pre_decrement_expression  ->  MINUSMINUS . unary_expression   (rule 106)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 296\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 179\r\n\r\n    unary_expression  ->  '*' . unary_expression   (rule 110)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 297\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 180\r\n\r\n    parenthesized_expression  ->  '(' . expression ')'   (rule 64)\r\n    cast_expression  ->  '(' . expression ')' unary_expression_not_plusminus   (rule 114)\r\n    cast_expression  ->  '(' . multiplicative_expression '*' ')' unary_expression   (rule 115)\r\n    cast_expression  ->  '(' . qualified_identifier rank_specifier type_quals_opt ')' unary_expression   (rule 116)\r\n    cast_expression  ->  '(' . primitive_type type_quals_opt ')' unary_expression   (rule 117)\r\n    cast_expression  ->  '(' . class_type type_quals_opt ')' unary_expression   (rule 118)\r\n    cast_expression  ->  '(' . VOID type_quals_opt ')' unary_expression   (rule 119)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 298\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 299\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 300\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 301\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 302\r\n    qualified_identifier\tgo to state 303\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 181\r\n\r\n    addressof_expression  ->  '&' . unary_expression   (rule 94)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 304\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 182\r\n\r\n    unary_expression_not_plusminus  ->  '!' . unary_expression   (rule 102)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 305\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 183\r\n\r\n    unary_expression_not_plusminus  ->  '~' . unary_expression   (rule 103)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 306\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 184\r\n\r\n    unary_expression  ->  '+' . unary_expression   (rule 108)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 307\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 185\r\n\r\n    unary_expression  ->  '-' . unary_expression   (rule 109)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 308\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 186\r\n\r\n    primary_expression_no_parenthesis  ->  literal .   (rule 52)\r\n\r\n    $default\treduce using rule 52 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 187\r\n\r\n    literal  ->  boolean_literal .   (rule 1)\r\n\r\n    $default\treduce using rule 1 (literal)\r\n\r\n\r\n\r\nstate 188\r\n\r\n    member_access  ->  primitive_type . '.' IDENTIFIER   (rule 66)\r\n\r\n    '.' \tshift, and go to state 309\r\n\r\n\r\n\r\nstate 189\r\n\r\n    member_access  ->  class_type . '.' IDENTIFIER   (rule 67)\r\n\r\n    '.' \tshift, and go to state 310\r\n\r\n\r\n\r\nstate 190\r\n\r\n    member_access  ->  primary_expression . '.' IDENTIFIER   (rule 65)\r\n    element_access  ->  primary_expression . LEFT_BRACKET expression_list RIGHT_BRACKET   (rule 72)\r\n    postfix_expression  ->  primary_expression .   (rule 96)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 311\r\n    '.' \tshift, and go to state 312\r\n\r\n    $default\treduce using rule 96 (postfix_expression)\r\n\r\n\r\n\r\nstate 191\r\n\r\n    primary_expression  ->  primary_expression_no_parenthesis .   (rule 51)\r\n    invocation_expression  ->  primary_expression_no_parenthesis . '(' argument_list_opt ')'   (rule 68)\r\n\r\n    '(' \tshift, and go to state 313\r\n\r\n    $default\treduce using rule 51 (primary_expression)\r\n\r\n\r\n\r\nstate 192\r\n\r\n    primary_expression  ->  parenthesized_expression .   (rule 50)\r\n\r\n    $default\treduce using rule 50 (primary_expression)\r\n\r\n\r\n\r\nstate 193\r\n\r\n    primary_expression_no_parenthesis  ->  member_access .   (rule 54)\r\n\r\n    $default\treduce using rule 54 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 194\r\n\r\n    primary_expression_no_parenthesis  ->  invocation_expression .   (rule 55)\r\n\r\n    $default\treduce using rule 55 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 195\r\n\r\n    primary_expression_no_parenthesis  ->  element_access .   (rule 56)\r\n\r\n    $default\treduce using rule 56 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 196\r\n\r\n    attribute_arguments  ->  '(' expression_list_opt . ')'   (rule 530)\r\n\r\n    ')' \tshift, and go to state 314\r\n\r\n\r\n\r\nstate 197\r\n\r\n    expression_list_opt  ->  expression_list .   (rule 75)\r\n    expression_list  ->  expression_list . COMMA expression   (rule 77)\r\n\r\n    COMMA\tshift, and go to state 315\r\n\r\n    $default\treduce using rule 75 (expression_list_opt)\r\n\r\n\r\n\r\nstate 198\r\n\r\n    primary_expression_no_parenthesis  ->  this_access .   (rule 57)\r\n\r\n    $default\treduce using rule 57 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 199\r\n\r\n    primary_expression_no_parenthesis  ->  base_access .   (rule 58)\r\n\r\n    $default\treduce using rule 58 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 200\r\n\r\n    postfix_expression  ->  post_increment_expression .   (rule 98)\r\n\r\n    $default\treduce using rule 98 (postfix_expression)\r\n\r\n\r\n\r\nstate 201\r\n\r\n    postfix_expression  ->  post_decrement_expression .   (rule 99)\r\n\r\n    $default\treduce using rule 99 (postfix_expression)\r\n\r\n\r\n\r\nstate 202\r\n\r\n    primary_expression_no_parenthesis  ->  new_expression .   (rule 59)\r\n\r\n    $default\treduce using rule 59 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 203\r\n\r\n    new_expression  ->  object_creation_expression .   (rule 83)\r\n\r\n    $default\treduce using rule 83 (new_expression)\r\n\r\n\r\n\r\nstate 204\r\n\r\n    primary_expression_no_parenthesis  ->  array_creation_expression .   (rule 53)\r\n\r\n    $default\treduce using rule 53 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 205\r\n\r\n    primary_expression_no_parenthesis  ->  typeof_expression .   (rule 60)\r\n\r\n    $default\treduce using rule 60 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 206\r\n\r\n    primary_expression_no_parenthesis  ->  checked_expression .   (rule 62)\r\n\r\n    $default\treduce using rule 62 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 207\r\n\r\n    primary_expression_no_parenthesis  ->  unchecked_expression .   (rule 63)\r\n\r\n    $default\treduce using rule 63 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 208\r\n\r\n    postfix_expression  ->  pointer_member_access .   (rule 100)\r\n\r\n    $default\treduce using rule 100 (postfix_expression)\r\n\r\n\r\n\r\nstate 209\r\n\r\n    unary_expression  ->  addressof_expression .   (rule 113)\r\n\r\n    $default\treduce using rule 113 (unary_expression)\r\n\r\n\r\n\r\nstate 210\r\n\r\n    primary_expression_no_parenthesis  ->  sizeof_expression .   (rule 61)\r\n\r\n    $default\treduce using rule 61 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 211\r\n\r\n    post_increment_expression  ->  postfix_expression . PLUSPLUS   (rule 81)\r\n    post_decrement_expression  ->  postfix_expression . MINUSMINUS   (rule 82)\r\n    pointer_member_access  ->  postfix_expression . ARROW IDENTIFIER   (rule 93)\r\n    unary_expression_not_plusminus  ->  postfix_expression .   (rule 101)\r\n\r\n    PLUSPLUS\tshift, and go to state 316\r\n    MINUSMINUS\tshift, and go to state 317\r\n    ARROW\tshift, and go to state 318\r\n\r\n    $default\treduce using rule 101 (unary_expression_not_plusminus)\r\n\r\n\r\n\r\nstate 212\r\n\r\n    unary_expression  ->  unary_expression_not_plusminus .   (rule 107)\r\n\r\n    $default\treduce using rule 107 (unary_expression)\r\n\r\n\r\n\r\nstate 213\r\n\r\n    unary_expression  ->  pre_increment_expression .   (rule 111)\r\n\r\n    $default\treduce using rule 111 (unary_expression)\r\n\r\n\r\n\r\nstate 214\r\n\r\n    unary_expression  ->  pre_decrement_expression .   (rule 112)\r\n\r\n    $default\treduce using rule 112 (unary_expression)\r\n\r\n\r\n\r\nstate 215\r\n\r\n    multiplicative_expression  ->  unary_expression .   (rule 126)\r\n    assignment  ->  unary_expression . assignment_operator expression   (rule 158)\r\n\r\n    PLUSEQ\tshift, and go to state 319\r\n    MINUSEQ\tshift, and go to state 320\r\n    STAREQ\tshift, and go to state 321\r\n    DIVEQ\tshift, and go to state 322\r\n    MODEQ\tshift, and go to state 323\r\n    XOREQ\tshift, and go to state 324\r\n    ANDEQ\tshift, and go to state 325\r\n    OREQ\tshift, and go to state 326\r\n    GTGTEQ\tshift, and go to state 327\r\n    LTLTEQ\tshift, and go to state 328\r\n    '=' \tshift, and go to state 329\r\n\r\n    $default\treduce using rule 126 (multiplicative_expression)\r\n\r\n    assignment_operator\tgo to state 330\r\n\r\n\r\n\r\nstate 216\r\n\r\n    unary_expression_not_plusminus  ->  cast_expression .   (rule 104)\r\n\r\n    $default\treduce using rule 104 (unary_expression_not_plusminus)\r\n\r\n\r\n\r\nstate 217\r\n\r\n    multiplicative_expression  ->  multiplicative_expression . '*' unary_expression   (rule 127)\r\n    multiplicative_expression  ->  multiplicative_expression . '/' unary_expression   (rule 128)\r\n    multiplicative_expression  ->  multiplicative_expression . '%' unary_expression   (rule 129)\r\n    additive_expression  ->  multiplicative_expression .   (rule 130)\r\n\r\n    '*' \tshift, and go to state 331\r\n    '/' \tshift, and go to state 332\r\n    '%' \tshift, and go to state 333\r\n\r\n    $default\treduce using rule 130 (additive_expression)\r\n\r\n\r\n\r\nstate 218\r\n\r\n    additive_expression  ->  additive_expression . '+' multiplicative_expression   (rule 131)\r\n    additive_expression  ->  additive_expression . '-' multiplicative_expression   (rule 132)\r\n    shift_expression  ->  additive_expression .   (rule 133)\r\n\r\n    '+' \tshift, and go to state 334\r\n    '-' \tshift, and go to state 335\r\n\r\n    $default\treduce using rule 133 (shift_expression)\r\n\r\n\r\n\r\nstate 219\r\n\r\n    shift_expression  ->  shift_expression . LTLT additive_expression   (rule 134)\r\n    shift_expression  ->  shift_expression . GTGT additive_expression   (rule 135)\r\n    relational_expression  ->  shift_expression .   (rule 136)\r\n\r\n    LTLT\tshift, and go to state 336\r\n    GTGT\tshift, and go to state 337\r\n\r\n    $default\treduce using rule 136 (relational_expression)\r\n\r\n\r\n\r\nstate 220\r\n\r\n    relational_expression  ->  relational_expression . '<' shift_expression   (rule 137)\r\n    relational_expression  ->  relational_expression . '>' shift_expression   (rule 138)\r\n    relational_expression  ->  relational_expression . LEQ shift_expression   (rule 139)\r\n    relational_expression  ->  relational_expression . GEQ shift_expression   (rule 140)\r\n    relational_expression  ->  relational_expression . IS type   (rule 141)\r\n    relational_expression  ->  relational_expression . AS type   (rule 142)\r\n    equality_expression  ->  relational_expression .   (rule 143)\r\n\r\n    AS  \tshift, and go to state 338\r\n    IS  \tshift, and go to state 339\r\n    LEQ \tshift, and go to state 340\r\n    GEQ \tshift, and go to state 341\r\n    '<' \tshift, and go to state 342\r\n    '>' \tshift, and go to state 343\r\n\r\n    $default\treduce using rule 143 (equality_expression)\r\n\r\n\r\n\r\nstate 221\r\n\r\n    equality_expression  ->  equality_expression . EQEQ relational_expression   (rule 144)\r\n    equality_expression  ->  equality_expression . NOTEQ relational_expression   (rule 145)\r\n    and_expression  ->  equality_expression .   (rule 146)\r\n\r\n    EQEQ\tshift, and go to state 344\r\n    NOTEQ\tshift, and go to state 345\r\n\r\n    $default\treduce using rule 146 (and_expression)\r\n\r\n\r\n\r\nstate 222\r\n\r\n    and_expression  ->  and_expression . '&' equality_expression   (rule 147)\r\n    exclusive_or_expression  ->  and_expression .   (rule 148)\r\n\r\n    '&' \tshift, and go to state 346\r\n\r\n    $default\treduce using rule 148 (exclusive_or_expression)\r\n\r\n\r\n\r\nstate 223\r\n\r\n    exclusive_or_expression  ->  exclusive_or_expression . '^' and_expression   (rule 149)\r\n    inclusive_or_expression  ->  exclusive_or_expression .   (rule 150)\r\n\r\n    '^' \tshift, and go to state 347\r\n\r\n    $default\treduce using rule 150 (inclusive_or_expression)\r\n\r\n\r\n\r\nstate 224\r\n\r\n    inclusive_or_expression  ->  inclusive_or_expression . '|' exclusive_or_expression   (rule 151)\r\n    conditional_and_expression  ->  inclusive_or_expression .   (rule 152)\r\n\r\n    '|' \tshift, and go to state 348\r\n\r\n    $default\treduce using rule 152 (conditional_and_expression)\r\n\r\n\r\n\r\nstate 225\r\n\r\n    conditional_and_expression  ->  conditional_and_expression . ANDAND inclusive_or_expression   (rule 153)\r\n    conditional_or_expression  ->  conditional_and_expression .   (rule 154)\r\n\r\n    ANDAND\tshift, and go to state 349\r\n\r\n    $default\treduce using rule 154 (conditional_or_expression)\r\n\r\n\r\n\r\nstate 226\r\n\r\n    conditional_or_expression  ->  conditional_or_expression . OROR conditional_and_expression   (rule 155)\r\n    conditional_expression  ->  conditional_or_expression .   (rule 156)\r\n    conditional_expression  ->  conditional_or_expression . '?' expression ':' expression   (rule 157)\r\n\r\n    OROR\tshift, and go to state 350\r\n    '?' \tshift, and go to state 351\r\n\r\n    $default\treduce using rule 156 (conditional_expression)\r\n\r\n\r\n\r\nstate 227\r\n\r\n    expression  ->  conditional_expression .   (rule 170)\r\n\r\n    $default\treduce using rule 170 (expression)\r\n\r\n\r\n\r\nstate 228\r\n\r\n    expression  ->  assignment .   (rule 171)\r\n\r\n    $default\treduce using rule 171 (expression)\r\n\r\n\r\n\r\nstate 229\r\n\r\n    expression_list  ->  expression .   (rule 76)\r\n\r\n    $default\treduce using rule 76 (expression_list)\r\n\r\n\r\n\r\nstate 230\r\n\r\n    invocation_expression  ->  qualified_identifier . '(' argument_list_opt ')'   (rule 69)\r\n    element_access  ->  qualified_identifier . LEFT_BRACKET expression_list RIGHT_BRACKET   (rule 73)\r\n    postfix_expression  ->  qualified_identifier .   (rule 97)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 352\r\n    '(' \tshift, and go to state 353\r\n\r\n    $default\treduce using rule 97 (postfix_expression)\r\n\r\n\r\n\r\nstate 231\r\n\r\n    namespace_body  ->  '{' using_directives_opt namespace_member_declarations_opt '}' .   (rule 306)\r\n\r\n    $default\treduce using rule 306 (namespace_body)\r\n\r\n\r\n\r\nstate 232\r\n\r\n    class_base  ->  ':' class_type COMMA . interface_type_list   (rule 345)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    type_name\tgo to state 145\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n    interface_type_list\tgo to state 354\r\n\r\n\r\n\r\nstate 233\r\n\r\n    interface_type_list  ->  interface_type_list COMMA . type_name   (rule 347)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n\r\n    type_name\tgo to state 355\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 234\r\n\r\n    class_declaration  ->  attributes_opt . modifiers_opt CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    constant_declaration  ->  attributes_opt . modifiers_opt CONST type constant_declarators ';'   (rule 363)\r\n    field_declaration  ->  attributes_opt . modifiers_opt type variable_declarators ';'   (rule 364)\r\n    method_header  ->  attributes_opt . modifiers_opt type qualified_identifier '(' formal_parameter_list_opt ')'   (rule 366)\r\n    method_header  ->  attributes_opt . modifiers_opt VOID qualified_identifier '(' formal_parameter_list_opt ')'   (rule 367)\r\n    property_declaration  ->  attributes_opt . modifiers_opt type qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n    event_declaration  ->  attributes_opt . modifiers_opt EVENT type variable_declarators ';'   (rule 394)\r\n    event_declaration  ->  attributes_opt . modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n    indexer_declaration  ->  attributes_opt . modifiers_opt indexer_declarator ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 400)\r\n    operator_declaration  ->  attributes_opt . modifiers_opt operator_declarator operator_body   (rule 404)\r\n    constructor_declaration  ->  attributes_opt . modifiers_opt constructor_declarator constructor_body   (rule 433)\r\n    destructor_declaration  ->  attributes_opt . modifiers_opt '~' IDENTIFIER '(' ')' block   (rule 439)\r\n    struct_declaration  ->  attributes_opt . modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt . modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt . modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt . modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    ABSTRACT\tshift, and go to state 30\r\n    EXTERN\tshift, and go to state 31\r\n    INTERNAL\tshift, and go to state 32\r\n    NEW \tshift, and go to state 34\r\n    OVERRIDE\tshift, and go to state 35\r\n    PRIVATE\tshift, and go to state 36\r\n    PROTECTED\tshift, and go to state 37\r\n    PUBLIC\tshift, and go to state 38\r\n    READONLY\tshift, and go to state 39\r\n    SEALED\tshift, and go to state 40\r\n    STATIC\tshift, and go to state 41\r\n    UNSAFE\tshift, and go to state 42\r\n    VIRTUAL\tshift, and go to state 43\r\n    VOLATILE\tshift, and go to state 44\r\n\r\n    $default\treduce using rule 322 (modifiers_opt)\r\n\r\n    modifiers_opt\tgo to state 356\r\n    modifiers\tgo to state 46\r\n    modifier\tgo to state 47\r\n\r\n\r\n\r\nstate 235\r\n\r\n    class_member_declaration  ->  type_declaration .   (rule 362)\r\n\r\n    $default\treduce using rule 362 (class_member_declaration)\r\n\r\n\r\n\r\nstate 236\r\n\r\n    class_body  ->  '{' class_member_declarations_opt . '}'   (rule 348)\r\n\r\n    '}' \tshift, and go to state 357\r\n\r\n\r\n\r\nstate 237\r\n\r\n    class_member_declarations_opt  ->  class_member_declarations .   (rule 350)\r\n    class_member_declarations  ->  class_member_declarations . class_member_declaration   (rule 352)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 350 (class_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 234\r\n    type_declaration\tgo to state 235\r\n    class_declaration\tgo to state 16\r\n    class_member_declaration\tgo to state 358\r\n    constant_declaration\tgo to state 239\r\n    field_declaration\tgo to state 240\r\n    method_declaration\tgo to state 241\r\n    method_header\tgo to state 242\r\n    property_declaration\tgo to state 243\r\n    event_declaration\tgo to state 244\r\n    indexer_declaration\tgo to state 245\r\n    operator_declaration\tgo to state 246\r\n    constructor_declaration\tgo to state 247\r\n    destructor_declaration\tgo to state 248\r\n    struct_declaration\tgo to state 17\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 238\r\n\r\n    class_member_declarations  ->  class_member_declaration .   (rule 351)\r\n\r\n    $default\treduce using rule 351 (class_member_declarations)\r\n\r\n\r\n\r\nstate 239\r\n\r\n    class_member_declaration  ->  constant_declaration .   (rule 353)\r\n\r\n    $default\treduce using rule 353 (class_member_declaration)\r\n\r\n\r\n\r\nstate 240\r\n\r\n    class_member_declaration  ->  field_declaration .   (rule 354)\r\n\r\n    $default\treduce using rule 354 (class_member_declaration)\r\n\r\n\r\n\r\nstate 241\r\n\r\n    class_member_declaration  ->  method_declaration .   (rule 355)\r\n\r\n    $default\treduce using rule 355 (class_member_declaration)\r\n\r\n\r\n\r\nstate 242\r\n\r\n    method_declaration  ->  method_header . method_body   (rule 365)\r\n\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 360\r\n\r\n    block\tgo to state 361\r\n    method_body\tgo to state 362\r\n\r\n\r\n\r\nstate 243\r\n\r\n    class_member_declaration  ->  property_declaration .   (rule 356)\r\n\r\n    $default\treduce using rule 356 (class_member_declaration)\r\n\r\n\r\n\r\nstate 244\r\n\r\n    class_member_declaration  ->  event_declaration .   (rule 357)\r\n\r\n    $default\treduce using rule 357 (class_member_declaration)\r\n\r\n\r\n\r\nstate 245\r\n\r\n    class_member_declaration  ->  indexer_declaration .   (rule 358)\r\n\r\n    $default\treduce using rule 358 (class_member_declaration)\r\n\r\n\r\n\r\nstate 246\r\n\r\n    class_member_declaration  ->  operator_declaration .   (rule 359)\r\n\r\n    $default\treduce using rule 359 (class_member_declaration)\r\n\r\n\r\n\r\nstate 247\r\n\r\n    class_member_declaration  ->  constructor_declaration .   (rule 360)\r\n\r\n    $default\treduce using rule 360 (class_member_declaration)\r\n\r\n\r\n\r\nstate 248\r\n\r\n    class_member_declaration  ->  destructor_declaration .   (rule 361)\r\n\r\n    $default\treduce using rule 361 (class_member_declaration)\r\n\r\n\r\n\r\nstate 249\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt CLASS IDENTIFIER class_base_opt class_body comma_opt .   (rule 340)\r\n\r\n    $default\treduce using rule 340 (class_declaration)\r\n\r\n\r\n\r\nstate 250\r\n\r\n    fixed_parameter  ->  attributes_opt . parameter_modifier_opt type IDENTIFIER   (rule 378)\r\n    parameter_array  ->  attributes_opt . PARAMS type IDENTIFIER   (rule 382)\r\n\r\n    OUT \tshift, and go to state 363\r\n    PARAMS\tshift, and go to state 364\r\n    REF \tshift, and go to state 365\r\n\r\n    $default\treduce using rule 379 (parameter_modifier_opt)\r\n\r\n    parameter_modifier_opt\tgo to state 366\r\n\r\n\r\n\r\nstate 251\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt . ')' ';'   (rule 506)\r\n\r\n    ')' \tshift, and go to state 367\r\n\r\n\r\n\r\nstate 252\r\n\r\n    formal_parameter_list_opt  ->  formal_parameter_list .   (rule 369)\r\n    formal_parameter_list  ->  formal_parameter_list . COMMA formal_parameter   (rule 375)\r\n\r\n    COMMA\tshift, and go to state 368\r\n\r\n    $default\treduce using rule 369 (formal_parameter_list_opt)\r\n\r\n\r\n\r\nstate 253\r\n\r\n    formal_parameter_list  ->  formal_parameter .   (rule 374)\r\n\r\n    $default\treduce using rule 374 (formal_parameter_list)\r\n\r\n\r\n\r\nstate 254\r\n\r\n    formal_parameter  ->  fixed_parameter .   (rule 376)\r\n\r\n    $default\treduce using rule 376 (formal_parameter)\r\n\r\n\r\n\r\nstate 255\r\n\r\n    formal_parameter  ->  parameter_array .   (rule 377)\r\n\r\n    $default\treduce using rule 377 (formal_parameter)\r\n\r\n\r\n\r\nstate 256\r\n\r\n    enum_member_declaration  ->  attributes_opt . IDENTIFIER   (rule 504)\r\n    enum_member_declaration  ->  attributes_opt . IDENTIFIER '=' constant_expression   (rule 505)\r\n\r\n    IDENTIFIER\tshift, and go to state 369\r\n\r\n\r\n\r\nstate 257\r\n\r\n    enum_body  ->  '{' enum_member_declarations_opt . '}'   (rule 498)\r\n\r\n    '}' \tshift, and go to state 370\r\n\r\n\r\n\r\nstate 258\r\n\r\n    enum_body  ->  '{' enum_member_declarations . COMMA '}'   (rule 499)\r\n    enum_member_declarations_opt  ->  enum_member_declarations .   (rule 501)\r\n    enum_member_declarations  ->  enum_member_declarations . COMMA enum_member_declaration   (rule 503)\r\n\r\n    COMMA\tshift, and go to state 371\r\n\r\n    $default\treduce using rule 501 (enum_member_declarations_opt)\r\n\r\n\r\n\r\nstate 259\r\n\r\n    enum_member_declarations  ->  enum_member_declaration .   (rule 502)\r\n\r\n    $default\treduce using rule 502 (enum_member_declarations)\r\n\r\n\r\n\r\nstate 260\r\n\r\n    enum_declaration  ->  attributes_opt modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body comma_opt .   (rule 494)\r\n\r\n    $default\treduce using rule 494 (enum_declaration)\r\n\r\n\r\n\r\nstate 261\r\n\r\n    interface_method_declaration  ->  attributes_opt . new_opt type IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body   (rule 481)\r\n    interface_method_declaration  ->  attributes_opt . new_opt VOID IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body   (rule 482)\r\n    interface_property_declaration  ->  attributes_opt . new_opt type IDENTIFIER ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 485)\r\n    interface_indexer_declaration  ->  attributes_opt . new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n    interface_event_declaration  ->  attributes_opt . new_opt EVENT type IDENTIFIER interface_empty_body   (rule 491)\r\n\r\n    NEW \tshift, and go to state 372\r\n\r\n    $default\treduce using rule 483 (new_opt)\r\n\r\n    new_opt\tgo to state 373\r\n\r\n\r\n\r\nstate 262\r\n\r\n    interface_body  ->  '{' interface_member_declarations_opt . '}'   (rule 472)\r\n\r\n    '}' \tshift, and go to state 374\r\n\r\n\r\n\r\nstate 263\r\n\r\n    interface_member_declarations_opt  ->  interface_member_declarations .   (rule 474)\r\n    interface_member_declarations  ->  interface_member_declarations . interface_member_declaration   (rule 476)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 474 (interface_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 261\r\n    interface_member_declaration\tgo to state 375\r\n    interface_method_declaration\tgo to state 265\r\n    interface_property_declaration\tgo to state 266\r\n    interface_indexer_declaration\tgo to state 267\r\n    interface_event_declaration\tgo to state 268\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 264\r\n\r\n    interface_member_declarations  ->  interface_member_declaration .   (rule 475)\r\n\r\n    $default\treduce using rule 475 (interface_member_declarations)\r\n\r\n\r\n\r\nstate 265\r\n\r\n    interface_member_declaration  ->  interface_method_declaration .   (rule 477)\r\n\r\n    $default\treduce using rule 477 (interface_member_declaration)\r\n\r\n\r\n\r\nstate 266\r\n\r\n    interface_member_declaration  ->  interface_property_declaration .   (rule 478)\r\n\r\n    $default\treduce using rule 478 (interface_member_declaration)\r\n\r\n\r\n\r\nstate 267\r\n\r\n    interface_member_declaration  ->  interface_indexer_declaration .   (rule 480)\r\n\r\n    $default\treduce using rule 480 (interface_member_declaration)\r\n\r\n\r\n\r\nstate 268\r\n\r\n    interface_member_declaration  ->  interface_event_declaration .   (rule 479)\r\n\r\n    $default\treduce using rule 479 (interface_member_declaration)\r\n\r\n\r\n\r\nstate 269\r\n\r\n    interface_declaration  ->  attributes_opt modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt .   (rule 468)\r\n\r\n    $default\treduce using rule 468 (interface_declaration)\r\n\r\n\r\n\r\nstate 270\r\n\r\n    class_declaration  ->  attributes_opt . modifiers_opt CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    constant_declaration  ->  attributes_opt . modifiers_opt CONST type constant_declarators ';'   (rule 363)\r\n    field_declaration  ->  attributes_opt . modifiers_opt type variable_declarators ';'   (rule 364)\r\n    method_header  ->  attributes_opt . modifiers_opt type qualified_identifier '(' formal_parameter_list_opt ')'   (rule 366)\r\n    method_header  ->  attributes_opt . modifiers_opt VOID qualified_identifier '(' formal_parameter_list_opt ')'   (rule 367)\r\n    property_declaration  ->  attributes_opt . modifiers_opt type qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n    event_declaration  ->  attributes_opt . modifiers_opt EVENT type variable_declarators ';'   (rule 394)\r\n    event_declaration  ->  attributes_opt . modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n    indexer_declaration  ->  attributes_opt . modifiers_opt indexer_declarator ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 400)\r\n    operator_declaration  ->  attributes_opt . modifiers_opt operator_declarator operator_body   (rule 404)\r\n    constructor_declaration  ->  attributes_opt . modifiers_opt constructor_declarator constructor_body   (rule 433)\r\n    struct_declaration  ->  attributes_opt . modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt . modifiers_opt INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt . modifiers_opt ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt . modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    ABSTRACT\tshift, and go to state 30\r\n    EXTERN\tshift, and go to state 31\r\n    INTERNAL\tshift, and go to state 32\r\n    NEW \tshift, and go to state 34\r\n    OVERRIDE\tshift, and go to state 35\r\n    PRIVATE\tshift, and go to state 36\r\n    PROTECTED\tshift, and go to state 37\r\n    PUBLIC\tshift, and go to state 38\r\n    READONLY\tshift, and go to state 39\r\n    SEALED\tshift, and go to state 40\r\n    STATIC\tshift, and go to state 41\r\n    UNSAFE\tshift, and go to state 42\r\n    VIRTUAL\tshift, and go to state 43\r\n    VOLATILE\tshift, and go to state 44\r\n\r\n    $default\treduce using rule 322 (modifiers_opt)\r\n\r\n    modifiers_opt\tgo to state 376\r\n    modifiers\tgo to state 46\r\n    modifier\tgo to state 47\r\n\r\n\r\n\r\nstate 271\r\n\r\n    struct_member_declaration  ->  type_declaration .   (rule 461)\r\n\r\n    $default\treduce using rule 461 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 272\r\n\r\n    struct_member_declaration  ->  constant_declaration .   (rule 453)\r\n\r\n    $default\treduce using rule 453 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 273\r\n\r\n    struct_member_declaration  ->  field_declaration .   (rule 454)\r\n\r\n    $default\treduce using rule 454 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 274\r\n\r\n    struct_member_declaration  ->  method_declaration .   (rule 455)\r\n\r\n    $default\treduce using rule 455 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 275\r\n\r\n    struct_member_declaration  ->  property_declaration .   (rule 456)\r\n\r\n    $default\treduce using rule 456 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 276\r\n\r\n    struct_member_declaration  ->  event_declaration .   (rule 457)\r\n\r\n    $default\treduce using rule 457 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 277\r\n\r\n    struct_member_declaration  ->  indexer_declaration .   (rule 458)\r\n\r\n    $default\treduce using rule 458 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 278\r\n\r\n    struct_member_declaration  ->  operator_declaration .   (rule 459)\r\n\r\n    $default\treduce using rule 459 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 279\r\n\r\n    struct_member_declaration  ->  constructor_declaration .   (rule 460)\r\n\r\n    $default\treduce using rule 460 (struct_member_declaration)\r\n\r\n\r\n\r\nstate 280\r\n\r\n    struct_body  ->  '{' struct_member_declarations_opt . '}'   (rule 448)\r\n\r\n    '}' \tshift, and go to state 377\r\n\r\n\r\n\r\nstate 281\r\n\r\n    struct_member_declarations_opt  ->  struct_member_declarations .   (rule 450)\r\n    struct_member_declarations  ->  struct_member_declarations . struct_member_declaration   (rule 452)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 450 (struct_member_declarations_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 270\r\n    type_declaration\tgo to state 271\r\n    class_declaration\tgo to state 16\r\n    constant_declaration\tgo to state 272\r\n    field_declaration\tgo to state 273\r\n    method_declaration\tgo to state 274\r\n    method_header\tgo to state 242\r\n    property_declaration\tgo to state 275\r\n    event_declaration\tgo to state 276\r\n    indexer_declaration\tgo to state 277\r\n    operator_declaration\tgo to state 278\r\n    constructor_declaration\tgo to state 279\r\n    struct_declaration\tgo to state 17\r\n    struct_member_declaration\tgo to state 378\r\n    interface_declaration\tgo to state 18\r\n    enum_declaration\tgo to state 19\r\n    delegate_declaration\tgo to state 20\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 282\r\n\r\n    struct_member_declarations  ->  struct_member_declaration .   (rule 451)\r\n\r\n    $default\treduce using rule 451 (struct_member_declarations)\r\n\r\n\r\n\r\nstate 283\r\n\r\n    struct_declaration  ->  attributes_opt modifiers_opt STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt .   (rule 444)\r\n\r\n    $default\treduce using rule 444 (struct_declaration)\r\n\r\n\r\n\r\nstate 284\r\n\r\n    attribute_section  ->  ENTER_attrib LEFT_BRACKET attribute_target_specifier_opt attribute_list COMMA RIGHT_BRACKET EXIT_attrib .   (rule 511)\r\n\r\n    $default\treduce using rule 511 (attribute_section)\r\n\r\n\r\n\r\nstate 285\r\n\r\n    base_access  ->  BASE LEFT_BRACKET . expression_list RIGHT_BRACKET   (rule 80)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    expression_list\tgo to state 379\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 229\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 286\r\n\r\n    base_access  ->  BASE '.' . IDENTIFIER   (rule 79)\r\n\r\n    IDENTIFIER\tshift, and go to state 380\r\n\r\n\r\n\r\nstate 287\r\n\r\n    checked_expression  ->  CHECKED '(' . expression ')'   (rule 91)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 381\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 288\r\n\r\n    pointer_type  ->  VOID . '*'   (rule 37)\r\n\r\n    '*' \tshift, and go to state 122\r\n\r\n\r\n\r\nstate 289\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    object_creation_expression  ->  NEW type . '(' argument_list_opt ')'   (rule 84)\r\n\r\n    '*' \tshift, and go to state 123\r\n    '(' \tshift, and go to state 382\r\n\r\n\r\n\r\nstate 290\r\n\r\n    type  ->  non_array_type .   (rule 11)\r\n    array_creation_expression  ->  NEW non_array_type . LEFT_BRACKET expression_list RIGHT_BRACKET rank_specifiers_opt array_initializer_opt   (rule 85)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 383\r\n\r\n    $default\treduce using rule 11 (type)\r\n\r\n\r\n\r\nstate 291\r\n\r\n    type  ->  array_type .   (rule 12)\r\n    array_type  ->  array_type . rank_specifier   (rule 38)\r\n    array_creation_expression  ->  NEW array_type . array_initializer   (rule 86)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    '{' \tshift, and go to state 384\r\n\r\n    $default\treduce using rule 12 (type)\r\n\r\n    rank_specifier\tgo to state 126\r\n    array_initializer\tgo to state 385\r\n\r\n\r\n\r\nstate 292\r\n\r\n    sizeof_expression  ->  SIZEOF '(' . type ')'   (rule 95)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 386\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 293\r\n\r\n    typeof_expression  ->  TYPEOF '(' . type ')'   (rule 89)\r\n    typeof_expression  ->  TYPEOF '(' . VOID ')'   (rule 90)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 387\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 388\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 294\r\n\r\n    unchecked_expression  ->  UNCHECKED '(' . expression ')'   (rule 92)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 389\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 295\r\n\r\n    pre_increment_expression  ->  PLUSPLUS unary_expression .   (rule 105)\r\n\r\n    $default\treduce using rule 105 (pre_increment_expression)\r\n\r\n\r\n\r\nstate 296\r\n\r\n    pre_decrement_expression  ->  MINUSMINUS unary_expression .   (rule 106)\r\n\r\n    $default\treduce using rule 106 (pre_decrement_expression)\r\n\r\n\r\n\r\nstate 297\r\n\r\n    unary_expression  ->  '*' unary_expression .   (rule 110)\r\n\r\n    $default\treduce using rule 110 (unary_expression)\r\n\r\n\r\n\r\nstate 298\r\n\r\n    cast_expression  ->  '(' VOID . type_quals_opt ')' unary_expression   (rule 119)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    '*' \tshift, and go to state 390\r\n\r\n    $default\treduce using rule 120 (type_quals_opt)\r\n\r\n    rank_specifier\tgo to state 391\r\n    type_quals_opt\tgo to state 392\r\n    type_quals\tgo to state 393\r\n    type_qual\tgo to state 394\r\n\r\n\r\n\r\nstate 299\r\n\r\n    member_access  ->  primitive_type . '.' IDENTIFIER   (rule 66)\r\n    cast_expression  ->  '(' primitive_type . type_quals_opt ')' unary_expression   (rule 117)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    '*' \tshift, and go to state 390\r\n    '.' \tshift, and go to state 309\r\n\r\n    $default\treduce using rule 120 (type_quals_opt)\r\n\r\n    rank_specifier\tgo to state 391\r\n    type_quals_opt\tgo to state 395\r\n    type_quals\tgo to state 393\r\n    type_qual\tgo to state 394\r\n\r\n\r\n\r\nstate 300\r\n\r\n    member_access  ->  class_type . '.' IDENTIFIER   (rule 67)\r\n    cast_expression  ->  '(' class_type . type_quals_opt ')' unary_expression   (rule 118)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    '*' \tshift, and go to state 390\r\n    '.' \tshift, and go to state 310\r\n\r\n    $default\treduce using rule 120 (type_quals_opt)\r\n\r\n    rank_specifier\tgo to state 391\r\n    type_quals_opt\tgo to state 396\r\n    type_quals\tgo to state 393\r\n    type_qual\tgo to state 394\r\n\r\n\r\n\r\nstate 301\r\n\r\n    cast_expression  ->  '(' multiplicative_expression . '*' ')' unary_expression   (rule 115)\r\n    multiplicative_expression  ->  multiplicative_expression . '*' unary_expression   (rule 127)\r\n    multiplicative_expression  ->  multiplicative_expression . '/' unary_expression   (rule 128)\r\n    multiplicative_expression  ->  multiplicative_expression . '%' unary_expression   (rule 129)\r\n    additive_expression  ->  multiplicative_expression .   (rule 130)\r\n\r\n    '*' \tshift, and go to state 397\r\n    '/' \tshift, and go to state 332\r\n    '%' \tshift, and go to state 333\r\n\r\n    $default\treduce using rule 130 (additive_expression)\r\n\r\n\r\n\r\nstate 302\r\n\r\n    parenthesized_expression  ->  '(' expression . ')'   (rule 64)\r\n    cast_expression  ->  '(' expression . ')' unary_expression_not_plusminus   (rule 114)\r\n\r\n    ')' \tshift, and go to state 398\r\n\r\n\r\n\r\nstate 303\r\n\r\n    invocation_expression  ->  qualified_identifier . '(' argument_list_opt ')'   (rule 69)\r\n    element_access  ->  qualified_identifier . LEFT_BRACKET expression_list RIGHT_BRACKET   (rule 73)\r\n    postfix_expression  ->  qualified_identifier .   (rule 97)\r\n    cast_expression  ->  '(' qualified_identifier . rank_specifier type_quals_opt ')' unary_expression   (rule 116)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    LEFT_BRACKET\tshift, and go to state 352\r\n    '(' \tshift, and go to state 353\r\n\r\n    $default\treduce using rule 97 (postfix_expression)\r\n\r\n    rank_specifier\tgo to state 399\r\n\r\n\r\n\r\nstate 304\r\n\r\n    addressof_expression  ->  '&' unary_expression .   (rule 94)\r\n\r\n    $default\treduce using rule 94 (addressof_expression)\r\n\r\n\r\n\r\nstate 305\r\n\r\n    unary_expression_not_plusminus  ->  '!' unary_expression .   (rule 102)\r\n\r\n    $default\treduce using rule 102 (unary_expression_not_plusminus)\r\n\r\n\r\n\r\nstate 306\r\n\r\n    unary_expression_not_plusminus  ->  '~' unary_expression .   (rule 103)\r\n\r\n    $default\treduce using rule 103 (unary_expression_not_plusminus)\r\n\r\n\r\n\r\nstate 307\r\n\r\n    unary_expression  ->  '+' unary_expression .   (rule 108)\r\n\r\n    $default\treduce using rule 108 (unary_expression)\r\n\r\n\r\n\r\nstate 308\r\n\r\n    unary_expression  ->  '-' unary_expression .   (rule 109)\r\n\r\n    $default\treduce using rule 109 (unary_expression)\r\n\r\n\r\n\r\nstate 309\r\n\r\n    member_access  ->  primitive_type '.' . IDENTIFIER   (rule 66)\r\n\r\n    IDENTIFIER\tshift, and go to state 400\r\n\r\n\r\n\r\nstate 310\r\n\r\n    member_access  ->  class_type '.' . IDENTIFIER   (rule 67)\r\n\r\n    IDENTIFIER\tshift, and go to state 401\r\n\r\n\r\n\r\nstate 311\r\n\r\n    element_access  ->  primary_expression LEFT_BRACKET . expression_list RIGHT_BRACKET   (rule 72)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    expression_list\tgo to state 402\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 229\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 312\r\n\r\n    member_access  ->  primary_expression '.' . IDENTIFIER   (rule 65)\r\n\r\n    IDENTIFIER\tshift, and go to state 403\r\n\r\n\r\n\r\nstate 313\r\n\r\n    invocation_expression  ->  primary_expression_no_parenthesis '(' . argument_list_opt ')'   (rule 68)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    OUT \tshift, and go to state 404\r\n    REF \tshift, and go to state 405\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 70 (argument_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    argument_list\tgo to state 406\r\n    argument\tgo to state 407\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    argument_list_opt\tgo to state 408\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 409\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 314\r\n\r\n    attribute_arguments  ->  '(' expression_list_opt ')' .   (rule 530)\r\n\r\n    $default\treduce using rule 530 (attribute_arguments)\r\n\r\n\r\n\r\nstate 315\r\n\r\n    expression_list  ->  expression_list COMMA . expression   (rule 77)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 410\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 316\r\n\r\n    post_increment_expression  ->  postfix_expression PLUSPLUS .   (rule 81)\r\n\r\n    $default\treduce using rule 81 (post_increment_expression)\r\n\r\n\r\n\r\nstate 317\r\n\r\n    post_decrement_expression  ->  postfix_expression MINUSMINUS .   (rule 82)\r\n\r\n    $default\treduce using rule 82 (post_decrement_expression)\r\n\r\n\r\n\r\nstate 318\r\n\r\n    pointer_member_access  ->  postfix_expression ARROW . IDENTIFIER   (rule 93)\r\n\r\n    IDENTIFIER\tshift, and go to state 411\r\n\r\n\r\n\r\nstate 319\r\n\r\n    assignment_operator  ->  PLUSEQ .   (rule 160)\r\n\r\n    $default\treduce using rule 160 (assignment_operator)\r\n\r\n\r\n\r\nstate 320\r\n\r\n    assignment_operator  ->  MINUSEQ .   (rule 161)\r\n\r\n    $default\treduce using rule 161 (assignment_operator)\r\n\r\n\r\n\r\nstate 321\r\n\r\n    assignment_operator  ->  STAREQ .   (rule 162)\r\n\r\n    $default\treduce using rule 162 (assignment_operator)\r\n\r\n\r\n\r\nstate 322\r\n\r\n    assignment_operator  ->  DIVEQ .   (rule 163)\r\n\r\n    $default\treduce using rule 163 (assignment_operator)\r\n\r\n\r\n\r\nstate 323\r\n\r\n    assignment_operator  ->  MODEQ .   (rule 164)\r\n\r\n    $default\treduce using rule 164 (assignment_operator)\r\n\r\n\r\n\r\nstate 324\r\n\r\n    assignment_operator  ->  XOREQ .   (rule 165)\r\n\r\n    $default\treduce using rule 165 (assignment_operator)\r\n\r\n\r\n\r\nstate 325\r\n\r\n    assignment_operator  ->  ANDEQ .   (rule 166)\r\n\r\n    $default\treduce using rule 166 (assignment_operator)\r\n\r\n\r\n\r\nstate 326\r\n\r\n    assignment_operator  ->  OREQ .   (rule 167)\r\n\r\n    $default\treduce using rule 167 (assignment_operator)\r\n\r\n\r\n\r\nstate 327\r\n\r\n    assignment_operator  ->  GTGTEQ .   (rule 168)\r\n\r\n    $default\treduce using rule 168 (assignment_operator)\r\n\r\n\r\n\r\nstate 328\r\n\r\n    assignment_operator  ->  LTLTEQ .   (rule 169)\r\n\r\n    $default\treduce using rule 169 (assignment_operator)\r\n\r\n\r\n\r\nstate 329\r\n\r\n    assignment_operator  ->  '=' .   (rule 159)\r\n\r\n    $default\treduce using rule 159 (assignment_operator)\r\n\r\n\r\n\r\nstate 330\r\n\r\n    assignment  ->  unary_expression assignment_operator . expression   (rule 158)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 412\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 331\r\n\r\n    multiplicative_expression  ->  multiplicative_expression '*' . unary_expression   (rule 127)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 413\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 332\r\n\r\n    multiplicative_expression  ->  multiplicative_expression '/' . unary_expression   (rule 128)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 414\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 333\r\n\r\n    multiplicative_expression  ->  multiplicative_expression '%' . unary_expression   (rule 129)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 415\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 334\r\n\r\n    additive_expression  ->  additive_expression '+' . multiplicative_expression   (rule 131)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 417\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 335\r\n\r\n    additive_expression  ->  additive_expression '-' . multiplicative_expression   (rule 132)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 418\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 336\r\n\r\n    shift_expression  ->  shift_expression LTLT . additive_expression   (rule 134)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 419\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 337\r\n\r\n    shift_expression  ->  shift_expression GTGT . additive_expression   (rule 135)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 420\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 338\r\n\r\n    relational_expression  ->  relational_expression AS . type   (rule 142)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 421\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 339\r\n\r\n    relational_expression  ->  relational_expression IS . type   (rule 141)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 422\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 340\r\n\r\n    relational_expression  ->  relational_expression LEQ . shift_expression   (rule 139)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 423\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 341\r\n\r\n    relational_expression  ->  relational_expression GEQ . shift_expression   (rule 140)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 424\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 342\r\n\r\n    relational_expression  ->  relational_expression '<' . shift_expression   (rule 137)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 425\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 343\r\n\r\n    relational_expression  ->  relational_expression '>' . shift_expression   (rule 138)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 426\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 344\r\n\r\n    equality_expression  ->  equality_expression EQEQ . relational_expression   (rule 144)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 427\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 345\r\n\r\n    equality_expression  ->  equality_expression NOTEQ . relational_expression   (rule 145)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 428\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 346\r\n\r\n    and_expression  ->  and_expression '&' . equality_expression   (rule 147)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 429\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 347\r\n\r\n    exclusive_or_expression  ->  exclusive_or_expression '^' . and_expression   (rule 149)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 430\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 348\r\n\r\n    inclusive_or_expression  ->  inclusive_or_expression '|' . exclusive_or_expression   (rule 151)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 431\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 349\r\n\r\n    conditional_and_expression  ->  conditional_and_expression ANDAND . inclusive_or_expression   (rule 153)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 432\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 350\r\n\r\n    conditional_or_expression  ->  conditional_or_expression OROR . conditional_and_expression   (rule 155)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 416\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 433\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 351\r\n\r\n    conditional_expression  ->  conditional_or_expression '?' . expression ':' expression   (rule 157)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 434\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 352\r\n\r\n    element_access  ->  qualified_identifier LEFT_BRACKET . expression_list RIGHT_BRACKET   (rule 73)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    expression_list\tgo to state 435\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 229\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 353\r\n\r\n    invocation_expression  ->  qualified_identifier '(' . argument_list_opt ')'   (rule 69)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    OUT \tshift, and go to state 404\r\n    REF \tshift, and go to state 405\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 70 (argument_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    argument_list\tgo to state 406\r\n    argument\tgo to state 407\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    argument_list_opt\tgo to state 436\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 409\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 354\r\n\r\n    class_base  ->  ':' class_type COMMA interface_type_list .   (rule 345)\r\n    interface_type_list  ->  interface_type_list . COMMA type_name   (rule 347)\r\n\r\n    COMMA\tshift, and go to state 233\r\n\r\n    $default\treduce using rule 345 (class_base)\r\n\r\n\r\n\r\nstate 355\r\n\r\n    interface_type_list  ->  interface_type_list COMMA type_name .   (rule 347)\r\n\r\n    $default\treduce using rule 347 (interface_type_list)\r\n\r\n\r\n\r\nstate 356\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt . CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    constant_declaration  ->  attributes_opt modifiers_opt . CONST type constant_declarators ';'   (rule 363)\r\n    field_declaration  ->  attributes_opt modifiers_opt . type variable_declarators ';'   (rule 364)\r\n    method_header  ->  attributes_opt modifiers_opt . type qualified_identifier '(' formal_parameter_list_opt ')'   (rule 366)\r\n    method_header  ->  attributes_opt modifiers_opt . VOID qualified_identifier '(' formal_parameter_list_opt ')'   (rule 367)\r\n    property_declaration  ->  attributes_opt modifiers_opt . type qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n    event_declaration  ->  attributes_opt modifiers_opt . EVENT type variable_declarators ';'   (rule 394)\r\n    event_declaration  ->  attributes_opt modifiers_opt . EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n    indexer_declaration  ->  attributes_opt modifiers_opt . indexer_declarator ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 400)\r\n    operator_declaration  ->  attributes_opt modifiers_opt . operator_declarator operator_body   (rule 404)\r\n    constructor_declaration  ->  attributes_opt modifiers_opt . constructor_declarator constructor_body   (rule 433)\r\n    destructor_declaration  ->  attributes_opt modifiers_opt . '~' IDENTIFIER '(' ')' block   (rule 439)\r\n    struct_declaration  ->  attributes_opt modifiers_opt . STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt modifiers_opt . INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt modifiers_opt . ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt modifiers_opt . DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    IDENTIFIER\tshift, and go to state 437\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CLASS\tshift, and go to state 56\r\n    CONST\tshift, and go to state 438\r\n    DECIMAL\tshift, and go to state 81\r\n    DELEGATE\tshift, and go to state 57\r\n    DOUBLE\tshift, and go to state 82\r\n    ENUM\tshift, and go to state 58\r\n    EVENT\tshift, and go to state 439\r\n    EXPLICIT\tshift, and go to state 440\r\n    FLOAT\tshift, and go to state 83\r\n    IMPLICIT\tshift, and go to state 441\r\n    INT \tshift, and go to state 84\r\n    INTERFACE\tshift, and go to state 59\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    STRUCT\tshift, and go to state 60\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 442\r\n    '~' \tshift, and go to state 443\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 444\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n    indexer_declarator\tgo to state 445\r\n    operator_declarator\tgo to state 446\r\n    overloadable_operator_declarator\tgo to state 447\r\n    conversion_operator_declarator\tgo to state 448\r\n    constructor_declarator\tgo to state 449\r\n\r\n\r\n\r\nstate 357\r\n\r\n    class_body  ->  '{' class_member_declarations_opt '}' .   (rule 348)\r\n\r\n    $default\treduce using rule 348 (class_body)\r\n\r\n\r\n\r\nstate 358\r\n\r\n    class_member_declarations  ->  class_member_declarations class_member_declaration .   (rule 352)\r\n\r\n    $default\treduce using rule 352 (class_member_declarations)\r\n\r\n\r\n\r\nstate 359\r\n\r\n    block  ->  '{' . statement_list_opt '}'   (rule 190)\r\n\r\n    IDENTIFIER\tshift, and go to state 450\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONST\tshift, and go to state 453\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    VOID\tshift, and go to state 288\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    $default\treduce using rule 191 (statement_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement\tgo to state 482\r\n    embedded_statement\tgo to state 483\r\n    block\tgo to state 484\r\n    statement_list_opt\tgo to state 485\r\n    statement_list\tgo to state 486\r\n    empty_statement\tgo to state 487\r\n    labeled_statement\tgo to state 488\r\n    declaration_statement\tgo to state 489\r\n    local_variable_declaration\tgo to state 490\r\n    local_constant_declaration\tgo to state 491\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 360\r\n\r\n    method_body  ->  ';' .   (rule 373)\r\n\r\n    $default\treduce using rule 373 (method_body)\r\n\r\n\r\n\r\nstate 361\r\n\r\n    method_body  ->  block .   (rule 372)\r\n\r\n    $default\treduce using rule 372 (method_body)\r\n\r\n\r\n\r\nstate 362\r\n\r\n    method_declaration  ->  method_header method_body .   (rule 365)\r\n\r\n    $default\treduce using rule 365 (method_declaration)\r\n\r\n\r\n\r\nstate 363\r\n\r\n    parameter_modifier_opt  ->  OUT .   (rule 381)\r\n\r\n    $default\treduce using rule 381 (parameter_modifier_opt)\r\n\r\n\r\n\r\nstate 364\r\n\r\n    parameter_array  ->  attributes_opt PARAMS . type IDENTIFIER   (rule 382)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 516\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 365\r\n\r\n    parameter_modifier_opt  ->  REF .   (rule 380)\r\n\r\n    $default\treduce using rule 380 (parameter_modifier_opt)\r\n\r\n\r\n\r\nstate 366\r\n\r\n    fixed_parameter  ->  attributes_opt parameter_modifier_opt . type IDENTIFIER   (rule 378)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 517\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 367\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' . ';'   (rule 506)\r\n\r\n    ';' \tshift, and go to state 518\r\n\r\n\r\n\r\nstate 368\r\n\r\n    formal_parameter_list  ->  formal_parameter_list COMMA . formal_parameter   (rule 375)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter\tgo to state 519\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 369\r\n\r\n    enum_member_declaration  ->  attributes_opt IDENTIFIER .   (rule 504)\r\n    enum_member_declaration  ->  attributes_opt IDENTIFIER . '=' constant_expression   (rule 505)\r\n\r\n    '=' \tshift, and go to state 520\r\n\r\n    $default\treduce using rule 504 (enum_member_declaration)\r\n\r\n\r\n\r\nstate 370\r\n\r\n    enum_body  ->  '{' enum_member_declarations_opt '}' .   (rule 498)\r\n\r\n    $default\treduce using rule 498 (enum_body)\r\n\r\n\r\n\r\nstate 371\r\n\r\n    enum_body  ->  '{' enum_member_declarations COMMA . '}'   (rule 499)\r\n    enum_member_declarations  ->  enum_member_declarations COMMA . enum_member_declaration   (rule 503)\r\n\r\n    '}' \tshift, and go to state 521\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 256\r\n    enum_member_declaration\tgo to state 522\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 372\r\n\r\n    new_opt  ->  NEW .   (rule 484)\r\n\r\n    $default\treduce using rule 484 (new_opt)\r\n\r\n\r\n\r\nstate 373\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt . type IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body   (rule 481)\r\n    interface_method_declaration  ->  attributes_opt new_opt . VOID IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body   (rule 482)\r\n    interface_property_declaration  ->  attributes_opt new_opt . type IDENTIFIER ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 485)\r\n    interface_indexer_declaration  ->  attributes_opt new_opt . type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n    interface_event_declaration  ->  attributes_opt new_opt . EVENT type IDENTIFIER interface_empty_body   (rule 491)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    EVENT\tshift, and go to state 523\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 524\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 525\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 374\r\n\r\n    interface_body  ->  '{' interface_member_declarations_opt '}' .   (rule 472)\r\n\r\n    $default\treduce using rule 472 (interface_body)\r\n\r\n\r\n\r\nstate 375\r\n\r\n    interface_member_declarations  ->  interface_member_declarations interface_member_declaration .   (rule 476)\r\n\r\n    $default\treduce using rule 476 (interface_member_declarations)\r\n\r\n\r\n\r\nstate 376\r\n\r\n    class_declaration  ->  attributes_opt modifiers_opt . CLASS IDENTIFIER class_base_opt class_body comma_opt   (rule 340)\r\n    constant_declaration  ->  attributes_opt modifiers_opt . CONST type constant_declarators ';'   (rule 363)\r\n    field_declaration  ->  attributes_opt modifiers_opt . type variable_declarators ';'   (rule 364)\r\n    method_header  ->  attributes_opt modifiers_opt . type qualified_identifier '(' formal_parameter_list_opt ')'   (rule 366)\r\n    method_header  ->  attributes_opt modifiers_opt . VOID qualified_identifier '(' formal_parameter_list_opt ')'   (rule 367)\r\n    property_declaration  ->  attributes_opt modifiers_opt . type qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n    event_declaration  ->  attributes_opt modifiers_opt . EVENT type variable_declarators ';'   (rule 394)\r\n    event_declaration  ->  attributes_opt modifiers_opt . EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n    indexer_declaration  ->  attributes_opt modifiers_opt . indexer_declarator ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 400)\r\n    operator_declaration  ->  attributes_opt modifiers_opt . operator_declarator operator_body   (rule 404)\r\n    constructor_declaration  ->  attributes_opt modifiers_opt . constructor_declarator constructor_body   (rule 433)\r\n    struct_declaration  ->  attributes_opt modifiers_opt . STRUCT IDENTIFIER struct_interfaces_opt struct_body comma_opt   (rule 444)\r\n    interface_declaration  ->  attributes_opt modifiers_opt . INTERFACE IDENTIFIER interface_base_opt interface_body comma_opt   (rule 468)\r\n    enum_declaration  ->  attributes_opt modifiers_opt . ENUM IDENTIFIER enum_base_opt enum_body comma_opt   (rule 494)\r\n    delegate_declaration  ->  attributes_opt modifiers_opt . DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';'   (rule 506)\r\n\r\n    IDENTIFIER\tshift, and go to state 437\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CLASS\tshift, and go to state 56\r\n    CONST\tshift, and go to state 438\r\n    DECIMAL\tshift, and go to state 81\r\n    DELEGATE\tshift, and go to state 57\r\n    DOUBLE\tshift, and go to state 82\r\n    ENUM\tshift, and go to state 58\r\n    EVENT\tshift, and go to state 439\r\n    EXPLICIT\tshift, and go to state 440\r\n    FLOAT\tshift, and go to state 83\r\n    IMPLICIT\tshift, and go to state 441\r\n    INT \tshift, and go to state 84\r\n    INTERFACE\tshift, and go to state 59\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    STRUCT\tshift, and go to state 60\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 442\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 444\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n    indexer_declarator\tgo to state 445\r\n    operator_declarator\tgo to state 446\r\n    overloadable_operator_declarator\tgo to state 447\r\n    conversion_operator_declarator\tgo to state 448\r\n    constructor_declarator\tgo to state 449\r\n\r\n\r\n\r\nstate 377\r\n\r\n    struct_body  ->  '{' struct_member_declarations_opt '}' .   (rule 448)\r\n\r\n    $default\treduce using rule 448 (struct_body)\r\n\r\n\r\n\r\nstate 378\r\n\r\n    struct_member_declarations  ->  struct_member_declarations struct_member_declaration .   (rule 452)\r\n\r\n    $default\treduce using rule 452 (struct_member_declarations)\r\n\r\n\r\n\r\nstate 379\r\n\r\n    expression_list  ->  expression_list . COMMA expression   (rule 77)\r\n    base_access  ->  BASE LEFT_BRACKET expression_list . RIGHT_BRACKET   (rule 80)\r\n\r\n    COMMA\tshift, and go to state 315\r\n    RIGHT_BRACKET\tshift, and go to state 526\r\n\r\n\r\n\r\nstate 380\r\n\r\n    base_access  ->  BASE '.' IDENTIFIER .   (rule 79)\r\n\r\n    $default\treduce using rule 79 (base_access)\r\n\r\n\r\n\r\nstate 381\r\n\r\n    checked_expression  ->  CHECKED '(' expression . ')'   (rule 91)\r\n\r\n    ')' \tshift, and go to state 527\r\n\r\n\r\n\r\nstate 382\r\n\r\n    object_creation_expression  ->  NEW type '(' . argument_list_opt ')'   (rule 84)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    OUT \tshift, and go to state 404\r\n    REF \tshift, and go to state 405\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 70 (argument_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    argument_list\tgo to state 406\r\n    argument\tgo to state 407\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    argument_list_opt\tgo to state 528\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 409\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 383\r\n\r\n    array_creation_expression  ->  NEW non_array_type LEFT_BRACKET . expression_list RIGHT_BRACKET rank_specifiers_opt array_initializer_opt   (rule 85)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    expression_list\tgo to state 529\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 229\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 384\r\n\r\n    array_initializer  ->  '{' . variable_initializer_list_opt '}'   (rule 462)\r\n    array_initializer  ->  '{' . variable_initializer_list COMMA '}'   (rule 463)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STACKALLOC\tshift, and go to state 530\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 384\r\n\r\n    $default\treduce using rule 464 (variable_initializer_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 531\r\n    variable_initializer\tgo to state 532\r\n    stackalloc_initializer\tgo to state 533\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n    array_initializer\tgo to state 534\r\n    variable_initializer_list_opt\tgo to state 535\r\n    variable_initializer_list\tgo to state 536\r\n\r\n\r\n\r\nstate 385\r\n\r\n    array_creation_expression  ->  NEW array_type array_initializer .   (rule 86)\r\n\r\n    $default\treduce using rule 86 (array_creation_expression)\r\n\r\n\r\n\r\nstate 386\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    sizeof_expression  ->  SIZEOF '(' type . ')'   (rule 95)\r\n\r\n    '*' \tshift, and go to state 123\r\n    ')' \tshift, and go to state 537\r\n\r\n\r\n\r\nstate 387\r\n\r\n    pointer_type  ->  VOID . '*'   (rule 37)\r\n    typeof_expression  ->  TYPEOF '(' VOID . ')'   (rule 90)\r\n\r\n    '*' \tshift, and go to state 122\r\n    ')' \tshift, and go to state 538\r\n\r\n\r\n\r\nstate 388\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    typeof_expression  ->  TYPEOF '(' type . ')'   (rule 89)\r\n\r\n    '*' \tshift, and go to state 123\r\n    ')' \tshift, and go to state 539\r\n\r\n\r\n\r\nstate 389\r\n\r\n    unchecked_expression  ->  UNCHECKED '(' expression . ')'   (rule 92)\r\n\r\n    ')' \tshift, and go to state 540\r\n\r\n\r\n\r\nstate 390\r\n\r\n    type_qual  ->  '*' .   (rule 125)\r\n\r\n    $default\treduce using rule 125 (type_qual)\r\n\r\n\r\n\r\nstate 391\r\n\r\n    type_qual  ->  rank_specifier .   (rule 124)\r\n\r\n    $default\treduce using rule 124 (type_qual)\r\n\r\n\r\n\r\nstate 392\r\n\r\n    cast_expression  ->  '(' VOID type_quals_opt . ')' unary_expression   (rule 119)\r\n\r\n    ')' \tshift, and go to state 541\r\n\r\n\r\n\r\nstate 393\r\n\r\n    type_quals_opt  ->  type_quals .   (rule 121)\r\n    type_quals  ->  type_quals . type_qual   (rule 123)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    '*' \tshift, and go to state 390\r\n\r\n    $default\treduce using rule 121 (type_quals_opt)\r\n\r\n    rank_specifier\tgo to state 391\r\n    type_qual\tgo to state 542\r\n\r\n\r\n\r\nstate 394\r\n\r\n    type_quals  ->  type_qual .   (rule 122)\r\n\r\n    $default\treduce using rule 122 (type_quals)\r\n\r\n\r\n\r\nstate 395\r\n\r\n    cast_expression  ->  '(' primitive_type type_quals_opt . ')' unary_expression   (rule 117)\r\n\r\n    ')' \tshift, and go to state 543\r\n\r\n\r\n\r\nstate 396\r\n\r\n    cast_expression  ->  '(' class_type type_quals_opt . ')' unary_expression   (rule 118)\r\n\r\n    ')' \tshift, and go to state 544\r\n\r\n\r\n\r\nstate 397\r\n\r\n    cast_expression  ->  '(' multiplicative_expression '*' . ')' unary_expression   (rule 115)\r\n    multiplicative_expression  ->  multiplicative_expression '*' . unary_expression   (rule 127)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    ')' \tshift, and go to state 545\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 413\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 398\r\n\r\n    parenthesized_expression  ->  '(' expression ')' .   (rule 64)\r\n    cast_expression  ->  '(' expression ')' . unary_expression_not_plusminus   (rule 114)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    '(' \tshift, and go to state 180\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n\r\n    $default\treduce using rule 64 (parenthesized_expression)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 546\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 399\r\n\r\n    cast_expression  ->  '(' qualified_identifier rank_specifier . type_quals_opt ')' unary_expression   (rule 116)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    '*' \tshift, and go to state 390\r\n\r\n    $default\treduce using rule 120 (type_quals_opt)\r\n\r\n    rank_specifier\tgo to state 391\r\n    type_quals_opt\tgo to state 547\r\n    type_quals\tgo to state 393\r\n    type_qual\tgo to state 394\r\n\r\n\r\n\r\nstate 400\r\n\r\n    member_access  ->  primitive_type '.' IDENTIFIER .   (rule 66)\r\n\r\n    $default\treduce using rule 66 (member_access)\r\n\r\n\r\n\r\nstate 401\r\n\r\n    member_access  ->  class_type '.' IDENTIFIER .   (rule 67)\r\n\r\n    $default\treduce using rule 67 (member_access)\r\n\r\n\r\n\r\nstate 402\r\n\r\n    element_access  ->  primary_expression LEFT_BRACKET expression_list . RIGHT_BRACKET   (rule 72)\r\n    expression_list  ->  expression_list . COMMA expression   (rule 77)\r\n\r\n    COMMA\tshift, and go to state 315\r\n    RIGHT_BRACKET\tshift, and go to state 548\r\n\r\n\r\n\r\nstate 403\r\n\r\n    member_access  ->  primary_expression '.' IDENTIFIER .   (rule 65)\r\n\r\n    $default\treduce using rule 65 (member_access)\r\n\r\n\r\n\r\nstate 404\r\n\r\n    argument  ->  OUT . variable_reference   (rule 49)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    variable_reference\tgo to state 549\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 550\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 405\r\n\r\n    argument  ->  REF . variable_reference   (rule 48)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    variable_reference\tgo to state 551\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 550\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 406\r\n\r\n    argument_list  ->  argument_list . COMMA argument   (rule 46)\r\n    argument_list_opt  ->  argument_list .   (rule 71)\r\n\r\n    COMMA\tshift, and go to state 552\r\n\r\n    $default\treduce using rule 71 (argument_list_opt)\r\n\r\n\r\n\r\nstate 407\r\n\r\n    argument_list  ->  argument .   (rule 45)\r\n\r\n    $default\treduce using rule 45 (argument_list)\r\n\r\n\r\n\r\nstate 408\r\n\r\n    invocation_expression  ->  primary_expression_no_parenthesis '(' argument_list_opt . ')'   (rule 68)\r\n\r\n    ')' \tshift, and go to state 553\r\n\r\n\r\n\r\nstate 409\r\n\r\n    argument  ->  expression .   (rule 47)\r\n\r\n    $default\treduce using rule 47 (argument)\r\n\r\n\r\n\r\nstate 410\r\n\r\n    expression_list  ->  expression_list COMMA expression .   (rule 77)\r\n\r\n    $default\treduce using rule 77 (expression_list)\r\n\r\n\r\n\r\nstate 411\r\n\r\n    pointer_member_access  ->  postfix_expression ARROW IDENTIFIER .   (rule 93)\r\n\r\n    $default\treduce using rule 93 (pointer_member_access)\r\n\r\n\r\n\r\nstate 412\r\n\r\n    assignment  ->  unary_expression assignment_operator expression .   (rule 158)\r\n\r\n    $default\treduce using rule 158 (assignment)\r\n\r\n\r\n\r\nstate 413\r\n\r\n    multiplicative_expression  ->  multiplicative_expression '*' unary_expression .   (rule 127)\r\n\r\n    $default\treduce using rule 127 (multiplicative_expression)\r\n\r\n\r\n\r\nstate 414\r\n\r\n    multiplicative_expression  ->  multiplicative_expression '/' unary_expression .   (rule 128)\r\n\r\n    $default\treduce using rule 128 (multiplicative_expression)\r\n\r\n\r\n\r\nstate 415\r\n\r\n    multiplicative_expression  ->  multiplicative_expression '%' unary_expression .   (rule 129)\r\n\r\n    $default\treduce using rule 129 (multiplicative_expression)\r\n\r\n\r\n\r\nstate 416\r\n\r\n    multiplicative_expression  ->  unary_expression .   (rule 126)\r\n\r\n    $default\treduce using rule 126 (multiplicative_expression)\r\n\r\n\r\n\r\nstate 417\r\n\r\n    multiplicative_expression  ->  multiplicative_expression . '*' unary_expression   (rule 127)\r\n    multiplicative_expression  ->  multiplicative_expression . '/' unary_expression   (rule 128)\r\n    multiplicative_expression  ->  multiplicative_expression . '%' unary_expression   (rule 129)\r\n    additive_expression  ->  additive_expression '+' multiplicative_expression .   (rule 131)\r\n\r\n    '*' \tshift, and go to state 331\r\n    '/' \tshift, and go to state 332\r\n    '%' \tshift, and go to state 333\r\n\r\n    $default\treduce using rule 131 (additive_expression)\r\n\r\n\r\n\r\nstate 418\r\n\r\n    multiplicative_expression  ->  multiplicative_expression . '*' unary_expression   (rule 127)\r\n    multiplicative_expression  ->  multiplicative_expression . '/' unary_expression   (rule 128)\r\n    multiplicative_expression  ->  multiplicative_expression . '%' unary_expression   (rule 129)\r\n    additive_expression  ->  additive_expression '-' multiplicative_expression .   (rule 132)\r\n\r\n    '*' \tshift, and go to state 331\r\n    '/' \tshift, and go to state 332\r\n    '%' \tshift, and go to state 333\r\n\r\n    $default\treduce using rule 132 (additive_expression)\r\n\r\n\r\n\r\nstate 419\r\n\r\n    additive_expression  ->  additive_expression . '+' multiplicative_expression   (rule 131)\r\n    additive_expression  ->  additive_expression . '-' multiplicative_expression   (rule 132)\r\n    shift_expression  ->  shift_expression LTLT additive_expression .   (rule 134)\r\n\r\n    '+' \tshift, and go to state 334\r\n    '-' \tshift, and go to state 335\r\n\r\n    $default\treduce using rule 134 (shift_expression)\r\n\r\n\r\n\r\nstate 420\r\n\r\n    additive_expression  ->  additive_expression . '+' multiplicative_expression   (rule 131)\r\n    additive_expression  ->  additive_expression . '-' multiplicative_expression   (rule 132)\r\n    shift_expression  ->  shift_expression GTGT additive_expression .   (rule 135)\r\n\r\n    '+' \tshift, and go to state 334\r\n    '-' \tshift, and go to state 335\r\n\r\n    $default\treduce using rule 135 (shift_expression)\r\n\r\n\r\n\r\nstate 421\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    relational_expression  ->  relational_expression AS type .   (rule 142)\r\n\r\n    '*' \tshift, and go to state 123\r\n\r\n    $default\treduce using rule 142 (relational_expression)\r\n\r\n\r\n\r\nstate 422\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    relational_expression  ->  relational_expression IS type .   (rule 141)\r\n\r\n    '*' \tshift, and go to state 123\r\n\r\n    $default\treduce using rule 141 (relational_expression)\r\n\r\n\r\n\r\nstate 423\r\n\r\n    shift_expression  ->  shift_expression . LTLT additive_expression   (rule 134)\r\n    shift_expression  ->  shift_expression . GTGT additive_expression   (rule 135)\r\n    relational_expression  ->  relational_expression LEQ shift_expression .   (rule 139)\r\n\r\n    LTLT\tshift, and go to state 336\r\n    GTGT\tshift, and go to state 337\r\n\r\n    $default\treduce using rule 139 (relational_expression)\r\n\r\n\r\n\r\nstate 424\r\n\r\n    shift_expression  ->  shift_expression . LTLT additive_expression   (rule 134)\r\n    shift_expression  ->  shift_expression . GTGT additive_expression   (rule 135)\r\n    relational_expression  ->  relational_expression GEQ shift_expression .   (rule 140)\r\n\r\n    LTLT\tshift, and go to state 336\r\n    GTGT\tshift, and go to state 337\r\n\r\n    $default\treduce using rule 140 (relational_expression)\r\n\r\n\r\n\r\nstate 425\r\n\r\n    shift_expression  ->  shift_expression . LTLT additive_expression   (rule 134)\r\n    shift_expression  ->  shift_expression . GTGT additive_expression   (rule 135)\r\n    relational_expression  ->  relational_expression '<' shift_expression .   (rule 137)\r\n\r\n    LTLT\tshift, and go to state 336\r\n    GTGT\tshift, and go to state 337\r\n\r\n    $default\treduce using rule 137 (relational_expression)\r\n\r\n\r\n\r\nstate 426\r\n\r\n    shift_expression  ->  shift_expression . LTLT additive_expression   (rule 134)\r\n    shift_expression  ->  shift_expression . GTGT additive_expression   (rule 135)\r\n    relational_expression  ->  relational_expression '>' shift_expression .   (rule 138)\r\n\r\n    LTLT\tshift, and go to state 336\r\n    GTGT\tshift, and go to state 337\r\n\r\n    $default\treduce using rule 138 (relational_expression)\r\n\r\n\r\n\r\nstate 427\r\n\r\n    relational_expression  ->  relational_expression . '<' shift_expression   (rule 137)\r\n    relational_expression  ->  relational_expression . '>' shift_expression   (rule 138)\r\n    relational_expression  ->  relational_expression . LEQ shift_expression   (rule 139)\r\n    relational_expression  ->  relational_expression . GEQ shift_expression   (rule 140)\r\n    relational_expression  ->  relational_expression . IS type   (rule 141)\r\n    relational_expression  ->  relational_expression . AS type   (rule 142)\r\n    equality_expression  ->  equality_expression EQEQ relational_expression .   (rule 144)\r\n\r\n    AS  \tshift, and go to state 338\r\n    IS  \tshift, and go to state 339\r\n    LEQ \tshift, and go to state 340\r\n    GEQ \tshift, and go to state 341\r\n    '<' \tshift, and go to state 342\r\n    '>' \tshift, and go to state 343\r\n\r\n    $default\treduce using rule 144 (equality_expression)\r\n\r\n\r\n\r\nstate 428\r\n\r\n    relational_expression  ->  relational_expression . '<' shift_expression   (rule 137)\r\n    relational_expression  ->  relational_expression . '>' shift_expression   (rule 138)\r\n    relational_expression  ->  relational_expression . LEQ shift_expression   (rule 139)\r\n    relational_expression  ->  relational_expression . GEQ shift_expression   (rule 140)\r\n    relational_expression  ->  relational_expression . IS type   (rule 141)\r\n    relational_expression  ->  relational_expression . AS type   (rule 142)\r\n    equality_expression  ->  equality_expression NOTEQ relational_expression .   (rule 145)\r\n\r\n    AS  \tshift, and go to state 338\r\n    IS  \tshift, and go to state 339\r\n    LEQ \tshift, and go to state 340\r\n    GEQ \tshift, and go to state 341\r\n    '<' \tshift, and go to state 342\r\n    '>' \tshift, and go to state 343\r\n\r\n    $default\treduce using rule 145 (equality_expression)\r\n\r\n\r\n\r\nstate 429\r\n\r\n    equality_expression  ->  equality_expression . EQEQ relational_expression   (rule 144)\r\n    equality_expression  ->  equality_expression . NOTEQ relational_expression   (rule 145)\r\n    and_expression  ->  and_expression '&' equality_expression .   (rule 147)\r\n\r\n    EQEQ\tshift, and go to state 344\r\n    NOTEQ\tshift, and go to state 345\r\n\r\n    $default\treduce using rule 147 (and_expression)\r\n\r\n\r\n\r\nstate 430\r\n\r\n    and_expression  ->  and_expression . '&' equality_expression   (rule 147)\r\n    exclusive_or_expression  ->  exclusive_or_expression '^' and_expression .   (rule 149)\r\n\r\n    '&' \tshift, and go to state 346\r\n\r\n    $default\treduce using rule 149 (exclusive_or_expression)\r\n\r\n\r\n\r\nstate 431\r\n\r\n    exclusive_or_expression  ->  exclusive_or_expression . '^' and_expression   (rule 149)\r\n    inclusive_or_expression  ->  inclusive_or_expression '|' exclusive_or_expression .   (rule 151)\r\n\r\n    '^' \tshift, and go to state 347\r\n\r\n    $default\treduce using rule 151 (inclusive_or_expression)\r\n\r\n\r\n\r\nstate 432\r\n\r\n    inclusive_or_expression  ->  inclusive_or_expression . '|' exclusive_or_expression   (rule 151)\r\n    conditional_and_expression  ->  conditional_and_expression ANDAND inclusive_or_expression .   (rule 153)\r\n\r\n    '|' \tshift, and go to state 348\r\n\r\n    $default\treduce using rule 153 (conditional_and_expression)\r\n\r\n\r\n\r\nstate 433\r\n\r\n    conditional_and_expression  ->  conditional_and_expression . ANDAND inclusive_or_expression   (rule 153)\r\n    conditional_or_expression  ->  conditional_or_expression OROR conditional_and_expression .   (rule 155)\r\n\r\n    ANDAND\tshift, and go to state 349\r\n\r\n    $default\treduce using rule 155 (conditional_or_expression)\r\n\r\n\r\n\r\nstate 434\r\n\r\n    conditional_expression  ->  conditional_or_expression '?' expression . ':' expression   (rule 157)\r\n\r\n    ':' \tshift, and go to state 554\r\n\r\n\r\n\r\nstate 435\r\n\r\n    element_access  ->  qualified_identifier LEFT_BRACKET expression_list . RIGHT_BRACKET   (rule 73)\r\n    expression_list  ->  expression_list . COMMA expression   (rule 77)\r\n\r\n    COMMA\tshift, and go to state 315\r\n    RIGHT_BRACKET\tshift, and go to state 555\r\n\r\n\r\n\r\nstate 436\r\n\r\n    invocation_expression  ->  qualified_identifier '(' argument_list_opt . ')'   (rule 69)\r\n\r\n    ')' \tshift, and go to state 556\r\n\r\n\r\n\r\nstate 437\r\n\r\n    qualified_identifier  ->  IDENTIFIER .   (rule 302)\r\n    qualifier  ->  IDENTIFIER . '.'   (rule 304)\r\n    constructor_declarator  ->  IDENTIFIER . '(' formal_parameter_list_opt ')' constructor_initializer_opt   (rule 434)\r\n\r\n    '(' \tshift, and go to state 557\r\n    '.' \tshift, and go to state 26\r\n\r\n    $default\treduce using rule 302 (qualified_identifier)\r\n\r\n\r\n\r\nstate 438\r\n\r\n    constant_declaration  ->  attributes_opt modifiers_opt CONST . type constant_declarators ';'   (rule 363)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 558\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 439\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT . type variable_declarators ';'   (rule 394)\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT . type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 559\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 440\r\n\r\n    conversion_operator_declarator  ->  EXPLICIT . OPERATOR type '(' type IDENTIFIER ')'   (rule 432)\r\n\r\n    OPERATOR\tshift, and go to state 560\r\n\r\n\r\n\r\nstate 441\r\n\r\n    conversion_operator_declarator  ->  IMPLICIT . OPERATOR type '(' type IDENTIFIER ')'   (rule 431)\r\n\r\n    OPERATOR\tshift, and go to state 561\r\n\r\n\r\n\r\nstate 442\r\n\r\n    pointer_type  ->  VOID . '*'   (rule 37)\r\n    method_header  ->  attributes_opt modifiers_opt VOID . qualified_identifier '(' formal_parameter_list_opt ')'   (rule 367)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    '*' \tshift, and go to state 122\r\n\r\n    qualified_identifier\tgo to state 562\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 443\r\n\r\n    destructor_declaration  ->  attributes_opt modifiers_opt '~' . IDENTIFIER '(' ')' block   (rule 439)\r\n\r\n    IDENTIFIER\tshift, and go to state 563\r\n\r\n\r\n\r\nstate 444\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    field_declaration  ->  attributes_opt modifiers_opt type . variable_declarators ';'   (rule 364)\r\n    method_header  ->  attributes_opt modifiers_opt type . qualified_identifier '(' formal_parameter_list_opt ')'   (rule 366)\r\n    property_declaration  ->  attributes_opt modifiers_opt type . qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n    indexer_declarator  ->  type . THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET   (rule 401)\r\n    indexer_declarator  ->  type . qualified_this LEFT_BRACKET formal_parameter_list RIGHT_BRACKET   (rule 402)\r\n    overloadable_operator_declarator  ->  type . OPERATOR overloadable_operator '(' type IDENTIFIER ')'   (rule 407)\r\n    overloadable_operator_declarator  ->  type . OPERATOR overloadable_operator '(' type IDENTIFIER COMMA type IDENTIFIER ')'   (rule 408)\r\n\r\n    IDENTIFIER\tshift, and go to state 564\r\n    OPERATOR\tshift, and go to state 565\r\n    THIS\tshift, and go to state 566\r\n    '*' \tshift, and go to state 123\r\n\r\n    variable_declarators\tgo to state 567\r\n    variable_declarator\tgo to state 568\r\n    qualified_identifier\tgo to state 569\r\n    qualifier\tgo to state 570\r\n    qualified_this\tgo to state 571\r\n\r\n\r\n\r\nstate 445\r\n\r\n    indexer_declaration  ->  attributes_opt modifiers_opt indexer_declarator . ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 400)\r\n\r\n    $default\treduce using rule 535 (ENTER_getset)\r\n\r\n    ENTER_getset\tgo to state 572\r\n\r\n\r\n\r\nstate 446\r\n\r\n    operator_declaration  ->  attributes_opt modifiers_opt operator_declarator . operator_body   (rule 404)\r\n\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 573\r\n\r\n    block\tgo to state 574\r\n    operator_body\tgo to state 575\r\n\r\n\r\n\r\nstate 447\r\n\r\n    operator_declarator  ->  overloadable_operator_declarator .   (rule 405)\r\n\r\n    $default\treduce using rule 405 (operator_declarator)\r\n\r\n\r\n\r\nstate 448\r\n\r\n    operator_declarator  ->  conversion_operator_declarator .   (rule 406)\r\n\r\n    $default\treduce using rule 406 (operator_declarator)\r\n\r\n\r\n\r\nstate 449\r\n\r\n    constructor_declaration  ->  attributes_opt modifiers_opt constructor_declarator . constructor_body   (rule 433)\r\n\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 576\r\n\r\n    block\tgo to state 577\r\n    constructor_body\tgo to state 578\r\n\r\n\r\n\r\nstate 450\r\n\r\n    labeled_statement  ->  IDENTIFIER . ':' statement   (rule 196)\r\n    qualified_identifier  ->  IDENTIFIER .   (rule 302)\r\n    qualifier  ->  IDENTIFIER . '.'   (rule 304)\r\n\r\n    '.' \tshift, and go to state 26\r\n    ':' \tshift, and go to state 579\r\n\r\n    $default\treduce using rule 302 (qualified_identifier)\r\n\r\n\r\n\r\nstate 451\r\n\r\n    break_statement  ->  BREAK . ';'   (rule 261)\r\n\r\n    ';' \tshift, and go to state 580\r\n\r\n\r\n\r\nstate 452\r\n\r\n    checked_expression  ->  CHECKED . '(' expression ')'   (rule 91)\r\n    checked_statement  ->  CHECKED . block   (rule 281)\r\n\r\n    '(' \tshift, and go to state 287\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 581\r\n\r\n\r\n\r\nstate 453\r\n\r\n    local_constant_declaration  ->  CONST . type constant_declarators   (rule 208)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 582\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 454\r\n\r\n    continue_statement  ->  CONTINUE . ';'   (rule 262)\r\n\r\n    ';' \tshift, and go to state 583\r\n\r\n\r\n\r\nstate 455\r\n\r\n    do_statement  ->  DO . embedded_statement WHILE '(' boolean_expression ')' ';'   (rule 241)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 584\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 456\r\n\r\n    fixed_statement  ->  FIXED . '(' type fixed_pointer_declarators ')' embedded_statement   (rule 287)\r\n\r\n    '(' \tshift, and go to state 585\r\n\r\n\r\n\r\nstate 457\r\n\r\n    for_statement  ->  FOR . '(' for_initializer_opt ';' for_condition_opt ';' for_iterator_opt ')' embedded_statement   (rule 242)\r\n\r\n    '(' \tshift, and go to state 586\r\n\r\n\r\n\r\nstate 458\r\n\r\n    foreach_statement  ->  FOREACH . '(' type IDENTIFIER IN expression ')' embedded_statement   (rule 255)\r\n\r\n    '(' \tshift, and go to state 587\r\n\r\n\r\n\r\nstate 459\r\n\r\n    goto_statement  ->  GOTO . IDENTIFIER ';'   (rule 263)\r\n    goto_statement  ->  GOTO . CASE constant_expression ';'   (rule 264)\r\n    goto_statement  ->  GOTO . DEFAULT ';'   (rule 265)\r\n\r\n    IDENTIFIER\tshift, and go to state 588\r\n    CASE\tshift, and go to state 589\r\n    DEFAULT\tshift, and go to state 590\r\n\r\n\r\n\r\nstate 460\r\n\r\n    if_statement  ->  IF . '(' boolean_expression ')' embedded_statement   (rule 222)\r\n    if_statement  ->  IF . '(' boolean_expression ')' embedded_statement ELSE embedded_statement   (rule 223)\r\n\r\n    '(' \tshift, and go to state 591\r\n\r\n\r\n\r\nstate 461\r\n\r\n    lock_statement  ->  LOCK . '(' expression ')' embedded_statement   (rule 283)\r\n\r\n    '(' \tshift, and go to state 592\r\n\r\n\r\n\r\nstate 462\r\n\r\n    return_statement  ->  RETURN . expression_opt ';'   (rule 266)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 267 (expression_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 593\r\n    expression_opt\tgo to state 594\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 463\r\n\r\n    switch_statement  ->  SWITCH . '(' expression ')' switch_block   (rule 224)\r\n\r\n    '(' \tshift, and go to state 595\r\n\r\n\r\n\r\nstate 464\r\n\r\n    throw_statement  ->  THROW . expression_opt ';'   (rule 269)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 267 (expression_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 593\r\n    expression_opt\tgo to state 596\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 465\r\n\r\n    try_statement  ->  TRY . block catch_clauses   (rule 270)\r\n    try_statement  ->  TRY . block finally_clause   (rule 271)\r\n    try_statement  ->  TRY . block catch_clauses finally_clause   (rule 272)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 597\r\n\r\n\r\n\r\nstate 466\r\n\r\n    unchecked_expression  ->  UNCHECKED . '(' expression ')'   (rule 92)\r\n    unchecked_statement  ->  UNCHECKED . block   (rule 282)\r\n\r\n    '(' \tshift, and go to state 294\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 598\r\n\r\n\r\n\r\nstate 467\r\n\r\n    unsafe_statement  ->  UNSAFE . block   (rule 239)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 599\r\n\r\n\r\n\r\nstate 468\r\n\r\n    using_statement  ->  USING . '(' resource_acquisition ')' embedded_statement   (rule 284)\r\n\r\n    '(' \tshift, and go to state 600\r\n\r\n\r\n\r\nstate 469\r\n\r\n    while_statement  ->  WHILE . '(' boolean_expression ')' embedded_statement   (rule 240)\r\n\r\n    '(' \tshift, and go to state 601\r\n\r\n\r\n\r\nstate 470\r\n\r\n    empty_statement  ->  ';' .   (rule 195)\r\n\r\n    $default\treduce using rule 195 (empty_statement)\r\n\r\n\r\n\r\nstate 471\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    local_variable_declaration  ->  type . variable_declarators   (rule 199)\r\n\r\n    IDENTIFIER\tshift, and go to state 602\r\n    '*' \tshift, and go to state 123\r\n\r\n    variable_declarators\tgo to state 603\r\n    variable_declarator\tgo to state 568\r\n\r\n\r\n\r\nstate 472\r\n\r\n    simple_type  ->  primitive_type .   (rule 15)\r\n    member_access  ->  primitive_type . '.' IDENTIFIER   (rule 66)\r\n\r\n    '.' \tshift, and go to state 309\r\n\r\n    $default\treduce using rule 15 (simple_type)\r\n\r\n\r\n\r\nstate 473\r\n\r\n    simple_type  ->  class_type .   (rule 16)\r\n    member_access  ->  class_type . '.' IDENTIFIER   (rule 67)\r\n\r\n    '.' \tshift, and go to state 310\r\n\r\n    $default\treduce using rule 16 (simple_type)\r\n\r\n\r\n\r\nstate 474\r\n\r\n    primary_expression_no_parenthesis  ->  invocation_expression .   (rule 55)\r\n    statement_expression  ->  invocation_expression .   (rule 213)\r\n\r\n    COMMA\treduce using rule 213 (statement_expression)\r\n    ')' \treduce using rule 213 (statement_expression)\r\n    ';' \treduce using rule 213 (statement_expression)\r\n    $default\treduce using rule 55 (primary_expression_no_parenthesis)\r\n\r\n\r\n\r\nstate 475\r\n\r\n    postfix_expression  ->  post_increment_expression .   (rule 98)\r\n    statement_expression  ->  post_increment_expression .   (rule 216)\r\n\r\n    COMMA\treduce using rule 216 (statement_expression)\r\n    ')' \treduce using rule 216 (statement_expression)\r\n    ';' \treduce using rule 216 (statement_expression)\r\n    $default\treduce using rule 98 (postfix_expression)\r\n\r\n\r\n\r\nstate 476\r\n\r\n    postfix_expression  ->  post_decrement_expression .   (rule 99)\r\n    statement_expression  ->  post_decrement_expression .   (rule 217)\r\n\r\n    COMMA\treduce using rule 217 (statement_expression)\r\n    ')' \treduce using rule 217 (statement_expression)\r\n    ';' \treduce using rule 217 (statement_expression)\r\n    $default\treduce using rule 99 (postfix_expression)\r\n\r\n\r\n\r\nstate 477\r\n\r\n    new_expression  ->  object_creation_expression .   (rule 83)\r\n    statement_expression  ->  object_creation_expression .   (rule 214)\r\n\r\n    COMMA\treduce using rule 214 (statement_expression)\r\n    ')' \treduce using rule 214 (statement_expression)\r\n    ';' \treduce using rule 214 (statement_expression)\r\n    $default\treduce using rule 83 (new_expression)\r\n\r\n\r\n\r\nstate 478\r\n\r\n    unary_expression  ->  pre_increment_expression .   (rule 111)\r\n    statement_expression  ->  pre_increment_expression .   (rule 218)\r\n\r\n    COMMA\treduce using rule 218 (statement_expression)\r\n    ')' \treduce using rule 218 (statement_expression)\r\n    ';' \treduce using rule 218 (statement_expression)\r\n    $default\treduce using rule 111 (unary_expression)\r\n\r\n\r\n\r\nstate 479\r\n\r\n    unary_expression  ->  pre_decrement_expression .   (rule 112)\r\n    statement_expression  ->  pre_decrement_expression .   (rule 219)\r\n\r\n    COMMA\treduce using rule 219 (statement_expression)\r\n    ')' \treduce using rule 219 (statement_expression)\r\n    ';' \treduce using rule 219 (statement_expression)\r\n    $default\treduce using rule 112 (unary_expression)\r\n\r\n\r\n\r\nstate 480\r\n\r\n    assignment  ->  unary_expression . assignment_operator expression   (rule 158)\r\n\r\n    PLUSEQ\tshift, and go to state 319\r\n    MINUSEQ\tshift, and go to state 320\r\n    STAREQ\tshift, and go to state 321\r\n    DIVEQ\tshift, and go to state 322\r\n    MODEQ\tshift, and go to state 323\r\n    XOREQ\tshift, and go to state 324\r\n    ANDEQ\tshift, and go to state 325\r\n    OREQ\tshift, and go to state 326\r\n    GTGTEQ\tshift, and go to state 327\r\n    LTLTEQ\tshift, and go to state 328\r\n    '=' \tshift, and go to state 329\r\n\r\n    assignment_operator\tgo to state 330\r\n\r\n\r\n\r\nstate 481\r\n\r\n    statement_expression  ->  assignment .   (rule 215)\r\n\r\n    $default\treduce using rule 215 (statement_expression)\r\n\r\n\r\n\r\nstate 482\r\n\r\n    statement_list  ->  statement .   (rule 193)\r\n\r\n    $default\treduce using rule 193 (statement_list)\r\n\r\n\r\n\r\nstate 483\r\n\r\n    statement  ->  embedded_statement .   (rule 176)\r\n\r\n    $default\treduce using rule 176 (statement)\r\n\r\n\r\n\r\nstate 484\r\n\r\n    embedded_statement  ->  block .   (rule 177)\r\n\r\n    $default\treduce using rule 177 (embedded_statement)\r\n\r\n\r\n\r\nstate 485\r\n\r\n    block  ->  '{' statement_list_opt . '}'   (rule 190)\r\n\r\n    '}' \tshift, and go to state 604\r\n\r\n\r\n\r\nstate 486\r\n\r\n    statement_list_opt  ->  statement_list .   (rule 192)\r\n    statement_list  ->  statement_list . statement   (rule 194)\r\n\r\n    IDENTIFIER\tshift, and go to state 450\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONST\tshift, and go to state 453\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    VOID\tshift, and go to state 288\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    $default\treduce using rule 192 (statement_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement\tgo to state 605\r\n    embedded_statement\tgo to state 483\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    labeled_statement\tgo to state 488\r\n    declaration_statement\tgo to state 489\r\n    local_variable_declaration\tgo to state 490\r\n    local_constant_declaration\tgo to state 491\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 487\r\n\r\n    embedded_statement  ->  empty_statement .   (rule 178)\r\n\r\n    $default\treduce using rule 178 (embedded_statement)\r\n\r\n\r\n\r\nstate 488\r\n\r\n    statement  ->  labeled_statement .   (rule 174)\r\n\r\n    $default\treduce using rule 174 (statement)\r\n\r\n\r\n\r\nstate 489\r\n\r\n    statement  ->  declaration_statement .   (rule 175)\r\n\r\n    $default\treduce using rule 175 (statement)\r\n\r\n\r\n\r\nstate 490\r\n\r\n    declaration_statement  ->  local_variable_declaration . ';'   (rule 197)\r\n\r\n    ';' \tshift, and go to state 606\r\n\r\n\r\n\r\nstate 491\r\n\r\n    declaration_statement  ->  local_constant_declaration . ';'   (rule 198)\r\n\r\n    ';' \tshift, and go to state 607\r\n\r\n\r\n\r\nstate 492\r\n\r\n    embedded_statement  ->  expression_statement .   (rule 179)\r\n\r\n    $default\treduce using rule 179 (embedded_statement)\r\n\r\n\r\n\r\nstate 493\r\n\r\n    expression_statement  ->  statement_expression . ';'   (rule 212)\r\n\r\n    ';' \tshift, and go to state 608\r\n\r\n\r\n\r\nstate 494\r\n\r\n    embedded_statement  ->  selection_statement .   (rule 180)\r\n\r\n    $default\treduce using rule 180 (embedded_statement)\r\n\r\n\r\n\r\nstate 495\r\n\r\n    selection_statement  ->  if_statement .   (rule 220)\r\n\r\n    $default\treduce using rule 220 (selection_statement)\r\n\r\n\r\n\r\nstate 496\r\n\r\n    selection_statement  ->  switch_statement .   (rule 221)\r\n\r\n    $default\treduce using rule 221 (selection_statement)\r\n\r\n\r\n\r\nstate 497\r\n\r\n    embedded_statement  ->  iteration_statement .   (rule 181)\r\n\r\n    $default\treduce using rule 181 (embedded_statement)\r\n\r\n\r\n\r\nstate 498\r\n\r\n    embedded_statement  ->  unsafe_statement .   (rule 188)\r\n\r\n    $default\treduce using rule 188 (embedded_statement)\r\n\r\n\r\n\r\nstate 499\r\n\r\n    iteration_statement  ->  while_statement .   (rule 235)\r\n\r\n    $default\treduce using rule 235 (iteration_statement)\r\n\r\n\r\n\r\nstate 500\r\n\r\n    iteration_statement  ->  do_statement .   (rule 236)\r\n\r\n    $default\treduce using rule 236 (iteration_statement)\r\n\r\n\r\n\r\nstate 501\r\n\r\n    iteration_statement  ->  for_statement .   (rule 237)\r\n\r\n    $default\treduce using rule 237 (iteration_statement)\r\n\r\n\r\n\r\nstate 502\r\n\r\n    iteration_statement  ->  foreach_statement .   (rule 238)\r\n\r\n    $default\treduce using rule 238 (iteration_statement)\r\n\r\n\r\n\r\nstate 503\r\n\r\n    embedded_statement  ->  jump_statement .   (rule 182)\r\n\r\n    $default\treduce using rule 182 (embedded_statement)\r\n\r\n\r\n\r\nstate 504\r\n\r\n    jump_statement  ->  break_statement .   (rule 256)\r\n\r\n    $default\treduce using rule 256 (jump_statement)\r\n\r\n\r\n\r\nstate 505\r\n\r\n    jump_statement  ->  continue_statement .   (rule 257)\r\n\r\n    $default\treduce using rule 257 (jump_statement)\r\n\r\n\r\n\r\nstate 506\r\n\r\n    jump_statement  ->  goto_statement .   (rule 258)\r\n\r\n    $default\treduce using rule 258 (jump_statement)\r\n\r\n\r\n\r\nstate 507\r\n\r\n    jump_statement  ->  return_statement .   (rule 259)\r\n\r\n    $default\treduce using rule 259 (jump_statement)\r\n\r\n\r\n\r\nstate 508\r\n\r\n    jump_statement  ->  throw_statement .   (rule 260)\r\n\r\n    $default\treduce using rule 260 (jump_statement)\r\n\r\n\r\n\r\nstate 509\r\n\r\n    embedded_statement  ->  try_statement .   (rule 183)\r\n\r\n    $default\treduce using rule 183 (embedded_statement)\r\n\r\n\r\n\r\nstate 510\r\n\r\n    embedded_statement  ->  checked_statement .   (rule 184)\r\n\r\n    $default\treduce using rule 184 (embedded_statement)\r\n\r\n\r\n\r\nstate 511\r\n\r\n    embedded_statement  ->  unchecked_statement .   (rule 185)\r\n\r\n    $default\treduce using rule 185 (embedded_statement)\r\n\r\n\r\n\r\nstate 512\r\n\r\n    embedded_statement  ->  lock_statement .   (rule 186)\r\n\r\n    $default\treduce using rule 186 (embedded_statement)\r\n\r\n\r\n\r\nstate 513\r\n\r\n    embedded_statement  ->  using_statement .   (rule 187)\r\n\r\n    $default\treduce using rule 187 (embedded_statement)\r\n\r\n\r\n\r\nstate 514\r\n\r\n    embedded_statement  ->  fixed_statement .   (rule 189)\r\n\r\n    $default\treduce using rule 189 (embedded_statement)\r\n\r\n\r\n\r\nstate 515\r\n\r\n    type_name  ->  qualified_identifier .   (rule 10)\r\n    array_type  ->  qualified_identifier . rank_specifier   (rule 40)\r\n    invocation_expression  ->  qualified_identifier . '(' argument_list_opt ')'   (rule 69)\r\n    element_access  ->  qualified_identifier . LEFT_BRACKET expression_list RIGHT_BRACKET   (rule 73)\r\n    postfix_expression  ->  qualified_identifier .   (rule 97)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n    LEFT_BRACKET\tshift, and go to state 352\r\n    '(' \tshift, and go to state 353\r\n\r\n    IDENTIFIER\treduce using rule 10 (type_name)\r\n    '*' \treduce using rule 10 (type_name)\r\n    '*' \t[reduce using rule 97 (postfix_expression)]\r\n    $default\treduce using rule 97 (postfix_expression)\r\n\r\n    rank_specifier\tgo to state 127\r\n\r\n\r\n\r\nstate 516\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    parameter_array  ->  attributes_opt PARAMS type . IDENTIFIER   (rule 382)\r\n\r\n    IDENTIFIER\tshift, and go to state 609\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 517\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    fixed_parameter  ->  attributes_opt parameter_modifier_opt type . IDENTIFIER   (rule 378)\r\n\r\n    IDENTIFIER\tshift, and go to state 610\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 518\r\n\r\n    delegate_declaration  ->  attributes_opt modifiers_opt DELEGATE return_type IDENTIFIER '(' formal_parameter_list_opt ')' ';' .   (rule 506)\r\n\r\n    $default\treduce using rule 506 (delegate_declaration)\r\n\r\n\r\n\r\nstate 519\r\n\r\n    formal_parameter_list  ->  formal_parameter_list COMMA formal_parameter .   (rule 375)\r\n\r\n    $default\treduce using rule 375 (formal_parameter_list)\r\n\r\n\r\n\r\nstate 520\r\n\r\n    enum_member_declaration  ->  attributes_opt IDENTIFIER '=' . constant_expression   (rule 505)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 611\r\n    constant_expression\tgo to state 612\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 521\r\n\r\n    enum_body  ->  '{' enum_member_declarations COMMA '}' .   (rule 499)\r\n\r\n    $default\treduce using rule 499 (enum_body)\r\n\r\n\r\n\r\nstate 522\r\n\r\n    enum_member_declarations  ->  enum_member_declarations COMMA enum_member_declaration .   (rule 503)\r\n\r\n    $default\treduce using rule 503 (enum_member_declarations)\r\n\r\n\r\n\r\nstate 523\r\n\r\n    interface_event_declaration  ->  attributes_opt new_opt EVENT . type IDENTIFIER interface_empty_body   (rule 491)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 613\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 524\r\n\r\n    pointer_type  ->  VOID . '*'   (rule 37)\r\n    interface_method_declaration  ->  attributes_opt new_opt VOID . IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body   (rule 482)\r\n\r\n    IDENTIFIER\tshift, and go to state 614\r\n    '*' \tshift, and go to state 122\r\n\r\n\r\n\r\nstate 525\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    interface_method_declaration  ->  attributes_opt new_opt type . IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body   (rule 481)\r\n    interface_property_declaration  ->  attributes_opt new_opt type . IDENTIFIER ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 485)\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type . THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    IDENTIFIER\tshift, and go to state 615\r\n    THIS\tshift, and go to state 616\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 526\r\n\r\n    base_access  ->  BASE LEFT_BRACKET expression_list RIGHT_BRACKET .   (rule 80)\r\n\r\n    $default\treduce using rule 80 (base_access)\r\n\r\n\r\n\r\nstate 527\r\n\r\n    checked_expression  ->  CHECKED '(' expression ')' .   (rule 91)\r\n\r\n    $default\treduce using rule 91 (checked_expression)\r\n\r\n\r\n\r\nstate 528\r\n\r\n    object_creation_expression  ->  NEW type '(' argument_list_opt . ')'   (rule 84)\r\n\r\n    ')' \tshift, and go to state 617\r\n\r\n\r\n\r\nstate 529\r\n\r\n    expression_list  ->  expression_list . COMMA expression   (rule 77)\r\n    array_creation_expression  ->  NEW non_array_type LEFT_BRACKET expression_list . RIGHT_BRACKET rank_specifiers_opt array_initializer_opt   (rule 85)\r\n\r\n    COMMA\tshift, and go to state 315\r\n    RIGHT_BRACKET\tshift, and go to state 618\r\n\r\n\r\n\r\nstate 530\r\n\r\n    stackalloc_initializer  ->  STACKALLOC . type LEFT_BRACKET expression RIGHT_BRACKET   (rule 207)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 619\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 531\r\n\r\n    variable_initializer  ->  expression .   (rule 204)\r\n\r\n    $default\treduce using rule 204 (variable_initializer)\r\n\r\n\r\n\r\nstate 532\r\n\r\n    variable_initializer_list  ->  variable_initializer .   (rule 466)\r\n\r\n    $default\treduce using rule 466 (variable_initializer_list)\r\n\r\n\r\n\r\nstate 533\r\n\r\n    variable_initializer  ->  stackalloc_initializer .   (rule 206)\r\n\r\n    $default\treduce using rule 206 (variable_initializer)\r\n\r\n\r\n\r\nstate 534\r\n\r\n    variable_initializer  ->  array_initializer .   (rule 205)\r\n\r\n    $default\treduce using rule 205 (variable_initializer)\r\n\r\n\r\n\r\nstate 535\r\n\r\n    array_initializer  ->  '{' variable_initializer_list_opt . '}'   (rule 462)\r\n\r\n    '}' \tshift, and go to state 620\r\n\r\n\r\n\r\nstate 536\r\n\r\n    array_initializer  ->  '{' variable_initializer_list . COMMA '}'   (rule 463)\r\n    variable_initializer_list_opt  ->  variable_initializer_list .   (rule 465)\r\n    variable_initializer_list  ->  variable_initializer_list . COMMA variable_initializer   (rule 467)\r\n\r\n    COMMA\tshift, and go to state 621\r\n\r\n    $default\treduce using rule 465 (variable_initializer_list_opt)\r\n\r\n\r\n\r\nstate 537\r\n\r\n    sizeof_expression  ->  SIZEOF '(' type ')' .   (rule 95)\r\n\r\n    $default\treduce using rule 95 (sizeof_expression)\r\n\r\n\r\n\r\nstate 538\r\n\r\n    typeof_expression  ->  TYPEOF '(' VOID ')' .   (rule 90)\r\n\r\n    $default\treduce using rule 90 (typeof_expression)\r\n\r\n\r\n\r\nstate 539\r\n\r\n    typeof_expression  ->  TYPEOF '(' type ')' .   (rule 89)\r\n\r\n    $default\treduce using rule 89 (typeof_expression)\r\n\r\n\r\n\r\nstate 540\r\n\r\n    unchecked_expression  ->  UNCHECKED '(' expression ')' .   (rule 92)\r\n\r\n    $default\treduce using rule 92 (unchecked_expression)\r\n\r\n\r\n\r\nstate 541\r\n\r\n    cast_expression  ->  '(' VOID type_quals_opt ')' . unary_expression   (rule 119)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 622\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 542\r\n\r\n    type_quals  ->  type_quals type_qual .   (rule 123)\r\n\r\n    $default\treduce using rule 123 (type_quals)\r\n\r\n\r\n\r\nstate 543\r\n\r\n    cast_expression  ->  '(' primitive_type type_quals_opt ')' . unary_expression   (rule 117)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 623\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 544\r\n\r\n    cast_expression  ->  '(' class_type type_quals_opt ')' . unary_expression   (rule 118)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 624\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 545\r\n\r\n    cast_expression  ->  '(' multiplicative_expression '*' ')' . unary_expression   (rule 115)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 625\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 546\r\n\r\n    cast_expression  ->  '(' expression ')' unary_expression_not_plusminus .   (rule 114)\r\n\r\n    $default\treduce using rule 114 (cast_expression)\r\n\r\n\r\n\r\nstate 547\r\n\r\n    cast_expression  ->  '(' qualified_identifier rank_specifier type_quals_opt . ')' unary_expression   (rule 116)\r\n\r\n    ')' \tshift, and go to state 626\r\n\r\n\r\n\r\nstate 548\r\n\r\n    element_access  ->  primary_expression LEFT_BRACKET expression_list RIGHT_BRACKET .   (rule 72)\r\n\r\n    $default\treduce using rule 72 (element_access)\r\n\r\n\r\n\r\nstate 549\r\n\r\n    argument  ->  OUT variable_reference .   (rule 49)\r\n\r\n    $default\treduce using rule 49 (argument)\r\n\r\n\r\n\r\nstate 550\r\n\r\n    variable_reference  ->  expression .   (rule 44)\r\n\r\n    $default\treduce using rule 44 (variable_reference)\r\n\r\n\r\n\r\nstate 551\r\n\r\n    argument  ->  REF variable_reference .   (rule 48)\r\n\r\n    $default\treduce using rule 48 (argument)\r\n\r\n\r\n\r\nstate 552\r\n\r\n    argument_list  ->  argument_list COMMA . argument   (rule 46)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    OUT \tshift, and go to state 404\r\n    REF \tshift, and go to state 405\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    argument\tgo to state 627\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 409\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 553\r\n\r\n    invocation_expression  ->  primary_expression_no_parenthesis '(' argument_list_opt ')' .   (rule 68)\r\n\r\n    $default\treduce using rule 68 (invocation_expression)\r\n\r\n\r\n\r\nstate 554\r\n\r\n    conditional_expression  ->  conditional_or_expression '?' expression ':' . expression   (rule 157)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 628\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 555\r\n\r\n    element_access  ->  qualified_identifier LEFT_BRACKET expression_list RIGHT_BRACKET .   (rule 73)\r\n\r\n    $default\treduce using rule 73 (element_access)\r\n\r\n\r\n\r\nstate 556\r\n\r\n    invocation_expression  ->  qualified_identifier '(' argument_list_opt ')' .   (rule 69)\r\n\r\n    $default\treduce using rule 69 (invocation_expression)\r\n\r\n\r\n\r\nstate 557\r\n\r\n    constructor_declarator  ->  IDENTIFIER '(' . formal_parameter_list_opt ')' constructor_initializer_opt   (rule 434)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    ')' \treduce using rule 368 (formal_parameter_list_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list_opt\tgo to state 629\r\n    formal_parameter_list\tgo to state 252\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 558\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    constant_declaration  ->  attributes_opt modifiers_opt CONST type . constant_declarators ';'   (rule 363)\r\n\r\n    IDENTIFIER\tshift, and go to state 630\r\n    '*' \tshift, and go to state 123\r\n\r\n    constant_declarators\tgo to state 631\r\n    constant_declarator\tgo to state 632\r\n\r\n\r\n\r\nstate 559\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type . variable_declarators ';'   (rule 394)\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type . qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n\r\n    IDENTIFIER\tshift, and go to state 564\r\n    '*' \tshift, and go to state 123\r\n\r\n    variable_declarators\tgo to state 633\r\n    variable_declarator\tgo to state 568\r\n    qualified_identifier\tgo to state 634\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 560\r\n\r\n    conversion_operator_declarator  ->  EXPLICIT OPERATOR . type '(' type IDENTIFIER ')'   (rule 432)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 635\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 561\r\n\r\n    conversion_operator_declarator  ->  IMPLICIT OPERATOR . type '(' type IDENTIFIER ')'   (rule 431)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 636\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 562\r\n\r\n    method_header  ->  attributes_opt modifiers_opt VOID qualified_identifier . '(' formal_parameter_list_opt ')'   (rule 367)\r\n\r\n    '(' \tshift, and go to state 637\r\n\r\n\r\n\r\nstate 563\r\n\r\n    destructor_declaration  ->  attributes_opt modifiers_opt '~' IDENTIFIER . '(' ')' block   (rule 439)\r\n\r\n    '(' \tshift, and go to state 638\r\n\r\n\r\n\r\nstate 564\r\n\r\n    variable_declarator  ->  IDENTIFIER .   (rule 202)\r\n    variable_declarator  ->  IDENTIFIER . '=' variable_initializer   (rule 203)\r\n    qualified_identifier  ->  IDENTIFIER .   (rule 302)\r\n    qualifier  ->  IDENTIFIER . '.'   (rule 304)\r\n\r\n    '.' \tshift, and go to state 26\r\n    '=' \tshift, and go to state 639\r\n\r\n    '(' \treduce using rule 302 (qualified_identifier)\r\n    '{' \treduce using rule 302 (qualified_identifier)\r\n    $default\treduce using rule 202 (variable_declarator)\r\n\r\n\r\n\r\nstate 565\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR . overloadable_operator '(' type IDENTIFIER ')'   (rule 407)\r\n    overloadable_operator_declarator  ->  type OPERATOR . overloadable_operator '(' type IDENTIFIER COMMA type IDENTIFIER ')'   (rule 408)\r\n\r\n    FALSE\tshift, and go to state 640\r\n    TRUE\tshift, and go to state 641\r\n    LTLT\tshift, and go to state 642\r\n    GTGT\tshift, and go to state 643\r\n    EQEQ\tshift, and go to state 644\r\n    NOTEQ\tshift, and go to state 645\r\n    LEQ \tshift, and go to state 646\r\n    GEQ \tshift, and go to state 647\r\n    PLUSPLUS\tshift, and go to state 648\r\n    MINUSMINUS\tshift, and go to state 649\r\n    '*' \tshift, and go to state 650\r\n    '&' \tshift, and go to state 651\r\n    '!' \tshift, and go to state 652\r\n    '~' \tshift, and go to state 653\r\n    '+' \tshift, and go to state 654\r\n    '-' \tshift, and go to state 655\r\n    '/' \tshift, and go to state 656\r\n    '%' \tshift, and go to state 657\r\n    '<' \tshift, and go to state 658\r\n    '>' \tshift, and go to state 659\r\n    '^' \tshift, and go to state 660\r\n    '|' \tshift, and go to state 661\r\n\r\n    overloadable_operator\tgo to state 662\r\n\r\n\r\n\r\nstate 566\r\n\r\n    indexer_declarator  ->  type THIS . LEFT_BRACKET formal_parameter_list RIGHT_BRACKET   (rule 401)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 663\r\n\r\n\r\n\r\nstate 567\r\n\r\n    variable_declarators  ->  variable_declarators . COMMA variable_declarator   (rule 201)\r\n    field_declaration  ->  attributes_opt modifiers_opt type variable_declarators . ';'   (rule 364)\r\n\r\n    COMMA\tshift, and go to state 664\r\n    ';' \tshift, and go to state 665\r\n\r\n\r\n\r\nstate 568\r\n\r\n    variable_declarators  ->  variable_declarator .   (rule 200)\r\n\r\n    $default\treduce using rule 200 (variable_declarators)\r\n\r\n\r\n\r\nstate 569\r\n\r\n    method_header  ->  attributes_opt modifiers_opt type qualified_identifier . '(' formal_parameter_list_opt ')'   (rule 366)\r\n    property_declaration  ->  attributes_opt modifiers_opt type qualified_identifier . ENTER_getset '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n\r\n    '(' \tshift, and go to state 666\r\n\r\n    $default\treduce using rule 535 (ENTER_getset)\r\n\r\n    ENTER_getset\tgo to state 667\r\n\r\n\r\n\r\nstate 570\r\n\r\n    qualified_identifier  ->  qualifier . IDENTIFIER   (rule 303)\r\n    qualifier  ->  qualifier . IDENTIFIER '.'   (rule 305)\r\n    qualified_this  ->  qualifier . THIS   (rule 403)\r\n\r\n    IDENTIFIER\tshift, and go to state 29\r\n    THIS\tshift, and go to state 668\r\n\r\n\r\n\r\nstate 571\r\n\r\n    indexer_declarator  ->  type qualified_this . LEFT_BRACKET formal_parameter_list RIGHT_BRACKET   (rule 402)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 669\r\n\r\n\r\n\r\nstate 572\r\n\r\n    indexer_declaration  ->  attributes_opt modifiers_opt indexer_declarator ENTER_getset . '{' accessor_declarations '}' EXIT_getset   (rule 400)\r\n\r\n    '{' \tshift, and go to state 670\r\n\r\n\r\n\r\nstate 573\r\n\r\n    operator_body  ->  ';' .   (rule 441)\r\n\r\n    $default\treduce using rule 441 (operator_body)\r\n\r\n\r\n\r\nstate 574\r\n\r\n    operator_body  ->  block .   (rule 440)\r\n\r\n    $default\treduce using rule 440 (operator_body)\r\n\r\n\r\n\r\nstate 575\r\n\r\n    operator_declaration  ->  attributes_opt modifiers_opt operator_declarator operator_body .   (rule 404)\r\n\r\n    $default\treduce using rule 404 (operator_declaration)\r\n\r\n\r\n\r\nstate 576\r\n\r\n    constructor_body  ->  ';' .   (rule 443)\r\n\r\n    $default\treduce using rule 443 (constructor_body)\r\n\r\n\r\n\r\nstate 577\r\n\r\n    constructor_body  ->  block .   (rule 442)\r\n\r\n    $default\treduce using rule 442 (constructor_body)\r\n\r\n\r\n\r\nstate 578\r\n\r\n    constructor_declaration  ->  attributes_opt modifiers_opt constructor_declarator constructor_body .   (rule 433)\r\n\r\n    $default\treduce using rule 433 (constructor_declaration)\r\n\r\n\r\n\r\nstate 579\r\n\r\n    labeled_statement  ->  IDENTIFIER ':' . statement   (rule 196)\r\n\r\n    IDENTIFIER\tshift, and go to state 450\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONST\tshift, and go to state 453\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    VOID\tshift, and go to state 288\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement\tgo to state 671\r\n    embedded_statement\tgo to state 483\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    labeled_statement\tgo to state 488\r\n    declaration_statement\tgo to state 489\r\n    local_variable_declaration\tgo to state 490\r\n    local_constant_declaration\tgo to state 491\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 580\r\n\r\n    break_statement  ->  BREAK ';' .   (rule 261)\r\n\r\n    $default\treduce using rule 261 (break_statement)\r\n\r\n\r\n\r\nstate 581\r\n\r\n    checked_statement  ->  CHECKED block .   (rule 281)\r\n\r\n    $default\treduce using rule 281 (checked_statement)\r\n\r\n\r\n\r\nstate 582\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    local_constant_declaration  ->  CONST type . constant_declarators   (rule 208)\r\n\r\n    IDENTIFIER\tshift, and go to state 630\r\n    '*' \tshift, and go to state 123\r\n\r\n    constant_declarators\tgo to state 672\r\n    constant_declarator\tgo to state 632\r\n\r\n\r\n\r\nstate 583\r\n\r\n    continue_statement  ->  CONTINUE ';' .   (rule 262)\r\n\r\n    $default\treduce using rule 262 (continue_statement)\r\n\r\n\r\n\r\nstate 584\r\n\r\n    do_statement  ->  DO embedded_statement . WHILE '(' boolean_expression ')' ';'   (rule 241)\r\n\r\n    WHILE\tshift, and go to state 673\r\n\r\n\r\n\r\nstate 585\r\n\r\n    fixed_statement  ->  FIXED '(' . type fixed_pointer_declarators ')' embedded_statement   (rule 287)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 674\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 586\r\n\r\n    for_statement  ->  FOR '(' . for_initializer_opt ';' for_condition_opt ';' for_iterator_opt ')' embedded_statement   (rule 242)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 243 (for_initializer_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    local_variable_declaration\tgo to state 675\r\n    statement_expression\tgo to state 676\r\n    for_initializer_opt\tgo to state 677\r\n    for_initializer\tgo to state 678\r\n    statement_expression_list\tgo to state 679\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 587\r\n\r\n    foreach_statement  ->  FOREACH '(' . type IDENTIFIER IN expression ')' embedded_statement   (rule 255)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 680\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 588\r\n\r\n    goto_statement  ->  GOTO IDENTIFIER . ';'   (rule 263)\r\n\r\n    ';' \tshift, and go to state 681\r\n\r\n\r\n\r\nstate 589\r\n\r\n    goto_statement  ->  GOTO CASE . constant_expression ';'   (rule 264)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 611\r\n    constant_expression\tgo to state 682\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 590\r\n\r\n    goto_statement  ->  GOTO DEFAULT . ';'   (rule 265)\r\n\r\n    ';' \tshift, and go to state 683\r\n\r\n\r\n\r\nstate 591\r\n\r\n    if_statement  ->  IF '(' . boolean_expression ')' embedded_statement   (rule 222)\r\n    if_statement  ->  IF '(' . boolean_expression ')' embedded_statement ELSE embedded_statement   (rule 223)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 684\r\n    boolean_expression\tgo to state 685\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 592\r\n\r\n    lock_statement  ->  LOCK '(' . expression ')' embedded_statement   (rule 283)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 686\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 593\r\n\r\n    expression_opt  ->  expression .   (rule 268)\r\n\r\n    $default\treduce using rule 268 (expression_opt)\r\n\r\n\r\n\r\nstate 594\r\n\r\n    return_statement  ->  RETURN expression_opt . ';'   (rule 266)\r\n\r\n    ';' \tshift, and go to state 687\r\n\r\n\r\n\r\nstate 595\r\n\r\n    switch_statement  ->  SWITCH '(' . expression ')' switch_block   (rule 224)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 688\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 596\r\n\r\n    throw_statement  ->  THROW expression_opt . ';'   (rule 269)\r\n\r\n    ';' \tshift, and go to state 689\r\n\r\n\r\n\r\nstate 597\r\n\r\n    try_statement  ->  TRY block . catch_clauses   (rule 270)\r\n    try_statement  ->  TRY block . finally_clause   (rule 271)\r\n    try_statement  ->  TRY block . catch_clauses finally_clause   (rule 272)\r\n\r\n    CATCH\tshift, and go to state 690\r\n    FINALLY\tshift, and go to state 691\r\n\r\n    catch_clauses\tgo to state 692\r\n    catch_clause\tgo to state 693\r\n    finally_clause\tgo to state 694\r\n\r\n\r\n\r\nstate 598\r\n\r\n    unchecked_statement  ->  UNCHECKED block .   (rule 282)\r\n\r\n    $default\treduce using rule 282 (unchecked_statement)\r\n\r\n\r\n\r\nstate 599\r\n\r\n    unsafe_statement  ->  UNSAFE block .   (rule 239)\r\n\r\n    $default\treduce using rule 239 (unsafe_statement)\r\n\r\n\r\n\r\nstate 600\r\n\r\n    using_statement  ->  USING '(' . resource_acquisition ')' embedded_statement   (rule 284)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 695\r\n    local_variable_declaration\tgo to state 696\r\n    resource_acquisition\tgo to state 697\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 601\r\n\r\n    while_statement  ->  WHILE '(' . boolean_expression ')' embedded_statement   (rule 240)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 684\r\n    boolean_expression\tgo to state 698\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 602\r\n\r\n    variable_declarator  ->  IDENTIFIER .   (rule 202)\r\n    variable_declarator  ->  IDENTIFIER . '=' variable_initializer   (rule 203)\r\n\r\n    '=' \tshift, and go to state 639\r\n\r\n    $default\treduce using rule 202 (variable_declarator)\r\n\r\n\r\n\r\nstate 603\r\n\r\n    local_variable_declaration  ->  type variable_declarators .   (rule 199)\r\n    variable_declarators  ->  variable_declarators . COMMA variable_declarator   (rule 201)\r\n\r\n    COMMA\tshift, and go to state 664\r\n\r\n    $default\treduce using rule 199 (local_variable_declaration)\r\n\r\n\r\n\r\nstate 604\r\n\r\n    block  ->  '{' statement_list_opt '}' .   (rule 190)\r\n\r\n    $default\treduce using rule 190 (block)\r\n\r\n\r\n\r\nstate 605\r\n\r\n    statement_list  ->  statement_list statement .   (rule 194)\r\n\r\n    $default\treduce using rule 194 (statement_list)\r\n\r\n\r\n\r\nstate 606\r\n\r\n    declaration_statement  ->  local_variable_declaration ';' .   (rule 197)\r\n\r\n    $default\treduce using rule 197 (declaration_statement)\r\n\r\n\r\n\r\nstate 607\r\n\r\n    declaration_statement  ->  local_constant_declaration ';' .   (rule 198)\r\n\r\n    $default\treduce using rule 198 (declaration_statement)\r\n\r\n\r\n\r\nstate 608\r\n\r\n    expression_statement  ->  statement_expression ';' .   (rule 212)\r\n\r\n    $default\treduce using rule 212 (expression_statement)\r\n\r\n\r\n\r\nstate 609\r\n\r\n    parameter_array  ->  attributes_opt PARAMS type IDENTIFIER .   (rule 382)\r\n\r\n    $default\treduce using rule 382 (parameter_array)\r\n\r\n\r\n\r\nstate 610\r\n\r\n    fixed_parameter  ->  attributes_opt parameter_modifier_opt type IDENTIFIER .   (rule 378)\r\n\r\n    $default\treduce using rule 378 (fixed_parameter)\r\n\r\n\r\n\r\nstate 611\r\n\r\n    constant_expression  ->  expression .   (rule 172)\r\n\r\n    $default\treduce using rule 172 (constant_expression)\r\n\r\n\r\n\r\nstate 612\r\n\r\n    enum_member_declaration  ->  attributes_opt IDENTIFIER '=' constant_expression .   (rule 505)\r\n\r\n    $default\treduce using rule 505 (enum_member_declaration)\r\n\r\n\r\n\r\nstate 613\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    interface_event_declaration  ->  attributes_opt new_opt EVENT type . IDENTIFIER interface_empty_body   (rule 491)\r\n\r\n    IDENTIFIER\tshift, and go to state 699\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 614\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt VOID IDENTIFIER . '(' formal_parameter_list_opt ')' interface_empty_body   (rule 482)\r\n\r\n    '(' \tshift, and go to state 700\r\n\r\n\r\n\r\nstate 615\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt type IDENTIFIER . '(' formal_parameter_list_opt ')' interface_empty_body   (rule 481)\r\n    interface_property_declaration  ->  attributes_opt new_opt type IDENTIFIER . ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 485)\r\n\r\n    '(' \tshift, and go to state 701\r\n\r\n    $default\treduce using rule 535 (ENTER_getset)\r\n\r\n    ENTER_getset\tgo to state 702\r\n\r\n\r\n\r\nstate 616\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS . LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 703\r\n\r\n\r\n\r\nstate 617\r\n\r\n    object_creation_expression  ->  NEW type '(' argument_list_opt ')' .   (rule 84)\r\n\r\n    $default\treduce using rule 84 (object_creation_expression)\r\n\r\n\r\n\r\nstate 618\r\n\r\n    array_creation_expression  ->  NEW non_array_type LEFT_BRACKET expression_list RIGHT_BRACKET . rank_specifiers_opt array_initializer_opt   (rule 85)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n\r\n    $default\treduce using rule 41 (rank_specifiers_opt)\r\n\r\n    rank_specifiers_opt\tgo to state 704\r\n    rank_specifier\tgo to state 705\r\n\r\n\r\n\r\nstate 619\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    stackalloc_initializer  ->  STACKALLOC type . LEFT_BRACKET expression RIGHT_BRACKET   (rule 207)\r\n\r\n    LEFT_BRACKET\tshift, and go to state 706\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 620\r\n\r\n    array_initializer  ->  '{' variable_initializer_list_opt '}' .   (rule 462)\r\n\r\n    $default\treduce using rule 462 (array_initializer)\r\n\r\n\r\n\r\nstate 621\r\n\r\n    array_initializer  ->  '{' variable_initializer_list COMMA . '}'   (rule 463)\r\n    variable_initializer_list  ->  variable_initializer_list COMMA . variable_initializer   (rule 467)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STACKALLOC\tshift, and go to state 530\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 384\r\n    '}' \tshift, and go to state 707\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 531\r\n    variable_initializer\tgo to state 708\r\n    stackalloc_initializer\tgo to state 533\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n    array_initializer\tgo to state 534\r\n\r\n\r\n\r\nstate 622\r\n\r\n    cast_expression  ->  '(' VOID type_quals_opt ')' unary_expression .   (rule 119)\r\n\r\n    $default\treduce using rule 119 (cast_expression)\r\n\r\n\r\n\r\nstate 623\r\n\r\n    cast_expression  ->  '(' primitive_type type_quals_opt ')' unary_expression .   (rule 117)\r\n\r\n    $default\treduce using rule 117 (cast_expression)\r\n\r\n\r\n\r\nstate 624\r\n\r\n    cast_expression  ->  '(' class_type type_quals_opt ')' unary_expression .   (rule 118)\r\n\r\n    $default\treduce using rule 118 (cast_expression)\r\n\r\n\r\n\r\nstate 625\r\n\r\n    cast_expression  ->  '(' multiplicative_expression '*' ')' unary_expression .   (rule 115)\r\n\r\n    $default\treduce using rule 115 (cast_expression)\r\n\r\n\r\n\r\nstate 626\r\n\r\n    cast_expression  ->  '(' qualified_identifier rank_specifier type_quals_opt ')' . unary_expression   (rule 116)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 709\r\n    cast_expression\tgo to state 216\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 627\r\n\r\n    argument_list  ->  argument_list COMMA argument .   (rule 46)\r\n\r\n    $default\treduce using rule 46 (argument_list)\r\n\r\n\r\n\r\nstate 628\r\n\r\n    conditional_expression  ->  conditional_or_expression '?' expression ':' expression .   (rule 157)\r\n\r\n    $default\treduce using rule 157 (conditional_expression)\r\n\r\n\r\n\r\nstate 629\r\n\r\n    constructor_declarator  ->  IDENTIFIER '(' formal_parameter_list_opt . ')' constructor_initializer_opt   (rule 434)\r\n\r\n    ')' \tshift, and go to state 710\r\n\r\n\r\n\r\nstate 630\r\n\r\n    constant_declarator  ->  IDENTIFIER . '=' constant_expression   (rule 211)\r\n\r\n    '=' \tshift, and go to state 711\r\n\r\n\r\n\r\nstate 631\r\n\r\n    constant_declarators  ->  constant_declarators . COMMA constant_declarator   (rule 210)\r\n    constant_declaration  ->  attributes_opt modifiers_opt CONST type constant_declarators . ';'   (rule 363)\r\n\r\n    COMMA\tshift, and go to state 712\r\n    ';' \tshift, and go to state 713\r\n\r\n\r\n\r\nstate 632\r\n\r\n    constant_declarators  ->  constant_declarator .   (rule 209)\r\n\r\n    $default\treduce using rule 209 (constant_declarators)\r\n\r\n\r\n\r\nstate 633\r\n\r\n    variable_declarators  ->  variable_declarators . COMMA variable_declarator   (rule 201)\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type variable_declarators . ';'   (rule 394)\r\n\r\n    COMMA\tshift, and go to state 664\r\n    ';' \tshift, and go to state 714\r\n\r\n\r\n\r\nstate 634\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type qualified_identifier . ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n\r\n    $default\treduce using rule 533 (ENTER_accessor_decl)\r\n\r\n    ENTER_accessor_decl\tgo to state 715\r\n\r\n\r\n\r\nstate 635\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    conversion_operator_declarator  ->  EXPLICIT OPERATOR type . '(' type IDENTIFIER ')'   (rule 432)\r\n\r\n    '*' \tshift, and go to state 123\r\n    '(' \tshift, and go to state 716\r\n\r\n\r\n\r\nstate 636\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    conversion_operator_declarator  ->  IMPLICIT OPERATOR type . '(' type IDENTIFIER ')'   (rule 431)\r\n\r\n    '*' \tshift, and go to state 123\r\n    '(' \tshift, and go to state 717\r\n\r\n\r\n\r\nstate 637\r\n\r\n    method_header  ->  attributes_opt modifiers_opt VOID qualified_identifier '(' . formal_parameter_list_opt ')'   (rule 367)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    ')' \treduce using rule 368 (formal_parameter_list_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list_opt\tgo to state 718\r\n    formal_parameter_list\tgo to state 252\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 638\r\n\r\n    destructor_declaration  ->  attributes_opt modifiers_opt '~' IDENTIFIER '(' . ')' block   (rule 439)\r\n\r\n    ')' \tshift, and go to state 719\r\n\r\n\r\n\r\nstate 639\r\n\r\n    variable_declarator  ->  IDENTIFIER '=' . variable_initializer   (rule 203)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STACKALLOC\tshift, and go to state 530\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 384\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 531\r\n    variable_initializer\tgo to state 720\r\n    stackalloc_initializer\tgo to state 533\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n    array_initializer\tgo to state 534\r\n\r\n\r\n\r\nstate 640\r\n\r\n    overloadable_operator  ->  FALSE .   (rule 416)\r\n\r\n    $default\treduce using rule 416 (overloadable_operator)\r\n\r\n\r\n\r\nstate 641\r\n\r\n    overloadable_operator  ->  TRUE .   (rule 415)\r\n\r\n    $default\treduce using rule 415 (overloadable_operator)\r\n\r\n\r\n\r\nstate 642\r\n\r\n    overloadable_operator  ->  LTLT .   (rule 423)\r\n\r\n    $default\treduce using rule 423 (overloadable_operator)\r\n\r\n\r\n\r\nstate 643\r\n\r\n    overloadable_operator  ->  GTGT .   (rule 424)\r\n\r\n    $default\treduce using rule 424 (overloadable_operator)\r\n\r\n\r\n\r\nstate 644\r\n\r\n    overloadable_operator  ->  EQEQ .   (rule 425)\r\n\r\n    $default\treduce using rule 425 (overloadable_operator)\r\n\r\n\r\n\r\nstate 645\r\n\r\n    overloadable_operator  ->  NOTEQ .   (rule 426)\r\n\r\n    $default\treduce using rule 426 (overloadable_operator)\r\n\r\n\r\n\r\nstate 646\r\n\r\n    overloadable_operator  ->  LEQ .   (rule 430)\r\n\r\n    $default\treduce using rule 430 (overloadable_operator)\r\n\r\n\r\n\r\nstate 647\r\n\r\n    overloadable_operator  ->  GEQ .   (rule 429)\r\n\r\n    $default\treduce using rule 429 (overloadable_operator)\r\n\r\n\r\n\r\nstate 648\r\n\r\n    overloadable_operator  ->  PLUSPLUS .   (rule 413)\r\n\r\n    $default\treduce using rule 413 (overloadable_operator)\r\n\r\n\r\n\r\nstate 649\r\n\r\n    overloadable_operator  ->  MINUSMINUS .   (rule 414)\r\n\r\n    $default\treduce using rule 414 (overloadable_operator)\r\n\r\n\r\n\r\nstate 650\r\n\r\n    overloadable_operator  ->  '*' .   (rule 417)\r\n\r\n    $default\treduce using rule 417 (overloadable_operator)\r\n\r\n\r\n\r\nstate 651\r\n\r\n    overloadable_operator  ->  '&' .   (rule 420)\r\n\r\n    $default\treduce using rule 420 (overloadable_operator)\r\n\r\n\r\n\r\nstate 652\r\n\r\n    overloadable_operator  ->  '!' .   (rule 411)\r\n\r\n    $default\treduce using rule 411 (overloadable_operator)\r\n\r\n\r\n\r\nstate 653\r\n\r\n    overloadable_operator  ->  '~' .   (rule 412)\r\n\r\n    $default\treduce using rule 412 (overloadable_operator)\r\n\r\n\r\n\r\nstate 654\r\n\r\n    overloadable_operator  ->  '+' .   (rule 409)\r\n\r\n    $default\treduce using rule 409 (overloadable_operator)\r\n\r\n\r\n\r\nstate 655\r\n\r\n    overloadable_operator  ->  '-' .   (rule 410)\r\n\r\n    $default\treduce using rule 410 (overloadable_operator)\r\n\r\n\r\n\r\nstate 656\r\n\r\n    overloadable_operator  ->  '/' .   (rule 418)\r\n\r\n    $default\treduce using rule 418 (overloadable_operator)\r\n\r\n\r\n\r\nstate 657\r\n\r\n    overloadable_operator  ->  '%' .   (rule 419)\r\n\r\n    $default\treduce using rule 419 (overloadable_operator)\r\n\r\n\r\n\r\nstate 658\r\n\r\n    overloadable_operator  ->  '<' .   (rule 428)\r\n\r\n    $default\treduce using rule 428 (overloadable_operator)\r\n\r\n\r\n\r\nstate 659\r\n\r\n    overloadable_operator  ->  '>' .   (rule 427)\r\n\r\n    $default\treduce using rule 427 (overloadable_operator)\r\n\r\n\r\n\r\nstate 660\r\n\r\n    overloadable_operator  ->  '^' .   (rule 422)\r\n\r\n    $default\treduce using rule 422 (overloadable_operator)\r\n\r\n\r\n\r\nstate 661\r\n\r\n    overloadable_operator  ->  '|' .   (rule 421)\r\n\r\n    $default\treduce using rule 421 (overloadable_operator)\r\n\r\n\r\n\r\nstate 662\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator . '(' type IDENTIFIER ')'   (rule 407)\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator . '(' type IDENTIFIER COMMA type IDENTIFIER ')'   (rule 408)\r\n\r\n    '(' \tshift, and go to state 721\r\n\r\n\r\n\r\nstate 663\r\n\r\n    indexer_declarator  ->  type THIS LEFT_BRACKET . formal_parameter_list RIGHT_BRACKET   (rule 401)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list\tgo to state 722\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 664\r\n\r\n    variable_declarators  ->  variable_declarators COMMA . variable_declarator   (rule 201)\r\n\r\n    IDENTIFIER\tshift, and go to state 602\r\n\r\n    variable_declarator\tgo to state 723\r\n\r\n\r\n\r\nstate 665\r\n\r\n    field_declaration  ->  attributes_opt modifiers_opt type variable_declarators ';' .   (rule 364)\r\n\r\n    $default\treduce using rule 364 (field_declaration)\r\n\r\n\r\n\r\nstate 666\r\n\r\n    method_header  ->  attributes_opt modifiers_opt type qualified_identifier '(' . formal_parameter_list_opt ')'   (rule 366)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    ')' \treduce using rule 368 (formal_parameter_list_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list_opt\tgo to state 724\r\n    formal_parameter_list\tgo to state 252\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 667\r\n\r\n    property_declaration  ->  attributes_opt modifiers_opt type qualified_identifier ENTER_getset . '{' accessor_declarations '}' EXIT_getset   (rule 383)\r\n\r\n    '{' \tshift, and go to state 725\r\n\r\n\r\n\r\nstate 668\r\n\r\n    qualified_this  ->  qualifier THIS .   (rule 403)\r\n\r\n    $default\treduce using rule 403 (qualified_this)\r\n\r\n\r\n\r\nstate 669\r\n\r\n    indexer_declarator  ->  type qualified_this LEFT_BRACKET . formal_parameter_list RIGHT_BRACKET   (rule 402)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list\tgo to state 726\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 670\r\n\r\n    indexer_declaration  ->  attributes_opt modifiers_opt indexer_declarator ENTER_getset '{' . accessor_declarations '}' EXIT_getset   (rule 400)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 727\r\n    accessor_declarations\tgo to state 728\r\n    get_accessor_declaration\tgo to state 729\r\n    set_accessor_declaration\tgo to state 730\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 671\r\n\r\n    labeled_statement  ->  IDENTIFIER ':' statement .   (rule 196)\r\n\r\n    $default\treduce using rule 196 (labeled_statement)\r\n\r\n\r\n\r\nstate 672\r\n\r\n    local_constant_declaration  ->  CONST type constant_declarators .   (rule 208)\r\n    constant_declarators  ->  constant_declarators . COMMA constant_declarator   (rule 210)\r\n\r\n    COMMA\tshift, and go to state 712\r\n\r\n    $default\treduce using rule 208 (local_constant_declaration)\r\n\r\n\r\n\r\nstate 673\r\n\r\n    do_statement  ->  DO embedded_statement WHILE . '(' boolean_expression ')' ';'   (rule 241)\r\n\r\n    '(' \tshift, and go to state 731\r\n\r\n\r\n\r\nstate 674\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    fixed_statement  ->  FIXED '(' type . fixed_pointer_declarators ')' embedded_statement   (rule 287)\r\n\r\n    IDENTIFIER\tshift, and go to state 732\r\n    '*' \tshift, and go to state 123\r\n\r\n    fixed_pointer_declarators\tgo to state 733\r\n    fixed_pointer_declarator\tgo to state 734\r\n\r\n\r\n\r\nstate 675\r\n\r\n    for_initializer  ->  local_variable_declaration .   (rule 249)\r\n\r\n    $default\treduce using rule 249 (for_initializer)\r\n\r\n\r\n\r\nstate 676\r\n\r\n    statement_expression_list  ->  statement_expression .   (rule 253)\r\n\r\n    $default\treduce using rule 253 (statement_expression_list)\r\n\r\n\r\n\r\nstate 677\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt . ';' for_condition_opt ';' for_iterator_opt ')' embedded_statement   (rule 242)\r\n\r\n    ';' \tshift, and go to state 735\r\n\r\n\r\n\r\nstate 678\r\n\r\n    for_initializer_opt  ->  for_initializer .   (rule 244)\r\n\r\n    $default\treduce using rule 244 (for_initializer_opt)\r\n\r\n\r\n\r\nstate 679\r\n\r\n    for_initializer  ->  statement_expression_list .   (rule 250)\r\n    statement_expression_list  ->  statement_expression_list . COMMA statement_expression   (rule 254)\r\n\r\n    COMMA\tshift, and go to state 736\r\n\r\n    $default\treduce using rule 250 (for_initializer)\r\n\r\n\r\n\r\nstate 680\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    foreach_statement  ->  FOREACH '(' type . IDENTIFIER IN expression ')' embedded_statement   (rule 255)\r\n\r\n    IDENTIFIER\tshift, and go to state 737\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 681\r\n\r\n    goto_statement  ->  GOTO IDENTIFIER ';' .   (rule 263)\r\n\r\n    $default\treduce using rule 263 (goto_statement)\r\n\r\n\r\n\r\nstate 682\r\n\r\n    goto_statement  ->  GOTO CASE constant_expression . ';'   (rule 264)\r\n\r\n    ';' \tshift, and go to state 738\r\n\r\n\r\n\r\nstate 683\r\n\r\n    goto_statement  ->  GOTO DEFAULT ';' .   (rule 265)\r\n\r\n    $default\treduce using rule 265 (goto_statement)\r\n\r\n\r\n\r\nstate 684\r\n\r\n    boolean_expression  ->  expression .   (rule 173)\r\n\r\n    $default\treduce using rule 173 (boolean_expression)\r\n\r\n\r\n\r\nstate 685\r\n\r\n    if_statement  ->  IF '(' boolean_expression . ')' embedded_statement   (rule 222)\r\n    if_statement  ->  IF '(' boolean_expression . ')' embedded_statement ELSE embedded_statement   (rule 223)\r\n\r\n    ')' \tshift, and go to state 739\r\n\r\n\r\n\r\nstate 686\r\n\r\n    lock_statement  ->  LOCK '(' expression . ')' embedded_statement   (rule 283)\r\n\r\n    ')' \tshift, and go to state 740\r\n\r\n\r\n\r\nstate 687\r\n\r\n    return_statement  ->  RETURN expression_opt ';' .   (rule 266)\r\n\r\n    $default\treduce using rule 266 (return_statement)\r\n\r\n\r\n\r\nstate 688\r\n\r\n    switch_statement  ->  SWITCH '(' expression . ')' switch_block   (rule 224)\r\n\r\n    ')' \tshift, and go to state 741\r\n\r\n\r\n\r\nstate 689\r\n\r\n    throw_statement  ->  THROW expression_opt ';' .   (rule 269)\r\n\r\n    $default\treduce using rule 269 (throw_statement)\r\n\r\n\r\n\r\nstate 690\r\n\r\n    catch_clause  ->  CATCH . '(' class_type identifier_opt ')' block   (rule 275)\r\n    catch_clause  ->  CATCH . '(' type_name identifier_opt ')' block   (rule 276)\r\n    catch_clause  ->  CATCH . block   (rule 277)\r\n\r\n    '(' \tshift, and go to state 742\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 743\r\n\r\n\r\n\r\nstate 691\r\n\r\n    finally_clause  ->  FINALLY . block   (rule 280)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 744\r\n\r\n\r\n\r\nstate 692\r\n\r\n    try_statement  ->  TRY block catch_clauses .   (rule 270)\r\n    try_statement  ->  TRY block catch_clauses . finally_clause   (rule 272)\r\n    catch_clauses  ->  catch_clauses . catch_clause   (rule 274)\r\n\r\n    CATCH\tshift, and go to state 690\r\n    FINALLY\tshift, and go to state 691\r\n\r\n    $default\treduce using rule 270 (try_statement)\r\n\r\n    catch_clause\tgo to state 745\r\n    finally_clause\tgo to state 746\r\n\r\n\r\n\r\nstate 693\r\n\r\n    catch_clauses  ->  catch_clause .   (rule 273)\r\n\r\n    $default\treduce using rule 273 (catch_clauses)\r\n\r\n\r\n\r\nstate 694\r\n\r\n    try_statement  ->  TRY block finally_clause .   (rule 271)\r\n\r\n    $default\treduce using rule 271 (try_statement)\r\n\r\n\r\n\r\nstate 695\r\n\r\n    resource_acquisition  ->  expression .   (rule 286)\r\n\r\n    $default\treduce using rule 286 (resource_acquisition)\r\n\r\n\r\n\r\nstate 696\r\n\r\n    resource_acquisition  ->  local_variable_declaration .   (rule 285)\r\n\r\n    $default\treduce using rule 285 (resource_acquisition)\r\n\r\n\r\n\r\nstate 697\r\n\r\n    using_statement  ->  USING '(' resource_acquisition . ')' embedded_statement   (rule 284)\r\n\r\n    ')' \tshift, and go to state 747\r\n\r\n\r\n\r\nstate 698\r\n\r\n    while_statement  ->  WHILE '(' boolean_expression . ')' embedded_statement   (rule 240)\r\n\r\n    ')' \tshift, and go to state 748\r\n\r\n\r\n\r\nstate 699\r\n\r\n    interface_event_declaration  ->  attributes_opt new_opt EVENT type IDENTIFIER . interface_empty_body   (rule 491)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 751\r\n\r\n\r\n\r\nstate 700\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt VOID IDENTIFIER '(' . formal_parameter_list_opt ')' interface_empty_body   (rule 482)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    ')' \treduce using rule 368 (formal_parameter_list_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list_opt\tgo to state 752\r\n    formal_parameter_list\tgo to state 252\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 701\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt type IDENTIFIER '(' . formal_parameter_list_opt ')' interface_empty_body   (rule 481)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    ')' \treduce using rule 368 (formal_parameter_list_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list_opt\tgo to state 753\r\n    formal_parameter_list\tgo to state 252\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 702\r\n\r\n    interface_property_declaration  ->  attributes_opt new_opt type IDENTIFIER ENTER_getset . '{' interface_accessors '}' EXIT_getset   (rule 485)\r\n\r\n    '{' \tshift, and go to state 754\r\n\r\n\r\n\r\nstate 703\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET . formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 250\r\n    formal_parameter_list\tgo to state 755\r\n    formal_parameter\tgo to state 253\r\n    fixed_parameter\tgo to state 254\r\n    parameter_array\tgo to state 255\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 704\r\n\r\n    array_creation_expression  ->  NEW non_array_type LEFT_BRACKET expression_list RIGHT_BRACKET rank_specifiers_opt . array_initializer_opt   (rule 85)\r\n\r\n    '{' \tshift, and go to state 384\r\n\r\n    $default\treduce using rule 87 (array_initializer_opt)\r\n\r\n    array_initializer_opt\tgo to state 756\r\n    array_initializer\tgo to state 757\r\n\r\n\r\n\r\nstate 705\r\n\r\n    rank_specifiers_opt  ->  rank_specifier . rank_specifiers_opt   (rule 42)\r\n\r\n    RANK_SPECIFIER\tshift, and go to state 124\r\n\r\n    $default\treduce using rule 41 (rank_specifiers_opt)\r\n\r\n    rank_specifiers_opt\tgo to state 758\r\n    rank_specifier\tgo to state 705\r\n\r\n\r\n\r\nstate 706\r\n\r\n    stackalloc_initializer  ->  STACKALLOC type LEFT_BRACKET . expression RIGHT_BRACKET   (rule 207)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 759\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 707\r\n\r\n    array_initializer  ->  '{' variable_initializer_list COMMA '}' .   (rule 463)\r\n\r\n    $default\treduce using rule 463 (array_initializer)\r\n\r\n\r\n\r\nstate 708\r\n\r\n    variable_initializer_list  ->  variable_initializer_list COMMA variable_initializer .   (rule 467)\r\n\r\n    $default\treduce using rule 467 (variable_initializer_list)\r\n\r\n\r\n\r\nstate 709\r\n\r\n    cast_expression  ->  '(' qualified_identifier rank_specifier type_quals_opt ')' unary_expression .   (rule 116)\r\n\r\n    $default\treduce using rule 116 (cast_expression)\r\n\r\n\r\n\r\nstate 710\r\n\r\n    constructor_declarator  ->  IDENTIFIER '(' formal_parameter_list_opt ')' . constructor_initializer_opt   (rule 434)\r\n\r\n    ':' \tshift, and go to state 760\r\n\r\n    $default\treduce using rule 435 (constructor_initializer_opt)\r\n\r\n    constructor_initializer_opt\tgo to state 761\r\n    constructor_initializer\tgo to state 762\r\n\r\n\r\n\r\nstate 711\r\n\r\n    constant_declarator  ->  IDENTIFIER '=' . constant_expression   (rule 211)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 611\r\n    constant_expression\tgo to state 763\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 712\r\n\r\n    constant_declarators  ->  constant_declarators COMMA . constant_declarator   (rule 210)\r\n\r\n    IDENTIFIER\tshift, and go to state 630\r\n\r\n    constant_declarator\tgo to state 764\r\n\r\n\r\n\r\nstate 713\r\n\r\n    constant_declaration  ->  attributes_opt modifiers_opt CONST type constant_declarators ';' .   (rule 363)\r\n\r\n    $default\treduce using rule 363 (constant_declaration)\r\n\r\n\r\n\r\nstate 714\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type variable_declarators ';' .   (rule 394)\r\n\r\n    $default\treduce using rule 394 (event_declaration)\r\n\r\n\r\n\r\nstate 715\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl . '{' event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n\r\n    '{' \tshift, and go to state 765\r\n\r\n\r\n\r\nstate 716\r\n\r\n    conversion_operator_declarator  ->  EXPLICIT OPERATOR type '(' . type IDENTIFIER ')'   (rule 432)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 766\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 717\r\n\r\n    conversion_operator_declarator  ->  IMPLICIT OPERATOR type '(' . type IDENTIFIER ')'   (rule 431)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 767\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 718\r\n\r\n    method_header  ->  attributes_opt modifiers_opt VOID qualified_identifier '(' formal_parameter_list_opt . ')'   (rule 367)\r\n\r\n    ')' \tshift, and go to state 768\r\n\r\n\r\n\r\nstate 719\r\n\r\n    destructor_declaration  ->  attributes_opt modifiers_opt '~' IDENTIFIER '(' ')' . block   (rule 439)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 769\r\n\r\n\r\n\r\nstate 720\r\n\r\n    variable_declarator  ->  IDENTIFIER '=' variable_initializer .   (rule 203)\r\n\r\n    $default\treduce using rule 203 (variable_declarator)\r\n\r\n\r\n\r\nstate 721\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' . type IDENTIFIER ')'   (rule 407)\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' . type IDENTIFIER COMMA type IDENTIFIER ')'   (rule 408)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 770\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 722\r\n\r\n    formal_parameter_list  ->  formal_parameter_list . COMMA formal_parameter   (rule 375)\r\n    indexer_declarator  ->  type THIS LEFT_BRACKET formal_parameter_list . RIGHT_BRACKET   (rule 401)\r\n\r\n    COMMA\tshift, and go to state 368\r\n    RIGHT_BRACKET\tshift, and go to state 771\r\n\r\n\r\n\r\nstate 723\r\n\r\n    variable_declarators  ->  variable_declarators COMMA variable_declarator .   (rule 201)\r\n\r\n    $default\treduce using rule 201 (variable_declarators)\r\n\r\n\r\n\r\nstate 724\r\n\r\n    method_header  ->  attributes_opt modifiers_opt type qualified_identifier '(' formal_parameter_list_opt . ')'   (rule 366)\r\n\r\n    ')' \tshift, and go to state 772\r\n\r\n\r\n\r\nstate 725\r\n\r\n    property_declaration  ->  attributes_opt modifiers_opt type qualified_identifier ENTER_getset '{' . accessor_declarations '}' EXIT_getset   (rule 383)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 727\r\n    accessor_declarations\tgo to state 773\r\n    get_accessor_declaration\tgo to state 729\r\n    set_accessor_declaration\tgo to state 730\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 726\r\n\r\n    formal_parameter_list  ->  formal_parameter_list . COMMA formal_parameter   (rule 375)\r\n    indexer_declarator  ->  type qualified_this LEFT_BRACKET formal_parameter_list . RIGHT_BRACKET   (rule 402)\r\n\r\n    COMMA\tshift, and go to state 368\r\n    RIGHT_BRACKET\tshift, and go to state 774\r\n\r\n\r\n\r\nstate 727\r\n\r\n    get_accessor_declaration  ->  attributes_opt . GET EXIT_getset accessor_body ENTER_getset   (rule 390)\r\n    set_accessor_declaration  ->  attributes_opt . SET EXIT_getset accessor_body ENTER_getset   (rule 391)\r\n\r\n    GET \tshift, and go to state 775\r\n    SET \tshift, and go to state 776\r\n\r\n\r\n\r\nstate 728\r\n\r\n    indexer_declaration  ->  attributes_opt modifiers_opt indexer_declarator ENTER_getset '{' accessor_declarations . '}' EXIT_getset   (rule 400)\r\n\r\n    '}' \tshift, and go to state 777\r\n\r\n\r\n\r\nstate 729\r\n\r\n    accessor_declarations  ->  get_accessor_declaration . set_accessor_declaration_opt   (rule 384)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 386 (set_accessor_declaration_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 778\r\n    set_accessor_declaration_opt\tgo to state 779\r\n    set_accessor_declaration\tgo to state 780\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 730\r\n\r\n    accessor_declarations  ->  set_accessor_declaration . get_accessor_declaration_opt   (rule 385)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 388 (get_accessor_declaration_opt)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 781\r\n    get_accessor_declaration_opt\tgo to state 782\r\n    get_accessor_declaration\tgo to state 783\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 731\r\n\r\n    do_statement  ->  DO embedded_statement WHILE '(' . boolean_expression ')' ';'   (rule 241)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 684\r\n    boolean_expression\tgo to state 784\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 732\r\n\r\n    fixed_pointer_declarator  ->  IDENTIFIER . '=' expression   (rule 290)\r\n\r\n    '=' \tshift, and go to state 785\r\n\r\n\r\n\r\nstate 733\r\n\r\n    fixed_statement  ->  FIXED '(' type fixed_pointer_declarators . ')' embedded_statement   (rule 287)\r\n    fixed_pointer_declarators  ->  fixed_pointer_declarators . COMMA fixed_pointer_declarator   (rule 289)\r\n\r\n    COMMA\tshift, and go to state 786\r\n    ')' \tshift, and go to state 787\r\n\r\n\r\n\r\nstate 734\r\n\r\n    fixed_pointer_declarators  ->  fixed_pointer_declarator .   (rule 288)\r\n\r\n    $default\treduce using rule 288 (fixed_pointer_declarators)\r\n\r\n\r\n\r\nstate 735\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt ';' . for_condition_opt ';' for_iterator_opt ')' embedded_statement   (rule 242)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 245 (for_condition_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 684\r\n    boolean_expression\tgo to state 788\r\n    for_condition_opt\tgo to state 789\r\n    for_condition\tgo to state 790\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 736\r\n\r\n    statement_expression_list  ->  statement_expression_list COMMA . statement_expression   (rule 254)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement_expression\tgo to state 791\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 737\r\n\r\n    foreach_statement  ->  FOREACH '(' type IDENTIFIER . IN expression ')' embedded_statement   (rule 255)\r\n\r\n    IN  \tshift, and go to state 792\r\n\r\n\r\n\r\nstate 738\r\n\r\n    goto_statement  ->  GOTO CASE constant_expression ';' .   (rule 264)\r\n\r\n    $default\treduce using rule 264 (goto_statement)\r\n\r\n\r\n\r\nstate 739\r\n\r\n    if_statement  ->  IF '(' boolean_expression ')' . embedded_statement   (rule 222)\r\n    if_statement  ->  IF '(' boolean_expression ')' . embedded_statement ELSE embedded_statement   (rule 223)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 793\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 740\r\n\r\n    lock_statement  ->  LOCK '(' expression ')' . embedded_statement   (rule 283)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 794\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 741\r\n\r\n    switch_statement  ->  SWITCH '(' expression ')' . switch_block   (rule 224)\r\n\r\n    '{' \tshift, and go to state 795\r\n\r\n    switch_block\tgo to state 796\r\n\r\n\r\n\r\nstate 742\r\n\r\n    catch_clause  ->  CATCH '(' . class_type identifier_opt ')' block   (rule 275)\r\n    catch_clause  ->  CATCH '(' . type_name identifier_opt ')' block   (rule 276)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    OBJECT\tshift, and go to state 86\r\n    STRING\tshift, and go to state 89\r\n\r\n    type_name\tgo to state 797\r\n    class_type\tgo to state 798\r\n    qualified_identifier\tgo to state 111\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 743\r\n\r\n    catch_clause  ->  CATCH block .   (rule 277)\r\n\r\n    $default\treduce using rule 277 (catch_clause)\r\n\r\n\r\n\r\nstate 744\r\n\r\n    finally_clause  ->  FINALLY block .   (rule 280)\r\n\r\n    $default\treduce using rule 280 (finally_clause)\r\n\r\n\r\n\r\nstate 745\r\n\r\n    catch_clauses  ->  catch_clauses catch_clause .   (rule 274)\r\n\r\n    $default\treduce using rule 274 (catch_clauses)\r\n\r\n\r\n\r\nstate 746\r\n\r\n    try_statement  ->  TRY block catch_clauses finally_clause .   (rule 272)\r\n\r\n    $default\treduce using rule 272 (try_statement)\r\n\r\n\r\n\r\nstate 747\r\n\r\n    using_statement  ->  USING '(' resource_acquisition ')' . embedded_statement   (rule 284)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 799\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 748\r\n\r\n    while_statement  ->  WHILE '(' boolean_expression ')' . embedded_statement   (rule 240)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 800\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 749\r\n\r\n    interface_empty_body  ->  '{' . '}'   (rule 493)\r\n\r\n    '}' \tshift, and go to state 801\r\n\r\n\r\n\r\nstate 750\r\n\r\n    interface_empty_body  ->  ';' .   (rule 492)\r\n\r\n    $default\treduce using rule 492 (interface_empty_body)\r\n\r\n\r\n\r\nstate 751\r\n\r\n    interface_event_declaration  ->  attributes_opt new_opt EVENT type IDENTIFIER interface_empty_body .   (rule 491)\r\n\r\n    $default\treduce using rule 491 (interface_event_declaration)\r\n\r\n\r\n\r\nstate 752\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt VOID IDENTIFIER '(' formal_parameter_list_opt . ')' interface_empty_body   (rule 482)\r\n\r\n    ')' \tshift, and go to state 802\r\n\r\n\r\n\r\nstate 753\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt type IDENTIFIER '(' formal_parameter_list_opt . ')' interface_empty_body   (rule 481)\r\n\r\n    ')' \tshift, and go to state 803\r\n\r\n\r\n\r\nstate 754\r\n\r\n    interface_property_declaration  ->  attributes_opt new_opt type IDENTIFIER ENTER_getset '{' . interface_accessors '}' EXIT_getset   (rule 485)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 804\r\n    interface_accessors\tgo to state 805\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 755\r\n\r\n    formal_parameter_list  ->  formal_parameter_list . COMMA formal_parameter   (rule 375)\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list . RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    COMMA\tshift, and go to state 368\r\n    RIGHT_BRACKET\tshift, and go to state 806\r\n\r\n\r\n\r\nstate 756\r\n\r\n    array_creation_expression  ->  NEW non_array_type LEFT_BRACKET expression_list RIGHT_BRACKET rank_specifiers_opt array_initializer_opt .   (rule 85)\r\n\r\n    $default\treduce using rule 85 (array_creation_expression)\r\n\r\n\r\n\r\nstate 757\r\n\r\n    array_initializer_opt  ->  array_initializer .   (rule 88)\r\n\r\n    $default\treduce using rule 88 (array_initializer_opt)\r\n\r\n\r\n\r\nstate 758\r\n\r\n    rank_specifiers_opt  ->  rank_specifier rank_specifiers_opt .   (rule 42)\r\n\r\n    $default\treduce using rule 42 (rank_specifiers_opt)\r\n\r\n\r\n\r\nstate 759\r\n\r\n    stackalloc_initializer  ->  STACKALLOC type LEFT_BRACKET expression . RIGHT_BRACKET   (rule 207)\r\n\r\n    RIGHT_BRACKET\tshift, and go to state 807\r\n\r\n\r\n\r\nstate 760\r\n\r\n    constructor_initializer  ->  ':' . BASE '(' argument_list_opt ')'   (rule 437)\r\n    constructor_initializer  ->  ':' . THIS '(' argument_list_opt ')'   (rule 438)\r\n\r\n    BASE\tshift, and go to state 808\r\n    THIS\tshift, and go to state 809\r\n\r\n\r\n\r\nstate 761\r\n\r\n    constructor_declarator  ->  IDENTIFIER '(' formal_parameter_list_opt ')' constructor_initializer_opt .   (rule 434)\r\n\r\n    $default\treduce using rule 434 (constructor_declarator)\r\n\r\n\r\n\r\nstate 762\r\n\r\n    constructor_initializer_opt  ->  constructor_initializer .   (rule 436)\r\n\r\n    $default\treduce using rule 436 (constructor_initializer_opt)\r\n\r\n\r\n\r\nstate 763\r\n\r\n    constant_declarator  ->  IDENTIFIER '=' constant_expression .   (rule 211)\r\n\r\n    $default\treduce using rule 211 (constant_declarator)\r\n\r\n\r\n\r\nstate 764\r\n\r\n    constant_declarators  ->  constant_declarators COMMA constant_declarator .   (rule 210)\r\n\r\n    $default\treduce using rule 210 (constant_declarators)\r\n\r\n\r\n\r\nstate 765\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' . event_accessor_declarations '}' EXIT_accessor_decl   (rule 395)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 810\r\n    event_accessor_declarations\tgo to state 811\r\n    add_accessor_declaration\tgo to state 812\r\n    remove_accessor_declaration\tgo to state 813\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 766\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    conversion_operator_declarator  ->  EXPLICIT OPERATOR type '(' type . IDENTIFIER ')'   (rule 432)\r\n\r\n    IDENTIFIER\tshift, and go to state 814\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 767\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    conversion_operator_declarator  ->  IMPLICIT OPERATOR type '(' type . IDENTIFIER ')'   (rule 431)\r\n\r\n    IDENTIFIER\tshift, and go to state 815\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 768\r\n\r\n    method_header  ->  attributes_opt modifiers_opt VOID qualified_identifier '(' formal_parameter_list_opt ')' .   (rule 367)\r\n\r\n    $default\treduce using rule 367 (method_header)\r\n\r\n\r\n\r\nstate 769\r\n\r\n    destructor_declaration  ->  attributes_opt modifiers_opt '~' IDENTIFIER '(' ')' block .   (rule 439)\r\n\r\n    $default\treduce using rule 439 (destructor_declaration)\r\n\r\n\r\n\r\nstate 770\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type . IDENTIFIER ')'   (rule 407)\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type . IDENTIFIER COMMA type IDENTIFIER ')'   (rule 408)\r\n\r\n    IDENTIFIER\tshift, and go to state 816\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 771\r\n\r\n    indexer_declarator  ->  type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET .   (rule 401)\r\n\r\n    $default\treduce using rule 401 (indexer_declarator)\r\n\r\n\r\n\r\nstate 772\r\n\r\n    method_header  ->  attributes_opt modifiers_opt type qualified_identifier '(' formal_parameter_list_opt ')' .   (rule 366)\r\n\r\n    $default\treduce using rule 366 (method_header)\r\n\r\n\r\n\r\nstate 773\r\n\r\n    property_declaration  ->  attributes_opt modifiers_opt type qualified_identifier ENTER_getset '{' accessor_declarations . '}' EXIT_getset   (rule 383)\r\n\r\n    '}' \tshift, and go to state 817\r\n\r\n\r\n\r\nstate 774\r\n\r\n    indexer_declarator  ->  type qualified_this LEFT_BRACKET formal_parameter_list RIGHT_BRACKET .   (rule 402)\r\n\r\n    $default\treduce using rule 402 (indexer_declarator)\r\n\r\n\r\n\r\nstate 775\r\n\r\n    get_accessor_declaration  ->  attributes_opt GET . EXIT_getset accessor_body ENTER_getset   (rule 390)\r\n\r\n    $default\treduce using rule 536 (EXIT_getset)\r\n\r\n    EXIT_getset\tgo to state 818\r\n\r\n\r\n\r\nstate 776\r\n\r\n    set_accessor_declaration  ->  attributes_opt SET . EXIT_getset accessor_body ENTER_getset   (rule 391)\r\n\r\n    $default\treduce using rule 536 (EXIT_getset)\r\n\r\n    EXIT_getset\tgo to state 819\r\n\r\n\r\n\r\nstate 777\r\n\r\n    indexer_declaration  ->  attributes_opt modifiers_opt indexer_declarator ENTER_getset '{' accessor_declarations '}' . EXIT_getset   (rule 400)\r\n\r\n    $default\treduce using rule 536 (EXIT_getset)\r\n\r\n    EXIT_getset\tgo to state 820\r\n\r\n\r\n\r\nstate 778\r\n\r\n    set_accessor_declaration  ->  attributes_opt . SET EXIT_getset accessor_body ENTER_getset   (rule 391)\r\n\r\n    SET \tshift, and go to state 776\r\n\r\n\r\n\r\nstate 779\r\n\r\n    accessor_declarations  ->  get_accessor_declaration set_accessor_declaration_opt .   (rule 384)\r\n\r\n    $default\treduce using rule 384 (accessor_declarations)\r\n\r\n\r\n\r\nstate 780\r\n\r\n    set_accessor_declaration_opt  ->  set_accessor_declaration .   (rule 387)\r\n\r\n    $default\treduce using rule 387 (set_accessor_declaration_opt)\r\n\r\n\r\n\r\nstate 781\r\n\r\n    get_accessor_declaration  ->  attributes_opt . GET EXIT_getset accessor_body ENTER_getset   (rule 390)\r\n\r\n    GET \tshift, and go to state 775\r\n\r\n\r\n\r\nstate 782\r\n\r\n    accessor_declarations  ->  set_accessor_declaration get_accessor_declaration_opt .   (rule 385)\r\n\r\n    $default\treduce using rule 385 (accessor_declarations)\r\n\r\n\r\n\r\nstate 783\r\n\r\n    get_accessor_declaration_opt  ->  get_accessor_declaration .   (rule 389)\r\n\r\n    $default\treduce using rule 389 (get_accessor_declaration_opt)\r\n\r\n\r\n\r\nstate 784\r\n\r\n    do_statement  ->  DO embedded_statement WHILE '(' boolean_expression . ')' ';'   (rule 241)\r\n\r\n    ')' \tshift, and go to state 821\r\n\r\n\r\n\r\nstate 785\r\n\r\n    fixed_pointer_declarator  ->  IDENTIFIER '=' . expression   (rule 290)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 822\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 786\r\n\r\n    fixed_pointer_declarators  ->  fixed_pointer_declarators COMMA . fixed_pointer_declarator   (rule 289)\r\n\r\n    IDENTIFIER\tshift, and go to state 732\r\n\r\n    fixed_pointer_declarator\tgo to state 823\r\n\r\n\r\n\r\nstate 787\r\n\r\n    fixed_statement  ->  FIXED '(' type fixed_pointer_declarators ')' . embedded_statement   (rule 287)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 824\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 788\r\n\r\n    for_condition  ->  boolean_expression .   (rule 251)\r\n\r\n    $default\treduce using rule 251 (for_condition)\r\n\r\n\r\n\r\nstate 789\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt ';' for_condition_opt . ';' for_iterator_opt ')' embedded_statement   (rule 242)\r\n\r\n    ';' \tshift, and go to state 825\r\n\r\n\r\n\r\nstate 790\r\n\r\n    for_condition_opt  ->  for_condition .   (rule 246)\r\n\r\n    $default\treduce using rule 246 (for_condition_opt)\r\n\r\n\r\n\r\nstate 791\r\n\r\n    statement_expression_list  ->  statement_expression_list COMMA statement_expression .   (rule 254)\r\n\r\n    $default\treduce using rule 254 (statement_expression_list)\r\n\r\n\r\n\r\nstate 792\r\n\r\n    foreach_statement  ->  FOREACH '(' type IDENTIFIER IN . expression ')' embedded_statement   (rule 255)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 826\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 793\r\n\r\n    if_statement  ->  IF '(' boolean_expression ')' embedded_statement .   (rule 222)\r\n    if_statement  ->  IF '(' boolean_expression ')' embedded_statement . ELSE embedded_statement   (rule 223)\r\n\r\n    ELSE\tshift, and go to state 827\r\n\r\n    ELSE\t[reduce using rule 222 (if_statement)]\r\n    $default\treduce using rule 222 (if_statement)\r\n\r\n\r\n\r\nstate 794\r\n\r\n    lock_statement  ->  LOCK '(' expression ')' embedded_statement .   (rule 283)\r\n\r\n    $default\treduce using rule 283 (lock_statement)\r\n\r\n\r\n\r\nstate 795\r\n\r\n    switch_block  ->  '{' . switch_sections_opt '}'   (rule 225)\r\n\r\n    CASE\tshift, and go to state 828\r\n    DEFAULT\tshift, and go to state 829\r\n\r\n    $default\treduce using rule 226 (switch_sections_opt)\r\n\r\n    switch_sections_opt\tgo to state 830\r\n    switch_sections\tgo to state 831\r\n    switch_section\tgo to state 832\r\n    switch_labels\tgo to state 833\r\n    switch_label\tgo to state 834\r\n\r\n\r\n\r\nstate 796\r\n\r\n    switch_statement  ->  SWITCH '(' expression ')' switch_block .   (rule 224)\r\n\r\n    $default\treduce using rule 224 (switch_statement)\r\n\r\n\r\n\r\nstate 797\r\n\r\n    catch_clause  ->  CATCH '(' type_name . identifier_opt ')' block   (rule 276)\r\n\r\n    IDENTIFIER\tshift, and go to state 835\r\n\r\n    $default\treduce using rule 278 (identifier_opt)\r\n\r\n    identifier_opt\tgo to state 836\r\n\r\n\r\n\r\nstate 798\r\n\r\n    catch_clause  ->  CATCH '(' class_type . identifier_opt ')' block   (rule 275)\r\n\r\n    IDENTIFIER\tshift, and go to state 835\r\n\r\n    $default\treduce using rule 278 (identifier_opt)\r\n\r\n    identifier_opt\tgo to state 837\r\n\r\n\r\n\r\nstate 799\r\n\r\n    using_statement  ->  USING '(' resource_acquisition ')' embedded_statement .   (rule 284)\r\n\r\n    $default\treduce using rule 284 (using_statement)\r\n\r\n\r\n\r\nstate 800\r\n\r\n    while_statement  ->  WHILE '(' boolean_expression ')' embedded_statement .   (rule 240)\r\n\r\n    $default\treduce using rule 240 (while_statement)\r\n\r\n\r\n\r\nstate 801\r\n\r\n    interface_empty_body  ->  '{' '}' .   (rule 493)\r\n\r\n    $default\treduce using rule 493 (interface_empty_body)\r\n\r\n\r\n\r\nstate 802\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt VOID IDENTIFIER '(' formal_parameter_list_opt ')' . interface_empty_body   (rule 482)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 838\r\n\r\n\r\n\r\nstate 803\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt type IDENTIFIER '(' formal_parameter_list_opt ')' . interface_empty_body   (rule 481)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 839\r\n\r\n\r\n\r\nstate 804\r\n\r\n    interface_accessors  ->  attributes_opt . GET interface_empty_body   (rule 487)\r\n    interface_accessors  ->  attributes_opt . SET interface_empty_body   (rule 488)\r\n    interface_accessors  ->  attributes_opt . GET interface_empty_body attributes_opt SET interface_empty_body   (rule 489)\r\n    interface_accessors  ->  attributes_opt . SET interface_empty_body attributes_opt GET interface_empty_body   (rule 490)\r\n\r\n    GET \tshift, and go to state 840\r\n    SET \tshift, and go to state 841\r\n\r\n\r\n\r\nstate 805\r\n\r\n    interface_property_declaration  ->  attributes_opt new_opt type IDENTIFIER ENTER_getset '{' interface_accessors . '}' EXIT_getset   (rule 485)\r\n\r\n    '}' \tshift, and go to state 842\r\n\r\n\r\n\r\nstate 806\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET . ENTER_getset '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    $default\treduce using rule 535 (ENTER_getset)\r\n\r\n    ENTER_getset\tgo to state 843\r\n\r\n\r\n\r\nstate 807\r\n\r\n    stackalloc_initializer  ->  STACKALLOC type LEFT_BRACKET expression RIGHT_BRACKET .   (rule 207)\r\n\r\n    $default\treduce using rule 207 (stackalloc_initializer)\r\n\r\n\r\n\r\nstate 808\r\n\r\n    constructor_initializer  ->  ':' BASE . '(' argument_list_opt ')'   (rule 437)\r\n\r\n    '(' \tshift, and go to state 844\r\n\r\n\r\n\r\nstate 809\r\n\r\n    constructor_initializer  ->  ':' THIS . '(' argument_list_opt ')'   (rule 438)\r\n\r\n    '(' \tshift, and go to state 845\r\n\r\n\r\n\r\nstate 810\r\n\r\n    add_accessor_declaration  ->  attributes_opt . ADD EXIT_accessor_decl block ENTER_accessor_decl   (rule 398)\r\n    remove_accessor_declaration  ->  attributes_opt . REMOVE EXIT_accessor_decl block ENTER_accessor_decl   (rule 399)\r\n\r\n    ADD \tshift, and go to state 846\r\n    REMOVE\tshift, and go to state 847\r\n\r\n\r\n\r\nstate 811\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations . '}' EXIT_accessor_decl   (rule 395)\r\n\r\n    '}' \tshift, and go to state 848\r\n\r\n\r\n\r\nstate 812\r\n\r\n    event_accessor_declarations  ->  add_accessor_declaration . remove_accessor_declaration   (rule 396)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 849\r\n    remove_accessor_declaration\tgo to state 850\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 813\r\n\r\n    event_accessor_declarations  ->  remove_accessor_declaration . add_accessor_declaration   (rule 397)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 851\r\n    add_accessor_declaration\tgo to state 852\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 814\r\n\r\n    conversion_operator_declarator  ->  EXPLICIT OPERATOR type '(' type IDENTIFIER . ')'   (rule 432)\r\n\r\n    ')' \tshift, and go to state 853\r\n\r\n\r\n\r\nstate 815\r\n\r\n    conversion_operator_declarator  ->  IMPLICIT OPERATOR type '(' type IDENTIFIER . ')'   (rule 431)\r\n\r\n    ')' \tshift, and go to state 854\r\n\r\n\r\n\r\nstate 816\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER . ')'   (rule 407)\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER . COMMA type IDENTIFIER ')'   (rule 408)\r\n\r\n    COMMA\tshift, and go to state 855\r\n    ')' \tshift, and go to state 856\r\n\r\n\r\n\r\nstate 817\r\n\r\n    property_declaration  ->  attributes_opt modifiers_opt type qualified_identifier ENTER_getset '{' accessor_declarations '}' . EXIT_getset   (rule 383)\r\n\r\n    $default\treduce using rule 536 (EXIT_getset)\r\n\r\n    EXIT_getset\tgo to state 857\r\n\r\n\r\n\r\nstate 818\r\n\r\n    get_accessor_declaration  ->  attributes_opt GET EXIT_getset . accessor_body ENTER_getset   (rule 390)\r\n\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 858\r\n\r\n    block\tgo to state 859\r\n    accessor_body\tgo to state 860\r\n\r\n\r\n\r\nstate 819\r\n\r\n    set_accessor_declaration  ->  attributes_opt SET EXIT_getset . accessor_body ENTER_getset   (rule 391)\r\n\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 858\r\n\r\n    block\tgo to state 859\r\n    accessor_body\tgo to state 861\r\n\r\n\r\n\r\nstate 820\r\n\r\n    indexer_declaration  ->  attributes_opt modifiers_opt indexer_declarator ENTER_getset '{' accessor_declarations '}' EXIT_getset .   (rule 400)\r\n\r\n    $default\treduce using rule 400 (indexer_declaration)\r\n\r\n\r\n\r\nstate 821\r\n\r\n    do_statement  ->  DO embedded_statement WHILE '(' boolean_expression ')' . ';'   (rule 241)\r\n\r\n    ';' \tshift, and go to state 862\r\n\r\n\r\n\r\nstate 822\r\n\r\n    fixed_pointer_declarator  ->  IDENTIFIER '=' expression .   (rule 290)\r\n\r\n    $default\treduce using rule 290 (fixed_pointer_declarator)\r\n\r\n\r\n\r\nstate 823\r\n\r\n    fixed_pointer_declarators  ->  fixed_pointer_declarators COMMA fixed_pointer_declarator .   (rule 289)\r\n\r\n    $default\treduce using rule 289 (fixed_pointer_declarators)\r\n\r\n\r\n\r\nstate 824\r\n\r\n    fixed_statement  ->  FIXED '(' type fixed_pointer_declarators ')' embedded_statement .   (rule 287)\r\n\r\n    $default\treduce using rule 287 (fixed_statement)\r\n\r\n\r\n\r\nstate 825\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt ';' for_condition_opt ';' . for_iterator_opt ')' embedded_statement   (rule 242)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 247 (for_iterator_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement_expression\tgo to state 676\r\n    for_iterator_opt\tgo to state 863\r\n    for_iterator\tgo to state 864\r\n    statement_expression_list\tgo to state 865\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 826\r\n\r\n    foreach_statement  ->  FOREACH '(' type IDENTIFIER IN expression . ')' embedded_statement   (rule 255)\r\n\r\n    ')' \tshift, and go to state 866\r\n\r\n\r\n\r\nstate 827\r\n\r\n    if_statement  ->  IF '(' boolean_expression ')' embedded_statement ELSE . embedded_statement   (rule 223)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 867\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 828\r\n\r\n    switch_label  ->  CASE . constant_expression ':'   (rule 233)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 611\r\n    constant_expression\tgo to state 868\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 829\r\n\r\n    switch_label  ->  DEFAULT . ':'   (rule 234)\r\n\r\n    ':' \tshift, and go to state 869\r\n\r\n\r\n\r\nstate 830\r\n\r\n    switch_block  ->  '{' switch_sections_opt . '}'   (rule 225)\r\n\r\n    '}' \tshift, and go to state 870\r\n\r\n\r\n\r\nstate 831\r\n\r\n    switch_sections_opt  ->  switch_sections .   (rule 227)\r\n    switch_sections  ->  switch_sections . switch_section   (rule 229)\r\n\r\n    CASE\tshift, and go to state 828\r\n    DEFAULT\tshift, and go to state 829\r\n\r\n    $default\treduce using rule 227 (switch_sections_opt)\r\n\r\n    switch_section\tgo to state 871\r\n    switch_labels\tgo to state 833\r\n    switch_label\tgo to state 834\r\n\r\n\r\n\r\nstate 832\r\n\r\n    switch_sections  ->  switch_section .   (rule 228)\r\n\r\n    $default\treduce using rule 228 (switch_sections)\r\n\r\n\r\n\r\nstate 833\r\n\r\n    switch_section  ->  switch_labels . statement_list   (rule 230)\r\n    switch_labels  ->  switch_labels . switch_label   (rule 232)\r\n\r\n    IDENTIFIER\tshift, and go to state 450\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CASE\tshift, and go to state 828\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONST\tshift, and go to state 453\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DEFAULT\tshift, and go to state 829\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    VOID\tshift, and go to state 288\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement\tgo to state 482\r\n    embedded_statement\tgo to state 483\r\n    block\tgo to state 484\r\n    statement_list\tgo to state 872\r\n    empty_statement\tgo to state 487\r\n    labeled_statement\tgo to state 488\r\n    declaration_statement\tgo to state 489\r\n    local_variable_declaration\tgo to state 490\r\n    local_constant_declaration\tgo to state 491\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    switch_label\tgo to state 873\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 834\r\n\r\n    switch_labels  ->  switch_label .   (rule 231)\r\n\r\n    $default\treduce using rule 231 (switch_labels)\r\n\r\n\r\n\r\nstate 835\r\n\r\n    identifier_opt  ->  IDENTIFIER .   (rule 279)\r\n\r\n    $default\treduce using rule 279 (identifier_opt)\r\n\r\n\r\n\r\nstate 836\r\n\r\n    catch_clause  ->  CATCH '(' type_name identifier_opt . ')' block   (rule 276)\r\n\r\n    ')' \tshift, and go to state 874\r\n\r\n\r\n\r\nstate 837\r\n\r\n    catch_clause  ->  CATCH '(' class_type identifier_opt . ')' block   (rule 275)\r\n\r\n    ')' \tshift, and go to state 875\r\n\r\n\r\n\r\nstate 838\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt VOID IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body .   (rule 482)\r\n\r\n    $default\treduce using rule 482 (interface_method_declaration)\r\n\r\n\r\n\r\nstate 839\r\n\r\n    interface_method_declaration  ->  attributes_opt new_opt type IDENTIFIER '(' formal_parameter_list_opt ')' interface_empty_body .   (rule 481)\r\n\r\n    $default\treduce using rule 481 (interface_method_declaration)\r\n\r\n\r\n\r\nstate 840\r\n\r\n    interface_accessors  ->  attributes_opt GET . interface_empty_body   (rule 487)\r\n    interface_accessors  ->  attributes_opt GET . interface_empty_body attributes_opt SET interface_empty_body   (rule 489)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 876\r\n\r\n\r\n\r\nstate 841\r\n\r\n    interface_accessors  ->  attributes_opt SET . interface_empty_body   (rule 488)\r\n    interface_accessors  ->  attributes_opt SET . interface_empty_body attributes_opt GET interface_empty_body   (rule 490)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 877\r\n\r\n\r\n\r\nstate 842\r\n\r\n    interface_property_declaration  ->  attributes_opt new_opt type IDENTIFIER ENTER_getset '{' interface_accessors '}' . EXIT_getset   (rule 485)\r\n\r\n    $default\treduce using rule 536 (EXIT_getset)\r\n\r\n    EXIT_getset\tgo to state 878\r\n\r\n\r\n\r\nstate 843\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset . '{' interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    '{' \tshift, and go to state 879\r\n\r\n\r\n\r\nstate 844\r\n\r\n    constructor_initializer  ->  ':' BASE '(' . argument_list_opt ')'   (rule 437)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    OUT \tshift, and go to state 404\r\n    REF \tshift, and go to state 405\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 70 (argument_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    argument_list\tgo to state 406\r\n    argument\tgo to state 407\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    argument_list_opt\tgo to state 880\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 409\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 845\r\n\r\n    constructor_initializer  ->  ':' THIS '(' . argument_list_opt ')'   (rule 438)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 168\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    OUT \tshift, and go to state 404\r\n    REF \tshift, and go to state 405\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    THIS\tshift, and go to state 173\r\n    TRUE\tshift, and go to state 174\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 176\r\n    USHORT\tshift, and go to state 92\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n\r\n    $default\treduce using rule 70 (argument_list_opt)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    argument_list\tgo to state 406\r\n    argument\tgo to state 407\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 194\r\n    argument_list_opt\tgo to state 881\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 200\r\n    post_decrement_expression\tgo to state 201\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 203\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 213\r\n    pre_decrement_expression\tgo to state 214\r\n    unary_expression\tgo to state 215\r\n    cast_expression\tgo to state 216\r\n    multiplicative_expression\tgo to state 217\r\n    additive_expression\tgo to state 218\r\n    shift_expression\tgo to state 219\r\n    relational_expression\tgo to state 220\r\n    equality_expression\tgo to state 221\r\n    and_expression\tgo to state 222\r\n    exclusive_or_expression\tgo to state 223\r\n    inclusive_or_expression\tgo to state 224\r\n    conditional_and_expression\tgo to state 225\r\n    conditional_or_expression\tgo to state 226\r\n    conditional_expression\tgo to state 227\r\n    assignment\tgo to state 228\r\n    expression\tgo to state 409\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 846\r\n\r\n    add_accessor_declaration  ->  attributes_opt ADD . EXIT_accessor_decl block ENTER_accessor_decl   (rule 398)\r\n\r\n    $default\treduce using rule 534 (EXIT_accessor_decl)\r\n\r\n    EXIT_accessor_decl\tgo to state 882\r\n\r\n\r\n\r\nstate 847\r\n\r\n    remove_accessor_declaration  ->  attributes_opt REMOVE . EXIT_accessor_decl block ENTER_accessor_decl   (rule 399)\r\n\r\n    $default\treduce using rule 534 (EXIT_accessor_decl)\r\n\r\n    EXIT_accessor_decl\tgo to state 883\r\n\r\n\r\n\r\nstate 848\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' . EXIT_accessor_decl   (rule 395)\r\n\r\n    $default\treduce using rule 534 (EXIT_accessor_decl)\r\n\r\n    EXIT_accessor_decl\tgo to state 884\r\n\r\n\r\n\r\nstate 849\r\n\r\n    remove_accessor_declaration  ->  attributes_opt . REMOVE EXIT_accessor_decl block ENTER_accessor_decl   (rule 399)\r\n\r\n    REMOVE\tshift, and go to state 847\r\n\r\n\r\n\r\nstate 850\r\n\r\n    event_accessor_declarations  ->  add_accessor_declaration remove_accessor_declaration .   (rule 396)\r\n\r\n    $default\treduce using rule 396 (event_accessor_declarations)\r\n\r\n\r\n\r\nstate 851\r\n\r\n    add_accessor_declaration  ->  attributes_opt . ADD EXIT_accessor_decl block ENTER_accessor_decl   (rule 398)\r\n\r\n    ADD \tshift, and go to state 846\r\n\r\n\r\n\r\nstate 852\r\n\r\n    event_accessor_declarations  ->  remove_accessor_declaration add_accessor_declaration .   (rule 397)\r\n\r\n    $default\treduce using rule 397 (event_accessor_declarations)\r\n\r\n\r\n\r\nstate 853\r\n\r\n    conversion_operator_declarator  ->  EXPLICIT OPERATOR type '(' type IDENTIFIER ')' .   (rule 432)\r\n\r\n    $default\treduce using rule 432 (conversion_operator_declarator)\r\n\r\n\r\n\r\nstate 854\r\n\r\n    conversion_operator_declarator  ->  IMPLICIT OPERATOR type '(' type IDENTIFIER ')' .   (rule 431)\r\n\r\n    $default\treduce using rule 431 (conversion_operator_declarator)\r\n\r\n\r\n\r\nstate 855\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER COMMA . type IDENTIFIER ')'   (rule 408)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    BOOL\tshift, and go to state 78\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    DECIMAL\tshift, and go to state 81\r\n    DOUBLE\tshift, and go to state 82\r\n    FLOAT\tshift, and go to state 83\r\n    INT \tshift, and go to state 84\r\n    LONG\tshift, and go to state 85\r\n    OBJECT\tshift, and go to state 86\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    STRING\tshift, and go to state 89\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    USHORT\tshift, and go to state 92\r\n    VOID\tshift, and go to state 288\r\n\r\n    type_name\tgo to state 94\r\n    type\tgo to state 885\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 98\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 102\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    qualified_identifier\tgo to state 105\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 856\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER ')' .   (rule 407)\r\n\r\n    $default\treduce using rule 407 (overloadable_operator_declarator)\r\n\r\n\r\n\r\nstate 857\r\n\r\n    property_declaration  ->  attributes_opt modifiers_opt type qualified_identifier ENTER_getset '{' accessor_declarations '}' EXIT_getset .   (rule 383)\r\n\r\n    $default\treduce using rule 383 (property_declaration)\r\n\r\n\r\n\r\nstate 858\r\n\r\n    accessor_body  ->  ';' .   (rule 393)\r\n\r\n    $default\treduce using rule 393 (accessor_body)\r\n\r\n\r\n\r\nstate 859\r\n\r\n    accessor_body  ->  block .   (rule 392)\r\n\r\n    $default\treduce using rule 392 (accessor_body)\r\n\r\n\r\n\r\nstate 860\r\n\r\n    get_accessor_declaration  ->  attributes_opt GET EXIT_getset accessor_body . ENTER_getset   (rule 390)\r\n\r\n    $default\treduce using rule 535 (ENTER_getset)\r\n\r\n    ENTER_getset\tgo to state 886\r\n\r\n\r\n\r\nstate 861\r\n\r\n    set_accessor_declaration  ->  attributes_opt SET EXIT_getset accessor_body . ENTER_getset   (rule 391)\r\n\r\n    $default\treduce using rule 535 (ENTER_getset)\r\n\r\n    ENTER_getset\tgo to state 887\r\n\r\n\r\n\r\nstate 862\r\n\r\n    do_statement  ->  DO embedded_statement WHILE '(' boolean_expression ')' ';' .   (rule 241)\r\n\r\n    $default\treduce using rule 241 (do_statement)\r\n\r\n\r\n\r\nstate 863\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt ';' for_condition_opt ';' for_iterator_opt . ')' embedded_statement   (rule 242)\r\n\r\n    ')' \tshift, and go to state 888\r\n\r\n\r\n\r\nstate 864\r\n\r\n    for_iterator_opt  ->  for_iterator .   (rule 248)\r\n\r\n    $default\treduce using rule 248 (for_iterator_opt)\r\n\r\n\r\n\r\nstate 865\r\n\r\n    for_iterator  ->  statement_expression_list .   (rule 252)\r\n    statement_expression_list  ->  statement_expression_list . COMMA statement_expression   (rule 254)\r\n\r\n    COMMA\tshift, and go to state 736\r\n\r\n    $default\treduce using rule 252 (for_iterator)\r\n\r\n\r\n\r\nstate 866\r\n\r\n    foreach_statement  ->  FOREACH '(' type IDENTIFIER IN expression ')' . embedded_statement   (rule 255)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 889\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 867\r\n\r\n    if_statement  ->  IF '(' boolean_expression ')' embedded_statement ELSE embedded_statement .   (rule 223)\r\n\r\n    $default\treduce using rule 223 (if_statement)\r\n\r\n\r\n\r\nstate 868\r\n\r\n    switch_label  ->  CASE constant_expression . ':'   (rule 233)\r\n\r\n    ':' \tshift, and go to state 890\r\n\r\n\r\n\r\nstate 869\r\n\r\n    switch_label  ->  DEFAULT ':' .   (rule 234)\r\n\r\n    $default\treduce using rule 234 (switch_label)\r\n\r\n\r\n\r\nstate 870\r\n\r\n    switch_block  ->  '{' switch_sections_opt '}' .   (rule 225)\r\n\r\n    $default\treduce using rule 225 (switch_block)\r\n\r\n\r\n\r\nstate 871\r\n\r\n    switch_sections  ->  switch_sections switch_section .   (rule 229)\r\n\r\n    $default\treduce using rule 229 (switch_sections)\r\n\r\n\r\n\r\nstate 872\r\n\r\n    statement_list  ->  statement_list . statement   (rule 194)\r\n    switch_section  ->  switch_labels statement_list .   (rule 230)\r\n\r\n    IDENTIFIER\tshift, and go to state 450\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONST\tshift, and go to state 453\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    VOID\tshift, and go to state 288\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    $default\treduce using rule 230 (switch_section)\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    type_name\tgo to state 94\r\n    type\tgo to state 471\r\n    non_array_type\tgo to state 96\r\n    simple_type\tgo to state 97\r\n    primitive_type\tgo to state 472\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 473\r\n    pointer_type\tgo to state 103\r\n    array_type\tgo to state 104\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    statement\tgo to state 605\r\n    embedded_statement\tgo to state 483\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    labeled_statement\tgo to state 488\r\n    declaration_statement\tgo to state 489\r\n    local_variable_declaration\tgo to state 490\r\n    local_constant_declaration\tgo to state 491\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 515\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 873\r\n\r\n    switch_labels  ->  switch_labels switch_label .   (rule 232)\r\n\r\n    $default\treduce using rule 232 (switch_labels)\r\n\r\n\r\n\r\nstate 874\r\n\r\n    catch_clause  ->  CATCH '(' type_name identifier_opt ')' . block   (rule 276)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 891\r\n\r\n\r\n\r\nstate 875\r\n\r\n    catch_clause  ->  CATCH '(' class_type identifier_opt ')' . block   (rule 275)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 892\r\n\r\n\r\n\r\nstate 876\r\n\r\n    interface_accessors  ->  attributes_opt GET interface_empty_body .   (rule 487)\r\n    interface_accessors  ->  attributes_opt GET interface_empty_body . attributes_opt SET interface_empty_body   (rule 489)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 487 (interface_accessors)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 893\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 877\r\n\r\n    interface_accessors  ->  attributes_opt SET interface_empty_body .   (rule 488)\r\n    interface_accessors  ->  attributes_opt SET interface_empty_body . attributes_opt GET interface_empty_body   (rule 490)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    '}' \treduce using rule 488 (interface_accessors)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 894\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 878\r\n\r\n    interface_property_declaration  ->  attributes_opt new_opt type IDENTIFIER ENTER_getset '{' interface_accessors '}' EXIT_getset .   (rule 485)\r\n\r\n    $default\treduce using rule 485 (interface_property_declaration)\r\n\r\n\r\n\r\nstate 879\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' . interface_accessors '}' EXIT_getset   (rule 486)\r\n\r\n    LEFT_BRACKET\treduce using rule 531 (ENTER_attrib)\r\n    $default\treduce using rule 295 (attributes_opt)\r\n\r\n    attributes_opt\tgo to state 804\r\n    interface_accessors\tgo to state 895\r\n    attributes\tgo to state 21\r\n    attribute_sections\tgo to state 22\r\n    attribute_section\tgo to state 23\r\n    ENTER_attrib\tgo to state 24\r\n\r\n\r\n\r\nstate 880\r\n\r\n    constructor_initializer  ->  ':' BASE '(' argument_list_opt . ')'   (rule 437)\r\n\r\n    ')' \tshift, and go to state 896\r\n\r\n\r\n\r\nstate 881\r\n\r\n    constructor_initializer  ->  ':' THIS '(' argument_list_opt . ')'   (rule 438)\r\n\r\n    ')' \tshift, and go to state 897\r\n\r\n\r\n\r\nstate 882\r\n\r\n    add_accessor_declaration  ->  attributes_opt ADD EXIT_accessor_decl . block ENTER_accessor_decl   (rule 398)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 898\r\n\r\n\r\n\r\nstate 883\r\n\r\n    remove_accessor_declaration  ->  attributes_opt REMOVE EXIT_accessor_decl . block ENTER_accessor_decl   (rule 399)\r\n\r\n    '{' \tshift, and go to state 359\r\n\r\n    block\tgo to state 899\r\n\r\n\r\n\r\nstate 884\r\n\r\n    event_declaration  ->  attributes_opt modifiers_opt EVENT type qualified_identifier ENTER_accessor_decl '{' event_accessor_declarations '}' EXIT_accessor_decl .   (rule 395)\r\n\r\n    $default\treduce using rule 395 (event_declaration)\r\n\r\n\r\n\r\nstate 885\r\n\r\n    pointer_type  ->  type . '*'   (rule 36)\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER COMMA type . IDENTIFIER ')'   (rule 408)\r\n\r\n    IDENTIFIER\tshift, and go to state 900\r\n    '*' \tshift, and go to state 123\r\n\r\n\r\n\r\nstate 886\r\n\r\n    get_accessor_declaration  ->  attributes_opt GET EXIT_getset accessor_body ENTER_getset .   (rule 390)\r\n\r\n    $default\treduce using rule 390 (get_accessor_declaration)\r\n\r\n\r\n\r\nstate 887\r\n\r\n    set_accessor_declaration  ->  attributes_opt SET EXIT_getset accessor_body ENTER_getset .   (rule 391)\r\n\r\n    $default\treduce using rule 391 (set_accessor_declaration)\r\n\r\n\r\n\r\nstate 888\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt ';' for_condition_opt ';' for_iterator_opt ')' . embedded_statement   (rule 242)\r\n\r\n    IDENTIFIER\tshift, and go to state 52\r\n    INTEGER_LITERAL\tshift, and go to state 163\r\n    REAL_LITERAL\tshift, and go to state 164\r\n    CHARACTER_LITERAL\tshift, and go to state 165\r\n    STRING_LITERAL\tshift, and go to state 166\r\n    BASE\tshift, and go to state 167\r\n    BOOL\tshift, and go to state 78\r\n    BREAK\tshift, and go to state 451\r\n    BYTE\tshift, and go to state 79\r\n    CHAR\tshift, and go to state 80\r\n    CHECKED\tshift, and go to state 452\r\n    CONTINUE\tshift, and go to state 454\r\n    DECIMAL\tshift, and go to state 81\r\n    DO  \tshift, and go to state 455\r\n    DOUBLE\tshift, and go to state 82\r\n    FALSE\tshift, and go to state 169\r\n    FIXED\tshift, and go to state 456\r\n    FLOAT\tshift, and go to state 83\r\n    FOR \tshift, and go to state 457\r\n    FOREACH\tshift, and go to state 458\r\n    GOTO\tshift, and go to state 459\r\n    IF  \tshift, and go to state 460\r\n    INT \tshift, and go to state 84\r\n    LOCK\tshift, and go to state 461\r\n    LONG\tshift, and go to state 85\r\n    NEW \tshift, and go to state 170\r\n    NULL_LITERAL\tshift, and go to state 171\r\n    OBJECT\tshift, and go to state 86\r\n    RETURN\tshift, and go to state 462\r\n    SBYTE\tshift, and go to state 87\r\n    SHORT\tshift, and go to state 88\r\n    SIZEOF\tshift, and go to state 172\r\n    STRING\tshift, and go to state 89\r\n    SWITCH\tshift, and go to state 463\r\n    THIS\tshift, and go to state 173\r\n    THROW\tshift, and go to state 464\r\n    TRUE\tshift, and go to state 174\r\n    TRY \tshift, and go to state 465\r\n    TYPEOF\tshift, and go to state 175\r\n    UINT\tshift, and go to state 90\r\n    ULONG\tshift, and go to state 91\r\n    UNCHECKED\tshift, and go to state 466\r\n    UNSAFE\tshift, and go to state 467\r\n    USHORT\tshift, and go to state 92\r\n    USING\tshift, and go to state 468\r\n    WHILE\tshift, and go to state 469\r\n    PLUSPLUS\tshift, and go to state 177\r\n    MINUSMINUS\tshift, and go to state 178\r\n    '*' \tshift, and go to state 179\r\n    '(' \tshift, and go to state 180\r\n    '&' \tshift, and go to state 181\r\n    '!' \tshift, and go to state 182\r\n    '~' \tshift, and go to state 183\r\n    '+' \tshift, and go to state 184\r\n    '-' \tshift, and go to state 185\r\n    '{' \tshift, and go to state 359\r\n    ';' \tshift, and go to state 470\r\n\r\n    literal\tgo to state 186\r\n    boolean_literal\tgo to state 187\r\n    primitive_type\tgo to state 188\r\n    numeric_type\tgo to state 99\r\n    integral_type\tgo to state 100\r\n    floating_point_type\tgo to state 101\r\n    class_type\tgo to state 189\r\n    primary_expression\tgo to state 190\r\n    primary_expression_no_parenthesis\tgo to state 191\r\n    parenthesized_expression\tgo to state 192\r\n    member_access\tgo to state 193\r\n    invocation_expression\tgo to state 474\r\n    element_access\tgo to state 195\r\n    this_access\tgo to state 198\r\n    base_access\tgo to state 199\r\n    post_increment_expression\tgo to state 475\r\n    post_decrement_expression\tgo to state 476\r\n    new_expression\tgo to state 202\r\n    object_creation_expression\tgo to state 477\r\n    array_creation_expression\tgo to state 204\r\n    typeof_expression\tgo to state 205\r\n    checked_expression\tgo to state 206\r\n    unchecked_expression\tgo to state 207\r\n    pointer_member_access\tgo to state 208\r\n    addressof_expression\tgo to state 209\r\n    sizeof_expression\tgo to state 210\r\n    postfix_expression\tgo to state 211\r\n    unary_expression_not_plusminus\tgo to state 212\r\n    pre_increment_expression\tgo to state 478\r\n    pre_decrement_expression\tgo to state 479\r\n    unary_expression\tgo to state 480\r\n    cast_expression\tgo to state 216\r\n    assignment\tgo to state 481\r\n    embedded_statement\tgo to state 901\r\n    block\tgo to state 484\r\n    empty_statement\tgo to state 487\r\n    expression_statement\tgo to state 492\r\n    statement_expression\tgo to state 493\r\n    selection_statement\tgo to state 494\r\n    if_statement\tgo to state 495\r\n    switch_statement\tgo to state 496\r\n    iteration_statement\tgo to state 497\r\n    unsafe_statement\tgo to state 498\r\n    while_statement\tgo to state 499\r\n    do_statement\tgo to state 500\r\n    for_statement\tgo to state 501\r\n    foreach_statement\tgo to state 502\r\n    jump_statement\tgo to state 503\r\n    break_statement\tgo to state 504\r\n    continue_statement\tgo to state 505\r\n    goto_statement\tgo to state 506\r\n    return_statement\tgo to state 507\r\n    throw_statement\tgo to state 508\r\n    try_statement\tgo to state 509\r\n    checked_statement\tgo to state 510\r\n    unchecked_statement\tgo to state 511\r\n    lock_statement\tgo to state 512\r\n    using_statement\tgo to state 513\r\n    fixed_statement\tgo to state 514\r\n    qualified_identifier\tgo to state 230\r\n    qualifier\tgo to state 10\r\n\r\n\r\n\r\nstate 889\r\n\r\n    foreach_statement  ->  FOREACH '(' type IDENTIFIER IN expression ')' embedded_statement .   (rule 255)\r\n\r\n    $default\treduce using rule 255 (foreach_statement)\r\n\r\n\r\n\r\nstate 890\r\n\r\n    switch_label  ->  CASE constant_expression ':' .   (rule 233)\r\n\r\n    $default\treduce using rule 233 (switch_label)\r\n\r\n\r\n\r\nstate 891\r\n\r\n    catch_clause  ->  CATCH '(' type_name identifier_opt ')' block .   (rule 276)\r\n\r\n    $default\treduce using rule 276 (catch_clause)\r\n\r\n\r\n\r\nstate 892\r\n\r\n    catch_clause  ->  CATCH '(' class_type identifier_opt ')' block .   (rule 275)\r\n\r\n    $default\treduce using rule 275 (catch_clause)\r\n\r\n\r\n\r\nstate 893\r\n\r\n    interface_accessors  ->  attributes_opt GET interface_empty_body attributes_opt . SET interface_empty_body   (rule 489)\r\n\r\n    SET \tshift, and go to state 902\r\n\r\n\r\n\r\nstate 894\r\n\r\n    interface_accessors  ->  attributes_opt SET interface_empty_body attributes_opt . GET interface_empty_body   (rule 490)\r\n\r\n    GET \tshift, and go to state 903\r\n\r\n\r\n\r\nstate 895\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors . '}' EXIT_getset   (rule 486)\r\n\r\n    '}' \tshift, and go to state 904\r\n\r\n\r\n\r\nstate 896\r\n\r\n    constructor_initializer  ->  ':' BASE '(' argument_list_opt ')' .   (rule 437)\r\n\r\n    $default\treduce using rule 437 (constructor_initializer)\r\n\r\n\r\n\r\nstate 897\r\n\r\n    constructor_initializer  ->  ':' THIS '(' argument_list_opt ')' .   (rule 438)\r\n\r\n    $default\treduce using rule 438 (constructor_initializer)\r\n\r\n\r\n\r\nstate 898\r\n\r\n    add_accessor_declaration  ->  attributes_opt ADD EXIT_accessor_decl block . ENTER_accessor_decl   (rule 398)\r\n\r\n    $default\treduce using rule 533 (ENTER_accessor_decl)\r\n\r\n    ENTER_accessor_decl\tgo to state 905\r\n\r\n\r\n\r\nstate 899\r\n\r\n    remove_accessor_declaration  ->  attributes_opt REMOVE EXIT_accessor_decl block . ENTER_accessor_decl   (rule 399)\r\n\r\n    $default\treduce using rule 533 (ENTER_accessor_decl)\r\n\r\n    ENTER_accessor_decl\tgo to state 906\r\n\r\n\r\n\r\nstate 900\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER COMMA type IDENTIFIER . ')'   (rule 408)\r\n\r\n    ')' \tshift, and go to state 907\r\n\r\n\r\n\r\nstate 901\r\n\r\n    for_statement  ->  FOR '(' for_initializer_opt ';' for_condition_opt ';' for_iterator_opt ')' embedded_statement .   (rule 242)\r\n\r\n    $default\treduce using rule 242 (for_statement)\r\n\r\n\r\n\r\nstate 902\r\n\r\n    interface_accessors  ->  attributes_opt GET interface_empty_body attributes_opt SET . interface_empty_body   (rule 489)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 908\r\n\r\n\r\n\r\nstate 903\r\n\r\n    interface_accessors  ->  attributes_opt SET interface_empty_body attributes_opt GET . interface_empty_body   (rule 490)\r\n\r\n    '{' \tshift, and go to state 749\r\n    ';' \tshift, and go to state 750\r\n\r\n    interface_empty_body\tgo to state 909\r\n\r\n\r\n\r\nstate 904\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' . EXIT_getset   (rule 486)\r\n\r\n    $default\treduce using rule 536 (EXIT_getset)\r\n\r\n    EXIT_getset\tgo to state 910\r\n\r\n\r\n\r\nstate 905\r\n\r\n    add_accessor_declaration  ->  attributes_opt ADD EXIT_accessor_decl block ENTER_accessor_decl .   (rule 398)\r\n\r\n    $default\treduce using rule 398 (add_accessor_declaration)\r\n\r\n\r\n\r\nstate 906\r\n\r\n    remove_accessor_declaration  ->  attributes_opt REMOVE EXIT_accessor_decl block ENTER_accessor_decl .   (rule 399)\r\n\r\n    $default\treduce using rule 399 (remove_accessor_declaration)\r\n\r\n\r\n\r\nstate 907\r\n\r\n    overloadable_operator_declarator  ->  type OPERATOR overloadable_operator '(' type IDENTIFIER COMMA type IDENTIFIER ')' .   (rule 408)\r\n\r\n    $default\treduce using rule 408 (overloadable_operator_declarator)\r\n\r\n\r\n\r\nstate 908\r\n\r\n    interface_accessors  ->  attributes_opt GET interface_empty_body attributes_opt SET interface_empty_body .   (rule 489)\r\n\r\n    $default\treduce using rule 489 (interface_accessors)\r\n\r\n\r\n\r\nstate 909\r\n\r\n    interface_accessors  ->  attributes_opt SET interface_empty_body attributes_opt GET interface_empty_body .   (rule 490)\r\n\r\n    $default\treduce using rule 490 (interface_accessors)\r\n\r\n\r\n\r\nstate 910\r\n\r\n    interface_indexer_declaration  ->  attributes_opt new_opt type THIS LEFT_BRACKET formal_parameter_list RIGHT_BRACKET ENTER_getset '{' interface_accessors '}' EXIT_getset .   (rule 486)\r\n\r\n    $default\treduce using rule 486 (interface_indexer_declaration)\r\n\r\n\r\n\r\nstate 911\r\n\r\n    $   \tgo to state 912\r\n\r\n\r\n\r\nstate 912\r\n\r\n    $   \tgo to state 913\r\n\r\n\r\n\r\nstate 913\r\n\r\n    $default\taccept\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/dirent.c",
    "content": "/*\r\n\r\n    Implementation of POSIX directory browsing functions and types for Win32.\r\n\r\n    Author:  Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)\r\n    History: Created March 1997. Updated June 2003 and July 2012.\r\n    Rights:  See end of file.\r\n\r\n*/\r\n\r\n#include <dirent.h>\r\n#include <errno.h>\r\n#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\ntypedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */\r\n\r\nstruct DIR\r\n{\r\n    handle_type         handle; /* -1 for failed rewind */\r\n    struct _finddata_t  info;\r\n    struct dirent       result; /* d_name null iff first time */\r\n    char                *name;  /* null-terminated char string */\r\n};\r\n\r\nDIR *opendir(const char *name)\r\n{\r\n    DIR *dir = 0;\r\n\r\n    if(name && name[0])\r\n    {\r\n        size_t base_length = strlen(name);\r\n        const char *all = /* search pattern must end with suitable wildcard */\r\n            strchr(\"/\\\\\", name[base_length - 1]) ? \"*\" : \"/*\";\r\n\r\n        if((dir = (DIR *) malloc(sizeof *dir)) != 0 &&\r\n           (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0)\r\n        {\r\n            strcat(strcpy(dir->name, name), all);\r\n\r\n            if((dir->handle =\r\n                (handle_type) _findfirst(dir->name, &dir->info)) != -1)\r\n            {\r\n                dir->result.d_name = 0;\r\n            }\r\n            else /* rollback */\r\n            {\r\n                free(dir->name);\r\n                free(dir);\r\n                dir = 0;\r\n            }\r\n        }\r\n        else /* rollback */\r\n        {\r\n            free(dir);\r\n            dir   = 0;\r\n            errno = ENOMEM;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        errno = EINVAL;\r\n    }\r\n\r\n    return dir;\r\n}\r\n\r\nint closedir(DIR *dir)\r\n{\r\n    int result = -1;\r\n\r\n    if(dir)\r\n    {\r\n        if(dir->handle != -1)\r\n        {\r\n            result = _findclose(dir->handle);\r\n        }\r\n\r\n        free(dir->name);\r\n        free(dir);\r\n    }\r\n\r\n    if(result == -1) /* map all errors to EBADF */\r\n    {\r\n        errno = EBADF;\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nstruct dirent *readdir(DIR *dir)\r\n{\r\n    struct dirent *result = 0;\r\n\r\n    if(dir && dir->handle != -1)\r\n    {\r\n        if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)\r\n        {\r\n            result         = &dir->result;\r\n            result->d_name = dir->info.name;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        errno = EBADF;\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nvoid rewinddir(DIR *dir)\r\n{\r\n    if(dir && dir->handle != -1)\r\n    {\r\n        _findclose(dir->handle);\r\n        dir->handle = (handle_type) _findfirst(dir->name, &dir->info);\r\n        dir->result.d_name = 0;\r\n    }\r\n    else\r\n    {\r\n        errno = EBADF;\r\n    }\r\n}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n/*\r\n\r\n    Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.\r\n\r\n    Permission to use, copy, modify, and distribute this software and its\r\n    documentation for any purpose is hereby granted without fee, provided\r\n    that this copyright and permissions notice appear in all copies and\r\n    derivatives.\r\n    \r\n    This software is supplied \"as is\" without express or implied warranty.\r\n\r\n    But that said, if there are any problems please get in touch.\r\n\r\n*/\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/dirent.h",
    "content": "#ifndef DIRENT_INCLUDED\r\n#define DIRENT_INCLUDED\r\n\r\n/*\r\n\r\n    Declaration of POSIX directory browsing functions and types for Win32.\r\n\r\n    Author:  Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)\r\n    History: Created March 1997. Updated June 2003.\r\n    Rights:  See end of file.\r\n    \r\n*/\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\ntypedef struct DIR DIR;\r\n\r\nstruct dirent\r\n{\r\n    char *d_name;\r\n};\r\n\r\nDIR           *opendir(const char *);\r\nint           closedir(DIR *);\r\nstruct dirent *readdir(DIR *);\r\nvoid          rewinddir(DIR *);\r\n\r\n/*\r\n\r\n    Copyright Kevlin Henney, 1997, 2003. All rights reserved.\r\n\r\n    Permission to use, copy, modify, and distribute this software and its\r\n    documentation for any purpose is hereby granted without fee, provided\r\n    that this copyright and permissions notice appear in all copies and\r\n    derivatives.\r\n    \r\n    This software is supplied \"as is\" without express or implied warranty.\r\n\r\n    But that said, if there are any problems please get in touch.\r\n\r\n*/\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/include.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef INCLUDE_H\r\n#define INCLUDE_H\r\n\r\n#include \"AbstractContainer.h\"\r\n#include \"Attribute.h\"\r\n#include \"compilerLibrary.h\"\r\n#include \"Expression.h\"\r\n#include \"NameSpace.h\"\r\n#include \"Statement.h\"\r\n#include \"Symbol.h\"\r\n#include \"TypeObject.h\"\r\n#include \"Variable.h\"\r\n\r\n#endif\t//INCLUDE_H\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/lex.yy.h",
    "content": "/***\r\n *** C# parser/scanner\r\n *** Copyright 2002 James Power, NUI Maynooth, Ireland <james.power@may.ie>\r\n *** This version: 19 Feb 2002\r\n ***\r\n* Redistribution and use in source and binary forms, with or without\r\n* modification, are permitted provided that the following conditions are met:\r\n*     * Redistributions of source code must retain the above copyright\r\n*       notice, this list of conditions and the following disclaimer.\r\n*     * Redistributions in binary form must reproduce the above copyright\r\n*       notice, this list of conditions and the following disclaimer in the\r\n*       documentation and/or other materials provided with the distribution.\r\n*     * Neither the name of the <organization> nor the\r\n*       names of its contributors may be used to endorse or promote products\r\n*       derived from this software without specific prior written permission.\r\n*\r\n* THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY\r\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY\r\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \r\n***/\r\n\r\nvoid lex_enter_attrib(void);\r\nvoid lex_exit_attrib(void); \r\nvoid lex_enter_accessor(void);\r\nvoid lex_exit_accessor(void);\r\nvoid lex_enter_getset(void);\r\nvoid lex_exit_getset(void);\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/lexParser.inc",
    "content": "#line 2 \"lexParser.inc\"\r\n/* A lexical scanner generated by flex */\r\n\r\n/* Scanner skeleton version:\r\n * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $\r\n */\r\n\r\n#define FLEX_SCANNER\r\n#define YY_FLEX_MAJOR_VERSION 2\r\n#define YY_FLEX_MINOR_VERSION 5\r\n\r\n#include <stdio.h>\r\n\r\n\r\n/* cfront 1.2 defines \"c_plusplus\" instead of \"__cplusplus\" */\r\n#ifdef c_plusplus\r\n#ifndef __cplusplus\r\n#define __cplusplus\r\n#endif\r\n#endif\r\n\r\n\r\n#ifdef __cplusplus\r\n\r\n#include <stdlib.h>\r\n#include <unistd.h>\r\n\r\n/* Use prototypes in function declarations. */\r\n#define YY_USE_PROTOS\r\n\r\n/* The \"const\" storage-class-modifier is valid. */\r\n#define YY_USE_CONST\r\n\r\n#else\t/* ! __cplusplus */\r\n\r\n#if __STDC__\r\n\r\n#define YY_USE_PROTOS\r\n#define YY_USE_CONST\r\n\r\n#endif\t/* __STDC__ */\r\n#endif\t/* ! __cplusplus */\r\n\r\n#ifdef __TURBOC__\r\n #pragma warn -rch\r\n #pragma warn -use\r\n#include <io.h>\r\n#include <stdlib.h>\r\n#define YY_USE_CONST\r\n#define YY_USE_PROTOS\r\n#endif\r\n\r\n#ifdef YY_USE_CONST\r\n#define yyconst const\r\n#else\r\n#define yyconst\r\n#endif\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\n#define YY_PROTO(proto) proto\r\n#else\r\n#define YY_PROTO(proto) ()\r\n#endif\r\n\r\n/* Returned upon end-of-file. */\r\n#define YY_NULL 0\r\n\r\n/* Promotes a possibly negative, possibly signed char to an unsigned\r\n * integer for use as an array index.  If the signed char is negative,\r\n * we want to instead treat it as an 8-bit unsigned char, hence the\r\n * double cast.\r\n */\r\n#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)\r\n\r\n/* Enter a start condition.  This macro really ought to take a parameter,\r\n * but we do it the disgusting crufty way forced on us by the ()-less\r\n * definition of BEGIN.\r\n */\r\n#define BEGIN yy_start = 1 + 2 *\r\n\r\n/* Translate the current start state into a value that can be later handed\r\n * to BEGIN to return to the state.  The YYSTATE alias is for lex\r\n * compatibility.\r\n */\r\n#define YY_START ((yy_start - 1) / 2)\r\n#define YYSTATE YY_START\r\n\r\n/* Action number for EOF rule of a given start state. */\r\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\r\n\r\n/* Special action meaning \"start processing a new file\". */\r\n#define YY_NEW_FILE yyrestart( yyin )\r\n\r\n#define YY_END_OF_BUFFER_CHAR 0\r\n\r\n/* Size of default input buffer. */\r\n#define YY_BUF_SIZE 16384\r\n\r\ntypedef struct yy_buffer_state *YY_BUFFER_STATE;\r\n\r\nextern int yyleng;\r\nextern FILE *yyin, *yyout;\r\n\r\n#define EOB_ACT_CONTINUE_SCAN 0\r\n#define EOB_ACT_END_OF_FILE 1\r\n#define EOB_ACT_LAST_MATCH 2\r\n\r\n/* The funky do-while in the following #define is used to turn the definition\r\n * int a single C statement (which needs a semi-colon terminator).  This\r\n * avoids problems with code like:\r\n *\r\n * \tif ( condition_holds )\r\n *\t\tyyless( 5 );\r\n *\telse\r\n *\t\tdo_something_else();\r\n *\r\n * Prior to using the do-while the compiler would get upset at the\r\n * \"else\" because it interpreted the \"if\" statement as being all\r\n * done when it reached the ';' after the yyless() call.\r\n */\r\n\r\n/* Return all but the first 'n' matched characters back to the input stream. */\r\n\r\n#define yyless(n) \\\r\n\tdo \\\r\n\t\t{ \\\r\n\t\t/* Undo effects of setting up yytext. */ \\\r\n\t\t*yy_cp = yy_hold_char; \\\r\n\t\tyy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \\\r\n\t\tYY_DO_BEFORE_ACTION; /* set up yytext again */ \\\r\n\t\t} \\\r\n\twhile ( 0 )\r\n\r\n#define unput(c) yyunput( c, yytext_ptr )\r\n\r\n/* The following is because we cannot portably get our hands on size_t\r\n * (without autoconf's help, which isn't available because we want\r\n * flex-generated scanners to compile on their own).\r\n */\r\ntypedef unsigned int yy_size_t;\r\n\r\n\r\nstruct yy_buffer_state\r\n\t{\r\n\tFILE *yy_input_file;\r\n\r\n\tchar *yy_ch_buf;\t\t/* input buffer */\r\n\tchar *yy_buf_pos;\t\t/* current position in input buffer */\r\n\r\n\t/* Size of input buffer in bytes, not including room for EOB\r\n\t * characters.\r\n\t */\r\n\tyy_size_t yy_buf_size;\r\n\r\n\t/* Number of characters read into yy_ch_buf, not including EOB\r\n\t * characters.\r\n\t */\r\n\tint yy_n_chars;\r\n\r\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\r\n\t * and can realloc() it to grow it, and should free() it to\r\n\t * delete it.\r\n\t */\r\n\tint yy_is_our_buffer;\r\n\r\n\t/* Whether this is an \"interactive\" input source; if so, and\r\n\t * if we're using stdio for input, then we want to use getc()\r\n\t * instead of fread(), to make sure we stop fetching input after\r\n\t * each newline.\r\n\t */\r\n\tint yy_is_interactive;\r\n\r\n\t/* Whether we're considered to be at the beginning of a line.\r\n\t * If so, '^' rules will be active on the next match, otherwise\r\n\t * not.\r\n\t */\r\n\tint yy_at_bol;\r\n\r\n\t/* Whether to try to fill the input buffer when we reach the\r\n\t * end of it.\r\n\t */\r\n\tint yy_fill_buffer;\r\n\r\n\tint yy_buffer_status;\r\n#define YY_BUFFER_NEW 0\r\n#define YY_BUFFER_NORMAL 1\r\n\t/* When an EOF's been seen but there's still some text to process\r\n\t * then we mark the buffer as YY_EOF_PENDING, to indicate that we\r\n\t * shouldn't try reading from the input source any more.  We might\r\n\t * still have a bunch of tokens to match, though, because of\r\n\t * possible backing-up.\r\n\t *\r\n\t * When we actually see the EOF, we change the status to \"new\"\r\n\t * (via yyrestart()), so that the user can continue scanning by\r\n\t * just pointing yyin at a new input file.\r\n\t */\r\n#define YY_BUFFER_EOF_PENDING 2\r\n\t};\r\n\r\nstatic YY_BUFFER_STATE yy_current_buffer = 0;\r\n\r\n/* We provide macros for accessing buffer states in case in the\r\n * future we want to put the buffer states in a more general\r\n * \"scanner state\".\r\n */\r\n#define YY_CURRENT_BUFFER yy_current_buffer\r\n\r\n\r\n/* yy_hold_char holds the character lost when yytext is formed. */\r\nstatic char yy_hold_char;\r\n\r\nstatic int yy_n_chars;\t\t/* number of characters read into yy_ch_buf */\r\n\r\n\r\nint yyleng;\r\n\r\n/* Points to current character in buffer. */\r\nstatic char *yy_c_buf_p = (char *) 0;\r\nstatic int yy_init = 1;\t\t/* whether we need to initialize */\r\nstatic int yy_start = 0;\t/* start state number */\r\n\r\n/* Flag which is used to allow yywrap()'s to do buffer switches\r\n * instead of setting up a fresh yyin.  A bit of a hack ...\r\n */\r\nstatic int yy_did_buffer_switch_on_eof;\r\n\r\nvoid yyrestart YY_PROTO(( FILE *input_file ));\r\n\r\nvoid yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));\r\nvoid yy_load_buffer_state YY_PROTO(( void ));\r\nYY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));\r\nvoid yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));\r\nvoid yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));\r\nvoid yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));\r\n#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )\r\n\r\nYY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));\r\nYY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));\r\nYY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));\r\n\r\nstatic void *yy_flex_alloc YY_PROTO(( yy_size_t ));\r\nstatic void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));\r\nstatic void yy_flex_free YY_PROTO(( void * ));\r\n\r\n#define yy_new_buffer yy_create_buffer\r\n\r\n#define yy_set_interactive(is_interactive) \\\r\n\t{ \\\r\n\tif ( ! yy_current_buffer ) \\\r\n\t\tyy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \\\r\n\tyy_current_buffer->yy_is_interactive = is_interactive; \\\r\n\t}\r\n\r\n#define yy_set_bol(at_bol) \\\r\n\t{ \\\r\n\tif ( ! yy_current_buffer ) \\\r\n\t\tyy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \\\r\n\tyy_current_buffer->yy_at_bol = at_bol; \\\r\n\t}\r\n\r\n#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)\r\n\r\n\r\n#define YY_USES_REJECT\r\n\r\n#define yywrap() 1\r\n#define YY_SKIP_YYWRAP\r\ntypedef unsigned char YY_CHAR;\r\nFILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;\r\ntypedef int yy_state_type;\r\nextern int yylineno;\r\nint yylineno = 1;\r\nextern char *yytext;\r\n#define yytext_ptr yytext\r\n\r\nstatic yy_state_type yy_get_previous_state YY_PROTO(( void ));\r\nstatic yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));\r\nstatic int yy_get_next_buffer YY_PROTO(( void ));\r\nstatic void yy_fatal_error YY_PROTO(( yyconst char msg[] ));\r\n\r\n/* Done after the current pattern has been matched and before the\r\n * corresponding action - sets up yytext.\r\n */\r\n#define YY_DO_BEFORE_ACTION \\\r\n\tyytext_ptr = yy_bp; \\\r\n\tyyleng = (int) (yy_cp - yy_bp); \\\r\n\tyy_hold_char = *yy_cp; \\\r\n\t*yy_cp = '\\0'; \\\r\n\tyy_c_buf_p = yy_cp;\r\n\r\n#define YY_NUM_RULES 51\r\n#define YY_END_OF_BUFFER 52\r\nstatic yyconst short int yy_acclist[203] =\r\n    {   0,\r\n       52,   50,   51,    2,   50,   51,    2,   51,   50,   51,\r\n       50,   51,   50,   51,   50,   51,   50,   51,   50,   51,\r\n       50,   51,   13,   50,   51,   50,   51,   50,   51,   50,\r\n       51,    8,   50,   51,    8,   50,   51,   50,   51,   50,\r\n       51,   12,   50,   51,   50,   51,   14,   50,   51,   15,\r\n       50,   51,   50,   51,   48,   50,   51,   50,   51,    2,\r\n       50,   51,    1,   50,   51,    4,   51,    5,   51,    4,\r\n       51,   51,   48,   50,   51,   48,   50,   51,   48,   50,\r\n       51,   48,   50,   51,   48,   50,   51,   48,   50,   51,\r\n       48,   50,   51,   48,   50,   51,   48,   50,   51,   29,\r\n\r\n       11,   21,   32,   23,   19,   34,   17,   35,   18,   36,\r\n        9,    3,    7,   20,    8,    9,    8,    8,   25,   30,\r\n       28,   31,   49,   16,   22,   48,   24,   33,    1,    1,\r\n        6,   48,   48,   48,   48,   48,   48,   48,   48,   48,\r\n       48,   48,   10,    9,    7,    9,    8,    8,   27,   26,\r\n       11,   49,   48,   48,   48,   48,   48,   48,   48,   44,\r\n       48,   48,   46,   48,   47,   48,    9,    8,    8,   48,\r\n       48,   48,   48,   48,   48,   43,   48,   48,    8,   48,\r\n       38,   48,   48,   48,   41,   48,   48,   48,   48,   39,\r\n       48,   40,   48,   48,   45,   48,   48,   48,   37,   48,\r\n\r\n       42,   48\r\n    } ;\r\n\r\nstatic yyconst short int yy_accept[193] =\r\n    {   0,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    2,    4,    7,    9,   11,   13,   15,\r\n       17,   19,   21,   23,   26,   28,   30,   32,   35,   38,\r\n       40,   42,   45,   47,   50,   53,   55,   58,   60,   63,\r\n       66,   68,   70,   72,   73,   76,   79,   82,   85,   88,\r\n       91,   94,   97,  100,  101,  101,  102,  102,  103,  104,\r\n      105,  105,  105,  106,  107,  108,  109,  110,  111,  112,\r\n      113,  114,  115,  115,  116,  117,  117,  118,  119,  119,\r\n      120,  121,  122,  123,  123,  123,  124,  124,  124,  125,\r\n      126,  127,  128,  129,  129,  130,  131,  132,  133,  134,\r\n\r\n      135,  136,  137,  138,  139,  140,  141,  142,  143,  143,\r\n      143,  144,  144,  144,  145,  145,  146,  146,  147,  148,\r\n      149,  150,  151,  151,  152,  153,  153,  154,  155,  156,\r\n      157,  158,  159,  160,  162,  163,  165,  167,  167,  167,\r\n      167,  167,  167,  168,  169,  170,  171,  172,  173,  174,\r\n      175,  176,  178,  179,  179,  179,  179,  179,  180,  181,\r\n      183,  184,  185,  187,  188,  189,  189,  189,  189,  189,\r\n      190,  192,  194,  195,  197,  197,  197,  197,  197,  198,\r\n      199,  199,  199,  201,  203,  203,  203,  203,  203,  203,\r\n      203,  203\r\n\r\n    } ;\r\n\r\nstatic yyconst int yy_ec[256] =\r\n    {   0,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,\r\n        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    2,    5,    6,    7,    1,    8,    9,   10,    1,\r\n        1,   11,   12,   13,   14,   15,   16,   17,   18,   18,\r\n       18,   18,   18,   18,   18,   18,   18,    1,    1,   19,\r\n       20,   21,    1,   22,   28,   29,   30,   31,   32,   33,\r\n       34,   35,   36,   37,   37,   38,   39,   40,   41,   42,\r\n       37,   43,   44,   45,   46,   47,   37,   48,   49,   37,\r\n       23,   24,   25,   26,   27,    1,   28,   29,   30,   31,\r\n\r\n       32,   33,   34,   35,   36,   37,   37,   38,   39,   40,\r\n       41,   42,   37,   43,   44,   45,   46,   47,   37,   48,\r\n       49,   37,    1,   50,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1\r\n    } ;\r\n\r\nstatic yyconst int yy_meta[51] =\r\n    {   0,\r\n        1,    1,    2,    1,    1,    3,    1,    1,    1,    4,\r\n        1,    1,    1,    1,    1,    1,    5,    6,    1,    1,\r\n        1,    7,    1,    8,    1,    1,    9,   10,   10,   11,\r\n       11,   11,   10,    9,    9,    9,    9,    9,    9,   12,\r\n        9,    9,   12,    9,   12,   12,   12,   12,    9,    1\r\n    } ;\r\n\r\nstatic yyconst short int yy_base[222] =\r\n    {   0,\r\n        0,   49,   49,   50,    0,    0,   26,   55,   27,   56,\r\n       30,   70,  293,  583,  583,  583,  272,   61,  271,   60,\r\n      258,  261,   61,  583,   72,   58,   71,  100,  232,   59,\r\n      259,   69,  272,   99,  583,  257,    0,   46,  103,    0,\r\n      583,  583,  260,  583,  231,  238,   66,   78,  216,  233,\r\n      231,  230,  229,  583,   89,  583,   63,  583,  583,  583,\r\n      250,   74,  583,  583,  583,  583,  583,  583,  110,  583,\r\n        0,  583,  108,  211,  583,  133,  212,  219,    0,  228,\r\n      583,  583,  583,  227,  240,    0,  150,  153,  583,  583,\r\n        0,  583,  583,  127,    0,    0,  583,  201,  212,  198,\r\n\r\n      211,  198,  199,  189,  199,  190,  183,  182,    0,    0,\r\n      583,    0,    0,  583,  147,    0,  118,  150,  583,   70,\r\n      583,  583,  220,  219,    0,  167,  192,  185,  179,  167,\r\n      184,  168,  177,    0,  167,    0,    0,    0,  187,    0,\r\n      197,  155,  167,  157,  164,  162,  168,  156,  158,  156,\r\n      162,    0,  144,    0,  204,    0,  180,  583,  159,    0,\r\n      156,  154,    0,  139,  147,    0,  221,    0,  167,  138,\r\n        0,    0,  129,    0,  238,  113,  152,  150,   95,   81,\r\n      255,    0,    0,    0,  272,    0,  289,    0,  134,  113,\r\n      583,  322,  334,  346,  358,  368,  376,  388,  398,  408,\r\n\r\n      420,  428,  439,  447,  455,  462,  469,  476,  483,  490,\r\n      498,  505,  512,  520,  527,  534,  542,  550,  557,  564,\r\n      571\r\n    } ;\r\n\r\nstatic yyconst short int yy_def[222] =\r\n    {   0,\r\n      191,    1,  192,  192,  193,  193,    1,    1,    1,    1,\r\n        1,    1,  191,  191,  191,  191,  191,  194,  191,  191,\r\n      195,  191,  191,  191,  191,  191,  191,  191,   28,  191,\r\n      191,  191,  196,  191,  191,  191,  197,  191,  191,  198,\r\n      191,  191,  191,  191,  197,  197,  197,  197,  197,  197,\r\n      197,  197,  197,  191,  194,  191,  199,  191,  191,  191,\r\n      191,  200,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      201,  191,  191,   28,  191,  191,  191,  191,  202,  191,\r\n      191,  191,  191,  191,  203,  204,  191,  191,  191,  191,\r\n      197,  191,  191,  191,  198,  198,  191,  197,  197,  197,\r\n\r\n      197,  197,  197,  197,  197,  197,  197,  197,  205,  206,\r\n      191,  207,  208,  191,  191,  201,  191,  191,  191,  202,\r\n      191,  191,  203,  191,  204,  191,  197,  197,  197,  197,\r\n      197,  197,  197,  197,  197,  197,  197,  209,  194,  210,\r\n      211,  191,  191,  191,  191,  197,  197,  197,  197,  197,\r\n      197,  197,  197,  212,  139,  213,  214,  191,  197,  197,\r\n      197,  197,  197,  197,  197,  215,  139,  216,  217,  197,\r\n      197,  197,  197,  197,  139,  194,  218,  191,  197,  197,\r\n      139,  219,  197,  197,  139,  220,  139,  221,  194,  191,\r\n        0,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191\r\n    } ;\r\n\r\nstatic yyconst short int yy_nxt[634] =\r\n    {   0,\r\n       14,   15,   16,   15,   17,   18,   14,   19,   20,   21,\r\n       22,   23,   24,   25,   26,   27,   28,   29,   30,   31,\r\n       32,   33,   34,   14,   35,   36,   37,   37,   37,   37,\r\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\r\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   38,\r\n       39,   42,   42,   45,   50,   40,   39,   39,   46,   43,\r\n       43,   40,   40,   52,   47,   92,   56,   48,   59,   51,\r\n       49,   39,   64,   53,   69,   69,   40,   80,   81,   60,\r\n       65,   70,   45,   50,   57,   66,   71,   46,   83,   84,\r\n       72,   67,   68,   47,   56,   93,   48,  100,   51,   49,\r\n\r\n       87,   87,   87,   52,   94,  102,  101,  144,  109,   95,\r\n      110,   88,   57,   53,   73,  145,   74,   74,   56,  112,\r\n      103,  113,  111,   89,   69,   69,   69,   69,   94,  184,\r\n       75,   76,   75,   95,  118,  118,   57,   77,   75,   56,\r\n      114,  115,  114,  183,  117,   78,  117,   79,  114,  118,\r\n      118,   87,   87,   87,  126,  126,  126,   57,  142,  111,\r\n      142,  111,   88,  143,  143,   88,  118,  118,  126,  126,\r\n      126,  143,  143,  180,   89,  179,  111,   89,  174,   88,\r\n       75,  173,   75,  143,  143,  172,  171,  170,   75,  111,\r\n      165,   89,   56,  164,  163,  162,  161,  114,  160,  114,\r\n\r\n      159,  158,  158,  155,  155,  114,  111,  153,  152,  151,\r\n       57,  150,  149,  148,  155,  155,  155,  155,  155,  155,\r\n      167,  167,  147,  146,  123,  124,  137,  136,  135,  134,\r\n      133,  167,  167,  167,  167,  167,  167,  176,  176,  132,\r\n      131,  130,  129,  128,  127,  124,  122,  121,  176,  176,\r\n      176,  176,  176,  176,  181,  181,  119,  119,  191,  111,\r\n      108,  107,  106,  105,  104,  181,  181,  181,  181,  181,\r\n      181,  185,  185,   99,   98,   97,   90,   85,   82,  191,\r\n       63,   62,  185,  185,  185,  185,  185,  185,  187,  187,\r\n       58,   54,  191,  191,  191,  191,  191,  191,  191,  187,\r\n\r\n      187,  187,  187,  187,  187,  189,  189,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  189,  189,  189,  189,\r\n      189,  189,   41,   41,   41,   41,   41,   41,   41,   41,\r\n       41,   41,   41,   41,   44,   44,   44,   44,   44,   44,\r\n       44,   44,   44,   44,   44,   44,   55,   55,   55,   55,\r\n       55,   55,   55,   55,   55,   55,   55,   55,   61,   61,\r\n       61,  191,   61,   61,   61,   61,   61,   61,   61,   61,\r\n       86,  191,  191,  191,  191,  191,   86,   86,   86,   86,\r\n       91,   91,   91,  191,   91,   91,   91,   91,   96,  191,\r\n       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,\r\n\r\n       55,   55,   55,  191,  191,   55,  191,   55,  191,   55,\r\n       61,   61,   61,  191,  191,   61,  191,   61,  191,   61,\r\n      116,  191,  116,  116,  116,  116,  116,  116,  116,  116,\r\n      116,  116,  120,  120,  191,  191,  191,  120,  120,  123,\r\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\r\n      123,  125,  125,  125,  191,  125,  125,  125,  125,  138,\r\n      138,  191,  191,  191,  138,  138,  139,  139,  191,  191,\r\n      191,  139,  139,  140,  140,  191,  191,  191,  140,  140,\r\n      141,  141,  191,  191,  191,  141,  141,  154,  154,  191,\r\n      191,  191,  154,  154,  156,  156,  191,  191,  191,  156,\r\n\r\n      156,  157,  157,  157,  191,  191,  191,  157,  157,  166,\r\n      166,  191,  191,  191,  166,  166,  168,  168,  191,  191,\r\n      191,  168,  168,  169,  169,  169,  191,  191,  191,  169,\r\n      169,  175,  175,  191,  191,  191,  175,  175,  177,  177,\r\n      191,  191,  191,  177,  177,  178,  178,  178,  191,  191,\r\n      191,  178,  178,  182,  182,  182,  191,  191,  191,  182,\r\n      182,  186,  186,  191,  191,  191,  186,  186,  188,  188,\r\n      191,  191,  191,  188,  188,  190,  190,  191,  191,  191,\r\n      190,  190,   13,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191\r\n    } ;\r\n\r\nstatic yyconst short int yy_chk[634] =\r\n    {   0,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r\n        2,    3,    4,    7,    9,    2,    8,   10,    7,    3,\r\n        4,    8,   10,   11,    7,   38,   18,    7,   20,    9,\r\n        7,   12,   23,   11,   26,   26,   12,   30,   30,   20,\r\n       23,   27,    8,   10,   18,   25,   27,    8,   32,   32,\r\n       27,   25,   25,    8,   55,   38,    8,   47,   10,    8,\r\n\r\n       34,   34,   34,   12,   39,   48,   47,  120,   57,   39,\r\n       57,   34,   55,   12,   28,  120,   28,   28,  176,   62,\r\n       48,   62,  190,   34,   73,   73,   69,   69,   94,  180,\r\n       28,   28,   28,   94,  117,  117,  176,   28,   28,  189,\r\n       69,   69,   69,  179,   76,   28,   76,   28,   69,   76,\r\n       76,   87,   87,   87,   88,   88,   88,  189,  115,  178,\r\n      115,  177,   87,  115,  115,   88,  118,  118,  126,  126,\r\n      126,  142,  142,  173,   87,  170,  169,   88,  165,  126,\r\n      118,  164,  118,  143,  143,  162,  161,  159,  118,  157,\r\n      153,  126,  139,  151,  150,  149,  148,  143,  147,  143,\r\n\r\n      146,  145,  144,  139,  139,  143,  141,  135,  133,  132,\r\n      139,  131,  130,  129,  139,  139,  139,  139,  139,  139,\r\n      155,  155,  128,  127,  124,  123,  108,  107,  106,  105,\r\n      104,  155,  155,  155,  155,  155,  155,  167,  167,  103,\r\n      102,  101,  100,   99,   98,   85,   84,   80,  167,  167,\r\n      167,  167,  167,  167,  175,  175,   78,   77,   74,   61,\r\n       53,   52,   51,   50,   49,  175,  175,  175,  175,  175,\r\n      175,  181,  181,   46,   45,   43,   36,   33,   31,   29,\r\n       22,   21,  181,  181,  181,  181,  181,  181,  185,  185,\r\n       19,   17,   13,    0,    0,    0,    0,    0,    0,  185,\r\n\r\n      185,  185,  185,  185,  185,  187,  187,    0,    0,    0,\r\n        0,    0,    0,    0,    0,    0,  187,  187,  187,  187,\r\n      187,  187,  192,  192,  192,  192,  192,  192,  192,  192,\r\n      192,  192,  192,  192,  193,  193,  193,  193,  193,  193,\r\n      193,  193,  193,  193,  193,  193,  194,  194,  194,  194,\r\n      194,  194,  194,  194,  194,  194,  194,  194,  195,  195,\r\n      195,    0,  195,  195,  195,  195,  195,  195,  195,  195,\r\n      196,    0,    0,    0,    0,    0,  196,  196,  196,  196,\r\n      197,  197,  197,    0,  197,  197,  197,  197,  198,    0,\r\n      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,\r\n\r\n      199,  199,  199,    0,    0,  199,    0,  199,    0,  199,\r\n      200,  200,  200,    0,    0,  200,    0,  200,    0,  200,\r\n      201,    0,  201,  201,  201,  201,  201,  201,  201,  201,\r\n      201,  201,  202,  202,    0,    0,    0,  202,  202,  203,\r\n      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,\r\n      203,  204,  204,  204,    0,  204,  204,  204,  204,  205,\r\n      205,    0,    0,    0,  205,  205,  206,  206,    0,    0,\r\n        0,  206,  206,  207,  207,    0,    0,    0,  207,  207,\r\n      208,  208,    0,    0,    0,  208,  208,  209,  209,    0,\r\n        0,    0,  209,  209,  210,  210,    0,    0,    0,  210,\r\n\r\n      210,  211,  211,  211,    0,    0,    0,  211,  211,  212,\r\n      212,    0,    0,    0,  212,  212,  213,  213,    0,    0,\r\n        0,  213,  213,  214,  214,  214,    0,    0,    0,  214,\r\n      214,  215,  215,    0,    0,    0,  215,  215,  216,  216,\r\n        0,    0,    0,  216,  216,  217,  217,  217,    0,    0,\r\n        0,  217,  217,  218,  218,  218,    0,    0,    0,  218,\r\n      218,  219,  219,    0,    0,    0,  219,  219,  220,  220,\r\n        0,    0,    0,  220,  220,  221,  221,    0,    0,    0,\r\n      221,  221,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\r\n      191,  191,  191\r\n    } ;\r\n\r\nstatic yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;\r\nstatic char *yy_full_match;\r\nstatic int yy_lp;\r\n#define REJECT \\\r\n{ \\\r\n*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \\\r\nyy_cp = yy_full_match; /* restore poss. backed-over text */ \\\r\n++yy_lp; \\\r\ngoto find_rule; \\\r\n}\r\n#define yymore() yymore_used_but_not_detected\r\n#define YY_MORE_ADJ 0\r\nchar *yytext;\r\n#line 1 \"csharp.l\"\r\n#define INITIAL 0\r\n/*** \r\n *** C# parser/scanner\r\n *** Copyright 2002 James Power, NUI Maynooth, Ireland <james.power@may.ie>\r\n *** This version: 19 Feb 2002\r\n ***\r\n* Redistribution and use in source and binary forms, with or without\r\n* modification, are permitted provided that the following conditions are met:\r\n*     * Redistributions of source code must retain the above copyright\r\n*       notice, this list of conditions and the following disclaimer.\r\n*     * Redistributions in binary form must reproduce the above copyright\r\n*       notice, this list of conditions and the following disclaimer in the\r\n*       documentation and/or other materials provided with the distribution.\r\n*     * Neither the name of the <organization> nor the\r\n*       names of its contributors may be used to endorse or promote products\r\n*       derived from this software without specific prior written permission.\r\n*\r\n* THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY\r\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY\r\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ***/\r\n#line 29 \"csharp.l\"\r\n#include <string.h>\r\n// #include \"csharp.tab.h\"\r\n#include \"y.tab.h\"\r\n\r\n  void lexical_error(const char *);\r\n  static int token_for(const char *);\r\n  static int is_allowed_char(const char );\r\n  static SValue getValueInt(const char* text);\r\n  static SValue getValueReal(const char* text);\r\n  static SValue getValueChar(const char* text);\r\n  static SValue getValueString(const char* text);\r\n  static SValue getValueNull();\r\n  static int getRank(const char* text);\r\n#define YY_STACK_USED 1\r\n#define IN_COMMENT 1\r\n#define IN_GENERIC 2\r\n\r\n#define IN_ATTRIB 3\r\n#define IN_ACCESSOR 4\r\n#define IN_GETSET 5\r\n \r\n#line 659 \"lexParser.inc\"\r\n\r\n/* Macros after this point can all be overridden by user definitions in\r\n * section 1.\r\n */\r\n\r\n#ifndef YY_SKIP_YYWRAP\r\n#ifdef __cplusplus\r\nextern \"C\" int yywrap YY_PROTO(( void ));\r\n#else\r\nextern int yywrap YY_PROTO(( void ));\r\n#endif\r\n#endif\r\n\r\n#ifndef YY_NO_UNPUT\r\nstatic void yyunput YY_PROTO(( int c, char *buf_ptr ));\r\n#endif\r\n\r\n#ifndef yytext_ptr\r\nstatic void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));\r\n#endif\r\n\r\n#ifndef YY_NO_INPUT\r\n#ifdef __cplusplus\r\nstatic int yyinput YY_PROTO(( void ));\r\n#else\r\nstatic int input YY_PROTO(( void ));\r\n#endif\r\n#endif\r\n\r\n#if YY_STACK_USED\r\nstatic int yy_start_stack_ptr = 0;\r\nstatic int yy_start_stack_depth = 0;\r\nstatic int *yy_start_stack = 0;\r\n#ifndef YY_NO_PUSH_STATE\r\nstatic void yy_push_state YY_PROTO(( int new_state ));\r\n#endif\r\n#ifndef YY_NO_POP_STATE\r\nstatic void yy_pop_state YY_PROTO(( void ));\r\n#endif\r\n#ifndef YY_NO_TOP_STATE\r\nstatic int yy_top_state YY_PROTO(( void ));\r\n#endif\r\n\r\n#else\r\n#define YY_NO_PUSH_STATE 1\r\n#define YY_NO_POP_STATE 1\r\n#define YY_NO_TOP_STATE 1\r\n#endif\r\n\r\n#ifdef YY_MALLOC_DECL\r\nYY_MALLOC_DECL\r\n#else\r\n#if __STDC__\r\n#ifndef __cplusplus\r\n#include <stdlib.h>\r\n#endif\r\n#else\r\n/* Just try to get by without declaring the routines.  This will fail\r\n * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)\r\n * or sizeof(void*) != sizeof(int).\r\n */\r\n#endif\r\n#endif\r\n\r\n/* Amount of stuff to slurp up with each read. */\r\n#ifndef YY_READ_BUF_SIZE\r\n#define YY_READ_BUF_SIZE 8192\r\n#endif\r\n\r\n/* Copy whatever the last rule matched to the standard output. */\r\n\r\n#ifndef ECHO\r\n/* This used to be an fputs(), but since the string might contain NUL's,\r\n * we now use fwrite().\r\n */\r\n#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )\r\n#endif\r\n\r\n/* Gets input and stuffs it into \"buf\".  number of characters read, or YY_NULL,\r\n * is returned in \"result\".\r\n */\r\n#ifndef YY_INPUT\r\n#define YY_INPUT(buf,result,max_size) \\\r\n\tif ( yy_current_buffer->yy_is_interactive ) \\\r\n\t\t{ \\\r\n\t\tint c = '*', n; \\\r\n\t\tfor ( n = 0; n < max_size && \\\r\n\t\t\t     (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\\r\n\t\t\tbuf[n] = (char) c; \\\r\n\t\tif ( c == '\\n' ) \\\r\n\t\t\tbuf[n++] = (char) c; \\\r\n\t\tif ( c == EOF && ferror( yyin ) ) \\\r\n\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\\r\n\t\tresult = n; \\\r\n\t\t} \\\r\n\telse if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \\\r\n\t\t  && ferror( yyin ) ) \\\r\n\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" );\r\n#endif\r\n\r\n/* No semi-colon after return; correct usage is to write \"yyterminate();\" -\r\n * we don't want an extra ';' after the \"return\" because that will cause\r\n * some compilers to complain about unreachable statements.\r\n */\r\n#ifndef yyterminate\r\n#define yyterminate() return YY_NULL\r\n#endif\r\n\r\n/* Number of entries by which start-condition stack grows. */\r\n#ifndef YY_START_STACK_INCR\r\n#define YY_START_STACK_INCR 25\r\n#endif\r\n\r\n/* Report a fatal error. */\r\n#ifndef YY_FATAL_ERROR\r\n#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )\r\n#endif\r\n\r\n/* Default declaration of generated scanner - a define so the user can\r\n * easily add parameters.\r\n */\r\n#ifndef YY_DECL\r\n#define YY_DECL int yylex YY_PROTO(( void ))\r\n#endif\r\n\r\n/* Code executed at the beginning of each rule, after yytext and yyleng\r\n * have been set up.\r\n */\r\n#ifndef YY_USER_ACTION\r\n#define YY_USER_ACTION\r\n#endif\r\n\r\n/* Code executed at the end of each rule. */\r\n#ifndef YY_BREAK\r\n#define YY_BREAK break;\r\n#endif\r\n\r\n#define YY_RULE_SETUP \\\r\n\tif ( yyleng > 0 ) \\\r\n\t\tyy_current_buffer->yy_at_bol = \\\r\n\t\t\t\t(yytext[yyleng - 1] == '\\n'); \\\r\n\tYY_USER_ACTION\r\n\r\nYY_DECL\r\n\t{\r\n\tregister yy_state_type yy_current_state;\r\n\tregister char *yy_cp, *yy_bp;\r\n\tregister int yy_act;\r\n\r\n#line 102 \"csharp.l\"\r\n\r\n\r\n#line 812 \"lexParser.inc\"\r\n\r\n\tif ( yy_init )\r\n\t\t{\r\n\t\tyy_init = 0;\r\n\r\n#ifdef YY_USER_INIT\r\n\t\tYY_USER_INIT;\r\n#endif\r\n\r\n\t\tif ( ! yy_start )\r\n\t\t\tyy_start = 1;\t/* first start state */\r\n\r\n\t\tif ( ! yyin )\r\n\t\t\tyyin = stdin;\r\n\r\n\t\tif ( ! yyout )\r\n\t\t\tyyout = stdout;\r\n\r\n\t\tif ( ! yy_current_buffer )\r\n\t\t\tyy_current_buffer =\r\n\t\t\t\tyy_create_buffer( yyin, YY_BUF_SIZE );\r\n\r\n\t\tyy_load_buffer_state();\r\n\t\t}\r\n\r\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\r\n\t\t{\r\n\t\tyy_cp = yy_c_buf_p;\r\n\r\n\t\t/* Support of yytext. */\r\n\t\t*yy_cp = yy_hold_char;\r\n\r\n\t\t/* yy_bp points to the position in yy_ch_buf of the start of\r\n\t\t * the current run.\r\n\t\t */\r\n\t\tyy_bp = yy_cp;\r\n\r\n\t\tyy_current_state = yy_start;\r\n\t\tyy_current_state += YY_AT_BOL();\r\n\t\tyy_state_ptr = yy_state_buf;\r\n\t\t*yy_state_ptr++ = yy_current_state;\r\nyy_match:\r\n\t\tdo\r\n\t\t\t{\r\n\t\t\tregister YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];\r\n\t\t\twhile ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r\n\t\t\t\t{\r\n\t\t\t\tyy_current_state = (int) yy_def[yy_current_state];\r\n\t\t\t\tif ( yy_current_state >= 192 )\r\n\t\t\t\t\tyy_c = yy_meta[(unsigned int) yy_c];\r\n\t\t\t\t}\r\n\t\t\tyy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r\n\t\t\t*yy_state_ptr++ = yy_current_state;\r\n\t\t\t++yy_cp;\r\n\t\t\t}\r\n\t\twhile ( yy_base[yy_current_state] != 583 );\r\n\r\nyy_find_action:\r\n\t\tyy_current_state = *--yy_state_ptr;\r\n\t\tyy_lp = yy_accept[yy_current_state];\r\nfind_rule: /* we branch to this label when backing up */\r\n\t\tfor ( ; ; ) /* until we find what rule we matched */\r\n\t\t\t{\r\n\t\t\tif ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )\r\n\t\t\t\t{\r\n\t\t\t\tyy_act = yy_acclist[yy_lp];\r\n\t\t\t\t\t{\r\n\t\t\t\t\tyy_full_match = yy_cp;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t--yy_cp;\r\n\t\t\tyy_current_state = *--yy_state_ptr;\r\n\t\t\tyy_lp = yy_accept[yy_current_state];\r\n\t\t\t}\r\n\r\n\t\tYY_DO_BEFORE_ACTION;\r\n\r\n\t\tif ( yy_act != YY_END_OF_BUFFER )\r\n\t\t\t{\r\n\t\t\tint yyl;\r\n\t\t\tfor ( yyl = 0; yyl < yyleng; ++yyl )\r\n\t\t\t\tif ( yytext[yyl] == '\\n' )\r\n\t\t\t\t\t++yylineno;\r\n\t\t\t}\r\n\r\ndo_action:\t/* This label is used only to access EOF actions. */\r\n\r\n\r\n\t\tswitch ( yy_act )\r\n\t{ /* beginning of action switch */\r\ncase 1:\r\nYY_RULE_SETUP\r\n#line 104 \"csharp.l\"\r\n{ ; /* ignore */ }\r\n\tYY_BREAK\r\ncase 2:\r\nYY_RULE_SETUP\r\n#line 105 \"csharp.l\"\r\n{ ; /* ignore */ }\r\n\tYY_BREAK\r\ncase 3:\r\nYY_RULE_SETUP\r\n#line 107 \"csharp.l\"\r\n{ yy_push_state(IN_COMMENT); }\r\n\tYY_BREAK\r\ncase 4:\r\nYY_RULE_SETUP\r\n#line 108 \"csharp.l\"\r\n{ ; /* ignore */ }\r\n\tYY_BREAK\r\ncase 5:\r\nYY_RULE_SETUP\r\n#line 109 \"csharp.l\"\r\n{ ; /* ignore */ }\r\n\tYY_BREAK\r\ncase 6:\r\nYY_RULE_SETUP\r\n#line 110 \"csharp.l\"\r\n{ yy_pop_state();}\r\n\tYY_BREAK\r\ncase 7:\r\nYY_RULE_SETUP\r\n#line 112 \"csharp.l\"\r\n{ ; /* ignore */ }\r\n\tYY_BREAK\r\n/* yytext yylval.xxx */\r\ncase 8:\r\nYY_RULE_SETUP\r\n#line 115 \"csharp.l\"\r\n{ yylval.value = getValueInt(yytext);\t\treturn INTEGER_LITERAL; \t}\r\n\tYY_BREAK\r\ncase 9:\r\nYY_RULE_SETUP\r\n#line 116 \"csharp.l\"\r\n{ yylval.value = getValueReal(yytext);\treturn REAL_LITERAL; \t\t}\r\n\tYY_BREAK\r\ncase 10:\r\nYY_RULE_SETUP\r\n#line 117 \"csharp.l\"\r\n{ yylval.value = getValueChar(yytext);\treturn CHARACTER_LITERAL; \t}\r\n\tYY_BREAK\r\ncase 11:\r\nYY_RULE_SETUP\r\n#line 118 \"csharp.l\"\r\n{ yylval.value = getValueString(yytext);\treturn STRING_LITERAL; \t\t}\r\n\tYY_BREAK\r\ncase 12:\r\nYY_RULE_SETUP\r\n#line 120 \"csharp.l\"\r\n{ return GT;\t  }\r\n\tYY_BREAK\r\ncase 13:\r\nYY_RULE_SETUP\r\n#line 121 \"csharp.l\"\r\n{ return COMMA; }\r\n\tYY_BREAK\r\ncase 14:\r\nYY_RULE_SETUP\r\n#line 122 \"csharp.l\"\r\n{ return LEFT_BRACKET; }\r\n\tYY_BREAK\r\ncase 15:\r\nYY_RULE_SETUP\r\n#line 123 \"csharp.l\"\r\n{ return RIGHT_BRACKET; }\r\n\tYY_BREAK\r\ncase 16:\r\nYY_RULE_SETUP\r\n#line 125 \"csharp.l\"\r\n{ yylval.tmpValue = getRank(yytext); printf(\"Rank : %s\\n\",yytext);return RANK_SPECIFIER; }\r\n\tYY_BREAK\r\n/*** Multi-Character Operators ***/\r\ncase 17:\r\nYY_RULE_SETUP\r\n#line 128 \"csharp.l\"\r\n{ return PLUSEQ;\t}\r\n\tYY_BREAK\r\ncase 18:\r\nYY_RULE_SETUP\r\n#line 129 \"csharp.l\"\r\n{ return MINUSEQ;\t}\r\n\tYY_BREAK\r\ncase 19:\r\nYY_RULE_SETUP\r\n#line 130 \"csharp.l\"\r\n{ return STAREQ;\t}\r\n\tYY_BREAK\r\ncase 20:\r\nYY_RULE_SETUP\r\n#line 131 \"csharp.l\"\r\n{ return DIVEQ;\t}\r\n\tYY_BREAK\r\ncase 21:\r\nYY_RULE_SETUP\r\n#line 132 \"csharp.l\"\r\n{ return MODEQ;\t}\r\n\tYY_BREAK\r\ncase 22:\r\nYY_RULE_SETUP\r\n#line 133 \"csharp.l\"\r\n{ return XOREQ;\t}\r\n\tYY_BREAK\r\ncase 23:\r\nYY_RULE_SETUP\r\n#line 134 \"csharp.l\"\r\n{ return ANDEQ;\t}\r\n\tYY_BREAK\r\ncase 24:\r\nYY_RULE_SETUP\r\n#line 135 \"csharp.l\"\r\n{ return OREQ;\t}\r\n\tYY_BREAK\r\ncase 25:\r\nYY_RULE_SETUP\r\n#line 136 \"csharp.l\"\r\n{ return LTLT;\t}\r\n\tYY_BREAK\r\ncase 26:\r\nYY_RULE_SETUP\r\n#line 137 \"csharp.l\"\r\n{ return GTGTEQ;\t}\r\n\tYY_BREAK\r\ncase 27:\r\nYY_RULE_SETUP\r\n#line 138 \"csharp.l\"\r\n{ return LTLTEQ;\t}\r\n\tYY_BREAK\r\ncase 28:\r\nYY_RULE_SETUP\r\n#line 139 \"csharp.l\"\r\n{ return EQEQ;\t}\r\n\tYY_BREAK\r\ncase 29:\r\nYY_RULE_SETUP\r\n#line 140 \"csharp.l\"\r\n{ return NOTEQ;\t}\r\n\tYY_BREAK\r\ncase 30:\r\nYY_RULE_SETUP\r\n#line 141 \"csharp.l\"\r\n{ return LEQ;\t\t}\r\n\tYY_BREAK\r\ncase 31:\r\nYY_RULE_SETUP\r\n#line 142 \"csharp.l\"\r\n{ return GEQ;\t\t}\r\n\tYY_BREAK\r\ncase 32:\r\nYY_RULE_SETUP\r\n#line 143 \"csharp.l\"\r\n{ return ANDAND;\t}\r\n\tYY_BREAK\r\ncase 33:\r\nYY_RULE_SETUP\r\n#line 144 \"csharp.l\"\r\n{ return OROR;\t}\r\n\tYY_BREAK\r\ncase 34:\r\nYY_RULE_SETUP\r\n#line 145 \"csharp.l\"\r\n{ return PLUSPLUS;\t}\r\n\tYY_BREAK\r\ncase 35:\r\nYY_RULE_SETUP\r\n#line 146 \"csharp.l\"\r\n{ return MINUSMINUS;\t}\r\n\tYY_BREAK\r\ncase 36:\r\nYY_RULE_SETUP\r\n#line 147 \"csharp.l\"\r\n{ return ARROW;\t}\r\n\tYY_BREAK\r\n/*** Those context-sensitive \"keywords\" ***/\r\ncase 37:\r\nYY_RULE_SETUP\r\n#line 152 \"csharp.l\"\r\n{ return ASSEMBLY; }\r\n\tYY_BREAK\r\ncase 38:\r\nYY_RULE_SETUP\r\n#line 153 \"csharp.l\"\r\n{ return FIELD; }\r\n\tYY_BREAK\r\ncase 39:\r\nYY_RULE_SETUP\r\n#line 154 \"csharp.l\"\r\n{ return METHOD; }\r\n\tYY_BREAK\r\ncase 40:\r\nYY_RULE_SETUP\r\n#line 155 \"csharp.l\"\r\n{ return MODULE; }\r\n\tYY_BREAK\r\ncase 41:\r\nYY_RULE_SETUP\r\n#line 156 \"csharp.l\"\r\n{ return PARAM; }\r\n\tYY_BREAK\r\ncase 42:\r\nYY_RULE_SETUP\r\n#line 157 \"csharp.l\"\r\n{ return PROPERTY; }\r\n\tYY_BREAK\r\ncase 43:\r\nYY_RULE_SETUP\r\n#line 158 \"csharp.l\"\r\n{ return TYPE; }\r\n\tYY_BREAK\r\ncase 44:\r\nYY_RULE_SETUP\r\n#line 160 \"csharp.l\"\r\n{ return ADD; }\r\n\tYY_BREAK\r\ncase 45:\r\nYY_RULE_SETUP\r\n#line 161 \"csharp.l\"\r\n{ return REMOVE; }\r\n\tYY_BREAK\r\ncase 46:\r\nYY_RULE_SETUP\r\n#line 163 \"csharp.l\"\r\n{ return GET; }\r\n\tYY_BREAK\r\ncase 47:\r\nYY_RULE_SETUP\r\n#line 164 \"csharp.l\"\r\n{ return SET; }\r\n\tYY_BREAK\r\ncase 48:\r\nYY_RULE_SETUP\r\n#line 166 \"csharp.l\"\r\n{ return token_for(yytext); }\r\n\tYY_BREAK\r\ncase 49:\r\nYY_RULE_SETUP\r\n#line 167 \"csharp.l\"\r\n{ yylval.text = strdup(yytext); return IDENTIFIER; }\r\n\tYY_BREAK\r\ncase 50:\r\nYY_RULE_SETUP\r\n#line 170 \"csharp.l\"\r\n{ \r\n        if (is_allowed_char(yytext[0])) return yytext[0];\r\n        else lexical_error(\"invalid token\"); \r\n      }\r\n\tYY_BREAK\r\ncase 51:\r\nYY_RULE_SETUP\r\n#line 174 \"csharp.l\"\r\nECHO;\r\n\tYY_BREAK\r\n#line 1165 \"lexParser.inc\"\r\n\t\t\tcase YY_STATE_EOF(INITIAL):\r\n\t\t\tcase YY_STATE_EOF(IN_COMMENT):\r\n\t\t\tcase YY_STATE_EOF(IN_GENERIC):\r\n\t\t\tcase YY_STATE_EOF(IN_ATTRIB):\r\n\t\t\tcase YY_STATE_EOF(IN_ACCESSOR):\r\n\t\t\tcase YY_STATE_EOF(IN_GETSET):\r\n\t\t\t\tyyterminate();\r\n\r\n\tcase YY_END_OF_BUFFER:\r\n\t\t{\r\n\t\t/* Amount of text matched not including the EOB char. */\r\n\t\tint yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;\r\n\r\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\r\n\t\t*yy_cp = yy_hold_char;\r\n\r\n\t\tif ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )\r\n\t\t\t{\r\n\t\t\t/* We're scanning a new file or input source.  It's\r\n\t\t\t * possible that this happened because the user\r\n\t\t\t * just pointed yyin at a new source and called\r\n\t\t\t * yylex().  If so, then we have to assure\r\n\t\t\t * consistency between yy_current_buffer and our\r\n\t\t\t * globals.  Here is the right place to do so, because\r\n\t\t\t * this is the first action (other than possibly a\r\n\t\t\t * back-up) that will match for the new input source.\r\n\t\t\t */\r\n\t\t\tyy_n_chars = yy_current_buffer->yy_n_chars;\r\n\t\t\tyy_current_buffer->yy_input_file = yyin;\r\n\t\t\tyy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;\r\n\t\t\t}\r\n\r\n\t\t/* Note that here we test for yy_c_buf_p \"<=\" to the position\r\n\t\t * of the first EOB in the buffer, since yy_c_buf_p will\r\n\t\t * already have been incremented past the NUL character\r\n\t\t * (since all states make transitions on EOB to the\r\n\t\t * end-of-buffer state).  Contrast this with the test\r\n\t\t * in input().\r\n\t\t */\r\n\t\tif ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )\r\n\t\t\t{ /* This was really a NUL. */\r\n\t\t\tyy_state_type yy_next_state;\r\n\r\n\t\t\tyy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;\r\n\r\n\t\t\tyy_current_state = yy_get_previous_state();\r\n\r\n\t\t\t/* Okay, we're now positioned to make the NUL\r\n\t\t\t * transition.  We couldn't have\r\n\t\t\t * yy_get_previous_state() go ahead and do it\r\n\t\t\t * for us because it doesn't know how to deal\r\n\t\t\t * with the possibility of jamming (and we don't\r\n\t\t\t * want to build jamming into it because then it\r\n\t\t\t * will run more slowly).\r\n\t\t\t */\r\n\r\n\t\t\tyy_next_state = yy_try_NUL_trans( yy_current_state );\r\n\r\n\t\t\tyy_bp = yytext_ptr + YY_MORE_ADJ;\r\n\r\n\t\t\tif ( yy_next_state )\r\n\t\t\t\t{\r\n\t\t\t\t/* Consume the NUL. */\r\n\t\t\t\tyy_cp = ++yy_c_buf_p;\r\n\t\t\t\tyy_current_state = yy_next_state;\r\n\t\t\t\tgoto yy_match;\r\n\t\t\t\t}\r\n\r\n\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\tyy_cp = yy_c_buf_p;\r\n\t\t\t\tgoto yy_find_action;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\telse switch ( yy_get_next_buffer() )\r\n\t\t\t{\r\n\t\t\tcase EOB_ACT_END_OF_FILE:\r\n\t\t\t\t{\r\n\t\t\t\tyy_did_buffer_switch_on_eof = 0;\r\n\r\n\t\t\t\tif ( yywrap() )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t/* Note: because we've taken care in\r\n\t\t\t\t\t * yy_get_next_buffer() to have set up\r\n\t\t\t\t\t * yytext, we can now set up\r\n\t\t\t\t\t * yy_c_buf_p so that if some total\r\n\t\t\t\t\t * hoser (like flex itself) wants to\r\n\t\t\t\t\t * call the scanner after we return the\r\n\t\t\t\t\t * YY_NULL, it'll still work - another\r\n\t\t\t\t\t * YY_NULL will get returned.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tyy_c_buf_p = yytext_ptr + YY_MORE_ADJ;\r\n\r\n\t\t\t\t\tyy_act = YY_STATE_EOF(YY_START);\r\n\t\t\t\t\tgoto do_action;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\tif ( ! yy_did_buffer_switch_on_eof )\r\n\t\t\t\t\t\tYY_NEW_FILE;\r\n\t\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\r\n\t\t\t\tyy_c_buf_p =\r\n\t\t\t\t\tyytext_ptr + yy_amount_of_matched_text;\r\n\r\n\t\t\t\tyy_current_state = yy_get_previous_state();\r\n\r\n\t\t\t\tyy_cp = yy_c_buf_p;\r\n\t\t\t\tyy_bp = yytext_ptr + YY_MORE_ADJ;\r\n\t\t\t\tgoto yy_match;\r\n\r\n\t\t\tcase EOB_ACT_LAST_MATCH:\r\n\t\t\t\tyy_c_buf_p =\r\n\t\t\t\t&yy_current_buffer->yy_ch_buf[yy_n_chars];\r\n\r\n\t\t\t\tyy_current_state = yy_get_previous_state();\r\n\r\n\t\t\t\tyy_cp = yy_c_buf_p;\r\n\t\t\t\tyy_bp = yytext_ptr + YY_MORE_ADJ;\r\n\t\t\t\tgoto yy_find_action;\r\n\t\t\t}\r\n\t\tbreak;\r\n\t\t}\r\n\r\n\tdefault:\r\n\t\tYY_FATAL_ERROR(\r\n\t\t\t\"fatal flex scanner internal error--no action found\" );\r\n\t} /* end of action switch */\r\n\t\t} /* end of scanning one token */\r\n\t} /* end of yylex */\r\n\r\n\r\n/* yy_get_next_buffer - try to read in a new buffer\r\n *\r\n * Returns a code representing an action:\r\n *\tEOB_ACT_LAST_MATCH -\r\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\r\n *\tEOB_ACT_END_OF_FILE - end of file\r\n */\r\n\r\nstatic int yy_get_next_buffer()\r\n\t{\r\n\tregister char *dest = yy_current_buffer->yy_ch_buf;\r\n\tregister char *source = yytext_ptr;\r\n\tregister int number_to_move, i;\r\n\tint ret_val;\r\n\r\n\tif ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )\r\n\t\tYY_FATAL_ERROR(\r\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\r\n\r\n\tif ( yy_current_buffer->yy_fill_buffer == 0 )\r\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\r\n\t\tif ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )\r\n\t\t\t{\r\n\t\t\t/* We matched a singled characater, the EOB, so\r\n\t\t\t * treat this as a final EOF.\r\n\t\t\t */\r\n\t\t\treturn EOB_ACT_END_OF_FILE;\r\n\t\t\t}\r\n\r\n\t\telse\r\n\t\t\t{\r\n\t\t\t/* We matched some text prior to the EOB, first\r\n\t\t\t * process it.\r\n\t\t\t */\r\n\t\t\treturn EOB_ACT_LAST_MATCH;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t/* Try to read more data. */\r\n\r\n\t/* First move last chars to start of buffer. */\r\n\tnumber_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;\r\n\r\n\tfor ( i = 0; i < number_to_move; ++i )\r\n\t\t*(dest++) = *(source++);\r\n\r\n\tif ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )\r\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\r\n\t\t * just force an EOF\r\n\t\t */\r\n\t\tyy_n_chars = 0;\r\n\r\n\telse\r\n\t\t{\r\n\t\tint num_to_read =\r\n\t\t\tyy_current_buffer->yy_buf_size - number_to_move - 1;\r\n\r\n\t\twhile ( num_to_read <= 0 )\r\n\t\t\t{ /* Not enough room in the buffer - grow it. */\r\n#ifdef YY_USES_REJECT\r\n\t\t\tYY_FATAL_ERROR(\r\n\"input buffer overflow, can't enlarge buffer because scanner uses REJECT\" );\r\n#else\r\n\r\n\t\t\t/* just a shorter name for the current buffer */\r\n\t\t\tYY_BUFFER_STATE b = yy_current_buffer;\r\n\r\n\t\t\tint yy_c_buf_p_offset =\r\n\t\t\t\t(int) (yy_c_buf_p - b->yy_ch_buf);\r\n\r\n\t\t\tif ( b->yy_is_our_buffer )\r\n\t\t\t\t{\r\n\t\t\t\tint new_size = b->yy_buf_size * 2;\r\n\r\n\t\t\t\tif ( new_size <= 0 )\r\n\t\t\t\t\tb->yy_buf_size += b->yy_buf_size / 8;\r\n\t\t\t\telse\r\n\t\t\t\t\tb->yy_buf_size *= 2;\r\n\r\n\t\t\t\tb->yy_ch_buf = (char *)\r\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\r\n\t\t\t\t\tyy_flex_realloc( (void *) b->yy_ch_buf,\r\n\t\t\t\t\t\t\t b->yy_buf_size + 2 );\r\n\t\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t/* Can't grow it, we don't own it. */\r\n\t\t\t\tb->yy_ch_buf = 0;\r\n\r\n\t\t\tif ( ! b->yy_ch_buf )\r\n\t\t\t\tYY_FATAL_ERROR(\r\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\r\n\r\n\t\t\tyy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\r\n\r\n\t\t\tnum_to_read = yy_current_buffer->yy_buf_size -\r\n\t\t\t\t\t\tnumber_to_move - 1;\r\n#endif\r\n\t\t\t}\r\n\r\n\t\tif ( num_to_read > YY_READ_BUF_SIZE )\r\n\t\t\tnum_to_read = YY_READ_BUF_SIZE;\r\n\r\n\t\t/* Read in more data. */\r\n\t\tYY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),\r\n\t\t\tyy_n_chars, num_to_read );\r\n\t\t}\r\n\r\n\tif ( yy_n_chars == 0 )\r\n\t\t{\r\n\t\tif ( number_to_move == YY_MORE_ADJ )\r\n\t\t\t{\r\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\r\n\t\t\tyyrestart( yyin );\r\n\t\t\t}\r\n\r\n\t\telse\r\n\t\t\t{\r\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\r\n\t\t\tyy_current_buffer->yy_buffer_status =\r\n\t\t\t\tYY_BUFFER_EOF_PENDING;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\telse\r\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\r\n\r\n\tyy_n_chars += number_to_move;\r\n\tyy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;\r\n\tyy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\r\n\r\n\tyytext_ptr = &yy_current_buffer->yy_ch_buf[0];\r\n\r\n\treturn ret_val;\r\n\t}\r\n\r\n\r\n/* yy_get_previous_state - get the state just before the EOB char was reached */\r\n\r\nstatic yy_state_type yy_get_previous_state()\r\n\t{\r\n\tregister yy_state_type yy_current_state;\r\n\tregister char *yy_cp;\r\n\r\n\tyy_current_state = yy_start;\r\n\tyy_current_state += YY_AT_BOL();\r\n\tyy_state_ptr = yy_state_buf;\r\n\t*yy_state_ptr++ = yy_current_state;\r\n\r\n\tfor ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )\r\n\t\t{\r\n\t\tregister YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);\r\n\t\twhile ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r\n\t\t\t{\r\n\t\t\tyy_current_state = (int) yy_def[yy_current_state];\r\n\t\t\tif ( yy_current_state >= 192 )\r\n\t\t\t\tyy_c = yy_meta[(unsigned int) yy_c];\r\n\t\t\t}\r\n\t\tyy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r\n\t\t*yy_state_ptr++ = yy_current_state;\r\n\t\t}\r\n\r\n\treturn yy_current_state;\r\n\t}\r\n\r\n\r\n/* yy_try_NUL_trans - try to make a transition on the NUL character\r\n *\r\n * synopsis\r\n *\tnext_state = yy_try_NUL_trans( current_state );\r\n */\r\n\r\n#ifdef YY_USE_PROTOS\r\nstatic yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )\r\n#else\r\nstatic yy_state_type yy_try_NUL_trans( yy_current_state )\r\nyy_state_type yy_current_state;\r\n#endif\r\n\t{\r\n\tregister int yy_is_jam;\r\n\r\n\tregister YY_CHAR yy_c = 1;\r\n\twhile ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r\n\t\t{\r\n\t\tyy_current_state = (int) yy_def[yy_current_state];\r\n\t\tif ( yy_current_state >= 192 )\r\n\t\t\tyy_c = yy_meta[(unsigned int) yy_c];\r\n\t\t}\r\n\tyy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r\n\t*yy_state_ptr++ = yy_current_state;\r\n\tyy_is_jam = (yy_current_state == 191);\r\n\r\n\treturn yy_is_jam ? 0 : yy_current_state;\r\n\t}\r\n\r\n\r\n#ifndef YY_NO_UNPUT\r\n#ifdef YY_USE_PROTOS\r\nstatic void yyunput( int c, register char *yy_bp )\r\n#else\r\nstatic void yyunput( c, yy_bp )\r\nint c;\r\nregister char *yy_bp;\r\n#endif\r\n\t{\r\n\tregister char *yy_cp = yy_c_buf_p;\r\n\r\n\t/* undo effects of setting up yytext */\r\n\t*yy_cp = yy_hold_char;\r\n\r\n\tif ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )\r\n\t\t{ /* need to shift things up to make room */\r\n\t\t/* +2 for EOB chars. */\r\n\t\tregister int number_to_move = yy_n_chars + 2;\r\n\t\tregister char *dest = &yy_current_buffer->yy_ch_buf[\r\n\t\t\t\t\tyy_current_buffer->yy_buf_size + 2];\r\n\t\tregister char *source =\r\n\t\t\t\t&yy_current_buffer->yy_ch_buf[number_to_move];\r\n\r\n\t\twhile ( source > yy_current_buffer->yy_ch_buf )\r\n\t\t\t*--dest = *--source;\r\n\r\n\t\tyy_cp += (int) (dest - source);\r\n\t\tyy_bp += (int) (dest - source);\r\n\t\tyy_n_chars = yy_current_buffer->yy_buf_size;\r\n\r\n\t\tif ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )\r\n\t\t\tYY_FATAL_ERROR( \"flex scanner push-back overflow\" );\r\n\t\t}\r\n\r\n\t*--yy_cp = (char) c;\r\n\r\n\tif ( c == '\\n' )\r\n\t\t--yylineno;\r\n\r\n\tyytext_ptr = yy_bp;\r\n\tyy_hold_char = *yy_cp;\r\n\tyy_c_buf_p = yy_cp;\r\n\t}\r\n#endif\t/* ifndef YY_NO_UNPUT */\r\n\r\n\r\n#ifdef __cplusplus\r\nstatic int yyinput()\r\n#else\r\nstatic int input()\r\n#endif\r\n\t{\r\n\tint c;\r\n\r\n\t*yy_c_buf_p = yy_hold_char;\r\n\r\n\tif ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\r\n\t\t{\r\n\t\t/* yy_c_buf_p now points to the character we want to return.\r\n\t\t * If this occurs *before* the EOB characters, then it's a\r\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\r\n\t\t */\r\n\t\tif ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )\r\n\t\t\t/* This was really a NUL. */\r\n\t\t\t*yy_c_buf_p = '\\0';\r\n\r\n\t\telse\r\n\t\t\t{ /* need more input */\r\n\t\t\tyytext_ptr = yy_c_buf_p;\r\n\t\t\t++yy_c_buf_p;\r\n\r\n\t\t\tswitch ( yy_get_next_buffer() )\r\n\t\t\t\t{\r\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\r\n\t\t\t\t\t{\r\n\t\t\t\t\tif ( yywrap() )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tyy_c_buf_p =\r\n\t\t\t\t\t\tyytext_ptr + YY_MORE_ADJ;\r\n\t\t\t\t\t\treturn EOF;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! yy_did_buffer_switch_on_eof )\r\n\t\t\t\t\t\tYY_NEW_FILE;\r\n#ifdef __cplusplus\r\n\t\t\t\t\treturn yyinput();\r\n#else\r\n\t\t\t\t\treturn input();\r\n#endif\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\r\n\t\t\t\t\tyy_c_buf_p = yytext_ptr + YY_MORE_ADJ;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\r\n#ifdef __cplusplus\r\n\t\t\t\t\tYY_FATAL_ERROR(\r\n\t\t\t\t\t\"unexpected last match in yyinput()\" );\r\n#else\r\n\t\t\t\t\tYY_FATAL_ERROR(\r\n\t\t\t\t\t\"unexpected last match in input()\" );\r\n#endif\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tc = *(unsigned char *) yy_c_buf_p;\t/* cast for 8-bit char's */\r\n\t*yy_c_buf_p = '\\0';\t/* preserve yytext */\r\n\tyy_hold_char = *++yy_c_buf_p;\r\n\r\n\tyy_current_buffer->yy_at_bol = (c == '\\n');\r\n\tif ( yy_current_buffer->yy_at_bol )\r\n\t\t++yylineno;\r\n\r\n\treturn c;\r\n\t}\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nvoid yyrestart( FILE *input_file )\r\n#else\r\nvoid yyrestart( input_file )\r\nFILE *input_file;\r\n#endif\r\n\t{\r\n\tif ( ! yy_current_buffer )\r\n\t\tyy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );\r\n\r\n\tyy_init_buffer( yy_current_buffer, input_file );\r\n\tyy_load_buffer_state();\r\n\t}\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nvoid yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )\r\n#else\r\nvoid yy_switch_to_buffer( new_buffer )\r\nYY_BUFFER_STATE new_buffer;\r\n#endif\r\n\t{\r\n\tif ( yy_current_buffer == new_buffer )\r\n\t\treturn;\r\n\r\n\tif ( yy_current_buffer )\r\n\t\t{\r\n\t\t/* Flush out information for old buffer. */\r\n\t\t*yy_c_buf_p = yy_hold_char;\r\n\t\tyy_current_buffer->yy_buf_pos = yy_c_buf_p;\r\n\t\tyy_current_buffer->yy_n_chars = yy_n_chars;\r\n\t\t}\r\n\r\n\tyy_current_buffer = new_buffer;\r\n\tyy_load_buffer_state();\r\n\r\n\t/* We don't actually know whether we did this switch during\r\n\t * EOF (yywrap()) processing, but the only time this flag\r\n\t * is looked at is after yywrap() is called, so it's safe\r\n\t * to go ahead and always set it.\r\n\t */\r\n\tyy_did_buffer_switch_on_eof = 1;\r\n\t}\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nvoid yy_load_buffer_state( void )\r\n#else\r\nvoid yy_load_buffer_state()\r\n#endif\r\n\t{\r\n\tyy_n_chars = yy_current_buffer->yy_n_chars;\r\n\tyytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;\r\n\tyyin = yy_current_buffer->yy_input_file;\r\n\tyy_hold_char = *yy_c_buf_p;\r\n\t}\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nYY_BUFFER_STATE yy_create_buffer( FILE *file, int size )\r\n#else\r\nYY_BUFFER_STATE yy_create_buffer( file, size )\r\nFILE *file;\r\nint size;\r\n#endif\r\n\t{\r\n\tYY_BUFFER_STATE b;\r\n\r\n\tb = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );\r\n\tif ( ! b )\r\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\r\n\r\n\tb->yy_buf_size = size;\r\n\r\n\t/* yy_ch_buf has to be 2 characters longer than the size given because\r\n\t * we need to put in 2 end-of-buffer characters.\r\n\t */\r\n\tb->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );\r\n\tif ( ! b->yy_ch_buf )\r\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\r\n\r\n\tb->yy_is_our_buffer = 1;\r\n\r\n\tyy_init_buffer( b, file );\r\n\r\n\treturn b;\r\n\t}\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nvoid yy_delete_buffer( YY_BUFFER_STATE b )\r\n#else\r\nvoid yy_delete_buffer( b )\r\nYY_BUFFER_STATE b;\r\n#endif\r\n\t{\r\n\tif ( ! b )\r\n\t\treturn;\r\n\r\n\tif ( b == yy_current_buffer )\r\n\t\tyy_current_buffer = (YY_BUFFER_STATE) 0;\r\n\r\n\tif ( b->yy_is_our_buffer )\r\n\t\tyy_flex_free( (void *) b->yy_ch_buf );\r\n\r\n\tyy_flex_free( (void *) b );\r\n\t}\r\n\r\n\r\n#ifndef YY_ALWAYS_INTERACTIVE\r\n#ifndef YY_NEVER_INTERACTIVE\r\nextern int isatty YY_PROTO(( int ));\r\n#endif\r\n#endif\r\n\r\n#ifdef YY_USE_PROTOS\r\nvoid yy_init_buffer( YY_BUFFER_STATE b, FILE *file )\r\n#else\r\nvoid yy_init_buffer( b, file )\r\nYY_BUFFER_STATE b;\r\nFILE *file;\r\n#endif\r\n\r\n\r\n\t{\r\n\tyy_flush_buffer( b );\r\n\r\n\tb->yy_input_file = file;\r\n\tb->yy_fill_buffer = 1;\r\n\r\n#if YY_ALWAYS_INTERACTIVE\r\n\tb->yy_is_interactive = 1;\r\n#else\r\n#if YY_NEVER_INTERACTIVE\r\n\tb->yy_is_interactive = 0;\r\n#else\r\n\tb->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;\r\n#endif\r\n#endif\r\n\t}\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nvoid yy_flush_buffer( YY_BUFFER_STATE b )\r\n#else\r\nvoid yy_flush_buffer( b )\r\nYY_BUFFER_STATE b;\r\n#endif\r\n\r\n\t{\r\n\tb->yy_n_chars = 0;\r\n\r\n\t/* We always need two end-of-buffer characters.  The first causes\r\n\t * a transition to the end-of-buffer state.  The second causes\r\n\t * a jam in that state.\r\n\t */\r\n\tb->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\r\n\tb->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\r\n\r\n\tb->yy_buf_pos = &b->yy_ch_buf[0];\r\n\r\n\tb->yy_at_bol = 1;\r\n\tb->yy_buffer_status = YY_BUFFER_NEW;\r\n\r\n\tif ( b == yy_current_buffer )\r\n\t\tyy_load_buffer_state();\r\n\t}\r\n\r\n\r\n#ifndef YY_NO_SCAN_BUFFER\r\n#ifdef YY_USE_PROTOS\r\nYY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )\r\n#else\r\nYY_BUFFER_STATE yy_scan_buffer( base, size )\r\nchar *base;\r\nyy_size_t size;\r\n#endif\r\n\t{\r\n\tYY_BUFFER_STATE b;\r\n\r\n\tif ( size < 2 ||\r\n\t     base[size-2] != YY_END_OF_BUFFER_CHAR ||\r\n\t     base[size-1] != YY_END_OF_BUFFER_CHAR )\r\n\t\t/* They forgot to leave room for the EOB's. */\r\n\t\treturn 0;\r\n\r\n\tb = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );\r\n\tif ( ! b )\r\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );\r\n\r\n\tb->yy_buf_size = size - 2;\t/* \"- 2\" to take care of EOB's */\r\n\tb->yy_buf_pos = b->yy_ch_buf = base;\r\n\tb->yy_is_our_buffer = 0;\r\n\tb->yy_input_file = 0;\r\n\tb->yy_n_chars = b->yy_buf_size;\r\n\tb->yy_is_interactive = 0;\r\n\tb->yy_at_bol = 1;\r\n\tb->yy_fill_buffer = 0;\r\n\tb->yy_buffer_status = YY_BUFFER_NEW;\r\n\r\n\tyy_switch_to_buffer( b );\r\n\r\n\treturn b;\r\n\t}\r\n#endif\r\n\r\n\r\n#ifndef YY_NO_SCAN_STRING\r\n#ifdef YY_USE_PROTOS\r\nYY_BUFFER_STATE yy_scan_string( yyconst char *str )\r\n#else\r\nYY_BUFFER_STATE yy_scan_string( str )\r\nyyconst char *str;\r\n#endif\r\n\t{\r\n\tint len;\r\n\tfor ( len = 0; str[len]; ++len )\r\n\t\t;\r\n\r\n\treturn yy_scan_bytes( str, len );\r\n\t}\r\n#endif\r\n\r\n\r\n#ifndef YY_NO_SCAN_BYTES\r\n#ifdef YY_USE_PROTOS\r\nYY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )\r\n#else\r\nYY_BUFFER_STATE yy_scan_bytes( bytes, len )\r\nyyconst char *bytes;\r\nint len;\r\n#endif\r\n\t{\r\n\tYY_BUFFER_STATE b;\r\n\tchar *buf;\r\n\tyy_size_t n;\r\n\tint i;\r\n\r\n\t/* Get memory for full buffer, including space for trailing EOB's. */\r\n\tn = len + 2;\r\n\tbuf = (char *) yy_flex_alloc( n );\r\n\tif ( ! buf )\r\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );\r\n\r\n\tfor ( i = 0; i < len; ++i )\r\n\t\tbuf[i] = bytes[i];\r\n\r\n\tbuf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;\r\n\r\n\tb = yy_scan_buffer( buf, n );\r\n\tif ( ! b )\r\n\t\tYY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );\r\n\r\n\t/* It's okay to grow etc. this buffer, and we should throw it\r\n\t * away when we're done.\r\n\t */\r\n\tb->yy_is_our_buffer = 1;\r\n\r\n\treturn b;\r\n\t}\r\n#endif\r\n\r\n\r\n#ifndef YY_NO_PUSH_STATE\r\n#ifdef YY_USE_PROTOS\r\nstatic void yy_push_state( int new_state )\r\n#else\r\nstatic void yy_push_state( new_state )\r\nint new_state;\r\n#endif\r\n\t{\r\n\tif ( yy_start_stack_ptr >= yy_start_stack_depth )\r\n\t\t{\r\n\t\tyy_size_t new_size;\r\n\r\n\t\tyy_start_stack_depth += YY_START_STACK_INCR;\r\n\t\tnew_size = yy_start_stack_depth * sizeof( int );\r\n\r\n\t\tif ( ! yy_start_stack )\r\n\t\t\tyy_start_stack = (int *) yy_flex_alloc( new_size );\r\n\r\n\t\telse\r\n\t\t\tyy_start_stack = (int *) yy_flex_realloc(\r\n\t\t\t\t\t(void *) yy_start_stack, new_size );\r\n\r\n\t\tif ( ! yy_start_stack )\r\n\t\t\tYY_FATAL_ERROR(\r\n\t\t\t\"out of memory expanding start-condition stack\" );\r\n\t\t}\r\n\r\n\tyy_start_stack[yy_start_stack_ptr++] = YY_START;\r\n\r\n\tBEGIN(new_state);\r\n\t}\r\n#endif\r\n\r\n\r\n#ifndef YY_NO_POP_STATE\r\nstatic void yy_pop_state()\r\n\t{\r\n\tif ( --yy_start_stack_ptr < 0 )\r\n\t\tYY_FATAL_ERROR( \"start-condition stack underflow\" );\r\n\r\n\tBEGIN(yy_start_stack[yy_start_stack_ptr]);\r\n\t}\r\n#endif\r\n\r\n\r\n#ifndef YY_NO_TOP_STATE\r\nstatic int yy_top_state()\r\n\t{\r\n\treturn yy_start_stack[yy_start_stack_ptr - 1];\r\n\t}\r\n#endif\r\n\r\n#ifndef YY_EXIT_FAILURE\r\n#define YY_EXIT_FAILURE 2\r\n#endif\r\n\r\n#ifdef YY_USE_PROTOS\r\nstatic void yy_fatal_error( yyconst char msg[] )\r\n#else\r\nstatic void yy_fatal_error( msg )\r\nchar msg[];\r\n#endif\r\n\t{\r\n\t(void) fprintf( stderr, \"%s\\n\", msg );\r\n\texit( YY_EXIT_FAILURE );\r\n\t}\r\n\r\n\r\n\r\n/* Redefine yyless() so it works in section 3 code. */\r\n\r\n#undef yyless\r\n#define yyless(n) \\\r\n\tdo \\\r\n\t\t{ \\\r\n\t\t/* Undo effects of setting up yytext. */ \\\r\n\t\tyytext[yyleng] = yy_hold_char; \\\r\n\t\tyy_c_buf_p = yytext + n - YY_MORE_ADJ; \\\r\n\t\tyy_hold_char = *yy_c_buf_p; \\\r\n\t\t*yy_c_buf_p = '\\0'; \\\r\n\t\tyyleng = n; \\\r\n\t\t} \\\r\n\twhile ( 0 )\r\n\r\n\r\n/* Internal utility routines. */\r\n\r\n#ifndef yytext_ptr\r\n#ifdef YY_USE_PROTOS\r\nstatic void yy_flex_strncpy( char *s1, yyconst char *s2, int n )\r\n#else\r\nstatic void yy_flex_strncpy( s1, s2, n )\r\nchar *s1;\r\nyyconst char *s2;\r\nint n;\r\n#endif\r\n\t{\r\n\tregister int i;\r\n\tfor ( i = 0; i < n; ++i )\r\n\t\ts1[i] = s2[i];\r\n\t}\r\n#endif\r\n\r\n\r\n#ifdef YY_USE_PROTOS\r\nstatic void *yy_flex_alloc( yy_size_t size )\r\n#else\r\nstatic void *yy_flex_alloc( size )\r\nyy_size_t size;\r\n#endif\r\n\t{\r\n\treturn (void *) malloc( size );\r\n\t}\r\n\r\n#ifdef YY_USE_PROTOS\r\nstatic void *yy_flex_realloc( void *ptr, yy_size_t size )\r\n#else\r\nstatic void *yy_flex_realloc( ptr, size )\r\nvoid *ptr;\r\nyy_size_t size;\r\n#endif\r\n\t{\r\n\t/* The cast to (char *) in the following accommodates both\r\n\t * implementations that use char* generic pointers, and those\r\n\t * that use void* generic pointers.  It works with the latter\r\n\t * because both ANSI C and C++ allow castless assignment from\r\n\t * any pointer type to void*, and deal with argument conversions\r\n\t * as though doing an assignment.\r\n\t */\r\n\treturn (void *) realloc( (char *) ptr, size );\r\n\t}\r\n\r\n#ifdef YY_USE_PROTOS\r\nstatic void yy_flex_free( void *ptr )\r\n#else\r\nstatic void yy_flex_free( ptr )\r\nvoid *ptr;\r\n#endif\r\n\t{\r\n\tfree( ptr );\r\n\t}\r\n\r\n#if YY_MAIN\r\nint main()\r\n\t{\r\n\tyylex();\r\n\treturn 0;\r\n\t}\r\n#endif\r\n#line 174 \"csharp.l\"\r\n\r\n\r\n\r\nstatic struct name_value {\r\n  char *name;\r\n  int value;\r\n} name_value;\r\nstatic struct name_value keywords [] = { \r\n /* This list must remain sorted!!! */\r\n    {\"abstract\", ABSTRACT},\r\n    {\"as\", AS},\r\n    {\"base\", BASE},\r\n    {\"bool\", BOOL},\r\n    {\"break\", BREAK},\r\n    {\"byte\", BYTE},\r\n    {\"case\", CASE},\r\n    {\"catch\", CATCH},\r\n    {\"char\", CHAR},\r\n    {\"checked\", CHECKED},\r\n    {\"class\", CLASS},\r\n    {\"const\", CONST},\r\n    {\"continue\", CONTINUE},\r\n    {\"decimal\", DECIMAL},\r\n    {\"default\", DEFAULT},\r\n    {\"delegate\", DELEGATE},\r\n    {\"do\", DO},\r\n    {\"double\", DOUBLE},\r\n    {\"else\", ELSE},\r\n    {\"enum\", ENUM},\r\n    {\"event\", EVENT},\r\n    {\"explicit\", EXPLICIT},\r\n    {\"extern\", EXTERN},\r\n    {\"false\", FALSE},\r\n    {\"finally\", FINALLY},\r\n    {\"fixed\", FIXED},\r\n    {\"float\", FLOAT},\r\n    {\"for\", FOR},\r\n    {\"foreach\", FOREACH},\r\n    {\"goto\", GOTO},\r\n    {\"if\", IF},\r\n    {\"implicit\", IMPLICIT},\r\n    {\"in\", IN},\r\n    {\"int\", INT},\r\n    {\"interface\", INTERFACE},\r\n    {\"internal\", INTERNAL},\r\n    {\"is\", IS},\r\n    {\"lock\", LOCK},\r\n    {\"long\", LONG},\r\n    {\"namespace\", NAMESPACE},\r\n    {\"new\", NEW},\r\n    {\"null\", NULL_LITERAL},\r\n    {\"object\", OBJECT},\r\n    {\"operator\", OPERATOR},\r\n    {\"out\", OUT},\r\n    {\"override\", OVERRIDE},\r\n    {\"params\", PARAMS},\r\n    {\"private\", PRIVATE},\r\n    {\"protected\", PROTECTED},\r\n    {\"public\", PUBLIC},\r\n    {\"readonly\", READONLY},\r\n    {\"ref\", REF},\r\n    {\"return\", RETURN},\r\n    {\"sbyte\", SBYTE},\r\n    {\"sealed\", SEALED},\r\n    {\"short\", SHORT},\r\n    {\"sizeof\", SIZEOF},\r\n    {\"stackalloc\", STACKALLOC},\r\n    {\"static\", STATIC},\r\n    {\"string\", STRING},\r\n    {\"struct\", STRUCT},\r\n    {\"switch\", SWITCH},\r\n    {\"this\", THIS},\r\n    {\"throw\", THROW},\r\n    {\"true\", TRUE},\r\n    {\"try\", TRY},\r\n    {\"typeof\", TYPEOF},\r\n    {\"uint\", UINT},\r\n    {\"ulong\", ULONG},\r\n    {\"unchecked\", UNCHECKED},\r\n    {\"unsafe\", UNSAFE},\r\n    {\"ushort\", USHORT},\r\n    {\"using\", USING},\r\n    {\"virtual\", VIRTUAL},\r\n    {\"void\", VOID},\r\n    {\"volatile\", VOLATILE},\r\n    {\"while\", WHILE},\r\n  };    \r\n\r\n\r\n/* Conduct a binary search for lexeme in the keywords array\r\n * between indices start (inclusive) and finish (exclusive)\r\n */\r\nstatic int bin_search(const char *lexeme, int start, int finish)\r\n{\r\n  if (start >= finish)  /* Not found */\r\n      return IDENTIFIER;\r\n  else {\r\n    int mid = (start+finish)/2;\r\n    int cmp = strcmp(lexeme,keywords[mid].name);\r\n    if (cmp == 0) \r\n      return keywords[mid].value;\r\n    else if (cmp < 0)\r\n      return bin_search(lexeme,start,mid);\r\n    else\r\n      return bin_search(lexeme,mid+1,finish);\r\n  }\r\n}\r\n\r\nstatic int token_for(const char *lexeme)\r\n{\r\n\r\n  static int num_keywords = sizeof(keywords) / sizeof(name_value);\r\n  int token = bin_search(lexeme,0,num_keywords);\r\n  if (token == -1) {\r\n    token = IDENTIFIER;\r\n\tyylval.text = strdup(lexeme); \r\n  } else if (token == NULL_LITERAL) {\r\n\tyylval.value = getValueNull();\r\n  }\r\n  return token;\r\n}\r\n\r\nstatic int is_allowed_char(const char c)\r\n{\r\n  static char allowed [] = {\r\n    '.', ';', ':',\r\n    '(', ')', '{', '}', '<', '>',\r\n    '+', '-', '*', '/', '%', '&', '|', '!', '~', '^',\r\n    '=', '?',\r\n  };\r\n  static int num_allowed = sizeof(allowed) / sizeof(char);\r\n  int i;\r\n  for (i=0; i<num_allowed; i++) {\r\n    if (allowed[i]==c) \r\n      return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\nstatic SValue getValueInt(const char* text) {\r\n\tSValue v;\r\n\tint len = strlen(text);\r\n\tint mode = 0;\r\n\tif ((text[len-1]=='U') || (text[len-1]=='u')) {\tmode |= 1;\t}\r\n\tif ((text[len-1]=='L') || (text[len-1]=='l')) {\tmode |= 2;\t}\r\n\r\n\tif (mode) {\r\n\t\tif ((text[len-2]=='U') || (text[len-2]=='u')) {\tmode |= 1;\t}\r\n\t\tif ((text[len-2]=='L') || (text[len-2]=='l')) {\tmode |= 2;\t}\r\n\t}\r\n\t\t\r\n\tint hexaMode = 10;\r\n\tconst char* p = text;\r\n\tif ((text[0] == '0') && (text[1] == 'x' || text[1]=='X')) {\r\n\t\thexaMode = 16;\r\n\t\tp += 2; // Skip 0x\r\n\t}\r\n\t\r\n\t// We have a valid string anyway.\r\n\tlong out = 0;\r\n\tdo {\r\n\t\tint v = *p++;\r\n\t\tif (v >= '0' && v <= '9') {\r\n\t\t\tv -= '0';\r\n\t\t} else\r\n\t\tif (v >= 'A' && v <= 'F') {\r\n\t\t\tv -= 'A';\r\n\t\t} else\r\n\t\tif (v >= 'a' && v <= 'f') {\r\n\t\t\tv -= 'a';\r\n\t\t} else {\r\n\t\t\t// Reach end : char 0, U, L etc...\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tout = (out * hexaMode) + v;\r\n\t} while(1);\r\n\t\r\n\tswitch (mode) {\r\n\tcase 0:\r\n\t\tv.type\t= TYPE_INT;\r\n\t\tv.v.i\t= (int)out;\r\n\t\tbreak;\r\n\tcase 1:\r\n\t\tv.type\t= TYPE_UINT;\r\n\t\tv.v.ui\t= (unsigned int)out;\r\n\t\tbreak;\r\n\tcase 2:\r\n\t\tv.type\t= TYPE_LONG;\r\n\t\tv.v.l\t= (long)out;\r\n\t\tbreak;\r\n\tdefault:\r\n\tcase 3:\r\n\t\tv.type\t= TYPE_ULONG;\r\n\t\tv.v.ul\t= (unsigned long)out;\r\n\t\tbreak;\r\n\t}\r\n\treturn v;\r\n}\r\n\r\nstatic SValue getValueReal(const char* text) {\r\n\tSValue v;\r\n\tdouble d;\r\n\tchar buff[70];\t// Tmp buffer\r\n\tint strL = strlen(text);\r\n\tchar c = text[strL-1];\r\n\tconst char* ptrRead = text;\r\n\tint isFloat = 0;\r\n\tif ((c == 'F') || (c == 'f') || (c == 'D') || (c == 'd') || (c == 'M') || (c == 'm')) {\r\n\t\tif ((c == 'F') || (c == 'f')) {\r\n\t\t\tisFloat = 1;\r\n\t\t}\r\n\t\tmemcpy(buff,text,strL-1);\r\n\t\tbuff[strL] = 0;\r\n\t\tptrRead = buff;\r\n\t}\r\n\tsscanf(ptrRead, \"%lf\", &d);\r\n\tif (isFloat) {\r\n\t\tv.type\t= TYPE_DOUBLE;\r\n\t\tv.v.d\t= d;\r\n\t} else {\r\n\t\tv.type\t= TYPE_FLOAT;\r\n\t\tv.v.f\t= (float)d;\r\n\t}\r\n\treturn v;\r\n}\r\n\r\nstatic SValue getValueChar(const char* text) {\r\n\tSValue v;\r\n\tv.type\t= TYPE_CHAR;\r\n\tconst char* t = &text[1];\r\n\tu16 ch = 0;\r\n\tif (*t == '/') {\r\n\t\tswitch (t[1]) {\r\n\t\tcase 'U':\r\n\t\t\tcompilerError(ERR_TODO, \" Support complex unicode.\");\r\n\t\tcase 'u':\r\n\t\tcase 'x':\r\n\t\t{\r\n\t\t\tint hexaMode = 16;\r\n\t\t\t// We have a valid string anyway.\r\n\t\t\tint out = 0;\r\n\t\t\tconst char* p = &t[2];\r\n\t\t\tdo {\r\n\t\t\t\tint v = *p++;\r\n\t\t\t\tif (v >= '0' && v <= '9') {\r\n\t\t\t\t\tv -= '0';\r\n\t\t\t\t} else\r\n\t\t\t\tif (v >= 'A' && v <= 'F') {\r\n\t\t\t\t\tv -= 'A';\r\n\t\t\t\t} else\r\n\t\t\t\tif (v >= 'a' && v <= 'f') {\r\n\t\t\t\t\tv -= 'a';\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Reach end : char 0, ' etc...\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tout = (out * hexaMode) + v;\r\n\t\t\t} while(1);\r\n\t\t\t// Read 4 hex char\r\n\t\t\tch = out;\r\n\t\t}\tbreak;\r\n\t\tcase 'a':\tch = 0x0007;\tbreak;\r\n\t\tcase 'b':\tch = 0x0008;\tbreak;\r\n\t\tcase 'f':\tch = 0x000C;\tbreak;\r\n\t\tcase 'n':\tch = 0x000A;\tbreak;\r\n\t\tcase 'r':\tch = 0x000D;\tbreak;\r\n\t\tcase 't':\tch = 0x0009;\tbreak;\r\n\t\tcase 'v':\tch = 0x000B;\tbreak;\r\n\t\tcase '0':\tch = 0;\t\t\tbreak;\r\n\t\tcase '\\'':\tch = 0x0027;\tbreak;\r\n\t\tcase '\\\"':\tch = 0x0022;\tbreak;\r\n\t\tcase '\\\\':\tch = 0x005C;\tbreak;\r\n\t\tdefault:\r\n\t\t\tcompilerError(ERR_INVALID_CHAR, \"Invalid Char sequence /%c .\", t[1]);\r\n\t\t}\r\n\t} else {\r\n\t\tif (*t >= 128) {\r\n\t\t\tcompilerError(ERR_TODO, \" Support UTF8 -> Unicode.\");\r\n\t\t} else {\r\n\t\t\tch = *t;\r\n\t\t}\r\n\t}\r\n\tv.v.i = ch;\r\n\treturn v;\r\n}\r\n\r\nstatic SValue getValueString(const char* text) {\r\n\tSValue v;\r\n\tv.type\t= TYPE_STRING;\r\n\tv.v.str\t= text;\t\t// For now UTF8 as is.\r\n\treturn v;\r\n}\r\n\r\nstatic int getRank(const char* text) {\r\n\tint res = 1;\r\n\twhile (*text != 0) {\r\n\t\tif (*text == ',') {\r\n\t\t\tres++;\r\n\t\t}\r\n\t\ttext++;\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nstatic SValue getValueNull() {\r\n\tSValue v;\r\n\tv.type\t= TYPE_NULL;\r\n\treturn v;\r\n}\r\n\r\n\r\nvoid lexical_error(const char *msg)\r\n{\r\n  fprintf(stderr,\"%d:lexical error (%s) [%s]\\n\",yylineno,msg,yytext);\r\n}\r\n\r\n\r\n/*** Switch on/off context-sensitive \"keywords\" ***/\r\n/* I don't like it any more than you do.  */\r\n\r\nvoid lex_in_generic(void) {\r\n}\r\nvoid lex_out_generic(void) {\r\n}\r\nvoid lex_enter_attrib(void)\r\n{\r\n  yy_push_state(IN_ATTRIB);\r\n}\r\nvoid lex_exit_attrib(void)\r\n{\r\n  yy_pop_state();\r\n}\r\nvoid lex_enter_accessor(void)\r\n{\r\n  yy_push_state(IN_ACCESSOR);\r\n}\r\nvoid lex_exit_accessor(void)\r\n{\r\n  yy_pop_state();\r\n}\r\nvoid lex_enter_getset(void)\r\n{\r\n  yy_push_state(IN_GETSET);\r\n}\r\nvoid lex_exit_getset(void)\r\n{\r\n  yy_pop_state();\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/stdafx.cpp",
    "content": "// stdafx.cpp : source file that includes just the standard includes\r\n// CompilerProject.pch will be the pre-compiled header\r\n// stdafx.obj will contain the pre-compiled type information\r\n\r\n#include \"stdafx.h\"\r\n\r\n// TODO: reference any additional headers you need in STDAFX.H\r\n// and not in this file\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/stdafx.h",
    "content": "// stdafx.h : include file for standard system include files,\r\n// or project specific include files that are used frequently, but\r\n// are changed infrequently\r\n//\r\n\r\n#pragma once\r\n\r\n#include \"targetver.h\"\r\n\r\n#include <stdio.h>\r\n#include <tchar.h>\r\n\r\n\r\n\r\n// TODO: reference additional headers your program requires here\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/supported.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nnamespace System\r\n{\r\n\t//Object Class\r\n\tpublic class Object\r\n\t{\r\n        public Object() {}\r\n\t\tpublic virtual\tbool\tEquals\t\t\t(Object obj){}\r\n\t\tpublic static\tbool\tEquals\t\t\t(Object objA, Object objB){}\r\n\t\tpublic virtual int\t\tGetHashCode\t\t(){}\r\n\t\t/*public Type GetType(){}\tNot Supported for now, but should be in the future : allow data loader using reflection*/\r\n\t\t// This is NOT a correct definition, but it allows to use this method for debug in C#.\r\n\t\tpublic string \t\t\tGetType\t\t\t(){}\r\n\t\tpublic virtual int\t\tCompareTo\t\t(Object obj){} // Implementation of IComparable\r\n\t\tpublic static bool\t\tReferenceEquals\t(Object objA, Object objB){}\r\n\t\tpublic virtual String\tToString\t\t(){}\r\n\t}\r\n\t\r\n\tpublic class IntPtr : Object\r\n\t{\r\n\t\tpublic static const IntPtr Zero = null;  // Value set to null by compiler, works !\r\n\t\tpublic static const int    Size = 0;\r\n\t}\r\n\t\r\n\t//Exceptions\r\n\tpublic class Exception : Object {\r\n\t\tpublic string Message { get {} }\r\n\t\tpublic string StackTrace { get {} }\r\n\t}\r\n\tpublic class SystemException \t\t\t\t: Exception {}\r\n\tpublic class NullReferenceException \t\t: SystemException {}\r\n\tpublic class IndexOutOfRangeException \t\t: SystemException {}\r\n\tpublic class OutOfMemoryException \t\t\t: SystemException {}\r\n\tpublic class ArgumentException \t\t\t\t: SystemException {}\r\n\tpublic class ArgumentOutOfRangeException \t: ArgumentException {}\r\n\tpublic class ArgumentNullException \t\t\t: ArgumentException {}\r\n\tpublic class RankException \t\t\t\t\t: SystemException {}\r\n\tpublic class CppNotComparable \t\t\t\t: SystemException {}\r\n\tpublic class InvalidOperationException \t\t: SystemException {}\r\n\tpublic class ArrayTypeMismatchException \t: SystemException {}\r\n\tpublic class ArithmeticException \t\t\t: SystemException {}\r\n\tpublic class DivideByZeroException \t\t\t: ArithmeticException {}\r\n\t\r\n\t//Array\r\n    public abstract class Array<T> : Object\r\n    {\r\n        //AbstractArray Part\r\n\r\n\t\t//public bool IsFixedSize { get{} }\r\n\t\t//public bool IsReadOnly { get{} }\r\n\t\t//public bool IsSynchronized { get{} }\r\n\t\tpublic int Length { get{} }\r\n\t\tpublic long LongLength { get{} }\r\n\t\tpublic int Rank { get{} }\r\n\t\t//public Object SyncRoot { get{} }\r\n        \r\n        //[Hint replace Array -> AbstractArray]\r\n\t\tpublic static int BinarySearch(Array Array, Object value){}\r\n\t\tpublic static int BinarySearch(Array Array, sbyte value){}\r\n\t\tpublic static int BinarySearch(Array Array, byte value){}\r\n\t\tpublic static int BinarySearch(Array Array, short value){}\r\n\t\tpublic static int BinarySearch(Array Array, ushort value){}\r\n\t\tpublic static int BinarySearch(Array Array, int value){}\r\n\t\tpublic static int BinarySearch(Array Array, uint value){}\r\n\t\tpublic static int BinarySearch(Array Array, long value){}\r\n\t\tpublic static int BinarySearch(Array Array, ulong value){}\r\n\t\tpublic static int BinarySearch(Array Array, float value){}\r\n\t\tpublic static int BinarySearch(Array Array, double value){}\r\n\t\tpublic static int BinarySearch(Array Array, bool value){}\t\t\r\n\t\t//public static int BinarySearch(Array Array, Object value, IComparer comparer){}\t\t\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, Object value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, sbyte value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, byte value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, short value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, ushort value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, int value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, uint value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, long value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, ulong value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, float value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, double value){}\r\n\t\tpublic static int BinarySearch(Array Array, int index, int length, bool value){}\r\n\t\t//public static int BinarySearch(Array Array, int index, int length, Object value, IComparer comparer){}\r\n\t\tpublic static void Clear(Array Array, int index, int length){}\r\n\t\tpublic Object Clone(){}\r\n\t\t//public static void ConstrainedCopy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length){}\r\n\t\t//public static void Copy(Array sourceArray, Array destinationArray, int length){}\r\n\t\t//public static void Copy(Array sourceArray, Array destinationArray, long length){}\r\n\t\t//public static void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length){}\r\n\t\t//public static void Copy(Array sourceArray, long sourceIndex, Array destinationArray, long destinationIndex, long length){}\r\n\t\t//public void CopyTo(Array Array, int index){}\r\n\t\t//public void CopyTo(Array Array, long index){}\r\n\t\t//public static Array CreateInstance(Type elementType, int length){}\r\n\t\t//public static Array CreateInstance(Type elementType, params int[] lengths){}\r\n\t\t//public static Array CreateInstance(Type elementType, params long[] lengths){}\r\n\t\t//public static Array CreateInstance(Type elementType, int length1, int length2){}\r\n\t\t//public static Array CreateInstance(Type elementType, int[] lengths, int[] lowerBounds){}\r\n\t\t//public static Array CreateInstance(Type elementType, int length1, int length2, int length3){}\r\n\t\t//public IEnumerator GetEnumerator(){}\r\n\t\tpublic int GetLength(int dimension){}\r\n\t\tpublic long GetLongLength(int dimension){}\r\n\t\tpublic int GetLowerBound(int dimension){}\r\n\t\tpublic int GetUpperBound(int dimension){}\r\n\r\n        // GetValue() functions will never be implemented\r\n\t\t//public Object GetValue(int index){}\r\n\t\t//public Object GetValue(long index){}\r\n\t\t//public Object GetValue(params int[] indices){}\r\n\t\t//public Object GetValue(params long[] indices){}\r\n\t\t//public Object GetValue(int index1, int index2){}\r\n\t\t//public Object GetValue(long index1, long index2){}\r\n\t\t//public Object GetValue(int index1, int index2, int index3){}\r\n\t\t//public Object GetValue(long index1, long index2, long index3){}\r\n\r\n\t\tpublic static int IndexOf(Array Array, Object   value) { }\r\n        public static int IndexOf(Array Array, sbyte    value) { }\r\n        public static int IndexOf(Array Array, byte     value) { }\r\n        public static int IndexOf(Array Array, short    value) { }\r\n        public static int IndexOf(Array Array, ushort   value) { }\r\n        public static int IndexOf(Array Array, int      value) { }\r\n        public static int IndexOf(Array Array, uint     value) { }\r\n        public static int IndexOf(Array Array, long     value) { }\r\n        public static int IndexOf(Array Array, ulong    value) { }\r\n        public static int IndexOf(Array Array, double   value) { }\r\n        public static int IndexOf(Array Array, float    value) { }\r\n        public static int IndexOf(Array Array, bool     value) { }\r\n\r\n        public static int IndexOf(Array Array, Object   value, int startIndex) { }\r\n        public static int IndexOf(Array Array, sbyte    value, int startIndex) { }\r\n        public static int IndexOf(Array Array, byte     value, int startIndex) { }\r\n        public static int IndexOf(Array Array, short    value, int startIndex) { }\r\n        public static int IndexOf(Array Array, ushort   value, int startIndex) { }\r\n        public static int IndexOf(Array Array, int      value, int startIndex) { }\r\n        public static int IndexOf(Array Array, uint     value, int startIndex) { }\r\n        public static int IndexOf(Array Array, long     value, int startIndex) { }\r\n        public static int IndexOf(Array Array, ulong    value, int startIndex) { }\r\n        public static int IndexOf(Array Array, double   value, int startIndex) { }\r\n        public static int IndexOf(Array Array, float    value, int startIndex) { }\r\n        public static int IndexOf(Array Array, bool     value, int startIndex) { }\r\n\r\n        public static int IndexOf(Array Array, Object   value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, sbyte    value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, byte     value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, short    value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, ushort   value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, int      value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, uint     value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, long     value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, ulong    value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, double   value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, float    value, int startIndex, int count) { }\r\n        public static int IndexOf(Array Array, bool     value, int startIndex, int count) { }\r\n\r\n\t\t//public void Initialize(){}\r\n        public static int LastIndexOf(Array Array, Object value) { }\r\n        public static int LastIndexOf(Array Array, sbyte value) { }\r\n        public static int LastIndexOf(Array Array, byte value) { }\r\n        public static int LastIndexOf(Array Array, short value) { }\r\n        public static int LastIndexOf(Array Array, ushort value) { }\r\n        public static int LastIndexOf(Array Array, int value) { }\r\n        public static int LastIndexOf(Array Array, uint value) { }\r\n        public static int LastIndexOf(Array Array, long value) { }\r\n        public static int LastIndexOf(Array Array, ulong value) { }\r\n        public static int LastIndexOf(Array Array, double value) { }\r\n        public static int LastIndexOf(Array Array, float value) { }\r\n        public static int LastIndexOf(Array Array, bool value) { }\r\n\r\n        public static int LastIndexOf(Array Array, Object value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, sbyte value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, byte value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, short value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, ushort value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, int value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, uint value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, long value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, ulong value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, double value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, float value, int startIndex) { }\r\n        public static int LastIndexOf(Array Array, bool value, int startIndex) { }\r\n\r\n        public static int LastIndexOf(Array Array, Object value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, sbyte value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, byte value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, short value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, ushort value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, int value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, uint value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, long value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, ulong value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, double value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, float value, int startIndex, int count) { }\r\n        public static int LastIndexOf(Array Array, bool value, int startIndex, int count) { }\r\n\t\tpublic static void Reverse(Array Array){}\r\n\t\tpublic static void Reverse(Array Array, int index, int length){}\r\n\r\n        // SetValue should never be implemented\r\n\t\t//public void SetValue(Object value, int index){}\r\n\t\t//public void SetValue(Object value, long index){}\r\n\t\t//public void SetValue(Object value, params int[] indices){}\r\n\t\t//public void SetValue(Object value, params long[] indices){}\r\n\t\t//public void SetValue(Object value, int index1, int index2){}\r\n\t\t//public void SetValue(Object value, long index1, long index2){}\r\n\t\t//public void SetValue(Object value, int index1, int index2, int index3){}\r\n\t\t//public void SetValue(Object value, long index1, long index2, long index3){}\r\n\r\n\t\tpublic static void Sort(Array Array){}\r\n\t\t//public static void Sort(Array keys, Array items){}\r\n\t\t//public static void Sort(Array Array, IComparer comparer){}\t\t\r\n\t\t//public static void Sort(Array keys, Array items, IComparer comparer){}\r\n\t\tpublic static void Sort(Array Array, int index, int length){}\t\r\n\t\t//public static void Sort(Array keys, Array items, int index, int length){}\r\n\t\t//public static void Sort(Array Array, int index, int length, IComparer comparer){}\t\r\n\t\t//public static void Sort(Array keys, Array items, int index, int length, IComparer comparer){}\r\n\r\n        //public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items) { }\r\n        //public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, IComparer<TKey> comparer){}\r\n        //public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length){}\r\n        //public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length, IComparer<TKey> comparer){}\r\n\r\n\t    //Array Part\r\n\r\n        public T this[int index] { get { } set { } }\r\n        public static int BinarySearch(T[] array, T value) { }\r\n        //public static int BinarySearch<T>(T[] array, T value, IComparer<T> comparer){}\r\n        public static int BinarySearch<T>(T[] array, int index, int length, T value) { }\r\n        //public static int BinarySearch<T>(T[] array, int index, int length, T value, IComparer<T> comparer){}\r\n        //public static TOutput[] ConvertAll<TInput, TOutput>(TInput[] array, Converter<TInput, TOutput> converter){}\r\n        //public static bool Exists<T>(T[] array, Predicate<T> match){}\r\n        //public static T Find<T>(T[] array, Predicate<T> match){}\r\n        //public static T[] FindAll<T>(T[] array, Predicate<T> match){}\r\n        //public static int FindIndex<T>(T[] array, Predicate<T> match){}\r\n        //public static int FindIndex<T>(T[] array, int startIndex, Predicate<T> match){}\r\n        //public static int FindIndex<T>(T[] array, int startIndex, int count, Predicate<T> match){}\r\n        //public static T FindLast<T>(T[] array, Predicate<T> match){}\r\n        //public static int FindLastIndex<T>(T[] array, Predicate<T> match){}\r\n        //public static int FindLastIndex<T>(T[] array, int startIndex, Predicate<T> match){}\r\n        //public static int FindLastIndex<T>(T[] array, int startIndex, int count, Predicate<T> match){}\r\n        //public static void ForEach<T>(T[] array, Action<T> action){}\r\n        public static int IndexOf<T>(T[] array, T value) { }\r\n        public static int IndexOf<T>(T[] array, T value, int startIndex) { }\r\n        public static int IndexOf<T>(T[] array, T value, int startIndex, int count) { }\r\n        public static int LastIndexOf<T>(T[] array, T value) { }\r\n        public static int LastIndexOf<T>(T[] array, T value, int startIndex) { }\r\n        public static int LastIndexOf<T>(T[] array, T value, int startIndex, int count) { }\r\n        public static void Resize<T>(ref T[] array, int newSize) { }\r\n        public static void Sort<T>(T[] array) { }\r\n        //public static void Sort<T>(T[] array, Comparison<T> comparison){}\r\n        //public static void Sort<T>(T[] array, IComparer<T> comparer){}\r\n        public static void Sort<T>(T[] array, int index, int length) { }\r\n        //public static void Sort<T>(T[] array, int index, int length, IComparer<T> comparer){}\r\n        //public static bool TrueForAll<T>(T[] array, Predicate<T> match){}\r\n\t}\r\n\t\r\n\t//String\r\n    public sealed class String : Object\r\n    {\r\n\t\tpublic static readonly string Empty{}\r\n\r\n\t\t//public String(char* value){}\r\n\t\tpublic String(char[] value){}\r\n\t\t//public String(sbyte* value){}\r\n\t\tpublic String(char c, int count){}\r\n\t\t//public String(char* value, int startIndex, int length){}\r\n\t\tpublic String(char[] value, int startIndex, int length){}\r\n\t\t//public String(sbyte* value, int startIndex, int length){}\r\n\t\t//public String(sbyte* value, int startIndex, int length, Encoding enc){}\r\n\r\n//\t    COMPILER ERROR : overloading not supported yet. Functions are implemented though.\r\n//\t\tpublic static bool operator !=(string a, string b){}\r\n//\t\tpublic static bool operator ==(string a, string b){}\r\n\r\n\t\tpublic int Length { get{} }\r\n\r\n\t\tpublic char this[int index] { get{} }\r\n\r\n\t\tpublic Object Clone(){}\r\n\t\tpublic static int Compare(string strA, string strB){}\r\n\t\tpublic static int Compare(string strA, string strB, bool ignoreCase){}\r\n\t\t//public static int Compare(string strA, string strB, StringComparison comparisonType){}\r\n\t\t//public static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture){}\r\n\t\t//public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options){}\r\n\t\t//public static int Compare(string strA, int indexA, string strB, int indexB, int length){}\r\n\t\t//public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase){}\r\n\t\t//public static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType){}\r\n\t\t//public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture){}\r\n\t\t//public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options){}\r\n\t\t//public static int CompareOrdinal(string strA, string strB){}\r\n\t\t//public static int CompareOrdinal(string strA, int indexA, string strB, int indexB, int length){}\r\n\t\tpublic int CompareTo(Object value){}\r\n\t\tpublic int CompareTo(string strB){}\r\n\t\t//public static string Concat(IEnumerable<string> values){}\r\n\t\t//public static string Concat<T>(IEnumerable<T> values){}\r\n\t\tpublic static string Concat(Object arg0){}\r\n\t\tpublic static string Concat(/*params*/ Object[] args){}\r\n\t\tpublic static string Concat(/*params*/ string[] values){}\r\n\t\t//public static string Concat(Object arg0, Object arg1){}\r\n\t\t//public static string Concat(string str0, string str1){}\r\n\t\t//public static string Concat(Object arg0, Object arg1, Object arg2){}\r\n\t\t//public static string Concat(string str0, string str1, string str2){}\r\n\t\t//public static string Concat(Object arg0, Object arg1, Object arg2, Object arg3){}\r\n\t\t//public static string Concat(string str0, string str1, string str2, string str3){}\r\n\t\tpublic bool Contains(string value){}\r\n\t\tpublic static string Copy(string str){}\r\n\t\tpublic void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count){}\r\n\t\tpublic bool EndsWith(string value){}\r\n\t\t//public bool EndsWith(string value, StringComparison comparisonType){}\r\n\t\t//public bool EndsWith(string value, bool ignoreCase, CultureInfo culture){}\r\n\t\tpublic override bool Equals(Object obj){}\r\n\t\tpublic bool Equals(string value){}\r\n\t\tpublic static bool Equals(string a, string b){}\r\n\t\tpublic bool Equals(string value, StringComparison comparisonType){}\r\n\t\t//public static bool Equals(string a, string b, StringComparison comparisonType){}\r\n\t\t//public static string Format(string format, Object arg0){}\r\n\t\t//public static string Format(string format, params Object[] args){}\r\n\t\t//public static string Format(IFormatProvider provider, string format, params Object[] args){}\r\n\t\t//public static string Format(string format, Object arg0, Object arg1){}\r\n\t\t//public static string Format(string format, Object arg0, Object arg1, Object arg2){}\r\n\t\t//public CharEnumerator GetEnumerator(){}\r\n\t\tpublic override int GetHashCode(){}\r\n\t\t//public TypeCode GetTypeCode(){}\r\n\t\tpublic int IndexOf(char value){}\r\n\t\tpublic int IndexOf(string value){}\r\n\t\tpublic int IndexOf(char value, int startIndex){}\r\n\t\tpublic int IndexOf(string value, int startIndex){}\r\n\t\t//public int IndexOf(string value, StringComparison comparisonType){}\r\n\t\tpublic int IndexOf(char value, int startIndex, int count){}\r\n\t\tpublic int IndexOf(string value, int startIndex, int count){}\r\n\t\t//public int IndexOf(string value, int startIndex, StringComparison comparisonType){}\r\n\t\t//public int IndexOf(string value, int startIndex, int count, StringComparison comparisonType){}\r\n\t\tpublic int IndexOfAny(char[] anyOf){}\r\n\t\tpublic int IndexOfAny(char[] anyOf, int startIndex){}\r\n\t\tpublic int IndexOfAny(char[] anyOf, int startIndex, int count){}\r\n\t\tpublic string Insert(int startIndex, string value){}\r\n\t\t//public static string Intern(string str){}\r\n\t\t//public static string IsInterned(string str){}\r\n\t\t//public bool IsNormalized(){}\r\n\t\t//public bool IsNormalized(NormalizationForm normalizationForm){}\r\n\t\tpublic static bool IsNullOrEmpty(string value){}\r\n\t\t//public static bool IsNullOrWhiteSpace(string value){}\r\n\t\t//public static string Join(string separator, IEnumerable<string> values){}\r\n\t\t//public static string Join<T>(string separator, IEnumerable<T> values){}\r\n\t\t//public static string Join(string separator, params Object[] values){}\r\n\t\tpublic static string Join(string separator, /*params*/ string[] value){}\r\n\t\tpublic static string Join(string separator, string[] value, int startIndex, int count){}\r\n\t\tpublic int LastIndexOf(char value){}\r\n\t\tpublic int LastIndexOf(string value){}\r\n\t\tpublic int LastIndexOf(char value, int startIndex){}\r\n\t\tpublic int LastIndexOf(string value, int startIndex){}\r\n\t\t//public int LastIndexOf(string value, StringComparison comparisonType){}\r\n\t\tpublic int LastIndexOf(char value, int startIndex, int count){}\r\n\t\tpublic int LastIndexOf(string value, int startIndex, int count){}\r\n\t\t//public int LastIndexOf(string value, int startIndex, StringComparison comparisonType){}\r\n\t\t//public int LastIndexOf(string value, int startIndex, int count, StringComparison comparisonType){}\r\n\t\tpublic int LastIndexOfAny(char[] anyOf){}\r\n\t\tpublic int LastIndexOfAny(char[] anyOf, int startIndex){}\r\n\t\tpublic int LastIndexOfAny(char[] anyOf, int startIndex, int count){}\r\n\t\t//public string Normalize(){}\r\n\t\t//public string Normalize(NormalizationForm normalizationForm){}\r\n\t\tpublic string PadLeft(int totalWidth){}\r\n\t\tpublic string PadLeft(int totalWidth, char paddingChar){}\r\n\t\tpublic string PadRight(int totalWidth){}\r\n\t\tpublic string PadRight(int totalWidth, char paddingChar){}\r\n\t\tpublic string Remove(int startIndex){}\r\n\t\tpublic string Remove(int startIndex, int count){}\r\n\t\tpublic string Replace(char oldChar, char newChar){}\r\n\t\tpublic string Replace(string oldValue, string newValue){}\r\n\t\tpublic string[] Split(/*params*/char[] separator){}\r\n\t\tpublic string[] Split(char[] separator, int count){}\r\n\t\tpublic string[] Split(char[] separator, StringSplitOptions options){}\r\n\t\tpublic string[] Split(string[] separator, StringSplitOptions options){}\r\n\t    public string[] Split(char[] separator, int count, StringSplitOptions options){}\r\n\t\tpublic string[] Split(string[] separator, int count, StringSplitOptions options){}\r\n\t\tpublic bool StartsWith(string value){}\r\n\t\t//public bool StartsWith(string value, StringComparison comparisonType){}\r\n\t\t//public bool StartsWith(string value, bool ignoreCase, CultureInfo culture){}\r\n\t\tpublic string Substring(int startIndex){}\r\n\t\tpublic string Substring(int startIndex, int length){}\r\n\t\tpublic char[] ToCharArray(){}\r\n\t\tpublic char[] ToCharArray(int startIndex, int length){}\r\n\t\tpublic string ToLower(){}\r\n\t\t//public string ToLower(CultureInfo culture){}\r\n\t\t//public string ToLowerInvariant(){}\r\n\t\tpublic override string ToString(){}\r\n\t\t//public string ToString(IFormatProvider provider){}\r\n\t\tpublic string ToUpper(){}\r\n\t\t//public string ToUpper(CultureInfo culture){}\r\n\t\t//public string ToUpperInvariant(){}\r\n\t\tpublic string Trim(){}\r\n\t\tpublic string Trim(/*params*/ char[] trimChars){}\r\n\t\tpublic string TrimEnd(/*params*/ char[] trimChars = null){}\r\n\t\tpublic string TrimStart(/*params*/ char[] trimChars = null){}\r\n    }\r\n\t\r\n\tpublic enum StringComparison\r\n\t{\r\n\t\tCurrentCulture = 0,\r\n\t\tCurrentCultureIgnoreCase = 1,\r\n\t\tInvariantCulture = 2,\r\n\t\tInvariantCultureIgnoreCase = 3,\r\n\t\tOrdinal = 4,\r\n\t\tOrdinalIgnoreCase = 5,\r\n\t}\r\n\r\n\tpublic enum StringSplitOptions\r\n\t{\r\n\t\tNone = 0,\r\n\t\tRemoveEmptyEntries = 1,\r\n\t}\r\n\t\r\n\t//Collections\r\n\tnamespace Collections {\r\n\t\tpublic class IEnumerator\r\n\t\t{\r\n\t\t\t//public virtual bool MoveNext(){}\r\n\t\t\t//public virtual void Reset(){}\r\n\t\t}\r\n\r\n\t\tpublic class IEnumerable\r\n\t\t{\r\n\t\t\t//public virtual IEnumerator* GetEnumerator(){}\r\n\t\t}\r\n\t\t\r\n\t\tnamespace Generic {\r\n            public class IEnumerator</*out*/T> {}\r\n\t\t\tpublic class IEnumerable </*out*/T> {}\r\n            public class IComparer </*in*/T> {}\r\n\t\t\t\r\n\t\t\tpublic class List<T> : Object\r\n\t\t\t{\r\n\t\t\t\tpublic List(){}\r\n\t\t\t\t//public List(IEnumerable<T> collection){}\r\n\t\t\t\tpublic List(int capacity){}\r\n\t\t\t\tpublic int Capacity { get{} set{} }\r\n\t\t\t\tpublic int Count { get{} }\r\n\t\t\t\tpublic T this[int index] { get{} set{} }\r\n\t\t\t\tpublic void Add(T item){}\r\n\t\t\t\t//public void AddRange(IEnumerable<T> collection){}\r\n\t\t\t\t//public ReadOnlyCollection<T> AsReadOnly(){}\r\n\t\t\t\tpublic int BinarySearch(T item){}\r\n\t\t\t\t//public int BinarySearch(T item, IComparer<T> comparer){}\r\n\t\t\t\t//public int BinarySearch(int index, int count, T item, IComparer<T> comparer){}\r\n\t\t\t\tpublic void Clear(){}\r\n\t\t\t\tpublic bool Contains(T item){}\r\n\t\t\t\t//public List<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter){}\r\n\t\t\t\tpublic void CopyTo(T[] array){}\r\n\t\t\t\tpublic void CopyTo(T[] array, int arrayIndex){}\r\n\t\t\t\tpublic void CopyTo(int index, T[] array, int arrayIndex, int count){}\r\n\t\t\t\t//public bool Exists(Predicate<T> match){}\r\n\t\t\t\t//public T Find(Predicate<T> match){}\r\n\t\t\t\t//public List<T> FindAll(Predicate<T> match){}\r\n\t\t\t\t//public int FindIndex(Predicate<T> match){}\r\n\t\t\t\t//public int FindIndex(int startIndex, Predicate<T> match){}\r\n\t\t\t\t//public int FindIndex(int startIndex, int count, Predicate<T> match){}\r\n\t\t\t\t//public T FindLast(Predicate<T> match){}\r\n\t\t\t\t//public int FindLastIndex(Predicate<T> match){}\r\n\t\t\t\t//public int FindLastIndex(int startIndex, Predicate<T> match){}\r\n\t\t\t\t//public int FindLastIndex(int startIndex, int count, Predicate<T> match){}\r\n\t\t\t\t//public void ForEach(Action<T> action){}\r\n\t\t\t\t//public List<T>.Enumerator GetEnumerator(){}\r\n\t\t\t\tpublic List<T> GetRange(int index, int count){}\r\n\t\t\t\tpublic int IndexOf(T item){}\r\n\t\t\t\tpublic int IndexOf(T item, int index){}\r\n\t\t\t\tpublic int IndexOf(T item, int index, int count){}\r\n\t\t\t\tpublic void Insert(int index, T item){}\r\n\t\t\t\t//public void InsertRange(int index, IEnumerable<T> collection){}\r\n\t\t\t\tpublic int LastIndexOf(T item){}\r\n\t\t\t\tpublic int LastIndexOf(T item, int index){}\r\n\t\t\t\tpublic int LastIndexOf(T item, int index, int count){}\r\n\t\t\t\tpublic bool Remove(T item){}\r\n\t\t\t\t//public int RemoveAll(Predicate<T> match){}\r\n\t\t\t\tpublic void RemoveAt(int index){}\r\n\t\t\t\tpublic void RemoveRange(int index, int count){}\r\n\t\t\t\tpublic void Reverse(){}\r\n\t\t\t\tpublic void Reverse(int index, int count){}\r\n\t\t        public void Sort(){}\r\n\t\t\t\t//public void Sort(Comparison<T> comparison){}\r\n\t\t\t\t//public void Sort(IComparer<T> comparer){}\r\n\t\t\t\t//public void Sort(int index, int count, IComparer<T> comparer){}\r\n\t\t\t\tpublic T[] ToArray(){}\r\n\t\t\t\tpublic void TrimExcess(){}\r\n\t\t\t\t//public bool TrueForAll(Predicate<T> match){}\r\n                //public struct Enumerator\r\n                //{\r\n                //    public T Current { get{} }\r\n                //    public void Dispose(){}\r\n                //    public bool MoveNext(){}\r\n                //}\r\n\t\t\t}\r\n            public class Dictionary<TKey, TValue> : Object\r\n            {\r\n                public Dictionary() { }\r\n                //public Dictionary(IDictionary<TKey, TValue> dictionary);\r\n                //public Dictionary(IEqualityComparer<TKey> comparer);\r\n                public Dictionary(int capacity) { }\r\n                //public Dictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer);\r\n                //public Dictionary(int capacity, IEqualityComparer<TKey> comparer);\r\n                //protected Dictionary(SerializationInfo info, StreamingContext context);\r\n                \r\n                //public IEqualityComparer<TKey> Comparer { get; }\r\n                public int Count { get { } }\r\n                //public Dictionary<TKey, TValue>.KeyCollection Keys { get; }\r\n                //public Dictionary<TKey, TValue>.ValueCollection Values { get; }\r\n\r\n                public TValue this[TKey key] { get { } set { } }\r\n\r\n                public void Add(TKey key, TValue value) { }\r\n                public void Clear() { }\r\n                public bool ContainsKey(TKey key) { }\r\n                public bool ContainsValue(TValue value) { }\r\n                //public Dictionary<TKey, TValue>.Enumerator GetEnumerator();\r\n                //public virtual void GetObjectData(SerializationInfo info, StreamingContext context);\r\n                //public virtual void OnDeserialization(object sender);\r\n                public bool Remove(TKey key) { }\r\n                public bool TryGetValue(TKey key, out TValue value) { }\r\n\r\n                //public sealed class KeyCollection \r\n                //{\r\n                //    public KeyCollection(Dictionary<TKey, TValue> dictionary);\r\n                    \r\n                //    public int Count { get; }\r\n                    \r\n                //    public void CopyTo(TKey[] array, int index);\r\n                //    public Dictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator()\r\n                    \r\n                //    public struct Enumerator\r\n                //    {\r\n                //        public TKey Current { get; }\r\n                        \r\n                //        public void Dispose();\r\n                //        public bool MoveNext();\r\n                //    }\r\n                //}\r\n\r\n                //public sealed class ValueCollection\r\n                //{\r\n                //    public ValueCollection(Dictionary<TKey, TValue> dictionary);\r\n                    \r\n                //    public int Count { get; }\r\n                    \r\n                //    public void CopyTo(TValue[] array, int index);\r\n                //    public Dictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator();\r\n                    \r\n                //    public struct Enumerator\r\n                //    {\r\n                //        public TValue Current { get; }\r\n                        \r\n                //        public void Dispose();\r\n                //        public bool MoveNext();\r\n                //    }\r\n                //}\r\n\r\n                //public struct Enumerator\r\n                //{\r\n                //    public KeyValuePair<TKey, TValue> Current { get; }\r\n                    \r\n                //    public void Dispose();\r\n                //    public bool MoveNext();\r\n                //}\r\n            }\r\n\t\t\t\r\n\t\t\tpublic class KeyNotFoundException : Exception { }\r\n\t\t}\r\n\t}\r\n\r\n    public static class Console\r\n    {\r\n        //public static ConsoleColor BackgroundColor { get{} set{} }\r\n        //public static int BufferHeight { get{} set{} }\r\n        //public static int BufferWidth { get{} set{} }\r\n        //public static bool CapsLock { get{} }\r\n        //public static int CursorLeft { get{} set{} }\r\n        //public static int CursorSize { get{} set{} }\r\n        //public static int CursorTop { get{} set{} }\r\n        //public static bool CursorVisible { get{} set{} }\r\n        //public static TextWriter Error { get{} }\r\n        //public static ConsoleColor ForegroundColor { get{} set{} }\r\n        //public static TextReader In { get{} }\r\n        //public static Encoding InputEncoding { get{} set{} }\r\n        //public static bool KeyAvailable { get{} }\r\n        //public static int LargestWindowHeight { get{} }\r\n        //public static int LargestWindowWidth { get{} }\r\n        //public static bool NumberLock { get{} }\r\n        //public static TextWriter Out { get{} }\r\n        //public static Encoding OutputEncoding { get{} set{} }\r\n        //public static string Title { get{} set{} }\r\n        //public static bool TreatControlCAsInput { get{} set{} }\r\n        //public static int WindowHeight { get{} set{} }\r\n        //public static int WindowLeft { get{} set{} }\r\n        //public static int WindowTop { get{} set{} }\r\n        //public static int WindowWidth { get{} set{} }\r\n\r\n        //public static event ConsoleCancelEventHandler CancelKeyPress{}\r\n\r\n        //public static void Beep(){}\r\n        //public static void Beep(int frequency, int duration){}\r\n        //public static void Clear(){}\r\n        //public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop){}\r\n        //public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor){}\r\n        //public static Stream OpenStandardError(){}\r\n        //public static Stream OpenStandardError(int bufferSize){}\r\n        //public static Stream OpenStandardInput(){}\r\n        //public static Stream OpenStandardInput(int bufferSize){}\r\n        //public static Stream OpenStandardOutput(){}\r\n        //public static Stream OpenStandardOutput(int bufferSize){}\r\n        //public static int Read(){}\r\n        //public static ConsoleKeyInfo ReadKey(){}\r\n        //public static ConsoleKeyInfo ReadKey(bool intercept){}\r\n        //public static string ReadLine(){}\r\n        //public static void ResetColor(){}\r\n        //public static void SetBufferSize(int width, int height){}\r\n        //public static void SetCursorPosition(int left, int top){}\r\n        //public static void SetError(TextWriter newError){}\r\n        //public static void SetIn(TextReader newIn){}\r\n        //public static void SetOut(TextWriter newOut){}\r\n        //public static void SetWindowPosition(int left, int top){}\r\n        //public static void SetWindowSize(int width, int height){}\r\n        public static void Write(bool value) { }\r\n        public static void Write(char value) { }\r\n        public static void Write(char[] buffer) { }\r\n        //public static void Write(decimal value) { }\r\n        public static void Write(double value) { }\r\n        public static void Write(float value) { }\r\n        public static void Write(int value) { }\r\n        public static void Write(long value) { }\r\n        public static void Write(object value) { }\r\n        public static void Write(string value) { }\r\n        public static void Write(uint value) { }\r\n        public static void Write(ulong value) { }\r\n        //public static void Write(string format, object arg0) { }\r\n        //public static void Write(string format, /*params*/ object[] arg) { }\r\n        //public static void Write(char[] buffer, int index, int count) { }\r\n        //public static void Write(string format, object arg0, object arg1) { }\r\n        //public static void Write(string format, object arg0, object arg1, object arg2) { }\r\n        //public static void Write(string format, object arg0, object arg1, object arg2, object arg3) { }\r\n        public static void WriteLine() { }\r\n        public static void WriteLine(bool value) { }\r\n        public static void WriteLine(char value) { }\r\n        public static void WriteLine(char[] buffer) { }\r\n        //public static void WriteLine(decimal value) { }\r\n        public static void WriteLine(double value) { }\r\n        public static void WriteLine(float value) { }\r\n        public static void WriteLine(int value) { }\r\n        public static void WriteLine(long value) { }\r\n        public static void WriteLine(object value) { }\r\n        public static void WriteLine(string value) { }\r\n        public static void WriteLine(uint value) { }\r\n        public static void WriteLine(ulong value) { }\r\n        //public static void WriteLine(string format, object arg0) { }\r\n        //public static void WriteLine(string format, /*params*/ object[] arg) { }\r\n        public static void WriteLine(char[] buffer, int index, int count) { }\r\n        //public static void WriteLine(string format, object arg0, object arg1) { }\r\n        //public static void WriteLine(string format, object arg0, object arg1, object arg2) { }\r\n        //public static void WriteLine(string format, object arg0, object arg1, object arg2, object arg3) { }\r\n    }\r\n\r\n\tpublic abstract class Attribute : _Attribute {}\r\n\t\r\n\tnamespace Runtime {\r\n\t\tnamespace InteropServices {\r\n\t\t\tpublic interface _Attribute {}\r\n\t\t\r\n\t\t\tpublic enum CharSet\r\n\t\t\t{\r\n\t\t\t\tNone = 1,\r\n\t\t\t\tAnsi = 2,\r\n\t\t\t\tUnicode = 3,\r\n\t\t\t\tAuto = 4,\r\n\t\t\t}\r\n\t\t\r\n\t\t\tpublic enum LayoutKind\r\n\t\t\t{\r\n\t\t\t\tSequential = 0,\r\n\t\t\t\tExplicit = 2,\r\n\t\t\t\tAuto = 3,\r\n\t\t\t}\r\n\t\t\r\n\t\t\tpublic static class Marshal {\r\n\t\t\t\tpublic static int ReadInt32(IntPtr ptr) {}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpublic sealed class StructLayoutAttribute : Attribute\r\n\t\t\t{\r\n\t\t\t\tpublic CharSet CharSet {}\r\n\t\t\t\tpublic int Pack {}\r\n\t\t\t\tpublic int Size {}\r\n\t\t\t\t\r\n\t\t\t\tpublic StructLayoutAttribute(LayoutKind layoutKind) {}\r\n\t\t\t\tpublic StructLayoutAttribute(short layoutKind) {}\r\n\t\t\t\t\r\n\t\t\t\tpublic LayoutKind Value { get {} }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic interface IDisposable {}\r\n\tpublic interface ICloneable {}\r\n\t\r\n\tpublic abstract class Delegate : Object\r\n\t{\r\n\t\t//protected Delegate(object target, string method) { }\r\n        //protected Delegate(Type target, string method) { }\r\n\t    \r\n        //public static bool operator !=(Delegate d1, Delegate d2) { } \r\n        //public static bool operator ==(Delegate d1, Delegate d2) { }\r\n        \r\n        //public MethodInfo Method { get { } }\r\n        //public object Target { get { } }\r\n        \r\n        //public virtual object Clone() { }\r\n        //public static Delegate Combine(params Delegate[] delegates) { }\r\n        //public static Delegate Combine(Delegate a, Delegate b) { }\r\n        //protected virtual Delegate CombineImpl(Delegate d) { }\r\n        //public static Delegate CreateDelegate(Type type, MethodInfo method) { }\r\n        //public static Delegate CreateDelegate(Type type, MethodInfo method, bool throwOnBindFailure) { }\r\n        //public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method) { }\r\n        //public static Delegate CreateDelegate(Type type, object target, string method) { }\r\n        //public static Delegate CreateDelegate(Type type, Type target, string method) { }\r\n        //public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method, bool throwOnBindFailure) { }\r\n        //public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase) { }\r\n        //public static Delegate CreateDelegate(Type type, Type target, string method, bool ignoreCase) { }\r\n        //public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure) { }\r\n        //public static Delegate CreateDelegate(Type type, Type target, string method, bool ignoreCase, bool throwOnBindFailure) { }\r\n        //public object DynamicInvoke(params object[] args) { }\r\n        //protected virtual object DynamicInvokeImpl(object[] args) { }\r\n        //public override bool Equals(object obj) { }\r\n        //public override int GetHashCode() { }\r\n        //public virtual Delegate[] GetInvocationList() { }\r\n        //protected virtual MethodInfo GetMethodImpl() { }\r\n        //public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { }\r\n        //public static Delegate Remove(Delegate source, Delegate value) { }\r\n        //public static Delegate RemoveAll(Delegate source, Delegate value) { }\r\n        //protected virtual Delegate RemoveImpl(Delegate d) { }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/targetver.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#pragma once\r\n\r\n// Including SDKDDKVer.h defines the highest available Windows platform.\r\n\r\n// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and\r\n// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.\r\n\r\n#include <SDKDDKVer.h>\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/unistd.h",
    "content": ""
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/CompilerProject/y.tab.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef Y_TAB_H\r\n#define Y_TAB_H\r\n\r\n#include \"compilerLibrary.h\"\r\n\r\nextern \"C\" {\r\n\t#ifndef YYSTYPE\r\n\r\n\tstruct yystype {\r\n\t\tAttribute*\tattribute;\r\n\t\tExpression*\texpr;\r\n\t\tconst char* text;\r\n\t\tTypeObject*\ttype;\r\n\t\tStatement*\tstatement;\r\n\t\tVariable*\tvariable;\r\n\t\tAccessor*\taccessor;\r\n\t\tIndexer*\tindexer;\r\n\t\tQuals*\t\tquals;\r\n\t\tSValue\t\tvalue;\r\n\t\tint\t\t\ttmpValue;\r\n\t\tvoid*\t\tptr;\r\n\t};\r\n\t#define YYSTYPE yystype\r\n\r\n\textern YYSTYPE yylval;\r\n}\r\n\r\n#endif\r\n\r\nvoid\terror\t\t\t\t(const char* msg,...);\r\nint\t\trunCompiler\t\t\t(const char* stream);\r\n\r\n#endif /* Y_TAB_H */\r\n"
  },
  {
    "path": "CSharpVersion/CSharp_CPPCompiler/Compiler_Limitations.txt",
    "content": "###############################\r\n#   C# Compiler Limitations   #\r\n###############################\r\n\r\n\r\nNOT SUPPORTED\r\n\r\n- foreach\r\n- auto-properties\r\n- operator overloading\r\n- generic delegates\r\n- events\r\n- typeof()\r\n- sizeof()\r\n- interface explicit implementation (eg public void InterfaceA.Method(); declaration)\r\n- named arguments (eg MethodCall(param2: 24, param1: \"value\"))\r\n- switch(string) statements\r\n- new operator with structures or base types\r\n- Non integer enums\r\n- += with strings\r\n- Non-array object initializers\r\n- Several methods for one delegate\r\n- Enums with Console.Write, Console.WriteLine and string concatenation\r\n- methodA(methodB) call, where methodB is overloaded (double overloading)\r\n- \"this()\" in constructor initialisation\r\n- params\r\n- IS operator with non pointer types\r\n- AS operator with non pointer types\r\n- list of boolean expressions which can be misunderstood as a generic (eg method(a<b,c>d))\r\n- unicode prefix (\\u)\r\n- Decimal type\r\n- unsafe blocks\r\n- checked / unchecked\r\n- *, & and -> operators\r\n- stackalloc\r\n- lock\r\n- fixed\r\n- Conditional operator (? :) with functions passed as a delegate\r\n\r\n\r\nRESTRICTIONS\r\n\r\n- Only part of the System classes and methods is supported (see supported.cs)\r\n- \"using\" can only be used with namespaces\r\n- Struct Marshalling\r\n\t> By references only\r\n\t> Must use attributes\r\n\t> StructLayout(LayoutKind.Sequential, Pack = 1) only\r\n- Cdecl is the only supported call convention\r\n- If the source file contains Japanese characters, its encoding needs to be UTF8 without BOM."
  },
  {
    "path": "CSharpVersion/EnginePrototype/EnginePrototypeCS.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">x86</Platform>\r\n    <ProductVersion>10.0.0</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{82172820-045A-4210-88EC-466042522A57}</ProjectGuid>\r\n    <OutputType>Library</OutputType>\r\n    <RootNamespace>EnginePrototype</RootNamespace>\r\n    <AssemblyName>MyCSharpLibForWindows</AssemblyName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x86' \">\r\n    <DebugSymbols>True</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>False</Optimize>\r\n    <OutputPath>bin\\Debug</OutputPath>\r\n    <DefineConstants>DEBUG;</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <Externalconsole>True</Externalconsole>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|x86' \">\r\n    <DebugType>none</DebugType>\r\n    <Optimize>True</Optimize>\r\n    <OutputPath>bin\\Release</OutputPath>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ConsolePause>False</ConsolePause>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <StartupObject />\r\n  </PropertyGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n  <ItemGroup>\r\n    <Compile Include=\"FrameworkCore\\GameObjectFactory.cs\" />\r\n    <Compile Include=\"FrameworkCore\\NodeIterator.cs\" />\r\n    <Compile Include=\"FrameworkCore\\Utils.cs\" />\r\n    <Compile Include=\"Libs\\CSRES.cs\" />\r\n    <Compile Include=\"Libs\\CSLang.cs\" />\r\n    <Compile Include=\"Libs\\CSGL.cs\" />\r\n    <Compile Include=\"Libs\\CSUI.cs\" />\r\n    <Compile Include=\"Libs\\CSAPP.cs\" />\r\n    <Compile Include=\"Libs\\CSAsset.cs\" />\r\n    <Compile Include=\"Libs\\CSData.cs\" />\r\n    <Compile Include=\"Libs\\CSDB.cs\" />\r\n    <Compile Include=\"Libs\\CSSystem.cs\" />\r\n    <Compile Include=\"Libs\\CSEng.cs\" />\r\n    <Compile Include=\"Libs\\CSDebug.cs\" />\r\n    <Compile Include=\"Libs\\CSKey.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBTask.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBGenericTask.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBIntervalTimer.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBNetApi.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUICanvas.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIFreeVertItem.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIGroup.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIPolyline.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIProgressBar.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIScale9.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIScore.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIScrollBar.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUISimpleItem.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUISWFPlayer.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUITask.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUITextInput.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIVirtualDoc.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIWebArea.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIDragIcon.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIForm.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUILabel.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIList.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIMoviePlayer.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIMultiImgItem.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIPieChart.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIRubberBand.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIControl.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIVariableItem.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBStoreService.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBAsyncLoader.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIDebugItem.cs\" />\r\n    <Compile Include=\"FrameworkCore\\CKLBException.cs\" />\r\n    <Compile Include=\"FrameworkCore\\NativeManagement.cs\" />\r\n    <Compile Include=\"FrameworkCore\\WrapperReg.cs\" />\r\n    <Compile Include=\"FrameworkCore\\GameObject.cs\" />\r\n    <Compile Include=\"Libs\\CSFont.cs\" />\r\n    <Compile Include=\"Libs\\CSSound.cs\" />\r\n    <Compile Include=\"Libs\\CSMatrix.cs\" />\r\n    <Compile Include=\"Libs\\CSBin.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUITouchPad.cs\" />\r\n    <Compile Include=\"Wrappers\\CKLBUIClip.cs\" />\r\n    <Compile Include=\"Wrappers\\IAmADocClass.cs\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n  </ItemGroup>\r\n  <ItemGroup />\r\n</Project>"
  },
  {
    "path": "CSharpVersion/EnginePrototype/EnginePrototypeCS.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 11.00\r\n# Visual Studio 2010\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"EnginePrototypeCS\", \"EnginePrototypeCS.csproj\", \"{82172820-045A-4210-88EC-466042522A57}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Debug|x86.ActiveCfg = Debug|x86\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Debug|x86.Build.0 = Debug|x86\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Release|x86.ActiveCfg = Release|x86\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Release|x86.Build.0 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(MonoDevelopProperties) = preSolution\r\n\t\tStartupItem = EnginePrototypeCS.csproj\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/CKLBException.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    /// <summary>\r\n    /// Generic exception.\r\n    /// </summary>\r\n\tpublic class CKLBException : Exception\r\n\t{\r\n\t\tpublic CKLBException(String msg = \"\") : base(msg)\r\n\t\t{\r\n\t\t}\r\n\t}\r\n\r\n    /// <summary>\r\n    /// Design a class or method which is not implemented yet.\r\n    /// </summary>\r\n\tpublic class CKLBExceptionNotImplemented : CKLBException\r\n\t{\r\n\t\tpublic CKLBExceptionNotImplemented(String msg = \"Not implemented\") : base(msg)\r\n\t\t{\r\n\t\t}\r\n\t}\r\n\r\n    /// <summary>\r\n    /// Design a method which cannot not be used.\r\n    /// </summary>\r\n\tpublic class CKLBExceptionForbiddenMethod : CKLBException\r\n\t{\r\n\t\tpublic CKLBExceptionForbiddenMethod(String msg = \"Forbidden Method\") : base(msg)\r\n\t\t{\r\n\t\t}\r\n\t}\r\n\r\n    /// <summary>\r\n    /// Used when an object tries to use a method on its C++ object when the CppObject pointer is null.\r\n    /// </summary>\r\n\tpublic class CKLBExceptionNullCppObject : CKLBException\r\n\t{\r\n\t\tpublic CKLBExceptionNullCppObject(String msg = \"Null CppObject Pointer.\") : base(msg)\r\n\t\t{\r\n\t\t}\r\n\t}\r\n\r\n    /// <summary>\r\n    /// Used when an iterator or a related object is used whereas it is too old to be used.\r\n    /// That means you must create another one.\r\n    /// </summary>\r\n    public class CKLBExceptionTooOld : CKLBException\r\n    {\r\n\t\tpublic CKLBExceptionTooOld(String msg = \"Use iterator or related object created in a different time frame / call back.\") : base(msg)\r\n\t\t{\r\n\t\t}\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/GameObject.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\r\n    /// <summary>\r\n    /// GameObject is the most generic class of the C# framework.\r\n    /// All wrappers inherit this class.\r\n    /// Each GameObject can be bound to 1 and only 1 C++ object.\r\n    /// The default behavior is to bind directly when instantiating a C# object, \r\n    /// but it is also possible to create an empty C# object (without C++ object bound)\r\n    /// and to bind it later.\r\n    /// \r\n    /// GameObject is IDisposable,\r\n    /// so you can call the Dipose() method to dispose it.\r\n    /// Override clearInternals() if needed. It is supposed to clear every single object\r\n    /// contained in the C# class.\r\n    /// \r\n    /// It can also register callbacks in the C++ Engine.\r\n    /// Take a look at the callbacks methods documentation for more details.\r\n    /// \r\n    /// It contains a handle, a typeID, a tag and a pointer to a CppObject.\r\n    /// \r\n    /// The handle is a unique uint which identifies the C# object.\r\n    /// It is given and registered in the C++ object when binding,\r\n    /// so the C++ object could identify the C# object bound with it.\r\n    /// \r\n    /// The typeID is used to verify that the C++ and the C# object are the same type,\r\n    /// and to authorize the binding or not.\r\n    /// </summary>\r\n\tpublic abstract class GameObject : IDisposable\r\n\t{\r\n\t\t#region DllImports\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBObjectScriptable_getScriptContext(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBObjectScriptable_setScriptContext(IntPtr p, uint handle);\r\n        #endregion\r\n\t\t\r\n\t\tpublic const uint NULLHANDLER = 0xffffffff;\r\n        public const uint NBCALLBACKS = 6;\r\n\t\t\r\n\t\tprivate Object m_tag;\r\n\t\tprivate uint m_typeID;\r\n\t\tprivate uint m_handle = NULLHANDLER;\r\n\t\tprivate IntPtr m_cppObject;\r\n\t\tprivate Delegate[] m_callbacksArray = new Delegate[NBCALLBACKS];\r\n\t\t\r\n         /// <summary>\r\n        /// User can associate any C# object to an object from our framework.\r\n        /// It is just used as a user storage linked to any engine classes instance.\r\n        /// It is never accessed, set or used by the framework.\r\n        /// </summary>\r\n       public Object Tag\r\n\t\t{\r\n\t\t\tget { return m_tag;}\r\n\t\t\tset { m_tag = value;}\r\n\t\t}\r\n        /// <summary>\r\n        /// Internal ID associated with engine classes.\r\n        /// Can be used for debugging or find a specific type for casting (less costly than typeof())\r\n        /// </summary>\r\n\t\tinternal uint TypeID\r\n\t\t{\r\n\t\t\tget { return m_typeID; }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n        /// <summary>\r\n        /// Internal ID mapping, replaces adress when the C# object is seen/accessed from C++. (C# object can change of adress)\r\n        /// </summary>\r\n\t\tinternal uint Handle\r\n\t\t{\r\n\t\t\tget { return m_handle; }\r\n\t\t\tset { m_handle = value; }\r\n\t\t}\r\n        /// <summary>\r\n        /// Pointer to the C++ Object as seen from C#. Stored as IntPtr for language convenience.\r\n        /// </summary>\r\n\t\tinternal IntPtr CppObject\r\n\t\t{\r\n\t\t\tget { return m_cppObject;}\r\n\t\t\tset { m_cppObject = value;}\r\n\t\t}\r\n\r\n        /// <summary>\r\n\t\t/// Know if the C# object is stand alone or binded to a engine C++ object.\r\n        /// </summary>\r\n\t\tpublic bool isBoundToCpp()\r\n\t\t{\r\n\t\t\treturn m_cppObject != IntPtr.Zero;\r\n\t\t}\r\n        /// <summary>\r\n        /// Game object constructor\r\n        /// It registers the typeID given in argument.\r\n        /// </summary>\r\n        /// <param name=\"typeID\">typeID of the C# object.</param>\r\n\t\tpublic GameObject(uint typeID)\r\n\t\t{\r\n            //Console.WriteLine(\"[C#] GameObject cctor BEGIN.\");\r\n            m_typeID = typeID;\r\n\t\t\tWrapperReg.getInstance().registerGameObject(this);\r\n            m_cppObject = IntPtr.Zero;\r\n            //Console.WriteLine(\"[C#] GameObject cctor END.\");\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Associates the C++ to the C# GameObject.\r\n\t\t/// </summary>\r\n\t\t/// <param name='cppObj'>\r\n\t\t/// Cpp object.\r\n\t\t/// </param>\r\n\t\tinternal void bind(IntPtr cppObj)\r\n\t\t{\r\n\t\t\tif(cppObj != IntPtr.Zero) {\r\n\t\t\t\tif(m_cppObject == IntPtr.Zero) {\r\n                    uint nativeHandle = CKLBObjectScriptable_getScriptContext(cppObj);\r\n\t\t\t\t\t// Is this object already bound ? if yes it must already have a Handle.\r\n\t\t\t\t\tif(nativeHandle == NULLHANDLER) {\r\n\t\t\t\t\t\tNativeManagement.registerWrapper(cppObj, m_handle);\r\n                        m_cppObject = cppObj;\r\n                        doSetupCallbacks();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthrow new CKLBException(\"This C++ object is already wrapped.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBException(\"This GameObject is already binded.\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBException(\"Impossible to bind a null pointer (It can be a failure on Engine side while creating C++ instance).\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Bind a GameObject to a C++ ObjectScriptable through its node name.\r\n        /// </summary>\r\n        /// <param name=\"nodeName\">Name of the Node to bind.</param>\r\n        public void bind(String nodeName)\r\n        {\r\n            if(nodeName == null)            { throw new CKLBException(\"Impossible to bind with a null name.\");  }\r\n            if(m_cppObject != IntPtr.Zero)  { throw new CKLBException(\"This GameObject is already binded.\");    }\r\n\r\n            NodeIterator nodeIterator = new NodeIterator(NativeManagement.getContextCounter(), NodeIterator.getRoot());\r\n            if(nodeIterator.find(nodeName)) {\r\n                IntPtr cppObj       = nodeIterator.getAsUITask().CppObject;\r\n                uint nativeHandle   = CKLBObjectScriptable_getScriptContext(cppObj);\r\n\r\n                if(nativeHandle == NULLHANDLER) {\r\n                    NativeManagement.registerWrapper(cppObj, m_handle);\r\n                    m_cppObject = cppObj;\r\n                    doSetupCallbacks();\r\n                } else {\r\n\t\t\t\t\tthrow new CKLBException(\"This C++ object is already wrapped.\");\r\n\t\t\t\t}\r\n            } else {\r\n                throw new CKLBException(\"There is not any Node with this name.\");\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Breaks the link between the C++ and the C# object.\r\n        /// </summary>\r\n        public void unbind()\r\n        {\r\n            Console.WriteLine(\"[C#] GameObject.unbind() BEGIN\");\r\n            if(m_cppObject != IntPtr.Zero) {\r\n                CKLBObjectScriptable_setScriptContext(m_cppObject, NULLHANDLER);\r\n                m_cppObject = IntPtr.Zero;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n            Console.WriteLine(\"[C#] GameObject.unbind() END\");\r\n        }\r\n\r\n        protected virtual void doSetupCallbacks() { }\r\n\r\n\t\t/// <summary>\r\n\t\t/// Clears the internal objects which won't be automatically destroyed.\r\n\t\t/// </summary>\r\n\t\tinternal virtual void clearInternals()    // Should be private, visible only from callers.\r\n\t\t{\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Dispose is called by the programmer to \"free\" the object.\r\n\t\t/// C# object instance stays alive but all internal data and ressources are freed.\r\n\t\t/// </summary>\r\n\t\tpublic virtual void Dispose() //\tInherited classes with unmanaged resources have to dispose them first.\r\n\t\t{\r\n\t\t\t//Console.WriteLine(\"[C#] \" + this + \" is disposing.\");\r\n            Console.WriteLine(\"[C#] GameObject.Dispose BEGIN\");\r\n\t\t\tclearInternals();\r\n\t\t\tif(m_handle != NULLHANDLER) {\r\n                WrapperReg.getInstance().unregisterGameObject(this);\r\n\t\t\t} \r\n            if(CppObject != IntPtr.Zero) {\r\n                unbind();\r\n            }\r\n\r\n            Console.WriteLine(\"[C#] GameObject.Dispose END\");\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Releases unmanaged resources and performs other cleanup operations before the\r\n\t\t/// <see cref=\"EnginePrototype.GameObject\"/> is reclaimed by garbage collection.\r\n        /// This method is called if the object has not been disposed with Dipose().\r\n\t\t/// </summary>\r\n\t\t~GameObject()\r\n\t\t{\r\n\t\t\t//Console.WriteLine(this + \" is dying\");\r\n\t\t\tDispose();\r\n\t\t}\r\n\r\n        // delegateName must have a null default value in daughter classes if only 1 delegate\r\n        /// <summary>\r\n        /// Set anyDelegate to the delegate designed by delegateName\r\n        /// Uses the different functions defined in daughter classes.\r\n        /// </summary>\r\n        /// <param name='anyDelegate'>\r\n        /// Object got from a delegate\r\n        /// </param>\r\n        /// <param name='delegateName'>\r\n        /// String designing the delegate name (if the class has only 1 delegate, it has a default value) \r\n        /// </param>\r\n        public virtual void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            throw new CKLBException(\"This class doesn't have any callback\");\r\n        }\r\n\r\n        /// <summary>\r\n        /// Static equivalent of setDelegate\r\n        /// </summary>\r\n        /// <param name='handle'>\r\n        /// handle of the object. Used to get the C# object associated.\r\n        /// </param>\r\n        /// <param name='anyDelegate'>\r\n        /// Object got from a delegate\r\n        /// </param>\r\n        /// <param name='delegateName'>\r\n        /// String designing the delegate name (if the class has only 1 delegate, it has a default value) \r\n        /// </param>\r\n        public static void staticSetDelegate(uint handle, Delegate delegatePtr, String delegateName)\r\n        {\r\n            WrapperReg.getInstance().getObjectFromHandle(handle).setDelegate(delegatePtr, delegateName);\r\n        }\r\n\r\n        /// <summary>\r\n        /// This function is called to setupCallbacks.\r\n        /// It gives the C++ Engine the pointer of the Virtual C# function which executes the delegate.\r\n        /// </summary>\r\n        /// <param name=\"delegateName\">delegate name</param>\r\n        protected void forceSetupCallBackWithVirtual(String delegateName = null)\r\n        {\r\n            setDelegate(null, delegateName);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers C# function pointer in C++ engine for the object designated by obj.\r\n        /// </summary>\r\n        /// <param name=\"obj\">C++ object pointer</param>\r\n        /// <param name=\"ptrFct\">function pointer</param>\r\n        /// <param name=\"index\">\r\n        /// index of the callback for multiple callbacks classes.\r\n        /// is 0 by default.\r\n        /// </param>\r\n        protected void registerCallBack(Delegate callback, uint index = 0)\r\n        {\r\n            if(0 <= index && index < NBCALLBACKS) {\r\n                if(callback != null) {\r\n                    //Console.WriteLine(\"[C#] - handle \"+ Handle +\" - callback[\" + index + \"] registered\");\r\n                    m_callbacksArray[index] = callback;\r\n                } else {\r\n                    throw new CKLBException(\"NULL function pointer.\");\r\n                }\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n\r\n        internal Delegate getCallBack(uint index)\r\n        {\r\n            //Console.WriteLine(\"[C#] getCallBack(\" + index + \") BEGIN\");\r\n            if(0 <= index && index < NBCALLBACKS) {\r\n                //Console.WriteLine(\"[C#] getCallBack(\" + index + \") END\");\r\n                Delegate d = m_callbacksArray[index];\r\n                //Console.WriteLine((d == null) ? \"NULL\" : \"NOT null\");\r\n                return d;\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (NBCALLBACKS - 1) + \".\");\r\n            }\r\n        }\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/GameObjectFactory.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    // TODO is internal class accessible from C++ ?\r\n    /// <summary>\r\n    /// GameObject Factory class.\r\n    /// Create a GameObject from its name.\r\n    /// It will be usefull to create C# wrappers from C++ Game Engine.\r\n    /// \r\n    /// It contains a <String, Type> Dictionary in order to be able to find a class type from its name.\r\n    /// So it is possible to get an instance of a specific class which inherits GameObject.\r\n    /// </summary>\r\n    internal static class GameObjectFactory\r\n    {\r\n        // Not used at the moment\r\n        /*private static Dictionary<String, Type> m_classes = new Dictionary<String,Type>();\r\n\r\n        internal static GameObject getInstanceFromName(String className)\r\n        {\r\n            try\r\n            {\r\n                Type t = m_classes[className];\r\n                return (GameObject)Activator.CreateInstance(t);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw ex;\r\n            }\r\n        }\r\n\r\n        internal static void registerType(String className, Type type) \r\n        {\r\n            Console.WriteLine(\"[C#] GameObjectFactory.registerType(\" + className + \", \" + type.ToString() +\") BEGIN\");\r\n            if(!m_classes.ContainsKey(className))\r\n            {\r\n                Console.WriteLine(\"[C#] GameObjectFactory.registerType add to m_classes\");\r\n                m_classes.Add(className, type);\r\n                Console.WriteLine(\"[C#] GameObjectFactory.registerType END\");\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(className + \" is already registered in GameObjectFactory\");\r\n            }\r\n        }*/\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/NativeManagement.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    /// <summary>\r\n    /// NativeManagement is a static class used to interact with C++.\r\n    /// It is able to register and unregister C# wrappers for each C++ object.\r\n    /// It also has a static method to destroy a C# wrapper directly\r\n    /// from the C++ Engine.\r\n    /// \r\n    /// The pointer of this static function must be sent to the C++ Engine \r\n    /// at the beginning of the program.\r\n    /// </summary>\r\n\tpublic static class NativeManagement\r\n\t{\r\n\t\t#region DllImports\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBObject_getTypeID(IntPtr p);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBObjectScriptable_getScriptContext(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBObjectScriptable_setScriptContext(IntPtr p, uint handle);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBScriptEnv_getCallBackCount();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBScriptEnv_getErrorPtr();\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBScriptEnv_getErrorString();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBScriptEnv_resetError();\r\n\t\t#endregion\r\n\r\n        public delegate void FunctionPointerV       ();\r\n\r\n        public delegate void FunctionPointerII      (int int_1, int int_2);\r\n        public delegate void FunctionPointerIII     (int int_1, int int_2, int int_3);\r\n        public delegate void FunctionPointerIIII    (int int_1, int int_2, int int_3, int int_4);\r\n\r\n        public delegate void FunctionPointerS       (IntPtr intptr_1);\r\n        public delegate void FunctionPointerSII     (IntPtr intptr_1, int int_1, int int_2);\r\n        public delegate void FunctionPointerSU      (IntPtr intptr_1, uint uint_1);\r\n        public delegate void FunctionPointerSS      (IntPtr intptr_1, IntPtr intptr_2);\r\n        public delegate void FunctionPointerUS      (uint uint_1, IntPtr intptr_1);\r\n        public delegate void FunctionPointerUSS     (uint uint_1, IntPtr intptr_1, IntPtr intptr_2);\r\n        \r\n        public delegate void FunctionPointerU       (uint uint_1);\r\n        public delegate void FunctionPointerUU      (uint uint_1, uint uint_2);\r\n        public delegate void FunctionPointerUFF     (uint uint_1, float float_1, float float_2);\r\n        public delegate void FunctionPointerUI      (uint uint_1, int int_1);\r\n        public delegate void FunctionPointerUII     (uint uint_1, int int_1, int int_2);\r\n        public delegate void FunctionPointerUIIII   (uint uint_1, int int_1, int int_2, int int_3, int int_4);\r\n        public delegate void FunctionPointerUIIUU   (uint uint_1, int int_1, int int_2, uint uint_2, uint uint_3);\r\n\r\n        public delegate void FunctionPointerUUII    (uint uint_1, uint uint_2, int int_1, int int_2);\r\n        public delegate void FunctionPointerUUUII   (uint uint_1, uint uint_2, uint uint_3, int int_1, int int_2);\r\n\r\n\t\tpublic delegate bool FunctionPointerIIIP_retB(int int_1, int int_2, int int_3, IntPtr obj_1);\r\n\r\n        public delegate void FunctionPointerFS      (float float_1, IntPtr intptr_1);\r\n\r\n        #region CppErrorHandling\r\n\r\n        /// <summary>\r\n        /// Pointer  to the global variable in Cpp.\r\n        /// This variable is set to 1 when an error has occured.\r\n        /// It is set to 0 when reset.\r\n        /// </summary>\r\n        private static IntPtr ms_cppErrorFlag = CKLBScriptEnv_getErrorPtr();\r\n        public static uint CppErrorFlag\r\n        {\r\n            get { return (uint)Marshal.ReadInt32(ms_cppErrorFlag); }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n        public static String CppErrorString\r\n        {\r\n            get\r\n            {\r\n                return __MarshallingUtils.StringFromNativeUtf8(CKLBScriptEnv_getErrorString());\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n        public static void resetCppError()\r\n        {\r\n            CKLBScriptEnv_resetError();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Raises an exception if there is an error in C++.\r\n        /// resetCppError() must be used before in order not to catch a previous error.\r\n        /// </summary>\r\n        public static void intercepCppError()\r\n        {\r\n            if(CppErrorFlag != 0) {\r\n                throw new CKLBException(\"Error from C++ Engine : \" + CppErrorString);\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        // Get Timer adress on startup.\r\n        private static IntPtr ms_counter = CKLBScriptEnv_getCallBackCount();\r\n        internal static uint getContextCounter()\r\n        {\r\n            return (uint)Marshal.ReadInt32(ms_counter);\r\n        }\r\n\r\n\t\t/// <summary>\r\n\t\t/// Gets the typeID of a C++ GameObject.\r\n\t\t/// </summary>\r\n\t\t/// <returns>\r\n\t\t/// The typeID.\r\n\t\t/// </returns>\r\n\t\t/// <param name='cppObj'>\r\n\t\t/// C++ object IntPtr.\r\n\t\t/// </param>\r\n\t\tpublic static uint getTypeID(IntPtr cppObj)\r\n\t\t{ \r\n            return CKLBObject_getTypeID(cppObj);\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Links a C++ object to its C# wrapper.\r\n\t\t/// </summary>\r\n\t\t/// <param name='cppObj'>\r\n\t\t/// Pointer to the CppObject to register.\r\n\t\t/// </param>\r\n\t\t/// <param name='handle'>\r\n\t\t/// Handle of the C# object.\r\n\t\t/// </param>\r\n\t\tpublic static void  registerWrapper(IntPtr cppObj, uint handle)\r\n\t\t{\r\n            Console.WriteLine(\"[C#] NativeManagement.registerWrapper BEGIN\");\r\n\t\t\tGameObject gameObject = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n\t\t\tif(cppObj != IntPtr.Zero) {\r\n\t\t\t\t// C# and C++ classes must have the same typeID to be bound\r\n                //Console.WriteLine(\"[C#] NativeManagement.registerWrapper - native typeID : 0x\" + NativeManagement.getTypeID(cppObj).ToString(\"X\") + \" - C# typeID : 0x\" + gameObject.TypeID.ToString(\"X\"));\r\n\t\t\t\tif(NativeManagement.getTypeID(cppObj) == gameObject.TypeID) {\r\n\t\t\t\t\t//Console.WriteLine(\"[C#] Register Wrapper : handle = \" + handle);\r\n                    CKLBObjectScriptable_setScriptContext(cppObj, handle);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBException(\"C# object and C++ object don't have the same typeID, impossible to bind them.\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Debug\r\n\t\t\t\t//uint handleResult = GameObject_getHandle(cppObj);\r\n\t\t\t\t//Console.WriteLine(\"Result : \" + handleResult);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n            Console.WriteLine(\"[C#] NativeManagement.registerWrapper END\");\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Breaks the link between the C++ object and its wrapper.\r\n\t\t/// </summary>\r\n\t\t/// <param name='cppObj'>\r\n\t\t/// Pointer to the CppObject to unregister.\r\n\t\t/// </param>\r\n\t\tpublic static void unregisterWrapper(IntPtr cppObj)\r\n\t\t{\r\n\t\t\tif(cppObj != IntPtr.Zero) {\r\n\t\t\t\tConsole.WriteLine(\"Unregister Wrapper\");\r\n                CKLBObjectScriptable_setScriptContext(cppObj, GameObject.NULLHANDLER);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Destroys the C# object designated by handle.\r\n        /// It can be called from C++.\r\n\t\t/// </summary>\r\n\t\t/// <param name='handle'>\r\n\t\t/// Handle of the C# object to destroy.\r\n\t\t/// </param>\r\n\t\tpublic static void destroyFromNative(uint handle)\r\n\t\t{\r\n\t\t\tGameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n            if(obj != null) {\r\n                WrapperReg.getInstance().unregisterGameObject(obj);\r\n                obj.CppObject = IntPtr.Zero;\r\n                obj.Dispose();\r\n            }\r\n\t\t}\r\n\r\n        public static void doCallBackV(uint cbInfos)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerV cb = (FunctionPointerV)obj.getCallBack(callbackIndex);\r\n                cb();\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n\r\n        public static void doCallBackII(uint cbInfos, int int_1, int int_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerII cb = (FunctionPointerII)obj.getCallBack(callbackIndex);\r\n                cb(int_1, int_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackIII(uint cbInfos, int int_1, int int_2, int int_3)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerIII cb = (FunctionPointerIII)obj.getCallBack(callbackIndex);\r\n                cb(int_1, int_2, int_3);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackIIII(uint cbInfos, int int_1, int int_2, int int_3, int int_4)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerIIII cb = (FunctionPointerIIII)obj.getCallBack(callbackIndex);\r\n                cb(int_1, int_2, int_3, int_4);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n\r\n        public static void doCallBackS(uint cbInfos, IntPtr intptr_1)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerS cb = (FunctionPointerS)obj.getCallBack(callbackIndex);\r\n                cb(intptr_1);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackSII(uint cbInfos, IntPtr intptr_1, int int_1, int int_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerSII cb = (FunctionPointerSII)obj.getCallBack(callbackIndex);\r\n                cb(intptr_1, int_1, int_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackSU(uint cbInfos, IntPtr intptr_1, uint uint_1)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerSU cb = (FunctionPointerSU)obj.getCallBack(callbackIndex);\r\n                cb(intptr_1, uint_1);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackSS(uint cbInfos, IntPtr intptr_1, IntPtr intptr_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerSS cb = (FunctionPointerSS)obj.getCallBack(callbackIndex);\r\n                cb(intptr_1, intptr_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n\r\n        public static void doCallBackUS(uint cbInfos, uint uint_1, IntPtr intptr_1)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUS cb = (FunctionPointerUS)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, intptr_1);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUSS(uint cbInfos, uint uint_1, IntPtr intptr_1, IntPtr intptr_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUSS cb = (FunctionPointerUSS)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, intptr_1, intptr_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        \r\n        public static void doCallBackU(uint cbInfos, uint uint_1)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerU cb = (FunctionPointerU)obj.getCallBack(callbackIndex);\r\n                cb(uint_1);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUU(uint cbInfos, uint uint_1, uint uint_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUU cb = (FunctionPointerUU)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, uint_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUFF(uint cbInfos, uint uint_1, float float_1, float float_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n            \r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUFF cb = (FunctionPointerUFF)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, float_1, float_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUI(uint cbInfos, uint uint_1, int int_1)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUI cb = (FunctionPointerUI)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, int_1);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUII(uint cbInfos, uint uint_1, int int_1, int int_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUII cb = (FunctionPointerUII)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, int_1, int_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUIIII(uint cbInfos, uint uint_1, int int_1, int int_2, int int_3, int int_4)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUIIII cb = (FunctionPointerUIIII)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, int_1, int_2, int_3, int_4);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUIIUU(uint cbInfos, uint uint_1, int int_1, int int_2, uint uint_2, uint uint_3)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUIIUU cb = (FunctionPointerUIIUU)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, int_1, int_2, uint_2, uint_3);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUUII(uint cbInfos, uint uint_1, uint uint_2, int int_1, int int_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUUII cb = (FunctionPointerUUII)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, uint_2, int_1, int_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n        public static void doCallBackUUUII(uint cbInfos, uint uint_1, uint uint_2, uint uint_3, int int_1, int int_2)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerUUUII cb = (FunctionPointerUUUII)obj.getCallBack(callbackIndex);\r\n                cb(uint_1, uint_2, uint_3, int_1, int_2);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n\t\t\r\n        public static bool doCallBackIIIP_retB(uint cbInfos, int int_1, int int_2, int int_3, IntPtr obj_1)\r\n\t\t{\r\n\t\t\tuint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n\t\t\tuint handle = cbInfos & 0x1FFFFFFF;\r\n\t\t\tGameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\t\t\t\r\n\t\t\tif(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n\t\t\t\tFunctionPointerIIIP_retB cb = (FunctionPointerIIIP_retB)obj.getCallBack(callbackIndex);\r\n\t\t\t\treturn cb(int_1, int_2, int_3, obj_1);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n\t\t\t}\r\n\t\t}\r\n        \r\n        public static void doCallBackFS(uint cbInfos, float float_1, IntPtr intptr_1)\r\n        {\r\n            uint callbackIndex = (cbInfos & 0xE0000000) >> 29;\r\n            uint handle = cbInfos & 0x1FFFFFFF;\r\n            GameObject obj = WrapperReg.getInstance().getObjectFromHandle(handle);\r\n\r\n            if(0 <= callbackIndex && callbackIndex < GameObject.NBCALLBACKS) {\r\n                FunctionPointerFS cb = (FunctionPointerFS)obj.getCallBack(callbackIndex);\r\n                cb(float_1, intptr_1);\r\n            } else {\r\n                throw new CKLBException(\"Invalid index, it must be between 0 and \" + (GameObject.NBCALLBACKS - 1)+ \".\");\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/NodeIterator.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    /// <summary>\r\n    /// NodeIterator is used to run through a node tree.\r\n    /// \r\n    /// A NodeIterator contains an uint (counter) determined at the creation of the object.\r\n    /// It limits its use : the NodeIterator can only be used before this counter \r\n    /// changes in the Engine.\r\n    /// This counter is updated each time there is an update on the node tree.\r\n    /// \r\n    /// Navigation methods can be used with registerStack to true. It will then use a \r\n    /// node stack which will store the previous node before returning the new one.\r\n    /// \r\n    /// A NodeIterator can return the current element as : Element, Container, Selectable, AnimationNode.\r\n    /// \r\n    /// It can use some navigation methods to run through the node tree.\r\n    /// Please take a look at methods documentation for more details.\r\n    /// \r\n    /// Node properties can be directly modified through a NodeIterator.\r\n    /// </summary>\r\n    public class NodeIterator\r\n    {\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getRoot();\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getChild(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getParent(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getBrother(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getNodeFromTask(IntPtr pTask);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float node_getNodeScaleX(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float node_getNodeScaleY(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float node_getRotation(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float node_getNodeTranslateX(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float node_getNodeTranslateY(IntPtr pNode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getName(IntPtr pNode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setName(IntPtr pNode, IntPtr name);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setTranslate(IntPtr pNode, float x, float y);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setRotation(IntPtr pNode, float deg);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setScale(IntPtr pNode, float scaleX, float scaleY);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_getColorMatrixVec(IntPtr pNode, float[] dst);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setColorMatrixVec(IntPtr pNode, float[] src);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint node_getColorMatrixUInt(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setColorMatrixUInt(IntPtr pNode, uint val);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void node_setVisible(IntPtr pNode, bool visible);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool node_getVisible(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_asElement(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_asContainer(IntPtr pNode);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_asSelectable(IntPtr pNode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_asAnimationNode(IntPtr pNode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_getUITask(IntPtr pNode);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_search(IntPtr pNode, IntPtr name);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr node_searchFirstByTypeID(IntPtr pNode, uint typeID);\r\n        #endregion\r\n\r\n        /// <summary>\r\n        /// Public constructor for user.\r\n        /// The NodeIterator is defaultly empty and must be filled through UITask.getIterator or UITask.getIteratorFromName\r\n        /// </summary>\r\n        public NodeIterator() { }\r\n\r\n        /// <summary>\r\n        /// Intern constructor only.\r\n        /// Creates a NodeIterator on a specific node given.\r\n        /// </summary>\r\n        /// <param name=\"counter\">Frame counter.</param>\r\n        /// <param name=\"node\">Node to set the NodeIterator on.</param>\r\n        internal NodeIterator(uint counter, IntPtr node) {\r\n            this.m_counter = counter;\r\n            this.m_nodeCpp = node;\r\n        }\r\n\r\n        private uint m_counter;\r\n        private IntPtr m_nodeCpp;\r\n        private List<IntPtr> m_navigation = new List<IntPtr>();\r\n\r\n        internal static IntPtr getRoot() \r\n        {\r\n            return node_getRoot();\r\n        }\r\n\r\n        internal static IntPtr getNodeFromTask(CKLBUITask task)\r\n        {\r\n            return node_getNodeFromTask(task.CppObject);\r\n        }\r\n\r\n\t\tpublic Element getAsElement() {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(node_asElement(m_nodeCpp) != IntPtr.Zero) {\r\n                    return new Element(m_counter, node_asElement(m_nodeCpp));\r\n                } else {\r\n                    return null;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\t\t\r\n\t\tpublic Container getAsContainer() {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(node_asContainer(m_nodeCpp) != IntPtr.Zero) {\r\n                    return new Container(m_counter, node_asElement(m_nodeCpp));\r\n                } else {\r\n                    return null;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\t\t\r\n\t\tpublic Selectable getAsSelectable() {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(node_asSelectable(m_nodeCpp) != IntPtr.Zero) {\r\n                    return new Selectable(m_counter, node_asElement(m_nodeCpp));\r\n                } else {\r\n                    return null;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        public AnimationNode getAsAnimationNode()\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(node_asAnimationNode(m_nodeCpp) != IntPtr.Zero) {\r\n                    return new AnimationNode(m_counter, node_asElement(m_nodeCpp));\r\n                } else {\r\n                    return null;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Go to the child node if any. Return true if successfull, false if no child is available.\r\n        /// If registerStack is true and navigation successfull, the previous node is pushed into a navigation stack.\r\n        /// </summary>\r\n        /// <param name=\"registerStack\">Push the previous node into a navigation stack.</param>\r\n        /// <returns>True if successfull.</returns>\r\n        public bool gotoChild(bool registerStack = false) \r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                IntPtr nNode = node_getChild(m_nodeCpp);\r\n                if(nNode != IntPtr.Zero) {\r\n                    // Push on navigation stack if needed.\r\n                    if(registerStack) { m_navigation.Add(m_nodeCpp); }\r\n                    m_nodeCpp = nNode;\r\n                    return true;\r\n                } else {\r\n                    return false;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        public bool gotoBrother(bool registerStack = false)\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                IntPtr nNode = node_getBrother(m_nodeCpp);\r\n                if(nNode != IntPtr.Zero) {\r\n                    // Push on navigation stack if needed.\r\n                    if(registerStack) { m_navigation.Add(m_nodeCpp); }\r\n                    m_nodeCpp = nNode;\r\n                    return true;\r\n                } else {\r\n                    return false;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        public bool gotoParent(bool registerStack = false)\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                IntPtr nNode = node_getParent(m_nodeCpp);\r\n                if(nNode != IntPtr.Zero) {\r\n                    // Push on navigation stack if needed.\r\n                    if(registerStack) { m_navigation.Add(m_nodeCpp); }\r\n                    m_nodeCpp = nNode;\r\n                    return true;\r\n                } else {\r\n                    return false;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Take the latest entry inside the navigation stack if any, and jump to the node, then the node is removed from the navigation stack.\r\n        /// Returns true if the operation is sucessfull, false if the navigation stack is empty.\r\n        /// </summary>\r\n        /// <returns>\r\n        /// True if successfull.\r\n        /// False if the navigation stack is empty.\r\n        /// </returns>\r\n        public bool rollback()\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(m_navigation.Count != 0) {\r\n                    m_nodeCpp = m_navigation[m_navigation.Count - 1];\r\n                    // Pop from stack.\r\n                    m_navigation.RemoveAt(m_navigation.Count - 1);\r\n                    return true;\r\n                } else {\r\n                    return false;\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Try to find a Node designated by name in the subnode of the actual one.\r\n        /// If the Node is found, the NodeIterator is updated.\r\n        /// Else it keeps its reference to the current Node.\r\n        /// </summary>\r\n        /// <param name=\"name\">Name of the node looked for.</param>\r\n        /// <returns>true if succeeds, else returns false.</returns>\r\n        public bool find(String name, bool registerStack = false)\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(m_nodeCpp != IntPtr.Zero) {\r\n                    IntPtr ptr = node_search(m_nodeCpp, __MarshallingUtils.NativeUtf8FromString(name));\r\n                    if(ptr != IntPtr.Zero) {\r\n                        if(registerStack) { m_navigation.Add(m_nodeCpp); }\r\n                        m_nodeCpp = ptr;\r\n                        return true;\r\n                    } else {\r\n                        return false;\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Try to get the UITask linked to the current Node of the NodeIterator.\r\n        /// </summary>\r\n        /// <returns>The UITask if a UITask is effectivly linked to the Node. Else returns null.</returns>\r\n        public CKLBUITask getAsUITask()\r\n        {\r\n            IntPtr ptr = node_getUITask(m_nodeCpp);\r\n            if(ptr != IntPtr.Zero) {\r\n                NativeManagement.resetCppError();\r\n                CKLBUITask task = new CKLBUITask(NativeManagement.getTypeID(ptr));\r\n                NativeManagement.intercepCppError();\r\n                task.bind(ptr);\r\n                return task;\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Search in subtree from iterator (including itself),\r\n        /// check if user task and native task are compatible,then bind.\r\n        /// </summary>\r\n        /// <param name=\"task\">The UITask to bind.</param>\r\n        /// <param name=\"name\">Name of the node to bind with the UITask.</param>\r\n        /// <returns>If not possible to bind returns null , if sucessfull return UITask.</returns>\r\n        public CKLBUITask bindTask(CKLBUITask task, String name = null) \r\n        {\r\n            if(name != null) {\r\n                if(find(name, true)) {\r\n                    task.bind(node_getUITask(m_nodeCpp));\r\n                } else {\r\n                    throw new CKLBException(\"There is not any Node with this name.\");\r\n                }\r\n            } else {\r\n                IntPtr ptr = node_searchFirstByTypeID(m_nodeCpp, task.TypeID);\r\n                if(ptr != IntPtr.Zero) {\r\n                    task.bind(ptr);\r\n                } else {\r\n                    throw new CKLBException(\"There is not any Node compatible with this task.\");\r\n                }\r\n            }\r\n            return task;\r\n        }\r\n\r\n        public uint Rgba\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getColorMatrixUInt(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setColorMatrixUInt(m_nodeCpp, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public float ScaleX\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getNodeScaleX(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setScale(m_nodeCpp, value, node_getNodeScaleY(m_nodeCpp));\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public float ScaleY\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getNodeScaleY(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setScale(m_nodeCpp, node_getNodeScaleX(m_nodeCpp), value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public float Scale\r\n        {\r\n            // get { throw new CKLBExceptionForbiddenMethod(); }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setScale(m_nodeCpp, value, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public float Rotation\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getRotation(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setRotation(m_nodeCpp, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public float X\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getNodeTranslateX(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setTranslate(m_nodeCpp, value, node_getNodeTranslateY(m_nodeCpp));\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public float Y\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getNodeTranslateY(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setTranslate(m_nodeCpp, node_getNodeTranslateX(m_nodeCpp), value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public bool Visible\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return node_getVisible(m_nodeCpp);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setVisible(m_nodeCpp, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n        public void setXY(float x, float y)\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(m_nodeCpp != IntPtr.Zero) {\r\n                    node_setTranslate(m_nodeCpp, x, y);\r\n                } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        public String Name\r\n        {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        return __MarshallingUtils.StringFromNativeUtf8(node_getName(m_nodeCpp));\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodeCpp != IntPtr.Zero) {\r\n                        node_setName(m_nodeCpp, __MarshallingUtils.NativeUtf8FromString(value));\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n\tpublic class Element {\r\n\r\n        protected IntPtr m_nodePtr;\r\n        protected uint m_counter;\r\n\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void element_setEnabled(IntPtr pElem, bool isEnabled);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool element_isEnabled(IntPtr pElem);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        protected extern static bool element_setAsset(IntPtr pElem, uint dest, IntPtr assetName);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void element_setPriority(IntPtr pElem, uint renderPriority);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint element_getPriority(IntPtr pElem);\r\n        #endregion\r\n\r\n        // Copy of C++ Def : TODO : create a system were .h and .cs could be maintained automatically.\r\n        protected enum ASSET_TYPE\r\n        {\r\n            NORMAL_ASSET        = 0,\r\n            DISABLED_ASSET      = 1,\r\n            FOCUSED_ASSET       = 2,\r\n            PUSHED_ASSET        = 3\r\n        };\r\n\r\n        internal Element(uint m_counter, IntPtr nodePtr)\r\n        {\r\n            this.m_counter = m_counter;\r\n            this.m_nodePtr = nodePtr;\r\n        }\r\n\t\t\r\n\t\tpublic bool Enabled\r\n\t\t{\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return element_isEnabled(m_nodePtr);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        element_setEnabled(m_nodePtr, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic String normalAsset\r\n\t\t{\r\n            // get { throw new CKLBExceptionForbiddenMethod(); }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        NativeManagement.resetCppError();\r\n                        if(!element_setAsset(m_nodePtr, (uint)ASSET_TYPE.NORMAL_ASSET, __MarshallingUtils.NativeUtf8FromString(value))) {\r\n                            NativeManagement.intercepCppError();\r\n                        }\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic String disableAsset\r\n\t\t{\r\n            // get { throw new CKLBExceptionForbiddenMethod(); }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        NativeManagement.resetCppError();\r\n                        if(!element_setAsset(m_nodePtr, (uint)ASSET_TYPE.DISABLED_ASSET, __MarshallingUtils.NativeUtf8FromString(value))) {\r\n                            NativeManagement.intercepCppError();\r\n                        }\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t}\r\n\r\n\tpublic class Container : Element {\r\n\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int container_getViewOffsetX(IntPtr pCont);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void container_setViewOffsetX(IntPtr pCont, int scrollX);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int container_getViewOffsetY(IntPtr pCont);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void container_setViewOffsetY(IntPtr pCont, int scrollY);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint container_getRadioValue(IntPtr pCont);\r\n        #endregion\r\n\r\n        internal Container(uint m_counter, IntPtr nodePtr):base(m_counter, nodePtr)\r\n        {\r\n        }\r\n\r\n\t\tpublic int ViewOffsetX {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return container_getViewOffsetX(m_nodePtr);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        container_setViewOffsetX(m_nodePtr, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic int ViewOffsetY {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return container_getViewOffsetY(m_nodePtr); \r\n                     } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        container_setViewOffsetY(m_nodePtr, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic uint RadioValue {\r\n\t\t\tget\r\n            { \r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return container_getRadioValue(m_nodePtr); \r\n                     } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\t\r\n\t\t// TODO : Add API about clipping.\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic class Selectable : Element {\r\n\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void selectable_setClick(IntPtr pSelect, int coordinateX, int coordinateY, int width, int height);\r\n\r\n        // assetAudio : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool selectable_setAudio(IntPtr pSelect, IntPtr assetAudio, uint mode, float volume);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void selectable_setStick(IntPtr pSelect, bool isStickable);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool selectable_isStickable(IntPtr pSelect);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void selectable_setSticked(IntPtr pSelect, bool isSticked);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool selectable_isSticked(IntPtr pSelect);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void selectable_setRadio(IntPtr pSelect, uint radioID);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint selectable_getRadioID(IntPtr pSelect);\r\n        #endregion\r\n\r\n        internal Selectable(uint m_counter, IntPtr nodePtr):base(m_counter, nodePtr)\r\n        {\r\n        }\r\n\r\n\t\tpublic String pushedAsset\r\n\t\t{\r\n            // get { throw new CKLBExceptionForbiddenMethod(); }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        NativeManagement.resetCppError();\r\n                        if(!element_setAsset(m_nodePtr, (uint)ASSET_TYPE.PUSHED_ASSET, __MarshallingUtils.NativeUtf8FromString(value))) {\r\n                            NativeManagement.intercepCppError();\r\n                        }\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\r\n        public bool setAudio(String assetName, uint mode, float volume)\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(m_nodePtr != IntPtr.Zero) {\r\n                    return selectable_setAudio(m_nodePtr, __MarshallingUtils.NativeUtf8FromString(assetName), mode, volume);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\r\n        public void setClickArea(int x, int y, int width, int height)\r\n        {\r\n            if(m_counter == NativeManagement.getContextCounter()) {\r\n                if(m_nodePtr != IntPtr.Zero) {\r\n                    selectable_setClick(m_nodePtr, x, y, width, height);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionTooOld();\r\n            }\r\n        }\r\n\t\t\r\n\t\tpublic bool isDown {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return selectable_isSticked(m_nodePtr);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        selectable_setStick(m_nodePtr, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n\t\t}\r\n\t\t\r\n\t\tpublic bool checkBoxMode {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return selectable_isStickable(m_nodePtr);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        selectable_setSticked(m_nodePtr, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t\t\r\n\t\tpublic uint RadioID {\r\n            get\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        return selectable_getRadioID(m_nodePtr);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(m_counter == NativeManagement.getContextCounter()) {\r\n                    if(m_nodePtr != IntPtr.Zero) {\r\n                        selectable_setRadio(m_nodePtr, value);\r\n                    } else {\r\n                        throw new CKLBExceptionNullCppObject();\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionTooOld();\r\n                }\r\n            }\r\n        }\r\n\t}\r\n\r\n    public class AnimationNode\r\n    {\r\n        protected IntPtr nodePtr;\r\n        protected uint m_counter;\r\n\r\n        internal AnimationNode(uint m_counter, IntPtr nodePtr)\r\n        {\r\n            this.m_counter = m_counter;\r\n            this.nodePtr = nodePtr;\r\n        }\r\n\r\n        void setAnimation(AnimationInfo animationInfo)\r\n        {\r\n            throw new CKLBExceptionNotImplemented();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/Utils.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Text;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public struct Size\r\n    {\r\n        public int width;\r\n        public int height;\r\n    }\r\n\r\n    public struct USize\r\n    {\r\n        public uint width;\r\n        public uint height;\r\n    }\r\n\r\n    public struct FSize\r\n    {\r\n        public float width;\r\n        public float height;\r\n    }\r\n\r\n    public class IClientRequest \r\n    {\r\n        public enum EVENT_TYPE {\r\n\t\t    E_PAUSE,\t\t// プロセスがポーズ状態になった\r\n\t\t    E_RESUME,\t\t// プロセスがレジュームされた\r\n            E_TEXTCHANGE,   // TextBox の文字列が変更された\r\n            E_URLJUMP,      // Webのコマンドリンクが指定された\r\n        \r\n            E_DIDSTARTLOADWEB,  // Webのロードが開始された\r\n\t\t    E_DIDLOADENDWEB,\t// Webのロードが終了した\r\n            E_FAILEDLOADWEB,    // Webのロードが失敗した\r\n        \r\n            E_STORE_BAD_ITEMID,         // アイテムIDが無効\r\n            E_STORE_PURCHASHING,        // 購入処理中\r\n            E_STORE_PURCHASHED,         // 購入処理終了\r\n            E_STORE_FAILED,             // 購入処理失敗\r\n\r\n            E_STORE_RESTORE,            // リストア終了\r\n            E_STORE_RESTORE_FAILED,     // リストア失敗\r\n            E_STORE_RESTORE_COMPLETED,  // 全リストア終了\r\n\r\n            E_STORE_GET_PRODUCTS,       // ProductListの取得.\r\n\r\n\t\t    E_SOUND_STATE_PLAY,             // サウンド再生中\r\n            E_SOUND_STATE_STOP,             // サウンド停止中\r\n            E_SOUND_STATE_PAUSE,            // サウンド一時停止中\r\n            E_SOUND_STATE_INVALID_HANDLE,   // サウンドハンドル無効\r\n         };\r\n    }\r\n\r\n\tpublic static class __FrameworkUtils\r\n    {\r\n        #region DllImports\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint Cpp_getClassIDByName(IntPtr name);\r\n        #endregion\r\n\r\n        // = 0 <-- Fail\r\n        // Implementation sample below\r\n        public static uint GetClassIDByName(String className)\r\n        {\r\n            Console.WriteLine(\"[C#] Utils.GetClassIDByName(\" + className + \") = \" + Cpp_getClassIDByName(__MarshallingUtils.NativeUtf8FromString(className)));\r\n            return Cpp_getClassIDByName(__MarshallingUtils.NativeUtf8FromString(className));\r\n        }\r\n\r\n        public static uint RegisterClass(String className/*, Type t*/) \r\n        {\r\n            // GameObjectFactory.registerType(className, t); // Not used at the moment.\r\n            return GetClassIDByName(className);\r\n        }\r\n/*\t\r\n * implementation in classes\r\n * \r\n\tclass CKLBUIProgressBar {\r\n\t\tstatic private engineID = getClassIDByName(\"CKLBUIProgressBar\");\r\n\t}\r\n*/\r\n\t}\r\n\r\n}\r\n\r\nnamespace System {\r\n    public static class __MarshallingUtils\r\n    {\r\n        public static IntPtr NativeUtf8FromString(String managedString)\r\n        {\r\n            if(managedString != null) {\r\n                int len = Encoding.UTF8.GetByteCount(managedString);\r\n                byte[] buffer = new byte[len + 1];\r\n                Encoding.Default.GetBytes(managedString, 0, managedString.Length, buffer, 0);\r\n                IntPtr nativeUtf8 = Marshal.AllocHGlobal(buffer.Length);\r\n                Marshal.Copy(buffer, 0, nativeUtf8, buffer.Length);\r\n                return nativeUtf8;\r\n            } else {\r\n                return IntPtr.Zero;\r\n            }\r\n        }\r\n\r\n        public static String StringFromNativeUtf8(IntPtr nativeUtf8)\r\n        {\r\n            if(nativeUtf8 != IntPtr.Zero) {\r\n                int len = 0;\r\n                while(Marshal.ReadByte(nativeUtf8, len) != 0) ++len;\r\n                if(len == 0) return string.Empty;\r\n                byte[] buffer = new byte[len];\r\n                Marshal.Copy(nativeUtf8, buffer, 0, buffer.Length);\r\n                return Encoding.Default.GetString(buffer);\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n\r\n        public static String[] StringArrayFromNativeUtf8IntPtr(IntPtr nativeUtf8, int size)\r\n        {\r\n            if(nativeUtf8 != IntPtr.Zero) {\r\n                String[] strArr = new String[size];\r\n                for(int i = 0; i < size; ++i) {\r\n                    IntPtr strPtr = (IntPtr)Marshal.PtrToStructure(nativeUtf8, typeof(IntPtr));\r\n                    strArr[i] = StringFromNativeUtf8(strPtr);\r\n                    nativeUtf8 = (IntPtr)((long)nativeUtf8 + IntPtr.Size);\r\n                }\r\n\r\n                return strArr;\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n\r\n        /*\r\n        public static String[] StringArrayFromNativeUtf8IntPtrArray(IntPtr[] nativeUtf8Array, int size)\r\n        {\r\n            if(nativeUtf8Array != null) {\r\n                String[] strArr = new String[size];\r\n                for(int i = 0; i < size; ++i) {\r\n                    strArr[i] = __MarshallingUtils.StringFromNativeUtf8(nativeUtf8Array[i]);\r\n                }\r\n                return strArr;\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n         */\r\n\r\n        public static IntPtr[] NativeUtf8ArrayFromStringArray(String[] stringArray, int size)\r\n        {\r\n            if(stringArray != null) {\r\n                IntPtr[] intPtrArr = new IntPtr[size];\r\n                for(int i = 0; i < size; ++i) {\r\n                    intPtrArr[i] = NativeUtf8FromString(stringArray[i]);\r\n                }\r\n                return intPtrArr;\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n\r\n        public static int[] IntArrayFromIntPtr(IntPtr ptr, int size)\r\n        {\r\n            if(ptr != IntPtr.Zero) {\r\n                int[] result = new int[size];\r\n                Marshal.Copy(ptr, result, 0, size);\r\n                return result;\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/FrameworkCore/WrapperReg.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\t/// <summary>\r\n\t/// C# Wrapper management class.\r\n    /// \r\n    /// Singleton class.\r\n    /// \r\n    /// It contains a GameObject array with a pointer on every single wrapper\r\n    /// and its handle. So it is possible to find the GameObject from its handle.\r\n    /// \r\n    /// It can register and unregister GameObject in the array.\r\n\t/// </summary>\r\n\tpublic class WrapperReg\r\n\t{\r\n\t\tprivate int m_listSize;\r\n\t\tprivate GameObject[] m_list;\r\n        // This list is used for space optimization.\r\n\t\tprivate List<uint> m_freeHandlesList;\r\n\t\tprivate uint m_objectCounter;\r\n\t\t\r\n\t\tprivate WrapperReg()\r\n\t\t{\r\n            Console.WriteLine(\"[C#] WrapperReg cctor BEGIN\");\r\n            m_listSize = 10;\r\n\t\t\tm_list = new GameObject[m_listSize]; // null by default\r\n\t\t\tm_freeHandlesList = new List<uint>();\r\n            m_objectCounter = 0;\r\n            Console.WriteLine(\"[C#] WrapperReg cctor END\");\r\n\t\t}\r\n\t\t\r\n\t\tprivate static WrapperReg reg = new WrapperReg();\r\n\t\t\r\n\t\tpublic static WrapperReg getInstance()\r\n\t\t{\r\n\t\t\treturn reg;\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Generates a handle and registers the game object in the array\r\n\t\t/// </summary>\r\n\t\t/// <returns>\r\n\t\t/// The handle of the GameObject.\r\n\t\t/// </returns>\r\n\t\t/// <param name='pObj'>\r\n\t\t/// GameObject to register.\r\n\t\t/// </param>\r\n\t\tpublic uint registerGameObject(GameObject pObj)\r\n\t\t{\r\n            Console.WriteLine(\"[C#] WrapperReg.registerGameObject BEGIN\");\r\n\t\t\tif(pObj.Handle == GameObject.NULLHANDLER) {\r\n                Console.WriteLine(\"[C#] WrapperReg - Handle OK\");\r\n                // no free handles in the array\r\n\t\t\t\tif(m_freeHandlesList.Count == 0) {\r\n\t\t\t\t\tm_list[m_objectCounter] = pObj;\r\n\t\t\t\t\tpObj.Handle = m_objectCounter;\r\n\t\t\t\t\tif(++m_objectCounter == m_listSize) {\r\n\t\t\t\t\t\tConsole.WriteLine(\"[C#] WrapperReg - array RESIZE\");\r\n\t\t\t\t\t\tArray.Resize(ref m_list, m_listSize += 10);\r\n\t\t\t\t\t}\r\n                    Console.WriteLine(\"[C#] WrapperReg - Register GameObject with handle \" + (m_objectCounter - 1));\r\n\t\t\t\t\treturn m_objectCounter - 1;\r\n\t\t\t\t} else {\r\n                    // there are free handles in the array\r\n\t\t\t\t\tuint idx = m_freeHandlesList[0];\r\n\t\t\t\t\tm_freeHandlesList.RemoveAt(0);\r\n\t\t\t\t\tm_list[idx] = pObj;\r\n\t\t\t\t\tpObj.Handle = idx;\r\n\t\t\t\t\t\r\n\t\t\t\t\tConsole.WriteLine(\"Register GameObject with handle \" + idx);\r\n\t\t\t\t\treturn idx;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBException(\"This object is already registered.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Unregisters the game object from the array and set the handle to NULLHANDLER\r\n\t\t/// </summary>\r\n\t\t/// <param name='pObj'>\r\n        /// GameObject to register.\r\n\t\t/// </param>\r\n\t\tpublic void unregisterGameObject(GameObject pObj)\r\n\t\t{\r\n            Console.WriteLine(\"[C#] WrapperReg.unregisterGameObject \" + pObj + \" BEGIN\");\r\n\t\t\tif(pObj.Handle != GameObject.NULLHANDLER) {\r\n\t\t\t\tm_freeHandlesList.Add(pObj.Handle);\r\n\t\t\t\tm_list[pObj.Handle] = null;\r\n\t\t\t\tpObj.Handle = GameObject.NULLHANDLER;\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBException(\"Already unregistered.\");\r\n\t\t\t}\r\n            Console.WriteLine(\"[C#] WrapperReg.unregisterGameObject END\");\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Gets the GameObject from a handle.\r\n\t\t/// </summary>\r\n\t\t/// <returns>\r\n\t\t/// The GameObject\r\n\t\t/// </returns>\r\n\t\t/// <param name='handle'>\r\n\t\t/// Handle.\r\n\t\t/// </param>\r\n\t\tpublic GameObject getObjectFromHandle(uint handle)\r\n\t\t{\r\n\t\t\tif(handle < m_listSize) {\r\n\t\t\t\treturn m_list[handle];\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBException(\"This handle is too high.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Displays this instance.\r\n\t\t/// </summary>\r\n\t\tpublic void display()\r\n\t\t{\r\n\t\t\tConsole.WriteLine();\r\n\t\t\tConsole.WriteLine(\"##################################\");\r\n\t\t\tConsole.WriteLine(\"####### Wrapper Reg Display ######\");\r\n\t\t\tConsole.WriteLine(\"##################################\");\r\n\t\t\tfor(int i=0; m_list[i]!= null && i < m_listSize; ++i)\r\n\t\t\t\tConsole.WriteLine(\"[\" + i + \"]\" + m_list[i]);\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSAPP.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSAPP\r\n    {\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibAPP_callApplication(APP_TYPE type, IntPtr addr, IntPtr subject, IntPtr body);\r\n        #endregion\r\n\r\n        public enum APP_TYPE\r\n        {\r\n            APP_MAIL,\r\n            APP_BROWSER,\r\n        };\r\n\r\n        public static bool callApplication(APP_TYPE type, String addr, String subject, String body)\r\n        {\r\n            return CKLBLuaLibAPP_callApplication(type, __MarshallingUtils.NativeUtf8FromString(addr), __MarshallingUtils.NativeUtf8FromString(subject), __MarshallingUtils.NativeUtf8FromString(body));\r\n        }\r\n    };\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSAsset.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSAsset\r\n    {\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibASSET_getImageSize(IntPtr assetName, ref int returnWidth, ref int returnHeight);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibASSET_getBoundSize(IntPtr assetName, ref float returnWidth, ref float returnHeight);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibASSET_getAssetInfo(IntPtr assetName, ref int returnImgWidth, ref int returnImgHeight, \r\n                                                                                  ref float returnBoundWidth, ref float returnBoundHeight);\r\n        #endregion\r\n\r\n        public static void getImageSize(String assetPath, ref int width, ref int height) \r\n        {\r\n            NativeManagement.resetCppError();\r\n            CKLBLuaLibASSET_getImageSize(__MarshallingUtils.NativeUtf8FromString(assetPath), ref width, ref height);\r\n            NativeManagement.intercepCppError();\r\n        }\r\n        public static void getImageSize(String assetPath, out Size size)\r\n        {\r\n            int width = 0, height = 0;\r\n            NativeManagement.resetCppError();\r\n            CKLBLuaLibASSET_getImageSize(__MarshallingUtils.NativeUtf8FromString(assetPath), ref width, ref height);\r\n            NativeManagement.resetCppError();\r\n            size.width = width;\r\n            size.height = height;\r\n        }\r\n\r\n        public static void getBoundSize(String assetPath, ref float width, ref float height) \r\n        {\r\n            NativeManagement.resetCppError();\r\n            CKLBLuaLibASSET_getBoundSize(__MarshallingUtils.NativeUtf8FromString(assetPath), ref width, ref height);\r\n            NativeManagement.intercepCppError();\r\n        }\r\n        public static void getBoundSize(String assetPath, out FSize size)\r\n        {\r\n            float width = 0, height = 0;\r\n            NativeManagement.resetCppError();\r\n            CKLBLuaLibASSET_getBoundSize(__MarshallingUtils.NativeUtf8FromString(assetPath), ref width, ref height);\r\n            NativeManagement.intercepCppError();\r\n            size.width = width;\r\n            size.height = height;\r\n        }\r\n\r\n        public static void getAssetInfo(String assetPath, ref int imgWidth, ref int imgHeight, ref float boundWidth, ref float boundHeight)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            CKLBLuaLibASSET_getAssetInfo(__MarshallingUtils.NativeUtf8FromString(assetPath), ref imgWidth, ref imgHeight, ref boundWidth, ref boundHeight);\r\n            NativeManagement.intercepCppError();\r\n        }\r\n        public static void getAssetInfo(String assetPath, out Size imgSize, out FSize boundSize)\r\n        {\r\n            int imgWidth = 0, imgHeight = 0;\r\n            float boundWidth = 0, boundHeight = 0;\r\n            NativeManagement.resetCppError();\r\n            CKLBLuaLibASSET_getAssetInfo(__MarshallingUtils.NativeUtf8FromString(assetPath), ref imgWidth, ref imgHeight, ref boundWidth, ref boundHeight);\r\n            NativeManagement.intercepCppError();\r\n            imgSize.width    = imgWidth;\r\n            imgSize.height   = imgHeight;\r\n            boundSize.width  = boundWidth;\r\n            boundSize.height = boundHeight;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSBin.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CSBin : GameObject\r\n    {\r\n        #region DllImports\r\n        //return : CKLBBinArray*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibBIN_open(IntPtr bin_asset);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibBIN_close(IntPtr pBIN);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibBIN_peek(IntPtr pBIN, int offset, ref int value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibBIN_peek_u16(IntPtr pBIN, int offset, ref uint value, bool f_bigendian);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibBIN_peek_u32(IntPtr pBIN, int offset, ref uint value, bool f_bigendian);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"LibBIN\"/*, typeof(CSBin)*/);\r\n\r\n        public CSBin(String bin_asset)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBLuaLibBIN_open(__MarshallingUtils.NativeUtf8FromString(bin_asset));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        #endregion\r\n\r\n        internal override void clearInternals()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibBIN_close(CppObject);\r\n            }\r\n        }\r\n\r\n        public bool peek(int offset, ref int value)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBLuaLibBIN_peek(CppObject, offset, ref value);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool peek_u16(int offset, ref uint value, bool f_bigendian = false)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBLuaLibBIN_peek_u16(CppObject, offset, ref value, f_bigendian);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool peek_u32(int offset, ref uint value, bool f_bigendian = false)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBLuaLibBIN_peek_u32(CppObject, offset, ref value, f_bigendian);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSDB.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CSDB : GameObject\r\n    {\r\n        #region DllImports\r\n        //return : CKLBLuaDB*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibDB_dbopen(IntPtr db_asset, bool b_write, bool b_create);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDB_dbclose(IntPtr pDB);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDB_closeAll();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibDB_query(IntPtr pDB, IntPtr sqlQuery, ref int nbEntries);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"LibDB\"/*, typeof(CSDB)*/);\r\n\r\n        public CSDB(String db_asset, bool b_write = true, bool b_create = true)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBLuaLibDB_dbopen(__MarshallingUtils.NativeUtf8FromString(db_asset), b_write, b_create);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_isWritable = b_write;\r\n            m_isCreatable = b_create;\r\n        }\r\n\r\n        #endregion\r\n\r\n        private bool m_isWritable;\r\n        private bool m_isCreatable;\r\n\r\n        public bool IsWritable\r\n        {\r\n            get { return m_isWritable; }\r\n        }\r\n        public bool IsCreatable\r\n        {\r\n            get { return m_isCreatable; }\r\n        }\r\n\r\n        internal override void clearInternals()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibDB_dbclose(CppObject);\r\n            }\r\n        }\r\n\r\n        public static void closeAll()\r\n        {\r\n            CKLBLuaLibDB_closeAll();\r\n        }\r\n\r\n        public void query(String sqlQuery, out String[] results)\r\n        {\r\n            int nbEntries = 0;\r\n            IntPtr p = CKLBLuaLibDB_query(CppObject, __MarshallingUtils.NativeUtf8FromString(sqlQuery), ref nbEntries);\r\n\r\n            results = __MarshallingUtils.StringArrayFromNativeUtf8IntPtr(p, nbEntries * 2);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSData.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CSData : GameObject\r\n    {\r\n        #region DllImports\r\n        // return : CKLBDataSet*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibDATA_cmdCreateData(uint dataSetID);\r\n\r\n        // pDataSet : CKLBDataSet*\r\n        // nameAsset & nameData : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibDATA_cmdRegistData(IntPtr pDataSet, IntPtr nameAsset, ref uint pReturnHandle);\r\n\r\n        // pDataSet : CKLBDataSet*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDATA_cmdDelete(IntPtr pDataSet);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"LibDATA\"/*, typeof(CSData)*/);\r\n\r\n        public CSData(uint ID)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBLuaLibDATA_cmdCreateData(ID);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        #endregion\r\n\r\n        public bool registerData(String nameAsset, ref uint pReturnHandle) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBLuaLibDATA_cmdRegistData(CppObject, __MarshallingUtils.NativeUtf8FromString(nameAsset), ref pReturnHandle);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        internal override void clearInternals() \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibDATA_cmdDelete(CppObject);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSDebug.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSDebug\r\n    {\r\n        #region DllImports\r\n        // caption & key : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDEBUG_startMenu(uint maxCount, IntPtr caption, IntPtr key);\r\n\r\n        // caption & key : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDEBUG_addItem(uint mode, IntPtr caption, IntPtr key, int min, int max, int value, IntPtr[] items, uint itemsCount);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDEBUG_endMenu();\r\n\r\n        // key : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibDEBUG_removeMenu(IntPtr key);\r\n        #endregion\r\n\r\n        #region CallBacks\r\n        // TODO static Callback\r\n        /*\r\n        public delegate void CallBack();\r\n        \r\n        private static CallBack s_callback;\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            s_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction()\r\n        {\r\n            if(s_callback != null) {\r\n                s_callback();\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        */\r\n        #endregion\r\n\r\n        private enum ESECTION_TYPE\r\n        {\r\n            M_SWITCH = 0,\r\n            M_NUMBER = 1,\r\n            M_SELECT = 2,\r\n        }\r\n        private static bool s_isBuildingMenu = false;\r\n\r\n        public static void setCallback() { throw new CKLBExceptionNotImplemented(); }\r\n\r\n        public static void startMenu(uint maxCount, String caption, String key)\r\n        {\r\n            if(s_isBuildingMenu) { throw new CKLBException(\"A Menu is already being built at the moment.\"); }\r\n            s_isBuildingMenu = true;\r\n            CKLBLuaLibDEBUG_startMenu(maxCount, __MarshallingUtils.NativeUtf8FromString(caption), __MarshallingUtils.NativeUtf8FromString(key));\r\n        }\r\n\r\n        public static void addItemSwitch(String itemName, String itemKey, bool defaultValue) \r\n        {\r\n            if(!s_isBuildingMenu) { throw new CKLBException(\"There is no Menu building. Please use startMenu before.\"); }\r\n            CKLBLuaLibDEBUG_addItem((uint)ESECTION_TYPE.M_SWITCH, __MarshallingUtils.NativeUtf8FromString(itemName), __MarshallingUtils.NativeUtf8FromString(itemKey), 0, 0, (defaultValue) ? 1:0, null, 0);\r\n        }\r\n\r\n        public static void addItemSelect(String itemName, String itemKey, String defaultValue, String[] items) \r\n        {\r\n            if(!s_isBuildingMenu) { throw new CKLBException(\"There is no Menu building. Please use startMenu before.\"); }\r\n            CKLBLuaLibDEBUG_addItem((uint)ESECTION_TYPE.M_SELECT, __MarshallingUtils.NativeUtf8FromString(itemName), __MarshallingUtils.NativeUtf8FromString(itemKey), 0, 0, Array.IndexOf(items, defaultValue), __MarshallingUtils.NativeUtf8ArrayFromStringArray(items, items.Length), (uint)items.Length);\r\n        }\r\n\r\n        public static void addItemNumber(String itemName, String itemKey, int lowerLimit, int upperLimit, int defaultValue) \r\n        {\r\n            if(!s_isBuildingMenu) { throw new CKLBException(\"There is no Menu building. Please use startMenu before.\"); }\r\n            CKLBLuaLibDEBUG_addItem((uint)ESECTION_TYPE.M_NUMBER, __MarshallingUtils.NativeUtf8FromString(itemName), __MarshallingUtils.NativeUtf8FromString(itemKey), lowerLimit, upperLimit, defaultValue, null, 0);\r\n        }\r\n\r\n        public static void endMenu()\r\n        {\r\n            if(!s_isBuildingMenu) { throw new CKLBException(\"There is no Menu building. Please use startMenu before.\"); }\r\n            CKLBLuaLibDEBUG_endMenu();\r\n            s_isBuildingMenu = false;\r\n        }\r\n\r\n        public static void removeMenu(String key) \r\n        { \r\n            CKLBLuaLibDEBUG_removeMenu(__MarshallingUtils.NativeUtf8FromString(key)); \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSEng.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSEng\r\n    {\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibENG_isRelease();\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibENG_getPlatform();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibENG_getNanoTime(ref int milli, ref int nano);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibENG_startNanoTime(int idx);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibENG_endNanoTime(int idx, ref int milli, ref int nano);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBLuaLibENG_getFrameID();\r\n        #endregion\r\n\r\n        public static bool      IsRelease\r\n        {\r\n            get\r\n            {\r\n                return CKLBLuaLibENG_isRelease();\r\n            }\r\n        }\r\n        public static String    Platform\r\n        {\r\n            get\r\n            {\r\n                return __MarshallingUtils.StringFromNativeUtf8(CKLBLuaLibENG_getPlatform());\r\n            }\r\n        }\r\n        public static uint      FrameId\r\n        {\r\n            get \r\n            {\r\n                return CKLBLuaLibENG_getFrameID();\r\n            }\r\n        }\r\n\r\n        public static void getNanoTime(ref int milli, ref int nano)\r\n        {\r\n            CKLBLuaLibENG_getNanoTime(ref milli, ref nano);\r\n        }\r\n\r\n        public static void startNanoTime(int idx)\r\n        {\r\n            CKLBLuaLibENG_startNanoTime(idx);\r\n        }\r\n\r\n        public static void endNanoTime(int idx, ref int milli, ref int nano)\r\n        {\r\n            CKLBLuaLibENG_endNanoTime(idx, ref milli, ref nano);\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSFont.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CSFont : GameObject\r\n    {\r\n        #region DllImports\r\n        // fontName : const char*\r\n        // return : FONTOBJ*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibFONT_createFont(int size, IntPtr fontName);\r\n\r\n        // font : FONTOBJ*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibFONT_removeFont(IntPtr font);\r\n\r\n        // str : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibFONT_cmdGetTextInfo(IntPtr str, IntPtr font, out STextInfo outInfo);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"LibFont\"/*, typeof(CSFont)*/);\r\n\r\n        public CSFont(uint size, String name)\r\n\t\t\t: base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBLuaLibFONT_createFont((int)size, __MarshallingUtils.NativeUtf8FromString(name));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_size = size;\r\n            m_name = name;\r\n        }\r\n\r\n        #endregion\r\n\r\n        [StructLayout(LayoutKind.Sequential, Pack = 1)]\r\n        public struct STextInfo\r\n        {\r\n            public float width;\r\n            public float height;\r\n            public float ascent;\r\n            public float descent;\r\n            public float top;\r\n            public float bottom;\r\n        }\r\n\r\n        private uint    m_size;\r\n        private String  m_name;\r\n        public  uint    Size\r\n        {\r\n            get { return m_size; }\r\n            set \r\n            {  \r\n                if(CppObject != IntPtr.Zero) {\r\n                    m_size = value;\r\n                    CKLBLuaLibFONT_removeFont(CppObject); // destroyes the C++ font and unregister the C# game object !\r\n                    NativeManagement.resetCppError();\r\n                    IntPtr ptr = CKLBLuaLibFONT_createFont((int)value, __MarshallingUtils.NativeUtf8FromString(m_name));\r\n                    NativeManagement.intercepCppError();\r\n                    WrapperReg.getInstance().registerGameObject(this);\r\n                    bind(ptr);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public  String  Name\r\n        {\r\n            get { return m_name; }\r\n            set \r\n            {  \r\n                if(CppObject != IntPtr.Zero) {\r\n                    m_name = value;\r\n                    CKLBLuaLibFONT_removeFont(CppObject);\r\n                    NativeManagement.resetCppError();\r\n                    IntPtr ptr = CKLBLuaLibFONT_createFont((int)m_size, __MarshallingUtils.NativeUtf8FromString(value));\r\n                    NativeManagement.intercepCppError();\r\n                    WrapperReg.getInstance().registerGameObject(this);\r\n                    bind(ptr);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        internal override void clearInternals()\r\n\t\t{\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibFONT_removeFont(CppObject);\r\n            }\r\n\t\t}\r\n\t\t\r\n\t\tpublic void getTextInfo(String text, out STextInfo info)\r\n\t\t{\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibFONT_cmdGetTextInfo(__MarshallingUtils.NativeUtf8FromString(text), CppObject, out info);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSGL.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSGL\r\n    {\r\n\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibGL_GLClearColor(float r, float g, float b, float a);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibGL_GLSetResolution(int width, int height);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibGL_GLCreateScreenAsset(IntPtr name);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibGL_GLDoScreenShot(IntPtr name);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibGL_GLFreeScreenAsset(IntPtr name);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibGL_SGGetGuardBand(ref float leftBorder, ref float rightBorder, ref float topBorder, ref float bottomBorder);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibGL_SGSetGuardBand(float leftBorder, float rightBorder, float topBorder, float bottomBorder);\r\n        #endregion\r\n\r\n        public static void clearColor(float r, float g, float b, float a)\r\n        {\r\n            CKLBLuaLibGL_GLClearColor(r, g, b, a);\r\n        }\r\n\r\n        public static void setResolution(int width, int height)\r\n        {\r\n            CKLBLuaLibGL_GLSetResolution(width, height);\r\n        }\r\n\r\n        public static bool createScreenAsset(String name)\r\n        {\r\n            return CKLBLuaLibGL_GLCreateScreenAsset(__MarshallingUtils.NativeUtf8FromString(name));\r\n        }\r\n\r\n        public static bool doScreenShot(String name)\r\n        {\r\n            return CKLBLuaLibGL_GLDoScreenShot(__MarshallingUtils.NativeUtf8FromString(name));\r\n        }\r\n\r\n        public static void freeScreenAsset(String name)\r\n        {\r\n            CKLBLuaLibGL_GLFreeScreenAsset(__MarshallingUtils.NativeUtf8FromString(name));\r\n        }\r\n\r\n        public static void getGuardBand(ref float leftBorder, ref float rightBorder, ref float topBorder, ref float bottomBorder)\r\n        {\r\n            CKLBLuaLibGL_SGGetGuardBand(ref leftBorder, ref rightBorder, ref topBorder, ref bottomBorder);\r\n        }\r\n\r\n        public static void setGuardBand(float leftBorder, float rightBorder, float topBorder, float bottomBorder)\r\n        {\r\n            CKLBLuaLibGL_SGSetGuardBand(leftBorder, rightBorder, topBorder, bottomBorder);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSKey.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSKey\r\n    {\r\n        #region DllImports\r\n        // userId : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibKEY_genUserID(IntPtr userId, uint bufSize);\r\n\r\n        // userId : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibKEY_genUserPW(IntPtr userId, IntPtr buf, uint bufSize);\r\n\r\n        // serviceName & userId : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibKEY_setSecureID(IntPtr serviceName, IntPtr userId);\r\n\r\n        // serviceName & userId : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibKEY_setSecurePW(IntPtr serviceName, IntPtr passwd);\r\n\r\n        // serviceName : const char*\r\n        // buf : char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibKEY_getSecureID(IntPtr serviceName, IntPtr buf, uint bufSize);\r\n\r\n        // serviceName : const char*\r\n        // buf : char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibKEY_getSecurePW(IntPtr serviceName, IntPtr buf, uint bufSize);\r\n\r\n        // serviceName : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibKEY_delSecureID(IntPtr serviceName);\r\n\r\n        // serviceName : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibKEY_delSecurePW(IntPtr serviceName);\r\n        #endregion\r\n\r\n        public static int genUserID(out String userId, uint bufSize = 1024)\r\n        {\r\n            IntPtr intPtr = __MarshallingUtils.NativeUtf8FromString(new String('0', (int)bufSize));\r\n            int len = CKLBLuaLibKEY_genUserID(intPtr, bufSize);\r\n            userId = __MarshallingUtils.StringFromNativeUtf8(intPtr);\r\n            return len;\r\n        }\r\n\r\n        public static int genUserPW(String userId, out String passwd, uint bufSize = 1024)\r\n        {\r\n            IntPtr intPtr = __MarshallingUtils.NativeUtf8FromString(new String('0', (int)bufSize));\r\n            int len = CKLBLuaLibKEY_genUserPW(__MarshallingUtils.NativeUtf8FromString(userId), intPtr, bufSize);\r\n            passwd = __MarshallingUtils.StringFromNativeUtf8(intPtr);\r\n            return len;\r\n        }\r\n\r\n        public static bool setSecureID(String serviceName, String userId)\r\n        {\r\n            return CKLBLuaLibKEY_setSecureID(__MarshallingUtils.NativeUtf8FromString(serviceName), __MarshallingUtils.NativeUtf8FromString(userId));\r\n        }\r\n\r\n        public static bool setSecurePW(String serviceName, String passwd)\r\n        {\r\n            return CKLBLuaLibKEY_setSecurePW(__MarshallingUtils.NativeUtf8FromString(serviceName), __MarshallingUtils.NativeUtf8FromString(passwd));\r\n        }\r\n\r\n        public static int getSecureID(String serviceName, out String secureID, uint bufSize = 1024)\r\n        {\r\n            IntPtr intPtr = __MarshallingUtils.NativeUtf8FromString(new String('0', (int)bufSize));\r\n            int len = CKLBLuaLibKEY_getSecureID(__MarshallingUtils.NativeUtf8FromString(serviceName), intPtr, bufSize);\r\n            secureID = __MarshallingUtils.StringFromNativeUtf8(intPtr);\r\n            return len;\r\n        }\r\n\r\n        public static int getSecurePW(String serviceName, out String securePW, uint bufSize = 1024)\r\n        {\r\n            IntPtr intPtr = __MarshallingUtils.NativeUtf8FromString(new String('0', (int)bufSize));\r\n\t\t\tint len = CKLBLuaLibKEY_getSecurePW(__MarshallingUtils.NativeUtf8FromString(serviceName), intPtr, bufSize);\r\n            securePW = __MarshallingUtils.StringFromNativeUtf8(intPtr);\r\n            return len;\r\n        }\r\n\r\n        public static bool delSecureID(String serviceName)\r\n        {\r\n            return CKLBLuaLibKEY_delSecureID(__MarshallingUtils.NativeUtf8FromString(serviceName));\r\n        }\r\n\r\n        public static bool delSecurePW(String serviceName)\r\n        {\r\n            return CKLBLuaLibKEY_delSecurePW(__MarshallingUtils.NativeUtf8FromString(serviceName));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSLang.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSLang\r\n    {\r\n\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibLANG_addString(IntPtr id, IntPtr str);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibLANG_getString(IntPtr id);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibLANG_removeString(IntPtr id);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibLANG_useDB(IntPtr dbFile, IntPtr table, IntPtr keyF, IntPtr valueF, IntPtr groupF);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibLANG_loadGroup(IntPtr groupId);\r\n        #endregion\r\n\r\n        public static bool addString(String id, String str) \r\n        {\r\n            return CKLBLuaLibLANG_addString(__MarshallingUtils.NativeUtf8FromString(id), __MarshallingUtils.NativeUtf8FromString(str));\r\n        }\r\n        public static String getString(String id) \r\n        {\r\n            return __MarshallingUtils.StringFromNativeUtf8(CKLBLuaLibLANG_getString(__MarshallingUtils.NativeUtf8FromString(id)));\r\n        }\r\n        public static void removeString(String id)\r\n        {\r\n            CKLBLuaLibLANG_removeString(__MarshallingUtils.NativeUtf8FromString(id));\r\n        }\r\n        public static bool useDB(String dbFile, String table, String keyF, String valueF, String groupF = null) \r\n        {\r\n            return CKLBLuaLibLANG_useDB(__MarshallingUtils.NativeUtf8FromString(dbFile), __MarshallingUtils.NativeUtf8FromString(table), __MarshallingUtils.NativeUtf8FromString(keyF), __MarshallingUtils.NativeUtf8FromString(valueF), __MarshallingUtils.NativeUtf8FromString(groupF));\r\n        }\r\n        public static bool loadGroup(String groupId)\r\n        {\r\n            return CKLBLuaLibLANG_loadGroup(__MarshallingUtils.NativeUtf8FromString(groupId));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSMatrix.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CSMatrix : ICloneable\r\n\t{\r\n        public class CSVector : ICloneable\r\n        {\r\n            private float[] m_vector;\r\n\r\n            public float this[int i]\r\n            {\r\n                get { return m_vector[i]; }\r\n            }\r\n\r\n            public CSVector(float[] vector)\r\n            {\r\n                m_vector = vector;\r\n            }\r\n\r\n            public object Clone()\r\n            {\r\n                return new CSVector((float[])m_vector.Clone());\r\n            }\r\n        }\r\n\r\n        private const float EPSILON = 1e-5f;\r\n        private float[] m_matrix;\r\n\r\n        public float this[int i, int j]\r\n        {\r\n            get { return m_matrix[4 * i + j]; }\r\n            //private set { m[4 * j + i] = value; }\r\n        }\r\n\r\n        public CSMatrix(float[] matrix = null)\r\n        {\r\n            if(matrix != null) {\r\n                if(matrix.Length == 16) {\r\n                    m_matrix = matrix;\r\n                } else {\r\n                    throw new CKLBException(\"Length must be 16.\");\r\n                }\r\n            } else {\r\n                //create a 4x4 identity matrix\r\n                m_matrix = new float[16] {\r\n                    1,  0,  0,  0,\r\n                    0,  1,  0,  0,\r\n                    0,  0,  1,  0,\r\n                    0,  0,  0,  1\r\n                };\r\n            }\r\n        }\r\n\r\n        public object Clone()\r\n        {\r\n            return new CSMatrix((float[])m_matrix.Clone());\r\n        }\r\n\r\n        public CSMatrix Copy()\r\n        {\r\n            return (CSMatrix)this.Clone();\r\n        }\r\n\r\n        public CSMatrix Transposed()\r\n        {\r\n            float[] res = new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\r\n            for(int i = 0; i < 4; ++i) {\r\n                for(int j = 0; j < 4; ++j) {\r\n                    res[4 * i + j] = m_matrix[4 * j + i];\r\n                }\r\n            }\r\n            return new CSMatrix(res);\r\n        }\r\n\r\n        public CSMatrix Mul(CSMatrix mat)\r\n        {\r\n\t\t\tfloat[] res = new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\r\n            for(int i = 0; i < 4; ++i) {\r\n                for(int j = 0; j < 4; ++j) {\r\n                    for(int k = 0; k < 4; ++k) {\r\n                        res[4 * j + i] += this[i, k] * mat[k, j];\r\n                    }\r\n                }\r\n            }\r\n            return new CSMatrix(res);\r\n        }\r\n\r\n\t\t// Operator overloading is not supported by the compiler yet.\r\n        //public static CSMatrix operator*(CSMatrix A, CSMatrix B)\r\n        //{\r\n        //    return A.Mul(B);\r\n        //}\r\n\r\n        public CSVector Mul(CSVector vect)\r\n        {\r\n            float[] res = new float[] { 0, 0, 0, 0 };\r\n            for(int i = 0; i < 4; ++i) {\r\n                for(int k = 0; k < 4; ++k) {\r\n                    res[i] += this[i, k] * vect[k];\r\n                }\r\n            }\r\n            return new CSVector(res);\r\n        }\r\n\r\n        //public static CSVector operator *(CSMatrix mat, CSVector vect)\r\n        //{\r\n        //    return mat.Mul(vect);\r\n        //}\r\n\r\n        public static float fabs(float f) { return f >= 0 ? f : f*(-1); }\r\n\r\n        public CSMatrix Inverse()\r\n        {\r\n            float[] A = m_matrix;\r\n            float[] B = new float[] {\r\n                    1.0f,  0.0f,  0.0f,  0.0f,\r\n                    0.0f,  1.0f,  0.0f,  0.0f,\r\n                    0.0f,  0.0f,  1.0f,  0.0f,\r\n                    0.0f,  0.0f,  0.0f,  1.0f\r\n            };\r\n\r\n            for(int y = 0; y < 4; ++y) {\r\n                float n = A[4 * y + y];\r\n                if(fabs(n) < EPSILON) return null;\r\n\r\n                for(int x = 0; x < 4; ++x) {\r\n                    A[4 * y + x] /= n;\r\n                    B[4 * y + x] /= n;\r\n                }\r\n                for(int x = 0; x < 4; ++x) {\r\n                    if(x == y) { continue; }\r\n                    n = A[4 * x + y];\r\n                    for(int z = 0; z < 4; ++z) {\r\n                        A[4 * x + z] -= A[4 * y + z] * n;\r\n                        B[4 * x + z] -= B[4 * y + z] * n;\r\n                    }\r\n                }\r\n            }\r\n            return new CSMatrix(B);\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSRES.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSRES\r\n    {\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibRES_dumpSceneGraph(IntPtr task);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibRES_dumpRendering(bool detailed);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibRES_dumpAssets();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibRES_dumpDataSet();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibRES_dumpTexturePacker(bool detailed);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibRES_dumpGeometryCost(bool detailed);\r\n        #endregion\r\n\t\t\r\n        public static void dumpSceneGraph(CKLBUITask task = null)\r\n        {\r\n            if(task != null) {\r\n                CKLBLuaLibRES_dumpSceneGraph(task.CppObject);\r\n            } else {\r\n                CKLBLuaLibRES_dumpSceneGraph(IntPtr.Zero);\r\n            }\r\n        }\r\n\r\n        public static void dumpRendering(bool detailed = false)\r\n        {\r\n            CKLBLuaLibRES_dumpRendering(detailed);\r\n        }\r\n\r\n        public static void dumpAssets()\r\n        {\r\n            CKLBLuaLibRES_dumpAssets();\r\n        }\r\n\r\n        public static void dumpDataSet()\r\n        {\r\n            CKLBLuaLibRES_dumpDataSet();\r\n        }\r\n\r\n        public static void dumpTexturePacker(bool detailed = false)\r\n        {\r\n            CKLBLuaLibRES_dumpTexturePacker(detailed);\r\n        }\r\n\r\n        public static void dumpGeometryCost(bool detailed = false)\r\n        {\r\n            CKLBLuaLibRES_dumpGeometryCost(detailed);\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSSound.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CSSound : GameObject\r\n    {\r\n        #region DllImports\r\n        // sndAsset : const char*\r\n        // return CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBLuaLibSOUND_cmdSoundOpen(IntPtr sndAsset, bool fBgm);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBLuaLibSOUND_cmdSoundSetBufSize(IntPtr pSnd, int level);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundClose(IntPtr pSnd);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibSOUND_removeSoundAll();\r\n        \r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundPlay(IntPtr pSnd, uint fade_msec, float tgtVol, float globalVol);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundStop(IntPtr pSnd, uint fade_msec, float tgtVol);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundVolume(IntPtr pSnd, float volume);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundPan(IntPtr pSnd, float pan);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundPause(IntPtr pSnd);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundResume(IntPtr pSnd);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSoundSeek(IntPtr pSnd, int millisec);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibSOUND_cmdSoundTell(IntPtr pSnd);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibSOUND_cmdSoundState(IntPtr pSnd);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdVolumeBGM(float volume);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdVolumeSE(float volume);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBLuaLibSOUND_cmdGetLength(IntPtr pSnd);\r\n\r\n        // pSnd CKLBLuaLibSOUND::SOUND*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibSOUND_cmdSetFade(IntPtr pSnd, int millisec, float tgtVol);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n\t\tstatic uint s_classID = __FrameworkUtils.RegisterClass(\"LibSound\"/*, typeof(CSSound)*/);\r\n\r\n\t\tpublic CSSound(String sound_asset, bool bgmMode = false) \r\n\t\t\t: base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBLuaLibSOUND_cmdSoundOpen(__MarshallingUtils.NativeUtf8FromString(sound_asset), bgmMode);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum EBUF_SIZE\r\n        {\r\n            SND_BUF_SMALL  = 0,\r\n            SND_BUF_MEDIUM = 1,\r\n            SND_BUF_LARGE  = 2,\r\n        }\r\n\r\n        private EBUF_SIZE   m_bufSize;\r\n        private float       m_volume;\r\n        private float       m_pan;\r\n\r\n        public EBUF_SIZE    BufSize\r\n        {\r\n            get { return m_bufSize; }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n        public bool         setBufSize(EBUF_SIZE size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                m_bufSize = size;\r\n                return CKLBLuaLibSOUND_cmdSoundSetBufSize(CppObject, (int)size);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public float        Volume \r\n        { \r\n            get { return m_volume; }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    m_volume = value;\r\n                    CKLBLuaLibSOUND_cmdSoundVolume(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic float        Pan \r\n        { \r\n            get { return m_pan; }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    m_pan = value;\r\n                    CKLBLuaLibSOUND_cmdSoundPan(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public int          Length\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBLuaLibSOUND_cmdGetLength(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n        internal override void clearInternals()\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBLuaLibSOUND_cmdSoundClose(CppObject);\r\n            }\r\n\t\t}\r\n\r\n        public static void closeAll()\r\n        {\r\n            CKLBLuaLibSOUND_removeSoundAll();\r\n        }\r\n\r\n\t\tpublic void play(uint fade_msec = 0, float tgtVol = 1.0f, float globalVol = 1.0f) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibSOUND_cmdSoundPlay(CppObject, fade_msec, tgtVol, globalVol);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n\t\tpublic void stop(uint fade_msec = 0, float tgtVol = 0.0f) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibSOUND_cmdSoundStop(CppObject, fade_msec, tgtVol);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void pause() \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibSOUND_cmdSoundPause(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void resume() \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibSOUND_cmdSoundResume(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void seek(int milliseconds) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibSOUND_cmdSoundSeek(CppObject, milliseconds);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public int  tell()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBLuaLibSOUND_cmdSoundTell(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public int  state()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBLuaLibSOUND_cmdSoundState(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void setFade(int millisec, float tgtVol)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBLuaLibSOUND_cmdSetFade(CppObject, millisec, tgtVol);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n\t\tpublic static void volumeBGM(float volume) \r\n        {\r\n            CKLBLuaLibSOUND_cmdVolumeBGM(volume);\r\n        }\r\n\r\n\t\tpublic static void volumeSE(float volume) \r\n        {\r\n            CKLBLuaLibSOUND_cmdVolumeSE(volume);\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSSystem.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSSystem\r\n    {\r\n        #region DllImports\r\n        // msg : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaEnv_cmdLogging(IntPtr msg);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaEnv_cmdExit();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaEnv_cmdSystemInfo(ref int width, ref int height);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaEnv_cmdSystemReboot();\r\n        #endregion\r\n\r\n        public struct SystemInfo\r\n        {\r\n            public int width;\r\n            public int height;\r\n        }\r\n\r\n        public static void logging(String msg) \r\n        {\r\n            CKLBLuaEnv_cmdLogging(__MarshallingUtils.NativeUtf8FromString(msg));\r\n        }\r\n\r\n        public static void exitGame() \r\n        {\r\n            CKLBLuaEnv_cmdExit();\r\n        }\r\n\r\n        public static void getInfo(out SystemInfo sysInfos)\r\n        {\r\n            int width = 0, height = 0;\r\n            CKLBLuaEnv_cmdSystemInfo(ref width, ref height);\r\n            sysInfos.width = width;\r\n            sysInfos.height = height;\r\n        }\r\n\r\n        public static void reboot()\r\n        {\r\n            CKLBLuaEnv_cmdSystemReboot();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Libs/CSUI.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public static class CSUI\r\n    {\r\n        public enum E_POSITION {\r\n\t        LEFT\t = 0x00000001,\r\n\t        RIGHT    = 0x00000002,\r\n\t        H_CENTER = 0x00000003, // LEFT | RIGHT\r\n\r\n\t        TOP      = 0x00000004,\r\n\t        BOTTOM   = 0x00000008,\r\n\t        V_CENTER = 0x0000000c, // TOP | BOTTOM\r\n        };\r\n\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBLuaLibUI_calcPosition(float x, float y, float w, float h, uint mask, ref float out_rx, ref float out_ry);\r\n        #endregion\r\n\r\n        public static void calcPosition(float x, float y, float w, float h, E_POSITION mask, ref float out_rx, ref float out_ry)\r\n        {\r\n            CKLBLuaLibUI_calcPosition(x, y, w, h, (uint)mask, ref out_rx, ref out_ry);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBAsyncLoader.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CKLBAsyncLoader : CKLBTask\r\n    {\r\n        #region DllImports\r\n        \r\n        // pParentTask  : CKLBTask\r\n        // assets       : const char**\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBAsyncLoader_create(IntPtr pParentTask, IntPtr[] assets, uint count, uint datasetID);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBAsyncLoader_getProcessCount(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBAsyncLoader_getTotalCount(IntPtr p);\r\n        #endregion\r\n\r\n        #region Constructors\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UTIL_AsyncLoader\"/*, typeof(CKLBAsyncLoader)*/);\r\n\r\n        public CKLBAsyncLoader(CKLBTask pParent, String[] assets, uint datasetID, CallBack callback)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBAsyncLoader_create((pParent != null) ? pParent.CppObject : IntPtr.Zero, \r\n                                                 __MarshallingUtils.NativeUtf8ArrayFromStringArray(assets, assets.Length), (uint)assets.Length, datasetID);\r\n            NativeManagement.intercepCppError();\r\n            m_callback = callback;\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBAsyncLoader() : base(s_classID) { }\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBAsyncLoader caller, uint loaded, uint total);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUU(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(uint loaded, uint total)\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this, loaded, total);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        #endregion\r\n\r\n        public uint ProcessCount\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBAsyncLoader_getProcessCount(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n        public uint TotalCount\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBAsyncLoader_getTotalCount(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBGenericTask.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CKLBGenericTask : CKLBTask\r\n    {\r\n        #region DllImports\r\n        // pParent : CKLBTask*\r\n        // arr_index : const char*\r\n        // return : CKLBGenericTask*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBGenericTask_create(IntPtr pParent, uint phase);\r\n        #endregion\r\n\r\n        #region Constructors\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"TASK_Generic\"/*, typeof(CKLBGenericTask)*/);\r\n\r\n        public CKLBGenericTask(CKLBTask parent, CKLBTask.ETASK_PHASE phase, ExecuteCallBack executeCallBack, DieCallBack dieCallBack)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBGenericTask_create(parent != null ? parent.CppObject : IntPtr.Zero, (uint)phase);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_executeCallBack = executeCallBack;\r\n            m_dieCallBack = dieCallBack;\r\n        }\r\n        public CKLBGenericTask() : base(s_classID) { }\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void ExecuteCallBack(CKLBGenericTask caller, uint deltaTime);\r\n        public delegate void DieCallBack(CKLBGenericTask caller);\r\n\r\n        private ExecuteCallBack m_executeCallBack;  // callback number 0\r\n        private DieCallBack     m_dieCallBack;      // callback number 1\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerU(executeCallBackFunction),    0);\r\n            registerCallBack(new NativeManagement.FunctionPointerV(dieCallBackFunction),        1);\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            if(delegateName == \"execute\")\r\n            {\r\n                m_executeCallBack = (ExecuteCallBack)anyDelegate;\r\n            }\r\n            else if(delegateName == \"die\")\r\n            {\r\n                m_dieCallBack = (DieCallBack)anyDelegate;\r\n            }\r\n            else {\r\n                throw new CKLBException(\"Unvalid delegate name\");\r\n            }\r\n        }\r\n\r\n        public virtual void executeCallBackFunction(uint deltaTime)\r\n        {\r\n            if(m_executeCallBack != null)\r\n            {\r\n                m_executeCallBack(this, deltaTime);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        public virtual void dieCallBackFunction()\r\n        {\r\n            if(m_dieCallBack != null) {\r\n                m_dieCallBack(this);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBIntervalTimer.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBIntervalTimer : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // return : CKLBIntervalTimer*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBIntervalTimer_create(IntPtr pParent, uint interval, bool repeat, byte mode);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBIntervalTimer_getTimerID(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBIntervalTimer_setTimerID(IntPtr p, uint ID);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBIntervalTimer_getRepeat(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBIntervalTimer_setRepeat(IntPtr p, bool boolean);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBIntervalTimer_getInterval(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBIntervalTimer_setInterval(IntPtr p, uint interval);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static byte CKLBIntervalTimer_getMode(IntPtr p);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UTIL_IntervalTimer\"/*, typeof(CKLBIntervalTimer)*/);\r\n\r\n        public CKLBIntervalTimer(CKLBTask parent, uint interval, CallBack callback, bool repeat = false, ETIMERMODE mode = ETIMERMODE.INTERVALTIMER_TIME) \r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBIntervalTimer_create(parent != null ? parent.CppObject : IntPtr.Zero, interval, repeat, (byte)mode);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBIntervalTimer() : base(s_classID) { }\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBIntervalTimer caller);\r\n\r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerV(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction()\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum ETIMERMODE : byte\r\n        {\r\n            INTERVALTIMER_TIME = 0,\r\n            INTERVALTIMER_FRAME\r\n        }\r\n\r\n        public ETIMERMODE   Mode \r\n        {\r\n            get\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn (ETIMERMODE)CKLBIntervalTimer_getMode(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\t\tpublic uint         Interval\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBIntervalTimer_getInterval(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBIntervalTimer_setInterval(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic bool         Repeat\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBIntervalTimer_getRepeat(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBIntervalTimer_setRepeat(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBNetAPI.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CKLBNetAPI : CKLBTask\r\n    {\r\n        #region DllImports\r\n        // pParent  : CKLBTask*\r\n        // apiurl   : const char*\r\n        // client_version   : const char*\r\n        // consumer_key     : const char*\r\n        // application_id   : const char*\r\n        // region   : const char*\r\n        // return   : CKLBNetAPI*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static IntPtr CKLBNetAPI_create( IntPtr pParent, IntPtr apiurl, IntPtr client_version, IntPtr consumerKey,\r\n                                                        IntPtr applicationId, uint sessionMax, IntPtr region);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBNetAPI_startUp(IntPtr p, IntPtr loginID, IntPtr password, IntPtr invite, uint timeout, ref uint session);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBNetAPI_login(IntPtr p, IntPtr loginID, IntPtr password, uint timeout, ref uint session);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBNetAPI_cancel(IntPtr p, uint uniq);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBNetAPI_cancelAll(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBNetAPI_watchMaintenance(IntPtr p, uint timeout, ref uint session);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBNetAPI_debugHdr(IntPtr p, bool debugflag);\r\n\r\n        // body     : const char*\r\n        // buf      : char[512]\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static void CKLBNetAPI_genCmdNumID(IntPtr p, IntPtr body, int serial, IntPtr buf);\r\n\t\t\r\n        // apiURL   : const char*\r\n        // json     : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBNetAPI_sendHTTP(IntPtr p, IntPtr apiURL, IntPtr json, uint timeout, bool passVersionCheck, ref uint session);\r\n        #endregion\r\n\r\n        #region Constructors\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"HTTP_API\"/*, typeof(CKLBNetAPI)*/);\r\n\r\n        public CKLBNetAPI(CKLBTask parent, String apiUrl, String clientVersion, String consumerKey, String applicationID, uint sessionMax = 1, String region = \"840\" /*America*/, CallBack callback = null, CallBackVersionUp versionUpCallback = null)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBNetAPI_create( parent != null ? parent.CppObject : IntPtr.Zero,__MarshallingUtils.NativeUtf8FromString(apiUrl),__MarshallingUtils.NativeUtf8FromString(clientVersion),\r\n                                            __MarshallingUtils.NativeUtf8FromString(consumerKey),__MarshallingUtils.NativeUtf8FromString(applicationID),sessionMax,__MarshallingUtils.NativeUtf8FromString(region));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n\r\n            m_callback          = callback;\r\n            m_callbackVersionUp = versionUpCallback;\r\n        }\r\n\r\n        public CKLBNetAPI() : base(s_classID) { }\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate bool CallBack(CKLBNetAPI caller, int uniq, ESTATUS msg, int status, IntPtr pRoot);\r\n        public delegate void CallBackVersionUp(CKLBNetAPI caller, String clientVer, String serverVer);\r\n        \r\n        private CallBack            m_callback;\r\n        private CallBackVersionUp   m_callbackVersionUp;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerIIIP_retB(callBackFunction),   0);\r\n            registerCallBack(new NativeManagement.FunctionPointerSS(callBackVersionUpFunction), 1);\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            if(delegateName == \"versionUp\") {\r\n                m_callbackVersionUp = (CallBackVersionUp)anyDelegate;\r\n            } else {\r\n                m_callback = (CallBack)anyDelegate;\r\n            }\r\n        }\r\n\r\n        public virtual bool callBackFunction(int uniq, int msg, int status, IntPtr pRoot)\r\n        {\r\n            if(m_callback != null) {\r\n                return m_callback(this, uniq, (ESTATUS)msg, status, pRoot);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        public virtual void callBackVersionUpFunction(IntPtr clientVer, IntPtr serverVer)\r\n        {\r\n            if(m_callbackVersionUp != null) {\r\n                m_callbackVersionUp(this, __MarshallingUtils.StringFromNativeUtf8(clientVer), __MarshallingUtils.StringFromNativeUtf8(serverVer));\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        #endregion\r\n\r\n        public enum ESTATUS\r\n        {\r\n\t        // メッセージ値定義\r\n\t        NETAPIMSG_SESSION_CANCELED  = -999,\t// セッションはキャンセルされた\r\n\t        NETAPIMSG_CONNECTION_FAILED = -500,\t// 接続に失敗した\r\n\r\n\t        NETAPIMSG_INVITE_FAILED     = -200,\t// Invite status の処理に失敗\r\n\t        NETAPIMSG_STARTUP_FAILED    = -100,\t// ユーザ登録失敗\r\n\t        NETAPIMSG_SERVER_TIMEOUT    = -4,\t// サーバとの通信がタイムアウトした\r\n\t        NETAPIMSG_REQUEST_FAILED    = -3,\t// サーバがリクエストに対しエラーを返した\r\n\t        NETAPIMSG_LOGIN_FAILED      = -2,\t// ログイン失敗\r\n\t        NETAPIMSG_SERVER_ERROR      = -1,\t// サーバにアクセスできない/サーバからのパケットを解釈できない\r\n\t        NETAPIMSG_UNKNOWN           = 0,\r\n\r\n\t        NETAPIMSG_LOGIN_SUCCESS     = 2,\t// ログイン成功\r\n\t        NETAPIMSG_REQUEST_SUCCESS   = 3,\t// リクエスト成功ステータス\r\n\t        NETAPIMSG_STARTUP_SUCCESS   = 100,\t// ユーザ登録成功\r\n\t        NETAPIMSG_INVITE_SUCCESS    = 200\t// Invite status の処理に成功\r\n        }\r\n\r\n        public bool startUp(ref uint session, String loginID, String password, String invite = null, uint timeout = 0)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                bool res = CKLBNetAPI_startUp(CppObject, __MarshallingUtils.NativeUtf8FromString(loginID), __MarshallingUtils.NativeUtf8FromString(password), __MarshallingUtils.NativeUtf8FromString(invite), timeout, ref session);\r\n                return res;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool login(ref uint session, String loginID, String password, uint timeout = 0)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                bool res = CKLBNetAPI_login(CppObject, __MarshallingUtils.NativeUtf8FromString(loginID), __MarshallingUtils.NativeUtf8FromString(password), timeout, ref session);\r\n                return res;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool cancel(uint session)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBNetAPI_cancel(CppObject, session);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool send(ref uint session, String json, String apiURL = \"/api\", uint timeout = 0, bool pass_version_check = false)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBNetAPI_sendHTTP(CppObject, __MarshallingUtils.NativeUtf8FromString(apiURL), __MarshallingUtils.NativeUtf8FromString(json), timeout, pass_version_check, ref session);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void cancelAll()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBNetAPI_cancelAll(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool watchMaintenance(ref uint session, uint timeout = 0)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBNetAPI_watchMaintenance(CppObject, timeout, ref session);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void debugHdr(bool debugflag)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBNetAPI_debugHdr(CppObject, debugflag);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void genCmdNumID(ref String numID, String body, int serial)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                IntPtr intPtr = __MarshallingUtils.NativeUtf8FromString(new String('0', 512));\r\n                CKLBNetAPI_genCmdNumID(CppObject, __MarshallingUtils.NativeUtf8FromString(body), serial, intPtr);\r\n                numID = __MarshallingUtils.StringFromNativeUtf8(intPtr);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBStoreService.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CKLBStoreService : CKLBTask\r\n    {\r\n        #region DllImports\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBStoreService_create();\r\n\r\n        // items : const char**\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBStoreService_buyItems(IntPtr p, IntPtr item);\r\n\r\n        // json : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBStoreService_getProducts(IntPtr p, IntPtr json, bool currency);\r\n        #endregion\r\n\r\n        #region Constructors\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"STORE_Service\"/*, typeof(CKLBStoreService)*/);\r\n\r\n        public CKLBStoreService(CallBack callback)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBStoreService_create();\r\n            NativeManagement.intercepCppError();\r\n            m_callback = callback;\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBStoreService() : base(s_classID) { }\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBStoreService caller, IClientRequest.EVENT_TYPE type, String itemID, String param);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUSS(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(/* IClientRequest.EVENT_TYPE */ uint type, IntPtr itemID, IntPtr param)\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this, (IClientRequest.EVENT_TYPE)type, __MarshallingUtils.StringFromNativeUtf8(itemID), __MarshallingUtils.StringFromNativeUtf8(param));\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        #endregion\r\n\r\n        public void buyItems(String item)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBStoreService_buyItems(CppObject, __MarshallingUtils.NativeUtf8FromString(item));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void getProducts(String json, bool currency) {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBStoreService_getProducts(CppObject, __MarshallingUtils.NativeUtf8FromString(json), currency);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBTask.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    /// <summary>\r\n    /// A task is the basic object instance in our framework.\r\n    /// Everything in a game is based on tasks from network to rendering or event processing.\r\n    /// \r\n    /// Tasks are executed in a specific order called phase (See ETASKPhase enum).\r\n    /// \r\n    /// Inside a phase, order is not garanteed, so multiple tasks inside the same phase\r\n    /// have no garanteed order.\r\n    /// \r\n    /// Task can have child/parent relationship and it is possible for parents to have different phases from their children.\r\n    /// \r\n    /// When a parent task dies, all the subtree of task also dies within the same frame.\r\n    /// \r\n    /// Because of possible relations that could occur between tasks. All tasks are killed at the end of the frame\r\n    /// and not right away. Thus allowing dependancy or execution order to be impactless when a task dies.\r\n    /// But still, tasks should not be modified by other tasks except the \"scripting\" itself.\r\n    /// \r\n    /// As an example, a progress bar is modified by the game logic tasks performed before the progress bar task.\r\n    /// But any other task should not modify the progress bar too, or have its own logic based on the output from the progress bar.\r\n    /// \r\n    /// Consider that we could one day declare tasks to be multithreaded and executed seperatly on another CPU.\r\n    /// Thus there must be no dependancy between tasks in any way and only the main game logic should be able to set/get things\r\n    /// with tasks.\r\n    /// \r\n    /// </summary>\r\n    public class CKLBTask : GameObject\r\n    {\r\n        #region DllImports\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void Task_kill(IntPtr task);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void Task_setStageTask(IntPtr task);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void Task_clearStageTask();\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void Task_setPause(IntPtr task, bool bPause, bool bRecursive);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void Task_setManagerPause(bool bPause);\r\n\r\n        // pTask & pTimer : CKLBTask\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void Task_interposeTimer(IntPtr pTask, IntPtr pTimer);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool Task_isKill(IntPtr task);\r\n        #endregion\r\n\r\n        #region Constructors\r\n        // Just throws the classID to GameObject\r\n        internal CKLBTask(uint classID) : base(classID) { \r\n            m_timer = null;\r\n        }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n        public delegate void onDieCallBack(CKLBTask caller);\r\n\r\n        private onDieCallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerV(onDieCallBackFunction), 5);\r\n        }\r\n\r\n        public void setOnDieCallBack(onDieCallBack anyDelegate)\r\n        {\r\n            m_callback = anyDelegate;\r\n        }\r\n\r\n        public virtual void onDieCallBackFunction()\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this);\r\n            } /*else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }*/\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CKLBIntervalTimer m_timer;\r\n\r\n        /// <summary>\r\n        /// Phase where the task can be executed.\r\n        /// </summary>\r\n        public enum ETASK_PHASE\r\n        {\r\n            P_BEGIN     = 0,        //!< フレーム開始時の処理。描画エンジンのリフレッシュ処理等はこのフェーズに登録。\r\n\r\n            P_INPUT     = 1,        //!< ユーザ操作の取得など\r\n\r\n\t\t    P_DBGSIGN   = 2,\t\t//!< デバッグコマンド受付\r\n\t\t    P_DBGMENU   = 3,\t\t//!< デバッグメニュー処理\r\n\r\n\t\t    P_UIPREV    = 4,\t\t//!< 標準UIパーツより先に処理するUIフェーズ\r\n\r\n\t\t    P_SCRIPT    = 5,       //!< スクリプト的な処理タスクはこのフェーズに登録\r\n\r\n\t\t    P_UIPROC    = 6,\t\t//!< UIパーツの処理を行うフェーズ\r\n\t\t    P_UIAFTER   = 7,\t\t//!< 他のUIパーツを子タスクとして使用するUIタスク用のフェーズ\r\n\r\n            P_MENU      = 8,         //!< メニューフェーズ: メニュー処理タスクはこのフェーズに登録。ポーズ中でも実行される。\r\n\r\n            // P_PREV, P_NORMAL, P_AFTER はポーズ中実行されない。\r\n            P_PREV      = 9,         //!< (ポーズ中停止)通常タスク以前に処理しなければならないもの\r\n            P_NORMAL    = 10,      //!< (ポーズ中停止)通常のタスクはここで処理\r\n            P_AFTER     = 11,       //!< (ポーズ中停止)通常のタスクが終わった後に処理しなければならないもの\r\n\t\t    P_JUDGE     = 12,       //!< ゲーム中の判定など\r\n\r\n            P_DRAW      = 13,        //!< 描画処理をキックするタスク等はここに登録\r\n            P_GC\t\t= 14,\r\n            P_END       = 15,         //!< 描画キック後に行う処理があればここに登録\r\n\r\n            P_MAX       = 16          //!< フェーズ総数\r\n        }\r\n\r\n        /// <summary>\r\n        /// Kills (remove and destroy) the task from the game. Object stays valid until the end of the frame, after all tasks have been executed.\r\n        /// </summary>\r\n        public void kill()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                onDieCallBackFunction();\r\n                IntPtr cppObject = CppObject;\r\n                unbind();\r\n                Task_kill(cppObject);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n\t\t/// [TODO]\r\n        /// </summary>\r\n        public bool isKill()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return Task_isKill(CppObject);\r\n            }\r\n            return true;\r\n        }\r\n\r\n        /// <summary>\r\n        /// When disposing the ressource, we automatically kill the associated task.\r\n        /// </summary>\r\n        public override void Dispose()\r\n        {\r\n            kill();\r\n\t\t\tbase.Dispose();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Pause or reactivate execution of a task.\r\n        /// If the task has children it is possible to decide if the children are affected or not.\r\n        /// Note that task by default are active.\r\n        /// </summary>\r\n        /// <param name=\"bPause\">True : Pause the task, False : Activate the task.</param>\r\n        /// <param name=\"bRecursive\">Apply also the bPause to children (true) also or not (false)</param>\r\n        public void setPause(bool bPause, bool bRecursive)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                Task_setPause(CppObject, bPause, bRecursive);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Assign a timer to the task. When the timer reach its target time, the task is killed.\r\n        /// </summary>\r\n        /// <param name=\"mode\">Timer in millisecond or frame</param>\r\n        /// <param name=\"time\">Amount of time</param>\r\n        public void setLifeTime(CKLBIntervalTimer.ETIMERMODE mode, uint time)\r\n        {\r\n            if(m_timer == null) {\r\n                CKLBIntervalTimer.CallBack cb = delegate(CKLBIntervalTimer caller) {};\r\n                m_timer = new CKLBIntervalTimer(null, time, cb, false, mode);\r\n                Task_interposeTimer(CppObject, m_timer.CppObject);\r\n            } else {\r\n                m_timer.Interval = time;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Allow the task to be associated to a global group of task called \"stage\".\r\n        /// This is usefull avoiding to remember each task to kill when the game\r\n        /// need a complete changes of tasks and many tasks need to be killed at once.\r\n        /// Just call this function to register the task to the global stage.\r\n        /// \r\n        /// See clearStage()\r\n        /// See ? global clearStage ? Not static from task ?\r\n        /// </summary>\r\n        public void stageOnly()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                Task_setStageTask(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Remove a specific task from the stage.\r\n        /// See stageOnly()\r\n        /// </summary>\r\n        /// <param name=\"task\">task to be removed</param>\r\n        public static void clearStage()\r\n        {\r\n            Task_clearStageTask();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Allow to stop/restart the task manager and freeze/run again all tasks instances in the game.\r\n        /// Note : internal tasks not seen by the game develloper do not stop, things like rendering as an example.\r\n        /// </summary>\r\n        /// <param name=\"bPause\"></param>\r\n        public static void setManagerPause(bool bPause)\r\n        {\r\n            Task_setManagerPause(bPause);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUICanvas.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUICanvas : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // return : CKLBUICanvas*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUICanvas_create(IntPtr pParent, uint order, float x, float y, uint vertexMax, uint indexMax);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUICanvas_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_setOrder(IntPtr p, uint order);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUICanvas_getIdxMax(IntPtr p);\r\n\t\t\r\n        // asset : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUICanvas_addResource(IntPtr p, IntPtr asset);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUICanvas_setFreeze(IntPtr p, bool freeze);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_drawImage(IntPtr p, float x, float y, uint idx, uint color);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_drawImageScale(IntPtr p, float x, float y, float scale, uint idx, uint color);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_fillRect(IntPtr p, float x, float y, float w, float h, uint color);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_startDynamicSection(IntPtr p, uint idx);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_endDynamicSection(IntPtr p, uint idx);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_dynamicSectionTranslate(IntPtr p, uint idx, float deltaX, float deltaY);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUICanvas_dynamicSectionColor(IntPtr p, uint idx, uint color);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Canvas\"/*, typeof(CKLBUICanvas)*/);\r\n\r\n        public CKLBUICanvas(CKLBUITask parent, uint order, float x, float y, uint vertexMax, uint indexMax, CallBack onDrawCallBack)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUICanvas_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, vertexMax, indexMax);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = onDrawCallBack;\r\n        }\r\n\r\n        public CKLBUICanvas() : base(s_classID) { }\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUICanvas caller);\r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerV(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction()\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUICanvas_getOrder(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUICanvas_setOrder(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint IdxMax\r\n\t\t{\r\n\t\t\tget\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUICanvas_getIdxMax(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n        public bool Freeze\r\n        {\r\n            //get { throw new CKLBExceptionForbiddenMethod(); }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUICanvas_setFreeze(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        public bool addResource(String asset)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                NativeManagement.resetCppError();\r\n                bool res = CKLBUICanvas_addResource(CppObject, __MarshallingUtils.NativeUtf8FromString(asset));\r\n                NativeManagement.intercepCppError();\r\n                return res;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void drawImage(float x, float y, uint idx, uint color)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_drawImage(CppObject, x, y, idx, color);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void drawImageScale(float x, float y, float scale, uint idx, uint color)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_drawImageScale(CppObject, x, y, scale, idx, color);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void fillRect(float x, float y, float w, float h, uint color)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_fillRect(CppObject, x, y, w, h, color);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void startDynamicSection(uint idx)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_startDynamicSection(CppObject, idx);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void endDynamicSection(uint idx)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_endDynamicSection(CppObject, idx);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void dynamicSectionTranslate(uint idx, float deltaX, float deltaY)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_dynamicSectionTranslate(CppObject, idx, deltaX, deltaY);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void dynamicSectionColor(uint idx, uint color)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUICanvas_dynamicSectionColor(CppObject, idx, color);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIClip.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIClip : CKLBUITask\r\n\t{\r\n        \r\n\t\t#region DllImports\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIClip_create(IntPtr pParent, uint baseOrder, uint maxOrder, float x, float y, float clipWidth, float clipHeight);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIClip_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIClip_setOrder(IntPtr p, uint order);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIClip_getMaxOdr(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIClip_setMaxOdr(IntPtr p, uint maxodr);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIClip_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIClip_setWidth(IntPtr p, float width);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIClip_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIClip_setHeight(IntPtr p, float height);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIClip_setPosition(IntPtr p, float x, float y);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIClip_setSize(IntPtr p, float width, float height);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Clip\"/*, typeof(CKLBUIClip)*/);\r\n\r\n\t\tpublic CKLBUIClip(CKLBUITask parent, uint baseOrder, uint maxOrder, float x, float y, float clipWidth, float clipHeight)\r\n            : base(s_classID)\r\n\t\t{\r\n\t\t\tNativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIClip_create( parent != null ? parent.CppObject : IntPtr.Zero, \r\n                                                baseOrder, maxOrder, x, y, clipWidth, clipHeight);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n\t\t}\r\n\r\n        public CKLBUIClip() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n\t\tpublic uint  Order\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIClip_getOrder(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIClip_setOrder(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint  MaxOrder\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIClip_getMaxOdr(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIClip_setMaxOdr(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic float Width\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIClip_getWidth(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIClip_setWidth(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic float Height\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIClip_getHeight(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIClip_setHeight(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic void  getSize(out FSize size)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tsize.width  = CKLBUIClip_getWidth(CppObject);\r\n\t\t\t\tsize.height = CKLBUIClip_getHeight(CppObject);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic void  setSize(FSize size)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIClip_setSize(CppObject, size.width, size.height);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic void  setSize(float width, float height)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIClip_setSize(CppObject, width, height);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void setPosition(float x, float y)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIClip_setPosition(CppObject, x, y);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIControl.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    public class CKLBUIControl : CKLBUITask\r\n    {\r\n        #region DllImports\r\n        // pParent : CKLBTask*\r\n        // return : CKLBUIControl*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIControl_create(IntPtr pParent);\r\n\r\n\t\t// group_name : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIControl_setGroup(IntPtr p, IntPtr groupName);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIControl_setMask(IntPtr p, ushort mask);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIControl_lock(IntPtr p, bool lockMode);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Control\"/*, typeof(CKLBUIControl)*/);\r\n\r\n        public CKLBUIControl(CKLBTask parent, OnClickCallBack onClickCallBack, OnDragCallBack onDragCallBack)\r\n            : base(s_classID) \r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIControl_create(parent != null ? parent.CppObject : IntPtr.Zero);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_onDragCallBack = onDragCallBack;\r\n            m_onClickCallBack = onClickCallBack;\r\n        }\r\n\r\n        public CKLBUIControl() : base(s_classID) { }\r\n\r\n        #endregion\r\n        \r\n        #region CallBacks\r\n\r\n        public delegate void OnClickCallBack    (CKLBUIControl caller, int x, int y);\r\n        public delegate void OnDblClickCallBack (CKLBUIControl caller, int x, int y);\r\n        public delegate void OnDragCallBack     (CKLBUIControl caller, EMODE mode, int x, int y, int mvX, int mvY);\r\n        public delegate void OnPinchCallBack    (CKLBUIControl caller, EMODE mode, float pinch, float rotation);\r\n        public delegate void OnLongTapCallBack  (CKLBUIControl caller, uint elapsedTime, int x, int y);\r\n\r\n        private OnDragCallBack m_onDragCallBack;            // callback number 0\r\n        private OnPinchCallBack m_onPinchCallBack;          // callback number 1\r\n        private OnClickCallBack m_onClickCallBack;          // callback number 2\r\n        private OnDblClickCallBack m_onDblClickCallBack;    // callback number 3\r\n        private OnLongTapCallBack m_onLongTapCallBack;      // callback number 4\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUIIII  (onDragCallBackFunction),      0);\r\n            registerCallBack(new NativeManagement.FunctionPointerUFF    (onPinchCallBackFunction),     1);\r\n            registerCallBack(new NativeManagement.FunctionPointerII     (onClickCallBackFunction),     2);\r\n            registerCallBack(new NativeManagement.FunctionPointerII     (onDblClickCallBackFunction),  3);\r\n            registerCallBack(new NativeManagement.FunctionPointerUII    (onLongTapCallBackFunction),   4);\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n\t\t/* To support in compiler\r\n            switch(delegateName)\r\n            {\r\n                case \"onDrag\":\r\n                    m_onDragCallBack = (OnDragCallBack)anyDelegate;\r\n                    break;\r\n                case \"onPinch\":\r\n                    m_onPinchCallBack = (OnPinchCallBack) anyDelegate;\r\n                    break;\r\n                case \"onClick\":\r\n                    m_onClickCallBack = (OnClickCallBack)anyDelegate;\r\n                    break;\r\n                case \"onDblClick\":\r\n                    m_onDblClickCallBack = (OnDblClickCallBack)anyDelegate;\r\n                    break;\r\n                case \"onLongtap\":\r\n                    m_onLongTapCallBack = (OnLongTapCallBack)anyDelegate;\r\n                    break;\r\n                default:\r\n                    throw new CKLBException(\"Unvalid delegate name\");\r\n            }\r\n\t\t\t*/\r\n\r\n\t\t\tif(delegateName == \"onDrag\")\r\n            {\r\n                m_onDragCallBack = (OnDragCallBack)anyDelegate;\r\n            }\r\n            else if(delegateName == \"onPinch\")\r\n            {\r\n                m_onPinchCallBack = (OnPinchCallBack)anyDelegate;\r\n            }\r\n            else if(delegateName == \"onClick\")\r\n            {\r\n                m_onClickCallBack = (OnClickCallBack)anyDelegate;\r\n            }\r\n            else if(delegateName == \"onDblClick\")\r\n            {\r\n                m_onDblClickCallBack = (OnDblClickCallBack)anyDelegate;\r\n            }\r\n            else if(delegateName == \"onLongtap\")\r\n            {\r\n                m_onLongTapCallBack = (OnLongTapCallBack)anyDelegate;\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Unvalid delegate name\");\r\n            }\r\n        }\r\n\r\n        public virtual void onClickCallBackFunction(int x, int y)\r\n        {\r\n            if(m_onClickCallBack != null)\r\n            {\r\n                m_onClickCallBack(this, x, y);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        public virtual void onDragCallBackFunction(uint /*EMODE*/ mode, int x, int y, int mvX, int mvY)\r\n        {\r\n            if(m_onDragCallBack != null)\r\n            {\r\n                m_onDragCallBack(this, (EMODE)mode, x, y, mvX, mvY);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        public virtual void onPinchCallBackFunction(uint /*EMODE*/ mode, float pinch, float rotation)\r\n        {\r\n            if(m_onPinchCallBack != null)\r\n            {\r\n                m_onPinchCallBack(this, (EMODE)mode, pinch, rotation);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        public virtual void onDblClickCallBackFunction(int x, int y)\r\n        {\r\n            if(m_onDblClickCallBack != null)\r\n            {\r\n                m_onDblClickCallBack(this, x, y);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        public virtual void onLongTapCallBackFunction(uint elapsedTime, int x, int y)\r\n        {\r\n            if(m_onLongTapCallBack != null)\r\n            {\r\n                m_onLongTapCallBack(this, elapsedTime, x, y);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum EMODE : uint\r\n        {\r\n            TAP,\r\n            DRAG,\r\n            RELEASE\r\n        }\r\n        public enum EMASK : ushort {\r\n\t        MASK_CLICK     = 0x0001,\r\n\t        MASK_DRAG      = 0x0002,\r\n\t        MASK_PINCH     = 0x0004,\r\n\t        MASK_DBLCLICK  = 0x0008,\r\n\t        MASK_LONGTAP   = 0x0010\r\n        };\r\n\r\n        public bool setGroup(String groupName) \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIControl_setGroup(CppObject, __MarshallingUtils.NativeUtf8FromString(groupName));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void setMask(EMASK mask)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIControl_setMask(CppObject, (ushort)mask);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void setLock(bool lockBool)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIControl_lock(CppObject, lockBool);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIDebugItem.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIDebugItem : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUIDebugItem*\r\n        // pParent : CKLBUITask*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIDebugItem_create(IntPtr pParent,uint order, float x, float y, uint argb, IntPtr font, uint size, IntPtr text, uint id);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIDebugItem_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDebugItem_setOrder(IntPtr p, uint order);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIDebugItem_getColor(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDebugItem_setColor(IntPtr p, uint order);\r\n\t\t\r\n\t\t// return and font : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIDebugItem_getFont(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIDebugItem_setFont(IntPtr p, IntPtr font);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIDebugItem_getSize(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDebugItem_setSize(IntPtr p, uint order);\r\n\t\t\r\n\t\t// return and text : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIDebugItem_getText(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIDebugItem_setText(IntPtr p, IntPtr text);\r\n\t\t#endregion\r\n\r\n        #region Constructors \r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_DbgLabel\"/*, typeof(CKLBUIDebugItem)*/);\r\n\r\n        //a string is given to the constructor which creates a font object\r\n        public CKLBUIDebugItem(CKLBUITask parent, uint order, float x, float y, uint argb, String font_name, uint font_size, String text, uint cmdID, CallBack callback)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIDebugItem_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, argb, __MarshallingUtils.NativeUtf8FromString(font_name), font_size, __MarshallingUtils.NativeUtf8FromString(text), cmdID);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUIDebugItem() : base(s_classID) { }\r\n        \r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUIDebugItem caller, uint cmdID);\r\n\r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerU(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(uint cmdID)\r\n        {\r\n            if(m_callback != null)\r\n            {\r\n                m_callback(this, cmdID);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public uint     Order\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIDebugItem_getOrder(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDebugItem_setOrder(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t    public String   Font\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIDebugItem_getFont(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIDebugItem_setFont(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic uint     Size\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIDebugItem_getSize(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDebugItem_setSize(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint     TextArgb\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIDebugItem_getColor(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDebugItem_setColor(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic String   Text\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn __MarshallingUtils.StringFromNativeUtf8(CKLBUIDebugItem_getText(CppObject));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDebugItem_setText(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIDragIcon.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIDragIcon : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUIDragIcon*\r\n        // pParent : CKLBUITask*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIDragIcon_create(IntPtr pParent, uint order, float x, float y, ref Area tap_area, IntPtr asset, IntPtr drag_asset,\r\n                                                            int drag_order_offset, float drag_alpha, float center_x, float center_y, uint flags);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIDragIcon_getOrder(IntPtr p);\r\n\r\n        //return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIDragIcon_getAsset(IntPtr p);\r\n\r\n        //return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIDragIcon_getDrag(IntPtr p);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIDragIcon_getFlags(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDragIcon_setFlags(IntPtr p, uint flag);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIDragIcon_getEnable(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDragIcon_setEnable(IntPtr p, bool enable);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIDragIcon_getDragScaleX(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDragIcon_setDragScaleX(IntPtr p, float x);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIDragIcon_getDragScaleY(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDragIcon_setDragScaleY(IntPtr p, float y);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIDragIcon_dragArea(IntPtr p, ref Area area);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_DragIcon\"/*, typeof(CKLBUIDragIcon)*/);\r\n\r\n        public CKLBUIDragIcon(  CKLBUITask parent, \r\n                                uint order, float x, float y, ref Area tap_area, String asset, String drag_asset, \r\n                                int drag_order_offset, float drag_alpha, float center_x, float center_y, CallBack callback, uint flags = 0)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIDragIcon_create( parent != null ? parent.CppObject : IntPtr.Zero, \r\n                                                order, x, y, ref tap_area, __MarshallingUtils.NativeUtf8FromString(asset), __MarshallingUtils.NativeUtf8FromString(drag_asset),\r\n                                                drag_order_offset, drag_alpha, center_x, center_y, flags);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUIDragIcon() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUIDragIcon caller, uint type, int x, int y);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUII(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(uint type, int x, int y)\r\n        {\r\n            if(m_callback != null){\r\n                m_callback(this, type, x, y);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        [StructLayout(LayoutKind.Sequential, Pack = 1)]\r\n        public struct Area\r\n        {\r\n            public Area(int _x, int _y, int _width, int _height)\r\n            {\r\n                x       = _x;\r\n                y       = _y;\r\n                width   = _width;\r\n                height  = _height;\r\n            }\r\n\r\n            public int x;\r\n            public int y;\r\n            public int width;\r\n            public int height;\r\n\r\n            public void setValues(int _x, int _y, int _width, int _height)\r\n            {\r\n                x       = _x;\r\n                y       = _y;\r\n                width   = _width;\r\n                height  = _height;\r\n            }\r\n        }\r\n\r\n        public enum ESTEP\r\n        {\r\n            DRAG,\r\n            RELEASE\r\n        }\r\n\r\n        public enum EFLAGS : uint\r\n        {\r\n            F_DICON_BASEINVISIBLE = 4\r\n        }\r\n\r\n\t\tpublic uint Order \r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\treturn CKLBUIDragIcon_getOrder (CppObject);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject ();\r\n\t\t\t}\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic String Asset\r\n\t\t{\r\n\t\t\tget\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIDragIcon_getAsset(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic String DragAsset\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIDragIcon_getDrag(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic EFLAGS Flags\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn (EFLAGS)CKLBUIDragIcon_getFlags(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDragIcon_setFlags(CppObject, (uint)value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic float DragScaleX\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIDragIcon_getDragScaleX(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDragIcon_setDragScaleX(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic float DragScaleY\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIDragIcon_getDragScaleY(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIDragIcon_setDragScaleY(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n        public bool Enable\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIDragIcon_getEnable(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIDragIcon_setEnable(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n\t\t\t\t}\r\n            }\r\n        }\r\n\r\n        public void dragArea(Area area) \r\n        {  \r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIDragIcon_dragArea(CppObject, ref area);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIForm.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIForm : CKLBUITask\r\n\t{\r\n        #region DllImports\r\n        //return : CKLBUIForm*\r\n        // pParent : CKLBUITask*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIForm_create(IntPtr pParent, uint order, float x, float y, bool bAssetFile, IntPtr asset, bool bExclusive, bool modal, bool urgent);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIForm_getAsset(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIForm_getOrder(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_getExclusive(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIForm_setExclusive(IntPtr p, bool exclusive);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_getIsFile(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIForm_setEnable(IntPtr p, bool isEnabled);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_existNode(IntPtr p, IntPtr name);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIForm_inputEnable(IntPtr p, bool bEnable);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_animation(IntPtr p, IntPtr animname, bool blend);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_animEnter(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_animLeave(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_isAnim(IntPtr p, IntPtr name);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_skipAnim(IntPtr p, IntPtr name);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIForm_setGroup(IntPtr p, IntPtr groupName);\r\n        \r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIForm_setGlobalVolume(IntPtr p, float volume);\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Form\"/*, typeof(CKLBUIForm)*/);\r\n\r\n        public CKLBUIForm(CKLBUITask parent, uint order, int x, int y, bool assetFile, String asset_name, bool bExclusive = false, bool modal = false, bool urgent = false)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIForm_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, assetFile, __MarshallingUtils.NativeUtf8FromString(asset_name), bExclusive, modal, urgent);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIForm() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void SelectableCallBack(CKLBUIForm caller, String name, int type, int param);\r\n        public delegate void AnimCallBack(CKLBUIForm caller, String name, uint id);\r\n\r\n        private SelectableCallBack m_selectableCallback;    // callback number 0\r\n        private AnimCallBack m_animCallback;                // callback number 4\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerSII(selectableCallbackFunction), 0);\r\n            registerCallBack(new NativeManagement.FunctionPointerSU (animCallBackFunction)      , 4);\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            if(delegateName == \"selectable\") {\r\n                m_selectableCallback = (SelectableCallBack)anyDelegate;\r\n            } else if(delegateName == \"anim\") {\r\n                m_animCallback = (AnimCallBack)anyDelegate;\r\n            } else {\r\n                throw new CKLBException(\"Unvalid delegate name\");\r\n            }\r\n        }\r\n\r\n        // name : const char* from Cpp\r\n        public virtual void animCallBackFunction(IntPtr name, uint id)\r\n        {\r\n            if(m_animCallback != null) {\r\n                m_animCallback(this, __MarshallingUtils.StringFromNativeUtf8(name), id);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        // name : const char* from Cpp\r\n        public virtual void selectableCallbackFunction(IntPtr name, int type, int param)\r\n        {\r\n            if(m_selectableCallback != null) {\r\n                m_selectableCallback(this, __MarshallingUtils.StringFromNativeUtf8(name), type, param);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIForm_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic String Asset\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIForm_getAsset(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic bool IsFile\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIForm_getIsFile(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic bool Exclusive\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIForm_getExclusive(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIForm_setExclusive(CppObject,value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\r\n        public void setEnabled(bool isEnabled) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIForm_setEnable(CppObject, isEnabled);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool existNode(String name)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_existNode(CppObject, __MarshallingUtils.NativeUtf8FromString(name));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void inputEnable(bool bEnable) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIForm_inputEnable(CppObject, bEnable);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool animation(String animationName, bool blend = false) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_animation(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName), blend);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool isRunningAnimation(String animationName = null) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_isAnim(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool skipAnim(String animationName = null)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_skipAnim(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool animEnter() \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_animEnter(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool animLeave() \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_animLeave(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool setGroup(String groupName)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIForm_setGroup(CppObject, __MarshallingUtils.NativeUtf8FromString(groupName));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void setGlobalVolume(float volume)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIForm_setGlobalVolume(CppObject, volume);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIFreeVertItem.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIFreeVertItem : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // parent   : CKLBUITask*\r\n        // asset    : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIFreeVertItem_create(IntPtr parent, uint order, float x, float y, IntPtr asset, float[] verticesArray);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIFreeVertItem_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIFreeVertItem_setOrder(IntPtr p, uint order);\r\n\t\t\r\n\t\t// return : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIFreeVertItem_getAsset(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static void CKLBUIFreeVertItem_setVertices(IntPtr p, float[] coord);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static void CKLBUIFreeVertItem_setColors(IntPtr p, uint[] colors);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIFreeVertItem_setVertCol(IntPtr p, int idx, uint argb);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static void CKLBUIFreeVertItem_setUV(IntPtr p, float[] uv);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_FreeVertItem\"/*, typeof(CKLBUIFreeVertItem)*/);\r\n\r\n        public CKLBUIFreeVertItem(CKLBUITask parent, uint order, float x, float y, String asset, float[] verticesArray) : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIFreeVertItem_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, __MarshallingUtils.NativeUtf8FromString(asset), verticesArray);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIFreeVertItem() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\treturn CKLBUIFreeVertItem_getOrder(CppObject);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\tCKLBUIFreeVertItem_setOrder(CppObject,value);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic String Asset\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIFreeVertItem_getAsset(CppObject));\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject ();\r\n\t\t\t}\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod();}\r\n\t\t}\r\n\r\n        // 8 vertices\r\n        public void setVertices(float[] coords)\r\n        {\r\n            if(coords.Length != 8)\r\n                throw new CKLBException(\"Vertices must be a float[8] array.\");\r\n\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIFreeVertItem_setVertices(CppObject, coords);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\r\n        // 4 colors\r\n        public void setColors(uint[] colors)\r\n        {\r\n            if(colors.Length != 4)\r\n                throw new CKLBException(\"Colors must be a uint[4] array.\");\r\n\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIFreeVertItem_setColors(CppObject, colors);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t\t\r\n        public void setVertCol(int idx, uint argb)\r\n        {\r\n            if(idx > 7)\r\n                throw new CKLBException(\"idx must be between 0 and 7.\");\r\n\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIFreeVertItem_setVertCol(CppObject, idx, argb);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\r\n        public void setUv(float[] uv)\r\n        {\r\n            if(uv.Length != 8)\r\n                throw new CKLBException(\"UV must be a float[8] array.\");\r\n\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIFreeVertItem_setUV(CppObject, uv);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIGroup.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIGroup : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // parent : CKLBUITask*\r\n        // return : CKLBUIGroup*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIGroup_create(IntPtr parent, float x, float y);\r\n\r\n\t\t// callback : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIGroup_setAnimCallback(IntPtr p, IntPtr callback);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIGroup_setAnimation(IntPtr p, IntPtr anim_name, bool blend);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIGroup_isAnim(IntPtr p, IntPtr anim_name);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIGroup_skipAnim(IntPtr p, IntPtr anim_name);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Group\"/*, typeof(CKLBUIGroup)*/);\r\n\r\n        public CKLBUIGroup(CKLBUITask parent, float x, float y)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIGroup_create(parent != null ? parent.CppObject : IntPtr.Zero, x, y);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIGroup() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void AnimCallBack(CKLBUIGroup caller, String name, uint id);\r\n\r\n        private AnimCallBack m_animCallback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerSU(animCallBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            if(delegateName == \"anim\")\r\n            {\r\n                m_animCallback = (AnimCallBack)anyDelegate;\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Unvalid delegate name\");\r\n            }\r\n        }\r\n\r\n        // name : const char* from Cpp\r\n        public virtual void animCallBackFunction(IntPtr name, uint id)\r\n        {\r\n            if(m_animCallback != null)\r\n            {\r\n                m_animCallback(this, __MarshallingUtils.StringFromNativeUtf8(name), id);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public bool setAnimation(String animationName, bool blendFlag = false) \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\treturn CKLBUIGroup_setAnimation(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName), blendFlag);\r\n\t\t\telse\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t}\r\n        \r\n        public bool isRunningAnimation(String animationName = null)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\treturn CKLBUIGroup_isAnim(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName));\r\n\t\t\telse\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t}\r\n\t\t\r\n        public bool skipAnim(String animationName = null) \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\treturn CKLBUIGroup_skipAnim(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName));\r\n\t\t\telse\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUILabel.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUILabel : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUILabel*\r\n        // pParent : CKLBUITask*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUILabel_create(IntPtr pParent, uint order, float x, float y, uint argb, IntPtr font, uint size, IntPtr text, uint align);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUILabel_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUILabel_setOrder(IntPtr p, uint order);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUILabel_getAlign(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUILabel_setAlign(IntPtr p, uint align);\r\n\t\t\r\n\t\t// return and text : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUILabel_getText(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUILabel_setText(IntPtr p, IntPtr text);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUILabel_getColor(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUILabel_setColor(IntPtr p, uint color);\r\n\t\t\r\n\t\t// return and font : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUILabel_getFont(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUILabel_setFont(IntPtr p, IntPtr font);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUILabel_getFontSize(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUILabel_setFontSize(IntPtr p, uint size);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUILabel_setPosition(IntPtr p, float x, float y);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Label\"/*, typeof(CKLBUILabel)*/);\r\n\r\n        public CKLBUILabel(CKLBUITask parent, uint order, float x, float y, uint argb, String font_name, uint font_size, String text, EALIGN align)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUILabel_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, argb, __MarshallingUtils.NativeUtf8FromString(font_name), font_size, __MarshallingUtils.NativeUtf8FromString(text), (uint)align);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUILabel() : base(s_classID) { Console.WriteLine(\"YOLO\"); }\r\n\r\n        #endregion\r\n\r\n        public enum EALIGN : uint\r\n        {\r\n            MID = 5,\r\n            TOP_LEFT = 10,\r\n            TOP = 9,\r\n            TOP_RIGHT = 8,\r\n            LEFT = 6,\r\n            RIGHT = 4,\r\n            BOTTOM_LEFT = 2,\r\n            BOTTOM = 1,\r\n            BOTTOM_RIGHT = 0\r\n        }\r\n\r\n\t\tpublic  uint    Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUILabel_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUILabel_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic String   FontName\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUILabel_getFont(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUILabel_setFont(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic  uint    FontSize\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUILabel_getFontSize(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUILabel_setFontSize(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public  void    setFont(String name, uint size)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUILabel_setFont(CppObject, __MarshallingUtils.NativeUtf8FromString(name));\r\n\t\t\t\tCKLBUILabel_setFontSize(CppObject, size);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic  uint    TxtArgb\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUILabel_getColor(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUILabel_setColor(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic  String  Text\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUILabel_getText(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUILabel_setText(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic  EALIGN  Align\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return (EALIGN)CKLBUILabel_getAlign(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUILabel_setAlign(CppObject, (uint)value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\r\n        public  void    setPosition(float x, float y)\r\n        {\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUILabel_setPosition(CppObject, x, y);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIList.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIList : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUIList*\r\n        // pParent : CKLBUITask*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIList_create(IntPtr pParent,uint baseOrder, uint maxOrder, float x, float y, float clipWidth,\r\n                                                        float clipHeight, int defaultLineStep, bool vertical, uint optionalFlags);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIList_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_setWidth(IntPtr p, uint width);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIList_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_setHeight(IntPtr p, uint height);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBUIList_getStepX(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIList_setStepX(IntPtr p, int x);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBUIList_getStepY(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIList_setStepY(IntPtr p, int y);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIList_getOrder(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIList_setOrder(IntPtr p, uint order);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIList_getMaxOrder(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIList_setMaxOrder(IntPtr p, uint order);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIList_getVertical(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIList_setVertical(IntPtr p, bool vertical);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIList_getItems(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_getMarginTop(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_setMarginTop(IntPtr p, int top);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_getMarginBottom(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_setMarginBottom(IntPtr p, int bottom);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static bool CKLBUIList_getDefaultScroll(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIList_setDefaultScroll(IntPtr p, bool scroll);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdItemRemove(IntPtr p, int idx);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdItemMove(IntPtr p, int src, int dst);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdSetMargin(IntPtr p, int top, int bottom);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_cmdGetPosition(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_cmdSetPosition(IntPtr p, int pos, int dir);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdSetItemID(IntPtr p, int index, int id);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_cmdSearchID(IntPtr p, int id);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdSetItemPos(IntPtr p, int mode, int idx, int offset);\r\n\t\t\r\n\t\t// limitCallBack : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdSetLimitClip(IntPtr p, bool chklimit);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_cmdGetLimit(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdSetLimitArea(IntPtr p, int limitArea);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdChangeStep(IntPtr p, int index, int step);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdInputEnable(IntPtr p, bool enable);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIList_cmdExistNode(IntPtr p, int index, IntPtr name);\r\n\r\n\t\t// name : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdAnimationItem(IntPtr p, int index, IntPtr name, bool blend);\r\n\t\t\r\n\t\t// name : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdAnimationAll(IntPtr p, IntPtr name, bool blend);\r\n\t\t\r\n\t\t// name : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdItemAnimSkip(IntPtr p, int idx, IntPtr name);\r\n\t\t\r\n\t\t// name : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdAllAnimSkip(IntPtr p, IntPtr name);\r\n\t\t\r\n\t\t// group_name : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIList_cmdSetGroup(IntPtr p, IntPtr group_name);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_setLoop(IntPtr p, bool mode);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIList_cmdSetInitial(IntPtr p, int pos);\r\n\r\n        // image : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIList_useScrollBar(IntPtr p, uint order, bool side, int lineWeight, IntPtr image, int minSlenderSize, uint colorNormal, uint colorSelect, bool active, bool hideMode, bool shortHide);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdFWModeConfig(IntPtr p, int itemStep, int maxItems);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdSetItemMode(IntPtr p, int itemMode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdAddRecords(IntPtr p, int insIdx, IntPtr tpForm, IntPtr dbRecords, int step);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdSelectScrMgr(IntPtr p, IntPtr name, int[] optParams, uint nb);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_cmdSetClip(IntPtr p, uint orderBegin, uint orderEnd, short clipX, short clipY, short clipWidth, short clipHeight);\r\n\r\n        // asset : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdItemAdd(IntPtr p, IntPtr name);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdItemAdd2(IntPtr p, IntPtr name, int step, int id);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIList_cmdInsertItem(IntPtr p, IntPtr name, int idx);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIList_cmdInsertItem2(IntPtr p, IntPtr name, int idx, int step, int id);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIList_cmdRemoveSelection(IntPtr p, int[] indexes, uint nb);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIList_setDragRect(IntPtr p, int left, int top, int right, int bottom);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_List\"/*, typeof(CKLBUIList)*/);\r\n\r\n        public CKLBUIList(  CKLBUITask parent, uint base_priority, uint max_order, float x, float y,\r\n                            float clip_width, float clip_height, int default_line_step, DragCallBack callback, bool vertical = true, uint option_flags = 0)\r\n            : base(s_classID)\r\n\t\t{\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr =    CKLBUIList_create(  parent != null ? parent.CppObject : IntPtr.Zero, base_priority, max_order, x, y, \r\n                                                clip_width, clip_height, default_line_step, vertical, option_flags);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_dragCallback = callback;\r\n\t\t}\r\n\r\n        public CKLBUIList() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void LimitCallBack      (CKLBUIList caller, uint type, uint itemCount, int listLength, int pos);\r\n        public delegate void DragCallBack       (CKLBUIList caller, uint type, int x, int y, int param1, int param2);\r\n        public delegate void DynamicCallBack    (CKLBUIList caller, int index, int id);\r\n        public delegate void ScrollBarCallBack  (CKLBUIList caller, uint type, int pos);\r\n        public delegate void AnimCallBack       (CKLBUIList caller, String name, uint id);\r\n\r\n        private LimitCallBack       m_limitCallback;      // callback number 0\r\n        private DragCallBack        m_dragCallback;       // callback number 1\r\n        private DynamicCallBack     m_dynamicCallback;    // callback number 2\r\n        private ScrollBarCallBack   m_scrollbarCallback;  // callback number 3\r\n        private AnimCallBack        m_animCallback;       // callback number 4\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUIIII  (dragCallBackFunction),       0);\r\n            registerCallBack(new NativeManagement.FunctionPointerUUII   (limitCallBackFunction),      1);\r\n            registerCallBack(new NativeManagement.FunctionPointerII     (dynamicCallBackFunction),    2);\r\n            registerCallBack(new NativeManagement.FunctionPointerUI     (scrollbarCallBackFunction),  3);\r\n            registerCallBack(new NativeManagement.FunctionPointerSU     (animCallBackFunction),       4);\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            if(delegateName == \"limit\") {\r\n                m_limitCallback = (LimitCallBack)anyDelegate;\r\n            } else if(delegateName == \"drag\") {\r\n                m_dragCallback = (DragCallBack)anyDelegate;\r\n            } else if(delegateName == \"dynamic\") {\r\n                m_dynamicCallback = (DynamicCallBack)anyDelegate;\r\n            } else if(delegateName == \"anim\") {\r\n                m_animCallback = (AnimCallBack)anyDelegate;\r\n            } else if(delegateName == \"scrollbar\") {\r\n                m_scrollbarCallback = (ScrollBarCallBack)anyDelegate;\r\n            } else {\r\n                throw new CKLBException(\"Unvalid delegate name\");\r\n            }\r\n        }\r\n\r\n        public virtual void dragCallBackFunction(uint type, int x, int y, int param1, int param2)\r\n        {\r\n            if(m_dragCallback != null) {\r\n                m_dragCallback(this, type, x, y, param1, param2);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        \r\n        public virtual void limitCallBackFunction(uint type, uint itemCount, int listLength, int pos)\r\n        {\r\n\t\t\tif(m_limitCallback != null) {\r\n                m_limitCallback(this, type, itemCount, listLength, pos);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        public virtual void dynamicCallBackFunction(int index, int id)\r\n        {\r\n\t\t\tif(m_dynamicCallback != null) {\r\n                m_dynamicCallback(this, index, id);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        public virtual void scrollbarCallBackFunction(uint type, int pos)\r\n        {\r\n\t\t\tif(m_scrollbarCallback != null) {\r\n                m_scrollbarCallback(this, type, pos);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        // name : const char* from Cpp\r\n        public virtual void animCallBackFunction(IntPtr name, uint id)\r\n        {\r\n\t\t\tif(m_animCallback != null) {\r\n                m_animCallback(this, __MarshallingUtils.StringFromNativeUtf8(name), id);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum EPOSITION_MODE : int\r\n        {\r\n            LIST_VIEW_TOP,\r\n            LIST_VIEW_CENTER,\r\n            LIST_VIEW_END,\r\n            LIST_VIEW_OFFSET\r\n        }\r\n\r\n        public enum ESCROLLBAR_VALUE : int\r\n        {\r\n            LIST_SCROVER_TOP,\r\n            LIST_SCROVER_BOTTTOM,\r\n            LIST_SCROVER_TAKEOFF\r\n        }\r\n\r\n        public enum EITEM_MODE : int {\r\n\t\t    LIST_ITEM_NORMAL,\r\n\t\t    LIST_ITEM_DYNAMIC,\r\n\t\t    LIST_ITEM_FLYWEIGHT,\r\n        }\r\n\r\n\t\tpublic uint Width\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIList_getWidth(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setWidth(CppObject,value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public uint Height\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIList_getHeight(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setHeight(CppObject,value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public void getSize(out USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                size.width = CKLBUIList_getWidth(CppObject);\r\n                size.height = CKLBUIList_getHeight(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setSize(USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_setWidth(CppObject, size.width);\r\n                CKLBUIList_setHeight(CppObject, size.height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setSize(uint width, uint height)\r\n        {\r\n            CKLBUIList_setWidth(CppObject, width);\r\n            CKLBUIList_setHeight(CppObject, height);\r\n        }\r\n\t\tpublic int  StepX\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getStepX(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setStepX(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic int  StepY\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getStepY(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setStepY(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic uint Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic uint Maxodr\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getMaxOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setMaxOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic bool IsVertical\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getVertical(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setVertical(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic uint Items\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getItems(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic int  MarginTop\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIList_getMarginTop(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIList_setMarginTop(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public int  MarginBottom\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIList_getMarginBottom(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIList_setMarginBottom(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic bool DefaultScroll\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_getDefaultScroll(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setDefaultScroll(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public int  Position\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_cmdGetPosition(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            // set { throw new CKLBExceptionForbiddenMethod(\"Use setPosition instead.\"); } \r\n        }\r\n        public int  Limit\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIList_cmdGetLimit(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionNotImplemented(); }\r\n        }\r\n        public bool LoopMode\r\n        {\r\n            get { throw new CKLBExceptionNotImplemented(); }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIList_setLoop(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        public void itemAdd(String asset)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_cmdItemAdd(CppObject, __MarshallingUtils.NativeUtf8FromString(asset));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic void itemAdd(String asset, int step, int id = -1)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_cmdItemAdd2(CppObject, __MarshallingUtils.NativeUtf8FromString(asset), step, id);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public void itemInsert(String asset, int index)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_cmdInsertItem(CppObject, __MarshallingUtils.NativeUtf8FromString(asset), index);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void itemInsert(String asset, int index, int step, int id = -1)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_cmdInsertItem2(CppObject, __MarshallingUtils.NativeUtf8FromString(asset), index, step, id);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic bool itemRemove(int index)\r\n\t\t{ \r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdItemRemove(CppObject, index);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void itemMove(int src, int dst)\r\n\t\t{ \r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdItemMove(CppObject, src, dst);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void itemRemoveSelection(int[] indexes)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdRemoveSelection(CppObject, indexes, (uint)indexes.Length);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void setMargin(int margin_top, int margin_bottom)\r\n\t\t{ \r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdSetMargin(CppObject, margin_top, margin_bottom);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void setItemPosition(EPOSITION_MODE positionMode, int index, int offset = 0)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdSetItemPos(CppObject, (int)positionMode, index, offset);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void changeStep(int index, int newStep)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdChangeStep(CppObject, index, newStep);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void setLimitClip(bool limitClipEnable)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdSetLimitClip(CppObject, limitClipEnable);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void setLimitClip(bool limitClipEnable, LimitCallBack limitCallback)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                m_limitCallback = limitCallback;\r\n\t\t\t\tCKLBUIList_cmdSetLimitClip(CppObject, limitClipEnable);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic bool setLimitArea(int size)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdSetLimitArea(CppObject, size);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void setInputEnable(bool enableFlag)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdInputEnable(CppObject, enableFlag);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public bool existNode(int index, String name)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                NativeManagement.resetCppError();\r\n                bool res = CKLBUIList_cmdExistNode(CppObject, index, __MarshallingUtils.NativeUtf8FromString(name));\r\n                NativeManagement.intercepCppError();\r\n                return res;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n\t\tpublic bool animationItem(int index, String animationName, bool blendFlag = false)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdAnimationItem(CppObject, index, __MarshallingUtils.NativeUtf8FromString(animationName), blendFlag);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic bool animationAll(String animationName, bool blendFlag = false)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdAnimationAll(CppObject, __MarshallingUtils.NativeUtf8FromString(animationName), blendFlag);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public bool useScrollbar(uint order, bool side, int lineWeight, String image, int minSliderSize, uint colorNormal, uint colorSelect, bool active, bool hideMode = false, bool shortHide = true)\r\n\t\t{\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIList_useScrollBar(CppObject, order, side, lineWeight, __MarshallingUtils.NativeUtf8FromString(image), minSliderSize, colorNormal, colorSelect, active, hideMode, shortHide);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public bool useScrollbar(uint order, bool side, int lineWeight, String image, int minSliderSize, uint colorNormal, uint colorSelect, bool active, ScrollBarCallBack callback, bool hideMode = false, bool shortHide = true)\r\n\t\t{\r\n            if(CppObject != IntPtr.Zero) {\r\n                m_scrollbarCallback = callback;\r\n                return CKLBUIList_useScrollBar(CppObject, order, side, lineWeight, __MarshallingUtils.NativeUtf8FromString(image), minSliderSize, colorNormal, colorSelect, active, hideMode, shortHide);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void setItemID(int index, int id)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdSetItemID(CppObject, index, id);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic int  searchID(int index)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdSearchID(CppObject, index);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        \r\n\t\tpublic bool selectScrMgr(String managerName, int[] optParams = null)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                if(optParams != null) {\r\n\t\t\t\t    return CKLBUIList_cmdSelectScrMgr(CppObject, __MarshallingUtils.NativeUtf8FromString(managerName), optParams, (uint)optParams.Length);\r\n                } else {\r\n                    return CKLBUIList_cmdSelectScrMgr(CppObject, __MarshallingUtils.NativeUtf8FromString(managerName), null, 0);\r\n                }\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\t\r\n\t\tpublic bool itemAnimSkip(int idx, String name)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdItemAnimSkip(CppObject, idx, __MarshallingUtils.NativeUtf8FromString(name));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic bool allAnimSkip(String groupName = null)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdAllAnimSkip(CppObject, __MarshallingUtils.NativeUtf8FromString(groupName));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic bool addRecords(int insIdx, String tpForm, String dbRecords, int step = 0)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdAddRecords(CppObject, insIdx, __MarshallingUtils.NativeUtf8FromString(tpForm), __MarshallingUtils.NativeUtf8FromString(dbRecords), step);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic int setInitial(int pos)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdSetInitial(CppObject, pos);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n\t\tpublic void fwModeConfig(int itemStep, int maxItems)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIList_cmdFWModeConfig(CppObject, itemStep, maxItems);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void fwItemAdd()\r\n        {\r\n            throw new CKLBExceptionNotImplemented(\"Not implemented in C++ yet.\");\r\n        }\r\n\r\n        public void fwItemInsertTop()\r\n        {\r\n            throw new CKLBExceptionNotImplemented(\"Not implemented in C++ yet.\");\r\n        }\r\n\r\n        public bool setItemMode(EITEM_MODE mode) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIList_cmdSetItemMode(CppObject, (int)mode);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public bool setItemMode(EITEM_MODE mode, DynamicCallBack dynamicCallback) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                m_dynamicCallback = dynamicCallback;\r\n\t\t\t\treturn CKLBUIList_cmdSetItemMode(CppObject, (int)mode);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public int setPosition(int pos, int dir = 0) \r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIList_cmdSetPosition(CppObject, pos, dir);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void setGroup(String groupName)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_cmdSetGroup(CppObject, __MarshallingUtils.NativeUtf8FromString(groupName));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void setClip(uint orderBegin, uint orderEnd, short clipX, short clipY, short clipWidth, short clipHeight)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_cmdSetClip(CppObject, orderBegin, orderEnd, clipX, clipY, clipWidth, clipHeight);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void setDragRect(int left, int top, int right, int bottom)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIList_setDragRect(CppObject, left, top, right, bottom);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIMoviePlayer.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIMoviePlayer : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUIMoviePlayer*\r\n        // pParent : CKLBUITask*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIMoviePlayer_create(IntPtr pParent, bool mode, float x, float y, float width, float height, IntPtr url);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIMoviePlayer_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_setWidth(IntPtr p, uint width);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIMoviePlayer_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_setHeight(IntPtr p, uint height);\r\n\t\t\r\n\t\t// return and text : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIMoviePlayer_getText(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_setText(IntPtr p, IntPtr text);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_moviePlay(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_movieStop(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_moviePause(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMoviePlayer_movieResume(IntPtr p);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_MoviePlayer\"/*, typeof(CKLBUIMoviePlayer)*/);\r\n\r\n        public CKLBUIMoviePlayer(CKLBUITask parent, bool background_mode, float x, float y, float width, float height, CallBack callback, String url = null)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIMoviePlayer_create(parent != null ? parent.CppObject : IntPtr.Zero, background_mode, x, y, width, height, __MarshallingUtils.NativeUtf8FromString(url));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUIMoviePlayer() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUIMoviePlayer caller);\r\n\r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerV(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction()\r\n        {\r\n            if(m_callback != null)\r\n            {\r\n                m_callback(this);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public uint Width\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIMoviePlayer_getWidth(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIMoviePlayer_setWidth(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public uint Height\r\n        {\r\n            get {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIMoviePlayer_getHeight(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIMoviePlayer_setHeight(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void getSize(out USize size)\r\n\t\t{\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                size.width = CKLBUIMoviePlayer_getWidth(CppObject);\r\n                size.height = CKLBUIMoviePlayer_getHeight(CppObject);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n\t\t}\r\n        public void setSize(USize size)\r\n\t\t{\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                CKLBUIMoviePlayer_setWidth(CppObject, size.width);\r\n                CKLBUIMoviePlayer_setHeight(CppObject, size.height);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n\t\t}\r\n        public void setSize(uint width, uint height)\r\n\t\t{\r\n            CKLBUIMoviePlayer_setWidth(CppObject, width);\r\n            CKLBUIMoviePlayer_setHeight(CppObject, height);\r\n\t\t}\r\n\t\tpublic String Path\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIMoviePlayer_getText(CppObject));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIMoviePlayer_setText(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public void play()\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIMoviePlayer_moviePlay(CppObject);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t\tpublic void pause()\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIMoviePlayer_moviePause(CppObject);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t\tpublic void stop()\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIMoviePlayer_movieStop(CppObject);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t\tpublic void resume()\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUIMoviePlayer_movieResume(CppObject);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIMultiImgItem.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n//using System.Security;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIMultiImgItem : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent          : CKLBUITask*\r\n        // pArrayAsset      : const char**\r\n        // pArrayIndexes    : uint*\r\n        // return           : CKLBUIMultiImgItem*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIMultiImgItem_create(IntPtr pParent, uint order, float x, float y, uint idx, IntPtr[] pArrayAsset,\r\n\t\t\t\t\t\t\t\t\t\t\t\t                uint[] pArrayIndexes, uint assetCount);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIMultiImgItem_getIndexMax(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMultiImgItem_setIndexMax(IntPtr p, uint index);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIMultiImgItem_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMultiImgItem_setOrder(IntPtr p, uint order);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIMultiImgItem_getIndex(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIMultiImgItem_setIndex(IntPtr p, uint index);\r\n\r\n        // pArrayAsset      : const char**\r\n        // pArrayIndexes    : uint*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIMultiImgItem_changeAssets(IntPtr p, IntPtr[] pArrayAsset, uint[] pArrayIndexes, uint assetCount);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_MultiImgItem\"/*, typeof(CKLBUIMultiImgItem)*/);\r\n\r\n        public CKLBUIMultiImgItem(  CKLBUITask parent, uint order, float x, float y, String[] pArrayAsset, \r\n                                    uint[] pArrayIndexes, uint index = 0)\r\n            : base(s_classID)\r\n        {\r\n            if(pArrayAsset.Length != pArrayAsset.Length) {\r\n                throw new CKLBException(\"ArrayAsset and ArrayIndexes must have the same size.\");\r\n            }\r\n\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIMultiImgItem_create( parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, index, __MarshallingUtils.NativeUtf8ArrayFromStringArray(pArrayAsset, pArrayAsset.Length),\r\n                                                    pArrayIndexes, (uint)pArrayAsset.Length);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIMultiImgItem() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIMultiImgItem_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIMultiImgItem_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public uint Index \r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIMultiImgItem_getIndex(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIMultiImgItem_setIndex(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public uint IdMax \r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIMultiImgItem_getIndexMax(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIMultiImgItem_setIndexMax(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        public bool changeAssets(String[] pArrayAsset, uint[] pArrayIndexes) \r\n        {\r\n            if(pArrayAsset.Length != pArrayIndexes.Length) {\r\n                throw new CKLBException(\"pArrayAsset and pArrayIndexes must have the same length.\");\r\n            }\r\n\r\n            if(CppObject != IntPtr.Zero) {\r\n                NativeManagement.resetCppError();\r\n                bool res = CKLBUIMultiImgItem_changeAssets(CppObject, __MarshallingUtils.NativeUtf8ArrayFromStringArray(pArrayAsset, pArrayAsset.Length), pArrayIndexes, (uint)pArrayAsset.Length);\r\n                NativeManagement.intercepCppError();\r\n                return res;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIPieChart.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIPieChart : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUIPieChart*\r\n        // pParent : CKLBUITask*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIPieChart_create(IntPtr pParent, uint order, float x, float y, float width, float height, IntPtr asset,\r\n                                                            float start, float end, int anim, float initial);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIPieChart_getStart(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPieChart_setStart(IntPtr p, float start);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIPieChart_getEnd(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPieChart_setEnd(IntPtr p, float end);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIPieChart_getValue(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPieChart_setValue(IntPtr p, float value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIPieChart_getAnim(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIPieChart_getOrder(IntPtr p);\r\n\r\n        // assetName : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIPieChart_changeAsset(IntPtr p, IntPtr assetName);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_PieChart\"/*, typeof(CKLBUIPieChart)*/);\r\n\r\n        public CKLBUIPieChart(CKLBUITask parent, uint order, float x, float y, float width, float height, String image_asset, float start_angle, float end_angle, int anim_time = 0, float initial_value = 0.0f)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIPieChart_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, width, height, __MarshallingUtils.NativeUtf8FromString(image_asset), start_angle, end_angle, anim_time, initial_value);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIPieChart() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint  Order\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPieChart_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod (); }\r\n\t\t}\r\n\t\tpublic float Start\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPieChart_getStart(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIPieChart_setStart(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic float End\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPieChart_getEnd(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIPieChart_setEnd(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic float Value\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPieChart_getValue(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIPieChart_setValue(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\t\tpublic int   Anim\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPieChart_getAnim(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n        public bool changeAsset(String assetName)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                NativeManagement.resetCppError();\r\n                bool res = CKLBUIPieChart_changeAsset(CppObject, __MarshallingUtils.NativeUtf8FromString(assetName));\r\n                NativeManagement.intercepCppError();\r\n                return res;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIPolyline.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIPolyline : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // parent : CKLBUITask*\r\n        // return : CKLBUIPolyline*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIPolyline_create(IntPtr parent, uint order, uint maxPoint);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIPolyline_getMaxPoint(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPolyline_setMaxPoint(IntPtr p, uint maxpointcount);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIPolyline_getOrder(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIPolyline_getPointCount(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPolyline_setPointCount(IntPtr p, uint pointcount);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPolyline_setPoint(IntPtr p, uint idx, float x, float y);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIPolyline_getColor(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIPolyline_setColor(IntPtr p, uint color);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Polyline\"/*, typeof(CKLBUIPolyline)*/);\r\n\r\n        public CKLBUIPolyline(CKLBUITask parent, uint order, uint maxPoint) : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIPolyline_create(parent != null ? parent.CppObject : IntPtr.Zero, order, maxPoint);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIPolyline() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPolyline_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic uint MaxPointCount \r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPolyline_getMaxPoint(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIPolyline_setMaxPoint(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public uint PointCount\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPolyline_getPointCount(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    if(value > 0) {\r\n                        CKLBUIPolyline_setPointCount(CppObject, value);\r\n                    } else {\r\n                        throw new CKLBException(\"PointCount must be strictly positive\");\r\n                    }\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public uint Color\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIPolyline_getColor(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIPolyline_setColor(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        public void setPoint(uint point_index, float x, float y)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIPolyline_setPoint(CppObject, point_index, x, y);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIProgressBar.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIProgressBar : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // fullImage & emptyImage & barfilterImage : const char*\r\n        // return : CKLBUIProgressBar*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIProgressBar_create(  IntPtr pParent,\r\n                                                                uint order, float x, float y, float width, float height,\r\n                                                                IntPtr fullImage, IntPtr emptyImage, \r\n                                                                int startPix, int endPix, int anim, bool vert,\r\n                                                                IntPtr barfilterImage);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIProgressBar_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setOrder(IntPtr p, uint order);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIProgressBar_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setWidth(IntPtr p, float width);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIProgressBar_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setHeight(IntPtr p, float height);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIProgressBar_getVertical(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setVertical(IntPtr p, bool vertical);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIProgressBar_getAnimTime(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setAnimTime(IntPtr p, uint time);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIProgressBar_getStart(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setStart(IntPtr p, float start);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIProgressBar_getEnd(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setEnd(IntPtr p, float end);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIProgressBar_getValue(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setValue(IntPtr p, float value);\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static IntPtr CKLBUIProgressBar_getImgEmpty(IntPtr p);\r\n        // empty_image : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIProgressBar_setImgEmpty(IntPtr p, IntPtr imageEmpty);\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIProgressBar_getImgFull(IntPtr p);\r\n        // full_image : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIProgressBar_setImgFull(IntPtr p, IntPtr imageFull);\r\n\r\n         // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static IntPtr CKLBUIProgressBar_getImgFilter(IntPtr p);\r\n        // empty_image : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIProgressBar_setImgFilter(IntPtr p, IntPtr imageFilter);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIProgressBar_reset(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIProgressBar_getFilterVisible(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setFilterVisible(IntPtr p, bool value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIProgressBar_getFilterColor(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIProgressBar_setFilterColor(IntPtr p, uint value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIProgressBar_setFilterAnim(IntPtr p, bool bColAnim, uint argb1, uint argb2, uint freq);\r\n\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_ProgressBar\"/*, typeof(CKLBUIProgressBar)*/);\r\n\r\n        public CKLBUIProgressBar(   CKLBUITask parent, \r\n                                    uint order, float x, float y, float width, float height, \r\n                                    String imageFull, String imageEmpty,\r\n                                    int startPix = -1, int endPix = -1, int animTime = 0, bool verticalFlag = false,\r\n                                    String barfilterImage = null)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIProgressBar_create(  parent != null ? parent.CppObject : IntPtr.Zero,\r\n                                                    order, x, y, width, height,\r\n                                                    __MarshallingUtils.NativeUtf8FromString(imageFull), __MarshallingUtils.NativeUtf8FromString(imageEmpty),\r\n                                                    startPix, endPix, animTime, verticalFlag, \r\n                                                    __MarshallingUtils.NativeUtf8FromString(barfilterImage));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIProgressBar() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint     Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public float    Width\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getWidth(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setWidth(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public float    Height\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getHeight(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setHeight(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public void     getSize(out FSize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                size.width = CKLBUIProgressBar_getWidth(CppObject);\r\n                size.height = CKLBUIProgressBar_getHeight(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void     setSize(FSize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIProgressBar_setWidth(CppObject, size.width);\r\n                CKLBUIProgressBar_setHeight(CppObject, size.height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void     setSize(float width, float height)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIProgressBar_setWidth(CppObject, width);\r\n                CKLBUIProgressBar_setHeight(CppObject, height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t\tpublic bool     IsVertical\r\n\t\t{\r\n            get\r\n            {\r\n               if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getVertical(CppObject);\r\n               } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n               }\r\n            }\r\n            set\r\n            {\r\n               if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setVertical(CppObject, value);\r\n               } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n               }\r\n            }\r\n\t\t}\r\n        public uint     AnimTime\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getAnimTime(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setAnimTime(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic float    Start \r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getStart(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setStart(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic float    End \r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getEnd(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setEnd(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public String   ImageEmpty\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIProgressBar_getImgEmpty(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setImgEmpty(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic String   ImageFull\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIProgressBar_getImgFull(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setImgFull(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public String   ImageFilter\r\n\t\t{\r\n\t\t\tget\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIProgressBar_getImgFilter(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setImgFilter(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic float    Value\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getValue(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setValue(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public bool     FilterVisible\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getFilterVisible(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setFilterVisible(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public uint     FilterColor\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIProgressBar_getFilterColor(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIProgressBar_setFilterColor(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        public void reset() \r\n        {\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                CKLBUIProgressBar_reset(CppObject);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void complete() \r\n\t\t{ \r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n                CKLBUIProgressBar_setValue(CppObject, CKLBUIProgressBar_getEnd(CppObject));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public bool setFilterAnim(bool bColAnim, uint argb1 = 0xffffffff, uint argb2 = 0xffffffff, uint freq = 500)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                return CKLBUIProgressBar_setFilterAnim(CppObject,bColAnim, argb1, argb2, freq);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIRubberBand.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIRubberBand : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        //return : CKLBUIRubberBand*\r\n        // pParent : CKLBUITask*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIRubberBand_create(IntPtr pParent, uint order, float x, float y, uint resolution, IntPtr origin, IntPtr joint,\r\n                                                             IntPtr point, uint flags, uint animTime, int joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIRubberBand_getOriginX(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIRubberBand_setOriginX(IntPtr p, float x);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIRubberBand_getOriginY(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIRubberBand_setOriginY(IntPtr p, float y);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIRubberBand_getPointX(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIRubberBand_setPointX(IntPtr p, float x);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIRubberBand_getPointY(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIRubberBand_setPointY(IntPtr p, float y);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIRubberBand_getFAnim(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIRubberBand_setFAnim(IntPtr p, bool fAnim);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIRubberBand_getFAnimRT(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIRubberBand_setFAnimRT(IntPtr p, bool fAnimRT);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIRubberBand_getAnimTime(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIRubberBand_setAnimTime(IntPtr p, uint animTime);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIRubberBand_getOrder(IntPtr p);\r\n\t\t\r\n\t\t// return : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIRubberBand_getAssetOrigin(IntPtr p);\r\n\t\t\r\n\t\t// return : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIRubberBand_getAssetJoint(IntPtr p);\r\n\t\t\r\n\t\t// return : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIRubberBand_getAssetPoint(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIRubberBand_setOrder(IntPtr p, uint orderOrigin, uint orderJoint, uint orderPoint);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_RubberBand\"/*, typeof(CKLBUIRubberBand)*/);\r\n\r\n        public CKLBUIRubberBand(CKLBUITask parent, uint order, float origin_x, float origin_y, String origin_asset, \r\n                                String joint_asset, String point_asset, uint resolution = 10, uint option_flags = 0, \r\n                                uint animation_time = 0, int joint_priority_offset = 0, int point_priority_offset = 0, \r\n                                bool rot_origin = true, bool rot_joint = false, bool rot_point = true)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIRubberBand_create(parent != null ? parent.CppObject : IntPtr.Zero, order, origin_x, origin_y, resolution, __MarshallingUtils.NativeUtf8FromString(origin_asset),\r\n                                                 __MarshallingUtils.NativeUtf8FromString(joint_asset), __MarshallingUtils.NativeUtf8FromString(point_asset), option_flags,\r\n                                                 animation_time, joint_priority_offset, point_priority_offset, rot_origin, rot_joint, rot_point);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIRubberBand() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getOrder(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic String AssetOrigin\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIRubberBand_getAssetOrigin(CppObject));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n        public String AssetJoint\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIRubberBand_getAssetJoint(CppObject));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\t\tpublic String AssetPoint\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIRubberBand_getAssetPoint(CppObject));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic float OriginX\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getOriginX(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setOriginX(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic float OriginY\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getOriginY(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setOriginY(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic float PointX\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getPointX(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setPointX(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic float PointY\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getPointY(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setPointY(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic bool AnimFlag\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getFAnim(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setFAnim(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic bool RealTimeFlag\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getFAnimRT(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setFAnimRT(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic uint AnimTime\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUIRubberBand_getAnimTime(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setAnimTime(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public void setOrder(uint orderOrigin, uint orderJoint, uint orderPoint) \r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                    CKLBUIRubberBand_setOrder(CppObject, orderOrigin, orderJoint, orderPoint);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUISWFPlayer.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUISWFPlayer  : CKLBUITask \r\n    {\r\n\t\t#region DllImports\r\n        // parent    : CKLBUITask*\r\n        // asset     : const char*\r\n        // movieName : const char*\r\n        // return    : CKLBUISWFPlayer*\r\n        // replaceList : const char**\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUISWFPlayer_create(IntPtr parent, uint order, float x, float y, IntPtr asset, IntPtr movieNameconst, IntPtr[] replaceList, int assetCnt);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUISWFPlayer_getPlay(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUISWFPlayer_setPlay(IntPtr p, bool play);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUISWFPlayer_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUISWFPlayer_setOrder(IntPtr p, uint order);\r\n\t\t\r\n\t\t// label : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUISWFPlayer_gotoFrame(IntPtr p, IntPtr label);\r\n\t\t\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUISWFPlayer_getFrameRate(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUISWFPlayer_setFrameRate(IntPtr p, uint fps);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUISWFPlayer_isAnimating(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUISWFPlayer_setFrameRateScale(IntPtr p, float scale);\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static IntPtr CKLBUISWFPlayer_getAsset(IntPtr p);\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static IntPtr CKLBUISWFPlayer_getMovieName(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUISWFPlayer_getVolume(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUISWFPlayer_setVolume(IntPtr p, float volume);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_SWFPlayer\"/*, typeof(CKLBUISWFPlayer)*/);\r\n\r\n        public CKLBUISWFPlayer(CKLBUITask parent, uint order, float x, float y, String asset, String movieName, CallBack callback, String[] replaceList = null, int assetCnt = 0)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUISWFPlayer_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, \r\n                                        __MarshallingUtils.NativeUtf8FromString(asset), __MarshallingUtils.NativeUtf8FromString(movieName),\r\n                                        (replaceList != null) ? __MarshallingUtils.NativeUtf8ArrayFromStringArray(replaceList, replaceList.Length) : null, assetCnt);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUISWFPlayer() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUISWFPlayer caller, String label);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerS(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        // label : const char* from Cpp\r\n        public virtual void callBackFunction(IntPtr label)\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this, __MarshallingUtils.StringFromNativeUtf8(label));\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUISWFPlayer_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUISWFPlayer_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic String Asset\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUISWFPlayer_getAsset(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic String MovieName\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUISWFPlayer_getMovieName(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic bool IsPlaying\r\n\t\t{\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUISWFPlayer_getPlay(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUISWFPlayer_setPlay(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public uint Framerate\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUISWFPlayer_getFrameRate(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUISWFPlayer_setFrameRate(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public bool IsAnim\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUISWFPlayer_isAnimating(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n        public float Volume\r\n        {\r\n            get \r\n            { \r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUISWFPlayer_getVolume(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUISWFPlayer_setVolume(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        public void play()\r\n\t\t{ \r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUISWFPlayer_setPlay(CppObject, true);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void stop() \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUISWFPlayer_setPlay(CppObject, false);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void goToFrame(String label) \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUISWFPlayer_gotoFrame(CppObject, __MarshallingUtils.NativeUtf8FromString(label));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void setFramerateScale(float scale)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUISWFPlayer_setFrameRateScale(CppObject, scale);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        // added : replaceAssets()\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIScale9.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIScale9 : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // asset : const char*\r\n        // return : CKLBUIScale9*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIScale9_create(IntPtr pParent, uint order, float x, float y, int width, int height, IntPtr asset);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScale9_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScale9_setWidth(IntPtr p, int width);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScale9_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScale9_setHeight(IntPtr p, int height);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIScale9_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScale9_setOrder(IntPtr p, uint order);\r\n\t\t\r\n        // const char* : asset & return\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIScale9_getAsset(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIScale9_setAsset(IntPtr p, IntPtr asset);\r\n\t\t#endregion\r\n\r\n        #region Constructor\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Scale9\"/*, typeof(CKLBUIScale9)*/);\r\n\r\n        public CKLBUIScale9(CKLBUITask parent, uint order, float x, float y, int width, int height, String asset)\r\n            : base(s_classID)\r\n\t\t{\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIScale9_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, width, height, __MarshallingUtils.NativeUtf8FromString(asset));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n\t\t}\r\n\r\n        public CKLBUIScale9() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint Order\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIScale9_getOrder(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScale9_setOrder(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic int  Width\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIScale9_getWidth(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScale9_setWidth(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic int  Height\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIScale9_getHeight(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScale9_setHeight(CppObject,value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n        public void getSize(out Size size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                size.width = CKLBUIScale9_getWidth(CppObject);\r\n                size.height = CKLBUIScale9_getHeight(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setSize(Size size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIScale9_setWidth(CppObject, size.width);\r\n                CKLBUIScale9_setHeight(CppObject, size.height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setSize(int width, int height)\r\n        {\r\n            CKLBUIScale9_setWidth(CppObject, width);\r\n            CKLBUIScale9_setHeight(CppObject, height);\r\n        }\r\n\t\tpublic String Asset\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn __MarshallingUtils.StringFromNativeUtf8(CKLBUIScale9_getAsset(CppObject));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n                if(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tNativeManagement.resetCppError();\r\n                    CKLBUIScale9_setAsset(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                    NativeManagement.intercepCppError();\r\n                } else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIScore.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\r\n\tpublic class AnimationInfo {\r\n\r\n        private enum EIDX : uint {\r\n            X_COORD\t\t\t= 0,\r\n\t        Y_COORD\t\t\t= 1,\r\n\t        SCALE_COORD\t\t= 2,\r\n\t        R_COLOR\t\t\t= 3,\r\n\t        G_COLOR\t\t\t= 4,\r\n\t        B_COLOR\t\t\t= 5,\r\n\t        A_COLOR\t\t\t= 6,\r\n\t        SCALEX_COORD\t= 7,\r\n\t        SCALEY_COORD\t= 8,\r\n\t        ROTATION_COORD\t= 9,\r\n\r\n            COUNT = 9\t// ROTATION_COORD\r\n        }\r\n\r\n        private         uint        m_mask      = 0;\r\n        private static  uint[]      ms_maskArr  = new uint[] { 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, 1<<8, 1<<9, 1<<10  };\r\n        private static  int[]       ms_indexes  = new int[]  { 0,    2,    4,    8,    10,   12,   14,   16,   18,   20     };\r\n        private         float[]     m_internalArray = new float[22];\r\n\r\n\t\tpublic void createAlphaAnimation    (float start, float end) \r\n        {\r\n            m_mask |= ms_maskArr[(uint)EIDX.A_COLOR];\r\n            m_internalArray[ms_indexes[(int)EIDX.A_COLOR]    ] = start;\r\n            m_internalArray[ms_indexes[(int)EIDX.A_COLOR] + 1] = end;\r\n        }\r\n        public void createRGBAnimation      (float RStart, float REnd, float GStart, float GEnd, float BStart, float BEnd) \r\n        {\r\n            m_mask |= ms_maskArr[(uint)EIDX.R_COLOR];\r\n            m_internalArray[ms_indexes[(int)EIDX.R_COLOR]    ] = RStart;\r\n            m_internalArray[ms_indexes[(int)EIDX.R_COLOR] + 1] = REnd;\r\n            m_mask |= ms_maskArr[(uint)EIDX.G_COLOR];\r\n            m_internalArray[ms_indexes[(int)EIDX.G_COLOR]    ] = GStart;\r\n            m_internalArray[ms_indexes[(int)EIDX.G_COLOR] + 1] = GEnd;\r\n            m_mask |= ms_maskArr[(uint)EIDX.B_COLOR];\r\n            m_internalArray[ms_indexes[(int)EIDX.R_COLOR]    ] = BStart;\r\n            m_internalArray[ms_indexes[(int)EIDX.R_COLOR] + 1] = BEnd;\r\n        }\r\n        public void createScaleAnimation    (float start, float end) \r\n        {\r\n            m_mask |= ms_maskArr[(uint)EIDX.SCALE_COORD];\r\n            m_internalArray[ms_indexes[(int)EIDX.SCALE_COORD]    ] = start;\r\n            m_internalArray[ms_indexes[(int)EIDX.SCALE_COORD] + 1] = end;\r\n            m_internalArray[ms_indexes[(int)EIDX.SCALE_COORD] + 2] = start;\r\n            m_internalArray[ms_indexes[(int)EIDX.SCALE_COORD] + 3] = end;\r\n        }\r\n        public void createXOffsetAnimation  (float start, float end) \r\n        {\r\n            m_mask |= ms_maskArr[(uint)EIDX.X_COORD];\r\n            m_internalArray[ms_indexes[(int)EIDX.X_COORD]    ] = start;\r\n            m_internalArray[ms_indexes[(int)EIDX.X_COORD] + 1] = end;\r\n        }\r\n        public void createYOffsetAnimation  (float start, float end) \r\n        { \r\n            m_mask |= ms_maskArr[(uint)EIDX.Y_COORD];\r\n            m_internalArray[ms_indexes[(int)EIDX.Y_COORD]    ] = start;\r\n            m_internalArray[ms_indexes[(int)EIDX.Y_COORD] + 1] = end;\r\n        }\r\n        //public void createRotationAnimation(float rotationStart, float rotationEnd); // Not supported yet.\r\n\t\t\r\n        internal void getAnimInfo(ref uint type, ref uint affected, ref float[] arrayParam)\r\n        {\r\n            affected    = m_mask;\r\n            type        = 1;\r\n            arrayParam  = new float[22];\r\n\r\n            int idx = 0;\r\n            for(int i = 0; i <= (int)EIDX.COUNT; ++i) {\r\n                uint currentAnim = ms_maskArr[i];\r\n                if(((uint)m_mask & currentAnim) == currentAnim) {\r\n                    int currentIdx = ms_indexes[i];\r\n\t\t\t\t\tarrayParam[idx++] = m_internalArray[currentIdx];\r\n\t\t\t\t\tarrayParam[idx++] = m_internalArray[currentIdx + 1];\r\n                    if(currentAnim == (uint)EIDX.SCALE_COORD) {\r\n\t\t\t\t\t\tarrayParam[idx++] = m_internalArray[currentIdx + 2];\r\n\t\t\t\t\t\tarrayParam[idx++] = m_internalArray[currentIdx + 3];\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\t}\r\n\t\r\n\tpublic class CKLBUIScore : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // texTable : const char**\r\n        // return : CKLBUIScore*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIScore_create(IntPtr pParent, \r\n                                                        uint order, int orderOffset,\r\n                                                        float x, float y, IntPtr[] texTable, \r\n                                                        float stepX, float stepY, int column,\r\n                                                        bool fillZero, bool animFlags,\r\n                                                        uint align, bool countClip);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIScore_getValue(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setValue(IntPtr p, uint value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIScore_getOrder(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setOrder(IntPtr p, uint value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIScore_getOrderOffset(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScore_getStepX(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setStepX(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScore_getStepY(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setStepY(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIScore_getColumn(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setColumn(IntPtr p, uint value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIScore_getFillZero(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setFillZero(IntPtr p, bool value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIScore_getAnim(IntPtr p);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScore_getAlign(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setAlign(IntPtr p, int align);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIScore_getTextures(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIScore_getCountClip(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setCountClip(IntPtr p, bool value);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setEnterAnimation(IntPtr p, uint milliSecondsPlayTime, int timeShift, uint type, uint affected, float[] arrayParam);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScore_setExitAnimation(IntPtr p, uint milliSecondsPlayTime, int timeShift, uint type, uint affected, float[] arrayParam);\r\n\t\t\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_Score\"/*, typeof(CKLBUIScore)*/);\r\n\r\n        public CKLBUIScore( CKLBUITask parent, uint order, int orderOffset, float x, float y, String[] textureTable, \r\n                            float stepX, float stepY, int column, bool fillZeroFlag, bool animationFlag, EALIGN align = EALIGN.ALIGN_RIGHT, bool countClip = false)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIScore_create(parent != null ? parent.CppObject : IntPtr.Zero, order, orderOffset,\r\n                                            x, y, __MarshallingUtils.NativeUtf8ArrayFromStringArray(textureTable, textureTable.Length),\r\n                                            stepX, stepY, column, fillZeroFlag, animationFlag, (uint)align, countClip);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUIScore() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public enum EALIGN {\r\n\t\t    ALIGN_RIGHT  = 0,\r\n\t\t    ALIGN_CENTER = 1,\r\n\t\t    ALIGN_LEFT   = 2,\r\n\t    };\r\n\r\n        public uint     Order\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint     Odoff\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getOrderOffset(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic int      StepX\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getStepX(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setStepX(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n        public int      StepY\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getStepY(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setStepY(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint     Cols\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getColumn(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setColumn(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic bool     FillZero\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getFillZero(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setFillZero(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic bool     IsAnim\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getAnim(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic uint     Value\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScore_getValue(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScore_setValue(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic EALIGN   Align\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn (EALIGN)CKLBUIScore_getAlign(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setAlign(CppObject, (int)value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n        public bool     CountClip\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIScore_getCountClip(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIScore_setCountClip(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n        \r\n\t\tpublic String[] Textures\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringArrayFromNativeUtf8IntPtr(CKLBUIScore_getTextures(CppObject), 10);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\r\n        public void reset() \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIScore_setValue(CppObject, 0);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public void enterAnim(AnimationInfo animation, uint msPlayTime, int timeShift)\r\n        {\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\r\n                uint type           = 0;\r\n                uint affected       = 0;\r\n                float[] param_array = null;\r\n                \r\n                if(animation != null) {\r\n                    animation.getAnimInfo(ref type, ref affected, ref param_array);\r\n                }\r\n\r\n                CKLBUIScore_setEnterAnimation(CppObject, msPlayTime, timeShift, type, affected, param_array);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n        public void exitAnim(AnimationInfo animation, uint msPlayTime, int timeShift)\r\n        {\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\r\n                uint type           = 0;\r\n                uint affected       = 0;\r\n                float[] param_array = null;\r\n\r\n                if(animation != null) {\r\n                    animation.getAnimInfo(ref type, ref affected, ref param_array);\r\n                }\r\n\r\n                CKLBUIScore_setExitAnimation(CppObject, msPlayTime, timeShift, type, affected, param_array);\r\n            } else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIScrollBar.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIScrollBar : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // image   : const char*\r\n        // return  : CKLBUIScrollBar*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIScrollBar_create(\r\n            IntPtr pParent,\r\n\t        uint order, float x, float y, float width, float height,\r\n\t        int minValue, int maxValue, int pos,\r\n\t        IntPtr image,\r\n\t        int slider_size, int min_slider_size, \r\n\t        uint colorNormal, uint colorSelect, bool vert, bool active, bool hideMode);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScrollBar_getMin(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setMin(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScrollBar_getMax(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setMax(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScrollBar_getPos(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setPos(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScrollBar_getSliderSize(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setSliderSize(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIScrollBar_getSliderSizeMin(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setSliderSizeMin(IntPtr p, int value);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIScrollBar_getTouchActive(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setTouchActive(IntPtr p, bool active);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIScrollBar_getNormalColor(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setNormalColor(IntPtr p, uint color);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIScrollBar_getActiveColor(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setActiveColor(IntPtr p, uint color);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setMode(IntPtr p, uint mode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIScrollBar_getVertical(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setVertical(IntPtr p, bool vertical);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBUIScrollBar_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setWidth(IntPtr p, int width);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static int CKLBUIScrollBar_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setHeight(IntPtr p, int height);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIScrollBar_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIScrollBar_setOrder(IntPtr p, uint order);\r\n\r\n        // return : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n        private extern static IntPtr CKLBUIScrollBar_getImage(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUIScrollBar_getMode(IntPtr p);\r\n\r\n        // name : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUIScrollBar_selectScrMgr(IntPtr p, IntPtr name, int len, int[] args);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_ScrollBar\"/*, typeof(CKLBUIScrollBar)*/);\r\n\r\n        public CKLBUIScrollBar(\r\n                                CKLBUITask parent, \r\n                                uint order, float x, float y, float width, float height, \r\n                                int minValue, int maxValue, int pos, \r\n                                String image, \r\n                                int sliderSize, int minSliderSize,\r\n                                uint argbNormal = 0xFFFFFFFF, uint argbSelect = 0xFFFFFFFF, bool vert = true, bool active = true, bool hideMode = false, ScrollBarCallBack callback = null)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIScrollBar_create(\r\n                        parent != null ? parent.CppObject : IntPtr.Zero,\r\n\t                    order, x, y, width, height,\r\n\t                    minValue, maxValue, pos,\r\n\t                    __MarshallingUtils.NativeUtf8FromString(image),\r\n\t                    sliderSize, minSliderSize, \r\n\t                    argbNormal, argbSelect, vert, active, hideMode);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUIScrollBar() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        //the \"type\" parameter is an ETYPE enum\r\n        public delegate void ScrollBarCallBack(CKLBUIScrollBar caller, uint type, int pos);\r\n\r\n        private ScrollBarCallBack m_callback;    // callback number 3\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUI(callBackFunction), 3);\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (ScrollBarCallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(uint type, int pos)\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this, type, pos);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum ETYPE\r\n        {\r\n            SCROLLBAR_DRAG      = 0,\r\n            SCROLLBAR_RELEASE   = 1\r\n        }\r\n\r\n\t\tpublic uint Order\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getOrder(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setOrder(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public int Width\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getWidth(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setWidth(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public int Height\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getHeight(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setHeight(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public void getSize(out Size size)\r\n        {\r\n            size.width  = CKLBUIScrollBar_getWidth(CppObject);\r\n            size.height = CKLBUIScrollBar_getHeight(CppObject);\r\n        }\r\n        public void setSize(Size size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIScrollBar_setWidth(CppObject, size.width);\r\n                CKLBUIScrollBar_setHeight(CppObject, size.height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setSize(int width, int height)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIScrollBar_setWidth(CppObject, width);\r\n                CKLBUIScrollBar_setHeight(CppObject, height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t\tpublic int Start\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getMin(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setMin(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic int End\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getMax(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setMax(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic int Pos\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getPos(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setPos(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic String Img\r\n\t\t{\r\n\t\t\tget\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUIScrollBar_getImage(CppObject));\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t\tpublic int SliderSize\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getSliderSize(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setSliderSize(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic int SliderSizeMin\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getSliderSizeMin(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setSliderSizeMin(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic bool IsVertical\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getVertical(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setVertical(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic uint ArgbNormal \r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getNormalColor(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setNormalColor(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic uint ArgbActive \r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getActiveColor(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setActiveColor(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic bool IsTouchActive\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getTouchActive(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setTouchActive(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public uint Mode\r\n        {\r\n            get \r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIScrollBar_getMode(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIScrollBar_setMode(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n\t\tpublic void selectScrollManager(String name, int[] args = null)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                if(args != null) {\r\n                    CKLBUIScrollBar_selectScrMgr(CppObject, __MarshallingUtils.NativeUtf8FromString(name), args.Length, args);\r\n                } else {\r\n                    CKLBUIScrollBar_selectScrMgr(CppObject, __MarshallingUtils.NativeUtf8FromString(name), 0, null);\r\n                }\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUISimpleItem.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUISimpleItem : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // asset : const char*\r\n        // return : CKLBUISimpleItem*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUISimpleItem_create(IntPtr pParent, uint order, float x, float y, IntPtr asset);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUISimpleItem_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUISimpleItem_setOrder(IntPtr p, uint order);\r\n\r\n\t\t// return : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUISimpleItem_getAsset(IntPtr p);\r\n\t\t#endregion\r\n\r\n        #region Constructor\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_SimpleItem\"/*, typeof(CKLBUISimpleItem)*/);\r\n\r\n        public CKLBUISimpleItem(CKLBUITask parent, uint order, float x, float y, String asset) : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUISimpleItem_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, __MarshallingUtils.NativeUtf8FromString(asset));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n        }\r\n\r\n        public CKLBUISimpleItem() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        public uint   Order\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUISimpleItem_getOrder(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUISimpleItem_setOrder(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\tpublic String Asset\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUISimpleItem_getAsset(CppObject));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t\t//set { throw new CKLBExceptionForbiddenMethod(); }\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUITask.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\nusing System.Collections.Generic;\r\n\r\nnamespace EnginePrototype\r\n{\r\n    /// <summary>\r\n    /// Base class used for all task that are related to displaying something on the screen.\r\n    /// Graphics properties, animation features are available to all tasks derived from this class.\r\n    /// </summary>\r\n\tpublic class CKLBUITask : CKLBTask\r\n\t{\r\n        #region DllImports\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUITask_getVisible(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setVisible(IntPtr p, bool isVisible);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float CKLBUITask_getScaleX(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setScaleX(IntPtr p, float scaleX);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float CKLBUITask_getScaleY(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setScaleY(IntPtr p, float scaleY);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float CKLBUITask_getX(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setX(IntPtr p, float x);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float CKLBUITask_getY(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setY(IntPtr p, float y);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static float CKLBUITask_getRotation(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setRotation(IntPtr p, float rotation);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CKLBUITask_getArgb(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_setArgb(IntPtr p, uint argb);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CKLBUITask_isAnim(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_play(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITask_stop(IntPtr p);\r\n\t\t\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUITask_setParamCount(IntPtr p, uint splineCount, uint maxKeyCount);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITask_setTarget\t\t\t(IntPtr p, uint splineIndex, ETARGET_TYPE targetParameter);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITask_addKeys\t\t\t(IntPtr p, uint splineIndex, uint time, int value);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITask_addKeysFixed\t\t(IntPtr p, uint splineIndex, uint time, int fixed16Value);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITask_generateAnimation\t(IntPtr p);\r\n\r\n        // nodeName : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static bool CKLBUITask_reconnect(IntPtr p, IntPtr nodeName);\r\n\t\t\r\n        #endregion\r\n\r\n        #region Constructors\r\n\r\n        // Just throws the classID to GameObject\r\n        internal CKLBUITask(uint classID) : base(classID) { }\r\n\r\n        #endregion\r\n\r\n        /// <summary>\r\n        /// Type of properties modified by the animation spline.\r\n        /// See IntSpline\r\n        /// See FloatSpline\r\n        /// </summary>\r\n        public enum ETARGET_TYPE\r\n        {\r\n            MODIFY_X        = 1 /* Value in pixels related to node coordinate system*/,\r\n            MODIFY_Y        = 2 /* Value in pixels related to node coordinate system*/,\r\n            MODIFY_SCALE    = 3 /* Scale for X and Y axis, 1.0f is 100% */, \r\n            MODIFY_R        = 4 /* Red color component value between 0 and 255*/,\r\n            MODIFY_G        = 5 /* Green color component value between 0 and 255*/,\r\n            MODIFY_B        = 6 /* Blue color component value between 0 and 255*/,\r\n            MODIFY_A        = 7 /* Alpha color component value between 0 and 255*/,\r\n            MODIFY_ROT      = 8 /* Rotation in degree, 360.0f is a full rotation*/\r\n        }\r\n\r\n        /// <summary>\r\n        /// Type of the spline to be used.\r\n        /// </summary>\r\n        public enum ESPLINE_TYPE\r\n        {\r\n            INT_SPLINE,\r\n            FLOAT_SPLINE\r\n        }\r\n\r\n        /// <summary>\r\n        /// Abstract Class owning one animation spline for one target property.\r\n        /// </summary>\r\n        public abstract class Spline\r\n        {\r\n            protected ETARGET_TYPE m_targetType;\r\n            public ETARGET_TYPE TargetType\r\n            {\r\n                get { return m_targetType; }\r\n            }\r\n\r\n            /// <summary>\r\n            /// Number of keys inside the spline.\r\n            /// </summary>\r\n            public abstract uint KeyCount\r\n            {\r\n                get;\r\n            }\r\n\r\n            protected Spline(ETARGET_TYPE targetType)\r\n            {\r\n                m_targetType = targetType;\r\n            }\r\n\r\n            abstract public void addKeyInt(uint time, int value);\r\n            abstract public void addKeyFloat(uint time, float value);\r\n\r\n            internal abstract void addKeys(IntPtr p, uint splineIndex);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Class used to define a spline using integer values.\r\n        /// </summary>\r\n        private class IntSpline : Spline\r\n        {\r\n            class IntPoint\r\n            {\r\n                private uint m_time;\r\n                public uint Time\r\n                {\r\n                    get { return m_time; }\r\n                }\r\n\r\n                private short m_value;\r\n                public short Value\r\n                {\r\n                    get { return m_value; }\r\n                }\r\n\r\n                internal IntPoint(uint time, short value)\r\n                {\r\n                    m_time = time;\r\n                    m_value = value;\r\n                }\r\n            }\r\n\r\n            private List<IntPoint> m_points;\r\n\r\n            internal IntSpline(ETARGET_TYPE targetType) : base(targetType)\r\n            {\r\n                m_points = new List<IntPoint>();\r\n            }\r\n\r\n            //Allows the user to add a key with an int value to a spline\r\n            override public void addKeyInt(uint time, int value)\r\n            {\r\n                if(value <= 32767)\t//short.MaxValue\r\n                {\r\n                    m_points.Add(new IntPoint(time, (short)value));\r\n                } else {\r\n                    throw new CKLBException(\"The value of a spline point cannot be greater than 32767\");\r\n                }\r\n            }\r\n            public override void addKeyFloat(uint time, float value)\r\n            {\r\n                throw new CKLBExceptionForbiddenMethod();\r\n            }\r\n\r\n            public override uint KeyCount\r\n            {\r\n                get { return (uint)m_points.Count; }\r\n            }\r\n\r\n            //Used internally to generate the animation\r\n            internal override void addKeys(IntPtr p, uint splineIndex)\r\n            {\r\n                for(int i = 0; i < m_points.Count; ++i) {\r\n                    CKLBUITask_addKeys(p, splineIndex, m_points[i].Time, m_points[i].Value);\r\n                }\r\n            }\r\n        }\r\n\r\n        private class FloatSpline : Spline\r\n        {\r\n            public class FloatPoint\r\n            {\r\n                private uint m_time;\r\n                public uint Time\r\n                {\r\n                    get { return m_time; }\r\n                }\r\n\r\n                private float m_value;\r\n                public float Value\r\n                {\r\n                    get { return m_value; }\r\n                }\r\n\r\n                internal FloatPoint(uint time, float value)\r\n                {\r\n                    m_time = time;\r\n                    m_value = value;\r\n                }\r\n            }\r\n\r\n            private List<FloatPoint> m_points;\r\n\r\n            internal FloatSpline(ETARGET_TYPE targetType) : base(targetType)\r\n            {\r\n                m_points = new List<FloatPoint>();\r\n            }\r\n\r\n            //Allows the user to add a key with a float value to a spline\r\n            override public void addKeyFloat(uint time, float value)\r\n            {\r\n                m_points.Add(new FloatPoint(time,value));\r\n            }\r\n\r\n            public override void addKeyInt(uint time, int value)\r\n            {\r\n                throw new CKLBExceptionForbiddenMethod();\r\n            }\r\n\r\n            public override uint KeyCount\r\n            {\r\n                get { return (uint)m_points.Count; }\r\n            }\r\n\r\n            //Used internally to generate the animation\r\n            internal override void addKeys(IntPtr p, uint splineIndex)\r\n            {\r\n                for(int i = 0; i < m_points.Count; ++i) {\r\n                    CKLBUITask_addKeysFixed(p, splineIndex, m_points[i].Time, (int)(m_points[i].Value*65536.0));\r\n                }\r\n            }\r\n        }\r\n\r\n        public class AnimSpline\r\n        {\r\n            private List<Spline> m_splines;\r\n            public List<Spline> Splines\r\n            {\r\n                get { return m_splines; }\r\n            }\r\n\r\n            public AnimSpline()\r\n            {\r\n                m_splines = new List<Spline>();\r\n            }\r\n\r\n            public Spline addNewSpline(ETARGET_TYPE targetType, ESPLINE_TYPE splineType)\r\n            {\r\n                switch (splineType) {\r\n                    case ESPLINE_TYPE.INT_SPLINE:\r\n                    {      \r\n                        IntSpline spline = new IntSpline(targetType);\r\n                        m_splines.Add(spline);\r\n                        return spline;\r\n                    }\r\n\r\n                    case ESPLINE_TYPE.FLOAT_SPLINE:\r\n                    {\r\n                        FloatSpline spline = new FloatSpline(targetType);\r\n                        m_splines.Add(spline);\r\n                        return spline;\r\n                    }\r\n\r\n                    default: return null;\r\n                }\r\n            }\r\n            public void reset()\r\n            {\r\n                m_splines.Clear();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Scale property on the X axis of the graphic task.\r\n        /// 1.0f means 100%\r\n        /// </summary>\r\n        public float ScaleX\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getScaleX(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setScaleX(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Scale property on the Y axis of the graphic task.\r\n        /// 1.0f means 100%\r\n        /// </summary>\r\n        public float ScaleY\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getScaleY(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setScaleY(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// Scale property on the X axis of the graphic task.\r\n        /// Scale is in degree, so 360.0f is a complete rotation.\r\n        /// </summary>\r\n        public float Rotation\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getRotation(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setRotation(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// X coordinate related to graphic parent task, or related to screen left coordinate if no owner set. \r\n        /// 1.0f means 1 pixels in logical screen coordinate.\r\n        /// </summary>\r\n        public float X\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getX(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setX(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// Y coordinate related to graphic parent task, or related to screen top coordinate if no owner set. \r\n        /// 1.0f means 1 pixels in logical screen coordinate.\r\n        /// </summary>\r\n        public float Y\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getY(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setY(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// Allows a graphic task to be visible or invisible.\r\n        /// As an example a blinking object could be made easily.\r\n        /// Hiding useless objects improve the engine performance and is recommended instead of putting them outside of the screen viewport.\r\n        /// </summary>\r\n        public bool IsVisible\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getVisible(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setVisible(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// It is possible to have a global color multiplied to the graphic task.\r\n        /// As an example, alpha blending is the most easy use case to understand.\r\n        /// ARGB values are stored on 32 bit with 8 bit per component ARGB\r\n        /// B is LSB and A the MSB in the following order ARGB\r\n        /// As an example : 0xFF000000 turn the object shape fully black\r\n        ///                 0x80FFFFFF turn the object with 50% alpha blending.\r\n        /// Basically every color in the object in modified in the following fashion :\r\n        /// Alpha blending with screen = A Task pixel * A color.\r\n        /// R on screen before alpha blending = R Task pixel * R Color\r\n        /// G on screen before alpha blending = G Task pixel * G Color\r\n        /// B on screen before alpha blending = B Task pixel * B Color\r\n        /// </summary>\r\n        public uint Argb\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_getArgb(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUITask_setArgb(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicate if the task is already performing an animation.\r\n        /// </summary>\r\n        public bool IsNodeAnim\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUITask_isAnim(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Get a node iterator, allowing to navigate through the scenegraph and manipulate nodes inside a task.\r\n\t\t/// Return the node passed as parameter.\r\n        /// </summary>\r\n        /// <param name=\"nodeIterator\">Return a </param>\r\n        /// <returns></returns>\r\n        public NodeIterator getIterator(out NodeIterator nodeIterator)\r\n        {\r\n            uint counter    = NativeManagement.getContextCounter();\r\n            IntPtr node     = NodeIterator.getNodeFromTask(this);\r\n\r\n            nodeIterator = new NodeIterator(counter, node);\r\n            return nodeIterator;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Get a node iterator already positionned on a node named \"name\".\r\n        /// </summary>\r\n        /// <param name=\"name\">iterator default position, if name is null or not found, ?</param>\r\n        /// <param name=\"nodeIterator\">returned iterator</param>\r\n        /// <returns>? not void</returns>\r\n        public NodeIterator getIteratorFromName(String name, out NodeIterator nodeIterator)\r\n        {\r\n            nodeIterator = getIterator(out nodeIterator);\r\n            if(!nodeIterator.find(name)) {\r\n                nodeIterator = null;\r\n            }\r\n            return nodeIterator;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Use to move a part of the scene graph tree to another part, only within this task.\r\n        /// Basically, it is mainly used for forms, but any task can benefit from such feature.\r\n        /// </summary>\r\n        /// <param name=\"nodeName\"></param>\r\n        public void nodeReconnect(String nodeName)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUITask_reconnect(CppObject, __MarshallingUtils.NativeUtf8FromString(nodeName));\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Start an animation, ? what happen if already animating ?\r\n        /// See setAnimSpline()\r\n        /// </summary>\r\n        public void animationPlay()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUITask_play(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Stop an animation, does nothing is no animation is executing.\r\n        /// See setAnimSpline()\r\n        /// </summary>\r\n        public void animationStop()\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUITask_stop(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }  \r\n\r\n        /// <summary>\r\n        /// Helper function to set both X and Y scale in an atomic fashion, faster than setting scale seperatly.\r\n        /// </summary>\r\n        /// <param name=\"scaleX\">X Scale, 1.0f is 100%</param>\r\n        /// <param name=\"scaleY\">Y Scale, 1.0f is 100%</param>\r\n        public void setScale(float scaleX, float scaleY)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUITask_setScaleX(CppObject, scaleX);\r\n                CKLBUITask_setScaleY(CppObject, scaleY);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Link an animation information to the root node of this task.\r\n        /// See animationPlay()\r\n        /// See animationStop()\r\n        /// ? Rename as setAnimationSpline\r\n        /// </summary>\r\n        /// <param name=\"splineArray\"></param>\r\n        public void setAnimSpline(AnimSpline splineArray)\r\n        {\r\n            uint maxKeyCount = 0;\r\n            for(int i = 0; i < splineArray.Splines.Count; ++i) {\r\n                if(splineArray.Splines[i].KeyCount > maxKeyCount) {\r\n                    maxKeyCount = splineArray.Splines[i].KeyCount;\r\n                }\r\n            }\r\n            if(CKLBUITask_setParamCount(CppObject, (uint)splineArray.Splines.Count, maxKeyCount)) {\r\n                uint splineIndex = 0;\r\n                for(int i = 0; i < splineArray.Splines.Count; ++i) {\r\n                    CKLBUITask_setTarget(CppObject, splineIndex, splineArray.Splines[i].TargetType);\r\n                    splineArray.Splines[i].addKeys(CppObject, splineIndex++);\r\n                }\r\n                CKLBUITask_generateAnimation(CppObject);\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUITextInput.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUITextInput : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // parent : CKLBUITask\r\n        // defaultText : const char*\r\n        // return : CKLBUITextInput*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUITextInput_create(IntPtr parent, bool passwordMode, \r\n                                                            float x, float y, float width, float height, IntPtr defaultText, int widgetId,\r\n                                                            int maxLen, uint charType);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUITextInput_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITextInput_setWidth(IntPtr p, uint width);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUITextInput_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITextInput_setHeight(IntPtr p, uint height);\r\n\t\t\r\n\t\t// return and text : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUITextInput_getText(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUITextInput_setText(IntPtr p, IntPtr text);\r\n\r\n        // placeholder : const char*\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITextInput_setPlaceHolder(IntPtr p, IntPtr placeholder);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITextInput_setColor(IntPtr p, bool bTouch, uint foregroundRgb, uint backgroundRgb);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUITextInput_getMaxLen(IntPtr p);\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITextInput_setMaxLen(IntPtr p, int maxlen);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITextInput_setCharType(IntPtr p, uint chartype);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUITextInput_getCharCount(IntPtr p);\r\n\r\n        // fontname : const char *\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUITextInput_setFont(IntPtr p, IntPtr fontName, float fontSize);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_TextInput\"/*, typeof(CKLBUITextInput)*/);\r\n\r\n        public CKLBUITextInput(CKLBUITask parent, bool passwordMode, int x, int y, uint width, uint height, String defaultText, CallBack callback, \r\n                                int widgetId = 0, int maxLen = 0, uint charType = (uint)(ECHAR_TYPE.TXCH_7BIT_ASCII|ECHAR_TYPE.TXCH_UTF8)) \r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUITextInput_create(parent != null ? parent.CppObject : IntPtr.Zero, passwordMode, x, y, width, height, __MarshallingUtils.NativeUtf8FromString(defaultText), widgetId, maxLen, charType);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUITextInput() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUITextInput caller, String txt, uint id);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerSU(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        // txt : const char* from Cpp\r\n        public virtual void callBackFunction(IntPtr txt, uint id)\r\n        {\r\n            if(m_callback != null)\r\n            {\r\n                m_callback(this, __MarshallingUtils.StringFromNativeUtf8(txt), id);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum ECHAR_TYPE\r\n        {\r\n            TXCH_7BIT_ASCII = 0x0001,\r\n            TXCH_UTF8       = 0x0002\r\n        }\r\n\r\n        public uint Width\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUITextInput_getWidth(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUITextInput_setWidth(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public uint Height\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUITextInput_getHeight(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUITextInput_setHeight(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public void getSize(out USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                size.width = CKLBUITextInput_getWidth(CppObject);\r\n                size.height = CKLBUITextInput_getHeight(CppObject);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n        public void setSize(USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                CKLBUITextInput_setWidth(CppObject, size.width);\r\n                CKLBUITextInput_setHeight(CppObject, size.height);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n        public void setSize(uint width, uint height)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                CKLBUITextInput_setWidth(CppObject, width);\r\n                CKLBUITextInput_setHeight(CppObject, height);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t\tpublic String Text\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return __MarshallingUtils.StringFromNativeUtf8(CKLBUITextInput_getText(CppObject));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUITextInput_setText(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        public int MaxLen\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUITextInput_getMaxLen(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    CKLBUITextInput_setMaxLen(CppObject, value);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public int CharCount \r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero)\r\n                    return CKLBUITextInput_getCharCount(CppObject);\r\n                else\r\n                    throw new CKLBExceptionNullCppObject();\r\n            }\r\n            //set { throw new CKLBExceptionForbiddenMethod(); }\r\n        }\r\n\r\n        public void setColor(bool bTouch, uint foregroundRgb, uint backgroundRgb)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUITextInput_setColor(CppObject, bTouch, foregroundRgb, backgroundRgb);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\r\n        public void setFont(String fontName, float fontSize)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUITextInput_setFont(CppObject, __MarshallingUtils.NativeUtf8FromString(fontName), fontSize);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\r\n        public void setCharType(ECHAR_TYPE chartype)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUITextInput_setCharType(CppObject, (uint)chartype);\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\r\n        public void setPlaceHolder(String placeHolder)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n                CKLBUITextInput_setPlaceHolder(CppObject, __MarshallingUtils.NativeUtf8FromString(placeHolder));\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUITouchPad.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUITouchPad : CKLBTask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBTask*\r\n        // return : CKLBUITouchPad*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUITouchPad_create(IntPtr pParent, bool modal);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUITouchPad_setGroup(IntPtr p, IntPtr group_name);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUITouchPad_setLock(IntPtr p, bool lock_mode);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUITouchPad_setGetAll(IntPtr p, bool bAll);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_TouchPad\"/*, typeof(CKLBUITouchPad)*/);\r\n\r\n        public CKLBUITouchPad(CKLBTask parent, CallBack callback, bool modal = false)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUITouchPad_create(parent != null ? parent.CppObject : IntPtr.Zero, modal);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUITouchPad() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        //the \"type\" parameter is an ETYPE enum\r\n        public delegate void CallBack(CKLBUITouchPad caller, uint execount, uint type, uint id, int x, int y);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUUUII(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(uint execount, uint type, uint id, int x, int y)\r\n        {\r\n            if(m_callback != null)\r\n            {\r\n                m_callback(this, execount, type, id, x, y);\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        public enum ETYPE\r\n        {\r\n            TAP,\r\n            DRAG,\r\n            RELEASE\r\n        }\r\n\r\n        public void setGetAll(bool bGetAll)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUITouchPad_setGetAll(CppObject, bGetAll);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t\tpublic void setLock(bool bLock)\r\n\t\t{\r\n    \t    if(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUITouchPad_setLock(CppObject, bLock);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n        \r\n        public bool setGroup(String group_name) \r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUITouchPad_setGroup(CppObject, __MarshallingUtils.NativeUtf8FromString(group_name));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIVariableItem.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIVariableItem : CKLBUITask\r\n\t{\r\n\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // asset : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIVariableItem_create(IntPtr pParent, uint order, float x, float y, float width, float height, IntPtr asset);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVariableItem_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVariableItem_setOrder(IntPtr p, uint order);\r\n\r\n        // return : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIVariableItem_getAsset(IntPtr p);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIVariableItem_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVariableItem_setWidth(IntPtr p, float width);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static float CKLBUIVariableItem_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVariableItem_setHeight(IntPtr p, float height);\r\n\t\t\r\n        // assetName : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIVariableItem_changeAsset(IntPtr p, IntPtr assetName);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVariableItem_changeUV(IntPtr p, float x, float y, float width, float height);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVariableItem_resetUV(IntPtr p);\r\n\r\n        // assetName : const char*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIVariableItem_setMaskAsset(IntPtr p, IntPtr assetName);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_VariableItem\"/*, typeof(CKLBUIVariableItem)*/);\r\n\r\n\t\tpublic CKLBUIVariableItem(CKLBUITask parent, uint order, float x, float y, float width, float height, String asset = null)\r\n            : base(s_classID)\r\n\t\t{\r\n\t\t\tNativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIVariableItem_create( parent != null ? parent.CppObject : IntPtr.Zero, \r\n                                                    order, x, y, width, height, __MarshallingUtils.NativeUtf8FromString(asset));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n\t\t}\r\n\r\n        public CKLBUIVariableItem() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n\t\tpublic uint   Order\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIVariableItem_getOrder(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIVariableItem_setOrder(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic String Asset\r\n\t\t{\r\n\t\t\tget \r\n            {\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn __MarshallingUtils.StringFromNativeUtf8(CKLBUIVariableItem_getAsset(CppObject));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n            { \r\n                if(CppObject != IntPtr.Zero) {\r\n                    NativeManagement.resetCppError();\r\n\t\t\t\t\tCKLBUIVariableItem_changeAsset(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n                    NativeManagement.intercepCppError();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic float  Width\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIVariableItem_getWidth(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIVariableItem_setWidth(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic float  Height\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\treturn CKLBUIVariableItem_getHeight(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\t\tCKLBUIVariableItem_setHeight(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic void   getSize(out FSize size)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tsize.width = CKLBUIVariableItem_getWidth(CppObject);\r\n\t\t\t\tsize.height = CKLBUIVariableItem_getHeight(CppObject);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public void setUV(float x, float y, float width, float height) {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIVariableItem_changeUV(CppObject, x, y, width, height);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void resetUV() {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIVariableItem_resetUV(CppObject);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public bool setMaskAsset(String assetName)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\treturn CKLBUIVariableItem_setMaskAsset(CppObject, __MarshallingUtils.NativeUtf8FromString(assetName));\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIVirtualDoc.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\r\n\tpublic class CKLBUIVirtualDoc : CKLBUITask\r\n\t{\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // return  : CKLBUIVirtualDoc*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CKLBUIVirtualDoc_create(   IntPtr pParent,\r\n                                                                uint order, float x, float y,\r\n                                                                uint docWidth, uint docHeight,\r\n                                                                uint viewWidth, uint viewHeight,\r\n                                                                uint maxCommandNums, bool verticalFlag);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_clear(IntPtr p, uint color);\r\n\t\t\r\n\t\t//  fontName : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setFont(IntPtr p, uint idx, IntPtr fontName, uint fontSize);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setViewPortPos(IntPtr p, int x, int y);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_drawLine(IntPtr p, int x0, int y0, int x1, int y1, uint color);\r\n\t\t\r\n\t\t// image : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_drawImage(IntPtr p, int x0, int y0, IntPtr image, uint alpha);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_fillRect(IntPtr p, int x0, int y0, uint width, uint height, uint color, bool fill);\r\n\t\t\r\n\t\t// str : const char *\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_drawText(IntPtr p, int x0, int y0, IntPtr str, uint color, uint fontidx);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_startDocument(IntPtr p);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CKLBUIVirtualDoc_checkDocumentSize(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_endDocument(IntPtr p);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVirtualDoc_getCommandMax(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setCommandMax(IntPtr p, uint command);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVirtualDoc_getDocHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setDocHeight(IntPtr p, uint command);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVirtualDoc_getDocWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setDocWidth(IntPtr p, uint command);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\t[return: MarshalAs(UnmanagedType.I1)]\r\n\t\tprivate extern static bool CKLBUIVirtualDoc_getVertical(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setVertical(IntPtr p, bool vertical);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVirtualDoc_getViewHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setViewHeight(IntPtr p, uint height);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVirtualDoc_getViewWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setViewWidth(IntPtr p, uint width);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static uint CKLBUIVirtualDoc_getOrder(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setOrder(IntPtr p, uint order);\r\n\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIVirtualDoc_setAlign(IntPtr p, uint align, int alignWidth);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_VirtualDoc\"/*, typeof(CKLBUIVirtualDoc)*/);\r\n\r\n        public CKLBUIVirtualDoc(CKLBUITask parent, uint order, float x, float y, uint docWidth, uint docHeight, uint viewWidth, uint viewHeight, uint maxCommandNums, bool verticalFlag, CallBack callback)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIVirtualDoc_create(parent != null ? parent.CppObject : IntPtr.Zero, order, x, y, docWidth, docHeight, viewWidth, viewHeight, maxCommandNums, verticalFlag);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n            m_isLocked = false;\r\n        }\r\n\r\n        public CKLBUIVirtualDoc() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUIVirtualDoc caller, ETYPE type, int x, int y, uint moveX, uint moveY);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUIIUU(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        public virtual void callBackFunction(uint type, int x, int y, uint moveX, uint moveY)\r\n        {\r\n            if(m_callback != null) {\r\n                m_callback(this, (ETYPE)type, x, y, moveX, moveY);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n        private bool m_isLocked;\r\n\r\n        public enum ETYPE : uint\r\n        {\r\n            TAP,\r\n            DRAG,\r\n            RELEASE\r\n        }\r\n        public enum EALIGN : uint {\r\n            VD_ALIGN_LEFT = 0,\r\n\t        VD_ALIGN_CENTER,\r\n\t        VD_ALIGN_RIGHT,\r\n        }\r\n\r\n\t\tpublic uint Order\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getOrder(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setOrder(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint CmdMax\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getCommandMax(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setCommandMax(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic bool Vertical\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getVertical(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setVertical(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n\t\tpublic uint DocWidth\r\n\t\t{\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getDocWidth(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setDocWidth(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n\t\t}\r\n        public uint DocHeight\r\n        {\r\n            get\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getDocHeight(CppObject);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n            set\r\n            {\r\n                if(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setDocHeight(CppObject, value);\r\n                } else {\r\n                    throw new CKLBExceptionNullCppObject();\r\n                }\r\n            }\r\n        }\r\n        public void getDocSize(out USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                size.width = CKLBUIVirtualDoc_getDocWidth(CppObject);\r\n                size.height = CKLBUIVirtualDoc_getDocHeight(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setDocSize(USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_setDocWidth(CppObject, size.width);\r\n                CKLBUIVirtualDoc_setDocHeight(CppObject, size.height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setDocSize(uint width, uint height)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_setDocWidth(CppObject, width);\r\n                CKLBUIVirtualDoc_setDocHeight(CppObject, height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t\tpublic uint ViewWidth\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getViewWidth(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setViewWidth(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic uint ViewHeight\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    return CKLBUIVirtualDoc_getViewHeight(CppObject);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero) {\r\n                    CKLBUIVirtualDoc_setViewHeight(CppObject, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n        public void getViewSize(out USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                size.width = CKLBUIVirtualDoc_getViewWidth(CppObject);\r\n                size.height = CKLBUIVirtualDoc_getViewHeight(CppObject);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setViewSize(USize size)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_setViewWidth(CppObject, size.width);\r\n                CKLBUIVirtualDoc_setViewHeight(CppObject, size.height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        public void setViewSize(uint width, uint height)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_setViewWidth(CppObject, width);\r\n                CKLBUIVirtualDoc_setViewHeight(CppObject, height);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n\t\tpublic void setFont(uint index, String name, uint size)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIVirtualDoc_setFont(CppObject, index, __MarshallingUtils.NativeUtf8FromString(name), size);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\r\n        public void clear(uint argb)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_clear(CppObject, argb);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void setViewPortPos(int x, int y)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_setViewPortPos(CppObject, x, y);\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        // Default value : ViewWidth\r\n\t\tpublic void setAlign(EALIGN align, int alignWidth = -1)\r\n\t\t{\r\n\t\t\tif(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIVirtualDoc_setAlign(CppObject, (uint)align, (alignWidth == -1) ? (int)ViewWidth : alignWidth);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n\t\t}\r\n\t\t\r\n        public void startDrawList(uint commandCount) {\r\n            if(CppObject != IntPtr.Zero) {\r\n                CKLBUIVirtualDoc_setCommandMax(CppObject, commandCount);\r\n                CKLBUIVirtualDoc_checkDocumentSize(CppObject);\r\n                CKLBUIVirtualDoc_startDocument(CppObject);\r\n                m_isLocked = true;\r\n            } else {\r\n                throw new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\r\n        public void endDrawList() {\r\n            CKLBUIVirtualDoc_endDocument(CppObject);\r\n            m_isLocked = false;\r\n        }\r\n\r\n        public void drawLine(int x0, int y0, int x1, int y1, uint argb)\r\n        {\r\n            if(CppObject == IntPtr.Zero) { throw new CKLBExceptionNullCppObject(); }\r\n\r\n            if(m_isLocked) {\r\n                CKLBUIVirtualDoc_drawLine(CppObject, x0, y0, x1, y1, argb);\r\n            } else {\r\n                throw new CKLBException(\"Please use the draw functions in startDrawList()/endDrawList() blocks\");\r\n            }\r\n        }\r\n\r\n\t\tpublic void drawText(int x0, int y0, String str, uint argb, uint font_index) \r\n\t\t{\r\n            if(CppObject == IntPtr.Zero) { throw new CKLBExceptionNullCppObject(); }\r\n\r\n            if(m_isLocked) {\r\n                CKLBUIVirtualDoc_drawText(CppObject, x0, y0, __MarshallingUtils.NativeUtf8FromString(str), argb, font_index);\r\n            } else {\r\n                throw new CKLBException(\"Please use the draw functions in startDrawList()/endDrawList() blocks\");\r\n            }\r\n\t\t}\r\n\r\n        public void drawFillRect(int x0, int y0, uint width, uint height, uint argb, bool fill) \r\n\t\t{\r\n            if(CppObject == IntPtr.Zero) { throw new CKLBExceptionNullCppObject(); }\r\n\r\n            if(m_isLocked) {\r\n                CKLBUIVirtualDoc_fillRect(CppObject, x0, y0, width, height, argb, fill);\r\n            } else {\r\n                throw new CKLBException(\"Please use the draw functions in startDrawList()/endDrawList() blocks\");\r\n            }\r\n\t\t}\r\n\r\n        public void drawImage(int x, int y, String image, uint alpha)\r\n        {\r\n            if(CppObject == IntPtr.Zero) { throw new CKLBExceptionNullCppObject(); }\r\n\r\n            if(m_isLocked) {\r\n                NativeManagement.resetCppError();\r\n                CKLBUIVirtualDoc_drawImage(CppObject, x, y, __MarshallingUtils.NativeUtf8FromString(image), alpha);\r\n                NativeManagement.intercepCppError();\r\n            } else {\r\n                throw new CKLBException(\"Please use the draw functions in startDrawList()/endDrawList() blocks\");\r\n            }\r\n        }\r\n\r\n\t}\r\n}"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/CKLBUIWebArea.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing System.Runtime.InteropServices; // Contains DllImport\r\n\r\nnamespace EnginePrototype\r\n{\r\n\tpublic class CKLBUIWebArea : CKLBUITask\r\n\t{\r\n\r\n\t\t#region DllImports\r\n        // pParent : CKLBUITask*\r\n        // url : const char*\r\n        // return : CKLBUIWebArea*\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static IntPtr CKLBUIWebArea_create(IntPtr pParent, bool mode, float x, float y, float width, float height, IntPtr url);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIWebArea_getWidth(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIWebArea_setWidth(IntPtr p, int width);\r\n\t\t\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static int CKLBUIWebArea_getHeight(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIWebArea_setHeight(IntPtr p, int height);\r\n\t\t\r\n\t\t// text and return : const char * : \r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static IntPtr CKLBUIWebArea_getText(IntPtr p);\r\n\t\t[DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n\t\tprivate extern static void CKLBUIWebArea_setText(IntPtr p, IntPtr text);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIWebArea_setScalesPageToFit(IntPtr p, bool b);\r\n\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n\t\tprivate extern static void CKLBUIWebArea_setBgColor(IntPtr p, uint argb);\r\n\t\t#endregion\r\n\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"UI_WebView\"/*, typeof(CKLBUIWebArea)*/);\r\n\r\n        public CKLBUIWebArea(CKLBUITask parent, bool mode, float x, float y, float width, float height, String url, CallBack callback)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CKLBUIWebArea_create(parent != null ? parent.CppObject : IntPtr.Zero, mode, x, y, width, height, __MarshallingUtils.NativeUtf8FromString(url));\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback = callback;\r\n        }\r\n\r\n        public CKLBUIWebArea() : base(s_classID) { }\r\n\r\n        #endregion\r\n\r\n        #region CallBacks\r\n\r\n        public delegate void CallBack(CKLBUIWebArea caller, uint uint1, String url);\r\n        \r\n        private CallBack m_callback;\r\n\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            registerCallBack(new NativeManagement.FunctionPointerUS(callBackFunction));\r\n        }\r\n\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName = null)\r\n        {\r\n            m_callback = (CallBack)anyDelegate;\r\n        }\r\n\r\n        // url : const char* from Cpp\r\n        public virtual void callBackFunction(uint uint1, IntPtr url)\r\n        {\r\n            if(m_callback != null)\r\n            {\r\n                m_callback(this, uint1, __MarshallingUtils.StringFromNativeUtf8(url));\r\n            }\r\n            else\r\n            {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n        #endregion\r\n\r\n        public int Width\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{ \r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\treturn CKLBUIWebArea_getWidth(CppObject);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\tCKLBUIWebArea_setWidth(CppObject,value);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t}\r\n        public int Height\r\n\t\t{\r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\treturn CKLBUIWebArea_getHeight(CppObject);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\tCKLBUIWebArea_setHeight(CppObject,value);\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t}\r\n        public void getSize(out Size size)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                size.width = CKLBUIWebArea_getWidth(CppObject);\r\n                size.height = CKLBUIWebArea_getHeight(CppObject);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n        public void setSize(Size size)\r\n        {\r\n            if(CppObject != IntPtr.Zero)\r\n            {\r\n                CKLBUIWebArea_setWidth(CppObject, size.width);\r\n                CKLBUIWebArea_setHeight(CppObject, size.height);\r\n            }\r\n            else\r\n                throw new CKLBExceptionNullCppObject();\r\n        }\r\n        public void setSize(int width, int height)\r\n        {\r\n            CKLBUIWebArea_setWidth(CppObject, width);\r\n            CKLBUIWebArea_setHeight(CppObject, height);\r\n        }\r\n\t\tpublic String Url\r\n\t\t{ \r\n\t\t\tget \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n\t\t\t\t\treturn __MarshallingUtils.StringFromNativeUtf8(CKLBUIWebArea_getText(CppObject));\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t\tset \r\n\t\t\t{\r\n\t\t\t\tif(CppObject != IntPtr.Zero)\r\n                    CKLBUIWebArea_setText(CppObject, __MarshallingUtils.NativeUtf8FromString(value));\r\n\t\t\t\telse\r\n\t\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n\t\t\t}\r\n\t\t}\r\n\r\n        public void setScalesPageToFit(bool b)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIWebArea_setScalesPageToFit(CppObject, b);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n        \r\n        public void setBgColor(uint argb)\r\n        {\r\n            if(CppObject != IntPtr.Zero) {\r\n\t\t\t\tCKLBUIWebArea_setBgColor(CppObject, argb);\r\n\t\t\t} else {\r\n\t\t\t\tthrow new CKLBExceptionNullCppObject();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype/Wrappers/IAmADocClass.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\nusing System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace EnginePrototype\r\n{\r\n\r\n    class IAmADocClass : GameObject\r\n    {\r\n        /// The DllImports region contains all the private DllImports of the class.\r\n        /// You must use the following library : System.Runtime.InteropServices\r\n        #region DllImports\r\n\r\n        /// <summary>\r\n        /// Static constructor of C++ object\r\n        /// </summary>\r\n        /// <param name=\"pParent\">Parent pointer</param>\r\n        /// <returns>IntPtr to the C++ class which has been instanciated</returns>\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CppClassName_create(IntPtr pParent);\r\n\r\n        /// <summary>\r\n        /// Normal DllImport\r\n        /// </summary>\r\n        /// <param name=\"pObject\">Pointer to Cpp Object bound by this class</param>\r\n        /// <param name=\"intArg\">int/uint/float/double/bool type is passed directly as this one</param>\r\n        /// <returns>int/uint/float/double directly</returns>\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static uint CppClassName_getSetArg(IntPtr pObject, int intArg);\r\n\r\n        /// <summary>\r\n        /// Get a bool\r\n        /// </summary>\r\n        /// <param name=\"p\">Pointer to Cpp Object bound by this class</param>\r\n        /// <returns>boolean which miust be Marshalled</returns>\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        [return: MarshalAs(UnmanagedType.I1)]\r\n        private extern static bool CppClassName_getBool(IntPtr p);\r\n\r\n        /// <summary>\r\n        /// Set String from C# to a C++ char* or const char*\r\n        /// </summary>\r\n        /// <param name=\"p\">Pointer to Cpp Object bound by this class</param>\r\n        /// <param name=\"myString\">\r\n        /// My String passed as an IntPtr.\r\n        /// To convert a String to an UTF8 IntPtr,\r\n        /// you must use the following function : __MarshallingUtils.NativeUtf8FromString(String)\r\n        /// </param>\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static void CppClassName_setString(IntPtr p, IntPtr myString);\r\n\r\n        /// <summary>\r\n        /// Get a C# String from a C++ char* or const char*\r\n        /// </summary>\r\n        /// <param name=\"p\"></param>\r\n        /// <returns>\r\n        /// IntPtr to the C++ char*.\r\n        /// To convert this IntPtr to a String,\r\n        /// you must use the following function : __MarshallingUtils.StringFromNativeUtf8(IntPtr)\r\n        /// </returns>\r\n        [DllImport(\"__Internal\", CallingConvention = CallingConvention.Cdecl)]\r\n        private extern static IntPtr CppClassName_getString(IntPtr p);\r\n\r\n        #endregion\r\n\r\n        // The Constructors region contains the classID, the basic constructor and a constructor for later binding.\r\n        #region Constructors\r\n\r\n        static uint s_classID = __FrameworkUtils.RegisterClass(\"Class name\", typeof(IAmADocClass));\r\n\r\n        /// <summary>\r\n        /// IAmADocClass constructor.\r\n        /// Create C# object.\r\n        /// Create C++ object.\r\n        /// Check if there is an error in C++ Engine\r\n        /// Bind both objects.\r\n        /// Register callbacks if there is/are some to register in constructor\r\n        /// </summary>\r\n        /// <param name=\"parent\"></param>\r\n        /// <param name=\"arg\"></param>\r\n        /// <param name=\"onDrawCallBack\"></param>\r\n        public IAmADocClass(CKLBUITask parent, int arg, CallBack1 callback1)\r\n            : base(s_classID)\r\n        {\r\n            NativeManagement.resetCppError();\r\n            IntPtr ptr = CppClassName_create(parent != null ? parent.CppObject : IntPtr.Zero);\r\n            NativeManagement.intercepCppError();\r\n            bind(ptr);\r\n            m_callback1 = callback1;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Empty constructor for later binding.\r\n        /// </summary>\r\n        public IAmADocClass() : base(s_classID) { }\r\n        #endregion\r\n\r\n        // The Callback region contains Callbacks delegates definitions\r\n        // and the virtual methods overide which will be called back from C++\r\n        #region CallBacks\r\n\r\n        /// <summary>\r\n        /// Declaration of the CallBack signature\r\n        /// </summary>\r\n        /// <param name=\"caller\">Emulate a this</param>\r\n        public delegate void CallBack1(IAmADocClass caller);\r\n        public delegate void CallBack2(IAmADocClass caller);\r\n\r\n        private CallBack1 m_callback1;  // callback number 0\r\n        private CallBack2 m_callback2;  // callback number 1\r\n\r\n        /// <summary>\r\n        /// This method is used in the bind function.\r\n        /// It sends the virtual callBackFunction pointer to the C++ Engine so that it can callback C#.\r\n        /// The callback index is between 0 and 4.\r\n        /// </summary>\r\n        protected override void doSetupCallbacks()\r\n        {\r\n            // If there is only 1 callback, you can call registerCallBack(IntPtr CppObj, IntPtr functionPtr) whithout uint.\r\n            registerCallBack((NativeManagement.FunctionPointerV)callBackFunction1, 0);\r\n            registerCallBack((NativeManagement.FunctionPointerV)callBackFunction2, 1);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Set anyDelegate to the delegate designed by delegateName\r\n        /// If there is only 1 delegate in the class, set a default value to null and don't do any switch\r\n        /// </summary>\r\n        /// <param name=\"anyDelegate\"></param>\r\n        /// <param name=\"delegateName\"></param>\r\n        public override void setDelegate(Delegate anyDelegate, String delegateName)\r\n        {\r\n            switch(delegateName)\r\n            {\r\n                case \"callback1\":\r\n                    m_callback1 = (CallBack1)anyDelegate;\r\n                    break;\r\n                case \"callback2\":\r\n                    m_callback2 = (CallBack2)anyDelegate;\r\n                    break;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// These methods will be called back from C++\r\n        /// Don't forget to test the nullity of the C# delegate before calling it.\r\n        /// </summary>\r\n        public virtual void callBackFunction1()\r\n        {\r\n            if(m_callback1 != null) {\r\n                m_callback1(this);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n\r\n        public virtual void callBackFunction2()\r\n        {\r\n            if(m_callback2 != null) {\r\n                m_callback2(this);\r\n            } else {\r\n                throw new CKLBException(\"Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null\");\r\n            }\r\n        }\r\n       \r\n        #endregion\r\n    }\r\n}\r\n*/\r\n"
  },
  {
    "path": "CSharpVersion/EnginePrototype.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 11.00\r\n# Visual Studio 2010\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"EnginePrototypeCS\", \"EnginePrototype\\EnginePrototypeCS.csproj\", \"{82172820-045A-4210-88EC-466042522A57}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Debug|x86.ActiveCfg = Debug|x86\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Debug|x86.Build.0 = Debug|x86\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Release|x86.ActiveCfg = Release|x86\r\n\t\t{82172820-045A-4210-88EC-466042522A57}.Release|x86.Build.0 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(MonoDevelopProperties) = preSolution\r\n\t\tStartupItem = EnginePrototype\\EnginePrototypeCS.csproj\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Doc/Android_Build.md",
    "content": "Windows Specific Install\r\n========================\r\n\r\nThe easiest and fastest to build for Android is to use a Linux emulated machine.\r\nUsing a virtual PC will make the task quite easy.\r\n\r\nIf you have already a Linux virtual machine running you can skip this section.\r\n\r\n1. First we will use VirtualBox, Windows version (select the version fitting your OS)\r\n   https://www.virtualbox.org/wiki/Downloads\r\n   \r\n   Start Download VirtualBox.\r\n\r\n2. We will use Ubuntu to do the build, so we download also Ubuntu at the same time.\r\n   \r\n   http://www.ubuntu.com/download\r\n\r\n   Then select Ubuntu Desktop, and download your ISO file (12.04 recommended).\r\n   \r\n   We would advise to install everything in 64 bit version if your machine supports it.\r\n\r\n   \r\n3. Run the VirtualBox installer\r\n   \r\n   WARNING : VirtualBox may temporarly disrupt your network connection during install.\r\n   If you are still downloading, wait all the files are downloaded.\r\n\r\n   *Follow the classic wizard like installation.*\r\n\r\n4. Launch VirtualBox\r\n   - Click on the New button to create a new Virtual Machine.\r\n   \r\n   - Setup Name and type of OS you are installing.\r\n   Type    -> Linux\r\n   Version -> Ubuntu \r\n   Then click 'next'.\r\n\r\n   - Let's create a memory size of 2GB, that should be enough. (\r\n   Then click 'next'.\r\n\r\n   - Create a virtual hard drive as asked.\r\n   Then click 'next'.\r\n\r\n   - Fixed Size hard disk is nicer for performance during build, but dynamic is OK.\r\n   Do as you wish, just make sure you have space to create that disk.\r\n   Then click 'next'.\r\n   \r\n   - Select the location and size of the virtual drive.\r\n   Then click 'next'.\r\n\r\n   Now the virtual PC setup is complete, now we will install Ubuntu on this virtual PC.\r\n\r\n   Select your new virtual machine and click the \"Settings\" button\r\n   Goto to Storage Tab, Add a CD/DVD (click on CD/DVD icon with +)\r\n   Then select the ISO file of Ubuntu we have just downloaded.\r\n\r\n   Make sure the boot order select the CD/DVD drive first (Under System / Motherboard)\r\n   Close the setup and go back to the main window of VirtualBox.\r\n   Select the virtual machine, run the PC.\r\n\r\n   Now the PC will boot and install Ubuntu.\r\n   Make sure the account you will use has the admin rights. (By default, it will work)\r\n   \r\n   You can also check that online tutorial :\r\n   http://www.wikihow.com/Install-Ubuntu-on-VirtualBox\r\n\r\n\r\n1. Tools install\r\n=================\r\n\r\nNDK\r\n---\r\n\r\n### For OSX\r\nhttp://dl.google.com/android/ndk/android-ndk-r9-darwin-x86_64.tar.bz2\r\n\r\n### For Ubuntu (for our virtual machine)\r\n\r\nRun Ubuntu, launch firefox and goto the following URL :\r\nhttp://developer.android.com/tools/sdk/ndk/index.html\r\n\r\nThen download the Linux android x86 NDK\r\n32 bit OR 64 bit based on your Virtual Box and hardware setup\r\n\r\n**32 bit** : http://dl.google.com/android/ndk/android-ndk-r9-linux-x86.tar.bz2\r\n**64 bit** : http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2\r\n\r\nFirefox ask you to use with Archive Manager to handle the archive, please use it.\r\nOnce the download is finished, select extract, the file explorer appears,\r\nselect \"File system\", then home/ and select your folder with your account. (ie home/myUserName)\r\n  \r\nSDK\r\n---\r\n\r\n### For OSX & Windows\r\n\r\nhttp://developer.android.com/sdk/index.html\r\n\r\n### For Windows: \r\n\r\nDownload Android SDK development environment (ADT)\r\nSelect the bundle for your machine.\r\n\r\n- 32 bit OR 64 bit based on your hardware\r\n- 32 bit : http://dl.google.com/android/adt/adt-bundle-windows-x86-20130917.zip\r\n- 64 bit : http://dl.google.com/android/adt/adt-bundle-windows-x86_64-20130917.zip\r\n\r\nIMPORTANT NOTE : package include the date, so if you need to download a higher version, please take care of\r\nmodifiying the path accordingly to the packages you have downloaded.\r\n\r\n### For OSX :\r\n\r\n[Download Android SDK development environment](http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20130917.zip\r\n) (ADT)\r\n\r\n**Put uncompressed files into /Applications/ directory ( /Applications/adt-bundle-mac-x86_64-20130917/ )**.\r\n\r\nFor OSX : launch a terminal\t\r\n\r\n- zsh is ```~/.zshrc```\r\n- bash is ```~/.bashrc```\r\n\r\n* NDK Setup\r\n\r\n```\r\nANDROID_NDK_ROOT=\"/Applications/android-ndk-r9\"\r\nexport ANDROID_NDK_ROOT\r\n```\r\n\r\n* SDK Setup\r\n\r\n```\r\nANDROID_SDK_ROOT=\"/Applications/adt-bundle-mac-x86_64-20130917/sdk\"\r\n```\r\n\r\n* Add to the PATH\r\n\r\n```\r\nPATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/local/bin:${ANDROID_NDK_ROOT}:${ANDROID_SDK_ROOT}/platform-tools\"\r\n```\r\n\r\n### For Ubuntu\r\nRun Ubuntu, search your computer for local ressource, type \"text editor\" and launch it.\r\n\r\n- Go inside '/home/myUserName' with the file explorer, right click, select show hidden files in the popup menu.\r\n- Select ```.bashrc```\r\n- Add the following accordingly to YOUR ACCOUNT NAME :\r\n\r\n```\r\nexport ANDROID_NDK_ROOT=\"/home/myUserName/android-ndk-r9\"\r\n```\r\n\r\nthen\r\n\r\n```\r\nexport PATH=\"$PATH:${ANDROID_NDK_ROOT}\"\r\n```\r\n\r\n- Then save the file.\r\nWe now need to mount the host windows folder owning the playground engine to be visible from Ubuntu.\r\nFrom the virtual machine window :\r\n- Select \"Device\" -> \"Install Guest Additions\"\r\n- It will ask you to run the package, and then ask you your user password because root access right are necessary.\r\n- Press return when finished, shell close.\r\n\r\n    - Select \"Device\" -> \"Shared Folder\"\r\n    - Select the \"Add folder\" icon and give a mount name and select the path on Windows. (ie Playground).\r\n    - Make sure \"Folder Name\" is set to \"Playground\".\r\n    - Then, turn \"Auto-mount\" option on.\r\n\r\n    - Launch terminal :\r\n\r\n    *(replace \"myUserName\" with your actual username on Ubuntu)*\r\n\r\n    ```\r\n    sudo usermod -aG vboxsf myUserName\r\n    ```\r\n\r\n    - Reboot Ubuntu.\r\n\r\n2. Build Engine library (native module)\r\n---------------------------------------\r\n\r\n## For OS X:\r\n\r\nLaunch terminal :\r\n\r\n```\r\n> cd [PATH TO PROJECT BASE]/Engine/porting/Android/GameEngine-android/\r\n> chmod +x ./build.py (note: First time only)\r\n> ./build.py --rebuild --project SampleProject\r\n```\r\n\r\n## For Ubuntu:\r\n\r\nLaunch terminal :\r\n\r\n```\r\n> cd /media/sf_Playground/Engine/porting/Android/GameEngine-android/\r\n> chmod +x ./build.py (note: First time only)\r\n> ./build.py --rebuild --project SampleProject\r\n```\r\n\r\n3. Build package assets\r\n------------------------\r\n(Target assets should be compiled prior to packaging. Please refer Tools document for how)\r\nFor instance, we're packaging \"SimpleItem\" example here.\r\nWe assume you already have Tutorial/ inside Playground root directory, please continue\r\nreading with replacing them if you have things in other location.\r\n\r\n### Move to the samples directory\r\n\r\n### For OS X:\r\nLaunch terminal :\r\n\r\n```\r\n> cd [PATH TO PROJECT BASE]/Tutorial/01.SimpleItem/.publish/android/\r\n> zip -r -0 [PATH TO PROJECT BASE]/Engine/porting/Android/GameEngine-android/assets/AppAssets.zip ./*\r\n> echo -n \"1\" > [PATH TO PROJECT BASE]/Engine/porting/Android/GameEngine-android/assets/version ./*\r\n```\r\n\r\n(note: you need to increment \"1\" by one every new build. i.e. \"2\" next time)\r\n\r\n### For Ubuntu:\r\nLaunch terminal :\r\n\r\n```\r\n> cd /media/sf_Playground/Tutorial/01.SimpleItem/.publish/android/\r\n> zip -r -0 /media/sf_Playground/Engine/porting/Android/GameEngine-android/assets/AppAssets.zip ./*\r\n> echo -n \"1\" > [PATH TO PROJECT BASE]/Engine/porting/Android/GameEngine-android/assets/version ./*\r\n```\r\n\r\n(note: you need to increment \"1\" by one every new build. i.e. \"2\" next time)\r\n\r\n4. Import Engine project into your ADT\r\n--------------------------------------\r\n\r\na. Open ADT\r\n\r\nb. Open File > Import Menu\r\n\r\nc. Choose \"Existing Android Code into Workspace\" and press \"Next\"\r\n\r\nd. Press \"Browse\" button and navigate to \"GameEngine-android\" directory on your filesystem\r\n\r\ne. Press \"OK\" to close directory browser\r\n\r\nf. Make sure a project named \"GameEngine\" is selected and press \"Finish\"\r\n\r\n5. Build Android Package & Run on a device\r\n------------------------------------------\r\na. Connect your Android device\r\n\r\nb. Open ADT\r\n\r\nc. Right click \"GameEngine\" project and navigate to \"Run As > Android Application\"\r\n\r\nd. Choose your device if a dialog is prompted and press \"OK\". Skip this step if no dialog is prompted.\r\n\r\n"
  },
  {
    "path": "Doc/Documentation_CSharp.md",
    "content": "C# Documentation\r\n================\r\n\r\nIntroduction\r\n-------------\r\n\r\nThe C++ Engine interacts with a Scripting Language in order to develop more efficiently.\r\nThe main scripting language used with this Engine is **LUA**, but we also developed a C# framework to script in C#.\r\nTo get more details about the LUA Scripting, please refer to Modules/Scripting.txt\r\n\r\nBe aware that this is an experimental work and that this had not gone past the test phase - ie it had never been in production.\r\n\r\nHere will be explained how the C# framework does work and how to use it.\r\n\r\n### The C# framework\r\ncan be found in ```CSharpVersion/Engine_Prototype/EnginePrototypeCS/```\r\n\r\n### The C++ Compiler\r\ncan be found in ```CSharpVersion/CSharp_CPPCompiler```\r\n\r\n### The C++ Runtime C# \r\ncan be found in ```Engine/libs/RuntimeCSharp/RuntimeLibrary/```\r\n\r\nA How To Use section is available at the end of this document to help you woth installing and running \r\nthe C# framework for our Game Engine.\r\n\r\nCommunication between C++ and C#\r\n---------------------------------\r\n\r\nTo communicate with **LUA**, the only way was to use the LUA stack for every single operation involving C++-LUA communication.\r\nWith C#, it is possible to call exported static C++ methods directly.\r\n\r\nTo call a C++ Engine method from C#, we proceeded as is : \r\n- The method must be Scripting Language independent ; that means no interaction with the LUA stack for example.\r\n- Define the methods in ExportListC_Likefunction.h (in the Engine project).\r\n  Export them in the ExportListC_Likefunction.cpp, file of the Game project\r\n  converting the static call to an instance call through the pointer transmitted as an argument if necessary.\r\n  See Engine/source/Scripting/ExportListC_Likefunction.h and .cpp for more implementation details.\r\n- Import them in the C# Framework\r\n- Define a method in C# wrapping this imported method.\r\n\r\nC# Framework Architecture and How it works\r\n-------------------------------------------\r\n\r\nBasically, each C++ scripting object has a wrapper in C#.\r\nHereafter will be detailed the Framework Core classes \r\n\r\n### GameObject\r\n\r\nTo correctly manage the communication between the two languages, the binding between objects (one in C++, one in C#), \r\nwe developed a C# Framework to provide simple APIs for programmers.\r\n\r\n**GameObject** (FrameworkCore/GameObject.cs) is the most generic class of the C# framework.\r\nAll wrappers inherit this class.\r\n\r\nEach GameObject can be bound to 1 and only 1 C++ object. The two instances are common handle.\r\nThe handle is a unique unsigned int which identifies the C# object.\r\nIt is given and registered in the C++ object when binding, so the C++ object could identify the C# object bound with it.\r\nThe default behavior is to bind directly when instantiating a C# object, but it is also possible to create an empty C# object \r\n(without any C++ object bound) and to bind it later.\r\n\r\nIt is also used to register callbacks in the C++ Engine.\r\nMore details about callbacks from C++ to C# can be found hereafter.\r\n\r\nA GameObject contains a handle, a typeID, a tag and a pointer to a CppObject.\r\n\r\nEach GameObject contains a typeID which is used to verify that the C++ and the C# object are the same type \r\nand to authorize the binding or not.\r\nThe typeID comes from the BaseType.h file (Engine/include/BaseType.h)\r\n\r\nA pointer is also stored in C# pointing directly to the C++ object.\r\nCommunicating it to the C++ makes us able to call methods from this object in C++ directly without having to \r\nfind the object back through his handle.\r\n\r\n### WrapperRegister\r\n\r\nEvery GameObject is registered in the WrapperRegister, a singleton allowing to find a GameObject through its handle.\r\nIn fact, the handle is the index in the array of GameObject of the WrapperRegister.\r\nThe possibility of finding a GameOject through its handle makes the callbacks possible from C++ to C# just knowing\r\nthe handle of the C# object.\r\n\r\n### NativeManagement\r\n\r\nNativeManagement is a static class used to interact with C++.\r\nIt is able to register and unregister C# wrappers for each C++ object.\r\nIt also has a static method to destroy a C# wrapper directly\r\nfrom the C++ Engine.\r\n\r\nThe pointer of this static function must be sent to the C++ Engine \r\nat the beginning of the program.\r\n\r\n### __MarshallingUtils and __FrameworkUtils\r\n\r\nThey are static classes providing utility methods.\r\n\r\n\r\nGame Object Life Cycle\r\n-------------------------\r\n\r\nWhen instantiating a GameObject in C# you an either create an empty one or instantiate it with parameters and create a C++ object\r\nat the same time. Both objects will be bound through the system previously described.\r\nIf an empty C# object had been created, no C++ object had been created with it. You will have to bind it manually with an already \r\ninstantiated C++ object. The typeID must correspond and remember that only one C++ object can be bound with C# one object.\r\n\r\nWhen a C++ or a C# Object dies, the binding has to be destroyed. Indeed it would be very problematic to call methods on a destroyed\r\nC++ object from C# or to try to callback on a C# destroyed object.\r\nA C++ object can either die \"by itself\", meaning that the destruction is asked by the Engine or its destruction can be asked\r\nfrom the C# framework by Disposing the GameObject.\r\nThe destruction is divided in 3 steps : \r\n\r\n#### The C++ destruction is asked (either by the Engine or the C# script)\r\n\r\nIf the destruction is asked by the Engine\r\n\r\n1. The C++ destructors are called.\r\n2. The C++ calls back the C# to destroy the bound C# object\r\n3. Dispose the C# object\r\n\r\nIf the destruction is asked by the C# script, it's actually just an unbinding\r\n1. The C# object is emptied (Disposed)\r\n2. The C++ object will be destroyed by the Engine opportunely.\r\n\r\nCallback System\r\n---------------\r\n\r\nThe Engine is based on running tasks and receive callbacks from the scripting language.\r\nWith LUA the callbacks where static methods called through their names.\r\nWith C#, callbacks are delegates that can be static or linked with an instance of a C# object.\r\n\r\nAs explained before, each C# GameObject bound with a C++ Object has the same handle than the C++ Object,\r\nso the C++ Object is able to find the right C# GameObject it has to call back.\r\n\r\nStatic methods have been designed to call back the right object from C++ to C#.\r\nThe handle and the callback number are regrouped in a unsigned int 32 and passed back to the C# that\r\nis in charge of retrieving the right object and call its right callback.\r\n\r\nThere will not be a detailed technical explanation here, so if needed, refer to the source code \r\nof the following classes : \r\n\r\n- Framework/Core/GameObject.cs\r\n- Framework/Core/NativeManagement.cs\r\n- Engine/source/Scripting/CKLBScriptEnv_forCSharp.cpp\r\n\r\n### Basically, a callback is a X phases process\r\n\r\n1. The C++ object is asked to call back the C#, this method is defined in Engine/source/Scripting/CKLBScriptEnv.h\r\nIt is for instance \r\n\r\n  ```csharp\r\ncall_eventDragIcon(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 dragX, s32 dragY)\r\n```\r\n\r\n2. This call_eventDragIcon(...) method is declared once in CKLBScriptEnv.h and defined for each scripting language.\r\nThe funcName is only used for LUA.\r\n\r\n  ```csharp\r\nvoid CKLBScriptEnv::call_eventDragIcon(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 dragX, s32 dragY)\r\n{\r\n  m_call++;\r\n  u32 objectHandle = obj->getScriptHandle();\r\n  klb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n    callbackUII(objectHandle, type, dragX, dragY);\r\n}\r\n```\r\n\r\n  The object handle is passed back to the C#.\r\nIf the C# object can have more than 1 callback, the callback number is added to the Handle (3 upper bits).\r\n\r\n3. A signature specific static function is then called.\r\nIn this example, it is callbackUII().\r\nThese methods are exported in C++ and imported in C#.\r\n\r\n4. public static void doCallBackUII(uint cbInfos, uint uint_1, int int_1, int int_2)\r\nA C# method of NativeManagement is wrapping the imported static function and redirects the call to the\r\nright object and the right callback.\r\n\r\n5. By default, the callback method is a virtual method calling the object delegate, specific for each object.\r\nThis allows the developer to override the method and define a general behavior or to keep the default behavior.\r\n\r\n\r\nMonoLib\r\n-------\r\n\r\nThe C# version of the Engine uses Mono as an embedded module.\r\nThe callback system is using the MonoLib in order to invoke C# methods from C#.\r\n\r\nMoreover, using the MonoLib to run the C# executable makes us able to debug with MonoSoftDebugger \r\n(in MonoDevelop). MonoSoftDebugger allows to run a C# executable from a C++ one and debug the C# \r\nexecutable (breakpoints, stop, etc.).\r\nYou will find more details on how to process at the end of this document.\r\n\r\nYou will find more details about Embedding Mono here \r\n\r\n- http://www.mono-project.com/Embedding_Mono\r\n\r\nC++ version\r\n-----------\r\n\r\nMono is a great tool to run the executable on PCs and to help during the debugging phase, but for devices (especially\r\niOS, it is a bit problematic having multiple executables).\r\nTo avid those problems, we developed a C# compiler that translates the C# code into C++ code and supporting the basic C# \r\nfunctionalities. Moreover, this results in a lighter and an only one language final executable.\r\n\r\nYou will find more documentation about the Compiler at the bottom of this document.\r\n\r\nA \"Runtime C#\" had been developed to mimic the C# essential classes way of working (such as String, Array, List, Dictionary).\r\nIt provides exactly similar methods to the C# ones. An Object allocator and a Garbage Collector has also been developed.\r\n\r\nFor more details, refer to the source code.\r\n\r\nHow To Run using C# with Mono\r\n-----------------------------\r\n\r\n### How to Install\r\n\r\n[Mono Download Link](http://monodevelop.com/Download)\r\n\r\n- If you are working with Windows, install the .NET Framework 4.0 or upper and GTK#\r\n- If you are using OSX, install Mono + GTK#\r\n\r\n### How to Run MANUALLY\r\n\r\n#### Edit File\r\n\r\nEdit the paths for your development environment in ```CKLBScriptEnv_forCSharp.cpp```\r\n\r\nI recommend to install all the files in something like\r\n\r\n```\r\nD:\\\\KLab\\\\playground\\\\Engine\\\\porting\\\\Win32\\\\Output\\\\Debug_CSharp\r\n```\r\n\r\n*(Engine output directory)*.\r\n\r\n- mono_set_dirs (\"YourOwnPath\\\\libs\\\\lib\",\"../../etc/\");\r\n- const char* frameworkPath = \"YourOwnPath\\\\MyCSharpLibForWindows.dll\";\r\n- const char* bootPath \t\t= \"YourOwnPath\\\\start.dll\";\r\n\r\n#### Compile the different files\r\n\r\n1. Compile the Engine and the Sample Game with the Debug_CSharp debug mode\r\n\r\n  Output : ```/Engine/porting/Win32/Output/Debug_CSharp```\r\n\r\n2. Compile the C# framework\r\n\r\n  Output : ```/VariousPrototyping/Engine_Prototype/EnginePrototypeCS/EnginePrototype/bin/Debug```\r\n\r\n3. Compile your C# program\r\n\r\n  Output : ```/SampleProject/CSharp/bin/Debug```\r\n\r\n4. Run Mono Soft Debugger Listener\r\n\r\n- Required #1\r\n\r\n  Set the following environment variable ```MONODEVELOP_SDB_TEST=1```\r\n\r\n- Required #2\r\n\r\n  Custom Command Mono Soft Debugger must be at the bottom of preferred debuggers.\r\n  It can be changed in ```Tools > Options > Debugger > Preferred Debuggers Run > Run With > Custom Command Mono Soft Debugger > Listen```\r\n\r\n  **Start the debugger listening on port 127.0.0.1:10000**\r\n\r\n\r\n#### Execute the following command line :\r\n\r\n```\r\nD:\\KLab\\playground\\Engine\\porting\\Win32\\Output\\Debug_CSharp\\SampleGame.exe -e \"D:/KLab/playground/Projects/ScriptSample/SimpleItem/.publish/iphone\" -i \"D:/KLab/playground/Projects/ScriptSample/SimpleItem/.publish/iphone\"\r\n```\r\n\r\n### Common Problems\r\n\r\n- MonoDevelop does not display anything in ```Run > Run With``` \r\n\r\n  - If the project is not an Executable MonoDevelop won't provide this Menu\r\n  - Change the project to an executable in the Project Properties or create an empty project\r\n\r\n- The Engine stops with the following error : \r\n\r\n- \"Mono JIT init failed (this is NOT a matter of JIT).\"\r\n- \"C# assembly loading failed.\"\r\n\r\n  - Be sure to have the right path in frameworkPath\r\n\r\n- \"C# boot assembly loading failed.\"\r\n\r\n  - Be sure to have the right path in bootPath\r\n  - Take care of the extension.\r\n\r\n\r\nHow To Run using C# converted to C++\r\n--------------------------------------\r\n\r\n1. Open the C#->C++ Compiler solution \r\n\r\n  ```\r\n(/CSharpVersion/CSharp_CPPCompiler/CompilerProject/CompilerProject.sln)\r\n```\r\n\r\n2. Compile the framework and pass as argument : (Example path where the project was installed)\r\n\r\n  \r\n  ```\r\nC:\\playgroundOSS\\CSharpVersion\\EnginePrototype -oa C:\\playgroundOSS\\SampleProject\\Cpp\\ -compileframework\r\n```\r\n\r\n3. Compile your C# project\r\n\r\n  ```\r\n-framework C:\\playgroundOSS\\CSharpVersion\\EnginePrototype  -user C:\\playgroundOSS\\SampleProject\\CSharp\\Program.cs -oa C:\\playgroundOSS\\SampleProject\\Cpp\\out.cpp\r\n```\r\n\r\n4. Move these files from the output location of the step 2 to \r\n\r\n\r\n  ```\r\n  /Engine/libs/RuntimeCSharp/RuntimeLibrary/inline/\r\n\r\n  ```\r\n\r\n  - __InternalUtilsGetTypeID_specializations.inl\r\n  - classPrototypes.inl\r\n\r\n5. Run your C++ project\r\n\r\n  Open the SampleProject Solution (in Engine/porting/Win32/SampleProject/)\r\n  Select the \"Debug_Cpp\" debug configuration.\r\n  Don't forget to specify the path for the assets. (```-i``` and ```-e``` arguments)\r\n  Run it!\r\n\r\nAbout the compiler and runtime library\r\n---------------------------------------\r\n\r\nThe C++ Runtime C# found in ```Engine/libs/RuntimeCSharp/RuntimeLibrary/``` is completly independant from the game engine and the compiler also.\r\nIt could be moved to a seperate project and be a usefull technology for other projects, directly and cleanly without any dependance on \r\nPlayground game engine.\r\n\r\nCommand line help about the compiler\r\n--------------------------------------\r\n\r\nThe compiler will generate ONE big C++ file containing all the user code translated from C#.\r\nThe generated code will use the C++ runtime library associated with it.\r\n\r\nHere is the help extracted from the compiler command line :\r\n\r\n### Command line options\r\n\r\n```\r\n-o or -or\r\n```\r\n\r\n- Description : Tells the output path (relative). If no output option is used, the result will be displayed in the console.\r\n- Argument : Output path, including the file name\r\n\r\n```\r\n-oa\r\n```\r\n- Description :  Tells the output path (absolute). If no output option is used, the result will be displayed in the console.\r\n- Argument : Full output path, including the file name\r\n\r\n```\r\n-user\r\n```\r\n\r\n- Description : Tells the path to the user project directory. If this option is not used, the first command line argument needs to be this path.\r\n- Argument : Full path to the project directory.\r\n\r\n```\r\n-framework\r\n```\r\n\r\n- Description : When a project which uses the framework is compiled, tells the path to the framework directory.\r\n- Argument : Full path to the framework directory.\r\n\r\n```\r\n-compileframework\r\n```\r\n\r\n- Description : Used to compile the framework only. In this case, -framework is not used and -user is the path to the framework.\r\n- Argument : None.\r\n\r\n```\r\n-ignore\r\n```\r\n\r\n- Description : Rather than parsing the mentioned files only, the compiler will parse all the files\r\nexcept the ones which have been enumerated.\r\n- Argument : None.\r\n\r\n```\r\n-h or -help\r\n```\r\n\r\n- Description : Displays this menu.\r\n- Argument : None.\r\n\r\n### Compilation process\r\n\r\n- Make sure that your C# project compiles in C#.\r\n- Check that it does not contain restricted functionalities.\r\n- Launch the compilation. The basic syntax for the command line is :\r\n\r\n```\r\nCompilerProject.exe <path to the project> [<C# file to parse 1> <C# file to parse 2> <...>] [-o <output file name>]\r\n```\r\n\r\nIf no parsed file is explicited, every C# file of the folder will be recursively parsed.\r\nFor further explanation, see the description of the command line options above.\r\n- Place the inline (.inl) files generated by the compiler into the \"inline\" folder of the \"RuntimeLibrary\" folder.\r\n- If your project uses the game engine framework, you also need to compile it once, as described below.\r\n\r\n### How to compile the framework ###\r\n\r\n- Launch the compiler with the following command line :\r\n\r\n```\r\nCompilerProject.exe <path to the framework folder> -oa <output path> -compileframework\r\n```\r\n\r\n- Include the generated files (framework.h and framework.cpp) in your C++ project.\r\n- Do not forget to compile the framework again if changes are made in C#.\r\n\r\nSee the command line executed for our project in the \"How To Run using C# converted to C++\" upper section.\r\n\r\nTechnical Information about the compiler\r\n-----------------------------------------\r\n\r\nThis compiler is a prototype and is not ready for full production.\r\nSo for now the compiler documentation is very limited, and the source code is quite \"technical\".\r\n\r\nSee technical limitations of the compiler in ```/CSharpVersion/CSharp_CPPCompiler/Compiler_Limitations.txt```\r\n\r\nHere is the technical difficulties that the compiler handle to transform C# to C++ code :\r\n\r\n- Object reference maintenance for garbage collector :\r\n\r\n\r\nCompiler know when assigning an object to an array, a reference member, a static variable, and generate the wrapper call for assigment.\r\n\r\nOur garbage collector(GC) system rely on EXACT maintenance and avoid \"generic\" scanning type of algorithm which are too expensive to our taste.\r\nBecause of expression evaluation order that we have to keep the same as the original C# code, the generated code is more convoluted\r\nthat it would seems at first glance.\r\n\r\n- Support C# delegate by generating template and have the compiler detect where the delegate is used and assigned.\r\nSupport include the \"capture\" of local variable to be able to generate a C++ class playing the role of the delegate.\r\n\r\n- Wrapping all the calls to object, testing for NULL pointer to be able to throw NULL pointer exceptions.\r\n(We do NOT rely on the C++ exception mecanism but do everything ourselves)\r\n\r\n- Analyze dependancies between classes, constants, enum and other symbol declaration because C# allows those definition to be in any order\r\nwhile need the C++ programmer to guarantee those. We do a dependancy analysis and generate the information in order to generate a C++ compliant code.\r\n  \r\n- Parser has still some issue with < and > symbol : conflict between generics and comparison operator making the grammar ambiguous.\r\nIt seems that it is a common problem among many C# parser. What we finally ended up with is to \"preparse\" the source code with a very stupid parser\r\nwhich replace the generic < > symbol with unambiguous symbol.\r\nOf course the trick is not perfect but that should work for all cases we have found until now.\r\n  \r\n- Parser has the classic \"dangling else\" issue, but again that should not be a problem.\r\n\r\n- Generate code using macros to do : try / catch / finally.\r\nBasically the current version of the generated code is quite heavy and not optimal.\r\nWe could, as an example, make a full analysis of the expression tree and decide that if a variable is \"safe\" (not null) we could generate all the code\r\nin the same code path do NOT perform the null check anymore, we would gain in speed and performance.\r\n"
  },
  {
    "path": "Doc/Documentation_Libraries.md",
    "content": "Library Names\r\n=============\r\n\r\nLibraries list\r\n--------------\r\n\r\nHere is the list of the libraries used in this project and the eventual modifications brought.\r\n\r\n|Library Name|Modifications|Comment|\r\n|:-----------|:------------|:-----------|\r\n|FreeType    |Used AS IS, no modification|[*4](#note4)|\r\n|libCurl     |Used AS IS, no modification||\r\n|libogg      |Used AS IS, no modification|Used only for Win32 platform.|\r\n|libvorbis   |Used AS IS, no modification|Used only for Win32 platform.|\r\n|MiniZip     |Few modifications including some #define for a cleaner implementation.||\r\n|mp3Lame     |Used AS IS, no modification|[*2](#note2)|\r\n|MsgPack     |Used AS IS, no modification||\r\n|OpenSSL     |Used AS IS, no modification||\r\n|Sha1        |[Implementation of the following algorithm](http://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode)||\r\n|SQLite      |[*3](#note3)|Was \"hacked\" (too dirty for saying modified) to support encryption.|\r\n|Tremolo     |Used AS IS, no modification|Used only for Android & ARM platform for now.|\r\n|utf8_converter|removed dependency and re-defined errcodes|| \r\n|YAJL        |Modified to support binary JSON and for debug purpose|[*1](#note1)|\r\n|Zlib        |Used AS IS, no modification||\r\n\r\nC# -> CPP Prototype compiler\r\n----------------------------\r\n\r\n- N/A\t(Parser C#)\t\r\n\r\n  Modified, Grammar used for C++/C# parser for C# compiler\r\n\r\n- N/A\t(UTF8 Parser)\r\n\r\n  As is, UTF8 string parser for C# Compiler\r\n\r\n### Notes\r\n\r\n<a name=\"note1\">*1</a>\r\nAdded code to check the first bytes of the stream to decode and decide to switch to other parser\r\nthat perform the same callback to user code as YAJL, as an end result, we can send different stream formats\r\nbut the user parser implementing the callbacks from YAJL will stay the same.\r\n\r\n<a name=\"note2\">*2</a>\r\nUsed for mp3 decoding for Win32 platform, but now we could remove it and avoid annoying MP3 license issues.\r\n\r\n<a name=\"note3\">*3</a>\r\nVersion used : 3.7.11\r\nModified functions : \r\n- hasHotJournal\r\n- sqlite3PagerSharedLock\r\nAdded functions : \r\n- getVFSList\r\n\r\n<a name=\"note4\">*4</a>\r\nYou can find 2 folders libs/freeType and libs/libfreetype2\r\nfreeType is a bit more recent (it is NOT freeType 1).\r\nlibfreetype2 is already compiled for Android.\r\n\r\n# LICENSES\r\n\r\n|Library Name\t\t|License Type          |Version (if known)|Link                     |\r\n|:------------------|:---------------------|:-----------------|:------------------------|\r\n|FreeType           |FTL                   |                  |http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT|\r\n|IPA Gothic Font    |IPA Font License v1.0|3|http://ipafont.ipa.go.jp/ipa_font_license_v1.html [*1](#licenses_note_1)|\r\n|libCurl            |MIT/X derivate licence|7.29.0            |http://curl.haxx.se/docs/copyright.html|\r\n|libogg\t\t\t\t|New BSD License       |                  |http://svn.xiph.org/trunk/ogg/COPYING|\r\n|libvorbis\t\t\t|New BSD License       |                  |http://svn.xiph.org/trunk/vorbis/COPYING|\r\n|MiniZip            |Undefined             |1.1               |http://www.winimage.com/zLibDll/minizip.html|\r\n|mp3Lame            |LGPL                  |1.189.2.1         |http://en.wikipedia.org/wiki/LAME#Patents_and_legal_issues|\r\n|MsgPack            |Apache License, V2    |0.5.7             |https://github.com/msgpack/msgpack-c/blob/master/LICENSE|\r\n|openSSL            |OpenSSL License       |                  |https://www.openssl.org/source/license.html|\r\n|Sha1|See link      |                      |https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License|\r\n|SQLite             |Public Domain         |3.7.11            |http://www.sqlite.org/copyright.html| \r\n|Tremolo            |BSD                   |                  |http://wss.co.uk/pinknoise/tremolo/|\r\n|utf8_converter     |has been described to source code.|      |http://www.opensource.apple.com/source/Heimdal/Heimdal-247.6/lib/wind/utf8.c\r\n|YAJL               |ISC licens:   |                  |http://lloyd.github.io/yajl/|\r\n|Zlib               |Undefined             |                  |http://www.winimage.com/zLibDll/minizip.html|\r\n\r\n### Licenses notes\r\n\r\n<a name=\"licenses_note_1\">*1</a>\r\nalso included a copy in this directory (IPA_Font_License_Agreement_v1.0.txt) under license requirement.\r\n\r\nC# -> CPP Prototype compiler\r\n----------------------------\r\n\r\n### Parser C#\r\n\r\n- http://www.cs.may.ie/~jpower/Research/csharp/Index.html\r\n\r\n### UTF8 Parser\r\n\r\n- http://bjoern.hoehrmann.de/utf-8/decoder/dfa/\r\n"
  },
  {
    "path": "Doc/Documentation_Modules.md",
    "content": "Modules documentation\r\n=====================\r\n\r\nThis file presents the various modules and their roles inside the game engine.\r\n\r\n- Some modules revolves around a singleton that represent the whole system.\r\n- Some modules are simple tasks (See tasks), like networking but reflect complex behavior and whole description is needed.\r\n- Some modules are deeply integrated direct within different implementations in various places but a description was needed.\r\n(Encryption support)\r\n\r\nSo, modules represent concept of different high-level features needed by a game engine.\r\n\r\nList of modules \r\n---------------\r\n\r\n### Allocators\r\n\r\nSee Doc/Modules/Allocators.txt\r\n\r\n### Asset\r\n\r\nManagement system for all loaded assets in the engine at runtime.\r\nSee Doc/Modules/Asset.txt\r\n\r\n### Encryption\r\n\r\nSee Doc/Modules/Encryption.txt\r\n\r\n### File System\r\n\r\nSee Doc/Modules/FileSystem.txt\r\n\r\n### Networking related\r\n\r\nSee Doc/Modules/Network.txt\r\n\r\n### Rendering\r\n\r\nSee Doc/Modules/Rendering.txt\r\n\r\n### SceneGraph\r\n\r\nSee Doc/Modules/Scenegraph.txt\r\n\r\n### Scripting/LUA related\r\n\r\nSee Doc/Modules/Scripting.txt\r\n\r\n### Sound System\r\n\r\nSee Doc/Modules/Audio.txt\r\n\r\n### Tasks\r\n\r\nSee Doc/Modules/Tasks.txt\r\n\r\n### Threading model\r\n\r\nSee Doc/Modules/Thread\r\n"
  },
  {
    "path": "Doc/Documentation_Tasks.md",
    "content": "Tasks\r\n=====\r\n\r\nThis file will introduce the tasks used in the engine.\r\n\r\nThe tasks are the basics object used by scripting.\r\nRefer to the Tasks module documentation for more details about implementation and architecture. (Doc/Modules/Tasks.txt)\r\n\r\nTasks are splitted into System Tasks and User Tasks as follows\r\n--------------------------------------------------------------\r\n\r\n### System Tasks\r\n\r\nSystem tasks are task that the developper do not control fully or control at all.\r\nThings like processing the event queue to detect UI click or perform the rendering, execute the script, are system tasks.\r\n\r\n### User Tasks\r\n\r\n#### User UI Tasks\r\n\r\nThose are visual task (=displayed on screen) that the developper can use freely, decide how and when to use them.\r\n\r\n#### User other Tasks\r\n\r\nThose are task that the develloper can use freely but they are not visual.\r\nThings like using a timer, request the event queue, etc... are user task.\r\n\r\nHere are the C++ classes used in the game engine.\r\n\r\n### Base Abstract Classes \r\n\r\n#### Tasks Root class : CKLBTask\r\n\r\nThe Game Engine is based on a frame-by-frame processing.\r\nEach unit processed each frame is managed by the class CKLBTask.\r\nCKLBTask is the base class for all the tasks of the engine.\r\nBy registering a task in the TaskManager it will be run as a process in the game.\r\n\r\nFor more details regarding the Tasks management, refer to the TaskManager documentation\r\nor the Tasks module documentation (Doc/Modules/Tasks.txt).\r\n\r\n#### CKLBLuaTask : CKLBTask\r\n\r\nCKLBLuaTask is the abstract root class for every task \r\nthat can be created from a script command.\r\nIt defines some virtual methods and some generic callbacks.\r\n\r\nCKLBLuaTask objects can interact with the scripting langage\r\nthrought methods/commands calls depending on the scripting langage.\r\n\r\n#### CKLBLuaPropTask : CKLBLuaTask\r\n\r\nCKLBLuaPropTask is a CKLBLuaTask with properties (int, uint, float, string, bool, pointers).\r\nThese properties can be read and/or written by the scripting part of the game,\r\ndepending on their declaration.\r\nIt is an abstract class for every class in the Engine using properties.\r\n\r\n#### CKLBUITask : CKLBLuaPropTask\r\n\r\nCKLBUITask is the root class for every UI Task Classes in the Engine.\r\nIt defines some properties helpful for every subclasses (such as\r\nalpha, color, scale, rotation, position, visibility).\r\nYou can also attach to a CKLBUITask some spline animations.\r\n\r\nEach UITask is linked with a Node of the SceneGraph to be rendered.\r\nBoth objects point each other.\r\nFor more details, see Doc/Modules/SceneGraph.txt\r\n\r\nThe different CKLBUITask subclasses will be detailled above.\r\n\r\n### System Tasks \r\n\r\nSystem Tasks are tasks created when launching the game and not controlled\r\nby the programmer.\r\nIt regroups the following tasks : \r\n\r\n#### CKLBDebugMenu : CKLBTask\r\n\r\nCKLBDebugMenu allows to create a debug menu task for your game.\r\nSeveral items can be used in the Menu : \r\n\r\n- Switch between 2 values.\r\n- Numbers.\r\n- Select between several values.\r\n\r\n#### CKLBDrawTask  : CKLBTask\r\n\r\nCKLBDrawTask is in charge of drawing the game resources each frame.\r\n\r\n**Actually it has several steps**\r\n\r\n- Perform node spline animation update.\r\n- Perform scene graph update.\r\n- Perform rendering.\r\n\r\nIt is instancied only once and draws all the resources in one and only one draw call.\r\nThis task is instancied when the game starts and dies when it stops.\r\n\r\n#### CKLBLuaScript : CKLBTask\r\n\r\nCKLBLuaScript is used to load and execute some Lua script from an URL.\r\n\r\n#### CKLBOSCtrlEvent : CKLBTask\r\n\r\nCKLBOSCtrlEvent is the class in charge of handling the OS events.\r\nEach frame it allows some events to be visible for the Engine.\r\nThis task is instanciated once when the game starts.\r\n\r\nCKLBTouchEventUITask : CKLBTask\r\nCKLBTouchEventUITask is in charge of handling the various touch events \r\nof the game and redistribute it to the right item. \r\nForms can be registered in order to be able to process some actions \r\non Touch Pad events.\r\nThis task is instanciated once when the game starts.\r\n\r\n#### CKLBTouchPad : CKLBTask \r\n\r\nCKLBTouchPad is similar to CKLBOSCtrlEvent, but only handles Touch Pad events.\r\nIt owns a queue of Touch Pad events.\r\nThis task is instanciated once when the game starts.\r\n\r\n### User Tasks\r\n\r\nUser Tasks are tasks the programmer can instanciate through LUA (or another scripting language).\r\nThey all inherits from CKLBLuaTask previously described.\r\nUser Tasks can be User UI Tasks (all UI related tasks) or User Other Tasks (download, unzip, network, etc).\r\n\r\n### User UI Tasks\r\n\r\n#### CKLBUIActivityIndicator : CKLBUITask\r\n\r\nThis task display an OS native \"busy\" indicator to show that the device is busy doing some work.\r\nAs an example, when application is connecting or transfering data with the server.\r\n\r\n#### CKLBUIButton : CKLBLuaTask\r\n\r\nThis task allow to detect and use click on physical button on a\r\ndevice.\r\n\r\n#### CKLBUICanvas : CKLBUITask\r\n\r\nCKLBUICanvas regroups various images to draw Canvas\r\nThe different assets must be in the same texture.\r\n\r\n#### CKLBUIClip : CKLBUITask\r\n\r\nCKLBUIClip creates a Task clipping the screen for the required area.\r\nSub tasks outside the clipping area will not be drawn.\r\n\r\n#### CKLBUIControl : CKLBLuaTask\r\n\r\nCKLBUIControl is a high level Touch Pad Events handler.\r\nEvents (Tap, Drag, Release) are interpreted into higher level events such as \r\nClick, Double Click, Drag, Long Tap, Pinch).\r\nIt provides a few callbacks that are called when some actions are processed.\r\nEvents can be masked to select only the ones you want.\r\n\r\n#### CKLBUIDebugItem : CKLBUITask\r\n\r\nCKLBUIDebugItem allows to display debug purpose items in the Game.\r\nA few properties (such as text, color, etc.) can be modified in runtime \r\nand used for debugging.\r\n\r\n#### CKLBUIDragIcon : CKLBUITask\r\n\r\nCKLBUIDragIcon allows to create a Task owning an image and answering the Drag Events.\r\nThe image can be scalled and/or moved while draging.\r\nA specific drag area can also be defined to limitate the DragIcon possible received events.\r\n#### CKLBUIForm : CKLBUITask\r\n\r\nCKLBUIForm is designed to manage forms in the Game.\r\nIt allows to manage a whole form (composed of several sub elements) very easily.\r\n\r\n#### CKLBUIFreeVertItem : CKLBUITask\r\n\r\nCKLBUIFreeVertItem can display image like CKLBUISimpleItem.\r\nHowever, it is possible to modify the UV, Colors and coordinate for each vertex.\r\nIt is usefull also to just display a filled area with a given RGBA color, or gradient display \r\nwithout texture at all.\r\n\r\n#### CKLBUIGroup : CKLBUITask\r\n\r\nCKLBUIGroup allows to easily manage UITasks groups.\r\nWith CKLBUIGroup you can anim or skip the anim of a whole group of tasks \r\nat the same time with a single command.\r\n\r\n#### CKLBUILabel : CKLBUITask\r\n\r\nCKLBUILabel is a basic text label task.\r\n\r\n#### CKLBUIList : CKLBUITask\r\n\r\nCKLBUIList allows to create and manage lists of items.\r\nIt comes with its own scrollbar.\r\nItems can be added dynamically and managed easily through the several developped APIs.\r\n\r\n#### CKLBUIMoviePlayer : CKLBUITask\r\nCKLBUIMoviePlayer is used to play movies into the Game.\r\nIt provides a few APIs to manage the movie display and some playing option \r\n(play, stop, pause, resume).\r\nThe task is platform independant as it uses a CKLBMovieNode which\r\nuses itself an implementation of IWidget that is platform specific.\r\n/!\\ CKLBUIMoviePlayer does NOT work on Windows at the moment.\r\n\r\n#### CKLBUIMultiImgItem : CKLBUITask\r\n\r\nCKLBUIMultiImgItem is used to regroup some images into one Task.\r\nOne image only is displayed every frame, but the active image can be changed\r\nat any moment through provided APIs.\r\n\r\n#### CKLBUIPieChart : CKLBUITask\r\n\r\nCKLBUIPieChart allows to create progress bar that are circular.\r\n\r\n#### CKLBUIPolyline : CKLBUITask\r\n\r\nCKLBUIPolyline allows to create Polylines.\r\n\r\n#### CKLBUIProgressBar : CKLBUITask\r\n\r\nCKLBUIProgressBar allows to create dynamic Progress Bars.\r\n\r\n#### CKLBUIRubberBand : CKLBUITask\r\n\r\nCKLBUIRubberBand allows to create dynamic Rubber Bands.\r\n\r\n#### CKLBUIScale9 : CKLBUITask\r\n\r\nCKLBUIScale9 is designed to manage assets cut in 9 parts.\r\n4 for corners, 4 for borders and 1 for the center.\r\nIt uses a CKLBSpriteScale9, refer to CKLBSpriteScale9 documentation for more details\r\n(Doc/Modules/Rendering.txt).\r\n\r\n#### CKLBUIScore : CKLBUITask\r\n\r\nCKLBUIScore is designed for managing Score.\r\nIt handles 10 assets, one for each digit and uses it to display a score.\r\nIt also manages the animation going with the two different scores transitions.\r\n\r\n#### CKLBUIScrollBar : CKLBUITask\r\n\r\nCKLBUIScrollBar allows to create and manage a Scroll Bar.\r\nThe Scroll Bar action into the Game can be defined through a callback.\r\n\r\n#### CKLBUISimpleItem : CKLBUITask\r\n\r\nCKLBUISimpleItem is a simple Image.\r\n\r\n#### CKLBUISWFPlayer : CKLBUITask\r\n\r\nCKLBUISWFPlayer is a Flash Player that can read and display our SWFAssets.\r\n\r\n#### CKLBUITextInput : CKLBUITask\r\n\r\nCKLBUITextInput is a UITask managing text inputs.\r\nIn addition to providing desing and display APIs, it also provides some control ones \r\nsuch as a maximum length control.\r\n\r\n#### CKLBUITouchPad : CKLBLuaTask\r\n\r\nCKLBUITouchPad is a simple low level Touch Pad Events handler.\r\nIt provides a few callbacks that are called when some actions are processed\r\n(Only Tap, Drag and Release).\r\nFor a higher level Touch Pad Events handling, see UIControl.\r\n\r\n#### CKLBUIVariableItem : CKLBUITask\r\n\r\nCKLBUIVariableItem is nearly similar to CKLBUISimpleItem.\r\nHowever, it is possible to modify the UV on the texture \r\nor to change the asset associated to an instance of CKLBUIVariableItem.\r\n\r\n#### CKLBUIVirtualDoc : CKLBUITask\r\n\r\nCKLBUIVirtualDoc creates and allows to manage a Virtual Document.\r\nA Virtual Document allows to manage the rendering of an area of the screen.\r\nSeveral items can be associated to it, such as text, lines or images.\r\n\r\n#### CKLBUIWebArea : CKLBUITask\r\n\r\nCKLBUIWebArea is used to create a web browser instance.\r\n\r\n### User Other Tasks\r\n\r\n#### CKLBNetAPI : CKLBLuaTask\r\n\r\nNetworking task perform network connections and retrieve data from a server.\r\nSee more detail in Modules/Network.txt\r\n\r\n#### CKLBAsyncFilecopy : CKLBLuaPropTask\r\nFile copy may be a long operation to process.\r\nIn order to lighten the process cost for the game, it can be done\r\nby another thread through a CKLBAsyncFilecopy object.\r\n\r\nTo load a resource in an asynchronous way, see CKLBAsyncLoader.\r\n\r\n#### CKLBAsyncLoader : CKLBLuaPropTask\r\n\r\nLoading resources can be a long task for the Game and make it long to load some scenes.\r\nIn order to be able to keep on processing the Game Logic while loading resources, \r\nCKLBAsyncLoader has been implemented.\r\nIt allows the Engine to load resources through another thread.\r\n\r\nTo copy a file in an asynchronous way, see CKLBAsyncLoader.\r\n\r\n#### CKLBDebugSign : CKLBTask\r\n\r\nInternal task created by CKLBDebugMenu for controlling the appearance or disappearance of debug menu.\r\nIt detect a specific sign made by moving the finger on the screen.\r\n\r\n1x          x3\r\n  xx      xx  x\r\n    xx  xx    x\r\n  xx      x\r\n    xx  xx    x\r\n  xx      xx  x\r\n4x          x2\r\n\r\n**Following the 1,2,3,4 order.**\r\n\r\n#### CKLBDebugMenu : CKLBTask\r\n\r\nCKLBDebugMenu allows to create a debug menu task for your game.\r\nSeveral items can be used in the Menu : \r\n\r\n- Switch between 2 values.\r\n- Numbers.\r\n- Select between several values.\r\n\r\nCompile option DEBUG_MENU must be set to be able to use it.\r\n\r\n#### CKLBGenericTask : CKLBLuaPropTask\r\n\r\nCKLBGenericTask is the most generic class of the Engine that can be used\r\nfor scripting purpose.\r\nIt is just made to execute some script code every frame.\r\n\r\n#### CKLBIntervalTimer : CKLBLuaPropTask\r\n\r\nCKLBIntervalTimer is a basic timer class.\r\nIt makes a call to the callback function when the timer reached the defined time limit.\r\nIt can make this call just once and then die or be in a repeat mode and reset itself\r\nevery time it reaches the defined time limit.\r\n\r\n#### CKLBLifeCtrlTask : CKLBLuaTask\r\n\r\nCKLBLifeCtrlTask is a Task made for controlling the life of another Task\r\nof the Engine. \r\nCKLBLifeCtrlTask has 2 mods : TIME and FRAME.\r\nA Task can be linked with an instance of CKLBLifeCtrlTask. In that case, the \r\nCKLBLifeCtrlTask will kill the Task after X milliseconds or frames.\r\n\r\n#### CKLBPauseCtrl : CKLBLuaTask\r\n\r\nCKLBPauseCtrl allows to add control to a class when you pause and/or resume it, \r\nas it is not provided by default in a CKLBTask.\r\nYou can register callbacks that will be called when pausing and resuming the Task.\r\n\r\n#### CKLBStoreService : CKLBLuaTask\r\n\r\nCKLBStoreService is responsible for the different interactions with the Application Store,\r\nas getting the products list or buying items.\r\nThis task is platform independant as it uses IPlatformRequest to process its requests.\r\n\r\n#### CKLBUpdate : CKLBLuaTask\r\n\r\nCKLBUpdate is used to update files.\r\nIt downloads it from a specified URL and unzips it.\r\nSpecific callbacks can be registered to be called after different steps\r\nsuch as the end of the dowload step, the unzipping step or when the whole \r\nprocess is over.\r\n\r\n#### CKLBUpdateZip : CKLBUpdate\r\n\r\nCKLBUpdateZip works the same way as CKLBUpdate but only unzips a file already downloaded.\r\nSee CKLBUpdate for more details.\r\n\r\n"
  },
  {
    "path": "Doc/How_to_run.md",
    "content": "\r\nHow to run\r\n==========\r\n\r\nGetting started\r\n---------------\r\n\r\n### Write your LUA code.\r\n\r\nSample Projects can be found in Tutorial/ directory.\r\nA list of all available APIs can be found in Doc/SysCommandList.xls\r\n\r\n### Create your assets with Toboggan tool and publish your project.\r\n\r\n(Unzip Tool/Toboggan-Tools.zip)\r\nOnce you have unzipped, you can run Toboggan tool from\r\nTools/Toboggan/KLBToolHost.exe\r\n\r\nFor more details about this tool, please refer to\r\nthe documentation (in Japanese only sorry & Word format) :\r\n\r\n```\r\nDoc/Toboggan_Plugin_Manual_(JPN).docx\r\n```\r\n\r\n```\r\nDoc/Toboggan_Operation_Manual_(JPN).docx\r\n```\r\n\r\n### Run it !\r\n\r\nFor more details about how to run the Game on your platform, a dedicated section is in this document,\r\nsee \"How to run\".\r\n\r\nCompile the assets.\r\n-------------------\r\n\r\nWhile you could run right away the game engine, you will need to build \r\nall the assets used by your project with Toboggan tool.\r\n(See getting started at the top of this document)\r\n\r\n### In Toboggan, just \r\n\r\n- Open the project folder with File -> Open\r\n- Project -> Clean\r\n- Project -> Force Republish\r\n\r\n### IMPORTANT NOTE\r\n\r\nNote you can setup Toboggan to point to your OWN exe of the game engine and run it\r\ndirectly from toboggan (See plugin settings in toboggan)\r\n\r\n### IMPORTANT NOTE\r\n\r\nWhen creating your own project, you can include any file you want into the building process.\r\nBy default, as there are no plugins able to do understand your files, you can decide the tool\r\nto pickup your file and copy it into the build.\r\n\r\n### How to do that \r\n\r\n- Suppose we have a file in ```a_folder/myFile.myExt```\r\n- Just add a empty file (0 byte)  : ```a_folder/myFile.myExt.publish```\r\n\r\nBy adding this 0 byte .publish file, it will act as a marker and force the tool chain\r\nto include this file in the build.\r\n\r\nSee tutorial where the font files are actually copied this way.\r\n\r\nHow to run (the game engine once the project asset are build)\r\n-------------------------------------------------------------\r\n\r\nOne of the Game Engine goal is to provide a multi-platform engine for games. Obviously it can be run with Windows (for development),\r\nMacOS, Android and iOS. Here we will explain how to run on these different platforms.\r\n\r\n## Windows\r\n\r\nWith the project is provided a Microsoft Visual Studio solution (2010 and higher).\r\nThe solution file is located at Engine/porting/Win32/GameLibraryWin32.sln\r\nWith the Engine is also provided a Game Project Sample and some Script Samples (See Tutorial folder).\r\n(Files have been tested with Visual 2010 Express for this release)\r\n\r\n### Game Project Sample\r\n\r\n#### Opening the engine solution, you will find 2 projects \r\n\r\n- GameLibraryWin32 which is the Game ENGINE project.\r\n- SampleProject which is the GAME poject.\r\n\r\nYou may want to modify the Game Engine to add Tasks Classes or to modify some Tasks behavior (see Doc/Documentation_Tasks.md\r\nfor more details about Tasks).\r\nYou may want to modify the Game project to add Game Specific classes.\r\n\r\nTo chose the script to run, you have to modify the command line used to launch the game.\r\nIn Visual Studios, modify SampleProject ```Properties > Debugging > Command line arguments```\r\n\r\n### Add at least these arguments to the command line : \r\n\r\n```\r\n-e \"PathToYourRootProjectAsset/.publish/iphone/\"\r\n-i \"PathToYourRootProjectAsset/.publish/iphone/\"\r\n```\r\n\r\nFor instance, to run the \"01.SimpleItem\" sample project, if you have install the game engine under ```C:\\Playground\\```\r\n\r\n```\r\n-e \"C:/Playground/Tutorial/01.SimpleItem/.publish/iphone/\" \r\n-i \"C:/Playground/Tutorial/01.SimpleItem/.publish/iphone/\"\r\n```\r\n\r\n**Note** \r\n\r\n- /iphone if you publish using the iphone profile,\r\n- /android if you use the android profile. \r\n\r\n(See tool publishing options)\r\n\r\n\r\n### IMPORTANT Note\r\n\r\nYou can also setup the Toboggan tool to use your executable.\r\n\r\nStart toboggan : Tool menu -> Setup -> \r\n\r\n1. GameEngine location : \r\n\r\n```\r\n...\\playgroundOSS\\Engine\\porting\\Win32\\Output\\SampleProject.exe\r\n```\r\n\r\n(after you build the .sln file of course)\r\n\r\n#### Command Line Arguments\r\n- ```-w int```\r\n\r\n  Specifies the screen width.\r\n\r\n- ```-h int```\r\n\r\n  Specifies the screen height.\r\n\r\n- ```-i string```\r\n\r\n  Specifies the install path.\r\n\r\n- ```-e string```\r\n\r\n  Specifies the extern path.\r\n\r\n- ```-t int```\r\n\r\n  Defines a constant DeltaT between frames.\r\n\r\n- ```-enc true/1/false/0```\r\n\r\n  Enables/Disables the encryption (see Doc/Modules/Encryption.txt for more details).\r\n\r\n\r\n**WARNING**\r\n\r\nMake sure the -enc options match the build option in the tool ! \r\n(If you rewrote the encryption of course, the default OSS is transparent so it does not apply here)\r\n\r\nOnce the command line had been added to the SampleProject, you just need to run it and the LUA script will be executed.\r\nYou can now start to write your own game !\r\nPlease refer to the \"How to start a LUA Game\" section for more details.\r\n\r\n\t\r\n## MacOS and iOS\r\n\r\nStart the XCode project from \r\n\r\n```\r\nEngine/porting/iOS/Project/SampleProject/SampleProject.xcodeproj\r\n```\r\n\t\r\n### Now you need to bind your compiled folder\r\n\r\n- Open Finder and go to ```PathToYourProjectAsset/.publish/iphone```\r\n- Drag and drop to ```ProjectResources``` folder inside XCode project\r\n- Select the ```Sample Project``` in XCode, file menu -> ```Add File to Sample Project```\r\n- File navigation appears, select the \"PathToYourProjectAsset/.publish/iphone\"\r\n- Pop up appears, DO NOT FORGET to select your target in ```Add To Targets```\r\n- Also you need to select ```Create folder references for any added folders```. DO NOT SELECT ```Create groups for any added folders```. If not, some ```.lua``` files will be lost when there are more than two ```.lua``` files with same filename in different folders\r\n- ```Finish``` button.\r\n\r\nIt will add the compiled ressources to the application.\r\n\r\n**WARNING**\r\n\r\niOS version supports only encrypted data in its version (it is possible to desactivate globally the encryption) but\r\nwhen trying the tutorial or your own data, make sure that you publish them as encrypted.\r\nThe OSS implementation is \"transparent encryption\" so it should make no difference, but just be aware of it.\r\n\r\n#### IMPORTANT NOTE\r\n\r\n- If you run your own project IOS and Android version need a game.db file to run, see Tutorial.txt for description of the issue.\r\n- You need a default font in your entrance (Sample Project)\r\n\r\n### Android \r\n\r\nSee **Android_Build.md**\r\n\r\n## Script Samples\r\n\r\nSeveral script samples have been provided with the project.\r\nBe aware that you need to compile them with the tool first, then embedded the data in the case of Android or iOS.\r\n\r\nHow to run C# module instead of LUA & How to run the C# to CPP compiler\r\n------------------------------------------------------------------------\r\n\r\nPlease refer to **Documentation_CSharp.md**\r\n"
  },
  {
    "path": "Doc/IPA_Font_License_Agreement_v1.0.txt",
    "content": "﻿--------------------------------------------------\nIPA Font License Agreement v1.0 <Japanese/English>\n--------------------------------------------------\n\nIPAフォントライセンスv1.0\n\n許諾者は、この使用許諾（以下「本契約」といいます。）に定める条件の下で、許諾プログラム（1条に定義するところによります。）を提供します。受領者（1条に定義するところによります。）が、許諾プログラムを使用し、複製し、または頒布する行為、その他、本契約に定める権利の利用を行った場合、受領者は本契約に同意したものと見なします。\n\n\n第1条　用語の定義\n\n本契約において、次の各号に掲げる用語は、当該各号に定めるところによります。\n\n1.「デジタル･フォント･プログラム」とは、フォントを含み、レンダリングしまたは表示するために用いられるコンピュータ・プログラムをいいます。\n2.「許諾プログラム」とは、許諾者が本契約の下で許諾するデジタル･フォント･プログラムをいいます。\n3.「派生プログラム」とは、許諾プログラムの一部または全部を、改変し、加除修正等し、入れ替え、その他翻案したデジタル･フォント･プログラムをいい、許諾プログラムの一部もしくは全部から文字情報を取り出し、またはデジタル･ドキュメント･ファイルからエンベッドされたフォントを取り出し、取り出された文字情報をそのまま、または改変をなして新たなデジタル・フォント・プログラムとして製作されたものを含みます。\n4.「デジタル・コンテンツ」とは、デジタル・データ形式によってエンド・ユーザに提供される制作物のことをいい、動画・静止画等の映像コンテンツおよびテレビ番組等の放送コンテンツ、ならびに文字テキスト、画像、図形等を含んで構成された制作物を含みます。\n5.「デジタル・ドキュメント・ファイル」とは、PDFファイルその他、各種ソフトウェア･プログラムによって製作されたデジタル・コンテンツであって、その中にフォントを表示するために許諾プログラムの全部または一部が埋め込まれた（エンベッドされた）ものをいいます。フォントが「エンベッドされた」とは、当該フォントが埋め込まれた特定の「デジタル・ドキュメント・ファイル」においてのみ表示されるために使用されている状態を指し、その特定の「デジタル・ドキュメント・ファイル」以外でフォントを表示するために使用できるデジタル・フォント・プログラムに含まれている場合と区別されます。\n6.「コンピュータ｣とは、本契約においては、サーバを含みます。\n7.「複製その他の利用」とは、複製、譲渡、頒布、貸与、公衆送信、上映、展示、翻案その他の利用をいいます。\n8.「受領者」とは、許諾プログラムを本契約の下で受領した人をいい、受領者から許諾プログラムを受領した人を含みます。\n\n第２条 使用許諾の付与\n\n許諾者は受領者に対し、本契約の条項に従い、すべての国で、許諾プログラムを使用することを許諾します。ただし、許諾プログラムに存在する一切の権利はすべて許諾者が保有しています。本契約は、本契約で明示的に定められている場合を除き、いかなる意味においても、許諾者が保有する許諾プログラムに関する一切の権利および、いかなる商標、商号、もしくはサービス・マークに関する権利をも受領者に移転するものではありません。\n\n1.受領者は本契約に定める条件に従い、許諾プログラムを任意の数のコンピュータにインストールし、当該コンピュータで使用することができます。\n2.受領者はコンピュータにインストールされた許諾プログラムをそのまま、または改変を行ったうえで、印刷物およびデジタル・コンテンツにおいて、文字テキスト表現等として使用することができます。\n3.受領者は前項の定めに従い作成した印刷物およびデジタル・コンテンツにつき、その商用・非商用の別、および放送、通信、各種記録メディアなどの媒体の形式を問わず、複製その他の利用をすることができます。\n4.受領者がデジタル・ドキュメント・ファイルからエンベッドされたフォントを取り出して派生プログラムを作成した場合には、かかる派生プログラムは本契約に定める条件に従う必要があります。\n5.許諾プログラムのエンベッドされたフォントがデジタル・ドキュメント・ファイル内のデジタル・コンテンツをレンダリングするためにのみ使用される場合において、受領者が当該デジタル・ドキュメント・ファイルを複製その他の利用をする場合には、受領者はかかる行為に関しては本契約の下ではいかなる義務をも負いません。\n6.受領者は、3条2項の定めに従い、商用・非商用を問わず、許諾プログラムをそのままの状態で改変することなく複製して第三者への譲渡し、公衆送信し、その他の方法で再配布することができます(以下、「再配布」といいます。)。\n7.受領者は、上記の許諾プログラムについて定められた条件と同様の条件に従って、派生プログラムを作成し、使用し、複製し、再配布することができます。ただし、受領者が派生プログラムを再配布する場合には、3条1項の定めに従うものとします。\n\n第３条　制限\n\n前条により付与された使用許諾は、以下の制限に服します。\n\n1.派生プログラムが前条4項及び7項に基づき再配布される場合には、以下の全ての条件を満たさなければなりません。\n　(1)派生プログラムを再配布する際には、下記もまた、当該派生プログラムと一緒に再配布され、オンラインで提供され、または、郵送費・媒体及び取扱手数料の合計を超えない実費と引き換えに媒体を郵送する方法により提供されなければなりません。\n　　(a)派生プログラムの写し; および\n　　(b)派生プログラムを作成する過程でフォント開発プログラムによって作成された追加のファイルであって派生プログラムをさらに加工するにあたって利用できるファイルが存在すれば、当該ファイル\n　(2)派生プログラムの受領者が、派生プログラムを、このライセンスの下で最初にリリースされた許諾プログラム（以下、「オリジナル・プログラム」といいます。）に置き換えることができる方法を再配布するものとします。かかる方法は、オリジナル・ファイルからの差分ファイルの提供、または、派生プログラムをオリジナル・プログラムに置き換える方法を示す指示の提供などが考えられます。\n　(3)派生プログラムを、本契約書に定められた条件の下でライセンスしなければなりません。\n　(4)派生プログラムのプログラム名、フォント名またはファイル名として、許諾プログラムが用いているのと同一の名称、またはこれを含む名称を使用してはなりません。\n　(5)本項の要件を満たすためにオンラインで提供し、または媒体を郵送する方法で提供されるものは、その提供を希望するいかなる者によっても提供が可能です。\n2.受領者が前条6項に基づき許諾プログラムを再配布する場合には、以下の全ての条件を満たさなければなりません。\n　(1)許諾プログラムの名称を変更してはなりません。\n　(2)許諾プログラムに加工その他の改変を加えてはなりません。\n　(3)本契約の写しを許諾プログラムに添付しなければなりません。\n3.許諾プログラムは、現状有姿で提供されており、許諾プログラムまたは派生プログラムについて、許諾者は一切の明示または黙示の保証（権利の所在、非侵害、商品性、特定目的への適合性を含むがこれに限られません）を行いません。いかなる場合にも、その原因を問わず、契約上の責任か厳格責任か過失その他の不法行為責任かにかかわらず、また事前に通知されたか否かにかかわらず、許諾者は、許諾プログラムまたは派生プログラムのインストール、使用、複製その他の利用または本契約上の権利の行使によって生じた一切の損害（直接・間接・付随的・特別・拡大・懲罰的または結果的損害）（商品またはサービスの代替品の調達、システム障害から生じた損害、現存するデータまたはプログラムの紛失または破損、逸失利益を含むがこれに限られません）について責任を負いません。\n4.許諾プログラムまたは派生プログラムのインストール、使用、複製その他の利用に関して、許諾者は技術的な質問や問い合わせ等に対する対応その他、いかなるユーザ・サポートをも行う義務を負いません。\n\n第４条　契約の終了\n\n1.本契約の有効期間は、受領者が許諾プログラムを受領した時に開始し、受領者が許諾プログラムを何らかの方法で保持する限り続くものとします。\n2.前項の定めにかかわらず、受領者が本契約に定める各条項に違反したときは、本契約は、何らの催告を要することなく、自動的に終了し、当該受領者はそれ以後、許諾プログラムおよび派生プログラムを一切使用しまたは複製その他の利用をすることができないものとします。ただし、かかる契約の終了は、当該違反した受領者から許諾プログラムまたは派生プログラムの配布を受けた受領者の権利に影響を及ぼすものではありません。\n\n第５条　準拠法\n\n1.IPAは、本契約の変更バージョンまたは新しいバージョンを公表することができます。その場合には、受領者は、許諾プログラムまたは派生プログラムの使用、複製その他の利用または再配布にあたり、本契約または変更後の契約のいずれかを選択することができます。その他、上記に記載されていない条項に関しては日本の著作権法および関連法規に従うものとします。\n2.本契約は、日本法に基づき解釈されます。\n\n\n----------\n\nIPA Font License Agreement v1.0\n\nThe Licensor provides the Licensed Program (as defined in Article 1 below) under the terms of this license agreement (“Agreement”).  Any use, reproduction or distribution of the Licensed Program, or any exercise of rights under this Agreement by a Recipient (as defined in Article 1 below) constitutes the Recipient's acceptance of this Agreement. \n\nArticle 1 (Definitions)\n1.“Digital Font Program” shall mean a computer program containing, or used to render or display fonts.\n2.“Licensed Program” shall mean a Digital Font Program licensed by the Licensor under this Agreement.\n3.“Derived Program” shall mean a Digital Font Program created as a result of a modification, addition, deletion, replacement or any other adaptation to or of a part or all of the Licensed Program, and includes a case where a Digital Font Program newly created by retrieving font information from a part or all of the Licensed Program or Embedded Fonts from a Digital Document File with or without modification of the retrieved font information. \n4.“Digital Content” shall mean products provided to end users in the form of digital data, including video content, motion and/or still pictures, TV programs or other broadcasting content and products consisting of character text, pictures, photographic images, graphic symbols and/or the like.\n5.“Digital Document File” shall mean a PDF file or other Digital Content created by various software programs in which a part or all of the Licensed Program becomes embedded or contained in the file for the display of the font (“Embedded Fonts”).  Embedded Fonts are used only in the display of characters in the particular Digital Document File within which they are embedded, and shall be distinguished from those in any Digital Font Program, which may be used for display of characters outside that particular Digital Document File.\n6.“Computer” shall include a server in this Agreement.\n7.“Reproduction and Other Exploitation” shall mean reproduction, transfer, distribution, lease, public transmission, presentation, exhibition, adaptation and any other exploitation.\n8.“Recipient” shall mean anyone who receives the Licensed Program under this Agreement, including one that receives the Licensed Program from a Recipient.\n\nArticle 2 (Grant of License)\nThe Licensor grants to the Recipient a license to use the Licensed Program in any and all countries in accordance with each of the provisions set forth in this Agreement. However, any and all rights underlying in the Licensed Program shall be held by the Licensor. In no sense is this Agreement intended to transfer any right relating to the Licensed Program held by the Licensor except as specifically set forth herein or any right relating to any trademark, trade name, or service mark to the Recipient.\n\n1.The Recipient may install the Licensed Program on any number of Computers and use the same in accordance with the provisions set forth in this Agreement.\n2.The Recipient may use the Licensed Program, with or without modification in printed materials or in Digital Content as an expression of character texts or the like.\n3.The Recipient may conduct Reproduction and Other Exploitation of the printed materials and Digital Content created in accordance with the preceding Paragraph, for commercial or non-commercial purposes and in any form of media including but not limited to broadcasting, communication and various recording media.\n4.If any Recipient extracts Embedded Fonts from a Digital Document File to create a Derived Program, such Derived Program shall be subject to the terms of this agreement.\n5.If any Recipient performs Reproduction or Other Exploitation of a Digital Document File in which Embedded Fonts of the Licensed Program are used only for rendering the Digital Content within such Digital Document File then such Recipient shall have no further obligations under this Agreement in relation to such actions.\n6.The Recipient may reproduce the Licensed Program as is without modification and transfer such copies, publicly transmit or otherwise redistribute the Licensed Program to a third party for commercial or non-commercial purposes (“Redistribute”), in accordance with the provisions set forth in Article 3 Paragraph 2.\n7.The Recipient may create, use, reproduce and/or Redistribute a Derived Program under the terms stated above for the Licensed Program: provided, that the Recipient shall follow the provisions set forth in Article 3 Paragraph 1 when Redistributing the Derived Program. \n\nArticle 3 (Restriction)\nThe license granted in the preceding Article shall be subject to the following restrictions:\n\n1.If a Derived Program is Redistributed pursuant to Paragraph 4 and 7 of the preceding Article, the following conditions must be met :\n　(1)The following must be also Redistributed together with the Derived Program, or be made available online or by means of mailing mechanisms in exchange for a cost which does not exceed the total costs of postage, storage medium and handling fees:\n　　(a)a copy of the Derived Program; and\n　　(b)any additional file created by the font developing program in the course of creating the Derived Program that can be used for further modification of the Derived Program, if any. \n　(2)It is required to also Redistribute means to enable recipients of the Derived Program to replace the Derived Program with the Licensed Program first released under this License (the “Original Program”).  Such means may be to provide a difference file from the Original Program, or instructions setting out a method to replace the Derived Program with the Original Program. \n　(3)The Recipient must license the Derived Program under the terms and conditions of this Agreement.\n　(4)No one may use or include the name of the Licensed Program as a program name, font name or file name of the Derived Program. \n　(5)Any material to be made available online or by means of mailing a medium to satisfy the requirements of this paragraph may be provided, verbatim, by any party wishing to do so.\n2.If the Recipient Redistributes the Licensed Program pursuant to Paragraph 6 of the preceding Article, the Recipient shall meet all of the following conditions:\n　(1)The Recipient may not change the name of the Licensed Program.\n　(2)The Recipient may not alter or otherwise modify the Licensed Program.\n　(3)The Recipient must attach a copy of this Agreement to the Licensed Program.\n3.THIS LICENSED PROGRAM IS PROVIDED BY THE LICENSOR “AS IS” AND ANY EXPRESSED OR IMPLIED WARRANTY AS TO THE LICENSED PROGRAM OR ANY DERIVED PROGRAM, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.  IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXTENDED, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO; PROCUREMENT OF SUBSTITUTED GOODS OR SERVICE; DAMAGES ARISING FROM SYSTEM FAILURE; LOSS OR CORRUPTION OF EXISTING DATA OR PROGRAM; LOST PROFITS), 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 INSTALLATION, USE, THE REPRODUCTION OR OTHER EXPLOITATION OF THE LICENSED PROGRAM OR ANY DERIVED PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n4.The Licensor is under no obligation to respond to any technical questions or inquiries, or provide any other user support in connection with the installation, use or the Reproduction and Other Exploitation of the Licensed Program or Derived Programs thereof.\n\nArticle 4 (Termination of Agreement)\n1.The term of this Agreement shall begin from the time of receipt of the Licensed Program by the Recipient and shall continue as long as the Recipient retains any such Licensed Program in any way.\n2.Notwithstanding the provision set forth in the preceding Paragraph, in the event of the breach of any of the provisions set forth in this Agreement by the Recipient, this Agreement shall automatically terminate without any notice. In the case of such termination, the Recipient may not use or conduct Reproduction and Other Exploitation of the Licensed Program or a Derived Program: provided that such termination shall not affect any rights of any other Recipient receiving the Licensed Program or the Derived Program from such Recipient who breached this Agreement.\n\nArticle 5 (Governing Law)\n1.IPA may publish revised and/or new versions of this License.  In such an event, the Recipient may select either this Agreement or any subsequent version of the Agreement in using, conducting the Reproduction and Other Exploitation of, or Redistributing the Licensed Program or a Derived Program. Other matters not specified above shall be subject to the Copyright Law of Japan and other related laws and regulations of Japan.\n2.This Agreement shall be construed under the laws of Japan.\n\n"
  },
  {
    "path": "Doc/LuaAPI/FAQ.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/FAQ – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h1 id=\"タスク使い方FAQ\">タスク使い方FAQ<a title=\"このセクションへのリンク\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E4%BD%BF%E3%81%84%E6%96%B9FAQ\" class=\"anchor\"> ¶</a></h1>\n<blockquote>\n<p>\nタスクの使い方に関するFAQページです。\n</p>\n</blockquote>\n<ul><li>表現逆引き編\n<ul><li><a class=\"wiki\" href=\"#%E3%83%89%E3%83%A9%E3%83%A0%E3%83%94%E3%83%83%E3%82%AB%E3%83%BC%E3%82%92%E4%BD%9C%E3%82%8A%E3%81%9F%E3%81%84\">ドラムピッカーを作りたい</a>\n</li></ul></li><li>UI_TouchPad/UI_Control編\n<ul><li><a class=\"wiki\" href=\"#UI_TouchPad%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%81%AE%E5%BC%95%E6%95%B0%E3%81%A8%E3%81%97%E3%81%A6%E4%B8%8E%E3%81%88%E3%82%89%E3%82%8C%E3%82%8Btbl%E3%81%AF%E3%81%A9%E3%82%93%E3%81%AA%E3%82%82%E3%81%AE\">UI_TouchPadのコールバックの引数として与えられるtblはどんなもの?</a>\n</li><li><a class=\"wiki\" href=\"#UI_TouchPad%E3%81%A7%E5%8F%96%E5%BE%97%E3%81%97%E3%81%9F%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AEid%E3%81%A3%E3%81%A6%E4%BD%95\">UI_TouchPadで取得したイベントの \"id\" って何?</a>\n</li></ul></li><li>UI_SWFPlayer編\n<ul><li><a class=\"wiki\" href=\"#%E5%86%8D%E7%94%9F%E3%81%97%E3%81%A6%E3%81%84%E3%82%8Bmovie%E5%90%8D%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF\">再生しているmovie名を取得するには?</a>\n</li></ul></li><li>UI_VirtualDoc編\n<ul><li><a class=\"wiki\" href=\"#BADcommandtableformat.%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\">BAD command table format.というassertで落ちた。何が原因?</a>\n</li></ul></li><li>UI_Form/UI_List共通編\n<ul><li><a class=\"wiki\" href=\"#FORM_UIE_SET_ASSET%E3%81%A7Node%E3%81%AE%E7%94%BB%E5%83%8F%E3%81%8C%E5%A4%89%E6%9B%B4%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84\">FORM_UIE_SET_ASSETでNodeの画像が変更できない</a>\n</li><li><a class=\"wiki\" href=\"#%E5%85%83%E3%80%85Composite%E3%81%A7%E6%8C%87%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%81%AE%E3%81%A8%E5%90%8C%E3%81%98Asset%E3%82%92FORM_UIE_SET_ASSET%E3%81%A7%E6%8C%87%E5%AE%9A%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84\">元々Compositeで指定されているのと同じAssetをFORM_UIE_SET_ASSETで指定できない</a>\n</li><li><a class=\"wiki\" href=\"#%E8%A4%87%E6%95%B0%E3%81%AEUI_Form%E3%82%84UI_List%E9%96%93%E3%81%A7%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%9C%E3%82%BF%E3%83%B3%E3%81%8C%E6%93%8D%E4%BD%9C%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E9%96%93%E4%BB%96%E3%81%AE%E3%83%9C%E3%82%BF%E3%83%B3%E3%81%8C%E3%83%9E%E3%83%AB%E3%83%81%E3%82%BF%E3%83%83%E3%83%81%E3%81%A7%E6%93%8D%E4%BD%9C%E3%81%95%E3%82%8C%E3%82%8B%E3%81%AE%E3%82%92%E9%98%B2%E3%81%8E%E3%81%9F%E3%81%84\">複数のUI_FormやUI_List間で、特定のボタンが操作されている間他のボタンがマルチタッチで操作されるのを防ぎたい</a>\n</li><li><a class=\"wiki\" href=\"#UI_Form%E3%81%AE%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%8E%E3%83%BC%E3%83%89%E3%81%AB%E5%AF%BE%E3%81%97%E3%81%A6UI_GENERIC_NODE_RECONNECT%E3%82%92%E4%BD%BF%E3%81%84UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%82%92%E7%B9%8B%E3%81%8E%E3%81%AA%E3%81%8A%E3%81%97%E3%81%9F%E3%81%8C%E7%B9%8B%E3%81%84%E3%81%A0%E3%81%AF%E3%81%9A%E3%81%AE%E3%83%8E%E3%83%BC%E3%83%89%E3%81%8B%E3%82%89UI_FORM_UPDATE_NODE%E3%81%AEFORM_NODE_TASK%E3%81%A7%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%9D%E3%82%A4%E3%83%B3%E3%82%BF%E3%81%8C%E5%8F%96%E5%BE%97%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84%E3%81%AA%E3%81%9C\">UI_Formの特定のノードに対してUI_GENERIC_NODE_RECONNECTを使いUIタスクを繋ぎなおしたが、繋いだはずのノードからUI_FORM_UPDATE_NODEのFORM_NODE_TASKでタスクポインタが取得できない。なぜ?</a>\n</li></ul></li><li>UI_List限定編\n<ul><li><a class=\"wiki\" href=\"#Overlappingclippingrange%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\">\"Overlapping clipping range\"というassertで落ちた。何が原因?</a>\n</li><li><a class=\"wiki\" href=\"#Wrongclippingorderstartend%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\">\"Wrong clipping order (start &gt;= end)\"というassertで落ちた。何が原因?</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%A8%E3%81%97%E3%81%A6UI_List%E8%B5%B7%E5%8B%95%E3%82%92%E4%BC%B4%E3%81%86Composite%E3%82%92%E7%99%BB%E9%8C%B2%E3%81%97%E3%81%9F%E3%81%8Cassertion%E3%81%8C%E5%87%BA%E3%81%A6%E5%8B%95%E3%81%84%E3%81%A6%E3%81%8F%E3%82%8C%E3%81%AA%E3%81%84\">アイテムとしてUI_List起動を伴うCompositeを登録したが、assertionが出て動いてくれない。</a>\n</li><li><a class=\"wiki\" href=\"#%E8%B5%B7%E5%8B%95%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E3%81%AELIST_FLAG_BOTTOM%E3%81%AF%E4%BD%95%E3%81%8C%E5%A4%89%E3%82%8F%E3%82%8B%E3%81%AE\">起動パラメータのLIST_FLAG_BOTTOMは何が変わるの?</a>\n</li><li><a class=\"wiki\" href=\"#LIST_FLAG_BOTTOM%E3%82%92%E6%8C%87%E5%AE%9A%E3%81%97%E3%81%9F%E3%82%89%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%8C%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%AA%E3%81%8F%E3%81%AA%E3%81%A3%E3%81%9F%E3%81%AA%E3%81%9C\">LIST_FLAG_BOTTOMを指定したらアイテムが表示されなくなった。なぜ?</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E4%B8%8A%E3%83%89%E3%83%A9%E3%83%83%E3%82%B0%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%82%92%E6%9B%B8%E3%81%8F%E3%81%AE%E3%81%8C%E3%82%81%E3%82%93%E3%81%A9%E3%81%8F%E3%81%95%E3%81%84\">リスト上ドラッグのためのコールバックを書くのがめんどくさい</a>\n</li><li><a class=\"wiki\" href=\"#UI_List%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%82%92%E3%81%A4%E3%81%91%E3%81%9F%E3%81%84\">UI_Listにスクロールバーをつけたい</a>\n</li><li><a class=\"wiki\" href=\"#ImagesourceforScrollbardoesnothaveattributesforscrollbardesign%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\">\"Image source for Scroll bar does not have attributes for scroll bar design\"というassertで落ちた。何が原因?</a>\n</li><li><a class=\"wiki\" href=\"#UI_List%E3%81%A7%E7%89%B9%E5%AE%9A%E3%81%AE%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%8C%E4%B8%AD%E5%A4%AE%E3%81%AB%E3%81%8F%E3%82%8B%E3%82%88%E3%81%86%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\">UI_List で特定のアイテムが中央にくるようにスクロールさせたい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E4%B8%AD%E3%81%AB%E3%81%82%E3%82%8B%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%AE%E5%8D%A0%E6%9C%89%E5%B9%85%E3%82%92%E5%80%8B%E5%88%A5%E3%81%AB%E5%A4%89%E6%9B%B4%E3%81%97%E3%81%9F%E3%81%84\">リスト中にあるアイテムの占有幅を個別に変更したい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E3%81%AE%E7%AB%AF%E3%81%A7%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%8C%E6%AD%A2%E3%81%BE%E3%81%A3%E3%81%A6%E3%81%97%E3%81%BE%E3%81%86%E3%81%8C%E6%AD%A2%E3%82%81%E3%81%9A%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\">リストの端でスクロールが止まってしまうが、止めずにスクロールさせたい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E3%81%AE%E4%B8%A1%E7%AB%AF%E3%81%A7%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%AF%E6%AD%A2%E3%82%81%E3%81%9F%E3%81%84%E3%81%8C%E4%B8%A1%E7%AB%AF%E3%81%AB%E4%BD%99%E7%99%BD%E3%81%8C%E3%81%BB%E3%81%97%E3%81%84\">リストの両端でスクロールは止めたいが、両端に余白がほしい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E6%9C%AB%E5%B0%BE%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84%E3%81%8C%E3%81%A9%E3%81%93%E3%81%BE%E3%81%A7%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%8B%E5%8F%96%E5%BE%97%E3%81%A7%E3%81%8D%E3%82%8B%E3%81%8B\">リスト末尾にスクロールさせたいが、どこまでスクロールさせればよいか取得できるか?</a>\n</li><li><a class=\"wiki\" href=\"#%E7%8F%BE%E5%9C%A8%E3%81%AE%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E4%BD%8D%E7%BD%AE%E3%81%8C%E7%9F%A5%E3%82%8A%E3%81%9F%E3%81%84\">現在のスクロール位置が知りたい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E4%BD%8D%E7%BD%AE%E3%81%AE%E5%80%A4%E3%81%AF%E3%81%A9%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E5%8D%98%E4%BD%8D%E3%81%A7%E6%89%B1%E3%82%8F%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B\">スクロール位置の値はどのような単位で扱われている?</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%81%AB%E8%BF%94%E3%81%95%E3%82%8C%E3%82%8B%E4%BD%8D%E7%BD%AE%E6%83%85%E5%A0%B1%E3%81%AE%E5%8D%98%E4%BD%8D%E3%81%AF\">スクロールバーのコールバックに返される位置情報の単位は?</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E6%99%82%E3%81%AB%E3%83%87%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88%E3%81%AE%E3%83%8C%E3%83%A1%E3%81%A3%E3%81%A8%E3%81%97%E3%81%9F%E5%8B%95%E3%81%8D%E3%81%A7%E3%81%AF%E3%81%AA%E3%81%8F%E3%81%8D%E3%81%B3%E3%81%8D%E3%81%B3%E5%8B%95%E4%BD%9C%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\">スクロール時にデフォルトのヌメっとした動きではなくきびきび動作させたい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%9E%E3%83%8D%E3%83%BC%E3%82%B8%E3%83%A3default%E3%81%AB%E6%8C%87%E5%AE%9A%E3%81%A7%E3%81%8D%E3%82%8B%E5%80%A4delay%E3%81%AE%E6%84%8F%E5%91%B3%E3%81%8C%E7%9F%A5%E3%82%8A%E3%81%9F%E3%81%84\">スクロールマネージャ \"default\" に指定できる値&lt;delay&gt;の意味が知りたい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%AE%E5%81%9C%E6%AD%A2%E4%BD%8D%E7%BD%AE%E3%82%92%E4%B8%80%E5%AE%9A%E3%83%94%E3%82%AF%E3%82%BB%E3%83%AB%E3%81%8A%E3%81%8D%E3%81%AB%E3%81%97%E3%81%A6%E3%83%9A%E3%83%BC%E3%82%B8%E5%8D%98%E4%BD%8D%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%8C%E3%81%97%E3%81%9F%E3%81%84\">スクロールの停止位置を一定ピクセルおきにして「ページ単位スクロール」がしたい</a>\n</li><li><a class=\"wiki\" href=\"#%E7%8F%BE%E5%9C%A8%E3%81%AE%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E4%BD%8D%E7%BD%AE%E6%8C%87%E6%A8%99%E3%81%A8%E3%81%97%E3%81%A6%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%81%AF%E8%A1%A8%E7%A4%BA%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84%E3%81%8C%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%82%92%E6%93%8D%E4%BD%9C%E3%81%95%E3%81%9B%E3%81%9F%E3%81%8F%E3%81%AF%E3%81%AA%E3%81%84%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84\">現在のスクロール位置指標としてスクロールバーは表示させたいが、スクロールバーを操作させたくはない。どうすればいい？</a>\n</li></ul></li><li>汎用タスク編\n<ul><li><a class=\"wiki\" href=\"#%E4%B8%80%E5%AE%9A%E6%99%82%E9%96%93%E5%BE%8C%E3%81%AB%E3%82%BF%E3%82%B9%E3%82%AF%E3%82%92%E6%AE%BA%E3%81%97%E3%81%9F%E3%81%84\">一定時間後にタスクを殺したい</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B2%E3%83%BC%E3%83%A0%E3%82%A2%E3%83%97%E3%83%AA%E3%81%8C%E7%AB%AF%E6%9C%AB%E3%81%AB%E3%82%88%E3%81%A3%E3%81%A6ForegroundBackground%E5%8C%96%E3%81%95%E3%82%8C%E3%81%9F%E3%81%A8%E3%81%8D%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E5%87%A6%E7%90%86%E3%82%92%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\">ゲームアプリが端末によってForeground/Background化されたときにスクリプト処理をさせたい</a>\n</li></ul></li></ul><hr>\n<h2 id=\"表現逆引き編\">表現逆引き編<a title=\"このセクションへのリンク\" href=\"#%E8%A1%A8%E7%8F%BE%E9%80%86%E5%BC%95%E3%81%8D%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"ドラムピッカーを作りたい\">ドラムピッカーを作りたい<a title=\"このセクションへのリンク\" href=\"#%E3%83%89%E3%83%A9%E3%83%A0%E3%83%94%E3%83%83%E3%82%AB%E3%83%BC%E3%82%92%E4%BD%9C%E3%82%8A%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\n以下のように UI_List を起動/設定することで、ドラムピッカー的な動作をさせることができます。\n</p>\n<ul><li>verticalモードを指定(起動引数)\n</li><li>クリッピング領域サイズをアイテム一つ分と同じ面積で指定(起動引数)\n</li><li>ループモードを指定(sysCommand: UI_LIST_SET_LOOPMODE)\n</li><li>スクロールマネージャとして \"page\" を指定し、ページサイズをアイテム一つと同じにする(sysCommand: UI_LIST_SELECT_SCRMGR)\n</li><li>デフォルトスクロールを有効にする(property: .default_scroll)\n</li></ul><pre class=\"wiki\">   local itemSize = {\n      width = 100,\n      height = 32\n   }\n   pDrumPick = UI_List( ... ) -- 起動引数でサイズと動作モードを適切に指定\n   sysCommand(pDrumPick, UI_LIST_SET_LOOPMODE, true)\n   sysCommand(pDrumPick, UI_LIST_SELECT_SCRMGR, \"page\", itemSize.height)\n   prop = TASK_getProperty(pDrumPick)\n   prop.default_scroll = true\n   TASK_setProperty(pDrumPick, prop)\n</pre><hr>\n<h2 id=\"UI_TouchPadUI_Control編\">UI_TouchPad/UI_Control編<a title=\"このセクションへのリンク\" href=\"#UI_TouchPadUI_Control%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"UI_TouchPadのコールバックの引数として与えられるtblはどんなもの\">UI_TouchPadのコールバックの引数として与えられるtblはどんなもの?<a title=\"このセクションへのリンク\" href=\"#UI_TouchPad%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%81%AE%E5%BC%95%E6%95%B0%E3%81%A8%E3%81%97%E3%81%A6%E4%B8%8E%E3%81%88%E3%82%89%E3%82%8C%E3%82%8Btbl%E3%81%AF%E3%81%A9%E3%82%93%E3%81%AA%E3%82%82%E3%81%AE\" class=\"anchor\"> ¶</a></h3>\n<p>\n「直前のフレーム内に検出されたタッチパネルイベントの一覧を、時系列順にindexを与え格納した配列(Luaテーブル)」です。\nindex順に処理する限り、時系列順にイベントを取り出すことができます。\n</p>\n<p>\n引数となるテーブルの各要素はさらにテーブルになっていて、以下のキーで値を取り出すことができます。\n</p>\n<ul><li>type : 操作のタイプ(PAD_ITEM_TAP / PAD_ITEM_DRAG / PAD_ITEM_RELEASE)\n</li><li>id : 操作ポイントID\n</li><li>x : X座標\n</li><li>y : Y座標\n</li></ul><hr>\n<h3 id=\"UI_TouchPadで取得したイベントのidって何\">UI_TouchPadで取得したイベントの \"id\" って何?<a title=\"このセクションへのリンク\" href=\"#UI_TouchPad%E3%81%A7%E5%8F%96%E5%BE%97%E3%81%97%E3%81%9F%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AEid%E3%81%A3%E3%81%A6%E4%BD%95\" class=\"anchor\"> ¶</a></h3>\n<p>\nマルチタッチの操作ポイントを区別するためのIDです。同時に複数の指が触れている場合、それぞれの指に異なるIDが割り当てられ、ある指に関する操作は、その指で触れて(TAP)から離す(RELEASE)までの間(DRAG)、すべて同じIDで通知されます。\n</p>\n<p>\nUI_TouchPadを使用してタッチパネルイベントを取得する場合は、必ずIDを見てそれぞれの指を区別するように実装してください。\n特に Win32 環境ではマウスポインタ以外によるポインティングが成されず id が常に 0 となるため、異なるidのイベントを混同することによる問題に気づきにくいので注意が必要です。\n</p>\n<hr>\n<h2 id=\"UI_SWFPlayer編\">UI_SWFPlayer編<a title=\"このセクションへのリンク\" href=\"#UI_SWFPlayer%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"再生しているmovie名を取得するには\">再生しているmovie名を取得するには?<a title=\"このセクションへのリンク\" href=\"#%E5%86%8D%E7%94%9F%E3%81%97%E3%81%A6%E3%81%84%E3%82%8Bmovie%E5%90%8D%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF\" class=\"anchor\"> ¶</a></h3>\n<p>\nプロパティの .mvname メンバを参照することで、起動時に指定された再生movie名を取得できます。\n</p>\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   prop = TASK_getProperty(pSWF)\n\n   -- movie名を取得\n   local movie_name = prop.mvname\n</pre><hr>\n<h2 id=\"UI_VirtualDoc編\">UI_VirtualDoc編<a title=\"このセクションへのリンク\" href=\"#UI_VirtualDoc%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"BADcommandtableformat.というassertで落ちた何が原因\">BAD command table format.というassertで落ちた。何が原因?<a title=\"このセクションへのリンク\" href=\"#BADcommandtableformat.%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\" class=\"anchor\"> ¶</a></h3>\n<p>\nsysCommandのUI_VDOC_DRAWに与える描画コマンドテーブルのフォーマットが誤っています。\n必ず「テーブルのテーブル」でなければならない点に注意してください。発行するコマンドが一つしかなくても同じです。\n</p>\n<hr>\n<h2 id=\"UI_FormUI_List共通編\">UI_Form/UI_List共通編<a title=\"このセクションへのリンク\" href=\"#UI_FormUI_List%E5%85%B1%E9%80%9A%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"FORM_UIE_SET_ASSETでNodeの画像が変更できない\">FORM_UIE_SET_ASSETでNodeの画像が変更できない<a title=\"このセクションへのリンク\" href=\"#FORM_UIE_SET_ASSET%E3%81%A7Node%E3%81%AE%E7%94%BB%E5%83%8F%E3%81%8C%E5%A4%89%E6%9B%B4%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nFORM_UIE_* というコマンドは CKLBUIElement クラス以上に対するコマンドです。\n通常のノードはもっとも基本的な CKLBNode クラスとして作られているため、FORM_UIE_SET_ASSET サブコマンドを適用することはできません。\n</p>\n<p>\nCKLBUIElementクラスを使用するもっとも基本的なComposite中のアイテムはボタンです。対象のNodeをボタンとして生成することで FORM_UI_SET_ASSET サブコマンドを使用することができます。\n</p>\n<hr>\n<h3 id=\"元々Compositeで指定されているのと同じAssetをFORM_UIE_SET_ASSETで指定できない\">元々Compositeで指定されているのと同じAssetをFORM_UIE_SET_ASSETで指定できない<a title=\"このセクションへのリンク\" href=\"#%E5%85%83%E3%80%85Composite%E3%81%A7%E6%8C%87%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%81%AE%E3%81%A8%E5%90%8C%E3%81%98Asset%E3%82%92FORM_UIE_SET_ASSET%E3%81%A7%E6%8C%87%E5%AE%9A%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\n本来、CompositeはAssetの差し替えを想定していない実装になっていますが、\n現時点においては数多くの需要からAdHookな実装としてFORM_UIE_SET_ASSETが実現されています。\n</p>\n<p>\nこのため、おおもとのCompositeに設定されているものと同じAssetを指定した際、\n正しくAssetが設定されないという副作用が確認されています。\nFORM_UIE_SET_ASSETによる変更を必要とするNodeについては、変更後に使われる可能性のあるAssetをComposite中では指定しないことで問題を回避してください。\n</p>\n<hr>\n<h3 id=\"複数のUI_FormやUI_List間で特定のボタンが操作されている間他のボタンがマルチタッチで操作されるのを防ぎたい\">複数のUI_FormやUI_List間で、特定のボタンが操作されている間他のボタンがマルチタッチで操作されるのを防ぎたい<a title=\"このセクションへのリンク\" href=\"#%E8%A4%87%E6%95%B0%E3%81%AEUI_Form%E3%82%84UI_List%E9%96%93%E3%81%A7%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%9C%E3%82%BF%E3%83%B3%E3%81%8C%E6%93%8D%E4%BD%9C%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E9%96%93%E4%BB%96%E3%81%AE%E3%83%9C%E3%82%BF%E3%83%B3%E3%81%8C%E3%83%9E%E3%83%AB%E3%83%81%E3%82%BF%E3%83%83%E3%83%81%E3%81%A7%E6%93%8D%E4%BD%9C%E3%81%95%E3%82%8C%E3%82%8B%E3%81%AE%E3%82%92%E9%98%B2%E3%81%8E%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\n同時に操作されては困る複数の UI_Form や UI_List は「グループ化」することで、同一のグループに所属するものとの間で排他制御されるようになります。\n</p>\n<p>\nUI_FORM_SET_GROUP(UI_LIST_SET_GROUP)で、フォームやリストを所属させるグループの名称を指定してください。\n</p>\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   pList = UI_List(...)\n\n   sysCommand(pForm, UI_FORM_SET_GROUP, \"exclusiveGroup\")\n   sysCommand(pList, UI_LIST_SET_GROUP, \"exclusiveGroup\")\n</pre><p>\n上記の例では、フォームとリストを一つずつ生成し、それぞれを同じ \"exclusiveGroup\" という名称のグループに所属させています。\npFormが操作中はpListの操作が禁止され、pListの操作中はpFormの操作が禁止されます。\n</p>\n<hr>\n<h3 id=\"UI_Formの特定のノードに対してUI_GENERIC_NODE_RECONNECTを使いUIタスクを繋ぎなおしたが繋いだはずのノードからUI_FORM_UPDATE_NODEのFORM_NODE_TASKでタスクポインタが取得できないなぜ\">UI_Formの特定のノードに対してUI_GENERIC_NODE_RECONNECTを使いUIタスクを繋ぎなおしたが、繋いだはずのノードからUI_FORM_UPDATE_NODEのFORM_NODE_TASKでタスクポインタが取得できない。なぜ?<a title=\"このセクションへのリンク\" href=\"#UI_Form%E3%81%AE%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%8E%E3%83%BC%E3%83%89%E3%81%AB%E5%AF%BE%E3%81%97%E3%81%A6UI_GENERIC_NODE_RECONNECT%E3%82%92%E4%BD%BF%E3%81%84UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%82%92%E7%B9%8B%E3%81%8E%E3%81%AA%E3%81%8A%E3%81%97%E3%81%9F%E3%81%8C%E7%B9%8B%E3%81%84%E3%81%A0%E3%81%AF%E3%81%9A%E3%81%AE%E3%83%8E%E3%83%BC%E3%83%89%E3%81%8B%E3%82%89UI_FORM_UPDATE_NODE%E3%81%AEFORM_NODE_TASK%E3%81%A7%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%9D%E3%82%A4%E3%83%B3%E3%82%BF%E3%81%8C%E5%8F%96%E5%BE%97%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84%E3%81%AA%E3%81%9C\" class=\"anchor\"> ¶</a></h3>\n<p>\nそれは、UI_GENERIC_NODE_RECONNECTは<strong>指定されたノードの下にUIタスクのRootノードを繋ぐ</strong>コマンドであり、\nFORM_NODE_TASKは指定された名前の<strong>ノードが持つタスクのポインタを返す</strong>コマンドだからです。\n<strong>「指定した名前のノードにタスクのポインタを与えるコマンド」ではありません</strong>。\n</p>\n<p>\nたとえば、\"connection_point\"という名前のノードの下に、UIタスクを繋ぎたいと思って、下記のような処理を行ったとします。\n</p>\n<pre class=\"wiki\">   pForm = UI_Form( ... )\n   pTask = UI_* (pForm, ... )\n   sysCommand(pTask, UI_GENERIC_NODE_RECONNECT, \"connection_point\")\n\n   pUI = sysCommand(pForm, UI_FORM_UPDATE_NODE, \"connection_point\", FORM_NODE_TASK)\n\n</pre><p>\nこのとき、pUIの値はnilにしかなりません。\nUI_GENERIC_NODE_RECONNECTによる接続後、 \"connection_point\" 以下のSceneGraphはこうなっています。\n</p>\n<pre class=\"wiki\">   \"connection_point\" (タスクポインタ == NULL)\n       |\n       +- pTaskのRootノード (タスクポインタ == pTask)\n</pre><p>\nこのため、UI_FORM_UPDATE_NODE::FORM_NODE_TASK のターゲットとして \"connection_point\" を指定しても、そのノードが持っているタスクポインタはNULLなので、nilしか返されません。\n</p>\n<p>\n取得ターゲットとしては、その下にぶら下がっている「pTaskのRootノード」を与える必要がありますが、このノードは名前を持っていないため、このままではUI_FORM_UPDATE_NODEのターゲットとして指定できません。\n</p>\n<p>\nしかし、下記のようにすることで目的を果たすことができます。\n</p>\n<pre class=\"wiki\">   pForm = UI_Form( ... )\n   pTask = UI_* (pForm, ... )\n   sysCommand(pTask, UI_GENERIC_SET_NAME, \"task_search_name\")        -- 追加\n   sysCommand(pTask, UI_GENERIC_NODE_RECONNECT, \"connection_point\")\n\n   pUI = sysCommand(pForm, UI_FORM_UPDATE_NODE, \"task_search_name\", FORM_NODE_TASK) -- 変更\n</pre><p>\nUI_GENERIC_SET_NAME は、UIタスクの持つRootノードに検索で使える名前を与えるためのコマンドです。\nこれにより名前のなかった「pTaskのRootノード」に名前を与えることができ、UI_GENERIC_NODE_RECONNECTにより\npFormの持つSceneGraph以下にもつながるため、pFormのUI_FORM_UPDATE_NODEのターゲットとしてその名前を使用できるようになります。\n</p>\n<hr>\n<h2 id=\"UI_List編\">UI_List編<a title=\"このセクションへのリンク\" href=\"#UI_List%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"Overlappingclippingrangeというassertで落ちた何が原因\">\"Overlapping clipping range\"というassertで落ちた。何が原因?<a title=\"このセクションへのリンク\" href=\"#Overlappingclippingrange%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_Listの起動時に指定した &lt;base priority&gt; から &lt;max order&gt; の範囲が、他の UI_List で指定されている範囲と重なっているのが原因です。\n同時に起動している他のUI_Listで指定されているプライオリティ範囲と重複する値を指定することはできません。たとえば以下のような場合です。\n</p>\n<pre class=\"wiki\">   pList1 = UI_List(nil, 100, 200, ...)\n   pList2 = UI_List(nil, 180, 300, ...)\n</pre><p>\n上記の例ではpList1に指定された範囲とpList2に指定された範囲が、180～200の範囲で重なっています。\n描画系のクリッピングシステムは描画プライオリティの範囲に対しクリッピングをかけるため、\n異なるクリッピング領域の有効プライオリティ範囲が重なる指定はできません。\n</p>\n<hr>\n<h3 id=\"Wrongclippingorderstartendというassertで落ちた何が原因\">\"Wrong clipping order (start &gt;= end)\"というassertで落ちた。何が原因?<a title=\"このセクションへのリンク\" href=\"#Wrongclippingorderstartend%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_Listの起動時に指定した &lt;base priority&gt; より &lt;max order&gt; の値が小さいです。\n&lt;max order&gt;は必ず&lt;base priority&gt;より大きな値でなければなりません。\n</p>\n<hr>\n<h3 id=\"アイテムとしてUI_List起動を伴うCompositeを登録したがassertionが出て動いてくれない\">アイテムとしてUI_List起動を伴うCompositeを登録したが、assertionが出て動いてくれない。<a title=\"このセクションへのリンク\" href=\"#%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%A8%E3%81%97%E3%81%A6UI_List%E8%B5%B7%E5%8B%95%E3%82%92%E4%BC%B4%E3%81%86Composite%E3%82%92%E7%99%BB%E9%8C%B2%E3%81%97%E3%81%9F%E3%81%8Cassertion%E3%81%8C%E5%87%BA%E3%81%A6%E5%8B%95%E3%81%84%E3%81%A6%E3%81%8F%E3%82%8C%E3%81%AA%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\n描画系の仕様上、UI_Listのアイテムとして、<strong>UI_Listの起動を伴うCompositeの登録はできません</strong>。\n</p>\n<p>\nこれは、UI_Listが利用している描画系のクリッピング機能に下記の制約があるためです。\n</p>\n<ul><li>クリッピング領域をクリッピングすることはできない\n</li><li>対象プライオリティ範囲が重複するクリッピング範囲を作ることはできない\n</li></ul><p>\nリストアイテムのCompositeはUI_Listの指定したクリッピングの対象となるのが前提であり、\nアイテムにUI_Listを含めるということは、アイテムのUI_Listのクリッピング範囲を\n親となるUI_Listのクリッピング範囲でクリッピングするということですが、描画系の制約上これはできません。\n</p>\n<p>\nまた、同時に表示されるUI_Listはそれぞれクリッピング対象となるプライオリティ範囲が重複してはいけませんが、\n親となる UI_List とアイテムの UI_Listだけでなく、アイテムのUI_List同士でも重複してはいけません。\n</p>\n<p>\nこの場合唯一の方法は「デザインの側を変更してもらう」ことです。\n</p>\n<hr>\n<h3 id=\"リスト上ドラッグのためのコールバックを書くのがめんどくさい\">リスト上ドラッグのためのコールバックを書くのがめんどくさい<a title=\"このセクションへのリンク\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E4%B8%8A%E3%83%89%E3%83%A9%E3%83%83%E3%82%B0%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%82%92%E6%9B%B8%E3%81%8F%E3%81%AE%E3%81%8C%E3%82%81%E3%82%93%E3%81%A9%E3%81%8F%E3%81%95%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_List起動時のコールバック名&lt;drag callback&gt;として nil 値を指定した上で、プロパティ .default_scroll を true にしてください。\nデフォルトのドラッグスクロール機能が有効になります。\n</p>\n<pre class=\"wiki\">   pList = UI_List(nil,\n                   3000,     -- base priority\n                   3200,     -- max priority\n                   100, 100, -- position\n                   300, 400, -- size\n                   90,       -- default step\n                   true,     -- vertical flag\n                   nil       -- drag callback   ←これを nil に\n                   )\n    prop = TASK_getProperty(pList)\n    prop.default_scroll = true     ← これをtrueに\n    TASK_setProperty(pList, prop)\n</pre><hr>\n<h3 id=\"UI_Listにスクロールバーをつけたい\">UI_Listにスクロールバーをつけたい<a title=\"このセクションへのリンク\" href=\"#UI_List%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%82%92%E3%81%A4%E3%81%91%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_USE_SCROLLBARに必要なパラメータを設定することで、UI_Listの組み込みスクロールバーが使用できます。\n</p>\n<hr>\n<h3 id=\"ImagesourceforScrollbardoesnothaveattributesforscrollbardesignというassertで落ちた何が原因\">\"Image source for Scroll bar does not have attributes for scroll bar design\"というassertで落ちた。何が原因?<a title=\"このセクションへのリンク\" href=\"#ImagesourceforScrollbardoesnothaveattributesforscrollbardesign%E3%81%A8%E3%81%84%E3%81%86assert%E3%81%A7%E8%90%BD%E3%81%A1%E3%81%9F%E4%BD%95%E3%81%8C%E5%8E%9F%E5%9B%A0\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_USE_SCROLLBARでスクロールバーの設定を行っていますね?\n</p>\n<p>\nスクロールバーのスライダに使用するassetの画像をToboggan上で開き、Editable propertyのImageTypeが&quot;ScrollBar&quot;になっていることを\n確認してください。なっていない場合、そのままではその画像をスライダ用assetとして指定することはできません。設定を変更した上でテクスチャを再生成してください。\n</p>\n<hr>\n<h3 id=\"起動パラメータのLIST_FLAG_BOTTOMは何が変わるの\">起動パラメータのLIST_FLAG_BOTTOMは何が変わるの?<a title=\"このセクションへのリンク\" href=\"#%E8%B5%B7%E5%8B%95%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E3%81%AELIST_FLAG_BOTTOM%E3%81%AF%E4%BD%95%E3%81%8C%E5%A4%89%E3%82%8F%E3%82%8B%E3%81%AE\" class=\"anchor\"> ¶</a></h3>\n<p>\n通常UI_Listにアイテムを追加すると、追加されたCompositeの原点はすべて一本の直線の上に乗るよう配置されます。この直線を「原点ライン」と呼びます。\n</p>\n<p>\nデフォルトでは、縦方向リストならばクリッピング領域の左側、横方向リストならば上側の辺の延長線が原点ラインとなりますが、\nLIST_FLAG_BOTTOMを指定すると、原点ラインが「反対側の辺」の延長線になります。縦方向リストならば右側、横方向リストならば下側の辺です。\n</p>\n<p>\nこれは、「右の辺から生えているリスト」「アイテムが下の辺に乗っているリスト」のような表示を可能にするためのモードです。\n原点ラインが移動するので、アイテムとして登録するCompositeの作り方にも注意が必要となります。\n</p>\n<hr>\n<h3 id=\"LIST_FLAG_BOTTOMを指定したらアイテムが表示されなくなったなぜ\">LIST_FLAG_BOTTOMを指定したらアイテムが表示されなくなった。なぜ?<a title=\"このセクションへのリンク\" href=\"#LIST_FLAG_BOTTOM%E3%82%92%E6%8C%87%E5%AE%9A%E3%81%97%E3%81%9F%E3%82%89%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%8C%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%AA%E3%81%8F%E3%81%AA%E3%81%A3%E3%81%9F%E3%81%AA%E3%81%9C\" class=\"anchor\"> ¶</a></h3>\n<p>\nLIST_FLAG_BOTTOMを指定しない状態でアイテムが表示されるのであれば、アイテムとして追加しているCompositeの作り方が間違っています。\n</p>\n<p>\nたとえば縦方向リストの場合、原点の右側に表示オブジェクトを配置しているCompositeをLIST_FLAG_BOTTOM指定のUI_Listに追加すると、\n表示物がクリッピング領域外に出てしまうため描画されません。\n</p>\n<p>\nLIST_FLAG_BOTTOM指定のUI_Listにアイテムとして追加するCompositeは、縦方向リストであれば原点の左側、横方向リストならば原点の上側に\n表示オブジェクトが配置されていなければなりません。\n</p>\n<hr>\n<h3 id=\"UI_Listで特定のアイテムが中央にくるようにスクロールさせたい\">UI_List で特定のアイテムが中央にくるようにスクロールさせたい<a title=\"このセクションへのリンク\" href=\"#UI_List%E3%81%A7%E7%89%B9%E5%AE%9A%E3%81%AE%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%8C%E4%B8%AD%E5%A4%AE%E3%81%AB%E3%81%8F%E3%82%8B%E3%82%88%E3%81%86%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_SET_ITEM_POSを、&lt;position mode&gt; = LIST_VIEW_CENTER で使用してください。\n</p>\n<p>\n同じように、クリッピング領域の上/左に移動させたいなら LIST_VIEW_TOP,クリッピング領域の下/右ならばLIST_VIEW_BOTTOMです。\n</p>\n<hr>\n<h3 id=\"リスト中にあるアイテムの占有幅を個別に変更したい\">リスト中にあるアイテムの占有幅を個別に変更したい<a title=\"このセクションへのリンク\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E4%B8%AD%E3%81%AB%E3%81%82%E3%82%8B%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%81%AE%E5%8D%A0%E6%9C%89%E5%B9%85%E3%82%92%E5%80%8B%E5%88%A5%E3%81%AB%E5%A4%89%E6%9B%B4%E3%81%97%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_CHANGE_STEPを使用することで変更できます。\n</p>\n<hr>\n<h3 id=\"リストの端でスクロールが止まってしまうが止めずにスクロールさせたい\">リストの端でスクロールが止まってしまうが、止めずにスクロールさせたい<a title=\"このセクションへのリンク\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E3%81%AE%E7%AB%AF%E3%81%A7%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%8C%E6%AD%A2%E3%81%BE%E3%81%A3%E3%81%A6%E3%81%97%E3%81%BE%E3%81%86%E3%81%8C%E6%AD%A2%E3%82%81%E3%81%9A%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_SET_LIMITCLIPで&lt;limit clip enable&gt;をfalseにすることで、両端を超えてスクロールできるようになります。\n</p>\n<hr>\n<h3 id=\"リストの両端でスクロールは止めたいが両端に余白がほしい\">リストの両端でスクロールは止めたいが、両端に余白がほしい<a title=\"このセクションへのリンク\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E3%81%AE%E4%B8%A1%E7%AB%AF%E3%81%A7%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%AF%E6%AD%A2%E3%82%81%E3%81%9F%E3%81%84%E3%81%8C%E4%B8%A1%E7%AB%AF%E3%81%AB%E4%BD%99%E7%99%BD%E3%81%8C%E3%81%BB%E3%81%97%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_SET_MARGINで&lt;margin-top&gt;と&lt;margin-bottom&gt;を指定できます。\n</p>\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_MARGIN, 50, 70)\n</pre><p>\nまた、プロパティ.margin_top と .margin_bottom で個別に指定できます。\n</p>\n<pre class=\"wiki\">   pList = UI_List(...)\n   prop = TASK_getProperty(pList)\n   prop.margin_top = 50    -- 先頭マージン\n   prop.margin_bottom = 70 -- 末尾マージン\n   TASK_setProperty(pList, prop)\n</pre><p>\n \n</p>\n<hr>\n<h3 id=\"リスト末尾にスクロールさせたいがどこまでスクロールさせればよいか取得できるか\">リスト末尾にスクロールさせたいが、どこまでスクロールさせればよいか取得できるか?<a title=\"このセクションへのリンク\" href=\"#%E3%83%AA%E3%82%B9%E3%83%88%E6%9C%AB%E5%B0%BE%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84%E3%81%8C%E3%81%A9%E3%81%93%E3%81%BE%E3%81%A7%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%95%E3%81%9B%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%8B%E5%8F%96%E5%BE%97%E3%81%A7%E3%81%8D%E3%82%8B%E3%81%8B\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_GET_LIMITで返ってくる値を使用してください。\n</p>\n<hr>\n<h3 id=\"現在のスクロール位置が知りたい\">現在のスクロール位置が知りたい<a title=\"このセクションへのリンク\" href=\"#%E7%8F%BE%E5%9C%A8%E3%81%AE%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E4%BD%8D%E7%BD%AE%E3%81%8C%E7%9F%A5%E3%82%8A%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_GET_POSITION で返ってくる値を使用してください。\n</p>\n<hr>\n<h3 id=\"スクロール位置の値はどのような単位で扱われている\">スクロール位置の値はどのような単位で扱われている?<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E4%BD%8D%E7%BD%AE%E3%81%AE%E5%80%A4%E3%81%AF%E3%81%A9%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E5%8D%98%E4%BD%8D%E3%81%A7%E6%89%B1%E3%82%8F%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B\" class=\"anchor\"> ¶</a></h3>\n<p>\nスクロールアイテム群の先頭からのピクセル数です。\n</p>\n<hr>\n<h3 id=\"スクロールバーのコールバックに返される位置情報の単位は\">スクロールバーのコールバックに返される位置情報の単位は?<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%81%AB%E8%BF%94%E3%81%95%E3%82%8C%E3%82%8B%E4%BD%8D%E7%BD%AE%E6%83%85%E5%A0%B1%E3%81%AE%E5%8D%98%E4%BD%8D%E3%81%AF\" class=\"anchor\"> ¶</a></h3>\n<p>\nスクロール位置と同様にアイテム群先頭からのピクセル数です。\nそのまま計算してUI_LIST_SET_POSITIONに与えることができます。\n</p>\n<hr>\n<h3 id=\"スクロール時にデフォルトのヌメっとした動きではなくきびきび動作させたい\">スクロール時にデフォルトのヌメっとした動きではなくきびきび動作させたい<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E6%99%82%E3%81%AB%E3%83%87%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88%E3%81%AE%E3%83%8C%E3%83%A1%E3%81%A3%E3%81%A8%E3%81%97%E3%81%9F%E5%8B%95%E3%81%8D%E3%81%A7%E3%81%AF%E3%81%AA%E3%81%8F%E3%81%8D%E3%81%B3%E3%81%8D%E3%81%B3%E5%8B%95%E4%BD%9C%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_SELECT_SCRMGR で \"solid\" でも指定すると良いでしょう。\nあるいは \"default\" の &lt;delay&gt; を小さくしても良いです。\n</p>\n<hr>\n<h3 id=\"スクロールマネージャdefaultに指定できる値delayの意味が知りたい\">スクロールマネージャ \"default\" に指定できる値&lt;delay&gt;の意味が知りたい<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%9E%E3%83%8D%E3%83%BC%E3%82%B8%E3%83%A3default%E3%81%AB%E6%8C%87%E5%AE%9A%E3%81%A7%E3%81%8D%E3%82%8B%E5%80%A4delay%E3%81%AE%E6%84%8F%E5%91%B3%E3%81%8C%E7%9F%A5%E3%82%8A%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nスクロールマネージャ \"default\" は、1フレームあたりに現在の位置とスクロール目標位置の間の 1/n だけ距離を詰めます。\n距離が近づくにつれ 1/n の値も小さくなるのでだんだんとゆっくりになり、整数値に丸めた値が等しくなった時点で停止します。\nつまり n に 1 を指定すると 1/n = 1/1 = 1 となり、見かけ上 \"solid\" と同じ動作になります。\n</p>\n<p>\n&lt;delay&gt; はこの分母 n を指定する値で、整数値のみが指定できます。デフォルトの値は10です。\n</p>\n<hr>\n<h3 id=\"スクロールの停止位置を一定ピクセルおきにしてページ単位スクロールがしたい\">スクロールの停止位置を一定ピクセルおきにして「ページ単位スクロール」がしたい<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%AE%E5%81%9C%E6%AD%A2%E4%BD%8D%E7%BD%AE%E3%82%92%E4%B8%80%E5%AE%9A%E3%83%94%E3%82%AF%E3%82%BB%E3%83%AB%E3%81%8A%E3%81%8D%E3%81%AB%E3%81%97%E3%81%A6%E3%83%9A%E3%83%BC%E3%82%B8%E5%8D%98%E4%BD%8D%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%81%8C%E3%81%97%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_SELECT_SCRMGR で \"page\" を指定し、ページの「長さ」を指定してください。\n</p>\n<hr>\n<h3 id=\"現在のスクロール位置指標としてスクロールバーは表示させたいがスクロールバーを操作させたくはないどうすればいい\">現在のスクロール位置指標としてスクロールバーは表示させたいが、スクロールバーを操作させたくはない。どうすればいい？<a title=\"このセクションへのリンク\" href=\"#%E7%8F%BE%E5%9C%A8%E3%81%AE%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E4%BD%8D%E7%BD%AE%E6%8C%87%E6%A8%99%E3%81%A8%E3%81%97%E3%81%A6%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%81%AF%E8%A1%A8%E7%A4%BA%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84%E3%81%8C%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%82%92%E6%93%8D%E4%BD%9C%E3%81%95%E3%81%9B%E3%81%9F%E3%81%8F%E3%81%AF%E3%81%AA%E3%81%84%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_LIST_USE_SCROLLBAR のパラメータ &lt;active&gt; を false にしてください。\nスクロールバーが指定のAssetで表示され、現在位置を反映しますが、スクロールバーそのものを操作することはできなくなります。\n</p>\n<hr>\n<h2 id=\"汎用タスク編\">汎用タスク編<a title=\"このセクションへのリンク\" href=\"#%E6%B1%8E%E7%94%A8%E3%82%BF%E3%82%B9%E3%82%AF%E7%B7%A8\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"一定時間後にタスクを殺したい\">一定時間後にタスクを殺したい<a title=\"このセクションへのリンク\" href=\"#%E4%B8%80%E5%AE%9A%E6%99%82%E9%96%93%E5%BE%8C%E3%81%AB%E3%82%BF%E3%82%B9%E3%82%AF%E3%82%92%E6%AE%BA%E3%81%97%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nLIFECtrlタスクを使用してください。\n</p>\n<hr>\n<h3 id=\"ゲームアプリが端末によってForegroundBackground化されたときにスクリプト処理をさせたい\">ゲームアプリが端末によってForeground/Background化されたときにスクリプト処理をさせたい<a title=\"このセクションへのリンク\" href=\"#%E3%82%B2%E3%83%BC%E3%83%A0%E3%82%A2%E3%83%97%E3%83%AA%E3%81%8C%E7%AB%AF%E6%9C%AB%E3%81%AB%E3%82%88%E3%81%A3%E3%81%A6ForegroundBackground%E5%8C%96%E3%81%95%E3%82%8C%E3%81%9F%E3%81%A8%E3%81%8D%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E5%87%A6%E7%90%86%E3%82%92%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84\" class=\"anchor\"> ¶</a></h3>\n<p>\nPAUSECtrl タスクを使用し、Background化された際の処理を &lt;pause-callback&gt; 、Foreground化の処理を &lt;resume-callback&gt; で指定した関数に記述してください。\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/LIFECtrl.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/LIFECtrl – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"LIFECtrl\">LIFECtrl<a title=\"このセクションへのリンク\" href=\"#LIFECtrl\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = LIFECtrl( &lt;mode&gt;, &lt;limit&gt; )\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;mode&gt; 動作モード。寿命をミリ秒またはフレーム数で指定できる。\n<ul><li>LIFECTRL_TIME ミリ秒指定\n</li><li>LIFECTRL_FRAME フレーム数指定\n</li></ul></li><li>&lt;limit&gt; タスクの寿命。&lt;mode&gt;で指定された単位で与える。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された LIFECtrl タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n指定された時間が経過した後に自殺するだけのタスク。\nコマンドで与えられたタスクの親タスクになることができるため、他のタスクを一定時間経過後に自動的にkillすることができる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>LIFECTRL_ADD_CHILD</dt><dd>\n指定されたポインタのタスクを自身の子として登録する。\n子タスクの数に上限はないため、登録された複数のタスクを同時に破棄できる。\n<ul><li>LIFECTRL_ADD_CHILD\n<pre class=\"wiki\">   pLIFE = LIFECtrl(...)\n   pTask = OtherTask( ... )\n   sysCommand(pLIFE, LIFECTRL_ADD_CHILD, pTask)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/ONLINE_Update.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/ONLINE_Update – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"ONLINE_Update\">ONLINE_Update<a title=\"このセクションへのリンク\" href=\"#ONLINE_Update\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = ONLINE_Update( \"&lt;zip-url&gt;\", \"&lt;zip-size&gt;\", \"&lt;tmp-filename&gt;\",\n                                   \"&lt;callback-download&gt;\", \"&lt;callback-unzip&gt;\", \"&lt;callback-finish&gt;\" )\n\n   function &lt;callback-download&gt;(&lt;task-pointer&gt;, &lt;progress&gt;, &lt;download-size&gt;)\n     -- &lt;task-pointer&gt;  呼び出した ONLINE_Update タスクのポインタ\n     -- &lt;progress&gt;      &lt;zip-size&gt;から計算されたダウンロードの進捗比。0.0～1.0 までの値\n     -- &lt;download-size&gt; ダウンロードされたデータのサイズ\n   end\n\n   function &lt;callback-unzip&gt;(&lt;task-pointer&gt;, &lt;finished-files&gt;, &lt;total-files&gt;)\n     -- &lt;task-pointer&gt;   呼び出した ONLINE_Update タスクのポインタ\n     -- &lt;finished-files&gt; 展開が終了した.zip中エントリの数\n     -- &lt;total-files&gt;    現在展開中の .zip に含まれるエントリの総数\n   end\n\n   function &lt;callback-finish&gt;(&lt;task-pointer&gt;)\n     -- &lt;task-pointer&gt;   呼び出した ONLINE_Update タスクのポインタ\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;zip-url&gt; .zip ファイルを取得するURL(例: \"<a class=\"ext-link\" href=\"http://servername.net/path/update.zip\"><span class=\"icon\">&nbsp;</span>http://servername.net/path/update.zip</a>\")\n</li><li>&lt;zip-size&gt; あらかじめ判明している .zip ファイルのサイズ。巨大なファイルサイズのときに誤差が出ないよう文字列で与える(例: \"456782\")\n</li><li>&lt;tmp-filename&gt; .zip をダウンロードするテンポラリファイル名。明示的に \"<a class=\"ext-link\" href=\"file:///\"><span class=\"icon\">&nbsp;</span>file://external/</a>\" 以下であることが指定されたパス名でなければならない。(例:\"file://external/update.zip\")。また、ダウンロード時に対応するパスが生成されているとは限らないため、事実上 <a class=\"ext-link\" href=\"file:///\"><span class=\"icon\">&nbsp;</span>file://external/</a> 直下でなければならない。\n</li><li>&lt;callback-download&gt;  ダウンロード中の進捗を通知するコールバック関数名\n</li><li>&lt;callback-unzip&gt; .zip 展開中の進捗を通知するコールバック関数名\n</li><li>&lt;callback-finish&gt; 処理終了を通知するコールバック関数名\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された ONLINE_Update タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nURLで指定された .zip ファイルをダウンロードし、終了後 <a class=\"ext-link\" href=\"file:///\"><span class=\"icon\">&nbsp;</span>file://external/</a> 相当のパス以下に展開する。\nその際、.zip ファイル中にディレクトリではなくファイルとしてサイズが0のものについては、当該パスに一致するファイルを削除する動作をする。\n</p>\n<p>\nダウンロード、zip展開それぞれのフェーズにおける進捗はコールバックで取得することができる。\nまた、ダウンロードや個々のzipエントリ展開は別スレッドで行われるため、フレーム処理をブロックしない。\n</p>\n<p>\nzip展開フェーズが終了すると終了通知コールバックを呼び出し、<strong>そのフレームを最後に自動破棄される</strong>。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\n(コマンドなし)\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/PAUSECtrl.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/PAUSECtrl – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"PAUSECtrl\">PAUSECtrl<a title=\"このセクションへのリンク\" href=\"#PAUSECtrl\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = PAUSECtrl( \"&lt;pause-callback&gt;\", \"&lt;resume-callback&gt;\")\n\n   function &lt;pause-callback&gt;()\n     -- 引数なし\n   end\n\n   function &lt;resume-callback&gt;()\n     -- 引数なし\n   end\n\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;pause-callback&gt; プロセスがバックグラウンド化される直前に呼ばれるコールバックの名前。不要な場合は nil  を指定する。\n</li><li>&lt;resume-callback&gt; プロセスがフォアグラウンド化される直前に呼ばれるコールバックの名前。不要な場合は nil を指定する。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された PAUSECtrl タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nゲームアプリケーションが端末の機能によってForeground/Backgroundを切り替えられる際に送られるOSイベントを検出し、\nコールバックを呼び出す。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<blockquote>\n<p>\n(コマンド無し)\n</p>\n</blockquote>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/README.md",
    "content": "see index.html\n"
  },
  {
    "path": "Doc/LuaAPI/README_DOC.txt",
    "content": "This is the detailed document for :\r\n- LUA global functions & constants.\r\n- Tasks construction & commands\r\n\r\nThe documentation is only available in japanese for now.\r\n\r\nIMPORTANT NOTE :\r\nAs it was backed up from Trac Wiki, the link are not functionning\r\nas the original Wiki is private.\r\nWe just did a backup to make sure that at\r\nleast people will have a default documentation available.\r\n"
  },
  {
    "path": "Doc/LuaAPI/STORE_Service.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/STORE_Service – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"STORE_Service\">STORE_Service<a title=\"このセクションへのリンク\" href=\"#STORE_Service\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = STORE_Service( \"&lt;store-callback&gt;\" )\n\n\n   function &lt;store-callback&gt;(&lt;task pointer&gt;, &lt;status&gt;, &lt;item-id&gt;, &lt;data&gt;)\n\n     -- &lt;task pointer&gt;  呼び出し元 STORE_Service タスクのポインタ\n     -- &lt;status&gt;        コールバック理由\n     -- &lt;item-id&gt;       対象商品の ID 文字列(不要な場合は長さ0の文字列になる)\n     -- &lt;data&gt;          付加データ(現時点で、レシート情報以外には使用されていない)\n\n   end\n\n\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;store-callback&gt; AppStore からのステータスを受け取るコールバック関数名\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された STORE_Service タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\niOS/Android の課金サービスをサポートする。\niOS/Android の API を必要とするため、他環境の porting layer 上での動作は保証されない。\n</p>\n<p>\nコールバックを登録した時点から中断された決済情報の回収が始まり、\n新規購入と同様にSTORE_PURCHASHEDのコールバックが中断された分だけlua側に返される。\nまた、課金プラットフォームの挙動によっては購入処理で失敗結果が返された後に成功結果が投げ直されることもある。\nよって、スクリプト側では任意のタイミングでSTORE_PURCHASEDが呼ばれることを考慮して適宜レシートデータをキューイングするなどの実装を行う必要がある。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>STORESERVICE_GET_PRODUCTS</dt><dd>\n商品のIDリスト(iOS: product id, Andrroid: sku id)を配列のjsonで指定し、\nプラットフォームに問い合わせて有効な商品リストを返却する。\n<ul><li>STORESERVICE_GET_PRODUCTS\n<pre class=\"wiki\">   pStore = STORE_Service(...)\n   itemListJson = Conv_Lua2Json({\"product.id.1\", \"product.id.2\", ... }\n   --  価格の文字列に通貨記号を自動で付加する場合はcurrency_modeをtrueにする。\n   sysCommand(pStore, STORESERVICE_GET_PRODUCTS, itemListJson, &lt;currency_mode&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>STORESERVICE_BUY_ITEMS</dt><dd>\n商品のIDを指定し、購入処理を開始する。以後のシーケンスはコールバックによって通知される。\n可変長パラメータとなっており、購入対象とするアイテムのIDを同時に複数指定することができる。\n<ul><li>STORESERVICE_BUY_ITEMS\n<pre class=\"wiki\">   pStore= STORE_Service(...)\n   sysCommand(pStore, STORESERVICE_BUY_ITEMS, &lt;item-id&gt; [, &lt;item-id&gt; [, ... ]])\n</pre></li></ul></dd></dl>\n<dl><dt>STORESERVICE_FINISH_TRANSACTION</dt><dd>\n決済情報のレシートデータ（iOS: Receipt, Android: PurchaseToken)をエンジンに渡し、購入処理が完了したことを通知する。\nこれを行うまで決済は中断状態とみなされ、アプリを起動し直す度にSTORE_PURCHASHEDコールバックに同じレシートデータが渡され続ける。\nこの処理を行うタイミングは、サーバーサイドが購入アイテム付与を正常に完了出来たと確証出来たタイミングに限られる。\n<ul><li>STORESERVICE_FINISH_TRANSACTION\n<pre class=\"wiki\">   sysCommand(pStore, STORESERVICE_FINISH_TRANSACTION,&lt;receipt&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"コールバック解説\">コールバック解説<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<blockquote>\n<p>\nコールバックは、&lt;status&gt;にコールバック理由を添えて通知される。\n使用スクリプト側では、各コールバック理由に対応する処理が求められる。\n</p>\n</blockquote>\n<dl><dt>STORE_GET_PRODUCTS/商品リスト取得</dt><dd>\nプラットフォームに商品リストを問い合わせた結果を返却する。\n<ul><li>STORE_GET_PRODUCTS有効パラメータ\n<ul><li>&lt;data&gt;    商品リストJSONデータ(Conv_Json2Luaでluaテーブルに要変換)\n<pre class=\"wiki\">  {\n    { \n      \"id\": &lt;product id&gt;, \n      \"title\": &lt;商品タイトル&gt;, \n      \"description\": &lt;商品説明&gt;, \n      \"price\": &lt;値段の文字列&gt;\n    }, ...\n}\n</pre></li></ul></li></ul></dd></dl>\n<dl><dt>STORE_FAILED/購入処理エラーもしくはキャンセル</dt><dd>\n購入処理がエラーもしくはキャンセルの扱いとなった通知。\n<ul><li>STORE_FAILED 有効パラメータ\n<ul><li>&lt;item-id&gt; 購入処理がエラーまたはキャンセルとなったアイテムのID\n</li></ul></li></ul></dd></dl>\n<dl><dt>STORE_PURCHASHING/購入処理中</dt><dd>\n現在購入処理中。\n<ul><li>STORE_PURCHASHING 有効パラメータ\n<ul><li>&lt;item-id&gt; 購入処理中アイテムのID\n</li></ul></li></ul></dd></dl>\n<dl><dt>STORE_PURCHASHED/購入処理成功</dt><dd>\n購入処理が終了し、処理は成功。レシートデータが通知されるので、適切に処理する必要がある。\n<ul><li>STORE_PURCHASHED 有効パラメータ\n<ul><li>&lt;item-id&gt; 購入処理終了アイテムのID\n</li><li>&lt;data&gt;    購入結果のレシートデータ文字列\n</li></ul></li></ul></dd></dl>\n<dl><dt>STORE_RESTORE/リストア</dt><dd>\n既に購入済みのアイテムが再インストール後の購入などで再付与される。\n<ul><li>STORE_RESTORE 有効パラメータ\n<ul><li>&lt;item-id&gt; リストア対象のアイテムID\n</li></ul></li></ul></dd></dl>\n<dl><dt>STORE_RESTRE_COMPLETED/リストア終了</dt><dd>\n全てのリストア処理が完了した。\n<ul><li>STORE_RESTORE_COMPLETED 有効パラメータ\n<ul><li>(なし)\n</li></ul></li></ul></dd></dl>\n<dl><dt>STORE_RESTORE_FAILED/リストア失敗</dt><dd>\nリストア処理が失敗した。\n<ul><li>STORE_RESTORE_FAILED 有効パラメータ\n<ul><li>(なし)\n</li></ul></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/TASK_Generic.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/TASK_Generic – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"TASK_Generic\">TASK_Generic<a title=\"このセクションへのリンク\" href=\"#TASK_Generic\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = TASK_Generic( \"&lt;execute function&gt;\", \"&lt;die function&gt;\",\n                                  \"&lt;array key string&gt;\" [, &lt;task phase&gt; [, &lt;parent-task&gt; ] ] )\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;execute function&gt; 毎フレーム実行させたい \"execute\"にあたるLua関数名\n</li><li>&lt;die function&gt; 破棄時に実行させたい \"die\" にあたるLua関数名\n</li><li>&lt;array key string&gt; execute や die に渡す、ワーク配列用の key 文字列\n</li><li>&lt;task phase&gt; タスクの実行フェーズ。下記の値が指定できる。省略した場合は TASK_P_NORMAL で動作する\n<ul><li>TASK_P_MENU   メニューフェーズ\n</li><li>TASK_P_PREV   通常タスクの直前フェーズ\n</li><li>TASK_P_NORMAL 通常タスクフェーズ\n</li><li>TASK_P_AFTER  通常タスクの直後フェーズ\n</li><li>TASK_P_JUDGE  判定フェーズ\n</li></ul></li><li>&lt;parent-task&gt; 親タスクとして指定するタスクのポインタ(親をつける場合)\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された TASK_Generic タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n実行内容をLuaで記述したタスクを起動し、実行する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<blockquote>\n<p>\n(コマンド無し)\n</p>\n</blockquote>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_ActivityIndicator.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_ActivityIndicator – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_ActivityIndicator\">UI_ActivityIndicator<a title=\"このセクションへのリンク\" href=\"#UI_ActivityIndicator\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_ActivityIndicator( &lt;parent pointer&gt;, &lt;type&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;[ , &lt;id&gt; ])\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;type&gt; 表示する ActivityIndicator の種類(ACTI_TYPE_WHITE / ACTI_TYPE_GRAY / ACTI_TYPE_WHITELARGE より選択)\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; 表示領域のサイズ(表示領域中央に表示される)\n</li><li>&lt;id&gt; OS Widget に与える ID値\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_ActivityIndicator タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n長時間かかる処理を行っていることを示す処理待ちアイコンを表示する。\n基本的には iOS のAPIを使用するため、他の環境では同様の表示が保証されない(タスクとしての起動は可能)。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_ACTI_ANIM_START::\n</p>\n<blockquote>\n<p>\nActivityIndicator のアニメーションを開始する\n</p>\n</blockquote>\n<ul><li>UI_ACTI_ANIM_START\n<pre class=\"wiki\">   pActI = UI_ActivityIndicator(...)\n   sysCommand(pActI, UI_ACTI_ANIM_START)\n</pre></li></ul><p>\nUI_ACTI_ANIM_STOP::\n</p>\n<blockquote>\n<p>\nActivityIndicator のアニメーションを停止する\n</p>\n</blockquote>\n<ul><li>UI_ACTI_ANIM_STOP\n<pre class=\"wiki\">   pActI = UI_ActivityIndicator(...)\n   sysCommand(pActI, UI_ACTI_ANIM_STOP)\n</pre></li></ul><p>\nUI_ACTI_IS_ANIM::\n</p>\n<blockquote>\n<p>\nActivityIndicator がアニメーション中か否かを返す\n</p>\n</blockquote>\n<ul><li>UI_ACTI_IS_ANIM\n<pre class=\"wiki\">   pActI = UI_ActivityIndicator(...)\n   &lt;is-anim&gt; = sysCommand(pActI, UI_ACTI_IS_ANIM)\n\n   &lt;is-anim&gt; trueでアニメーション中 / falseでアニメーション停止状態\n</pre></li></ul>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Button.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Button – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Button\">UI_Button<a title=\"このセクションへのリンク\" href=\"#UI_Button\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Button( \"&lt;callback&gt;\" )\n\n   function &lt;callback&gt;(tbl)\n\n     --[[\n       tbl = {\n         {\n           type = 1 (PRESS) / 2 (RELEASE) / 3 (CLICK),  -- イベントの種類 (2013/08/17 現状は3(CLICK)のみサポート、長押しでは連続してイベントが通知される)\n           id = 1 (BACK) / 2 (MENU),                    -- イベントを起こしたデバイスボタン種別\n         },\n         {\n           type = 1 (PRESS) / 2 (RELEASE) / 3 (CLICK),\n           id   = 1 (BACK) / 2 (MENU),\n         },\n            :\n       }\n     ]]\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;callback&gt; デバイスボタンイベントが通知されるコールバック関数\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Button タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nデバイスボタンイベントキュー内容を通知する。通知は毎フレーム行われる。\n</p>\n<p>\nコールバック関数は一つだけ引数を持ち、その引数はキュー内容を時系列順に並べたテーブルとなる。\n</p>\n<p>\nデバイスボタン種別のプラットフォーム毎のマッピングは以下の通り。\n</p>\n<table class=\"wiki\">\n<tbody><tr><td>  Platform </td><td> BACK </td><td> MENU \n</td></tr><tr><td> Win32    </td><td>      F8キー</td><td> - \n</td></tr><tr><td> Android  </td><td> 端末のBACKキー</td><td> 端末のMENUキー \n</td></tr><tr><td> iOS     </td><td> - </td><td> - \n</td></tr></tbody></table>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\nなし\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Clip.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Clip – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Clip\">UI_Clip<a title=\"このセクションへのリンク\" href=\"#UI_Clip\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Clip( &lt;parent pointer&gt;, \n                             &lt;base priority&gt;, &lt;max order&gt;,\n                             &lt;x&gt;, &lt;y&gt;, &lt;clip width&gt;, &lt;clip height&gt;)\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;base priority&gt; 基準表示プライオリティ\n</li><li>&lt;max order&gt; クリッピング対象とする最大プライオリティ値\n</li><li>&lt;x&gt;, &lt;y&gt; クリッピング領域とする領域の位置\n</li><li>&lt;clip width&gt;, &lt;clip height&gt; クリッピング領域のサイズ\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Clip タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n一定のプライオリティを持つオブジェクトに対して適用されるクリッピング領域を配置する。\n</p>\n<h3 id=\"制約事項\">制約事項<a title=\"このセクションへのリンク\" href=\"#%E5%88%B6%E7%B4%84%E4%BA%8B%E9%A0%85\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_Clip と UI_List は、共に描画システムのクリッピング機能を利用している。\nどちらも他の UI_Clip や UI_List と重複するプライオリティ範囲を指定することはできない。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_CLIP_SET_POSITION</dt><dd>\nクリッピング領域矩形の左上位置を画面座標で指定する\n<ul><li>UI_CLIP_SET_POSITION\n<pre class=\"wiki\">   pClip = UI_Clip(...)\n   sysCommand(pClip, UI_CLIP_SET_POSITION, &lt;x&gt;, &lt;y&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>UI_CLIP_SET_SIZE</dt><dd>\nクリッピング領域矩形のサイズを指定する\n<ul><li>UI_CLIP_SET_SIZE\n<pre class=\"wiki\">   pClip = UI_Clip(...)\n   sysCommand(pClip, UI_CLIP_SET_SIZE, &lt;clip width&gt;, &lt;clip height&gt; )\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Control.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Control – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Control\">UI_Control<a title=\"このセクションへのリンク\" href=\"#UI_Control\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Control( \"&lt;onClick callback&gt;\", \"&lt;onDrag callback&gt;\")\n\n   function &lt;onClick callback&gt;(x, y)\n\n   end\n\n\n   function &lt;onDrag callback&gt;(mode, x, y, mvX, mvY)\n\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;onClick callback&gt; クリック動作時に呼ばれるコールバック関数の名称。関数は以下の二つの引数を持つ。\n<ul><li>x,y クリックされた座標\n</li></ul></li></ul><ul><li>&lt;onDrag callback&gt; ドラッグ動作時に呼ばれるコールバック関数の名称。関数は以下の5つの引数を持つ。\n<ul><li>mode ドラッグ中もしくはリリース動作を表す値のいずれか\n<ul><li>PAD_ITEM_DRAG     ドラッグ中\n</li><li>PAD_ITEM_RELEASE  リリース]\n</li></ul></li><li>x, y  現在の座標\n</li><li>mvX, mvY  タップ座標からの移動量\n</li></ul></li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Control タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n高レベルの入力ゼスチャーを解釈し、それぞれに対応したコールバックを呼ぶ。\nピンチイン/アウト、ローテーション、ダブルクリック、ロングタップ(長押し)に対応。\n</p>\n<p>\nまた、<a class=\"wiki\" href=\"modalstack.html\">モーダルスタック</a>の影響を受ける。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_CONTROL_ON_PINCH</dt><dd>\nピンチイン/アウトおよびローテーション動作の値を取得するコールバック関数を指定する。\n<ul><li>UI_CONTROL_ON_PINCH \n<pre class=\"wiki\">   pCtrl = UI_Control(...)\n   sysCommand(pCtrl, UI_CONTROL_ON_PINCH, \"&lt;onPinch callback&gt;\")\n\n   function &lt;onPinch callback&gt;( mode, pinch, rot )\n\n   end\n\n    mode PAD_ITEM_DRAG / PAD_ITEM_RELEASE のどちらか\n    pinch 最初に指を置いた2点間の距離に対する、現在の2点間の距離の比率\n    rot   最初に指を置いた2点間を結ぶ線分に対する、現在の2点間を結ぶ線分の角度\n</pre></li></ul></dd></dl>\n<dl><dt>UI_CONTROL_ON_DBLCLICK</dt><dd>\nダブルクリック動作の値を取得するコールバック関数を指定する。\n<ul><li>UI_CONTROL_ON_DBLCLICK \n<pre class=\"wiki\">   pCtrl = UI_Control(...)\n   sysCommand(pCtrl, UI_CONTROL_ON_DBLCLICK, \"&lt;onDblClick callback&gt;\")\n\n   function &lt;onDblClick callback&gt;( x, y )\n\n   end\n\n    x,y ダブルクリック動作が行われた座標\n</pre></li></ul></dd></dl>\n<dl><dt>UI_CONTROL_ON_LONGTAP</dt><dd>\nロングタップ(長押し)動作の値を取得するコールバック関数を指定する。\nロングタップ動作の通知は、ドラッグやリリースなどが行われるまで毎フレーム行われる。\n<ul><li>UI_CONTROL_ON_LONGTAP\n<pre class=\"wiki\">   pCtrl = UI_Control(...)\n   sysCommand(pCtrl, UI_CONTROL_ON_LONGTAP, \"&lt;onLongTap callback&gt;\")\n\n   function &lt;onLongTap callback&gt;( t, x, y )\n\n   end\n\n    t   タップ時点からの経過時間(ミリ秒)\n    x,y ダブルクリック動作が行われた座標\n</pre></li></ul></dd></dl>\n<dl><dt>UI_CONTROL_SET_GROUP</dt><dd>\nUI_ControlをUI_FormやUI_Listと同様グループに所属させる。\n指定されたグループの他のフォーム等が操作中、UI_Controlの各操作におけるコールバックは呼ばれなくなる。また、後述のUI_CONTROL_LOCKで同グループの他のフォーム等の操作を禁止することができる。\n<ul><li>UI_CONTROL_SET_GROUP\n<pre class=\"wiki\">   pCtrl = UI_Control(...)\n   sysCommand(pCtrl, UI_CONTROL_SET_GROUP, \"&lt;group-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_CONTROL_SET_MASK</dt><dd>\nUI_Controlが呼び出すcallback各種の許可/禁止フラグを設定する。\n指定はビットマスクで行い、対応するビットが 1 のコールバックは呼び出しが禁止される。\n<ul><li>UI_CONTROL_SET_MASK\n<pre class=\"wiki\">   pCtrl = UI_Control(...)\n   sysCommand(pCtrl, UI_CONTROL_SET_MASK, &lt;bit-mask&gt;)\n\n   &lt;bit-mask&gt; に指定できるマスクビット定数\n    CTRLMASK_CLICK     クリック\n    CTRLMASK_DRAG      ドラッグ\n    CTRLMASK_PINCH      ピンチイン/アウト/ローテーション\n    CTRLMASK_DBLCLICK   ダブルクリック\n    CTRLMASK_LONGTAP    ロングタップ\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_DbgLabel.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_DbgLabel – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_DbgLabel\">UI_DbgLabel<a title=\"このセクションへのリンク\" href=\"#UI_DbgLabel\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_DbgLabel( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;,\n                             &lt;alpha&gt;, &lt;rgb&gt;, \"&lt;font name&gt;\", &lt;font size&gt;, \"&lt;text string&gt;\",\n                             &lt;cmdID&gt;, \"&lt;callback&gt;\")\n\n\n   function &lt;callback&gt;(pTask, cmdID)\n     --[[\n         pTask タスクのポインタ\n         cmdID 起動時に与えられた&lt;cmdID&gt;の値\n     ]]\n   end\n\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;alpha&gt; ラベル表示alpha値\n</li><li>&lt;rgb&gt; ラベル表示RGB値\n</li><li>&lt;font name&gt; 使用するフォント名\n</li><li>&lt;font size&gt; 使用するフォントサイズ\n</li><li>&lt;text string&gt; ラベル文字列\n</li><li>&lt;cmdID&gt; コールバックに与えられるID値\n</li><li>&lt;callback&gt; タップ時に呼び出されるコールバック名\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_DbgLabel タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n位置、表示色、フォントとサイズを指定し、文字列を描画する。\n文字列はボタンになっており、タップ操作でコールバックが呼び出される。\n</p>\n<p>\nデバッグ用のコマンドボタンを簡易的に配置するために使用する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\n(コマンド無し)\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_DragIcon.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_DragIcon – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_DragIcon\">UI_DragIcon<a title=\"このセクションへのリンク\" href=\"#UI_DragIcon\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_DragIcon( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;tap area&gt;, \"&lt;asset&gt;\",\n                                 \"&lt;drag asset&gt;\", &lt;drag order offset&gt;, &lt;drag alpha&gt;, &lt;centerX&gt;, &lt;centerY&gt;,\n                                 \"&lt;callback&gt;\" [ , &lt;flags&gt; ])\n\n   &lt;tap area&gt; = {\n     x = &lt;x&gt;,\n     y = &lt;y&gt;,\n     width = &lt;width&gt;,\n     height = &lt;height&gt;\n   }\n\n   function &lt;callback&gt;(step, x, y)\n   end\n\n    stepは下記二つの値を取る。\n　　  DRAGICON_DRAG ドラッグ中\n      DRAGICON_RELEASE リリース(ドロップ)\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; アイコン表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; アイコン表示座標\n</li><li>&lt;tap area&gt; アイコンとして反応するエリアの指定配列。自身の表示座標を基準に指定。\n</li><li>&lt;asset&gt; アイコン表示に使用する画像assetのパス\n</li></ul><ul><li>&lt;drag asset&gt; ドラッグ中、指先について回る表示物のasset\n</li><li>&lt;drag order offset&gt; ドラッグ中&lt;drag asset&gt;の表示に使用するプライオリティの、&lt;order&gt;からのオフセット\n</li><li>&lt;drag alpha&gt; ドラッグ中&lt;drag asset&gt;を表示する際のalpha値。\n</li><li>&lt;centerX&gt;,&lt;centerY&gt; ドラッグ中&lt;drag asset&gt;を表示する際に、指先の真下にくるべき&lt;drag asset&gt;表示位置からの相対座標。\n</li><li>&lt;callback&gt; 操作中や操作終了の通知を受け取るコールバック関数名。\n</li><li>&lt;flags&gt; 動作規定フラグ。下記の値をbitOR()関数等でORした結果で動作を規定する。\n<ul><li>F_DICON_BASEINVISIBLE ドラッグ中元アイコンを非表示にする\n</li></ul></li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_DragIcon タスクのポインタ。\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nアイコン位置からのドラッグ&amp;ドロップ操作によって、操作対象の位置を取得できるUIタスク。\n<a class=\"wiki\" href=\"modalstack.html\">モーダルスタック</a>の影響を受ける。\n</p>\n<p>\nUI_DragIcon を起動すると指定した座標に&lt;asset&gt;によるアイコンが表示される。\nこのアイコンに対し、&lt;tap area&gt;で指定された領域内から始まるDRAG操作により、現在のDRAG座標に&lt;drag asset&gt;が表示され、\nRELEASE操作でDropした段階で&lt;drag asset&gt;の表示が消える。\n</p>\n<p>\nこの間、DRAGとRELEASEそれぞれについて&lt;callback&gt;で指定されたLua関数が呼ばれ、この関数を適切に実装することにより、\nドラッグ&amp;ドロップ操作を実装できる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_DRAGICON_ENABLE</dt><dd>\nドラッグアイコンの操作を許可または禁止する。\n<ul><li>UI_DRAGICON_ENABLE\n<pre class=\"wiki\">   pDIC= UI_DragIcon(...)\n   sysCommand(pDIC, UI_DRAGICON_ENABLE, &lt;enabled(true/false)&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_DRAGICON_DRAGAREA</dt><dd>\nドラッグアイコンをドロップ操作可能な画面領域に制限を与える。\nこのコマンド実行以後、画面上の指定した領域以外に対してはドロップ操作ができなくなる。\n<ul><li>UI_DRAGICON_DRAGAREA\n<pre class=\"wiki\">   pDIC= UI_DragIcon(...)\n   sysCommand(pDIC, UI_DRAGICON_DRAGAREA, &lt;drop area&gt;)\n\n   &lt;drop area&gt; = {\n     x = &lt;x&gt;,\n     y = &lt;y&gt;,\n     width = &lt;width&gt;,\n     height = &lt;height&gt;\n   }\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Form.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Form – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Form\">UI_Form<a title=\"このセクションへのリンク\" href=\"#UI_Form\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Form( &lt;parent pointer&gt;, &lt;base priority&gt;,\n                            &lt;x&gt;, &lt;y&gt;, \"&lt;asset name&gt;\" [ , &lt;exclusive flag&gt;, &lt;modal flag&gt;, &lt;urgent flag&gt; ] )\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;base priority&gt; 基準表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;asset name&gt; 使用するassetのパス\n</li><li>&lt;exclusive flag&gt; 排他フラグ。Formが保持する特定コントロールの操作中、他の保持コントロールの操作を禁止する。\n</li><li>&lt;modal flag&gt; モーダルフラグ。モーダルフォームとして機能させる(<a class=\"wiki\" href=\"modalstack.html\">モーダルスタックについて</a>)\n</li><li>&lt;urgent flag&gt; アージェント(緊急)フラグ。モーダルスタック上にアージェントレベル(urgent level)で乗るようになり、&lt;modal flag&gt;は自動的に true 扱いとなる。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Form タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nUIエディタで生成されたJSONを元に、フォームを表示/管理するタスクを生成する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_FORM_SET_ENABLED</dt><dd>\nフォーム操作の許可/禁止を指定する\n<ul><li>UI_FORM_SET_ENABLED\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_SET_ENABLED, &lt;enable flag&gt;)\n</pre><ul><li>&lt;enable flag&gt; 許可(true)/禁止(false)\n</li></ul></li></ul></dd></dl>\n<dl><dt>UI_FORM_EXIST_NODE</dt><dd>\nフォーム内に含まれるノードを名前で検索し、存在するか否かを返す。\n<ul><li>UI_FORM_EXIST_NODE\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   &lt;exist-status&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, \"&lt;node name&gt;\")\n\n   &lt;node name&gt;  ノード名称文字列\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_UPDATE_NODE</dt><dd>\nフォーム内に含まれるノードを名前で検索し、サブコマンドで指定された操作を行う。\n<ul><li>UI_FORM_UPDATE_NODE\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, &lt;subcommand&gt;, ... )\n\n   &lt;node identifier&gt;  ノードの名称\"&lt;node name&gt;\"または、FORM_NODE_POINTER で取得される &lt;node pointer&gt; いずれか\n\n\n   引数の数と意味は &lt;subcommand&gt; の値ごとに異なる。\n\n   FORM_NODE_～: 全ノード共通処理\n     &lt;node pointer&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_POINTER)  ノードポインタ取得\n\n      ※取得されるポインタは SceneGraph上に存在するノードのポインタであり、そのノードが持つタスクのポインタではないことに注意。\n        タスクのポインタを取得する場合は、FORM_NODE_TASK サブコマンド(後述)を使用。\n\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_RECURSIVE, \"&lt;function name&gt;\") ノード再帰処理\n\n       function &lt;function name&gt;(&lt;parent task pointer&gt;, &lt;node pointer&gt;, &lt;index&gt;, &lt;level&gt;)\n         -- &lt;parent task pointer&gt;  呼び出し元UI_Formタスクのポインタ\n         -- &lt;node pointer&gt;         再帰処理対象となるノードのポインタ\n         -- &lt;index&gt;                アイテムインデックス。UI_Formでは常に0\n         -- &lt;level&gt;                再帰呼び出しの階層。FORM_NODE_RECURSIVEで指定した&lt;node identifier&gt;に該当するものが0、以降、階層を子の側に辿るごとに+1される。\n       end\n\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_TRANS, &lt;x&gt;, &lt;y&gt;)           移動\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_SCALE, &lt;scaleX&gt;, &lt;scaleY&gt;) 表示倍率指定\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_ROT, &lt;rotation-degree&gt;)    回転角指定。正の方向で時計回り。単位はdegree.\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_COLOR, &lt;alpha&gt;, &lt;RGB&gt; )    表示RGBおよびalpha指定\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_VISIBLE, &lt;visible flag&gt; )  表示/非表示切り替え\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_ORDER, &lt;priority&gt; )        表示プライオリティ指定\n     &lt;node order&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_GET_ORDER)  表示プライオリティ取得\n     &lt;task pointer&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_NODE_TASK)     指定した名称のノードを持つタスクポインタを取得\n\n       ※FORM_NODE_TASK で取得できるのは、Compositeで指定され起動されたタスクのみであり、\n         UI_GENERIC_RECONNECT_NODE 等を使用してスクリプトから後天的に接続したタスクについては対象とならない。\n         そのようなタスクについては、別途スクリプタの責任においてタスクのポインタを保持すること。\n\n       ※ Order property does not update (起動時のみ）:\n　　　　（しかし、対応が出来るので相談してください）\n\t\t\t- UIDragIcon\n\t\t\t- UIPieChart\n\t\t\t- UIGroup\n\t\t\t- UIForm\n\t\t\t- UIPolyline\n\t\t\t- UIRubberBand\n\t\t\t- UIScore\n\t\t\t- UIMapGroup(Worldから正常に更新される）\n\t\t\t- MapTask\n\t\t\t- UIScrollbar (order property unused at all)\n\n   FORM_UIE_～: CKLBUIElement型用\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIE_SET_ENABLED, &lt;enabled flag&gt; )           有効/無効切り替え\n     &lt;enabled flag&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIE_GET_ENABLED)           有効/無効状態取得\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIE_SET_ASSET, &lt;asset path&gt;, &lt;asset type&gt; ) 表示asset変更\n     &lt;asset type&gt; は、form中で使用される目的別の分類。\n\t\tFORM_ASSET_NORMAL    通常時\n\t\tFORM_ASSET_DISABLED  無効時\n\t\tFORM_ASSET_FOCUSED   フォーカス時(タッチパネルデバイスでは無意味)\n\t\tFORM_ASSET_PUSHED    押された時\n\n   FORM_UIS_～: CKLBUISelectable型用\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIS_SET_CLICK, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt; ) クリック範囲指定\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIS_SET_STICK, &lt;stick flag&gt; )                チェックボックス状態指定\n     &lt;sticked status&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIS_GET_STICK)            チェックボックス状態取得\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIS_SET_RADIO, &lt;radio ID&gt; )                  ラジオボタンID指定\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_UIS_SET_CALLBACK, &lt;callback fct name&gt; )      コールバック関数を実行に変更する\n\n   FORM_CONT_～: CKLBUIContainer型用\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_CONT_VIEWOFFSET, &lt;offsetX&gt;, &lt;offsetY&gt; )      View内表示offset指定\n     &lt;radio value&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_CONT_GET_RADIO_VALUE)        ラジオボタン値取得\n\n   FORM_TEXT_～: CKLBUITextBox型用\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_TEXT_SET, &lt;text string&gt; )                    テキストボックス文字列設定\n     &lt;text string&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_TEXT_GET)                    テキストボックス文字列取得\n   \n   FORM_WEB_～: CKLBUIWebView型用\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_WEB_SET_URI, &lt;URI string&gt; )                  WebView 表示 URI 指定\n     &lt;URI string&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_WEB_GET_URI)                  現在の URI 文字列取得\n\n   FORM_LBL_～: CKLBLabelNode型用\n     sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_LBL_SET_TEXT, \"&lt;new text&gt;\" )                ラベルテキスト変更\n     &lt;text string&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;node identifier&gt;, FORM_LBL_GET_TEXT)               ラベルテキスト取得\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_INPUT_ENABLE</dt><dd>\nフォームの表示状態を変えずに操作を許可/禁止する。\n<ul><li>UI_FORM_INPUT_ENABLE\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_INPUT_ENABLE, &lt;enable flag&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_ANIM_CALLBACK</dt><dd>\nフォームのアニメーションコールバックを指定する。\n<ul><li>UI_FORM_ANIM_CALLBACK\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_ANIM_CALLBACK, \"&lt;callback name&gt;\")\n\n   コールバックの型は下記の通り。\n\n   function &lt;callback name&gt;(pForm, name, id)\n   end\n\n    pForm アニメーションを終了させたUI_Formタスクのポインタ\n    name  終了したアニメーションの名前\n    id    アニメーション起動時に与えたID(必ず0になる)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_ANIMATION</dt><dd>\n名前を指定して、formの持つアニメーションを開始させる。\n<ul><li>UI_FORM_ANIMATION\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_ANIMATION, \"&lt;animation name&gt;\" [, &lt;blend flag&gt;])\n\n     &lt;animation name&gt; アニメーションの名前\n     &lt;blend flag&gt; Form中のアニメーションとの補間フラグ。指定しない場合はfalseと同じ扱いとなる。\n                  trueであればこのコマンドで最初に指定した時にだけ再生を行い、\n                  falseであれば指定される都度に再生される。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_SKIP_ANIM</dt><dd>\n指定された名称のアニメーションを中断し、終了時のフレーム状態にする。ループアニメーションの場合でも終了する。\n<ul><li>UI_FORM_SKIP_ANIM\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_SKIP_ANIM, \"&lt;animation name&gt;\")\n\n     &lt;animation name&gt; アニメーションの名前\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_ANIM_ENTER</dt><dd>\n\"enter\" アニメーションを再生する。\n<ul><li>UI_FORM_ANIM_ENTER\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_ANIM_ENTER)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_ANIM_LEAVE</dt><dd>\n\"leave\" アニメーションを再生し、終了と同時にタスクを殺す。\n<ul><li>UI_FORM_ANIM_LEAVE\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_ANIM_LEAVE)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_IS_ANIM</dt><dd>\n現在アニメーションが再生されているか否かをbooleanで返す。\n<ul><li>UI_FORM_IS_ANIM\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   &lt;result&gt; = sysCommand(pForm, UI_FORM_IS_ANIM [, \"&lt;animation name&gt;\" ] )\n\n   &lt;animation name&gt; で指定された名称のアニメーションについて、現在動いているノードがあれば true, 再生が終了していれば false を返す。\n   &lt;animation name&gt; を指定しない、または nil を指定することで全てのアニメーションについて確認できる。\n　　　　　　この場合、trueであればいずれかのアニメーションが再生中、falseであれば全てのアニメーションが終了している。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FORM_SET_GROUP</dt><dd>\nフォームにグループ名を与える。同じグループ名を持つ UI_Form および UI_List は同一のグループに所属すると見做され、\n</dd></dl>\n<p>\n操作の排他制御が行われる。\n</p>\n<pre class=\"wiki\">   pForm = UI_Form(...)\n   sysCommand(pForm, UI_FORM_SET_GROUP, \"&lt;group-name&gt;\")\n</pre>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_FreeVertItem.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_FreeVertItem – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_FreeVertItem\">UI_FreeVertItem<a title=\"このセクションへのリンク\" href=\"#UI_FreeVertItem\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_FreeVertItem( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, \"&lt;asset&gt;\", &lt;vertices array&gt;)\n\n   &lt;vertices array&gt; = {\n     &lt;x0&gt;, &lt;y0&gt;,   -- left top\n     &lt;x1&gt;, &lt;y1&gt;,   -- right top\n     &lt;x2&gt;, &lt;y2&gt;,   -- right bottom\n     &lt;x3&gt;, &lt;y3&gt;    -- left bottom\n   } \n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;asset&gt; 表示に使用する画像assetのパス。nilを指定するとテクスチャ無しで白単色での描画になる。\n</li><li>&lt;vertices array&gt; 頂点配列。4頂点を画像左上から時計回りに指定。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_FreeVertItem タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n4つの頂点座標を自由に設定できる四角形を描画する。\n画像assetを指定した場合、そのテクスチャが使用されるが、assetとしてnilを指定した場合は白単色の四角形となる。\n</p>\n<p>\n実際は三角形を二つ組み合わせて描画(右上と左下を結ぶ対角線で分割)しているため、\n頂点の位置関係により凹となる頂点が生じた場合は正しく描画されない。必ず各頂点が凸となるような位置関係で指定する必要がある。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_FREEVERT_SET_VERTICES</dt><dd>\n頂点を再設定する。\n<ul><li>UI_FREEVERT_SET_VERTICES \n<pre class=\"wiki\">   pFVI= UI_FreeVertItem(...)\n   sysCommand(pFVI, UI_FREEVERT_SET_VERTICES, &lt;vertices array&gt;)\n\n   &lt;vertices array&gt; = {\n     &lt;x0&gt;, &lt;y0&gt;,   -- left top\n     &lt;x1&gt;, &lt;y1&gt;,   -- right top\n     &lt;x2&gt;, &lt;y2&gt;,   -- right bottom\n     &lt;x3&gt;, &lt;y3&gt;    -- left bottom\n   }\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FREEVERT_SET_COLORS</dt><dd>\n4つの頂点カラー(RGBA)を配列で与え、同時に設定する。\n頂点カラーにはデフォルトで 0xff(alpha)+0xffffff(RGB) が与えられているが、これを変更できる。\n<ul><li>UI_FREEVERT_SET_COLORS\n<pre class=\"wiki\">   pFVI= UI_FreeVertItem(...)\n   sysCommand(pFVI, UI_FREEVERT_SET_COLORS, &lt;color array&gt;)\n\n   &lt;color array&gt; = {\n     &lt;alpha0&gt;, &lt;rgb0&gt;,  -- ex) 0xff, 0xffffff,\n     &lt;alpha1&gt;, &lt;rgb1&gt;,\n     &lt;alpha2&gt;, &lt;rgb2&gt;,\n     &lt;alpha3&gt;, &lt;rgb3&gt;\n   }\n</pre></li></ul></dd></dl>\n<dl><dt>UI_FREEVERT_SET_VERT_COL</dt><dd>\n頂点カラーを個別に設定する。カラーを変更する頂点はインデックスで指定される。\n<ul><li>UI_FREEVERT_SET_VERT_COL\n<pre class=\"wiki\">   pFVI= UI_FreeVertItem(...)\n   sysCommand(pFVI, UI_FREEVERT_SET_VERT_COL, &lt;idx&gt;, &lt;alpha&gt;, &lt;rgb&gt; )\n\n   &lt;idx&gt;: 左上を 0 とし、時計廻りに増加。\n</pre></li></ul></dd></dl>\n<p>\nUI_FREEVERT_SET_UV::\n</p>\n<blockquote>\n<p>\n4つの頂点についてUV値を同時に設定する。\n</p>\n</blockquote>\n<ul><li>UI_FREEVERT_SET_UV\n<pre class=\"wiki\">   pFVI = UI_FreeVertItem(...)\n   sysCommand(pFVI, UI_FREEVERT_SET_UV, &lt;UV array&gt;)\n\n   &lt;UV array&gt; = {\n     &lt;u0&gt;, &lt;v0&gt;,   -- left top\n     &lt;u1&gt;, &lt;v1&gt;,   -- right top\n     &lt;u2&gt;, &lt;v2&gt;,   -- right bottom\n     &lt;u3&gt;, &lt;v3&gt;    -- left bottom\n   }\n   ※各UVは、指定された画像内の幅、高さを 0.0～1.0で正規化した値。テクスチャアトラス内(.texb)の正規化座標ではないことに注意。\n</pre></li></ul>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Group.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Group – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Group\">UI_Group<a title=\"このセクションへのリンク\" href=\"#UI_Group\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Group( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;)\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 座標\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Group タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n表示物を持たず、概念的に位置情報のみを保持するUIタスク。\n他の表示系UIタスクの&lt;parent pointer&gt;として機能する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_GROUP_ANIM_CALLBACK</dt><dd>\n自身の下に接続されたUIの中に定義されたアニメーションの再生を、自身から発行する際に用いるコールバック関数を指定する。\n<ul><li>UI_GROUP_ANIM_CALLBACK\n<pre class=\"wiki\">   pGrp= UI_Group(...)\n   sysCommand(pGrp, UI_GROUP_ANIM_CALLBACK, \"&lt;callback func name&gt;\")\n\n   コールバックの型は下記の通り。\n\n   function &lt;callback name&gt;(pGrp, name, id)\n   end\n\n    pGrp  アニメーションを終了させたUI_Grpタスクのポインタ\n    name  終了したアニメーションの名前\n    id    アニメーション起動時に与えたID(必ず0になる)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GROUP_ANIMATION</dt><dd>\n名前を指定して、自身以下に接続されたUIの持つアニメーションを開始させる。\n<ul><li>UI_GROUP_ANIMATION\n<pre class=\"wiki\">   pGrp = UI_Group(...)\n   sysCommand(pGrp, UI_GROUP_ANIMATION, \"&lt;animation name&gt;\" [, &lt;blend flag&gt;])\n\n     &lt;animation name&gt; アニメーションの名前\n     &lt;blend flag&gt; 補間フラグ。指定しない場合はfalseと同じ扱いとなる。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GROUP_IS_ANIM</dt><dd>\n現在アニメーションが再生されているか否かをbooleanで返す。\n<ul><li>UI_GROUP_IS_ANIM\n<pre class=\"wiki\">   pGrp = UI_Group(...)\n   &lt;result&gt; = sysCommand(pGrp, UI_GROUP_IS_ANIM [, \"&lt;animation name&gt;\" ] )\n\n   &lt;animation name&gt; で指定された名称のアニメーションについて、現在動いているノードがあれば true, 再生が終了していれば false を返す。\n   &lt;animation name&gt; を指定しない、または nil を指定することで全てのアニメーションについて確認できる。\n　　　　　　この場合、trueであればいずれかのアニメーションが再生中、falseであれば全てのアニメーションが終了している。\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Label.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Label – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Label\">UI_Label<a title=\"このセクションへのリンク\" href=\"#UI_Label\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Label( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;,\n                             &lt;alpha&gt;, &lt;rgb&gt;, \"&lt;font name&gt;\", &lt;font size&gt;, \"&lt;text string&gt;\")\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;alpha&gt; ラベル表示alpha値\n</li><li>&lt;rgb&gt; ラベル表示RGB値\n</li><li>&lt;font name&gt; 使用するフォント名\n</li><li>&lt;font size&gt; 使用するフォントサイズ\n</li><li>&lt;text string&gt; ラベル文字列\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Label タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n位置、表示色、フォントとサイズを指定し、文字列を描画する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_LABEL_SET_TEXT</dt><dd>\n表示テキストを再設定する。\n<ul><li>UI_LABEL_SET_TEXT \n<pre class=\"wiki\">   pLabel = UI_Label(...)\n   sysCommand(pLabel, UI_LABEL_SET_TEXT, \"&lt;new text string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LABEL_SET_COLOR</dt><dd>\nラベルの表示色を設定する\n<ul><li>UI_LABEL_SET_COLOR\n<pre class=\"wiki\">   pLabel = UI_Label(...)\n   sysCommand(pLabel, UI_LABEL_SET_COLOR, &lt;alpha&gt;, &lt;rgb&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LABEL_SET_FONT</dt><dd>\nフォントを再設定する\n<ul><li>UI_LABEL_SET_FONT\n<pre class=\"wiki\">   pLabel = UI_Label(...)\n   sysCommand(pLabel, UI_LABEL_SET_FONT, \"&lt;font name&gt;\", &lt;font size&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LABEL_SET_POSITION</dt><dd>\nラベルの表示位置を再設定する\n<ul><li>UI_LABEL_SET_POSITION\n<pre class=\"wiki\">   pLabel = UI_Label(...)\n   sysCommand(pLabel, UI_LABEL_SET_POSITION,  &lt;x&gt;, &lt;y&gt;)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_List.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_List – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_List\">UI_List<a title=\"このセクションへのリンク\" href=\"#UI_List\" class=\"anchor\"> ¶</a></h2>\n<hr>\n<h3 id=\"ご注意\">!!!ご注意!!!<a title=\"このセクションへのリンク\" href=\"#%E3%81%94%E6%B3%A8%E6%84%8F\" class=\"anchor\"> ¶</a></h3>\n<p>\n<strong>UI_List は非常に多機能であり、使用方法についてもっとも質問の多いタスクであるため、</strong>\n<strong>質問や不具合報告を行う前に、必ず FAQ およびマニュアルを確認することを推奨します。</strong>\n</p>\n<ul><li><a class=\"wiki\" href=\"FAQ.html#UI_FormUI_List%E5%85%B1%E9%80%9A%E7%B7%A8\">FAQ:UI_Form/UI_List共通編</a>\n</li><li><a class=\"wiki\" href=\"FAQ.html#UI_List%E7%B7%A8\">FAQ:UI_List編</a>\n</li></ul><hr>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_List( &lt;parent pointer&gt;, \n                             &lt;base priority&gt;, &lt;max order&gt;,\n                             &lt;x&gt;, &lt;y&gt;, &lt;clip width&gt;, &lt;clip height&gt;,\n                             &lt;default line step&gt;, &lt;vertical flag&gt;, \"&lt;drag callback&gt;\" [ , &lt;option flags&gt; ] )\n\n\n   function &lt;drag callback&gt;(&lt;task pointer&gt;, &lt;type&gt;, &lt;tap-x&gt;, &lt;tap-y&gt;, &lt;move-x&gt;, &lt;move-y&gt;)\n\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;base priority&gt; 基準表示プライオリティ\n</li><li>&lt;max order&gt; クリッピング対象とする最大プライオリティ値\n</li><li>&lt;x&gt;, &lt;y&gt; クリッピング領域とする領域の位置\n</li><li>&lt;clip width&gt;, &lt;clip height&gt; クリッピング領域のサイズ\n</li><li>&lt;default line step&gt; デフォルトの項目間隔（アイテムの幅）\n</li><li>&lt;vertical flag&gt; 縦方向リストフラグ。trueで縦方向、falseで横方向\n</li><li>&lt;drag callback&gt; リストをドラッグ操作した際のコールバック。nil を指定した場合はコールバックを呼ばない。\n</li><li>&lt;option flags&gt; 動作オプションのフラグ\n<ul><li>LIST_FLAG_BOTTOM アイテムとなるフォームを並べる軸線を、横スクロールであればクリッピング領域の下端、縦スクロールであれば右端に設定する。\n</li><li>LIST_FLAG_MODAL  モーダルコントロールとして生成する(<a class=\"wiki\" href=\"modalstack.html\">モーダルスタックについて</a>)\n</li></ul></li></ul><blockquote>\n<p>\n※LIST_FLAG_BOTTOM を使用する場合、アイテムとして追加されるフォームの起点が軸線上に来るため、データ作成上注意が必要。\n</p>\n</blockquote>\n<ul><li>&lt;task pointer&gt; コールバックを呼び出した UI_List タスクのポインタ\n</li><li>&lt;type&gt; タッチパネル操作の種類\n</li><li>&lt;tap-x&gt; 今回の操作が始まった時点におけるタップ位置x座標\n</li><li>&lt;tap-y&gt; 今回の操作が始まった時点におけるタップ位置y座標\n</li><li>&lt;move-x&gt; タップ位置から今回のイベントが検出された位置までのx方向差分\n</li><li>&lt;move-y&gt; タップ位置から今回のイベントが検出された位置までのy方向差分\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_List タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nUIエディタで生成されたJSONを項目として、複数のフォームを縦または横に並べたリストを表示/管理するタスクを生成する。\n</p>\n<h3 id=\"プロパティ\">プロパティ<a title=\"このセクションへのリンク\" href=\"#%E3%83%97%E3%83%AD%E3%83%91%E3%83%86%E3%82%A3\" class=\"anchor\"> ¶</a></h3>\n<ul><li>.margin_top (integer:default = 0)  先端マージンサイズ(integer)\n</li><li>.margin_bottom (integer:default = 0)  終端マージンサイズ(integer)\n</li><li>.default_scroll (boolean:default = false)  起動時に指定された &lt;drag callback&gt;がnilの場合、trueでデフォルトドラッグスクロールが有効になる。\n</li></ul><h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_LIST_ITEM_ADD</dt><dd>\nリストの末尾に項目を追加する。項目は JSON asset または同じ構造のLuaテーブルで与えられる。\n<ul><li>UI_LIST_ITEM_ADD\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ITEM_ADD, \"&lt;form JSON asset&gt;\" [, &lt;step by prev&gt;, &lt;item-id&gt; ] )\n   sysCommand(pList, UI_LIST_ITEM_ADD, &lt;form Lua table&gt; [, &lt;step by prev&gt;, &lt;item-id&gt; ] )\n\n   &lt;item-id&gt; 0以上の値を持つ任意の整数値\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_ITEM_ID</dt><dd>\n指定されたindex値を持つアイテムに、任意のID値を与える。\n<ul><li>UI_LIST_SET_ITEM_ID\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_ITEM_ID, &lt;index&gt;, &lt;item-id&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SEARCH_ID</dt><dd>\n指定されたID値を持つアイテムを検索し、そのindex値を返す。\n<ul><li>UI_LIST_SEARCH_ID\n<pre class=\"wiki\">   pList = UI_List(...)\n   &lt;index&gt; = sysCommand(pList, UI_LIST_SEARCH_ID, &lt;item-id&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_ITEM_INSERT</dt><dd>\nリスト中の指定したindex位置に項目を挿入する。項目はJSON asset または同じ構造のLuaテーブルで与えられる。\n<ul><li>UI_LIST_ITEM_INSERT\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ITEM_INSERT, \"&lt;form JSON asset&gt;\", &lt;exist item index [, &lt;item-id&gt; ])\n   sysCommand(pList, UI_LIST_ITEM_INSERT, &lt;form Lua table&gt;, &lt;exist item index&gt; [, &lt;item-id&gt; ])\n\n   &lt;item-id&gt; 0以上の値を持つ任意の整数値\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_ITEM_REMOVE</dt><dd>\nリスト中の指定したindex位置にある項目を削除する。\n<strong>indexはその場で先頭に詰めます</strong>\n<ul><li>UI_LIST_ITEM_REMOVE\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ITEM_REMOVE, &lt;exist item index&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_ITEM_MOVE</dt><dd>\n&lt;src-index&gt;で指定されたアイテムのindex位置が、&lt;dst-index&gt;になるように移動する。\nただし、index値として指定できるのは0～(アイテム総数-1)に限られ、この範囲を超えると末尾に移動する。\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ITEM_MOVE, &lt;src-index&gt;, &lt;dst-index&gt;)\n</pre></dd></dl>\n<dl><dt>UI_LIST_ITEM_REMOVE_SELECTION</dt><dd>\nLuaテーブルで指定されたリスト中に含まれる複数のindex位置にある項目をまとめて削除する。\n<ul><li>UI_LIST_ITEM_REMOVE_SELECTION\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ITEM_REMOVE_SELECTION, &lt;item-index-array&gt;)\n\n   ex) sysCommand(pList, UI_LIST_ITEM_REMOVE_SELECTION, { 0, 3, 8, 12 } )\n\n     indexが 0, 3, 8, 12 のアイテムをまとめて削除します。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_LOOPMODE</dt><dd>\nリストの先端と終端が連結され、アイテムがループする動作モードの有効/無効を設定する。\nリスト全体の長さがクリッピングエリアより短い場合、ループ動作モードはループ動作にならず、UI_LIST_SET_LIMITCLIPによる設定に準じた動作となる。\n<ul><li>UI_LIST_SET_LOOPMODE\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_LOOPMODE, &lt;loop-mode&gt;)\n\n   &lt;loop-mode&gt; true:ループ有効 / false:ループ無効\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_ITEMMODE</dt><dd>\nリストにおけるアイテムの保持モードを設定する。\n<ul><li>UI_LIST_SET_ITEMMODE\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(plist, UI_LIST_SET_ITEMMODE, &lt;item-mode&gt; [ , &lt;into-callback&gt; ])\n\n   &lt;item-mode&gt; として設定可能な値\n\n     LIST_ITEM_NORMAL    NORMALモード: アイテム追加時点でformを作成する。UI_LIST_UPDATE_NODEコマンドによるノードの更新が可能。\n\n     LIST_ITEM_DYNAMIC   DYNAMICモード: アイテム追加時点でformのjsonのみを保持し、クリッピング領域内に入った時点でformを生成、\n                         領域外に出たときにformを破棄する。formの状態を保持することができないので、UI_LIST_UPDATE_NODE コマンドによる\n                         ノードの更新は禁止される。表示分のみformを生成するため、assetによるメモリ資源の消費を抑えることができる。\n\n   &lt;into-callback&gt; アイテムがクリップ領域に入った時に呼ばれるコールバック。\n\n     function &lt;into-callback&gt;( pList , &lt;item-index&gt;, &lt;item-id&gt; )\n\n     end\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_MARGIN</dt><dd>\nリストスクロール範囲の先端と終端における、アイテム以前/以後の余白となる領域のサイズを指定する。\n<ul><li>UI_LIST_SET_MARGIN\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_MARGIN, &lt;margin-top&gt;, &lt;margin-bottom&gt;)\n\n   ※プロパティ .margin_top および .margin_bottom でも値は操作可能。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_POSITION</dt><dd>\nリスト項目のスクロール位置を指定する。スクロール方向は縦か横どちらかなので、位置を表す値は一つのみ。実際に設定された値を返す。\nまた、ループ動作モード時など、あるポジションに行くために二つのスクロール方向がある場合のため、\nスクロール方向を指定する値として &lt;dir&gt; を指定することができる。 &lt;dir&gt;に指定する値は 1(増加方向)あるいは -1(減少方向)となる。\n<ul><li>UI_LIST_SET_POSITION\n<pre class=\"wiki\">   pList = UI_List(...)\n   &lt;set position X or Y&gt; = sysCommand(pList, UI_LIST_SET_POSITION, &lt;position X or Y&gt; [ , &lt;dir&gt; ] )\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_GET_POSITION</dt><dd>\n現在のスクロール位置を取得する。\n<ul><li>UI_LIST_SET_POSITION\n<pre class=\"wiki\">   pList = UI_List(...)\n   &lt;position X or Y&gt; = sysCommand(pList, UI_LIST_GET_POSITION)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_INITIAL</dt><dd>\nリスト項目の初期位置を指定する。UI_LIST_SET_POSITION と基本的に同じだが、\nスクロールマネージャによるアニメーションを伴わず、瞬時にその位置まで移動する。表示開始時の初期位置指定等に使用する。\n<ul><li>UI_LIST_SET_INITIAL\n<pre class=\"wiki\">   pList = UI_List(...)\n   &lt;set position X or Y&gt; = sysCommand(pList, UI_LIST_SET_INITIAL, &lt;position X or Y&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_ITEM_POS</dt><dd>\nインデックスで指定したリスト中のアイテムが、クリッピング領域内にはいるように、スクロール位置を自動設定する。\n<ul><li>UI_LIST_SET_ITEM_POS\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_ITEM_POS, &lt;position mode&gt;, &lt;exist item index&gt; [, &lt;offset&gt; ])\n   \n   &lt;position mode&gt; は下記の中から選択する。\n\t\tLIST_VIEW_TOP    クリッピング領域の上端にアイテム上端を合わせる\n\t\tLIST_VIEW_CENTER クリッピング領域の中央にアイテムが来るように合わせる\n\t\tLIST_VIEW_END    クリッピング領域の下端にアイテム下端を合わせる\n                LIST_VIEW_OFFSET クリッピング領域の上端を基準とした指定オフセット位置にアイテム上端を合わせる\n\n   ※ &lt;offset&gt; は &lt;position mode&gt;がLIST_VIEW_OFFSET以外の時に指定されるとエラーとなるので注意。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_CHANGE_STEP</dt><dd>\nインデックスで指定したリスト中のアイテムが占有するスクロール幅を変更する\n<ul><li>UI_LIST_CHANGE_STEP\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_CHANGE_STEP, &lt;exist item index&gt;, &lt;new step&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_LIMITCLIP</dt><dd>\nリストの上端および下端を超えたスクロールの許可/禁止を設定する。デフォルト状態では禁止状態。\nスクロールの結果、が両端に達した際呼ばれるコールバックを指定できる。\nこのコールバックは、&lt;limit clip enable&gt;がtrueのときは両端に達した/離れたとき、falseの場合は両端からの領域に入った/出たときに呼ばれる。\n<ul><li>UI_LIST_SET_LIMITCLIP\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_LIMITCLIP, &lt;limit clip enable&gt; [, \"&lt;limit callback&gt;\" ] )\n   \n   &lt;limit clip enable&gt; true でクリップあり(禁止)、falseでクリップなし(許可)\n\n   &lt;limit callback&gt; スクロールの結果、リスト両端から一定の範囲がクリッピング領域に入った際に呼ばれるコールバック関数の名前。\n\n   function &lt;limit callback&gt;(&lt;list task pointer&gt;, &lt;mode&gt;, &lt;items&gt;, &lt;length&gt;, &lt;pos&gt;)\n   end\n\n   &lt;list task pointer&gt; 呼び出し元 UI_List タスクのポインタ\n   &lt;mode&gt;              LIST_SCROVER_TOP(先頭側) / LIST_SCROVER_BOTTOM(末端側) / LIST_SCROVER_TAKEOFF(先頭または末端を離れた)のいずれか。\n   &lt;items&gt;             現在のアイテム総数\n   &lt;length&gt;            現在のスクロール範囲長さ\n   &lt;pos&gt;               現在のスクロール位置\n\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_LIMITAREA</dt><dd>\nUI_LIST_SET_LIMITCLIP で超過スクロール警告コールバックを指定した際、呼び出し条件となる両端からの範囲のサイズを指定する。\n0 を指定すると両端からクリッピング領域のサイズ(1画面分)と同じ値となり、デフォルトではこの状態となる。\n<ul><li>UI_LIST_SET_LIMITAREA\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_LIMITAREA, &lt;limit area size&gt; )\n   \n   &lt;limit area size&gt; コールバック呼び出しの条件となる両端からの範囲のサイズ\n</pre></li></ul></dd></dl>\n<blockquote>\n<p>\nUI_LIST_SET_LIMITCLIP で false とコールバックを指定したとき、UI_LIST_SET_LIMITAREA で設定された範囲は下図のような概念で扱われます。\n</p>\n</blockquote>\n<p>\n<a style=\"padding:0; border:none\" href=\"assets/LimitClipFalse.png\"><img src=\"assets/LimitClipFalse.png\"></a>\n</p>\n<dl><dt>UI_LIST_GET_LIMIT</dt><dd>\n現在のリスト下端がクリッピング領域の下端に来るスクロール値を返す。\n<ul><li>UI_LIST_GET_LIMIT\n<pre class=\"wiki\">   pList = UI_List(...)\n   &lt;limit position X or Y&gt; = sysCommand(pList, UI_LIST_GET_LIMIT)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_EXIST_NODE</dt><dd>\nリスト内に含まれるノードを名前で検索し、存在するか否かを返す。\n<strong>&lt;target index&gt;は0から始まる。</strong>\n<ul><li>UI_LIST_EXIST_NODE\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_EXIST_NODE, &lt;target index&gt;, \"&lt;node name&gt;\")\n\n   &lt;target index&gt;  対象アイテムのindex\n   &lt;node name&gt;     ノードの名称\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_UPDATE_NODE</dt><dd>\nリスト内に含まれるノードを名前で検索し、サブコマンドで指定された操作を行う。\n<strong>&lt;target index&gt;は0から始まる。</strong>\n<ul><li>UI_LIST_UPDATE_NODE\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, &lt;subcommand&gt;, ... )\n\n\n   &lt;node identifier&gt;  ノードの名称\"&lt;node name&gt;\"または、FORM_NODE_POINTER で取得される &lt;node pointer&gt; いずれか\n\n\n   引数の数と意味は &lt;subcommand&gt; の値ごとに異なる。\n   &lt;subcommand&gt;の値は UI_Form と共通の定数を使用する。また、&lt;subcommand&gt;以降の書式は UI_Formと共通。\n\n   FORM_NODE_～: 全ノード共通処理\n     &lt;node pointer&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_POINTER)  ノードポインタ取得\n\n      ※取得されるポインタは SceneGraph上に存在するノードのポインタであり、そのノードが持つタスクのポインタではないことに注意。\n        タスクのポインタを取得する場合は、FORM_NODE_TASK サブコマンド(後述)を使用。\n\n\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_RECURSIVE, \"&lt;function name&gt;\") ノード再帰処理\n\n\n       function &lt;function name&gt;(&lt;parent task pointer&gt;, &lt;node pointer&gt;, &lt;index&gt;, &lt;level&gt;)\n         -- &lt;parent task pointer&gt;  呼び出し元UI_Listタスクのポインタ\n         -- &lt;node pointer&gt;         再帰処理対象となるノードのポインタ\n         -- &lt;index&gt;                アイテムインデックス。UI_ListではFORM_NODE_RECURSIVEで指定した &lt;target index&gt; の値\n         -- &lt;level&gt;                再帰呼び出しの階層。FORM_NODE_RECURSIVEで指定した&lt;node identifier&gt;に該当するノードが0、以降、階層を子の側に辿るごとに+1される\n       end\n\n\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_TRANS, &lt;x&gt;, &lt;y&gt;)           移動\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_SCALE, &lt;scaleX&gt;, &lt;scaleY&gt;) 表示倍率指定\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;\", FORM_NODE_ROT, &lt;rotation-degree&gt;)    回転角指定。正の方向で時計回り。単位はdegree.\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_COLOR, &lt;alpha&gt;, &lt;RGB&gt; )    表示RGBおよびalpha指定\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_VISIBLE, &lt;visible flag&gt; )  表示/非表示切り替え\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_ORDER, &lt;priority&gt; )        表示プライオリティ指定\n     &lt;node order&gt;   = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_GET_ORDER)表示プライオリティ取得\n     &lt;task pointer&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_NODE_TASK)     指定のノードを持つタスクポインタを取得\n\n      ※FORM_NODE_TASK で取得できるのは、Compositeで指定され起動されたタスクのみであり、\n         UI_GENERIC_RECONNECT_NODE 等を使用してスクリプトから後天的に接続したタスクについては対象とならない。\n         そのようなタスクについては、別途スクリプタの責任においてタスクのポインタを保持すること。\n\n\n   FORM_UIE_～: CKLBUIElement型用\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIE_SET_ENABLED, &lt;enabled flag&gt; )           有効/無効切り替え\n     &lt;enabled flag&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIE_GET_ENABLED)           有効/無効状態取得\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIE_SET_ASSET, &lt;asset path&gt;, &lt;asset type&gt; ) 表示asset変更\n\n     &lt;asset type&gt; は、form中で使用される目的別の分類。\n\t\tFORM_ASSET_NORMAL    通常時\n\t\tFORM_ASSET_DISABLED  無効時\n\t\tFORM_ASSET_FOCUSED   フォーカス時(タッチパネルデバイスでは無意味)\n\t\tFORM_ASSET_PUSHED    押された時\n\n    sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIE_SET_TEXT, \"&lt;new text&gt;\" )                 ラベルテキスト変更(ラベル以外は無視)\n     ※現状未実装\n\n\n   FORM_UIS_～: CKLBUISelectable型用\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIS_SET_CLICK, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt; ) クリック範囲指定\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIS_SET_STICK, &lt;stick flag&gt; )                チェックボックス状態指定\n     &lt;sticked status&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIS_GET_STICK)            チェックボックス状態取得\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_UIS_SET_RADIO, &lt;radio ID&gt; )                  ラジオボタンID指定\n\n   FORM_CONT_～: CKLBUIContainer型用\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_CONT_VIEWOFFSET, &lt;offsetX&gt;, &lt;offsetY&gt; )      View内表示offset指定\n     &lt;radio value&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_CONT_GET_RADIO_VALUE)        ラジオボタン値取得\n\n   FORM_TEXT_～: CKLBUITextBox型用\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_TEXT_SET, &lt;text string&gt; )                    テキストボックス文字列設定\n     &lt;text string&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_TEXT_GET)                    テキストボックス文字列取得\n   \n   FORM_WEB_～: CKLBUIWebView型用\n     sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_WEB_SET_URI, &lt;URI string&gt; )                  WebView 表示 URI 指定\n     &lt;URI string&gt; = sysCommand(pList, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_WEB_GET_URI)                  現在の URI 文字列取得\n\n   FORM_LBL_～: CKLBLabelNode型用\n     sysCommand(pForm, UI_LIST_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_LBL_SET_TEXT, \"&lt;new text&gt;\" )                ラベルテキスト変更\n     &lt;text string&gt; = sysCommand(pForm, UI_FORM_UPDATE_NODE, &lt;target index&gt;, &lt;node identifier&gt;, FORM_LBL_GET_TEXT)               ラベルテキスト取得\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_INPUT_ENABLE</dt><dd>\nリスト各項目の表示状態を変えずに操作を許可/禁止する。\n<ul><li>UI_LIST_INPUT_ENABLE\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pLilst, UI_LIST_INPUT_ENABLE, &lt;enable flag&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_ANIM_CALLBACK</dt><dd>\nフォームのアニメーションコールバックを指定する。\n<ul><li>UI_LIST_ANIM_CALLBACK\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ANIM_CALLBACK, \"&lt;callback name&gt;\")\n\n   コールバックの型は下記の通り。\n\n   function &lt;callback name&gt;(pList, name, id)\n   end\n\n    pList アニメーションを終了させたUI_Listタスクのポインタ\n    name  終了したアニメーションの名前\n    id    アニメーション起動時に与えたID(リストアイテムのindex値と同じ,あるいは-1)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_ANIMATION_ITEM</dt><dd>\n名前を指定して、listの持つアイテムのうち、&lt;item index&gt;で指定されたアイテムのアニメーションを開始させる。\nUI_LIST_ANIM_CALLBACKが使用されている場合、id値として&lt;item index&gt;が渡される。\n<ul><li>UI_LIST_ANIMATION_ITEM\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ANIMATION_ITEM, &lt;item index&gt;, \"&lt;animation name&gt;\" [, &lt;blend flag&gt;])\n\n     &lt;item index&gt; アニメーションさせるアイテムのindex\n     &lt;animation name&gt; アニメーションの名前\n     &lt;blend flag&gt; Form中のアニメーションとの補間フラグ。指定しない場合はfalseと同じ扱いとなる。\n                  trueであればこのコマンドで最初に指定した時にだけ再生を行い、\n                  falseであれば指定される都度に再生される。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_ANIMATION_ALL</dt><dd>\n名前を指定して、listの持つ全てのアイテムのアニメーションを開始させる。\nUI_LIST_ANIM_CALLBACKが使用されている場合、渡されるid値は -1 となる。\n<ul><li>UI_LIST_ANIMATION_ALL\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_ANIMATION_ALL, \"&lt;animation name&gt;\" [, &lt;blend flag&gt;])\n\n     &lt;animation name&gt; アニメーションの名前\n     &lt;blend flag&gt; Form中のアニメーションとの補間フラグ。指定しない場合はfalseと同じ扱いとなる。\n                  trueであればこのコマンドで最初に指定した時にだけ再生を行い、\n                  falseであれば指定される都度に再生される。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_USE_SCROLLBAR</dt><dd>\nUI_List の組み込みスクロールバーを表示させる。\nスクロールバーは縦スクロールの場合は左右いずれか、横スクロールの場合は上下いずれかに表示させることができる。\n<ul><li>UI_LIST_USE_SCROLLBAR\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_USE_SCROLLBAR, &lt;order&gt;, &lt;side&gt;, &lt;line-weight&gt;, &lt;image&gt;, &lt;min-slider-size&gt;,\n              \"&lt;callback&gt;\", &lt;alpha-normal&gt;, &lt;color-normal&gt;, &lt;alpha-select&gt;, &lt;color-select&gt;, &lt;active&gt; [ , &lt;hide-mode&gt; ] )\n\n   &lt;order&gt;   表示プライオリティ\n   &lt;side&gt;            スクロールバーの表示位置。true で右側または下側、falseで左側または上側\n   &lt;line-weight&gt;     スクロールバーの太さ。表示領域サイズに使用される。\n   &lt;image&gt;           スクロールバーのスライダ表示に使用される画像asset名。\n   &lt;min-slider-size&gt; スクロール領域の変動に伴うスライダサイズ変更時の最小サイズ\n   &lt;callback&gt;        スクロールバーによるコールバックの関数名称(不要な場合は nil を指定)\n\n   &lt;alpha-normal&gt;    通常時のスライダ表示アルファ値\n   &lt;color-normal&gt;    通常時のスライダ表示カラー\n   &lt;alpha-select&gt;    選択/操作時のスライダ表示アルファ値\n   &lt;color-select&gt;    選択/操作時のスライダ表示\n   &lt;active&gt;          ユーザによるスクロールバー自体の操作可否(true:許可/false:禁止)\n   &lt;hide-mode&gt;       手を放して1秒後にフェードアウトするモードの使用(true:有効/false:無効)\n\n\n   ※コールバック関数仕様\n   function &lt;callback&gt;(&lt;pList&gt;, &lt;type&gt;, &lt;pos&gt;)\n\n   end\n\n   &lt;pList&gt;    呼び出し元となるスクロールバーを持つUI_Listタスクのポインタ\n   &lt;type&gt;     操作の種類。0(Drag) または 1(Release)\n   &lt;pos&gt;      スクロールバーの値\n\n\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SELECT_SCRMGR</dt><dd>\n名前を指定してスクロールバーが使用するスクロールマネージャを選択し、必要に応じてそのパラメータを与える。\n<ul><li>UI_LIST_SELECT_SCRMGR\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SELECT_SCRMGR, \"&lt;manager-name&gt;\" [, ... ])\n\n     &lt;manager-name&gt; スクロールマネージャ名称\n\n     ※現在、スクロールマネージャは下記のものが用意されている。()内はパラメータ\n       \"default\" 指定位置まで急加速→減速の動きでスクロールする([, &lt;delay&gt; ])\n       \"solid\"   一切の補間処理なく指定位置にそのフレームで即ジャンプする(パラメータなし)\n       \"page\"    一定単位を「ページサイズ」とし、その境界単位でスクロールする(, &lt;page-size&gt; [, &lt;delay&gt; [ , &lt;stopline-offset&gt; ] ])\n\n         &lt;stopline-offset&gt; クリッピング領域上端からページ境界の停止位置オフセット\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SCRMGR_CALLBACK</dt><dd>\nスクロールマネージャレベルのコールバックを指定する。\nコールバックはスクロールマネージャがそのフレーム処理の中でスクロールを停止した時点で呼ばれる。\n<ul><li>UI_LIST_SCRMGR_CALLBACK\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SCRMGR_CALLBACK, \"&lt;callback-function-name&gt;\")\n\n   function &lt;callback-function-name&gt;( &lt;task-pointer&gt;, &lt;pos&gt; )\n     -- &lt;task-pointer&gt;  親となるUI_Listのポインタ\n     -- &lt;pos&gt;           停止した時点のスクロール位置\n   end\n\n   ※スクロール停止位置が前回の停止位置と同じ場合はコールバック関数は呼ばれない（仕様）\n</pre></li></ul></dd></dl>\n<dl><dt>UI_LIST_SET_GROUP</dt><dd>\nリストにグループ名を与える。同じグループ名を持つ UI_Form および UI_List は同一のグループに所属すると見做され、操作の排他制御が行われる。\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_GROUP, \"&lt;group-name&gt;\")\n</pre></dd></dl>\n<dl><dt>UI_LIST_SET_CLIP</dt><dd>\nクリッピングを再設定する機能です。start_priorityとend_priorityも設定できるが、-1に設定した場合、前の値のままになります。\n</dd></dl>\n<p>\nそして、x,yは基本的に0だが、自由に設定できる。\n</p>\n<blockquote>\n<p>\nwidth == 0 and height == 0の場合、クリップが無効になります。\n</p>\n</blockquote>\n<blockquote>\n<p>\nwidth != 0 or height != 0の場合、クリップ有効になります。\n</p>\n<pre class=\"wiki\">   pList = UI_List(...)\n   sysCommand(pList, UI_LIST_SET_CLIP, start_priority, end_priority, x, y, width, height)\n</pre></blockquote>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_MoviePlayer.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_MoviePlayer – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_MoviePlayer\">UI_MoviePlayer<a title=\"このセクションへのリンク\" href=\"#UI_MoviePlayer\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_MoviePlayer( &lt;parent pointer&gt;, &lt;background mode&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;, \"&lt;movie asset&gt;\", \"&lt;callback&gt;\")\n\n   function &lt;callback&gt;(&lt;task pointer&gt;)\n\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;background mode&gt; trueでバックグラウンドモード(GLレイヤの後ろで動画を再生する)。falseでフォアグラウンドモード(GL画面の手前に再生Viewを作成)\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標。バックグラウンドモードでは無視される。\n</li><li>&lt;width&gt;, &lt;height&gt; 表示サイズ。バックグラウンドモードでは無視される。\n</li><li>&lt;movie asset&gt; 再生する動画asset。H.264推奨。\n</li><li>&lt;callback&gt; 再生終了時に呼び出されるコールバック関数名。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_MoviePlayer タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nOSのUI機能を使い、動画を再生する。\n</p>\n<p>\n動画の再生領域となる View はOSのコントロールとして生成される。\n</p>\n<p>\n必ずGL描画より手前(フォアグラウンドモード)または最奥(バックグラウンドモード)となり、GLによる描画中に混在させることはできない。\n</p>\n<h4 id=\"フォアグラウンドモード\">フォアグラウンドモード<a title=\"このセクションへのリンク\" href=\"#%E3%83%95%E3%82%A9%E3%82%A2%E3%82%B0%E3%83%A9%E3%82%A6%E3%83%B3%E3%83%89%E3%83%A2%E3%83%BC%E3%83%89\" class=\"anchor\"> ¶</a></h4>\n<p>\nGL画面の手前に動画再生領域を生成し、そこで動画を再生する。\nこの再生領域は、UI_MoviePlayerタスクと同じタイミングで破棄される。\n</p>\n<h4 id=\"バックグラウンドモード\">バックグラウンドモード<a title=\"このセクションへのリンク\" href=\"#%E3%83%90%E3%83%83%E3%82%AF%E3%82%B0%E3%83%A9%E3%82%A6%E3%83%B3%E3%83%89%E3%83%A2%E3%83%BC%E3%83%89\" class=\"anchor\"> ¶</a></h4>\n<p>\nGL画面の奥にあるView上で動画再生を行う。このため、GLによる描画が行われない領域については再生中の動画が表示されることになる。\n</p>\n<p>\nただし、デフォルトの状態ではGLのクリア色が不透明であるため、GLによる描画を行わない部分についても動画が表示されない。\nGL_ClearColor() 関数を用いGLのクリア色としてアルファ値が透過になるような背景色を設定する必要がある。\n</p>\n<pre class=\"wiki\">   function setup()\n       GL_ClearColor(0.0, 0.0, 0.0, 0.0)\n   end\n</pre><h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_MOVIE_SETPATH</dt><dd>\n再生する動画assetを再設定する\n<ul><li>UI_MOVIE_SETPATH\n<pre class=\"wiki\">   pMovie = UI_MoviePlayer(...)\n   sysCommand(pText, UI_MOVIE_SETPATH, \"&lt;new asset path&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_MOVIE_GETPATH</dt><dd>\n現在設定されている動画assetのパスを取得する。\n<ul><li>UI_MOVIE_GETPATH\n<pre class=\"wiki\">   pMovie = UI_MoviePlayer(...)\n   &lt;now asset path&gt; = sysCommand(pText, UI_MOVIE_GETPATH)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_MOVIE_PLAY</dt><dd>\n現在設定されている動画assetの再生を開始する。\n<ul><li>UI_MOVIE_PLAY\n<pre class=\"wiki\">   pMovie = UI_MoviePlayer(...)\n   sysCommand(pText, UI_MOVIE_PLAY)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_MOVIE_STOP</dt><dd>\n現在再生中の動画を停止する。\n<ul><li>UI_MOVIE_STOP\n<pre class=\"wiki\">   pMovie = UI_MoviePlayer(...)\n   sysCommand(pText, UI_MOVIE_STOP)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_MOVIE_PAUSE</dt><dd>\n現在再生中の動画を一時停止する。\n<ul><li>UI_MOVIE_PAUSE\n<pre class=\"wiki\">   pMovie = UI_MoviePlayer(...)\n   sysCommand(pText, UI_MOVIE_PAUSE)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_MOVIE_RESUME</dt><dd>\n現在一時停止中の動画再生を再開する。\n<ul><li>UI_MOVIE_RESUME\n<pre class=\"wiki\">   pMovie = UI_MoviePlayer(...)\n   sysCommand(pText, UI_MOVIE_RESUME)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_MultiImgItem.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_MultiImgItem – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_MultiImgItem\">UI_MultiImgItem<a title=\"このセクションへのリンク\" href=\"#UI_MultiImgItem\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_MultiImgItem( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;asset list&gt; [, &lt;index&gt;])\n\n   &lt;asset list&gt; = {\n      \"&lt;asset path&gt;\",\n         :\n   }\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;asset list&gt; 登録するassetリスト\n</li><li>&lt;index&gt; 初期表示に使用するassetのインデックス。指定しない場合は0を指定した場合と同じ扱いになる。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_MultiImgItem タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nあらかじめロードし保持しているassetを、インデックス指定で切り替えて表示できるタスク。\nスクリプト側の都合で表示を切り替えたいキャラクターなどに使用できる。\n</p>\n<p>\nロードされるassetは、&lt;asset list&gt;としてLuaテーブルの形で指定し、インデックスを指定することで切り替えられる。\nインデックスはLuaと異なり 0 を起点として与えるので注意すること。\n与えた&lt;asset list&gt;に記述された以上の範囲をindexが指した場合の動作は保証されない。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_MULTIIMG_SET_INDEX</dt><dd>\n表示に使用するassetのインデックスを変更する。\n<ul><li>UI_MULTIIMG_SET_INDEX\n<pre class=\"wiki\">   pMulti = UI_MultiImgItem(...)\n   sysCommand(pMulti, UI_MULTIIMG_SET_INDEX, &lt;index&gt;)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_PieChart.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_PieChart – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_PieChart\">UI_PieChart<a title=\"このセクションへのリンク\" href=\"#UI_PieChart\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_PieChart( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;,\n                              &lt;image asset&gt;, &lt;start-angle&gt;, &lt;end-angle&gt; [ , &lt;anim time&gt;, &lt;initial-value&gt; ])\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; 円グラフ全体の表示域サイズ\n</li><li>&lt;image asset&gt; 円グラフ変化部の画像\n</li><li>&lt;start-angle&gt; 0.0点となる角度。単位はdegree(0～360)\n</li><li>&lt;end-angle&gt; 1.0点となる角度。単位はdegree(&lt;start-angle&gt;+360.0まで)\n</li><li>&lt;anim time&gt; 値を指定してから、実際にグラフの表示がその値に到達するまでのアニメーション時間(単位: [ms])。0を指定するとアニメーション無し。\n</li><li>&lt;initial-value&gt; 初期値。0.0～1.0の間で指定(デフォルト値: 0.0)\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_PieChart タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n指定された長方形のテクスチャを中心点を頂点とし、指定角度で切り取って表示する。\n</p>\n<p>\n表示される角度は別途propertyやsysCommandで指定されるvalueの値(0.0～1.0)に比例する。\n</p>\n<p>\n通常は円グラフの表示に用いられるが、画像表示上の効果としても応用できるかもしれない。\n</p>\n<p>\n&lt;start-angle&gt; &lt;= &lt;end-angle&gt; の場合、&lt;value&gt;値の増加とともに円グラフは時計廻り方向に成長する。\n</p>\n<p>\n&lt;start-angle&gt; &gt;= &lt;end-angle&gt; の場合、&lt;value&gt;値の増加とともに円グラフは反時計廻り方向に成長する。\n</p>\n<h3 id=\"制約事項\">制約事項<a title=\"このセクションへのリンク\" href=\"#%E5%88%B6%E7%B4%84%E4%BA%8B%E9%A0%85\" class=\"anchor\"> ¶</a></h3>\n<p>\nこのタスクを使用する上では下記の制約がある。\n</p>\n<ul><li>使用される画像assetは、必ず4頂点かつ、頂点indexが左上から時計回りに割り当てられている必要がある。\n</li><li>&lt;start-angle&gt;から&lt;end-angle&gt;までの角度は絶対値が360度を越えてはならない(例: &lt;start-angle&gt; = 270.0, &lt;end-angle&gt; = 630.0 などは可)。\n</li><li>&lt;start-angle&gt;と&lt;end-angle&gt;の差の絶対値が315度を超えるとき、&lt;start-angle&gt;は45度単位で指定されねばならない。\n</li></ul><p>\n上記の制約に抵触する値を指定した場合の動作は保証されない。\n</p>\n<p>\n二番目、三番目の制約がつく理由は下記の通り。\n</p>\n<p>\nUI_PieChart は、指定されたテクスチャを下記のように45°単位で8つの三角形に分割し、\nそれぞれの三角形を45°までのタンジェントを用い必要な角度分だけ表示することで実現されている。\nたとえば、0°位置から68°分だけを表示するならば、45°の三角形と23°の三角形二枚分となる。\n</p>\n<p>\n<a style=\"padding:0; border:none\" href=\"assets/piechart-1.png\"><img src=\"assets/piechart-1.png\"></a><a style=\"padding:0; border:none\" href=\"assets/tan45.png\"><img src=\"assets/tan45.png\"></a>\n</p>\n<p>\nこのため、表示角が360°を超えた場合、重複して表示する分の三角形を持たないため、\n&lt;start-angle&gt;から&lt;end-angle&gt;の間の角度は360°以下に限られる。\n</p>\n<p>\nまた、一つの45°エリアには一つの三角形しか割り当てられていない。\nこのため、開始角が45°境界に無い状態で、&lt;start-angle&gt;から&lt;end-angle&gt;の間が315°を超えると、\n下記のような問題が起こりうる。\n</p>\n<p>\n<a style=\"padding:0; border:none\" href=\"assets/piechart-2.png\"><img src=\"assets/piechart-2.png\"></a>\n</p>\n<p>\n下図において、右上の緑色に着色されたエリアには一つの三角形しかないが、\n実際に描画すべき三角形が二つ分生じてしまう。このため、正しい表示を保証することができなくなる。\n</p>\n<p>\nどうしてもこの制約に抵触する表現が必要な場合は、UI_PieChart の標準プロパティ .rot を使用して回転させることで実現できる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_PIE_SET_START</dt><dd>\n&lt;start-angle&gt;に相当する角度を指定する。\n<ul><li>UI_PIE_SET_START\n<pre class=\"wiki\">   pPieChart = UI_PieChart(...)\n   sysCommand(pPieChart, UI_PIE_SET_START, &lt;start-angle&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PIE_SET_END</dt><dd>\n&lt;end-angle&gt;に相当する角度を指定する。\n<ul><li>UI_PIE_SET_END\n<pre class=\"wiki\">   pPieChart = UI_PieChart(...)\n   sysCommand(pPieChart, UI_PIE_SET_END, &lt;end-angle&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PIE_SET_VALUE</dt><dd>\n円グラフの進捗を設定する。進捗は 0.0から 1.0の間(実数)で与える。\n<ul><li>UI_PIE_SET_VALUE\n<pre class=\"wiki\">   pPieChart = UI_PieChart(...)\n   sysCommand(pPieChart, UI_PIE_SET_VALUE, &lt;value&gt;)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Polyline.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Polyline – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Polyline\">UI_Polyline<a title=\"このセクションへのリンク\" href=\"#UI_Polyline\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Polyline( &lt;parent pointer&gt;, &lt;order&gt;, &lt;max-point-count&gt;)\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;max-point-count&gt; 最大頂点数\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Polyline タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n複数の頂点間を線分で結び、折れ線を描画する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_POLYLINE_SET_POINTCOUNT</dt><dd>\n起動時に指定した最大頂点数を超えない範囲で、頂点数を指定する。\n<ul><li>UI_POLYLINE_SET_POINTCOUNT\n<pre class=\"wiki\">   pPolyline = UI_Polyline(...)\n   sysCommand(pPolyline, UI_POLYLINE_SET_POINTCOUNT, &lt;point-count&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_POLYLINE_SET_COLOR</dt><dd>\nPolylineの表示色を設定する\n<ul><li>UI_POLYLINE_SET_COLOR\n<pre class=\"wiki\">   pPolyline = UI_Polyline(...)\n   sysCommand(pPolyline , UI_POLYLINE_SET_COLOR, &lt;alpha&gt;, &lt;rgb&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_POLYLINE_SET_POINT</dt><dd>\n&lt;point-index&gt;で指定される頂点の座標を設定する。\n<ul><li>UI_POLYLINE_SET_POINT\n<pre class=\"wiki\">   pPolyline = UI_Polyline(...)\n   sysCommand(pPolyline , UI_POLYLINE_SET_POINT, &lt;point-index&gt;, &lt;x&gt;, &lt;y&gt;)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_ProgressBar.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_ProgressBar – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_ProgressBar\">UI_ProgressBar<a title=\"このセクションへのリンク\" href=\"#UI_ProgressBar\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_ProgressBar( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;,\n                              &lt;full image&gt;, &lt;empty image&gt; [, &lt;start pix&gt;, &lt;end pix&gt;, &lt;anim time&gt;, &lt;vertical flag&gt;, &lt;barfilter image&gt;])\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; プログレスバー全体の表示域サイズ\n</li><li>&lt;full image&gt; 100%状態で使用する画像asset\n</li><li>&lt;empty image&gt; 0%状態で使用する画像asset\n</li><li>&lt;start pix&gt; ゲージ開始点となるpixel位置。縦方向か横方向かはバーの成長方向による。\n</li><li>&lt;end pix&gt; ゲージ終了店となるpixel位置。縦方向か横方向かはバーの成長方向による。\n</li><li>&lt;anim time&gt; バーの変化にかけるアニメーション時間(単位:[ms])\n</li><li>&lt;vertical flag&gt; 縦方向プログレスバーフラグ\n</li><li>&lt;barfilter image&gt; バーの長さに合わせて伸縮するフィルタ画像asset\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_ProgressBar タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n指定された二つの画像を適切な位置で分割し繋ぎ合わせることでプログレスバーの表示をおこなう。\nこのタスクを使用する上では下記の制約がある。\n</p>\n<ul><li>使用される画像assetは、必ず同一の .texb に含まれている必要がある(&lt;barfilter image&gt;含む)。\n</li><li>使用される画像assetは、必ず4頂点かつ、頂点indexが左上から時計回りに割り当てられている必要がある。\n</li></ul><p>\n上記の制約に当てはまらない画像assetを&lt;full image&gt;もしくは&lt;empty image&gt;に指定した場合の動作は保証されない。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_PROGRESS_RESET</dt><dd>\nプログレスバーの進捗を0にリセットする\n<ul><li>UI_PROGRESS_RESET\n<pre class=\"wiki\">   pProgressBar = UI_ProgressBar(...)\n   sysCommand(pProgressBar, UI_PROGRESS_RESET)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PROGRESS_SET</dt><dd>\nプログレスバーの進捗を設定する。進捗は 0.0から 1.0の間(実数)で与える。\n<ul><li>UI_PROGRESS_SET\n<pre class=\"wiki\">   pProgressBar= UI_ProgressBar(...)\n   sysCommand(pProgressBar, UI_PROGRESS_SET, &lt;progress&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PROGRESS_MAX</dt><dd>\nプログレスバーの進捗を最大(1.0)にする\n<ul><li>UI_PROGRESS_MAX\n<pre class=\"wiki\">   pProgressBar= UI_ProgressBar(...)\n   sysCommand(pProgressBar, UI_PROGRESS_MAX)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PROGRESS_GET</dt><dd>\n現在プログレスバーに与えられている進捗値を取得する。\n<ul><li>UI_PROGRESS_GET\n<pre class=\"wiki\">   pProgressBar= UI_ProgressBar(...)\n   &lt;progress&gt; = sysCommand(pProgressBar, UI_PROGRESS_GET)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PROGRESS_FILTER_VISIBLE</dt><dd>\n&lt;barfilter image&gt;が指定されている場合に、バーフィルタの visible をコントロールする\n<ul><li>UI_PROGRESS_FILTER_VISIBLE\n<pre class=\"wiki\">   pProgressBar = UI_ProgerssBar(...)\n   sysCommand(pProgressBar, UI_PROGRESS_FILTER_VISIBLE, &lt;visible&gt;)\n\n   &lt;visible&gt; true / false\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PROGRESS_FILTER_COLOR</dt><dd>\n&lt;barfilter image&gt;が指定されている場合に、バーフィルタに対して与える頂点 RGBA 値を指定する\n<ul><li>UI_PROGRESS_FILTER_COLOR\n<pre class=\"wiki\">   pProgressBar = UI_ProgressBar(...)\n   sysCommand(pProgressBar, UI_PROGRESS_FILTER_COLOR, &lt;alpha&gt;, &lt;rgb&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_PROGRESS_FILTER_ANIM</dt><dd>\n&lt;barfilter image&gt;が指定されている場合に、バーフィルタに対して与えるカラーアニメーションを指定する。\nアニメーションは与えられた二つのRGBA値の間をサインカーブ的に補間し、指定された周期で往復するものになる。\n<ul><li>UI_PROGRESS_FILTER_ANIM\n<pre class=\"wiki\">   pProgressBar = UI_ProgressBar(...)\n   sysCommand(pProgressBar, UI_PROGRESS_FILTER_ANIM, &lt;anim-enable&gt;, &lt;alpha-1&gt;, &lt;rgb-1&gt;, &lt;alpha-2&gt;, &lt;rgb-2&gt;, &lt;period&gt;)\n\n   &lt;anim-enable&gt;  true:カラーアニメを有効にする / false:カラーアニメを無効にする。falseの場合は以降のパラメータは省略可能で、あっても無視される。\n   &lt;alpha-1&gt;   カラー1のalpha値\n   &lt;rgb-1&gt;     カラー1のRGB値\n   &lt;alpha-2&gt;   カラー2のalpha値\n   &lt;rgb-2&gt;     カラー2のRGB値\n   &lt;period&gt;    往復にかかる周期(単位:[ms])\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_RubberBand.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_RubberBand – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_RubberBand\">UI_RubberBand<a title=\"このセクションへのリンク\" href=\"#UI_RubberBand\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_RubberBand( &lt;parent pointer&gt;, &lt;order&gt;, &lt;origin x&gt;, &lt;origin y&gt;, \"&lt;origin asset&gt;\", \"&lt;joint asset&gt;\", \"&lt;point asset&gt;\",\n                              &lt;resolution&gt;[ , &lt;option flags&gt;, &lt;animation time&gt;, &lt;joint priority offset&gt;, &lt;point priority offset&gt;,\n                                              &lt;origin-rot-enable&gt;, &lt;joint-rot-enable&gt;, &lt;point-rot-enable&gt; ])\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ。始点の表示に使用される。\n</li><li>&lt;origin x&gt;, &lt;origin y&gt; 始点座標\n</li><li>&lt;origin asset&gt; 始点表示に使用する画像asset。向きに合わせて回転するので「右向きで」作る。\n</li><li>&lt;joint asset&gt; 中間表示に使用する画像asset。回転しないので、回転しなくても違和感のないデザインで作る。\n</li><li>&lt;point asset&gt; 終点表示に使用する画像asset。向きに合わせて回転するので「右向きで」作る。\n</li><li>&lt;resolution&gt; 分割数。始点と終点の間をこの数に分割した境界に中間点が表示される。\n</li><li>&lt;option flags&gt; オプションの動作フラグ。下記の値を論理和で指定可能。\n<ul><li>RB_ANIM_ENABLE アニメーションを行う。始点方向から終点方向に向かい、中間点がループアニメーションする。\n</li><li>RB_ANIM_REALTIME アニメーション時間を実時間で解釈する。\n</li></ul></li><li>&lt;animation time&gt; アニメーションフラグが有効な場合には &lt;joint priority offset&gt; のひとつ前に引数をセットする必要があります。アニメーションの1ループにかかる時間を設定します。\n</li><li>&lt;joint priority offset&gt; 中間表示のプライオリティに与える、始点プライオリティからのオフセット。デフォルトは 1\n</li><li>&lt;point prioriry offset&gt; 終点表示のプライオリティに与える、始点プライオリティからのオフセット。デフォルトは 2\n</li><li>&lt;origin-rot-enable&gt; 始点画像を回転させるか否か。デフォルトはtrue(回転する)\n</li><li>&lt;joint-rot-enable&gt;  中間表示画像を回転させるか否か。デフォルトは false(回転しない)\n</li><li>&lt;point-rot-enable&gt;  終点画像を回転させるか否か。デフォルトはtrue(回転する)\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_RubberBand タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n始点と終点の間を結ぶ直線状にスプライトを並べて表示します。\n矢印の表示に使用できます。\n</p>\n<p>\nタスクの動作中、始点と終点の座標を下記プロパティで変更することができます。\n</p>\n<pre class=\"wiki\">   pRB = UI_RubberBand(...)\n   prop = TASK_getProperty(pRB)\n \n   -- 始点座標\n   prop.originX = &lt;始点x&gt;\n   prop.originY = &lt;始点y&gt;\n\n   -- 終点座標\n   prop.pointX = &lt;終点x&gt;\n   prop.pointY = &lt;終点y&gt;\n\n   TASK_setProperty(pRB)\n</pre><p>\n始点と終点に指定された画像は、両者を結ぶ線分の傾きに合わせて回転します。\n中間点の画像は回転されませんので、それを踏まえて素材を作る必要があります。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_RUBBAND_SET_ORDER::\n</p>\n<blockquote>\n<p>\n各パーツの表示プライオリティを変更する\n</p>\n</blockquote>\n<p>\n* UI_RUBBAND_SET_ORDER\n</p>\n<pre class=\"wiki\">   pRubBand = UI_RubberBand(...)\n   sysCommand(pRubBand, UI_RUBBAND_SET_ORDER, &lt;order-origin&gt;, &lt;order-joint&gt;, &lt;order-point&gt;)\n</pre>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_SWFPlayer.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_SWFPlayer – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_SWFPlayer\">UI_SWFPlayer<a title=\"このセクションへのリンク\" href=\"#UI_SWFPlayer\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_SWFPlayer( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;asset&gt;, \"&lt;movie name&gt;\", \"&lt;complete callback&gt;\", &lt;asset-replace-list&gt;)\n   \n   function &lt;complete callback&gt;( &lt;task pointer&gt;, label)\n      -- 再生終了時、必ずlabel は\"\"(length = 0の文字列)になる。\n   end\n\n   &lt;asset-replace-list&gt; = {\n      \"&lt;old-asset1&gt;\", \"&lt;new-asset1&gt;\",\n      \"&lt;old-asset2&gt;\", \"&lt;new-asset2&gt;\",\n      \"&lt;old-asset3&gt;\", \"&lt;new-asset3&gt;\",\n      \"&lt;old-asset4&gt;\", \"&lt;new-asset4&gt;\"\n           :\n   }\n\n   &lt;old-asset*&gt; および &lt;new-asset*&gt; には、\"asset://\" 等の scheme をつけない。\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;asset&gt; 表示する Flash asset のパス\n</li><li>&lt;movie name&gt; 再生するFlash movieの名前。全体再生のときは nil\n</li><li>&lt;complete callback&gt; 再生終了通知を受け取るコールバック関数の名前。UI_SWF_REACHFRAMEコマンド(後述)で指定するコールバックと同じ型であるため、同じ関数を使いまわすことができる。\n</li><li>&lt;asset-replace-list&gt; SWF中で使用されているassetの中で、置き換えるものの一覧を指定する\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_SWFPlayer タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nFlash Playerとなるタスク。swfから変換された Flash asset を再生する。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_SWF_PLAY</dt><dd>\nFlash の再生を開始する\n<ul><li>UI_SWF_PLAY\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   sysCommand(pSWF , UI_SWF_PLAY)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SWF_STOP</dt><dd>\nFlash の再生を一時停止する。実質上PAUSEにあたる。\n<ul><li>UI_SWF_STOP\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   sysCommand(pSWF, UI_SWF_STOP)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SWF_GOTOFRAME</dt><dd>\n再生個所を、ラベルで指定されたフレームにジャンプする。\n<ul><li>UI_SWF_GOTOFRAME\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   sysCommand(pSWF, UI_SWF_GOTOFRAME, \"&lt;label&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SWF_REACHFRAME</dt><dd>\nFlash中のフレームをラベルで指定し、そのラベルに到達した際に呼ぶコールバック関数を指定する。\nコールバックには到達したラベル文字列が引数として与えられるため、同じコールバックを異なるラベルに対して使いまわすことができる。\n<ul><li>UI_SWF_REACHFRAME\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   sysCommand(pSWF, UI_SWF_REACHFRAME, \"&lt;label&gt;\", \"&lt;callback&gt;\")\n\n\n   function &lt;callback&gt;( pSWF , label )\n      -- UI_SWFPlayerタスクのポインタが pSWFに、到達したラベル文字列が label に与えられる。\n   end\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SWF_SETFRAMERATE</dt><dd>\n再生フレームレートをfps値で指定して変更する。\n<ul><li>UI_SWF_SETFRAMERATE\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   sysCommand(pSWF, UI_SWF_SETFRAMERATE, &lt;fps&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SWF_SETFRAMERATE_SCALE</dt><dd>\n再生フレームレートを、デフォルトの時間に対する倍率で指定する。\n<ul><li>UI_SWF_SETFRAMERATE_SCALE\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   sysCommand(pSWF, UI_SWF_SETFRAMERATE_SCALE, &lt;scale&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SWF_IS_ANIM</dt><dd>\nSWFプレイヤーがアニメーションを再生中か否かを返す。\n<ul><li>UI_SWF_IS_ANIM\n<pre class=\"wiki\">   pSWF = UI_SWFPlayer(...)\n   &lt;result&gt; = sysCommand(pSWF, UI_SWF_IS_ANIM)\n\n   &lt;result&gt; が true であれば再生中、false であれば再生終了もしくは停止中。\n</pre></li></ul></dd></dl>\n<h3 id=\"廃止コマンド\">廃止コマンド<a title=\"このセクションへのリンク\" href=\"#%E5%BB%83%E6%AD%A2%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\n下記のコマンドは廃止された。\n</p>\n<dl><dt>UI_SWF_REPLACE_ASSETS</dt><dd>\n</dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_Score.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_Score – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_Score\">UI_Score<a title=\"このセクションへのリンク\" href=\"#UI_Score\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_Score( &lt;parent pointer&gt;, &lt;order&gt;, &lt;order offset&gt;, &lt;x&gt;, &lt;y&gt;,\n                              &lt;texture table&gt;, &lt;stepX&gt;, &lt;stepY&gt;, &lt;column&gt;, &lt;fillzero flag&gt;, &lt;animation flag&gt; [ , &lt;align&gt; , &lt;countclip&gt; ])\n\n   &lt;texture table&gt; = {\n       &lt;asset path 0&gt;,\n       &lt;asset path 1&gt;,\n       &lt;asset path 2&gt;,\n       &lt;asset path 3&gt;,\n       &lt;asset path 4&gt;,\n       &lt;asset path 5&gt;,\n       &lt;asset path 6&gt;,\n       &lt;asset path 7&gt;,\n       &lt;asset path 8&gt;,\n       &lt;asset path 9&gt;\n   }\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;order offset&gt; アニメーション用のプライオリティオフセット\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;texture table&gt; 各数字に対応するテクスチャassetを配列としてまとめたもの。0～9までの10要素が必要。\n</li><li>&lt;stepX&gt;, &lt;stepY&gt; 各桁数字の表示間隔\n</li><li>&lt;column&gt; 表示桁数(最大10桁)\n</li><li>&lt;fillzero flag&gt; true にすると、上位の桁を0で埋める。\n</li><li>&lt;animation flag&gt; アニメーションフラグ。数値が変化する際にアニメーションを行うか否か。\n</li><li>&lt;align&gt; 表示位置指定。&lt;fillzero flag&gt;がfalseの場合に有効。指定できる値は下記の三種。\n<ul><li>SCORE_ALIGN_RIGHT 右寄せ(デフォルト)\n</li><li>SCORE_ALIGN_CENTER センタリング\n</li><li>SCORE_ALIGN_LEFT 左寄せ\n</li></ul></li><li>&lt;countclip&gt; カウントクリップ機能。true にすることで表示可能な最大値を超えた際に、設定される値と表示を「全桁9」にする(default:false)\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_Score タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n指定された10のテクスチャを数字と見做し、整数列の表示を行う。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_SCORE_RESET</dt><dd>\nスコアの値を0にリセットする\n<ul><li>UI_SCORE_RESET\n<pre class=\"wiki\">   pScore = UI_Score(...)\n   sysCommand(pScore, UI_SCORE_RESET)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SCORE_SET</dt><dd>\nスコアの値を設定する\n<ul><li>UI_SCORE_SET\n<pre class=\"wiki\">   pScore = UI_Score(...)\n   sysCommand(pScore, UI_SCORE_SET, &lt;score&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SCORE_GET</dt><dd>\nスコアの値を取得する\n<ul><li>UI_SCORE_GET\n<pre class=\"wiki\">   pScore = UI_Score(...)\n   &lt;score&gt; = sysCommand(pScore, UI_SCORE_GET)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SCORE_ENTERANIM</dt><dd>\n表示開始アニメーションのパラメータを設定する。\n<ul><li>UI_SCORE_ENTERANIM\n<pre class=\"wiki\">   pScore = UI_Score(...)\n   sysCommand(pScore, UI_SCORE_ENTERANIM,\n              &lt;msplaytime&gt;, &lt;timeshift&gt;, &lt;onlychange&gt;, &lt;type&gt;, &lt;affected&gt;, &lt;param array&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SCORE_EXITANIM</dt><dd>\n表示終了アニメーションのパラメータを設定する。\n<ul><li>UI_SCORE_EXITANIM\n<pre class=\"wiki\">   pScore = UI_Score(...)\n   sysCommand(pScore, UI_SCORE_EXITANIM,\n              &lt;msplaytime&gt;, &lt;timeshift&gt;, &lt;onlychange&gt;, &lt;type&gt;, &lt;affected&gt;, &lt;param array&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_SCORE_ALIGN</dt><dd>\nfillzero が false の時に有効な表示位置合わせモードを指定する。位置合わせは最大表示桁数を指定のstepで表示するために必要な幅の中で行われる。\n<ul><li>UI_SCORE_ALIGN\n<pre class=\"wiki\">   pScore = UI_Score(...)\n   sysCommand(pScore, UI_SCORE_ALIGN, &lt;align&gt;)\n\n   &lt;align&gt;   SCORE_ALIGN_RIGHT(default) / SCORE_ALIGN_CENTER / SCORE_ALIGN_LEFT のいずれかを指定\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_ScrollBar.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_ScrollBar – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_ScrollBar\">UI_ScrollBar<a title=\"このセクションへのリンク\" href=\"#UI_ScrollBar\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_ScrollBar( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;,\n                              &lt;min&gt;, &lt;max&gt;, &lt;pos&gt;, &lt;image&gt;, &lt;slider size&gt;, &lt;slider min size&gt;, &lt;vertical flag&gt;,\n                              \"&lt;callback&gt;\", &lt;touch active&gt;, &lt;alpha normal&gt;, &lt;alpha select&gt;, &lt;color normal&gt;, &lt;color select&gt;)\n\n  function callback( task, event_type, value)\n    -- task: コールバック元のタスク名\n    -- event_type: イベント種類\n    -- value: 更新後の値\n  end\n\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; スクロールバー全体の表示域サイズ\n</li><li>&lt;min&gt;, &lt;max&gt;, &lt;pos&gt; スクロールバーの開始、終了、現在値\n</li><li>&lt;image&gt; 使用する画像asset\n</li><li>&lt;slider size&gt;, &lt;slider min size&gt; スライダーサイズ\n</li><li>&lt;vertical flag&gt; 縦方向リストフラグ。trueで縦方向、falseで横方向\n</li><li>&lt;callback&gt; スクロールする際のコールバック\n</li><li>&lt;touch active&gt; イベント処理フラグ。trueでタッチイベントを受け取る\n</li><li>&lt;alpha normal&gt;, &lt;color normal&gt; 普段使うカラーとアルファ\n</li></ul><p>\n* &lt;alpha select&gt;, &lt;color select&gt; 選択されている状況で使うカラーとアルファ\n</p>\n<h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_ScrollBar タスクのポインタ\n</li></ul><h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_SCROLL_SET_MIN::\n</p>\n<blockquote>\n<p>\nスクロールバーの開始値を設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_MIN\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_MIN, 0)\n</pre><p>\nUI_SCROLL_GET_MIN::\n</p>\n<blockquote>\n<p>\nスクロールバーの開始値を取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_MIN\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   min = sysCommand(pScrollBar, UI_SCROLL_GET_MIN)\n</pre><p>\n                        \nUI_SCROLL_SET_MAX::\n</p>\n<blockquote>\n<p>\nスクロールバーの終了値を設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_MAX\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_MAX, 100)\n</pre><p>\nUI_SCROLL_GET_MAX::\n</p>\n<blockquote>\n<p>\nスクロールバーの終了値を取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_MAX\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   max = sysCommand(pScrollBar, UI_SCROLL_GET_MAX)\n</pre><p>\nUI_SCROLL_SET_POS::\n</p>\n<blockquote>\n<p>\nスクロールバーの現在の値を設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_POS\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_POS, 50)\n</pre><p>\nUI_SCROLL_GET_POS::\n</p>\n<blockquote>\n<p>\nスクロールバーの現在の値を取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_POS\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   pos = sysCommand(pScrollBar, UI_SCROLL_GET_POS)\n</pre><p>\nUI_SCROLL_SET_SLIDER_SIZE::\n</p>\n<blockquote>\n<p>\nスライダーのサイズを設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_SLIDER_SIZE\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_SLIDER_SIZE, 12)\n</pre><p>\nUI_SCROLL_GET_SLIDER_SIZE::\n</p>\n<blockquote>\n<p>\nスライダーのサイズを取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_SLIDER_SIZE\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   slider_size = sysCommand(pScrollBar, UI_SCROLL_GET_SLIDER_SIZE)\n</pre><p>\nUI_SCROLL_SET_SLIDER_MIN_SIZE::\n</p>\n<blockquote>\n<p>\nスライダーの最小サイズを設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_SLIDER_MIN_SIZE\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_SLIDER_MIN_SIZE, 12)\n</pre><p>\nUI_SCROLL_GET_SLIDER_MIN_SIZE::\n</p>\n<blockquote>\n<p>\nスライダーの最小サイズを取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_SLIDER_MIN_SIZE\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   slider_min_size = sysCommand(pScrollBar, UI_SCROLL_GET_SLIDER_MIN_SIZE)\n</pre><p>\nUI_SCROLL_SET_COLOR_NORMAL::\n</p>\n<blockquote>\n<p>\n普段のカラーを設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_COLOR_NORMAL\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_COLOR_NORMAL, 0xffffffff)\n</pre><p>\nUI_SCROLL_GET_COLOR_NORMAL::\n</p>\n<blockquote>\n<p>\n普段のカラーをを取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_COLOR_NORMAL\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   color_normal = sysCommand(pScrollBar, UI_SCROLL_GET_COLOR_NORMAL)\n</pre><p>\nUI_SCROLL_SET_COLOR_SELECT::\n</p>\n<blockquote>\n<p>\n選択されている状況のカラーを設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_COLOR_SELECT\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_COLOR_SELECT, 0xffffffff)\n</pre><p>\nUI_SCROLL_GET_COLOR_SELECT::\n</p>\n<blockquote>\n<p>\n選択されている状況のカラーをを取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_COLOR_SELECT\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   color_select = sysCommand(pScrollBar, UI_SCROLL_GET_COLOR_SELECT)\n</pre><p>\nUI_SCROLL_SET_ALPHA_NORMAL::\n</p>\n<blockquote>\n<p>\n普段の透明度を設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_ALPHA_NORMAL\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_ALPHA_NORMAL, 0xff)\n</pre><p>\nUI_SCROLL_GET_ALPHA_NORMAL::\n</p>\n<blockquote>\n<p>\n普段の透明度をを取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_ALPHA_NORMAL\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   alpha_normal = sysCommand(pScrollBar, UI_SCROLL_GET_ALPHA_NORMAL)\n</pre><p>\nUI_SCROLL_SET_ALPHA_SELECT::\n</p>\n<blockquote>\n<p>\n選択されている状況の透明度を設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_ALPHA_SELECT\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_ALPHA_SELECT, 0xff)\n</pre><p>\nUI_SCROLL_GET_ALPHA_SELECT::\n</p>\n<blockquote>\n<p>\n選択されている状況の透明度をを取得する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_ALPHA_SELECT\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   alpha_select = sysCommand(pScrollBar, UI_SCROLL_GET_ALPHA_SELECT)\n</pre><p>\nUI_SCROLL_SET_TOUCH_ACTIVE::\n</p>\n<blockquote>\n<p>\nタッチイベント処理の有効無効状況を設定する。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SET_TOUCH_ACTIVE\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   sysCommand(pScrollBar, UI_SCROLL_SET_TOUCH_ACTIVE, true)\n</pre><p>\nUI_SCROLL_GET_TOUCH_ACTIVE::\n</p>\n<blockquote>\n<p>\nタッチイベント処理の有効無効状況を調べる。\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_GET_TOUCH_ACTIVE\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   touch_active = sysCommand(pScrollBar, UI_SCROLL_GET_TOUCH_ACTIVE)\n</pre><p>\nUI_SCROLL_SELECT_SCRMGR::\n</p>\n<blockquote>\n<p>\nスクロールマネージャを設定する\n</p>\n</blockquote>\n<p>\n* UI_SCROLL_SELECT_SCRMGR\n</p>\n<pre class=\"wiki\">   pScrollBar = UI_ScrollBar(...)\n   touch_active = sysCommand(pScrollBar, UI_SCROLL_SELECT_SCRMGR, \"scroll_manager\")\n</pre>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_SimpleItem.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_SimpleItem – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_SimpleItem\">UI_SimpleItem<a title=\"このセクションへのリンク\" href=\"#UI_SimpleItem\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_SimpleItem( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, \"&lt;asset&gt;\")\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;asset&gt; 表示に使用するassetのパス\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_SimpleItem タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n指定されたassetを表示するだけの、最もシンプルな表示系UIタスク。\nassetとしては画像のほか、Flashやセルアニメーション等も指定できる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<blockquote>\n<p>\n(コマンド無し)\n</p>\n</blockquote>\n\n        \n        \n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_TextInput.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_TextInput – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_TextInput\">UI_TextInput<a title=\"このセクションへのリンク\" href=\"#UI_TextInput\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_TextInput( &lt;parent pointer&gt;, &lt;password mode&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;, \"&lt;default text&gt;\"\n                                 [ , \"&lt;on-change-callback&gt;\", &lt;widget-id&gt;, &lt;max-length&gt;, &lt;enable-chartype&gt; ] )\n\n   function &lt;on-change-callback&gt;(&lt;task-pointer&gt;, &lt;new-string&gt;, &lt;widget-id&gt;)\n     -- &lt;task-pointer&gt; 呼び出し元 UI_TextInput のタスクポインタ\n     -- &lt;new-string&gt;   更新された結果の文字列\n     -- &lt;widget-id&gt;    タスク起動時に指定された&lt;widget-id&gt;の値\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;password mode&gt; trueでパスワードモード(入力した文字列がコントロール上で伏せて表示される)で作成する。falseの場合は通常の入力。\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; 画面上の表示サイズ\n</li><li>&lt;default text&gt; 初期状態で設定する文字列\n</li><li>&lt;on-change-callback&gt; 文字列が変更されたときに呼ばれるコールバック名。指定されない場合は呼び出されない。\n</li><li>&lt;widget-id&gt; コールバックに渡されるID値。指定されない場合は 0 と同じ扱い。\n</li><li>&lt;max-length&gt; 入力可能な最大長\n</li><li>&lt;enable-chartype&gt; 文字種による入力制限。定数 TXCH_7BIT_ASCII と TXCH_UTF8 の論理和で与える。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_TextInput タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nOSのUI機能を使い、文字列入力コントロールを生成する。\n</p>\n<p>\n文字列入力コントロールの表示は OpenGL ES の管理外にあるため、必ず最前面に表示される(プライオリティ制御はできない)\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_TEXTBOX_SETTEXT</dt><dd>\n文字列入力コントロールに文字列を設定する\n<ul><li>UI_TEXTBOX_SETTEXT\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETTEXT, \"&lt;new text string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_GETTEXT</dt><dd>\n文字列入力コントロールに現在入力されている文字列を取得する\n<ul><li>UI_TEXTBOX_GETTEXT\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   &lt;now text string&gt; = sysCommand(pText, UI_TEXTBOX_GETTEXT)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_SETPLACEHOLDER</dt><dd>\nプレースホルダー文字列を指定する\n<ul><li>UI_TEXTBOX_SETPLACEHOLDER\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETPLACEHOLDER, \"&lt;placeholder-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_SETCOLOR</dt><dd>\n文字列入力コントロールの文字色および背景色を、選択時および非選択時それぞれのケースについて設定する。\n現在iOSでは対応済みだが、非対応環境ではサポートされない。\n<ul><li>UI_TEXTBOX_SETCOLOR\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETCOLOR, &lt;touch-case&gt;, &lt;foreground-rgb&gt;, &lt;background-rgb&gt;)\n\n   &lt;touch-case&gt;  true で選択時 / false で非選択時\n   &lt;foreground-rgb&gt; フォアグラウンドカラー。具体的には文字の色。\n   &lt;background-rgb&gt; バックグラウンドカラー。具体的には背景の色。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_SETFONT</dt><dd>\n文字列入力コントロールで使用されるフォントの種類およびサイズを指定する。\n<ul><li>UI_TEXTBOX_SETFONT\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETFONT, \"&lt;font-name&gt;\", &lt;font-size&gt;)\n  \n   &lt;font-name&gt;  フォント名。システムフォントを使用する場合は nil を指定。\n   &lt;font-size&gt;    フォントサイズ。見かけ上の大きさはラベル等と同じ基準。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_SETMAXLEN</dt><dd>\n入力可能な最大文字列長を指定する。\n<ul><li>UI_TEXTBOX_SETMAXLEN\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETMAXLEN, &lt;max-length&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_SETCHARTYPE</dt><dd>\n入力可能な文字種を指定する。\n<ul><li>UI_TEXTBOX_SETCHARTYPE\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETCHARTYPE, &lt;enable-chartype&gt;)\n\n   &lt;enable-chartype&gt;  下記定数の論理和で、許可する文字種を与える。\n      TXCH_7BIT_ASCII  7bit ASCII 文字。通常のいわゆる半角アルファベットおよび数字、記号等はこちらに含まれる。\n      TXCH_UTF8           UTF8文字としているが、7bit ASCIIに含まれない文字は全てこちらに該当する。\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_GETCHARCOUNT</dt><dd>\n入力されている文字数を読む。\n<ul><li>UI_TEXTBOX_GETCHARCOUNT\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   count = sysCommand(pText, UI_TEXTBOX_GETCHARCOUNT)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_GETMAXLEN</dt><dd>\nテキストボックスの最大入力文字数を取得。\n<ul><li>UI_TEXTBOX_GETMAXLEN\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   count = sysCommand(pText, UI_TEXTBOX_GETMAXLEN)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TEXTBOX_SETALIGN</dt><dd>\nテキストボックスのアライメントを設定。\n<ul><li>UI_TEXTBOX_SETALIGN\n<pre class=\"wiki\">   pText = UI_TextInput(...)\n   sysCommand(pText, UI_TEXTBOX_SETALIGN, &lt;align-type&gt;)\n   \n   &lt;align-type&gt; 下記定数のいずれかを設定(作成時のデフォルトは TX_ALIGN_LEFT )\n     TX_ALIGN_LEFT       左揃え \n     TX_ALIGN_CENTER  中央揃え\n     TX_ALIGN_RIGHT     右揃え\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_TouchPad.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_TouchPad – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_TouchPad\">UI_TouchPad<a title=\"このセクションへのリンク\" href=\"#UI_TouchPad\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_TouchPad( \"&lt;callback&gt;\" [, &lt;modal&gt; ] )\n\n   function &lt;callback&gt;(tbl)\n\n     --[[\n       tbl = {\n         {\n           type = PAD_ITEM_TAP / PAD_ITEM_DRAG / PAD_ITEM_RELEASE,  -- イベントの種類\n           id = touch point ID,                                     -- イベントを起こしたタッチポイントID\n           x = position X,                                          -- x位置\n           y = position Y                                           -- y位置\n         },\n         {\n           type = PAD_ITEM_TAP / PAD_ITEM_DRAG / PAD_ITEM_RELEASE,\n           id = touch point ID,\n           x = position X,\n           y = position Y\n         },\n            :\n       }\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;callback&gt; タッチパネルイベントが通知されるコールバック関数\n</li><li>&lt;modal&gt; trueにすることで、UI_TouchPad がモーダルスタックに乗る。デフォルトはfalse\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_TouchPad タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nタッチパネルデバイスイベントキュー内容を通知する。通知は毎フレーム行われる。\n</p>\n<p>\nコールバック関数は一つだけ引数を持ち、その引数はキュー内容を時系列順に並べたテーブルとなる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_TOUCHPAD_SET_GROUP</dt><dd>\nUI_TouchPadをUI_FormやUI_Listと同様グループに所属させる。\n指定されたグループの他のフォーム等が操作中、UI_TouchPadのコールバックは呼ばれなくなる。また、後述のUI_TOUCHPAD_LOCKで同グループの他のフォーム等の操作を禁止することができる。\n<ul><li>UI_TOUCHPAD_SET_GROUP\n<pre class=\"wiki\">   pTouchPad = UI_TouchPad(...)\n   sysCommand(pTouchPad, UI_TOUCHPAD_SET_GROUP, \"&lt;group-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TOUCHPAD_LOCK</dt><dd>\nUI_TouchPadおよび所属するグループのworking状態を設定する。\n他のFormやListと同じグループに所属している場合、それらの操作は設定した状態の影響を受ける。\n<ul><li>UI_TOUCHPAD_LOCK\n<pre class=\"wiki\">   pTouchPad = UI_TouchPad(...)\n   sysCommand(pTouchPad, UI_TOUCHPAD_LOCK, &lt;working-status&gt;)\n\n   &lt;working-status&gt;  trueで操作中(working:他はブロックされる) / false で未操作(not working:他も操作可能)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_TOUCHPAD_GET_ALL</dt><dd>\nUI_TouchPad が、他のタスクによってマーク済みのイベントも含めて通知するか否かを設定する。\n起動直後は false を指定した場合(通知しない)になっている。\n<ul><li>UI_TOUCHPAD_GET_ALL\n<pre class=\"wiki\">   pTouchPad = UI_TouchPad(...)\n   sysCommand(pTouchPad, UI_TOUCHPAD_GET_ALL, &lt;get-all-enable&gt;)\n\n   &lt;get-all-enable&gt;  true:マーク済みのイベントも通知する / false:マーク済みのイベントは通知しない(default)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_VariableItem.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_VariableItem – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_VariableItem\">UI_VariableItem<a title=\"このセクションへのリンク\" href=\"#UI_VariableItem\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_VariableItem( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;, &lt;image asset&gt;)\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; 表示サイズ, [-1,-1]は&lt;image asset&gt;のサイズを利用する事になります。\n</li><li>&lt;image asset&gt; 表示に用いる画像\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_VariableItem タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n指定位置に指定assetを、指定サイズで表示する。\n表示に用いるassetやサイズの値は、タスク動作中に変更できる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_VARITEM_CHANGE_ASSET</dt><dd>\n表示に使用するassetを変更する。UV値が変更されていた場合は新しい画像の全域を示すUV値にリセットされる。\n<ul><li>UI_VARITEM_CHANGE_ASSET\n<pre class=\"wiki\">   pVarItem = UI_VariableItem(...)\n   sysCommand(pVarItem, UI_VARITEM_CHANGE_ASSET, \"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_VARITEM_SET_UV</dt><dd>\n画像内における位置とサイズをピクセル単位で指定して、表示上のUV値を変更する。\n画像の一部が矩形で切り取られて使用される。本来の画像をはみ出す値が指定された場合の動作は保障されない。\n<ul><li>UI_VARITEM_SET_UV\n<pre class=\"wiki\">   pVarItem = UI_VariableItem(...)\n   sysCommand(pVarItem, UI_VARITEM_SET_UV, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_VARITEM_RESET_UV</dt><dd>\n画像内における位置とサイズを画像本来の値に戻す。\n<ul><li>UI_VARITEM_SET_UV\n<pre class=\"wiki\">   pVarItem = UI_VariableItem(...)\n   sysCommand(pVarItem, UI_VARITEM_RESET_UV)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_VirtualDoc.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_VirtualDoc – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_VirtualDoc\">UI_VirtualDoc<a title=\"このセクションへのリンク\" href=\"#UI_VirtualDoc\" class=\"anchor\"> ¶</a></h2>\n<p>\n(マニュアル作成中)\n</p>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_VirtualDoc( &lt;parent pointer&gt;, &lt;order&gt;, &lt;x&gt;, &lt;y&gt;,\n                                   &lt;doc width&gt;, &lt;doc height&gt;, &lt;view width&gt;, &lt;view height&gt;,\n                                   &lt;max command nums&gt;, &lt;vertical flag&gt; [, \"&lt;callback&gt;\"] )\n\n   function &lt;drag callback&gt;(&lt;task pointer&gt;, &lt;type&gt;, &lt;tap-x&gt;, &lt;tap-y&gt;, &lt;move-x&gt;, &lt;move-y&gt;)\n\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;order&gt; 表示プライオリティ\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;doc width&gt;, &lt;doc height&gt; 表示するドキュメントのサイズ\n</li><li>&lt;view width&gt;, &lt;view height&gt; 表示域のサイズ\n</li><li>&lt;max command nums&gt; 受付可能な描画コマンドの最大数\n</li><li>&lt;vertical flag&gt; trueで縦スクロールモード(falseで横スクロール)\n</li><li>&lt;callback&gt; Virtual Document上におけるポインティングデバイス操作のコールバック\n</li></ul><ul><li>&lt;task pointer&gt; コールバックを呼び出した UI_List タスクのポインタ\n</li><li>&lt;type&gt; タッチパネル操作の種類\n</li><li>&lt;tap-x&gt; 今回の操作が始まった時点におけるタップ位置x座標\n</li><li>&lt;tap-y&gt; 今回の操作が始まった時点におけるタップ位置y座標\n</li><li>&lt;move-x&gt; タップ位置から今回のイベントが検出された位置までのx方向差分\n</li><li>&lt;move-y&gt; タップ位置から今回のイベントが検出された位置までのy方向差分\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_VirtualDoc タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nスクロール可能なドキュメント領域を生成する。\nドキュメントはviewのサイズでクリッピングされて表示される。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_VDOC_CLEAR</dt><dd>\nVirtualDocumentのクリア色を指定する\n<ul><li>UI_VDOC_CLEAR\n<pre class=\"wiki\">   pVDoc = UI_VirtualDoc(...)\n   sysCommand(pVDoc, UI_VDOC_CLEAR, &lt;alpha&gt;, &lt;rgb&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_VDOC_FONT</dt><dd>\nVirtualDocumentの指定したフォントインデックスに、フォント名とサイズを指定する。\n以後、このフォントインデックスによる文字列描画はそのフォント/サイズで行われる。\n<ul><li>UI_VDOC_FONT\n<pre class=\"wiki\">   pVDoc = UI_VirtualDoc(...)\n   sysCommand(pVDoc, UI_VDOC_FONT, &lt;font index&gt;, \"&lt;font name&gt;\", &lt;font size&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_VDOC_VIEWPOS</dt><dd>\n表示域から見えるドキュメントの位置を指定する。\n<ul><li>UI_VDOC_VIEWPOS\n<pre class=\"wiki\">   pVDoc = UI_VirtualDoc(...)\n   sysCommand(pVDoc, UI_VDOC_VIEWPOS, &lt;x&gt;, &lt;y&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_VDOC_ALIGN</dt><dd>\nテキスト描画の際のalignと、必要な場合はセンタリングや右寄せに用いる幅のサイズを指定する。\nUI_VDOC_DRAWで描画を行う以前に指定する必要がある。\n&lt;align-width&gt;を指定しない場合、表示域のサイズ( = &lt;doc width&gt;)を指定したのと同義となる。\n<ul><li>UI_VDOC_ALIGN\n<pre class=\"wiki\">   pVDoc = UI_VirtualDoc(...)\n   sysCommand(pVDoc, UI_VDOC_ALIGN, &lt;align-mode&gt; [ , &lt;align-width&gt; ] )\n\n   &lt;align-mode&gt;に指定できる値\n\n    VD_ALIGN_LEFT   左寄せ(デフォルト)\n    VD_ALIGN_CENTER センタリング\n    VD_ALIGN_RIGHT  右寄せ\n</pre></li></ul></dd></dl>\n<dl><dt>UI_VDOC_DRAW</dt><dd>\nVirtual Document に対し描画命令を発行する。描画命令は配列で指定したものを一括で与える。\n与えられる描画命令の数は、タスク起動時に&lt;max command nums&gt;で与えた値が上限となる。\n<ul><li>UI_VDOC_DRAW\n<pre class=\"wiki\">   pVDoc = UI_VirtualDoc(...)\n   sysCommand(pVDoc, UI_VDOC_DRAW, &lt;command list table&gt;)\n\n   &lt;command list table&gt; = {\n     -- 指定の色で線分を描画する\n     { VD_DRAW_LINE, &lt;x0&gt;, &lt;y0&gt;, &lt;x1&gt;, &lt;y1&gt;, &lt;alpha&gt;, &lt;rgb&gt; },\n\n     -- 指定の色と、フォントインデックスで指定されたフォントで文字列を描画する\n     { VD_DRAW_TEXT, &lt;x&gt;, &lt;y&gt;, \"&lt;string&gt;\", &lt;alpha&gt;, &lt;rgb&gt;, &lt;font index&gt; },\n\n     -- 矩形を描画する。&lt;fill&gt;をtrueにすることで、矩形を塗りつぶす。\n     { VD_FILL_RECT, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;, &lt;alpha&gt;, &lt;rgb&gt;, &lt;fill&gt; },\n\n     -- インラインイメージを描画する。\n     { VD_DRAW_IMAG, &lt;x&gt;, &lt;y&gt;, \"&lt;image asset&gt;\", &lt;alpha&gt; },\n   }\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UI_WebView.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UI_WebView – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UI_WebView20130221現在Windowsでの動作はしないです\">UI_WebView (2013/02/21現在 Windowsでの動作はしないです)<a title=\"このセクションへのリンク\" href=\"#UI_WebView20130221%E7%8F%BE%E5%9C%A8Windows%E3%81%A7%E3%81%AE%E5%8B%95%E4%BD%9C%E3%81%AF%E3%81%97%E3%81%AA%E3%81%84%E3%81%A7%E3%81%99\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UI_WebView( &lt;parent pointer&gt;, &lt;mode&gt;, &lt;x&gt;, &lt;y&gt;, &lt;width&gt;, &lt;height&gt;, &lt;url&gt;, \"&lt;callback&gt;\" )\n\n   function &lt;callback&gt;( &lt;task pointer&gt;, &lt;type&gt;, &lt;argument string&gt; )\n     -- &lt;task pointer&gt;          呼び出し元 UI_WebView タスクのポインタ\n     -- &lt;type&gt;                      呼び出し理由\n     -- &lt;argument string&gt;　通知に必要な文字列\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;parent pointer&gt; 親UIのポインタ\n</li><li>&lt;mode&gt; ページ遷移の許可/禁止\n</li><li>&lt;x&gt;, &lt;y&gt; 表示座標\n</li><li>&lt;width&gt;, &lt;height&gt; 表示領域のサイズ\n</li><li>&lt;url&gt; 初期表示状態のURL\n</li><li>&lt;callback&gt; WebViewのイベントコールバック\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UI_WebView タスクのポインタ\n</li></ul><h3 id=\"コールバック引数\">コールバック引数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; コールバックを呼び出した UI_WebView のポインタ\n</li><li>&lt;type&gt;             コールバック理由。\n<ul><li>WEBVIEW_LOCALLINK         スクリプトへの通知。&lt;argument string&gt;がWebView上で踏まれたリンクの値になる\n</li><li>WEBVIEW_DIDSTARTLOAD  Webのロードが開始された。&lt;argument string&gt; は空になる。\n</li><li>WEBVIEW_DIDENDLOAD     Webのロードが終了した。&lt;argument string&gt; は空になる。\n</li><li>WEBVIEW_FAILEDLOAD      Webのロードが失敗した。&lt;argument string&gt; は空になる。\n</li></ul></li><li>&lt;argument string&gt; WebSite 中のリンクから与えられた識別用文字列\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\n画面の一部に簡易ブラウザを表示する。\n用途によって他ページへの遷移を禁止できる。\n</p>\n<p>\nまた、表示したWebPage中のリンクやボタンから特定のJavaScript呼び出しを行うことで、\n&lt;callback&gt;で指定されたコールバック関数を呼び出し、JavaScriptの引数として与えられた文字列を\n受け取ることができる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>UI_WEBVIEW_SETURL</dt><dd>\n表示するURLを指定する\n<ul><li>UI_WEBVIEW_SETURL\n<pre class=\"wiki\">   pWeb = UI_WebView(...)\n   sysCommand(pWeb, UI_WEBVIEW_SETURL, \"&lt;url&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>UI_WEBVIEW_GETURL</dt><dd>\n現在表示しているURL文字列を取得する\n<ul><li>UI_WEBVIEW_GETURL\n<pre class=\"wiki\">   pWeb = UI_WebView(...)\n   &lt;url&gt; = sysCommand(pWeb, UI_WEBVIEW_GETURL)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_WEBVIEW_SCALESPAGETOFIT</dt><dd>\nOSによって表示されるWebView の scalesPageToFit フラグを指定する。現時点ではiOS限定であり、対応していない環境では無視される。\n<pre class=\"wiki\">   pWeb = UI_WebView(...)\n   &lt;url&gt; = sysCommand(pWeb, UI_WEBVIEW_SCALESPAGETOFIT, &lt;scalesPageToFit-value&gt;\n\n   &lt;scalesPageToFit-value&gt; true で YES / false で NO\n</pre></dd></dl>\n<dl><dt>UI_WEBVIEW_SETBGCOLOR</dt><dd>\n背景色を指定します。\n<pre class=\"wiki\">   pWeb = UI_WebView(...)\n   sysCommand(pWeb, UI_WEBVIEW_SETBGCOLOR, &lt;alpha&gt;, &lt;rgb&gt;)\n\n   &lt;alpha&gt; 0x00 ～ 0xff までのアルファ値\n   &lt;rgb&gt; 0x000000 ～ 0xffffff までのRGBカラー値\n</pre></dd></dl>\n<h3 id=\"UI_WebView向けサイトの実装\">UI_WebView向けサイトの実装<a title=\"このセクションへのリンク\" href=\"#UI_WebView%E5%90%91%E3%81%91%E3%82%B5%E3%82%A4%E3%83%88%E3%81%AE%E5%AE%9F%E8%A3%85\" class=\"anchor\"> ¶</a></h3>\n<p>\nUI_WebView向けのサイトでは、ページ遷移せずにLua中のコールバック関数を呼ぶリンクを作ることができます。\n</p>\n<p>\n簡単なサンプルを書くと、下記のようになります。\n</p>\n<ul><li>HTML側(XHTML1.1による例)\n<pre class=\"wiki\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"]\n               \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"&gt;\n&lt;html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ja\" lang=\"ja\"&gt;\n\t&lt;head&gt;\n\t\t&lt;meta name=\"language\" content=\"jp\" /&gt;\n\n\t\t&lt;script type=\"text/javascript\" src=\"./webview.js\" /&gt;\n\n\t\t&lt;title&gt;JavaScript Test&lt;/title&gt;\n\t&lt;/head&gt;\n\n\t&lt;body&gt;\n\t&lt;div&gt;\n\t&lt;h1&gt;テスト&lt;/h1&gt;\n\t&lt;ul&gt;\n\t&lt;li&gt;&lt;a onclick=\"eng.cmd('campaign')\"&gt;呼び出しリンク(test:campaign)&lt;/a&gt;&lt;/li&gt;\n\t&lt;li&gt;&lt;a onclick=\"eng.cmd('shop')\"&gt;呼び出しリンク(test:shop)&lt;/a&gt;&lt;/li&gt;\n\t&lt;li&gt;&lt;a onclick=\"eng.cmd('special')\"&gt;呼び出しリンク(test:special)&lt;/a&gt;&lt;/li&gt;\n\t&lt;/ul&gt;\n\t&lt;/div&gt;\n\t&lt;/body&gt;\n&lt;/html&gt;\n</pre></li></ul><ul><li>webview.js\n<pre class=\"wiki\">// UserAgentを取得\nvar strUA = \"\";\nstrUA = navigator.userAgent.toLowerCase();\n\n// UserAgent に iphone または ipad が含まれたら、iOSデバイス\nvar iOSclient = false;\nif(strUA.indexOf(\"iphone\") &gt;= 0) iOSclient = true;\nif(strUA.indexOf(\"ipad\") &gt;= 0) iOSclient = true;\n\n// iOSデバイスの場合は、Androidによって定義されるインタフェースクラスと同名のメソッドを持つ\n// 簡易インタフェースクラスを実装する。\nif(iOSclient) {\n\tvar engineIF = function() {};\n\tengineIF.prototype.cmd = function(keyString) {\n\t\tlocation.href = \"native://\" + keyString;\n\t};\n\tvar eng = new engineIF();\n}\n</pre></li></ul><p>\nwebview.js を読み込んだ後は、iOS,Android共にHTML中で eng.cmd('&lt;argument string&gt;') を呼ぶことで、\nそのページを表示しているUI_WebViewに指定された&lt;callback&gt;を呼び、&lt;argument string&gt;を渡すことができるようになります。\n</p>\n<p>\neng インスタンスは、iOSでは webview.js 中で生成され、AndroidではEngine側でWebView表示の際にJavaScript Interfaceとして生成されます。\nどちらも cmd(String) メソッドを持ち、同じ呼び出し記述で&lt;callback&gt;を呼び出すことができます。\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/UTIL_IntervalTimer.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UTIL_IntervalTimer – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UTIL_IntervalTimer\">UTIL_IntervalTimer<a title=\"このセクションへのリンク\" href=\"#UTIL_IntervalTimer\" class=\"anchor\"> ¶</a></h2>\n<pre class=\"wiki\">   &lt;task pointer&gt; = UTIL_IntervalTimer( &lt;timerID&gt;, \"&lt;callback&gt;\", &lt;interval&gt; [ , &lt;repeat&gt; , &lt;parentTask&gt; ] )\n\n\n   function &lt;callback&gt;(timerID)\n\n   end\n</pre><h3 id=\"引数\">引数<a title=\"このセクションへのリンク\" href=\"#%E5%BC%95%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;timerID&gt; タイマーID。コールバック時の引数として渡される値で、スクリプタがその意味を定める。\n</li><li>&lt;callback&gt; 所定の時間経過時に呼び出されるコールバック関数の名称\n</li><li>&lt;interval&gt; 時間間隔。[ms]単位で与える(1秒 = 1000)\n</li><li>&lt;repeat&gt; trueで繰り返し、falseでワンショットタイマーになる。指定しなかった場合はfalseの扱いになる。\n</li><li>&lt;parentTask&gt; 親タスク。\n</li></ul><h3 id=\"戻り値\">戻り値<a title=\"このセクションへのリンク\" href=\"#%E6%88%BB%E3%82%8A%E5%80%A4\" class=\"anchor\"> ¶</a></h3>\n<ul><li>&lt;task pointer&gt; 生成された UTIL_IntervalTimer タスクのポインタ\n</li></ul><h3 id=\"解説\">解説<a title=\"このセクションへのリンク\" href=\"#%E8%A7%A3%E8%AA%AC\" class=\"anchor\"> ¶</a></h3>\n<p>\nタスクが起動されてから、指定された時間が経過後にコールバック関数を呼び出すタスク。\n同じ時間間隔で繰り返しコールバックを呼ぶこともできる。\n</p>\n<h3 id=\"コマンド\">コマンド<a title=\"このセクションへのリンク\" href=\"#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h3>\n<p>\n(コマンド無し)\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/assets/jquery.js",
    "content": "/*\n * jQuery 1.2.6 - New Wave Javascript\n *\n * Copyright (c) 2008 John Resig (jquery.com)\n * Dual licensed under the MIT (MIT-LICENSE.txt)\n * and GPL (GPL-LICENSE.txt) licenses.\n *\n * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $\n * $Rev: 5685 $\n */\neval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\\\s)+>)[^>]*$|^#(\\\\w+)$/,62=/^.[^:#\\\\[\\\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d==\"23\"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?\"27\":\"43\"](d);I 7.6Y(D.2d(d))},5w:\"1.2.6\",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||\"1K\"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\\'2h\\'||b==\\'1Z\\')&&3d(a)<0)a=12;I 7.1K(b,a,\"2a\")},1r:H(b){G(1j b!=\"49\"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a=\"\";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h(\"..\")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h(\"1v\");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q(\"*\").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q(\"*\").5c().P(H(i){G(7.16==3)I;J c=D.L(7,\"3w\");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\\'23\\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F(\".\"+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,\"2A\")){J e=c.64,63=[],15=c.15,2V=c.O==\"2A-2V\";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||\"\").1o(/\\\\r/g,\"\")}I 12}G(b.1q==4L)b+=\\'\\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,\"2A\")){J a=D.2d(b);D(\"9R\",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(\".\");a[1]=a[1]?\".\"+a[1]:\"\";G(b===12){J c=7.5C(\"9z\"+a[1]+\"!\",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P(\"9u\"+a[1]+\"!\",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,\"1T\")&&D.Y(3x[0],\"4F\"))b=7.3H(\"22\")[0]||7.3U(7.2z.3h(\"22\"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,\"1m\"))c=c.1e(a);N{G(a.16==1)c=c.1e(D(\"1m\",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:\"1m\"});N D.5u(a.1r||a.6O||a.4H||\"\");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!=\"49\"&&1j b!=\"H\")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w==\"49\"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E=\"4M\"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!=\"23\"&&!a.Y&&a.1q!=2p&&/^[\\\\s[]?H/.11(a+\"\")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a=D.3k(a);G(a){J b=S.3H(\"6w\")[0]||S.1C,1m=S.3h(\"1m\");1m.O=\"1r/4t\";G(D.14.1f)1m.1r=a;N 1m.3U(S.5F(a));b.39(1m,b.1x);b.37(1m)}},Y:H(b,a){I b.Y&&b.Y.2r()==a.2r()},1Y:{},L:H(c,d,b){c=c==1b?5r:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1b?5r:c;J a=c[E];G(b){G(D.1Y[a]){2U D.1Y[a][b];b=\"\";R(b 1n D.1Y[a])1X;G(!b)D.3b(c)}}N{1U{2U c[E]}1V(e){G(c.5l)c.5l(E)}2U D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1n d)G(a.1w(d[e],c)===Q)1X}N R(;i<K;)G(a.1w(d[i++],c)===Q)1X}N{G(K==12){R(e 1n d)G(a.1k(d[e],e,d[e])===Q)1X}N R(J b=d[0];i<K&&a.1k(b,i,b)!==Q;b=d[++i]){}}I d},1i:H(b,a,c,i,d){G(D.1D(a))a=a.1k(b,i);I a&&a.1q==4L&&c==\"2a\"&&!6G.11(d)?a+\"2X\":a},1F:{1e:H(c,b){D.P((b||\"\").1R(/\\\\s+/),H(i,a){G(c.16==1&&!D.1F.3T(c.1F,a))c.1F+=(c.1F?\" \":\"\")+a})},21:H(c,b){G(c.16==1)c.1F=b!=12?D.3C(c.1F.1R(/\\\\s+/),H(a){I!D.1F.3T(b,a)}).6s(\" \"):\"\"},3T:H(b,a){I D.2L(a,(b.1F||b).6r().1R(/\\\\s+/))>-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e==\"2h\"||e==\"1Z\"){J b,3X={30:\"5x\",5g:\"1G\",18:\"3I\"},35=e==\"2h\"?[\"5e\",\"6k\"]:[\"5G\",\"6i\"];H 5b(){b=e==\"2h\"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,\"57\"+7,M))||0;2C+=3d(D.2a(d,\"2C\"+7+\"4b\",M))||0});b-=29.83(a+2C)}G(D(d).3F(\":4j\"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52(\"3E\")==\"\"}G(l==\"1y\"&&D.14.1f){e=D.1K(V,\"1y\");I e==\"\"?\"1\":e}G(D.14.2G&&l==\"18\"){J d=V.50;V.50=\"0 7Y 7W\";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l=\"4i\";l=l.1o(/([A-Z])/g,\"-$1\").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18=\"3I\"}e=l==\"18\"&&g[2E.K-1]!=U?\"2F\":(c&&c.52(l))||\"\";R(i=0;i<g.K;i++)G(g[i]!=U)2E[i].V.18=g[i]}G(l==\"1y\"&&e==\"\")e=\"1\"}N G(f.4g){J h=l.1o(/\\\\-(\\\\w)/g,H(a,b){I b.2r()});e=f.4g[l]||f.4g[h];G(!/^\\\\d+(2X)?$/i.11(e)&&/^\\\\d/.11(e)){J j=V.1A,66=f.65.1A;f.65.1A=f.4g.1A;V.1A=e||0;e=V.aM+\"2X\";V.1A=j;f.65.1A=66}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3h==\\'12\\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4L)d+=\\'\\';G(1j d==\"23\"){d=d.1o(/(<(\\\\w+)[^>]*?)\\\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+\"></\"+c+\">\"});J f=D.3k(d).3y(),1v=h.3h(\"1v\");J e=!f.1h(\"<au\")&&[1,\"<2A 7w=\\'7w\\'>\",\"</2A>\"]||!f.1h(\"<ar\")&&[1,\"<7v>\",\"</7v>\"]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,\"<1T>\",\"</1T>\"]||!f.1h(\"<4F\")&&[2,\"<1T><22>\",\"</22></1T>\"]||(!f.1h(\"<af\")||!f.1h(\"<ad\"))&&[3,\"<1T><22><4F>\",\"</4F></22></1T>\"]||!f.1h(\"<7E\")&&[2,\"<1T><22></22><7q>\",\"</7q></1T>\"]||D.14.1f&&[1,\"1v<1v>\",\"</1v>\"]||[0,\"\",\"\"];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h(\"<1T\")&&f.1h(\"<22\")<0?1v.1x&&1v.1x.3t:e[1]==\"<1T>\"&&f.1h(\"<22\")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],\"22\")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\\\s/.11(d))1v.39(h.5F(d.1I(/^\\\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,\"3V\")&&!D.Y(d,\"2A\")))I;G(d[0]==12||D.Y(d,\"3V\")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f==\"2W\"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f==\"O\"&&D.Y(d,\"4T\")&&d.1d)7p\"O a3 a1\\'t 9V 9U\";d[f]=c}G(D.Y(d,\"3V\")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f==\"V\")I D.1K(d.V,\"9T\",c);G(40)d.9Q(f,\"\"+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f==\"1y\"){G(40){d.6B=1;d.1E=(d.1E||\"\").1o(/7f\\\\([^)]*\\\\)/,\"\")+(3r(c)+\\'\\'==\"9L\"?\"\":\"7f(1y=\"+c*7a+\")\")}I d.1E&&d.1E.1h(\"1y=\")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\\'\\':\"\"}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||\"\").1o(/^\\\\s+|\\\\s+$/g,\"\")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},2R:H(a,b){J i=0,T,2S=a.K;G(D.14.1f){1B(T=b[i++])G(T.16!=8)a[2S++]=T}N 1B(T=b[i++])a[2S++]=T;I a},4r:H(a){J c=[],2o={};1U{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2o[b]){2o[b]=M;c.1p(a[i])}}}1V(e){c=a}I c},3C:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1p(c[i]);I b},2l:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.7d.1w([],c)}});J v=9B.9A.3y();D.14={5B:(v.1I(/.+(?:9y|9x|9w|9v)[\\\\/: ]([\\\\d.]+)/)||[])[1],2k:/75/.11(v),2G:/2G/.11(v),1f:/1f/.11(v)&&!/2G/.11(v),42:/42/.11(v)&&!/(9s|75)/.11(v)};J y=D.14.1f?\"7o\":\"72\";D.1l({71:!D.14.1f||S.70==\"6Z\",3X:{\"R\":\"9n\",\"9k\":\"1F\",\"4i\":y,72:y,7o:y,9h:\"9f\",9e:\"9d\",9b:\"99\"}});D.P({6W:H(a){I a.1d},97:H(a){I D.4S(a,\"1d\")},95:H(a){I D.3a(a,2,\"2H\")},91:H(a){I D.3a(a,2,\"4l\")},8Z:H(a){I D.4S(a,\"2H\")},8X:H(a){I D.4S(a,\"4l\")},8W:H(a){I D.5v(a.1d.1x,a)},8V:H(a){I D.5v(a.1x)},6Q:H(a){I D.Y(a,\"8U\")?a.8T||a.8S.S:D.2d(a.3t)}},H(c,d){D.17[c]=H(b){J a=D.2l(7,d);G(b&&1j b==\"23\")a=D.3g(b,a);I 7.2I(D.4r(a))}});D.P({6P:\"3v\",8Q:\"6F\",39:\"6E\",8P:\"5q\",8O:\"7b\"},H(c,b){D.17[c]=H(){J a=19;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1K(7,a,\"\");G(7.16==1)7.5l(a)},8M:H(a){D.1F.1e(7,a)},8L:H(a){D.1F.21(7,a)},8K:H(a){D.1F[D.1F.3T(7,a)?\"21\":\"1e\"](7,a)},21:H(a){G(!a||D.1E(a,[7]).r.K){D(\"*\",7).1e(7).P(H(){D.W.21(7);D.3b(7)});G(7.1d)7.1d.37(7)}},4E:H(){D(\">*\",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P([\"6N\",\"4b\"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c[\"5t\"+c]||D.14.2k&&1b[\"5s\"+c]||S.70==\"6Z\"&&S.1C[\"5t\"+c]||S.1c[\"5t\"+c]:7[0]==S?29.2f(29.2f(S.1c[\"4y\"+c],S.1C[\"4y\"+c]),29.2f(S.1c[\"2i\"+c],S.1C[\"2i\"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+\"2X\")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?\"(?:[\\\\\\\\w*3m-]|\\\\\\\\\\\\\\\\.)\":\"(?:[\\\\\\\\w\\\\8F-\\\\8E*3m-]|\\\\\\\\\\\\\\\\.)\",6L=2B 4v(\"^>\\\\\\\\s*(\"+C+\"+)\"),6J=2B 4v(\"^(\"+C+\"+)(#)(\"+C+\"+)\"),6I=2B 4v(\"^([#.]?)(\"+C+\"*)\");D.1l({6H:{\"\":H(a,i,m){I m[2]==\"*\"||D.Y(a,m[2])},\"#\":H(a,i,m){I a.4G(\"2v\")==m[2]},\":\":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},\"3o-4u\":H(a){I a.1d.3H(\"*\")[0]==a},\"3S-4u\":H(a){I D.3a(a.1d.5T,1,\"4l\")==a},\"8z-4u\":H(a){I!D.3a(a.1d.5T,2,\"4l\")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||\"\").1h(m[3])>=0},4j:H(a){I\"1G\"!=a.O&&D.1g(a,\"18\")!=\"2F\"&&D.1g(a,\"5g\")!=\"1G\"},1G:H(a){I\"1G\"==a.O||D.1g(a,\"18\")==\"2F\"||D.1g(a,\"5g\")==\"1G\"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,\"2W\")},1r:H(a){I\"1r\"==a.O},5O:H(a){I\"5O\"==a.O},5L:H(a){I\"5L\"==a.O},5p:H(a){I\"5p\"==a.O},3Q:H(a){I\"3Q\"==a.O},5o:H(a){I\"5o\"==a.O},6A:H(a){I\"6A\"==a.O},6z:H(a){I\"6z\"==a.O},2s:H(a){I\"2s\"==a.O||D.Y(a,\"2s\")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\\\[) *@?([\\\\w-]+) *([!*$^~=]*) *(\\'?\"?)(.*?)\\\\4 *\\\\]/,/^(:)([\\\\w-]+)\\\\(\"?\\'?(.*?(\\\\(.*?\\\\))?[^(]*?)\"?\\'?\\\\)/,2B 4v(\"^([:.#]*)(\"+C+\"+)\")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\\\s*,\\\\s*/,\"\");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!=\"23\")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y==\"*\"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,\"\");G(t.1h(\" \")==0)6M;l=M}N{3j=/^([>+~])\\\\s*(\\\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m==\"~\"||m==\"+\"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m==\"~\"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m==\"~\")k[g]=M;r.1p(n)}G(m==\"+\")1X}}d=r;t=D.3k(t.1o(3j,\"\"));l=M}}G(t&&!l){G(!t.1h(\",\")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=\" \"+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\\\\\/g,\"\");J f=d[d.K-1];G(m[1]==\"#\"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v==\"23\"&&p.2v!=m[2])p=D(\\'[@2v=\"\\'+m[2]+\\'\"]\\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]==\"#\"&&m[3]?m[3]:m[1]!=\"\"||m[0]==\"\"?\"*\":m[2];G(a==\"*\"&&d[i].Y.3y()==\"49\")a=\"3n\";r=D.2R(r,d[i].3H(a))}G(m[1]==\".\")r=D.5m(r,m[2]);G(m[1]==\"#\"){J e=[];R(J i=0;r[i];i++)G(r[i].4G(\"2v\")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,\"\")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=\" \"+m+\" \";J c=[];R(J i=0;r[i];i++){J b=(\" \"+r[i].1F+\" \").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\\\\\/g,\"\");1X}}G(!m)1X;G(m[1]==\":\"&&m[2]==\"4Y\")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==\".\")r=D.5m(r,m[2],h);N G(m[1]==\"[\"){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\\'\\';G((O==\"\"&&!!z||O==\"=\"&&z==m[5]||O==\"!=\"&&z!=m[5]||O==\"^=\"&&z&&!z.1h(m[5])||O==\"$=\"&&z.6v(z.K-m[5].K)==m[5]||(O==\"*=\"||O==\"~=\")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==\":\"&&m[2]==\"3a-4u\"){J e={},g=[],11=/(-?)(\\\\d*)n((?:\\\\+|-)?\\\\d*)/.2D(m[3]==\"6D\"&&\"2n\"||m[3]==\"6C\"&&\"2n+1\"||!/\\\\D/.11(m[3])&&\"8q+\"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f==\"49\")f=f[m[2]];G(1j f==\"23\")f=6u(\"Q||H(a,i){I \"+f+\";}\");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,\"3w\")||D.L(f,\"3w\",{}),1H=D.L(f,\"1H\")||D.L(f,\"1H\",H(){G(1j D!=\"12\"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\\\s+/),H(c,b){J a=b.1R(\".\");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t(\"4o\"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,\"3w\"),1L,5i;G(i){G(h==12||(1j h==\"23\"&&h.8p(0)==\".\"))R(J g 1n i)7.21(e,g+(h||\"\"));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\\\s+/),H(b,a){J c=a.1R(\".\");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,\"1H\"),Q);N G(e.6n)e.6n(\"4o\"+a,D.L(e,\"1H\"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,\"1H\");G(d)d.T=U;D.3b(e,\"3w\");D.3b(e,\"1H\")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h(\"!\")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D(\"*\").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,\"1H\");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\\'a\\')&&h==\"4V\"))&&f[\"4o\"+h]&&f[\"4o\"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\\'a\\')&&h==\"4V\")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(\".\");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,\"3w\")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c=\"8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35\".1R(\" \");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O(\"53\",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e(\"53\",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O=\"3D\";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O(\"51\",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e(\"51\",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O=\"3N\";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c==\"4X\"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i<c.K)D.W.3M(b,c[i++]);I 7.4V(D.W.3M(b,H(a){7.4Z=(7.4Z||0)%i;a.32();I c[7.4Z++].1w(7,19)||Q}))},7X:H(a,b){I 7.2O(\\'3D\\',a).2O(\\'3N\\',b)},27:H(a){55();G(D.2Q)a.1k(S,D);N D.3A.1p(H(){I a.1k(7,D)});I 7}});D.1l({2Q:Q,3A:[],27:H(){G(!D.2Q){D.2Q=M;G(D.3A){D.P(D.3A,H(){7.1k(S)});D.3A=U}D(S).5C(\"27\")}}});J x=Q;H 55(){G(x)I;x=M;G(S.3K&&!D.14.2G)S.3K(\"69\",D.27,Q);G(D.14.1f&&1b==1S)(H(){G(D.2Q)I;1U{S.1C.7V(\"1A\")}1V(3e){3B(19.3L,0);I}D.27()})();G(D.14.2G)S.3K(\"69\",H(){G(D.2Q)I;R(J i=0;i<S.4W.K;i++)G(S.4W[i].3R){3B(19.3L,0);I}D.27()},Q);G(D.14.2k){J a;(H(){G(D.2Q)I;G(S.3f!=\"68\"&&S.3f!=\"1J\"){3B(19.3L,0);I}G(a===12)a=D(\"V, 7A[7U=7S]\").K;G(S.4W.K!=a){3B(19.3L,0);I}D.27()})()}D.W.1e(1b,\"43\",D.27)}D.P((\"7R,7Q,43,85,4y,4X,4V,7P,\"+\"7O,7N,89,53,51,7M,2A,\"+\"5o,7L,7K,8d,3e\").1R(\",\"),H(i,b){D.17[b]=H(a){I a?7.2O(b,a):7.1P(b)}});J F=H(a,c){J b=a.4k;1B(b&&b!=c)1U{b=b.1d}1V(3e){b=c}I b==c};D(1b).2O(\"4X\",H(){D(\"*\").1e(S).4e()});D.17.1l({67:D.17.43,43:H(g,d,c){G(1j g!=\\'23\\')I 7.67(g);J e=g.1h(\" \");G(e>=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f=\"2P\";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f=\"6g\"}J h=7;D.3Y({1a:g,O:f,1O:\"2K\",L:d,1J:H(a,b){G(b==\"1W\"||b==\"7J\")h.2K(i?D(\"<1v/>\").3v(a.4U.1o(/<1m(.|\\\\s)*?\\\\/1m>/g,\"\")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,\"3V\")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P(\"7H,7G,7F,7D,7C,7B\".1R(\",\"),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:\"2P\",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,\"1m\")},aD:H(c,b,a){I D.3p(c,b,a,\"3z\")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:\"6g\",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:\"2P\",2T:0,7z:\"4R/x-ax-3V-aw\",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:\"4R/2N, 1r/2N\",2K:\"1r/2K\",1m:\"1r/4t, 4R/4t\",3z:\"4R/3z, 1r/4t\",1r:\"1r/as\",4w:\"*/*\"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!=\"23\")s.L=D.3n(s.L);G(s.1O==\"4P\"){G(O==\"2P\"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\\\?/)?\"&\":\"?\")+(s.4P||\"7u\")+\"=?\"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+\"&\":\"\")+(s.4P||\"7u\")+\"=?\";s.1O=\"3z\"}G(s.1O==\"3z\"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g=\"4P\"+B++;G(s.L)s.L=(s.L+\"\").1o(2Z,\"=\"+g+\"$1\");s.1a=s.1a.1o(2Z,\"=\"+g+\"$1\");s.1O=\"1m\";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O==\"1m\"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O==\"2P\"){J j=1z();J k=s.1a.1o(/(\\\\?|&)3m=.*?(&|$)/,\"$ap=\"+j+\"$2\");s.1a=k+((k==s.1a)?(s.1a.1I(/\\\\?/)?\"&\":\"?\")+\"3m=\"+j:\"\")}G(s.L&&O==\"2P\"){s.1a+=(s.1a.1I(/\\\\?/)?\"&\":\"?\")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P(\"7H\");J n=/^(?:\\\\w+:)?\\\\/\\\\/([^\\\\/?#]+)/;G(s.1O==\"1m\"&&O==\"2P\"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H(\"6w\")[0];J h=S.3h(\"1m\");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f==\"68\"||7.3f==\"1J\")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s(\"ae.ac\"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B(\"ab-aa\",s.7z);G(s.5S)c.4B(\"a9-5R-a8\",D.4z[s.1a]||\"a7, a6 a5 a4 5N:5N:5N a2\");c.4B(\"X-9Z-9Y\",\"7r\");c.4B(\"9W\",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+\", */*\":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P(\"7B\",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a==\"2T\")){m=M;G(f){7k(f);f=U}1u=a==\"2T\"&&\"2T\"||!D.7j(c)&&\"3e\"||s.5S&&D.7h(c,s.1a)&&\"7J\"||\"1W\";G(1u==\"1W\"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u=\"5J\"}}G(1u==\"1W\"){J b;1U{b=c.5I(\"7g-5R\")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d(\"2T\")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P(\"7C\",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P(\"7F\",[c,s]);G(s.26&&!--D.4O)D.W.1P(\"7G\")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P(\"7D\",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O==\"5p:\"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I(\"7g-5R\");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I(\"9J-O\"),2N=c==\"2N\"||!c&&d&&d.1h(\"2N\")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j==\"5J\")7p\"5J\";G(b)L=b(L,c);G(c==\"1m\")D.5u(L);G(c==\"3z\")L=6u(\"(\"+L+\")\");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+\"=\"+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+\"=\"+3u(7))});N s.1p(3u(j)+\"=\"+3u(D.1D(a[j])?a[j]():a[j]));I s.6s(\"&\").1o(/%20/g,\"+\")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:\"1N\",2h:\"1N\",1y:\"1N\"},c,b):7.1E(\":1G\").P(H(){7.V.18=7.5D||\"\";G(D.1g(7,\"18\")==\"2F\"){J a=D(\"<\"+7.2j+\" />\").6P(\"1c\");7.V.18=a.1g(\"18\");G(7.V.18==\"2F\")7.V.18=\"3I\";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:\"1M\",2h:\"1M\",1y:\"1M\"},b,a):7.1E(\":4j\").P(H(){7.5D=7.5D||D.1g(7,\"18\");7.V.18=\"2F\"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:\"2m\",2h:\"2m\",1y:\"2m\"},a,b):7.P(H(){D(7)[D(7).3F(\":1G\")?\"1N\":\"1M\"]()})},9G:H(b,a){I 7.2g({1Z:\"1N\"},b,a)},9F:H(b,a){I 7.2g({1Z:\"1M\"},b,a)},9E:H(b,a){I 7.2g({1Z:\"2m\"},b,a)},9D:H(b,a){I 7.2g({1y:\"1N\"},b,a)},9M:H(b,a){I 7.2g({1y:\"1M\"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?\"P\":\"36\"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(\":1G\"),46=7;R(p 1n k){G(k[p]==\"1M\"&&1G||k[p]==\"1N\"&&!1G)I f.1J.1k(7);G(p==\"1Z\"||p==\"2h\"){f.18=D.1g(7,\"18\");f.33=7.V.33}}G(f.33!=U)7.V.33=\"1G\";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a==\"2m\"?1G?\"1N\":\"1M\":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||\"2X\";G(2M!=\"2X\"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]==\"-=\"?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,\"\")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a=\"28\"}G(!a||(1j a==\"23\"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||\"28\";J q=D.L(b,c+\"36\");G(!q||a)q=D.L(b,c+\"36\",D.2d(a))}I q};D.17.5A=H(a){a=a||\"28\";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i==\"1Z\"||7.1i==\"2h\")7.T.V.18=\"3I\"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||\"2X\";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i<a.K;i++)G(!a[i]())a.7n(i--,1);G(!a.K){7k(D.48);D.48=U}},13)}},1N:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1N=M;7.3G(0,7.1t());G(7.1i==\"2h\"||7.1i==\"1Z\")7.T.V[7.1i]=\"9m\";D(7.T).1N()},1M:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1M=M;7.3G(7.1t(),0)},2Y:H(a){J t=1z();G(a||t>7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,\"18\")==\"2F\")7.T.V.18=\"3I\"}G(7.15.1M)7.T.V.18=\"2F\";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?\"5P\":\"73\")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,\"1y\",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,\"30\")==\"3c\";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,\"30\")==\"3c\")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,\"18\")))1e(-d.2e,-d.2c);G(42&&1g(d,\"33\")!=\"4j\")2C(d);d=d.1d}G((5U&&(3c||1g(4a,\"30\")==\"5x\"))||(42&&1g(4a,\"30\")!=\"5x\"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,\"6V\",M),D.2a(a,\"6U\",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\\'94\\');2i.1A-=25(7,\\'aF\\');4c.1S+=25(b,\\'6U\\');4c.1A+=25(b,\\'6V\\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\\'30\\')==\\'93\\'))a=a.1s;I D(a)}});D.P([\\'5e\\',\\'5G\\'],H(i,b){J c=\\'4y\\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\\'aI\\':\\'aJ\\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P([\"6N\",\"4b\"],H(i,b){J c=i?\"5e\":\"5G\",4f=i?\"6k\":\"6i\";D.17[\"5s\"+b]=H(){I 7[b.3y()]()+25(7,\"57\"+c)+25(7,\"57\"+4f)};D.17[\"90\"+b]=H(a){I 7[\"5s\"+b]()+25(7,\"2C\"+c+\"4b\")+25(7,\"2C\"+4f+\"4b\")+(a?25(7,\"6S\"+c)+25(7,\"6S\"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{}))"
  },
  {
    "path": "Doc/LuaAPI/assets/search.js",
    "content": "(function($){\n  \n  /* Adapted from http://www.kryogenix.org/code/browser/searchhi/ */\n  $.fn.highlightText = function(text, className) {\n    function highlight(node) {\n      if (node.nodeType == 3) { // Node.TEXT_NODE\n        var val = node.nodeValue;\n        var pos = val.toLowerCase().indexOf(text);\n        if (pos >= 0 && !$.className.has(node.parentNode, className)) {\n          var span = document.createElement(\"span\");\n          span.className = className;\n          var txt = document.createTextNode(val.substr(pos, text.length));\n          span.appendChild(txt);\n          node.parentNode.insertBefore(span, node.parentNode.insertBefore(\n            document.createTextNode(val.substr(pos + text.length)),\n              node.nextSibling));\n          node.nodeValue = val.substr(0, pos);\n        }\n      } else if (!$(node).is(\"button, select, textarea\")) {\n        $.each(node.childNodes, function() { highlight(this) });\n      }\n    }\n    return this.each(function() { highlight(this) });\n  }\n  \n  $(document).ready(function() {\n    var elems = $(\".searchable\");\n    if (!elems.length) return;\n  \n    function getSearchTerms(url) {\n      if (url.indexOf(\"?\") == -1) return [];\n      var params = url.substr(url.indexOf(\"?\") + 1).split(\"&\");\n      for (var p in params) {\n        var param = params[p].split(\"=\");\n        if (param.length < 2) continue;\n        if (param[0] == \"q\" || param[0] == \"p\") {// q= for Google, p= for Yahoo\n          var query = decodeURIComponent(param[1].replace(/\\+/g, \" \"));\n          if (query[0] == \"!\") query = query.slice(1);\n          var terms = [];\n          $.each(query.split(/(\".*?\"|'.*?'|\\s+)/), function() {\n            if (terms.length < 10) {\n              term = this.replace(/^\\s+$/, \"\")\n                         .replace(/^['\"]/, \"\")\n                         .replace(/['\"]$/, \"\");\n              if (term.length >= 3)\n                terms.push(term);\n            }\n          });\n          return terms;\n        }\n      }\n      return [];\n    }\n  \n    var terms = getSearchTerms(document.URL);\n    if (!terms.length) terms = getSearchTerms(document.referrer);\n    $.each(terms, function(idx) {\n      elems.highlightText(this.toLowerCase(), \"searchword\" + (idx % 5));\n    });\n  });\n\n})(jQuery);\n"
  },
  {
    "path": "Doc/LuaAPI/assets/trac.css",
    "content": "body { background: #fff; color: #000; margin: 10px; padding: 0; }\nbody, th, td {\n font: normal 13px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;\n}\nh1, h2, h3, h4 {\n font-family: Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif;\n font-weight: bold;\n letter-spacing: -0.018em;\n page-break-after: avoid;\n}\nh1 { font-size: 19px; margin: .15em 1em 0.5em 0 }\nh2 { font-size: 16px }\nh3 { font-size: 14px }\nhr { border: none;  border-top: 1px solid #ccb; margin: 2em 0 }\naddress { font-style: normal }\nimg { border: none }\n\n.underline { text-decoration: underline }\nol.loweralpha { list-style-type: lower-alpha }\nol.upperalpha { list-style-type: upper-alpha }\nol.lowerroman { list-style-type: lower-roman }\nol.upperroman { list-style-type: upper-roman }\nol.arabic     { list-style-type: decimal }\n\n/* Link styles */\n:link, :visited {\n text-decoration: none;\n color: #b00;\n border-bottom: 1px dotted #bbb;\n}\n:link:hover, :visited:hover { background-color: #eee; color: #555 }\nh1 :link, h1 :visited ,h2 :link, h2 :visited, h3 :link, h3 :visited,\nh4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited {\n color: inherit;\n}\n.trac-rawlink { border-bottom: none }\n\n/* Heading anchors */\n.anchor:link, .anchor:visited {\n border: none;\n color: #d7d7d7;\n font-size: .8em;\n vertical-align: text-top;\n}\n* > .anchor:link, * > .anchor:visited {\n visibility: hidden;\n}\nh1:hover .anchor, h2:hover .anchor, h3:hover .anchor,\nh4:hover .anchor, h5:hover .anchor, h6:hover .anchor {\n visibility: visible;\n}\n\n@media screen {\n a.ext-link .icon {\n  background: url(../extlink.gif) center center no-repeat;\n  padding-left: 12px;\n }\n a.mail-link .icon {\n  background: url(../envelope.png) center center no-repeat;\n  padding-left: 14px;\n }\n}\n\n/* Forms */\ninput, textarea, select { margin: 2px }\ninput, select { vertical-align: middle }\ninput[type=button], input[type=submit], input[type=reset] {\n background: #eee;\n color: #222;\n border: 1px outset #ccc;\n padding: .1em .5em;\n}\ninput[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {\n background: #ccb;\n}\ninput[type=button][disabled], input[type=submit][disabled],\ninput[type=reset][disabled] {\n background: #f6f6f6;\n border-style: solid;\n color: #999;\n}\ninput[type=text], input.textwidget, textarea { border: 1px solid #d7d7d7 }\ninput[type=text], input.textwidget { padding: .25em .5em }\ninput[type=text]:focus, input.textwidget:focus, textarea:focus {\n border: 1px solid #886;\n}\noption { border-bottom: 1px dotted #d7d7d7 }\nfieldset { border: 1px solid #d7d7d7; padding: .5em; margin: 1em 0 }\nform p.hint, form span.hint { color: #666; font-size: 85%; font-style: italic; margin: .5em 0;\n  padding-left: 1em;\n}\nfieldset.iefix {\n  background: transparent;\n  border: none;\n  padding: 0;\n  margin: 0;\n}\n* html fieldset.iefix { width: 98% }\nfieldset.iefix p { margin: 0 }\nlegend { color: #999; padding: 0 .25em; font-size: 90%; font-weight: bold }\nlabel.disabled { color: #d7d7d7 }\n.buttons { margin: .5em .5em .5em 0 }\n.buttons form, .buttons form div { display: inline }\n.buttons input { margin: 1em .5em .1em 0 }\n.inlinebuttons input { \n font-size: 70%;\n border-width: 1px;\n border-style: dotted;\n margin: 0 .1em;\n padding: 0.1em;\n background: none;\n}\n\n/* Header */\n#header hr { display: none }\n#header h1 { margin: 1.5em 0 -1.5em; }\n#header img { border: none; margin: 0 0 -3em }\n#header :link, #header :visited, #header :link:hover, #header :visited:hover {\n background: transparent;\n color: #555;\n margin-bottom: 2px;\n border: none;\n}\n#header h1 :link:hover, #header h1 :visited:hover { color: #000 }\n\n/* Quick search */\n#search {\n clear: both;\n font-size: 10px;\n height: 2.2em;\n margin: 0 0 1em;\n text-align: right;\n}\n#search input { font-size: 10px }\n#search label { display: none }\n\n/* Navigation */\n.nav h2, .nav hr { display: none }\n.nav ul { font-size: 10px; list-style: none; margin: 0; text-align: right }\n.nav li {\n border-right: 1px solid #d7d7d7;\n display: inline;\n padding: 0 .75em;\n white-space: nowrap;\n}\n.nav li.last { border-right: none }\n\n/* Main navigation bar */\n#mainnav {\n background: #f7f7f7 url(../topbar_gradient.png) 0 0;\n border: 1px solid #000;\n font: normal 10px verdana,'Bitstream Vera Sans',helvetica,arial,sans-serif;\n margin: .66em 0 .33em;\n padding: .2em 0;\n}\n#mainnav li { border-right: none; padding: .25em 0 }\n#mainnav :link, #mainnav :visited {\n background: url(../dots.gif) 0 0 no-repeat;\n border-right: 1px solid #fff;\n border-bottom: none;\n border-left: 1px solid #555;\n color: #000;\n padding: .2em 20px;\n}\n* html #mainnav :link, * html #mainnav :visited { background-position: 1px 0 }\n#mainnav :link:hover, #mainnav :visited:hover {\n background-color: #ccc;\n border-right: 1px solid #ddd;\n}\n#mainnav .active :link, #mainnav .active :visited {\n background: #333 url(../topbar_gradient2.png) 0 0 repeat-x;\n border-top: none;\n border-right: 1px solid #000;\n color: #eee;\n font-weight: bold;\n}\n#mainnav .active :link:hover, #mainnav .active :visited:hover {\n border-right: 1px solid #000;\n}\n\n/* Context-dependent navigation links */\n#ctxtnav { height: 1em }\n#ctxtnav li ul {\n background: #f7f7f7;\n color: #ccc;\n border: 1px solid;\n padding: 0;\n display: inline;\n margin: 0;\n}\n#ctxtnav li li { padding: 0; }\n#ctxtnav li li :link, #ctxtnav li li :visited { padding: 0 1em }\n#ctxtnav li li :link:hover, #ctxtnav li li :visited:hover {\n background: #bba;\n color: #fff;\n}\n\n/* Alternate links */\n#altlinks { clear: both; text-align: center }\n#altlinks h3 { font-size: 12px; letter-spacing: normal; margin: 0 }\n#altlinks ul { list-style: none; margin: 0; padding: 0 0 1em }\n#altlinks li {\n border-right: 1px solid #d7d7d7;\n display: inline;\n font-size: 11px;\n line-height: 1.5;\n padding: 0 1em;\n white-space: nowrap;\n}\n#altlinks li.last { border-right: none }\n#altlinks li :link, #altlinks li :visited {\n background-repeat: no-repeat;\n color: #666;\n border: none;\n padding: 0 0 2px;\n}\n#altlinks li a.ics { background-image: url(../ics.png); padding-left: 22px }\n#altlinks li a.rss { background-image: url(../feed.png); padding-left: 20px }\n\n/* Footer */\n#footer {\n  clear: both;\n  color: #bbb;\n  font-size: 10px;\n  border-top: 1px solid;\n  height: 31px;\n  padding: .25em 0;\n}\n#footer :link, #footer :visited { color: #bbb; }\n#footer hr { display: none }\n#footer #tracpowered { border: 0; float: left }\n#footer #tracpowered:hover { background: transparent }\n#footer p { margin: 0 }\n#footer p.left {\n  float: left;\n  margin-left: 1em;\n  padding: 0 1em;\n  border-left: 1px solid #d7d7d7;\n  border-right: 1px solid #d7d7d7;\n}\n#footer p.right {\n  float: right;\n  text-align: right;\n}\n\n#content { padding-bottom: 2em; position: relative }\n\n#help {\n clear: both;\n color: #999;\n font-size: 90%;\n margin: 1em;\n text-align: right;\n}\n#help :link, #help :visited { cursor: help }\n#help hr { display: none }\n\n/* Page preferences form */\n#prefs {\n background: #f7f7f0;\n border: 1px outset #998;\n float: right;\n font-size: 9px;\n padding: .8em;\n position: relative;\n margin: 0 1em 1em;\n}\n* html #prefs { width: 26em } /* Set width only for IE */\n#prefs input, #prefs select { font-size: 9px; vertical-align: middle }\n#prefs fieldset {\n background: transparent;\n border: none;\n margin: .5em;\n padding: 0;\n}\n#prefs fieldset legend {\n background: transparent;\n color: #000;\n font-size: 9px;\n font-weight: normal;\n margin: 0 0 0 -1.5em;\n padding: 0;\n}\n#prefs .buttons { text-align: right }\n\n/* Version information (browser, wiki, attachments) */\n#info {\n margin: 1em 0 0 0;\n background: #f7f7f0;\n border: 1px solid #d7d7d7;\n border-collapse: collapse;\n border-spacing: 0;\n clear: both;\n width: 100%;\n}\n#info th, #info td { font-size: 85%; padding: 2px .5em; vertical-align: top }\n#info th { font-weight: bold; text-align: left; white-space: nowrap }\n#info td.message { width: 100% }\n#info .message ul { padding: 0; margin: 0 2em }\n#info .message p { margin: 0; padding: 0 }\n\n/* Wiki */\n.wikipage { padding-left: 18px }\n.wikipage h1, .wikipage h2, .wikipage h3 { margin-left: -18px }\n\na.missing:link, a.missing:visited, a.missing, span.missing,\na.forbidden, span.forbidden { color: #998 }\na.missing:hover { color: #000 }\na.closed:link, a.closed:visited, span.closed { text-decoration: line-through }\n\n/* User-selectable styles for blocks */\n.important {\n background: #fcb;\n border: 1px dotted #d00;\n color: #500;\n padding: 0 .5em 0 .5em;\n margin: .5em;\n}\n\ndl.wiki dt { font-weight: bold }\ndl.compact dt { float: left; padding-right: .5em }\ndl.compact dd { margin: 0; padding: 0 }\n\npre.wiki, pre.literal-block {\n background: #f7f7f7;\n border: 1px solid #d7d7d7;\n margin: 1em 1.75em;\n padding: .25em;\n overflow: auto;\n}\n\nblockquote.citation { \n margin: -0.6em 0;\n border-style: solid; \n border-width: 0 0 0 2px; \n padding-left: .5em;\n border-color: #b44; \n}\n.citation blockquote.citation { border-color: #4b4; }\n.citation .citation blockquote.citation { border-color: #44b; }\n.citation .citation .citation blockquote.citation { border-color: #c55; }\n\ntable.wiki {\n border: 2px solid #ccc;\n border-collapse: collapse;\n border-spacing: 0;\n}\ntable.wiki td { border: 1px solid #ccc;  padding: .1em .25em; }\n\n.wikitoolbar {\n margin-top: 0.3em;\n margin-left: 2px;\n border: solid #d7d7d7;\n border-width: 1px 1px 1px 0;\n height: 18px;\n width: 234px;\n}\n.wikitoolbar :link, .wikitoolbar :visited {\n background: transparent url(../edit_toolbar.png) no-repeat;\n border: 1px solid #fff;\n border-left-color: #d7d7d7;\n cursor: default;\n display: block;\n float: left;\n width: 24px;\n height: 16px;\n}\n.wikitoolbar :link:hover, .wikitoolbar :visited:hover {\n background-color: transparent;\n border: 1px solid #fb2;\n}\n.wikitoolbar a#em { background-position: 0 0 }\n.wikitoolbar a#strong { background-position: 0 -16px }\n.wikitoolbar a#heading { background-position: 0 -32px }\n.wikitoolbar a#link { background-position: 0 -48px }\n.wikitoolbar a#code { background-position: 0 -64px }\n.wikitoolbar a#hr { background-position: 0 -80px }\n.wikitoolbar a#np { background-position: 0 -96px }\n.wikitoolbar a#br { background-position: 0 -112px }\n.wikitoolbar a#img { background-position: 0 -128px }\n\n/* Styles for the form for adding attachments. */\n#attachment .field { margin-top: 1.3em }\n#attachment label { padding-left: .2em }\n#attachment fieldset { margin-top: 2em }\n#attachment fieldset .field { float: left; margin: 0 1em .5em 0 }\n#attachment .options { float: left; padding: 0 0 1em 1em }\n#attachment br { clear: left }\n.attachment #preview { margin-top: 1em }\n\n/* Styles for the list of attachments. */\n#attachments { border: 1px outset #996; padding: 1em }\n#attachments .attachments { margin-left: 2em; padding: 0 }\n#attachments dt { display: list-item; list-style: square; }\n#attachments dd { font-style: italic; margin-left: 0; padding-left: 0; }\n\n/* Styles for tabular listings such as those used for displaying directory\n   contents and report results. */\ntable.listing {\n clear: both;\n border-bottom: 1px solid #d7d7d7;\n border-collapse: collapse;\n border-spacing: 0;\n margin-top: 1em;\n width: 100%;\n}\ntable.listing th { text-align: left; padding: 0 1em .1em 0; font-size: 12px }\ntable.listing thead { background: #f7f7f0 }\ntable.listing thead th {\n border: 1px solid #d7d7d7;\n border-bottom-color: #999;\n font-size: 11px;\n font-weight: bold;\n padding: 2px .5em;\n vertical-align: bottom;\n}\ntable.listing thead th :link:hover, table.listing thead th :visited:hover {\n background-color: transparent;\n}\ntable.listing thead th a { border: none; padding-right: 12px }\ntable.listing th.asc a, table.listing th.desc a { font-weight: bold }\ntable.listing th.asc a, table.listing th.desc a {\n background-position: 100% 50%;\n background-repeat: no-repeat;\n}\ntable.listing th.asc a { background-image: url(../asc.png) }\ntable.listing th.desc a { background-image: url(../desc.png) }\ntable.listing tbody td, table.listing tbody th {\n border: 1px dotted #ddd;\n padding: .3em .5em;\n vertical-align: top;\n}\ntable.listing tbody td a:hover, table.listing tbody th a:hover {\n background-color: transparent;\n}\ntable.listing tbody tr { border-top: 1px solid #ddd }\ntable.listing tbody tr.even { background-color: #fcfcfc }\ntable.listing tbody tr.odd { background-color: #f7f7f7 }\ntable.listing tbody tr:hover { background: #eed !important }\ntable.listing tbody tr.focus { background: #ddf !important }\n\n/* Styles for the page history table\n   (extends the styles for \"table.listing\") */\n#fieldhist td { padding: 0 .5em }\n#fieldhist td.date, #fieldhist td.diff, #fieldhist td.version,\n#fieldhist td.author {\n white-space: nowrap;\n}\n#fieldhist td.version { text-align: center }\n#fieldhist td.comment { width: 100% }\n\n/* Auto-completion interface */\n.suggestions { background: #fff; border: 1px solid #886; color: #222; }\n.suggestions ul {\n  font-family: sans-serif;\n  max-height: 20em;\n  min-height: 3em;\n  list-style: none;\n  margin: 0;\n  overflow: auto;\n  padding: 0;\n  width: 440px;\n}\n* html .suggestions ul { height: 10em; }\n.suggestions li { background: #fff; cursor: pointer; padding: 2px 5px }\n.suggestions li.selected { background: #b9b9b9 }\n\n/* Styles for the error page (and rst errors) */\n#content.error .message, div.system-message {\n background: #fdc;\n border: 2px solid #d00;\n color: #500;\n padding: .5em;\n margin: 1em 0;\n}\n#content.error div.message pre, div.system-message pre {\n  margin-left: 1em;\n  overflow: hidden;\n  white-space: normal;\n}\ndiv.system-message p { margin: 0; }\ndiv.system-message p.system-message-title { font-weight: bold; }\n\n#warning.system-message { background: #ffb; border: 1px solid #000; }\n#warning.system-message li { list-style-type: square; }\n\n#notice.system-message { background: #dfd; border: 1px solid #000; }\n#notice.system-message li { list-style-type: square; }\n\n#content.error form.newticket { display: inline; }\n#content.error form.newticket textarea { display: none; }\n\n#content.error #systeminfo { margin: 1em; width: auto; }\n#content.error #systeminfo th { font-weight: bold; text-align: right; }\n\n#content.error #traceback { margin-left: 1em; }\n#content.error #traceback :link, #content.error #traceback :visited {\n  border: none;\n}\n#content.error #tbtoggle { font-size: 80%; }\n#content.error #traceback div { margin-left: 1em; }\n#content.error #traceback h3 { font-size: 95%; margin: .5em 0 0; }\n#content.error #traceback :link var, #content.error #traceback :visited var {\n  font-family: monospace;\n  font-style: normal;\n  font-weight: bold;\n}\n#content.error #traceback span.file { color: #666; font-size: 85%; }\n#content.error #traceback ul { list-style: none; margin: .5em 0; padding: 0; }\n#content.error #traceback ol {\n  border: 1px dotted #d7d7d7;\n  color: #999;\n  font-size: 85%;\n  line-height: 1;\n  margin: .5em 0;\n}\n#content.error #traceback ol li { white-space: pre; }\n#content.error #traceback ol li.current { background: #e6e6e6; color: #333; }\n#content.error #traceback ol li code { color: #666; }\n#content.error #traceback ol li.current code { color: #000; }\n#content.error #traceback table { margin: .5em 0 1em;  }\n#content.error #traceback th, #content.error #traceback td {\n  font-size: 85%; padding: 1px;\n}\n#content.error #traceback th var {\n  font-family: monospace;\n  font-style: normal;\n}\n#content.error #traceback td code { white-space: pre; }\n#content.error #traceback pre { font-size: 95%; }\n\n#content .paging { margin: 0 0 2em; padding: .5em 0 0;\n  font-size: 85%; line-height: 2em; text-align: center;\n}\n#content .paging .current { \n  padding: .1em .3em;\n  border: 1px solid #333;\n  background: #999; color: #fff; \n}\n\n#content .paging :link, #content .paging :visited {\n  padding: .1em .3em;\n  border: 1px solid #666;\n  background: transparent; color: #666;\n}\n#content .paging :link:hover, #content .paging :visited:hover {\n  background: #999; color: #fff;  border-color: #333;\n}\n#content .paging .previous a, \n#content .paging .next a {\n  font-size: 150%; font-weight: bold; border: none;\n}\n#content .paging .previous a:hover,\n#content .paging .next a:hover {\n  background: transparent; color: #666;\n}\n\n#content h2 .numresults { color: #666; font-size: 90%; }\n\n/* Styles for search word highlighting */\n@media screen {\n .searchword0 { background: #ff9 }\n .searchword1 { background: #cfc }\n .searchword2 { background: #cff }\n .searchword3 { background: #ccf }\n .searchword4 { background: #fcf }\n}\n\n@media print {\n #header, #altlinks, #footer, #help { display: none }\n .nav, form, .buttons form, form .buttons, form .inlinebuttons,\n .noprint, .trac-rawlink {\n   display: none;\n }\n form.printableform { display: block }\n}\n"
  },
  {
    "path": "Doc/LuaAPI/assets/trac.js",
    "content": "(function($){\n  \n  $.fn.addAnchor = function(title) {\n    title = title || \"Link here\";\n    return this.filter(\"*[id]\").each(function() {\n      $(\"<a class='anchor'> \\u00B6</a>\").attr(\"href\", \"#\" + this.id)\n        .attr(\"title\", title).appendTo(this);\n    });\n  }\n  \n  $.fn.checked = function(checked) {\n    if (checked == undefined) { // getter\n      if (!this.length) return false;\n      return this.get(0).checked;\n    } else { // setter\n      return this.each(function() {\n        this.checked = checked;\n      });\n    }\n  }\n  \n  $.fn.enable = function(enabled) {\n    if (enabled == undefined) enabled = true;\n    return this.each(function() {\n      this.disabled = !enabled;\n      var label = $(this).parents(\"label\");\n      if (!label.length && this.id) {\n        label = $(\"label[for='\" + this.id + \"']\");\n      }\n      if (!enabled) {\n        label.addClass(\"disabled\");\n      } else {\n        label.removeClass(\"disabled\");\n      }\n    });\n  }\n  \n  $.loadStyleSheet = function(href, type) {\n    type = type || \"text/css\";\n    $(document).ready(function() {\n      if (document.createStyleSheet) { // MSIE\n        document.createStyleSheet(href);\n      } else {\n        $(\"<link rel='stylesheet' type='\" + type + \"' href='\" + href + \"' />\")\n          .appendTo(\"head\");\n      }\n    });\n  }\n  \n  // Used for dynamically updating the height of a textarea\n  window.resizeTextArea = function (id, rows) {\n    var textarea = $(\"#\" + id).get(0);\n    if (!textarea || textarea.rows == undefined) return;\n    textarea.rows = rows;\n  }\n  \n  // The following are defined for backwards compatibility with releases prior\n  // to Trac 0.11\n  \n  window.addEvent = function(elem, type, func) {\n    $(elem).bind(type, func);\n  }\n  window.addHeadingLinks = function(container, title) {\n    $.each([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"], function() {\n      $(this, container).addAnchor(title);\n    });\n  }\n  window.enableControl = function(id, enabled) {\n    $(\"#\" + id).enable(enabled);\n  }\n  window.getAncestorByTagName = function(elem, tagName) {\n    return $(elem).parents(tagName).get(0);\n  }\n\n})(jQuery);"
  },
  {
    "path": "Doc/LuaAPI/assets/wiki.css",
    "content": "@import url(code.css);\n\n/* Styles for the path of hierarchical pages */\np.path { margin: 0; padding: 0 0 .5em; font-size: .75em }\np.path :link, p.path :visited { margin: 0 .2em }\np.path .sep { color: #666; padding: 0 .1em }\np.path .pathentry { float: left }\n\n/* Styles for the page editing form */\n#edit #rows { float: right; font-size: 80% }\n#edit #rows select { font-size: 90% }\n#edit fieldset { margin-left: 1px; margin-right: 1px }\n#edit #text { clear: both; margin-left: -1px; margin-right: -1px; padding: 0; width: 100% }\n#edit .wikitoolbar { float: left; margin-left: -1px }\n#changeinfo { padding: .5em }\n#changeinfo .field { float: left; margin: 0 1em .5em 0 }\n#changeinfo br { clear: left }\n#changeinfo .options { padding: 0 0 1em 1em }\n#changeinfo .options, #changeinfo .buttons { clear: left }\n#delete, #save { margin-left: 6em }\n#preview {\n background: #f4f4f4 url(../draft.png);\n margin: 1em 0 2em;\n overflow: auto;\n}\n#template { vertical-align: middle; padding-top: 1em; }\n\n/* Diff view */\n#overview .multi { color: #999 }\n#overview .ipnr { color: #999; font-size: 80% }\n#overview .comment { padding: 1em 0 0 }\n\n@media print { \n th.diff, td.diff { display: none }\n}\n\n/* Styles for the TracGuideToc wikimacro */\n.wiki-toc {\n padding: .5em 1em;\n margin: 0 0 2em 1em;\n float: right;\n border: 1px outset #ddc;\n background: #ffd;\n font-size: 85%;\n position: relative;\n}\n.wiki-toc h4 { font-size: 12px; margin: 0 }\n.wiki-toc ul, .wiki-toc ol { list-style: none; padding: 0; margin: 0 }\n.wiki-toc ul ul, .wiki-toc ol ol { padding-left: 1.2em }\n.wiki-toc li { margin: 0; padding: 0 }\n.wiki-toc .active { background: #ff9; position: relative; }\n"
  },
  {
    "path": "Doc/LuaAPI/callbacks.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/CompositeCallback – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"callbacks_files/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"callbacks_files/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"callbacks_files/jquery.js\"></script><script type=\"text/javascript\" src=\"callbacks_files/trac.js\"></script><script type=\"text/javascript\" src=\"callbacks_files/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"Compositeからのコールバック仕様UI_FormUI_List共通\">Compositeからのコールバック仕様(UI_Form / UI_List共通)<a title=\"このセクションへのリンク\" href=\"#Composite%E3%81%8B%E3%82%89%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E4%BB%95%E6%A7%98UI_FormUI_List%E5%85%B1%E9%80%9A\" class=\"anchor\"> ¶</a></h2>\n<p>\nUI_FormやUI_ListはCompositeを使用してフォームを表示します。\nフォーム内のコントロールは、操作されることでLuaのコールバック関数を呼ぶことができます。\n</p>\n<p>\nCompositeから呼ばれるLuaコールバック関数は、下記の形式を持ちます。\n</p>\n<pre class=\"wiki\">   function &lt;composite-lua-callback&gt; ( &lt;string:name&gt;, &lt;int:type&gt;, &lt;int:param&gt; )\n\n   end\n</pre><ul><li>&lt;string:name&gt; 操作が生じたコントロールにComposite中で与えられた名前\n</li><li>&lt;int:type&gt; 操作の種類。下記の値を持つ。\n<ul><li>ACTION_PUSH コントロールがPUSHされた(TAP操作)\n</li><li>ACTION_RELEASE コントロールがRELEASEされた(RELEASE操作)\n</li><li>ACTION_ENDANIM アニメーションが終了した\n</li><li>ACTION_CHANGE チェックボックス等の状態が変更された\n</li><li>ACTION_CLICK ボタンがクリックされた\n</li></ul></li><li>&lt;int:param&gt; その他パラメータ\n<ul><li>ACTION_CHANGEの時 変更後のチェックボックス状態\n</li></ul></li></ul><p>\n複数のコントロールに対する応答を一つのコールバックで行う場合は、\n&lt;string:name&gt; と &lt;int:type&gt; で分岐します。\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"callbacks_files/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/design_lua.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/lua – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"Luaスクリプトインタフェース\">Luaスクリプトインタフェース<a title=\"このセクションへのリンク\" href=\"#Lua%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9\" class=\"anchor\"> ¶</a></h2>\n<p>\nここでは、タスクとは独立したLuaインタフェース関数について解説します。\n</p>\n<ul><li><a class=\"wiki\" href=\"index.html\">汎用タスクマニュアル</a>\n</li></ul><h3 id=\"スクリプトの実行ルール\">スクリプトの実行ルール<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%81%AE%E5%AE%9F%E8%A1%8C%E3%83%AB%E3%83%BC%E3%83%AB\" class=\"anchor\"> ¶</a></h3>\n<ul><li>スクリプトはロードされた直後、グローバル域とsetup()が実行される\n</li><li>毎フレームP_SCRIPTフェーズにexecute()が呼ばれる。\n</li><li>sysLoad()関数を用いて他のスクリプトに移動することが決定したとき、leave()が呼ばれる。\n</li><li>sysLoad()で指定された移動先のスクリプトがロードされるのは、次のフレームのP_SCRIPTフェーズ。\n</li></ul><h3 id=\"タスクの実行ルール\">タスクの実行ルール<a title=\"このセクションへのリンク\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E3%81%AE%E5%AE%9F%E8%A1%8C%E3%83%AB%E3%83%BC%E3%83%AB\" class=\"anchor\"> ¶</a></h3>\n<ul><li>タスクは、起動関数を呼ぶことで起動される。\n</li><li>起動関数は、必ずタスクのポインタを返す。\n</li><li>起動中のタスクに対しコマンドを与える際は、sysCommand()関数を使用する。第一引数は対象タスクのポインタ、第二引数が各タスクによって定義されるコマンド値となる。引数が必要な場合は、第三引数以降に続ける。\n</li><li>起動中のタスクを個別に破棄するには、TASK_kill() 関数を用いる。\n</li><li>「ステージタスク」として登録されているタスクは、TASK_StageClear()関数でまとめて破棄することができる。\n</li><li>起動したタスクを「ステージタスク」として登録する場合は、TASK_StageOnly()関数にタスクのポインタを与える。\n</li><li>タスクが起動すると自動的に「ステージタスク」になるように実装されているケースもある。\n</li></ul><h2 id=\"Luaスクリプト関数リファレンス\">Luaスクリプト関数リファレンス<a title=\"このセクションへのリンク\" href=\"#Lua%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9\" class=\"anchor\"> ¶</a></h2>\n<ul><li><a class=\"wiki\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E9%96%A2%E6%95%B0\">システム関数</a>\n</li><li><a class=\"wiki\" href=\"#IDKeyChain%E9%96%A2%E6%95%B0\">ID/KeyChain関数</a>\n</li><li><a class=\"wiki\" href=\"#GL%E9%96%A2%E6%95%B0\">GL関数</a>\n</li><li><a class=\"wiki\" href=\"#SG%E9%96%A2%E6%95%B0\">GuardBand関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E8%B5%B7%E5%8B%95%E9%96%A2%E6%95%B0\">アプリケーション起動関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%83%A2%E3%83%BC%E3%83%89%E9%96%A2%E6%95%B0\">デバッグモード関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E6%83%85%E5%A0%B1%E3%83%80%E3%83%B3%E3%83%97%E9%96%A2%E6%95%B0\">システムリソース情報ダンプ関数</a>\n</li><li><a class=\"wiki\" href=\"#Engine%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\">Engine情報関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\">フォント情報関数</a>\n</li><li><a class=\"wiki\" href=\"#ASSET%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\">ASSET情報関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E3%82%BB%E3%83%83%E3%83%88%E9%96%A2%E6%95%B0\">データセット関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E9%96%A2%E6%95%B0\">タスク関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B5%E3%82%A6%E3%83%B3%E3%83%89%E9%96%A2%E6%95%B0\">サウンド関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%A6%E3%83%BC%E3%83%86%E3%82%A3%E3%83%AA%E3%83%86%E3%82%A3%E9%96%A2%E6%95%B0\">ユーティリティ関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E5%A4%89%E6%8F%9B%E9%96%A2%E6%95%B0\">データ変換関数</a>\n</li><li><a class=\"wiki\" href=\"#%E8%A8%80%E8%AA%9EDB%E9%96%A2%E6%95%B0\">言語DB関数</a>\n</li><li><a class=\"wiki\" href=\"#SQLite%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\">SQLiteインタフェース関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%90%E3%82%A4%E3%83%8A%E3%83%AA%E3%83%87%E3%83%BC%E3%82%BF%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\">バイナリデータインタフェース関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%9E%E3%83%88%E3%83%AA%E3%82%AF%E3%82%B9%E3%83%99%E3%82%AF%E3%83%88%E3%83%AB%E6%BC%94%E7%AE%97%E9%96%A2%E6%95%B0\">マトリクス/ベクトル演算関数</a>\n</li></ul><h3 id=\"システム関数\">システム関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>sysReboot</dt><dd>\n全ゲーム環境を破棄し、起動シーケンスから再実行する\n<ul><li>sysReboot\n<pre class=\"wiki\">   sysReboot()\n</pre></li></ul></dd></dl>\n<dl><dt>sysLoad</dt><dd>\n指定されたスクリプトに制御を移す。\nコールされた時点で、現在定義されているleave()関数を呼び、\n次のフレームのexecute()実行前に指定されたスクリプトをロード、グローバル域とsetup()を実行する。\n<ul><li>sysLoad\n<pre class=\"wiki\">   sysLoad(&lt;移行先スクリプトのパス名&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>sysCommand</dt><dd>\n動作中のタスクに対し、そのタスクが受け付けるコマンドを発行する。\n第一引数はコマンド実行対象となるタスクのポインタ、第二引数はそのタスクが受け付けるコマンドの値となる。\n引数がある場合は第三引数以降に指定される。また、コマンドによっては戻り値を持つ。\n<ul><li>sysCommand\n<pre class=\"wiki\">   [ &lt;戻り値&gt; = ] sysCommand(&lt;タスクポインタ&gt;, &lt;コマンドID&gt; [, ...] )\n</pre></li></ul></dd></dl>\n<dl><dt>syslog</dt><dd>\nデバッグに用いられるログ文字列を出力する。\n出力先およびその形式は、実行されるプラットフォームに依存する。\n<ul><li>syslog\n<pre class=\"wiki\">   syslog(&lt;出力文字列&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>sysExit</dt><dd>\nゲームシステムの実行を終了し、OSに制御を戻す。\nアプリケーションが「自己判断で終了する」という概念を持たないプラットフォームでは\n対応していない(例:iOS)。\n<ul><li>sysExit\n<pre class=\"wiki\">   sysExit()\n</pre></li></ul></dd></dl>\n<dl><dt>include</dt><dd>\n指定されたスクリプトファイルの内容が、さもその場所にあるかのように取り込む。\nスクリプト間で共通する定義を別ファイルにまとめ、取り込む際などに使用する。\n<ul><li>include\n<pre class=\"wiki\">   include(&lt;インクルードスクリプトのパス名&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>sysInfo</dt><dd>\n実行環境についてのシステム情報をテーブルとして返す。\n現時点で対応しているのは width(画面幅)とheight(画面高)のみ。\n<ul><li>sysInfo\n<pre class=\"wiki\">   &lt;システム情報テーブルを受け取る変数&gt; = sysInfo()\n</pre></li></ul></dd></dl>\n<h3 id=\"IDKeyChain関数\">ID/KeyChain関数<a title=\"このセクションへのリンク\" href=\"#IDKeyChain%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>KEY_genUserID</dt><dd>\nIDとして使用できる値を自動生成する。\n<ul><li>KEY_genUserID\n<pre class=\"wiki\">   &lt;id-string&gt; = KEY_genUserID()\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_genUserPW</dt><dd>\nパスワードとして使用できる値を自動生成する。\n<ul><li>KEY_genUserPW\n<pre class=\"wiki\">   &lt;password-string&gt; = KEY_genUserPW(\"&lt;id-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_setSecureID</dt><dd>\n文字列を指定されたサービス名のIDとして、keychainに登録する。\n<ul><li>KEY_setSecureID\n<pre class=\"wiki\">   &lt;result&gt; = KEY_setSecureID(\"&lt;service-name&gt;\", \"&lt;id-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_setSecurePW</dt><dd>\n文字列を指定されたサービスのパスワードとして keychain に登録する。\n<ul><li>KEY_setSecurePW\n<pre class=\"wiki\">   &lt;result&gt; = KEY_setSecurePW(\"&lt;service-name&gt;\", \"&lt;password-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_getSecureID</dt><dd>\nkeychainをサービス名で検索し、登録されているIDを返す。IDが登録されていない場合はnilを返す。\n<ul><li>KEY_getSecureID\n<pre class=\"wiki\">   &lt;id-string&gt; = KEY_getSecureID(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_getSecurePW</dt><dd>\nkeychainをサービス名で検索し、登録されているパスワードを返す。パスワードが登録されていない場合はnilを返す。\n<ul><li>KEY_getSecurePW\n<pre class=\"wiki\">   &lt;password-string&gt; = KEY_getSecurePW(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_delSecureID</dt><dd>\nkeychain中から指定されたサービス名で登録されているIDを削除し、未登録状態にする。\n元々登録されていない場合は何もしない。\n<ul><li>KEY_delSecureID\n<pre class=\"wiki\">   KEY_delSecureID(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_delSecurePW</dt><dd>\nkeychain中から指定されたサービス名で登録されているパスワードを削除し、未登録状態にする。\n元々登録されていない場合は何もしない。\n<ul><li>KEY_delSecurePW\n<pre class=\"wiki\">   KEY_delSecurePW(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<h3 id=\"GL関数\">GL関数<a title=\"このセクションへのリンク\" href=\"#GL%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>GL_ClearColor</dt><dd>\nOpenGL ES のglClearColor()と同じ。GLのクリア色を指定する。\n<ul><li>GL_ClearColor\n<pre class=\"wiki\">   GL_ClearColor(&lt;red&gt;, &lt;green&gt;, &lt;blue&gt;, &lt;alpha&gt;)\n   \n   ※各要素は 0.0～1.0 で指定する。\n</pre></li></ul></dd></dl>\n<dl><dt>GL_SetResolution</dt><dd>\n論理描画領域の解像度を指定する。プログラムはその描画面積があるものとして動作するが、表示は物理解像度に合わせ比率を保ったまま拡大または縮小される。\nデフォルトの状態における論理解像度は物理解像度と一致する。\n</dd></dl>\n<p>\nborderlessがオプションですが、設定をtrueにすると論理描画と物理画面の比率が会わない場合、右左や上下に枠が描画可能になり、\n</p>\n<blockquote>\n<p>\n左や上に描画したい場合、理論座標システムは次になります。\n</p>\n<blockquote>\n<p>\n[-borderHorizontal, -borderHorizontal] .. [width + borderHorizontal, height + borderVertical]\n</p>\n</blockquote>\n<p>\nつまり、borderlessをtrue/falseにしても、[0,0]-[width,height]は同じ場所にあります。\n</p>\n<pre class=\"wiki\">   GL_SetResolution(&lt;width&gt;, &lt;height&gt; [,&lt;borderless = false&gt;])\n</pre></blockquote>\n<blockquote>\n<p>\nSee also : GL_GetHorizontalBorder, GL_GetVerticalBorder.\n</p>\n</blockquote>\n<pre class=\"wiki\">   -- Sample Code : Bordeless when screen is larger than logical screen.\n   GL_SetResolution(width, height)\n   if (GL_GetHorizontalBorder() != 0) then\n     GL_SetResolution(width, height, true)\n</pre><dl><dt>GL_Unloadtexture</dt><dd>\nGL_Unloadtextureを使って、すべてのOpenGLのtextureを開放する。\n<pre class=\"wiki\">　GL_Unloadtexture()\n</pre></dd></dl>\n<dl><dt>GL_Reloadtexture</dt><dd>\nGL_Reloadtextureを使って、GL_Unloadtextureに開放されたTextureを回復する。\n</dd></dl>\n<p>\nWARNING:GL_Unloadtextureと一緒にセットで使ってください。しないとリークします！\n</p>\n<blockquote>\n<p>\n分かれているの存在理由はOSが勝手に開放された場合、復活させる関数もほしかったので、機能がわかれているが、基本ではセットで使ってください！\n</p>\n<pre class=\"wiki\">　GL_Reloadtexture()\n</pre></blockquote>\n<h3 id=\"SG関数\">SG関数<a title=\"このセクションへのリンク\" href=\"#SG%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>SG_GetGuardBand</dt><dd>\n現在のGuardBand情報を返す。X0,Y0,X1,Y1\n<ul><li>SG_GetGuardBand\n<pre class=\"wiki\">   x0,y0,x1,y1 = SG_GetGuardBand()\n</pre></li></ul></dd></dl>\n<dl><dt>SG_SetGuardBand</dt><dd>\n描画・計算処理を軽くするため、ノードの座標がGuardBand外に移動した場合、処理をしない事になります。\n</dd></dl>\n<p>\nおかしいな描画・描画に表れない事につながる事になります。\n</p>\n<blockquote>\n<p>\nGuardBandの座標は画面の空間でピクセルで設定する。\n</p>\n</blockquote>\n<blockquote>\n<p>\n例えば：SG_SetGuardBand(-500.0, -400.0, 1500.0, 1400.0)\nこの場合、(-500, -400)を以下に物置いた場合、処理・描画が行わない。\n同じく、+1500,+1400を超えた場合にも、処理・描画が行わない。\n</p>\n</blockquote>\n<blockquote>\n<p>\nノードにつながっている描画オブジェクトのサイズや中心もあるため、ぎりぎりなサイズで使わない方が良い。\n基本的に大変横・立ての長いのリスト・物の一覧があった時に利用する。\n</p>\n</blockquote>\n<pre class=\"wiki\">   SG_SetGuardBand(&lt;x0&gt;, &lt;y0&gt;, &lt;x1&gt;, &lt;y1&gt;)\n</pre><h3 id=\"アプリケーション起動関数\">アプリケーション起動関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E8%B5%B7%E5%8B%95%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>APP_CallApplication</dt><dd>\n指定された機能を持つ、プラットフォーム上のアプリケーションを起動する。\n起動されるアプリケーションそのものや、機能の対応状況、アプリケーション起動時の状態はプラットフォームに依存する。\n<ul><li>APP_CallApplication\n<pre class=\"wiki\">   &lt;result&gt; = APP_CallApplication(&lt;app-type&gt;, ... )\n\n   &lt;app-type&gt; アプリケーション機能のタイプ。\n      APP_MAIL  メールアプリケーション\n        APP_CallApplication(APP_MAIL, &lt;address&gt;, &lt;subject&gt;, &lt;body&gt;)\n\n      APP_BROWSER Webブラウザ\n        ※現在未対応\n\n      APP_UPDATE アプリケーションのアップデートを行うシステムアプリ(例: iOSの場合は AppStore が該当)\n        APP_CallApplication(APP_UPDATE, &lt;search-key&gt;)\n\n   &lt;result&gt; 指定されたアプリケーションの起動に成功したら true, 失敗したり非対応である場合は false\n</pre></li></ul></dd></dl>\n<h3 id=\"デバッグモード関数\">デバッグモード関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%83%A2%E3%83%BC%E3%83%89%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>DEBUG_SetCallback</dt><dd>\nデバッグモード終了時に設定値を受け取るLuaのコールバック関数を指定する。\n<ul><li>DEBUG_SetCallback\n<pre class=\"wiki\">   DEBUG_SetCallback(\"&lt;コールバック関数名&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>DEBUG_AddItem</dt><dd>\nデバッグモードのセクションと、セクションに属する刻目を追加する。\n<ul><li>DEBUG_AddItem\n<pre class=\"wiki\">   DEBUG_AddItem(\"&lt;セクション名&gt;\", \"&lt;セクションkey名&gt;\", {\n       { DBG_M_SWITCH, \"&lt;項目名&gt;\", \"&lt;項目key名&gt;\", &lt;デフォルト値(true/false)&gt; }.\n       { DBG_M_SELECT, \"&lt;項目名&gt;\", \"&lt;項目key名&gt;\", \"&lt;デフォルト値&gt;\", { \"&lt;項目1&gt;\", \"&lt;項目2&gt;\", ... , \"&lt;項目n&gt;\" }},\n       { DBG_M_NUMBER, \"&lt;項目名&gt;\", \"&lt;項目key名&gt;\", &lt;下限値&gt;, &lt;上限値&gt;, &lt;デフォルト値&gt; }\n   })\n\n     項目は、ON/OFF型(DBG_M_SWITCH)、選択型(DBG_M_SELECT)、整数型(DBG_M_NUMBER) の三種類が作れる。\n     DBG_M_SELECT の &lt;デフォルト値&gt; は、その後の項目リスト中に存在する文字列である必要がある。\n     項目内に存在しない&lt;デフォルト値&gt;を指定した場合、先頭の項目がデフォルトとなる。\n</pre></li></ul></dd></dl>\n<dl><dt>DEBUG_DelItem</dt><dd>\n指定されたkey名を持つセクションを削除する\n<ul><li>DEBUG_DelItem\n<pre class=\"wiki\">   DEBUG_DelItem(\"&lt;セクションkey名&gt;\")\n</pre></li></ul></dd></dl>\n<h4 id=\"デバッグモード生成の流れ\">デバッグモード生成の流れ<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%83%A2%E3%83%BC%E3%83%89%E7%94%9F%E6%88%90%E3%81%AE%E6%B5%81%E3%82%8C\" class=\"anchor\"> ¶</a></h4>\n<pre class=\"wiki\">DEBUG_SetCallback(\"debugCallback\")  -- コールバックの設定\n\nDEBUG_AddItem(\"Default enemy parameters\", \"enemy\", {  -- 敵の設定\n    { DBG_M_SWITCH, \"Phisical attack\", \"phisical\" true },  -- 物理攻撃の使用(on/off)\n    { DBG_M_SWITCH, \"Use magic\",       \"magic\",   true },  -- 魔法の使用(on/off)\n    { DBG_M_SWITCH, \"Use skill\",       \"skill\",   true },  -- スキルの使用(on/off)\n    { DBG_M_SELECT, \"Tactics\",         \"tactics\", \"normal\", { \"normal\", \"power\", \"defence\", \"away\" } }, -- 使用戦術(通常/攻撃重視/防御重視/逃亡)\n    { DBG_M_NUMBER, \"HitPoint\",        \"hp\",      1000, 30000, 2500 }, -- HPの値\n    { DBG_M_NUMBER, \"MagicPoint\",      \"mp\",      0, 500, 300 }        -- MPの値\n})\n\nDEBUG_AddItem(\"World flags\",  \"world\", {  -- ワールド設定\n    { DBG_M_SWITCH, \"Castle Pass\",  \"castle\", true },  -- 城の通行証(on/off)\n    { DBG_M_SWITCH, \"River bridge\", \"bridge\", false },  -- 川の橋(on/off)\n    { DBG_M_SWITCH, \"Cave door\",    \"cave\",   false },  -- 洞窟の扉(on/off)\n    { DBG_M_SWITCH, \"Hell Gate\",    \"hell\",   false },  -- 地獄の門(on/off)\n})\n\n\nfunction debugCallback(tbl)\n\n   --[[\n      上記のデバッグモード設定でメニューを生成した場合、\n      デフォルト状態で渡されるテーブルの値は次のようになります。\n   ]]\n   tbl = {\n     \"enemy\" = {\n       \"phisical\" = true,\n       \"magic\" = true,\n       \"skill\" = true,\n       \"tactics\" = \"normal\",\n       \"hp\" = 2500,\n       \"mp\" = 300\n     },\n     \"world\" = {\n       \"castle\" = true,\n       \"bridge\" = false,\n       \"cave\" = false,\n       \"hell\" = false\n     }\n   }\nend\n\n</pre><h3 id=\"システムリソース情報ダンプ関数\">システムリソース情報ダンプ関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E6%83%85%E5%A0%B1%E3%83%80%E3%83%B3%E3%83%97%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>RES_DumpSceneGraph</dt><dd>\nSceneGraph のツリー情報をコンソールに出力する。引数を与えない場合はrootノードから、\nUIタスクのポインタを与えた場合はそのタスクが持つコントロールノード以下のツリー情報を出力する。\n<ul><li>RES_DumpSceneGraph()\n<pre class=\"wiki\">   RES_DumpSceneGraph( [ &lt;UI-task-pointer&gt; ] )\n</pre></li></ul></dd></dl>\n<dl><dt>RES_DumpRendering</dt><dd>\n<ul><li>RES_DumpRendering\n</li></ul></dd></dl>\n<dl><dt>RES_DumpAsset</dt><dd>\n使用中の asset をコンソールにダンプする。\n<ul><li>RES_DumpAsset\n<pre class=\"wiki\">   RES_DumpAsset()\n</pre></li></ul></dd></dl>\n<dl><dt>RES_DumpTexturePacker</dt><dd>\n<ul><li>RES_DumpTexturePacker\n</li></ul></dd></dl>\n<dl><dt>RES_DumpGeometryCost</dt><dd>\n<ul><li>RES_DumpGeometryCost\n</li></ul></dd></dl>\n<h3 id=\"Engine情報関数\">Engine情報関数<a title=\"このセクションへのリンク\" href=\"#Engine%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>ENG_isRelease</dt><dd>\n現在動作しているEngineがReleaseビルド版であるかどうかを返す。\nReleaseビルドの場合は true, それ以外の場合は false を返す。\n<ul><li>ENG_isRelease\n<pre class=\"wiki\">   &lt;result&gt; = ENG_isRelease()\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getPlatform</dt><dd>\n現在Engineが動作しているOSとそのバージョン情報、および設定されているTIMEZONEを返す。\nReleaseビルドの場合は true, それ以外の場合は false を返す。\n<ul><li>ENG_getPlatform\n<pre class=\"wiki\">   &lt;version string&gt; = ENG_getPlatform()\n\n   version string は、下記フォーマットで与えられる。\n　　　\"&lt;OS名&gt;;&lt;version&gt;;&lt;timezone&gt;\"\n\n   例) \"iOS;5.1;JST\"\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getNanoTime</dt><dd>\nporting layer で実装されている、システムのナノ秒単位カウンタ値を取得する。\nepoch はシステム依存だが、2回以上の呼び出しで得られた値の差分から経過時間の計測を行える。\n<ul><li>ENG_getNanoTime\n<pre class=\"wiki\">   &lt;milli-second-time&gt;, &lt;nano-second-time&gt; = ENG_getNanoTime()\n\n   &lt;milli-second-time&gt;  ミリ秒単位の時間\n   &lt;nano-second-time&gt;   ナノ秒単位の時間。0～999999の範囲をとる。\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getFrameID</dt><dd>\nタスクマネージャが各フレームに対し発行している FrameID の値を取得する。\nこの値は毎フレームインクリメントされる16bitの値であり、0xffffの次は 0x0000 となる。\n隣り合うフレームではこの値が異なることが保証される。\n</dd></dl>\n<ul><li>ENG_getFrameID\n<pre class=\"wiki\">   &lt;frame-id&gt; = ENG_getFrameID()\n</pre></li></ul><dl><dt>ENG_startNanoTime</dt><dd>\nナノ秒単位の時間計測を開始する。最大10個までのタイマーを用いることができる。\n<ul><li>ENG_startNanoTime\n<pre class=\"wiki\">   ENG_startNanoTime(&lt;timer-id&gt;)\n\n   &lt;timer-id&gt; 0～9が指定可能\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_endNanoTime</dt><dd>\n指定した&lt;timer-id&gt;において、最後の ENG_startNanoTime() もしくは ENG_endNanoTime() の呼び出しから経過した時間をナノ秒単位で取得する。\n<ul><li>ENG_endNanoTime\n<pre class=\"wiki\">   &lt;milli-sec&gt;, &lt;nano-sec&gt; = ENG_endNanoTime(&lt;timer-id&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getElapsedTime</dt><dd>\nOSの起動からの経過時間を秒単位で取得する。\n<ul><li>ENG_getElapsedTime\n<pre class=\"wiki\">   &lt;sec&gt; = ENG_getElapsedTime()\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_forbidSleep</dt><dd>\n端末画面の無操作ロックタイムアウトを無効/解除する。\n<ul><li>ENG_forbidSleep\n<pre class=\"wiki\">   ENG_forbidSleep(&lt;is_forbidden: true / false&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"フォント情報関数\">フォント情報関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nフォント情報関数は、フォント描画に関連する値の取得に使用されます。\n</p>\n<dl><dt>FONT_load</dt><dd>\nフォントファイルをロードして利用可能になります。\n<ul><li>FONT_load\n<pre class=\"wiki\">  bResult = FONT_load(\"&lt;logicalName&gt;\",\"&lt;asset://...ttf&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>FONT_create</dt><dd>\nフォント情報オブジェクトを生成する。\n取得したフォント情報は、フォントによる描画情報の計算に使用される。\n<ul><li>FONT_create\n<pre class=\"wiki\">  &lt;font-object&gt; = FONT_create(&lt;font-size&gt;, \"&lt;font-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>FONT_release</dt><dd>\nフォント情報オブジェクトを破棄する。\n<ul><li>FONT_release\n<pre class=\"wiki\">   nil[, nil, ... ] = FONT_release(&lt;font-object&gt; [, &lt;font-object&gt;, ... ])\n</pre></li></ul></dd></dl>\n<dl><dt>FONT_getTextInfo</dt><dd>\nフォント情報と文字列を指定して「その文字列を描画するために必要な位置と面積の情報」を取得する。\n<ul><li>FONT_getTextInfo\n<pre class=\"wiki\">   &lt;draw-info&gt; = FONT_getTextInfo(&lt;font-object&gt;, \"&lt;string&gt;\")\n\n   &lt;draw-info&gt; = {\n       \"width\" = &lt;draw-width&gt;,\n       \"height\" = &lt;draw-height&gt;,\n       \"ascent\" = &lt;ascent&gt;,\n       \"descent\" = &lt;descent&gt;,\n       \"top\" = &lt;top&gt;,\n       \"bottom\" = &lt;bottom&gt;\n   }\n</pre></li></ul></dd></dl>\n<h3 id=\"ASSET情報関数\">ASSET情報関数<a title=\"このセクションへのリンク\" href=\"#ASSET%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>ASSET_getImageSize</dt><dd>\n指定された画像assetの元画像サイズを返す。\n<ul><li>ASSET_getImageSize\n<pre class=\"wiki\">   &lt;width&gt;, &lt;height&gt; = ASSET_getImageSize(\"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>ASSET_getBoundSize</dt><dd>\n指定された画像assetが持つ全頂点のバウンディングボックスサイズを返す\n<ul><li>ASSET_getBoundSize\n<pre class=\"wiki\">   &lt;width&gt;, &lt;height&gt; = ASSET_getBoundSize(\"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>ASSET_getAssetInfo</dt><dd>\n指定された画像assetのサイズ情報をまとめて取得する。\n<ul><li>ASSET_getAssetInfo\n<pre class=\"wiki\">   &lt;img-width&gt;, &lt;img-height&gt;, &lt;bound-width&gt;, &lt;bound-height&gt; = ASSET_getAssetInfo(\"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<h3 id=\"データセット関数\">データセット関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E3%82%BB%E3%83%83%E3%83%88%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nデータセットは、個々のタスクに代わってデータを保持し続けるための仕組み。\nデータセットを使用するタスクは、あらかじめデータセットを使用するものとして実装されている必要がある。\n</p>\n<p>\n通常、各アセットはリファレンスカウンタによる管理で使用者がいなくなると自動的に解放される。\n同じアセットを繰り返し使いまわしたい場合、そのアセットを使用するタスクが一時不在になった後、\n再度同じアセットを使用すると再ロードが発生するため、処理負荷が大きくなる。\n</p>\n<p>\nこれを防ぐため、各タスクの代理としてアセットを保持し続けるのがデータセットであり、\nデータセットを利用するタスクは、指定されたデータセットからデータを借りてくる形で実装される。\n</p>\n<dl><dt>DATA_create</dt><dd>\n指定されたIDでデータセットを生成し、そのポインタを返す。\n<ul><li>DATA_create\n<pre class=\"wiki\">   &lt;データセットポインタ受取変数&gt; = DATA_create(&lt;データセットに与えるID&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>DATA_register</dt><dd>\n指定されたデータセットのポインタに対し、データを個別に登録する。\nデータセットのポインタとアセットのパス名、データに与える名称を指定する。\n<ul><li>DATA_register\n<pre class=\"wiki\">   DATA_register(&lt;データセットポインタ&gt;, &lt;アセットパス名&gt;, &lt;データセット内でアセットに与える名称&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>DATA_regtable</dt><dd>\n指定されたデータセットのポインタに対し、複数のデータを一括で登録する。\n与えるデータはLuaのテーブルで指定する。\n<ul><li>DATA_regtable\n<pre class=\"wiki\">   -- 登録データ配列\n   assetList = {\n      { &lt;アセットパス名&gt;, &lt;データセット内でアセットに与える名称&gt; },\n       :\n   }\n\n   DATA_regtable(&lt;データセットポインタ&gt;, assetList )\n</pre></li></ul></dd></dl>\n<dl><dt>DATA_delete</dt><dd>\n生成済みのデータセットを破棄する。\nデータセットに登録されたデータを使用中のタスクがある場合はエラーとなる。\n<ul><li>DATA_delete\n<pre class=\"wiki\">   DATA_delete(&lt;データセットポインタ&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"タスク関数\">タスク関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nタスク関数は、基本的にタスクの生成/破棄を管理する。\nまた、タスクがスクリプトからアクセス可能なプロパティを持つ場合、アクセス手段を提供する。\n起動されている特定のタスクに対して処理を行うものが多いため、タスク関数で扱いたいタスクについては、\n起動関数の戻り値として返されるタスクのポインタを保持しておく必要がある。\n</p>\n<dl><dt>TASK_kill</dt><dd>\nタスクポインタで指定されたタスクに対し、破棄指令を出す。\n破棄指令が出されたタスクは、そのフレームの最後に破棄される。\nTASK_kill() は必ずnil値を返す。また、破棄対象のタスクポインタとしてnil値が渡された場合は何もしない。\n<ul><li>TASK_kill\n<pre class=\"wiki\">   [ &lt;nil値を受け取る変数&gt; = ] TASK_kill( &lt;破棄対象となるタスクのポインタ&gt; )\n\n   例)\n   pTask = TASK_kill(pTask)\n\n   上の例はpTaskが示すタスクに破棄指令を出した後、pTaskの値がnilになるので、\n   複数回実行された場合の事故防止になる。\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_registerkill</dt><dd>\nタスクポインタで指定されたタスクに対し、killが発生した時のコールバックを設定出来る仕組みです。\n<ul><li>TASK_registerkill\n<pre class=\"wiki\">   TASK_registerkill( &lt;タスクのポインタ&gt;, &lt;コールバック関数名&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_isKilled</dt><dd>\nポインタで指定されたタスクが、すでに破棄指令を何らかの形で出されているか否かを返す。\n「何らかの形」とは、TASK_kill()関数のほか、TASK_StateClear() による破棄や、\n親タスクの破棄による連鎖破棄なども含まれる。\n<ul><li>TASK_isKilled\n<pre class=\"wiki\">   &lt;is-killed-status&gt; = TASK_isKilled( &lt;破棄対象となるタスクのポインタ&gt; )\n\n   &lt;is-killed-status&gt; (bool)   破棄指令が出されている場合は true, まだ出されていない場合は false\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_StageOnly</dt><dd>\nタスクポインタで指定されたタスクを「ステージタスク」として登録する。\n「ステージタスク」は「現在のステージでのみ使用されるタスク」という概念で、\nステージの終了を告げる TASK_StageClear() のタイミングで破棄対象とされる。\nTASK_StageOnly()でステージタスクにしたタスクを TASK_kill() で破棄しても、\n特に問題はない。\n<ul><li>TASK_StageOnly\n<pre class=\"wiki\">   TASK_StageOnly( &lt;ステージタスクにするタスクのポインタ&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_StageClear</dt><dd>\nこの関数が呼ばれたフレームの最後に、TASK_StageOnly()でステージタスク登録されたタスク全てに対し破棄指令を出す。\nこれは、TASK_StageClear()を呼んだ後に起動され、TASK_StageOnly()で登録されたタスクも対象となる。\nつまり、そのフレームの最後までにステージタスクとして登録され、破棄されていないタスクはすべて破棄対象となる。\n<ul><li>TASK_StageClear\n<pre class=\"wiki\">   TASK_StageClear()\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_getProperty</dt><dd>\nタスクがスクリプトに対し公開プロパティを持つ場合、その値をLuaテーブルとして取得する。\n公開プロパティを持たないタスクの場合はエラーとなる。\n<ul><li>TASK_getProperty\n<pre class=\"wiki\">   &lt;受取Luaテーブル&gt; = TASK_getProperty( &lt;プロパティを取得するタスクのポインタ&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_setProperty</dt><dd>\nTASK_getProperty() で取得したのと同じ形式のLuaテーブルをタスクの新たなプロパティ値として受け取り、\n指定されたタスクに設定する。公開プロパティを持たないタスクや、プロパティがread onlyであるタスクに対してはエラーとなる。\nまた、指定されたLuaテーブルが、タスクのプロパティリストにない名称のメンバを持つ場合もエラーとなる。\n<ul><li>TASK_setProperty\n<pre class=\"wiki\">   TASK_setProperty( &lt;プロパティを設定するタスクのポインタ&gt;, &lt;プロパティ値を持つLuaテーブル&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_Pause</dt><dd>\n特定のタスクをpause状態を操作する。\npause状態にあるタスクは、毎フレームの execute() 呼び出しが行われなくなる。\n<ul><li>TASK_Pause\n<pre class=\"wiki\">   TASK_Pause( &lt;対象タスクのポインタ&gt;, &lt;pause状態(true/false)&gt;[, &lt;再帰指定(true/false)&gt;] )\n\n   上記の&lt;pause状態&gt;をtrueにすることでpause、falseでpause解除となる。\n   子タスクを持つタスクを指定した場合、再帰指定がtrueだと子タスクも同じpause状態を与えられる。\n   再帰指定がfalseの場合子の状態は変化しない。再帰指定は省略でき、省略時の値はtrueとなる。\n</pre></li></ul></dd></dl>\n<h3 id=\"サウンド関数\">サウンド関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B5%E3%82%A6%E3%83%B3%E3%83%89%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>SND_Open</dt><dd>\nサウンドデータを開いて再生準備を行う。また、そのサウンドデータを操作するためのハンドルを返す。\n<ul><li>SND_Open\n<pre class=\"wiki\">   &lt;sound-handle&gt; = SND_Open(\"&lt;sound asset&gt;\" [, &lt;BGM-mode(true/false)&gt; ])\n\n   &lt;sound asset&gt;に指定するファイル名は拡張子抜きで指定してください。\n     × SND_Open( \"soundtest.mp3\" )\n     ○ SND_Open( \"soundtest\" )\n\n   &lt;BGM-mode&gt;をtrueにすると、ループ再生されるBGMとして扱われる。再生開始が遅いのでSEには不向き。\n   &lt;BGM-mode&gt;をfalseにすると、SEとしてサウンドデータをロードし、オンメモリでの待機状態になる(プラットフォームによって異なることがある)。\n\n   &lt;BGM-mode&gt;のデフォルトは false\n</pre></li></ul></dd></dl>\n<dl><dt>SND_setBufSize</dt><dd>\nサウンドデータをBGM再生する際のバッファサイズを三段階(大中小)から選択する。具体的にどのような値が再生系に与えられるかは、\nプラットフォームによって異なる(場合によっては特に何も行わないプラットフォームも考えられる)。\n<ul><li>SND_setBufSize\n<pre class=\"wiki\">    SND_setBufSize(&lt;sound-handle&gt;, &lt;buffer-size-level&gt;)\n\n    &lt;buffer-size-level&gt;\n      SND_BUF_SMALL   [小]時刻取得の分解能がより細かくなることが期待できる。\n      SND_BUF_MEDIUM  [中]標準。デフォルトのサイズ。\n      SND_BUF_LARGE   [大]標準より大きなサイズ。iOSでは標準の2倍。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Close</dt><dd>\nSND_Openによって得られた&lt;sound-handle&gt;を解放し、nilを返す。\n<ul><li>SND_Close\n<pre class=\"wiki\">   nil[,...] = SND_Close(&lt;sound-handle&gt; [, ... ] )\n\n   同時に複数の &lt;sound-handle&gt; を解放できる。引数として与えられた個数分、\n   戻り値として nil を返す。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Play</dt><dd>\nSND_Openによって得られた&lt;sound-handle&gt;で指定されるサウンドデータの再生を開始する\n<ul><li>SND_Play\n<pre class=\"wiki\">   SND_Play(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;, &lt;volume&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:1.0\n  &lt;volume&gt;        サウンドの再生開始時のボリューム\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Stop</dt><dd>\n&lt;sound-handle&gt;で指定される再生中のサウンドデータについて、再生を停止する。\n<ul><li>SND_Stop\n<pre class=\"wiki\">   SND_Stop(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:0.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Pause</dt><dd>\n&lt;sound-handle&gt;で指定される再生中のサウンドデータについて、再生を一時停止する。\n<ul><li>SND_Pause\n<pre class=\"wiki\">   SND_Pause(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:0.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Resume</dt><dd>\n&lt;sound-handle&gt;で指定される一時停止中のサウンドデータについて、再生を再開する。\n<ul><li>SND_Resume\n<pre class=\"wiki\">   SND_Resume(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:1.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Fade</dt><dd>\n&lt;sound-handle&gt;で指定される再生中のサウンドデータについて、&lt;mili-sec&gt;分の時間でフェード音量を&lt;terget-vol&gt;の値にする。\n<ul><li>SND_Fade\n<pre class=\"wiki\">   SND_Fade(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) \n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Seek</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて再生位置をミリ秒で指定する。\n<ul><li>SND_Seek\n<pre class=\"wiki\">   SND_Seek(&lt;sound-handle&gt;, &lt;milli-sec&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Tell</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて再生位置をミリ秒で取得する。\n<ul><li>SND_Tell\n<pre class=\"wiki\">   &lt;milli-sec&gt; = SND_Tell(&lt;sound-handle&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>SND_getLength</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて総演奏時間をミリ秒で取得する。\n<ul><li>SND_getLength\n<pre class=\"wiki\">   &lt;milli-sec&gt; = SND_getLength(&lt;sound-handle&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Volume</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて、音量を設定する。\n<ul><li>SND_Volume\n<pre class=\"wiki\">   SND_Volume(&lt;sound-handle&gt;, &lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音) ～ 1.0(最大) の間で指定\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Pan</dt><dd>\n&lt;sound-handle&gt;で指定されるSEデータについて、パン位置を設定する。\n<ul><li>SND_Pan\n<pre class=\"wiki\">   SND_Pan(&lt;sound-handle&gt;, &lt;pan&gt;)\n\n   &lt;pan&gt; 中央を 0.0 とし、左最大が -1.0, 右最大が 1.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_VolumeBGM</dt><dd>\nSND_Open()関数の&lt;BGM-mode&gt;をtrueとしてオープンされたBGMサウンド全体に対するマスターボリュームを設定する。\n&lt;BGM-mode&gt;がfalseであるSEサウンドは影響を受けない。\n<ul><li>SND_VolumeBGM\n<pre class=\"wiki\">   SND_VolumeBGM(&lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音)～1.0(最大) の範囲で指定。\n\n   実際の再生音量は、ここで指定された&lt;volume&gt;と、サウンド個別に指定された&lt;volume&gt;を掛けた値となる。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_VolumeSE</dt><dd>\nSND_Open()関数の&lt;BGM-mode&gt;をfalseとしてオープンされたSEサウンド全体に対するマスターボリュームを設定する。\n&lt;BGM-mode&gt;がtrueであるBGMサウンドは影響を受けない。\n<ul><li>SND_VolumeSE\n<pre class=\"wiki\">   SND_VolumeSE(&lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音)～1.0(最大)の範囲で指定。\n\n   実際の再生音量は、ここで指定された&lt;volume&gt;と、サウンド個別に指定された&lt;volume&gt;を掛けた値となる。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_VolumeFormSE</dt><dd>\nUI_FormでオープンされたSEサウンド全体に対するマスターボリュームを設定する。\n<ul><li>SND_VolumeFormSE\n<pre class=\"wiki\">   SND_VolumeFormSE(&lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音)～1.0(最大)の範囲で指定。\n\n   実際の再生音量は、ここで指定された&lt;volume&gt;と、SEのマスターボリュームと、サウンド個別に指定された&lt;volume&gt;を掛けた値となる。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_State</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドの状態を取得する。\n<ul><li>SND_State\n<pre class=\"wiki\">   &lt;state&gt; = SND_State(&lt;sound-handle&gt;)\n\n   &lt;state&gt; サウンドハンドルで指定したサウンドの状態、戻り値の定数は以下の通りです。\n                SND_STATE_PLAY                      ・・・  再生中\n                SND_STATE_PAUSE                    ・・・  一時停止中\n                SND_STATE_STOP                      ・・・  停止中\n                SND_STATE_INVALID_HANDLE   ・・・  無効なハンドルです。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_MultiProcess</dt><dd>\n<ul><li>SND_MultiProcess\n<pre class=\"wiki\">   SND_MultiProcess(&lt;process-type&gt;)    \n\n   &lt;process-type&gt; で指定したタイプによってミュージックアプリとの挙動を変更します。(2013/4/8現在iPhoneのみ対応)\n                SND_MULTIPROCESS_MUSIC_CUT                      ・・・  ゲームアプリのサウンドがミュージックアプリより優先(ゲーム起動時デフォルト)\n                SND_MULTIPROCESS_SOUND_CUT                    ・・・  ミュージックアプリ再生中はゲームアプリのサウンドが全てOFF\n                SND_MULTIPROCESS_SOUND_BGM_CUT            ・・・  ミュージックアプリ再生中はゲームアプリのBGMサウンドのみOFF\n</pre></li></ul></dd></dl>\n<dl><dt>SND_PauseOnInterruption</dt><dd>\n<ul><li>SND_PauseOnInterruption\n<pre class=\"wiki\">   SND_PauseOnInterruption(&lt;bInterruption&gt;)    \n\n   &lt;bInterruption&gt; で指定したbool値によってアプリのサスペンド時にエンジンでサウンドの一時停止などを制御するかを設定(2013/6/10現在iPhoneのみ対応)\n                true          ・・・  サウンドのサスペンド処理をエンジンで制御する(ゲーム起動時デフォルト)\n                false         ・・・  サウンドのサスペンド処理をエンジンで制御しない\n</pre></li></ul></dd></dl>\n<h3 id=\"ユーティリティ関数\">ユーティリティ関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%A6%E3%83%BC%E3%83%86%E3%82%A3%E3%83%AA%E3%83%86%E3%82%A3%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>bitOR</dt><dd>\n引数すべてを整数とみなし、そのすべてのビットごとの OR をとった値を返す。\n整数とみなすことができない値を引数として与えた場合はエラーとなる。\n<ul><li>bitOR\n<pre class=\"wiki\">   &lt;ORの結果&gt; = bitOR(&lt;int値&gt; [, &lt;int値&gt;[, ... ] ] )\n</pre></li></ul></dd></dl>\n<dl><dt>bitAND</dt><dd>\n引数すべてを整数とみなし、そのすべてのビットごとの AND をとった値を返す。\n整数とみなすことができない値を引数として与えた場合はエラーとなる。\n<ul><li>bitAND\n<pre class=\"wiki\">   &lt;ANDの結果&gt; = bitAND(&lt;int値&gt; [, &lt;int値&gt;[, ... ] ] )\n</pre></li></ul></dd></dl>\n<h3 id=\"データ変換関数\">データ変換関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E5%A4%89%E6%8F%9B%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\n各種データをLuaから扱いやすい形式に変換する機能を提供している。\n</p>\n<dl><dt>CONV_Lua2Json</dt><dd>\nLuaテーブルを同じ構造を持つJSON文字列に変換する。\n<ul><li>CONV_Lua2Json\n<pre class=\"wiki\">   &lt;JSON文字列&gt; = CONV_Lua2Json( &lt;構造を表現するLuaテーブル&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>CONV_Json2Lua</dt><dd>\nJSONの文字列を、同じ構造を持つLuaテーブルに変換する。\n<pre class=\"wiki\">   &lt;Luaテーブル&gt; = CONV_Json2Lua( &lt;元になるJSON文字列&gt; )\n</pre></dd></dl>\n<dl><dt>CONV_JsonFile2Lua</dt><dd>\nファイルパス形式で指定されたJSONファイルを、同じ構造を持つLuaテーブルに変換する。\n<ul><li>CONV_JsonFile2Lua\n<pre class=\"wiki\">   &lt;Luaテーブル&gt; = CONV_JsonFile2Lua( &lt;JSONファイルのパス&gt; )\n</pre></li></ul></dd></dl>\n<h3 id=\"言語DB関数\">言語DB関数<a title=\"このセクションへのリンク\" href=\"#%E8%A8%80%E8%AA%9EDB%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\n各言語の文字列DBアクセス手段を提供する。\n</p>\n<dl><dt>LANG_addString</dt><dd>\nidと文字列の組を登録する。\n<ul><li>LANG_addString\n<pre class=\"wiki\">   LANG_addString( &lt;id&gt;, \"&lt;string&gt;\" )\n</pre></li></ul></dd></dl>\n<dl><dt>LANG_getString</dt><dd>\nid指定されたidに対応する文字列を返す。\n<ul><li>LANG_getString\n<pre class=\"wiki\">   &lt;string&gt; = LANG_getString(&lt;id&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>LANG_removeString</dt><dd>\n指定されたidに対応する文字列を削除する。\n<ul><li>LANG_removeString\n<pre class=\"wiki\">   LANG_removeString(&lt;id&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"SQLiteインタフェース関数\">SQLiteインタフェース関数<a title=\"このセクションへのリンク\" href=\"#SQLite%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nローカルストレージ中にあるSQLite3のDBファイルをSQLでアクセスする手段を提供する。\nただし、システムのルール上書き込み禁止のディレクトリにあるDBファイルに対し、\nINSERT/UPDATE/DELETEなどの更新を伴うクエリを投げてはならない。\n</p>\n<dl><dt>DB_open</dt><dd>\nDBファイルパスを指定することで、そのDBにアクセスするためのコネクションインスタンスを返す。\n指定されたDBファイルのオープンが失敗した場合、戻り値はnilとなる。\n<ul><li>DB_open\n<pre class=\"wiki\">   &lt;コネクションインスタンス&gt; = DB_open( &lt;DBファイルパス名&gt; [, &lt;書き込み許可&gt;, &lt;DBファイル作成許可&gt; ] )\n\n   &lt;書き込み許可&gt;        true でDBへの書き込みを許可する。\n                         デフォルトはtrue。read only のDBとして扱う場合、false にする。\n\n   &lt;DBファイル作成許可&gt;  true でDBファイルが見つからない場合の作成を許可する。\n                         デフォルトはtrueだが、&lt;書き込み許可&gt;がfalseの場合自動的にfalseとなる。\n\n\n</pre></li></ul></dd></dl>\n<dl><dt>DB_close</dt><dd>\nDB_open()で返されたコネクションインスタンスのDBをクローズする。\nコネクションインスタンスとしてnilが渡された場合は何もしない。\n<ul><li>DB_close\n<pre class=\"wiki\">   DB_close(&lt;コネクションインスタンス&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>DB_query</dt><dd>\nコネクションインスタンスで指定されたDBに対し、SQL文字列でクエリを発行し、\nクエリ実行の成否と結果を返す。戻り値が二つあるので注意。\nクエリがselectionを返すSELECT文である場合は、第二戻り値はselectionをまとめたLuaテーブルとなる。\n戻されるLuaテーブルは、selection各行を{ カラム名=値, ... }の形式でまとめ、この行単位のテーブルを\n配列にしたもの。\n<ul><li>DB_query\n<pre class=\"wiki\">   &lt;成否&gt;, &lt;値&gt; = DB_query(&lt;コネクションインスタンス&gt;, &lt;SQL文字列&gt;)\n   \n   &lt;成否&gt; boolean 成功時 true / 失敗時 false\n   &lt;値&gt; 成功時 セレクション結果のテーブルまたは空のテーブル\n        失敗時 エラーコード\n</pre></li></ul></dd></dl>\n<h3 id=\"バイナリデータインタフェース関数\">バイナリデータインタフェース関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%90%E3%82%A4%E3%83%8A%E3%83%AA%E3%83%87%E3%83%BC%E3%82%BF%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nファイルをバイナリデータとして読み込み、指定のオフセットにあるバイトデータを読み込む手段を提供する。\n</p>\n<dl><dt>BIN_open</dt><dd>\nファイルパスを指定することで、そのファイルをバイナリデータとみなし、\nバイナリアレイインスタンス返す。\n指定されたファイルのオープンが失敗した場合、戻り値はnilとなる。\n<ul><li>BIN_open\n<pre class=\"wiki\">   &lt;バイナリアレイインスタンス&gt; = BIN_open( &lt;ファイルパス名&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_close</dt><dd>\nBIN_open()で返されたバイナリアレイインスタンスを破棄する。\nバイナリアレイインスタンスとしてnilが渡された場合は何もしない。\n<ul><li>BIN_close\n<pre class=\"wiki\">   BIN_close(&lt;バイナリアレイインスタンス&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_peek</dt><dd>\nバイナリアレイインスタンスの持つデータの、指定されたオフセットにある値を返す。\n指定されたオフセットが負の値や元のファイルサイズを超えるなどの場合はnilを返す。\n<ul><li>BIN_peek\n<pre class=\"wiki\">   &lt;値&gt; = BIN_peek(&lt;バイナリアレイインスタンス&gt;, &lt;オフセット&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_peekU16</dt><dd>\nバイナリアレイインスタンスの持つデータの、指定されたオフセットから 2 バイトを16bit整数として取得し、その値を返す。\n取得される値のバイトオーダーは、第三引数の &lt;big-endian-mode&gt; が true の場合はビッグエンディアン(上位-下位)、\nfalseの場合および指定されない場合はリトルエンディアン(下位-上位)となる。\n<ul><li>BIN_peekU16\n<pre class=\"wiki\">   &lt;値&gt; = BIN_peekU16(&lt;バイナリアレイインスタンス&gt;, &lt;オフセット&gt; [ , &lt;big-endian-mode&gt; ])\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_peekU32</dt><dd>\nバイナリアレイインスタンスの持つデータの、指定されたオフセットから 4 バイトを32bit整数として取得し、その値を返す。\n取得される値のバイトオーダーは、第三引数の &lt;big-endian-mode&gt; が true の場合はビッグエンディアン(上位-&gt;下位)、\nfalseの場合および指定されない場合はリトルエンディアン(下位-&gt;上位)となる。\n<ul><li>BIN_peekU32\n<pre class=\"wiki\">   &lt;値&gt; = BIN_peekU32(&lt;バイナリアレイインスタンス&gt;, &lt;オフセット&gt; [ , &lt;big-endian-mode&gt; ])\n</pre></li></ul></dd></dl>\n<h3 id=\"マトリクスベクトル演算関数\">マトリクス/ベクトル演算関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%9E%E3%83%88%E3%83%AA%E3%82%AF%E3%82%B9%E3%83%99%E3%82%AF%E3%83%88%E3%83%AB%E6%BC%94%E7%AE%97%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\n簡易的な3D計算をサポートするため、マトリクス/ベクトルの計算ライブラリが用意されている。\n</p>\n<dl><dt>GEO_CreateMatrix</dt><dd>\nLuaのテーブル(配列)で与えらえた値を持つマトリクスオブジェクトを与えられたテーブルの個数だけ生成する。\nテーブルの代わりに nil を与えると、単位行列を生成する。戻り値の数は、引数として与えられたテーブルとnilの個数の合計と等しい。\n</dd></dl>\n<blockquote>\n<p>\nテーブルを与えずに呼び出すと、単位行列の値を持つマトリクスオブジェクトを一つだけ生成して返す。\n</p>\n</blockquote>\n<blockquote>\n<p>\nマトリクスオブジェクトは、扱いを高速にするためC++のnativeコードから扱えるバイナリ構造体として表現されたマトリクス情報。\nLuaの実数が double で表現されている場合は double/float間の変換のため、実際に生成される値は丸め誤差が生じる。\n</p>\n</blockquote>\n<ul><li>GEO_CreateMatrix\n<pre class=\"wiki\">   local tblMat1 = {\n    1.0, 2.0, 0.0, -1.0,\n    -1.0, 1.0, 2.0,  0.0,\n    2.0, 0.0, 1.0,  1.0,\n    1.0, -2.0, -1.0, 1.0\n   }\n   local tblMat2 = {\n     0.0, 1.0, 0.0, 0.0,\n     1.0, 0.0, 0.0, 0.0,\n     0.0, 0.0, 1.0, 0.0,\n     0.0, 0.0, 0.0, 1.0\n   }\n   pMat1, pMat2, pUnit = GEO_CreateMatrix(tblMat1, tblMat2, nil)\n\n   pUnitMat = GEO_CreateMatrix()\n\n   上記の例で、pMat1 と pMat2 はそれぞれ tblMat1, tblMat2 と同じ値を持つマトリクスオブジェクトになる。\n   また、ｐUnit, pUnitMat は単位行列として生成される。\n</pre></li></ul><dl><dt>GEO_DeleteMatrix</dt><dd>\nマトリクスオブジェクトを破棄する。\n一度に複数のマトリクスオブジェクトを破棄することができる。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\n与えられた引数のうち、値が nil のものについては何も行わない。\n値がnilであったものも含め、引数として与えられた数と同じだけの nil を返す。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>GEO_DeleteMatrix\n<pre class=\"wiki\">   local tblMatrix = { (省略) }\n\n   pMatrix = GEO_CreateMatrix( tblMatrix )\n   pUnitMatrix = GEO_CreateMatrix()\n\n   pMatrix, pUnitMatrix = GEO_DeleteMatrix( pMatrix, pUnitMatrix )\n\n   上記の例で、生成した二つのマトリクスオブジェクトを破棄している。\n   呼び出しの引数が二つであるため、戻り値として二つの nil が返される。\n   これを用いてマトリクスオブジェクトの保持に使用した変数を初期化している。\n</pre></li></ul><dl><dt>GEO_RevertMatrix</dt><dd>\nマトリクスオブジェクトから、同じ値を持つLuaのテーブルを返す。\n返されたLuaテーブルは、GEO_CreateMatrix()で使用する形式と同じとなる。\n</dd></dl>\n<ul><li>GEO_RevertMatrix\n<pre class=\"wiki\">   local tblMatrix = { (省略) }\n\n   pMatrix = GEO_CreateMatrix( tblMatrix )\n\n   local tblMat2 = GEO_RevertMatrix(pMatrix)\n\n   上記の例で、tblMat2 はtblMatrix と同じ値の配列となる。\n   ただし、Luaでの実数が double で扱われている環境では double と float の\n   相互変換を経由するため、丸め誤差が生じる可能性がある。\n</pre></li></ul><dl><dt>GEO_CopyMatrix</dt><dd>\n引数で指定されたマトリクスオブジェクトをコピーし、新しいマトリクスオブジェクトを生成する。\n内部でコピーされるため、マトリクスオブジェクトとしては全く同じ値を持つ。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\nただし両者は異なるポインタを持つため、Luaの演算子で比較しても同じ値とは見做されない。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>GEO_CopyMatrix\n<pre class=\"wiki\">   local tblMatrix = { (省略) }\n\n   pMatrix = GEO_CreateMatrix( tblMatrix )\n   pMat2 = GEO_CopyMatrix(pMatrix)\n\n   上記例で、pMat2 は pMatrix と同じ値を持つマトリクスオブジェクトとなる。\n</pre></li></ul><dl><dt>GEO_TransposedMatrix</dt><dd>\n指定されたマトリクスオブジェクトを、転置行列に変換する。\n<pre class=\"wiki\">   pMatrix = GEO_CreateMatrix()\n   GEO_TransposedMatrix(pMatrix)\n\n   上記例で、pMatrix の内容は GEO_TransposedMatrix() 実行前の内容を転置行列に変換した値になる。\n   再度実行することで元に戻すことができる。\n</pre></dd></dl>\n<dl><dt>GEO_OverwriteMatrix</dt><dd>\n既存のマトリクスオブジェクトの値を、Luaテーブルの値で上書きする。\nマトリクスオブジェクトとして与えられた値が nil である場合には何も行わない。\n</dd></dl>\n<ul><li>GEO_OverwriteMatrix\n<pre class=\"wiki\">   pMatrix = GEO_CreateMatrix()\n\n   local tblNew = {\n     1.0, 2.0, 0.0, -1.0,\n     -1.0, 1.0, 2.0,  0.0,\n     2.0, 0.0, 1.0,  1.0,\n     1.0, -2.0, -1.0, 1.0\n   }\n\n   GEO_OverwriteMatrix(pMatrix, tblNew)\n\n   上記の例では、GEO_CreateMatrix() で単位行列として生成したマトリクスオブジェクトの値を、\n   GEO_OverwriteMatrix() で上書きしている。\n</pre></li></ul><dl><dt>GEO_DeleteAllMatrix</dt><dd>\n  \n生成方法を問わず、これまで生成されたマトリクスオブジェクト全てを破棄する。\n変数を上書きしてアクセスできなくなったマトリクスオブジェクトも含まれる。\n</dd></dl>\n<ul><li>GEO_DeleteAllMatrix\n<pre class=\"wiki\">   local tblMat = { (省略) }\n   pMatrix = GEO_CreateMatrix(tblMat)\n\n   pMatrix = 100\n\n   GEO_DeleteAllMatrix()\n\n   上記の例では生成したマトリクスオブジェクトのポインタ値を受け取った pMatrix 変数を、\n   数値で上書きすることによってマトリクスへのアクセス手段が失われてしまっているが、\n   このようなマトリクスオブジェクトも GEO_DeleteAllMatrix()によって破棄できる。\n\n   ただし、システム起動以来生成したすべてのマトリクスオブジェクトが対象となるため、\n   使用に際しては注意が必要となる。\n</pre></li></ul><dl><dt>GEO_MulMatrix</dt><dd>\n  \n第二引数以降のマトリクスオブジェクト同士を順次乗算し、結果を第一引数のマトリクスオブジェクトに書き込む。\n二つ以上のマトリクス乗算を一度の手続きで行うことができる。\n</dd></dl>\n<ul><li>GEO_MulMatrix\n<pre class=\"wiki\">   local tblMat1 = { (省略) }\n   local tblMat2 = { (省略) }\n   local tblMat3 = { (省略) }\n   local tblMat4 = { (省略) }\n   local tblMat5 = { (省略) }\n\n   pMat1 = GEO_CreateMatrix(tblMat1)\n   pMat2 = GEO_CreateMatrix(tblMat2)\n   pMat3 = GEO_CreateMatrix(tblMat3)\n   pMat4 = GEO_CreateMatrix(tblMat4)\n   pMat5 = GEO_CreateMatrix(tblMat5)\n\n   pAns = GEO_CreateMatrix()  -- 結果受け取り用\n \n   GEO_MulMatrix(pAns, pMat1, pMat2, pMat3, pMat4, pMat5)\n\n   上記の例ではtblMat1～tblMat5までの配列から生成した pMat1～pMat5を番号順に乗算し、\n   結果を pAns に格納している。行列の計算なので、引数を与える順番に注意。\n</pre></li></ul><dl><dt>GEO_InverseMatrix</dt><dd>\n  \n与えられたマトリクスの内容を、逆行列に変換する。\n変換に成功した場合は true, 失敗した場合は false を返す。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\nいずれの場合も元の内容は破壊されるため注意。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>GEO_InverseMatrix\n<pre class=\"wiki\">   local tblMat = { (省略) }\n\n   pMat = GEO_CreateMatrix(tblMat)\n   pInvMat = GEO_CopyMatrix(pMat)\n\n   if GEO_InverseMatrix(pInvMat) then\n     -- 逆行列生成成功\n   else\n     -- 逆行列生成失敗\n     -- pInvMatの内容は無効なので破棄する\n     pInvMat = GEO_DeleteMatrix(pInvMat)\n   end\n\n   上記の例ではLuaテーブルから生成したマトリクスオブジェクト pMat を pInvMat にコピーし、\n   GEO_INverseMatrix() で逆行列に変換している。\n</pre></li></ul><dl><dt>GEO_VecConv</dt><dd>\n  \nLuaテーブルとして表現されるベクトルにマトリクスオブジェクトをかけ、\n結果のベクトルを同じ形式のLuaテーブルとして返す。\n</dd></dl>\n<ul><li>GEO_VecConv\n<pre class=\"wiki\">   local tblMat = { (省略) }\n\n   pMat = GEO_CreateMatrix(tblMat)\n\n   local tblVec = GEO_VecConv(pMat, { x1, y1, z1, w1 })\n\n   上記の例では(x1, y1, z1, w1)の値を持つベクトルをLuaテーブルとして与え、\n   pMat が持つマトリクスをかけた変換結果を tblVec に受け取っている。\n\n   変換結果を (x2, y2, z2, w2) とした場合、tblVec の値は { x2, y2, z2, w2 }\n   というテーブルになる。\n</pre></li></ul><dl><dt>GEO_VecArrayConv</dt><dd>\n  \nGEO_VecConv()に与える形式のベクトルを配列として同時に複数与え、そのすべてに対しマトリクスオブジェクトをかけた結果を、\n同じ要素数/同じ形式のLuaテーブルとして返す。複数のベクトルに対し、同じマトリクスでまとめて変換をかける際に使用する。\n</dd></dl>\n<ul><li>GEO_VecArrayConv\n<pre class=\"wiki\">   local tblMat = { (省略) }\n\n   pMat = GEO_CreateMatrix(tblMat)\n\n   local tblVecArray {\n     { x1, y1, z1, w1 },\n     { x2, y2, z2, w2 },\n     { x3, y3, z3, w3 },\n     { x4, y4, z4, w4 },\n      :\n     (中略)\n      :\n     { xn, yn, zn, wn },\n   }\n\n   local retVecArray = GEO_VecArrayConv(pMat, tblVecArray)\n\n   上記の例では複数のベクトルをLuaテーブルとして与え、\n   pMat が持つマトリクスをかけた変換結果を retVecArray に受け取っている。\n\n   同じ形式、同じ要素数で変換結果が返される。\n</pre></li></ul>        \n      </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/functions.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/lua – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"Luaスクリプトインタフェース\">Luaスクリプトインタフェース<a title=\"このセクションへのリンク\" href=\"#Lua%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9\" class=\"anchor\"> ¶</a></h2>\n<p>\nここでは、タスクとは独立したLuaインタフェース関数について解説します。\n</p>\n<ul><li><a class=\"wiki\" href=\"index.html\">汎用タスクマニュアル</a>\n</li></ul><h3 id=\"スクリプトの実行ルール\">スクリプトの実行ルール<a title=\"このセクションへのリンク\" href=\"#%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%81%AE%E5%AE%9F%E8%A1%8C%E3%83%AB%E3%83%BC%E3%83%AB\" class=\"anchor\"> ¶</a></h3>\n<ul><li>スクリプトはロードされた直後、グローバル域とsetup()が実行される\n</li><li>毎フレームP_SCRIPTフェーズにexecute()が呼ばれる。\n</li><li>sysLoad()関数を用いて他のスクリプトに移動することが決定したとき、leave()が呼ばれる。\n</li><li>sysLoad()で指定された移動先のスクリプトがロードされるのは、次のフレームのP_SCRIPTフェーズ。\n</li></ul><h3 id=\"タスクの実行ルール\">タスクの実行ルール<a title=\"このセクションへのリンク\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E3%81%AE%E5%AE%9F%E8%A1%8C%E3%83%AB%E3%83%BC%E3%83%AB\" class=\"anchor\"> ¶</a></h3>\n<ul><li>タスクは、起動関数を呼ぶことで起動される。\n</li><li>起動関数は、必ずタスクのポインタを返す。\n</li><li>起動中のタスクに対しコマンドを与える際は、sysCommand()関数を使用する。第一引数は対象タスクのポインタ、第二引数が各タスクによって定義されるコマンド値となる。引数が必要な場合は、第三引数以降に続ける。\n</li><li>起動中のタスクを個別に破棄するには、TASK_kill() 関数を用いる。\n</li><li>「ステージタスク」として登録されているタスクは、TASK_StageClear()関数でまとめて破棄することができる。\n</li><li>起動したタスクを「ステージタスク」として登録する場合は、TASK_StageOnly()関数にタスクのポインタを与える。\n</li><li>タスクが起動すると自動的に「ステージタスク」になるように実装されているケースもある。\n</li></ul><h2 id=\"Luaスクリプト関数リファレンス\">Luaスクリプト関数リファレンス<a title=\"このセクションへのリンク\" href=\"#Lua%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9\" class=\"anchor\"> ¶</a></h2>\n<ul><li><a class=\"wiki\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E9%96%A2%E6%95%B0\">システム関数</a>\n</li><li><a class=\"wiki\" href=\"#IDKeyChain%E9%96%A2%E6%95%B0\">ID/KeyChain関数</a>\n</li><li><a class=\"wiki\" href=\"#GL%E9%96%A2%E6%95%B0\">GL関数</a>\n</li><li><a class=\"wiki\" href=\"#SG%E9%96%A2%E6%95%B0\">GuardBand関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E8%B5%B7%E5%8B%95%E9%96%A2%E6%95%B0\">アプリケーション起動関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%83%A2%E3%83%BC%E3%83%89%E9%96%A2%E6%95%B0\">デバッグモード関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E6%83%85%E5%A0%B1%E3%83%80%E3%83%B3%E3%83%97%E9%96%A2%E6%95%B0\">システムリソース情報ダンプ関数</a>\n</li><li><a class=\"wiki\" href=\"#Engine%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\">Engine情報関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\">フォント情報関数</a>\n</li><li><a class=\"wiki\" href=\"#ASSET%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\">ASSET情報関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E3%82%BB%E3%83%83%E3%83%88%E9%96%A2%E6%95%B0\">データセット関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E9%96%A2%E6%95%B0\">タスク関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%82%B5%E3%82%A6%E3%83%B3%E3%83%89%E9%96%A2%E6%95%B0\">サウンド関数</a>\n</li><li><a class=\"wiki\" href=\"#AI%E9%96%A2%E6%95%B0\">AI関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%A6%E3%83%BC%E3%83%86%E3%82%A3%E3%83%AA%E3%83%86%E3%82%A3%E9%96%A2%E6%95%B0\">ユーティリティ関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E5%A4%89%E6%8F%9B%E9%96%A2%E6%95%B0\">データ変換関数</a>\n</li><li><a class=\"wiki\" href=\"#%E8%A8%80%E8%AA%9EDB%E9%96%A2%E6%95%B0\">言語DB関数</a>\n</li><li><a class=\"wiki\" href=\"#SQLite%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\">SQLiteインタフェース関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%90%E3%82%A4%E3%83%8A%E3%83%AA%E3%83%87%E3%83%BC%E3%82%BF%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\">バイナリデータインタフェース関数</a>\n</li><li><a class=\"wiki\" href=\"#%E3%83%9E%E3%83%88%E3%83%AA%E3%82%AF%E3%82%B9%E3%83%99%E3%82%AF%E3%83%88%E3%83%AB%E6%BC%94%E7%AE%97%E9%96%A2%E6%95%B0\">マトリクス/ベクトル演算関数</a>\n</li></ul><h3 id=\"システム関数\">システム関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>sysReboot</dt><dd>\n全ゲーム環境を破棄し、起動シーケンスから再実行する\n<ul><li>sysReboot\n<pre class=\"wiki\">   sysReboot()\n</pre></li></ul></dd></dl>\n<dl><dt>sysLoad</dt><dd>\n指定されたスクリプトに制御を移す。\nコールされた時点で、現在定義されているleave()関数を呼び、\n次のフレームのexecute()実行前に指定されたスクリプトをロード、グローバル域とsetup()を実行する。\n<ul><li>sysLoad\n<pre class=\"wiki\">   sysLoad(&lt;移行先スクリプトのパス名&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>sysCommand</dt><dd>\n動作中のタスクに対し、そのタスクが受け付けるコマンドを発行する。\n第一引数はコマンド実行対象となるタスクのポインタ、第二引数はそのタスクが受け付けるコマンドの値となる。\n引数がある場合は第三引数以降に指定される。また、コマンドによっては戻り値を持つ。\n<ul><li>sysCommand\n<pre class=\"wiki\">   [ &lt;戻り値&gt; = ] sysCommand(&lt;タスクポインタ&gt;, &lt;コマンドID&gt; [, ...] )\n</pre></li></ul></dd></dl>\n<dl><dt>syslog</dt><dd>\nデバッグに用いられるログ文字列を出力する。\n出力先およびその形式は、実行されるプラットフォームに依存する。\n<ul><li>syslog\n<pre class=\"wiki\">   syslog(&lt;出力文字列&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>sysExit</dt><dd>\nゲームシステムの実行を終了し、OSに制御を戻す。\nアプリケーションが「自己判断で終了する」という概念を持たないプラットフォームでは\n対応していない(例:iOS)。\n<ul><li>sysExit\n<pre class=\"wiki\">   sysExit()\n</pre></li></ul></dd></dl>\n<dl><dt>include</dt><dd>\n指定されたスクリプトファイルの内容が、さもその場所にあるかのように取り込む。\nスクリプト間で共通する定義を別ファイルにまとめ、取り込む際などに使用する。\n<ul><li>include\n<pre class=\"wiki\">   include(&lt;インクルードスクリプトのパス名&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>sysInfo</dt><dd>\n実行環境についてのシステム情報をテーブルとして返す。\n現時点で対応しているのは width(画面幅)とheight(画面高)のみ。\n<ul><li>sysInfo\n<pre class=\"wiki\">   &lt;システム情報テーブルを受け取る変数&gt; = sysInfo()\n</pre></li></ul></dd></dl>\n<h3 id=\"IDKeyChain関数\">ID/KeyChain関数<a title=\"このセクションへのリンク\" href=\"#IDKeyChain%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>KEY_genUserID</dt><dd>\nIDとして使用できる値を自動生成する。\n<ul><li>KEY_genUserID\n<pre class=\"wiki\">   &lt;id-string&gt; = KEY_genUserID()\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_genUserPW</dt><dd>\nパスワードとして使用できる値を自動生成する。\n<ul><li>KEY_genUserPW\n<pre class=\"wiki\">   &lt;password-string&gt; = KEY_genUserPW(\"&lt;id-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_setSecureID</dt><dd>\n文字列を指定されたサービス名のIDとして、keychainに登録する。\n<ul><li>KEY_setSecureID\n<pre class=\"wiki\">   &lt;result&gt; = KEY_setSecureID(\"&lt;service-name&gt;\", \"&lt;id-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_setSecurePW</dt><dd>\n文字列を指定されたサービスのパスワードとして keychain に登録する。\n<ul><li>KEY_setSecurePW\n<pre class=\"wiki\">   &lt;result&gt; = KEY_setSecurePW(\"&lt;service-name&gt;\", \"&lt;password-string&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_getSecureID</dt><dd>\nkeychainをサービス名で検索し、登録されているIDを返す。IDが登録されていない場合はnilを返す。\n<ul><li>KEY_getSecureID\n<pre class=\"wiki\">   &lt;id-string&gt; = KEY_getSecureID(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_getSecurePW</dt><dd>\nkeychainをサービス名で検索し、登録されているパスワードを返す。パスワードが登録されていない場合はnilを返す。\n<ul><li>KEY_getSecurePW\n<pre class=\"wiki\">   &lt;password-string&gt; = KEY_getSecurePW(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_delSecureID</dt><dd>\nkeychain中から指定されたサービス名で登録されているIDを削除し、未登録状態にする。\n元々登録されていない場合は何もしない。\n<ul><li>KEY_delSecureID\n<pre class=\"wiki\">   KEY_delSecureID(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>KEY_delSecurePW</dt><dd>\nkeychain中から指定されたサービス名で登録されているパスワードを削除し、未登録状態にする。\n元々登録されていない場合は何もしない。\n<ul><li>KEY_delSecurePW\n<pre class=\"wiki\">   KEY_delSecurePW(\"&lt;service-name&gt;\")\n</pre></li></ul></dd></dl>\n<h3 id=\"GL関数\">GL関数<a title=\"このセクションへのリンク\" href=\"#GL%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>GL_ClearColor</dt><dd>\nOpenGL ES のglClearColor()と同じ。GLのクリア色を指定する。\n<ul><li>GL_ClearColor\n<pre class=\"wiki\">   GL_ClearColor(&lt;red&gt;, &lt;green&gt;, &lt;blue&gt;, &lt;alpha&gt;)\n   \n   ※各要素は 0.0～1.0 で指定する。\n</pre></li></ul></dd></dl>\n<dl><dt>GL_SetResolution</dt><dd>\n論理描画領域の解像度を指定する。プログラムはその描画面積があるものとして動作するが、表示は物理解像度に合わせ比率を保ったまま拡大または縮小される。\nデフォルトの状態における論理解像度は物理解像度と一致する。\n</dd></dl>\n<p>\nborderlessがオプションですが、設定をtrueにすると論理描画と物理画面の比率が会わない場合、右左や上下に枠が描画可能になり、\n</p>\n<blockquote>\n<p>\n左や上に描画したい場合、理論座標システムは次になります。\n</p>\n<blockquote>\n<p>\n[-borderHorizontal, -borderHorizontal] .. [width + borderHorizontal, height + borderVertical]\n</p>\n</blockquote>\n<p>\nつまり、borderlessをtrue/falseにしても、[0,0]-[width,height]は同じ場所にあります。\n</p>\n<pre class=\"wiki\">   GL_SetResolution(&lt;width&gt;, &lt;height&gt; [,&lt;borderless = false&gt;])\n</pre></blockquote>\n<blockquote>\n<p>\nSee also : GL_GetHorizontalBorder, GL_GetVerticalBorder.\n</p>\n</blockquote>\n<pre class=\"wiki\">   -- Sample Code : Bordeless when screen is larger than logical screen.\n   GL_SetResolution(width, height)\n   if (GL_GetHorizontalBorder() != 0) then\n     GL_SetResolution(width, height, true)\n</pre><dl><dt>GL_GetHorizontalBorder</dt><dd>\nGL_SetResolutionを使って、borderlessにした場合、立て枠のピクセルサイズを返す関数です。\n<pre class=\"wiki\">　GL_GetHorizontalBorder()\n</pre></dd></dl>\n<dl><dt>GL_GetVerticalBorder</dt><dd>\nGL_SetResolutionを使って、borderlessにした場合、横枠のピクセルサイズを返す関数です。\n<pre class=\"wiki\">　GL_GetVerticalBorder()\n</pre></dd></dl>\n<h3 id=\"SG関数\">SG関数<a title=\"このセクションへのリンク\" href=\"#SG%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>SG_GetGuardBand</dt><dd>\n現在のGuardBand情報を返す。X0,Y0,X1,Y1\n<ul><li>SG_GetGuardBand\n<pre class=\"wiki\">   x0,y0,x1,y1 = SG_GetGuardBand()\n</pre></li></ul></dd></dl>\n<dl><dt>SG_SetGuardBand</dt><dd>\n描画・計算処理を軽くするため、ノードの座標がGuardBand外に移動した場合、処理をしない事になります。\n</dd></dl>\n<p>\nおかしいな描画・描画に表れない事につながる事になります。\n</p>\n<blockquote>\n<p>\nGuardBandの座標は画面の空間でピクセルで設定する。\n</p>\n</blockquote>\n<blockquote>\n<p>\n例えば：SG_SetGuardBand(-500.0, -400.0, 1500.0, 1400.0)\nこの場合、(-500, -400)を以下に物置いた場合、処理・描画が行わない。\n同じく、+1500,+1400を超えた場合にも、処理・描画が行わない。\n</p>\n</blockquote>\n<blockquote>\n<p>\nノードにつながっている描画オブジェクトのサイズや中心もあるため、ぎりぎりなサイズで使わない方が良い。\n基本的に大変横・立ての長いのリスト・物の一覧があった時に利用する。\n</p>\n</blockquote>\n<pre class=\"wiki\">   SG_SetGuardBand(&lt;x0&gt;, &lt;y0&gt;, &lt;x1&gt;, &lt;y1&gt;)\n</pre><h3 id=\"アプリケーション起動関数\">アプリケーション起動関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E8%B5%B7%E5%8B%95%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>APP_CallApplication</dt><dd>\n指定された機能を持つ、プラットフォーム上のアプリケーションを起動する。\n起動されるアプリケーションそのものや、機能の対応状況、アプリケーション起動時の状態はプラットフォームに依存する。\n<ul><li>APP_CallApplication\n<pre class=\"wiki\">   &lt;result&gt; = APP_CallApplication(&lt;app-type&gt;, ... )\n\n   &lt;app-type&gt; アプリケーション機能のタイプ。\n      APP_MAIL  メールアプリケーション\n        APP_CallApplication(APP_MAIL, &lt;address&gt;, &lt;subject&gt;, &lt;body&gt;)\n\n      APP_BROWSER Webブラウザ\n        ※現在未対応\n\n      APP_UPDATE アプリケーションのアップデートを行うシステムアプリ(例: iOSの場合は AppStore が該当)\n        APP_CallApplication(APP_UPDATE, &lt;search-key&gt;)\n\n   &lt;result&gt; 指定されたアプリケーションの起動に成功したら true, 失敗したり非対応である場合は false\n</pre></li></ul></dd></dl>\n<h3 id=\"デバッグモード関数\">デバッグモード関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%83%A2%E3%83%BC%E3%83%89%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>DEBUG_SetCallback</dt><dd>\nデバッグモード終了時に設定値を受け取るLuaのコールバック関数を指定する。\n<ul><li>DEBUG_SetCallback\n<pre class=\"wiki\">   DEBUG_SetCallback(\"&lt;コールバック関数名&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>DEBUG_AddItem</dt><dd>\nデバッグモードのセクションと、セクションに属する刻目を追加する。\n<ul><li>DEBUG_AddItem\n<pre class=\"wiki\">   DEBUG_AddItem(\"&lt;セクション名&gt;\", \"&lt;セクションkey名&gt;\", {\n       { DBG_M_SWITCH, \"&lt;項目名&gt;\", \"&lt;項目key名&gt;\", &lt;デフォルト値(true/false)&gt; }.\n       { DBG_M_SELECT, \"&lt;項目名&gt;\", \"&lt;項目key名&gt;\", \"&lt;デフォルト値&gt;\", { \"&lt;項目1&gt;\", \"&lt;項目2&gt;\", ... , \"&lt;項目n&gt;\" }},\n       { DBG_M_NUMBER, \"&lt;項目名&gt;\", \"&lt;項目key名&gt;\", &lt;下限値&gt;, &lt;上限値&gt;, &lt;デフォルト値&gt; }\n   })\n\n     項目は、ON/OFF型(DBG_M_SWITCH)、選択型(DBG_M_SELECT)、整数型(DBG_M_NUMBER) の三種類が作れる。\n     DBG_M_SELECT の &lt;デフォルト値&gt; は、その後の項目リスト中に存在する文字列である必要がある。\n     項目内に存在しない&lt;デフォルト値&gt;を指定した場合、先頭の項目がデフォルトとなる。\n</pre></li></ul></dd></dl>\n<dl><dt>DEBUG_DelItem</dt><dd>\n指定されたkey名を持つセクションを削除する\n<ul><li>DEBUG_DelItem\n<pre class=\"wiki\">   DEBUG_DelItem(\"&lt;セクションkey名&gt;\")\n</pre></li></ul></dd></dl>\n<h4 id=\"デバッグモード生成の流れ\">デバッグモード生成の流れ<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%83%A2%E3%83%BC%E3%83%89%E7%94%9F%E6%88%90%E3%81%AE%E6%B5%81%E3%82%8C\" class=\"anchor\"> ¶</a></h4>\n<pre class=\"wiki\">DEBUG_SetCallback(\"debugCallback\")  -- コールバックの設定\n\nDEBUG_AddItem(\"Default enemy parameters\", \"enemy\", {  -- 敵の設定\n    { DBG_M_SWITCH, \"Phisical attack\", \"phisical\" true },  -- 物理攻撃の使用(on/off)\n    { DBG_M_SWITCH, \"Use magic\",       \"magic\",   true },  -- 魔法の使用(on/off)\n    { DBG_M_SWITCH, \"Use skill\",       \"skill\",   true },  -- スキルの使用(on/off)\n    { DBG_M_SELECT, \"Tactics\",         \"tactics\", \"normal\", { \"normal\", \"power\", \"defence\", \"away\" } }, -- 使用戦術(通常/攻撃重視/防御重視/逃亡)\n    { DBG_M_NUMBER, \"HitPoint\",        \"hp\",      1000, 30000, 2500 }, -- HPの値\n    { DBG_M_NUMBER, \"MagicPoint\",      \"mp\",      0, 500, 300 }        -- MPの値\n})\n\nDEBUG_AddItem(\"World flags\",  \"world\", {  -- ワールド設定\n    { DBG_M_SWITCH, \"Castle Pass\",  \"castle\", true },  -- 城の通行証(on/off)\n    { DBG_M_SWITCH, \"River bridge\", \"bridge\", false },  -- 川の橋(on/off)\n    { DBG_M_SWITCH, \"Cave door\",    \"cave\",   false },  -- 洞窟の扉(on/off)\n    { DBG_M_SWITCH, \"Hell Gate\",    \"hell\",   false },  -- 地獄の門(on/off)\n})\n\n\nfunction debugCallback(tbl)\n\n   --[[\n      上記のデバッグモード設定でメニューを生成した場合、\n      デフォルト状態で渡されるテーブルの値は次のようになります。\n   ]]\n   tbl = {\n     \"enemy\" = {\n       \"phisical\" = true,\n       \"magic\" = true,\n       \"skill\" = true,\n       \"tactics\" = \"normal\",\n       \"hp\" = 2500,\n       \"mp\" = 300\n     },\n     \"world\" = {\n       \"castle\" = true,\n       \"bridge\" = false,\n       \"cave\" = false,\n       \"hell\" = false\n     }\n   }\nend\n\n</pre><h3 id=\"システムリソース情報ダンプ関数\">システムリソース情報ダンプ関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E6%83%85%E5%A0%B1%E3%83%80%E3%83%B3%E3%83%97%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>RES_DumpSceneGraph</dt><dd>\nSceneGraph のツリー情報をコンソールに出力する。引数を与えない場合はrootノードから、\nUIタスクのポインタを与えた場合はそのタスクが持つコントロールノード以下のツリー情報を出力する。\n<ul><li>RES_DumpSceneGraph()\n<pre class=\"wiki\">   RES_DumpSceneGraph( [ &lt;UI-task-pointer&gt; ] )\n</pre></li></ul></dd></dl>\n<dl><dt>RES_DumpRendering</dt><dd>\n<ul><li>RES_DumpRendering\n</li></ul></dd></dl>\n<dl><dt>RES_DumpAsset</dt><dd>\n使用中の asset をコンソールにダンプする。\n<ul><li>RES_DumpAsset\n<pre class=\"wiki\">   RES_DumpAsset()\n</pre></li></ul></dd></dl>\n<dl><dt>RES_DumpTexturePacker</dt><dd>\n<ul><li>RES_DumpTexturePacker\n</li></ul></dd></dl>\n<dl><dt>RES_DumpGeometryCost</dt><dd>\n<ul><li>RES_DumpGeometryCost\n</li></ul></dd></dl>\n<h3 id=\"Engine情報関数\">Engine情報関数<a title=\"このセクションへのリンク\" href=\"#Engine%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>ENG_isRelease</dt><dd>\n現在動作しているEngineがReleaseビルド版であるかどうかを返す。\nReleaseビルドの場合は true, それ以外の場合は false を返す。\n<ul><li>ENG_isRelease\n<pre class=\"wiki\">   &lt;result&gt; = ENG_isRelease()\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getPlatform</dt><dd>\n現在Engineが動作しているOSとそのバージョン情報、および設定されているTIMEZONEを返す。\nReleaseビルドの場合は true, それ以外の場合は false を返す。\n<ul><li>ENG_getPlatform\n<pre class=\"wiki\">   &lt;version string&gt; = ENG_getPlatform()\n\n   version string は、下記フォーマットで与えられる。\n　　　\"&lt;OS名&gt;;&lt;version&gt;;&lt;timezone&gt;\"\n\n   例) \"iOS;5.1;JST\"\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getNanoTime</dt><dd>\nporting layer で実装されている、システムのナノ秒単位カウンタ値を取得する。\nepoch はシステム依存だが、2回以上の呼び出しで得られた値の差分から経過時間の計測を行える。\n<ul><li>ENG_getNanoTime\n<pre class=\"wiki\">   &lt;milli-second-time&gt;, &lt;nano-second-time&gt; = ENG_getNanoTime()\n\n   &lt;milli-second-time&gt;  ミリ秒単位の時間\n   &lt;nano-second-time&gt;   ナノ秒単位の時間。0～999999の範囲をとる。\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getFrameID</dt><dd>\nタスクマネージャが各フレームに対し発行している FrameID の値を取得する。\nこの値は毎フレームインクリメントされる16bitの値であり、0xffffの次は 0x0000 となる。\n隣り合うフレームではこの値が異なることが保証される。\n</dd></dl>\n<ul><li>ENG_getFrameID\n<pre class=\"wiki\">   &lt;frame-id&gt; = ENG_getFrameID()\n</pre></li></ul><dl><dt>ENG_startNanoTime</dt><dd>\nナノ秒単位の時間計測を開始する。最大10個までのタイマーを用いることができる。\n<ul><li>ENG_startNanoTime\n<pre class=\"wiki\">   ENG_startNanoTime(&lt;timer-id&gt;)\n\n   &lt;timer-id&gt; 0～9が指定可能\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_endNanoTime</dt><dd>\n指定した&lt;timer-id&gt;において、最後の ENG_startNanoTime() もしくは ENG_endNanoTime() の呼び出しから経過した時間をナノ秒単位で取得する。\n<ul><li>ENG_endNanoTime\n<pre class=\"wiki\">   &lt;milli-sec&gt;, &lt;nano-sec&gt; = ENG_endNanoTime(&lt;timer-id&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>ENG_getElapsedTime</dt><dd>\nOSの起動からの経過時間を秒単位で取得する。\n<ul><li>ENG_getElapsedTime\n<pre class=\"wiki\">   &lt;sec&gt; = ENG_getElapsedTime()\n</pre></li></ul></dd></dl>\n<h3 id=\"フォント情報関数\">フォント情報関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nフォント情報関数は、フォント描画に関連する値の取得に使用されます。\n</p>\n<dl><dt>FONT_load</dt><dd>\nフォントファイルをロードして利用可能になります。\n<ul><li>FONT_load\n<pre class=\"wiki\">  bResult = FONT_load(\"&lt;logicalName&gt;\",\"&lt;asset://...ttf&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>FONT_create</dt><dd>\nフォント情報オブジェクトを生成する。\n取得したフォント情報は、フォントによる描画情報の計算に使用される。\n<ul><li>FONT_create\n<pre class=\"wiki\">  &lt;font-object&gt; = FONT_create(&lt;font-size&gt;, \"&lt;font-name&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>FONT_release</dt><dd>\nフォント情報オブジェクトを破棄する。\n<ul><li>FONT_release\n<pre class=\"wiki\">   nil[, nil, ... ] = FONT_release(&lt;font-object&gt; [, &lt;font-object&gt;, ... ])\n</pre></li></ul></dd></dl>\n<dl><dt>FONT_getTextInfo</dt><dd>\nフォント情報と文字列を指定して「その文字列を描画するために必要な位置と面積の情報」を取得する。\n<ul><li>FONT_getTextInfo\n<pre class=\"wiki\">   &lt;draw-info&gt; = FONT_getTextInfo(&lt;font-object&gt;, \"&lt;string&gt;\")\n\n   &lt;draw-info&gt; = {\n       \"width\" = &lt;draw-width&gt;,\n       \"height\" = &lt;draw-height&gt;,\n       \"ascent\" = &lt;ascent&gt;,\n       \"descent\" = &lt;descent&gt;,\n       \"top\" = &lt;top&gt;,\n       \"bottom\" = &lt;bottom&gt;\n   }\n</pre></li></ul></dd></dl>\n<h3 id=\"ASSET情報関数\">ASSET情報関数<a title=\"このセクションへのリンク\" href=\"#ASSET%E6%83%85%E5%A0%B1%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>ASSET_getImageSize</dt><dd>\n指定された画像assetの元画像サイズを返す。\n<ul><li>ASSET_getImageSize\n<pre class=\"wiki\">   &lt;width&gt;, &lt;height&gt; = ASSET_getImageSize(\"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>ASSET_getBoundSize</dt><dd>\n指定された画像assetが持つ全頂点のバウンディングボックスサイズを返す\n<ul><li>ASSET_getBoundSize\n<pre class=\"wiki\">   &lt;width&gt;, &lt;height&gt; = ASSET_getBoundSize(\"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<dl><dt>ASSET_getAssetInfo</dt><dd>\n指定された画像assetのサイズ情報をまとめて取得する。\n<ul><li>ASSET_getAssetInfo\n<pre class=\"wiki\">   &lt;img-width&gt;, &lt;img-height&gt;, &lt;bound-width&gt;, &lt;bound-height&gt; = ASSET_getAssetInfo(\"&lt;asset-path&gt;\")\n</pre></li></ul></dd></dl>\n<h3 id=\"データセット関数\">データセット関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E3%82%BB%E3%83%83%E3%83%88%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nデータセットは、個々のタスクに代わってデータを保持し続けるための仕組み。\nデータセットを使用するタスクは、あらかじめデータセットを使用するものとして実装されている必要がある。\n</p>\n<p>\n通常、各アセットはリファレンスカウンタによる管理で使用者がいなくなると自動的に解放される。\n同じアセットを繰り返し使いまわしたい場合、そのアセットを使用するタスクが一時不在になった後、\n再度同じアセットを使用すると再ロードが発生するため、処理負荷が大きくなる。\n</p>\n<p>\nこれを防ぐため、各タスクの代理としてアセットを保持し続けるのがデータセットであり、\nデータセットを利用するタスクは、指定されたデータセットからデータを借りてくる形で実装される。\n</p>\n<dl><dt>DATA_create</dt><dd>\n指定されたIDでデータセットを生成し、そのポインタを返す。\n<ul><li>DATA_create\n<pre class=\"wiki\">   &lt;データセットポインタ受取変数&gt; = DATA_create(&lt;データセットに与えるID&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>DATA_register</dt><dd>\n指定されたデータセットのポインタに対し、データを個別に登録する。\nデータセットのポインタとアセットのパス名、データに与える名称を指定する。\n<ul><li>DATA_register\n<pre class=\"wiki\">   DATA_register(&lt;データセットポインタ&gt;, &lt;アセットパス名&gt;, &lt;データセット内でアセットに与える名称&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>DATA_regtable</dt><dd>\n指定されたデータセットのポインタに対し、複数のデータを一括で登録する。\n与えるデータはLuaのテーブルで指定する。\n<ul><li>DATA_regtable\n<pre class=\"wiki\">   -- 登録データ配列\n   assetList = {\n      { &lt;アセットパス名&gt;, &lt;データセット内でアセットに与える名称&gt; },\n       :\n   }\n\n   DATA_regtable(&lt;データセットポインタ&gt;, assetList )\n</pre></li></ul></dd></dl>\n<dl><dt>DATA_delete</dt><dd>\n生成済みのデータセットを破棄する。\nデータセットに登録されたデータを使用中のタスクがある場合はエラーとなる。\n<ul><li>DATA_delete\n<pre class=\"wiki\">   DATA_delete(&lt;データセットポインタ&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"タスク関数\">タスク関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nタスク関数は、基本的にタスクの生成/破棄を管理する。\nまた、タスクがスクリプトからアクセス可能なプロパティを持つ場合、アクセス手段を提供する。\n起動されている特定のタスクに対して処理を行うものが多いため、タスク関数で扱いたいタスクについては、\n起動関数の戻り値として返されるタスクのポインタを保持しておく必要がある。\n</p>\n<dl><dt>TASK_kill</dt><dd>\nタスクポインタで指定されたタスクに対し、破棄指令を出す。\n破棄指令が出されたタスクは、そのフレームの最後に破棄される。\nTASK_kill() は必ずnil値を返す。また、破棄対象のタスクポインタとしてnil値が渡された場合は何もしない。\n<ul><li>TASK_kill\n<pre class=\"wiki\">   [ &lt;nil値を受け取る変数&gt; = ] TASK_kill( &lt;破棄対象となるタスクのポインタ&gt; )\n\n   例)\n   pTask = TASK_kill(pTask)\n\n   上の例はpTaskが示すタスクに破棄指令を出した後、pTaskの値がnilになるので、\n   複数回実行された場合の事故防止になる。\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_registerkill</dt><dd>\nタスクポインタで指定されたタスクに対し、killが発生した時のコールバックを設定出来る仕組みです。\n<ul><li>TASK_registerkill\n<pre class=\"wiki\">   TASK_registerkill( &lt;タスクのポインタ&gt;, &lt;コールバック関数名&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_isKilled</dt><dd>\nポインタで指定されたタスクが、すでに破棄指令を何らかの形で出されているか否かを返す。\n「何らかの形」とは、TASK_kill()関数のほか、TASK_StateClear() による破棄や、\n親タスクの破棄による連鎖破棄なども含まれる。\n<ul><li>TASK_isKilled\n<pre class=\"wiki\">   &lt;is-killed-status&gt; = TASK_isKilled( &lt;破棄対象となるタスクのポインタ&gt; )\n\n   &lt;is-killed-status&gt; (bool)   破棄指令が出されている場合は true, まだ出されていない場合は false\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_StageOnly</dt><dd>\nタスクポインタで指定されたタスクを「ステージタスク」として登録する。\n「ステージタスク」は「現在のステージでのみ使用されるタスク」という概念で、\nステージの終了を告げる TASK_StageClear() のタイミングで破棄対象とされる。\nTASK_StageOnly()でステージタスクにしたタスクを TASK_kill() で破棄しても、\n特に問題はない。\n<ul><li>TASK_StageOnly\n<pre class=\"wiki\">   TASK_StageOnly( &lt;ステージタスクにするタスクのポインタ&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_StageClear</dt><dd>\nこの関数が呼ばれたフレームの最後に、TASK_StageOnly()でステージタスク登録されたタスク全てに対し破棄指令を出す。\nこれは、TASK_StageClear()を呼んだ後に起動され、TASK_StageOnly()で登録されたタスクも対象となる。\nつまり、そのフレームの最後までにステージタスクとして登録され、破棄されていないタスクはすべて破棄対象となる。\n<ul><li>TASK_StageClear\n<pre class=\"wiki\">   TASK_StageClear()\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_getProperty</dt><dd>\nタスクがスクリプトに対し公開プロパティを持つ場合、その値をLuaテーブルとして取得する。\n公開プロパティを持たないタスクの場合はエラーとなる。\n<ul><li>TASK_getProperty\n<pre class=\"wiki\">   &lt;受取Luaテーブル&gt; = TASK_getProperty( &lt;プロパティを取得するタスクのポインタ&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_setProperty</dt><dd>\nTASK_getProperty() で取得したのと同じ形式のLuaテーブルをタスクの新たなプロパティ値として受け取り、\n指定されたタスクに設定する。公開プロパティを持たないタスクや、プロパティがread onlyであるタスクに対してはエラーとなる。\nまた、指定されたLuaテーブルが、タスクのプロパティリストにない名称のメンバを持つ場合もエラーとなる。\n<ul><li>TASK_setProperty\n<pre class=\"wiki\">   TASK_setProperty( &lt;プロパティを設定するタスクのポインタ&gt;, &lt;プロパティ値を持つLuaテーブル&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>TASK_Pause</dt><dd>\n特定のタスクをpause状態を操作する。\npause状態にあるタスクは、毎フレームの execute() 呼び出しが行われなくなる。\n<ul><li>TASK_Pause\n<pre class=\"wiki\">   TASK_Pause( &lt;対象タスクのポインタ&gt;, &lt;pause状態(true/false)&gt;[, &lt;再帰指定(true/false)&gt;] )\n\n   上記の&lt;pause状態&gt;をtrueにすることでpause、falseでpause解除となる。\n   子タスクを持つタスクを指定した場合、再帰指定がtrueだと子タスクも同じpause状態を与えられる。\n   再帰指定がfalseの場合子の状態は変化しない。再帰指定は省略でき、省略時の値はtrueとなる。\n</pre></li></ul></dd></dl>\n<h3 id=\"サウンド関数\">サウンド関数<a title=\"このセクションへのリンク\" href=\"#%E3%82%B5%E3%82%A6%E3%83%B3%E3%83%89%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>SND_Open</dt><dd>\nサウンドデータを開いて再生準備を行う。また、そのサウンドデータを操作するためのハンドルを返す。\n<ul><li>SND_Open\n<pre class=\"wiki\">   &lt;sound-handle&gt; = SND_Open(\"&lt;sound asset&gt;\" [, &lt;BGM-mode(true/false)&gt; ])\n\n   &lt;sound asset&gt;に指定するファイル名は拡張子抜きで指定してください。\n     × SND_Open( \"soundtest.mp3\" )\n     ○ SND_Open( \"soundtest\" )\n\n   &lt;BGM-mode&gt;をtrueにすると、ループ再生されるBGMとして扱われる。再生開始が遅いのでSEには不向き。\n   &lt;BGM-mode&gt;をfalseにすると、SEとしてサウンドデータをロードし、オンメモリでの待機状態になる(プラットフォームによって異なることがある)。\n\n   &lt;BGM-mode&gt;のデフォルトは false\n</pre></li></ul></dd></dl>\n<dl><dt>SND_setBufSize</dt><dd>\nサウンドデータをBGM再生する際のバッファサイズを三段階(大中小)から選択する。具体的にどのような値が再生系に与えられるかは、\nプラットフォームによって異なる(場合によっては特に何も行わないプラットフォームも考えられる)。\n<ul><li>SND_setBufSize\n<pre class=\"wiki\">    SND_setBufSize(&lt;sound-handle&gt;, &lt;buffer-size-level&gt;)\n\n    &lt;buffer-size-level&gt;\n      SND_BUF_SMALL   [小]時刻取得の分解能がより細かくなることが期待できる。\n      SND_BUF_MEDIUM  [中]標準。デフォルトのサイズ。\n      SND_BUF_LARGE   [大]標準より大きなサイズ。iOSでは標準の2倍。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Close</dt><dd>\nSND_Openによって得られた&lt;sound-handle&gt;を解放し、nilを返す。\n<ul><li>SND_Close\n<pre class=\"wiki\">   nil[,...] = SND_Close(&lt;sound-handle&gt; [, ... ] )\n\n   同時に複数の &lt;sound-handle&gt; を解放できる。引数として与えられた個数分、\n   戻り値として nil を返す。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Play</dt><dd>\nSND_Openによって得られた&lt;sound-handle&gt;で指定されるサウンドデータの再生を開始する\n<ul><li>SND_Play\n<pre class=\"wiki\">   SND_Play(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;, &lt;volume&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:1.0\n  &lt;volume&gt;        サウンドの再生開始時のボリューム\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Stop</dt><dd>\n&lt;sound-handle&gt;で指定される再生中のサウンドデータについて、再生を停止する。\n<ul><li>SND_Stop\n<pre class=\"wiki\">   SND_Stop(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:0.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Pause</dt><dd>\n&lt;sound-handle&gt;で指定される再生中のサウンドデータについて、再生を一時停止する。\n<ul><li>SND_Pause\n<pre class=\"wiki\">   SND_Pause(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:0.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Resume</dt><dd>\n&lt;sound-handle&gt;で指定される一時停止中のサウンドデータについて、再生を再開する。\n<ul><li>SND_Resume\n<pre class=\"wiki\">   SND_Resume(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n   以下の項目は入力スキップ可能\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) デフォルト:0\n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。 デフォルト:1.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Fade</dt><dd>\n&lt;sound-handle&gt;で指定される再生中のサウンドデータについて、&lt;mili-sec&gt;分の時間でフェード音量を&lt;terget-vol&gt;の値にする。\n<ul><li>SND_Fade\n<pre class=\"wiki\">   SND_Fade(&lt;sound-handle&gt;, &lt;mili-sec&gt;, &lt;terget-vol&gt;)\n\n  &lt;mili-sec&gt;       フェードにかかる時間(ミリ秒) \n  &lt;terget-vol&gt;    フェード終了時の音量0.0~1.0で指定。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Seek</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて再生位置をミリ秒で指定する。\n<ul><li>SND_Seek\n<pre class=\"wiki\">   SND_Seek(&lt;sound-handle&gt;, &lt;milli-sec&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Tell</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて再生位置をミリ秒で取得する。\n<ul><li>SND_Tell\n<pre class=\"wiki\">   &lt;milli-sec&gt; = SND_Tell(&lt;sound-handle&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>SND_getLength</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて総演奏時間をミリ秒で取得する。\n<ul><li>SND_getLength\n<pre class=\"wiki\">   &lt;milli-sec&gt; = SND_getLength(&lt;sound-handle&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Volume</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドデータについて、音量を設定する。\n<ul><li>SND_Volume\n<pre class=\"wiki\">   SND_Volume(&lt;sound-handle&gt;, &lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音) ～ 1.0(最大) の間で指定\n</pre></li></ul></dd></dl>\n<dl><dt>SND_Pan</dt><dd>\n&lt;sound-handle&gt;で指定されるSEデータについて、パン位置を設定する。\n<ul><li>SND_Pan\n<pre class=\"wiki\">   SND_Pan(&lt;sound-handle&gt;, &lt;pan&gt;)\n\n   &lt;pan&gt; 中央を 0.0 とし、左最大が -1.0, 右最大が 1.0\n</pre></li></ul></dd></dl>\n<dl><dt>SND_VolumeBGM</dt><dd>\nSND_Open()関数の&lt;BGM-mode&gt;をtrueとしてオープンされたBGMサウンド全体に対するマスターボリュームを設定する。\n&lt;BGM-mode&gt;がfalseであるSEサウンドは影響を受けない。\n<ul><li>SND_VolumeBGM\n<pre class=\"wiki\">   SND_VolumeBGM(&lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音)～1.0(最大) の範囲で指定。\n\n   実際の再生音量は、ここで指定された&lt;volume&gt;と、サウンド個別に指定された&lt;volume&gt;を掛けた値となる。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_VolumeSE</dt><dd>\nSND_Open()関数の&lt;BGM-mode&gt;をfalseとしてオープンされたSEサウンド全体に対するマスターボリュームを設定する。\n&lt;BGM-mode&gt;がtrueであるBGMサウンドは影響を受けない。\n<ul><li>SND_VolumeSE\n<pre class=\"wiki\">   SND_VolumeSE(&lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音)～1.0(最大)の範囲で指定。\n\n   実際の再生音量は、ここで指定された&lt;volume&gt;と、サウンド個別に指定された&lt;volume&gt;を掛けた値となる。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_VolumeFormSE</dt><dd>\nUI_FormでオープンされたSEサウンド全体に対するマスターボリュームを設定する。\n<ul><li>SND_VolumeFormSE\n<pre class=\"wiki\">   SND_VolumeFormSE(&lt;volume&gt;)\n\n   &lt;volume&gt; 0.0(無音)～1.0(最大)の範囲で指定。\n\n   実際の再生音量は、ここで指定された&lt;volume&gt;と、SEのマスターボリュームと、サウンド個別に指定された&lt;volume&gt;を掛けた値となる。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_State</dt><dd>\n&lt;sound-handle&gt;で指定されるサウンドの状態を取得する。\n<ul><li>SND_State\n<pre class=\"wiki\">   &lt;state&gt; = SND_State(&lt;sound-handle&gt;)\n\n   &lt;state&gt; サウンドハンドルで指定したサウンドの状態、戻り値の定数は以下の通りです。\n                SND_STATE_PLAY                      ・・・  再生中\n                SND_STATE_PAUSE                    ・・・  一時停止中\n                SND_STATE_STOP                      ・・・  停止中\n                SND_STATE_INVALID_HANDLE   ・・・  無効なハンドルです。\n</pre></li></ul></dd></dl>\n<dl><dt>SND_MultiProcess</dt><dd>\n<ul><li>SND_MultiProcess\n<pre class=\"wiki\">   SND_MultiProcess(&lt;process-type&gt;)    \n\n   &lt;process-type&gt; で指定したタイプによってミュージックアプリとの挙動を変更します。(2013/4/8現在iPhoneのみ対応)\n                SND_MULTIPROCESS_MUSIC_CUT                      ・・・  ゲームアプリのサウンドがミュージックアプリより優先(ゲーム起動時デフォルト)\n                SND_MULTIPROCESS_SOUND_CUT                    ・・・  ミュージックアプリ再生中はゲームアプリのサウンドが全てOFF\n                SND_MULTIPROCESS_SOUND_BGM_CUT            ・・・  ミュージックアプリ再生中はゲームアプリのBGMサウンドのみOFF\n</pre></li></ul></dd></dl>\n<dl><dt>SND_PauseOnInterruption</dt><dd>\n<ul><li>SND_PauseOnInterruption\n<pre class=\"wiki\">   SND_PauseOnInterruption(&lt;bInterruption&gt;)    \n\n   &lt;bInterruption&gt; で指定したbool値によってアプリのサスペンド時にエンジンでサウンドの一時停止などを制御するかを設定(2013/6/10現在iPhoneのみ対応)\n                true          ・・・  サウンドのサスペンド処理をエンジンで制御する(ゲーム起動時デフォルト)\n                false         ・・・  サウンドのサスペンド処理をエンジンで制御しない\n</pre></li></ul></dd></dl>\n<h3 id=\"AI関数\">AI関数<a title=\"このセクションへのリンク\" href=\"#AI%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nAIシステムの制御や利用に際して用いられます。\n</p>\n<dl><dt>AI_setProp</dt><dd>\nAIオブジェクトのプロパティを設定する。プロパティは別途指定されるindex定数で指定する。\n<ul><li>AI_setProp\n<pre class=\"wiki\">   AI_setProp(&lt;AI-object&gt;, &lt;index&gt;, &lt;value&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>AI_getProp</dt><dd>\nAIオブジェクトからプロパティ値を取得する。プロパティは別途指定されるindex定数で指定する。\n<ul><li>AI_getProp\n<pre class=\"wiki\">   &lt;prop-value&gt; = AI_getProp(&lt;AI-object&gt;, &lt;index&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>AI_newQuery</dt><dd>\nAIシステムにおいて他のユニットを検索する条件をまとめ、Queryオブジェクトとして生成する。\n<ul><li>AI_newQuery\n<pre class=\"wiki\">   &lt;query-object&gt; = AI_newQuery(\"&lt;unit-class&gt;\", &lt;unit-mask&gt;, &lt;query-table&gt;)\n\n   &lt;unit-class&gt; Sincで定義されるユニットクラス名。\n\n   &lt;unit-mask&gt; GAME_Unit タスクの UNIT_TYPE コマンドで指定されたtype値とANDを取り、\n               結果が0にならないものを検索対象とするために用いられる。\n               このため、UNIT_TYPEでtype値を指定されていないユニットは検索対象にならない。\n\n   &lt;query-table&gt; = {\n      { &lt;operator&gt;, &lt;src-type&gt;, &lt;src-param&gt;, &lt;dst-type&gt;, &lt;dst-param&gt; },\n      { &lt;operator&gt;, &lt;src-type&gt;, &lt;src-param&gt;, &lt;dst-type&gt;, &lt;dst-param&gt; },\n        :\n   }\n\n   &lt;query-type&gt; に指定できる条件は最大4つまで。それ以上指定した場合は無視5つ目以降が無視される。\n\n   &lt;operator&gt; src を左辺、dst を右辺とおいた場合の条件演算子を指定する。\n     OP_NE  != 条件 src Not Equal dst\n     OP_EQ  == 条件 src EQual dst\n     OP_GT  &gt;  条件 src Greater Than dst\n     OP_GE  &gt;= 条件 src Greater then or Equal to dst\n     OP_LT  &lt;  条件 src Less Than dst\n     OP_LE  &lt;= 条件 src Less then or Equal to dst\n\n   &lt;src-type&gt;,&lt;dst-type&gt;  値の種別を指定する。&lt;src-param&gt;/&lt;dst-param&gt;をどのように解釈するかの指定。\n     AIT_UNITP  ユニットのプロパティ名文字列として解釈する。\n     AIT_AIP    AIプロパティのインデックス値として解釈する。別途定義される定数シンボルを使用すること。\n     AIT_GLOBAL AIシステムグローバルプロパティ値として解釈する。別途定義される定数シンボルを使用すること。\n     AIT_CONST  定数として解釈する。32bit符号付き整数として扱える値を指定すること。\n\n   &lt;src-param&gt;,&lt;dst-param&gt; &lt;src-type&gt;/&lt;dst-type&gt;で指定されたタイプの値として解釈可能な値を与える。\n</pre></li></ul></dd></dl>\n<dl><dt>AI_delQuery</dt><dd>\n生成済みのQueryオブジェクトを破棄する。同時に複数破棄可能。破棄対象として指定した数だけnilを返す。\n<ul><li>AI_delQuery\n<pre class=\"wiki\">   nil [, nil [, ...]] = AI_delQuery(&lt;query-object&gt; [, &lt;query-object&gt; [, ... ] ])\n</pre></li></ul></dd></dl>\n<dl><dt>AI_delQueryAll</dt><dd>\n生成したすべてのQueryオブジェクトを破棄する。\n<ul><li>AI_delQueryAll\n<pre class=\"wiki\">   AI_delQueryAll()\n</pre></li></ul></dd></dl>\n<dl><dt>AI_resetRule</dt><dd>\nAIオブジェクトのルールフラグをすべてリセットする。\n<ul><li>AI_resetRule\n<pre class=\"wiki\">   AI_resetRule(&lt;AI-object&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>AI_setActive</dt><dd>\nAIのアクティブ状態を設定する。非アクティブ状態の時、AIは処理を進行させない。\n<ul><li>AI_setActive\n<pre class=\"wiki\">   AI_setActive(&lt;AI-object&gt;, &lt;active-flag&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"ユーティリティ関数\">ユーティリティ関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%A6%E3%83%BC%E3%83%86%E3%82%A3%E3%83%AA%E3%83%86%E3%82%A3%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>bitOR</dt><dd>\n引数すべてを整数とみなし、そのすべてのビットごとの OR をとった値を返す。\n整数とみなすことができない値を引数として与えた場合はエラーとなる。\n<ul><li>bitOR\n<pre class=\"wiki\">   &lt;ORの結果&gt; = bitOR(&lt;int値&gt; [, &lt;int値&gt;[, ... ] ] )\n</pre></li></ul></dd></dl>\n<dl><dt>bitAND</dt><dd>\n引数すべてを整数とみなし、そのすべてのビットごとの AND をとった値を返す。\n整数とみなすことができない値を引数として与えた場合はエラーとなる。\n<ul><li>bitAND\n<pre class=\"wiki\">   &lt;ANDの結果&gt; = bitAND(&lt;int値&gt; [, &lt;int値&gt;[, ... ] ] )\n</pre></li></ul></dd></dl>\n<h3 id=\"データ変換関数\">データ変換関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%87%E3%83%BC%E3%82%BF%E5%A4%89%E6%8F%9B%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\n各種データをLuaから扱いやすい形式に変換する機能を提供している。\n</p>\n<dl><dt>CONV_Lua2Json</dt><dd>\nLuaテーブルを同じ構造を持つJSON文字列に変換する。\n<ul><li>CONV_Lua2Json\n<pre class=\"wiki\">   &lt;JSON文字列&gt; = CONV_Lua2Json( &lt;構造を表現するLuaテーブル&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>CONV_Json2Lua</dt><dd>\nJSONの文字列を、同じ構造を持つLuaテーブルに変換する。\n<pre class=\"wiki\">   &lt;Luaテーブル&gt; = CONV_Json2Lua( &lt;元になるJSON文字列&gt; )\n</pre></dd></dl>\n<dl><dt>CONV_JsonFile2Lua</dt><dd>\nファイルパス形式で指定されたJSONファイルを、同じ構造を持つLuaテーブルに変換する。\n<ul><li>CONV_JsonFile2Lua\n<pre class=\"wiki\">   &lt;Luaテーブル&gt; = CONV_JsonFile2Lua( &lt;JSONファイルのパス&gt; )\n</pre></li></ul></dd></dl>\n<h3 id=\"言語DB関数\">言語DB関数<a title=\"このセクションへのリンク\" href=\"#%E8%A8%80%E8%AA%9EDB%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\n各言語の文字列DBアクセス手段を提供する。\n</p>\n<dl><dt>LANG_addString</dt><dd>\nidと文字列の組を登録する。\n<ul><li>LANG_addString\n<pre class=\"wiki\">   LANG_addString( &lt;id&gt;, \"&lt;string&gt;\" )\n</pre></li></ul></dd></dl>\n<dl><dt>LANG_getString</dt><dd>\nid指定されたidに対応する文字列を返す。\n<ul><li>LANG_getString\n<pre class=\"wiki\">   &lt;string&gt; = LANG_getString(&lt;id&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>LANG_removeString</dt><dd>\n指定されたidに対応する文字列を削除する。\n<ul><li>LANG_removeString\n<pre class=\"wiki\">   LANG_removeString(&lt;id&gt;)\n</pre></li></ul></dd></dl>\n<h3 id=\"SQLiteインタフェース関数\">SQLiteインタフェース関数<a title=\"このセクションへのリンク\" href=\"#SQLite%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nローカルストレージ中にあるSQLite3のDBファイルをSQLでアクセスする手段を提供する。\nただし、システムのルール上書き込み禁止のディレクトリにあるDBファイルに対し、\nINSERT/UPDATE/DELETEなどの更新を伴うクエリを投げてはならない。\n</p>\n<dl><dt>DB_open</dt><dd>\nDBファイルパスを指定することで、そのDBにアクセスするためのコネクションインスタンスを返す。\n指定されたDBファイルのオープンが失敗した場合、戻り値はnilとなる。\n<ul><li>DB_open\n<pre class=\"wiki\">   &lt;コネクションインスタンス&gt; = DB_open( &lt;DBファイルパス名&gt; [, &lt;書き込み許可&gt;, &lt;DBファイル作成許可&gt; ] )\n\n   &lt;書き込み許可&gt;        true でDBへの書き込みを許可する。\n                         デフォルトはtrue。read only のDBとして扱う場合、false にする。\n\n   &lt;DBファイル作成許可&gt;  true でDBファイルが見つからない場合の作成を許可する。\n                         デフォルトはtrueだが、&lt;書き込み許可&gt;がfalseの場合自動的にfalseとなる。\n\n\n</pre></li></ul></dd></dl>\n<dl><dt>DB_close</dt><dd>\nDB_open()で返されたコネクションインスタンスのDBをクローズする。\nコネクションインスタンスとしてnilが渡された場合は何もしない。\n<ul><li>DB_close\n<pre class=\"wiki\">   DB_close(&lt;コネクションインスタンス&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>DB_query</dt><dd>\nコネクションインスタンスで指定されたDBに対し、SQL文字列でクエリを発行し、\nクエリ実行の成否と結果を返す。戻り値が二つあるので注意。\nクエリがselectionを返すSELECT文である場合は、第二戻り値はselectionをまとめたLuaテーブルとなる。\n戻されるLuaテーブルは、selection各行を{ カラム名=値, ... }の形式でまとめ、この行単位のテーブルを\n配列にしたもの。\n<ul><li>DB_query\n<pre class=\"wiki\">   &lt;成否&gt;, &lt;値&gt; = DB_query(&lt;コネクションインスタンス&gt;, &lt;SQL文字列&gt;)\n   \n   &lt;成否&gt; boolean 成功時 true / 失敗時 false\n   &lt;値&gt; 成功時 セレクション結果のテーブルまたは空のテーブル\n        失敗時 エラーコード\n</pre></li></ul></dd></dl>\n<h3 id=\"バイナリデータインタフェース関数\">バイナリデータインタフェース関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%90%E3%82%A4%E3%83%8A%E3%83%AA%E3%83%87%E3%83%BC%E3%82%BF%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\nファイルをバイナリデータとして読み込み、指定のオフセットにあるバイトデータを読み込む手段を提供する。\n</p>\n<dl><dt>BIN_open</dt><dd>\nファイルパスを指定することで、そのファイルをバイナリデータとみなし、\nバイナリアレイインスタンス返す。\n指定されたファイルのオープンが失敗した場合、戻り値はnilとなる。\n<ul><li>BIN_open\n<pre class=\"wiki\">   &lt;バイナリアレイインスタンス&gt; = BIN_open( &lt;ファイルパス名&gt; )\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_close</dt><dd>\nBIN_open()で返されたバイナリアレイインスタンスを破棄する。\nバイナリアレイインスタンスとしてnilが渡された場合は何もしない。\n<ul><li>BIN_close\n<pre class=\"wiki\">   BIN_close(&lt;バイナリアレイインスタンス&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_peek</dt><dd>\nバイナリアレイインスタンスの持つデータの、指定されたオフセットにある値を返す。\n指定されたオフセットが負の値や元のファイルサイズを超えるなどの場合はnilを返す。\n<ul><li>BIN_peek\n<pre class=\"wiki\">   &lt;値&gt; = BIN_peek(&lt;バイナリアレイインスタンス&gt;, &lt;オフセット&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_peekU16</dt><dd>\nバイナリアレイインスタンスの持つデータの、指定されたオフセットから 2 バイトを16bit整数として取得し、その値を返す。\n取得される値のバイトオーダーは、第三引数の &lt;big-endian-mode&gt; が true の場合はビッグエンディアン(上位-下位)、\nfalseの場合および指定されない場合はリトルエンディアン(下位-上位)となる。\n<ul><li>BIN_peekU16\n<pre class=\"wiki\">   &lt;値&gt; = BIN_peekU16(&lt;バイナリアレイインスタンス&gt;, &lt;オフセット&gt; [ , &lt;big-endian-mode&gt; ])\n</pre></li></ul></dd></dl>\n<dl><dt>BIN_peekU32</dt><dd>\nバイナリアレイインスタンスの持つデータの、指定されたオフセットから 4 バイトを32bit整数として取得し、その値を返す。\n取得される値のバイトオーダーは、第三引数の &lt;big-endian-mode&gt; が true の場合はビッグエンディアン(上位-&gt;下位)、\nfalseの場合および指定されない場合はリトルエンディアン(下位-&gt;上位)となる。\n<ul><li>BIN_peekU32\n<pre class=\"wiki\">   &lt;値&gt; = BIN_peekU32(&lt;バイナリアレイインスタンス&gt;, &lt;オフセット&gt; [ , &lt;big-endian-mode&gt; ])\n</pre></li></ul></dd></dl>\n<h3 id=\"マトリクスベクトル演算関数\">マトリクス/ベクトル演算関数<a title=\"このセクションへのリンク\" href=\"#%E3%83%9E%E3%83%88%E3%83%AA%E3%82%AF%E3%82%B9%E3%83%99%E3%82%AF%E3%83%88%E3%83%AB%E6%BC%94%E7%AE%97%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<p>\n簡易的な3D計算をサポートするため、マトリクス/ベクトルの計算ライブラリが用意されている。\n</p>\n<dl><dt>GEO_CreateMatrix</dt><dd>\nLuaのテーブル(配列)で与えらえた値を持つマトリクスオブジェクトを与えられたテーブルの個数だけ生成する。\nテーブルの代わりに nil を与えると、単位行列を生成する。戻り値の数は、引数として与えられたテーブルとnilの個数の合計と等しい。\n</dd></dl>\n<blockquote>\n<p>\nテーブルを与えずに呼び出すと、単位行列の値を持つマトリクスオブジェクトを一つだけ生成して返す。\n</p>\n</blockquote>\n<blockquote>\n<p>\nマトリクスオブジェクトは、扱いを高速にするためC++のnativeコードから扱えるバイナリ構造体として表現されたマトリクス情報。\nLuaの実数が double で表現されている場合は double/float間の変換のため、実際に生成される値は丸め誤差が生じる。\n</p>\n</blockquote>\n<ul><li>GEO_CreateMatrix\n<pre class=\"wiki\">   local tblMat1 = {\n    1.0, 2.0, 0.0, -1.0,\n    -1.0, 1.0, 2.0,  0.0,\n    2.0, 0.0, 1.0,  1.0,\n    1.0, -2.0, -1.0, 1.0\n   }\n   local tblMat2 = {\n     0.0, 1.0, 0.0, 0.0,\n     1.0, 0.0, 0.0, 0.0,\n     0.0, 0.0, 1.0, 0.0,\n     0.0, 0.0, 0.0, 1.0\n   }\n   pMat1, pMat2, pUnit = GEO_CreateMatrix(tblMat1, tblMat2, nil)\n\n   pUnitMat = GEO_CreateMatrix()\n\n   上記の例で、pMat1 と pMat2 はそれぞれ tblMat1, tblMat2 と同じ値を持つマトリクスオブジェクトになる。\n   また、ｐUnit, pUnitMat は単位行列として生成される。\n</pre></li></ul><dl><dt>GEO_DeleteMatrix</dt><dd>\nマトリクスオブジェクトを破棄する。\n一度に複数のマトリクスオブジェクトを破棄することができる。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\n与えられた引数のうち、値が nil のものについては何も行わない。\n値がnilであったものも含め、引数として与えられた数と同じだけの nil を返す。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>GEO_DeleteMatrix\n<pre class=\"wiki\">   local tblMatrix = { (省略) }\n\n   pMatrix = GEO_CreateMatrix( tblMatrix )\n   pUnitMatrix = GEO_CreateMatrix()\n\n   pMatrix, pUnitMatrix = GEO_DeleteMatrix( pMatrix, pUnitMatrix )\n\n   上記の例で、生成した二つのマトリクスオブジェクトを破棄している。\n   呼び出しの引数が二つであるため、戻り値として二つの nil が返される。\n   これを用いてマトリクスオブジェクトの保持に使用した変数を初期化している。\n</pre></li></ul><dl><dt>GEO_RevertMatrix</dt><dd>\nマトリクスオブジェクトから、同じ値を持つLuaのテーブルを返す。\n返されたLuaテーブルは、GEO_CreateMatrix()で使用する形式と同じとなる。\n</dd></dl>\n<ul><li>GEO_RevertMatrix\n<pre class=\"wiki\">   local tblMatrix = { (省略) }\n\n   pMatrix = GEO_CreateMatrix( tblMatrix )\n\n   local tblMat2 = GEO_RevertMatrix(pMatrix)\n\n   上記の例で、tblMat2 はtblMatrix と同じ値の配列となる。\n   ただし、Luaでの実数が double で扱われている環境では double と float の\n   相互変換を経由するため、丸め誤差が生じる可能性がある。\n</pre></li></ul><dl><dt>GEO_CopyMatrix</dt><dd>\n引数で指定されたマトリクスオブジェクトをコピーし、新しいマトリクスオブジェクトを生成する。\n内部でコピーされるため、マトリクスオブジェクトとしては全く同じ値を持つ。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\nただし両者は異なるポインタを持つため、Luaの演算子で比較しても同じ値とは見做されない。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>GEO_CopyMatrix\n<pre class=\"wiki\">   local tblMatrix = { (省略) }\n\n   pMatrix = GEO_CreateMatrix( tblMatrix )\n   pMat2 = GEO_CopyMatrix(pMatrix)\n\n   上記例で、pMat2 は pMatrix と同じ値を持つマトリクスオブジェクトとなる。\n</pre></li></ul><dl><dt>GEO_TransposedMatrix</dt><dd>\n指定されたマトリクスオブジェクトを、転置行列に変換する。\n<pre class=\"wiki\">   pMatrix = GEO_CreateMatrix()\n   GEO_TransposedMatrix(pMatrix)\n\n   上記例で、pMatrix の内容は GEO_TransposedMatrix() 実行前の内容を転置行列に変換した値になる。\n   再度実行することで元に戻すことができる。\n</pre></dd></dl>\n<dl><dt>GEO_OverwriteMatrix</dt><dd>\n既存のマトリクスオブジェクトの値を、Luaテーブルの値で上書きする。\nマトリクスオブジェクトとして与えられた値が nil である場合には何も行わない。\n</dd></dl>\n<ul><li>GEO_OverwriteMatrix\n<pre class=\"wiki\">   pMatrix = GEO_CreateMatrix()\n\n   local tblNew = {\n     1.0, 2.0, 0.0, -1.0,\n     -1.0, 1.0, 2.0,  0.0,\n     2.0, 0.0, 1.0,  1.0,\n     1.0, -2.0, -1.0, 1.0\n   }\n\n   GEO_OverwriteMatrix(pMatrix, tblNew)\n\n   上記の例では、GEO_CreateMatrix() で単位行列として生成したマトリクスオブジェクトの値を、\n   GEO_OverwriteMatrix() で上書きしている。\n</pre></li></ul><dl><dt>GEO_DeleteAllMatrix</dt><dd>\n  \n生成方法を問わず、これまで生成されたマトリクスオブジェクト全てを破棄する。\n変数を上書きしてアクセスできなくなったマトリクスオブジェクトも含まれる。\n</dd></dl>\n<ul><li>GEO_DeleteAllMatrix\n<pre class=\"wiki\">   local tblMat = { (省略) }\n   pMatrix = GEO_CreateMatrix(tblMat)\n\n   pMatrix = 100\n\n   GEO_DeleteAllMatrix()\n\n   上記の例では生成したマトリクスオブジェクトのポインタ値を受け取った pMatrix 変数を、\n   数値で上書きすることによってマトリクスへのアクセス手段が失われてしまっているが、\n   このようなマトリクスオブジェクトも GEO_DeleteAllMatrix()によって破棄できる。\n\n   ただし、システム起動以来生成したすべてのマトリクスオブジェクトが対象となるため、\n   使用に際しては注意が必要となる。\n</pre></li></ul><dl><dt>GEO_MulMatrix</dt><dd>\n  \n第二引数以降のマトリクスオブジェクト同士を順次乗算し、結果を第一引数のマトリクスオブジェクトに書き込む。\n二つ以上のマトリクス乗算を一度の手続きで行うことができる。\n</dd></dl>\n<ul><li>GEO_MulMatrix\n<pre class=\"wiki\">   local tblMat1 = { (省略) }\n   local tblMat2 = { (省略) }\n   local tblMat3 = { (省略) }\n   local tblMat4 = { (省略) }\n   local tblMat5 = { (省略) }\n\n   pMat1 = GEO_CreateMatrix(tblMat1)\n   pMat2 = GEO_CreateMatrix(tblMat2)\n   pMat3 = GEO_CreateMatrix(tblMat3)\n   pMat4 = GEO_CreateMatrix(tblMat4)\n   pMat5 = GEO_CreateMatrix(tblMat5)\n\n   pAns = GEO_CreateMatrix()  -- 結果受け取り用\n \n   GEO_MulMatrix(pAns, pMat1, pMat2, pMat3, pMat4, pMat5)\n\n   上記の例ではtblMat1～tblMat5までの配列から生成した pMat1～pMat5を番号順に乗算し、\n   結果を pAns に格納している。行列の計算なので、引数を与える順番に注意。\n</pre></li></ul><dl><dt>GEO_InverseMatrix</dt><dd>\n  \n与えられたマトリクスの内容を、逆行列に変換する。\n変換に成功した場合は true, 失敗した場合は false を返す。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\nいずれの場合も元の内容は破壊されるため注意。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>GEO_InverseMatrix\n<pre class=\"wiki\">   local tblMat = { (省略) }\n\n   pMat = GEO_CreateMatrix(tblMat)\n   pInvMat = GEO_CopyMatrix(pMat)\n\n   if GEO_InverseMatrix(pInvMat) then\n     -- 逆行列生成成功\n   else\n     -- 逆行列生成失敗\n     -- pInvMatの内容は無効なので破棄する\n     pInvMat = GEO_DeleteMatrix(pInvMat)\n   end\n\n   上記の例ではLuaテーブルから生成したマトリクスオブジェクト pMat を pInvMat にコピーし、\n   GEO_INverseMatrix() で逆行列に変換している。\n</pre></li></ul><dl><dt>GEO_VecConv</dt><dd>\n  \nLuaテーブルとして表現されるベクトルにマトリクスオブジェクトをかけ、\n結果のベクトルを同じ形式のLuaテーブルとして返す。\n</dd></dl>\n<ul><li>GEO_VecConv\n<pre class=\"wiki\">   local tblMat = { (省略) }\n\n   pMat = GEO_CreateMatrix(tblMat)\n\n   local tblVec = GEO_VecConv(pMat, { x1, y1, z1, w1 })\n\n   上記の例では(x1, y1, z1, w1)の値を持つベクトルをLuaテーブルとして与え、\n   pMat が持つマトリクスをかけた変換結果を tblVec に受け取っている。\n\n   変換結果を (x2, y2, z2, w2) とした場合、tblVec の値は { x2, y2, z2, w2 }\n   というテーブルになる。\n</pre></li></ul><dl><dt>GEO_VecArrayConv</dt><dd>\n  \nGEO_VecConv()に与える形式のベクトルを配列として同時に複数与え、そのすべてに対しマトリクスオブジェクトをかけた結果を、\n同じ要素数/同じ形式のLuaテーブルとして返す。複数のベクトルに対し、同じマトリクスでまとめて変換をかける際に使用する。\n</dd></dl>\n<ul><li>GEO_VecArrayConv\n<pre class=\"wiki\">   local tblMat = { (省略) }\n\n   pMat = GEO_CreateMatrix(tblMat)\n\n   local tblVecArray {\n     { x1, y1, z1, w1 },\n     { x2, y2, z2, w2 },\n     { x3, y3, z3, w3 },\n     { x4, y4, z4, w4 },\n      :\n     (中略)\n      :\n     { xn, yn, zn, wn },\n   }\n\n   local retVecArray = GEO_VecArrayConv(pMat, tblVecArray)\n\n   上記の例では複数のベクトルをLuaテーブルとして与え、\n   pMat が持つマトリクスをかけた変換結果を retVecArray に受け取っている。\n\n   同じ形式、同じ要素数で変換結果が返される。\n</pre></li></ul><h3 id=\"RisetotheThrone専用関数\">Rise to the Throne 専用関数<a title=\"このセクションへのリンク\" href=\"#RisetotheThrone%E5%B0%82%E7%94%A8%E9%96%A2%E6%95%B0\" class=\"anchor\"> ¶</a></h3>\n<dl><dt>RTTT_getPlatformID</dt><dd>\n</dd></dl>\n<p>\n今のPlatformが何であるかを示す識別子を返す. \n</p>\n<ul><li>RTTT_getPlatformID\n<pre class=\"wiki\">  local platform = RTTT_getPlatformID()\n\n  -- 戻り値の識別子は以下の通りで内部的には整数.\n  -- RTTT_PLATFORM_UNKNOWN\n  -- RTTT_PLATFORM_WIN32\n  -- RTTT_PLATFORM_IOS\n  -- RTTT_PLATFORM_ANDROID\n</pre></li></ul>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/index.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"タスクマニュアル\">タスクマニュアル<a title=\"このセクションへのリンク\" href=\"#%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB\" class=\"anchor\"> ¶</a></h2>\n<p>\nここには、Engineによって用意されるタスクのマニュアルを集約していく予定です。\n</p>\n<ul><li><a class=\"wiki\" href=\"design_lua.html\">Luaインタフェース関数マニュアル</a>\n</li></ul><p>\nタスクの使い方については幾度となく同じ質問を受けています。\n質問前に読んでもらえるよう、現在FAQを作成中です。\n</p>\n<ul><li><a class=\"wiki\" href=\"FAQ.html\">タスク使い方FAQ</a>\n</li></ul><h3 id=\"UIタスクツリー化可能\">UIタスク(ツリー化可能)<a title=\"このセクションへのリンク\" href=\"#UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%84%E3%83%AA%E3%83%BC%E5%8C%96%E5%8F%AF%E8%83%BD\" class=\"anchor\"> ¶</a></h3>\n<ul><li><a class=\"wiki\" href=\"UITree.html\">UIタスクのツリー化について</a>\n</li><li><a class=\"wiki\" href=\"UIGeneric.html\">UIタスクの標準プロパティおよびコマンドについて</a>\n</li><li><a class=\"wiki\" href=\"CompositeCallback.html\">Compositeからのコールバック仕様(UI_Form / UI_List共通)</a>\n</li><li><a class=\"wiki\" href=\"modalstack.html\">モーダルスタックについて (UI_Form / UI_List / UI_DragIcon / UI_Control)</a>\n</li></ul><ul><li><a class=\"wiki\" href=\"UI_ActivityIndicator.html\">UI_ActivityIndicator</a> 処理待ちアニメーションアイコン表示\n</li><li><a class=\"wiki\" href=\"UI_Clip.html\">UI_Clip</a> プライオリティクリッピング領域配置\n</li><li><a class=\"wiki\" href=\"UI_DbgLabel.html\">UI_DbgLabel</a> デバッグラベル\n</li><li><a class=\"wiki\" href=\"UI_DragIcon.html\">UI_DragIcon</a> ドラッグアイコン\n</li><li><a class=\"wiki\" href=\"UI_Form.html\">UI_Form</a> フォーム\n</li><li><a class=\"wiki\" href=\"UI_FreeVertItem.html\">UI_FreeVertItem</a> 自由頂点表示\n</li><li><a class=\"wiki\" href=\"UI_Group.html\">UI_Group</a> 画面上座標タグ\n</li><li><a class=\"wiki\" href=\"UI_Label.html\">UI_Label</a> ラベル\n</li><li><a class=\"wiki\" href=\"UI_List.html\">UI_List</a> リスト\n</li><li><a class=\"wiki\" href=\"UI_MoviePlayer.html\">UI_MoviePlayer</a> 動画の再生\n</li><li><a class=\"wiki\" href=\"UI_MultiImgItem.html\">UI_MultiImgItem</a> 複数asset切り替え表示\n</li><li><a class=\"wiki\" href=\"UI_PieChart.html\">UI_PieChart</a> 円グラフゲージ\n</li><li><a class=\"wiki\" href=\"UI_Polyline.html\">UI_Polyline</a> ポリライン\n</li><li><a class=\"wiki\" href=\"UI_ProgressBar.html\">UI_ProgressBar</a> プログレスバー\n</li><li><a class=\"wiki\" href=\"UI_RubberBand.html\">UI_RubberBand</a> ラバーバンド\n</li><li><a class=\"wiki\" href=\"UI_Score.html\">UI_Score</a> スコア表示\n</li><li><a class=\"wiki\" href=\"UI_ScrollBar.html\">UI_ScrollBar</a> スクロールバー\n</li><li><a class=\"wiki\" href=\"UI_SimpleItem.html\">UI_SimpleItem</a> asset表示\n</li><li><a class=\"wiki\" href=\"UI_SWFPlayer.html\">UI_SWFPlayer</a> Flashプレイヤー\n</li><li><a class=\"wiki\" href=\"UI_TextInput.html\">UI_TextInput</a> テキスト入力コントロール\n</li><li><a class=\"wiki\" href=\"UI_VariableItem.html\">UI_VariableItem</a> 可変asset表示\n</li><li><a class=\"wiki\" href=\"UI_VirtualDoc.html\">UI_VirtualDoc</a> 仮想ドキュメント\n</li><li><a class=\"wiki\" href=\"UI_WebView.html\">UI_WebView</a> Web表示\n</li></ul><h3 id=\"UIタスクツリー化不可.html\">UIタスク(ツリー化不可)<a title=\"このセクションへのリンク\" href=\"#UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%84%E3%83%AA%E3%83%BC%E5%8C%96%E4%B8%8D%E5%8F%AF\" class=\"anchor.html\"> ¶</a></h3>\n<ul><li><a class=\"wiki\" href=\"UI_Control.html\">UI_Control</a> 高レベルタッチパネル操作\n</li><li><a class=\"wiki\" href=\"UI_TouchPad.html\">UI_TouchPad</a> タッチパネル入力\n</li><li><a class=\"wiki\" href=\"UI_Button.html\">UI_Button</a> デバイスボタン入力\n</li></ul><h3 id=\"ゲーム用タスク.html\">ゲーム用タスク<a title=\"このセクションへのリンク\" href=\"#%E3%82%B2%E3%83%BC%E3%83%A0%E7%94%A8%E3%82%BF%E3%82%B9%E3%82%AF\" class=\"anchor.html\"> ¶</a></h3>\n</li><li><a class=\"wiki\" href=\"HTTP_API.html\">HTTP_API</a> サーバ通信(TODO: update documentaion)\n</li></ul><h3 id=\"その他.html\">その他<a title=\"このセクションへのリンク\" href=\"#%E3%81%9D%E3%81%AE%E4%BB%96\" class=\"anchor.html\"> ¶</a></h3>\n<ul><li><a class=\"wiki\" href=\"LIFECtrl.html\">LIFECtrl</a> タスク寿命時限化\n</li><li><a class=\"wiki\" href=\"ONLINE_Update.html\">ONLINE_Update</a> オンラインアップデート\n</li><li><a class=\"wiki\" href=\"PAUSECtrl.html\">PAUSECtrl</a> プロセスのForeground/Background切り替え処理呼び出し\n</li><li><a class=\"wiki\" href=\"STORE_Service.html\">STORE_Service</a> iOS ストアサービスタスク\n</li><li><a class=\"wiki\" href=\"TASK_Generic.html\">TASK_Generic</a> スクリプト向け汎用タスク\n</li><li><a class=\"wiki\" href=\"UTIL_IntervalTimer.html\">UTIL_IntervalTimer</a> インターバルタイマー\n</li></ul>\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/modalstack.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/ModalStack – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"モーダルスタックについて\">モーダルスタックについて<a title=\"このセクションへのリンク\" href=\"#%E3%83%A2%E3%83%BC%E3%83%80%E3%83%AB%E3%82%B9%E3%82%BF%E3%83%83%E3%82%AF%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6\" class=\"anchor\"> ¶</a></h2>\n<p>\n一部のUIタスクは「モーダルスタック」の概念を持ちます。\nこれはUIのモーダル状態を制御するための、内部的なデータ構造です。\n具体的には下記のタスクが対応しています。\n</p>\n<ul><li><a class=\"wiki\" href=\"UI_Form.html\">UI_Form</a> (&lt;modal flag&gt;で指定)\n</li><li><a class=\"wiki\" href=\"UI_List.html\">UI_List</a> (&lt;option flags&gt; の LIST_FLAG_MODAL で指定)\n</li><li><a class=\"wiki\" href=\"UI_Control.html\">UI_Control</a> (非モーダル状態のみ)\n</li><li><a class=\"wiki\" href=\"UI_DragIcon.html\">UI_DragIcon</a> (非モーダル状態のみ)\n</li></ul><p>\nモーダルスタック対応のタスクは、起動されると自身を「モーダルスタック」と呼ばれるスタック形式のデータに積み上げます。\nまた、非表示にされたり破棄されるなど、画面上から取り除かれる際に取り除かれます。\n</p>\n<p>\nこの時、モーダルスタックに積まれているすべてのタスクは下記の法則により影響を受けます。\n</p>\n<ul><li>タスクがモーダルであるか否かを問わず、上記の種類のタスクはすべてモーダルスタックに積まれます。\n</li><li>モーダルスタックに積まれたタスクが「モーダル」であるならば、自分より下に積まれているタスクの操作をすべて禁止します。\n</li><li>タスクが取り除かれた時、そのタスクがモーダルスタック中で最も上に積まれているモーダルのタスク(その上に何もないか、あってもすべてモーダルではない場合)であれば、その下から次のモーダルであるタスクにぶつかるまで、操作が許可された状態に戻します。\n</li><li>自身がモーダルスタックの途中にあるときに取り除かれた場合は、特に他のタスクの状態を変更しません。\n</li></ul><p>\nモーダルスタックに積まれるタイミングは、\n</p>\n<ul><li>タスクを生成したとき\n</li><li>表示状態をvisibleに変更したとき\n</li></ul><p>\n取り除かれるタイミングは、\n</p>\n<ul><li>タスクを破棄したとき\n</li><li>表示状態をinvisible に変更したとき\n</li></ul><p>\nとなります。\n</p>\n<p>\nモーダルスタックに積まれる順番は表示上のプライオリティと関係なく、\n「積まれるアクションを行った順」であることに注意してください。\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/properties.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UIGeneric – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UIタスクの標準プロパティ\">UIタスクの標準プロパティ<a title=\"このセクションへのリンク\" href=\"#UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%81%AE%E6%A8%99%E6%BA%96%E3%83%97%E3%83%AD%E3%83%91%E3%83%86%E3%82%A3\" class=\"anchor\"> ¶</a></h2>\n<p>\nツリー化可能とされるUIタスクは、すべて共通のプロパティを持ちます。\n</p>\n<ul><li>.alpha 表示上の alpha 値\n</li><li>.color 表示上の RGB 値\n</li><li>.scaleX 表示上のscale値(x方向)\n</li><li>.scaleY 表示上のscale値(y方向)\n</li><li>.rot 表示上の回転角(正方向で時計廻り。単位は degree)\n</li><li>.x 表示位置(x)\n</li><li>.y 表示位置(y)\n</li><li>.visible 表示の可否(boolean)\n</li></ul><p>\nこれらは同じ手続きで操作できます。\n</p>\n<h2 id=\"UIタスクの標準コマンド\">UIタスクの標準コマンド<a title=\"このセクションへのリンク\" href=\"#UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%81%AE%E6%A8%99%E6%BA%96%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89\" class=\"anchor\"> ¶</a></h2>\n<p>\nツリー化可能とされるUIタスクは、すべて共通のコマンドを受け付けます。\n</p>\n<dl><dt>UI_GENERIC_NODE_RECONNECT</dt><dd>\n</dd></dl>\n<blockquote>\n<p>\n<strong>注意:このコマンドは本来望ましくない処理を行うものであり、動作を理解しないまま使用するのは大変危険であるため、正しい動作を理解の上自己責任で使用すること！！</strong>\n</p>\n</blockquote>\n<blockquote>\n<p>\n自身の「代表ノード」を接続する先を、親タスクの持つ代表ノードではなく、\n親タスクの代表ノード以下になる別のノードに変更する。\n</p>\n</blockquote>\n<blockquote>\n<p>\n接続先のノードは名前で指定する。\n親タスクが存在しなければならず、またUIタスクでなければならない。\n親タスクが指定の名称のノードを持たない場合は基本的に何もしない。\n</p>\n</blockquote>\n<blockquote>\n<p>\n接続先として指定するノードは、親タスクが保有するノードでなければならない。同じ親を持つ兄弟の階層となったタスクが保有しているノードが、指定した名前を持つ場合の動作は保障しない。\n</p>\n</blockquote>\n<blockquote>\n<p>\nまた、このコマンドはUIタスクの持つSceneGraphを上位となるUIタスクのRootノード以外のノードに接続しなおすだけであり、\nCompositeのロードにより起動されるタスクのような「タスク付きノード」を生成するものではない。このため、UI_FormやUI_Listの\nUI_(FORM|LIST)_UPDATE_NODE の FORM_NODE_TASKでタスクポインタを取得することはできないことに注意。\n</p>\n</blockquote>\n<ul><li>UI_GENERIC_NODE_RECONNECT\n<pre class=\"wiki\">   pParent UI_*( ... )\n   pChild= UI_*(pParent, ...)\n   sysCommand(pChild, UI_GENERIC_NODE_RECONNECT, \"&lt;reconnect node name&gt;\")\n\n   ※上記例の場合、pParent が持つツリーに、&lt;reconnect node name&gt;で指定した名称のノードが無ければならない。\n</pre></li></ul><dl><dt>UI_GENERIC_SET_NAME</dt><dd>\nそのUIタスクの持つRootノードに、検索で使用可能な名前を与える。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\nただし、Rootノードが既に名前を持っている場合は再設定できない。Compositeから生成されたUIタスクや、すでに名前を与えられている場合がこれに該当する。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>UI_GENERIC_SET_NAME\n<pre class=\"wiki\">  pTask = UI_*( ... )\n  sysCommand(pTask, UI_GENERIC_SET_NAME, \"&lt;new task name&gt;\")\n</pre></li></ul><dl><dt>UI_GENERIC_ANIM_SET_SPLINE</dt><dd>\n自身の代表ノードに対し、スプラインアニメーションを設定する。\nスプラインアニメーション情報はLuaテーブルの形式で与える。\n</dd></dl>\n<blockquote>\n<blockquote>\n<p>\n現在再生中のアニメーションがある場合は、このコマンド呼び出しによって停止される。\n</p>\n</blockquote>\n</blockquote>\n<ul><li>UI_GENERIC_ANIM_SET_SPLINE\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_ANIM_SET_SPLINE, &lt;table-spline-data&gt;)\n\n   &lt;table-spline-data&gt; = {\n       {\n           target = &lt;modify-target&gt;,\n           mode = &lt;value-mode&gt;,\n           keys = {\n               { &lt;time&gt;, &lt;value&gt; },\n               { &lt;time&gt;, &lt;value&gt; },\n               { &lt;time&gt;, &lt;value&gt; },\n               { &lt;time&gt;, &lt;value&gt; },\n                      :\n                      :\n           },\n       },\n       {\n           target = &lt;modify-target&gt;,\n           mode = &lt;value-mode&gt;,\n           keys = {\n               { &lt;time&gt;, &lt;value&gt; },\n               { &lt;time&gt;, &lt;value&gt; },\n               { &lt;time&gt;, &lt;value&gt; },\n               { &lt;time&gt;, &lt;value&gt; },\n                      :\n                      :\n           },\n       },\n        :\n        :\n   }\n\n   &lt;modify-target&gt; 以下のうちどれか一種を指定。\n       SPL_MODIFY_X\n       SPL_MODIFY_Y\n       SPL_MODIFY_SCALE\n       SPL_MODIFY_R\n       SPL_MODIFY_G\n       SPL_MODIFY_B\n       SPL_MODIFY_A\n       SPL_MODIFY_ROT\n\n   &lt;value-mode&gt; 以下のうち、どちらかを指定。指定されない場合は SPL_VALUE_INT 扱いになる。\n       SPL_VALUE_INT  &lt;value&gt;を整数で指定。\n       SPL_VALUE_NUM  &lt;value&gt;を実数で指定。\n\n   &lt;time&gt; キーの時刻\n   &lt;value&gt; &lt;time&gt;で指定された時刻における値(値の形式は&lt;value-mode&gt;で指定)\n</pre></li></ul><dl><dt>UI_GENERIC_ANIM_PLAY</dt><dd>\n自身の代表ノードに設定されたスプラインアニメーションを再生する。\n実行前に、UI_GENERIC_ANIM_SET_SPLINE でアニメーション情報が設定されている必要がある。\n<ul><li>UI_GENERIC_ANIM_PLAY\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_ANIM_PLAY)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GENERIC_ANIM_STOP</dt><dd>\n自身の代表ノードに設定されたスプラインアニメーションが再生中の場合に、それを停止する。\n<ul><li>UI_GENERIC_ANIM_STOP\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_ANIM_STOP)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GENERIC_IS_ANIM</dt><dd>\n自身の代表ノードが現在アニメーション中か否かを返す。\n<ul><li>UI_GENERIC_IS_ANIM\n<pre class=\"wiki\">   pParent UI_*( ... )\n   &lt;is-animating&gt; = sysCommand(pChild, UI_GENERIC_IS_ANIM)\n\n   &lt;is-animating&gt; trueでアニメーション中、falseで停止中\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GENERIC_SET_COLOR</dt><dd>\n標準プロパティ .alpha および .color を設定する。\n<ul><li>UI_GENERIC_SET_COLOR\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_SET_COLOR, &lt;alpha&gt;, &lt;rgb&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GENERIC_SET_SCALE</dt><dd>\n標準プロパティ .scaleX および .scaleYを設定する。\n<ul><li>UI_GENERIC_SET_SCALE\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_SET_SCALE, &lt;scale-x&gt;, &lt;scale-y&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GENERIC_SET_ROT</dt><dd>\n標準プロパティ .rot を設定する。\n<ul><li>UI_GENERIC_SET_ROT\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_SET_ROT, &lt;rot&gt;)\n</pre></li></ul></dd></dl>\n<dl><dt>UI_GENERIC_SET_VISIBLE</dt><dd>\n標準プロパティ .visible を設定する。\n<ul><li>UI_GENERIC_SET_VISIBLE\n<pre class=\"wiki\">   pParent UI_*( ... )\n   sysCommand(pChild, UI_GENERIC_SET_VISIBLE, &lt;visible&gt;)\n</pre></li></ul></dd></dl>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/LuaAPI/tree.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title>\n      engine/design/task/UITree – PlaygroundOSS\n    </title>\n        <link rel=\"stylesheet\" href=\"assets/trac.css\" type=\"text/css\"><link rel=\"stylesheet\" href=\"assets/wiki.css\" type=\"text/css\">\n    <script type=\"text/javascript\" src=\"assets/jquery.js\"></script><script type=\"text/javascript\" src=\"assets/trac.js\"></script><script type=\"text/javascript\" src=\"assets/search.js\"></script>\n    <script type=\"text/javascript\">\n      jQuery(document).ready(function($) {\n        $(\"#content\").find(\"h1,h2,h3,h4,h5,h6\").addAnchor(\"このセクションへのリンク\");\n      });\n    </script>\n  </head>\n  <body>\n    <div id=\"main\">\n    <div id=\"content\" class=\"wiki\">\n      <p class=\"path noprint\">\n        <br style=\"clear: both\">\n      </p>\n      <div class=\"wikipage searchable\">\n        \n          <h2 id=\"UIタスクのツリー化について\">UIタスクのツリー化について<a title=\"このセクションへのリンク\" href=\"#UI%E3%82%BF%E3%82%B9%E3%82%AF%E3%81%AE%E3%83%84%E3%83%AA%E3%83%BC%E5%8C%96%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6\" class=\"anchor\"> ¶</a></h2>\n<p>\n「ツリー化可能」とされるUIタスクは、必ず表示要素を持ち、起動関数の第一引数に「親タスクのポインタ」を指定するようになっています。\n起動時に他のUIタスクを親タスクとして指定することで、UIタスクのツリー化が可能になります。\n</p>\n<p>\nUIタスクをツリー化することにより、それらのタスクは以下のような関係を持ちます。\n</p>\n<ul><li>各UIタスクの持つ表示要素は、描画系のSceneGraphレベルでツリー化されます。\n</li><li>このため子の側となったタスクに指定した座標は、親側タスクの表示位置からの相対座標で扱われます。\n</li><li>各UIタスク同士は、タスクレベルでの親子関係を構築します。\n</li><li>親タスクの破棄に合わせ、子タスク側にも破棄指令が送られます。\n</li></ul><p>\nまた、UIタスクに分類されるもの以外にも、ツリー化の親となることができるタスク(GAME_Unit, MAP_Groupなど)が存在します。\nこの場合も構築される関係は上記と同じです。これらはUIタスクを装飾として付随させることができる機能として実装されています。\n</p>\n\n        \n        \n      </div>\n    </div>\n    </div>\n    <div id=\"footer\" xml:lang=\"en\" lang=\"en\"><hr>\n      <a id=\"tracpowered\" href=\"http://trac.edgewall.org/\"><img src=\"assets/trac_logo_mini.png\" alt=\"Trac Powered\" height=\"30\" width=\"107\"></a>\n      <p class=\"left\">\n        By <a href=\"http://www.edgewall.org/\">Edgewall Software</a>.\n        <br>Translated by <a href=\"http://www.i-act.co.jp/\">インタアクト株式会社</a>\n      </p>\n      <p class=\"right\">Visit the Trac open source project at<br><a href=\"http://trac.edgewall.org/\">http://trac.edgewall.org/</a></p>\n    </div>\n  \n</body></html>\n"
  },
  {
    "path": "Doc/Modules/Allocators.txt",
    "content": "============================== Allocators & Memory ==================================\r\n\r\n1. Global Object & Array Allocation\r\nFirst there are MACROS used for allocation/free.\r\n\r\nKLBNEW(className)\r\nKLBNEWA(type, count)\r\nKLBDELETE(pointer)\r\nKLBDELETEA(pointer)\r\n\r\nThose macros are used only INSIDE the engine code, NOT inside the platform code.\r\nWhen receiving a object that you must free yourself from the platform (ie like a string),\r\nDO NOT USE those macros.\r\n\r\nie :\r\n\t\t\t\t|\tAlloc Platform\t| Alloc Engine\r\n----------------------------------------------------\r\nFree  Engine\t|\tNO MACRO\t\t| Use Macro\r\nFree  Platform\t|\tNO MACRO\t\t| NEVER EXIST\r\n----------------------------------------------------\r\n\r\nBased on DEBUG_MEMORY flag, those macro behavior can change. (BaseType.h)\r\n\r\n2. Pool.\r\nThere are a few places where pool allocator are used.\r\n\r\nIn source/core/ArrayAllocator.h, there is a template of a pool allocator.\r\nThe allocator work the following way :\r\n- An array of struct is allocated.\r\n- Each struct member with index in the array about the previous and next item.\r\n- There are two link list in the allocator :\r\n\t- The list of free items.\r\n\t- The list of allocated items.\r\n\r\nFor now, indexes are limited to 16 bit, resulting in 65534 item available max.\r\n\r\nThe allocator is used in :\r\n- The asset dictionnary node pool.\r\n- The language dictionnary node pool.\r\n- The 2D Texture packer nodes.\r\n- The composite management loader (\"form\") CKLBInnerDef struct pool.\r\n- The asset manager pool.(note : does NOT use the template but direct implementation of same mecanism)\r\n\r\n\r\n3. Detailed Setup of memory amount for various pools and buffers when the engine start.\r\nWhen the main class CKLBGameApplication start, each project implement a sub class and can override the setupAllocation(...) function.\r\n(See CKLBGameApplication.h)\r\n\r\nThe following information can be setup :\r\n- Default number of node for dictionnary (used for asset) : 15,000 by default.\r\n- Asset Handler pool size.\t: 10,000 by default.\tx  8  byte each =  80 KB at start\r\n- Number of asset slots.\t:  1,000 by default.\tx 12  byte each =  12 KB at start\r\n- Template form node slots\t: 10,000 by default.\tx 240 byte each\t= 2.4 MB at start\r\n\tUsed by form loader for each \"node\"\r\n\r\nInternal Stuff at startup are :\r\n- CKLBTextTempBuffer is a singleton for a \"temporary any use\" buffer\t= 32 KB at start\r\n- TexturePacker with 2048x512 texture (SW buff + HW texture) in 4444 or 8888 depending on compile option = 4MB or 8MB at start.\r\n- Each plugin instance and various singletons of each modules.\r\n- Language database entry node = 72 KB at start.\r\n- Rendering System consume per frame cache : 65000 vertex and 65000 indexes.\r\n\t128 KB for index\r\n\t1.2 MB for vertex\r\n\tper frame cached.\r\n\t\r\n\tIn multithreaded rendering, we have 5 frames cached.\r\n\t\r\nTexturePacker and Rendering system are the heavy weight in memory consumption at first,\r\nthose memory could be reduce by changing the limits (packer page size, maximum number of vertex during rendering of a frame, etc...)\r\nEach asset, each task instance will of course use memory.\r\n\r\n##################################\r\n### Files involved\r\n\r\ninclude/BaseType.h\r\nsource/core/ArrayAllocator.h\r\nsource/Rendering/CKLBRenderingManager.cpp\r\nsource/core/CKLBGameApplication.cpp\r\nsource/assets/CKLBTexturePacker.cpp\r\n"
  },
  {
    "path": "Doc/Modules/Asset_Stream_Format/Asset_Naming_Convention.txt",
    "content": "Asset Loading specification & Format\r\n---------------------------------------\r\n\r\n1/ Asset Seen from File URL :\rFile URL : \"asset:://com/klab/www/asset1.texb\"\r\n\r\n\t'asset::' allow to access to the asset folder.\r\n\t\r\n\tAsset name is : 'com/klab/www/asset1'\r\n\tPlugin ID is  : 'T' (Texture) --> Extension is  : '.texb'\r\n\r\n2/ Asset Seen from internal views :\r\t- Own Name stored in Asset stream \t\t: Char[0]   : PluginId\r\n\t\t\t\t\t\t\t\t\t\t\t  Char[1..n]: Asset Name (non-mangled name)\r\n\tEx. 'Iimage_207'\r\n\t\tI\t\t\t: Plugin ID (char)\r\n\t\timage_207\t: Name\r\n\r\n\t- Inside a .link file asset\t\t\t\t: Use AssetName + Extension in one string : \"com/klab/www/asset1.texb\"\r\n\t\t\r\n\t- In a constant pool for reference\t\t: Same as own name storage.\r\n\t\tChar[0]\t\t: PluginId\r\n\t\tChar[1..n]\t: Asset Name\r\n\t\t\r3/ Assets : Plugin ID, file extension, chunk type, description.\r\n\r\n\t'I'\t\t.imag\t\t[TIMG]\t\tDefine one sprite entity\r\n\t'T'\t\t.texb\t\t[TEXB]\t\tDefine one texture, grouping multiple sprite definition [TIMG]\r\n\t'F'\t\t.flsh\t\t[FLSH]\t\tDefine a flash movie, use references on [TIMG]\r\t\t\t\t\t\t\rSpecial chunk type:\r\n\t\t\t\t\t\t[LINK]\t\tSpecial chunk that can be in ANY file but 'route' to another file for loading.\r\n\r\n\tFor now, [LINK] is used inside .imag to force loading of .texb embedding the ressource instead.\r\n\t.imag has no data, .texb has all the data.\r"
  },
  {
    "path": "Doc/Modules/Asset_Stream_Format/TEXB_stream_format.txt",
    "content": "--------------------------------------------------------------------------\r\nTEXB File format\r\n\r\nTEXB file format describe a texture.\r\n\r\nTexture can embbed multiple \"images\" which are not only rectangular but\r\nis defined as a triangle soup.\r\n\r\n2011/12/06 V0.1 : First Draft\r\n2011/12/09 V0.15: Added information about \"Type\" field, compressed texture is not complete still.\r\n2012/01/12 V0.2 : Updated information about C String format for ressource name\r\n2012/01/26 V0.3 : Added member width, height into image asset\r\n--------------------------------------------------------------------------\r[TEXB](u32)\r\nSize  (u32)\r\n\tString Length\t(u16)\r\n\t\tLength include 0 and padding alignment\r\n\tC String (0 included, + padding align 2)\r\n\t\tT + full resource path name\r\n\t\texample : Tpackage.package2.filename.texb\r\r\n\tWidth\t\t\t\t(u16)\r\n\tHeight\t\t\t\t(u16)\r\n\tType\t\t\t\t(u16)\r\n\t\tBit 0..2\t: [0] ALPHA | [1] LUMA | [2] LUMALPHA | [3] RGB | [4] RGBA\r\n\t\tBit 3\t\t: [0] False, [1] True --> Compressed\r\n\t\tBit 4\t\t: [0] False, [1] True --> Mipmap\r\n\t\tBit 5\t\t: [0] False, [1] True --> Double Buffered\r\n\t\tBit 6..7\t: Pixel Format\r\n\t\t\t0 : 565  RGB\r\n\t\t\t1 : 5551 RGBA\r\n\t\t\t2 : 4444 RGBA\r\n\t\t\t3 : Byte\r\n\t\t\t\r\n\t\tTODO RP\t\t: Add Bit definition for compressed texture format type (ETC1 variation, etc...)\r\n\t\t\t\t\t\tCan reuse pixel format bits if necessary\r\n\r\n\tTotalVertexCount\t(u16)\r\n\tTotalIndexCount\t\t(u16)\r\n\tImageCount\t\t\t(u16)\r\n\t\r\n\t\t(multiply by Image Count)\r\n\t\t[TIMG]\t\t\t\t(u32)\r\n\t\tSize\t\t\t\t(u16)\r\n\t\tString Length\t\t\t(u16)\r\n\t\t\tLength include 0 and padding alignment\r\n\t\tC String \t\t\t(0 included, + padding align 2)\r\n\t\t\tI + full resource path name\r\n\t\t\tIpackage.package2.filenameB.imag\r\n\t\tVertexCount\t\t\t(u8)\r\n\t\tIndexCount\t\t\t(u8)\r\n\t\tCenterX\t\t\t\t(u16)\r\n\t\tCenterY\t\t\t\t(u16)\r\n\t\t\r\n\t\t\t(multiply by VertexCount)\r\n\t\t\tX\t\t\t\t\t(u32 fixed 16.16)\r\n\t\t\tY\t\t\t\t\t(u32 fixed 16.16)\r\n\t\t\t\r\n\t\t\t(multiply by IndexCount)\r\n\t\t\tIndex\t\t\t\t(u8)\r\n\r\n\t[... Texture Bitmap Data...]\r\n------------------------------------------------------------------------\r\n"
  },
  {
    "path": "Doc/Modules/Asset_Stream_Format/TIMG_stream_format.txt",
    "content": "--------------------------------------------------------------------------\r\nTIMG Chunk format\r\n\r\nTIMG Chunk format describe an image inside a texture.\r\nTIMG Chunk ARE NOT stand alone for now but embedded into the TEXB stream format.\r\nIMAG File ARE stand alone but are just link information to the TEXB file.\r\n\r\n2011/12/06 V0.1 : First Draft\r\n2011/12/09 V0.15: \r\n2012/01/12 V0.2 : Added information about link file and\r\n2012/01/26 V0.3 : Added Width & Height member to have virtual image size.\r\n2012/01/27 V0.4 : Added concept of map with sub tiles.\r\n--------------------------------------------------------------------------\r\n[TIMG]\t\t\t(u32)\r\nSize\t\t\t(u16)\r\nString Length\t(u16)\r\n\tLength include 0 and padding alignment\r\nC String \t\t(0 included, + padding align 2)\r\n\t\tI + full resource path name\r\n\t\tIpackage.package2.filenameB.imag\r\nSubCount\t\t(u16)\r\n\r\n\tx SubCount\r\n\t\tVertexCount\t\t(u8)\r\n\t\tIndexCount\t\t(u8)\r\n\t\tWidth\t\t\t(u16)\r\n\t\tHeight\t\t\t(u16)\r\n\t\tCenterX\t\t\t(u16)\r\n\t\tCenterY\t\t\t(u16)\r\n\r\n\t\t\t(multiply by VertexCount)\r\n\t\t\tX\t\t\t\t\t(u32 fixed 16.16)\r\n\t\t\tY\t\t\t\t\t(u32 fixed 16.16)\r\n\t\t\t\r\n\t\t\t(multiply by IndexCount)\r\n\t\t\tIndex\t\t\t\t(u8)\r\n\rNote : due to the fact that TIMG is embedded into a TEXB stream, there is no constant\r\npool referencing to the texture name.\r\n\r\nNote : Stand alone imag file linking to .texb files\r\n[LINK][Size(u32)]C String 0 terminated.\r\n\r\n Ex : [LINK][31]package.package2.filename.texb[0]\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Doc/Modules/Assets.txt",
    "content": "================================ Assets ====================================\r\n\r\nThe Asset Manager (CKLBAssetManager) is the class in charge of all assets life cycle\r\nand of the assets loader plugins.\r\n\r\nThis class is a singleton and has a pool of assets.\r\n\r\nA SAssetEntry is a basic structure :\r\n\r\nstruct SAssetEntry {\r\n\tCKLBAbstractAsset*\tm_pAsset;\r\n\tbool\t\t\t\tm_isFree;\r\n\tu16\t\t\t\t\tm_prev;\r\n\tu16\t\t\t\t\tm_next;\r\n};\r\n\r\nIt uses an allocator with a list of used and free SAssetEntry.\r\nPool size is defined when the game engine starts. (See \"Allocators.txt\")\r\n\r\nIt can load a maximum of 65534 assets.\r\n\r\nThe Asset Manager is also able to register and unregister IKLBAssetPlugins. \r\nUsing IKLBAssetPlugins allows the different assets to be loaded differently depending on \r\nthe type of asset that have to be loaded.\r\n\r\nCKLBAbstractAsset is the root class for all assets definition.\r\nEach abstract asset has a name (for debug purpose), an ID (runtime decided),\r\nand the methods incrementRefCount() and decrementRefCount() which can be used \r\nto lock an instance of this asset. If the reference counter falls to 0, \r\nit is automatically removed from the CKLBAbstractAsset list of the Asset Manager.\r\n\r\nIt also defines the following virtual methods : onRegisterSubAsset() and onUnregisterSubAsset()\r\ndoing nothing by default. They can be overwritten in subclasses.\r\n\r\nIKLBAssetPlugin defines an interface for the Asset plugins being defined in the Engine.\r\nAmong other methods, it defines a method loadAsset(u8* stream, u32 streamSize).\r\n\r\nThe manager allows to find an asset by an asset name :\r\nExample \"asset://myfolder/asset.ext\"\r\n\r\nThe manager knows the logical name of each asset loaded and decided to load automatically the asset\r\nif not already loaded. File system acts as database of assets.\r\nThere are cases where one asset file will actually own multiple assets, thus a need to have multiple path\r\npointing to the same asset.(.LNK file)\r\n\r\nSee also \"Asset Stream Format\" folder with :\r\n- Asset_Naming_Convention.txt\r\n- TEXB_stream_format.txt (not updated to latest version of the parser, just as a reference)\r\n- TIMG_stream_format.txt (not updated to latest version of the parser, just as a reference)\r\n\r\n=============================================================================\r\nHow To Add A New Asset Type ?\r\n\r\nHow to create new assets and use them :\r\n- Create your own plugin derived from IKLBAssetPlugin.\r\n- Create your own asset derived from CKLBAbstractAsset or CKLBAsset based on the type.\r\n- Export a file format that has a header supporting the getChunkID() from the plugin OR use\r\n  API calls with a specific plugin. \r\n  -> Loader will recognize your file by using a header if you have no plugin set during the function call.\r\n\r\n=============================================================================\r\n\r\nLINK file\r\n\r\nWhen an asset embed multiple assets, as we have a unique file path to access each sub asset, it can create a problem.\r\n=> We can create an asset file that will reroute to another asset that really owns all the data.\r\n\r\nThe file will own a LINK header instead of a normal plugin header, and have information to reroute to another file.\r\n\r\nTo make the understanding easier :\r\n----------------------------------\r\n\r\nFor the sake of understanding all the asset are in the root folder.\r\nA texture \"A.texb\" have 3 images \"IMG1.imag\", \"IMG2.imag\", \"IMG3.imag\".\r\n\r\nThus :\r\n\"asset://IMG1.imag\"\r\n\"asset://IMG2.imag\"\r\n\"asset://IMG3.imag\" are the assets we want to access\r\n\r\n\"asset://A.texb\" is the real file having the texture and all the IMG*.imag assets.\r\n\r\nA file IMG1.imag does exist, but inside there is just a LINK header pointing to A.texb\r\nSame for IMG2.imag and IMG3.imag\r\n\r\nYou can look at compiled image asset.\r\n\r\n=============================================================================\r\n\r\nAbout plugin direct call + Asset with/without using header.\r\n\r\nWhen creating new tasks for your game, you can use as an example the following APIs.\r\nSee CKLBUtility::readAsset\r\nSee CKLBUtility::loadAsset\r\n\r\nBy passing a plugin, we can access a file which has no header and directly read the stream\r\nas an asset stream.\r\n\r\nIf the plugin is not given, then a header IS necessary at the beginning of the file.\r\n\r\nIn some cases it is usefull : JSON file as an example have no header, and different\r\nasset could use JSON as an exchange format.\r\n\r\n=============================================================================\r\nNote about audio assets :\r\n\r\n\t1/ Audio assets are \"just\" wrappers around objects given by the porting layer,\r\n\tand are actually used only by the form asset loader.\r\n\t2/ Audio assets used by LUA are directly using Audio Object from the porting layer,\r\n\tso technically they are NOT assets from the point of view of the engine.\r\n\t\r\n\tConsidering that Audio Asset are not used globally, it defeat the whole point\r\n\tof wrapping and modularity of the design. A possible refactoring would be\r\n\tto remove completly Audio Asset and related code and directly use Audio object\r\n\tinside the engine.\r\n\t\r\n\tThe only role here for Audio asset is to avoid loading the same audio object\r\n\tmultiple times. By using the asset management system we get unique assets.\r\n\t\t\r\n=============================================================================\r\n# Assets\r\n- CKLBAbstractAsset\r\n\tGeneric basic asset, owns the reference counting mecanism.\r\n\t\r\n\tSources : \tsource/Assets/CKLBAsset.h\r\n\t\t\t\tsource/Assets/CKLBAssetManager.cpp\r\n\t\r\n- CKLBAsset\r\n\tAsset that can create a part of the scene graph when instancing.\r\n\t\r\n\tSources : \tsource/Assets/CKLBAsset.h\r\n\t\r\n- CKLBAudioAsset\r\n\tWrapper for audio object given by porting layer, used only by \r\n\t\r\n\tSources :\tsource/Assets/AudioAsset.h\r\n\t\t\t\tsource/Assets/AudioAsset.cpp\r\n\t\r\n- CKLBTextureAsset\r\n- CKLBImageAsset\r\n\tTexture asset is a texture that describes a 2D texture uploaded to the GPU.\r\n\tInside a texture asset file, we also store a list of 2D models.\r\n\tA 2D model is a list vertices and related indexes for rendering triangles. \r\n\tBasically, one model is an image asset.\r\n\tThere are also various attributes that are stored within an image asset.\r\n\t\r\n\tSources : \tsource/Assets/CKLBAsset.h\r\n\t\t\t\tsource/Assets/CKLBAssetManager.cpp\r\n\r\n- CKLBSWFAsset\r\n\tThis is an asset that stores exported Flash movies from our converter.\r\n\tIt contains animation information, link to needed images or sound assets and movie structure.\r\n\tVarious information about label, movie length is also stored.\r\n\t\r\n\tSources :\tsource/Animation/CKLBSWFPlayer.h\r\n\t\t\t\tsource/Animation/CKLBSWFPlayer.cpp\r\n\r\n- CKLBCompositeAsset\r\n\tCKLBCompositeAsset is an asset defining a \"Form\". \r\n\tA Form is basically a tree of visual tasks and components.\r\n\tIt allows to create a scene formed with tasks and UI objects without having to \r\n\theavily rely on scripting. \r\n\tInstead, a loader performs object creation and property setup.\r\n\t\r\n\tSources : \tsource/Assets/CompositeManagement.h\r\n\t\t\t\tsource/Assets/CompositeManagement.cpp\r\n\t\r\n- CKLBCellAnimationAsset\r\n- CKLBSplineAnimationAsset \r\n- CKLBNodeAnimationAsset\r\n\tThose assert virtually exist as implemented for some, but have never been used in production or completly.\r\n\tSo for the time being we will not consider discussing those further.\r\n\t\r\n\tNote : could remove from the project.\r\n\t\r\n\tSources : \tsource/Assets/CKLBAssetCellAnimation.h\r\n\t\t\t\tsource/Assets/CKLBAssetCellAnimation.cpp\r\n\t\t\t\tsource/Assets/MapManagement.h\r\n\t\t\t\tsource/Assets/MapManagement.cpp\r\n\t\t\t\tsource/Assets/AI_Asset.h\r\n\t\t\t\tsource/Assets/AI_Asset.cpp\r\n\t\t\t\tsource/Assets/NodeAnimationAsset.h\r\n\t\t\t\tsource/Assets/NodeAnimationAsset.cpp\r\n\t\r\n- CKLBUIAsset\r\n\tGenerates an instance of UI Form from asset definition.\r\n\tNever been used, instead we use \"CKLBCompositeAsset\"\r\n\t\r\n\tSources :\tsource/Assets/CKLBAsset.h\r\n\t\t\t\tsource/Assets/CKLBAssetManager.cpp\r\n\t\r\n# Assets Plugins\r\n- IKLBAssetPlugin\r\n\tBase interface for all asset plugins.\r\n\t\r\n\tSources :\tsource/Assets/CKLBAsset.h\r\n\t\t\t\tsource/Assets/CKLBAssetManager.cpp\r\n\t\r\n- KLBTextureAssetPlugin\r\n\tPlugin responsible for loading texture and images inside texture.\r\n\tSee CKLBTextureAsset and CKLBImageAsset.\r\n\t\r\n\tSources :\tsource/Assets/TextureManagement.h\r\n\t\t\t\tsource/Assets/TextureManagement.cpp\r\n\t\r\n- KLBFlashAssetPlugin\r\n\tKLBFlashAssetPlugin is in charge of loading KLBFlashAssetPlugin.\r\n\t\r\n\tSources :\tsource/Animation/CKLBSWFPlayer.h\r\n\t\t\t\tsource/Animation/CKLBSWFPlayer.cpp\r\n\t\t\t\t\r\n- KLBAudioAssetPlugin\r\n\tKLBAudioAssetPlugin is in charge of loading CKLBAudioAsset.\r\n\t\r\n\tSources :\tsource/Assets/AudioAsset.h\r\n\t\t\t\tsource/Assets/AudioAsset.cpp\r\n\r\n- KLBBlendAnimationAssetPlugin\r\n\tKLBBlendAnimationAssetPlugin is in charge of loading CKLBNodeAnimationAsset.\r\n\t\r\n\tSources :\tsource/Assets/NodeAnimationAsset.h\r\n\t\t\t\tsource/Assets/NodeAnimationAsset.cpp\r\n\t\r\n- KLBCellAnimationAssetPlugin\r\n\tKLBCellAnimationAssetPlugin is in charge of loading CKLBCellAnimationAsset.\r\n\t\r\n\tSources : \tsource/Assets/CKLBAssetCellAnimation.h\r\n\t\t\t\tsource/Assets/CKLBAssetCellAnimation.\r\n\t\t\t\t\r\nSpecial note about asynchronous loading for textures :\r\n\tThere is one special case where the asset is loaded by a seperated thread.\r\n\tIn this case, the main engine thread MUST NOT execute any asset loading (= all tasks using ressources must NOT be created)\r\n\r\n\tThe asset manager will perform the asset loading in another thread but transfer to OpenGL texture\r\n\tand texture creation will happen on the main thread.\r\n\t\r\n"
  },
  {
    "path": "Doc/Modules/Audio.txt",
    "content": "============================== Audio ==================================\r\n\r\nThere are two ways to load audio data :\r\n- One is to use LUA API directly and manage audio data with control APIs.\r\n- One is to use audio resource link inside a form.\r\n\t(See Assets.txt for Audio)\r\n\r\nCore Audio APIs are provided by the platform layer to be standardized\r\nfor all platforms.\r\n\r\nThese APIs are called from the following system in the game engine :\r\n- Called from Audio Asset wrapper.\r\n- Called by LUA binding APIs.\r\n- SWF Player\r\n\r\nAudio files support encryption same as any other resources.\r\n(For more details about encryption support, see Encryption.txt)\r\n\r\nInside the tool when you compile for iPhone, the audio is MP3.\r\nWhen compiling for Android, the audio output is OGG.\r\n\r\nBecause of licensing issue, it may be worth to pass everything to OGG\r\nbut in this case, you may loose the advantage of the performance gain but will have to pay\r\nlicenses using MP3 for games.\r\ngiven by device maker optimization. (ie hardware codec, or very optimized software codec)\r\n(http://www.mp3licensing.com/royalty/games.html)\r\n\r\nAnyway, the OSS version of the engine is OGG for Android, MP3 for Win32 and iOS.\r\n\r\nRelated file (all platforms):\r\n\tsource/Assets/\r\n\t\tAudioAsset.cpp\r\n\t\tAudioAsset.h\r\n\t\r\n\tsource/LuaLib/\r\n\t\tCKLBLuaLibSOUND.h\r\n\t\tCKLBLuaLibSOUND.cpp\r\n\t\r\n\tsource/Animation/CKLBSWFPlayer.cpp\r\n\t\r\n\tsource/include/CPInterface.h\r\n\r\nRelated file (when using MP3, all platforms):\r\n\tsource/Sound/CSoundAnalysis.cpp\r\n\tsource/Sound/CSoundAnalysisMP3.cpp\r\n\tsource/Sound/CSoundAnalysisMP3.h\r\n\r\nEach platform has a specific implementation depending on the underlying OS\r\nAPIs available, optimisation of resources, streaming, etc...\r\nWhat is important to know is that we have a thread that control the volume\r\nfor each audio object currently playing.\r\n\r\nRelated file (each platform):\r\n\tWin32 \t(MP3 version)\r\n\tporting/Win32/Platform/\r\n\t\tCWin32Audio.cpp\r\n\t\tCWin32Audio.h\r\n\t\tCWin32MP3.cpp\r\n\t\tCWin32MP3.h\r\n\t\tCWin32Platform.cpp\r\n\t\t\r\n\tiOS \t(MP3 version)\r\n\tporting/iOS/\r\n\t\tCiOSAudio.mm\r\n\t\tCiOSAudioManager.mm\r\n\t\tCiOSPlatform.mm\r\n\t\t\r\n\tAndroid (OGG version)\r\n\tporting/Android/jni/Android/\r\n\t\tCSoundPool.cpp\r\n\t\tCSoundPool.h\r\n\t\tKLBOpenSLAudioPlayer.h\r\n\t\tKLBOpenSLEngine.cpp\r\n\t\tKLBOpenSLSoundAsset.cpp\r\n\t\tKLBOpenSLSoundAssetLoader.cpp\r\n\t\tKLBOpenSLSoundHandle.cpp\r\n\t\r\nNote : we also have a version for Win32 using OggVorbis instead of MP3 but is not\r\nyet used in production.\r\n"
  },
  {
    "path": "Doc/Modules/Encryption.txt",
    "content": "============================== Encryption ==================================\r\n\r\nFor obvious purpose, we do need sometime to support encryption for files.\r\nWe support encryption through access to the file system only.\r\n\r\nThe encryption scheme must be able to support random access to the data.\r\n\r\nWe have the following code using encryption :\r\n- Audio Data (porting layer for Win32, Android, IOS)\r\n- File Stream implementation (porting layer for Win32, Android, IOS)\r\n- CKLBDatabase.cpp (wrapper for SQLite)\r\n- CSoundAnalysisMP3.cpp (parser of MP3, used on iOS and Win32)\r\n\r\nEverything is based on the CDecryptBaseClass, which could be summarized as :\r\n\r\nclass CDecryptBaseClass {\r\n\tvoid \t\tdecryptBlck\t(void* ptr, u32 length);\r\n\tu32\t\t\tdecryptSetup(const u8* ptr, const u8* hdr);\r\n\tvoid\t\tgotoOffset\t(u32 offset);\r\n};\r\n\r\n\r\nThe decryption works the following way :\r\n\r\n1. Engine call decryptSetup() function with the following arguments:\r\n\tParameter 1 - Name of file without path. Just the file name.\r\n\tParameter 2 - The first 4 byte of the file.\r\n\t\r\n\tIf decryptSetup return 0, the first 4 bytes of the stream are part of the encrypted data.\r\n\tIf decryptSetup return 1, the first 4 bytes of the stream are not data but header, encrypted info start at +4 bytes.\r\n\t\r\n\tThe reason for such system is that the encryption scheme was changed in between and we wanted to be backward compatible.\r\n\t\r\n\t0 is the old scheme\r\n\t1 is the new scheme with a 4 byte header in front of the encrypted file.\r\n\t\r\n2. After that the decryptBlck and gotoOffset can be called anytime, any order.\r\n\tIf the stream jumps, gotoOffset is ALWAYS called before decryptBlck.\r\n\t\r\nAs you can notice, the encryption is made in such a way that data is the same length as the original.\r\nBasically for each byte of the stream (except the 4 byte header of the new scheme) you should be able to do :\r\n\r\n\t[Out] Decrypted Byte = DecryptFunction ( [In] Encrypted Byte )\r\n\r\nThe concept is to have an encryption algorithm that is efficient enough to support fast and transparent decryption over a file system\r\nwith random access.\r\n\r\nWhich files are subject to encryption (All assets compiled by the tool) :\r\n- Lua files\r\n- SQLite databases (produced by the tool)\r\n- Audio files\r\n- Other assets like textures, forms, etc...\r\n\r\nNote that it is IMPOSSIBLE to mix encrypted and unencrypted files within the file system if you support old and new encryption scheme.\r\nBecause we have no way to differentiate an encrypted file from a non encrypted file when opening it.\r\n(The 4 byte header allows to select between the old or new encoding scheme)\r\n\r\nBUT, if you support only the new format with a 4 byte header, and that the header can NEVER be the first 4 bytes of a non encrypted file.\r\nYou could implement the \"old scheme\" as being a transparent decryption (= does nothing) and the \"new scheme\" to really perform decryption.\r\n\r\nThe tool is not supporting partial encryption (ie encrypt this file but not another) but your custom tool chain could do that when publishing.\r\n\r\nAndroid and IOS version only support encrypted.\r\nWin32 version is able to select if encryption is activated or not to allow engine debug.(need to read unencrypted data from the file system)\r\n(-enc true, -enc false option on the command line)\r\n\r\nRelated files:\r\n\t- source/include/encryptFile.h\r\n\t- source/core/encryptFile.cpp\r\n"
  },
  {
    "path": "Doc/Modules/FileSystem.txt",
    "content": "============================== File System =================================\r\n\r\nThe platform provides a set of APIs to handle files in the target OS file system.\r\n\r\nIReadStream defines an Interface for Read Stream classes.\r\nIt provides methods for file decryption.\r\nRead data can either be u8, u16, u32, float or blocks.\r\n\t\r\nGroup A\r\n\tIReadStream*\topenReadStream(...);\r\n\r\nGroup B\r\n\tITmpFile*\t\topenTmpFile(...);\r\n\tvoid\t\t\tremoveTmpFile(...);\r\n\r\nGroup C\r\n\tvoid*\t\t\tifopen\t(...)\r\n\tvoid\t\t\tifclose\t(...)\r\n\tint\t\t\t\tifseek\t(...)\r\n\tu32\t\t\t\tifread\t(...)\r\n\tu32\t\t\t\tifwrite\t(...)\r\n\tint\t\t\t\tifflush\t(...)\r\n\tlong int\t\tiftell\t(...)\r\n\tbool\t\t\ticreateEmptyFile(...)\r\n\r\n\t\r\nThe file path has always the following format coming from the game engine :\r\n\t\r\n\tfile://external/fileName\r\n\tfile://install/fileName\r\n\tasset://fileName\r\n\t\r\nBy using a notation like that we can extend later to other system like \"socket://\"\r\n\r\nfile://install/ is the root of the data for the application, where the package\r\nhas been downloaded and installed, considered as a READ ONLY area inside the file system.\r\n(or ROM if you prefer)\r\n\r\nfile://external/ is the base of the area where data can be freely modified and updated\r\nindependently from the application package files.\r\n\r\nWhen using the \"asset://folder/file.ext\" addressing, \r\nwe check first if \"file://external/folder/file.ext\" does exist.\r\n-> If so we return the stream object accessing the file.\r\n-> If not, we then check \"file://internal/folder/file.ext\"\r\n\r\nSo, the implementation checks FIRST in the updatable storage for a given file,\r\nand if not found, try to find it inside the application package.\r\n\r\nSuch mechanism allows to update, load new modules without worrying about the change\r\nof path inside the game content.\r\n\r\nBecause path format, default root and file permission may be different betweens OSes,\r\nthe path search and conversion from abstract \"game path\" to physical path is done\r\ninside the porting layer of each platform.\r\n\t\r\nEach platform porting layer is in charge of converting logical paths into physical paths \r\nfor each specific platform.\r\nIt provides instance of the IReadStream.\r\n\r\nThere are not much file writing activity, except for the downloading itself.\r\n(Information that are written over and over are saved on server side or client side DB).\r\n\r\nSo the engine relies mainly on openReadStream(...) to access files.\r\n\r\nThe group B APIs : openTmpFile / removeTmpFile APIs are only used in\r\n\tCKLBAsyncFileCopy\r\n\tCKLBUpdate\r\n\t\r\nThe group C APIs : it has been added later when encryption was added to the engine later on.\r\nThis addition just exists for the purpose of supporting encryption inside SQLite, and \r\nall these APIs are called from CKLBDatabase.cpp\r\n\r\nNow, there is also a IWriteStream interface that is used only for debugger protocol, but\r\nis not an essential part of the engine.\r\n(See source/Core/DebugTracker.cpp)\r\n\r\n- IWriteStream\r\n\tIWriteStream defines an Interface for Write Stream classes.\r\n\tWritten data can either be u8, u16, u32, float or blocks.\r\n\r\nWe have also included here the files about socket stream because they inherit from IReadStream / IWriteStream.\r\nBut also those are not used anymore inside the engine.\r\n\r\nRelated files:\r\n\t\r\n- include/FileSystem.h\r\n- source/Database/\r\n\tCKLBDatabase.h\r\n\tCKLBDatabase.cpp\r\n- porting/Win32/Platform/\r\n\tCWin32PathConv.cpp\r\n\tCWin32PathConv.h\r\n\tCWin32ReadFileStream.h\r\n\tCWin32ReadFileStream.cpp\r\n\tCWin32Platform.cpp\r\n- porting/iOS/\r\n\tCiOSPathConv.mm\r\n\tCiOSReadFileStream.cpp\r\n\tCiOSWriteFileStream.cpp\r\n\tCiOSTmpFile.cpp\r\n\tCiOSHttpStream.h\r\n\tCiOSHttpStream.mm\r\n\tCSockReadStream.cpp\r\n\tCSockWriteStream.cpp\r\n\tinclude/\r\n\t\tCiOSReadFileStream.h\r\n\t\tCiOSWriteFileStream.h\r\n\t\tiOSFileLocation.h\r\n\t\t\r\n- porting/Android/jni/Android/\r\n\tCAndroidPathConv.cpp\r\n\tCAndroidPathConv.h\r\n\tCAndroidReadFileStream.cpp\r\n\tCAndroidReadFileStream.h\r\n\tCAndroidTmpFile.cpp\r\n\tCAndroidTmpFile.h\r\n\tCAndroidWriteFileStream.cpp\r\n\tCAndroidWriteFileStream.h\r\n\tCSockReadStream.cpp\r\n\tCSockReadStream.h\r\n\tCSockWriteStream.cpp\r\n\tCSockWriteStream.h\r\n\t\n"
  },
  {
    "path": "Doc/Modules/Network.txt",
    "content": "============================== Network ==================================\r\n\r\nAt first, the core system is CKLBHTTPInterface class.\r\nEach instance of this class is an HTTP connection to the server.\r\n\r\nEach time the connection starts, a thread executing the connection is started.\r\n\r\nThe HTTP and socket connection support is done using the LibCurl library.\r\n\r\nThere is a special trick about error handling:\r\nSome server do suddenly cut the connection if there is zero byte of payload,\r\nresulting in an error when actually everything went OK.\r\nSo we check the error code sent by the server into a temporary variable when\r\nreceiving the header from the server and then override the error code from curl\r\nwith our temporary variable if we have CURL error with a zero byte payload.\r\n\r\nCKLBHTTPInterface has also various functions to :\r\n- Save the HTTP stream to file system.\r\n- Use POST or GET method.\r\n- Know how much of the data has already been downloaded / download complete.\r\n\r\nReferences:\r\n- CKLBHTTPInterface\r\n\tSources :\tsource\\HTTP\\CKLBHTTPInterface.h\r\n\t\t\t\tsource\\HTTP\\CKLBHTTPInterface.cpp\r\n\t\t\t\t\r\nTo avoid having HTTP connections created directly, the CKLBHTTPInterface class is\r\nnot directly accessible. (private constructor)\r\n\r\nInstead, we use the NetworkManager singleton which controls each connection so\r\nwe know how many connection threads are currently active.\r\n\r\nThe ConnectionEntry class is an element of the link list for each active connection.\r\n\r\nReference:\r\n- ConnectionEntry\r\n\tSources :\tsource\\HTTP\\MultithreadedNetwork.h\r\n\t\t\t\tsource\\HTTP\\MultithreadedNetwork.cpp\r\n\t\t\t\t\r\n- NetworkManager\r\n\tSources : \tsource\\HTTP\\MultithreadedNetwork.h\r\n\t\t\t\tsource\\HTTP\\MultithreadedNetwork.cpp\r\n\r\n\r\nCKLBUpdate is a task that download a file and unzip it.\r\nCKLBUpdateZip is task that perform only the zip when the file is already downloaded and saved.\r\n(Those use the same code, just different start state in their internal state machine)\r\n\r\nAdd two functions to lua library to check if a lock exists and destroy the lock.\r\n\r\nWe are using a lock mechanism (creating a lock file) in case if the appli fails while downloading,\r\nwe know that something went wrong and can restart/complete the operation.\r\n\r\nReferences:\t\t\t\t\r\n- CKLBUpdate & CKLBUpdateZip\r\n\tSources :\tsource\\HTTP\\CKLBUpdate.h\r\n\t\t\t\tsource\\HTTP\\CKLBUpdate.cpp\r\n\r\nCode used for unzipping the archive.\r\n- CUnZip\r\n\tSources :\tsource\\HTTP\\CUnZip.h\r\n\t\t\t\tsource\\HTTP\\CUnZip.cpp\r\n\t\r\nCKLBNetAPI is a task that perform network connection to a server.\r\nIt has the following possibilities :\r\n\t- Use Get or Post method\r\n\t- Cancel connection\r\n\t- Handle time out\r\n\t- Setup the headers for the connection\r\n\t\r\n\tEach instance of CKLBNetAPI task can only work with ONE connection at a time.\r\n\tSo the user need to wait a callback that the download is complete, failed or has timed out. else it is also possible\r\n\tto cancel a connection.\r\n\t\r\n\tThe system only receive result in Json format which is sent back to LUA.\r\n\t\r\n\tHere is the LUA command for the constructor :\r\n\tpNetTaskVariable = HTTP_API(\"myNetCallbackFunction\")\t-- Pass the callback function\r\n\t\r\n\tHere is the various LUA commands possible after construction :\r\n\t\r\n\t-- sysCommand(task, NETAPI_SEND, url, header, payload, timeout) : start a connection\r\n\tsysCommand(pNetTaskVariable, NETAPI_SEND, \"http://someserverdomain.com/urlapi/\", {a=\"Hello\", b=\"World\"}, \"{\\\"payload\\\":true}\", 30000)\r\n\t\r\n\t-- sysCommand(task, NETAPI_CANCEL) : cancel the connection if any\r\n\tsysCommand(pNetTaskVariable, NETAPI_CANCEL)\r\n\t\r\n\t-- sysCommand(task, NETAPI_BUSY) : return true if the connection is currently active, false if no connection\r\n\tisBusy = sysCommand(pNetTaskVariable, NETAPI_BUSY)\r\n\t\r\n\tHere is the callback function format :\r\n\t\r\n\tfunction myNetCallbackFunction(connectionID, message, status, bodyPayload)\r\n\t\t-- connectionID is always 0 for historical reason with our internal version of the network APIs.\r\n\t\t-- message has the following values :\r\n\t\t--   NETAPIMSG_CONNECTION_FAILED\r\n\t\t--   NETAPIMSG_SERVER_ERROR\r\n\t\t--   NETAPIMSG_SERVER_TIMEOUT\r\n\t\t--   NETAPIMSG_REQUEST_SUCCESS\r\n\t\t-- status is the server status code, but return -1 if connection could not happen\r\n\t\t-- bodyPayload is a json item tree\r\n\tend\r\n\t\r\nReferences:\t\t\t\t\r\n- CKLBNetAPI\r\n\tSources :\tsource\\HTTP\\CKLBNetAPI.h\r\n\t\t\t\tsource\\HTTP\\CKLBNetAPI.cpp\r\n\r\n\r\nThere is a singleton just to store key chain related information for network implementation.\r\n\r\n- CKLBNetAPIKeyChain\r\n\tSources :\tsource\\HTTP\\CKLBNetAPIKeyChain.h\r\n\t\t\t\tsource\\HTTP\\CKLBNetAPIKeyChain.cpp\r\n\r\nThis is more a utility than networking feature, but it is used mainly in networking.\r\nWhen receiving a JSon stream from a server response, the stream is parsed and converted into a tree\r\nof CKLBJSonItem and then to an equivalent LUA object tree sent back to LUA.\r\nIt is used by mainly by CKLBNetAPI and derived work.\r\n\r\n- CKLBJsonItem\r\n\tSources :\tEngine\\source\\HTTP\\CKLBJsonItem.h\r\n\t\t\t\tEngine\\source\\HTTP\\CKLBJsonItem.cpp\r\n\r\n\r\nConsidering billing/stores APIs, not sure if it can be considered as \"networking\" primitive, \r\nstill they surely connect in the background and do a lot of work.\r\nCKLBStoreService is responsible for the different interactions with the Application Store,\r\nas getting the products list or buying items.\r\nThis task is platform independent as it uses IPlatformRequest to process its requests.\r\n\r\n- CKLBStoreService\r\n\tSources :\tsource\\HTTP\\CKLBStoreService.h\r\n\t\t\t\tsource\\HTTP\\CKLBStoreService.cpp\r\n\t\t\t\t\r\n\t\t\t\tporting\\iOS\\CiOSPlatform.mm\r\n\t\t\t\tporting\\Android\\src\\klb\\android\\GameEngine\\PFInterface.java\r\n\t\t\t\tporting\\Android\\src\\klb\\android\\GameEngine\\billing\\*\r\n"
  },
  {
    "path": "Doc/Modules/Rendering.txt",
    "content": "======================== Rendering  =============================\r\n\r\nThe rendering is actually composed of two modules.\r\n- The OpenGLES wrapper. (OGLWrapper)                            (A)\r\n- The rendering system of the engine itself using OGLWrapper.   (B)\r\n\r\nThere is also something related to rendering, but \r\n\r\nA/ The OpenGLES wrapper\r\n-----------------------------------------------------------------\r\nThe goal is to avoid having the engine or upper layer to\r\nbe dependant on a specific rendering APIs.\r\nMoreover, by wrapping OpenGL concept with C++ objects,\r\nit makes life cycle management and setup much more convenient.\r\n\r\nIt is a self-contained system and have no dependancy except OpenGL/OpenGLES\r\nIt also has some features to make life easier concerning texture management\r\n(double buffering, handling atlas and UV coordinates).\r\n\r\nRelated files :\r\nsource/Rendering/\r\n\tCBuffer.cpp\r\n\tCFrame.cpp\r\n\tCImageBuffer.cpp\r\n\tCIndexBuffer.cpp\r\n\tCRenderingManager.cpp\r\n\tCRenderingManager_GL1.cpp\t(Rendering manager part dependant on OpenGLES 1.x APIs)\r\n\tCRenderingManager_GL2.cpp\t(Rendering manager part dependant on OpenGLES 2.x APIs)\r\n\tCShaderSet.cpp\r\n\tCShaderSetInstance.cpp\r\n\tCTexture.cpp\r\n\tCTextureBase.cpp\r\n\tCTextureUsage.cpp\r\n\tglWrapper.cpp\r\n\tglWrapper.h\r\n\tshaderSource.inl\r\n\r\n\t\r\nB/ The rendering system.\r\n\r\nIt is a list in order of rendering commands, executed each frame.\r\n\r\nB.1 - The rendering system is working as the following :\r\n\r\n\t1  - Parse a list of render commands.\r\n\t2A - If the render command has a triangle to draw, takes the XY, UV, color information\r\n\t  and tries to group them (batch) by rendering state to minimize the number of draw calls to GPU.\r\n\t2B - If the render command changes the gpu state or applies specific GPU command, it executes them.\r\n\r\n\tThe XY and color are recomputed by the scene graph when necessary (= when changes occur)\r\n\tbefore the rendering system is executed.\r\n\r\n\tFirst, the rendering system is simply a singleton of the CKLBRenderingManager class\r\n\twhich owns datas to perform rendering on :\r\n\t- Link list of all the render command objects.\r\n\t- Index Buffer, Vertex Buffer for batching.\r\n\t\t- List of indexes for triangle soup.\r\n\t\t- List of XY, UV, color buffers for vertices.\r\n\r\n\r\nB.2 - Default matrix, default OpenGLES setup\r\n\r\n\t* We perform 2D rendering and control the rendering order of the polygons, moreover\r\n\tfor all polygons being transparent there is no need for using a Z Buffer (except a few specific cases\r\n\twhere clipping per pixel is needed). By doing so, we optimize the memory bandwidth necessary to perform rendering.\r\n\r\n\t* Because all the vertices have colors attribute and we prefer to do batches, all the rendering\r\n\tare done using this render state :\r\n\t\tPixel = Texture * Interpolated Vertex Color (modulate)\r\n\t\tincluding alpha blending.\r\n\t\t\r\n\t* Transformation matrix is done in a way that all our coordinates for objects\r\n\tare TOP-LEFT in pixel coordinate.\r\n\r\n- Coordinates system : Logical Screen Size, Physical Screen Size.\r\n\r\n\tBecause devices have different screen size, it is important to design the application with only one\r\n\tscreen size.\r\n\tThere are scripting APIs to allow to setup a \"logical screen size\" (the screen size used when creating UI)\r\n\tand then the \"physical screen size\" (the device).\r\n\tBy being able to setup a logical screen size, it is possible to use/reuse parts created for another resolution.\r\n\tThe OpenGL matrix is updated accordinly to match the physical screen size when using logical screen size data.\r\n\r\n- Render Commands classes inheritance.\r\n\r\n* CKLBRenderCommand\t\t\t\t: Abstract render command, does nothing.\r\n\t* CKLBRenderState\t\t\t: Executes a render state change\r\n\t\tClears, Actives, Desactivates Z Buffer\r\n\t\tZ Buffer Range\r\n\t\tStencil Buffer Management (Never used)\r\n\t\tChanges of shaders (when shader compatible GPU)\r\n\t* CKLBSprite\t\t\t\t: Basic class for drawable polygon.\r\n\t\tSupports a fixed amount of vertex (XY,UV,Color), indexes.\r\n\t\tUses image asset as source.\r\n\t\t\r\n\t\t* CKLBSprite4_6\t\t\t: Optimized version of CKLBSprite\r\n\t\t\tThe role of this class is to have a member array with\r\n\t\t\t6 indexes and 4 vertices.\r\n\t\t\tThus, there is no need to allocate buffers for XY and UV coordinates.\r\n\t\t\tNeither allocation for colors.\r\n\t\t\tInstead the class is limited to the use of \"rectangular\" images.\r\n\t\t\t\r\n\t\t* CKLBDynSprite\t\t\t: More generic sprite where it is possible to\r\n\t\t\tsetup the number of vertices, the indexes, setup XY, UV and colors freely.\r\n\t\t\tUsefull for doing tricks with UV, showing part of images, etc...\r\n\t\t\t\r\n\t\t\t* CKLBSpriteScale9\t: It is a special image composed with 9 rectangles,\r\n\t\t\tthe corners are of fixed size, \r\n\t\t\tthe bottom and up edges are stretched horizontally,\r\n\t\t\tleft and right edges are stretched vertically.\r\n\t\t\t\r\n\t\t\tie : ABC          ABBBBBC\r\n\t\t\t     DEF     ---> DEEEEEF\r\n\t\t\t     GHI          GHHHHHI\r\n\t\t\t\t \r\n\t\t\tie : ABC          ABBBBBC\r\n\t\t\t     DEF          DEEEEEF\r\n\t\t\t     GHI          DEEEEEF\r\n\t\t\t     \t          DEEEEEF\r\n\t\t\t                  GHHHHHI\r\n\t\t\t\t\t\t\t  \r\n\t\t\tA,C,G,I corners are of fixed size.\r\n\t\t\tB and H are stretched horizontally.\r\n\t\t\tD and F are stretched vertically.\r\n\t\t\tE is stretched against both axis.\r\n\t\t\t\r\n\t\t\tThis component is usefull to draw many different variation of the same image\r\n\t\t\twithout sacrifying memory.\r\n\t\t\t\r\n\t\t\t* CKLBPolyline\t\t:\r\n\t\t\tRender command that take like and convert them into rectangle with thickness,\r\n\t\t\tallowing to draw lines.\r\n\t\t\tThis primitive was created only to perform some debug information and was\r\n\t\t\tnever used into production. The quality of the lines connection is inexistant.\r\n\t\t\t\r\n\t\t* CKLBCanvasSprite\r\n\t\t\r\n\t\t\tIt is like a dynamic sprite with a maximum amount of vertices and indexes.\r\n\t\t\tIt allowed to perform \"local\" rendering of images into one sprite that act like\r\n\t\t\ta batch.\r\n\t\t\t\r\n\t\t\tSimple use case :\r\n\t\t\tThere is a fixed background composed of multiple tiled images, like a maze.\r\n\t\t\t\r\n\t\t\tIt is of course possible to create multiple images instance, setup each coordinate.\r\n\t\t\tBut if you are concerned with performance and ressource usage, it would be better\r\n\t\t\tto batch all those vertices and indexes into ONE batch of polygons.\r\n\t\t\t\r\n\t\t\tBasically the canvas sprite allows the programmer to create a batch of images drawn as a single static\r\n\t\t\tsprite.\r\n\t\t\t\r\n\t\t* CKLBSprite3D\r\n\t\t\tIt is code that have never been in production but only made as a prototype to use 3D objects\r\n\t\t\tinside the game engine.\r\n\r\n- Text Rendering\r\n\r\n\tAt first we had text rendering done by each platform. But the slight differences between platforms were\r\n\ttoo much different in some cases. We ended up having our own font rendering system.\r\n\tOf course, complex language are not handled correctly as we are doing a basic usage of freeType for our renderer.\r\n\t\r\n\tThe system is the following :\r\n\tFontObject class :\tOwns the list of FontObject and handles life-cycle of font using reference counter.\r\n\t\t\t\t\t\tPerform the rendering of strings of characters.\r\n\t\t\t\t\t\tMapping between a logical font name and physical font file.\r\n\t\t\t\t\t\tOwns root of the font dictionnary mapping unicode id and cached character.\r\n\t\r\n\tCharCache class :\tArray of CharCache represent a pool of free and used cached character.\r\n\t\t\t\t\t\tHas information about font object, cached glyph bitmap, rendering offsets.\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tWhen a cache entry is used or created, it is always put at the top of the list.\r\n\t\t\t\t\t\tWhen there are no cache entry available for a new uncached character,\r\n\t\t\t\t\t\tthe most bottom item is reused as new one and old character information are deleted.\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tBasically act as a big MRU of the size of the cache table.\r\n\t\t\t\t\t\t\r\n\t\r\n\tCharDictionnary class :\r\n\t\t\t\t\t\tAllows to create a tree to map unicode id (32 bits) <-> CharCache entry.\r\n\t\t\t\t\t\t- Node of CharDictionnary tree.\r\n\t\t\t\t\t\t- Use a radix based child table (4 bits -> 16 children).\r\n\t\t\t\t\t\t- The last item uses its child index to store an index to CharCache instead of CharDictionnary.\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tAs a unicode is 32 bits, cut in 4 bits slices, the depth for any complete entry is 8 in depth.\r\n\t\r\n\tRendering is optimized using a tricky format :\r\n\t- The bitmap cache for a glyp is using a \"mask table\".\r\n\t  We are cutting the glyph into vertical bands of 32 bits.\r\n\t  And then rely on the mask to perform the rendering : \r\n\t  - No need to test for valid/invalid pixels.\r\n\t  - Early termination test is for free.\r\n\t  \r\n\t- The value for each pixel in the cache is an unsigned 8 bits value.\r\n\t  We convert them into RGB values when performing the rendering to the target surface.\r\n\r\nRelated files:\r\nporting/\r\n\tFontRendering.cpp\r\n\tFontRendering.h\r\n\r\nRelated files :\r\n\tsource/Rendering/\r\n\t\tCKLBRendering.h\r\n\t\tCKLBRenderingManager.cpp\r\n\t\tCKLBSprite3D.cpp\r\n\t\tCKLBSprite3D.h\r\n\t\tCKLBCanvasSprite.cpp\r\n\t\tCKLBCanvasSprite.h\r\n \n"
  },
  {
    "path": "Doc/Modules/SceneGraph.txt",
    "content": "============================== Scene graph ==================================\r\n\r\nThe Scene Graph is used to represent a hierarchy of 2D transformation and color transformation.\r\nThe base class which is a node of the tree is CKLBNode.\r\n\r\nEach node owns a list of render objects to apply the transformations to.\r\nThe rendering order is not linked to the geometry order, basically the hierarchy DOES NOT\r\ndefine the order of rendering. Each render object has its own order.\r\n\r\nSo, it is important to understand that scene graph and rendering are dependant in order :\r\n|<---   Scene graph domain                --->|<--- Rendering Domain                      --->|\r\n [Tree is modified] -> [Tree is recomputed]  ---> [Render is recomputed] -> [Render performed]\r\n\r\n1 - Modification of the tree\r\n\tEach tasks creating node will modify the properties like scaling, color, etc...\r\n\tBecause multiple properties could be changed by many tasks within the same frame we\r\n\tavoid recomputing/updating the tree in place (= each time a modification is made)\r\n\t\r\n\tInstead we store information inside the tree to tell the recomputation process later on\r\n\tthat specific changes have occured.\r\n\t\r\n\t- Mark the node that was change, specific bit exist of each type of change.\r\n\t- Mark the uppers node until the root to signal that children has been changed.\r\n\t\r\n2 - Recomputation of the tree\r\n\tThe recomputation will parse the tree once per frame and recompute the tree information,\r\n\tperform tree transformation on the render object for the rendering phase.\r\n\t\r\n\tBasically the following computation occurs :\r\n\t- Node compute its \"composed\" matrix with its parent matrix and local Matrix :\r\n\t\tComposed          = Parent          * Own Matrix\r\n\t- Same for colors\r\n\t\tComposed Color    = Parent Color    * Own Color\r\n\t- Apply the transformation to the rendering object\r\n\t\tFor each vertices :\r\n\t\t-------------------\r\n\t\tScreen Coordinate = Composed Matrix * Own Coordinate\r\n\t\tScreen Color      = Composed Color  * Own Color\r\n\t\r\n\tNote : Optimization of the tree\r\n\t-------------------------------------\r\n\tBecause of the marking we have made when modifying the tree, we can understand if a sub tree\r\n\thas changed or not, thus we can skip some part of the recomputation, avoid recomputing\r\n\tsome part of the rendering object too.\r\n\t\r\n3 - Root node is owned by CKLBDrawResource singleton, \r\n\taccessible using CKLBDrawResource::getInstance().getRoot()\r\n\r\nTechnical Limitations \r\n----------------------------------------------------------------------------------------------\r\n\r\nSome nodes are linked to system object or feature that can NOT perform any rotation or scaling when displayed.\r\nSo, you must know when to use rotation or scaling.\r\n\r\n- Clipping (uses OpenGLES glScissor)\r\n- Text input box for the OS (depends on each OS implementation)\r\n- Web Browser\r\n- Movie (OS will provide the player and display/overlay)\r\n\r\n\r\nTechnical Note:\r\nA CKLBNode can be linked with a UITask.\r\nIn that case, the UITask and the CKLBNode will point each other.\r\nMoreover, the CKLBNode will be protected from destruction untill the UITask is destroyed.\r\n\r\n##################################\r\n### Sub Classes\r\n\r\n- CKLBSystem\r\n\tCKLBSystem provides static methods to manage the Animation Node List.\r\n\tIt allows to separate the Node System from the rest of the Game Engine.\r\n\t\r\n\tSources : \tsource/SceneGraph/CKLBNode.h\r\n\t\t\t\tsource/Animation/CKLBSystem.cpp\r\n\r\n- CKLBNode\r\n\tCKLBNode is the root class for the Scene Graph.\r\n\tEvery Element of the Scene Graph is a CKLBNode or a derivated class.\r\n\tEach CKLBNode owns a list of render objects to apply the transformations to.\r\n\tThe transformations are defined by matrices also owned by the CKLBNode.\r\n\t\r\n\tA CKLBNode can be linked with a CKLBUITask and in that case, they will point\r\n\teach other. Moreover, the CKLBNode will be protected from destruction untill \r\n\tthe CKLBUITask is destroyed.\r\n\t\r\n\tImportant points about the Scene Graph System :\r\n\t- add/remove do also add/remove to the animation and rendering if associated \r\n\t\tbit or object are set.\r\n\t- add takes in account the fact that upper node of new_ node is visible to perform \r\n\t\tthe modification in animation and rendering.\r\n\t- node destruction also destroy all the sub system and includes render object associated.\r\n\t\r\n\tSources :\tsource/SceneGraph/CKLBNode.h\r\n\t\t\t\tsource/SceneGraph/CKLBNode.cpp\r\n\t\r\n- CKLBUITask\r\n\tAdds an integrated node to the task, the task owns a node connected to the scene graph.\r\n\tThe node also has a pointer to the task.\r\n\tRefer to the CKLBUITask for more details (Doc/Modules/Tasks.txt and Doc/Documentation_Tasks.md).\r\n\t\r\n\tSources : \tsource/Core/CKLBUITask.h\r\n\t\t\t\tsource/Core/CKLBUITask.cpp\r\n\r\n\r\n# Classes inheriting CKLBNode\r\n- CKLBMovieNode\r\n\tCKLBMovieNode is a specilized Node for movie management.\r\n\tIt takes care of the graphic operations that can be processed\r\n\ton a movie asset.\r\n\r\n\tSources :\tsource/UISystem/CKLBMovieNode.h\r\n\t\t\t\tsource/UISystem/CKLBMovieNode.cpp\r\n\r\n- CKLBLabelNode \r\n\tCKLBLabelNode is a text specialized Node for Scene Graph.\r\n\tIt provides methods to modify the apparence of the text label.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBLabelNode.h\r\n\t\t\t\tsource/UISystem/CKLBLabelNode.cpp\r\n\t\t\t\t\r\n- CKLBUITextBox \r\n\tCKLBUITextBox is a UITextBox specialized Node.\r\n\tIt provides methodss to manage a TextBox.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBTextInputNode.h\r\n\t\t\t\tsource/UISystem/CKLBTextInputNode.cpp\r\n\t\t\t\t\r\n- CKLBUISystem \r\n\tCKLBUISystem provides static methods to manage screen area using STouchSurface.\r\n\tIt can be used to create/release touch surfaces and clips.\r\n\r\n\tSources :\tsource/UISystem/CKLBUISystem.h\r\n\t\t\t\tsource/UISystem/CKLBUISystem.cpp\r\n\t\t\t\t\r\n- CKLBUIContainer  \r\n\tCKLBUIContainer allows to regroup sub items and manage them like one.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBUISystem.h\r\n\t\t\t\tsource/UISystem/CKLBUISystem.cpp\r\n\t\t\t\t\r\n- CKLBUISelectable \r\n\tCKLBUISelectable represents a selectable item Node.\r\n\tA STouchSurface is allocated for each CKLBUISelectable and represents the \r\n\tscreen area associated with the object.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBUISystem.h\r\n\t\t\t\tsource/UISystem/CKLBUISystem.cpp\r\n\t\t\t\t\r\n- CKLBUIElement \r\n\tCKLBUIElement is the most basic UI Node as it directly inherits CKLBNode.\r\n\tIt adds Assets and asset management methods to the CKLBNode.\r\n\tA CKLBUIElement supports multiple assets association in order to change\r\n\tthe asset if the CKLBUIElement is enable or not.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBUISystem.h\r\n\t\t\t\tsource/UISystem/CKLBUISystem.cpp\r\n\t\t\t\t\r\n- CKLBUIWebView \r\n\tCKLBUIWebView provides methods to manage a Web Viewer.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBWebViewNode.h\r\n\t\t\t\tsource/UISystem/CKLBWebViewNode.cpp\r\n\t\t\t\t\r\n- CKLBSWFMovie \r\n\tCKLBSWFMovie is a specialized Node for Flash Movies.\r\n\tIt provides basic control methods for a Flash Movie.\r\n\r\n\tSources :\tsource/Animation/CKLBSWFPlayer.h\r\n\t\t\t\tsource/Animation/CKLBSWFPlayer.cpp\r\n\t\t\t\t\r\n- CKLBSplineNode \r\n\tCKLBSplineNode gives the possibility to easily associate a Spline Animation \r\n\twith an UITask.\r\n\t\r\n\tSources :\tsource/Animation/CKLBSplineNode.h\r\n\t\t\t\tsource/Animation/CKLBSplineNode.cpp\r\n\t\t\t\t \r\n- CKLBScoreNode \r\n\tCKLBScoreNode is in charge of animating a Score.\r\n\tFirst, it animates the previous digit.\r\n\tThe is animates the next digt.\r\n\tFinnaly, it animates the node itself.\r\n\r\n\tSources :\tsource/Animation/CKLBScoreNode.h\r\n\t\t\t\tsource/Animation/CKLBScoreNode.cpp\r\n\t\t\t\t\r\n- CKLBNodeVirtualDocument \r\n\tCKLBNodeVirtualDocumentis in charge of the graphic operations\r\n\ton a Virtual Document.\r\n\t\r\n\tSources :\tsource/Animation/CKLBNodeVirtualDocument.h\r\n\t\t\t\tsource/Animation/CKLBNodeVirtualDocument.cpp\r\n\t\t\t\t\r\n- CKLBActivityIndicatorNode \r\n\tUsed by CKLBUIActivityIndicator task, this node create a native OS widget\r\n\tto display that the application is \"busy\" doing some work.\r\n\t\r\n\tSources :\tsource/UISystem/CKLBActivityIndicatorNode.h\r\n\t\t\t\tsource/UISystem/CKLBActivityIndicatorNode.cpp\r\n\r\n##################################\r\n### Other Files involved\r\n\r\nSee also CKLBDrawTask.h, CKLBDrawTask.cpp : \r\n\t- own CKLBDrawResource singleton which owns the root.\r\n\t- Implement global rendering task, including tree update\r\n"
  },
  {
    "path": "Doc/Modules/Scripting.txt",
    "content": "============================== Scripting ==================================\r\n\r\nWe use LUA as scripting language but other languages could be interfaced without much pain.\r\n\r\nThis document is describing HOW Lua is bound to our objects and how to create new objects following\r\nour APIs. This document is NOT describing the LUA APIs that are available in the engine.\r\n\r\nLUA is used in different ways :\r\n\r\n- LUA Libraries\r\n\tWhat we mean here by library is to provide a list of functions.\r\n\tThey are not related with task instances.\r\n\tThey provide APIs for various type of work from opening and reading a file to audio management.\t\r\n\r\n\t# Implementation & extension\r\n\r\n\tsource/LuaLib/ folder contains all the implemented libraries, look at the source as implementation reference.\r\n\r\n\t\tILuaFuncLib.h\t: Provides mecanism to register your function into LUA.\r\n\t\tILuaFuncLib.cpp\r\n\t\t\r\n\t\tCKLBLuaConst.h\t: Provides mecanism to register your constants into LUA.\r\n\t\tCKLBLuaConst.cpp\r\n\t\r\n\tTo create a new library, you need to :\r\n\t- Implement a class derived from ILuaFuncLib implementing addLibrary() function.\r\n\t- Inside your addLibrary function, call addFunction for each function you want to register.\r\n\t- Implement each function from your library with the following signature:\r\n\t\r\n\t\tint MyLibraryClass::myFunctionForLUA(lua_State * L);\r\n\t\r\n\t\tThe input parameter is the parameters received from LUA.\r\n\t\tThe output int is the number of values returned by the function call.\r\n\t\t\r\n\t\tWrap the lua_State* with a CLUAState:\r\n\t\tCLuaState lua(L);\r\n\t\t\r\n\t\tThen use lua.*() functions to get the number of arguments, their type and setup the return value(s).\r\n\t\t\r\n\t- Create a static instance that passes an optionnal constant array as constructor parameter.\r\n\t\r\n\tNOTE :\r\n\tYou may see optionnally code calling a given classID to a CKLBLibRegistrator class.\r\n\tIn this case, it is related to work done on interfacing with other scripting system and is not related to LUA.\r\n\t\r\n\tIMPORTANT NOTE :\r\n\tIf your extension source code is not in the project of the executable but is going to be inside\r\n\ta C++ library for your compiler then you need to register your LUA library using EngineStdReference.cpp\r\n\tIt will force to reference the code and linker will include the code, else you may endup with your code not being\r\n\tincluded inside the final exe.\r\n\r\n\t\tSee EngineLuaFuncReference() implementation.\r\n\t\r\n- Task command implementation & extension\t\r\n\t\r\n\tSee also Doc/Modules/Tasks.txt for more details about task inheritance.\r\n\t\r\n\tInside the tasks system, there is support for implementing commands that can be executed from LUA.\r\n\tCommands ARE equivalent to function call from LUA to C++, except that they all use a common pattern.\r\n\t\r\n\tFrom LUA language it is always the same function which is called :\r\n\tsyscommand(taskObject, COMMAND_ID, ...parameters...)\r\n\t\r\n\tThe list of supported commands is registered to the CKLBTaskFactory template with your task class.\r\n\r\n\tInside your task implementation MyTaskClass.cpp, you will have something like that :\r\n\r\n\t// Optionnal constant, just for sake of clean code.\r\n\tenum {\r\n\t\tCPP_CONSTANT\t= 0,\r\n\t\t...\r\n\t\t...\r\n\t};\r\n\t\r\n\t// Constant table of commands to pass to the factory when registering your task.\r\n\tstatic IFactory::DEFCMD cmd[] = {\r\n\t\t{\"COMMAND_CONSTANT\",\t\t\tCPP_CONSTANT\t\t},\r\n\t\t...\r\n\t\t...\r\n\t\t...\r\n\t\t{0, 0}\r\n\t};\r\n\t// Registration to the factory using template.\r\n\tstatic CKLBTaskFactory<MyTASKClass> factory(\"ClassNameInLUA\", UNIQUE_CLASS_ID, commands);\r\n\r\n\t... MyTASKClass implementation here ...\r\n\r\n\t// Implementation of LUA callback to decode argument and execute command.\t\r\n\tint\r\n\tmyTaskClass::commandScript(CLuaState& lua)\t\t\t\t\t// In case MyTaskClass is NOT a CKLBUITask subclass. \r\n\tmyTaskClass::commandUI(CLuaState& lua, int argc, int cmd)\t// In case MyTaskClass IS a CKLBUITask subclass. \r\n\t{\r\n\t\tswitch(cmd)\r\n\t\t{\r\n\t\tcase CPP_CONSTANT:\r\n\t\t\t... Implement your command here...\r\n\t\tbreak;\r\n\t\t...\r\n\t\t...\r\n\t\t}\r\n\t\t\r\n\t\treturn luaReturnArgumentCount;\r\n\t}\r\n\t\r\n\tNOTE : it is possible to return MULTIPLE arguments in LUA, as an example a get point coordinate could return X and Y.\r\n\r\n\tSee CLuaState.h for all the get* function to retrieve data from the LUA stack.\r\n\tSee CLuaState.h for all the ret* function to return data to LUA.\r\n\t\r\n\t=> See implementation of UI tasks as an example.\r\n\t\r\n- Task constructor from LUA\r\n\r\n\tImplement the virtual function initUI if you are creating a CKLBUITask subclass.\r\n\tImplement the virtual function initScript if you are creating a CKLBLuaTask or CKLBLuaPropTask subclass.\r\n\t\r\n\tbool myTaskClass::initUI(CLuaState& lua) {\r\n\t\t// Read the parameter, create internal objects, return true if successfull.\r\n\t}\r\n\t\r\n\t=> See implementation of UI tasks as an example.\r\n\r\n- Task properties implementation & extension\r\n\r\n\tAll classes derived from CKLBLuaPropTask can support having properties accessible for reading and writing\r\n\tfrom LUA.\r\n\t\r\n\tFor historical reason and bad design, the first implementation of CKLBLuaPropTask property mecanism was wasting memory\r\n\tand consuming more CPU at initialize. Moreover, it was less compatible with standard getter/setter that could\r\n\tbe used when mapping another script language.\r\n\t\r\n\tBecause most classes were already written with this scheme in place and we were afraid of having too much regression\r\n\ton already working code in production, we choosed to use have a second property accessing scheme in parrallel,\r\n\tand the scheme would be selected at runtime and not compile time.\r\n\tThis way more work was needed, but we could migrate task one by one from the old property scheme to the new one\r\n\twithout having to worry about impacting already working code.\r\n\r\n\tThe distinction can be done easily :\r\n\tinside CKLBLuaPropTask.h there are two structures,\r\n\t- PROP\t\t: Struct used by old scheme.\r\n\t- PROP_V2\t: Struct used by new scheme.\r\n\r\n\tWhen a class support the new scheme, IT MUST have the following code inside the C++ constructor:\r\n\t\r\n\t\tm_newScriptModel = true;\r\n\t\r\n\tThen during the init, call to CKLBLuaPropTask::setupPropertyList will use the given parameters differently.\r\n\tBy doing a \"dirty cast\", we keep the old API structure as it was, even if internals behave differently.\r\n\t\r\n\tIt is recommended to use the new scheme.\r\n\t\t\r\n\tPlease take a look at the implementation of various getter/setters for implementation detail.\r\n\t\r\n- Garbage collection in LUA.\r\n\t\r\n\tEach time the script is executed within the script phase, there is also an evaluation of a threshold\r\n\tto start a garbage collection within LUA.\r\n\t\r\n\tSee implementation of void CKLBLuaEnv::execScript(int) function.\r\n\t\r\n- Callback from C++ to LUA.\r\n\t\r\n\tIn order to be Scripting Language Independant, the Engine does not directly call LUA function.\r\n\tIndeed, callbacks signatures are first defined in CKLBScriptEnv.h\r\n\tThen, the implementation defiers regarding the Scripting Language used.\r\n\tThese methods takes the following parameters :\r\n\t- the name of the function to call back\r\n\t- a pointer to a CKLBObjectScriptable\r\n\t- additional parameters to send back to the scripting language\r\n\tBoth the name or the object pointer can be used to locate the callback to call depending on \r\n\tthe scripting language.\r\n\t\r\n\tFor LUA, the function name is used to identify the function to call back.\r\n\tThe methods implemented redirect the call to a LUA specific method with the following parameters : \r\n\t- the name of the callback function\r\n\t- a String corresponding to the callback signature (matching the next arguments)\r\n\t\tThe following types are supported and linked with the following letter\r\n\t\t- B : Byte\r\n\t\t- I : Integer\r\n\t\t- N : numeric (double)\r\n\t\t- S : String\r\n\t\t- P : Pointer\r\n\t\t- G : Global \r\n\t\tFor example if a callback must return 2 integers to LUA, the signature will be \"II\".\r\n\t- Additional parameters to send back to LUA\r\n\t\r\n\tThe signature String is then analysed and arguments are pushed on the LUA stack before calling the final \r\n\tLUA function through its name.\r\n\t\r\n\tInvolved Files :\r\n\t\tsource/Core/CKLBScriptEnv.h\t\t\t\t\t: Defines the callbacks signatures (Scripting Language Independant).\r\n\t\tsource/Scripting/CKLBScriptEnv_forLUA.cpp\t: Implements the callbacks for LUA Scripting\r\n\t\r\n\t\r\n- About LUA Script Loading\r\n\r\n\tUsing the \"sysLoad\" command, it is possible to switch from a LUA file to another LUA file.\r\n\t\r\n\tEach time we load a new LUA file, our library will try to call the following functions :\r\n\t\r\n\tsetup() function\t: When the LUA file loading is complete AT THE BEGINNING OF THE NEXT FRAME after \"sysLoad\".\r\n\texecute() function\t: Executed each frame from the NEXT FRAME after \"sysLoad\"\r\n\tleave() function\t: Executed directly when \"sysLoad\" load another file.\r\n\t\r\n\tBasically, the current LUA file executing \"sysLoad\" will have its leave() function executed right away.\r\n\tThen the file is loaded at the beginning of the NEXT frame, setup() is executed. Then execute() for each frame.\r\n\t\r\nCore Related Files:\r\n\tsource/LuaLib/\r\n\t\tILuaFuncLib.h\t\t: Registration of libraries and functions.\r\n\t\tILuaFuncLib.cpp\r\n\t\tCKLBLuaConst.h\t\t: Registration of constant into LUA scripting world.\r\n\t\tCKLBLuaConst.cpp\r\n\tsource/core/\r\n\t\tCLuaState.h\t\t\t: Wrapper to access the stack, data type and push back return values.\r\n\t\tCLuaState.cpp\r\n\t\t\r\n\t\tCKLBLuaEnv.h\t\t: Execution context of the scripting system (singleton)\r\n\t\tCKLBLuaEnv.cpp\r\n\t\t\r\n\t\tCKLBLuaScript.h\t\t: Task executing the script.\r\n\t\tCKLBLuaScript.cpp\r\n\t\t\r\n\t\tCKLBLuaTask.h\t\t: Support of task accessible from LUA (commands & properties)\r\n\t\tCKLBLuaTask.cpp\r\n\t\tCKLBLuaPropTask.h\r\n\t\tCKLBLuaPropTask.cpp\r\n"
  },
  {
    "path": "Doc/Modules/Tasks.txt",
    "content": "============================== Task System ==================================\r\n\r\nThe only thing executed each frame by the engine is the task manager.\r\nAnything that must be executed by the CPU each frame must register a task to the task manager.\r\n\r\nThe task manager works the following way :\r\n- There are what is called PHASES. It defines the order of execution.\r\n\t(See TASK_PHASE inside CKLBTask.h)\r\n\t\r\n- There are tasks that are registered to a given phase.\r\n\tNote that a task instance can only be registered to one and only one phase at a given time.\r\n\t\r\n- Order of execution INSIDE a phase are not guaranteed.\r\n\t-> We guarantee that a phase is executed before another, but not the task order within a phase.\r\n\t\r\n- Tasks can have parent/child relationship.\r\n\tWhen a task is destroyed, all the subtree is destroyed at the same time.\r\n\r\n- When killing a task, the task is NOT destroyed immediatly but at the end of the current frame execution ;\r\n\tthat means after all the phases have been executed for this frame.\r\n\tIt helps to guarantee that pointers are not becoming unavailable if tasks have pointers on other tasks and\r\n\tguarantee the integrity of all tasks for a given frame.\r\n\t\r\n\r\nClass Groups:\r\n\r\nEvent if all Tasks inherits the root class CKLBTask (see \"Classes\" in this document for more details),\r\nthere are splitted in 2 groups : System Tasks and User Tasks.\r\n- System Tasks are tasks created when launching the game and not controlled by the programmer.\r\n- User Tasks are tasks the programmer can instanciate through LUA (or another scripting language).\r\n\tThey all inherits from CKLBLuaTask previously described.\r\n\tUser Tasks can also be splitted in 2 groups : \r\n\t\t- User UI Tasks (all UI related tasks).\r\n\t\t- User Other Tasks (download, unzip, network, etc).\r\n\t\r\n\tFor more details about specific Tasks of any group refer to Doc/Documentation_Tasks.md\r\n\r\n\r\nTasks may not need to be executed every single frame, for instance if a progress bar had not moved from the previous frame,\r\nrecompute it and redraw it would be a loss of cpu usage.\r\nThat is why, in an optimization purpose, tasks can enter a Sleep state by themselves (meaning not like a Pause from the script).\r\n\r\nA flag system has been deployed, using a 1 byte member and macros.\r\nBy default, a task is ALWAYS_ACTIVE. (0x80)\r\nIf you want a sub task to be not always active, you have to call setNotAlwaysActive() in the subclass constructor,\r\nthis will desactivate the flag at 0x80. We strongly suggest to use this only in the constructor to differenciate\r\ntasks who can sleep and those which ALWAYS need to execute at each frame.\r\n\r\nThen, for tasks which can sleep, we have different flags.\r\nThose flag are generic in the way that the programmer can decide to use them for any purpose.\r\n\r\n5 flags macros are available for a Task activity (from A to E). If one of them is Up, the task is considered as active and\r\nexecute function will be called as long as the flag is not reset.\r\n\r\n- Flag A (0x01)\t: REFRESH_A, CHANGE_A, RESET_A macros\r\n- Flab B (0x02)\t: REFRESH_B, CHANGE_B, RESET_B macros\r\n- Flag C (0x04)\t: REFRESH_C, CHANGE_C, RESET_C macros\r\n- Flag D (0x08)\t: REFRESH_D, CHANGE_D, RESET_D macros\r\n- Flag E (0x10)\t: REFRESH_E, CHANGE_E, RESET_E macros\r\n\r\nREFRESH_x will SET the flag to 1.\r\nCHANGE_x will return if the flag is set or not. So programmer can do something like : if (CHANGE_x) { ... }\r\nRESET_x will RESET the flag to 0.\r\n\r\nMost of the common case is to set a flag when a property is changed, and then perform the real update only once\r\nper frame. To different what kind of update has been made to the object, the programmer can use freely those flags.\r\n\r\nWhen the TaskManager process the Tasks List and execute every one of them, it first tests if the task is indeed \r\nactive or not. If not, the call to the execute method is not done.\r\nA task is active either if it is \"Alaways Active\" or if one of the 5 flags is up.\r\n\r\n\r\nIMPORTANT: === Only needed if modifying the library instead of using the main project ===\r\nIf you want to add/remove task from the library project (inside Win32 project), \r\nit is important to modify EngineStdReference.cpp\r\nThe reason for this file to exist is that when compiling all the tasks inside a library, each\r\ntask creates a singleton template factory. But because nobody is referencing directly the singleton\r\noutside of the library, thus the linker does not incluse the singleton and the factory is not available at runtime.\r\n(Worked without this system when the project was inside a single project)\r\n\r\nSo you need to modify EngineStdReference.h with :\r\n- #include your header \r\n- go inside the EngineTaskReference() function and then add/remove the call to the task.\r\n\r\nNote about destruction of task owning nodes (UITask) :\r\n\r\nTask using node in the scene graph will need delete the node they created.\r\nIf the node is connected to the scene graph when the task dies, it is automatically destroyed due to connection\r\nwith the task \"local root\" node.\r\n\r\nNow, if a node belonging to a task B is connected to a node from task A, when task A dies, the node belonging to task B is NOT destroyed.\r\n\r\nHere is the schematic:\r\n---------------------------------\r\nTask A with Node A'\r\n\tNode A2'\r\n\t\tTask B with node B'\r\n\t\t\tNode B2'\r\n\tNode A3'\r\n---------------------------------\r\n\r\nNormally a tree should delete all the node by recursion on destruction,\r\nbut as the node belong to another task, we avoid the destruction of those sub node (B' and B2') when killing taks A.\r\nOnly node A',A2',A3' are going to be automatically deleted.\r\n\r\nBecause task B does NOT know that task A has been destroyed in the scene graph and we do not want task B to delete the\r\nnode B' and B2' a second time ! So when A dies, it has NO RIGHTS to destroy a node belonging to another task.\r\n\r\nJust remember that Task parent (relation between task) and scene graph relation (task parent inside a form) are not related.\r\nA given task B inside another task A inside the scene graph could have task B as child of task A in term of execution.\r\n\r\nClasses:\r\n\tCKLBTaskMgr (Singleton)\r\n\t\tPerforms the execution of each phase.\r\n\t\tProvides management for tasks.\r\n\t\t\r\n\tCKLBTask\r\n\t\tBasic task class, provides mecanisms for init/die/execute, phase ownership, name.\r\n\t\tRefer to Doc/Modules/Scripting.txt for more details about scripting tasks.\r\n\t\t\r\n\t\tCKLBLuaTask : \r\n\t\tAdds feature to have command executable from LUA.\r\n\t\t\t\r\n\t\t\tCKLBLuaPropTask : \r\n\t\t\tAdds properties accessible from LUA.\r\n\t\t\t\t\r\n\t\t\t\tCKLBUITask : \r\n\t\t\t\tAdds an integrated node to the task, the task owns a node connected to the scene graph.\r\n\t\t\t\tThe node also has a pointer to the task.\r\n\r\n=============================================================================\r\nHow To Add A New Task ?\r\n\r\nIf you want to add new tasks to the Game Engine, please follow these instructions.\r\nWe will consider that your new task is name MyNewTask.\r\n\r\n- Make MyNewTask inherits CKLBTask or a subclass of CKLBTask.\r\n- In include/BaseType.h add a new define :\r\n\t#define CLS_MYNEWTASK (XXX | CLS_KLBUSERTASK | ...)\r\n\trefer to the defines at the beginning of the file.\r\n- Add CKLBTaskFactory<MyNewTask> as a friend class.\r\n- In the cpp file, add \r\n\tstatic CKLBTaskFactory<MyNewTask> factory(\"MyNewTask\", CLS_MYNEWTASK);\r\n- Add the following methods :\r\n\t- static MyNewTask* create(...) : tries to allocate the task and call init(...).\r\n\t- bool init(...) : ends with a call to CKLBTask::regist(parent, phase) to add this task \r\n\t\tto a specific phase of the Game Engine.\r\n\r\n- Override the following methods :\r\n\t- u32 getClassID()\t: must return CLS_MYNEWTASK.\r\n\t- void execute(u32 deltaT) : contains the execution instructions.\r\n\r\n- You may add setNotAlwaysActive() in the contructor for optimization purpose.\r\n\tRefer to Doc/Documentation_Tasks.md for more details about tasks execution.\r\n\r\nFor more details about LuaTask and derived classes implementation, refer to Doc/Modules/Scripting.txt\r\n\t\r\nIf it is a LuaPropTask\r\n- In the constructor, add :\r\n\tm_newScriptModel = true;\r\n- Add properties :\r\n\t- .h \t: \r\n\t\tstatic\tPROP_V2\t\tms_propItems[];\r\n\t- .cpp \t: \r\n\t\tCKLBLuaPropTask::PROP_V2 MyNewTask::ms_propItems[] = {\r\n\t\t\t{\t\"prop1\",\tUINTEGER,\t(setBoolT)&MyNewTask::setProp1,\t(getBoolT)&MyNewTask::getOrder,\t0 },\r\n\t\t\t{\t\"prop2\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t(getBoolT)&MyNewTask::getAsset,\t0 },\r\n\t\t\t...\r\n\t\t};\r\n\t\r\nIf it is a CKLBUITask\r\n\r\n- .cpp\r\n\tDon't forget to add the CKLBUITask properties to your Task ones, with the macro UI_BASE_PROP.\r\n\tCKLBLuaPropTask::PROP_V2 MyNewTask::ms_propItems[] = {\r\n\t\t\tUI_BASE_PROP,\r\n\t\t\t{\t\"prop1\",\tUINTEGER,\t(setBoolT)&MyNewTask::setProp1,\t(getBoolT)&MyNewTask::getOrder,\t0 },\r\n\t\t\t{\t\"prop2\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t(getBoolT)&MyNewTask::getAsset,\t0 },\r\n\t\t\t...\r\n\t\t};\r\n\t\t\r\n\t- Override the following methods \r\n\t\t- initCore \t: initializes the members.\r\n\t\t- initUI\t: initializes the script values.\r\n\t\r\n\tIf you want to add commands accessible from the Script, override the commandUI method.\r\n\r\nFor more details, please refer to a simple task implementation such as source/UISystem/CKLBUISimpleItem.h\r\n\r\n=============================================================================\r\n\r\nRelated Files:\r\nsource/core/\r\n\tCKLBTask.h\r\n\tCKLBTask.cpp\r\n\tCKLBLuaTask.h\r\n\tCKLBLuaTask.cpp\r\n\tCKLBLuaPropTask.h\r\n\tCKLBLuaPropTask.cpp\r\n\tCKLBUITask.h\r\n\tCKLBUITask.cpp\r\n"
  },
  {
    "path": "Doc/Project.md",
    "content": "﻿What's this Playground project?\r\n===============================\r\n\r\nIntroduction\r\n------------\r\n\r\nBy comparing various platforms and solutions, the following points come to mind :\r\n\r\n- How much does it cost ? License model ?\r\n- What is the technology behind it ?\r\n- How much control do we have over it ?\r\n- On how many platform does it work ?\r\n- Can it do easily our specific task ?\r\n\r\nEtc...\r\n\r\nWe decided that we could write a small core at first and get some functions easily\r\nthat the other solutions do not provide (ie basic flash player, rendering optimized for 2D, etc...)\r\n\r\n\r\nConcept\r\n-------\r\n\r\n- Multiplatform, 2D only support, scriptable, customizable game engine.\r\n- Support for debugging at low level (resource and memory leak detection made easy).\r\n- Provide from start feature like primitive flash player.\r\n- Can implement game logic in LUA but also in C++ and create custom task. \r\n\r\nThe goal is to use LUA as much as possible for game level logic, C++ for game specific parts/systems.\r\n\r\nHistory\r\n-------\r\n\r\nThe project was started for 3 months with 3 people and we ended up having a robust base :\r\n\r\n- Rendering system with batching was in place.\r\n- Task system was in place\r\n- Logging, memory leak tracking was in place with appropriate tools.\r\n- Basic flash player to help with animation was in place.\r\n\r\nAfter that, game development grew and we mostly spent time to add new features, new tasks to the system,\r\nfix bugs, improve multiplatform support, tool extension, etc...\r\n\r\nHow to run\r\n----------\r\n\r\nSee How_to_run.md\r\n\r\nDocuments about architecture and C++\r\n------------------------------------\r\n\r\nWe try to gather all the documentation inside the Docs folder.\r\nThose documents are related to implementation details and architecture of the engine at C++ level mainly,\r\nnot much user friendly to write LUA script for creating a game.\r\n\r\n### Documentation_Libraries.md\r\n\r\nThis document is about all the open source libraries we have been using.\r\nIn some cases, the library have been modified to fit our purpose, so we needed to document it.\r\nThe other purpose is also to show that there are no license issue with the engine.\r\n\r\n### Documentation_Modules.md\r\n\r\nThis document is about all the different \"systems\" or features inside the engine.\r\n- Some are clean in the way that they are working around a singleton, and a bunch of instance with various subclasses,\r\nindependantly from other parts.\r\n- Some features needed to modify source code in multiple places. (ie Encryption)\r\nBasically the sum of the modules IS the engine itself.\r\n\r\nSee also /Modules/ directory with all modules specific information.\r\n\r\n### Document_Tasks.txt\r\n\r\nThis document list the tasks that are implemented inside the engine.\r\nSome are system tasks that the programmer is never aware of, some are system tasks that programmer can control.\r\nSome are freely instanciable and here for the programmer to be manipulated.\r\n\r\n### Documents about function and feature available from LUA\r\nDoc/DocLUA_HTML.zip contains the list of functions, constants and command available\r\nthrough LUA to create application using scripting.\r\n\r\nSamples and Tutorials\r\n---------------------\r\n\r\nWhile it may not be a tutorial in the strict sense of the term, because there are not much step by step explaination,\r\nwe have also a tutorial-like showing LUA code testing different features of the engine.\r\n\r\nSee ```Tutorial/``` directory.\r\n\r\nPrototype with C# Instead of LUA\r\n---------------------------------\r\nWe also provide a version of the engine using C# instead of LUA as a scripting language.\r\nThe engine works with Mono, but also works with a custom compiler able to convert C# into C++.\r\n\r\nSee Doc/Documentation_CSharp.md\r\n\t\r\nPLEASE UNDERSTAND THAT IT IS A PROTOTYPE and has not be completed to be in production, still\r\nwe believe that the amount of work put into this part of the project made it quite close to reality.\r\n\r\nImplementation\r\n--------------\r\n\r\nHere is a representation of the important folders of the project :\r\n\r\n- Engine \r\n  - fonts\r\n\r\n      Contains the fonts used in the Engine.\r\n\r\n  - include\r\n\r\n      Contains some header files.\r\n\r\n    - libs\r\n\r\n        Contains the several libraries used in the Engine.\r\n\r\n    - porting\r\n\r\n        Contains the files related to the porting of the Engine on several platforms.\r\n\r\n      - Android\r\n\r\n          For Android\r\n\r\n      - iOS\r\n\r\n          For iOS\r\n\r\n      - Win32\r\n\r\n        For Windows\r\n\r\n    - source\r\n\r\n       Contains the source files.\r\n\r\n  - SampleProject\r\n\r\n      Sample project C++ base and C# prototype related implementation.\r\n\r\n  - Tools\r\n\r\n      Tool use for the games.(Toboggan)\r\n\r\n  - CSharpVersion\r\n\r\n      Everything related to the C# prototype\r\n\r\n  - Tutorial\r\n\r\n      List of tutorial to show LUA scripting and available APIs\r\n\r\n#### Where are the project files ?\r\n\r\n- Windows\r\n\r\n  Engine/porting/Win32/GameLibraryWin32.sln\r\n\r\n- Android\r\n\r\n  Engine/porting/Android/\r\n\r\n- iOS\r\n\r\n  Engine/porting/iOS/Project/SampleProject/SampleProject.xcodeproj\r\n\r\nModify things\r\n-------------\r\n\r\n### Add new tasks.\r\n\r\n  See \"How To Add A New Task ?\" in Doc/Modules/Tasks.txt\r\n\r\n### Add new asset type.\r\n\r\n  See \"How To Add A New Asset Type ?\" in Doc/Modules/Assets.txt\r\n\r\nRoad Map\r\n--------\r\n\r\n### Two main systems\r\n\r\n- Font rendering based on texture-charmap support would be a big plus.\r\n\r\nFor now we render directly the text into a surface, each label cost memory.\r\nWe could trade-off those by having dynamically managed textures using only char cached instead of complete text.\r\nThis should result in less memory pressure on the textures but more vertex to process.\r\n\r\n- Particle Effect System.\r\nA particle system is necessary, Flash player is may be good enough for static animation,\r\nbut it lacks the fluidity,randomness and smoothness that a particle system can bring to games.\r\n\r\nPost Mortem : What has been done correctly\r\n-------------------------------------------\r\n\r\n- Tasks system and basic architecture are modular enough.\r\n- Binding to scripting language.\r\n- Ability to import animation from a system like Flash.\r\n\r\nPost Mortem : What could have been better\r\n-----------------------------------------\r\n\r\n- Scripting, APIs to be more user friendly.\r\n- Sometime discrepancies between features, \"holes\" in API features.\r\n- Current behavior not like originally planned after many iterations and user feedback.\r\nResult in sometime idiotic/illogic behavior to fix an issue that should not have occured in the first place by design.\r\n\r\n### Many of those issues resulted for various causes\r\n\r\n- Difference in skills, understanding the necessity for architecture cleanness between the different developpers.\r\n- Engine feature done/added/modified on a \"for yesterday\" basis.\r\n- Political compromise over technical rightness.\r\n- Different priorities.\r\n"
  },
  {
    "path": "Doc/Toboggan/README.md",
    "content": "Toboggan Manual\n===============\n\n**Japanese only.**\n\nToboggan is in ```Tools``` directory.\n"
  },
  {
    "path": "Engine/include/BaseType.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Common type, inside porting layer ===\r\n//\r\n\r\n#ifndef __KLB_BASE_TYPE__\r\n#define __KLB_BASE_TYPE__\r\n\r\n#ifdef _WIN32\r\n#pragma warning(disable:4996)\r\n#endif\r\n\r\n//\r\n// Base type definition.\r\n//\r\ntypedef unsigned int\tu32;\r\ntypedef int\t\t\t\ts32;\r\ntypedef unsigned short\tu16;\r\ntypedef short\t\t\ts16;\r\ntypedef unsigned char\tu8;\r\ntypedef char\t\t\ts8;\r\ntypedef u16\t\t\t\tunichar;\r\ntypedef long long int\ts64;\r\ntypedef long long unsigned int u64;\r\n\r\n#ifndef NULL\r\n\t#define\tNULL\t\t\t(0)\r\n#endif\r\n\r\n#define NULL_IDX\t\t\t(0xFFFF)\r\n\r\n// TODO RP : Move the lower definition to an internal .h file.\r\n//\r\n// Class ID.\r\n//\r\n\r\n// Special Array wrapper class\r\n#define CLS_KLBARRAY\t\t\t(0x80000000)\r\n// Native array\r\n#define CLS_ARRAYOF\t\t\t\t(0x40000000)\r\n#define CLS_PUBLIC\t\t\t\t(0x20000000)\r\n#define CLS_PRIVATEPROTECTED\t(0x10000000)\r\n#define CLS_READONLY\t\t\t(0x08000000)\r\n\r\n//\r\n// Group bit.\r\n//\r\n#define CLS_BASETYPE\t\t\t(0x00000000)\r\n#define CLS_KLBENGINECLASS\t\t(0x00010000)\r\n#define CLS_KLBASSETCLASS\t\t(0x00020000)\r\n#define CLS_KLBUICORECLASS\t\t(0x00040000)\r\n#define CLS_KLBUSERTASK\t\t\t(0x00080000)\r\n#define CLS_USERCUSTOM\t\t\t(0x00100000)\r\n#define CLS_USERCUSTOMTASK\t\t(CLS_USERCUSTOM | CLS_KLBUSERTASK)\r\n#define CLS_NONVISUALTASK\t\t(0x00200000)\r\n\r\n// 4,8\r\n#define CLS_UNIQUEID\t\t\t(0x000FFFFF)\r\n\r\n//\r\n// Base Type\r\n//\r\n#define CLS_U32\t\t\t\t(1 | CLS_BASETYPE)\r\n#define CLS_S32\t\t\t\t(2 | CLS_BASETYPE)\r\n#define CLS_U16\t\t\t\t(3 | CLS_BASETYPE)\r\n#define CLS_S16\t\t\t\t(4 | CLS_BASETYPE)\r\n#define CLS_U8\t\t\t\t(5 | CLS_BASETYPE)\r\n#define CLS_S8\t\t\t\t(6 | CLS_BASETYPE)\r\n#define CLS_BOOL\t\t\t(9 | CLS_BASETYPE)\r\n#define CLS_FLOAT\t\t\t(7 | CLS_BASETYPE)\r\n#define CLS_PTR\t\t\t\t(8 | CLS_BASETYPE)\r\n#define CLS_CSTRING\t\t\t(10| CLS_BASETYPE)\r\n#define CLS_COLOR\t\t\t(11| CLS_BASETYPE)\r\n\r\n//\r\n// Engine\r\n//\r\n#define CLS_KLBOBJECT\t\t(1 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBNODE\t\t\t(2 | CLS_KLBENGINECLASS)\r\n// Node based\r\n\r\n#define CLS_KLBUIELEMENT\t(3 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n#define CLS_KLBUISELECTABLE\t(4 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n#define CLS_KLBUICONTAINER\t(5 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n\r\n#define CLS_GAMEUNIT\t\t(6 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBSWFMOVIE\t\t(7 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBSPLINENODE\t(8 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBNODEMAP\t\t(9 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBSCORENODE\t(10| CLS_KLBENGINECLASS)\r\n\r\n#define CLS_KLBTASKTOUCHPAD\t(12| CLS_KLBENGINECLASS | CLS_NONVISUALTASK)\r\n#define CLS_KLBTASKSCRIPT\t(13| CLS_KLBENGINECLASS | CLS_NONVISUALTASK)\r\n#define CLS_KLBTASKDRAW\t\t(14| CLS_KLBENGINECLASS | CLS_NONVISUALTASK)\r\n#define CLS_KLBTASKGENERIC\t(15| CLS_KLBUSERTASK    | CLS_NONVISUALTASK)\r\n#define CLS_KLBLUAPROPTASK  (16| CLS_KLBENGINECLASS)\r\n#define CLS_KLBTASKUIEVENT\t(17| CLS_KLBENGINECLASS)\r\n#define CLS_KLBTASKOSCTRLEVENT (18|CLS_KLBENGINECLASS)\r\n\r\n// UITasks based\r\n#define CLS_KLBUIPROGRESS\t(20| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISCORE\t\t(21| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIVIRTUALDOC\t(22| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBCELLANIMNODE\t(23| CLS_KLBENGINECLASS)\r\n\r\n// UITasks based\r\n#define CLS_KLBUICELLANIM   (24| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISWFPLAYER  (25| CLS_KLBUSERTASK)\r\n#define CLS_KLBUITOUCHPAD   (26| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIMAPTASK\t(27| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIFORM\t\t(28| CLS_KLBUSERTASK)\r\n\r\n// Node based\r\n#define CLS_KLBTEXTEDIT\t\t(29| CLS_KLBENGINECLASS)\r\n#define CLS_KLBWEBVIEW\t\t(30| CLS_KLBENGINECLASS)\r\n#define CLS_GAMEUNITBASE\t(31| CLS_KLBENGINECLASS)\r\n#define CLS_KLBLABEL\t\t(32| CLS_KLBENGINECLASS)\r\n\r\n// UITasks based\r\n#define CLB_KLBUISCROLLBAR\t(33| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBMOVIENODE\t\t(34| CLS_KLBENGINECLASS)\r\n#define CLS_KLBINTERVALTIMER\t(35| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBUICANVAS\t\t\t(36| CLS_KLBUSERTASK)\r\n#define CLS_KLBUICONTROL\t\t(37| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIDBGLABEL\t\t(38| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIDRAGICON\t\t(39| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIFREEVERTITEM\t(40| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIGROUP\t\t\t(41| CLS_KLBUSERTASK)\r\n#define CLS_KLBUILABEL\t\t\t(42| CLS_KLBUSERTASK)\r\n#define CLS_KLBUILIST\t\t\t(43| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIMOVIEPLAYER\t(44| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIMULTIIMGITEM\t(45| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIPIECHART\t\t(46| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIPOLYLINE\t\t(47| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIRUBBERBAND\t\t(48| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISCALE9\t\t\t(49| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISIMPLEITEM\t\t(50| CLS_KLBUSERTASK)\r\n#define CLS_KLBUITEXTINPUT\t\t(51| CLS_KLBUSERTASK)\r\n\r\n// export objects\r\n#define CLS_KLBBINARRAY     (52| CLS_KLBENGINECLASS)\r\n#define CLS_KLBLUADB        (53| CLS_KLBENGINECLASS)\r\n#define CLS_KLBDATASET      (54| CLS_KLBENGINECLASS)\r\n#define CLS_KLBNODEVIRTUALDOC\t(55 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n#define CLS_KLBFONTOBJ\t\t(56| CLS_KLBENGINECLASS)\r\n#define CLS_KLBSOUNDOBJ\t\t(57| CLS_KLBENGINECLASS)\r\n#define CLS_KLBMATRIXOBJ\t(58| CLS_KLBENGINECLASS)\r\n#define CLS_KLBVECTOROBJ\t(59| CLS_KLBENGINECLASS)\r\n\r\n#define CLS_KLBUNITTASK\t\t(60| CLS_KLBUSERTASK)\r\n#define CLS_KLBMAPGROUP\t\t(61| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBSTORESERVICE\t(62| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBNETAPI\t\t(63| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBPAUSECTRL\t(64| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBLIFECTRL\t\t(65| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBAIDRIVERTASK\t(67| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBWORDLTASK\t(68| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBUIWEBVIEW\t(69| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBAPPPROP\t\t(70| CLS_KLBENGINECLASS)\r\n\r\n#define CLS_KLBACTIVITYINDICATORNODE    (71| CLS_KLBENGINECLASS)    // CKLBActivityIndicatorNode\r\n#define CLS_KLBUIACTIVITYINDICATOR      (72| CLS_KLBUSERTASK)    // CKLBUIActivityIndicator\r\n\r\n#define CLS_KLBUIVARIABLEITEM\t\t\t(73| CLS_KLBUSERTASK)\r\n#define CLS_KLBUICLIP\t\t\t\t\t(74| CLS_KLBUSERTASK)\r\n#define CLS_KLBAPPUPDATE\t\t\t\t(75| CLS_KLBENGINECLASS)\r\n#define CLS_KLBASYNCLOADER\t\t\t\t(76| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBGCTASK\t\t\t\t\t(77| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBAPPUPDATEZIP\t\t\t\t(78| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBASYNCFILECOPY\t\t\t(79| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n\r\n#define CLS_KLBUIBUTTON\t\t(80| CLS_KLBUSERTASK)\r\n#define CLS_KLBPACKERCTRL\t(81| CLS_KLBENGINECLASS)\r\n\r\n//\r\n// Engine Assets\r\n//\r\n#define CLS_ASSETBASE\t\t(0 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETTEXTURE\t(1 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETIMAGE\t\t(2 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETAUDIO\t\t(3 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETFLASH\t\t(4 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETANIMSPLINE\t(5 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETMAP\t\t(6 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETCELLANIM\t(7 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETCOMPOSITE\t(8 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETNODEANIM\t(9 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETAI\t\t\t(10| CLS_KLBASSETCLASS)\r\n\r\n\r\n#ifdef DEBUG_MEMORY\r\n\r\n\t// #define INTERNAL_MEMORY_STARVING\r\n\r\n\t#include \"DebugAlloc.h\"\r\n\t#include \"DebugTracker.h\"\r\n\t\r\n\t#define KLBNEW(a)\t\t\t\t(a*)CTracker::logNew(new a(),sizeof(a),__LINE__,__FILE__)\r\n\t#define KLBNEWA(a,b)\t\t\t(a*)CTracker::logNew(new a[(b)],sizeof(a)*(b),__LINE__,__FILE__)\r\n\t#define KLBNEWC(a,b)\t\t\t(a*)CTracker::logNew(new a b,sizeof(a), __LINE__,__FILE__)\r\n\t#define KLBMALLOC(a)\t\t\tCTracker::logNew(malloc(a),(a),__LINE__,__FILE__)\r\n\r\n\t#define KLBDELETE(a)\t\t\tdo { if( (a)!=NULL ){ CTracker::logDelete((void *)(a),__LINE__,__FILE__); delete a; } } while (0)\r\n\t#define KLBDELETEA(a)\t\t\tdo { if( (a)!=NULL ){ CTracker::logDelete((void *)(a),__LINE__, __FILE__); delete [] a; } } while (0)\r\n\t#define KLBFREE(a)\t\t\t\tdo { if( (a)!=NULL ){ CTracker::logDelete((void *)(a),__LINE__,__FILE__); free(a); a=NULL; } } while (0)\r\n#else\r\n    #define KLBNEW(a)\t\t\t\tnew a()\r\n    #define KLBNEWA(a,b)\t\t\tnew a[(b)]\r\n    #define KLBNEWC(a,b)\t\t\tnew a b\r\n    #define KLBMALLOC(a)\t\t\tmalloc(a)\r\n\r\n    #define KLBDELETE(a)\t\t\tdo { if( (a)!=NULL ){ delete a; } } while (0)\r\n    #define KLBDELETEA(a)           do { if( (a)!=NULL ){ delete [] a; } } while (0)\r\n    #define KLBFREE(a)\t\t\t\tdo { if( (a)!=NULL ){ free(a); a=NULL; } } while (0)\r\n#endif\r\n\r\n#include \"assert_klb.h\"\r\n\r\n// #define _CRTDBG_MAP_ALLOC\r\n// #include <stdlib.h>\r\n// #include <crtdbg.h>\r\n\r\n#include <stdio.h>\r\n\r\n// Heap checking (via crtdbg) is windows-only, so use it cautiously\r\n#ifdef _WIN32\r\n  #include <crtdbg.h>\r\n  #define\t\tCHECKMEM()\t\t\tklb_assert(_CrtCheckMemory(),\"Heap Corrupted\")\r\n#else\r\n  #define\t\tCHECKMEM()\t\t\t;\r\n#endif\r\n#define TASKCLID(a)\t\t\t\t\t{ CKLBTask* pTsk = CKLBTaskMgr::getInstance().getCurrentTask(); u32 clID = pTsk ? pTsk->getClassID() : 0; klb_assert(clID != (a),\"Task Found\"); }\r\n#define ISCLID(a)\t\t\t\t\t(CKLBTaskMgr::getInstance().getCurrentTask() ? ((CKLBTaskMgr::getInstance().getCurrentTask()->getClassID()) == a) : (0 == a)))\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tvoid checkVirtualDocState();\r\n\tvoid dumpVirtualDocState(void* lookupObj);\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/include/FileSystem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __FILE_SYSTEM_KLB__\r\n#define __FILE_SYSTEM_KLB__\r\n\r\nclass IWriteStream;\r\n\r\n/*!\r\n* \\class IReadStream\r\n* \\brief Read Stream Interface\r\n* \r\n* IReadStream defines an Interface for Read Stream classes.\r\n* It provides methods for file decryption.\r\n* Read data can either be u8, u16, u32, float or blocks.\r\n*/\r\nclass IReadStream {\r\npublic:\r\n\tenum ESTATUS {\r\n\t\tNOT_FOUND,\t\t// Failed open\r\n\t\tNORMAL,\t\t\t// Open success\r\n\t\tNOT_AVAILABLE,\t// Killed during read\r\n        NOT_CONNECT,\r\n\t\tCLOSED\t\t\t// File close\r\n\t};\r\n\r\n\tvirtual ~IReadStream() { }\r\n\t\r\n\tvirtual\t\ts32\t\tgetSize\t\t()\t= 0;\t// -1 : Undefined, >= 0 file size\r\n\tvirtual\t\ts32\t\tgetPosition\t()\t= 0;\r\n\tvirtual \tu8\t\treadU8\t\t() \t= 0;\t// Use cast to support s8\r\n\tvirtual\t\tu16\t\treadU16\t\t()\t= 0;\t// Use cast to support s16\r\n\tvirtual\t\tu32\t\treadU32\t\t()\t= 0;\t// Use cast to support s32\r\n    \r\n    virtual     int     readU16arr  (u16 * pBufferU16, int items) = 0;\r\n    virtual     int     readU32arr  (u32 * pBufferU32, int items) = 0;\r\n    \r\n\tvirtual\t\tfloat\treadFloat\t()\t= 0;\t//\r\n\tvirtual\t\tbool\treadBlock\t(void* buffer, u32 byteSize)\t= 0;\r\n\tvirtual\t\tESTATUS\tgetStatus\t()\t= 0;\r\n\t\r\n\t// Socket specialized\r\n\tvirtual\t\tIWriteStream* getWriteStream()  = 0;\r\n};\r\n\r\n/*!\r\n* \\class IWriteStream\r\n* \\brief Write Stream Interface\r\n* \r\n* IWriteStream defines an Interface for Write Stream classes.\r\n* It provides methods for file encryption.\r\n* Written data can either be u8, u16, u32, float or blocks.\r\n*/\r\nclass IWriteStream {\r\npublic:\r\n\tenum ESTATUS {\r\n\t\t// TODO WRITE Status...\r\n        CAN_NOT_WRITE,\r\n        NORMAL,\r\n        NOT_AVAILABLE,\r\n        CLOSED\r\n\t};\r\n\r\n\tvirtual ~IWriteStream() { }\r\n\t\r\n\tvirtual\t\tESTATUS\tgetStatus\t()\t\t\t= 0;\r\n\tvirtual\t\ts32\t\tgetPosition\t()\t\t\t= 0;\r\n\tvirtual \tvoid\twriteU8\t\t(u8 value) \t= 0;\t// Use cast to support s8\r\n\tvirtual\t\tvoid\twriteU16\t(u16 value)\t= 0;\t// Use cast to support s16\r\n\tvirtual\t\tvoid\twriteU32\t(u32 value)\t= 0;\t// Use cast to support s32\r\n\tvirtual\t\tvoid\twriteFloat\t(float)\t\t= 0;\r\n\tvirtual\t\tvoid\twriteBlock\t(void* buffer, u32 byteSize)\t= 0;\r\n};\r\n\r\nenum WRITE_MODE {\r\n\tCREATE_FILE\t= 1,\r\n};\r\n\r\nIReadStream* \topenReadStream\t\t(char* path);\r\nIWriteStream*\topenWriteStream\t\t(char* path, WRITE_MODE writeMode); \r\nvoid\t\t\tcloseReadStream\t\t(IReadStream* \tpReadStream);\r\nvoid\t\t\tcloseWriteStream\t(IWriteStream*\tpWriteStream);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/include/ITmpFile.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef ITmpFile_h\r\n#define ITmpFile_h\r\n\r\n#include <sys/types.h>\r\n\r\nclass ITmpFile\r\n{\r\npublic:\r\n\tITmpFile();\r\n\tvirtual ~ITmpFile();\r\n\r\n\t// writing\r\n\tvirtual size_t writeTmp(void * ptr, size_t size) = 0;\r\n};\r\n\r\n#endif // ITmpFile_h\r\n"
  },
  {
    "path": "Engine/include/OSWidget.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef OSWidget_h\r\n#define OSWidget_h\r\n\r\n#include <string.h>\r\n\r\nclass IWidget\r\n{\r\npublic:\r\n\tenum CONTROL {\r\n\t\tTEXTBOX,\r\n\t\tPASSWDBOX,\r\n        WEBVIEW,\r\n        WEBNOJUMP,\r\n        MOVIEPLAYER,\r\n        BGMOVIEPLAYER,\r\n        ACTIVITYINDICATOR,\r\n\t};\r\n    \r\n\t// TEXTBOX で生成された Widget の操作コマンド(cmd()に渡して使用)\r\n\tenum TEXTCMD{\r\n        TX_FONT,            // フォントおよびサイズ指定\r\n\t\tTX_PLACEHOLDER,\t\t// プレースホルダ設定\r\n        TX_MAXLEN,          // 最大長設定\r\n        TX_CHARTYPE,        // 有効文字種設定(TEXTCHARTYPEの論理和で指定)\r\n\r\n\t\tTX_BGCOLOR_NORMAL,\t// 通常時の背景色\r\n\t\tTX_FGCOLOR_NORMAL,\t// 通常時の前景色\r\n\r\n\t\tTX_BGCOLOR_TOUCH,\t// 触れた時の背景色\r\n\t\tTX_FGCOLOR_TOUCH,\t// 触れた時の前景色\r\n        \r\n        TX_ALIGNMENTTYPE,   // テキストのアライメントタイプ\r\n\t};\r\n    \r\n    enum TEXTALIGNMENTTYPE {\r\n        TX_ALIGN_LEFT = 0,     // 左揃え\r\n        TX_ALIGN_CENTER,       // 中央揃え\r\n        TX_ALIGN_RIGHT,        // 右揃え\r\n    };\r\n\r\n\tenum TEXTCHARTYPE {\r\n\t\tTXCH_7BIT_ASCII = 0x0001,\t// 7bit ASCII を許可\r\n\t\tTXCH_UTF8       = 0x0002,\t// 最上位bitが1の文字を許可\r\n\r\n\t\t// それ以外の文字種を追加する際は 0x0004, 0x0008…と、bitmaskを追加する形で。\r\n\t};\r\n\r\n    // WEBVIEW で生成された Widget の操作コマンド(cmd()に渡して使用)\r\n    typedef enum {\r\n        WEB_SET_SCALESPAGETOFIT,\t// iOSの UIWebViewにおける scalePageToFit プロパティ設定\r\n        WEB_BGCOLOR_NORMAL,\t\t\t// webviewの背景色\r\n    } WEBCMD;\r\n    \r\n    \r\n    // MOVIEPLAYER で生成された Widget の操作コマンド(cmd()に渡して使用)\r\n    enum MOVIECMD{\r\n        MV_STOP,\t\t\t\t\t// 動画再生停止\r\n        MV_PLAY,\t\t\t\t\t// 動画再生\r\n        MV_PAUSE,\t\t\t\t\t// 動画一時停止\r\n        MV_RESUME,\t\t\t\t\t// 動画再生再開\r\n    };\r\n\r\n\t// 動画再生ステータス(現在未使用)\r\n    enum MOVIESTAT {\r\n        MV_FINISHED,\t\t\t\t// 動画再生終了\r\n    };\r\n    \r\n    // ACTIVITYINDICATOR　用コマンドと定数\r\n    enum ACTIVITYINDICATORCMD {\r\n        ACT_STARTANIM,\t\t\t\t// アニメーション開始\r\n        ACT_STOPANIM,\t\t\t\t// アニメーション停止\r\n        ACT_SET_STYLE,\t\t\t\t// ActivityIndicatorの種類指定(定数ACTITYPEで指定)\r\n    };\r\n    \r\n    enum ACTITYPE {\r\n        ACTI_TYPE_WHITE,\t\t\t// white\r\n        ACTI_TYPE_GRAY,\t\t\t\t// gray\r\n        ACTI_TYPE_WHITELARGE,\t\t// whitelarge\r\n    };\r\n    \r\n\tvirtual ~IWidget();\r\n\r\n\tvirtual int  getTextLength() = 0;\r\n\tvirtual int  getTextMaxLength() { return 0; } // Default implementation for all classes.\r\n\tvirtual bool getText(char * pBuf, int maxlen) = 0;\r\n\tvirtual bool setText(const char * string) = 0;\r\n\tvirtual void move(int x, int y) = 0;\r\n\tvirtual void resize(int width, int height) = 0;\r\n\tvirtual void visible(bool bVisible) = 0;\r\n\tvirtual void enable(bool bEnable) = 0;\r\n    \r\n    virtual void cmd(int cmd, ...) = 0;\r\n    virtual int status() = 0;\r\n    \r\n    inline void setTmpString(const char * string) { strcpy(m_buf, string); }\r\n    inline const char * getTmpString() const { return (const char *)m_buf; }\r\nprivate:\r\n    char        m_buf[1024];\r\n};\r\n\r\n#endif // OSWidget_h\r\n"
  },
  {
    "path": "Engine/include/assert_klb.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __ASSERT_SYSTEM__\r\n#define __ASSERT_SYSTEM__\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//#ifdef assert\r\n//#error \"Already using standard C Assert\"\r\n//#endif\r\n//#undef assert\r\n\tvoid assertFunction(int line, const char* file, const char* msg,...);\r\n#ifdef _WIN32\r\n#define klb_assert(cond,msg,...)\t\tif (!(cond)) { assertFunction(__LINE__, __FILE__, msg, __VA_ARGS__); }\r\n#define klb_assertNull(cond, msg, ...)\t;\r\n#define klb_assertAlways(msg,...)\t\t{ assertFunction(__LINE__, __FILE__, msg, __VA_ARGS__); }\r\n#else\r\n#if (DEBUG == 1)\r\n#define klb_assert(cond,msg...)\t\t\tif(!(cond)) { assertFunction(__LINE__, __FILE__, msg); }\r\n#define klb_assertNull(cond, msg, ...)\t;\r\n#define klb_assertAlways(msg...)\t\t{ assertFunction(__LINE__, __FILE__, msg); }\r\n#else\r\n#define klb_assert(cond,msg...)\t\t\t;\r\n#define klb_assertNull(cond, msg, ...)\t;\r\n#define klb_assertAlways(msg...)\t\t;\r\n#endif\r\n#endif\r\n\r\nvoid msgBox(char* msg);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/include/klb_vararg.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef klb_vararg_h\r\n#define klb_vararg_h\r\n\r\n#include <stdarg.h>\r\n\r\n#endif // klb_vararg_h\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/api/yajl_common.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#ifndef __YAJL_COMMON_H__\r\n#define __YAJL_COMMON_H__\r\n\r\n#include <stddef.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif    \r\n\r\n#define YAJL_MAX_DEPTH 128\r\n\r\n/* msft dll export gunk.  To build a DLL on windows, you\r\n * must define WIN32, YAJL_SHARED, and YAJL_BUILD.  To use a shared\r\n * DLL, you must define YAJL_SHARED and WIN32 */\r\n#if defined(WIN32) && defined(YAJL_SHARED)\r\n#  ifdef YAJL_BUILD\r\n#    define YAJL_API __declspec(dllexport)\r\n#  else\r\n#    define YAJL_API __declspec(dllimport)\r\n#  endif\r\n#else\r\n#  if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303\r\n#    define YAJL_API __attribute__ ((visibility(\"default\")))\r\n#  else\r\n#    define YAJL_API\r\n#  endif\r\n#endif \r\n\r\n/** pointer to a malloc function, supporting client overriding memory\r\n *  allocation routines */\r\ntypedef void * (*yajl_malloc_func)(void *ctx, size_t sz);\r\n\r\n/** pointer to a free function, supporting client overriding memory\r\n *  allocation routines */\r\ntypedef void (*yajl_free_func)(void *ctx, void * ptr);\r\n\r\n/** pointer to a realloc function which can resize an allocation. */\r\ntypedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz);\r\n\r\n/** A structure which can be passed to yajl_*_alloc routines to allow the\r\n *  client to specify memory allocation functions to be used. */\r\ntypedef struct\r\n{\r\n    /** pointer to a function that can allocate uninitialized memory */\r\n    yajl_malloc_func malloc;\r\n    /** pointer to a function that can resize memory allocations */\r\n    yajl_realloc_func realloc;\r\n    /** pointer to a function that can free memory allocated using\r\n     *  reallocFunction or mallocFunction */\r\n    yajl_free_func free;\r\n    /** a context pointer that will be passed to above allocation routines */\r\n    void * ctx;\r\n} yajl_alloc_funcs;\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/api/yajl_gen.h",
    "content": "/*\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * \\file yajl_gen.h\n * Interface to YAJL's JSON generation facilities.\n */\n\n#include \"yajl_common.h\"\n\n#ifndef __YAJL_GEN_H__\n#define __YAJL_GEN_H__\n\r\n#ifdef _WIN32\r\n#pragma warning(disable:4996)\r\n#endif\r\n\n#include <stddef.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n    /** generator status codes */\n    typedef enum {\n        /** no error */\n        yajl_gen_status_ok = 0,\n        /** at a point where a map key is generated, a function other than\n         *  yajl_gen_string was called */\n        yajl_gen_keys_must_be_strings,\n        /** YAJL's maximum generation depth was exceeded.  see\n         *  YAJL_MAX_DEPTH */\n        yajl_max_depth_exceeded,\n        /** A generator function (yajl_gen_XXX) was called while in an error\n         *  state */\n        yajl_gen_in_error_state,\n        /** A complete JSON document has been generated */\n        yajl_gen_generation_complete,                \n        /** yajl_gen_double was passed an invalid floating point value\n         *  (infinity or NaN). */\n        yajl_gen_invalid_number,\n        /** A print callback was passed in, so there is no internal\n         * buffer to get from */\n        yajl_gen_no_buf,\n        /** returned from yajl_gen_string() when the yajl_gen_validate_utf8\n         *  option is enabled and an invalid was passed by client code.\n         */\n        yajl_gen_invalid_string\n    } yajl_gen_status;\n\n    /** an opaque handle to a generator */\n    typedef struct yajl_gen_t * yajl_gen;\n\n    /** a callback used for \"printing\" the results. */\n    typedef void (*yajl_print_t)(void * ctx,\n                                 const char * str,\n                                 size_t len);\n\n    /** configuration parameters for the parser, these may be passed to\n     *  yajl_gen_config() along with option specific argument(s).  In general,\n     *  all configuration parameters default to *off*. */\n    typedef enum {\n        /** generate indented (beautiful) output */\n        yajl_gen_beautify = 0x01,\n        /**\n         * Set an indent string which is used when yajl_gen_beautify\n         * is enabled.  Maybe something like \\\\t or some number of\n         * spaces.  The default is four spaces ' '.\n         */\n        yajl_gen_indent_string = 0x02,\n        /**\n         * Set a function and context argument that should be used to\n         * output generated json.  the function should conform to the\n         * yajl_print_t prototype while the context argument is a\n         * void * of your choosing.\n         *\n         * example:\n         *   yajl_gen_config(g, yajl_gen_print_callback, myFunc, myVoidPtr);\n         */\n        yajl_gen_print_callback = 0x04,\n        /**\n         * Normally the generator does not validate that strings you\n         * pass to it via yajl_gen_string() are valid UTF8.  Enabling\n         * this option will cause it to do so.\n         */\n        yajl_gen_validate_utf8 = 0x08,\n        /**\n         * the forward solidus (slash or '/' in human) is not required to be\n         * escaped in json text.  By default, YAJL will not escape it in the\n         * iterest of saving bytes.  Setting this flag will cause YAJL to\n         * always escape '/' in generated JSON strings.\n         */\n        yajl_gen_escape_solidus = 0x10\n    } yajl_gen_option;\n\n    /** allow the modification of generator options subsequent to handle\n     *  allocation (via yajl_alloc)\n     *  \\returns zero in case of errors, non-zero otherwise\n     */\n    YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...);\n\n    /** allocate a generator handle\n     *  \\param allocFuncs an optional pointer to a structure which allows\n     *                    the client to overide the memory allocation\n     *                    used by yajl.  May be NULL, in which case\n     *                    malloc/free/realloc will be used.\n     *\n     *  \\returns an allocated handle on success, NULL on failure (bad params)\n     */\n    YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * allocFuncs);\n\n    /** free a generator handle */\n    YAJL_API void yajl_gen_free(yajl_gen handle);\n\n    YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number);\n    /** generate a floating point number.  number may not be infinity or\n     *  NaN, as these have no representation in JSON.  In these cases the\n     *  generator will return 'yajl_gen_invalid_number' */\n    YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number);\n    YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand,\n                                             const char * num,\n                                             size_t len);\n    YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand,\n                                             const unsigned char * str,\n                                             size_t len);\n    YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand);\n    YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean);\n    YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand);\n    YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand);\n    YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand);\n    YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand);\n\n    /** access the null terminated generator buffer.  If incrementally\n     *  outputing JSON, one should call yajl_gen_clear to clear the\n     *  buffer.  This allows stream generation. */\n    YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand,\n                                              const unsigned char ** buf,\n                                              size_t * len);\n\n    /** clear yajl's output buffer, but maintain all internal generation\n     *  state.  This function will not \"reset\" the generator state, and is\n     *  intended to enable incremental JSON outputing. */\n    YAJL_API void yajl_gen_clear(yajl_gen hand);\n\n#ifdef __cplusplus\n}\n#endif    \n\n#endif\n"
  },
  {
    "path": "Engine/libs/JSonParser/api/yajl_parse.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n/**\r\n * \\file yajl_parse.h\r\n * Interface to YAJL's JSON stream parsing facilities.\r\n */\r\n\r\n#include \"yajl_common.h\"\r\n\r\n#ifndef __YAJL_PARSE_H__\r\n#define __YAJL_PARSE_H__\r\n\r\n#include <stddef.h>\r\n\r\n// ======================\r\n//  BJSon Type\r\n// ======================\t\r\n#define BJSN_END\t\t\t\t(0)\r\n#define BJSN_OPEN_OBJ\t\t\t(1)\r\n#define BJSN_OPEN_ARR\t\t\t(2)\r\n#define BJSN_CLOSE_OBJ\t\t\t(3)\r\n#define BJSN_CLOSE_ARR\t\t\t(4)\r\n#define BJSN_STRING\t\t\t\t(5)\r\n#define BJSN_STRING_DIRECT\t\t(6)\r\n#define BJSN_MEMBER\t\t\t\t(7)\r\n#define BJSN_MEMBER_DIRECT\t\t(8)\r\n#define BJSN_NUMBER_I64\t\t\t(9)\r\n#define BJSN_NUMBER_DBL\t\t\t(10)\r\n#define BJSN_NUMBER_I32\t\t\t(11)\r\n#define BJSN_NUMBER_I16\t\t\t(12)\r\n#define BJSN_NUMBER_I8\t\t\t(13)\r\n#define BJSN_NUMBER_FLT\t\t\t(14)\r\n#define BJSN_CTE_TRUE\t\t\t(15)\r\n#define BJSN_CTE_FALSE\t\t\t(16)\r\n#define BJSN_CTE_NULL\t\t\t(17)\r\n#define BJSN_NUMBER_I8_RLE\t\t(18)\r\n#define BJSN_NUMBER_I16_RLE\t\t(19)\r\n#define BJSN_NUMBER_I32_RLE\t\t(20)\r\n#define BJSN_NUMBER_I64_RLE\t\t(21)\r\n#define BJSN_CTE_TRUE_RLE\t\t(22)\r\n#define BJSN_CTE_FALSE_RLE\t\t(23)\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n    /** error codes returned from this interface */\r\n    typedef enum {\r\n        /** no error was encountered */\r\n        yajl_status_ok,\r\n        /** a client callback returned zero, stopping the parse */\r\n        yajl_status_client_canceled,\r\n        /** An error occured during the parse.  Call yajl_get_error for\r\n         *  more information about the encountered error */\r\n        yajl_status_error\r\n    } yajl_status;\r\n\r\n    /** attain a human readable, english, string for an error */\r\n    YAJL_API const char * yajl_status_to_string(yajl_status code);\r\n\r\n    /** an opaque handle to a parser */\r\n    typedef struct yajl_handle_t * yajl_handle;\r\n\r\n    /** yajl is an event driven parser.  this means as json elements are\r\n     *  parsed, you are called back to do something with the data.  The\r\n     *  functions in this table indicate the various events for which\r\n     *  you will be called back.  Each callback accepts a \"context\"\r\n     *  pointer, this is a void * that is passed into the yajl_parse\r\n     *  function which the client code may use to pass around context.\r\n     *\r\n     *  All callbacks return an integer.  If non-zero, the parse will\r\n     *  continue.  If zero, the parse will be canceled and\r\n     *  yajl_status_client_canceled will be returned from the parse.\r\n     *\r\n     *  \\attention {\r\n     *    A note about the handling of numbers:\r\n     *\r\n     *    yajl will only convert numbers that can be represented in a\r\n     *    double or a 64 bit (long long) int.  All other numbers will\r\n     *    be passed to the client in string form using the yajl_number\r\n     *    callback.  Furthermore, if yajl_number is not NULL, it will\r\n     *    always be used to return numbers, that is yajl_integer and\r\n     *    yajl_double will be ignored.  If yajl_number is NULL but one\r\n     *    of yajl_integer or yajl_double are defined, parsing of a\r\n     *    number larger than is representable in a double or 64 bit\r\n     *    integer will result in a parse error.\r\n     *  }\r\n     */\r\n    typedef struct {\r\n        int (* yajl_null)(void * ctx);\r\n        int (* yajl_boolean)(void * ctx, int boolVal);\r\n        int (* yajl_integer)(void * ctx, long long integerVal);\r\n        int (* yajl_double)(void * ctx, double doubleVal);\r\n        /** A callback which passes the string representation of the number\r\n         *  back to the client.  Will be used for all numbers when present */\r\n        int (* yajl_number)(void * ctx, const char * numberVal,\r\n                            size_t numberLen);\r\n\r\n        /** strings are returned as pointers into the JSON text when,\r\n         * possible, as a result, they are _not_ null padded */\r\n        int (* yajl_string)(void * ctx, const unsigned char * stringVal,\r\n                            size_t stringLen, int cte_pool);\r\n\r\n        int (* yajl_start_map)(void * ctx, unsigned int size);\r\n        int (* yajl_map_key)(void * ctx, const unsigned char * key,\r\n                             size_t stringLen, int cte_pool);\r\n        int (* yajl_end_map)(void * ctx);\r\n\r\n        int (* yajl_start_array)(void * ctx, unsigned int size);\r\n        int (* yajl_end_array)(void * ctx);\r\n    } yajl_callbacks;\r\n\r\n    /** allocate a parser handle\r\n     *  \\param callbacks  a yajl callbacks structure specifying the\r\n     *                    functions to call when different JSON entities\r\n     *                    are encountered in the input text.  May be NULL,\r\n     *                    which is only useful for validation.\r\n     *  \\param afs        memory allocation functions, may be NULL for to use\r\n     *                    C runtime library routines (malloc and friends) \r\n     *  \\param ctx        a context pointer that will be passed to callbacks.\r\n     */\r\n    YAJL_API yajl_handle yajl_alloc(const yajl_callbacks * callbacks,\r\n                                    yajl_alloc_funcs * afs,\r\n                                    void * ctx);\r\n\r\n\r\n    /** configuration parameters for the parser, these may be passed to\r\n     *  yajl_config() along with option specific argument(s).  In general,\r\n     *  all configuration parameters default to *off*. */\r\n    typedef enum {\r\n        /** Ignore javascript style comments present in\r\n         *  JSON input.  Non-standard, but rather fun\r\n         *  arguments: toggled off with integer zero, on otherwise.\r\n         *\r\n         *  example:\r\n         *    yajl_config(h, yajl_allow_comments, 1); // turn comment support on\r\n         */\r\n        yajl_allow_comments = 0x01,\r\n        /**\r\n         * When set the parser will verify that all strings in JSON input are\r\n         * valid UTF8 and will emit a parse error if this is not so.  When set,\r\n         * this option makes parsing slightly more expensive (~7% depending\r\n         * on processor and compiler in use)\r\n         *\r\n         * example:\r\n         *   yajl_config(h, yajl_dont_validate_strings, 1); // disable utf8 checking\r\n         */\r\n        yajl_dont_validate_strings     = 0x02,\r\n        /**\r\n         * By default, upon calls to yajl_complete_parse(), yajl will\r\n         * ensure the entire input text was consumed and will raise an error\r\n         * otherwise.  Enabling this flag will cause yajl to disable this\r\n         * check.  This can be useful when parsing json out of a that contains more\r\n         * than a single JSON document.\r\n         */\r\n        yajl_allow_trailing_garbage = 0x04,\r\n        /**\r\n         * Allow multiple values to be parsed by a single handle.  The\r\n         * entire text must be valid JSON, and values can be seperated\r\n         * by any kind of whitespace.  This flag will change the\r\n         * behavior of the parser, and cause it continue parsing after\r\n         * a value is parsed, rather than transitioning into a\r\n         * complete state.  This option can be useful when parsing multiple\r\n         * values from an input stream.\r\n         */\r\n        yajl_allow_multiple_values = 0x08,\r\n        /**\r\n         * When yajl_complete_parse() is called the parser will\r\n         * check that the top level value was completely consumed.  I.E.,\r\n         * if called whilst in the middle of parsing a value\r\n         * yajl will enter an error state (premature EOF).  Setting this\r\n         * flag suppresses that check and the corresponding error.\r\n         */\r\n        yajl_allow_partial_values = 0x10\r\n    } yajl_option;\r\n\r\n    /** allow the modification of parser options subsequent to handle\r\n     *  allocation (via yajl_alloc)\r\n     *  \\returns zero in case of errors, non-zero otherwise\r\n     */\r\n    YAJL_API int yajl_config(yajl_handle h, yajl_option opt, ...);\r\n\r\n    /** free a parser handle */\r\n    YAJL_API void yajl_free(yajl_handle handle);\r\n\r\n    /** Parse some json!\r\n     *  \\param hand - a handle to the json parser allocated with yajl_alloc\r\n     *  \\param jsonText - a pointer to the UTF8 json text to be parsed\r\n     *  \\param jsonTextLength - the length, in bytes, of input text\r\n     */\r\n    YAJL_API yajl_status yajl_parse(yajl_handle hand,\r\n                                    const unsigned char * jsonText,\r\n                                    size_t jsonTextLength);\r\n\r\n    /** Parse any remaining buffered json.\r\n     *  Since yajl is a stream-based parser, without an explicit end of\r\n     *  input, yajl sometimes can't decide if content at the end of the\r\n     *  stream is valid or not.  For example, if \"1\" has been fed in,\r\n     *  yajl can't know whether another digit is next or some character\r\n     *  that would terminate the integer token.\r\n     *\r\n     *  \\param hand - a handle to the json parser allocated with yajl_alloc\r\n     */\r\n    YAJL_API yajl_status yajl_complete_parse(yajl_handle hand);\r\n\r\n    /** get an error string describing the state of the\r\n     *  parse.\r\n     *\r\n     *  If verbose is non-zero, the message will include the JSON\r\n     *  text where the error occured, along with an arrow pointing to\r\n     *  the specific char.\r\n     *\r\n     *  \\returns A dynamically allocated string will be returned which should\r\n     *  be freed with yajl_free_error\r\n     */\r\n    YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose,\r\n                                            const unsigned char * jsonText,\r\n                                            size_t jsonTextLength);\r\n\r\n    /**\r\n     * get the amount of data consumed from the last chunk passed to YAJL.\r\n     *\r\n     * In the case of a successful parse this can help you understand if\r\n     * the entire buffer was consumed (which will allow you to handle\r\n     * \"junk at end of input\").\r\n     *\r\n     * In the event an error is encountered during parsing, this function\r\n     * affords the client a way to get the offset into the most recent\r\n     * chunk where the error occured.  0 will be returned if no error\r\n     * was encountered.\r\n     */\r\n    YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand);\r\n\r\n    /** free an error returned from yajl_get_error */\r\n    YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str);\r\n\r\n\r\n\t/** Get Cache from constant pool for BJson */\r\n\tint bjson_getCPCacheID(\t\tyajl_handle\t\thand,\r\n\t\t\t\t\t\t\t\tint\t\t\t\tcte_pool);\r\n\r\n\t/** Set Cache from constant pool for BJson */\r\n\tvoid bjson_setCPCacheID(\tyajl_handle\t\thand,\r\n\t\t\t\t\t\t\t\tint\t\t\t\tcte_pool,\r\n\t\t\t\t\t\t\t\tint\t\t\t\tcacheID);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/api/yajl_tree.h",
    "content": "/*\r\n * Copyright (c) 2010-2011  Florian Forster  <ff at octo.it>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n/**\r\n * \\file yajl_tree.h\r\n *\r\n * Parses JSON data and returns the data in tree form.\r\n *\r\n * \\author Florian Forster\r\n * \\date August 2010\r\n *\r\n * This interface makes quick parsing and extraction of\r\n * smallish JSON docs trivial:\r\n *\r\n * \\include example/parse_config.c\r\n */\r\n\r\n#ifndef YAJL_TREE_H\r\n#define YAJL_TREE_H 1\r\n\r\n#include \"yajl_common.h\"\r\n\r\n/** possible data types that a yajl_val_s can hold */\r\ntypedef enum {\r\n    yajl_t_string = 1,\r\n    yajl_t_number = 2,\r\n    yajl_t_object = 3,\r\n    yajl_t_array = 4,\r\n    yajl_t_true = 5,\r\n    yajl_t_false = 6,\r\n    yajl_t_null = 7,\r\n    /** The any type isn't valid for yajl_val_s.type, but can be\r\n     *  used as an argument to routines like yajl_tree_get().\r\n     */\r\n    yajl_t_any = 8\r\n} yajl_type;\r\n\r\n#define YAJL_NUMBER_INT_VALID    0x01\r\n#define YAJL_NUMBER_DOUBLE_VALID 0x02\r\n\r\n/** A pointer to a node in the parse tree */\r\ntypedef struct yajl_val_s * yajl_val;\r\n\r\n/**\r\n * A JSON value representation capable of holding one of the seven\r\n * types above. For \"string\", \"number\", \"object\", and \"array\"\r\n * additional data is available in the union.  The \"YAJL_IS_*\"\r\n * and \"YAJL_GET_*\" macros below allow type checking and convenient\r\n * value extraction.\r\n */\r\nstruct yajl_val_s\r\n{\r\n    /** Type of the value contained. Use the \"YAJL_IS_*\" macors to check for a\r\n     * specific type. */\r\n    yajl_type type;\r\n    /** Type-specific data. You may use the \"YAJL_GET_*\" macros to access these\r\n     * members. */\r\n    union\r\n    {\r\n        char * string;\r\n        struct {\r\n            long long i; /*< integer value, if representable. */\r\n            double  d;   /*< double value, if representable. */\r\n            /** Signals whether the \\em i and \\em d members are\r\n             * valid. See \\c YAJL_NUMBER_INT_VALID and\r\n             * \\c YAJL_NUMBER_DOUBLE_VALID. */\r\n            char   *r;   /*< unparsed number in string form. */\r\n            unsigned int flags;\r\n        } number;\r\n        struct {\r\n            const char **keys; /*< Array of keys */\r\n            yajl_val *values; /*< Array of values. */\r\n            size_t len; /*< Number of key-value-pairs. */\r\n        } object;\r\n        struct {\r\n            yajl_val *values; /*< Array of elements. */\r\n            size_t len; /*< Number of elements. */\r\n        } array;\r\n    } u;\r\n};\r\n\r\n/**\r\n * Parse a string.\r\n *\r\n * Parses an null-terminated string containing JSON data and returns a pointer\r\n * to the top-level value (root of the parse tree).\r\n *\r\n * \\param input              Pointer to a null-terminated utf8 string containing\r\n *                           JSON data.\r\n * \\param error_buffer       Pointer to a buffer in which an error message will\r\n *                           be stored if \\em yajl_tree_parse fails, or\r\n *                           \\c NULL. The buffer will be initialized before\r\n *                           parsing, so its content will be destroyed even if\r\n *                           \\em yajl_tree_parse succeeds.\r\n * \\param error_buffer_size  Size of the memory area pointed to by\r\n *                           \\em error_buffer_size. If \\em error_buffer_size is\r\n *                           \\c NULL, this argument is ignored.\r\n *\r\n * \\returns Pointer to the top-level value or \\c NULL on error. The memory\r\n * pointed to must be freed using \\em yajl_tree_free. In case of an error, a\r\n * null terminated message describing the error in more detail is stored in\r\n * \\em error_buffer if it is not \\c NULL.\r\n */\r\nYAJL_API yajl_val yajl_tree_parse (const char *input,\r\n                                   char *error_buffer, size_t error_buffer_size);\r\n\r\n/**\r\n * Free a parse tree returned by \"yajl_tree_parse\".\r\n *\r\n * \\param v Pointer to a JSON value returned by \"yajl_tree_parse\". Passing NULL\r\n * is valid and results in a no-op.\r\n */\r\nYAJL_API void yajl_tree_free (yajl_val v);\r\n\r\n/**\r\n * Access a nested value inside a tree.\r\n *\r\n * \\param parent the node under which you'd like to extract values.\r\n * \\param path A null terminated array of strings, each the name of an object key\r\n * \\param type the yajl_type of the object you seek, or yajl_t_any if any will do.\r\n *\r\n * \\returns a pointer to the found value, or NULL if we came up empty.\r\n * \r\n * Future Ideas:  it'd be nice to move path to a string and implement support for\r\n * a teeny tiny micro language here, so you can extract array elements, do things\r\n * like .first and .last, even .length.  Inspiration from JSONPath and css selectors?\r\n * No it wouldn't be fast, but that's not what this API is about.\r\n */\r\nYAJL_API yajl_val yajl_tree_get(yajl_val parent, const char ** path, yajl_type type);\r\n\r\n/* Various convenience macros to check the type of a `yajl_val` */\r\n#define YAJL_IS_STRING(v) (((v) != NULL) && ((v)->type == yajl_t_string))\r\n#define YAJL_IS_NUMBER(v) (((v) != NULL) && ((v)->type == yajl_t_number))\r\n#define YAJL_IS_INTEGER(v) (YAJL_IS_NUMBER(v) && ((v)->u.flags & YAJL_NUMBER_INT_VALID))\r\n#define YAJL_IS_DOUBLE(v) (YAJL_IS_NUMBER(v) && ((v)->u.flags & YAJL_NUMBER_DOUBLE_VALID))\r\n#define YAJL_IS_OBJECT(v) (((v) != NULL) && ((v)->type == yajl_t_object))\r\n#define YAJL_IS_ARRAY(v)  (((v) != NULL) && ((v)->type == yajl_t_array ))\r\n#define YAJL_IS_TRUE(v)   (((v) != NULL) && ((v)->type == yajl_t_true  ))\r\n#define YAJL_IS_FALSE(v)  (((v) != NULL) && ((v)->type == yajl_t_false ))\r\n#define YAJL_IS_NULL(v)   (((v) != NULL) && ((v)->type == yajl_t_null  ))\r\n\r\n/** Given a yajl_val_string return a ptr to the bare string it contains,\r\n *  or NULL if the value is not a string. */\r\n#define YAJL_GET_STRING(v) (YAJL_IS_STRING(v) ? (v)->u.string : NULL)\r\n\r\n/** Get the string representation of a number.  You should check type first,\r\n *  perhaps using YAJL_IS_NUMBER */\r\n#define YAJL_GET_NUMBER(v) ((v)->u.number.r)\r\n\r\n/** Get the double representation of a number.  You should check type first,\r\n *  perhaps using YAJL_IS_DOUBLE */\r\n#define YAJL_GET_DOUBLE(v) ((v)->u.number.d)\r\n\r\n/** Get the 64bit (long long) integer representation of a number.  You should\r\n *  check type first, perhaps using YAJL_IS_INTEGER */\r\n#define YAJL_GET_INTEGER(v) ((v)->u.number.i)\r\n\r\n/** Get a pointer to a yajl_val_object or NULL if the value is not an object. */\r\n#define YAJL_GET_OBJECT(v) (YAJL_IS_OBJECT(v) ? &(v)->u.object : NULL)\r\n\r\n/** Get a pointer to a yajl_val_array or NULL if the value is not an object. */\r\n#define YAJL_GET_ARRAY(v)  (YAJL_IS_ARRAY(v)  ? &(v)->u.array  : NULL)\r\n\r\n#endif /* YAJL_TREE_H */\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/important.txt",
    "content": "IMPORTANT :\r\nThe source of the library has been modified to allow compatibility with an efficient binary JSon parser.\r\nModified code is yajl_parser.c & yajl_parse.h (check SVN to see history change).\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/json_binary_parser.c",
    "content": "#include \"api/yajl_parse.h\"\r\n#include \"yajl_parser.h\"\r\n\r\n#include <stdio.h>\r\n\r\n#define BJSON_NO_ERROR\t\t(yajl_status_ok)\r\n#define BJSON_CANCEL\t\t(yajl_status_client_canceled)\r\n#define BJSON_ERROR\t\t\t(yajl_status_error)\r\n\r\n#define CHCK_PARSER(x)\t\tif (!(x)) { \\\r\n\t\t\t\t\t\t\t\terror = BJSON_CANCEL; parse = endStream; \\\r\n\t\t\t\t\t\t\t}\r\n\r\n#define CHCK_PARSER_LOOP(x)\tif (!(x)) { \\\r\n\t\t\t\t\t\t\t\terror = BJSON_CANCEL; parse = endStream; break; \\\r\n\t\t\t\t\t\t\t}\r\n\r\n\r\nint bjson_getCPCacheID(\t\tyajl_handle\t\thand,\r\n\t\t\t\t\t\t\tint\t\t\t\tcte_pool) {\r\n\tbjson_handle* bjsn\t= &hand->bj;\r\n\tif ((cte_pool < bjsn->cp_count) && (cte_pool >= 0)) {\r\n\t\treturn bjsn->cp[cte_pool].memberCache;\r\n\t} else {\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\nvoid bjson_setCPCacheID(\tyajl_handle\t\thand,\r\n\t\t\t\t\t\t\tint\t\t\t\tcte_pool,\r\n\t\t\t\t\t\t\tint\t\t\t\tcacheID) {\r\n\tbjson_handle* bjsn\t= &hand->bj;\r\n\tif ((cte_pool < bjsn->cp_count) && (cte_pool >= 0)) {\r\n\t\tbjsn->cp[cte_pool].memberCache = cacheID;\r\n\t} else {\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nint bjson_parse(\tyajl_handle\t\thand,\r\n\t\t\t\t\tconst unsigned char*\tjsonText,\r\n\t\t\t\t\tint\t\t\t\t\t\tjsonTextLength\r\n\t\t\t\t)\r\n{\r\n\tbjson_handle*\tbjsn= &hand->bj;\r\n\r\n\tint error\t\t\t= BJSON_NO_ERROR;\r\n\tconst yajl_callbacks * callbacks = hand->callbacks;\r\n\tcp_entry*\tcp\t\t= 0;\r\n\tvoid*\t\tctx\t\t= bjsn->ctx;\r\n\r\n\tconst unsigned char* endStream\t= &jsonText[jsonTextLength];\r\n\tconst unsigned char* parse\t\t= jsonText;\r\n\r\n\t// Parse header\r\n\tif ((parse[0] != 0xFF) || (parse[1] != 0xFF)) {\r\n\t\terror\t= BJSON_ERROR;\r\n\t\tparse\t= endStream;\r\n\t} else {\r\n\t\tparse += 2;\r\n\t}\r\n\r\n\t// Parse Pre-CP\r\n\t{\r\n\t\tint strSize;\r\n\t\tint cnt = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\tparse += 4;\r\n\t\tstrSize = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\tparse += 4;\r\n\r\n\t\tif (cnt) {\r\n\t\t\tbjsn->cp_count = cnt;\r\n\t\t\tbjsn->cp\t= (cp_entry*)hand->alloc.malloc(hand->alloc.ctx , cnt * sizeof(cp_entry));\r\n\t\t\tcp\t\t\t= bjsn->cp;\r\n\t\t\tbjsn->strs\t= NULL; // (unsigned char*)hand->alloc.malloc(hand->alloc.ctx, strSize);\r\n\t\t\tif (bjsn->cp /*&& bjsn->strs*/) {\r\n\t\t\t\tint n;\r\n//\t\t\t\tunsigned char* wPtr = bjsn->strs;\r\n\t\t\t\tfor (n=0; n < cnt; n++) {\r\n\t\t\t\t\t// Size\r\n\t\t\t\t\tint len = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\t\tparse += 4;\r\n\r\n\t\t\t\t\t// String\r\n\t\t\t\t\t// memcpy(wPtr, parse, len);\r\n\t\t\t\t\tcp[n].string\t\t= parse;\r\n\r\n\t\t\t\t\t// Read Ptr\r\n\t\t\t\t\tparse\t+= len;\r\n\t\t\t\t\t// Write Ptr\r\n\t\t\t\t\t// wPtr\t+= len;\r\n\r\n\t\t\t\t\t// Cache\r\n\t\t\t\t\tcp[n].stringlen\t\t= len;\r\n\t\t\t\t\tcp[n].memberCache\t= -1;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\terror\t= BJSON_ERROR;\r\n\t\t\t\tparse\t= endStream;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t// Parse Inner stream\r\n\twhile (parse < endStream) {\r\n\t\t// printf(\"Comm %4i %i %i\\n\",commandID++, *parse, error);\r\n\r\n\t\tswitch (*parse++) {\r\n\t\tcase BJSN_END:\r\n\t\t\tparse = endStream;\r\n\t\t\tbreak;\r\n\t\tcase BJSN_OPEN_OBJ:\r\n\t\t\t{\r\n\t\t\t\tint size = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_start_map(ctx,size));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_OPEN_ARR:\r\n\t\t\t{\r\n\t\t\t\tint size = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 8; // Skip type mask\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_start_array(ctx, size));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CLOSE_OBJ:\r\n\t\t\tCHCK_PARSER(callbacks->yajl_end_map(ctx));\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CLOSE_ARR:\r\n\t\t\tCHCK_PARSER(callbacks->yajl_end_array(ctx));\r\n\t\t\tbreak;\r\n\t\tcase BJSN_STRING:\r\n\t\t\t{\r\n\t\t\t\tint idx = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4; \r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_string(ctx, cp[idx].string, cp[idx].stringlen, idx));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_STRING_DIRECT:\r\n\t\t\t{\r\n\t\t\t\tint len = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_string(ctx, parse, len, -1));\r\n\t\t\t\tparse += len;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_MEMBER:\r\n\t\t\t{\r\n\t\t\t\tint idx = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_map_key(ctx, cp[idx].string, cp[idx].stringlen, idx));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_MEMBER_DIRECT:\r\n\t\t\t{\r\n\t\t\t\tint len = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_map_key(ctx, parse, len, -1));\r\n\t\t\t\tparse += len;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I64:\r\n\t\t\t{\r\n\t\t\t\t// MSB 32/64\r\n\t\t\t\tint idx  = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tunsigned int idx2 = (parse[4] << 24) | (parse[5] << 16) | (parse[6] << 8) | parse[7];\r\n\t\t\t\tlong long int l64 = (((long long int)idx)<<32) | idx2;\r\n\t\t\t\tparse += 8;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_integer(ctx, l64));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_DBL:\r\n\t\t\t{\r\n\t\t\t\tunsigned int idx  = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tunsigned int idx2 = (parse[4] << 24) | (parse[5] << 16) | (parse[6] << 8) | parse[7];\r\n\t\t\t\tunsigned long long int l64 = (((unsigned long long int)idx)<<32) | idx2;\r\n\t\t\t\tparse += 8;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_double(ctx, (*((double*)&l64))));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I32:\r\n\t\t\t{\r\n\t\t\t\tint idx  = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_integer(ctx, idx));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I16:\r\n\t\t\t{\r\n\t\t\t\tint idx  = (short)((parse[0] << 8) | parse[1]);\r\n\t\t\t\tidx <<= 16;\r\n\t\t\t\tidx >>= 16;\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_integer(ctx, idx));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I8:\r\n\t\t\t{\r\n\t\t\t\tint c = *parse++;\r\n\t\t\t\tc <<= 24;\r\n\t\t\t\tc >>= 24;\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_integer(ctx, c));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_FLT:\r\n\t\t\t{\r\n\t\t\t\tint idx  = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\t// int --trick--> float -> double\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_double(ctx, (double)(*((float*)&idx))));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CTE_TRUE:\r\n\t\t\t{\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_boolean(ctx, 1));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CTE_FALSE:\r\n\t\t\t{\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_boolean(ctx, 0));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CTE_NULL:\r\n\t\t\t{\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_null(ctx));\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I8_RLE:\r\n\t\t\t{\r\n\t\t\t\tint idx  = (char)(*parse++);\r\n\t\t\t\tint count = parse[0]<<8 | parse[1];\r\n\t\t\t\tint n;\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tfor (n=0; n < count; n++) {\r\n\t\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx, idx));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I16_RLE:\r\n\t\t\t{\r\n\t\t\t\tint count;\r\n\t\t\t\tint n;\r\n\t\t\t\tint idx  = (short)((parse[0] << 8) | parse[1]);\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tcount = parse[0]<<8 | parse[1];\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tfor (n=0; n < count; n++) {\r\n\t\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx, idx));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I32_RLE:\r\n\t\t\t{\r\n\t\t\t\tint n;\r\n\t\t\t\tint count;\r\n\t\t\t\tint idx  = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tparse += 4;\r\n\t\t\t\tcount = parse[0]<<8 | parse[1];\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tfor (n=0; n < count; n++) {\r\n\t\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx, idx));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_NUMBER_I64_RLE:\r\n\t\t\t{\r\n\t\t\t\tint count;\r\n\t\t\t\tint n;\r\n\t\t\t\t// MSB 32/64\r\n\t\t\t\tint idx  = (parse[0] << 24) | (parse[1] << 16) | (parse[2] << 8) | parse[3];\r\n\t\t\t\tunsigned int idx2 = (parse[4] << 24) | (parse[5] << 16) | (parse[6] << 8) | parse[7];\r\n\t\t\t\tlong long int l64 = (((long long int)idx)<<32) | idx2;\r\n\t\t\t\tparse += 8;\r\n\t\t\t\tcount = parse[0]<<8 | parse[1];\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tfor (n=0; n < count; n++) {\r\n\t\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx, l64));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CTE_TRUE_RLE:\r\n\t\t\t{\r\n\t\t\t\tint n;\r\n\t\t\t\tint count = parse[0]<<8 | parse[1];\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tfor (n=0; n < count; n++) {\r\n\t\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_boolean(ctx, 1));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BJSN_CTE_FALSE_RLE:\r\n\t\t\t{\r\n\t\t\t\tint n;\r\n\t\t\t\tint count = parse[0]<<8 | parse[1];\r\n\t\t\t\tparse += 2;\r\n\t\t\t\tfor (n=0; n < count; n++) {\r\n\t\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_boolean(ctx, 0));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\terror = BJSON_ERROR;\r\n\t\t\tgoto exit;\r\n\t\t}\r\n\t}\r\n\r\nexit:\r\n\t//\r\n\t// Free all allocated mem.\r\n\t//\r\n\tif (bjsn->cp_count) {\r\n\t\tif (bjsn->cp) {\r\n\t\t\thand->alloc.free(hand->alloc.ctx, bjsn->cp);\r\n\t\t\tbjsn->cp = NULL;\r\n\t\t}\r\n\r\n\t\tif (bjsn->strs) {\r\n\t\t\thand->alloc.free(hand->alloc.ctx, bjsn->strs);\r\n\t\t\tbjsn->strs = NULL;\r\n\t\t}\r\n\t}\r\n\r\n\t// Parse Post-CP\r\n\treturn error;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/msg_pack_parser.c",
    "content": "#include \"api/yajl_parse.h\"\r\n#include \"yajl_parser.h\"\r\n\r\n\r\n#define MSGPACK_NO_ERROR\t\t(yajl_status_ok)\r\n#define MSGPACK_CANCEL\t\t\t(yajl_status_client_canceled)\r\n#define MSGPACK_ERROR\t\t\t(yajl_status_error)\r\n\r\n#define MSG_PACK_nil\t\t\t\t0xc0\r\n#define MSG_PACK_reservedA \t\t\t0xc1\r\n#define MSG_PACK_false \t\t\t\t0xc2\r\n#define MSG_PACK_true \t\t\t\t0xc3\r\n#define MSG_PACK_reservedB \t\t\t0xc4\r\n#define MSG_PACK_reservedC \t\t\t0xc5\r\n#define MSG_PACK_reservedD \t\t\t0xc6\r\n#define MSG_PACK_reservedE \t\t\t0xc7\r\n#define MSG_PACK_reservedF \t\t\t0xc8\r\n#define MSG_PACK_reservedG \t\t\t0xc9\r\n#define MSG_PACK_float \t\t\t\t0xca\r\n#define MSG_PACK_double \t\t\t0xcb\r\n#define MSG_PACK_uint_8 \t\t\t0xcc\r\n#define MSG_PACK_uint_16 \t\t\t0xcd\r\n#define MSG_PACK_uint_32 \t\t\t0xce\r\n#define MSG_PACK_uint_64 \t\t\t0xcf\r\n#define MSG_PACK_int_8 \t\t\t\t0xd0\r\n#define MSG_PACK_int_16 \t\t\t0xd1\r\n#define MSG_PACK_int_32 \t\t\t0xd2\r\n#define MSG_PACK_int_64 \t\t\t0xd3\r\n#define MSG_PACK_reservedH \t\t\t0xd4\r\n#define MSG_PACK_reservedI \t\t\t0xd5\r\n#define MSG_PACK_reservedJ \t\t\t0xd6\r\n#define MSG_PACK_reservedK \t\t\t0xd7\r\n#define MSG_PACK_reservedL \t\t\t0xd8\r\n#define MSG_PACK_reservedM \t\t\t0xd9\r\n#define MSG_PACK_raw_16 \t\t\t0xda\r\n#define MSG_PACK_raw_32 \t\t\t0xdb\r\n#define MSG_PACK_array_16 \t\t\t0xdc\r\n#define MSG_PACK_array_32 \t\t\t0xdd\r\n#define MSG_PACK_map_16 \t\t\t0xde\r\n#define MSG_PACK_map_32 \t\t\t0xdf\r\n\r\n#define CHCK_PARSER(x)\t\tif (!(x)) { \\\r\n\t\t\t\t\t\t\t\terror = MSGPACK_CANCEL; ptr = endPtr; \\\r\n\t\t\t\t\t\t\t}\r\n\r\n#define CHCK_PARSER_LOOP(x)\tif (!(x)) { \\\r\n\t\t\t\t\t\t\t\terror = MSGPACK_CANCEL; ptr = endPtr; break; \\\r\n\t\t\t\t\t\t\t}\r\n\r\n// ReserveA : Constant Pool\r\n// ReserveB : Ref Constant Pool 8\r\n// ReserveC : Ref Constant Pool 16\r\n// ReserveD : PatternCount 16\r\nint msgpack_parse(\tyajl_handle\t\thand,\r\n\t\t\t\t\tconst unsigned char*\tjsonText,\r\n\t\t\t\t\tint\t\t\t\t\t\tjsonTextLength\r\n\t\t\t\t)\r\n{\r\n\tbjson_handle*\tbjsn= &hand->msgpack;\r\n\r\n\tint error\t\t\t= MSGPACK_NO_ERROR;\r\n\tconst yajl_callbacks * callbacks = hand->callbacks;\r\n\t// cp_entry*\tcp\t\t= 0;\r\n\tvoid*\t\tctx\t\t= bjsn->ctx;\r\n\r\n\tint\ttype;\r\n\tint currBlockType;\r\n\tint count;\r\n\tlong long int longValue;\r\n\tint rle;\r\n\tunsigned char\tc;\r\n\tunsigned int\tstackCount\t[100];\r\n\tunsigned char\tstackType\t[100];\r\n\tunsigned char\tstackDepth\t= 0;\r\n\tconst unsigned char*\tptr\t\t\t= jsonText;\r\n\tconst unsigned char*\tendPtr\t\t= &jsonText[jsonTextLength];\r\n\r\n\twhile (ptr != endPtr) {\r\n\t\r\n\tshortCut:\r\n\t\tc = *ptr++;\r\n\t\t\r\n\t\tif (c == MSG_PACK_reservedA) {\r\n\t\t\trle\t  = ((ptr[0]<<8) | (ptr[1]));\r\n\t\t\tptr\t\t+= 2;\r\n\t\t\tc = *ptr++;\r\n\t\t} else {\r\n\t\t\trle\t  = 1;\r\n\t\t}\r\n\t\t\r\n\t\tswitch (c) {\r\n\t\tdefault:\r\n\t\t\tif (c < 0x80) {\r\n\t\t\t\t// 0x00..7F\t\t: Positive Num\r\n\t\t\t\tcount = c;\r\n\t\t\t} else {\r\n\t\t\t\t// 0xe0 - 0xff \t: Negative Num\r\n\t\t\t\tcount = ((char)c);\r\n\t\t\t}\r\n\t\tperformIntCall:\r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx, count));\r\n\t\t\t} while (--rle);\r\n\t\t\t\r\n\t\t\ttype = currBlockType;\r\n\r\n\t\t\tbreak;\r\n\t\t//\r\n\t\t// Fix Map 80-8F\r\n\t\t//\r\n\t\tcase 0x80:\r\n\t\tcase 0x81:\r\n\t\tcase 0x82:\r\n\t\tcase 0x83:\r\n\t\tcase 0x84:\r\n\t\tcase 0x85:\r\n\t\tcase 0x86:\r\n\t\tcase 0x87:\r\n\t\tcase 0x88:\r\n\t\tcase 0x89:\r\n\t\tcase 0x8A:\r\n\t\tcase 0x8B:\r\n\t\tcase 0x8C:\r\n\t\tcase 0x8D:\r\n\t\tcase 0x8E:\r\n\t\tcase 0x8F:\r\n\t\t\tcount = c - 0x80;\r\n\t\t\t\r\n\t\t\tgoto shortCut;\r\n\t\t\t\r\n\t\t//\r\n\t\t// Fix Array 90-9F\r\n\t\t//\r\n\t\tcase 0x90:\r\n\t\tcase 0x91:\r\n\t\tcase 0x92:\r\n\t\tcase 0x93:\r\n\t\tcase 0x94:\r\n\t\tcase 0x95:\r\n\t\tcase 0x96:\r\n\t\tcase 0x97:\r\n\t\tcase 0x98:\r\n\t\tcase 0x99:\r\n\t\tcase 0x9A:\r\n\t\tcase 0x9B:\r\n\t\tcase 0x9C:\r\n\t\tcase 0x9D:\r\n\t\tcase 0x9E:\r\n\t\tcase 0x9F:\t\t\r\n\t\t\tcount = c - 0x90;\r\n\t\t\tgoto shortCut;\r\n\t\t\t\r\n\t\t//\r\n\t\t// Fix Raw A0-BF\r\n\t\t//\r\n\t\tcase 0xA0:\r\n\t\tcase 0xA1:\r\n\t\tcase 0xA2:\r\n\t\tcase 0xA3:\r\n\t\tcase 0xA4:\r\n\t\tcase 0xA5:\r\n\t\tcase 0xA6:\r\n\t\tcase 0xA7:\r\n\t\tcase 0xA8:\r\n\t\tcase 0xA9:\r\n\t\tcase 0xAA:\r\n\t\tcase 0xAB:\r\n\t\tcase 0xAC:\r\n\t\tcase 0xAD:\r\n\t\tcase 0xAE:\r\n\t\tcase 0xAF:\r\n\t\tcase 0xB0:\r\n\t\tcase 0xB1:\r\n\t\tcase 0xB2:\r\n\t\tcase 0xB3:\r\n\t\tcase 0xB4:\r\n\t\tcase 0xB5:\r\n\t\tcase 0xB6:\r\n\t\tcase 0xB7:\r\n\t\tcase 0xB8:\r\n\t\tcase 0xB9:\r\n\t\tcase 0xBA:\r\n\t\tcase 0xBB:\r\n\t\tcase 0xBC:\r\n\t\tcase 0xBD:\r\n\t\tcase 0xBE:\r\n\t\tcase 0xBF:\r\n\t\t\tcount = c - 0xA0;\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_nil:\r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_null(ctx));\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedA\t: // RLE Encoding\r\n\t\t\t// Do nothing here.\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_false \t: \r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_boolean(ctx,0));\t// False\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_true \t\t: \r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_boolean(ctx,1));\t// True\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedB\t: \r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedC\t: \r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedD\t: \r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedE\t: \r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedF\t: \r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_reservedG\t: \r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_float \t: \r\n\t\t\tcount = (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_double(ctx,(double)(*((float*)(&count)))));\t// Int -> Float raw memory -> Double.\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_double \t: \r\n\t\t\tcount\t\t= (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tlongValue\t= count;\r\n\t\t\tlongValue  <<= 32;\r\n\t\t\tcount\t\t= (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tlongValue\t|= count;\r\n\r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_double(ctx,(*((double*)(&longValue)))));\t// Int64 -> Double raw memory\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase MSG_PACK_uint_8 \t: \r\n\t\t\tcount = *ptr++;\r\n\t\t\tgoto performIntCall;\r\n\t\t\t\r\n\t\tcase MSG_PACK_uint_16 \t: \r\n\t\t\tcount = (ptr[0]<<8) | ptr[1]; ptr+=2;\r\n\t\t\tgoto performIntCall;\r\n\t\t\t\r\n\t\tcase MSG_PACK_uint_32 \t: \r\n\t\t\tcount\t\t= (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tlongValue\t= (unsigned int)count;\r\n\r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx,longValue));\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase MSG_PACK_uint_64 \t: \r\n\t\tcase MSG_PACK_int_64 \t: \r\n\t\t\tcount\t\t= (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tlongValue\t= count;\r\n\t\t\tlongValue  <<= 32;\r\n\t\t\tcount\t\t= (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tlongValue\t|= count;\r\n\r\n\t\t\tdo {\r\n\t\t\t\tCHCK_PARSER_LOOP(callbacks->yajl_integer(ctx,longValue));\r\n\t\t\t} while (--rle);\r\n\t\t\ttype = currBlockType;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase MSG_PACK_int_8 \t: \r\n\t\t\tcount = (char)*ptr++;\r\n\t\t\tgoto performIntCall;\r\n\t\t\t\r\n\t\tcase MSG_PACK_int_16 \t: \r\n\t\t\tcount = (short)((ptr[0]<<8) | ptr[1]); ptr+=2;\r\n\t\t\tgoto performIntCall;\r\n\t\t\t\r\n\t\tcase MSG_PACK_int_32 \t: \r\n\t\t\tcount = (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tgoto performIntCall;\r\n\t\t\t\r\n\t\tcase MSG_PACK_reservedH\t: \r\n\t\tcase MSG_PACK_reservedI\t: \r\n\t\tcase MSG_PACK_reservedJ\t: \r\n\t\tcase MSG_PACK_reservedK\t: \r\n\t\tcase MSG_PACK_reservedL\t: \r\n\t\tcase MSG_PACK_reservedM\t: \r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase MSG_PACK_raw_16 \t: \r\n\t\t\tcount = (short)((ptr[0]<<8) | ptr[1]); ptr+=2;\r\n\t\t\tif (type == 1) {\r\n\t\t\t\t// Key.\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_map_key(ctx,ptr,count,-1));\r\n\t\t\t} else {\r\n\t\t\t\t// String.\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_string(ctx,ptr,count,-1));\r\n\t\t\t\ttype = currBlockType;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_raw_32 \t: \r\n\t\t\tcount = (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tif (type == 1) {\r\n\t\t\t\t// Key.\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_map_key(ctx,ptr,count,-1));\r\n\t\t\t} else {\r\n\t\t\t\t// String.\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_string(ctx,ptr,count,-1));\r\n\t\t\t\ttype = currBlockType;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MSG_PACK_array_16 \t: \r\n\t\t\tcount = (unsigned short)((ptr[0]<<8) | ptr[1]); ptr+=2;\r\n\t\t\tstackCount\t[++stackDepth]\t= count;\r\n\t\t\tstackType\t[stackDepth]\t= 1;\r\n\t\t\tCHCK_PARSER(callbacks->yajl_start_array(ctx, count));\r\n\t\t\tcurrBlockType = 1;\r\n\t\t\tgoto shortCut;\r\n\t\tcase MSG_PACK_array_32 \t: \r\n\t\t\tcount = (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tstackCount[++stackDepth]\t= (unsigned int)count;\r\n\t\t\tstackType\t[stackDepth]\t= 1;\r\n\t\t\tCHCK_PARSER(callbacks->yajl_start_array(ctx, (unsigned int)count));\r\n\t\t\tcurrBlockType = 1;\r\n\t\t\tgoto shortCut;\r\n\t\tcase MSG_PACK_map_16 \t: \r\n\t\t\tcount = (unsigned short)((ptr[0]<<8) | ptr[1]); ptr+=2;\r\n\t\t\tstackCount[++stackDepth]\t= (unsigned int)count;\r\n\t\t\tstackType\t[stackDepth]\t= 0;\r\n\t\t\tCHCK_PARSER(callbacks->yajl_start_map(ctx, count));\r\n\t\t\tcurrBlockType = 0;\r\n\t\t\tgoto shortCut;\r\n\t\tcase MSG_PACK_map_32 \t: \r\n\t\t\tcount = (int)((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]); ptr+=4;\r\n\t\t\tstackCount[++stackDepth]\t= (unsigned int)count;\r\n\t\t\tstackType\t[stackDepth]\t= 0;\r\n\t\t\tCHCK_PARSER(callbacks->yajl_start_map(ctx, (unsigned int)count));\r\n\t\t\tcurrBlockType = 0;\r\n\t\t\tgoto shortCut;\r\n\t\t}\r\n\t\t\r\n\t\tif ((stackDepth > 0) && ((--stackCount[stackDepth]) == 0)) {\r\n\t\t\tif (stackType[stackDepth] == 0) {\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_end_array(ctx));\r\n\t\t\t} else {\r\n\t\t\t\tCHCK_PARSER(callbacks->yajl_end_map(ctx));\r\n\t\t\t}\r\n\t\t\tstackDepth--;\r\n\t\t\tcurrBlockType = stackType[stackDepth];\r\n\t\t\ttype = currBlockType;\r\n\t\t}\r\n\t}\r\n\r\n\treturn error;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#include \"api/yajl_parse.h\"\r\n#include \"yajl_lex.h\"\r\n#include \"yajl_parser.h\"\r\n#include \"yajl_alloc.h\"\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <stdarg.h>\r\n#include <assert.h>\r\n\r\nconst char *\r\nyajl_status_to_string(yajl_status stat)\r\n{\r\n    const char * statStr = \"unknown\";\r\n    switch (stat) {\r\n        case yajl_status_ok:\r\n            statStr = \"ok, no error\";\r\n            break;\r\n        case yajl_status_client_canceled:\r\n            statStr = \"client canceled parse\";\r\n            break;\r\n        case yajl_status_error:\r\n            statStr = \"parse error\";\r\n            break;\r\n    }\r\n    return statStr;\r\n}\r\n\r\n#include <stdio.h>\r\nint debugCommandCount = 0;\r\n\r\n// Use this macro only when tracking Binary JSon or Message Pack.\r\n// #define INTERNAL_DEBUG_JSON_PARSER\r\n\r\nyajl_callbacks debug_route = {\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL,\r\n\tNULL\r\n};\r\n\r\n/* bunch of forward declarations */\r\nint log_null(void * ctx);\r\nint log_boolean(void * ctx, int boolVal);\r\nint log_integer(void * ctx, long long integerVal);\r\nint log_double(void * ctx, double doubleVal);\r\nint log_string(void * ctx, const unsigned char * stringVal,\r\n               size_t stringLen, int cte_pool);\r\nint log_startmap(void * ctx, unsigned int size);\r\nint log_endarray(void * ctx);\r\nint log_mapkey(void * ctx, const unsigned char * key,\r\n               size_t stringLen, int cte_pool);\r\nint log_endmap(void * ctx);\r\nint log_startarray(void * ctx, unsigned int size);\r\n\r\nint log_null(void * ctx) {\r\n\tprintf(\"Command %8i Null\\n\",debugCommandCount);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_null(ctx);\r\n}\r\n\r\nint log_boolean(void * ctx, int boolVal) {\r\n\tprintf(\"Command %8i Boolean %i\\n\",debugCommandCount, boolVal);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_boolean(ctx,boolVal);\r\n}\r\n\r\nint log_integer(void * ctx, long long integerVal) {\r\n\tprintf(\"Command %8i Integer %lli\\n\",debugCommandCount, integerVal);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_integer(ctx, integerVal);\r\n}\r\n\r\nint log_double(void * ctx, double doubleVal) {\r\n\tprintf(\"Command %8i Double %f\\n\",debugCommandCount, doubleVal);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_double(ctx, doubleVal);\r\n}\r\n\r\nint log_string(void * ctx, const unsigned char * stringVal,\r\n                    size_t stringLen, int cte_pool) {\r\n\tunsigned int n;\r\n\tprintf(\"Command %8i String[%i] '\",debugCommandCount, (int)stringLen);\r\n\tfor (n=0; n<stringLen; n++) {\r\n\t\tprintf(\"%c\",stringVal[n]);\r\n\t}\r\n\tprintf(\"'\\n\");\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_string(ctx, stringVal, stringLen, cte_pool);\r\n}\r\n\r\nint log_startmap(void * ctx, unsigned int size) {\r\n\tprintf(\"Command %8i StartMap\\n\",debugCommandCount);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_start_map(ctx, size);\r\n}\r\n\r\nint log_mapkey(void * ctx, const unsigned char * key,\r\n                        size_t stringLen, int cte_pool) {\r\n\tprintf(\"Command %8i MapKey\\n\",debugCommandCount);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_map_key(ctx, key, stringLen, cte_pool);\r\n}\r\n\r\nint log_endmap(void * ctx) {\r\n\tprintf(\"Command %8i EndMap\\n\",debugCommandCount);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_end_map(ctx);\r\n}\r\n\r\nint log_startarray(void * ctx, unsigned int size) {\r\n\tprintf(\"Command %8i StartArray\\n\",debugCommandCount);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_start_array(ctx, size);\r\n}\r\n\r\nint log_endarray(void * ctx) {\r\n\tprintf(\"Command %8i EndArray\\n\",debugCommandCount);\r\n\tdebugCommandCount++;\r\n\treturn debug_route.yajl_end_array(ctx);\r\n}\r\n\r\nyajl_callbacks debugcallbacks = {\r\n\tlog_null,\r\n\tlog_boolean,\r\n\tlog_integer,\r\n\tlog_double,\r\n\tNULL,\r\n\tlog_string,\r\n\tlog_startmap,\r\n\tlog_mapkey,\r\n\tlog_endmap,\r\n\tlog_startarray,\r\n\tlog_endarray\r\n};\r\n\r\nyajl_handle\r\nyajl_alloc(const yajl_callbacks * callbacks,\r\n           yajl_alloc_funcs * afs,\r\n           void * ctx)\r\n{\r\n    yajl_handle hand = NULL;\r\n    yajl_alloc_funcs afsBuffer;\r\n\r\n    /* first order of business is to set up memory allocation routines */\r\n    if (afs != NULL) {\r\n        if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL)\r\n        {\r\n            return NULL;\r\n        }\r\n    } else {\r\n        yajl_set_default_alloc_funcs(&afsBuffer);\r\n        afs = &afsBuffer;\r\n    }\r\n\r\n    hand = (yajl_handle) YA_MALLOC(afs, sizeof(struct yajl_handle_t));\r\n\r\n    /* copy in pointers to allocation routines */\r\n    memcpy((void *) &(hand->alloc), (void *) afs, sizeof(yajl_alloc_funcs));\r\n\r\n#ifndef INTERNAL_DEBUG_JSON_PARSER\r\n\thand->callbacks = callbacks;\r\n\thand->ctx = ctx;\r\n#else\r\n\thand->callbacks\t\t= &debugcallbacks;\r\n\tdebug_route\t\t\t= *callbacks;\r\n\thand->ctx\t\t\t= ctx;\r\n\tdebugCommandCount\t= 0;\r\n#endif\r\n    hand->lexer = NULL; \r\n    hand->bytesConsumed = 0;\r\n    hand->decodeBuf = yajl_buf_alloc(&(hand->alloc));\r\n    hand->flags\t    = 0;\r\n    yajl_bs_init(hand->stateStack, &(hand->alloc));\r\n    yajl_bs_push(hand->stateStack, yajl_state_start);\r\n\r\n\t//\r\n\t// Binary JSon Parser\r\n\t//\r\n\thand->bj.afs\t\t= afs;\r\n\thand->bj.callbacks\t= callbacks;\r\n\thand->bj.cp\t\t\t= NULL;\r\n\thand->bj.ctx\t\t= ctx;\r\n\thand->bj.strs\t\t= NULL;\r\n\thand->bj.used\t\t= 0;\r\n\r\n    return hand;\r\n}\r\n\r\nint\r\nyajl_config(yajl_handle h, yajl_option opt, ...)\r\n{\r\n\tint rv = 1;\r\n\tif (h->bj.used == 0) {\r\n\t\tva_list ap;\r\n\t\tva_start(ap, opt);\r\n\r\n\t\tswitch(opt) {\r\n\t\t\tcase yajl_allow_comments:\r\n\t\t\tcase yajl_dont_validate_strings:\r\n\t\t\tcase yajl_allow_trailing_garbage:\r\n\t\t\tcase yajl_allow_multiple_values:\r\n\t\t\tcase yajl_allow_partial_values:\r\n\t\t\t\tif (va_arg(ap, int)) h->flags |= opt;\r\n\t\t\t\telse h->flags &= ~opt;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\trv = 0;\r\n\t\t}\r\n\t\tva_end(ap);\r\n\t}\r\n\r\n    return rv;\r\n}\r\n\r\nvoid\r\nyajl_free(yajl_handle handle)\r\n{\r\n\t//\r\n\t// Binary JSon\r\n\t//\r\n\tif (handle->bj.cp)\t\tYA_FREE(&(handle->alloc), handle->bj.cp);\r\n\tif (handle->bj.strs)\tYA_FREE(&(handle->alloc), handle->bj.strs);\r\n\r\n    yajl_bs_free(handle->stateStack);\r\n    yajl_buf_free(handle->decodeBuf);\r\n    if (handle->lexer) {\r\n        yajl_lex_free(handle->lexer);\r\n        handle->lexer = NULL;\r\n    }\r\n    YA_FREE(&(handle->alloc), handle);\r\n}\r\n\r\nyajl_status\r\nyajl_parse(yajl_handle hand, const unsigned char * jsonText,\r\n           size_t jsonTextLen)\r\n{\r\n    yajl_status status;\r\n\r\n\tif (jsonTextLen >= 2) {\r\n\t\tif (jsonText[0] == 0xFF && jsonText[1] == 0xFF) {\r\n\t\t\thand->bj.used = 1;\r\n\t\t\treturn (yajl_status)bjson_parse(hand,jsonText,jsonTextLen);\r\n\t\t} else if ((jsonText[0] >= 0xDC) && (jsonText[0] <= 0xDF)) {\r\n\t\t\thand->msgpack.used = 1;\r\n\t\t\treturn (yajl_status)msgpack_parse(hand,jsonText,jsonTextLen);\r\n\t\t}\r\n\t}\r\n\r\n    /* lazy allocation of the lexer */\r\n    if (hand->lexer == NULL) {\r\n        hand->lexer = yajl_lex_alloc(&(hand->alloc),\r\n                                     hand->flags & yajl_allow_comments,\r\n                                     !(hand->flags & yajl_dont_validate_strings));\r\n    }\r\n\r\n    status = yajl_do_parse(hand, jsonText, jsonTextLen);\r\n    return status;\r\n}\r\n\r\n\r\nyajl_status\r\nyajl_complete_parse(yajl_handle hand)\r\n{\r\n\tif (hand->bj.used) {\r\n\t\treturn yajl_status_ok;\r\n\t}\r\n\r\n    /* The lexer is lazy allocated in the first call to parse.  if parse is\r\n     * never called, then no data was provided to parse at all.  This is a\r\n     * \"premature EOF\" error unless yajl_allow_partial_values is specified.\r\n     * allocating the lexer now is the simplest possible way to handle this\r\n     * case while preserving all the other semantics of the parser\r\n     * (multiple values, partial values, etc). */\r\n    if (hand->lexer == NULL) {\r\n        hand->lexer = yajl_lex_alloc(&(hand->alloc),\r\n                                     hand->flags & yajl_allow_comments,\r\n                                     !(hand->flags & yajl_dont_validate_strings));\r\n    }\r\n\r\n    return yajl_do_finish(hand);\r\n}\r\n\r\nunsigned char *\r\nyajl_get_error(yajl_handle hand, int verbose,\r\n               const unsigned char * jsonText, size_t jsonTextLen)\r\n{\r\n    return yajl_render_error_string(hand, jsonText, jsonTextLen, verbose);\r\n}\r\n\r\nsize_t\r\nyajl_get_bytes_consumed(yajl_handle hand)\r\n{\r\n    if (!hand) return 0;\r\n    else return hand->bytesConsumed;\r\n}\r\n\r\n\r\nvoid\r\nyajl_free_error(yajl_handle hand, unsigned char * str)\r\n{\r\n    /* use memory allocation functions if set */\r\n    YA_FREE(&(hand->alloc), str);\r\n}\r\n\r\n/* XXX: add utility routines to parse from file */\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_alloc.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n/**\r\n * \\file yajl_alloc.h\r\n * default memory allocation routines for yajl which use malloc/realloc and\r\n * free\r\n */\r\n\r\n#include \"yajl_alloc.h\"\r\n#include <stdlib.h>\r\n\r\nstatic void * yajl_internal_malloc(void * ctx, size_t sz)\r\n{\r\n\t(void)ctx;\r\n    return malloc(sz);\r\n}\r\n\r\nstatic void * yajl_internal_realloc(void * ctx, void * previous,\r\n                                    size_t sz)\r\n{\r\n\t(void)ctx;\r\n    return realloc(previous, sz);\r\n}\r\n\r\nstatic void yajl_internal_free(void * ctx, void * ptr)\r\n{\r\n\t(void)ctx;\r\n    free(ptr);\r\n}\r\n\r\nvoid yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf)\r\n{\r\n    yaf->malloc = yajl_internal_malloc;\r\n    yaf->free = yajl_internal_free;\r\n    yaf->realloc = yajl_internal_realloc;\r\n    yaf->ctx = NULL;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_alloc.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n/**\r\n * \\file yajl_alloc.h\r\n * default memory allocation routines for yajl which use malloc/realloc and\r\n * free\r\n */\r\n\r\n#ifndef __YAJL_ALLOC_H__\r\n#define __YAJL_ALLOC_H__\r\n\r\n#include \"api/yajl_common.h\"\r\n\r\n#define YA_MALLOC(afs, sz) (afs)->malloc((afs)->ctx, (sz))\r\n#define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr))\r\n#define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz))\r\n\r\nvoid yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_assert.h",
    "content": "#ifndef __YAJL_ASSERT__\r\n#define __YAJL_ASSERT__\r\n\r\n#define assert(c)\t\t(!(c))\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_buf.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#include \"yajl_buf.h\"\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#include \"yajl_assert.h\"\r\n\r\n#define YAJL_BUF_INIT_SIZE 2048\r\n\r\nstruct yajl_buf_t {\r\n    size_t len;\r\n    size_t used;\r\n    unsigned char * data;\r\n    yajl_alloc_funcs * alloc;\r\n};\r\n\r\nstatic\r\nvoid yajl_buf_ensure_available(yajl_buf buf, size_t want)\r\n{\r\n    size_t need;\r\n    \r\n    (void)assert(buf != NULL);\r\n\r\n    /* first call */\r\n    if (buf->data == NULL) {\r\n        buf->len = YAJL_BUF_INIT_SIZE;\r\n        buf->data = (unsigned char *) YA_MALLOC(buf->alloc, buf->len);\r\n        buf->data[0] = 0;\r\n    }\r\n\r\n    need = buf->len;\r\n\r\n    while (want >= (need - buf->used)) need <<= 1;\r\n\r\n    if (need != buf->len) {\r\n        buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need);\r\n        buf->len = need;\r\n    }\r\n}\r\n\r\nyajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc)\r\n{\r\n    yajl_buf b = YA_MALLOC(alloc, sizeof(struct yajl_buf_t));\r\n    memset((void *) b, 0, sizeof(struct yajl_buf_t));\r\n    b->alloc = alloc;\r\n    return b;\r\n}\r\n\r\nvoid yajl_buf_free(yajl_buf buf)\r\n{\r\n    (void)assert(buf != NULL);\r\n    if (buf->data) YA_FREE(buf->alloc, buf->data);\r\n    YA_FREE(buf->alloc, buf);\r\n}\r\n\r\nvoid yajl_buf_append(yajl_buf buf, const void * data, size_t len)\r\n{\r\n    yajl_buf_ensure_available(buf, len);\r\n    if (len > 0) {\r\n        (void)assert(data != NULL);\r\n        memcpy(buf->data + buf->used, data, len);\r\n        buf->used += len;\r\n        buf->data[buf->used] = 0;\r\n    }\r\n}\r\n\r\nvoid yajl_buf_clear(yajl_buf buf)\r\n{\r\n    buf->used = 0;\r\n    if (buf->data) buf->data[buf->used] = 0;\r\n}\r\n\r\nconst unsigned char * yajl_buf_data(yajl_buf buf)\r\n{\r\n    return buf->data;\r\n}\r\n\r\nsize_t yajl_buf_len(yajl_buf buf)\r\n{\r\n    return buf->used;\r\n}\r\n\r\nvoid\r\nyajl_buf_truncate(yajl_buf buf, size_t len)\r\n{\r\n    (void)assert(len <= buf->used);\r\n    buf->used = len;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_buf.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#ifndef __YAJL_BUF_H__\r\n#define __YAJL_BUF_H__\r\n\r\n#include \"api/yajl_common.h\"\r\n#include \"yajl_alloc.h\"\r\n\r\n/*\r\n * Implementation/performance notes.  If this were moved to a header\r\n * only implementation using #define's where possible we might be \r\n * able to sqeeze a little performance out of the guy by killing function\r\n * call overhead.  YMMV.\r\n */\r\n\r\n/**\r\n * yajl_buf is a buffer with exponential growth.  the buffer ensures that\r\n * you are always null padded.\r\n */\r\ntypedef struct yajl_buf_t * yajl_buf;\r\n\r\n/* allocate a new buffer */\r\nyajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc);\r\n\r\n/* free the buffer */\r\nvoid yajl_buf_free(yajl_buf buf);\r\n\r\n/* append a number of bytes to the buffer */\r\nvoid yajl_buf_append(yajl_buf buf, const void * data, size_t len);\r\n\r\n/* empty the buffer */\r\nvoid yajl_buf_clear(yajl_buf buf);\r\n\r\n/* get a pointer to the beginning of the buffer */\r\nconst unsigned char * yajl_buf_data(yajl_buf buf);\r\n\r\n/* get the length of the buffer */\r\nsize_t yajl_buf_len(yajl_buf buf);\r\n\r\n/* truncate the buffer */\r\nvoid yajl_buf_truncate(yajl_buf buf, size_t len);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_bytestack.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n/*\r\n * A header only implementation of a simple stack of bytes, used in YAJL\r\n * to maintain parse state.\r\n */\r\n\r\n#ifndef __YAJL_BYTESTACK_H__\r\n#define __YAJL_BYTESTACK_H__\r\n\r\n#include \"api/yajl_common.h\"\r\n\r\n#define YAJL_BS_INC 128\r\n\r\ntypedef struct yajl_bytestack_t\r\n{\r\n    unsigned char * stack;\r\n    size_t size;\r\n    size_t used;\r\n    yajl_alloc_funcs * yaf;\r\n} yajl_bytestack;\r\n\r\n/* initialize a bytestack */\r\n#define yajl_bs_init(obs, _yaf) {               \\\r\n        (obs).stack = NULL;                     \\\r\n        (obs).size = 0;                         \\\r\n        (obs).used = 0;                         \\\r\n        (obs).yaf = (_yaf);                     \\\r\n    }                                           \\\r\n\r\n\r\n/* initialize a bytestack */\r\n#define yajl_bs_free(obs)                 \\\r\n    if ((obs).stack) (obs).yaf->free((obs).yaf->ctx, (obs).stack);\r\n\r\n#define yajl_bs_current(obs)               \\\r\n    ((void)assert((obs).used > 0), (obs).stack[(obs).used - 1])\r\n\r\n#define yajl_bs_push(obs, byte) {                       \\\r\n    if (((obs).size - (obs).used) == 0) {               \\\r\n        (obs).size += YAJL_BS_INC;                      \\\r\n        (obs).stack = (obs).yaf->realloc((obs).yaf->ctx,\\\r\n                                         (void *) (obs).stack, (obs).size);\\\r\n    }                                                   \\\r\n    (obs).stack[((obs).used)++] = (byte);               \\\r\n}\r\n\r\n/* removes the top item of the stack, returns nothing */\r\n#define yajl_bs_pop(obs) { ((obs).used)--; }\r\n\r\n#define yajl_bs_set(obs, byte)                          \\\r\n    (obs).stack[((obs).used) - 1] = (byte);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_encode.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n// Ignore Warnings\r\n// C4130 : 'operator' : logical operation on address of string constant\r\n#pragma warning( disable : 4130 )\r\n\r\n\r\n#include \"yajl_encode.h\"\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <stdio.h>\r\n\r\n#include \"yajl_assert.h\"\r\n\r\nstatic void CharToHex(unsigned char c, char * hexBuf)\r\n{\r\n    const char * hexchar = \"0123456789ABCDEF\";\r\n    hexBuf[0] = hexchar[c >> 4];\r\n    hexBuf[1] = hexchar[c & 0x0F];\r\n}\r\n\r\nvoid\r\nyajl_string_encode(const yajl_print_t print,\r\n                   void * ctx,\r\n                   const unsigned char * str,\r\n                   size_t len,\r\n                   int escape_solidus)\r\n{\r\n    size_t beg = 0;\r\n    size_t end = 0;\r\n    char hexBuf[7];\r\n    hexBuf[0] = '\\\\'; hexBuf[1] = 'u'; hexBuf[2] = '0'; hexBuf[3] = '0';\r\n    hexBuf[6] = 0;\r\n\r\n    while (end < len) {\r\n        const char * escaped = NULL;\r\n        switch (str[end]) {\r\n            case '\\r': escaped = \"\\\\r\"; break;\r\n            case '\\n': escaped = \"\\\\n\"; break;\r\n            case '\\\\': escaped = \"\\\\\\\\\"; break;\r\n            /* it is not required to escape a solidus in JSON:\r\n             * read sec. 2.5: http://www.ietf.org/rfc/rfc4627.txt\r\n             * specifically, this production from the grammar:\r\n             *   unescaped = %x20-21 / %x23-5B / %x5D-10FFFF\r\n             */\r\n            case '/': if (escape_solidus) escaped = \"\\\\/\"; break;\r\n            case '\"': escaped = \"\\\\\\\"\"; break;\r\n            case '\\f': escaped = \"\\\\f\"; break;\r\n            case '\\b': escaped = \"\\\\b\"; break;\r\n            case '\\t': escaped = \"\\\\t\"; break;\r\n            default:\r\n                if ((unsigned char) str[end] < 32) {\r\n                    CharToHex(str[end], hexBuf + 4);\r\n                    escaped = hexBuf;\r\n                }\r\n                break;\r\n        }\r\n        if (escaped != NULL) {\r\n            print(ctx, (const char *) (str + beg), end - beg);\r\n            print(ctx, escaped, (unsigned int)strlen(escaped));\r\n            beg = ++end;\r\n        } else {\r\n            ++end;\r\n        }\r\n    }\r\n    print(ctx, (const char *) (str + beg), end - beg);\r\n}\r\n\r\nstatic void hexToDigit(unsigned int * val, const unsigned char * hex)\r\n{\r\n    unsigned int i;\r\n    for (i=0;i<4;i++) {\r\n        unsigned char c = hex[i];\r\n        if (c >= 'A') c = (c & ~0x20) - 7;\r\n        c -= '0';\r\n        (void)assert(!(c & 0xF0));\r\n        *val = (*val << 4) | c;\r\n    }\r\n}\r\n\r\nstatic void Utf32toUtf8(unsigned int codepoint, char * utf8Buf) \r\n{\r\n    if (codepoint < 0x80) {\r\n        utf8Buf[0] = (char) codepoint;\r\n        utf8Buf[1] = 0;\r\n    } else if (codepoint < 0x0800) {\r\n        utf8Buf[0] = (char) ((codepoint >> 6) | 0xC0);\r\n        utf8Buf[1] = (char) ((codepoint & 0x3F) | 0x80);\r\n        utf8Buf[2] = 0;\r\n    } else if (codepoint < 0x10000) {\r\n        utf8Buf[0] = (char) ((codepoint >> 12) | 0xE0);\r\n        utf8Buf[1] = (char) (((codepoint >> 6) & 0x3F) | 0x80);\r\n        utf8Buf[2] = (char) ((codepoint & 0x3F) | 0x80);\r\n        utf8Buf[3] = 0;\r\n    } else if (codepoint < 0x200000) {\r\n        utf8Buf[0] =(char)((codepoint >> 18) | 0xF0);\r\n        utf8Buf[1] =(char)(((codepoint >> 12) & 0x3F) | 0x80);\r\n        utf8Buf[2] =(char)(((codepoint >> 6) & 0x3F) | 0x80);\r\n        utf8Buf[3] =(char)((codepoint & 0x3F) | 0x80);\r\n        utf8Buf[4] = 0;\r\n    } else {\r\n        utf8Buf[0] = '?';\r\n        utf8Buf[1] = 0;\r\n    }\r\n}\r\n\r\nvoid yajl_string_decode(yajl_buf buf, const unsigned char * str,\r\n                        size_t len)\r\n{\r\n    size_t beg = 0;\r\n    size_t end = 0;    \r\n\r\n    while (end < len) {\r\n        if (str[end] == '\\\\') {\r\n            char utf8Buf[5];\r\n            const char * unescaped = \"?\";\r\n            yajl_buf_append(buf, str + beg, end - beg);\r\n            switch (str[++end]) {\r\n                case 'r': unescaped = \"\\r\"; break;\r\n                case 'n': unescaped = \"\\n\"; break;\r\n                case '\\\\': unescaped = \"\\\\\"; break;\r\n                case '/': unescaped = \"/\"; break;\r\n                case '\"': unescaped = \"\\\"\"; break;\r\n                case 'f': unescaped = \"\\f\"; break;\r\n                case 'b': unescaped = \"\\b\"; break;\r\n                case 't': unescaped = \"\\t\"; break;\r\n                case 'u': {\r\n                    unsigned int codepoint = 0;\r\n                    hexToDigit(&codepoint, str + ++end);\r\n                    end+=3;\r\n                    /* check if this is a surrogate */\r\n                    if ((codepoint & 0xFC00) == 0xD800) {\r\n                        end++;\r\n                        if (str[end] == '\\\\' && str[end + 1] == 'u') {\r\n                            unsigned int surrogate = 0;\r\n                            hexToDigit(&surrogate, str + end + 2);\r\n                            codepoint =\r\n                                (((codepoint & 0x3F) << 10) | \r\n                                 ((((codepoint >> 6) & 0xF) + 1) << 16) | \r\n                                 (surrogate & 0x3FF));\r\n                            end += 5;\r\n                        } else {\r\n                            unescaped = \"?\";\r\n                            break;\r\n                        }\r\n                    }\r\n                    \r\n                    Utf32toUtf8(codepoint, utf8Buf);\r\n                    unescaped = utf8Buf;\r\n\r\n                    if (codepoint == 0) {\r\n                        yajl_buf_append(buf, unescaped, 1);\r\n                        beg = ++end;\r\n                        continue;\r\n                    }\r\n\r\n                    break;\r\n                }\r\n                default:\r\n                    (void)assert(\"this should never happen\" == NULL);\r\n                    break;\r\n            }\r\n            yajl_buf_append(buf, unescaped, (unsigned int)strlen(unescaped));\r\n            beg = ++end;\r\n        } else {\r\n            end++;\r\n        }\r\n    }\r\n    yajl_buf_append(buf, str + beg, end - beg);\r\n}\r\n\r\n#define ADV_PTR s++; if (!(len--)) return 0;\r\n\r\nint yajl_string_validate_utf8(const unsigned char * s, size_t len)\r\n{\r\n    if (!len) return 1;\r\n    if (!s) return 0;\r\n    \r\n    while (len--) {\r\n        /* single byte */\r\n        if (*s <= 0x7f) {\r\n            /* noop */\r\n        }\r\n        /* two byte */ \r\n        else if ((*s >> 5) == 0x6) {\r\n            ADV_PTR;\r\n            if (!((*s >> 6) == 0x2)) return 0;\r\n        }\r\n        /* three byte */\r\n        else if ((*s >> 4) == 0x0e) {\r\n            ADV_PTR;\r\n            if (!((*s >> 6) == 0x2)) return 0;\r\n            ADV_PTR;\r\n            if (!((*s >> 6) == 0x2)) return 0;\r\n        }\r\n        /* four byte */        \r\n        else if ((*s >> 3) == 0x1e) {\r\n            ADV_PTR;\r\n            if (!((*s >> 6) == 0x2)) return 0;\r\n            ADV_PTR;\r\n            if (!((*s >> 6) == 0x2)) return 0;\r\n            ADV_PTR;\r\n            if (!((*s >> 6) == 0x2)) return 0;\r\n        } else {\r\n            return 0;\r\n        }\r\n        \r\n        s++;\r\n    }\r\n    \r\n    return 1;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_encode.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#ifndef __YAJL_ENCODE_H__\r\n#define __YAJL_ENCODE_H__\r\n\r\n#include \"yajl_buf.h\"\r\n#include \"api/yajl_gen.h\"\r\n\r\nvoid yajl_string_encode(const yajl_print_t printer,\r\n                        void * ctx,\r\n                        const unsigned char * str,\r\n                        size_t length,\r\n                        int escape_solidus);\r\n\r\nvoid yajl_string_decode(yajl_buf buf, const unsigned char * str,\r\n                        size_t length);\r\n\r\nint yajl_string_validate_utf8(const unsigned char * s, size_t len);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_gen.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#include \"api/yajl_gen.h\"\r\n#include \"yajl_buf.h\"\r\n#include \"yajl_encode.h\"\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <stdio.h>\r\n#include <math.h>\r\n#include <stdarg.h>\r\n\r\ntypedef enum {\r\n    yajl_gen_start,\r\n    yajl_gen_map_start,\r\n    yajl_gen_map_key,\r\n    yajl_gen_map_val,\r\n    yajl_gen_array_start,\r\n    yajl_gen_in_array,\r\n    yajl_gen_complete,\r\n    yajl_gen_error\r\n} yajl_gen_state;\r\n\r\nstruct yajl_gen_t\r\n{\r\n    unsigned int flags;\r\n    unsigned int depth;\r\n    const char * indentString;\r\n    yajl_gen_state state[YAJL_MAX_DEPTH];\r\n    yajl_print_t print;\r\n    void * ctx; /* yajl_buf */\r\n    /* memory allocation routines */\r\n    yajl_alloc_funcs alloc;\r\n};\r\n\r\nint\r\nyajl_gen_config(yajl_gen g, yajl_gen_option opt, ...)\r\n{\r\n    int rv = 1;\r\n    va_list ap;\r\n    va_start(ap, opt);\r\n\r\n    switch(opt) {\r\n        case yajl_gen_beautify:\r\n        case yajl_gen_validate_utf8:\r\n            if (va_arg(ap, int)) g->flags |= opt;\r\n            else g->flags &= ~opt;\r\n            break;\r\n        case yajl_gen_indent_string: {\r\n            const char *indent = va_arg(ap, const char *);\r\n            g->indentString = indent;\r\n            for (; *indent; indent++) {\r\n                if (*indent != '\\n'\r\n                    && *indent != '\\v'\r\n                    && *indent != '\\f'\r\n                    && *indent != '\\t'\r\n                    && *indent != '\\r'\r\n                    && *indent != ' ')\r\n                {\r\n                    g->indentString = NULL;\r\n                    rv = 0;\r\n                }\r\n            }\r\n            break;\r\n        }\r\n        case yajl_gen_print_callback:\r\n            yajl_buf_free(g->ctx);\r\n            g->print = va_arg(ap, const yajl_print_t);\r\n            g->ctx = va_arg(ap, void *);\r\n            break;\r\n        default:\r\n            rv = 0;\r\n    }\r\n\r\n    va_end(ap);\r\n\r\n    return rv;\r\n}\r\n\r\n\r\n\r\nyajl_gen\r\nyajl_gen_alloc(const yajl_alloc_funcs * afs)\r\n{\r\n    yajl_gen g = NULL;\r\n    yajl_alloc_funcs afsBuffer;\r\n\r\n    /* first order of business is to set up memory allocation routines */\r\n    if (afs != NULL) {\r\n        if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL)\r\n        {\r\n            return NULL;\r\n        }\r\n    } else {\r\n        yajl_set_default_alloc_funcs(&afsBuffer);\r\n        afs = &afsBuffer;\r\n    }\r\n\r\n    g = (yajl_gen) YA_MALLOC(afs, sizeof(struct yajl_gen_t));\r\n    if (!g) return NULL;\r\n\r\n    memset((void *) g, 0, sizeof(struct yajl_gen_t));\r\n    /* copy in pointers to allocation routines */\r\n    memcpy((void *) &(g->alloc), (void *) afs, sizeof(yajl_alloc_funcs));\r\n\r\n    g->print = (yajl_print_t)&yajl_buf_append;\r\n    g->ctx = yajl_buf_alloc(&(g->alloc));\r\n    g->indentString = \"    \";\r\n\r\n    return g;\r\n}\r\n\r\nvoid\r\nyajl_gen_free(yajl_gen g)\r\n{\r\n    if (g->print == (yajl_print_t)&yajl_buf_append) yajl_buf_free((yajl_buf)g->ctx);\r\n    YA_FREE(&(g->alloc), g);\r\n}\r\n\r\n#define INSERT_SEP \\\r\n    if (g->state[g->depth] == yajl_gen_map_key ||               \\\r\n        g->state[g->depth] == yajl_gen_in_array) {              \\\r\n        g->print(g->ctx, \",\", 1);                               \\\r\n        if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, \"\\n\", 1);               \\\r\n    } else if (g->state[g->depth] == yajl_gen_map_val) {        \\\r\n        g->print(g->ctx, \":\", 1);                               \\\r\n        if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, \" \", 1);                \\\r\n   } \r\n\r\n#define INSERT_WHITESPACE                                               \\\r\n    if ((g->flags & yajl_gen_beautify)) {                                                    \\\r\n        if (g->state[g->depth] != yajl_gen_map_val) {                   \\\r\n            unsigned int _i;                                            \\\r\n            for (_i=0;_i<g->depth;_i++)                                 \\\r\n                g->print(g->ctx,                                        \\\r\n                         g->indentString,                               \\\r\n                         (unsigned int)strlen(g->indentString));        \\\r\n        }                                                               \\\r\n    }\r\n\r\n#define ENSURE_NOT_KEY \\\r\n    if (g->state[g->depth] == yajl_gen_map_key ||       \\\r\n        g->state[g->depth] == yajl_gen_map_start)  {    \\\r\n        return yajl_gen_keys_must_be_strings;           \\\r\n    }                                                   \\\r\n\r\n/* check that we're not complete, or in error state.  in a valid state\r\n * to be generating */\r\n#define ENSURE_VALID_STATE \\\r\n    if (g->state[g->depth] == yajl_gen_error) {   \\\r\n        return yajl_gen_in_error_state;\\\r\n    } else if (g->state[g->depth] == yajl_gen_complete) {   \\\r\n        return yajl_gen_generation_complete;                \\\r\n    }\r\n\r\n#define INCREMENT_DEPTH \\\r\n    if (++(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded;\r\n\r\n#define DECREMENT_DEPTH \\\r\n  if (--(g->depth) >= YAJL_MAX_DEPTH) return yajl_gen_error;\r\n\r\n#define APPENDED_ATOM \\\r\n    switch (g->state[g->depth]) {                   \\\r\n        case yajl_gen_start:                        \\\r\n            g->state[g->depth] = yajl_gen_complete; \\\r\n            break;                                  \\\r\n        case yajl_gen_map_start:                    \\\r\n        case yajl_gen_map_key:                      \\\r\n            g->state[g->depth] = yajl_gen_map_val;  \\\r\n            break;                                  \\\r\n        case yajl_gen_array_start:                  \\\r\n            g->state[g->depth] = yajl_gen_in_array; \\\r\n            break;                                  \\\r\n        case yajl_gen_map_val:                      \\\r\n            g->state[g->depth] = yajl_gen_map_key;  \\\r\n            break;                                  \\\r\n        default:                                    \\\r\n            break;                                  \\\r\n    }                                               \\\r\n\r\n#define FINAL_NEWLINE                                        \\\r\n    if ((g->flags & yajl_gen_beautify) && g->state[g->depth] == yajl_gen_complete) \\\r\n        g->print(g->ctx, \"\\n\", 1);\r\n\r\nyajl_gen_status\r\nyajl_gen_integer(yajl_gen g, long long int number)\r\n{\r\n    char i[32];\r\n    ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;\r\n    sprintf(i, \"%lld\", number);\r\n    g->print(g->ctx, i, (unsigned int)strlen(i));\r\n    APPENDED_ATOM;\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\n#ifdef WIN32\r\n#include <float.h>\r\n#define isnan _isnan\r\n#define isinf !_finite\r\n#endif\r\n\r\nyajl_gen_status\r\nyajl_gen_double(yajl_gen g, double number)\r\n{\r\n    char i[32];\r\n    ENSURE_VALID_STATE; ENSURE_NOT_KEY; \r\n    if (isnan(number) || isinf(number)) return yajl_gen_invalid_number;\r\n    INSERT_SEP; INSERT_WHITESPACE;\r\n    sprintf(i, \"%.20g\", number);\r\n    g->print(g->ctx, i, (unsigned int)strlen(i));\r\n    APPENDED_ATOM;\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_number(yajl_gen g, const char * s, size_t l)\r\n{\r\n    ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;\r\n    g->print(g->ctx, s, l);\r\n    APPENDED_ATOM;\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_string(yajl_gen g, const unsigned char * str,\r\n                size_t len)\r\n{\r\n    // if validation is enabled, check that the string is valid utf8\r\n    // XXX: This checking could be done a little faster, in the same pass as\r\n    // the string encoding\r\n    if (g->flags & yajl_gen_validate_utf8) {\r\n        if (!yajl_string_validate_utf8(str, len)) {\r\n            return yajl_gen_invalid_string;\r\n        }\r\n    }\r\n    ENSURE_VALID_STATE; INSERT_SEP; INSERT_WHITESPACE;\r\n    g->print(g->ctx, \"\\\"\", 1);\r\n    yajl_string_encode(g->print, g->ctx, str, len, g->flags & yajl_gen_escape_solidus);\r\n    g->print(g->ctx, \"\\\"\", 1);\r\n    APPENDED_ATOM;\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_null(yajl_gen g)\r\n{\r\n    ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;\r\n    g->print(g->ctx, \"null\", strlen(\"null\"));\r\n    APPENDED_ATOM;\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_bool(yajl_gen g, int boolean)\r\n{\r\n    const char * val = boolean ? \"true\" : \"false\";\r\n\r\n\tENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;\r\n    g->print(g->ctx, val, (unsigned int)strlen(val));\r\n    APPENDED_ATOM;\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_map_open(yajl_gen g)\r\n{\r\n    ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;\r\n    INCREMENT_DEPTH; \r\n    \r\n    g->state[g->depth] = yajl_gen_map_start;\r\n    g->print(g->ctx, \"{\", 1);\r\n    if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, \"\\n\", 1);\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_map_close(yajl_gen g)\r\n{\r\n    ENSURE_VALID_STATE; \r\n    DECREMENT_DEPTH;\r\n    \r\n    if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, \"\\n\", 1);\r\n    APPENDED_ATOM;\r\n    INSERT_WHITESPACE;\r\n    g->print(g->ctx, \"}\", 1);\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_array_open(yajl_gen g)\r\n{\r\n    ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;\r\n    INCREMENT_DEPTH; \r\n    g->state[g->depth] = yajl_gen_array_start;\r\n    g->print(g->ctx, \"[\", 1);\r\n    if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, \"\\n\", 1);\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_array_close(yajl_gen g)\r\n{\r\n    ENSURE_VALID_STATE;\r\n    DECREMENT_DEPTH;\r\n    if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, \"\\n\", 1);\r\n    APPENDED_ATOM;\r\n    INSERT_WHITESPACE;\r\n    g->print(g->ctx, \"]\", 1);\r\n    FINAL_NEWLINE;\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nyajl_gen_status\r\nyajl_gen_get_buf(yajl_gen g, const unsigned char ** buf,\r\n                 size_t * len)\r\n{\r\n    if (g->print != (yajl_print_t)&yajl_buf_append) return yajl_gen_no_buf;\r\n    *buf = yajl_buf_data((yajl_buf)g->ctx);\r\n    *len = yajl_buf_len((yajl_buf)g->ctx);\r\n    return yajl_gen_status_ok;\r\n}\r\n\r\nvoid\r\nyajl_gen_clear(yajl_gen g)\r\n{\r\n    if (g->print == (yajl_print_t)&yajl_buf_append) yajl_buf_clear((yajl_buf)g->ctx);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_lex.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#include \"yajl_lex.h\"\r\n#include \"yajl_buf.h\"\r\n\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n#include <string.h>\r\n\r\n#include \"yajl_assert.h\"\r\n\r\n#ifdef YAJL_LEXER_DEBUG\r\nstatic const char *\r\ntokToStr(yajl_tok tok) \r\n{\r\n    switch (tok) {\r\n        case yajl_tok_bool: return \"bool\";\r\n        case yajl_tok_colon: return \"colon\";\r\n        case yajl_tok_comma: return \"comma\";\r\n        case yajl_tok_eof: return \"eof\";\r\n        case yajl_tok_error: return \"error\";\r\n        case yajl_tok_left_brace: return \"brace\";\r\n        case yajl_tok_left_bracket: return \"bracket\";\r\n        case yajl_tok_null: return \"null\";\r\n        case yajl_tok_integer: return \"integer\";\r\n        case yajl_tok_double: return \"double\";\r\n        case yajl_tok_right_brace: return \"brace\";\r\n        case yajl_tok_right_bracket: return \"bracket\";\r\n        case yajl_tok_string: return \"string\";\r\n        case yajl_tok_string_with_escapes: return \"string_with_escapes\";\r\n    }\r\n    return \"unknown\";\r\n}\r\n#endif\r\n\r\n/* Impact of the stream parsing feature on the lexer:\r\n *\r\n * YAJL support stream parsing.  That is, the ability to parse the first\r\n * bits of a chunk of JSON before the last bits are available (still on\r\n * the network or disk).  This makes the lexer more complex.  The\r\n * responsibility of the lexer is to handle transparently the case where\r\n * a chunk boundary falls in the middle of a token.  This is\r\n * accomplished is via a buffer and a character reading abstraction. \r\n *\r\n * Overview of implementation\r\n *\r\n * When we lex to end of input string before end of token is hit, we\r\n * copy all of the input text composing the token into our lexBuf.\r\n * \r\n * Every time we read a character, we do so through the readChar function.\r\n * readChar's responsibility is to handle pulling all chars from the buffer\r\n * before pulling chars from input text\r\n */\r\n\r\nstruct yajl_lexer_t {\r\n    /* the overal line and char offset into the data */\r\n    size_t lineOff;\r\n    size_t charOff;\r\n\r\n    /* error */\r\n    yajl_lex_error error;\r\n\r\n    /* a input buffer to handle the case where a token is spread over\r\n     * multiple chunks */ \r\n    yajl_buf buf;\r\n\r\n    /* in the case where we have data in the lexBuf, bufOff holds\r\n     * the current offset into the lexBuf. */\r\n    size_t bufOff;\r\n\r\n    /* are we using the lex buf? */\r\n    unsigned int bufInUse;\r\n\r\n    /* shall we allow comments? */\r\n    unsigned int allowComments;\r\n\r\n    /* shall we validate utf8 inside strings? */\r\n    unsigned int validateUTF8;\r\n\r\n    yajl_alloc_funcs * alloc;\r\n};\r\n\r\n#define readChar(lxr, txt, off)                      \\\r\n    (((lxr)->bufInUse && yajl_buf_len((lxr)->buf) && lxr->bufOff < yajl_buf_len((lxr)->buf)) ? \\\r\n     (*((const unsigned char *) yajl_buf_data((lxr)->buf) + ((lxr)->bufOff)++)) : \\\r\n     ((txt)[(*(off))++]))\r\n\r\n#define unreadChar(lxr, off) ((*(off) > 0) ? (*(off))-- : ((lxr)->bufOff--))\r\n\r\nyajl_lexer\r\nyajl_lex_alloc(yajl_alloc_funcs * alloc,\r\n               unsigned int allowComments, unsigned int validateUTF8)\r\n{\r\n    yajl_lexer lxr = (yajl_lexer) YA_MALLOC(alloc, sizeof(struct yajl_lexer_t));\r\n    memset((void *) lxr, 0, sizeof(struct yajl_lexer_t));\r\n    lxr->buf = yajl_buf_alloc(alloc);\r\n    lxr->allowComments = allowComments;\r\n    lxr->validateUTF8 = validateUTF8;\r\n    lxr->alloc = alloc;\r\n    return lxr;\r\n}\r\n\r\nvoid\r\nyajl_lex_free(yajl_lexer lxr)\r\n{\r\n    yajl_buf_free(lxr->buf);\r\n    YA_FREE(lxr->alloc, lxr);\r\n    return;\r\n}\r\n\r\n/* a lookup table which lets us quickly determine three things:\r\n * VEC - valid escaped control char\r\n * note.  the solidus '/' may be escaped or not.\r\n * IJC - invalid json char\r\n * VHC - valid hex char\r\n * NFP - needs further processing (from a string scanning perspective)\r\n * NUC - needs utf8 checking when enabled (from a string scanning perspective)\r\n */\r\n#define VEC 0x01\r\n#define IJC 0x02\r\n#define VHC 0x04\r\n#define NFP 0x08\r\n#define NUC 0x10\r\n\r\nstatic const char charLookupTable[256] =\r\n{\r\n/*00*/ IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    ,\r\n/*08*/ IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    ,\r\n/*10*/ IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    ,\r\n/*18*/ IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    , IJC    ,\r\n\r\n/*20*/ 0      , 0      , NFP|VEC|IJC, 0      , 0      , 0      , 0      , 0      ,\r\n/*28*/ 0      , 0      , 0      , 0      , 0      , 0      , 0      , VEC    ,\r\n/*30*/ VHC    , VHC    , VHC    , VHC    , VHC    , VHC    , VHC    , VHC    ,\r\n/*38*/ VHC    , VHC    , 0      , 0      , 0      , 0      , 0      , 0      ,\r\n\r\n/*40*/ 0      , VHC    , VHC    , VHC    , VHC    , VHC    , VHC    , 0      ,\r\n/*48*/ 0      , 0      , 0      , 0      , 0      , 0      , 0      , 0      ,\r\n/*50*/ 0      , 0      , 0      , 0      , 0      , 0      , 0      , 0      ,\r\n/*58*/ 0      , 0      , 0      , 0      , NFP|VEC|IJC, 0      , 0      , 0      ,\r\n\r\n/*60*/ 0      , VHC    , VEC|VHC, VHC    , VHC    , VHC    , VEC|VHC, 0      ,\r\n/*68*/ 0      , 0      , 0      , 0      , 0      , 0      , VEC    , 0      ,\r\n/*70*/ 0      , 0      , VEC    , 0      , VEC    , 0      , 0      , 0      ,\r\n/*78*/ 0      , 0      , 0      , 0      , 0      , 0      , 0      , 0      ,\r\n\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    ,\r\n       NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC    , NUC\r\n};\r\n\r\n/** process a variable length utf8 encoded codepoint.\r\n *\r\n *  returns:\r\n *    yajl_tok_string - if valid utf8 char was parsed and offset was\r\n *                      advanced\r\n *    yajl_tok_eof - if end of input was hit before validation could\r\n *                   complete\r\n *    yajl_tok_error - if invalid utf8 was encountered\r\n * \r\n *  NOTE: on error the offset will point to the first char of the\r\n *  invalid utf8 */\r\n#define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; }\r\n\r\nstatic yajl_tok\r\nyajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText,\r\n                   size_t jsonTextLen, size_t * offset,\r\n                   unsigned char curChar)\r\n{\r\n    if (curChar <= 0x7f) {\r\n        /* single byte */\r\n        return yajl_tok_string;\r\n    } else if ((curChar >> 5) == 0x6) {\r\n        /* two byte */ \r\n        UTF8_CHECK_EOF;\r\n        curChar = readChar(lexer, jsonText, offset);\r\n        if ((curChar >> 6) == 0x2) return yajl_tok_string;\r\n    } else if ((curChar >> 4) == 0x0e) {\r\n        /* three byte */\r\n        UTF8_CHECK_EOF;\r\n        curChar = readChar(lexer, jsonText, offset);\r\n        if ((curChar >> 6) == 0x2) {\r\n            UTF8_CHECK_EOF;\r\n            curChar = readChar(lexer, jsonText, offset);\r\n            if ((curChar >> 6) == 0x2) return yajl_tok_string;\r\n        }\r\n    } else if ((curChar >> 3) == 0x1e) {\r\n        /* four byte */\r\n        UTF8_CHECK_EOF;\r\n        curChar = readChar(lexer, jsonText, offset);\r\n        if ((curChar >> 6) == 0x2) {\r\n            UTF8_CHECK_EOF;\r\n            curChar = readChar(lexer, jsonText, offset);\r\n            if ((curChar >> 6) == 0x2) {\r\n                UTF8_CHECK_EOF;\r\n                curChar = readChar(lexer, jsonText, offset);\r\n                if ((curChar >> 6) == 0x2) return yajl_tok_string;\r\n            }\r\n        }\r\n    } \r\n\r\n    return yajl_tok_error;\r\n}\r\n\r\n/* lex a string.  input is the lexer, pointer to beginning of\r\n * json text, and start of string (offset).\r\n * a token is returned which has the following meanings:\r\n * yajl_tok_string: lex of string was successful.  offset points to\r\n *                  terminating '\"'.\r\n * yajl_tok_eof: end of text was encountered before we could complete\r\n *               the lex.\r\n * yajl_tok_error: embedded in the string were unallowable chars.  offset\r\n *               points to the offending char\r\n */\r\n#define STR_CHECK_EOF \\\r\nif (*offset >= jsonTextLen) { \\\r\n   tok = yajl_tok_eof; \\\r\n   goto finish_string_lex; \\\r\n}\r\n\r\n/** scan a string for interesting characters that might need further\r\n *  review.  return the number of chars that are uninteresting and can\r\n *  be skipped.\r\n * (lth) hi world, any thoughts on how to make this routine faster? */\r\nstatic size_t\r\nyajl_string_scan(const unsigned char * buf, size_t len, int utf8check)\r\n{\r\n    unsigned char mask = IJC|NFP|(utf8check ? NUC : 0);\r\n    size_t skip = 0;\r\n    while (skip < len && !(charLookupTable[*buf] & mask))\r\n    {\r\n        skip++;\r\n        buf++;\r\n    }\r\n    return skip;\r\n}\r\n\r\nstatic yajl_tok\r\nyajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText,\r\n                size_t jsonTextLen, size_t * offset)\r\n{\r\n    yajl_tok tok = yajl_tok_error;\r\n    int hasEscapes = 0;\r\n\r\n    for (;;) {\r\n        unsigned char curChar;\r\n\r\n        /* now jump into a faster scanning routine to skip as much\r\n         * of the buffers as possible */\r\n        {\r\n            const unsigned char * p;\r\n            size_t len;\r\n            \r\n            if ((lexer->bufInUse && yajl_buf_len(lexer->buf) &&\r\n                 lexer->bufOff < yajl_buf_len(lexer->buf)))\r\n            {\r\n                p = ((const unsigned char *) yajl_buf_data(lexer->buf) +\r\n                     (lexer->bufOff));\r\n                len = yajl_buf_len(lexer->buf) - lexer->bufOff;\r\n                lexer->bufOff += yajl_string_scan(p, len, lexer->validateUTF8);\r\n            }                \r\n            else if (*offset < jsonTextLen) \r\n            {\r\n                p = jsonText + *offset;\r\n                len = jsonTextLen - *offset;\r\n                *offset += yajl_string_scan(p, len, lexer->validateUTF8);\r\n            }\r\n        }\r\n\r\n        STR_CHECK_EOF;\r\n\r\n        curChar = readChar(lexer, jsonText, offset);\r\n\r\n        /* quote terminates */\r\n        if (curChar == '\"') {\r\n            tok = yajl_tok_string;\r\n            break;\r\n        }\r\n        /* backslash escapes a set of control chars, */\r\n        else if (curChar == '\\\\') {\r\n            hasEscapes = 1;\r\n            STR_CHECK_EOF;\r\n\r\n            /* special case \\u */\r\n            curChar = readChar(lexer, jsonText, offset);\r\n            if (curChar == 'u') {\r\n                unsigned int i = 0;\r\n\r\n                for (i=0;i<4;i++) {\r\n                    STR_CHECK_EOF;                \r\n                    curChar = readChar(lexer, jsonText, offset);                \r\n                    if (!(charLookupTable[curChar] & VHC)) {\r\n                        /* back up to offending char */\r\n                        unreadChar(lexer, offset);\r\n                        lexer->error = yajl_lex_string_invalid_hex_char;\r\n                        goto finish_string_lex;\r\n                    }\r\n                }\r\n            } else if (!(charLookupTable[curChar] & VEC)) {\r\n                /* back up to offending char */\r\n                unreadChar(lexer, offset);\r\n                lexer->error = yajl_lex_string_invalid_escaped_char;\r\n                goto finish_string_lex;                \r\n            } \r\n        }\r\n        /* when not validating UTF8 it's a simple table lookup to determine\r\n         * if the present character is invalid */\r\n        else if(charLookupTable[curChar] & IJC) {\r\n            /* back up to offending char */\r\n            unreadChar(lexer, offset);\r\n            lexer->error = yajl_lex_string_invalid_json_char;\r\n            goto finish_string_lex;                \r\n        }\r\n        /* when in validate UTF8 mode we need to do some extra work */\r\n        else if (lexer->validateUTF8) {\r\n            yajl_tok t = yajl_lex_utf8_char(lexer, jsonText, jsonTextLen,\r\n                                            offset, curChar);\r\n            \r\n            if (t == yajl_tok_eof) {\r\n                tok = yajl_tok_eof;\r\n                goto finish_string_lex;\r\n            } else if (t == yajl_tok_error) {\r\n                lexer->error = yajl_lex_string_invalid_utf8;\r\n                goto finish_string_lex;\r\n            } \r\n        }\r\n        /* accept it, and move on */ \r\n    }\r\n  finish_string_lex:\r\n    /* tell our buddy, the parser, wether he needs to process this string\r\n     * again */\r\n    if (hasEscapes && tok == yajl_tok_string) {\r\n        tok = yajl_tok_string_with_escapes;\r\n    } \r\n\r\n    return tok;\r\n}\r\n\r\n#define RETURN_IF_EOF if (*offset >= jsonTextLen) return yajl_tok_eof;\r\n\r\nstatic yajl_tok\r\nyajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText,\r\n                size_t jsonTextLen, size_t * offset)\r\n{\r\n    /** XXX: numbers are the only entities in json that we must lex\r\n     *       _beyond_ in order to know that they are complete.  There\r\n     *       is an ambiguous case for integers at EOF. */\r\n\r\n    unsigned char c;\r\n\r\n    yajl_tok tok = yajl_tok_integer;\r\n\r\n    RETURN_IF_EOF;    \r\n    c = readChar(lexer, jsonText, offset);\r\n\r\n    /* optional leading minus */\r\n    if (c == '-') {\r\n        RETURN_IF_EOF;    \r\n        c = readChar(lexer, jsonText, offset); \r\n    }\r\n\r\n    /* a single zero, or a series of integers */\r\n    if (c == '0') {\r\n        RETURN_IF_EOF;    \r\n        c = readChar(lexer, jsonText, offset); \r\n    } else if (c >= '1' && c <= '9') {\r\n        do {\r\n            RETURN_IF_EOF;    \r\n            c = readChar(lexer, jsonText, offset); \r\n        } while (c >= '0' && c <= '9');\r\n    } else {\r\n        unreadChar(lexer, offset);\r\n        lexer->error = yajl_lex_missing_integer_after_minus;\r\n        return yajl_tok_error;\r\n    }\r\n\r\n    /* optional fraction (indicates this is floating point) */\r\n    if (c == '.') {\r\n        int numRd = 0;\r\n        \r\n        RETURN_IF_EOF;\r\n        c = readChar(lexer, jsonText, offset); \r\n\r\n        while (c >= '0' && c <= '9') {\r\n            numRd++;\r\n            RETURN_IF_EOF;\r\n            c = readChar(lexer, jsonText, offset); \r\n        } \r\n\r\n        if (!numRd) {\r\n            unreadChar(lexer, offset);\r\n            lexer->error = yajl_lex_missing_integer_after_decimal;\r\n            return yajl_tok_error;\r\n        }\r\n        tok = yajl_tok_double;\r\n    }\r\n\r\n    /* optional exponent (indicates this is floating point) */\r\n    if (c == 'e' || c == 'E') {\r\n        RETURN_IF_EOF;\r\n        c = readChar(lexer, jsonText, offset); \r\n\r\n        /* optional sign */\r\n        if (c == '+' || c == '-') {\r\n            RETURN_IF_EOF;\r\n            c = readChar(lexer, jsonText, offset); \r\n        }\r\n\r\n        if (c >= '0' && c <= '9') {\r\n            do {\r\n                RETURN_IF_EOF;\r\n                c = readChar(lexer, jsonText, offset); \r\n            } while (c >= '0' && c <= '9');\r\n        } else {\r\n            unreadChar(lexer, offset);\r\n            lexer->error = yajl_lex_missing_integer_after_exponent;\r\n            return yajl_tok_error;\r\n        }\r\n        tok = yajl_tok_double;\r\n    }\r\n    \r\n    /* we always go \"one too far\" */\r\n    unreadChar(lexer, offset);\r\n    \r\n    return tok;\r\n}\r\n\r\nstatic yajl_tok\r\nyajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText,\r\n                 size_t jsonTextLen, size_t * offset)\r\n{\r\n    unsigned char c;\r\n\r\n    yajl_tok tok = yajl_tok_comment;\r\n\r\n    RETURN_IF_EOF;    \r\n    c = readChar(lexer, jsonText, offset);\r\n\r\n    /* either slash or star expected */\r\n    if (c == '/') {\r\n        /* now we throw away until end of line */\r\n        do {\r\n            RETURN_IF_EOF;    \r\n            c = readChar(lexer, jsonText, offset); \r\n        } while (c != '\\n');\r\n    } else if (c == '*') {\r\n        /* now we throw away until end of comment */        \r\n        for (;;) {\r\n            RETURN_IF_EOF;    \r\n            c = readChar(lexer, jsonText, offset); \r\n            if (c == '*') {\r\n                RETURN_IF_EOF;    \r\n                c = readChar(lexer, jsonText, offset);                 \r\n                if (c == '/') {\r\n                    break;\r\n                } else {\r\n                    unreadChar(lexer, offset);\r\n                }\r\n            }\r\n        }\r\n    } else {\r\n        lexer->error = yajl_lex_invalid_char;\r\n        tok = yajl_tok_error;\r\n    }\r\n    \r\n    return tok;\r\n}\r\n\r\nyajl_tok\r\nyajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText,\r\n             size_t jsonTextLen, size_t * offset,\r\n             const unsigned char ** outBuf, size_t * outLen)\r\n{\r\n    yajl_tok tok = yajl_tok_error;\r\n    unsigned char c;\r\n    size_t startOffset = *offset;\r\n\r\n    *outBuf = NULL;\r\n    *outLen = 0;\r\n\r\n    for (;;) {\r\n        (void)assert(*offset <= jsonTextLen);\r\n\r\n        if (*offset >= jsonTextLen) {\r\n            tok = yajl_tok_eof;\r\n            goto lexed;\r\n        }\r\n\r\n        c = readChar(lexer, jsonText, offset);\r\n\r\n        switch (c) {\r\n            case '{':\r\n                tok = yajl_tok_left_bracket;\r\n                goto lexed;\r\n            case '}':\r\n                tok = yajl_tok_right_bracket;\r\n                goto lexed;\r\n            case '[':\r\n                tok = yajl_tok_left_brace;\r\n                goto lexed;\r\n            case ']':\r\n                tok = yajl_tok_right_brace;\r\n                goto lexed;\r\n            case ',':\r\n                tok = yajl_tok_comma;\r\n                goto lexed;\r\n            case ':':\r\n                tok = yajl_tok_colon;\r\n                goto lexed;\r\n            case '\\t': case '\\n': case '\\v': case '\\f': case '\\r': case ' ':\r\n                startOffset++;\r\n                break;\r\n            case 't': {\r\n                const char * want = \"rue\";\r\n                do {\r\n                    if (*offset >= jsonTextLen) {\r\n                        tok = yajl_tok_eof;\r\n                        goto lexed;\r\n                    }\r\n                    c = readChar(lexer, jsonText, offset);\r\n                    if (c != *want) {\r\n                        unreadChar(lexer, offset);\r\n                        lexer->error = yajl_lex_invalid_string;\r\n                        tok = yajl_tok_error;\r\n                        goto lexed;\r\n                    }\r\n                } while (*(++want));\r\n                tok = yajl_tok_bool;\r\n                goto lexed;\r\n            }\r\n            case 'f': {\r\n                const char * want = \"alse\";\r\n                do {\r\n                    if (*offset >= jsonTextLen) {\r\n                        tok = yajl_tok_eof;\r\n                        goto lexed;\r\n                    }\r\n                    c = readChar(lexer, jsonText, offset);\r\n                    if (c != *want) {\r\n                        unreadChar(lexer, offset);\r\n                        lexer->error = yajl_lex_invalid_string;\r\n                        tok = yajl_tok_error;\r\n                        goto lexed;\r\n                    }\r\n                } while (*(++want));\r\n                tok = yajl_tok_bool;\r\n                goto lexed;\r\n            }\r\n            case 'n': {\r\n                const char * want = \"ull\";\r\n                do {\r\n                    if (*offset >= jsonTextLen) {\r\n                        tok = yajl_tok_eof;\r\n                        goto lexed;\r\n                    }\r\n                    c = readChar(lexer, jsonText, offset);\r\n                    if (c != *want) {\r\n                        unreadChar(lexer, offset);\r\n                        lexer->error = yajl_lex_invalid_string;\r\n                        tok = yajl_tok_error;\r\n                        goto lexed;\r\n                    }\r\n                } while (*(++want));\r\n                tok = yajl_tok_null;\r\n                goto lexed;\r\n            }\r\n            case '\"': {\r\n                tok = yajl_lex_string(lexer, (const unsigned char *) jsonText,\r\n                                      jsonTextLen, offset);\r\n                goto lexed;\r\n            }\r\n            case '-':\r\n            case '0': case '1': case '2': case '3': case '4': \r\n            case '5': case '6': case '7': case '8': case '9': {\r\n                /* integer parsing wants to start from the beginning */\r\n                unreadChar(lexer, offset);\r\n                tok = yajl_lex_number(lexer, (const unsigned char *) jsonText,\r\n                                      jsonTextLen, offset);\r\n                goto lexed;\r\n            }\r\n            case '/':\r\n                /* hey, look, a probable comment!  If comments are disabled\r\n                 * it's an error. */\r\n                if (!lexer->allowComments) {\r\n                    unreadChar(lexer, offset);\r\n                    lexer->error = yajl_lex_unallowed_comment;\r\n                    tok = yajl_tok_error;\r\n                    goto lexed;\r\n                }\r\n                /* if comments are enabled, then we should try to lex\r\n                 * the thing.  possible outcomes are\r\n                 * - successful lex (tok_comment, which means continue),\r\n                 * - malformed comment opening (slash not followed by\r\n                 *   '*' or '/') (tok_error)\r\n                 * - eof hit. (tok_eof) */\r\n                tok = yajl_lex_comment(lexer, (const unsigned char *) jsonText,\r\n                                       jsonTextLen, offset);\r\n                if (tok == yajl_tok_comment) {\r\n                    /* \"error\" is silly, but that's the initial\r\n                     * state of tok.  guilty until proven innocent. */  \r\n                    tok = yajl_tok_error;\r\n                    yajl_buf_clear(lexer->buf);\r\n                    lexer->bufInUse = 0;\r\n                    startOffset = *offset; \r\n                    break;\r\n                }\r\n                /* hit error or eof, bail */\r\n                goto lexed;\r\n            default:\r\n                lexer->error = yajl_lex_invalid_char;\r\n                tok = yajl_tok_error;\r\n                goto lexed;\r\n        }\r\n    }\r\n\r\n\r\n  lexed:\r\n    /* need to append to buffer if the buffer is in use or\r\n     * if it's an EOF token */\r\n    if (tok == yajl_tok_eof || lexer->bufInUse) {\r\n        if (!lexer->bufInUse) yajl_buf_clear(lexer->buf);\r\n        lexer->bufInUse = 1;\r\n        yajl_buf_append(lexer->buf, jsonText + startOffset, *offset - startOffset);\r\n        lexer->bufOff = 0;\r\n        \r\n        if (tok != yajl_tok_eof) {\r\n            *outBuf = yajl_buf_data(lexer->buf);\r\n            *outLen = yajl_buf_len(lexer->buf);\r\n            lexer->bufInUse = 0;\r\n        }\r\n    } else if (tok != yajl_tok_error) {\r\n        *outBuf = jsonText + startOffset;\r\n        *outLen = *offset - startOffset;\r\n    }\r\n\r\n    /* special case for strings. skip the quotes. */\r\n    if (tok == yajl_tok_string || tok == yajl_tok_string_with_escapes)\r\n    {\r\n        (void)assert(*outLen >= 2);\r\n        (*outBuf)++;\r\n        *outLen -= 2; \r\n    }\r\n\r\n\r\n#ifdef YAJL_LEXER_DEBUG\r\n    if (tok == yajl_tok_error) {\r\n        printf(\"lexical error: %s\\n\",\r\n               yajl_lex_error_to_string(yajl_lex_get_error(lexer)));\r\n    } else if (tok == yajl_tok_eof) {\r\n        printf(\"EOF hit\\n\");\r\n    } else {\r\n        printf(\"lexed %s: '\", tokToStr(tok));\r\n        fwrite(*outBuf, 1, *outLen, stdout);\r\n        printf(\"'\\n\");\r\n    }\r\n#endif\r\n\r\n    return tok;\r\n}\r\n\r\nconst char *\r\nyajl_lex_error_to_string(yajl_lex_error error)\r\n{\r\n    switch (error) {\r\n        case yajl_lex_e_ok:\r\n            return \"ok, no error\";\r\n        case yajl_lex_string_invalid_utf8:\r\n            return \"invalid bytes in UTF8 string.\";\r\n        case yajl_lex_string_invalid_escaped_char:\r\n            return \"inside a string, '\\\\' occurs before a character \"\r\n                   \"which it may not.\";\r\n        case yajl_lex_string_invalid_json_char:            \r\n            return \"invalid character inside string.\";\r\n        case yajl_lex_string_invalid_hex_char:\r\n            return \"invalid (non-hex) character occurs after '\\\\u' inside \"\r\n                   \"string.\";\r\n        case yajl_lex_invalid_char:\r\n            return \"invalid char in json text.\";\r\n        case yajl_lex_invalid_string:\r\n            return \"invalid string in json text.\";\r\n        case yajl_lex_missing_integer_after_exponent:\r\n            return \"malformed number, a digit is required after the exponent.\";\r\n        case yajl_lex_missing_integer_after_decimal:\r\n            return \"malformed number, a digit is required after the \"\r\n                   \"decimal point.\";\r\n        case yajl_lex_missing_integer_after_minus:\r\n            return \"malformed number, a digit is required after the \"\r\n                   \"minus sign.\";\r\n        case yajl_lex_unallowed_comment:\r\n            return \"probable comment found in input text, comments are \"\r\n                   \"not enabled.\";\r\n    }\r\n    return \"unknown error code\";\r\n}\r\n\r\n\r\n/** allows access to more specific information about the lexical\r\n *  error when yajl_lex_lex returns yajl_tok_error. */\r\nyajl_lex_error\r\nyajl_lex_get_error(yajl_lexer lexer)\r\n{\r\n    if (lexer == NULL) return (yajl_lex_error) -1;\r\n    return lexer->error;\r\n}\r\n\r\nsize_t yajl_lex_current_line(yajl_lexer lexer)\r\n{\r\n    return lexer->lineOff;\r\n}\r\n\r\nsize_t yajl_lex_current_char(yajl_lexer lexer)\r\n{\r\n    return lexer->charOff;\r\n}\r\n\r\nyajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText,\r\n                       size_t jsonTextLen, size_t offset)\r\n{\r\n    const unsigned char * outBuf;\r\n    size_t outLen;\r\n    size_t bufLen = yajl_buf_len(lexer->buf);\r\n    size_t bufOff = lexer->bufOff;\r\n    unsigned int bufInUse = lexer->bufInUse;\r\n    yajl_tok tok;\r\n    \r\n    tok = yajl_lex_lex(lexer, jsonText, jsonTextLen, &offset,\r\n                       &outBuf, &outLen);\r\n\r\n    lexer->bufOff = bufOff;\r\n    lexer->bufInUse = bufInUse;\r\n    yajl_buf_truncate(lexer->buf, bufLen);\r\n    \r\n    return tok;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_lex.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#ifndef __YAJL_LEX_H__\r\n#define __YAJL_LEX_H__\r\n\r\n#include \"api/yajl_common.h\"\r\n\r\ntypedef enum {\r\n    yajl_tok_bool,         \r\n    yajl_tok_colon,\r\n    yajl_tok_comma,     \r\n    yajl_tok_eof,\r\n    yajl_tok_error,\r\n    yajl_tok_left_brace,     \r\n    yajl_tok_left_bracket,\r\n    yajl_tok_null,         \r\n    yajl_tok_right_brace,     \r\n    yajl_tok_right_bracket,\r\n\r\n    /* we differentiate between integers and doubles to allow the\r\n     * parser to interpret the number without re-scanning */\r\n    yajl_tok_integer, \r\n    yajl_tok_double, \r\n\r\n    /* we differentiate between strings which require further processing,\r\n     * and strings that do not */\r\n    yajl_tok_string,\r\n    yajl_tok_string_with_escapes,\r\n\r\n    /* comment tokens are not currently returned to the parser, ever */\r\n    yajl_tok_comment\r\n} yajl_tok;\r\n\r\ntypedef struct yajl_lexer_t * yajl_lexer;\r\n\r\nyajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc,\r\n                          unsigned int allowComments,\r\n                          unsigned int validateUTF8);\r\n\r\nvoid yajl_lex_free(yajl_lexer lexer);\r\n\r\n/**\r\n * run/continue a lex. \"offset\" is an input/output parameter.\r\n * It should be initialized to zero for a\r\n * new chunk of target text, and upon subsetquent calls with the same\r\n * target text should passed with the value of the previous invocation.\r\n *\r\n * the client may be interested in the value of offset when an error is\r\n * returned from the lexer.  This allows the client to render useful\r\nn * error messages.\r\n *\r\n * When you pass the next chunk of data, context should be reinitialized\r\n * to zero.\r\n * \r\n * Finally, the output buffer is usually just a pointer into the jsonText,\r\n * however in cases where the entity being lexed spans multiple chunks,\r\n * the lexer will buffer the entity and the data returned will be\r\n * a pointer into that buffer.\r\n *\r\n * This behavior is abstracted from client code except for the performance\r\n * implications which require that the client choose a reasonable chunk\r\n * size to get adequate performance.\r\n */\r\nyajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText,\r\n                      size_t jsonTextLen, size_t * offset,\r\n                      const unsigned char ** outBuf, size_t * outLen);\r\n\r\n/** have a peek at the next token, but don't move the lexer forward */\r\nyajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText,\r\n                       size_t jsonTextLen, size_t offset);\r\n\r\n\r\ntypedef enum {\r\n    yajl_lex_e_ok = 0,\r\n    yajl_lex_string_invalid_utf8,\r\n    yajl_lex_string_invalid_escaped_char,\r\n    yajl_lex_string_invalid_json_char,\r\n    yajl_lex_string_invalid_hex_char,\r\n    yajl_lex_invalid_char,\r\n    yajl_lex_invalid_string,\r\n    yajl_lex_missing_integer_after_decimal,\r\n    yajl_lex_missing_integer_after_exponent,\r\n    yajl_lex_missing_integer_after_minus,\r\n    yajl_lex_unallowed_comment\r\n} yajl_lex_error;\r\n\r\nconst char * yajl_lex_error_to_string(yajl_lex_error error);\r\n\r\n/** allows access to more specific information about the lexical\r\n *  error when yajl_lex_lex returns yajl_tok_error. */\r\nyajl_lex_error yajl_lex_get_error(yajl_lexer lexer);\r\n\r\n/** get the current offset into the most recently lexed json string. */\r\nsize_t yajl_lex_current_offset(yajl_lexer lexer);\r\n\r\n/** get the number of lines lexed by this lexer instance */\r\nsize_t yajl_lex_current_line(yajl_lexer lexer);\r\n\r\n/** get the number of chars lexed by this lexer instance since the last\r\n *  \\n or \\r */\r\nsize_t yajl_lex_current_char(yajl_lexer lexer);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_parser.c",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n// Disable Warnings\r\n// C4245 : 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch\r\n#pragma warning( disable : 4245 )\r\n\r\n\r\n#include \"api/yajl_parse.h\"\r\n#include \"yajl_lex.h\"\r\n#include \"yajl_parser.h\"\r\n#include \"yajl_encode.h\"\r\n#include \"yajl_bytestack.h\"\r\n\r\n#include <stdlib.h>\r\n#include <limits.h>\r\n#include <errno.h>\r\n#include <stdio.h>\r\n#include <string.h>\r\n#include <ctype.h>\r\n#include <math.h>\r\n\r\n#include \"yajl_assert.h\"\r\n\r\n#define MAX_VALUE_TO_MULTIPLY ((LLONG_MAX / 10) + (LLONG_MAX % 10))\r\n\r\n /* same semantics as strtol */\r\nlong long\r\nyajl_parse_integer(const unsigned char *number, unsigned int length)\r\n{\r\n    long long ret  = 0;\r\n    long sign = 1;\r\n    const unsigned char *pos = number;\r\n    if (*pos == '-') { pos++; sign = -1; }\r\n    if (*pos == '+') { pos++; }\r\n\r\n    while (pos < number + length) {\r\n        if ( ret > MAX_VALUE_TO_MULTIPLY ) {\r\n            errno = ERANGE;\r\n            return sign == 1 ? LLONG_MAX : LLONG_MIN;\r\n        }\r\n        ret *= 10;\r\n        if (LLONG_MAX - ret < (*pos - '0')) {\r\n            errno = ERANGE;\r\n            return sign == 1 ? LLONG_MAX : LLONG_MIN;\r\n        }\r\n        ret += (*pos++ - '0');\r\n    }\r\n\r\n    return sign * ret;\r\n}\r\n\r\nunsigned char *\r\nyajl_render_error_string(yajl_handle hand, const unsigned char * jsonText,\r\n                         size_t jsonTextLen, int verbose)\r\n{\r\n    size_t offset = hand->bytesConsumed;\r\n    unsigned char * str;\r\n    const char * errorType = NULL;\r\n    const char * errorText = NULL;\r\n    char text[72];\r\n    const char * arrow = \"                     (right here) ------^\\n\";\r\n\r\n    if (yajl_bs_current(hand->stateStack) == yajl_state_parse_error) {\r\n        errorType = \"parse\";\r\n        errorText = hand->parseError;\r\n    } else if (yajl_bs_current(hand->stateStack) == yajl_state_lexical_error) {\r\n        errorType = \"lexical\";\r\n        errorText = yajl_lex_error_to_string(yajl_lex_get_error(hand->lexer));\r\n    } else {\r\n        errorType = \"unknown\";\r\n    }\r\n\r\n    {\r\n        size_t memneeded = 0;\r\n        memneeded += strlen(errorType);\r\n        memneeded += strlen(\" error\");\r\n        if (errorText != NULL) {\r\n            memneeded += strlen(\": \");\r\n            memneeded += strlen(errorText);\r\n        }\r\n        str = (unsigned char *) YA_MALLOC(&(hand->alloc), memneeded + 2);\r\n        if (!str) return NULL;\r\n        str[0] = 0;\r\n        strcat((char *) str, errorType);\r\n        strcat((char *) str, \" error\");\r\n        if (errorText != NULL) {\r\n            strcat((char *) str, \": \");\r\n            strcat((char *) str, errorText);\r\n        }\r\n        strcat((char *) str, \"\\n\");\r\n    }\r\n\r\n    /* now we append as many spaces as needed to make sure the error\r\n     * falls at char 41, if verbose was specified */\r\n    if (verbose) {\r\n        size_t start, end, i;\r\n        size_t spacesNeeded;\r\n\r\n        spacesNeeded = (offset < 30 ? 40 - offset : 10);\r\n        start = (offset >= 30 ? offset - 30 : 0);\r\n        end = (offset + 30 > jsonTextLen ? jsonTextLen : offset + 30);\r\n\r\n        for (i=0;i<spacesNeeded;i++) text[i] = ' ';\r\n\r\n        for (;start < end;start++, i++) {\r\n            if (jsonText[start] != '\\n' && jsonText[start] != '\\r')\r\n            {\r\n                text[i] = jsonText[start];\r\n            }\r\n            else\r\n            {\r\n                text[i] = ' ';\r\n            }\r\n        }\r\n        (void)assert(i <= 71);\r\n        text[i++] = '\\n';\r\n        text[i] = 0;\r\n        {\r\n            char * newStr = (char *)\r\n                YA_MALLOC(&(hand->alloc), (unsigned int)(strlen((char *) str) +\r\n                                                         strlen((char *) text) +\r\n                                                         strlen(arrow) + 1));\r\n            if (newStr) {\r\n                newStr[0] = 0;\r\n                strcat((char *) newStr, (char *) str);\r\n                strcat((char *) newStr, text);\r\n                strcat((char *) newStr, arrow);\r\n            }\r\n            YA_FREE(&(hand->alloc), str);\r\n            str = (unsigned char *) newStr;\r\n        }\r\n    }\r\n    return str;\r\n}\r\n\r\n/* check for client cancelation */\r\n#define _CC_CHK(x)                                                \\\r\n    if (!(x)) {                                                   \\\r\n        yajl_bs_set(hand->stateStack, yajl_state_parse_error);    \\\r\n        hand->parseError =                                        \\\r\n            \"client cancelled parse via callback return value\";   \\\r\n        return yajl_status_client_canceled;                       \\\r\n    }\r\n\r\n\r\nyajl_status\r\nyajl_do_finish(yajl_handle hand)\r\n{\r\n    yajl_status stat;\r\n    stat = yajl_do_parse(hand,(const unsigned char *) \" \",1);\r\n\r\n    if (stat != yajl_status_ok) return stat;\r\n\r\n    switch(yajl_bs_current(hand->stateStack))\r\n    {\r\n        case yajl_state_parse_error:\r\n        case yajl_state_lexical_error:\r\n            return yajl_status_error;\r\n        case yajl_state_got_value:\r\n        case yajl_state_parse_complete:\r\n            return yajl_status_ok;\r\n        default:\r\n            if (!(hand->flags & yajl_allow_partial_values))\r\n            {\r\n                yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                hand->parseError = \"premature EOF\";\r\n                return yajl_status_error;\r\n            }\r\n            return yajl_status_ok;\r\n    }\r\n}\r\n\r\nyajl_status\r\nyajl_do_parse(yajl_handle hand, const unsigned char * jsonText,\r\n              size_t jsonTextLen)\r\n{\r\n    yajl_tok tok;\r\n    const unsigned char * buf;\r\n    size_t bufLen;\r\n    size_t * offset = &(hand->bytesConsumed);\r\n\r\n    *offset = 0;\r\n\r\n  around_again:\r\n    switch (yajl_bs_current(hand->stateStack)) {\r\n        case yajl_state_parse_complete:\r\n            if (hand->flags & yajl_allow_multiple_values) {\r\n                yajl_bs_set(hand->stateStack, yajl_state_got_value);\r\n                goto around_again;\r\n            }\r\n            if (!(hand->flags & yajl_allow_trailing_garbage)) {\r\n                if (*offset != jsonTextLen) {\r\n                    tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,\r\n                                       offset, &buf, &bufLen);\r\n                    if (tok != yajl_tok_eof) {\r\n                        yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                        hand->parseError = \"trailing garbage\";\r\n                    }\r\n                    goto around_again;\r\n                }\r\n            }\r\n            return yajl_status_ok;\r\n        case yajl_state_lexical_error:\r\n        case yajl_state_parse_error:\r\n            return yajl_status_error;\r\n        case yajl_state_start:\r\n        case yajl_state_got_value:\r\n        case yajl_state_map_need_val:\r\n        case yajl_state_array_need_val:\r\n        case yajl_state_array_start:  {\r\n            /* for arrays and maps, we advance the state for this\r\n             * depth, then push the state of the next depth.\r\n             * If an error occurs during the parsing of the nesting\r\n             * enitity, the state at this level will not matter.\r\n             * a state that needs pushing will be anything other\r\n             * than state_start */\r\n\r\n            yajl_state stateToPush = yajl_state_start;\r\n\r\n            tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,\r\n                               offset, &buf, &bufLen);\r\n\r\n            switch (tok) {\r\n                case yajl_tok_eof:\r\n                    return yajl_status_ok;\r\n                case yajl_tok_error:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_lexical_error);\r\n                    goto around_again;\r\n                case yajl_tok_string:\r\n                    if (hand->callbacks && hand->callbacks->yajl_string) {\r\n                        _CC_CHK(hand->callbacks->yajl_string(hand->ctx,\r\n                                                             buf, bufLen, -1));\r\n                    }\r\n                    break;\r\n                case yajl_tok_string_with_escapes:\r\n                    if (hand->callbacks && hand->callbacks->yajl_string) {\r\n                        yajl_buf_clear(hand->decodeBuf);\r\n                        yajl_string_decode(hand->decodeBuf, buf, bufLen);\r\n                        _CC_CHK(hand->callbacks->yajl_string(\r\n                                    hand->ctx, yajl_buf_data(hand->decodeBuf),\r\n                                    yajl_buf_len(hand->decodeBuf),-1));\r\n                    }\r\n                    break;\r\n                case yajl_tok_bool:\r\n                    if (hand->callbacks && hand->callbacks->yajl_boolean) {\r\n                        _CC_CHK(hand->callbacks->yajl_boolean(hand->ctx,\r\n                                                              *buf == 't'));\r\n                    }\r\n                    break;\r\n                case yajl_tok_null:\r\n                    if (hand->callbacks && hand->callbacks->yajl_null) {\r\n                        _CC_CHK(hand->callbacks->yajl_null(hand->ctx));\r\n                    }\r\n                    break;\r\n                case yajl_tok_left_bracket:\r\n                    if (hand->callbacks && hand->callbacks->yajl_start_map) {\r\n                        _CC_CHK(hand->callbacks->yajl_start_map(hand->ctx,-1));\r\n                    }\r\n                    stateToPush = yajl_state_map_start;\r\n                    break;\r\n                case yajl_tok_left_brace:\r\n                    if (hand->callbacks && hand->callbacks->yajl_start_array) {\r\n                        _CC_CHK(hand->callbacks->yajl_start_array(hand->ctx,-1));\r\n                    }\r\n                    stateToPush = yajl_state_array_start;\r\n                    break;\r\n                case yajl_tok_integer:\r\n                    if (hand->callbacks) {\r\n                        if (hand->callbacks->yajl_number) {\r\n                            _CC_CHK(hand->callbacks->yajl_number(\r\n                                        hand->ctx,(const char *) buf, bufLen));\r\n                        } else if (hand->callbacks->yajl_integer) {\r\n                            long long int i = 0;\r\n                            i = yajl_parse_integer(buf, bufLen);\r\n                            if ((i == LLONG_MIN || i == LLONG_MAX) &&\r\n                                errno == ERANGE)\r\n                            {\r\n                                yajl_bs_set(hand->stateStack,\r\n                                            yajl_state_parse_error);\r\n                                hand->parseError = \"integer overflow\" ;\r\n                                /* try to restore error offset */\r\n                                if (*offset >= bufLen) *offset -= bufLen;\r\n                                else *offset = 0;\r\n                                goto around_again;\r\n                            }\r\n                            _CC_CHK(hand->callbacks->yajl_integer(hand->ctx,\r\n                                                                  i));\r\n                        }\r\n                    }\r\n                    break;\r\n                case yajl_tok_double:\r\n                    if (hand->callbacks) {\r\n                        if (hand->callbacks->yajl_number) {\r\n                            _CC_CHK(hand->callbacks->yajl_number(\r\n                                        hand->ctx, (const char *) buf, bufLen));\r\n                        } else if (hand->callbacks->yajl_double) {\r\n                            double d = 0.0;\r\n                            yajl_buf_clear(hand->decodeBuf);\r\n                            yajl_buf_append(hand->decodeBuf, buf, bufLen);\r\n                            buf = yajl_buf_data(hand->decodeBuf);\r\n                            d = strtod((char *) buf, NULL);\r\n                            if ((d == HUGE_VAL || d == -HUGE_VAL) &&\r\n                                errno == ERANGE)\r\n                            {\r\n                                yajl_bs_set(hand->stateStack,\r\n                                            yajl_state_parse_error);\r\n                                hand->parseError = \"numeric (floating point) \"\r\n                                    \"overflow\";\r\n                                /* try to restore error offset */\r\n                                if (*offset >= bufLen) *offset -= bufLen;\r\n                                else *offset = 0;\r\n                                goto around_again;\r\n                            }\r\n                            _CC_CHK(hand->callbacks->yajl_double(hand->ctx,\r\n                                                                 d));\r\n                        }\r\n                    }\r\n                    break;\r\n                case yajl_tok_right_brace: {\r\n                    if (yajl_bs_current(hand->stateStack) ==\r\n                        yajl_state_array_start)\r\n                    {\r\n                        if (hand->callbacks &&\r\n                            hand->callbacks->yajl_end_array)\r\n                        {\r\n                            _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx));\r\n                        }\r\n                        yajl_bs_pop(hand->stateStack);\r\n                        goto around_again;\r\n                    }\r\n                    /* intentional fall-through */\r\n                }\r\n                case yajl_tok_colon:\r\n                case yajl_tok_comma:\r\n                case yajl_tok_right_bracket:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                    hand->parseError =\r\n                        \"unallowed token at this point in JSON text\";\r\n                    goto around_again;\r\n                default:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                    hand->parseError = \"invalid token, internal error\";\r\n                    goto around_again;\r\n            }\r\n            /* got a value.  transition depends on the state we're in. */\r\n            {\r\n                yajl_state s = yajl_bs_current(hand->stateStack);\r\n                if (s == yajl_state_start || s == yajl_state_got_value) {\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_complete);\r\n                } else if (s == yajl_state_map_need_val) {\r\n                    yajl_bs_set(hand->stateStack, yajl_state_map_got_val);\r\n                } else {\r\n                    yajl_bs_set(hand->stateStack, yajl_state_array_got_val);\r\n                }\r\n            }\r\n            if (stateToPush != yajl_state_start) {\r\n                yajl_bs_push(hand->stateStack, stateToPush);\r\n            }\r\n\r\n            goto around_again;\r\n        }\r\n        case yajl_state_map_start:\r\n        case yajl_state_map_need_key: {\r\n            /* only difference between these two states is that in\r\n             * start '}' is valid, whereas in need_key, we've parsed\r\n             * a comma, and a string key _must_ follow */\r\n            tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,\r\n                               offset, &buf, &bufLen);\r\n            switch (tok) {\r\n                case yajl_tok_eof:\r\n                    return yajl_status_ok;\r\n                case yajl_tok_error:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_lexical_error);\r\n                    goto around_again;\r\n                case yajl_tok_string_with_escapes:\r\n                    if (hand->callbacks && hand->callbacks->yajl_map_key) {\r\n                        yajl_buf_clear(hand->decodeBuf);\r\n                        yajl_string_decode(hand->decodeBuf, buf, bufLen);\r\n                        buf = yajl_buf_data(hand->decodeBuf);\r\n                        bufLen = yajl_buf_len(hand->decodeBuf);\r\n                    }\r\n                    /* intentional fall-through */\r\n                case yajl_tok_string:\r\n                    if (hand->callbacks && hand->callbacks->yajl_map_key) {\r\n                        _CC_CHK(hand->callbacks->yajl_map_key(hand->ctx, buf,\r\n                                                              bufLen,-1));\r\n                    }\r\n                    yajl_bs_set(hand->stateStack, yajl_state_map_sep);\r\n                    goto around_again;\r\n                case yajl_tok_right_bracket:\r\n                    if (yajl_bs_current(hand->stateStack) ==\r\n                        yajl_state_map_start)\r\n                    {\r\n                        if (hand->callbacks && hand->callbacks->yajl_end_map) {\r\n                            _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx));\r\n                        }\r\n                        yajl_bs_pop(hand->stateStack);\r\n                        goto around_again;\r\n                    }\r\n                default:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                    hand->parseError =\r\n                        \"invalid object key (must be a string)\"; \r\n                    goto around_again;\r\n            }\r\n        }\r\n        case yajl_state_map_sep: {\r\n            tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,\r\n                               offset, &buf, &bufLen);\r\n            switch (tok) {\r\n                case yajl_tok_colon:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_map_need_val);\r\n                    goto around_again;\r\n                case yajl_tok_eof:\r\n                    return yajl_status_ok;\r\n                case yajl_tok_error:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_lexical_error);\r\n                    goto around_again;\r\n                default:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                    hand->parseError = \"object key and value must \"\r\n                        \"be separated by a colon (':')\";\r\n                    goto around_again;\r\n            }\r\n        }\r\n        case yajl_state_map_got_val: {\r\n            tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,\r\n                               offset, &buf, &bufLen);\r\n            switch (tok) {\r\n                case yajl_tok_right_bracket:\r\n                    if (hand->callbacks && hand->callbacks->yajl_end_map) {\r\n                        _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx));\r\n                    }\r\n                    yajl_bs_pop(hand->stateStack);\r\n                    goto around_again;\r\n                case yajl_tok_comma:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_map_need_key);\r\n                    goto around_again;\r\n                case yajl_tok_eof:\r\n                    return yajl_status_ok;\r\n                case yajl_tok_error:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_lexical_error);\r\n                    goto around_again;\r\n                default:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                    hand->parseError = \"after key and value, inside map, \"\r\n                                       \"I expect ',' or '}'\";\r\n                    /* try to restore error offset */\r\n                    if (*offset >= bufLen) *offset -= bufLen;\r\n                    else *offset = 0;\r\n                    goto around_again;\r\n            }\r\n        }\r\n        case yajl_state_array_got_val: {\r\n            tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,\r\n                               offset, &buf, &bufLen);\r\n            switch (tok) {\r\n                case yajl_tok_right_brace:\r\n                    if (hand->callbacks && hand->callbacks->yajl_end_array) {\r\n                        _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx));\r\n                    }\r\n                    yajl_bs_pop(hand->stateStack);\r\n                    goto around_again;\r\n                case yajl_tok_comma:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_array_need_val);\r\n                    goto around_again;\r\n                case yajl_tok_eof:\r\n                    return yajl_status_ok;\r\n                case yajl_tok_error:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_lexical_error);\r\n                    goto around_again;\r\n                default:\r\n                    yajl_bs_set(hand->stateStack, yajl_state_parse_error);\r\n                    hand->parseError =\r\n                        \"after array element, I expect ',' or ']'\";\r\n                    goto around_again;\r\n            }\r\n        }\r\n    }\r\n\r\n    abort();\r\n    return yajl_status_error;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_parser.h",
    "content": "/*\r\n * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#ifndef __YAJL_PARSER_H__\r\n#define __YAJL_PARSER_H__\r\n\r\n#ifdef _WIN32\r\n#pragma warning(disable:4996)\r\n#endif\r\n\r\n#include \"api/yajl_parse.h\"\r\n#include \"yajl_bytestack.h\"\r\n#include \"yajl_buf.h\"\r\n#include \"yajl_lex.h\"\r\n\r\n\r\ntypedef enum {\r\n    yajl_state_start = 0,\r\n    yajl_state_parse_complete,\r\n    yajl_state_parse_error,\r\n    yajl_state_lexical_error,\r\n    yajl_state_map_start,\r\n    yajl_state_map_sep,\r\n    yajl_state_map_need_val,\r\n    yajl_state_map_got_val,\r\n    yajl_state_map_need_key,\r\n    yajl_state_array_start,\r\n    yajl_state_array_got_val,\r\n    yajl_state_array_need_val,\r\n    yajl_state_got_value,\r\n} yajl_state;\r\n\r\ntypedef struct {\r\n\tconst unsigned char *\tstring;\r\n\tint\t\t\t\t\t\tstringlen;\r\n\tint\t\t\t\t\t\tmemberCache;\r\n} cp_entry;\r\n\r\ntypedef struct {\r\n\tint\t\t\t\t\t\tused;\r\n\tint\t\t\t\t\t\tcp_count;\r\n    const yajl_callbacks*\tcallbacks;\r\n\tyajl_alloc_funcs*\t\tafs;\r\n    void*\t\t\t\t\tctx;\r\n    const char *\t\t\tparseError;\r\n\tcp_entry*\t\t\t\tcp;\r\n\tunsigned char*\t\t\tstrs;\r\n} bjson_handle;\r\n\r\ntypedef struct yajl_handle_t {\r\n    const yajl_callbacks * callbacks;\r\n    void * ctx;\r\n    yajl_lexer lexer;\r\n    const char * parseError;\r\n    /* the number of bytes consumed from the last client buffer,\r\n     * in the case of an error this will be an error offset, in the\r\n     * case of an error this can be used as the error offset */\r\n    size_t bytesConsumed;\r\n    /* temporary storage for decoded strings */\r\n    yajl_buf decodeBuf;\r\n    /* a stack of states.  access with yajl_state_XXX routines */\r\n    yajl_bytestack stateStack;\r\n    /* memory allocation routines */\r\n    yajl_alloc_funcs alloc;\r\n    /* bitfield */\r\n    unsigned int flags;\r\n\r\n\t// Binary JSon parser.\r\n\tbjson_handle bj;\r\n\tbjson_handle msgpack;\r\n} yajl_handle_t;\r\n\r\nyajl_status\r\nyajl_do_parse(yajl_handle handle, const unsigned char * jsonText,\r\n              size_t jsonTextLen);\r\n\r\nyajl_status\r\nyajl_do_finish(yajl_handle handle);\r\n\r\nunsigned char *\r\nyajl_render_error_string(yajl_handle hand, const unsigned char * jsonText,\r\n                         size_t jsonTextLen, int verbose);\r\n\r\n/* A little built in integer parsing routine with the same semantics as strtol\r\n * that's unaffected by LOCALE. */\r\nlong long\r\nyajl_parse_integer(const unsigned char *number, unsigned int length);\r\n\r\nint bjson_parse(\tyajl_handle hand, \r\n\t\t\t\t\tconst unsigned char*\tjsonText,\r\n\t\t\t\t\tint\t\t\t\t\t\tjsonTextLength\r\n\t\t\t\t);\r\n\r\nint msgpack_parse(\tyajl_handle hand, \r\n\t\t\t\t\tconst unsigned char*\tjsonText,\r\n\t\t\t\t\tint\t\t\t\t\t\tjsonTextLength\r\n\t\t\t\t);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_tree.c",
    "content": "/*\r\n * Copyright (c) 2010-2011  Florian Forster  <ff at octo.it>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n// Ignore Warnings\r\n// C4100 : 'identifier' : unreferenced formal parameter\r\n#pragma warning( disable : 4100 )\r\n\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n#include <string.h>\r\n#include <errno.h>\r\n\r\n#include \"api/yajl_tree.h\"\r\n#include \"api/yajl_parse.h\"\r\n\r\n#include \"yajl_parser.h\"\r\n\r\n#include \"yajl_assert.h\"\r\n\r\n#ifdef WIN32\r\n#define snprintf sprintf_s\r\n#endif\r\n\r\n#define STATUS_CONTINUE 1\r\n#define STATUS_ABORT    0\r\n\r\nstruct stack_elem_s;\r\ntypedef struct stack_elem_s stack_elem_t;\r\nstruct stack_elem_s\r\n{\r\n    char * key;\r\n    yajl_val value;\r\n    stack_elem_t *next;\r\n};\r\n\r\nstruct context_s\r\n{\r\n    stack_elem_t *stack;\r\n    yajl_val root;\r\n    char *errbuf;\r\n    size_t errbuf_size;\r\n};\r\ntypedef struct context_s context_t;\r\n\r\n#define RETURN_ERROR(ctx,retval,...) {                                  \\\r\n        if ((ctx)->errbuf != NULL)                                      \\\r\n            snprintf ((ctx)->errbuf, (ctx)->errbuf_size, __VA_ARGS__);  \\\r\n        return (retval);                                                \\\r\n    }\r\n\r\nstatic yajl_val value_alloc (yajl_type type)\r\n{\r\n    yajl_val v;\r\n\r\n    v = malloc (sizeof (*v));\r\n    if (v == NULL) return (NULL);\r\n    memset (v, 0, sizeof (*v));\r\n    v->type = type;\r\n\r\n    return (v);\r\n}\r\n\r\nstatic void yajl_object_free (yajl_val v)\r\n{\r\n    size_t i;\r\n\r\n    if (!YAJL_IS_OBJECT(v)) return;\r\n\r\n    for (i = 0; i < v->u.object.len; i++)\r\n    {\r\n        free((char *) v->u.object.keys[i]);\r\n        v->u.object.keys[i] = NULL;\r\n        yajl_tree_free (v->u.object.values[i]);\r\n        v->u.object.values[i] = NULL;\r\n    }\r\n\r\n    free((void*) v->u.object.keys);\r\n    free(v->u.object.values);\r\n    free(v);\r\n}\r\n\r\nstatic void yajl_array_free (yajl_val v)\r\n{\r\n    size_t i;\r\n\r\n    if (!YAJL_IS_ARRAY(v)) return;\r\n\r\n    for (i = 0; i < v->u.array.len; i++)\r\n    {\r\n        yajl_tree_free (v->u.array.values[i]);\r\n        v->u.array.values[i] = NULL;\r\n    }\r\n\r\n    free(v->u.array.values);\r\n    free(v);\r\n}\r\n\r\n/*\r\n * Parsing nested objects and arrays is implemented using a stack. When a new\r\n * object or array starts (a curly or a square opening bracket is read), an\r\n * appropriate value is pushed on the stack. When the end of the object is\r\n * reached (an appropriate closing bracket has been read), the value is popped\r\n * off the stack and added to the enclosing object using \"context_add_value\".\r\n */\r\nstatic int context_push(context_t *ctx, yajl_val v)\r\n{\r\n    stack_elem_t *stack;\r\n\r\n    stack = malloc (sizeof (*stack));\r\n    if (stack == NULL)\r\n        RETURN_ERROR (ctx, ENOMEM, \"Out of memory\");\r\n    memset (stack, 0, sizeof (*stack));\r\n\r\n    (void)assert ((ctx->stack == NULL)\r\n            || YAJL_IS_OBJECT (v)\r\n            || YAJL_IS_ARRAY (v));\r\n\r\n    stack->value = v;\r\n    stack->next = ctx->stack;\r\n    ctx->stack = stack;\r\n\r\n    return (0);\r\n}\r\n\r\nstatic yajl_val context_pop(context_t *ctx)\r\n{\r\n    stack_elem_t *stack;\r\n    yajl_val v;\r\n\r\n    if (ctx->stack == NULL)\r\n        RETURN_ERROR (ctx, NULL, \"context_pop: \"\r\n                      \"Bottom of stack reached prematurely\");\r\n\r\n    stack = ctx->stack;\r\n    ctx->stack = stack->next;\r\n\r\n    v = stack->value;\r\n\r\n    free (stack);\r\n\r\n    return (v);\r\n}\r\n\r\nstatic int object_add_keyval(context_t *ctx,\r\n                             yajl_val obj, char *key, yajl_val value)\r\n{\r\n    const char **tmpk;\r\n    yajl_val *tmpv;\r\n\r\n    /* We're checking for NULL in \"context_add_value\" or its callers. */\r\n    (void)assert (ctx != NULL);\r\n    (void)assert (obj != NULL);\r\n    (void)assert (key != NULL);\r\n    (void)assert (value != NULL);\r\n\r\n    /* We're assuring that \"obj\" is an object in \"context_add_value\". */\r\n    (void)assert(YAJL_IS_OBJECT(obj));\r\n\r\n    tmpk = realloc((void *) obj->u.object.keys, sizeof(*(obj->u.object.keys)) * (obj->u.object.len + 1));\r\n    if (tmpk == NULL)\r\n        RETURN_ERROR(ctx, ENOMEM, \"Out of memory\");\r\n    obj->u.object.keys = tmpk;\r\n\r\n    tmpv = realloc(obj->u.object.values, sizeof (*obj->u.object.values) * (obj->u.object.len + 1));\r\n    if (tmpv == NULL)\r\n        RETURN_ERROR(ctx, ENOMEM, \"Out of memory\");\r\n    obj->u.object.values = tmpv;\r\n\r\n    obj->u.object.keys[obj->u.object.len] = key;\r\n    obj->u.object.values[obj->u.object.len] = value;\r\n    obj->u.object.len++;\r\n\r\n    return (0);\r\n}\r\n\r\nstatic int array_add_value (context_t *ctx,\r\n                            yajl_val array, yajl_val value)\r\n{\r\n    yajl_val *tmp;\r\n\r\n    /* We're checking for NULL pointers in \"context_add_value\" or its\r\n     * callers. */\r\n    (void)assert (ctx != NULL);\r\n    (void)assert (array != NULL);\r\n    (void)assert (value != NULL);\r\n\r\n    /* \"context_add_value\" will only call us with array values. */\r\n    (void)assert(YAJL_IS_ARRAY(array));\r\n    \r\n    tmp = realloc(array->u.array.values,\r\n                  sizeof(*(array->u.array.values)) * (array->u.array.len + 1));\r\n    if (tmp == NULL)\r\n        RETURN_ERROR(ctx, ENOMEM, \"Out of memory\");\r\n    array->u.array.values = tmp;\r\n    array->u.array.values[array->u.array.len] = value;\r\n    array->u.array.len++;\r\n\r\n    return 0;\r\n}\r\n\r\n/*\r\n * Add a value to the value on top of the stack or the \"root\" member in the\r\n * context if the end of the parsing process is reached.\r\n */\r\nstatic int context_add_value (context_t *ctx, yajl_val v)\r\n{\r\n    /* We're checking for NULL values in all the calling functions. */\r\n    (void)assert (ctx != NULL);\r\n    (void)assert (v != NULL);\r\n\r\n    /*\r\n     * There are three valid states in which this function may be called:\r\n     *   - There is no value on the stack => This is the only value. This is the\r\n     *     last step done when parsing a document. We assign the value to the\r\n     *     \"root\" member and return.\r\n     *   - The value on the stack is an object. In this case store the key on the\r\n     *     stack or, if the key has already been read, add key and value to the\r\n     *     object.\r\n     *   - The value on the stack is an array. In this case simply add the value\r\n     *     and return.\r\n     */\r\n    if (ctx->stack == NULL)\r\n    {\r\n        (void)assert (ctx->root == NULL);\r\n        ctx->root = v;\r\n        return (0);\r\n    }\r\n    else if (YAJL_IS_OBJECT (ctx->stack->value))\r\n    {\r\n        if (ctx->stack->key == NULL)\r\n        {\r\n            if (!YAJL_IS_STRING (v))\r\n                RETURN_ERROR (ctx, EINVAL, \"context_add_value: \"\r\n                              \"Object key is not a string (%#04x)\",\r\n                              v->type);\r\n\r\n            ctx->stack->key = v->u.string;\r\n            v->u.string = NULL;\r\n            free(v);\r\n            return (0);\r\n        }\r\n        else /* if (ctx->key != NULL) */\r\n        {\r\n            char * key;\r\n\r\n            key = ctx->stack->key;\r\n            ctx->stack->key = NULL;\r\n            return (object_add_keyval (ctx, ctx->stack->value, key, v));\r\n        }\r\n    }\r\n    else if (YAJL_IS_ARRAY (ctx->stack->value))\r\n    {\r\n        return (array_add_value (ctx, ctx->stack->value, v));\r\n    }\r\n    else\r\n    {\r\n        RETURN_ERROR (ctx, EINVAL, \"context_add_value: Cannot add value to \"\r\n                      \"a value of type %#04x (not a composite type)\",\r\n                      ctx->stack->value->type);\r\n    }\r\n}\r\n\r\nstatic int handle_string (void *ctx,\r\n                          const unsigned char *string, size_t string_length, int cte_pool)\r\n{\r\n    yajl_val v;\r\n\t(void)cte_pool;\r\n\r\n    v = value_alloc (yajl_t_string);\r\n    if (v == NULL)\r\n        RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n\r\n    v->u.string = (char *)malloc (string_length + 1);\r\n    if (v->u.string == NULL)\r\n    {\r\n        free (v);\r\n        RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n    }\r\n    memcpy(v->u.string, string, string_length);\r\n    v->u.string[string_length] = 0;\r\n\r\n    return ((context_add_value ((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_number (void *ctx, const char *string, size_t string_length)\r\n{\r\n    yajl_val v;\r\n    char *endptr;\r\n\r\n    v = value_alloc(yajl_t_number);\r\n    if (v == NULL)\r\n        RETURN_ERROR((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n\r\n    v->u.number.r = (char *)malloc(string_length + 1);\r\n    if (v->u.number.r == NULL)\r\n    {\r\n        free(v);\r\n        RETURN_ERROR((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n    }\r\n    memcpy(v->u.number.r, string, string_length);\r\n    v->u.number.r[string_length] = 0;\r\n\r\n    v->u.number.flags = 0;\r\n\r\n    endptr = NULL;\r\n    errno = 0;\r\n    v->u.number.i = yajl_parse_integer((const unsigned char *) v->u.number.r,\r\n                                       strlen(v->u.number.r));\r\n    if ((errno == 0) && (endptr != NULL) && (*endptr == 0))\r\n        v->u.number.flags |= YAJL_NUMBER_INT_VALID;\r\n\r\n    endptr = NULL;\r\n    errno = 0;\r\n    v->u.number.d = strtod(v->u.number.r, &endptr);\r\n    if ((errno == 0) && (endptr != NULL) && (*endptr == 0))\r\n        v->u.number.flags |= YAJL_NUMBER_DOUBLE_VALID;\r\n\r\n    return ((context_add_value((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_start_map (void *ctx, unsigned int size)\r\n{\r\n    yajl_val v;\r\n//\tsize = size;\t// Avoid Warning.\r\n\r\n    v = value_alloc(yajl_t_object);\r\n    if (v == NULL)\r\n        RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n\r\n    v->u.object.keys = NULL;\r\n    v->u.object.values = NULL;\r\n    v->u.object.len = 0;\r\n\r\n    return ((context_push ((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_end_map (void *ctx)\r\n{\r\n    yajl_val v;\r\n\r\n    v = context_pop ((context_t *)ctx);\r\n    if (v == NULL)\r\n        return (STATUS_ABORT);\r\n\r\n    return ((context_add_value ((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_start_array (void *ctx, unsigned int size)\r\n{\r\n    yajl_val v;\r\n\t// size = size;\t// Avoid Warning.\r\n\r\n    v = value_alloc(yajl_t_array);\r\n    if (v == NULL)\r\n        RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n\r\n    v->u.array.values = NULL;\r\n    v->u.array.len = 0;\r\n\r\n    return ((context_push ((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_end_array (void *ctx)\r\n{\r\n    yajl_val v;\r\n\r\n    v = context_pop ((context_t *)ctx);\r\n    if (v == NULL)\r\n        return (STATUS_ABORT);\r\n\r\n    return ((context_add_value ((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_boolean (void *ctx, int boolean_value)\r\n{\r\n    yajl_val v;\r\n\r\n    v = value_alloc (boolean_value ? yajl_t_true : yajl_t_false);\r\n    if (v == NULL)\r\n        RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n\r\n    return ((context_add_value (ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\nstatic int handle_null (void *ctx)\r\n{\r\n    yajl_val v;\r\n\r\n    v = value_alloc (yajl_t_null);\r\n    if (v == NULL)\r\n        RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, \"Out of memory\");\r\n\r\n    return ((context_add_value ((context_t *)ctx, v) == 0) ? STATUS_CONTINUE : STATUS_ABORT);\r\n}\r\n\r\n/*\r\n * Public functions\r\n */\r\nyajl_val yajl_tree_parse (const char *input,\r\n                          char *error_buffer, size_t error_buffer_size)\r\n{\r\n    static const yajl_callbacks callbacks =\r\n        {\r\n            /* null        = */ handle_null,\r\n            /* boolean     = */ handle_boolean,\r\n            /* integer     = */ NULL,\r\n            /* double      = */ NULL,\r\n            /* number      = */ handle_number,\r\n            /* string      = */ handle_string,\r\n            /* start map   = */ handle_start_map,\r\n            /* map key     = */ handle_string,\r\n            /* end map     = */ handle_end_map,\r\n            /* start array = */ handle_start_array,\r\n            /* end array   = */ handle_end_array\r\n        };\r\n\r\n    yajl_handle handle;\r\n    yajl_status status;\r\n\tcontext_t ctx = { NULL, NULL, NULL, 0 };\r\n\r\n\tctx.errbuf = error_buffer;\r\n\tctx.errbuf_size = error_buffer_size;\r\n\r\n    if (error_buffer != NULL)\r\n        memset (error_buffer, 0, error_buffer_size);\r\n\r\n    handle = yajl_alloc (&callbacks, NULL, &ctx);\r\n    yajl_config(handle, yajl_allow_comments, 1);\r\n\r\n    status = yajl_parse(handle,\r\n                        (unsigned char *) input,\r\n                        strlen (input));\r\n    status = yajl_complete_parse (handle);\r\n    if (status != yajl_status_ok) {\r\n        if (error_buffer != NULL && error_buffer_size > 0) {\r\n            snprintf(\r\n                error_buffer, error_buffer_size, \"%s\",\r\n                (char *) yajl_get_error(handle, 1,\r\n                                        (const unsigned char *) input,\r\n                                        strlen(input)));\r\n        }\r\n        yajl_free (handle);\r\n        return NULL;\r\n    }\r\n\r\n    yajl_free (handle);\r\n    return (ctx.root);\r\n}\r\n\r\nyajl_val yajl_tree_get(yajl_val n, const char ** path, yajl_type type)\r\n{\r\n    if (!path) return NULL;\r\n    while (n && *path) {\r\n        unsigned int i;\r\n\r\n        if (n->type != yajl_t_object) return NULL;\r\n        for (i = 0; i < n->u.object.len; i++) {\r\n            if (!strcmp(*path, n->u.object.keys[i])) {\r\n                n = n->u.object.values[i];\r\n                break;\r\n            }\r\n        }\r\n        if (i == n->u.object.len) return NULL;\r\n        path++;\r\n    }\r\n    if (n && type != yajl_t_any && type != n->type) n = NULL;\r\n    return n;\r\n}\r\n\r\nvoid yajl_tree_free (yajl_val v)\r\n{\r\n    if (v == NULL) return;\r\n\r\n    if (YAJL_IS_STRING(v))\r\n    {\r\n        free(v->u.string);\r\n        free(v);\r\n    }\r\n    else if (YAJL_IS_NUMBER(v))\r\n    {\r\n        free(v->u.number.r);\r\n        free(v);\r\n    }\r\n    else if (YAJL_GET_OBJECT(v))\r\n    {\r\n        yajl_object_free(v);\r\n    }\r\n    else if (YAJL_GET_ARRAY(v))\r\n    {\r\n        yajl_array_free(v);\r\n    }\r\n    else /* if (yajl_t_true or yajl_t_false or yajl_t_null) */\r\n    {\r\n        free(v);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/libs/JSonParser/yajl_version.c",
    "content": "/*\r\n#include <yajl/yajl_version.h>\r\n\r\nint yajl_version(void)\r\n{\r\n\treturn YAJL_VERSION;\r\n}\r\n*/\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/CompilerProject/BaseType.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef BASETYPE_H\r\n#define BASETYPE_H\r\n\r\n#include <string>\r\n#include <iostream>\r\n\r\n#pragma warning( disable : 4996 )\r\n#pragma warning( disable : 4482 )\r\n\r\n#define EXPAND(count,arr,item)\texpand(&count,(void***)&arr,(void*)item)\r\n\r\n#define CLEAR(a,b)\t\tfor (int n=0; n < b; n++) {\\\r\n\t\t\t\t\t\t\tdelete a[n];\\\r\n\t\t\t\t\t\t} delete[] a; b\t= 0; a = NULL\r\n\r\n\r\n#include \"assert_klb.h\"\r\n#define CS_Assert(cond,msg,...)\t\tklb_assert(cond, msg, __VA_ARGS__)\r\n#define CS_AssertAlways(msg,...)\tklb_assertAlways(msg, __VA_ARGS__)\r\n\r\n\r\n// -----------------------------------------------------------------------\r\n// Global Types\r\n// -----------------------------------------------------------------------\r\ntypedef int\t\t\t\t\ts32;\r\ntypedef unsigned int\t\tu32;\r\ntypedef short\t\t\t\ts16;\r\ntypedef unsigned short\t\tu16;\r\ntypedef char\t\t\t\ts8;\r\ntypedef unsigned char\t\tu8;\r\ntypedef long long           s64;\r\ntypedef unsigned long long  u64;\r\ntypedef unsigned int\t\tptrAsInt;\r\ntypedef u16\t\t\t\t\tuniChar;\r\ntypedef\tu32\t\t\t\t\tuint;\r\ntypedef u8\t\t\t\t\tbyte;\r\ntypedef s8\t\t\t\t\tsbyte;\r\n#ifndef NULL\r\n\t#define NULL\t\t\t(0)\r\n#endif\r\n\r\n// -----------------------------------------------------------------------\r\n//  Classes used by the compiler to describe all the item in the C# Language.\r\n// -----------------------------------------------------------------------\r\n/** Base class for all named symbol **/\r\nclass SymbolDictionnary;\r\nclass Symbol;\r\nclass AbstractContainer;\t// Struct, Class, Interface use same holder to simplify implementation.\r\nclass Accessor;\r\nclass Attribute;\r\nclass Argument;\r\nclass Enum;\r\nclass Method;\r\nclass NameSpace;\r\nclass Uses;\r\nclass TypeObject;\r\nclass Expression;\r\nclass Statement;\r\nclass Variable;\r\nclass Indexer;\r\nclass Delegate;\r\n\r\nenum EGENRE {\r\n\t_UNDEFGENRE\t\t\t= 0,\r\n\t_ABSTRACTCONTAINER\t= 0x0001,\r\n\t_DELEGATE\t\t\t= 0x0002,\r\n\t_ENUM\t\t\t\t= 0x0004,\r\n\t_MEMBER\t\t\t\t= 0x0008,\r\n\t_VARIABLE\t\t\t= 0x0010,\r\n\t_METHOD\t\t\t\t= 0x0020,\r\n\t_ACCESSOR\t\t\t= 0x0040,\r\n\t_STATEMENT\t\t\t= 0x0080,\r\n\t_NAMESPACE\t\t\t= 0x0100,\r\n\t_ENUMENTRY\t\t\t= 0x0200,\r\n\t_GENDEFENTRY\t\t= 0x0400,\r\n\t_METHODLIST\t\t\t= 0x0800,\r\n};\r\n\r\nstruct SRSymbol {\r\n\tSymbol*\t\tpSymbol;\r\n\tEGENRE\t\tsymbolType;\r\n\tTypeObject*\tpType;\r\n\r\n\tvoid dump(bool assignSide);\r\n};\r\n\r\nstruct StringID {\r\n\tint\t\t\tm_id;\r\n\tconst char*\tm_str;\r\n\tStringID*\tm_next;\r\n\tbool\t\tm_isDumped;\r\n};\r\n\r\nstruct SValue {\r\n\tSValue();\r\n\r\n\tunion {\r\n\t\tdouble\t\t\t\td;\r\n\t\tfloat\t\t\t\tf;\r\n\t\ts64\t\t\t\t\tl;\r\n\t\tu64\t\t\t\t\tul;\r\n\t\ts32\t\t\t\t\ti;\r\n\t\tu32\t\t\t\t\tui;\r\n\t\tconst char*\t\t\tstr;\r\n\t\tvoid*\t\t\t\tptr;\r\n\t} v;\r\n\tint type;\r\n\tint strLen;\r\n\tStringID* pString;\r\n\r\n\tstatic int\t\toperatorType(SValue& a, SValue& b);\r\n\tSValue\tToType\t\t(int type);\r\n};\r\n\r\n// -----------------------------------------------------------------------\r\n//\tDefined Type used by the compiler for :\r\n//\t- Differenciate type within an abstract container\r\n//  - Differenciate user type from predefined type\r\n//  - Native type from instances of objets/ref\r\n// -----------------------------------------------------------------------\r\n\r\nconst u32\tET_CLASS\t\t= 0x01000000;\r\nconst u32\tET_INTERFACE\t= 0x02000000;\r\nconst u32\tET_STRUCT\t\t= 0x03000000;\r\n\r\nconst u32\tET_COMPLEXMASK\t= 0x0000FFFF;\r\nconst u32\tET_INFOMASK\t\t= 0x00F00000;\r\nconst u32\tET_PRIMITIVEMASK= 0xFF000000;\r\n\r\nconst u32\tET_USERSPACE\t= 0x00800000;\r\nconst u32\t_TYPE_USEROBJECT= ET_USERSPACE;\r\nconst u32\tET_PREINSTALL\t= 0x00400000;\r\nconst u32\tET_ARRAY\t\t= 0x00200000;\r\n\r\nconst u32\tET_BASETYPE\t\t= 0x80000000;\r\nconst u32\tET_SIGNEDTYPE\t= 0x40000000;\r\nconst u32\tET_NUMBER\t\t= 0x20000000;\r\nconst u32\tET_POINTER\t\t= 0x10000000;\r\n\r\nconst u32\tET_SIZE_1\t\t= 1;\r\nconst u32\tET_SIZE_2\t\t= 2;\r\nconst u32\tET_SIZE_4\t\t= 4;\r\nconst u32\tET_SIZE_8\t\t= 8;\r\n\r\nconst u32\tET_VOID\t\t\t= ET_BASETYPE\t| 0;\r\nconst u32\tET_BOOL\t\t\t= ET_BASETYPE\t| 0x11;\r\nconst u32\tET_NULL\t\t\t= ET_BASETYPE\t| 0x12;\r\nconst u32\tET_INTPTR\t\t= ET_BASETYPE\t| 0x13;\r\nconst u32\tET_INT8\t\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_1;\r\nconst u32\tET_INT16\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_2;\r\nconst u32\tET_INT32\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_4;\r\nconst u32\tET_INT64\t\t= ET_BASETYPE\t| ET_SIGNEDTYPE\t|\tET_SIZE_8;\r\nconst u32\tET_UINT8\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_1;\r\nconst u32\tET_UINT16\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_2;\r\nconst u32\tET_UINT32\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_4;\r\nconst u32\tET_UINT64\t\t= ET_BASETYPE\t|\t\t\t\t\tET_SIZE_8;\r\nconst u32\tET_CHAR\t\t\t= ET_UINT16\t\t| 0x20; // Just to make sure that CHAR and UINT16 have actually a unique code.\r\nconst u32\tET_FLOAT\t\t= ET_BASETYPE\t| ET_NUMBER\t\t|\tET_SIZE_4;\r\nconst u32\tET_DOUBLE\t\t= ET_BASETYPE\t| ET_NUMBER\t\t|\tET_SIZE_8;\r\n\r\n//\r\n// Standard Types\r\n//\r\nenum EnumTypeObject {\r\n\tTYPE_UNRESOLVED\t\t= 0x7FFFFFFF,\r\n\tTYPE_UNDEFINED\t\t= TYPE_UNRESOLVED,\r\n\tTYPE_SBYTE\t\t\t= ET_INT8,\r\n\tTYPE_BYTE\t\t\t= ET_UINT8,\r\n\tTYPE_SHORT\t\t\t= ET_INT16,\r\n\tTYPE_USHORT\t\t\t= ET_UINT16,\r\n\tTYPE_INT\t\t\t= ET_INT32,\r\n\tTYPE_UINT\t\t\t= ET_UINT32,\r\n\tTYPE_LONG\t\t\t= ET_INT64,\r\n\tTYPE_ULONG\t\t\t= ET_UINT64,\r\n\tTYPE_CHAR\t\t\t= ET_CHAR,\r\n\tTYPE_FLOAT\t\t\t= ET_FLOAT,\r\n\tTYPE_DOUBLE\t\t\t= ET_DOUBLE,\r\n\tTYPE_BOOL\t\t\t= ET_BOOL,\r\n\tTYPE_OBJECT\t\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFF,\t// Object\tis 0xFFFF\r\n\tTYPE_STRING\t\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFC,\t// String\tis 0xFFFC\r\n\tTYPE_ARRAY\t\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFB,\t// Array\tis 0xFFFB\r\n\tTYPE_DELEGATE\t\t= ET_CLASS | ET_PREINSTALL | 0xFFFA,\t// Delegate\tis 0xFFFA\r\n\tTYPE_VOID\t\t\t= ET_VOID,\r\n\tTYPE_INTPTR\t\t\t= ET_INTPTR,\r\n\tTYPE_NULL\t\t\t= ET_NULL\t// Only in constant int type.\r\n};\r\n\r\n\r\n//\r\n// Standard Attributes\r\n//\r\nenum EATTRIBUTE {\r\n\tATT_STATIC\t\t= 0x00000001,\r\n\tATT_PUBLIC\t\t= 0x00000002,\r\n\tATT_PRIVATE\t\t= 0x00000004,\r\n\tATT_PROTECTED\t= 0x00000008,\r\n\tATT_INTERNAL\t= 0x00000010,\r\n\tATT_UNSAFE\t\t= 0x00000020,\r\n\tATT_VIRTUAL\t\t= 0x00000040,\r\n\tATT_FINAL\t\t= 0x00000080,\r\n\tATT_NATIVE\t\t= 0x00000100,\r\n\tATT_ABSTRACT\t= 0x00000200,\r\n\tATT_OPERATOR\t= 0x00000400,\r\n\tATT_READONLY\t= 0x00000800,\r\n\tATT_VOLATILE\t= 0x00001000,\r\n\tATT_CTOR\t\t= 0x00002000,\r\n\tATT_DTOR\t\t= 0x00004000,\r\n\tATT_NEW\t\t\t= 0x00008000,\r\n\tATT_CONST\t\t= 0x00010000,\t// Same as read only ?\r\n\tATT_SEALED\t\t= 0x00000080,\t// Same as FINAL\r\n\tATT_EXTERN\t\t= 0x00020000,\r\n\tATT_PARTIAL\t\t= 0x00000400,\t// Same as OPERATOR but no conflict : use only for class/interface/struct.\r\n\r\n\tATTR_NEW\t\t= 0x00040000,\r\n\t// Attribute type\r\n\tATTRB_ASSEMBLY\t= 0x80000000,\r\n\tATTRB_ANONDELEGATE\t= 0x40000000,\t// Same as FIELD.\r\n\tATTRB_FIELD\t\t= 0x40000000,\r\n\tATTRB_EVENT\t\t= 0x20000000,\r\n\tATTRB_METHOD\t= 0x10000000,\r\n\tATTRB_MODULE\t= 0x08000000,\r\n\tATTRB_PARAM\t\t= 0x04000000,\r\n\tATTRB_PROPERTY\t= 0x02000000,\r\n\tATTRB_RETURN\t= 0x01000000,\r\n\tATTRB_TYPE\t\t= 0x00800000,\r\n\r\n\t// Attribute for param.\r\n\tATT_REF\t\t\t= 0x00400000,\r\n\tATT_OUT\t\t\t= 0x00200000,\r\n\r\n\tATT_CLASS\t\t= 0x00100000,\r\n\tATT_STRUCT\t\t= 0x00080000,\r\n\tATT_INTERFACE\t= 0x00040000,\t// Same as new.\r\n};\r\n\r\n//\r\n// All possible expression AST type.\r\n//\r\nenum EnumExpressionType {\r\n\t// Multiple\r\n\tEXPR_LIST,\r\n\tEXPR_LIST_INIT,\r\n\r\n\t// Create a delegate code, class definition, etc...\r\n\tEXPR_DELEGATECREATE,\r\n\r\n\t// Leaf\r\n\tEXPR_THIS,\r\n\tEXPR_TYPEOF,\t// + Type\r\n\tEXPR_BASE,\r\n\tEXPR_CTE,\r\n\tEXPR_IDENT,\r\n\r\n\t// Single\r\n\tEXPR_REF,\r\n\tEXPR_PLUSPLUS,\r\n\tEXPR_MINUSMINUS,\r\n\tEXPR_ARROW,\t\t// + Id\r\n\tEXPR_NOT,\t\t// !\r\n\tEXPR_LNOT,\t\t// ~\r\n\tEXPR_ADRESSOF,\r\n\tEXPR_SIZEOF,\t// + Type\r\n\tEXPR_PREINCR,\r\n\tEXPR_PREDECR,\r\n\tEXPR_UNARYPLUS,\r\n\tEXPR_UNARYMINUS,\r\n\tEXPR_UNARYMULT,\r\n\tEXPR_IS,\r\n\tEXPR_AS,\r\n\tEXPR_UNCHECKED,\r\n\tEXPR_CHECKED,\r\n\r\n\t// Double & Single\r\n\tEXPR_ACCESS,\t// + Expr|Id\r\n\tEXPR_NEW,\t\t// + Type\r\n\t\r\n\t// Double\r\n\tEXPR_DOT,\r\n\tEXPR_INVOKE,\r\n\tEXPR_CAST,\r\n\tEXPR_CAST_PTR,\r\n\tEXPR_MULT,\r\n\tEXPR_DIV,\r\n\tEXPR_MOD,\r\n\tEXPR_PLUS,\r\n\tEXPR_MINUS,\r\n\tEXPR_LSHFT,\r\n\tEXPR_RSHFT,\r\n\tEXPR_LESS,\r\n\tEXPR_MORE,\r\n\tEXPR_LESSEQ,\r\n\tEXPR_MOREEQ,\r\n\tEXPR_EQUTST,\r\n\tEXPR_DIFFTST,\r\n\tEXPR_LAND,\r\n\tEXPR_LXOR,\r\n\tEXPR_LOR,\r\n\tEXPR_AND,\r\n\tEXPR_OR,\r\n\tEXPR_XOR,\r\n\t\r\n\t// Double (Assignment)\r\n\tEXPR_ASS_EQ,\r\n\tEXPR_ASS_PLUSEQ,\r\n\tEXPR_ASS_MINUSEQ,\r\n\tEXPR_ASS_STAREQ,\r\n\tEXPR_ASS_DIVEQ,\r\n\tEXPR_ASS_MODEQ,\r\n\tEXPR_ASS_XOREQ,\r\n\tEXPR_ASS_ANDEQ,\r\n\tEXPR_ASS_OREQ,\r\n\tEXPR_ASS_RSHFTEQ,\r\n\tEXPR_ASS_LSHFTEQ,\r\n\t\r\n\t// Triple\r\n\tEXPR_COND,\r\n\t\r\n};\r\n\r\nenum EnumStatementType {\r\n\tSTM_UNDEFINED,\r\n\r\n\tSTM_BLOCK,\r\n\tSTM_NILWRAPPER,\t// Empty expression.\r\n\tSTM_NULL,\r\n\tSTM_LABEL,\r\n\tSTM_LOCALVAR,\r\n\tSTM_LOCAL_PERVAR,\r\n\tSTM_WRAP_EXP,\r\n\tSTM_ASSIGN_EXPR,\r\n\tSTM_WRAPPER_POSTINCR,\r\n\tSTM_WRAPPER_POSTDECR,\r\n\tSTM_WRAPPER_PREINCR,\r\n\tSTM_WRAPPER_PREDECR,\r\n\tSTM_IF,\r\n\tSTM_SWITCH,\r\n\tSTM_CASE,\r\n\tSTM_CASEDEFAULT,\r\n\tSTM_UNSAFE,\r\n\tSTM_WHILE,\r\n\tSTM_DOWHILE,\r\n\tSTM_FOR,\r\n\tSTM_FOREACH,\r\n\tSTM_BREAK,\r\n\tSTM_CONTINUE,\r\n\tSTM_GOTO,\r\n\tSTM_GOTOCASE,\r\n\tSTM_GOTODEFAULT,\r\n\tSTM_RETURN,\r\n\tSTM_THROW,\r\n\tSTM_TRY,\r\n\tSTM_CATCH,\r\n\tSTM_FINALLY,\r\n\tSTM_CHECKED,\r\n\tSTM_UNCHECKED,\r\n\tSTM_LOCK,\r\n\tSTM_USING,\r\n};\r\n\r\nenum EOVEROP {\r\n\tOP_PLUS,\r\n\tOP_MINUS,\r\n\tOP_LNOT,\r\n\tOP_NOT,\r\n\tOP_PLUSPLUS,\r\n\tOP_MINUSMINUS,\r\n\tOP_TRUE,\r\n\tOP_FALSE,\r\n\tOP_MULT,\r\n\tOP_DIV,\r\n\tOP_MOD,\r\n\tOP_AND,\r\n\tOP_OR,\r\n\tOP_XOR,\r\n\tOP_LSHFT,\r\n\tOP_RSHFT,\r\n\tOP_EQUAL,\r\n\tOP_DIFF,\r\n\tOP_MORE,\r\n\tOP_LESS,\r\n\tOP_MOREEQ,\r\n\tOP_LESSEQ,\r\n};\r\n\r\nenum ECOMPARISON {\r\n\tCOMP_BETTER,\r\n\tCOMP_EQUIVALENT,\r\n\tCOMP_WORSE,\r\n};\r\n\r\nenum EMATCH {\r\n\tM_IDENTICAL, \r\n\tM_APPLICABLE,\r\n\tM_MISMATCH,\r\n};\r\n\r\n// -----------------------------------------------------------------------\r\n// Compiler Specific Define & Functions\r\n// -----------------------------------------------------------------------\r\n#define ERR_TODO\t\t\t(0000)\r\n#define\tUNSUPPORTED\t\t\t(0001)\r\n#define ERR_INVALID_CHAR\t(0002)\r\n\r\n// Compiler options\r\nconst u32\tCOMPIL_USE_FRAMEWORK\t= 0x00000001;\r\nconst u32\tCOMPIL_IS_FRAMEWORK\t\t= 0x00000002;\r\n\r\nvoid compilerError(int err, const char* format, ...);\r\nvoid expand(int* count, void*** array_, void* newEntry);\r\n\r\n#endif\t//BASETYPE_H\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Array.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_Array.h\"\r\n\r\nnamespace System {\r\n\r\n// -----------------------------------------------------------------------\r\n// Virtual methods\r\n\r\n/*virtual*/\r\nbool AbstractArray::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(AbstractArray,Object);\r\n};\r\n\r\n/*virtual*/\r\nu32 AbstractArray::_processGC() {\r\n\tif(m_arrayObject) {\r\n\t\tu32 lastProcessIndex\t= Memory::getLastProcessIndex();\r\n\t\tu32 countMax\t\t\t= Memory::getProcessSizeMax();\r\n\r\n\t\tif((m_typeIDOfElement & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\tif((_getTypeIDOfElement() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\tfor(int i = lastProcessIndex; i < GetLength(); ++i) {\r\n\t\t\t\t\t// There will always be a struct in i event if it is a 0 filled one.\r\n\t\t\t\t\t// So we always call __Internal_Struct_processGC.\r\n\t\t\t\t\tif(!countMax) {\r\n\t\t\t\t\t\tif(((__GCStruct*)((u8*)m_array + i * m_sizeOfElement))->_processGC() == INCOMPLETE) {\r\n\t\t\t\t\t\t\tMemory::setLastProcessIndex(i);\r\n\t\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcountMax = Memory::getProcessSizeMax();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor(int i = lastProcessIndex; i < GetLength(); ++i) {\r\n\t\t\t\t\t__GCObject* obj = *(__GCObject**)((u8*)m_array + i * m_sizeOfElement);\r\n\t\t\t\t\tif(obj) {\r\n\t\t\t\t\t\tif(!(countMax--)) {\r\n\t\t\t\t\t\t\tMemory::setLastProcessIndex(i);\r\n\t\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tMemory::pushList(obj, 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// There are at least 32 places left.\r\n\t\tMemory::pushList(m_arrayObject, 0);\r\n\t}\r\n\treturn COMPLETE;\r\n}\r\n\r\n/*virtual*/\r\nvoid AbstractArray::_move(__GCObject* prevobj, __GCObject* newobj) {\r\n\tif((__GCObject*)m_arrayObject == prevobj) {\r\n\t\tm_arrayObject = (__GCMalloc*)newobj;\r\n\t\tm_array = m_arrayObject->getBlock();\r\n\t\r\n\t\tif((m_typeIDOfElement & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\tvoid* old = ((__GCMalloc*)prevobj)->getBlock();\r\n\t\t\tif((m_typeIDOfElement & ET_CLASS) == ET_CLASS) {\r\n\t\t\t\tfor(int i = 0; i < m_length; ++i) {\r\n\t\t\t\t\t__GCObject** obj = (__GCObject**)((u8*)m_array + i * m_sizeOfElement);\r\n\t\t\t\t\tif(*obj) {\r\n\t\t\t\t\t\t(*obj)->_moveRef((__GCObject**)((u8*)old + i * m_sizeOfElement), obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if((m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\tfor(int i = 0; i < m_length; ++i) {\r\n\t\t\t\t\t__GCStruct* str = (__GCStruct*)((u8*)m_array + i * m_sizeOfElement);\r\n\t\t\t\t\tstr->_moveAlert((u8*)str - ((u8*)old + i * m_sizeOfElement));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid AbstractArray::_releaseGC() {\r\n\tif(m_arrayObject) {\r\n\t\tif((m_typeIDOfElement & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\tif((m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\tfor(int i = 0; i < m_length; ++i) {\r\n\t\t\t\t\t((__GCStruct*)((u8*)m_array + i * m_sizeOfElement))->_releaseGC();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor(int i = 0; i < m_length; ++i) {\r\n\t\t\t\t\t__GCObject* obj = *(__GCObject**)this->_getValuePtr(i);\r\n\t\t\t\t\tif(obj && !obj->isFreed()) {\r\n\t\t\t\t\t\tobj->_releaseGC();\r\n\t\t\t\t\t\tobj->_removeRef((__GCObject**)_getValuePtr(i));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!m_arrayObject->isFreed()) { m_arrayObject->_removeOwner(this); }\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid AbstractArray::_moveAlert(u32 offset) {\r\n\tObject::_moveAlert(offset);\r\n\tif(m_arrayObject) { m_arrayObject->_moveOwnerAsRef((__GCObject**)((u8*)this - offset) , (__GCObject**)this); }\r\n\tif(!(m_infos & OWN_LENGTHS_BUFFER))\t\t\t{ m_lengths = (u32*)&m_length;\t\t\t}\r\n\tif(!(m_infos & OWN_LOWER_BOUNDS_BUFFER))\t{ m_lowerBounds = (u32*)&m_lowerBound;\t}\r\n}\r\n\r\n// -----------------------------------------------------------------------\r\n\r\n// -----------------------------------------------------------------------\r\n// Constructors - Destructor\r\n\r\nAbstractArray::AbstractArray(u32 rank, u32 length, u32 typeID, size_t sizeOfElement)\r\n: m_array\t\t\t(NULL)\r\n, m_lengths\t\t\t(NULL)\r\n, m_lowerBound\t\t(0)\r\n, m_rank\t\t\t(rank)\r\n, m_length\t\t\t(length)\r\n, m_typeIDOfElement\t(typeID)\r\n, m_sizeOfElement\t(sizeOfElement)\r\n, m_infos\t\t\t(0)\r\n{\r\n\tm_lowerBounds\t= &m_lowerBound;\r\n\tm_lengths\t\t= (u32*)&m_length;\r\n\t\r\n\tm_array = __GCMalloc::allocBlock(sizeOfElement * length, m_arrayObject);\r\n\tm_arrayObject->_addOwner(this);\r\n}\r\n\t\r\nAbstractArray::AbstractArray(u32 rank, u32* lengths, u32 typeID, u32 sizeOfElement, u32* lowerBounds)\r\n: m_array\t\t\t(NULL)\r\n, m_lowerBounds\t\t(NULL)\r\n, m_lengths\t\t\t(NULL)\r\n, m_lowerBound\t\t(0)\r\n, m_rank\t\t\t(rank)\r\n, m_length\t\t\t(0)\r\n, m_typeIDOfElement\t(typeID)\r\n, m_sizeOfElement\t(sizeOfElement)\r\n, m_infos\t\t\t(0)\r\n{\r\n\tif(rank < 1 || !lowerBounds || !lengths) {\r\n\t\tTHROW(CS_NEW CppException());\r\n\t}\r\n\r\n\tm_lowerBounds\t= (u32*)CS_MALLOC(sizeof(u32) * rank);\r\n\tm_lengths\t\t= (u32*)CS_MALLOC(sizeof(u32) * rank);\r\n\tm_infos\t\t\t= OWN_LENGTHS_BUFFER | OWN_LOWER_BOUNDS_BUFFER;\r\n\r\n\tmemcpy(m_lowerBounds, lowerBounds, rank * sizeof(u32));\r\n\tmemcpy(m_lengths, lengths, rank * sizeof(u32));\r\n\r\n\tm_length\t\t= 1;\r\n\tfor(u32 i = 0; i < rank; ++i) {\r\n\t\tif(lengths[i] > 0) {\r\n\t\t\tm_length *= lengths[i];\r\n\t\t}\r\n\t}\r\n\t\r\n\tm_array = __GCMalloc::allocBlock((u32)(sizeOfElement * m_length), m_arrayObject);\r\n\tm_arrayObject->_addOwner(this);\r\n}\r\n\r\nAbstractArray::~AbstractArray() {\r\n\tCS_FREE(m_lowerBounds);\r\n\tCS_FREE(m_lengths);\r\n\r\n\t_releaseGC();\r\n}\r\n\r\n\r\n\r\n// -----------------------------------------------------------------------\r\n\r\n// -----------------------------------------------------------------------\r\n// Protected Methods\r\n\r\nObject*\tAbstractArray::_getValue(s32 index) {\r\n\tif(m_rank != 1) { THROW(CS_NEW ArgumentException()); }\r\n\tif((u32)index < m_lowerBounds[0] || index >= (m_lowerBounds[0] + m_length)) { THROW(CS_NEW IndexOutOfRangeException()); }\r\n\treturn *((System::Object**)((u8*)m_array + ((index - m_lowerBounds[0]) * m_sizeOfElement)));\r\n}\r\n\r\n// -----------------------------------------------------------------------\r\n// Public Methods\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, Object* value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(!value->_isInstanceOf(_array->_getTypeIDOfElement())) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\ts32 startIdx\t= _array->GetLowerBound(1);\r\n\ts32 endIdx\t\t= (s32)(startIdx + _array->m_length - 1);\r\n\r\n\tif(value->CompareTo(_array->_getValue(endIdx)) > 0) {\r\n\t\treturn ~(endIdx + 1);\r\n\t}\r\n\r\n\ts32 currentIdx;\r\n\ts32 compRes;\r\n\twhile(startIdx <= endIdx) {\r\n\t\t currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\r\n\t\t// Throws an ArgumentException if CompareTo throws a CppNotComparable Exception\r\n\t\tTRY\r\n\t\t\tcompRes = value->CompareTo(_array->_getValue(currentIdx));\r\n\t\t\tif(compRes == 0) {\r\n\t\t\t\treturn currentIdx;\r\n\t\t\t} else if(compRes == 1) {\r\n\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t} else /*if(compRes == -1)*/ {\r\n\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t}\r\n\t\tCTRY\r\n\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\tFINALLY\r\n\t\tETRY\r\n\t}\r\n\treturn ~startIdx;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s64 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_LONG) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s64>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, u64 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_ULONG) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u64>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_INT) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s32>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, u32 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_UINT) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u32>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s16 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SHORT) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s16>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, u16 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_USHORT) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u16>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s8 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SBYTE) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s8>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, u8 value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BYTE) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u8>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, float value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_FLOAT) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<float>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, double value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_DOUBLE) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<double>*) _array, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, bool value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BOOL) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<bool>*) _array, value);\r\n}\r\n\r\n/*x*/\t//static s32\t\t\tBinarySearch\t\t\t(AbstractArray* _array, Object* value, IComparer* comparer);\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, Object* value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(index < _array->GetLowerBound(1) || length < 0)\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\tif(!value->_isInstanceOf(_array->_getTypeIDOfElement()) || (index + length) > _array->GetUpperBound(1) + 1)\t{ THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\t// Same comportment as C#\r\n\tif(length == 0) { return -1; }\r\n\r\n\ts32 startIdx\t= index;\r\n\ts32 endIdx\t\t= startIdx + length - 1;\r\n\r\n\t// Throws an InvalidOperationException if CompareTo throws a CppNotComparable Exception\r\n\tTRY\r\n\t\tif(value->CompareTo(_array->_getValue(endIdx)) > 0) {\r\n\t\t\treturn ~(endIdx + 1);\r\n\t\t}\r\n\r\n\t\twhile(startIdx <= endIdx) {\r\n\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\ts32 compRes = value->CompareTo(_array->_getValue(currentIdx));\r\n\t\t\tif(compRes == 0) {\r\n\t\t\t\treturn currentIdx;\r\n\t\t\t} else if(compRes == 1) {\r\n\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t} else /*if(compRes == -1)*/ {\r\n\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t}\r\n\t\t}\r\n\tCTRY\r\n\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\tTHROW(CS_NEW InvalidOperationException());\r\n\tFINALLY\r\n\tETRY\r\n\treturn ~startIdx;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, s64 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_LONG))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s64>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, u64 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_ULONG))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u64>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, s32 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_INT))\t\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s32>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, u32 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_UINT))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u32>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, s16 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SHORT))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s16>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, u16 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_USHORT))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<u16>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, s8 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SBYTE))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s8>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, u8 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BYTE))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<s64>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, float value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_FLOAT))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<float>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, double value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_DOUBLE))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<double>*)_array, index, length, value);\r\n}\r\ns32 AbstractArray::BinarySearch(AbstractArray* _array, s32 index, s32 length, bool value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BOOL))\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\t\r\n\treturn AbstractArray::BinarySearch((Array<bool>*)_array, index, length, value);\r\n}\r\n\r\nvoid AbstractArray::Clear(AbstractArray* _array, s32 index, s32 length) {\r\n\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif((index < _array->GetLowerBound(1)) || (length < 0) || ((index + length) > _array->_acc_gLength())) { \r\n\t\tTHROW(CS_NEW IndexOutOfRangeException()); \r\n\t}\r\n\r\n\tu32 startIndex = index - _array->GetLowerBound(1);\r\n\tmemset((u8*)(_array->m_array) + startIndex * _array->m_sizeOfElement , 0, length * _array->m_sizeOfElement);\r\n}\r\n\r\n/*x*/\tstatic void\t\t\t\tConstrainedCopy\t\t\t(AbstractArray* sourceArray, s32 sourceIndex, AbstractArray* destinationArray, s32 destinationIndex, s32 length);\r\n\r\n/*static*/\r\nvoid AbstractArray::Copy(AbstractArray* sourceArray, AbstractArray* destinationArray, s32 length) {\r\n\tif(!sourceArray || !destinationArray)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t\t}\r\n\tif(sourceArray->m_rank != destinationArray->m_rank)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t\t}\r\n\tif(destinationArray->_isInstanceOf(sourceArray->m_typeIDOfElement))\t\t\t\t{ THROW(CS_NEW ArrayTypeMismatchException());\t}\r\n\t// TODO InvalidCastException\r\n\tif(length < 0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\tif((length > sourceArray->m_length) || (length > destinationArray->m_length))\t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\t// TODO : types checking\r\n\tif(((sourceArray->m_typeIDOfElement & ET_BASETYPE) == ET_BASETYPE) && ((destinationArray->m_typeIDOfElement & ET_BASETYPE) == ET_BASETYPE)) {\r\n\t\tmemcpy(destinationArray->m_array, sourceArray->m_array, length * sourceArray->m_sizeOfElement);\r\n\t} else {\r\n\t\tif((sourceArray->m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\tfor(int i = 0; i < length; ++i) {\r\n\t\t\t\t__GCStruct* dst = (__GCStruct*)(destinationArray->_getValuePtr(i));\r\n\t\t\t\t__GCStruct* src = (__GCStruct*)(sourceArray->_getValuePtr(i));\r\n\t\t\t\tdst->_RefSetValue(src);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor(int i = 0; i < length; ++i) {\r\n\t\t\t\t__GCObject** dst = (__GCObject**)(destinationArray->_getValuePtr(i));\r\n\t\t\t\t__GCObject** src = (__GCObject**)(sourceArray->_getValuePtr(i));\r\n\t\t\t\t__GCObject::_RefSetValue(dst, *src);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*x*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, AbstractArray* destinationArray, s64 length);\r\n/*x*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, s32 sourceIndex, AbstractArray* destinationArray, s32 destinationIndex, s32 length);\r\n/*x*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, s64 sourceIndex, AbstractArray* destinationArray, s64 destinationIndex, s64 length);\r\n/*x*/\tvoid\t\t\t\t\tCopyTo\t\t\t\t\t(AbstractArray* _array, s32 index);\r\n/*x*/\tvoid\t\t\t\t\tCopyTo\t\t\t\t\t(AbstractArray* _array, s64 index);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 length);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 lengths, ...);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s64 lengths, ...);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 length1, s32 length2);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, Array<s32>* lengths, Array<s32>* lowerBounds);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 length1, s32 length2, s32 length3);\r\n/*x*/\t//IEnumerator\t\t\tGetEnumerator\t\t\t();\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/ \r\ns32 AbstractArray::IndexOf(AbstractArray* _array, Object* value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\r\n\tfor(int i = _array->GetLowerBound(1); i <= _array->GetUpperBound(1); ++i) {\r\n\t\tif(_array->_getValue(i)->Equals(value)) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\treturn _array->GetLowerBound(1) - 1;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s64 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_LONG))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s64>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u64 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_ULONG))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u64>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s32 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_INT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s32>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u32 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_UINT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u32>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s16 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SHORT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s16>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u16 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_USHORT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u16>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s8 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SBYTE))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s8>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u8 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BYTE))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) - AbstractArray::IndexOf((Array<u8>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, float value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_FLOAT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<float>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, double value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_DOUBLE))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<double>*)_array, value);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, bool value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BOOL))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<bool>*)_array, value);\r\n}\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, Object* value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tfor(int i = startIndex; i <= _array->GetUpperBound(1); ++i) {\r\n\t\tif(_array->_getValue(i)->Equals(value)) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\treturn _array->GetLowerBound(1) - 1;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s64 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_LONG))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s64>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u64 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_ULONG))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u64>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s32 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_INT))\t\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s32>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u32 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_UINT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u32>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s16 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SHORT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s16>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u16 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_USHORT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u16>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s8 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SBYTE))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s8>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u8 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BYTE))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) - AbstractArray::IndexOf((Array<u8>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, float value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_FLOAT))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<float>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, double value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_DOUBLE))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<double>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, bool value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BOOL))\t{ return _array->GetLowerBound(1) - 1;\t\t}\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<bool>*)_array, value, startIndex - _array->GetLowerBound(1));\r\n}\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, Object* value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\t\t\r\n\tfor(int i = startIndex; i < startIndex + count; ++i) {\r\n\t\tif(_array->_getValue(i)->Equals(value)) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\treturn _array->GetLowerBound(1) - 1;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s64 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_LONG)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s64>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u64 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_ULONG)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u64>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s32 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_INT)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s32>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u32 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_UINT)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u32>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s16 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SHORT)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s16>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u16 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_USHORT)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u16>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, s8 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_SBYTE)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<s8>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, u8 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BYTE)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<u8>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, float value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_FLOAT)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<float>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, double value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_DOUBLE)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<double>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::IndexOf(AbstractArray* _array, bool value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1) || (count < 0) || (startIndex + count > _array->GetUpperBound(1) + 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif((_array->_getTypeIDOfElement() != TYPE_BOOL)) { return _array->GetLowerBound(1) - 1;\t\t}\r\n\t\r\n\treturn _array->GetLowerBound(1) + AbstractArray::IndexOf((Array<bool>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\n\r\n/*x*/\tvoid\t\t\t\t\tInitialize\t\t\t\t();\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, Object* value) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\r\n\tfor(s32 i = _array->GetUpperBound(1); i >= _array->GetLowerBound(1); --i) {\r\n\t\tif(_array->_getValue(i)->Equals(value)) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\treturn _array->GetLowerBound(1) - 1;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s64 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_LONG)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s64>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u64 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_ULONG)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u64>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s32 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_INT)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s32>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u32 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_UINT)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u32>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s16 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SHORT)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s16>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u16 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_USHORT)\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u16>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s8 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SBYTE)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s8>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u8 value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BYTE)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u8>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, float value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_FLOAT)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<float>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, double value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_DOUBLE)\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<double>*)_array, value);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, bool value) {\r\n\tif(!_array)\t\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t\t\t\t\t\t\t\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BOOL)\t\t{ return _array->GetLowerBound(1) - 1;\t }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<bool>*)_array, value);\r\n}\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, Object* value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tfor(s32 i = startIndex; i >= _array->GetLowerBound(1); --i) {\r\n\t\tif(_array->_getValue(i)->Equals(value)) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\treturn _array->GetLowerBound(1) - 1;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s64 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_LONG)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s64>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u64 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_ULONG)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u64>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s32 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_INT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s32>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u32 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_UINT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u32>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s16 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SHORT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s16>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u16 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_USHORT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u16>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s8 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SBYTE)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s8>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u8 value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BYTE)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u8>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, float value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_FLOAT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<float>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, double value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_DOUBLE)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<double>*)_array, value, startIndex);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, bool value, s32 startIndex) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t }\r\n\tif(startIndex < _array->GetLowerBound(1) || startIndex > _array->GetUpperBound(1)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BOOL)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<bool>*)_array, value, startIndex);\r\n}\r\n\r\n// For objects which inherits System::Object.\r\n/*static*/\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, Object* value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\tfor(s32 i = startIndex; i > startIndex - count; --i) {\r\n\t\tif(_array->_getValue(i)->Equals(value)) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\treturn _array->GetLowerBound(1) - 1;\r\n}\r\n\r\n// For value types\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s64 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_LONG)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s64>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u64 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_ULONG)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u64>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s32 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_INT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s32>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u32 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_UINT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u32>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s16 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SHORT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s16>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u16 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_USHORT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u16>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, s8 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_SBYTE)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<s8>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, u8 value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BYTE)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<u8>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, float value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_FLOAT)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<float>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, double value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_DOUBLE)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<double>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\ns32 AbstractArray::LastIndexOf(AbstractArray* _array, bool value, s32 startIndex, s32 count) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((startIndex < _array->GetLowerBound(1)) || (startIndex > _array->GetUpperBound(1)) || (count < 0) || (startIndex - count < _array->GetLowerBound(1) - 1)) { \r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tif(_array->_getTypeIDOfElement() != TYPE_BOOL)\t{ return _array->GetLowerBound(1) - 1; }\r\n\r\n\treturn _array->GetLowerBound(1) + AbstractArray::LastIndexOf((Array<bool>*)_array, value, startIndex - _array->GetLowerBound(1), count);\r\n}\r\n\r\n/*static*/\r\nvoid AbstractArray::Reverse(AbstractArray* _array) {\r\n\tAbstractArray::Reverse(_array, _array->GetLowerBound(1), (s32)_array->m_length);\r\n}\r\n\r\n/*static*/\r\nvoid AbstractArray::Reverse(AbstractArray* _array, s32 index, s32 length) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((index < _array->GetLowerBound(1)) || (length < 0))\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\tif(index + length > _array->GetUpperBound(1) + 1)\t\t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\tswitch(_array->m_sizeOfElement) {\r\n\tcase 1:\r\n\t\t{\r\n\t\t\t// Here the struct cannot contain any pointer.\r\n\t\t\tu8* pStart\t= (u8*)_array->m_array + index;\r\n\t\t\tu8* pEnd\t= (u8*)_array->m_array + index + (length >> 1);\r\n\t\t\tu8* pFill\t= (u8*)_array->m_array + index + length - 1;\r\n\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\tu8 tmp\t\t= *pStart;\r\n\t\t\t\t*pStart++\t= *pFill;\r\n\t\t\t\t*pFill--\t= tmp;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 2:\r\n\t\t{\r\n\t\t\t// Here the struct cannot contain any pointer.\r\n\t\t\tu16* pStart\t= (u16*)_array->m_array + index;\r\n\t\t\tu16* pEnd\t= (u16*)_array->m_array + index + (length >> 1);\r\n\t\t\tu16* pFill\t= (u16*)_array->m_array + index + length - 1;\r\n\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\tu16 tmp\t\t= *pStart;\r\n\t\t\t\t*pStart++\t= *pFill;\r\n\t\t\t\t*pFill--\t= tmp;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 4:\r\n\t\t{\r\n\t\t\tu32* pStart\t= (u32*)_array->m_array + index;\r\n\t\t\tu32* pEnd\t= (u32*)_array->m_array + index + (length >> 1);\r\n\t\t\tu32* pFill\t= (u32*)_array->m_array + index + length - 1;\r\n\t\t\tif((_array->m_typeIDOfElement & ET_BASETYPE) == ET_BASETYPE) {\r\n\t\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\t\tu32 tmp\t\t= *pStart;\r\n\t\t\t\t\t*pStart++\t= *pFill;\r\n\t\t\t\t\t*pFill--\t= tmp;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif((_array->m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\t\t\tu32 tmp\t\t= *pStart;\r\n\t\t\t\t\t\t((__GCStruct*)(pStart))->_RefSetValue(pFill);\r\n\t\t\t\t\t\t((__GCStruct*)(pFill))->_RefSetValue(&tmp);\r\n\t\t\t\t\t\t*pStart++;\r\n\t\t\t\t\t\t*pFill--;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\t\t\tu32 tmp = *pStart;\r\n\t\t\t\t\t\t__GCObject::_RefSetValue((__GCObject**)pStart, *(__GCObject**)pFill);\r\n\t\t\t\t\t\t__GCObject::_RefSetValue((__GCObject**)pFill,  (__GCObject*)tmp);\r\n\t\t\t\t\t\tpStart++;\r\n\t\t\t\t\t\tpFill--;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 8:\r\n\t\t{\r\n\t\t\tu64* pStart\t= (u64*)_array->m_array + index;\r\n\t\t\tu64* pEnd\t= (u64*)_array->m_array + index + (length >> 1);\r\n\t\t\tu64* pFill\t= (u64*)_array->m_array + index + length - 1;\r\n\t\t\tif((_array->m_typeIDOfElement & ET_BASETYPE) == ET_BASETYPE) {\r\n\t\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\t\tu64 tmp\t\t= *pStart;\r\n\t\t\t\t\t*pStart++\t= *pFill;\r\n\t\t\t\t\t*pFill--\t= tmp;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif((_array->m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\t\t\tu64 tmp\t\t= *pStart;\r\n\t\t\t\t\t\t((__GCStruct*)(pStart))->_RefSetValue(pFill);\r\n\t\t\t\t\t\t((__GCStruct*)(pFill))->_RefSetValue(&tmp);\r\n\t\t\t\t\t\t*pStart++;\r\n\t\t\t\t\t\t*pFill--;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\t{\r\n\t\t\t// it must be a struct\r\n\t\t\tu8* pStart\t= (u8*)_array->m_array + index * _array->m_sizeOfElement;\r\n\t\t\tu8* pEnd\t= (u8*)_array->m_array + (index + (length >> 1)) * _array->m_sizeOfElement;\r\n\t\t\tu8* pFill\t= (u8*)_array->m_array + (index + length - 1) * _array->m_sizeOfElement;\r\n\t\t\tu8* tmp\t\t= (u8*)CS_MALLOC(sizeof(u8) * _array->m_sizeOfElement);\r\n\t\t\twhile(pStart < pEnd) {\r\n\t\t\t\tmemcpy(tmp,\tpStart, _array->m_sizeOfElement);\r\n\t\t\t\t((__GCStruct*)(pStart))->_RefSetValue(pFill);\r\n\t\t\t\t((__GCStruct*)(pFill))->_RefSetValue(tmp);\r\n\t\t\t\tpStart = pStart + _array->m_sizeOfElement;\r\n\t\t\t\tpFill  = pFill  - _array->m_sizeOfElement;\r\n\t\t\t}\r\n\t\t\tCS_FREE(tmp);\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*static*/\r\nvoid AbstractArray::Sort(AbstractArray* _array) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\r\n\tif((_array->m_typeIDOfElement & ET_CLASS) == ET_CLASS) {\r\n\t\tArray<System::Object*>::Sort((Array<System::Object*>*)_array);\r\n\t} else {\r\n\t\tif((_array->m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t// TODO - struct - need an implementation of IComparable.\r\n\t\t} else {\r\n\t\t\tswitch(_array->m_sizeOfElement) {\r\n\t\t\tcase 1:\r\n\t\t\t\tAbstractArray::Sort((Array<u8>*)_array);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tAbstractArray::Sort((Array<u16>*)_array);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tAbstractArray::Sort((Array<u32>*)_array);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 8:\r\n\t\t\t\tAbstractArray::Sort((Array<u64>*)_array);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*x*/\tstatic void\t\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* _array, IComparer* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items, IComparer* comparer);\r\n\r\n/*static*/\r\nvoid AbstractArray::Sort(AbstractArray* _array, s32 index, s32 length) {\r\n\tif(!_array)\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\tif(_array->m_rank > 1)\t{ THROW(CS_NEW RankException());\t\t\t}\r\n\tif((index < _array->GetLowerBound(1)) || (length < 0))\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\tif(index + length > _array->GetUpperBound(1) + 1)\t\t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\tif((_array->m_typeIDOfElement & ET_CLASS) == ET_CLASS) {\r\n\t\tArray<System::Object*>::Sort((Array<System::Object*>*)_array, index - _array->GetLowerBound(1), length);\r\n\t} else {\r\n\t\tif((_array->m_typeIDOfElement & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t// TODO - struct - need an implementation of IComparable.\r\n\t\t} else {\r\n\t\t\tswitch(_array->m_sizeOfElement) {\r\n\t\t\tcase 1:\r\n\t\t\t\tAbstractArray::Sort((Array<u8>*)_array, index - _array->GetLowerBound(1), length);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tAbstractArray::Sort((Array<u16>*)_array, index - _array->GetLowerBound(1), length);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tAbstractArray::Sort((Array<u32>*)_array, index - _array->GetLowerBound(1), length);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 8:\r\n\t\t\t\tAbstractArray::Sort((Array<u64>*)_array, index - _array->GetLowerBound(1), length);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\t// Here it should be a struct\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*x*/\tstatic void\t\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items, s32 index, s32 length);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* _array, s32 index, s32 length, IComparer* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items, s32 index, s32 length, IComparer* comparer);\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Array.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Array_h_\r\n#define _CS_Array_h_\r\n\r\n#include \"CS_Object.h\"\r\n#include \"Collections/Generic/Generic.h\"\r\n#include \"InternalUtils.h\"\r\n\r\nnamespace System {\r\n\tclass String;\r\n\ttemplate<class T>\r\n\tclass Array;\r\n\r\n\tclass AbstractArray : public Object {\r\n\tprivate:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ABSTRACTARRAY;\r\n\r\n\t\tstatic const u8\t\tOWN_LENGTHS_BUFFER\t\t= 0x01;\r\n\t\tstatic const u8\t\tOWN_LOWER_BOUNDS_BUFFER\t= 0x02;\r\n\tpublic:\r\n\t\tvirtual bool\t_isInstanceOf\t(u32 typeID);\r\n\t\tvirtual\tu32\t\t_processGC\t\t();\r\n\t\tvirtual\tvoid\t_releaseGC\t\t();\r\n\t\tvirtual void\t_move\t\t\t(__GCObject* prevobj, __GCObject* newobj);\r\n\t\tvirtual void\t_moveAlert\t\t(u32 offset);\r\n\r\n\tprotected:\r\n\t\tvoid*\t\tm_array;\r\n\t\t__GCMalloc* m_arrayObject;\r\n\tprivate:\r\n\t\tu32*\t\tm_lowerBounds;\r\n\t\tu32*\t\tm_lengths;\r\n\t\tu32\t\t\tm_lowerBound;\r\n\t\tu32\t\t\tm_rank;\r\n\t\tu64\t\t\tm_length;\r\n\t\tu32\t\t\tm_typeIDOfElement;\r\n\t\tu32\t\t\tm_sizeOfElement;\r\n\t\tu8\t\t\tm_infos;\r\n\r\n\tpublic:\r\n\t\tAbstractArray(u32 rank, u32 length, u32 typeID, size_t sizeOfElement);\r\n\t\tAbstractArray(u32 rank, u32* lengths, u32 typeID, size_t sizeOfElement, u32* lowerBounds);\r\n\t\t~AbstractArray();\r\n\r\n\t\tinline s32\t\t_acc_gRank\t\t\t()\t\t\t\t{ return (s32)m_rank;\t\t\t\t\t\t}\r\n\t\tinline s32\t\t_acc_gRank$\t\t\t()\t\t\t\t{ CHCKTHIS; return _acc_gRank();\t\t\t}\r\n\t\tinline s32\t\t_acc_gLength\t\t()\t\t\t\t{ return (s32)m_length;\t\t\t\t\t\t}\r\n\t\tinline s32\t\t_acc_gLength$\t\t()\t\t\t\t{ CHCKTHIS; return _acc_gLength();\t\t\t}\r\n\t\tinline s64\t\t_acc_gLongLength\t()\t\t\t\t{ return (s64)m_length;\t\t\t\t\t\t}\r\n\t\tinline s64\t\t_acc_gLongLength$\t()\t\t\t\t{ CHCKTHIS; return _acc_gLongLength();\t\t}\r\n\t\tinline s32\t\tGetLength\t\t\t()\t\t\t\t{ return (s32)m_length;\t\t\t\t\t\t}\r\n\t\tinline s32\t\tGetLength$\t\t\t()\t\t\t\t{ CHCKTHIS; return GetLength();\t\t\t\t}\r\n\t\tinline s64\t\tGetLongLength\t\t()\t\t\t\t{ return (s64)m_length;\t\t\t\t\t\t}\r\n\t\tinline s64\t\tGetLongLength$\t\t()\t\t\t\t{ CHCKTHIS; return GetLongLength();\t\t\t}\r\n\t\tinline s32\t\tGetLowerBound\t\t(s32 dimension) { return (s32)m_lowerBounds[dimension - 1]; }\r\n\t\tinline s32\t\tGetLowerBound$\t\t(s32 dimension) { CHCKTHIS; return GetLowerBound(dimension);}\r\n\t\tinline s32\t\tGetUpperBound\t\t(s32 dimension) { return (s32)(m_lowerBounds[dimension - 1] + m_lengths[dimension - 1] - 1);\t}\r\n\t\tinline s32\t\tGetUpperBound$\t\t(s32 dimension) { CHCKTHIS; return GetUpperBound(dimension);}\r\n\r\n\t// Internal Methods\r\n\tpublic:\r\n\t\tinline\tvoid*\t_getPArray\t\t\t()\t\t\t\t\t\t{ return m_array;\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\tinline void\t\t_setMemCpy\t\t\t(const void* buffer)\t{ memcpy(m_array, buffer, (size_t)(m_length * m_sizeOfElement));}\r\n\tprotected:\r\n\t\tinline\tvoid*\t_getValuePtr\t\t(s32 idx)\t\t{ return ((u8*)m_array + (idx - m_lowerBounds[0]) * m_sizeOfElement);\t}\r\n\t\tinline\tu32\t\t_getSizeOfElement\t()\t\t\t\t{ return m_sizeOfElement;\t\t}\r\n\t\tinline\tu32\t\t_getTypeIDOfElement\t()\t\t\t\t{ return m_typeIDOfElement;\t\t}\r\n\t\tinline\tvoid\t_setTypeIDOfElement\t(u32 typeID)\t{ m_typeIDOfElement = typeID;\t}\r\n\t\tinline\tu32*\t_getLengths\t\t\t()\t\t\t\t{ return m_lengths;\t\t\t\t}\r\n\t\tinline\tu32*\t_getLowerBounds\t\t()\t\t\t\t{ return m_lowerBounds;\t\t\t}\r\n\t\tObject*\t\t\t_getValue\t\t\t(s32 index);\r\n\t\tinline void\t\t_setLength\t\t\t(u64 value)\t\t{ m_length = value;\t\t\t\t}\r\n\r\n\tpublic:\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, Object* value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s64 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, u64 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, u32 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s16 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, u16 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s8 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, u8 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, float value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, double value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, bool value);\r\n/*x*/\t//static s32\t\t\tBinarySearch\t\t\t(AbstractArray* _array, Object* value, IComparer* comparer);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, Object* value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, s64 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, u64 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, s32 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, u32 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, s16 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, u16 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, s8 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, u8 value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, float value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, double value);\r\n\t\tstatic s32\t\t\t\tBinarySearch\t\t\t(AbstractArray* _array, s32 index, s32 length, bool value);\r\n\t\tstatic void\t\t\t\tClear\t\t\t\t\t(AbstractArray* _array, s32 index, s32 length);\r\n\t\tvirtual Object*\t\t\tClone\t\t\t\t\t() = 0;\r\n/*x*/\tstatic void\t\t\t\tConstrainedCopy\t\t\t(AbstractArray* sourceArray, s32 sourceIndex, AbstractArray* destinationArray, s32 destinationIndex, s32 length);\r\n/*a*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, AbstractArray* destinationArray, s32 length);\r\n/*a*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, AbstractArray* destinationArray, s64 length);\r\n/*a*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, s32 sourceIndex, AbstractArray* destinationArray, s32 destinationIndex, s32 length);\r\n/*a*/\tstatic void\t\t\t\tCopy\t\t\t\t\t(AbstractArray* sourceArray, s64 sourceIndex, AbstractArray* destinationArray, s64 destinationIndex, s64 length);\r\n/*a*/\tvoid\t\t\t\t\tCopyTo\t\t\t\t\t(AbstractArray* _array, s32 index);\r\n/*a*/\tvoid\t\t\t\t\tCopyTo\t\t\t\t\t(AbstractArray* _array, s64 index);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 length);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 lengths, ...);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s64 lengths, ...);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 length1, s32 length2);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, Array<s32>* lengths, Array<s32>* lowerBounds);\r\n/*x*/\tstatic AbstractArray*\tCreateInstance\t\t\t(Type elementType, s32 length1, s32 length2, s32 length3);\r\n/*x*/\t//IEnumerator\t\t\tGetEnumerator\t\t\t();\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s64 index);\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s32 index1, s32 index2);\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s64 index1, s64 index2);\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s32 index1, s32 index2, s32 index3);\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s64 index1, s64 index2, s64 index3);\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s32 index1, s32 index2, s32 index3, s32 additionalIndexes, ...);\r\n/*NO*/\t//Object*\t\t\t\tGetValue\t\t\t\t(s64 index1, s64 index2, s64 index3, s64 additionalIndexes, ...);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, Object* value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s64 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u64 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s32 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u32 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s16 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u16 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s8 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u8 value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, float value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, double value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, bool value);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, Object* value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s64 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u64 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s32 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u32 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s16 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u16 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s8 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u8 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, float value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, double value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, bool value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, Object* value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s64 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u64 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s32 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u32 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s16 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u16 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, s8 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, u8 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, float value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, double value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tIndexOf\t\t\t\t\t(AbstractArray* _array, bool value, s32 startIndex, s32 count);\r\n/*x*/\tvoid\t\t\t\t\tInitialize\t\t\t\t();\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, Object* value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s64 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u64 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s32 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u32 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s16 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u16 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s8 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u8 value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, float value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, double value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, bool value);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, Object* value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s64 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u64 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s32 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u32 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s16 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u16 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s8 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u8 value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, float value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, double value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, bool value, s32 startIndex);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, Object* value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s64 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u64 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s32 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u32 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s16 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u16 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, s8 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, u8 value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, float value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, double value, s32 startIndex, s32 count);\r\n\t\tstatic s32\t\t\t\tLastIndexOf\t\t\t\t(AbstractArray* _array, bool value, s32 startIndex, s32 count);\r\n\t\tstatic void\t\t\t\tReverse\t\t\t\t\t(AbstractArray* _array);\r\n\t\tstatic void\t\t\t\tReverse\t\t\t\t\t(AbstractArray* _array, s32 index, s32 length);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s32 index);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s32 indices, ...);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s64 index);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s64 indices, ...);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s32 index1, s32 index2);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s64 index1, s64 index2);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object* value, s32 index1, s32 index2, s32 index3);\r\n/*NO*/\t//void\t\t\t\t\tSetValue\t\t\t\t(Object value, s64 index1, s64 index2, s64 index3);\r\n\t\tstatic void\t\t\t\tSort\t\t\t\t\t(AbstractArray* _array);\r\n/*x*/\tstatic void\t\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* _array, IComparer* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items, IComparer* comparer);\r\n\t\tstatic void\t\t\t\tSort\t\t\t\t\t(AbstractArray* _array, s32 index, s32 length);\r\n/*x*/\tstatic void\t\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items, s32 index, s32 length);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* _array, s32 index, s32 length, IComparer* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(AbstractArray* keys, AbstractArray* items, s32 index, s32 length, IComparer* comparer);\r\n\r\n// template methods\r\n/*x*/\t//template<class T> static ReadOnlyCollection<T>* AsReadOnly\t\t(Array<T>* _array);\r\n\t\ttemplate<class T> static s32\t\t\t\tBinarySearch\t\t\t(Array<T>* _array, T value);\r\n/*x*/\t//template<class T> static s32\t\t\t\tBinarySearch\t\t\t(Array<T>* _array, T value, IComparer<T> comparer);\r\n\t\ttemplate<class T> static s32\t\t\t\tBinarySearch\t\t\t(Array<T>* _array, s32 index, s32 length, T value);\r\n/*x*/\t//template<class T> static s32\t\t\t\tBinarySearch\t\t\t(Array<T>* _array, s32 index, s32 length, T value, IComparer<T>* comparer);\r\n/*x*/\t//template<class TInput, class TOutput> \r\n/*x*/\t//\t\t\t\t\tstatic Array<TOutput>*\tConvertAll\t\t\t\t(Array<TInput>* array, Converter<TInput, TOutput>* converter);\r\n/*x*/\t//template<class T> static bool\t\t\t\tExists\t\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//template<class T> static T*\t\t\t\tFind\t\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//template<class T> static Array<T>*\t\tFindAll\t\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//template<class T> static s32\t\t\t\tFindIndex\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//template<class T> static s32\t\t\t\tFindIndex\t\t\t\t(Array<T>* _array, s32 startIndex, Predicate<T>* match);\r\n/*x*/\t//template<class T> static s32\t\t\t\tFindIndex\t\t\t\t(Array<T>* _array, s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/\t//template<class T> static T*\t\t\t\tFindLast\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//template<class T> static s32\t\t\t\tFindLastIndex\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//template<class T> static s32\t\t\t\tFindLastIndex\t\t\t(Array<T>* _array, s32 startIndex, Predicate<T>* match);\r\n/*x*/\t//template<class T> static int\t\t\t\tFindLastIndex\t\t\t(Array<T>* _array, s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/\t//template<class T> static void\t\t\t\tForEach\t\t\t\t\t(Array<T>* _array, Action<T> action);\r\n\t\ttemplate<class T> static s32\t\t\t\tIndexOf\t\t\t\t\t(Array<T>* _array, T value);\r\n\t\ttemplate<class T> static s32\t\t\t\tIndexOf\t\t\t\t\t(Array<T>* _array, T value, s32 startIndex);\r\n\t\ttemplate<class T> static s32\t\t\t\tIndexOf\t\t\t\t\t(Array<T>* _array, T value, s32 startIndex, s32 count);\r\n\t\ttemplate<class T> static s32\t\t\t\tLastIndexOf\t\t\t\t(Array<T>* _array, T value);\r\n\t\ttemplate<class T> static s32\t\t\t\tLastIndexOf\t\t\t\t(Array<T>* _array, T value, s32 startIndex);\r\n\t\ttemplate<class T> static s32\t\t\t\tLastIndexOf\t\t\t\t(Array<T>* _array, T value, s32 startIndex, s32 count);\r\n\t\ttemplate<class T> static void\t\t\t\tResize\t\t\t\t\t(Array<T>*& _array, s32 newSize);\r\n\t\ttemplate<class T> static void\t\t\t\tSort\t\t\t\t\t(Array<T>* _array);\r\n/*x*/\t//template<class T> static void\t\t\t\tSort\t\t\t\t\t(Array<T>* _array, IComparer<T>* comparer);\r\n/*x*/\t//template<class T> static void\t\t\t\tSort\t\t\t\t\t(Array<T>* _array, Comparison<T> comparison);\r\n\t\ttemplate<class T> static void\t\t\t\tSort\t\t\t\t\t(Array<T>* _array, s32 index, s32 length);\r\n/*x*/\t//template<class T> static void\t\t\t\tSort\t\t\t\t\t(Array<T>* _array, s32 index, s32 length, IComparer<T>* comparer);\r\n/*x*/\t//template<class TKey, class TValue> \r\n/*x*/\t//\t\t\t\t\tstatic void\t\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items);\r\n/*x*/\t//template<class TKey, class TValue> \r\n/*x*/\t//\t\t\t\t\tstatic void\t\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items, IComparer<TKey>* comparer);\r\n/*x*/\t//template<class TKey, class TValue> \r\n/*x*/\t//\t\t\t\t\tstatic void\t\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items, s32 index, s32 length);\r\n/*x*/\t//template<class TKey, class TValue> \r\n/*x*/\t//\t\t\t\t\tstatic void\t\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items, s32 index, s32 length, IComparer<TKey>* comparer);\r\n/*x*/\t//template<class T> static bool\t\t\t\tTrueForAll\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n\r\n\tprivate:\r\n\t\ttemplate<class T> static s32\t\t\t\t_valueType_BinarySearch\t(Array<T>* _array, T value);\r\n\t\ttemplate<class T> static s32\t\t\t\t_valueType_BinarySearch\t(Array<T>* _array, s32 index, s32 length, T value);\r\n\t\ttemplate<class T> static void\t\t\t\t_valueType_Sort\t\t\t(Array<T>* _array);\r\n\t\ttemplate<class T> static void\t\t\t\t_valueType_Sort\t\t\t(Array<T>* _array, s32 index, s32 length);\r\n\r\n\t};\r\n\r\n\r\n\r\n\r\n\ttemplate<class T>\r\n\tclass Array : public AbstractArray {\r\n\t\tfriend class String;\r\n\tprivate:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ARRAY;\r\n\tpublic:\r\n\t\tvirtual bool\t\t_isInstanceOf(u32 typeID);\r\n\r\n\tpublic:\r\n\t\tArray<T>(u32 length);\r\n/*x*/\tArray<T>(u32 rank, u32* lengths);\r\n/*x*/\tArray<T>(u32 rank, System::Collections::Generic::IEnumerable<T>*);\r\n\r\n\t\t~Array<T>();\r\n\r\n\t\tvoid\t\t\t\t\t_array_refSetValue\t\t(s32 idx, T item);\r\n\t\t\r\n\t\tinline T&\t\t\t\t_idx_g_0based\t\t\t(s32 idx)\t\t\t{ return ((T*)m_array)[idx];\t\t\t\t\t\t}\r\n\t\tinline T&\t\t\t\t_idx_g\t\t\t\t\t(s32 idx)\t\t\t{ return ((T*)m_array)[idx - GetLowerBound(1)];\t\t}\r\n\t\tinline T&\t\t\t\t_idx_g$\t\t\t\t\t(s32 idx)\t\t\t{ CHCKTHIS; return _idx_g(idx);\t\t\t\t\t\t}\r\n\t\tinline T&\t\t\t\t_idx$_g\t\t\t\t\t(s32 idx)\t\t\t{ if(((u32)idx) >= (u32)(GetLowerBound(1) + _acc_gLength()) || ((u32)idx < (u32)GetLowerBound(1)) ) { THROW(CS_NEW IndexOutOfRangeException()); } return ((T*)m_array)[idx - GetLowerBound(1)];  }\r\n\t\tinline T&\t\t\t\t_idx$_g$\t\t\t\t(s32 idx)\t\t\t{ CHCKTHIS; return _idx$_g(idx);\t\t\t\t\t}\r\n\t\tinline T\t\t\t\t_idx_s\t\t\t\t\t(s32 idx, T item)\t{ _array_refSetValue(idx, item); return item;\t\t}\r\n\t\tinline T\t\t\t\t_idx_s$\t\t\t\t\t(s32 idx, T item)\t{ CHCKTHIS; return _idx_s(idx, item);\t\t\t\t}\r\n\t\tinline T\t\t\t\t_idx$_s\t\t\t\t\t(s32 idx, T item)\t{ \r\n\t\t\tif(((u32)idx) >= (u32)GetLowerBound(1) + _acc_gLength() || ((u32)idx < (u32)GetLowerBound(1)))\t{ THROW(CS_NEW IndexOutOfRangeException()); }\r\n\t\t\tif(_acc_gRank() > 1)\t{ THROW(CS_NEW ArgumentException()); }\r\n\t\t\t_array_refSetValue(idx, item);\r\n\t\t\treturn item;\r\n\t\t}\r\n\t\tinline T\t\t\t\t_idx$_s$\t\t\t\t(s32 idx, T item)\t{ CHCKTHIS; return _idx$_s(idx, item);\t\t\t\t}\r\n\t\tinline Array<T>*\t\t_s\t\t\t\t\t\t(s32 idx, T item)\t{ _array_refSetValue(idx, item); return this;\t\t}\r\n\r\n\t\tObject*\t\t\t\t\tClone\t\t\t\t\t();\r\n\t\tinline Object*\t\t\tClone$\t\t\t\t\t()\t\t\t\t\t{ CHCKTHIS; return Clone();\t\t\t\t\t\t\t}\r\n\t\r\n\tpublic: // Internal method.\r\n\t\tArray<T>\t\t\t\t\t\t\t\t\t\t(u32 length, T* _array, u32 arrayLen);\r\n\t};\r\n\r\n\ttemplate<class T>\r\n\tbool Array<T>::_isInstanceOf(u32 typeID) {\r\n\t\t_INSTANCEOF(Array,Object);\r\n\t};\r\n\r\n\ttemplate <class T>\r\n\tinline void Array<T>::_array_refSetValue(s32 idx, T item) {\r\n\t\tif((_getTypeIDOfElement() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t((__GCStruct*)((T*)m_array + idx - GetLowerBound(1)))->_RefSetValue(&item);\r\n\t\t} else {\r\n\t\t\t__GCObject::_RefSetValue((__GCObject**)((T*)m_array + idx - GetLowerBound(1)), (__GCObject*)item);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate <> inline void Array<u64>::_array_refSetValue\t(s32 idx, u64 item)\t\t{ ((u64*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<s64>::_array_refSetValue\t(s32 idx, s64 item)\t\t{ ((s64*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<u32>::_array_refSetValue\t(s32 idx, u32 item)\t\t{ ((u32*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<s32>::_array_refSetValue\t(s32 idx, s32 item)\t\t{ ((u32*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<u16>::_array_refSetValue\t(s32 idx, u16 item)\t\t{ ((u16*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<s16>::_array_refSetValue\t(s32 idx, s16 item)\t\t{ ((u16*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<u8 >::_array_refSetValue\t(s32 idx, u8  item)\t\t{ ((u8 *)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<s8 >::_array_refSetValue\t(s32 idx, s8  item)\t\t{ ((u8 *)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<bool>::_array_refSetValue\t (s32 idx, bool item)\t{ ((bool*)m_array)\t[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<double>::_array_refSetValue(s32 idx, double item)\t{ ((double*)m_array)[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<float>::_array_refSetValue (s32 idx, float item)\t{ ((float*)m_array)\t[idx - GetLowerBound(1)] = item; }\r\n\ttemplate <> inline void Array<s32*>::_array_refSetValue (s32 idx, s32* item)\t{ ((s32**)m_array)\t[idx - GetLowerBound(1)] = item; }\r\n\t\r\n\t// Constructors - Destructor\r\n\t// -----------------------------------\r\n\ttemplate<class T>\r\n\tArray<T>::Array(u32 length)\r\n\t: AbstractArray(1, length, __InternalUtilsGetTypeID<T>::getIt(), sizeof(T))\r\n\t{\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tArray<T>::Array(u32 length, T* _array, u32 arrayLen)\r\n\t: AbstractArray(1, length, __InternalUtilsGetTypeID<T>::getIt(), sizeof(T))\r\n\t{\r\n\t\tmemcpy(m_array, _array, arrayLen * sizeof(T));\r\n\t}\r\n\r\n/*x*/ //Array<T>(u32 typeID, u32 rank, System::Collections::Generic::IEnumerable<T>*);\r\n\r\n\ttemplate<class T>\r\n\tArray<T>::~Array() {\r\n\t\t\r\n\t}\r\n\r\n\t// -----------------------------------\r\n\t// Methods\r\n\t// -----------------------------------\r\n\r\n\t\r\n\ttemplate<class T>\r\n\tObject* Array<T>::Clone() {\r\n\t\tArray<T>* obj = CS_NEW Array<T>(_acc_gLength());\r\n\t\tAbstractArray::Copy(this, obj, _acc_gLength());\r\n\t\treturn (Object*)obj;\r\n\t}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// ===================================\r\n// ===================================\r\n// AbstractArray Template Methods\r\n// ===================================\r\n// ===================================\r\n\r\n/*x*/\t//static ReadOnlyCollection<T>* AsReadOnly\t\t(Array<T>* _array);\r\n\r\n\ttemplate<class T>\r\n\ts32 AbstractArray::_valueType_BinarySearch(Array<T>* _array, T value) {\r\n\t\tif(!_array)\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\r\n\t\ts32 startIdx\t= 0;\r\n\t\ts32 endIdx\t\t= _array->_acc_gLength() - 1;\r\n\r\n\t\tif(value > _array->_idx_g(endIdx)) {\r\n\t\t\treturn ~(endIdx + 1);\r\n\t\t}\r\n\r\n\t\twhile(startIdx <= endIdx) {\r\n\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\tif(_array->_idx_g(currentIdx) == value) {\r\n\t\t\t\treturn currentIdx;\r\n\t\t\t} else if(value > _array->_idx_g(currentIdx)) {\r\n\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t} else /*if(value < _array->_idx_g(currentIdx))*/ {\r\n\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ~startIdx;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::BinarySearch(Array<T>* _array, T value) {\r\n\t\tif(!_array)\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\r\n\t\ts32 startIdx\t= 0;\r\n\t\ts32 endIdx\t\t= _array->_acc_gLength() - 1;\r\n\r\n\t\t// Throws an ArgumentException if CompareTo throws a CppNotComparable Exception\r\n\t\tTRY\r\n\t\t\tif(value->CompareTo(_array->_idx_g(endIdx)) > 0) {\r\n\t\t\t\treturn ~(endIdx + 1);\r\n\t\t\t}\r\n\r\n\t\t\twhile(startIdx <= endIdx) {\r\n\t\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\t\ts32 compRes = value->CompareTo(_array->_idx_g(currentIdx));\r\n\t\t\t\tif(compRes == 0) {\r\n\t\t\t\t\treturn currentIdx;\r\n\t\t\t\t} else if(compRes == 1) {\r\n\t\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t\t} else /*if(compRes == -1)*/ {\r\n\t\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tCTRY\r\n\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\tFINALLY\r\n\t\tETRY\r\n\r\n\t\treturn ~startIdx;\r\n\t}\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s64>* _array, s64 value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u64>* _array, u64 value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s32>* _array, s32 value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u32>* _array, u32 value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s16>* _array, s16 value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u16>* _array, u16 value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s8>* _array, s8 value)\t\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u8>* _array, u8 value)\t\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<float>* _array, float value)\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<double>* _array, double value)\t{ return _valueType_BinarySearch(_array, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<bool>* _array, bool value)\t\t{ return _valueType_BinarySearch(_array, value); }\r\n\r\n/*x*/\t//static s32\t\t\tBinarySearch\t\t\t(Array<T>* _array, T value, IComparer<T> comparer);\r\n\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::BinarySearch(Array<T>* _array, s32 index, s32 length, T value) {\r\n\t\tif(!_array)\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\t\tif((index | length) < 0)\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif(!value->_isInstanceOf(_array->_getTypeIDOfElement()) || (index + length) > _array->_acc_gLength())\t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\t\t// Same comportment as C#\r\n\t\tif(length == 0) { return -1; }\r\n\r\n\t\ts32 startIdx\t= index;\r\n\t\ts32 endIdx\t\t= startIdx + length - 1;\r\n\r\n\t\t// Throws an ArgumentException if CompareTo throws a CppNotComparable Exception\r\n\t\tTRY\r\n\t\t\tif(value->CompareTo(_array->_idx_g_0based(endIdx)) > 0) {\r\n\t\t\t\treturn ~(endIdx + 1);\r\n\t\t\t}\r\n\r\n\t\t\twhile(startIdx <= endIdx) {\r\n\t\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\t\ts32 compRes = value->CompareTo(_array->_idx_g_0based(currentIdx));\r\n\t\t\t\tif(compRes == 0) {\r\n\t\t\t\t\treturn currentIdx;\r\n\t\t\t\t} else if(compRes == 1) {\r\n\t\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t\t} else /*if(compRes == -1)*/ {\r\n\t\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tCTRY\r\n\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\tFINALLY\r\n\t\tETRY\r\n\t\treturn ~startIdx;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\ts32 AbstractArray::_valueType_BinarySearch(Array<T>* _array, s32 index, s32 length, T value) {\r\n\t\tif(!_array)\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t\t}\r\n\t\tif((index | length) < 0)\t\t\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif((index + length) > _array->_acc_gLength()) \t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\t\t// Same comportment as C#\r\n\t\tif(length == 0) { return -1; }\r\n\r\n\t\ts32 startIdx\t= index;\r\n\t\ts32 endIdx\t\t= startIdx + length - 1;\r\n\r\n\t\tif(value > _array->_idx_g_0based(endIdx)) {\r\n\t\t\treturn ~(endIdx + 1);\r\n\t\t}\r\n\r\n\t\twhile(startIdx <= endIdx) {\r\n\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\tif(value == _array->_idx_g_0based(currentIdx)) {\r\n\t\t\t\treturn currentIdx;\r\n\t\t\t} else if(value > _array->_idx_g_0based(currentIdx)) {\r\n\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t} else /*if(value < _array->_idx_g_0based(currentIdx))*/ {\r\n\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ~startIdx;\r\n\t}\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s64>* _array, s32 index, s32 length, s64 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u64>* _array, s32 index, s32 length, u64 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s32>* _array, s32 index, s32 length, s32 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u32>* _array, s32 index, s32 length, u32 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s16>* _array, s32 index, s32 length, s16 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u16>* _array, s32 index, s32 length, u16 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<s8>* _array, s32 index, s32 length, s8 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<u8>* _array, s32 index, s32 length, u8 value)\t\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<float>* _array, s32 index, s32 length, float value)\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<double>* _array, s32 index, s32 length, double value)\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\ttemplate<> inline s32 AbstractArray::BinarySearch(Array<bool>* _array, s32 index, s32 length, bool value)\t\t{ return _valueType_BinarySearch(_array, index, length, value); }\r\n\r\n\r\n/*x*/\t//static s32\t\t\tBinarySearch\t\t\t(Array<T>* _array, s32 index, s32 length, T value, IComparer<T>* comparer);\r\n\t\r\n/*x*/\t//static bool\t\t\tExists\t\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//static T*\t\t\t\tFind\t\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//static Array<T>*\t\tFindAll\t\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//static s32\t\t\tFindIndex\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//static s32\t\t\tFindIndex\t\t\t\t(Array<T>* _array, s32 startIndex, Predicate<T>* match);\r\n/*x*/\t//static s32\t\t\tFindIndex\t\t\t\t(Array<T>* _array, s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/\t//static T*\t\t\t\tFindLast\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//static s32\t\t\tFindLastIndex\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n/*x*/\t//static s32\t\t\tFindLastIndex\t\t\t(Array<T>* _array, s32 startIndex, Predicate<T>* match);\r\n/*x*/\t//static int\t\t\tFindLastIndex\t\t\t(Array<T>* _array, s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/\t//static void\t\t\tForEach\t\t\t\t\t(Array<T>* _array, Action<T> action);\r\n\t\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::IndexOf(Array<T>* _array, T value) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(value, _array->_idx_g_0based(i))) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::IndexOf(Array<T>* _array, T value, s32 startIndex) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\tif((u32)startIndex >= (u32)_array->_acc_gLength()) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\t\r\n\t\tfor(int i = startIndex; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(value, _array->_idx_g_0based(i))) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline s32\tAbstractArray::IndexOf(Array<T>* _array, T value, s32 startIndex, s32 count) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\tif(((u32)startIndex >= (u32)_array->_acc_gLength()) || (count < 0) || (startIndex + count > _array->_acc_gLength())) { \r\n\t\t\tTHROW(CS_NEW ArgumentOutOfRangeException()); \r\n\t\t}\r\n\t\t\r\n\t\tfor(int i = startIndex; i < startIndex + count; ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(value, _array->_idx_g_0based(i))) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::LastIndexOf(Array<T>* _array, T value) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tfor(s32 i = _array->_acc_gLength() - 1; i >= 0; --i) {\r\n\t\t\tif(__InternalUtils::_areEqual(value, _array->_idx_g_0based(i))) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::LastIndexOf(Array<T>* _array, T value, s32 startIndex) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\tif((u32)startIndex >= (u32)_array->_acc_gLength()) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\t\r\n\t\tfor(s32 i = startIndex; i >= 0; --i) {\r\n\t\t\tif(__InternalUtils::_areEqual(value, _array->_idx_g_0based(i))) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline s32 AbstractArray::LastIndexOf(Array<T>* _array, T value, s32 startIndex, s32 count) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\tif(((u32)startIndex >= (u32)_array->_acc_gLength()) || (count < 0) || (startIndex - count < -1)) { \r\n\t\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t\t}\r\n\t\t\r\n\t\tfor(s32 i = startIndex; i > startIndex - count; --i) {\r\n\t\t\tif(__InternalUtils::_areEqual(value, _array->_idx_g_0based(i))) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid AbstractArray::Resize(Array<T>*& _array, s32 newSize) {\r\n\t\tif(newSize < 0) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\tif(_array && _array->_acc_gLength() == newSize) return;\r\n\r\n\t\t_array->m_arrayObject->_removeOwner(_array);\r\n\t\tvoid* tmp = __GCMalloc::allocBlock(newSize * _array->_getSizeOfElement(), _array->m_arrayObject);\r\n\t\t_array->m_arrayObject->_addOwner(_array);\r\n\r\n\t\tu32 length = (newSize > _array->_acc_gLength()) ? _array->_acc_gLength() : newSize;\r\n\r\n\t\tmemcpy(tmp, _array->m_array, length * sizeof(T));\r\n\t\t\r\n\t\tif((_array->_getTypeIDOfElement() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\tu32 i = 0;\r\n\t\t\tfor(; i < length; ++i) {\r\n\t\t\t\t__GCStruct* str = (__GCStruct*)((T*)tmp + i);\r\n\t\t\t\tif(str) {\r\n\t\t\t\t\tstr->_moveAlert((u8*)str - (u8*)((T*)_array->m_array + i));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor(; i < (u32)_array->_acc_gLength(); ++i) {\r\n\t\t\t\t((__GCStruct*)((T*)_array->m_array + i))->_RefSetValue((T*)__InternalUtils::m_nullStruct);\r\n\t\t\t}\r\n\t\t} else if((_array->_getTypeIDOfElement() & ET_CLASS) == ET_CLASS) {\r\n\t\t\tu32 i = 0;\r\n\t\t\tfor(; i < length; ++i) {\r\n\t\t\t\t__GCObject** obj = (__GCObject**)((T*)tmp + i);\r\n\t\t\t\tif(*obj) {\r\n\t\t\t\t\t(*obj)->_moveRef((__GCObject**)((T*)_array->m_array + i), obj);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor(; i < (u32)_array->_acc_gLength(); ++i) {\r\n\t\t\t\t_RefSetValue((__GCObject**)((T*)_array->m_array + i), NULL);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t_array->m_array = (T*)tmp;\r\n\t\t_array->_setLength(newSize);\r\n\t}\r\n\t\r\n\ttemplate<class T>\r\n\tvoid AbstractArray::_valueType_Sort(Array<T>* _array) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\t// TODO ? quick sort if m_count > ?\r\n\t\tfor(u32 i = 1; i < (u32)_array->_acc_gLength(); ++i) {\r\n\t\t\tu32 j = i;\r\n\t\t\tT tmp = _array->_idx_g_0based(i);\r\n\t\t\twhile((j > 0) && (_array->_idx_g_0based(j - 1) > tmp)) {\r\n\t\t\t\t_array->_array_refSetValue(j, _array->_idx_g_0based(j-1));\r\n\t\t\t\t--j;\r\n\t\t\t}\r\n\t\t\t_array->_array_refSetValue(j, tmp);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline void AbstractArray::Sort(Array<T>* _array) {\r\n\t\tif(!_array) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tfor(u32 i = 1; i < (u32)_array->_acc_gLength(); ++i) {\r\n\t\t\tu32 j = i;\r\n\t\t\tT tmp = _array->_idx_g_0based(i);\r\n\r\n\t\t\t// Throws an InvalidOperationException if CompareTo throws a CppNotComparable Exception\r\n\t\t\tTRY\r\n\t\t\t\twhile(j > 0 && (_array->_idx_g_0based(j-1)->CompareTo(tmp) > 0)) {\r\n\t\t\t\t\t_array->_array_refSetValue(j, _array->_idx_g_0based(j-1));\r\n\t\t\t\t\t--j;\r\n\t\t\t\t}\r\n\t\t\tCTRY\r\n\t\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\t\tFINALLY\r\n\t\t\tETRY\r\n\t\t\t_array->_array_refSetValue(j, tmp);\r\n\t\t}\r\n\t}\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s64>* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u64>* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s32>* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u32>* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s16>* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u16>* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s8 >* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u8 >* _array)\t\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<float>* _array)\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<double>* _array)\t{ _valueType_Sort(_array); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<bool>* _array)\t\t{ _valueType_Sort(_array); }\r\n\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<T>* _array, IComparer<T>* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<T>* _array, Comparison<T> comparison);\r\n\t\r\n\ttemplate<class T>\r\n\tvoid AbstractArray::_valueType_Sort(Array<T>* _array, s32 index, s32 length) {\r\n\t\tif(!_array)\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\t\tif((index | length) < 0)\t\t\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif(index + length > _array->_acc_gLength())\t{ THROW(CS_NEW ArgumentException()); }\r\n\r\n\t\tfor(int i = index + 1; i < index + length; ++i) {\r\n\t\t\tint j = i;\r\n\t\t\tT tmp = _array->_idx_g_0based(i);\r\n\t\t\twhile(j > index && _array->_idx_g_0based(j - 1) > tmp) {\r\n\t\t\t\t_array->_array_refSetValue(j, _array->_idx_g_0based(j - 1));\r\n\t\t\t\t--j;\r\n\t\t\t}\r\n\t\t\t_array->_array_refSetValue(j, tmp);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline void AbstractArray::Sort(Array<T>* _array, s32 index, s32 length) {\r\n\t\tif(!_array)\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\t\tif((index | length) < 0)\t\t\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif(index + length > _array->_acc_gLength())\t{ THROW(CS_NEW ArgumentException()); }\r\n\t\t\r\n\t\tfor(int i = index + 1; i < index + length; ++i) {\r\n\t\t\tint j = i;\r\n\t\t\tT tmp = _array->_idx_g(i);\r\n\t\t\t// Throws an InvalidOperationException if CompareTo throws a CppNotComparable Exception\r\n\t\t\tTRY\r\n\t\t\t\twhile(j > index && _array->_idx_g_0based(j - 1)->CompareTo(tmp) > 0) {\r\n\t\t\t\t\t_array->_array_refSetValue(j, _array->_idx_g_0based(j - 1));\r\n\t\t\t\t\t--j;\r\n\t\t\t\t}\r\n\t\t\tCTRY\r\n\t\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\t\tFINALLY\r\n\t\t\tETRY\r\n\t\t\t_array->_array_refSetValue(j, tmp);\r\n\t\t}\r\n\t}\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s64>* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u64>* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s32>* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u32>* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s16>* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u16>* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<s8 >* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<u8 >* _array, s32 index, s32 length)\t\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<float>*  _array, s32 index, s32 length)\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<double>* _array, s32 index, s32 length)\t{ _valueType_Sort(_array, index, length); }\r\n\ttemplate<> inline void AbstractArray::Sort(Array<bool>*   _array, s32 index, s32 length)\t{ _valueType_Sort(_array, index, length); }\r\n\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<T>* _array, s32 index, s32 length, IComparer<T>* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items, IComparer<TKey>* comparer);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items, s32 index, s32 length);\r\n/*x*/\t//static void\t\t\tSort\t\t\t\t\t(Array<TKey>* keys, Array<TValue>* items, s32 index, s32 length, IComparer<TKey>* comparer);\r\n/*x*/\t//static bool\t\t\tTrueForAll\t\t\t\t(Array<T>* _array, Predicate<T>* match);\r\n\r\n\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Console.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_Console.h\"\r\n\r\nnamespace System {\r\n\r\n/*static*/\r\nvoid Console::Write(bool value) {\r\n\tprintf(\"%s\", value ? \"True\" : \"False\");\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(uniChar value) {\r\n\tu8 utf8buff[3];\r\n\t_utf16ToUtf8(&value, 1, utf8buff, 3);\r\n\tprintf(\"%s\", utf8buff);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(System::Array<uniChar>* buffer) {\r\n\tu8* utf8buff = (u8*)CS_MALLOC(buffer->_acc_gLength() * 3);\r\n\t_utf16ToUtf8((uniChar*)buffer->_getPArray(), buffer->_acc_gLength(), utf8buff, buffer->_acc_gLength()*3);\r\n\tprintf(\"%s\", utf8buff);\r\n\tCS_FREE(utf8buff);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(double value) {\r\n\tif(value == 0) {\r\n\t\tprintf(\"0\");\r\n\t} else {\r\n\t\tprintf(\"%G\", value);\r\n\t}\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(float value) {\r\n\tprintf(\"%LG\", value);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(s32 value) {\r\n\tprintf(\"%i\", value);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(s64 value) {\r\n\tprintf(\"%li\", value);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(System::Object* value) {\r\n\tprintf(\"%s\", value->ToString()->_toCStr());\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(System::String* value) {\r\n\tprintf(\"%s\", value->_toCStr());\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(u32 value) {\r\n\tprintf(\"%u\", value);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(u64 value) {\r\n\tprintf(\"%u\", value);\r\n}\r\n\r\n/*static*/\r\nvoid Console::Write(System::Array<uniChar>* buffer, u32 index, u32 count) {\r\n\tu8* utf8buff = (u8*)CS_MALLOC(count * 3);\r\n\t_utf16ToUtf8((uniChar*)buffer->_getPArray() + index, count, utf8buff, count * 3);\r\n\tprintf(\"%s\", utf8buff);\r\n\tCS_FREE(utf8buff);\r\n}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Console.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Console_\r\n#define _CS_Console_\r\n\r\n#include \"CS_Object.h\"\r\n#include \"CS_String.h\"\r\n\r\nnamespace System {\r\n\r\n/*static*/ class Console {\r\npublic:\r\n/*x*/\t//static ConsoleColor BackgroundColor { get; set; }\r\n/*x*/\t//static u32 BufferHeight { get; set; }\r\n/*x*/\t//static u32 BufferWidth { get; set; }\r\n/*x*/\t//static bool CapsLock { get; }\r\n/*x*/\t//static u32 CursorLeft { get; set; }\r\n/*x*/\t//static u32 CursorSize { get; set; }\r\n/*x*/\t//static u32 CursorTop { get; set; }\r\n/*x*/\t//static bool CursorVisible { get; set; }\r\n/*x*/\t//static TextWriter Error { get; }\r\n/*x*/\t//static ConsoleColor ForegroundColor { get; set; }\r\n/*x*/\t//static TextReader In { get; }\r\n/*x*/\t//static Encoding InputEncoding { get; set; }\r\n/*x*/\t//static bool KeyAvailable { get; }\r\n/*x*/\t//static u32 LargestWindowHeight { get; }\r\n/*x*/\t//static u32 LargestWindowWidth { get; }\r\n/*x*/\t//static bool NumberLock { get; }\r\n/*x*/\t//static TextWriter Out { get; }\r\n/*x*/\t//static Encoding OutputEncoding { get; set; }\r\n/*x*/\t//static System::String* Title { get; set; }\r\n/*x*/\t//static bool TreatControlCAsInput { get; set; }\r\n/*x*/\t//static u32 WindowHeight { get; set; }\r\n/*x*/\t//static u32 WindowLeft { get; set; }\r\n/*x*/\t//static u32 WindowTop { get; set; }\r\n/*x*/\t//static u32 WindowWidth { get; set; }\r\n/*x*/\t//static event ConsoleCancelEventHandler CancelKeyPress;\r\n\r\n/*x*/\t//static void Beep();\r\n/*x*/\t//static void Beep(u32 frequency, u32 duration);\r\n/*x*/\t//static void Clear();\r\n/*x*/\t//static void MoveBufferArea(u32 sourceLeft, u32 sourceTop, u32 sourceWidth, u32 sourceHeight, u32 targetLeft, u32 targetTop);\r\n/*x*/\t//static void MoveBufferArea(u32 sourceLeft, u32 sourceTop, u32 sourceWidth, u32 sourceHeight, u32 targetLeft, u32 targetTop, uniChar sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor);\r\n/*x*/\t//static Stream OpenStandardError();\r\n/*x*/\t//static Stream OpenStandardError(u32 bufferSize);\r\n/*x*/\t//static Stream OpenStandardInput();\r\n/*x*/\t//static Stream OpenStandardInput(u32 bufferSize);\r\n/*x*/\t//static Stream OpenStandardOutput();\r\n/*x*/\t//static Stream OpenStandardOutput(u32 bufferSize);\r\n/*x*/\t//static u32 Read();\r\n/*x*/\t//static ConsoleKeyInfo ReadKey();\r\n/*x*/\t//static ConsoleKeyInfo ReadKey(bool intercept);\r\n/*x*/\t//static System::String* ReadLine();\r\n/*x*/\t//static void ResetColor();\r\n/*x*/\t//static void SetBufferSize(u32 width, u32 height);\r\n/*x*/\t//static void SetCursorPosition(u32 left, u32 top);\r\n/*x*/\t//static void SetError(TextWriter newError);\r\n/*x*/\t//static void SetIn(TextReader newIn);\r\n/*x*/\t//static void SetOut(TextWriter newOut);\r\n/*x*/\t//static void SetWindowPosition(u32 left, u32 top);\r\n/*x*/\t//static void SetWindowSize(u32 width, u32 height);\r\n/*x*/\tstatic void Write(bool value);\r\n/*x*/\tstatic void Write(uniChar value);\r\n/*x*/\tstatic void Write(System::Array<uniChar>* buffer);\r\n/*x*/\t//static void Write(decimal value);\r\n/*x*/\tstatic void Write(double value);\r\n/*x*/\tstatic void Write(float value);\r\n/*x*/\tstatic void Write(s32 value);\r\n/*x*/\tstatic void Write(s64 value);\r\n/*x*/\tstatic void Write(System::Object* value);\r\n/*x*/\tstatic void Write(System::String* value);\r\n/*x*/\tstatic void Write(u32 value);\r\n/*x*/\tstatic void Write(u64 value);\r\n/*x*/\t//static void Write(System::String* format, System::Object* arg0);\r\n/*x*/\t//static void Write(System::String* format, params object[] arg);\r\n/*x*/\tstatic void Write(System::Array<uniChar>* buffer, u32 index, u32 count);\r\n/*x*/\t//static void Write(System::String* format, System::Object* arg0, System::Object* arg1);\r\n/*x*/\t//static void Write(System::String* format, System::Object* arg0, System::Object* arg1, System::Object* arg2);\r\n/*x*/\t//static void Write(System::String* format, System::Object* arg0, System::Object* arg1, System::Object* arg2, System::Object* arg3);\r\n/*x*/\tstatic void WriteLine()\t\t\t\t\t\t\t\t\t\t\t{ printf(\"\\n\");\t\t\t\t\t}\r\n/*x*/\tinline static void WriteLine(bool value)\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(uniChar value)\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(System::Array<uniChar>* buffer)\t{ Write(buffer); printf(\"\\n\");\t}\r\n/*x*/\t//inline static void WriteLine(decimal value)\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(double value)\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(float value)\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(s32 value)\t\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(s64 value)\t\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(System::Object* value)\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(System::String* value)\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(u32 value)\t\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(u64 value)\t\t\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\t//static void WriteLine(System::String* format, System::Object* arg0)\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\t//static void WriteLine(System::String* format, params object[] arg)\t\t\t\t\t{ Write(value); printf(\"\\n\");\t}\r\n/*x*/\tinline static void WriteLine(System::Array<uniChar>* buffer, u32 index, u32 count)\t\t{ Write(buffer, index, count); printf(\"\\n\");\t}\r\n/*x*/\t//static void WriteLine(System::String* format, System::Object* arg0, System::Object* arg1);\r\n/*x*/\t//static void WriteLine(System::String* format, System::Object* arg0, System::Object* arg1, System::Object* arg2);\r\n/*x*/\t//static void WriteLine(System::String* format, System::Object* arg0, System::Object* arg1, System::Object* arg2, System::Object* arg3);\r\n\r\n};\r\n\r\n}\r\n\r\n#endif // _CS_Console_\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Exception.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_Object.h\"\r\n#include \"CS_String.h\"\r\n\r\n//\r\n// Stack of 100 try catch.\r\n//\r\njmp_buf\tSystem::_g_excStack[100];\r\nint\t\tSystem::_g_excDepth = 0;\r\n\r\nnamespace System {\r\n\r\nstatic const uniChar __NotSupportedYetStr_0[17]\t\t\t\t= { 'N','o','t',' ','s','u','p','o','r','t','e','d',' ','y','e','t','.' };\r\n\r\nstatic const uniChar __ExceptionStr_0[16]\t\t\t\t\t= { 'S','y','s','t','e','m','.','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __SystemExceptionStr_0[22]\t\t\t\t= { 'S','y','s','t','e','m','.','S','y','s','t','e','m','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __IndexOutOfRangeExceptionStr_0[31]\t= { 'S','y','s','t','e','m','.','I','n','d','e','x','O','u','t','O','f','R','a','n','g','e','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __NullReferenceExceptionStr_0[29]\t\t= { 'S','y','s','t','e','m','.','N','u','l','l','R','e','f','e','r','e','n','c','e','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __OutOfMemoryExceptionStr_0[27]\t\t= { 'S','y','s','t','e','m','.','O','u','t','O','f','M','e','m','o','r','y','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __ArgumentExceptionStr_0[24]\t\t\t= { 'S','y','s','t','e','m','.','A','r','g','u','m','e','n','t','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __ArgumentOutOfRangeExceptionStr_0[34]\t= { 'S','y','s','t','e','m','.','A','r','g','u','m','e','n','t','O','u','t','O','f','R','a','n','g','e','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __ArgumentNullExceptionStr_0[28]\t\t= { 'S','y','s','t','e','m','.','A','r','g','u','m','e','n','t','N','u','l','l','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __RankExceptionStr_0[20]\t\t\t\t= { 'S','y','s','t','e','m','.','R','a','n','k','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __InvalidOperationExceptionStr_0[32]\t= { 'S','y','s','t','e','m','.','I','n','v','a','l','i','d','O','p','e','r','a','t','i','o','n','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __ArrayTypeMismatchExceptionStr_0[33]\t= { 'S','y','s','t','e','m','.','A','r','r','a','y','T','y','p','e','M','i','s','m','a','t','c','h','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __ArithmeticExceptionStr_0[33]\t\t\t= { 'S','y','s','t','e','m','.','A','r','r','a','y','T','y','p','e','M','i','s','m','a','t','c','h','E','x','c','e','p','t','i','o','n' };\r\nstatic const uniChar __DivideByZeroExceptionStr_0[28]\t\t= { 'S','y','s','t','e','m','.','D','i','v','i','d','e','B','y','Z','e','r','o','E','x','c','e','p','t','i','o','n' };\r\n\r\n// ------------------------------------------------------\r\n// System::Exception\r\n// ------------------------------------------------------\r\n\r\nException::Exception() {\r\n\t__GCObject::_RefSetValue((__GCObject**)&m_message, System::String::Empty);\r\n}\r\n\r\nException::Exception(String* msg) {\r\n\t__GCObject::_RefSetValue((__GCObject**)&m_message, msg);\r\n}\r\n\r\n/*virtual*/ \r\nbool  Exception::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Exception, Object);\r\n}\r\n\r\n/*virtual*/\r\nu32\tException::_processGC() {\r\n\tif(m_message) { Memory::pushList(m_message, 0); }\r\n\treturn COMPLETE;\r\n}\r\n\r\n/*virtual*/\t\r\nvoid Exception::_releaseGC() {\r\n\tif(m_message) {\r\n\t\tm_message->_removeRef((__GCObject**)&m_message);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid Exception::_moveAlert(u32 offset) {\r\n\tObject::_moveAlert(offset);\r\n\tif(m_message) { m_message->_moveRef((__GCObject**)((u8*)&m_message - offset), (__GCObject**)&m_message); }\r\n}\r\n\r\n/*virtual*/\r\nString* Exception::ToString() {\r\n\treturn CS_NEW String(__ExceptionStr_0,16);\r\n}\r\n\r\nString* Exception::_acc_gMessage() {\r\n\treturn m_message;\r\n}\r\n\r\nString*\tException::_acc_gStackTrace() {\r\n\treturn CS_NEW String(__NotSupportedYetStr_0, 17);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::SystemException\r\n// ------------------------------------------------------\r\n\r\nSystemException::SystemException(String* msg)\r\n: Exception(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool  SystemException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(SystemException, Exception);\r\n}\r\n\r\n/*virtual*/\r\nString* SystemException::ToString() {\r\n\treturn CS_NEW String(__SystemExceptionStr_0,22);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::IndexOutOfRangeException\r\n// ------------------------------------------------------\r\n\r\nIndexOutOfRangeException::IndexOutOfRangeException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool IndexOutOfRangeException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(IndexOutOfRangeException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\nString* IndexOutOfRangeException::ToString() {\r\n\treturn CS_NEW String(__IndexOutOfRangeExceptionStr_0,31);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::NullReferenceException\r\n// ------------------------------------------------------\r\n\r\nNullReferenceException::NullReferenceException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool NullReferenceException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(NullReferenceException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\nString* NullReferenceException::ToString() {\r\n\treturn CS_NEW String(__NullReferenceExceptionStr_0,29);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::OutOfMemoryException\r\n// ------------------------------------------------------\r\n\r\nOutOfMemoryException::OutOfMemoryException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool OutOfMemoryException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(OutOfMemoryException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\nString* OutOfMemoryException::ToString() {\r\n\treturn CS_NEW String(__OutOfMemoryExceptionStr_0,27);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::ArgumentException\r\n// ------------------------------------------------------\r\n\r\nArgumentException::ArgumentException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool ArgumentException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(ArgumentException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\ninline \r\nString* ArgumentException::ToString() {\r\n\treturn CS_NEW String(__ArgumentExceptionStr_0,24);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::ArgumentOutOfRangeException\r\n// ------------------------------------------------------\r\n\r\nArgumentOutOfRangeException::ArgumentOutOfRangeException(String* msg)\r\n: ArgumentException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool ArgumentOutOfRangeException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(ArgumentOutOfRangeException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\nString* ArgumentOutOfRangeException::ToString() {\r\n\treturn CS_NEW String(__ArgumentOutOfRangeExceptionStr_0,34);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::ArgumentNullException\r\n// ------------------------------------------------------\r\n\r\nArgumentNullException::ArgumentNullException(String* msg)\r\n: ArgumentException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool ArgumentNullException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(ArgumentNullException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\nString* ArgumentNullException::ToString() {\r\n\treturn CS_NEW String(__ArgumentNullExceptionStr_0,28);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::RankException\r\n// ------------------------------------------------------\r\n\r\nRankException::RankException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/\r\nbool RankException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(RankException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\ninline \r\nString* RankException::ToString() {\r\n\treturn CS_NEW String(__RankExceptionStr_0,20);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::InvalidOperationException\r\n// ------------------------------------------------------\r\n\r\nInvalidOperationException::InvalidOperationException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool InvalidOperationException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(InvalidOperationException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\ninline \r\nString* InvalidOperationException::ToString() {\r\n\treturn CS_NEW String(__InvalidOperationExceptionStr_0,32);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::ArrayTypeMismatchException\r\n// ------------------------------------------------------\r\n\r\nArrayTypeMismatchException::ArrayTypeMismatchException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool ArrayTypeMismatchException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(ArrayTypeMismatchException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\ninline \r\nString* ArrayTypeMismatchException::ToString() {\r\n\treturn CS_NEW String(__ArrayTypeMismatchExceptionStr_0,33);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::ArithmeticException\r\n// ------------------------------------------------------\r\n\r\nArithmeticException::ArithmeticException(String* msg)\r\n: SystemException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool ArithmeticException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(ArithmeticException,SystemException);\r\n}\r\n\r\n/*virtual*/\r\nString* ArithmeticException::ToString() {\r\n\treturn CS_NEW String(__ArithmeticExceptionStr_0,33);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::DivideByZeroException\r\n// ------------------------------------------------------\r\n\r\nDivideByZeroException::DivideByZeroException(String* msg)\r\n: ArithmeticException(msg)\r\n{ \r\n\t// Do nothing\r\n}\r\n\r\n/*virtual*/ \r\nbool DivideByZeroException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(DivideByZeroException,ArithmeticException);\r\n}\r\n\r\n/*virtual*/\r\nString* DivideByZeroException::ToString() {\r\n\treturn CS_NEW String(__DivideByZeroExceptionStr_0,28);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::CppException\r\n// ------------------------------------------------------\r\n\r\n/*virtual*/ bool CppException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CppException,SystemException);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n// ------------------------------------------------------\r\n// System::CppNotComparable\r\n// ------------------------------------------------------\r\n\r\n/*virtual*/ bool CppNotComparable::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CppNotComparable,SystemException);\r\n}\r\n\r\n// ------------------------------------------------------\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Marshal.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Marshal_\r\n#define _CS_Marshal_\r\n\r\n#include \"../CompilerProject/BaseType.h\"\r\n\r\nnamespace System {\r\nnamespace Runtime {\r\nnamespace InteropServices {\r\n\r\n\tclass Marshal {\r\n\tpublic:\r\n\t\tstatic inline s32 ReadInt32(s32* ptr) { return *ptr; }\r\n\t};\r\n}\r\n}\r\n}\r\n\r\n#endif /* defined(_CS_Marshal_) */\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Math.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Math_h_\r\n#define _CS_Math_h_\r\n\r\n#include <cmath>\r\n#include \"CS_Object.h\"\r\n\r\nnamespace System {\r\n\r\nenum MidpointRounding {\r\n\tToEven\t\t\t= 0,\r\n\tAwayFromZero\t= 1,\r\n};\r\n\r\n/*static*/ class Math {\r\npublic:\r\n\tstatic\tconst double\tE;\r\n\tstatic\tconst double\tPI;\r\n\r\n\tinline static double\tAbs\t\t\t\t(double value)\t\t\t\t\t\t\t\t\t\t{ return fabs(value);\t}\r\n\tinline static float\t\tAbs\t\t\t\t(float  value)\t\t\t\t\t\t\t\t\t\t{ return fabs(value);\t}\r\n\tinline static s32\t\tAbs\t\t\t\t(s32\tvalue)\t\t\t\t\t\t\t\t\t\t{ return abs(value);\t}\r\n\tinline static s64\t\tAbs\t\t\t\t(s64\tvalue)\t\t\t\t\t\t\t\t\t\t{ return abs(value);\t}\r\n\tinline static s8\t\tAbs\t\t\t\t(s8\t\tvalue)\t\t\t\t\t\t\t\t\t\t{ return abs(value);\t}\r\n\tinline static s16\t\tAbs\t\t\t\t(s16\tvalue)\t\t\t\t\t\t\t\t\t\t{ return abs(value);\t}\r\n\tinline static double\tAcos\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return acos(d);\t\t}\r\n\tinline static double\tAsin\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return asin(d);\t\t}\r\n\tinline static double\tAtan\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return atan(d);\t\t}\r\n\tinline static double\tAtan2\t\t\t(double y, double x)\t\t\t\t\t\t\t\t{ return atan2(y, x);\t}\r\n\tinline static s64\t\tBigMul\t\t\t(s32 a, s32 b)\t\t\t\t\t\t\t\t\t\t{ s64 s = (s64)a; return s * (s64)b;\t}\r\n\tinline static double\tCeiling\t\t\t(double a)\t\t\t\t\t\t\t\t\t\t\t{ return ceil(a);\t\t}\r\n\tinline static double\tCos\t\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return cos(d);\t\t}\r\n\tinline static double\tCosh\t\t\t(double value)\t\t\t\t\t\t\t\t\t\t{ return cosh(value);\t}\r\n\tinline static s32\t\tDivRem\t\t\t(s32 a, s32 b, /*out*/ s32* result)\t\t\t\t\t{ if(!b) { THROW(CS_NEW System::DivideByZeroException()); } *result = a%b; return a/b; }\r\n\tinline static s64\t\tDivRem\t\t\t(s64 a, s64 b, /*out*/ s64* result)\t\t\t\t\t{ if(!b) { THROW(CS_NEW System::DivideByZeroException()); } *result = a%b; return a/b; }\r\n\tinline static double\tExp\t\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return exp(d);\t\t}\r\n\tinline static double\tFloor\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return floor(d);\t\t}\r\n\tinline static double\tIEEERemainder\t(double x, double y)\t\t\t\t\t\t\t\t{ return x - (y * Round(x / y)); }\r\n\tinline static double\tLog\t\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return log(d);\t\t}\r\n\tinline static double\tLog\t\t\t\t(double a, double newBase)\t\t\t\t\t\t\t{ return log(a)/log(newBase);\t}\r\n\tinline static double\tLog10\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return log10(d);\t\t}\r\n\tinline static u8\t\tMax\t\t\t\t(u8 val1, u8 val2)\t\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static double\tMax\t\t\t\t(double val1, double val2)\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static float\t\tMax\t\t\t\t(float val1,  float val2)\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static s32\t\tMax\t\t\t\t(s32 val1,\ts32 val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static s64\t\tMax\t\t\t\t(s64 val1,\ts64 val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static s8\t\tMax\t\t\t\t(s8 val1,\ts8  val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static s16\t\tMax\t\t\t\t(s16 val1,\ts16 val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static u32\t\tMax\t\t\t\t(u32 val1,\tu32 val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static u64\t\tMax\t\t\t\t(u64 val1,\tu64 val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static u16\t\tMax\t\t\t\t(u16 val1,\tu16 val2)\t\t\t\t\t\t\t\t{ return (((val1) > (val2)) ? (val1) : (val2));\t}\r\n\tinline static u8\t\tMin\t\t\t\t(u8 val1,\tu8  val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static double\tMin\t\t\t\t(double val1, double val2)\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static float\t\tMin\t\t\t\t(float\tval1, float  val2)\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static s32\t\tMin\t\t\t\t(s32 val1,\ts32 val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static s64\t\tMin\t\t\t\t(s64 val1,\ts64 val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static s8\t\tMin\t\t\t\t(s8 val1,\ts8  val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static s16\t\tMin\t\t\t\t(s16 val1,\ts16 val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static u32\t\tMin\t\t\t\t(u32 val1,\tu32 val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static u64\t\tMin\t\t\t\t(u64 val1,\tu64 val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static u16\t\tMin\t\t\t\t(u16 val1,\tu16 val2)\t\t\t\t\t\t\t\t{ return (((val1) < (val2)) ? (val1) : (val2));\t}\r\n\tinline static double\tPow\t\t\t\t(double x, double y)\t\t\t\t\t\t\t\t{ return pow(x, y);\t\t\t\t\t\t\t\t}\r\n\tinline static double\tRound\t\t\t(double a)\t\t\t\t\t\t\t\t\t\t\t{ return Round(a, MidpointRounding::ToEven);\t}\r\n\tinline static double\tRound\t\t\t(double value, s32 digits)\t\t\t\t\t\t\t{ return Round(value, digits, MidpointRounding::ToEven); } \r\n\tinline static double\tRound\t\t\t(double value, MidpointRounding mode)\t\t\t\t{\r\n\t\tdouble fvalue = floor(value);\r\n\t\tdouble cvalue = ceil(value);\r\n\t\tif(value > 0) {\r\n\t\t\tif(value - fvalue == 0.5) { return (mode == ToEven) ? ((floor((fvalue/2.0)*2) == fvalue) ? fvalue : cvalue) : cvalue; }\r\n\t\t\telse { return floor(value + 0.5); }\r\n\t\t} else {\r\n\t\t\tif(value - fvalue == 0.5) { return (mode == ToEven) ? ((floor((cvalue/2.0)*2) == cvalue) ? cvalue : fvalue) : fvalue; }\r\n\t\t\telse { return ceil(value - 0.5); }\r\n\t\t}\r\n\t}\r\n\tinline static double\tRound\t\t\t(double value, s32 digits, MidpointRounding mode)\t{\r\n\t\tif((u32)digits > 15) { THROW(CS_NEW System::ArgumentOutOfRangeException()); }\r\n\t\tdouble p = pow(10.0, digits); return Round(value * p, mode) / p;\r\n\t}\r\n\tinline static s32\t\tSign\t\t\t(double value)\t\t\t\t\t\t\t\t\t\t{ return ((value == 0) ? 0 : ((value > 0) ? 1 : -1));\t}\r\n\tinline static s32\t\tSign\t\t\t(float\tvalue)\t\t\t\t\t\t\t\t\t\t{ return ((value == 0) ? 0 : ((value > 0) ? 1 : -1));\t}\r\n\tinline static s32\t\tSign\t\t\t(s32 value)\t\t\t\t\t\t\t\t\t\t\t{ return ((value == 0) ? 0 : ((value > 0) ? 1 : -1));\t}\r\n\tinline static s32\t\tSign\t\t\t(s64 value)\t\t\t\t\t\t\t\t\t\t\t{ return ((value == 0) ? 0 : ((value > 0) ? 1 : -1));\t}\r\n\tinline static s32\t\tSign\t\t\t(s8 value)\t\t\t\t\t\t\t\t\t\t\t{ return ((value == 0) ? 0 : ((value > 0) ? 1 : -1));\t}\r\n\tinline static s32\t\tSign\t\t\t(s16 value)\t\t\t\t\t\t\t\t\t\t\t{ return ((value == 0) ? 0 : ((value > 0) ? 1 : -1));\t}\r\n\tinline static double\tSin\t\t\t\t(double a)\t\t\t\t\t\t\t\t\t\t\t{ return sin(a);\t\t\t\t\t\t\t\t\t\t}\r\n\tinline static double\tSinh\t\t\t(double value)\t\t\t\t\t\t\t\t\t\t{ return sinh(value);\t\t\t\t\t\t\t\t\t}\r\n\tinline static double\tSqrt\t\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return sqrt(d);\t\t\t\t\t\t\t\t\t\t}\r\n\tinline static double\tTan\t\t\t\t(double a)\t\t\t\t\t\t\t\t\t\t\t{ return tan(a);\t\t\t\t\t\t\t\t\t\t}\r\n\tinline static double\tTanh\t\t\t(double value)\t\t\t\t\t\t\t\t\t\t{ return tanh(value);\t\t\t\t\t\t\t\t\t}\r\n\tinline static double\tTruncate\t\t(double d)\t\t\t\t\t\t\t\t\t\t\t{ return (d > 0.0) ? floor(d) : ceil(d);\t\t\t\t}\r\n\r\n};\r\n\r\n/*static*/ const double\tMath::E\t\t= 2.71828;\r\n/*static*/ const double\tMath::PI\t= 3.14159;\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Memory.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_Memory.h\"\r\n#include \"CS_Object.h\"\r\n\r\nSystem::RefHolder\tg_globTempRefStack[256];\r\nSystem::RefHolder*\tg_globStack = g_globTempRefStack;\r\n\r\nu32 _refCallFinish_(System::RefHolder* array_) {\r\n\tu32 res = g_globStack - g_globTempRefStack;\r\n\tmemcpy(array_, g_globTempRefStack, res * sizeof(System::RefHolder));\r\n\tg_globStack = g_globTempRefStack;\r\n\treturn res;\r\n}\r\n\r\nvoid _refRemove_(u32 count, System::RefHolder* array_) {\r\n\tfor (u32 n = 0; n < count; n++) {\r\n\t\tSystem::__GCObject** holder = array_[n].pHolder;\r\n\t\tSystem::__GCObject* newRef = *holder;\r\n\t\tSystem::__GCObject* oldRef = array_[n].holderValue;\r\n\t\tif (newRef != oldRef) {\r\n\t\t\tif (oldRef) \t{ oldRef->_removeRef(holder); \t}\r\n\t\t\tif (newRef)\t\t{ newRef->_addRef(holder); \t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//\r\n// Memory system itself\r\n//\r\nnamespace System {\r\n\r\n//\r\n// TODO : have option to perform compaction on gen0 or gen1\r\n// TODO : have option to move from gen0 to gen1\r\n//\t-> Mark the object after a first pass (move on 2nd pass) ?\r\n//  Moving in gen1 while doing a progressive parsing is meaningless.\r\n//\t-> We must parse the whole heap of gen0 before moving them.\r\n//  -> Thus use a marking and have the next parsing do the move.\r\n//\r\n\r\n/*static*/ __GCObject*\t\tMemory::g_destroyList\t\t\t= NULL;\r\n/*static*/ u8*\t\t\t\tMemory::s_bufferStart\t\t\t= NULL;\r\n/*static*/ u8* \t\t\t\tMemory::s_bufferEnd\t\t\t\t= NULL;\r\n/*static*/ u8* \t\t\t\tMemory::s_bufferStartGen1\t\t= NULL;\r\n/*static*/ u8* \t\t\t\tMemory::s_bufferAllocGen0\t\t= NULL;\t\t// Pointer to start of next freely available block\r\n/*static*/ SAllocHeader*\tMemory::s_bufferAllocGen0Prev\t= NULL;\t\t// Pointer to start of latest allocated block\r\n/*static*/ SAllocHeader*\tMemory::s_bufferAllocGen1Prev\t= NULL;\t\t// Pointer to start of latest allocated block in Gen1\r\n/*static*/ u8* \t\t\t\tMemory::s_bufferAllocGen1\t\t= NULL;\t\t// Downward\r\n/*static*/ SAllocHeader*\tMemory::s_lastCompaction\t\t= NULL;\r\n/*static*/ u32\t\t\t\tMemory::s_initMagic\t\t\t\t= 0;\r\n/*static*/ __GCObject***\tMemory::g_rootList\t\t\t\t= NULL;\r\n/*static*/ u32\t\t\t\tMemory::g_rootCount\t\t\t\t= 0;\r\n/*static*/ u32\t\t\t\tMemory::ROOTCOUNT\t\t\t\t= 0;\r\n/*static*/ _CS_ArrayAllocator<RefList>*\t\t\tMemory::g_allocPage\t\t= NULL;\r\n/*static*/ _CS_ArrayAllocator<SAllocMSEntry>*\tMemory::g_allocMSEntry\t= NULL;\r\n\r\nvoid Memory::removeObject(__GCObject* obj) {\r\n\tMemory::injectToDieList(obj);\r\n\r\n\t// This may trigger a cascade of reference update here =>\r\n\t// This will increase the probability to reclaim memory in this pass\r\n\t// And make sure that all the memory is reclaimed in the 2nd pass after this one.\r\n\twhile (obj && !obj->isDestroyed()) {\r\n\t\tobj->_releaseGC();\r\n\t\tobj->destroy();\r\n\t\tobj = (__GCObject*)obj->m_ownerA; // If not null, cascade occured.\r\n\t}\r\n\r\n\t// Empty List.\r\n\tg_destroyList = NULL;\r\n}\r\n\r\nvoid Memory::compactionInternal(CompactionContext& ctx) {\r\n\tSAllocHeader* pN = ctx.p->m_next;\r\n\t__GCObject* obj = (__GCObject*)&ctx.p[1];\r\n\tif (ctx.p->getFreed()) {\r\n\t\t#ifdef _DEBUG_MEMORY_\r\n\t\t\tprintf(\"[REMOVED]\\t0x%08x\\t \\t \\t%x\\n\", ctx.p, ctx.p->getSize());\r\n\t\t#endif\r\n\t\t\r\n\t\tremoveObject(obj);\r\n\r\n\t\t// Memory is reclaimed.\r\n\t\tif(!ctx.firstFreeGen0 && !ctx.firstFreeGen1) {\r\n\t\t\tif(ctx.genParsing == 0) {\r\n\t\t\t\t// Generation 0 - next moving object must move to Gen1\r\n\t\t\t\tctx.firstFreeGen0 = ctx.p;\r\n\t\t\t\tctx.firstFreeGen1 = (SAllocHeader*)System::Memory::s_bufferAllocGen1;\r\n\t\t\t} else {\r\n\t\t\t\t// Generation 1 - next moving object stays in Gen1\r\n\t\t\t\tctx.firstFreeGen1\t= ctx.p;\r\n\t\t\t}\r\n\t\t}\r\n\t\tctx.removed++;\r\n\t} else {\r\n\t\tif(!ctx.firstFreeGen1 && ctx.genParsing == 0 && ctx.p->getSurvived()) {\r\n\t\t\t// The object has already survived a compaction, it must move to Gen1 in any case.\r\n\t\t\tctx.firstFreeGen1 = (SAllocHeader*)System::Memory::s_bufferAllocGen1;\r\n\t\t}\r\n\r\n\t\tif(ctx.firstFreeGen1) {\r\n\t\t\t#ifdef _DEBUG_MEMORY_\r\n\t\t\t\tprintf(\"[MOVED]\\t\\t0x%08x ->\\t 0x%08x \\t%x\\n\", ctx.p, ctx.firstFreeGen1, ctx.p->getSize());\r\n\t\t\t#endif\r\n\t\t\tu32 size = ctx.p->getSize() + sizeof(SAllocHeader);\r\n\t\t\t\r\n\t\t\t// firstFreeGen1 patch if this is not the first entry\r\n\t\t\tif((u8*)ctx.firstFreeGen1 == s_bufferEnd) {\r\n\t\t\t\ts_bufferStartGen1 = ((u8*)ctx.firstFreeGen1 - size);\r\n\t\t\t}\r\n\t\t\tif(ctx.genParsing == 0 && !ctx.lastValidGen1) {\r\n\t\t\t\tctx.lastValidGen1 = (SAllocHeader*)System::Memory::s_bufferAllocGen1Prev;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tctx.firstFreeGen1 = (SAllocHeader*)((u8*)ctx.firstFreeGen1 - size);\r\n\t\t\t\r\n\t\t\t__GCObject* prev = (__GCObject*)&ctx.p[1];\r\n\t\t\tmemcpy(ctx.firstFreeGen1, ctx.p, size);\r\n\t\t\tobj = (__GCObject*)&ctx.firstFreeGen1[1];\r\n\t\t\tobj->_moveUpdate(prev);\r\n\t\t\tctx.p = ctx.firstFreeGen1;\r\n\t\t\tctx.firstFreeGen1 = (SAllocHeader*)((u8*)ctx.p - size);\r\n\t\t\tctx.moved\t+= size;\r\n\t\t} else {\r\n\t\t\tif(ctx.genParsing == 0) {\r\n\t\t\t\t// if the object is still in Gen0 it is marked as SURVIVED to be move during the next compaction\r\n\t\t\t\tctx.p->setSurvived();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(ctx.lastValidGen0 && !ctx.firstFreeGen1) {\r\n\t\t\tctx.lastValidGen0->m_next\t= ctx.p;\r\n\t\t} else if(ctx.lastValidGen1) {\r\n\t\t\tctx.lastValidGen1->m_next\t= ctx.p;\r\n\t\t}\r\n\r\n\t\tif(ctx.genParsing == 0 && !ctx.firstFreeGen1) {\r\n\t\t\tctx.p->m_prev\t= ctx.lastValidGen0;\r\n\t\t} else {\r\n\t\t\tctx.p->m_prev\t= ctx.lastValidGen1;\r\n\t\t}\r\n\r\n\t\tif(ctx.genParsing == 0 && !ctx.firstFreeGen1) {\r\n\t\t\tctx.lastValidGen0 = ctx.p;\r\n\t\t\tctx.lastValidGen1 = (SAllocHeader*)System::Memory::s_bufferAllocGen1Prev; // Not to remove s_bufferAllocGen1Prev after this method call.\r\n\t\t} else {\r\n\t\t\tctx.lastValidGen1 = ctx.p;\r\n\t\t}\r\n\t}\r\n\r\n\tctx.p = pN;\r\n}\r\n\r\n/*static*/\r\nvoid Memory::injectToDieList(__GCObject* obj) {\r\n\r\n\t// Add to a link list of destroyed item.\r\n\tobj->m_ownerA = (__GCObject**)g_destroyList;\r\n\t// obj->m_ownerB = NULL; // Is already null !\r\n\tif (g_destroyList) {\r\n\t\tg_destroyList->m_ownerB = (__GCObject**)obj;\r\n\t}\r\n\tg_destroyList = obj;\r\n\r\n\t// Mark as destroyed.\r\n\tSAllocHeader* pN = (SAllocHeader*)obj;\r\n\tpN[-1].setFreed();\r\n}\r\n\r\n/*static*/\r\nvoid Memory::rejectFromDieList(__GCObject* obj) {\r\n\t//\r\n\t// Remove from double link list.\r\n\t//\r\n\tif (obj->m_ownerA) {\r\n\t\t((__GCObject*)(obj->m_ownerA))->m_ownerB = obj->m_ownerB;\r\n\t}\r\n\r\n\tif (obj->m_ownerB) {\r\n\t\t((__GCObject*)(obj->m_ownerB))->m_ownerA = obj->m_ownerA;\r\n\t} else {\r\n\t\tg_destroyList = (__GCObject*)obj->m_ownerA;\r\n\t}\r\n\r\n\t// Mark as destroyed.\r\n\tSAllocHeader* pN = (SAllocHeader*)obj;\r\n\tpN[-1].unsetFreed();\r\n\t// m_ownerA is going to be filled.\r\n\tobj->m_ownerB = NULL;\r\n}\r\n\r\n/*static*/\r\nvoid Memory::compactionSmall(u32 infos) {\r\n\tif(!(infos & (COMPACT_GEN0 | COMPACT_GEN1))) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tCompactionContext ctx;\r\n\t// If no item were allocated at all, no item to compact.\r\n\t// If last item exist, then first item exist at start adress. (compaction will garantee first entry at base adress)\r\n\tif(infos & COMPACT_GEN1) {\r\n\t\tctx.p = s_bufferAllocGen1Prev ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\t} else {\r\n\t\tctx.p = s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t}\r\n\tctx.lastValidGen0\t= NULL;\r\n\tctx.lastValidGen1\t= NULL;\r\n\tctx.firstFreeGen0\t= NULL;\r\n\tctx.firstFreeGen1\t= NULL;\r\n\tctx.moved\t\t= 0;\r\n\tctx.removed\t\t= 0;\r\n\tctx.genParsing\t= (infos & COMPACT_GEN1) ? 1 : 0;\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tCompactionContext dctx;\r\n\t\tdctx.genParsing\t= (infos & COMPACT_GEN1) ? 1 : 0;\r\n\t\tif(dctx.genParsing == 0) {\r\n\t\t\tdctx.p = s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t\t} else {\r\n\t\t\tdctx.p = s_bufferAllocGen1Prev ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\t\t}\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n\r\n\twhile (ctx.p) {\r\n\t\tcompactionInternal(ctx);\r\n\t}\r\n\tif(ctx.lastValidGen0) { ctx.lastValidGen0->m_next = NULL; }\r\n\tif(ctx.lastValidGen1) { ctx.lastValidGen1->m_next = NULL; }\r\n\r\n\t//\r\n\t// When compaction reach the end, we can modifiy :\r\n\t//\r\n\t// Take last allocated item and point to the next free block.\r\n\t// Then update last allocated item pointer.\r\n\ts_bufferAllocGen0 = (ctx.firstFreeGen0) ? (u8*)ctx.firstFreeGen0 : s_bufferStart;\r\n\ts_bufferAllocGen0Prev = ctx.lastValidGen0;\r\n\r\n\tif((ctx.genParsing == 0 && ctx.moved > 0) || (ctx.genParsing == 1 && (ctx.moved > 0 || ctx.removed > 0))) {\r\n\t\ts_bufferAllocGen1 = (ctx.firstFreeGen1) ? (u8*)ctx.firstFreeGen1 : s_bufferEnd;\r\n\t\ts_bufferAllocGen1Prev = ctx.lastValidGen1;\r\n\t}\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tdctx.p = s_bufferAllocGen1Prev ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\t\tdctx.genParsing = 1;\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tdctx.p = s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t\tdctx.genParsing = 0;\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n\r\n\tif((infos & COMPACT_GEN1) && (infos & COMPACT_GEN0)) {\r\n\t\tcompactionSmall((infos & ~COMPACT_GEN1));\r\n\t}\r\n}\r\n\r\nSAllocMSEntry*\tgEntryEnd;\r\nSAllocMSEntry*\tgEntryStart;\r\nu32\t\t\t\tgEntryCount;\r\nu32\t\t\t\tgEntryTotal;\r\n\r\nbool Memory::pushList(__GCObject* obj, u32 startIndex) {\r\n\t// Push at end of list.\r\n\tSAllocMSEntry* pEntry = Memory::g_allocMSEntry->allocEntry();\r\n\tif (pEntry) {\r\n\t\tpEntry->prev\t\t= gEntryEnd;\r\n\t\tif(gEntryEnd && gEntryEnd != pEntry) {\r\n\t\t\tgEntryEnd->next = pEntry;\r\n\t\t}\r\n\t\tpEntry->next\t\t= NULL;\r\n\t\tpEntry->object\t\t= obj;\r\n\t\tpEntry->startIndex\t= startIndex;\r\n\t\tgEntryEnd\t\t\t= pEntry;\r\n\t\tif (!gEntryStart) {\r\n\t\t\tgEntryStart = gEntryEnd;\r\n\t\t}\r\n\t\tgEntryCount++;\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nu32 gLastIndex;\r\n\r\n__GCObject* Memory::removeNext() {\r\n\t// Pop at beginning of the list\r\n\tif (gEntryStart) {\r\n\t\tSAllocMSEntry*\tpRes = gEntryStart;\r\n\t\t__GCObject*\t\tpObj = pRes->object;\r\n\t\tMemory::g_allocMSEntry->freeEntry(gEntryStart);\r\n\t\tgLastIndex\t\t= pRes->startIndex;\r\n\t\tgEntryStart\t\t= pRes->next;\r\n\t\tgEntryCount--;\r\n\t\treturn pObj;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n// TODO : inline to optimize.\r\nbool Memory::emptyList() {\r\n\treturn (gEntryCount == 0);\r\n}\r\n\r\n// TODO : inline to optimize.\r\nu32 Memory::getProcessSizeMax() {\r\n\t// use gEntryCount, nb items\r\n\tu32 remain = gEntryTotal - gEntryCount;\r\n\tif (remain < 32) {\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t// Always leave a margin of 32.\r\n\treturn remain - 32;\r\n}\r\n\r\nu32 Memory::getLastProcessIndex() {\r\n\treturn gLastIndex;\r\n}\r\n\r\nvoid Memory::setLastProcessIndex(u32 index) {\r\n\tgLastIndex = index;\r\n}\r\n\r\n/*static*/\r\nvoid Memory::compactionMS(u32 infos) {\r\n\t//\r\n\t// Phase 1 : Unmark Everything, Buffer will need to be __GCObject to avoid problems.\r\n\t//\r\n\r\n\tCompactionContext ctx;\r\n\tctx.p = s_bufferAllocGen1Prev ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tCompactionContext dctx;\r\n\t\tdctx.p = ctx.p;\r\n\t\tdctx.genParsing = 1;\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n\r\n\twhile (ctx.p) {\r\n\t\tSAllocHeader* pN = ctx.p->m_next;\r\n\t\tctx.p->unsetMark();\r\n\t\tctx.p = pN;\r\n\t}\r\n\r\n\tctx.p = s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tdctx.p = ctx.p;\r\n\t\tdctx.genParsing = 0;\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n\r\n\twhile (ctx.p) {\r\n\t\tSAllocHeader* pN = ctx.p->m_next;\r\n\t\tctx.p->unsetMark();\r\n\t\tctx.p = pN;\r\n\t}\r\n\r\n\t//\r\n\t// Phase 2 : Mark only alive.\r\n\t//\r\n\r\n\t// List reset\r\n\tgEntryEnd\t= NULL;\r\n\tgEntryStart\t= NULL;\r\n\tgEntryCount\t= 0;\r\n\r\n\tfor(u32 n = 0; n < g_rootCount; n++) {\r\n\t\t__GCObject** ptrOwner = g_rootList[n];\r\n\t\tif(*ptrOwner) {\r\n\t\t\tif(pushList(*ptrOwner,0)) {\r\n\t\t\t\twhile(!emptyList()) {\r\n\t\t\t\t\t__GCObject* pObj = removeNext();\r\n\t\t\t\t\tu32 size = getProcessSizeMax();\r\n\t\t\t\t\tif(pObj && !pObj->isMarked() && (size != 0)) {\r\n\t\t\t\t\t\tif(pObj->_processGC() == __GCObject::INCOMPLETE) {\r\n\t\t\t\t\t\t\t// Push back at the end.\r\n\t\t\t\t\t\t\t// Call modify Size and return the next point to process during the call.\r\n\t\t\t\t\t\t\tpushList(pObj, getLastProcessIndex());\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t#ifdef _DEBUG_MEMORY_\r\n\t\t\t\t\t\t\t\t//SAllocHeader* pN = (SAllocHeader*)pObj;\r\n\t\t\t\t\t\t\t\t//printf(\"[MARKED]\\t0x%08x\\t%s %s %s\\t\\t%x\\n\", &pN[-1], pN[-1].getFreed() ? \"F\":\" \", pN[-1].getDestroyed() ? \"D\":\" \", pN[-1].getDestroyed() ? \"S\":\" \", pN[-1].getSize());\r\n\t\t\t\t\t\t\t#endif\r\n\t\t\t\t\t\t\tpObj->mark();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tprintf(\"\\n\");\r\n\t#endif\r\n\r\n\t//\r\n\t// Phase 3 : Delete Unmarked object.\r\n\t//\r\n\tif(!(infos & COMPACT_NOW)) {\r\n\t\t// Mark as Freed Gen 1\r\n\t\tctx.p = (s_bufferAllocGen1 != s_bufferEnd) ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\t\twhile(ctx.p) {\r\n\t\t\tSAllocHeader* pN = ctx.p->m_next;\r\n\t\t\tif(!ctx.p->getMark()) {\r\n\t\t\t\tMemory::injectToDieList((__GCObject*)&ctx.p[1]);\r\n\t\t\t}\r\n\t\t\tctx.p = pN;\r\n\t\t}\r\n\r\n\t\t// Mark as Freed Gen 0\r\n\t\tctx.p = s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t\twhile(ctx.p) {\r\n\t\t\tSAllocHeader* pN = ctx.p->m_next;\r\n\t\t\tif(!ctx.p->getMark()) {\r\n\t\t\t\tMemory::injectToDieList((__GCObject*)&ctx.p[1]);\r\n\t\t\t}\r\n\t\t\tctx.p = pN;\r\n\t\t}\r\n\t} else {\r\n\t\t// GEN 1\r\n\t\tctx.p\t\t\t\t= (s_bufferAllocGen1 != s_bufferEnd) ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\t\tctx.firstFreeGen0\t= NULL;\r\n\t\tctx.firstFreeGen1\t= NULL;\r\n\t\tctx.lastValidGen0\t= NULL;\r\n\t\tctx.lastValidGen1\t= NULL;\r\n\t\tctx.moved\t\t\t= 0;\r\n\t\tctx.removed\t\t\t= 0;\r\n\t\tctx.genParsing\t\t= 1;\r\n\t\twhile(ctx.p) {\r\n\t\t\tif(!ctx.p->getMark()) {\r\n\t\t\t\tMemory::injectToDieList((__GCObject*)&ctx.p[1]);\r\n\t\t\t}\r\n\t\t\tcompactionInternal(ctx);\r\n\t\t}\r\n\t\tif(ctx.lastValidGen1) { ctx.lastValidGen1->m_next = NULL; }\r\n\r\n\t\t//\r\n\t\t// When compaction reach the end, we can modifiy :\r\n\t\t//\r\n\t\t// Take last allocated item and point to the next free block.\r\n\t\tif(ctx.moved > 0 || ctx.removed > 0) {\r\n\t\t\ts_bufferAllocGen1\t\t= (ctx.firstFreeGen1) ? (u8*)ctx.firstFreeGen1 : s_bufferEnd;\r\n\t\t\ts_bufferAllocGen1Prev\t= ctx.lastValidGen1;\r\n\t\t}\r\n\r\n\t\t// GEN 0\r\n\t\tctx.p\t\t\t\t= s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t\tctx.firstFreeGen0\t= NULL;\r\n\t\tctx.firstFreeGen1\t= NULL;\r\n\t\tctx.lastValidGen0\t= NULL;\r\n\t\tctx.lastValidGen1\t= NULL;\r\n\t\tctx.moved\t\t\t= 0;\r\n\t\tctx.removed\t\t\t= 0;\r\n\t\tctx.genParsing\t\t= 0;\r\n\t\twhile(ctx.p) {\r\n\t\t\tif(!ctx.p->getMark()) {\r\n\t\t\t\tMemory::injectToDieList((__GCObject*)&ctx.p[1]);\r\n\t\t\t}\r\n\t\t\tcompactionInternal(ctx);\r\n\t\t}\r\n\t\tif(ctx.lastValidGen0) { ctx.lastValidGen0->m_next = NULL; }\r\n\t\tif(ctx.lastValidGen1) { ctx.lastValidGen1->m_next = NULL; }\r\n\r\n\t\t//\r\n\t\t// When compaction reach the end, we can modifiy :\r\n\t\t//\r\n\t\t// Take last allocated item and point to the next free block.\r\n\t\t// Then update last allocated item pointer.\r\n\t\ts_bufferAllocGen0\t\t= (ctx.firstFreeGen0) ? (u8*)ctx.firstFreeGen0 : s_bufferStart;\r\n\t\ts_bufferAllocGen0Prev\t= ctx.lastValidGen0;\r\n\t\tif(ctx.moved > 0) {\r\n\t\t\ts_bufferAllocGen1\t\t= (ctx.firstFreeGen1) ? (u8*)ctx.firstFreeGen1 : s_bufferEnd;\r\n\t\t\ts_bufferAllocGen1Prev\t= ctx.lastValidGen1;\r\n\t\t}\r\n\t}\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tdctx.p = s_bufferAllocGen1Prev ? (SAllocHeader*)s_bufferStartGen1 : NULL;\r\n\t\tdctx.genParsing = 1;\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tdctx.p = s_bufferAllocGen0Prev ? (SAllocHeader*)s_bufferStart : NULL;\r\n\t\tdctx.genParsing = 0;\r\n\t\t_debug_displayMemory(dctx);\r\n\t#endif\r\n}\r\n\r\n/*static*/\r\nvoid* Memory::allocate(u32 size) {\r\n\tsize = (size + 3) & 0xFFFFFFFC;\r\n\tu32 asize = size + sizeof(SAllocHeader);\r\n\t\r\n\tu8* newPostAdress = &s_bufferAllocGen0[asize];\r\n\r\n\t/* WARNING : CAN NOT PERFORM COMPACTION HERE IN CURRENT IMPLEMENTATION :\r\n\t   LOCAL VARIABLE ARE NOT PROCESSED :\r\n\t   Variable-only link will lead to a destruction of a valid object !\r\n\r\n\tif (newPostAdress >= s_bufferAllocGen1) {\r\n\t\tcompactionSmall();\r\n\t}*/\r\n\r\n\tif (newPostAdress < s_bufferAllocGen1) {\r\n\t\t// Get Base Adress.\r\n\t\tSAllocHeader* pAlloc = (SAllocHeader*)s_bufferAllocGen0;\r\n\r\n\t\t// Update related structure.\r\n\t\tpAlloc->m_info\t= size;\r\n\t\tpAlloc->m_prev\t= s_bufferAllocGen0Prev;\r\n\t\tpAlloc->m_next\t= NULL;\r\n\t\tif(s_bufferAllocGen0Prev) {\r\n\t\t\ts_bufferAllocGen0Prev->m_next = pAlloc;\r\n\t\t}\r\n\t\t\r\n\t\t// Increment allocator\r\n\t\ts_bufferAllocGen0Prev\t= pAlloc; \r\n\t\ts_bufferAllocGen0\t\t= newPostAdress;\r\n\r\n\t\t// Clean allocated memory.\r\n\t\t__GCObject* obj = (__GCObject*)&pAlloc[1];\r\n\t\tmemset(obj, 0, size);\r\n\r\n\t\t// Put in the die list right away : nobody points to it.\r\n\t\tinjectToDieList(obj);\r\n\r\n\t\t// Return object base adress.\r\n\t\treturn obj;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\n/*static*/\r\nvoid Memory::release() {\r\n\tif (s_bufferStart) {\r\n\t\tCS_FREE(s_bufferStart);\r\n\t\ts_bufferStart = NULL;\r\n\t}\r\n\r\n\tif (g_rootList) {\r\n\t\tCS_FREE(g_rootList);\r\n\t\tg_rootList = NULL;\r\n\t}\r\n\r\n\tif (g_allocPage) {\r\n\t\tdelete g_allocPage;\r\n\t\tg_allocPage = NULL;\r\n\t}\r\n\r\n\tif (g_allocMSEntry) {\r\n\t\tdelete g_allocMSEntry;\r\n\t\tg_allocMSEntry = NULL;\r\n\t}\r\n}\r\n\r\n/*static*/\r\nbool Memory::setGlobalMemory(u32 size, u32 rootCount, u16 MultipleRefPageCount, u16 MarkAndSweepStackSize) {\r\n\ts_bufferStart\t= (u8*)CS_MALLOC(size);\r\n\tg_rootList\t\t= (__GCObject***)CS_MALLOC(rootCount * sizeof(__GCObject**));\r\n\tg_allocPage\t\t= new _CS_ArrayAllocator<System::RefList>();\r\n\tg_allocMSEntry\t= new _CS_ArrayAllocator<System::SAllocMSEntry>();\r\n\t\r\n\tif (s_bufferStart && g_rootList && g_allocPage && g_allocMSEntry) {\r\n\t\tif ((g_allocPage->init(MultipleRefPageCount)) && (g_allocMSEntry->init(MarkAndSweepStackSize))) {\r\n\t\t\ts_initMagic\t\t\t= MAGICNUMBER;\t// Magic number checking for allocation.\r\n\t\t\ts_bufferEnd\t\t\t= s_bufferStart + size;\r\n\t\t\ts_bufferStartGen1\t= NULL;\r\n\t\t\ts_bufferAllocGen0\t= s_bufferStart;\r\n\t\t\ts_bufferAllocGen1\t= s_bufferEnd;\r\n\t\t\tg_rootCount\t\t\t= 0;\r\n\t\t\tgEntryTotal\t\t\t= MarkAndSweepStackSize;\r\n\t\t\tROOTCOUNT\t\t\t= rootCount;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\trelease();\r\n\treturn false;\r\n}\r\n\r\nvoid Memory::registerGCRoot(void* ptr) {\r\n\t__GCObject** ptrOwner = (__GCObject**)ptr;\r\n\tCS_Assert(g_rootCount != ROOTCOUNT, \"Please change root count, maximum reached.\");\r\n\tg_rootList[g_rootCount++] = ptrOwner;\r\n\tif (*ptrOwner) {\r\n\t\t(*ptrOwner)->_addRef(ptrOwner);\r\n\t}\r\n}\r\n\r\n//\r\n// Object Allocation\r\n//\r\n\r\nvoid* __GCObject::operator new(size_t size)\r\n{\t\r\n\tCS_Assert(Memory::s_initMagic == MAGICNUMBER, \"Memory::setGlobalMemory not set yet !\");\r\n\t__GCObject* obj = (__GCObject*)Memory::allocate(size);\r\n\tif (!obj) {\r\n\t\tTHROW(CS_NEW OutOfMemoryException());\r\n\t}\r\n\t\r\n\treturn obj;\r\n}\r\n\r\nvoid* __GCObject::operator new(size_t size, size_t sizeBuffer)\r\n{\t\r\n\tCS_Assert(Memory::s_initMagic == MAGICNUMBER, \"Memory::setGlobalMemory not set yet !\");\r\n\t__GCObject* obj = (__GCObject*)Memory::allocate(sizeBuffer);\r\n\tif (!obj) {\r\n\t\tTHROW(CS_NEW OutOfMemoryException());\r\n\t}\r\n\t\r\n\treturn obj;\r\n}\r\n\r\n/*static*/\r\nvoid* __GCMalloc::allocBlock(u32 byteCount, __GCMalloc*& wrapper) {\r\n\t__GCMalloc* obj = new(byteCount + sizeof(__GCMalloc)) __GCMalloc();\r\n\t\r\n\twrapper = obj;\r\n\treturn &((u8*)obj)[sizeof(__GCMalloc)];\r\n}\r\n\r\n//\r\n// Wrapper to assign object to member.\r\n//\r\n/*static*/\r\n__GCObject* __GCObject::_RefSetValue(__GCObject** m_ptrOwner, __GCObject* object) {\r\n\tif (*m_ptrOwner && !(*m_ptrOwner)->isFreed()) \t{ \r\n\t\t(*m_ptrOwner)->_removeRef(m_ptrOwner);\r\n\t}\r\n\tif (object)\t\t\t{ \r\n\t\tobject->_addRef(m_ptrOwner); \t\t\r\n\t}\r\n\t*m_ptrOwner = object;\r\n\treturn object;\r\n}\r\n\r\n/*static*/\r\n__GCObject* __GCObject::_RefSetOwner(__GCObject** m_ptrOwner, __GCObject* object) {\r\n\tif(*m_ptrOwner) {\r\n\t\t(*m_ptrOwner)->_removeOwner(*m_ptrOwner);\r\n\t\tif (object)\t{ \r\n\t\t\tobject->_addOwner(*m_ptrOwner);\r\n\t\t}\r\n\t\t*m_ptrOwner = object;\r\n\t}\r\n\treturn object;\r\n}\r\n\r\n//\r\n// Compaction\r\n//\r\nvoid __GCObject::_moveUpdate(__GCObject* beforeMoveObj) {\r\n\tif (m_ownerA != (__GCObject**)0xFFFFFFFF) {\r\n\t\tif (m_ownerA)\t{\r\n\t\t\tif(((ptrAsInt)m_ownerA & 0x3) == 0x3) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else if(((ptrAsInt)m_ownerA & 0x3) == 0x1) {\r\n\t\t\t\t__GCObject* obj = (__GCObject*)((ptrAsInt)m_ownerA & ~0x1);\r\n\t\t\t\tobj->_move(beforeMoveObj, this);\r\n\t\t\t} else if(((ptrAsInt)m_ownerA & 0x3) == 0x2) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else {\r\n\t\t\t\t*m_ownerA = this;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (m_ownerB)\t{ \r\n\t\t\tif(((ptrAsInt)m_ownerB & 0x3) == 0x3) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else if(((ptrAsInt)m_ownerB & 0x3) == 0x1) {\r\n\t\t\t\t__GCObject* obj = (__GCObject*)((ptrAsInt)m_ownerB & ~0x1);\r\n\t\t\t\tobj->_move(beforeMoveObj, this);\r\n\t\t\t} else if(((ptrAsInt)m_ownerB & 0x3) == 0x2) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else {\r\n\t\t\t\t*m_ownerB = this;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t((RefList*)m_ownerB)->updateListMove(beforeMoveObj, this);\r\n\t}\r\n\r\n\t// After moving, the object must patch its own members\r\n\t_moveAlert((u8*)this - (u8*)beforeMoveObj);\r\n}\r\n\r\n//\r\n// Reference Maintenance\r\n//\r\nvoid __GCObject::_removeRef(__GCObject** ptrOwner) {\r\n\tif(m_ownerA == ptrOwner) {\r\n\t\tm_ownerA = m_ownerB;\r\n\t\tm_ownerB = NULL;\r\n\t\tif (m_ownerA == NULL) {\r\n\t\t\tMemory::injectToDieList(this);\r\n\t\t}\r\n\t} else if (m_ownerB == ptrOwner) {\r\n\t\tm_ownerB = NULL;\r\n\t} else {\r\n\t\t((RefList*)m_ownerB)->removeList(this,ptrOwner);\r\n\t}\r\n}\r\n\r\nvoid __GCObject::_addRef(__GCObject** ptrOwner) {\r\n\tif(m_ownerA == ((__GCObject**)0xFFFFFFFF)) {\r\n\t\t((RefList*)m_ownerB)->addList(ptrOwner);\r\n\t} else {\r\n\t\tSAllocHeader* pN = (SAllocHeader*)this;\r\n\t\tif(pN[-1].getFreed()) {\r\n\t\t\tMemory::rejectFromDieList(this);\r\n\t\t\tm_ownerA = ptrOwner;\r\n\t\t} else {\r\n\t\t\tif(m_ownerB == NULL) {\r\n\t\t\t\tm_ownerB = ptrOwner;\r\n\t\t\t} else {\r\n\t\t\t\tm_ownerB = (__GCObject**)RefList::createList(this, ptrOwner);\r\n\t\t\t\tm_ownerA = (__GCObject**)0xFFFFFFFF;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid __GCObject::_moveRef(__GCObject** oldPtr, __GCObject** newPtr) {\r\n\tif(m_ownerA == oldPtr) {\r\n\t\tm_ownerA = newPtr;\r\n\t} else if (m_ownerB == oldPtr) {\r\n\t\tm_ownerB = newPtr;\r\n\t} else {\r\n\t\t((RefList*)m_ownerB)->moveRefList(oldPtr,newPtr);\r\n\t}\r\n}\r\n\r\nvoid __GCObject::_removeOwner(__GCObject* ptrOwner) {\r\n\t__GCObject** ptrOwner1 = (__GCObject**)((ptrAsInt)ptrOwner | 0x1);\r\n\t//__GCObject** ptrOwner2 = (__GCObject**)((ptrAsInt)ptrOwner | 0x3);\r\n\tif(m_ownerA == ptrOwner1 /*|| m_ownerA == ptrOwner2*/) {\r\n\t\tm_ownerA = m_ownerB;\r\n\t\tm_ownerB = NULL;\r\n\t\tif (m_ownerA == NULL) {\r\n\t\t\tMemory::injectToDieList(this);\r\n\t\t}\r\n\t} else if (m_ownerB == ptrOwner1 /*|| m_ownerB == ptrOwner2*/) {\r\n\t\tm_ownerB = NULL;\r\n\t} else {\r\n\t\t((RefList*)m_ownerB)->removeListOwner(this, ptrOwner);\r\n\t}\r\n}\r\n\r\nvoid __GCObject::_moveOwner(__GCObject*  oldObj, __GCObject* newObj) {\r\n\t__GCObject** oldObjPtr1 = (__GCObject**)((ptrAsInt)oldObj | 0x1);\r\n\t__GCObject** newObjPtr1 = (__GCObject**)((ptrAsInt)newObj | 0x1);\r\n\tif(m_ownerA == oldObjPtr1) {\r\n\t\tm_ownerA = newObjPtr1;\r\n\t} else if (m_ownerB == oldObjPtr1) {\r\n\t\tm_ownerB = newObjPtr1;\r\n\t} else {\r\n\t\t((RefList*)m_ownerB)->moveRefListOwner(oldObj, newObj);\r\n\t}\r\n}\r\n\r\n\r\nvoid RefList::updateListMove(__GCObject* prevObjMoving, __GCObject* objMoving) {\r\n\tRefList* p = this;\r\nloop:\r\n\tfor (int n=0; n < 4; n++) {\r\n\t\t__GCObject** adr = p->m_refArr[n];\r\n\t\tif (adr)\t{\r\n\t\t\tif(((ptrAsInt)adr & 0x3) == 0x3) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else if(((ptrAsInt)adr & 0x3) == 0x1) {\r\n\t\t\t\t__GCObject* obj = (__GCObject*)((ptrAsInt)adr & ~0x1);\r\n\t\t\t\t// Just call the Owner _move virtual method.\r\n\t\t\t\tobj->_move(prevObjMoving, objMoving);\r\n\t\t\t} else if(((ptrAsInt)adr & 0x3) == 0x2) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else {\r\n\t\t\t\t*adr = objMoving;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (p->m_next)\t\t{ p = p->m_next; goto loop; }\r\n}\r\n\r\nvoid RefList::addList(__GCObject** newRef) {\r\n\tRefList* p = this;\r\nloop:\r\n\tif (p->m_refArr[0] == NULL)\t{ p->m_refArr[0] = newRef; }\r\n\telse\r\n\tif (p->m_refArr[1] == NULL)\t{ p->m_refArr[1] = newRef; }\r\n\telse\r\n\tif (p->m_refArr[2] == NULL)\t{ p->m_refArr[2] = newRef; }\r\n\telse\r\n\tif (p->m_refArr[3] == NULL)\t{ p->m_refArr[3] = newRef; }\r\n\telse {\r\n\t\t// Tries to fill existing list first...\r\n\t\tif (p->m_next == NULL) {\r\n\t\t\tp->m_next = Memory::g_allocPage->allocEntry();\r\n\t\t}\r\n\t\tp = p->m_next;\r\n\t\tgoto loop;\r\n\t}\r\n}\r\n\r\nvoid RefList::removeList(__GCObject* obj, __GCObject** ref) {\r\n\tRefList* pList\t= this;\r\n\tRefList* pPrev  = NULL;\r\n\tbool found\t\t= false;\r\nloop:\r\n\tint idx = 0;\r\n\twhile (idx < 4) {\r\n\t\tif (pList->m_refArr[idx] == ref) {\r\n\t\t\tfound = true;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tidx++;\r\n\t}\r\n\r\n\tif (found == false) {\r\n\t\tpPrev = pList;\r\n\t\tpList = pList->m_next;\r\n\t\tgoto loop;\t// IF should not be necessary : pointer always inside.\r\n\t}\r\n\r\n\t//\r\n\t// Perform reduction.\r\n\t//\r\n\tint n = idx;\r\n\twhile(n < 3) {\r\n\t\tpList->m_refArr[n] = pList->m_refArr[n+1];\r\n\t\tn++;\r\n\t}\r\n\tpList->m_refArr[3] = NULL;\r\n\r\n\r\n\t// Stand alone, remain only 2 entries\r\n\tif ((pPrev == NULL) && (pList->m_next == NULL) && (pList->m_refArr[2] == NULL)) {\r\n\t\tobj->m_ownerA\t= pList->m_refArr[0];\r\n\t\tobj->m_ownerB\t= pList->m_refArr[1];\r\n\t\tMemory::g_allocPage->freeEntry(pList);\r\n\r\n\t\t//Early exit.\r\n\t\treturn;\r\n\t}\r\n\r\n\t// List has previous or successor...\r\n\t// Is empty ?\r\n\tif (pList->m_refArr[0] == NULL) {\r\n\t\tif (pPrev) {\r\n\t\t\tpPrev->m_next = pList->m_next;\r\n\t\t} else {\r\n\t\t\t// List may be empty or beginning of list.\r\n\t\t\tobj->m_ownerB = (__GCObject**)pList->m_next;\r\n\t\t}\r\n\t\tMemory::g_allocPage->freeEntry(pList);\r\n\t}\r\n}\r\n\r\nvoid RefList::removeListOwner(__GCObject* obj, __GCObject* ptrOwner) {\r\n\t__GCObject** ptrOwner1 = (__GCObject**)((ptrAsInt)ptrOwner | 0x1);\r\n\tRefList* pList\t= this;\r\n\tRefList* pPrev  = NULL;\r\n\tbool found\t\t= false;\r\nloop:\r\n\tint idx = 0;\r\n\twhile (idx < 4) {\r\n\t\tif (pList->m_refArr[idx] == ptrOwner1) {\r\n\t\t\tfound = true;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tidx++;\r\n\t}\r\n\r\n\tif (found == false) {\r\n\t\tpPrev = pList;\r\n\t\tpList = pList->m_next;\r\n\t\tgoto loop;\t// IF should not be necessary : pointer always inside.\r\n\t}\r\n\r\n\t//\r\n\t// Perform reduction.\r\n\t//\r\n\tint n = idx;\r\n\twhile(n < 3) {\r\n\t\tpList->m_refArr[n] = pList->m_refArr[n+1];\r\n\t\tn++;\r\n\t}\r\n\tpList->m_refArr[3] = NULL;\r\n\r\n\r\n\t// Stand alone, remain only 2 entries\r\n\tif ((pPrev == NULL) && (pList->m_next == NULL) && (pList->m_refArr[2] == NULL)) {\r\n\t\tobj->m_ownerA\t= pList->m_refArr[0];\r\n\t\tobj->m_ownerB\t= pList->m_refArr[1];\r\n\t\tMemory::g_allocPage->freeEntry(pList);\r\n\r\n\t\t//Early exit.\r\n\t\treturn;\r\n\t}\r\n\r\n\t// List has previous or successor...\r\n\t// Is empty ?\r\n\tif (pList->m_refArr[0] == NULL) {\r\n\t\tif (pPrev) {\r\n\t\t\tpPrev->m_next = pList->m_next;\r\n\t\t} else {\r\n\t\t\t// List may be empty or beginning of list.\r\n\t\t\tobj->m_ownerB = (__GCObject**)pList->m_next;\r\n\t\t}\r\n\t\tMemory::g_allocPage->freeEntry(pList);\r\n\t}\r\n}\r\n\r\nvoid RefList::moveRefList(__GCObject** oldRef, __GCObject** newRef) {\r\n\tRefList* p = this;\r\nloop:\r\n\tif\t\t(p->m_refArr[0] == oldRef)\t{ p->m_refArr[0] = newRef; }\r\n\telse if (p->m_refArr[1] == oldRef)\t{ p->m_refArr[1] = newRef; }\r\n\telse if (p->m_refArr[2] == oldRef)\t{ p->m_refArr[2] = newRef; }\r\n\telse if (p->m_refArr[3] == oldRef)\t{ p->m_refArr[3] = newRef; }\r\n\telse {\r\n\t\tp = p->m_next;\r\n\t\tgoto loop;\r\n\t}\r\n}\r\n\r\nvoid RefList::moveRefListOwner(__GCObject* oldObj, __GCObject* newObj) {\r\n\tRefList* p = this;\r\n\t__GCObject** oldRef1 = (__GCObject**)((ptrAsInt)oldObj | 0x1);\r\n\t__GCObject** newRef1 = (__GCObject**)((ptrAsInt)newObj | 0x1);\r\nloop:\r\n\tif\t\t(p->m_refArr[0] == oldRef1)\t{ p->m_refArr[0] = newRef1; }\r\n\telse if (p->m_refArr[1] == oldRef1)\t{ p->m_refArr[1] = newRef1; }\r\n\telse if (p->m_refArr[2] == oldRef1)\t{ p->m_refArr[2] = newRef1; }\r\n\telse if (p->m_refArr[3] == oldRef1)\t{ p->m_refArr[3] = newRef1; }\r\n\telse {\r\n\t\tp = p->m_next;\r\n\t\tgoto loop;\r\n\t}\r\n}\r\n\r\nRefList* RefList::createList(__GCObject* obj, __GCObject** newRef) {\r\n\t// 1. Create new list\r\n\tRefList* pList\t= Memory::g_allocPage->allocEntry();\r\n\r\n\t// 2.\r\n\tpList->m_refArr[0]\t= obj->m_ownerA;\r\n\tpList->m_refArr[1]\t= obj->m_ownerB;\r\n\tpList->m_refArr[2]\t= newRef;\r\n\tpList->m_refArr[3]\t= NULL;\r\n\tpList->m_next\t\t= NULL;\r\n\treturn pList;\r\n}\r\n\r\n/*\r\n\t1. Have struct count the number of ref GCObject\r\n\t2. Have struct count the combined count also. (struct in struct)\r\n\t3. Have the compiler do the sum of those to get the max amount of possible references\r\n\r\n\r\n\t// Compiler now need to generate something like this :\r\n\r\n\tfct_ref(ref a, ref b) {\r\n\t\tRefHolder array[MAX_COUNT];\t\t\r\n\t\tu32 count = _refCallFinish(array);\r\n\r\n\t\t... perform call here ...\r\n\r\n\t\t_refRemove_(count,array);\r\n\t}\r\n */\r\n\r\n/*static*/\r\n__GCObject*& __GCObject::__registerByRef(__GCObject*& ref) {\r\n\t// TODO Check stack end reach.\r\n\t// TODO Compiler can check also max needed limit.\r\n\tg_globStack->holderValue\t= ref;\r\n\tg_globStack->pHolder\t\t= &ref;\r\n\tg_globStack++;\r\n\treturn ref;\r\n}\r\n\r\n#ifdef _DEBUG_MEMORY_\r\n\r\nvoid __GCObject::_debug_displayReferences(u8 tabsNb, u8 tabsOnFirstLine) {\r\n\tif(m_ownerA != (__GCObject**)0xFFFFFFFF) {\r\n\t\tif(m_ownerA) {\r\n\t\t\tfor(u8 i = 0; i < tabsOnFirstLine; ++i) { printf(\"\\t\"); }\r\n\t\t\tif(((ptrAsInt)m_ownerA & 0x3) == 0x3) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else if(((ptrAsInt)m_ownerA & 0x3) == 0x1) {\r\n\t\t\t\tprintf(\"+ 0x%08x [A][OWNER]\\n\", ((ptrAsInt)m_ownerA & ~0x1));\r\n\t\t\t} else if(((ptrAsInt)m_ownerA & 0x3) == 0x2) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"+ 0x%08x [A]\\n\", m_ownerA);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(m_ownerB)\t{ \r\n\t\t\tfor(u8 i = 0; i < tabsNb; ++i) { printf(\"\\t\"); }\r\n\t\t\tif(((ptrAsInt)m_ownerB & 0x3) == 0x1) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else if(((ptrAsInt)m_ownerB & 0x3) == 0x1) {\r\n\t\t\t\tprintf(\"+ 0x%08x [B][OWNER]\\n\", ((ptrAsInt)m_ownerB & ~0x1));\r\n\t\t\t} else if(((ptrAsInt)m_ownerB & 0x3) == 0x2) {\r\n\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t} else {\r\n\t\t\t\tprintf(\"+ 0x%08x [B]\\n\", m_ownerB);\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tRefList* pList = ((RefList*)m_ownerB);\r\n\t\tu8 rank = 1;\r\n\t\twhile(pList) {\r\n\t\t\tfor(u8 i = 0; i < 4; ++i) {\r\n\t\t\t\t__GCObject** adr = pList->m_refArr[i];\r\n\t\t\t\tif(adr) {\r\n\t\t\t\t\tfor(u8 j = 0; j < ((rank == 1 && i == 0) ? tabsOnFirstLine : tabsNb); ++j) { printf(\"\\t\"); }\r\n\t\t\t\t\tfor(u8 j = 0; j < rank*2; ++j) { printf(\"+\"); };\r\n\t\t\t\t\tif(((ptrAsInt)adr & 0x3) == 0x3) {\r\n\t\t\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t\t\t} else if(((ptrAsInt)adr & 0x3) == 0x1) {\r\n\t\t\t\t\t\tprintf(\"+ 0x%08x [%i][OWNER]\\n\", ((ptrAsInt)adr & ~0x1), i);\r\n\t\t\t\t\t} else if(((ptrAsInt)adr & 0x3) == 0x2) {\r\n\t\t\t\t\t\tCS_AssertAlways(\"It should be impossible to have this kind of reference now. Not used in current version.\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprintf(\"+ 0x%08x [%i]\\n\", adr, i);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t++rank;\r\n\t\t\tpList = pList->m_next;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid Memory::_debug_displayMemory(CompactionContext ctx) {\r\n\tu32 parsingStart\t= (ctx.genParsing == 0) ? (u32)s_bufferStart\t\t\t: (u32)s_bufferStartGen1;\r\n\tu32 parsingEnd\t\t= (ctx.genParsing == 0) ? (u32)s_bufferAllocGen0Prev\t: (u32)s_bufferAllocGen1Prev;\r\n\tprintf(\"\\n\");\r\n\tprintf(\"=======================================================================\\n\");\r\n\tprintf(\"\\tMemory Dump - GENERATION %i - from 0x%08x to 0x%08x\\n\", ctx.genParsing, parsingStart, parsingEnd);\r\n\tprintf(\"=======================================================================\\n\");\r\n\tprintf(\"INDEX \\t\\t ADDRESS \\t INFOS \\t SIZE\\n\");\r\n\tprintf(\"=======================================================================\\n\");\r\n\tu32 debugCount = 0;\r\n\twhile(ctx.p) {\r\n\t\tprintf(\"[%i]\\t\\t0x%08x\\t%s %s %s\\t\\t%x\", debugCount, ctx.p, ctx.p->getFreed() ? \"F\":\" \", ctx.p->getDestroyed() ? \"D\":\" \", ctx.p->getSurvived() ? \"S\":\" \", ctx.p->getSize());\r\n\t\tif(!ctx.p->getFreed()) {\r\n\t\t\t((__GCObject*)(&ctx.p[1]))->_debug_displayReferences(7,1);\r\n\t\t} else {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t}\r\n\t\tdebugCount++;\r\n\t\tctx.p = ctx.p->m_next;\r\n\t}\r\n\tprintf(\"=======================================================================\\n\");\r\n\tprintf(\"\\n\");\r\n}\r\n\r\n#endif\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Memory.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Memory_h_\r\n#define _CS_Memory_h_\r\n\r\n#include \"../CompilerProject/BaseType.h\"\r\n\r\n/*\r\n\tMemory System Description :\r\n\r\n\t0 - Does NOT support multitasking.\r\n\t\tIt is oriented for scripting and be light weight as possible, easy implementation\r\n\t\tfor now.\r\n\r\n\t1 - All big objects will be allocated in a special pool.\r\n\t\r\n\t2 - All small objects will have a 2 Generation Heap (0 and 1).\r\n\t\r\n\t3 - The 2 Generation heap are using the same heap space, allowing dynamic balancing between both heaps.\r\n\r\n\t\tThe trick is that the second generation (generation 1) is using the memory\r\n\t\tfrom the highest memory pointer to the lowest, while first generation\r\n\t\tis using memory from the lowest to the highest.\r\n\t\t=> When they meet, it means that memory is full.\r\n\r\n\t\t(like the heap and stack using the same memory)\r\n\r\n\t4 - Garbage collection is a mix of both reference counting-like mecanism, and mark & sweep.\r\n\r\n\tThe technical reason are the following :\r\n\t\t- Mark & Sweep is perfect for detecting all the leaks, but must be an ATOMIC operation.\r\n\t\tThus, is very costly.\r\n\r\n\t\t- Reference counting allow to handle destruction, recollection of memory little by little.\r\n\t\tThus, allow to delay memory processing over multiple frames, more adapted to real-time.\r\n\t\tProblem : Reference counting does not work well with cyclic graph, thus need a more\r\n\t\tcomplex way to sometime reclaim memory.\r\n\r\n\t5 - Actually we do not use reference counting, but keep track of all object owner inside the object itself.\r\n\t\t- This allows us to perform compaction very easily : we can move a single object and update the owner directly.\r\n\r\n\t6 - WARNING, our system has the following limitation for now :\r\n\t\t\r\n\t\t6.1 - We do NOT scan the stack.\r\n\t\t\r\n\t\tWARNING => Garbage collection must occur ONLY when script is NOT executing.\r\n\t\tIt means that your system has better to garbage collect little by little to make\r\n\t\tsure that you have enough room for allocation.\r\n\r\n\t\tWARNING => Do not modify the new allocator to force recompaction, else make sure\r\n\t\tthat you have implemented support for local variables.\r\n\r\n\t\tAgain, I repeat to make clean : garbage collection MUST always occurs outside of script execution.\r\n\r\n\t7 - Logic / Algorithm implementation is the following.\r\n\t\t\r\n\t\t7.1 -\tEach time a static or instance member has a pointer modified (write),\r\n\t\t\t\tthe previous and new pointer are updated of owner ship change.\r\n\t\t\t\t\r\n\t\t\t\tWhen no ownership is set, it is marked as being FREED.\r\n\t\t\t\tWhen ownership    is set, it is marked as being NOT FREED.\r\n\r\n\t\t\t\tTRICK : When object is freed, there is a link list of object marked freed,\r\n\t\t\t\twe reuse the reference pointer to this new purpose.\r\n\r\n\t\t7.2 -\tCompaction / Memory recollection :\r\n\r\n\t\t\t\tFor each item in the heap\r\n\t\t\t\t\tIf the item is marked as free\r\n\t\t\t\t\t\t=> Update references => Other object may marked free and added to list of object to destroy.\r\n\t\t\t\t\t\t=> Parse the list of item to destroy until list is empty.\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\t=> Move the object if adress has changed (Object Copy + Update references to object)\r\n\r\n\t\t\t\tWe keep track of the last valid item to decide where to move the object when doing the compaction.\r\n\t\t\t\t\r\n\t\t\t\tCompaction can be performed atomically for one item only , thus allowing to run the compaction\r\n\t\t\t\tthe way we want for multiple items :\r\n\t\t\t\t- Time limited\r\n\t\t\t\t- Number of item limited\r\n\t\t\t\t- Amount of memory processed\r\n\t\t\t\t- Etc... etc...\r\n\r\n\t\t7.3 -\tFunction Dependancies\r\n\t\t\t\r\n\t\t\t\tgarbageCollection / member write\r\n\t\t\t\t\treleaseGC()\r\n\t\t\t\t\t\t_removeRef\t\r\n\t\t\t\t\t\t\t->\tinjectToDieList\r\n\t\t\t\t\t\t_addRef\t\t\r\n\t\t\t\t\t\t\t->\trejectFromDieList\r\n\r\n\t\t\t\tInside garbage collection, parse \"die list\" and call releaseGC for each.\r\n\r\n\t\r\n\tAll and all, our system is quite primitive. But it should be efficient enough\r\n\tfor scripting and real time execution for video games.\r\n\r\n\t- The limitation for allocation error at runtime can be compensated easily by\r\n\tregular low cost maintenance collection.\r\n\r\n\t- Allocation of list for more than 2 references to object is something more costly,\r\n\tbut those kind of memory structure are rare, and the overhead of such should be bearable for scripting then.\r\n\r\n */\r\n\r\n#define MAGICNUMBER 0xC0FEBABE\r\n//#define _DEBUG_MEMORY_\r\n\r\nvoid*\tCS_malloc(size_t size);\r\nvoid\tCS_free(void* ptr);\r\nvoid*\tCS_realloc(void *memblock, size_t size, size_t oldSize);\r\n\r\n#define CS_MALLOC(size)\t\t\t\t\tCS_malloc(size)\r\n#define CS_FREE(ptr)\t\t\t\t\tCS_free(ptr)\r\n#define CS_REALLOC(ptr,size,oldSize)\tCS_realloc(ptr,size,oldSize)\r\n\r\n#define\tCS_NEW\t\t\tnew\r\n#define CS_DELETE\t\tdelete\r\n#define CS_DELETEA\t\tdelete[]\r\n#define CS_NEWA(a,b)\tnew a[b]\r\n\r\nnamespace System {\r\n\r\nclass Object;\r\nclass __GCObject;\r\n\r\nstruct RefHolder {\r\n\tSystem::__GCObject**\tpHolder;\r\n\tSystem::__GCObject*\t\tholderValue;\r\n};\r\n\r\nclass GC {\r\npublic:\r\n\tstatic void Collect(s32 generation);\r\n\tstatic s32  CollectionCount(s32 generation);\r\n\tstatic s32\tGetGeneration(Object* object);\r\n\tstatic s32\tGetTotalMemory(bool forceFullCollection);\r\n};\r\n\r\nstruct SAllocMSEntry {\r\n\tu32\t\t\t\tstartIndex;\r\n\t__GCObject*\t\tobject;\r\n\tSAllocMSEntry*\tnext;\r\n\tSAllocMSEntry*\tprev;\r\n};\r\n\r\nstruct RefList {\r\n\tvoid updateListMove\t\t\t(__GCObject* prevObjMoving, __GCObject* objMoving);\r\n\tvoid addList\t\t\t\t(__GCObject** newRef);\r\n\tvoid removeList\t\t\t\t(__GCObject* obj,\t\t__GCObject** ref);\r\n\tvoid removeListOwner\t\t(__GCObject* obj,\t\t__GCObject* ptrOwner);\r\n\tvoid moveRefList\t\t\t(__GCObject** oldRef,\t__GCObject** newRef);\r\n\tvoid moveRefListOwner\t\t(__GCObject* oldObj,\t__GCObject* newObj);\r\n\tstatic RefList* createList\t(__GCObject* obj,\t\t__GCObject** newRef);\r\n\r\n\t__GCObject**\tm_refArr[4];\r\n\tRefList*\t\tm_next;\t\t\t// Note : can store bottom 2 bit for counter.\r\n};\r\n\r\nstruct SAllocHeader {\r\n\tSAllocHeader* \tm_prev;\r\n\tSAllocHeader* \tm_next;\r\n\tu32\t\t  \t\tm_info;\t// Bit 24..31 : Info\r\n\t\t\t\t\t\t\t// Bit  0..23 : Size, 16 MB Max\r\n\r\n\tstatic const int SHIFT_INFO = 24;\r\n\tstatic const int MASK_INFO\t= 0x0F000000;\r\n\tstatic const int SIZE_INFO\t= 0x00FFFFFF;\r\n\tstatic const int FREED\t\t= 0x80000000;\r\n\tstatic const int MSMARK\t\t= 0x40000000;\r\n\tstatic const int DESTROYED\t= 0x20000000;\r\n\tstatic const int SURVIVED\t= 0x10000000;\r\n\r\n\tinline void setSize(u32 size) {\r\n\t\tm_info = (m_info & MASK_INFO) | size;\r\n\t}\r\n\r\n\tinline u32 getSize() {\r\n\t\treturn m_info & SIZE_INFO;\r\n\t}\r\n\r\n\tinline void incGCCount() {\r\n\t\tm_info += (SIZE_INFO + 1);\r\n\t}\r\n\r\n\tinline u32 getGCCount() {\r\n\t\treturn m_info & MASK_INFO >> SHIFT_INFO;\r\n\t}\r\n\r\n\tinline bool getFreed() {\r\n\t\treturn (m_info & FREED) != 0;\r\n\t}\r\n\r\n\tinline void setFreed() {\r\n\t\tm_info |= FREED;\r\n\t}\r\n\r\n\tinline void unsetFreed() {\r\n\t\tm_info &= ~FREED;\r\n\t}\r\n\r\n\tinline bool getDestroyed() {\r\n\t\treturn (m_info & DESTROYED) != 0;\r\n\t}\r\n\r\n\tinline void setDestroyed() {\r\n\t\tm_info |= DESTROYED;\r\n\t}\r\n\r\n\tinline bool getSurvived() {\r\n\t\treturn (m_info & SURVIVED) != 0;\r\n\t}\r\n\r\n\tinline void setSurvived() {\r\n\t\tm_info |= SURVIVED; \r\n\t}\r\n\r\n\tinline void unsetSurvived() {\r\n\t\tm_info &= ~SURVIVED; \r\n\t}\r\n\r\n\tinline void setMark() {\r\n\t\tm_info |= MSMARK;\r\n\t}\r\n\r\n\tinline bool getMark() {\r\n\t\treturn (m_info & MSMARK) != 0;\r\n\t}\r\n\r\n\tinline void unsetMark() {\r\n\t\tm_info &= ~MSMARK;\r\n\t}\r\n};\r\n\r\ntemplate <class T>\r\nclass _CS_ArrayAllocator {\r\nprotected:\r\n\tstruct ArrayItem {\r\n\tpublic:\r\n\t\tArrayItem() {}\r\n\t\t~ArrayItem() {}\r\n\r\n\t\tT \tentry;\r\n\t\tu16\tnext;\r\n\t\tu16 prev;\r\n\t};\r\n\tstatic const u16 NULL_INDEX = 0xFFFF;\r\npublic:\r\n\t_CS_ArrayAllocator()\r\n\t:m_array\t\t(NULL)\r\n\t,m_arrayCount\t(0)\r\n\t,m_freeList\t\t(NULL_INDEX)\r\n\t,m_usedList\t\t(NULL_INDEX)\r\n\t{\r\n\t}\r\n\r\n\t~_CS_ArrayAllocator()\r\n\t{\r\n\t\trelease();\r\n\t}\r\n\t\r\n\tbool init(u16 entryCount) {\r\n\t\tm_array = (ArrayItem*)CS_MALLOC(entryCount*sizeof(ArrayItem));\r\n\t\tif (m_array) {\r\n\t\t\tm_arrayCount = entryCount;\r\n\t\t\tm_allocated\t = 0;\r\n\r\n\t\t\tfor (int n=0; n < entryCount; n++) {\r\n\t\t\t\tm_array[n].next = n+1;\r\n\t\t\t\tm_array[n].prev = n-1;\r\n\t\t\t}\r\n\t\t\r\n\t\t\tm_array[0].prev\t\t\t\t= NULL_INDEX;\r\n\t\t\tm_array[entryCount-1].next\t= NULL_INDEX;\r\n\t\t\tm_freeList\t\t\t\t\t= 0;\r\n\t\t\tm_usedList\t\t\t\t\t= NULL_INDEX;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tvoid release() {\r\n\t\tCS_FREE(m_array);\r\n\t\tm_array = NULL;\r\n\t}\r\n\t\r\n\tT* allocEntry() {\r\n\t\tif (m_freeList == NULL_INDEX) {\r\n\t\t\tCS_AssertAlways(\"Allocator Full\");\r\n\t\t\treturn NULL;\r\n\t\t} else {\r\n\t\t\tm_allocated++;\r\n\r\n\t\t\tu16 newItem = m_freeList;\r\n\t\t\r\n\t\t\t// Remove from free list.\r\n\t\t\tm_freeList\t= m_array[newItem].next;\r\n\t\t\tif (m_freeList != NULL_INDEX) {\tm_array[m_freeList].prev = NULL_INDEX;\t}\r\n\t\t\r\n\t\t\t// Add to used list.\r\n\t\t\tm_array[newItem].next = m_usedList;\r\n\t\t\tm_array[newItem].prev = NULL_INDEX;\r\n\t\t\tif (m_usedList != NULL_INDEX) {\tm_array[m_usedList].prev = newItem;\t\t}\r\n\t\t\tm_usedList = newItem;\r\n\r\n\t\t\t// Clean entry before returning it.\r\n\t\t\tmemset(&m_array[newItem].entry, 0, sizeof(T));\r\n\r\n\t\t\treturn &m_array[newItem].entry;\r\n\t\t}\r\n\t}\r\n\r\n\tvoid freeEntry(T* entry) {\r\n\t\tif (!entry)\t{ return ;}\t// Safe delete\r\n\t\tArrayItem* pItem = (ArrayItem*)entry;\r\n\r\n\t\tm_allocated--;\r\n\r\n\t\t//\r\n\t\t// Remove from active list\r\n\t\t//\r\n\t\tif (pItem->prev != NULL_INDEX) {\r\n\t\t\tm_array[pItem->prev].next = pItem->next;\r\n\t\t} else {\r\n\t\t\tm_usedList = pItem->next;\r\n\t\t}\r\n\t\r\n\t\tif (pItem->next != NULL_INDEX) {\r\n\t\t\tm_array[pItem->next].prev = pItem->prev;\r\n\t\t}\r\n\t\r\n\t\t//\r\n\t\t// Add to free list\r\n\t\t//\r\n\t\tu16 idx = pItem - m_array;\r\n\t\tif (m_freeList != NULL_INDEX) {\r\n\t\t\tm_array[m_freeList].prev = idx;\r\n\t\t}\r\n\t\r\n\t\tpItem->next = m_freeList;\r\n\t\tpItem->prev = NULL_INDEX;\r\n\r\n\t\t// Position.\r\n\t\tm_freeList = idx;\r\n\t}\r\n\t\r\n\tArrayItem*\tm_array;\r\n\tu32\t\t\tm_allocated;\r\n\tu32\t\t\tm_arrayCount;\r\n\tu32\t\t\tm_freeList;\r\n\tu32\t\t\tm_usedList;\r\n};\r\n\r\nclass Memory {\r\n\tfriend class __GCObject;\r\npublic:\r\n\tstatic bool setGlobalMemory\t\t\t(u32 size,u32 rootCount, u16 MultipleRefPageCount, u16 MarkAndSweepStackSize);\r\n\tstatic void release\t\t\t\t\t();\r\n\r\n\tstatic void* allocate\t\t\t\t(u32 size);\r\n\t//\r\n\t// Ref counter Collection System.\r\n\t//\r\n\tstatic void compactionSmall\t\t\t(u32 infos);\r\n\r\n\t//\r\n\t// Mark & Sweep Collection System.\r\n\t//\r\n\r\n\tstatic const u32 COMPACT_GEN0\t= 0x00000001;\r\n\tstatic const u32 COMPACT_GEN1\t= 0x00000002;\r\n\tstatic const u32 COMPACT_NOW\t= 0x00000010;\r\n\r\n\tstatic void compactionMS\t\t\t(u32 infos = (COMPACT_GEN0 | COMPACT_NOW));\r\n\tstatic void registerGCRoot\t\t\t(void* ptr);\r\n\tstatic bool pushList\t\t\t\t(__GCObject* obj, u32 startIndex);\r\n\tstatic __GCObject* removeNext\t\t();\r\n\tstatic void setLastProcessIndex\t\t(u32 size);\r\n\tstatic u32\tgetLastProcessIndex\t\t();\r\n\tstatic bool emptyList\t\t\t\t();\r\n\tstatic u32\tgetProcessSizeMax\t\t();\r\n\r\n\tstatic _CS_ArrayAllocator<RefList>*\t\t\tg_allocPage;\r\nprotected:\r\n\tstruct CompactionContext {\r\n\t\tSAllocHeader*\tp;\r\n\t\tSAllocHeader*\tlastValidGen0;\r\n\t\tSAllocHeader*\tlastValidGen1;\r\n\t\tSAllocHeader*\tfirstFreeGen0;\r\n\t\tSAllocHeader*\tfirstFreeGen1;\r\n\t\tu32\t\t\t\tmoved;\r\n\t\tu32\t\t\t\tremoved;\r\n\t\tu32\t\t\t\tgenParsing;\t\t// Which generation is being compacted\r\n\t};\r\n\r\n\tstatic void injectToDieList\t\t\t(__GCObject* obj);\r\n\tstatic void rejectFromDieList\t\t(__GCObject* obj);\r\n\tstatic void compactionInternal\t\t(CompactionContext& ctx);\r\n\tstatic void removeObject\t\t\t(__GCObject* obj);\r\n\r\nprivate:\r\n\tstatic __GCObject*\t\tg_destroyList;\r\n\tstatic u8*\t\t\t\ts_bufferStart;\r\n\tstatic u8* \t\t\t\ts_bufferEnd;\r\n\tstatic u8*\t\t\t\ts_bufferStartGen1;\r\n\tstatic u8* \t\t\t\ts_bufferAllocGen0;\t\t// Pointer to start of next freely available block\r\n\tstatic SAllocHeader*\ts_bufferAllocGen0Prev;\t// Pointer to start of latest allocated block\r\n\tstatic SAllocHeader*\ts_bufferAllocGen1Prev;\t// Pointer to start of latest allocated block in Gen1\r\n\tstatic u8* \t\t\t\ts_bufferAllocGen1;\t\t// Downward\r\n\tstatic SAllocHeader*\ts_lastCompaction;\r\n\tstatic u32\t\t\t\ts_initMagic;\r\n\tstatic __GCObject***\tg_rootList;\r\n\tstatic u32\t\t\t\tg_rootCount;\r\n\tstatic u32\t\t\t\tROOTCOUNT;\r\n\tstatic _CS_ArrayAllocator<SAllocMSEntry>*\tg_allocMSEntry;\r\n\r\n//\tstatic SAllocHeader*\ts_allocatedSmall;\r\n//\tstatic SAllocHeader*\ts_allocatedSmallPrev;\r\n//\tstatic SAllocHeader*\ts_allocatedBig;\r\n//\tstatic SAllocHeader*\ts_freeList;\r\n\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tstatic void\t\t\t_debug_displayMemory(CompactionContext ctx);\r\n\t#endif\r\n\r\n};\r\n\r\n\r\n}\r\n\r\n// Outside of name space.\r\nu32  _refCallFinish_\t(System::RefHolder* array_);\r\nvoid _refRemove_\t\t(u32 count, System::RefHolder* array_);\r\n\r\n#endif // _CS_Memory_h_\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Object.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_Object.h\"\r\n#include \"CS_String.h\"\r\n\r\nvoid* CS_malloc(size_t size) {\r\n\tsize = ((size + 3) & 0xFFFFFFFC);\r\n\tvoid* ptr = malloc(size);\r\n\tif(ptr) { memset32(ptr, 0, size); }\r\n\treturn ptr;\r\n}\r\n\r\nvoid CS_free(void* ptr) {\r\n\tfree(ptr);\r\n}\r\n\r\nvoid* CS_realloc(void *memblock, size_t size, size_t oldSize) {\r\n\tsize = ((size + 3) & 0xFFFFFFFC);\r\n\tvoid* ptr = realloc(memblock, size);\r\n\tif(ptr && size > oldSize) {\r\n\t\tmemset32((u8*)ptr + oldSize, 0, size - oldSize); \r\n\t}\r\n\treturn ptr;\r\n}\r\n\r\n\r\n\r\nnamespace System {\r\n\r\n// TODO override new / delete\r\n\r\nObject::Object() {\r\n}\r\n\r\n/*virtual*/\r\nu32 Object::_processGC() {\r\n\t// Do nothing.\r\n\treturn COMPLETE;\r\n}\r\n\r\nbool Object::Equals(Object* obj) {\r\n\treturn obj == this;\r\n}\r\n\r\n/*static*/\r\nbool Object::Equals(Object* objA, Object* objB) {\r\n\treturn objA == objB;\r\n}\r\n\r\ns32 Object::GetHashCode() {\r\n\treturn (s32)this;\r\n}\r\n\r\n/** Unsupported\r\nType* Object::GetType() {\r\n\treturn NULL;\r\n}*/\r\n\r\nstatic const uniChar __NotSupportedYetStr_0[17]\t\t\t\t= { 'N','o','t',' ','s','u','p','o','r','t','e','d',' ','y','e','t','.' };\r\n\r\nString* Object::GetType() {\r\n\treturn CS_NEW String(__NotSupportedYetStr_0, 17);\r\n}\r\n\r\n\r\n/** Unsupported\r\nObject* Object::MemberwiseClone() {\r\n\treturn new Object();\r\n}*/\r\n\r\n/*vitual*/\r\ns32 Object::CompareTo(Object* obj) {\r\n\tTHROW(CS_NEW CppNotComparable());\r\n}\r\n\r\n/*static*/\r\nbool Object::ReferenceEquals(Object* objA, Object* objB) {\r\n\treturn objA == objB;\r\n}\r\n\r\nstatic const uniChar __objStr_1[] = { 'S','y','s','t','e','m','.','O','b','j','e','c','t' };\r\nString* Object::ToString() {\r\n\treturn CS_NEW String(__objStr_1,13);\r\n}\r\n\r\nObject::~Object() {\r\n}\r\n\r\n/*virtual*/ \r\nbool Object::_isInstanceOf(u32 typeID) {\r\n\tif(typeID == Object::_TYPEID) {\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool Object::_isClassOf(u32 typeID) {\r\n\tif(typeID == Object::_TYPEID) {\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\n}\r\n\r\nvoid* _as_(System::Object* ptr, u32 classID) {\r\n\treturn (ptr ? (ptr->_isInstanceOf(classID) ? ptr : NULL) : NULL);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_Object.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Object_\r\n#define _CS_Object_\r\n\r\n#include <setjmp.h>\r\n#include <stdlib.h>\r\n#include \"../CompilerProject/BaseType.h\"\r\n#include \"CS_Memory.h\"\r\n\r\n//----------------------------------------------------------------------------\r\n// Standard Define\r\n//\r\n\r\n#define\tmemcpy32\tmemcpy\r\n#define memcpy16\tmemcpy\r\n#define memset16(dst, val, size)\t{ u16 v = (u16)(val); u16* ptrStart = (u16*)(dst); u16* ptrEnd = &ptrStart[(size)>>1]; while (ptrStart != ptrEnd) { *ptrStart++ = v; } }\r\n#define memset32(dst, val, size)\t{ u32 v = (u32)(val); u32* ptrStart = (u32*)(dst); u32* ptrEnd = &ptrStart[(size)>>2]; while (ptrStart != ptrEnd) { *ptrStart++ = v; } }\r\n\r\n#ifndef NULL\r\n#define\tNULL\t\t\t(0)\r\n#endif\r\n\r\n// Heap checking (via crtdbg) is windows-only, so use it cautiously\r\n#ifdef _WIN32\r\n  #include <crtdbg.h>\r\n  #define\t\tCHECKMEM()\t\t\tCS_Assert(_CrtCheckMemory(),\"Heap Corrupted\")\r\n#else\r\n  #define\t\tCHECKMEM()\t\t\t;\r\n#endif\r\n\r\nenum _CS_CLASS_TYPE {\r\n\t_TYPE_OBJECT\t\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFFF,\r\n\t_TYPE_ARRAY\t\t\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFFE,\r\n\t_TYPE_ABSTRACTARRAY\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFFD,\r\n\t_TYPE_STRING\t\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFFC,\r\n\t_TYPE_LIST\t\t\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFFB,\r\n\t_TYPE_DICTIONARY\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFFA,\r\n\t_TYPE_DELEGATE\t\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFFF9,\r\n\r\n\t_TYPE_EXCEPTION\t\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF7F,\r\n\t_TYPE_SYSTEMEXCEPTION\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF7E,\r\n\t_TYPE_INDEXOUTOFRANGEEXCEPTION\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF7D,\r\n\t_TYPE_NULLEXCEPTION\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF7C,\r\n\t_TYPE_OUTOFMEMORYEXCEPTION\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF7B,\r\n\t_TYPE_ARGUMENTEXCEPTION\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF7A,\r\n\t_TYPE_ARGUMENTOUTOFRANGEEXCEPTION\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF79,\r\n\t_TYPE_ARGUMENTNULLEXCEPTION\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF78,\r\n\t_TYPE_RANKEXCEPTION\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF76,\r\n\t_TYPE_CPPNOTCOMPARABLEEXCEPTION\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF75,\r\n\t_TYPE_INVALIDOPERATIONEXCEPTION\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF74,\r\n\t_TYPE_ARRAYTYPEMISMATCHEXCEPTION\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF73,\r\n\t_TYPE_KEYNOTFOUNDEXCEPTION\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF72,\r\n\t_TYPE_ARITHMETICEXCEPTION\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF71,\r\n\t_TYPE_DIVISIONBYZEROEXCEPTION\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF70,\r\n\t_TYPE_CPPEXCEPTION\t\t\t\t\t= ET_PREINSTALL\t|\tET_CLASS\t\t\t|\t0xFF6F,\r\n};\r\n\r\nnamespace System {\r\n\r\nclass String;\r\n\r\nclass __GCObject {\r\npublic:\r\n\tstatic const u32\tINCOMPLETE\t= 1;\r\n\tstatic const u32\tCOMPLETE\t= 0;\r\n\r\n\tvoid* \toperator \tnew\t\t(std::size_t);\r\n\tvoid* \toperator \tnew\t\t(std::size_t, std::size_t);\r\n\t// No need, GC does the work : void  \toperator \tdelete\t(void*);\r\n\r\n\tvirtual\r\n\tvoid\t_releaseGC\t() { /* Do nothing */ }\r\n\r\n\tvirtual\t\r\n\tu32\t\t_processGC\t() = 0;\r\n\r\n\tvirtual\r\n\tvoid\t_move\t\t(__GCObject* prevObj, __GCObject* newObj) { /* Do nothing */ }\r\n\r\n\tvirtual \r\n\tvoid\t_moveAlert\t(u32 offset) { /* Do nothing */ }\r\n\r\n\tvoid\t_moveUpdate\t(__GCObject* obj);\r\n\r\n\tvoid\t_removeRef\t(__GCObject** ptrOwner);\r\n\tvoid\t_addRef\t\t(__GCObject** ptrOwner);\r\n\tvoid\t_moveRef\t(__GCObject** oldPtr, __GCObject** newPtr);\r\n\r\n\tinline\r\n\tvoid\t_addOwner\t(__GCObject*  object) { _addRef((__GCObject**)((ptrAsInt)object | 0x1)); }\r\n\tvoid\t_removeOwner(__GCObject*  object);\r\n\tvoid\t_moveOwner\t(__GCObject*  oldObj, __GCObject* newObj);\r\n\r\n\tinline\r\n\tvoid\t_moveOwnerAsRef(__GCObject** oldRef, __GCObject** newRef) { _moveRef((__GCObject**)((ptrAsInt)oldRef | 0x1), ((__GCObject**)((ptrAsInt)newRef | 0x1))); };\r\n\r\n\tinline\r\n\tvoid\tmark\t\t() { SAllocHeader* pN = (SAllocHeader*)this; pN[-1].setMark(); }\r\n\tinline\r\n\tbool\tisMarked\t() { SAllocHeader* pN = (SAllocHeader*)this; return pN[-1].getMark(); }\r\n\r\n\tinline\r\n\tvoid\tdestroy\t\t() { SAllocHeader* pN = (SAllocHeader*)this; pN[-1].setDestroyed(); }\r\n\tinline\r\n\tbool\tisDestroyed\t() { SAllocHeader* pN = (SAllocHeader*)this; return pN[-1].getDestroyed(); }\r\n\r\n\tinline\r\n\tbool\tisFreed\t\t() { SAllocHeader* pN = (SAllocHeader*)this; return pN[-1].getFreed(); }\r\n\t/**\r\n\t\tIf allocator set object as NON FREE,\r\n\t\twe have two mode :\r\n\t\tm_ownerA != 0xFFFFFFFF\r\n\t\t\tm_ownerA is a pointer to a reference\r\n\t\t\tm_ownerB is a pointer to a reference\r\n\t\t\tThus allowing to have a maximum of 2 references supported by default\r\n\t\tm_ownerA == 0xFFFFFFFF\r\n\t\t\tm_ownerA is a magic number.\r\n\t\t\tm_ownerB is a pointer to a LIST of references.\r\n\t\t\tThus allowing to have an unlimited amount of references supported.\r\n\r\n\t\tIf allocator set object as FREED,\r\n\t\t\tm_ownerA = next pointer in the link list of \"die-list\"\r\n\t\t\tm_ownerB = prev pointer in the link list of \"die-list\"\r\n\t */\r\n\t__GCObject**\tm_ownerA;\r\n\t__GCObject**\tm_ownerB;\r\n\r\n\tstatic __GCObject*\t_RefSetValue\t(__GCObject** m_ptrOwner, __GCObject* object);\r\n\tstatic __GCObject*  _RefSetOwner\t(__GCObject** m_ptrOwner, __GCObject* object);\r\n\tstatic __GCObject*& __registerByRef\t(__GCObject*& ref);\r\n\r\n\t// Debug methods\r\n\t#ifdef _DEBUG_MEMORY_\r\n\t\tvoid _debug_displayReferences(u8 tabsNb = 0, u8 tabsOnFirstLine = 0);\r\n\t#endif\r\n};\r\n\r\nclass __GCMalloc : public __GCObject {\r\npublic:\r\n\tstatic void* allocBlock(u32 byteCount, __GCMalloc*& wrapper);\r\n\tvoid*\t\t getBlock()\t\t{ return &((u8*)this)[sizeof(__GCMalloc)];\t}\r\n\tvirtual\tu32\t _processGC\t()\t{ return COMPLETE;\t\t\t\t\t\t\t}\r\n\tvirtual void _releaseGC\t()\t{ /* Do nothing */\t\t\t\t\t\t\t}\r\n};\r\n\r\nclass __GCStruct {\r\npublic:\r\n\tvirtual\tu32\t\t_processGC\t() = 0;\r\n\tvirtual void*\t_RefSetValue(void* newStruct) = 0;\r\n\tvirtual void\t_moveAlert\t(u32 offset) = 0;\t\t// Must be called after moving a struct to update its pointers' references.\r\n\tvirtual void\t_releaseGC\t()\t= 0;\r\n};\r\n\r\n/* \r\n\tCOMPILER TODO \r\n\t1.Generate and called by destructor\r\n\tvoid _releaseGC() {\r\n\t\t...\r\n\t\t...\r\n\t\tif (m_memberA) { m_memberA->_removeRef(&m_memberA); }\r\n\t\t...\r\n\t\t...\r\n\t\tMemory::injectToDieList(this);\r\n\t}\r\n\r\n\t2.Call to _RefSetValue\r\n*/\r\n\r\n\r\n//----------------------------------------------------------------------------\r\n// Object Class\r\n//\r\n\r\n\tclass String;\r\n\tclass Type;\r\n\r\n#define _INSTANCEOF(curr, base)\tif (typeID == curr::_TYPEID) { return true; } else { return base::_isInstanceOf(typeID); }\r\n#define _CLASSOF(curr, base)\tif (typeID == curr::_TYPEID) { return true; } else { return base::_isClassOf(typeID); }\r\n\r\n\tclass Object : public __GCObject\r\n\t{\r\n\tprivate:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_OBJECT;\r\n\tpublic:\r\n\t\tvirtual bool\t_isInstanceOf\t(u32 typeID);\r\n\t\t\t\tbool \t_isInstanceOf$\t(u32 typeID);\r\n\t\tstatic\tbool\t_isClassOf\t\t(u32 typeID);\r\n\t\t\t\tbool\t_isClassOf$\t\t(u32 typeID);\r\n\t\tvirtual\tu32\t\t_processGC\t\t();\r\n\tpublic:\r\n        Object();\r\n\t\t~Object();\r\n\r\n\t\tvirtual\tbool\tEquals\t\t\t(Object* obj);\r\n\t\t\t\tbool\tEquals$\t\t\t(Object* obj);\r\n\t\tstatic\tbool\tEquals\t\t\t(Object* objA, Object* objB);\r\n\t\t\t\tbool\tEquals$\t\t\t(Object* objA, Object* objB);\r\n\t\tvirtual s32\t\tGetHashCode\t\t();\r\n\t\t\t\ts32\t\tGetHashCode$\t();\r\n\t\t/*Type* GetType();\tNot Supported for now, but should be in the future : allow data loader using reflection*/\r\n\t\t// This is NOT a correct definition, but it allows to use this method for debug in C#.\r\n\t\t\t\tString* GetType\t\t\t();\r\n\t\t\t\tString* GetType$\t\t();\r\n\t\tvirtual s32\t\tCompareTo\t\t(Object* obj); // Implementation of IComparable\r\n\t\t\t\ts32\t\tCompareTo$\t\t(Object* obj); // Implementation of IComparable\r\n\t\tstatic\tbool\tReferenceEquals\t(Object* objA, Object* objB);\r\n\t\t\t\tbool\tReferenceEquals$(Object* objA, Object* objB);\r\n\t\tvirtual String*\tToString\t\t();\r\n\t\t\t\tString*\tToString$\t\t();\r\n\tprotected:\r\n\t\t\r\n\t\t/*Object* MemberwiseClone();\tTo Support ? */\r\n\t};\r\n\t\r\n\ttypedef Object\tobject;\r\n\ttypedef Object*\tPObject;\r\n\r\n\t//\r\n\t// Exception macro and classes\r\n\t//\r\n\r\n\t//------------------------------------------------------------------------\r\n\t// Exception Mecanism V1.0\r\n\t// Based on the work from : http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html\r\n\t// Added global exception stack, allowing to have THROW outside of\r\n\t// TRY function.\r\n\t//------------------------------------------------------------------------\r\n\r\n\t//\r\n\t// Stack of 100 try catch.\r\n\t//\r\n\textern jmp_buf\t_g_excStack[100];\r\n\textern int\t\t_g_excDepth;\r\n\r\n\t//\r\n\t// Macro to handle jump context stack.\r\n\t//\r\n\t#define POPEXC\t\t\t(&System::_g_excStack[--System::_g_excDepth])\r\n\t#define PUSHEXC\t\t\t(&System::_g_excStack[System::_g_excDepth++])\r\n\t#define DELEXC\t\t\t(--System::_g_excDepth)\r\n\r\n\t//\r\n\t// Try-Catch-Finally-Throw creation macro.\r\n\t//\r\n\t// Minimum to use : \r\n\t// TRY\r\n\t// CTRY\r\n\t// ETRY\r\n\t//\r\n\t// If using a CATCH, you must end it with a FINALLY\r\n\t//\r\n\t#define THROW(x)\t\tlongjmp(*POPEXC, (u32)x)\r\n\t#define TRY\t\t\t\t{ jmp_buf* pBuf = PUSHEXC; System::Exception* exceptPtr = (System::Exception*)setjmp(*pBuf); if (exceptPtr == NULL) {\r\n\t#define CTRY\t\t\t  DELEXC; } else {\r\n\t#define FIRSTCATCH(x,y)\t    if (exceptPtr->_isInstanceOf(x::_TYPEID)) { x* y = (x*)exceptPtr;\r\n\t#define ELSECATCH(x,y)\t    } else if (exceptPtr->_isInstanceOf(x::_TYPEID)) { x* y = (x*)exceptPtr;\r\n\t#define FINALLY\t\t\t    }\r\n\t#define ETRY\t\t\t} }\r\n\t\r\n\t#define CHCKTHIS\t\tif (!this) { THROW(new System::NullReferenceException()); }\r\n\t#define THROWDIVZERO\tTHROW(new System::DivideByZeroException());\r\n\r\n\tclass Exception : public Object {\r\n\tprivate:\r\n\t\tString* m_message;\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_EXCEPTION;\r\n\tpublic:\r\n\t\tException();\r\n\t\t~Exception() { }\r\n\t\tException(String* msg);\r\n\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual\tu32\t\t_processGC\t\t\t();\r\n\t\tvirtual\tvoid\t_releaseGC\t\t\t();\r\n\t\tvirtual void\t_moveAlert\t\t\t(u32 offset);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t\tString*\t\t\t_acc_gMessage\t\t();\r\n\t\tString*\t\t\t_acc_gMessage$\t\t();\r\n\t\tString*\t\t\t_acc_gStackTrace\t();\r\n\t\tString*\t\t\t_acc_gStackTrace$\t();\r\n\t};\r\n\r\n\tclass SystemException : public Exception {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_SYSTEMEXCEPTION;\r\n\tpublic:\r\n\t\tSystemException\t\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~SystemException\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tSystemException\t\t\t\t\t\t(String* msg);\r\n\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass NullReferenceException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_NULLEXCEPTION;\r\n\tpublic:\r\n\t\tNullReferenceException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~NullReferenceException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tNullReferenceException\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass IndexOutOfRangeException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_INDEXOUTOFRANGEEXCEPTION;\r\n\tpublic:\r\n\t\tIndexOutOfRangeException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~IndexOutOfRangeException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tIndexOutOfRangeException\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass OutOfMemoryException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_OUTOFMEMORYEXCEPTION;\r\n\tpublic:\r\n\t\tOutOfMemoryException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~OutOfMemoryException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tOutOfMemoryException\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass ArgumentException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ARGUMENTEXCEPTION;\r\n\tpublic:\r\n\t\tArgumentException\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~ArgumentException\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tArgumentException\t\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass ArgumentOutOfRangeException : public ArgumentException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ARGUMENTOUTOFRANGEEXCEPTION;\r\n\tpublic:\r\n\t\tArgumentOutOfRangeException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~ArgumentOutOfRangeException\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tArgumentOutOfRangeException\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass ArgumentNullException : public ArgumentException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ARGUMENTNULLEXCEPTION;\r\n\tpublic:\r\n\t\tArgumentNullException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~ArgumentNullException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tArgumentNullException\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass RankException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_RANKEXCEPTION;\r\n\tpublic:\r\n\t\tRankException\t\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~RankException\t\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tRankException\t\t\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass InvalidOperationException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_INVALIDOPERATIONEXCEPTION;\r\n\tpublic:\r\n\t\tInvalidOperationException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~InvalidOperationException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tInvalidOperationException\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass ArrayTypeMismatchException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ARRAYTYPEMISMATCHEXCEPTION;\r\n\tpublic:\r\n\t\tArrayTypeMismatchException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~ArrayTypeMismatchException\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tArrayTypeMismatchException\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\tclass ArithmeticException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_ARITHMETICEXCEPTION;\r\n\tpublic:\r\n\t\tArithmeticException\t\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~ArithmeticException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tArithmeticException\t\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\t\r\n\tclass DivideByZeroException : public ArithmeticException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_DIVISIONBYZEROEXCEPTION;\r\n\tpublic:\r\n\t\tDivideByZeroException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\t~DivideByZeroException\t\t\t\t()\t\t\t\t\t\t\t{ }\r\n\t\tDivideByZeroException\t\t\t\t(String* msg);\r\n\t\t\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tbool\t\t\t_isInstanceOf$\t\t(u32 typeID);\r\n\t\tvirtual String* ToString\t\t\t();\r\n\t\tString*\t\t\tToString$\t\t\t();\r\n\t};\r\n\r\n\r\n\t// Internal Exceptions\r\n\r\n\tclass CppNotComparable : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_CPPNOTCOMPARABLEEXCEPTION;\r\n\tpublic:\r\n\t\tvirtual bool _isInstanceOf(u32 typeID);\r\n\t};\r\n\r\n\tclass CppException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_CPPEXCEPTION;\r\n\tpublic:\r\n\t\tvirtual bool _isInstanceOf(u32 typeID);\r\n\t};\r\n\r\n\tinline bool\t\tObject::_isInstanceOf$\t(u32 typeID)\t\t\t\t\t\t{ CHCKTHIS; return _isInstanceOf(typeID);\t\t}\r\n\tinline bool\t\tObject::_isClassOf$\t\t(u32 typeID)\t\t\t\t\t\t{ CHCKTHIS; return _isClassOf(typeID);\t\t\t}\r\n\tinline bool\t\tObject::Equals$\t\t\t(Object* obj)\t\t\t\t\t\t{ CHCKTHIS; return Equals(obj);\t\t\t\t\t}\r\n\tinline bool\t\tObject::Equals$\t\t\t(Object* objA, Object* objB)\t\t{ CHCKTHIS; return Equals(objA, objB);\t\t\t}\r\n\tinline s32\t\tObject::GetHashCode$\t()\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return GetHashCode();\t\t\t\t}\r\n\tinline s32\t\tObject::CompareTo$\t\t(Object* obj)\t\t\t\t\t\t{ CHCKTHIS; return CompareTo(obj);\t\t\t\t}\r\n\tinline bool\t\tObject::ReferenceEquals$(Object* objA, Object* objB)\t\t{ CHCKTHIS; return ReferenceEquals(objA,objB);\t}\r\n\tinline String*\tObject::ToString$\t\t()\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToString();\t\t\t\t\t}\r\n\tinline String*\tObject::GetType$\t\t()\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return GetType();\t\t\t\t\t}\r\n\r\n\tinline bool\t\tException::_isInstanceOf$\t\t\t\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tException::ToString$\t\t\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\tinline String*\tException::_acc_gMessage$\t\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->_acc_gMessage();\t\t}\r\n\tinline String*\tException::_acc_gStackTrace$\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->_acc_gStackTrace();\t}\r\n\r\n\tinline bool\t\tSystemException::_isInstanceOf$\t\t\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tSystemException::ToString$\t\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tIndexOutOfRangeException::_isInstanceOf$\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tIndexOutOfRangeException::ToString$\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tNullReferenceException::_isInstanceOf$\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tNullReferenceException::ToString$\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tOutOfMemoryException::_isInstanceOf$\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tOutOfMemoryException::ToString$\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tArgumentException::_isInstanceOf$\t\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tArgumentException::ToString$\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tArgumentOutOfRangeException::_isInstanceOf$\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tArgumentOutOfRangeException::ToString$\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tArgumentNullException::_isInstanceOf$\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tArgumentNullException::ToString$\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tRankException::_isInstanceOf$\t\t\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tRankException::ToString$\t\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline  bool\tInvalidOperationException::_isInstanceOf$\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tInvalidOperationException::ToString$\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tArrayTypeMismatchException::_isInstanceOf$\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tArrayTypeMismatchException::ToString$\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tArithmeticException::_isInstanceOf$\t\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tArithmeticException::ToString$\t\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\tinline bool\t\tDivideByZeroException::_isInstanceOf$\t\t(u32 typeID)\t{ CHCKTHIS; return this->_isInstanceOf(typeID); }\r\n\tinline String*\tDivideByZeroException::ToString$\t\t\t()\t\t\t\t{ CHCKTHIS; return this->ToString();\t\t\t}\r\n\r\n\r\n\tvoid* _as_(Object* ptr, u32 classID);\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_String.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_String.h\"\r\n#include \"CS_Array.h\"\r\n\r\n#include <memory.h>\r\n#include <cstdio>\r\n\r\nnamespace System {\r\n\r\n// --------------------------------------------------------\r\n// StringGlobalAllocator\r\n\r\n// static members\r\nuniChar*\t_x_StringGlobalAllocator::s_pBuffer\t\t\t= NULL;\r\nuniChar*\t_x_StringGlobalAllocator::s_pLastBegin\t\t= NULL;\r\nuniChar*\t_x_StringGlobalAllocator::s_pWarningZone\t= NULL;\r\nuniChar*\t_x_StringGlobalAllocator::s_pBufferEnd\t\t= NULL;\r\nString*\t\t_x_StringGlobalAllocator::s_userList\t\t= NULL;\r\n#ifdef _DEBUG_STRING_\r\nbool\t\t_x_StringGlobalAllocator::s_isBuilding\t\t= false;\r\n#endif\r\n\r\nbool _x_StringGlobalAllocator::init(u32 bufferSize) {\r\n\ts_pBuffer\t\t= (uniChar*)CS_MALLOC(sizeof(uniChar) * bufferSize);\r\n\ts_pLastBegin\t= s_pBuffer;\r\n\ts_pWarningZone\t= s_pBuffer + bufferSize - bufferSize * 10 / 100;\r\n\ts_pBufferEnd\t= s_pBuffer + bufferSize;\r\n#ifdef _DEBUG_STRING_\r\n\ts_isBuilding\t= false;\r\n#endif\r\n\r\n\treturn true;\r\n}\r\n\t\r\nuniChar* _x_StringGlobalAllocator::getStartPointer(u32 optionnalSize) {\r\n\tif(s_pLastBegin >= s_pWarningZone) {\r\n\t\t// TODO : garbageCollector();\r\n\t\tcompact();\r\n\t}\r\n\r\n\tif(optionnalSize == 0) {\r\n\t\treturn s_pLastBegin;\r\n\t} else {\r\n\t\treturn ((&s_pLastBegin[optionnalSize]) <= s_pBufferEnd) ? s_pLastBegin : NULL;\r\n\t}\r\n}\r\n\t\r\nuniChar* _x_StringGlobalAllocator::getLimitPointer() {\r\n\treturn s_pBufferEnd;\r\n}\r\n\t\r\nbool _x_StringGlobalAllocator::closeString(String* pString, uniChar* end) {\r\n\tCS_Assert(pString, \"null ptr\");\r\n\t\t\r\n\tif(end > s_pBufferEnd) {\r\n\t\t// With 0 default alloc size, String implementation MUST have checked.\r\n\t\tCS_AssertAlways(\"String implementation is incorrect, please fix it.\");\r\n\t\treturn false;\r\n\t} else {\r\n\t\tpString->m_stringBuffer\t= s_pLastBegin;\r\n\t\tpString->m_length\t\t= end - s_pLastBegin;\r\n\t\ts_pLastBegin\t\t\t= end;\r\n\t\tif(pString->m_length == 0) {\r\n\t\t\tpString->m_stringBuffer = NULL;\r\n\t\t}\r\n\r\n\t\t// Add the String to the list\r\n\t\tif(s_userList) {\r\n\t\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&pString->m_next, s_userList);\r\n\t\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&s_userList->m_prev, pString);\r\n\t\t}\r\n\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&s_userList, pString);\r\n\t\t\t\r\n\t\treturn true;\r\n\t}\r\n}\r\n\r\nbool _x_StringGlobalAllocator::compact() {\r\n\tString*\tpList = s_userList;\r\n\twhile (pList) {\r\n\t\tString* pListNext = pList->m_next;\r\n\t\tif(pList->copyStringFromAllocator()) {\r\n\t\t\tpList->disconnect();\t// Always return true in this case.\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tpList = pListNext;\r\n\t}\r\n\tSystem::__GCObject::_RefSetValue((__GCObject**)&s_userList, NULL);\r\n\ts_pLastBegin = s_pBuffer;\r\n\treturn true;\r\n}\r\n\t\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// String Constructors - Destructor\r\n\r\n// Private Constructors\r\n\r\nString::String(bool bUseAllocator)\r\n: m_next\t\t\t(NULL)\r\n, m_prev\t\t\t(NULL)\r\n, m_allocBuffer\t\t(NULL)\r\n, m_stringBuffer\t(NULL)\r\n, m_stringOffset\t(0)\r\n, m_tmpStringPtr\t(NULL)\r\n, m_pBufferOwner\t(NULL)\r\n, m_length\t\t\t(0)\r\n, m_bNotOwnBuffer\t(true)\r\n{\r\n\tif(bUseAllocator) {\r\n\t#ifdef _DEBUG_STRING_\r\n\t\tCS_Assert(!_x_StringGlobalAllocator::s_isBuilding, \"A String is already beeing built!\");\r\n\t\t_x_StringGlobalAllocator::s_isBuilding = true;\r\n\t#endif\r\n\r\n\t\t_x_StringGlobalAllocator::s_pLastBegin\t= _x_StringGlobalAllocator::getStartPointer();\r\n\t\tm_stringBuffer\t\t\t\t\t\t\t= _x_StringGlobalAllocator::s_pLastBegin;\r\n\t} else {\r\n\t\tm_bNotOwnBuffer = false;\r\n\t}\r\n}\r\n\r\nString::String(const uniChar* buffer, u32 size)\r\n: m_next\t\t\t\t(NULL)\r\n, m_prev\t\t\t\t(NULL)\r\n, m_allocBuffer\t\t\t(NULL)\r\n, m_allocBufferObject\t(NULL)\r\n, m_stringBuffer\t\t(buffer)\r\n, m_stringOffset\t\t(0)\r\n, m_tmpStringPtr\t\t(NULL)\r\n, m_pBufferOwner\t\t(NULL)\r\n, m_length\t\t\t\t(size)\r\n, m_bNotOwnBuffer\t\t(true)\r\n{\r\n\t\r\n}\r\n\r\n// Public Constructors\r\n\r\nString::String(System::Array<uniChar>* value, bool bUseAllocator)\r\n: m_next\t\t\t\t(NULL)\r\n, m_prev\t\t\t\t(NULL)\r\n, m_allocBuffer\t\t\t(NULL)\r\n, m_allocBufferObject\t(NULL)\r\n, m_stringBuffer\t\t(NULL)\r\n, m_stringOffset\t\t(0)\r\n, m_tmpStringPtr\t\t(NULL)\r\n, m_pBufferOwner\t\t(NULL)\r\n, m_length\t\t\t\t(0)\r\n, m_bNotOwnBuffer\t\t(true)\r\n{\r\n\tif(bUseAllocator) {\r\n\t\tif(value && (value->_acc_gLength() > 0)) {\r\n\t\t#ifdef _DEBUG_STRING_\r\n\t\t\tCS_Assert(!_x_StringGlobalAllocator::s_isBuilding, \"A String is already beeing built!\");\r\n\t\t\t_x_StringGlobalAllocator::s_isBuilding = true;\r\n\t\t#endif\r\n\r\n\t\t\t_x_StringGlobalAllocator::s_pLastBegin = _x_StringGlobalAllocator::getStartPointer();\r\n\t\t\tm_stringBuffer = _x_StringGlobalAllocator::s_pLastBegin;\r\n\t\t\tmemcpy((uniChar*)m_stringBuffer, (uniChar*)value->_getPArray(), value->_acc_gLength() * sizeof(uniChar));\r\n\t\t\tm_length = value->_acc_gLength();\r\n\t\t\t_appendClose();\r\n\t\t}\r\n\t} else {\r\n\t\tm_length = value->_acc_gLength();\r\n\t\tm_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * m_length, m_allocBufferObject);\r\n\t\tm_allocBufferObject->_addOwner(this);\r\n\t\tm_stringBuffer = m_allocBuffer;\r\n\t\tmemcpy((uniChar*)m_stringBuffer, (uniChar*)value->_getPArray(), value->_acc_gLength() * sizeof(uniChar));\r\n\t\tm_bNotOwnBuffer = false;\r\n\t}\r\n}\r\n\r\nString::String(uniChar c, s32 count, bool bUseAllocator)\r\n: m_next\t\t\t\t(NULL)\r\n, m_prev\t\t\t\t(NULL)\r\n, m_allocBuffer\t\t\t(NULL)\r\n, m_allocBufferObject\t(NULL)\r\n, m_stringBuffer\t\t(NULL)\r\n, m_stringOffset\t\t(0)\r\n, m_tmpStringPtr\t\t(NULL)\r\n, m_pBufferOwner\t\t(NULL)\r\n, m_bNotOwnBuffer\t\t(true)\r\n{\r\n\tif(count < 0) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tif(bUseAllocator) {\r\n\t#ifdef _DEBUG_STRING_\r\n\t\tCS_Assert(!_x_StringGlobalAllocator::s_isBuilding, \"A String is already beeing built!\");\r\n\t\t_x_StringGlobalAllocator::s_isBuilding = true;\r\n\t#endif\r\n\r\n\t\tm_stringBuffer\t= _x_StringGlobalAllocator::getStartPointer();\r\n\t\tm_length\t\t= count;\r\n\t\t_x_StringGlobalAllocator::s_pLastBegin = _x_StringGlobalAllocator::getStartPointer();\r\n\t\tmemset16((uniChar*)m_stringBuffer, c, sizeof(uniChar) * count);\r\n\t\t_appendClose();\r\n\t} else {\r\n\t\tm_length = count;\r\n\t\tm_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * m_length, m_allocBufferObject);\r\n\t\tm_allocBufferObject->_addOwner(this);\r\n\t\tm_stringBuffer = m_allocBuffer;\r\n\t\tmemset16((uniChar*)m_stringBuffer, c, sizeof(uniChar) * count);\r\n\t\tm_bNotOwnBuffer = false;\r\n\t}\r\n}\r\n\r\nString::String(const uniChar* value, s32 startIndex, s32 length) \r\n: m_next\t\t\t\t(NULL)\r\n, m_prev\t\t\t\t(NULL)\r\n, m_allocBuffer\t\t\t(NULL)\r\n, m_allocBufferObject\t(NULL)\r\n, m_stringBuffer\t\t((uniChar*)value + startIndex)\r\n, m_stringOffset\t\t(0)\r\n, m_tmpStringPtr\t\t(NULL)\r\n, m_pBufferOwner\t\t(NULL)\r\n, m_length\t\t\t\t(length)\r\n, m_bNotOwnBuffer\t\t(true)\r\n{\r\n\r\n}\r\n\r\nString::String(System::Array<uniChar>* value, s32 startIndex, s32 length, bool bUseAllocator)\r\n: m_next\t\t\t\t(NULL)\r\n, m_prev\t\t\t\t(NULL)\r\n, m_allocBuffer\t\t\t(NULL)\r\n, m_allocBufferObject\t(NULL)\r\n, m_stringBuffer\t\t(NULL)\r\n, m_stringOffset\t\t(0)\r\n, m_tmpStringPtr\t\t(NULL)\r\n, m_pBufferOwner\t\t(NULL)\r\n, m_length\t\t\t\t(0)\r\n, m_bNotOwnBuffer\t\t(true)\r\n{\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif(((startIndex | length) < 0) || ((startIndex + length) > value->_acc_gLength())) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tif(bUseAllocator) {\r\n\t\t#ifdef _DEBUG_STRING_\r\n\t\t\tCS_Assert(!_x_StringGlobalAllocator::s_isBuilding, \"A String is already beeing built!\");\r\n\t\t\t_x_StringGlobalAllocator::s_isBuilding = true;\r\n\t\t#endif\r\n\r\n\t\t_x_StringGlobalAllocator::s_pLastBegin = _x_StringGlobalAllocator::getStartPointer();\r\n\t\tm_stringBuffer = _x_StringGlobalAllocator::s_pLastBegin;\r\n\t\tmemcpy((uniChar*)m_stringBuffer, (uniChar*)value->_getPArray() + startIndex, length * sizeof(uniChar));\r\n\t\tm_length = length;\r\n\t\t_appendClose();\r\n\t} else {\r\n\t\tm_length = length;\r\n\t\tm_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * m_length, m_allocBufferObject);\r\n\t\tm_allocBufferObject->_addOwner(this);\r\n\t\tm_stringBuffer = m_allocBuffer;\r\n\t\tmemcpy((uniChar*)m_stringBuffer, (uniChar*)value->_getPArray() + startIndex, length * sizeof(uniChar));\r\n\t\tm_bNotOwnBuffer = false;\r\n\t}\r\n}\r\n\r\n// Destructor\r\nString::~String() {\r\n\t_releaseGC();\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// Virtual methods\r\n\r\n/*virtual*/\r\nu32 String::_processGC() {\r\n\tif(m_pBufferOwner) \t\t{ Memory::pushList(m_pBufferOwner, 0);\t\t}\r\n\tif(m_allocBufferObject)\t{ Memory::pushList(m_allocBufferObject, 0);\t}\r\n\tif(m_next)\t\t\t\t{ Memory::pushList(m_next, 0);\t\t\t\t}\r\n\tif(m_prev)\t\t\t\t{ Memory::pushList(m_prev, 0);\t\t\t\t}\r\n\treturn COMPLETE;\r\n}\r\n\r\n/*virtual*/\r\nbool String::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(String,Object);\r\n};\r\n\r\n/*virtual*/\r\nvoid String::_move(__GCObject* prevobj, __GCObject* newobj) {\r\n\tif((__GCObject*)m_allocBufferObject == prevobj) {\r\n\t\tm_allocBufferObject = (__GCMalloc*)newobj;\r\n\t\tm_allocBuffer = (uniChar*)m_allocBufferObject->getBlock();\r\n\t\tm_stringBuffer = m_allocBuffer;\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid String::_releaseGC() {\r\n\tif(m_bNotOwnBuffer && m_pBufferOwner && !m_pBufferOwner->isFreed()) {\r\n\t\tm_pBufferOwner->_removeRef((__GCObject**)&m_pBufferOwner);\r\n\t}\r\n\tif((!disconnect()) && m_allocBufferObject && !m_allocBufferObject->isFreed()) {\r\n\t\tm_allocBufferObject->_removeOwner(this);\r\n\t}\r\n\tif(m_next && !m_next->isFreed()) {\r\n\t\tm_next->_removeRef((__GCObject**)&m_next);\r\n\t}\r\n\tif(m_prev && !m_prev->isFreed()) {\r\n\t\tm_prev->_removeRef((__GCObject**)&m_prev);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid String::_moveAlert(u32 offset) {\r\n\tObject::_moveAlert(offset);\r\n\tif(m_pBufferOwner)\t{ m_pBufferOwner->_moveRef((__GCObject**)((u8*)&m_pBufferOwner - offset), (__GCObject**)&m_pBufferOwner); }\r\n\tif(m_next)\t\t\t{ m_next->_moveRef((__GCObject**)((u8*)&m_next - offset), (__GCObject**)&m_next); }\r\n\tif(m_prev)\t\t\t{ m_prev->_moveRef((__GCObject**)((u8*)&m_prev - offset), (__GCObject**)&m_prev); }\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// Internal methods\r\n\r\nbool String::disconnect() {\r\n\tbool ret = true;\r\n\t\t\r\n\tif((!m_next) && (!m_prev)) {\r\n\t\tif(_x_StringGlobalAllocator::s_userList == this) {\r\n\t\t\t// Only String in the allocator.\r\n\t\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&_x_StringGlobalAllocator::s_userList, NULL);\r\n\t\t} else {\r\n\t\t\t// Stand alone string, do nothing.\r\n\t\t\tret = false;\r\n\t\t}\r\n\t} else {\r\n\t\tif(m_prev) {\r\n\t\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&m_prev->m_next, this->m_next);\r\n\t\t} else {\r\n\t\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&_x_StringGlobalAllocator::s_userList, this->m_next);\r\n\t\t}\r\n\t\t\t\r\n\t\tif(m_next) {\r\n\t\t\tSystem::__GCObject::_RefSetValue((__GCObject**)&m_next->m_prev, this->m_prev);\r\n\t\t}\r\n\t}\r\n\tif(m_next) { System::__GCObject::_RefSetValue((__GCObject**)&m_next, NULL); }\r\n\tif(m_prev) { System::__GCObject::_RefSetValue((__GCObject**)&m_prev, NULL); }\r\n\treturn ret;\r\n}\r\n\r\nbool String::copyStringFromAllocator() {\r\n\tif(m_length) {\r\n\t\tm_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * m_length, m_allocBufferObject);\r\n\t\tm_allocBufferObject->_addOwner(this);\r\n\r\n        if(!m_allocBuffer) {\r\n            return false;\r\n        }\r\n\t\tmemcpy((uniChar*)m_allocBuffer, _getStringBuffer(), m_length * sizeof(uniChar));\r\n\t} else {\r\n\t\tm_allocBuffer = NULL;\r\n\t}\r\n    \r\n    m_stringBuffer\t= m_allocBuffer;\r\n    m_bNotOwnBuffer = false;\r\n\tm_pBufferOwner\t= NULL;\r\n\treturn true;\r\n}\r\n\r\nstatic const uniChar _str_$_null[]  = { 'n','u','l','l'\t\t};\t// 4\r\nstatic const uniChar _str_$_true[]  = { 'T','r','u','e'\t\t};\t// 4\r\nstatic const uniChar _str_$_false[] = { 'F','a','l','s','e' };\t// 5\r\nstatic const uniChar _str_toUpperArray[] =\t\t{ 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x039C, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00F7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x0178, 0x0100, 0x0100, 0x0102, 0x0102, 0x0104, 0x0104, 0x0106, 0x0106, 0x0108, 0x0108, 0x010A, 0x010A, 0x010C, 0x010C, 0x010E, 0x010E, 0x0110, 0x0110, 0x0112, 0x0112, 0x0114, 0x0114, 0x0116, 0x0116, 0x0118, 0x0118, 0x011A, 0x011A, 0x011C, 0x011C, 0x011E, 0x011E, 0x0120, 0x0120, 0x0122, 0x0122, 0x0124, 0x0124, 0x0126, 0x0126, 0x0128, 0x0128, 0x012A, 0x012A, 0x012C, 0x012C, 0x012E, 0x012E, 0x0130, 0x0049, 0x0132, 0x0132, 0x0134, 0x0134, 0x0136, 0x0136, 0x0138, 0x0139, 0x0139, 0x013B, 0x013B, 0x013D, 0x013D, 0x013F, 0x013F, 0x0141, 0x0141, 0x0143, 0x0143, 0x0145, 0x0145, 0x0147, 0x0147, 0x0149, 0x014A, 0x014A, 0x014C, 0x014C, 0x014E, 0x014E, 0x0150, 0x0150, 0x0152, 0x0152, 0x0154, 0x0154, 0x0156, 0x0156, 0x0158, 0x0158, 0x015A, 0x015A, 0x015C, 0x015C, 0x015E, 0x015E, 0x0160, 0x0160, 0x0162, 0x0162, 0x0164, 0x0164, 0x0166, 0x0166, 0x0168, 0x0168, 0x016A, 0x016A, 0x016C, 0x016C, 0x016E, 0x016E, 0x0170, 0x0170, 0x0172, 0x0172, 0x0174, 0x0174, 0x0176, 0x0176, 0x0178, 0x0179, 0x0179, 0x017B, 0x017B, 0x017D, 0x017D, 0x0053 };\r\nstatic const uniChar _str_toLowerArray[] =\t\t{ 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00D7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0101, 0x0101, 0x0103, 0x0103, 0x0105, 0x0105, 0x0107, 0x0107, 0x0109, 0x0109, 0x010B, 0x010B, 0x010D, 0x010D, 0x010F, 0x010F, 0x0111, 0x0111, 0x0113, 0x0113, 0x0115, 0x0115, 0x0117, 0x0117, 0x0119, 0x0119, 0x011B, 0x011B, 0x011D, 0x011D, 0x011F, 0x011F, 0x0121, 0x0121, 0x0123, 0x0123, 0x0125, 0x0125, 0x0127, 0x0127, 0x0129, 0x0129, 0x012B, 0x012B, 0x012D, 0x012D, 0x012F, 0x012F, 0x0069, 0x0131, 0x0133, 0x0133, 0x0135, 0x0135, 0x0137, 0x0137, 0x0138, 0x013A, 0x013A, 0x013C, 0x013C, 0x013E, 0x013E, 0x0140, 0x0140, 0x0142, 0x0142, 0x0144, 0x0144, 0x0146, 0x0146, 0x0148, 0x0148, 0x0149, 0x014B, 0x014B, 0x014D, 0x014D, 0x014F, 0x014F, 0x0151, 0x0151, 0x0153, 0x0153, 0x0155, 0x0155, 0x0157, 0x0157, 0x0159, 0x0159, 0x015B, 0x015B, 0x015D, 0x015D, 0x015F, 0x015F, 0x0161, 0x0161, 0x0163, 0x0163, 0x0165, 0x0165, 0x0167, 0x0167, 0x0169, 0x0169, 0x016B, 0x016B, 0x016D, 0x016D, 0x016F, 0x016F, 0x0171, 0x0171, 0x0173, 0x0173, 0x0175, 0x0175, 0x0177, 0x0177, 0x00FF, 0x017A, 0x017A, 0x017C, 0x017C, 0x017E };\r\nstatic const uniChar _str_whiteSpaceArray[] =\t{ 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, 0x3000 };\r\nstatic const System::Array<uniChar>* _str_whiteSpaceSystemArray = NULL;\r\n\r\n/* Switch to faster algorithm*/\r\n\r\nint String::_leftSearch(String* source, String* pattern, s32 startSearch, s32 searchCount) {\r\n\t// Negative search count or startSearch = search space smaller than pattern length !\r\n\tif((searchCount | startSearch) < 0) {\r\n\t\treturn -1;\r\n\t}\r\n\r\n\tconst uniChar* pSrc\t\t= source->_getStringBuffer() + startSearch;\r\n\tconst uniChar* pESrc\t= pSrc + searchCount;\r\n\tconst uniChar* pDstO\t= pattern->_getStringBuffer();\r\n\tconst uniChar* pDstE\t= pDstO + pattern->m_length;\r\n\r\n\twhile (pSrc < pESrc) {\r\n\t\tconst uniChar* pSrcLocal\t= pSrc;\r\n\t\tconst uniChar* pDst\t\t\t= pDstO;\r\n\t\twhile (pDst < pDstE) {\r\n\t\t\tif((*pDst) != (*pSrcLocal++)) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpDst++;\r\n\t\t}\r\n\r\n\t\tif(pDst == pDstE) {\r\n\t\t\treturn pSrc - source->_getStringBuffer();\r\n\t\t}\r\n\t\tpSrc++;\r\n\t}\r\n\r\n\treturn -1;\r\n}\r\n\r\nint String::_rightSearch(String* source, String* pattern, s32 startSearch, s32 searchCount) {\r\n\t// Negative search count or startSearch = search space smaller than pattern length !\r\n\tif((searchCount | startSearch) < 0) {\r\n\t\treturn -1;\r\n\t}\r\n\tif(searchCount > startSearch) {\r\n\t\tsearchCount = startSearch;\r\n\t}\r\n\r\n\tconst uniChar* pSrc\t\t= source->_getStringBuffer() + startSearch;\r\n\tconst uniChar* pESrc\t= source->_getStringBuffer() + startSearch - searchCount -1;\r\n\tconst uniChar* pDstO\t= pattern->_getStringBuffer();\r\n\tconst uniChar* pDstE\t= pDstO + pattern->m_length;\r\n\r\n\twhile(pSrc > pESrc) {\r\n\t\tconst uniChar* pSrcLocal\t= pSrc;\r\n\t\tconst uniChar* pDst\t\t\t= pDstO;\r\n\t\twhile(pDst < pDstE) {\r\n\t\t\tif((*pDst) != (*pSrcLocal++)) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpDst++;\r\n\t\t}\r\n\r\n\t\tif(pDst == pDstE) {\r\n\t\t\treturn pSrc - source->_getStringBuffer();\r\n\t\t}\r\n\t\tpSrc--;\r\n\t}\r\n\r\n\treturn -1;\r\n}\r\n\r\nint String::_leftSearchAny(String* source, Array<uniChar>* array_, s32 startSearch, s32 searchCount) {\r\n\t// Negative search count or startSearch = search space smalled than pattern length !\r\n\tif((searchCount | startSearch) < 0) {\r\n\t\treturn -1;\r\n\t}\r\n\r\n\tconst uniChar* pSrc\t\t= source->_getStringBuffer() + startSearch;\r\n\tconst uniChar* pESrc\t= pSrc + searchCount;\r\n\tconst uniChar* pDstO\t= &array_->_idx_g_0based(0);\r\n\tconst uniChar* pDstE\t= pDstO + array_->_acc_gLength();\r\n\r\n\twhile (pSrc < pESrc) {\r\n\t\tconst uniChar* pDst\t= pDstO;\r\n\t\twhile (pDst < pDstE) {\r\n\t\t\tif((*pDst) == (*pSrc)) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpDst++;\r\n\t\t}\r\n\r\n\t\tif(pDst != pDstE) {\r\n\t\t\treturn pSrc - source->_getStringBuffer();\r\n\t\t}\r\n\r\n\t\tpSrc++;\r\n\t}\r\n\r\n\treturn -1;\r\n}\r\n\r\nint String::_rightSearchAny(String* source, Array<uniChar>* array_, s32 startSearch, s32 searchCount) {\r\n\t// Negative search count or startSearch = search space smalled than pattern length !\r\n\tif((searchCount | startSearch) < 0) {\r\n\t\treturn -1;\r\n\t}\r\n\tif(searchCount > startSearch) {\r\n\t\tsearchCount = startSearch;\r\n\t}\r\n\r\n\tconst uniChar* pSrc\t\t= source->_getStringBuffer() + startSearch;\r\n\tconst uniChar* pESrc\t= source->_getStringBuffer() + startSearch - searchCount -1;\r\n\tconst uniChar* pDstO\t= &array_->_idx_g_0based(0);\r\n\tconst uniChar* pDstE\t= pDstO + array_->_acc_gLength();\r\n\r\n\twhile (pSrc > pESrc) {\r\n\t\tconst uniChar* pDst\t= pDstO;\r\n\t\twhile (pDst < pDstE) {\r\n\t\t\tif((*pDst) == (*pSrc)) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpDst++;\r\n\t\t}\r\n\r\n\t\tif(pDst != pDstE) {\r\n\t\t\treturn pSrc - source->_getStringBuffer();\r\n\t\t}\r\n\r\n\t\tpSrc--;\r\n\t}\r\n\r\n\treturn -1;\r\n}\r\n\r\nvoid asciiToUnicode16(u8* pSrc, u32 len, uniChar* pDst) {\r\n\tu8* pSrcE = &pSrc[len];\r\n\twhile (pSrc != pSrcE) {\r\n\t\t*pDst++ = *pSrc++;\r\n\t}\r\n}\r\n\r\nconst uniChar* String::_getStringBuffer() const {\r\n\tif(m_bNotOwnBuffer) {\r\n\t\tif(m_pBufferOwner) {\r\n\t\t\treturn m_pBufferOwner->m_stringBuffer + m_stringOffset;\r\n\t\t}\r\n\t}\r\n\treturn m_stringBuffer;\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// Properties\r\n\r\ns32 String::_acc_gLength() {\r\n\treturn m_length;\r\n}\r\n\r\nconst uniChar& String::operator[](s32 index) const  {\r\n\tCHCKTHIS;\r\n\tif((u32)index >= m_length) { THROW(CS_NEW IndexOutOfRangeException()); }\r\n\treturn *(_getStringBuffer() + index);\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// Operator Overload\r\n\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// Static\r\n/*static*/ // See String::init() function for initialization.\r\nString* String::Empty = NULL;\r\n\r\n/*static*/\r\ns32 String::Compare(String* strA, String* strB) {\r\n\tif(strA == strB) {\r\n\t\treturn 0;\t\t// Same pointer, same string. Valid for null.\r\n\t} else {\r\n\t\tif(!strA) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tif(!strB) {\r\n\t\t\treturn +1;\r\n\t\t}\r\n\r\n\t\tconst uniChar* aBuff = strA->_getStringBuffer();\r\n\t\tconst uniChar* bBuff = strB->_getStringBuffer();\r\n\t\tu32 lenA\t\t= strA->m_length;\r\n\t\tu32 lenB\t\t= strB->m_length;\r\n\t\tu32 parseLen\t= lenA < lenB ? lenA : lenB;\r\n\t\tu32 parseNow\t= 0;\r\n\t\twhile (parseNow != parseLen) {\r\n\t\t\tuniChar a = *aBuff++;\r\n\t\t\tuniChar b = *bBuff++;\r\n\r\n\t\t\t// Without any CompareOptions C# will consider a lower case character is before its upper character.\r\n\t\t\tif((a >= 0x0061 && a <= 0x017E) && b == _str_toUpperArray[a-0x0061]) {\r\n\t\t\t\treturn -1;\r\n\t\t\t} else if((b >= 0x0061 && b <= 0x017E) && a == _str_toUpperArray[b-0x0061]) {\r\n\t\t\t\treturn 1;\r\n\t\t\t} else {\r\n\t\t\t\tif(a < b) { return -1; }\r\n\t\t\t\tif(a > b) { return +1; }\r\n\t\t\t}\r\n\t\t\tparseNow++;\r\n\t\t}\r\n\r\n\t\t// Reached last char of shortest string.\r\n\t\tif(parseNow < lenA) { return 1;  }\r\n\t\tif(parseNow < lenB) { return -1; }\r\n\r\n\t\t// Both size were equal and content is the same.\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\n/*static*/\r\ns32 String::Compare(String* strA, String* strB, bool ignoreCase) {\r\n\tif(ignoreCase == false) {\r\n\t\treturn Compare(strA, strB);\r\n\t}\r\n\r\n\tif(strA == strB) {\r\n\t\treturn 0;\t\t// Same pointer, same string. Valid for null.\r\n\t} else {\r\n\t\tif(!strA) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tif(!strB) {\r\n\t\t\treturn +1;\r\n\t\t}\r\n\r\n\t\tconst uniChar* aBuff = strA->_getStringBuffer();\r\n\t\tconst uniChar* bBuff = strB->_getStringBuffer();\r\n\t\tu32 lenA\t\t= strA->m_length;\r\n\t\tu32 lenB\t\t= strB->m_length;\r\n\t\tu32 parseLen\t= lenA < lenB ? lenA : lenB;\r\n\t\tu32 parseNow\t= 0;\r\n\t\twhile (parseNow != parseLen) {\r\n\t\t\tuniChar a = *aBuff++;\r\n\t\t\tuniChar b = *bBuff++;\r\n\t\t\t\r\n\t\t\t// to lower case\r\n\t\t\tif(a >= 0x0041 && a <= 0x017D) { a = _str_toLowerArray[a-0x0041]; }\r\n\t\t\tif(b >= 0x0041 && b <= 0x017D) { b = _str_toLowerArray[b-0x0041]; }\t\t\t\r\n\r\n\t\t\tif(a < b) { return -1; }\r\n\t\t\tif(a > b) { return +1; }\r\n\t\t\tparseNow++;\r\n\t\t}\r\n\r\n\t\t// Reached last char of shortest string.\r\n\t\tif(parseNow < lenA) { return 1;  }\r\n\t\tif(parseNow < lenB) { return -1; }\r\n\r\n\t\t// Both size were equal and content is the same.\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\nString* String::Concat(Object* obj) {\r\n\treturn obj->ToString();\r\n}\r\n\r\nString* String::Concat(/*params*/ Array<Object*>* args) {\r\n\tif(!args)\t{ THROW(CS_NEW ArgumentNullException()); }\r\n\t\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* pS = CS_NEW String(false);\r\n\tif(!pS)\t\t{ THROW(CS_NEW OutOfMemoryException()); }\r\n\r\n\tfor(int n=0; n < args->_acc_gLength(); n++) {\r\n\t\tif(args->_idx_g(n)) {\r\n\t\t\tpS->m_length += args->_idx_g(n)->ToString()->_acc_gLength();\r\n\t\t}\r\n\t}\r\n\r\n\tpS->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * pS->m_length, pS->m_allocBufferObject);\r\n\tpS->m_allocBufferObject->_addOwner(pS);\r\n\tpS->m_stringBuffer = pS->m_allocBuffer;\r\n\t// [ToRemove] - end\r\n\r\n\tu32 currentLen = 0;\r\n\tfor(int n=0; n < args->_acc_gLength(); n++) {\r\n\t\tObject* obj = args->_idx_g(n);\r\n\t\tif(obj) {\r\n\t\t\t// uses allocator\r\n\t\t\t//pS->_appendStr(obj->ToString());\r\n\t\t\tString* strObj = obj->ToString();\r\n\t\t\tmemcpy((uniChar*)pS->m_stringBuffer + currentLen, strObj->_getStringBuffer(), strObj->m_length * sizeof(uniChar));\r\n\t\t\tcurrentLen += strObj->m_length;\r\n\t\t}\r\n\r\n\t}\r\n\t\r\n\t// uses allocator\r\n\t//return pS->_appendClose();\r\n\treturn pS;\r\n}\r\n\r\nString* String::Concat(/*params*/ Array<String*>* values) {\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* pS = CS_NEW String(false);\r\n\tif(!pS)\t\t{ THROW(CS_NEW OutOfMemoryException()); }\r\n\r\n\tfor(int n=0; n < values->_acc_gLength(); n++) {\r\n\t\tif(values->_idx_g(n)) {\r\n\t\t\tpS->m_length += values->_idx_g(n)->_acc_gLength();\r\n\t\t}\r\n\t}\r\n\r\n\tpS->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * pS->m_length, pS->m_allocBufferObject);\r\n\tpS->m_allocBufferObject->_addOwner(pS);\r\n\tpS->m_stringBuffer = pS->m_allocBuffer;\r\n\t// [ToRemove] - end\r\n\r\n\tu32 currentLen = 0;\r\n\tfor(int n=0; n < values->_acc_gLength(); n++) {\r\n\t\tString* str = values->_idx_g(n);\r\n\t\tif(str) {\r\n\t\t\t// uses allocator\r\n\t\t\t//pS->_appendStr(str);\r\n\t\t\tmemcpy((uniChar*)pS->m_stringBuffer + currentLen, str->_getStringBuffer(), str->m_length * sizeof(uniChar));\r\n\t\t\tcurrentLen += str->m_length;\r\n\t\t}\r\n\t}\r\n\t// uses allocator\r\n\t//return pS->_appendClose();\r\n\treturn pS;\r\n}\r\n\r\nString* String::Copy(String* str) {\r\n\t// Must create a new String object but content pointer can be the same.\r\n\tString* newStr = CS_NEW String(false);\r\n\tif(!newStr) THROW(CS_NEW OutOfMemoryException());\r\n\tnewStr->m_length\t\t= str->m_length;\r\n\tnewStr->m_stringBuffer\t= str->m_stringBuffer;\r\n\tnewStr->m_stringOffset\t= str->m_stringOffset;\r\n    newStr->m_bNotOwnBuffer\t= true;\r\n    newStr->m_pBufferOwner\t= str;\r\n    str->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\treturn newStr;\r\n}\r\n\r\nbool String::Equals(String* a, String* b) {\r\n\treturn (Compare(a, b) == 0);\r\n}\r\n\r\n/*x*/\tstatic String* Format(String* format, Object* arg0);\r\n/*x*/\tstatic String* Format(String* format, /*params*/ Array<Object*>* args);\r\n\r\nbool String::IsNullOrEmpty(String* value) {\r\n\treturn value ? (value->m_length == 0) : true;\r\n}\r\n\r\n/*static*/\r\nString* String::Join(String* separator, Array<String*>* value) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\r\n\tif(!separator) { return String::Join(String::Empty, value); }\r\n\r\n\tString* newStr\t= CS_NEW String(false);\r\n\tif(!newStr) THROW(CS_NEW OutOfMemoryException());\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tfor(int i = 0; i < value->_acc_gLength(); ++i) {\r\n\t\tnewStr->m_length += value->_idx_g(i)->_acc_gLength();\r\n\t}\r\n\tif(value->_acc_gLength() > 0) {\r\n\t\tnewStr->m_length += separator->m_length * (value->_acc_gLength() - 1);\r\n\t}\r\n\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\tnewStr->m_bNotOwnBuffer = false;\r\n\t// [ToRemove] - end\r\n\r\n\tu32 currentLen = 0;\r\n\tfor(int i = 0; i < value->_acc_gLength() - 1; ++i) {\r\n\t\t// uses Allocator\r\n\t\t//newStr->_appendStr(value->_idx_g(i))->_appendStr(separator);\r\n\t\tmemcpy((uniChar*)newStr->m_stringBuffer + currentLen, value->_idx_g(i)->_getStringBuffer(), value->_idx_g(i)->m_length * sizeof(uniChar));\r\n\t\tcurrentLen += value->_idx_g(i)->m_length;\r\n\t\tmemcpy((uniChar*)newStr->m_stringBuffer + currentLen, separator->_getStringBuffer(), separator->m_length * sizeof(uniChar));\r\n\t\tcurrentLen += separator->m_length;\r\n\t}\r\n\r\n\t// uses Allocator\r\n\t//return newStr->_appendStr(value->_idx_g(value->_acc_gLength() - 1))->_appendClose();\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer + currentLen, value->_idx_g(value->_acc_gLength() - 1)->_getStringBuffer(), value->_idx_g(value->_acc_gLength() - 1)->m_length * sizeof(uniChar));\r\n\treturn newStr;\r\n}\r\n\r\n/*static*/\r\nString* String::Join(String* separator, Array<String*>* value, s32 startIndex, s32 count) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif((startIndex < 0) || (count < 0) || (startIndex + count) > value->_acc_gLength()) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tif(!separator) { return String::Join(String::Empty, value, startIndex, count); }\r\n\r\n\tString* newStr = CS_NEW String(false);\r\n\tif(!newStr) { THROW(CS_NEW OutOfMemoryException()); }\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tfor(int i = startIndex; i < startIndex + count; ++i) {\r\n\t\tnewStr->m_length += value->_idx_g(i)->_acc_gLength();\r\n\t}\r\n\tif(value->_acc_gLength() > 0) {\r\n\t\tnewStr->m_length += separator->m_length * (count - 1);\r\n\t}\r\n\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\tnewStr->m_bNotOwnBuffer = false;\r\n\t// [ToRemove] - end\r\n\r\n\tu32 currentLen = 0;\r\n\tfor(int i = startIndex; i < startIndex + count - 1; ++i) {\r\n\t\t// uses Allocator\r\n\t\t//newStr->_appendStr(value->_idx_g(i))->_appendStr(separator);\r\n\t\tmemcpy((uniChar*)newStr->m_stringBuffer + currentLen, value->_idx_g(i)->_getStringBuffer(), value->_idx_g(i)->m_length * sizeof(uniChar));\r\n\t\tcurrentLen += value->_idx_g(i)->m_length;\r\n\t\tmemcpy((uniChar*)newStr->m_stringBuffer + currentLen, separator->_getStringBuffer(), separator->m_length * sizeof(uniChar));\r\n\t\tcurrentLen += separator->m_length;\r\n\t}\r\n\t\r\n\t// uses Allocator\r\n\t//return newStr->_appendStr(value->_idx_g(startIndex + count - 1))->_appendClose();\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer + currentLen, value->_idx_g(startIndex + count - 1)->_getStringBuffer(), value->_idx_g(startIndex + count - 1)->m_length * sizeof(uniChar));\r\n\treturn newStr;\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// Public methods\r\n\r\nObject* String::Clone() {\r\n\treturn (Object*)this;\r\n}\r\n\r\ns32 String::CompareTo(Object* value) {\r\n\tif(!value->_isInstanceOf(_TYPE_STRING)) {\r\n\t\tTHROW(CS_NEW ArgumentException());\r\n\t}\r\n\treturn Compare(this, (value ? value->ToString() : NULL));\r\n}\r\n\r\ns32 String::CompareTo(String* strB) {\r\n\treturn String::Compare(this, strB);\r\n}\r\n\r\nbool String::Contains(String* value) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t// Cheap trick : no way that value can fit into this string.\r\n\tif(value->m_length > this->m_length) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn (_leftSearch(this, value, 0, (this->m_length - value->m_length) + 1) != -1);\r\n}\r\n\r\nvoid String::CopyTo(s32 sourceIndex, Array<uniChar>* destination, s32 destinationIndex, s32 count) {\r\n\tif(!destination) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif(((sourceIndex | destinationIndex | count) < 0) || ((u32)(sourceIndex + count) > m_length) || (destinationIndex + count > destination->_acc_gLength())) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tmemcpy((u8*)(destination->_getPArray()) + destinationIndex * sizeof(uniChar), _getStringBuffer() + sourceIndex, count * sizeof(uniChar));\r\n}\r\n\r\nbool String::EndsWith(String* value) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\treturn (_leftSearch(this, value, (m_length - value->m_length), 1) != -1);\r\n}\r\n\r\nbool String::Equals(Object* obj) {\r\n\tif(!obj) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(!obj->_isInstanceOf(_TYPE_STRING)) {\r\n\t\treturn false;\r\n\t}\r\n\treturn Equals(obj->ToString());\r\n}\r\n\r\nbool String::Equals(String* value) {\r\n\treturn (Compare(this, value) == 0);\r\n}\r\n\r\ns32 String::GetHashCode() {\r\n\t/*\r\n\tconst uniChar* chPtr = this->_getStringBuffer();\r\n\tint num = 352654597;\r\n\tint num2 = num;\r\n\tint* numPtr = (int*)chPtr;\r\n\tfor (u32 i = this->m_length; i > 0; i -= 4)\r\n\t{\r\n\t    num = (((num << 5) + num) + (num >> 27)) ^ numPtr[0];\r\n\t    if(i <= 2)\r\n\t    {\r\n\t\tbreak;\r\n\t    }\r\n\t    num2 = (((num2 << 5) + num2) + (num2 >> 27)) ^ numPtr[1];\r\n\t    numPtr += 2;\r\n\t}\r\n\treturn (num + (num2 * 1566083941));\r\n    */\r\n\t\r\n\t//\r\n\t// Reimplementation Based on MSFT algorithm as seen on :\r\n\t// http://www.dotnetperls.com/gethashcode\r\n\t//\r\n\t// Could switch to https://github.com/PeterScott/murmur3/blob/master/murmur3.c if necessary.\r\n\t//\r\n\tconst uniChar* chPtr\t= this->_getStringBuffer();\r\n\tint num\t\t\t\t\t= 0x15051505;\r\n\tint num2\t\t\t\t= num;\r\n\tint* numPtr\t\t\t\t= (int*)chPtr;\r\n\tint* numPtrE\t\t\t= &numPtr[(this->m_length & 0xFFFFFFFC)>>1];\t// Array of unicode pair end.\r\n\t\r\n\t// Process 2 unicode char x 2 time / iteration.\r\n\twhile (numPtr != numPtrE) {\r\n\t\tnum\t\t= (((num  << 5) + num ) + (num  >> 27)) ^ (*numPtr++);\r\n\t\tnum2\t= (((num2 << 5) + num2) + (num2 >> 27)) ^ (*numPtr++);\r\n\t}\r\n\r\n\t// Process last pair of character.\r\n\tif(!(this->m_length & 4)) {\r\n\t\tnum\t\t= (((num  << 5) + num ) + (num  >> 27)) ^ (*numPtr++);\r\n\t}\r\n\treturn (num + (num2 * 0x5D588B65));\r\n\t\r\n}\r\n\r\n/*x*/\t/*TypeCode GetTypeCode\t\t();*/\r\n\r\ns32 String::IndexOf(uniChar value) {\r\n\t// Local Object\r\n\tString l((const uniChar*)&value, 1); \r\n\treturn _leftSearch(this, &l, 0, this->m_length);\r\n}\r\n\r\ns32 String::IndexOf(String* value) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\tif(value->m_length == 0) {\r\n\t\treturn -1;\r\n\t}\r\n\r\n\treturn _leftSearch(this, value, 0, (this->m_length - value->m_length) + 1);\r\n}\r\n\r\ns32 String::IndexOf(uniChar value, s32 startIndex) {\r\n\tif((startIndex < 0) || ((u32)startIndex >= this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tString l((const uniChar*)&value, 1);\r\n\treturn _leftSearch(this, &l, startIndex, this->m_length - startIndex);\r\n}\r\n\r\ns32 String::IndexOf(String* value, s32 startIndex) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\tif(value->m_length == 0) {\r\n\t\treturn -1;\r\n\t}\r\n\r\n\tif((startIndex < 0) || ((u32)startIndex >= this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\treturn _leftSearch(this, value, startIndex, ((this->m_length - value->m_length) + 1)-startIndex);\r\n}\r\n\r\ns32 String::IndexOf(uniChar value, s32 startIndex, s32 count) {\r\n\tif((count < 0) || (startIndex < 0) || ((u32)(startIndex + count) > this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tString l((const uniChar*)&value, 1);\r\n\treturn _leftSearch(this, &l, startIndex, count);\r\n}\r\n\r\ns32 String::IndexOf(String* value, s32 startIndex, s32 count) {\r\n\tif(!value) {\r\n\t\tTHROW(CS_NEW ArgumentNullException());\r\n\t}\r\n\r\n\tif(value->m_length == 0) {\r\n\t\treturn -1;\r\n\t}\t\r\n\r\n\tif((count < 0) || (startIndex < 0) || ((u32)(startIndex + count) > this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\treturn _leftSearch(this, value, startIndex, (count - value->m_length) + 1);\r\n}\r\n\r\ns32 String::IndexOfAny(Array<uniChar>* anyOf) {\r\n\tif(!anyOf) { THROW(CS_NEW ArgumentNullException()); }\r\n\treturn _leftSearchAny(this, anyOf, 0, m_length);\r\n}\r\n\r\ns32 String::IndexOfAny(Array<uniChar>* anyOf, s32 startIndex) {\r\n\tif(!anyOf) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif((((u32)startIndex) >= m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\treturn _leftSearchAny(this, anyOf, startIndex, m_length - startIndex);\r\n}\r\n\r\ns32 String::IndexOfAny(Array<uniChar>* anyOf, s32 startIndex, s32 count) {\r\n\tif(!anyOf) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif((count < 0) || (startIndex < 0) || ((u32)(startIndex + count) > this->m_length)) {\r\n\t\tTHROW(CS_NEW IndexOutOfRangeException());\r\n\t}\r\n\r\n\treturn _leftSearchAny(this, anyOf, startIndex, count);\r\n}\r\n\r\nString* String::Insert(s32 startIndex, String* value) {\r\n\tif(!value)\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t\t}\r\n\tif((u32)startIndex > m_length)\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_length = m_length + value->m_length;\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\t// [ToRemove] - end\r\n\r\n\t// uses Allocator\r\n\t//return newStr->_appendStr(this, 0, startIndex)->_appendStr(value, 0, value->m_length)->_appendStr(this, startIndex, m_length - startIndex)->_appendClose();\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer,\t\t\t\t\t\t\t\t_getStringBuffer(),\t\t\t\t\tsizeof(uniChar) * startIndex);\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer + startIndex,\t\t\t\t\tvalue->_getStringBuffer(),\t\t\tsizeof(uniChar) * value->m_length);\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer + startIndex + value->m_length,\t_getStringBuffer() + startIndex,\tsizeof(uniChar) * (m_length - startIndex));\r\n\treturn newStr;\r\n}\r\n\r\ns32 String::LastIndexOf(uniChar value) {\r\n\tString l((const uniChar*)&value, 1);\r\n\treturn _rightSearch(this, &l, this->m_length, this->m_length);\r\n}\r\n\r\ns32 String::LastIndexOf(String* value) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\tif(value->m_length == 0) {\r\n\t\treturn -1;\r\n\t}\r\n\r\n\treturn _rightSearch(this, value, (this->m_length - value->m_length) + 1, (this->m_length - value->m_length) + 1);\r\n}\r\n\r\ns32 String::LastIndexOf(uniChar value, s32 startIndex) {\r\n\tif((startIndex < 0) || ((u32)startIndex >= this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tString l((const uniChar*)&value, 1);\r\n\treturn _rightSearch(this, &l, startIndex, startIndex);\r\n}\r\n\r\ns32 String::LastIndexOf(String* value, s32 startIndex) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\tif(value->m_length == 0) {\r\n\t\treturn -1;\r\n\t}\r\n\r\n\tif((startIndex < 0) || ((u32)startIndex >= this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\treturn _rightSearch(this, value, startIndex, ((this->m_length - value->m_length) + 1));\r\n}\r\n\r\ns32 String::LastIndexOf(uniChar value, s32 startIndex, s32 count) {\r\n\tif((count < 0) || (startIndex < 0) || ((u32)(startIndex + count) > this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\tString l((const uniChar*)&value, 1);\r\n\treturn _rightSearch(this, &l, startIndex, count);\r\n}\r\n\r\ns32 String::LastIndexOf(String* value, s32 startIndex, s32 count) {\r\n\tif(!value) {\r\n\t\tTHROW(CS_NEW ArgumentNullException());\r\n\t}\r\n\r\n\tif(value->m_length == 0) {\r\n\t\treturn -1;\r\n\t}\t\r\n\r\n\tif((count < 0) || (startIndex < 0) || ((u32)(startIndex + count) > this->m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\treturn _rightSearch(this, value, startIndex, (count - value->m_length) + 1);\r\n}\r\n\r\ns32 String::LastIndexOfAny(Array<uniChar>* anyOf) {\r\n\tif(!anyOf) { THROW(CS_NEW ArgumentNullException()); }\r\n\treturn _rightSearchAny(this, anyOf, m_length-1, m_length-1);\r\n}\r\n\r\ns32 String::LastIndexOfAny(Array<uniChar>* anyOf, s32 startIndex) {\r\n\tif(!anyOf) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif((((u32)startIndex) >= m_length)) {\r\n\t\tTHROW(CS_NEW ArgumentOutOfRangeException());\r\n\t}\r\n\r\n\treturn _rightSearchAny(this, anyOf, startIndex, startIndex);\r\n}\r\n\r\ns32 String::LastIndexOfAny(Array<uniChar>* anyOf, s32 startIndex, s32 count) {\r\n\tif(!anyOf) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif((count < 0) || (startIndex < 0) || ((startIndex - count) < 0)) {\r\n\t\tTHROW(CS_NEW IndexOutOfRangeException());\r\n\t}\r\n\r\n\treturn _rightSearchAny(this, anyOf, startIndex, count);\r\n}\r\n\r\nString* String::PadLeft(s32 totalWidth, uniChar paddingChar) {\r\n\tif(totalWidth < 0) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((u32)totalWidth <= m_length) { return this; }\r\n\t\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_length = totalWidth;\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\t// [ToRemove] - end\r\n\r\n\t// uses Allocator\r\n\t//newStr->m_length = totalWidth - m_length;\r\n\t//memset16(_x_StringGlobalAllocator::s_pLastBegin, paddingChar, newStr->m_length << 1);\r\n\t//return newStr->_appendStr(this)->_appendClose();\r\n\r\n\tmemset16((uniChar*)newStr->m_stringBuffer, paddingChar, (totalWidth - m_length) * sizeof(uniChar));\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer + (totalWidth - m_length), _getStringBuffer(), m_length * sizeof(uniChar));\r\n\r\n\treturn newStr;\r\n}\r\n\r\nString* String::PadRight(s32 totalWidth, uniChar paddingChar) {\r\n\tif(totalWidth < 0) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif((u32)totalWidth <= m_length) { return this; }\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_length = totalWidth;\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\t// [ToRemove] - end\r\n\t\r\n\t// uses Allocator\r\n\t//newStr->_appendStr(this);\r\n\t//memset16(_x_StringGlobalAllocator::s_pLastBegin + m_length, paddingChar, (totalWidth - m_length) << 1);\r\n\t//newStr->m_length += totalWidth - m_length;\r\n\t//return newStr->_appendClose();\r\n\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer, _getStringBuffer(), m_length * sizeof(uniChar));\r\n\tmemset16((uniChar*)newStr->m_stringBuffer  + m_length, paddingChar, (totalWidth - m_length) * sizeof(uniChar));\r\n\treturn newStr;\r\n}\r\n\r\nString* String::Remove(s32 startIndex) {\r\n\tif((u32)startIndex >= m_length) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tString* newStr\t\t\t= CS_NEW String(false);\r\n\tnewStr->m_length\t\t= startIndex;\r\n\tnewStr->m_stringBuffer\t= m_stringBuffer;\r\n\tnewStr->m_stringOffset\t= 0;\r\n    newStr->m_bNotOwnBuffer\t= true;\r\n    newStr->m_pBufferOwner\t= this;\r\n\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\treturn newStr;\r\n}\r\n\r\nString* String::Remove(s32 startIndex, s32 count) {\r\n\tif((startIndex < 0) || ((u32)(startIndex + count) > m_length)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\t// uses Allocator\r\n\t//String* newStr = CS_NEW String();\r\n\t//return newStr->_appendStr(this, 0, startIndex)->_appendStr(this, startIndex + count, m_length - startIndex - count)->_appendClose();\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_length = m_length - count;\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer,\t\t\t\t_getStringBuffer(),\t\t\t\t\t\t\tsizeof(uniChar) * startIndex);\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer + startIndex,\t_getStringBuffer() + startIndex + count,\tsizeof(uniChar) * (m_length - count));\r\n\r\n\treturn newStr;\r\n\t// [ToRemove] - end\r\n}\r\n\r\nString* String::Replace(uniChar oldChar, uniChar newChar) {\r\n\t// uses Allocator\r\n\t//String* newStr = CS_NEW String();\r\n\t//const uniChar* pSrc\t= _getStringBuffer();\r\n\t//const uniChar* pEnd\t= pSrc + m_length;\r\n\t//uniChar* pDst\t\t= (uniChar*)newStr->m_stringBuffer; // is in StringAllocator\r\n\t//while(pSrc < pEnd) {\r\n\t//\t*pDst++ = (*pSrc == oldChar) ? newChar : *pSrc;\r\n\t//\tpSrc++;\r\n\t//}\r\n\t//newStr->m_length = m_length;\r\n\t//return newStr->_appendClose();\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_length = m_length;\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\r\n\tconst uniChar* pSrc\t= _getStringBuffer();\r\n\tconst uniChar* pEnd\t= pSrc + m_length;\r\n\tuniChar* pDst\t\t= (uniChar*)newStr->m_stringBuffer;\r\n\twhile(pSrc < pEnd) {\r\n\t\t*pDst++ = (*pSrc == oldChar) ? newChar : *pSrc;\r\n\t\tpSrc++;\r\n\t}\r\n\r\n\treturn newStr;\r\n\t// [ToRemove] - end\r\n}\r\n\r\nString* String::Replace(String* oldValue, String* newValue) {\r\n\tif(!oldValue) { THROW(CS_NEW ArgumentNullException()); }\r\n\tif(oldValue->m_length == 0) { THROW(CS_NEW ArgumentException()); }\r\n\t\r\n\t// uses Allocator\r\n\t//String* newStr = CS_NEW String();\r\n\t//s32 idx\t= IndexOf(oldValue);\r\n\t//if(idx == -1) {\r\n\t//\treturn newStr->_appendStr(this)->_appendClose();\r\n\t//}\r\n\t//\r\n\t//s32 startIdx\t= 0;\r\n\t//while(idx != -1) {\r\n\t//\tnewStr->_appendStr(this, startIdx, idx - startIdx)->_appendStr(newValue);\r\n\t//\tstartIdx = idx + newValue->m_length;\r\n\t//\tidx = IndexOf(oldValue, idx + 1);\r\n\t//}\r\n\t//return newStr->_appendStr(this, startIdx, m_length - startIdx)->_appendClose();\r\n\r\n\t// [ToRemove] when allocator issue is solved in Compilator - begin\r\n\tString* newStr = CS_NEW String(false);\r\n\r\n\ts32 idx\t= IndexOf(oldValue);\r\n\tif(idx == -1) {\r\n\t\tnewStr->m_stringBuffer  = m_stringBuffer;\r\n\t\tnewStr->m_length\t\t= m_length;\r\n\t\tif(newStr->m_length > 0) {\r\n\t\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\t\t}\r\n\t\treturn newStr;\r\n\t}\r\n\r\n\tnewStr->m_length\t= m_length;\r\n\tu32 startIdx\t\t= 0;\r\n\tu32 lengthRatio\t\t= newValue->m_length / oldValue->m_length;\r\n\tif(lengthRatio < 1) { lengthRatio = 1; }\r\n\tuniChar* tmpBuff = (uniChar*)CS_MALLOC(sizeof(uniChar) * m_length * lengthRatio);\r\n\twhile(idx != -1) {\r\n\t\tmemcpy(tmpBuff + startIdx,\t\t\tthis->_getStringBuffer(),\t\tsizeof(uniChar) * idx);\r\n\t\tmemcpy(tmpBuff + startIdx + idx,\tnewValue->_getStringBuffer(),\tsizeof(uniChar) * newValue->m_length);\r\n\t\tnewStr->m_length += newValue->m_length - oldValue->m_length;\r\n\t\tstartIdx = idx + newValue->m_length;\r\n\r\n\t\tidx = IndexOf(oldValue, idx + 1);\r\n\t}\r\n\t// add last string\r\n\tmemcpy(tmpBuff + startIdx, this->_getStringBuffer() + startIdx,\tsizeof(uniChar) * (m_length - startIdx));\r\n\r\n\tnewStr->m_allocBuffer = (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer = newStr->m_allocBuffer;\r\n\tmemcpy((uniChar*)newStr->m_stringBuffer, tmpBuff, sizeof(uniChar) * newStr->m_length);\r\n\tCS_FREE(tmpBuff);\r\n\t\r\n\treturn newStr;\r\n\t// [ToRemove] - end\r\n}\r\n\r\nArray<String*>* String::Split(Array<uniChar>* separator, StringSplitOptions options) {\r\n\treturn Split(separator, 0xffff, options);\r\n}\r\n\r\nArray<String*>* String::Split(Array<String*>* separator, StringSplitOptions options) {\r\n\treturn Split(separator, 0xffff, options);\r\n}\r\n\r\nArray<String*>* String::Split(Array<uniChar>* separator, s32 count, StringSplitOptions options) {\r\n\tif(count < 0) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t// TODO ArgumentException <= options is not one of the StringSplitOptions values.\r\n\r\n\tif(!separator || separator->_acc_gLength() == 0) {\r\n\t\treturn Split((Array<uniChar>*) _str_whiteSpaceSystemArray, count, options);\r\n\t}\r\n\r\n\tString* newStr;\r\n\tString* prevStr\t\t\t= NULL;\r\n\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\tconst uniChar* pPrev\t= pSrc;\r\n\tconst uniChar* pEnd\t\t= pSrc + m_length;\r\n\tu32 idx\t\t\t\t\t= 0;\r\n\tconst uniChar* pOChars\t= &separator->_idx_g_0based(0);\r\n\tconst uniChar* pEChars\t= pOChars + separator->_acc_gLength();\r\n\twhile(pSrc < pEnd && idx < (u32)count - 1) {\r\n\t\tconst uniChar* pChar\t= pOChars;\r\n\t\twhile(pChar < pEChars) {\r\n\t\t\tif(*pSrc == *pChar++) {\r\n\t\t\t\tif((options == None) || ((options == RemoveEmptyEntries) && (pSrc - pPrev > 0))) {\r\n\t\t\t\t\tnewStr = CS_NEW String(false);\r\n\t\t\t\t\tnewStr->m_stringBuffer  = m_stringBuffer;\r\n\t\t\t\t\tnewStr->m_stringOffset\t= m_stringOffset + pPrev - _getStringBuffer();\r\n\t\t\t\t\tnewStr->m_length\t\t= pSrc - pPrev;\r\n\t\t\t\t\tif(newStr->m_length > 0) {\r\n\t\t\t\t\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\t\t\t\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\t\t\t\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tnewStr->m_tmpStringPtr\t= prevStr;\r\n\t\t\t\t\tprevStr\t= newStr;\r\n\t\t\t\t\tpPrev\t= pSrc + 1;\r\n\t\t\t\t\tidx++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpPrev++;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpSrc++;\r\n\t}\r\n\r\n\t// Last String\r\n\tif(options == RemoveEmptyEntries) {\r\n\t\twhile(pSrc < pEnd) {\r\n\t\t\tconst uniChar* pChar\t= pOChars;\r\n\t\t\twhile (pChar < pEChars) {\r\n\t\t\t\tif(*pSrc == *pChar) { \r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tpChar++;\r\n\t\t\t}\r\n\t\t\tif(pChar == pEChars) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpPrev = ++pSrc;\r\n\t\t}\r\n\t}\r\n\tnewStr = CS_NEW String(false);\r\n\tnewStr->m_stringBuffer  = m_stringBuffer;\r\n\tnewStr->m_stringOffset\t= m_stringOffset + pPrev - _getStringBuffer();\r\n\tnewStr->m_length\t\t= pEnd - pPrev ;\r\n\tif(newStr->m_length > 0) {\r\n\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\t}\r\n\tnewStr->m_tmpStringPtr\t= prevStr;\r\n\tidx++;\r\n\r\n\tArray<String*>* arr = CS_NEW Array<String*>(idx);\r\n\twhile(idx--) {\r\n\t\tarr->_idx_s(idx, newStr);\r\n\t\tnewStr = newStr->m_tmpStringPtr;\r\n\t}\r\n\r\n\treturn arr;\r\n}\r\n\r\nArray<String*>* String::Split(Array<String*>* separator, s32 count, StringSplitOptions options) {\r\n\tif(count < 0) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t// TODO ArgumentException <= options is not one of the StringSplitOptions values.\r\n\r\n\tif(!separator || separator->_acc_gLength() == 0) {\r\n\t\treturn Split((Array<uniChar>*) _str_whiteSpaceSystemArray, count, options);\r\n\t}\r\n\r\n\tString* newStr;\r\n\tString* prevStr = NULL;\r\n\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\tconst uniChar* pPrev\t= pSrc;\r\n\tconst uniChar* pEnd\t\t= pSrc + m_length;\r\n\tu32 idx\t\t\t\t\t= 0;\r\n\twhile(pSrc < pEnd && idx < (u32)count - 1) {\r\n\t\tfor(s32 i = 0; i < separator->_acc_gLength(); ++i) {\r\n\t\t\tif(_leftSearch(this, separator->_idx_g(i), m_length - (pEnd - pSrc), 1) ==  m_length - (pEnd - pSrc)) {\r\n\t\t\t\tpSrc += separator->_idx_g(i)->m_length - 1;\r\n\t\t\t\tif((options == None) || ((options == RemoveEmptyEntries) && (pSrc - pPrev > (s32)separator->_idx_g(i)->m_length))) {\r\n\t\t\t\t\tnewStr = CS_NEW String(false);\r\n\t\t\t\t\tnewStr->m_stringBuffer  = m_stringBuffer;\r\n\t\t\t\t\tnewStr->m_stringOffset\t= m_stringOffset + pPrev - _getStringBuffer();\r\n\t\t\t\t\tnewStr->m_length\t\t= pSrc - pPrev - separator->_idx_g(i)->m_length + 1;\r\n\t\t\t\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\t\t\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\t\t\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\t\t\t\t\tnewStr->m_tmpStringPtr\t= prevStr;\r\n\t\t\t\t\tprevStr\t= newStr;\r\n\t\t\t\t\tpPrev\t= pSrc + 1;\r\n\t\t\t\t\tidx++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpPrev++;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpSrc++;\r\n\t}\r\n\r\n\t// Last String\r\n\tif(options == RemoveEmptyEntries) {\r\n\t\twhile(pSrc < pEnd) {\r\n\t\t\tfor(s32 i = 0; i < separator->_acc_gLength(); ++i) {\r\n\t\t\t\tif(_leftSearch(this, separator->_idx_g(i), m_length - (pEnd - pSrc), 1) ==  m_length - (pEnd - pSrc)) {\r\n\t\t\t\t\tpSrc += separator->_idx_g(i)->m_length - 1;\r\n\t\t\t\t\tpPrev = pSrc+1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(pPrev == pSrc+1) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpSrc++;\r\n\t\t}\r\n\t}\r\n\tnewStr = CS_NEW String(false);\r\n\tnewStr->m_stringBuffer  = m_stringBuffer;\r\n\tnewStr->m_stringOffset\t= m_stringOffset + pPrev - _getStringBuffer();\r\n\tnewStr->m_length\t\t= pEnd - pPrev;\r\n\tif(newStr->m_length > 0) {\r\n\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\t}\r\n\tnewStr->m_tmpStringPtr\t= prevStr;\r\n\tidx++;\r\n\r\n\tArray<String*>* arr = CS_NEW Array<String*>(idx);\r\n\twhile(idx--) {\r\n\t\tarr->_idx_s(idx, newStr);\r\n\t\tnewStr = newStr->m_tmpStringPtr;\r\n\t}\r\n\r\n\treturn arr;\r\n}\r\n\r\nbool String::StartsWith(String* value) {\r\n\tif(!value) { THROW(CS_NEW ArgumentNullException()); }\r\n\treturn (_leftSearch(this, value, 0, 1) != -1);\r\n}\r\n\r\nString* String::Substring(s32 startIndex) {\r\n\tif((u32)startIndex > m_length) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(startIndex == m_length) { return Empty; }\r\n\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_stringBuffer\t= m_stringBuffer;\r\n\tnewStr->m_stringOffset\t= m_stringOffset + startIndex;\r\n\tnewStr->m_length\t\t= m_length - startIndex;\r\n\tnewStr->m_bNotOwnBuffer = true;\r\n\tnewStr->m_pBufferOwner\t= this;\r\n\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\treturn newStr;\r\n}\r\n\r\nString* String::Substring(s32 startIndex, s32 length) {\r\n\tif((startIndex < 0) || (length < 0) || ((u32)(startIndex + length) > m_length)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\tif(startIndex == m_length) { return Empty; }\r\n\r\n\tString* newStr = CS_NEW String(false);\r\n\tnewStr->m_stringBuffer\t= m_stringBuffer;\r\n\tnewStr->m_stringOffset\t= m_stringOffset + startIndex;\r\n\tnewStr->m_length\t\t= length;\r\n\tnewStr->m_bNotOwnBuffer = true;\r\n\tnewStr->m_pBufferOwner\t= this;\r\n\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\treturn newStr;\r\n}\r\n\r\nArray<uniChar>* String::ToCharArray() {\r\n\tArray<uniChar>* arr = CS_NEW Array<uniChar>(m_length);\r\n\tmemcpy(arr->_getPArray(), _getStringBuffer(), m_length * sizeof(uniChar));\r\n\treturn arr;\r\n}\r\n\r\nArray<uniChar>* String::ToCharArray\t(s32 startIndex, s32 length) {\r\n\tif((startIndex < 0) || (length < 0) || ((u32)(startIndex + length) > m_length)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\tArray<uniChar>* arr = CS_NEW Array<uniChar>(length);\r\n\tmemcpy(arr->_getPArray(), _getStringBuffer() + startIndex, length * sizeof(uniChar));\r\n\treturn arr;\r\n}\r\n\r\nString* String::ToLower() {\r\n\t// uses Allocator\r\n\t//String* newStr\t\t= CS_NEW String();\r\n\t//const uniChar* pSrc\t= _getStringBuffer();\r\n\t//const uniChar* pEnd\t= pSrc + m_length;\r\n\t//uniChar* pDst\t\t= (uniChar*)newStr->m_stringBuffer; // is in StringAllocator\r\n\t//while(pSrc < pEnd) {\r\n\t//\t*pDst++ = (*pSrc >= 0x0041 && *pSrc <= 0x017D) ? _str_toLowerArray[*pSrc - 0x0041] : *pSrc;\r\n\t//\tpSrc++;\r\n\t//}\r\n\t//newStr->m_length = m_length;\r\n\t//return newStr->_appendClose();\r\n\r\n\tString* newStr\t\t\t= CS_NEW String(false);\r\n\tnewStr->m_length\t\t= m_length;\r\n\tnewStr->m_allocBuffer\t= (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer\t= newStr->m_allocBuffer;\r\n\r\n\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\tconst uniChar* pEnd\t\t= pSrc + m_length;\r\n\tuniChar* pDst\t\t\t= (uniChar*)newStr->m_stringBuffer;\r\n\twhile(pSrc < pEnd) {\r\n\t\t*pDst++ = (*pSrc >= 0x0041 && *pSrc <= 0x017D) ? _str_toLowerArray[*pSrc - 0x0041] : *pSrc;\r\n\t\tpSrc++;\r\n\t}\r\n\treturn newStr;\r\n}\r\n\r\nString* String::ToString() {\r\n\treturn this;\r\n}\r\n\r\nString* String::ToUpper() {\r\n\t// uses Allocator\r\n\t//String* newStr\t\t= CS_NEW String();\r\n\t//const uniChar* pSrc\t= _getStringBuffer();\r\n\t//const uniChar* pEnd\t= pSrc + m_length;\r\n\t//uniChar* pDst\t\t= (uniChar*)newStr->m_stringBuffer; // is in StringAllocator\r\n\t//while(pSrc < pEnd) {\r\n\t//\t*pDst++ = (*pSrc >= 0x0061 && *pSrc <= 0x017E) ? _str_toUpperArray[*pSrc - 0x0061] : *pSrc;\r\n\t//\tpSrc++;\r\n\t//}\r\n\t//newStr->m_length = m_length;\r\n\t//return newStr->_appendClose();\r\n\r\n\tString* newStr\t\t\t= CS_NEW String(false);\r\n\tnewStr->m_length\t\t= m_length;\r\n\tnewStr->m_allocBuffer\t= (uniChar*)__GCMalloc::allocBlock(sizeof(uniChar) * newStr->m_length, newStr->m_allocBufferObject);\r\n\tnewStr->m_allocBufferObject->_addOwner(newStr);\r\n\tnewStr->m_stringBuffer\t= newStr->m_allocBuffer;\r\n\r\n\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\tconst uniChar* pEnd\t\t= pSrc + m_length;\r\n\tuniChar* pDst\t\t\t= (uniChar*)newStr->m_stringBuffer;\r\n\twhile(pSrc < pEnd) {\r\n\t\t*pDst++ = (*pSrc >= 0x0061 && *pSrc <= 0x017E) ? _str_toUpperArray[*pSrc - 0x0061] : *pSrc;\r\n\t\tpSrc++;\r\n\t}\r\n\treturn newStr;\r\n}\r\n\r\nString* String::Trim(Array<uniChar>* trimChars) {\r\n\tif(!trimChars || trimChars->_acc_gLength() == 0) {\r\n\t\treturn Trim((Array<uniChar>*)_str_whiteSpaceSystemArray);\r\n\t} else {\r\n\t\tString* newStr = CS_NEW String(false);\r\n\t\t\r\n\t\tnewStr->m_stringBuffer\t= m_stringBuffer;\r\n\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\r\n\t\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\t\tconst uniChar* pEnd\t\t= pSrc + m_length - 1;\r\n\t\tconst uniChar* pOChars\t= &trimChars->_idx_g_0based(0);\r\n\t\tconst uniChar* pEChars\t= pOChars + trimChars->_acc_gLength();\r\n\t\tbool bContinue\t\t\t= true;\r\n\t\twhile(pSrc <= pEnd && bContinue) {\r\n\t\t\tconst uniChar* pChar\t= pOChars;\r\n\t\t\tbContinue\t\t\t\t= false;\r\n\t\t\twhile (pChar < pEChars) {\r\n\t\t\t\tif((*pChar++) == (*pSrc)) {\r\n\t\t\t\t\tbContinue = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpSrc++;\r\n\t\t}\r\n\r\n\t\tbContinue = true;\r\n\t\twhile (pSrc <= pEnd && bContinue) {\r\n\t\t\tconst uniChar* pChar\t= pOChars;\r\n\t\t\tbContinue\t\t\t\t= false;\r\n\t\t\twhile (pChar < pEChars) {\r\n\t\t\t\tif((*pChar++) == (*pEnd)) {\r\n\t\t\t\t\tbContinue = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpEnd--;\r\n\t\t}\r\n\r\n\t\tnewStr->m_stringOffset  = m_stringOffset + pSrc - m_stringBuffer - 1;\r\n\t\tnewStr->m_length\t\t= m_length - (newStr->m_stringOffset - m_stringOffset) - (_getStringBuffer() + m_length - 1 - pEnd - 1);\r\n\t\treturn newStr;\r\n\t}\r\n}\r\n\r\nString* String::TrimEnd(Array<uniChar>* trimChars) {\r\n\tif(!trimChars || trimChars->_acc_gLength() == 0) {\r\n\t\treturn TrimEnd((Array<uniChar>*)_str_whiteSpaceSystemArray);\r\n\t} else {\r\n\t\tString* newStr = CS_NEW String(false);\r\n\r\n\t\tnewStr->m_stringBuffer\t= m_stringBuffer;\r\n\t\tnewStr->m_stringOffset\t= m_stringOffset;\r\n\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\r\n\t\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\t\tconst uniChar* pEnd\t\t= pSrc + m_length - 1;\r\n\t\tconst uniChar* pOChars\t= &trimChars->_idx_g_0based(0);\r\n\t\tconst uniChar* pEChars\t= pOChars + trimChars->_acc_gLength();\r\n\t\tbool bContinue\t\t\t= true;\r\n\t\twhile (pSrc <= pEnd && bContinue) {\r\n\t\t\tconst uniChar* pChar\t= pOChars;\r\n\t\t\tbContinue\t\t\t\t= false;\r\n\t\t\twhile (pChar < pEChars) {\r\n\t\t\t\tif((*pChar++) == (*pEnd)) {\r\n\t\t\t\t\tbContinue = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpEnd--;\r\n\t\t}\r\n\t\t\r\n\t\tnewStr->m_length\t\t= m_length - (m_stringBuffer + m_length - 1 - pEnd - 1);\r\n\t\r\n\t\treturn newStr;\r\n\t}\r\n}\r\n\r\nString* String::TrimStart(Array<uniChar>* trimChars) {\r\n\tif(!trimChars || trimChars->_acc_gLength() == 0) {\r\n\t\treturn TrimStart((Array<uniChar>*)_str_whiteSpaceSystemArray);\r\n\t} else {\r\n\t\tString* newStr = CS_NEW String(false);\r\n\r\n\t\tnewStr->m_stringBuffer  = m_stringBuffer;\r\n\t\tnewStr->m_bNotOwnBuffer = true;\r\n\t\tnewStr->m_pBufferOwner\t= this;\r\n\t\tthis->_addRef((__GCObject**)&newStr->m_pBufferOwner);\r\n\r\n\t\tconst uniChar* pSrc\t\t= _getStringBuffer();\r\n\t\tconst uniChar* pEnd\t\t= pSrc + m_length - 1;\r\n\t\tconst uniChar* pOChars\t= &trimChars->_idx_g_0based(0);\r\n\t\tconst uniChar* pEChars\t= pOChars + trimChars->_acc_gLength();\r\n\t\tbool bContinue\t\t\t= true;\r\n\t\twhile(pSrc <= pEnd && bContinue) {\r\n\t\t\tconst uniChar* pChar\t= pOChars;\r\n\t\t\tbContinue\t\t\t\t= false;\r\n\t\t\twhile (pChar < pEChars) {\r\n\t\t\t\tif((*pChar++) == (*pSrc)) {\r\n\t\t\t\t\tbContinue = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpSrc++;\r\n\t\t}\r\n\t\tnewStr->m_stringOffset  = m_stringOffset + (pSrc - m_stringBuffer - 1);\r\n\t\tnewStr->m_length\t\t= m_length - (newStr->m_stringOffset - m_stringOffset);\r\n\t\treturn newStr;\r\n\t}\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// String Builder.\r\n\r\nString* String::_appendStr(String* pStr) {\r\n\tif(pStr) {\r\n\t\tmemcpy(_x_StringGlobalAllocator::s_pLastBegin + m_length, pStr->_getStringBuffer(), pStr->m_length * sizeof(uniChar));\r\n\t\tm_length += pStr->m_length;\r\n\t}\r\n\treturn this;\r\n}\r\nString* String::_appendStr(String* pStr, s32 startIndex, s32 length) {\t\r\n\tif(pStr) {\r\n\t\tmemcpy(_x_StringGlobalAllocator::s_pLastBegin + m_length, pStr->_getStringBuffer() + startIndex, length * sizeof(uniChar));\r\n\t\tm_length += length;\r\n\t}\r\n\treturn this;\r\n}\r\nString* String::_appendCte(const uniChar* buffer, u32 size) {\r\n    memcpy((uniChar*)m_stringBuffer + m_length, buffer, size * sizeof(uniChar));\r\n    m_length += size;\r\n    return this;\r\n}\r\nString* String::_appendI(s32 i) {\r\n\t// max int is 2,147,483,647\r\n\r\n\tif(i < 0) {\r\n\t\tthis->_appendC('-');\r\n\t\ti = -i;\r\n\t}\r\n\r\n\tbool isAfterFirstNonZero = false;\r\n\tfor(int n = 1000000000; n > 1; n/=10) {\r\n\t\tif(isAfterFirstNonZero || i/n != 0) {\r\n\t\t\tthis->_appendC('0' + i/n);\r\n\t\t\ti -= (i/n) * n;\r\n\t\t\tisAfterFirstNonZero = true;\r\n\t\t}\r\n\t}\r\n\tthis->_appendC('0' + i);\r\n\treturn this;\r\n}\r\nString* String::_appendU(u32 u) {\r\n\t// max uint is 4,294,967,295\r\n\r\n\tbool isAfterFirstNonZero = false;\r\n\tfor(int n = 1000000000; n > 1; n/=10) {\r\n\t\tif(isAfterFirstNonZero || u/n != 0) {\r\n\t\t\tthis->_appendC('0' + u/n);\r\n\t\t\tu -= (u/n) * n;\r\n\t\t\tisAfterFirstNonZero = true;\r\n\t\t}\r\n\t}\r\n\tthis->_appendC('0' + u);\r\n\treturn this;\r\n}\r\nString* String::_appendF(float f) {\r\n\t// TODO\r\n\t// 3 digits for exponent instead of 2.\r\n\t// precision problems with %G (not with %E).\r\n\tchar charBuffer[50];\r\n\tuniChar uniCharBuffer[50];\r\n\tint len = sprintf(charBuffer, \"%G\", f);\r\n\tasciiToUnicode16((u8*)charBuffer, len, uniCharBuffer);\r\n\t_appendCte(uniCharBuffer, len);\r\n\treturn this;\r\n}\r\nString* String::_appendC(uniChar c) {\r\n\t*(_x_StringGlobalAllocator::s_pLastBegin + m_length++) = c;\r\n\treturn this;\r\n}\r\nString* String::_appendS(s16 s) {\r\n\t// max short is 32,767\r\n\tif(s < 0) {\r\n\t\tthis->_appendC('-');\r\n\t\ts = -s;\r\n\t}\r\n\r\n\tbool isAfterFirstNonZero = false;\r\n\tfor(int n = 10000; n > 1; n/=10) {\r\n\t\tif(isAfterFirstNonZero || s/n != 0) {\r\n\t\t\tthis->_appendC('0' + s/n);\r\n\t\t\ts -= (s/n) * n;\r\n\t\t\tisAfterFirstNonZero = true;\r\n\t\t}\r\n\t}\r\n\tthis->_appendC('0' + s);\r\n\treturn this;\r\n}\r\nString* String::_appendUS(u16 u) {\r\n\t// max short is 65,535\r\n\r\n\tbool isAfterFirstNonZero = false;\r\n\tfor(int n = 10000; n > 1; n/=10) {\r\n\t\tif(isAfterFirstNonZero || u/n != 0) {\r\n\t\t\tthis->_appendC('0' + u/n);\r\n\t\t\tu -= (u/n) * n;\r\n\t\t\tisAfterFirstNonZero = true;\r\n\t\t}\r\n\t}\r\n\tthis->_appendC('0' + u);\r\n\treturn this;\r\n}\r\nString* String::_appendS8(s8 s) {\r\n\t// max s8 is 127\r\n\r\n\tif(s < 0) {\r\n\t\tthis->_appendC('-');\r\n\t\ts = -s;\r\n\t}\r\n\r\n\tif(s > 100) {\r\n\t\tthis->_appendC('0' + s/100);\r\n\t\ts -= s/100 * 100;\r\n\t}\r\n\tif(s > 10) {\r\n\t\tthis->_appendC('0' + s/10);\r\n\t\ts -= s/10 * 10;\r\n\t}\r\n\tthis->_appendC('0' + s);\r\n\treturn this;\r\n}\r\nString* String::_appendU8(u8 u) {\r\n\t// max u8 is 255\r\n\r\n\tif(u > 100) {\r\n\t\tthis->_appendC('0' + u/100);\r\n\t\tu -= u/100 * 100;\r\n\t}\r\n\tif(u > 10) {\r\n\t\tthis->_appendC('0' + u/10);\r\n\t\tu -= u/10 * 10;\r\n\t}\r\n\tthis->_appendC('0' + u);\r\n\treturn this;\r\n}\r\nString* String::_appendB(bool b) {\r\n\tif(b) {\r\n\t\tString tmp(_str_$_true, 4);\r\n\t\tthis->_appendStr(&tmp);\r\n\t} else {\r\n\t\tString tmp(_str_$_false, 5);\r\n\t\tthis->_appendStr(&tmp);\r\n\t}\r\n\treturn this;\r\n}\r\nString* String::_appendL(s64 l) {\r\n\t// max long is 9,223,372,036,854,775,807\r\n\r\n\tif(l < 0) {\r\n\t\tthis->_appendC('-');\r\n\t\tl = -l;\r\n\t}\r\n\r\n\tbool isAfterFirstNonZero = false;\r\n\tfor(s64 n = 1000000000000000000; n > 1; n/=10) {\r\n\t\tif(isAfterFirstNonZero || l/n != 0) {\r\n\t\t\tthis->_appendC((uniChar)('0' + l/n));\r\n\t\t\tl -= (l/n) * n;\r\n\t\t\tisAfterFirstNonZero = true;\r\n\t\t}\r\n\t}\r\n\tthis->_appendC((uniChar)('0' + l));\r\n\treturn this;\r\n}\r\nString* String::_appendUL(u64 u) {\r\n\t// max uint is 18,446,744,073,709,551,615\r\n\r\n\tbool isAfterFirstNonZero = false;\r\n\tfor(u64 n = 10000000000000000000; n > 1; n/=10) {\r\n\t\tif(isAfterFirstNonZero || u/n != 0) {\r\n\t\t\tthis->_appendC((uniChar)('0' + u/n));\r\n\t\t\tu -= (u/n) * n;\r\n\t\t\tisAfterFirstNonZero = true;\r\n\t\t}\r\n\t}\r\n\tthis->_appendC((uniChar)('0' + u));\r\n\treturn this;\r\n}\r\nString* String::_appendD(double d) {\r\n\t// TODO\r\n\treturn this;\r\n}\r\nString* String::_appendClose() {\r\n#ifdef _DEBUG_STRING_\r\n\tCS_Assert(_x_StringGlobalAllocator::s_isBuilding, \"You are trying to close a String which has not been allocated in the StringAllocator!\");\r\n\t_x_StringGlobalAllocator::s_isBuilding = false;\r\n#endif\r\n\r\n\tif(_x_StringGlobalAllocator::closeString(this, (uniChar*)&this->m_stringBuffer[this->m_length])) {\r\n\t\treturn this;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nString& String::operator+(String& pStr) {\r\n\treturn *_appendStr(&pStr);\r\n}\r\nString& String::operator+(uniChar c) {\r\n\treturn *_appendC(c);\r\n}\r\nString& String::operator+(s64 l) {\r\n\treturn *_appendL(l);\r\n}\r\nString& String::operator+(u64 u) {\r\n\treturn *_appendUL(u);\r\n}\r\nString& String::operator+(s32 i) {\r\n\treturn *_appendI(i);\r\n}\r\nString& String::operator+(u32 u) {\r\n\treturn *_appendU(u);\r\n}\r\nString& String::operator+(s16 s) {\r\n\treturn *_appendS(s);\r\n}\r\nString& String::operator+(s8 s) {\r\n\treturn *_appendS8(s);\r\n}\r\nString& String::operator+(u8 u) {\r\n\treturn *_appendU8(u);\r\n}\r\nString& String::operator+(float f) {\r\n\treturn *_appendF(f);\r\n}\r\nString& String::operator+(double d) {\r\n\treturn *_appendD(d);\r\n}\r\nString& String::operator+(bool b) {\r\n\treturn *_appendB(b);\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\nconst char* String::_toCStr() {\r\n\tint* intptr = __MarshallingUtils::NativeUtf8FromString(this);\r\n\treturn (intptr) ? (char*)intptr : \"\";\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n// --------------------------------------------------------\r\n// init\r\n\r\n/*static*/\r\nbool String::init() {\r\n\t_str_whiteSpaceSystemArray = CS_NEW System::Array<uniChar>(26, (uniChar*)_str_whiteSpaceArray, 26);\r\n\tString::Empty = CS_NEW String(false);\r\n\tString::Empty->m_stringBuffer = &System::String::emptyStr;\r\n\tSystem::Memory::registerGCRoot(&_str_whiteSpaceSystemArray);\r\n\tSystem::Memory::registerGCRoot(&String::Empty);\r\n\treturn true;\r\n}\r\n\r\n// --------------------------------------------------------\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_String.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_String_\r\n#define _CS_String_\r\n\r\n#include \"CS_Object.h\"\r\n#include \"Collections/Generic/Generic.h\"\r\n#include \"CS_Array.h\"\r\n#include \"MarshallingUtils.h\"\r\n\r\nnamespace System {\r\n\r\n\tclass __MarshallingUtils;\r\n/* Allocate string on buffer as long as we can...\r\n\t// Buffer full Failure occurs.\r\n\t//\r\n\t//\t--> 1. Call for garbage collector.\r\n\t//\t--> 2. Parse all the string in the list and force them to make a copy\r\n\t//  --> 3. Reset Buffer\r\n\t*/\r\n\t\r\n\t\r\n/*\r\nIFormatProvider*\r\nCharEnumerator*\r\nCultureInfo*\r\n*/\r\n\r\n\t///\r\n\t/// StringGlobalAllocator is a huge uniChar buffer used to avoid using MALLOC for each String.\r\n\t///\r\n\t/// When the Warning Zone is reached, a garbage collection is done.\r\n\t///\tNon garbage collectable Strings make a copy in their own buffer.\r\n\t///\r\n\t/// It must be initialized with the init(u32 bufferSize) method at the beginning of the program.\r\n\t/// A reasonnable size must be allocated to it in order not to have to detach String very often.\r\n\t/// The Warning Zone is defaulty 10% of the total allocator size.\r\n\t///\r\n\t/// \r\n\t\r\n\tclass _x_StringGlobalAllocator\r\n\t{\r\n\t\tfriend class String;\r\n\tpublic:\r\n\t\tstatic bool\t\tinit(u32 bufferSize);\r\n\tprivate:\r\n\t\tstatic uniChar*\tgetStartPointer(u32 optionnalSize = 0);\r\n\t\tstatic uniChar*\tgetLimitPointer();\r\n\t\tstatic bool\t\tcloseString(String* pString, uniChar* end);\r\n\t\tstatic bool\t\tcompact();\r\n\t\t\r\n\t\t// ------------------------\r\n\t\tstatic uniChar*\ts_pBuffer;\r\n\t\tstatic uniChar*\ts_pLastBegin;\r\n\t\tstatic uniChar*\ts_pWarningZone;\r\n\t\tstatic uniChar*\ts_pBufferEnd;\r\n\t\tstatic String*\ts_userList;\r\n\t#ifdef _DEBUG_STRING_\r\n\t\tstatic bool\t\ts_isBuilding;\r\n\t#endif\r\n\t};\r\n\r\n\tenum Encoding \r\n\t{\r\n\t\t// TODO.\r\n\t};\r\n\r\n    enum StringSplitOptions\r\n    {\r\n        None\t\t\t\t\t\t= 0,\r\n        RemoveEmptyEntries\t\t\t= 1,\r\n    };\r\n\r\n    enum StringComparison\r\n    {\r\n        CurrentCulture \t\t\t\t= 0,\r\n        CurrentCultureIgnoreCase\t= 1,\r\n        InvariantCulture\t\t\t= 2,\r\n        InvariantCultureIgnoreCase\t= 3,\r\n        Ordinal\t\t\t\t\t\t= 4,\r\n        OrdinalIgnoreCase\t\t\t= 5,\r\n    };\r\n\t\r\n    enum NormalizationForm\r\n    {\r\n        FormC\t\t\t\t\t\t= 1,\r\n        FormD\t\t\t\t\t\t= 2,\r\n        FormKC\t\t\t\t\t\t= 5,\r\n        FormKD\t\t\t\t\t\t= 6,\r\n\t};\r\n\r\n\t///\r\n\t/// String\r\n\t/// C# Documentation : http://msdn.microsoft.com/en-us/library/system.string.aspx\r\n\t///\r\n\t///\r\n    class String : public Object /*, IComparable, ICloneable, IConvertible, IComparable<string>, IEnumerable<char>, IEnumerable, IEquatable<string>*/\r\n\t{\r\n\t\tfriend class _x_StringGlobalAllocator;\r\n\t\tfriend class Object;\r\n\t\tfriend class __MarshallingUtils;\r\n\tprivate:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_STRING;\r\n\tpublic:\r\n\t\tstatic\tbool\tinit\t\t\t\t();\r\n\t\tvirtual bool\t_isInstanceOf\t\t(u32 typeID);\r\n\t\tinline\tbool\t_isInstanceOf$\t\t(u32 typeID)\t\t\t{ CHCKTHIS; return _isInstanceOf(typeID);\t}\r\n\t\tvirtual\tu32\t\t_processGC\t\t\t();\r\n\t\tvirtual\tvoid\t_releaseGC\t\t\t();\r\n\t\tvirtual void\t_move\t\t\t\t(__GCObject* prevobj, __GCObject* newobj);\r\n\t\tvirtual void\t_moveAlert\t\t\t(u32 offset);\r\n\tprivate:\r\n\t\t// Link list of string using Allocator.\r\n\t\tString*\t\t\tm_next;\r\n\t\tString*\t\t\tm_prev;\r\n\r\n\t\t// Buffer\r\n\t\tconst uniChar*\tm_allocBuffer;\t\t// For Alloc / Free\r\n\t\t__GCMalloc*\t\tm_allocBufferObject;\r\n\t\tconst uniChar*\tm_stringBuffer;\t\t// Pointer could be reduced after a split, trim etc...\r\n\t\tu32\t\t\t\tm_stringOffset;\t\t// Offset in m_stringBuffer IF AND ONLY IF m_stringBuffer belongs to another System::String (m_pBufferOwner)\r\n\r\n\t\t// Temporary list\r\n\t\tString*\t\t\tm_tmpStringPtr;\r\n\r\n\t\t// Reference for GC\r\n\t\tString*\t\t\tm_pBufferOwner;\r\n\r\n\t\tu32\t\t\t\tm_length;\r\n\t\tbool\t\t\tm_bNotOwnBuffer;\r\n\t\t\r\n\t\t// Internal Stuff.\r\n\tpublic: // TODO REMOVE \"public:\" (just for tests)\r\n\t\t~String\t\t\t\t\t\t\t\t\t\t();\r\n\t\tbool\t\t\tcopyStringFromAllocator\t\t();\r\n\t\tbool\t\t\tdisconnect\t\t\t\t\t();\r\n\tpublic:\r\n\r\n\t\tString(bool bUseAllocator = true);\r\n\t\tString(const uniChar* buffer, u32 size); // You must NOT call _appendClose() with this Constructor.\r\n\r\n\t\t// String Builder.\r\n\t\tString* _appendStr\t(String* pStr);\r\n\t\tString* _appendStr\t(String* pStr, s32 startIndex, s32 length);\r\n\t\tString* _appendCte\t(const uniChar* buffer, u32 size);\r\n\t\tString* _appendC\t(uniChar c);\r\n\t\tString* _appendL\t(s64\tl);\r\n\t\tString* _appendUL\t(u64\tu);\r\n\t\tString* _appendI\t(s32\ti);\r\n\t\tString* _appendU\t(u32\tu);\r\n\t\tString* _appendS\t(s16\ts);\r\n\t\tString* _appendUS\t(u16\tu);\r\n\t\tString* _appendS8\t(s8\t\ts);\r\n\t\tString* _appendU8\t(u8\t\tu);\r\n\t\tString* _appendF\t(float\tf);\r\n\t\tString* _appendD\t(double d);\r\n\t\tString* _appendB\t(bool\tb);\r\n\t\tString* _appendClose();\r\n\r\n\t\tString& operator+\t(String&\tpStr);\r\n\t\tString& operator+\t(uniChar\tc);\r\n\t\tString& operator+\t(s64\t\tl);\r\n\t\tString& operator+\t(u64\t\tu);\r\n\t\tString& operator+\t(s32\t\ti);\r\n\t\tString& operator+\t(u32\t\tu);\r\n\t\tString& operator+\t(s16\t\ts);\r\n\t\tString& operator+\t(s8\t\t\ts);\r\n\t\tString& operator+\t(u8\t\t\tu);\r\n\t\tString& operator+\t(float\t\tf);\r\n\t\tString& operator+\t(double\t\td);\r\n\t\tString& operator+\t(bool\t\tb);\r\n\r\n\t\tconst uniChar*\t_getStringBuffer() const;\r\n\r\n\t\tstatic int\t_leftSearch\t\t(String* source, String* pattern, s32 startSearch, s32 searchCount);\r\n\t\tstatic int\t_rightSearch\t(String* source, String* pattern, s32 startSearch, s32 searchCount);\r\n\t\tstatic int\t_leftSearchAny\t(String* source, Array<uniChar>* any, s32 startSearch, s32 searchCount);\r\n\t\tstatic int\t_rightSearchAny\t(String* source, Array<uniChar>* any, s32 startSearch, s32 searchCount);\r\n\r\n\tpublic:\r\n\t\tstatic String* Empty;\r\n\t\tstatic const uniChar emptyStr = '\\0';\r\n\t\tstatic String* _acc_gEmpty() { return Empty; }\r\n\r\n/*NO*/\t//String(const uniChar* value,\tbool bUseAllocator = true);\t\t\t\t\t\t\t\t// You must NOT call _appendClose() with this Constructor.\r\n\t\tString(Array<uniChar>* value,\tbool bUseAllocator = true);\t\t\t\t\t\t\t\t// You must NOT call _appendClose() with this Constructor.\r\n/*NO*/\t//String(sbyte* value,\t\t\tbool bUseAllocator = true);\t\t\t\t\t\t\t\t// You must NOT call _appendClose() with this Constructor.\r\n\t\tString(uniChar c, s32 count,\tbool bUseAllocator = true);\t\t\t\t\t\t\t\t// You must NOT call _appendClose() with this Constructor.\r\n\t\tString(const uniChar* value, s32 startIndex, s32 length);\t\t\t\t\t\t\t\t// You must NOT call _appendClose() with this Constructor.\r\n\t\tString(Array<uniChar>* value, s32 startIndex, s32 length,\tbool bUseAllocator = true);\t// You must NOT call _appendClose() with this Constructor.\r\n/*NO*/\t//String(sbyte* value, s32 startIndex, s32 length,\t\t\tbool bUseAllocator = true);\t// You must NOT call _appendClose() with this Constructor.\r\n/*xUTF8*/\r\n\t\tString(sbyte* value, s32 startIndex, s32 length, Encoding enc, bool bUseAllocator = false);\r\n\r\n\t\ts32\t\t\t\t_acc_gLength\t\t\t();\r\n\t\tinline s32\t\t_acc_gLength$\t\t\t()\t\t\t\t\t\t\t\t{ CHCKTHIS; return _acc_gLength();\t}\r\n\r\n\t\t// TODO $afe version.\r\n\t\tuniChar _idx_g(s32 index)\t\t\t\t\t\t\t\t\t\t\t\t{ return m_stringBuffer[index];\t\t}\r\n\t\tuniChar _idx_g$(s32 index)\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return _idx_g(index);\t}\r\n\r\n\t\tconst uniChar&\t\t\toperator[]\t\t\t(s32 index) const;\r\n\t\tinline bool\t\t\t\toperator==\t\t\t(String& b)\t\t\t\t\t{ CHCKTHIS; return Equals(&b);\t\t}\r\n\t\tinline bool\t\t\t\toperator==\t\t\t(Object& b)\t\t\t\t\t{ CHCKTHIS; return Equals(&b);\t\t}\r\n\t\tinline bool\t\t\t\toperator!=\t\t\t(String& b)\t\t\t\t\t{ CHCKTHIS; return !(*this==b);\t\t}\r\n\t\tinline bool\t\t\t\toperator!=\t\t\t(Object& b)\t\t\t\t\t{ CHCKTHIS; return !(*this==b);\t\t}\r\n\r\n        static s32\t\t\t\tCompare\t\t\t\t(String* strA, String* strB);\r\n        static s32\t\t\t\tCompare\t\t\t\t(String* strA, String* strB, bool ignoreCase);\r\n        static String*\t\t\tConcat\t\t\t\t(Object* arg0);\r\n        static String*\t\t\tConcat\t\t\t\t(/*params*/ Array<Object*>* args);\r\n        static String*\t\t\tConcat\t\t\t\t(/*params*/ Array<String*>* values);\r\n        static String*\t\t\tCopy\t\t\t\t(String* str);\r\n        static bool\t\t\t\tEquals\t\t\t\t(String* a, String* b);\r\n/*x*/\tstatic bool\t\t\t\tEquals\t\t\t\t(String* a, String* b, StringComparison comparisonType);\r\n/*x*/\tstatic String*\t\t\tFormat\t\t\t\t(String* format, Object* arg0);\r\n/*x*/\tstatic String*\t\t\tFormat\t\t\t\t(String* format, /*params*/ Array<Object*>* args);\r\n        static bool\t\t\t\tIsNullOrEmpty\t\t(String* value);\r\n/*x*/\tstatic bool\t\t\t\tIsNullOrWhiteSpace\t(String* value);\r\n\t\tstatic String*\t\t\tJoin\t\t\t\t(String* separator, /*params*/ Array<String*>* value);\r\n\t\tstatic String*\t\t\tJoin\t\t\t\t(String* separator, Array<String*>* value, s32 startIndex, s32 count);\r\n\r\n\t\tObject*\t\t\t\t\tClone\t\t\t\t();\r\n\t\tinline Object*\t\t\tClone$\t\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Clone();\t\t\t\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tCompareTo\t\t\t(Object* value);\r\n\t\tinline s32\t\t\t\tCompareTo$\t\t\t(Object* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return CompareTo(value);\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tCompareTo\t\t\t(String* strB);\r\n\t\tinline s32\t\t\t\tCompareTo$\t\t\t(String* strB)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return CompareTo(strB);\t\t\t\t\t\t\t}\r\n\t\tbool\t\t\t\t\tContains\t\t\t(String* value);\r\n\t\tinline bool\t\t\t\tContains$\t\t\t(String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Contains(value);\t\t\t\t\t\t\t}\r\n\t\tvoid\t\t\t\t\tCopyTo\t\t\t\t(s32 sourceIndex, Array<uniChar>* destination, s32 destinationIndex, s32 count);\r\n\t\tinline void\t\t\t\tCopyTo$\t\t\t\t(s32 sourceIndex, Array<uniChar>* destination, s32 destinationIndex, s32 count)\t\t\t\t{ CHCKTHIS; CopyTo(sourceIndex, destination, destinationIndex, count);\t}\r\n\t\tbool\t\t\t\t\tEndsWith\t\t\t(String* value);\r\n\t\tinline bool\t\t\t\tEndsWith$\t\t\t(String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return EndsWith(value);\t\t\t\t\t\t\t}\r\n\t\tbool\t\t\t\t\tEquals\t\t\t\t(Object* obj);\r\n\t\tinline bool\t\t\t\tEquals$\t\t\t\t(Object* obj)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Equals(obj);\t\t\t\t\t\t\t\t}\r\n\t\tbool\t\t\t\t\tEquals\t\t\t\t(String* value);\r\n\t\tinline bool\t\t\t\tEquals$\t\t\t\t(String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Equals(value);\t\t\t\t\t\t\t}\r\n/*x*/\tbool\t\t\t\t\tEquals\t\t\t\t(String* value, StringComparison comparisonType);\r\n\t\ts32\t\t\t\t\t\tGetHashCode\t\t\t();\r\n\t\tinline s32\t\t\t\tGetHashCode$\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return GetHashCode();\t\t\t\t\t\t\t}\r\n/*x*/\t/*TypeCode GetTypeCode\t\t();*/\r\n\t\ts32\t\t\t\t\t\tIndexOf\t\t\t\t(uniChar value);\r\n\t\tinline s32\t\t\t\tIndexOf$\t\t\t(uniChar value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(value);\t\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOf\t\t\t\t(String* value);\r\n\t\tinline s32\t\t\t\tIndexOf$\t\t\t(String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(value);\t\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOf\t\t\t\t(uniChar value, s32 startIndex);\r\n\t\tinline s32\t\t\t\tIndexOf$\t\t\t(uniChar value, s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(value, startIndex);\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOf\t\t\t\t(String* value, s32 startIndex);\r\n\t\tinline s32\t\t\t\tIndexOf$\t\t\t(String* value, s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(value, startIndex);\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOf\t\t\t\t(uniChar value, s32 startIndex, s32 count);\r\n\t\tinline s32\t\t\t\tIndexOf$\t\t\t(uniChar value, s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(value, startIndex, count);\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOf\t\t\t\t(String* value, s32 startIndex, s32 count);\r\n\t\tinline s32\t\t\t\tIndexOf$\t\t\t(String* value, s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(value, startIndex, count);\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOfAny\t\t\t(Array<uniChar>* anyOf);\r\n\t\tinline s32\t\t\t\tIndexOfAny$\t\t\t(Array<uniChar>* anyOf)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOfAny(anyOf);\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOfAny\t\t\t(Array<uniChar>* anyOf, s32 startIndex);\r\n\t\tinline s32\t\t\t\tIndexOfAny$\t\t\t(Array<uniChar>* anyOf, s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOfAny(anyOf, startIndex);\t\t\t}\r\n\t\ts32\t\t\t\t\t\tIndexOfAny\t\t\t(Array<uniChar>* anyOf, s32 startIndex, s32 count);\r\n\t\tinline s32\t\t\t\tIndexOfAny$\t\t\t(Array<uniChar>* anyOf, s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOfAny(anyOf, startIndex, count);\t}\r\n\t\tString*\t\t\t\t\tInsert\t\t\t\t(s32 startIndex, String* value);\r\n\t\tinline String*\t\t\tInsert$\t\t\t\t(s32 startIndex, String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Insert(startIndex, value);\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOf\t\t\t(uniChar value);\r\n\t\tinline s32\t\t\t\tLastIndexOf$\t\t(uniChar value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(value);\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOf\t\t\t(String* value);\r\n\t\tinline s32\t\t\t\tLastIndexOf$\t\t(String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(value);\t\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOf\t\t\t(uniChar value, s32 startIndex);\r\n\t\tinline s32\t\t\t\tLastIndexOf$\t\t(uniChar value, s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(value, startIndex);\t\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOf\t\t\t(String* value, s32 startIndex);\r\n\t\tinline s32\t\t\t\tLastIndexOf$\t\t(String* value, s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(value, startIndex);\t\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOf\t\t\t(uniChar value, s32 startIndex, s32 count);\r\n\t\tinline s32\t\t\t\tLastIndexOf$\t\t(uniChar value, s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(value, startIndex, count);\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOf\t\t\t(String* value, s32 startIndex, s32 count);\r\n\t\tinline s32\t\t\t\tLastIndexOf$\t\t(String* value, s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(value, startIndex, count);\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOfAny\t\t(Array<uniChar>* anyOf);\r\n\t\tinline s32\t\t\t\tLastIndexOfAny$\t\t(Array<uniChar>* anyOf)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOfAny(anyOf);\t\t\t\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOfAny\t\t(Array<uniChar>* anyOf, s32 startIndex);\r\n\t\tinline s32\t\t\t\tLastIndexOfAny$\t\t(Array<uniChar>* anyOf, s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOfAny(anyOf, startIndex);\t\t}\r\n\t\ts32\t\t\t\t\t\tLastIndexOfAny\t\t(Array<uniChar>* anyOf, s32 startIndex, s32 count);\r\n\t\tinline s32\t\t\t\tLastIndexOfAny$\t\t(Array<uniChar>* anyOf, s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOfAny(anyOf, startIndex, count);\t}\r\n\t\tString*\t\t\t\t\tPadLeft\t\t\t\t(s32 totalWidth, uniChar paddingChar = ' ');\r\n\t\tinline String*\t\t\tPadLeft$\t\t\t(s32 totalWidth, uniChar paddingChar = ' ')\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return PadLeft(totalWidth, paddingChar);\t\t}\r\n\t\tString*\t\t\t\t\tPadRight\t\t\t(s32 totalWidth, uniChar paddingChar = ' ');\r\n\t\tinline String*\t\t\tPadRight$\t\t\t(s32 totalWidth, uniChar paddingChar = ' ')\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return PadRight(totalWidth, paddingChar);\t\t}\r\n\t\tString*\t\t\t\t\tRemove\t\t\t\t(s32 startIndex);\r\n\t\tinline String*\t\t\tRemove$\t\t\t\t(s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Remove(startIndex);\t\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tRemove\t\t\t\t(s32 startIndex, s32 count);\r\n\t\tinline String*\t\t\tRemove$\t\t\t\t(s32 startIndex, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Remove(startIndex, count);\t\t\t\t}\r\n\t\tString*\t\t\t\t\tReplace\t\t\t\t(uniChar oldChar, uniChar newChar);\r\n\t\tinline String*\t\t\tReplace$\t\t\t(uniChar oldChar, uniChar newChar)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Replace(oldChar, newChar);\t\t\t\t}\r\n\t\tString*\t\t\t\t\tReplace\t\t\t\t(String* oldValue, String* newValue);\r\n\t\tinline String*\t\t\tReplace$\t\t\t(String* oldValue, String* newValue)\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Replace(oldValue, newValue);\t\t\t\t}\r\n\t\tArray<String*>*\t\t\tSplit\t\t\t\t(Array<uniChar>* separator, StringSplitOptions options);\r\n\t\tinline Array<String*>*\tSplit$\t\t\t\t(Array<uniChar>* separator, StringSplitOptions options)\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Split(separator, options);\t\t\t\t}\r\n\t\tArray<String*>*\t\t\tSplit\t\t\t\t(Array<String*>* separator, StringSplitOptions options);\r\n\t\tinline Array<String*>*\tSplit$\t\t\t\t(Array<String*>* separator, StringSplitOptions options)\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Split(separator, options);\t\t\t\t}\r\n\t\tArray<String*>*\t\t\tSplit\t\t\t\t(Array<uniChar>* separator, s32 count = 0xffff, StringSplitOptions options = None);\r\n\t\tinline Array<String*>*\tSplit$\t\t\t\t(Array<uniChar>* separator, s32 count = 0xffff, StringSplitOptions options = None)\t\t{ CHCKTHIS; return Split(separator, count, options);\t\t}\r\n\t\tArray<String*>*\t\t\tSplit\t\t\t\t(Array<String*>* separator, s32 count, StringSplitOptions options);\r\n\t\tinline Array<String*>*\tSplit$\t\t\t\t(Array<String*>* separator, s32 count, StringSplitOptions options)\t\t\t\t\t\t\t{ CHCKTHIS; return Split(separator, count, options);\t\t}\r\n\t\tbool\t\t\t\t\tStartsWith\t\t\t(String* value);\r\n\t\tinline bool\t\t\t\tStartsWith$\t\t\t(String* value)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return StartsWith(value);\t\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tSubstring\t\t\t(s32 startIndex);\r\n\t\tinline String*\t\t\tSubstring$\t\t\t(s32 startIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Substring(startIndex);\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tSubstring\t\t\t(s32 startIndex, s32 length);\r\n\t\tinline String*\t\t\tSubstring$\t\t\t(s32 startIndex, s32 length)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Substring(startIndex, length);\t\t\t}\r\n\t\tArray<uniChar>*\t\t\tToCharArray\t\t\t();\r\n\t\tinline Array<uniChar>*\tToCharArray$\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToCharArray();\t\t\t\t\t\t\t}\r\n\t\tArray<uniChar>*\t\t\tToCharArray\t\t\t(s32 startIndex, s32 length);\r\n\t\tinline Array<uniChar>*\tToCharArray$\t\t(s32 startIndex, s32 length)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToCharArray(startIndex, length);\t\t\t}\r\n\t\tString*\t\t\t\t\tToLower\t\t\t\t();\r\n\t\tinline String*\t\t\tToLower$\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToLower();\t\t\t\t\t\t\t\t}\r\n\t\tvirtual String*\t\t\tToString\t\t\t();\r\n\t\tinline String*\t\t\tToString$\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToString();\t\t\t\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tToUpper\t\t\t\t();\r\n\t\tinline String*\t\t\tToUpper$\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToUpper();\t\t\t\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tTrim\t\t\t\t(/*params*/ Array<uniChar>* trimChars = NULL);\r\n\t\tinline String*\t\t\tTrim$\t\t\t\t(/*params*/ Array<uniChar>* trimChars = NULL)\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Trim(trimChars);\t\t\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tTrimEnd\t\t\t\t(/*params*/ Array<uniChar>* trimChars = NULL);\r\n\t\tinline String*\t\t\tTrimEnd$\t\t\t(/*params*/ Array<uniChar>* trimChars = NULL)\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return TrimEnd(trimChars);\t\t\t\t\t\t}\r\n\t\tString*\t\t\t\t\tTrimStart\t\t\t(/*params*/ Array<uniChar>* trimChars = NULL);\r\n\t\tinline String*\t\t\tTrimStart$\t\t\t(/*params*/ Array<uniChar>* trimChars = NULL)\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return TrimStart(trimChars);\t\t\t\t\t}\r\n\r\n\tpublic:\r\n\t\tinline static const char*\t_toCStr\t\t\t(String* str)\t\t\t{ if(!str) { return NULL; } return str->_toCStr();\t}\r\n\t\tconst char*\t\t\t\t\t_toCStr\t\t\t();\r\n\t\tinline const char*\t\t\t_toCStr$\t\t()\t\t\t\t\t\t{ CHCKTHIS; return this->_toCStr();\t\t\t\t\t}\r\n\t};\r\n\r\n\tclass AnyToString {\r\n/*x*/\tstatic String ToString\t(int    value);\t\r\n/*x*/\tstatic String ToString\t(float\tvalue);\r\n/*x*/\tstatic String ToString\t(uint\tvalue);\r\n/*x*/\tstatic String ToString\t(bool\tvalue);\r\n/*x*/\tstatic String ToString\t(long\tvalue);\r\n/*x*/\tstatic String ToString\t(double value);\r\n/*x*/\tstatic String ToString\t(byte\tvalue);\r\n/*x*/\tstatic String ToString\t(sbyte\tvalue);\r\n/*x*/\tstatic String ToString\t(short\tvalue);\r\n/*x*/\tstatic String ToString\t(uniChar value);\r\n\t};\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_System.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_System.h\"\r\n\r\nnamespace System {\r\n\r\nbool initRuntime() {\r\n\t__InternalUtils::init();\r\n\tSystem::_x_StringGlobalAllocator::init(32768);\r\n\tSystem::String::init();\r\n\t\r\n\treturn true;\r\n}\r\n\r\nstatic const uniChar __delStr_1[] = { 'S','y','s','t','e','m','.','D','e','l','e','g','a','t','e' };\r\n/*virtual*/\r\nString* Delegate::ToString() {\r\n\treturn CS_NEW String(__delStr_1, 15);\r\n}\r\n\r\n/*static*/ /*const*/ s32*\tIntPtr::Zero\t= 0;\r\n/*static*/ /*const*/ s32\tIntPtr::Size\t= sizeof(s32*);\r\n/*static*/ /*const*/ u32*\tUIntPtr::Zero\t= 0;\r\n/*static*/ /*const*/ s32\tUIntPtr::Size\t= sizeof(s32*);\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/CS_System.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_IntrPtr_h_\r\n#define _CS_IntrPtr_h_\r\n\r\n#include \"../CompilerProject/BaseType.h\"\r\n#include \"CS_Object.h\"\r\n#include \"CS_String.h\"\r\n\r\nnamespace System {\r\n\r\nbool initRuntime();\r\n\r\nclass IntPtr {\r\npublic:\r\n\tstatic /*const*/ s32*\tZero;\r\n\tstatic /*const*/ s32\tSize;\r\n};\r\n\r\nclass UIntPtr {\r\npublic:\r\n\tstatic /*const*/ u32*\tZero;\r\n\tstatic /*const*/ s32\tSize;\r\n};\r\n\r\nclass Delegate : public Object {\r\nprivate:\r\n\tstatic const u32\t_TYPEID = _TYPE_DELEGATE;\r\npublic:\r\n\tvirtual\t\t\t\tvoid\t\t_releaseGC\t\t()\t\t\t\t\t\t\t\t\t\t\t{ /* Do nothing */\t\t\t\t}\r\n\tvirtual\t\t\t\tu32\t\t\t_processGC\t\t()\t\t\t\t\t\t\t\t\t\t\t{ return COMPLETE;\t\t\t\t}\r\n\tvirtual\t\t\t\tvoid\t\t_move\t\t\t(__GCObject* prevObj, __GCObject* newObj)\t{ /* Do nothing */\t\t\t\t}\r\n\tvirtual\t\t\t\tbool\t\t_isInstanceOf\t(u32 typeID)\t\t\t\t\t\t\t\t{ _INSTANCEOF(Delegate,Object);\t}\r\n\tinline\t\t\t\tbool \t\t_isInstanceOf$\t(u32 typeID)\t\t\t\t\t\t\t\t{ return _isInstanceOf(typeID); }\r\n\tvirtual\t\t\t\tString*\t\tToString\t\t();\r\n\tinline\t\t\t\tString*\t\tToString$\t\t()\t\t\t\t\t\t\t\t\t\t\t{ return ToString();\t\t\t}\r\n};\r\n\r\nclass IDisposable { \r\n};\r\nclass ICloneable { \r\n};\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/Collections/Collections.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _System_Collections_h_\r\n#define _System_Collections_h_\r\n\r\nnamespace System {\r\nnamespace Collections {\r\n\tclass IEnumerator\r\n\t{\r\n\t\tvirtual\tObject* __get__Current();/*Current { get; }*/\r\n\t\tvirtual bool\tMoveNext();\r\n\t\tvirtual void\tReset();\r\n\t};\r\n\r\n\tclass IEnumerable\r\n\t{\r\n\t\tvirtual\tIEnumerator* GetEnumerator();\r\n\t};\r\n}\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/Collections/Generic/CS_Dictionary.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_Dictionary.h\"\r\n\r\nnamespace System {\r\nnamespace Collections {\r\nnamespace Generic {\r\n\r\nstatic const u32 _dictionary_primeArray[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,233,239,251,257,263,269,277,281,293,307,311,317,331,337,347,353,359,367,373,379,383,389,397,401,409,419,431,439,449,457,463,479,487,499,509,521,541,547,557,563,569,577,587,593,599,607,617,631,641,653,661,673,683,691,701,709,719,727,739,751,761,769,787,797,809,821,839,853,863,877,887,907,919,929,941,953,967,977,991,1009,1021,1033,1049,1061,1087,1103,1117,1129,1151,1163,1181,1193,1213,1229,1249,1277,1291,1307,1321,1361,1381,1399,1423,1439,1459,1481,1499,1523,1543,1559,1579,1597,1613,1637,1657,1693,1721,1741,1759,1777,1801,1823,1847,1867,1889,1913,1933,1973,1993,2017,2039,2063,2087,2111,2137,2161,2203,2237,2267,2293,2333,2357,2381,2411,2437,2467,2503,2531,2557,2591,2617,2647,2677,2707,2741,2777,2819,2851,2887,2917,2953,2999,3037,3079,3119,3163,3203,3251,3299,3343,3389,3433,3469,3511,3547,3583,3623,3671,3709,3761,3803,3847,3889,3929,3989,4049,4091,4133,4177,4219,4271,4327,4373,4421,4481,4547,4597,4643,4691,4751,4799,4861,4919,4969,5021,5077,5147,5209,5273,5333,5387,5441,5501,5557,5623,5683,5741,5801,5861,5923,5987,6047,6113,6197,6263,6329,6397,6469,6547,6619,6689,6761,6829,6899,6971,7043,7121,7193,7283,7369,7451,7529,7607,7687,7789,7867,7949,8039,8123,8209,8293,8377,8461,8563,8663,8753,8849,8941,9041,9133,9227,9323,9419,9521,9619,9719,9817,9923,10037,10139,10243,10357,10463,10589,10709,10831,10949,11059,11171,11287,11411,11527,11657,11777,11897,12037,12161,12289,12413,12539,12671,12799,12941,13093,13229,13367,13513,13649,13789,13931,14071,14221,14369,14519,14669,14821,14983,15137,15289,15443,15601,15761,15919,16087,16249,16417,16603,16787,16963,17137,17317,17491,17669,17851,18041,18223,18413,18617,18839,19031,19231,19427,19661,19861,20063,20269,20477,20693,20903,21121,21341,21557,21773,21991,22229,22453,22679,22907,23143,23399,23633,23873,24113,24359,24611,24859,25111,25367,25621,25889,26153,26417,26683,26951,27239,27527,27803,28087,28387,28687,28979,29269,29567,29863,30169,30491,30803,31121,31469,31793,32117,32441,32771,33107,33457,33797,34141,34483,34841,35201,35569,35933,36293,36671,37039,37423,37799,38177,38561,38953,39343,39749,40151,40559,40973,41387,41801,42221,42649,43093,43541,43987,44449,44909,45361,45817,46279,46747,47221,47699,48179,48661,49157,49663,50177,50683,51193,51713,52237,52769,53299,53849,54401,54949,55501,56081,56659,57241,57829,58411,58997,59611,60209,60821,61441,62057,62683,63311,63949,64591,65239,65899,66569,67247,67927,68611,69313,70009,70717,71429,72161,72883,73613,74353,75109,75869,76631,77417,78193,78977,79769,80567,81373,82189,83023,83857,84697,85549,86413,87281,88169,89051,89959,90863,91781,92699,93629,94573,95527,96487,97453,98429,99431,100447,101461,102481,103511,104549,105601,106661,107741,108821,109913,111029,112153,113279,114419,115571,116731,117899,119083,120277,121487,122719,123953,125197,126457,127727,129011,130303,131611,132929,134263,135607,136973,138349,139739,141157,142573,143999,145441,146917,148387,149873,151379,152897,154439,156007,157571,159157,160751,162359,163987,165653,167311,168991,170689,172399,174137,175891,177677,179461,181273,183089,184949,186799,188677,190573,192497,194431,196379,198343,200329,202339,204367,206411,208489,210599,212777,214913,217069,219251,221447,223667,225919,228181,230467,232777,235111,237467,239843,242243,244667,247141,249647,252151,254699,257249,259823,262433,265079,267737,270421,273127,275881,278651,281509,284341,287191,290083,292993,295937,298897,301897,304933,308003,311099,314213,317363,320539,323759,326999,330271,333581,336929,340321,343727,347167,350657,354169,357727,361313,364937,368593,372289,376021,379787,383587,387433,391331,395251,399221,403219,407257,411337,415469,419651,423853,428093,432389,436717,441101,445537,450001,454507,459061,463663,468319,473009,477749,482527,487363,492251,497177,502171,507193,512269,517393,522569,527803,533089,538423,543811,549257,554753,560311,565919,571579,577307,583087,588923,594821,600791,606811,612889,619019,625213,631469,637787,644167,650609,657121,663709,670349,677057,683831,690671,697579,704563,711617,718741,725929,733189,740521,747941,755437,763001,770639,778357,786151,794023,801973,809993,818093,826279,834569,842923,851359,859891,868493,877181,885959,894869,903827,912869,922021,931267,940607,950023,959533,969131,978839,988643,998537};\r\n\r\n\r\n\t\r\n\r\n}\r\n}\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/Collections/Generic/CS_Dictionary.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_Dictionary_\r\n#define _CS_Dictionary_\r\n\r\n#include \"../../CS_Object.h\"\r\n#include \"../../CS_String.h\"\r\n#include \"../../InternalUtils.h\"\r\n\r\nnamespace System {\r\nnamespace Collections {\r\nnamespace Generic {\r\n\r\n\t// Prime numbers from 2 to 1M with a minimal increase of 1% between 2 prime numbers.\r\n\t// Array of 772 elements.\r\n\textern const u32 _dictionary_primeArray[];\r\n\r\n\t///\r\n\t/// Dictionary<TKey,TValue>\r\n\t/// Implementation based on :\r\n\t///\t\thttp://msdn.microsoft.com/en-us/library/xfhwa508.aspx\r\n\t///\t\thttp://www.simple-talk.com/blogs/2011/09/16/the-net-dictionary/\r\n\t///\t\r\n\ttemplate<class TKey, class TValue>\r\n\tclass Dictionary : public Object {\r\n\t\tfriend class Object;\r\n\r\n\tpublic:\r\n\t\tstruct Entry {\r\n\t\t\tEntry*\tm_pNext;\r\n\t\t\tTKey\tm_key;\r\n\t\t\tTValue\tm_value;\r\n\t\t\ts32\t\tm_hashCode;\r\n\t\t\tbool\tm_isFilled;\r\n\r\n\t\t\tEntry();\r\n\t\t\tEntry(TKey key, TValue value, s32 hashCode, Entry* next);\r\n\t\t\t~Entry();\r\n\t\t\tvoid set(TKey key, TValue value, s32 hashCode, Entry* next);\r\n\t\t};\r\n\r\n\tprivate:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_DICTIONARY;\r\n\tpublic:\r\n\t\tvirtual bool\t_isInstanceOf\t(u32 typeID);\r\n\t\tvirtual\tu32\t\t_processGC\t\t();\r\n\t\tvirtual void\t_releaseGC\t\t();\r\n\t\tvirtual void\t_move\t\t\t(__GCObject* prevobj, __GCObject* newobj);\r\n\t\tvirtual void\t_moveAlert\t\t(u32 offset);\r\n\tprivate:\r\n\t\t// members\r\n\t\ts32*\t\tm_buckets;\r\n\t\tEntry*\t\tm_entries;\r\n\t\tEntry*\t\tm_freeList;\r\n\t\t__GCMalloc*\tm_bucketsObject;\r\n\t\t__GCMalloc* m_entriesObject;\r\n\t\tu32\t\t\tm_count;\r\n\t\tu32\t\t\tm_capacity;\r\n\t\tu32\t\t\tm_countRemoved;\r\n\r\n\tpublic:\r\n\t\tDictionary<TKey, TValue>(s32 capacity = 17);\r\n\t\t~Dictionary();\r\n\r\n\t\t// Properties\r\n/*x*/\t//IEqualityComparer<TKey>\t\t_g$Comparer\t\t\t\t();\r\n\t\tinline s32\t\t\t\t\t\t_acc_gCount\t\t\t\t()\t\t\t\t\t\t\t\t\t{ return m_count;\t\t\t\t\t\t}\r\n\t\tinline s32\t\t\t\t\t\t_acc_gCount$\t\t\t()\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return _acc_gCount();\t\t}\r\n\t\tTValue&\t\t\t\t\t\t\t_idx_g\t\t\t\t\t(TKey key);\r\n\t\tinline TValue&\t\t\t\t\t_idx_g$\t\t\t\t\t(TKey key)\t\t\t\t\t\t\t{ CHCKTHIS; return _idx_g(key);\t\t\t}\r\n\t\tTValue\t\t\t\t\t\t\t_idx_s\t\t\t\t\t(TKey key, TValue value);\r\n\t\tinline TValue\t\t\t\t\t_idx_s$\t\t\t\t\t(TKey key, TValue value)\t\t\t{ CHCKTHIS; return _idx_s(key, value);\t}\r\n/*x*/\t//Dictionary<T>.KeyCollection\t_g$Keys\t\t\t\t\t();\r\n/*x*/\t//Dictionary<T>.ValueCollection\t_g$Values\t\t\t\t();\r\n\r\n\t\t// Methods\r\n\t\tvoid\t\t\t\t\t\t\tAdd\t\t\t\t\t\t(TKey key, TValue value);\r\n\t\tinline void\t\t\t\t\t\tAdd$\t\t\t\t\t(TKey key, TValue value)\t\t\t{ CHCKTHIS; Add(key, value);\t\t\t\t}\r\n\t\tvoid\t\t\t\t\t\t\tClear\t\t\t\t\t();\r\n\t\tinline void\t\t\t\t\t\tClear$\t\t\t\t\t()\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Clear();\t\t\t\t\t\t}\r\n\t\tbool\t\t\t\t\t\t\tContainsKey\t\t\t\t(TKey key);\r\n\t\tinline bool\t\t\t\t\t\tContainsKey$\t\t\t(TKey key)\t\t\t\t\t\t\t{ CHCKTHIS;  return ContainsKey(key);\t\t}\r\n\t\tbool\t\t\t\t\t\t\tContainsValue\t\t\t(TValue value);\r\n\t\tinline bool\t\t\t\t\t\tContainsValue$\t\t\t(TValue value)\t\t\t\t\t\t{ CHCKTHIS; return ContainsValue(value);\t}\r\n/*x*/\t//Dictionary<T>.Enumerator\t\tGetEnumerator\t\t\t();\r\n/*x*/\t//int\t\t\t\t\t\t\tGetHashCode\t\t\t\t();\r\n\t\tbool\t\t\t\t\t\t\tRemove\t\t\t\t\t(TKey key);\r\n\t\tinline bool\t\t\t\t\t\tRemove$\t\t\t\t\t(TKey key)\t\t\t\t\t\t\t{ CHCKTHIS; return Remove(key);\t\t\t\t}\r\n\t\tbool\t\t\t\t\t\t\t_ref_TryGetValue\t\t(TKey key, /*out*/ TValue& value);\r\n\t\tbool\t\t\t\t\t\t\tTryGetValue\t\t\t\t(TKey key, /*out*/ TValue& value);\r\n\t\tinline bool\t\t\t\t\t\tTryGetValue$\t\t\t(TKey key, /*out*/ TValue& value)\t{ CHCKTHIS; return TryGetValue(key, value);\t}\r\n\r\n\t// Internal methods.\r\n\tprivate:\r\n/*x*/\tvoid\t\t\t\t\t\t\t_resize\t\t\t\t\t(u32 newSize = -1);\r\n\t\tvoid\t\t\t\t\t\t\t_addToFreeList\t\t\t(s32 idx);\r\n\t\tEntry*\t\t\t\t\t\t\t_popFreeList\t\t\t();\r\n\t\tEntry*\t\t\t\t\t\t\t_popFreeListAndFill\t\t(TKey* key, TValue* value, s32 hashCode, Entry* pNext);\r\n\r\n\tpublic: \r\n\t\tvoid\t\t\t\t\t\t\t_display\t\t\t\t();\r\n\t};\r\n\r\n\r\n\t// ------------------------------------------------------\r\n\t// Virtual methods\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tbool Dictionary<TKey,TValue>::_isInstanceOf(u32 typeID) {\r\n\t\t_INSTANCEOF(Dictionary,Object);\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tu32 Dictionary<TKey,TValue>::_processGC() {\r\n\t\tu32 keyType = __InternalUtilsGetTypeID<TKey>::getIt();\r\n\r\n\t\t// If lastProcessIndex is >= 0 that means the Keys the previous iteration didn't occure \r\n\t\t// OR it was stopped during the Key procession.\r\n\t\t// If it is < 0 that means it was during the Value procession.\r\n\t\t// The next index to process will be ~lastProcessIndex\r\n\t\ts32 lastProcessIndex = (s32)Memory::getLastProcessIndex();\r\n\t\tu32 countMax = Memory::getProcessSizeMax();\r\n\r\n\t\tif(lastProcessIndex >= 0) {\r\n\t\t\tif((keyType & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tif((keyType & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = lastProcessIndex; i < m_count + m_countRemoved; ++i) {\r\n\t\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\t\tif(!countMax) {\r\n\t\t\t\t\t\t\t\tif(((__GCStruct*)(&m_entries[i].m_key))->_processGC() == INCOMPLETE) {\r\n\t\t\t\t\t\t\t\t\t// If the struct _processGC is not completed, the last struct processed will be processed again\r\n\t\t\t\t\t\t\t\t\t// during the next processGC of the Dictionary.\r\n\t\t\t\t\t\t\t\t\tMemory::setLastProcessIndex(i);\r\n\t\t\t\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// Impossible to know how many elements have been added in the list during the _processGC method of the struct with the current implementation\r\n\t\t\t\t\t\t\t// So we must update countMax recalling getProcessSizeMax\r\n\t\t\t\t\t\t\tcountMax = Memory::getProcessSizeMax();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfor(u32 i = Memory::getLastProcessIndex(); i < m_count + m_countRemoved; ++i) {\r\n\t\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\t\tif(!(countMax--)) {\r\n\t\t\t\t\t\t\t\tMemory::setLastProcessIndex(i);\r\n\t\t\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tMemory::pushList(m_entries[i].m_key, 0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tu32 valType = __InternalUtilsGetTypeID<TValue>::getIt();\r\n\r\n\t\tif(lastProcessIndex < 0) {\r\n\t\t\tlastProcessIndex = ~lastProcessIndex;\r\n\t\t}\r\n\r\n\t\tif((valType & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\tif((valType & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\tfor(u32 i = lastProcessIndex; i < m_count + m_countRemoved; ++i) {\r\n\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\tif(!countMax) {\r\n\t\t\t\t\t\t\tif(((__GCStruct*)(&m_entries[i].m_value))->_processGC() == INCOMPLETE) {\r\n\t\t\t\t\t\t\t\tMemory::setLastProcessIndex(~i);\r\n\t\t\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcountMax = Memory::getProcessSizeMax();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor(u32 i = Memory::getLastProcessIndex(); i < m_count + m_countRemoved; ++i) {\r\n\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\tif(!(countMax--)) {\r\n\t\t\t\t\t\t\tMemory::setLastProcessIndex(~i);\r\n\t\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tMemory::pushList(m_entries[i].m_value, 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// There are at least 32 places left.\r\n\t\tif(m_bucketsObject) { Memory::pushList(m_bucketsObject, 0); }\r\n\t\tif(m_entriesObject) { Memory::pushList(m_entriesObject, 0); }\r\n\t\treturn COMPLETE;\r\n\t}\r\n\r\n\t/*virtual*/\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::_move(__GCObject* prevobj, __GCObject* newobj) {\r\n\t\tif((__GCObject*)m_bucketsObject == prevobj) {\r\n\t\t\tm_bucketsObject = (__GCMalloc*)newobj;\r\n\t\t\tm_buckets = (s32*)m_bucketsObject->getBlock();\r\n\t\t} else if((__GCObject*)m_entriesObject == prevobj) {\r\n\t\t\tm_entriesObject = (__GCMalloc*)newobj;\r\n\t\t\tm_entries = (Entry*)m_entriesObject->getBlock();\r\n\r\n\t\t\tif((__InternalUtilsGetTypeID<TKey>::getIt() & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tvoid* old = ((__GCMalloc*)prevobj)->getBlock();\r\n\t\t\t\tif((__InternalUtilsGetTypeID<TKey>::getIt() & ET_CLASS) == ET_CLASS) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\t\t__GCObject** newObj = (__GCObject**)(&m_entries[i].m_key);\r\n\t\t\t\t\t\t\t__GCObject** oldObj = (__GCObject**)(&((Entry*)old)[i].m_key);\r\n\t\t\t\t\t\t\tif(newObj) {\r\n\t\t\t\t\t\t\t\t(*newObj)->_moveRef(oldObj, newObj);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if((__InternalUtilsGetTypeID<TKey>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\t\t__GCStruct* str\t\t= (__GCStruct*)(&m_entries[i].m_key);\r\n\t\t\t\t\t\t\t__GCStruct* oldStr\t= (__GCStruct*)(&((Entry*)old)[i].m_key);\r\n\t\t\t\t\t\t\tif(str) {\r\n\t\t\t\t\t\t\t\tstr->_moveAlert((u8*)str - (u8*)oldStr);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif((__InternalUtilsGetTypeID<TValue>::getIt() & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tvoid* old = ((__GCMalloc*)prevobj)->getBlock();\r\n\t\t\t\tif((__InternalUtilsGetTypeID<TValue>::getIt() & ET_CLASS) == ET_CLASS) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\t\t__GCObject** newObj = (__GCObject**)(&m_entries[i].m_value);\r\n\t\t\t\t\t\t\t__GCObject** oldObj = (__GCObject**)(&((Entry*)old)[i].m_value);\r\n\t\t\t\t\t\t\tif(newObj) {\r\n\t\t\t\t\t\t\t\t(*newObj)->_moveRef(oldObj, newObj);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if((__InternalUtilsGetTypeID<TValue>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\tif(m_entries[i].m_isFilled) {\r\n\t\t\t\t\t\t\t__GCStruct* str\t\t= (__GCStruct*)(&m_entries[i].m_value);\r\n\t\t\t\t\t\t\t__GCStruct* oldStr\t= (__GCStruct*)(&((Entry*)old)[i].m_value);\r\n\t\t\t\t\t\t\tif(str) {\r\n\t\t\t\t\t\t\t\tstr->_moveAlert((u8*)str - (u8*)oldStr);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*virtual*/\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::_releaseGC() {\r\n\t\tif(m_entriesObject) {\r\n\t\t\tif((__InternalUtilsGetTypeID<TKey>::getIt() & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tif((__InternalUtilsGetTypeID<TKey>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\t((__GCStruct*)(&m_entries[i].m_key))->_releaseGC();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\t__GCObject* obj = m_entries[i].m_key;\r\n\t\t\t\t\t\tif(obj && !obj->isFreed()) {\r\n\t\t\t\t\t\t\tobj->_releaseGC();\r\n\t\t\t\t\t\t\tobj->_removeRef((__GCObject**)&(m_entries[i].m_key));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\tif((__InternalUtilsGetTypeID<TValue>::getIt() & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tif((__InternalUtilsGetTypeID<TValue>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\t((__GCStruct*)(&m_entries[i].m_value))->_releaseGC();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\t\t\t\t__GCObject* obj = m_entries[i].m_value;\r\n\t\t\t\t\t\tif(obj && !obj->isFreed()) {\r\n\t\t\t\t\t\t\tobj->_releaseGC();\r\n\t\t\t\t\t\t\tobj->_removeRef((__GCObject**)&(m_entries[i].m_value));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!m_entriesObject->isFreed()) { m_entriesObject->_removeOwner(this); }\r\n\t\t}\r\n\t}\r\n\r\n\t/*virtual*/\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::_moveAlert(u32 offset) {\r\n\t\tObject::_moveAlert(offset);\r\n\t\tif(m_bucketsObject) { m_bucketsObject->_moveOwnerAsRef((__GCObject**)((u8*)this - offset) , (__GCObject**)this); }\r\n\t\tif(m_entriesObject) { m_entriesObject->_moveOwnerAsRef((__GCObject**)((u8*)this - offset) , (__GCObject**)this); }\r\n\t}\r\n\r\n\t// ------------------------------------------------------\r\n\t\r\n\t// ------------------------------------------------------\r\n\t// Constructor - Destructor\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tDictionary<TKey,TValue>::Dictionary(s32 capacity) \r\n\t: m_buckets\t\t\t(NULL)\r\n\t, m_entries\t\t\t(NULL)\r\n\t, m_freeList\t\t(NULL)\r\n\t, m_bucketsObject\t(NULL)\r\n\t, m_entriesObject\t(NULL)\r\n\t, m_count\t\t\t(0)\r\n\t, m_capacity\t\t(capacity)\r\n\t, m_countRemoved\t(0)\r\n\t{\r\n\t\tm_buckets\t= (s32*)\t__GCMalloc::allocBlock(sizeof(s32)   * capacity, m_bucketsObject);\r\n\t\tm_entries\t= (Entry*)\t__GCMalloc::allocBlock(sizeof(Entry) * capacity, m_entriesObject);\r\n\t\tm_bucketsObject->_addOwner(this);\r\n\t\tm_entriesObject->_addOwner(this);\r\n\r\n\t\tmemset32(m_buckets, 0xFFFFFFFF, capacity * sizeof(s32));\r\n\t\tfor(s32 i = 0; i < capacity - 1; ++i) {\r\n\t\t\tm_entries[i].m_pNext = &m_entries[i+1];\r\n\t\t}\r\n\t\tm_entries[capacity - 1].m_pNext = NULL;\r\n\t\tm_freeList = m_entries;\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tDictionary<TKey,TValue>::~Dictionary() {\r\n\t\t_releaseGC();\r\n\t}\r\n\r\n\t// ------------------------------------------------------\r\n\r\n\t// ------------------------------------------------------\r\n\t// Internal Methods\r\n\r\n\t//\r\n\t// Cannot be implemented inside the template class because of partial template specialization\r\n\t// This is impossible to specialize a single method into a generic class.\r\n\t// We should have specialized the whole class.\r\n\t//\r\n\ttemplate<class T>\r\n\tinline void _dico_RefSetValue(T* itemPtr, T* newValPtr) { \r\n\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\tif(newValPtr) {\r\n\t\t\t\t((__GCStruct*)(itemPtr))->_RefSetValue(newValPtr);\r\n\t\t\t} else {\r\n\t\t\t\t((__GCStruct*)(itemPtr))->_RefSetValue((T*)__InternalUtils::m_nullStruct);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif(newValPtr) {\r\n\t\t\t\t__GCObject::_RefSetValue((__GCObject**)(itemPtr), *(__GCObject**)newValPtr);\r\n\t\t\t} else {\r\n\t\t\t\t__GCObject::_RefSetValue((__GCObject**)(itemPtr), NULL);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\ttemplate<>\tinline void _dico_RefSetValue(u64*\t\titemPtr, u64*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(s64*\t\titemPtr, s64*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(u32*\t\titemPtr, u32*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(s32*\t\titemPtr, s32*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(u16*\t\titemPtr, u16*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(s16*\t\titemPtr, s16*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(u8*\t\titemPtr, u8*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(s8*\t\titemPtr, s8*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(bool*\t\titemPtr, bool*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(float*\titemPtr, float*\tnewVal)\t{ *itemPtr = *newVal; }\r\n\ttemplate<>\tinline void _dico_RefSetValue(double*\titemPtr, double*newVal)\t{ *itemPtr = *newVal; }\r\n\r\n\ttemplate<class T>\r\n\tinline void _dico_RefResetValue(T* oldPtr, T* newPtr, T* itemPtr) { \r\n\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\tif(newPtr) {\r\n\t\t\t\t*newPtr = *itemPtr;\r\n\t\t\t\t((__GCStruct*)itemPtr)->_moveAlert((u8*)newPtr - (u8*)oldPtr);\r\n\t\t\t} else {\r\n\t\t\t\t((__GCStruct*)(itemPtr))->_RefSetValue((T*)__InternalUtils::m_nullStruct);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif(newPtr) {\r\n\t\t\t\t*newPtr = *itemPtr;\r\n\t\t\t\t(*(__GCObject**)itemPtr)->_moveRef((__GCObject**)oldPtr, (__GCObject**)newPtr);\r\n\t\t\t} else {\r\n\t\t\t\t__GCObject::_RefSetValue((__GCObject**)(itemPtr), NULL);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\ttemplate<>\tinline void _dico_RefResetValue(u64*\t/*oldPtr*/,\tu64*\tnewPtr,\tu64*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(s64*\t/*oldPtr*/,\ts64*\tnewPtr,\ts64*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(u32*\t/*oldPtr*/,\tu32*\tnewPtr,\tu32*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(s32*\t/*oldPtr*/,\ts32*\tnewPtr,\ts32*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(u16*\t/*oldPtr*/,\tu16*\tnewPtr,\tu16*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(s16*\t/*oldPtr*/,\ts16*\tnewPtr,\ts16*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(u8 *\t/*oldPtr*/,\tu8 *\tnewPtr,\tu8*\t\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(s8 *\t/*oldPtr*/,\ts8 *\tnewPtr,\ts8*\t\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(bool*\t/*oldPtr*/,\tbool*\tnewPtr,\tbool*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(float*\t/*oldPtr*/,\tfloat*\tnewPtr,\tfloat*\titemPtr) { *itemPtr = *newPtr; }\r\n\ttemplate<>\tinline void _dico_RefResetValue(double*\t/*oldPtr*/,\tdouble*\tnewPtr,\tdouble*\titemPtr) { *itemPtr = *newPtr; }\r\n\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tDictionary<TKey,TValue>::Entry::Entry()\r\n\t: m_pNext\t(NULL)\r\n\t, m_isFilled(false)\r\n\t{\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tDictionary<TKey,TValue>::Entry::Entry(TKey key, TValue value, s32 hashCode, Entry* next)\r\n\t: m_hashCode(hashCode)\r\n\t, m_pNext\t(next)\r\n\t, m_isFilled(true)\r\n\t{\r\n\t\t_dico_RefSetValue(&m_key, &key);\r\n\t\t_dico_RefSetValue(&m_value, &value);\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::Entry::set(TKey key, TValue value, s32 hashCode, Entry* next) {\r\n\t\ttemplate <class T>\r\n\t\t_dico_RefSetValue(&m_key, &key);\r\n\t\t_dico_RefSetValue(&m_value, &value);\r\n\t\tm_hashCode\t= hashCode;\r\n\t\tm_pNext\t\t= next;\r\n\t\tm_isFilled\t= true;\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tDictionary<TKey,TValue>::Entry::~Entry() \r\n\t{\r\n\t\t_dico_RefSetValue(&m_key, (T*)NULL);\r\n\t\t_dico_RefSetValue(&m_value, (T*)NULL);\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::_addToFreeList(s32 idx) {\r\n\t\tm_entries[idx].m_pNext\t= m_freeList;\r\n\t\tm_freeList\t\t\t\t= &m_entries[idx];\r\n\t\t_dico_RefSetValue(&(m_entries[idx].m_key),   (TKey*)NULL);\r\n\t\t_dico_RefSetValue(&(m_entries[idx].m_value), (TValue*)NULL);\r\n\t\tm_count--;\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\ttypename Dictionary<TKey,TValue>::Entry* Dictionary<TKey,TValue>::_popFreeList() {\r\n\t\tif(m_freeList) {\r\n\t\t\tif(m_countRemoved > 0) {\r\n\t\t\t\tm_countRemoved--;\r\n\t\t\t}\r\n\t\t\tEntry* ret\t\t= m_freeList;\r\n\t\t\tm_freeList\t\t= m_freeList->m_pNext;\r\n\t\t\tret->m_pNext\t= NULL;\r\n\t\t\treturn ret;\r\n\t\t} else {\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\ttypename Dictionary<TKey,TValue>::Entry* Dictionary<TKey,TValue>::_popFreeListAndFill(TKey* key, TValue* value, s32 hashCode, Entry* pNext) {\r\n\t\tif(m_freeList) {\r\n\t\t\tif(m_countRemoved > 0) {\r\n\t\t\t\tm_countRemoved--;\r\n\t\t\t}\r\n\r\n\t\t\tEntry* ret = m_freeList;\r\n\t\t\tm_freeList = m_freeList->m_pNext;\r\n\r\n\t\t\t_dico_RefSetValue(&ret->m_key, key);\r\n\t\t\t_dico_RefSetValue(&ret->m_value, value);\r\n\t\t\tret->m_hashCode\t= hashCode;\r\n\t\t\tret->m_pNext\t= pNext;\r\n\t\t\tret->m_isFilled = false;\r\n\r\n\t\t\treturn ret;\r\n\t\t} else {\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::_resize(u32 newSize) {\r\n\t\ts32 idx = __InternalUtils::_binarySearch((u32*)_dictionary_primeArray, 0, 772, (newSize == -1) ? (m_capacity << 1) : newSize);\r\n\t\t\r\n\t\t// TODO : ok for this exception?\r\n\t\tif(idx == -1)\t{ THROW(CS_NEW OutOfMemoryException()); }\r\n\r\n\t\tm_count = 0;\r\n\t\tu32 newCapacity = (idx == 0) ? _dictionary_primeArray[0] : _dictionary_primeArray[~idx];\r\n\t\t\r\n\t\tm_bucketsObject->_removeOwner(this);\r\n\t\tm_entriesObject->_removeOwner(this);\r\n\t\ts32*   newBuckets\t= (s32*)\t__GCMalloc::allocBlock(sizeof(s32)   * newCapacity, m_bucketsObject);\r\n\t\tEntry* newEntries\t= (Entry*)\t__GCMalloc::allocBlock(sizeof(Entry) * newCapacity, m_entriesObject);\r\n\t\tm_bucketsObject->_addOwner(this);\r\n\t\tm_entriesObject->_addOwner(this);\r\n\t\tmemset32(newBuckets, 0xFFFFFFFF, newCapacity * sizeof(s32));\r\n\r\n\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\tif(m_buckets[i] != -1) {\r\n\t\t\t\tEntry* pEntry = &m_entries[m_buckets[i]];\r\n\t\t\t\twhile(pEntry) {\r\n\t\t\t\t\tu32 newIdx\t\t\t= pEntry->m_hashCode % newCapacity;\r\n\t\t\t\t\tEntry* pNewEntry\t= &newEntries[m_count++];\r\n\t\t\t\t\tif(newBuckets[newIdx] != -1) {\r\n\t\t\t\t\t\tpNewEntry->m_pNext = &newEntries[newBuckets[newIdx]];\r\n\t\t\t\t\t}\r\n\t\t\t\t\t_dico_RefResetValue(&pEntry->m_key,\t\t&pNewEntry->m_key,\t\t&pEntry->m_key);\r\n\t\t\t\t\t_dico_RefResetValue(&pEntry->m_value,\t&pNewEntry->m_value,\t&pEntry->m_value);\r\n\t\t\t\t\tpNewEntry->m_hashCode\t= pEntry->m_hashCode;\r\n\t\t\t\t\tpNewEntry->m_isFilled\t= pEntry->m_isFilled;\r\n\t\t\t\t\tnewBuckets[newIdx]\t\t= pNewEntry - newEntries;\r\n\r\n\t\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tm_buckets\t= newBuckets;\r\n\t\tm_entries\t= newEntries;\r\n\t\tm_capacity\t= newCapacity;\r\n\t\tm_freeList  = &newEntries[m_count];\r\n\t\tfor(u32 i = m_count; i < m_capacity - 1; ++i) {\r\n\t\t\tnewEntries[i].m_pNext = &newEntries[i+1];\r\n\t\t}\r\n\t\tnewEntries[m_capacity].m_pNext = NULL;\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tinline void Dictionary<TKey,TValue>::_display() {\r\n\t\t\r\n\t}\r\n\r\n\ttemplate<>\r\n\tinline void Dictionary<System::String*,System::String*>::_display() {\r\n\t\tfor(u32 i = 0; i < m_capacity; ++i) {\r\n\t\t\tEntry* pEntry\t= &m_entries[i];\r\n\t\t\tif(pEntry && pEntry->m_key && pEntry->m_value) {\r\n\t\t\t\tprintf(\"Key = %s Value = %s\\n\", pEntry->m_key->PadRight(15)->_toCStr(), pEntry->m_value->_toCStr());\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// ------------------------------------------------------\r\n\r\n\t// ------------------------------------------------------\r\n\t// Properties\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tTValue& Dictionary<TKey,TValue>::_idx_g(TKey key) {\r\n\t\tif(__InternalUtils::_isNullPtr(key)) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tu32 idx\t\t\t= m_buckets[__InternalUtils::_getHashCode(key) % m_capacity];\r\n\t\tEntry* pEntry\t= NULL;\r\n\t\tif(idx != -1) {\r\n\t\t\tpEntry = &m_entries[idx];\r\n\r\n\t\t\twhile(pEntry && !__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(!pEntry) { THROW(CS_NEW KeyNotFoundException()); }\r\n\r\n\t\treturn pEntry->m_value;\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tTValue Dictionary<TKey,TValue>::_idx_s(TKey key, TValue value) {\r\n\t\tif(__InternalUtils::_isNullPtr(key)) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tu32 hashCode\t= __InternalUtils::_getHashCode(key);\r\n\t\tu32 idx\t\t\t= hashCode % m_capacity;\r\n\t\tEntry* pEntry\t= &m_entries[m_buckets[idx]];\r\n\r\n\t\t// if a bucket is empty, it will contain -1\r\n\t\tif(m_buckets[idx] != -1) {\r\n\t\t\twhile((pEntry->m_pNext) && !__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t}\r\n\t\t\tif(!__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpEntry = _popFreeListAndFill(&key, NULL, hashCode, &m_entries[m_buckets[idx]]);\r\n\t\t\t\tm_count++;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tpEntry = _popFreeListAndFill(&key, NULL, hashCode, NULL);\r\n\t\t\tm_count++;\r\n\t\t}\r\n\t\t_dico_RefSetValue(&pEntry->m_value, &value);\r\n\t\tpEntry->m_isFilled\t= true;\r\n\t\tm_buckets[idx]\t\t= pEntry - m_entries;\r\n\r\n\t\tif(m_count == m_capacity) {\r\n\t\t\t_resize();\r\n\t\t}\r\n\r\n\t\treturn value;\r\n\t}\r\n\r\n\t// ------------------------------------------------------\r\n\r\n\t// ------------------------------------------------------\r\n\t// Methods\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey,TValue>::Add(TKey key, TValue value) {\r\n\t\tif(__InternalUtils::_isNullPtr(key)) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tu32 hashCode\t= __InternalUtils::_getHashCode(key);\r\n\t\tu32 idx\t\t\t= hashCode % m_capacity;\r\n\t\tEntry* pEntry\t= NULL;\r\n\t\tif(m_buckets[idx] != -1) {\r\n\t\t\tpEntry = &m_entries[m_buckets[idx]];\r\n\t\t\twhile((pEntry->m_pNext) && !__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t}\r\n\t\t\tif(__InternalUtils::_areEqual(pEntry->m_key, key)) { THROW(CS_NEW ArgumentException()); }\r\n\t\t}\r\n\r\n\t\tpEntry = _popFreeList();\r\n\t\t_dico_RefSetValue(&pEntry->m_key, &key);\r\n\t\t_dico_RefSetValue(&pEntry->m_value, &value);\r\n\t\tpEntry->m_hashCode\t= hashCode;\r\n\t\tpEntry->m_isFilled\t= true;\r\n\t\t// if a bucket is empty, it will contain -1\r\n\t\tif(m_buckets[idx] != -1) {\r\n\t\t\tpEntry->m_pNext = &m_entries[m_buckets[idx]];\r\n\t\t}\r\n\t\t\r\n\t\tm_buckets[idx] = pEntry - m_entries;\r\n\t\tm_count++;\r\n\r\n\t\tif(m_count == m_capacity) {\r\n\t\t\t_resize();\r\n\t\t}\r\n\t}\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tvoid Dictionary<TKey, TValue>::Clear() {\r\n\t\tfor(u32 i = 0; i < m_capacity - 1; ++i) {\r\n\t\t\tm_entries[i].m_pNext = &m_entries[i+1];\r\n\t\t\t_dico_RefSetValue(&m_entries[i].m_value, (TValue*)NULL);\r\n\t\t}\r\n\t\tm_entries[m_capacity - 1].m_pNext = NULL;\r\n\t\tm_freeList = m_entries;\r\n\r\n\t\tmemset32(m_buckets, 0xFFFFFFFF, m_capacity * sizeof(s32));\r\n\r\n\t\tm_count\t\t= 0;\r\n\t}\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tbool Dictionary<TKey,TValue>::ContainsKey(TKey key) {\r\n\t\tif(__InternalUtils::_isNullPtr(key)) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\t\r\n\t\tu32 idx\t\t\t= m_buckets[__InternalUtils::_getHashCode(key) % m_capacity];\r\n\t\tEntry* pEntry\t= NULL;\r\n\t\tif(idx != -1) {\r\n\t\t\tpEntry = &m_entries[idx];\r\n\r\n\t\t\twhile(pEntry && !__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn (pEntry != NULL);\r\n\t}\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tbool Dictionary<TKey,TValue>::ContainsValue(TValue value) {\r\n\t\tfor(u32 i = 0; i < (m_count + m_countRemoved); ++i) {\r\n\t\t\tEntry* pEntry\t= &m_entries[i];\r\n\t\t\tif(pEntry->m_isFilled) {\r\n\t\t\t\twhile((pEntry->m_pNext) && !__InternalUtils::_areEqual(pEntry->m_value, value)) {\r\n\t\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t\t}\r\n\t\t\t\tif(__InternalUtils::_areEqual(pEntry->m_value, value)) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tbool Dictionary<TKey,TValue>::Remove(TKey key) {\r\n\t\tif(__InternalUtils::_isNullPtr(key)) { THROW(CS_NEW ArgumentNullException()); }\r\n\r\n\t\tu32 hashCodeMod\t= __InternalUtils::_getHashCode(key) % m_capacity;\r\n\t\tu32 idx\t\t\t= m_buckets[hashCodeMod];\r\n\t\tEntry* pEntry\t= NULL;\r\n\t\t\r\n\t\tif(idx != -1) {\r\n\t\t\tpEntry = &m_entries[idx];\r\n\t\t\tif(__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tif(pEntry->m_pNext) {\r\n\t\t\t\t\tm_buckets[hashCodeMod] = pEntry->m_pNext - m_entries;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_buckets[hashCodeMod] = -1;\r\n\t\t\t\t}\r\n\t\t\t\t_addToFreeList(idx);\r\n\t\t\t\tm_countRemoved++;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\tEntry* pPrev\t= pEntry;\r\n\t\t\tpEntry\t\t\t= pEntry->m_pNext;\r\n\t\t\twhile(pEntry && !__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpPrev\t= pEntry;\r\n\t\t\t\tpEntry\t= pEntry->m_pNext;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(pEntry) {\r\n\t\t\t\tpPrev->m_pNext = pEntry->m_pNext;\r\n\t\t\t\t_addToFreeList(pEntry - m_entries);\r\n\t\t\t\tm_countRemoved++;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tbool Dictionary<TKey,TValue>::_ref_TryGetValue(TKey key, /*out*/ TValue& value) {\r\n\t\tif(__InternalUtils::_isNullPtr(key)) { THROW(CS_NEW ArgumentNullException()); }\r\n\t\t\r\n\t\tu32 idx\t\t\t= m_buckets[__InternalUtils::_getHashCode(key) % m_capacity];\r\n\t\tEntry* pEntry\t= NULL;\r\n\t\tif(idx != -1) {\r\n\t\t\tpEntry = &m_entries[idx];\r\n\r\n\t\t\twhile(pEntry && !__InternalUtils::_areEqual(pEntry->m_key, key)) {\r\n\t\t\t\tpEntry = pEntry->m_pNext;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(!pEntry) {\r\n\t\t\tvalue = (TValue)NULL;\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvalue = pEntry->m_value;\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\ttemplate<class TKey, class TValue>\r\n\tbool Dictionary<TKey,TValue>::TryGetValue(TKey key, /*out*/ TValue& value) {\r\n\t\tSystem::RefHolder _cs_refholder_loc_array[1];\r\n\t\tu32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array);\r\n\t\tbool r = _ref_TryGetValue(key, value);\r\n\t\t_refRemove_(_cs_count_refholder,_cs_refholder_loc_array);\r\n\t\treturn r;\r\n\t}\r\n\r\n}\r\n}\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/Collections/Generic/CS_List.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CS_List.h\"\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/Collections/Generic/CS_List.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _CS_List_\r\n#define _CS_List_\r\n\r\n#include \"../../CS_Object.h\"\r\n#include \"../../CS_Array.h\"\r\n#include \"../Collections.h\"\r\n#include \"Generic.h\"\r\n#include \"../../InternalUtils.h\"\r\n\r\nnamespace System {\r\nnamespace Collections {\r\nnamespace Generic {\r\n    \r\n\t///\r\n\t/// List<T>\r\n\t/// C# documentation : http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx\r\n\t///\r\n\t///\r\n    template<class T>\r\n    class List : public Object {\r\n        \r\n    private:\r\n        static const u32\t_TYPEID = _TYPE_LIST;\r\n\r\n        u32\t\t\tm_count;\r\n        u32\t\t\tm_capacity;\r\n        T*\t\t\tm_list;\r\n\t\t__GCMalloc* m_listObject;\r\n    public:\r\n        virtual bool\t_isInstanceOf\t(u32 typeID);\r\n\t\tvirtual\tu32\t\t_processGC\t\t();\r\n\t\tvirtual void\t_releaseGC\t\t();\r\n\t\tvirtual void\t_move\t\t\t(__GCObject* prevobj, __GCObject* newobj);\r\n\t\tvirtual void\t_moveAlert\t\t(u32 offset);\r\n    public:\r\n        // Constructors\r\n        List<T>();\r\n/*x*/   List<T>(System::Collections::Generic::IEnumerable<T>*);\r\n        List<T>(s32 capacity);\r\n\r\n\t\t~List();\r\n\r\n\t\tvoid\t\t\t_list_refSetValue\t\t(s32 idx, T item);\r\n\t\tvoid\t\t\t_list_removeValue\t\t(s32 idx);\r\n\t\tinline void\t\t_setMemCpy\t\t\t\t(const void* buffer)\t{ memcpy(m_list, buffer, m_count * m_sizeOfElement);\t}\r\n\t\tinline List<T>* _s\t\t\t\t\t\t(s32 idx, T item)\t\t{ _list_refSetValue(idx, item); return this;\t\t\t}\r\n        \r\n        // Properties\r\n        inline s32      _acc_gCapacity\t\t\t()\t\t\t\t\t{ return (s32)m_capacity;\t\t\t\t}\r\n        inline s32      _acc_gCapacity$\t\t\t()\t\t\t\t\t{ CHCKTHIS; return _acc_gCapacity();\t}\r\n        inline s32      _acc_gCount\t\t\t\t()\t\t\t\t\t{ return (s32)m_count;\t\t\t\t\t}\r\n        inline s32      _acc_gCount$\t\t\t()\t\t\t\t\t{ CHCKTHIS; return _acc_gCount();\t\t}\r\n        inline\tT&      _idx_g\t\t\t\t\t(s32 idx)\t\t\t{ return m_list[idx];\t\t\t\t\t}\r\n        inline\tT&      _idx_g$\t\t\t\t\t(s32 idx)\t\t\t{ CHCKTHIS; return _idx_g(idx);\t\t\t}\r\n        inline\tT&      _idx$_g\t\t\t\t\t(s32 idx)\t\t\t{ if (((u32)idx) >= m_count) { THROW(CS_NEW ArgumentOutOfRangeException()); } return m_list[idx]; }\r\n\t\tinline\tT&      _idx$_g$\t\t\t\t(s32 idx)\t\t\t{ CHCKTHIS; return _idx$_g(idx);\t\t}\r\n\t\tinline\tT\t\t_idx_s\t\t\t\t\t(s32 idx, T item)\t{ _list_refSetValue(idx, item);\treturn item;\t}\r\n\t\tinline\tT\t\t_idx_s$\t\t\t\t\t(s32 idx, T item)\t{ CHCKTHIS; return _idx_s(idx, item);\t}\r\n\t\tinline\tT\t\t_idx$_s\t\t\t\t\t(s32 idx, T item)\t{ if (((u32)idx) >= m_count) { THROW(CS_NEW ArgumentOutOfRangeException()); } _list_refSetValue(idx, item); return item; }\r\n\t\tinline\tT\t    _idx$_s$\t\t\t\t(s32 idx, T item)\t{ CHCKTHIS; return _idx$_s(idx, item);\t}\r\n\t\tvoid            _acc_sCapacity\t\t\t(s32 val);\r\n\t\tinline void     _acc_sCapacity$\t\t\t(s32 val)\t\t\t{ CHCKTHIS; _acc_sCapacity();\t\t\t}\r\n\r\n        // Methods\r\n\t    void            Add\t\t\t\t\t\t(T item);\r\n\t\tinline void     Add$\t\t\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Add(item);\t\t\t\t\t\t\t}\r\n\t\tinline List<T>*\tAddRT\t\t\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ Add(item); return this;\t\t\t\t\t\t}\r\n/*x*/   void            AddRange\t\t\t\t(System::Collections::Generic::IEnumerable<T>* collection);\r\n/*x*/   //ReadOnlyCollection<T>* AsReadOnly\t\t(); //System.Collections.ObjectModel.ReadOnlyCollection<T>\r\n\t\ts32             BinarySearch\t\t\t(T item);\r\n\t\tinline s32      BinarySearch$\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return BinarySearch(item);\t\t\t}\r\n/*x*/   s32             BinarySearch\t\t\t(T item, System::Collections::Generic::IComparer<T>* comparer);\r\n/*x*/   s32             BinarySearch\t\t\t(s32 idx, s32 count, T item, System::Collections::Generic::IComparer<T>* comparer);\r\n\t\tvoid            Clear\t\t\t\t\t();\r\n\t\tinline void     Clear$\t\t\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Clear();\t\t\t\t\t\t\t}\r\n\t\tbool            Contains\t\t\t\t(T item);\r\n\t\tinline bool     Contains$\t\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Contains(item);\t\t\t\t}\r\n        \r\n/*x*/   /*List<TOutput>*  ConvertAll<TOutput>   (Converter<T, TOutput>* converter);*/\r\n        \r\n\t\tvoid            CopyTo\t\t\t\t\t(Array<T>* _array);\r\n\t\tinline void     CopyTo$\t\t\t\t\t(Array<T>* _array)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; CopyTo(_array);\t\t\t\t\t\t}\r\n\t\tvoid            CopyTo\t\t\t\t\t(Array<T>* _array, s32 arrayIndex);\r\n\t\tinline void     CopyTo$\t\t\t\t\t(Array<T>* _array, s32 arrayIndex)\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; CopyTo(_array, arrayIndex);\t\t\t}\r\n\t\tvoid            CopyTo\t\t\t\t\t(s32 index, Array<T>* _array, s32 arrayIndex, s32 count);\r\n\t\tinline void     CopyTo$\t\t\t\t\t(s32 index, Array<T>* _array, s32 arrayIndex, s32 count)\t\t\t\t\t\t\t\t{ CHCKTHIS; CopyTo(index, _array, arrayIndex, count);\t}\r\n/*x*/   /*bool          Exists\t\t\t\t\t(Predicate<T>* match);\r\n/*x*/   //T             Find\t\t\t\t\t(Predicate<T>* match);\r\n/*x*/   //List<T>*      FindAll\t\t\t\t\t(Predicate<T>* match);\r\n/*x*/   //int           FindIndex\t\t\t\t(Predicate<T>* match);\r\n/*x*/   //int           FindIndex\t\t\t\t(s32 startIndex, Predicate<T>* match);\r\n/*x*/   //int           FindIndex\t\t\t\t(s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/   //T             FindLast\t\t\t\t(Predicate<T>* match);\r\n/*x*/   //int           FindLastIndex\t\t\t(Predicate<T>* match);\r\n/*x*/   //int           FindLastIndex\t\t\t(int startIndex, Predicate<T>* match);\r\n/*x*/   //int           FindLastIndex\t\t\t(int startIndex, s32 count, Predicate<T>* match);\r\n/*x*/   //void          ForEach\t\t\t\t\t(Action<T>* action);*/\r\n/*x*/   /*List<T>.Enumerator GetEnumerator\t\t();*/\r\n\t\tList<T>*        GetRange\t\t\t\t(s32 index, s32 count);\r\n\t\tinline List<T>* GetRange$\t\t\t\t(s32 index, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return GetRange(index, count);\t\t\t}\r\n\t\tint             IndexOf\t\t\t\t\t(T item);\r\n\t\tinline int      IndexOf$\t\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(item);\t\t\t\t\t}\r\n\t\tint             IndexOf\t\t\t\t\t(T item, s32 index);\r\n\t\tinline int      IndexOf$\t\t\t\t(T item, s32 index)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(item, index);\t\t\t}\r\n\t\tint             IndexOf\t\t\t\t\t(T item, s32 index, s32 count);\r\n\t\tinline int      IndexOf$\t\t\t\t(T item, s32 index, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return IndexOf(item, index, count);\t\t}\r\n\t\tvoid            Insert\t\t\t\t\t(s32 index, T item);\r\n\t\tinline void     Insert$\t\t\t\t\t(s32 index, T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Insert(index, item);\t\t\t\t\t}\r\n/*x*/   void            InsertRange\t\t\t\t(s32 index, System::Collections::Generic::IEnumerable<T>* collection);\r\n\t\tint             LastIndexOf\t\t\t\t(T item);\r\n\t\tinline int      LastIndexOf$\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(item);\t\t\t\t}\r\n\t\tint             LastIndexOf\t\t\t\t(T item, s32 index);\r\n\t\tinline int      LastIndexOf$\t\t\t(T item, s32 index)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(item, index);\t\t}\r\n\t\tint             LastIndexOf\t\t\t\t(T item, s32 index, s32 count);\r\n\t\tinline int      LastIndexOf$\t\t\t(T item, s32 index, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return LastIndexOf(item, index, count);\t}\r\n\t\tbool            Remove\t\t\t\t\t(T item);\r\n\t\tinline bool     Remove$\t\t\t\t\t(T item)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return Remove(item);\t\t\t\t\t}\r\n/*x*/   //int           RemoveAll\t\t\t\t(Predicate<T> match);\r\n\t\tvoid            RemoveAt\t\t\t\t(s32 index);\r\n\t\tinline void     RemoveAt$\t\t\t\t(s32 index)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; RemoveAt(index);\t\t\t\t\t\t}\r\n\t\tvoid            RemoveRange\t\t\t\t(s32 index, s32 count);\r\n\t\tinline void     RemoveRange$\t\t\t(s32 index, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; RemoveRange(index, count);\t\t\t\t}\r\n\t\tvoid            Reverse\t\t\t\t\t();\r\n\t\tinline void     Reverse$\t\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Reverse();\t\t\t\t\t\t\t\t}\r\n\t\tvoid            Reverse\t\t\t\t\t(s32 index, s32 count);\r\n\t\tinline void     Reverse$\t\t\t\t(s32 index, s32 count)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Reverse(index, count);\t\t\t\t\t}\r\n\t\tvoid            Sort\t\t\t\t\t();\r\n\t\tinline void     Sort$\t\t\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; Sort();\t\t\t\t\t\t\t\t\t}\r\n/*x*/   //void          Sort\t\t\t        (Comparison<T> comparison);\r\n/*x*/   void            Sort\t\t            (System::Collections::Generic::IComparer<T>* comparer);\r\n/*x*/   void            Sort\t\t\t\t    (s32 index, s32 count, System::Collections::Generic::IComparer<T>* comparer);\r\n\t\tArray<T>*       ToArray\t\t\t\t    ();\r\n\t\tinline Array<T>*ToArray$\t\t\t\t()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; return ToArray();\t\t\t\t\t\t}\r\n\t\tvoid            TrimExcess\t\t        ();\r\n\t\tinline void     TrimExcess$\t\t        ()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ CHCKTHIS; TrimExcess();\t\t\t\t\t\t\t}\r\n/*x*/   //bool          TrueForAll\t\t\t\t(Predicate<T> match);\r\n        \r\n\tprivate:\r\n\t\tvoid\t\t\t_valueType_Sort\t\t\t();\r\n\t\ts32\t\t\t\t_valueType_BinarySearch\t(T item);\r\n    };\r\n\r\n\r\n\t// -----------------------------------------------------------------------\r\n\t// refSetValue.\r\n\r\n\ttemplate <class T>\r\n\tinline void List<T>::_list_refSetValue(s32 idx, T item) { \r\n\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t((__GCStruct*)(m_list + idx))->_RefSetValue(&item);\r\n\t\t} else {\r\n\t\t\t__GCObject::_RefSetValue((__GCObject**)(m_list + idx), (__GCObject*)item);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate <> inline void List<u64>::_list_refSetValue\t(s32 idx, u64 item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<s64>::_list_refSetValue\t(s32 idx, s64 item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<u32>::_list_refSetValue\t(s32 idx, u32 item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<s32>::_list_refSetValue\t(s32 idx, s32 item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<u16>::_list_refSetValue\t(s32 idx, u16 item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<s16>::_list_refSetValue\t(s32 idx, s16 item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<u8>::_list_refSetValue\t\t(s32 idx, u8  item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<s8>::_list_refSetValue\t\t(s32 idx, s8  item)\t\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<bool>::_list_refSetValue\t(s32 idx, bool item)\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<double>::_list_refSetValue\t(s32 idx, double item)\t{ m_list[idx] = item; }\r\n\ttemplate <> inline void List<float>::_list_refSetValue\t(s32 idx, float item)\t{ m_list[idx] = item; }\r\n\r\n\ttemplate <class T>\r\n\tinline void List<T>::_list_removeValue(s32 idx) { \r\n\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t((__GCStruct*)(m_list + idx))->_RefSetValue((T*)__InternalUtils::m_nullStruct);\r\n\t\t} else {\r\n\t\t\t__GCObject::_RefSetValue((__GCObject**)(m_list + idx), (__GCObject*)NULL);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate <> inline void List<u64>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<s64>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<u32>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<s32>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<u16>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<s16>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<u8>::_list_removeValue\t\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<s8>::_list_removeValue\t\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<bool>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<double>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\ttemplate <> inline void List<float>::_list_removeValue\t(s32 idx)\t{ m_list[idx] = 0; }\r\n\r\n\t// -----------------------------------------------------------------------\r\n\t// Virtual methods.\r\n\r\n\t/*virtual*/\r\n\ttemplate<class T>\r\n\tu32 List<T>::_processGC() {\r\n\r\n\t\tu32 lastProcessIndex\t= Memory::getLastProcessIndex();\r\n\t\tu32 countMax\t\t\t= Memory::getProcessSizeMax();\r\n\r\n\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t\t// There will always be a struct in i event if it is a 0 filled one.\r\n\t\t\t\tif(countMax > 0) {\r\n\t\t\t\t\tif(((__GCStruct*)(&m_list[i]))->_processGC() == INCOMPLETE) {\r\n\t\t\t\t\t\tMemory::setLastProcessIndex(i);\r\n\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcountMax = Memory::getProcessSizeMax();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor(u32 i = lastProcessIndex; i < m_count; ++i) {\r\n\t\t\t\tif(m_list[i]) {\r\n\t\t\t\t\tif(!countMax--) {\r\n\t\t\t\t\t\tMemory::setLastProcessIndex(i);\r\n\t\t\t\t\t\treturn INCOMPLETE;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tMemory::pushList(m_list[i],0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// There are at least 32 places left.\r\n\t\tif(m_listObject) { \r\n\t\t\tMemory::pushList(m_listObject, 0);\r\n\t\t}\r\n\t\treturn COMPLETE;\r\n\t}\r\n\ttemplate<> inline u32 List<s32>::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<u32>::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<s16>::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<u16>::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<s8 >::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<u8 >::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<s64>::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<u64>::_processGC\t\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<float>::_processGC\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<double>::_processGC\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<bool>::_processGC\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\ttemplate<> inline u32 List<s32*>::_processGC\t()\t{ if(m_listObject) { Memory::pushList(m_listObject, 0); } return COMPLETE; }\r\n\r\n\t/*virtual*/\r\n\ttemplate<class T>\r\n\tbool List<T>::_isInstanceOf(u32 typeID) {\r\n\t\t_INSTANCEOF(List,Object);\r\n\t};\r\n\r\n\t/*virtual*/\r\n\ttemplate<class T>\r\n\tvoid List<T>::_move(__GCObject* prevobj, __GCObject* newobj) {\r\n\t\tif((__GCObject*)m_listObject == prevobj) {\r\n\t\t\tm_listObject = (__GCMalloc*)newobj;\r\n\t\t\tm_list = (T*)m_listObject->getBlock();\r\n\r\n\t\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tvoid* old = ((__GCMalloc*)prevobj)->getBlock();\r\n\t\t\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_CLASS) == ET_CLASS) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t\t\t\t__GCObject** obj = (__GCObject**)(m_list + i);\r\n\t\t\t\t\t\tif(*obj) {\r\n\t\t\t\t\t\t\t(*obj)->_moveRef((__GCObject**)((T*)old + i), obj);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t\t\t\t__GCStruct* str = (__GCStruct*)(m_list + i);\r\n\t\t\t\t\t\tif(str) {\r\n\t\t\t\t\t\t\tstr->_moveAlert((u8*)str - (u8*)((T*)old + i));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*virtual*/\r\n\ttemplate<class T>\r\n\tvoid List<T>::_releaseGC() {\r\n\t\tif(m_listObject) {\r\n\t\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_BASETYPE) != ET_BASETYPE) {\r\n\t\t\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t\t\t\t((__GCStruct*)(m_list + i))->_releaseGC();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t\t\t\t__GCObject* obj = *(__GCObject**)(m_list + i);\r\n\t\t\t\t\t\tif(obj && !obj->isFreed()) {\r\n\t\t\t\t\t\t\tobj->_releaseGC();\r\n\t\t\t\t\t\t\tobj->_removeRef((__GCObject**)(m_list + i));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!m_listObject->isFreed()) { m_listObject->_removeOwner(this); }\r\n\t\t}\r\n\t}\r\n\ttemplate<> inline void List<s32>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<u32>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<s16>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<u16>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<s8 >::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<u8 >::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<s64>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<u64>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<float>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<double>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\ttemplate<> inline void List<bool>::_releaseGC\t()\t{ if(m_listObject && !m_listObject->isFreed()) { m_listObject->_removeOwner(this); } }\r\n\r\n\r\n\t/*virtual*/\r\n\ttemplate<class T>\r\n\tvoid List<T>::_moveAlert(u32 offset) {\r\n\t\tObject::_moveAlert(offset);\r\n\t\tif(m_listObject) { m_listObject->_moveOwnerAsRef((__GCObject**)((u8*)this - offset) , (__GCObject**)this); }\r\n\t}\r\n\r\n\t// -----------------------------------------------------------------------\r\n\t\r\n\t// -----------------------------------------------------------------------\r\n\t// Constructors - Destructors\r\n\r\n\ttemplate<class T>\r\n\tList<T>::List()\r\n\t: m_count\t\t(0)\r\n\t, m_capacity\t(0)\r\n\t, m_list\t\t(NULL)\r\n\t, m_listObject\t(NULL)\r\n\t{\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tList<T>::List(System::Collections::Generic::IEnumerable<T>*) {\r\n\t\t// TODO\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tList<T>::List(s32 capacity)\r\n\t: m_count\t\t(0)\r\n\t, m_capacity\t(capacity)\r\n\t, m_list\t\t(NULL)\r\n\t, m_listObject\t(NULL)\r\n\t{\r\n\t\tif(capacity > 0) {\r\n\t\t\tm_list = (T*)__GCMalloc::allocBlock(sizeof(T) * capacity, m_listObject);\r\n\t\t\tm_listObject->_addOwner(this);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tList<T>::~List() {\r\n\t\t_releaseGC();\r\n\t}\r\n\r\n\t// -----------------------------------------------------------------------\r\n\r\n\t// -----------------------------------------------------------------------\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::_acc_sCapacity(s32 val) {\r\n\t\tif(val < (s32)m_count) THROW(CS_NEW ArgumentOutOfRangeException());\r\n\r\n\t\tif(m_capacity == 0) {\r\n\t\t\tif(m_listObject) {\r\n\t\t\t\tm_listObject->_removeOwner(this);\r\n\t\t\t}\r\n\t\t\tm_list = (T*)__GCMalloc::allocBlock(sizeof(T) * val, m_listObject);\r\n\t\t\tm_listObject->_addOwner(this);\r\n\t\t} else {\r\n\t\t\tvoid* old = m_list;\r\n\r\n\t\t\tm_listObject->_removeOwner(this);\r\n\t\t\tm_list = (T*)__GCMalloc::allocBlock(sizeof(T) * val, m_listObject);\r\n\t\t\tm_listObject->_addOwner(this);\r\n\r\n\t\t\tu32 length = ((u32)val > m_count) ? m_count : (u32)val;\r\n\r\n\t\t\tmemcpy(m_list, old, length * sizeof(T));\r\n\r\n\t\t\tif((__InternalUtilsGetTypeID<T>::getIt() & ET_CLASS) == ET_CLASS) {\r\n\t\t\t\tu32 i = 0;\r\n\t\t\t\tfor(; i < length; ++i) {\r\n\t\t\t\t\t__GCObject** obj = (__GCObject**)(m_list + i);\r\n\t\t\t\t\tif(*obj) {\r\n\t\t\t\t\t\t(*obj)->_moveRef((__GCObject**)((T*)old + i), obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfor(; i < m_count; ++i) {\r\n\t\t\t\t\t__GCObject::_RefSetValue((__GCObject**)((T*)old + i), NULL);\r\n\t\t\t\t}\r\n\t\t\t} else if((__InternalUtilsGetTypeID<T>::getIt() & ET_STRUCT) == ET_STRUCT) {\r\n\t\t\t\tu32 i = 0;\r\n\t\t\t\tfor(; i < length; ++i) {\r\n\t\t\t\t\t__GCStruct* str = (__GCStruct*)(m_list + i);\r\n\t\t\t\t\tif(str) {\r\n\t\t\t\t\t\tstr->_moveAlert((u8*)str - (u8*)((T*)old + i));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfor(; i < m_count; ++i) {\r\n\t\t\t\t\t((__GCStruct*)((T*)old + i))->_RefSetValue((T*)__InternalUtils::m_nullStruct);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tm_capacity = val;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid  List<T>::Add (T item) {\r\n\t\tif(m_capacity == 0) {\r\n\t\t\t_acc_sCapacity(4);\r\n\t\t}\r\n\t\tif(m_count == m_capacity) {\r\n\t\t\t_acc_sCapacity(m_capacity * 2);\r\n\t\t}\r\n\r\n\t\t_list_refSetValue(m_count++, item);\r\n\t}\r\n\r\n\ttemplate<class T>\r\n/*x*/   void            AddRange            (System::Collections::Generic::IEnumerable<T>* collection);\r\n\r\n/*x*/   //ReadOnlyCollection<T>* AsReadOnly    (); //System.Collections.ObjectModel.ReadOnlyCollection<T>\r\n\r\n\ttemplate<class T>\r\n\tinline s32 List<T>::BinarySearch(T item) {\r\n\t\ts32 startIdx\t= 0;\r\n\t\ts32 endIdx\t\t= m_count - 1;\r\n\r\n\t\tTRY\r\n\t\t\tif(item->CompareTo(m_list[endIdx]) == 1) {\r\n\t\t\t\treturn ~(endIdx + 1);\r\n\t\t\t}\r\n\r\n\t\t\twhile(startIdx <= endIdx) {\r\n\t\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\t\ts32 compRes = item->CompareTo(m_list[currentIdx]);\r\n\t\t\t\tif(compRes == 0) {\r\n\t\t\t\t\treturn currentIdx;\r\n\t\t\t\t} else if(compRes == 1) {\r\n\t\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t\t} else /*if(compRes == -1)*/ {\r\n\t\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tCTRY\r\n\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\tFINALLY\r\n\t\tETRY\r\n\t\treturn ~startIdx;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\ts32 List<T>::_valueType_BinarySearch(T value) {\r\n\t\ts32 startIdx\t= 0;\r\n\t\ts32 endIdx\t\t= m_count - 1;\r\n\r\n\t\t\r\n\t\tif(value > m_list[endIdx]) {\r\n\t\t\treturn ~(endIdx + 1);\r\n\t\t}\r\n\r\n\t\twhile(startIdx <= endIdx) {\r\n\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\tif(m_list[currentIdx] == value) {\r\n\t\t\t\treturn currentIdx;\r\n\t\t\t} else if(value > m_list[currentIdx]) {\r\n\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t} else /*if(value < m_list[currentIdx])*/ {\r\n\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ~startIdx;\r\n\t}\r\n\ttemplate<> inline s32 List<s64>::BinarySearch\t(s64\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<u64>::BinarySearch\t(u64\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<s32>::BinarySearch\t(s32\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<u32>::BinarySearch\t(u32\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<s16>::BinarySearch\t(s16\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<u16>::BinarySearch\t(u16\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<s8>::BinarySearch\t(s8\t\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<u8>::BinarySearch\t(u8\t\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<float>::BinarySearch\t(float\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<double>::BinarySearch(double item)\t{ return _valueType_BinarySearch(item);\t}\r\n\ttemplate<> inline s32 List<bool>::BinarySearch\t(bool\titem)\t{ return _valueType_BinarySearch(item);\t}\r\n\t\r\n\ttemplate<class T>\r\n/*x*/   s32             BinarySearch        (T item, System::Collections::Generic::IComparer<T>* comparer);\r\n\ttemplate<class T>\r\n/*x*/   s32             BinarySearch        (s32 idx, s32 count, T item, System::Collections::Generic::IComparer<T>* comparer);\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::Clear () {\r\n\t\tm_count = 0;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline bool List<T>::Contains (T item) {\r\n\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i],item)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n/*x*/   /*List<TOutput>*  ConvertAll<TOutput>   (Converter<T, TOutput>* converter);*/\r\n\r\n    template<class T>    \r\n\tvoid List<T>::CopyTo (Array<T>* _array) {\r\n\t\tif(!_array)\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t}\r\n\t\tif((u32)_array->_acc_gLength() < m_count)\t{ THROW(CS_NEW ArgumentException());\t\t}\r\n\r\n\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t_array->_array_refSetValue(i, m_list[i]);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::CopyTo(Array<T>* _array, s32 arrayIndex) {\r\n\t\tif(!_array)\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t\t}\r\n\t\tif(arrayIndex < 0)\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif((u32)_array->_acc_gLength() < m_count + arrayIndex)\t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\t_array->_array_refSetValue(arrayIndex + i, m_list[i]);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::CopyTo(s32 index, Array<T>* _array, s32 arrayIndex, s32 count) {\r\n\t\tif(!_array)\t\t\t\t\t\t\t\t\t\t{ THROW(CS_NEW ArgumentNullException());\t\t}\r\n\t\tif((index | arrayIndex | count) < 0)\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif(((u32)index >= m_count) || ((u32)(index + count) > m_count) || (_array->_acc_gLength() < count + arrayIndex))\t{ THROW(CS_NEW ArgumentException());\t}\r\n\r\n\t\tfor(u32 i = 0; i < (u32)count; ++i) {\r\n\t\t\t_array->_array_refSetValue(arrayIndex + i, m_list[index + i]);\r\n\t\t}\r\n\t}\r\n\r\n/*x*/   /*bool            Exists              (Predicate<T>* match);\r\n/*x*/   //T               Find                (Predicate<T>* match);\r\n/*x*/   //List<T>*        FindAll             (Predicate<T>* match);\r\n/*x*/   //int             FindIndex           (Predicate<T>* match);\r\n/*x*/   //int             FindIndex           (s32 startIndex, Predicate<T>* match);\r\n/*x*/   //int             FindIndex           (s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/   //T               FindLast            (Predicate<T>* match);\r\n/*x*/   //int             FindLastIndex       (Predicate<T>* match);\r\n/*x*/   //int             FindLastIndex       (s32 startIndex, Predicate<T>* match);\r\n/*x*/   //int             FindLastIndex       (s32 startIndex, s32 count, Predicate<T>* match);\r\n/*x*/   //void            ForEach             (Action<T>* action);*/\r\n/*x*/   /*List<T>.Enumerator GetEnumerator    ();*/\r\n\t\r\n\ttemplate<class T>\r\n\tList<T>* List<T>::GetRange (s32 index, s32 count) {\r\n\t\tif((index | count) < 0)\t\t\t\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif((u32)(index + count) > m_count)\t{ THROW(CS_NEW ArgumentException());\t\t\t}\r\n\r\n\t\tList<T>* res = CS_NEW List<T>(count);\r\n\t\tmemcpy(res->m_list, m_list + index, count * sizeof(T));\r\n\t\tres->m_count = count;\r\n\t\treturn res;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tint List<T>::IndexOf(T item) {\r\n\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tint List<T>::IndexOf(T item, s32 index) {\r\n\t\tif((u32)index > m_count) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\tfor(u32 i = index; i < m_count; ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tint List<T>::IndexOf(T item, s32 index, s32 count) {\r\n\t\tif(((u32)index > m_count) || ((u32)index + (u32)count > m_count)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\tfor(u32 i = (u32)index; i < (u32)(index + count); ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::Insert(s32 index, T item) {\r\n\t\tif((u32)index > m_count) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\tif(m_count == m_capacity) {\r\n\t\t\t_acc_sCapacity(m_capacity * 2);\r\n\t\t}\r\n\r\n\t\tfor(u32 i = m_count; i > (u32)index; --i) {\r\n\t\t\t_list_refSetValue(i, m_list[i-1]);\r\n\t\t}\r\n\r\n\t\t_list_refSetValue(index, item);\r\n\t\tm_count++;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n/*x*/   void            InsertRange         (s32 index, System::Collections::Generic::IEnumerable<T>* collection);\r\n\r\n\ttemplate<class T>\r\n\tint List<T>::LastIndexOf(T item) {\r\n\t\tfor(s32 i = (s32)m_count - 1; i >= 0; --i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tint List<T>::LastIndexOf(T item, s32 index) {\r\n\t\tif((u32)index > m_count) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\t\tfor(s32 i = (s32)index; i >= 0; --i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tint List<T>::LastIndexOf(T item, s32 index, s32 count) {\r\n\t\tif(((u32)index > m_count) || ((u32)index - (u32)count < 0)) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\r\n\t\tfor(s32 i = index; i > index - count; --i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tbool List<T>::Remove(T item) {\r\n\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\tif(__InternalUtils::_areEqual(m_list[i], item)) {\r\n\t\t\t\tfor(u32 j = i; j < m_count - 1; ++j) {\r\n\t\t\t\t\t_list_refSetValue(j, m_list[j+1]);\r\n\t\t\t\t}\r\n\t\t\t\tm_count--;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n/*x*/   /*int             RemoveAll           (Predicate<T> match);*/\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::RemoveAt (s32 index) {\r\n\t\tif((u32)index > m_count) { THROW(CS_NEW ArgumentOutOfRangeException()); }\r\n\t\tfor(u32 i = index; i < m_count - 1; ++i) {\r\n\t\t\t_list_refSetValue(i, m_list[i+1]);\r\n\t\t}\r\n\t\t_list_removeValue(--m_count);\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::RemoveRange(s32 index, s32 count) {\r\n\t\tif(index < 0 || count < 0)\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif((u32)(index + count) > m_count) { THROW(CS_NEW ArgumentException());\t\t\t}\r\n\t\tfor(u32 i = index; i < m_count - index + count; ++i) {\r\n\t\t\t_list_refSetValue(i, m_list[count + i]);\r\n\t\t}\r\n\t\tm_count -= count;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::Reverse() {\r\n\t\tfor(u32 i = 0; i < (m_count >> 1); ++i) {\r\n\t\t\tT tmp = m_list[i];\r\n\t\t\t_list_refSetValue(i, m_list[m_count - i - 1]);\r\n\t\t\t_list_refSetValue(m_count - i - 1, tmp);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::Reverse(s32 index, s32 count) {\r\n\t\tif(index < 0 || count < 0)\t{ THROW(CS_NEW ArgumentOutOfRangeException());\t}\r\n\t\tif((u32)(index + count) > m_count) { THROW(CS_NEW ArgumentException());\t\t\t}\r\n\t\tif(count < 2) return;\r\n\r\n\t\tfor(int i = 0; i < (count >> 1); ++i) {\r\n\t\t\tT tmp = m_list[index + i];\r\n\t\t\t_list_refSetValue(index + i, m_list[index + count - i - 1]);\r\n\t\t\t_list_refSetValue(index + count - i - 1, tmp);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tinline void List<T>::Sort () {\r\n\t\t// TODO ? quick sort if m_count > ?\r\n\t\tfor(u32 i = 1; i < m_count; ++i) {\r\n\t\t\tu32 j = i;\r\n\t\t\tT tmp = m_list[i];\r\n\r\n\t\t\tTRY\r\n\t\t\t\twhile(j > 0 && m_list[j - 1]->CompareTo(tmp) > 0) {\r\n\t\t\t\t\t_list_refSetValue(j, m_list[j-1]);\r\n\t\t\t\t\t--j;\r\n\t\t\t\t}\r\n\t\t\tCTRY\r\n\t\t\tFIRSTCATCH(CppNotComparable, ex)\r\n\t\t\t\tTHROW(CS_NEW InvalidOperationException());\r\n\t\t\tFINALLY\r\n\t\t\tETRY\r\n\t\t\t_list_refSetValue(j, tmp);\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::_valueType_Sort() {\r\n\t\t// TODO ? quick sort if m_count > ?\r\n\t\tfor(u32 i = 1; i < m_count; ++i) {\r\n\t\t\tu32 j = i;\r\n\t\t\tT tmp = m_list[i];\r\n\t\t\twhile(j > 0 && m_list[j - 1] > tmp) {\r\n\t\t\t\tm_list[j] = m_list[j-1];\r\n\t\t\t\t--j;\r\n\t\t\t}\r\n\t\t\tm_list[j] = tmp;\r\n\t\t}\r\n\t}\r\n\ttemplate<> inline void List<s64>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<u64>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<s32>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<u32>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<s16>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<u16>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<s8>::Sort()\t\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<u8>::Sort()\t\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<float>::Sort()\t{ _valueType_Sort(); }\r\n\ttemplate<> inline void List<double>::Sort() { _valueType_Sort(); }\r\n\ttemplate<> inline void List<bool>::Sort()\t{ _valueType_Sort(); }\r\n\r\n/*x*/   /*void Sort                (Comparison<T> comparison);*/\r\n\ttemplate<class T>\r\n/*x*/   void Sort(System::Collections::Generic::IComparer<T>* comparer);\r\n\ttemplate<class T>\r\n/*x*/   void Sort(s32 index, s32 count, System::Collections::Generic::IComparer<T>* comparer);\r\n\t\r\n\ttemplate<class T>\r\n\tArray<T>* List<T>::ToArray() {\r\n\t\tArray<T>* ret = CS_NEW Array<T>(m_count);\r\n\t\tfor(u32 i = 0; i < m_count; ++i) {\r\n\t\t\tret->_array_refSetValue(i, m_list[i]);\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\r\n\ttemplate<class T>\r\n\tvoid List<T>::TrimExcess() {\r\n\t\t// TrimExcess method does nothing if the list is at more than 90 percent of capacity. \r\n\t\t// This avoids incurring a large reallocation cost for a relatively small gain.\r\n\t\tif(m_count < ((m_capacity * 921)>>10)) {\r\n\t\t\t_acc_sCapacity(m_count);\r\n\t\t}\r\n\t}\r\n/*x*/   /*bool            TrueForAll          (Predicate<T> match);*/\r\n}\r\n}\r\n}\r\n\r\n#endif /* defined(_CS_List_) */\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/Collections/Generic/Generic.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _System_Collection_Generic_h_\r\n#define _System_Collection_Generic_h_\r\n\r\n#include \"Collections/Collections.h\"\r\n#include \"CS_Object.h\"\r\n\r\nnamespace System {\r\nnamespace Collections {\r\nnamespace Generic {\r\n    \r\n    template<class T>\r\n    class IEnumerator /*<out T> : System::Collections::IEnumerator*/\r\n    {\r\n                \r\n    };\r\n\t\t\t\r\n\ttemplate<class T>\r\n\tclass IEnumerable /*<out T> : System::Collections::IEnumerable*/\r\n\t{\r\n\t\t// Summary:\r\n\t\t//     Returns an enumerator that iterates through the collection.\r\n\t\t//\r\n\t\t// Returns:\r\n\t\t//     A System.Collections.Generic.IEnumerator<T> that can be used to iterate through\r\n\t\t//     the collection.\r\n\t\tIEnumerator<T> GetEnumerator();\r\n\t};\r\n            \r\n    template<class T>\r\n    class IComparer /*<in T>*/\r\n    {\r\n                \r\n    };\r\n\r\n\tclass KeyNotFoundException : public SystemException {\r\n\tpublic:\r\n\t\tstatic const u32\t_TYPEID = _TYPE_KEYNOTFOUNDEXCEPTION;\r\n\tpublic:\r\n\t\tvirtual bool _isInstanceOf(u32 typeID) { _INSTANCEOF(KeyNotFoundException,SystemException); }\r\n\t};\r\n}\r\n}\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/InternalUtils.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"InternalUtils.h\"\r\n\r\nvoid* __InternalUtils::m_nullStruct = NULL;\r\n\r\n/*static*/\r\nvoid __InternalUtils::init() {\r\n\tm_nullStruct = (u32*)CS_MALLOC(1024);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/InternalUtils.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _InternalUtils_\r\n#define _InternalUtils_\r\n\r\n#include \"../CompilerProject/BaseType.h\"\r\n#include \"CS_Object.h\"\r\n\r\nnamespace System {\r\n\tclass AbstractArray;\r\n\tclass String;\r\n\ttemplate<class T> class Array;\r\n\tclass Delegate;\r\n\r\n\tnamespace Collections {\r\n\t\tnamespace Generic {\r\n\t\t\ttemplate<class T> class List;\r\n\t\t\ttemplate<class TKey, class TValue> class Dictionary;\r\n\t\t\tclass KeyNotFoundException;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#include \"inline/classPrototypes.inl\"\r\n\r\nclass __InternalUtils {\r\npublic:\r\n\tstatic void* m_nullStruct;\r\n\tstatic void init();\r\n\r\n\ttemplate<class T> \r\n\tstatic bool _isNullPtr\t\t(T element);\r\n\r\n\ttemplate<class T>\r\n\tstatic bool _areEqual\t\t(T first, T second);\r\n\r\n\ttemplate<class T>\r\n\tstatic u32\t_getHashCode\t(T element);\r\n\r\n\ttemplate<class T>\r\n\tstatic s32 _binarySearch\t(T* _array, s32 index, s32 length, T value);\r\n\r\n\ttemplate<class T>\r\n\tstatic s32 _compare\t\t\t(T first, T second);\r\n};\r\n\r\nclass UtilDiv {\r\npublic:\r\n\tstatic inline s8  _divBy(s8 & r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (s8 )(r / v); }\r\n\tstatic inline s8  _divBy(s8 & r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s8 )(r / v); }\r\n\tstatic inline s8  _divBy(s8 & r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (s8 )(r / v); }\r\n\tstatic inline s8  _divBy(s8 & r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s8 )(r / v); }\r\n\r\n\tstatic inline u8  _divBy(u8 & r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u8 )(r / v); }\r\n\tstatic inline u8  _divBy(u8 & r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (u8 )(r / v); }\r\n\tstatic inline u8  _divBy(u8 & r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u8 )(r / v); }\r\n\tstatic inline u8  _divBy(u8 & r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (u8 )(r / v); }\r\n\r\n\tstatic inline s16 _divBy(s16& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r / v); }\r\n\tstatic inline s16 _divBy(s16& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r / v); }\r\n\tstatic inline s16 _divBy(s16& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r / v); }\r\n\tstatic inline s16 _divBy(s16& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r / v); }\r\n\r\n\tstatic inline u16 _divBy(u16& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r / v); }\r\n\tstatic inline u16 _divBy(u16& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r / v); }\r\n\tstatic inline u16 _divBy(u16& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r / v); }\r\n\tstatic inline u16 _divBy(u16& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r / v); }\r\n\r\n\tstatic inline s32 _divBy(s32& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r =\t\tr / v;  }\r\n\tstatic inline s32 _divBy(s32& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r / v); }\r\n\tstatic inline s32 _divBy(s32& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r / v); }\r\n\tstatic inline s32 _divBy(s32& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r / v); }\r\n\r\n\tstatic inline u32 _divBy(u32& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u32)(r / v); }\r\n\tstatic inline u32 _divBy(u32& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r =\t\tr / v;  }\r\n\tstatic inline u32 _divBy(u32& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u32)(r / v); }\r\n\tstatic inline u32 _divBy(u32& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (u32)(r / v); }\r\n\r\n\tstatic inline s64 _divBy(s64& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\tstatic inline s64 _divBy(s64& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\tstatic inline s64 _divBy(s64& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\tstatic inline s64 _divBy(s64& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\t\r\n\tstatic inline u64 _divBy(u64& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\tstatic inline u64 _divBy(u64& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\tstatic inline u64 _divBy(u64& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\tstatic inline u64 _divBy(u64& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = r / v; }\r\n\r\n\tstatic inline s8  _modBy(s8& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (s8)(r % v); }\r\n\tstatic inline s8  _modBy(s8& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s8)(r % v); }\r\n\tstatic inline s8  _modBy(s8& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (s8)(r % v); }\r\n\tstatic inline s8  _modBy(s8& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s8)(r % v); }\r\n\r\n\tstatic inline u8  _modBy(u8& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u8)(r % v); }\r\n\tstatic inline u8  _modBy(u8& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (u8)(r % v); }\r\n\tstatic inline u8  _modBy(u8& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u8)(r % v); }\r\n\tstatic inline u8  _modBy(u8& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (u8)(r % v); }\r\n\r\n\tstatic inline s16 _modBy(s16& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r % v); }\r\n\tstatic inline s16 _modBy(s16& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r % v); }\r\n\tstatic inline s16 _modBy(s16& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r % v); }\r\n\tstatic inline s16 _modBy(s16& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s16)(r % v); }\r\n\r\n\tstatic inline u16 _modBy(u16& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r % v); }\r\n\tstatic inline u16 _modBy(u16& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r % v); }\r\n\tstatic inline u16 _modBy(u16& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r % v); }\r\n\tstatic inline u16 _modBy(u16& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (u16)(r % v); }\r\n\r\n\tstatic inline s32 _modBy(s32& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r % v); }\r\n\tstatic inline s32 _modBy(s32& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r % v); }\r\n\tstatic inline s32 _modBy(s32& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r % v); }\r\n\tstatic inline s32 _modBy(s32& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s32)(r % v); }\r\n\r\n\tstatic inline u32 _modBy(u32& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u32)(r % v); }\r\n\tstatic inline u32 _modBy(u32& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r =       r % v;  }\r\n\tstatic inline u32 _modBy(u32& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u32)(r % v); }\r\n\tstatic inline u32 _modBy(u32& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (u32)(r % v); }\r\n\r\n\tstatic inline s64 _modBy(s64& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (s64)(r % v); }\r\n\tstatic inline s64 _modBy(s64& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (s64)(r % v); }\r\n\tstatic inline s64 _modBy(s64& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r =\t\tr % v;  }\r\n\tstatic inline s64 _modBy(s64& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = (s64)(r % v); }\r\n\r\n\tstatic inline u64 _modBy(u64& r, s32 v) { if (v==0) { THROWDIVZERO; }; return r = (u64)(r % v); }\r\n\tstatic inline u64 _modBy(u64& r, u32 v) { if (v==0) { THROWDIVZERO; }; return r = (u64)(r % v); }\r\n\tstatic inline u64 _modBy(u64& r, s64 v) { if (v==0) { THROWDIVZERO; }; return r = (u64)(r % v); }\r\n\tstatic inline u64 _modBy(u64& r, u64 v) { if (v==0) { THROWDIVZERO; }; return r = r % v; }\r\n\r\n\tstatic inline s32 _divByWrp(s32 r, s32 v) { if (v==0) { THROWDIVZERO; }; return r / v; }\r\n\tstatic inline u32 _divByWrp(u32 r, u32 v) { if (v==0) { THROWDIVZERO; }; return r / v; }\r\n\tstatic inline s64 _divByWrp(s64 r, s64 v) { if (v==0) { THROWDIVZERO; }; return r / v; }\r\n\tstatic inline u64 _divByWrp(u64 r, u64 v) { if (v==0) { THROWDIVZERO; }; return r / v; }\r\n\r\n\tstatic inline s32 _modByWrp(s32 r, s32 v) { if (v==0) { THROWDIVZERO; }; return r % v; }\r\n\tstatic inline u32 _modByWrp(u32 r, u32 v) { if (v==0) { THROWDIVZERO; }; return r % v; }\r\n\tstatic inline s64 _modByWrp(s64 r, s64 v) { if (v==0) { THROWDIVZERO; }; return r % v; }\r\n\tstatic inline u64 _modByWrp(u64 r, u64 v) { if (v==0) { THROWDIVZERO; }; return r % v; }\r\n\r\n\tstatic inline float  _modBy(float & r, double v)\t{ s32 tmp = ((s32)(r / v)); return r = (float)(r-(tmp*v)); }\r\n\tstatic inline double _modBy(double& r, double v)\t{ s32 tmp = ((s32)(r / v)); return r = r-(tmp*v); }\r\n\r\n\tstatic inline float  _modByWrp(float  r, double v)\t{ s32 tmp = ((s32)(r / v)); return (float)(r-(tmp*v)); }\r\n\tstatic inline double _modByWrp(double r, double v)\t{ s32 tmp = ((s32)(r / v)); return r-(tmp*v); }\r\n};\r\n\r\n/*static*/\r\ntemplate<class T>\tinline bool\t__InternalUtils::_isNullPtr(T element)\t\t{ return (element) ? false:true; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(s64 element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(u64 element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(s32 element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(u32 element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(s16 element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(u16 element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(s8 element)\t\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(u8 element)\t\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(bool element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(float element)\t{ return false;\t}\r\ntemplate<>\t\t\tinline bool __InternalUtils::_isNullPtr(double element)\t{ return false;\t}\r\n\r\n/*static*/\r\ntemplate<class T>\tinline bool __InternalUtils::_areEqual(T first, T second)\t\t\t\t{ return first->Equals(second); }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(s64 first, s64 second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(u64 first, u64 second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(s32 first, s32 second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(u32 first, u32 second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(s16 first, s16 second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(u16 first, u16 second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(s8 first, s8 second)\t\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(u8 first, u8 second)\t\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(bool first, bool second)\t\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(float first, float second)\t\t{ return first == second; }\r\ntemplate<>\t\t\tinline bool __InternalUtils::_areEqual(double first, double second)\t\t{ return first == second; }\r\n\r\n/*static*/\r\ntemplate<class T>\tinline s32\t__InternalUtils::_compare(T first, T second)\t\t\t\t{ return first->CompareTo(second); }\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(s64 first, s64 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1; }\r\n\treturn 0;\r\n\t\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(u64 first, u64 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return 1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(s32 first, s32 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(u32 first, u32 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(s16 first, s16 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0; \r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(u16 first, u16 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(s8 first, s8 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(u8 first, u8 second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(bool first, bool second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(float first, float second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\ntemplate<>\t\t\tinline s32\t__InternalUtils::_compare(double first, double second) { \r\n\tif(first < second) { return -1; }\r\n\tif(first > second) { return +1;\t}\r\n\treturn 0;\r\n}\r\n\r\n/*static*/\r\ntemplate<class T>\tinline u32 __InternalUtils::_getHashCode(T element)\t{ return (u32)element->GetHashCode();\t}\r\ntemplate<>\t\t\tinline u32 __InternalUtils::_getHashCode(s32 element)\t{ return (u32)element;\t\t\t\t\t}\r\ntemplate<>\t\t\tinline u32 __InternalUtils::_getHashCode(u32 element)\t{ return element;\t\t\t\t\t\t}\r\n\r\n/*static*/\r\ntemplate<class T>\r\ns32 __InternalUtils::_binarySearch(T* _array, s32 index, s32 length, T value) {\r\n\t\tif(!_array || length == 0)\t{ return -1; }\r\n\r\n\t\ts32 startIdx\t= index;\r\n\t\ts32 endIdx\t\t= startIdx + length - 1;\r\n\r\n\t\tif(value > _array[endIdx]) {\r\n\t\t\treturn ~(endIdx + 1);\r\n\t\t}\r\n\r\n\t\twhile(startIdx <= endIdx) {\r\n\t\t\ts32 currentIdx = (startIdx + endIdx) / 2;\r\n\t\t\tif(value == _array[currentIdx]) {\r\n\t\t\t\treturn currentIdx;\r\n\t\t\t} else if(value > _array[currentIdx]) {\r\n\t\t\t\tstartIdx = currentIdx + 1;\r\n\t\t\t} else {\r\n\t\t\t\tendIdx = currentIdx - 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ~startIdx;\r\n\t}\r\n\r\ntemplate<class T>\r\nstruct __InternalUtilsGetTypeID {\r\n\tstatic u32 getIt() { THROW(CS_NEW System::SystemException()); }\r\n};\r\n\r\ntemplate<> struct __InternalUtilsGetTypeID<s64>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_LONG;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<u64>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_ULONG;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<s32>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_INT;\t\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<u32>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_UINT;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<s16>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_SHORT;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<u16>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_USHORT;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<s8>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_SBYTE;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<u8>\t\t\t\t\t\t{ static u32 getIt() { return TYPE_BYTE;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<bool>\t\t\t\t\t{ static u32 getIt() { return TYPE_BOOL;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<float>\t\t\t\t\t{ static u32 getIt() { return TYPE_FLOAT;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<double>\t\t\t\t\t{ static u32 getIt() { return TYPE_DOUBLE;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<s32*>\t\t\t\t\t{ static u32 getIt() { return TYPE_INTPTR;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::Object*>\t\t\t{ static u32 getIt() { return _TYPE_OBJECT;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::String*>\t\t\t{ static u32 getIt() { return _TYPE_STRING;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::AbstractArray*>\t{ static u32 getIt() { return _TYPE_ABSTRACTARRAY;\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::Delegate*>\t\t{ static u32 getIt() { return _TYPE_DELEGATE;\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::Exception*>\t\t\t\t\t\t{ static u32 getIt() { return _TYPE_EXCEPTION;\t\t\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::SystemException*>\t\t\t\t{ static u32 getIt() { return _TYPE_SYSTEMEXCEPTION;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::IndexOutOfRangeException*>\t\t{ static u32 getIt() { return _TYPE_INDEXOUTOFRANGEEXCEPTION;\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::NullReferenceException*>\t\t\t{ static u32 getIt() { return _TYPE_NULLEXCEPTION;\t\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::OutOfMemoryException*>\t\t\t{ static u32 getIt() { return _TYPE_OUTOFMEMORYEXCEPTION;\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::ArgumentException*>\t\t\t\t{ static u32 getIt() { return _TYPE_ARGUMENTEXCEPTION;\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::ArgumentOutOfRangeException*>\t{ static u32 getIt() { return _TYPE_ARGUMENTOUTOFRANGEEXCEPTION;} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::ArgumentNullException*>\t\t\t{ static u32 getIt() { return _TYPE_ARGUMENTNULLEXCEPTION;\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::RankException*>\t\t\t\t\t{ static u32 getIt() { return _TYPE_RANKEXCEPTION;\t\t\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::InvalidOperationException*>\t\t{ static u32 getIt() { return _TYPE_INVALIDOPERATIONEXCEPTION;\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::ArrayTypeMismatchException*>\t\t{ static u32 getIt() { return _TYPE_ARRAYTYPEMISMATCHEXCEPTION;\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::ArithmeticException*>\t\t\t{ static u32 getIt() { return _TYPE_ARITHMETICEXCEPTION;\t\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::DivideByZeroException*>\t\t\t{ static u32 getIt() { return _TYPE_DIVISIONBYZEROEXCEPTION;\t} };\r\ntemplate<> struct __InternalUtilsGetTypeID<System::Collections::Generic::KeyNotFoundException*>\t{ static u32 getIt() { return _TYPE_KEYNOTFOUNDEXCEPTION;\t\t} };\r\n\r\ntemplate<class T>\t\t\t\t\tstruct __InternalUtilsGetTypeID<System::Array<T>*>\t\t\t\t\t\t\t\t\t\t{ static u32 getIt() { return _TYPE_ARRAY;\t\t\t} };\r\ntemplate<class T>\t\t\t\t\tstruct __InternalUtilsGetTypeID<System::Collections::Generic::List<T>*>\t\t\t\t\t{ static u32 getIt() { return _TYPE_LIST;\t\t\t} };\r\ntemplate<class TKey, class TValue>\tstruct __InternalUtilsGetTypeID<System::Collections::Generic::Dictionary<TKey,TValue>*> { static u32 getIt() { return _TYPE_DICTIONARY;\t\t} };\r\n#include \"inline/__InternalUtilsGetTypeID_specializations.inl\"\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/MarshallingUtils.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"MarshallingUtils.h\"\r\n#include \"CS_Memory.h\"\r\n\r\nnamespace System {\r\n\r\n/*static*/\r\nint* __MarshallingUtils::NativeUtf8FromString(System::String* str) {\r\n\tif(!str) { \r\n\t\treturn NULL;\r\n\t}\r\n\tif(str->_acc_gLength() == 0) {\r\n\t\treturn (int*)System::String::Empty->_getStringBuffer();\r\n\t}\r\n\r\n\tu8* utf8buff = (u8*)CS_MALLOC(str->_acc_gLength() * 2);\r\n\tu32 utf8Length = _utf16ToUtf8(str->_getStringBuffer(), str->_acc_gLength(), utf8buff, str->_acc_gLength() * 2);\r\n\treturn (int*)utf8buff;\r\n}\r\n\r\n/*static*/\t\r\nSystem::String* __MarshallingUtils::StringFromNativeUtf8(s32* utf8intptr) {\r\n\tu8* utf8ptr = (u8*)utf8intptr;\r\n\tu32 utf8len = 0;\r\n\twhile(utf8ptr[utf8len] != 0) { ++utf8len; }\r\n\r\n\tif(!utf8intptr || (utf8len == 0)) { \r\n\t\treturn System::String::Empty; \r\n\t}\r\n\r\n\tSystem::String* str = CS_NEW System::String(false);\r\n\tstr->m_allocBuffer = (const uniChar*)System::__GCMalloc::allocBlock((utf8len * 3), str->m_allocBufferObject);\r\n\tstr->m_allocBufferObject->_addOwner(str);\r\n\tstr->m_bNotOwnBuffer = false;\r\n\tstr->m_stringBuffer  = str->m_allocBuffer;\r\n\r\n\tstr->m_length = _utf8ToUtf16((u8*)utf8ptr, utf8len, (u16*)str->m_allocBuffer, (utf8len * 3));\r\n\r\n\treturn str;\r\n}\r\n\r\n/*static*/\t\r\nSystem::Array<System::String*>* __MarshallingUtils::StringArrayFromNativeUtf8IntPtr(s32* utf8intptr, int size) {\r\n\tSystem::Array<System::String*>* arr = CS_NEW System::Array<System::String*>(size);\r\n\r\n\tfor(int i = 0; i < size; ++i) {\r\n\t\tarr->_array_refSetValue(i, StringFromNativeUtf8((int*)*utf8intptr));\r\n\t\tutf8intptr++;\r\n\t}\r\n\r\n\treturn arr;\r\n}\r\n\r\n/*static*/\t\r\nSystem::Array<s32*>* __MarshallingUtils::NativeUtf8ArrayFromStringArray(System::Array<System::String*>* stringArray, int size) {\r\n\tif(!stringArray) {\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\tSystem::Array<s32*>* arr = CS_NEW System::Array<s32*>(size);\r\n\r\n\tfor(int i = 0; i < size; ++i) {\r\n\t\tarr->_array_refSetValue(i, NativeUtf8FromString(stringArray->_idx_g_0based(i)));\r\n\t}\r\n\r\n\treturn arr;\r\n}\r\n\r\n/*static*/\t\r\nSystem::Array<s32>* __MarshallingUtils::IntArrayFromIntPtr(s32* intptr, int size) {\r\n\r\n\tSystem::Array<s32>* arr = CS_NEW System::Array<s32>(size);\r\n\tmemcpy(arr->_getPArray(), intptr, size * sizeof(s32));\r\n\r\n\treturn arr;\r\n}\r\n\r\n// --------------------------------------------------------\r\n// --------------------------------------------------------\r\n\r\n#define UTF8_ACCEPT 0\r\n#define UTF8_REJECT 1\r\n\r\n// 10x4 + 11x4 = 84 byte\r\nstatic const u32 utf8d[] = {\r\n\t0x00000000,\t// 0\r\n\t0x11111111,\t// 1\r\n\t0x22222222,\t// 2\r\n\t0x33433333,\t// 3\t--> Special pattern.\r\n\t0x22222288,\t// 4\t--> Special pattern.\r\n\t0x3333333A,\t// 5\t--> Special pattern.\r\n\t0x8885666B,\t// 6\t--> Special pattern.\r\n\t0x77777777,\t// 7\r\n\t0x88888888,\t// 8\r\n\t0x99999999,\t// 9\r\n\r\n\t// State Table Compressed Entry.\r\n\t0x17853210,\t// IT0\r\n\t0x11116411,\t// IT1\r\n\t0x11111111,\t// IT2\r\n\t0x01111101,\t// IT3\r\n\t0x11111101,\t// IT4\r\n\t0x21111121,\t// IT5\r\n\t0x11111121,\t// IT6\r\n\t0x21111111,\t// IT7\r\n\t0x31111111,\t// IT8\r\n\t0x11111131,\t// IT9\r\n\t0x31111131,\t// ITA\r\n};             \r\n\r\n#define IT0\t(10)\r\n#define IT1\t(11)\r\n#define IT2\t(12)\r\n#define IT3\t(13)\r\n#define IT4\t(14)\r\n#define IT5\t(15)\r\n#define IT6\t(16)\r\n#define IT7\t(17)\r\n#define IT8\t(18)\r\n#define IT9\t(19)\r\n#define ITA\t(20)\r\n\r\n// Could compact this table in 16 bytes, but overhead of shift and decode is pretty pointless.\r\n// 32 Bytes.\r\nstatic const u8 code[] = {\r\n\t0,0,0,0, // 00..1f\r\n\t0,0,0,0, // 20..3f\r\n\t0,0,0,0, // 40..5f\r\n\t0,0,0,0, // 60..7f\r\n\t1,1,9,9, // 80..9f\r\n\t7,7,7,7, // A0..BF\r\n\t4,2,2,2, // C0..DF\r\n\t5,3,6,8, // E0..FF\r\n};\r\n\r\n// 18 Byte table.\r\nstatic const u8 code2[] = {\r\n\tIT0,IT1, // s0..s0\r\n\tIT2,IT2,\r\n\tIT3,IT4, // s1..s2\r\n\tIT5,IT6,\r\n\tIT7,IT2, // s3..s4\r\n\tIT6,IT6,\r\n\tIT8,IT9, // s5..s6\r\n\tITA,IT9,\r\n\tIT9,IT2, // s7..s8\r\n};\r\n\r\nu32 decode(u32* state, u32* codep, u8 byte) {\r\n  u32 type = (utf8d[code[byte>>3]]>>((byte & 7)<<2)) & 0xF;\r\n\r\n  *codep = (*state != UTF8_ACCEPT) ?\r\n    (byte & 0x3fu) | (*codep << 6) :\r\n    (0xff >> type) & (byte);\r\n\r\n  byte = (u8)((*state)*16 + type);\r\n  *state = (utf8d[code2[byte>>3]]>>((byte & 7)<<2)) & 0xF;\r\n  return *state;\r\n}\r\n\r\nu32 _utf8ToUtf16(const u8* src, u32 srcSizeBytes, u16* dst, u32 dstSizeWord) {\r\n\tconst u8* src_actual_end = src + srcSizeBytes;\r\n\tconst u8* s = src;\r\n\tu16* d = dst;\r\n\tu32 codepoint;\r\n\tu32 state = 0;\r\n\tu32 count = 0;\r\n\r\n\twhile (s < src_actual_end) {\r\n\t\tu32 dst_words_free = dstSizeWord - (d - dst);\r\n\t\tconst u8* src_current_end = s + dst_words_free;\r\n\r\n\t\tif(src_actual_end < src_current_end)\r\n\t\t\tsrc_current_end = src_actual_end;\r\n\r\n\t\tif(src_current_end <= s)\r\n\t\t\tgoto toosmall;\r\n\r\n\t\twhile (s < src_current_end) {\r\n\r\n\t\t\tif(decode(&state, &codepoint, *s++))\r\n\t\t\tcontinue;\r\n\r\n\t\t\tif(codepoint > 0xffff) {\r\n\t\t\t\t*d++ = (u16)(0xD7C0 + (codepoint >> 10));\r\n\t\t\t\t*d++ = (u16)(0xDC00 + (codepoint & 0x3FF));\r\n\t\t\t\tcount += 2;\r\n\t\t\t} else {\r\n\t\t\t\t*d++ = (u16)codepoint;\r\n\t\t\t\tcount += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\ntoosmall:\r\n  /*\r\n  if(state != UTF8_ACCEPT) {\r\n    ...\r\n  }\r\n\r\n  if((dstWords - (d - dst)) == 0)\r\n    goto toosmall;\r\n\r\n  *d++ = 0;\r\n  ...\r\n\r\n  ...\r\n  */\r\n  return count;\r\n}\r\n\r\nu32 _utf16ToUtf8(const uniChar* src, u32 srcSizeWord, u8* dst, u32 dstSizeBytes) {\r\n\tconst u8* dstStart = dst;\r\n\tconst uniChar* end = src + srcSizeWord;\r\n\r\n\twhile(src < end) {\r\n\t\tif((*src >= 0x0001) && (*src <= 0x007F)) {\r\n\t\t\t*dst++ = (u8)*src;\r\n\t\t} else if((*src >= 0x0080) && (*src <= 0x07FF)) {\r\n\t\t\t*dst++ = (0xC0 | ((*src >>  6) & 0x1F));\r\n\t\t\t*dst++ = (0x80 | ((*src >>  0) & 0x3F));\r\n\t\t} else if(((*src >= 0x0800) && (*src <= 0xFFFF)) && !(*src >= 0xD800 && *src <= 0xDFFF)) {\r\n\t\t\t*dst++ = (0xE0 | ((*src >> 12) & 0x0F));\r\n\t\t\t*dst++ = (0x80 | ((*src >>  6) & 0x3F));\r\n\t\t\t*dst++ = (0x80 | ((*src >>  0) & 0x3F));\r\n\t\t} else {\r\n\t\t\t// unicode characters encoded on 4 bytes.\r\n\t\t\tu32\tupper = (0x000F & (*src >> 6)) + 1; // 5 bits : 000xxxxx\r\n\t\t\r\n\t\t\t*dst++ = (0xF0 | ((upper >> 2) & 0x07));\r\n\t\t\t*dst++ = (0x80 | (((upper) & 0x03) << 4) + ((*src >> 2) & 0x0F));\r\n\t\t\t*dst++ = (0x80 | (((*src >> 0) & 0x03) << 4) + ((*++src >> 6) & 0x0F));\r\n\t\t\t*dst++ = (0x80 | ((*src >> 0) & 0x3F));\r\n\t\t}\r\n\t\tsrc++;\r\n\t}\r\n\r\n\treturn (dst - dstStart);\r\n}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/MarshallingUtils.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _MarshallingUtils_\r\n#define _MarshallingUtils_\r\n\r\n#include \"../CompilerProject/BaseType.h\"\r\n#include \"CS_Object.h\"\r\n#include \"CS_String.h\"\r\n\r\nnamespace System {\r\n\r\n\r\nclass __MarshallingUtils \r\n{\r\npublic:\r\n\tstatic\ts32*\t\t\t\t\t\t\tNativeUtf8FromString\t\t\t\t(System::String* str);\r\n\tstatic\tSystem::String*\t\t\t\t\tStringFromNativeUtf8\t\t\t\t(s32* utf8intptr);\r\n\tstatic\tSystem::Array<System::String*>*\tStringArrayFromNativeUtf8IntPtr\t\t(s32* utf8intptr, int size);\r\n\tstatic\tSystem::Array<s32*>*\t\t\tNativeUtf8ArrayFromStringArray\t\t(System::Array<System::String*>* stringArray, int size);\r\n\tstatic\tSystem::Array<s32>*\t\t\t\tIntArrayFromIntPtr\t\t\t\t\t(s32* intptr, int size);\r\n};\r\n\r\nu32 _utf8ToUtf16(const u8* src, u32 srcSizeBytes, u16* dst, u32 dstSizeWord);\r\nu32 _utf16ToUtf8(const uniChar* src, u32 srcSizeWord, u8* dst, u32 dstSizeBytes);\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/RuntimeCSharp.sln",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\nMicrosoft Visual Studio Solution File, Format Version 11.00\r\n# Visual C++ Express 2010\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"RuntimeCSharp\", \"RuntimeCSharp.vcxproj\", \"{0CB3E5F2-5883-45A6-9511-73425909E16B}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDEBUG MEMORY|Win32 = DEBUG MEMORY|Win32\r\n\t\tDebug|Win32 = Debug|Win32\r\n\t\tRelease|Win32 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{0CB3E5F2-5883-45A6-9511-73425909E16B}.DEBUG MEMORY|Win32.ActiveCfg = DEBUG MEMORY|Win32\r\n\t\t{0CB3E5F2-5883-45A6-9511-73425909E16B}.DEBUG MEMORY|Win32.Build.0 = DEBUG MEMORY|Win32\r\n\t\t{0CB3E5F2-5883-45A6-9511-73425909E16B}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{0CB3E5F2-5883-45A6-9511-73425909E16B}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{0CB3E5F2-5883-45A6-9511-73425909E16B}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{0CB3E5F2-5883-45A6-9511-73425909E16B}.Release|Win32.Build.0 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/RuntimeCSharp.vcxproj",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"DEBUG MEMORY|Win32\">\r\n      <Configuration>DEBUG MEMORY</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{0CB3E5F2-5883-45A6-9511-73425909E16B}</ProjectGuid>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <RootNamespace>RuntimeCSharp</RootNamespace>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='DEBUG MEMORY|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='DEBUG MEMORY|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\\include;$(ProjectDir);$(ProjectDir)\\Collections;$(ProjectDir)\\Collections\\Generic;$(ProjectDir)\\TestSuite</IncludePath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='DEBUG MEMORY|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\\include;$(ProjectDir);$(ProjectDir)\\Collections;$(ProjectDir)\\Collections\\Generic;$(ProjectDir)\\TestSuite</IncludePath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r\n      <WarningLevel>TurnOffAllWarnings</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./Collection/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='DEBUG MEMORY|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>_DEBUG_MEMORY_;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>./Collection/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <CompileAsManaged>false</CompileAsManaged>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <Optimization>MaxSpeed</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <None Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\CompilerProject\\BaseType.h\" />\r\n    <ClInclude Include=\"Collections\\Collections.h\" />\r\n    <ClInclude Include=\"Collections\\Generic\\CS_Dictionary.h\" />\r\n    <ClInclude Include=\"Collections\\Generic\\CS_List.h\" />\r\n    <ClInclude Include=\"Collections\\Generic\\Generic.h\" />\r\n    <ClInclude Include=\"CS_Array.h\" />\r\n    <ClInclude Include=\"CS_Console.h\" />\r\n    <ClInclude Include=\"CS_Marshal.h\" />\r\n    <ClInclude Include=\"CS_Math.h\" />\r\n    <ClInclude Include=\"CS_Memory.h\" />\r\n    <ClInclude Include=\"CS_Object.h\" />\r\n    <ClInclude Include=\"CS_String.h\" />\r\n    <ClInclude Include=\"CS_System.h\" />\r\n    <ClInclude Include=\"InternalUtils.h\" />\r\n    <ClInclude Include=\"MarshallingUtils.h\" />\r\n    <ClInclude Include=\"stdafx.h\" />\r\n    <ClInclude Include=\"targetver.h\" />\r\n    <ClInclude Include=\"TestSuite\\MemoryTests.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Collections\\Generic\\CS_Dictionary.cpp\" />\r\n    <ClCompile Include=\"Collections\\Generic\\CS_List.cpp\" />\r\n    <ClCompile Include=\"CS_Array.cpp\" />\r\n    <ClCompile Include=\"CS_Console.cpp\" />\r\n    <ClCompile Include=\"CS_System.cpp\" />\r\n    <ClCompile Include=\"CS_Memory.cpp\" />\r\n    <ClCompile Include=\"InternalUtils.cpp\" />\r\n    <ClCompile Include=\"main.cpp\" />\r\n    <ClCompile Include=\"MarshallingUtils.cpp\" />\r\n    <ClCompile Include=\"CS_Object.cpp\" />\r\n    <ClCompile Include=\"CS_Exception.cpp\" />\r\n    <ClCompile Include=\"CS_String.cpp\" />\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='DEBUG MEMORY|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\r\n    </ClCompile>\r\n    <ClCompile Include=\"TestSuite\\MemoryTests.cpp\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/TestSuite/MemoryTests.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"MemoryTests.h\"\r\n#include \"CS_Object.h\"\r\n#include \"CS_Memory.h\"\r\n#include \"CS_Array.h\"\r\n#include \"CS_String.h\"\r\n#include \"CS_List.h\"\r\n#include \"CS_Dictionary.h\"\r\n\r\nnamespace InternalTests {\r\n\r\n\ttemplate <class T>\r\n\tvoid DisplayArray(System::Array<T>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%s|\", (_array->_idx_g(i)) ? _array->_idx_g(i)->ToString()->_toCStr() : \"\");\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<s64>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<u64>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<s32>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<u32>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<s16>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<u16>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<s8>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<u8>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<float>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%G|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<double>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%G|\", _array->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayArray(System::Array<bool>* _array) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\t\tprintf(\"%s|\", (_array->_idx_g(i)) ? \"True\":\"False\" );\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T> \r\n\tvoid DisplayArrayInfos(System::Array<T>* _array) {\r\n\t\tprintf(\"Length = %i \\t Rank = %i\", _array->_acc_gLength(), _array->_acc_gRank());\r\n\t}\r\n\r\n\ttemplate <class T>\r\n\tvoid DisplayList(System::Collections::Generic::List<T>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%s|\", _list->_idx_g(i)->ToString()->_toCStr());\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<s64>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<u64>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<s32>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<u32>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<u16>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<s16>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<u8>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<s8>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<float>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%G|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<double>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%G|\", _list->_idx_g(i));\r\n\t\t}\r\n\t}\r\n\ttemplate <> void DisplayList(System::Collections::Generic::List<bool>* _list) {\r\n\t\tprintf(\"|\");\r\n\t\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\t\tprintf(\"%s|\", (_list->_idx_g(i)) ? \"True\":\"False\");\r\n\t\t}\r\n\t}\r\n\r\n\ttemplate<class T> \r\n\tvoid DisplayListInfos(System::Collections::Generic::List<T>* _list) {\r\n\t\tprintf(\"Capacity = %i \\t Count = %i\", _list->_acc_gCapacity(), _list->_acc_gCount());\r\n\t}\r\n\r\n\ttemplate<class TKey, class TValue>\r\n\tinline void DisplayDictionary(System::Collections::Generic::Dictionary<TKey,TValue>* _dictionary) {\r\n\t\tprintf(\"DIPLAY NOT IMPLEMENTED FOR THESE TYPES.\\n\");\r\n\t}\r\n\r\n\ttemplate<>\r\n\tinline void DisplayDictionary(System::Collections::Generic::Dictionary<System::String*,System::String*>* _dictionary) {\r\n\t\t_dictionary->_display();\r\n\t}\r\n\r\n\r\n\t/*static*/\r\n\tvoid RefSetValueTests() {\r\n\t\t//printf(\"#########################################\\n\");\r\n\t\t//printf(\"#########################################\\n\");\r\n\t\t//printf(\"############# Memory Tests ##############\\n\");\r\n\t\t//printf(\"#########################################\\n\");\r\n\t\t//printf(\"#########################################\\n\");\r\n\t\r\n\t\tSystem::Object* _obj\t= NULL;\r\n\t\tSystem::Object* _obj1\t= NULL;\r\n\t\tSystem::Object* _obj2\t= NULL;\r\n\t\tSystem::Object* _obj3\t= NULL;\r\n\t\tSystem::Object* _obj4\t= NULL;\r\n\t\tSystem::Object* _obj5\t= NULL;\r\n\t\tSystem::Object* _obj6\t= NULL;\r\n\t\tSystem::Object* _obj7\t= NULL;\r\n\t\tSystem::Object* _obj8\t= NULL;\r\n\t\tSystem::Object* _obj9\t= NULL;\r\n\r\n\r\n\t\t// Adding\t1 refs on _obj\r\n\t\t// Removing 1 ref\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\t// Adding\t2 refs on _obj\r\n\t\t// Removing 2 refs\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\t// Adding\t3 refs on _obj\r\n\t\t// Removing 3 refs\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\t// Adding\t4 refs on _obj\r\n\t\t// Removing 4 refs\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\r\n\t\t// Adding 5 refs\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\r\n\t\t// Adding 10 values\r\n\t\t// Removing the 2nde page\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj5, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj6, _obj); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj7, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj8, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj9, _obj); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj5, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj6, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj7, NULL);\r\n\r\n\t\t// Adding 10 values\r\n\t\t// Removing the 1st page\r\n\t\t// Removing the 3rd page (now 2nd)\r\n\t\t// Removing the last one -> return to __GCObject pointers in __GCObject.\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, _obj); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj5, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj6, _obj); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj7, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj8, _obj); System::__GCObject::_RefSetValue((System::__GCObject**)&_obj9, _obj); \r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj,  NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj2, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj3, NULL);\r\n\t\t\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj8, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj9, NULL);\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj4, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj5, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj6, NULL);\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj7, NULL);\r\n\t}\r\n\r\n\r\n\t/*static*/\r\n\tvoid GCTest1() {\r\n\r\n\t\tSystem::Object* _obj\t= NULL;\r\n\t\tSystem::Object* _obj1\t= NULL;\r\n\t\tSystem::Object* _obj2\t= NULL;\r\n\t\tSystem::Object* _obj3\t= NULL;\r\n\t\tSystem::Object* _obj4\t= NULL;\r\n\t\tSystem::Object* _obj5\t= NULL;\r\n\t\tSystem::Object* _obj6\t= NULL;\r\n\t\tSystem::Object* _obj7\t= NULL;\r\n\t\tSystem::Object* _obj8\t= NULL;\r\n\t\tSystem::Object* _obj9\t= NULL;\r\n\r\n\t\t// Create 1 object and set 10 pointers to it.\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj, CS_NEW System::Object);\t// add new Object [obj0]\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, CS_NEW System::Object);\t// add new Object [obj1]\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, CS_NEW System::Object);\t// remove [obj1] add new Object [obj2]\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, NULL);\t\t\t\t\t// remove [obj2]\r\n\t\t//System::__GCObject::_RefSetValue((System::__GCObject**)&_obj1, CS_NEW System::Object);\t// add new Object [obj3]\r\n\t\t\r\n\r\n\t\t/*\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#### Mark & Sweep without compaction ####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1));\r\n\t\t*/\r\n\t\t\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"###### Mark & Sweep with compaction #####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\t\r\n\r\n\t\t/*\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"# Compaction based on Reference Counting#\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionSmall();\r\n\t\t*/\r\n\t}\r\n\r\n\t/*static*/\r\n\tvoid GCTestArray() {\t\t\r\n\t\t// Array of String\r\n\t\tSystem::Array<System::String*> * strArray\t= NULL;\r\n\t\tstrArray = CS_NEW System::Array<System::String*>(3);\r\n\t\tSystem::String* s = (CS_NEW System::String())->_appendC('S')->_appendC('T')->_appendC('R')->_appendClose();\r\n\t\tstrArray->_idx$_s(0, s);\r\n\t\tstrArray->_idx$_s(1, System::String::Empty);\r\n\t\tstrArray->_idx$_s(2, s);\r\n\t\t\r\n\t\t// Fake static array\r\n\t\tSystem::Array<System::String*> * _static_strArray\t= NULL;\r\n\t\t_static_strArray = CS_NEW System::Array<System::String*>(3);\r\n\t\t_static_strArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\t\t_static_strArray->_idx$_s(1, System::String::Empty);\r\n\t\t_static_strArray->_idx$_s(2, System::String::Copy(s));\r\n\r\n\t\tSystem::Memory::registerGCRoot(&_static_strArray);\r\n\r\n\t\t// Array of int\r\n\t\t\r\n\t\tSystem::Array<s32> * intArray\t= NULL;\r\n\t\tintArray = CS_NEW System::Array<s32>(3);\r\n\t\tintArray->_idx$_s(0, 4);\r\n\t\tintArray->_idx$_s(1, 2);\r\n\t\tintArray->_idx$_s(2, 1);\r\n\t\t\r\n\t\t/*\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"###### Mark & Sweep with compaction #####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\t*/\r\n\t\t\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#### Mark & Sweep without compaction ####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS();\r\n\t\t\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"# Compaction based on Reference Counting#\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionSmall((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1));\r\n\t\t\r\n\r\n\t\tDisplayArray(_static_strArray);\r\n\t}\r\n\r\n\t/*static*/\r\n\tvoid GCTestList() {\t\r\n\t\tSystem::Collections::Generic::List<s32>\t\t\t\t*intList = NULL;\r\n\t\tSystem::Collections::Generic::List<System::String*> *strList = NULL;\r\n\t\tSystem::Collections::Generic::List<System::String*> *_static_strList = NULL;\r\n\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&intList, CS_NEW System::Collections::Generic::List<s32>(3));\r\n\t\tSystem::__GCObject::_RefSetValue((System::__GCObject**)&strList, CS_NEW System::Collections::Generic::List<System::String*>());\r\n\r\n\t\t_static_strList = CS_NEW System::Collections::Generic::List<System::String*>(1);\r\n\t\tfor(int i = 0; i < 9; ++i) {\r\n\t\t\t_static_strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n\t\t}\r\n\t\tprintf(\"Static String List : \");\r\n\t\tDisplayListInfos(_static_strList);    printf(\"\\n\");\r\n\t\tDisplayList(_static_strList);         printf(\"\\n\");\r\n\r\n\r\n\t\tfor(int i = 0; i < 8; ++i) {\r\n\t\t\tintList->Add(i*2);\r\n\t\t\tstrList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n\t\t}\r\n\r\n\t\tprintf(\"Int List : \");\r\n\t\tDisplayListInfos(intList);    printf(\"\\n\");\r\n\t\tDisplayList(intList);         printf(\"\\n\");\r\n\t\tprintf(\"String List : \");\r\n\t\tDisplayListInfos(strList);    printf(\"\\n\");\r\n\t\tDisplayList(strList);         printf(\"\\n\");\r\n\r\n\t\tSystem::Memory::registerGCRoot(&_static_strList);\r\n\t\t\r\n\r\n\t\t/*\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"###### Mark & Sweep with compaction #####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\t*/\r\n\t\t\r\n\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#### Mark & Sweep without compaction ####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS();\r\n\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"# Compaction based on Reference Counting#\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionSmall((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1));\r\n\t\t\r\n\t\tprintf(\"Static String List : \");\r\n\t\tDisplayListInfos(_static_strList);    printf(\"\\n\");\r\n\t\tDisplayList(_static_strList);         printf(\"\\n\");\r\n\r\n\t}\r\n\r\n\t\t/*static*/\r\n\tvoid GCTestDictionary() {\t\r\n\t\t\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"########### Dictionary Tests ############\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"\\n\");\r\n\t\tprintf(\"\\n\");\r\n\r\n\t\tSystem::String* s_red\t\t\t= (CS_NEW System::String())->_appendC('r')->_appendC('e')->_appendC('d')->_appendClose();\r\n\t\tSystem::String* s_air\t\t\t= (CS_NEW System::String())->_appendC('a')->_appendC('i')->_appendC('r')->_appendClose();\r\n\t\tSystem::String* s_blue\t\t\t= (CS_NEW System::String())->_appendC('b')->_appendC('l')->_appendC('u')->_appendC('e')->_appendClose();\r\n\t\tSystem::String* s_green\t\t\t= (CS_NEW System::String())->_appendC('g')->_appendC('r')->_appendC('e')->_appendC('e')->_appendC('n')->_appendClose();\r\n\t\tSystem::String* s_water\t\t\t= (CS_NEW System::String())->_appendC('w')->_appendC('a')->_appendC('t')->_appendC('e')->_appendC('r')->_appendClose();\r\n\t\tSystem::String* s_yellow\t\t= (CS_NEW System::String())->_appendC('y')->_appendC('e')->_appendC('l')->_appendC('l')->_appendC('o')->_appendC('w')->_appendClose();\r\n\t\tSystem::String* s_friend\t\t= (CS_NEW System::String())->_appendC('f')->_appendC('r')->_appendC('i')->_appendC('e')->_appendC('n')->_appendC('d')->_appendClose();\r\n\t\tSystem::String* s_Hitokage\t\t= (CS_NEW System::String())->_appendC('H')->_appendC('i')->_appendC('t')->_appendC('o')->_appendC('k')->_appendC('a')->_appendC('g')->_appendC('e')->_appendClose();\r\n\t\tSystem::String* s_Zenigame\t\t= (CS_NEW System::String())->_appendC('Z')->_appendC('e')->_appendC('n')->_appendC('i')->_appendC('g')->_appendC('a')->_appendC('m')->_appendC('e')->_appendClose();\r\n\t\tSystem::String* s_Fushigidane\t= (CS_NEW System::String())->_appendC('F')->_appendC('u')->_appendC('s')->_appendC('h')->_appendC('i')->_appendC('g')->_appendC('i')->_appendC('d')->_appendC('a')->_appendC('n')->_appendC('e')->_appendClose();\r\n\t\tSystem::String* s_Pikachu\t\t= (CS_NEW System::String())->_appendC('P')->_appendC('i')->_appendC('k')->_appendC('a')->_appendC('c')->_appendC('h')->_appendC('u')->_appendClose();\r\n\t\tSystem::String* s_Lizardo\t\t= (CS_NEW System::String())->_appendC('L')->_appendC('i')->_appendC('z')->_appendC('a')->_appendC('r')->_appendC('d')->_appendC('o')->_appendClose();\r\n\t\tSystem::String* s_Poppo\t\t\t= (CS_NEW System::String())->_appendC('P')->_appendC('o')->_appendC('p')->_appendC('p')->_appendC('o')->_appendClose();\r\n\t\tSystem::String* s_Mew\t\t\t= (CS_NEW System::String())->_appendC('M')->_appendC('e')->_appendC('w')->_appendClose();\r\n\r\n\t\t// Test - Contructor\r\n\t\tSystem::Collections::Generic::Dictionary<System::String*,System::String*>* dic = NULL;\r\n\t\tdic = CS_NEW System::Collections::Generic::Dictionary<System::String*,System::String*>(1);\r\n\t\tSystem::Memory::registerGCRoot(&dic);\r\n\t\tprintf(\"[DictionaryTest] Constructors 1.0 - Count = %i\\n\", dic->_acc_gCount());\r\n\t\tprintf(\"[DictionaryTest] Constructors 1.0 - Display\\n\");  \r\n\t\tDisplayDictionary(dic);\r\n\t\tprintf(\"\\n\");\r\n            \r\n\t\t// Test - Add\r\n\t\tprintf(\"[DictionaryTest] Add 1.0+ - before - Count = %i\\n\", dic->_acc_gCount());\r\n\t\tprintf(\"[DictionaryTest] Add 1.0+ - before - Display\\n\");  \r\n\t\tDisplayDictionary(dic);\r\n\t\tprintf(\"\\n\");\r\n            \r\n\t\tdic->Add(s_red   , s_Hitokage);\r\n\t\tdic->Add(s_blue  , s_Zenigame);\r\n\t\tdic->Add(s_green , s_Fushigidane);\r\n\t\tdic->Add(s_yellow, s_Pikachu);\r\n\t\tdic->Add(s_friend, s_Pikachu);\r\n            \r\n\t\tprintf(\"[DictionaryTest] Add 1.0 - result - Count = %i\\n\", dic->_acc_gCount());\r\n\t\tprintf(\"[DictionaryTest] Add 1.0 - result - Display\\n\");  \r\n\t\tDisplayDictionary(dic);\r\n\r\n\t\t\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"###### Mark & Sweep with compaction #####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\t\r\n\t\t/*\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#### Mark & Sweep without compaction ####\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1));\r\n\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"# Compaction based on Reference Counting#\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\t\tprintf(\"#########################################\\n\");\r\n\r\n\t\tSystem::Memory::compactionSmall();\r\n\t\t*/\r\n\r\n\t\tDisplayDictionary(dic);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/TestSuite/MemoryTests.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _MemoryTests_\r\n#define _memoryTests_\r\n\r\nnamespace InternalTests {\r\n\r\nvoid RefSetValueTests();\r\nvoid GCTest1();\r\nvoid GCTestArray();\r\nvoid GCTestList();\r\nvoid GCTestDictionary();\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/inline/__InternalUtilsGetTypeID_specializations.inl",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBException*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 50; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBExceptionNotImplemented*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 51; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBExceptionForbiddenMethod*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 52; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBExceptionNullCppObject*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 53; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBExceptionTooOld*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 54; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::GameObject*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 55; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::GameObjectFactory*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 56; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::NativeManagement*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 57; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerV_inner0*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 59; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerII_inner1*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 61; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerIII_inner2*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 63; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerIIII_inner3*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 65; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerS_inner4*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 67; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerSII_inner5*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 69; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerSU_inner6*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 71; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerSS_inner7*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 73; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUS_inner8*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 75; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUSS_inner9*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 77; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerU_inner10*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 79; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUU_inner11*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 81; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUFF_inner12*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 83; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUI_inner13*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 85; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUII_inner14*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 87; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUIIII_inner15*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 89; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUIIUU_inner16*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 91; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUUII_inner17*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 93; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerUUUII_inner18*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 95; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerIIIP_retB_inner19*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 97; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_FunctionPointerFS_inner20*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 99; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::NodeIterator*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 100; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::Element*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 101; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::Container*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 103; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::Selectable*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 104; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::AnimationNode*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 105; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::Size> { static u32 getIt() { return _TYPE_USEROBJECT | ET_STRUCT | 106; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::USize> { static u32 getIt() { return _TYPE_USEROBJECT | ET_STRUCT | 107; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::FSize> { static u32 getIt() { return _TYPE_USEROBJECT | ET_STRUCT | 108; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::IClientRequest*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 109; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::__FrameworkUtils*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 111; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::WrapperReg*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 113; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSAPP*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 114; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSAsset*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 116; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSBin*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 117; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSData*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 118; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSDB*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 119; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSDebug*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 120; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSEng*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 122; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSFont*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 123; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::STextInfo_inner0> { static u32 getIt() { return _TYPE_USEROBJECT | ET_STRUCT | 125; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSGL*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 126; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSKey*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 127; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSLang*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 128; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSMatrix*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 129; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSVector_inner1*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 131; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSRES*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 132; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSSound*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 133; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSSystem*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 135; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::SystemInfo_inner2> { static u32 getIt() { return _TYPE_USEROBJECT | ET_STRUCT | 137; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CSUI*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 138; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBAsyncLoader*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 140; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner21*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 142; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBGenericTask*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 143; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 145; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_DieCallBack_inner23*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 147; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBIntervalTimer*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 148; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner24*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 150; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBNetAPI*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 152; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner25*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 154; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 156; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBStoreService*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 158; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner27*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 160; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBTask*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 161; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_onDieCallBack_inner28*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 163; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUICanvas*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 166; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner29*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 168; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIClip*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 169; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIControl*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 170; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_OnClickCallBack_inner30*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 172; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 174; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_OnDragCallBack_inner32*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 176; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 178; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 180; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIDebugItem*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 183; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner35*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 185; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIDragIcon*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 186; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner36*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 188; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::Area_inner3> { static u32 getIt() { return _TYPE_USEROBJECT | ET_STRUCT | 190; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIForm*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 193; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_SelectableCallBack_inner37*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 195; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_AnimCallBack_inner38*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 197; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIFreeVertItem*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 198; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIGroup*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 199; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_AnimCallBack_inner39*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 201; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUILabel*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 202; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIList*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 204; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_LimitCallBack_inner40*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 206; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_DragCallBack_inner41*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 208; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_DynamicCallBack_inner42*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 210; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 212; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_AnimCallBack_inner44*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 214; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIMoviePlayer*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 218; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner45*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 220; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIMultiImgItem*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 221; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIPieChart*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 222; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIPolyline*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 223; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIProgressBar*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 224; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIRubberBand*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 225; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIScale9*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 226; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::AnimationInfo*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 227; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIScore*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 229; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIScrollBar*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 231; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 233; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUISimpleItem*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 235; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUISWFPlayer*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 236; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner47*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 238; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUITask*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 239; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::Spline_inner4*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 243; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::IntSpline_inner5*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 245; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::IntPoint_inner6*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 247; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::FloatSpline_inner7*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 249; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::FloatPoint_inner8*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 251; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::AnimSpline_inner9*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 253; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUITextInput*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 254; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner48*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 256; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUITouchPad*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 258; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner49*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 260; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIVariableItem*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 262; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIVirtualDoc*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 263; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner50*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 265; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::CKLBUIWebArea*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 268; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<EnginePrototype::_Delegate_Base_CallBack_inner51*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 270; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<Program*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 271; } };\r\ntemplate<> struct __InternalUtilsGetTypeID<SampleGame::Program*> { static u32 getIt() { return _TYPE_USEROBJECT | ET_CLASS | 272; } };\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/inline/classPrototypes.inl",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nclass Program;\r\n\r\nnamespace EnginePrototype {\r\n    class _Delegate_Base_FunctionPointerV_inner0;\r\n    template <class TClass> class _DelegateI_FunctionPointerV_inner0;\r\n    class _DelegateS_FunctionPointerV_inner0;\r\n    class _Delegate_Base_FunctionPointerII_inner1;\r\n    template <class TClass> class _DelegateI_FunctionPointerII_inner1;\r\n    class _DelegateS_FunctionPointerII_inner1;\r\n    class _Delegate_Base_FunctionPointerIII_inner2;\r\n    template <class TClass> class _DelegateI_FunctionPointerIII_inner2;\r\n    class _DelegateS_FunctionPointerIII_inner2;\r\n    class _Delegate_Base_FunctionPointerIIII_inner3;\r\n    template <class TClass> class _DelegateI_FunctionPointerIIII_inner3;\r\n    class _DelegateS_FunctionPointerIIII_inner3;\r\n    class _Delegate_Base_FunctionPointerS_inner4;\r\n    template <class TClass> class _DelegateI_FunctionPointerS_inner4;\r\n    class _DelegateS_FunctionPointerS_inner4;\r\n    class _Delegate_Base_FunctionPointerSII_inner5;\r\n    template <class TClass> class _DelegateI_FunctionPointerSII_inner5;\r\n    class _DelegateS_FunctionPointerSII_inner5;\r\n    class _Delegate_Base_FunctionPointerSU_inner6;\r\n    template <class TClass> class _DelegateI_FunctionPointerSU_inner6;\r\n    class _DelegateS_FunctionPointerSU_inner6;\r\n    class _Delegate_Base_FunctionPointerSS_inner7;\r\n    template <class TClass> class _DelegateI_FunctionPointerSS_inner7;\r\n    class _DelegateS_FunctionPointerSS_inner7;\r\n    class _Delegate_Base_FunctionPointerUS_inner8;\r\n    template <class TClass> class _DelegateI_FunctionPointerUS_inner8;\r\n    class _DelegateS_FunctionPointerUS_inner8;\r\n    class _Delegate_Base_FunctionPointerUSS_inner9;\r\n    template <class TClass> class _DelegateI_FunctionPointerUSS_inner9;\r\n    class _DelegateS_FunctionPointerUSS_inner9;\r\n    class _Delegate_Base_FunctionPointerU_inner10;\r\n    template <class TClass> class _DelegateI_FunctionPointerU_inner10;\r\n    class _DelegateS_FunctionPointerU_inner10;\r\n    class _Delegate_Base_FunctionPointerUU_inner11;\r\n    template <class TClass> class _DelegateI_FunctionPointerUU_inner11;\r\n    class _DelegateS_FunctionPointerUU_inner11;\r\n    class _Delegate_Base_FunctionPointerUFF_inner12;\r\n    template <class TClass> class _DelegateI_FunctionPointerUFF_inner12;\r\n    class _DelegateS_FunctionPointerUFF_inner12;\r\n    class _Delegate_Base_FunctionPointerUI_inner13;\r\n    template <class TClass> class _DelegateI_FunctionPointerUI_inner13;\r\n    class _DelegateS_FunctionPointerUI_inner13;\r\n    class _Delegate_Base_FunctionPointerUII_inner14;\r\n    template <class TClass> class _DelegateI_FunctionPointerUII_inner14;\r\n    class _DelegateS_FunctionPointerUII_inner14;\r\n    class _Delegate_Base_FunctionPointerUIIII_inner15;\r\n    template <class TClass> class _DelegateI_FunctionPointerUIIII_inner15;\r\n    class _DelegateS_FunctionPointerUIIII_inner15;\r\n    class _Delegate_Base_FunctionPointerUIIUU_inner16;\r\n    template <class TClass> class _DelegateI_FunctionPointerUIIUU_inner16;\r\n    class _DelegateS_FunctionPointerUIIUU_inner16;\r\n    class _Delegate_Base_FunctionPointerUUII_inner17;\r\n    template <class TClass> class _DelegateI_FunctionPointerUUII_inner17;\r\n    class _DelegateS_FunctionPointerUUII_inner17;\r\n    class _Delegate_Base_FunctionPointerUUUII_inner18;\r\n    template <class TClass> class _DelegateI_FunctionPointerUUUII_inner18;\r\n    class _DelegateS_FunctionPointerUUUII_inner18;\r\n    class _Delegate_Base_FunctionPointerIIIP_retB_inner19;\r\n    template <class TClass> class _DelegateI_FunctionPointerIIIP_retB_inner19;\r\n    class _DelegateS_FunctionPointerIIIP_retB_inner19;\r\n    class _Delegate_Base_FunctionPointerFS_inner20;\r\n    template <class TClass> class _DelegateI_FunctionPointerFS_inner20;\r\n    class _DelegateS_FunctionPointerFS_inner20;\r\n    class _Delegate_Base_CallBack_inner21;\r\n    template <class TClass> class _DelegateI_CallBack_inner21;\r\n    class _DelegateS_CallBack_inner21;\r\n    class _Delegate_Base_ExecuteCallBack_inner22;\r\n    template <class TClass> class _DelegateI_ExecuteCallBack_inner22;\r\n    class _DelegateS_ExecuteCallBack_inner22;\r\n    class _Delegate_Base_DieCallBack_inner23;\r\n    template <class TClass> class _DelegateI_DieCallBack_inner23;\r\n    class _DelegateS_DieCallBack_inner23;\r\n    class _Delegate_Base_CallBack_inner24;\r\n    template <class TClass> class _DelegateI_CallBack_inner24;\r\n    class _DelegateS_CallBack_inner24;\r\n    class _Delegate_Base_CallBack_inner25;\r\n    template <class TClass> class _DelegateI_CallBack_inner25;\r\n    class _DelegateS_CallBack_inner25;\r\n    class _Delegate_Base_CallBackVersionUp_inner26;\r\n    template <class TClass> class _DelegateI_CallBackVersionUp_inner26;\r\n    class _DelegateS_CallBackVersionUp_inner26;\r\n    class _Delegate_Base_CallBack_inner27;\r\n    template <class TClass> class _DelegateI_CallBack_inner27;\r\n    class _DelegateS_CallBack_inner27;\r\n    class _Delegate_Base_onDieCallBack_inner28;\r\n    template <class TClass> class _DelegateI_onDieCallBack_inner28;\r\n    class _DelegateS_onDieCallBack_inner28;\r\n    class _Delegate_Base_CallBack_inner29;\r\n    template <class TClass> class _DelegateI_CallBack_inner29;\r\n    class _DelegateS_CallBack_inner29;\r\n    class _Delegate_Base_OnClickCallBack_inner30;\r\n    template <class TClass> class _DelegateI_OnClickCallBack_inner30;\r\n    class _DelegateS_OnClickCallBack_inner30;\r\n    class _Delegate_Base_OnDblClickCallBack_inner31;\r\n    template <class TClass> class _DelegateI_OnDblClickCallBack_inner31;\r\n    class _DelegateS_OnDblClickCallBack_inner31;\r\n    class _Delegate_Base_OnDragCallBack_inner32;\r\n    template <class TClass> class _DelegateI_OnDragCallBack_inner32;\r\n    class _DelegateS_OnDragCallBack_inner32;\r\n    class _Delegate_Base_OnPinchCallBack_inner33;\r\n    template <class TClass> class _DelegateI_OnPinchCallBack_inner33;\r\n    class _DelegateS_OnPinchCallBack_inner33;\r\n    class _Delegate_Base_OnLongTapCallBack_inner34;\r\n    template <class TClass> class _DelegateI_OnLongTapCallBack_inner34;\r\n    class _DelegateS_OnLongTapCallBack_inner34;\r\n    class _Delegate_Base_CallBack_inner35;\r\n    template <class TClass> class _DelegateI_CallBack_inner35;\r\n    class _DelegateS_CallBack_inner35;\r\n    class _Delegate_Base_CallBack_inner36;\r\n    template <class TClass> class _DelegateI_CallBack_inner36;\r\n    class _DelegateS_CallBack_inner36;\r\n    class _Delegate_Base_SelectableCallBack_inner37;\r\n    template <class TClass> class _DelegateI_SelectableCallBack_inner37;\r\n    class _DelegateS_SelectableCallBack_inner37;\r\n    class _Delegate_Base_AnimCallBack_inner38;\r\n    template <class TClass> class _DelegateI_AnimCallBack_inner38;\r\n    class _DelegateS_AnimCallBack_inner38;\r\n    class _Delegate_Base_AnimCallBack_inner39;\r\n    template <class TClass> class _DelegateI_AnimCallBack_inner39;\r\n    class _DelegateS_AnimCallBack_inner39;\r\n    class _Delegate_Base_LimitCallBack_inner40;\r\n    template <class TClass> class _DelegateI_LimitCallBack_inner40;\r\n    class _DelegateS_LimitCallBack_inner40;\r\n    class _Delegate_Base_DragCallBack_inner41;\r\n    template <class TClass> class _DelegateI_DragCallBack_inner41;\r\n    class _DelegateS_DragCallBack_inner41;\r\n    class _Delegate_Base_DynamicCallBack_inner42;\r\n    template <class TClass> class _DelegateI_DynamicCallBack_inner42;\r\n    class _DelegateS_DynamicCallBack_inner42;\r\n    class _Delegate_Base_ScrollBarCallBack_inner43;\r\n    template <class TClass> class _DelegateI_ScrollBarCallBack_inner43;\r\n    class _DelegateS_ScrollBarCallBack_inner43;\r\n    class _Delegate_Base_AnimCallBack_inner44;\r\n    template <class TClass> class _DelegateI_AnimCallBack_inner44;\r\n    class _DelegateS_AnimCallBack_inner44;\r\n    class _Delegate_Base_CallBack_inner45;\r\n    template <class TClass> class _DelegateI_CallBack_inner45;\r\n    class _DelegateS_CallBack_inner45;\r\n    class _Delegate_Base_ScrollBarCallBack_inner46;\r\n    template <class TClass> class _DelegateI_ScrollBarCallBack_inner46;\r\n    class _DelegateS_ScrollBarCallBack_inner46;\r\n    class _Delegate_Base_CallBack_inner47;\r\n    template <class TClass> class _DelegateI_CallBack_inner47;\r\n    class _DelegateS_CallBack_inner47;\r\n    class _Delegate_Base_CallBack_inner48;\r\n    template <class TClass> class _DelegateI_CallBack_inner48;\r\n    class _DelegateS_CallBack_inner48;\r\n    class _Delegate_Base_CallBack_inner49;\r\n    template <class TClass> class _DelegateI_CallBack_inner49;\r\n    class _DelegateS_CallBack_inner49;\r\n    class _Delegate_Base_CallBack_inner50;\r\n    template <class TClass> class _DelegateI_CallBack_inner50;\r\n    class _DelegateS_CallBack_inner50;\r\n    class _Delegate_Base_CallBack_inner51;\r\n    template <class TClass> class _DelegateI_CallBack_inner51;\r\n    class _DelegateS_CallBack_inner51;\r\n    class CKLBException;\r\n    class CKLBExceptionNotImplemented;\r\n    class CKLBExceptionForbiddenMethod;\r\n    class CKLBExceptionNullCppObject;\r\n    class CKLBExceptionTooOld;\r\n    class GameObject;\r\n    class GameObjectFactory;\r\n    class NativeManagement;\r\n    class NodeIterator;\r\n    class Element;\r\n    class Container;\r\n    class Selectable;\r\n    class AnimationNode;\r\n    struct Size;\r\n    struct USize;\r\n    struct FSize;\r\n    class IClientRequest;\r\n    class __FrameworkUtils;\r\n    class WrapperReg;\r\n    class CSAPP;\r\n    class CSAsset;\r\n    class CSBin;\r\n    class CSData;\r\n    class CSDB;\r\n    class CSDebug;\r\n    class CSEng;\r\n    class CSFont;\r\n    struct STextInfo_inner0;\r\n    class CSGL;\r\n    class CSKey;\r\n    class CSLang;\r\n    class CSMatrix;\r\n    class CSVector_inner1;\r\n    class CSRES;\r\n    class CSSound;\r\n    class CSSystem;\r\n    struct SystemInfo_inner2;\r\n    class CSUI;\r\n    class CKLBAsyncLoader;\r\n    class CKLBGenericTask;\r\n    class CKLBIntervalTimer;\r\n    class CKLBNetAPI;\r\n    class CKLBStoreService;\r\n    class CKLBTask;\r\n    class CKLBUICanvas;\r\n    class CKLBUIClip;\r\n    class CKLBUIControl;\r\n    class CKLBUIDebugItem;\r\n    class CKLBUIDragIcon;\r\n    struct Area_inner3;\r\n    class CKLBUIForm;\r\n    class CKLBUIFreeVertItem;\r\n    class CKLBUIGroup;\r\n    class CKLBUILabel;\r\n    class CKLBUIList;\r\n    class CKLBUIMoviePlayer;\r\n    class CKLBUIMultiImgItem;\r\n    class CKLBUIPieChart;\r\n    class CKLBUIPolyline;\r\n    class CKLBUIProgressBar;\r\n    class CKLBUIRubberBand;\r\n    class CKLBUIScale9;\r\n    class AnimationInfo;\r\n    class CKLBUIScore;\r\n    class CKLBUIScrollBar;\r\n    class CKLBUISimpleItem;\r\n    class CKLBUISWFPlayer;\r\n    class CKLBUITask;\r\n    class Spline_inner4;\r\n    class IntSpline_inner5;\r\n    class IntPoint_inner6;\r\n    class FloatSpline_inner7;\r\n    class FloatPoint_inner8;\r\n    class AnimSpline_inner9;\r\n    class CKLBUITextInput;\r\n    class CKLBUITouchPad;\r\n    class CKLBUIVariableItem;\r\n    class CKLBUIVirtualDoc;\r\n    class CKLBUIWebArea;\r\n\r\n}\r\nnamespace SampleGame {\r\n    class Program;\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/main.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifdef _WIN32\r\n#pragma warning disable 4820, 4986\r\n#include <Windows.h>\r\n#endif\r\n\r\n#include <stdio.h>\r\n\r\n#include \"CS_Object.h\"\r\n#include \"CS_String.h\"\r\n#include \"Collections/Generic/CS_List.h\"\r\n#include \"Collections/Generic/CS_Dictionary.h\"\r\n#include \"MarshallingUtils.h\"\r\n#include \"CS_Console.h\"\r\n#include \"CS_Math.h\"\r\n\r\n// Tests\r\n#include \"MemoryTests.h\"\r\n\r\n// BENCHMARK\r\n\r\n#pragma comment (lib,\"Winmm.lib\")\r\n#include <windows.h>\r\n#include <mmsystem.h>\r\n#include <iostream>\r\n\r\nclass cTime\r\n{\r\npublic:\r\n\tstatic cTime*\tInstance();\r\n\tstatic void\t\tDestroy();\r\n\r\n\tvoid\toperator()();\r\n\tUINT64\tGetDTime(){return mDTime;}\r\n\r\nprivate:\r\n\tcTime():mDTime(0)\r\n\t{\r\n\t\tmLastGameTime = (UINT64)timeGetTime();\r\n\t}\r\n\t~cTime() {}\r\n\r\n\tstatic cTime *mInstance;\r\n\tUINT64 mLastGameTime;\r\n\tUINT64 mDTime;\r\n};\r\n\r\ncTime *cTime::mInstance\t=\t0;\r\n\r\ncTime *cTime::Instance()\r\n{\r\n\tif(mInstance)\r\n\t\treturn mInstance;\r\n\treturn mInstance = new cTime;\r\n}\r\n\r\nvoid cTime::Destroy()\r\n{\r\n\tif(mInstance)\r\n\t\tdelete mInstance;\r\n}\r\n\r\nvoid cTime::operator()()\r\n{\r\n\tUINT64 ticks = (UINT64)timeGetTime();\r\n\r\n\tmDTime = ticks - mLastGameTime;\r\n\r\n\tmLastGameTime = ticks;\r\n}\r\n\r\nvoid DisplayUniCharArray(System::Array<uniChar>* _array) {\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%c\",_array->_idx_g(i));\r\n\t}\r\n}\r\n\r\ntemplate <class T>\r\nvoid DisplayArray(System::Array<T>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%s|\", (_array->_idx_g(i)) ? _array->_idx_g(i)->ToString()->_toCStr() : \"\");\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<s64>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<u64>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<s32>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<u32>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<s16>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<u16>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<s8>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<u8>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%i|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<float>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%G|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<double>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%G|\", _array->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayArray(System::Array<bool>* _array) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _array->_acc_gLength(); ++i) {\r\n\t\tprintf(\"%s|\", (_array->_idx_g(i)) ? \"True\":\"False\" );\r\n\t}\r\n}\r\n\r\ntemplate<class T> \r\nvoid DisplayArrayInfos(System::Array<T>* _array) {\r\n\tprintf(\"Length = %i \\t Rank = %i\", _array->_acc_gLength(), _array->_acc_gRank());\r\n}\r\n\r\ntemplate <class T>\r\nvoid DisplayList(System::Collections::Generic::List<T>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%s|\", _list->_idx_g(i)->ToString()->_toCStr());\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<s64>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<u64>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<s32>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<u32>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<u16>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<s16>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<u8>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<s8>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%i|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<float>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%G|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<double>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%G|\", _list->_idx_g(i));\r\n\t}\r\n}\r\ntemplate <> void DisplayList(System::Collections::Generic::List<bool>* _list) {\r\n\tprintf(\"|\");\r\n\tfor(int i = 0; i < _list->_acc_gCount(); ++i) {\r\n\t\tprintf(\"%s|\", (_list->_idx_g(i)) ? \"True\":\"False\");\r\n\t}\r\n}\r\n\r\ntemplate<class T> \r\nvoid DisplayListInfos(System::Collections::Generic::List<T>* _list) {\r\n\tprintf(\"Capacity = %i \\t Count = %i\", _list->_acc_gCapacity(), _list->_acc_gCount());\r\n}\r\n\r\ntemplate<class TKey, class TValue>\r\ninline void DisplayDictionary(System::Collections::Generic::Dictionary<TKey,TValue>* _dictionary) {\r\n\tprintf(\"DIPLAY NOT IMPLEMENTED FOR THESE TYPES.\\n\");\r\n}\r\n\r\ntemplate<>\r\ninline void DisplayDictionary(System::Collections::Generic::Dictionary<System::String*,System::String*>* _dictionary) {\r\n\t_dictionary->_display();\r\n}\r\n\r\nint main_tests()\r\n{\r\n\t// Benchmark\r\n\t/*\r\n\tcTime &TimeRef = *cTime::Instance();\r\n\tTimeRef();\r\n\r\n\tTimeRef();\r\n\tstd::cout<<\"Benchmark1 - : \"<<TimeRef.GetDTime() << std::endl;\r\n\t*/\t\r\n\r\n\t//InternalTests::RefSetValueTests();\r\n\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"############# String Tests ##############\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"\\n\\n\");\r\n    \r\n    System::String\t\t\t\t\t\t\t\t*s, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *a, *b, *c, *d, *hw;\r\n\tSystem::Array<System::String*>\t\t\t\t*strArray, *strArray2;\r\n\tSystem::Array<uniChar> *charArray,\t\t\t*charArray2;\r\n\tSystem::Array<System::Object*>\t\t\t\t*objArray;\r\n\tSystem::Array<s32>\t\t\t\t\t\t\t*intArray, *intArray2;\r\n\tSystem::Object* obj;\r\n\tSystem::Collections::Generic::List<s32>\t\t*intList, *intList2;\r\n\tSystem::Collections::Generic::List<System::String*> *strList, *strList2;\r\n\r\n\tconst uniChar c_a[6]\t\t\t= {'a','b','c','d','e'};\r\n    const uniChar c_b[6]\t\t\t= {'q','w','e','r','t', 'y'};\r\n    const uniChar c_c[6]\t\t\t= {'Q','W','e','r','T', 'Y'};\r\n\tconst uniChar c_hw[12]\t\t\t= {'H','e','l','l','o',' ','W','o','r','l','d','!'};\r\n\tconst uniChar c_hello[5]\t\t= {'H','e','l','l','o'};\r\n\tconst uniChar c_world[5]\t\t= {'W','o','r','l','d'};\r\n\tconst uniChar c_digits[11]\t\t= {'0',' ','1',' ','2',' ','3',' ','4',' ','5'};\r\n\tconst uniChar c_hw_toTrim[27]\t= {' ',' ',' ',' ',' ','H','e','l','l','o',' ','W','o','r','l','d','!',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; \r\n\tconst uniChar c_badGuy[10]\t\t= {0xDBFF, 0xDFFF};\r\n\r\n\r\n\t//const char*   char_hw\t\t\t= \"Hello World\";\r\n\t//s = __MarshallingUtils::StringFromNativeUtf8((int *)char_hw);\r\n\r\n\t//char**  char_array = (char**)CS_MALLOC(3 * sizeof(const char*));\r\n\t//char_array[0] = \"Hi\";\r\n\t//char_array[1] = \"Hello !\";\r\n\t//char_array[2] = \"and Yo ! :D\";\r\n\r\n\t//strArray = __MarshallingUtils::StringArrayFromNativeUtf8IntPtr((int*) char_array, 3);\r\n\r\n\t//System::Console::WriteLine(s);\r\n\r\n\thw = CS_NEW System::String(c_hw, 12);\r\n\ts = CS_NEW System::String(c_badGuy, 2);\r\n\t//printf(\"%s\", s->_toCStr());\r\n\r\n    //Test - warning zone\r\n\t//printf(\"[StringTest] Allocator - Warning Zone\\n\");\r\n    //for(int i = 0; i < 200; ++i) {\r\n    //    s = CS_NEW(System::String);\r\n    //    s->_appendI(i)->_appendC(' ')->_appendClose();\r\n    //}\r\n\r\n\t// Test - Ctor + _appendC + _appendClose\r\n\tuniChar* cArr = CS_NEWA(uniChar,10);\r\n\tcArr[0] = 'H'; cArr[1] = 'e'; cArr[2] = 'l'; cArr[3] = 'l'; cArr[4] = 'o';\r\n\tcharArray = CS_NEW System::Array<uniChar>(6);\r\n\tcharArray->_idx$_s(0, 'C');\r\n\tcharArray->_idx$_s(1, 'h');\r\n\tcharArray->_idx$_s(2, 'a');\r\n\tcharArray->_idx$_s(3, 'r');\r\n\tcharArray->_idx$_s(4, '[');\r\n\tcharArray->_idx$_s(5, ']');\r\n\tprintf(\"[StringTest] Constructor INTERNAL 0 - result = %s\\n\", (CS_NEW System::String)->_toCStr());\r\n\tprintf(\"[StringTest] Constructor INTERNAL 1 - result = %s\\n\", (CS_NEW System::String(cArr, 5))->_toCStr());\r\n\tprintf(\"[StringTest] Constructor INTERNAL 2 - result = %s\\n\", (CS_NEW System::String(cArr, 1,2))->_toCStr());\r\n\tprintf(\"[StringTest] Constructor 1.0 - result = %s\\n\", (CS_NEW System::String(charArray))->_toCStr());\r\n\tprintf(\"[StringTest] Constructor 1.1 - result = %s\\n\", (CS_NEW System::String('a',10))->_toCStr());\r\n\tprintf(\"[StringTest] Constructor 1.2 - result = %s\\n\", (CS_NEW System::String(charArray, 1,4))->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\tprintf(\"[StringTest] operator+\\n\");\r\n\ts = CS_NEW(System::String);\r\n\t(*s) = (*s)+(uniChar)'H'+(uniChar)'e'+(uniChar)'l'+(uniChar)'l'+(uniChar)'o';\r\n\ts->_appendClose();\r\n\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendC('H')->_appendC('e')->_appendC('l')->_appendC('l')->_appendC('o')->_appendC(' ')\r\n\t ->_appendC('W')->_appendC('o')->_appendC('r')->_appendC('l')->_appendC('d')->_appendC('!')->_appendClose();\r\n\r\n\t// Test - Ctor + _appendC + _appendClose\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendC('S')->_appendC('e')->_appendC('c')->_appendC('o')->_appendC('n')->_appendC('d')->_appendC(' ')\r\n\t ->_appendC('H')->_appendC('e')->_appendC('l')->_appendC('l')->_appendC('o')->_appendC(' ')\r\n\t ->_appendC('W')->_appendC('o')->_appendC('r')->_appendC('l')->_appendC('d')->_appendC('!')->_appendClose();\r\n\r\n\t// Test - _appendI\r\n\ts = CS_NEW(System::String);\r\n\t(*s)+(-1021);\r\n\ts->_appendClose();\r\n\r\n\t// Test - _appendU\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendU(123)->_appendClose();\r\n\r\n\t// Test - _appendF\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendC(' ')->_appendF(1234.0f)\r\n     ->_appendC(' ')->_appendF(123456789.0f)\r\n\t ->_appendC(' ')->_appendF(0.00123456f)\r\n\t ->_appendClose();\r\n\r\n\t// Test - _appendS\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendS(32767)->_appendClose();\r\n\t\r\n\t// Test - _appendUS\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendU(42)->_appendClose();\r\n\r\n\t// Test - _appendS8\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendS8(123)->_appendClose();\r\n\r\n\t// Test - _appendU8\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendU8(45)->_appendClose();\r\n\r\n\t// Test - _appendB\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendB(true)->_appendB(false)->_appendClose();\r\n\r\n\t// Test - _appendL\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendL(9223372036854775807)->_appendClose();\r\n\r\n\t// Test - _appendUL\r\n\ts = CS_NEW(System::String);\r\n\ts->_appendUL(18446744073709551615)->_appendClose();\r\n\r\n\t// Test - _appendD\r\n    s = CS_NEW(System::String);\r\n\ts->_appendD(123456.12345678901234567890)->_appendClose();\r\n    \r\n    //　Test - _appendStr\r\n    s2 = CS_NEW(System::String);\r\n\t(*s2) = (*s2) + ' ' + ' ' + ' ' + (*s) + ' ' + ' ' + ' ';\r\n    \r\n    // Test - _appendCte\r\n\ta = CS_NEW(System::String);\r\n    a->_appendCte(c_a, 5)->_appendClose();\r\n\r\n\t// Test - Operators\r\n\t// TODO\r\n\r\n\t// Test - Compare\r\n\ta = CS_NEW System::String(c_a, 5);\t\t\t// \"abcde\"\r\n\tb = System::String::Copy(a);\t\t\t\t// \"abcde\"\r\n    c = CS_NEW System::String(c_b, 6);\t\t\t// \"qwerty\"\r\n    d = CS_NEW System::String(c_c, 6);\t\t\t// \"QWerTY\"\r\n\r\n    printf(\"[StringTest] Compare 1.0 - result = %i\\n\",\tSystem::String::Compare(a, b));\r\n    printf(\"[StringTest] Compare 1.1 - result = %i\\n\",\tSystem::String::Compare(a, c));\r\n    printf(\"[StringTest] Compare 1.2 - result = %i\\n\",\tSystem::String::Compare(c, a));\r\n    printf(\"[StringTest] Compare 1.3 - result = %i\\n\",\tSystem::String::Compare(c, d));\r\n    printf(\"[StringTest] Compare 1.4 - result = %i\\n\",\tSystem::String::Compare(c, NULL));\r\n    printf(\"[StringTest] Compare 1.5 - result = %i\\n\",\tSystem::String::Compare(NULL, d));\r\n    printf(\"[StringTest] Compare 1.6 - result = %i\\n\",\tSystem::String::Compare(NULL, NULL));\r\n\tprintf(\"\\n\");\r\n    \r\n    printf(\"[StringTest] Compare 2.0 - result = %i\\n\",\tSystem::String::Compare(a, b, true));\r\n    printf(\"[StringTest] Compare 2.1 - result = %i\\n\",\tSystem::String::Compare(a, c, true));\r\n    printf(\"[StringTest] Compare 2.2 - result = %i\\n\",\tSystem::String::Compare(c, a, true));\r\n    printf(\"[StringTest] Compare 2.3 - result = %i\\n\",\tSystem::String::Compare(c, d, true));\r\n    printf(\"[StringTest] Compare 2.4 - result = %i\\n\",\tSystem::String::Compare(c, NULL, true));\r\n    printf(\"[StringTest] Compare 2.5 - result = %i\\n\",\tSystem::String::Compare(NULL, d, true));\r\n    printf(\"[StringTest] Compare 2.6 - result = %i\\n\",\tSystem::String::Compare(NULL, NULL, true));\r\n\tprintf(\"\\n\");\r\n    \r\n    // Test - Concat\r\n\tobj = CS_NEW System::Object();\r\n\tobjArray = CS_NEW System::Array<System::Object*>(2);\r\n\tobjArray->_idx$_s(0, obj);\r\n\tobjArray->_idx$_s(1, hw);\r\n\tstrArray = CS_NEW System::Array<System::String*>(4);\r\n\tstrArray->_idx$_s(0, CS_NEW System::String(c_hello, 5));\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC(' ')->_appendClose());\r\n\tstrArray->_idx$_s(2, CS_NEW System::String(c_world, 5));\r\n\tstrArray->_idx$_s(3, (CS_NEW System::String())->_appendC('!')->_appendClose());\r\n\t\r\n\ts = System::String::Concat(obj);\r\n\tprintf(\"[StringTest] Concat 1.0 - result = %s\\n\", s->_toCStr());\r\n\tprintf(\"\\n\");\r\n\ts = System::String::Concat(objArray);\r\n\tprintf(\"[StringTest] Concat 2.0 - result = %s\\n\", s->_toCStr());\r\n\tprintf(\"\\n\");\r\n\ts = System::String::Concat(strArray);\r\n\tprintf(\"[StringTest] Concat 3.0 - result = %s\\n\", s->_toCStr());\r\n\tprintf(\"\\n\");\r\n   \r\n\t// Test - Copy\r\n\ts1 = (CS_NEW System::String())->_appendC('a')->_appendC('b')->_appendC('c')->_appendClose();\t// \"abc\"\r\n\ts2 = (CS_NEW System::String())->_appendC('x')->_appendC('y')->_appendC('z')->_appendClose();\t// \"xyz\"\r\n\tprintf(\"[StringTest] Copy 1.0 - before - s1 = %s\\n\", s1->_toCStr());\r\n\tprintf(\"[StringTest] Copy 1.0 - before - s2 = %s\\n\", s2->_toCStr());\r\n\ts2 = System::String::Copy(s1);\r\n\tprintf(\"[StringTest] Copy 1.0 - result - s1 = %s\\n\", s1->_toCStr());\r\n\tprintf(\"[StringTest] Copy 1.0 - result - s2 = %s\\n\", s2->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Equals (static)\r\n\ta = CS_NEW System::String(c_a,5);\t// \"abcde\"\r\n\tb = System::String::Copy(a);\t\t// \"abcde\"\r\n\tc = CS_NEW System::String(c_b,6);\t// \"qwerty\"\r\n\td = CS_NEW System::String(c_c,6);\t// \"QWerTY\"\r\n\tprintf(\"[StringTest] Equals 1.0 - result = %s\\n\",\t(System::String::Equals(a,a)) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Equals 1.1 - result = %s\\n\",\t(System::String::Equals(a,b)) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Equals 1.2 - result = %s\\n\",\t(System::String::Equals(a,c)) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Equals 1.3 - result = %s\\n\",\t(System::String::Equals(a,d)) ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Format\r\n\r\n\r\n\t\r\n    // Test - IsNullOrEmpty\r\n    s = CS_NEW(System::String);\r\n    printf(\"[StringTest] IsNullOrEmpty 1.0 - result = %s\\n\",\tSystem::String::IsNullOrEmpty(a)\t? \"True\" : \"False\");\r\n    printf(\"[StringTest] IsNullOrEmpty 1.1 - result = %s\\n\",\tSystem::String::IsNullOrEmpty(NULL) ? \"True\" : \"False\");\r\n    printf(\"[StringTest] IsNullOrEmpty 1.2 - result = %s\\n\",\tSystem::String::IsNullOrEmpty(s)\t? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n    \r\n\t// Test - Join \r\n\tstrArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx_s(0, CS_NEW System::String(c_hello, 5));\t\t\t\t\t\t\t\t// \"Hello\"\r\n\tstrArray->_idx_s(1, CS_NEW System::String(c_world, 5));\t\t\t\t\t\t\t\t// \"World\"\r\n\tstrArray->_idx_s(2, (CS_NEW System::String())->_appendC('!')->_appendClose());\t\t// \"!\"\r\n\tprintf(\"[StringTest] Join 1.0 - result = %s\\n\", System::String::Join(NULL, strArray)->_toCStr());\r\n\tprintf(\"[StringTest] Join 1.1 - result = %s\\n\", System::String::Join((CS_NEW System::String())->_appendC(' ')->_appendC('-')->_appendC(' ')->_appendClose(), strArray)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] Join 2.0 - result = %s\\n\", System::String::Join(NULL, strArray, 1, 2)->_toCStr());\r\n\tprintf(\"[StringTest] Join 2.1 - result = %s\\n\", System::String::Join((CS_NEW System::String())->_appendC(' ')->_appendC('-')->_appendC(' ')->_appendClose(), strArray, 1, 2)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Clone\r\n\ts1 = (CS_NEW System::String())->_appendC('a')->_appendC('b')->_appendC('c')->_appendClose();\t// \"abc\"\r\n\ts2 = (CS_NEW System::String())->_appendC('x')->_appendC('y')->_appendC('z')->_appendClose();\t// \"xyz\"\r\n\tprintf(\"[StringTest] Clone 1.0 - before - s1 = %s\\n\", s1->_toCStr());\r\n\tprintf(\"[StringTest] Clone 1.0 - before - s2 = %s\\n\", s2->_toCStr());\r\n\tobj = s1->Clone();\r\n\tprintf(\"[StringTest] Clone 1.0 - result - s1  = %s\\n\", s1->_toCStr());\r\n\tprintf(\"[StringTest] Clone 1.0 - result - obj = %s\\n\", obj->ToString()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n    // Test - CompareTo\r\n    a = CS_NEW System::String(c_a,5);\t// \"abcde\"\r\n\tb = System::String::Copy(a);\t\t// \"abcde\"\r\n\tc = CS_NEW System::String(c_b,6);\t// \"qwerty\"\r\n\td = CS_NEW System::String(c_c,6);\t// \"QWerTY\"\r\n\ts = System::String::Empty;\r\n\tprintf(\"[StringTest] CompareTo 1.0 - result = %i\\n\",\ta->CompareTo((System::Object*)a));\r\n    printf(\"[StringTest] CompareTo 1.1 - result = %i\\n\",\ta->CompareTo((System::Object*)c));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] CompareTo 2.0 - result = %i\\n\",\ta->CompareTo(b));\r\n    printf(\"[StringTest] CompareTo 2.1 - result = %i\\n\",\ta->CompareTo(c));\r\n    printf(\"[StringTest] CompareTo 2.2 - result = %i\\n\",\tc->CompareTo(a));\r\n    printf(\"[StringTest] CompareTo 2.3 - result = %i\\n\",\tc->CompareTo(d));\r\n    printf(\"[StringTest] CompareTo 2.4 - result = %i\\n\",\tc->CompareTo((System::String*)NULL));\r\n    printf(\"[StringTest] CompareTo 2.5 - result = %i\\n\",\ts->CompareTo((System::String*)NULL));\r\n    printf(\"\\n\");\r\n    \r\n    // Test - Contains\r\n\ts = System::String::Copy(hw);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// \"Hello World!\"\r\n\ts1 = (CS_NEW System::String())->_appendStr(hw, 1, 11)->_appendClose();\t\t\t\t\t\t// \"ello World!\"\r\n\ts2 = (CS_NEW System::String())->_appendC(' ')->_appendStr(hw, 0, 12)->_appendClose();\t\t// \" Hello World!\"\r\n\ts3 = (CS_NEW System::String())->_appendC('o')->_appendClose();\t\t\t\t\t\t\t\t// \"o\"\r\n\ts4 = (CS_NEW System::String())->_appendC('a')->_appendClose();\t\t\t\t\t\t\t\t// \"a\"\r\n\tprintf(\"[StringTest] Contains 1.0 - result = %s\\n\",\ts->Contains(hw) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Contains 1.1 - result = %s\\n\",\ts->Contains(s1) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Contains 1.2 - result = %s\\n\",\ts->Contains(s2) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Contains 1.3 - result = %s\\n\",\ts->Contains(s3) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Contains 1.4 - result = %s\\n\",\ts->Contains(s4) ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - CopyTo\r\n\tcharArray = CS_NEW System::Array<uniChar>(7);\r\n\tcharArray->_idx$_s(0, 'I');\r\n\tcharArray->_idx$_s(1, 'n');\r\n\tcharArray->_idx$_s(2, 'i');\r\n\tcharArray->_idx$_s(3, 't');\r\n\tcharArray->_idx$_s(4, 'i');\r\n\tcharArray->_idx$_s(5, 'a');\r\n\tcharArray->_idx$_s(6, 'l');\r\n\ts = (CS_NEW System::String())->_appendC('M')->_appendC('o')->_appendC('d')->_appendC('i')->_appendC('f')->_appendC('i')->_appendC('e')->_appendC('d')->_appendClose();\r\n\tprintf(\"[StringTest] CopyTo 1.0 - initial char array = \");\r\n\tDisplayUniCharArray(charArray);\r\n\tprintf(\"\\n\");\r\n\ts->CopyTo(0, charArray, 0, s->_acc_gLength() - 1);\r\n\tprintf(\"[StringTest] CopyTo - base string = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] CopyTo 1.0 - result = \");\tDisplayUniCharArray(charArray);\tprintf(\"\\n\");\r\n\ts->CopyTo(2, charArray, 4, 1);\r\n\tprintf(\"[StringTest] CopyTo 1.1 - result = \");\tDisplayUniCharArray(charArray);\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - EndsWith\r\n\ts = System::String::Copy(hw);\r\n\ts1 = (CS_NEW System::String())->_appendCte(c_world, 5)->_appendC('!')->_appendClose();\t\t// \"World!\"\r\n\ts2 = (CS_NEW System::String(c_world, 5));\t\t\t\t\t\t\t\t\t\t\t\t\t// \"World\"\r\n\tprintf(\"[StringTest] EndsWith 1.0 - result = %s\\n\",\ts->EndsWith(s1) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] EndsWith 1.1 - result = %s\\n\",\ts->EndsWith(s2) ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Equals\r\n\tconst uniChar _obj_str[] =\t\t\t{'S','y','s','t','e','m','.','O','b','j','e','c','t'};\r\n\tconst uniChar _obj_str_upper[] =\t{'S','Y','S','T','E','M','.','O','B','J','E','C','T'};\r\n\ts\t= CS_NEW System::String(_obj_str, 13);\r\n\ts2\t= CS_NEW System::String(_obj_str_upper, 13);\r\n\tobj = CS_NEW System::Object();\r\n\tprintf(\"[StringTest] Equals 1.0 - result = %s\\n\", s->Equals(obj) ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] Equals 2.0 - result = %s\\n\", s->Equals(obj->ToString()) ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n\t// TODO\r\n\t/*printf(\"[StringTest] Equals 3.0 - result = %s\\n\", s->Equals(s2) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] Equals 3.0 - result = %s\\n\",\ts->Equals(s2) ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");*/\r\n\r\n\t// Test - GetHashCode\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] GetHashCode - result = %i\\n\", s->GetHashCode());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - IndexOf\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] IndexOf 1.0 - result = %i\\n\",\ts->IndexOf('a'));\r\n\tprintf(\"[StringTest] IndexOf 1.1 - result = %i\\n\",\ts->IndexOf('o'));\r\n\tprintf(\"[StringTest] IndexOf 1.2 - result = %i\\n\",\ts->IndexOf('O'));\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] IndexOf 2.0 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('t')->_appendClose()));\t\t\t\t\t// \"t\"\r\n\tprintf(\"[StringTest] IndexOf 2.1 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('l')->_appendC('l')->_appendClose()));\t// \"ll\"\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] IndexOf 3.0 - result = %i\\n\",\ts->IndexOf('t', 5));\r\n\tprintf(\"[StringTest] IndexOf 3.1 - result = %i\\n\",\ts->IndexOf('o', 5));\r\n\tprintf(\"[StringTest] IndexOf 3.2 - result = %i\\n\",\ts->IndexOf('o', 9));\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] IndexOf 4.0 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('t')->_appendClose(), 5));\r\n\tprintf(\"[StringTest] IndexOf 4.1 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('o')->_appendClose(), 5));\r\n\tprintf(\"[StringTest] IndexOf 4.2 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('o')->_appendClose(), 9));\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] IndexOf 5.0 - result = %i\\n\",\ts->IndexOf('t', 2, 3));\r\n\tprintf(\"[StringTest] IndexOf 5.1 - result = %i\\n\",\ts->IndexOf('o', 2, 3));\r\n\tprintf(\"[StringTest] IndexOf 5.2 - result = %i\\n\",\ts->IndexOf('o', 2, 1));\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] IndexOf 6.0 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('t')->_appendClose(), 2, 3));\r\n\tprintf(\"[StringTest] IndexOf 6.1 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('o')->_appendClose(), 2, 3));\r\n\tprintf(\"[StringTest] IndexOf 6.2 - result = %i\\n\",\ts->IndexOf((CS_NEW System::String())->_appendC('o')->_appendClose(), 2, 1));\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - IndexOfAny\r\n\ts = System::String::Copy(hw);\r\n\tcharArray = CS_NEW System::Array<uniChar>(2);\r\n\tcharArray->_idx$_s(0, 'a');\r\n\tcharArray->_idx$_s(1, 'b');\r\n\tcharArray2 = CS_NEW System::Array<uniChar>(4);\r\n\tcharArray2->_idx$_s(0, 'a');\r\n\tcharArray2->_idx$_s(1, 'b');\r\n\tcharArray2->_idx$_s(2, 'o');\r\n\tcharArray2->_idx$_s(3, 'l');\r\n\tprintf(\"[StringTest] IndexOfAny 1.0 - result = %i\\n\",\ts->IndexOfAny(charArray));\r\n    printf(\"[StringTest] IndexOfAny 1.1 - result = %i\\n\",\ts->IndexOfAny(charArray2));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] IndexOfAny 2.0 - result = %i\\n\",\ts->IndexOfAny(charArray, 5));\r\n    printf(\"[StringTest] IndexOfAny 2.1 - result = %i\\n\",\ts->IndexOfAny(charArray2, 5));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] IndexOfAny 3.0 - result = %i\\n\",\ts->IndexOfAny(charArray, 5, 1));\r\n    printf(\"[StringTest] IndexOfAny 3.1 - result = %i\\n\",\ts->IndexOfAny(charArray2, 5, 1));\r\n\tprintf(\"[StringTest] IndexOfAny 3.2 - result = %i\\n\",\ts->IndexOfAny(charArray2, 5, 3));\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Insert\r\n\ts =\t\t(CS_NEW System::String())->_appendC('H')->_appendC('e')->_appendC('o')->_appendC('r')->_appendC('l')->_appendC('d')->_appendC('!')->_appendClose();\t// \"Heorld!\"\r\n\ts1 =\t(CS_NEW System::String())->_appendC('l')->_appendC('l')->_appendC('o')->_appendC(' ')->_appendC('W')->_appendClose();\t\t\t\t\t\t\t\t// \"llo W\"\r\n\tprintf(\"[StringTest] Insert 1.0 - before = %s\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] Insert 1.0 - result = %s\\n\",\ts->Insert(2, s1)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - LastIndexOf\r\n\ts\t= System::String::Copy(hw);\r\n\ts1\t= (CS_NEW System::String())->_appendC('t')->_appendClose();\r\n\ts2\t= (CS_NEW System::String())->_appendC('o')->_appendClose();\r\n    printf(\"[StringTest] LastIndexOf 1.0 - result = %i\\n\",\ts->LastIndexOf('a'));\r\n    printf(\"[StringTest] LastIndexOf 1.1 - result = %i\\n\",\ts->LastIndexOf('o'));\r\n    printf(\"[StringTest] LastIndexOf 1.2 - result = %i\\n\",\ts->LastIndexOf('O'));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOf 1.0 - result = %i\\n\",\ts->LastIndexOf(s1));\r\n    printf(\"[StringTest] LastIndexOf 2.1 - result = %i\\n\",\ts->LastIndexOf(s2));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOf 3.0 - result = %i\\n\",\ts->LastIndexOf(s1, 5));\r\n    printf(\"[StringTest] LastIndexOf 3.1 - result = %i\\n\",\ts->LastIndexOf(s2, 5));\r\n    printf(\"[StringTest] LastIndexOf 3.2 - result = %i\\n\",\ts->LastIndexOf(s2, 9));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOf 4.0 - result = %i\\n\",\ts->LastIndexOf(s1, 5));\r\n    printf(\"[StringTest] LastIndexOf 4.1 - result = %i\\n\",\ts->LastIndexOf(s2, 5));\r\n    printf(\"[StringTest] LastIndexOf 4.2 - result = %i\\n\",\ts->LastIndexOf(s2, 9));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOf 5.0 - result = %i\\n\",\ts->LastIndexOf('t', 9, 3));\r\n    printf(\"[StringTest] LastIndexOf 5.1 - result = %i\\n\",\ts->LastIndexOf('o', 9, 3));\r\n    printf(\"[StringTest] LastIndexOf 5.2 - result = %i\\n\",\ts->LastIndexOf('o', 9, 1));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOf 6.0 - result = %i\\n\",\ts->LastIndexOf(s1, 9, 3));\r\n    printf(\"[StringTest] LastIndexOf 6.1 - result = %i\\n\",\ts->LastIndexOf(s2, 9, 3));\r\n    printf(\"[StringTest] LastIndexOf 6.2 - result = %i\\n\",\ts->LastIndexOf(s2, 9, 1));\r\n    printf(\"\\n\");\r\n\r\n\t// Test - LastIndexOfany\r\n\ts = System::String::Copy(hw);\r\n\tcharArray = CS_NEW System::Array<uniChar>(2);\r\n\tcharArray->_idx$_s(0, 'a');\r\n\tcharArray->_idx$_s(1, 'b');\r\n\tcharArray2 = CS_NEW System::Array<uniChar>(4);\r\n\tcharArray2->_idx$_s(0, 'a');\r\n\tcharArray2->_idx$_s(1, 'b');\r\n\tcharArray2->_idx$_s(2, 'o');\r\n\tcharArray2->_idx$_s(3, 'l');\r\n\tprintf(\"[StringTest] LastIndexOfAny 1.0 - result = %i\\n\",\ts->LastIndexOfAny(charArray));\r\n    printf(\"[StringTest] LastIndexOfAny 1.1 - result = %i\\n\",\ts->LastIndexOfAny(charArray2));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOfAny 2.0 - result = %i\\n\",\ts->LastIndexOfAny(charArray, 6));\r\n    printf(\"[StringTest] LastIndexOfAny 2.1 - result = %i\\n\",\ts->LastIndexOfAny(charArray2, 6));\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] LastIndexOfAny 3.0 - result = %i\\n\",\ts->LastIndexOfAny(charArray, 9, 1));\r\n    printf(\"[StringTest] LastIndexOfAny 3.1 - result = %i\\n\",\ts->LastIndexOfAny(charArray2, 9, 1));\r\n    printf(\"[StringTest] LastIndexOfAny 3.2 - result = %i\\n\",\ts->LastIndexOfAny(charArray2, 6, 3));\r\n    printf(\"\\n\");\r\n\r\n\t// Test - PadLeft\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] PadLeft 1.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] PadLeft 1.0 - result = |%s|\\n\",\ts->PadLeft(0)->_toCStr());\r\n    printf(\"[StringTest] PadLeft 1.1 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] PadLeft 1.1 - result = |%s|\\n\",\ts->PadLeft(15)->_toCStr());\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] PadLeft 2.0 - before = |%s|\\n\",\ts->_toCStr());\r\n    printf(\"[StringTest] PadLeft 2.0 - result = |%s|\\n\",\ts->PadLeft(0, '-')->_toCStr());\r\n\tprintf(\"[StringTest] PadLeft 2.1 - before = |%s|\\n\",\ts->_toCStr());\r\n    printf(\"[StringTest] PadLeft 2.1 - result = |%s|\\n\",\ts->PadLeft(15, '-')->_toCStr());\r\n    printf(\"\\n\");\r\n\r\n\t// Test - PadRight\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] PadRight 1.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] PadRight 1.0 - result = |%s|\\n\",\ts->PadRight(0)->_toCStr());\r\n\tprintf(\"[StringTest] PadRight 1.1 - before = |%s|\\n\",\ts->_toCStr());\r\n    printf(\"[StringTest] PadRight 1.1 - result = |%s|\\n\",\ts->PadRight(15)->_toCStr());\r\n    printf(\"\\n\");\r\n    printf(\"[StringTest] PadRight 2.0 - before = |%s|\\n\",\ts->_toCStr());\r\n    printf(\"[StringTest] PadRight 2.0 - result = |%s|\\n\",\ts->PadRight(0, '-')->_toCStr());\r\n\tprintf(\"[StringTest] PadRight 2.1 - before = |%s|\\n\",\ts->_toCStr());\r\n    printf(\"[StringTest] PadRight 2.1 - result = |%s|\\n\",\ts->PadRight(15, '-')->_toCStr());\r\n    printf(\"\\n\");\r\n\r\n\t// Test - Remove\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] Remove 1.0 - before = %s\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] Remove 1.0 - result = %s\\n\",\ts->Remove(5)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] Remove 2.0 - before = %s\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] Remove 2.0 - result = %s\\n\",\ts->Remove(5, 1)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Replace\t\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\ts1 = (CS_NEW System::String())->_appendC('1')->_appendC(' ')->_appendC('2')->_appendC(' ')->_appendC('a')->_appendClose();\r\n\ts2 = (CS_NEW System::String())->_appendC('1')->_appendC(' ')->_appendC('2')->_appendClose();\r\n\ts3 = (CS_NEW System::String())->_appendC('@')->_appendC('_')->_appendC('@')->_appendClose();\r\n\tprintf(\"[StringTest] Replace 1.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Replace 1.0 - result = %s\\n\", s->Replace('a', '-')->_toCStr());\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Replace 1.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Replace 1.1 - result = %s\\n\", s->Replace(' ', '-')->_toCStr());\r\n\tprintf(\"\\n\");\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Replace 2.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Replace 2.0 - result = %s\\n\", s->Replace(s1, s3)->_toCStr());\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Replace 2.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Replace 2.1 - result = %s\\n\", s->Replace(s2, s3)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Split\r\n\tcharArray = CS_NEW System::Array<uniChar>(2);\t\t\t// {' ','2'}\r\n\tcharArray->_idx$_s(0, ' ');\r\n\tcharArray->_idx$_s(1, '2');\r\n\tcharArray2 = CS_NEW System::Array<uniChar>(1);\t\t\t// {'a'}\r\n\tcharArray2->_idx$_s(0,'a');\r\n\tstrArray = CS_NEW System::Array<System::String*>(2);\t// {\"2\",\"3\"}\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('2')->_appendC(' ')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('3')->_appendClose());\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 1.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 1.0 - result = \");\tDisplayArray(s->Split(charArray2));\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 1.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 1.1 - result = \");\tDisplayArray(s->Split(NULL));\t\tprintf(\"\\n\");\r\n\t\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 1.2 - before = %s\\n\", s->_toCStr());\t\r\n\tprintf(\"[StringTest] Split 1.2 - result = \");\tDisplayArray(s->Split(charArray));\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 2.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 2.0 - result = \");\tDisplayArray(s->Split(charArray, 3));\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 3.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 3.0 - result = \");\tDisplayArray(s->Split(charArray, System::StringSplitOptions::None));\t\t\t\t\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 3.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 3.1 - result = \");\tDisplayArray(s->Split(charArray, System::StringSplitOptions::RemoveEmptyEntries));\t\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 4.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 4.0 - result = \");\tDisplayArray(s->Split(strArray, System::StringSplitOptions::None));\t\t\t\t\t\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 4.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 4.1 - result = \");\tDisplayArray(s->Split(strArray, System::StringSplitOptions::RemoveEmptyEntries));\t\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\t\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 5.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 5.0 - result = \");\tDisplayArray(s->Split(charArray, 3, System::StringSplitOptions::None));\t\t\t\t\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 5.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 5.1 - result = \");\tDisplayArray(s->Split(charArray, 3, System::StringSplitOptions::RemoveEmptyEntries));\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 6.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 6.0 - result = \");\tDisplayArray(s->Split(strArray, 2, System::StringSplitOptions::None));\t\t\t\t\tprintf(\"\\n\");\r\n\r\n\ts = CS_NEW System::String(c_digits, 11);\r\n\tprintf(\"[StringTest] Split 6.1 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] Split 6.1 - result = \");\tDisplayArray(s->Split(strArray, 2, System::StringSplitOptions::RemoveEmptyEntries));\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - StartsWith\r\n\ts = System::String::Copy(hw);\r\n\ts1 = (CS_NEW System::String())->_appendC('h')->_appendC('e')->_appendC('l')->_appendC('l')->_appendC('o')->_appendClose();\r\n\tprintf(\"[StringTest] StartsWith 1.0 - result = %s\\n\",\ts->StartsWith(s1) ? \"True\" : \"False\");\r\n\tprintf(\"[StringTest] StartsWith 1.1 - result = %s\\n\",\ts->StartsWith(s)  ? \"True\" : \"False\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test Substring\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] Substring 1.0 - result = %s\\n\",\ts->Substring(0)->_toCStr());\r\n    printf(\"[StringTest] Substring 1.1 - result = %s\\n\",\ts->Substring(6)->_toCStr());\t\tprintf(\"\\n\");\r\n    printf(\"[StringTest] Substring 2.0 - result = %s\\n\",\ts->Substring(6,5)->_toCStr());\t\tprintf(\"\\n\");\r\n\r\n\t// Test - ToCharArray\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] ToCharArray 1.0 - result = \");\tDisplayUniCharArray(s->ToCharArray());\t\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n    printf(\"[StringTest] ToCharArray 2.0 - result = \"); DisplayUniCharArray(s->ToCharArray(6,5));\tprintf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - ToLower\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] ToLower 1.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] ToLower 1.0 - result = %s\\n\", s->ToLower()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - ToString\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] ToString 1.0 - result = %s\\n\", s->ToString()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - ToUpper\r\n\ts = System::String::Copy(hw);\r\n\tprintf(\"[StringTest] ToUpper 1.0 - before = %s\\n\", s->_toCStr());\r\n\tprintf(\"[StringTest] ToUpper 1.0 - result = %s\\n\", s->ToUpper()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Trim\r\n\ts = CS_NEW System::String(c_hw_toTrim, 27);\r\n\tcharArray = CS_NEW System::Array<uniChar>(3);\r\n\tcharArray->_idx$_s(0, ' ');\r\n\tcharArray->_idx$_s(1, 'H');\r\n\tcharArray->_idx$_s(2, '!');\r\n\tprintf(\"[StringTest] Trim 1.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] Trim 1.0 - result = |%s|\\n\",\ts->Trim()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] Trim 2.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] Trim 2.0 - result = |%s|\\n\",\ts->Trim(charArray)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - TrimEnd\r\n\ts = CS_NEW System::String(c_hw_toTrim, 27);\r\n\tcharArray = CS_NEW System::Array<uniChar>(3);\r\n\tcharArray->_idx$_s(0, ' ');\r\n\tcharArray->_idx$_s(1, 'H');\r\n\tcharArray->_idx$_s(2, '!');\r\n\tprintf(\"[StringTest] TrimEnd 1.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] TrimEnd 1.0 - result = |%s|\\n\",\ts->TrimEnd()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] TrimEnd 2.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] TrimEnd 2.0 - result = |%s|\\n\",\ts->TrimEnd(charArray)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - TrimStart\r\n\ts = CS_NEW System::String(c_hw_toTrim, 27);\r\n\tcharArray = CS_NEW System::Array<uniChar>(3);\r\n\tcharArray->_idx$_s(0, ' ');\r\n\tcharArray->_idx$_s(1, 'H');\r\n\tcharArray->_idx$_s(2, '!');\r\n\tprintf(\"[StringTest] TrimStart 1.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] TrimStart 1.0 - result = |%s|\\n\",\ts->TrimStart()->_toCStr());\r\n\tprintf(\"\\n\");\r\n\tprintf(\"[StringTest] TrimStart 2.0 - before = |%s|\\n\",\ts->_toCStr());\r\n\tprintf(\"[StringTest] TrimStart 2.0 - result = |%s|\\n\",\ts->TrimStart(charArray)->_toCStr());\r\n\tprintf(\"\\n\");\r\n\t\r\n\t//#########################################\r\n\t//#########################################\r\n\t//############## List Tests ###############\r\n\t//#########################################\r\n\t//#########################################\r\n\t\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"############## List Tests ###############\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"\\n\\n\");\r\n\r\n\t// Test - Ctor\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>(3);\r\n\tstrList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n\r\n\tprintf(\"[ListTest] Constructor 1.0 - result = \"); DisplayListInfos(intList); printf(\"\\n\");\r\n\tprintf(\"[ListTest] Constructor 2.0 - result = \"); DisplayListInfos(strList); printf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n\t// Test - Add\r\n\tprintf(\"[ListTest] Add 1.0 - before = \"); DisplayListInfos(intList); printf(\"\\n\");\r\n    printf(\"[ListTest] Add 1.0 - before = \"); DisplayList(intList);      printf(\"\\n\");\r\n    for(int i = 0; i < 16; ++i)\r\n        intList->Add(i);\r\n    printf(\"[ListTest] Add 1.0 - result = \"); DisplayListInfos(intList); printf(\"\\n\");\r\n    printf(\"[ListTest] Add 1.0 - result = \"); DisplayList(intList);      printf(\"\\n\");\r\n            \r\n    printf(\"[ListTest] Add 1.1 - before = \"); DisplayListInfos(strList); printf(\"\\n\");\r\n    printf(\"[ListTest] Add 1.1 - before = \"); DisplayList(strList);      printf(\"\\n\");\r\n    for(int i = 0; i < 16; ++i)\r\n        strList->Add((CS_NEW System::String())->_appendC('H')->_appendC('i')->_appendClose());\r\n    printf(\"[ListTest] Add 1.1 - result = \"); DisplayListInfos(strList); printf(\"\\n\");\r\n    printf(\"[ListTest] Add 1.1 - result = \"); DisplayList(strList);      printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - AddRange\r\n\r\n\r\n\t// Test - AsReadOnly\r\n\r\n\r\n\t// Test - BinarySearch\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n    printf(\"[ListTest] BinarySearch 1.0+ - infos = \"); DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] BinarySearch 1.0+ - infos = \"); DisplayList(intList);         printf(\"\\n\");\r\n    printf(\"[ListTest] BinarySearch 1.0 - result = %i\\n\", intList->BinarySearch(4));\r\n    printf(\"[ListTest] BinarySearch 1.1 - result = %i\\n\", intList->BinarySearch(42));\r\n    printf(\"[ListTest] BinarySearch 1.3 - result = %i\\n\", intList->BinarySearch(7));\r\n    printf(\"[ListTest] BinarySearch 1.4+ - infos = \"); DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] BinarySearch 1.4+ - infos = \"); DisplayList(strList);         printf(\"\\n\"); \r\n    printf(\"[ListTest] BinarySearch 1.4 - result = %i\\n\", strList->BinarySearch((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose()));\r\n    printf(\"[ListTest] BinarySearch 1.5 - result = %i\\n\", strList->BinarySearch((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(42)->_appendClose()));\r\n    printf(\"[ListTest] BinarySearch 1.6 - result = %i\\n\", strList->BinarySearch((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(7)->_appendClose()));\r\n    printf(\"\\n\");\r\n    // TODO 2 et 3\r\n\r\n\t// Test - Clear\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] Clear 1.0 - infos = \");\tDisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Clear 1.0 - infos = \");\tDisplayList(intList);       printf(\"\\n\");\r\n    intList->Clear();\r\n    printf(\"[ListTest] Clear 1.0 - result = \"); DisplayListInfos(intList);\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Clear 1.0 - result = \"); DisplayList(intList);       printf(\"\\n\");\r\n            \r\n    printf(\"[ListTest] Clear 1.1 - infos = \");  DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Clear 1.1 - infos = \");  DisplayList(strList);       printf(\"\\n\");\r\n    strList->Clear();\r\n    printf(\"[ListTest] Clear 1.1 - result = \"); DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Clear 1.1 - result = \"); DisplayList(strList);       printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - Contains\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] Contains 1.0+ - infos = \");   DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] Contains 1.0+ - infos = \");   DisplayList(intList);         printf(\"\\n\");\r\n    printf(\"[ListTest] Contains 1.0 - result = %s\\n\", (intList->Contains(6)) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Contains 1.1 - result = %s\\n\", (intList->Contains(7)) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Contains 1.2+ - infos = \");   DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] Contains 1.2+ - infos = \");   DisplayList(strList);         printf(\"\\n\");\r\n    printf(\"[ListTest] Contains 1.2 - result = %s\\n\", (strList->Contains((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(6)->_appendClose())) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Contains 1.3 - result = %s\\n\", (strList->Contains((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(7)->_appendClose())) ? \"True\":\"False\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - ConvertAll\r\n\r\n\r\n\t// Test CopyTo\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 5; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n    intArray = CS_NEW System::Array<int>(20);\r\n    strArray = CS_NEW System::Array<System::String*>(20);\r\n    printf(\"[ListTest] CopyTo 1.0+ - infos  = \");    DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] CopyTo 1.0+ - infos  = \");    DisplayList(intList);       printf(\"\\n\");\r\n    intList->CopyTo(intArray);\r\n    printf(\"[ListTest] CopyTo 1.0 - result = \");     DisplayArray(intArray);     printf(\"\\n\");\r\n    printf(\"[ListTest] CopyTo 1.1+ - infos  = \");    DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] CopyTo 1.1+ - infos  = \");    DisplayList(strList);       printf(\"\\n\");\r\n    strList->CopyTo(strArray);\r\n    printf(\"[ListTest] CopyTo 1.1 - result = \");     DisplayArray(strArray);     printf(\"\\n\");\r\n    intList->CopyTo(intArray, 6);\r\n    printf(\"[ListTest] CopyTo 2.0 - result = \");     DisplayArray(intArray);     printf(\"\\n\");\r\n    strList->CopyTo(strArray, 6);\r\n    printf(\"[ListTest] CopyTo 2.1 - result = \");     DisplayArray(strArray);     printf(\"\\n\");\r\n    intList->CopyTo(1, intArray, 13, 3);\r\n    printf(\"[ListTest] CopyTo 2.0 - result = \");     DisplayArray(intArray);     printf(\"\\n\");\r\n    strList->CopyTo(3, strArray, 15, 2);\r\n    printf(\"[ListTest] CopyTo 2.1 - result = \");     DisplayArray(strArray);     printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - Exists\r\n\r\n\r\n\t// Test - Find\r\n\r\n\r\n\t// Test - FindAll\r\n\r\n\r\n\t// Test - FindIndex\r\n\r\n\r\n\t// Test - FindLast\r\n\r\n\r\n\t// Test - FindLastIndex\r\n\r\n\r\n\t// Test - Foreach\r\n\r\n\r\n\t// Test - GetEnumerator\r\n\r\n\t\r\n\t// Test - GetRange\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tintList2 = intList->GetRange(3,3);\r\n    strList2 = strList->GetRange(3,3);\r\n    printf(\"[ListTest] GetRange 1.0 - infos  = \");   DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.0 - infos  = \");   DisplayList(intList);         printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.0 - result = \");   DisplayListInfos(intList2);   printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.0 - result = \");   DisplayList(intList2);        printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.1 - infos  = \");   DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.1 - infos  = \");   DisplayList(strList);         printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.1 - result = \");   DisplayListInfos(strList2);   printf(\"\\n\");\r\n    printf(\"[ListTest] GetRange 1.1 - result = \");   DisplayList(strList2);        printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\t\r\n\t// Test - IndexOf\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] IndexOf 1.0+ - infos = \");   DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] IndexOf 1.0+ - infos = \");   DisplayList(intList);         printf(\"\\n\");\r\n    printf(\"[ListTest] IndexOf 1.0 - result = %i\\n\", intList->IndexOf(4));\r\n    printf(\"[ListTest] IndexOf 1.1 - result = %i\\n\", intList->IndexOf(5));\r\n    printf(\"[ListTest] IndexOf 1.2+ - infos = \");   DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] IndexOf 1.2+ - infos = \");   DisplayList(strList);         printf(\"\\n\");\r\n    printf(\"[ListTest] IndexOf 1.2 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose()));\r\n    printf(\"[ListTest] IndexOf 1.3 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose()));\r\n    printf(\"\\n\");\r\n    printf(\"[ListTest] IndexOf 2.0 - result = %i\\n\", intList->IndexOf(4, 0));\r\n    printf(\"[ListTest] IndexOf 2.1 - result = %i\\n\", intList->IndexOf(4, 4));\r\n    printf(\"[ListTest] IndexOf 2.2 - result = %i\\n\", intList->IndexOf(5, 0));\r\n    printf(\"[ListTest] IndexOf 2.3 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 0));\r\n    printf(\"[ListTest] IndexOf 2.4 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 4));\r\n    printf(\"[ListTest] IndexOf 2.5 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose(), 0));\r\n    printf(\"\\n\");\r\n    printf(\"[ListTest] IndexOf 2.0 - result = %i\\n\", intList->IndexOf(4, 0, 1));\r\n    printf(\"[ListTest] IndexOf 2.1 - result = %i\\n\", intList->IndexOf(4, 0, 4));\r\n    printf(\"[ListTest] IndexOf 2.2 - result = %i\\n\", intList->IndexOf(5, 0, 8));\r\n    printf(\"[ListTest] IndexOf 2.3 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 0, 1));\r\n    printf(\"[ListTest] IndexOf 2.4 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 0, 4));\r\n    printf(\"[ListTest] IndexOf 2.5 - result = %i\\n\", strList->IndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose(), 0, 8));\r\n    printf(\"\\n\");\r\n\t\r\n\t// Test - Insert\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] Insert 1.0 - infos  = \");   DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] Insert 1.0 - infos  = \");   DisplayList(intList);         printf(\"\\n\");\r\n    intList->Insert(4,7);\r\n    intList->Insert(0,-1);\r\n    intList->Insert(10,20);\r\n    printf(\"[ListTest] Insert 1.0 - result = \");   DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] Insert 1.0 - result = \");   DisplayList(intList);         printf(\"\\n\");\r\n    printf(\"[ListTest] Insert 1.1 - infos  = \");   DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] Insert 1.1 - infos  = \");   DisplayList(strList);         printf(\"\\n\");\r\n    strList->Insert(4,(CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(7)->_appendClose());\r\n    strList->Insert(0,(CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(-1)->_appendClose());\r\n    strList->Insert(10,(CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(20)->_appendClose());\r\n    printf(\"[ListTest] Insert 1.1 - result = \");   DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] Insert 1.1 - result = \");   DisplayList(strList);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\r\n\t// GC TEST\r\n\tSystem::Collections::Generic::List<System::String*>* _static_strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n\tSystem::Memory::registerGCRoot(&_static_strList);\r\n\tfor(int i = 0; i < 8; ++i) {\r\n        _static_strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('a')->_appendC('t')->_appendI(i*2)->_appendClose());\r\n    }\r\n\t// END GC TEST\r\n\r\n\r\n\t// Test - InsertRange\r\n\r\n\t\r\n\t// Test - LastIndexOf\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] LastIndexOf 1.0+ - infos = \");   DisplayListInfos(intList);    printf(\"\\n\");\r\n    printf(\"[ListTest] LastIndexOf 1.0+ - infos = \");   DisplayList(intList);         printf(\"\\n\");\r\n    printf(\"[ListTest] LastIndexOf 1.0 - result = %i\\n\", intList->LastIndexOf(4));\r\n    printf(\"[ListTest] LastIndexOf 1.1 - result = %i\\n\", intList->LastIndexOf(5));\r\n    printf(\"[ListTest] LastIndexOf 1.2+ - infos = \");   DisplayListInfos(strList);    printf(\"\\n\");\r\n    printf(\"[ListTest] LastIndexOf 1.2+ - infos = \");   DisplayList(strList);         printf(\"\\n\");\r\n    printf(\"[ListTest] LastIndexOf 1.2 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose()));\r\n    printf(\"[ListTest] LastIndexOf 1.3 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose()));\r\n    printf(\"\\n\");\r\n    printf(\"[ListTest] LastIndexOf 2.0 - result = %i\\n\", intList->LastIndexOf(4, 7));\r\n    printf(\"[ListTest] LastIndexOf 2.1 - result = %i\\n\", intList->LastIndexOf(4, 1));\r\n    printf(\"[ListTest] LastIndexOf 2.2 - result = %i\\n\", intList->LastIndexOf(5, 7));\r\n    printf(\"[ListTest] LastIndexOf 2.3 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 7));\r\n    printf(\"[ListTest] LastIndexOf 2.4 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 1));\r\n    printf(\"[ListTest] LastIndexOf 2.5 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose(), 7));\r\n    printf(\"\\n\");\r\n    printf(\"[ListTest] LastIndexOf 2.0 - result = %i\\n\", intList->LastIndexOf(4, 7, 4));\r\n    printf(\"[ListTest] LastIndexOf 2.1 - result = %i\\n\", intList->LastIndexOf(4, 7, 8));\r\n    printf(\"[ListTest] LastIndexOf 2.2 - result = %i\\n\", intList->LastIndexOf(5, 7, 8));\r\n    printf(\"[ListTest] LastIndexOf 2.3 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 7, 4));\r\n    printf(\"[ListTest] LastIndexOf 2.4 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose(), 7, 8));\r\n    printf(\"[ListTest] LastIndexOf 2.5 - result = %i\\n\", strList->LastIndexOf((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose(), 7, 8));\r\n    printf(\"\\n\");\r\n\r\n\t// Test - Remove\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] Remove 1.0+ - infos  = \");   DisplayListInfos(intList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.0+ - infos  = \");   DisplayList(intList);\t\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.0 - result  = %s\\n\", (intList->Remove(4)) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Remove 1.1 - result  = %s\\n\", (intList->Remove(5)) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Remove 1.0+ - result = \");   DisplayListInfos(intList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.0+ - result = \");   DisplayList(intList);\t\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.2+ - infos  = \");   DisplayListInfos(strList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.2+ - infos  = \");   DisplayList(strList);\t\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.2 - result  = %s\\n\", (strList->Remove((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(4)->_appendClose())) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Remove 1.3 - result  = %s\\n\", (strList->Remove((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(5)->_appendClose())) ? \"True\":\"False\");\r\n    printf(\"[ListTest] Remove 1.2+ - result = \");   DisplayListInfos(strList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Remove 1.2+ - result = \");   DisplayList(strList);\t\t\tprintf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - RemoveAll\r\n\r\n\t\r\n\t// Test - RemoveAt\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] RemoveAt 1.0 - infos  = \");   DisplayListInfos(intList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] RemoveAt 1.0 - infos  = \");   DisplayList(intList);\t\t\tprintf(\"\\n\");\r\n    intList->RemoveAt(4);\r\n    printf(\"[ListTest] RemoveAt 1.0 - result = \");   DisplayListInfos(intList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] RemoveAt 1.0 - result = \");   DisplayList(intList);\t\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] RemoveAt 1.1 - infos  = \");   DisplayListInfos(strList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] RemoveAt 1.1 - infos  = \");   DisplayList(strList);\t\t\tprintf(\"\\n\");\r\n    strList->RemoveAt(4);\r\n    printf(\"[ListTest] RemoveAt 1.1 - result = \");   DisplayListInfos(strList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] RemoveAt 1.1 - result = \");   DisplayList(strList);\t\t\tprintf(\"\\n\");\r\n    printf(\"\\n\");\r\n\t\r\n\t// Test - RemoveRange\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] RemoveRange 1.0 - infos  = \");   DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] RemoveRange 1.0 - infos  = \");   DisplayList(intList);       printf(\"\\n\");\r\n    intList->RemoveRange(4,2);\r\n    printf(\"[ListTest] RemoveRange 1.0 - result = \");   DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] RemoveRange 1.0 - result = \");   DisplayList(intList);       printf(\"\\n\");\r\n    printf(\"[ListTest] RemoveRange 1.1 - infos  = \");   DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] RemoveRange 1.1 - infos  = \");   DisplayList(strList);       printf(\"\\n\");\r\n    strList->RemoveRange(4,2);\r\n    printf(\"[ListTest] RemoveRange 1.1 - result = \");   DisplayListInfos(strList);\tprintf(\"\\n\");\r\n    printf(\"[ListTest] RemoveRange 1.1 - result = \");   DisplayList(strList);       printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\t\r\n\t// Test - Reverse\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 8; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] Reverse 1.0 - infos  = \");   DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 1.0 - infos  = \");   DisplayList(intList);       printf(\"\\n\");\r\n    intList->Reverse();\r\n    printf(\"[ListTest] Reverse 1.0 - result = \");   DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 1.0 - result = \");   DisplayList(intList);       printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 1.1 - infos  = \");   DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 1.1 - infos  = \");   DisplayList(strList);       printf(\"\\n\");\r\n    strList->Reverse();\r\n    printf(\"[ListTest] Reverse 1.1 - result = \");   DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 1.1 - result = \");   DisplayList(strList);       printf(\"\\n\");\r\n    printf(\"\\n\");\r\n    intList->Reverse(4,3);\r\n    strList->Reverse(3,2);\r\n    printf(\"[ListTest] Reverse 2.0 - result = \");   DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 2.0 - result = \");   DisplayList(intList);       printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 2.1 - result = \");   DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] Reverse 2.1 - result = \");   DisplayList(strList);\t\tprintf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - Sort\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n\tintList->Add(42); intList->Add(1337); intList->Add(7); intList->Add(23); intList->Add(2);\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n\tstrList->Add((CS_NEW System::String())->_appendC('q')->_appendClose());\r\n\tstrList->Add((CS_NEW System::String())->_appendC('w')->_appendClose());\r\n\tstrList->Add((CS_NEW System::String())->_appendC('e')->_appendClose());\r\n\tstrList->Add((CS_NEW System::String())->_appendC('r')->_appendClose());\r\n\tstrList->Add((CS_NEW System::String())->_appendC('t')->_appendClose());\r\n\tstrList->Add((CS_NEW System::String())->_appendC('y')->_appendClose());\r\n    printf(\"[ListTest] Sort 1.0 - infos  = \");   DisplayListInfos(intList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Sort 1.0 - infos  = \");   DisplayList(intList);\t\t\tprintf(\"\\n\");\r\n    intList->Sort();\r\n    printf(\"[ListTest] Sort 1.0 - result = \");   DisplayListInfos(intList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Sort 1.0 - result = \");   DisplayList(intList);\t\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Sort 1.1 - infos  = \");   DisplayListInfos(strList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Sort 1.1 - infos  = \");   DisplayList(strList);\t\t\tprintf(\"\\n\");\r\n    strList->Sort();\r\n    printf(\"[ListTest] Sort 1.1 - result = \");   DisplayListInfos(strList);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] Sort 1.1 - result = \");   DisplayList(strList);\t\t\tprintf(\"\\n\");\r\n    printf(\"\\n\");\r\n    // TODO other Sort methods.\r\n\r\n\t// Test - ToArray\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 5; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] ToArray 1.0 - infos  = \");   DisplayListInfos(intList);  printf(\"\\n\");\r\n    printf(\"[ListTest] ToArray 1.0 - infos  = \");   DisplayList(intList);       printf(\"\\n\");\r\n    intArray = intList->ToArray();\r\n    printf(\"[ListTest] ToArray 1.0 - result = \");   DisplayArray(intArray);\t\tprintf(\"\\n\");\r\n    printf(\"[ListTest] ToArray 1.1 - infos  = \");   DisplayListInfos(strList);  printf(\"\\n\");\r\n    printf(\"[ListTest] ToArray 1.1 - infos  = \");   DisplayList(strList);       printf(\"\\n\");\r\n    strArray = strList->ToArray();\r\n    printf(\"[ListTest] ToArray 1.1 - result = \");   DisplayArray(strArray);\t\tprintf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - TrimExcess\r\n\tintList = CS_NEW System::Collections::Generic::List<s32>();\r\n    strList = CS_NEW System::Collections::Generic::List<System::String*>();\r\n    for(int i = 0; i < 5; ++i) {\r\n        intList->Add(i*2);\r\n        strList->Add((CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('r')->_appendI(i*2)->_appendClose());\r\n    }\r\n\tprintf(\"[ListTest] TrimExcess 1.0 - infos  = \");   DisplayListInfos(intList);\tprintf(\"\\n\");\r\n    printf(\"[ListTest] TrimExcess 1.0 - infos  = \");   DisplayList(intList);        printf(\"\\n\");\r\n    intList->TrimExcess();\r\n    printf(\"[ListTest] TrimExcess 1.0 - result = \");   DisplayListInfos(intList);   printf(\"\\n\");\r\n    printf(\"[ListTest] TrimExcess 1.0 - result = \");   DisplayList(intList);        printf(\"\\n\");\r\n    printf(\"[ListTest] TrimExcess 1.1 - infos  = \");   DisplayListInfos(strList);   printf(\"\\n\");\r\n    printf(\"[ListTest] TrimExcess 1.1 - infos  = \");   DisplayList(strList);        printf(\"\\n\");\r\n    strList->TrimExcess();\r\n    printf(\"[ListTest] TrimExcess 1.1 - result = \");   DisplayListInfos(strList);   printf(\"\\n\");\r\n    printf(\"[ListTest] TrimExcess 1.1 - result = \");   DisplayList(strList);        printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\t// Test - TrueForAll\r\n\t\r\n\r\n\t\r\n\t//#########################################\r\n\t//#########################################\r\n\t//############# Array Tests ###############\r\n\t//#########################################\r\n\t//#########################################\r\n\t\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"############## Array Tests ##############\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"#########################################\\n\");\r\n    printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"############ Abstract Array #############\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - Constructors (normal arrays)\r\n\tintArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n\tprintf(\"[AbstractArrayTest] Constructors 1.0 - infos = \"); DisplayArrayInfos(intArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Constructors 1.0 - infos = \"); DisplayArray(intArray);      printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Constructors 1.1 - infos = \"); DisplayArrayInfos(strArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Constructors 1.1 - infos = \"); DisplayArray(strArray);      printf(\"\\n\");\r\n\tprintf(\"\\n\");\r\n\r\n    // Test - BinarySearch\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4);\r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.0+ - infos = \"); DisplayArrayInfos(intArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.0+ - infos = \"); DisplayArray(intArray);      printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.2+ - infos = \"); DisplayArrayInfos(strArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.2+ - infos = \"); DisplayArray(strArray);      printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.0 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 3));\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.1 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 4));\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.2 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, (CS_NEW System::String())->_appendC('t')->_appendClose()));\r\n    printf(\"[AbstractArrayTest] BinarySearch 1.3 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose()));\r\n    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] BinarySearch 2.0 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 0, 6, 3));\r\n    printf(\"[AbstractArrayTest] BinarySearch 2.1 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 1, 1, 4));\r\n    printf(\"[AbstractArrayTest] BinarySearch 2.2 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 1, 2, 4));\r\n    printf(\"[AbstractArrayTest] BinarySearch 2.3 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, 0, 3, (CS_NEW System::String())->_appendC('s')->_appendI(9)->_appendClose()));\r\n    printf(\"[AbstractArrayTest] BinarySearch 2.4 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, 0, 1, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose()));\r\n    printf(\"[AbstractArrayTest] BinarySearch 2.5 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, 0, 3, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose()));\r\n    printf(\"\\n\");\r\n\r\n    // Test - Clear\r\n    intArray = CS_NEW System::Array<s32>(6);\r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] Clear 1.0 - infos  = \"); DisplayArrayInfos(intArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clear 1.0 - infos  = \"); DisplayArray(intArray);      printf(\"\\n\");\r\n    System::AbstractArray::Clear(intArray, 0, intArray->_acc_gLength());\r\n    printf(\"[AbstractArrayTest] Clear 1.0 - result = \"); DisplayArrayInfos(intArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clear 1.0 - result = \"); DisplayArray(intArray);      printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clear 1.1 - infos  = \"); DisplayArrayInfos(strArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clear 1.1 - infos  = \"); DisplayArray(strArray);      printf(\"\\n\");\r\n    System::AbstractArray::Clear(strArray, 1, 1);\r\n    printf(\"[AbstractArrayTest] Clear 1.1 - result = \"); DisplayArrayInfos(strArray); printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clear 1.1 - result = \"); DisplayArray(strArray);      printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - Clone\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    \r\n    printf(\"[AbstractArrayTest] Clone 1.0 - infos  = \"); DisplayArrayInfos(intArray);            printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - infos  = \"); DisplayArray(intArray);                 printf(\"\\n\");\r\n    intArray2 = (System::Array<s32>*)intArray->Clone();\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - clone  = \"); DisplayArrayInfos(intArray2);           printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - clone  = \"); DisplayArray(intArray2);                printf(\"\\n\");\r\n\tintArray->_idx$_s(3, intArray->_idx$_g(3) +1);\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - after original = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - after original = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - after clone    = \"); DisplayArrayInfos(intArray2);   printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.0 - after clone    = \"); DisplayArray(intArray2);        printf(\"\\n\");\r\n\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n\r\n\t// GC TEST\r\n\tSystem::Array<System::String*>* _static_strArray = CS_NEW System::Array<System::String*>(3);\r\n\tSystem::Memory::registerGCRoot(&_static_strArray);\r\n\t_static_strArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('a')->_appendC('t')->_appendC('i')->_appendC('c')->_appendC('0')->_appendClose());\r\n\t_static_strArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('a')->_appendC('t')->_appendC('i')->_appendC('c')->_appendC('1')->_appendClose());\r\n\t_static_strArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('t')->_appendC('a')->_appendC('t')->_appendC('i')->_appendC('c')->_appendC('2')->_appendClose());\r\n\t// END GC TEST\r\n\t\r\n\r\n\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - infos  = \"); DisplayArrayInfos(strArray);            printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - infos  = \"); DisplayArray(strArray);                 printf(\"\\n\");\r\n    strArray2 = (System::Array<System::String*>*)strArray->Clone();\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - clone  = \"); DisplayArrayInfos(strArray);            printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - clone  = \"); DisplayArray(strArray);                 printf(\"\\n\");\r\n\tstrArray->_idx$_s(1, CS_NEW System::String(c_hello, 5));\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - after original = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - after original = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - after clone    = \"); DisplayArrayInfos(strArray2);   printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Clone 1.1 - after clone    = \"); DisplayArray(strArray2);        printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - ConstrainedCopy\r\n\r\n\r\n    // Test - Copy\r\n\r\n\r\n    // Test - CopyTo\r\n\r\n\r\n    // Test - CreateInstance\r\n\r\n\r\n    // Test - GetEnumerator\r\n\r\n\r\n    // Test - IndexOf\r\n    intArray = CS_NEW System::Array<int>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 2); intArray->_idx$_s(4, 4); intArray->_idx$_s(5, 0);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] IndexOf 1.0+ - infos = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] IndexOf 1.0+ - infos = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] IndexOf 1.2+ - infos = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] IndexOf 1.2+ - infos = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n\r\n    printf(\"[AbstractArrayTest] IndexOf 1.0 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 0));\r\n    printf(\"[AbstractArrayTest] IndexOf 1.1 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 1));\r\n    printf(\"[AbstractArrayTest] IndexOf 1.2 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose()));\r\n    printf(\"[AbstractArrayTest] IndexOf 1.3 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, 1));\r\n    printf(\"[AbstractArrayTest] IndexOf 1.4 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, CS_NEW System::Collections::Generic::List<s32>()));\r\n    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] IndexOf 2.0 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 0));\r\n    printf(\"[AbstractArrayTest] IndexOf 2.1 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 2));\r\n    printf(\"[AbstractArrayTest] IndexOf 2.2 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 4));\r\n    printf(\"[AbstractArrayTest] IndexOf 2.3 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 1, 0));\r\n    printf(\"[AbstractArrayTest] IndexOf 2.4 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 0));\r\n    printf(\"[AbstractArrayTest] IndexOf 2.5 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 1));\r\n    printf(\"[AbstractArrayTest] IndexOf 2.6 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, 2, 0));\r\n    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] IndexOf 3.0 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 0, 1));\r\n    printf(\"[AbstractArrayTest] IndexOf 3.1 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 0, 2));\r\n    printf(\"[AbstractArrayTest] IndexOf 3.2 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 1, 2));\r\n    printf(\"[AbstractArrayTest] IndexOf 3.3 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, 's', 1, 2));\r\n    printf(\"\\n\");\r\n\r\n    // Test - Initialize\r\n\r\n\r\n    // Test - LastIndexOf\r\n    intArray = CS_NEW System::Array<int>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 2); intArray->_idx$_s(4, 4); intArray->_idx$_s(5, 0);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.0+ - infos = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.0+ - infos = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.2+ - infos = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.2+ - infos = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.0 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 0));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.1 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 1));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.2 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose()));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.3 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, 1));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 1.4 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, CS_NEW System::Collections::Generic::List<s32>()));\r\n    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.0 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 5));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.1 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 2));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.2 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 0));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.3 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 1, 5));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.4 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 2));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.5 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose(), 0));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 2.6 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, 2, 2));\r\n    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] LastIndexOf 3.0 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 5, 6));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 3.1 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 5, 2));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 3.2 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose(), 2, 2));\r\n    printf(\"[AbstractArrayTest] LastIndexOf 3.3 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, 's', 2, 2));\r\n    printf(\"\\n\");\r\n\r\n    // Test - Reverse\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] Reverse 1.0 - infos  = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 1.0 - infos  = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    System::AbstractArray::Reverse(intArray);\r\n    printf(\"[AbstractArrayTest] Reverse 1.0 - result = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 1.0 - result = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 1.1 - infos  = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 1.1 - infos  = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    System::AbstractArray::Reverse(strArray);\r\n    printf(\"[AbstractArrayTest] Reverse 1.1 - result = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 1.1 - result = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] Reverse 2.0 - infos  = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 2.0 - infos  = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    System::AbstractArray::Reverse(intArray, 1, 5);\r\n    printf(\"[AbstractArrayTest] Reverse 2.0 - result = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 2.0 - result = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 2.1 - infos  = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 2.1 - infos  = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    System::AbstractArray::Reverse(strArray, 1, 2);\r\n    printf(\"[AbstractArrayTest] Reverse 2.1 - result = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Reverse 2.1 - result = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - Sort\r\n\tintArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 42); intArray->_idx$_s(1, 1337); intArray->_idx$_s(2, 7); \r\n\tintArray->_idx$_s(3, 23); intArray->_idx$_s(4, 2); intArray->_idx$_s(5, 14);\r\n    strArray = CS_NEW System::Array<System::String*>(7);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('q')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('w')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('e')->_appendClose());\r\n\tstrArray->_idx$_s(3, (CS_NEW System::String())->_appendC('r')->_appendClose());\r\n\tstrArray->_idx$_s(4, (CS_NEW System::String())->_appendC('t')->_appendClose());\r\n\tstrArray->_idx$_s(5, (CS_NEW System::String())->_appendC('y')->_appendClose());\r\n\tstrArray->_idx$_s(6, (CS_NEW System::String())->_appendC('Q')->_appendClose());\r\n\t\r\n    printf(\"[AbstractArrayTest] Sort 1.0 - infos  = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 1.0 - infos  = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(intArray);\r\n    printf(\"[AbstractArrayTest] Sort 1.0 - result = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 1.0 - result = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 1.1 - infos  = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 1.1 - infos  = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(strArray);\r\n    printf(\"[AbstractArrayTest] Sort 1.1 - result = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 1.1 - result = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n    \r\n\tintArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 42); intArray->_idx$_s(1, 1337); intArray->_idx$_s(2, 7); \r\n\tintArray->_idx$_s(3, 23); intArray->_idx$_s(4, 2); intArray->_idx$_s(5, 14);\r\n    strArray = CS_NEW System::Array<System::String*>(7);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('q')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('w')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('e')->_appendClose());\r\n\tstrArray->_idx$_s(3, (CS_NEW System::String())->_appendC('r')->_appendClose());\r\n\tstrArray->_idx$_s(4, (CS_NEW System::String())->_appendC('t')->_appendClose());\r\n\tstrArray->_idx$_s(5, (CS_NEW System::String())->_appendC('y')->_appendClose());\r\n\tstrArray->_idx$_s(6, (CS_NEW System::String())->_appendC('Q')->_appendClose());\r\n\r\n    printf(\"[AbstractArrayTest] Sort 2.0 - infos  = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 2.0 - infos  = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(intArray, 1, 3);\r\n    printf(\"[AbstractArrayTest] Sort 2.0 - result = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 2.0 - result = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 2.1 - infos  = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 2.1 - infos  = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(strArray, 3, 4);\r\n    printf(\"[AbstractArrayTest] Sort 2.1 - result = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[AbstractArrayTest] Sort 2.1 - result = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n    // TODO : Other sorts.\r\n\r\n\r\n\r\n\tprintf(\"\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"############### Array<T> ################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - Constructor\r\n    // Test - Constructors (normal arrays)\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] Constructors 1.0 - infos = \"); DisplayArrayInfos(intArray); printf(\"\\n\");\r\n    printf(\"[ArrayTest] Constructors 1.0 - infos = \"); DisplayArray(intArray);      printf(\"\\n\");\r\n    printf(\"[ArrayTest] Constructors 1.1 - infos = \"); DisplayArrayInfos(strArray); printf(\"\\n\");\r\n    printf(\"[ArrayTest] Constructors 1.1 - infos = \"); DisplayArray(strArray);      printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - BinarySearch\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] BinarySearch 1.0+ - infos = \"); DisplayArrayInfos(intArray); printf(\"\\n\");\r\n    printf(\"[ArrayTest] BinarySearch 1.0+ - infos = \"); DisplayArray(intArray);      printf(\"\\n\");\r\n    printf(\"[ArrayTest] BinarySearch 1.2+ - infos = \"); DisplayArrayInfos(strArray); printf(\"\\n\");\r\n    printf(\"[ArrayTest] BinarySearch 1.2+ - infos = \"); DisplayArray(strArray);      printf(\"\\n\");\r\n    printf(\"[ArrayTest] BinarySearch 1.0 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 3));\r\n\tprintf(\"[ArrayTest] BinarySearch 1.1 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 4));\r\n    printf(\"[ArrayTest] BinarySearch 1.2 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, (CS_NEW System::String())->_appendC('t')->_appendClose()));\r\n    printf(\"[ArrayTest] BinarySearch 1.3 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose()));\r\n    printf(\"\\n\");\r\n    printf(\"[ArrayTest] BinarySearch 2.0 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 0, 6, 3));\r\n    printf(\"[ArrayTest] BinarySearch 2.1 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 1, 1, 4));\r\n    printf(\"[ArrayTest] BinarySearch 2.2 - result = %i\\n\", System::AbstractArray::BinarySearch(intArray, 1, 2, 4));\r\n    printf(\"[ArrayTest] BinarySearch 2.3 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, 0, 3, (CS_NEW System::String())->_appendC('s')->_appendI(9)->_appendClose()));\r\n    printf(\"[ArrayTest] BinarySearch 2.4 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, 0, 1, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose()));\r\n    printf(\"[ArrayTest] BinarySearch 2.5 - result = %i\\n\", System::AbstractArray::BinarySearch(strArray, 0, 3, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose()));\r\n    printf(\"\\n\");\r\n\r\n    // Test - ConvertAll\r\n\r\n\r\n    // Test - Exists\r\n\r\n\r\n    // Test - Find\r\n\r\n\r\n    // Test - FindAll\r\n\r\n\r\n    // Test - FindIndex\r\n\r\n\r\n    // Test - FindLast\r\n\r\n\r\n    // Test - FindLastIndex\r\n\r\n\r\n    // Test - ForEach\r\n\r\n\r\n    // Test - IndexOf\r\n\tintArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 2); intArray->_idx$_s(4, 4); intArray->_idx$_s(5, 0);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] IndexOf 1.0+ - infos = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] IndexOf 1.0+ - infos = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[ArrayTest] IndexOf 1.2+ - infos = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] IndexOf 1.2+ - infos = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n\r\n    printf(\"[ArrayTest] IndexOf 1.0 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 0));\r\n    printf(\"[ArrayTest] IndexOf 1.1 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 1));\r\n    printf(\"[ArrayTest] IndexOf 1.2 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose()));\r\n    printf(\"[ArrayTest] IndexOf 1.3 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, 1));\r\n\tprintf(\"[ArrayTest] IndexOf 1.4 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, CS_NEW System::Collections::Generic::List<s32>()));\r\n    printf(\"\\n\");\r\n    printf(\"[ArrayTest] IndexOf 2.0 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 0));\r\n    printf(\"[ArrayTest] IndexOf 2.1 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 2));\r\n    printf(\"[ArrayTest] IndexOf 2.2 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 4));\r\n    printf(\"[ArrayTest] IndexOf 2.3 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 1, 0));\r\n    printf(\"[ArrayTest] IndexOf 2.4 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 0));\r\n    printf(\"[ArrayTest] IndexOf 2.5 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 1));\r\n    printf(\"[ArrayTest] IndexOf 2.6 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, 2, 0));\r\n    printf(\"\\n\");\r\n    printf(\"[ArrayTest] IndexOf 3.0 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 0, 1));\r\n    printf(\"[ArrayTest] IndexOf 3.1 - result = %i\\n\", System::AbstractArray::IndexOf(intArray, 2, 0, 2));\r\n    printf(\"[ArrayTest] IndexOf 3.2 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 1, 2));\r\n    printf(\"[ArrayTest] IndexOf 3.3 - result = %i\\n\", System::AbstractArray::IndexOf(strArray, 's', 1, 2));\r\n    printf(\"\\n\");\r\n\r\n\r\n    // Test - LastIndexOf\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 2); intArray->_idx$_s(4, 4); intArray->_idx$_s(5, 0);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] LastIndexOf 1.0+ - infos = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] LastIndexOf 1.0+ - infos = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[ArrayTest] LastIndexOf 1.2+ - infos = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] LastIndexOf 1.2+ - infos = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n\r\n    printf(\"[ArrayTest] LastIndexOf 1.0 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 0));\r\n    printf(\"[ArrayTest] LastIndexOf 1.1 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 1));\r\n    printf(\"[ArrayTest] LastIndexOf 1.2 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose()));\r\n    printf(\"[ArrayTest] LastIndexOf 1.3 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, 1));\r\n    printf(\"[ArrayTest] LastIndexOf 1.4 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, CS_NEW System::Collections::Generic::List<s32>()));\r\n    printf(\"\\n\");\r\n    printf(\"[ArrayTest] LastIndexOf 2.0 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 5));\r\n    printf(\"[ArrayTest] LastIndexOf 2.1 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 2));\r\n    printf(\"[ArrayTest] LastIndexOf 2.2 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 0));\r\n    printf(\"[ArrayTest] LastIndexOf 2.3 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 1, 5));\r\n    printf(\"[ArrayTest] LastIndexOf 2.4 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(0)->_appendClose(), 2));\r\n    printf(\"[ArrayTest] LastIndexOf 2.5 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose(), 0));\r\n    printf(\"[ArrayTest] LastIndexOf 2.6 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, 2, 2));\r\n    printf(\"\\n\");\r\n    printf(\"[ArrayTest] LastIndexOf 3.0 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 5, 6));\r\n    printf(\"[ArrayTest] LastIndexOf 3.1 - result = %i\\n\", System::AbstractArray::LastIndexOf(intArray, 2, 5, 2));\r\n    printf(\"[ArrayTest] LastIndexOf 3.2 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, (CS_NEW System::String())->_appendC('s')->_appendI(1)->_appendClose(), 2, 2));\r\n    printf(\"[ArrayTest] LastIndexOf 3.3 - result = %i\\n\", System::AbstractArray::LastIndexOf(strArray, 's', 2, 2));\r\n    printf(\"\\n\");\r\n\r\n    // Test - Resize\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 0); intArray->_idx$_s(1, 2); intArray->_idx$_s(2, 4); \r\n\tintArray->_idx$_s(3, 6); intArray->_idx$_s(4, 8); intArray->_idx$_s(5, 10);\r\n    strArray = CS_NEW System::Array<System::String*>(3);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('s')->_appendC('0')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('s')->_appendC('1')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('s')->_appendC('2')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] Resize 1.0+ - infos = \"); DisplayArrayInfos(intArray);   printf(\"\\n\");\r\n    printf(\"[ArrayTest] Resize 1.0+ - infos = \"); DisplayArray(intArray);        printf(\"\\n\");\r\n    System::AbstractArray::Resize(intArray, 10);\r\n    printf(\"[ArrayTest] Resize 1.1 - result = \"); DisplayArrayInfos(intArray);   printf(\"\\n\");\r\n    printf(\"[ArrayTest] Resize 1.1 - result = \"); DisplayArray(intArray);        printf(\"\\n\");\r\n    System::AbstractArray::Resize(intArray, 3);\r\n    printf(\"[ArrayTest] Resize 1.2 - result = \"); DisplayArrayInfos(intArray);   printf(\"\\n\");\r\n    printf(\"[ArrayTest] Resize 1.2 - result = \"); DisplayArray(intArray);        printf(\"\\n\");\r\n            \r\n    printf(\"[ArrayTest] Resize 1.3+ - infos = \"); DisplayArrayInfos(strArray);   printf(\"\\n\");\r\n    printf(\"[ArrayTest] Resize 1.3+ - infos = \"); DisplayArray(strArray);        printf(\"\\n\");\r\n    System::AbstractArray::Resize(strArray, 10);\r\n    printf(\"[ArrayTest] Resize 1.3 - result = \"); DisplayArrayInfos(strArray);   printf(\"\\n\");\r\n    printf(\"[ArrayTest] Resize 1.3 - result = \"); DisplayArray(strArray);        printf(\"\\n\");\r\n    System::AbstractArray::Resize(strArray, 3);\r\n    printf(\"[ArrayTest] Resize 1.4 - result = \"); DisplayArrayInfos(strArray);   printf(\"\\n\");\r\n    printf(\"[ArrayTest] Resize 1.4 - result = \"); DisplayArray(strArray);        printf(\"\\n\");\r\n            \r\n    // Test - Sort\r\n    intArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 42); intArray->_idx$_s(1, 1337); intArray->_idx$_s(2, 7); \r\n\tintArray->_idx$_s(3, 23); intArray->_idx$_s(4, 2); intArray->_idx$_s(5, 14);\r\n    strArray = CS_NEW System::Array<System::String*>(7);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('q')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('w')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('e')->_appendClose());\r\n\tstrArray->_idx$_s(3, (CS_NEW System::String())->_appendC('r')->_appendClose());\r\n\tstrArray->_idx$_s(4, (CS_NEW System::String())->_appendC('t')->_appendClose());\r\n\tstrArray->_idx$_s(5, (CS_NEW System::String())->_appendC('y')->_appendClose());\r\n\tstrArray->_idx$_s(6, (CS_NEW System::String())->_appendC('Q')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] Sort 1.0 - infos  = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 1.0 - infos  = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(intArray);\r\n    printf(\"[ArrayTest] Sort 1.0 - result = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 1.0 - result = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 1.1 - infos  = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 1.1 - infos  = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(strArray);\r\n    printf(\"[ArrayTest] Sort 1.1 - result = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 1.1 - result = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n    \r\n\tintArray = CS_NEW System::Array<s32>(6); \r\n\tintArray->_idx$_s(0, 42); intArray->_idx$_s(1, 1337); intArray->_idx$_s(2, 7); \r\n\tintArray->_idx$_s(3, 23); intArray->_idx$_s(4, 2); intArray->_idx$_s(5, 14);\r\n    strArray = CS_NEW System::Array<System::String*>(7);\r\n\tstrArray->_idx$_s(0, (CS_NEW System::String())->_appendC('q')->_appendClose());\r\n\tstrArray->_idx$_s(1, (CS_NEW System::String())->_appendC('w')->_appendClose());\r\n\tstrArray->_idx$_s(2, (CS_NEW System::String())->_appendC('e')->_appendClose());\r\n\tstrArray->_idx$_s(3, (CS_NEW System::String())->_appendC('r')->_appendClose());\r\n\tstrArray->_idx$_s(4, (CS_NEW System::String())->_appendC('t')->_appendClose());\r\n\tstrArray->_idx$_s(5, (CS_NEW System::String())->_appendC('y')->_appendClose());\r\n\tstrArray->_idx$_s(6, (CS_NEW System::String())->_appendC('Q')->_appendClose());\r\n\r\n    printf(\"[ArrayTest] Sort 2.0 - infos  = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 2.0 - infos  = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(intArray, 1, 3);\r\n    printf(\"[ArrayTest] Sort 2.0 - result = \"); DisplayArrayInfos(intArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 2.0 - result = \"); DisplayArray(intArray);         printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 2.1 - infos  = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 2.1 - infos  = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    System::AbstractArray::Sort(strArray, 3, 4);\r\n    printf(\"[ArrayTest] Sort 2.1 - result = \"); DisplayArrayInfos(strArray);    printf(\"\\n\");\r\n    printf(\"[ArrayTest] Sort 2.1 - result = \"); DisplayArray(strArray);         printf(\"\\n\");\r\n    printf(\"\\n\");\r\n    // TODO : Other sorts.\r\n\r\n    // Test - TrueForAll\r\n\r\n\r\n\t//#########################################\r\n\t//#########################################\r\n\t//########## Dictionary Tests #############\r\n\t//#########################################\r\n\t//#########################################\r\n\t\r\n\t// Test - Constructor\r\n\tprintf(\"#########################################\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"########### Dictionary Tests ############\\n\");\r\n\tprintf(\"#########################################\\n\");\r\n    printf(\"#########################################\\n\");\r\n    printf(\"\\n\");\r\n    printf(\"\\n\");\r\n\r\n\tSystem::String* s_red\t\t\t= (CS_NEW System::String())->_appendC('r')->_appendC('e')->_appendC('d')->_appendClose();\r\n\tSystem::String* s_air\t\t\t= (CS_NEW System::String())->_appendC('a')->_appendC('i')->_appendC('r')->_appendClose();\r\n\tSystem::String* s_blue\t\t\t= (CS_NEW System::String())->_appendC('b')->_appendC('l')->_appendC('u')->_appendC('e')->_appendClose();\r\n\tSystem::String* s_green\t\t\t= (CS_NEW System::String())->_appendC('g')->_appendC('r')->_appendC('e')->_appendC('e')->_appendC('n')->_appendClose();\r\n\tSystem::String* s_water\t\t\t= (CS_NEW System::String())->_appendC('w')->_appendC('a')->_appendC('t')->_appendC('e')->_appendC('r')->_appendClose();\r\n\tSystem::String* s_yellow\t\t= (CS_NEW System::String())->_appendC('y')->_appendC('e')->_appendC('l')->_appendC('l')->_appendC('o')->_appendC('w')->_appendClose();\r\n\tSystem::String* s_friend\t\t= (CS_NEW System::String())->_appendC('f')->_appendC('r')->_appendC('i')->_appendC('e')->_appendC('n')->_appendC('d')->_appendClose();\r\n\tSystem::String* s_Hitokage\t\t= (CS_NEW System::String())->_appendC('H')->_appendC('i')->_appendC('t')->_appendC('o')->_appendC('k')->_appendC('a')->_appendC('g')->_appendC('e')->_appendClose();\r\n\tSystem::String* s_Zenigame\t\t= (CS_NEW System::String())->_appendC('Z')->_appendC('e')->_appendC('n')->_appendC('i')->_appendC('g')->_appendC('a')->_appendC('m')->_appendC('e')->_appendClose();\r\n\tSystem::String* s_Fushigidane\t= (CS_NEW System::String())->_appendC('F')->_appendC('u')->_appendC('s')->_appendC('h')->_appendC('i')->_appendC('g')->_appendC('i')->_appendC('d')->_appendC('a')->_appendC('n')->_appendC('e')->_appendClose();\r\n\tSystem::String* s_Pikachu\t\t= (CS_NEW System::String())->_appendC('P')->_appendC('i')->_appendC('k')->_appendC('a')->_appendC('c')->_appendC('h')->_appendC('u')->_appendClose();\r\n\tSystem::String* s_Lizardo\t\t= (CS_NEW System::String())->_appendC('L')->_appendC('i')->_appendC('z')->_appendC('a')->_appendC('r')->_appendC('d')->_appendC('o')->_appendClose();\r\n\tSystem::String* s_Poppo\t\t\t= (CS_NEW System::String())->_appendC('P')->_appendC('o')->_appendC('p')->_appendC('p')->_appendC('o')->_appendClose();\r\n\tSystem::String* s_Mew\t\t\t= (CS_NEW System::String())->_appendC('M')->_appendC('e')->_appendC('w')->_appendClose();\r\n\r\n\r\n\r\n\t// GC TEST\r\n\tSystem::Collections::Generic::Dictionary<System::String*,System::String*>* _static_dic = CS_NEW System::Collections::Generic::Dictionary<System::String*,System::String*>();\r\n    _static_dic->Add(s_red   , s_Hitokage);\r\n    _static_dic->Add(s_blue  , s_Zenigame);\r\n    _static_dic->Add(s_green , s_Fushigidane);\r\n    _static_dic->Add(s_yellow, s_Pikachu);\r\n    _static_dic->Add(s_friend, s_Pikachu);\r\n\tSystem::Memory::registerGCRoot(&_static_dic);\r\n\t// END GC TEST\r\n\r\n\r\n    // Test - Contructor\r\n    System::Collections::Generic::Dictionary<System::String*,System::String*>* dic = CS_NEW System::Collections::Generic::Dictionary<System::String*,System::String*>();\r\n    printf(\"[DictionaryTest] Constructors 1.0 - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Constructors 1.0 - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n    printf(\"\\n\");\r\n            \r\n    // Test - Add\r\n    printf(\"[DictionaryTest] Add 1.0+ - before - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Add 1.0+ - before - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n    printf(\"\\n\");\r\n            \r\n    dic->Add(s_red   , s_Hitokage);\r\n    dic->Add(s_blue  , s_Zenigame);\r\n    dic->Add(s_green , s_Fushigidane);\r\n    dic->Add(s_yellow, s_Pikachu);\r\n    dic->Add(s_friend, s_Pikachu);\r\n            \r\n    printf(\"[DictionaryTest] Add 1.0 - result - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Add 1.0 - result - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\t\r\n    TRY\r\n        dic->Add(s_red, s_Lizardo);\r\n\tCTRY\r\n    FIRSTCATCH(System::ArgumentException, ex)\r\n        printf(\"[DictionaryTest] Add 1.1 - An element with Key = \\\"red\\\" already exists.\\n\");\r\n\tFINALLY\r\n    ETRY\r\n    printf(\"\\n\");\r\n\t\r\n    // Test - Item\r\n    printf(\"[DictionaryTest] Item 1.0+ - before - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Item 1.0+ - before - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\r\n\tprintf(\"[DictionaryTest] Item 1.0 - dic[\\\"red\\\"]    - result = %s\\n\", dic->_idx_g(s_red)->_toCStr());\r\n    printf(\"[DictionaryTest] Item 1.1 - dic[\\\"yellow\\\"] - result = %s\\n\", dic->_idx_g(s_yellow)->_toCStr());\r\n\r\n    dic->_idx_s(s_red, s_Lizardo);\r\n    printf(\"[DictionaryTest] Item 1.2 - dic[\\\"red\\\"]    - result = %s\\n\", dic->_idx_g(s_red)->_toCStr());\r\n            \r\n    dic->_idx_s(s_air, s_Poppo);\r\n            \r\n    printf(\"[DictionaryTest] Item 1.0-1.2 - result - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Item 1.0-1.2 - result - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\t\r\n    TRY\r\n        printf(\"[DictionaryTest] Item 1.3 - dic[\\\"water\\\"] - result = %s\\n\", dic->_idx_g(s_water)->_toCStr());\r\n    CTRY\r\n\tFIRSTCATCH(System::Collections::Generic::KeyNotFoundException, ex)\r\n        printf(\"[DictionaryTest] Item 1.3 - dic[\\\"water\\\"] - result = Not found.\\n\");\r\n    FINALLY\r\n\tETRY\r\n    printf(\"\\n\");\r\n\t\r\n    // Test - Clear\r\n    printf(\"[DictionaryTest] Clear 1.0 - before - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Clear 1.0 - before - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\r\n    dic->Clear();\r\n\r\n    printf(\"[DictionaryTest] Clear 1.0 - result - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Clear 1.0 - result - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n    printf(\"\\n\");\r\n\r\n    // Test - ContainsKey\r\n\tdic->Add(s_red   , s_Hitokage);\r\n    dic->Add(s_blue  , s_Zenigame);\r\n    dic->Add(s_green , s_Fushigidane);\r\n    dic->Add(s_yellow, s_Pikachu);\r\n    dic->Add(s_friend, s_Pikachu);\r\n\r\n    printf(\"[DictionaryTest] ContainsKey 1.0+ - before - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] ContainsKey 1.0+ - before - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\r\n    printf(\"[DictionaryTest] ContainsKey 1.0 - ContainsKey(\\\"red\\\")   - result = %s\\n\", (dic->ContainsKey(s_red))\t? \"True\":\"False\");\r\n    printf(\"[DictionaryTest] ContainsKey 1.1 - ContainsKey(\\\"water\\\") - result = %s\\n\", (dic->ContainsKey(s_water)) ? \"True\":\"False\");\r\n    printf(\"\\n\");\r\n\r\n        // Test - ContainsValue\r\n    printf(\"[DictionaryTest] ContainsValue 1.0+ - before - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] ContainsValue 1.0+ - before - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\r\n    printf(\"[DictionaryTest] ContainsValue 1.0 - ContainsValue(\\\"Pikachu\\\") - result = %s\\n\", (dic->ContainsValue(s_Pikachu)) ? \"True\":\"False\");\r\n    printf(\"[DictionaryTest] ContainsValue 1.1 - ContainsValue(\\\"Mew\\\")     - result = %s\\n\", (dic->ContainsValue(s_Mew))\t  ? \"True\":\"False\");\r\n    printf(\"\\n\");\r\n\r\n    // Test - Remove\r\n    printf(\"[DictionaryTest] Remove 1.0+ - before - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Remove 1.0+ - before - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n\r\n    dic->Remove(s_friend);\r\n\r\n    printf(\"[DictionaryTest] Remove 1.0 - result - Count = %i\\n\", dic->_acc_gCount());\r\n    printf(\"[DictionaryTest] Remove 1.0 - result - Display\\n\");  \r\n    DisplayDictionary(dic);\r\n    printf(\"\\n\");\r\n\r\n    // Test - TryGetValue\r\n\ts = NULL;\r\n    if(dic->TryGetValue(s_red, s)) {\r\n\t\tprintf(\"[DictionaryTest] TryGetValue 1.0 - TryGetValue(\\\"red\\\")   - result = %s\\n\", s->_toCStr()); \r\n    } else {\r\n        printf(\"[DictionaryTest] TryGetValue 1.0 - TryGetValue(\\\"red\\\")   - result = Not found.\\n\");\r\n    }\r\n\r\n    if(dic->TryGetValue(s_water, s)) {\r\n\t\tprintf(\"[DictionaryTest] TryGetValue 1.1 - TryGetValue(\\\"water\\\") - result = %s\\n\", s->_toCStr()); \r\n    } else {\r\n        printf(\"[DictionaryTest] TryGetValue 1.1 - TryGetValue(\\\"water\\\") - result = Not found.\\n\");\r\n    }\r\n    printf(\"\\n\");\r\n\t\r\n\r\n\t// GC TEST\r\n\t// Garbage Collection\r\n\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\r\n\tDisplayList(_static_strList);\tprintf(\"\\n\");\r\n\tDisplayArray(_static_strArray); printf(\"\\n\");\r\n\tDisplayDictionary(_static_dic); printf(\"\\n\");\r\n\t\r\n\t// SECOND COMPACTION\r\n\tSystem::Memory::compactionSmall((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\r\n\tDisplayList(_static_strList);\tprintf(\"\\n\");\r\n\tDisplayArray(_static_strArray); printf(\"\\n\");\r\n\tDisplayDictionary(_static_dic); printf(\"\\n\");\r\n\r\n\t// END GC TEST\r\n\r\n\treturn 0;\r\n}\r\n\r\nbool init() {\r\n\t__InternalUtils::init();\r\n\tSystem::_x_StringGlobalAllocator::init(500);\r\n\tSystem::String::init();\r\n\t\r\n\treturn true;\r\n}\r\n\r\n// TODO D : Assignment of struct from code, via var, member.\r\n// TODO E : Verifiy struct with Delegate\r\n// TODO F : Verify ref & related.\r\n\r\n#include \"inline/generated.inl\"\r\n\r\nint main() {\r\n\tif (System::Memory::setGlobalMemory(1500000, 500,4096,4096)) {\r\n\t\tint i = 0;\r\n\t\tTRY\r\n\t\t\tinit();\r\n\t\t\t//main_tests();\r\n\t\t\tregisterWorldGC();\r\n\t\t\tCSharpTests::Program::Main(NULL);\r\n\t\t\t//InternalTests::GCTestArray();\r\n\t\t\t//InternalTests::GCTestList();\r\n\t\t\t//InternalTests::GCTestDictionary();\r\n\r\n\r\n\t\t\t// GC TEST\r\n\t\t\t// Garbage Collection\r\n\t\t\tSystem::Memory::compactionMS((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\r\n\t\t\tprintf(\"--------------------------------\\n\");\r\n\t\t\tprintf(\"--------------------------------\\n\");\r\n\t\t\tprintf(\"-------------       ------------\\n\");\r\n\t\t\tprintf(\"--------------------------------\\n\");\r\n\t\t\tprintf(\"--------------------------------\\n\");\r\n\r\n\t\t\t// SECOND COMPACTION\r\n\t\t\tSystem::Memory::compactionSmall((System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_GEN1 | System::Memory::COMPACT_NOW));\r\n\t\r\n\t\t\t// END GC TEST\r\n\r\n\t\tCTRY\r\n\t\tFIRSTCATCH(System::Exception, ex)\r\n\t\t\tSystem::Console::WriteLine();\r\n\t\t\tprintf(\"EXCEPTION\");\r\n\t\t\tSystem::Console::WriteLine();\r\n\t\t\tSystem::Console::WriteLine(ex->ToString$());\r\n\t\t\tSystem::Console::WriteLine(ex->_acc_gMessage$());\r\n\t\tFINALLY\r\n\t\tETRY\r\n\r\n\t#ifdef _WIN32\r\n\t\tsystem(\"pause\");\r\n\t#endif\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/stdafx.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// stdafx.cpp : source file that includes just the standard includes\r\n// CompilerCSharp.pch will be the pre-compiled header\r\n// stdafx.obj will contain the pre-compiled type information\r\n\r\n#include \"stdafx.h\"\r\n\r\n// TODO: reference any additional headers you need in STDAFX.H\r\n// and not in this file\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/stdafx.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// stdafx.h : include file for standard system include files,\r\n// or project specific include files that are used frequently, but\r\n// are changed infrequently\r\n//\r\n\r\n#pragma once\r\n\r\n#include \"targetver.h\"\r\n\r\n#include <stdio.h>\r\n#include <tchar.h>\r\n\r\n\r\n\r\n// TODO: reference additional headers your program requires here\r\n"
  },
  {
    "path": "Engine/libs/RuntimeCSharp/RuntimeLibrary/targetver.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#pragma once\r\n\r\n// Including SDKDDKVer.h defines the highest available Windows platform.\r\n\r\n// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and\r\n// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.\r\n\r\n#include <SDKDDKVer.h>\r\n"
  },
  {
    "path": "Engine/libs/SQLite/sqlite3.c",
    "content": "/******************************************************************************\r\n** This file is an amalgamation of many separate C source files from SQLite\r\n** version 3.7.11.  By combining all the individual C code files into this \r\n** single large file, the entire code can be compiled as a single translation\r\n** unit.  This allows many compilers to do optimizations that would not be\r\n** possible if the files were compiled separately.  Performance improvements\r\n** of 5% or more are commonly seen when SQLite is compiled as a single\r\n** translation unit.\r\n**\r\n** This file is all you need to compile SQLite.  To use SQLite in other\r\n** programs, you need this file and the \"sqlite3.h\" header file that defines\r\n** the programming interface to the SQLite library.  (If you do not have \r\n** the \"sqlite3.h\" header file at hand, you will find a copy embedded within\r\n** the text of this file.  Search for \"Begin file sqlite3.h\" to find the start\r\n** of the embedded sqlite3.h header file.) Additional code files may be needed\r\n** if you want a wrapper to interface SQLite with your choice of programming\r\n** language. The code for the \"sqlite3\" command-line shell is also in a\r\n** separate file. This file contains only code for the core SQLite library.\r\n*/\r\n\r\n// Disable Warnings\r\n// C4100 : 'identifier' : unreferenced formal parameter\r\n// C4127 : conditional expression is constant\r\n// C4232 : nonstandard extension used : 'identifier' : address of dllimport 'dllimport' is not static, identity not guaranteed\r\n// C4244 : 'conversion' conversion from 'type1' to 'type2', possible loss of data\r\n// C4701 : Potentially uninitialized local variable 'name' used\r\n// C4706 : assignment within conditional expression\r\n#pragma warning( disable : 4100 )\r\n#pragma warning( disable : 4127 )\r\n#pragma warning( disable : 4232 )\r\n#pragma warning( disable : 4244 )\r\n#pragma warning( disable : 4701 )\r\n#pragma warning( disable : 4706 )\r\n\r\n\r\n#define SQLITE_CORE 1\r\n#define SQLITE_AMALGAMATION 1\r\n#ifndef SQLITE_PRIVATE\r\n# define SQLITE_PRIVATE static\r\n#endif\r\n#ifndef SQLITE_API\r\n# define SQLITE_API\r\n#endif\r\n/************** Begin file sqliteInt.h ***************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** Internal interface definitions for SQLite.\r\n**\r\n*/\r\n#ifndef _SQLITEINT_H_\r\n#define _SQLITEINT_H_\r\n\r\n/*\r\n** These #defines should enable >2GB file support on POSIX if the\r\n** underlying operating system supports it.  If the OS lacks\r\n** large file support, or if the OS is windows, these should be no-ops.\r\n**\r\n** Ticket #2739:  The _LARGEFILE_SOURCE macro must appear before any\r\n** system #includes.  Hence, this block of code must be the very first\r\n** code in all source files.\r\n**\r\n** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch\r\n** on the compiler command line.  This is necessary if you are compiling\r\n** on a recent machine (ex: Red Hat 7.2) but you want your code to work\r\n** on an older machine (ex: Red Hat 6.0).  If you compile on Red Hat 7.2\r\n** without this option, LFS is enable.  But LFS does not exist in the kernel\r\n** in Red Hat 6.0, so the code won't work.  Hence, for maximum binary\r\n** portability you should omit LFS.\r\n**\r\n** Similar is true for Mac OS X.  LFS is only supported on Mac OS X 9 and later.\r\n*/\r\n#ifndef SQLITE_DISABLE_LFS\r\n# define _LARGE_FILE       1\r\n# ifndef _FILE_OFFSET_BITS\r\n#   define _FILE_OFFSET_BITS 64\r\n# endif\r\n# define _LARGEFILE_SOURCE 1\r\n#endif\r\n\r\n/*\r\n** Include the configuration header output by 'configure' if we're using the\r\n** autoconf-based build\r\n*/\r\n#ifdef _HAVE_SQLITE_CONFIG_H\r\n#include \"config.h\"\r\n#endif\r\n\r\n/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/\r\n/************** Begin file sqliteLimit.h *************************************/\r\n/*\r\n** 2007 May 7\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** \r\n** This file defines various limits of what SQLite can process.\r\n*/\r\n\r\n/*\r\n** The maximum length of a TEXT or BLOB in bytes.   This also\r\n** limits the size of a row in a table or index.\r\n**\r\n** The hard limit is the ability of a 32-bit signed integer\r\n** to count the size: 2^31-1 or 2147483647.\r\n*/\r\n#ifndef SQLITE_MAX_LENGTH\r\n# define SQLITE_MAX_LENGTH 1000000000\r\n#endif\r\n\r\n/*\r\n** This is the maximum number of\r\n**\r\n**    * Columns in a table\r\n**    * Columns in an index\r\n**    * Columns in a view\r\n**    * Terms in the SET clause of an UPDATE statement\r\n**    * Terms in the result set of a SELECT statement\r\n**    * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.\r\n**    * Terms in the VALUES clause of an INSERT statement\r\n**\r\n** The hard upper limit here is 32676.  Most database people will\r\n** tell you that in a well-normalized database, you usually should\r\n** not have more than a dozen or so columns in any table.  And if\r\n** that is the case, there is no point in having more than a few\r\n** dozen values in any of the other situations described above.\r\n*/\r\n#ifndef SQLITE_MAX_COLUMN\r\n# define SQLITE_MAX_COLUMN 2000\r\n#endif\r\n\r\n/*\r\n** The maximum length of a single SQL statement in bytes.\r\n**\r\n** It used to be the case that setting this value to zero would\r\n** turn the limit off.  That is no longer true.  It is not possible\r\n** to turn this limit off.\r\n*/\r\n#ifndef SQLITE_MAX_SQL_LENGTH\r\n# define SQLITE_MAX_SQL_LENGTH 1000000000\r\n#endif\r\n\r\n/*\r\n** The maximum depth of an expression tree. This is limited to \r\n** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might \r\n** want to place more severe limits on the complexity of an \r\n** expression.\r\n**\r\n** A value of 0 used to mean that the limit was not enforced.\r\n** But that is no longer true.  The limit is now strictly enforced\r\n** at all times.\r\n*/\r\n#ifndef SQLITE_MAX_EXPR_DEPTH\r\n# define SQLITE_MAX_EXPR_DEPTH 1000\r\n#endif\r\n\r\n/*\r\n** The maximum number of terms in a compound SELECT statement.\r\n** The code generator for compound SELECT statements does one\r\n** level of recursion for each term.  A stack overflow can result\r\n** if the number of terms is too large.  In practice, most SQL\r\n** never has more than 3 or 4 terms.  Use a value of 0 to disable\r\n** any limit on the number of terms in a compount SELECT.\r\n*/\r\n#ifndef SQLITE_MAX_COMPOUND_SELECT\r\n# define SQLITE_MAX_COMPOUND_SELECT 500\r\n#endif\r\n\r\n/*\r\n** The maximum number of opcodes in a VDBE program.\r\n** Not currently enforced.\r\n*/\r\n#ifndef SQLITE_MAX_VDBE_OP\r\n# define SQLITE_MAX_VDBE_OP 25000\r\n#endif\r\n\r\n/*\r\n** The maximum number of arguments to an SQL function.\r\n*/\r\n#ifndef SQLITE_MAX_FUNCTION_ARG\r\n# define SQLITE_MAX_FUNCTION_ARG 127\r\n#endif\r\n\r\n/*\r\n** The maximum number of in-memory pages to use for the main database\r\n** table and for temporary tables.  The SQLITE_DEFAULT_CACHE_SIZE\r\n*/\r\n#ifndef SQLITE_DEFAULT_CACHE_SIZE\r\n# define SQLITE_DEFAULT_CACHE_SIZE  2000\r\n#endif\r\n#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE\r\n# define SQLITE_DEFAULT_TEMP_CACHE_SIZE  500\r\n#endif\r\n\r\n/*\r\n** The default number of frames to accumulate in the log file before\r\n** checkpointing the database in WAL mode.\r\n*/\r\n#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT\r\n# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT  1000\r\n#endif\r\n\r\n/*\r\n** The maximum number of attached databases.  This must be between 0\r\n** and 62.  The upper bound on 62 is because a 64-bit integer bitmap\r\n** is used internally to track attached databases.\r\n*/\r\n#ifndef SQLITE_MAX_ATTACHED\r\n# define SQLITE_MAX_ATTACHED 10\r\n#endif\r\n\r\n\r\n/*\r\n** The maximum value of a ?nnn wildcard that the parser will accept.\r\n*/\r\n#ifndef SQLITE_MAX_VARIABLE_NUMBER\r\n# define SQLITE_MAX_VARIABLE_NUMBER 999\r\n#endif\r\n\r\n/* Maximum page size.  The upper bound on this value is 65536.  This a limit\r\n** imposed by the use of 16-bit offsets within each page.\r\n**\r\n** Earlier versions of SQLite allowed the user to change this value at\r\n** compile time. This is no longer permitted, on the grounds that it creates\r\n** a library that is technically incompatible with an SQLite library \r\n** compiled with a different limit. If a process operating on a database \r\n** with a page-size of 65536 bytes crashes, then an instance of SQLite \r\n** compiled with the default page-size limit will not be able to rollback \r\n** the aborted transaction. This could lead to database corruption.\r\n*/\r\n#ifdef SQLITE_MAX_PAGE_SIZE\r\n# undef SQLITE_MAX_PAGE_SIZE\r\n#endif\r\n#define SQLITE_MAX_PAGE_SIZE 65536\r\n\r\n\r\n/*\r\n** The default size of a database page.\r\n*/\r\n#ifndef SQLITE_DEFAULT_PAGE_SIZE\r\n# define SQLITE_DEFAULT_PAGE_SIZE 1024\r\n#endif\r\n#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE\r\n# undef SQLITE_DEFAULT_PAGE_SIZE\r\n# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE\r\n#endif\r\n\r\n/*\r\n** Ordinarily, if no value is explicitly provided, SQLite creates databases\r\n** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain\r\n** device characteristics (sector-size and atomic write() support),\r\n** SQLite may choose a larger value. This constant is the maximum value\r\n** SQLite will choose on its own.\r\n*/\r\n#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE\r\n# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192\r\n#endif\r\n#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE\r\n# undef SQLITE_MAX_DEFAULT_PAGE_SIZE\r\n# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE\r\n#endif\r\n\r\n\r\n/*\r\n** Maximum number of pages in one database file.\r\n**\r\n** This is really just the default value for the max_page_count pragma.\r\n** This value can be lowered (or raised) at run-time using that the\r\n** max_page_count macro.\r\n*/\r\n#ifndef SQLITE_MAX_PAGE_COUNT\r\n# define SQLITE_MAX_PAGE_COUNT 1073741823\r\n#endif\r\n\r\n/*\r\n** Maximum length (in bytes) of the pattern in a LIKE or GLOB\r\n** operator.\r\n*/\r\n#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH\r\n# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000\r\n#endif\r\n\r\n/*\r\n** Maximum depth of recursion for triggers.\r\n**\r\n** A value of 1 means that a trigger program will not be able to itself\r\n** fire any triggers. A value of 0 means that no trigger programs at all \r\n** may be executed.\r\n*/\r\n#ifndef SQLITE_MAX_TRIGGER_DEPTH\r\n# define SQLITE_MAX_TRIGGER_DEPTH 1000\r\n#endif\r\n\r\n/************** End of sqliteLimit.h *****************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n\r\n/* Disable nuisance warnings on Borland compilers */\r\n#if defined(__BORLANDC__)\r\n#pragma warn -rch /* unreachable code */\r\n#pragma warn -ccc /* Condition is always true or false */\r\n#pragma warn -aus /* Assigned value is never used */\r\n#pragma warn -csu /* Comparing signed and unsigned */\r\n#pragma warn -spa /* Suspicious pointer arithmetic */\r\n#endif\r\n\r\n/* Needed for various definitions... */\r\n#ifndef _GNU_SOURCE\r\n# define _GNU_SOURCE\r\n#endif\r\n\r\n/*\r\n** Include standard header files as necessary\r\n*/\r\n#ifdef HAVE_STDINT_H\r\n#include <stdint.h>\r\n#endif\r\n#ifdef HAVE_INTTYPES_H\r\n#include <inttypes.h>\r\n#endif\r\n\r\n/*\r\n** The following macros are used to cast pointers to integers and\r\n** integers to pointers.  The way you do this varies from one compiler\r\n** to the next, so we have developed the following set of #if statements\r\n** to generate appropriate macros for a wide range of compilers.\r\n**\r\n** The correct \"ANSI\" way to do this is to use the intptr_t type. \r\n** Unfortunately, that typedef is not available on all compilers, or\r\n** if it is available, it requires an #include of specific headers\r\n** that vary from one machine to the next.\r\n**\r\n** Ticket #3860:  The llvm-gcc-4.2 compiler from Apple chokes on\r\n** the ((void*)&((char*)0)[X]) construct.  But MSVC chokes on ((void*)(X)).\r\n** So we have to define the macros in different ways depending on the\r\n** compiler.\r\n*/\r\n#if defined(__PTRDIFF_TYPE__)  /* This case should work for GCC */\r\n# define SQLITE_INT_TO_PTR(X)  ((void*)(__PTRDIFF_TYPE__)(X))\r\n# define SQLITE_PTR_TO_INT(X)  ((int)(__PTRDIFF_TYPE__)(X))\r\n#elif !defined(__GNUC__)       /* Works for compilers other than LLVM */\r\n# define SQLITE_INT_TO_PTR(X)  ((void*)&((char*)0)[X])\r\n# define SQLITE_PTR_TO_INT(X)  ((int)(((char*)X)-(char*)0))\r\n#elif defined(HAVE_STDINT_H)   /* Use this case if we have ANSI headers */\r\n# define SQLITE_INT_TO_PTR(X)  ((void*)(intptr_t)(X))\r\n# define SQLITE_PTR_TO_INT(X)  ((int)(intptr_t)(X))\r\n#else                          /* Generates a warning - but it always works */\r\n# define SQLITE_INT_TO_PTR(X)  ((void*)(X))\r\n# define SQLITE_PTR_TO_INT(X)  ((int)(X))\r\n#endif\r\n\r\n/*\r\n** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.\r\n** 0 means mutexes are permanently disable and the library is never\r\n** threadsafe.  1 means the library is serialized which is the highest\r\n** level of threadsafety.  2 means the libary is multithreaded - multiple\r\n** threads can use SQLite as long as no two threads try to use the same\r\n** database connection at the same time.\r\n**\r\n** Older versions of SQLite used an optional THREADSAFE macro.\r\n** We support that for legacy.\r\n*/\r\n#if !defined(SQLITE_THREADSAFE)\r\n#if defined(THREADSAFE)\r\n# define SQLITE_THREADSAFE THREADSAFE\r\n#else\r\n# define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */\r\n#endif\r\n#endif\r\n\r\n/*\r\n** Powersafe overwrite is on by default.  But can be turned off using\r\n** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.\r\n*/\r\n#ifndef SQLITE_POWERSAFE_OVERWRITE\r\n# define SQLITE_POWERSAFE_OVERWRITE 1\r\n#endif\r\n\r\n/*\r\n** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.\r\n** It determines whether or not the features related to \r\n** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can\r\n** be overridden at runtime using the sqlite3_config() API.\r\n*/\r\n#if !defined(SQLITE_DEFAULT_MEMSTATUS)\r\n# define SQLITE_DEFAULT_MEMSTATUS 1\r\n#endif\r\n\r\n/*\r\n** Exactly one of the following macros must be defined in order to\r\n** specify which memory allocation subsystem to use.\r\n**\r\n**     SQLITE_SYSTEM_MALLOC          // Use normal system malloc()\r\n**     SQLITE_WIN32_MALLOC           // Use Win32 native heap API\r\n**     SQLITE_MEMDEBUG               // Debugging version of system malloc()\r\n**\r\n** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the\r\n** assert() macro is enabled, each call into the Win32 native heap subsystem\r\n** will cause HeapValidate to be called.  If heap validation should fail, an\r\n** assertion will be triggered.\r\n**\r\n** (Historical note:  There used to be several other options, but we've\r\n** pared it down to just these three.)\r\n**\r\n** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as\r\n** the default.\r\n*/\r\n#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)>1\r\n# error \"At most one of the following compile-time configuration options\\\r\n is allows: SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG\"\r\n#endif\r\n#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)==0\r\n# define SQLITE_SYSTEM_MALLOC 1\r\n#endif\r\n\r\n/*\r\n** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the\r\n** sizes of memory allocations below this value where possible.\r\n*/\r\n#if !defined(SQLITE_MALLOC_SOFT_LIMIT)\r\n# define SQLITE_MALLOC_SOFT_LIMIT 1024\r\n#endif\r\n\r\n/*\r\n** We need to define _XOPEN_SOURCE as follows in order to enable\r\n** recursive mutexes on most Unix systems.  But Mac OS X is different.\r\n** The _XOPEN_SOURCE define causes problems for Mac OS X we are told,\r\n** so it is omitted there.  See ticket #2673.\r\n**\r\n** Later we learn that _XOPEN_SOURCE is poorly or incorrectly\r\n** implemented on some systems.  So we avoid defining it at all\r\n** if it is already defined or if it is unneeded because we are\r\n** not doing a threadsafe build.  Ticket #2681.\r\n**\r\n** See also ticket #2741.\r\n*/\r\n#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE\r\n#  define _XOPEN_SOURCE 500  /* Needed to enable pthread recursive mutexes */\r\n#endif\r\n\r\n/*\r\n** The TCL headers are only needed when compiling the TCL bindings.\r\n*/\r\n#if defined(SQLITE_TCL) || defined(TCLSH)\r\n# include <tcl.h>\r\n#endif\r\n\r\n/*\r\n** Many people are failing to set -DNDEBUG=1 when compiling SQLite.\r\n** Setting NDEBUG makes the code smaller and run faster.  So the following\r\n** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1\r\n** option is set.  Thus NDEBUG becomes an opt-in rather than an opt-out\r\n** feature.\r\n*/\r\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \r\n# define NDEBUG 1\r\n#endif\r\n\r\n/*\r\n** The testcase() macro is used to aid in coverage testing.  When \r\n** doing coverage testing, the condition inside the argument to\r\n** testcase() must be evaluated both true and false in order to\r\n** get full branch coverage.  The testcase() macro is inserted\r\n** to help ensure adequate test coverage in places where simple\r\n** condition/decision coverage is inadequate.  For example, testcase()\r\n** can be used to make sure boundary values are tested.  For\r\n** bitmask tests, testcase() can be used to make sure each bit\r\n** is significant and used at least once.  On switch statements\r\n** where multiple cases go to the same block of code, testcase()\r\n** can insure that all cases are evaluated.\r\n**\r\n*/\r\n#ifdef SQLITE_COVERAGE_TEST\r\nSQLITE_PRIVATE   void sqlite3Coverage(int);\r\n# define testcase(X)  if( X ){ sqlite3Coverage(__LINE__); }\r\n#else\r\n# define testcase(X)\r\n#endif\r\n\r\n/*\r\n** The TESTONLY macro is used to enclose variable declarations or\r\n** other bits of code that are needed to support the arguments\r\n** within testcase() and assert() macros.\r\n*/\r\n#if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)\r\n# define TESTONLY(X)  X\r\n#else\r\n# define TESTONLY(X)\r\n#endif\r\n\r\n/*\r\n** Sometimes we need a small amount of code such as a variable initialization\r\n** to setup for a later assert() statement.  We do not want this code to\r\n** appear when assert() is disabled.  The following macro is therefore\r\n** used to contain that setup code.  The \"VVA\" acronym stands for\r\n** \"Verification, Validation, and Accreditation\".  In other words, the\r\n** code within VVA_ONLY() will only run during verification processes.\r\n*/\r\n#ifndef NDEBUG\r\n# define VVA_ONLY(X)  X\r\n#else\r\n# define VVA_ONLY(X)\r\n#endif\r\n\r\n/*\r\n** The ALWAYS and NEVER macros surround boolean expressions which \r\n** are intended to always be true or false, respectively.  Such\r\n** expressions could be omitted from the code completely.  But they\r\n** are included in a few cases in order to enhance the resilience\r\n** of SQLite to unexpected behavior - to make the code \"self-healing\"\r\n** or \"ductile\" rather than being \"brittle\" and crashing at the first\r\n** hint of unplanned behavior.\r\n**\r\n** In other words, ALWAYS and NEVER are added for defensive code.\r\n**\r\n** When doing coverage testing ALWAYS and NEVER are hard-coded to\r\n** be true and false so that the unreachable code then specify will\r\n** not be counted as untested code.\r\n*/\r\n#if defined(SQLITE_COVERAGE_TEST)\r\n# define ALWAYS(X)      (1)\r\n# define NEVER(X)       (0)\r\n#elif !defined(NDEBUG)\r\n# define ALWAYS(X)      ((X)?1:(assert(0),0))\r\n# define NEVER(X)       ((X)?(assert(0),1):0)\r\n#else\r\n# define ALWAYS(X)      (X)\r\n# define NEVER(X)       (X)\r\n#endif\r\n\r\n/*\r\n** Return true (non-zero) if the input is a integer that is too large\r\n** to fit in 32-bits.  This macro is used inside of various testcase()\r\n** macros to verify that we have tested SQLite for large-file support.\r\n*/\r\n#define IS_BIG_INT(X)  (((X)&~(i64)0xffffffff)!=0)\r\n\r\n/*\r\n** The macro unlikely() is a hint that surrounds a boolean\r\n** expression that is usually false.  Macro likely() surrounds\r\n** a boolean expression that is usually true.  GCC is able to\r\n** use these hints to generate better code, sometimes.\r\n*/\r\n#if defined(__GNUC__) && 0\r\n# define likely(X)    __builtin_expect((X),1)\r\n# define unlikely(X)  __builtin_expect((X),0)\r\n#else\r\n# define likely(X)    !!(X)\r\n# define unlikely(X)  !!(X)\r\n#endif\r\n\r\n/************** Include sqlite3.h in the middle of sqliteInt.h ***************/\r\n/************** Begin file sqlite3.h *****************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the interface that the SQLite library\r\n** presents to client programs.  If a C-function, structure, datatype,\r\n** or constant definition does not appear in this file, then it is\r\n** not a published API of SQLite, is subject to change without\r\n** notice, and should not be referenced by programs that use SQLite.\r\n**\r\n** Some of the definitions that are in this file are marked as\r\n** \"experimental\".  Experimental interfaces are normally new\r\n** features recently added to SQLite.  We do not anticipate changes\r\n** to experimental interfaces but reserve the right to make minor changes\r\n** if experience from use \"in the wild\" suggest such changes are prudent.\r\n**\r\n** The official C-language API documentation for SQLite is derived\r\n** from comments in this file.  This file is the authoritative source\r\n** on how SQLite interfaces are suppose to operate.\r\n**\r\n** The name of this file under configuration management is \"sqlite.h.in\".\r\n** The makefile makes some minor changes to this file (such as inserting\r\n** the version number) and changes its name to \"sqlite3.h\" as\r\n** part of the build process.\r\n*/\r\n#ifndef _SQLITE3_H_\r\n#define _SQLITE3_H_\r\n#include <stdarg.h>     /* Needed for the definition of va_list */\r\n\r\n/*\r\n** Make sure we can call this stuff from C++.\r\n*/\r\n#if 0\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\n/*\r\n** Add the ability to override 'extern'\r\n*/\r\n#ifndef SQLITE_EXTERN\r\n# define SQLITE_EXTERN extern\r\n#endif\r\n\r\n#ifndef SQLITE_API\r\n# define SQLITE_API\r\n#endif\r\n\r\n\r\n/*\r\n** These no-op macros are used in front of interfaces to mark those\r\n** interfaces as either deprecated or experimental.  New applications\r\n** should not use deprecated interfaces - they are support for backwards\r\n** compatibility only.  Application writers should be aware that\r\n** experimental interfaces are subject to change in point releases.\r\n**\r\n** These macros used to resolve to various kinds of compiler magic that\r\n** would generate warning messages when they were used.  But that\r\n** compiler magic ended up generating such a flurry of bug reports\r\n** that we have taken it all out and gone back to using simple\r\n** noop macros.\r\n*/\r\n#define SQLITE_DEPRECATED\r\n#define SQLITE_EXPERIMENTAL\r\n\r\n/*\r\n** Ensure these symbols were not defined by some previous header file.\r\n*/\r\n#ifdef SQLITE_VERSION\r\n# undef SQLITE_VERSION\r\n#endif\r\n#ifdef SQLITE_VERSION_NUMBER\r\n# undef SQLITE_VERSION_NUMBER\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Compile-Time Library Version Numbers\r\n**\r\n** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header\r\n** evaluates to a string literal that is the SQLite version in the\r\n** format \"X.Y.Z\" where X is the major version number (always 3 for\r\n** SQLite3) and Y is the minor version number and Z is the release number.)^\r\n** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer\r\n** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same\r\n** numbers used in [SQLITE_VERSION].)^\r\n** The SQLITE_VERSION_NUMBER for any given release of SQLite will also\r\n** be larger than the release from which it is derived.  Either Y will\r\n** be held constant and Z will be incremented or else Y will be incremented\r\n** and Z will be reset to zero.\r\n**\r\n** Since version 3.6.18, SQLite source code has been stored in the\r\n** <a href=\"http://www.fossil-scm.org/\">Fossil configuration management\r\n** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to\r\n** a string which identifies a particular check-in of SQLite\r\n** within its configuration management system.  ^The SQLITE_SOURCE_ID\r\n** string contains the date and time of the check-in (UTC) and an SHA1\r\n** hash of the entire source tree.\r\n**\r\n** See also: [sqlite3_libversion()],\r\n** [sqlite3_libversion_number()], [sqlite3_sourceid()],\r\n** [sqlite_version()] and [sqlite_source_id()].\r\n*/\r\n#define SQLITE_VERSION        \"3.7.11\"\r\n#define SQLITE_VERSION_NUMBER 3007011\r\n#define SQLITE_SOURCE_ID      \"2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669\"\r\n\r\n/*\r\n** CAPI3REF: Run-Time Library Version Numbers\r\n** KEYWORDS: sqlite3_version, sqlite3_sourceid\r\n**\r\n** These interfaces provide the same information as the [SQLITE_VERSION],\r\n** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros\r\n** but are associated with the library instead of the header file.  ^(Cautious\r\n** programmers might include assert() statements in their application to\r\n** verify that values returned by these interfaces match the macros in\r\n** the header, and thus insure that the application is\r\n** compiled with matching library and header files.\r\n**\r\n** <blockquote><pre>\r\n** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );\r\n** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );\r\n** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );\r\n** </pre></blockquote>)^\r\n**\r\n** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]\r\n** macro.  ^The sqlite3_libversion() function returns a pointer to the\r\n** to the sqlite3_version[] string constant.  The sqlite3_libversion()\r\n** function is provided for use in DLLs since DLL users usually do not have\r\n** direct access to string constants within the DLL.  ^The\r\n** sqlite3_libversion_number() function returns an integer equal to\r\n** [SQLITE_VERSION_NUMBER].  ^The sqlite3_sourceid() function returns \r\n** a pointer to a string constant whose value is the same as the \r\n** [SQLITE_SOURCE_ID] C preprocessor macro.\r\n**\r\n** See also: [sqlite_version()] and [sqlite_source_id()].\r\n*/\r\nSQLITE_API const char sqlite3_version[] = SQLITE_VERSION;\r\nSQLITE_API const char *sqlite3_libversion(void);\r\nSQLITE_API const char *sqlite3_sourceid(void);\r\nSQLITE_API int sqlite3_libversion_number(void);\r\n\r\n/*\r\n** CAPI3REF: Run-Time Library Compilation Options Diagnostics\r\n**\r\n** ^The sqlite3_compileoption_used() function returns 0 or 1 \r\n** indicating whether the specified option was defined at \r\n** compile time.  ^The SQLITE_ prefix may be omitted from the \r\n** option name passed to sqlite3_compileoption_used().  \r\n**\r\n** ^The sqlite3_compileoption_get() function allows iterating\r\n** over the list of options that were defined at compile time by\r\n** returning the N-th compile time option string.  ^If N is out of range,\r\n** sqlite3_compileoption_get() returns a NULL pointer.  ^The SQLITE_ \r\n** prefix is omitted from any strings returned by \r\n** sqlite3_compileoption_get().\r\n**\r\n** ^Support for the diagnostic functions sqlite3_compileoption_used()\r\n** and sqlite3_compileoption_get() may be omitted by specifying the \r\n** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.\r\n**\r\n** See also: SQL functions [sqlite_compileoption_used()] and\r\n** [sqlite_compileoption_get()] and the [compile_options pragma].\r\n*/\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\nSQLITE_API int sqlite3_compileoption_used(const char *zOptName);\r\nSQLITE_API const char *sqlite3_compileoption_get(int N);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Test To See If The Library Is Threadsafe\r\n**\r\n** ^The sqlite3_threadsafe() function returns zero if and only if\r\n** SQLite was compiled with mutexing code omitted due to the\r\n** [SQLITE_THREADSAFE] compile-time option being set to 0.\r\n**\r\n** SQLite can be compiled with or without mutexes.  When\r\n** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes\r\n** are enabled and SQLite is threadsafe.  When the\r\n** [SQLITE_THREADSAFE] macro is 0, \r\n** the mutexes are omitted.  Without the mutexes, it is not safe\r\n** to use SQLite concurrently from more than one thread.\r\n**\r\n** Enabling mutexes incurs a measurable performance penalty.\r\n** So if speed is of utmost importance, it makes sense to disable\r\n** the mutexes.  But for maximum safety, mutexes should be enabled.\r\n** ^The default behavior is for mutexes to be enabled.\r\n**\r\n** This interface can be used by an application to make sure that the\r\n** version of SQLite that it is linking against was compiled with\r\n** the desired setting of the [SQLITE_THREADSAFE] macro.\r\n**\r\n** This interface only reports on the compile-time mutex setting\r\n** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with\r\n** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but\r\n** can be fully or partially disabled using a call to [sqlite3_config()]\r\n** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],\r\n** or [SQLITE_CONFIG_MUTEX].  ^(The return value of the\r\n** sqlite3_threadsafe() function shows only the compile-time setting of\r\n** thread safety, not any run-time changes to that setting made by\r\n** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()\r\n** is unchanged by calls to sqlite3_config().)^\r\n**\r\n** See the [threading mode] documentation for additional information.\r\n*/\r\nSQLITE_API int sqlite3_threadsafe(void);\r\n\r\n/*\r\n** CAPI3REF: Database Connection Handle\r\n** KEYWORDS: {database connection} {database connections}\r\n**\r\n** Each open SQLite database is represented by a pointer to an instance of\r\n** the opaque structure named \"sqlite3\".  It is useful to think of an sqlite3\r\n** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and\r\n** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]\r\n** is its destructor.  There are many other interfaces (such as\r\n** [sqlite3_prepare_v2()], [sqlite3_create_function()], and\r\n** [sqlite3_busy_timeout()] to name but three) that are methods on an\r\n** sqlite3 object.\r\n*/\r\ntypedef struct sqlite3 sqlite3;\r\n\r\n/*\r\n** CAPI3REF: 64-Bit Integer Types\r\n** KEYWORDS: sqlite_int64 sqlite_uint64\r\n**\r\n** Because there is no cross-platform way to specify 64-bit integer types\r\n** SQLite includes typedefs for 64-bit signed and unsigned integers.\r\n**\r\n** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.\r\n** The sqlite_int64 and sqlite_uint64 types are supported for backwards\r\n** compatibility only.\r\n**\r\n** ^The sqlite3_int64 and sqlite_int64 types can store integer values\r\n** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The\r\n** sqlite3_uint64 and sqlite_uint64 types can store integer values \r\n** between 0 and +18446744073709551615 inclusive.\r\n*/\r\n#ifdef SQLITE_INT64_TYPE\r\n  typedef SQLITE_INT64_TYPE sqlite_int64;\r\n  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;\r\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\r\n  typedef __int64 sqlite_int64;\r\n  typedef unsigned __int64 sqlite_uint64;\r\n#else\r\n  typedef long long int sqlite_int64;\r\n  typedef unsigned long long int sqlite_uint64;\r\n#endif\r\ntypedef sqlite_int64 sqlite3_int64;\r\ntypedef sqlite_uint64 sqlite3_uint64;\r\n\r\n/*\r\n** If compiling for a processor that lacks floating point support,\r\n** substitute integer for floating-point.\r\n*/\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n# define double sqlite3_int64\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Closing A Database Connection\r\n**\r\n** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.\r\n** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is\r\n** successfully destroyed and all associated resources are deallocated.\r\n**\r\n** Applications must [sqlite3_finalize | finalize] all [prepared statements]\r\n** and [sqlite3_blob_close | close] all [BLOB handles] associated with\r\n** the [sqlite3] object prior to attempting to close the object.  ^If\r\n** sqlite3_close() is called on a [database connection] that still has\r\n** outstanding [prepared statements] or [BLOB handles], then it returns\r\n** SQLITE_BUSY.\r\n**\r\n** ^If [sqlite3_close()] is invoked while a transaction is open,\r\n** the transaction is automatically rolled back.\r\n**\r\n** The C parameter to [sqlite3_close(C)] must be either a NULL\r\n** pointer or an [sqlite3] object pointer obtained\r\n** from [sqlite3_open()], [sqlite3_open16()], or\r\n** [sqlite3_open_v2()], and not previously closed.\r\n** ^Calling sqlite3_close() with a NULL pointer argument is a \r\n** harmless no-op.\r\n*/\r\nSQLITE_API int sqlite3_close(sqlite3 *);\r\n\r\n/*\r\n** The type for a callback function.\r\n** This is legacy and deprecated.  It is included for historical\r\n** compatibility and is not documented.\r\n*/\r\ntypedef int (*sqlite3_callback)(void*,int,char**, char**);\r\n\r\n/*\r\n** CAPI3REF: One-Step Query Execution Interface\r\n**\r\n** The sqlite3_exec() interface is a convenience wrapper around\r\n** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],\r\n** that allows an application to run multiple statements of SQL\r\n** without having to use a lot of C code. \r\n**\r\n** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,\r\n** semicolon-separate SQL statements passed into its 2nd argument,\r\n** in the context of the [database connection] passed in as its 1st\r\n** argument.  ^If the callback function of the 3rd argument to\r\n** sqlite3_exec() is not NULL, then it is invoked for each result row\r\n** coming out of the evaluated SQL statements.  ^The 4th argument to\r\n** sqlite3_exec() is relayed through to the 1st argument of each\r\n** callback invocation.  ^If the callback pointer to sqlite3_exec()\r\n** is NULL, then no callback is ever invoked and result rows are\r\n** ignored.\r\n**\r\n** ^If an error occurs while evaluating the SQL statements passed into\r\n** sqlite3_exec(), then execution of the current statement stops and\r\n** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()\r\n** is not NULL then any error message is written into memory obtained\r\n** from [sqlite3_malloc()] and passed back through the 5th parameter.\r\n** To avoid memory leaks, the application should invoke [sqlite3_free()]\r\n** on error message strings returned through the 5th parameter of\r\n** of sqlite3_exec() after the error message string is no longer needed.\r\n** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors\r\n** occur, then sqlite3_exec() sets the pointer in its 5th parameter to\r\n** NULL before returning.\r\n**\r\n** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()\r\n** routine returns SQLITE_ABORT without invoking the callback again and\r\n** without running any subsequent SQL statements.\r\n**\r\n** ^The 2nd argument to the sqlite3_exec() callback function is the\r\n** number of columns in the result.  ^The 3rd argument to the sqlite3_exec()\r\n** callback is an array of pointers to strings obtained as if from\r\n** [sqlite3_column_text()], one for each column.  ^If an element of a\r\n** result row is NULL then the corresponding string pointer for the\r\n** sqlite3_exec() callback is a NULL pointer.  ^The 4th argument to the\r\n** sqlite3_exec() callback is an array of pointers to strings where each\r\n** entry represents the name of corresponding result column as obtained\r\n** from [sqlite3_column_name()].\r\n**\r\n** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer\r\n** to an empty string, or a pointer that contains only whitespace and/or \r\n** SQL comments, then no SQL statements are evaluated and the database\r\n** is not changed.\r\n**\r\n** Restrictions:\r\n**\r\n** <ul>\r\n** <li> The application must insure that the 1st parameter to sqlite3_exec()\r\n**      is a valid and open [database connection].\r\n** <li> The application must not close [database connection] specified by\r\n**      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.\r\n** <li> The application must not modify the SQL statement text passed into\r\n**      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.\r\n** </ul>\r\n*/\r\nSQLITE_API int sqlite3_exec(\r\n  sqlite3*,                                  /* An open database */\r\n  const char *sql,                           /* SQL to be evaluated */\r\n  int (*callback)(void*,int,char**,char**),  /* Callback function */\r\n  void *,                                    /* 1st argument to callback */\r\n  char **errmsg                              /* Error msg written here */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Result Codes\r\n** KEYWORDS: SQLITE_OK {error code} {error codes}\r\n** KEYWORDS: {result code} {result codes}\r\n**\r\n** Many SQLite functions return an integer result code from the set shown\r\n** here in order to indicate success or failure.\r\n**\r\n** New error codes may be added in future versions of SQLite.\r\n**\r\n** See also: [SQLITE_IOERR_READ | extended result codes],\r\n** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes].\r\n*/\r\n#define SQLITE_OK           0   /* Successful result */\r\n/* beginning-of-error-codes */\r\n#define SQLITE_ERROR        1   /* SQL error or missing database */\r\n#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */\r\n#define SQLITE_PERM         3   /* Access permission denied */\r\n#define SQLITE_ABORT        4   /* Callback routine requested an abort */\r\n#define SQLITE_BUSY         5   /* The database file is locked */\r\n#define SQLITE_LOCKED       6   /* A table in the database is locked */\r\n#define SQLITE_NOMEM        7   /* A malloc() failed */\r\n#define SQLITE_READONLY     8   /* Attempt to write a readonly database */\r\n#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/\r\n#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */\r\n#define SQLITE_CORRUPT     11   /* The database disk image is malformed */\r\n#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */\r\n#define SQLITE_FULL        13   /* Insertion failed because database is full */\r\n#define SQLITE_CANTOPEN    14   /* Unable to open the database file */\r\n#define SQLITE_PROTOCOL    15   /* Database lock protocol error */\r\n#define SQLITE_EMPTY       16   /* Database is empty */\r\n#define SQLITE_SCHEMA      17   /* The database schema changed */\r\n#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */\r\n#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */\r\n#define SQLITE_MISMATCH    20   /* Data type mismatch */\r\n#define SQLITE_MISUSE      21   /* Library used incorrectly */\r\n#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */\r\n#define SQLITE_AUTH        23   /* Authorization denied */\r\n#define SQLITE_FORMAT      24   /* Auxiliary database format error */\r\n#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */\r\n#define SQLITE_NOTADB      26   /* File opened that is not a database file */\r\n#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */\r\n#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */\r\n/* end-of-error-codes */\r\n\r\n/*\r\n** CAPI3REF: Extended Result Codes\r\n** KEYWORDS: {extended error code} {extended error codes}\r\n** KEYWORDS: {extended result code} {extended result codes}\r\n**\r\n** In its default configuration, SQLite API routines return one of 26 integer\r\n** [SQLITE_OK | result codes].  However, experience has shown that many of\r\n** these result codes are too coarse-grained.  They do not provide as\r\n** much information about problems as programmers might like.  In an effort to\r\n** address this, newer versions of SQLite (version 3.3.8 and later) include\r\n** support for additional result codes that provide more detailed information\r\n** about errors. The extended result codes are enabled or disabled\r\n** on a per database connection basis using the\r\n** [sqlite3_extended_result_codes()] API.\r\n**\r\n** Some of the available extended result codes are listed here.\r\n** One may expect the number of extended result codes will be expand\r\n** over time.  Software that uses extended result codes should expect\r\n** to see new result codes in future releases of SQLite.\r\n**\r\n** The SQLITE_OK result code will never be extended.  It will always\r\n** be exactly zero.\r\n*/\r\n#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))\r\n#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))\r\n#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))\r\n#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))\r\n#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))\r\n#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))\r\n#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))\r\n#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))\r\n#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))\r\n#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))\r\n#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))\r\n#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))\r\n#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))\r\n#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))\r\n#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))\r\n#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))\r\n#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))\r\n#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))\r\n#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))\r\n#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))\r\n#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))\r\n#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))\r\n#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))\r\n#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))\r\n#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))\r\n#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))\r\n#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))\r\n#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))\r\n#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))\r\n\r\n/*\r\n** CAPI3REF: Flags For File Open Operations\r\n**\r\n** These bit values are intended for use in the\r\n** 3rd parameter to the [sqlite3_open_v2()] interface and\r\n** in the 4th parameter to the [sqlite3_vfs.xOpen] method.\r\n*/\r\n#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */\r\n#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */\r\n#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */\r\n#define SQLITE_OPEN_URI              0x00000040  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */\r\n#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */\r\n#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */\r\n#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */\r\n#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */\r\n#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */\r\n#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */\r\n#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */\r\n\r\n/* Reserved:                         0x00F00000 */\r\n\r\n/*\r\n** CAPI3REF: Device Characteristics\r\n**\r\n** The xDeviceCharacteristics method of the [sqlite3_io_methods]\r\n** object returns an integer which is a vector of the these\r\n** bit values expressing I/O characteristics of the mass storage\r\n** device that holds the file that the [sqlite3_io_methods]\r\n** refers to.\r\n**\r\n** The SQLITE_IOCAP_ATOMIC property means that all writes of\r\n** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values\r\n** mean that writes of blocks that are nnn bytes in size and\r\n** are aligned to an address which is an integer multiple of\r\n** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means\r\n** that when data is appended to a file, the data is appended\r\n** first then the size of the file is extended, never the other\r\n** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that\r\n** information is written to disk in the same order as calls\r\n** to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that\r\n** after reboot following a crash or power loss, the only bytes in a\r\n** file that were written at the application level might have changed\r\n** and that adjacent bytes, even bytes within the same sector are\r\n** guaranteed to be unchanged.\r\n*/\r\n#define SQLITE_IOCAP_ATOMIC                 0x00000001\r\n#define SQLITE_IOCAP_ATOMIC512              0x00000002\r\n#define SQLITE_IOCAP_ATOMIC1K               0x00000004\r\n#define SQLITE_IOCAP_ATOMIC2K               0x00000008\r\n#define SQLITE_IOCAP_ATOMIC4K               0x00000010\r\n#define SQLITE_IOCAP_ATOMIC8K               0x00000020\r\n#define SQLITE_IOCAP_ATOMIC16K              0x00000040\r\n#define SQLITE_IOCAP_ATOMIC32K              0x00000080\r\n#define SQLITE_IOCAP_ATOMIC64K              0x00000100\r\n#define SQLITE_IOCAP_SAFE_APPEND            0x00000200\r\n#define SQLITE_IOCAP_SEQUENTIAL             0x00000400\r\n#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800\r\n#define SQLITE_IOCAP_POWERSAFE_OVERWRITE    0x00001000\r\n\r\n/*\r\n** CAPI3REF: File Locking Levels\r\n**\r\n** SQLite uses one of these integer values as the second\r\n** argument to calls it makes to the xLock() and xUnlock() methods\r\n** of an [sqlite3_io_methods] object.\r\n*/\r\n#define SQLITE_LOCK_NONE          0\r\n#define SQLITE_LOCK_SHARED        1\r\n#define SQLITE_LOCK_RESERVED      2\r\n#define SQLITE_LOCK_PENDING       3\r\n#define SQLITE_LOCK_EXCLUSIVE     4\r\n\r\n/*\r\n** CAPI3REF: Synchronization Type Flags\r\n**\r\n** When SQLite invokes the xSync() method of an\r\n** [sqlite3_io_methods] object it uses a combination of\r\n** these integer values as the second argument.\r\n**\r\n** When the SQLITE_SYNC_DATAONLY flag is used, it means that the\r\n** sync operation only needs to flush data to mass storage.  Inode\r\n** information need not be flushed. If the lower four bits of the flag\r\n** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.\r\n** If the lower four bits equal SQLITE_SYNC_FULL, that means\r\n** to use Mac OS X style fullsync instead of fsync().\r\n**\r\n** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags\r\n** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL\r\n** settings.  The [synchronous pragma] determines when calls to the\r\n** xSync VFS method occur and applies uniformly across all platforms.\r\n** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how\r\n** energetic or rigorous or forceful the sync operations are and\r\n** only make a difference on Mac OSX for the default SQLite code.\r\n** (Third-party VFS implementations might also make the distinction\r\n** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the\r\n** operating systems natively supported by SQLite, only Mac OSX\r\n** cares about the difference.)\r\n*/\r\n#define SQLITE_SYNC_NORMAL        0x00002\r\n#define SQLITE_SYNC_FULL          0x00003\r\n#define SQLITE_SYNC_DATAONLY      0x00010\r\n\r\n/*\r\n** CAPI3REF: OS Interface Open File Handle\r\n**\r\n** An [sqlite3_file] object represents an open file in the \r\n** [sqlite3_vfs | OS interface layer].  Individual OS interface\r\n** implementations will\r\n** want to subclass this object by appending additional fields\r\n** for their own use.  The pMethods entry is a pointer to an\r\n** [sqlite3_io_methods] object that defines methods for performing\r\n** I/O operations on the open file.\r\n*/\r\ntypedef struct sqlite3_file sqlite3_file;\r\nstruct sqlite3_file {\r\n  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */\r\n};\r\n\r\n/*\r\n** CAPI3REF: OS Interface File Virtual Methods Object\r\n**\r\n** Every file opened by the [sqlite3_vfs.xOpen] method populates an\r\n** [sqlite3_file] object (or, more commonly, a subclass of the\r\n** [sqlite3_file] object) with a pointer to an instance of this object.\r\n** This object defines the methods used to perform various operations\r\n** against the open file represented by the [sqlite3_file] object.\r\n**\r\n** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element \r\n** to a non-NULL pointer, then the sqlite3_io_methods.xClose method\r\n** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The\r\n** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]\r\n** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element\r\n** to NULL.\r\n**\r\n** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or\r\n** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().\r\n** The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]\r\n** flag may be ORed in to indicate that only the data of the file\r\n** and not its inode needs to be synced.\r\n**\r\n** The integer values to xLock() and xUnlock() are one of\r\n** <ul>\r\n** <li> [SQLITE_LOCK_NONE],\r\n** <li> [SQLITE_LOCK_SHARED],\r\n** <li> [SQLITE_LOCK_RESERVED],\r\n** <li> [SQLITE_LOCK_PENDING], or\r\n** <li> [SQLITE_LOCK_EXCLUSIVE].\r\n** </ul>\r\n** xLock() increases the lock. xUnlock() decreases the lock.\r\n** The xCheckReservedLock() method checks whether any database connection,\r\n** either in this process or in some other process, is holding a RESERVED,\r\n** PENDING, or EXCLUSIVE lock on the file.  It returns true\r\n** if such a lock exists and false otherwise.\r\n**\r\n** The xFileControl() method is a generic interface that allows custom\r\n** VFS implementations to directly control an open file using the\r\n** [sqlite3_file_control()] interface.  The second \"op\" argument is an\r\n** integer opcode.  The third argument is a generic pointer intended to\r\n** point to a structure that may contain arguments or space in which to\r\n** write return values.  Potential uses for xFileControl() might be\r\n** functions to enable blocking locks with timeouts, to change the\r\n** locking strategy (for example to use dot-file locks), to inquire\r\n** about the status of a lock, or to break stale locks.  The SQLite\r\n** core reserves all opcodes less than 100 for its own use.\r\n** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.\r\n** Applications that define a custom xFileControl method should use opcodes\r\n** greater than 100 to avoid conflicts.  VFS implementations should\r\n** return [SQLITE_NOTFOUND] for file control opcodes that they do not\r\n** recognize.\r\n**\r\n** The xSectorSize() method returns the sector size of the\r\n** device that underlies the file.  The sector size is the\r\n** minimum write that can be performed without disturbing\r\n** other bytes in the file.  The xDeviceCharacteristics()\r\n** method returns a bit vector describing behaviors of the\r\n** underlying device:\r\n**\r\n** <ul>\r\n** <li> [SQLITE_IOCAP_ATOMIC]\r\n** <li> [SQLITE_IOCAP_ATOMIC512]\r\n** <li> [SQLITE_IOCAP_ATOMIC1K]\r\n** <li> [SQLITE_IOCAP_ATOMIC2K]\r\n** <li> [SQLITE_IOCAP_ATOMIC4K]\r\n** <li> [SQLITE_IOCAP_ATOMIC8K]\r\n** <li> [SQLITE_IOCAP_ATOMIC16K]\r\n** <li> [SQLITE_IOCAP_ATOMIC32K]\r\n** <li> [SQLITE_IOCAP_ATOMIC64K]\r\n** <li> [SQLITE_IOCAP_SAFE_APPEND]\r\n** <li> [SQLITE_IOCAP_SEQUENTIAL]\r\n** </ul>\r\n**\r\n** The SQLITE_IOCAP_ATOMIC property means that all writes of\r\n** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values\r\n** mean that writes of blocks that are nnn bytes in size and\r\n** are aligned to an address which is an integer multiple of\r\n** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means\r\n** that when data is appended to a file, the data is appended\r\n** first then the size of the file is extended, never the other\r\n** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that\r\n** information is written to disk in the same order as calls\r\n** to xWrite().\r\n**\r\n** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill\r\n** in the unread portions of the buffer with zeros.  A VFS that\r\n** fails to zero-fill short reads might seem to work.  However,\r\n** failure to zero-fill short reads will eventually lead to\r\n** database corruption.\r\n*/\r\ntypedef struct sqlite3_io_methods sqlite3_io_methods;\r\nstruct sqlite3_io_methods {\r\n  int iVersion;\r\n  int (*xClose)(sqlite3_file*);\r\n  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);\r\n  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);\r\n  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);\r\n  int (*xSync)(sqlite3_file*, int flags);\r\n  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);\r\n  int (*xLock)(sqlite3_file*, int);\r\n  int (*xUnlock)(sqlite3_file*, int);\r\n  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);\r\n  int (*xFileControl)(sqlite3_file*, int op, void *pArg);\r\n  int (*xSectorSize)(sqlite3_file*);\r\n  int (*xDeviceCharacteristics)(sqlite3_file*);\r\n  /* Methods above are valid for version 1 */\r\n  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);\r\n  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);\r\n  void (*xShmBarrier)(sqlite3_file*);\r\n  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);\r\n  /* Methods above are valid for version 2 */\r\n  /* Additional methods may be added in future releases */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Standard File Control Opcodes\r\n**\r\n** These integer constants are opcodes for the xFileControl method\r\n** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]\r\n** interface.\r\n**\r\n** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This\r\n** opcode causes the xFileControl method to write the current state of\r\n** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],\r\n** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])\r\n** into an integer that the pArg argument points to. This capability\r\n** is used during testing and only needs to be supported when SQLITE_TEST\r\n** is defined.\r\n** <ul>\r\n** <li>[[SQLITE_FCNTL_SIZE_HINT]]\r\n** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS\r\n** layer a hint of how large the database file will grow to be during the\r\n** current transaction.  This hint is not guaranteed to be accurate but it\r\n** is often close.  The underlying VFS might choose to preallocate database\r\n** file space based on this hint in order to help writes to the database\r\n** file run faster.\r\n**\r\n** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]\r\n** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS\r\n** extends and truncates the database file in chunks of a size specified\r\n** by the user. The fourth argument to [sqlite3_file_control()] should \r\n** point to an integer (type int) containing the new chunk-size to use\r\n** for the nominated database. Allocating database file space in large\r\n** chunks (say 1MB at a time), may reduce file-system fragmentation and\r\n** improve performance on some systems.\r\n**\r\n** <li>[[SQLITE_FCNTL_FILE_POINTER]]\r\n** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer\r\n** to the [sqlite3_file] object associated with a particular database\r\n** connection.  See the [sqlite3_file_control()] documentation for\r\n** additional information.\r\n**\r\n** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]\r\n** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by\r\n** SQLite and sent to all VFSes in place of a call to the xSync method\r\n** when the database connection has [PRAGMA synchronous] set to OFF.)^\r\n** Some specialized VFSes need this signal in order to operate correctly\r\n** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most \r\n** VFSes do not need this signal and should silently ignore this opcode.\r\n** Applications should not call [sqlite3_file_control()] with this\r\n** opcode as doing so may disrupt the operation of the specialized VFSes\r\n** that do require it.  \r\n**\r\n** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]\r\n** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic\r\n** retry counts and intervals for certain disk I/O operations for the\r\n** windows [VFS] in order to provide robustness in the presence of\r\n** anti-virus programs.  By default, the windows VFS will retry file read,\r\n** file write, and file delete operations up to 10 times, with a delay\r\n** of 25 milliseconds before the first retry and with the delay increasing\r\n** by an additional 25 milliseconds with each subsequent retry.  This\r\n** opcode allows these two values (10 retries and 25 milliseconds of delay)\r\n** to be adjusted.  The values are changed for all database connections\r\n** within the same process.  The argument is a pointer to an array of two\r\n** integers where the first integer i the new retry count and the second\r\n** integer is the delay.  If either integer is negative, then the setting\r\n** is not changed but instead the prior value of that setting is written\r\n** into the array entry, allowing the current retry settings to be\r\n** interrogated.  The zDbName parameter is ignored.\r\n**\r\n** <li>[[SQLITE_FCNTL_PERSIST_WAL]]\r\n** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the\r\n** persistent [WAL | Write AHead Log] setting.  By default, the auxiliary\r\n** write ahead log and shared memory files used for transaction control\r\n** are automatically deleted when the latest connection to the database\r\n** closes.  Setting persistent WAL mode causes those files to persist after\r\n** close.  Persisting the files is useful when other processes that do not\r\n** have write permission on the directory containing the database file want\r\n** to read the database file, as the WAL and shared memory files must exist\r\n** in order for the database to be readable.  The fourth parameter to\r\n** [sqlite3_file_control()] for this opcode should be a pointer to an integer.\r\n** That integer is 0 to disable persistent WAL mode or 1 to enable persistent\r\n** WAL mode.  If the integer is -1, then it is overwritten with the current\r\n** WAL persistence setting.\r\n**\r\n** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]\r\n** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the\r\n** persistent \"powersafe-overwrite\" or \"PSOW\" setting.  The PSOW setting\r\n** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the\r\n** xDeviceCharacteristics methods. The fourth parameter to\r\n** [sqlite3_file_control()] for this opcode should be a pointer to an integer.\r\n** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage\r\n** mode.  If the integer is -1, then it is overwritten with the current\r\n** zero-damage mode setting.\r\n**\r\n** <li>[[SQLITE_FCNTL_OVERWRITE]]\r\n** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening\r\n** a write transaction to indicate that, unless it is rolled back for some\r\n** reason, the entire database file will be overwritten by the current \r\n** transaction. This is used by VACUUM operations.\r\n**\r\n** <li>[[SQLITE_FCNTL_VFSNAME]]\r\n** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of\r\n** all [VFSes] in the VFS stack.  The names are of all VFS shims and the\r\n** final bottom-level VFS are written into memory obtained from \r\n** [sqlite3_malloc()] and the result is stored in the char* variable\r\n** that the fourth parameter of [sqlite3_file_control()] points to.\r\n** The caller is responsible for freeing the memory when done.  As with\r\n** all file-control actions, there is no guarantee that this will actually\r\n** do anything.  Callers should initialize the char* variable to a NULL\r\n** pointer in case this file-control is not implemented.  This file-control\r\n** is intended for diagnostic use only.\r\n**\r\n** <li>[[SQLITE_FCNTL_PRAGMA]]\r\n** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] \r\n** file control is sent to the open [sqlite3_file] object corresponding\r\n** to the database file to which the pragma statement refers. ^The argument\r\n** to the [SQLITE_FCNTL_PRAGMA] file control is an array of\r\n** pointers to strings (char**) in which the second element of the array\r\n** is the name of the pragma and the third element is the argument to the\r\n** pragma or NULL if the pragma has no argument.  ^The handler for an\r\n** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element\r\n** of the char** argument point to a string obtained from [sqlite3_mprintf()]\r\n** or the equivalent and that string will become the result of the pragma or\r\n** the error message if the pragma fails. ^If the\r\n** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal \r\n** [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]\r\n** file control returns [SQLITE_OK], then the parser assumes that the\r\n** VFS has handled the PRAGMA itself and the parser generates a no-op\r\n** prepared statement.  ^If the [SQLITE_FCNTL_PRAGMA] file control returns\r\n** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means\r\n** that the VFS encountered an error while handling the [PRAGMA] and the\r\n** compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]\r\n** file control occurs at the beginning of pragma statement analysis and so\r\n** it is able to override built-in [PRAGMA] statements.\r\n** </ul>\r\n*/\r\n#define SQLITE_FCNTL_LOCKSTATE               1\r\n#define SQLITE_GET_LOCKPROXYFILE             2\r\n#define SQLITE_SET_LOCKPROXYFILE             3\r\n#define SQLITE_LAST_ERRNO                    4\r\n#define SQLITE_FCNTL_SIZE_HINT               5\r\n#define SQLITE_FCNTL_CHUNK_SIZE              6\r\n#define SQLITE_FCNTL_FILE_POINTER            7\r\n#define SQLITE_FCNTL_SYNC_OMITTED            8\r\n#define SQLITE_FCNTL_WIN32_AV_RETRY          9\r\n#define SQLITE_FCNTL_PERSIST_WAL            10\r\n#define SQLITE_FCNTL_OVERWRITE              11\r\n#define SQLITE_FCNTL_VFSNAME                12\r\n#define SQLITE_FCNTL_POWERSAFE_OVERWRITE    13\r\n#define SQLITE_FCNTL_PRAGMA                 14\r\n\r\n/*\r\n** CAPI3REF: Mutex Handle\r\n**\r\n** The mutex module within SQLite defines [sqlite3_mutex] to be an\r\n** abstract type for a mutex object.  The SQLite core never looks\r\n** at the internal representation of an [sqlite3_mutex].  It only\r\n** deals with pointers to the [sqlite3_mutex] object.\r\n**\r\n** Mutexes are created using [sqlite3_mutex_alloc()].\r\n*/\r\ntypedef struct sqlite3_mutex sqlite3_mutex;\r\n\r\n/*\r\n** CAPI3REF: OS Interface Object\r\n**\r\n** An instance of the sqlite3_vfs object defines the interface between\r\n** the SQLite core and the underlying operating system.  The \"vfs\"\r\n** in the name of the object stands for \"virtual file system\".  See\r\n** the [VFS | VFS documentation] for further information.\r\n**\r\n** The value of the iVersion field is initially 1 but may be larger in\r\n** future versions of SQLite.  Additional fields may be appended to this\r\n** object when the iVersion value is increased.  Note that the structure\r\n** of the sqlite3_vfs object changes in the transaction between\r\n** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not\r\n** modified.\r\n**\r\n** The szOsFile field is the size of the subclassed [sqlite3_file]\r\n** structure used by this VFS.  mxPathname is the maximum length of\r\n** a pathname in this VFS.\r\n**\r\n** Registered sqlite3_vfs objects are kept on a linked list formed by\r\n** the pNext pointer.  The [sqlite3_vfs_register()]\r\n** and [sqlite3_vfs_unregister()] interfaces manage this list\r\n** in a thread-safe way.  The [sqlite3_vfs_find()] interface\r\n** searches the list.  Neither the application code nor the VFS\r\n** implementation should use the pNext pointer.\r\n**\r\n** The pNext field is the only field in the sqlite3_vfs\r\n** structure that SQLite will ever modify.  SQLite will only access\r\n** or modify this field while holding a particular static mutex.\r\n** The application should never modify anything within the sqlite3_vfs\r\n** object once the object has been registered.\r\n**\r\n** The zName field holds the name of the VFS module.  The name must\r\n** be unique across all VFS modules.\r\n**\r\n** [[sqlite3_vfs.xOpen]]\r\n** ^SQLite guarantees that the zFilename parameter to xOpen\r\n** is either a NULL pointer or string obtained\r\n** from xFullPathname() with an optional suffix added.\r\n** ^If a suffix is added to the zFilename parameter, it will\r\n** consist of a single \"-\" character followed by no more than\r\n** 11 alphanumeric and/or \"-\" characters.\r\n** ^SQLite further guarantees that\r\n** the string will be valid and unchanged until xClose() is\r\n** called. Because of the previous sentence,\r\n** the [sqlite3_file] can safely store a pointer to the\r\n** filename if it needs to remember the filename for some reason.\r\n** If the zFilename parameter to xOpen is a NULL pointer then xOpen\r\n** must invent its own temporary name for the file.  ^Whenever the \r\n** xFilename parameter is NULL it will also be the case that the\r\n** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].\r\n**\r\n** The flags argument to xOpen() includes all bits set in\r\n** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]\r\n** or [sqlite3_open16()] is used, then flags includes at least\r\n** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. \r\n** If xOpen() opens a file read-only then it sets *pOutFlags to\r\n** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.\r\n**\r\n** ^(SQLite will also add one of the following flags to the xOpen()\r\n** call, depending on the object being opened:\r\n**\r\n** <ul>\r\n** <li>  [SQLITE_OPEN_MAIN_DB]\r\n** <li>  [SQLITE_OPEN_MAIN_JOURNAL]\r\n** <li>  [SQLITE_OPEN_TEMP_DB]\r\n** <li>  [SQLITE_OPEN_TEMP_JOURNAL]\r\n** <li>  [SQLITE_OPEN_TRANSIENT_DB]\r\n** <li>  [SQLITE_OPEN_SUBJOURNAL]\r\n** <li>  [SQLITE_OPEN_MASTER_JOURNAL]\r\n** <li>  [SQLITE_OPEN_WAL]\r\n** </ul>)^\r\n**\r\n** The file I/O implementation can use the object type flags to\r\n** change the way it deals with files.  For example, an application\r\n** that does not care about crash recovery or rollback might make\r\n** the open of a journal file a no-op.  Writes to this journal would\r\n** also be no-ops, and any attempt to read the journal would return\r\n** SQLITE_IOERR.  Or the implementation might recognize that a database\r\n** file will be doing page-aligned sector reads and writes in a random\r\n** order and set up its I/O subsystem accordingly.\r\n**\r\n** SQLite might also add one of the following flags to the xOpen method:\r\n**\r\n** <ul>\r\n** <li> [SQLITE_OPEN_DELETEONCLOSE]\r\n** <li> [SQLITE_OPEN_EXCLUSIVE]\r\n** </ul>\r\n**\r\n** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be\r\n** deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]\r\n** will be set for TEMP databases and their journals, transient\r\n** databases, and subjournals.\r\n**\r\n** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction\r\n** with the [SQLITE_OPEN_CREATE] flag, which are both directly\r\n** analogous to the O_EXCL and O_CREAT flags of the POSIX open()\r\n** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the \r\n** SQLITE_OPEN_CREATE, is used to indicate that file should always\r\n** be created, and that it is an error if it already exists.\r\n** It is <i>not</i> used to indicate the file should be opened \r\n** for exclusive access.\r\n**\r\n** ^At least szOsFile bytes of memory are allocated by SQLite\r\n** to hold the  [sqlite3_file] structure passed as the third\r\n** argument to xOpen.  The xOpen method does not have to\r\n** allocate the structure; it should just fill it in.  Note that\r\n** the xOpen method must set the sqlite3_file.pMethods to either\r\n** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do\r\n** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods\r\n** element will be valid after xOpen returns regardless of the success\r\n** or failure of the xOpen call.\r\n**\r\n** [[sqlite3_vfs.xAccess]]\r\n** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]\r\n** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to\r\n** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]\r\n** to test whether a file is at least readable.   The file can be a\r\n** directory.\r\n**\r\n** ^SQLite will always allocate at least mxPathname+1 bytes for the\r\n** output buffer xFullPathname.  The exact size of the output buffer\r\n** is also passed as a parameter to both  methods. If the output buffer\r\n** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is\r\n** handled as a fatal error by SQLite, vfs implementations should endeavor\r\n** to prevent this by setting mxPathname to a sufficiently large value.\r\n**\r\n** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()\r\n** interfaces are not strictly a part of the filesystem, but they are\r\n** included in the VFS structure for completeness.\r\n** The xRandomness() function attempts to return nBytes bytes\r\n** of good-quality randomness into zOut.  The return value is\r\n** the actual number of bytes of randomness obtained.\r\n** The xSleep() method causes the calling thread to sleep for at\r\n** least the number of microseconds given.  ^The xCurrentTime()\r\n** method returns a Julian Day Number for the current date and time as\r\n** a floating point value.\r\n** ^The xCurrentTimeInt64() method returns, as an integer, the Julian\r\n** Day Number multiplied by 86400000 (the number of milliseconds in \r\n** a 24-hour day).  \r\n** ^SQLite will use the xCurrentTimeInt64() method to get the current\r\n** date and time if that method is available (if iVersion is 2 or \r\n** greater and the function pointer is not NULL) and will fall back\r\n** to xCurrentTime() if xCurrentTimeInt64() is unavailable.\r\n**\r\n** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces\r\n** are not used by the SQLite core.  These optional interfaces are provided\r\n** by some VFSes to facilitate testing of the VFS code. By overriding \r\n** system calls with functions under its control, a test program can\r\n** simulate faults and error conditions that would otherwise be difficult\r\n** or impossible to induce.  The set of system calls that can be overridden\r\n** varies from one VFS to another, and from one version of the same VFS to the\r\n** next.  Applications that use these interfaces must be prepared for any\r\n** or all of these interfaces to be NULL or for their behavior to change\r\n** from one release to the next.  Applications must not attempt to access\r\n** any of these methods if the iVersion of the VFS is less than 3.\r\n*/\r\ntypedef struct sqlite3_vfs sqlite3_vfs;\r\ntypedef void (*sqlite3_syscall_ptr)(void);\r\nstruct sqlite3_vfs {\r\n  int iVersion;            /* Structure version number (currently 3) */\r\n  int szOsFile;            /* Size of subclassed sqlite3_file */\r\n  int mxPathname;          /* Maximum file pathname length */\r\n  sqlite3_vfs *pNext;      /* Next registered VFS */\r\n  const char *zName;       /* Name of this virtual file system */\r\n  void *pAppData;          /* Pointer to application-specific data */\r\n  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,\r\n               int flags, int *pOutFlags);\r\n  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);\r\n  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);\r\n  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);\r\n  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);\r\n  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);\r\n  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);\r\n  void (*xDlClose)(sqlite3_vfs*, void*);\r\n  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);\r\n  int (*xSleep)(sqlite3_vfs*, int microseconds);\r\n  int (*xCurrentTime)(sqlite3_vfs*, double*);\r\n  int (*xGetLastError)(sqlite3_vfs*, int, char *);\r\n  /*\r\n  ** The methods above are in version 1 of the sqlite_vfs object\r\n  ** definition.  Those that follow are added in version 2 or later\r\n  */\r\n  int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);\r\n  /*\r\n  ** The methods above are in versions 1 and 2 of the sqlite_vfs object.\r\n  ** Those below are for version 3 and greater.\r\n  */\r\n  int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);\r\n  sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);\r\n  const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);\r\n  /*\r\n  ** The methods above are in versions 1 through 3 of the sqlite_vfs object.\r\n  ** New fields may be appended in figure versions.  The iVersion\r\n  ** value will increment whenever this happens. \r\n  */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Flags for the xAccess VFS method\r\n**\r\n** These integer constants can be used as the third parameter to\r\n** the xAccess method of an [sqlite3_vfs] object.  They determine\r\n** what kind of permissions the xAccess method is looking for.\r\n** With SQLITE_ACCESS_EXISTS, the xAccess method\r\n** simply checks whether the file exists.\r\n** With SQLITE_ACCESS_READWRITE, the xAccess method\r\n** checks whether the named directory is both readable and writable\r\n** (in other words, if files can be added, removed, and renamed within\r\n** the directory).\r\n** The SQLITE_ACCESS_READWRITE constant is currently used only by the\r\n** [temp_store_directory pragma], though this could change in a future\r\n** release of SQLite.\r\n** With SQLITE_ACCESS_READ, the xAccess method\r\n** checks whether the file is readable.  The SQLITE_ACCESS_READ constant is\r\n** currently unused, though it might be used in a future release of\r\n** SQLite.\r\n*/\r\n#define SQLITE_ACCESS_EXISTS    0\r\n#define SQLITE_ACCESS_READWRITE 1   /* Used by PRAGMA temp_store_directory */\r\n#define SQLITE_ACCESS_READ      2   /* Unused */\r\n\r\n/*\r\n** CAPI3REF: Flags for the xShmLock VFS method\r\n**\r\n** These integer constants define the various locking operations\r\n** allowed by the xShmLock method of [sqlite3_io_methods].  The\r\n** following are the only legal combinations of flags to the\r\n** xShmLock method:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_SHARED\r\n** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE\r\n** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED\r\n** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE\r\n** </ul>\r\n**\r\n** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as\r\n** was given no the corresponding lock.  \r\n**\r\n** The xShmLock method can transition between unlocked and SHARED or\r\n** between unlocked and EXCLUSIVE.  It cannot transition between SHARED\r\n** and EXCLUSIVE.\r\n*/\r\n#define SQLITE_SHM_UNLOCK       1\r\n#define SQLITE_SHM_LOCK         2\r\n#define SQLITE_SHM_SHARED       4\r\n#define SQLITE_SHM_EXCLUSIVE    8\r\n\r\n/*\r\n** CAPI3REF: Maximum xShmLock index\r\n**\r\n** The xShmLock method on [sqlite3_io_methods] may use values\r\n** between 0 and this upper bound as its \"offset\" argument.\r\n** The SQLite core will never attempt to acquire or release a\r\n** lock outside of this range\r\n*/\r\n#define SQLITE_SHM_NLOCK        8\r\n\r\n\r\n/*\r\n** CAPI3REF: Initialize The SQLite Library\r\n**\r\n** ^The sqlite3_initialize() routine initializes the\r\n** SQLite library.  ^The sqlite3_shutdown() routine\r\n** deallocates any resources that were allocated by sqlite3_initialize().\r\n** These routines are designed to aid in process initialization and\r\n** shutdown on embedded systems.  Workstation applications using\r\n** SQLite normally do not need to invoke either of these routines.\r\n**\r\n** A call to sqlite3_initialize() is an \"effective\" call if it is\r\n** the first time sqlite3_initialize() is invoked during the lifetime of\r\n** the process, or if it is the first time sqlite3_initialize() is invoked\r\n** following a call to sqlite3_shutdown().  ^(Only an effective call\r\n** of sqlite3_initialize() does any initialization.  All other calls\r\n** are harmless no-ops.)^\r\n**\r\n** A call to sqlite3_shutdown() is an \"effective\" call if it is the first\r\n** call to sqlite3_shutdown() since the last sqlite3_initialize().  ^(Only\r\n** an effective call to sqlite3_shutdown() does any deinitialization.\r\n** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^\r\n**\r\n** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()\r\n** is not.  The sqlite3_shutdown() interface must only be called from a\r\n** single thread.  All open [database connections] must be closed and all\r\n** other SQLite resources must be deallocated prior to invoking\r\n** sqlite3_shutdown().\r\n**\r\n** Among other things, ^sqlite3_initialize() will invoke\r\n** sqlite3_os_init().  Similarly, ^sqlite3_shutdown()\r\n** will invoke sqlite3_os_end().\r\n**\r\n** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.\r\n** ^If for some reason, sqlite3_initialize() is unable to initialize\r\n** the library (perhaps it is unable to allocate a needed resource such\r\n** as a mutex) it returns an [error code] other than [SQLITE_OK].\r\n**\r\n** ^The sqlite3_initialize() routine is called internally by many other\r\n** SQLite interfaces so that an application usually does not need to\r\n** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]\r\n** calls sqlite3_initialize() so the SQLite library will be automatically\r\n** initialized when [sqlite3_open()] is called if it has not be initialized\r\n** already.  ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]\r\n** compile-time option, then the automatic calls to sqlite3_initialize()\r\n** are omitted and the application must call sqlite3_initialize() directly\r\n** prior to using any other SQLite interface.  For maximum portability,\r\n** it is recommended that applications always invoke sqlite3_initialize()\r\n** directly prior to using any other SQLite interface.  Future releases\r\n** of SQLite may require this.  In other words, the behavior exhibited\r\n** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the\r\n** default behavior in some future release of SQLite.\r\n**\r\n** The sqlite3_os_init() routine does operating-system specific\r\n** initialization of the SQLite library.  The sqlite3_os_end()\r\n** routine undoes the effect of sqlite3_os_init().  Typical tasks\r\n** performed by these routines include allocation or deallocation\r\n** of static resources, initialization of global variables,\r\n** setting up a default [sqlite3_vfs] module, or setting up\r\n** a default configuration using [sqlite3_config()].\r\n**\r\n** The application should never invoke either sqlite3_os_init()\r\n** or sqlite3_os_end() directly.  The application should only invoke\r\n** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()\r\n** interface is called automatically by sqlite3_initialize() and\r\n** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate\r\n** implementations for sqlite3_os_init() and sqlite3_os_end()\r\n** are built into SQLite when it is compiled for Unix, Windows, or OS/2.\r\n** When [custom builds | built for other platforms]\r\n** (using the [SQLITE_OS_OTHER=1] compile-time\r\n** option) the application must supply a suitable implementation for\r\n** sqlite3_os_init() and sqlite3_os_end().  An application-supplied\r\n** implementation of sqlite3_os_init() or sqlite3_os_end()\r\n** must return [SQLITE_OK] on success and some other [error code] upon\r\n** failure.\r\n*/\r\nSQLITE_API int sqlite3_initialize(void);\r\nSQLITE_API int sqlite3_shutdown(void);\r\nSQLITE_API int sqlite3_os_init(void);\r\nSQLITE_API int sqlite3_os_end(void);\r\n\r\n/*\r\n** CAPI3REF: Configuring The SQLite Library\r\n**\r\n** The sqlite3_config() interface is used to make global configuration\r\n** changes to SQLite in order to tune SQLite to the specific needs of\r\n** the application.  The default configuration is recommended for most\r\n** applications and so this routine is usually not necessary.  It is\r\n** provided to support rare applications with unusual needs.\r\n**\r\n** The sqlite3_config() interface is not threadsafe.  The application\r\n** must insure that no other SQLite interfaces are invoked by other\r\n** threads while sqlite3_config() is running.  Furthermore, sqlite3_config()\r\n** may only be invoked prior to library initialization using\r\n** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].\r\n** ^If sqlite3_config() is called after [sqlite3_initialize()] and before\r\n** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.\r\n** Note, however, that ^sqlite3_config() can be called as part of the\r\n** implementation of an application-defined [sqlite3_os_init()].\r\n**\r\n** The first argument to sqlite3_config() is an integer\r\n** [configuration option] that determines\r\n** what property of SQLite is to be configured.  Subsequent arguments\r\n** vary depending on the [configuration option]\r\n** in the first argument.\r\n**\r\n** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].\r\n** ^If the option is unknown or SQLite is unable to set the option\r\n** then this routine returns a non-zero [error code].\r\n*/\r\nSQLITE_API int sqlite3_config(int, ...);\r\n\r\n/*\r\n** CAPI3REF: Configure database connections\r\n**\r\n** The sqlite3_db_config() interface is used to make configuration\r\n** changes to a [database connection].  The interface is similar to\r\n** [sqlite3_config()] except that the changes apply to a single\r\n** [database connection] (specified in the first argument).\r\n**\r\n** The second argument to sqlite3_db_config(D,V,...)  is the\r\n** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code \r\n** that indicates what aspect of the [database connection] is being configured.\r\n** Subsequent arguments vary depending on the configuration verb.\r\n**\r\n** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if\r\n** the call is considered successful.\r\n*/\r\nSQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);\r\n\r\n/*\r\n** CAPI3REF: Memory Allocation Routines\r\n**\r\n** An instance of this object defines the interface between SQLite\r\n** and low-level memory allocation routines.\r\n**\r\n** This object is used in only one place in the SQLite interface.\r\n** A pointer to an instance of this object is the argument to\r\n** [sqlite3_config()] when the configuration option is\r\n** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].  \r\n** By creating an instance of this object\r\n** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])\r\n** during configuration, an application can specify an alternative\r\n** memory allocation subsystem for SQLite to use for all of its\r\n** dynamic memory needs.\r\n**\r\n** Note that SQLite comes with several [built-in memory allocators]\r\n** that are perfectly adequate for the overwhelming majority of applications\r\n** and that this object is only useful to a tiny minority of applications\r\n** with specialized memory allocation requirements.  This object is\r\n** also used during testing of SQLite in order to specify an alternative\r\n** memory allocator that simulates memory out-of-memory conditions in\r\n** order to verify that SQLite recovers gracefully from such\r\n** conditions.\r\n**\r\n** The xMalloc, xRealloc, and xFree methods must work like the\r\n** malloc(), realloc() and free() functions from the standard C library.\r\n** ^SQLite guarantees that the second argument to\r\n** xRealloc is always a value returned by a prior call to xRoundup.\r\n**\r\n** xSize should return the allocated size of a memory allocation\r\n** previously obtained from xMalloc or xRealloc.  The allocated size\r\n** is always at least as big as the requested size but may be larger.\r\n**\r\n** The xRoundup method returns what would be the allocated size of\r\n** a memory allocation given a particular requested size.  Most memory\r\n** allocators round up memory allocations at least to the next multiple\r\n** of 8.  Some allocators round up to a larger multiple or to a power of 2.\r\n** Every memory allocation request coming in through [sqlite3_malloc()]\r\n** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, \r\n** that causes the corresponding memory allocation to fail.\r\n**\r\n** The xInit method initializes the memory allocator.  (For example,\r\n** it might allocate any require mutexes or initialize internal data\r\n** structures.  The xShutdown method is invoked (indirectly) by\r\n** [sqlite3_shutdown()] and should deallocate any resources acquired\r\n** by xInit.  The pAppData pointer is used as the only parameter to\r\n** xInit and xShutdown.\r\n**\r\n** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes\r\n** the xInit method, so the xInit method need not be threadsafe.  The\r\n** xShutdown method is only called from [sqlite3_shutdown()] so it does\r\n** not need to be threadsafe either.  For all other methods, SQLite\r\n** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the\r\n** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which\r\n** it is by default) and so the methods are automatically serialized.\r\n** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other\r\n** methods must be threadsafe or else make their own arrangements for\r\n** serialization.\r\n**\r\n** SQLite will never invoke xInit() more than once without an intervening\r\n** call to xShutdown().\r\n*/\r\ntypedef struct sqlite3_mem_methods sqlite3_mem_methods;\r\nstruct sqlite3_mem_methods {\r\n  void *(*xMalloc)(int);         /* Memory allocation function */\r\n  void (*xFree)(void*);          /* Free a prior allocation */\r\n  void *(*xRealloc)(void*,int);  /* Resize an allocation */\r\n  int (*xSize)(void*);           /* Return the size of an allocation */\r\n  int (*xRoundup)(int);          /* Round up request size to allocation size */\r\n  int (*xInit)(void*);           /* Initialize the memory allocator */\r\n  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */\r\n  void *pAppData;                /* Argument to xInit() and xShutdown() */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Configuration Options\r\n** KEYWORDS: {configuration option}\r\n**\r\n** These constants are the available integer configuration options that\r\n** can be passed as the first argument to the [sqlite3_config()] interface.\r\n**\r\n** New configuration options may be added in future releases of SQLite.\r\n** Existing configuration options might be discontinued.  Applications\r\n** should check the return code from [sqlite3_config()] to make sure that\r\n** the call worked.  The [sqlite3_config()] interface will return a\r\n** non-zero [error code] if a discontinued or unsupported configuration option\r\n** is invoked.\r\n**\r\n** <dl>\r\n** [[SQLITE_CONFIG_SINGLETHREAD]] <dt>SQLITE_CONFIG_SINGLETHREAD</dt>\r\n** <dd>There are no arguments to this option.  ^This option sets the\r\n** [threading mode] to Single-thread.  In other words, it disables\r\n** all mutexing and puts SQLite into a mode where it can only be used\r\n** by a single thread.   ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** it is not possible to change the [threading mode] from its default\r\n** value of Single-thread and so [sqlite3_config()] will return \r\n** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD\r\n** configuration option.</dd>\r\n**\r\n** [[SQLITE_CONFIG_MULTITHREAD]] <dt>SQLITE_CONFIG_MULTITHREAD</dt>\r\n** <dd>There are no arguments to this option.  ^This option sets the\r\n** [threading mode] to Multi-thread.  In other words, it disables\r\n** mutexing on [database connection] and [prepared statement] objects.\r\n** The application is responsible for serializing access to\r\n** [database connections] and [prepared statements].  But other mutexes\r\n** are enabled so that SQLite will be safe to use in a multi-threaded\r\n** environment as long as no two threads attempt to use the same\r\n** [database connection] at the same time.  ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** it is not possible to set the Multi-thread [threading mode] and\r\n** [sqlite3_config()] will return [SQLITE_ERROR] if called with the\r\n** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>\r\n**\r\n** [[SQLITE_CONFIG_SERIALIZED]] <dt>SQLITE_CONFIG_SERIALIZED</dt>\r\n** <dd>There are no arguments to this option.  ^This option sets the\r\n** [threading mode] to Serialized. In other words, this option enables\r\n** all mutexes including the recursive\r\n** mutexes on [database connection] and [prepared statement] objects.\r\n** In this mode (which is the default when SQLite is compiled with\r\n** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access\r\n** to [database connections] and [prepared statements] so that the\r\n** application is free to use the same [database connection] or the\r\n** same [prepared statement] in different threads at the same time.\r\n** ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** it is not possible to set the Serialized [threading mode] and\r\n** [sqlite3_config()] will return [SQLITE_ERROR] if called with the\r\n** SQLITE_CONFIG_SERIALIZED configuration option.</dd>\r\n**\r\n** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mem_methods] structure.  The argument specifies\r\n** alternative low-level memory allocation routines to be used in place of\r\n** the memory allocation routines built into SQLite.)^ ^SQLite makes\r\n** its own private copy of the content of the [sqlite3_mem_methods] structure\r\n** before the [sqlite3_config()] call returns.</dd>\r\n**\r\n** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mem_methods] structure.  The [sqlite3_mem_methods]\r\n** structure is filled with the currently defined memory allocation routines.)^\r\n** This option can be used to overload the default memory allocation\r\n** routines with a wrapper that simulations memory allocation failure or\r\n** tracks memory usage, for example. </dd>\r\n**\r\n** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>\r\n** <dd> ^This option takes single argument of type int, interpreted as a \r\n** boolean, which enables or disables the collection of memory allocation \r\n** statistics. ^(When memory allocation statistics are disabled, the \r\n** following SQLite interfaces become non-operational:\r\n**   <ul>\r\n**   <li> [sqlite3_memory_used()]\r\n**   <li> [sqlite3_memory_highwater()]\r\n**   <li> [sqlite3_soft_heap_limit64()]\r\n**   <li> [sqlite3_status()]\r\n**   </ul>)^\r\n** ^Memory allocation statistics are enabled by default unless SQLite is\r\n** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory\r\n** allocation statistics are disabled by default.\r\n** </dd>\r\n**\r\n** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>\r\n** <dd> ^This option specifies a static memory buffer that SQLite can use for\r\n** scratch memory.  There are three arguments:  A pointer an 8-byte\r\n** aligned memory buffer from which the scratch allocations will be\r\n** drawn, the size of each scratch allocation (sz),\r\n** and the maximum number of scratch allocations (N).  The sz\r\n** argument must be a multiple of 16.\r\n** The first argument must be a pointer to an 8-byte aligned buffer\r\n** of at least sz*N bytes of memory.\r\n** ^SQLite will use no more than two scratch buffers per thread.  So\r\n** N should be set to twice the expected maximum number of threads.\r\n** ^SQLite will never require a scratch buffer that is more than 6\r\n** times the database page size. ^If SQLite needs needs additional\r\n** scratch memory beyond what is provided by this configuration option, then \r\n** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>\r\n**\r\n** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>\r\n** <dd> ^This option specifies a static memory buffer that SQLite can use for\r\n** the database page cache with the default page cache implementation.  \r\n** This configuration should not be used if an application-define page\r\n** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.\r\n** There are three arguments to this option: A pointer to 8-byte aligned\r\n** memory, the size of each page buffer (sz), and the number of pages (N).\r\n** The sz argument should be the size of the largest database page\r\n** (a power of two between 512 and 32768) plus a little extra for each\r\n** page header.  ^The page header size is 20 to 40 bytes depending on\r\n** the host architecture.  ^It is harmless, apart from the wasted memory,\r\n** to make sz a little too large.  The first\r\n** argument should point to an allocation of at least sz*N bytes of memory.\r\n** ^SQLite will use the memory provided by the first argument to satisfy its\r\n** memory needs for the first N pages that it adds to cache.  ^If additional\r\n** page cache memory is needed beyond what is provided by this option, then\r\n** SQLite goes to [sqlite3_malloc()] for the additional storage space.\r\n** The pointer in the first argument must\r\n** be aligned to an 8-byte boundary or subsequent behavior of SQLite\r\n** will be undefined.</dd>\r\n**\r\n** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>\r\n** <dd> ^This option specifies a static memory buffer that SQLite will use\r\n** for all of its dynamic memory allocation needs beyond those provided\r\n** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].\r\n** There are three arguments: An 8-byte aligned pointer to the memory,\r\n** the number of bytes in the memory buffer, and the minimum allocation size.\r\n** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts\r\n** to using its default memory allocator (the system malloc() implementation),\r\n** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  ^If the\r\n** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or\r\n** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory\r\n** allocator is engaged to handle all of SQLites memory allocation needs.\r\n** The first pointer (the memory pointer) must be aligned to an 8-byte\r\n** boundary or subsequent behavior of SQLite will be undefined.\r\n** The minimum allocation size is capped at 2**12. Reasonable values\r\n** for the minimum allocation size are 2**5 through 2**8.</dd>\r\n**\r\n** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mutex_methods] structure.  The argument specifies\r\n** alternative low-level mutex routines to be used in place\r\n** the mutex routines built into SQLite.)^  ^SQLite makes a copy of the\r\n** content of the [sqlite3_mutex_methods] structure before the call to\r\n** [sqlite3_config()] returns. ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** the entire mutexing subsystem is omitted from the build and hence calls to\r\n** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will\r\n** return [SQLITE_ERROR].</dd>\r\n**\r\n** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mutex_methods] structure.  The\r\n** [sqlite3_mutex_methods]\r\n** structure is filled with the currently defined mutex routines.)^\r\n** This option can be used to overload the default mutex allocation\r\n** routines with a wrapper used to track mutex usage for performance\r\n** profiling or testing, for example.   ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** the entire mutexing subsystem is omitted from the build and hence calls to\r\n** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will\r\n** return [SQLITE_ERROR].</dd>\r\n**\r\n** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>\r\n** <dd> ^(This option takes two arguments that determine the default\r\n** memory allocation for the lookaside memory allocator on each\r\n** [database connection].  The first argument is the\r\n** size of each lookaside buffer slot and the second is the number of\r\n** slots allocated to each database connection.)^  ^(This option sets the\r\n** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]\r\n** verb to [sqlite3_db_config()] can be used to change the lookaside\r\n** configuration on individual connections.)^ </dd>\r\n**\r\n** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to\r\n** an [sqlite3_pcache_methods2] object.  This object specifies the interface\r\n** to a custom page cache implementation.)^  ^SQLite makes a copy of the\r\n** object and uses it for page cache memory allocations.</dd>\r\n**\r\n** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** [sqlite3_pcache_methods2] object.  SQLite copies of the current\r\n** page cache implementation into that object.)^ </dd>\r\n**\r\n** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>\r\n** <dd> ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a\r\n** function with a call signature of void(*)(void*,int,const char*), \r\n** and a pointer to void. ^If the function pointer is not NULL, it is\r\n** invoked by [sqlite3_log()] to process each logging event.  ^If the\r\n** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.\r\n** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is\r\n** passed through as the first parameter to the application-defined logger\r\n** function whenever that function is invoked.  ^The second parameter to\r\n** the logger function is a copy of the first parameter to the corresponding\r\n** [sqlite3_log()] call and is intended to be a [result code] or an\r\n** [extended result code].  ^The third parameter passed to the logger is\r\n** log message after formatting via [sqlite3_snprintf()].\r\n** The SQLite logging interface is not reentrant; the logger function\r\n** supplied by the application must not invoke any SQLite interface.\r\n** In a multi-threaded application, the application-defined logger\r\n** function must be threadsafe. </dd>\r\n**\r\n** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI\r\n** <dd> This option takes a single argument of type int. If non-zero, then\r\n** URI handling is globally enabled. If the parameter is zero, then URI handling\r\n** is globally disabled. If URI handling is globally enabled, all filenames\r\n** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or\r\n** specified as part of [ATTACH] commands are interpreted as URIs, regardless\r\n** of whether or not the [SQLITE_OPEN_URI] flag is set when the database\r\n** connection is opened. If it is globally disabled, filenames are\r\n** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the\r\n** database connection is opened. By default, URI handling is globally\r\n** disabled. The default value may be changed by compiling with the\r\n** [SQLITE_USE_URI] symbol defined.\r\n**\r\n** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]\r\n** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFNIG_GETPCACHE\r\n** <dd> These options are obsolete and should not be used by new code.\r\n** They are retained for backwards compatibility but are now no-ops.\r\n** </dl>\r\n*/\r\n#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */\r\n#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */\r\n#define SQLITE_CONFIG_SERIALIZED    3  /* nil */\r\n#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */\r\n#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */\r\n#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */\r\n#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */\r\n#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */\r\n#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */\r\n#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */\r\n#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */\r\n/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ \r\n#define SQLITE_CONFIG_LOOKASIDE    13  /* int int */\r\n#define SQLITE_CONFIG_PCACHE       14  /* no-op */\r\n#define SQLITE_CONFIG_GETPCACHE    15  /* no-op */\r\n#define SQLITE_CONFIG_LOG          16  /* xFunc, void* */\r\n#define SQLITE_CONFIG_URI          17  /* int */\r\n#define SQLITE_CONFIG_PCACHE2      18  /* sqlite3_pcache_methods2* */\r\n#define SQLITE_CONFIG_GETPCACHE2   19  /* sqlite3_pcache_methods2* */\r\n\r\n/*\r\n** CAPI3REF: Database Connection Configuration Options\r\n**\r\n** These constants are the available integer configuration options that\r\n** can be passed as the second argument to the [sqlite3_db_config()] interface.\r\n**\r\n** New configuration options may be added in future releases of SQLite.\r\n** Existing configuration options might be discontinued.  Applications\r\n** should check the return code from [sqlite3_db_config()] to make sure that\r\n** the call worked.  ^The [sqlite3_db_config()] interface will return a\r\n** non-zero [error code] if a discontinued or unsupported configuration option\r\n** is invoked.\r\n**\r\n** <dl>\r\n** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>\r\n** <dd> ^This option takes three additional arguments that determine the \r\n** [lookaside memory allocator] configuration for the [database connection].\r\n** ^The first argument (the third parameter to [sqlite3_db_config()] is a\r\n** pointer to a memory buffer to use for lookaside memory.\r\n** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb\r\n** may be NULL in which case SQLite will allocate the\r\n** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the\r\n** size of each lookaside buffer slot.  ^The third argument is the number of\r\n** slots.  The size of the buffer in the first argument must be greater than\r\n** or equal to the product of the second and third arguments.  The buffer\r\n** must be aligned to an 8-byte boundary.  ^If the second argument to\r\n** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally\r\n** rounded down to the next smaller multiple of 8.  ^(The lookaside memory\r\n** configuration for a database connection can only be changed when that\r\n** connection is not currently using lookaside memory, or in other words\r\n** when the \"current value\" returned by\r\n** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.\r\n** Any attempt to change the lookaside memory configuration when lookaside\r\n** memory is in use leaves the configuration unchanged and returns \r\n** [SQLITE_BUSY].)^</dd>\r\n**\r\n** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>\r\n** <dd> ^This option is used to enable or disable the enforcement of\r\n** [foreign key constraints].  There should be two additional arguments.\r\n** The first argument is an integer which is 0 to disable FK enforcement,\r\n** positive to enable FK enforcement or negative to leave FK enforcement\r\n** unchanged.  The second parameter is a pointer to an integer into which\r\n** is written 0 or 1 to indicate whether FK enforcement is off or on\r\n** following this call.  The second parameter may be a NULL pointer, in\r\n** which case the FK enforcement setting is not reported back. </dd>\r\n**\r\n** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>\r\n** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].\r\n** There should be two additional arguments.\r\n** The first argument is an integer which is 0 to disable triggers,\r\n** positive to enable triggers or negative to leave the setting unchanged.\r\n** The second parameter is a pointer to an integer into which\r\n** is written 0 or 1 to indicate whether triggers are disabled or enabled\r\n** following this call.  The second parameter may be a NULL pointer, in\r\n** which case the trigger setting is not reported back. </dd>\r\n**\r\n** </dl>\r\n*/\r\n#define SQLITE_DBCONFIG_LOOKASIDE       1001  /* void* int int */\r\n#define SQLITE_DBCONFIG_ENABLE_FKEY     1002  /* int int* */\r\n#define SQLITE_DBCONFIG_ENABLE_TRIGGER  1003  /* int int* */\r\n\r\n\r\n/*\r\n** CAPI3REF: Enable Or Disable Extended Result Codes\r\n**\r\n** ^The sqlite3_extended_result_codes() routine enables or disables the\r\n** [extended result codes] feature of SQLite. ^The extended result\r\n** codes are disabled by default for historical compatibility.\r\n*/\r\nSQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);\r\n\r\n/*\r\n** CAPI3REF: Last Insert Rowid\r\n**\r\n** ^Each entry in an SQLite table has a unique 64-bit signed\r\n** integer key called the [ROWID | \"rowid\"]. ^The rowid is always available\r\n** as an undeclared column named ROWID, OID, or _ROWID_ as long as those\r\n** names are not also used by explicitly declared columns. ^If\r\n** the table has a column of type [INTEGER PRIMARY KEY] then that column\r\n** is another alias for the rowid.\r\n**\r\n** ^This routine returns the [rowid] of the most recent\r\n** successful [INSERT] into the database from the [database connection]\r\n** in the first argument.  ^As of SQLite version 3.7.7, this routines\r\n** records the last insert rowid of both ordinary tables and [virtual tables].\r\n** ^If no successful [INSERT]s\r\n** have ever occurred on that database connection, zero is returned.\r\n**\r\n** ^(If an [INSERT] occurs within a trigger or within a [virtual table]\r\n** method, then this routine will return the [rowid] of the inserted\r\n** row as long as the trigger or virtual table method is running.\r\n** But once the trigger or virtual table method ends, the value returned \r\n** by this routine reverts to what it was before the trigger or virtual\r\n** table method began.)^\r\n**\r\n** ^An [INSERT] that fails due to a constraint violation is not a\r\n** successful [INSERT] and does not change the value returned by this\r\n** routine.  ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,\r\n** and INSERT OR ABORT make no changes to the return value of this\r\n** routine when their insertion fails.  ^(When INSERT OR REPLACE\r\n** encounters a constraint violation, it does not fail.  The\r\n** INSERT continues to completion after deleting rows that caused\r\n** the constraint problem so INSERT OR REPLACE will always change\r\n** the return value of this interface.)^\r\n**\r\n** ^For the purposes of this routine, an [INSERT] is considered to\r\n** be successful even if it is subsequently rolled back.\r\n**\r\n** This function is accessible to SQL statements via the\r\n** [last_insert_rowid() SQL function].\r\n**\r\n** If a separate thread performs a new [INSERT] on the same\r\n** database connection while the [sqlite3_last_insert_rowid()]\r\n** function is running and thus changes the last insert [rowid],\r\n** then the value returned by [sqlite3_last_insert_rowid()] is\r\n** unpredictable and might not equal either the old or the new\r\n** last insert [rowid].\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Count The Number Of Rows Modified\r\n**\r\n** ^This function returns the number of database rows that were changed\r\n** or inserted or deleted by the most recently completed SQL statement\r\n** on the [database connection] specified by the first parameter.\r\n** ^(Only changes that are directly specified by the [INSERT], [UPDATE],\r\n** or [DELETE] statement are counted.  Auxiliary changes caused by\r\n** triggers or [foreign key actions] are not counted.)^ Use the\r\n** [sqlite3_total_changes()] function to find the total number of changes\r\n** including changes caused by triggers and foreign key actions.\r\n**\r\n** ^Changes to a view that are simulated by an [INSTEAD OF trigger]\r\n** are not counted.  Only real table changes are counted.\r\n**\r\n** ^(A \"row change\" is a change to a single row of a single table\r\n** caused by an INSERT, DELETE, or UPDATE statement.  Rows that\r\n** are changed as side effects of [REPLACE] constraint resolution,\r\n** rollback, ABORT processing, [DROP TABLE], or by any other\r\n** mechanisms do not count as direct row changes.)^\r\n**\r\n** A \"trigger context\" is a scope of execution that begins and\r\n** ends with the script of a [CREATE TRIGGER | trigger]. \r\n** Most SQL statements are\r\n** evaluated outside of any trigger.  This is the \"top level\"\r\n** trigger context.  If a trigger fires from the top level, a\r\n** new trigger context is entered for the duration of that one\r\n** trigger.  Subtriggers create subcontexts for their duration.\r\n**\r\n** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does\r\n** not create a new trigger context.\r\n**\r\n** ^This function returns the number of direct row changes in the\r\n** most recent INSERT, UPDATE, or DELETE statement within the same\r\n** trigger context.\r\n**\r\n** ^Thus, when called from the top level, this function returns the\r\n** number of changes in the most recent INSERT, UPDATE, or DELETE\r\n** that also occurred at the top level.  ^(Within the body of a trigger,\r\n** the sqlite3_changes() interface can be called to find the number of\r\n** changes in the most recently completed INSERT, UPDATE, or DELETE\r\n** statement within the body of the same trigger.\r\n** However, the number returned does not include changes\r\n** caused by subtriggers since those have their own context.)^\r\n**\r\n** See also the [sqlite3_total_changes()] interface, the\r\n** [count_changes pragma], and the [changes() SQL function].\r\n**\r\n** If a separate thread makes changes on the same database connection\r\n** while [sqlite3_changes()] is running then the value returned\r\n** is unpredictable and not meaningful.\r\n*/\r\nSQLITE_API int sqlite3_changes(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Total Number Of Rows Modified\r\n**\r\n** ^This function returns the number of row changes caused by [INSERT],\r\n** [UPDATE] or [DELETE] statements since the [database connection] was opened.\r\n** ^(The count returned by sqlite3_total_changes() includes all changes\r\n** from all [CREATE TRIGGER | trigger] contexts and changes made by\r\n** [foreign key actions]. However,\r\n** the count does not include changes used to implement [REPLACE] constraints,\r\n** do rollbacks or ABORT processing, or [DROP TABLE] processing.  The\r\n** count does not include rows of views that fire an [INSTEAD OF trigger],\r\n** though if the INSTEAD OF trigger makes changes of its own, those changes \r\n** are counted.)^\r\n** ^The sqlite3_total_changes() function counts the changes as soon as\r\n** the statement that makes them is completed (when the statement handle\r\n** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).\r\n**\r\n** See also the [sqlite3_changes()] interface, the\r\n** [count_changes pragma], and the [total_changes() SQL function].\r\n**\r\n** If a separate thread makes changes on the same database connection\r\n** while [sqlite3_total_changes()] is running then the value\r\n** returned is unpredictable and not meaningful.\r\n*/\r\nSQLITE_API int sqlite3_total_changes(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Interrupt A Long-Running Query\r\n**\r\n** ^This function causes any pending database operation to abort and\r\n** return at its earliest opportunity. This routine is typically\r\n** called in response to a user action such as pressing \"Cancel\"\r\n** or Ctrl-C where the user wants a long query operation to halt\r\n** immediately.\r\n**\r\n** ^It is safe to call this routine from a thread different from the\r\n** thread that is currently running the database operation.  But it\r\n** is not safe to call this routine with a [database connection] that\r\n** is closed or might close before sqlite3_interrupt() returns.\r\n**\r\n** ^If an SQL operation is very nearly finished at the time when\r\n** sqlite3_interrupt() is called, then it might not have an opportunity\r\n** to be interrupted and might continue to completion.\r\n**\r\n** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].\r\n** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE\r\n** that is inside an explicit transaction, then the entire transaction\r\n** will be rolled back automatically.\r\n**\r\n** ^The sqlite3_interrupt(D) call is in effect until all currently running\r\n** SQL statements on [database connection] D complete.  ^Any new SQL statements\r\n** that are started after the sqlite3_interrupt() call and before the \r\n** running statements reaches zero are interrupted as if they had been\r\n** running prior to the sqlite3_interrupt() call.  ^New SQL statements\r\n** that are started after the running statement count reaches zero are\r\n** not effected by the sqlite3_interrupt().\r\n** ^A call to sqlite3_interrupt(D) that occurs when there are no running\r\n** SQL statements is a no-op and has no effect on SQL statements\r\n** that are started after the sqlite3_interrupt() call returns.\r\n**\r\n** If the database connection closes while [sqlite3_interrupt()]\r\n** is running then bad things will likely happen.\r\n*/\r\nSQLITE_API void sqlite3_interrupt(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Determine If An SQL Statement Is Complete\r\n**\r\n** These routines are useful during command-line input to determine if the\r\n** currently entered text seems to form a complete SQL statement or\r\n** if additional input is needed before sending the text into\r\n** SQLite for parsing.  ^These routines return 1 if the input string\r\n** appears to be a complete SQL statement.  ^A statement is judged to be\r\n** complete if it ends with a semicolon token and is not a prefix of a\r\n** well-formed CREATE TRIGGER statement.  ^Semicolons that are embedded within\r\n** string literals or quoted identifier names or comments are not\r\n** independent tokens (they are part of the token in which they are\r\n** embedded) and thus do not count as a statement terminator.  ^Whitespace\r\n** and comments that follow the final semicolon are ignored.\r\n**\r\n** ^These routines return 0 if the statement is incomplete.  ^If a\r\n** memory allocation fails, then SQLITE_NOMEM is returned.\r\n**\r\n** ^These routines do not parse the SQL statements thus\r\n** will not detect syntactically incorrect SQL.\r\n**\r\n** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior \r\n** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked\r\n** automatically by sqlite3_complete16().  If that initialization fails,\r\n** then the return value from sqlite3_complete16() will be non-zero\r\n** regardless of whether or not the input SQL is complete.)^\r\n**\r\n** The input to [sqlite3_complete()] must be a zero-terminated\r\n** UTF-8 string.\r\n**\r\n** The input to [sqlite3_complete16()] must be a zero-terminated\r\n** UTF-16 string in native byte order.\r\n*/\r\nSQLITE_API int sqlite3_complete(const char *sql);\r\nSQLITE_API int sqlite3_complete16(const void *sql);\r\n\r\n/*\r\n** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors\r\n**\r\n** ^This routine sets a callback function that might be invoked whenever\r\n** an attempt is made to open a database table that another thread\r\n** or process has locked.\r\n**\r\n** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]\r\n** is returned immediately upon encountering the lock.  ^If the busy callback\r\n** is not NULL, then the callback might be invoked with two arguments.\r\n**\r\n** ^The first argument to the busy handler is a copy of the void* pointer which\r\n** is the third argument to sqlite3_busy_handler().  ^The second argument to\r\n** the busy handler callback is the number of times that the busy handler has\r\n** been invoked for this locking event.  ^If the\r\n** busy callback returns 0, then no additional attempts are made to\r\n** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.\r\n** ^If the callback returns non-zero, then another attempt\r\n** is made to open the database for reading and the cycle repeats.\r\n**\r\n** The presence of a busy handler does not guarantee that it will be invoked\r\n** when there is lock contention. ^If SQLite determines that invoking the busy\r\n** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]\r\n** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.\r\n** Consider a scenario where one process is holding a read lock that\r\n** it is trying to promote to a reserved lock and\r\n** a second process is holding a reserved lock that it is trying\r\n** to promote to an exclusive lock.  The first process cannot proceed\r\n** because it is blocked by the second and the second process cannot\r\n** proceed because it is blocked by the first.  If both processes\r\n** invoke the busy handlers, neither will make any progress.  Therefore,\r\n** SQLite returns [SQLITE_BUSY] for the first process, hoping that this\r\n** will induce the first process to release its read lock and allow\r\n** the second process to proceed.\r\n**\r\n** ^The default busy callback is NULL.\r\n**\r\n** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]\r\n** when SQLite is in the middle of a large transaction where all the\r\n** changes will not fit into the in-memory cache.  SQLite will\r\n** already hold a RESERVED lock on the database file, but it needs\r\n** to promote this lock to EXCLUSIVE so that it can spill cache\r\n** pages into the database file without harm to concurrent\r\n** readers.  ^If it is unable to promote the lock, then the in-memory\r\n** cache will be left in an inconsistent state and so the error\r\n** code is promoted from the relatively benign [SQLITE_BUSY] to\r\n** the more severe [SQLITE_IOERR_BLOCKED].  ^This error code promotion\r\n** forces an automatic rollback of the changes.  See the\r\n** <a href=\"/cvstrac/wiki?p=CorruptionFollowingBusyError\">\r\n** CorruptionFollowingBusyError</a> wiki page for a discussion of why\r\n** this is important.\r\n**\r\n** ^(There can only be a single busy handler defined for each\r\n** [database connection].  Setting a new busy handler clears any\r\n** previously set handler.)^  ^Note that calling [sqlite3_busy_timeout()]\r\n** will also set or clear the busy handler.\r\n**\r\n** The busy callback should not take any actions which modify the\r\n** database connection that invoked the busy handler.  Any such actions\r\n** result in undefined behavior.\r\n** \r\n** A busy handler must not close the database connection\r\n** or [prepared statement] that invoked the busy handler.\r\n*/\r\nSQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);\r\n\r\n/*\r\n** CAPI3REF: Set A Busy Timeout\r\n**\r\n** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps\r\n** for a specified amount of time when a table is locked.  ^The handler\r\n** will sleep multiple times until at least \"ms\" milliseconds of sleeping\r\n** have accumulated.  ^After at least \"ms\" milliseconds of sleeping,\r\n** the handler returns 0 which causes [sqlite3_step()] to return\r\n** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].\r\n**\r\n** ^Calling this routine with an argument less than or equal to zero\r\n** turns off all busy handlers.\r\n**\r\n** ^(There can only be a single busy handler for a particular\r\n** [database connection] any any given moment.  If another busy handler\r\n** was defined  (using [sqlite3_busy_handler()]) prior to calling\r\n** this routine, that other busy handler is cleared.)^\r\n*/\r\nSQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);\r\n\r\n/*\r\n** CAPI3REF: Convenience Routines For Running Queries\r\n**\r\n** This is a legacy interface that is preserved for backwards compatibility.\r\n** Use of this interface is not recommended.\r\n**\r\n** Definition: A <b>result table</b> is memory data structure created by the\r\n** [sqlite3_get_table()] interface.  A result table records the\r\n** complete query results from one or more queries.\r\n**\r\n** The table conceptually has a number of rows and columns.  But\r\n** these numbers are not part of the result table itself.  These\r\n** numbers are obtained separately.  Let N be the number of rows\r\n** and M be the number of columns.\r\n**\r\n** A result table is an array of pointers to zero-terminated UTF-8 strings.\r\n** There are (N+1)*M elements in the array.  The first M pointers point\r\n** to zero-terminated strings that  contain the names of the columns.\r\n** The remaining entries all point to query results.  NULL values result\r\n** in NULL pointers.  All other values are in their UTF-8 zero-terminated\r\n** string representation as returned by [sqlite3_column_text()].\r\n**\r\n** A result table might consist of one or more memory allocations.\r\n** It is not safe to pass a result table directly to [sqlite3_free()].\r\n** A result table should be deallocated using [sqlite3_free_table()].\r\n**\r\n** ^(As an example of the result table format, suppose a query result\r\n** is as follows:\r\n**\r\n** <blockquote><pre>\r\n**        Name        | Age\r\n**        -----------------------\r\n**        Alice       | 43\r\n**        Bob         | 28\r\n**        Cindy       | 21\r\n** </pre></blockquote>\r\n**\r\n** There are two column (M==2) and three rows (N==3).  Thus the\r\n** result table has 8 entries.  Suppose the result table is stored\r\n** in an array names azResult.  Then azResult holds this content:\r\n**\r\n** <blockquote><pre>\r\n**        azResult&#91;0] = \"Name\";\r\n**        azResult&#91;1] = \"Age\";\r\n**        azResult&#91;2] = \"Alice\";\r\n**        azResult&#91;3] = \"43\";\r\n**        azResult&#91;4] = \"Bob\";\r\n**        azResult&#91;5] = \"28\";\r\n**        azResult&#91;6] = \"Cindy\";\r\n**        azResult&#91;7] = \"21\";\r\n** </pre></blockquote>)^\r\n**\r\n** ^The sqlite3_get_table() function evaluates one or more\r\n** semicolon-separated SQL statements in the zero-terminated UTF-8\r\n** string of its 2nd parameter and returns a result table to the\r\n** pointer given in its 3rd parameter.\r\n**\r\n** After the application has finished with the result from sqlite3_get_table(),\r\n** it must pass the result table pointer to sqlite3_free_table() in order to\r\n** release the memory that was malloced.  Because of the way the\r\n** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling\r\n** function must not try to call [sqlite3_free()] directly.  Only\r\n** [sqlite3_free_table()] is able to release the memory properly and safely.\r\n**\r\n** The sqlite3_get_table() interface is implemented as a wrapper around\r\n** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access\r\n** to any internal data structures of SQLite.  It uses only the public\r\n** interface defined here.  As a consequence, errors that occur in the\r\n** wrapper layer outside of the internal [sqlite3_exec()] call are not\r\n** reflected in subsequent calls to [sqlite3_errcode()] or\r\n** [sqlite3_errmsg()].\r\n*/\r\nSQLITE_API int sqlite3_get_table(\r\n  sqlite3 *db,          /* An open database */\r\n  const char *zSql,     /* SQL to be evaluated */\r\n  char ***pazResult,    /* Results of the query */\r\n  int *pnRow,           /* Number of result rows written here */\r\n  int *pnColumn,        /* Number of result columns written here */\r\n  char **pzErrmsg       /* Error msg written here */\r\n);\r\nSQLITE_API void sqlite3_free_table(char **result);\r\n\r\n/*\r\n** CAPI3REF: Formatted String Printing Functions\r\n**\r\n** These routines are work-alikes of the \"printf()\" family of functions\r\n** from the standard C library.\r\n**\r\n** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their\r\n** results into memory obtained from [sqlite3_malloc()].\r\n** The strings returned by these two routines should be\r\n** released by [sqlite3_free()].  ^Both routines return a\r\n** NULL pointer if [sqlite3_malloc()] is unable to allocate enough\r\n** memory to hold the resulting string.\r\n**\r\n** ^(The sqlite3_snprintf() routine is similar to \"snprintf()\" from\r\n** the standard C library.  The result is written into the\r\n** buffer supplied as the second parameter whose size is given by\r\n** the first parameter. Note that the order of the\r\n** first two parameters is reversed from snprintf().)^  This is an\r\n** historical accident that cannot be fixed without breaking\r\n** backwards compatibility.  ^(Note also that sqlite3_snprintf()\r\n** returns a pointer to its buffer instead of the number of\r\n** characters actually written into the buffer.)^  We admit that\r\n** the number of characters written would be a more useful return\r\n** value but we cannot change the implementation of sqlite3_snprintf()\r\n** now without breaking compatibility.\r\n**\r\n** ^As long as the buffer size is greater than zero, sqlite3_snprintf()\r\n** guarantees that the buffer is always zero-terminated.  ^The first\r\n** parameter \"n\" is the total size of the buffer, including space for\r\n** the zero terminator.  So the longest string that can be completely\r\n** written will be n-1 characters.\r\n**\r\n** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().\r\n**\r\n** These routines all implement some additional formatting\r\n** options that are useful for constructing SQL statements.\r\n** All of the usual printf() formatting options apply.  In addition, there\r\n** is are \"%q\", \"%Q\", and \"%z\" options.\r\n**\r\n** ^(The %q option works like %s in that it substitutes a nul-terminated\r\n** string from the argument list.  But %q also doubles every '\\'' character.\r\n** %q is designed for use inside a string literal.)^  By doubling each '\\''\r\n** character it escapes that character and allows it to be inserted into\r\n** the string.\r\n**\r\n** For example, assume the string variable zText contains text as follows:\r\n**\r\n** <blockquote><pre>\r\n**  char *zText = \"It's a happy day!\";\r\n** </pre></blockquote>\r\n**\r\n** One can use this text in an SQL statement as follows:\r\n**\r\n** <blockquote><pre>\r\n**  char *zSQL = sqlite3_mprintf(\"INSERT INTO table VALUES('%q')\", zText);\r\n**  sqlite3_exec(db, zSQL, 0, 0, 0);\r\n**  sqlite3_free(zSQL);\r\n** </pre></blockquote>\r\n**\r\n** Because the %q format string is used, the '\\'' character in zText\r\n** is escaped and the SQL generated is as follows:\r\n**\r\n** <blockquote><pre>\r\n**  INSERT INTO table1 VALUES('It''s a happy day!')\r\n** </pre></blockquote>\r\n**\r\n** This is correct.  Had we used %s instead of %q, the generated SQL\r\n** would have looked like this:\r\n**\r\n** <blockquote><pre>\r\n**  INSERT INTO table1 VALUES('It's a happy day!');\r\n** </pre></blockquote>\r\n**\r\n** This second example is an SQL syntax error.  As a general rule you should\r\n** always use %q instead of %s when inserting text into a string literal.\r\n**\r\n** ^(The %Q option works like %q except it also adds single quotes around\r\n** the outside of the total string.  Additionally, if the parameter in the\r\n** argument list is a NULL pointer, %Q substitutes the text \"NULL\" (without\r\n** single quotes).)^  So, for example, one could say:\r\n**\r\n** <blockquote><pre>\r\n**  char *zSQL = sqlite3_mprintf(\"INSERT INTO table VALUES(%Q)\", zText);\r\n**  sqlite3_exec(db, zSQL, 0, 0, 0);\r\n**  sqlite3_free(zSQL);\r\n** </pre></blockquote>\r\n**\r\n** The code above will render a correct SQL statement in the zSQL\r\n** variable even if the zText variable is a NULL pointer.\r\n**\r\n** ^(The \"%z\" formatting option works like \"%s\" but with the\r\n** addition that after the string has been read and copied into\r\n** the result, [sqlite3_free()] is called on the input string.)^\r\n*/\r\nSQLITE_API char *sqlite3_mprintf(const char*,...);\r\nSQLITE_API char *sqlite3_vmprintf(const char*, va_list);\r\nSQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);\r\nSQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);\r\n\r\n/*\r\n** CAPI3REF: Memory Allocation Subsystem\r\n**\r\n** The SQLite core uses these three routines for all of its own\r\n** internal memory allocation needs. \"Core\" in the previous sentence\r\n** does not include operating-system specific VFS implementation.  The\r\n** Windows VFS uses native malloc() and free() for some operations.\r\n**\r\n** ^The sqlite3_malloc() routine returns a pointer to a block\r\n** of memory at least N bytes in length, where N is the parameter.\r\n** ^If sqlite3_malloc() is unable to obtain sufficient free\r\n** memory, it returns a NULL pointer.  ^If the parameter N to\r\n** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns\r\n** a NULL pointer.\r\n**\r\n** ^Calling sqlite3_free() with a pointer previously returned\r\n** by sqlite3_malloc() or sqlite3_realloc() releases that memory so\r\n** that it might be reused.  ^The sqlite3_free() routine is\r\n** a no-op if is called with a NULL pointer.  Passing a NULL pointer\r\n** to sqlite3_free() is harmless.  After being freed, memory\r\n** should neither be read nor written.  Even reading previously freed\r\n** memory might result in a segmentation fault or other severe error.\r\n** Memory corruption, a segmentation fault, or other severe error\r\n** might result if sqlite3_free() is called with a non-NULL pointer that\r\n** was not obtained from sqlite3_malloc() or sqlite3_realloc().\r\n**\r\n** ^(The sqlite3_realloc() interface attempts to resize a\r\n** prior memory allocation to be at least N bytes, where N is the\r\n** second parameter.  The memory allocation to be resized is the first\r\n** parameter.)^ ^ If the first parameter to sqlite3_realloc()\r\n** is a NULL pointer then its behavior is identical to calling\r\n** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().\r\n** ^If the second parameter to sqlite3_realloc() is zero or\r\n** negative then the behavior is exactly the same as calling\r\n** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().\r\n** ^sqlite3_realloc() returns a pointer to a memory allocation\r\n** of at least N bytes in size or NULL if sufficient memory is unavailable.\r\n** ^If M is the size of the prior allocation, then min(N,M) bytes\r\n** of the prior allocation are copied into the beginning of buffer returned\r\n** by sqlite3_realloc() and the prior allocation is freed.\r\n** ^If sqlite3_realloc() returns NULL, then the prior allocation\r\n** is not freed.\r\n**\r\n** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()\r\n** is always aligned to at least an 8 byte boundary, or to a\r\n** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time\r\n** option is used.\r\n**\r\n** In SQLite version 3.5.0 and 3.5.1, it was possible to define\r\n** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in\r\n** implementation of these routines to be omitted.  That capability\r\n** is no longer provided.  Only built-in memory allocators can be used.\r\n**\r\n** The Windows OS interface layer calls\r\n** the system malloc() and free() directly when converting\r\n** filenames between the UTF-8 encoding used by SQLite\r\n** and whatever filename encoding is used by the particular Windows\r\n** installation.  Memory allocation errors are detected, but\r\n** they are reported back as [SQLITE_CANTOPEN] or\r\n** [SQLITE_IOERR] rather than [SQLITE_NOMEM].\r\n**\r\n** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]\r\n** must be either NULL or else pointers obtained from a prior\r\n** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have\r\n** not yet been released.\r\n**\r\n** The application must not read or write any part of\r\n** a block of memory after it has been released using\r\n** [sqlite3_free()] or [sqlite3_realloc()].\r\n*/\r\nSQLITE_API void *sqlite3_malloc(int);\r\nSQLITE_API void *sqlite3_realloc(void*, int);\r\nSQLITE_API void sqlite3_free(void*);\r\n\r\n/*\r\n** CAPI3REF: Memory Allocator Statistics\r\n**\r\n** SQLite provides these two interfaces for reporting on the status\r\n** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]\r\n** routines, which form the built-in memory allocation subsystem.\r\n**\r\n** ^The [sqlite3_memory_used()] routine returns the number of bytes\r\n** of memory currently outstanding (malloced but not freed).\r\n** ^The [sqlite3_memory_highwater()] routine returns the maximum\r\n** value of [sqlite3_memory_used()] since the high-water mark\r\n** was last reset.  ^The values returned by [sqlite3_memory_used()] and\r\n** [sqlite3_memory_highwater()] include any overhead\r\n** added by SQLite in its implementation of [sqlite3_malloc()],\r\n** but not overhead added by the any underlying system library\r\n** routines that [sqlite3_malloc()] may call.\r\n**\r\n** ^The memory high-water mark is reset to the current value of\r\n** [sqlite3_memory_used()] if and only if the parameter to\r\n** [sqlite3_memory_highwater()] is true.  ^The value returned\r\n** by [sqlite3_memory_highwater(1)] is the high-water mark\r\n** prior to the reset.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_memory_used(void);\r\nSQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);\r\n\r\n/*\r\n** CAPI3REF: Pseudo-Random Number Generator\r\n**\r\n** SQLite contains a high-quality pseudo-random number generator (PRNG) used to\r\n** select random [ROWID | ROWIDs] when inserting new records into a table that\r\n** already uses the largest possible [ROWID].  The PRNG is also used for\r\n** the build-in random() and randomblob() SQL functions.  This interface allows\r\n** applications to access the same PRNG for other purposes.\r\n**\r\n** ^A call to this routine stores N bytes of randomness into buffer P.\r\n**\r\n** ^The first time this routine is invoked (either internally or by\r\n** the application) the PRNG is seeded using randomness obtained\r\n** from the xRandomness method of the default [sqlite3_vfs] object.\r\n** ^On all subsequent invocations, the pseudo-randomness is generated\r\n** internally and without recourse to the [sqlite3_vfs] xRandomness\r\n** method.\r\n*/\r\nSQLITE_API void sqlite3_randomness(int N, void *P);\r\n\r\n/*\r\n** CAPI3REF: Compile-Time Authorization Callbacks\r\n**\r\n** ^This routine registers an authorizer callback with a particular\r\n** [database connection], supplied in the first argument.\r\n** ^The authorizer callback is invoked as SQL statements are being compiled\r\n** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],\r\n** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  ^At various\r\n** points during the compilation process, as logic is being created\r\n** to perform various actions, the authorizer callback is invoked to\r\n** see if those actions are allowed.  ^The authorizer callback should\r\n** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the\r\n** specific action but allow the SQL statement to continue to be\r\n** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be\r\n** rejected with an error.  ^If the authorizer callback returns\r\n** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]\r\n** then the [sqlite3_prepare_v2()] or equivalent call that triggered\r\n** the authorizer will fail with an error message.\r\n**\r\n** When the callback returns [SQLITE_OK], that means the operation\r\n** requested is ok.  ^When the callback returns [SQLITE_DENY], the\r\n** [sqlite3_prepare_v2()] or equivalent call that triggered the\r\n** authorizer will fail with an error message explaining that\r\n** access is denied. \r\n**\r\n** ^The first parameter to the authorizer callback is a copy of the third\r\n** parameter to the sqlite3_set_authorizer() interface. ^The second parameter\r\n** to the callback is an integer [SQLITE_COPY | action code] that specifies\r\n** the particular action to be authorized. ^The third through sixth parameters\r\n** to the callback are zero-terminated strings that contain additional\r\n** details about the action to be authorized.\r\n**\r\n** ^If the action code is [SQLITE_READ]\r\n** and the callback returns [SQLITE_IGNORE] then the\r\n** [prepared statement] statement is constructed to substitute\r\n** a NULL value in place of the table column that would have\r\n** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]\r\n** return can be used to deny an untrusted user access to individual\r\n** columns of a table.\r\n** ^If the action code is [SQLITE_DELETE] and the callback returns\r\n** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the\r\n** [truncate optimization] is disabled and all rows are deleted individually.\r\n**\r\n** An authorizer is used when [sqlite3_prepare | preparing]\r\n** SQL statements from an untrusted source, to ensure that the SQL statements\r\n** do not try to access data they are not allowed to see, or that they do not\r\n** try to execute malicious statements that damage the database.  For\r\n** example, an application may allow a user to enter arbitrary\r\n** SQL queries for evaluation by a database.  But the application does\r\n** not want the user to be able to make arbitrary changes to the\r\n** database.  An authorizer could then be put in place while the\r\n** user-entered SQL is being [sqlite3_prepare | prepared] that\r\n** disallows everything except [SELECT] statements.\r\n**\r\n** Applications that need to process SQL from untrusted sources\r\n** might also consider lowering resource limits using [sqlite3_limit()]\r\n** and limiting database size using the [max_page_count] [PRAGMA]\r\n** in addition to using an authorizer.\r\n**\r\n** ^(Only a single authorizer can be in place on a database connection\r\n** at a time.  Each call to sqlite3_set_authorizer overrides the\r\n** previous call.)^  ^Disable the authorizer by installing a NULL callback.\r\n** The authorizer is disabled by default.\r\n**\r\n** The authorizer callback must not do anything that will modify\r\n** the database connection that invoked the authorizer callback.\r\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\r\n** database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the\r\n** statement might be re-prepared during [sqlite3_step()] due to a \r\n** schema change.  Hence, the application should ensure that the\r\n** correct authorizer callback remains in place during the [sqlite3_step()].\r\n**\r\n** ^Note that the authorizer callback is invoked only during\r\n** [sqlite3_prepare()] or its variants.  Authorization is not\r\n** performed during statement evaluation in [sqlite3_step()], unless\r\n** as stated in the previous paragraph, sqlite3_step() invokes\r\n** sqlite3_prepare_v2() to reprepare a statement after a schema change.\r\n*/\r\nSQLITE_API int sqlite3_set_authorizer(\r\n  sqlite3*,\r\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),\r\n  void *pUserData\r\n);\r\n\r\n/*\r\n** CAPI3REF: Authorizer Return Codes\r\n**\r\n** The [sqlite3_set_authorizer | authorizer callback function] must\r\n** return either [SQLITE_OK] or one of these two constants in order\r\n** to signal SQLite whether or not the action is permitted.  See the\r\n** [sqlite3_set_authorizer | authorizer documentation] for additional\r\n** information.\r\n**\r\n** Note that SQLITE_IGNORE is also used as a [SQLITE_ROLLBACK | return code]\r\n** from the [sqlite3_vtab_on_conflict()] interface.\r\n*/\r\n#define SQLITE_DENY   1   /* Abort the SQL statement with an error */\r\n#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */\r\n\r\n/*\r\n** CAPI3REF: Authorizer Action Codes\r\n**\r\n** The [sqlite3_set_authorizer()] interface registers a callback function\r\n** that is invoked to authorize certain SQL statement actions.  The\r\n** second parameter to the callback is an integer code that specifies\r\n** what action is being authorized.  These are the integer action codes that\r\n** the authorizer callback may be passed.\r\n**\r\n** These action code values signify what kind of operation is to be\r\n** authorized.  The 3rd and 4th parameters to the authorization\r\n** callback function will be parameters or NULL depending on which of these\r\n** codes is used as the second parameter.  ^(The 5th parameter to the\r\n** authorizer callback is the name of the database (\"main\", \"temp\",\r\n** etc.) if applicable.)^  ^The 6th parameter to the authorizer callback\r\n** is the name of the inner-most trigger or view that is responsible for\r\n** the access attempt or NULL if this access attempt is directly from\r\n** top-level SQL code.\r\n*/\r\n/******************************************* 3rd ************ 4th ***********/\r\n#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */\r\n#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */\r\n#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */\r\n#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */\r\n#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */\r\n#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */\r\n#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */\r\n#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */\r\n#define SQLITE_DELETE                9   /* Table Name      NULL            */\r\n#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */\r\n#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */\r\n#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */\r\n#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */\r\n#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */\r\n#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */\r\n#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */\r\n#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */\r\n#define SQLITE_INSERT               18   /* Table Name      NULL            */\r\n#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */\r\n#define SQLITE_READ                 20   /* Table Name      Column Name     */\r\n#define SQLITE_SELECT               21   /* NULL            NULL            */\r\n#define SQLITE_TRANSACTION          22   /* Operation       NULL            */\r\n#define SQLITE_UPDATE               23   /* Table Name      Column Name     */\r\n#define SQLITE_ATTACH               24   /* Filename        NULL            */\r\n#define SQLITE_DETACH               25   /* Database Name   NULL            */\r\n#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */\r\n#define SQLITE_REINDEX              27   /* Index Name      NULL            */\r\n#define SQLITE_ANALYZE              28   /* Table Name      NULL            */\r\n#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */\r\n#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */\r\n#define SQLITE_FUNCTION             31   /* NULL            Function Name   */\r\n#define SQLITE_SAVEPOINT            32   /* Operation       Savepoint Name  */\r\n#define SQLITE_COPY                  0   /* No longer used */\r\n\r\n/*\r\n** CAPI3REF: Tracing And Profiling Functions\r\n**\r\n** These routines register callback functions that can be used for\r\n** tracing and profiling the execution of SQL statements.\r\n**\r\n** ^The callback function registered by sqlite3_trace() is invoked at\r\n** various times when an SQL statement is being run by [sqlite3_step()].\r\n** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the\r\n** SQL statement text as the statement first begins executing.\r\n** ^(Additional sqlite3_trace() callbacks might occur\r\n** as each triggered subprogram is entered.  The callbacks for triggers\r\n** contain a UTF-8 SQL comment that identifies the trigger.)^\r\n**\r\n** ^The callback function registered by sqlite3_profile() is invoked\r\n** as each SQL statement finishes.  ^The profile callback contains\r\n** the original statement text and an estimate of wall-clock time\r\n** of how long that statement took to run.  ^The profile callback\r\n** time is in units of nanoseconds, however the current implementation\r\n** is only capable of millisecond resolution so the six least significant\r\n** digits in the time are meaningless.  Future versions of SQLite\r\n** might provide greater resolution on the profiler callback.  The\r\n** sqlite3_profile() function is considered experimental and is\r\n** subject to change in future versions of SQLite.\r\n*/\r\nSQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);\r\nSQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,\r\n   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);\r\n\r\n/*\r\n** CAPI3REF: Query Progress Callbacks\r\n**\r\n** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback\r\n** function X to be invoked periodically during long running calls to\r\n** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for\r\n** database connection D.  An example use for this\r\n** interface is to keep a GUI updated during a large query.\r\n**\r\n** ^The parameter P is passed through as the only parameter to the \r\n** callback function X.  ^The parameter N is the number of \r\n** [virtual machine instructions] that are evaluated between successive\r\n** invocations of the callback X.\r\n**\r\n** ^Only a single progress handler may be defined at one time per\r\n** [database connection]; setting a new progress handler cancels the\r\n** old one.  ^Setting parameter X to NULL disables the progress handler.\r\n** ^The progress handler is also disabled by setting N to a value less\r\n** than 1.\r\n**\r\n** ^If the progress callback returns non-zero, the operation is\r\n** interrupted.  This feature can be used to implement a\r\n** \"Cancel\" button on a GUI progress dialog box.\r\n**\r\n** The progress handler callback must not do anything that will modify\r\n** the database connection that invoked the progress handler.\r\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\r\n** database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n*/\r\nSQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);\r\n\r\n/*\r\n** CAPI3REF: Opening A New Database Connection\r\n**\r\n** ^These routines open an SQLite database file as specified by the \r\n** filename argument. ^The filename argument is interpreted as UTF-8 for\r\n** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte\r\n** order for sqlite3_open16(). ^(A [database connection] handle is usually\r\n** returned in *ppDb, even if an error occurs.  The only exception is that\r\n** if SQLite is unable to allocate memory to hold the [sqlite3] object,\r\n** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]\r\n** object.)^ ^(If the database is opened (and/or created) successfully, then\r\n** [SQLITE_OK] is returned.  Otherwise an [error code] is returned.)^ ^The\r\n** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain\r\n** an English language description of the error following a failure of any\r\n** of the sqlite3_open() routines.\r\n**\r\n** ^The default encoding for the database will be UTF-8 if\r\n** sqlite3_open() or sqlite3_open_v2() is called and\r\n** UTF-16 in the native byte order if sqlite3_open16() is used.\r\n**\r\n** Whether or not an error occurs when it is opened, resources\r\n** associated with the [database connection] handle should be released by\r\n** passing it to [sqlite3_close()] when it is no longer required.\r\n**\r\n** The sqlite3_open_v2() interface works like sqlite3_open()\r\n** except that it accepts two additional parameters for additional control\r\n** over the new database connection.  ^(The flags parameter to\r\n** sqlite3_open_v2() can take one of\r\n** the following three values, optionally combined with the \r\n** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],\r\n** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^\r\n**\r\n** <dl>\r\n** ^(<dt>[SQLITE_OPEN_READONLY]</dt>\r\n** <dd>The database is opened in read-only mode.  If the database does not\r\n** already exist, an error is returned.</dd>)^\r\n**\r\n** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>\r\n** <dd>The database is opened for reading and writing if possible, or reading\r\n** only if the file is write protected by the operating system.  In either\r\n** case the database must already exist, otherwise an error is returned.</dd>)^\r\n**\r\n** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>\r\n** <dd>The database is opened for reading and writing, and is created if\r\n** it does not already exist. This is the behavior that is always used for\r\n** sqlite3_open() and sqlite3_open16().</dd>)^\r\n** </dl>\r\n**\r\n** If the 3rd parameter to sqlite3_open_v2() is not one of the\r\n** combinations shown above optionally combined with other\r\n** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]\r\n** then the behavior is undefined.\r\n**\r\n** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection\r\n** opens in the multi-thread [threading mode] as long as the single-thread\r\n** mode has not been set at compile-time or start-time.  ^If the\r\n** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens\r\n** in the serialized [threading mode] unless single-thread was\r\n** previously selected at compile-time or start-time.\r\n** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be\r\n** eligible to use [shared cache mode], regardless of whether or not shared\r\n** cache is enabled using [sqlite3_enable_shared_cache()].  ^The\r\n** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not\r\n** participate in [shared cache mode] even if it is enabled.\r\n**\r\n** ^The fourth parameter to sqlite3_open_v2() is the name of the\r\n** [sqlite3_vfs] object that defines the operating system interface that\r\n** the new database connection should use.  ^If the fourth parameter is\r\n** a NULL pointer then the default [sqlite3_vfs] object is used.\r\n**\r\n** ^If the filename is \":memory:\", then a private, temporary in-memory database\r\n** is created for the connection.  ^This in-memory database will vanish when\r\n** the database connection is closed.  Future versions of SQLite might\r\n** make use of additional special filenames that begin with the \":\" character.\r\n** It is recommended that when a database filename actually does begin with\r\n** a \":\" character you should prefix the filename with a pathname such as\r\n** \"./\" to avoid ambiguity.\r\n**\r\n** ^If the filename is an empty string, then a private, temporary\r\n** on-disk database will be created.  ^This private database will be\r\n** automatically deleted as soon as the database connection is closed.\r\n**\r\n** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>\r\n**\r\n** ^If [URI filename] interpretation is enabled, and the filename argument\r\n** begins with \"file:\", then the filename is interpreted as a URI. ^URI\r\n** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is\r\n** set in the fourth argument to sqlite3_open_v2(), or if it has\r\n** been enabled globally using the [SQLITE_CONFIG_URI] option with the\r\n** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.\r\n** As of SQLite version 3.7.7, URI filename interpretation is turned off\r\n** by default, but future releases of SQLite might enable URI filename\r\n** interpretation by default.  See \"[URI filenames]\" for additional\r\n** information.\r\n**\r\n** URI filenames are parsed according to RFC 3986. ^If the URI contains an\r\n** authority, then it must be either an empty string or the string \r\n** \"localhost\". ^If the authority is not an empty string or \"localhost\", an \r\n** error is returned to the caller. ^The fragment component of a URI, if \r\n** present, is ignored.\r\n**\r\n** ^SQLite uses the path component of the URI as the name of the disk file\r\n** which contains the database. ^If the path begins with a '/' character, \r\n** then it is interpreted as an absolute path. ^If the path does not begin \r\n** with a '/' (meaning that the authority section is omitted from the URI)\r\n** then the path is interpreted as a relative path. \r\n** ^On windows, the first component of an absolute path \r\n** is a drive specification (e.g. \"C:\").\r\n**\r\n** [[core URI query parameters]]\r\n** The query component of a URI may contain parameters that are interpreted\r\n** either by SQLite itself, or by a [VFS | custom VFS implementation].\r\n** SQLite interprets the following three query parameters:\r\n**\r\n** <ul>\r\n**   <li> <b>vfs</b>: ^The \"vfs\" parameter may be used to specify the name of\r\n**     a VFS object that provides the operating system interface that should\r\n**     be used to access the database file on disk. ^If this option is set to\r\n**     an empty string the default VFS object is used. ^Specifying an unknown\r\n**     VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is\r\n**     present, then the VFS specified by the option takes precedence over\r\n**     the value passed as the fourth parameter to sqlite3_open_v2().\r\n**\r\n**   <li> <b>mode</b>: ^(The mode parameter may be set to either \"ro\", \"rw\" or\r\n**     \"rwc\". Attempting to set it to any other value is an error)^. \r\n**     ^If \"ro\" is specified, then the database is opened for read-only \r\n**     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the \r\n**     third argument to sqlite3_prepare_v2(). ^If the mode option is set to \r\n**     \"rw\", then the database is opened for read-write (but not create) \r\n**     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had \r\n**     been set. ^Value \"rwc\" is equivalent to setting both \r\n**     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If sqlite3_open_v2() is \r\n**     used, it is an error to specify a value for the mode parameter that is \r\n**     less restrictive than that specified by the flags passed as the third \r\n**     parameter.\r\n**\r\n**   <li> <b>cache</b>: ^The cache parameter may be set to either \"shared\" or\r\n**     \"private\". ^Setting it to \"shared\" is equivalent to setting the\r\n**     SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to\r\n**     sqlite3_open_v2(). ^Setting the cache parameter to \"private\" is \r\n**     equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.\r\n**     ^If sqlite3_open_v2() is used and the \"cache\" parameter is present in\r\n**     a URI filename, its value overrides any behaviour requested by setting\r\n**     SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.\r\n** </ul>\r\n**\r\n** ^Specifying an unknown parameter in the query component of a URI is not an\r\n** error.  Future versions of SQLite might understand additional query\r\n** parameters.  See \"[query parameters with special meaning to SQLite]\" for\r\n** additional information.\r\n**\r\n** [[URI filename examples]] <h3>URI filename examples</h3>\r\n**\r\n** <table border=\"1\" align=center cellpadding=5>\r\n** <tr><th> URI filenames <th> Results\r\n** <tr><td> file:data.db <td> \r\n**          Open the file \"data.db\" in the current directory.\r\n** <tr><td> file:/home/fred/data.db<br>\r\n**          file:///home/fred/data.db <br> \r\n**          file://localhost/home/fred/data.db <br> <td> \r\n**          Open the database file \"/home/fred/data.db\".\r\n** <tr><td> file://darkstar/home/fred/data.db <td> \r\n**          An error. \"darkstar\" is not a recognized authority.\r\n** <tr><td style=\"white-space:nowrap\"> \r\n**          file:///C:/Documents%20and%20Settings/fred/Desktop/data.db\r\n**     <td> Windows only: Open the file \"data.db\" on fred's desktop on drive\r\n**          C:. Note that the %20 escaping in this example is not strictly \r\n**          necessary - space characters can be used literally\r\n**          in URI filenames.\r\n** <tr><td> file:data.db?mode=ro&cache=private <td> \r\n**          Open file \"data.db\" in the current directory for read-only access.\r\n**          Regardless of whether or not shared-cache mode is enabled by\r\n**          default, use a private cache.\r\n** <tr><td> file:/home/fred/data.db?vfs=unix-nolock <td>\r\n**          Open file \"/home/fred/data.db\". Use the special VFS \"unix-nolock\".\r\n** <tr><td> file:data.db?mode=readonly <td> \r\n**          An error. \"readonly\" is not a valid option for the \"mode\" parameter.\r\n** </table>\r\n**\r\n** ^URI hexadecimal escape sequences (%HH) are supported within the path and\r\n** query components of a URI. A hexadecimal escape sequence consists of a\r\n** percent sign - \"%\" - followed by exactly two hexadecimal digits \r\n** specifying an octet value. ^Before the path or query components of a\r\n** URI filename are interpreted, they are encoded using UTF-8 and all \r\n** hexadecimal escape sequences replaced by a single byte containing the\r\n** corresponding octet. If this process generates an invalid UTF-8 encoding,\r\n** the results are undefined.\r\n**\r\n** <b>Note to Windows users:</b>  The encoding used for the filename argument\r\n** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever\r\n** codepage is currently defined.  Filenames containing international\r\n** characters must be converted to UTF-8 prior to passing them into\r\n** sqlite3_open() or sqlite3_open_v2().\r\n*/\r\nSQLITE_API int sqlite3_open(\r\n  const char *filename,   /* Database filename (UTF-8) */\r\n  sqlite3 **ppDb          /* OUT: SQLite db handle */\r\n);\r\nSQLITE_API int sqlite3_open16(\r\n  const void *filename,   /* Database filename (UTF-16) */\r\n  sqlite3 **ppDb          /* OUT: SQLite db handle */\r\n);\r\nSQLITE_API int sqlite3_open_v2(\r\n  const char *filename,   /* Database filename (UTF-8) */\r\n  sqlite3 **ppDb,         /* OUT: SQLite db handle */\r\n  int flags,              /* Flags */\r\n  const char *zVfs        /* Name of VFS module to use */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Obtain Values For URI Parameters\r\n**\r\n** These are utility routines, useful to VFS implementations, that check\r\n** to see if a database file was a URI that contained a specific query \r\n** parameter, and if so obtains the value of that query parameter.\r\n**\r\n** If F is the database filename pointer passed into the xOpen() method of \r\n** a VFS implementation when the flags parameter to xOpen() has one or \r\n** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and\r\n** P is the name of the query parameter, then\r\n** sqlite3_uri_parameter(F,P) returns the value of the P\r\n** parameter if it exists or a NULL pointer if P does not appear as a \r\n** query parameter on F.  If P is a query parameter of F\r\n** has no explicit value, then sqlite3_uri_parameter(F,P) returns\r\n** a pointer to an empty string.\r\n**\r\n** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean\r\n** parameter and returns true (1) or false (0) according to the value\r\n** of P.  The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the\r\n** value of query parameter P is one of \"yes\", \"true\", or \"on\" in any\r\n** case or if the value begins with a non-zero number.  The \r\n** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of\r\n** query parameter P is one of \"no\", \"false\", or \"off\" in any case or\r\n** if the value begins with a numeric zero.  If P is not a query\r\n** parameter on F or if the value of P is does not match any of the\r\n** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).\r\n**\r\n** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a\r\n** 64-bit signed integer and returns that integer, or D if P does not\r\n** exist.  If the value of P is something other than an integer, then\r\n** zero is returned.\r\n** \r\n** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and\r\n** sqlite3_uri_boolean(F,P,B) returns B.  If F is not a NULL pointer and\r\n** is not a database file pathname pointer that SQLite passed into the xOpen\r\n** VFS method, then the behavior of this routine is undefined and probably\r\n** undesirable.\r\n*/\r\nSQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);\r\nSQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);\r\nSQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);\r\n\r\n\r\n/*\r\n** CAPI3REF: Error Codes And Messages\r\n**\r\n** ^The sqlite3_errcode() interface returns the numeric [result code] or\r\n** [extended result code] for the most recent failed sqlite3_* API call\r\n** associated with a [database connection]. If a prior API call failed\r\n** but the most recent API call succeeded, the return value from\r\n** sqlite3_errcode() is undefined.  ^The sqlite3_extended_errcode()\r\n** interface is the same except that it always returns the \r\n** [extended result code] even when extended result codes are\r\n** disabled.\r\n**\r\n** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language\r\n** text that describes the error, as either UTF-8 or UTF-16 respectively.\r\n** ^(Memory to hold the error message string is managed internally.\r\n** The application does not need to worry about freeing the result.\r\n** However, the error string might be overwritten or deallocated by\r\n** subsequent calls to other SQLite interface functions.)^\r\n**\r\n** When the serialized [threading mode] is in use, it might be the\r\n** case that a second error occurs on a separate thread in between\r\n** the time of the first error and the call to these interfaces.\r\n** When that happens, the second error will be reported since these\r\n** interfaces always report the most recent result.  To avoid\r\n** this, each thread can obtain exclusive use of the [database connection] D\r\n** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning\r\n** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after\r\n** all calls to the interfaces listed here are completed.\r\n**\r\n** If an interface fails with SQLITE_MISUSE, that means the interface\r\n** was invoked incorrectly by the application.  In that case, the\r\n** error code and message may or may not be set.\r\n*/\r\nSQLITE_API int sqlite3_errcode(sqlite3 *db);\r\nSQLITE_API int sqlite3_extended_errcode(sqlite3 *db);\r\nSQLITE_API const char *sqlite3_errmsg(sqlite3*);\r\nSQLITE_API const void *sqlite3_errmsg16(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: SQL Statement Object\r\n** KEYWORDS: {prepared statement} {prepared statements}\r\n**\r\n** An instance of this object represents a single SQL statement.\r\n** This object is variously known as a \"prepared statement\" or a\r\n** \"compiled SQL statement\" or simply as a \"statement\".\r\n**\r\n** The life of a statement object goes something like this:\r\n**\r\n** <ol>\r\n** <li> Create the object using [sqlite3_prepare_v2()] or a related\r\n**      function.\r\n** <li> Bind values to [host parameters] using the sqlite3_bind_*()\r\n**      interfaces.\r\n** <li> Run the SQL by calling [sqlite3_step()] one or more times.\r\n** <li> Reset the statement using [sqlite3_reset()] then go back\r\n**      to step 2.  Do this zero or more times.\r\n** <li> Destroy the object using [sqlite3_finalize()].\r\n** </ol>\r\n**\r\n** Refer to documentation on individual methods above for additional\r\n** information.\r\n*/\r\ntypedef struct sqlite3_stmt sqlite3_stmt;\r\n\r\n/*\r\n** CAPI3REF: Run-time Limits\r\n**\r\n** ^(This interface allows the size of various constructs to be limited\r\n** on a connection by connection basis.  The first parameter is the\r\n** [database connection] whose limit is to be set or queried.  The\r\n** second parameter is one of the [limit categories] that define a\r\n** class of constructs to be size limited.  The third parameter is the\r\n** new limit for that construct.)^\r\n**\r\n** ^If the new limit is a negative number, the limit is unchanged.\r\n** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a \r\n** [limits | hard upper bound]\r\n** set at compile-time by a C preprocessor macro called\r\n** [limits | SQLITE_MAX_<i>NAME</i>].\r\n** (The \"_LIMIT_\" in the name is changed to \"_MAX_\".))^\r\n** ^Attempts to increase a limit above its hard upper bound are\r\n** silently truncated to the hard upper bound.\r\n**\r\n** ^Regardless of whether or not the limit was changed, the \r\n** [sqlite3_limit()] interface returns the prior value of the limit.\r\n** ^Hence, to find the current value of a limit without changing it,\r\n** simply invoke this interface with the third parameter set to -1.\r\n**\r\n** Run-time limits are intended for use in applications that manage\r\n** both their own internal database and also databases that are controlled\r\n** by untrusted external sources.  An example application might be a\r\n** web browser that has its own databases for storing history and\r\n** separate databases controlled by JavaScript applications downloaded\r\n** off the Internet.  The internal databases can be given the\r\n** large, default limits.  Databases managed by external sources can\r\n** be given much smaller limits designed to prevent a denial of service\r\n** attack.  Developers might also want to use the [sqlite3_set_authorizer()]\r\n** interface to further control untrusted SQL.  The size of the database\r\n** created by an untrusted script can be contained using the\r\n** [max_page_count] [PRAGMA].\r\n**\r\n** New run-time limit categories may be added in future releases.\r\n*/\r\nSQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);\r\n\r\n/*\r\n** CAPI3REF: Run-Time Limit Categories\r\n** KEYWORDS: {limit category} {*limit categories}\r\n**\r\n** These constants define various performance limits\r\n** that can be lowered at run-time using [sqlite3_limit()].\r\n** The synopsis of the meanings of the various limits is shown below.\r\n** Additional information is available at [limits | Limits in SQLite].\r\n**\r\n** <dl>\r\n** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>\r\n** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^\r\n**\r\n** [[SQLITE_LIMIT_SQL_LENGTH]] ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>\r\n** <dd>The maximum length of an SQL statement, in bytes.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_COLUMN]] ^(<dt>SQLITE_LIMIT_COLUMN</dt>\r\n** <dd>The maximum number of columns in a table definition or in the\r\n** result set of a [SELECT] or the maximum number of columns in an index\r\n** or in an ORDER BY or GROUP BY clause.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>\r\n** <dd>The maximum depth of the parse tree on any expression.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>\r\n** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>\r\n** <dd>The maximum number of instructions in a virtual machine program\r\n** used to implement an SQL statement.  This limit is not currently\r\n** enforced, though that might be added in some future release of\r\n** SQLite.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>\r\n** <dd>The maximum number of arguments on a function.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_ATTACHED]] ^(<dt>SQLITE_LIMIT_ATTACHED</dt>\r\n** <dd>The maximum number of [ATTACH | attached databases].)^</dd>\r\n**\r\n** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]\r\n** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>\r\n** <dd>The maximum length of the pattern argument to the [LIKE] or\r\n** [GLOB] operators.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_VARIABLE_NUMBER]]\r\n** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>\r\n** <dd>The maximum index number of any [parameter] in an SQL statement.)^\r\n**\r\n** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>\r\n** <dd>The maximum depth of recursion for triggers.</dd>)^\r\n** </dl>\r\n*/\r\n#define SQLITE_LIMIT_LENGTH                    0\r\n#define SQLITE_LIMIT_SQL_LENGTH                1\r\n#define SQLITE_LIMIT_COLUMN                    2\r\n#define SQLITE_LIMIT_EXPR_DEPTH                3\r\n#define SQLITE_LIMIT_COMPOUND_SELECT           4\r\n#define SQLITE_LIMIT_VDBE_OP                   5\r\n#define SQLITE_LIMIT_FUNCTION_ARG              6\r\n#define SQLITE_LIMIT_ATTACHED                  7\r\n#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8\r\n#define SQLITE_LIMIT_VARIABLE_NUMBER           9\r\n#define SQLITE_LIMIT_TRIGGER_DEPTH            10\r\n\r\n/*\r\n** CAPI3REF: Compiling An SQL Statement\r\n** KEYWORDS: {SQL statement compiler}\r\n**\r\n** To execute an SQL query, it must first be compiled into a byte-code\r\n** program using one of these routines.\r\n**\r\n** The first argument, \"db\", is a [database connection] obtained from a\r\n** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or\r\n** [sqlite3_open16()].  The database connection must not have been closed.\r\n**\r\n** The second argument, \"zSql\", is the statement to be compiled, encoded\r\n** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()\r\n** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()\r\n** use UTF-16.\r\n**\r\n** ^If the nByte argument is less than zero, then zSql is read up to the\r\n** first zero terminator. ^If nByte is non-negative, then it is the maximum\r\n** number of  bytes read from zSql.  ^When nByte is non-negative, the\r\n** zSql string ends at either the first '\\000' or '\\u0000' character or\r\n** the nByte-th byte, whichever comes first. If the caller knows\r\n** that the supplied string is nul-terminated, then there is a small\r\n** performance advantage to be gained by passing an nByte parameter that\r\n** is equal to the number of bytes in the input string <i>including</i>\r\n** the nul-terminator bytes as this saves SQLite from having to\r\n** make a copy of the input string.\r\n**\r\n** ^If pzTail is not NULL then *pzTail is made to point to the first byte\r\n** past the end of the first SQL statement in zSql.  These routines only\r\n** compile the first statement in zSql, so *pzTail is left pointing to\r\n** what remains uncompiled.\r\n**\r\n** ^*ppStmt is left pointing to a compiled [prepared statement] that can be\r\n** executed using [sqlite3_step()].  ^If there is an error, *ppStmt is set\r\n** to NULL.  ^If the input text contains no SQL (if the input is an empty\r\n** string or a comment) then *ppStmt is set to NULL.\r\n** The calling procedure is responsible for deleting the compiled\r\n** SQL statement using [sqlite3_finalize()] after it has finished with it.\r\n** ppStmt may not be NULL.\r\n**\r\n** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];\r\n** otherwise an [error code] is returned.\r\n**\r\n** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are\r\n** recommended for all new programs. The two older interfaces are retained\r\n** for backwards compatibility, but their use is discouraged.\r\n** ^In the \"v2\" interfaces, the prepared statement\r\n** that is returned (the [sqlite3_stmt] object) contains a copy of the\r\n** original SQL text. This causes the [sqlite3_step()] interface to\r\n** behave differently in three ways:\r\n**\r\n** <ol>\r\n** <li>\r\n** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it\r\n** always used to do, [sqlite3_step()] will automatically recompile the SQL\r\n** statement and try to run it again.\r\n** </li>\r\n**\r\n** <li>\r\n** ^When an error occurs, [sqlite3_step()] will return one of the detailed\r\n** [error codes] or [extended error codes].  ^The legacy behavior was that\r\n** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code\r\n** and the application would have to make a second call to [sqlite3_reset()]\r\n** in order to find the underlying cause of the problem. With the \"v2\" prepare\r\n** interfaces, the underlying reason for the error is returned immediately.\r\n** </li>\r\n**\r\n** <li>\r\n** ^If the specific value bound to [parameter | host parameter] in the \r\n** WHERE clause might influence the choice of query plan for a statement,\r\n** then the statement will be automatically recompiled, as if there had been \r\n** a schema change, on the first  [sqlite3_step()] call following any change\r\n** to the [sqlite3_bind_text | bindings] of that [parameter]. \r\n** ^The specific value of WHERE-clause [parameter] might influence the \r\n** choice of query plan if the parameter is the left-hand side of a [LIKE]\r\n** or [GLOB] operator or if the parameter is compared to an indexed column\r\n** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.\r\n** the \r\n** </li>\r\n** </ol>\r\n*/\r\nSQLITE_API int sqlite3_prepare(\r\n  sqlite3 *db,            /* Database handle */\r\n  const char *zSql,       /* SQL statement, UTF-8 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const char **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\nSQLITE_API int sqlite3_prepare_v2(\r\n  sqlite3 *db,            /* Database handle */\r\n  const char *zSql,       /* SQL statement, UTF-8 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const char **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\nSQLITE_API int sqlite3_prepare16(\r\n  sqlite3 *db,            /* Database handle */\r\n  const void *zSql,       /* SQL statement, UTF-16 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const void **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\nSQLITE_API int sqlite3_prepare16_v2(\r\n  sqlite3 *db,            /* Database handle */\r\n  const void *zSql,       /* SQL statement, UTF-16 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const void **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Retrieving Statement SQL\r\n**\r\n** ^This interface can be used to retrieve a saved copy of the original\r\n** SQL text used to create a [prepared statement] if that statement was\r\n** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].\r\n*/\r\nSQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Determine If An SQL Statement Writes The Database\r\n**\r\n** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if\r\n** and only if the [prepared statement] X makes no direct changes to\r\n** the content of the database file.\r\n**\r\n** Note that [application-defined SQL functions] or\r\n** [virtual tables] might change the database indirectly as a side effect.  \r\n** ^(For example, if an application defines a function \"eval()\" that \r\n** calls [sqlite3_exec()], then the following SQL statement would\r\n** change the database file through side-effects:\r\n**\r\n** <blockquote><pre>\r\n**    SELECT eval('DELETE FROM t1') FROM t2;\r\n** </pre></blockquote>\r\n**\r\n** But because the [SELECT] statement does not change the database file\r\n** directly, sqlite3_stmt_readonly() would still return true.)^\r\n**\r\n** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],\r\n** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,\r\n** since the statements themselves do not actually modify the database but\r\n** rather they control the timing of when other statements modify the \r\n** database.  ^The [ATTACH] and [DETACH] statements also cause\r\n** sqlite3_stmt_readonly() to return true since, while those statements\r\n** change the configuration of a database connection, they do not make \r\n** changes to the content of the database files on disk.\r\n*/\r\nSQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Determine If A Prepared Statement Has Been Reset\r\n**\r\n** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the\r\n** [prepared statement] S has been stepped at least once using \r\n** [sqlite3_step(S)] but has not run to completion and/or has not \r\n** been reset using [sqlite3_reset(S)].  ^The sqlite3_stmt_busy(S)\r\n** interface returns false if S is a NULL pointer.  If S is not a \r\n** NULL pointer and is not a pointer to a valid [prepared statement]\r\n** object, then the behavior is undefined and probably undesirable.\r\n**\r\n** This interface can be used in combination [sqlite3_next_stmt()]\r\n** to locate all prepared statements associated with a database \r\n** connection that are in need of being reset.  This can be used,\r\n** for example, in diagnostic routines to search for prepared \r\n** statements that are holding a transaction open.\r\n*/\r\nSQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Dynamically Typed Value Object\r\n** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}\r\n**\r\n** SQLite uses the sqlite3_value object to represent all values\r\n** that can be stored in a database table. SQLite uses dynamic typing\r\n** for the values it stores.  ^Values stored in sqlite3_value objects\r\n** can be integers, floating point values, strings, BLOBs, or NULL.\r\n**\r\n** An sqlite3_value object may be either \"protected\" or \"unprotected\".\r\n** Some interfaces require a protected sqlite3_value.  Other interfaces\r\n** will accept either a protected or an unprotected sqlite3_value.\r\n** Every interface that accepts sqlite3_value arguments specifies\r\n** whether or not it requires a protected sqlite3_value.\r\n**\r\n** The terms \"protected\" and \"unprotected\" refer to whether or not\r\n** a mutex is held.  An internal mutex is held for a protected\r\n** sqlite3_value object but no mutex is held for an unprotected\r\n** sqlite3_value object.  If SQLite is compiled to be single-threaded\r\n** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)\r\n** or if SQLite is run in one of reduced mutex modes \r\n** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]\r\n** then there is no distinction between protected and unprotected\r\n** sqlite3_value objects and they can be used interchangeably.  However,\r\n** for maximum code portability it is recommended that applications\r\n** still make the distinction between protected and unprotected\r\n** sqlite3_value objects even when not strictly required.\r\n**\r\n** ^The sqlite3_value objects that are passed as parameters into the\r\n** implementation of [application-defined SQL functions] are protected.\r\n** ^The sqlite3_value object returned by\r\n** [sqlite3_column_value()] is unprotected.\r\n** Unprotected sqlite3_value objects may only be used with\r\n** [sqlite3_result_value()] and [sqlite3_bind_value()].\r\n** The [sqlite3_value_blob | sqlite3_value_type()] family of\r\n** interfaces require protected sqlite3_value objects.\r\n*/\r\ntypedef struct Mem sqlite3_value;\r\n\r\n/*\r\n** CAPI3REF: SQL Function Context Object\r\n**\r\n** The context in which an SQL function executes is stored in an\r\n** sqlite3_context object.  ^A pointer to an sqlite3_context object\r\n** is always first parameter to [application-defined SQL functions].\r\n** The application-defined SQL function implementation will pass this\r\n** pointer through into calls to [sqlite3_result_int | sqlite3_result()],\r\n** [sqlite3_aggregate_context()], [sqlite3_user_data()],\r\n** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],\r\n** and/or [sqlite3_set_auxdata()].\r\n*/\r\ntypedef struct sqlite3_context sqlite3_context;\r\n\r\n/*\r\n** CAPI3REF: Binding Values To Prepared Statements\r\n** KEYWORDS: {host parameter} {host parameters} {host parameter name}\r\n** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}\r\n**\r\n** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,\r\n** literals may be replaced by a [parameter] that matches one of following\r\n** templates:\r\n**\r\n** <ul>\r\n** <li>  ?\r\n** <li>  ?NNN\r\n** <li>  :VVV\r\n** <li>  @VVV\r\n** <li>  $VVV\r\n** </ul>\r\n**\r\n** In the templates above, NNN represents an integer literal,\r\n** and VVV represents an alphanumeric identifier.)^  ^The values of these\r\n** parameters (also called \"host parameter names\" or \"SQL parameters\")\r\n** can be set using the sqlite3_bind_*() routines defined here.\r\n**\r\n** ^The first argument to the sqlite3_bind_*() routines is always\r\n** a pointer to the [sqlite3_stmt] object returned from\r\n** [sqlite3_prepare_v2()] or its variants.\r\n**\r\n** ^The second argument is the index of the SQL parameter to be set.\r\n** ^The leftmost SQL parameter has an index of 1.  ^When the same named\r\n** SQL parameter is used more than once, second and subsequent\r\n** occurrences have the same index as the first occurrence.\r\n** ^The index for named parameters can be looked up using the\r\n** [sqlite3_bind_parameter_index()] API if desired.  ^The index\r\n** for \"?NNN\" parameters is the value of NNN.\r\n** ^The NNN value must be between 1 and the [sqlite3_limit()]\r\n** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).\r\n**\r\n** ^The third argument is the value to bind to the parameter.\r\n**\r\n** ^(In those routines that have a fourth argument, its value is the\r\n** number of bytes in the parameter.  To be clear: the value is the\r\n** number of <u>bytes</u> in the value, not the number of characters.)^\r\n** ^If the fourth parameter is negative, the length of the string is\r\n** the number of bytes up to the first zero terminator.\r\n** If a non-negative fourth parameter is provided to sqlite3_bind_text()\r\n** or sqlite3_bind_text16() then that parameter must be the byte offset\r\n** where the NUL terminator would occur assuming the string were NUL\r\n** terminated.  If any NUL characters occur at byte offsets less than \r\n** the value of the fourth parameter then the resulting string value will\r\n** contain embedded NULs.  The result of expressions involving strings\r\n** with embedded NULs is undefined.\r\n**\r\n** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and\r\n** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or\r\n** string after SQLite has finished with it.  ^The destructor is called\r\n** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(),\r\n** sqlite3_bind_text(), or sqlite3_bind_text16() fails.  \r\n** ^If the fifth argument is\r\n** the special value [SQLITE_STATIC], then SQLite assumes that the\r\n** information is in static, unmanaged space and does not need to be freed.\r\n** ^If the fifth argument has the value [SQLITE_TRANSIENT], then\r\n** SQLite makes its own private copy of the data immediately, before\r\n** the sqlite3_bind_*() routine returns.\r\n**\r\n** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that\r\n** is filled with zeroes.  ^A zeroblob uses a fixed amount of memory\r\n** (just an integer to hold its size) while it is being processed.\r\n** Zeroblobs are intended to serve as placeholders for BLOBs whose\r\n** content is later written using\r\n** [sqlite3_blob_open | incremental BLOB I/O] routines.\r\n** ^A negative value for the zeroblob results in a zero-length BLOB.\r\n**\r\n** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer\r\n** for the [prepared statement] or with a prepared statement for which\r\n** [sqlite3_step()] has been called more recently than [sqlite3_reset()],\r\n** then the call will return [SQLITE_MISUSE].  If any sqlite3_bind_()\r\n** routine is passed a [prepared statement] that has been finalized, the\r\n** result is undefined and probably harmful.\r\n**\r\n** ^Bindings are not cleared by the [sqlite3_reset()] routine.\r\n** ^Unbound parameters are interpreted as NULL.\r\n**\r\n** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an\r\n** [error code] if anything goes wrong.\r\n** ^[SQLITE_RANGE] is returned if the parameter\r\n** index is out of range.  ^[SQLITE_NOMEM] is returned if malloc() fails.\r\n**\r\n** See also: [sqlite3_bind_parameter_count()],\r\n** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));\r\nSQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);\r\nSQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);\r\nSQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);\r\nSQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);\r\nSQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));\r\nSQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));\r\nSQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);\r\nSQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);\r\n\r\n/*\r\n** CAPI3REF: Number Of SQL Parameters\r\n**\r\n** ^This routine can be used to find the number of [SQL parameters]\r\n** in a [prepared statement].  SQL parameters are tokens of the\r\n** form \"?\", \"?NNN\", \":AAA\", \"$AAA\", or \"@AAA\" that serve as\r\n** placeholders for values that are [sqlite3_bind_blob | bound]\r\n** to the parameters at a later time.\r\n**\r\n** ^(This routine actually returns the index of the largest (rightmost)\r\n** parameter. For all forms except ?NNN, this will correspond to the\r\n** number of unique parameters.  If parameters of the ?NNN form are used,\r\n** there may be gaps in the list.)^\r\n**\r\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\r\n** [sqlite3_bind_parameter_name()], and\r\n** [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Name Of A Host Parameter\r\n**\r\n** ^The sqlite3_bind_parameter_name(P,N) interface returns\r\n** the name of the N-th [SQL parameter] in the [prepared statement] P.\r\n** ^(SQL parameters of the form \"?NNN\" or \":AAA\" or \"@AAA\" or \"$AAA\"\r\n** have a name which is the string \"?NNN\" or \":AAA\" or \"@AAA\" or \"$AAA\"\r\n** respectively.\r\n** In other words, the initial \":\" or \"$\" or \"@\" or \"?\"\r\n** is included as part of the name.)^\r\n** ^Parameters of the form \"?\" without a following integer have no name\r\n** and are referred to as \"nameless\" or \"anonymous parameters\".\r\n**\r\n** ^The first host parameter has an index of 1, not 0.\r\n**\r\n** ^If the value N is out of range or if the N-th parameter is\r\n** nameless, then NULL is returned.  ^The returned string is\r\n** always in UTF-8 encoding even if the named parameter was\r\n** originally specified as UTF-16 in [sqlite3_prepare16()] or\r\n** [sqlite3_prepare16_v2()].\r\n**\r\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\r\n** [sqlite3_bind_parameter_count()], and\r\n** [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);\r\n\r\n/*\r\n** CAPI3REF: Index Of A Parameter With A Given Name\r\n**\r\n** ^Return the index of an SQL parameter given its name.  ^The\r\n** index value returned is suitable for use as the second\r\n** parameter to [sqlite3_bind_blob|sqlite3_bind()].  ^A zero\r\n** is returned if no matching parameter is found.  ^The parameter\r\n** name must be given in UTF-8 even if the original statement\r\n** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].\r\n**\r\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\r\n** [sqlite3_bind_parameter_count()], and\r\n** [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);\r\n\r\n/*\r\n** CAPI3REF: Reset All Bindings On A Prepared Statement\r\n**\r\n** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset\r\n** the [sqlite3_bind_blob | bindings] on a [prepared statement].\r\n** ^Use this routine to reset all host parameters to NULL.\r\n*/\r\nSQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Number Of Columns In A Result Set\r\n**\r\n** ^Return the number of columns in the result set returned by the\r\n** [prepared statement]. ^This routine returns 0 if pStmt is an SQL\r\n** statement that does not return data (for example an [UPDATE]).\r\n**\r\n** See also: [sqlite3_data_count()]\r\n*/\r\nSQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Column Names In A Result Set\r\n**\r\n** ^These routines return the name assigned to a particular column\r\n** in the result set of a [SELECT] statement.  ^The sqlite3_column_name()\r\n** interface returns a pointer to a zero-terminated UTF-8 string\r\n** and sqlite3_column_name16() returns a pointer to a zero-terminated\r\n** UTF-16 string.  ^The first parameter is the [prepared statement]\r\n** that implements the [SELECT] statement. ^The second parameter is the\r\n** column number.  ^The leftmost column is number 0.\r\n**\r\n** ^The returned string pointer is valid until either the [prepared statement]\r\n** is destroyed by [sqlite3_finalize()] or until the statement is automatically\r\n** reprepared by the first call to [sqlite3_step()] for a particular run\r\n** or until the next call to\r\n** sqlite3_column_name() or sqlite3_column_name16() on the same column.\r\n**\r\n** ^If sqlite3_malloc() fails during the processing of either routine\r\n** (for example during a conversion from UTF-8 to UTF-16) then a\r\n** NULL pointer is returned.\r\n**\r\n** ^The name of a result column is the value of the \"AS\" clause for\r\n** that column, if there is an AS clause.  If there is no AS clause\r\n** then the name of the column is unspecified and may change from\r\n** one release of SQLite to the next.\r\n*/\r\nSQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);\r\nSQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);\r\n\r\n/*\r\n** CAPI3REF: Source Of Data In A Query Result\r\n**\r\n** ^These routines provide a means to determine the database, table, and\r\n** table column that is the origin of a particular result column in\r\n** [SELECT] statement.\r\n** ^The name of the database or table or column can be returned as\r\n** either a UTF-8 or UTF-16 string.  ^The _database_ routines return\r\n** the database name, the _table_ routines return the table name, and\r\n** the origin_ routines return the column name.\r\n** ^The returned string is valid until the [prepared statement] is destroyed\r\n** using [sqlite3_finalize()] or until the statement is automatically\r\n** reprepared by the first call to [sqlite3_step()] for a particular run\r\n** or until the same information is requested\r\n** again in a different encoding.\r\n**\r\n** ^The names returned are the original un-aliased names of the\r\n** database, table, and column.\r\n**\r\n** ^The first argument to these interfaces is a [prepared statement].\r\n** ^These functions return information about the Nth result column returned by\r\n** the statement, where N is the second function argument.\r\n** ^The left-most column is column 0 for these routines.\r\n**\r\n** ^If the Nth column returned by the statement is an expression or\r\n** subquery and is not a column value, then all of these functions return\r\n** NULL.  ^These routine might also return NULL if a memory allocation error\r\n** occurs.  ^Otherwise, they return the name of the attached database, table,\r\n** or column that query result column was extracted from.\r\n**\r\n** ^As with all other SQLite APIs, those whose names end with \"16\" return\r\n** UTF-16 encoded strings and the other functions return UTF-8.\r\n**\r\n** ^These APIs are only available if the library was compiled with the\r\n** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.\r\n**\r\n** If two or more threads call one or more of these routines against the same\r\n** prepared statement and column at the same time then the results are\r\n** undefined.\r\n**\r\n** If two or more threads call one or more\r\n** [sqlite3_column_database_name | column metadata interfaces]\r\n** for the same [prepared statement] and result column\r\n** at the same time then the results are undefined.\r\n*/\r\nSQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);\r\nSQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);\r\nSQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);\r\n\r\n/*\r\n** CAPI3REF: Declared Datatype Of A Query Result\r\n**\r\n** ^(The first parameter is a [prepared statement].\r\n** If this statement is a [SELECT] statement and the Nth column of the\r\n** returned result set of that [SELECT] is a table column (not an\r\n** expression or subquery) then the declared type of the table\r\n** column is returned.)^  ^If the Nth column of the result set is an\r\n** expression or subquery, then a NULL pointer is returned.\r\n** ^The returned string is always UTF-8 encoded.\r\n**\r\n** ^(For example, given the database schema:\r\n**\r\n** CREATE TABLE t1(c1 VARIANT);\r\n**\r\n** and the following statement to be compiled:\r\n**\r\n** SELECT c1 + 1, c1 FROM t1;\r\n**\r\n** this routine would return the string \"VARIANT\" for the second result\r\n** column (i==1), and a NULL pointer for the first result column (i==0).)^\r\n**\r\n** ^SQLite uses dynamic run-time typing.  ^So just because a column\r\n** is declared to contain a particular type does not mean that the\r\n** data stored in that column is of the declared type.  SQLite is\r\n** strongly typed, but the typing is dynamic not static.  ^Type\r\n** is associated with individual values, not with the containers\r\n** used to hold those values.\r\n*/\r\nSQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);\r\n\r\n/*\r\n** CAPI3REF: Evaluate An SQL Statement\r\n**\r\n** After a [prepared statement] has been prepared using either\r\n** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy\r\n** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function\r\n** must be called one or more times to evaluate the statement.\r\n**\r\n** The details of the behavior of the sqlite3_step() interface depend\r\n** on whether the statement was prepared using the newer \"v2\" interface\r\n** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy\r\n** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the\r\n** new \"v2\" interface is recommended for new applications but the legacy\r\n** interface will continue to be supported.\r\n**\r\n** ^In the legacy interface, the return value will be either [SQLITE_BUSY],\r\n** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].\r\n** ^With the \"v2\" interface, any of the other [result codes] or\r\n** [extended result codes] might be returned as well.\r\n**\r\n** ^[SQLITE_BUSY] means that the database engine was unable to acquire the\r\n** database locks it needs to do its job.  ^If the statement is a [COMMIT]\r\n** or occurs outside of an explicit transaction, then you can retry the\r\n** statement.  If the statement is not a [COMMIT] and occurs within an\r\n** explicit transaction then you should rollback the transaction before\r\n** continuing.\r\n**\r\n** ^[SQLITE_DONE] means that the statement has finished executing\r\n** successfully.  sqlite3_step() should not be called again on this virtual\r\n** machine without first calling [sqlite3_reset()] to reset the virtual\r\n** machine back to its initial state.\r\n**\r\n** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]\r\n** is returned each time a new row of data is ready for processing by the\r\n** caller. The values may be accessed using the [column access functions].\r\n** sqlite3_step() is called again to retrieve the next row of data.\r\n**\r\n** ^[SQLITE_ERROR] means that a run-time error (such as a constraint\r\n** violation) has occurred.  sqlite3_step() should not be called again on\r\n** the VM. More information may be found by calling [sqlite3_errmsg()].\r\n** ^With the legacy interface, a more specific error code (for example,\r\n** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)\r\n** can be obtained by calling [sqlite3_reset()] on the\r\n** [prepared statement].  ^In the \"v2\" interface,\r\n** the more specific error code is returned directly by sqlite3_step().\r\n**\r\n** [SQLITE_MISUSE] means that the this routine was called inappropriately.\r\n** Perhaps it was called on a [prepared statement] that has\r\n** already been [sqlite3_finalize | finalized] or on one that had\r\n** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could\r\n** be the case that the same database connection is being used by two or\r\n** more threads at the same moment in time.\r\n**\r\n** For all versions of SQLite up to and including 3.6.23.1, a call to\r\n** [sqlite3_reset()] was required after sqlite3_step() returned anything\r\n** other than [SQLITE_ROW] before any subsequent invocation of\r\n** sqlite3_step().  Failure to reset the prepared statement using \r\n** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from\r\n** sqlite3_step().  But after version 3.6.23.1, sqlite3_step() began\r\n** calling [sqlite3_reset()] automatically in this circumstance rather\r\n** than returning [SQLITE_MISUSE].  This is not considered a compatibility\r\n** break because any application that ever receives an SQLITE_MISUSE error\r\n** is broken by definition.  The [SQLITE_OMIT_AUTORESET] compile-time option\r\n** can be used to restore the legacy behavior.\r\n**\r\n** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()\r\n** API always returns a generic error code, [SQLITE_ERROR], following any\r\n** error other than [SQLITE_BUSY] and [SQLITE_MISUSE].  You must call\r\n** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the\r\n** specific [error codes] that better describes the error.\r\n** We admit that this is a goofy design.  The problem has been fixed\r\n** with the \"v2\" interface.  If you prepare all of your SQL statements\r\n** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead\r\n** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,\r\n** then the more specific [error codes] are returned directly\r\n** by sqlite3_step().  The use of the \"v2\" interface is recommended.\r\n*/\r\nSQLITE_API int sqlite3_step(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Number of columns in a result set\r\n**\r\n** ^The sqlite3_data_count(P) interface returns the number of columns in the\r\n** current row of the result set of [prepared statement] P.\r\n** ^If prepared statement P does not have results ready to return\r\n** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of\r\n** interfaces) then sqlite3_data_count(P) returns 0.\r\n** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.\r\n** ^The sqlite3_data_count(P) routine returns 0 if the previous call to\r\n** [sqlite3_step](P) returned [SQLITE_DONE].  ^The sqlite3_data_count(P)\r\n** will return non-zero if previous call to [sqlite3_step](P) returned\r\n** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]\r\n** where it always returns zero since each step of that multi-step\r\n** pragma returns 0 columns of data.\r\n**\r\n** See also: [sqlite3_column_count()]\r\n*/\r\nSQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Fundamental Datatypes\r\n** KEYWORDS: SQLITE_TEXT\r\n**\r\n** ^(Every value in SQLite has one of five fundamental datatypes:\r\n**\r\n** <ul>\r\n** <li> 64-bit signed integer\r\n** <li> 64-bit IEEE floating point number\r\n** <li> string\r\n** <li> BLOB\r\n** <li> NULL\r\n** </ul>)^\r\n**\r\n** These constants are codes for each of those types.\r\n**\r\n** Note that the SQLITE_TEXT constant was also used in SQLite version 2\r\n** for a completely different meaning.  Software that links against both\r\n** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not\r\n** SQLITE_TEXT.\r\n*/\r\n#define SQLITE_INTEGER  1\r\n#define SQLITE_FLOAT    2\r\n#define SQLITE_BLOB     4\r\n#define SQLITE_NULL     5\r\n#ifdef SQLITE_TEXT\r\n# undef SQLITE_TEXT\r\n#else\r\n# define SQLITE_TEXT     3\r\n#endif\r\n#define SQLITE3_TEXT     3\r\n\r\n/*\r\n** CAPI3REF: Result Values From A Query\r\n** KEYWORDS: {column access functions}\r\n**\r\n** These routines form the \"result set\" interface.\r\n**\r\n** ^These routines return information about a single column of the current\r\n** result row of a query.  ^In every case the first argument is a pointer\r\n** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]\r\n** that was returned from [sqlite3_prepare_v2()] or one of its variants)\r\n** and the second argument is the index of the column for which information\r\n** should be returned. ^The leftmost column of the result set has the index 0.\r\n** ^The number of columns in the result can be determined using\r\n** [sqlite3_column_count()].\r\n**\r\n** If the SQL statement does not currently point to a valid row, or if the\r\n** column index is out of range, the result is undefined.\r\n** These routines may only be called when the most recent call to\r\n** [sqlite3_step()] has returned [SQLITE_ROW] and neither\r\n** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.\r\n** If any of these routines are called after [sqlite3_reset()] or\r\n** [sqlite3_finalize()] or after [sqlite3_step()] has returned\r\n** something other than [SQLITE_ROW], the results are undefined.\r\n** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]\r\n** are called from a different thread while any of these routines\r\n** are pending, then the results are undefined.\r\n**\r\n** ^The sqlite3_column_type() routine returns the\r\n** [SQLITE_INTEGER | datatype code] for the initial data type\r\n** of the result column.  ^The returned value is one of [SQLITE_INTEGER],\r\n** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value\r\n** returned by sqlite3_column_type() is only meaningful if no type\r\n** conversions have occurred as described below.  After a type conversion,\r\n** the value returned by sqlite3_column_type() is undefined.  Future\r\n** versions of SQLite may change the behavior of sqlite3_column_type()\r\n** following a type conversion.\r\n**\r\n** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()\r\n** routine returns the number of bytes in that BLOB or string.\r\n** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts\r\n** the string to UTF-8 and then returns the number of bytes.\r\n** ^If the result is a numeric value then sqlite3_column_bytes() uses\r\n** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns\r\n** the number of bytes in that string.\r\n** ^If the result is NULL, then sqlite3_column_bytes() returns zero.\r\n**\r\n** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()\r\n** routine returns the number of bytes in that BLOB or string.\r\n** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts\r\n** the string to UTF-16 and then returns the number of bytes.\r\n** ^If the result is a numeric value then sqlite3_column_bytes16() uses\r\n** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns\r\n** the number of bytes in that string.\r\n** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.\r\n**\r\n** ^The values returned by [sqlite3_column_bytes()] and \r\n** [sqlite3_column_bytes16()] do not include the zero terminators at the end\r\n** of the string.  ^For clarity: the values returned by\r\n** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of\r\n** bytes in the string, not the number of characters.\r\n**\r\n** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),\r\n** even empty strings, are always zero-terminated.  ^The return\r\n** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.\r\n**\r\n** ^The object returned by [sqlite3_column_value()] is an\r\n** [unprotected sqlite3_value] object.  An unprotected sqlite3_value object\r\n** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].\r\n** If the [unprotected sqlite3_value] object returned by\r\n** [sqlite3_column_value()] is used in any other way, including calls\r\n** to routines like [sqlite3_value_int()], [sqlite3_value_text()],\r\n** or [sqlite3_value_bytes()], then the behavior is undefined.\r\n**\r\n** These routines attempt to convert the value where appropriate.  ^For\r\n** example, if the internal representation is FLOAT and a text result\r\n** is requested, [sqlite3_snprintf()] is used internally to perform the\r\n** conversion automatically.  ^(The following table details the conversions\r\n** that are applied:\r\n**\r\n** <blockquote>\r\n** <table border=\"1\">\r\n** <tr><th> Internal<br>Type <th> Requested<br>Type <th>  Conversion\r\n**\r\n** <tr><td>  NULL    <td> INTEGER   <td> Result is 0\r\n** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0\r\n** <tr><td>  NULL    <td>   TEXT    <td> Result is NULL pointer\r\n** <tr><td>  NULL    <td>   BLOB    <td> Result is NULL pointer\r\n** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float\r\n** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer\r\n** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT\r\n** <tr><td>  FLOAT   <td> INTEGER   <td> Convert from float to integer\r\n** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float\r\n** <tr><td>  FLOAT   <td>   BLOB    <td> Same as FLOAT->TEXT\r\n** <tr><td>  TEXT    <td> INTEGER   <td> Use atoi()\r\n** <tr><td>  TEXT    <td>  FLOAT    <td> Use atof()\r\n** <tr><td>  TEXT    <td>   BLOB    <td> No change\r\n** <tr><td>  BLOB    <td> INTEGER   <td> Convert to TEXT then use atoi()\r\n** <tr><td>  BLOB    <td>  FLOAT    <td> Convert to TEXT then use atof()\r\n** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed\r\n** </table>\r\n** </blockquote>)^\r\n**\r\n** The table above makes reference to standard C library functions atoi()\r\n** and atof().  SQLite does not really use these functions.  It has its\r\n** own equivalent internal routines.  The atoi() and atof() names are\r\n** used in the table for brevity and because they are familiar to most\r\n** C programmers.\r\n**\r\n** Note that when type conversions occur, pointers returned by prior\r\n** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or\r\n** sqlite3_column_text16() may be invalidated.\r\n** Type conversions and pointer invalidations might occur\r\n** in the following cases:\r\n**\r\n** <ul>\r\n** <li> The initial content is a BLOB and sqlite3_column_text() or\r\n**      sqlite3_column_text16() is called.  A zero-terminator might\r\n**      need to be added to the string.</li>\r\n** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or\r\n**      sqlite3_column_text16() is called.  The content must be converted\r\n**      to UTF-16.</li>\r\n** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or\r\n**      sqlite3_column_text() is called.  The content must be converted\r\n**      to UTF-8.</li>\r\n** </ul>\r\n**\r\n** ^Conversions between UTF-16be and UTF-16le are always done in place and do\r\n** not invalidate a prior pointer, though of course the content of the buffer\r\n** that the prior pointer references will have been modified.  Other kinds\r\n** of conversion are done in place when it is possible, but sometimes they\r\n** are not possible and in those cases prior pointers are invalidated.\r\n**\r\n** The safest and easiest to remember policy is to invoke these routines\r\n** in one of the following ways:\r\n**\r\n** <ul>\r\n**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>\r\n**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>\r\n**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>\r\n** </ul>\r\n**\r\n** In other words, you should call sqlite3_column_text(),\r\n** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result\r\n** into the desired format, then invoke sqlite3_column_bytes() or\r\n** sqlite3_column_bytes16() to find the size of the result.  Do not mix calls\r\n** to sqlite3_column_text() or sqlite3_column_blob() with calls to\r\n** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()\r\n** with calls to sqlite3_column_bytes().\r\n**\r\n** ^The pointers returned are valid until a type conversion occurs as\r\n** described above, or until [sqlite3_step()] or [sqlite3_reset()] or\r\n** [sqlite3_finalize()] is called.  ^The memory space used to hold strings\r\n** and BLOBs is freed automatically.  Do <b>not</b> pass the pointers returned\r\n** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into\r\n** [sqlite3_free()].\r\n**\r\n** ^(If a memory allocation error occurs during the evaluation of any\r\n** of these routines, a default value is returned.  The default value\r\n** is either the integer 0, the floating point number 0.0, or a NULL\r\n** pointer.  Subsequent calls to [sqlite3_errcode()] will return\r\n** [SQLITE_NOMEM].)^\r\n*/\r\nSQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);\r\nSQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);\r\nSQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);\r\nSQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);\r\nSQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);\r\nSQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);\r\n\r\n/*\r\n** CAPI3REF: Destroy A Prepared Statement Object\r\n**\r\n** ^The sqlite3_finalize() function is called to delete a [prepared statement].\r\n** ^If the most recent evaluation of the statement encountered no errors\r\n** or if the statement is never been evaluated, then sqlite3_finalize() returns\r\n** SQLITE_OK.  ^If the most recent evaluation of statement S failed, then\r\n** sqlite3_finalize(S) returns the appropriate [error code] or\r\n** [extended error code].\r\n**\r\n** ^The sqlite3_finalize(S) routine can be called at any point during\r\n** the life cycle of [prepared statement] S:\r\n** before statement S is ever evaluated, after\r\n** one or more calls to [sqlite3_reset()], or after any call\r\n** to [sqlite3_step()] regardless of whether or not the statement has\r\n** completed execution.\r\n**\r\n** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.\r\n**\r\n** The application must finalize every [prepared statement] in order to avoid\r\n** resource leaks.  It is a grievous error for the application to try to use\r\n** a prepared statement after it has been finalized.  Any use of a prepared\r\n** statement after it has been finalized can result in undefined and\r\n** undesirable behavior such as segfaults and heap corruption.\r\n*/\r\nSQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Reset A Prepared Statement Object\r\n**\r\n** The sqlite3_reset() function is called to reset a [prepared statement]\r\n** object back to its initial state, ready to be re-executed.\r\n** ^Any SQL statement variables that had values bound to them using\r\n** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.\r\n** Use [sqlite3_clear_bindings()] to reset the bindings.\r\n**\r\n** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S\r\n** back to the beginning of its program.\r\n**\r\n** ^If the most recent call to [sqlite3_step(S)] for the\r\n** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],\r\n** or if [sqlite3_step(S)] has never before been called on S,\r\n** then [sqlite3_reset(S)] returns [SQLITE_OK].\r\n**\r\n** ^If the most recent call to [sqlite3_step(S)] for the\r\n** [prepared statement] S indicated an error, then\r\n** [sqlite3_reset(S)] returns an appropriate [error code].\r\n**\r\n** ^The [sqlite3_reset(S)] interface does not change the values\r\n** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.\r\n*/\r\nSQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Create Or Redefine SQL Functions\r\n** KEYWORDS: {function creation routines}\r\n** KEYWORDS: {application-defined SQL function}\r\n** KEYWORDS: {application-defined SQL functions}\r\n**\r\n** ^These functions (collectively known as \"function creation routines\")\r\n** are used to add SQL functions or aggregates or to redefine the behavior\r\n** of existing SQL functions or aggregates.  The only differences between\r\n** these routines are the text encoding expected for\r\n** the second parameter (the name of the function being created)\r\n** and the presence or absence of a destructor callback for\r\n** the application data pointer.\r\n**\r\n** ^The first parameter is the [database connection] to which the SQL\r\n** function is to be added.  ^If an application uses more than one database\r\n** connection then application-defined SQL functions must be added\r\n** to each database connection separately.\r\n**\r\n** ^The second parameter is the name of the SQL function to be created or\r\n** redefined.  ^The length of the name is limited to 255 bytes in a UTF-8\r\n** representation, exclusive of the zero-terminator.  ^Note that the name\r\n** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.  \r\n** ^Any attempt to create a function with a longer name\r\n** will result in [SQLITE_MISUSE] being returned.\r\n**\r\n** ^The third parameter (nArg)\r\n** is the number of arguments that the SQL function or\r\n** aggregate takes. ^If this parameter is -1, then the SQL function or\r\n** aggregate may take any number of arguments between 0 and the limit\r\n** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]).  If the third\r\n** parameter is less than -1 or greater than 127 then the behavior is\r\n** undefined.\r\n**\r\n** ^The fourth parameter, eTextRep, specifies what\r\n** [SQLITE_UTF8 | text encoding] this SQL function prefers for\r\n** its parameters.  Every SQL function implementation must be able to work\r\n** with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be\r\n** more efficient with one encoding than another.  ^An application may\r\n** invoke sqlite3_create_function() or sqlite3_create_function16() multiple\r\n** times with the same function but with different values of eTextRep.\r\n** ^When multiple implementations of the same function are available, SQLite\r\n** will pick the one that involves the least amount of data conversion.\r\n** If there is only a single implementation which does not care what text\r\n** encoding is used, then the fourth argument should be [SQLITE_ANY].\r\n**\r\n** ^(The fifth parameter is an arbitrary pointer.  The implementation of the\r\n** function can gain access to this pointer using [sqlite3_user_data()].)^\r\n**\r\n** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are\r\n** pointers to C-language functions that implement the SQL function or\r\n** aggregate. ^A scalar SQL function requires an implementation of the xFunc\r\n** callback only; NULL pointers must be passed as the xStep and xFinal\r\n** parameters. ^An aggregate SQL function requires an implementation of xStep\r\n** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing\r\n** SQL function or aggregate, pass NULL pointers for all three function\r\n** callbacks.\r\n**\r\n** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,\r\n** then it is destructor for the application data pointer. \r\n** The destructor is invoked when the function is deleted, either by being\r\n** overloaded or when the database connection closes.)^\r\n** ^The destructor is also invoked if the call to\r\n** sqlite3_create_function_v2() fails.\r\n** ^When the destructor callback of the tenth parameter is invoked, it\r\n** is passed a single argument which is a copy of the application data \r\n** pointer which was the fifth parameter to sqlite3_create_function_v2().\r\n**\r\n** ^It is permitted to register multiple implementations of the same\r\n** functions with the same name but with either differing numbers of\r\n** arguments or differing preferred text encodings.  ^SQLite will use\r\n** the implementation that most closely matches the way in which the\r\n** SQL function is used.  ^A function implementation with a non-negative\r\n** nArg parameter is a better match than a function implementation with\r\n** a negative nArg.  ^A function where the preferred text encoding\r\n** matches the database encoding is a better\r\n** match than a function where the encoding is different.  \r\n** ^A function where the encoding difference is between UTF16le and UTF16be\r\n** is a closer match than a function where the encoding difference is\r\n** between UTF8 and UTF16.\r\n**\r\n** ^Built-in functions may be overloaded by new application-defined functions.\r\n**\r\n** ^An application-defined function is permitted to call other\r\n** SQLite interfaces.  However, such calls must not\r\n** close the database connection nor finalize or reset the prepared\r\n** statement in which the function is running.\r\n*/\r\nSQLITE_API int sqlite3_create_function(\r\n  sqlite3 *db,\r\n  const char *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *pApp,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*)\r\n);\r\nSQLITE_API int sqlite3_create_function16(\r\n  sqlite3 *db,\r\n  const void *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *pApp,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*)\r\n);\r\nSQLITE_API int sqlite3_create_function_v2(\r\n  sqlite3 *db,\r\n  const char *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *pApp,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*),\r\n  void(*xDestroy)(void*)\r\n);\r\n\r\n/*\r\n** CAPI3REF: Text Encodings\r\n**\r\n** These constant define integer codes that represent the various\r\n** text encodings supported by SQLite.\r\n*/\r\n#define SQLITE_UTF8           1\r\n#define SQLITE_UTF16LE        2\r\n#define SQLITE_UTF16BE        3\r\n#define SQLITE_UTF16          4    /* Use native byte order */\r\n#define SQLITE_ANY            5    /* sqlite3_create_function only */\r\n#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */\r\n\r\n/*\r\n** CAPI3REF: Deprecated Functions\r\n** DEPRECATED\r\n**\r\n** These functions are [deprecated].  In order to maintain\r\n** backwards compatibility with older code, these functions continue \r\n** to be supported.  However, new applications should avoid\r\n** the use of these functions.  To help encourage people to avoid\r\n** using these functions, we are not going to tell you what they do.\r\n*/\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);\r\nSQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Obtaining SQL Function Parameter Values\r\n**\r\n** The C-language implementation of SQL functions and aggregates uses\r\n** this set of interface routines to access the parameter values on\r\n** the function or aggregate.\r\n**\r\n** The xFunc (for scalar functions) or xStep (for aggregates) parameters\r\n** to [sqlite3_create_function()] and [sqlite3_create_function16()]\r\n** define callbacks that implement the SQL functions and aggregates.\r\n** The 3rd parameter to these callbacks is an array of pointers to\r\n** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for\r\n** each parameter to the SQL function.  These routines are used to\r\n** extract values from the [sqlite3_value] objects.\r\n**\r\n** These routines work only with [protected sqlite3_value] objects.\r\n** Any attempt to use these routines on an [unprotected sqlite3_value]\r\n** object results in undefined behavior.\r\n**\r\n** ^These routines work just like the corresponding [column access functions]\r\n** except that  these routines take a single [protected sqlite3_value] object\r\n** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.\r\n**\r\n** ^The sqlite3_value_text16() interface extracts a UTF-16 string\r\n** in the native byte-order of the host machine.  ^The\r\n** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces\r\n** extract UTF-16 strings as big-endian and little-endian respectively.\r\n**\r\n** ^(The sqlite3_value_numeric_type() interface attempts to apply\r\n** numeric affinity to the value.  This means that an attempt is\r\n** made to convert the value to an integer or floating point.  If\r\n** such a conversion is possible without loss of information (in other\r\n** words, if the value is a string that looks like a number)\r\n** then the conversion is performed.  Otherwise no conversion occurs.\r\n** The [SQLITE_INTEGER | datatype] after conversion is returned.)^\r\n**\r\n** Please pay particular attention to the fact that the pointer returned\r\n** from [sqlite3_value_blob()], [sqlite3_value_text()], or\r\n** [sqlite3_value_text16()] can be invalidated by a subsequent call to\r\n** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],\r\n** or [sqlite3_value_text16()].\r\n**\r\n** These routines must be called from the same thread as\r\n** the SQL function that supplied the [sqlite3_value*] parameters.\r\n*/\r\nSQLITE_API const void *sqlite3_value_blob(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_bytes(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_bytes16(sqlite3_value*);\r\nSQLITE_API double sqlite3_value_double(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_int(sqlite3_value*);\r\nSQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);\r\nSQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);\r\nSQLITE_API const void *sqlite3_value_text16(sqlite3_value*);\r\nSQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);\r\nSQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_type(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);\r\n\r\n/*\r\n** CAPI3REF: Obtain Aggregate Function Context\r\n**\r\n** Implementations of aggregate SQL functions use this\r\n** routine to allocate memory for storing their state.\r\n**\r\n** ^The first time the sqlite3_aggregate_context(C,N) routine is called \r\n** for a particular aggregate function, SQLite\r\n** allocates N of memory, zeroes out that memory, and returns a pointer\r\n** to the new memory. ^On second and subsequent calls to\r\n** sqlite3_aggregate_context() for the same aggregate function instance,\r\n** the same buffer is returned.  Sqlite3_aggregate_context() is normally\r\n** called once for each invocation of the xStep callback and then one\r\n** last time when the xFinal callback is invoked.  ^(When no rows match\r\n** an aggregate query, the xStep() callback of the aggregate function\r\n** implementation is never called and xFinal() is called exactly once.\r\n** In those cases, sqlite3_aggregate_context() might be called for the\r\n** first time from within xFinal().)^\r\n**\r\n** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is\r\n** less than or equal to zero or if a memory allocate error occurs.\r\n**\r\n** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is\r\n** determined by the N parameter on first successful call.  Changing the\r\n** value of N in subsequent call to sqlite3_aggregate_context() within\r\n** the same aggregate function instance will not resize the memory\r\n** allocation.)^\r\n**\r\n** ^SQLite automatically frees the memory allocated by \r\n** sqlite3_aggregate_context() when the aggregate query concludes.\r\n**\r\n** The first parameter must be a copy of the\r\n** [sqlite3_context | SQL function context] that is the first parameter\r\n** to the xStep or xFinal callback routine that implements the aggregate\r\n** function.\r\n**\r\n** This routine must be called from the same thread in which\r\n** the aggregate SQL function is running.\r\n*/\r\nSQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);\r\n\r\n/*\r\n** CAPI3REF: User Data For Functions\r\n**\r\n** ^The sqlite3_user_data() interface returns a copy of\r\n** the pointer that was the pUserData parameter (the 5th parameter)\r\n** of the [sqlite3_create_function()]\r\n** and [sqlite3_create_function16()] routines that originally\r\n** registered the application defined function.\r\n**\r\n** This routine must be called from the same thread in which\r\n** the application-defined function is running.\r\n*/\r\nSQLITE_API void *sqlite3_user_data(sqlite3_context*);\r\n\r\n/*\r\n** CAPI3REF: Database Connection For Functions\r\n**\r\n** ^The sqlite3_context_db_handle() interface returns a copy of\r\n** the pointer to the [database connection] (the 1st parameter)\r\n** of the [sqlite3_create_function()]\r\n** and [sqlite3_create_function16()] routines that originally\r\n** registered the application defined function.\r\n*/\r\nSQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);\r\n\r\n/*\r\n** CAPI3REF: Function Auxiliary Data\r\n**\r\n** The following two functions may be used by scalar SQL functions to\r\n** associate metadata with argument values. If the same value is passed to\r\n** multiple invocations of the same SQL function during query execution, under\r\n** some circumstances the associated metadata may be preserved. This may\r\n** be used, for example, to add a regular-expression matching scalar\r\n** function. The compiled version of the regular expression is stored as\r\n** metadata associated with the SQL value passed as the regular expression\r\n** pattern.  The compiled regular expression can be reused on multiple\r\n** invocations of the same function so that the original pattern string\r\n** does not need to be recompiled on each invocation.\r\n**\r\n** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata\r\n** associated by the sqlite3_set_auxdata() function with the Nth argument\r\n** value to the application-defined function. ^If no metadata has been ever\r\n** been set for the Nth argument of the function, or if the corresponding\r\n** function parameter has changed since the meta-data was set,\r\n** then sqlite3_get_auxdata() returns a NULL pointer.\r\n**\r\n** ^The sqlite3_set_auxdata() interface saves the metadata\r\n** pointed to by its 3rd parameter as the metadata for the N-th\r\n** argument of the application-defined function.  Subsequent\r\n** calls to sqlite3_get_auxdata() might return this data, if it has\r\n** not been destroyed.\r\n** ^If it is not NULL, SQLite will invoke the destructor\r\n** function given by the 4th parameter to sqlite3_set_auxdata() on\r\n** the metadata when the corresponding function parameter changes\r\n** or when the SQL statement completes, whichever comes first.\r\n**\r\n** SQLite is free to call the destructor and drop metadata on any\r\n** parameter of any function at any time.  ^The only guarantee is that\r\n** the destructor will be called before the metadata is dropped.\r\n**\r\n** ^(In practice, metadata is preserved between function calls for\r\n** expressions that are constant at compile time. This includes literal\r\n** values and [parameters].)^\r\n**\r\n** These routines must be called from the same thread in which\r\n** the SQL function is running.\r\n*/\r\nSQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);\r\nSQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));\r\n\r\n\r\n/*\r\n** CAPI3REF: Constants Defining Special Destructor Behavior\r\n**\r\n** These are special values for the destructor that is passed in as the\r\n** final argument to routines like [sqlite3_result_blob()].  ^If the destructor\r\n** argument is SQLITE_STATIC, it means that the content pointer is constant\r\n** and will never change.  It does not need to be destroyed.  ^The\r\n** SQLITE_TRANSIENT value means that the content will likely change in\r\n** the near future and that SQLite should make its own private copy of\r\n** the content before returning.\r\n**\r\n** The typedef is necessary to work around problems in certain\r\n** C++ compilers.  See ticket #2191.\r\n*/\r\ntypedef void (*sqlite3_destructor_type)(void*);\r\n#define SQLITE_STATIC      ((sqlite3_destructor_type)0)\r\n#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)\r\n\r\n/*\r\n** CAPI3REF: Setting The Result Of An SQL Function\r\n**\r\n** These routines are used by the xFunc or xFinal callbacks that\r\n** implement SQL functions and aggregates.  See\r\n** [sqlite3_create_function()] and [sqlite3_create_function16()]\r\n** for additional information.\r\n**\r\n** These functions work very much like the [parameter binding] family of\r\n** functions used to bind values to host parameters in prepared statements.\r\n** Refer to the [SQL parameter] documentation for additional information.\r\n**\r\n** ^The sqlite3_result_blob() interface sets the result from\r\n** an application-defined function to be the BLOB whose content is pointed\r\n** to by the second parameter and which is N bytes long where N is the\r\n** third parameter.\r\n**\r\n** ^The sqlite3_result_zeroblob() interfaces set the result of\r\n** the application-defined function to be a BLOB containing all zero\r\n** bytes and N bytes in size, where N is the value of the 2nd parameter.\r\n**\r\n** ^The sqlite3_result_double() interface sets the result from\r\n** an application-defined function to be a floating point value specified\r\n** by its 2nd argument.\r\n**\r\n** ^The sqlite3_result_error() and sqlite3_result_error16() functions\r\n** cause the implemented SQL function to throw an exception.\r\n** ^SQLite uses the string pointed to by the\r\n** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()\r\n** as the text of an error message.  ^SQLite interprets the error\r\n** message string from sqlite3_result_error() as UTF-8. ^SQLite\r\n** interprets the string from sqlite3_result_error16() as UTF-16 in native\r\n** byte order.  ^If the third parameter to sqlite3_result_error()\r\n** or sqlite3_result_error16() is negative then SQLite takes as the error\r\n** message all text up through the first zero character.\r\n** ^If the third parameter to sqlite3_result_error() or\r\n** sqlite3_result_error16() is non-negative then SQLite takes that many\r\n** bytes (not characters) from the 2nd parameter as the error message.\r\n** ^The sqlite3_result_error() and sqlite3_result_error16()\r\n** routines make a private copy of the error message text before\r\n** they return.  Hence, the calling function can deallocate or\r\n** modify the text after they return without harm.\r\n** ^The sqlite3_result_error_code() function changes the error code\r\n** returned by SQLite as a result of an error in a function.  ^By default,\r\n** the error code is SQLITE_ERROR.  ^A subsequent call to sqlite3_result_error()\r\n** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.\r\n**\r\n** ^The sqlite3_result_toobig() interface causes SQLite to throw an error\r\n** indicating that a string or BLOB is too long to represent.\r\n**\r\n** ^The sqlite3_result_nomem() interface causes SQLite to throw an error\r\n** indicating that a memory allocation failed.\r\n**\r\n** ^The sqlite3_result_int() interface sets the return value\r\n** of the application-defined function to be the 32-bit signed integer\r\n** value given in the 2nd argument.\r\n** ^The sqlite3_result_int64() interface sets the return value\r\n** of the application-defined function to be the 64-bit signed integer\r\n** value given in the 2nd argument.\r\n**\r\n** ^The sqlite3_result_null() interface sets the return value\r\n** of the application-defined function to be NULL.\r\n**\r\n** ^The sqlite3_result_text(), sqlite3_result_text16(),\r\n** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces\r\n** set the return value of the application-defined function to be\r\n** a text string which is represented as UTF-8, UTF-16 native byte order,\r\n** UTF-16 little endian, or UTF-16 big endian, respectively.\r\n** ^SQLite takes the text result from the application from\r\n** the 2nd parameter of the sqlite3_result_text* interfaces.\r\n** ^If the 3rd parameter to the sqlite3_result_text* interfaces\r\n** is negative, then SQLite takes result text from the 2nd parameter\r\n** through the first zero character.\r\n** ^If the 3rd parameter to the sqlite3_result_text* interfaces\r\n** is non-negative, then as many bytes (not characters) of the text\r\n** pointed to by the 2nd parameter are taken as the application-defined\r\n** function result.  If the 3rd parameter is non-negative, then it\r\n** must be the byte offset into the string where the NUL terminator would\r\n** appear if the string where NUL terminated.  If any NUL characters occur\r\n** in the string at a byte offset that is less than the value of the 3rd\r\n** parameter, then the resulting string will contain embedded NULs and the\r\n** result of expressions operating on strings with embedded NULs is undefined.\r\n** ^If the 4th parameter to the sqlite3_result_text* interfaces\r\n** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that\r\n** function as the destructor on the text or BLOB result when it has\r\n** finished using that result.\r\n** ^If the 4th parameter to the sqlite3_result_text* interfaces or to\r\n** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite\r\n** assumes that the text or BLOB result is in constant space and does not\r\n** copy the content of the parameter nor call a destructor on the content\r\n** when it has finished using that result.\r\n** ^If the 4th parameter to the sqlite3_result_text* interfaces\r\n** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT\r\n** then SQLite makes a copy of the result into space obtained from\r\n** from [sqlite3_malloc()] before it returns.\r\n**\r\n** ^The sqlite3_result_value() interface sets the result of\r\n** the application-defined function to be a copy the\r\n** [unprotected sqlite3_value] object specified by the 2nd parameter.  ^The\r\n** sqlite3_result_value() interface makes a copy of the [sqlite3_value]\r\n** so that the [sqlite3_value] specified in the parameter may change or\r\n** be deallocated after sqlite3_result_value() returns without harm.\r\n** ^A [protected sqlite3_value] object may always be used where an\r\n** [unprotected sqlite3_value] object is required, so either\r\n** kind of [sqlite3_value] object can be used with this interface.\r\n**\r\n** If these routines are called from within the different thread\r\n** than the one containing the application-defined function that received\r\n** the [sqlite3_context] pointer, the results are undefined.\r\n*/\r\nSQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));\r\nSQLITE_API void sqlite3_result_double(sqlite3_context*, double);\r\nSQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);\r\nSQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);\r\nSQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);\r\nSQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);\r\nSQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);\r\nSQLITE_API void sqlite3_result_int(sqlite3_context*, int);\r\nSQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);\r\nSQLITE_API void sqlite3_result_null(sqlite3_context*);\r\nSQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));\r\nSQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));\r\nSQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));\r\nSQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));\r\nSQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);\r\nSQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);\r\n\r\n/*\r\n** CAPI3REF: Define New Collating Sequences\r\n**\r\n** ^These functions add, remove, or modify a [collation] associated\r\n** with the [database connection] specified as the first argument.\r\n**\r\n** ^The name of the collation is a UTF-8 string\r\n** for sqlite3_create_collation() and sqlite3_create_collation_v2()\r\n** and a UTF-16 string in native byte order for sqlite3_create_collation16().\r\n** ^Collation names that compare equal according to [sqlite3_strnicmp()] are\r\n** considered to be the same name.\r\n**\r\n** ^(The third argument (eTextRep) must be one of the constants:\r\n** <ul>\r\n** <li> [SQLITE_UTF8],\r\n** <li> [SQLITE_UTF16LE],\r\n** <li> [SQLITE_UTF16BE],\r\n** <li> [SQLITE_UTF16], or\r\n** <li> [SQLITE_UTF16_ALIGNED].\r\n** </ul>)^\r\n** ^The eTextRep argument determines the encoding of strings passed\r\n** to the collating function callback, xCallback.\r\n** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep\r\n** force strings to be UTF16 with native byte order.\r\n** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin\r\n** on an even byte address.\r\n**\r\n** ^The fourth argument, pArg, is an application data pointer that is passed\r\n** through as the first argument to the collating function callback.\r\n**\r\n** ^The fifth argument, xCallback, is a pointer to the collating function.\r\n** ^Multiple collating functions can be registered using the same name but\r\n** with different eTextRep parameters and SQLite will use whichever\r\n** function requires the least amount of data transformation.\r\n** ^If the xCallback argument is NULL then the collating function is\r\n** deleted.  ^When all collating functions having the same name are deleted,\r\n** that collation is no longer usable.\r\n**\r\n** ^The collating function callback is invoked with a copy of the pArg \r\n** application data pointer and with two strings in the encoding specified\r\n** by the eTextRep argument.  The collating function must return an\r\n** integer that is negative, zero, or positive\r\n** if the first string is less than, equal to, or greater than the second,\r\n** respectively.  A collating function must always return the same answer\r\n** given the same inputs.  If two or more collating functions are registered\r\n** to the same collation name (using different eTextRep values) then all\r\n** must give an equivalent answer when invoked with equivalent strings.\r\n** The collating function must obey the following properties for all\r\n** strings A, B, and C:\r\n**\r\n** <ol>\r\n** <li> If A==B then B==A.\r\n** <li> If A==B and B==C then A==C.\r\n** <li> If A&lt;B THEN B&gt;A.\r\n** <li> If A&lt;B and B&lt;C then A&lt;C.\r\n** </ol>\r\n**\r\n** If a collating function fails any of the above constraints and that\r\n** collating function is  registered and used, then the behavior of SQLite\r\n** is undefined.\r\n**\r\n** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()\r\n** with the addition that the xDestroy callback is invoked on pArg when\r\n** the collating function is deleted.\r\n** ^Collating functions are deleted when they are overridden by later\r\n** calls to the collation creation functions or when the\r\n** [database connection] is closed using [sqlite3_close()].\r\n**\r\n** ^The xDestroy callback is <u>not</u> called if the \r\n** sqlite3_create_collation_v2() function fails.  Applications that invoke\r\n** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should \r\n** check the return code and dispose of the application data pointer\r\n** themselves rather than expecting SQLite to deal with it for them.\r\n** This is different from every other SQLite interface.  The inconsistency \r\n** is unfortunate but cannot be changed without breaking backwards \r\n** compatibility.\r\n**\r\n** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].\r\n*/\r\nSQLITE_API int sqlite3_create_collation(\r\n  sqlite3*, \r\n  const char *zName, \r\n  int eTextRep, \r\n  void *pArg,\r\n  int(*xCompare)(void*,int,const void*,int,const void*)\r\n);\r\nSQLITE_API int sqlite3_create_collation_v2(\r\n  sqlite3*, \r\n  const char *zName, \r\n  int eTextRep, \r\n  void *pArg,\r\n  int(*xCompare)(void*,int,const void*,int,const void*),\r\n  void(*xDestroy)(void*)\r\n);\r\nSQLITE_API int sqlite3_create_collation16(\r\n  sqlite3*, \r\n  const void *zName,\r\n  int eTextRep, \r\n  void *pArg,\r\n  int(*xCompare)(void*,int,const void*,int,const void*)\r\n);\r\n\r\n/*\r\n** CAPI3REF: Collation Needed Callbacks\r\n**\r\n** ^To avoid having to register all collation sequences before a database\r\n** can be used, a single callback function may be registered with the\r\n** [database connection] to be invoked whenever an undefined collation\r\n** sequence is required.\r\n**\r\n** ^If the function is registered using the sqlite3_collation_needed() API,\r\n** then it is passed the names of undefined collation sequences as strings\r\n** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,\r\n** the names are passed as UTF-16 in machine native byte order.\r\n** ^A call to either function replaces the existing collation-needed callback.\r\n**\r\n** ^(When the callback is invoked, the first argument passed is a copy\r\n** of the second argument to sqlite3_collation_needed() or\r\n** sqlite3_collation_needed16().  The second argument is the database\r\n** connection.  The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],\r\n** or [SQLITE_UTF16LE], indicating the most desirable form of the collation\r\n** sequence function required.  The fourth parameter is the name of the\r\n** required collation sequence.)^\r\n**\r\n** The callback function should register the desired collation using\r\n** [sqlite3_create_collation()], [sqlite3_create_collation16()], or\r\n** [sqlite3_create_collation_v2()].\r\n*/\r\nSQLITE_API int sqlite3_collation_needed(\r\n  sqlite3*, \r\n  void*, \r\n  void(*)(void*,sqlite3*,int eTextRep,const char*)\r\n);\r\nSQLITE_API int sqlite3_collation_needed16(\r\n  sqlite3*, \r\n  void*,\r\n  void(*)(void*,sqlite3*,int eTextRep,const void*)\r\n);\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n/*\r\n** Specify the key for an encrypted database.  This routine should be\r\n** called right after sqlite3_open().\r\n**\r\n** The code to implement this API is not available in the public release\r\n** of SQLite.\r\n*/\r\nSQLITE_API int sqlite3_key(\r\n  sqlite3 *db,                   /* Database to be rekeyed */\r\n  const void *pKey, int nKey     /* The key */\r\n);\r\n\r\n/*\r\n** Change the key on an open database.  If the current database is not\r\n** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the\r\n** database is decrypted.\r\n**\r\n** The code to implement this API is not available in the public release\r\n** of SQLite.\r\n*/\r\nSQLITE_API int sqlite3_rekey(\r\n  sqlite3 *db,                   /* Database to be rekeyed */\r\n  const void *pKey, int nKey     /* The new key */\r\n);\r\n\r\n/*\r\n** Specify the activation key for a SEE database.  Unless \r\n** activated, none of the SEE routines will work.\r\n*/\r\nSQLITE_API void sqlite3_activate_see(\r\n  const char *zPassPhrase        /* Activation phrase */\r\n);\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_CEROD\r\n/*\r\n** Specify the activation key for a CEROD database.  Unless \r\n** activated, none of the CEROD routines will work.\r\n*/\r\nSQLITE_API void sqlite3_activate_cerod(\r\n  const char *zPassPhrase        /* Activation phrase */\r\n);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Suspend Execution For A Short Time\r\n**\r\n** The sqlite3_sleep() function causes the current thread to suspend execution\r\n** for at least a number of milliseconds specified in its parameter.\r\n**\r\n** If the operating system does not support sleep requests with\r\n** millisecond time resolution, then the time will be rounded up to\r\n** the nearest second. The number of milliseconds of sleep actually\r\n** requested from the operating system is returned.\r\n**\r\n** ^SQLite implements this interface by calling the xSleep()\r\n** method of the default [sqlite3_vfs] object.  If the xSleep() method\r\n** of the default VFS is not implemented correctly, or not implemented at\r\n** all, then the behavior of sqlite3_sleep() may deviate from the description\r\n** in the previous paragraphs.\r\n*/\r\nSQLITE_API int sqlite3_sleep(int);\r\n\r\n/*\r\n** CAPI3REF: Name Of The Folder Holding Temporary Files\r\n**\r\n** ^(If this global variable is made to point to a string which is\r\n** the name of a folder (a.k.a. directory), then all temporary files\r\n** created by SQLite when using a built-in [sqlite3_vfs | VFS]\r\n** will be placed in that directory.)^  ^If this variable\r\n** is a NULL pointer, then SQLite performs a search for an appropriate\r\n** temporary file directory.\r\n**\r\n** It is not safe to read or modify this variable in more than one\r\n** thread at a time.  It is not safe to read or modify this variable\r\n** if a [database connection] is being used at the same time in a separate\r\n** thread.\r\n** It is intended that this variable be set once\r\n** as part of process initialization and before any SQLite interface\r\n** routines have been called and that this variable remain unchanged\r\n** thereafter.\r\n**\r\n** ^The [temp_store_directory pragma] may modify this variable and cause\r\n** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,\r\n** the [temp_store_directory pragma] always assumes that any string\r\n** that this variable points to is held in memory obtained from \r\n** [sqlite3_malloc] and the pragma may attempt to free that memory\r\n** using [sqlite3_free].\r\n** Hence, if this variable is modified directly, either it should be\r\n** made NULL or made to point to memory obtained from [sqlite3_malloc]\r\n** or else the use of the [temp_store_directory pragma] should be avoided.\r\n*/\r\nSQLITE_API char *sqlite3_temp_directory;\r\n\r\n/*\r\n** CAPI3REF: Test For Auto-Commit Mode\r\n** KEYWORDS: {autocommit mode}\r\n**\r\n** ^The sqlite3_get_autocommit() interface returns non-zero or\r\n** zero if the given database connection is or is not in autocommit mode,\r\n** respectively.  ^Autocommit mode is on by default.\r\n** ^Autocommit mode is disabled by a [BEGIN] statement.\r\n** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].\r\n**\r\n** If certain kinds of errors occur on a statement within a multi-statement\r\n** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],\r\n** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the\r\n** transaction might be rolled back automatically.  The only way to\r\n** find out whether SQLite automatically rolled back the transaction after\r\n** an error is to use this function.\r\n**\r\n** If another thread changes the autocommit status of the database\r\n** connection while this routine is running, then the return value\r\n** is undefined.\r\n*/\r\nSQLITE_API int sqlite3_get_autocommit(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Find The Database Handle Of A Prepared Statement\r\n**\r\n** ^The sqlite3_db_handle interface returns the [database connection] handle\r\n** to which a [prepared statement] belongs.  ^The [database connection]\r\n** returned by sqlite3_db_handle is the same [database connection]\r\n** that was the first argument\r\n** to the [sqlite3_prepare_v2()] call (or its variants) that was used to\r\n** create the statement in the first place.\r\n*/\r\nSQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Return The Filename For A Database Connection\r\n**\r\n** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename\r\n** associated with database N of connection D.  ^The main database file\r\n** has the name \"main\".  If there is no attached database N on the database\r\n** connection D, or if database N is a temporary or in-memory database, then\r\n** a NULL pointer is returned.\r\n**\r\n** ^The filename returned by this function is the output of the\r\n** xFullPathname method of the [VFS].  ^In other words, the filename\r\n** will be an absolute pathname, even if the filename used\r\n** to open the database originally was a URI or relative pathname.\r\n*/\r\nSQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);\r\n\r\n/*\r\n** CAPI3REF: Determine if a database is read-only\r\n**\r\n** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N\r\n** of connection D is read-only, 0 if it is read/write, or -1 if N is not\r\n** the name of a database on connection D.\r\n*/\r\nSQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);\r\n\r\n/*\r\n** CAPI3REF: Find the next prepared statement\r\n**\r\n** ^This interface returns a pointer to the next [prepared statement] after\r\n** pStmt associated with the [database connection] pDb.  ^If pStmt is NULL\r\n** then this interface returns a pointer to the first prepared statement\r\n** associated with the database connection pDb.  ^If no prepared statement\r\n** satisfies the conditions of this routine, it returns NULL.\r\n**\r\n** The [database connection] pointer D in a call to\r\n** [sqlite3_next_stmt(D,S)] must refer to an open database\r\n** connection and in particular must not be a NULL pointer.\r\n*/\r\nSQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Commit And Rollback Notification Callbacks\r\n**\r\n** ^The sqlite3_commit_hook() interface registers a callback\r\n** function to be invoked whenever a transaction is [COMMIT | committed].\r\n** ^Any callback set by a previous call to sqlite3_commit_hook()\r\n** for the same database connection is overridden.\r\n** ^The sqlite3_rollback_hook() interface registers a callback\r\n** function to be invoked whenever a transaction is [ROLLBACK | rolled back].\r\n** ^Any callback set by a previous call to sqlite3_rollback_hook()\r\n** for the same database connection is overridden.\r\n** ^The pArg argument is passed through to the callback.\r\n** ^If the callback on a commit hook function returns non-zero,\r\n** then the commit is converted into a rollback.\r\n**\r\n** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions\r\n** return the P argument from the previous call of the same function\r\n** on the same [database connection] D, or NULL for\r\n** the first call for each function on D.\r\n**\r\n** The commit and rollback hook callbacks are not reentrant.\r\n** The callback implementation must not do anything that will modify\r\n** the database connection that invoked the callback.  Any actions\r\n** to modify the database connection must be deferred until after the\r\n** completion of the [sqlite3_step()] call that triggered the commit\r\n** or rollback hook in the first place.\r\n** Note that running any other SQL statements, including SELECT statements,\r\n** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify\r\n** the database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n** ^Registering a NULL function disables the callback.\r\n**\r\n** ^When the commit hook callback routine returns zero, the [COMMIT]\r\n** operation is allowed to continue normally.  ^If the commit hook\r\n** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].\r\n** ^The rollback hook is invoked on a rollback that results from a commit\r\n** hook returning non-zero, just as it would be with any other rollback.\r\n**\r\n** ^For the purposes of this API, a transaction is said to have been\r\n** rolled back if an explicit \"ROLLBACK\" statement is executed, or\r\n** an error or constraint causes an implicit rollback to occur.\r\n** ^The rollback callback is not invoked if a transaction is\r\n** automatically rolled back because the database connection is closed.\r\n**\r\n** See also the [sqlite3_update_hook()] interface.\r\n*/\r\nSQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);\r\nSQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);\r\n\r\n/*\r\n** CAPI3REF: Data Change Notification Callbacks\r\n**\r\n** ^The sqlite3_update_hook() interface registers a callback function\r\n** with the [database connection] identified by the first argument\r\n** to be invoked whenever a row is updated, inserted or deleted.\r\n** ^Any callback set by a previous call to this function\r\n** for the same database connection is overridden.\r\n**\r\n** ^The second argument is a pointer to the function to invoke when a\r\n** row is updated, inserted or deleted.\r\n** ^The first argument to the callback is a copy of the third argument\r\n** to sqlite3_update_hook().\r\n** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],\r\n** or [SQLITE_UPDATE], depending on the operation that caused the callback\r\n** to be invoked.\r\n** ^The third and fourth arguments to the callback contain pointers to the\r\n** database and table name containing the affected row.\r\n** ^The final callback parameter is the [rowid] of the row.\r\n** ^In the case of an update, this is the [rowid] after the update takes place.\r\n**\r\n** ^(The update hook is not invoked when internal system tables are\r\n** modified (i.e. sqlite_master and sqlite_sequence).)^\r\n**\r\n** ^In the current implementation, the update hook\r\n** is not invoked when duplication rows are deleted because of an\r\n** [ON CONFLICT | ON CONFLICT REPLACE] clause.  ^Nor is the update hook\r\n** invoked when rows are deleted using the [truncate optimization].\r\n** The exceptions defined in this paragraph might change in a future\r\n** release of SQLite.\r\n**\r\n** The update hook implementation must not do anything that will modify\r\n** the database connection that invoked the update hook.  Any actions\r\n** to modify the database connection must be deferred until after the\r\n** completion of the [sqlite3_step()] call that triggered the update hook.\r\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\r\n** database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n** ^The sqlite3_update_hook(D,C,P) function\r\n** returns the P argument from the previous call\r\n** on the same [database connection] D, or NULL for\r\n** the first call on D.\r\n**\r\n** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]\r\n** interfaces.\r\n*/\r\nSQLITE_API void *sqlite3_update_hook(\r\n  sqlite3*, \r\n  void(*)(void *,int ,char const *,char const *,sqlite3_int64),\r\n  void*\r\n);\r\n\r\n/*\r\n** CAPI3REF: Enable Or Disable Shared Pager Cache\r\n** KEYWORDS: {shared cache}\r\n**\r\n** ^(This routine enables or disables the sharing of the database cache\r\n** and schema data structures between [database connection | connections]\r\n** to the same database. Sharing is enabled if the argument is true\r\n** and disabled if the argument is false.)^\r\n**\r\n** ^Cache sharing is enabled and disabled for an entire process.\r\n** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,\r\n** sharing was enabled or disabled for each thread separately.\r\n**\r\n** ^(The cache sharing mode set by this interface effects all subsequent\r\n** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].\r\n** Existing database connections continue use the sharing mode\r\n** that was in effect at the time they were opened.)^\r\n**\r\n** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled\r\n** successfully.  An [error code] is returned otherwise.)^\r\n**\r\n** ^Shared cache is disabled by default. But this might change in\r\n** future releases of SQLite.  Applications that care about shared\r\n** cache setting should set it explicitly.\r\n**\r\n** See Also:  [SQLite Shared-Cache Mode]\r\n*/\r\nSQLITE_API int sqlite3_enable_shared_cache(int);\r\n\r\n/*\r\n** CAPI3REF: Attempt To Free Heap Memory\r\n**\r\n** ^The sqlite3_release_memory() interface attempts to free N bytes\r\n** of heap memory by deallocating non-essential memory allocations\r\n** held by the database library.   Memory used to cache database\r\n** pages to improve performance is an example of non-essential memory.\r\n** ^sqlite3_release_memory() returns the number of bytes actually freed,\r\n** which might be more or less than the amount requested.\r\n** ^The sqlite3_release_memory() routine is a no-op returning zero\r\n** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].\r\n**\r\n** See also: [sqlite3_db_release_memory()]\r\n*/\r\nSQLITE_API int sqlite3_release_memory(int);\r\n\r\n/*\r\n** CAPI3REF: Free Memory Used By A Database Connection\r\n**\r\n** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap\r\n** memory as possible from database connection D. Unlike the\r\n** [sqlite3_release_memory()] interface, this interface is effect even\r\n** when then [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is\r\n** omitted.\r\n**\r\n** See also: [sqlite3_release_memory()]\r\n*/\r\nSQLITE_API int sqlite3_db_release_memory(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Impose A Limit On Heap Size\r\n**\r\n** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the\r\n** soft limit on the amount of heap memory that may be allocated by SQLite.\r\n** ^SQLite strives to keep heap memory utilization below the soft heap\r\n** limit by reducing the number of pages held in the page cache\r\n** as heap memory usages approaches the limit.\r\n** ^The soft heap limit is \"soft\" because even though SQLite strives to stay\r\n** below the limit, it will exceed the limit rather than generate\r\n** an [SQLITE_NOMEM] error.  In other words, the soft heap limit \r\n** is advisory only.\r\n**\r\n** ^The return value from sqlite3_soft_heap_limit64() is the size of\r\n** the soft heap limit prior to the call, or negative in the case of an\r\n** error.  ^If the argument N is negative\r\n** then no change is made to the soft heap limit.  Hence, the current\r\n** size of the soft heap limit can be determined by invoking\r\n** sqlite3_soft_heap_limit64() with a negative argument.\r\n**\r\n** ^If the argument N is zero then the soft heap limit is disabled.\r\n**\r\n** ^(The soft heap limit is not enforced in the current implementation\r\n** if one or more of following conditions are true:\r\n**\r\n** <ul>\r\n** <li> The soft heap limit is set to zero.\r\n** <li> Memory accounting is disabled using a combination of the\r\n**      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and\r\n**      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.\r\n** <li> An alternative page cache implementation is specified using\r\n**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).\r\n** <li> The page cache allocates from its own memory pool supplied\r\n**      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than\r\n**      from the heap.\r\n** </ul>)^\r\n**\r\n** Beginning with SQLite version 3.7.3, the soft heap limit is enforced\r\n** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]\r\n** compile-time option is invoked.  With [SQLITE_ENABLE_MEMORY_MANAGEMENT],\r\n** the soft heap limit is enforced on every memory allocation.  Without\r\n** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced\r\n** when memory is allocated by the page cache.  Testing suggests that because\r\n** the page cache is the predominate memory user in SQLite, most\r\n** applications will achieve adequate soft heap limit enforcement without\r\n** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].\r\n**\r\n** The circumstances under which SQLite will enforce the soft heap limit may\r\n** changes in future releases of SQLite.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);\r\n\r\n/*\r\n** CAPI3REF: Deprecated Soft Heap Limit Interface\r\n** DEPRECATED\r\n**\r\n** This is a deprecated version of the [sqlite3_soft_heap_limit64()]\r\n** interface.  This routine is provided for historical compatibility\r\n** only.  All new applications should use the\r\n** [sqlite3_soft_heap_limit64()] interface rather than this one.\r\n*/\r\nSQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);\r\n\r\n\r\n/*\r\n** CAPI3REF: Extract Metadata About A Column Of A Table\r\n**\r\n** ^This routine returns metadata about a specific column of a specific\r\n** database table accessible using the [database connection] handle\r\n** passed as the first function argument.\r\n**\r\n** ^The column is identified by the second, third and fourth parameters to\r\n** this function. ^The second parameter is either the name of the database\r\n** (i.e. \"main\", \"temp\", or an attached database) containing the specified\r\n** table or NULL. ^If it is NULL, then all attached databases are searched\r\n** for the table using the same algorithm used by the database engine to\r\n** resolve unqualified table references.\r\n**\r\n** ^The third and fourth parameters to this function are the table and column\r\n** name of the desired column, respectively. Neither of these parameters\r\n** may be NULL.\r\n**\r\n** ^Metadata is returned by writing to the memory locations passed as the 5th\r\n** and subsequent parameters to this function. ^Any of these arguments may be\r\n** NULL, in which case the corresponding element of metadata is omitted.\r\n**\r\n** ^(<blockquote>\r\n** <table border=\"1\">\r\n** <tr><th> Parameter <th> Output<br>Type <th>  Description\r\n**\r\n** <tr><td> 5th <td> const char* <td> Data type\r\n** <tr><td> 6th <td> const char* <td> Name of default collation sequence\r\n** <tr><td> 7th <td> int         <td> True if column has a NOT NULL constraint\r\n** <tr><td> 8th <td> int         <td> True if column is part of the PRIMARY KEY\r\n** <tr><td> 9th <td> int         <td> True if column is [AUTOINCREMENT]\r\n** </table>\r\n** </blockquote>)^\r\n**\r\n** ^The memory pointed to by the character pointers returned for the\r\n** declaration type and collation sequence is valid only until the next\r\n** call to any SQLite API function.\r\n**\r\n** ^If the specified table is actually a view, an [error code] is returned.\r\n**\r\n** ^If the specified column is \"rowid\", \"oid\" or \"_rowid_\" and an\r\n** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output\r\n** parameters are set for the explicitly declared column. ^(If there is no\r\n** explicitly declared [INTEGER PRIMARY KEY] column, then the output\r\n** parameters are set as follows:\r\n**\r\n** <pre>\r\n**     data type: \"INTEGER\"\r\n**     collation sequence: \"BINARY\"\r\n**     not null: 0\r\n**     primary key: 1\r\n**     auto increment: 0\r\n** </pre>)^\r\n**\r\n** ^(This function may load one or more schemas from database files. If an\r\n** error occurs during this process, or if the requested table or column\r\n** cannot be found, an [error code] is returned and an error message left\r\n** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^\r\n**\r\n** ^This API is only available if the library was compiled with the\r\n** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.\r\n*/\r\nSQLITE_API int sqlite3_table_column_metadata(\r\n  sqlite3 *db,                /* Connection handle */\r\n  const char *zDbName,        /* Database name or NULL */\r\n  const char *zTableName,     /* Table name */\r\n  const char *zColumnName,    /* Column name */\r\n  char const **pzDataType,    /* OUTPUT: Declared data type */\r\n  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */\r\n  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */\r\n  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */\r\n  int *pAutoinc               /* OUTPUT: True if column is auto-increment */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Load An Extension\r\n**\r\n** ^This interface loads an SQLite extension library from the named file.\r\n**\r\n** ^The sqlite3_load_extension() interface attempts to load an\r\n** SQLite extension library contained in the file zFile.\r\n**\r\n** ^The entry point is zProc.\r\n** ^zProc may be 0, in which case the name of the entry point\r\n** defaults to \"sqlite3_extension_init\".\r\n** ^The sqlite3_load_extension() interface returns\r\n** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.\r\n** ^If an error occurs and pzErrMsg is not 0, then the\r\n** [sqlite3_load_extension()] interface shall attempt to\r\n** fill *pzErrMsg with error message text stored in memory\r\n** obtained from [sqlite3_malloc()]. The calling function\r\n** should free this memory by calling [sqlite3_free()].\r\n**\r\n** ^Extension loading must be enabled using\r\n** [sqlite3_enable_load_extension()] prior to calling this API,\r\n** otherwise an error will be returned.\r\n**\r\n** See also the [load_extension() SQL function].\r\n*/\r\nSQLITE_API int sqlite3_load_extension(\r\n  sqlite3 *db,          /* Load the extension into this database connection */\r\n  const char *zFile,    /* Name of the shared library containing extension */\r\n  const char *zProc,    /* Entry point.  Derived from zFile if 0 */\r\n  char **pzErrMsg       /* Put error message here if not 0 */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Enable Or Disable Extension Loading\r\n**\r\n** ^So as not to open security holes in older applications that are\r\n** unprepared to deal with extension loading, and as a means of disabling\r\n** extension loading while evaluating user-entered SQL, the following API\r\n** is provided to turn the [sqlite3_load_extension()] mechanism on and off.\r\n**\r\n** ^Extension loading is off by default. See ticket #1863.\r\n** ^Call the sqlite3_enable_load_extension() routine with onoff==1\r\n** to turn extension loading on and call it with onoff==0 to turn\r\n** it back off again.\r\n*/\r\nSQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);\r\n\r\n/*\r\n** CAPI3REF: Automatically Load Statically Linked Extensions\r\n**\r\n** ^This interface causes the xEntryPoint() function to be invoked for\r\n** each new [database connection] that is created.  The idea here is that\r\n** xEntryPoint() is the entry point for a statically linked SQLite extension\r\n** that is to be automatically loaded into all new database connections.\r\n**\r\n** ^(Even though the function prototype shows that xEntryPoint() takes\r\n** no arguments and returns void, SQLite invokes xEntryPoint() with three\r\n** arguments and expects and integer result as if the signature of the\r\n** entry point where as follows:\r\n**\r\n** <blockquote><pre>\r\n** &nbsp;  int xEntryPoint(\r\n** &nbsp;    sqlite3 *db,\r\n** &nbsp;    const char **pzErrMsg,\r\n** &nbsp;    const struct sqlite3_api_routines *pThunk\r\n** &nbsp;  );\r\n** </pre></blockquote>)^\r\n**\r\n** If the xEntryPoint routine encounters an error, it should make *pzErrMsg\r\n** point to an appropriate error message (obtained from [sqlite3_mprintf()])\r\n** and return an appropriate [error code].  ^SQLite ensures that *pzErrMsg\r\n** is NULL before calling the xEntryPoint().  ^SQLite will invoke\r\n** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns.  ^If any\r\n** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],\r\n** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.\r\n**\r\n** ^Calling sqlite3_auto_extension(X) with an entry point X that is already\r\n** on the list of automatic extensions is a harmless no-op. ^No entry point\r\n** will be called more than once for each database connection that is opened.\r\n**\r\n** See also: [sqlite3_reset_auto_extension()].\r\n*/\r\nSQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));\r\n\r\n/*\r\n** CAPI3REF: Reset Automatic Extension Loading\r\n**\r\n** ^This interface disables all automatic extensions previously\r\n** registered using [sqlite3_auto_extension()].\r\n*/\r\nSQLITE_API void sqlite3_reset_auto_extension(void);\r\n\r\n/*\r\n** The interface to the virtual-table mechanism is currently considered\r\n** to be experimental.  The interface might change in incompatible ways.\r\n** If this is a problem for you, do not use the interface at this time.\r\n**\r\n** When the virtual-table mechanism stabilizes, we will declare the\r\n** interface fixed, support it indefinitely, and remove this comment.\r\n*/\r\n\r\n/*\r\n** Structures used by the virtual table interface\r\n*/\r\ntypedef struct sqlite3_vtab sqlite3_vtab;\r\ntypedef struct sqlite3_index_info sqlite3_index_info;\r\ntypedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;\r\ntypedef struct sqlite3_module sqlite3_module;\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Object\r\n** KEYWORDS: sqlite3_module {virtual table module}\r\n**\r\n** This structure, sometimes called a \"virtual table module\", \r\n** defines the implementation of a [virtual tables].  \r\n** This structure consists mostly of methods for the module.\r\n**\r\n** ^A virtual table module is created by filling in a persistent\r\n** instance of this structure and passing a pointer to that instance\r\n** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].\r\n** ^The registration remains valid until it is replaced by a different\r\n** module or until the [database connection] closes.  The content\r\n** of this structure must not change while it is registered with\r\n** any database connection.\r\n*/\r\nstruct sqlite3_module {\r\n  int iVersion;\r\n  int (*xCreate)(sqlite3*, void *pAux,\r\n               int argc, const char *const*argv,\r\n               sqlite3_vtab **ppVTab, char**);\r\n  int (*xConnect)(sqlite3*, void *pAux,\r\n               int argc, const char *const*argv,\r\n               sqlite3_vtab **ppVTab, char**);\r\n  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);\r\n  int (*xDisconnect)(sqlite3_vtab *pVTab);\r\n  int (*xDestroy)(sqlite3_vtab *pVTab);\r\n  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);\r\n  int (*xClose)(sqlite3_vtab_cursor*);\r\n  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,\r\n                int argc, sqlite3_value **argv);\r\n  int (*xNext)(sqlite3_vtab_cursor*);\r\n  int (*xEof)(sqlite3_vtab_cursor*);\r\n  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);\r\n  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);\r\n  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);\r\n  int (*xBegin)(sqlite3_vtab *pVTab);\r\n  int (*xSync)(sqlite3_vtab *pVTab);\r\n  int (*xCommit)(sqlite3_vtab *pVTab);\r\n  int (*xRollback)(sqlite3_vtab *pVTab);\r\n  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,\r\n                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                       void **ppArg);\r\n  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);\r\n  /* The methods above are in version 1 of the sqlite_module object. Those \r\n  ** below are for version 2 and greater. */\r\n  int (*xSavepoint)(sqlite3_vtab *pVTab, int);\r\n  int (*xRelease)(sqlite3_vtab *pVTab, int);\r\n  int (*xRollbackTo)(sqlite3_vtab *pVTab, int);\r\n};\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Indexing Information\r\n** KEYWORDS: sqlite3_index_info\r\n**\r\n** The sqlite3_index_info structure and its substructures is used as part\r\n** of the [virtual table] interface to\r\n** pass information into and receive the reply from the [xBestIndex]\r\n** method of a [virtual table module].  The fields under **Inputs** are the\r\n** inputs to xBestIndex and are read-only.  xBestIndex inserts its\r\n** results into the **Outputs** fields.\r\n**\r\n** ^(The aConstraint[] array records WHERE clause constraints of the form:\r\n**\r\n** <blockquote>column OP expr</blockquote>\r\n**\r\n** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is\r\n** stored in aConstraint[].op using one of the\r\n** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^\r\n** ^(The index of the column is stored in\r\n** aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the\r\n** expr on the right-hand side can be evaluated (and thus the constraint\r\n** is usable) and false if it cannot.)^\r\n**\r\n** ^The optimizer automatically inverts terms of the form \"expr OP column\"\r\n** and makes other simplifications to the WHERE clause in an attempt to\r\n** get as many WHERE clause terms into the form shown above as possible.\r\n** ^The aConstraint[] array only reports WHERE clause terms that are\r\n** relevant to the particular virtual table being queried.\r\n**\r\n** ^Information about the ORDER BY clause is stored in aOrderBy[].\r\n** ^Each term of aOrderBy records a column of the ORDER BY clause.\r\n**\r\n** The [xBestIndex] method must fill aConstraintUsage[] with information\r\n** about what parameters to pass to xFilter.  ^If argvIndex>0 then\r\n** the right-hand side of the corresponding aConstraint[] is evaluated\r\n** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit\r\n** is true, then the constraint is assumed to be fully handled by the\r\n** virtual table and is not checked again by SQLite.)^\r\n**\r\n** ^The idxNum and idxPtr values are recorded and passed into the\r\n** [xFilter] method.\r\n** ^[sqlite3_free()] is used to free idxPtr if and only if\r\n** needToFreeIdxPtr is true.\r\n**\r\n** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in\r\n** the correct order to satisfy the ORDER BY clause so that no separate\r\n** sorting step is required.\r\n**\r\n** ^The estimatedCost value is an estimate of the cost of doing the\r\n** particular lookup.  A full scan of a table with N entries should have\r\n** a cost of N.  A binary search of a table of N entries should have a\r\n** cost of approximately log(N).\r\n*/\r\nstruct sqlite3_index_info {\r\n  /* Inputs */\r\n  int nConstraint;           /* Number of entries in aConstraint */\r\n  struct sqlite3_index_constraint {\r\n     int iColumn;              /* Column on left-hand side of constraint */\r\n     unsigned char op;         /* Constraint operator */\r\n     unsigned char usable;     /* True if this constraint is usable */\r\n     int iTermOffset;          /* Used internally - xBestIndex should ignore */\r\n  } *aConstraint;            /* Table of WHERE clause constraints */\r\n  int nOrderBy;              /* Number of terms in the ORDER BY clause */\r\n  struct sqlite3_index_orderby {\r\n     int iColumn;              /* Column number */\r\n     unsigned char desc;       /* True for DESC.  False for ASC. */\r\n  } *aOrderBy;               /* The ORDER BY clause */\r\n  /* Outputs */\r\n  struct sqlite3_index_constraint_usage {\r\n    int argvIndex;           /* if >0, constraint is part of argv to xFilter */\r\n    unsigned char omit;      /* Do not code a test for this constraint */\r\n  } *aConstraintUsage;\r\n  int idxNum;                /* Number used to identify the index */\r\n  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */\r\n  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */\r\n  int orderByConsumed;       /* True if output is already ordered */\r\n  double estimatedCost;      /* Estimated cost of using this index */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Constraint Operator Codes\r\n**\r\n** These macros defined the allowed values for the\r\n** [sqlite3_index_info].aConstraint[].op field.  Each value represents\r\n** an operator that is part of a constraint term in the wHERE clause of\r\n** a query that uses a [virtual table].\r\n*/\r\n#define SQLITE_INDEX_CONSTRAINT_EQ    2\r\n#define SQLITE_INDEX_CONSTRAINT_GT    4\r\n#define SQLITE_INDEX_CONSTRAINT_LE    8\r\n#define SQLITE_INDEX_CONSTRAINT_LT    16\r\n#define SQLITE_INDEX_CONSTRAINT_GE    32\r\n#define SQLITE_INDEX_CONSTRAINT_MATCH 64\r\n\r\n/*\r\n** CAPI3REF: Register A Virtual Table Implementation\r\n**\r\n** ^These routines are used to register a new [virtual table module] name.\r\n** ^Module names must be registered before\r\n** creating a new [virtual table] using the module and before using a\r\n** preexisting [virtual table] for the module.\r\n**\r\n** ^The module name is registered on the [database connection] specified\r\n** by the first parameter.  ^The name of the module is given by the \r\n** second parameter.  ^The third parameter is a pointer to\r\n** the implementation of the [virtual table module].   ^The fourth\r\n** parameter is an arbitrary client data pointer that is passed through\r\n** into the [xCreate] and [xConnect] methods of the virtual table module\r\n** when a new virtual table is be being created or reinitialized.\r\n**\r\n** ^The sqlite3_create_module_v2() interface has a fifth parameter which\r\n** is a pointer to a destructor for the pClientData.  ^SQLite will\r\n** invoke the destructor function (if it is not NULL) when SQLite\r\n** no longer needs the pClientData pointer.  ^The destructor will also\r\n** be invoked if the call to sqlite3_create_module_v2() fails.\r\n** ^The sqlite3_create_module()\r\n** interface is equivalent to sqlite3_create_module_v2() with a NULL\r\n** destructor.\r\n*/\r\nSQLITE_API int sqlite3_create_module(\r\n  sqlite3 *db,               /* SQLite connection to register module with */\r\n  const char *zName,         /* Name of the module */\r\n  const sqlite3_module *p,   /* Methods for the module */\r\n  void *pClientData          /* Client data for xCreate/xConnect */\r\n);\r\nSQLITE_API int sqlite3_create_module_v2(\r\n  sqlite3 *db,               /* SQLite connection to register module with */\r\n  const char *zName,         /* Name of the module */\r\n  const sqlite3_module *p,   /* Methods for the module */\r\n  void *pClientData,         /* Client data for xCreate/xConnect */\r\n  void(*xDestroy)(void*)     /* Module destructor function */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Instance Object\r\n** KEYWORDS: sqlite3_vtab\r\n**\r\n** Every [virtual table module] implementation uses a subclass\r\n** of this object to describe a particular instance\r\n** of the [virtual table].  Each subclass will\r\n** be tailored to the specific needs of the module implementation.\r\n** The purpose of this superclass is to define certain fields that are\r\n** common to all module implementations.\r\n**\r\n** ^Virtual tables methods can set an error message by assigning a\r\n** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should\r\n** take care that any prior string is freed by a call to [sqlite3_free()]\r\n** prior to assigning a new string to zErrMsg.  ^After the error message\r\n** is delivered up to the client application, the string will be automatically\r\n** freed by sqlite3_free() and the zErrMsg field will be zeroed.\r\n*/\r\nstruct sqlite3_vtab {\r\n  const sqlite3_module *pModule;  /* The module for this virtual table */\r\n  int nRef;                       /* NO LONGER USED */\r\n  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */\r\n  /* Virtual table implementations will typically add additional fields */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Cursor Object\r\n** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}\r\n**\r\n** Every [virtual table module] implementation uses a subclass of the\r\n** following structure to describe cursors that point into the\r\n** [virtual table] and are used\r\n** to loop through the virtual table.  Cursors are created using the\r\n** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed\r\n** by the [sqlite3_module.xClose | xClose] method.  Cursors are used\r\n** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods\r\n** of the module.  Each module implementation will define\r\n** the content of a cursor structure to suit its own needs.\r\n**\r\n** This superclass exists in order to define fields of the cursor that\r\n** are common to all implementations.\r\n*/\r\nstruct sqlite3_vtab_cursor {\r\n  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */\r\n  /* Virtual table implementations will typically add additional fields */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Declare The Schema Of A Virtual Table\r\n**\r\n** ^The [xCreate] and [xConnect] methods of a\r\n** [virtual table module] call this interface\r\n** to declare the format (the names and datatypes of the columns) of\r\n** the virtual tables they implement.\r\n*/\r\nSQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);\r\n\r\n/*\r\n** CAPI3REF: Overload A Function For A Virtual Table\r\n**\r\n** ^(Virtual tables can provide alternative implementations of functions\r\n** using the [xFindFunction] method of the [virtual table module].  \r\n** But global versions of those functions\r\n** must exist in order to be overloaded.)^\r\n**\r\n** ^(This API makes sure a global version of a function with a particular\r\n** name and number of parameters exists.  If no such function exists\r\n** before this API is called, a new function is created.)^  ^The implementation\r\n** of the new function always causes an exception to be thrown.  So\r\n** the new function is not good for anything by itself.  Its only\r\n** purpose is to be a placeholder function that can be overloaded\r\n** by a [virtual table].\r\n*/\r\nSQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);\r\n\r\n/*\r\n** The interface to the virtual-table mechanism defined above (back up\r\n** to a comment remarkably similar to this one) is currently considered\r\n** to be experimental.  The interface might change in incompatible ways.\r\n** If this is a problem for you, do not use the interface at this time.\r\n**\r\n** When the virtual-table mechanism stabilizes, we will declare the\r\n** interface fixed, support it indefinitely, and remove this comment.\r\n*/\r\n\r\n/*\r\n** CAPI3REF: A Handle To An Open BLOB\r\n** KEYWORDS: {BLOB handle} {BLOB handles}\r\n**\r\n** An instance of this object represents an open BLOB on which\r\n** [sqlite3_blob_open | incremental BLOB I/O] can be performed.\r\n** ^Objects of this type are created by [sqlite3_blob_open()]\r\n** and destroyed by [sqlite3_blob_close()].\r\n** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces\r\n** can be used to read or write small subsections of the BLOB.\r\n** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.\r\n*/\r\ntypedef struct sqlite3_blob sqlite3_blob;\r\n\r\n/*\r\n** CAPI3REF: Open A BLOB For Incremental I/O\r\n**\r\n** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located\r\n** in row iRow, column zColumn, table zTable in database zDb;\r\n** in other words, the same BLOB that would be selected by:\r\n**\r\n** <pre>\r\n**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;\r\n** </pre>)^\r\n**\r\n** ^If the flags parameter is non-zero, then the BLOB is opened for read\r\n** and write access. ^If it is zero, the BLOB is opened for read access.\r\n** ^It is not possible to open a column that is part of an index or primary \r\n** key for writing. ^If [foreign key constraints] are enabled, it is \r\n** not possible to open a column that is part of a [child key] for writing.\r\n**\r\n** ^Note that the database name is not the filename that contains\r\n** the database but rather the symbolic name of the database that\r\n** appears after the AS keyword when the database is connected using [ATTACH].\r\n** ^For the main database file, the database name is \"main\".\r\n** ^For TEMP tables, the database name is \"temp\".\r\n**\r\n** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written\r\n** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set\r\n** to be a null pointer.)^\r\n** ^This function sets the [database connection] error code and message\r\n** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related\r\n** functions. ^Note that the *ppBlob variable is always initialized in a\r\n** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob\r\n** regardless of the success or failure of this routine.\r\n**\r\n** ^(If the row that a BLOB handle points to is modified by an\r\n** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects\r\n** then the BLOB handle is marked as \"expired\".\r\n** This is true if any column of the row is changed, even a column\r\n** other than the one the BLOB handle is open on.)^\r\n** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for\r\n** an expired BLOB handle fail with a return code of [SQLITE_ABORT].\r\n** ^(Changes written into a BLOB prior to the BLOB expiring are not\r\n** rolled back by the expiration of the BLOB.  Such changes will eventually\r\n** commit if the transaction continues to completion.)^\r\n**\r\n** ^Use the [sqlite3_blob_bytes()] interface to determine the size of\r\n** the opened blob.  ^The size of a blob may not be changed by this\r\n** interface.  Use the [UPDATE] SQL command to change the size of a\r\n** blob.\r\n**\r\n** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces\r\n** and the built-in [zeroblob] SQL function can be used, if desired,\r\n** to create an empty, zero-filled blob in which to read or write using\r\n** this interface.\r\n**\r\n** To avoid a resource leak, every open [BLOB handle] should eventually\r\n** be released by a call to [sqlite3_blob_close()].\r\n*/\r\nSQLITE_API int sqlite3_blob_open(\r\n  sqlite3*,\r\n  const char *zDb,\r\n  const char *zTable,\r\n  const char *zColumn,\r\n  sqlite3_int64 iRow,\r\n  int flags,\r\n  sqlite3_blob **ppBlob\r\n);\r\n\r\n/*\r\n** CAPI3REF: Move a BLOB Handle to a New Row\r\n**\r\n** ^This function is used to move an existing blob handle so that it points\r\n** to a different row of the same database table. ^The new row is identified\r\n** by the rowid value passed as the second argument. Only the row can be\r\n** changed. ^The database, table and column on which the blob handle is open\r\n** remain the same. Moving an existing blob handle to a new row can be\r\n** faster than closing the existing handle and opening a new one.\r\n**\r\n** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -\r\n** it must exist and there must be either a blob or text value stored in\r\n** the nominated column.)^ ^If the new row is not present in the table, or if\r\n** it does not contain a blob or text value, or if another error occurs, an\r\n** SQLite error code is returned and the blob handle is considered aborted.\r\n** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or\r\n** [sqlite3_blob_reopen()] on an aborted blob handle immediately return\r\n** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle\r\n** always returns zero.\r\n**\r\n** ^This function sets the database handle error code and message.\r\n*/\r\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);\r\n\r\n/*\r\n** CAPI3REF: Close A BLOB Handle\r\n**\r\n** ^Closes an open [BLOB handle].\r\n**\r\n** ^Closing a BLOB shall cause the current transaction to commit\r\n** if there are no other BLOBs, no pending prepared statements, and the\r\n** database connection is in [autocommit mode].\r\n** ^If any writes were made to the BLOB, they might be held in cache\r\n** until the close operation if they will fit.\r\n**\r\n** ^(Closing the BLOB often forces the changes\r\n** out to disk and so if any I/O errors occur, they will likely occur\r\n** at the time when the BLOB is closed.  Any errors that occur during\r\n** closing are reported as a non-zero return value.)^\r\n**\r\n** ^(The BLOB is closed unconditionally.  Even if this routine returns\r\n** an error code, the BLOB is still closed.)^\r\n**\r\n** ^Calling this routine with a null pointer (such as would be returned\r\n** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.\r\n*/\r\nSQLITE_API int sqlite3_blob_close(sqlite3_blob *);\r\n\r\n/*\r\n** CAPI3REF: Return The Size Of An Open BLOB\r\n**\r\n** ^Returns the size in bytes of the BLOB accessible via the \r\n** successfully opened [BLOB handle] in its only argument.  ^The\r\n** incremental blob I/O routines can only read or overwriting existing\r\n** blob content; they cannot change the size of a blob.\r\n**\r\n** This routine only works on a [BLOB handle] which has been created\r\n** by a prior successful call to [sqlite3_blob_open()] and which has not\r\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\r\n** to this routine results in undefined and probably undesirable behavior.\r\n*/\r\nSQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);\r\n\r\n/*\r\n** CAPI3REF: Read Data From A BLOB Incrementally\r\n**\r\n** ^(This function is used to read data from an open [BLOB handle] into a\r\n** caller-supplied buffer. N bytes of data are copied into buffer Z\r\n** from the open BLOB, starting at offset iOffset.)^\r\n**\r\n** ^If offset iOffset is less than N bytes from the end of the BLOB,\r\n** [SQLITE_ERROR] is returned and no data is read.  ^If N or iOffset is\r\n** less than zero, [SQLITE_ERROR] is returned and no data is read.\r\n** ^The size of the blob (and hence the maximum value of N+iOffset)\r\n** can be determined using the [sqlite3_blob_bytes()] interface.\r\n**\r\n** ^An attempt to read from an expired [BLOB handle] fails with an\r\n** error code of [SQLITE_ABORT].\r\n**\r\n** ^(On success, sqlite3_blob_read() returns SQLITE_OK.\r\n** Otherwise, an [error code] or an [extended error code] is returned.)^\r\n**\r\n** This routine only works on a [BLOB handle] which has been created\r\n** by a prior successful call to [sqlite3_blob_open()] and which has not\r\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\r\n** to this routine results in undefined and probably undesirable behavior.\r\n**\r\n** See also: [sqlite3_blob_write()].\r\n*/\r\nSQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);\r\n\r\n/*\r\n** CAPI3REF: Write Data Into A BLOB Incrementally\r\n**\r\n** ^This function is used to write data into an open [BLOB handle] from a\r\n** caller-supplied buffer. ^N bytes of data are copied from the buffer Z\r\n** into the open BLOB, starting at offset iOffset.\r\n**\r\n** ^If the [BLOB handle] passed as the first argument was not opened for\r\n** writing (the flags parameter to [sqlite3_blob_open()] was zero),\r\n** this function returns [SQLITE_READONLY].\r\n**\r\n** ^This function may only modify the contents of the BLOB; it is\r\n** not possible to increase the size of a BLOB using this API.\r\n** ^If offset iOffset is less than N bytes from the end of the BLOB,\r\n** [SQLITE_ERROR] is returned and no data is written.  ^If N is\r\n** less than zero [SQLITE_ERROR] is returned and no data is written.\r\n** The size of the BLOB (and hence the maximum value of N+iOffset)\r\n** can be determined using the [sqlite3_blob_bytes()] interface.\r\n**\r\n** ^An attempt to write to an expired [BLOB handle] fails with an\r\n** error code of [SQLITE_ABORT].  ^Writes to the BLOB that occurred\r\n** before the [BLOB handle] expired are not rolled back by the\r\n** expiration of the handle, though of course those changes might\r\n** have been overwritten by the statement that expired the BLOB handle\r\n** or by other independent statements.\r\n**\r\n** ^(On success, sqlite3_blob_write() returns SQLITE_OK.\r\n** Otherwise, an  [error code] or an [extended error code] is returned.)^\r\n**\r\n** This routine only works on a [BLOB handle] which has been created\r\n** by a prior successful call to [sqlite3_blob_open()] and which has not\r\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\r\n** to this routine results in undefined and probably undesirable behavior.\r\n**\r\n** See also: [sqlite3_blob_read()].\r\n*/\r\nSQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);\r\n\r\n/*\r\n** CAPI3REF: Virtual File System Objects\r\n**\r\n** A virtual filesystem (VFS) is an [sqlite3_vfs] object\r\n** that SQLite uses to interact\r\n** with the underlying operating system.  Most SQLite builds come with a\r\n** single default VFS that is appropriate for the host computer.\r\n** New VFSes can be registered and existing VFSes can be unregistered.\r\n** The following interfaces are provided.\r\n**\r\n** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.\r\n** ^Names are case sensitive.\r\n** ^Names are zero-terminated UTF-8 strings.\r\n** ^If there is no match, a NULL pointer is returned.\r\n** ^If zVfsName is NULL then the default VFS is returned.\r\n**\r\n** ^New VFSes are registered with sqlite3_vfs_register().\r\n** ^Each new VFS becomes the default VFS if the makeDflt flag is set.\r\n** ^The same VFS can be registered multiple times without injury.\r\n** ^To make an existing VFS into the default VFS, register it again\r\n** with the makeDflt flag set.  If two different VFSes with the\r\n** same name are registered, the behavior is undefined.  If a\r\n** VFS is registered with a name that is NULL or an empty string,\r\n** then the behavior is undefined.\r\n**\r\n** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.\r\n** ^(If the default VFS is unregistered, another VFS is chosen as\r\n** the default.  The choice for the new VFS is arbitrary.)^\r\n*/\r\nSQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);\r\nSQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);\r\nSQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);\r\n\r\n/*\r\n** CAPI3REF: Mutexes\r\n**\r\n** The SQLite core uses these routines for thread\r\n** synchronization. Though they are intended for internal\r\n** use by SQLite, code that links against SQLite is\r\n** permitted to use any of these routines.\r\n**\r\n** The SQLite source code contains multiple implementations\r\n** of these mutex routines.  An appropriate implementation\r\n** is selected automatically at compile-time.  ^(The following\r\n** implementations are available in the SQLite core:\r\n**\r\n** <ul>\r\n** <li>   SQLITE_MUTEX_OS2\r\n** <li>   SQLITE_MUTEX_PTHREADS\r\n** <li>   SQLITE_MUTEX_W32\r\n** <li>   SQLITE_MUTEX_NOOP\r\n** </ul>)^\r\n**\r\n** ^The SQLITE_MUTEX_NOOP implementation is a set of routines\r\n** that does no real locking and is appropriate for use in\r\n** a single-threaded application.  ^The SQLITE_MUTEX_OS2,\r\n** SQLITE_MUTEX_PTHREADS, and SQLITE_MUTEX_W32 implementations\r\n** are appropriate for use on OS/2, Unix, and Windows.\r\n**\r\n** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor\r\n** macro defined (with \"-DSQLITE_MUTEX_APPDEF=1\"), then no mutex\r\n** implementation is included with the library. In this case the\r\n** application must supply a custom mutex implementation using the\r\n** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function\r\n** before calling sqlite3_initialize() or any other public sqlite3_\r\n** function that calls sqlite3_initialize().)^\r\n**\r\n** ^The sqlite3_mutex_alloc() routine allocates a new\r\n** mutex and returns a pointer to it. ^If it returns NULL\r\n** that means that a mutex could not be allocated.  ^SQLite\r\n** will unwind its stack and return an error.  ^(The argument\r\n** to sqlite3_mutex_alloc() is one of these integer constants:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_MUTEX_FAST\r\n** <li>  SQLITE_MUTEX_RECURSIVE\r\n** <li>  SQLITE_MUTEX_STATIC_MASTER\r\n** <li>  SQLITE_MUTEX_STATIC_MEM\r\n** <li>  SQLITE_MUTEX_STATIC_MEM2\r\n** <li>  SQLITE_MUTEX_STATIC_PRNG\r\n** <li>  SQLITE_MUTEX_STATIC_LRU\r\n** <li>  SQLITE_MUTEX_STATIC_LRU2\r\n** </ul>)^\r\n**\r\n** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)\r\n** cause sqlite3_mutex_alloc() to create\r\n** a new mutex.  ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\r\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\r\n** The mutex implementation does not need to make a distinction\r\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\r\n** not want to.  ^SQLite will only request a recursive mutex in\r\n** cases where it really needs one.  ^If a faster non-recursive mutex\r\n** implementation is available on the host platform, the mutex subsystem\r\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\r\n**\r\n** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other\r\n** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return\r\n** a pointer to a static preexisting mutex.  ^Six static mutexes are\r\n** used by the current version of SQLite.  Future versions of SQLite\r\n** may add additional static mutexes.  Static mutexes are for internal\r\n** use by SQLite only.  Applications that use SQLite mutexes should\r\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\r\n** SQLITE_MUTEX_RECURSIVE.\r\n**\r\n** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\r\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\r\n** returns a different mutex on every call.  ^But for the static\r\n** mutex types, the same mutex is returned on every call that has\r\n** the same type number.\r\n**\r\n** ^The sqlite3_mutex_free() routine deallocates a previously\r\n** allocated dynamic mutex.  ^SQLite is careful to deallocate every\r\n** dynamic mutex that it allocates.  The dynamic mutexes must not be in\r\n** use when they are deallocated.  Attempting to deallocate a static\r\n** mutex results in undefined behavior.  ^SQLite never deallocates\r\n** a static mutex.\r\n**\r\n** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\r\n** to enter a mutex.  ^If another thread is already within the mutex,\r\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\r\n** SQLITE_BUSY.  ^The sqlite3_mutex_try() interface returns [SQLITE_OK]\r\n** upon successful entry.  ^(Mutexes created using\r\n** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.\r\n** In such cases the,\r\n** mutex must be exited an equal number of times before another thread\r\n** can enter.)^  ^(If the same thread tries to enter any other\r\n** kind of mutex more than once, the behavior is undefined.\r\n** SQLite will never exhibit\r\n** such behavior in its own use of mutexes.)^\r\n**\r\n** ^(Some systems (for example, Windows 95) do not support the operation\r\n** implemented by sqlite3_mutex_try().  On those systems, sqlite3_mutex_try()\r\n** will always return SQLITE_BUSY.  The SQLite core only ever uses\r\n** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^\r\n**\r\n** ^The sqlite3_mutex_leave() routine exits a mutex that was\r\n** previously entered by the same thread.   ^(The behavior\r\n** is undefined if the mutex is not currently entered by the\r\n** calling thread or is not currently allocated.  SQLite will\r\n** never do either.)^\r\n**\r\n** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or\r\n** sqlite3_mutex_leave() is a NULL pointer, then all three routines\r\n** behave as no-ops.\r\n**\r\n** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].\r\n*/\r\nSQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);\r\nSQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);\r\nSQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);\r\nSQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);\r\nSQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);\r\n\r\n/*\r\n** CAPI3REF: Mutex Methods Object\r\n**\r\n** An instance of this structure defines the low-level routines\r\n** used to allocate and use mutexes.\r\n**\r\n** Usually, the default mutex implementations provided by SQLite are\r\n** sufficient, however the user has the option of substituting a custom\r\n** implementation for specialized deployments or systems for which SQLite\r\n** does not provide a suitable implementation. In this case, the user\r\n** creates and populates an instance of this structure to pass\r\n** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.\r\n** Additionally, an instance of this structure can be used as an\r\n** output variable when querying the system for the current mutex\r\n** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.\r\n**\r\n** ^The xMutexInit method defined by this structure is invoked as\r\n** part of system initialization by the sqlite3_initialize() function.\r\n** ^The xMutexInit routine is called by SQLite exactly once for each\r\n** effective call to [sqlite3_initialize()].\r\n**\r\n** ^The xMutexEnd method defined by this structure is invoked as\r\n** part of system shutdown by the sqlite3_shutdown() function. The\r\n** implementation of this method is expected to release all outstanding\r\n** resources obtained by the mutex methods implementation, especially\r\n** those obtained by the xMutexInit method.  ^The xMutexEnd()\r\n** interface is invoked exactly once for each call to [sqlite3_shutdown()].\r\n**\r\n** ^(The remaining seven methods defined by this structure (xMutexAlloc,\r\n** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and\r\n** xMutexNotheld) implement the following interfaces (respectively):\r\n**\r\n** <ul>\r\n**   <li>  [sqlite3_mutex_alloc()] </li>\r\n**   <li>  [sqlite3_mutex_free()] </li>\r\n**   <li>  [sqlite3_mutex_enter()] </li>\r\n**   <li>  [sqlite3_mutex_try()] </li>\r\n**   <li>  [sqlite3_mutex_leave()] </li>\r\n**   <li>  [sqlite3_mutex_held()] </li>\r\n**   <li>  [sqlite3_mutex_notheld()] </li>\r\n** </ul>)^\r\n**\r\n** The only difference is that the public sqlite3_XXX functions enumerated\r\n** above silently ignore any invocations that pass a NULL pointer instead\r\n** of a valid mutex handle. The implementations of the methods defined\r\n** by this structure are not required to handle this case, the results\r\n** of passing a NULL pointer instead of a valid mutex handle are undefined\r\n** (i.e. it is acceptable to provide an implementation that segfaults if\r\n** it is passed a NULL pointer).\r\n**\r\n** The xMutexInit() method must be threadsafe.  ^It must be harmless to\r\n** invoke xMutexInit() multiple times within the same process and without\r\n** intervening calls to xMutexEnd().  Second and subsequent calls to\r\n** xMutexInit() must be no-ops.\r\n**\r\n** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]\r\n** and its associates).  ^Similarly, xMutexAlloc() must not use SQLite memory\r\n** allocation for a static mutex.  ^However xMutexAlloc() may use SQLite\r\n** memory allocation for a fast or recursive mutex.\r\n**\r\n** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is\r\n** called, but only if the prior call to xMutexInit returned SQLITE_OK.\r\n** If xMutexInit fails in any way, it is expected to clean up after itself\r\n** prior to returning.\r\n*/\r\ntypedef struct sqlite3_mutex_methods sqlite3_mutex_methods;\r\nstruct sqlite3_mutex_methods {\r\n  int (*xMutexInit)(void);\r\n  int (*xMutexEnd)(void);\r\n  sqlite3_mutex *(*xMutexAlloc)(int);\r\n  void (*xMutexFree)(sqlite3_mutex *);\r\n  void (*xMutexEnter)(sqlite3_mutex *);\r\n  int (*xMutexTry)(sqlite3_mutex *);\r\n  void (*xMutexLeave)(sqlite3_mutex *);\r\n  int (*xMutexHeld)(sqlite3_mutex *);\r\n  int (*xMutexNotheld)(sqlite3_mutex *);\r\n};\r\n\r\n/*\r\n** CAPI3REF: Mutex Verification Routines\r\n**\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines\r\n** are intended for use inside assert() statements.  ^The SQLite core\r\n** never uses these routines except inside an assert() and applications\r\n** are advised to follow the lead of the core.  ^The SQLite core only\r\n** provides implementations for these routines when it is compiled\r\n** with the SQLITE_DEBUG flag.  ^External mutex implementations\r\n** are only required to provide these routines if SQLITE_DEBUG is\r\n** defined and if NDEBUG is not defined.\r\n**\r\n** ^These routines should return true if the mutex in their argument\r\n** is held or not held, respectively, by the calling thread.\r\n**\r\n** ^The implementation is not required to provide versions of these\r\n** routines that actually work. If the implementation does not provide working\r\n** versions of these routines, it should at least provide stubs that always\r\n** return true so that one does not get spurious assertion failures.\r\n**\r\n** ^If the argument to sqlite3_mutex_held() is a NULL pointer then\r\n** the routine should return 1.   This seems counter-intuitive since\r\n** clearly the mutex cannot be held if it does not exist.  But\r\n** the reason the mutex does not exist is because the build is not\r\n** using mutexes.  And we do not want the assert() containing the\r\n** call to sqlite3_mutex_held() to fail, so a non-zero return is\r\n** the appropriate thing to do.  ^The sqlite3_mutex_notheld()\r\n** interface should also return 1 when given a NULL pointer.\r\n*/\r\n#ifndef NDEBUG\r\nSQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);\r\nSQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Mutex Types\r\n**\r\n** The [sqlite3_mutex_alloc()] interface takes a single argument\r\n** which is one of these integer constants.\r\n**\r\n** The set of static mutexes may change from one SQLite release to the\r\n** next.  Applications that override the built-in mutex logic must be\r\n** prepared to accommodate additional static mutexes.\r\n*/\r\n#define SQLITE_MUTEX_FAST             0\r\n#define SQLITE_MUTEX_RECURSIVE        1\r\n#define SQLITE_MUTEX_STATIC_MASTER    2\r\n#define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */\r\n#define SQLITE_MUTEX_STATIC_MEM2      4  /* NOT USED */\r\n#define SQLITE_MUTEX_STATIC_OPEN      4  /* sqlite3BtreeOpen() */\r\n#define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */\r\n#define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */\r\n#define SQLITE_MUTEX_STATIC_LRU2      7  /* NOT USED */\r\n#define SQLITE_MUTEX_STATIC_PMEM      7  /* sqlite3PageMalloc() */\r\n\r\n/*\r\n** CAPI3REF: Retrieve the mutex for a database connection\r\n**\r\n** ^This interface returns a pointer the [sqlite3_mutex] object that \r\n** serializes access to the [database connection] given in the argument\r\n** when the [threading mode] is Serialized.\r\n** ^If the [threading mode] is Single-thread or Multi-thread then this\r\n** routine returns a NULL pointer.\r\n*/\r\nSQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Low-Level Control Of Database Files\r\n**\r\n** ^The [sqlite3_file_control()] interface makes a direct call to the\r\n** xFileControl method for the [sqlite3_io_methods] object associated\r\n** with a particular database identified by the second argument. ^The\r\n** name of the database is \"main\" for the main database or \"temp\" for the\r\n** TEMP database, or the name that appears after the AS keyword for\r\n** databases that are added using the [ATTACH] SQL command.\r\n** ^A NULL pointer can be used in place of \"main\" to refer to the\r\n** main database file.\r\n** ^The third and fourth parameters to this routine\r\n** are passed directly through to the second and third parameters of\r\n** the xFileControl method.  ^The return value of the xFileControl\r\n** method becomes the return value of this routine.\r\n**\r\n** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes\r\n** a pointer to the underlying [sqlite3_file] object to be written into\r\n** the space pointed to by the 4th parameter.  ^The SQLITE_FCNTL_FILE_POINTER\r\n** case is a short-circuit path which does not actually invoke the\r\n** underlying sqlite3_io_methods.xFileControl method.\r\n**\r\n** ^If the second parameter (zDbName) does not match the name of any\r\n** open database file, then SQLITE_ERROR is returned.  ^This error\r\n** code is not remembered and will not be recalled by [sqlite3_errcode()]\r\n** or [sqlite3_errmsg()].  The underlying xFileControl method might\r\n** also return SQLITE_ERROR.  There is no way to distinguish between\r\n** an incorrect zDbName and an SQLITE_ERROR return from the underlying\r\n** xFileControl method.\r\n**\r\n** See also: [SQLITE_FCNTL_LOCKSTATE]\r\n*/\r\nSQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);\r\n\r\n/*\r\n** CAPI3REF: Testing Interface\r\n**\r\n** ^The sqlite3_test_control() interface is used to read out internal\r\n** state of SQLite and to inject faults into SQLite for testing\r\n** purposes.  ^The first parameter is an operation code that determines\r\n** the number, meaning, and operation of all subsequent parameters.\r\n**\r\n** This interface is not for use by applications.  It exists solely\r\n** for verifying the correct operation of the SQLite library.  Depending\r\n** on how the SQLite library is compiled, this interface might not exist.\r\n**\r\n** The details of the operation codes, their meanings, the parameters\r\n** they take, and what they do are all subject to change without notice.\r\n** Unlike most of the SQLite API, this function is not guaranteed to\r\n** operate consistently from one release to the next.\r\n*/\r\nSQLITE_API int sqlite3_test_control(int op, ...);\r\n\r\n/*\r\n** CAPI3REF: Testing Interface Operation Codes\r\n**\r\n** These constants are the valid operation code parameters used\r\n** as the first argument to [sqlite3_test_control()].\r\n**\r\n** These parameters and their meanings are subject to change\r\n** without notice.  These values are for testing purposes only.\r\n** Applications should not use any of these parameters or the\r\n** [sqlite3_test_control()] interface.\r\n*/\r\n#define SQLITE_TESTCTRL_FIRST                    5\r\n#define SQLITE_TESTCTRL_PRNG_SAVE                5\r\n#define SQLITE_TESTCTRL_PRNG_RESTORE             6\r\n#define SQLITE_TESTCTRL_PRNG_RESET               7\r\n#define SQLITE_TESTCTRL_BITVEC_TEST              8\r\n#define SQLITE_TESTCTRL_FAULT_INSTALL            9\r\n#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10\r\n#define SQLITE_TESTCTRL_PENDING_BYTE            11\r\n#define SQLITE_TESTCTRL_ASSERT                  12\r\n#define SQLITE_TESTCTRL_ALWAYS                  13\r\n#define SQLITE_TESTCTRL_RESERVE                 14\r\n#define SQLITE_TESTCTRL_OPTIMIZATIONS           15\r\n#define SQLITE_TESTCTRL_ISKEYWORD               16\r\n#define SQLITE_TESTCTRL_SCRATCHMALLOC           17\r\n#define SQLITE_TESTCTRL_LOCALTIME_FAULT         18\r\n#define SQLITE_TESTCTRL_EXPLAIN_STMT            19\r\n#define SQLITE_TESTCTRL_LAST                    19\r\n\r\n/*\r\n** CAPI3REF: SQLite Runtime Status\r\n**\r\n** ^This interface is used to retrieve runtime status information\r\n** about the performance of SQLite, and optionally to reset various\r\n** highwater marks.  ^The first argument is an integer code for\r\n** the specific parameter to measure.  ^(Recognized integer codes\r\n** are of the form [status parameters | SQLITE_STATUS_...].)^\r\n** ^The current value of the parameter is returned into *pCurrent.\r\n** ^The highest recorded value is returned in *pHighwater.  ^If the\r\n** resetFlag is true, then the highest record value is reset after\r\n** *pHighwater is written.  ^(Some parameters do not record the highest\r\n** value.  For those parameters\r\n** nothing is written into *pHighwater and the resetFlag is ignored.)^\r\n** ^(Other parameters record only the highwater mark and not the current\r\n** value.  For these latter parameters nothing is written into *pCurrent.)^\r\n**\r\n** ^The sqlite3_status() routine returns SQLITE_OK on success and a\r\n** non-zero [error code] on failure.\r\n**\r\n** This routine is threadsafe but is not atomic.  This routine can be\r\n** called while other threads are running the same or different SQLite\r\n** interfaces.  However the values returned in *pCurrent and\r\n** *pHighwater reflect the status of SQLite at different points in time\r\n** and it is possible that another thread might change the parameter\r\n** in between the times when *pCurrent and *pHighwater are written.\r\n**\r\n** See also: [sqlite3_db_status()]\r\n*/\r\nSQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);\r\n\r\n\r\n/*\r\n** CAPI3REF: Status Parameters\r\n** KEYWORDS: {status parameters}\r\n**\r\n** These integer constants designate various run-time status parameters\r\n** that can be returned by [sqlite3_status()].\r\n**\r\n** <dl>\r\n** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>\r\n** <dd>This parameter is the current amount of memory checked out\r\n** using [sqlite3_malloc()], either directly or indirectly.  The\r\n** figure includes calls made to [sqlite3_malloc()] by the application\r\n** and internal memory usage by the SQLite library.  Scratch memory\r\n** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache\r\n** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in\r\n** this parameter.  The amount returned is the sum of the allocation\r\n** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^\r\n**\r\n** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>\r\n** <dd>This parameter records the largest memory allocation request\r\n** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their\r\n** internal equivalents).  Only the value returned in the\r\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \r\n** The value written into the *pCurrent parameter is undefined.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_MALLOC_COUNT]] ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>\r\n** <dd>This parameter records the number of separate memory allocations\r\n** currently checked out.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PAGECACHE_USED]] ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>\r\n** <dd>This parameter returns the number of pages used out of the\r\n** [pagecache memory allocator] that was configured using \r\n** [SQLITE_CONFIG_PAGECACHE].  The\r\n** value returned is in pages, not in bytes.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] \r\n** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>\r\n** <dd>This parameter returns the number of bytes of page cache\r\n** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]\r\n** buffer and where forced to overflow to [sqlite3_malloc()].  The\r\n** returned value includes allocations that overflowed because they\r\n** where too large (they were larger than the \"sz\" parameter to\r\n** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because\r\n** no space was left in the page cache.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>\r\n** <dd>This parameter records the largest memory allocation request\r\n** handed to [pagecache memory allocator].  Only the value returned in the\r\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \r\n** The value written into the *pCurrent parameter is undefined.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>\r\n** <dd>This parameter returns the number of allocations used out of the\r\n** [scratch memory allocator] configured using\r\n** [SQLITE_CONFIG_SCRATCH].  The value returned is in allocations, not\r\n** in bytes.  Since a single thread may only have one scratch allocation\r\n** outstanding at time, this parameter also reports the number of threads\r\n** using scratch memory at the same time.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>\r\n** <dd>This parameter returns the number of bytes of scratch memory\r\n** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]\r\n** buffer and where forced to overflow to [sqlite3_malloc()].  The values\r\n** returned include overflows because the requested allocation was too\r\n** larger (that is, because the requested allocation was larger than the\r\n** \"sz\" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer\r\n** slots were available.\r\n** </dd>)^\r\n**\r\n** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>\r\n** <dd>This parameter records the largest memory allocation request\r\n** handed to [scratch memory allocator].  Only the value returned in the\r\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \r\n** The value written into the *pCurrent parameter is undefined.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>\r\n** <dd>This parameter records the deepest parser stack.  It is only\r\n** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^\r\n** </dl>\r\n**\r\n** New status parameters may be added from time to time.\r\n*/\r\n#define SQLITE_STATUS_MEMORY_USED          0\r\n#define SQLITE_STATUS_PAGECACHE_USED       1\r\n#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2\r\n#define SQLITE_STATUS_SCRATCH_USED         3\r\n#define SQLITE_STATUS_SCRATCH_OVERFLOW     4\r\n#define SQLITE_STATUS_MALLOC_SIZE          5\r\n#define SQLITE_STATUS_PARSER_STACK         6\r\n#define SQLITE_STATUS_PAGECACHE_SIZE       7\r\n#define SQLITE_STATUS_SCRATCH_SIZE         8\r\n#define SQLITE_STATUS_MALLOC_COUNT         9\r\n\r\n/*\r\n** CAPI3REF: Database Connection Status\r\n**\r\n** ^This interface is used to retrieve runtime status information \r\n** about a single [database connection].  ^The first argument is the\r\n** database connection object to be interrogated.  ^The second argument\r\n** is an integer constant, taken from the set of\r\n** [SQLITE_DBSTATUS options], that\r\n** determines the parameter to interrogate.  The set of \r\n** [SQLITE_DBSTATUS options] is likely\r\n** to grow in future releases of SQLite.\r\n**\r\n** ^The current value of the requested parameter is written into *pCur\r\n** and the highest instantaneous value is written into *pHiwtr.  ^If\r\n** the resetFlg is true, then the highest instantaneous value is\r\n** reset back down to the current value.\r\n**\r\n** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a\r\n** non-zero [error code] on failure.\r\n**\r\n** See also: [sqlite3_status()] and [sqlite3_stmt_status()].\r\n*/\r\nSQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);\r\n\r\n/*\r\n** CAPI3REF: Status Parameters for database connections\r\n** KEYWORDS: {SQLITE_DBSTATUS options}\r\n**\r\n** These constants are the available integer \"verbs\" that can be passed as\r\n** the second argument to the [sqlite3_db_status()] interface.\r\n**\r\n** New verbs may be added in future releases of SQLite. Existing verbs\r\n** might be discontinued. Applications should check the return code from\r\n** [sqlite3_db_status()] to make sure that the call worked.\r\n** The [sqlite3_db_status()] interface will return a non-zero error code\r\n** if a discontinued or unsupported verb is invoked.\r\n**\r\n** <dl>\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>\r\n** <dd>This parameter returns the number of lookaside memory slots currently\r\n** checked out.</dd>)^\r\n**\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>\r\n** <dd>This parameter returns the number malloc attempts that were \r\n** satisfied using lookaside memory. Only the high-water value is meaningful;\r\n** the current value is always zero.)^\r\n**\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]\r\n** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>\r\n** <dd>This parameter returns the number malloc attempts that might have\r\n** been satisfied using lookaside memory but failed due to the amount of\r\n** memory requested being larger than the lookaside slot size.\r\n** Only the high-water value is meaningful;\r\n** the current value is always zero.)^\r\n**\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]\r\n** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>\r\n** <dd>This parameter returns the number malloc attempts that might have\r\n** been satisfied using lookaside memory but failed due to all lookaside\r\n** memory already being in use.\r\n** Only the high-water value is meaningful;\r\n** the current value is always zero.)^\r\n**\r\n** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>\r\n** <dd>This parameter returns the approximate number of of bytes of heap\r\n** memory used by all pager caches associated with the database connection.)^\r\n** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.\r\n**\r\n** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>\r\n** <dd>This parameter returns the approximate number of of bytes of heap\r\n** memory used to store the schema for all databases associated\r\n** with the connection - main, temp, and any [ATTACH]-ed databases.)^ \r\n** ^The full amount of memory used by the schemas is reported, even if the\r\n** schema memory is shared with other database connections due to\r\n** [shared cache mode] being enabled.\r\n** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.\r\n**\r\n** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>\r\n** <dd>This parameter returns the approximate number of of bytes of heap\r\n** and lookaside memory used by all prepared statements associated with\r\n** the database connection.)^\r\n** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.\r\n** </dd>\r\n**\r\n** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>\r\n** <dd>This parameter returns the number of pager cache hits that have\r\n** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT \r\n** is always 0.\r\n** </dd>\r\n**\r\n** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>\r\n** <dd>This parameter returns the number of pager cache misses that have\r\n** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS \r\n** is always 0.\r\n** </dd>\r\n** </dl>\r\n*/\r\n#define SQLITE_DBSTATUS_LOOKASIDE_USED       0\r\n#define SQLITE_DBSTATUS_CACHE_USED           1\r\n#define SQLITE_DBSTATUS_SCHEMA_USED          2\r\n#define SQLITE_DBSTATUS_STMT_USED            3\r\n#define SQLITE_DBSTATUS_LOOKASIDE_HIT        4\r\n#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE  5\r\n#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL  6\r\n#define SQLITE_DBSTATUS_CACHE_HIT            7\r\n#define SQLITE_DBSTATUS_CACHE_MISS           8\r\n#define SQLITE_DBSTATUS_MAX                  8   /* Largest defined DBSTATUS */\r\n\r\n\r\n/*\r\n** CAPI3REF: Prepared Statement Status\r\n**\r\n** ^(Each prepared statement maintains various\r\n** [SQLITE_STMTSTATUS counters] that measure the number\r\n** of times it has performed specific operations.)^  These counters can\r\n** be used to monitor the performance characteristics of the prepared\r\n** statements.  For example, if the number of table steps greatly exceeds\r\n** the number of table searches or result rows, that would tend to indicate\r\n** that the prepared statement is using a full table scan rather than\r\n** an index.  \r\n**\r\n** ^(This interface is used to retrieve and reset counter values from\r\n** a [prepared statement].  The first argument is the prepared statement\r\n** object to be interrogated.  The second argument\r\n** is an integer code for a specific [SQLITE_STMTSTATUS counter]\r\n** to be interrogated.)^\r\n** ^The current value of the requested counter is returned.\r\n** ^If the resetFlg is true, then the counter is reset to zero after this\r\n** interface call returns.\r\n**\r\n** See also: [sqlite3_status()] and [sqlite3_db_status()].\r\n*/\r\nSQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);\r\n\r\n/*\r\n** CAPI3REF: Status Parameters for prepared statements\r\n** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}\r\n**\r\n** These preprocessor macros define integer codes that name counter\r\n** values associated with the [sqlite3_stmt_status()] interface.\r\n** The meanings of the various counters are as follows:\r\n**\r\n** <dl>\r\n** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>\r\n** <dd>^This is the number of times that SQLite has stepped forward in\r\n** a table as part of a full table scan.  Large numbers for this counter\r\n** may indicate opportunities for performance improvement through \r\n** careful use of indices.</dd>\r\n**\r\n** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>\r\n** <dd>^This is the number of sort operations that have occurred.\r\n** A non-zero value in this counter may indicate an opportunity to\r\n** improvement performance through careful use of indices.</dd>\r\n**\r\n** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>\r\n** <dd>^This is the number of rows inserted into transient indices that\r\n** were created automatically in order to help joins run faster.\r\n** A non-zero value in this counter may indicate an opportunity to\r\n** improvement performance by adding permanent indices that do not\r\n** need to be reinitialized each time the statement is run.</dd>\r\n** </dl>\r\n*/\r\n#define SQLITE_STMTSTATUS_FULLSCAN_STEP     1\r\n#define SQLITE_STMTSTATUS_SORT              2\r\n#define SQLITE_STMTSTATUS_AUTOINDEX         3\r\n\r\n/*\r\n** CAPI3REF: Custom Page Cache Object\r\n**\r\n** The sqlite3_pcache type is opaque.  It is implemented by\r\n** the pluggable module.  The SQLite core has no knowledge of\r\n** its size or internal structure and never deals with the\r\n** sqlite3_pcache object except by holding and passing pointers\r\n** to the object.\r\n**\r\n** See [sqlite3_pcache_methods2] for additional information.\r\n*/\r\ntypedef struct sqlite3_pcache sqlite3_pcache;\r\n\r\n/*\r\n** CAPI3REF: Custom Page Cache Object\r\n**\r\n** The sqlite3_pcache_page object represents a single page in the\r\n** page cache.  The page cache will allocate instances of this\r\n** object.  Various methods of the page cache use pointers to instances\r\n** of this object as parameters or as their return value.\r\n**\r\n** See [sqlite3_pcache_methods2] for additional information.\r\n*/\r\ntypedef struct sqlite3_pcache_page sqlite3_pcache_page;\r\nstruct sqlite3_pcache_page {\r\n  void *pBuf;        /* The content of the page */\r\n  void *pExtra;      /* Extra information associated with the page */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Application Defined Page Cache.\r\n** KEYWORDS: {page cache}\r\n**\r\n** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can\r\n** register an alternative page cache implementation by passing in an \r\n** instance of the sqlite3_pcache_methods2 structure.)^\r\n** In many applications, most of the heap memory allocated by \r\n** SQLite is used for the page cache.\r\n** By implementing a \r\n** custom page cache using this API, an application can better control\r\n** the amount of memory consumed by SQLite, the way in which \r\n** that memory is allocated and released, and the policies used to \r\n** determine exactly which parts of a database file are cached and for \r\n** how long.\r\n**\r\n** The alternative page cache mechanism is an\r\n** extreme measure that is only needed by the most demanding applications.\r\n** The built-in page cache is recommended for most uses.\r\n**\r\n** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an\r\n** internal buffer by SQLite within the call to [sqlite3_config].  Hence\r\n** the application may discard the parameter after the call to\r\n** [sqlite3_config()] returns.)^\r\n**\r\n** [[the xInit() page cache method]]\r\n** ^(The xInit() method is called once for each effective \r\n** call to [sqlite3_initialize()])^\r\n** (usually only once during the lifetime of the process). ^(The xInit()\r\n** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^\r\n** The intent of the xInit() method is to set up global data structures \r\n** required by the custom page cache implementation. \r\n** ^(If the xInit() method is NULL, then the \r\n** built-in default page cache is used instead of the application defined\r\n** page cache.)^\r\n**\r\n** [[the xShutdown() page cache method]]\r\n** ^The xShutdown() method is called by [sqlite3_shutdown()].\r\n** It can be used to clean up \r\n** any outstanding resources before process shutdown, if required.\r\n** ^The xShutdown() method may be NULL.\r\n**\r\n** ^SQLite automatically serializes calls to the xInit method,\r\n** so the xInit method need not be threadsafe.  ^The\r\n** xShutdown method is only called from [sqlite3_shutdown()] so it does\r\n** not need to be threadsafe either.  All other methods must be threadsafe\r\n** in multithreaded applications.\r\n**\r\n** ^SQLite will never invoke xInit() more than once without an intervening\r\n** call to xShutdown().\r\n**\r\n** [[the xCreate() page cache methods]]\r\n** ^SQLite invokes the xCreate() method to construct a new cache instance.\r\n** SQLite will typically create one cache instance for each open database file,\r\n** though this is not guaranteed. ^The\r\n** first parameter, szPage, is the size in bytes of the pages that must\r\n** be allocated by the cache.  ^szPage will always a power of two.  ^The\r\n** second parameter szExtra is a number of bytes of extra storage \r\n** associated with each page cache entry.  ^The szExtra parameter will\r\n** a number less than 250.  SQLite will use the\r\n** extra szExtra bytes on each page to store metadata about the underlying\r\n** database page on disk.  The value passed into szExtra depends\r\n** on the SQLite version, the target platform, and how SQLite was compiled.\r\n** ^The third argument to xCreate(), bPurgeable, is true if the cache being\r\n** created will be used to cache database pages of a file stored on disk, or\r\n** false if it is used for an in-memory database. The cache implementation\r\n** does not have to do anything special based with the value of bPurgeable;\r\n** it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will\r\n** never invoke xUnpin() except to deliberately delete a page.\r\n** ^In other words, calls to xUnpin() on a cache with bPurgeable set to\r\n** false will always have the \"discard\" flag set to true.  \r\n** ^Hence, a cache created with bPurgeable false will\r\n** never contain any unpinned pages.\r\n**\r\n** [[the xCachesize() page cache method]]\r\n** ^(The xCachesize() method may be called at any time by SQLite to set the\r\n** suggested maximum cache-size (number of pages stored by) the cache\r\n** instance passed as the first argument. This is the value configured using\r\n** the SQLite \"[PRAGMA cache_size]\" command.)^  As with the bPurgeable\r\n** parameter, the implementation is not required to do anything with this\r\n** value; it is advisory only.\r\n**\r\n** [[the xPagecount() page cache methods]]\r\n** The xPagecount() method must return the number of pages currently\r\n** stored in the cache, both pinned and unpinned.\r\n** \r\n** [[the xFetch() page cache methods]]\r\n** The xFetch() method locates a page in the cache and returns a pointer to \r\n** an sqlite3_pcache_page object associated with that page, or a NULL pointer.\r\n** The pBuf element of the returned sqlite3_pcache_page object will be a\r\n** pointer to a buffer of szPage bytes used to store the content of a \r\n** single database page.  The pExtra element of sqlite3_pcache_page will be\r\n** a pointer to the szExtra bytes of extra storage that SQLite has requested\r\n** for each entry in the page cache.\r\n**\r\n** The page to be fetched is determined by the key. ^The minimum key value\r\n** is 1.  After it has been retrieved using xFetch, the page is considered\r\n** to be \"pinned\".\r\n**\r\n** If the requested page is already in the page cache, then the page cache\r\n** implementation must return a pointer to the page buffer with its content\r\n** intact.  If the requested page is not already in the cache, then the\r\n** cache implementation should use the value of the createFlag\r\n** parameter to help it determined what action to take:\r\n**\r\n** <table border=1 width=85% align=center>\r\n** <tr><th> createFlag <th> Behaviour when page is not already in cache\r\n** <tr><td> 0 <td> Do not allocate a new page.  Return NULL.\r\n** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.\r\n**                 Otherwise return NULL.\r\n** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return\r\n**                 NULL if allocating a new page is effectively impossible.\r\n** </table>\r\n**\r\n** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite\r\n** will only use a createFlag of 2 after a prior call with a createFlag of 1\r\n** failed.)^  In between the to xFetch() calls, SQLite may\r\n** attempt to unpin one or more cache pages by spilling the content of\r\n** pinned pages to disk and synching the operating system disk cache.\r\n**\r\n** [[the xUnpin() page cache method]]\r\n** ^xUnpin() is called by SQLite with a pointer to a currently pinned page\r\n** as its second argument.  If the third parameter, discard, is non-zero,\r\n** then the page must be evicted from the cache.\r\n** ^If the discard parameter is\r\n** zero, then the page may be discarded or retained at the discretion of\r\n** page cache implementation. ^The page cache implementation\r\n** may choose to evict unpinned pages at any time.\r\n**\r\n** The cache must not perform any reference counting. A single \r\n** call to xUnpin() unpins the page regardless of the number of prior calls \r\n** to xFetch().\r\n**\r\n** [[the xRekey() page cache methods]]\r\n** The xRekey() method is used to change the key value associated with the\r\n** page passed as the second argument. If the cache\r\n** previously contains an entry associated with newKey, it must be\r\n** discarded. ^Any prior cache entry associated with newKey is guaranteed not\r\n** to be pinned.\r\n**\r\n** When SQLite calls the xTruncate() method, the cache must discard all\r\n** existing cache entries with page numbers (keys) greater than or equal\r\n** to the value of the iLimit parameter passed to xTruncate(). If any\r\n** of these pages are pinned, they are implicitly unpinned, meaning that\r\n** they can be safely discarded.\r\n**\r\n** [[the xDestroy() page cache method]]\r\n** ^The xDestroy() method is used to delete a cache allocated by xCreate().\r\n** All resources associated with the specified cache should be freed. ^After\r\n** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]\r\n** handle invalid, and will not use it with any other sqlite3_pcache_methods2\r\n** functions.\r\n**\r\n** [[the xShrink() page cache method]]\r\n** ^SQLite invokes the xShrink() method when it wants the page cache to\r\n** free up as much of heap memory as possible.  The page cache implementation\r\n** is not obligated to free any memory, but well-behaved implementations should\r\n** do their best.\r\n*/\r\ntypedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;\r\nstruct sqlite3_pcache_methods2 {\r\n  int iVersion;\r\n  void *pArg;\r\n  int (*xInit)(void*);\r\n  void (*xShutdown)(void*);\r\n  sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);\r\n  void (*xCachesize)(sqlite3_pcache*, int nCachesize);\r\n  int (*xPagecount)(sqlite3_pcache*);\r\n  sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);\r\n  void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);\r\n  void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, \r\n      unsigned oldKey, unsigned newKey);\r\n  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);\r\n  void (*xDestroy)(sqlite3_pcache*);\r\n  void (*xShrink)(sqlite3_pcache*);\r\n};\r\n\r\n/*\r\n** This is the obsolete pcache_methods object that has now been replaced\r\n** by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is\r\n** retained in the header file for backwards compatibility only.\r\n*/\r\ntypedef struct sqlite3_pcache_methods sqlite3_pcache_methods;\r\nstruct sqlite3_pcache_methods {\r\n  void *pArg;\r\n  int (*xInit)(void*);\r\n  void (*xShutdown)(void*);\r\n  sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);\r\n  void (*xCachesize)(sqlite3_pcache*, int nCachesize);\r\n  int (*xPagecount)(sqlite3_pcache*);\r\n  void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);\r\n  void (*xUnpin)(sqlite3_pcache*, void*, int discard);\r\n  void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);\r\n  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);\r\n  void (*xDestroy)(sqlite3_pcache*);\r\n};\r\n\r\n\r\n/*\r\n** CAPI3REF: Online Backup Object\r\n**\r\n** The sqlite3_backup object records state information about an ongoing\r\n** online backup operation.  ^The sqlite3_backup object is created by\r\n** a call to [sqlite3_backup_init()] and is destroyed by a call to\r\n** [sqlite3_backup_finish()].\r\n**\r\n** See Also: [Using the SQLite Online Backup API]\r\n*/\r\ntypedef struct sqlite3_backup sqlite3_backup;\r\n\r\n/*\r\n** CAPI3REF: Online Backup API.\r\n**\r\n** The backup API copies the content of one database into another.\r\n** It is useful either for creating backups of databases or\r\n** for copying in-memory databases to or from persistent files. \r\n**\r\n** See Also: [Using the SQLite Online Backup API]\r\n**\r\n** ^SQLite holds a write transaction open on the destination database file\r\n** for the duration of the backup operation.\r\n** ^The source database is read-locked only while it is being read;\r\n** it is not locked continuously for the entire backup operation.\r\n** ^Thus, the backup may be performed on a live source database without\r\n** preventing other database connections from\r\n** reading or writing to the source database while the backup is underway.\r\n** \r\n** ^(To perform a backup operation: \r\n**   <ol>\r\n**     <li><b>sqlite3_backup_init()</b> is called once to initialize the\r\n**         backup, \r\n**     <li><b>sqlite3_backup_step()</b> is called one or more times to transfer \r\n**         the data between the two databases, and finally\r\n**     <li><b>sqlite3_backup_finish()</b> is called to release all resources \r\n**         associated with the backup operation. \r\n**   </ol>)^\r\n** There should be exactly one call to sqlite3_backup_finish() for each\r\n** successful call to sqlite3_backup_init().\r\n**\r\n** [[sqlite3_backup_init()]] <b>sqlite3_backup_init()</b>\r\n**\r\n** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the \r\n** [database connection] associated with the destination database \r\n** and the database name, respectively.\r\n** ^The database name is \"main\" for the main database, \"temp\" for the\r\n** temporary database, or the name specified after the AS keyword in\r\n** an [ATTACH] statement for an attached database.\r\n** ^The S and M arguments passed to \r\n** sqlite3_backup_init(D,N,S,M) identify the [database connection]\r\n** and database name of the source database, respectively.\r\n** ^The source and destination [database connections] (parameters S and D)\r\n** must be different or else sqlite3_backup_init(D,N,S,M) will fail with\r\n** an error.\r\n**\r\n** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is\r\n** returned and an error code and error message are stored in the\r\n** destination [database connection] D.\r\n** ^The error code and message for the failed call to sqlite3_backup_init()\r\n** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or\r\n** [sqlite3_errmsg16()] functions.\r\n** ^A successful call to sqlite3_backup_init() returns a pointer to an\r\n** [sqlite3_backup] object.\r\n** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and\r\n** sqlite3_backup_finish() functions to perform the specified backup \r\n** operation.\r\n**\r\n** [[sqlite3_backup_step()]] <b>sqlite3_backup_step()</b>\r\n**\r\n** ^Function sqlite3_backup_step(B,N) will copy up to N pages between \r\n** the source and destination databases specified by [sqlite3_backup] object B.\r\n** ^If N is negative, all remaining source pages are copied. \r\n** ^If sqlite3_backup_step(B,N) successfully copies N pages and there\r\n** are still more pages to be copied, then the function returns [SQLITE_OK].\r\n** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages\r\n** from source to destination, then it returns [SQLITE_DONE].\r\n** ^If an error occurs while running sqlite3_backup_step(B,N),\r\n** then an [error code] is returned. ^As well as [SQLITE_OK] and\r\n** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],\r\n** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an\r\n** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.\r\n**\r\n** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if\r\n** <ol>\r\n** <li> the destination database was opened read-only, or\r\n** <li> the destination database is using write-ahead-log journaling\r\n** and the destination and source page sizes differ, or\r\n** <li> the destination database is an in-memory database and the\r\n** destination and source page sizes differ.\r\n** </ol>)^\r\n**\r\n** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then\r\n** the [sqlite3_busy_handler | busy-handler function]\r\n** is invoked (if one is specified). ^If the \r\n** busy-handler returns non-zero before the lock is available, then \r\n** [SQLITE_BUSY] is returned to the caller. ^In this case the call to\r\n** sqlite3_backup_step() can be retried later. ^If the source\r\n** [database connection]\r\n** is being used to write to the source database when sqlite3_backup_step()\r\n** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this\r\n** case the call to sqlite3_backup_step() can be retried later on. ^(If\r\n** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or\r\n** [SQLITE_READONLY] is returned, then \r\n** there is no point in retrying the call to sqlite3_backup_step(). These \r\n** errors are considered fatal.)^  The application must accept \r\n** that the backup operation has failed and pass the backup operation handle \r\n** to the sqlite3_backup_finish() to release associated resources.\r\n**\r\n** ^The first call to sqlite3_backup_step() obtains an exclusive lock\r\n** on the destination file. ^The exclusive lock is not released until either \r\n** sqlite3_backup_finish() is called or the backup operation is complete \r\n** and sqlite3_backup_step() returns [SQLITE_DONE].  ^Every call to\r\n** sqlite3_backup_step() obtains a [shared lock] on the source database that\r\n** lasts for the duration of the sqlite3_backup_step() call.\r\n** ^Because the source database is not locked between calls to\r\n** sqlite3_backup_step(), the source database may be modified mid-way\r\n** through the backup process.  ^If the source database is modified by an\r\n** external process or via a database connection other than the one being\r\n** used by the backup operation, then the backup will be automatically\r\n** restarted by the next call to sqlite3_backup_step(). ^If the source \r\n** database is modified by the using the same database connection as is used\r\n** by the backup operation, then the backup database is automatically\r\n** updated at the same time.\r\n**\r\n** [[sqlite3_backup_finish()]] <b>sqlite3_backup_finish()</b>\r\n**\r\n** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the \r\n** application wishes to abandon the backup operation, the application\r\n** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().\r\n** ^The sqlite3_backup_finish() interfaces releases all\r\n** resources associated with the [sqlite3_backup] object. \r\n** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any\r\n** active write-transaction on the destination database is rolled back.\r\n** The [sqlite3_backup] object is invalid\r\n** and may not be used following a call to sqlite3_backup_finish().\r\n**\r\n** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no\r\n** sqlite3_backup_step() errors occurred, regardless or whether or not\r\n** sqlite3_backup_step() completed.\r\n** ^If an out-of-memory condition or IO error occurred during any prior\r\n** sqlite3_backup_step() call on the same [sqlite3_backup] object, then\r\n** sqlite3_backup_finish() returns the corresponding [error code].\r\n**\r\n** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()\r\n** is not a permanent error and does not affect the return value of\r\n** sqlite3_backup_finish().\r\n**\r\n** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]]\r\n** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>\r\n**\r\n** ^Each call to sqlite3_backup_step() sets two values inside\r\n** the [sqlite3_backup] object: the number of pages still to be backed\r\n** up and the total number of pages in the source database file.\r\n** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces\r\n** retrieve these two values, respectively.\r\n**\r\n** ^The values returned by these functions are only updated by\r\n** sqlite3_backup_step(). ^If the source database is modified during a backup\r\n** operation, then the values are not updated to account for any extra\r\n** pages that need to be updated or the size of the source database file\r\n** changing.\r\n**\r\n** <b>Concurrent Usage of Database Handles</b>\r\n**\r\n** ^The source [database connection] may be used by the application for other\r\n** purposes while a backup operation is underway or being initialized.\r\n** ^If SQLite is compiled and configured to support threadsafe database\r\n** connections, then the source database connection may be used concurrently\r\n** from within other threads.\r\n**\r\n** However, the application must guarantee that the destination \r\n** [database connection] is not passed to any other API (by any thread) after \r\n** sqlite3_backup_init() is called and before the corresponding call to\r\n** sqlite3_backup_finish().  SQLite does not currently check to see\r\n** if the application incorrectly accesses the destination [database connection]\r\n** and so no error code is reported, but the operations may malfunction\r\n** nevertheless.  Use of the destination database connection while a\r\n** backup is in progress might also also cause a mutex deadlock.\r\n**\r\n** If running in [shared cache mode], the application must\r\n** guarantee that the shared cache used by the destination database\r\n** is not accessed while the backup is running. In practice this means\r\n** that the application must guarantee that the disk file being \r\n** backed up to is not accessed by any connection within the process,\r\n** not just the specific connection that was passed to sqlite3_backup_init().\r\n**\r\n** The [sqlite3_backup] object itself is partially threadsafe. Multiple \r\n** threads may safely make multiple concurrent calls to sqlite3_backup_step().\r\n** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()\r\n** APIs are not strictly speaking threadsafe. If they are invoked at the\r\n** same time as another thread is invoking sqlite3_backup_step() it is\r\n** possible that they return invalid values.\r\n*/\r\nSQLITE_API sqlite3_backup *sqlite3_backup_init(\r\n  sqlite3 *pDest,                        /* Destination database handle */\r\n  const char *zDestName,                 /* Destination database name */\r\n  sqlite3 *pSource,                      /* Source database handle */\r\n  const char *zSourceName                /* Source database name */\r\n);\r\nSQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);\r\nSQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);\r\nSQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);\r\nSQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);\r\n\r\n/*\r\n** CAPI3REF: Unlock Notification\r\n**\r\n** ^When running in shared-cache mode, a database operation may fail with\r\n** an [SQLITE_LOCKED] error if the required locks on the shared-cache or\r\n** individual tables within the shared-cache cannot be obtained. See\r\n** [SQLite Shared-Cache Mode] for a description of shared-cache locking. \r\n** ^This API may be used to register a callback that SQLite will invoke \r\n** when the connection currently holding the required lock relinquishes it.\r\n** ^This API is only available if the library was compiled with the\r\n** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.\r\n**\r\n** See Also: [Using the SQLite Unlock Notification Feature].\r\n**\r\n** ^Shared-cache locks are released when a database connection concludes\r\n** its current transaction, either by committing it or rolling it back. \r\n**\r\n** ^When a connection (known as the blocked connection) fails to obtain a\r\n** shared-cache lock and SQLITE_LOCKED is returned to the caller, the\r\n** identity of the database connection (the blocking connection) that\r\n** has locked the required resource is stored internally. ^After an \r\n** application receives an SQLITE_LOCKED error, it may call the\r\n** sqlite3_unlock_notify() method with the blocked connection handle as \r\n** the first argument to register for a callback that will be invoked\r\n** when the blocking connections current transaction is concluded. ^The\r\n** callback is invoked from within the [sqlite3_step] or [sqlite3_close]\r\n** call that concludes the blocking connections transaction.\r\n**\r\n** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,\r\n** there is a chance that the blocking connection will have already\r\n** concluded its transaction by the time sqlite3_unlock_notify() is invoked.\r\n** If this happens, then the specified callback is invoked immediately,\r\n** from within the call to sqlite3_unlock_notify().)^\r\n**\r\n** ^If the blocked connection is attempting to obtain a write-lock on a\r\n** shared-cache table, and more than one other connection currently holds\r\n** a read-lock on the same table, then SQLite arbitrarily selects one of \r\n** the other connections to use as the blocking connection.\r\n**\r\n** ^(There may be at most one unlock-notify callback registered by a \r\n** blocked connection. If sqlite3_unlock_notify() is called when the\r\n** blocked connection already has a registered unlock-notify callback,\r\n** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is\r\n** called with a NULL pointer as its second argument, then any existing\r\n** unlock-notify callback is canceled. ^The blocked connections \r\n** unlock-notify callback may also be canceled by closing the blocked\r\n** connection using [sqlite3_close()].\r\n**\r\n** The unlock-notify callback is not reentrant. If an application invokes\r\n** any sqlite3_xxx API functions from within an unlock-notify callback, a\r\n** crash or deadlock may be the result.\r\n**\r\n** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always\r\n** returns SQLITE_OK.\r\n**\r\n** <b>Callback Invocation Details</b>\r\n**\r\n** When an unlock-notify callback is registered, the application provides a \r\n** single void* pointer that is passed to the callback when it is invoked.\r\n** However, the signature of the callback function allows SQLite to pass\r\n** it an array of void* context pointers. The first argument passed to\r\n** an unlock-notify callback is a pointer to an array of void* pointers,\r\n** and the second is the number of entries in the array.\r\n**\r\n** When a blocking connections transaction is concluded, there may be\r\n** more than one blocked connection that has registered for an unlock-notify\r\n** callback. ^If two or more such blocked connections have specified the\r\n** same callback function, then instead of invoking the callback function\r\n** multiple times, it is invoked once with the set of void* context pointers\r\n** specified by the blocked connections bundled together into an array.\r\n** This gives the application an opportunity to prioritize any actions \r\n** related to the set of unblocked database connections.\r\n**\r\n** <b>Deadlock Detection</b>\r\n**\r\n** Assuming that after registering for an unlock-notify callback a \r\n** database waits for the callback to be issued before taking any further\r\n** action (a reasonable assumption), then using this API may cause the\r\n** application to deadlock. For example, if connection X is waiting for\r\n** connection Y's transaction to be concluded, and similarly connection\r\n** Y is waiting on connection X's transaction, then neither connection\r\n** will proceed and the system may remain deadlocked indefinitely.\r\n**\r\n** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock\r\n** detection. ^If a given call to sqlite3_unlock_notify() would put the\r\n** system in a deadlocked state, then SQLITE_LOCKED is returned and no\r\n** unlock-notify callback is registered. The system is said to be in\r\n** a deadlocked state if connection A has registered for an unlock-notify\r\n** callback on the conclusion of connection B's transaction, and connection\r\n** B has itself registered for an unlock-notify callback when connection\r\n** A's transaction is concluded. ^Indirect deadlock is also detected, so\r\n** the system is also considered to be deadlocked if connection B has\r\n** registered for an unlock-notify callback on the conclusion of connection\r\n** C's transaction, where connection C is waiting on connection A. ^Any\r\n** number of levels of indirection are allowed.\r\n**\r\n** <b>The \"DROP TABLE\" Exception</b>\r\n**\r\n** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost \r\n** always appropriate to call sqlite3_unlock_notify(). There is however,\r\n** one exception. When executing a \"DROP TABLE\" or \"DROP INDEX\" statement,\r\n** SQLite checks if there are any currently executing SELECT statements\r\n** that belong to the same connection. If there are, SQLITE_LOCKED is\r\n** returned. In this case there is no \"blocking connection\", so invoking\r\n** sqlite3_unlock_notify() results in the unlock-notify callback being\r\n** invoked immediately. If the application then re-attempts the \"DROP TABLE\"\r\n** or \"DROP INDEX\" query, an infinite loop might be the result.\r\n**\r\n** One way around this problem is to check the extended error code returned\r\n** by an sqlite3_step() call. ^(If there is a blocking connection, then the\r\n** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in\r\n** the special \"DROP TABLE/INDEX\" case, the extended error code is just \r\n** SQLITE_LOCKED.)^\r\n*/\r\nSQLITE_API int sqlite3_unlock_notify(\r\n  sqlite3 *pBlocked,                          /* Waiting connection */\r\n  void (*xNotify)(void **apArg, int nArg),    /* Callback function to invoke */\r\n  void *pNotifyArg                            /* Argument to pass to xNotify */\r\n);\r\n\r\n\r\n/*\r\n** CAPI3REF: String Comparison\r\n**\r\n** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications\r\n** and extensions to compare the contents of two buffers containing UTF-8\r\n** strings in a case-independent fashion, using the same definition of \"case\r\n** independence\" that SQLite uses internally when comparing identifiers.\r\n*/\r\nSQLITE_API int sqlite3_stricmp(const char *, const char *);\r\nSQLITE_API int sqlite3_strnicmp(const char *, const char *, int);\r\n\r\n/*\r\n** CAPI3REF: Error Logging Interface\r\n**\r\n** ^The [sqlite3_log()] interface writes a message into the error log\r\n** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].\r\n** ^If logging is enabled, the zFormat string and subsequent arguments are\r\n** used with [sqlite3_snprintf()] to generate the final output string.\r\n**\r\n** The sqlite3_log() interface is intended for use by extensions such as\r\n** virtual tables, collating functions, and SQL functions.  While there is\r\n** nothing to prevent an application from calling sqlite3_log(), doing so\r\n** is considered bad form.\r\n**\r\n** The zFormat string must not be NULL.\r\n**\r\n** To avoid deadlocks and other threading problems, the sqlite3_log() routine\r\n** will not use dynamically allocated memory.  The log message is stored in\r\n** a fixed-length buffer on the stack.  If the log message is longer than\r\n** a few hundred characters, it will be truncated to the length of the\r\n** buffer.\r\n*/\r\nSQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);\r\n\r\n/*\r\n** CAPI3REF: Write-Ahead Log Commit Hook\r\n**\r\n** ^The [sqlite3_wal_hook()] function is used to register a callback that\r\n** will be invoked each time a database connection commits data to a\r\n** [write-ahead log] (i.e. whenever a transaction is committed in\r\n** [journal_mode | journal_mode=WAL mode]). \r\n**\r\n** ^The callback is invoked by SQLite after the commit has taken place and \r\n** the associated write-lock on the database released, so the implementation \r\n** may read, write or [checkpoint] the database as required.\r\n**\r\n** ^The first parameter passed to the callback function when it is invoked\r\n** is a copy of the third parameter passed to sqlite3_wal_hook() when\r\n** registering the callback. ^The second is a copy of the database handle.\r\n** ^The third parameter is the name of the database that was written to -\r\n** either \"main\" or the name of an [ATTACH]-ed database. ^The fourth parameter\r\n** is the number of pages currently in the write-ahead log file,\r\n** including those that were just committed.\r\n**\r\n** The callback function should normally return [SQLITE_OK].  ^If an error\r\n** code is returned, that error will propagate back up through the\r\n** SQLite code base to cause the statement that provoked the callback\r\n** to report an error, though the commit will have still occurred. If the\r\n** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value\r\n** that does not correspond to any valid SQLite error code, the results\r\n** are undefined.\r\n**\r\n** A single database handle may have at most a single write-ahead log callback \r\n** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any\r\n** previously registered write-ahead log callback. ^Note that the\r\n** [sqlite3_wal_autocheckpoint()] interface and the\r\n** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will\r\n** those overwrite any prior [sqlite3_wal_hook()] settings.\r\n*/\r\nSQLITE_API void *sqlite3_wal_hook(\r\n  sqlite3*, \r\n  int(*)(void *,sqlite3*,const char*,int),\r\n  void*\r\n);\r\n\r\n/*\r\n** CAPI3REF: Configure an auto-checkpoint\r\n**\r\n** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around\r\n** [sqlite3_wal_hook()] that causes any database on [database connection] D\r\n** to automatically [checkpoint]\r\n** after committing a transaction if there are N or\r\n** more frames in the [write-ahead log] file.  ^Passing zero or \r\n** a negative value as the nFrame parameter disables automatic\r\n** checkpoints entirely.\r\n**\r\n** ^The callback registered by this function replaces any existing callback\r\n** registered using [sqlite3_wal_hook()].  ^Likewise, registering a callback\r\n** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism\r\n** configured by this function.\r\n**\r\n** ^The [wal_autocheckpoint pragma] can be used to invoke this interface\r\n** from SQL.\r\n**\r\n** ^Every new [database connection] defaults to having the auto-checkpoint\r\n** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]\r\n** pages.  The use of this interface\r\n** is only necessary if the default setting is found to be suboptimal\r\n** for a particular application.\r\n*/\r\nSQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);\r\n\r\n/*\r\n** CAPI3REF: Checkpoint a database\r\n**\r\n** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X\r\n** on [database connection] D to be [checkpointed].  ^If X is NULL or an\r\n** empty string, then a checkpoint is run on all databases of\r\n** connection D.  ^If the database connection D is not in\r\n** [WAL | write-ahead log mode] then this interface is a harmless no-op.\r\n**\r\n** ^The [wal_checkpoint pragma] can be used to invoke this interface\r\n** from SQL.  ^The [sqlite3_wal_autocheckpoint()] interface and the\r\n** [wal_autocheckpoint pragma] can be used to cause this interface to be\r\n** run whenever the WAL reaches a certain size threshold.\r\n**\r\n** See also: [sqlite3_wal_checkpoint_v2()]\r\n*/\r\nSQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);\r\n\r\n/*\r\n** CAPI3REF: Checkpoint a database\r\n**\r\n** Run a checkpoint operation on WAL database zDb attached to database \r\n** handle db. The specific operation is determined by the value of the \r\n** eMode parameter:\r\n**\r\n** <dl>\r\n** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>\r\n**   Checkpoint as many frames as possible without waiting for any database \r\n**   readers or writers to finish. Sync the db file if all frames in the log\r\n**   are checkpointed. This mode is the same as calling \r\n**   sqlite3_wal_checkpoint(). The busy-handler callback is never invoked.\r\n**\r\n** <dt>SQLITE_CHECKPOINT_FULL<dd>\r\n**   This mode blocks (calls the busy-handler callback) until there is no\r\n**   database writer and all readers are reading from the most recent database\r\n**   snapshot. It then checkpoints all frames in the log file and syncs the\r\n**   database file. This call blocks database writers while it is running,\r\n**   but not database readers.\r\n**\r\n** <dt>SQLITE_CHECKPOINT_RESTART<dd>\r\n**   This mode works the same way as SQLITE_CHECKPOINT_FULL, except after \r\n**   checkpointing the log file it blocks (calls the busy-handler callback)\r\n**   until all readers are reading from the database file only. This ensures \r\n**   that the next client to write to the database file restarts the log file \r\n**   from the beginning. This call blocks database writers while it is running,\r\n**   but not database readers.\r\n** </dl>\r\n**\r\n** If pnLog is not NULL, then *pnLog is set to the total number of frames in\r\n** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to\r\n** the total number of checkpointed frames (including any that were already\r\n** checkpointed when this function is called). *pnLog and *pnCkpt may be\r\n** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.\r\n** If no values are available because of an error, they are both set to -1\r\n** before returning to communicate this to the caller.\r\n**\r\n** All calls obtain an exclusive \"checkpoint\" lock on the database file. If\r\n** any other process is running a checkpoint operation at the same time, the \r\n** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a \r\n** busy-handler configured, it will not be invoked in this case.\r\n**\r\n** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive \r\n** \"writer\" lock on the database file. If the writer lock cannot be obtained\r\n** immediately, and a busy-handler is configured, it is invoked and the writer\r\n** lock retried until either the busy-handler returns 0 or the lock is\r\n** successfully obtained. The busy-handler is also invoked while waiting for\r\n** database readers as described above. If the busy-handler returns 0 before\r\n** the writer lock is obtained or while waiting for database readers, the\r\n** checkpoint operation proceeds from that point in the same way as \r\n** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible \r\n** without blocking any further. SQLITE_BUSY is returned in this case.\r\n**\r\n** If parameter zDb is NULL or points to a zero length string, then the\r\n** specified operation is attempted on all WAL databases. In this case the\r\n** values written to output parameters *pnLog and *pnCkpt are undefined. If \r\n** an SQLITE_BUSY error is encountered when processing one or more of the \r\n** attached WAL databases, the operation is still attempted on any remaining \r\n** attached databases and SQLITE_BUSY is returned to the caller. If any other \r\n** error occurs while processing an attached database, processing is abandoned \r\n** and the error code returned to the caller immediately. If no error \r\n** (SQLITE_BUSY or otherwise) is encountered while processing the attached \r\n** databases, SQLITE_OK is returned.\r\n**\r\n** If database zDb is the name of an attached database that is not in WAL\r\n** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If\r\n** zDb is not NULL (or a zero length string) and is not the name of any\r\n** attached database, SQLITE_ERROR is returned to the caller.\r\n*/\r\nSQLITE_API int sqlite3_wal_checkpoint_v2(\r\n  sqlite3 *db,                    /* Database handle */\r\n  const char *zDb,                /* Name of attached database (or NULL) */\r\n  int eMode,                      /* SQLITE_CHECKPOINT_* value */\r\n  int *pnLog,                     /* OUT: Size of WAL log in frames */\r\n  int *pnCkpt                     /* OUT: Total number of frames checkpointed */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Checkpoint operation parameters\r\n**\r\n** These constants can be used as the 3rd parameter to\r\n** [sqlite3_wal_checkpoint_v2()].  See the [sqlite3_wal_checkpoint_v2()]\r\n** documentation for additional information about the meaning and use of\r\n** each of these values.\r\n*/\r\n#define SQLITE_CHECKPOINT_PASSIVE 0\r\n#define SQLITE_CHECKPOINT_FULL    1\r\n#define SQLITE_CHECKPOINT_RESTART 2\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Interface Configuration\r\n**\r\n** This function may be called by either the [xConnect] or [xCreate] method\r\n** of a [virtual table] implementation to configure\r\n** various facets of the virtual table interface.\r\n**\r\n** If this interface is invoked outside the context of an xConnect or\r\n** xCreate virtual table method then the behavior is undefined.\r\n**\r\n** At present, there is only one option that may be configured using\r\n** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].)  Further options\r\n** may be added in the future.\r\n*/\r\nSQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Configuration Options\r\n**\r\n** These macros define the various options to the\r\n** [sqlite3_vtab_config()] interface that [virtual table] implementations\r\n** can use to customize and optimize their behavior.\r\n**\r\n** <dl>\r\n** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT\r\n** <dd>Calls of the form\r\n** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,\r\n** where X is an integer.  If X is zero, then the [virtual table] whose\r\n** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not\r\n** support constraints.  In this configuration (which is the default) if\r\n** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire\r\n** statement is rolled back as if [ON CONFLICT | OR ABORT] had been\r\n** specified as part of the users SQL statement, regardless of the actual\r\n** ON CONFLICT mode specified.\r\n**\r\n** If X is non-zero, then the virtual table implementation guarantees\r\n** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before\r\n** any modifications to internal or persistent data structures have been made.\r\n** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite \r\n** is able to roll back a statement or database transaction, and abandon\r\n** or continue processing the current SQL statement as appropriate. \r\n** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns\r\n** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode\r\n** had been ABORT.\r\n**\r\n** Virtual table implementations that are required to handle OR REPLACE\r\n** must do so within the [xUpdate] method. If a call to the \r\n** [sqlite3_vtab_on_conflict()] function indicates that the current ON \r\n** CONFLICT policy is REPLACE, the virtual table implementation should \r\n** silently replace the appropriate rows within the xUpdate callback and\r\n** return SQLITE_OK. Or, if this is not possible, it may return\r\n** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT \r\n** constraint handling.\r\n** </dl>\r\n*/\r\n#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1\r\n\r\n/*\r\n** CAPI3REF: Determine The Virtual Table Conflict Policy\r\n**\r\n** This function may only be called from within a call to the [xUpdate] method\r\n** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The\r\n** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],\r\n** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode\r\n** of the SQL statement that triggered the call to the [xUpdate] method of the\r\n** [virtual table].\r\n*/\r\nSQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);\r\n\r\n/*\r\n** CAPI3REF: Conflict resolution modes\r\n**\r\n** These constants are returned by [sqlite3_vtab_on_conflict()] to\r\n** inform a [virtual table] implementation what the [ON CONFLICT] mode\r\n** is for the SQL statement being evaluated.\r\n**\r\n** Note that the [SQLITE_IGNORE] constant is also used as a potential\r\n** return value from the [sqlite3_set_authorizer()] callback and that\r\n** [SQLITE_ABORT] is also a [result code].\r\n*/\r\n#define SQLITE_ROLLBACK 1\r\n/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */\r\n#define SQLITE_FAIL     3\r\n/* #define SQLITE_ABORT 4  // Also an error code */\r\n#define SQLITE_REPLACE  5\r\n\r\n\r\n\r\n/*\r\n** Undo the hack that converts floating point types to integer for\r\n** builds on processors without floating point support.\r\n*/\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n# undef double\r\n#endif\r\n\r\n#if 0\r\n}  /* End of the 'extern \"C\"' block */\r\n#endif\r\n#endif\r\n\r\n/*\r\n** 2010 August 30\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n*/\r\n\r\n#ifndef _SQLITE3RTREE_H_\r\n#define _SQLITE3RTREE_H_\r\n\r\n\r\n#if 0\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;\r\n\r\n/*\r\n** Register a geometry callback named zGeom that can be used as part of an\r\n** R-Tree geometry query as follows:\r\n**\r\n**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)\r\n*/\r\nSQLITE_API int sqlite3_rtree_geometry_callback(\r\n  sqlite3 *db,\r\n  const char *zGeom,\r\n  int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes),\r\n  void *pContext\r\n);\r\n\r\n\r\n/*\r\n** A pointer to a structure of the following type is passed as the first\r\n** argument to callbacks registered using rtree_geometry_callback().\r\n*/\r\nstruct sqlite3_rtree_geometry {\r\n  void *pContext;                 /* Copy of pContext passed to s_r_g_c() */\r\n  int nParam;                     /* Size of array aParam[] */\r\n  double *aParam;                 /* Parameters passed to SQL geom function */\r\n  void *pUser;                    /* Callback implementation user data */\r\n  void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */\r\n};\r\n\r\n\r\n#if 0\r\n}  /* end of the 'extern \"C\"' block */\r\n#endif\r\n\r\n#endif  /* ifndef _SQLITE3RTREE_H_ */\r\n\r\n\r\n/************** End of sqlite3.h *********************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n/************** Include hash.h in the middle of sqliteInt.h ******************/\r\n/************** Begin file hash.h ********************************************/\r\n/*\r\n** 2001 September 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This is the header file for the generic hash-table implemenation\r\n** used in SQLite.\r\n*/\r\n#ifndef _SQLITE_HASH_H_\r\n#define _SQLITE_HASH_H_\r\n\r\n/* Forward declarations of structures. */\r\ntypedef struct Hash Hash;\r\ntypedef struct HashElem HashElem;\r\n\r\n/* A complete hash table is an instance of the following structure.\r\n** The internals of this structure are intended to be opaque -- client\r\n** code should not attempt to access or modify the fields of this structure\r\n** directly.  Change this structure only by using the routines below.\r\n** However, some of the \"procedures\" and \"functions\" for modifying and\r\n** accessing this structure are really macros, so we can't really make\r\n** this structure opaque.\r\n**\r\n** All elements of the hash table are on a single doubly-linked list.\r\n** Hash.first points to the head of this list.\r\n**\r\n** There are Hash.htsize buckets.  Each bucket points to a spot in\r\n** the global doubly-linked list.  The contents of the bucket are the\r\n** element pointed to plus the next _ht.count-1 elements in the list.\r\n**\r\n** Hash.htsize and Hash.ht may be zero.  In that case lookup is done\r\n** by a linear search of the global list.  For small tables, the \r\n** Hash.ht table is never allocated because if there are few elements\r\n** in the table, it is faster to do a linear search than to manage\r\n** the hash table.\r\n*/\r\nstruct Hash {\r\n  unsigned int htsize;      /* Number of buckets in the hash table */\r\n  unsigned int count;       /* Number of entries in this table */\r\n  HashElem *first;          /* The first element of the array */\r\n  struct _ht {              /* the hash table */\r\n    int count;                 /* Number of entries with this hash */\r\n    HashElem *chain;           /* Pointer to first entry with this hash */\r\n  } *ht;\r\n};\r\n\r\n/* Each element in the hash table is an instance of the following \r\n** structure.  All elements are stored on a single doubly-linked list.\r\n**\r\n** Again, this structure is intended to be opaque, but it can't really\r\n** be opaque because it is used by macros.\r\n*/\r\nstruct HashElem {\r\n  HashElem *next, *prev;       /* Next and previous elements in the table */\r\n  void *data;                  /* Data associated with this element */\r\n  const char *pKey; int nKey;  /* Key associated with this element */\r\n};\r\n\r\n/*\r\n** Access routines.  To delete, insert a NULL pointer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3HashInit(Hash*);\r\nSQLITE_PRIVATE void *sqlite3HashInsert(Hash*, const char *pKey, int nKey, void *pData);\r\nSQLITE_PRIVATE void *sqlite3HashFind(const Hash*, const char *pKey, int nKey);\r\nSQLITE_PRIVATE void sqlite3HashClear(Hash*);\r\n\r\n/*\r\n** Macros for looping over all elements of a hash table.  The idiom is\r\n** like this:\r\n**\r\n**   Hash h;\r\n**   HashElem *p;\r\n**   ...\r\n**   for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){\r\n**     SomeStructure *pData = sqliteHashData(p);\r\n**     // do something with pData\r\n**   }\r\n*/\r\n#define sqliteHashFirst(H)  ((H)->first)\r\n#define sqliteHashNext(E)   ((E)->next)\r\n#define sqliteHashData(E)   ((E)->data)\r\n/* #define sqliteHashKey(E)    ((E)->pKey) // NOT USED */\r\n/* #define sqliteHashKeysize(E) ((E)->nKey)  // NOT USED */\r\n\r\n/*\r\n** Number of entries in a hash table\r\n*/\r\n/* #define sqliteHashCount(H)  ((H)->count) // NOT USED */\r\n\r\n#endif /* _SQLITE_HASH_H_ */\r\n\r\n/************** End of hash.h ************************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n/************** Include parse.h in the middle of sqliteInt.h *****************/\r\n/************** Begin file parse.h *******************************************/\r\n#define TK_SEMI                            1\r\n#define TK_EXPLAIN                         2\r\n#define TK_QUERY                           3\r\n#define TK_PLAN                            4\r\n#define TK_BEGIN                           5\r\n#define TK_TRANSACTION                     6\r\n#define TK_DEFERRED                        7\r\n#define TK_IMMEDIATE                       8\r\n#define TK_EXCLUSIVE                       9\r\n#define TK_COMMIT                         10\r\n#define TK_END                            11\r\n#define TK_ROLLBACK                       12\r\n#define TK_SAVEPOINT                      13\r\n#define TK_RELEASE                        14\r\n#define TK_TO                             15\r\n#define TK_TABLE                          16\r\n#define TK_CREATE                         17\r\n#define TK_IF                             18\r\n#define TK_NOT                            19\r\n#define TK_EXISTS                         20\r\n#define TK_TEMP                           21\r\n#define TK_LP                             22\r\n#define TK_RP                             23\r\n#define TK_AS                             24\r\n#define TK_COMMA                          25\r\n#define TK_ID                             26\r\n#define TK_INDEXED                        27\r\n#define TK_ABORT                          28\r\n#define TK_ACTION                         29\r\n#define TK_AFTER                          30\r\n#define TK_ANALYZE                        31\r\n#define TK_ASC                            32\r\n#define TK_ATTACH                         33\r\n#define TK_BEFORE                         34\r\n#define TK_BY                             35\r\n#define TK_CASCADE                        36\r\n#define TK_CAST                           37\r\n#define TK_COLUMNKW                       38\r\n#define TK_CONFLICT                       39\r\n#define TK_DATABASE                       40\r\n#define TK_DESC                           41\r\n#define TK_DETACH                         42\r\n#define TK_EACH                           43\r\n#define TK_FAIL                           44\r\n#define TK_FOR                            45\r\n#define TK_IGNORE                         46\r\n#define TK_INITIALLY                      47\r\n#define TK_INSTEAD                        48\r\n#define TK_LIKE_KW                        49\r\n#define TK_MATCH                          50\r\n#define TK_NO                             51\r\n#define TK_KEY                            52\r\n#define TK_OF                             53\r\n#define TK_OFFSET                         54\r\n#define TK_PRAGMA                         55\r\n#define TK_RAISE                          56\r\n#define TK_REPLACE                        57\r\n#define TK_RESTRICT                       58\r\n#define TK_ROW                            59\r\n#define TK_TRIGGER                        60\r\n#define TK_VACUUM                         61\r\n#define TK_VIEW                           62\r\n#define TK_VIRTUAL                        63\r\n#define TK_REINDEX                        64\r\n#define TK_RENAME                         65\r\n#define TK_CTIME_KW                       66\r\n#define TK_ANY                            67\r\n#define TK_OR                             68\r\n#define TK_AND                            69\r\n#define TK_IS                             70\r\n#define TK_BETWEEN                        71\r\n#define TK_IN                             72\r\n#define TK_ISNULL                         73\r\n#define TK_NOTNULL                        74\r\n#define TK_NE                             75\r\n#define TK_EQ                             76\r\n#define TK_GT                             77\r\n#define TK_LE                             78\r\n#define TK_LT                             79\r\n#define TK_GE                             80\r\n#define TK_ESCAPE                         81\r\n#define TK_BITAND                         82\r\n#define TK_BITOR                          83\r\n#define TK_LSHIFT                         84\r\n#define TK_RSHIFT                         85\r\n#define TK_PLUS                           86\r\n#define TK_MINUS                          87\r\n#define TK_STAR                           88\r\n#define TK_SLASH                          89\r\n#define TK_REM                            90\r\n#define TK_CONCAT                         91\r\n#define TK_COLLATE                        92\r\n#define TK_BITNOT                         93\r\n#define TK_STRING                         94\r\n#define TK_JOIN_KW                        95\r\n#define TK_CONSTRAINT                     96\r\n#define TK_DEFAULT                        97\r\n#define TK_NULL                           98\r\n#define TK_PRIMARY                        99\r\n#define TK_UNIQUE                         100\r\n#define TK_CHECK                          101\r\n#define TK_REFERENCES                     102\r\n#define TK_AUTOINCR                       103\r\n#define TK_ON                             104\r\n#define TK_INSERT                         105\r\n#define TK_DELETE                         106\r\n#define TK_UPDATE                         107\r\n#define TK_SET                            108\r\n#define TK_DEFERRABLE                     109\r\n#define TK_FOREIGN                        110\r\n#define TK_DROP                           111\r\n#define TK_UNION                          112\r\n#define TK_ALL                            113\r\n#define TK_EXCEPT                         114\r\n#define TK_INTERSECT                      115\r\n#define TK_SELECT                         116\r\n#define TK_DISTINCT                       117\r\n#define TK_DOT                            118\r\n#define TK_FROM                           119\r\n#define TK_JOIN                           120\r\n#define TK_USING                          121\r\n#define TK_ORDER                          122\r\n#define TK_GROUP                          123\r\n#define TK_HAVING                         124\r\n#define TK_LIMIT                          125\r\n#define TK_WHERE                          126\r\n#define TK_INTO                           127\r\n#define TK_VALUES                         128\r\n#define TK_INTEGER                        129\r\n#define TK_FLOAT                          130\r\n#define TK_BLOB                           131\r\n#define TK_REGISTER                       132\r\n#define TK_VARIABLE                       133\r\n#define TK_CASE                           134\r\n#define TK_WHEN                           135\r\n#define TK_THEN                           136\r\n#define TK_ELSE                           137\r\n#define TK_INDEX                          138\r\n#define TK_ALTER                          139\r\n#define TK_ADD                            140\r\n#define TK_TO_TEXT                        141\r\n#define TK_TO_BLOB                        142\r\n#define TK_TO_NUMERIC                     143\r\n#define TK_TO_INT                         144\r\n#define TK_TO_REAL                        145\r\n#define TK_ISNOT                          146\r\n#define TK_END_OF_FILE                    147\r\n#define TK_ILLEGAL                        148\r\n#define TK_SPACE                          149\r\n#define TK_UNCLOSED_STRING                150\r\n#define TK_FUNCTION                       151\r\n#define TK_COLUMN                         152\r\n#define TK_AGG_FUNCTION                   153\r\n#define TK_AGG_COLUMN                     154\r\n#define TK_CONST_FUNC                     155\r\n#define TK_UMINUS                         156\r\n#define TK_UPLUS                          157\r\n\r\n/************** End of parse.h ***********************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <assert.h>\r\n#include <stddef.h>\r\n\r\n/*\r\n** If compiling for a processor that lacks floating point support,\r\n** substitute integer for floating-point\r\n*/\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n# define double sqlite_int64\r\n# define float sqlite_int64\r\n# define LONGDOUBLE_TYPE sqlite_int64\r\n# ifndef SQLITE_BIG_DBL\r\n#   define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50)\r\n# endif\r\n# define SQLITE_OMIT_DATETIME_FUNCS 1\r\n# define SQLITE_OMIT_TRACE 1\r\n# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT\r\n# undef SQLITE_HAVE_ISNAN\r\n#endif\r\n#ifndef SQLITE_BIG_DBL\r\n# define SQLITE_BIG_DBL (1e99)\r\n#endif\r\n\r\n/*\r\n** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0\r\n** afterward. Having this macro allows us to cause the C compiler \r\n** to omit code used by TEMP tables without messy #ifndef statements.\r\n*/\r\n#ifdef SQLITE_OMIT_TEMPDB\r\n#define OMIT_TEMPDB 1\r\n#else\r\n#define OMIT_TEMPDB 0\r\n#endif\r\n\r\n/*\r\n** The \"file format\" number is an integer that is incremented whenever\r\n** the VDBE-level file format changes.  The following macros define the\r\n** the default file format for new databases and the maximum file format\r\n** that the library can read.\r\n*/\r\n#define SQLITE_MAX_FILE_FORMAT 4\r\n#ifndef SQLITE_DEFAULT_FILE_FORMAT\r\n# define SQLITE_DEFAULT_FILE_FORMAT 4\r\n#endif\r\n\r\n/*\r\n** Determine whether triggers are recursive by default.  This can be\r\n** changed at run-time using a pragma.\r\n*/\r\n#ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS\r\n# define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0\r\n#endif\r\n\r\n/*\r\n** Provide a default value for SQLITE_TEMP_STORE in case it is not specified\r\n** on the command-line\r\n*/\r\n#ifndef SQLITE_TEMP_STORE\r\n# define SQLITE_TEMP_STORE 1\r\n#endif\r\n\r\n/*\r\n** GCC does not define the offsetof() macro so we'll have to do it\r\n** ourselves.\r\n*/\r\n#ifndef offsetof\r\n#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))\r\n#endif\r\n\r\n/*\r\n** Check to see if this machine uses EBCDIC.  (Yes, believe it or\r\n** not, there are still machines out there that use EBCDIC.)\r\n*/\r\n#if 'A' == '\\301'\r\n# define SQLITE_EBCDIC 1\r\n#else\r\n# define SQLITE_ASCII 1\r\n#endif\r\n\r\n/*\r\n** Integers of known sizes.  These typedefs might change for architectures\r\n** where the sizes very.  Preprocessor macros are available so that the\r\n** types can be conveniently redefined at compile-type.  Like this:\r\n**\r\n**         cc '-DUINTPTR_TYPE=long long int' ...\r\n*/\r\n#ifndef UINT32_TYPE\r\n# ifdef HAVE_UINT32_T\r\n#  define UINT32_TYPE uint32_t\r\n# else\r\n#  define UINT32_TYPE unsigned int\r\n# endif\r\n#endif\r\n#ifndef UINT16_TYPE\r\n# ifdef HAVE_UINT16_T\r\n#  define UINT16_TYPE uint16_t\r\n# else\r\n#  define UINT16_TYPE unsigned short int\r\n# endif\r\n#endif\r\n#ifndef INT16_TYPE\r\n# ifdef HAVE_INT16_T\r\n#  define INT16_TYPE int16_t\r\n# else\r\n#  define INT16_TYPE short int\r\n# endif\r\n#endif\r\n#ifndef UINT8_TYPE\r\n# ifdef HAVE_UINT8_T\r\n#  define UINT8_TYPE uint8_t\r\n# else\r\n#  define UINT8_TYPE unsigned char\r\n# endif\r\n#endif\r\n#ifndef INT8_TYPE\r\n# ifdef HAVE_INT8_T\r\n#  define INT8_TYPE int8_t\r\n# else\r\n#  define INT8_TYPE signed char\r\n# endif\r\n#endif\r\n#ifndef LONGDOUBLE_TYPE\r\n# define LONGDOUBLE_TYPE long double\r\n#endif\r\ntypedef sqlite_int64 i64;          /* 8-byte signed integer */\r\ntypedef sqlite_uint64 u64;         /* 8-byte unsigned integer */\r\ntypedef UINT32_TYPE u32;           /* 4-byte unsigned integer */\r\ntypedef UINT16_TYPE u16;           /* 2-byte unsigned integer */\r\ntypedef INT16_TYPE i16;            /* 2-byte signed integer */\r\ntypedef UINT8_TYPE u8;             /* 1-byte unsigned integer */\r\ntypedef INT8_TYPE i8;              /* 1-byte signed integer */\r\n\r\n/*\r\n** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value\r\n** that can be stored in a u32 without loss of data.  The value\r\n** is 0x00000000ffffffff.  But because of quirks of some compilers, we\r\n** have to specify the value in the less intuitive manner shown:\r\n*/\r\n#define SQLITE_MAX_U32  ((((u64)1)<<32)-1)\r\n\r\n/*\r\n** The datatype used to store estimates of the number of rows in a\r\n** table or index.  This is an unsigned integer type.  For 99.9% of\r\n** the world, a 32-bit integer is sufficient.  But a 64-bit integer\r\n** can be used at compile-time if desired.\r\n*/\r\n#ifdef SQLITE_64BIT_STATS\r\n typedef u64 tRowcnt;    /* 64-bit only if requested at compile-time */\r\n#else\r\n typedef u32 tRowcnt;    /* 32-bit is the default */\r\n#endif\r\n\r\n/*\r\n** Macros to determine whether the machine is big or little endian,\r\n** evaluated at runtime.\r\n*/\r\n#ifdef SQLITE_AMALGAMATION\r\nSQLITE_PRIVATE const int sqlite3one = 1;\r\n#else\r\nSQLITE_PRIVATE const int sqlite3one;\r\n#endif\r\n#if defined(i386) || defined(__i386__) || defined(_M_IX86)\\\r\n                             || defined(__x86_64) || defined(__x86_64__)\r\n# define SQLITE_BIGENDIAN    0\r\n# define SQLITE_LITTLEENDIAN 1\r\n# define SQLITE_UTF16NATIVE  SQLITE_UTF16LE\r\n#else\r\n# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)\r\n# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)\r\n# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)\r\n#endif\r\n\r\n/*\r\n** Constants for the largest and smallest possible 64-bit signed integers.\r\n** These macros are designed to work correctly on both 32-bit and 64-bit\r\n** compilers.\r\n*/\r\n#define LARGEST_INT64  (0xffffffff|(((i64)0x7fffffff)<<32))\r\n#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)\r\n\r\n/* \r\n** Round up a number to the next larger multiple of 8.  This is used\r\n** to force 8-byte alignment on 64-bit architectures.\r\n*/\r\n#define ROUND8(x)     (((x)+7)&~7)\r\n\r\n/*\r\n** Round down to the nearest multiple of 8\r\n*/\r\n#define ROUNDDOWN8(x) ((x)&~7)\r\n\r\n/*\r\n** Assert that the pointer X is aligned to an 8-byte boundary.  This\r\n** macro is used only within assert() to verify that the code gets\r\n** all alignment restrictions correct.\r\n**\r\n** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the\r\n** underlying malloc() implemention might return us 4-byte aligned\r\n** pointers.  In that case, only verify 4-byte alignment.\r\n*/\r\n#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC\r\n# define EIGHT_BYTE_ALIGNMENT(X)   ((((char*)(X) - (char*)0)&3)==0)\r\n#else\r\n# define EIGHT_BYTE_ALIGNMENT(X)   ((((char*)(X) - (char*)0)&7)==0)\r\n#endif\r\n\r\n\r\n/*\r\n** An instance of the following structure is used to store the busy-handler\r\n** callback for a given sqlite handle. \r\n**\r\n** The sqlite.busyHandler member of the sqlite struct contains the busy\r\n** callback for the database handle. Each pager opened via the sqlite\r\n** handle is passed a pointer to sqlite.busyHandler. The busy-handler\r\n** callback is currently invoked only from within pager.c.\r\n*/\r\ntypedef struct BusyHandler BusyHandler;\r\nstruct BusyHandler {\r\n  int (*xFunc)(void *,int);  /* The busy callback */\r\n  void *pArg;                /* First arg to busy callback */\r\n  int nBusy;                 /* Incremented with each busy call */\r\n};\r\n\r\n/*\r\n** Name of the master database table.  The master database table\r\n** is a special table that holds the names and attributes of all\r\n** user tables and indices.\r\n*/\r\n#define MASTER_NAME       \"sqlite_master\"\r\n#define TEMP_MASTER_NAME  \"sqlite_temp_master\"\r\n\r\n/*\r\n** The root-page of the master database table.\r\n*/\r\n#define MASTER_ROOT       1\r\n\r\n/*\r\n** The name of the schema table.\r\n*/\r\n#define SCHEMA_TABLE(x)  ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME)\r\n\r\n/*\r\n** A convenience macro that returns the number of elements in\r\n** an array.\r\n*/\r\n#define ArraySize(X)    ((int)(sizeof(X)/sizeof(X[0])))\r\n\r\n/*\r\n** The following value as a destructor means to use sqlite3DbFree().\r\n** The sqlite3DbFree() routine requires two parameters instead of the \r\n** one parameter that destructors normally want.  So we have to introduce \r\n** this magic value that the code knows to handle differently.  Any \r\n** pointer will work here as long as it is distinct from SQLITE_STATIC\r\n** and SQLITE_TRANSIENT.\r\n*/\r\n#define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)\r\n\r\n/*\r\n** When SQLITE_OMIT_WSD is defined, it means that the target platform does\r\n** not support Writable Static Data (WSD) such as global and static variables.\r\n** All variables must either be on the stack or dynamically allocated from\r\n** the heap.  When WSD is unsupported, the variable declarations scattered\r\n** throughout the SQLite code must become constants instead.  The SQLITE_WSD\r\n** macro is used for this purpose.  And instead of referencing the variable\r\n** directly, we use its constant as a key to lookup the run-time allocated\r\n** buffer that holds real variable.  The constant is also the initializer\r\n** for the run-time allocated buffer.\r\n**\r\n** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL\r\n** macros become no-ops and have zero performance impact.\r\n*/\r\n#ifdef SQLITE_OMIT_WSD\r\n  #define SQLITE_WSD const\r\n  #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))\r\n  #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)\r\nSQLITE_API   int sqlite3_wsd_init(int N, int J);\r\nSQLITE_API   void *sqlite3_wsd_find(void *K, int L);\r\n#else\r\n  #define SQLITE_WSD \r\n  #define GLOBAL(t,v) v\r\n  #define sqlite3GlobalConfig sqlite3Config\r\n#endif\r\n\r\n/*\r\n** The following macros are used to suppress compiler warnings and to\r\n** make it clear to human readers when a function parameter is deliberately \r\n** left unused within the body of a function. This usually happens when\r\n** a function is called via a function pointer. For example the \r\n** implementation of an SQL aggregate step callback may not use the\r\n** parameter indicating the number of arguments passed to the aggregate,\r\n** if it knows that this is enforced elsewhere.\r\n**\r\n** When a function parameter is not used at all within the body of a function,\r\n** it is generally named \"NotUsed\" or \"NotUsed2\" to make things even clearer.\r\n** However, these macros may also be used to suppress warnings related to\r\n** parameters that may or may not be used depending on compilation options.\r\n** For example those parameters only used in assert() statements. In these\r\n** cases the parameters are named as per the usual conventions.\r\n*/\r\n#define UNUSED_PARAMETER(x) (void)(x)\r\n#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)\r\n\r\n/*\r\n** Forward references to structures\r\n*/\r\ntypedef struct AggInfo AggInfo;\r\ntypedef struct AuthContext AuthContext;\r\ntypedef struct AutoincInfo AutoincInfo;\r\ntypedef struct Bitvec Bitvec;\r\ntypedef struct CollSeq CollSeq;\r\ntypedef struct Column Column;\r\ntypedef struct Db Db;\r\ntypedef struct Schema Schema;\r\ntypedef struct Expr Expr;\r\ntypedef struct ExprList ExprList;\r\ntypedef struct ExprSpan ExprSpan;\r\ntypedef struct FKey FKey;\r\ntypedef struct FuncDestructor FuncDestructor;\r\ntypedef struct FuncDef FuncDef;\r\ntypedef struct FuncDefHash FuncDefHash;\r\ntypedef struct IdList IdList;\r\ntypedef struct Index Index;\r\ntypedef struct IndexSample IndexSample;\r\ntypedef struct KeyClass KeyClass;\r\ntypedef struct KeyInfo KeyInfo;\r\ntypedef struct Lookaside Lookaside;\r\ntypedef struct LookasideSlot LookasideSlot;\r\ntypedef struct Module Module;\r\ntypedef struct NameContext NameContext;\r\ntypedef struct Parse Parse;\r\ntypedef struct RowSet RowSet;\r\ntypedef struct Savepoint Savepoint;\r\ntypedef struct Select Select;\r\ntypedef struct SrcList SrcList;\r\ntypedef struct StrAccum StrAccum;\r\ntypedef struct Table Table;\r\ntypedef struct TableLock TableLock;\r\ntypedef struct Token Token;\r\ntypedef struct Trigger Trigger;\r\ntypedef struct TriggerPrg TriggerPrg;\r\ntypedef struct TriggerStep TriggerStep;\r\ntypedef struct UnpackedRecord UnpackedRecord;\r\ntypedef struct VTable VTable;\r\ntypedef struct VtabCtx VtabCtx;\r\ntypedef struct Walker Walker;\r\ntypedef struct WherePlan WherePlan;\r\ntypedef struct WhereInfo WhereInfo;\r\ntypedef struct WhereLevel WhereLevel;\r\n\r\n/*\r\n** Defer sourcing vdbe.h and btree.h until after the \"u8\" and \r\n** \"BusyHandler\" typedefs. vdbe.h also requires a few of the opaque\r\n** pointer types (i.e. FuncDef) defined above.\r\n*/\r\n/************** Include btree.h in the middle of sqliteInt.h *****************/\r\n/************** Begin file btree.h *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the interface that the sqlite B-Tree file\r\n** subsystem.  See comments in the source code for a detailed description\r\n** of what each interface routine does.\r\n*/\r\n#ifndef _BTREE_H_\r\n#define _BTREE_H_\r\n\r\n/* TODO: This definition is just included so other modules compile. It\r\n** needs to be revisited.\r\n*/\r\n#define SQLITE_N_BTREE_META 10\r\n\r\n/*\r\n** If defined as non-zero, auto-vacuum is enabled by default. Otherwise\r\n** it must be turned on for each database using \"PRAGMA auto_vacuum = 1\".\r\n*/\r\n#ifndef SQLITE_DEFAULT_AUTOVACUUM\r\n  #define SQLITE_DEFAULT_AUTOVACUUM 0\r\n#endif\r\n\r\n#define BTREE_AUTOVACUUM_NONE 0        /* Do not do auto-vacuum */\r\n#define BTREE_AUTOVACUUM_FULL 1        /* Do full auto-vacuum */\r\n#define BTREE_AUTOVACUUM_INCR 2        /* Incremental vacuum */\r\n\r\n/*\r\n** Forward declarations of structure\r\n*/\r\ntypedef struct Btree Btree;\r\ntypedef struct BtCursor BtCursor;\r\ntypedef struct BtShared BtShared;\r\n\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeOpen(\r\n  sqlite3_vfs *pVfs,       /* VFS to use with this b-tree */\r\n  const char *zFilename,   /* Name of database file to open */\r\n  sqlite3 *db,             /* Associated database connection */\r\n  Btree **ppBtree,         /* Return open Btree* here */\r\n  int flags,               /* Flags */\r\n  int vfsFlags             /* Flags passed through to VFS open */\r\n);\r\n\r\n/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the\r\n** following values.\r\n**\r\n** NOTE:  These values must match the corresponding PAGER_ values in\r\n** pager.h.\r\n*/\r\n#define BTREE_OMIT_JOURNAL  1  /* Do not create or use a rollback journal */\r\n#define BTREE_MEMORY        2  /* This is an in-memory DB */\r\n#define BTREE_SINGLE        4  /* The file contains at most 1 b-tree */\r\n#define BTREE_UNORDERED     8  /* Use of a hash implementation is OK */\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeClose(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);\r\nSQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int);\r\nSQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);\r\nSQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree*,int);\r\nSQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree*,int);\r\nSQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *, int);\r\nSQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *);\r\nSQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int);\r\nSQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);\r\nSQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int);\r\nSQLITE_PRIVATE int sqlite3BtreeCommit(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int);\r\nSQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int);\r\nSQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags);\r\nSQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*);\r\nSQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*);\r\nSQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));\r\nSQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *pBtree);\r\nSQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock);\r\nSQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *, int, int);\r\n\r\nSQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *);\r\nSQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *);\r\nSQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *, Btree *);\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *);\r\n\r\n/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR\r\n** of the flags shown below.\r\n**\r\n** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set.\r\n** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data\r\n** is stored in the leaves.  (BTREE_INTKEY is used for SQL tables.)  With\r\n** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored\r\n** anywhere - the key is the content.  (BTREE_BLOBKEY is used for SQL\r\n** indices.)\r\n*/\r\n#define BTREE_INTKEY     1    /* Table has only 64-bit signed integer keys */\r\n#define BTREE_BLOBKEY    2    /* Table has keys only - no data */\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*);\r\nSQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*);\r\nSQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int);\r\n\r\nSQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);\r\nSQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);\r\n\r\n/*\r\n** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta\r\n** should be one of the following values. The integer values are assigned \r\n** to constants so that the offset of the corresponding field in an\r\n** SQLite database header may be found using the following formula:\r\n**\r\n**   offset = 36 + (idx * 4)\r\n**\r\n** For example, the free-page-count field is located at byte offset 36 of\r\n** the database file header. The incr-vacuum-flag field is located at\r\n** byte offset 64 (== 36+4*7).\r\n*/\r\n#define BTREE_FREE_PAGE_COUNT     0\r\n#define BTREE_SCHEMA_VERSION      1\r\n#define BTREE_FILE_FORMAT         2\r\n#define BTREE_DEFAULT_CACHE_SIZE  3\r\n#define BTREE_LARGEST_ROOT_PAGE   4\r\n#define BTREE_TEXT_ENCODING       5\r\n#define BTREE_USER_VERSION        6\r\n#define BTREE_INCR_VACUUM         7\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeCursor(\r\n  Btree*,                              /* BTree containing table to open */\r\n  int iTable,                          /* Index of root page */\r\n  int wrFlag,                          /* 1 for writing.  0 for read-only */\r\n  struct KeyInfo*,                     /* First argument to compare function */\r\n  BtCursor *pCursor                    /* Space to write cursor structure */\r\n);\r\nSQLITE_PRIVATE int sqlite3BtreeCursorSize(void);\r\nSQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*);\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*);\r\nSQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(\r\n  BtCursor*,\r\n  UnpackedRecord *pUnKey,\r\n  i64 intKey,\r\n  int bias,\r\n  int *pRes\r\n);\r\nSQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*, int*);\r\nSQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*);\r\nSQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,\r\n                                  const void *pData, int nData,\r\n                                  int nZero, int bias, int seekResult);\r\nSQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes);\r\nSQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes);\r\nSQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes);\r\nSQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*);\r\nSQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes);\r\nSQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);\r\nSQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);\r\nSQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);\r\nSQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);\r\nSQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);\r\nSQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);\r\nSQLITE_PRIVATE void sqlite3BtreeSetCachedRowid(BtCursor*, sqlite3_int64);\r\nSQLITE_PRIVATE sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor*);\r\n\r\nSQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);\r\nSQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);\r\n\r\nSQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);\r\nSQLITE_PRIVATE void sqlite3BtreeCacheOverflow(BtCursor *);\r\nSQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);\r\n\r\n#ifndef NDEBUG\r\nSQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_BTREECOUNT\r\nSQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *, i64 *);\r\n#endif\r\n\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int);\r\nSQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*);\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\nSQLITE_PRIVATE   int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);\r\n#endif\r\n\r\n/*\r\n** If we are not using shared cache, then there is no need to\r\n** use mutexes to access the BtShared structures.  So make the\r\n** Enter and Leave procedures no-ops.\r\n*/\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\nSQLITE_PRIVATE   void sqlite3BtreeEnter(Btree*);\r\nSQLITE_PRIVATE   void sqlite3BtreeEnterAll(sqlite3*);\r\n#else\r\n# define sqlite3BtreeEnter(X) \r\n# define sqlite3BtreeEnterAll(X)\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE\r\nSQLITE_PRIVATE   int sqlite3BtreeSharable(Btree*);\r\nSQLITE_PRIVATE   void sqlite3BtreeLeave(Btree*);\r\nSQLITE_PRIVATE   void sqlite3BtreeEnterCursor(BtCursor*);\r\nSQLITE_PRIVATE   void sqlite3BtreeLeaveCursor(BtCursor*);\r\nSQLITE_PRIVATE   void sqlite3BtreeLeaveAll(sqlite3*);\r\n#ifndef NDEBUG\r\n  /* These routines are used inside assert() statements only. */\r\nSQLITE_PRIVATE   int sqlite3BtreeHoldsMutex(Btree*);\r\nSQLITE_PRIVATE   int sqlite3BtreeHoldsAllMutexes(sqlite3*);\r\nSQLITE_PRIVATE   int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);\r\n#endif\r\n#else\r\n\r\n# define sqlite3BtreeSharable(X) 0\r\n# define sqlite3BtreeLeave(X)\r\n# define sqlite3BtreeEnterCursor(X)\r\n# define sqlite3BtreeLeaveCursor(X)\r\n# define sqlite3BtreeLeaveAll(X)\r\n\r\n# define sqlite3BtreeHoldsMutex(X) 1\r\n# define sqlite3BtreeHoldsAllMutexes(X) 1\r\n# define sqlite3SchemaMutexHeld(X,Y,Z) 1\r\n#endif\r\n\r\n\r\n#endif /* _BTREE_H_ */\r\n\r\n/************** End of btree.h ***********************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n/************** Include vdbe.h in the middle of sqliteInt.h ******************/\r\n/************** Begin file vdbe.h ********************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** Header file for the Virtual DataBase Engine (VDBE)\r\n**\r\n** This header defines the interface to the virtual database engine\r\n** or VDBE.  The VDBE implements an abstract machine that runs a\r\n** simple program to access and modify the underlying database.\r\n*/\r\n#ifndef _SQLITE_VDBE_H_\r\n#define _SQLITE_VDBE_H_\r\n/* #include <stdio.h> */\r\n\r\n/*\r\n** A single VDBE is an opaque structure named \"Vdbe\".  Only routines\r\n** in the source file sqliteVdbe.c are allowed to see the insides\r\n** of this structure.\r\n*/\r\ntypedef struct Vdbe Vdbe;\r\n\r\n/*\r\n** The names of the following types declared in vdbeInt.h are required\r\n** for the VdbeOp definition.\r\n*/\r\ntypedef struct VdbeFunc VdbeFunc;\r\ntypedef struct Mem Mem;\r\ntypedef struct SubProgram SubProgram;\r\n\r\n/*\r\n** A single instruction of the virtual machine has an opcode\r\n** and as many as three operands.  The instruction is recorded\r\n** as an instance of the following structure:\r\n*/\r\nstruct VdbeOp {\r\n  u8 opcode;          /* What operation to perform */\r\n  signed char p4type; /* One of the P4_xxx constants for p4 */\r\n  u8 opflags;         /* Mask of the OPFLG_* flags in opcodes.h */\r\n  u8 p5;              /* Fifth parameter is an unsigned character */\r\n  int p1;             /* First operand */\r\n  int p2;             /* Second parameter (often the jump destination) */\r\n  int p3;             /* The third parameter */\r\n  union {             /* fourth parameter */\r\n    int i;                 /* Integer value if p4type==P4_INT32 */\r\n    void *p;               /* Generic pointer */\r\n    char *z;               /* Pointer to data for string (char array) types */\r\n    i64 *pI64;             /* Used when p4type is P4_INT64 */\r\n    double *pReal;         /* Used when p4type is P4_REAL */\r\n    FuncDef *pFunc;        /* Used when p4type is P4_FUNCDEF */\r\n    VdbeFunc *pVdbeFunc;   /* Used when p4type is P4_VDBEFUNC */\r\n    CollSeq *pColl;        /* Used when p4type is P4_COLLSEQ */\r\n    Mem *pMem;             /* Used when p4type is P4_MEM */\r\n    VTable *pVtab;         /* Used when p4type is P4_VTAB */\r\n    KeyInfo *pKeyInfo;     /* Used when p4type is P4_KEYINFO */\r\n    int *ai;               /* Used when p4type is P4_INTARRAY */\r\n    SubProgram *pProgram;  /* Used when p4type is P4_SUBPROGRAM */\r\n    int (*xAdvance)(BtCursor *, int *);\r\n  } p4;\r\n#ifdef SQLITE_DEBUG\r\n  char *zComment;          /* Comment to improve readability */\r\n#endif\r\n#ifdef VDBE_PROFILE\r\n  int cnt;                 /* Number of times this instruction was executed */\r\n  u64 cycles;              /* Total time spent executing this instruction */\r\n#endif\r\n};\r\ntypedef struct VdbeOp VdbeOp;\r\n\r\n\r\n/*\r\n** A sub-routine used to implement a trigger program.\r\n*/\r\nstruct SubProgram {\r\n  VdbeOp *aOp;                  /* Array of opcodes for sub-program */\r\n  int nOp;                      /* Elements in aOp[] */\r\n  int nMem;                     /* Number of memory cells required */\r\n  int nCsr;                     /* Number of cursors required */\r\n  int nOnce;                    /* Number of OP_Once instructions */\r\n  void *token;                  /* id that may be used to recursive triggers */\r\n  SubProgram *pNext;            /* Next sub-program already visited */\r\n};\r\n\r\n/*\r\n** A smaller version of VdbeOp used for the VdbeAddOpList() function because\r\n** it takes up less space.\r\n*/\r\nstruct VdbeOpList {\r\n  u8 opcode;          /* What operation to perform */\r\n  signed char p1;     /* First operand */\r\n  signed char p2;     /* Second parameter (often the jump destination) */\r\n  signed char p3;     /* Third parameter */\r\n};\r\ntypedef struct VdbeOpList VdbeOpList;\r\n\r\n/*\r\n** Allowed values of VdbeOp.p4type\r\n*/\r\n#define P4_NOTUSED    0   /* The P4 parameter is not used */\r\n#define P4_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */\r\n#define P4_STATIC   (-2)  /* Pointer to a static string */\r\n#define P4_COLLSEQ  (-4)  /* P4 is a pointer to a CollSeq structure */\r\n#define P4_FUNCDEF  (-5)  /* P4 is a pointer to a FuncDef structure */\r\n#define P4_KEYINFO  (-6)  /* P4 is a pointer to a KeyInfo structure */\r\n#define P4_VDBEFUNC (-7)  /* P4 is a pointer to a VdbeFunc structure */\r\n#define P4_MEM      (-8)  /* P4 is a pointer to a Mem*    structure */\r\n#define P4_TRANSIENT  0   /* P4 is a pointer to a transient string */\r\n#define P4_VTAB     (-10) /* P4 is a pointer to an sqlite3_vtab structure */\r\n#define P4_MPRINTF  (-11) /* P4 is a string obtained from sqlite3_mprintf() */\r\n#define P4_REAL     (-12) /* P4 is a 64-bit floating point value */\r\n#define P4_INT64    (-13) /* P4 is a 64-bit signed integer */\r\n#define P4_INT32    (-14) /* P4 is a 32-bit signed integer */\r\n#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */\r\n#define P4_SUBPROGRAM  (-18) /* P4 is a pointer to a SubProgram structure */\r\n#define P4_ADVANCE  (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */\r\n\r\n/* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure\r\n** is made.  That copy is freed when the Vdbe is finalized.  But if the\r\n** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used.  It still\r\n** gets freed when the Vdbe is finalized so it still should be obtained\r\n** from a single sqliteMalloc().  But no copy is made and the calling\r\n** function should *not* try to free the KeyInfo.\r\n*/\r\n#define P4_KEYINFO_HANDOFF (-16)\r\n#define P4_KEYINFO_STATIC  (-17)\r\n\r\n/*\r\n** The Vdbe.aColName array contains 5n Mem structures, where n is the \r\n** number of columns of data returned by the statement.\r\n*/\r\n#define COLNAME_NAME     0\r\n#define COLNAME_DECLTYPE 1\r\n#define COLNAME_DATABASE 2\r\n#define COLNAME_TABLE    3\r\n#define COLNAME_COLUMN   4\r\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\r\n# define COLNAME_N        5      /* Number of COLNAME_xxx symbols */\r\n#else\r\n# ifdef SQLITE_OMIT_DECLTYPE\r\n#   define COLNAME_N      1      /* Store only the name */\r\n# else\r\n#   define COLNAME_N      2      /* Store the name and decltype */\r\n# endif\r\n#endif\r\n\r\n/*\r\n** The following macro converts a relative address in the p2 field\r\n** of a VdbeOp structure into a negative number so that \r\n** sqlite3VdbeAddOpList() knows that the address is relative.  Calling\r\n** the macro again restores the address.\r\n*/\r\n#define ADDR(X)  (-1-(X))\r\n\r\n/*\r\n** The makefile scans the vdbe.c source file and creates the \"opcodes.h\"\r\n** header file that defines a number for each opcode used by the VDBE.\r\n*/\r\n/************** Include opcodes.h in the middle of vdbe.h ********************/\r\n/************** Begin file opcodes.h *****************************************/\r\n/* Automatically generated.  Do not edit */\r\n/* See the mkopcodeh.awk script for details */\r\n#define OP_Goto                                 1\r\n#define OP_Gosub                                2\r\n#define OP_Return                               3\r\n#define OP_Yield                                4\r\n#define OP_HaltIfNull                           5\r\n#define OP_Halt                                 6\r\n#define OP_Integer                              7\r\n#define OP_Int64                                8\r\n#define OP_Real                               130   /* same as TK_FLOAT    */\r\n#define OP_String8                             94   /* same as TK_STRING   */\r\n#define OP_String                               9\r\n#define OP_Null                                10\r\n#define OP_Blob                                11\r\n#define OP_Variable                            12\r\n#define OP_Move                                13\r\n#define OP_Copy                                14\r\n#define OP_SCopy                               15\r\n#define OP_ResultRow                           16\r\n#define OP_Concat                              91   /* same as TK_CONCAT   */\r\n#define OP_Add                                 86   /* same as TK_PLUS     */\r\n#define OP_Subtract                            87   /* same as TK_MINUS    */\r\n#define OP_Multiply                            88   /* same as TK_STAR     */\r\n#define OP_Divide                              89   /* same as TK_SLASH    */\r\n#define OP_Remainder                           90   /* same as TK_REM      */\r\n#define OP_CollSeq                             17\r\n#define OP_Function                            18\r\n#define OP_BitAnd                              82   /* same as TK_BITAND   */\r\n#define OP_BitOr                               83   /* same as TK_BITOR    */\r\n#define OP_ShiftLeft                           84   /* same as TK_LSHIFT   */\r\n#define OP_ShiftRight                          85   /* same as TK_RSHIFT   */\r\n#define OP_AddImm                              20\r\n#define OP_MustBeInt                           21\r\n#define OP_RealAffinity                        22\r\n#define OP_ToText                             141   /* same as TK_TO_TEXT  */\r\n#define OP_ToBlob                             142   /* same as TK_TO_BLOB  */\r\n#define OP_ToNumeric                          143   /* same as TK_TO_NUMERIC*/\r\n#define OP_ToInt                              144   /* same as TK_TO_INT   */\r\n#define OP_ToReal                             145   /* same as TK_TO_REAL  */\r\n#define OP_Eq                                  76   /* same as TK_EQ       */\r\n#define OP_Ne                                  75   /* same as TK_NE       */\r\n#define OP_Lt                                  79   /* same as TK_LT       */\r\n#define OP_Le                                  78   /* same as TK_LE       */\r\n#define OP_Gt                                  77   /* same as TK_GT       */\r\n#define OP_Ge                                  80   /* same as TK_GE       */\r\n#define OP_Permutation                         23\r\n#define OP_Compare                             24\r\n#define OP_Jump                                25\r\n#define OP_And                                 69   /* same as TK_AND      */\r\n#define OP_Or                                  68   /* same as TK_OR       */\r\n#define OP_Not                                 19   /* same as TK_NOT      */\r\n#define OP_BitNot                              93   /* same as TK_BITNOT   */\r\n#define OP_Once                                26\r\n#define OP_If                                  27\r\n#define OP_IfNot                               28\r\n#define OP_IsNull                              73   /* same as TK_ISNULL   */\r\n#define OP_NotNull                             74   /* same as TK_NOTNULL  */\r\n#define OP_Column                              29\r\n#define OP_Affinity                            30\r\n#define OP_MakeRecord                          31\r\n#define OP_Count                               32\r\n#define OP_Savepoint                           33\r\n#define OP_AutoCommit                          34\r\n#define OP_Transaction                         35\r\n#define OP_ReadCookie                          36\r\n#define OP_SetCookie                           37\r\n#define OP_VerifyCookie                        38\r\n#define OP_OpenRead                            39\r\n#define OP_OpenWrite                           40\r\n#define OP_OpenAutoindex                       41\r\n#define OP_OpenEphemeral                       42\r\n#define OP_SorterOpen                          43\r\n#define OP_OpenPseudo                          44\r\n#define OP_Close                               45\r\n#define OP_SeekLt                              46\r\n#define OP_SeekLe                              47\r\n#define OP_SeekGe                              48\r\n#define OP_SeekGt                              49\r\n#define OP_Seek                                50\r\n#define OP_NotFound                            51\r\n#define OP_Found                               52\r\n#define OP_IsUnique                            53\r\n#define OP_NotExists                           54\r\n#define OP_Sequence                            55\r\n#define OP_NewRowid                            56\r\n#define OP_Insert                              57\r\n#define OP_InsertInt                           58\r\n#define OP_Delete                              59\r\n#define OP_ResetCount                          60\r\n#define OP_SorterCompare                       61\r\n#define OP_SorterData                          62\r\n#define OP_RowKey                              63\r\n#define OP_RowData                             64\r\n#define OP_Rowid                               65\r\n#define OP_NullRow                             66\r\n#define OP_Last                                67\r\n#define OP_SorterSort                          70\r\n#define OP_Sort                                71\r\n#define OP_Rewind                              72\r\n#define OP_SorterNext                          81\r\n#define OP_Prev                                92\r\n#define OP_Next                                95\r\n#define OP_SorterInsert                        96\r\n#define OP_IdxInsert                           97\r\n#define OP_IdxDelete                           98\r\n#define OP_IdxRowid                            99\r\n#define OP_IdxLT                              100\r\n#define OP_IdxGE                              101\r\n#define OP_Destroy                            102\r\n#define OP_Clear                              103\r\n#define OP_CreateIndex                        104\r\n#define OP_CreateTable                        105\r\n#define OP_ParseSchema                        106\r\n#define OP_LoadAnalysis                       107\r\n#define OP_DropTable                          108\r\n#define OP_DropIndex                          109\r\n#define OP_DropTrigger                        110\r\n#define OP_IntegrityCk                        111\r\n#define OP_RowSetAdd                          112\r\n#define OP_RowSetRead                         113\r\n#define OP_RowSetTest                         114\r\n#define OP_Program                            115\r\n#define OP_Param                              116\r\n#define OP_FkCounter                          117\r\n#define OP_FkIfZero                           118\r\n#define OP_MemMax                             119\r\n#define OP_IfPos                              120\r\n#define OP_IfNeg                              121\r\n#define OP_IfZero                             122\r\n#define OP_AggStep                            123\r\n#define OP_AggFinal                           124\r\n#define OP_Checkpoint                         125\r\n#define OP_JournalMode                        126\r\n#define OP_Vacuum                             127\r\n#define OP_IncrVacuum                         128\r\n#define OP_Expire                             129\r\n#define OP_TableLock                          131\r\n#define OP_VBegin                             132\r\n#define OP_VCreate                            133\r\n#define OP_VDestroy                           134\r\n#define OP_VOpen                              135\r\n#define OP_VFilter                            136\r\n#define OP_VColumn                            137\r\n#define OP_VNext                              138\r\n#define OP_VRename                            139\r\n#define OP_VUpdate                            140\r\n#define OP_Pagecount                          146\r\n#define OP_MaxPgcnt                           147\r\n#define OP_Trace                              148\r\n#define OP_Noop                               149\r\n#define OP_Explain                            150\r\n\r\n\r\n/* Properties such as \"out2\" or \"jump\" that are specified in\r\n** comments following the \"case\" for each opcode in the vdbe.c\r\n** are encoded into bitvectors as follows:\r\n*/\r\n#define OPFLG_JUMP            0x0001  /* jump:  P2 holds jmp target */\r\n#define OPFLG_OUT2_PRERELEASE 0x0002  /* out2-prerelease: */\r\n#define OPFLG_IN1             0x0004  /* in1:   P1 is an input */\r\n#define OPFLG_IN2             0x0008  /* in2:   P2 is an input */\r\n#define OPFLG_IN3             0x0010  /* in3:   P3 is an input */\r\n#define OPFLG_OUT2            0x0020  /* out2:  P2 is an output */\r\n#define OPFLG_OUT3            0x0040  /* out3:  P3 is an output */\r\n#define OPFLG_INITIALIZER {\\\r\n/*   0 */ 0x00, 0x01, 0x01, 0x04, 0x04, 0x10, 0x00, 0x02,\\\r\n/*   8 */ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x24, 0x24,\\\r\n/*  16 */ 0x00, 0x00, 0x00, 0x24, 0x04, 0x05, 0x04, 0x00,\\\r\n/*  24 */ 0x00, 0x01, 0x01, 0x05, 0x05, 0x00, 0x00, 0x00,\\\r\n/*  32 */ 0x02, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00,\\\r\n/*  40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11,\\\r\n/*  48 */ 0x11, 0x11, 0x08, 0x11, 0x11, 0x11, 0x11, 0x02,\\\r\n/*  56 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\\\r\n/*  64 */ 0x00, 0x02, 0x00, 0x01, 0x4c, 0x4c, 0x01, 0x01,\\\r\n/*  72 */ 0x01, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\\\r\n/*  80 */ 0x15, 0x01, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,\\\r\n/*  88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x01, 0x24, 0x02, 0x01,\\\r\n/*  96 */ 0x08, 0x08, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00,\\\r\n/* 104 */ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\\\r\n/* 112 */ 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00, 0x01, 0x08,\\\r\n/* 120 */ 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00,\\\r\n/* 128 */ 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\\\r\n/* 136 */ 0x01, 0x00, 0x01, 0x00, 0x00, 0x04, 0x04, 0x04,\\\r\n/* 144 */ 0x04, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00,}\r\n\r\n/************** End of opcodes.h *********************************************/\r\n/************** Continuing where we left off in vdbe.h ***********************/\r\n\r\n/*\r\n** Prototypes for the VDBE interface.  See comments on the implementation\r\n** for a description of what each of these routines does.\r\n*/\r\nSQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3*);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);\r\nSQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);\r\nSQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2);\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3);\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5);\r\nSQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);\r\nSQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe*, int addr);\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);\r\nSQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int);\r\nSQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);\r\nSQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeDeleteObject(sqlite3*,Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);\r\nSQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);\r\nSQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE   int sqlite3VdbeAssertMayAbort(Vdbe *, int);\r\nSQLITE_PRIVATE   void sqlite3VdbeTrace(Vdbe*,FILE*);\r\n#endif\r\nSQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*);\r\nSQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int);\r\nSQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));\r\nSQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*);\r\nSQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);\r\nSQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*);\r\nSQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);\r\nSQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe*, int, u8);\r\nSQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);\r\n#ifndef SQLITE_OMIT_TRACE\r\nSQLITE_PRIVATE   char *sqlite3VdbeExpandSql(Vdbe*, const char*);\r\n#endif\r\n\r\nSQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);\r\nSQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);\r\nSQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **);\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\nSQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);\r\n#endif\r\n\r\n\r\n#ifndef NDEBUG\r\nSQLITE_PRIVATE   void sqlite3VdbeComment(Vdbe*, const char*, ...);\r\n# define VdbeComment(X)  sqlite3VdbeComment X\r\nSQLITE_PRIVATE   void sqlite3VdbeNoopComment(Vdbe*, const char*, ...);\r\n# define VdbeNoopComment(X)  sqlite3VdbeNoopComment X\r\n#else\r\n# define VdbeComment(X)\r\n# define VdbeNoopComment(X)\r\n#endif\r\n\r\n#endif\r\n\r\n/************** End of vdbe.h ************************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n/************** Include pager.h in the middle of sqliteInt.h *****************/\r\n/************** Begin file pager.h *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the interface that the sqlite page cache\r\n** subsystem.  The page cache subsystem reads and writes a file a page\r\n** at a time and provides a journal for rollback.\r\n*/\r\n\r\n#ifndef _PAGER_H_\r\n#define _PAGER_H_\r\n\r\n/*\r\n** Default maximum size for persistent journal files. A negative \r\n** value means no limit. This value may be overridden using the \r\n** sqlite3PagerJournalSizeLimit() API. See also \"PRAGMA journal_size_limit\".\r\n*/\r\n#ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT\r\n  #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1\r\n#endif\r\n\r\n/*\r\n** The type used to represent a page number.  The first page in a file\r\n** is called page 1.  0 is used to represent \"not a page\".\r\n*/\r\ntypedef u32 Pgno;\r\n\r\n/*\r\n** Each open file is managed by a separate instance of the \"Pager\" structure.\r\n*/\r\ntypedef struct Pager Pager;\r\n\r\n/*\r\n** Handle type for pages.\r\n*/\r\ntypedef struct PgHdr DbPage;\r\n\r\n/*\r\n** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is\r\n** reserved for working around a windows/posix incompatibility). It is\r\n** used in the journal to signify that the remainder of the journal file \r\n** is devoted to storing a master journal name - there are no more pages to\r\n** roll back. See comments for function writeMasterJournal() in pager.c \r\n** for details.\r\n*/\r\n#define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))\r\n\r\n/*\r\n** Allowed values for the flags parameter to sqlite3PagerOpen().\r\n**\r\n** NOTE: These values must match the corresponding BTREE_ values in btree.h.\r\n*/\r\n#define PAGER_OMIT_JOURNAL  0x0001    /* Do not use a rollback journal */\r\n#define PAGER_MEMORY        0x0002    /* In-memory database */\r\n\r\n/*\r\n** Valid values for the second argument to sqlite3PagerLockingMode().\r\n*/\r\n#define PAGER_LOCKINGMODE_QUERY      -1\r\n#define PAGER_LOCKINGMODE_NORMAL      0\r\n#define PAGER_LOCKINGMODE_EXCLUSIVE   1\r\n\r\n/*\r\n** Numeric constants that encode the journalmode.  \r\n*/\r\n#define PAGER_JOURNALMODE_QUERY     (-1)  /* Query the value of journalmode */\r\n#define PAGER_JOURNALMODE_DELETE      0   /* Commit by deleting journal file */\r\n#define PAGER_JOURNALMODE_PERSIST     1   /* Commit by zeroing journal header */\r\n#define PAGER_JOURNALMODE_OFF         2   /* Journal omitted.  */\r\n#define PAGER_JOURNALMODE_TRUNCATE    3   /* Commit by truncating journal */\r\n#define PAGER_JOURNALMODE_MEMORY      4   /* In-memory journal file */\r\n#define PAGER_JOURNALMODE_WAL         5   /* Use write-ahead logging */\r\n\r\n/*\r\n** The remainder of this file contains the declarations of the functions\r\n** that make up the Pager sub-system API. See source code comments for \r\n** a detailed description of each routine.\r\n*/\r\n\r\n/* Open and close a Pager connection. */ \r\nSQLITE_PRIVATE int sqlite3PagerOpen(\r\n  sqlite3_vfs*,\r\n  Pager **ppPager,\r\n  const char*,\r\n  int,\r\n  int,\r\n  int,\r\n  void(*)(DbPage*)\r\n);\r\nSQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager);\r\nSQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);\r\n\r\n/* Functions used to configure a Pager object. */\r\nSQLITE_PRIVATE void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);\r\nSQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int);\r\nSQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int);\r\nSQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int);\r\nSQLITE_PRIVATE void sqlite3PagerShrink(Pager*);\r\nSQLITE_PRIVATE void sqlite3PagerSetSafetyLevel(Pager*,int,int,int);\r\nSQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int);\r\nSQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int);\r\nSQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*);\r\nSQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64);\r\nSQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*);\r\n\r\n/* Functions used to obtain and release page references. */ \r\nSQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);\r\n#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0)\r\nSQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);\r\nSQLITE_PRIVATE void sqlite3PagerRef(DbPage*);\r\nSQLITE_PRIVATE void sqlite3PagerUnref(DbPage*);\r\n\r\n/* Operations on page references. */\r\nSQLITE_PRIVATE int sqlite3PagerWrite(DbPage*);\r\nSQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*);\r\nSQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);\r\nSQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage*);\r\nSQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *); \r\nSQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *); \r\n\r\n/* Functions used to manage pager transactions and savepoints. */\r\nSQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*);\r\nSQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int);\r\nSQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int);\r\nSQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager);\r\nSQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerRollback(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n);\r\nSQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);\r\nSQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager);\r\n\r\nSQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int*);\r\nSQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager);\r\nSQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager);\r\nSQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);\r\nSQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager);\r\n#ifdef SQLITE_ENABLE_ZIPVFS\r\nSQLITE_PRIVATE   int sqlite3PagerWalFramesize(Pager *pPager);\r\n#endif\r\n\r\n/* Functions used to query pager state and configuration. */\r\nSQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerRefcount(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*);\r\nSQLITE_PRIVATE const char *sqlite3PagerFilename(Pager*);\r\nSQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager*);\r\nSQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*);\r\nSQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerNosync(Pager*);\r\nSQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*);\r\nSQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*);\r\nSQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *);\r\nSQLITE_PRIVATE void sqlite3PagerClearCache(Pager *);\r\n\r\n/* Functions used to truncate the database file. */\r\nSQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);\r\n\r\n#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)\r\nSQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *);\r\n#endif\r\n\r\n/* Functions to support testing and debugging. */\r\n#if !defined(NDEBUG) || defined(SQLITE_TEST)\r\nSQLITE_PRIVATE   Pgno sqlite3PagerPagenumber(DbPage*);\r\nSQLITE_PRIVATE   int sqlite3PagerIswriteable(DbPage*);\r\n#endif\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE   int *sqlite3PagerStats(Pager*);\r\nSQLITE_PRIVATE   void sqlite3PagerRefdump(Pager*);\r\n  void disable_simulated_io_errors(void);\r\n  void enable_simulated_io_errors(void);\r\n#else\r\n# define disable_simulated_io_errors()\r\n# define enable_simulated_io_errors()\r\n#endif\r\n\r\n#endif /* _PAGER_H_ */\r\n\r\n/************** End of pager.h ***********************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n/************** Include pcache.h in the middle of sqliteInt.h ****************/\r\n/************** Begin file pcache.h ******************************************/\r\n/*\r\n** 2008 August 05\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the interface that the sqlite page cache\r\n** subsystem. \r\n*/\r\n\r\n#ifndef _PCACHE_H_\r\n\r\ntypedef struct PgHdr PgHdr;\r\ntypedef struct PCache PCache;\r\n\r\n/*\r\n** Every page in the cache is controlled by an instance of the following\r\n** structure.\r\n*/\r\nstruct PgHdr {\r\n  sqlite3_pcache_page *pPage;    /* Pcache object page handle */\r\n  void *pData;                   /* Page data */\r\n  void *pExtra;                  /* Extra content */\r\n  PgHdr *pDirty;                 /* Transient list of dirty pages */\r\n  Pager *pPager;                 /* The pager this page is part of */\r\n  Pgno pgno;                     /* Page number for this page */\r\n#ifdef SQLITE_CHECK_PAGES\r\n  u32 pageHash;                  /* Hash of page content */\r\n#endif\r\n  u16 flags;                     /* PGHDR flags defined below */\r\n\r\n  /**********************************************************************\r\n  ** Elements above are public.  All that follows is private to pcache.c\r\n  ** and should not be accessed by other modules.\r\n  */\r\n  i16 nRef;                      /* Number of users of this page */\r\n  PCache *pCache;                /* Cache that owns this page */\r\n\r\n  PgHdr *pDirtyNext;             /* Next element in list of dirty pages */\r\n  PgHdr *pDirtyPrev;             /* Previous element in list of dirty pages */\r\n};\r\n\r\n/* Bit values for PgHdr.flags */\r\n#define PGHDR_DIRTY             0x002  /* Page has changed */\r\n#define PGHDR_NEED_SYNC         0x004  /* Fsync the rollback journal before\r\n                                       ** writing this page to the database */\r\n#define PGHDR_NEED_READ         0x008  /* Content is unread */\r\n#define PGHDR_REUSE_UNLIKELY    0x010  /* A hint that reuse is unlikely */\r\n#define PGHDR_DONT_WRITE        0x020  /* Do not write content to disk */\r\n\r\n/* Initialize and shutdown the page cache subsystem */\r\nSQLITE_PRIVATE int sqlite3PcacheInitialize(void);\r\nSQLITE_PRIVATE void sqlite3PcacheShutdown(void);\r\n\r\n/* Page cache buffer management:\r\n** These routines implement SQLITE_CONFIG_PAGECACHE.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *, int sz, int n);\r\n\r\n/* Create a new pager cache.\r\n** Under memory stress, invoke xStress to try to make pages clean.\r\n** Only clean and unpinned pages can be reclaimed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheOpen(\r\n  int szPage,                    /* Size of every page */\r\n  int szExtra,                   /* Extra space associated with each page */\r\n  int bPurgeable,                /* True if pages are on backing store */\r\n  int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */\r\n  void *pStress,                 /* Argument to xStress */\r\n  PCache *pToInit                /* Preallocated space for the PCache */\r\n);\r\n\r\n/* Modify the page-size after the cache has been created. */\r\nSQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *, int);\r\n\r\n/* Return the size in bytes of a PCache object.  Used to preallocate\r\n** storage space.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheSize(void);\r\n\r\n/* One release per successful fetch.  Page is pinned until released.\r\n** Reference counted. \r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**);\r\nSQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr*);\r\n\r\nSQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*);         /* Remove page from cache */\r\nSQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr*);    /* Make sure page is marked dirty */\r\nSQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr*);    /* Mark a single page as clean */\r\nSQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache*);    /* Mark all dirty list pages as clean */\r\n\r\n/* Change a page number.  Used by incr-vacuum. */\r\nSQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno);\r\n\r\n/* Remove all pages with pgno>x.  Reset the cache if x==0 */\r\nSQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x);\r\n\r\n/* Get a list of all dirty pages in the cache, sorted by page number */\r\nSQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache*);\r\n\r\n/* Reset and close the cache object */\r\nSQLITE_PRIVATE void sqlite3PcacheClose(PCache*);\r\n\r\n/* Clear flags from pages of the page cache */\r\nSQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *);\r\n\r\n/* Discard the contents of the cache */\r\nSQLITE_PRIVATE void sqlite3PcacheClear(PCache*);\r\n\r\n/* Return the total number of outstanding page references */\r\nSQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*);\r\n\r\n/* Increment the reference count of an existing page */\r\nSQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);\r\n\r\nSQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*);\r\n\r\n/* Return the total number of pages stored in the cache */\r\nSQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);\r\n\r\n#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)\r\n/* Iterate through all dirty pages currently stored in the cache. This\r\n** interface is only available if SQLITE_CHECK_PAGES is defined when the \r\n** library is built.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *));\r\n#endif\r\n\r\n/* Set and get the suggested cache-size for the specified pager-cache.\r\n**\r\n** If no global maximum is configured, then the system attempts to limit\r\n** the total number of pages cached by purgeable pager-caches to the sum\r\n** of the suggested cache-sizes.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *, int);\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *);\r\n#endif\r\n\r\n/* Free up as much memory as possible from the page cache */\r\nSQLITE_PRIVATE void sqlite3PcacheShrink(PCache*);\r\n\r\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\r\n/* Try to return memory used by the pcache module to the main memory heap */\r\nSQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int);\r\n#endif\r\n\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*);\r\n#endif\r\n\r\nSQLITE_PRIVATE void sqlite3PCacheSetDefault(void);\r\n\r\n#endif /* _PCACHE_H_ */\r\n\r\n/************** End of pcache.h **********************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n\r\n/************** Include os.h in the middle of sqliteInt.h ********************/\r\n/************** Begin file os.h **********************************************/\r\n/*\r\n** 2001 September 16\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This header file (together with is companion C source-code file\r\n** \"os.c\") attempt to abstract the underlying operating system so that\r\n** the SQLite library will work on both POSIX and windows systems.\r\n**\r\n** This header file is #include-ed by sqliteInt.h and thus ends up\r\n** being included by every source file.\r\n*/\r\n#ifndef _SQLITE_OS_H_\r\n#define _SQLITE_OS_H_\r\n\r\n/*\r\n** Figure out if we are dealing with Unix, Windows, or some other\r\n** operating system.  After the following block of preprocess macros,\r\n** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER \r\n** will defined to either 1 or 0.  One of the four will be 1.  The other \r\n** three will be 0.\r\n*/\r\n#if defined(SQLITE_OS_OTHER)\r\n# if SQLITE_OS_OTHER==1\r\n#   undef SQLITE_OS_UNIX\r\n#   define SQLITE_OS_UNIX 0\r\n#   undef SQLITE_OS_WIN\r\n#   define SQLITE_OS_WIN 0\r\n#   undef SQLITE_OS_OS2\r\n#   define SQLITE_OS_OS2 0\r\n# else\r\n#   undef SQLITE_OS_OTHER\r\n# endif\r\n#endif\r\n#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)\r\n# define SQLITE_OS_OTHER 0\r\n# ifndef SQLITE_OS_WIN\r\n#   if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)\r\n#     define SQLITE_OS_WIN 1\r\n#     define SQLITE_OS_UNIX 0\r\n#     define SQLITE_OS_OS2 0\r\n#   elif defined(__EMX__) || defined(_OS2) || defined(OS2) || defined(_OS2_) || defined(__OS2__)\r\n#     define SQLITE_OS_WIN 0\r\n#     define SQLITE_OS_UNIX 0\r\n#     define SQLITE_OS_OS2 1\r\n#   else\r\n#     define SQLITE_OS_WIN 0\r\n#     define SQLITE_OS_UNIX 1\r\n#     define SQLITE_OS_OS2 0\r\n#  endif\r\n# else\r\n#  define SQLITE_OS_UNIX 0\r\n#  define SQLITE_OS_OS2 0\r\n# endif\r\n#else\r\n# ifndef SQLITE_OS_WIN\r\n#  define SQLITE_OS_WIN 0\r\n# endif\r\n#endif\r\n\r\n/*\r\n** Define the maximum size of a temporary filename\r\n*/\r\n#if SQLITE_OS_WIN\r\n# include <windows.h>\r\n# define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)\r\n#elif SQLITE_OS_OS2\r\n# if (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3) && defined(OS2_HIGH_MEMORY)\r\n#  include <os2safe.h> /* has to be included before os2.h for linking to work */\r\n# endif\r\n# define INCL_DOSDATETIME\r\n# define INCL_DOSFILEMGR\r\n# define INCL_DOSERRORS\r\n# define INCL_DOSMISC\r\n# define INCL_DOSPROCESS\r\n# define INCL_DOSMODULEMGR\r\n# define INCL_DOSSEMAPHORES\r\n# include <os2.h>\r\n# include <uconv.h>\r\n# define SQLITE_TEMPNAME_SIZE (CCHMAXPATHCOMP)\r\n#else\r\n# define SQLITE_TEMPNAME_SIZE 200\r\n#endif\r\n\r\n/*\r\n** Determine if we are dealing with Windows NT.\r\n**\r\n** We ought to be able to determine if we are compiling for win98 or winNT\r\n** using the _WIN32_WINNT macro as follows:\r\n**\r\n** #if defined(_WIN32_WINNT)\r\n** # define SQLITE_OS_WINNT 1\r\n** #else\r\n** # define SQLITE_OS_WINNT 0\r\n** #endif\r\n**\r\n** However, vs2005 does not set _WIN32_WINNT by default, as it ought to,\r\n** so the above test does not work.  We'll just assume that everything is\r\n** winNT unless the programmer explicitly says otherwise by setting\r\n** SQLITE_OS_WINNT to 0.\r\n*/\r\n#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT)\r\n# define SQLITE_OS_WINNT 1\r\n#endif\r\n\r\n/*\r\n** Determine if we are dealing with WindowsCE - which has a much\r\n** reduced API.\r\n*/\r\n#if defined(_WIN32_WCE)\r\n# define SQLITE_OS_WINCE 1\r\n#else\r\n# define SQLITE_OS_WINCE 0\r\n#endif\r\n\r\n/* If the SET_FULLSYNC macro is not defined above, then make it\r\n** a no-op\r\n*/\r\n#ifndef SET_FULLSYNC\r\n# define SET_FULLSYNC(x,y)\r\n#endif\r\n\r\n/*\r\n** The default size of a disk sector\r\n*/\r\n#ifndef SQLITE_DEFAULT_SECTOR_SIZE\r\n# define SQLITE_DEFAULT_SECTOR_SIZE 4096\r\n#endif\r\n\r\n/*\r\n** Temporary files are named starting with this prefix followed by 16 random\r\n** alphanumeric characters, and no file extension. They are stored in the\r\n** OS's standard temporary file directory, and are deleted prior to exit.\r\n** If sqlite is being embedded in another program, you may wish to change the\r\n** prefix to reflect your program's name, so that if your program exits\r\n** prematurely, old temporary files can be easily identified. This can be done\r\n** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line.\r\n**\r\n** 2006-10-31:  The default prefix used to be \"sqlite_\".  But then\r\n** Mcafee started using SQLite in their anti-virus product and it\r\n** started putting files with the \"sqlite\" name in the c:/temp folder.\r\n** This annoyed many windows users.  Those users would then do a \r\n** Google search for \"sqlite\", find the telephone numbers of the\r\n** developers and call to wake them up at night and complain.\r\n** For this reason, the default name prefix is changed to be \"sqlite\" \r\n** spelled backwards.  So the temp files are still identified, but\r\n** anybody smart enough to figure out the code is also likely smart\r\n** enough to know that calling the developer will not help get rid\r\n** of the file.\r\n*/\r\n#ifndef SQLITE_TEMP_FILE_PREFIX\r\n# define SQLITE_TEMP_FILE_PREFIX \"etilqs_\"\r\n#endif\r\n\r\n/*\r\n** The following values may be passed as the second argument to\r\n** sqlite3OsLock(). The various locks exhibit the following semantics:\r\n**\r\n** SHARED:    Any number of processes may hold a SHARED lock simultaneously.\r\n** RESERVED:  A single process may hold a RESERVED lock on a file at\r\n**            any time. Other processes may hold and obtain new SHARED locks.\r\n** PENDING:   A single process may hold a PENDING lock on a file at\r\n**            any one time. Existing SHARED locks may persist, but no new\r\n**            SHARED locks may be obtained by other processes.\r\n** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks.\r\n**\r\n** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a\r\n** process that requests an EXCLUSIVE lock may actually obtain a PENDING\r\n** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to\r\n** sqlite3OsLock().\r\n*/\r\n#define NO_LOCK         0\r\n#define SHARED_LOCK     1\r\n#define RESERVED_LOCK   2\r\n#define PENDING_LOCK    3\r\n#define EXCLUSIVE_LOCK  4\r\n\r\n/*\r\n** File Locking Notes:  (Mostly about windows but also some info for Unix)\r\n**\r\n** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because\r\n** those functions are not available.  So we use only LockFile() and\r\n** UnlockFile().\r\n**\r\n** LockFile() prevents not just writing but also reading by other processes.\r\n** A SHARED_LOCK is obtained by locking a single randomly-chosen \r\n** byte out of a specific range of bytes. The lock byte is obtained at \r\n** random so two separate readers can probably access the file at the \r\n** same time, unless they are unlucky and choose the same lock byte.\r\n** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range.\r\n** There can only be one writer.  A RESERVED_LOCK is obtained by locking\r\n** a single byte of the file that is designated as the reserved lock byte.\r\n** A PENDING_LOCK is obtained by locking a designated byte different from\r\n** the RESERVED_LOCK byte.\r\n**\r\n** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available,\r\n** which means we can use reader/writer locks.  When reader/writer locks\r\n** are used, the lock is placed on the same range of bytes that is used\r\n** for probabilistic locking in Win95/98/ME.  Hence, the locking scheme\r\n** will support two or more Win95 readers or two or more WinNT readers.\r\n** But a single Win95 reader will lock out all WinNT readers and a single\r\n** WinNT reader will lock out all other Win95 readers.\r\n**\r\n** The following #defines specify the range of bytes used for locking.\r\n** SHARED_SIZE is the number of bytes available in the pool from which\r\n** a random byte is selected for a shared lock.  The pool of bytes for\r\n** shared locks begins at SHARED_FIRST. \r\n**\r\n** The same locking strategy and\r\n** byte ranges are used for Unix.  This leaves open the possiblity of having\r\n** clients on win95, winNT, and unix all talking to the same shared file\r\n** and all locking correctly.  To do so would require that samba (or whatever\r\n** tool is being used for file sharing) implements locks correctly between\r\n** windows and unix.  I'm guessing that isn't likely to happen, but by\r\n** using the same locking range we are at least open to the possibility.\r\n**\r\n** Locking in windows is manditory.  For this reason, we cannot store\r\n** actual data in the bytes used for locking.  The pager never allocates\r\n** the pages involved in locking therefore.  SHARED_SIZE is selected so\r\n** that all locks will fit on a single page even at the minimum page size.\r\n** PENDING_BYTE defines the beginning of the locks.  By default PENDING_BYTE\r\n** is set high so that we don't have to allocate an unused page except\r\n** for very large databases.  But one should test the page skipping logic \r\n** by setting PENDING_BYTE low and running the entire regression suite.\r\n**\r\n** Changing the value of PENDING_BYTE results in a subtly incompatible\r\n** file format.  Depending on how it is changed, you might not notice\r\n** the incompatibility right away, even running a full regression test.\r\n** The default location of PENDING_BYTE is the first byte past the\r\n** 1GB boundary.\r\n**\r\n*/\r\n#ifdef SQLITE_OMIT_WSD\r\n# define PENDING_BYTE     (0x40000000)\r\n#else\r\n# define PENDING_BYTE      sqlite3PendingByte\r\n#endif\r\n#define RESERVED_BYTE     (PENDING_BYTE+1)\r\n#define SHARED_FIRST      (PENDING_BYTE+2)\r\n#define SHARED_SIZE       510\r\n\r\n/*\r\n** Wrapper around OS specific sqlite3_os_init() function.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OsInit(void);\r\n\r\n/* \r\n** Functions for accessing sqlite3_file methods \r\n*/\r\nSQLITE_PRIVATE int sqlite3OsClose(sqlite3_file*);\r\nSQLITE_PRIVATE int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset);\r\nSQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset);\r\nSQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file*, i64 size);\r\nSQLITE_PRIVATE int sqlite3OsSync(sqlite3_file*, int);\r\nSQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file*, i64 *pSize);\r\nSQLITE_PRIVATE int sqlite3OsLock(sqlite3_file*, int);\r\nSQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file*, int);\r\nSQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut);\r\nSQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file*,int,void*);\r\nSQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file*,int,void*);\r\n#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0\r\nSQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id);\r\nSQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id);\r\nSQLITE_PRIVATE int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **);\r\nSQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int, int, int);\r\nSQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id);\r\nSQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int);\r\n\r\n\r\n/* \r\n** Functions for accessing sqlite3_vfs methods \r\n*/\r\nSQLITE_PRIVATE int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *);\r\nSQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *, const char *, int);\r\nSQLITE_PRIVATE int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut);\r\nSQLITE_PRIVATE int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\nSQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *, const char *);\r\nSQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *, int, char *);\r\nSQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void);\r\nSQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *, void *);\r\n#endif /* SQLITE_OMIT_LOAD_EXTENSION */\r\nSQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *, int, char *);\r\nSQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *, int);\r\nSQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*);\r\n\r\n/*\r\n** Convenience functions for opening and closing files using \r\n** sqlite3_malloc() to obtain space for the file-handle structure.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);\r\nSQLITE_PRIVATE int sqlite3OsCloseFree(sqlite3_file *);\r\n\r\n#endif /* _SQLITE_OS_H_ */\r\n\r\n/************** End of os.h **************************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n/************** Include mutex.h in the middle of sqliteInt.h *****************/\r\n/************** Begin file mutex.h *******************************************/\r\n/*\r\n** 2007 August 28\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains the common header for all mutex implementations.\r\n** The sqliteInt.h header #includes this file so that it is available\r\n** to all source files.  We break it out in an effort to keep the code\r\n** better organized.\r\n**\r\n** NOTE:  source files should *not* #include this header file directly.\r\n** Source files should #include the sqliteInt.h file and let that file\r\n** include this one indirectly.\r\n*/\r\n\r\n\r\n/*\r\n** Figure out what version of the code to use.  The choices are\r\n**\r\n**   SQLITE_MUTEX_OMIT         No mutex logic.  Not even stubs.  The\r\n**                             mutexes implemention cannot be overridden\r\n**                             at start-time.\r\n**\r\n**   SQLITE_MUTEX_NOOP         For single-threaded applications.  No\r\n**                             mutual exclusion is provided.  But this\r\n**                             implementation can be overridden at\r\n**                             start-time.\r\n**\r\n**   SQLITE_MUTEX_PTHREADS     For multi-threaded applications on Unix.\r\n**\r\n**   SQLITE_MUTEX_W32          For multi-threaded applications on Win32.\r\n**\r\n**   SQLITE_MUTEX_OS2          For multi-threaded applications on OS/2.\r\n*/\r\n#if !SQLITE_THREADSAFE\r\n# define SQLITE_MUTEX_OMIT\r\n#endif\r\n#if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP)\r\n#  if SQLITE_OS_UNIX\r\n#    define SQLITE_MUTEX_PTHREADS\r\n#  elif SQLITE_OS_WIN\r\n#    define SQLITE_MUTEX_W32\r\n#  elif SQLITE_OS_OS2\r\n#    define SQLITE_MUTEX_OS2\r\n#  else\r\n#    define SQLITE_MUTEX_NOOP\r\n#  endif\r\n#endif\r\n\r\n#ifdef SQLITE_MUTEX_OMIT\r\n/*\r\n** If this is a no-op implementation, implement everything as macros.\r\n*/\r\n#define sqlite3_mutex_alloc(X)    ((sqlite3_mutex*)8)\r\n#define sqlite3_mutex_free(X)\r\n#define sqlite3_mutex_enter(X)    \r\n#define sqlite3_mutex_try(X)      SQLITE_OK\r\n#define sqlite3_mutex_leave(X)    \r\n#define sqlite3_mutex_held(X)     ((void)(X),1)\r\n#define sqlite3_mutex_notheld(X)  ((void)(X),1)\r\n#define sqlite3MutexAlloc(X)      ((sqlite3_mutex*)8)\r\n#define sqlite3MutexInit()        SQLITE_OK\r\n#define sqlite3MutexEnd()\r\n#define MUTEX_LOGIC(X)\r\n#else\r\n#define MUTEX_LOGIC(X)            X\r\n#endif /* defined(SQLITE_MUTEX_OMIT) */\r\n\r\n/************** End of mutex.h ***********************************************/\r\n/************** Continuing where we left off in sqliteInt.h ******************/\r\n\r\n\r\n/*\r\n** Each database file to be accessed by the system is an instance\r\n** of the following structure.  There are normally two of these structures\r\n** in the sqlite.aDb[] array.  aDb[0] is the main database file and\r\n** aDb[1] is the database file used to hold temporary tables.  Additional\r\n** databases may be attached.\r\n*/\r\nstruct Db {\r\n  char *zName;         /* Name of this database */\r\n  Btree *pBt;          /* The B*Tree structure for this database file */\r\n  u8 inTrans;          /* 0: not writable.  1: Transaction.  2: Checkpoint */\r\n  u8 safety_level;     /* How aggressive at syncing data to disk */\r\n  Schema *pSchema;     /* Pointer to database schema (possibly shared) */\r\n};\r\n\r\n/*\r\n** An instance of the following structure stores a database schema.\r\n**\r\n** Most Schema objects are associated with a Btree.  The exception is\r\n** the Schema for the TEMP databaes (sqlite3.aDb[1]) which is free-standing.\r\n** In shared cache mode, a single Schema object can be shared by multiple\r\n** Btrees that refer to the same underlying BtShared object.\r\n** \r\n** Schema objects are automatically deallocated when the last Btree that\r\n** references them is destroyed.   The TEMP Schema is manually freed by\r\n** sqlite3_close().\r\n*\r\n** A thread must be holding a mutex on the corresponding Btree in order\r\n** to access Schema content.  This implies that the thread must also be\r\n** holding a mutex on the sqlite3 connection pointer that owns the Btree.\r\n** For a TEMP Schema, only the connection mutex is required.\r\n*/\r\nstruct Schema {\r\n  int schema_cookie;   /* Database schema version number for this file */\r\n  int iGeneration;     /* Generation counter.  Incremented with each change */\r\n  Hash tblHash;        /* All tables indexed by name */\r\n  Hash idxHash;        /* All (named) indices indexed by name */\r\n  Hash trigHash;       /* All triggers indexed by name */\r\n  Hash fkeyHash;       /* All foreign keys by referenced table name */\r\n  Table *pSeqTab;      /* The sqlite_sequence table used by AUTOINCREMENT */\r\n  u8 file_format;      /* Schema format version for this file */\r\n  u8 enc;              /* Text encoding used by this database */\r\n  u16 flags;           /* Flags associated with this schema */\r\n  int cache_size;      /* Number of pages to use in the cache */\r\n};\r\n\r\n/*\r\n** These macros can be used to test, set, or clear bits in the \r\n** Db.pSchema->flags field.\r\n*/\r\n#define DbHasProperty(D,I,P)     (((D)->aDb[I].pSchema->flags&(P))==(P))\r\n#define DbHasAnyProperty(D,I,P)  (((D)->aDb[I].pSchema->flags&(P))!=0)\r\n#define DbSetProperty(D,I,P)     (D)->aDb[I].pSchema->flags|=(P)\r\n#define DbClearProperty(D,I,P)   (D)->aDb[I].pSchema->flags&=~(P)\r\n\r\n/*\r\n** Allowed values for the DB.pSchema->flags field.\r\n**\r\n** The DB_SchemaLoaded flag is set after the database schema has been\r\n** read into internal hash tables.\r\n**\r\n** DB_UnresetViews means that one or more views have column names that\r\n** have been filled out.  If the schema changes, these column names might\r\n** changes and so the view will need to be reset.\r\n*/\r\n#define DB_SchemaLoaded    0x0001  /* The schema has been loaded */\r\n#define DB_UnresetViews    0x0002  /* Some views have defined column names */\r\n#define DB_Empty           0x0004  /* The file is empty (length 0 bytes) */\r\n\r\n/*\r\n** The number of different kinds of things that can be limited\r\n** using the sqlite3_limit() interface.\r\n*/\r\n#define SQLITE_N_LIMIT (SQLITE_LIMIT_TRIGGER_DEPTH+1)\r\n\r\n/*\r\n** Lookaside malloc is a set of fixed-size buffers that can be used\r\n** to satisfy small transient memory allocation requests for objects\r\n** associated with a particular database connection.  The use of\r\n** lookaside malloc provides a significant performance enhancement\r\n** (approx 10%) by avoiding numerous malloc/free requests while parsing\r\n** SQL statements.\r\n**\r\n** The Lookaside structure holds configuration information about the\r\n** lookaside malloc subsystem.  Each available memory allocation in\r\n** the lookaside subsystem is stored on a linked list of LookasideSlot\r\n** objects.\r\n**\r\n** Lookaside allocations are only allowed for objects that are associated\r\n** with a particular database connection.  Hence, schema information cannot\r\n** be stored in lookaside because in shared cache mode the schema information\r\n** is shared by multiple database connections.  Therefore, while parsing\r\n** schema information, the Lookaside.bEnabled flag is cleared so that\r\n** lookaside allocations are not used to construct the schema objects.\r\n*/\r\nstruct Lookaside {\r\n  u16 sz;                 /* Size of each buffer in bytes */\r\n  u8 bEnabled;            /* False to disable new lookaside allocations */\r\n  u8 bMalloced;           /* True if pStart obtained from sqlite3_malloc() */\r\n  int nOut;               /* Number of buffers currently checked out */\r\n  int mxOut;              /* Highwater mark for nOut */\r\n  int anStat[3];          /* 0: hits.  1: size misses.  2: full misses */\r\n  LookasideSlot *pFree;   /* List of available buffers */\r\n  void *pStart;           /* First byte of available memory space */\r\n  void *pEnd;             /* First byte past end of available space */\r\n};\r\nstruct LookasideSlot {\r\n  LookasideSlot *pNext;    /* Next buffer in the list of free buffers */\r\n};\r\n\r\n/*\r\n** A hash table for function definitions.\r\n**\r\n** Hash each FuncDef structure into one of the FuncDefHash.a[] slots.\r\n** Collisions are on the FuncDef.pHash chain.\r\n*/\r\nstruct FuncDefHash {\r\n  FuncDef *a[23];       /* Hash table for functions */\r\n};\r\n\r\n/*\r\n** Each database connection is an instance of the following structure.\r\n*/\r\nstruct sqlite3 {\r\n  sqlite3_vfs *pVfs;            /* OS Interface */\r\n  struct Vdbe *pVdbe;           /* List of active virtual machines */\r\n  CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */\r\n  sqlite3_mutex *mutex;         /* Connection mutex */\r\n  Db *aDb;                      /* All backends */\r\n  int nDb;                      /* Number of backends currently in use */\r\n  int flags;                    /* Miscellaneous flags. See below */\r\n  i64 lastRowid;                /* ROWID of most recent insert (see above) */\r\n  unsigned int openFlags;       /* Flags passed to sqlite3_vfs.xOpen() */\r\n  int errCode;                  /* Most recent error code (SQLITE_*) */\r\n  int errMask;                  /* & result codes with this before returning */\r\n  u8 autoCommit;                /* The auto-commit flag. */\r\n  u8 temp_store;                /* 1: file 2: memory 0: default */\r\n  u8 mallocFailed;              /* True if we have seen a malloc failure */\r\n  u8 dfltLockMode;              /* Default locking-mode for attached dbs */\r\n  signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */\r\n  u8 suppressErr;               /* Do not issue error messages if true */\r\n  u8 vtabOnConflict;            /* Value to return for s3_vtab_on_conflict() */\r\n  u8 isTransactionSavepoint;    /* True if the outermost savepoint is a TS */\r\n  int nextPagesize;             /* Pagesize after VACUUM if >0 */\r\n  u32 magic;                    /* Magic number for detect library misuse */\r\n  int nChange;                  /* Value returned by sqlite3_changes() */\r\n  int nTotalChange;             /* Value returned by sqlite3_total_changes() */\r\n  int aLimit[SQLITE_N_LIMIT];   /* Limits */\r\n  struct sqlite3InitInfo {      /* Information used during initialization */\r\n    int newTnum;                /* Rootpage of table being initialized */\r\n    u8 iDb;                     /* Which db file is being initialized */\r\n    u8 busy;                    /* TRUE if currently initializing */\r\n    u8 orphanTrigger;           /* Last statement is orphaned TEMP trigger */\r\n  } init;\r\n  int activeVdbeCnt;            /* Number of VDBEs currently executing */\r\n  int writeVdbeCnt;             /* Number of active VDBEs that are writing */\r\n  int vdbeExecCnt;              /* Number of nested calls to VdbeExec() */\r\n  int nExtension;               /* Number of loaded extensions */\r\n  void **aExtension;            /* Array of shared library handles */\r\n  void (*xTrace)(void*,const char*);        /* Trace function */\r\n  void *pTraceArg;                          /* Argument to the trace function */\r\n  void (*xProfile)(void*,const char*,u64);  /* Profiling function */\r\n  void *pProfileArg;                        /* Argument to profile function */\r\n  void *pCommitArg;                 /* Argument to xCommitCallback() */   \r\n  int (*xCommitCallback)(void*);    /* Invoked at every commit. */\r\n  void *pRollbackArg;               /* Argument to xRollbackCallback() */   \r\n  void (*xRollbackCallback)(void*); /* Invoked at every commit. */\r\n  void *pUpdateArg;\r\n  void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);\r\n#ifndef SQLITE_OMIT_WAL\r\n  int (*xWalCallback)(void *, sqlite3 *, const char *, int);\r\n  void *pWalArg;\r\n#endif\r\n  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);\r\n  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);\r\n  void *pCollNeededArg;\r\n  sqlite3_value *pErr;          /* Most recent error message */\r\n  char *zErrMsg;                /* Most recent error message (UTF-8 encoded) */\r\n  char *zErrMsg16;              /* Most recent error message (UTF-16 encoded) */\r\n  union {\r\n    volatile int isInterrupted; /* True if sqlite3_interrupt has been called */\r\n    double notUsed1;            /* Spacer */\r\n  } u1;\r\n  Lookaside lookaside;          /* Lookaside malloc configuration */\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);\r\n                                /* Access authorization function */\r\n  void *pAuthArg;               /* 1st argument to the access auth function */\r\n#endif\r\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\r\n  int (*xProgress)(void *);     /* The progress callback */\r\n  void *pProgressArg;           /* Argument to the progress callback */\r\n  int nProgressOps;             /* Number of opcodes for progress callback */\r\n#endif\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  int nVTrans;                  /* Allocated size of aVTrans */\r\n  Hash aModule;                 /* populated by sqlite3_create_module() */\r\n  VtabCtx *pVtabCtx;            /* Context for active vtab connect/create */\r\n  VTable **aVTrans;             /* Virtual tables with open transactions */\r\n  VTable *pDisconnect;    /* Disconnect these in next sqlite3_prepare() */\r\n#endif\r\n  FuncDefHash aFunc;            /* Hash table of connection functions */\r\n  Hash aCollSeq;                /* All collating sequences */\r\n  BusyHandler busyHandler;      /* Busy callback */\r\n  Db aDbStatic[2];              /* Static space for the 2 default backends */\r\n  Savepoint *pSavepoint;        /* List of active savepoints */\r\n  int busyTimeout;              /* Busy handler timeout, in msec */\r\n  int nSavepoint;               /* Number of non-transaction savepoints */\r\n  int nStatement;               /* Number of nested statement-transactions  */\r\n  i64 nDeferredCons;            /* Net deferred constraints this transaction. */\r\n  int *pnBytesFreed;            /* If not NULL, increment this in DbFree() */\r\n\r\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\r\n  /* The following variables are all protected by the STATIC_MASTER \r\n  ** mutex, not by sqlite3.mutex. They are used by code in notify.c. \r\n  **\r\n  ** When X.pUnlockConnection==Y, that means that X is waiting for Y to\r\n  ** unlock so that it can proceed.\r\n  **\r\n  ** When X.pBlockingConnection==Y, that means that something that X tried\r\n  ** tried to do recently failed with an SQLITE_LOCKED error due to locks\r\n  ** held by Y.\r\n  */\r\n  sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */\r\n  sqlite3 *pUnlockConnection;           /* Connection to watch for unlock */\r\n  void *pUnlockArg;                     /* Argument to xUnlockNotify */\r\n  void (*xUnlockNotify)(void **, int);  /* Unlock notify callback */\r\n  sqlite3 *pNextBlocked;        /* Next in list of all blocked connections */\r\n#endif\r\n};\r\n\r\n/*\r\n** A macro to discover the encoding of a database.\r\n*/\r\n#define ENC(db) ((db)->aDb[0].pSchema->enc)\r\n\r\n/*\r\n** Possible values for the sqlite3.flags.\r\n*/\r\n#define SQLITE_VdbeTrace      0x00000100  /* True to trace VDBE execution */\r\n#define SQLITE_InternChanges  0x00000200  /* Uncommitted Hash table changes */\r\n#define SQLITE_FullColNames   0x00000400  /* Show full column names on SELECT */\r\n#define SQLITE_ShortColNames  0x00000800  /* Show short columns names */\r\n#define SQLITE_CountRows      0x00001000  /* Count rows changed by INSERT, */\r\n                                          /*   DELETE, or UPDATE and return */\r\n                                          /*   the count using a callback. */\r\n#define SQLITE_NullCallback   0x00002000  /* Invoke the callback once if the */\r\n                                          /*   result set is empty */\r\n#define SQLITE_SqlTrace       0x00004000  /* Debug print SQL as it executes */\r\n#define SQLITE_VdbeListing    0x00008000  /* Debug listings of VDBE programs */\r\n#define SQLITE_WriteSchema    0x00010000  /* OK to update SQLITE_MASTER */\r\n                         /*   0x00020000  Unused */\r\n#define SQLITE_IgnoreChecks   0x00040000  /* Do not enforce check constraints */\r\n#define SQLITE_ReadUncommitted 0x0080000  /* For shared-cache mode */\r\n#define SQLITE_LegacyFileFmt  0x00100000  /* Create new databases in format 1 */\r\n#define SQLITE_FullFSync      0x00200000  /* Use full fsync on the backend */\r\n#define SQLITE_CkptFullFSync  0x00400000  /* Use full fsync for checkpoint */\r\n#define SQLITE_RecoveryMode   0x00800000  /* Ignore schema errors */\r\n#define SQLITE_ReverseOrder   0x01000000  /* Reverse unordered SELECTs */\r\n#define SQLITE_RecTriggers    0x02000000  /* Enable recursive triggers */\r\n#define SQLITE_ForeignKeys    0x04000000  /* Enforce foreign key constraints  */\r\n#define SQLITE_AutoIndex      0x08000000  /* Enable automatic indexes */\r\n#define SQLITE_PreferBuiltin  0x10000000  /* Preference to built-in funcs */\r\n#define SQLITE_LoadExtension  0x20000000  /* Enable load_extension */\r\n#define SQLITE_EnableTrigger  0x40000000  /* True to enable triggers */\r\n\r\n/*\r\n** Bits of the sqlite3.flags field that are used by the\r\n** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface.\r\n** These must be the low-order bits of the flags field.\r\n*/\r\n#define SQLITE_QueryFlattener 0x01        /* Disable query flattening */\r\n#define SQLITE_ColumnCache    0x02        /* Disable the column cache */\r\n#define SQLITE_IndexSort      0x04        /* Disable indexes for sorting */\r\n#define SQLITE_IndexSearch    0x08        /* Disable indexes for searching */\r\n#define SQLITE_IndexCover     0x10        /* Disable index covering table */\r\n#define SQLITE_GroupByOrder   0x20        /* Disable GROUPBY cover of ORDERBY */\r\n#define SQLITE_FactorOutConst 0x40        /* Disable factoring out constants */\r\n#define SQLITE_IdxRealAsInt   0x80        /* Store REAL as INT in indices */\r\n#define SQLITE_DistinctOpt    0x80        /* DISTINCT using indexes */\r\n#define SQLITE_OptMask        0xff        /* Mask of all disablable opts */\r\n\r\n/*\r\n** Possible values for the sqlite.magic field.\r\n** The numbers are obtained at random and have no special meaning, other\r\n** than being distinct from one another.\r\n*/\r\n#define SQLITE_MAGIC_OPEN     0xa029a697  /* Database is open */\r\n#define SQLITE_MAGIC_CLOSED   0x9f3c2d33  /* Database is closed */\r\n#define SQLITE_MAGIC_SICK     0x4b771290  /* Error and awaiting close */\r\n#define SQLITE_MAGIC_BUSY     0xf03b7906  /* Database currently in use */\r\n#define SQLITE_MAGIC_ERROR    0xb5357930  /* An SQLITE_MISUSE error occurred */\r\n\r\n/*\r\n** Each SQL function is defined by an instance of the following\r\n** structure.  A pointer to this structure is stored in the sqlite.aFunc\r\n** hash table.  When multiple functions have the same name, the hash table\r\n** points to a linked list of these structures.\r\n*/\r\nstruct FuncDef {\r\n  i16 nArg;            /* Number of arguments.  -1 means unlimited */\r\n  u8 iPrefEnc;         /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */\r\n  u8 flags;            /* Some combination of SQLITE_FUNC_* */\r\n  void *pUserData;     /* User data parameter */\r\n  FuncDef *pNext;      /* Next function with same name */\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */\r\n  void (*xFinalize)(sqlite3_context*);                /* Aggregate finalizer */\r\n  char *zName;         /* SQL name of the function. */\r\n  FuncDef *pHash;      /* Next with a different name but the same hash */\r\n  FuncDestructor *pDestructor;   /* Reference counted destructor function */\r\n};\r\n\r\n/*\r\n** This structure encapsulates a user-function destructor callback (as\r\n** configured using create_function_v2()) and a reference counter. When\r\n** create_function_v2() is called to create a function with a destructor,\r\n** a single object of this type is allocated. FuncDestructor.nRef is set to \r\n** the number of FuncDef objects created (either 1 or 3, depending on whether\r\n** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor\r\n** member of each of the new FuncDef objects is set to point to the allocated\r\n** FuncDestructor.\r\n**\r\n** Thereafter, when one of the FuncDef objects is deleted, the reference\r\n** count on this object is decremented. When it reaches 0, the destructor\r\n** is invoked and the FuncDestructor structure freed.\r\n*/\r\nstruct FuncDestructor {\r\n  int nRef;\r\n  void (*xDestroy)(void *);\r\n  void *pUserData;\r\n};\r\n\r\n/*\r\n** Possible values for FuncDef.flags\r\n*/\r\n#define SQLITE_FUNC_LIKE     0x01 /* Candidate for the LIKE optimization */\r\n#define SQLITE_FUNC_CASE     0x02 /* Case-sensitive LIKE-type function */\r\n#define SQLITE_FUNC_EPHEM    0x04 /* Ephemeral.  Delete with VDBE */\r\n#define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */\r\n#define SQLITE_FUNC_COUNT    0x20 /* Built-in count(*) aggregate */\r\n#define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */\r\n\r\n/*\r\n** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are\r\n** used to create the initializers for the FuncDef structures.\r\n**\r\n**   FUNCTION(zName, nArg, iArg, bNC, xFunc)\r\n**     Used to create a scalar function definition of a function zName \r\n**     implemented by C function xFunc that accepts nArg arguments. The\r\n**     value passed as iArg is cast to a (void*) and made available\r\n**     as the user-data (sqlite3_user_data()) for the function. If \r\n**     argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set.\r\n**\r\n**   AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)\r\n**     Used to create an aggregate function definition implemented by\r\n**     the C functions xStep and xFinal. The first four parameters\r\n**     are interpreted in the same way as the first 4 parameters to\r\n**     FUNCTION().\r\n**\r\n**   LIKEFUNC(zName, nArg, pArg, flags)\r\n**     Used to create a scalar function definition of a function zName \r\n**     that accepts nArg arguments and is implemented by a call to C \r\n**     function likeFunc. Argument pArg is cast to a (void *) and made\r\n**     available as the function user-data (sqlite3_user_data()). The\r\n**     FuncDef.flags variable is set to the value passed as the flags\r\n**     parameter.\r\n*/\r\n#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \\\r\n  {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \\\r\n   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0}\r\n#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \\\r\n  {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \\\r\n   pArg, 0, xFunc, 0, 0, #zName, 0, 0}\r\n#define LIKEFUNC(zName, nArg, arg, flags) \\\r\n  {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0}\r\n#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \\\r\n  {nArg, SQLITE_UTF8, nc*SQLITE_FUNC_NEEDCOLL, \\\r\n   SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0,0}\r\n\r\n/*\r\n** All current savepoints are stored in a linked list starting at\r\n** sqlite3.pSavepoint. The first element in the list is the most recently\r\n** opened savepoint. Savepoints are added to the list by the vdbe\r\n** OP_Savepoint instruction.\r\n*/\r\nstruct Savepoint {\r\n  char *zName;                        /* Savepoint name (nul-terminated) */\r\n  i64 nDeferredCons;                  /* Number of deferred fk violations */\r\n  Savepoint *pNext;                   /* Parent savepoint (if any) */\r\n};\r\n\r\n/*\r\n** The following are used as the second parameter to sqlite3Savepoint(),\r\n** and as the P1 argument to the OP_Savepoint instruction.\r\n*/\r\n#define SAVEPOINT_BEGIN      0\r\n#define SAVEPOINT_RELEASE    1\r\n#define SAVEPOINT_ROLLBACK   2\r\n\r\n\r\n/*\r\n** Each SQLite module (virtual table definition) is defined by an\r\n** instance of the following structure, stored in the sqlite3.aModule\r\n** hash table.\r\n*/\r\nstruct Module {\r\n  const sqlite3_module *pModule;       /* Callback pointers */\r\n  const char *zName;                   /* Name passed to create_module() */\r\n  void *pAux;                          /* pAux passed to create_module() */\r\n  void (*xDestroy)(void *);            /* Module destructor function */\r\n};\r\n\r\n/*\r\n** information about each column of an SQL table is held in an instance\r\n** of this structure.\r\n*/\r\nstruct Column {\r\n  char *zName;     /* Name of this column */\r\n  Expr *pDflt;     /* Default value of this column */\r\n  char *zDflt;     /* Original text of the default value */\r\n  char *zType;     /* Data type for this column */\r\n  char *zColl;     /* Collating sequence.  If NULL, use the default */\r\n  u8 notNull;      /* True if there is a NOT NULL constraint */\r\n  u8 isPrimKey;    /* True if this column is part of the PRIMARY KEY */\r\n  char affinity;   /* One of the SQLITE_AFF_... values */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  u8 isHidden;     /* True if this column is 'hidden' */\r\n#endif\r\n};\r\n\r\n/*\r\n** A \"Collating Sequence\" is defined by an instance of the following\r\n** structure. Conceptually, a collating sequence consists of a name and\r\n** a comparison routine that defines the order of that sequence.\r\n**\r\n** There may two separate implementations of the collation function, one\r\n** that processes text in UTF-8 encoding (CollSeq.xCmp) and another that\r\n** processes text encoded in UTF-16 (CollSeq.xCmp16), using the machine\r\n** native byte order. When a collation sequence is invoked, SQLite selects\r\n** the version that will require the least expensive encoding\r\n** translations, if any.\r\n**\r\n** The CollSeq.pUser member variable is an extra parameter that passed in\r\n** as the first argument to the UTF-8 comparison function, xCmp.\r\n** CollSeq.pUser16 is the equivalent for the UTF-16 comparison function,\r\n** xCmp16.\r\n**\r\n** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the\r\n** collating sequence is undefined.  Indices built on an undefined\r\n** collating sequence may not be read or written.\r\n*/\r\nstruct CollSeq {\r\n  char *zName;          /* Name of the collating sequence, UTF-8 encoded */\r\n  u8 enc;               /* Text encoding handled by xCmp() */\r\n  void *pUser;          /* First argument to xCmp() */\r\n  int (*xCmp)(void*,int, const void*, int, const void*);\r\n  void (*xDel)(void*);  /* Destructor for pUser */\r\n};\r\n\r\n/*\r\n** A sort order can be either ASC or DESC.\r\n*/\r\n#define SQLITE_SO_ASC       0  /* Sort in ascending order */\r\n#define SQLITE_SO_DESC      1  /* Sort in ascending order */\r\n\r\n/*\r\n** Column affinity types.\r\n**\r\n** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and\r\n** 't' for SQLITE_AFF_TEXT.  But we can save a little space and improve\r\n** the speed a little by numbering the values consecutively.  \r\n**\r\n** But rather than start with 0 or 1, we begin with 'a'.  That way,\r\n** when multiple affinity types are concatenated into a string and\r\n** used as the P4 operand, they will be more readable.\r\n**\r\n** Note also that the numeric types are grouped together so that testing\r\n** for a numeric type is a single comparison.\r\n*/\r\n#define SQLITE_AFF_TEXT     'a'\r\n#define SQLITE_AFF_NONE     'b'\r\n#define SQLITE_AFF_NUMERIC  'c'\r\n#define SQLITE_AFF_INTEGER  'd'\r\n#define SQLITE_AFF_REAL     'e'\r\n\r\n#define sqlite3IsNumericAffinity(X)  ((X)>=SQLITE_AFF_NUMERIC)\r\n\r\n/*\r\n** The SQLITE_AFF_MASK values masks off the significant bits of an\r\n** affinity value. \r\n*/\r\n#define SQLITE_AFF_MASK     0x67\r\n\r\n/*\r\n** Additional bit values that can be ORed with an affinity without\r\n** changing the affinity.\r\n*/\r\n#define SQLITE_JUMPIFNULL   0x08  /* jumps if either operand is NULL */\r\n#define SQLITE_STOREP2      0x10  /* Store result in reg[P2] rather than jump */\r\n#define SQLITE_NULLEQ       0x80  /* NULL=NULL */\r\n\r\n/*\r\n** An object of this type is created for each virtual table present in\r\n** the database schema. \r\n**\r\n** If the database schema is shared, then there is one instance of this\r\n** structure for each database connection (sqlite3*) that uses the shared\r\n** schema. This is because each database connection requires its own unique\r\n** instance of the sqlite3_vtab* handle used to access the virtual table \r\n** implementation. sqlite3_vtab* handles can not be shared between \r\n** database connections, even when the rest of the in-memory database \r\n** schema is shared, as the implementation often stores the database\r\n** connection handle passed to it via the xConnect() or xCreate() method\r\n** during initialization internally. This database connection handle may\r\n** then be used by the virtual table implementation to access real tables \r\n** within the database. So that they appear as part of the callers \r\n** transaction, these accesses need to be made via the same database \r\n** connection as that used to execute SQL operations on the virtual table.\r\n**\r\n** All VTable objects that correspond to a single table in a shared\r\n** database schema are initially stored in a linked-list pointed to by\r\n** the Table.pVTable member variable of the corresponding Table object.\r\n** When an sqlite3_prepare() operation is required to access the virtual\r\n** table, it searches the list for the VTable that corresponds to the\r\n** database connection doing the preparing so as to use the correct\r\n** sqlite3_vtab* handle in the compiled query.\r\n**\r\n** When an in-memory Table object is deleted (for example when the\r\n** schema is being reloaded for some reason), the VTable objects are not \r\n** deleted and the sqlite3_vtab* handles are not xDisconnect()ed \r\n** immediately. Instead, they are moved from the Table.pVTable list to\r\n** another linked list headed by the sqlite3.pDisconnect member of the\r\n** corresponding sqlite3 structure. They are then deleted/xDisconnected \r\n** next time a statement is prepared using said sqlite3*. This is done\r\n** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.\r\n** Refer to comments above function sqlite3VtabUnlockList() for an\r\n** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect\r\n** list without holding the corresponding sqlite3.mutex mutex.\r\n**\r\n** The memory for objects of this type is always allocated by \r\n** sqlite3DbMalloc(), using the connection handle stored in VTable.db as \r\n** the first argument.\r\n*/\r\nstruct VTable {\r\n  sqlite3 *db;              /* Database connection associated with this table */\r\n  Module *pMod;             /* Pointer to module implementation */\r\n  sqlite3_vtab *pVtab;      /* Pointer to vtab instance */\r\n  int nRef;                 /* Number of pointers to this structure */\r\n  u8 bConstraint;           /* True if constraints are supported */\r\n  int iSavepoint;           /* Depth of the SAVEPOINT stack */\r\n  VTable *pNext;            /* Next in linked list (see above) */\r\n};\r\n\r\n/*\r\n** Each SQL table is represented in memory by an instance of the\r\n** following structure.\r\n**\r\n** Table.zName is the name of the table.  The case of the original\r\n** CREATE TABLE statement is stored, but case is not significant for\r\n** comparisons.\r\n**\r\n** Table.nCol is the number of columns in this table.  Table.aCol is a\r\n** pointer to an array of Column structures, one for each column.\r\n**\r\n** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of\r\n** the column that is that key.   Otherwise Table.iPKey is negative.  Note\r\n** that the datatype of the PRIMARY KEY must be INTEGER for this field to\r\n** be set.  An INTEGER PRIMARY KEY is used as the rowid for each row of\r\n** the table.  If a table has no INTEGER PRIMARY KEY, then a random rowid\r\n** is generated for each row of the table.  TF_HasPrimaryKey is set if\r\n** the table has any PRIMARY KEY, INTEGER or otherwise.\r\n**\r\n** Table.tnum is the page number for the root BTree page of the table in the\r\n** database file.  If Table.iDb is the index of the database table backend\r\n** in sqlite.aDb[].  0 is for the main database and 1 is for the file that\r\n** holds temporary tables and indices.  If TF_Ephemeral is set\r\n** then the table is stored in a file that is automatically deleted\r\n** when the VDBE cursor to the table is closed.  In this case Table.tnum \r\n** refers VDBE cursor number that holds the table open, not to the root\r\n** page number.  Transient tables are used to hold the results of a\r\n** sub-query that appears instead of a real table name in the FROM clause \r\n** of a SELECT statement.\r\n*/\r\nstruct Table {\r\n  char *zName;         /* Name of the table or view */\r\n  int iPKey;           /* If not negative, use aCol[iPKey] as the primary key */\r\n  int nCol;            /* Number of columns in this table */\r\n  Column *aCol;        /* Information about each column */\r\n  Index *pIndex;       /* List of SQL indexes on this table. */\r\n  int tnum;            /* Root BTree node for this table (see note above) */\r\n  tRowcnt nRowEst;     /* Estimated rows in table - from sqlite_stat1 table */\r\n  Select *pSelect;     /* NULL for tables.  Points to definition if a view. */\r\n  u16 nRef;            /* Number of pointers to this Table */\r\n  u8 tabFlags;         /* Mask of TF_* values */\r\n  u8 keyConf;          /* What to do in case of uniqueness conflict on iPKey */\r\n  FKey *pFKey;         /* Linked list of all foreign keys in this table */\r\n  char *zColAff;       /* String defining the affinity of each column */\r\n#ifndef SQLITE_OMIT_CHECK\r\n  Expr *pCheck;        /* The AND of all CHECK constraints */\r\n#endif\r\n#ifndef SQLITE_OMIT_ALTERTABLE\r\n  int addColOffset;    /* Offset in CREATE TABLE stmt to add a new column */\r\n#endif\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  VTable *pVTable;     /* List of VTable objects. */\r\n  int nModuleArg;      /* Number of arguments to the module */\r\n  char **azModuleArg;  /* Text of all module args. [0] is module name */\r\n#endif\r\n  Trigger *pTrigger;   /* List of triggers stored in pSchema */\r\n  Schema *pSchema;     /* Schema that contains this table */\r\n  Table *pNextZombie;  /* Next on the Parse.pZombieTab list */\r\n};\r\n\r\n/*\r\n** Allowed values for Tabe.tabFlags.\r\n*/\r\n#define TF_Readonly        0x01    /* Read-only system table */\r\n#define TF_Ephemeral       0x02    /* An ephemeral table */\r\n#define TF_HasPrimaryKey   0x04    /* Table has a primary key */\r\n#define TF_Autoincrement   0x08    /* Integer primary key is autoincrement */\r\n#define TF_Virtual         0x10    /* Is a virtual table */\r\n\r\n\r\n/*\r\n** Test to see whether or not a table is a virtual table.  This is\r\n** done as a macro so that it will be optimized out when virtual\r\n** table support is omitted from the build.\r\n*/\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n#  define IsVirtual(X)      (((X)->tabFlags & TF_Virtual)!=0)\r\n#  define IsHiddenColumn(X) ((X)->isHidden)\r\n#else\r\n#  define IsVirtual(X)      0\r\n#  define IsHiddenColumn(X) 0\r\n#endif\r\n\r\n/*\r\n** Each foreign key constraint is an instance of the following structure.\r\n**\r\n** A foreign key is associated with two tables.  The \"from\" table is\r\n** the table that contains the REFERENCES clause that creates the foreign\r\n** key.  The \"to\" table is the table that is named in the REFERENCES clause.\r\n** Consider this example:\r\n**\r\n**     CREATE TABLE ex1(\r\n**       a INTEGER PRIMARY KEY,\r\n**       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)\r\n**     );\r\n**\r\n** For foreign key \"fk1\", the from-table is \"ex1\" and the to-table is \"ex2\".\r\n**\r\n** Each REFERENCES clause generates an instance of the following structure\r\n** which is attached to the from-table.  The to-table need not exist when\r\n** the from-table is created.  The existence of the to-table is not checked.\r\n*/\r\nstruct FKey {\r\n  Table *pFrom;     /* Table containing the REFERENCES clause (aka: Child) */\r\n  FKey *pNextFrom;  /* Next foreign key in pFrom */\r\n  char *zTo;        /* Name of table that the key points to (aka: Parent) */\r\n  FKey *pNextTo;    /* Next foreign key on table named zTo */\r\n  FKey *pPrevTo;    /* Previous foreign key on table named zTo */\r\n  int nCol;         /* Number of columns in this key */\r\n  /* EV: R-30323-21917 */\r\n  u8 isDeferred;    /* True if constraint checking is deferred till COMMIT */\r\n  u8 aAction[2];          /* ON DELETE and ON UPDATE actions, respectively */\r\n  Trigger *apTrigger[2];  /* Triggers for aAction[] actions */\r\n  struct sColMap {  /* Mapping of columns in pFrom to columns in zTo */\r\n    int iFrom;         /* Index of column in pFrom */\r\n    char *zCol;        /* Name of column in zTo.  If 0 use PRIMARY KEY */\r\n  } aCol[1];        /* One entry for each of nCol column s */\r\n};\r\n\r\n/*\r\n** SQLite supports many different ways to resolve a constraint\r\n** error.  ROLLBACK processing means that a constraint violation\r\n** causes the operation in process to fail and for the current transaction\r\n** to be rolled back.  ABORT processing means the operation in process\r\n** fails and any prior changes from that one operation are backed out,\r\n** but the transaction is not rolled back.  FAIL processing means that\r\n** the operation in progress stops and returns an error code.  But prior\r\n** changes due to the same operation are not backed out and no rollback\r\n** occurs.  IGNORE means that the particular row that caused the constraint\r\n** error is not inserted or updated.  Processing continues and no error\r\n** is returned.  REPLACE means that preexisting database rows that caused\r\n** a UNIQUE constraint violation are removed so that the new insert or\r\n** update can proceed.  Processing continues and no error is reported.\r\n**\r\n** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.\r\n** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the\r\n** same as ROLLBACK for DEFERRED keys.  SETNULL means that the foreign\r\n** key is set to NULL.  CASCADE means that a DELETE or UPDATE of the\r\n** referenced table row is propagated into the row that holds the\r\n** foreign key.\r\n** \r\n** The following symbolic values are used to record which type\r\n** of action to take.\r\n*/\r\n#define OE_None     0   /* There is no constraint to check */\r\n#define OE_Rollback 1   /* Fail the operation and rollback the transaction */\r\n#define OE_Abort    2   /* Back out changes but do no rollback transaction */\r\n#define OE_Fail     3   /* Stop the operation but leave all prior changes */\r\n#define OE_Ignore   4   /* Ignore the error. Do not do the INSERT or UPDATE */\r\n#define OE_Replace  5   /* Delete existing record, then do INSERT or UPDATE */\r\n\r\n#define OE_Restrict 6   /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */\r\n#define OE_SetNull  7   /* Set the foreign key value to NULL */\r\n#define OE_SetDflt  8   /* Set the foreign key value to its default */\r\n#define OE_Cascade  9   /* Cascade the changes */\r\n\r\n#define OE_Default  99  /* Do whatever the default action is */\r\n\r\n\r\n/*\r\n** An instance of the following structure is passed as the first\r\n** argument to sqlite3VdbeKeyCompare and is used to control the \r\n** comparison of the two index keys.\r\n*/\r\nstruct KeyInfo {\r\n  sqlite3 *db;        /* The database connection */\r\n  u8 enc;             /* Text encoding - one of the SQLITE_UTF* values */\r\n  u16 nField;         /* Number of entries in aColl[] */\r\n  u8 *aSortOrder;     /* Sort order for each column.  May be NULL */\r\n  CollSeq *aColl[1];  /* Collating sequence for each term of the key */\r\n};\r\n\r\n/*\r\n** An instance of the following structure holds information about a\r\n** single index record that has already been parsed out into individual\r\n** values.\r\n**\r\n** A record is an object that contains one or more fields of data.\r\n** Records are used to store the content of a table row and to store\r\n** the key of an index.  A blob encoding of a record is created by\r\n** the OP_MakeRecord opcode of the VDBE and is disassembled by the\r\n** OP_Column opcode.\r\n**\r\n** This structure holds a record that has already been disassembled\r\n** into its constituent fields.\r\n*/\r\nstruct UnpackedRecord {\r\n  KeyInfo *pKeyInfo;  /* Collation and sort-order information */\r\n  u16 nField;         /* Number of entries in apMem[] */\r\n  u8 flags;           /* Boolean settings.  UNPACKED_... below */\r\n  i64 rowid;          /* Used by UNPACKED_PREFIX_SEARCH */\r\n  Mem *aMem;          /* Values */\r\n};\r\n\r\n/*\r\n** Allowed values of UnpackedRecord.flags\r\n*/\r\n#define UNPACKED_INCRKEY       0x01  /* Make this key an epsilon larger */\r\n#define UNPACKED_PREFIX_MATCH  0x02  /* A prefix match is considered OK */\r\n#define UNPACKED_PREFIX_SEARCH 0x04  /* Ignore final (rowid) field */\r\n\r\n/*\r\n** Each SQL index is represented in memory by an\r\n** instance of the following structure.\r\n**\r\n** The columns of the table that are to be indexed are described\r\n** by the aiColumn[] field of this structure.  For example, suppose\r\n** we have the following table and index:\r\n**\r\n**     CREATE TABLE Ex1(c1 int, c2 int, c3 text);\r\n**     CREATE INDEX Ex2 ON Ex1(c3,c1);\r\n**\r\n** In the Table structure describing Ex1, nCol==3 because there are\r\n** three columns in the table.  In the Index structure describing\r\n** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.\r\n** The value of aiColumn is {2, 0}.  aiColumn[0]==2 because the \r\n** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].\r\n** The second column to be indexed (c1) has an index of 0 in\r\n** Ex1.aCol[], hence Ex2.aiColumn[1]==0.\r\n**\r\n** The Index.onError field determines whether or not the indexed columns\r\n** must be unique and what to do if they are not.  When Index.onError=OE_None,\r\n** it means this is not a unique index.  Otherwise it is a unique index\r\n** and the value of Index.onError indicate the which conflict resolution \r\n** algorithm to employ whenever an attempt is made to insert a non-unique\r\n** element.\r\n*/\r\nstruct Index {\r\n  char *zName;     /* Name of this index */\r\n  int *aiColumn;   /* Which columns are used by this index.  1st is 0 */\r\n  tRowcnt *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */\r\n  Table *pTable;   /* The SQL table being indexed */\r\n  char *zColAff;   /* String defining the affinity of each column */\r\n  Index *pNext;    /* The next index associated with the same table */\r\n  Schema *pSchema; /* Schema containing this index */\r\n  u8 *aSortOrder;  /* Array of size Index.nColumn. True==DESC, False==ASC */\r\n  char **azColl;   /* Array of collation sequence names for index */\r\n  int nColumn;     /* Number of columns in the table used by this index */\r\n  int tnum;        /* Page containing root of this index in database file */\r\n  u8 onError;      /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */\r\n  u8 autoIndex;    /* True if is automatically created (ex: by UNIQUE) */\r\n  u8 bUnordered;   /* Use this index for == or IN queries only */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  int nSample;             /* Number of elements in aSample[] */\r\n  tRowcnt avgEq;           /* Average nEq value for key values not in aSample */\r\n  IndexSample *aSample;    /* Samples of the left-most key */\r\n#endif\r\n};\r\n\r\n/*\r\n** Each sample stored in the sqlite_stat3 table is represented in memory \r\n** using a structure of this type.  See documentation at the top of the\r\n** analyze.c source file for additional information.\r\n*/\r\nstruct IndexSample {\r\n  union {\r\n    char *z;        /* Value if eType is SQLITE_TEXT or SQLITE_BLOB */\r\n    double r;       /* Value if eType is SQLITE_FLOAT */\r\n    i64 i;          /* Value if eType is SQLITE_INTEGER */\r\n  } u;\r\n  u8 eType;         /* SQLITE_NULL, SQLITE_INTEGER ... etc. */\r\n  int nByte;        /* Size in byte of text or blob. */\r\n  tRowcnt nEq;      /* Est. number of rows where the key equals this sample */\r\n  tRowcnt nLt;      /* Est. number of rows where key is less than this sample */\r\n  tRowcnt nDLt;     /* Est. number of distinct keys less than this sample */\r\n};\r\n\r\n/*\r\n** Each token coming out of the lexer is an instance of\r\n** this structure.  Tokens are also used as part of an expression.\r\n**\r\n** Note if Token.z==0 then Token.dyn and Token.n are undefined and\r\n** may contain random values.  Do not make any assumptions about Token.dyn\r\n** and Token.n when Token.z==0.\r\n*/\r\nstruct Token {\r\n  const char *z;     /* Text of the token.  Not NULL-terminated! */\r\n  unsigned int n;    /* Number of characters in this token */\r\n};\r\n\r\n/*\r\n** An instance of this structure contains information needed to generate\r\n** code for a SELECT that contains aggregate functions.\r\n**\r\n** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a\r\n** pointer to this structure.  The Expr.iColumn field is the index in\r\n** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate\r\n** code for that node.\r\n**\r\n** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the\r\n** original Select structure that describes the SELECT statement.  These\r\n** fields do not need to be freed when deallocating the AggInfo structure.\r\n*/\r\nstruct AggInfo {\r\n  u8 directMode;          /* Direct rendering mode means take data directly\r\n                          ** from source tables rather than from accumulators */\r\n  u8 useSortingIdx;       /* In direct mode, reference the sorting index rather\r\n                          ** than the source table */\r\n  int sortingIdx;         /* Cursor number of the sorting index */\r\n  int sortingIdxPTab;     /* Cursor number of pseudo-table */\r\n  int nSortingColumn;     /* Number of columns in the sorting index */\r\n  ExprList *pGroupBy;     /* The group by clause */\r\n  struct AggInfo_col {    /* For each column used in source tables */\r\n    Table *pTab;             /* Source table */\r\n    int iTable;              /* Cursor number of the source table */\r\n    int iColumn;             /* Column number within the source table */\r\n    int iSorterColumn;       /* Column number in the sorting index */\r\n    int iMem;                /* Memory location that acts as accumulator */\r\n    Expr *pExpr;             /* The original expression */\r\n  } *aCol;\r\n  int nColumn;            /* Number of used entries in aCol[] */\r\n  int nAccumulator;       /* Number of columns that show through to the output.\r\n                          ** Additional columns are used only as parameters to\r\n                          ** aggregate functions */\r\n  struct AggInfo_func {   /* For each aggregate function */\r\n    Expr *pExpr;             /* Expression encoding the function */\r\n    FuncDef *pFunc;          /* The aggregate function implementation */\r\n    int iMem;                /* Memory location that acts as accumulator */\r\n    int iDistinct;           /* Ephemeral table used to enforce DISTINCT */\r\n  } *aFunc;\r\n  int nFunc;              /* Number of entries in aFunc[] */\r\n};\r\n\r\n/*\r\n** The datatype ynVar is a signed integer, either 16-bit or 32-bit.\r\n** Usually it is 16-bits.  But if SQLITE_MAX_VARIABLE_NUMBER is greater\r\n** than 32767 we have to make it 32-bit.  16-bit is preferred because\r\n** it uses less memory in the Expr object, which is a big memory user\r\n** in systems with lots of prepared statements.  And few applications\r\n** need more than about 10 or 20 variables.  But some extreme users want\r\n** to have prepared statements with over 32767 variables, and for them\r\n** the option is available (at compile-time).\r\n*/\r\n#if SQLITE_MAX_VARIABLE_NUMBER<=32767\r\ntypedef i16 ynVar;\r\n#else\r\ntypedef int ynVar;\r\n#endif\r\n\r\n/*\r\n** Each node of an expression in the parse tree is an instance\r\n** of this structure.\r\n**\r\n** Expr.op is the opcode. The integer parser token codes are reused\r\n** as opcodes here. For example, the parser defines TK_GE to be an integer\r\n** code representing the \">=\" operator. This same integer code is reused\r\n** to represent the greater-than-or-equal-to operator in the expression\r\n** tree.\r\n**\r\n** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, \r\n** or TK_STRING), then Expr.token contains the text of the SQL literal. If\r\n** the expression is a variable (TK_VARIABLE), then Expr.token contains the \r\n** variable name. Finally, if the expression is an SQL function (TK_FUNCTION),\r\n** then Expr.token contains the name of the function.\r\n**\r\n** Expr.pRight and Expr.pLeft are the left and right subexpressions of a\r\n** binary operator. Either or both may be NULL.\r\n**\r\n** Expr.x.pList is a list of arguments if the expression is an SQL function,\r\n** a CASE expression or an IN expression of the form \"<lhs> IN (<y>, <z>...)\".\r\n** Expr.x.pSelect is used if the expression is a sub-select or an expression of\r\n** the form \"<lhs> IN (SELECT ...)\". If the EP_xIsSelect bit is set in the\r\n** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is \r\n** valid.\r\n**\r\n** An expression of the form ID or ID.ID refers to a column in a table.\r\n** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is\r\n** the integer cursor number of a VDBE cursor pointing to that table and\r\n** Expr.iColumn is the column number for the specific column.  If the\r\n** expression is used as a result in an aggregate SELECT, then the\r\n** value is also stored in the Expr.iAgg column in the aggregate so that\r\n** it can be accessed after all aggregates are computed.\r\n**\r\n** If the expression is an unbound variable marker (a question mark \r\n** character '?' in the original SQL) then the Expr.iTable holds the index \r\n** number for that variable.\r\n**\r\n** If the expression is a subquery then Expr.iColumn holds an integer\r\n** register number containing the result of the subquery.  If the\r\n** subquery gives a constant result, then iTable is -1.  If the subquery\r\n** gives a different answer at different times during statement processing\r\n** then iTable is the address of a subroutine that computes the subquery.\r\n**\r\n** If the Expr is of type OP_Column, and the table it is selecting from\r\n** is a disk table or the \"old.*\" pseudo-table, then pTab points to the\r\n** corresponding table definition.\r\n**\r\n** ALLOCATION NOTES:\r\n**\r\n** Expr objects can use a lot of memory space in database schema.  To\r\n** help reduce memory requirements, sometimes an Expr object will be\r\n** truncated.  And to reduce the number of memory allocations, sometimes\r\n** two or more Expr objects will be stored in a single memory allocation,\r\n** together with Expr.zToken strings.\r\n**\r\n** If the EP_Reduced and EP_TokenOnly flags are set when\r\n** an Expr object is truncated.  When EP_Reduced is set, then all\r\n** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees\r\n** are contained within the same memory allocation.  Note, however, that\r\n** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately\r\n** allocated, regardless of whether or not EP_Reduced is set.\r\n*/\r\nstruct Expr {\r\n  u8 op;                 /* Operation performed by this node */\r\n  char affinity;         /* The affinity of the column or 0 if not a column */\r\n  u16 flags;             /* Various flags.  EP_* See below */\r\n  union {\r\n    char *zToken;          /* Token value. Zero terminated and dequoted */\r\n    int iValue;            /* Non-negative integer value if EP_IntValue */\r\n  } u;\r\n\r\n  /* If the EP_TokenOnly flag is set in the Expr.flags mask, then no\r\n  ** space is allocated for the fields below this point. An attempt to\r\n  ** access them will result in a segfault or malfunction. \r\n  *********************************************************************/\r\n\r\n  Expr *pLeft;           /* Left subnode */\r\n  Expr *pRight;          /* Right subnode */\r\n  union {\r\n    ExprList *pList;     /* Function arguments or in \"<expr> IN (<expr-list)\" */\r\n    Select *pSelect;     /* Used for sub-selects and \"<expr> IN (<select>)\" */\r\n  } x;\r\n  CollSeq *pColl;        /* The collation type of the column or 0 */\r\n\r\n  /* If the EP_Reduced flag is set in the Expr.flags mask, then no\r\n  ** space is allocated for the fields below this point. An attempt to\r\n  ** access them will result in a segfault or malfunction.\r\n  *********************************************************************/\r\n\r\n  int iTable;            /* TK_COLUMN: cursor number of table holding column\r\n                         ** TK_REGISTER: register number\r\n                         ** TK_TRIGGER: 1 -> new, 0 -> old */\r\n  ynVar iColumn;         /* TK_COLUMN: column index.  -1 for rowid.\r\n                         ** TK_VARIABLE: variable number (always >= 1). */\r\n  i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */\r\n  i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */\r\n  u8 flags2;             /* Second set of flags.  EP2_... */\r\n  u8 op2;                /* If a TK_REGISTER, the original value of Expr.op */\r\n  AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */\r\n  Table *pTab;           /* Table for TK_COLUMN expressions. */\r\n#if SQLITE_MAX_EXPR_DEPTH>0\r\n  int nHeight;           /* Height of the tree headed by this node */\r\n#endif\r\n};\r\n\r\n/*\r\n** The following are the meanings of bits in the Expr.flags field.\r\n*/\r\n#define EP_FromJoin   0x0001  /* Originated in ON or USING clause of a join */\r\n#define EP_Agg        0x0002  /* Contains one or more aggregate functions */\r\n#define EP_Resolved   0x0004  /* IDs have been resolved to COLUMNs */\r\n#define EP_Error      0x0008  /* Expression contains one or more errors */\r\n#define EP_Distinct   0x0010  /* Aggregate function with DISTINCT keyword */\r\n#define EP_VarSelect  0x0020  /* pSelect is correlated, not constant */\r\n#define EP_DblQuoted  0x0040  /* token.z was originally in \"...\" */\r\n#define EP_InfixFunc  0x0080  /* True for an infix function: LIKE, GLOB, etc */\r\n#define EP_ExpCollate 0x0100  /* Collating sequence specified explicitly */\r\n#define EP_FixedDest  0x0200  /* Result needed in a specific register */\r\n#define EP_IntValue   0x0400  /* Integer value contained in u.iValue */\r\n#define EP_xIsSelect  0x0800  /* x.pSelect is valid (otherwise x.pList is) */\r\n#define EP_Hint       0x1000  /* Optimizer hint. Not required for correctness */\r\n#define EP_Reduced    0x2000  /* Expr struct is EXPR_REDUCEDSIZE bytes only */\r\n#define EP_TokenOnly  0x4000  /* Expr struct is EXPR_TOKENONLYSIZE bytes only */\r\n#define EP_Static     0x8000  /* Held in memory not obtained from malloc() */\r\n\r\n/*\r\n** The following are the meanings of bits in the Expr.flags2 field.\r\n*/\r\n#define EP2_MallocedToken  0x0001  /* Need to sqlite3DbFree() Expr.zToken */\r\n#define EP2_Irreducible    0x0002  /* Cannot EXPRDUP_REDUCE this Expr */\r\n\r\n/*\r\n** The pseudo-routine sqlite3ExprSetIrreducible sets the EP2_Irreducible\r\n** flag on an expression structure.  This flag is used for VV&A only.  The\r\n** routine is implemented as a macro that only works when in debugging mode,\r\n** so as not to burden production code.\r\n*/\r\n#ifdef SQLITE_DEBUG\r\n# define ExprSetIrreducible(X)  (X)->flags2 |= EP2_Irreducible\r\n#else\r\n# define ExprSetIrreducible(X)\r\n#endif\r\n\r\n/*\r\n** These macros can be used to test, set, or clear bits in the \r\n** Expr.flags field.\r\n*/\r\n#define ExprHasProperty(E,P)     (((E)->flags&(P))==(P))\r\n#define ExprHasAnyProperty(E,P)  (((E)->flags&(P))!=0)\r\n#define ExprSetProperty(E,P)     (E)->flags|=(P)\r\n#define ExprClearProperty(E,P)   (E)->flags&=~(P)\r\n\r\n/*\r\n** Macros to determine the number of bytes required by a normal Expr \r\n** struct, an Expr struct with the EP_Reduced flag set in Expr.flags \r\n** and an Expr struct with the EP_TokenOnly flag set.\r\n*/\r\n#define EXPR_FULLSIZE           sizeof(Expr)           /* Full size */\r\n#define EXPR_REDUCEDSIZE        offsetof(Expr,iTable)  /* Common features */\r\n#define EXPR_TOKENONLYSIZE      offsetof(Expr,pLeft)   /* Fewer features */\r\n\r\n/*\r\n** Flags passed to the sqlite3ExprDup() function. See the header comment \r\n** above sqlite3ExprDup() for details.\r\n*/\r\n#define EXPRDUP_REDUCE         0x0001  /* Used reduced-size Expr nodes */\r\n\r\n/*\r\n** A list of expressions.  Each expression may optionally have a\r\n** name.  An expr/name combination can be used in several ways, such\r\n** as the list of \"expr AS ID\" fields following a \"SELECT\" or in the\r\n** list of \"ID = expr\" items in an UPDATE.  A list of expressions can\r\n** also be used as the argument to a function, in which case the a.zName\r\n** field is not used.\r\n*/\r\nstruct ExprList {\r\n  int nExpr;             /* Number of expressions on the list */\r\n  int iECursor;          /* VDBE Cursor associated with this ExprList */\r\n  struct ExprList_item { /* For each expression in the list */\r\n    Expr *pExpr;           /* The list of expressions */\r\n    char *zName;           /* Token associated with this expression */\r\n    char *zSpan;           /* Original text of the expression */\r\n    u8 sortOrder;          /* 1 for DESC or 0 for ASC */\r\n    u8 done;               /* A flag to indicate when processing is finished */\r\n    u16 iOrderByCol;       /* For ORDER BY, column number in result set */\r\n    u16 iAlias;            /* Index into Parse.aAlias[] for zName */\r\n  } *a;                  /* Alloc a power of two greater or equal to nExpr */\r\n};\r\n\r\n/*\r\n** An instance of this structure is used by the parser to record both\r\n** the parse tree for an expression and the span of input text for an\r\n** expression.\r\n*/\r\nstruct ExprSpan {\r\n  Expr *pExpr;          /* The expression parse tree */\r\n  const char *zStart;   /* First character of input text */\r\n  const char *zEnd;     /* One character past the end of input text */\r\n};\r\n\r\n/*\r\n** An instance of this structure can hold a simple list of identifiers,\r\n** such as the list \"a,b,c\" in the following statements:\r\n**\r\n**      INSERT INTO t(a,b,c) VALUES ...;\r\n**      CREATE INDEX idx ON t(a,b,c);\r\n**      CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;\r\n**\r\n** The IdList.a.idx field is used when the IdList represents the list of\r\n** column names after a table name in an INSERT statement.  In the statement\r\n**\r\n**     INSERT INTO t(a,b,c) ...\r\n**\r\n** If \"a\" is the k-th column of table \"t\", then IdList.a[0].idx==k.\r\n*/\r\nstruct IdList {\r\n  struct IdList_item {\r\n    char *zName;      /* Name of the identifier */\r\n    int idx;          /* Index in some Table.aCol[] of a column named zName */\r\n  } *a;\r\n  int nId;         /* Number of identifiers on the list */\r\n};\r\n\r\n/*\r\n** The bitmask datatype defined below is used for various optimizations.\r\n**\r\n** Changing this from a 64-bit to a 32-bit type limits the number of\r\n** tables in a join to 32 instead of 64.  But it also reduces the size\r\n** of the library by 738 bytes on ix86.\r\n*/\r\ntypedef u64 Bitmask;\r\n\r\n/*\r\n** The number of bits in a Bitmask.  \"BMS\" means \"BitMask Size\".\r\n*/\r\n#define BMS  ((int)(sizeof(Bitmask)*8))\r\n\r\n/*\r\n** The following structure describes the FROM clause of a SELECT statement.\r\n** Each table or subquery in the FROM clause is a separate element of\r\n** the SrcList.a[] array.\r\n**\r\n** With the addition of multiple database support, the following structure\r\n** can also be used to describe a particular table such as the table that\r\n** is modified by an INSERT, DELETE, or UPDATE statement.  In standard SQL,\r\n** such a table must be a simple name: ID.  But in SQLite, the table can\r\n** now be identified by a database name, a dot, then the table name: ID.ID.\r\n**\r\n** The jointype starts out showing the join type between the current table\r\n** and the next table on the list.  The parser builds the list this way.\r\n** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each\r\n** jointype expresses the join between the table and the previous table.\r\n**\r\n** In the colUsed field, the high-order bit (bit 63) is set if the table\r\n** contains more than 63 columns and the 64-th or later column is used.\r\n*/\r\nstruct SrcList {\r\n  i16 nSrc;        /* Number of tables or subqueries in the FROM clause */\r\n  i16 nAlloc;      /* Number of entries allocated in a[] below */\r\n  struct SrcList_item {\r\n    char *zDatabase;  /* Name of database holding this table */\r\n    char *zName;      /* Name of the table */\r\n    char *zAlias;     /* The \"B\" part of a \"A AS B\" phrase.  zName is the \"A\" */\r\n    Table *pTab;      /* An SQL table corresponding to zName */\r\n    Select *pSelect;  /* A SELECT statement used in place of a table name */\r\n    int addrFillSub;  /* Address of subroutine to manifest a subquery */\r\n    int regReturn;    /* Register holding return address of addrFillSub */\r\n    u8 jointype;      /* Type of join between this able and the previous */\r\n    u8 notIndexed;    /* True if there is a NOT INDEXED clause */\r\n    u8 isCorrelated;  /* True if sub-query is correlated */\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n    u8 iSelectId;     /* If pSelect!=0, the id of the sub-select in EQP */\r\n#endif\r\n    int iCursor;      /* The VDBE cursor number used to access this table */\r\n    Expr *pOn;        /* The ON clause of a join */\r\n    IdList *pUsing;   /* The USING clause of a join */\r\n    Bitmask colUsed;  /* Bit N (1<<N) set if column N of pTab is used */\r\n    char *zIndex;     /* Identifier from \"INDEXED BY <zIndex>\" clause */\r\n    Index *pIndex;    /* Index structure corresponding to zIndex, if any */\r\n  } a[1];             /* One entry for each identifier on the list */\r\n};\r\n\r\n/*\r\n** Permitted values of the SrcList.a.jointype field\r\n*/\r\n#define JT_INNER     0x0001    /* Any kind of inner or cross join */\r\n#define JT_CROSS     0x0002    /* Explicit use of the CROSS keyword */\r\n#define JT_NATURAL   0x0004    /* True for a \"natural\" join */\r\n#define JT_LEFT      0x0008    /* Left outer join */\r\n#define JT_RIGHT     0x0010    /* Right outer join */\r\n#define JT_OUTER     0x0020    /* The \"OUTER\" keyword is present */\r\n#define JT_ERROR     0x0040    /* unknown or unsupported join type */\r\n\r\n\r\n/*\r\n** A WherePlan object holds information that describes a lookup\r\n** strategy.\r\n**\r\n** This object is intended to be opaque outside of the where.c module.\r\n** It is included here only so that that compiler will know how big it\r\n** is.  None of the fields in this object should be used outside of\r\n** the where.c module.\r\n**\r\n** Within the union, pIdx is only used when wsFlags&WHERE_INDEXED is true.\r\n** pTerm is only used when wsFlags&WHERE_MULTI_OR is true.  And pVtabIdx\r\n** is only used when wsFlags&WHERE_VIRTUALTABLE is true.  It is never the\r\n** case that more than one of these conditions is true.\r\n*/\r\nstruct WherePlan {\r\n  u32 wsFlags;                   /* WHERE_* flags that describe the strategy */\r\n  u32 nEq;                       /* Number of == constraints */\r\n  double nRow;                   /* Estimated number of rows (for EQP) */\r\n  union {\r\n    Index *pIdx;                   /* Index when WHERE_INDEXED is true */\r\n    struct WhereTerm *pTerm;       /* WHERE clause term for OR-search */\r\n    sqlite3_index_info *pVtabIdx;  /* Virtual table index to use */\r\n  } u;\r\n};\r\n\r\n/*\r\n** For each nested loop in a WHERE clause implementation, the WhereInfo\r\n** structure contains a single instance of this structure.  This structure\r\n** is intended to be private the the where.c module and should not be\r\n** access or modified by other modules.\r\n**\r\n** The pIdxInfo field is used to help pick the best index on a\r\n** virtual table.  The pIdxInfo pointer contains indexing\r\n** information for the i-th table in the FROM clause before reordering.\r\n** All the pIdxInfo pointers are freed by whereInfoFree() in where.c.\r\n** All other information in the i-th WhereLevel object for the i-th table\r\n** after FROM clause ordering.\r\n*/\r\nstruct WhereLevel {\r\n  WherePlan plan;       /* query plan for this element of the FROM clause */\r\n  int iLeftJoin;        /* Memory cell used to implement LEFT OUTER JOIN */\r\n  int iTabCur;          /* The VDBE cursor used to access the table */\r\n  int iIdxCur;          /* The VDBE cursor used to access pIdx */\r\n  int addrBrk;          /* Jump here to break out of the loop */\r\n  int addrNxt;          /* Jump here to start the next IN combination */\r\n  int addrCont;         /* Jump here to continue with the next loop cycle */\r\n  int addrFirst;        /* First instruction of interior of the loop */\r\n  u8 iFrom;             /* Which entry in the FROM clause */\r\n  u8 op, p5;            /* Opcode and P5 of the opcode that ends the loop */\r\n  int p1, p2;           /* Operands of the opcode used to ends the loop */\r\n  union {               /* Information that depends on plan.wsFlags */\r\n    struct {\r\n      int nIn;              /* Number of entries in aInLoop[] */\r\n      struct InLoop {\r\n        int iCur;              /* The VDBE cursor used by this IN operator */\r\n        int addrInTop;         /* Top of the IN loop */\r\n      } *aInLoop;           /* Information about each nested IN operator */\r\n    } in;                 /* Used when plan.wsFlags&WHERE_IN_ABLE */\r\n  } u;\r\n\r\n  /* The following field is really not part of the current level.  But\r\n  ** we need a place to cache virtual table index information for each\r\n  ** virtual table in the FROM clause and the WhereLevel structure is\r\n  ** a convenient place since there is one WhereLevel for each FROM clause\r\n  ** element.\r\n  */\r\n  sqlite3_index_info *pIdxInfo;  /* Index info for n-th source table */\r\n};\r\n\r\n/*\r\n** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin()\r\n** and the WhereInfo.wctrlFlags member.\r\n*/\r\n#define WHERE_ORDERBY_NORMAL   0x0000 /* No-op */\r\n#define WHERE_ORDERBY_MIN      0x0001 /* ORDER BY processing for min() func */\r\n#define WHERE_ORDERBY_MAX      0x0002 /* ORDER BY processing for max() func */\r\n#define WHERE_ONEPASS_DESIRED  0x0004 /* Want to do one-pass UPDATE/DELETE */\r\n#define WHERE_DUPLICATES_OK    0x0008 /* Ok to return a row more than once */\r\n#define WHERE_OMIT_OPEN_CLOSE  0x0010 /* Table cursors are already open */\r\n#define WHERE_FORCE_TABLE      0x0020 /* Do not use an index-only search */\r\n#define WHERE_ONETABLE_ONLY    0x0040 /* Only code the 1st table in pTabList */\r\n#define WHERE_AND_ONLY         0x0080 /* Don't use indices for OR terms */\r\n\r\n/*\r\n** The WHERE clause processing routine has two halves.  The\r\n** first part does the start of the WHERE loop and the second\r\n** half does the tail of the WHERE loop.  An instance of\r\n** this structure is returned by the first half and passed\r\n** into the second half to give some continuity.\r\n*/\r\nstruct WhereInfo {\r\n  Parse *pParse;       /* Parsing and code generating context */\r\n  u16 wctrlFlags;      /* Flags originally passed to sqlite3WhereBegin() */\r\n  u8 okOnePass;        /* Ok to use one-pass algorithm for UPDATE or DELETE */\r\n  u8 untestedTerms;    /* Not all WHERE terms resolved by outer loop */\r\n  u8 eDistinct;\r\n  SrcList *pTabList;             /* List of tables in the join */\r\n  int iTop;                      /* The very beginning of the WHERE loop */\r\n  int iContinue;                 /* Jump here to continue with next record */\r\n  int iBreak;                    /* Jump here to break out of the loop */\r\n  int nLevel;                    /* Number of nested loop */\r\n  struct WhereClause *pWC;       /* Decomposition of the WHERE clause */\r\n  double savedNQueryLoop;        /* pParse->nQueryLoop outside the WHERE loop */\r\n  double nRowOut;                /* Estimated number of output rows */\r\n  WhereLevel a[1];               /* Information about each nest loop in WHERE */\r\n};\r\n\r\n#define WHERE_DISTINCT_UNIQUE 1\r\n#define WHERE_DISTINCT_ORDERED 2\r\n\r\n/*\r\n** A NameContext defines a context in which to resolve table and column\r\n** names.  The context consists of a list of tables (the pSrcList) field and\r\n** a list of named expression (pEList).  The named expression list may\r\n** be NULL.  The pSrc corresponds to the FROM clause of a SELECT or\r\n** to the table being operated on by INSERT, UPDATE, or DELETE.  The\r\n** pEList corresponds to the result set of a SELECT and is NULL for\r\n** other statements.\r\n**\r\n** NameContexts can be nested.  When resolving names, the inner-most \r\n** context is searched first.  If no match is found, the next outer\r\n** context is checked.  If there is still no match, the next context\r\n** is checked.  This process continues until either a match is found\r\n** or all contexts are check.  When a match is found, the nRef member of\r\n** the context containing the match is incremented. \r\n**\r\n** Each subquery gets a new NameContext.  The pNext field points to the\r\n** NameContext in the parent query.  Thus the process of scanning the\r\n** NameContext list corresponds to searching through successively outer\r\n** subqueries looking for a match.\r\n*/\r\nstruct NameContext {\r\n  Parse *pParse;       /* The parser */\r\n  SrcList *pSrcList;   /* One or more tables used to resolve names */\r\n  ExprList *pEList;    /* Optional list of named expressions */\r\n  int nRef;            /* Number of names resolved by this context */\r\n  int nErr;            /* Number of errors encountered while resolving names */\r\n  u8 allowAgg;         /* Aggregate functions allowed here */\r\n  u8 hasAgg;           /* True if aggregates are seen */\r\n  u8 isCheck;          /* True if resolving names in a CHECK constraint */\r\n  int nDepth;          /* Depth of subquery recursion. 1 for no recursion */\r\n  AggInfo *pAggInfo;   /* Information about aggregates at this level */\r\n  NameContext *pNext;  /* Next outer name context.  NULL for outermost */\r\n};\r\n\r\n/*\r\n** An instance of the following structure contains all information\r\n** needed to generate code for a single SELECT statement.\r\n**\r\n** nLimit is set to -1 if there is no LIMIT clause.  nOffset is set to 0.\r\n** If there is a LIMIT clause, the parser sets nLimit to the value of the\r\n** limit and nOffset to the value of the offset (or 0 if there is not\r\n** offset).  But later on, nLimit and nOffset become the memory locations\r\n** in the VDBE that record the limit and offset counters.\r\n**\r\n** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes.\r\n** These addresses must be stored so that we can go back and fill in\r\n** the P4_KEYINFO and P2 parameters later.  Neither the KeyInfo nor\r\n** the number of columns in P2 can be computed at the same time\r\n** as the OP_OpenEphm instruction is coded because not\r\n** enough information about the compound query is known at that point.\r\n** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences\r\n** for the result set.  The KeyInfo for addrOpenTran[2] contains collating\r\n** sequences for the ORDER BY clause.\r\n*/\r\nstruct Select {\r\n  ExprList *pEList;      /* The fields of the result */\r\n  u8 op;                 /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */\r\n  char affinity;         /* MakeRecord with this affinity for SRT_Set */\r\n  u16 selFlags;          /* Various SF_* values */\r\n  int iLimit, iOffset;   /* Memory registers holding LIMIT & OFFSET counters */\r\n  int addrOpenEphm[3];   /* OP_OpenEphem opcodes related to this select */\r\n  double nSelectRow;     /* Estimated number of result rows */\r\n  SrcList *pSrc;         /* The FROM clause */\r\n  Expr *pWhere;          /* The WHERE clause */\r\n  ExprList *pGroupBy;    /* The GROUP BY clause */\r\n  Expr *pHaving;         /* The HAVING clause */\r\n  ExprList *pOrderBy;    /* The ORDER BY clause */\r\n  Select *pPrior;        /* Prior select in a compound select statement */\r\n  Select *pNext;         /* Next select to the left in a compound */\r\n  Select *pRightmost;    /* Right-most select in a compound select statement */\r\n  Expr *pLimit;          /* LIMIT expression. NULL means not used. */\r\n  Expr *pOffset;         /* OFFSET expression. NULL means not used. */\r\n};\r\n\r\n/*\r\n** Allowed values for Select.selFlags.  The \"SF\" prefix stands for\r\n** \"Select Flag\".\r\n*/\r\n#define SF_Distinct        0x01  /* Output should be DISTINCT */\r\n#define SF_Resolved        0x02  /* Identifiers have been resolved */\r\n#define SF_Aggregate       0x04  /* Contains aggregate functions */\r\n#define SF_UsesEphemeral   0x08  /* Uses the OpenEphemeral opcode */\r\n#define SF_Expanded        0x10  /* sqlite3SelectExpand() called on this */\r\n#define SF_HasTypeInfo     0x20  /* FROM subqueries have Table metadata */\r\n#define SF_UseSorter       0x40  /* Sort using a sorter */\r\n#define SF_Values          0x80  /* Synthesized from VALUES clause */\r\n\r\n\r\n/*\r\n** The results of a select can be distributed in several ways.  The\r\n** \"SRT\" prefix means \"SELECT Result Type\".\r\n*/\r\n#define SRT_Union        1  /* Store result as keys in an index */\r\n#define SRT_Except       2  /* Remove result from a UNION index */\r\n#define SRT_Exists       3  /* Store 1 if the result is not empty */\r\n#define SRT_Discard      4  /* Do not save the results anywhere */\r\n\r\n/* The ORDER BY clause is ignored for all of the above */\r\n#define IgnorableOrderby(X) ((X->eDest)<=SRT_Discard)\r\n\r\n#define SRT_Output       5  /* Output each row of result */\r\n#define SRT_Mem          6  /* Store result in a memory cell */\r\n#define SRT_Set          7  /* Store results as keys in an index */\r\n#define SRT_Table        8  /* Store result as data with an automatic rowid */\r\n#define SRT_EphemTab     9  /* Create transient tab and store like SRT_Table */\r\n#define SRT_Coroutine   10  /* Generate a single row of result */\r\n\r\n/*\r\n** A structure used to customize the behavior of sqlite3Select(). See\r\n** comments above sqlite3Select() for details.\r\n*/\r\ntypedef struct SelectDest SelectDest;\r\nstruct SelectDest {\r\n  u8 eDest;         /* How to dispose of the results */\r\n  u8 affinity;      /* Affinity used when eDest==SRT_Set */\r\n  int iParm;        /* A parameter used by the eDest disposal method */\r\n  int iMem;         /* Base register where results are written */\r\n  int nMem;         /* Number of registers allocated */\r\n};\r\n\r\n/*\r\n** During code generation of statements that do inserts into AUTOINCREMENT \r\n** tables, the following information is attached to the Table.u.autoInc.p\r\n** pointer of each autoincrement table to record some side information that\r\n** the code generator needs.  We have to keep per-table autoincrement\r\n** information in case inserts are down within triggers.  Triggers do not\r\n** normally coordinate their activities, but we do need to coordinate the\r\n** loading and saving of autoincrement information.\r\n*/\r\nstruct AutoincInfo {\r\n  AutoincInfo *pNext;   /* Next info block in a list of them all */\r\n  Table *pTab;          /* Table this info block refers to */\r\n  int iDb;              /* Index in sqlite3.aDb[] of database holding pTab */\r\n  int regCtr;           /* Memory register holding the rowid counter */\r\n};\r\n\r\n/*\r\n** Size of the column cache\r\n*/\r\n#ifndef SQLITE_N_COLCACHE\r\n# define SQLITE_N_COLCACHE 10\r\n#endif\r\n\r\n/*\r\n** At least one instance of the following structure is created for each \r\n** trigger that may be fired while parsing an INSERT, UPDATE or DELETE\r\n** statement. All such objects are stored in the linked list headed at\r\n** Parse.pTriggerPrg and deleted once statement compilation has been\r\n** completed.\r\n**\r\n** A Vdbe sub-program that implements the body and WHEN clause of trigger\r\n** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of\r\n** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable.\r\n** The Parse.pTriggerPrg list never contains two entries with the same\r\n** values for both pTrigger and orconf.\r\n**\r\n** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns\r\n** accessed (or set to 0 for triggers fired as a result of INSERT \r\n** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to\r\n** a mask of new.* columns used by the program.\r\n*/\r\nstruct TriggerPrg {\r\n  Trigger *pTrigger;      /* Trigger this program was coded from */\r\n  TriggerPrg *pNext;      /* Next entry in Parse.pTriggerPrg list */\r\n  SubProgram *pProgram;   /* Program implementing pTrigger/orconf */\r\n  int orconf;             /* Default ON CONFLICT policy */\r\n  u32 aColmask[2];        /* Masks of old.*, new.* columns accessed */\r\n};\r\n\r\n/*\r\n** The yDbMask datatype for the bitmask of all attached databases.\r\n*/\r\n#if SQLITE_MAX_ATTACHED>30\r\n  typedef sqlite3_uint64 yDbMask;\r\n#else\r\n  typedef unsigned int yDbMask;\r\n#endif\r\n\r\n/*\r\n** An SQL parser context.  A copy of this structure is passed through\r\n** the parser and down into all the parser action routine in order to\r\n** carry around information that is global to the entire parse.\r\n**\r\n** The structure is divided into two parts.  When the parser and code\r\n** generate call themselves recursively, the first part of the structure\r\n** is constant but the second part is reset at the beginning and end of\r\n** each recursion.\r\n**\r\n** The nTableLock and aTableLock variables are only used if the shared-cache \r\n** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are\r\n** used to store the set of table-locks required by the statement being\r\n** compiled. Function sqlite3TableLock() is used to add entries to the\r\n** list.\r\n*/\r\nstruct Parse {\r\n  sqlite3 *db;         /* The main database structure */\r\n  char *zErrMsg;       /* An error message */\r\n  Vdbe *pVdbe;         /* An engine for executing database bytecode */\r\n  int rc;              /* Return code from execution */\r\n  u8 colNamesSet;      /* TRUE after OP_ColumnName has been issued to pVdbe */\r\n  u8 checkSchema;      /* Causes schema cookie check after an error */\r\n  u8 nested;           /* Number of nested calls to the parser/code generator */\r\n  u8 nTempReg;         /* Number of temporary registers in aTempReg[] */\r\n  u8 nTempInUse;       /* Number of aTempReg[] currently checked out */\r\n  u8 nColCache;        /* Number of entries in aColCache[] */\r\n  u8 iColCache;        /* Next entry in aColCache[] to replace */\r\n  u8 isMultiWrite;     /* True if statement may modify/insert multiple rows */\r\n  u8 mayAbort;         /* True if statement may throw an ABORT exception */\r\n  int aTempReg[8];     /* Holding area for temporary registers */\r\n  int nRangeReg;       /* Size of the temporary register block */\r\n  int iRangeReg;       /* First register in temporary register block */\r\n  int nErr;            /* Number of errors seen */\r\n  int nTab;            /* Number of previously allocated VDBE cursors */\r\n  int nMem;            /* Number of memory cells used so far */\r\n  int nSet;            /* Number of sets used so far */\r\n  int nOnce;           /* Number of OP_Once instructions so far */\r\n  int ckBase;          /* Base register of data during check constraints */\r\n  int iCacheLevel;     /* ColCache valid when aColCache[].iLevel<=iCacheLevel */\r\n  int iCacheCnt;       /* Counter used to generate aColCache[].lru values */\r\n  struct yColCache {\r\n    int iTable;           /* Table cursor number */\r\n    int iColumn;          /* Table column number */\r\n    u8 tempReg;           /* iReg is a temp register that needs to be freed */\r\n    int iLevel;           /* Nesting level */\r\n    int iReg;             /* Reg with value of this column. 0 means none. */\r\n    int lru;              /* Least recently used entry has the smallest value */\r\n  } aColCache[SQLITE_N_COLCACHE];  /* One for each column cache entry */\r\n  yDbMask writeMask;   /* Start a write transaction on these databases */\r\n  yDbMask cookieMask;  /* Bitmask of schema verified databases */\r\n  int cookieGoto;      /* Address of OP_Goto to cookie verifier subroutine */\r\n  int cookieValue[SQLITE_MAX_ATTACHED+2];  /* Values of cookies to verify */\r\n  int regRowid;        /* Register holding rowid of CREATE TABLE entry */\r\n  int regRoot;         /* Register holding root page number for new objects */\r\n  int nMaxArg;         /* Max args passed to user function by sub-program */\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  int nTableLock;        /* Number of locks in aTableLock */\r\n  TableLock *aTableLock; /* Required table locks for shared-cache mode */\r\n#endif\r\n  AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */\r\n\r\n  /* Information used while coding trigger programs. */\r\n  Parse *pToplevel;    /* Parse structure for main program (or NULL) */\r\n  Table *pTriggerTab;  /* Table triggers are being coded for */\r\n  double nQueryLoop;   /* Estimated number of iterations of a query */\r\n  u32 oldmask;         /* Mask of old.* columns referenced */\r\n  u32 newmask;         /* Mask of new.* columns referenced */\r\n  u8 eTriggerOp;       /* TK_UPDATE, TK_INSERT or TK_DELETE */\r\n  u8 eOrconf;          /* Default ON CONFLICT policy for trigger steps */\r\n  u8 disableTriggers;  /* True to disable triggers */\r\n\r\n  /* Above is constant between recursions.  Below is reset before and after\r\n  ** each recursion */\r\n\r\n  int nVar;                 /* Number of '?' variables seen in the SQL so far */\r\n  int nzVar;                /* Number of available slots in azVar[] */\r\n  u8 explain;               /* True if the EXPLAIN flag is found on the query */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  u8 declareVtab;           /* True if inside sqlite3_declare_vtab() */\r\n  int nVtabLock;            /* Number of virtual tables to lock */\r\n#endif\r\n  int nAlias;               /* Number of aliased result set columns */\r\n  int nHeight;              /* Expression tree height of current sub-select */\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  int iSelectId;            /* ID of current select for EXPLAIN output */\r\n  int iNextSelectId;        /* Next available select ID for EXPLAIN output */\r\n#endif\r\n  char **azVar;             /* Pointers to names of parameters */\r\n  Vdbe *pReprepare;         /* VM being reprepared (sqlite3Reprepare()) */\r\n  int *aAlias;              /* Register used to hold aliased result */\r\n  const char *zTail;        /* All SQL text past the last semicolon parsed */\r\n  Table *pNewTable;         /* A table being constructed by CREATE TABLE */\r\n  Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */\r\n  const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */\r\n  Token sNameToken;         /* Token with unqualified schema object name */\r\n  Token sLastToken;         /* The last token parsed */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  Token sArg;               /* Complete text of a module argument */\r\n  Table **apVtabLock;       /* Pointer to virtual tables needing locking */\r\n#endif\r\n  Table *pZombieTab;        /* List of Table objects to delete after code gen */\r\n  TriggerPrg *pTriggerPrg;  /* Linked list of coded triggers */\r\n};\r\n\r\n/*\r\n** Return true if currently inside an sqlite3_declare_vtab() call.\r\n*/\r\n#ifdef SQLITE_OMIT_VIRTUALTABLE\r\n  #define IN_DECLARE_VTAB 0\r\n#else\r\n  #define IN_DECLARE_VTAB (pParse->declareVtab)\r\n#endif\r\n\r\n/*\r\n** An instance of the following structure can be declared on a stack and used\r\n** to save the Parse.zAuthContext value so that it can be restored later.\r\n*/\r\nstruct AuthContext {\r\n  const char *zAuthContext;   /* Put saved Parse.zAuthContext here */\r\n  Parse *pParse;              /* The Parse structure */\r\n};\r\n\r\n/*\r\n** Bitfield flags for P5 value in OP_Insert and OP_Delete\r\n*/\r\n#define OPFLAG_NCHANGE       0x01    /* Set to update db->nChange */\r\n#define OPFLAG_LASTROWID     0x02    /* Set to update db->lastRowid */\r\n#define OPFLAG_ISUPDATE      0x04    /* This OP_Insert is an sql UPDATE */\r\n#define OPFLAG_APPEND        0x08    /* This is likely to be an append */\r\n#define OPFLAG_USESEEKRESULT 0x10    /* Try to avoid a seek in BtreeInsert() */\r\n#define OPFLAG_CLEARCACHE    0x20    /* Clear pseudo-table cache in OP_Column */\r\n\r\n/*\r\n * Each trigger present in the database schema is stored as an instance of\r\n * struct Trigger. \r\n *\r\n * Pointers to instances of struct Trigger are stored in two ways.\r\n * 1. In the \"trigHash\" hash table (part of the sqlite3* that represents the \r\n *    database). This allows Trigger structures to be retrieved by name.\r\n * 2. All triggers associated with a single table form a linked list, using the\r\n *    pNext member of struct Trigger. A pointer to the first element of the\r\n *    linked list is stored as the \"pTrigger\" member of the associated\r\n *    struct Table.\r\n *\r\n * The \"step_list\" member points to the first element of a linked list\r\n * containing the SQL statements specified as the trigger program.\r\n */\r\nstruct Trigger {\r\n  char *zName;            /* The name of the trigger                        */\r\n  char *table;            /* The table or view to which the trigger applies */\r\n  u8 op;                  /* One of TK_DELETE, TK_UPDATE, TK_INSERT         */\r\n  u8 tr_tm;               /* One of TRIGGER_BEFORE, TRIGGER_AFTER */\r\n  Expr *pWhen;            /* The WHEN clause of the expression (may be NULL) */\r\n  IdList *pColumns;       /* If this is an UPDATE OF <column-list> trigger,\r\n                             the <column-list> is stored here */\r\n  Schema *pSchema;        /* Schema containing the trigger */\r\n  Schema *pTabSchema;     /* Schema containing the table */\r\n  TriggerStep *step_list; /* Link list of trigger program steps             */\r\n  Trigger *pNext;         /* Next trigger associated with the table */\r\n};\r\n\r\n/*\r\n** A trigger is either a BEFORE or an AFTER trigger.  The following constants\r\n** determine which. \r\n**\r\n** If there are multiple triggers, you might of some BEFORE and some AFTER.\r\n** In that cases, the constants below can be ORed together.\r\n*/\r\n#define TRIGGER_BEFORE  1\r\n#define TRIGGER_AFTER   2\r\n\r\n/*\r\n * An instance of struct TriggerStep is used to store a single SQL statement\r\n * that is a part of a trigger-program. \r\n *\r\n * Instances of struct TriggerStep are stored in a singly linked list (linked\r\n * using the \"pNext\" member) referenced by the \"step_list\" member of the \r\n * associated struct Trigger instance. The first element of the linked list is\r\n * the first step of the trigger-program.\r\n * \r\n * The \"op\" member indicates whether this is a \"DELETE\", \"INSERT\", \"UPDATE\" or\r\n * \"SELECT\" statement. The meanings of the other members is determined by the \r\n * value of \"op\" as follows:\r\n *\r\n * (op == TK_INSERT)\r\n * orconf    -> stores the ON CONFLICT algorithm\r\n * pSelect   -> If this is an INSERT INTO ... SELECT ... statement, then\r\n *              this stores a pointer to the SELECT statement. Otherwise NULL.\r\n * target    -> A token holding the quoted name of the table to insert into.\r\n * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then\r\n *              this stores values to be inserted. Otherwise NULL.\r\n * pIdList   -> If this is an INSERT INTO ... (<column-names>) VALUES ... \r\n *              statement, then this stores the column-names to be\r\n *              inserted into.\r\n *\r\n * (op == TK_DELETE)\r\n * target    -> A token holding the quoted name of the table to delete from.\r\n * pWhere    -> The WHERE clause of the DELETE statement if one is specified.\r\n *              Otherwise NULL.\r\n * \r\n * (op == TK_UPDATE)\r\n * target    -> A token holding the quoted name of the table to update rows of.\r\n * pWhere    -> The WHERE clause of the UPDATE statement if one is specified.\r\n *              Otherwise NULL.\r\n * pExprList -> A list of the columns to update and the expressions to update\r\n *              them to. See sqlite3Update() documentation of \"pChanges\"\r\n *              argument.\r\n * \r\n */\r\nstruct TriggerStep {\r\n  u8 op;               /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */\r\n  u8 orconf;           /* OE_Rollback etc. */\r\n  Trigger *pTrig;      /* The trigger that this step is a part of */\r\n  Select *pSelect;     /* SELECT statment or RHS of INSERT INTO .. SELECT ... */\r\n  Token target;        /* Target table for DELETE, UPDATE, INSERT */\r\n  Expr *pWhere;        /* The WHERE clause for DELETE or UPDATE steps */\r\n  ExprList *pExprList; /* SET clause for UPDATE.  VALUES clause for INSERT */\r\n  IdList *pIdList;     /* Column names for INSERT */\r\n  TriggerStep *pNext;  /* Next in the link-list */\r\n  TriggerStep *pLast;  /* Last element in link-list. Valid for 1st elem only */\r\n};\r\n\r\n/*\r\n** The following structure contains information used by the sqliteFix...\r\n** routines as they walk the parse tree to make database references\r\n** explicit.  \r\n*/\r\ntypedef struct DbFixer DbFixer;\r\nstruct DbFixer {\r\n  Parse *pParse;      /* The parsing context.  Error messages written here */\r\n  const char *zDb;    /* Make sure all objects are contained in this database */\r\n  const char *zType;  /* Type of the container - used for error messages */\r\n  const Token *pName; /* Name of the container - used for error messages */\r\n};\r\n\r\n/*\r\n** An objected used to accumulate the text of a string where we\r\n** do not necessarily know how big the string will be in the end.\r\n*/\r\nstruct StrAccum {\r\n  sqlite3 *db;         /* Optional database for lookaside.  Can be NULL */\r\n  char *zBase;         /* A base allocation.  Not from malloc. */\r\n  char *zText;         /* The string collected so far */\r\n  int  nChar;          /* Length of the string so far */\r\n  int  nAlloc;         /* Amount of space allocated in zText */\r\n  int  mxAlloc;        /* Maximum allowed string length */\r\n  u8   mallocFailed;   /* Becomes true if any memory allocation fails */\r\n  u8   useMalloc;      /* 0: none,  1: sqlite3DbMalloc,  2: sqlite3_malloc */\r\n  u8   tooBig;         /* Becomes true if string size exceeds limits */\r\n};\r\n\r\n/*\r\n** A pointer to this structure is used to communicate information\r\n** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.\r\n*/\r\ntypedef struct {\r\n  sqlite3 *db;        /* The database being initialized */\r\n  char **pzErrMsg;    /* Error message stored here */\r\n  int iDb;            /* 0 for main database.  1 for TEMP, 2.. for ATTACHed */\r\n  int rc;             /* Result code stored here */\r\n} InitData;\r\n\r\n/*\r\n** Structure containing global configuration data for the SQLite library.\r\n**\r\n** This structure also contains some state information.\r\n*/\r\nstruct Sqlite3Config {\r\n  int bMemstat;                     /* True to enable memory status */\r\n  int bCoreMutex;                   /* True to enable core mutexing */\r\n  int bFullMutex;                   /* True to enable full mutexing */\r\n  int bOpenUri;                     /* True to interpret filenames as URIs */\r\n  int mxStrlen;                     /* Maximum string length */\r\n  int szLookaside;                  /* Default lookaside buffer size */\r\n  int nLookaside;                   /* Default lookaside buffer count */\r\n  sqlite3_mem_methods m;            /* Low-level memory allocation interface */\r\n  sqlite3_mutex_methods mutex;      /* Low-level mutex interface */\r\n  sqlite3_pcache_methods2 pcache2;  /* Low-level page-cache interface */\r\n  void *pHeap;                      /* Heap storage space */\r\n  int nHeap;                        /* Size of pHeap[] */\r\n  int mnReq, mxReq;                 /* Min and max heap requests sizes */\r\n  void *pScratch;                   /* Scratch memory */\r\n  int szScratch;                    /* Size of each scratch buffer */\r\n  int nScratch;                     /* Number of scratch buffers */\r\n  void *pPage;                      /* Page cache memory */\r\n  int szPage;                       /* Size of each page in pPage[] */\r\n  int nPage;                        /* Number of pages in pPage[] */\r\n  int mxParserStack;                /* maximum depth of the parser stack */\r\n  int sharedCacheEnabled;           /* true if shared-cache mode enabled */\r\n  /* The above might be initialized to non-zero.  The following need to always\r\n  ** initially be zero, however. */\r\n  int isInit;                       /* True after initialization has finished */\r\n  int inProgress;                   /* True while initialization in progress */\r\n  int isMutexInit;                  /* True after mutexes are initialized */\r\n  int isMallocInit;                 /* True after malloc is initialized */\r\n  int isPCacheInit;                 /* True after malloc is initialized */\r\n  sqlite3_mutex *pInitMutex;        /* Mutex used by sqlite3_initialize() */\r\n  int nRefInitMutex;                /* Number of users of pInitMutex */\r\n  void (*xLog)(void*,int,const char*); /* Function for logging */\r\n  void *pLogArg;                       /* First argument to xLog() */\r\n  int bLocaltimeFault;              /* True to fail localtime() calls */\r\n};\r\n\r\n/*\r\n** Context pointer passed down through the tree-walk.\r\n*/\r\nstruct Walker {\r\n  int (*xExprCallback)(Walker*, Expr*);     /* Callback for expressions */\r\n  int (*xSelectCallback)(Walker*,Select*);  /* Callback for SELECTs */\r\n  Parse *pParse;                            /* Parser context.  */\r\n  union {                                   /* Extra data for callback */\r\n    NameContext *pNC;                          /* Naming context */\r\n    int i;                                     /* Integer value */\r\n  } u;\r\n};\r\n\r\n/* Forward declarations */\r\nSQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);\r\nSQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*);\r\nSQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*);\r\nSQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*);\r\nSQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);\r\n\r\n/*\r\n** Return code from the parse-tree walking primitives and their\r\n** callbacks.\r\n*/\r\n#define WRC_Continue    0   /* Continue down into children */\r\n#define WRC_Prune       1   /* Omit children but continue walking siblings */\r\n#define WRC_Abort       2   /* Abandon the tree walk */\r\n\r\n/*\r\n** Assuming zIn points to the first byte of a UTF-8 character,\r\n** advance zIn to point to the first byte of the next UTF-8 character.\r\n*/\r\n#define SQLITE_SKIP_UTF8(zIn) {                        \\\r\n  if( (*(zIn++))>=0xc0 ){                              \\\r\n    while( (*zIn & 0xc0)==0x80 ){ zIn++; }             \\\r\n  }                                                    \\\r\n}\r\n\r\n/*\r\n** The SQLITE_*_BKPT macros are substitutes for the error codes with\r\n** the same name but without the _BKPT suffix.  These macros invoke\r\n** routines that report the line-number on which the error originated\r\n** using sqlite3_log().  The routines also provide a convenient place\r\n** to set a debugger breakpoint.\r\n*/\r\nSQLITE_PRIVATE int sqlite3CorruptError(int);\r\nSQLITE_PRIVATE int sqlite3MisuseError(int);\r\nSQLITE_PRIVATE int sqlite3CantopenError(int);\r\n#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__)\r\n#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__)\r\n#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__)\r\n\r\n\r\n/*\r\n** FTS4 is really an extension for FTS3.  It is enabled using the\r\n** SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also all\r\n** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.\r\n*/\r\n#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)\r\n# define SQLITE_ENABLE_FTS3\r\n#endif\r\n\r\n/*\r\n** The ctype.h header is needed for non-ASCII systems.  It is also\r\n** needed by FTS3 when FTS3 is included in the amalgamation.\r\n*/\r\n#if !defined(SQLITE_ASCII) || \\\r\n    (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION))\r\n# include <ctype.h>\r\n#endif\r\n\r\n/*\r\n** The following macros mimic the standard library functions toupper(),\r\n** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The\r\n** sqlite versions only work for ASCII characters, regardless of locale.\r\n*/\r\n#ifdef SQLITE_ASCII\r\n# define sqlite3Toupper(x)  ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20))\r\n# define sqlite3Isspace(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x01)\r\n# define sqlite3Isalnum(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x06)\r\n# define sqlite3Isalpha(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x02)\r\n# define sqlite3Isdigit(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x04)\r\n# define sqlite3Isxdigit(x)  (sqlite3CtypeMap[(unsigned char)(x)]&0x08)\r\n# define sqlite3Tolower(x)   (sqlite3UpperToLower[(unsigned char)(x)])\r\n#else\r\n# define sqlite3Toupper(x)   toupper((unsigned char)(x))\r\n# define sqlite3Isspace(x)   isspace((unsigned char)(x))\r\n# define sqlite3Isalnum(x)   isalnum((unsigned char)(x))\r\n# define sqlite3Isalpha(x)   isalpha((unsigned char)(x))\r\n# define sqlite3Isdigit(x)   isdigit((unsigned char)(x))\r\n# define sqlite3Isxdigit(x)  isxdigit((unsigned char)(x))\r\n# define sqlite3Tolower(x)   tolower((unsigned char)(x))\r\n#endif\r\n\r\n/*\r\n** Internal function prototypes\r\n*/\r\n#define sqlite3StrICmp sqlite3_stricmp\r\nSQLITE_PRIVATE int sqlite3Strlen30(const char*);\r\n#define sqlite3StrNICmp sqlite3_strnicmp\r\n\r\nSQLITE_PRIVATE int sqlite3MallocInit(void);\r\nSQLITE_PRIVATE void sqlite3MallocEnd(void);\r\nSQLITE_PRIVATE void *sqlite3Malloc(int);\r\nSQLITE_PRIVATE void *sqlite3MallocZero(int);\r\nSQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3*, int);\r\nSQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3*, int);\r\nSQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3*,const char*);\r\nSQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3*,const char*, int);\r\nSQLITE_PRIVATE void *sqlite3Realloc(void*, int);\r\nSQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *, void *, int);\r\nSQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *, void *, int);\r\nSQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*);\r\nSQLITE_PRIVATE int sqlite3MallocSize(void*);\r\nSQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, void*);\r\nSQLITE_PRIVATE void *sqlite3ScratchMalloc(int);\r\nSQLITE_PRIVATE void sqlite3ScratchFree(void*);\r\nSQLITE_PRIVATE void *sqlite3PageMalloc(int);\r\nSQLITE_PRIVATE void sqlite3PageFree(void*);\r\nSQLITE_PRIVATE void sqlite3MemSetDefault(void);\r\nSQLITE_PRIVATE void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));\r\nSQLITE_PRIVATE int sqlite3HeapNearlyFull(void);\r\n\r\n/*\r\n** On systems with ample stack space and that support alloca(), make\r\n** use of alloca() to obtain space for large automatic objects.  By default,\r\n** obtain space from malloc().\r\n**\r\n** The alloca() routine never returns NULL.  This will cause code paths\r\n** that deal with sqlite3StackAlloc() failures to be unreachable.\r\n*/\r\n#ifdef SQLITE_USE_ALLOCA\r\n# define sqlite3StackAllocRaw(D,N)   alloca(N)\r\n# define sqlite3StackAllocZero(D,N)  memset(alloca(N), 0, N)\r\n# define sqlite3StackFree(D,P)       \r\n#else\r\n# define sqlite3StackAllocRaw(D,N)   sqlite3DbMallocRaw(D,N)\r\n# define sqlite3StackAllocZero(D,N)  sqlite3DbMallocZero(D,N)\r\n# define sqlite3StackFree(D,P)       sqlite3DbFree(D,P)\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_MEMSYS3\r\nSQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);\r\n#endif\r\n#ifdef SQLITE_ENABLE_MEMSYS5\r\nSQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);\r\n#endif\r\n\r\n\r\n#ifndef SQLITE_MUTEX_OMIT\r\nSQLITE_PRIVATE   sqlite3_mutex_methods const *sqlite3DefaultMutex(void);\r\nSQLITE_PRIVATE   sqlite3_mutex_methods const *sqlite3NoopMutex(void);\r\nSQLITE_PRIVATE   sqlite3_mutex *sqlite3MutexAlloc(int);\r\nSQLITE_PRIVATE   int sqlite3MutexInit(void);\r\nSQLITE_PRIVATE   int sqlite3MutexEnd(void);\r\n#endif\r\n\r\nSQLITE_PRIVATE int sqlite3StatusValue(int);\r\nSQLITE_PRIVATE void sqlite3StatusAdd(int, int);\r\nSQLITE_PRIVATE void sqlite3StatusSet(int, int);\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\nSQLITE_PRIVATE   int sqlite3IsNaN(double);\r\n#else\r\n# define sqlite3IsNaN(X)  0\r\n#endif\r\n\r\nSQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, int, const char*, va_list);\r\n#ifndef SQLITE_OMIT_TRACE\r\nSQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, const char*, ...);\r\n#endif\r\nSQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...);\r\nSQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list);\r\nSQLITE_PRIVATE char *sqlite3MAppendf(sqlite3*,char*,const char*,...);\r\n#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)\r\nSQLITE_PRIVATE   void sqlite3DebugPrintf(const char*, ...);\r\n#endif\r\n#if defined(SQLITE_TEST)\r\nSQLITE_PRIVATE   void *sqlite3TestTextToPtr(const char*);\r\n#endif\r\n\r\n/* Output formatting for SQLITE_TESTCTRL_EXPLAIN */\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\nSQLITE_PRIVATE   void sqlite3ExplainBegin(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3ExplainPrintf(Vdbe*, const char*, ...);\r\nSQLITE_PRIVATE   void sqlite3ExplainNL(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3ExplainPush(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3ExplainPop(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3ExplainFinish(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3ExplainSelect(Vdbe*, Select*);\r\nSQLITE_PRIVATE   void sqlite3ExplainExpr(Vdbe*, Expr*);\r\nSQLITE_PRIVATE   void sqlite3ExplainExprList(Vdbe*, ExprList*);\r\nSQLITE_PRIVATE   const char *sqlite3VdbeExplanation(Vdbe*);\r\n#else\r\n# define sqlite3ExplainBegin(X)\r\n# define sqlite3ExplainSelect(A,B)\r\n# define sqlite3ExplainExpr(A,B)\r\n# define sqlite3ExplainExprList(A,B)\r\n# define sqlite3ExplainFinish(X)\r\n# define sqlite3VdbeExplanation(X) 0\r\n#endif\r\n\r\n\r\nSQLITE_PRIVATE void sqlite3SetString(char **, sqlite3*, const char*, ...);\r\nSQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...);\r\nSQLITE_PRIVATE int sqlite3Dequote(char*);\r\nSQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int);\r\nSQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **);\r\nSQLITE_PRIVATE void sqlite3FinishCoding(Parse*);\r\nSQLITE_PRIVATE int sqlite3GetTempReg(Parse*);\r\nSQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);\r\nSQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);\r\nSQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);\r\nSQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);\r\nSQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);\r\nSQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);\r\nSQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);\r\nSQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*);\r\nSQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);\r\nSQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);\r\nSQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*);\r\nSQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);\r\nSQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);\r\nSQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);\r\nSQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*);\r\nSQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*);\r\nSQLITE_PRIVATE int sqlite3Init(sqlite3*, char**);\r\nSQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**);\r\nSQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);\r\nSQLITE_PRIVATE void sqlite3ResetInternalSchema(sqlite3*, int);\r\nSQLITE_PRIVATE void sqlite3BeginParse(Parse*,int);\r\nSQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*);\r\nSQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*);\r\nSQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int);\r\nSQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);\r\nSQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*);\r\nSQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);\r\nSQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*);\r\nSQLITE_PRIVATE void sqlite3AddColumnType(Parse*,Token*);\r\nSQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,ExprSpan*);\r\nSQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);\r\nSQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,Select*);\r\nSQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,\r\n                    sqlite3_vfs**,char**,char **);\r\nSQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*);\r\nSQLITE_PRIVATE int sqlite3CodeOnce(Parse *);\r\n\r\nSQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32);\r\nSQLITE_PRIVATE int sqlite3BitvecTest(Bitvec*, u32);\r\nSQLITE_PRIVATE int sqlite3BitvecSet(Bitvec*, u32);\r\nSQLITE_PRIVATE void sqlite3BitvecClear(Bitvec*, u32, void*);\r\nSQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec*);\r\nSQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec*);\r\nSQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int,int*);\r\n\r\nSQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3*, void*, unsigned int);\r\nSQLITE_PRIVATE void sqlite3RowSetClear(RowSet*);\r\nSQLITE_PRIVATE void sqlite3RowSetInsert(RowSet*, i64);\r\nSQLITE_PRIVATE int sqlite3RowSetTest(RowSet*, u8 iBatch, i64);\r\nSQLITE_PRIVATE int sqlite3RowSetNext(RowSet*, i64*);\r\n\r\nSQLITE_PRIVATE void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int,int);\r\n\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)\r\nSQLITE_PRIVATE   int sqlite3ViewGetColumnNames(Parse*,Table*);\r\n#else\r\n# define sqlite3ViewGetColumnNames(A,B) 0\r\n#endif\r\n\r\nSQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int);\r\nSQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int);\r\nSQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*);\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\nSQLITE_PRIVATE   void sqlite3AutoincrementBegin(Parse *pParse);\r\nSQLITE_PRIVATE   void sqlite3AutoincrementEnd(Parse *pParse);\r\n#else\r\n# define sqlite3AutoincrementBegin(X)\r\n# define sqlite3AutoincrementEnd(X)\r\n#endif\r\nSQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);\r\nSQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);\r\nSQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);\r\nSQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,\r\n                                      Token*, Select*, Expr*, IdList*);\r\nSQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);\r\nSQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);\r\nSQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*);\r\nSQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*);\r\nSQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);\r\nSQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*);\r\nSQLITE_PRIVATE Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,\r\n                        Token*, int, int);\r\nSQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int);\r\nSQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);\r\nSQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,\r\n                         Expr*,ExprList*,int,Expr*,Expr*);\r\nSQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);\r\nSQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);\r\nSQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);\r\nSQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);\r\n#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)\r\nSQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *, char *);\r\n#endif\r\nSQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*);\r\nSQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);\r\nSQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**,ExprList*,u16);\r\nSQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);\r\nSQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprCacheStore(Parse*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprCachePush(Parse*);\r\nSQLITE_PRIVATE void sqlite3ExprCachePop(Parse*, int);\r\nSQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*);\r\nSQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);\r\nSQLITE_PRIVATE int sqlite3ExprCode(Parse*, Expr*, int);\r\nSQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);\r\nSQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);\r\nSQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int);\r\nSQLITE_PRIVATE void sqlite3ExprCodeConstants(Parse*, Expr*);\r\nSQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int);\r\nSQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int);\r\nSQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*);\r\nSQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*);\r\nSQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*);\r\nSQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);\r\nSQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);\r\nSQLITE_PRIVATE void sqlite3Vacuum(Parse*);\r\nSQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*);\r\nSQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);\r\nSQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*);\r\nSQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*);\r\nSQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);\r\nSQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);\r\nSQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);\r\nSQLITE_PRIVATE void sqlite3PrngSaveState(void);\r\nSQLITE_PRIVATE void sqlite3PrngRestoreState(void);\r\nSQLITE_PRIVATE void sqlite3PrngResetState(void);\r\nSQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int);\r\nSQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);\r\nSQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);\r\nSQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);\r\nSQLITE_PRIVATE void sqlite3CommitTransaction(Parse*);\r\nSQLITE_PRIVATE void sqlite3RollbackTransaction(Parse*);\r\nSQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*);\r\nSQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);\r\nSQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);\r\nSQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);\r\nSQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*);\r\nSQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*);\r\nSQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);\r\nSQLITE_PRIVATE void sqlite3ExprCodeIsNullJump(Vdbe*, const Expr*, int, int);\r\nSQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);\r\nSQLITE_PRIVATE int sqlite3IsRowid(const char*);\r\nSQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*, Table*, int, int, int, Trigger *, int);\r\nSQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int*);\r\nSQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int,\r\n                                     int*,int,int,int,int,int*);\r\nSQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int);\r\nSQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, int);\r\nSQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse*, int, int);\r\nSQLITE_PRIVATE void sqlite3MultiWrite(Parse*);\r\nSQLITE_PRIVATE void sqlite3MayAbort(Parse*);\r\nSQLITE_PRIVATE void sqlite3HaltConstraint(Parse*, int, char*, int);\r\nSQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,Expr*,int);\r\nSQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int);\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int);\r\nSQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,IdList*);\r\nSQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,Select*,int);\r\nSQLITE_PRIVATE void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*);\r\nSQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);\r\nSQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(sqlite3*);\r\nSQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void);\r\nSQLITE_PRIVATE void sqlite3RegisterGlobalFunctions(void);\r\nSQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*);\r\nSQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*);\r\nSQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int);\r\n\r\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\r\nSQLITE_PRIVATE void sqlite3MaterializeView(Parse*, Table*, Expr*, int);\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\nSQLITE_PRIVATE   void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,\r\n                           Expr*,int, int);\r\nSQLITE_PRIVATE   void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);\r\nSQLITE_PRIVATE   void sqlite3DropTrigger(Parse*, SrcList*, int);\r\nSQLITE_PRIVATE   void sqlite3DropTriggerPtr(Parse*, Trigger*);\r\nSQLITE_PRIVATE   Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask);\r\nSQLITE_PRIVATE   Trigger *sqlite3TriggerList(Parse *, Table *);\r\nSQLITE_PRIVATE   void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *,\r\n                            int, int, int);\r\nSQLITE_PRIVATE   void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int);\r\n  void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);\r\nSQLITE_PRIVATE   void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);\r\nSQLITE_PRIVATE   TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*);\r\nSQLITE_PRIVATE   TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,\r\n                                        ExprList*,Select*,u8);\r\nSQLITE_PRIVATE   TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8);\r\nSQLITE_PRIVATE   TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*);\r\nSQLITE_PRIVATE   void sqlite3DeleteTrigger(sqlite3*, Trigger*);\r\nSQLITE_PRIVATE   void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);\r\nSQLITE_PRIVATE   u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);\r\n# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))\r\n#else\r\n# define sqlite3TriggersExist(B,C,D,E,F) 0\r\n# define sqlite3DeleteTrigger(A,B)\r\n# define sqlite3DropTriggerPtr(A,B)\r\n# define sqlite3UnlinkAndDeleteTrigger(A,B,C)\r\n# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I)\r\n# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)\r\n# define sqlite3TriggerList(X, Y) 0\r\n# define sqlite3ParseToplevel(p) p\r\n# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0\r\n#endif\r\n\r\nSQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);\r\nSQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);\r\nSQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\nSQLITE_PRIVATE   void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);\r\nSQLITE_PRIVATE   int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);\r\nSQLITE_PRIVATE   void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);\r\nSQLITE_PRIVATE   void sqlite3AuthContextPop(AuthContext*);\r\nSQLITE_PRIVATE   int sqlite3AuthReadCol(Parse*, const char *, const char *, int);\r\n#else\r\n# define sqlite3AuthRead(a,b,c,d)\r\n# define sqlite3AuthCheck(a,b,c,d,e)    SQLITE_OK\r\n# define sqlite3AuthContextPush(a,b,c)\r\n# define sqlite3AuthContextPop(a)  ((void)(a))\r\n#endif\r\nSQLITE_PRIVATE void sqlite3Attach(Parse*, Expr*, Expr*, Expr*);\r\nSQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*);\r\nSQLITE_PRIVATE int sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);\r\nSQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*);\r\nSQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*);\r\nSQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*);\r\nSQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);\r\nSQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);\r\nSQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);\r\nSQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);\r\nSQLITE_PRIVATE int sqlite3Atoi(const char*);\r\nSQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);\r\nSQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);\r\nSQLITE_PRIVATE u32 sqlite3Utf8Read(const u8*, const u8**);\r\n\r\n/*\r\n** Routines to read and write variable-length integers.  These used to\r\n** be defined locally, but now we use the varint routines in the util.c\r\n** file.  Code should use the MACRO forms below, as the Varint32 versions\r\n** are coded to assume the single byte case is already handled (which \r\n** the MACRO form does).\r\n*/\r\nSQLITE_PRIVATE int sqlite3PutVarint(unsigned char*, u64);\r\nSQLITE_PRIVATE int sqlite3PutVarint32(unsigned char*, u32);\r\nSQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *, u64 *);\r\nSQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *, u32 *);\r\nSQLITE_PRIVATE int sqlite3VarintLen(u64 v);\r\n\r\n/*\r\n** The header of a record consists of a sequence variable-length integers.\r\n** These integers are almost always small and are encoded as a single byte.\r\n** The following macros take advantage this fact to provide a fast encode\r\n** and decode of the integers in a record header.  It is faster for the common\r\n** case where the integer is a single byte.  It is a little slower when the\r\n** integer is two or more bytes.  But overall it is faster.\r\n**\r\n** The following expressions are equivalent:\r\n**\r\n**     x = sqlite3GetVarint32( A, &B );\r\n**     x = sqlite3PutVarint32( A, B );\r\n**\r\n**     x = getVarint32( A, B );\r\n**     x = putVarint32( A, B );\r\n**\r\n*/\r\n#define getVarint32(A,B)  (u8)((*(A)<(u8)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), (u32 *)&(B)))\r\n#define putVarint32(A,B)  (u8)(((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))\r\n#define getVarint    sqlite3GetVarint\r\n#define putVarint    sqlite3PutVarint\r\n\r\n\r\nSQLITE_PRIVATE const char *sqlite3IndexAffinityStr(Vdbe *, Index *);\r\nSQLITE_PRIVATE void sqlite3TableAffinityStr(Vdbe *, Table *);\r\nSQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2);\r\nSQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);\r\nSQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr);\r\nSQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);\r\nSQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...);\r\nSQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);\r\nSQLITE_PRIVATE u8 sqlite3HexToInt(int h);\r\nSQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);\r\nSQLITE_PRIVATE const char *sqlite3ErrStr(int);\r\nSQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);\r\nSQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);\r\nSQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);\r\nSQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);\r\nSQLITE_PRIVATE Expr *sqlite3ExprSetColl(Expr*, CollSeq*);\r\nSQLITE_PRIVATE Expr *sqlite3ExprSetCollByToken(Parse *pParse, Expr*, Token*);\r\nSQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *, CollSeq *);\r\nSQLITE_PRIVATE int sqlite3CheckObjectName(Parse *, const char *);\r\nSQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *, int);\r\nSQLITE_PRIVATE int sqlite3AddInt64(i64*,i64);\r\nSQLITE_PRIVATE int sqlite3SubInt64(i64*,i64);\r\nSQLITE_PRIVATE int sqlite3MulInt64(i64*,i64);\r\nSQLITE_PRIVATE int sqlite3AbsInt32(int);\r\n#ifdef SQLITE_ENABLE_8_3_NAMES\r\nSQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*);\r\n#else\r\n# define sqlite3FileSuffix3(X,Y)\r\n#endif\r\nSQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z,int);\r\n\r\nSQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);\r\nSQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);\r\nSQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, \r\n                        void(*)(void*));\r\nSQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);\r\nSQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);\r\nSQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);\r\n#ifdef SQLITE_ENABLE_STAT3\r\nSQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);\r\n#endif\r\nSQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);\r\nSQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);\r\n#ifndef SQLITE_AMALGAMATION\r\nSQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];\r\nSQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];\r\nSQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];\r\nSQLITE_PRIVATE const Token sqlite3IntTokens[];\r\nSQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;\r\nSQLITE_PRIVATE SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;\r\n#ifndef SQLITE_OMIT_WSD\r\nSQLITE_PRIVATE int sqlite3PendingByte;\r\n#endif\r\n#endif\r\nSQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, int, int);\r\nSQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*);\r\nSQLITE_PRIVATE void sqlite3AlterFunctions(void);\r\nSQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);\r\nSQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);\r\nSQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);\r\nSQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*);\r\nSQLITE_PRIVATE int sqlite3CodeSubselect(Parse *, Expr *, int, int);\r\nSQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);\r\nSQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);\r\nSQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);\r\nSQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);\r\nSQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);\r\nSQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);\r\nSQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);\r\nSQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(sqlite3*, u8, CollSeq *, const char*);\r\nSQLITE_PRIVATE char sqlite3AffinityType(const char*);\r\nSQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);\r\nSQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*);\r\nSQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*);\r\nSQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *);\r\nSQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB);\r\nSQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3*,Index*);\r\nSQLITE_PRIVATE void sqlite3DefaultRowEst(Index*);\r\nSQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3*, int);\r\nSQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);\r\nSQLITE_PRIVATE void sqlite3MinimumFileFormat(Parse*, int, int);\r\nSQLITE_PRIVATE void sqlite3SchemaClear(void *);\r\nSQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *);\r\nSQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *);\r\nSQLITE_PRIVATE KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *);\r\nSQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, \r\n  void (*)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*),\r\n  FuncDestructor *pDestructor\r\n);\r\nSQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int);\r\nSQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);\r\n\r\nSQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int);\r\nSQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int);\r\nSQLITE_PRIVATE void sqlite3AppendSpace(StrAccum*,int);\r\nSQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);\r\nSQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*);\r\nSQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);\r\nSQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);\r\n\r\nSQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);\r\nSQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);\r\n\r\n/*\r\n** The interface to the LEMON-generated parser\r\n*/\r\nSQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(size_t));\r\nSQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*));\r\nSQLITE_PRIVATE void sqlite3Parser(void*, int, Token, Parse*);\r\n#ifdef YYTRACKMAXSTACKDEPTH\r\nSQLITE_PRIVATE   int sqlite3ParserStackPeak(void*);\r\n#endif\r\n\r\nSQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*);\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\nSQLITE_PRIVATE   void sqlite3CloseExtensions(sqlite3*);\r\n#else\r\n# define sqlite3CloseExtensions(X)\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\nSQLITE_PRIVATE   void sqlite3TableLock(Parse *, int, int, u8, const char *);\r\n#else\r\n  #define sqlite3TableLock(v,w,x,y,z)\r\n#endif\r\n\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE   int sqlite3Utf8To8(unsigned char*);\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_VIRTUALTABLE\r\n#  define sqlite3VtabClear(Y)\r\n#  define sqlite3VtabSync(X,Y) SQLITE_OK\r\n#  define sqlite3VtabRollback(X)\r\n#  define sqlite3VtabCommit(X)\r\n#  define sqlite3VtabInSync(db) 0\r\n#  define sqlite3VtabLock(X) \r\n#  define sqlite3VtabUnlock(X)\r\n#  define sqlite3VtabUnlockList(X)\r\n#  define sqlite3VtabSavepoint(X, Y, Z) SQLITE_OK\r\n#  define sqlite3GetVTable(X,Y)  ((VTable*)0)\r\n#else\r\nSQLITE_PRIVATE    void sqlite3VtabClear(sqlite3 *db, Table*);\r\nSQLITE_PRIVATE    int sqlite3VtabSync(sqlite3 *db, char **);\r\nSQLITE_PRIVATE    int sqlite3VtabRollback(sqlite3 *db);\r\nSQLITE_PRIVATE    int sqlite3VtabCommit(sqlite3 *db);\r\nSQLITE_PRIVATE    void sqlite3VtabLock(VTable *);\r\nSQLITE_PRIVATE    void sqlite3VtabUnlock(VTable *);\r\nSQLITE_PRIVATE    void sqlite3VtabUnlockList(sqlite3*);\r\nSQLITE_PRIVATE    int sqlite3VtabSavepoint(sqlite3 *, int, int);\r\nSQLITE_PRIVATE    VTable *sqlite3GetVTable(sqlite3*, Table*);\r\n#  define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)\r\n#endif\r\nSQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);\r\nSQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int);\r\nSQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*);\r\nSQLITE_PRIVATE void sqlite3VtabArgInit(Parse*);\r\nSQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*);\r\nSQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);\r\nSQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);\r\nSQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);\r\nSQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);\r\nSQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);\r\nSQLITE_PRIVATE void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**);\r\nSQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);\r\nSQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);\r\nSQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);\r\nSQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);\r\nSQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *);\r\nSQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3*);\r\nSQLITE_PRIVATE const char *sqlite3JournalModename(int);\r\nSQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);\r\nSQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);\r\n\r\n/* Declarations for functions in fkey.c. All of these are replaced by\r\n** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign\r\n** key functionality is available. If OMIT_TRIGGER is defined but\r\n** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In\r\n** this case foreign keys are parsed, but no other functionality is \r\n** provided (enforcement of FK constraints requires the triggers sub-system).\r\n*/\r\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\r\nSQLITE_PRIVATE   void sqlite3FkCheck(Parse*, Table*, int, int);\r\nSQLITE_PRIVATE   void sqlite3FkDropTable(Parse*, SrcList *, Table*);\r\nSQLITE_PRIVATE   void sqlite3FkActions(Parse*, Table*, ExprList*, int);\r\nSQLITE_PRIVATE   int sqlite3FkRequired(Parse*, Table*, int*, int);\r\nSQLITE_PRIVATE   u32 sqlite3FkOldmask(Parse*, Table*);\r\nSQLITE_PRIVATE   FKey *sqlite3FkReferences(Table *);\r\n#else\r\n  #define sqlite3FkActions(a,b,c,d)\r\n  #define sqlite3FkCheck(a,b,c,d)\r\n  #define sqlite3FkDropTable(a,b,c)\r\n  #define sqlite3FkOldmask(a,b)      0\r\n  #define sqlite3FkRequired(a,b,c,d) 0\r\n#endif\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\nSQLITE_PRIVATE   void sqlite3FkDelete(sqlite3 *, Table*);\r\n#else\r\n  #define sqlite3FkDelete(a,b)\r\n#endif\r\n\r\n\r\n/*\r\n** Available fault injectors.  Should be numbered beginning with 0.\r\n*/\r\n#define SQLITE_FAULTINJECTOR_MALLOC     0\r\n#define SQLITE_FAULTINJECTOR_COUNT      1\r\n\r\n/*\r\n** The interface to the code in fault.c used for identifying \"benign\"\r\n** malloc failures. This is only present if SQLITE_OMIT_BUILTIN_TEST\r\n** is not defined.\r\n*/\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\nSQLITE_PRIVATE   void sqlite3BeginBenignMalloc(void);\r\nSQLITE_PRIVATE   void sqlite3EndBenignMalloc(void);\r\n#else\r\n  #define sqlite3BeginBenignMalloc()\r\n  #define sqlite3EndBenignMalloc()\r\n#endif\r\n\r\n#define IN_INDEX_ROWID           1\r\n#define IN_INDEX_EPH             2\r\n#define IN_INDEX_INDEX           3\r\nSQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, int*);\r\n\r\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\nSQLITE_PRIVATE   int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);\r\nSQLITE_PRIVATE   int sqlite3JournalSize(sqlite3_vfs *);\r\nSQLITE_PRIVATE   int sqlite3JournalCreate(sqlite3_file *);\r\n#else\r\n  #define sqlite3JournalSize(pVfs) ((pVfs)->szOsFile)\r\n#endif\r\n\r\nSQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *);\r\nSQLITE_PRIVATE int sqlite3MemJournalSize(void);\r\nSQLITE_PRIVATE int sqlite3IsMemJournal(sqlite3_file *);\r\n\r\n#if SQLITE_MAX_EXPR_DEPTH>0\r\nSQLITE_PRIVATE   void sqlite3ExprSetHeight(Parse *pParse, Expr *p);\r\nSQLITE_PRIVATE   int sqlite3SelectExprHeight(Select *);\r\nSQLITE_PRIVATE   int sqlite3ExprCheckHeight(Parse*, int);\r\n#else\r\n  #define sqlite3ExprSetHeight(x,y)\r\n  #define sqlite3SelectExprHeight(x) 0\r\n  #define sqlite3ExprCheckHeight(x,y)\r\n#endif\r\n\r\nSQLITE_PRIVATE u32 sqlite3Get4byte(const u8*);\r\nSQLITE_PRIVATE void sqlite3Put4byte(u8*, u32);\r\n\r\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\r\nSQLITE_PRIVATE   void sqlite3ConnectionBlocked(sqlite3 *, sqlite3 *);\r\nSQLITE_PRIVATE   void sqlite3ConnectionUnlocked(sqlite3 *db);\r\nSQLITE_PRIVATE   void sqlite3ConnectionClosed(sqlite3 *db);\r\n#else\r\n  #define sqlite3ConnectionBlocked(x,y)\r\n  #define sqlite3ConnectionUnlocked(x)\r\n  #define sqlite3ConnectionClosed(x)\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE   void sqlite3ParserTrace(FILE*, char *);\r\n#endif\r\n\r\n/*\r\n** If the SQLITE_ENABLE IOTRACE exists then the global variable\r\n** sqlite3IoTrace is a pointer to a printf-like routine used to\r\n** print I/O tracing messages. \r\n*/\r\n#ifdef SQLITE_ENABLE_IOTRACE\r\n# define IOTRACE(A)  if( sqlite3IoTrace ){ sqlite3IoTrace A; }\r\nSQLITE_PRIVATE   void sqlite3VdbeIOTraceSql(Vdbe*);\r\nSQLITE_PRIVATE void (*sqlite3IoTrace)(const char*,...);\r\n#else\r\n# define IOTRACE(A)\r\n# define sqlite3VdbeIOTraceSql(X)\r\n#endif\r\n\r\n/*\r\n** These routines are available for the mem2.c debugging memory allocator\r\n** only.  They are used to verify that different \"types\" of memory\r\n** allocations are properly tracked by the system.\r\n**\r\n** sqlite3MemdebugSetType() sets the \"type\" of an allocation to one of\r\n** the MEMTYPE_* macros defined below.  The type must be a bitmask with\r\n** a single bit set.\r\n**\r\n** sqlite3MemdebugHasType() returns true if any of the bits in its second\r\n** argument match the type set by the previous sqlite3MemdebugSetType().\r\n** sqlite3MemdebugHasType() is intended for use inside assert() statements.\r\n**\r\n** sqlite3MemdebugNoType() returns true if none of the bits in its second\r\n** argument match the type set by the previous sqlite3MemdebugSetType().\r\n**\r\n** Perhaps the most important point is the difference between MEMTYPE_HEAP\r\n** and MEMTYPE_LOOKASIDE.  If an allocation is MEMTYPE_LOOKASIDE, that means\r\n** it might have been allocated by lookaside, except the allocation was\r\n** too large or lookaside was already full.  It is important to verify\r\n** that allocations that might have been satisfied by lookaside are not\r\n** passed back to non-lookaside free() routines.  Asserts such as the\r\n** example above are placed on the non-lookaside free() routines to verify\r\n** this constraint. \r\n**\r\n** All of this is no-op for a production build.  It only comes into\r\n** play when the SQLITE_MEMDEBUG compile-time option is used.\r\n*/\r\n#ifdef SQLITE_MEMDEBUG\r\nSQLITE_PRIVATE   void sqlite3MemdebugSetType(void*,u8);\r\nSQLITE_PRIVATE   int sqlite3MemdebugHasType(void*,u8);\r\nSQLITE_PRIVATE   int sqlite3MemdebugNoType(void*,u8);\r\n#else\r\n# define sqlite3MemdebugSetType(X,Y)  /* no-op */\r\n# define sqlite3MemdebugHasType(X,Y)  1\r\n# define sqlite3MemdebugNoType(X,Y)   1\r\n#endif\r\n#define MEMTYPE_HEAP       0x01  /* General heap allocations */\r\n#define MEMTYPE_LOOKASIDE  0x02  /* Might have been lookaside memory */\r\n#define MEMTYPE_SCRATCH    0x04  /* Scratch allocations */\r\n#define MEMTYPE_PCACHE     0x08  /* Page cache allocations */\r\n#define MEMTYPE_DB         0x10  /* Uses sqlite3DbMalloc, not sqlite_malloc */\r\n\r\n#endif /* _SQLITEINT_H_ */\r\n\r\n/************** End of sqliteInt.h *******************************************/\r\n/************** Begin file global.c ******************************************/\r\n/*\r\n** 2008 June 13\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains definitions of global variables and contants.\r\n*/\r\n\r\n/* An array to map all upper-case characters into their corresponding\r\n** lower-case character. \r\n**\r\n** SQLite only considers US-ASCII (or EBCDIC) characters.  We do not\r\n** handle case conversions for the UTF character set since the tables\r\n** involved are nearly as big or bigger than SQLite itself.\r\n*/\r\nSQLITE_PRIVATE const unsigned char sqlite3UpperToLower[] = {\r\n#ifdef SQLITE_ASCII\r\n      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,\r\n     18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,\r\n     36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,\r\n     54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103,\r\n    104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,\r\n    122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,\r\n    108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,\r\n    126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,\r\n    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,\r\n    162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,\r\n    180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,\r\n    198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,\r\n    216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,\r\n    234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,\r\n    252,253,254,255\r\n#endif\r\n#ifdef SQLITE_EBCDIC\r\n      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, /* 0x */\r\n     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */\r\n     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */\r\n     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 3x */\r\n     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 4x */\r\n     80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 5x */\r\n     96, 97, 66, 67, 68, 69, 70, 71, 72, 73,106,107,108,109,110,111, /* 6x */\r\n    112, 81, 82, 83, 84, 85, 86, 87, 88, 89,122,123,124,125,126,127, /* 7x */\r\n    128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, /* 8x */\r\n    144,145,146,147,148,149,150,151,152,153,154,155,156,157,156,159, /* 9x */\r\n    160,161,162,163,164,165,166,167,168,169,170,171,140,141,142,175, /* Ax */\r\n    176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, /* Bx */\r\n    192,129,130,131,132,133,134,135,136,137,202,203,204,205,206,207, /* Cx */\r\n    208,145,146,147,148,149,150,151,152,153,218,219,220,221,222,223, /* Dx */\r\n    224,225,162,163,164,165,166,167,168,169,232,203,204,205,206,207, /* Ex */\r\n    239,240,241,242,243,244,245,246,247,248,249,219,220,221,222,255, /* Fx */\r\n#endif\r\n};\r\n\r\n/*\r\n** The following 256 byte lookup table is used to support SQLites built-in\r\n** equivalents to the following standard library functions:\r\n**\r\n**   isspace()                        0x01\r\n**   isalpha()                        0x02\r\n**   isdigit()                        0x04\r\n**   isalnum()                        0x06\r\n**   isxdigit()                       0x08\r\n**   toupper()                        0x20\r\n**   SQLite identifier character      0x40\r\n**\r\n** Bit 0x20 is set if the mapped character requires translation to upper\r\n** case. i.e. if the character is a lower-case ASCII character.\r\n** If x is a lower-case ASCII character, then its upper-case equivalent\r\n** is (x - 0x20). Therefore toupper() can be implemented as:\r\n**\r\n**   (x & ~(map[x]&0x20))\r\n**\r\n** Standard function tolower() is implemented using the sqlite3UpperToLower[]\r\n** array. tolower() is used more often than toupper() by SQLite.\r\n**\r\n** Bit 0x40 is set if the character non-alphanumeric and can be used in an \r\n** SQLite identifier.  Identifiers are alphanumerics, \"_\", \"$\", and any\r\n** non-ASCII UTF character. Hence the test for whether or not a character is\r\n** part of an identifier is 0x46.\r\n**\r\n** SQLite's versions are identical to the standard versions assuming a\r\n** locale of \"C\". They are implemented as macros in sqliteInt.h.\r\n*/\r\n#ifdef SQLITE_ASCII\r\nSQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = {\r\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 00..07    ........ */\r\n  0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,  /* 08..0f    ........ */\r\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 10..17    ........ */\r\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 18..1f    ........ */\r\n  0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,  /* 20..27     !\"#$%&' */\r\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 28..2f    ()*+,-./ */\r\n  0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,  /* 30..37    01234567 */\r\n  0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 38..3f    89:;<=>? */\r\n\r\n  0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02,  /* 40..47    @ABCDEFG */\r\n  0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  /* 48..4f    HIJKLMNO */\r\n  0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  /* 50..57    PQRSTUVW */\r\n  0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40,  /* 58..5f    XYZ[\\]^_ */\r\n  0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22,  /* 60..67    `abcdefg */\r\n  0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,  /* 68..6f    hijklmno */\r\n  0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,  /* 70..77    pqrstuvw */\r\n  0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 78..7f    xyz{|}~. */\r\n\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 80..87    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 88..8f    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 90..97    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 98..9f    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* a0..a7    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* a8..af    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* b0..b7    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* b8..bf    ........ */\r\n\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* c0..c7    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* c8..cf    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* d0..d7    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* d8..df    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* e0..e7    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* e8..ef    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* f0..f7    ........ */\r\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40   /* f8..ff    ........ */\r\n};\r\n#endif\r\n\r\n#ifndef SQLITE_USE_URI\r\n# define  SQLITE_USE_URI 0\r\n#endif\r\n\r\n/*\r\n** The following singleton contains the global configuration for\r\n** the SQLite library.\r\n*/\r\nSQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {\r\n   SQLITE_DEFAULT_MEMSTATUS,  /* bMemstat */\r\n   1,                         /* bCoreMutex */\r\n   SQLITE_THREADSAFE==1,      /* bFullMutex */\r\n   SQLITE_USE_URI,            /* bOpenUri */\r\n   0x7ffffffe,                /* mxStrlen */\r\n   128,                       /* szLookaside */\r\n   500,                       /* nLookaside */\r\n   {0,0,0,0,0,0,0,0},         /* m */\r\n   {0,0,0,0,0,0,0,0,0},       /* mutex */\r\n   {0,0,0,0,0,0,0,0,0,0,0,0,0},/* pcache2 */\r\n   (void*)0,                  /* pHeap */\r\n   0,                         /* nHeap */\r\n   0, 0,                      /* mnHeap, mxHeap */\r\n   (void*)0,                  /* pScratch */\r\n   0,                         /* szScratch */\r\n   0,                         /* nScratch */\r\n   (void*)0,                  /* pPage */\r\n   0,                         /* szPage */\r\n   0,                         /* nPage */\r\n   0,                         /* mxParserStack */\r\n   0,                         /* sharedCacheEnabled */\r\n   /* All the rest should always be initialized to zero */\r\n   0,                         /* isInit */\r\n   0,                         /* inProgress */\r\n   0,                         /* isMutexInit */\r\n   0,                         /* isMallocInit */\r\n   0,                         /* isPCacheInit */\r\n   0,                         /* pInitMutex */\r\n   0,                         /* nRefInitMutex */\r\n   0,                         /* xLog */\r\n   0,                         /* pLogArg */\r\n   0,                         /* bLocaltimeFault */\r\n};\r\n\r\n\r\n/*\r\n** Hash table for global functions - functions common to all\r\n** database connections.  After initialization, this table is\r\n** read-only.\r\n*/\r\nSQLITE_PRIVATE SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;\r\n\r\n/*\r\n** Constant tokens for values 0 and 1.\r\n*/\r\nSQLITE_PRIVATE const Token sqlite3IntTokens[] = {\r\n   { \"0\", 1 },\r\n   { \"1\", 1 }\r\n};\r\n\r\n\r\n/*\r\n** The value of the \"pending\" byte must be 0x40000000 (1 byte past the\r\n** 1-gibabyte boundary) in a compatible database.  SQLite never uses\r\n** the database page that contains the pending byte.  It never attempts\r\n** to read or write that page.  The pending byte page is set assign\r\n** for use by the VFS layers as space for managing file locks.\r\n**\r\n** During testing, it is often desirable to move the pending byte to\r\n** a different position in the file.  This allows code that has to\r\n** deal with the pending byte to run on files that are much smaller\r\n** than 1 GiB.  The sqlite3_test_control() interface can be used to\r\n** move the pending byte.\r\n**\r\n** IMPORTANT:  Changing the pending byte to any value other than\r\n** 0x40000000 results in an incompatible database file format!\r\n** Changing the pending byte during operating results in undefined\r\n** and dileterious behavior.\r\n*/\r\n#ifndef SQLITE_OMIT_WSD\r\nSQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;\r\n#endif\r\n\r\n/*\r\n** Properties of opcodes.  The OPFLG_INITIALIZER macro is\r\n** created by mkopcodeh.awk during compilation.  Data is obtained\r\n** from the comments following the \"case OP_xxxx:\" statements in\r\n** the vdbe.c file.  \r\n*/\r\nSQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;\r\n\r\n/************** End of global.c **********************************************/\r\n/************** Begin file ctime.c *******************************************/\r\n/*\r\n** 2010 February 23\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file implements routines used to report what compile-time options\r\n** SQLite was built with.\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\n\r\n\r\n/*\r\n** An array of names of all compile-time options.  This array should \r\n** be sorted A-Z.\r\n**\r\n** This array looks large, but in a typical installation actually uses\r\n** only a handful of compile-time options, so most times this array is usually\r\n** rather short and uses little memory space.\r\n*/\r\nstatic const char * const azCompileOpt[] = {\r\n\r\n/* These macros are provided to \"stringify\" the value of the define\r\n** for those options in which the value is meaningful. */\r\n#define CTIMEOPT_VAL_(opt) #opt\r\n#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)\r\n\r\n#ifdef SQLITE_32BIT_ROWID\r\n  \"32BIT_ROWID\",\r\n#endif\r\n#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC\r\n  \"4_BYTE_ALIGNED_MALLOC\",\r\n#endif\r\n#ifdef SQLITE_CASE_SENSITIVE_LIKE\r\n  \"CASE_SENSITIVE_LIKE\",\r\n#endif\r\n#ifdef SQLITE_CHECK_PAGES\r\n  \"CHECK_PAGES\",\r\n#endif\r\n#ifdef SQLITE_COVERAGE_TEST\r\n  \"COVERAGE_TEST\",\r\n#endif\r\n#ifdef SQLITE_DEBUG\r\n  \"DEBUG\",\r\n#endif\r\n#ifdef SQLITE_DEFAULT_LOCKING_MODE\r\n  \"DEFAULT_LOCKING_MODE=\" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),\r\n#endif\r\n#ifdef SQLITE_DISABLE_DIRSYNC\r\n  \"DISABLE_DIRSYNC\",\r\n#endif\r\n#ifdef SQLITE_DISABLE_LFS\r\n  \"DISABLE_LFS\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\n  \"ENABLE_ATOMIC_WRITE\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_CEROD\r\n  \"ENABLE_CEROD\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\r\n  \"ENABLE_COLUMN_METADATA\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\r\n  \"ENABLE_EXPENSIVE_ASSERT\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_FTS1\r\n  \"ENABLE_FTS1\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_FTS2\r\n  \"ENABLE_FTS2\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_FTS3\r\n  \"ENABLE_FTS3\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS\r\n  \"ENABLE_FTS3_PARENTHESIS\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_FTS4\r\n  \"ENABLE_FTS4\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_ICU\r\n  \"ENABLE_ICU\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_IOTRACE\r\n  \"ENABLE_IOTRACE\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_LOAD_EXTENSION\r\n  \"ENABLE_LOAD_EXTENSION\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_LOCKING_STYLE\r\n  \"ENABLE_LOCKING_STYLE=\" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),\r\n#endif\r\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\r\n  \"ENABLE_MEMORY_MANAGEMENT\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_MEMSYS3\r\n  \"ENABLE_MEMSYS3\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_MEMSYS5\r\n  \"ENABLE_MEMSYS5\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK\r\n  \"ENABLE_OVERSIZE_CELL_CHECK\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_RTREE\r\n  \"ENABLE_RTREE\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  \"ENABLE_STAT3\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\r\n  \"ENABLE_UNLOCK_NOTIFY\",\r\n#endif\r\n#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT\r\n  \"ENABLE_UPDATE_DELETE_LIMIT\",\r\n#endif\r\n#ifdef SQLITE_HAS_CODEC\r\n  \"HAS_CODEC\",\r\n#endif\r\n#ifdef SQLITE_HAVE_ISNAN\r\n  \"HAVE_ISNAN\",\r\n#endif\r\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\r\n  \"HOMEGROWN_RECURSIVE_MUTEX\",\r\n#endif\r\n#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS\r\n  \"IGNORE_AFP_LOCK_ERRORS\",\r\n#endif\r\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\r\n  \"IGNORE_FLOCK_LOCK_ERRORS\",\r\n#endif\r\n#ifdef SQLITE_INT64_TYPE\r\n  \"INT64_TYPE\",\r\n#endif\r\n#ifdef SQLITE_LOCK_TRACE\r\n  \"LOCK_TRACE\",\r\n#endif\r\n#ifdef SQLITE_MAX_SCHEMA_RETRY\r\n  \"MAX_SCHEMA_RETRY=\" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),\r\n#endif\r\n#ifdef SQLITE_MEMDEBUG\r\n  \"MEMDEBUG\",\r\n#endif\r\n#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT\r\n  \"MIXED_ENDIAN_64BIT_FLOAT\",\r\n#endif\r\n#ifdef SQLITE_NO_SYNC\r\n  \"NO_SYNC\",\r\n#endif\r\n#ifdef SQLITE_OMIT_ALTERTABLE\r\n  \"OMIT_ALTERTABLE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_ANALYZE\r\n  \"OMIT_ANALYZE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_ATTACH\r\n  \"OMIT_ATTACH\",\r\n#endif\r\n#ifdef SQLITE_OMIT_AUTHORIZATION\r\n  \"OMIT_AUTHORIZATION\",\r\n#endif\r\n#ifdef SQLITE_OMIT_AUTOINCREMENT\r\n  \"OMIT_AUTOINCREMENT\",\r\n#endif\r\n#ifdef SQLITE_OMIT_AUTOINIT\r\n  \"OMIT_AUTOINIT\",\r\n#endif\r\n#ifdef SQLITE_OMIT_AUTOMATIC_INDEX\r\n  \"OMIT_AUTOMATIC_INDEX\",\r\n#endif\r\n#ifdef SQLITE_OMIT_AUTORESET\r\n  \"OMIT_AUTORESET\",\r\n#endif\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n  \"OMIT_AUTOVACUUM\",\r\n#endif\r\n#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION\r\n  \"OMIT_BETWEEN_OPTIMIZATION\",\r\n#endif\r\n#ifdef SQLITE_OMIT_BLOB_LITERAL\r\n  \"OMIT_BLOB_LITERAL\",\r\n#endif\r\n#ifdef SQLITE_OMIT_BTREECOUNT\r\n  \"OMIT_BTREECOUNT\",\r\n#endif\r\n#ifdef SQLITE_OMIT_BUILTIN_TEST\r\n  \"OMIT_BUILTIN_TEST\",\r\n#endif\r\n#ifdef SQLITE_OMIT_CAST\r\n  \"OMIT_CAST\",\r\n#endif\r\n#ifdef SQLITE_OMIT_CHECK\r\n  \"OMIT_CHECK\",\r\n#endif\r\n/* // redundant\r\n** #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\n**   \"OMIT_COMPILEOPTION_DIAGS\",\r\n** #endif\r\n*/\r\n#ifdef SQLITE_OMIT_COMPLETE\r\n  \"OMIT_COMPLETE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_COMPOUND_SELECT\r\n  \"OMIT_COMPOUND_SELECT\",\r\n#endif\r\n#ifdef SQLITE_OMIT_DATETIME_FUNCS\r\n  \"OMIT_DATETIME_FUNCS\",\r\n#endif\r\n#ifdef SQLITE_OMIT_DECLTYPE\r\n  \"OMIT_DECLTYPE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_DEPRECATED\r\n  \"OMIT_DEPRECATED\",\r\n#endif\r\n#ifdef SQLITE_OMIT_DISKIO\r\n  \"OMIT_DISKIO\",\r\n#endif\r\n#ifdef SQLITE_OMIT_EXPLAIN\r\n  \"OMIT_EXPLAIN\",\r\n#endif\r\n#ifdef SQLITE_OMIT_FLAG_PRAGMAS\r\n  \"OMIT_FLAG_PRAGMAS\",\r\n#endif\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n  \"OMIT_FLOATING_POINT\",\r\n#endif\r\n#ifdef SQLITE_OMIT_FOREIGN_KEY\r\n  \"OMIT_FOREIGN_KEY\",\r\n#endif\r\n#ifdef SQLITE_OMIT_GET_TABLE\r\n  \"OMIT_GET_TABLE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_INCRBLOB\r\n  \"OMIT_INCRBLOB\",\r\n#endif\r\n#ifdef SQLITE_OMIT_INTEGRITY_CHECK\r\n  \"OMIT_INTEGRITY_CHECK\",\r\n#endif\r\n#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION\r\n  \"OMIT_LIKE_OPTIMIZATION\",\r\n#endif\r\n#ifdef SQLITE_OMIT_LOAD_EXTENSION\r\n  \"OMIT_LOAD_EXTENSION\",\r\n#endif\r\n#ifdef SQLITE_OMIT_LOCALTIME\r\n  \"OMIT_LOCALTIME\",\r\n#endif\r\n#ifdef SQLITE_OMIT_LOOKASIDE\r\n  \"OMIT_LOOKASIDE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_MEMORYDB\r\n  \"OMIT_MEMORYDB\",\r\n#endif\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n  \"OMIT_MERGE_SORT\",\r\n#endif\r\n#ifdef SQLITE_OMIT_OR_OPTIMIZATION\r\n  \"OMIT_OR_OPTIMIZATION\",\r\n#endif\r\n#ifdef SQLITE_OMIT_PAGER_PRAGMAS\r\n  \"OMIT_PAGER_PRAGMAS\",\r\n#endif\r\n#ifdef SQLITE_OMIT_PRAGMA\r\n  \"OMIT_PRAGMA\",\r\n#endif\r\n#ifdef SQLITE_OMIT_PROGRESS_CALLBACK\r\n  \"OMIT_PROGRESS_CALLBACK\",\r\n#endif\r\n#ifdef SQLITE_OMIT_QUICKBALANCE\r\n  \"OMIT_QUICKBALANCE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_REINDEX\r\n  \"OMIT_REINDEX\",\r\n#endif\r\n#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS\r\n  \"OMIT_SCHEMA_PRAGMAS\",\r\n#endif\r\n#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS\r\n  \"OMIT_SCHEMA_VERSION_PRAGMAS\",\r\n#endif\r\n#ifdef SQLITE_OMIT_SHARED_CACHE\r\n  \"OMIT_SHARED_CACHE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_SUBQUERY\r\n  \"OMIT_SUBQUERY\",\r\n#endif\r\n#ifdef SQLITE_OMIT_TCL_VARIABLE\r\n  \"OMIT_TCL_VARIABLE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_TEMPDB\r\n  \"OMIT_TEMPDB\",\r\n#endif\r\n#ifdef SQLITE_OMIT_TRACE\r\n  \"OMIT_TRACE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_TRIGGER\r\n  \"OMIT_TRIGGER\",\r\n#endif\r\n#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION\r\n  \"OMIT_TRUNCATE_OPTIMIZATION\",\r\n#endif\r\n#ifdef SQLITE_OMIT_UTF16\r\n  \"OMIT_UTF16\",\r\n#endif\r\n#ifdef SQLITE_OMIT_VACUUM\r\n  \"OMIT_VACUUM\",\r\n#endif\r\n#ifdef SQLITE_OMIT_VIEW\r\n  \"OMIT_VIEW\",\r\n#endif\r\n#ifdef SQLITE_OMIT_VIRTUALTABLE\r\n  \"OMIT_VIRTUALTABLE\",\r\n#endif\r\n#ifdef SQLITE_OMIT_WAL\r\n  \"OMIT_WAL\",\r\n#endif\r\n#ifdef SQLITE_OMIT_WSD\r\n  \"OMIT_WSD\",\r\n#endif\r\n#ifdef SQLITE_OMIT_XFER_OPT\r\n  \"OMIT_XFER_OPT\",\r\n#endif\r\n#ifdef SQLITE_PERFORMANCE_TRACE\r\n  \"PERFORMANCE_TRACE\",\r\n#endif\r\n#ifdef SQLITE_PROXY_DEBUG\r\n  \"PROXY_DEBUG\",\r\n#endif\r\n#ifdef SQLITE_SECURE_DELETE\r\n  \"SECURE_DELETE\",\r\n#endif\r\n#ifdef SQLITE_SMALL_STACK\r\n  \"SMALL_STACK\",\r\n#endif\r\n#ifdef SQLITE_SOUNDEX\r\n  \"SOUNDEX\",\r\n#endif\r\n#ifdef SQLITE_TCL\r\n  \"TCL\",\r\n#endif\r\n#ifdef SQLITE_TEMP_STORE\r\n  \"TEMP_STORE=\" CTIMEOPT_VAL(SQLITE_TEMP_STORE),\r\n#endif\r\n#ifdef SQLITE_TEST\r\n  \"TEST\",\r\n#endif\r\n#ifdef SQLITE_THREADSAFE\r\n  \"THREADSAFE=\" CTIMEOPT_VAL(SQLITE_THREADSAFE),\r\n#endif\r\n#ifdef SQLITE_USE_ALLOCA\r\n  \"USE_ALLOCA\",\r\n#endif\r\n#ifdef SQLITE_ZERO_MALLOC\r\n  \"ZERO_MALLOC\"\r\n#endif\r\n};\r\n\r\n/*\r\n** Given the name of a compile-time option, return true if that option\r\n** was used and false if not.\r\n**\r\n** The name can optionally begin with \"SQLITE_\" but the \"SQLITE_\" prefix\r\n** is not required for a match.\r\n*/\r\nSQLITE_API int sqlite3_compileoption_used(const char *zOptName){\r\n  int i, n;\r\n  if( sqlite3StrNICmp(zOptName, \"SQLITE_\", 7)==0 ) zOptName += 7;\r\n  n = sqlite3Strlen30(zOptName);\r\n\r\n  /* Since ArraySize(azCompileOpt) is normally in single digits, a\r\n  ** linear search is adequate.  No need for a binary search. */\r\n  for(i=0; i<ArraySize(azCompileOpt); i++){\r\n    if(   (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)\r\n       && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return the N-th compile-time option string.  If N is out of range,\r\n** return a NULL pointer.\r\n*/\r\nSQLITE_API const char *sqlite3_compileoption_get(int N){\r\n  if( N>=0 && N<ArraySize(azCompileOpt) ){\r\n    return azCompileOpt[N];\r\n  }\r\n  return 0;\r\n}\r\n\r\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\r\n\r\n/************** End of ctime.c ***********************************************/\r\n/************** Begin file status.c ******************************************/\r\n/*\r\n** 2008 June 18\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This module implements the sqlite3_status() interface and related\r\n** functionality.\r\n*/\r\n/************** Include vdbeInt.h in the middle of status.c ******************/\r\n/************** Begin file vdbeInt.h *****************************************/\r\n/*\r\n** 2003 September 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This is the header file for information that is private to the\r\n** VDBE.  This information used to all be at the top of the single\r\n** source code file \"vdbe.c\".  When that file became too big (over\r\n** 6000 lines long) it was split up into several smaller files and\r\n** this header information was factored out.\r\n*/\r\n#ifndef _VDBEINT_H_\r\n#define _VDBEINT_H_\r\n\r\n/*\r\n** SQL is translated into a sequence of instructions to be\r\n** executed by a virtual machine.  Each instruction is an instance\r\n** of the following structure.\r\n*/\r\ntypedef struct VdbeOp Op;\r\n\r\n/*\r\n** Boolean values\r\n*/\r\ntypedef unsigned char Bool;\r\n\r\n/* Opaque type used by code in vdbesort.c */\r\ntypedef struct VdbeSorter VdbeSorter;\r\n\r\n/* Opaque type used by the explainer */\r\ntypedef struct Explain Explain;\r\n\r\n/*\r\n** A cursor is a pointer into a single BTree within a database file.\r\n** The cursor can seek to a BTree entry with a particular key, or\r\n** loop over all entries of the Btree.  You can also insert new BTree\r\n** entries or retrieve the key or data from the entry that the cursor\r\n** is currently pointing to.\r\n** \r\n** Every cursor that the virtual machine has open is represented by an\r\n** instance of the following structure.\r\n*/\r\nstruct VdbeCursor {\r\n  BtCursor *pCursor;    /* The cursor structure of the backend */\r\n  Btree *pBt;           /* Separate file holding temporary table */\r\n  KeyInfo *pKeyInfo;    /* Info about index keys needed by index cursors */\r\n  int iDb;              /* Index of cursor database in db->aDb[] (or -1) */\r\n  int pseudoTableReg;   /* Register holding pseudotable content. */\r\n  int nField;           /* Number of fields in the header */\r\n  Bool zeroed;          /* True if zeroed out and ready for reuse */\r\n  Bool rowidIsValid;    /* True if lastRowid is valid */\r\n  Bool atFirst;         /* True if pointing to first entry */\r\n  Bool useRandomRowid;  /* Generate new record numbers semi-randomly */\r\n  Bool nullRow;         /* True if pointing to a row with no data */\r\n  Bool deferredMoveto;  /* A call to sqlite3BtreeMoveto() is needed */\r\n  Bool isTable;         /* True if a table requiring integer keys */\r\n  Bool isIndex;         /* True if an index containing keys only - no data */\r\n  Bool isOrdered;       /* True if the underlying table is BTREE_UNORDERED */\r\n  Bool isSorter;        /* True if a new-style sorter */\r\n  sqlite3_vtab_cursor *pVtabCursor;  /* The cursor for a virtual table */\r\n  const sqlite3_module *pModule;     /* Module for cursor pVtabCursor */\r\n  i64 seqCount;         /* Sequence counter */\r\n  i64 movetoTarget;     /* Argument to the deferred sqlite3BtreeMoveto() */\r\n  i64 lastRowid;        /* Last rowid from a Next or NextIdx operation */\r\n  VdbeSorter *pSorter;  /* Sorter object for OP_SorterOpen cursors */\r\n\r\n  /* Result of last sqlite3BtreeMoveto() done by an OP_NotExists or \r\n  ** OP_IsUnique opcode on this cursor. */\r\n  int seekResult;\r\n\r\n  /* Cached information about the header for the data record that the\r\n  ** cursor is currently pointing to.  Only valid if cacheStatus matches\r\n  ** Vdbe.cacheCtr.  Vdbe.cacheCtr will never take on the value of\r\n  ** CACHE_STALE and so setting cacheStatus=CACHE_STALE guarantees that\r\n  ** the cache is out of date.\r\n  **\r\n  ** aRow might point to (ephemeral) data for the current row, or it might\r\n  ** be NULL.\r\n  */\r\n  u32 cacheStatus;      /* Cache is valid if this matches Vdbe.cacheCtr */\r\n  int payloadSize;      /* Total number of bytes in the record */\r\n  u32 *aType;           /* Type values for all entries in the record */\r\n  u32 *aOffset;         /* Cached offsets to the start of each columns data */\r\n  u8 *aRow;             /* Data for the current row, if all on one page */\r\n};\r\ntypedef struct VdbeCursor VdbeCursor;\r\n\r\n/*\r\n** When a sub-program is executed (OP_Program), a structure of this type\r\n** is allocated to store the current value of the program counter, as\r\n** well as the current memory cell array and various other frame specific\r\n** values stored in the Vdbe struct. When the sub-program is finished, \r\n** these values are copied back to the Vdbe from the VdbeFrame structure,\r\n** restoring the state of the VM to as it was before the sub-program\r\n** began executing.\r\n**\r\n** The memory for a VdbeFrame object is allocated and managed by a memory\r\n** cell in the parent (calling) frame. When the memory cell is deleted or\r\n** overwritten, the VdbeFrame object is not freed immediately. Instead, it\r\n** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame\r\n** list is deleted when the VM is reset in VdbeHalt(). The reason for doing\r\n** this instead of deleting the VdbeFrame immediately is to avoid recursive\r\n** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the\r\n** child frame are released.\r\n**\r\n** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is\r\n** set to NULL if the currently executing frame is the main program.\r\n*/\r\ntypedef struct VdbeFrame VdbeFrame;\r\nstruct VdbeFrame {\r\n  Vdbe *v;                /* VM this frame belongs to */\r\n  VdbeFrame *pParent;     /* Parent of this frame, or NULL if parent is main */\r\n  Op *aOp;                /* Program instructions for parent frame */\r\n  Mem *aMem;              /* Array of memory cells for parent frame */\r\n  u8 *aOnceFlag;          /* Array of OP_Once flags for parent frame */\r\n  VdbeCursor **apCsr;     /* Array of Vdbe cursors for parent frame */\r\n  void *token;            /* Copy of SubProgram.token */\r\n  i64 lastRowid;          /* Last insert rowid (sqlite3.lastRowid) */\r\n  u16 nCursor;            /* Number of entries in apCsr */\r\n  int pc;                 /* Program Counter in parent (calling) frame */\r\n  int nOp;                /* Size of aOp array */\r\n  int nMem;               /* Number of entries in aMem */\r\n  int nOnceFlag;          /* Number of entries in aOnceFlag */\r\n  int nChildMem;          /* Number of memory cells for child frame */\r\n  int nChildCsr;          /* Number of cursors for child frame */\r\n  int nChange;            /* Statement changes (Vdbe.nChanges)     */\r\n};\r\n\r\n#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])\r\n\r\n/*\r\n** A value for VdbeCursor.cacheValid that means the cache is always invalid.\r\n*/\r\n#define CACHE_STALE 0\r\n\r\n/*\r\n** Internally, the vdbe manipulates nearly all SQL values as Mem\r\n** structures. Each Mem struct may cache multiple representations (string,\r\n** integer etc.) of the same value.\r\n*/\r\nstruct Mem {\r\n  sqlite3 *db;        /* The associated database connection */\r\n  char *z;            /* String or BLOB value */\r\n  double r;           /* Real value */\r\n  union {\r\n    i64 i;              /* Integer value used when MEM_Int is set in flags */\r\n    int nZero;          /* Used when bit MEM_Zero is set in flags */\r\n    FuncDef *pDef;      /* Used only when flags==MEM_Agg */\r\n    RowSet *pRowSet;    /* Used only when flags==MEM_RowSet */\r\n    VdbeFrame *pFrame;  /* Used when flags==MEM_Frame */\r\n  } u;\r\n  int n;              /* Number of characters in string value, excluding '\\0' */\r\n  u16 flags;          /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */\r\n  u8  type;           /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */\r\n  u8  enc;            /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */\r\n#ifdef SQLITE_DEBUG\r\n  Mem *pScopyFrom;    /* This Mem is a shallow copy of pScopyFrom */\r\n  void *pFiller;      /* So that sizeof(Mem) is a multiple of 8 */\r\n#endif\r\n  void (*xDel)(void *);  /* If not null, call this function to delete Mem.z */\r\n  char *zMalloc;      /* Dynamic buffer allocated by sqlite3_malloc() */\r\n};\r\n\r\n/* One or more of the following flags are set to indicate the validOK\r\n** representations of the value stored in the Mem struct.\r\n**\r\n** If the MEM_Null flag is set, then the value is an SQL NULL value.\r\n** No other flags may be set in this case.\r\n**\r\n** If the MEM_Str flag is set then Mem.z points at a string representation.\r\n** Usually this is encoded in the same unicode encoding as the main\r\n** database (see below for exceptions). If the MEM_Term flag is also\r\n** set, then the string is nul terminated. The MEM_Int and MEM_Real \r\n** flags may coexist with the MEM_Str flag.\r\n*/\r\n#define MEM_Null      0x0001   /* Value is NULL */\r\n#define MEM_Str       0x0002   /* Value is a string */\r\n#define MEM_Int       0x0004   /* Value is an integer */\r\n#define MEM_Real      0x0008   /* Value is a real number */\r\n#define MEM_Blob      0x0010   /* Value is a BLOB */\r\n#define MEM_RowSet    0x0020   /* Value is a RowSet object */\r\n#define MEM_Frame     0x0040   /* Value is a VdbeFrame object */\r\n#define MEM_Invalid   0x0080   /* Value is undefined */\r\n#define MEM_TypeMask  0x00ff   /* Mask of type bits */\r\n\r\n/* Whenever Mem contains a valid string or blob representation, one of\r\n** the following flags must be set to determine the memory management\r\n** policy for Mem.z.  The MEM_Term flag tells us whether or not the\r\n** string is \\000 or \\u0000 terminated\r\n*/\r\n#define MEM_Term      0x0200   /* String rep is nul terminated */\r\n#define MEM_Dyn       0x0400   /* Need to call sqliteFree() on Mem.z */\r\n#define MEM_Static    0x0800   /* Mem.z points to a static string */\r\n#define MEM_Ephem     0x1000   /* Mem.z points to an ephemeral string */\r\n#define MEM_Agg       0x2000   /* Mem.z points to an agg function context */\r\n#define MEM_Zero      0x4000   /* Mem.i contains count of 0s appended to blob */\r\n#ifdef SQLITE_OMIT_INCRBLOB\r\n  #undef MEM_Zero\r\n  #define MEM_Zero 0x0000\r\n#endif\r\n\r\n/*\r\n** Clear any existing type flags from a Mem and replace them with f\r\n*/\r\n#define MemSetTypeFlag(p, f) \\\r\n   ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)\r\n\r\n/*\r\n** Return true if a memory cell is not marked as invalid.  This macro\r\n** is for use inside assert() statements only.\r\n*/\r\n#ifdef SQLITE_DEBUG\r\n#define memIsValid(M)  ((M)->flags & MEM_Invalid)==0\r\n#endif\r\n\r\n\r\n/* A VdbeFunc is just a FuncDef (defined in sqliteInt.h) that contains\r\n** additional information about auxiliary information bound to arguments\r\n** of the function.  This is used to implement the sqlite3_get_auxdata()\r\n** and sqlite3_set_auxdata() APIs.  The \"auxdata\" is some auxiliary data\r\n** that can be associated with a constant argument to a function.  This\r\n** allows functions such as \"regexp\" to compile their constant regular\r\n** expression argument once and reused the compiled code for multiple\r\n** invocations.\r\n*/\r\nstruct VdbeFunc {\r\n  FuncDef *pFunc;               /* The definition of the function */\r\n  int nAux;                     /* Number of entries allocated for apAux[] */\r\n  struct AuxData {\r\n    void *pAux;                   /* Aux data for the i-th argument */\r\n    void (*xDelete)(void *);      /* Destructor for the aux data */\r\n  } apAux[1];                   /* One slot for each function argument */\r\n};\r\n\r\n/*\r\n** The \"context\" argument for a installable function.  A pointer to an\r\n** instance of this structure is the first argument to the routines used\r\n** implement the SQL functions.\r\n**\r\n** There is a typedef for this structure in sqlite.h.  So all routines,\r\n** even the public interface to SQLite, can use a pointer to this structure.\r\n** But this file is the only place where the internal details of this\r\n** structure are known.\r\n**\r\n** This structure is defined inside of vdbeInt.h because it uses substructures\r\n** (Mem) which are only defined there.\r\n*/\r\nstruct sqlite3_context {\r\n  FuncDef *pFunc;       /* Pointer to function information.  MUST BE FIRST */\r\n  VdbeFunc *pVdbeFunc;  /* Auxilary data, if created. */\r\n  Mem s;                /* The return value is stored here */\r\n  Mem *pMem;            /* Memory cell used to store aggregate context */\r\n  CollSeq *pColl;       /* Collating sequence */\r\n  int isError;          /* Error code returned by the function. */\r\n  int skipFlag;         /* Skip skip accumulator loading if true */\r\n};\r\n\r\n/*\r\n** An Explain object accumulates indented output which is helpful\r\n** in describing recursive data structures.\r\n*/\r\nstruct Explain {\r\n  Vdbe *pVdbe;       /* Attach the explanation to this Vdbe */\r\n  StrAccum str;      /* The string being accumulated */\r\n  int nIndent;       /* Number of elements in aIndent */\r\n  u16 aIndent[100];  /* Levels of indentation */\r\n  char zBase[100];   /* Initial space */\r\n};\r\n\r\n/*\r\n** An instance of the virtual machine.  This structure contains the complete\r\n** state of the virtual machine.\r\n**\r\n** The \"sqlite3_stmt\" structure pointer that is returned by sqlite3_prepare()\r\n** is really a pointer to an instance of this structure.\r\n**\r\n** The Vdbe.inVtabMethod variable is set to non-zero for the duration of\r\n** any virtual table method invocations made by the vdbe program. It is\r\n** set to 2 for xDestroy method calls and 1 for all other methods. This\r\n** variable is used for two purposes: to allow xDestroy methods to execute\r\n** \"DROP TABLE\" statements and to prevent some nasty side effects of\r\n** malloc failure when SQLite is invoked recursively by a virtual table \r\n** method function.\r\n*/\r\nstruct Vdbe {\r\n  sqlite3 *db;            /* The database connection that owns this statement */\r\n  Op *aOp;                /* Space to hold the virtual machine's program */\r\n  Mem *aMem;              /* The memory locations */\r\n  Mem **apArg;            /* Arguments to currently executing user function */\r\n  Mem *aColName;          /* Column names to return */\r\n  Mem *pResultSet;        /* Pointer to an array of results */\r\n  int nMem;               /* Number of memory locations currently allocated */\r\n  int nOp;                /* Number of instructions in the program */\r\n  int nOpAlloc;           /* Number of slots allocated for aOp[] */\r\n  int nLabel;             /* Number of labels used */\r\n  int *aLabel;            /* Space to hold the labels */\r\n  u16 nResColumn;         /* Number of columns in one row of the result set */\r\n  u16 nCursor;            /* Number of slots in apCsr[] */\r\n  u32 magic;              /* Magic number for sanity checking */\r\n  char *zErrMsg;          /* Error message written here */\r\n  Vdbe *pPrev,*pNext;     /* Linked list of VDBEs with the same Vdbe.db */\r\n  VdbeCursor **apCsr;     /* One element of this array for each open cursor */\r\n  Mem *aVar;              /* Values for the OP_Variable opcode. */\r\n  char **azVar;           /* Name of variables */\r\n  ynVar nVar;             /* Number of entries in aVar[] */\r\n  ynVar nzVar;            /* Number of entries in azVar[] */\r\n  u32 cacheCtr;           /* VdbeCursor row cache generation counter */\r\n  int pc;                 /* The program counter */\r\n  int rc;                 /* Value to return */\r\n  u8 errorAction;         /* Recovery action to do in case of an error */\r\n  u8 explain;             /* True if EXPLAIN present on SQL command */\r\n  u8 changeCntOn;         /* True to update the change-counter */\r\n  u8 expired;             /* True if the VM needs to be recompiled */\r\n  u8 runOnlyOnce;         /* Automatically expire on reset */\r\n  u8 minWriteFileFormat;  /* Minimum file format for writable database files */\r\n  u8 inVtabMethod;        /* See comments above */\r\n  u8 usesStmtJournal;     /* True if uses a statement journal */\r\n  u8 readOnly;            /* True for read-only statements */\r\n  u8 isPrepareV2;         /* True if prepared with prepare_v2() */\r\n  int nChange;            /* Number of db changes made since last reset */\r\n  yDbMask btreeMask;      /* Bitmask of db->aDb[] entries referenced */\r\n  yDbMask lockMask;       /* Subset of btreeMask that requires a lock */\r\n  int iStatement;         /* Statement number (or 0 if has not opened stmt) */\r\n  int aCounter[3];        /* Counters used by sqlite3_stmt_status() */\r\n#ifndef SQLITE_OMIT_TRACE\r\n  i64 startTime;          /* Time when query started - used for profiling */\r\n#endif\r\n  i64 nFkConstraint;      /* Number of imm. FK constraints this VM */\r\n  i64 nStmtDefCons;       /* Number of def. constraints when stmt started */\r\n  char *zSql;             /* Text of the SQL statement that generated this */\r\n  void *pFree;            /* Free this when deleting the vdbe */\r\n#ifdef SQLITE_DEBUG\r\n  FILE *trace;            /* Write an execution trace here, if not NULL */\r\n#endif\r\n#ifdef SQLITE_ENABLE_TREE_EXPLAIN\r\n  Explain *pExplain;      /* The explainer */\r\n  char *zExplain;         /* Explanation of data structures */\r\n#endif\r\n  VdbeFrame *pFrame;      /* Parent frame */\r\n  VdbeFrame *pDelFrame;   /* List of frame objects to free on VM reset */\r\n  int nFrame;             /* Number of frames in pFrame list */\r\n  u32 expmask;            /* Binding to these vars invalidates VM */\r\n  SubProgram *pProgram;   /* Linked list of all sub-programs used by VM */\r\n  int nOnceFlag;          /* Size of array aOnceFlag[] */\r\n  u8 *aOnceFlag;          /* Flags for OP_Once */\r\n};\r\n\r\n/*\r\n** The following are allowed values for Vdbe.magic\r\n*/\r\n#define VDBE_MAGIC_INIT     0x26bceaa5    /* Building a VDBE program */\r\n#define VDBE_MAGIC_RUN      0xbdf20da3    /* VDBE is ready to execute */\r\n#define VDBE_MAGIC_HALT     0x519c2973    /* VDBE has completed execution */\r\n#define VDBE_MAGIC_DEAD     0xb606c3c8    /* The VDBE has been deallocated */\r\n\r\n/*\r\n** Function prototypes\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);\r\nvoid sqliteVdbePopStack(Vdbe*,int);\r\nSQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor*);\r\n#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)\r\nSQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, Op*);\r\n#endif\r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32);\r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem*, int);\r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int);\r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);\r\nSQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);\r\n\r\nint sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);\r\nSQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);\r\nSQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *);\r\nSQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);\r\nSQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*);\r\nSQLITE_PRIVATE int sqlite3VdbeList(Vdbe*);\r\nSQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*);\r\nSQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int);\r\nSQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*);\r\nSQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);\r\nSQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64);\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64\r\n#else\r\nSQLITE_PRIVATE   void sqlite3VdbeMemSetDouble(Mem*, double);\r\n#endif\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*);\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int);\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, int);\r\nSQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);\r\nSQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);\r\nSQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*);\r\nSQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);\r\nSQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);\r\nSQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p);\r\n#define VdbeMemRelease(X)  \\\r\n  if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \\\r\n    sqlite3VdbeMemReleaseExternal(X);\r\nSQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);\r\nSQLITE_PRIVATE const char *sqlite3OpcodeName(int);\r\nSQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);\r\nSQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);\r\nSQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*);\r\nSQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *);\r\nSQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);\r\nSQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p);\r\n\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n# define sqlite3VdbeSorterInit(Y,Z)      SQLITE_OK\r\n# define sqlite3VdbeSorterWrite(X,Y,Z)   SQLITE_OK\r\n# define sqlite3VdbeSorterClose(Y,Z)\r\n# define sqlite3VdbeSorterRowkey(Y,Z)    SQLITE_OK\r\n# define sqlite3VdbeSorterRewind(X,Y,Z)  SQLITE_OK\r\n# define sqlite3VdbeSorterNext(X,Y,Z)    SQLITE_OK\r\n# define sqlite3VdbeSorterCompare(X,Y,Z) SQLITE_OK\r\n#else\r\nSQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *);\r\nSQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);\r\nSQLITE_PRIVATE int sqlite3VdbeSorterRowkey(VdbeCursor *, Mem *);\r\nSQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, VdbeCursor *, int *);\r\nSQLITE_PRIVATE int sqlite3VdbeSorterRewind(sqlite3 *, VdbeCursor *, int *);\r\nSQLITE_PRIVATE int sqlite3VdbeSorterWrite(sqlite3 *, VdbeCursor *, Mem *);\r\nSQLITE_PRIVATE int sqlite3VdbeSorterCompare(VdbeCursor *, Mem *, int *);\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0\r\nSQLITE_PRIVATE   void sqlite3VdbeEnter(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3VdbeLeave(Vdbe*);\r\n#else\r\n# define sqlite3VdbeEnter(X)\r\n# define sqlite3VdbeLeave(X)\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\nSQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);\r\n#else\r\n# define sqlite3VdbeCheckFk(p,i) 0\r\n#endif\r\n\r\nSQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE   void sqlite3VdbePrintSql(Vdbe*);\r\nSQLITE_PRIVATE   void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);\r\n#endif\r\nSQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\nSQLITE_PRIVATE   int sqlite3VdbeMemExpandBlob(Mem *);\r\n  #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)\r\n#else\r\n  #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK\r\n  #define ExpandBlob(P) SQLITE_OK\r\n#endif\r\n\r\n#endif /* !defined(_VDBEINT_H_) */\r\n\r\n/************** End of vdbeInt.h *********************************************/\r\n/************** Continuing where we left off in status.c *********************/\r\n\r\n/*\r\n** Variables in which to record status information.\r\n*/\r\ntypedef struct sqlite3StatType sqlite3StatType;\r\nstatic SQLITE_WSD struct sqlite3StatType {\r\n  int nowValue[10];         /* Current value */\r\n  int mxValue[10];          /* Maximum value */\r\n} sqlite3Stat = { {0,}, {0,} };\r\n\r\n\r\n/* The \"wsdStat\" macro will resolve to the status information\r\n** state vector.  If writable static data is unsupported on the target,\r\n** we have to locate the state vector at run-time.  In the more common\r\n** case where writable static data is supported, wsdStat can refer directly\r\n** to the \"sqlite3Stat\" state vector declared above.\r\n*/\r\n#ifdef SQLITE_OMIT_WSD\r\n# define wsdStatInit  sqlite3StatType *x = &GLOBAL(sqlite3StatType,sqlite3Stat)\r\n# define wsdStat x[0]\r\n#else\r\n# define wsdStatInit\r\n# define wsdStat sqlite3Stat\r\n#endif\r\n\r\n/*\r\n** Return the current value of a status parameter.\r\n*/\r\nSQLITE_PRIVATE int sqlite3StatusValue(int op){\r\n  wsdStatInit;\r\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\r\n  return wsdStat.nowValue[op];\r\n}\r\n\r\n/*\r\n** Add N to the value of a status record.  It is assumed that the\r\n** caller holds appropriate locks.\r\n*/\r\nSQLITE_PRIVATE void sqlite3StatusAdd(int op, int N){\r\n  wsdStatInit;\r\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\r\n  wsdStat.nowValue[op] += N;\r\n  if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){\r\n    wsdStat.mxValue[op] = wsdStat.nowValue[op];\r\n  }\r\n}\r\n\r\n/*\r\n** Set the value of a status to X.\r\n*/\r\nSQLITE_PRIVATE void sqlite3StatusSet(int op, int X){\r\n  wsdStatInit;\r\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\r\n  wsdStat.nowValue[op] = X;\r\n  if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){\r\n    wsdStat.mxValue[op] = wsdStat.nowValue[op];\r\n  }\r\n}\r\n\r\n/*\r\n** Query status information.\r\n**\r\n** This implementation assumes that reading or writing an aligned\r\n** 32-bit integer is an atomic operation.  If that assumption is not true,\r\n** then this routine is not threadsafe.\r\n*/\r\nSQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){\r\n  wsdStatInit;\r\n  if( op<0 || op>=ArraySize(wsdStat.nowValue) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  *pCurrent = wsdStat.nowValue[op];\r\n  *pHighwater = wsdStat.mxValue[op];\r\n  if( resetFlag ){\r\n    wsdStat.mxValue[op] = wsdStat.nowValue[op];\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Query status information for a single database connection\r\n*/\r\nSQLITE_API int sqlite3_db_status(\r\n  sqlite3 *db,          /* The database connection whose status is desired */\r\n  int op,               /* Status verb */\r\n  int *pCurrent,        /* Write current value here */\r\n  int *pHighwater,      /* Write high-water mark here */\r\n  int resetFlag         /* Reset high-water mark if true */\r\n){\r\n  int rc = SQLITE_OK;   /* Return code */\r\n  sqlite3_mutex_enter(db->mutex);\r\n  switch( op ){\r\n    case SQLITE_DBSTATUS_LOOKASIDE_USED: {\r\n      *pCurrent = db->lookaside.nOut;\r\n      *pHighwater = db->lookaside.mxOut;\r\n      if( resetFlag ){\r\n        db->lookaside.mxOut = db->lookaside.nOut;\r\n      }\r\n      break;\r\n    }\r\n\r\n    case SQLITE_DBSTATUS_LOOKASIDE_HIT:\r\n    case SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE:\r\n    case SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: {\r\n      testcase( op==SQLITE_DBSTATUS_LOOKASIDE_HIT );\r\n      testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE );\r\n      testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL );\r\n      assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)>=0 );\r\n      assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)<3 );\r\n      *pCurrent = 0;\r\n      *pHighwater = db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT];\r\n      if( resetFlag ){\r\n        db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0;\r\n      }\r\n      break;\r\n    }\r\n\r\n    /* \r\n    ** Return an approximation for the amount of memory currently used\r\n    ** by all pagers associated with the given database connection.  The\r\n    ** highwater mark is meaningless and is returned as zero.\r\n    */\r\n    case SQLITE_DBSTATUS_CACHE_USED: {\r\n      int totalUsed = 0;\r\n      int i;\r\n      sqlite3BtreeEnterAll(db);\r\n      for(i=0; i<db->nDb; i++){\r\n        Btree *pBt = db->aDb[i].pBt;\r\n        if( pBt ){\r\n          Pager *pPager = sqlite3BtreePager(pBt);\r\n          totalUsed += sqlite3PagerMemUsed(pPager);\r\n        }\r\n      }\r\n      sqlite3BtreeLeaveAll(db);\r\n      *pCurrent = totalUsed;\r\n      *pHighwater = 0;\r\n      break;\r\n    }\r\n\r\n    /*\r\n    ** *pCurrent gets an accurate estimate of the amount of memory used\r\n    ** to store the schema for all databases (main, temp, and any ATTACHed\r\n    ** databases.  *pHighwater is set to zero.\r\n    */\r\n    case SQLITE_DBSTATUS_SCHEMA_USED: {\r\n      int i;                      /* Used to iterate through schemas */\r\n      int nByte = 0;              /* Used to accumulate return value */\r\n\r\n      sqlite3BtreeEnterAll(db);\r\n      db->pnBytesFreed = &nByte;\r\n      for(i=0; i<db->nDb; i++){\r\n        Schema *pSchema = db->aDb[i].pSchema;\r\n        if( ALWAYS(pSchema!=0) ){\r\n          HashElem *p;\r\n\r\n          nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * (\r\n              pSchema->tblHash.count \r\n            + pSchema->trigHash.count\r\n            + pSchema->idxHash.count\r\n            + pSchema->fkeyHash.count\r\n          );\r\n          nByte += sqlite3MallocSize(pSchema->tblHash.ht);\r\n          nByte += sqlite3MallocSize(pSchema->trigHash.ht);\r\n          nByte += sqlite3MallocSize(pSchema->idxHash.ht);\r\n          nByte += sqlite3MallocSize(pSchema->fkeyHash.ht);\r\n\r\n          for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){\r\n            sqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p));\r\n          }\r\n          for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){\r\n            sqlite3DeleteTable(db, (Table *)sqliteHashData(p));\r\n          }\r\n        }\r\n      }\r\n      db->pnBytesFreed = 0;\r\n      sqlite3BtreeLeaveAll(db);\r\n\r\n      *pHighwater = 0;\r\n      *pCurrent = nByte;\r\n      break;\r\n    }\r\n\r\n    /*\r\n    ** *pCurrent gets an accurate estimate of the amount of memory used\r\n    ** to store all prepared statements.\r\n    ** *pHighwater is set to zero.\r\n    */\r\n    case SQLITE_DBSTATUS_STMT_USED: {\r\n      struct Vdbe *pVdbe;         /* Used to iterate through VMs */\r\n      int nByte = 0;              /* Used to accumulate return value */\r\n\r\n      db->pnBytesFreed = &nByte;\r\n      for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){\r\n        sqlite3VdbeDeleteObject(db, pVdbe);\r\n      }\r\n      db->pnBytesFreed = 0;\r\n\r\n      *pHighwater = 0;\r\n      *pCurrent = nByte;\r\n\r\n      break;\r\n    }\r\n\r\n    /*\r\n    ** Set *pCurrent to the total cache hits or misses encountered by all\r\n    ** pagers the database handle is connected to. *pHighwater is always set \r\n    ** to zero.\r\n    */\r\n    case SQLITE_DBSTATUS_CACHE_HIT:\r\n    case SQLITE_DBSTATUS_CACHE_MISS: {\r\n      int i;\r\n      int nRet = 0;\r\n      assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 );\r\n\r\n      for(i=0; i<db->nDb; i++){\r\n        if( db->aDb[i].pBt ){\r\n          Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);\r\n          sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet);\r\n        }\r\n      }\r\n      *pHighwater = 0;\r\n      *pCurrent = nRet;\r\n      break;\r\n    }\r\n\r\n    default: {\r\n      rc = SQLITE_ERROR;\r\n    }\r\n  }\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/************** End of status.c **********************************************/\r\n/************** Begin file date.c ********************************************/\r\n/*\r\n** 2003 October 31\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement date and time\r\n** functions for SQLite.  \r\n**\r\n** There is only one exported symbol in this file - the function\r\n** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.\r\n** All other code has file scope.\r\n**\r\n** SQLite processes all times and dates as Julian Day numbers.  The\r\n** dates and times are stored as the number of days since noon\r\n** in Greenwich on November 24, 4714 B.C. according to the Gregorian\r\n** calendar system. \r\n**\r\n** 1970-01-01 00:00:00 is JD 2440587.5\r\n** 2000-01-01 00:00:00 is JD 2451544.5\r\n**\r\n** This implemention requires years to be expressed as a 4-digit number\r\n** which means that only dates between 0000-01-01 and 9999-12-31 can\r\n** be represented, even though julian day numbers allow a much wider\r\n** range of dates.\r\n**\r\n** The Gregorian calendar system is used for all dates and times,\r\n** even those that predate the Gregorian calendar.  Historians usually\r\n** use the Julian calendar for dates prior to 1582-10-15 and for some\r\n** dates afterwards, depending on locale.  Beware of this difference.\r\n**\r\n** The conversion algorithms are implemented based on descriptions\r\n** in the following text:\r\n**\r\n**      Jean Meeus\r\n**      Astronomical Algorithms, 2nd Edition, 1998\r\n**      ISBM 0-943396-61-1\r\n**      Willmann-Bell, Inc\r\n**      Richmond, Virginia (USA)\r\n*/\r\n/* #include <stdlib.h> */\r\n/* #include <assert.h> */\r\n#include <time.h>\r\n\r\n#ifndef SQLITE_OMIT_DATETIME_FUNCS\r\n\r\n\r\n/*\r\n** A structure for holding a single date and time.\r\n*/\r\ntypedef struct DateTime DateTime;\r\nstruct DateTime {\r\n  sqlite3_int64 iJD; /* The julian day number times 86400000 */\r\n  int Y, M, D;       /* Year, month, and day */\r\n  int h, m;          /* Hour and minutes */\r\n  int tz;            /* Timezone offset in minutes */\r\n  double s;          /* Seconds */\r\n  char validYMD;     /* True (1) if Y,M,D are valid */\r\n  char validHMS;     /* True (1) if h,m,s are valid */\r\n  char validJD;      /* True (1) if iJD is valid */\r\n  char validTZ;      /* True (1) if tz is valid */\r\n};\r\n\r\n\r\n/*\r\n** Convert zDate into one or more integers.  Additional arguments\r\n** come in groups of 5 as follows:\r\n**\r\n**       N       number of digits in the integer\r\n**       min     minimum allowed value of the integer\r\n**       max     maximum allowed value of the integer\r\n**       nextC   first character after the integer\r\n**       pVal    where to write the integers value.\r\n**\r\n** Conversions continue until one with nextC==0 is encountered.\r\n** The function returns the number of successful conversions.\r\n*/\r\nstatic int getDigits(const char *zDate, ...){\r\n  va_list ap;\r\n  int val;\r\n  int N;\r\n  int min;\r\n  int max;\r\n  int nextC;\r\n  int *pVal;\r\n  int cnt = 0;\r\n  va_start(ap, zDate);\r\n  do{\r\n    N = va_arg(ap, int);\r\n    min = va_arg(ap, int);\r\n    max = va_arg(ap, int);\r\n    nextC = va_arg(ap, int);\r\n    pVal = va_arg(ap, int*);\r\n    val = 0;\r\n    while( N-- ){\r\n      if( !sqlite3Isdigit(*zDate) ){\r\n        goto end_getDigits;\r\n      }\r\n      val = val*10 + *zDate - '0';\r\n      zDate++;\r\n    }\r\n    if( val<min || val>max || (nextC!=0 && nextC!=*zDate) ){\r\n      goto end_getDigits;\r\n    }\r\n    *pVal = val;\r\n    zDate++;\r\n    cnt++;\r\n  }while( nextC );\r\nend_getDigits:\r\n  va_end(ap);\r\n  return cnt;\r\n}\r\n\r\n/*\r\n** Parse a timezone extension on the end of a date-time.\r\n** The extension is of the form:\r\n**\r\n**        (+/-)HH:MM\r\n**\r\n** Or the \"zulu\" notation:\r\n**\r\n**        Z\r\n**\r\n** If the parse is successful, write the number of minutes\r\n** of change in p->tz and return 0.  If a parser error occurs,\r\n** return non-zero.\r\n**\r\n** A missing specifier is not considered an error.\r\n*/\r\nstatic int parseTimezone(const char *zDate, DateTime *p){\r\n  int sgn = 0;\r\n  int nHr, nMn;\r\n  int c;\r\n  while( sqlite3Isspace(*zDate) ){ zDate++; }\r\n  p->tz = 0;\r\n  c = *zDate;\r\n  if( c=='-' ){\r\n    sgn = -1;\r\n  }else if( c=='+' ){\r\n    sgn = +1;\r\n  }else if( c=='Z' || c=='z' ){\r\n    zDate++;\r\n    goto zulu_time;\r\n  }else{\r\n    return c!=0;\r\n  }\r\n  zDate++;\r\n  if( getDigits(zDate, 2, 0, 14, ':', &nHr, 2, 0, 59, 0, &nMn)!=2 ){\r\n    return 1;\r\n  }\r\n  zDate += 5;\r\n  p->tz = sgn*(nMn + nHr*60);\r\nzulu_time:\r\n  while( sqlite3Isspace(*zDate) ){ zDate++; }\r\n  return *zDate!=0;\r\n}\r\n\r\n/*\r\n** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.\r\n** The HH, MM, and SS must each be exactly 2 digits.  The\r\n** fractional seconds FFFF can be one or more digits.\r\n**\r\n** Return 1 if there is a parsing error and 0 on success.\r\n*/\r\nstatic int parseHhMmSs(const char *zDate, DateTime *p){\r\n  int h, m, s;\r\n  double ms = 0.0;\r\n  if( getDigits(zDate, 2, 0, 24, ':', &h, 2, 0, 59, 0, &m)!=2 ){\r\n    return 1;\r\n  }\r\n  zDate += 5;\r\n  if( *zDate==':' ){\r\n    zDate++;\r\n    if( getDigits(zDate, 2, 0, 59, 0, &s)!=1 ){\r\n      return 1;\r\n    }\r\n    zDate += 2;\r\n    if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){\r\n      double rScale = 1.0;\r\n      zDate++;\r\n      while( sqlite3Isdigit(*zDate) ){\r\n        ms = ms*10.0 + *zDate - '0';\r\n        rScale *= 10.0;\r\n        zDate++;\r\n      }\r\n      ms /= rScale;\r\n    }\r\n  }else{\r\n    s = 0;\r\n  }\r\n  p->validJD = 0;\r\n  p->validHMS = 1;\r\n  p->h = h;\r\n  p->m = m;\r\n  p->s = s + ms;\r\n  if( parseTimezone(zDate, p) ) return 1;\r\n  p->validTZ = (p->tz!=0)?1:0;\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Convert from YYYY-MM-DD HH:MM:SS to julian day.  We always assume\r\n** that the YYYY-MM-DD is according to the Gregorian calendar.\r\n**\r\n** Reference:  Meeus page 61\r\n*/\r\nstatic void computeJD(DateTime *p){\r\n  int Y, M, D, A, B, X1, X2;\r\n\r\n  if( p->validJD ) return;\r\n  if( p->validYMD ){\r\n    Y = p->Y;\r\n    M = p->M;\r\n    D = p->D;\r\n  }else{\r\n    Y = 2000;  /* If no YMD specified, assume 2000-Jan-01 */\r\n    M = 1;\r\n    D = 1;\r\n  }\r\n  if( M<=2 ){\r\n    Y--;\r\n    M += 12;\r\n  }\r\n  A = Y/100;\r\n  B = 2 - A + (A/4);\r\n  X1 = 36525*(Y+4716)/100;\r\n  X2 = 306001*(M+1)/10000;\r\n  p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000);\r\n  p->validJD = 1;\r\n  if( p->validHMS ){\r\n    p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000);\r\n    if( p->validTZ ){\r\n      p->iJD -= p->tz*60000;\r\n      p->validYMD = 0;\r\n      p->validHMS = 0;\r\n      p->validTZ = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Parse dates of the form\r\n**\r\n**     YYYY-MM-DD HH:MM:SS.FFF\r\n**     YYYY-MM-DD HH:MM:SS\r\n**     YYYY-MM-DD HH:MM\r\n**     YYYY-MM-DD\r\n**\r\n** Write the result into the DateTime structure and return 0\r\n** on success and 1 if the input string is not a well-formed\r\n** date.\r\n*/\r\nstatic int parseYyyyMmDd(const char *zDate, DateTime *p){\r\n  int Y, M, D, neg;\r\n\r\n  if( zDate[0]=='-' ){\r\n    zDate++;\r\n    neg = 1;\r\n  }else{\r\n    neg = 0;\r\n  }\r\n  if( getDigits(zDate,4,0,9999,'-',&Y,2,1,12,'-',&M,2,1,31,0,&D)!=3 ){\r\n    return 1;\r\n  }\r\n  zDate += 10;\r\n  while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; }\r\n  if( parseHhMmSs(zDate, p)==0 ){\r\n    /* We got the time */\r\n  }else if( *zDate==0 ){\r\n    p->validHMS = 0;\r\n  }else{\r\n    return 1;\r\n  }\r\n  p->validJD = 0;\r\n  p->validYMD = 1;\r\n  p->Y = neg ? -Y : Y;\r\n  p->M = M;\r\n  p->D = D;\r\n  if( p->validTZ ){\r\n    computeJD(p);\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Set the time to the current time reported by the VFS.\r\n**\r\n** Return the number of errors.\r\n*/\r\nstatic int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  if( sqlite3OsCurrentTimeInt64(db->pVfs, &p->iJD)==SQLITE_OK ){\r\n    p->validJD = 1;\r\n    return 0;\r\n  }else{\r\n    return 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Attempt to parse the given string into a Julian Day Number.  Return\r\n** the number of errors.\r\n**\r\n** The following are acceptable forms for the input string:\r\n**\r\n**      YYYY-MM-DD HH:MM:SS.FFF  +/-HH:MM\r\n**      DDDD.DD \r\n**      now\r\n**\r\n** In the first form, the +/-HH:MM is always optional.  The fractional\r\n** seconds extension (the \".FFF\") is optional.  The seconds portion\r\n** (\":SS.FFF\") is option.  The year and date can be omitted as long\r\n** as there is a time string.  The time string can be omitted as long\r\n** as there is a year and date.\r\n*/\r\nstatic int parseDateOrTime(\r\n  sqlite3_context *context, \r\n  const char *zDate, \r\n  DateTime *p\r\n){\r\n  double r;\r\n  if( parseYyyyMmDd(zDate,p)==0 ){\r\n    return 0;\r\n  }else if( parseHhMmSs(zDate, p)==0 ){\r\n    return 0;\r\n  }else if( sqlite3StrICmp(zDate,\"now\")==0){\r\n    return setDateTimeToCurrent(context, p);\r\n  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){\r\n    p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);\r\n    p->validJD = 1;\r\n    return 0;\r\n  }\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Compute the Year, Month, and Day from the julian day number.\r\n*/\r\nstatic void computeYMD(DateTime *p){\r\n  int Z, A, B, C, D, E, X1;\r\n  if( p->validYMD ) return;\r\n  if( !p->validJD ){\r\n    p->Y = 2000;\r\n    p->M = 1;\r\n    p->D = 1;\r\n  }else{\r\n    Z = (int)((p->iJD + 43200000)/86400000);\r\n    A = (int)((Z - 1867216.25)/36524.25);\r\n    A = Z + 1 + A - (A/4);\r\n    B = A + 1524;\r\n    C = (int)((B - 122.1)/365.25);\r\n    D = (36525*C)/100;\r\n    E = (int)((B-D)/30.6001);\r\n    X1 = (int)(30.6001*E);\r\n    p->D = B - D - X1;\r\n    p->M = E<14 ? E-1 : E-13;\r\n    p->Y = p->M>2 ? C - 4716 : C - 4715;\r\n  }\r\n  p->validYMD = 1;\r\n}\r\n\r\n/*\r\n** Compute the Hour, Minute, and Seconds from the julian day number.\r\n*/\r\nstatic void computeHMS(DateTime *p){\r\n  int s;\r\n  if( p->validHMS ) return;\r\n  computeJD(p);\r\n  s = (int)((p->iJD + 43200000) % 86400000);\r\n  p->s = s/1000.0;\r\n  s = (int)p->s;\r\n  p->s -= s;\r\n  p->h = s/3600;\r\n  s -= p->h*3600;\r\n  p->m = s/60;\r\n  p->s += s - p->m*60;\r\n  p->validHMS = 1;\r\n}\r\n\r\n/*\r\n** Compute both YMD and HMS\r\n*/\r\nstatic void computeYMD_HMS(DateTime *p){\r\n  computeYMD(p);\r\n  computeHMS(p);\r\n}\r\n\r\n/*\r\n** Clear the YMD and HMS and the TZ\r\n*/\r\nstatic void clearYMD_HMS_TZ(DateTime *p){\r\n  p->validYMD = 0;\r\n  p->validHMS = 0;\r\n  p->validTZ = 0;\r\n}\r\n\r\n/*\r\n** On recent Windows platforms, the localtime_s() function is available\r\n** as part of the \"Secure CRT\". It is essentially equivalent to \r\n** localtime_r() available under most POSIX platforms, except that the \r\n** order of the parameters is reversed.\r\n**\r\n** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.\r\n**\r\n** If the user has not indicated to use localtime_r() or localtime_s()\r\n** already, check for an MSVC build environment that provides \r\n** localtime_s().\r\n*/\r\n#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \\\r\n     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)\r\n#define HAVE_LOCALTIME_S 1\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_LOCALTIME\r\n/*\r\n** The following routine implements the rough equivalent of localtime_r()\r\n** using whatever operating-system specific localtime facility that\r\n** is available.  This routine returns 0 on success and\r\n** non-zero on any kind of error.\r\n**\r\n** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this\r\n** routine will always fail.\r\n*/\r\nstatic int osLocaltime(time_t *t, struct tm *pTm){\r\n  int rc;\r\n#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \\\r\n      && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S)\r\n  struct tm *pX;\r\n#if SQLITE_THREADSAFE>0\r\n  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n#endif\r\n  sqlite3_mutex_enter(mutex);\r\n  pX = localtime(t);\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\n  if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;\r\n#endif\r\n  if( pX ) *pTm = *pX;\r\n  sqlite3_mutex_leave(mutex);\r\n  rc = pX==0;\r\n#else\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\n  if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;\r\n#endif\r\n#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R\r\n  rc = localtime_r(t, pTm)==0;\r\n#else\r\n  rc = localtime_s(pTm, t);\r\n#endif /* HAVE_LOCALTIME_R */\r\n#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_LOCALTIME */\r\n\r\n\r\n#ifndef SQLITE_OMIT_LOCALTIME\r\n/*\r\n** Compute the difference (in milliseconds) between localtime and UTC\r\n** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs,\r\n** return this value and set *pRc to SQLITE_OK. \r\n**\r\n** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value\r\n** is undefined in this case.\r\n*/\r\nstatic sqlite3_int64 localtimeOffset(\r\n  DateTime *p,                    /* Date at which to calculate offset */\r\n  sqlite3_context *pCtx,          /* Write error here if one occurs */\r\n  int *pRc                        /* OUT: Error code. SQLITE_OK or ERROR */\r\n){\r\n  DateTime x, y;\r\n  time_t t;\r\n  struct tm sLocal;\r\n\r\n  /* Initialize the contents of sLocal to avoid a compiler warning. */\r\n  memset(&sLocal, 0, sizeof(sLocal));\r\n\r\n  x = *p;\r\n  computeYMD_HMS(&x);\r\n  if( x.Y<1971 || x.Y>=2038 ){\r\n    x.Y = 2000;\r\n    x.M = 1;\r\n    x.D = 1;\r\n    x.h = 0;\r\n    x.m = 0;\r\n    x.s = 0.0;\r\n  } else {\r\n    int s = (int)(x.s + 0.5);\r\n    x.s = s;\r\n  }\r\n  x.tz = 0;\r\n  x.validJD = 0;\r\n  computeJD(&x);\r\n  t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);\r\n  if( osLocaltime(&t, &sLocal) ){\r\n    sqlite3_result_error(pCtx, \"local time unavailable\", -1);\r\n    *pRc = SQLITE_ERROR;\r\n    return 0;\r\n  }\r\n  y.Y = sLocal.tm_year + 1900;\r\n  y.M = sLocal.tm_mon + 1;\r\n  y.D = sLocal.tm_mday;\r\n  y.h = sLocal.tm_hour;\r\n  y.m = sLocal.tm_min;\r\n  y.s = sLocal.tm_sec;\r\n  y.validYMD = 1;\r\n  y.validHMS = 1;\r\n  y.validJD = 0;\r\n  y.validTZ = 0;\r\n  computeJD(&y);\r\n  *pRc = SQLITE_OK;\r\n  return y.iJD - x.iJD;\r\n}\r\n#endif /* SQLITE_OMIT_LOCALTIME */\r\n\r\n/*\r\n** Process a modifier to a date-time stamp.  The modifiers are\r\n** as follows:\r\n**\r\n**     NNN days\r\n**     NNN hours\r\n**     NNN minutes\r\n**     NNN.NNNN seconds\r\n**     NNN months\r\n**     NNN years\r\n**     start of month\r\n**     start of year\r\n**     start of week\r\n**     start of day\r\n**     weekday N\r\n**     unixepoch\r\n**     localtime\r\n**     utc\r\n**\r\n** Return 0 on success and 1 if there is any kind of error. If the error\r\n** is in a system call (i.e. localtime()), then an error message is written\r\n** to context pCtx. If the error is an unrecognized modifier, no error is\r\n** written to pCtx.\r\n*/\r\nstatic int parseModifier(sqlite3_context *pCtx, const char *zMod, DateTime *p){\r\n  int rc = 1;\r\n  int n;\r\n  double r;\r\n  char *z, zBuf[30];\r\n  z = zBuf;\r\n  for(n=0; n<ArraySize(zBuf)-1 && zMod[n]; n++){\r\n    z[n] = (char)sqlite3UpperToLower[(u8)zMod[n]];\r\n  }\r\n  z[n] = 0;\r\n  switch( z[0] ){\r\n#ifndef SQLITE_OMIT_LOCALTIME\r\n    case 'l': {\r\n      /*    localtime\r\n      **\r\n      ** Assuming the current time value is UTC (a.k.a. GMT), shift it to\r\n      ** show local time.\r\n      */\r\n      if( strcmp(z, \"localtime\")==0 ){\r\n        computeJD(p);\r\n        p->iJD += localtimeOffset(p, pCtx, &rc);\r\n        clearYMD_HMS_TZ(p);\r\n      }\r\n      break;\r\n    }\r\n#endif\r\n    case 'u': {\r\n      /*\r\n      **    unixepoch\r\n      **\r\n      ** Treat the current value of p->iJD as the number of\r\n      ** seconds since 1970.  Convert to a real julian day number.\r\n      */\r\n      if( strcmp(z, \"unixepoch\")==0 && p->validJD ){\r\n        p->iJD = (p->iJD + 43200)/86400 + 21086676*(i64)10000000;\r\n        clearYMD_HMS_TZ(p);\r\n        rc = 0;\r\n      }\r\n#ifndef SQLITE_OMIT_LOCALTIME\r\n      else if( strcmp(z, \"utc\")==0 ){\r\n        sqlite3_int64 c1;\r\n        computeJD(p);\r\n        c1 = localtimeOffset(p, pCtx, &rc);\r\n        if( rc==SQLITE_OK ){\r\n          p->iJD -= c1;\r\n          clearYMD_HMS_TZ(p);\r\n          p->iJD += c1 - localtimeOffset(p, pCtx, &rc);\r\n        }\r\n      }\r\n#endif\r\n      break;\r\n    }\r\n    case 'w': {\r\n      /*\r\n      **    weekday N\r\n      **\r\n      ** Move the date to the same time on the next occurrence of\r\n      ** weekday N where 0==Sunday, 1==Monday, and so forth.  If the\r\n      ** date is already on the appropriate weekday, this is a no-op.\r\n      */\r\n      if( strncmp(z, \"weekday \", 8)==0\r\n               && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)\r\n               && (n=(int)r)==r && n>=0 && r<7 ){\r\n        sqlite3_int64 Z;\r\n        computeYMD_HMS(p);\r\n        p->validTZ = 0;\r\n        p->validJD = 0;\r\n        computeJD(p);\r\n        Z = ((p->iJD + 129600000)/86400000) % 7;\r\n        if( Z>n ) Z -= 7;\r\n        p->iJD += (n - Z)*86400000;\r\n        clearYMD_HMS_TZ(p);\r\n        rc = 0;\r\n      }\r\n      break;\r\n    }\r\n    case 's': {\r\n      /*\r\n      **    start of TTTTT\r\n      **\r\n      ** Move the date backwards to the beginning of the current day,\r\n      ** or month or year.\r\n      */\r\n      if( strncmp(z, \"start of \", 9)!=0 ) break;\r\n      z += 9;\r\n      computeYMD(p);\r\n      p->validHMS = 1;\r\n      p->h = p->m = 0;\r\n      p->s = 0.0;\r\n      p->validTZ = 0;\r\n      p->validJD = 0;\r\n      if( strcmp(z,\"month\")==0 ){\r\n        p->D = 1;\r\n        rc = 0;\r\n      }else if( strcmp(z,\"year\")==0 ){\r\n        computeYMD(p);\r\n        p->M = 1;\r\n        p->D = 1;\r\n        rc = 0;\r\n      }else if( strcmp(z,\"day\")==0 ){\r\n        rc = 0;\r\n      }\r\n      break;\r\n    }\r\n    case '+':\r\n    case '-':\r\n    case '0':\r\n    case '1':\r\n    case '2':\r\n    case '3':\r\n    case '4':\r\n    case '5':\r\n    case '6':\r\n    case '7':\r\n    case '8':\r\n    case '9': {\r\n      double rRounder;\r\n      for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}\r\n      if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){\r\n        rc = 1;\r\n        break;\r\n      }\r\n      if( z[n]==':' ){\r\n        /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the\r\n        ** specified number of hours, minutes, seconds, and fractional seconds\r\n        ** to the time.  The \".FFF\" may be omitted.  The \":SS.FFF\" may be\r\n        ** omitted.\r\n        */\r\n        const char *z2 = z;\r\n        DateTime tx;\r\n        sqlite3_int64 day;\r\n        if( !sqlite3Isdigit(*z2) ) z2++;\r\n        memset(&tx, 0, sizeof(tx));\r\n        if( parseHhMmSs(z2, &tx) ) break;\r\n        computeJD(&tx);\r\n        tx.iJD -= 43200000;\r\n        day = tx.iJD/86400000;\r\n        tx.iJD -= day*86400000;\r\n        if( z[0]=='-' ) tx.iJD = -tx.iJD;\r\n        computeJD(p);\r\n        clearYMD_HMS_TZ(p);\r\n        p->iJD += tx.iJD;\r\n        rc = 0;\r\n        break;\r\n      }\r\n      z += n;\r\n      while( sqlite3Isspace(*z) ) z++;\r\n      n = sqlite3Strlen30(z);\r\n      if( n>10 || n<3 ) break;\r\n      if( z[n-1]=='s' ){ z[n-1] = 0; n--; }\r\n      computeJD(p);\r\n      rc = 0;\r\n      rRounder = r<0 ? -0.5 : +0.5;\r\n      if( n==3 && strcmp(z,\"day\")==0 ){\r\n        p->iJD += (sqlite3_int64)(r*86400000.0 + rRounder);\r\n      }else if( n==4 && strcmp(z,\"hour\")==0 ){\r\n        p->iJD += (sqlite3_int64)(r*(86400000.0/24.0) + rRounder);\r\n      }else if( n==6 && strcmp(z,\"minute\")==0 ){\r\n        p->iJD += (sqlite3_int64)(r*(86400000.0/(24.0*60.0)) + rRounder);\r\n      }else if( n==6 && strcmp(z,\"second\")==0 ){\r\n        p->iJD += (sqlite3_int64)(r*(86400000.0/(24.0*60.0*60.0)) + rRounder);\r\n      }else if( n==5 && strcmp(z,\"month\")==0 ){\r\n        int x, y;\r\n        computeYMD_HMS(p);\r\n        p->M += (int)r;\r\n        x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;\r\n        p->Y += x;\r\n        p->M -= x*12;\r\n        p->validJD = 0;\r\n        computeJD(p);\r\n        y = (int)r;\r\n        if( y!=r ){\r\n          p->iJD += (sqlite3_int64)((r - y)*30.0*86400000.0 + rRounder);\r\n        }\r\n      }else if( n==4 && strcmp(z,\"year\")==0 ){\r\n        int y = (int)r;\r\n        computeYMD_HMS(p);\r\n        p->Y += y;\r\n        p->validJD = 0;\r\n        computeJD(p);\r\n        if( y!=r ){\r\n          p->iJD += (sqlite3_int64)((r - y)*365.0*86400000.0 + rRounder);\r\n        }\r\n      }else{\r\n        rc = 1;\r\n      }\r\n      clearYMD_HMS_TZ(p);\r\n      break;\r\n    }\r\n    default: {\r\n      break;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Process time function arguments.  argv[0] is a date-time stamp.\r\n** argv[1] and following are modifiers.  Parse them all and write\r\n** the resulting time into the DateTime structure p.  Return 0\r\n** on success and 1 if there are any errors.\r\n**\r\n** If there are zero parameters (if even argv[0] is undefined)\r\n** then assume a default value of \"now\" for argv[0].\r\n*/\r\nstatic int isDate(\r\n  sqlite3_context *context, \r\n  int argc, \r\n  sqlite3_value **argv, \r\n  DateTime *p\r\n){\r\n  int i;\r\n  const unsigned char *z;\r\n  int eType;\r\n  memset(p, 0, sizeof(*p));\r\n  if( argc==0 ){\r\n    return setDateTimeToCurrent(context, p);\r\n  }\r\n  if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT\r\n                   || eType==SQLITE_INTEGER ){\r\n    p->iJD = (sqlite3_int64)(sqlite3_value_double(argv[0])*86400000.0 + 0.5);\r\n    p->validJD = 1;\r\n  }else{\r\n    z = sqlite3_value_text(argv[0]);\r\n    if( !z || parseDateOrTime(context, (char*)z, p) ){\r\n      return 1;\r\n    }\r\n  }\r\n  for(i=1; i<argc; i++){\r\n    z = sqlite3_value_text(argv[i]);\r\n    if( z==0 || parseModifier(context, (char*)z, p) ) return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n\r\n/*\r\n** The following routines implement the various date and time functions\r\n** of SQLite.\r\n*/\r\n\r\n/*\r\n**    julianday( TIMESTRING, MOD, MOD, ...)\r\n**\r\n** Return the julian day number of the date specified in the arguments\r\n*/\r\nstatic void juliandayFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  DateTime x;\r\n  if( isDate(context, argc, argv, &x)==0 ){\r\n    computeJD(&x);\r\n    sqlite3_result_double(context, x.iJD/86400000.0);\r\n  }\r\n}\r\n\r\n/*\r\n**    datetime( TIMESTRING, MOD, MOD, ...)\r\n**\r\n** Return YYYY-MM-DD HH:MM:SS\r\n*/\r\nstatic void datetimeFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  DateTime x;\r\n  if( isDate(context, argc, argv, &x)==0 ){\r\n    char zBuf[100];\r\n    computeYMD_HMS(&x);\r\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"%04d-%02d-%02d %02d:%02d:%02d\",\r\n                     x.Y, x.M, x.D, x.h, x.m, (int)(x.s));\r\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\r\n  }\r\n}\r\n\r\n/*\r\n**    time( TIMESTRING, MOD, MOD, ...)\r\n**\r\n** Return HH:MM:SS\r\n*/\r\nstatic void timeFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  DateTime x;\r\n  if( isDate(context, argc, argv, &x)==0 ){\r\n    char zBuf[100];\r\n    computeHMS(&x);\r\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"%02d:%02d:%02d\", x.h, x.m, (int)x.s);\r\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\r\n  }\r\n}\r\n\r\n/*\r\n**    date( TIMESTRING, MOD, MOD, ...)\r\n**\r\n** Return YYYY-MM-DD\r\n*/\r\nstatic void dateFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  DateTime x;\r\n  if( isDate(context, argc, argv, &x)==0 ){\r\n    char zBuf[100];\r\n    computeYMD(&x);\r\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"%04d-%02d-%02d\", x.Y, x.M, x.D);\r\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\r\n  }\r\n}\r\n\r\n/*\r\n**    strftime( FORMAT, TIMESTRING, MOD, MOD, ...)\r\n**\r\n** Return a string described by FORMAT.  Conversions as follows:\r\n**\r\n**   %d  day of month\r\n**   %f  ** fractional seconds  SS.SSS\r\n**   %H  hour 00-24\r\n**   %j  day of year 000-366\r\n**   %J  ** Julian day number\r\n**   %m  month 01-12\r\n**   %M  minute 00-59\r\n**   %s  seconds since 1970-01-01\r\n**   %S  seconds 00-59\r\n**   %w  day of week 0-6  sunday==0\r\n**   %W  week of year 00-53\r\n**   %Y  year 0000-9999\r\n**   %%  %\r\n*/\r\nstatic void strftimeFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  DateTime x;\r\n  u64 n;\r\n  size_t i,j;\r\n  char *z;\r\n  sqlite3 *db;\r\n  const char *zFmt = (const char*)sqlite3_value_text(argv[0]);\r\n  char zBuf[100];\r\n  if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;\r\n  db = sqlite3_context_db_handle(context);\r\n  for(i=0, n=1; zFmt[i]; i++, n++){\r\n    if( zFmt[i]=='%' ){\r\n      switch( zFmt[i+1] ){\r\n        case 'd':\r\n        case 'H':\r\n        case 'm':\r\n        case 'M':\r\n        case 'S':\r\n        case 'W':\r\n          n++;\r\n          /* fall thru */\r\n        case 'w':\r\n        case '%':\r\n          break;\r\n        case 'f':\r\n          n += 8;\r\n          break;\r\n        case 'j':\r\n          n += 3;\r\n          break;\r\n        case 'Y':\r\n          n += 8;\r\n          break;\r\n        case 's':\r\n        case 'J':\r\n          n += 50;\r\n          break;\r\n        default:\r\n          return;  /* ERROR.  return a NULL */\r\n      }\r\n      i++;\r\n    }\r\n  }\r\n  testcase( n==sizeof(zBuf)-1 );\r\n  testcase( n==sizeof(zBuf) );\r\n  testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH]+1 );\r\n  testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH] );\r\n  if( n<sizeof(zBuf) ){\r\n    z = zBuf;\r\n  }else if( n>(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    sqlite3_result_error_toobig(context);\r\n    return;\r\n  }else{\r\n    z = sqlite3DbMallocRaw(db, (int)n);\r\n    if( z==0 ){\r\n      sqlite3_result_error_nomem(context);\r\n      return;\r\n    }\r\n  }\r\n  computeJD(&x);\r\n  computeYMD_HMS(&x);\r\n  for(i=j=0; zFmt[i]; i++){\r\n    if( zFmt[i]!='%' ){\r\n      z[j++] = zFmt[i];\r\n    }else{\r\n      i++;\r\n      switch( zFmt[i] ){\r\n        case 'd':  sqlite3_snprintf(3, &z[j],\"%02d\",x.D); j+=2; break;\r\n        case 'f': {\r\n          double s = x.s;\r\n          if( s>59.999 ) s = 59.999;\r\n          sqlite3_snprintf(7, &z[j],\"%06.3f\", s);\r\n          j += sqlite3Strlen30(&z[j]);\r\n          break;\r\n        }\r\n        case 'H':  sqlite3_snprintf(3, &z[j],\"%02d\",x.h); j+=2; break;\r\n        case 'W': /* Fall thru */\r\n        case 'j': {\r\n          int nDay;             /* Number of days since 1st day of year */\r\n          DateTime y = x;\r\n          y.validJD = 0;\r\n          y.M = 1;\r\n          y.D = 1;\r\n          computeJD(&y);\r\n          nDay = (int)((x.iJD-y.iJD+43200000)/86400000);\r\n          if( zFmt[i]=='W' ){\r\n            int wd;   /* 0=Monday, 1=Tuesday, ... 6=Sunday */\r\n            wd = (int)(((x.iJD+43200000)/86400000)%7);\r\n            sqlite3_snprintf(3, &z[j],\"%02d\",(nDay+7-wd)/7);\r\n            j += 2;\r\n          }else{\r\n            sqlite3_snprintf(4, &z[j],\"%03d\",nDay+1);\r\n            j += 3;\r\n          }\r\n          break;\r\n        }\r\n        case 'J': {\r\n          sqlite3_snprintf(20, &z[j],\"%.16g\",x.iJD/86400000.0);\r\n          j+=sqlite3Strlen30(&z[j]);\r\n          break;\r\n        }\r\n        case 'm':  sqlite3_snprintf(3, &z[j],\"%02d\",x.M); j+=2; break;\r\n        case 'M':  sqlite3_snprintf(3, &z[j],\"%02d\",x.m); j+=2; break;\r\n        case 's': {\r\n          sqlite3_snprintf(30,&z[j],\"%lld\",\r\n                           (i64)(x.iJD/1000 - 21086676*(i64)10000));\r\n          j += sqlite3Strlen30(&z[j]);\r\n          break;\r\n        }\r\n        case 'S':  sqlite3_snprintf(3,&z[j],\"%02d\",(int)x.s); j+=2; break;\r\n        case 'w': {\r\n          z[j++] = (char)(((x.iJD+129600000)/86400000) % 7) + '0';\r\n          break;\r\n        }\r\n        case 'Y': {\r\n          sqlite3_snprintf(5,&z[j],\"%04d\",x.Y); j+=sqlite3Strlen30(&z[j]);\r\n          break;\r\n        }\r\n        default:   z[j++] = '%'; break;\r\n      }\r\n    }\r\n  }\r\n  z[j] = 0;\r\n  sqlite3_result_text(context, z, -1,\r\n                      z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);\r\n}\r\n\r\n/*\r\n** current_time()\r\n**\r\n** This function returns the same value as time('now').\r\n*/\r\nstatic void ctimeFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  timeFunc(context, 0, 0);\r\n}\r\n\r\n/*\r\n** current_date()\r\n**\r\n** This function returns the same value as date('now').\r\n*/\r\nstatic void cdateFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  dateFunc(context, 0, 0);\r\n}\r\n\r\n/*\r\n** current_timestamp()\r\n**\r\n** This function returns the same value as datetime('now').\r\n*/\r\nstatic void ctimestampFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  datetimeFunc(context, 0, 0);\r\n}\r\n#endif /* !defined(SQLITE_OMIT_DATETIME_FUNCS) */\r\n\r\n#ifdef SQLITE_OMIT_DATETIME_FUNCS\r\n/*\r\n** If the library is compiled to omit the full-scale date and time\r\n** handling (to get a smaller binary), the following minimal version\r\n** of the functions current_time(), current_date() and current_timestamp()\r\n** are included instead. This is to support column declarations that\r\n** include \"DEFAULT CURRENT_TIME\" etc.\r\n**\r\n** This function uses the C-library functions time(), gmtime()\r\n** and strftime(). The format string to pass to strftime() is supplied\r\n** as the user-data for the function.\r\n*/\r\nstatic void currentTimeFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  time_t t;\r\n  char *zFormat = (char *)sqlite3_user_data(context);\r\n  sqlite3 *db;\r\n  sqlite3_int64 iT;\r\n  struct tm *pTm;\r\n  struct tm sNow;\r\n  char zBuf[20];\r\n\r\n  UNUSED_PARAMETER(argc);\r\n  UNUSED_PARAMETER(argv);\r\n\r\n  db = sqlite3_context_db_handle(context);\r\n  if( sqlite3OsCurrentTimeInt64(db->pVfs, &iT) ) return;\r\n  t = iT/1000 - 10000*(sqlite3_int64)21086676;\r\n#ifdef HAVE_GMTIME_R\r\n  pTm = gmtime_r(&t, &sNow);\r\n#else\r\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n  pTm = gmtime(&t);\r\n  if( pTm ) memcpy(&sNow, pTm, sizeof(sNow));\r\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n#endif\r\n  if( pTm ){\r\n    strftime(zBuf, 20, zFormat, &sNow);\r\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** This function registered all of the above C functions as SQL\r\n** functions.  This should be the only routine in this file with\r\n** external linkage.\r\n*/\r\nSQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){\r\n  static SQLITE_WSD FuncDef aDateTimeFuncs[] = {\r\n#ifndef SQLITE_OMIT_DATETIME_FUNCS\r\n    FUNCTION(julianday,        -1, 0, 0, juliandayFunc ),\r\n    FUNCTION(date,             -1, 0, 0, dateFunc      ),\r\n    FUNCTION(time,             -1, 0, 0, timeFunc      ),\r\n    FUNCTION(datetime,         -1, 0, 0, datetimeFunc  ),\r\n    FUNCTION(strftime,         -1, 0, 0, strftimeFunc  ),\r\n    FUNCTION(current_time,      0, 0, 0, ctimeFunc     ),\r\n    FUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),\r\n    FUNCTION(current_date,      0, 0, 0, cdateFunc     ),\r\n#else\r\n    STR_FUNCTION(current_time,      0, \"%H:%M:%S\",          0, currentTimeFunc),\r\n    STR_FUNCTION(current_date,      0, \"%Y-%m-%d\",          0, currentTimeFunc),\r\n    STR_FUNCTION(current_timestamp, 0, \"%Y-%m-%d %H:%M:%S\", 0, currentTimeFunc),\r\n#endif\r\n  };\r\n  int i;\r\n  FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);\r\n  FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aDateTimeFuncs);\r\n\r\n  for(i=0; i<ArraySize(aDateTimeFuncs); i++){\r\n    sqlite3FuncDefInsert(pHash, &aFunc[i]);\r\n  }\r\n}\r\n\r\n/************** End of date.c ************************************************/\r\n/************** Begin file os.c **********************************************/\r\n/*\r\n** 2005 November 29\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains OS interface code that is common to all\r\n** architectures.\r\n*/\r\n#define _SQLITE_OS_C_ 1\r\n#undef _SQLITE_OS_C_\r\n\r\n/*\r\n** The default SQLite sqlite3_vfs implementations do not allocate\r\n** memory (actually, os_unix.c allocates a small amount of memory\r\n** from within OsOpen()), but some third-party implementations may.\r\n** So we test the effects of a malloc() failing and the sqlite3OsXXX()\r\n** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro.\r\n**\r\n** The following functions are instrumented for malloc() failure \r\n** testing:\r\n**\r\n**     sqlite3OsRead()\r\n**     sqlite3OsWrite()\r\n**     sqlite3OsSync()\r\n**     sqlite3OsFileSize()\r\n**     sqlite3OsLock()\r\n**     sqlite3OsCheckReservedLock()\r\n**     sqlite3OsFileControl()\r\n**     sqlite3OsShmMap()\r\n**     sqlite3OsOpen()\r\n**     sqlite3OsDelete()\r\n**     sqlite3OsAccess()\r\n**     sqlite3OsFullPathname()\r\n**\r\n*/\r\n#if defined(SQLITE_TEST)\r\nSQLITE_API int sqlite3_memdebug_vfs_oom_test = 1;\r\n  #define DO_OS_MALLOC_TEST(x)                                       \\\r\n  if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) {  \\\r\n    void *pTstAlloc = sqlite3Malloc(10);                             \\\r\n    if (!pTstAlloc) return SQLITE_IOERR_NOMEM;                       \\\r\n    sqlite3_free(pTstAlloc);                                         \\\r\n  }\r\n#else\r\n  #define DO_OS_MALLOC_TEST(x)\r\n#endif\r\n\r\n/*\r\n** The following routines are convenience wrappers around methods\r\n** of the sqlite3_file object.  This is mostly just syntactic sugar. All\r\n** of this would be completely automatic if SQLite were coded using\r\n** C++ instead of plain old C.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OsClose(sqlite3_file *pId){\r\n  int rc = SQLITE_OK;\r\n  if( pId->pMethods ){\r\n    rc = pId->pMethods->xClose(pId);\r\n    pId->pMethods = 0;\r\n  }\r\n  return rc;\r\n}\r\nSQLITE_PRIVATE int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xRead(id, pBuf, amt, offset);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xWrite(id, pBuf, amt, offset);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file *id, i64 size){\r\n  return id->pMethods->xTruncate(id, size);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsSync(sqlite3_file *id, int flags){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xSync(id, flags);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xFileSize(id, pSize);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsLock(sqlite3_file *id, int lockType){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xLock(id, lockType);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file *id, int lockType){\r\n  return id->pMethods->xUnlock(id, lockType);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xCheckReservedLock(id, pResOut);\r\n}\r\n\r\n/*\r\n** Use sqlite3OsFileControl() when we are doing something that might fail\r\n** and we need to know about the failures.  Use sqlite3OsFileControlHint()\r\n** when simply tossing information over the wall to the VFS and we do not\r\n** really care if the VFS receives and understands the information since it\r\n** is only a hint and can be safely ignored.  The sqlite3OsFileControlHint()\r\n** routine has no return value since the return value would be meaningless.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xFileControl(id, op, pArg);\r\n}\r\nSQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){\r\n  (void)id->pMethods->xFileControl(id, op, pArg);\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id){\r\n  int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;\r\n  return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id){\r\n  return id->pMethods->xDeviceCharacteristics(id);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){\r\n  return id->pMethods->xShmLock(id, offset, n, flags);\r\n}\r\nSQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id){\r\n  id->pMethods->xShmBarrier(id);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){\r\n  return id->pMethods->xShmUnmap(id, deleteFlag);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsShmMap(\r\n  sqlite3_file *id,               /* Database file handle */\r\n  int iPage,\r\n  int pgsz,\r\n  int bExtend,                    /* True to extend file if necessary */\r\n  void volatile **pp              /* OUT: Pointer to mapping */\r\n){\r\n  DO_OS_MALLOC_TEST(id);\r\n  return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);\r\n}\r\n\r\n/*\r\n** The next group of routines are convenience wrappers around the\r\n** VFS methods.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OsOpen(\r\n  sqlite3_vfs *pVfs, \r\n  const char *zPath, \r\n  sqlite3_file *pFile, \r\n  int flags, \r\n  int *pFlagsOut\r\n){\r\n  int rc;\r\n  DO_OS_MALLOC_TEST(0);\r\n  /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed\r\n  ** down into the VFS layer.  Some SQLITE_OPEN_ flags (for example,\r\n  ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before\r\n  ** reaching the VFS. */\r\n  rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f7f, pFlagsOut);\r\n  assert( rc==SQLITE_OK || pFile->pMethods==0 );\r\n  return rc;\r\n}\r\nSQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){\r\n  DO_OS_MALLOC_TEST(0);\r\n  assert( dirSync==0 || dirSync==1 );\r\n  return pVfs->xDelete(pVfs, zPath, dirSync);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsAccess(\r\n  sqlite3_vfs *pVfs, \r\n  const char *zPath, \r\n  int flags, \r\n  int *pResOut\r\n){\r\n  DO_OS_MALLOC_TEST(0);\r\n  return pVfs->xAccess(pVfs, zPath, flags, pResOut);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsFullPathname(\r\n  sqlite3_vfs *pVfs, \r\n  const char *zPath, \r\n  int nPathOut, \r\n  char *zPathOut\r\n){\r\n  DO_OS_MALLOC_TEST(0);\r\n  zPathOut[0] = 0;\r\n  return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);\r\n}\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\nSQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){\r\n  return pVfs->xDlOpen(pVfs, zPath);\r\n}\r\nSQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){\r\n  pVfs->xDlError(pVfs, nByte, zBufOut);\r\n}\r\nSQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){\r\n  return pVfs->xDlSym(pVfs, pHdle, zSym);\r\n}\r\nSQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){\r\n  pVfs->xDlClose(pVfs, pHandle);\r\n}\r\n#endif /* SQLITE_OMIT_LOAD_EXTENSION */\r\nSQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){\r\n  return pVfs->xRandomness(pVfs, nByte, zBufOut);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){\r\n  return pVfs->xSleep(pVfs, nMicro);\r\n}\r\nSQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){\r\n  int rc;\r\n  /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64()\r\n  ** method to get the current date and time if that method is available\r\n  ** (if iVersion is 2 or greater and the function pointer is not NULL) and\r\n  ** will fall back to xCurrentTime() if xCurrentTimeInt64() is\r\n  ** unavailable.\r\n  */\r\n  if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){\r\n    rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut);\r\n  }else{\r\n    double r;\r\n    rc = pVfs->xCurrentTime(pVfs, &r);\r\n    *pTimeOut = (sqlite3_int64)(r*86400000.0);\r\n  }\r\n  return rc;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3OsOpenMalloc(\r\n  sqlite3_vfs *pVfs, \r\n  const char *zFile, \r\n  sqlite3_file **ppFile, \r\n  int flags,\r\n  int *pOutFlags\r\n){\r\n  int rc = SQLITE_NOMEM;\r\n  sqlite3_file *pFile;\r\n  pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);\r\n  if( pFile ){\r\n    rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags);\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3_free(pFile);\r\n    }else{\r\n      *ppFile = pFile;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\nSQLITE_PRIVATE int sqlite3OsCloseFree(sqlite3_file *pFile){\r\n  int rc = SQLITE_OK;\r\n  assert( pFile );\r\n  rc = sqlite3OsClose(pFile);\r\n  sqlite3_free(pFile);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is a wrapper around the OS specific implementation of\r\n** sqlite3_os_init(). The purpose of the wrapper is to provide the\r\n** ability to simulate a malloc failure, so that the handling of an\r\n** error in sqlite3_os_init() by the upper layers can be tested.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OsInit(void){\r\n  void *p = sqlite3_malloc(10);\r\n  if( p==0 ) return SQLITE_NOMEM;\r\n  sqlite3_free(p);\r\n  return sqlite3_os_init();\r\n}\r\n\r\n/*\r\n** The list of all registered VFS implementations.\r\n*/\r\nstatic sqlite3_vfs * SQLITE_WSD vfsList = 0;\r\n#define vfsList GLOBAL(sqlite3_vfs *, vfsList)\r\n\r\n/*\r\n** Locate a VFS by name.  If no name is given, simply return the\r\n** first VFS on the list.\r\n*/\r\nSQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){\r\n  sqlite3_vfs *pVfs = 0;\r\n#if SQLITE_THREADSAFE\r\n  sqlite3_mutex *mutex;\r\n#endif\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  int rc = sqlite3_initialize();\r\n  if( rc ) return 0;\r\n#endif\r\n#if SQLITE_THREADSAFE\r\n  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n#endif\r\n  sqlite3_mutex_enter(mutex);\r\n  for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){\r\n    if( zVfs==0 ) break;\r\n    if( strcmp(zVfs, pVfs->zName)==0 ) break;\r\n  }\r\n  sqlite3_mutex_leave(mutex);\r\n  return pVfs;\r\n}\r\n\r\n/*\r\n** Unlink a VFS from the linked list\r\n*/\r\nstatic void vfsUnlink(sqlite3_vfs *pVfs){\r\n  assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) );\r\n  if( pVfs==0 ){\r\n    /* No-op */\r\n  }else if( vfsList==pVfs ){\r\n    vfsList = pVfs->pNext;\r\n  }else if( vfsList ){\r\n    sqlite3_vfs *p = vfsList;\r\n    while( p->pNext && p->pNext!=pVfs ){\r\n      p = p->pNext;\r\n    }\r\n    if( p->pNext==pVfs ){\r\n      p->pNext = pVfs->pNext;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Register a VFS with the system.  It is harmless to register the same\r\n** VFS multiple times.  The new VFS becomes the default if makeDflt is\r\n** true.\r\n*/\r\nSQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){\r\n  MUTEX_LOGIC(sqlite3_mutex *mutex;)\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  int rc = sqlite3_initialize();\r\n  if( rc ) return rc;\r\n#endif\r\n  MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )\r\n  sqlite3_mutex_enter(mutex);\r\n  vfsUnlink(pVfs);\r\n  if( makeDflt || vfsList==0 ){\r\n    pVfs->pNext = vfsList;\r\n    vfsList = pVfs;\r\n  }else{\r\n    pVfs->pNext = vfsList->pNext;\r\n    vfsList->pNext = pVfs;\r\n  }\r\n  assert(vfsList);\r\n  sqlite3_mutex_leave(mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Unregister a VFS so that it is no longer accessible.\r\n*/\r\nSQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){\r\n#if SQLITE_THREADSAFE\r\n  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n#endif\r\n  sqlite3_mutex_enter(mutex);\r\n  vfsUnlink(pVfs);\r\n  sqlite3_mutex_leave(mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/************** End of os.c **************************************************/\r\n/************** Begin file fault.c *******************************************/\r\n/*\r\n** 2008 Jan 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code to support the concept of \"benign\" \r\n** malloc failures (when the xMalloc() or xRealloc() method of the\r\n** sqlite3_mem_methods structure fails to allocate a block of memory\r\n** and returns 0). \r\n**\r\n** Most malloc failures are non-benign. After they occur, SQLite\r\n** abandons the current operation and returns an error code (usually\r\n** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily\r\n** fatal. For example, if a malloc fails while resizing a hash table, this \r\n** is completely recoverable simply by not carrying out the resize. The \r\n** hash table will continue to function normally.  So a malloc failure \r\n** during a hash table resize is a benign fault.\r\n*/\r\n\r\n\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\n\r\n/*\r\n** Global variables.\r\n*/\r\ntypedef struct BenignMallocHooks BenignMallocHooks;\r\nstatic SQLITE_WSD struct BenignMallocHooks {\r\n  void (*xBenignBegin)(void);\r\n  void (*xBenignEnd)(void);\r\n} sqlite3Hooks = { 0, 0 };\r\n\r\n/* The \"wsdHooks\" macro will resolve to the appropriate BenignMallocHooks\r\n** structure.  If writable static data is unsupported on the target,\r\n** we have to locate the state vector at run-time.  In the more common\r\n** case where writable static data is supported, wsdHooks can refer directly\r\n** to the \"sqlite3Hooks\" state vector declared above.\r\n*/\r\n#ifdef SQLITE_OMIT_WSD\r\n# define wsdHooksInit \\\r\n  BenignMallocHooks *x = &GLOBAL(BenignMallocHooks,sqlite3Hooks)\r\n# define wsdHooks x[0]\r\n#else\r\n# define wsdHooksInit\r\n# define wsdHooks sqlite3Hooks\r\n#endif\r\n\r\n\r\n/*\r\n** Register hooks to call when sqlite3BeginBenignMalloc() and\r\n** sqlite3EndBenignMalloc() are called, respectively.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BenignMallocHooks(\r\n  void (*xBenignBegin)(void),\r\n  void (*xBenignEnd)(void)\r\n){\r\n  wsdHooksInit;\r\n  wsdHooks.xBenignBegin = xBenignBegin;\r\n  wsdHooks.xBenignEnd = xBenignEnd;\r\n}\r\n\r\n/*\r\n** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that\r\n** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc()\r\n** indicates that subsequent malloc failures are non-benign.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BeginBenignMalloc(void){\r\n  wsdHooksInit;\r\n  if( wsdHooks.xBenignBegin ){\r\n    wsdHooks.xBenignBegin();\r\n  }\r\n}\r\nSQLITE_PRIVATE void sqlite3EndBenignMalloc(void){\r\n  wsdHooksInit;\r\n  if( wsdHooks.xBenignEnd ){\r\n    wsdHooks.xBenignEnd();\r\n  }\r\n}\r\n\r\n#endif   /* #ifndef SQLITE_OMIT_BUILTIN_TEST */\r\n\r\n/************** End of fault.c ***********************************************/\r\n/************** Begin file mem0.c ********************************************/\r\n/*\r\n** 2008 October 28\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains a no-op memory allocation drivers for use when\r\n** SQLITE_ZERO_MALLOC is defined.  The allocation drivers implemented\r\n** here always fail.  SQLite will not operate with these drivers.  These\r\n** are merely placeholders.  Real drivers must be substituted using\r\n** sqlite3_config() before SQLite will operate.\r\n*/\r\n\r\n/*\r\n** This version of the memory allocator is the default.  It is\r\n** used when no other memory allocator is specified using compile-time\r\n** macros.\r\n*/\r\n#ifdef SQLITE_ZERO_MALLOC\r\n\r\n/*\r\n** No-op versions of all memory allocation routines\r\n*/\r\nstatic void *sqlite3MemMalloc(int nByte){ return 0; }\r\nstatic void sqlite3MemFree(void *pPrior){ return; }\r\nstatic void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; }\r\nstatic int sqlite3MemSize(void *pPrior){ return 0; }\r\nstatic int sqlite3MemRoundup(int n){ return n; }\r\nstatic int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; }\r\nstatic void sqlite3MemShutdown(void *NotUsed){ return; }\r\n\r\n/*\r\n** This routine is the only routine in this file with external linkage.\r\n**\r\n** Populate the low-level memory allocation function pointers in\r\n** sqlite3GlobalConfig.m with pointers to the routines in this file.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemSetDefault(void){\r\n  static const sqlite3_mem_methods defaultMethods = {\r\n     sqlite3MemMalloc,\r\n     sqlite3MemFree,\r\n     sqlite3MemRealloc,\r\n     sqlite3MemSize,\r\n     sqlite3MemRoundup,\r\n     sqlite3MemInit,\r\n     sqlite3MemShutdown,\r\n     0\r\n  };\r\n  sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);\r\n}\r\n\r\n#endif /* SQLITE_ZERO_MALLOC */\r\n\r\n/************** End of mem0.c ************************************************/\r\n/************** Begin file mem1.c ********************************************/\r\n/*\r\n** 2007 August 14\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains low-level memory allocation drivers for when\r\n** SQLite will use the standard C-library malloc/realloc/free interface\r\n** to obtain the memory it needs.\r\n**\r\n** This file contains implementations of the low-level memory allocation\r\n** routines specified in the sqlite3_mem_methods object.  The content of\r\n** this file is only used if SQLITE_SYSTEM_MALLOC is defined.  The\r\n** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the\r\n** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined.  The\r\n** default configuration is to use memory allocation routines in this\r\n** file.\r\n**\r\n** C-preprocessor macro summary:\r\n**\r\n**    HAVE_MALLOC_USABLE_SIZE     The configure script sets this symbol if\r\n**                                the malloc_usable_size() interface exists\r\n**                                on the target platform.  Or, this symbol\r\n**                                can be set manually, if desired.\r\n**                                If an equivalent interface exists by\r\n**                                a different name, using a separate -D\r\n**                                option to rename it.\r\n**\r\n**    SQLITE_WITHOUT_ZONEMALLOC   Some older macs lack support for the zone\r\n**                                memory allocator.  Set this symbol to enable\r\n**                                building on older macs.\r\n**\r\n**    SQLITE_WITHOUT_MSIZE        Set this symbol to disable the use of\r\n**                                _msize() on windows systems.  This might\r\n**                                be necessary when compiling for Delphi,\r\n**                                for example.\r\n*/\r\n\r\n/*\r\n** This version of the memory allocator is the default.  It is\r\n** used when no other memory allocator is specified using compile-time\r\n** macros.\r\n*/\r\n#ifdef SQLITE_SYSTEM_MALLOC\r\n\r\n/*\r\n** The MSVCRT has malloc_usable_size() but it is called _msize().\r\n** The use of _msize() is automatic, but can be disabled by compiling\r\n** with -DSQLITE_WITHOUT_MSIZE\r\n*/\r\n#if defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)\r\n# define SQLITE_MALLOCSIZE _msize\r\n#endif\r\n\r\n#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)\r\n\r\n/*\r\n** Use the zone allocator available on apple products unless the\r\n** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.\r\n*/\r\n#include <sys/sysctl.h>\r\n#include <malloc/malloc.h>\r\n#include <libkern/OSAtomic.h>\r\nstatic malloc_zone_t* _sqliteZone_;\r\n#define SQLITE_MALLOC(x) malloc_zone_malloc(_sqliteZone_, (x))\r\n#define SQLITE_FREE(x) malloc_zone_free(_sqliteZone_, (x));\r\n#define SQLITE_REALLOC(x,y) malloc_zone_realloc(_sqliteZone_, (x), (y))\r\n#define SQLITE_MALLOCSIZE(x) \\\r\n        (_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x))\r\n\r\n#else /* if not __APPLE__ */\r\n\r\n/*\r\n** Use standard C library malloc and free on non-Apple systems.  \r\n** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.\r\n*/\r\n#define SQLITE_MALLOC(x)    malloc(x)\r\n#define SQLITE_FREE(x)      free(x)\r\n#define SQLITE_REALLOC(x,y) realloc((x),(y))\r\n\r\n#if (defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)) \\\r\n      || (defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE))\r\n# include <malloc.h>    /* Needed for malloc_usable_size on linux */\r\n#endif\r\n#ifdef HAVE_MALLOC_USABLE_SIZE\r\n# ifndef SQLITE_MALLOCSIZE\r\n#  define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)\r\n# endif\r\n#else\r\n# undef SQLITE_MALLOCSIZE\r\n#endif\r\n\r\n#endif /* __APPLE__ or not __APPLE__ */\r\n\r\n/*\r\n** Like malloc(), but remember the size of the allocation\r\n** so that we can find it later using sqlite3MemSize().\r\n**\r\n** For this low-level routine, we are guaranteed that nByte>0 because\r\n** cases of nByte<=0 will be intercepted and dealt with by higher level\r\n** routines.\r\n*/\r\nstatic void *sqlite3MemMalloc(int nByte){\r\n#ifdef SQLITE_MALLOCSIZE\r\n  void *p = SQLITE_MALLOC( nByte );\r\n  if( p==0 ){\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to allocate %u bytes of memory\", nByte);\r\n  }\r\n  return p;\r\n#else\r\n  sqlite3_int64 *p;\r\n  assert( nByte>0 );\r\n  nByte = ROUND8(nByte);\r\n  p = SQLITE_MALLOC( nByte+8 );\r\n  if( p ){\r\n    p[0] = nByte;\r\n    p++;\r\n  }else{\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to allocate %u bytes of memory\", nByte);\r\n  }\r\n  return (void *)p;\r\n#endif\r\n}\r\n\r\n/*\r\n** Like free() but works for allocations obtained from sqlite3MemMalloc()\r\n** or sqlite3MemRealloc().\r\n**\r\n** For this low-level routine, we already know that pPrior!=0 since\r\n** cases where pPrior==0 will have been intecepted and dealt with\r\n** by higher-level routines.\r\n*/\r\nstatic void sqlite3MemFree(void *pPrior){\r\n#ifdef SQLITE_MALLOCSIZE\r\n  SQLITE_FREE(pPrior);\r\n#else\r\n  sqlite3_int64 *p = (sqlite3_int64*)pPrior;\r\n  assert( pPrior!=0 );\r\n  p--;\r\n  SQLITE_FREE(p);\r\n#endif\r\n}\r\n\r\n/*\r\n** Report the allocated size of a prior return from xMalloc()\r\n** or xRealloc().\r\n*/\r\nstatic int sqlite3MemSize(void *pPrior){\r\n#ifdef SQLITE_MALLOCSIZE\r\n  return pPrior ? (int)SQLITE_MALLOCSIZE(pPrior) : 0;\r\n#else\r\n  sqlite3_int64 *p;\r\n  if( pPrior==0 ) return 0;\r\n  p = (sqlite3_int64*)pPrior;\r\n  p--;\r\n  return (int)p[0];\r\n#endif\r\n}\r\n\r\n/*\r\n** Like realloc().  Resize an allocation previously obtained from\r\n** sqlite3MemMalloc().\r\n**\r\n** For this low-level interface, we know that pPrior!=0.  Cases where\r\n** pPrior==0 while have been intercepted by higher-level routine and\r\n** redirected to xMalloc.  Similarly, we know that nByte>0 becauses\r\n** cases where nByte<=0 will have been intercepted by higher-level\r\n** routines and redirected to xFree.\r\n*/\r\nstatic void *sqlite3MemRealloc(void *pPrior, int nByte){\r\n#ifdef SQLITE_MALLOCSIZE\r\n  void *p = SQLITE_REALLOC(pPrior, nByte);\r\n  if( p==0 ){\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(SQLITE_NOMEM,\r\n      \"failed memory resize %u to %u bytes\",\r\n      SQLITE_MALLOCSIZE(pPrior), nByte);\r\n  }\r\n  return p;\r\n#else\r\n  sqlite3_int64 *p = (sqlite3_int64*)pPrior;\r\n  assert( pPrior!=0 && nByte>0 );\r\n  assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */\r\n  p--;\r\n  p = SQLITE_REALLOC(p, nByte+8 );\r\n  if( p ){\r\n    p[0] = nByte;\r\n    p++;\r\n  }else{\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(SQLITE_NOMEM,\r\n      \"failed memory resize %u to %u bytes\",\r\n      sqlite3MemSize(pPrior), nByte);\r\n  }\r\n  return (void*)p;\r\n#endif\r\n}\r\n\r\n/*\r\n** Round up a request size to the next valid allocation size.\r\n*/\r\nstatic int sqlite3MemRoundup(int n){\r\n  return ROUND8(n);\r\n}\r\n\r\n/*\r\n** Initialize this module.\r\n*/\r\nstatic int sqlite3MemInit(void *NotUsed){\r\n#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)\r\n  int cpuCount;\r\n  size_t len;\r\n  if( _sqliteZone_ ){\r\n    return SQLITE_OK;\r\n  }\r\n  len = sizeof(cpuCount);\r\n  /* One usually wants to use hw.acctivecpu for MT decisions, but not here */\r\n  sysctlbyname(\"hw.ncpu\", &cpuCount, &len, NULL, 0);\r\n  if( cpuCount>1 ){\r\n    /* defer MT decisions to system malloc */\r\n    _sqliteZone_ = malloc_default_zone();\r\n  }else{\r\n    /* only 1 core, use our own zone to contention over global locks, \r\n    ** e.g. we have our own dedicated locks */\r\n    bool success;\t\t\r\n    malloc_zone_t* newzone = malloc_create_zone(4096, 0);\r\n    malloc_set_zone_name(newzone, \"Sqlite_Heap\");\r\n    do{\r\n      success = OSAtomicCompareAndSwapPtrBarrier(NULL, newzone, \r\n                                 (void * volatile *)&_sqliteZone_);\r\n    }while(!_sqliteZone_);\r\n    if( !success ){\t\r\n      /* somebody registered a zone first */\r\n      malloc_destroy_zone(newzone);\r\n    }\r\n  }\r\n#endif\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Deinitialize this module.\r\n*/\r\nstatic void sqlite3MemShutdown(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return;\r\n}\r\n\r\n/*\r\n** This routine is the only routine in this file with external linkage.\r\n**\r\n** Populate the low-level memory allocation function pointers in\r\n** sqlite3GlobalConfig.m with pointers to the routines in this file.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemSetDefault(void){\r\n  static const sqlite3_mem_methods defaultMethods = {\r\n     sqlite3MemMalloc,\r\n     sqlite3MemFree,\r\n     sqlite3MemRealloc,\r\n     sqlite3MemSize,\r\n     sqlite3MemRoundup,\r\n     sqlite3MemInit,\r\n     sqlite3MemShutdown,\r\n     0\r\n  };\r\n  sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);\r\n}\r\n\r\n#endif /* SQLITE_SYSTEM_MALLOC */\r\n\r\n/************** End of mem1.c ************************************************/\r\n/************** Begin file mem2.c ********************************************/\r\n/*\r\n** 2007 August 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains low-level memory allocation drivers for when\r\n** SQLite will use the standard C-library malloc/realloc/free interface\r\n** to obtain the memory it needs while adding lots of additional debugging\r\n** information to each allocation in order to help detect and fix memory\r\n** leaks and memory usage errors.\r\n**\r\n** This file contains implementations of the low-level memory allocation\r\n** routines specified in the sqlite3_mem_methods object.\r\n*/\r\n\r\n/*\r\n** This version of the memory allocator is used only if the\r\n** SQLITE_MEMDEBUG macro is defined\r\n*/\r\n#ifdef SQLITE_MEMDEBUG\r\n\r\n/*\r\n** The backtrace functionality is only available with GLIBC\r\n*/\r\n#ifdef __GLIBC__\r\n  extern int backtrace(void**,int);\r\n  extern void backtrace_symbols_fd(void*const*,int,int);\r\n#else\r\n# define backtrace(A,B) 1\r\n# define backtrace_symbols_fd(A,B,C)\r\n#endif\r\n/* #include <stdio.h> */\r\n\r\n/*\r\n** Each memory allocation looks like this:\r\n**\r\n**  ------------------------------------------------------------------------\r\n**  | Title |  backtrace pointers |  MemBlockHdr |  allocation |  EndGuard |\r\n**  ------------------------------------------------------------------------\r\n**\r\n** The application code sees only a pointer to the allocation.  We have\r\n** to back up from the allocation pointer to find the MemBlockHdr.  The\r\n** MemBlockHdr tells us the size of the allocation and the number of\r\n** backtrace pointers.  There is also a guard word at the end of the\r\n** MemBlockHdr.\r\n*/\r\nstruct MemBlockHdr {\r\n  i64 iSize;                          /* Size of this allocation */\r\n  struct MemBlockHdr *pNext, *pPrev;  /* Linked list of all unfreed memory */\r\n  char nBacktrace;                    /* Number of backtraces on this alloc */\r\n  char nBacktraceSlots;               /* Available backtrace slots */\r\n  u8 nTitle;                          /* Bytes of title; includes '\\0' */\r\n  u8 eType;                           /* Allocation type code */\r\n  int iForeGuard;                     /* Guard word for sanity */\r\n};\r\n\r\n/*\r\n** Guard words\r\n*/\r\n#define FOREGUARD 0x80F5E153\r\n#define REARGUARD 0xE4676B53\r\n\r\n/*\r\n** Number of malloc size increments to track.\r\n*/\r\n#define NCSIZE  1000\r\n\r\n/*\r\n** All of the static variables used by this module are collected\r\n** into a single structure named \"mem\".  This is to keep the\r\n** static variables organized and to reduce namespace pollution\r\n** when this module is combined with other in the amalgamation.\r\n*/\r\nstatic struct {\r\n  \r\n  /*\r\n  ** Mutex to control access to the memory allocation subsystem.\r\n  */\r\n  sqlite3_mutex *mutex;\r\n\r\n  /*\r\n  ** Head and tail of a linked list of all outstanding allocations\r\n  */\r\n  struct MemBlockHdr *pFirst;\r\n  struct MemBlockHdr *pLast;\r\n  \r\n  /*\r\n  ** The number of levels of backtrace to save in new allocations.\r\n  */\r\n  int nBacktrace;\r\n  void (*xBacktrace)(int, int, void **);\r\n\r\n  /*\r\n  ** Title text to insert in front of each block\r\n  */\r\n  int nTitle;        /* Bytes of zTitle to save.  Includes '\\0' and padding */\r\n  char zTitle[100];  /* The title text */\r\n\r\n  /* \r\n  ** sqlite3MallocDisallow() increments the following counter.\r\n  ** sqlite3MallocAllow() decrements it.\r\n  */\r\n  int disallow; /* Do not allow memory allocation */\r\n\r\n  /*\r\n  ** Gather statistics on the sizes of memory allocations.\r\n  ** nAlloc[i] is the number of allocation attempts of i*8\r\n  ** bytes.  i==NCSIZE is the number of allocation attempts for\r\n  ** sizes more than NCSIZE*8 bytes.\r\n  */\r\n  int nAlloc[NCSIZE];      /* Total number of allocations */\r\n  int nCurrent[NCSIZE];    /* Current number of allocations */\r\n  int mxCurrent[NCSIZE];   /* Highwater mark for nCurrent */\r\n\r\n} mem;\r\n\r\n\r\n/*\r\n** Adjust memory usage statistics\r\n*/\r\nstatic void adjustStats(int iSize, int increment){\r\n  int i = ROUND8(iSize)/8;\r\n  if( i>NCSIZE-1 ){\r\n    i = NCSIZE - 1;\r\n  }\r\n  if( increment>0 ){\r\n    mem.nAlloc[i]++;\r\n    mem.nCurrent[i]++;\r\n    if( mem.nCurrent[i]>mem.mxCurrent[i] ){\r\n      mem.mxCurrent[i] = mem.nCurrent[i];\r\n    }\r\n  }else{\r\n    mem.nCurrent[i]--;\r\n    assert( mem.nCurrent[i]>=0 );\r\n  }\r\n}\r\n\r\n/*\r\n** Given an allocation, find the MemBlockHdr for that allocation.\r\n**\r\n** This routine checks the guards at either end of the allocation and\r\n** if they are incorrect it asserts.\r\n*/\r\nstatic struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){\r\n  struct MemBlockHdr *p;\r\n  int *pInt;\r\n  u8 *pU8;\r\n  int nReserve;\r\n\r\n  p = (struct MemBlockHdr*)pAllocation;\r\n  p--;\r\n  assert( p->iForeGuard==(int)FOREGUARD );\r\n  nReserve = ROUND8(p->iSize);\r\n  pInt = (int*)pAllocation;\r\n  pU8 = (u8*)pAllocation;\r\n  assert( pInt[nReserve/sizeof(int)]==(int)REARGUARD );\r\n  /* This checks any of the \"extra\" bytes allocated due\r\n  ** to rounding up to an 8 byte boundary to ensure \r\n  ** they haven't been overwritten.\r\n  */\r\n  while( nReserve-- > p->iSize ) assert( pU8[nReserve]==0x65 );\r\n  return p;\r\n}\r\n\r\n/*\r\n** Return the number of bytes currently allocated at address p.\r\n*/\r\nstatic int sqlite3MemSize(void *p){\r\n  struct MemBlockHdr *pHdr;\r\n  if( !p ){\r\n    return 0;\r\n  }\r\n  pHdr = sqlite3MemsysGetHeader(p);\r\n  return pHdr->iSize;\r\n}\r\n\r\n/*\r\n** Initialize the memory allocation subsystem.\r\n*/\r\nstatic int sqlite3MemInit(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  assert( (sizeof(struct MemBlockHdr)&7) == 0 );\r\n  if( !sqlite3GlobalConfig.bMemstat ){\r\n    /* If memory status is enabled, then the malloc.c wrapper will already\r\n    ** hold the STATIC_MEM mutex when the routines here are invoked. */\r\n    mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Deinitialize the memory allocation subsystem.\r\n*/\r\nstatic void sqlite3MemShutdown(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  mem.mutex = 0;\r\n}\r\n\r\n/*\r\n** Round up a request size to the next valid allocation size.\r\n*/\r\nstatic int sqlite3MemRoundup(int n){\r\n  return ROUND8(n);\r\n}\r\n\r\n/*\r\n** Fill a buffer with pseudo-random bytes.  This is used to preset\r\n** the content of a new memory allocation to unpredictable values and\r\n** to clear the content of a freed allocation to unpredictable values.\r\n*/\r\nstatic void randomFill(char *pBuf, int nByte){\r\n  unsigned int x, y, r;\r\n  x = SQLITE_PTR_TO_INT(pBuf);\r\n  y = nByte | 1;\r\n  while( nByte >= 4 ){\r\n    x = (x>>1) ^ (-(x&1) & 0xd0000001);\r\n    y = y*1103515245 + 12345;\r\n    r = x ^ y;\r\n    *(int*)pBuf = r;\r\n    pBuf += 4;\r\n    nByte -= 4;\r\n  }\r\n  while( nByte-- > 0 ){\r\n    x = (x>>1) ^ (-(x&1) & 0xd0000001);\r\n    y = y*1103515245 + 12345;\r\n    r = x ^ y;\r\n    *(pBuf++) = r & 0xff;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate nByte bytes of memory.\r\n*/\r\nstatic void *sqlite3MemMalloc(int nByte){\r\n  struct MemBlockHdr *pHdr;\r\n  void **pBt;\r\n  char *z;\r\n  int *pInt;\r\n  void *p = 0;\r\n  int totalSize;\r\n  int nReserve;\r\n  sqlite3_mutex_enter(mem.mutex);\r\n  assert( mem.disallow==0 );\r\n  nReserve = ROUND8(nByte);\r\n  totalSize = nReserve + sizeof(*pHdr) + sizeof(int) +\r\n               mem.nBacktrace*sizeof(void*) + mem.nTitle;\r\n  p = malloc(totalSize);\r\n  if( p ){\r\n    z = p;\r\n    pBt = (void**)&z[mem.nTitle];\r\n    pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace];\r\n    pHdr->pNext = 0;\r\n    pHdr->pPrev = mem.pLast;\r\n    if( mem.pLast ){\r\n      mem.pLast->pNext = pHdr;\r\n    }else{\r\n      mem.pFirst = pHdr;\r\n    }\r\n    mem.pLast = pHdr;\r\n    pHdr->iForeGuard = FOREGUARD;\r\n    pHdr->eType = MEMTYPE_HEAP;\r\n    pHdr->nBacktraceSlots = mem.nBacktrace;\r\n    pHdr->nTitle = mem.nTitle;\r\n    if( mem.nBacktrace ){\r\n      void *aAddr[40];\r\n      pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1;\r\n      memcpy(pBt, &aAddr[1], pHdr->nBacktrace*sizeof(void*));\r\n      assert(pBt[0]);\r\n      if( mem.xBacktrace ){\r\n        mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]);\r\n      }\r\n    }else{\r\n      pHdr->nBacktrace = 0;\r\n    }\r\n    if( mem.nTitle ){\r\n      memcpy(z, mem.zTitle, mem.nTitle);\r\n    }\r\n    pHdr->iSize = nByte;\r\n    adjustStats(nByte, +1);\r\n    pInt = (int*)&pHdr[1];\r\n    pInt[nReserve/sizeof(int)] = REARGUARD;\r\n    randomFill((char*)pInt, nByte);\r\n    memset(((char*)pInt)+nByte, 0x65, nReserve-nByte);\r\n    p = (void*)pInt;\r\n  }\r\n  sqlite3_mutex_leave(mem.mutex);\r\n  return p; \r\n}\r\n\r\n/*\r\n** Free memory.\r\n*/\r\nstatic void sqlite3MemFree(void *pPrior){\r\n  struct MemBlockHdr *pHdr;\r\n  void **pBt;\r\n  char *z;\r\n  assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0 \r\n       || mem.mutex!=0 );\r\n  pHdr = sqlite3MemsysGetHeader(pPrior);\r\n  pBt = (void**)pHdr;\r\n  pBt -= pHdr->nBacktraceSlots;\r\n  sqlite3_mutex_enter(mem.mutex);\r\n  if( pHdr->pPrev ){\r\n    assert( pHdr->pPrev->pNext==pHdr );\r\n    pHdr->pPrev->pNext = pHdr->pNext;\r\n  }else{\r\n    assert( mem.pFirst==pHdr );\r\n    mem.pFirst = pHdr->pNext;\r\n  }\r\n  if( pHdr->pNext ){\r\n    assert( pHdr->pNext->pPrev==pHdr );\r\n    pHdr->pNext->pPrev = pHdr->pPrev;\r\n  }else{\r\n    assert( mem.pLast==pHdr );\r\n    mem.pLast = pHdr->pPrev;\r\n  }\r\n  z = (char*)pBt;\r\n  z -= pHdr->nTitle;\r\n  adjustStats(pHdr->iSize, -1);\r\n  randomFill(z, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) +\r\n                pHdr->iSize + sizeof(int) + pHdr->nTitle);\r\n  free(z);\r\n  sqlite3_mutex_leave(mem.mutex);  \r\n}\r\n\r\n/*\r\n** Change the size of an existing memory allocation.\r\n**\r\n** For this debugging implementation, we *always* make a copy of the\r\n** allocation into a new place in memory.  In this way, if the \r\n** higher level code is using pointer to the old allocation, it is \r\n** much more likely to break and we are much more liking to find\r\n** the error.\r\n*/\r\nstatic void *sqlite3MemRealloc(void *pPrior, int nByte){\r\n  struct MemBlockHdr *pOldHdr;\r\n  void *pNew;\r\n  assert( mem.disallow==0 );\r\n  assert( (nByte & 7)==0 );     /* EV: R-46199-30249 */\r\n  pOldHdr = sqlite3MemsysGetHeader(pPrior);\r\n  pNew = sqlite3MemMalloc(nByte);\r\n  if( pNew ){\r\n    memcpy(pNew, pPrior, nByte<pOldHdr->iSize ? nByte : pOldHdr->iSize);\r\n    if( nByte>pOldHdr->iSize ){\r\n      randomFill(&((char*)pNew)[pOldHdr->iSize], nByte - pOldHdr->iSize);\r\n    }\r\n    sqlite3MemFree(pPrior);\r\n  }\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Populate the low-level memory allocation function pointers in\r\n** sqlite3GlobalConfig.m with pointers to the routines in this file.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemSetDefault(void){\r\n  static const sqlite3_mem_methods defaultMethods = {\r\n     sqlite3MemMalloc,\r\n     sqlite3MemFree,\r\n     sqlite3MemRealloc,\r\n     sqlite3MemSize,\r\n     sqlite3MemRoundup,\r\n     sqlite3MemInit,\r\n     sqlite3MemShutdown,\r\n     0\r\n  };\r\n  sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);\r\n}\r\n\r\n/*\r\n** Set the \"type\" of an allocation.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){\r\n  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){\r\n    struct MemBlockHdr *pHdr;\r\n    pHdr = sqlite3MemsysGetHeader(p);\r\n    assert( pHdr->iForeGuard==FOREGUARD );\r\n    pHdr->eType = eType;\r\n  }\r\n}\r\n\r\n/*\r\n** Return TRUE if the mask of type in eType matches the type of the\r\n** allocation p.  Also return true if p==NULL.\r\n**\r\n** This routine is designed for use within an assert() statement, to\r\n** verify the type of an allocation.  For example:\r\n**\r\n**     assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );\r\n*/\r\nSQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){\r\n  int rc = 1;\r\n  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){\r\n    struct MemBlockHdr *pHdr;\r\n    pHdr = sqlite3MemsysGetHeader(p);\r\n    assert( pHdr->iForeGuard==FOREGUARD );         /* Allocation is valid */\r\n    if( (pHdr->eType&eType)==0 ){\r\n      rc = 0;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return TRUE if the mask of type in eType matches no bits of the type of the\r\n** allocation p.  Also return true if p==NULL.\r\n**\r\n** This routine is designed for use within an assert() statement, to\r\n** verify the type of an allocation.  For example:\r\n**\r\n**     assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );\r\n*/\r\nSQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){\r\n  int rc = 1;\r\n  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){\r\n    struct MemBlockHdr *pHdr;\r\n    pHdr = sqlite3MemsysGetHeader(p);\r\n    assert( pHdr->iForeGuard==FOREGUARD );         /* Allocation is valid */\r\n    if( (pHdr->eType&eType)!=0 ){\r\n      rc = 0;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set the number of backtrace levels kept for each allocation.\r\n** A value of zero turns off backtracing.  The number is always rounded\r\n** up to a multiple of 2.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemdebugBacktrace(int depth){\r\n  if( depth<0 ){ depth = 0; }\r\n  if( depth>20 ){ depth = 20; }\r\n  depth = (depth+1)&0xfe;\r\n  mem.nBacktrace = depth;\r\n}\r\n\r\nSQLITE_PRIVATE void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){\r\n  mem.xBacktrace = xBacktrace;\r\n}\r\n\r\n/*\r\n** Set the title string for subsequent allocations.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){\r\n  unsigned int n = sqlite3Strlen30(zTitle) + 1;\r\n  sqlite3_mutex_enter(mem.mutex);\r\n  if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;\r\n  memcpy(mem.zTitle, zTitle, n);\r\n  mem.zTitle[n] = 0;\r\n  mem.nTitle = ROUND8(n);\r\n  sqlite3_mutex_leave(mem.mutex);\r\n}\r\n\r\nSQLITE_PRIVATE void sqlite3MemdebugSync(){\r\n  struct MemBlockHdr *pHdr;\r\n  for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){\r\n    void **pBt = (void**)pHdr;\r\n    pBt -= pHdr->nBacktraceSlots;\r\n    mem.xBacktrace(pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]);\r\n  }\r\n}\r\n\r\n/*\r\n** Open the file indicated and write a log of all unfreed memory \r\n** allocations into that log.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemdebugDump(const char *zFilename){\r\n  FILE *out;\r\n  struct MemBlockHdr *pHdr;\r\n  void **pBt;\r\n  int i;\r\n  out = fopen(zFilename, \"w\");\r\n  if( out==0 ){\r\n    fprintf(stderr, \"** Unable to output memory debug output log: %s **\\n\",\r\n                    zFilename);\r\n    return;\r\n  }\r\n  for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){\r\n    char *z = (char*)pHdr;\r\n    z -= pHdr->nBacktraceSlots*sizeof(void*) + pHdr->nTitle;\r\n    fprintf(out, \"**** %lld bytes at %p from %s ****\\n\", \r\n            pHdr->iSize, &pHdr[1], pHdr->nTitle ? z : \"???\");\r\n    if( pHdr->nBacktrace ){\r\n      fflush(out);\r\n      pBt = (void**)pHdr;\r\n      pBt -= pHdr->nBacktraceSlots;\r\n      backtrace_symbols_fd(pBt, pHdr->nBacktrace, fileno(out));\r\n      fprintf(out, \"\\n\");\r\n    }\r\n  }\r\n  fprintf(out, \"COUNTS:\\n\");\r\n  for(i=0; i<NCSIZE-1; i++){\r\n    if( mem.nAlloc[i] ){\r\n      fprintf(out, \"   %5d: %10d %10d %10d\\n\", \r\n            i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);\r\n    }\r\n  }\r\n  if( mem.nAlloc[NCSIZE-1] ){\r\n    fprintf(out, \"   %5d: %10d %10d %10d\\n\",\r\n             NCSIZE*8-8, mem.nAlloc[NCSIZE-1],\r\n             mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);\r\n  }\r\n  fclose(out);\r\n}\r\n\r\n/*\r\n** Return the number of times sqlite3MemMalloc() has been called.\r\n*/\r\nSQLITE_PRIVATE int sqlite3MemdebugMallocCount(){\r\n  int i;\r\n  int nTotal = 0;\r\n  for(i=0; i<NCSIZE; i++){\r\n    nTotal += mem.nAlloc[i];\r\n  }\r\n  return nTotal;\r\n}\r\n\r\n\r\n#endif /* SQLITE_MEMDEBUG */\r\n\r\n/************** End of mem2.c ************************************************/\r\n/************** Begin file mem3.c ********************************************/\r\n/*\r\n** 2007 October 14\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement a memory\r\n** allocation subsystem for use by SQLite. \r\n**\r\n** This version of the memory allocation subsystem omits all\r\n** use of malloc(). The SQLite user supplies a block of memory\r\n** before calling sqlite3_initialize() from which allocations\r\n** are made and returned by the xMalloc() and xRealloc() \r\n** implementations. Once sqlite3_initialize() has been called,\r\n** the amount of memory available to SQLite is fixed and cannot\r\n** be changed.\r\n**\r\n** This version of the memory allocation subsystem is included\r\n** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.\r\n*/\r\n\r\n/*\r\n** This version of the memory allocator is only built into the library\r\n** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not\r\n** mean that the library will use a memory-pool by default, just that\r\n** it is available. The mempool allocator is activated by calling\r\n** sqlite3_config().\r\n*/\r\n#ifdef SQLITE_ENABLE_MEMSYS3\r\n\r\n/*\r\n** Maximum size (in Mem3Blocks) of a \"small\" chunk.\r\n*/\r\n#define MX_SMALL 10\r\n\r\n\r\n/*\r\n** Number of freelist hash slots\r\n*/\r\n#define N_HASH  61\r\n\r\n/*\r\n** A memory allocation (also called a \"chunk\") consists of two or \r\n** more blocks where each block is 8 bytes.  The first 8 bytes are \r\n** a header that is not returned to the user.\r\n**\r\n** A chunk is two or more blocks that is either checked out or\r\n** free.  The first block has format u.hdr.  u.hdr.size4x is 4 times the\r\n** size of the allocation in blocks if the allocation is free.\r\n** The u.hdr.size4x&1 bit is true if the chunk is checked out and\r\n** false if the chunk is on the freelist.  The u.hdr.size4x&2 bit\r\n** is true if the previous chunk is checked out and false if the\r\n** previous chunk is free.  The u.hdr.prevSize field is the size of\r\n** the previous chunk in blocks if the previous chunk is on the\r\n** freelist. If the previous chunk is checked out, then\r\n** u.hdr.prevSize can be part of the data for that chunk and should\r\n** not be read or written.\r\n**\r\n** We often identify a chunk by its index in mem3.aPool[].  When\r\n** this is done, the chunk index refers to the second block of\r\n** the chunk.  In this way, the first chunk has an index of 1.\r\n** A chunk index of 0 means \"no such chunk\" and is the equivalent\r\n** of a NULL pointer.\r\n**\r\n** The second block of free chunks is of the form u.list.  The\r\n** two fields form a double-linked list of chunks of related sizes.\r\n** Pointers to the head of the list are stored in mem3.aiSmall[] \r\n** for smaller chunks and mem3.aiHash[] for larger chunks.\r\n**\r\n** The second block of a chunk is user data if the chunk is checked \r\n** out.  If a chunk is checked out, the user data may extend into\r\n** the u.hdr.prevSize value of the following chunk.\r\n*/\r\ntypedef struct Mem3Block Mem3Block;\r\nstruct Mem3Block {\r\n  union {\r\n    struct {\r\n      u32 prevSize;   /* Size of previous chunk in Mem3Block elements */\r\n      u32 size4x;     /* 4x the size of current chunk in Mem3Block elements */\r\n    } hdr;\r\n    struct {\r\n      u32 next;       /* Index in mem3.aPool[] of next free chunk */\r\n      u32 prev;       /* Index in mem3.aPool[] of previous free chunk */\r\n    } list;\r\n  } u;\r\n};\r\n\r\n/*\r\n** All of the static variables used by this module are collected\r\n** into a single structure named \"mem3\".  This is to keep the\r\n** static variables organized and to reduce namespace pollution\r\n** when this module is combined with other in the amalgamation.\r\n*/\r\nstatic SQLITE_WSD struct Mem3Global {\r\n  /*\r\n  ** Memory available for allocation. nPool is the size of the array\r\n  ** (in Mem3Blocks) pointed to by aPool less 2.\r\n  */\r\n  u32 nPool;\r\n  Mem3Block *aPool;\r\n\r\n  /*\r\n  ** True if we are evaluating an out-of-memory callback.\r\n  */\r\n  int alarmBusy;\r\n  \r\n  /*\r\n  ** Mutex to control access to the memory allocation subsystem.\r\n  */\r\n  sqlite3_mutex *mutex;\r\n  \r\n  /*\r\n  ** The minimum amount of free space that we have seen.\r\n  */\r\n  u32 mnMaster;\r\n\r\n  /*\r\n  ** iMaster is the index of the master chunk.  Most new allocations\r\n  ** occur off of this chunk.  szMaster is the size (in Mem3Blocks)\r\n  ** of the current master.  iMaster is 0 if there is not master chunk.\r\n  ** The master chunk is not in either the aiHash[] or aiSmall[].\r\n  */\r\n  u32 iMaster;\r\n  u32 szMaster;\r\n\r\n  /*\r\n  ** Array of lists of free blocks according to the block size \r\n  ** for smaller chunks, or a hash on the block size for larger\r\n  ** chunks.\r\n  */\r\n  u32 aiSmall[MX_SMALL-1];   /* For sizes 2 through MX_SMALL, inclusive */\r\n  u32 aiHash[N_HASH];        /* For sizes MX_SMALL+1 and larger */\r\n} mem3 = { 97535575 };\r\n\r\n#define mem3 GLOBAL(struct Mem3Global, mem3)\r\n\r\n/*\r\n** Unlink the chunk at mem3.aPool[i] from list it is currently\r\n** on.  *pRoot is the list that i is a member of.\r\n*/\r\nstatic void memsys3UnlinkFromList(u32 i, u32 *pRoot){\r\n  u32 next = mem3.aPool[i].u.list.next;\r\n  u32 prev = mem3.aPool[i].u.list.prev;\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  if( prev==0 ){\r\n    *pRoot = next;\r\n  }else{\r\n    mem3.aPool[prev].u.list.next = next;\r\n  }\r\n  if( next ){\r\n    mem3.aPool[next].u.list.prev = prev;\r\n  }\r\n  mem3.aPool[i].u.list.next = 0;\r\n  mem3.aPool[i].u.list.prev = 0;\r\n}\r\n\r\n/*\r\n** Unlink the chunk at index i from \r\n** whatever list is currently a member of.\r\n*/\r\nstatic void memsys3Unlink(u32 i){\r\n  u32 size, hash;\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );\r\n  assert( i>=1 );\r\n  size = mem3.aPool[i-1].u.hdr.size4x/4;\r\n  assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );\r\n  assert( size>=2 );\r\n  if( size <= MX_SMALL ){\r\n    memsys3UnlinkFromList(i, &mem3.aiSmall[size-2]);\r\n  }else{\r\n    hash = size % N_HASH;\r\n    memsys3UnlinkFromList(i, &mem3.aiHash[hash]);\r\n  }\r\n}\r\n\r\n/*\r\n** Link the chunk at mem3.aPool[i] so that is on the list rooted\r\n** at *pRoot.\r\n*/\r\nstatic void memsys3LinkIntoList(u32 i, u32 *pRoot){\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  mem3.aPool[i].u.list.next = *pRoot;\r\n  mem3.aPool[i].u.list.prev = 0;\r\n  if( *pRoot ){\r\n    mem3.aPool[*pRoot].u.list.prev = i;\r\n  }\r\n  *pRoot = i;\r\n}\r\n\r\n/*\r\n** Link the chunk at index i into either the appropriate\r\n** small chunk list, or into the large chunk hash table.\r\n*/\r\nstatic void memsys3Link(u32 i){\r\n  u32 size, hash;\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  assert( i>=1 );\r\n  assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );\r\n  size = mem3.aPool[i-1].u.hdr.size4x/4;\r\n  assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );\r\n  assert( size>=2 );\r\n  if( size <= MX_SMALL ){\r\n    memsys3LinkIntoList(i, &mem3.aiSmall[size-2]);\r\n  }else{\r\n    hash = size % N_HASH;\r\n    memsys3LinkIntoList(i, &mem3.aiHash[hash]);\r\n  }\r\n}\r\n\r\n/*\r\n** If the STATIC_MEM mutex is not already held, obtain it now. The mutex\r\n** will already be held (obtained by code in malloc.c) if\r\n** sqlite3GlobalConfig.bMemStat is true.\r\n*/\r\nstatic void memsys3Enter(void){\r\n  if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){\r\n    mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\r\n  }\r\n  sqlite3_mutex_enter(mem3.mutex);\r\n}\r\nstatic void memsys3Leave(void){\r\n  sqlite3_mutex_leave(mem3.mutex);\r\n}\r\n\r\n/*\r\n** Called when we are unable to satisfy an allocation of nBytes.\r\n*/\r\nstatic void memsys3OutOfMemory(int nByte){\r\n  if( !mem3.alarmBusy ){\r\n    mem3.alarmBusy = 1;\r\n    assert( sqlite3_mutex_held(mem3.mutex) );\r\n    sqlite3_mutex_leave(mem3.mutex);\r\n    sqlite3_release_memory(nByte);\r\n    sqlite3_mutex_enter(mem3.mutex);\r\n    mem3.alarmBusy = 0;\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** Chunk i is a free chunk that has been unlinked.  Adjust its \r\n** size parameters for check-out and return a pointer to the \r\n** user portion of the chunk.\r\n*/\r\nstatic void *memsys3Checkout(u32 i, u32 nBlock){\r\n  u32 x;\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  assert( i>=1 );\r\n  assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );\r\n  assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );\r\n  x = mem3.aPool[i-1].u.hdr.size4x;\r\n  mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);\r\n  mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;\r\n  mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;\r\n  return &mem3.aPool[i];\r\n}\r\n\r\n/*\r\n** Carve a piece off of the end of the mem3.iMaster free chunk.\r\n** Return a pointer to the new allocation.  Or, if the master chunk\r\n** is not large enough, return 0.\r\n*/\r\nstatic void *memsys3FromMaster(u32 nBlock){\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  assert( mem3.szMaster>=nBlock );\r\n  if( nBlock>=mem3.szMaster-1 ){\r\n    /* Use the entire master */\r\n    void *p = memsys3Checkout(mem3.iMaster, mem3.szMaster);\r\n    mem3.iMaster = 0;\r\n    mem3.szMaster = 0;\r\n    mem3.mnMaster = 0;\r\n    return p;\r\n  }else{\r\n    /* Split the master block.  Return the tail. */\r\n    u32 newi, x;\r\n    newi = mem3.iMaster + mem3.szMaster - nBlock;\r\n    assert( newi > mem3.iMaster+1 );\r\n    mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock;\r\n    mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2;\r\n    mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;\r\n    mem3.szMaster -= nBlock;\r\n    mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster;\r\n    x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;\r\n    mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;\r\n    if( mem3.szMaster < mem3.mnMaster ){\r\n      mem3.mnMaster = mem3.szMaster;\r\n    }\r\n    return (void*)&mem3.aPool[newi];\r\n  }\r\n}\r\n\r\n/*\r\n** *pRoot is the head of a list of free chunks of the same size\r\n** or same size hash.  In other words, *pRoot is an entry in either\r\n** mem3.aiSmall[] or mem3.aiHash[].  \r\n**\r\n** This routine examines all entries on the given list and tries\r\n** to coalesce each entries with adjacent free chunks.  \r\n**\r\n** If it sees a chunk that is larger than mem3.iMaster, it replaces \r\n** the current mem3.iMaster with the new larger chunk.  In order for\r\n** this mem3.iMaster replacement to work, the master chunk must be\r\n** linked into the hash tables.  That is not the normal state of\r\n** affairs, of course.  The calling routine must link the master\r\n** chunk before invoking this routine, then must unlink the (possibly\r\n** changed) master chunk once this routine has finished.\r\n*/\r\nstatic void memsys3Merge(u32 *pRoot){\r\n  u32 iNext, prev, size, i, x;\r\n\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  for(i=*pRoot; i>0; i=iNext){\r\n    iNext = mem3.aPool[i].u.list.next;\r\n    size = mem3.aPool[i-1].u.hdr.size4x;\r\n    assert( (size&1)==0 );\r\n    if( (size&2)==0 ){\r\n      memsys3UnlinkFromList(i, pRoot);\r\n      assert( i > mem3.aPool[i-1].u.hdr.prevSize );\r\n      prev = i - mem3.aPool[i-1].u.hdr.prevSize;\r\n      if( prev==iNext ){\r\n        iNext = mem3.aPool[prev].u.list.next;\r\n      }\r\n      memsys3Unlink(prev);\r\n      size = i + size/4 - prev;\r\n      x = mem3.aPool[prev-1].u.hdr.size4x & 2;\r\n      mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;\r\n      mem3.aPool[prev+size-1].u.hdr.prevSize = size;\r\n      memsys3Link(prev);\r\n      i = prev;\r\n    }else{\r\n      size /= 4;\r\n    }\r\n    if( size>mem3.szMaster ){\r\n      mem3.iMaster = i;\r\n      mem3.szMaster = size;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Return a block of memory of at least nBytes in size.\r\n** Return NULL if unable.\r\n**\r\n** This function assumes that the necessary mutexes, if any, are\r\n** already held by the caller. Hence \"Unsafe\".\r\n*/\r\nstatic void *memsys3MallocUnsafe(int nByte){\r\n  u32 i;\r\n  u32 nBlock;\r\n  u32 toFree;\r\n\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  assert( sizeof(Mem3Block)==8 );\r\n  if( nByte<=12 ){\r\n    nBlock = 2;\r\n  }else{\r\n    nBlock = (nByte + 11)/8;\r\n  }\r\n  assert( nBlock>=2 );\r\n\r\n  /* STEP 1:\r\n  ** Look for an entry of the correct size in either the small\r\n  ** chunk table or in the large chunk hash table.  This is\r\n  ** successful most of the time (about 9 times out of 10).\r\n  */\r\n  if( nBlock <= MX_SMALL ){\r\n    i = mem3.aiSmall[nBlock-2];\r\n    if( i>0 ){\r\n      memsys3UnlinkFromList(i, &mem3.aiSmall[nBlock-2]);\r\n      return memsys3Checkout(i, nBlock);\r\n    }\r\n  }else{\r\n    int hash = nBlock % N_HASH;\r\n    for(i=mem3.aiHash[hash]; i>0; i=mem3.aPool[i].u.list.next){\r\n      if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){\r\n        memsys3UnlinkFromList(i, &mem3.aiHash[hash]);\r\n        return memsys3Checkout(i, nBlock);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* STEP 2:\r\n  ** Try to satisfy the allocation by carving a piece off of the end\r\n  ** of the master chunk.  This step usually works if step 1 fails.\r\n  */\r\n  if( mem3.szMaster>=nBlock ){\r\n    return memsys3FromMaster(nBlock);\r\n  }\r\n\r\n\r\n  /* STEP 3:  \r\n  ** Loop through the entire memory pool.  Coalesce adjacent free\r\n  ** chunks.  Recompute the master chunk as the largest free chunk.\r\n  ** Then try again to satisfy the allocation by carving a piece off\r\n  ** of the end of the master chunk.  This step happens very\r\n  ** rarely (we hope!)\r\n  */\r\n  for(toFree=nBlock*16; toFree<(mem3.nPool*16); toFree *= 2){\r\n    memsys3OutOfMemory(toFree);\r\n    if( mem3.iMaster ){\r\n      memsys3Link(mem3.iMaster);\r\n      mem3.iMaster = 0;\r\n      mem3.szMaster = 0;\r\n    }\r\n    for(i=0; i<N_HASH; i++){\r\n      memsys3Merge(&mem3.aiHash[i]);\r\n    }\r\n    for(i=0; i<MX_SMALL-1; i++){\r\n      memsys3Merge(&mem3.aiSmall[i]);\r\n    }\r\n    if( mem3.szMaster ){\r\n      memsys3Unlink(mem3.iMaster);\r\n      if( mem3.szMaster>=nBlock ){\r\n        return memsys3FromMaster(nBlock);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* If none of the above worked, then we fail. */\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Free an outstanding memory allocation.\r\n**\r\n** This function assumes that the necessary mutexes, if any, are\r\n** already held by the caller. Hence \"Unsafe\".\r\n*/\r\nstatic void memsys3FreeUnsafe(void *pOld){\r\n  Mem3Block *p = (Mem3Block*)pOld;\r\n  int i;\r\n  u32 size, x;\r\n  assert( sqlite3_mutex_held(mem3.mutex) );\r\n  assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] );\r\n  i = p - mem3.aPool;\r\n  assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );\r\n  size = mem3.aPool[i-1].u.hdr.size4x/4;\r\n  assert( i+size<=mem3.nPool+1 );\r\n  mem3.aPool[i-1].u.hdr.size4x &= ~1;\r\n  mem3.aPool[i+size-1].u.hdr.prevSize = size;\r\n  mem3.aPool[i+size-1].u.hdr.size4x &= ~2;\r\n  memsys3Link(i);\r\n\r\n  /* Try to expand the master using the newly freed chunk */\r\n  if( mem3.iMaster ){\r\n    while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){\r\n      size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize;\r\n      mem3.iMaster -= size;\r\n      mem3.szMaster += size;\r\n      memsys3Unlink(mem3.iMaster);\r\n      x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;\r\n      mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;\r\n      mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;\r\n    }\r\n    x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;\r\n    while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){\r\n      memsys3Unlink(mem3.iMaster+mem3.szMaster);\r\n      mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4;\r\n      mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;\r\n      mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Return the size of an outstanding allocation, in bytes.  The\r\n** size returned omits the 8-byte header overhead.  This only\r\n** works for chunks that are currently checked out.\r\n*/\r\nstatic int memsys3Size(void *p){\r\n  Mem3Block *pBlock;\r\n  if( p==0 ) return 0;\r\n  pBlock = (Mem3Block*)p;\r\n  assert( (pBlock[-1].u.hdr.size4x&1)!=0 );\r\n  return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;\r\n}\r\n\r\n/*\r\n** Round up a request size to the next valid allocation size.\r\n*/\r\nstatic int memsys3Roundup(int n){\r\n  if( n<=12 ){\r\n    return 12;\r\n  }else{\r\n    return ((n+11)&~7) - 4;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate nBytes of memory.\r\n*/\r\nstatic void *memsys3Malloc(int nBytes){\r\n  sqlite3_int64 *p;\r\n  assert( nBytes>0 );          /* malloc.c filters out 0 byte requests */\r\n  memsys3Enter();\r\n  p = memsys3MallocUnsafe(nBytes);\r\n  memsys3Leave();\r\n  return (void*)p; \r\n}\r\n\r\n/*\r\n** Free memory.\r\n*/\r\nstatic void memsys3Free(void *pPrior){\r\n  assert( pPrior );\r\n  memsys3Enter();\r\n  memsys3FreeUnsafe(pPrior);\r\n  memsys3Leave();\r\n}\r\n\r\n/*\r\n** Change the size of an existing memory allocation\r\n*/\r\nstatic void *memsys3Realloc(void *pPrior, int nBytes){\r\n  int nOld;\r\n  void *p;\r\n  if( pPrior==0 ){\r\n    return sqlite3_malloc(nBytes);\r\n  }\r\n  if( nBytes<=0 ){\r\n    sqlite3_free(pPrior);\r\n    return 0;\r\n  }\r\n  nOld = memsys3Size(pPrior);\r\n  if( nBytes<=nOld && nBytes>=nOld-128 ){\r\n    return pPrior;\r\n  }\r\n  memsys3Enter();\r\n  p = memsys3MallocUnsafe(nBytes);\r\n  if( p ){\r\n    if( nOld<nBytes ){\r\n      memcpy(p, pPrior, nOld);\r\n    }else{\r\n      memcpy(p, pPrior, nBytes);\r\n    }\r\n    memsys3FreeUnsafe(pPrior);\r\n  }\r\n  memsys3Leave();\r\n  return p;\r\n}\r\n\r\n/*\r\n** Initialize this module.\r\n*/\r\nstatic int memsys3Init(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  if( !sqlite3GlobalConfig.pHeap ){\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  /* Store a pointer to the memory block in global structure mem3. */\r\n  assert( sizeof(Mem3Block)==8 );\r\n  mem3.aPool = (Mem3Block *)sqlite3GlobalConfig.pHeap;\r\n  mem3.nPool = (sqlite3GlobalConfig.nHeap / sizeof(Mem3Block)) - 2;\r\n\r\n  /* Initialize the master block. */\r\n  mem3.szMaster = mem3.nPool;\r\n  mem3.mnMaster = mem3.szMaster;\r\n  mem3.iMaster = 1;\r\n  mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;\r\n  mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;\r\n  mem3.aPool[mem3.nPool].u.hdr.size4x = 1;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Deinitialize this module.\r\n*/\r\nstatic void memsys3Shutdown(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  mem3.mutex = 0;\r\n  return;\r\n}\r\n\r\n\r\n\r\n/*\r\n** Open the file indicated and write a log of all unfreed memory \r\n** allocations into that log.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Memsys3Dump(const char *zFilename){\r\n#ifdef SQLITE_DEBUG\r\n  FILE *out;\r\n  u32 i, j;\r\n  u32 size;\r\n  if( zFilename==0 || zFilename[0]==0 ){\r\n    out = stdout;\r\n  }else{\r\n    out = fopen(zFilename, \"w\");\r\n    if( out==0 ){\r\n      fprintf(stderr, \"** Unable to output memory debug output log: %s **\\n\",\r\n                      zFilename);\r\n      return;\r\n    }\r\n  }\r\n  memsys3Enter();\r\n  fprintf(out, \"CHUNKS:\\n\");\r\n  for(i=1; i<=mem3.nPool; i+=size/4){\r\n    size = mem3.aPool[i-1].u.hdr.size4x;\r\n    if( size/4<=1 ){\r\n      fprintf(out, \"%p size error\\n\", &mem3.aPool[i]);\r\n      assert( 0 );\r\n      break;\r\n    }\r\n    if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){\r\n      fprintf(out, \"%p tail size does not match\\n\", &mem3.aPool[i]);\r\n      assert( 0 );\r\n      break;\r\n    }\r\n    if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){\r\n      fprintf(out, \"%p tail checkout bit is incorrect\\n\", &mem3.aPool[i]);\r\n      assert( 0 );\r\n      break;\r\n    }\r\n    if( size&1 ){\r\n      fprintf(out, \"%p %6d bytes checked out\\n\", &mem3.aPool[i], (size/4)*8-8);\r\n    }else{\r\n      fprintf(out, \"%p %6d bytes free%s\\n\", &mem3.aPool[i], (size/4)*8-8,\r\n                  i==mem3.iMaster ? \" **master**\" : \"\");\r\n    }\r\n  }\r\n  for(i=0; i<MX_SMALL-1; i++){\r\n    if( mem3.aiSmall[i]==0 ) continue;\r\n    fprintf(out, \"small(%2d):\", i);\r\n    for(j = mem3.aiSmall[i]; j>0; j=mem3.aPool[j].u.list.next){\r\n      fprintf(out, \" %p(%d)\", &mem3.aPool[j],\r\n              (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);\r\n    }\r\n    fprintf(out, \"\\n\"); \r\n  }\r\n  for(i=0; i<N_HASH; i++){\r\n    if( mem3.aiHash[i]==0 ) continue;\r\n    fprintf(out, \"hash(%2d):\", i);\r\n    for(j = mem3.aiHash[i]; j>0; j=mem3.aPool[j].u.list.next){\r\n      fprintf(out, \" %p(%d)\", &mem3.aPool[j],\r\n              (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);\r\n    }\r\n    fprintf(out, \"\\n\"); \r\n  }\r\n  fprintf(out, \"master=%d\\n\", mem3.iMaster);\r\n  fprintf(out, \"nowUsed=%d\\n\", mem3.nPool*8 - mem3.szMaster*8);\r\n  fprintf(out, \"mxUsed=%d\\n\", mem3.nPool*8 - mem3.mnMaster*8);\r\n  sqlite3_mutex_leave(mem3.mutex);\r\n  if( out==stdout ){\r\n    fflush(stdout);\r\n  }else{\r\n    fclose(out);\r\n  }\r\n#else\r\n  UNUSED_PARAMETER(zFilename);\r\n#endif\r\n}\r\n\r\n/*\r\n** This routine is the only routine in this file with external \r\n** linkage.\r\n**\r\n** Populate the low-level memory allocation function pointers in\r\n** sqlite3GlobalConfig.m with pointers to the routines in this file. The\r\n** arguments specify the block of memory to manage.\r\n**\r\n** This routine is only called by sqlite3_config(), and therefore\r\n** is not required to be threadsafe (it is not).\r\n*/\r\nSQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){\r\n  static const sqlite3_mem_methods mempoolMethods = {\r\n     memsys3Malloc,\r\n     memsys3Free,\r\n     memsys3Realloc,\r\n     memsys3Size,\r\n     memsys3Roundup,\r\n     memsys3Init,\r\n     memsys3Shutdown,\r\n     0\r\n  };\r\n  return &mempoolMethods;\r\n}\r\n\r\n#endif /* SQLITE_ENABLE_MEMSYS3 */\r\n\r\n/************** End of mem3.c ************************************************/\r\n/************** Begin file mem5.c ********************************************/\r\n/*\r\n** 2007 October 14\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement a memory\r\n** allocation subsystem for use by SQLite. \r\n**\r\n** This version of the memory allocation subsystem omits all\r\n** use of malloc(). The application gives SQLite a block of memory\r\n** before calling sqlite3_initialize() from which allocations\r\n** are made and returned by the xMalloc() and xRealloc() \r\n** implementations. Once sqlite3_initialize() has been called,\r\n** the amount of memory available to SQLite is fixed and cannot\r\n** be changed.\r\n**\r\n** This version of the memory allocation subsystem is included\r\n** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.\r\n**\r\n** This memory allocator uses the following algorithm:\r\n**\r\n**   1.  All memory allocations sizes are rounded up to a power of 2.\r\n**\r\n**   2.  If two adjacent free blocks are the halves of a larger block,\r\n**       then the two blocks are coalesed into the single larger block.\r\n**\r\n**   3.  New memory is allocated from the first available free block.\r\n**\r\n** This algorithm is described in: J. M. Robson. \"Bounds for Some Functions\r\n** Concerning Dynamic Storage Allocation\". Journal of the Association for\r\n** Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499.\r\n** \r\n** Let n be the size of the largest allocation divided by the minimum\r\n** allocation size (after rounding all sizes up to a power of 2.)  Let M\r\n** be the maximum amount of memory ever outstanding at one time.  Let\r\n** N be the total amount of memory available for allocation.  Robson\r\n** proved that this memory allocator will never breakdown due to \r\n** fragmentation as long as the following constraint holds:\r\n**\r\n**      N >=  M*(1 + log2(n)/2) - n + 1\r\n**\r\n** The sqlite3_status() logic tracks the maximum values of n and M so\r\n** that an application can, at any time, verify this constraint.\r\n*/\r\n\r\n/*\r\n** This version of the memory allocator is used only when \r\n** SQLITE_ENABLE_MEMSYS5 is defined.\r\n*/\r\n#ifdef SQLITE_ENABLE_MEMSYS5\r\n\r\n/*\r\n** A minimum allocation is an instance of the following structure.\r\n** Larger allocations are an array of these structures where the\r\n** size of the array is a power of 2.\r\n**\r\n** The size of this object must be a power of two.  That fact is\r\n** verified in memsys5Init().\r\n*/\r\ntypedef struct Mem5Link Mem5Link;\r\nstruct Mem5Link {\r\n  int next;       /* Index of next free chunk */\r\n  int prev;       /* Index of previous free chunk */\r\n};\r\n\r\n/*\r\n** Maximum size of any allocation is ((1<<LOGMAX)*mem5.szAtom). Since\r\n** mem5.szAtom is always at least 8 and 32-bit integers are used,\r\n** it is not actually possible to reach this limit.\r\n*/\r\n#define LOGMAX 30\r\n\r\n/*\r\n** Masks used for mem5.aCtrl[] elements.\r\n*/\r\n#define CTRL_LOGSIZE  0x1f    /* Log2 Size of this block */\r\n#define CTRL_FREE     0x20    /* True if not checked out */\r\n\r\n/*\r\n** All of the static variables used by this module are collected\r\n** into a single structure named \"mem5\".  This is to keep the\r\n** static variables organized and to reduce namespace pollution\r\n** when this module is combined with other in the amalgamation.\r\n*/\r\nstatic SQLITE_WSD struct Mem5Global {\r\n  /*\r\n  ** Memory available for allocation\r\n  */\r\n  int szAtom;      /* Smallest possible allocation in bytes */\r\n  int nBlock;      /* Number of szAtom sized blocks in zPool */\r\n  u8 *zPool;       /* Memory available to be allocated */\r\n  \r\n  /*\r\n  ** Mutex to control access to the memory allocation subsystem.\r\n  */\r\n  sqlite3_mutex *mutex;\r\n\r\n  /*\r\n  ** Performance statistics\r\n  */\r\n  u64 nAlloc;         /* Total number of calls to malloc */\r\n  u64 totalAlloc;     /* Total of all malloc calls - includes internal frag */\r\n  u64 totalExcess;    /* Total internal fragmentation */\r\n  u32 currentOut;     /* Current checkout, including internal fragmentation */\r\n  u32 currentCount;   /* Current number of distinct checkouts */\r\n  u32 maxOut;         /* Maximum instantaneous currentOut */\r\n  u32 maxCount;       /* Maximum instantaneous currentCount */\r\n  u32 maxRequest;     /* Largest allocation (exclusive of internal frag) */\r\n  \r\n  /*\r\n  ** Lists of free blocks.  aiFreelist[0] is a list of free blocks of\r\n  ** size mem5.szAtom.  aiFreelist[1] holds blocks of size szAtom*2.\r\n  ** and so forth.\r\n  */\r\n  int aiFreelist[LOGMAX+1];\r\n\r\n  /*\r\n  ** Space for tracking which blocks are checked out and the size\r\n  ** of each block.  One byte per block.\r\n  */\r\n  u8 *aCtrl;\r\n\r\n} mem5;\r\n\r\n/*\r\n** Access the static variable through a macro for SQLITE_OMIT_WSD\r\n*/\r\n#define mem5 GLOBAL(struct Mem5Global, mem5)\r\n\r\n/*\r\n** Assuming mem5.zPool is divided up into an array of Mem5Link\r\n** structures, return a pointer to the idx-th such lik.\r\n*/\r\n#define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.szAtom]))\r\n\r\n/*\r\n** Unlink the chunk at mem5.aPool[i] from list it is currently\r\n** on.  It should be found on mem5.aiFreelist[iLogsize].\r\n*/\r\nstatic void memsys5Unlink(int i, int iLogsize){\r\n  int next, prev;\r\n  assert( i>=0 && i<mem5.nBlock );\r\n  assert( iLogsize>=0 && iLogsize<=LOGMAX );\r\n  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );\r\n\r\n  next = MEM5LINK(i)->next;\r\n  prev = MEM5LINK(i)->prev;\r\n  if( prev<0 ){\r\n    mem5.aiFreelist[iLogsize] = next;\r\n  }else{\r\n    MEM5LINK(prev)->next = next;\r\n  }\r\n  if( next>=0 ){\r\n    MEM5LINK(next)->prev = prev;\r\n  }\r\n}\r\n\r\n/*\r\n** Link the chunk at mem5.aPool[i] so that is on the iLogsize\r\n** free list.\r\n*/\r\nstatic void memsys5Link(int i, int iLogsize){\r\n  int x;\r\n  assert( sqlite3_mutex_held(mem5.mutex) );\r\n  assert( i>=0 && i<mem5.nBlock );\r\n  assert( iLogsize>=0 && iLogsize<=LOGMAX );\r\n  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );\r\n\r\n  x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize];\r\n  MEM5LINK(i)->prev = -1;\r\n  if( x>=0 ){\r\n    assert( x<mem5.nBlock );\r\n    MEM5LINK(x)->prev = i;\r\n  }\r\n  mem5.aiFreelist[iLogsize] = i;\r\n}\r\n\r\n/*\r\n** If the STATIC_MEM mutex is not already held, obtain it now. The mutex\r\n** will already be held (obtained by code in malloc.c) if\r\n** sqlite3GlobalConfig.bMemStat is true.\r\n*/\r\nstatic void memsys5Enter(void){\r\n  sqlite3_mutex_enter(mem5.mutex);\r\n}\r\nstatic void memsys5Leave(void){\r\n  sqlite3_mutex_leave(mem5.mutex);\r\n}\r\n\r\n/*\r\n** Return the size of an outstanding allocation, in bytes.  The\r\n** size returned omits the 8-byte header overhead.  This only\r\n** works for chunks that are currently checked out.\r\n*/\r\nstatic int memsys5Size(void *p){\r\n  int iSize = 0;\r\n  if( p ){\r\n    int i = ((u8 *)p-mem5.zPool)/mem5.szAtom;\r\n    assert( i>=0 && i<mem5.nBlock );\r\n    iSize = mem5.szAtom * (1 << (mem5.aCtrl[i]&CTRL_LOGSIZE));\r\n  }\r\n  return iSize;\r\n}\r\n\r\n/*\r\n** Find the first entry on the freelist iLogsize.  Unlink that\r\n** entry and return its index. \r\n*/\r\nstatic int memsys5UnlinkFirst(int iLogsize){\r\n  int i;\r\n  int iFirst;\r\n\r\n  assert( iLogsize>=0 && iLogsize<=LOGMAX );\r\n  i = iFirst = mem5.aiFreelist[iLogsize];\r\n  assert( iFirst>=0 );\r\n  while( i>0 ){\r\n    if( i<iFirst ) iFirst = i;\r\n    i = MEM5LINK(i)->next;\r\n  }\r\n  memsys5Unlink(iFirst, iLogsize);\r\n  return iFirst;\r\n}\r\n\r\n/*\r\n** Return a block of memory of at least nBytes in size.\r\n** Return NULL if unable.  Return NULL if nBytes==0.\r\n**\r\n** The caller guarantees that nByte positive.\r\n**\r\n** The caller has obtained a mutex prior to invoking this\r\n** routine so there is never any chance that two or more\r\n** threads can be in this routine at the same time.\r\n*/\r\nstatic void *memsys5MallocUnsafe(int nByte){\r\n  int i;           /* Index of a mem5.aPool[] slot */\r\n  int iBin;        /* Index into mem5.aiFreelist[] */\r\n  int iFullSz;     /* Size of allocation rounded up to power of 2 */\r\n  int iLogsize;    /* Log2 of iFullSz/POW2_MIN */\r\n\r\n  /* nByte must be a positive */\r\n  assert( nByte>0 );\r\n\r\n  /* Keep track of the maximum allocation request.  Even unfulfilled\r\n  ** requests are counted */\r\n  if( (u32)nByte>mem5.maxRequest ){\r\n    mem5.maxRequest = nByte;\r\n  }\r\n\r\n  /* Abort if the requested allocation size is larger than the largest\r\n  ** power of two that we can represent using 32-bit signed integers.\r\n  */\r\n  if( nByte > 0x40000000 ){\r\n    return 0;\r\n  }\r\n\r\n  /* Round nByte up to the next valid power of two */\r\n  for(iFullSz=mem5.szAtom, iLogsize=0; iFullSz<nByte; iFullSz *= 2, iLogsize++){}\r\n\r\n  /* Make sure mem5.aiFreelist[iLogsize] contains at least one free\r\n  ** block.  If not, then split a block of the next larger power of\r\n  ** two in order to create a new free block of size iLogsize.\r\n  */\r\n  for(iBin=iLogsize; mem5.aiFreelist[iBin]<0 && iBin<=LOGMAX; iBin++){}\r\n  if( iBin>LOGMAX ){\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to allocate %u bytes\", nByte);\r\n    return 0;\r\n  }\r\n  i = memsys5UnlinkFirst(iBin);\r\n  while( iBin>iLogsize ){\r\n    int newSize;\r\n\r\n    iBin--;\r\n    newSize = 1 << iBin;\r\n    mem5.aCtrl[i+newSize] = CTRL_FREE | iBin;\r\n    memsys5Link(i+newSize, iBin);\r\n  }\r\n  mem5.aCtrl[i] = iLogsize;\r\n\r\n  /* Update allocator performance statistics. */\r\n  mem5.nAlloc++;\r\n  mem5.totalAlloc += iFullSz;\r\n  mem5.totalExcess += iFullSz - nByte;\r\n  mem5.currentCount++;\r\n  mem5.currentOut += iFullSz;\r\n  if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;\r\n  if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;\r\n\r\n  /* Return a pointer to the allocated memory. */\r\n  return (void*)&mem5.zPool[i*mem5.szAtom];\r\n}\r\n\r\n/*\r\n** Free an outstanding memory allocation.\r\n*/\r\nstatic void memsys5FreeUnsafe(void *pOld){\r\n  u32 size, iLogsize;\r\n  int iBlock;\r\n\r\n  /* Set iBlock to the index of the block pointed to by pOld in \r\n  ** the array of mem5.szAtom byte blocks pointed to by mem5.zPool.\r\n  */\r\n  iBlock = ((u8 *)pOld-mem5.zPool)/mem5.szAtom;\r\n\r\n  /* Check that the pointer pOld points to a valid, non-free block. */\r\n  assert( iBlock>=0 && iBlock<mem5.nBlock );\r\n  assert( ((u8 *)pOld-mem5.zPool)%mem5.szAtom==0 );\r\n  assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 );\r\n\r\n  iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE;\r\n  size = 1<<iLogsize;\r\n  assert( iBlock+size-1<(u32)mem5.nBlock );\r\n\r\n  mem5.aCtrl[iBlock] |= CTRL_FREE;\r\n  mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;\r\n  assert( mem5.currentCount>0 );\r\n  assert( mem5.currentOut>=(size*mem5.szAtom) );\r\n  mem5.currentCount--;\r\n  mem5.currentOut -= size*mem5.szAtom;\r\n  assert( mem5.currentOut>0 || mem5.currentCount==0 );\r\n  assert( mem5.currentCount>0 || mem5.currentOut==0 );\r\n\r\n  mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;\r\n  while( ALWAYS(iLogsize<LOGMAX) ){\r\n    int iBuddy;\r\n    if( (iBlock>>iLogsize) & 1 ){\r\n      iBuddy = iBlock - size;\r\n    }else{\r\n      iBuddy = iBlock + size;\r\n    }\r\n    assert( iBuddy>=0 );\r\n    if( (iBuddy+(1<<iLogsize))>mem5.nBlock ) break;\r\n    if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break;\r\n    memsys5Unlink(iBuddy, iLogsize);\r\n    iLogsize++;\r\n    if( iBuddy<iBlock ){\r\n      mem5.aCtrl[iBuddy] = CTRL_FREE | iLogsize;\r\n      mem5.aCtrl[iBlock] = 0;\r\n      iBlock = iBuddy;\r\n    }else{\r\n      mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;\r\n      mem5.aCtrl[iBuddy] = 0;\r\n    }\r\n    size *= 2;\r\n  }\r\n  memsys5Link(iBlock, iLogsize);\r\n}\r\n\r\n/*\r\n** Allocate nBytes of memory\r\n*/\r\nstatic void *memsys5Malloc(int nBytes){\r\n  sqlite3_int64 *p = 0;\r\n  if( nBytes>0 ){\r\n    memsys5Enter();\r\n    p = memsys5MallocUnsafe(nBytes);\r\n    memsys5Leave();\r\n  }\r\n  return (void*)p; \r\n}\r\n\r\n/*\r\n** Free memory.\r\n**\r\n** The outer layer memory allocator prevents this routine from\r\n** being called with pPrior==0.\r\n*/\r\nstatic void memsys5Free(void *pPrior){\r\n  assert( pPrior!=0 );\r\n  memsys5Enter();\r\n  memsys5FreeUnsafe(pPrior);\r\n  memsys5Leave();  \r\n}\r\n\r\n/*\r\n** Change the size of an existing memory allocation.\r\n**\r\n** The outer layer memory allocator prevents this routine from\r\n** being called with pPrior==0.  \r\n**\r\n** nBytes is always a value obtained from a prior call to\r\n** memsys5Round().  Hence nBytes is always a non-negative power\r\n** of two.  If nBytes==0 that means that an oversize allocation\r\n** (an allocation larger than 0x40000000) was requested and this\r\n** routine should return 0 without freeing pPrior.\r\n*/\r\nstatic void *memsys5Realloc(void *pPrior, int nBytes){\r\n  int nOld;\r\n  void *p;\r\n  assert( pPrior!=0 );\r\n  assert( (nBytes&(nBytes-1))==0 );  /* EV: R-46199-30249 */\r\n  assert( nBytes>=0 );\r\n  if( nBytes==0 ){\r\n    return 0;\r\n  }\r\n  nOld = memsys5Size(pPrior);\r\n  if( nBytes<=nOld ){\r\n    return pPrior;\r\n  }\r\n  memsys5Enter();\r\n  p = memsys5MallocUnsafe(nBytes);\r\n  if( p ){\r\n    memcpy(p, pPrior, nOld);\r\n    memsys5FreeUnsafe(pPrior);\r\n  }\r\n  memsys5Leave();\r\n  return p;\r\n}\r\n\r\n/*\r\n** Round up a request size to the next valid allocation size.  If\r\n** the allocation is too large to be handled by this allocation system,\r\n** return 0.\r\n**\r\n** All allocations must be a power of two and must be expressed by a\r\n** 32-bit signed integer.  Hence the largest allocation is 0x40000000\r\n** or 1073741824 bytes.\r\n*/\r\nstatic int memsys5Roundup(int n){\r\n  int iFullSz;\r\n  if( n > 0x40000000 ) return 0;\r\n  for(iFullSz=mem5.szAtom; iFullSz<n; iFullSz *= 2);\r\n  return iFullSz;\r\n}\r\n\r\n/*\r\n** Return the ceiling of the logarithm base 2 of iValue.\r\n**\r\n** Examples:   memsys5Log(1) -> 0\r\n**             memsys5Log(2) -> 1\r\n**             memsys5Log(4) -> 2\r\n**             memsys5Log(5) -> 3\r\n**             memsys5Log(8) -> 3\r\n**             memsys5Log(9) -> 4\r\n*/\r\nstatic int memsys5Log(int iValue){\r\n  int iLog;\r\n  for(iLog=0; (iLog<(int)((sizeof(int)*8)-1)) && (1<<iLog)<iValue; iLog++);\r\n  return iLog;\r\n}\r\n\r\n/*\r\n** Initialize the memory allocator.\r\n**\r\n** This routine is not threadsafe.  The caller must be holding a mutex\r\n** to prevent multiple threads from entering at the same time.\r\n*/\r\nstatic int memsys5Init(void *NotUsed){\r\n  int ii;            /* Loop counter */\r\n  int nByte;         /* Number of bytes of memory available to this allocator */\r\n  u8 *zByte;         /* Memory usable by this allocator */\r\n  int nMinLog;       /* Log base 2 of minimum allocation size in bytes */\r\n  int iOffset;       /* An offset into mem5.aCtrl[] */\r\n\r\n  UNUSED_PARAMETER(NotUsed);\r\n\r\n  /* For the purposes of this routine, disable the mutex */\r\n  mem5.mutex = 0;\r\n\r\n  /* The size of a Mem5Link object must be a power of two.  Verify that\r\n  ** this is case.\r\n  */\r\n  assert( (sizeof(Mem5Link)&(sizeof(Mem5Link)-1))==0 );\r\n\r\n  nByte = sqlite3GlobalConfig.nHeap;\r\n  zByte = (u8*)sqlite3GlobalConfig.pHeap;\r\n  assert( zByte!=0 );  /* sqlite3_config() does not allow otherwise */\r\n\r\n  /* boundaries on sqlite3GlobalConfig.mnReq are enforced in sqlite3_config() */\r\n  nMinLog = memsys5Log(sqlite3GlobalConfig.mnReq);\r\n  mem5.szAtom = (1<<nMinLog);\r\n  while( (int)sizeof(Mem5Link)>mem5.szAtom ){\r\n    mem5.szAtom = mem5.szAtom << 1;\r\n  }\r\n\r\n  mem5.nBlock = (nByte / (mem5.szAtom+sizeof(u8)));\r\n  mem5.zPool = zByte;\r\n  mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.szAtom];\r\n\r\n  for(ii=0; ii<=LOGMAX; ii++){\r\n    mem5.aiFreelist[ii] = -1;\r\n  }\r\n\r\n  iOffset = 0;\r\n  for(ii=LOGMAX; ii>=0; ii--){\r\n    int nAlloc = (1<<ii);\r\n    if( (iOffset+nAlloc)<=mem5.nBlock ){\r\n      mem5.aCtrl[iOffset] = ii | CTRL_FREE;\r\n      memsys5Link(iOffset, ii);\r\n      iOffset += nAlloc;\r\n    }\r\n    assert((iOffset+nAlloc)>mem5.nBlock);\r\n  }\r\n\r\n  /* If a mutex is required for normal operation, allocate one */\r\n  if( sqlite3GlobalConfig.bMemstat==0 ){\r\n    mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Deinitialize this module.\r\n*/\r\nstatic void memsys5Shutdown(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  mem5.mutex = 0;\r\n  return;\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** Open the file indicated and write a log of all unfreed memory \r\n** allocations into that log.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Memsys5Dump(const char *zFilename){\r\n  FILE *out;\r\n  int i, j, n;\r\n  int nMinLog;\r\n\r\n  if( zFilename==0 || zFilename[0]==0 ){\r\n    out = stdout;\r\n  }else{\r\n    out = fopen(zFilename, \"w\");\r\n    if( out==0 ){\r\n      fprintf(stderr, \"** Unable to output memory debug output log: %s **\\n\",\r\n                      zFilename);\r\n      return;\r\n    }\r\n  }\r\n  memsys5Enter();\r\n  nMinLog = memsys5Log(mem5.szAtom);\r\n  for(i=0; i<=LOGMAX && i+nMinLog<32; i++){\r\n    for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){}\r\n    fprintf(out, \"freelist items of size %d: %d\\n\", mem5.szAtom << i, n);\r\n  }\r\n  fprintf(out, \"mem5.nAlloc       = %llu\\n\", mem5.nAlloc);\r\n  fprintf(out, \"mem5.totalAlloc   = %llu\\n\", mem5.totalAlloc);\r\n  fprintf(out, \"mem5.totalExcess  = %llu\\n\", mem5.totalExcess);\r\n  fprintf(out, \"mem5.currentOut   = %u\\n\", mem5.currentOut);\r\n  fprintf(out, \"mem5.currentCount = %u\\n\", mem5.currentCount);\r\n  fprintf(out, \"mem5.maxOut       = %u\\n\", mem5.maxOut);\r\n  fprintf(out, \"mem5.maxCount     = %u\\n\", mem5.maxCount);\r\n  fprintf(out, \"mem5.maxRequest   = %u\\n\", mem5.maxRequest);\r\n  memsys5Leave();\r\n  if( out==stdout ){\r\n    fflush(stdout);\r\n  }else{\r\n    fclose(out);\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** This routine is the only routine in this file with external \r\n** linkage. It returns a pointer to a static sqlite3_mem_methods\r\n** struct populated with the memsys5 methods.\r\n*/\r\nSQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){\r\n  static const sqlite3_mem_methods memsys5Methods = {\r\n     memsys5Malloc,\r\n     memsys5Free,\r\n     memsys5Realloc,\r\n     memsys5Size,\r\n     memsys5Roundup,\r\n     memsys5Init,\r\n     memsys5Shutdown,\r\n     0\r\n  };\r\n  return &memsys5Methods;\r\n}\r\n\r\n#endif /* SQLITE_ENABLE_MEMSYS5 */\r\n\r\n/************** End of mem5.c ************************************************/\r\n/************** Begin file mutex.c *******************************************/\r\n/*\r\n** 2007 August 14\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement mutexes.\r\n**\r\n** This file contains code that is common across all mutex implementations.\r\n*/\r\n\r\n#if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT)\r\n/*\r\n** For debugging purposes, record when the mutex subsystem is initialized\r\n** and uninitialized so that we can assert() if there is an attempt to\r\n** allocate a mutex while the system is uninitialized.\r\n*/\r\nstatic SQLITE_WSD int mutexIsInit = 0;\r\n#endif /* SQLITE_DEBUG */\r\n\r\n\r\n#ifndef SQLITE_MUTEX_OMIT\r\n/*\r\n** Initialize the mutex system.\r\n*/\r\nSQLITE_PRIVATE int sqlite3MutexInit(void){ \r\n  int rc = SQLITE_OK;\r\n  if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){\r\n    /* If the xMutexAlloc method has not been set, then the user did not\r\n    ** install a mutex implementation via sqlite3_config() prior to \r\n    ** sqlite3_initialize() being called. This block copies pointers to\r\n    ** the default implementation into the sqlite3GlobalConfig structure.\r\n    */\r\n    sqlite3_mutex_methods const *pFrom;\r\n    sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;\r\n\r\n    if( sqlite3GlobalConfig.bCoreMutex ){\r\n      pFrom = sqlite3DefaultMutex();\r\n    }else{\r\n      pFrom = sqlite3NoopMutex();\r\n    }\r\n    memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));\r\n    memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,\r\n           sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));\r\n    pTo->xMutexAlloc = pFrom->xMutexAlloc;\r\n  }\r\n  rc = sqlite3GlobalConfig.mutex.xMutexInit();\r\n\r\n#ifdef SQLITE_DEBUG\r\n  GLOBAL(int, mutexIsInit) = 1;\r\n#endif\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Shutdown the mutex system. This call frees resources allocated by\r\n** sqlite3MutexInit().\r\n*/\r\nSQLITE_PRIVATE int sqlite3MutexEnd(void){\r\n  int rc = SQLITE_OK;\r\n  if( sqlite3GlobalConfig.mutex.xMutexEnd ){\r\n    rc = sqlite3GlobalConfig.mutex.xMutexEnd();\r\n  }\r\n\r\n#ifdef SQLITE_DEBUG\r\n  GLOBAL(int, mutexIsInit) = 0;\r\n#endif\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Retrieve a pointer to a static mutex or allocate a new dynamic one.\r\n*/\r\nSQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  if( sqlite3_initialize() ) return 0;\r\n#endif\r\n  return sqlite3GlobalConfig.mutex.xMutexAlloc(id);\r\n}\r\n\r\nSQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){\r\n  if( !sqlite3GlobalConfig.bCoreMutex ){\r\n    return 0;\r\n  }\r\n  assert( GLOBAL(int, mutexIsInit) );\r\n  return sqlite3GlobalConfig.mutex.xMutexAlloc(id);\r\n}\r\n\r\n/*\r\n** Free a dynamic mutex.\r\n*/\r\nSQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){\r\n  if( p ){\r\n    sqlite3GlobalConfig.mutex.xMutexFree(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Obtain the mutex p. If some other thread already has the mutex, block\r\n** until it can be obtained.\r\n*/\r\nSQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){\r\n  if( p ){\r\n    sqlite3GlobalConfig.mutex.xMutexEnter(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another\r\n** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.\r\n*/\r\nSQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){\r\n  int rc = SQLITE_OK;\r\n  if( p ){\r\n    return sqlite3GlobalConfig.mutex.xMutexTry(p);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_leave() routine exits a mutex that was previously\r\n** entered by the same thread.  The behavior is undefined if the mutex \r\n** is not currently entered. If a NULL pointer is passed as an argument\r\n** this function is a no-op.\r\n*/\r\nSQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){\r\n  if( p ){\r\n    sqlite3GlobalConfig.mutex.xMutexLeave(p);\r\n  }\r\n}\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\r\n** intended for use inside assert() statements.\r\n*/\r\nSQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){\r\n  return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);\r\n}\r\nSQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){\r\n  return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);\r\n}\r\n#endif\r\n\r\n#endif /* !defined(SQLITE_MUTEX_OMIT) */\r\n\r\n/************** End of mutex.c ***********************************************/\r\n/************** Begin file mutex_noop.c **************************************/\r\n/*\r\n** 2008 October 07\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement mutexes.\r\n**\r\n** This implementation in this file does not provide any mutual\r\n** exclusion and is thus suitable for use only in applications\r\n** that use SQLite in a single thread.  The routines defined\r\n** here are place-holders.  Applications can substitute working\r\n** mutex routines at start-time using the\r\n**\r\n**     sqlite3_config(SQLITE_CONFIG_MUTEX,...)\r\n**\r\n** interface.\r\n**\r\n** If compiled with SQLITE_DEBUG, then additional logic is inserted\r\n** that does error checking on mutexes to make sure they are being\r\n** called correctly.\r\n*/\r\n\r\n#ifndef SQLITE_MUTEX_OMIT\r\n\r\n#ifndef SQLITE_DEBUG\r\n/*\r\n** Stub routines for all mutex methods.\r\n**\r\n** This routines provide no mutual exclusion or error checking.\r\n*/\r\nstatic int noopMutexInit(void){ return SQLITE_OK; }\r\nstatic int noopMutexEnd(void){ return SQLITE_OK; }\r\nstatic sqlite3_mutex *noopMutexAlloc(int id){ \r\n  UNUSED_PARAMETER(id);\r\n  return (sqlite3_mutex*)8; \r\n}\r\nstatic void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }\r\nstatic void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }\r\nstatic int noopMutexTry(sqlite3_mutex *p){\r\n  UNUSED_PARAMETER(p);\r\n  return SQLITE_OK;\r\n}\r\nstatic void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }\r\n\r\nSQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){\r\n  static const sqlite3_mutex_methods sMutex = {\r\n    noopMutexInit,\r\n    noopMutexEnd,\r\n    noopMutexAlloc,\r\n    noopMutexFree,\r\n    noopMutexEnter,\r\n    noopMutexTry,\r\n    noopMutexLeave,\r\n\r\n    0,\r\n    0,\r\n  };\r\n\r\n  return &sMutex;\r\n}\r\n#endif /* !SQLITE_DEBUG */\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** In this implementation, error checking is provided for testing\r\n** and debugging purposes.  The mutexes still do not provide any\r\n** mutual exclusion.\r\n*/\r\n\r\n/*\r\n** The mutex object\r\n*/\r\ntypedef struct sqlite3_debug_mutex {\r\n  int id;     /* The mutex type */\r\n  int cnt;    /* Number of entries without a matching leave */\r\n} sqlite3_debug_mutex;\r\n\r\n/*\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\r\n** intended for use inside assert() statements.\r\n*/\r\nstatic int debugMutexHeld(sqlite3_mutex *pX){\r\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\r\n  return p==0 || p->cnt>0;\r\n}\r\nstatic int debugMutexNotheld(sqlite3_mutex *pX){\r\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\r\n  return p==0 || p->cnt==0;\r\n}\r\n\r\n/*\r\n** Initialize and deinitialize the mutex subsystem.\r\n*/\r\nstatic int debugMutexInit(void){ return SQLITE_OK; }\r\nstatic int debugMutexEnd(void){ return SQLITE_OK; }\r\n\r\n/*\r\n** The sqlite3_mutex_alloc() routine allocates a new\r\n** mutex and returns a pointer to it.  If it returns NULL\r\n** that means that a mutex could not be allocated. \r\n*/\r\nstatic sqlite3_mutex *debugMutexAlloc(int id){\r\n  static sqlite3_debug_mutex aStatic[6];\r\n  sqlite3_debug_mutex *pNew = 0;\r\n  switch( id ){\r\n    case SQLITE_MUTEX_FAST:\r\n    case SQLITE_MUTEX_RECURSIVE: {\r\n      pNew = sqlite3Malloc(sizeof(*pNew));\r\n      if( pNew ){\r\n        pNew->id = id;\r\n        pNew->cnt = 0;\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      assert( id-2 >= 0 );\r\n      assert( id-2 < (int)(sizeof(aStatic)/sizeof(aStatic[0])) );\r\n      pNew = &aStatic[id-2];\r\n      pNew->id = id;\r\n      break;\r\n    }\r\n  }\r\n  return (sqlite3_mutex*)pNew;\r\n}\r\n\r\n/*\r\n** This routine deallocates a previously allocated mutex.\r\n*/\r\nstatic void debugMutexFree(sqlite3_mutex *pX){\r\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\r\n  assert( p->cnt==0 );\r\n  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\r\n** to enter a mutex.  If another thread is already within the mutex,\r\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\r\n** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK\r\n** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can\r\n** be entered multiple times by the same thread.  In such cases the,\r\n** mutex must be exited an equal number of times before another thread\r\n** can enter.  If the same thread tries to enter any other kind of mutex\r\n** more than once, the behavior is undefined.\r\n*/\r\nstatic void debugMutexEnter(sqlite3_mutex *pX){\r\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );\r\n  p->cnt++;\r\n}\r\nstatic int debugMutexTry(sqlite3_mutex *pX){\r\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );\r\n  p->cnt++;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_leave() routine exits a mutex that was\r\n** previously entered by the same thread.  The behavior\r\n** is undefined if the mutex is not currently entered or\r\n** is not currently allocated.  SQLite will never do either.\r\n*/\r\nstatic void debugMutexLeave(sqlite3_mutex *pX){\r\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\r\n  assert( debugMutexHeld(pX) );\r\n  p->cnt--;\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );\r\n}\r\n\r\nSQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){\r\n  static const sqlite3_mutex_methods sMutex = {\r\n    debugMutexInit,\r\n    debugMutexEnd,\r\n    debugMutexAlloc,\r\n    debugMutexFree,\r\n    debugMutexEnter,\r\n    debugMutexTry,\r\n    debugMutexLeave,\r\n\r\n    debugMutexHeld,\r\n    debugMutexNotheld\r\n  };\r\n\r\n  return &sMutex;\r\n}\r\n#endif /* SQLITE_DEBUG */\r\n\r\n/*\r\n** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation\r\n** is used regardless of the run-time threadsafety setting.\r\n*/\r\n#ifdef SQLITE_MUTEX_NOOP\r\nSQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){\r\n  return sqlite3NoopMutex();\r\n}\r\n#endif /* defined(SQLITE_MUTEX_NOOP) */\r\n#endif /* !defined(SQLITE_MUTEX_OMIT) */\r\n\r\n/************** End of mutex_noop.c ******************************************/\r\n/************** Begin file mutex_os2.c ***************************************/\r\n/*\r\n** 2007 August 28\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement mutexes for OS/2\r\n*/\r\n\r\n/*\r\n** The code in this file is only used if SQLITE_MUTEX_OS2 is defined.\r\n** See the mutex.h file for details.\r\n*/\r\n#ifdef SQLITE_MUTEX_OS2\r\n\r\n/********************** OS/2 Mutex Implementation **********************\r\n**\r\n** This implementation of mutexes is built using the OS/2 API.\r\n*/\r\n\r\n/*\r\n** The mutex object\r\n** Each recursive mutex is an instance of the following structure.\r\n*/\r\nstruct sqlite3_mutex {\r\n  HMTX mutex;       /* Mutex controlling the lock */\r\n  int  id;          /* Mutex type */\r\n#ifdef SQLITE_DEBUG\r\n int   trace;       /* True to trace changes */\r\n#endif\r\n};\r\n\r\n#ifdef SQLITE_DEBUG\r\n#define SQLITE3_MUTEX_INITIALIZER { 0, 0, 0 }\r\n#else\r\n#define SQLITE3_MUTEX_INITIALIZER { 0, 0 }\r\n#endif\r\n\r\n/*\r\n** Initialize and deinitialize the mutex subsystem.\r\n*/\r\nstatic int os2MutexInit(void){ return SQLITE_OK; }\r\nstatic int os2MutexEnd(void){ return SQLITE_OK; }\r\n\r\n/*\r\n** The sqlite3_mutex_alloc() routine allocates a new\r\n** mutex and returns a pointer to it.  If it returns NULL\r\n** that means that a mutex could not be allocated. \r\n** SQLite will unwind its stack and return an error.  The argument\r\n** to sqlite3_mutex_alloc() is one of these integer constants:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_MUTEX_FAST\r\n** <li>  SQLITE_MUTEX_RECURSIVE\r\n** <li>  SQLITE_MUTEX_STATIC_MASTER\r\n** <li>  SQLITE_MUTEX_STATIC_MEM\r\n** <li>  SQLITE_MUTEX_STATIC_MEM2\r\n** <li>  SQLITE_MUTEX_STATIC_PRNG\r\n** <li>  SQLITE_MUTEX_STATIC_LRU\r\n** <li>  SQLITE_MUTEX_STATIC_LRU2\r\n** </ul>\r\n**\r\n** The first two constants cause sqlite3_mutex_alloc() to create\r\n** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\r\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\r\n** The mutex implementation does not need to make a distinction\r\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\r\n** not want to.  But SQLite will only request a recursive mutex in\r\n** cases where it really needs one.  If a faster non-recursive mutex\r\n** implementation is available on the host platform, the mutex subsystem\r\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\r\n**\r\n** The other allowed parameters to sqlite3_mutex_alloc() each return\r\n** a pointer to a static preexisting mutex.  Six static mutexes are\r\n** used by the current version of SQLite.  Future versions of SQLite\r\n** may add additional static mutexes.  Static mutexes are for internal\r\n** use by SQLite only.  Applications that use SQLite mutexes should\r\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\r\n** SQLITE_MUTEX_RECURSIVE.\r\n**\r\n** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\r\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\r\n** returns a different mutex on every call.  But for the static\r\n** mutex types, the same mutex is returned on every call that has\r\n** the same type number.\r\n*/\r\nstatic sqlite3_mutex *os2MutexAlloc(int iType){\r\n  sqlite3_mutex *p = NULL;\r\n  switch( iType ){\r\n    case SQLITE_MUTEX_FAST:\r\n    case SQLITE_MUTEX_RECURSIVE: {\r\n      p = sqlite3MallocZero( sizeof(*p) );\r\n      if( p ){\r\n        p->id = iType;\r\n        if( DosCreateMutexSem( 0, &p->mutex, 0, FALSE ) != NO_ERROR ){\r\n          sqlite3_free( p );\r\n          p = NULL;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      static volatile int isInit = 0;\r\n      static sqlite3_mutex staticMutexes[6] = {\r\n        SQLITE3_MUTEX_INITIALIZER,\r\n        SQLITE3_MUTEX_INITIALIZER,\r\n        SQLITE3_MUTEX_INITIALIZER,\r\n        SQLITE3_MUTEX_INITIALIZER,\r\n        SQLITE3_MUTEX_INITIALIZER,\r\n        SQLITE3_MUTEX_INITIALIZER,\r\n      };\r\n      if ( !isInit ){\r\n        APIRET rc;\r\n        PTIB ptib;\r\n        PPIB ppib;\r\n        HMTX mutex;\r\n        char name[32];\r\n        DosGetInfoBlocks( &ptib, &ppib );\r\n        sqlite3_snprintf( sizeof(name), name, \"\\\\SEM32\\\\SQLITE%04x\",\r\n                          ppib->pib_ulpid );\r\n        while( !isInit ){\r\n          mutex = 0;\r\n          rc = DosCreateMutexSem( name, &mutex, 0, FALSE);\r\n          if( rc == NO_ERROR ){\r\n            unsigned int i;\r\n            if( !isInit ){\r\n              for( i = 0; i < sizeof(staticMutexes)/sizeof(staticMutexes[0]); i++ ){\r\n                DosCreateMutexSem( 0, &staticMutexes[i].mutex, 0, FALSE );\r\n              }\r\n              isInit = 1;\r\n            }\r\n            DosCloseMutexSem( mutex );\r\n          }else if( rc == ERROR_DUPLICATE_NAME ){\r\n            DosSleep( 1 );\r\n          }else{\r\n            return p;\r\n          }\r\n        }\r\n      }\r\n      assert( iType-2 >= 0 );\r\n      assert( iType-2 < sizeof(staticMutexes)/sizeof(staticMutexes[0]) );\r\n      p = &staticMutexes[iType-2];\r\n      p->id = iType;\r\n      break;\r\n    }\r\n  }\r\n  return p;\r\n}\r\n\r\n\r\n/*\r\n** This routine deallocates a previously allocated mutex.\r\n** SQLite is careful to deallocate every mutex that it allocates.\r\n*/\r\nstatic void os2MutexFree(sqlite3_mutex *p){\r\n#ifdef SQLITE_DEBUG\r\n  TID tid;\r\n  PID pid;\r\n  ULONG ulCount;\r\n  DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);\r\n  assert( ulCount==0 );\r\n  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );\r\n#endif\r\n  DosCloseMutexSem( p->mutex );\r\n  sqlite3_free( p );\r\n}\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\r\n** intended for use inside assert() statements.\r\n*/\r\nstatic int os2MutexHeld(sqlite3_mutex *p){\r\n  TID tid;\r\n  PID pid;\r\n  ULONG ulCount;\r\n  PTIB ptib;\r\n  DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);\r\n  if( ulCount==0 || ( ulCount>1 && p->id!=SQLITE_MUTEX_RECURSIVE ) )\r\n    return 0;\r\n  DosGetInfoBlocks(&ptib, NULL);\r\n  return tid==ptib->tib_ptib2->tib2_ultid;\r\n}\r\nstatic int os2MutexNotheld(sqlite3_mutex *p){\r\n  TID tid;\r\n  PID pid;\r\n  ULONG ulCount;\r\n  PTIB ptib;\r\n  DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);\r\n  if( ulCount==0 )\r\n    return 1;\r\n  DosGetInfoBlocks(&ptib, NULL);\r\n  return tid!=ptib->tib_ptib2->tib2_ultid;\r\n}\r\nstatic void os2MutexTrace(sqlite3_mutex *p, char *pAction){\r\n  TID   tid;\r\n  PID   pid;\r\n  ULONG ulCount;\r\n  DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);\r\n  printf(\"%s mutex %p (%d) with nRef=%ld\\n\", pAction, (void*)p, p->trace, ulCount);\r\n}\r\n#endif\r\n\r\n/*\r\n** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\r\n** to enter a mutex.  If another thread is already within the mutex,\r\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\r\n** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK\r\n** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can\r\n** be entered multiple times by the same thread.  In such cases the,\r\n** mutex must be exited an equal number of times before another thread\r\n** can enter.  If the same thread tries to enter any other kind of mutex\r\n** more than once, the behavior is undefined.\r\n*/\r\nstatic void os2MutexEnter(sqlite3_mutex *p){\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || os2MutexNotheld(p) );\r\n  DosRequestMutexSem(p->mutex, SEM_INDEFINITE_WAIT);\r\n#ifdef SQLITE_DEBUG\r\n  if( p->trace ) os2MutexTrace(p, \"enter\");\r\n#endif\r\n}\r\nstatic int os2MutexTry(sqlite3_mutex *p){\r\n  int rc = SQLITE_BUSY;\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || os2MutexNotheld(p) );\r\n  if( DosRequestMutexSem(p->mutex, SEM_IMMEDIATE_RETURN) == NO_ERROR ) {\r\n    rc = SQLITE_OK;\r\n#ifdef SQLITE_DEBUG\r\n    if( p->trace ) os2MutexTrace(p, \"try\");\r\n#endif\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_leave() routine exits a mutex that was\r\n** previously entered by the same thread.  The behavior\r\n** is undefined if the mutex is not currently entered or\r\n** is not currently allocated.  SQLite will never do either.\r\n*/\r\nstatic void os2MutexLeave(sqlite3_mutex *p){\r\n  assert( os2MutexHeld(p) );\r\n  DosReleaseMutexSem(p->mutex);\r\n#ifdef SQLITE_DEBUG\r\n  if( p->trace ) os2MutexTrace(p, \"leave\");\r\n#endif\r\n}\r\n\r\nSQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){\r\n  static const sqlite3_mutex_methods sMutex = {\r\n    os2MutexInit,\r\n    os2MutexEnd,\r\n    os2MutexAlloc,\r\n    os2MutexFree,\r\n    os2MutexEnter,\r\n    os2MutexTry,\r\n    os2MutexLeave,\r\n#ifdef SQLITE_DEBUG\r\n    os2MutexHeld,\r\n    os2MutexNotheld\r\n#else\r\n    0,\r\n    0\r\n#endif\r\n  };\r\n\r\n  return &sMutex;\r\n}\r\n#endif /* SQLITE_MUTEX_OS2 */\r\n\r\n/************** End of mutex_os2.c *******************************************/\r\n/************** Begin file mutex_unix.c **************************************/\r\n/*\r\n** 2007 August 28\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement mutexes for pthreads\r\n*/\r\n\r\n/*\r\n** The code in this file is only used if we are compiling threadsafe\r\n** under unix with pthreads.\r\n**\r\n** Note that this implementation requires a version of pthreads that\r\n** supports recursive mutexes.\r\n*/\r\n#ifdef SQLITE_MUTEX_PTHREADS\r\n\r\n#include <pthread.h>\r\n\r\n/*\r\n** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields\r\n** are necessary under two condidtions:  (1) Debug builds and (2) using\r\n** home-grown mutexes.  Encapsulate these conditions into a single #define.\r\n*/\r\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)\r\n# define SQLITE_MUTEX_NREF 1\r\n#else\r\n# define SQLITE_MUTEX_NREF 0\r\n#endif\r\n\r\n/*\r\n** Each recursive mutex is an instance of the following structure.\r\n*/\r\nstruct sqlite3_mutex {\r\n  pthread_mutex_t mutex;     /* Mutex controlling the lock */\r\n#if SQLITE_MUTEX_NREF\r\n  int id;                    /* Mutex type */\r\n  volatile int nRef;         /* Number of entrances */\r\n  volatile pthread_t owner;  /* Thread that is within this mutex */\r\n  int trace;                 /* True to trace changes */\r\n#endif\r\n};\r\n#if SQLITE_MUTEX_NREF\r\n#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0, (pthread_t)0, 0 }\r\n#else\r\n#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }\r\n#endif\r\n\r\n/*\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\r\n** intended for use only inside assert() statements.  On some platforms,\r\n** there might be race conditions that can cause these routines to\r\n** deliver incorrect results.  In particular, if pthread_equal() is\r\n** not an atomic operation, then these routines might delivery\r\n** incorrect results.  On most platforms, pthread_equal() is a \r\n** comparison of two integers and is therefore atomic.  But we are\r\n** told that HPUX is not such a platform.  If so, then these routines\r\n** will not always work correctly on HPUX.\r\n**\r\n** On those platforms where pthread_equal() is not atomic, SQLite\r\n** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to\r\n** make sure no assert() statements are evaluated and hence these\r\n** routines are never called.\r\n*/\r\n#if !defined(NDEBUG) || defined(SQLITE_DEBUG)\r\nstatic int pthreadMutexHeld(sqlite3_mutex *p){\r\n  return (p->nRef!=0 && pthread_equal(p->owner, pthread_self()));\r\n}\r\nstatic int pthreadMutexNotheld(sqlite3_mutex *p){\r\n  return p->nRef==0 || pthread_equal(p->owner, pthread_self())==0;\r\n}\r\n#endif\r\n\r\n/*\r\n** Initialize and deinitialize the mutex subsystem.\r\n*/\r\nstatic int pthreadMutexInit(void){ return SQLITE_OK; }\r\nstatic int pthreadMutexEnd(void){ return SQLITE_OK; }\r\n\r\n/*\r\n** The sqlite3_mutex_alloc() routine allocates a new\r\n** mutex and returns a pointer to it.  If it returns NULL\r\n** that means that a mutex could not be allocated.  SQLite\r\n** will unwind its stack and return an error.  The argument\r\n** to sqlite3_mutex_alloc() is one of these integer constants:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_MUTEX_FAST\r\n** <li>  SQLITE_MUTEX_RECURSIVE\r\n** <li>  SQLITE_MUTEX_STATIC_MASTER\r\n** <li>  SQLITE_MUTEX_STATIC_MEM\r\n** <li>  SQLITE_MUTEX_STATIC_MEM2\r\n** <li>  SQLITE_MUTEX_STATIC_PRNG\r\n** <li>  SQLITE_MUTEX_STATIC_LRU\r\n** <li>  SQLITE_MUTEX_STATIC_PMEM\r\n** </ul>\r\n**\r\n** The first two constants cause sqlite3_mutex_alloc() to create\r\n** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\r\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\r\n** The mutex implementation does not need to make a distinction\r\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\r\n** not want to.  But SQLite will only request a recursive mutex in\r\n** cases where it really needs one.  If a faster non-recursive mutex\r\n** implementation is available on the host platform, the mutex subsystem\r\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\r\n**\r\n** The other allowed parameters to sqlite3_mutex_alloc() each return\r\n** a pointer to a static preexisting mutex.  Six static mutexes are\r\n** used by the current version of SQLite.  Future versions of SQLite\r\n** may add additional static mutexes.  Static mutexes are for internal\r\n** use by SQLite only.  Applications that use SQLite mutexes should\r\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\r\n** SQLITE_MUTEX_RECURSIVE.\r\n**\r\n** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\r\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\r\n** returns a different mutex on every call.  But for the static \r\n** mutex types, the same mutex is returned on every call that has\r\n** the same type number.\r\n*/\r\nstatic sqlite3_mutex *pthreadMutexAlloc(int iType){\r\n  static sqlite3_mutex staticMutexes[] = {\r\n    SQLITE3_MUTEX_INITIALIZER,\r\n    SQLITE3_MUTEX_INITIALIZER,\r\n    SQLITE3_MUTEX_INITIALIZER,\r\n    SQLITE3_MUTEX_INITIALIZER,\r\n    SQLITE3_MUTEX_INITIALIZER,\r\n    SQLITE3_MUTEX_INITIALIZER\r\n  };\r\n  sqlite3_mutex *p;\r\n  switch( iType ){\r\n    case SQLITE_MUTEX_RECURSIVE: {\r\n      p = sqlite3MallocZero( sizeof(*p) );\r\n      if( p ){\r\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\r\n        /* If recursive mutexes are not available, we will have to\r\n        ** build our own.  See below. */\r\n        pthread_mutex_init(&p->mutex, 0);\r\n#else\r\n        /* Use a recursive mutex if it is available */\r\n        pthread_mutexattr_t recursiveAttr;\r\n        pthread_mutexattr_init(&recursiveAttr);\r\n        pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE);\r\n        pthread_mutex_init(&p->mutex, &recursiveAttr);\r\n        pthread_mutexattr_destroy(&recursiveAttr);\r\n#endif\r\n#if SQLITE_MUTEX_NREF\r\n        p->id = iType;\r\n#endif\r\n      }\r\n      break;\r\n    }\r\n    case SQLITE_MUTEX_FAST: {\r\n      p = sqlite3MallocZero( sizeof(*p) );\r\n      if( p ){\r\n#if SQLITE_MUTEX_NREF\r\n        p->id = iType;\r\n#endif\r\n        pthread_mutex_init(&p->mutex, 0);\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      assert( iType-2 >= 0 );\r\n      assert( iType-2 < ArraySize(staticMutexes) );\r\n      p = &staticMutexes[iType-2];\r\n#if SQLITE_MUTEX_NREF\r\n      p->id = iType;\r\n#endif\r\n      break;\r\n    }\r\n  }\r\n  return p;\r\n}\r\n\r\n\r\n/*\r\n** This routine deallocates a previously\r\n** allocated mutex.  SQLite is careful to deallocate every\r\n** mutex that it allocates.\r\n*/\r\nstatic void pthreadMutexFree(sqlite3_mutex *p){\r\n  assert( p->nRef==0 );\r\n  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );\r\n  pthread_mutex_destroy(&p->mutex);\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\r\n** to enter a mutex.  If another thread is already within the mutex,\r\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\r\n** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK\r\n** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can\r\n** be entered multiple times by the same thread.  In such cases the,\r\n** mutex must be exited an equal number of times before another thread\r\n** can enter.  If the same thread tries to enter any other kind of mutex\r\n** more than once, the behavior is undefined.\r\n*/\r\nstatic void pthreadMutexEnter(sqlite3_mutex *p){\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );\r\n\r\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\r\n  /* If recursive mutexes are not available, then we have to grow\r\n  ** our own.  This implementation assumes that pthread_equal()\r\n  ** is atomic - that it cannot be deceived into thinking self\r\n  ** and p->owner are equal if p->owner changes between two values\r\n  ** that are not equal to self while the comparison is taking place.\r\n  ** This implementation also assumes a coherent cache - that \r\n  ** separate processes cannot read different values from the same\r\n  ** address at the same time.  If either of these two conditions\r\n  ** are not met, then the mutexes will fail and problems will result.\r\n  */\r\n  {\r\n    pthread_t self = pthread_self();\r\n    if( p->nRef>0 && pthread_equal(p->owner, self) ){\r\n      p->nRef++;\r\n    }else{\r\n      pthread_mutex_lock(&p->mutex);\r\n      assert( p->nRef==0 );\r\n      p->owner = self;\r\n      p->nRef = 1;\r\n    }\r\n  }\r\n#else\r\n  /* Use the built-in recursive mutexes if they are available.\r\n  */\r\n  pthread_mutex_lock(&p->mutex);\r\n#if SQLITE_MUTEX_NREF\r\n  assert( p->nRef>0 || p->owner==0 );\r\n  p->owner = pthread_self();\r\n  p->nRef++;\r\n#endif\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\n  if( p->trace ){\r\n    printf(\"enter mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\r\n  }\r\n#endif\r\n}\r\nstatic int pthreadMutexTry(sqlite3_mutex *p){\r\n  int rc;\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );\r\n\r\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\r\n  /* If recursive mutexes are not available, then we have to grow\r\n  ** our own.  This implementation assumes that pthread_equal()\r\n  ** is atomic - that it cannot be deceived into thinking self\r\n  ** and p->owner are equal if p->owner changes between two values\r\n  ** that are not equal to self while the comparison is taking place.\r\n  ** This implementation also assumes a coherent cache - that \r\n  ** separate processes cannot read different values from the same\r\n  ** address at the same time.  If either of these two conditions\r\n  ** are not met, then the mutexes will fail and problems will result.\r\n  */\r\n  {\r\n    pthread_t self = pthread_self();\r\n    if( p->nRef>0 && pthread_equal(p->owner, self) ){\r\n      p->nRef++;\r\n      rc = SQLITE_OK;\r\n    }else if( pthread_mutex_trylock(&p->mutex)==0 ){\r\n      assert( p->nRef==0 );\r\n      p->owner = self;\r\n      p->nRef = 1;\r\n      rc = SQLITE_OK;\r\n    }else{\r\n      rc = SQLITE_BUSY;\r\n    }\r\n  }\r\n#else\r\n  /* Use the built-in recursive mutexes if they are available.\r\n  */\r\n  if( pthread_mutex_trylock(&p->mutex)==0 ){\r\n#if SQLITE_MUTEX_NREF\r\n    p->owner = pthread_self();\r\n    p->nRef++;\r\n#endif\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    rc = SQLITE_BUSY;\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\n  if( rc==SQLITE_OK && p->trace ){\r\n    printf(\"enter mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\r\n  }\r\n#endif\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_leave() routine exits a mutex that was\r\n** previously entered by the same thread.  The behavior\r\n** is undefined if the mutex is not currently entered or\r\n** is not currently allocated.  SQLite will never do either.\r\n*/\r\nstatic void pthreadMutexLeave(sqlite3_mutex *p){\r\n  assert( pthreadMutexHeld(p) );\r\n#if SQLITE_MUTEX_NREF\r\n  p->nRef--;\r\n  if( p->nRef==0 ) p->owner = 0;\r\n#endif\r\n  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );\r\n\r\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\r\n  if( p->nRef==0 ){\r\n    pthread_mutex_unlock(&p->mutex);\r\n  }\r\n#else\r\n  pthread_mutex_unlock(&p->mutex);\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\n  if( p->trace ){\r\n    printf(\"leave mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\r\n  }\r\n#endif\r\n}\r\n\r\nSQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){\r\n  static const sqlite3_mutex_methods sMutex = {\r\n    pthreadMutexInit,\r\n    pthreadMutexEnd,\r\n    pthreadMutexAlloc,\r\n    pthreadMutexFree,\r\n    pthreadMutexEnter,\r\n    pthreadMutexTry,\r\n    pthreadMutexLeave,\r\n#ifdef SQLITE_DEBUG\r\n    pthreadMutexHeld,\r\n    pthreadMutexNotheld\r\n#else\r\n    0,\r\n    0\r\n#endif\r\n  };\r\n\r\n  return &sMutex;\r\n}\r\n\r\n#endif /* SQLITE_MUTEX_PTHREADS */\r\n\r\n/************** End of mutex_unix.c ******************************************/\r\n/************** Begin file mutex_w32.c ***************************************/\r\n/*\r\n** 2007 August 14\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement mutexes for win32\r\n*/\r\n\r\n/*\r\n** The code in this file is only used if we are compiling multithreaded\r\n** on a win32 system.\r\n*/\r\n#ifdef SQLITE_MUTEX_W32\r\n\r\n/*\r\n** Each recursive mutex is an instance of the following structure.\r\n*/\r\nstruct sqlite3_mutex {\r\n  CRITICAL_SECTION mutex;    /* Mutex controlling the lock */\r\n  int id;                    /* Mutex type */\r\n#ifdef SQLITE_DEBUG\r\n  volatile int nRef;         /* Number of enterances */\r\n  volatile DWORD owner;      /* Thread holding this mutex */\r\n  int trace;                 /* True to trace changes */\r\n#endif\r\n};\r\n#define SQLITE_W32_MUTEX_INITIALIZER { 0 }\r\n#ifdef SQLITE_DEBUG\r\n#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0, 0L, (DWORD)0, 0 }\r\n#else\r\n#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0 }\r\n#endif\r\n\r\n/*\r\n** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,\r\n** or WinCE.  Return false (zero) for Win95, Win98, or WinME.\r\n**\r\n** Here is an interesting observation:  Win95, Win98, and WinME lack\r\n** the LockFileEx() API.  But we can still statically link against that\r\n** API as long as we don't call it win running Win95/98/ME.  A call to\r\n** this routine is used to determine if the host is Win95/98/ME or\r\n** WinNT/2K/XP so that we will know whether or not we can safely call\r\n** the LockFileEx() API.\r\n**\r\n** mutexIsNT() is only used for the TryEnterCriticalSection() API call,\r\n** which is only available if your application was compiled with \r\n** _WIN32_WINNT defined to a value >= 0x0400.  Currently, the only\r\n** call to TryEnterCriticalSection() is #ifdef'ed out, so #ifdef \r\n** this out as well.\r\n*/\r\n#if 0\r\n#if SQLITE_OS_WINCE\r\n# define mutexIsNT()  (1)\r\n#else\r\n  static int mutexIsNT(void){\r\n    static int osType = 0;\r\n    if( osType==0 ){\r\n      OSVERSIONINFO sInfo;\r\n      sInfo.dwOSVersionInfoSize = sizeof(sInfo);\r\n      GetVersionEx(&sInfo);\r\n      osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;\r\n    }\r\n    return osType==2;\r\n  }\r\n#endif /* SQLITE_OS_WINCE */\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\r\n** intended for use only inside assert() statements.\r\n*/\r\nstatic int winMutexHeld(sqlite3_mutex *p){\r\n  return p->nRef!=0 && p->owner==GetCurrentThreadId();\r\n}\r\nstatic int winMutexNotheld2(sqlite3_mutex *p, DWORD tid){\r\n  return p->nRef==0 || p->owner!=tid;\r\n}\r\nstatic int winMutexNotheld(sqlite3_mutex *p){\r\n  DWORD tid = GetCurrentThreadId(); \r\n  return winMutexNotheld2(p, tid);\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Initialize and deinitialize the mutex subsystem.\r\n*/\r\nstatic sqlite3_mutex winMutex_staticMutexes[6] = {\r\n  SQLITE3_MUTEX_INITIALIZER,\r\n  SQLITE3_MUTEX_INITIALIZER,\r\n  SQLITE3_MUTEX_INITIALIZER,\r\n  SQLITE3_MUTEX_INITIALIZER,\r\n  SQLITE3_MUTEX_INITIALIZER,\r\n  SQLITE3_MUTEX_INITIALIZER\r\n};\r\nstatic int winMutex_isInit = 0;\r\n/* As winMutexInit() and winMutexEnd() are called as part\r\n** of the sqlite3_initialize and sqlite3_shutdown()\r\n** processing, the \"interlocked\" magic is probably not\r\n** strictly necessary.\r\n*/\r\nstatic long winMutex_lock = 0;\r\n\r\nstatic int winMutexInit(void){ \r\n  /* The first to increment to 1 does actual initialization */\r\n  if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){\r\n    int i;\r\n    for(i=0; i<ArraySize(winMutex_staticMutexes); i++){\r\n      InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);\r\n    }\r\n    winMutex_isInit = 1;\r\n  }else{\r\n    /* Someone else is in the process of initing the static mutexes */\r\n    while( !winMutex_isInit ){\r\n      Sleep(1);\r\n    }\r\n  }\r\n  return SQLITE_OK; \r\n}\r\n\r\nstatic int winMutexEnd(void){ \r\n  /* The first to decrement to 0 does actual shutdown \r\n  ** (which should be the last to shutdown.) */\r\n  if( InterlockedCompareExchange(&winMutex_lock, 0, 1)==1 ){\r\n    if( winMutex_isInit==1 ){\r\n      int i;\r\n      for(i=0; i<ArraySize(winMutex_staticMutexes); i++){\r\n        DeleteCriticalSection(&winMutex_staticMutexes[i].mutex);\r\n      }\r\n      winMutex_isInit = 0;\r\n    }\r\n  }\r\n  return SQLITE_OK; \r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_alloc() routine allocates a new\r\n** mutex and returns a pointer to it.  If it returns NULL\r\n** that means that a mutex could not be allocated.  SQLite\r\n** will unwind its stack and return an error.  The argument\r\n** to sqlite3_mutex_alloc() is one of these integer constants:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_MUTEX_FAST\r\n** <li>  SQLITE_MUTEX_RECURSIVE\r\n** <li>  SQLITE_MUTEX_STATIC_MASTER\r\n** <li>  SQLITE_MUTEX_STATIC_MEM\r\n** <li>  SQLITE_MUTEX_STATIC_MEM2\r\n** <li>  SQLITE_MUTEX_STATIC_PRNG\r\n** <li>  SQLITE_MUTEX_STATIC_LRU\r\n** <li>  SQLITE_MUTEX_STATIC_PMEM\r\n** </ul>\r\n**\r\n** The first two constants cause sqlite3_mutex_alloc() to create\r\n** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\r\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\r\n** The mutex implementation does not need to make a distinction\r\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\r\n** not want to.  But SQLite will only request a recursive mutex in\r\n** cases where it really needs one.  If a faster non-recursive mutex\r\n** implementation is available on the host platform, the mutex subsystem\r\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\r\n**\r\n** The other allowed parameters to sqlite3_mutex_alloc() each return\r\n** a pointer to a static preexisting mutex.  Six static mutexes are\r\n** used by the current version of SQLite.  Future versions of SQLite\r\n** may add additional static mutexes.  Static mutexes are for internal\r\n** use by SQLite only.  Applications that use SQLite mutexes should\r\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\r\n** SQLITE_MUTEX_RECURSIVE.\r\n**\r\n** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\r\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\r\n** returns a different mutex on every call.  But for the static \r\n** mutex types, the same mutex is returned on every call that has\r\n** the same type number.\r\n*/\r\nstatic sqlite3_mutex *winMutexAlloc(int iType){\r\n  sqlite3_mutex *p;\r\n\r\n  switch( iType ){\r\n    case SQLITE_MUTEX_FAST:\r\n    case SQLITE_MUTEX_RECURSIVE: {\r\n      p = sqlite3MallocZero( sizeof(*p) );\r\n      if( p ){  \r\n#ifdef SQLITE_DEBUG\r\n        p->id = iType;\r\n#endif\r\n        InitializeCriticalSection(&p->mutex);\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      assert( winMutex_isInit==1 );\r\n      assert( iType-2 >= 0 );\r\n      assert( iType-2 < ArraySize(winMutex_staticMutexes) );\r\n      p = &winMutex_staticMutexes[iType-2];\r\n#ifdef SQLITE_DEBUG\r\n      p->id = iType;\r\n#endif\r\n      break;\r\n    }\r\n  }\r\n  return p;\r\n}\r\n\r\n\r\n/*\r\n** This routine deallocates a previously\r\n** allocated mutex.  SQLite is careful to deallocate every\r\n** mutex that it allocates.\r\n*/\r\nstatic void winMutexFree(sqlite3_mutex *p){\r\n  assert( p );\r\n  assert( p->nRef==0 && p->owner==0 );\r\n  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );\r\n  DeleteCriticalSection(&p->mutex);\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\r\n** to enter a mutex.  If another thread is already within the mutex,\r\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\r\n** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK\r\n** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can\r\n** be entered multiple times by the same thread.  In such cases the,\r\n** mutex must be exited an equal number of times before another thread\r\n** can enter.  If the same thread tries to enter any other kind of mutex\r\n** more than once, the behavior is undefined.\r\n*/\r\nstatic void winMutexEnter(sqlite3_mutex *p){\r\n#ifdef SQLITE_DEBUG\r\n  DWORD tid = GetCurrentThreadId(); \r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );\r\n#endif\r\n  EnterCriticalSection(&p->mutex);\r\n#ifdef SQLITE_DEBUG\r\n  assert( p->nRef>0 || p->owner==0 );\r\n  p->owner = tid; \r\n  p->nRef++;\r\n  if( p->trace ){\r\n    printf(\"enter mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\r\n  }\r\n#endif\r\n}\r\nstatic int winMutexTry(sqlite3_mutex *p){\r\n#ifndef NDEBUG\r\n  DWORD tid = GetCurrentThreadId(); \r\n#endif\r\n  int rc = SQLITE_BUSY;\r\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );\r\n  /*\r\n  ** The sqlite3_mutex_try() routine is very rarely used, and when it\r\n  ** is used it is merely an optimization.  So it is OK for it to always\r\n  ** fail.  \r\n  **\r\n  ** The TryEnterCriticalSection() interface is only available on WinNT.\r\n  ** And some windows compilers complain if you try to use it without\r\n  ** first doing some #defines that prevent SQLite from building on Win98.\r\n  ** For that reason, we will omit this optimization for now.  See\r\n  ** ticket #2685.\r\n  */\r\n#if 0\r\n  if( mutexIsNT() && TryEnterCriticalSection(&p->mutex) ){\r\n    p->owner = tid;\r\n    p->nRef++;\r\n    rc = SQLITE_OK;\r\n  }\r\n#else\r\n  UNUSED_PARAMETER(p);\r\n#endif\r\n#ifdef SQLITE_DEBUG\r\n  if( rc==SQLITE_OK && p->trace ){\r\n    printf(\"try mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\r\n  }\r\n#endif\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The sqlite3_mutex_leave() routine exits a mutex that was\r\n** previously entered by the same thread.  The behavior\r\n** is undefined if the mutex is not currently entered or\r\n** is not currently allocated.  SQLite will never do either.\r\n*/\r\nstatic void winMutexLeave(sqlite3_mutex *p){\r\n#ifndef NDEBUG\r\n  DWORD tid = GetCurrentThreadId();\r\n  assert( p->nRef>0 );\r\n  assert( p->owner==tid );\r\n  p->nRef--;\r\n  if( p->nRef==0 ) p->owner = 0;\r\n  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );\r\n#endif\r\n  LeaveCriticalSection(&p->mutex);\r\n#ifdef SQLITE_DEBUG\r\n  if( p->trace ){\r\n    printf(\"leave mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\r\n  }\r\n#endif\r\n}\r\n\r\nSQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){\r\n  static const sqlite3_mutex_methods sMutex = {\r\n    winMutexInit,\r\n    winMutexEnd,\r\n    winMutexAlloc,\r\n    winMutexFree,\r\n    winMutexEnter,\r\n    winMutexTry,\r\n    winMutexLeave,\r\n#ifdef SQLITE_DEBUG\r\n    winMutexHeld,\r\n    winMutexNotheld\r\n#else\r\n    0,\r\n    0\r\n#endif\r\n  };\r\n\r\n  return &sMutex;\r\n}\r\n#endif /* SQLITE_MUTEX_W32 */\r\n\r\n/************** End of mutex_w32.c *******************************************/\r\n/************** Begin file malloc.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** Memory allocation functions used throughout sqlite.\r\n*/\r\n/* #include <stdarg.h> */\r\n\r\n/*\r\n** Attempt to release up to n bytes of non-essential memory currently\r\n** held by SQLite. An example of non-essential memory is memory used to\r\n** cache database pages that are not currently in use.\r\n*/\r\nSQLITE_API int sqlite3_release_memory(int n){\r\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\r\n  return sqlite3PcacheReleaseMemory(n);\r\n#else\r\n  /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine\r\n  ** is a no-op returning zero if SQLite is not compiled with\r\n  ** SQLITE_ENABLE_MEMORY_MANAGEMENT. */\r\n  UNUSED_PARAMETER(n);\r\n  return 0;\r\n#endif\r\n}\r\n\r\n/*\r\n** An instance of the following object records the location of\r\n** each unused scratch buffer.\r\n*/\r\ntypedef struct ScratchFreeslot {\r\n  struct ScratchFreeslot *pNext;   /* Next unused scratch buffer */\r\n} ScratchFreeslot;\r\n\r\n/*\r\n** State information local to the memory allocation subsystem.\r\n*/\r\nstatic SQLITE_WSD struct Mem0Global {\r\n  sqlite3_mutex *mutex;         /* Mutex to serialize access */\r\n\r\n  /*\r\n  ** The alarm callback and its arguments.  The mem0.mutex lock will\r\n  ** be held while the callback is running.  Recursive calls into\r\n  ** the memory subsystem are allowed, but no new callbacks will be\r\n  ** issued.\r\n  */\r\n  sqlite3_int64 alarmThreshold;\r\n  void (*alarmCallback)(void*, sqlite3_int64,int);\r\n  void *alarmArg;\r\n\r\n  /*\r\n  ** Pointers to the end of sqlite3GlobalConfig.pScratch memory\r\n  ** (so that a range test can be used to determine if an allocation\r\n  ** being freed came from pScratch) and a pointer to the list of\r\n  ** unused scratch allocations.\r\n  */\r\n  void *pScratchEnd;\r\n  ScratchFreeslot *pScratchFree;\r\n  u32 nScratchFree;\r\n\r\n  /*\r\n  ** True if heap is nearly \"full\" where \"full\" is defined by the\r\n  ** sqlite3_soft_heap_limit() setting.\r\n  */\r\n  int nearlyFull;\r\n} mem0 = { 0, 0, 0, 0, 0, 0, 0, 0 };\r\n\r\n#define mem0 GLOBAL(struct Mem0Global, mem0)\r\n\r\n/*\r\n** This routine runs when the memory allocator sees that the\r\n** total memory allocation is about to exceed the soft heap\r\n** limit.\r\n*/\r\nstatic void softHeapLimitEnforcer(\r\n  void *NotUsed, \r\n  sqlite3_int64 NotUsed2,\r\n  int allocSize\r\n){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  sqlite3_release_memory(allocSize);\r\n}\r\n\r\n/*\r\n** Change the alarm callback\r\n*/\r\nstatic int sqlite3MemoryAlarm(\r\n  void(*xCallback)(void *pArg, sqlite3_int64 used,int N),\r\n  void *pArg,\r\n  sqlite3_int64 iThreshold\r\n){\r\n  int nUsed;\r\n  sqlite3_mutex_enter(mem0.mutex);\r\n  mem0.alarmCallback = xCallback;\r\n  mem0.alarmArg = pArg;\r\n  mem0.alarmThreshold = iThreshold;\r\n  nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);\r\n  mem0.nearlyFull = (iThreshold>0 && iThreshold<=nUsed);\r\n  sqlite3_mutex_leave(mem0.mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n/*\r\n** Deprecated external interface.  Internal/core SQLite code\r\n** should call sqlite3MemoryAlarm.\r\n*/\r\nSQLITE_API int sqlite3_memory_alarm(\r\n  void(*xCallback)(void *pArg, sqlite3_int64 used,int N),\r\n  void *pArg,\r\n  sqlite3_int64 iThreshold\r\n){\r\n  return sqlite3MemoryAlarm(xCallback, pArg, iThreshold);\r\n}\r\n#endif\r\n\r\n/*\r\n** Set the soft heap-size limit for the library. Passing a zero or \r\n** negative value indicates no limit.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){\r\n  sqlite3_int64 priorLimit;\r\n  sqlite3_int64 excess;\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  int rc = sqlite3_initialize();\r\n  if( rc ) return -1;\r\n#endif\r\n  sqlite3_mutex_enter(mem0.mutex);\r\n  priorLimit = mem0.alarmThreshold;\r\n  sqlite3_mutex_leave(mem0.mutex);\r\n  if( n<0 ) return priorLimit;\r\n  if( n>0 ){\r\n    sqlite3MemoryAlarm(softHeapLimitEnforcer, 0, n);\r\n  }else{\r\n    sqlite3MemoryAlarm(0, 0, 0);\r\n  }\r\n  excess = sqlite3_memory_used() - n;\r\n  if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));\r\n  return priorLimit;\r\n}\r\nSQLITE_API void sqlite3_soft_heap_limit(int n){\r\n  if( n<0 ) n = 0;\r\n  sqlite3_soft_heap_limit64(n);\r\n}\r\n\r\n/*\r\n** Initialize the memory allocation subsystem.\r\n*/\r\nSQLITE_PRIVATE int sqlite3MallocInit(void){\r\n  if( sqlite3GlobalConfig.m.xMalloc==0 ){\r\n    sqlite3MemSetDefault();\r\n  }\r\n  memset(&mem0, 0, sizeof(mem0));\r\n  if( sqlite3GlobalConfig.bCoreMutex ){\r\n    mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\r\n  }\r\n  if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100\r\n      && sqlite3GlobalConfig.nScratch>0 ){\r\n    int i, n, sz;\r\n    ScratchFreeslot *pSlot;\r\n    sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch);\r\n    sqlite3GlobalConfig.szScratch = sz;\r\n    pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch;\r\n    n = sqlite3GlobalConfig.nScratch;\r\n    mem0.pScratchFree = pSlot;\r\n    mem0.nScratchFree = n;\r\n    for(i=0; i<n-1; i++){\r\n      pSlot->pNext = (ScratchFreeslot*)(sz+(char*)pSlot);\r\n      pSlot = pSlot->pNext;\r\n    }\r\n    pSlot->pNext = 0;\r\n    mem0.pScratchEnd = (void*)&pSlot[1];\r\n  }else{\r\n    mem0.pScratchEnd = 0;\r\n    sqlite3GlobalConfig.pScratch = 0;\r\n    sqlite3GlobalConfig.szScratch = 0;\r\n    sqlite3GlobalConfig.nScratch = 0;\r\n  }\r\n  if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512\r\n      || sqlite3GlobalConfig.nPage<1 ){\r\n    sqlite3GlobalConfig.pPage = 0;\r\n    sqlite3GlobalConfig.szPage = 0;\r\n    sqlite3GlobalConfig.nPage = 0;\r\n  }\r\n  return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);\r\n}\r\n\r\n/*\r\n** Return true if the heap is currently under memory pressure - in other\r\n** words if the amount of heap used is close to the limit set by\r\n** sqlite3_soft_heap_limit().\r\n*/\r\nSQLITE_PRIVATE int sqlite3HeapNearlyFull(void){\r\n  return mem0.nearlyFull;\r\n}\r\n\r\n/*\r\n** Deinitialize the memory allocation subsystem.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MallocEnd(void){\r\n  if( sqlite3GlobalConfig.m.xShutdown ){\r\n    sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData);\r\n  }\r\n  memset(&mem0, 0, sizeof(mem0));\r\n}\r\n\r\n/*\r\n** Return the amount of memory currently checked out.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_memory_used(void){\r\n  int n, mx;\r\n  sqlite3_int64 res;\r\n  sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, 0);\r\n  res = (sqlite3_int64)n;  /* Work around bug in Borland C. Ticket #3216 */\r\n  return res;\r\n}\r\n\r\n/*\r\n** Return the maximum amount of memory that has ever been\r\n** checked out since either the beginning of this process\r\n** or since the most recent reset.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag){\r\n  int n, mx;\r\n  sqlite3_int64 res;\r\n  sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, resetFlag);\r\n  res = (sqlite3_int64)mx;  /* Work around bug in Borland C. Ticket #3216 */\r\n  return res;\r\n}\r\n\r\n/*\r\n** Trigger the alarm \r\n*/\r\nstatic void sqlite3MallocAlarm(int nByte){\r\n  void (*xCallback)(void*,sqlite3_int64,int);\r\n  sqlite3_int64 nowUsed;\r\n  void *pArg;\r\n  if( mem0.alarmCallback==0 ) return;\r\n  xCallback = mem0.alarmCallback;\r\n  nowUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);\r\n  pArg = mem0.alarmArg;\r\n  mem0.alarmCallback = 0;\r\n  sqlite3_mutex_leave(mem0.mutex);\r\n  xCallback(pArg, nowUsed, nByte);\r\n  sqlite3_mutex_enter(mem0.mutex);\r\n  mem0.alarmCallback = xCallback;\r\n  mem0.alarmArg = pArg;\r\n}\r\n\r\n/*\r\n** Do a memory allocation with statistics and alarms.  Assume the\r\n** lock is already held.\r\n*/\r\nstatic int mallocWithAlarm(int n, void **pp){\r\n  int nFull;\r\n  void *p;\r\n  assert( sqlite3_mutex_held(mem0.mutex) );\r\n  nFull = sqlite3GlobalConfig.m.xRoundup(n);\r\n  sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, n);\r\n  if( mem0.alarmCallback!=0 ){\r\n    int nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);\r\n    if( nUsed >= mem0.alarmThreshold - nFull ){\r\n      mem0.nearlyFull = 1;\r\n      sqlite3MallocAlarm(nFull);\r\n    }else{\r\n      mem0.nearlyFull = 0;\r\n    }\r\n  }\r\n  p = sqlite3GlobalConfig.m.xMalloc(nFull);\r\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\r\n  if( p==0 && mem0.alarmCallback ){\r\n    sqlite3MallocAlarm(nFull);\r\n    p = sqlite3GlobalConfig.m.xMalloc(nFull);\r\n  }\r\n#endif\r\n  if( p ){\r\n    nFull = sqlite3MallocSize(p);\r\n    sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nFull);\r\n    sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, 1);\r\n  }\r\n  *pp = p;\r\n  return nFull;\r\n}\r\n\r\n/*\r\n** Allocate memory.  This routine is like sqlite3_malloc() except that it\r\n** assumes the memory subsystem has already been initialized.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3Malloc(int n){\r\n  void *p;\r\n  if( n<=0               /* IMP: R-65312-04917 */ \r\n   || n>=0x7fffff00\r\n  ){\r\n    /* A memory allocation of a number of bytes which is near the maximum\r\n    ** signed integer value might cause an integer overflow inside of the\r\n    ** xMalloc().  Hence we limit the maximum size to 0x7fffff00, giving\r\n    ** 255 bytes of overhead.  SQLite itself will never use anything near\r\n    ** this amount.  The only way to reach the limit is with sqlite3_malloc() */\r\n    p = 0;\r\n  }else if( sqlite3GlobalConfig.bMemstat ){\r\n    sqlite3_mutex_enter(mem0.mutex);\r\n    mallocWithAlarm(n, &p);\r\n    sqlite3_mutex_leave(mem0.mutex);\r\n  }else{\r\n    p = sqlite3GlobalConfig.m.xMalloc(n);\r\n  }\r\n  assert( EIGHT_BYTE_ALIGNMENT(p) );  /* IMP: R-04675-44850 */\r\n  return p;\r\n}\r\n\r\n/*\r\n** This version of the memory allocation is for use by the application.\r\n** First make sure the memory subsystem is initialized, then do the\r\n** allocation.\r\n*/\r\nSQLITE_API void *sqlite3_malloc(int n){\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  if( sqlite3_initialize() ) return 0;\r\n#endif\r\n  return sqlite3Malloc(n);\r\n}\r\n\r\n/*\r\n** Each thread may only have a single outstanding allocation from\r\n** xScratchMalloc().  We verify this constraint in the single-threaded\r\n** case by setting scratchAllocOut to 1 when an allocation\r\n** is outstanding clearing it when the allocation is freed.\r\n*/\r\n#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)\r\nstatic int scratchAllocOut = 0;\r\n#endif\r\n\r\n\r\n/*\r\n** Allocate memory that is to be used and released right away.\r\n** This routine is similar to alloca() in that it is not intended\r\n** for situations where the memory might be held long-term.  This\r\n** routine is intended to get memory to old large transient data\r\n** structures that would not normally fit on the stack of an\r\n** embedded processor.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3ScratchMalloc(int n){\r\n  void *p;\r\n  assert( n>0 );\r\n\r\n  sqlite3_mutex_enter(mem0.mutex);\r\n  if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){\r\n    p = mem0.pScratchFree;\r\n    mem0.pScratchFree = mem0.pScratchFree->pNext;\r\n    mem0.nScratchFree--;\r\n    sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);\r\n    sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);\r\n    sqlite3_mutex_leave(mem0.mutex);\r\n  }else{\r\n    if( sqlite3GlobalConfig.bMemstat ){\r\n      sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);\r\n      n = mallocWithAlarm(n, &p);\r\n      if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);\r\n      sqlite3_mutex_leave(mem0.mutex);\r\n    }else{\r\n      sqlite3_mutex_leave(mem0.mutex);\r\n      p = sqlite3GlobalConfig.m.xMalloc(n);\r\n    }\r\n    sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);\r\n  }\r\n  assert( sqlite3_mutex_notheld(mem0.mutex) );\r\n\r\n\r\n#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)\r\n  /* Verify that no more than two scratch allocations per thread\r\n  ** are outstanding at one time.  (This is only checked in the\r\n  ** single-threaded case since checking in the multi-threaded case\r\n  ** would be much more complicated.) */\r\n  assert( scratchAllocOut<=1 );\r\n  if( p ) scratchAllocOut++;\r\n#endif\r\n\r\n  return p;\r\n}\r\nSQLITE_PRIVATE void sqlite3ScratchFree(void *p){\r\n  if( p ){\r\n\r\n#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)\r\n    /* Verify that no more than two scratch allocation per thread\r\n    ** is outstanding at one time.  (This is only checked in the\r\n    ** single-threaded case since checking in the multi-threaded case\r\n    ** would be much more complicated.) */\r\n    assert( scratchAllocOut>=1 && scratchAllocOut<=2 );\r\n    scratchAllocOut--;\r\n#endif\r\n\r\n    if( p>=sqlite3GlobalConfig.pScratch && p<mem0.pScratchEnd ){\r\n      /* Release memory from the SQLITE_CONFIG_SCRATCH allocation */\r\n      ScratchFreeslot *pSlot;\r\n      pSlot = (ScratchFreeslot*)p;\r\n      sqlite3_mutex_enter(mem0.mutex);\r\n      pSlot->pNext = mem0.pScratchFree;\r\n      mem0.pScratchFree = pSlot;\r\n      mem0.nScratchFree++;\r\n      assert( mem0.nScratchFree <= (u32)sqlite3GlobalConfig.nScratch );\r\n      sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1);\r\n      sqlite3_mutex_leave(mem0.mutex);\r\n    }else{\r\n      /* Release memory back to the heap */\r\n      assert( sqlite3MemdebugHasType(p, MEMTYPE_SCRATCH) );\r\n      assert( sqlite3MemdebugNoType(p, ~MEMTYPE_SCRATCH) );\r\n      sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\r\n      if( sqlite3GlobalConfig.bMemstat ){\r\n        int iSize = sqlite3MallocSize(p);\r\n        sqlite3_mutex_enter(mem0.mutex);\r\n        sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, -iSize);\r\n        sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize);\r\n        sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1);\r\n        sqlite3GlobalConfig.m.xFree(p);\r\n        sqlite3_mutex_leave(mem0.mutex);\r\n      }else{\r\n        sqlite3GlobalConfig.m.xFree(p);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** TRUE if p is a lookaside memory allocation from db\r\n*/\r\n#ifndef SQLITE_OMIT_LOOKASIDE\r\nstatic int isLookaside(sqlite3 *db, void *p){\r\n  return p && p>=db->lookaside.pStart && p<db->lookaside.pEnd;\r\n}\r\n#else\r\n#define isLookaside(A,B) 0\r\n#endif\r\n\r\n/*\r\n** Return the size of a memory allocation previously obtained from\r\n** sqlite3Malloc() or sqlite3_malloc().\r\n*/\r\nSQLITE_PRIVATE int sqlite3MallocSize(void *p){\r\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\r\n  assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );\r\n  return sqlite3GlobalConfig.m.xSize(p);\r\n}\r\nSQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){\r\n  assert( db==0 || sqlite3_mutex_held(db->mutex) );\r\n  if( db && isLookaside(db, p) ){\r\n    return db->lookaside.sz;\r\n  }else{\r\n    assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );\r\n    assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) );\r\n    assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );\r\n    return sqlite3GlobalConfig.m.xSize(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Free memory previously obtained from sqlite3Malloc().\r\n*/\r\nSQLITE_API void sqlite3_free(void *p){\r\n  if( p==0 ) return;  /* IMP: R-49053-54554 */\r\n  assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );\r\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\r\n  if( sqlite3GlobalConfig.bMemstat ){\r\n    sqlite3_mutex_enter(mem0.mutex);\r\n    sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -sqlite3MallocSize(p));\r\n    sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1);\r\n    sqlite3GlobalConfig.m.xFree(p);\r\n    sqlite3_mutex_leave(mem0.mutex);\r\n  }else{\r\n    sqlite3GlobalConfig.m.xFree(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Free memory that might be associated with a particular database\r\n** connection.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){\r\n  assert( db==0 || sqlite3_mutex_held(db->mutex) );\r\n  if( db ){\r\n    if( db->pnBytesFreed ){\r\n      *db->pnBytesFreed += sqlite3DbMallocSize(db, p);\r\n      return;\r\n    }\r\n    if( isLookaside(db, p) ){\r\n      LookasideSlot *pBuf = (LookasideSlot*)p;\r\n      pBuf->pNext = db->lookaside.pFree;\r\n      db->lookaside.pFree = pBuf;\r\n      db->lookaside.nOut--;\r\n      return;\r\n    }\r\n  }\r\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );\r\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) );\r\n  assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );\r\n  sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** Change the size of an existing memory allocation\r\n*/\r\nSQLITE_PRIVATE void *sqlite3Realloc(void *pOld, int nBytes){\r\n  int nOld, nNew, nDiff;\r\n  void *pNew;\r\n  if( pOld==0 ){\r\n    return sqlite3Malloc(nBytes); /* IMP: R-28354-25769 */\r\n  }\r\n  if( nBytes<=0 ){\r\n    sqlite3_free(pOld); /* IMP: R-31593-10574 */\r\n    return 0;\r\n  }\r\n  if( nBytes>=0x7fffff00 ){\r\n    /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */\r\n    return 0;\r\n  }\r\n  nOld = sqlite3MallocSize(pOld);\r\n  /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second\r\n  ** argument to xRealloc is always a value returned by a prior call to\r\n  ** xRoundup. */\r\n  nNew = sqlite3GlobalConfig.m.xRoundup(nBytes);\r\n  if( nOld==nNew ){\r\n    pNew = pOld;\r\n  }else if( sqlite3GlobalConfig.bMemstat ){\r\n    sqlite3_mutex_enter(mem0.mutex);\r\n    sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes);\r\n    nDiff = nNew - nOld;\r\n    if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= \r\n          mem0.alarmThreshold-nDiff ){\r\n      sqlite3MallocAlarm(nDiff);\r\n    }\r\n    assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) );\r\n    assert( sqlite3MemdebugNoType(pOld, ~MEMTYPE_HEAP) );\r\n    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);\r\n    if( pNew==0 && mem0.alarmCallback ){\r\n      sqlite3MallocAlarm(nBytes);\r\n      pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);\r\n    }\r\n    if( pNew ){\r\n      nNew = sqlite3MallocSize(pNew);\r\n      sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);\r\n    }\r\n    sqlite3_mutex_leave(mem0.mutex);\r\n  }else{\r\n    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);\r\n  }\r\n  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-04675-44850 */\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** The public interface to sqlite3Realloc.  Make sure that the memory\r\n** subsystem is initialized prior to invoking sqliteRealloc.\r\n*/\r\nSQLITE_API void *sqlite3_realloc(void *pOld, int n){\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  if( sqlite3_initialize() ) return 0;\r\n#endif\r\n  return sqlite3Realloc(pOld, n);\r\n}\r\n\r\n\r\n/*\r\n** Allocate and zero memory.\r\n*/ \r\nSQLITE_PRIVATE void *sqlite3MallocZero(int n){\r\n  void *p = sqlite3Malloc(n);\r\n  if( p ){\r\n    memset(p, 0, n);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Allocate and zero memory.  If the allocation fails, make\r\n** the mallocFailed flag in the connection pointer.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3 *db, int n){\r\n  void *p = sqlite3DbMallocRaw(db, n);\r\n  if( p ){\r\n    memset(p, 0, n);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Allocate and zero memory.  If the allocation fails, make\r\n** the mallocFailed flag in the connection pointer.\r\n**\r\n** If db!=0 and db->mallocFailed is true (indicating a prior malloc\r\n** failure on the same database connection) then always return 0.\r\n** Hence for a particular database connection, once malloc starts\r\n** failing, it fails consistently until mallocFailed is reset.\r\n** This is an important assumption.  There are many places in the\r\n** code that do things like this:\r\n**\r\n**         int *a = (int*)sqlite3DbMallocRaw(db, 100);\r\n**         int *b = (int*)sqlite3DbMallocRaw(db, 200);\r\n**         if( b ) a[10] = 9;\r\n**\r\n** In other words, if a subsequent malloc (ex: \"b\") worked, it is assumed\r\n** that all prior mallocs (ex: \"a\") worked too.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, int n){\r\n  void *p;\r\n  assert( db==0 || sqlite3_mutex_held(db->mutex) );\r\n  assert( db==0 || db->pnBytesFreed==0 );\r\n#ifndef SQLITE_OMIT_LOOKASIDE\r\n  if( db ){\r\n    LookasideSlot *pBuf;\r\n    if( db->mallocFailed ){\r\n      return 0;\r\n    }\r\n    if( db->lookaside.bEnabled ){\r\n      if( n>db->lookaside.sz ){\r\n        db->lookaside.anStat[1]++;\r\n      }else if( (pBuf = db->lookaside.pFree)==0 ){\r\n        db->lookaside.anStat[2]++;\r\n      }else{\r\n        db->lookaside.pFree = pBuf->pNext;\r\n        db->lookaside.nOut++;\r\n        db->lookaside.anStat[0]++;\r\n        if( db->lookaside.nOut>db->lookaside.mxOut ){\r\n          db->lookaside.mxOut = db->lookaside.nOut;\r\n        }\r\n        return (void*)pBuf;\r\n      }\r\n    }\r\n  }\r\n#else\r\n  if( db && db->mallocFailed ){\r\n    return 0;\r\n  }\r\n#endif\r\n  p = sqlite3Malloc(n);\r\n  if( !p && db ){\r\n    db->mallocFailed = 1;\r\n  }\r\n  sqlite3MemdebugSetType(p, MEMTYPE_DB |\r\n         ((db && db->lookaside.bEnabled) ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP));\r\n  return p;\r\n}\r\n\r\n/*\r\n** Resize the block of memory pointed to by p to n bytes. If the\r\n** resize fails, set the mallocFailed flag in the connection object.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){\r\n  void *pNew = 0;\r\n  assert( db!=0 );\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  if( db->mallocFailed==0 ){\r\n    if( p==0 ){\r\n      return sqlite3DbMallocRaw(db, n);\r\n    }\r\n    if( isLookaside(db, p) ){\r\n      if( n<=db->lookaside.sz ){\r\n        return p;\r\n      }\r\n      pNew = sqlite3DbMallocRaw(db, n);\r\n      if( pNew ){\r\n        memcpy(pNew, p, db->lookaside.sz);\r\n        sqlite3DbFree(db, p);\r\n      }\r\n    }else{\r\n      assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );\r\n      assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) );\r\n      sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\r\n      pNew = sqlite3_realloc(p, n);\r\n      if( !pNew ){\r\n        sqlite3MemdebugSetType(p, MEMTYPE_DB|MEMTYPE_HEAP);\r\n        db->mallocFailed = 1;\r\n      }\r\n      sqlite3MemdebugSetType(pNew, MEMTYPE_DB | \r\n            (db->lookaside.bEnabled ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP));\r\n    }\r\n  }\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Attempt to reallocate p.  If the reallocation fails, then free p\r\n** and set the mallocFailed flag in the database connection.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, int n){\r\n  void *pNew;\r\n  pNew = sqlite3DbRealloc(db, p, n);\r\n  if( !pNew ){\r\n    sqlite3DbFree(db, p);\r\n  }\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Make a copy of a string in memory obtained from sqliteMalloc(). These \r\n** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This\r\n** is because when memory debugging is turned on, these two functions are \r\n** called via macros that record the current file and line number in the\r\n** ThreadData structure.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3 *db, const char *z){\r\n  char *zNew;\r\n  size_t n;\r\n  if( z==0 ){\r\n    return 0;\r\n  }\r\n  n = sqlite3Strlen30(z) + 1;\r\n  assert( (n&0x7fffffff)==n );\r\n  zNew = sqlite3DbMallocRaw(db, (int)n);\r\n  if( zNew ){\r\n    memcpy(zNew, z, n);\r\n  }\r\n  return zNew;\r\n}\r\nSQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3 *db, const char *z, int n){\r\n  char *zNew;\r\n  if( z==0 ){\r\n    return 0;\r\n  }\r\n  assert( (n&0x7fffffff)==n );\r\n  zNew = sqlite3DbMallocRaw(db, n+1);\r\n  if( zNew ){\r\n    memcpy(zNew, z, n);\r\n    zNew[n] = 0;\r\n  }\r\n  return zNew;\r\n}\r\n\r\n/*\r\n** Create a string from the zFromat argument and the va_list that follows.\r\n** Store the string in memory obtained from sqliteMalloc() and make *pz\r\n** point to that string.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zFormat, ...){\r\n  va_list ap;\r\n  char *z;\r\n\r\n  va_start(ap, zFormat);\r\n  z = sqlite3VMPrintf(db, zFormat, ap);\r\n  va_end(ap);\r\n  sqlite3DbFree(db, *pz);\r\n  *pz = z;\r\n}\r\n\r\n\r\n/*\r\n** This function must be called before exiting any API function (i.e. \r\n** returning control to the user) that has called sqlite3_malloc or\r\n** sqlite3_realloc.\r\n**\r\n** The returned value is normally a copy of the second argument to this\r\n** function. However, if a malloc() failure has occurred since the previous\r\n** invocation SQLITE_NOMEM is returned instead. \r\n**\r\n** If the first argument, db, is not NULL and a malloc() error has occurred,\r\n** then the connection error-code (the value returned by sqlite3_errcode())\r\n** is set to SQLITE_NOMEM.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ApiExit(sqlite3* db, int rc){\r\n  /* If the db handle is not NULL, then we must hold the connection handle\r\n  ** mutex here. Otherwise the read (and possible write) of db->mallocFailed \r\n  ** is unsafe, as is the call to sqlite3Error().\r\n  */\r\n  assert( !db || sqlite3_mutex_held(db->mutex) );\r\n  if( db && (db->mallocFailed || rc==SQLITE_IOERR_NOMEM) ){\r\n    sqlite3Error(db, SQLITE_NOMEM, 0);\r\n    db->mallocFailed = 0;\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n  return rc & (db ? db->errMask : 0xff);\r\n}\r\n\r\n/************** End of malloc.c **********************************************/\r\n/************** Begin file printf.c ******************************************/\r\n/*\r\n** The \"printf\" code that follows dates from the 1980's.  It is in\r\n** the public domain.  The original comments are included here for\r\n** completeness.  They are very out-of-date but might be useful as\r\n** an historical reference.  Most of the \"enhancements\" have been backed\r\n** out so that the functionality is now the same as standard printf().\r\n**\r\n**************************************************************************\r\n**\r\n** This file contains code for a set of \"printf\"-like routines.  These\r\n** routines format strings much like the printf() from the standard C\r\n** library, though the implementation here has enhancements to support\r\n** SQLlite.\r\n*/\r\n\r\n/*\r\n** Conversion types fall into various categories as defined by the\r\n** following enumeration.\r\n*/\r\n#define etRADIX       1 /* Integer types.  %d, %x, %o, and so forth */\r\n#define etFLOAT       2 /* Floating point.  %f */\r\n#define etEXP         3 /* Exponentional notation. %e and %E */\r\n#define etGENERIC     4 /* Floating or exponential, depending on exponent. %g */\r\n#define etSIZE        5 /* Return number of characters processed so far. %n */\r\n#define etSTRING      6 /* Strings. %s */\r\n#define etDYNSTRING   7 /* Dynamically allocated strings. %z */\r\n#define etPERCENT     8 /* Percent symbol. %% */\r\n#define etCHARX       9 /* Characters. %c */\r\n/* The rest are extensions, not normally found in printf() */\r\n#define etSQLESCAPE  10 /* Strings with '\\'' doubled.  %q */\r\n#define etSQLESCAPE2 11 /* Strings with '\\'' doubled and enclosed in '',\r\n                          NULL pointers replaced by SQL NULL.  %Q */\r\n#define etTOKEN      12 /* a pointer to a Token structure */\r\n#define etSRCLIST    13 /* a pointer to a SrcList */\r\n#define etPOINTER    14 /* The %p conversion */\r\n#define etSQLESCAPE3 15 /* %w -> Strings with '\\\"' doubled */\r\n#define etORDINAL    16 /* %r -> 1st, 2nd, 3rd, 4th, etc.  English only */\r\n\r\n#define etINVALID     0 /* Any unrecognized conversion type */\r\n\r\n\r\n/*\r\n** An \"etByte\" is an 8-bit unsigned value.\r\n*/\r\ntypedef unsigned char etByte;\r\n\r\n/*\r\n** Each builtin conversion character (ex: the 'd' in \"%d\") is described\r\n** by an instance of the following structure\r\n*/\r\ntypedef struct et_info {   /* Information about each format field */\r\n  char fmttype;            /* The format field code letter */\r\n  etByte base;             /* The base for radix conversion */\r\n  etByte flags;            /* One or more of FLAG_ constants below */\r\n  etByte type;             /* Conversion paradigm */\r\n  etByte charset;          /* Offset into aDigits[] of the digits string */\r\n  etByte prefix;           /* Offset into aPrefix[] of the prefix string */\r\n} et_info;\r\n\r\n/*\r\n** Allowed values for et_info.flags\r\n*/\r\n#define FLAG_SIGNED  1     /* True if the value to convert is signed */\r\n#define FLAG_INTERN  2     /* True if for internal use only */\r\n#define FLAG_STRING  4     /* Allow infinity precision */\r\n\r\n\r\n/*\r\n** The following table is searched linearly, so it is good to put the\r\n** most frequently used conversion types first.\r\n*/\r\nstatic const char aDigits[] = \"0123456789ABCDEF0123456789abcdef\";\r\nstatic const char aPrefix[] = \"-x0\\000X0\";\r\nstatic const et_info fmtinfo[] = {\r\n  {  'd', 10, 1, etRADIX,      0,  0 },\r\n  {  's',  0, 4, etSTRING,     0,  0 },\r\n  {  'g',  0, 1, etGENERIC,    30, 0 },\r\n  {  'z',  0, 4, etDYNSTRING,  0,  0 },\r\n  {  'q',  0, 4, etSQLESCAPE,  0,  0 },\r\n  {  'Q',  0, 4, etSQLESCAPE2, 0,  0 },\r\n  {  'w',  0, 4, etSQLESCAPE3, 0,  0 },\r\n  {  'c',  0, 0, etCHARX,      0,  0 },\r\n  {  'o',  8, 0, etRADIX,      0,  2 },\r\n  {  'u', 10, 0, etRADIX,      0,  0 },\r\n  {  'x', 16, 0, etRADIX,      16, 1 },\r\n  {  'X', 16, 0, etRADIX,      0,  4 },\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n  {  'f',  0, 1, etFLOAT,      0,  0 },\r\n  {  'e',  0, 1, etEXP,        30, 0 },\r\n  {  'E',  0, 1, etEXP,        14, 0 },\r\n  {  'G',  0, 1, etGENERIC,    14, 0 },\r\n#endif\r\n  {  'i', 10, 1, etRADIX,      0,  0 },\r\n  {  'n',  0, 0, etSIZE,       0,  0 },\r\n  {  '%',  0, 0, etPERCENT,    0,  0 },\r\n  {  'p', 16, 0, etPOINTER,    0,  1 },\r\n\r\n/* All the rest have the FLAG_INTERN bit set and are thus for internal\r\n** use only */\r\n  {  'T',  0, 2, etTOKEN,      0,  0 },\r\n  {  'S',  0, 2, etSRCLIST,    0,  0 },\r\n  {  'r', 10, 3, etORDINAL,    0,  0 },\r\n};\r\n\r\n/*\r\n** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point\r\n** conversions will work.\r\n*/\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n/*\r\n** \"*val\" is a double such that 0.1 <= *val < 10.0\r\n** Return the ascii code for the leading digit of *val, then\r\n** multiply \"*val\" by 10.0 to renormalize.\r\n**\r\n** Example:\r\n**     input:     *val = 3.14159\r\n**     output:    *val = 1.4159    function return = '3'\r\n**\r\n** The counter *cnt is incremented each time.  After counter exceeds\r\n** 16 (the number of significant digits in a 64-bit float) '0' is\r\n** always returned.\r\n*/\r\nstatic char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){\r\n  int digit;\r\n  LONGDOUBLE_TYPE d;\r\n  if( (*cnt)++ >= 16 ) return '0';\r\n  digit = (int)*val;\r\n  d = digit;\r\n  digit += '0';\r\n  *val = (*val - d)*10.0;\r\n  return (char)digit;\r\n}\r\n#endif /* SQLITE_OMIT_FLOATING_POINT */\r\n\r\n/*\r\n** Append N space characters to the given string buffer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AppendSpace(StrAccum *pAccum, int N){\r\n  static const char zSpaces[] = \"                             \";\r\n  while( N>=(int)sizeof(zSpaces)-1 ){\r\n    sqlite3StrAccumAppend(pAccum, zSpaces, sizeof(zSpaces)-1);\r\n    N -= sizeof(zSpaces)-1;\r\n  }\r\n  if( N>0 ){\r\n    sqlite3StrAccumAppend(pAccum, zSpaces, N);\r\n  }\r\n}\r\n\r\n/*\r\n** On machines with a small stack size, you can redefine the\r\n** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired.\r\n*/\r\n#ifndef SQLITE_PRINT_BUF_SIZE\r\n# define SQLITE_PRINT_BUF_SIZE 70\r\n#endif\r\n#define etBUFSIZE SQLITE_PRINT_BUF_SIZE  /* Size of the output buffer */\r\n\r\n/*\r\n** Render a string given by \"fmt\" into the StrAccum object.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VXPrintf(\r\n  StrAccum *pAccum,                  /* Accumulate results here */\r\n  int useExtended,                   /* Allow extended %-conversions */\r\n  const char *fmt,                   /* Format string */\r\n  va_list ap                         /* arguments */\r\n){\r\n  int c;                     /* Next character in the format string */\r\n  char *bufpt;               /* Pointer to the conversion buffer */\r\n  int precision;             /* Precision of the current field */\r\n  int length;                /* Length of the field */\r\n  int idx;                   /* A general purpose loop counter */\r\n  int width;                 /* Width of the current field */\r\n  etByte flag_leftjustify;   /* True if \"-\" flag is present */\r\n  etByte flag_plussign;      /* True if \"+\" flag is present */\r\n  etByte flag_blanksign;     /* True if \" \" flag is present */\r\n  etByte flag_alternateform; /* True if \"#\" flag is present */\r\n  etByte flag_altform2;      /* True if \"!\" flag is present */\r\n  etByte flag_zeropad;       /* True if field width constant starts with zero */\r\n  etByte flag_long;          /* True if \"l\" flag is present */\r\n  etByte flag_longlong;      /* True if the \"ll\" flag is present */\r\n  etByte done;               /* Loop termination flag */\r\n  etByte xtype = 0;          /* Conversion paradigm */\r\n  char prefix;               /* Prefix character.  \"+\" or \"-\" or \" \" or '\\0'. */\r\n  sqlite_uint64 longvalue;   /* Value for integer types */\r\n  LONGDOUBLE_TYPE realvalue; /* Value for real types */\r\n  const et_info *infop;      /* Pointer to the appropriate info structure */\r\n  char *zOut;                /* Rendering buffer */\r\n  int nOut;                  /* Size of the rendering buffer */\r\n  char *zExtra;              /* Malloced memory used by some conversion */\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n  int  exp, e2;              /* exponent of real numbers */\r\n  int nsd;                   /* Number of significant digits returned */\r\n  double rounder;            /* Used for rounding floating point values */\r\n  etByte flag_dp;            /* True if decimal point should be shown */\r\n  etByte flag_rtz;           /* True if trailing zeros should be removed */\r\n#endif\r\n  char buf[etBUFSIZE];       /* Conversion buffer */\r\n\r\n  bufpt = 0;\r\n  for(; (c=(*fmt))!=0; ++fmt){\r\n    if( c!='%' ){\r\n      int amt;\r\n      bufpt = (char *)fmt;\r\n      amt = 1;\r\n      while( (c=(*++fmt))!='%' && c!=0 ) amt++;\r\n      sqlite3StrAccumAppend(pAccum, bufpt, amt);\r\n      if( c==0 ) break;\r\n    }\r\n    if( (c=(*++fmt))==0 ){\r\n      sqlite3StrAccumAppend(pAccum, \"%\", 1);\r\n      break;\r\n    }\r\n    /* Find out what flags are present */\r\n    flag_leftjustify = flag_plussign = flag_blanksign = \r\n     flag_alternateform = flag_altform2 = flag_zeropad = 0;\r\n    done = 0;\r\n    do{\r\n      switch( c ){\r\n        case '-':   flag_leftjustify = 1;     break;\r\n        case '+':   flag_plussign = 1;        break;\r\n        case ' ':   flag_blanksign = 1;       break;\r\n        case '#':   flag_alternateform = 1;   break;\r\n        case '!':   flag_altform2 = 1;        break;\r\n        case '0':   flag_zeropad = 1;         break;\r\n        default:    done = 1;                 break;\r\n      }\r\n    }while( !done && (c=(*++fmt))!=0 );\r\n    /* Get the field width */\r\n    width = 0;\r\n    if( c=='*' ){\r\n      width = va_arg(ap,int);\r\n      if( width<0 ){\r\n        flag_leftjustify = 1;\r\n        width = -width;\r\n      }\r\n      c = *++fmt;\r\n    }else{\r\n      while( c>='0' && c<='9' ){\r\n        width = width*10 + c - '0';\r\n        c = *++fmt;\r\n      }\r\n    }\r\n    /* Get the precision */\r\n    if( c=='.' ){\r\n      precision = 0;\r\n      c = *++fmt;\r\n      if( c=='*' ){\r\n        precision = va_arg(ap,int);\r\n        if( precision<0 ) precision = -precision;\r\n        c = *++fmt;\r\n      }else{\r\n        while( c>='0' && c<='9' ){\r\n          precision = precision*10 + c - '0';\r\n          c = *++fmt;\r\n        }\r\n      }\r\n    }else{\r\n      precision = -1;\r\n    }\r\n    /* Get the conversion type modifier */\r\n    if( c=='l' ){\r\n      flag_long = 1;\r\n      c = *++fmt;\r\n      if( c=='l' ){\r\n        flag_longlong = 1;\r\n        c = *++fmt;\r\n      }else{\r\n        flag_longlong = 0;\r\n      }\r\n    }else{\r\n      flag_long = flag_longlong = 0;\r\n    }\r\n    /* Fetch the info entry for the field */\r\n    infop = &fmtinfo[0];\r\n    xtype = etINVALID;\r\n    for(idx=0; idx<ArraySize(fmtinfo); idx++){\r\n      if( c==fmtinfo[idx].fmttype ){\r\n        infop = &fmtinfo[idx];\r\n        if( useExtended || (infop->flags & FLAG_INTERN)==0 ){\r\n          xtype = infop->type;\r\n        }else{\r\n          return;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n    zExtra = 0;\r\n\r\n    /*\r\n    ** At this point, variables are initialized as follows:\r\n    **\r\n    **   flag_alternateform          TRUE if a '#' is present.\r\n    **   flag_altform2               TRUE if a '!' is present.\r\n    **   flag_plussign               TRUE if a '+' is present.\r\n    **   flag_leftjustify            TRUE if a '-' is present or if the\r\n    **                               field width was negative.\r\n    **   flag_zeropad                TRUE if the width began with 0.\r\n    **   flag_long                   TRUE if the letter 'l' (ell) prefixed\r\n    **                               the conversion character.\r\n    **   flag_longlong               TRUE if the letter 'll' (ell ell) prefixed\r\n    **                               the conversion character.\r\n    **   flag_blanksign              TRUE if a ' ' is present.\r\n    **   width                       The specified field width.  This is\r\n    **                               always non-negative.  Zero is the default.\r\n    **   precision                   The specified precision.  The default\r\n    **                               is -1.\r\n    **   xtype                       The class of the conversion.\r\n    **   infop                       Pointer to the appropriate info struct.\r\n    */\r\n    switch( xtype ){\r\n      case etPOINTER:\r\n        flag_longlong = sizeof(char*)==sizeof(i64);\r\n        flag_long = sizeof(char*)==sizeof(long int);\r\n        /* Fall through into the next case */\r\n      case etORDINAL:\r\n      case etRADIX:\r\n        if( infop->flags & FLAG_SIGNED ){\r\n          i64 v;\r\n          if( flag_longlong ){\r\n            v = va_arg(ap,i64);\r\n          }else if( flag_long ){\r\n            v = va_arg(ap,long int);\r\n          }else{\r\n            v = va_arg(ap,int);\r\n          }\r\n          if( v<0 ){\r\n            if( v==SMALLEST_INT64 ){\r\n              longvalue = ((u64)1)<<63;\r\n            }else{\r\n              longvalue = -v;\r\n            }\r\n            prefix = '-';\r\n          }else{\r\n            longvalue = v;\r\n            if( flag_plussign )        prefix = '+';\r\n            else if( flag_blanksign )  prefix = ' ';\r\n            else                       prefix = 0;\r\n          }\r\n        }else{\r\n          if( flag_longlong ){\r\n            longvalue = va_arg(ap,u64);\r\n          }else if( flag_long ){\r\n            longvalue = va_arg(ap,unsigned long int);\r\n          }else{\r\n            longvalue = va_arg(ap,unsigned int);\r\n          }\r\n          prefix = 0;\r\n        }\r\n        if( longvalue==0 ) flag_alternateform = 0;\r\n        if( flag_zeropad && precision<width-(prefix!=0) ){\r\n          precision = width-(prefix!=0);\r\n        }\r\n        if( precision<etBUFSIZE-10 ){\r\n          nOut = etBUFSIZE;\r\n          zOut = buf;\r\n        }else{\r\n          nOut = precision + 10;\r\n          zOut = zExtra = sqlite3Malloc( nOut );\r\n          if( zOut==0 ){\r\n            pAccum->mallocFailed = 1;\r\n            return;\r\n          }\r\n        }\r\n        bufpt = &zOut[nOut-1];\r\n        if( xtype==etORDINAL ){\r\n          static const char zOrd[] = \"thstndrd\";\r\n          int x = (int)(longvalue % 10);\r\n          if( x>=4 || (longvalue/10)%10==1 ){\r\n            x = 0;\r\n          }\r\n          *(--bufpt) = zOrd[x*2+1];\r\n          *(--bufpt) = zOrd[x*2];\r\n        }\r\n        {\r\n          register const char *cset;      /* Use registers for speed */\r\n          register int base;\r\n          cset = &aDigits[infop->charset];\r\n          base = infop->base;\r\n          do{                                           /* Convert to ascii */\r\n            *(--bufpt) = cset[longvalue%base];\r\n            longvalue = longvalue/base;\r\n          }while( longvalue>0 );\r\n        }\r\n        length = (int)(&zOut[nOut-1]-bufpt);\r\n        for(idx=precision-length; idx>0; idx--){\r\n          *(--bufpt) = '0';                             /* Zero pad */\r\n        }\r\n        if( prefix ) *(--bufpt) = prefix;               /* Add sign */\r\n        if( flag_alternateform && infop->prefix ){      /* Add \"0\" or \"0x\" */\r\n          const char *pre;\r\n          char x;\r\n          pre = &aPrefix[infop->prefix];\r\n          for(; (x=(*pre))!=0; pre++) *(--bufpt) = x;\r\n        }\r\n        length = (int)(&zOut[nOut-1]-bufpt);\r\n        break;\r\n      case etFLOAT:\r\n      case etEXP:\r\n      case etGENERIC:\r\n        realvalue = va_arg(ap,double);\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n        length = 0;\r\n#else\r\n        if( precision<0 ) precision = 6;         /* Set default precision */\r\n        if( realvalue<0.0 ){\r\n          realvalue = -realvalue;\r\n          prefix = '-';\r\n        }else{\r\n          if( flag_plussign )          prefix = '+';\r\n          else if( flag_blanksign )    prefix = ' ';\r\n          else                         prefix = 0;\r\n        }\r\n        if( xtype==etGENERIC && precision>0 ) precision--;\r\n#if 0\r\n        /* Rounding works like BSD when the constant 0.4999 is used.  Wierd! */\r\n        for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);\r\n#else\r\n        /* It makes more sense to use 0.5 */\r\n        for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){}\r\n#endif\r\n        if( xtype==etFLOAT ) realvalue += rounder;\r\n        /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */\r\n        exp = 0;\r\n        if( sqlite3IsNaN((double)realvalue) ){\r\n          bufpt = \"NaN\";\r\n          length = 3;\r\n          break;\r\n        }\r\n        if( realvalue>0.0 ){\r\n          while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }\r\n          while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }\r\n          while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }\r\n          while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }\r\n          while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }\r\n          if( exp>350 ){\r\n            if( prefix=='-' ){\r\n              bufpt = \"-Inf\";\r\n            }else if( prefix=='+' ){\r\n              bufpt = \"+Inf\";\r\n            }else{\r\n              bufpt = \"Inf\";\r\n            }\r\n            length = sqlite3Strlen30(bufpt);\r\n            break;\r\n          }\r\n        }\r\n        bufpt = buf;\r\n        /*\r\n        ** If the field type is etGENERIC, then convert to either etEXP\r\n        ** or etFLOAT, as appropriate.\r\n        */\r\n        if( xtype!=etFLOAT ){\r\n          realvalue += rounder;\r\n          if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }\r\n        }\r\n        if( xtype==etGENERIC ){\r\n          flag_rtz = !flag_alternateform;\r\n          if( exp<-4 || exp>precision ){\r\n            xtype = etEXP;\r\n          }else{\r\n            precision = precision - exp;\r\n            xtype = etFLOAT;\r\n          }\r\n        }else{\r\n          flag_rtz = 0;\r\n        }\r\n        if( xtype==etEXP ){\r\n          e2 = 0;\r\n        }else{\r\n          e2 = exp;\r\n        }\r\n        if( e2+precision+width > etBUFSIZE - 15 ){\r\n          bufpt = zExtra = sqlite3Malloc( e2+precision+width+15 );\r\n          if( bufpt==0 ){\r\n            pAccum->mallocFailed = 1;\r\n            return;\r\n          }\r\n        }\r\n        zOut = bufpt;\r\n        nsd = 0;\r\n        flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;\r\n        /* The sign in front of the number */\r\n        if( prefix ){\r\n          *(bufpt++) = prefix;\r\n        }\r\n        /* Digits prior to the decimal point */\r\n        if( e2<0 ){\r\n          *(bufpt++) = '0';\r\n        }else{\r\n          for(; e2>=0; e2--){\r\n            *(bufpt++) = et_getdigit(&realvalue,&nsd);\r\n          }\r\n        }\r\n        /* The decimal point */\r\n        if( flag_dp ){\r\n          *(bufpt++) = '.';\r\n        }\r\n        /* \"0\" digits after the decimal point but before the first\r\n        ** significant digit of the number */\r\n        for(e2++; e2<0; precision--, e2++){\r\n          assert( precision>0 );\r\n          *(bufpt++) = '0';\r\n        }\r\n        /* Significant digits after the decimal point */\r\n        while( (precision--)>0 ){\r\n          *(bufpt++) = et_getdigit(&realvalue,&nsd);\r\n        }\r\n        /* Remove trailing zeros and the \".\" if no digits follow the \".\" */\r\n        if( flag_rtz && flag_dp ){\r\n          while( bufpt[-1]=='0' ) *(--bufpt) = 0;\r\n          assert( bufpt>zOut );\r\n          if( bufpt[-1]=='.' ){\r\n            if( flag_altform2 ){\r\n              *(bufpt++) = '0';\r\n            }else{\r\n              *(--bufpt) = 0;\r\n            }\r\n          }\r\n        }\r\n        /* Add the \"eNNN\" suffix */\r\n        if( xtype==etEXP ){\r\n          *(bufpt++) = aDigits[infop->charset];\r\n          if( exp<0 ){\r\n            *(bufpt++) = '-'; exp = -exp;\r\n          }else{\r\n            *(bufpt++) = '+';\r\n          }\r\n          if( exp>=100 ){\r\n            *(bufpt++) = (char)((exp/100)+'0');        /* 100's digit */\r\n            exp %= 100;\r\n          }\r\n          *(bufpt++) = (char)(exp/10+'0');             /* 10's digit */\r\n          *(bufpt++) = (char)(exp%10+'0');             /* 1's digit */\r\n        }\r\n        *bufpt = 0;\r\n\r\n        /* The converted number is in buf[] and zero terminated. Output it.\r\n        ** Note that the number is in the usual order, not reversed as with\r\n        ** integer conversions. */\r\n        length = (int)(bufpt-zOut);\r\n        bufpt = zOut;\r\n\r\n        /* Special case:  Add leading zeros if the flag_zeropad flag is\r\n        ** set and we are not left justified */\r\n        if( flag_zeropad && !flag_leftjustify && length < width){\r\n          int i;\r\n          int nPad = width - length;\r\n          for(i=width; i>=nPad; i--){\r\n            bufpt[i] = bufpt[i-nPad];\r\n          }\r\n          i = prefix!=0;\r\n          while( nPad-- ) bufpt[i++] = '0';\r\n          length = width;\r\n        }\r\n#endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */\r\n        break;\r\n      case etSIZE:\r\n        *(va_arg(ap,int*)) = pAccum->nChar;\r\n        length = width = 0;\r\n        break;\r\n      case etPERCENT:\r\n        buf[0] = '%';\r\n        bufpt = buf;\r\n        length = 1;\r\n        break;\r\n      case etCHARX:\r\n        c = va_arg(ap,int);\r\n        buf[0] = (char)c;\r\n        if( precision>=0 ){\r\n          for(idx=1; idx<precision; idx++) buf[idx] = (char)c;\r\n          length = precision;\r\n        }else{\r\n          length =1;\r\n        }\r\n        bufpt = buf;\r\n        break;\r\n      case etSTRING:\r\n      case etDYNSTRING:\r\n        bufpt = va_arg(ap,char*);\r\n        if( bufpt==0 ){\r\n          bufpt = \"\";\r\n        }else if( xtype==etDYNSTRING ){\r\n          zExtra = bufpt;\r\n        }\r\n        if( precision>=0 ){\r\n          for(length=0; length<precision && bufpt[length]; length++){}\r\n        }else{\r\n          length = sqlite3Strlen30(bufpt);\r\n        }\r\n        break;\r\n      case etSQLESCAPE:\r\n      case etSQLESCAPE2:\r\n      case etSQLESCAPE3: {\r\n        int i, j, k, n, isnull;\r\n        int needQuote;\r\n        char ch;\r\n        char q = ((xtype==etSQLESCAPE3)?'\"':'\\'');   /* Quote character */\r\n        char *escarg = va_arg(ap,char*);\r\n        isnull = escarg==0;\r\n        if( isnull ) escarg = (xtype==etSQLESCAPE2 ? \"NULL\" : \"(NULL)\");\r\n        k = precision;\r\n        for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){\r\n          if( ch==q )  n++;\r\n        }\r\n        needQuote = !isnull && xtype==etSQLESCAPE2;\r\n        n += i + 1 + needQuote*2;\r\n        if( n>etBUFSIZE ){\r\n          bufpt = zExtra = sqlite3Malloc( n );\r\n          if( bufpt==0 ){\r\n            pAccum->mallocFailed = 1;\r\n            return;\r\n          }\r\n        }else{\r\n          bufpt = buf;\r\n        }\r\n        j = 0;\r\n        if( needQuote ) bufpt[j++] = q;\r\n        k = i;\r\n        for(i=0; i<k; i++){\r\n          bufpt[j++] = ch = escarg[i];\r\n          if( ch==q ) bufpt[j++] = ch;\r\n        }\r\n        if( needQuote ) bufpt[j++] = q;\r\n        bufpt[j] = 0;\r\n        length = j;\r\n        /* The precision in %q and %Q means how many input characters to\r\n        ** consume, not the length of the output...\r\n        ** if( precision>=0 && precision<length ) length = precision; */\r\n        break;\r\n      }\r\n      case etTOKEN: {\r\n        Token *pToken = va_arg(ap, Token*);\r\n        if( pToken ){\r\n          sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n);\r\n        }\r\n        length = width = 0;\r\n        break;\r\n      }\r\n      case etSRCLIST: {\r\n        SrcList *pSrc = va_arg(ap, SrcList*);\r\n        int k = va_arg(ap, int);\r\n        struct SrcList_item *pItem = &pSrc->a[k];\r\n        assert( k>=0 && k<pSrc->nSrc );\r\n        if( pItem->zDatabase ){\r\n          sqlite3StrAccumAppend(pAccum, pItem->zDatabase, -1);\r\n          sqlite3StrAccumAppend(pAccum, \".\", 1);\r\n        }\r\n        sqlite3StrAccumAppend(pAccum, pItem->zName, -1);\r\n        length = width = 0;\r\n        break;\r\n      }\r\n      default: {\r\n        assert( xtype==etINVALID );\r\n        return;\r\n      }\r\n    }/* End switch over the format type */\r\n    /*\r\n    ** The text of the conversion is pointed to by \"bufpt\" and is\r\n    ** \"length\" characters long.  The field width is \"width\".  Do\r\n    ** the output.\r\n    */\r\n    if( !flag_leftjustify ){\r\n      register int nspace;\r\n      nspace = width-length;\r\n      if( nspace>0 ){\r\n        sqlite3AppendSpace(pAccum, nspace);\r\n      }\r\n    }\r\n    if( length>0 ){\r\n      sqlite3StrAccumAppend(pAccum, bufpt, length);\r\n    }\r\n    if( flag_leftjustify ){\r\n      register int nspace;\r\n      nspace = width-length;\r\n      if( nspace>0 ){\r\n        sqlite3AppendSpace(pAccum, nspace);\r\n      }\r\n    }\r\n    sqlite3_free(zExtra);\r\n  }/* End for loop over the format string */\r\n} /* End of function */\r\n\r\n/*\r\n** Append N bytes of text from z to the StrAccum object.\r\n*/\r\nSQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){\r\n  assert( z!=0 || N==0 );\r\n  if( p->tooBig | p->mallocFailed ){\r\n    testcase(p->tooBig);\r\n    testcase(p->mallocFailed);\r\n    return;\r\n  }\r\n  assert( p->zText!=0 || p->nChar==0 );\r\n  if( N<0 ){\r\n    N = sqlite3Strlen30(z);\r\n  }\r\n  if( N==0 || NEVER(z==0) ){\r\n    return;\r\n  }\r\n  if( p->nChar+N >= p->nAlloc ){\r\n    char *zNew;\r\n    if( !p->useMalloc ){\r\n      p->tooBig = 1;\r\n      N = p->nAlloc - p->nChar - 1;\r\n      if( N<=0 ){\r\n        return;\r\n      }\r\n    }else{\r\n      char *zOld = (p->zText==p->zBase ? 0 : p->zText);\r\n      i64 szNew = p->nChar;\r\n      szNew += N + 1;\r\n      if( szNew > p->mxAlloc ){\r\n        sqlite3StrAccumReset(p);\r\n        p->tooBig = 1;\r\n        return;\r\n      }else{\r\n        p->nAlloc = (int)szNew;\r\n      }\r\n      if( p->useMalloc==1 ){\r\n        zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc);\r\n      }else{\r\n        zNew = sqlite3_realloc(zOld, p->nAlloc);\r\n      }\r\n      if( zNew ){\r\n        if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);\r\n        p->zText = zNew;\r\n      }else{\r\n        p->mallocFailed = 1;\r\n        sqlite3StrAccumReset(p);\r\n        return;\r\n      }\r\n    }\r\n  }\r\n  assert( p->zText );\r\n  memcpy(&p->zText[p->nChar], z, N);\r\n  p->nChar += N;\r\n}\r\n\r\n/*\r\n** Finish off a string by making sure it is zero-terminated.\r\n** Return a pointer to the resulting string.  Return a NULL\r\n** pointer if any kind of error was encountered.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){\r\n  if( p->zText ){\r\n    p->zText[p->nChar] = 0;\r\n    if( p->useMalloc && p->zText==p->zBase ){\r\n      if( p->useMalloc==1 ){\r\n        p->zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );\r\n      }else{\r\n        p->zText = sqlite3_malloc(p->nChar+1);\r\n      }\r\n      if( p->zText ){\r\n        memcpy(p->zText, p->zBase, p->nChar+1);\r\n      }else{\r\n        p->mallocFailed = 1;\r\n      }\r\n    }\r\n  }\r\n  return p->zText;\r\n}\r\n\r\n/*\r\n** Reset an StrAccum string.  Reclaim all malloced memory.\r\n*/\r\nSQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){\r\n  if( p->zText!=p->zBase ){\r\n    if( p->useMalloc==1 ){\r\n      sqlite3DbFree(p->db, p->zText);\r\n    }else{\r\n      sqlite3_free(p->zText);\r\n    }\r\n  }\r\n  p->zText = 0;\r\n}\r\n\r\n/*\r\n** Initialize a string accumulator\r\n*/\r\nSQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, char *zBase, int n, int mx){\r\n  p->zText = p->zBase = zBase;\r\n  p->db = 0;\r\n  p->nChar = 0;\r\n  p->nAlloc = n;\r\n  p->mxAlloc = mx;\r\n  p->useMalloc = 1;\r\n  p->tooBig = 0;\r\n  p->mallocFailed = 0;\r\n}\r\n\r\n/*\r\n** Print into memory obtained from sqliteMalloc().  Use the internal\r\n** %-conversion extensions.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){\r\n  char *z;\r\n  char zBase[SQLITE_PRINT_BUF_SIZE];\r\n  StrAccum acc;\r\n  assert( db!=0 );\r\n  sqlite3StrAccumInit(&acc, zBase, sizeof(zBase),\r\n                      db->aLimit[SQLITE_LIMIT_LENGTH]);\r\n  acc.db = db;\r\n  sqlite3VXPrintf(&acc, 1, zFormat, ap);\r\n  z = sqlite3StrAccumFinish(&acc);\r\n  if( acc.mallocFailed ){\r\n    db->mallocFailed = 1;\r\n  }\r\n  return z;\r\n}\r\n\r\n/*\r\n** Print into memory obtained from sqliteMalloc().  Use the internal\r\n** %-conversion extensions.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){\r\n  va_list ap;\r\n  char *z;\r\n  va_start(ap, zFormat);\r\n  z = sqlite3VMPrintf(db, zFormat, ap);\r\n  va_end(ap);\r\n  return z;\r\n}\r\n\r\n/*\r\n** Like sqlite3MPrintf(), but call sqlite3DbFree() on zStr after formatting\r\n** the string and before returnning.  This routine is intended to be used\r\n** to modify an existing string.  For example:\r\n**\r\n**       x = sqlite3MPrintf(db, x, \"prefix %s suffix\", x);\r\n**\r\n*/\r\nSQLITE_PRIVATE char *sqlite3MAppendf(sqlite3 *db, char *zStr, const char *zFormat, ...){\r\n  va_list ap;\r\n  char *z;\r\n  va_start(ap, zFormat);\r\n  z = sqlite3VMPrintf(db, zFormat, ap);\r\n  va_end(ap);\r\n  sqlite3DbFree(db, zStr);\r\n  return z;\r\n}\r\n\r\n/*\r\n** Print into memory obtained from sqlite3_malloc().  Omit the internal\r\n** %-conversion extensions.\r\n*/\r\nSQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){\r\n  char *z;\r\n  char zBase[SQLITE_PRINT_BUF_SIZE];\r\n  StrAccum acc;\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  if( sqlite3_initialize() ) return 0;\r\n#endif\r\n  sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);\r\n  acc.useMalloc = 2;\r\n  sqlite3VXPrintf(&acc, 0, zFormat, ap);\r\n  z = sqlite3StrAccumFinish(&acc);\r\n  return z;\r\n}\r\n\r\n/*\r\n** Print into memory obtained from sqlite3_malloc()().  Omit the internal\r\n** %-conversion extensions.\r\n*/\r\nSQLITE_API char *sqlite3_mprintf(const char *zFormat, ...){\r\n  va_list ap;\r\n  char *z;\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  if( sqlite3_initialize() ) return 0;\r\n#endif\r\n  va_start(ap, zFormat);\r\n  z = sqlite3_vmprintf(zFormat, ap);\r\n  va_end(ap);\r\n  return z;\r\n}\r\n\r\n/*\r\n** sqlite3_snprintf() works like snprintf() except that it ignores the\r\n** current locale settings.  This is important for SQLite because we\r\n** are not able to use a \",\" as the decimal point in place of \".\" as\r\n** specified by some locales.\r\n**\r\n** Oops:  The first two arguments of sqlite3_snprintf() are backwards\r\n** from the snprintf() standard.  Unfortunately, it is too late to change\r\n** this without breaking compatibility, so we just have to live with the\r\n** mistake.\r\n**\r\n** sqlite3_vsnprintf() is the varargs version.\r\n*/\r\nSQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){\r\n  StrAccum acc;\r\n  if( n<=0 ) return zBuf;\r\n  sqlite3StrAccumInit(&acc, zBuf, n, 0);\r\n  acc.useMalloc = 0;\r\n  sqlite3VXPrintf(&acc, 0, zFormat, ap);\r\n  return sqlite3StrAccumFinish(&acc);\r\n}\r\nSQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){\r\n  char *z;\r\n  va_list ap;\r\n  va_start(ap,zFormat);\r\n  z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);\r\n  va_end(ap);\r\n  return z;\r\n}\r\n\r\n/*\r\n** This is the routine that actually formats the sqlite3_log() message.\r\n** We house it in a separate routine from sqlite3_log() to avoid using\r\n** stack space on small-stack systems when logging is disabled.\r\n**\r\n** sqlite3_log() must render into a static buffer.  It cannot dynamically\r\n** allocate memory because it might be called while the memory allocator\r\n** mutex is held.\r\n*/\r\nstatic void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){\r\n  StrAccum acc;                          /* String accumulator */\r\n  char zMsg[SQLITE_PRINT_BUF_SIZE*3];    /* Complete log message */\r\n\r\n  sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0);\r\n  acc.useMalloc = 0;\r\n  sqlite3VXPrintf(&acc, 0, zFormat, ap);\r\n  sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,\r\n                           sqlite3StrAccumFinish(&acc));\r\n}\r\n\r\n/*\r\n** Format and write a message to the log if logging is enabled.\r\n*/\r\nSQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){\r\n  va_list ap;                             /* Vararg list */\r\n  if( sqlite3GlobalConfig.xLog ){\r\n    va_start(ap, zFormat);\r\n    renderLogMsg(iErrCode, zFormat, ap);\r\n    va_end(ap);\r\n  }\r\n}\r\n\r\n#if defined(SQLITE_DEBUG)\r\n/*\r\n** A version of printf() that understands %lld.  Used for debugging.\r\n** The printf() built into some versions of windows does not understand %lld\r\n** and segfaults if you give it a long long int.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){\r\n  va_list ap;\r\n  StrAccum acc;\r\n  char zBuf[500];\r\n  sqlite3StrAccumInit(&acc, zBuf, sizeof(zBuf), 0);\r\n  acc.useMalloc = 0;\r\n  va_start(ap,zFormat);\r\n  sqlite3VXPrintf(&acc, 0, zFormat, ap);\r\n  va_end(ap);\r\n  sqlite3StrAccumFinish(&acc);\r\n  fprintf(stdout,\"%s\", zBuf);\r\n  fflush(stdout);\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_TRACE\r\n/*\r\n** variable-argument wrapper around sqlite3VXPrintf().\r\n*/\r\nSQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, const char *zFormat, ...){\r\n  va_list ap;\r\n  va_start(ap,zFormat);\r\n  sqlite3VXPrintf(p, 1, zFormat, ap);\r\n  va_end(ap);\r\n}\r\n#endif\r\n\r\n/************** End of printf.c **********************************************/\r\n/************** Begin file random.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code to implement a pseudo-random number\r\n** generator (PRNG) for SQLite.\r\n**\r\n** Random numbers are used by some of the database backends in order\r\n** to generate random integer keys for tables or random filenames.\r\n*/\r\n\r\n\r\n/* All threads share a single random number generator.\r\n** This structure is the current state of the generator.\r\n*/\r\nstatic SQLITE_WSD struct sqlite3PrngType {\r\n  unsigned char isInit;          /* True if initialized */\r\n  unsigned char i, j;            /* State variables */\r\n  unsigned char s[256];          /* State variables */\r\n} sqlite3Prng;\r\n\r\n/*\r\n** Get a single 8-bit random value from the RC4 PRNG.  The Mutex\r\n** must be held while executing this routine.\r\n**\r\n** Why not just use a library random generator like lrand48() for this?\r\n** Because the OP_NewRowid opcode in the VDBE depends on having a very\r\n** good source of random numbers.  The lrand48() library function may\r\n** well be good enough.  But maybe not.  Or maybe lrand48() has some\r\n** subtle problems on some systems that could cause problems.  It is hard\r\n** to know.  To minimize the risk of problems due to bad lrand48()\r\n** implementations, SQLite uses this random number generator based\r\n** on RC4, which we know works very well.\r\n**\r\n** (Later):  Actually, OP_NewRowid does not depend on a good source of\r\n** randomness any more.  But we will leave this code in all the same.\r\n*/\r\nstatic u8 randomByte(void){\r\n  unsigned char t;\r\n\r\n\r\n  /* The \"wsdPrng\" macro will resolve to the pseudo-random number generator\r\n  ** state vector.  If writable static data is unsupported on the target,\r\n  ** we have to locate the state vector at run-time.  In the more common\r\n  ** case where writable static data is supported, wsdPrng can refer directly\r\n  ** to the \"sqlite3Prng\" state vector declared above.\r\n  */\r\n#ifdef SQLITE_OMIT_WSD\r\n  struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng);\r\n# define wsdPrng p[0]\r\n#else\r\n# define wsdPrng sqlite3Prng\r\n#endif\r\n\r\n\r\n  /* Initialize the state of the random number generator once,\r\n  ** the first time this routine is called.  The seed value does\r\n  ** not need to contain a lot of randomness since we are not\r\n  ** trying to do secure encryption or anything like that...\r\n  **\r\n  ** Nothing in this file or anywhere else in SQLite does any kind of\r\n  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random\r\n  ** number generator) not as an encryption device.\r\n  */\r\n  if( !wsdPrng.isInit ){\r\n    int i;\r\n    char k[256];\r\n    wsdPrng.j = 0;\r\n    wsdPrng.i = 0;\r\n    sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k);\r\n    for(i=0; i<256; i++){\r\n      wsdPrng.s[i] = (u8)i;\r\n    }\r\n    for(i=0; i<256; i++){\r\n      wsdPrng.j += wsdPrng.s[i] + k[i];\r\n      t = wsdPrng.s[wsdPrng.j];\r\n      wsdPrng.s[wsdPrng.j] = wsdPrng.s[i];\r\n      wsdPrng.s[i] = t;\r\n    }\r\n    wsdPrng.isInit = 1;\r\n  }\r\n\r\n  /* Generate and return single random byte\r\n  */\r\n  wsdPrng.i++;\r\n  t = wsdPrng.s[wsdPrng.i];\r\n  wsdPrng.j += t;\r\n  wsdPrng.s[wsdPrng.i] = wsdPrng.s[wsdPrng.j];\r\n  wsdPrng.s[wsdPrng.j] = t;\r\n  t += wsdPrng.s[wsdPrng.i];\r\n  return wsdPrng.s[t];\r\n}\r\n\r\n/*\r\n** Return N random bytes.\r\n*/\r\nSQLITE_API void sqlite3_randomness(int N, void *pBuf){\r\n  unsigned char *zBuf = pBuf;\r\n#if SQLITE_THREADSAFE\r\n  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);\r\n#endif\r\n  sqlite3_mutex_enter(mutex);\r\n  while( N-- ){\r\n    *(zBuf++) = randomByte();\r\n  }\r\n  sqlite3_mutex_leave(mutex);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\n/*\r\n** For testing purposes, we sometimes want to preserve the state of\r\n** PRNG and restore the PRNG to its saved state at a later time, or\r\n** to reset the PRNG to its initial state.  These routines accomplish\r\n** those tasks.\r\n**\r\n** The sqlite3_test_control() interface calls these routines to\r\n** control the PRNG.\r\n*/\r\nstatic SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng;\r\nSQLITE_PRIVATE void sqlite3PrngSaveState(void){\r\n  memcpy(\r\n    &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),\r\n    &GLOBAL(struct sqlite3PrngType, sqlite3Prng),\r\n    sizeof(sqlite3Prng)\r\n  );\r\n}\r\nSQLITE_PRIVATE void sqlite3PrngRestoreState(void){\r\n  memcpy(\r\n    &GLOBAL(struct sqlite3PrngType, sqlite3Prng),\r\n    &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),\r\n    sizeof(sqlite3Prng)\r\n  );\r\n}\r\nSQLITE_PRIVATE void sqlite3PrngResetState(void){\r\n  GLOBAL(struct sqlite3PrngType, sqlite3Prng).isInit = 0;\r\n}\r\n#endif /* SQLITE_OMIT_BUILTIN_TEST */\r\n\r\n/************** End of random.c **********************************************/\r\n/************** Begin file utf.c *********************************************/\r\n/*\r\n** 2004 April 13\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains routines used to translate between UTF-8, \r\n** UTF-16, UTF-16BE, and UTF-16LE.\r\n**\r\n** Notes on UTF-8:\r\n**\r\n**   Byte-0    Byte-1    Byte-2    Byte-3    Value\r\n**  0xxxxxxx                                 00000000 00000000 0xxxxxxx\r\n**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx\r\n**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx\r\n**  11110uuu  10uuzzzz  10yyyyyy  10xxxxxx   000uuuuu zzzzyyyy yyxxxxxx\r\n**\r\n**\r\n** Notes on UTF-16:  (with wwww+1==uuuuu)\r\n**\r\n**      Word-0               Word-1          Value\r\n**  110110ww wwzzzzyy   110111yy yyxxxxxx    000uuuuu zzzzyyyy yyxxxxxx\r\n**  zzzzyyyy yyxxxxxx                        00000000 zzzzyyyy yyxxxxxx\r\n**\r\n**\r\n** BOM or Byte Order Mark:\r\n**     0xff 0xfe   little-endian utf-16 follows\r\n**     0xfe 0xff   big-endian utf-16 follows\r\n**\r\n*/\r\n/* #include <assert.h> */\r\n\r\n#ifndef SQLITE_AMALGAMATION\r\n/*\r\n** The following constant value is used by the SQLITE_BIGENDIAN and\r\n** SQLITE_LITTLEENDIAN macros.\r\n*/\r\nSQLITE_PRIVATE const int sqlite3one = 1;\r\n#endif /* SQLITE_AMALGAMATION */\r\n\r\n/*\r\n** This lookup table is used to help decode the first byte of\r\n** a multi-byte UTF8 character.\r\n*/\r\nstatic const unsigned char sqlite3Utf8Trans1[] = {\r\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\r\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\r\n  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\r\n  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\r\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\r\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\r\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\r\n  0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,\r\n};\r\n\r\n\r\n#define WRITE_UTF8(zOut, c) {                          \\\r\n  if( c<0x00080 ){                                     \\\r\n    *zOut++ = (u8)(c&0xFF);                            \\\r\n  }                                                    \\\r\n  else if( c<0x00800 ){                                \\\r\n    *zOut++ = 0xC0 + (u8)((c>>6)&0x1F);                \\\r\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\r\n  }                                                    \\\r\n  else if( c<0x10000 ){                                \\\r\n    *zOut++ = 0xE0 + (u8)((c>>12)&0x0F);               \\\r\n    *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);              \\\r\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\r\n  }else{                                               \\\r\n    *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);             \\\r\n    *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);             \\\r\n    *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);              \\\r\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\r\n  }                                                    \\\r\n}\r\n\r\n#define WRITE_UTF16LE(zOut, c) {                                    \\\r\n  if( c<=0xFFFF ){                                                  \\\r\n    *zOut++ = (u8)(c&0x00FF);                                       \\\r\n    *zOut++ = (u8)((c>>8)&0x00FF);                                  \\\r\n  }else{                                                            \\\r\n    *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \\\r\n    *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));              \\\r\n    *zOut++ = (u8)(c&0x00FF);                                       \\\r\n    *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));                         \\\r\n  }                                                                 \\\r\n}\r\n\r\n#define WRITE_UTF16BE(zOut, c) {                                    \\\r\n  if( c<=0xFFFF ){                                                  \\\r\n    *zOut++ = (u8)((c>>8)&0x00FF);                                  \\\r\n    *zOut++ = (u8)(c&0x00FF);                                       \\\r\n  }else{                                                            \\\r\n    *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));              \\\r\n    *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \\\r\n    *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));                         \\\r\n    *zOut++ = (u8)(c&0x00FF);                                       \\\r\n  }                                                                 \\\r\n}\r\n\r\n#define READ_UTF16LE(zIn, TERM, c){                                   \\\r\n  c = (*zIn++);                                                       \\\r\n  c += ((*zIn++)<<8);                                                 \\\r\n  if( c>=0xD800 && c<0xE000 && TERM ){                                \\\r\n    int c2 = (*zIn++);                                                \\\r\n    c2 += ((*zIn++)<<8);                                              \\\r\n    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \\\r\n  }                                                                   \\\r\n}\r\n\r\n#define READ_UTF16BE(zIn, TERM, c){                                   \\\r\n  c = ((*zIn++)<<8);                                                  \\\r\n  c += (*zIn++);                                                      \\\r\n  if( c>=0xD800 && c<0xE000 && TERM ){                                \\\r\n    int c2 = ((*zIn++)<<8);                                           \\\r\n    c2 += (*zIn++);                                                   \\\r\n    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \\\r\n  }                                                                   \\\r\n}\r\n\r\n/*\r\n** Translate a single UTF-8 character.  Return the unicode value.\r\n**\r\n** During translation, assume that the byte that zTerm points\r\n** is a 0x00.\r\n**\r\n** Write a pointer to the next unread byte back into *pzNext.\r\n**\r\n** Notes On Invalid UTF-8:\r\n**\r\n**  *  This routine never allows a 7-bit character (0x00 through 0x7f) to\r\n**     be encoded as a multi-byte character.  Any multi-byte character that\r\n**     attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd.\r\n**\r\n**  *  This routine never allows a UTF16 surrogate value to be encoded.\r\n**     If a multi-byte character attempts to encode a value between\r\n**     0xd800 and 0xe000 then it is rendered as 0xfffd.\r\n**\r\n**  *  Bytes in the range of 0x80 through 0xbf which occur as the first\r\n**     byte of a character are interpreted as single-byte characters\r\n**     and rendered as themselves even though they are technically\r\n**     invalid characters.\r\n**\r\n**  *  This routine accepts an infinite number of different UTF8 encodings\r\n**     for unicode values 0x80 and greater.  It do not change over-length\r\n**     encodings to 0xfffd as some systems recommend.\r\n*/\r\n#define READ_UTF8(zIn, zTerm, c)                           \\\r\n  c = *(zIn++);                                            \\\r\n  if( c>=0xc0 ){                                           \\\r\n    c = sqlite3Utf8Trans1[c-0xc0];                         \\\r\n    while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){            \\\r\n      c = (c<<6) + (0x3f & *(zIn++));                      \\\r\n    }                                                      \\\r\n    if( c<0x80                                             \\\r\n        || (c&0xFFFFF800)==0xD800                          \\\r\n        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }        \\\r\n  }\r\nSQLITE_PRIVATE u32 sqlite3Utf8Read(\r\n  const unsigned char *zIn,       /* First byte of UTF-8 character */\r\n  const unsigned char **pzNext    /* Write first byte past UTF-8 char here */\r\n){\r\n  unsigned int c;\r\n\r\n  /* Same as READ_UTF8() above but without the zTerm parameter.\r\n  ** For this routine, we assume the UTF8 string is always zero-terminated.\r\n  */\r\n  c = *(zIn++);\r\n  if( c>=0xc0 ){\r\n    c = sqlite3Utf8Trans1[c-0xc0];\r\n    while( (*zIn & 0xc0)==0x80 ){\r\n      c = (c<<6) + (0x3f & *(zIn++));\r\n    }\r\n    if( c<0x80\r\n        || (c&0xFFFFF800)==0xD800\r\n        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }\r\n  }\r\n  *pzNext = zIn;\r\n  return c;\r\n}\r\n\r\n\r\n\r\n\r\n/*\r\n** If the TRANSLATE_TRACE macro is defined, the value of each Mem is\r\n** printed on stderr on the way into and out of sqlite3VdbeMemTranslate().\r\n*/ \r\n/* #define TRANSLATE_TRACE 1 */\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** This routine transforms the internal text encoding used by pMem to\r\n** desiredEnc. It is an error if the string is already of the desired\r\n** encoding, or if *pMem does not contain a string value.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){\r\n  int len;                    /* Maximum length of output string in bytes */\r\n  unsigned char *zOut;                  /* Output buffer */\r\n  unsigned char *zIn;                   /* Input iterator */\r\n  unsigned char *zTerm;                 /* End of input */\r\n  unsigned char *z;                     /* Output iterator */\r\n  unsigned int c;\r\n\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( pMem->flags&MEM_Str );\r\n  assert( pMem->enc!=desiredEnc );\r\n  assert( pMem->enc!=0 );\r\n  assert( pMem->n>=0 );\r\n\r\n#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)\r\n  {\r\n    char zBuf[100];\r\n    sqlite3VdbeMemPrettyPrint(pMem, zBuf);\r\n    fprintf(stderr, \"INPUT:  %s\\n\", zBuf);\r\n  }\r\n#endif\r\n\r\n  /* If the translation is between UTF-16 little and big endian, then \r\n  ** all that is required is to swap the byte order. This case is handled\r\n  ** differently from the others.\r\n  */\r\n  if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){\r\n    u8 temp;\r\n    int rc;\r\n    rc = sqlite3VdbeMemMakeWriteable(pMem);\r\n    if( rc!=SQLITE_OK ){\r\n      assert( rc==SQLITE_NOMEM );\r\n      return SQLITE_NOMEM;\r\n    }\r\n    zIn = (u8*)pMem->z;\r\n    zTerm = &zIn[pMem->n&~1];\r\n    while( zIn<zTerm ){\r\n      temp = *zIn;\r\n      *zIn = *(zIn+1);\r\n      zIn++;\r\n      *zIn++ = temp;\r\n    }\r\n    pMem->enc = desiredEnc;\r\n    goto translate_out;\r\n  }\r\n\r\n  /* Set len to the maximum number of bytes required in the output buffer. */\r\n  if( desiredEnc==SQLITE_UTF8 ){\r\n    /* When converting from UTF-16, the maximum growth results from\r\n    ** translating a 2-byte character to a 4-byte UTF-8 character.\r\n    ** A single byte is required for the output string\r\n    ** nul-terminator.\r\n    */\r\n    pMem->n &= ~1;\r\n    len = pMem->n * 2 + 1;\r\n  }else{\r\n    /* When converting from UTF-8 to UTF-16 the maximum growth is caused\r\n    ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16\r\n    ** character. Two bytes are required in the output buffer for the\r\n    ** nul-terminator.\r\n    */\r\n    len = pMem->n * 2 + 2;\r\n  }\r\n\r\n  /* Set zIn to point at the start of the input buffer and zTerm to point 1\r\n  ** byte past the end.\r\n  **\r\n  ** Variable zOut is set to point at the output buffer, space obtained\r\n  ** from sqlite3_malloc().\r\n  */\r\n  zIn = (u8*)pMem->z;\r\n  zTerm = &zIn[pMem->n];\r\n  zOut = sqlite3DbMallocRaw(pMem->db, len);\r\n  if( !zOut ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  z = zOut;\r\n\r\n  if( pMem->enc==SQLITE_UTF8 ){\r\n    if( desiredEnc==SQLITE_UTF16LE ){\r\n      /* UTF-8 -> UTF-16 Little-endian */\r\n      while( zIn<zTerm ){\r\n        /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */\r\n        READ_UTF8(zIn, zTerm, c);\r\n        WRITE_UTF16LE(z, c);\r\n      }\r\n    }else{\r\n      assert( desiredEnc==SQLITE_UTF16BE );\r\n      /* UTF-8 -> UTF-16 Big-endian */\r\n      while( zIn<zTerm ){\r\n        /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */\r\n        READ_UTF8(zIn, zTerm, c);\r\n        WRITE_UTF16BE(z, c);\r\n      }\r\n    }\r\n    pMem->n = (int)(z - zOut);\r\n    *z++ = 0;\r\n  }else{\r\n    assert( desiredEnc==SQLITE_UTF8 );\r\n    if( pMem->enc==SQLITE_UTF16LE ){\r\n      /* UTF-16 Little-endian -> UTF-8 */\r\n      while( zIn<zTerm ){\r\n        READ_UTF16LE(zIn, zIn<zTerm, c); \r\n        WRITE_UTF8(z, c);\r\n      }\r\n    }else{\r\n      /* UTF-16 Big-endian -> UTF-8 */\r\n      while( zIn<zTerm ){\r\n        READ_UTF16BE(zIn, zIn<zTerm, c); \r\n        WRITE_UTF8(z, c);\r\n      }\r\n    }\r\n    pMem->n = (int)(z - zOut);\r\n  }\r\n  *z = 0;\r\n  assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );\r\n\r\n  sqlite3VdbeMemRelease(pMem);\r\n  pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem);\r\n  pMem->enc = desiredEnc;\r\n  pMem->flags |= (MEM_Term|MEM_Dyn);\r\n  pMem->z = (char*)zOut;\r\n  pMem->zMalloc = pMem->z;\r\n\r\ntranslate_out:\r\n#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)\r\n  {\r\n    char zBuf[100];\r\n    sqlite3VdbeMemPrettyPrint(pMem, zBuf);\r\n    fprintf(stderr, \"OUTPUT: %s\\n\", zBuf);\r\n  }\r\n#endif\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This routine checks for a byte-order mark at the beginning of the \r\n** UTF-16 string stored in *pMem. If one is present, it is removed and\r\n** the encoding of the Mem adjusted. This routine does not do any\r\n** byte-swapping, it just sets Mem.enc appropriately.\r\n**\r\n** The allocation (static, dynamic etc.) and encoding of the Mem may be\r\n** changed by this function.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){\r\n  int rc = SQLITE_OK;\r\n  u8 bom = 0;\r\n\r\n  assert( pMem->n>=0 );\r\n  if( pMem->n>1 ){\r\n    u8 b1 = *(u8 *)pMem->z;\r\n    u8 b2 = *(((u8 *)pMem->z) + 1);\r\n    if( b1==0xFE && b2==0xFF ){\r\n      bom = SQLITE_UTF16BE;\r\n    }\r\n    if( b1==0xFF && b2==0xFE ){\r\n      bom = SQLITE_UTF16LE;\r\n    }\r\n  }\r\n  \r\n  if( bom ){\r\n    rc = sqlite3VdbeMemMakeWriteable(pMem);\r\n    if( rc==SQLITE_OK ){\r\n      pMem->n -= 2;\r\n      memmove(pMem->z, &pMem->z[2], pMem->n);\r\n      pMem->z[pMem->n] = '\\0';\r\n      pMem->z[pMem->n+1] = '\\0';\r\n      pMem->flags |= MEM_Term;\r\n      pMem->enc = bom;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/*\r\n** pZ is a UTF-8 encoded unicode string. If nByte is less than zero,\r\n** return the number of unicode characters in pZ up to (but not including)\r\n** the first 0x00 byte. If nByte is not less than zero, return the\r\n** number of unicode characters in the first nByte of pZ (or up to \r\n** the first 0x00, whichever comes first).\r\n*/\r\nSQLITE_PRIVATE int sqlite3Utf8CharLen(const char *zIn, int nByte){\r\n  int r = 0;\r\n  const u8 *z = (const u8*)zIn;\r\n  const u8 *zTerm;\r\n  if( nByte>=0 ){\r\n    zTerm = &z[nByte];\r\n  }else{\r\n    zTerm = (const u8*)(-1);\r\n  }\r\n  assert( z<=zTerm );\r\n  while( *z!=0 && z<zTerm ){\r\n    SQLITE_SKIP_UTF8(z);\r\n    r++;\r\n  }\r\n  return r;\r\n}\r\n\r\n/* This test function is not currently used by the automated test-suite. \r\n** Hence it is only available in debug builds.\r\n*/\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n/*\r\n** Translate UTF-8 to UTF-8.\r\n**\r\n** This has the effect of making sure that the string is well-formed\r\n** UTF-8.  Miscoded characters are removed.\r\n**\r\n** The translation is done in-place and aborted if the output\r\n** overruns the input.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Utf8To8(unsigned char *zIn){\r\n  unsigned char *zOut = zIn;\r\n  unsigned char *zStart = zIn;\r\n  u32 c;\r\n\r\n  while( zIn[0] && zOut<=zIn ){\r\n    c = sqlite3Utf8Read(zIn, (const u8**)&zIn);\r\n    if( c!=0xfffd ){\r\n      WRITE_UTF8(zOut, c);\r\n    }\r\n  }\r\n  *zOut = 0;\r\n  return (int)(zOut - zStart);\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** Convert a UTF-16 string in the native encoding into a UTF-8 string.\r\n** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must\r\n** be freed by the calling function.\r\n**\r\n** NULL is returned if there is an allocation error.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){\r\n  Mem m;\r\n  memset(&m, 0, sizeof(m));\r\n  m.db = db;\r\n  sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);\r\n  sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);\r\n  if( db->mallocFailed ){\r\n    sqlite3VdbeMemRelease(&m);\r\n    m.z = 0;\r\n  }\r\n  assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );\r\n  assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );\r\n  assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed );\r\n  assert( m.z || db->mallocFailed );\r\n  return m.z;\r\n}\r\n\r\n/*\r\n** Convert a UTF-8 string to the UTF-16 encoding specified by parameter\r\n** enc. A pointer to the new string is returned, and the value of *pnOut\r\n** is set to the length of the returned string in bytes. The call should\r\n** arrange to call sqlite3DbFree() on the returned pointer when it is\r\n** no longer required.\r\n** \r\n** If a malloc failure occurs, NULL is returned and the db.mallocFailed\r\n** flag set.\r\n*/\r\n#ifdef SQLITE_ENABLE_STAT3\r\nSQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *db, u8 enc, char *z, int n, int *pnOut){\r\n  Mem m;\r\n  memset(&m, 0, sizeof(m));\r\n  m.db = db;\r\n  sqlite3VdbeMemSetStr(&m, z, n, SQLITE_UTF8, SQLITE_STATIC);\r\n  if( sqlite3VdbeMemTranslate(&m, enc) ){\r\n    assert( db->mallocFailed );\r\n    return 0;\r\n  }\r\n  assert( m.z==m.zMalloc );\r\n  *pnOut = m.n;\r\n  return m.z;\r\n}\r\n#endif\r\n\r\n/*\r\n** zIn is a UTF-16 encoded unicode string at least nChar characters long.\r\n** Return the number of bytes in the first nChar unicode characters\r\n** in pZ.  nChar must be non-negative.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){\r\n  int c;\r\n  unsigned char const *z = zIn;\r\n  int n = 0;\r\n  \r\n  if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){\r\n    while( n<nChar ){\r\n      READ_UTF16BE(z, 1, c);\r\n      n++;\r\n    }\r\n  }else{\r\n    while( n<nChar ){\r\n      READ_UTF16LE(z, 1, c);\r\n      n++;\r\n    }\r\n  }\r\n  return (int)(z-(unsigned char const *)zIn);\r\n}\r\n\r\n#if defined(SQLITE_TEST)\r\n/*\r\n** This routine is called from the TCL test function \"translate_selftest\".\r\n** It checks that the primitives for serializing and deserializing\r\n** characters in each encoding are inverses of each other.\r\n*/\r\nSQLITE_PRIVATE void sqlite3UtfSelfTest(void){\r\n  unsigned int i, t;\r\n  unsigned char zBuf[20];\r\n  unsigned char *z;\r\n  int n;\r\n  unsigned int c;\r\n\r\n  for(i=0; i<0x00110000; i++){\r\n    z = zBuf;\r\n    WRITE_UTF8(z, i);\r\n    n = (int)(z-zBuf);\r\n    assert( n>0 && n<=4 );\r\n    z[0] = 0;\r\n    z = zBuf;\r\n    c = sqlite3Utf8Read(z, (const u8**)&z);\r\n    t = i;\r\n    if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD;\r\n    if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD;\r\n    assert( c==t );\r\n    assert( (z-zBuf)==n );\r\n  }\r\n  for(i=0; i<0x00110000; i++){\r\n    if( i>=0xD800 && i<0xE000 ) continue;\r\n    z = zBuf;\r\n    WRITE_UTF16LE(z, i);\r\n    n = (int)(z-zBuf);\r\n    assert( n>0 && n<=4 );\r\n    z[0] = 0;\r\n    z = zBuf;\r\n    READ_UTF16LE(z, 1, c);\r\n    assert( c==i );\r\n    assert( (z-zBuf)==n );\r\n  }\r\n  for(i=0; i<0x00110000; i++){\r\n    if( i>=0xD800 && i<0xE000 ) continue;\r\n    z = zBuf;\r\n    WRITE_UTF16BE(z, i);\r\n    n = (int)(z-zBuf);\r\n    assert( n>0 && n<=4 );\r\n    z[0] = 0;\r\n    z = zBuf;\r\n    READ_UTF16BE(z, 1, c);\r\n    assert( c==i );\r\n    assert( (z-zBuf)==n );\r\n  }\r\n}\r\n#endif /* SQLITE_TEST */\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/************** End of utf.c *************************************************/\r\n/************** Begin file util.c ********************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** Utility functions used throughout sqlite.\r\n**\r\n** This file contains functions for allocating memory, comparing\r\n** strings, and stuff like that.\r\n**\r\n*/\r\n/* #include <stdarg.h> */\r\n#ifdef SQLITE_HAVE_ISNAN\r\n# include <math.h>\r\n#endif\r\n\r\n/*\r\n** Routine needed to support the testcase() macro.\r\n*/\r\n#ifdef SQLITE_COVERAGE_TEST\r\nSQLITE_PRIVATE void sqlite3Coverage(int x){\r\n  static unsigned dummy = 0;\r\n  dummy += (unsigned)x;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n/*\r\n** Return true if the floating point value is Not a Number (NaN).\r\n**\r\n** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN.\r\n** Otherwise, we have our own implementation that works on most systems.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IsNaN(double x){\r\n  int rc;   /* The value return */\r\n#if !defined(SQLITE_HAVE_ISNAN)\r\n  /*\r\n  ** Systems that support the isnan() library function should probably\r\n  ** make use of it by compiling with -DSQLITE_HAVE_ISNAN.  But we have\r\n  ** found that many systems do not have a working isnan() function so\r\n  ** this implementation is provided as an alternative.\r\n  **\r\n  ** This NaN test sometimes fails if compiled on GCC with -ffast-math.\r\n  ** On the other hand, the use of -ffast-math comes with the following\r\n  ** warning:\r\n  **\r\n  **      This option [-ffast-math] should never be turned on by any\r\n  **      -O option since it can result in incorrect output for programs\r\n  **      which depend on an exact implementation of IEEE or ISO \r\n  **      rules/specifications for math functions.\r\n  **\r\n  ** Under MSVC, this NaN test may fail if compiled with a floating-\r\n  ** point precision mode other than /fp:precise.  From the MSDN \r\n  ** documentation:\r\n  **\r\n  **      The compiler [with /fp:precise] will properly handle comparisons \r\n  **      involving NaN. For example, x != x evaluates to true if x is NaN \r\n  **      ...\r\n  */\r\n#ifdef __FAST_MATH__\r\n# error SQLite will not work correctly with the -ffast-math option of GCC.\r\n#endif\r\n  volatile double y = x;\r\n  volatile double z = y;\r\n  rc = (y!=z);\r\n#else  /* if defined(SQLITE_HAVE_ISNAN) */\r\n  rc = isnan(x);\r\n#endif /* SQLITE_HAVE_ISNAN */\r\n  testcase( rc );\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_FLOATING_POINT */\r\n\r\n/*\r\n** Compute a string length that is limited to what can be stored in\r\n** lower 30 bits of a 32-bit signed integer.\r\n**\r\n** The value returned will never be negative.  Nor will it ever be greater\r\n** than the actual length of the string.  For very long strings (greater\r\n** than 1GiB) the value returned might be less than the true string length.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Strlen30(const char *z){\r\n  const char *z2 = z;\r\n  if( z==0 ) return 0;\r\n  while( *z2 ){ z2++; }\r\n  return 0x3fffffff & (int)(z2 - z);\r\n}\r\n\r\n/*\r\n** Set the most recent error code and error string for the sqlite\r\n** handle \"db\". The error code is set to \"err_code\".\r\n**\r\n** If it is not NULL, string zFormat specifies the format of the\r\n** error string in the style of the printf functions: The following\r\n** format characters are allowed:\r\n**\r\n**      %s      Insert a string\r\n**      %z      A string that should be freed after use\r\n**      %d      Insert an integer\r\n**      %T      Insert a token\r\n**      %S      Insert the first element of a SrcList\r\n**\r\n** zFormat and any string tokens that follow it are assumed to be\r\n** encoded in UTF-8.\r\n**\r\n** To clear the most recent error for sqlite handle \"db\", sqlite3Error\r\n** should be called with err_code set to SQLITE_OK and zFormat set\r\n** to NULL.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){\r\n  if( db && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){\r\n    db->errCode = err_code;\r\n    if( zFormat ){\r\n      char *z;\r\n      va_list ap;\r\n      va_start(ap, zFormat);\r\n      z = sqlite3VMPrintf(db, zFormat, ap);\r\n      va_end(ap);\r\n      sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);\r\n    }else{\r\n      sqlite3ValueSetStr(db->pErr, 0, 0, SQLITE_UTF8, SQLITE_STATIC);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Add an error message to pParse->zErrMsg and increment pParse->nErr.\r\n** The following formatting characters are allowed:\r\n**\r\n**      %s      Insert a string\r\n**      %z      A string that should be freed after use\r\n**      %d      Insert an integer\r\n**      %T      Insert a token\r\n**      %S      Insert the first element of a SrcList\r\n**\r\n** This function should be used to report any error that occurs whilst\r\n** compiling an SQL statement (i.e. within sqlite3_prepare()). The\r\n** last thing the sqlite3_prepare() function does is copy the error\r\n** stored by this function into the database handle using sqlite3Error().\r\n** Function sqlite3Error() should be used during statement execution\r\n** (sqlite3_step() etc.).\r\n*/\r\nSQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){\r\n  char *zMsg;\r\n  va_list ap;\r\n  sqlite3 *db = pParse->db;\r\n  va_start(ap, zFormat);\r\n  zMsg = sqlite3VMPrintf(db, zFormat, ap);\r\n  va_end(ap);\r\n  if( db->suppressErr ){\r\n    sqlite3DbFree(db, zMsg);\r\n  }else{\r\n    pParse->nErr++;\r\n    sqlite3DbFree(db, pParse->zErrMsg);\r\n    pParse->zErrMsg = zMsg;\r\n    pParse->rc = SQLITE_ERROR;\r\n  }\r\n}\r\n\r\n/*\r\n** Convert an SQL-style quoted string into a normal string by removing\r\n** the quote characters.  The conversion is done in-place.  If the\r\n** input does not begin with a quote character, then this routine\r\n** is a no-op.\r\n**\r\n** The input string must be zero-terminated.  A new zero-terminator\r\n** is added to the dequoted string.\r\n**\r\n** The return value is -1 if no dequoting occurs or the length of the\r\n** dequoted string, exclusive of the zero terminator, if dequoting does\r\n** occur.\r\n**\r\n** 2002-Feb-14: This routine is extended to remove MS-Access style\r\n** brackets from around identifers.  For example:  \"[a-b-c]\" becomes\r\n** \"a-b-c\".\r\n*/\r\nSQLITE_PRIVATE int sqlite3Dequote(char *z){\r\n  char quote;\r\n  int i, j;\r\n  if( z==0 ) return -1;\r\n  quote = z[0];\r\n  switch( quote ){\r\n    case '\\'':  break;\r\n    case '\"':   break;\r\n    case '`':   break;                /* For MySQL compatibility */\r\n    case '[':   quote = ']';  break;  /* For MS SqlServer compatibility */\r\n    default:    return -1;\r\n  }\r\n  for(i=1, j=0; ALWAYS(z[i]); i++){\r\n    if( z[i]==quote ){\r\n      if( z[i+1]==quote ){\r\n        z[j++] = quote;\r\n        i++;\r\n      }else{\r\n        break;\r\n      }\r\n    }else{\r\n      z[j++] = z[i];\r\n    }\r\n  }\r\n  z[j] = 0;\r\n  return j;\r\n}\r\n\r\n/* Convenient short-hand */\r\n#define UpperToLower sqlite3UpperToLower\r\n\r\n/*\r\n** Some systems have stricmp().  Others have strcasecmp().  Because\r\n** there is no consistency, we will define our own.\r\n**\r\n** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and\r\n** sqlite3_strnicmp() APIs allow applications and extensions to compare\r\n** the contents of two buffers containing UTF-8 strings in a\r\n** case-independent fashion, using the same definition of \"case\r\n** independence\" that SQLite uses internally when comparing identifiers.\r\n*/\r\nSQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){\r\n  register unsigned char *a, *b;\r\n  a = (unsigned char *)zLeft;\r\n  b = (unsigned char *)zRight;\r\n  while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }\r\n  return UpperToLower[*a] - UpperToLower[*b];\r\n}\r\nSQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){\r\n  register unsigned char *a, *b;\r\n  a = (unsigned char *)zLeft;\r\n  b = (unsigned char *)zRight;\r\n  while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }\r\n  return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];\r\n}\r\n\r\n/*\r\n** The string z[] is an text representation of a real number.\r\n** Convert this string to a double and write it into *pResult.\r\n**\r\n** The string z[] is length bytes in length (bytes, not characters) and\r\n** uses the encoding enc.  The string is not necessarily zero-terminated.\r\n**\r\n** Return TRUE if the result is a valid real number (or integer) and FALSE\r\n** if the string is empty or contains extraneous text.  Valid numbers\r\n** are in one of these formats:\r\n**\r\n**    [+-]digits[E[+-]digits]\r\n**    [+-]digits.[digits][E[+-]digits]\r\n**    [+-].digits[E[+-]digits]\r\n**\r\n** Leading and trailing whitespace is ignored for the purpose of determining\r\n** validity.\r\n**\r\n** If some prefix of the input string is a valid number, this routine\r\n** returns FALSE but it still converts the prefix and writes the result\r\n** into *pResult.\r\n*/\r\nSQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n  int incr = (enc==SQLITE_UTF8?1:2);\r\n  const char *zEnd = z + length;\r\n  /* sign * significand * (10 ^ (esign * exponent)) */\r\n  int sign = 1;    /* sign of significand */\r\n  i64 s = 0;       /* significand */\r\n  int d = 0;       /* adjust exponent for shifting decimal point */\r\n  int esign = 1;   /* sign of exponent */\r\n  int e = 0;       /* exponent */\r\n  int eValid = 1;  /* True exponent is either not used or is well-formed */\r\n  double result;\r\n  int nDigits = 0;\r\n\r\n  *pResult = 0.0;   /* Default return value, in case of an error */\r\n\r\n  if( enc==SQLITE_UTF16BE ) z++;\r\n\r\n  /* skip leading spaces */\r\n  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;\r\n  if( z>=zEnd ) return 0;\r\n\r\n  /* get sign of significand */\r\n  if( *z=='-' ){\r\n    sign = -1;\r\n    z+=incr;\r\n  }else if( *z=='+' ){\r\n    z+=incr;\r\n  }\r\n\r\n  /* skip leading zeroes */\r\n  while( z<zEnd && z[0]=='0' ) z+=incr, nDigits++;\r\n\r\n  /* copy max significant digits to significand */\r\n  while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){\r\n    s = s*10 + (*z - '0');\r\n    z+=incr, nDigits++;\r\n  }\r\n\r\n  /* skip non-significant significand digits\r\n  ** (increase exponent by d to shift decimal left) */\r\n  while( z<zEnd && sqlite3Isdigit(*z) ) z+=incr, nDigits++, d++;\r\n  if( z>=zEnd ) goto do_atof_calc;\r\n\r\n  /* if decimal point is present */\r\n  if( *z=='.' ){\r\n    z+=incr;\r\n    /* copy digits from after decimal to significand\r\n    ** (decrease exponent by d to shift decimal right) */\r\n    while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){\r\n      s = s*10 + (*z - '0');\r\n      z+=incr, nDigits++, d--;\r\n    }\r\n    /* skip non-significant digits */\r\n    while( z<zEnd && sqlite3Isdigit(*z) ) z+=incr, nDigits++;\r\n  }\r\n  if( z>=zEnd ) goto do_atof_calc;\r\n\r\n  /* if exponent is present */\r\n  if( *z=='e' || *z=='E' ){\r\n    z+=incr;\r\n    eValid = 0;\r\n    if( z>=zEnd ) goto do_atof_calc;\r\n    /* get sign of exponent */\r\n    if( *z=='-' ){\r\n      esign = -1;\r\n      z+=incr;\r\n    }else if( *z=='+' ){\r\n      z+=incr;\r\n    }\r\n    /* copy digits to exponent */\r\n    while( z<zEnd && sqlite3Isdigit(*z) ){\r\n      e = e<10000 ? (e*10 + (*z - '0')) : 10000;\r\n      z+=incr;\r\n      eValid = 1;\r\n    }\r\n  }\r\n\r\n  /* skip trailing spaces */\r\n  if( nDigits && eValid ){\r\n    while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;\r\n  }\r\n\r\ndo_atof_calc:\r\n  /* adjust exponent by d, and update sign */\r\n  e = (e*esign) + d;\r\n  if( e<0 ) {\r\n    esign = -1;\r\n    e *= -1;\r\n  } else {\r\n    esign = 1;\r\n  }\r\n\r\n  /* if 0 significand */\r\n  if( !s ) {\r\n    /* In the IEEE 754 standard, zero is signed.\r\n    ** Add the sign if we've seen at least one digit */\r\n    result = (sign<0 && nDigits) ? -(double)0 : (double)0;\r\n  } else {\r\n    /* attempt to reduce exponent */\r\n    if( esign>0 ){\r\n      while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10;\r\n    }else{\r\n      while( !(s%10) && e>0 ) e--,s/=10;\r\n    }\r\n\r\n    /* adjust the sign of significand */\r\n    s = sign<0 ? -s : s;\r\n\r\n    /* if exponent, scale significand as appropriate\r\n    ** and store in result. */\r\n    if( e ){\r\n      double scale = 1.0;\r\n      /* attempt to handle extremely small/large numbers better */\r\n      if( e>307 && e<342 ){\r\n        while( e%308 ) { scale *= 1.0e+1; e -= 1; }\r\n        if( esign<0 ){\r\n          result = s / scale;\r\n          result /= 1.0e+308;\r\n        }else{\r\n          result = s * scale;\r\n          result *= 1.0e+308;\r\n        }\r\n      }else if( e>=342 ){\r\n        if( esign<0 ){\r\n          result = 0.0*s;\r\n        }else{\r\n          result = 1e308*1e308*s;  /* Infinity */\r\n        }\r\n      }else{\r\n        /* 1.0e+22 is the largest power of 10 than can be \r\n        ** represented exactly. */\r\n        while( e%22 ) { scale *= 1.0e+1; e -= 1; }\r\n        while( e>0 ) { scale *= 1.0e+22; e -= 22; }\r\n        if( esign<0 ){\r\n          result = s / scale;\r\n        }else{\r\n          result = s * scale;\r\n        }\r\n      }\r\n    } else {\r\n      result = (double)s;\r\n    }\r\n  }\r\n\r\n  /* store the result */\r\n  *pResult = result;\r\n\r\n  /* return true if number and no extra non-whitespace chracters after */\r\n  return z>=zEnd && nDigits>0 && eValid;\r\n#else\r\n  return !sqlite3Atoi64(z, pResult, length, enc);\r\n#endif /* SQLITE_OMIT_FLOATING_POINT */\r\n}\r\n\r\n/*\r\n** Compare the 19-character string zNum against the text representation\r\n** value 2^63:  9223372036854775808.  Return negative, zero, or positive\r\n** if zNum is less than, equal to, or greater than the string.\r\n** Note that zNum must contain exactly 19 characters.\r\n**\r\n** Unlike memcmp() this routine is guaranteed to return the difference\r\n** in the values of the last digit if the only difference is in the\r\n** last digit.  So, for example,\r\n**\r\n**      compare2pow63(\"9223372036854775800\", 1)\r\n**\r\n** will return -8.\r\n*/\r\nstatic int compare2pow63(const char *zNum, int incr){\r\n  int c = 0;\r\n  int i;\r\n                    /* 012345678901234567 */\r\n  const char *pow63 = \"922337203685477580\";\r\n  for(i=0; c==0 && i<18; i++){\r\n    c = (zNum[i*incr]-pow63[i])*10;\r\n  }\r\n  if( c==0 ){\r\n    c = zNum[18*incr] - '8';\r\n    testcase( c==(-1) );\r\n    testcase( c==0 );\r\n    testcase( c==(+1) );\r\n  }\r\n  return c;\r\n}\r\n\r\n\r\n/*\r\n** Convert zNum to a 64-bit signed integer.\r\n**\r\n** If the zNum value is representable as a 64-bit twos-complement \r\n** integer, then write that value into *pNum and return 0.\r\n**\r\n** If zNum is exactly 9223372036854665808, return 2.  This special\r\n** case is broken out because while 9223372036854665808 cannot be a \r\n** signed 64-bit integer, its negative -9223372036854665808 can be.\r\n**\r\n** If zNum is too big for a 64-bit integer and is not\r\n** 9223372036854665808 then return 1.\r\n**\r\n** length is the number of bytes in the string (bytes, not characters).\r\n** The string is not necessarily zero-terminated.  The encoding is\r\n** given by enc.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){\r\n  int incr = (enc==SQLITE_UTF8?1:2);\r\n  u64 u = 0;\r\n  int neg = 0; /* assume positive */\r\n  int i;\r\n  int c = 0;\r\n  const char *zStart;\r\n  const char *zEnd = zNum + length;\r\n  if( enc==SQLITE_UTF16BE ) zNum++;\r\n  while( zNum<zEnd && sqlite3Isspace(*zNum) ) zNum+=incr;\r\n  if( zNum<zEnd ){\r\n    if( *zNum=='-' ){\r\n      neg = 1;\r\n      zNum+=incr;\r\n    }else if( *zNum=='+' ){\r\n      zNum+=incr;\r\n    }\r\n  }\r\n  zStart = zNum;\r\n  while( zNum<zEnd && zNum[0]=='0' ){ zNum+=incr; } /* Skip leading zeros. */\r\n  for(i=0; &zNum[i]<zEnd && (c=zNum[i])>='0' && c<='9'; i+=incr){\r\n    u = u*10 + c - '0';\r\n  }\r\n  if( u>LARGEST_INT64 ){\r\n    *pNum = SMALLEST_INT64;\r\n  }else if( neg ){\r\n    *pNum = -(i64)u;\r\n  }else{\r\n    *pNum = (i64)u;\r\n  }\r\n  testcase( i==18 );\r\n  testcase( i==19 );\r\n  testcase( i==20 );\r\n  if( (c!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19*incr ){\r\n    /* zNum is empty or contains non-numeric text or is longer\r\n    ** than 19 digits (thus guaranteeing that it is too large) */\r\n    return 1;\r\n  }else if( i<19*incr ){\r\n    /* Less than 19 digits, so we know that it fits in 64 bits */\r\n    assert( u<=LARGEST_INT64 );\r\n    return 0;\r\n  }else{\r\n    /* zNum is a 19-digit numbers.  Compare it against 9223372036854775808. */\r\n    c = compare2pow63(zNum, incr);\r\n    if( c<0 ){\r\n      /* zNum is less than 9223372036854775808 so it fits */\r\n      assert( u<=LARGEST_INT64 );\r\n      return 0;\r\n    }else if( c>0 ){\r\n      /* zNum is greater than 9223372036854775808 so it overflows */\r\n      return 1;\r\n    }else{\r\n      /* zNum is exactly 9223372036854775808.  Fits if negative.  The\r\n      ** special case 2 overflow if positive */\r\n      assert( u-1==LARGEST_INT64 );\r\n      assert( (*pNum)==SMALLEST_INT64 );\r\n      return neg ? 0 : 2;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** If zNum represents an integer that will fit in 32-bits, then set\r\n** *pValue to that integer and return true.  Otherwise return false.\r\n**\r\n** Any non-numeric characters that following zNum are ignored.\r\n** This is different from sqlite3Atoi64() which requires the\r\n** input number to be zero-terminated.\r\n*/\r\nSQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){\r\n  sqlite_int64 v = 0;\r\n  int i, c;\r\n  int neg = 0;\r\n  if( zNum[0]=='-' ){\r\n    neg = 1;\r\n    zNum++;\r\n  }else if( zNum[0]=='+' ){\r\n    zNum++;\r\n  }\r\n  while( zNum[0]=='0' ) zNum++;\r\n  for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){\r\n    v = v*10 + c;\r\n  }\r\n\r\n  /* The longest decimal representation of a 32 bit integer is 10 digits:\r\n  **\r\n  **             1234567890\r\n  **     2^31 -> 2147483648\r\n  */\r\n  testcase( i==10 );\r\n  if( i>10 ){\r\n    return 0;\r\n  }\r\n  testcase( v-neg==2147483647 );\r\n  if( v-neg>2147483647 ){\r\n    return 0;\r\n  }\r\n  if( neg ){\r\n    v = -v;\r\n  }\r\n  *pValue = (int)v;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Return a 32-bit integer value extracted from a string.  If the\r\n** string is not an integer, just return 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Atoi(const char *z){\r\n  int x = 0;\r\n  if( z ) sqlite3GetInt32(z, &x);\r\n  return x;\r\n}\r\n\r\n/*\r\n** The variable-length integer encoding is as follows:\r\n**\r\n** KEY:\r\n**         A = 0xxxxxxx    7 bits of data and one flag bit\r\n**         B = 1xxxxxxx    7 bits of data and one flag bit\r\n**         C = xxxxxxxx    8 bits of data\r\n**\r\n**  7 bits - A\r\n** 14 bits - BA\r\n** 21 bits - BBA\r\n** 28 bits - BBBA\r\n** 35 bits - BBBBA\r\n** 42 bits - BBBBBA\r\n** 49 bits - BBBBBBA\r\n** 56 bits - BBBBBBBA\r\n** 64 bits - BBBBBBBBC\r\n*/\r\n\r\n/*\r\n** Write a 64-bit variable-length integer to memory starting at p[0].\r\n** The length of data write will be between 1 and 9 bytes.  The number\r\n** of bytes written is returned.\r\n**\r\n** A variable-length integer consists of the lower 7 bits of each byte\r\n** for all bytes that have the 8th bit set and one byte with the 8th\r\n** bit clear.  Except, if we get to the 9th byte, it stores the full\r\n** 8 bits and is the last byte.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){\r\n  int i, j, n;\r\n  u8 buf[10];\r\n  if( v & (((u64)0xff000000)<<32) ){\r\n    p[8] = (u8)v;\r\n    v >>= 8;\r\n    for(i=7; i>=0; i--){\r\n      p[i] = (u8)((v & 0x7f) | 0x80);\r\n      v >>= 7;\r\n    }\r\n    return 9;\r\n  }    \r\n  n = 0;\r\n  do{\r\n    buf[n++] = (u8)((v & 0x7f) | 0x80);\r\n    v >>= 7;\r\n  }while( v!=0 );\r\n  buf[0] &= 0x7f;\r\n  assert( n<=9 );\r\n  for(i=0, j=n-1; j>=0; j--, i++){\r\n    p[i] = buf[j];\r\n  }\r\n  return n;\r\n}\r\n\r\n/*\r\n** This routine is a faster version of sqlite3PutVarint() that only\r\n** works for 32-bit positive integers and which is optimized for\r\n** the common case of small integers.  A MACRO version, putVarint32,\r\n** is provided which inlines the single-byte case.  All code should use\r\n** the MACRO version as this function assumes the single-byte case has\r\n** already been handled.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PutVarint32(unsigned char *p, u32 v){\r\n#ifndef putVarint32\r\n  if( (v & ~0x7f)==0 ){\r\n    p[0] = v;\r\n    return 1;\r\n  }\r\n#endif\r\n  if( (v & ~0x3fff)==0 ){\r\n    p[0] = (u8)((v>>7) | 0x80);\r\n    p[1] = (u8)(v & 0x7f);\r\n    return 2;\r\n  }\r\n  return sqlite3PutVarint(p, v);\r\n}\r\n\r\n/*\r\n** Bitmasks used by sqlite3GetVarint().  These precomputed constants\r\n** are defined here rather than simply putting the constant expressions\r\n** inline in order to work around bugs in the RVT compiler.\r\n**\r\n** SLOT_2_0     A mask for  (0x7f<<14) | 0x7f\r\n**\r\n** SLOT_4_2_0   A mask for  (0x7f<<28) | SLOT_2_0\r\n*/\r\n#define SLOT_2_0     0x001fc07f\r\n#define SLOT_4_2_0   0xf01fc07f\r\n\r\n\r\n/*\r\n** Read a 64-bit variable-length integer from memory starting at p[0].\r\n** Return the number of bytes read.  The value is stored in *v.\r\n*/\r\nSQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){\r\n  u32 a,b,s;\r\n\r\n  a = *p;\r\n  /* a: p0 (unmasked) */\r\n  if (!(a&0x80))\r\n  {\r\n    *v = a;\r\n    return 1;\r\n  }\r\n\r\n  p++;\r\n  b = *p;\r\n  /* b: p1 (unmasked) */\r\n  if (!(b&0x80))\r\n  {\r\n    a &= 0x7f;\r\n    a = a<<7;\r\n    a |= b;\r\n    *v = a;\r\n    return 2;\r\n  }\r\n\r\n  /* Verify that constants are precomputed correctly */\r\n  assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );\r\n  assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );\r\n\r\n  p++;\r\n  a = a<<14;\r\n  a |= *p;\r\n  /* a: p0<<14 | p2 (unmasked) */\r\n  if (!(a&0x80))\r\n  {\r\n    a &= SLOT_2_0;\r\n    b &= 0x7f;\r\n    b = b<<7;\r\n    a |= b;\r\n    *v = a;\r\n    return 3;\r\n  }\r\n\r\n  /* CSE1 from below */\r\n  a &= SLOT_2_0;\r\n  p++;\r\n  b = b<<14;\r\n  b |= *p;\r\n  /* b: p1<<14 | p3 (unmasked) */\r\n  if (!(b&0x80))\r\n  {\r\n    b &= SLOT_2_0;\r\n    /* moved CSE1 up */\r\n    /* a &= (0x7f<<14)|(0x7f); */\r\n    a = a<<7;\r\n    a |= b;\r\n    *v = a;\r\n    return 4;\r\n  }\r\n\r\n  /* a: p0<<14 | p2 (masked) */\r\n  /* b: p1<<14 | p3 (unmasked) */\r\n  /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\r\n  /* moved CSE1 up */\r\n  /* a &= (0x7f<<14)|(0x7f); */\r\n  b &= SLOT_2_0;\r\n  s = a;\r\n  /* s: p0<<14 | p2 (masked) */\r\n\r\n  p++;\r\n  a = a<<14;\r\n  a |= *p;\r\n  /* a: p0<<28 | p2<<14 | p4 (unmasked) */\r\n  if (!(a&0x80))\r\n  {\r\n    /* we can skip these cause they were (effectively) done above in calc'ing s */\r\n    /* a &= (0x7f<<28)|(0x7f<<14)|(0x7f); */\r\n    /* b &= (0x7f<<14)|(0x7f); */\r\n    b = b<<7;\r\n    a |= b;\r\n    s = s>>18;\r\n    *v = ((u64)s)<<32 | a;\r\n    return 5;\r\n  }\r\n\r\n  /* 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\r\n  s = s<<7;\r\n  s |= b;\r\n  /* s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\r\n\r\n  p++;\r\n  b = b<<14;\r\n  b |= *p;\r\n  /* b: p1<<28 | p3<<14 | p5 (unmasked) */\r\n  if (!(b&0x80))\r\n  {\r\n    /* we can skip this cause it was (effectively) done above in calc'ing s */\r\n    /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */\r\n    a &= SLOT_2_0;\r\n    a = a<<7;\r\n    a |= b;\r\n    s = s>>18;\r\n    *v = ((u64)s)<<32 | a;\r\n    return 6;\r\n  }\r\n\r\n  p++;\r\n  a = a<<14;\r\n  a |= *p;\r\n  /* a: p2<<28 | p4<<14 | p6 (unmasked) */\r\n  if (!(a&0x80))\r\n  {\r\n    a &= SLOT_4_2_0;\r\n    b &= SLOT_2_0;\r\n    b = b<<7;\r\n    a |= b;\r\n    s = s>>11;\r\n    *v = ((u64)s)<<32 | a;\r\n    return 7;\r\n  }\r\n\r\n  /* CSE2 from below */\r\n  a &= SLOT_2_0;\r\n  p++;\r\n  b = b<<14;\r\n  b |= *p;\r\n  /* b: p3<<28 | p5<<14 | p7 (unmasked) */\r\n  if (!(b&0x80))\r\n  {\r\n    b &= SLOT_4_2_0;\r\n    /* moved CSE2 up */\r\n    /* a &= (0x7f<<14)|(0x7f); */\r\n    a = a<<7;\r\n    a |= b;\r\n    s = s>>4;\r\n    *v = ((u64)s)<<32 | a;\r\n    return 8;\r\n  }\r\n\r\n  p++;\r\n  a = a<<15;\r\n  a |= *p;\r\n  /* a: p4<<29 | p6<<15 | p8 (unmasked) */\r\n\r\n  /* moved CSE2 up */\r\n  /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */\r\n  b &= SLOT_2_0;\r\n  b = b<<8;\r\n  a |= b;\r\n\r\n  s = s<<4;\r\n  b = p[-4];\r\n  b &= 0x7f;\r\n  b = b>>3;\r\n  s |= b;\r\n\r\n  *v = ((u64)s)<<32 | a;\r\n\r\n  return 9;\r\n}\r\n\r\n/*\r\n** Read a 32-bit variable-length integer from memory starting at p[0].\r\n** Return the number of bytes read.  The value is stored in *v.\r\n**\r\n** If the varint stored in p[0] is larger than can fit in a 32-bit unsigned\r\n** integer, then set *v to 0xffffffff.\r\n**\r\n** A MACRO version, getVarint32, is provided which inlines the \r\n** single-byte case.  All code should use the MACRO version as \r\n** this function assumes the single-byte case has already been handled.\r\n*/\r\nSQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){\r\n  u32 a,b;\r\n\r\n  /* The 1-byte case.  Overwhelmingly the most common.  Handled inline\r\n  ** by the getVarin32() macro */\r\n  a = *p;\r\n  /* a: p0 (unmasked) */\r\n#ifndef getVarint32\r\n  if (!(a&0x80))\r\n  {\r\n    /* Values between 0 and 127 */\r\n    *v = a;\r\n    return 1;\r\n  }\r\n#endif\r\n\r\n  /* The 2-byte case */\r\n  p++;\r\n  b = *p;\r\n  /* b: p1 (unmasked) */\r\n  if (!(b&0x80))\r\n  {\r\n    /* Values between 128 and 16383 */\r\n    a &= 0x7f;\r\n    a = a<<7;\r\n    *v = a | b;\r\n    return 2;\r\n  }\r\n\r\n  /* The 3-byte case */\r\n  p++;\r\n  a = a<<14;\r\n  a |= *p;\r\n  /* a: p0<<14 | p2 (unmasked) */\r\n  if (!(a&0x80))\r\n  {\r\n    /* Values between 16384 and 2097151 */\r\n    a &= (0x7f<<14)|(0x7f);\r\n    b &= 0x7f;\r\n    b = b<<7;\r\n    *v = a | b;\r\n    return 3;\r\n  }\r\n\r\n  /* A 32-bit varint is used to store size information in btrees.\r\n  ** Objects are rarely larger than 2MiB limit of a 3-byte varint.\r\n  ** A 3-byte varint is sufficient, for example, to record the size\r\n  ** of a 1048569-byte BLOB or string.\r\n  **\r\n  ** We only unroll the first 1-, 2-, and 3- byte cases.  The very\r\n  ** rare larger cases can be handled by the slower 64-bit varint\r\n  ** routine.\r\n  */\r\n#if 1\r\n  {\r\n    u64 v64;\r\n    u8 n;\r\n\r\n    p -= 2;\r\n    n = sqlite3GetVarint(p, &v64);\r\n    assert( n>3 && n<=9 );\r\n    if( (v64 & SQLITE_MAX_U32)!=v64 ){\r\n      *v = 0xffffffff;\r\n    }else{\r\n      *v = (u32)v64;\r\n    }\r\n    return n;\r\n  }\r\n\r\n#else\r\n  /* For following code (kept for historical record only) shows an\r\n  ** unrolling for the 3- and 4-byte varint cases.  This code is\r\n  ** slightly faster, but it is also larger and much harder to test.\r\n  */\r\n  p++;\r\n  b = b<<14;\r\n  b |= *p;\r\n  /* b: p1<<14 | p3 (unmasked) */\r\n  if (!(b&0x80))\r\n  {\r\n    /* Values between 2097152 and 268435455 */\r\n    b &= (0x7f<<14)|(0x7f);\r\n    a &= (0x7f<<14)|(0x7f);\r\n    a = a<<7;\r\n    *v = a | b;\r\n    return 4;\r\n  }\r\n\r\n  p++;\r\n  a = a<<14;\r\n  a |= *p;\r\n  /* a: p0<<28 | p2<<14 | p4 (unmasked) */\r\n  if (!(a&0x80))\r\n  {\r\n    /* Values  between 268435456 and 34359738367 */\r\n    a &= SLOT_4_2_0;\r\n    b &= SLOT_4_2_0;\r\n    b = b<<7;\r\n    *v = a | b;\r\n    return 5;\r\n  }\r\n\r\n  /* We can only reach this point when reading a corrupt database\r\n  ** file.  In that case we are not in any hurry.  Use the (relatively\r\n  ** slow) general-purpose sqlite3GetVarint() routine to extract the\r\n  ** value. */\r\n  {\r\n    u64 v64;\r\n    u8 n;\r\n\r\n    p -= 4;\r\n    n = sqlite3GetVarint(p, &v64);\r\n    assert( n>5 && n<=9 );\r\n    *v = (u32)v64;\r\n    return n;\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Return the number of bytes that will be needed to store the given\r\n** 64-bit integer.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VarintLen(u64 v){\r\n  int i = 0;\r\n  do{\r\n    i++;\r\n    v >>= 7;\r\n  }while( v!=0 && ALWAYS(i<9) );\r\n  return i;\r\n}\r\n\r\n\r\n/*\r\n** Read or write a four-byte big-endian integer value.\r\n*/\r\nSQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){\r\n  return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];\r\n}\r\nSQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){\r\n  p[0] = (u8)(v>>24);\r\n  p[1] = (u8)(v>>16);\r\n  p[2] = (u8)(v>>8);\r\n  p[3] = (u8)v;\r\n}\r\n\r\n\r\n\r\n/*\r\n** Translate a single byte of Hex into an integer.\r\n** This routine only works if h really is a valid hexadecimal\r\n** character:  0..9a..fA..F\r\n*/\r\nSQLITE_PRIVATE u8 sqlite3HexToInt(int h){\r\n  assert( (h>='0' && h<='9') ||  (h>='a' && h<='f') ||  (h>='A' && h<='F') );\r\n#ifdef SQLITE_ASCII\r\n  h += 9*(1&(h>>6));\r\n#endif\r\n#ifdef SQLITE_EBCDIC\r\n  h += 9*(1&~(h>>4));\r\n#endif\r\n  return (u8)(h & 0xf);\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)\r\n/*\r\n** Convert a BLOB literal of the form \"x'hhhhhh'\" into its binary\r\n** value.  Return a pointer to its binary value.  Space to hold the\r\n** binary value has been obtained from malloc and must be freed by\r\n** the calling routine.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){\r\n  char *zBlob;\r\n  int i;\r\n\r\n  zBlob = (char *)sqlite3DbMallocRaw(db, n/2 + 1);\r\n  n--;\r\n  if( zBlob ){\r\n    for(i=0; i<n; i+=2){\r\n      zBlob[i/2] = (sqlite3HexToInt(z[i])<<4) | sqlite3HexToInt(z[i+1]);\r\n    }\r\n    zBlob[i/2] = 0;\r\n  }\r\n  return zBlob;\r\n}\r\n#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */\r\n\r\n/*\r\n** Log an error that is an API call on a connection pointer that should\r\n** not have been used.  The \"type\" of connection pointer is given as the\r\n** argument.  The zType is a word like \"NULL\" or \"closed\" or \"invalid\".\r\n*/\r\nstatic void logBadConnection(const char *zType){\r\n  sqlite3_log(SQLITE_MISUSE, \r\n     \"API call with %s database connection pointer\",\r\n     zType\r\n  );\r\n}\r\n\r\n/*\r\n** Check to make sure we have a valid db pointer.  This test is not\r\n** foolproof but it does provide some measure of protection against\r\n** misuse of the interface such as passing in db pointers that are\r\n** NULL or which have been previously closed.  If this routine returns\r\n** 1 it means that the db pointer is valid and 0 if it should not be\r\n** dereferenced for any reason.  The calling function should invoke\r\n** SQLITE_MISUSE immediately.\r\n**\r\n** sqlite3SafetyCheckOk() requires that the db pointer be valid for\r\n** use.  sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to\r\n** open properly and is not fit for general use but which can be\r\n** used as an argument to sqlite3_errmsg() or sqlite3_close().\r\n*/\r\nSQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3 *db){\r\n  u32 magic;\r\n  if( db==0 ){\r\n    logBadConnection(\"NULL\");\r\n    return 0;\r\n  }\r\n  magic = db->magic;\r\n  if( magic!=SQLITE_MAGIC_OPEN ){\r\n    if( sqlite3SafetyCheckSickOrOk(db) ){\r\n      testcase( sqlite3GlobalConfig.xLog!=0 );\r\n      logBadConnection(\"unopened\");\r\n    }\r\n    return 0;\r\n  }else{\r\n    return 1;\r\n  }\r\n}\r\nSQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){\r\n  u32 magic;\r\n  magic = db->magic;\r\n  if( magic!=SQLITE_MAGIC_SICK &&\r\n      magic!=SQLITE_MAGIC_OPEN &&\r\n      magic!=SQLITE_MAGIC_BUSY ){\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    logBadConnection(\"invalid\");\r\n    return 0;\r\n  }else{\r\n    return 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Attempt to add, substract, or multiply the 64-bit signed value iB against\r\n** the other 64-bit signed integer at *pA and store the result in *pA.\r\n** Return 0 on success.  Or if the operation would have resulted in an\r\n** overflow, leave *pA unchanged and return 1.\r\n*/\r\nSQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){\r\n  i64 iA = *pA;\r\n  testcase( iA==0 ); testcase( iA==1 );\r\n  testcase( iB==-1 ); testcase( iB==0 );\r\n  if( iB>=0 ){\r\n    testcase( iA>0 && LARGEST_INT64 - iA == iB );\r\n    testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 );\r\n    if( iA>0 && LARGEST_INT64 - iA < iB ) return 1;\r\n    *pA += iB;\r\n  }else{\r\n    testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 );\r\n    testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 );\r\n    if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1;\r\n    *pA += iB;\r\n  }\r\n  return 0; \r\n}\r\nSQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){\r\n  testcase( iB==SMALLEST_INT64+1 );\r\n  if( iB==SMALLEST_INT64 ){\r\n    testcase( (*pA)==(-1) ); testcase( (*pA)==0 );\r\n    if( (*pA)>=0 ) return 1;\r\n    *pA -= iB;\r\n    return 0;\r\n  }else{\r\n    return sqlite3AddInt64(pA, -iB);\r\n  }\r\n}\r\n#define TWOPOWER32 (((i64)1)<<32)\r\n#define TWOPOWER31 (((i64)1)<<31)\r\nSQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){\r\n  i64 iA = *pA;\r\n  i64 iA1, iA0, iB1, iB0, r;\r\n\r\n  iA1 = iA/TWOPOWER32;\r\n  iA0 = iA % TWOPOWER32;\r\n  iB1 = iB/TWOPOWER32;\r\n  iB0 = iB % TWOPOWER32;\r\n  if( iA1*iB1 != 0 ) return 1;\r\n  assert( iA1*iB0==0 || iA0*iB1==0 );\r\n  r = iA1*iB0 + iA0*iB1;\r\n  testcase( r==(-TWOPOWER31)-1 );\r\n  testcase( r==(-TWOPOWER31) );\r\n  testcase( r==TWOPOWER31 );\r\n  testcase( r==TWOPOWER31-1 );\r\n  if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1;\r\n  r *= TWOPOWER32;\r\n  if( sqlite3AddInt64(&r, iA0*iB0) ) return 1;\r\n  *pA = r;\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Compute the absolute value of a 32-bit signed integer, of possible.  Or \r\n** if the integer has a value of -2147483648, return +2147483647\r\n*/\r\nSQLITE_PRIVATE int sqlite3AbsInt32(int x){\r\n  if( x>=0 ) return x;\r\n  if( x==(int)0x80000000 ) return 0x7fffffff;\r\n  return -x;\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_8_3_NAMES\r\n/*\r\n** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database\r\n** filename in zBaseFilename is a URI with the \"8_3_names=1\" parameter and\r\n** if filename in z[] has a suffix (a.k.a. \"extension\") that is longer than\r\n** three characters, then shorten the suffix on z[] to be the last three\r\n** characters of the original suffix.\r\n**\r\n** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always\r\n** do the suffix shortening regardless of URI parameter.\r\n**\r\n** Examples:\r\n**\r\n**     test.db-journal    =>   test.nal\r\n**     test.db-wal        =>   test.wal\r\n**     test.db-shm        =>   test.shm\r\n**     test.db-mj7f3319fa =>   test.9fa\r\n*/\r\nSQLITE_PRIVATE void sqlite3FileSuffix3(const char *zBaseFilename, char *z){\r\n#if SQLITE_ENABLE_8_3_NAMES<2\r\n  if( sqlite3_uri_boolean(zBaseFilename, \"8_3_names\", 0) )\r\n#endif\r\n  {\r\n    int i, sz;\r\n    sz = sqlite3Strlen30(z);\r\n    for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}\r\n    if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4);\r\n  }\r\n}\r\n#endif\r\n\r\n/************** End of util.c ************************************************/\r\n/************** Begin file hash.c ********************************************/\r\n/*\r\n** 2001 September 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This is the implementation of generic hash-tables\r\n** used in SQLite.\r\n*/\r\n/* #include <assert.h> */\r\n\r\n/* Turn bulk memory into a hash table object by initializing the\r\n** fields of the Hash structure.\r\n**\r\n** \"pNew\" is a pointer to the hash table that is to be initialized.\r\n*/\r\nSQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){\r\n  assert( pNew!=0 );\r\n  pNew->first = 0;\r\n  pNew->count = 0;\r\n  pNew->htsize = 0;\r\n  pNew->ht = 0;\r\n}\r\n\r\n/* Remove all entries from a hash table.  Reclaim all memory.\r\n** Call this routine to delete a hash table or to reset a hash table\r\n** to the empty state.\r\n*/\r\nSQLITE_PRIVATE void sqlite3HashClear(Hash *pH){\r\n  HashElem *elem;         /* For looping over all elements of the table */\r\n\r\n  assert( pH!=0 );\r\n  elem = pH->first;\r\n  pH->first = 0;\r\n  sqlite3_free(pH->ht);\r\n  pH->ht = 0;\r\n  pH->htsize = 0;\r\n  while( elem ){\r\n    HashElem *next_elem = elem->next;\r\n    sqlite3_free(elem);\r\n    elem = next_elem;\r\n  }\r\n  pH->count = 0;\r\n}\r\n\r\n/*\r\n** The hashing function.\r\n*/\r\nstatic unsigned int strHash(const char *z, int nKey){\r\n  int h = 0;\r\n  assert( nKey>=0 );\r\n  while( nKey > 0  ){\r\n    h = (h<<3) ^ h ^ sqlite3UpperToLower[(unsigned char)*z++];\r\n    nKey--;\r\n  }\r\n  return h;\r\n}\r\n\r\n\r\n/* Link pNew element into the hash table pH.  If pEntry!=0 then also\r\n** insert pNew into the pEntry hash bucket.\r\n*/\r\nstatic void insertElement(\r\n  Hash *pH,              /* The complete hash table */\r\n  struct _ht *pEntry,    /* The entry into which pNew is inserted */\r\n  HashElem *pNew         /* The element to be inserted */\r\n){\r\n  HashElem *pHead;       /* First element already in pEntry */\r\n  if( pEntry ){\r\n    pHead = pEntry->count ? pEntry->chain : 0;\r\n    pEntry->count++;\r\n    pEntry->chain = pNew;\r\n  }else{\r\n    pHead = 0;\r\n  }\r\n  if( pHead ){\r\n    pNew->next = pHead;\r\n    pNew->prev = pHead->prev;\r\n    if( pHead->prev ){ pHead->prev->next = pNew; }\r\n    else             { pH->first = pNew; }\r\n    pHead->prev = pNew;\r\n  }else{\r\n    pNew->next = pH->first;\r\n    if( pH->first ){ pH->first->prev = pNew; }\r\n    pNew->prev = 0;\r\n    pH->first = pNew;\r\n  }\r\n}\r\n\r\n\r\n/* Resize the hash table so that it cantains \"new_size\" buckets.\r\n**\r\n** The hash table might fail to resize if sqlite3_malloc() fails or\r\n** if the new size is the same as the prior size.\r\n** Return TRUE if the resize occurs and false if not.\r\n*/\r\nstatic int rehash(Hash *pH, unsigned int new_size){\r\n  struct _ht *new_ht;            /* The new hash table */\r\n  HashElem *elem, *next_elem;    /* For looping over existing elements */\r\n\r\n#if SQLITE_MALLOC_SOFT_LIMIT>0\r\n  if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){\r\n    new_size = SQLITE_MALLOC_SOFT_LIMIT/sizeof(struct _ht);\r\n  }\r\n  if( new_size==pH->htsize ) return 0;\r\n#endif\r\n\r\n  /* The inability to allocates space for a larger hash table is\r\n  ** a performance hit but it is not a fatal error.  So mark the\r\n  ** allocation as a benign.\r\n  */\r\n  sqlite3BeginBenignMalloc();\r\n  new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) );\r\n  sqlite3EndBenignMalloc();\r\n\r\n  if( new_ht==0 ) return 0;\r\n  sqlite3_free(pH->ht);\r\n  pH->ht = new_ht;\r\n  pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);\r\n  memset(new_ht, 0, new_size*sizeof(struct _ht));\r\n  for(elem=pH->first, pH->first=0; elem; elem = next_elem){\r\n    unsigned int h = strHash(elem->pKey, elem->nKey) % new_size;\r\n    next_elem = elem->next;\r\n    insertElement(pH, &new_ht[h], elem);\r\n  }\r\n  return 1;\r\n}\r\n\r\n/* This function (for internal use only) locates an element in an\r\n** hash table that matches the given key.  The hash for this key has\r\n** already been computed and is passed as the 4th parameter.\r\n*/\r\nstatic HashElem *findElementGivenHash(\r\n  const Hash *pH,     /* The pH to be searched */\r\n  const char *pKey,   /* The key we are searching for */\r\n  int nKey,           /* Bytes in key (not counting zero terminator) */\r\n  unsigned int h      /* The hash for this key. */\r\n){\r\n  HashElem *elem;                /* Used to loop thru the element list */\r\n  int count;                     /* Number of elements left to test */\r\n\r\n  if( pH->ht ){\r\n    struct _ht *pEntry = &pH->ht[h];\r\n    elem = pEntry->chain;\r\n    count = pEntry->count;\r\n  }else{\r\n    elem = pH->first;\r\n    count = pH->count;\r\n  }\r\n  while( count-- && ALWAYS(elem) ){\r\n    if( elem->nKey==nKey && sqlite3StrNICmp(elem->pKey,pKey,nKey)==0 ){ \r\n      return elem;\r\n    }\r\n    elem = elem->next;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* Remove a single entry from the hash table given a pointer to that\r\n** element and a hash on the element's key.\r\n*/\r\nstatic void removeElementGivenHash(\r\n  Hash *pH,         /* The pH containing \"elem\" */\r\n  HashElem* elem,   /* The element to be removed from the pH */\r\n  unsigned int h    /* Hash value for the element */\r\n){\r\n  struct _ht *pEntry;\r\n  if( elem->prev ){\r\n    elem->prev->next = elem->next; \r\n  }else{\r\n    pH->first = elem->next;\r\n  }\r\n  if( elem->next ){\r\n    elem->next->prev = elem->prev;\r\n  }\r\n  if( pH->ht ){\r\n    pEntry = &pH->ht[h];\r\n    if( pEntry->chain==elem ){\r\n      pEntry->chain = elem->next;\r\n    }\r\n    pEntry->count--;\r\n    assert( pEntry->count>=0 );\r\n  }\r\n  sqlite3_free( elem );\r\n  pH->count--;\r\n  if( pH->count<=0 ){\r\n    assert( pH->first==0 );\r\n    assert( pH->count==0 );\r\n    sqlite3HashClear(pH);\r\n  }\r\n}\r\n\r\n/* Attempt to locate an element of the hash table pH with a key\r\n** that matches pKey,nKey.  Return the data for this element if it is\r\n** found, or NULL if there is no match.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey, int nKey){\r\n  HashElem *elem;    /* The element that matches key */\r\n  unsigned int h;    /* A hash on key */\r\n\r\n  assert( pH!=0 );\r\n  assert( pKey!=0 );\r\n  assert( nKey>=0 );\r\n  if( pH->ht ){\r\n    h = strHash(pKey, nKey) % pH->htsize;\r\n  }else{\r\n    h = 0;\r\n  }\r\n  elem = findElementGivenHash(pH, pKey, nKey, h);\r\n  return elem ? elem->data : 0;\r\n}\r\n\r\n/* Insert an element into the hash table pH.  The key is pKey,nKey\r\n** and the data is \"data\".\r\n**\r\n** If no element exists with a matching key, then a new\r\n** element is created and NULL is returned.\r\n**\r\n** If another element already exists with the same key, then the\r\n** new data replaces the old data and the old data is returned.\r\n** The key is not copied in this instance.  If a malloc fails, then\r\n** the new data is returned and the hash table is unchanged.\r\n**\r\n** If the \"data\" parameter to this function is NULL, then the\r\n** element corresponding to \"key\" is removed from the hash table.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, void *data){\r\n  unsigned int h;       /* the hash of the key modulo hash table size */\r\n  HashElem *elem;       /* Used to loop thru the element list */\r\n  HashElem *new_elem;   /* New element added to the pH */\r\n\r\n  assert( pH!=0 );\r\n  assert( pKey!=0 );\r\n  assert( nKey>=0 );\r\n  if( pH->htsize ){\r\n    h = strHash(pKey, nKey) % pH->htsize;\r\n  }else{\r\n    h = 0;\r\n  }\r\n  elem = findElementGivenHash(pH,pKey,nKey,h);\r\n  if( elem ){\r\n    void *old_data = elem->data;\r\n    if( data==0 ){\r\n      removeElementGivenHash(pH,elem,h);\r\n    }else{\r\n      elem->data = data;\r\n      elem->pKey = pKey;\r\n      assert(nKey==elem->nKey);\r\n    }\r\n    return old_data;\r\n  }\r\n  if( data==0 ) return 0;\r\n  new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) );\r\n  if( new_elem==0 ) return data;\r\n  new_elem->pKey = pKey;\r\n  new_elem->nKey = nKey;\r\n  new_elem->data = data;\r\n  pH->count++;\r\n  if( pH->count>=10 && pH->count > 2*pH->htsize ){\r\n    if( rehash(pH, pH->count*2) ){\r\n      assert( pH->htsize>0 );\r\n      h = strHash(pKey, nKey) % pH->htsize;\r\n    }\r\n  }\r\n  if( pH->ht ){\r\n    insertElement(pH, &pH->ht[h], new_elem);\r\n  }else{\r\n    insertElement(pH, 0, new_elem);\r\n  }\r\n  return 0;\r\n}\r\n\r\n/************** End of hash.c ************************************************/\r\n/************** Begin file opcodes.c *****************************************/\r\n/* Automatically generated.  Do not edit */\r\n/* See the mkopcodec.awk script for details. */\r\n#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)\r\nSQLITE_PRIVATE const char *sqlite3OpcodeName(int i){\r\n static const char *const azName[] = { \"?\",\r\n     /*   1 */ \"Goto\",\r\n     /*   2 */ \"Gosub\",\r\n     /*   3 */ \"Return\",\r\n     /*   4 */ \"Yield\",\r\n     /*   5 */ \"HaltIfNull\",\r\n     /*   6 */ \"Halt\",\r\n     /*   7 */ \"Integer\",\r\n     /*   8 */ \"Int64\",\r\n     /*   9 */ \"String\",\r\n     /*  10 */ \"Null\",\r\n     /*  11 */ \"Blob\",\r\n     /*  12 */ \"Variable\",\r\n     /*  13 */ \"Move\",\r\n     /*  14 */ \"Copy\",\r\n     /*  15 */ \"SCopy\",\r\n     /*  16 */ \"ResultRow\",\r\n     /*  17 */ \"CollSeq\",\r\n     /*  18 */ \"Function\",\r\n     /*  19 */ \"Not\",\r\n     /*  20 */ \"AddImm\",\r\n     /*  21 */ \"MustBeInt\",\r\n     /*  22 */ \"RealAffinity\",\r\n     /*  23 */ \"Permutation\",\r\n     /*  24 */ \"Compare\",\r\n     /*  25 */ \"Jump\",\r\n     /*  26 */ \"Once\",\r\n     /*  27 */ \"If\",\r\n     /*  28 */ \"IfNot\",\r\n     /*  29 */ \"Column\",\r\n     /*  30 */ \"Affinity\",\r\n     /*  31 */ \"MakeRecord\",\r\n     /*  32 */ \"Count\",\r\n     /*  33 */ \"Savepoint\",\r\n     /*  34 */ \"AutoCommit\",\r\n     /*  35 */ \"Transaction\",\r\n     /*  36 */ \"ReadCookie\",\r\n     /*  37 */ \"SetCookie\",\r\n     /*  38 */ \"VerifyCookie\",\r\n     /*  39 */ \"OpenRead\",\r\n     /*  40 */ \"OpenWrite\",\r\n     /*  41 */ \"OpenAutoindex\",\r\n     /*  42 */ \"OpenEphemeral\",\r\n     /*  43 */ \"SorterOpen\",\r\n     /*  44 */ \"OpenPseudo\",\r\n     /*  45 */ \"Close\",\r\n     /*  46 */ \"SeekLt\",\r\n     /*  47 */ \"SeekLe\",\r\n     /*  48 */ \"SeekGe\",\r\n     /*  49 */ \"SeekGt\",\r\n     /*  50 */ \"Seek\",\r\n     /*  51 */ \"NotFound\",\r\n     /*  52 */ \"Found\",\r\n     /*  53 */ \"IsUnique\",\r\n     /*  54 */ \"NotExists\",\r\n     /*  55 */ \"Sequence\",\r\n     /*  56 */ \"NewRowid\",\r\n     /*  57 */ \"Insert\",\r\n     /*  58 */ \"InsertInt\",\r\n     /*  59 */ \"Delete\",\r\n     /*  60 */ \"ResetCount\",\r\n     /*  61 */ \"SorterCompare\",\r\n     /*  62 */ \"SorterData\",\r\n     /*  63 */ \"RowKey\",\r\n     /*  64 */ \"RowData\",\r\n     /*  65 */ \"Rowid\",\r\n     /*  66 */ \"NullRow\",\r\n     /*  67 */ \"Last\",\r\n     /*  68 */ \"Or\",\r\n     /*  69 */ \"And\",\r\n     /*  70 */ \"SorterSort\",\r\n     /*  71 */ \"Sort\",\r\n     /*  72 */ \"Rewind\",\r\n     /*  73 */ \"IsNull\",\r\n     /*  74 */ \"NotNull\",\r\n     /*  75 */ \"Ne\",\r\n     /*  76 */ \"Eq\",\r\n     /*  77 */ \"Gt\",\r\n     /*  78 */ \"Le\",\r\n     /*  79 */ \"Lt\",\r\n     /*  80 */ \"Ge\",\r\n     /*  81 */ \"SorterNext\",\r\n     /*  82 */ \"BitAnd\",\r\n     /*  83 */ \"BitOr\",\r\n     /*  84 */ \"ShiftLeft\",\r\n     /*  85 */ \"ShiftRight\",\r\n     /*  86 */ \"Add\",\r\n     /*  87 */ \"Subtract\",\r\n     /*  88 */ \"Multiply\",\r\n     /*  89 */ \"Divide\",\r\n     /*  90 */ \"Remainder\",\r\n     /*  91 */ \"Concat\",\r\n     /*  92 */ \"Prev\",\r\n     /*  93 */ \"BitNot\",\r\n     /*  94 */ \"String8\",\r\n     /*  95 */ \"Next\",\r\n     /*  96 */ \"SorterInsert\",\r\n     /*  97 */ \"IdxInsert\",\r\n     /*  98 */ \"IdxDelete\",\r\n     /*  99 */ \"IdxRowid\",\r\n     /* 100 */ \"IdxLT\",\r\n     /* 101 */ \"IdxGE\",\r\n     /* 102 */ \"Destroy\",\r\n     /* 103 */ \"Clear\",\r\n     /* 104 */ \"CreateIndex\",\r\n     /* 105 */ \"CreateTable\",\r\n     /* 106 */ \"ParseSchema\",\r\n     /* 107 */ \"LoadAnalysis\",\r\n     /* 108 */ \"DropTable\",\r\n     /* 109 */ \"DropIndex\",\r\n     /* 110 */ \"DropTrigger\",\r\n     /* 111 */ \"IntegrityCk\",\r\n     /* 112 */ \"RowSetAdd\",\r\n     /* 113 */ \"RowSetRead\",\r\n     /* 114 */ \"RowSetTest\",\r\n     /* 115 */ \"Program\",\r\n     /* 116 */ \"Param\",\r\n     /* 117 */ \"FkCounter\",\r\n     /* 118 */ \"FkIfZero\",\r\n     /* 119 */ \"MemMax\",\r\n     /* 120 */ \"IfPos\",\r\n     /* 121 */ \"IfNeg\",\r\n     /* 122 */ \"IfZero\",\r\n     /* 123 */ \"AggStep\",\r\n     /* 124 */ \"AggFinal\",\r\n     /* 125 */ \"Checkpoint\",\r\n     /* 126 */ \"JournalMode\",\r\n     /* 127 */ \"Vacuum\",\r\n     /* 128 */ \"IncrVacuum\",\r\n     /* 129 */ \"Expire\",\r\n     /* 130 */ \"Real\",\r\n     /* 131 */ \"TableLock\",\r\n     /* 132 */ \"VBegin\",\r\n     /* 133 */ \"VCreate\",\r\n     /* 134 */ \"VDestroy\",\r\n     /* 135 */ \"VOpen\",\r\n     /* 136 */ \"VFilter\",\r\n     /* 137 */ \"VColumn\",\r\n     /* 138 */ \"VNext\",\r\n     /* 139 */ \"VRename\",\r\n     /* 140 */ \"VUpdate\",\r\n     /* 141 */ \"ToText\",\r\n     /* 142 */ \"ToBlob\",\r\n     /* 143 */ \"ToNumeric\",\r\n     /* 144 */ \"ToInt\",\r\n     /* 145 */ \"ToReal\",\r\n     /* 146 */ \"Pagecount\",\r\n     /* 147 */ \"MaxPgcnt\",\r\n     /* 148 */ \"Trace\",\r\n     /* 149 */ \"Noop\",\r\n     /* 150 */ \"Explain\",\r\n  };\r\n  return azName[i];\r\n}\r\n#endif\r\n\r\n/************** End of opcodes.c *********************************************/\r\n/************** Begin file os_os2.c ******************************************/\r\n/*\r\n** 2006 Feb 14\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains code that is specific to OS/2.\r\n*/\r\n\r\n\r\n#if SQLITE_OS_OS2\r\n\r\n/*\r\n** A Note About Memory Allocation:\r\n**\r\n** This driver uses malloc()/free() directly rather than going through\r\n** the SQLite-wrappers sqlite3_malloc()/sqlite3_free().  Those wrappers\r\n** are designed for use on embedded systems where memory is scarce and\r\n** malloc failures happen frequently.  OS/2 does not typically run on\r\n** embedded systems, and when it does the developers normally have bigger\r\n** problems to worry about than running out of memory.  So there is not\r\n** a compelling need to use the wrappers.\r\n**\r\n** But there is a good reason to not use the wrappers.  If we use the\r\n** wrappers then we will get simulated malloc() failures within this\r\n** driver.  And that causes all kinds of problems for our tests.  We\r\n** could enhance SQLite to deal with simulated malloc failures within\r\n** the OS driver, but the code to deal with those failure would not\r\n** be exercised on Linux (which does not need to malloc() in the driver)\r\n** and so we would have difficulty writing coverage tests for that\r\n** code.  Better to leave the code out, we think.\r\n**\r\n** The point of this discussion is as follows:  When creating a new\r\n** OS layer for an embedded system, if you use this file as an example,\r\n** avoid the use of malloc()/free().  Those routines work ok on OS/2\r\n** desktops but not so well in embedded systems.\r\n*/\r\n\r\n/*\r\n** Macros used to determine whether or not to use threads.\r\n*/\r\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE\r\n# define SQLITE_OS2_THREADS 1\r\n#endif\r\n\r\n/*\r\n** Include code that is common to all os_*.c files\r\n*/\r\n/************** Include os_common.h in the middle of os_os2.c ****************/\r\n/************** Begin file os_common.h ***************************************/\r\n/*\r\n** 2004 May 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains macros and a little bit of code that is common to\r\n** all of the platform-specific files (os_*.c) and is #included into those\r\n** files.\r\n**\r\n** This file should be #included by the os_*.c files only.  It is not a\r\n** general purpose header file.\r\n*/\r\n#ifndef _OS_COMMON_H_\r\n#define _OS_COMMON_H_\r\n\r\n/*\r\n** At least two bugs have slipped in because we changed the MEMORY_DEBUG\r\n** macro to SQLITE_DEBUG and some older makefiles have not yet made the\r\n** switch.  The following code should catch this problem at compile-time.\r\n*/\r\n#ifdef MEMORY_DEBUG\r\n# error \"The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead.\"\r\n#endif\r\n\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n# ifndef SQLITE_DEBUG_OS_TRACE\r\n#   define SQLITE_DEBUG_OS_TRACE 0\r\n# endif\r\n  int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;\r\n# define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X\r\n#else\r\n# define OSTRACE(X)\r\n#endif\r\n\r\n/*\r\n** Macros for performance tracing.  Normally turned off.  Only works\r\n** on i486 hardware.\r\n*/\r\n#ifdef SQLITE_PERFORMANCE_TRACE\r\n\r\n/* \r\n** hwtime.h contains inline assembler code for implementing \r\n** high-performance timing routines.\r\n*/\r\n/************** Include hwtime.h in the middle of os_common.h ****************/\r\n/************** Begin file hwtime.h ******************************************/\r\n/*\r\n** 2008 May 27\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains inline asm code for retrieving \"high-performance\"\r\n** counters for x86 class CPUs.\r\n*/\r\n#ifndef _HWTIME_H_\r\n#define _HWTIME_H_\r\n\r\n/*\r\n** The following routine only works on pentium-class (or newer) processors.\r\n** It uses the RDTSC opcode to read the cycle count value out of the\r\n** processor and returns that value.  This can be used for high-res\r\n** profiling.\r\n*/\r\n#if (defined(__GNUC__) || defined(_MSC_VER)) && \\\r\n      (defined(i386) || defined(__i386__) || defined(_M_IX86))\r\n\r\n  #if defined(__GNUC__)\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n     unsigned int lo, hi;\r\n     __asm__ __volatile__ (\"rdtsc\" : \"=a\" (lo), \"=d\" (hi));\r\n     return (sqlite_uint64)hi << 32 | lo;\r\n  }\r\n\r\n  #elif defined(_MSC_VER)\r\n\r\n  __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){\r\n     __asm {\r\n        rdtsc\r\n        ret       ; return value at EDX:EAX\r\n     }\r\n  }\r\n\r\n  #endif\r\n\r\n#elif (defined(__GNUC__) && defined(__x86_64__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long val;\r\n      __asm__ __volatile__ (\"rdtsc\" : \"=A\" (val));\r\n      return val;\r\n  }\r\n \r\n#elif (defined(__GNUC__) && defined(__ppc__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long long retval;\r\n      unsigned long junk;\r\n      __asm__ __volatile__ (\"\\n\\\r\n          1:      mftbu   %1\\n\\\r\n                  mftb    %L0\\n\\\r\n                  mftbu   %0\\n\\\r\n                  cmpw    %0,%1\\n\\\r\n                  bne     1b\"\r\n                  : \"=r\" (retval), \"=r\" (junk));\r\n      return retval;\r\n  }\r\n\r\n#else\r\n\r\n  #error Need implementation of sqlite3Hwtime() for your platform.\r\n\r\n  /*\r\n  ** To compile without implementing sqlite3Hwtime() for your platform,\r\n  ** you can remove the above #error and use the following\r\n  ** stub function.  You will lose timing support for many\r\n  ** of the debugging and testing utilities, but it should at\r\n  ** least compile and run.\r\n  */\r\nSQLITE_PRIVATE   sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }\r\n\r\n#endif\r\n\r\n#endif /* !defined(_HWTIME_H_) */\r\n\r\n/************** End of hwtime.h **********************************************/\r\n/************** Continuing where we left off in os_common.h ******************/\r\n\r\nstatic sqlite_uint64 g_start;\r\nstatic sqlite_uint64 g_elapsed;\r\n#define TIMER_START       g_start=sqlite3Hwtime()\r\n#define TIMER_END         g_elapsed=sqlite3Hwtime()-g_start\r\n#define TIMER_ELAPSED     g_elapsed\r\n#else\r\n#define TIMER_START\r\n#define TIMER_END\r\n#define TIMER_ELAPSED     ((sqlite_uint64)0)\r\n#endif\r\n\r\n/*\r\n** If we compile with the SQLITE_TEST macro set, then the following block\r\n** of code will give us the ability to simulate a disk I/O error.  This\r\n** is used for testing the I/O recovery logic.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */\r\nSQLITE_API int sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */\r\nSQLITE_API int sqlite3_io_error_pending = 0;        /* Count down to first I/O error */\r\nSQLITE_API int sqlite3_io_error_persist = 0;        /* True if I/O errors persist */\r\nSQLITE_API int sqlite3_io_error_benign = 0;         /* True if errors are benign */\r\nSQLITE_API int sqlite3_diskfull_pending = 0;\r\nSQLITE_API int sqlite3_diskfull = 0;\r\n#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)\r\n#define SimulateIOError(CODE)  \\\r\n  if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \\\r\n       || sqlite3_io_error_pending-- == 1 )  \\\r\n              { local_ioerr(); CODE; }\r\nstatic void local_ioerr(){\r\n  IOTRACE((\"IOERR\\n\"));\r\n  sqlite3_io_error_hit++;\r\n  if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++;\r\n}\r\n#define SimulateDiskfullError(CODE) \\\r\n   if( sqlite3_diskfull_pending ){ \\\r\n     if( sqlite3_diskfull_pending == 1 ){ \\\r\n       local_ioerr(); \\\r\n       sqlite3_diskfull = 1; \\\r\n       sqlite3_io_error_hit = 1; \\\r\n       CODE; \\\r\n     }else{ \\\r\n       sqlite3_diskfull_pending--; \\\r\n     } \\\r\n   }\r\n#else\r\n#define SimulateIOErrorBenign(X)\r\n#define SimulateIOError(A)\r\n#define SimulateDiskfullError(A)\r\n#endif\r\n\r\n/*\r\n** When testing, keep a count of the number of open files.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_open_file_count = 0;\r\n#define OpenCounter(X)  sqlite3_open_file_count+=(X)\r\n#else\r\n#define OpenCounter(X)\r\n#endif\r\n\r\n#endif /* !defined(_OS_COMMON_H_) */\r\n\r\n/************** End of os_common.h *******************************************/\r\n/************** Continuing where we left off in os_os2.c *********************/\r\n\r\n/* Forward references */\r\ntypedef struct os2File os2File;         /* The file structure */\r\ntypedef struct os2ShmNode os2ShmNode;   /* A shared descritive memory node */\r\ntypedef struct os2ShmLink os2ShmLink;   /* A connection to shared-memory */\r\n\r\n/*\r\n** The os2File structure is subclass of sqlite3_file specific for the OS/2\r\n** protability layer.\r\n*/\r\nstruct os2File {\r\n  const sqlite3_io_methods *pMethod;  /* Always the first entry */\r\n  HFILE h;                  /* Handle for accessing the file */\r\n  int flags;                /* Flags provided to os2Open() */\r\n  int locktype;             /* Type of lock currently held on this file */\r\n  int szChunk;              /* Chunk size configured by FCNTL_CHUNK_SIZE */\r\n  char *zFullPathCp;        /* Full path name of this file */\r\n  os2ShmLink *pShmLink;     /* Instance of shared memory on this file */\r\n};\r\n\r\n#define LOCK_TIMEOUT 10L /* the default locking timeout */\r\n\r\n/*\r\n** Missing from some versions of the OS/2 toolkit -\r\n** used to allocate from high memory if possible\r\n*/\r\n#ifndef OBJ_ANY\r\n# define OBJ_ANY 0x00000400\r\n#endif\r\n\r\n/*****************************************************************************\r\n** The next group of routines implement the I/O methods specified\r\n** by the sqlite3_io_methods object.\r\n******************************************************************************/\r\n\r\n/*\r\n** Close a file.\r\n*/\r\nstatic int os2Close( sqlite3_file *id ){\r\n  APIRET rc;\r\n  os2File *pFile = (os2File*)id;\r\n\r\n  assert( id!=0 );\r\n  OSTRACE(( \"CLOSE %d (%s)\\n\", pFile->h, pFile->zFullPathCp ));\r\n\r\n  rc = DosClose( pFile->h );\r\n\r\n  if( pFile->flags & SQLITE_OPEN_DELETEONCLOSE )\r\n    DosForceDelete( (PSZ)pFile->zFullPathCp );\r\n\r\n  free( pFile->zFullPathCp );\r\n  pFile->zFullPathCp = NULL;\r\n  pFile->locktype = NO_LOCK;\r\n  pFile->h = (HFILE)-1;\r\n  pFile->flags = 0;\r\n\r\n  OpenCounter( -1 );\r\n  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;\r\n}\r\n\r\n/*\r\n** Read data from a file into a buffer.  Return SQLITE_OK if all\r\n** bytes were read successfully and SQLITE_IOERR if anything goes\r\n** wrong.\r\n*/\r\nstatic int os2Read(\r\n  sqlite3_file *id,               /* File to read from */\r\n  void *pBuf,                     /* Write content into this buffer */\r\n  int amt,                        /* Number of bytes to read */\r\n  sqlite3_int64 offset            /* Begin reading at this offset */\r\n){\r\n  ULONG fileLocation = 0L;\r\n  ULONG got;\r\n  os2File *pFile = (os2File*)id;\r\n  assert( id!=0 );\r\n  SimulateIOError( return SQLITE_IOERR_READ );\r\n  OSTRACE(( \"READ %d lock=%d\\n\", pFile->h, pFile->locktype ));\r\n  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){\r\n    return SQLITE_IOERR;\r\n  }\r\n  if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){\r\n    return SQLITE_IOERR_READ;\r\n  }\r\n  if( got == (ULONG)amt )\r\n    return SQLITE_OK;\r\n  else {\r\n    /* Unread portions of the input buffer must be zero-filled */\r\n    memset(&((char*)pBuf)[got], 0, amt-got);\r\n    return SQLITE_IOERR_SHORT_READ;\r\n  }\r\n}\r\n\r\n/*\r\n** Write data from a buffer into a file.  Return SQLITE_OK on success\r\n** or some other error code on failure.\r\n*/\r\nstatic int os2Write(\r\n  sqlite3_file *id,               /* File to write into */\r\n  const void *pBuf,               /* The bytes to be written */\r\n  int amt,                        /* Number of bytes to write */\r\n  sqlite3_int64 offset            /* Offset into the file to begin writing at */\r\n){\r\n  ULONG fileLocation = 0L;\r\n  APIRET rc = NO_ERROR;\r\n  ULONG wrote;\r\n  os2File *pFile = (os2File*)id;\r\n  assert( id!=0 );\r\n  SimulateIOError( return SQLITE_IOERR_WRITE );\r\n  SimulateDiskfullError( return SQLITE_FULL );\r\n  OSTRACE(( \"WRITE %d lock=%d\\n\", pFile->h, pFile->locktype ));\r\n  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){\r\n    return SQLITE_IOERR;\r\n  }\r\n  assert( amt>0 );\r\n  while( amt > 0 &&\r\n         ( rc = DosWrite( pFile->h, (PVOID)pBuf, amt, &wrote ) ) == NO_ERROR &&\r\n         wrote > 0\r\n  ){\r\n    amt -= wrote;\r\n    pBuf = &((char*)pBuf)[wrote];\r\n  }\r\n\r\n  return ( rc != NO_ERROR || amt > (int)wrote ) ? SQLITE_FULL : SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Truncate an open file to a specified size\r\n*/\r\nstatic int os2Truncate( sqlite3_file *id, i64 nByte ){\r\n  APIRET rc;\r\n  os2File *pFile = (os2File*)id;\r\n  assert( id!=0 );\r\n  OSTRACE(( \"TRUNCATE %d %lld\\n\", pFile->h, nByte ));\r\n  SimulateIOError( return SQLITE_IOERR_TRUNCATE );\r\n\r\n  /* If the user has configured a chunk-size for this file, truncate the\r\n  ** file so that it consists of an integer number of chunks (i.e. the\r\n  ** actual file size after the operation may be larger than the requested\r\n  ** size).\r\n  */\r\n  if( pFile->szChunk ){\r\n    nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;\r\n  }\r\n  \r\n  rc = DosSetFileSize( pFile->h, nByte );\r\n  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR_TRUNCATE;\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** Count the number of fullsyncs and normal syncs.  This is used to test\r\n** that syncs and fullsyncs are occuring at the right times.\r\n*/\r\nSQLITE_API int sqlite3_sync_count = 0;\r\nSQLITE_API int sqlite3_fullsync_count = 0;\r\n#endif\r\n\r\n/*\r\n** Make sure all writes to a particular file are committed to disk.\r\n*/\r\nstatic int os2Sync( sqlite3_file *id, int flags ){\r\n  os2File *pFile = (os2File*)id;\r\n  OSTRACE(( \"SYNC %d lock=%d\\n\", pFile->h, pFile->locktype ));\r\n#ifdef SQLITE_TEST\r\n  if( flags & SQLITE_SYNC_FULL){\r\n    sqlite3_fullsync_count++;\r\n  }\r\n  sqlite3_sync_count++;\r\n#endif\r\n  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a\r\n  ** no-op\r\n  */\r\n#ifdef SQLITE_NO_SYNC\r\n  UNUSED_PARAMETER(pFile);\r\n  return SQLITE_OK;\r\n#else\r\n  return DosResetBuffer( pFile->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;\r\n#endif\r\n}\r\n\r\n/*\r\n** Determine the current size of a file in bytes\r\n*/\r\nstatic int os2FileSize( sqlite3_file *id, sqlite3_int64 *pSize ){\r\n  APIRET rc = NO_ERROR;\r\n  FILESTATUS3 fsts3FileInfo;\r\n  memset(&fsts3FileInfo, 0, sizeof(fsts3FileInfo));\r\n  assert( id!=0 );\r\n  SimulateIOError( return SQLITE_IOERR_FSTAT );\r\n  rc = DosQueryFileInfo( ((os2File*)id)->h, FIL_STANDARD, &fsts3FileInfo, sizeof(FILESTATUS3) );\r\n  if( rc == NO_ERROR ){\r\n    *pSize = fsts3FileInfo.cbFile;\r\n    return SQLITE_OK;\r\n  }else{\r\n    return SQLITE_IOERR_FSTAT;\r\n  }\r\n}\r\n\r\n/*\r\n** Acquire a reader lock.\r\n*/\r\nstatic int getReadLock( os2File *pFile ){\r\n  FILELOCK  LockArea,\r\n            UnlockArea;\r\n  APIRET res;\r\n  memset(&LockArea, 0, sizeof(LockArea));\r\n  memset(&UnlockArea, 0, sizeof(UnlockArea));\r\n  LockArea.lOffset = SHARED_FIRST;\r\n  LockArea.lRange = SHARED_SIZE;\r\n  UnlockArea.lOffset = 0L;\r\n  UnlockArea.lRange = 0L;\r\n  res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );\r\n  OSTRACE(( \"GETREADLOCK %d res=%d\\n\", pFile->h, res ));\r\n  return res;\r\n}\r\n\r\n/*\r\n** Undo a readlock\r\n*/\r\nstatic int unlockReadLock( os2File *id ){\r\n  FILELOCK  LockArea,\r\n            UnlockArea;\r\n  APIRET res;\r\n  memset(&LockArea, 0, sizeof(LockArea));\r\n  memset(&UnlockArea, 0, sizeof(UnlockArea));\r\n  LockArea.lOffset = 0L;\r\n  LockArea.lRange = 0L;\r\n  UnlockArea.lOffset = SHARED_FIRST;\r\n  UnlockArea.lRange = SHARED_SIZE;\r\n  res = DosSetFileLocks( id->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );\r\n  OSTRACE(( \"UNLOCK-READLOCK file handle=%d res=%d?\\n\", id->h, res ));\r\n  return res;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter locktype - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** This routine will only increase a lock.  The os2Unlock() routine\r\n** erases all locks at once and returns us immediately to locking level 0.\r\n** It is not possible to lower the locking level one step at a time.  You\r\n** must go straight to locking level 0.\r\n*/\r\nstatic int os2Lock( sqlite3_file *id, int locktype ){\r\n  int rc = SQLITE_OK;       /* Return code from subroutines */\r\n  APIRET res = NO_ERROR;    /* Result of an OS/2 lock call */\r\n  int newLocktype;       /* Set pFile->locktype to this value before exiting */\r\n  int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */\r\n  FILELOCK  LockArea,\r\n            UnlockArea;\r\n  os2File *pFile = (os2File*)id;\r\n  memset(&LockArea, 0, sizeof(LockArea));\r\n  memset(&UnlockArea, 0, sizeof(UnlockArea));\r\n  assert( pFile!=0 );\r\n  OSTRACE(( \"LOCK %d %d was %d\\n\", pFile->h, locktype, pFile->locktype ));\r\n\r\n  /* If there is already a lock of this type or more restrictive on the\r\n  ** os2File, do nothing. Don't use the end_lock: exit path, as\r\n  ** sqlite3_mutex_enter() hasn't been called yet.\r\n  */\r\n  if( pFile->locktype>=locktype ){\r\n    OSTRACE(( \"LOCK %d %d ok (already held)\\n\", pFile->h, locktype ));\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Make sure the locking sequence is correct\r\n  */\r\n  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );\r\n  assert( locktype!=PENDING_LOCK );\r\n  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );\r\n\r\n  /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or\r\n  ** a SHARED lock.  If we are acquiring a SHARED lock, the acquisition of\r\n  ** the PENDING_LOCK byte is temporary.\r\n  */\r\n  newLocktype = pFile->locktype;\r\n  if( pFile->locktype==NO_LOCK\r\n      || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)\r\n  ){\r\n    LockArea.lOffset = PENDING_BYTE;\r\n    LockArea.lRange = 1L;\r\n    UnlockArea.lOffset = 0L;\r\n    UnlockArea.lRange = 0L;\r\n\r\n    /* wait longer than LOCK_TIMEOUT here not to have to try multiple times */\r\n    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 100L, 0L );\r\n    if( res == NO_ERROR ){\r\n      gotPendingLock = 1;\r\n      OSTRACE(( \"LOCK %d pending lock boolean set.  res=%d\\n\", pFile->h, res ));\r\n    }\r\n  }\r\n\r\n  /* Acquire a shared lock\r\n  */\r\n  if( locktype==SHARED_LOCK && res == NO_ERROR ){\r\n    assert( pFile->locktype==NO_LOCK );\r\n    res = getReadLock(pFile);\r\n    if( res == NO_ERROR ){\r\n      newLocktype = SHARED_LOCK;\r\n    }\r\n    OSTRACE(( \"LOCK %d acquire shared lock. res=%d\\n\", pFile->h, res ));\r\n  }\r\n\r\n  /* Acquire a RESERVED lock\r\n  */\r\n  if( locktype==RESERVED_LOCK && res == NO_ERROR ){\r\n    assert( pFile->locktype==SHARED_LOCK );\r\n    LockArea.lOffset = RESERVED_BYTE;\r\n    LockArea.lRange = 1L;\r\n    UnlockArea.lOffset = 0L;\r\n    UnlockArea.lRange = 0L;\r\n    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    if( res == NO_ERROR ){\r\n      newLocktype = RESERVED_LOCK;\r\n    }\r\n    OSTRACE(( \"LOCK %d acquire reserved lock. res=%d\\n\", pFile->h, res ));\r\n  }\r\n\r\n  /* Acquire a PENDING lock\r\n  */\r\n  if( locktype==EXCLUSIVE_LOCK && res == NO_ERROR ){\r\n    newLocktype = PENDING_LOCK;\r\n    gotPendingLock = 0;\r\n    OSTRACE(( \"LOCK %d acquire pending lock. pending lock boolean unset.\\n\",\r\n               pFile->h ));\r\n  }\r\n\r\n  /* Acquire an EXCLUSIVE lock\r\n  */\r\n  if( locktype==EXCLUSIVE_LOCK && res == NO_ERROR ){\r\n    assert( pFile->locktype>=SHARED_LOCK );\r\n    res = unlockReadLock(pFile);\r\n    OSTRACE(( \"unreadlock = %d\\n\", res ));\r\n    LockArea.lOffset = SHARED_FIRST;\r\n    LockArea.lRange = SHARED_SIZE;\r\n    UnlockArea.lOffset = 0L;\r\n    UnlockArea.lRange = 0L;\r\n    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    if( res == NO_ERROR ){\r\n      newLocktype = EXCLUSIVE_LOCK;\r\n    }else{\r\n      OSTRACE(( \"OS/2 error-code = %d\\n\", res ));\r\n      getReadLock(pFile);\r\n    }\r\n    OSTRACE(( \"LOCK %d acquire exclusive lock.  res=%d\\n\", pFile->h, res ));\r\n  }\r\n\r\n  /* If we are holding a PENDING lock that ought to be released, then\r\n  ** release it now.\r\n  */\r\n  if( gotPendingLock && locktype==SHARED_LOCK ){\r\n    int r;\r\n    LockArea.lOffset = 0L;\r\n    LockArea.lRange = 0L;\r\n    UnlockArea.lOffset = PENDING_BYTE;\r\n    UnlockArea.lRange = 1L;\r\n    r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    OSTRACE(( \"LOCK %d unlocking pending/is shared. r=%d\\n\", pFile->h, r ));\r\n  }\r\n\r\n  /* Update the state of the lock has held in the file descriptor then\r\n  ** return the appropriate result code.\r\n  */\r\n  if( res == NO_ERROR ){\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    OSTRACE(( \"LOCK FAILED %d trying for %d but got %d\\n\", pFile->h,\r\n              locktype, newLocktype ));\r\n    rc = SQLITE_BUSY;\r\n  }\r\n  pFile->locktype = newLocktype;\r\n  OSTRACE(( \"LOCK %d now %d\\n\", pFile->h, pFile->locktype ));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, return\r\n** non-zero, otherwise zero.\r\n*/\r\nstatic int os2CheckReservedLock( sqlite3_file *id, int *pOut ){\r\n  int r = 0;\r\n  os2File *pFile = (os2File*)id;\r\n  assert( pFile!=0 );\r\n  if( pFile->locktype>=RESERVED_LOCK ){\r\n    r = 1;\r\n    OSTRACE(( \"TEST WR-LOCK %d %d (local)\\n\", pFile->h, r ));\r\n  }else{\r\n    FILELOCK  LockArea,\r\n              UnlockArea;\r\n    APIRET rc = NO_ERROR;\r\n    memset(&LockArea, 0, sizeof(LockArea));\r\n    memset(&UnlockArea, 0, sizeof(UnlockArea));\r\n    LockArea.lOffset = RESERVED_BYTE;\r\n    LockArea.lRange = 1L;\r\n    UnlockArea.lOffset = 0L;\r\n    UnlockArea.lRange = 0L;\r\n    rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    OSTRACE(( \"TEST WR-LOCK %d lock reserved byte rc=%d\\n\", pFile->h, rc ));\r\n    if( rc == NO_ERROR ){\r\n      APIRET rcu = NO_ERROR; /* return code for unlocking */\r\n      LockArea.lOffset = 0L;\r\n      LockArea.lRange = 0L;\r\n      UnlockArea.lOffset = RESERVED_BYTE;\r\n      UnlockArea.lRange = 1L;\r\n      rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n      OSTRACE(( \"TEST WR-LOCK %d unlock reserved byte r=%d\\n\", pFile->h, rcu ));\r\n    }\r\n    r = !(rc == NO_ERROR);\r\n    OSTRACE(( \"TEST WR-LOCK %d %d (remote)\\n\", pFile->h, r ));\r\n  }\r\n  *pOut = r;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor id to locktype.  locktype\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n**\r\n** It is not possible for this routine to fail if the second argument\r\n** is NO_LOCK.  If the second argument is SHARED_LOCK then this routine\r\n** might return SQLITE_IOERR;\r\n*/\r\nstatic int os2Unlock( sqlite3_file *id, int locktype ){\r\n  int type;\r\n  os2File *pFile = (os2File*)id;\r\n  APIRET rc = SQLITE_OK;\r\n  APIRET res = NO_ERROR;\r\n  FILELOCK  LockArea,\r\n            UnlockArea;\r\n  memset(&LockArea, 0, sizeof(LockArea));\r\n  memset(&UnlockArea, 0, sizeof(UnlockArea));\r\n  assert( pFile!=0 );\r\n  assert( locktype<=SHARED_LOCK );\r\n  OSTRACE(( \"UNLOCK %d to %d was %d\\n\", pFile->h, locktype, pFile->locktype ));\r\n  type = pFile->locktype;\r\n  if( type>=EXCLUSIVE_LOCK ){\r\n    LockArea.lOffset = 0L;\r\n    LockArea.lRange = 0L;\r\n    UnlockArea.lOffset = SHARED_FIRST;\r\n    UnlockArea.lRange = SHARED_SIZE;\r\n    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    OSTRACE(( \"UNLOCK %d exclusive lock res=%d\\n\", pFile->h, res ));\r\n    if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){\r\n      /* This should never happen.  We should always be able to\r\n      ** reacquire the read lock */\r\n      OSTRACE(( \"UNLOCK %d to %d getReadLock() failed\\n\", pFile->h, locktype ));\r\n      rc = SQLITE_IOERR_UNLOCK;\r\n    }\r\n  }\r\n  if( type>=RESERVED_LOCK ){\r\n    LockArea.lOffset = 0L;\r\n    LockArea.lRange = 0L;\r\n    UnlockArea.lOffset = RESERVED_BYTE;\r\n    UnlockArea.lRange = 1L;\r\n    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    OSTRACE(( \"UNLOCK %d reserved res=%d\\n\", pFile->h, res ));\r\n  }\r\n  if( locktype==NO_LOCK && type>=SHARED_LOCK ){\r\n    res = unlockReadLock(pFile);\r\n    OSTRACE(( \"UNLOCK %d is %d want %d res=%d\\n\",\r\n              pFile->h, type, locktype, res ));\r\n  }\r\n  if( type>=PENDING_LOCK ){\r\n    LockArea.lOffset = 0L;\r\n    LockArea.lRange = 0L;\r\n    UnlockArea.lOffset = PENDING_BYTE;\r\n    UnlockArea.lRange = 1L;\r\n    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );\r\n    OSTRACE(( \"UNLOCK %d pending res=%d\\n\", pFile->h, res ));\r\n  }\r\n  pFile->locktype = locktype;\r\n  OSTRACE(( \"UNLOCK %d now %d\\n\", pFile->h, pFile->locktype ));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Control and query of the open file handle.\r\n*/\r\nstatic int os2FileControl(sqlite3_file *id, int op, void *pArg){\r\n  switch( op ){\r\n    case SQLITE_FCNTL_LOCKSTATE: {\r\n      *(int*)pArg = ((os2File*)id)->locktype;\r\n      OSTRACE(( \"FCNTL_LOCKSTATE %d lock=%d\\n\",\r\n                ((os2File*)id)->h, ((os2File*)id)->locktype ));\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_CHUNK_SIZE: {\r\n      ((os2File*)id)->szChunk = *(int*)pArg;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_SIZE_HINT: {\r\n      sqlite3_int64 sz = *(sqlite3_int64*)pArg;\r\n      SimulateIOErrorBenign(1);\r\n      os2Truncate(id, sz);\r\n      SimulateIOErrorBenign(0);\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_SYNC_OMITTED: {\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n  return SQLITE_NOTFOUND;\r\n}\r\n\r\n/*\r\n** Return the sector size in bytes of the underlying block device for\r\n** the specified file. This is almost always 512 bytes, but may be\r\n** larger for some devices.\r\n**\r\n** SQLite code assumes this function cannot fail. It also assumes that\r\n** if two files are created in the same file-system directory (i.e.\r\n** a database and its journal file) that the sector size will be the\r\n** same for both.\r\n*/\r\nstatic int os2SectorSize(sqlite3_file *id){\r\n  UNUSED_PARAMETER(id);\r\n  return SQLITE_DEFAULT_SECTOR_SIZE;\r\n}\r\n\r\n/*\r\n** Return a vector of device characteristics.\r\n*/\r\nstatic int os2DeviceCharacteristics(sqlite3_file *id){\r\n  UNUSED_PARAMETER(id);\r\n  return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN;\r\n}\r\n\r\n\r\n/*\r\n** Character set conversion objects used by conversion routines.\r\n*/\r\nstatic UconvObject ucUtf8 = NULL; /* convert between UTF-8 and UCS-2 */\r\nstatic UconvObject uclCp = NULL;  /* convert between local codepage and UCS-2 */\r\n\r\n/*\r\n** Helper function to initialize the conversion objects from and to UTF-8.\r\n*/\r\nstatic void initUconvObjects( void ){\r\n  if( UniCreateUconvObject( UTF_8, &ucUtf8 ) != ULS_SUCCESS )\r\n    ucUtf8 = NULL;\r\n  if ( UniCreateUconvObject( (UniChar *)L\"@path=yes\", &uclCp ) != ULS_SUCCESS )\r\n    uclCp = NULL;\r\n}\r\n\r\n/*\r\n** Helper function to free the conversion objects from and to UTF-8.\r\n*/\r\nstatic void freeUconvObjects( void ){\r\n  if ( ucUtf8 )\r\n    UniFreeUconvObject( ucUtf8 );\r\n  if ( uclCp )\r\n    UniFreeUconvObject( uclCp );\r\n  ucUtf8 = NULL;\r\n  uclCp = NULL;\r\n}\r\n\r\n/*\r\n** Helper function to convert UTF-8 filenames to local OS/2 codepage.\r\n** The two-step process: first convert the incoming UTF-8 string\r\n** into UCS-2 and then from UCS-2 to the current codepage.\r\n** The returned char pointer has to be freed.\r\n*/\r\nstatic char *convertUtf8PathToCp( const char *in ){\r\n  UniChar tempPath[CCHMAXPATH];\r\n  char *out = (char *)calloc( CCHMAXPATH, 1 );\r\n\r\n  if( !out )\r\n    return NULL;\r\n\r\n  if( !ucUtf8 || !uclCp )\r\n    initUconvObjects();\r\n\r\n  /* determine string for the conversion of UTF-8 which is CP1208 */\r\n  if( UniStrToUcs( ucUtf8, tempPath, (char *)in, CCHMAXPATH ) != ULS_SUCCESS )\r\n    return out; /* if conversion fails, return the empty string */\r\n\r\n  /* conversion for current codepage which can be used for paths */\r\n  UniStrFromUcs( uclCp, out, tempPath, CCHMAXPATH );\r\n\r\n  return out;\r\n}\r\n\r\n/*\r\n** Helper function to convert filenames from local codepage to UTF-8.\r\n** The two-step process: first convert the incoming codepage-specific\r\n** string into UCS-2 and then from UCS-2 to the codepage of UTF-8.\r\n** The returned char pointer has to be freed.\r\n**\r\n** This function is non-static to be able to use this in shell.c and\r\n** similar applications that take command line arguments.\r\n*/\r\nchar *convertCpPathToUtf8( const char *in ){\r\n  UniChar tempPath[CCHMAXPATH];\r\n  char *out = (char *)calloc( CCHMAXPATH, 1 );\r\n\r\n  if( !out )\r\n    return NULL;\r\n\r\n  if( !ucUtf8 || !uclCp )\r\n    initUconvObjects();\r\n\r\n  /* conversion for current codepage which can be used for paths */\r\n  if( UniStrToUcs( uclCp, tempPath, (char *)in, CCHMAXPATH ) != ULS_SUCCESS )\r\n    return out; /* if conversion fails, return the empty string */\r\n\r\n  /* determine string for the conversion of UTF-8 which is CP1208 */\r\n  UniStrFromUcs( ucUtf8, out, tempPath, CCHMAXPATH );\r\n\r\n  return out;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n\r\n/*\r\n** Use main database file for interprocess locking. If un-defined\r\n** a separate file is created for this purpose. The file will be\r\n** used only to set file locks. There will be no data written to it.\r\n*/\r\n#define SQLITE_OS2_NO_WAL_LOCK_FILE     \r\n\r\n#if 0\r\nstatic void _ERR_TRACE( const char *fmt, ... ) {\r\n  va_list  ap;\r\n  va_start(ap, fmt);\r\n  vfprintf(stderr, fmt, ap);\r\n  fflush(stderr);\r\n}\r\n#define ERR_TRACE(rc, msg)        \\\r\n        if( (rc) != SQLITE_OK ) _ERR_TRACE msg;\r\n#else\r\n#define ERR_TRACE(rc, msg)\r\n#endif\r\n\r\n/*\r\n** Helper functions to obtain and relinquish the global mutex. The\r\n** global mutex is used to protect os2ShmNodeList.\r\n**\r\n** Function os2ShmMutexHeld() is used to assert() that the global mutex \r\n** is held when required. This function is only used as part of assert() \r\n** statements. e.g.\r\n**\r\n**   os2ShmEnterMutex()\r\n**     assert( os2ShmMutexHeld() );\r\n**   os2ShmLeaveMutex()\r\n*/\r\nstatic void os2ShmEnterMutex(void){\r\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\nstatic void os2ShmLeaveMutex(void){\r\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\n#ifdef SQLITE_DEBUG\r\nstatic int os2ShmMutexHeld(void) {\r\n  return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\nint GetCurrentProcessId(void) {\r\n  PPIB pib;\r\n  DosGetInfoBlocks(NULL, &pib);\r\n  return (int)pib->pib_ulpid;\r\n}\r\n#endif\r\n\r\n/*\r\n** Object used to represent a the shared memory area for a single log file.\r\n** When multiple threads all reference the same log-summary, each thread has\r\n** its own os2File object, but they all point to a single instance of this \r\n** object.  In other words, each log-summary is opened only once per process.\r\n**\r\n** os2ShmMutexHeld() must be true when creating or destroying\r\n** this object or while reading or writing the following fields:\r\n**\r\n**      nRef\r\n**      pNext \r\n**\r\n** The following fields are read-only after the object is created:\r\n** \r\n**      szRegion\r\n**      hLockFile\r\n**      shmBaseName\r\n**\r\n** Either os2ShmNode.mutex must be held or os2ShmNode.nRef==0 and\r\n** os2ShmMutexHeld() is true when reading or writing any other field\r\n** in this structure.\r\n**\r\n*/\r\nstruct os2ShmNode {\r\n  sqlite3_mutex *mutex;      /* Mutex to access this object */\r\n  os2ShmNode *pNext;         /* Next in list of all os2ShmNode objects */\r\n\r\n  int szRegion;              /* Size of shared-memory regions */\r\n\r\n  int nRegion;               /* Size of array apRegion */\r\n  void **apRegion;           /* Array of pointers to shared-memory regions */\r\n\r\n  int nRef;                  /* Number of os2ShmLink objects pointing to this */\r\n  os2ShmLink *pFirst;        /* First os2ShmLink object pointing to this */\r\n\r\n  HFILE hLockFile;           /* File used for inter-process memory locking */\r\n  char shmBaseName[1];       /* Name of the memory object !!! must last !!! */\r\n};\r\n\r\n\r\n/*\r\n** Structure used internally by this VFS to record the state of an\r\n** open shared memory connection.\r\n**\r\n** The following fields are initialized when this object is created and\r\n** are read-only thereafter:\r\n**\r\n**    os2Shm.pShmNode\r\n**    os2Shm.id\r\n**\r\n** All other fields are read/write.  The os2Shm.pShmNode->mutex must be held\r\n** while accessing any read/write fields.\r\n*/\r\nstruct os2ShmLink {\r\n  os2ShmNode *pShmNode;      /* The underlying os2ShmNode object */\r\n  os2ShmLink *pNext;         /* Next os2Shm with the same os2ShmNode */\r\n  u32 sharedMask;            /* Mask of shared locks held */\r\n  u32 exclMask;              /* Mask of exclusive locks held */\r\n#ifdef SQLITE_DEBUG\r\n  u8 id;                     /* Id of this connection with its os2ShmNode */\r\n#endif\r\n};\r\n\r\n\r\n/*\r\n** A global list of all os2ShmNode objects.\r\n**\r\n** The os2ShmMutexHeld() must be true while reading or writing this list.\r\n*/\r\nstatic os2ShmNode *os2ShmNodeList = NULL;\r\n\r\n/*\r\n** Constants used for locking\r\n*/\r\n#ifdef  SQLITE_OS2_NO_WAL_LOCK_FILE\r\n#define OS2_SHM_BASE   (PENDING_BYTE + 0x10000)         /* first lock byte */\r\n#else\r\n#define OS2_SHM_BASE   ((22+SQLITE_SHM_NLOCK)*4)        /* first lock byte */\r\n#endif\r\n\r\n#define OS2_SHM_DMS    (OS2_SHM_BASE+SQLITE_SHM_NLOCK)  /* deadman switch */\r\n\r\n/*\r\n** Apply advisory locks for all n bytes beginning at ofst.\r\n*/\r\n#define _SHM_UNLCK  1   /* no lock */\r\n#define _SHM_RDLCK  2   /* shared lock, no wait */\r\n#define _SHM_WRLCK  3   /* exlusive lock, no wait */\r\n#define _SHM_WRLCK_WAIT 4 /* exclusive lock, wait */\r\nstatic int os2ShmSystemLock(\r\n  os2ShmNode *pNode,    /* Apply locks to this open shared-memory segment */\r\n  int lockType,         /* _SHM_UNLCK, _SHM_RDLCK, _SHM_WRLCK or _SHM_WRLCK_WAIT */\r\n  int ofst,             /* Offset to first byte to be locked/unlocked */\r\n  int nByte             /* Number of bytes to lock or unlock */\r\n){\r\n  APIRET rc;\r\n  FILELOCK area;\r\n  ULONG mode, timeout;\r\n\r\n  /* Access to the os2ShmNode object is serialized by the caller */\r\n  assert( sqlite3_mutex_held(pNode->mutex) || pNode->nRef==0 );\r\n\r\n  mode = 1;     /* shared lock */\r\n  timeout = 0;  /* no wait */\r\n  area.lOffset = ofst;\r\n  area.lRange = nByte;\r\n\r\n  switch( lockType ) {\r\n    case _SHM_WRLCK_WAIT:\r\n      timeout = (ULONG)-1;      /* wait forever */\r\n    case _SHM_WRLCK:\r\n      mode = 0;                 /* exclusive lock */\r\n    case _SHM_RDLCK:\r\n      rc = DosSetFileLocks(pNode->hLockFile, \r\n                           NULL, &area, timeout, mode);\r\n      break;\r\n    /* case _SHM_UNLCK: */\r\n    default:\r\n      rc = DosSetFileLocks(pNode->hLockFile, \r\n                           &area, NULL, 0, 0);\r\n      break;\r\n  }\r\n                          \r\n  OSTRACE((\"SHM-LOCK %d %s %s 0x%08lx\\n\", \r\n           pNode->hLockFile,\r\n           rc==SQLITE_OK ? \"ok\" : \"failed\",\r\n           lockType==_SHM_UNLCK ? \"Unlock\" : \"Lock\",\r\n           rc));\r\n\r\n  ERR_TRACE(rc, (\"os2ShmSystemLock: %d %s\\n\", rc, pNode->shmBaseName))\r\n\r\n  return ( rc == 0 ) ?  SQLITE_OK : SQLITE_BUSY;\r\n}\r\n\r\n/*\r\n** Find an os2ShmNode in global list or allocate a new one, if not found.\r\n**\r\n** This is not a VFS shared-memory method; it is a utility function called\r\n** by VFS shared-memory methods.\r\n*/\r\nstatic int os2OpenSharedMemory( os2File *fd, int szRegion ) {\r\n  os2ShmLink *pLink;\r\n  os2ShmNode *pNode;\r\n  int cbShmName, rc = SQLITE_OK;\r\n  char shmName[CCHMAXPATH + 30];\r\n#ifndef SQLITE_OS2_NO_WAL_LOCK_FILE\r\n  ULONG action;\r\n#endif\r\n  \r\n  /* We need some additional space at the end to append the region number */\r\n  cbShmName = sprintf(shmName, \"\\\\SHAREMEM\\\\%s\", fd->zFullPathCp );\r\n  if( cbShmName >= CCHMAXPATH-8 )\r\n    return SQLITE_IOERR_SHMOPEN; \r\n\r\n  /* Replace colon in file name to form a valid shared memory name */\r\n  shmName[10+1] = '!';\r\n\r\n  /* Allocate link object (we free it later in case of failure) */\r\n  pLink = sqlite3_malloc( sizeof(*pLink) );\r\n  if( !pLink )\r\n    return SQLITE_NOMEM;\r\n\r\n  /* Access node list */\r\n  os2ShmEnterMutex();\r\n\r\n  /* Find node by it's shared memory base name */\r\n  for( pNode = os2ShmNodeList; \r\n       pNode && stricmp(shmName, pNode->shmBaseName) != 0; \r\n       pNode = pNode->pNext )   ;\r\n\r\n  /* Not found: allocate a new node */\r\n  if( !pNode ) {\r\n    pNode = sqlite3_malloc( sizeof(*pNode) + cbShmName );\r\n    if( pNode ) {\r\n      memset(pNode, 0, sizeof(*pNode) );\r\n      pNode->szRegion = szRegion;\r\n      pNode->hLockFile = (HFILE)-1;      \r\n      strcpy(pNode->shmBaseName, shmName);\r\n\r\n#ifdef SQLITE_OS2_NO_WAL_LOCK_FILE\r\n      if( DosDupHandle(fd->h, &pNode->hLockFile) != 0 ) {\r\n#else\r\n      sprintf(shmName, \"%s-lck\", fd->zFullPathCp);\r\n      if( DosOpen((PSZ)shmName, &pNode->hLockFile, &action, 0, FILE_NORMAL, \r\n                  OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW,\r\n                  OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE | \r\n                  OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_FAIL_ON_ERROR,\r\n                  NULL) != 0 ) {\r\n#endif\r\n        sqlite3_free(pNode);  \r\n        rc = SQLITE_IOERR;\r\n      } else {\r\n        pNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);\r\n        if( !pNode->mutex ) {\r\n          sqlite3_free(pNode);  \r\n          rc = SQLITE_NOMEM;\r\n        }\r\n      }   \r\n    } else {\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n    \r\n    if( rc == SQLITE_OK ) {\r\n      pNode->pNext = os2ShmNodeList;\r\n      os2ShmNodeList = pNode;\r\n    } else {\r\n      pNode = NULL;\r\n    }\r\n  } else if( pNode->szRegion != szRegion ) {\r\n    rc = SQLITE_IOERR_SHMSIZE;\r\n    pNode = NULL;\r\n  }\r\n\r\n  if( pNode ) {\r\n    sqlite3_mutex_enter(pNode->mutex);\r\n\r\n    memset(pLink, 0, sizeof(*pLink));\r\n\r\n    pLink->pShmNode = pNode;\r\n    pLink->pNext = pNode->pFirst;\r\n    pNode->pFirst = pLink;\r\n    pNode->nRef++;\r\n\r\n    fd->pShmLink = pLink;\r\n\r\n    sqlite3_mutex_leave(pNode->mutex);\r\n    \r\n  } else {\r\n    /* Error occured. Free our link object. */\r\n    sqlite3_free(pLink);  \r\n  }\r\n\r\n  os2ShmLeaveMutex();\r\n\r\n  ERR_TRACE(rc, (\"os2OpenSharedMemory: %d  %s\\n\", rc, fd->zFullPathCp))  \r\n  \r\n  return rc;\r\n}\r\n\r\n/*\r\n** Purge the os2ShmNodeList list of all entries with nRef==0.\r\n**\r\n** This is not a VFS shared-memory method; it is a utility function called\r\n** by VFS shared-memory methods.\r\n*/\r\nstatic void os2PurgeShmNodes( int deleteFlag ) {\r\n  os2ShmNode *pNode;\r\n  os2ShmNode **ppNode;\r\n\r\n  os2ShmEnterMutex();\r\n  \r\n  ppNode = &os2ShmNodeList;\r\n\r\n  while( *ppNode ) {\r\n    pNode = *ppNode;\r\n\r\n    if( pNode->nRef == 0 ) {\r\n      *ppNode = pNode->pNext;   \r\n     \r\n      if( pNode->apRegion ) {\r\n        /* Prevent other processes from resizing the shared memory */\r\n        os2ShmSystemLock(pNode, _SHM_WRLCK_WAIT, OS2_SHM_DMS, 1);\r\n\r\n        while( pNode->nRegion-- ) {\r\n#ifdef SQLITE_DEBUG\r\n          int rc = \r\n#endif          \r\n          DosFreeMem(pNode->apRegion[pNode->nRegion]);\r\n\r\n          OSTRACE((\"SHM-PURGE pid-%d unmap region=%d %s\\n\",\r\n                  (int)GetCurrentProcessId(), pNode->nRegion,\r\n                  rc == 0 ? \"ok\" : \"failed\"));\r\n        }\r\n\r\n        /* Allow other processes to resize the shared memory */\r\n        os2ShmSystemLock(pNode, _SHM_UNLCK, OS2_SHM_DMS, 1);\r\n\r\n        sqlite3_free(pNode->apRegion);\r\n      }  \r\n\r\n      DosClose(pNode->hLockFile);\r\n      \r\n#ifndef SQLITE_OS2_NO_WAL_LOCK_FILE\r\n      if( deleteFlag ) {\r\n         char fileName[CCHMAXPATH];\r\n         /* Skip \"\\\\SHAREMEM\\\\\" */\r\n         sprintf(fileName, \"%s-lck\", pNode->shmBaseName + 10);\r\n         /* restore colon */\r\n         fileName[1] = ':';\r\n         \r\n         DosForceDelete(fileName); \r\n      }\r\n#endif\r\n\r\n      sqlite3_mutex_free(pNode->mutex);\r\n\r\n      sqlite3_free(pNode);\r\n      \r\n    } else {\r\n      ppNode = &pNode->pNext;\r\n    }\r\n  } \r\n\r\n  os2ShmLeaveMutex();\r\n}\r\n\r\n/*\r\n** This function is called to obtain a pointer to region iRegion of the\r\n** shared-memory associated with the database file id. Shared-memory regions\r\n** are numbered starting from zero. Each shared-memory region is szRegion\r\n** bytes in size.\r\n**\r\n** If an error occurs, an error code is returned and *pp is set to NULL.\r\n**\r\n** Otherwise, if the bExtend parameter is 0 and the requested shared-memory\r\n** region has not been allocated (by any client, including one running in a\r\n** separate process), then *pp is set to NULL and SQLITE_OK returned. If\r\n** bExtend is non-zero and the requested shared-memory region has not yet\r\n** been allocated, it is allocated by this function.\r\n**\r\n** If the shared-memory region has already been allocated or is allocated by\r\n** this call as described above, then it is mapped into this processes\r\n** address space (if it is not already), *pp is set to point to the mapped\r\n** memory and SQLITE_OK returned.\r\n*/\r\nstatic int os2ShmMap(\r\n  sqlite3_file *id,               /* Handle open on database file */\r\n  int iRegion,                    /* Region to retrieve */\r\n  int szRegion,                   /* Size of regions */\r\n  int bExtend,                    /* True to extend block if necessary */\r\n  void volatile **pp              /* OUT: Mapped memory */\r\n){\r\n  PVOID pvTemp;\r\n  void **apRegion;\r\n  os2ShmNode *pNode;\r\n  int n, rc = SQLITE_OK;\r\n  char shmName[CCHMAXPATH];\r\n  os2File *pFile = (os2File*)id;\r\n  \r\n  *pp = NULL;\r\n\r\n  if( !pFile->pShmLink )\r\n    rc = os2OpenSharedMemory( pFile, szRegion );\r\n  \r\n  if( rc == SQLITE_OK ) {\r\n    pNode = pFile->pShmLink->pShmNode ;\r\n    \r\n    sqlite3_mutex_enter(pNode->mutex);\r\n    \r\n    assert( szRegion==pNode->szRegion );\r\n\r\n    /* Unmapped region ? */\r\n    if( iRegion >= pNode->nRegion ) {\r\n      /* Prevent other processes from resizing the shared memory */\r\n      os2ShmSystemLock(pNode, _SHM_WRLCK_WAIT, OS2_SHM_DMS, 1);\r\n\r\n      apRegion = sqlite3_realloc(\r\n        pNode->apRegion, (iRegion + 1) * sizeof(apRegion[0]));\r\n\r\n      if( apRegion ) {\r\n        pNode->apRegion = apRegion;\r\n\r\n        while( pNode->nRegion <= iRegion ) {\r\n          sprintf(shmName, \"%s-%u\", \r\n                  pNode->shmBaseName, pNode->nRegion);\r\n\r\n          if( DosGetNamedSharedMem(&pvTemp, (PSZ)shmName, \r\n                PAG_READ | PAG_WRITE) != NO_ERROR ) {\r\n            if( !bExtend )\r\n              break;\r\n\r\n            if( DosAllocSharedMem(&pvTemp, (PSZ)shmName, szRegion,\r\n                  PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_ANY) != NO_ERROR && \r\n                DosAllocSharedMem(&pvTemp, (PSZ)shmName, szRegion,\r\n                  PAG_READ | PAG_WRITE | PAG_COMMIT) != NO_ERROR ) { \r\n              rc = SQLITE_NOMEM;\r\n              break;\r\n            }\r\n          }\r\n\r\n          apRegion[pNode->nRegion++] = pvTemp;\r\n        }\r\n\r\n        /* zero out remaining entries */ \r\n        for( n = pNode->nRegion; n <= iRegion; n++ )\r\n          pNode->apRegion[n] = NULL;\r\n\r\n        /* Return this region (maybe zero) */\r\n        *pp = pNode->apRegion[iRegion];\r\n      } else {\r\n        rc = SQLITE_NOMEM;\r\n      }\r\n\r\n      /* Allow other processes to resize the shared memory */\r\n      os2ShmSystemLock(pNode, _SHM_UNLCK, OS2_SHM_DMS, 1);\r\n      \r\n    } else {\r\n      /* Region has been mapped previously */\r\n      *pp = pNode->apRegion[iRegion];\r\n    }\r\n\r\n    sqlite3_mutex_leave(pNode->mutex);\r\n  } \r\n\r\n  ERR_TRACE(rc, (\"os2ShmMap: %s iRgn = %d, szRgn = %d, bExt = %d : %d\\n\", \r\n                 pFile->zFullPathCp, iRegion, szRegion, bExtend, rc))\r\n          \r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close a connection to shared-memory.  Delete the underlying\r\n** storage if deleteFlag is true.\r\n**\r\n** If there is no shared memory associated with the connection then this\r\n** routine is a harmless no-op.\r\n*/\r\nstatic int os2ShmUnmap(\r\n  sqlite3_file *id,               /* The underlying database file */\r\n  int deleteFlag                  /* Delete shared-memory if true */\r\n){\r\n  os2File *pFile = (os2File*)id;\r\n  os2ShmLink *pLink = pFile->pShmLink;\r\n  \r\n  if( pLink ) {\r\n    int nRef = -1;\r\n    os2ShmLink **ppLink;\r\n    os2ShmNode *pNode = pLink->pShmNode;\r\n\r\n    sqlite3_mutex_enter(pNode->mutex);\r\n    \r\n    for( ppLink = &pNode->pFirst;\r\n         *ppLink && *ppLink != pLink;\r\n         ppLink = &(*ppLink)->pNext )   ;\r\n         \r\n    assert(*ppLink);\r\n\r\n    if( *ppLink ) {\r\n      *ppLink = pLink->pNext;\r\n      nRef = --pNode->nRef;\r\n    } else {\r\n      ERR_TRACE(1, (\"os2ShmUnmap: link not found ! %s\\n\", \r\n                    pNode->shmBaseName))\r\n    }\r\n    \r\n    pFile->pShmLink = NULL;\r\n    sqlite3_free(pLink);\r\n\r\n    sqlite3_mutex_leave(pNode->mutex);\r\n    \r\n    if( nRef == 0 )\r\n      os2PurgeShmNodes( deleteFlag );\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Change the lock state for a shared-memory segment.\r\n**\r\n** Note that the relationship between SHAREd and EXCLUSIVE locks is a little\r\n** different here than in posix.  In xShmLock(), one can go from unlocked\r\n** to shared and back or from unlocked to exclusive and back.  But one may\r\n** not go from shared to exclusive or from exclusive to shared.\r\n*/\r\nstatic int os2ShmLock(\r\n  sqlite3_file *id,          /* Database file holding the shared memory */\r\n  int ofst,                  /* First lock to acquire or release */\r\n  int n,                     /* Number of locks to acquire or release */\r\n  int flags                  /* What to do with the lock */\r\n){\r\n  u32 mask;                             /* Mask of locks to take or release */\r\n  int rc = SQLITE_OK;                   /* Result code */\r\n  os2File *pFile = (os2File*)id;\r\n  os2ShmLink *p = pFile->pShmLink;      /* The shared memory being locked */\r\n  os2ShmLink *pX;                       /* For looping over all siblings */\r\n  os2ShmNode *pShmNode = p->pShmNode;   /* Our node */\r\n  \r\n  assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );\r\n  assert( n>=1 );\r\n  assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)\r\n       || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)\r\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)\r\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) );\r\n  assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 );\r\n\r\n  mask = (u32)((1U<<(ofst+n)) - (1U<<ofst));\r\n  assert( n>1 || mask==(1<<ofst) );\r\n\r\n\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n\r\n  if( flags & SQLITE_SHM_UNLOCK ){\r\n    u32 allMask = 0; /* Mask of locks held by siblings */\r\n\r\n    /* See if any siblings hold this same lock */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( pX==p ) continue;\r\n      assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );\r\n      allMask |= pX->sharedMask;\r\n    }\r\n\r\n    /* Unlock the system-level locks */\r\n    if( (mask & allMask)==0 ){\r\n      rc = os2ShmSystemLock(pShmNode, _SHM_UNLCK, ofst+OS2_SHM_BASE, n);\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n\r\n    /* Undo the local locks */\r\n    if( rc==SQLITE_OK ){\r\n      p->exclMask &= ~mask;\r\n      p->sharedMask &= ~mask;\r\n    } \r\n  }else if( flags & SQLITE_SHM_SHARED ){\r\n    u32 allShared = 0;  /* Union of locks held by connections other than \"p\" */\r\n\r\n    /* Find out which shared locks are already held by sibling connections.\r\n    ** If any sibling already holds an exclusive lock, go ahead and return\r\n    ** SQLITE_BUSY.\r\n    */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( (pX->exclMask & mask)!=0 ){\r\n        rc = SQLITE_BUSY;\r\n        break;\r\n      }\r\n      allShared |= pX->sharedMask;\r\n    }\r\n\r\n    /* Get shared locks at the system level, if necessary */\r\n    if( rc==SQLITE_OK ){\r\n      if( (allShared & mask)==0 ){\r\n        rc = os2ShmSystemLock(pShmNode, _SHM_RDLCK, ofst+OS2_SHM_BASE, n);\r\n      }else{\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n\r\n    /* Get the local shared locks */\r\n    if( rc==SQLITE_OK ){\r\n      p->sharedMask |= mask;\r\n    }\r\n  }else{\r\n    /* Make sure no sibling connections hold locks that will block this\r\n    ** lock.  If any do, return SQLITE_BUSY right away.\r\n    */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){\r\n        rc = SQLITE_BUSY;\r\n        break;\r\n      }\r\n    }\r\n  \r\n    /* Get the exclusive locks at the system level.  Then if successful\r\n    ** also mark the local connection as being locked.\r\n    */\r\n    if( rc==SQLITE_OK ){\r\n      rc = os2ShmSystemLock(pShmNode, _SHM_WRLCK, ofst+OS2_SHM_BASE, n);\r\n      if( rc==SQLITE_OK ){\r\n        assert( (p->sharedMask & mask)==0 );\r\n        p->exclMask |= mask;\r\n      }\r\n    }\r\n  }\r\n\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  \r\n  OSTRACE((\"SHM-LOCK shmid-%d, pid-%d got %03x,%03x %s\\n\",\r\n           p->id, (int)GetCurrentProcessId(), p->sharedMask, p->exclMask,\r\n           rc ? \"failed\" : \"ok\"));\r\n\r\n  ERR_TRACE(rc, (\"os2ShmLock: ofst = %d, n = %d, flags = 0x%x -> %d \\n\", \r\n                 ofst, n, flags, rc))\r\n                  \r\n  return rc; \r\n}\r\n\r\n/*\r\n** Implement a memory barrier or memory fence on shared memory.\r\n**\r\n** All loads and stores begun before the barrier must complete before\r\n** any load or store begun after the barrier.\r\n*/\r\nstatic void os2ShmBarrier(\r\n  sqlite3_file *id                /* Database file holding the shared memory */\r\n){\r\n  UNUSED_PARAMETER(id);\r\n  os2ShmEnterMutex();\r\n  os2ShmLeaveMutex();\r\n}\r\n\r\n#else\r\n# define os2ShmMap     0\r\n# define os2ShmLock    0\r\n# define os2ShmBarrier 0\r\n# define os2ShmUnmap   0\r\n#endif /* #ifndef SQLITE_OMIT_WAL */\r\n\r\n\r\n/*\r\n** This vector defines all the methods that can operate on an\r\n** sqlite3_file for os2.\r\n*/\r\nstatic const sqlite3_io_methods os2IoMethod = {\r\n  2,                              /* iVersion */\r\n  os2Close,                       /* xClose */\r\n  os2Read,                        /* xRead */\r\n  os2Write,                       /* xWrite */\r\n  os2Truncate,                    /* xTruncate */\r\n  os2Sync,                        /* xSync */\r\n  os2FileSize,                    /* xFileSize */\r\n  os2Lock,                        /* xLock */\r\n  os2Unlock,                      /* xUnlock */\r\n  os2CheckReservedLock,           /* xCheckReservedLock */\r\n  os2FileControl,                 /* xFileControl */\r\n  os2SectorSize,                  /* xSectorSize */\r\n  os2DeviceCharacteristics,       /* xDeviceCharacteristics */\r\n  os2ShmMap,                      /* xShmMap */\r\n  os2ShmLock,                     /* xShmLock */\r\n  os2ShmBarrier,                  /* xShmBarrier */\r\n  os2ShmUnmap                     /* xShmUnmap */\r\n};\r\n\r\n\r\n/***************************************************************************\r\n** Here ends the I/O methods that form the sqlite3_io_methods object.\r\n**\r\n** The next block of code implements the VFS methods.\r\n****************************************************************************/\r\n\r\n/*\r\n** Create a temporary file name in zBuf.  zBuf must be big enough to\r\n** hold at pVfs->mxPathname characters.\r\n*/\r\nstatic int getTempname(int nBuf, char *zBuf ){\r\n  static const char zChars[] =\r\n    \"abcdefghijklmnopqrstuvwxyz\"\r\n    \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\r\n    \"0123456789\";\r\n  int i, j;\r\n  PSZ zTempPathCp;      \r\n  char zTempPath[CCHMAXPATH];\r\n  ULONG ulDriveNum, ulDriveMap;\r\n  \r\n  /* It's odd to simulate an io-error here, but really this is just\r\n  ** using the io-error infrastructure to test that SQLite handles this\r\n  ** function failing. \r\n  */\r\n  SimulateIOError( return SQLITE_IOERR );\r\n\r\n  if( sqlite3_temp_directory ) {\r\n    sqlite3_snprintf(CCHMAXPATH-30, zTempPath, \"%s\", sqlite3_temp_directory);\r\n  } else if( DosScanEnv( (PSZ)\"TEMP\",   &zTempPathCp ) == NO_ERROR ||\r\n             DosScanEnv( (PSZ)\"TMP\",    &zTempPathCp ) == NO_ERROR ||\r\n             DosScanEnv( (PSZ)\"TMPDIR\", &zTempPathCp ) == NO_ERROR ) {\r\n    char *zTempPathUTF = convertCpPathToUtf8( (char *)zTempPathCp );\r\n    sqlite3_snprintf(CCHMAXPATH-30, zTempPath, \"%s\", zTempPathUTF);\r\n    free( zTempPathUTF );\r\n  } else if( DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap ) == NO_ERROR ) {\r\n    zTempPath[0] = (char)('A' + ulDriveNum - 1);\r\n    zTempPath[1] = ':'; \r\n    zTempPath[2] = '\\0'; \r\n  } else {\r\n    zTempPath[0] = '\\0'; \r\n  }\r\n  \r\n  /* Strip off a trailing slashes or backslashes, otherwise we would get *\r\n   * multiple (back)slashes which causes DosOpen() to fail.              *\r\n   * Trailing spaces are not allowed, either.                            */\r\n  j = sqlite3Strlen30(zTempPath);\r\n  while( j > 0 && ( zTempPath[j-1] == '\\\\' || zTempPath[j-1] == '/' || \r\n                    zTempPath[j-1] == ' ' ) ){\r\n    j--;\r\n  }\r\n  zTempPath[j] = '\\0';\r\n  \r\n  /* We use 20 bytes to randomize the name */\r\n  sqlite3_snprintf(nBuf-22, zBuf,\r\n                   \"%s\\\\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);\r\n  j = sqlite3Strlen30(zBuf);\r\n  sqlite3_randomness( 20, &zBuf[j] );\r\n  for( i = 0; i < 20; i++, j++ ){\r\n    zBuf[j] = zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];\r\n  }\r\n  zBuf[j] = 0;\r\n\r\n  OSTRACE(( \"TEMP FILENAME: %s\\n\", zBuf ));\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Turn a relative pathname into a full pathname.  Write the full\r\n** pathname into zFull[].  zFull[] will be at least pVfs->mxPathname\r\n** bytes in size.\r\n*/\r\nstatic int os2FullPathname(\r\n  sqlite3_vfs *pVfs,          /* Pointer to vfs object */\r\n  const char *zRelative,      /* Possibly relative input path */\r\n  int nFull,                  /* Size of output buffer in bytes */\r\n  char *zFull                 /* Output buffer */\r\n){\r\n  char *zRelativeCp = convertUtf8PathToCp( zRelative );\r\n  char zFullCp[CCHMAXPATH] = \"\\0\";\r\n  char *zFullUTF;\r\n  APIRET rc = DosQueryPathInfo( (PSZ)zRelativeCp, FIL_QUERYFULLNAME, \r\n                                zFullCp, CCHMAXPATH );\r\n  free( zRelativeCp );\r\n  zFullUTF = convertCpPathToUtf8( zFullCp );\r\n  sqlite3_snprintf( nFull, zFull, zFullUTF );\r\n  free( zFullUTF );\r\n  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;\r\n}\r\n\r\n\r\n/*\r\n** Open a file.\r\n*/\r\nstatic int os2Open(\r\n  sqlite3_vfs *pVfs,            /* Not used */\r\n  const char *zName,            /* Name of the file (UTF-8) */\r\n  sqlite3_file *id,             /* Write the SQLite file handle here */\r\n  int flags,                    /* Open mode flags */\r\n  int *pOutFlags                /* Status return flags */\r\n){\r\n  HFILE h;\r\n  ULONG ulOpenFlags = 0;\r\n  ULONG ulOpenMode = 0;\r\n  ULONG ulAction = 0;\r\n  ULONG rc;\r\n  os2File *pFile = (os2File*)id;\r\n  const char *zUtf8Name = zName;\r\n  char *zNameCp;\r\n  char  zTmpname[CCHMAXPATH];\r\n\r\n  int isExclusive  = (flags & SQLITE_OPEN_EXCLUSIVE);\r\n  int isCreate     = (flags & SQLITE_OPEN_CREATE);\r\n  int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);\r\n#ifndef NDEBUG\r\n  int isDelete     = (flags & SQLITE_OPEN_DELETEONCLOSE);\r\n  int isReadonly   = (flags & SQLITE_OPEN_READONLY);\r\n  int eType        = (flags & 0xFFFFFF00);\r\n  int isOpenJournal = (isCreate && (\r\n        eType==SQLITE_OPEN_MASTER_JOURNAL \r\n     || eType==SQLITE_OPEN_MAIN_JOURNAL \r\n     || eType==SQLITE_OPEN_WAL\r\n  ));\r\n#endif\r\n\r\n  UNUSED_PARAMETER(pVfs);\r\n  assert( id!=0 );\r\n\r\n  /* Check the following statements are true: \r\n  **\r\n  **   (a) Exactly one of the READWRITE and READONLY flags must be set, and \r\n  **   (b) if CREATE is set, then READWRITE must also be set, and\r\n  **   (c) if EXCLUSIVE is set, then CREATE must also be set.\r\n  **   (d) if DELETEONCLOSE is set, then CREATE must also be set.\r\n  */\r\n  assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));\r\n  assert(isCreate==0 || isReadWrite);\r\n  assert(isExclusive==0 || isCreate);\r\n  assert(isDelete==0 || isCreate);\r\n\r\n  /* The main DB, main journal, WAL file and master journal are never \r\n  ** automatically deleted. Nor are they ever temporary files.  */\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL );\r\n\r\n  /* Assert that the upper layer has set one of the \"file-type\" flags. */\r\n  assert( eType==SQLITE_OPEN_MAIN_DB      || eType==SQLITE_OPEN_TEMP_DB \r\n       || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL \r\n       || eType==SQLITE_OPEN_SUBJOURNAL   || eType==SQLITE_OPEN_MASTER_JOURNAL \r\n       || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL\r\n  );\r\n\r\n  memset( pFile, 0, sizeof(*pFile) );\r\n  pFile->h = (HFILE)-1;\r\n\r\n  /* If the second argument to this function is NULL, generate a \r\n  ** temporary file name to use \r\n  */\r\n  if( !zUtf8Name ){\r\n    assert(isDelete && !isOpenJournal);\r\n    rc = getTempname(CCHMAXPATH, zTmpname);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    zUtf8Name = zTmpname;\r\n  }\r\n\r\n  if( isReadWrite ){\r\n    ulOpenMode |= OPEN_ACCESS_READWRITE;\r\n  }else{\r\n    ulOpenMode |= OPEN_ACCESS_READONLY;\r\n  }\r\n\r\n  /* Open in random access mode for possibly better speed.  Allow full\r\n  ** sharing because file locks will provide exclusive access when needed.\r\n  ** The handle should not be inherited by child processes and we don't \r\n  ** want popups from the critical error handler.\r\n  */\r\n  ulOpenMode |= OPEN_FLAGS_RANDOM | OPEN_SHARE_DENYNONE | \r\n                OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_FAIL_ON_ERROR;\r\n\r\n  /* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is \r\n  ** created. SQLite doesn't use it to indicate \"exclusive access\" \r\n  ** as it is usually understood.\r\n  */\r\n  if( isExclusive ){\r\n    /* Creates a new file, only if it does not already exist. */\r\n    /* If the file exists, it fails. */\r\n    ulOpenFlags |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS;\r\n  }else if( isCreate ){\r\n    /* Open existing file, or create if it doesn't exist */\r\n    ulOpenFlags |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;\r\n  }else{\r\n    /* Opens a file, only if it exists. */\r\n    ulOpenFlags |= OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;\r\n  }\r\n\r\n  zNameCp = convertUtf8PathToCp( zUtf8Name );\r\n  rc = DosOpen( (PSZ)zNameCp,\r\n                &h,\r\n                &ulAction,\r\n                0L,\r\n                FILE_NORMAL,\r\n                ulOpenFlags,\r\n                ulOpenMode,\r\n                (PEAOP2)NULL );\r\n  free( zNameCp );\r\n\r\n  if( rc != NO_ERROR ){\r\n    OSTRACE(( \"OPEN Invalid handle rc=%d: zName=%s, ulAction=%#lx, ulFlags=%#lx, ulMode=%#lx\\n\",\r\n              rc, zUtf8Name, ulAction, ulOpenFlags, ulOpenMode ));\r\n\r\n    if( isReadWrite ){\r\n      return os2Open( pVfs, zName, id,\r\n                      ((flags|SQLITE_OPEN_READONLY)&~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)),\r\n                      pOutFlags );\r\n    }else{\r\n      return SQLITE_CANTOPEN;\r\n    }\r\n  }\r\n\r\n  if( pOutFlags ){\r\n    *pOutFlags = isReadWrite ? SQLITE_OPEN_READWRITE : SQLITE_OPEN_READONLY;\r\n  }\r\n\r\n  os2FullPathname( pVfs, zUtf8Name, sizeof( zTmpname ), zTmpname );\r\n  pFile->zFullPathCp = convertUtf8PathToCp( zTmpname );\r\n  pFile->pMethod = &os2IoMethod;\r\n  pFile->flags = flags;\r\n  pFile->h = h;\r\n\r\n  OpenCounter(+1);\r\n  OSTRACE(( \"OPEN %d pOutFlags=%d\\n\", pFile->h, pOutFlags ));\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Delete the named file.\r\n*/\r\nstatic int os2Delete(\r\n  sqlite3_vfs *pVfs,                     /* Not used on os2 */\r\n  const char *zFilename,                 /* Name of file to delete */\r\n  int syncDir                            /* Not used on os2 */\r\n){\r\n  APIRET rc;\r\n  char *zFilenameCp;\r\n  SimulateIOError( return SQLITE_IOERR_DELETE );\r\n  zFilenameCp = convertUtf8PathToCp( zFilename );\r\n  rc = DosDelete( (PSZ)zFilenameCp );\r\n  free( zFilenameCp );\r\n  OSTRACE(( \"DELETE \\\"%s\\\"\\n\", zFilename ));\r\n  return (rc == NO_ERROR ||\r\n          rc == ERROR_FILE_NOT_FOUND ||\r\n          rc == ERROR_PATH_NOT_FOUND ) ? SQLITE_OK : SQLITE_IOERR_DELETE;\r\n}\r\n\r\n/*\r\n** Check the existance and status of a file.\r\n*/\r\nstatic int os2Access(\r\n  sqlite3_vfs *pVfs,        /* Not used on os2 */\r\n  const char *zFilename,    /* Name of file to check */\r\n  int flags,                /* Type of test to make on this file */\r\n  int *pOut                 /* Write results here */\r\n){\r\n  APIRET rc;\r\n  FILESTATUS3 fsts3ConfigInfo;\r\n  char *zFilenameCp;\r\n\r\n  UNUSED_PARAMETER(pVfs);\r\n  SimulateIOError( return SQLITE_IOERR_ACCESS; );\r\n  \r\n  zFilenameCp = convertUtf8PathToCp( zFilename );\r\n  rc = DosQueryPathInfo( (PSZ)zFilenameCp, FIL_STANDARD,\r\n                         &fsts3ConfigInfo, sizeof(FILESTATUS3) );\r\n  free( zFilenameCp );\r\n  OSTRACE(( \"ACCESS fsts3ConfigInfo.attrFile=%d flags=%d rc=%d\\n\",\r\n            fsts3ConfigInfo.attrFile, flags, rc ));\r\n\r\n  switch( flags ){\r\n    case SQLITE_ACCESS_EXISTS:\r\n      /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file\r\n      ** as if it does not exist.\r\n      */\r\n      if( fsts3ConfigInfo.cbFile == 0 ) \r\n        rc = ERROR_FILE_NOT_FOUND;\r\n      break;\r\n    case SQLITE_ACCESS_READ:\r\n      break;\r\n    case SQLITE_ACCESS_READWRITE:\r\n      if( fsts3ConfigInfo.attrFile & FILE_READONLY )\r\n        rc = ERROR_ACCESS_DENIED;\r\n      break;\r\n    default:\r\n      rc = ERROR_FILE_NOT_FOUND;\r\n      assert( !\"Invalid flags argument\" );\r\n  }\r\n\r\n  *pOut = (rc == NO_ERROR);\r\n  OSTRACE(( \"ACCESS %s flags %d: rc=%d\\n\", zFilename, flags, *pOut ));\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\n/*\r\n** Interfaces for opening a shared library, finding entry points\r\n** within the shared library, and closing the shared library.\r\n*/\r\n/*\r\n** Interfaces for opening a shared library, finding entry points\r\n** within the shared library, and closing the shared library.\r\n*/\r\nstatic void *os2DlOpen(sqlite3_vfs *pVfs, const char *zFilename){\r\n  HMODULE hmod;\r\n  APIRET rc;\r\n  char *zFilenameCp = convertUtf8PathToCp(zFilename);\r\n  rc = DosLoadModule(NULL, 0, (PSZ)zFilenameCp, &hmod);\r\n  free(zFilenameCp);\r\n  return rc != NO_ERROR ? 0 : (void*)hmod;\r\n}\r\n/*\r\n** A no-op since the error code is returned on the DosLoadModule call.\r\n** os2Dlopen returns zero if DosLoadModule is not successful.\r\n*/\r\nstatic void os2DlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){\r\n/* no-op */\r\n}\r\nstatic void (*os2DlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){\r\n  PFN pfn;\r\n  APIRET rc;\r\n  rc = DosQueryProcAddr((HMODULE)pHandle, 0L, (PSZ)zSymbol, &pfn);\r\n  if( rc != NO_ERROR ){\r\n    /* if the symbol itself was not found, search again for the same\r\n     * symbol with an extra underscore, that might be needed depending\r\n     * on the calling convention */\r\n    char _zSymbol[256] = \"_\";\r\n    strncat(_zSymbol, zSymbol, 254);\r\n    rc = DosQueryProcAddr((HMODULE)pHandle, 0L, (PSZ)_zSymbol, &pfn);\r\n  }\r\n  return rc != NO_ERROR ? 0 : (void(*)(void))pfn;\r\n}\r\nstatic void os2DlClose(sqlite3_vfs *pVfs, void *pHandle){\r\n  DosFreeModule((HMODULE)pHandle);\r\n}\r\n#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */\r\n  #define os2DlOpen 0\r\n  #define os2DlError 0\r\n  #define os2DlSym 0\r\n  #define os2DlClose 0\r\n#endif\r\n\r\n\r\n/*\r\n** Write up to nBuf bytes of randomness into zBuf.\r\n*/\r\nstatic int os2Randomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf ){\r\n  int n = 0;\r\n#if defined(SQLITE_TEST)\r\n  n = nBuf;\r\n  memset(zBuf, 0, nBuf);\r\n#else\r\n  int i;                           \r\n  PPIB ppib;\r\n  PTIB ptib;\r\n  DATETIME dt; \r\n  static unsigned c = 0;\r\n  /* Ordered by variation probability */\r\n  static ULONG svIdx[6] = { QSV_MS_COUNT, QSV_TIME_LOW,\r\n                            QSV_MAXPRMEM, QSV_MAXSHMEM,\r\n                            QSV_TOTAVAILMEM, QSV_TOTRESMEM };\r\n\r\n  /* 8 bytes; timezone and weekday don't increase the randomness much */\r\n  if( (int)sizeof(dt)-3 <= nBuf - n ){\r\n    c += 0x0100;\r\n    DosGetDateTime(&dt);\r\n    dt.year = (USHORT)((dt.year - 1900) | c);\r\n    memcpy(&zBuf[n], &dt, sizeof(dt)-3);\r\n    n += sizeof(dt)-3;\r\n  }\r\n\r\n  /* 4 bytes; PIDs and TIDs are 16 bit internally, so combine them */\r\n  if( (int)sizeof(ULONG) <= nBuf - n ){\r\n    DosGetInfoBlocks(&ptib, &ppib);\r\n    *(PULONG)&zBuf[n] = MAKELONG(ppib->pib_ulpid,\r\n                                 ptib->tib_ptib2->tib2_ultid);\r\n    n += sizeof(ULONG);\r\n  }\r\n\r\n  /* Up to 6 * 4 bytes; variables depend on the system state */\r\n  for( i = 0; i < 6 && (int)sizeof(ULONG) <= nBuf - n; i++ ){\r\n    DosQuerySysInfo(svIdx[i], svIdx[i], \r\n                    (PULONG)&zBuf[n], sizeof(ULONG));\r\n    n += sizeof(ULONG);\r\n  } \r\n#endif\r\n\r\n  return n;\r\n}\r\n\r\n/*\r\n** Sleep for a little while.  Return the amount of time slept.\r\n** The argument is the number of microseconds we want to sleep.\r\n** The return value is the number of microseconds of sleep actually\r\n** requested from the underlying operating system, a number which\r\n** might be greater than or equal to the argument, but not less\r\n** than the argument.\r\n*/\r\nstatic int os2Sleep( sqlite3_vfs *pVfs, int microsec ){\r\n  DosSleep( (microsec/1000) );\r\n  return microsec;\r\n}\r\n\r\n/*\r\n** The following variable, if set to a non-zero value, becomes the result\r\n** returned from sqlite3OsCurrentTime().  This is used for testing.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_current_time = 0;\r\n#endif\r\n\r\n/*\r\n** Find the current time (in Universal Coordinated Time).  Write into *piNow\r\n** the current time and date as a Julian Day number times 86_400_000.  In\r\n** other words, write into *piNow the number of milliseconds since the Julian\r\n** epoch of noon in Greenwich on November 24, 4714 B.C according to the\r\n** proleptic Gregorian calendar.\r\n**\r\n** On success, return 0.  Return 1 if the time and date cannot be found.\r\n*/\r\nstatic int os2CurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){\r\n#ifdef SQLITE_TEST\r\n  static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;\r\n#endif\r\n  int year, month, datepart, timepart;\r\n \r\n  DATETIME dt;\r\n  DosGetDateTime( &dt );\r\n\r\n  year = dt.year;\r\n  month = dt.month;\r\n\r\n  /* Calculations from http://www.astro.keele.ac.uk/~rno/Astronomy/hjd.html\r\n  ** http://www.astro.keele.ac.uk/~rno/Astronomy/hjd-0.1.c\r\n  ** Calculate the Julian days\r\n  */\r\n  datepart = (int)dt.day - 32076 +\r\n    1461*(year + 4800 + (month - 14)/12)/4 +\r\n    367*(month - 2 - (month - 14)/12*12)/12 -\r\n    3*((year + 4900 + (month - 14)/12)/100)/4;\r\n\r\n  /* Time in milliseconds, hours to noon added */\r\n  timepart = 12*3600*1000 + dt.hundredths*10 + dt.seconds*1000 +\r\n    ((int)dt.minutes + dt.timezone)*60*1000 + dt.hours*3600*1000;\r\n\r\n  *piNow = (sqlite3_int64)datepart*86400*1000 + timepart;\r\n   \r\n#ifdef SQLITE_TEST\r\n  if( sqlite3_current_time ){\r\n    *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch;\r\n  }\r\n#endif\r\n\r\n  UNUSED_PARAMETER(pVfs);\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Find the current time (in Universal Coordinated Time).  Write the\r\n** current time and date as a Julian Day number into *prNow and\r\n** return 0.  Return 1 if the time and date cannot be found.\r\n*/\r\nstatic int os2CurrentTime( sqlite3_vfs *pVfs, double *prNow ){\r\n  int rc;\r\n  sqlite3_int64 i;\r\n  rc = os2CurrentTimeInt64(pVfs, &i);\r\n  if( !rc ){\r\n    *prNow = i/86400000.0;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The idea is that this function works like a combination of\r\n** GetLastError() and FormatMessage() on windows (or errno and\r\n** strerror_r() on unix). After an error is returned by an OS\r\n** function, SQLite calls this function with zBuf pointing to\r\n** a buffer of nBuf bytes. The OS layer should populate the\r\n** buffer with a nul-terminated UTF-8 encoded error message\r\n** describing the last IO error to have occurred within the calling\r\n** thread.\r\n**\r\n** If the error message is too large for the supplied buffer,\r\n** it should be truncated. The return value of xGetLastError\r\n** is zero if the error message fits in the buffer, or non-zero\r\n** otherwise (if the message was truncated). If non-zero is returned,\r\n** then it is not necessary to include the nul-terminator character\r\n** in the output buffer.\r\n**\r\n** Not supplying an error message will have no adverse effect\r\n** on SQLite. It is fine to have an implementation that never\r\n** returns an error message:\r\n**\r\n**   int xGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){\r\n**     assert(zBuf[0]=='\\0');\r\n**     return 0;\r\n**   }\r\n**\r\n** However if an error message is supplied, it will be incorporated\r\n** by sqlite into the error message available to the user using\r\n** sqlite3_errmsg(), possibly making IO errors easier to debug.\r\n*/\r\nstatic int os2GetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){\r\n  assert(zBuf[0]=='\\0');\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Initialize and deinitialize the operating system interface.\r\n*/\r\nSQLITE_API int sqlite3_os_init(void){\r\n  static sqlite3_vfs os2Vfs = {\r\n    3,                 /* iVersion */\r\n    sizeof(os2File),   /* szOsFile */\r\n    CCHMAXPATH,        /* mxPathname */\r\n    0,                 /* pNext */\r\n    \"os2\",             /* zName */\r\n    0,                 /* pAppData */\r\n\r\n    os2Open,           /* xOpen */\r\n    os2Delete,         /* xDelete */\r\n    os2Access,         /* xAccess */\r\n    os2FullPathname,   /* xFullPathname */\r\n    os2DlOpen,         /* xDlOpen */\r\n    os2DlError,        /* xDlError */\r\n    os2DlSym,          /* xDlSym */\r\n    os2DlClose,        /* xDlClose */\r\n    os2Randomness,     /* xRandomness */\r\n    os2Sleep,          /* xSleep */\r\n    os2CurrentTime,    /* xCurrentTime */\r\n    os2GetLastError,   /* xGetLastError */\r\n    os2CurrentTimeInt64, /* xCurrentTimeInt64 */\r\n    0,                 /* xSetSystemCall */\r\n    0,                 /* xGetSystemCall */\r\n    0                  /* xNextSystemCall */\r\n  };\r\n  sqlite3_vfs_register(&os2Vfs, 1);\r\n  initUconvObjects();\r\n/*  sqlite3OSTrace = 1; */\r\n  return SQLITE_OK;\r\n}\r\nSQLITE_API int sqlite3_os_end(void){\r\n  freeUconvObjects();\r\n  return SQLITE_OK;\r\n}\r\n\r\n#endif /* SQLITE_OS_OS2 */\r\n\r\n/************** End of os_os2.c **********************************************/\r\n/************** Begin file os_unix.c *****************************************/\r\n/*\r\n** 2004 May 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains the VFS implementation for unix-like operating systems\r\n** include Linux, MacOSX, *BSD, QNX, VxWorks, AIX, HPUX, and others.\r\n**\r\n** There are actually several different VFS implementations in this file.\r\n** The differences are in the way that file locking is done.  The default\r\n** implementation uses Posix Advisory Locks.  Alternative implementations\r\n** use flock(), dot-files, various proprietary locking schemas, or simply\r\n** skip locking all together.\r\n**\r\n** This source file is organized into divisions where the logic for various\r\n** subfunctions is contained within the appropriate division.  PLEASE\r\n** KEEP THE STRUCTURE OF THIS FILE INTACT.  New code should be placed\r\n** in the correct division and should be clearly labeled.\r\n**\r\n** The layout of divisions is as follows:\r\n**\r\n**   *  General-purpose declarations and utility functions.\r\n**   *  Unique file ID logic used by VxWorks.\r\n**   *  Various locking primitive implementations (all except proxy locking):\r\n**      + for Posix Advisory Locks\r\n**      + for no-op locks\r\n**      + for dot-file locks\r\n**      + for flock() locking\r\n**      + for named semaphore locks (VxWorks only)\r\n**      + for AFP filesystem locks (MacOSX only)\r\n**   *  sqlite3_file methods not associated with locking.\r\n**   *  Definitions of sqlite3_io_methods objects for all locking\r\n**      methods plus \"finder\" functions for each locking method.\r\n**   *  sqlite3_vfs method implementations.\r\n**   *  Locking primitives for the proxy uber-locking-method. (MacOSX only)\r\n**   *  Definitions of sqlite3_vfs objects for all locking methods\r\n**      plus implementations of sqlite3_os_init() and sqlite3_os_end().\r\n*/\r\n#if SQLITE_OS_UNIX              /* This file is used on unix only */\r\n\r\n/*\r\n** There are various methods for file locking used for concurrency\r\n** control:\r\n**\r\n**   1. POSIX locking (the default),\r\n**   2. No locking,\r\n**   3. Dot-file locking,\r\n**   4. flock() locking,\r\n**   5. AFP locking (OSX only),\r\n**   6. Named POSIX semaphores (VXWorks only),\r\n**   7. proxy locking. (OSX only)\r\n**\r\n** Styles 4, 5, and 7 are only available of SQLITE_ENABLE_LOCKING_STYLE\r\n** is defined to 1.  The SQLITE_ENABLE_LOCKING_STYLE also enables automatic\r\n** selection of the appropriate locking style based on the filesystem\r\n** where the database is located.  \r\n*/\r\n#if !defined(SQLITE_ENABLE_LOCKING_STYLE)\r\n#  if defined(__APPLE__)\r\n#    define SQLITE_ENABLE_LOCKING_STYLE 1\r\n#  else\r\n#    define SQLITE_ENABLE_LOCKING_STYLE 0\r\n#  endif\r\n#endif\r\n\r\n/*\r\n** Define the OS_VXWORKS pre-processor macro to 1 if building on \r\n** vxworks, or 0 otherwise.\r\n*/\r\n#ifndef OS_VXWORKS\r\n#  if defined(__RTP__) || defined(_WRS_KERNEL)\r\n#    define OS_VXWORKS 1\r\n#  else\r\n#    define OS_VXWORKS 0\r\n#  endif\r\n#endif\r\n\r\n/*\r\n** These #defines should enable >2GB file support on Posix if the\r\n** underlying operating system supports it.  If the OS lacks\r\n** large file support, these should be no-ops.\r\n**\r\n** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch\r\n** on the compiler command line.  This is necessary if you are compiling\r\n** on a recent machine (ex: RedHat 7.2) but you want your code to work\r\n** on an older machine (ex: RedHat 6.0).  If you compile on RedHat 7.2\r\n** without this option, LFS is enable.  But LFS does not exist in the kernel\r\n** in RedHat 6.0, so the code won't work.  Hence, for maximum binary\r\n** portability you should omit LFS.\r\n**\r\n** The previous paragraph was written in 2005.  (This paragraph is written\r\n** on 2008-11-28.) These days, all Linux kernels support large files, so\r\n** you should probably leave LFS enabled.  But some embedded platforms might\r\n** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful.\r\n*/\r\n#ifndef SQLITE_DISABLE_LFS\r\n# define _LARGE_FILE       1\r\n# ifndef _FILE_OFFSET_BITS\r\n#   define _FILE_OFFSET_BITS 64\r\n# endif\r\n# define _LARGEFILE_SOURCE 1\r\n#endif\r\n\r\n/*\r\n** standard include files.\r\n*/\r\n#include <sys/types.h>\r\n#include <sys/stat.h>\r\n#include <fcntl.h>\r\n#include <unistd.h>\r\n/* #include <time.h> */\r\n#include <sys/time.h>\r\n#include <errno.h>\r\n#ifndef SQLITE_OMIT_WAL\r\n#include <sys/mman.h>\r\n#endif\r\n\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n# include <sys/ioctl.h>\r\n# if OS_VXWORKS\r\n#  include <semaphore.h>\r\n#  include <limits.h>\r\n# else\r\n#  include <sys/file.h>\r\n#  include <sys/param.h>\r\n# endif\r\n#endif /* SQLITE_ENABLE_LOCKING_STYLE */\r\n\r\n#if defined(__APPLE__) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)\r\n# include <sys/mount.h>\r\n#endif\r\n\r\n#ifdef HAVE_UTIME\r\n# include <utime.h>\r\n#endif\r\n\r\n/*\r\n** Allowed values of unixFile.fsFlags\r\n*/\r\n#define SQLITE_FSFLAGS_IS_MSDOS     0x1\r\n\r\n/*\r\n** If we are to be thread-safe, include the pthreads header and define\r\n** the SQLITE_UNIX_THREADS macro.\r\n*/\r\n#if SQLITE_THREADSAFE\r\n/* # include <pthread.h> */\r\n# define SQLITE_UNIX_THREADS 1\r\n#endif\r\n\r\n/*\r\n** Default permissions when creating a new file\r\n*/\r\n#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS\r\n# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644\r\n#endif\r\n\r\n/*\r\n ** Default permissions when creating auto proxy dir\r\n */\r\n#ifndef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS\r\n# define SQLITE_DEFAULT_PROXYDIR_PERMISSIONS 0755\r\n#endif\r\n\r\n/*\r\n** Maximum supported path-length.\r\n*/\r\n#define MAX_PATHNAME 512\r\n\r\n/*\r\n** Only set the lastErrno if the error code is a real error and not \r\n** a normal expected return code of SQLITE_BUSY or SQLITE_OK\r\n*/\r\n#define IS_LOCK_ERROR(x)  ((x != SQLITE_OK) && (x != SQLITE_BUSY))\r\n\r\n/* Forward references */\r\ntypedef struct unixShm unixShm;               /* Connection shared memory */\r\ntypedef struct unixShmNode unixShmNode;       /* Shared memory instance */\r\ntypedef struct unixInodeInfo unixInodeInfo;   /* An i-node */\r\ntypedef struct UnixUnusedFd UnixUnusedFd;     /* An unused file descriptor */\r\n\r\n/*\r\n** Sometimes, after a file handle is closed by SQLite, the file descriptor\r\n** cannot be closed immediately. In these cases, instances of the following\r\n** structure are used to store the file descriptor while waiting for an\r\n** opportunity to either close or reuse it.\r\n*/\r\nstruct UnixUnusedFd {\r\n  int fd;                   /* File descriptor to close */\r\n  int flags;                /* Flags this file descriptor was opened with */\r\n  UnixUnusedFd *pNext;      /* Next unused file descriptor on same file */\r\n};\r\n\r\n/*\r\n** The unixFile structure is subclass of sqlite3_file specific to the unix\r\n** VFS implementations.\r\n*/\r\ntypedef struct unixFile unixFile;\r\nstruct unixFile {\r\n  sqlite3_io_methods const *pMethod;  /* Always the first entry */\r\n  sqlite3_vfs *pVfs;                  /* The VFS that created this unixFile */\r\n  unixInodeInfo *pInode;              /* Info about locks on this inode */\r\n  int h;                              /* The file descriptor */\r\n  unsigned char eFileLock;            /* The type of lock held on this fd */\r\n  unsigned short int ctrlFlags;       /* Behavioral bits.  UNIXFILE_* flags */\r\n  int lastErrno;                      /* The unix errno from last I/O error */\r\n  void *lockingContext;               /* Locking style specific state */\r\n  UnixUnusedFd *pUnused;              /* Pre-allocated UnixUnusedFd */\r\n  const char *zPath;                  /* Name of the file */\r\n  unixShm *pShm;                      /* Shared memory segment information */\r\n  int szChunk;                        /* Configured by FCNTL_CHUNK_SIZE */\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n  int openFlags;                      /* The flags specified at open() */\r\n#endif\r\n#if SQLITE_ENABLE_LOCKING_STYLE || defined(__APPLE__)\r\n  unsigned fsFlags;                   /* cached details from statfs() */\r\n#endif\r\n#if OS_VXWORKS\r\n  struct vxworksFileId *pId;          /* Unique file ID */\r\n#endif\r\n#ifndef NDEBUG\r\n  /* The next group of variables are used to track whether or not the\r\n  ** transaction counter in bytes 24-27 of database files are updated\r\n  ** whenever any part of the database changes.  An assertion fault will\r\n  ** occur if a file is updated without also updating the transaction\r\n  ** counter.  This test is made to avoid new problems similar to the\r\n  ** one described by ticket #3584. \r\n  */\r\n  unsigned char transCntrChng;   /* True if the transaction counter changed */\r\n  unsigned char dbUpdate;        /* True if any part of database file changed */\r\n  unsigned char inNormalWrite;   /* True if in a normal write operation */\r\n#endif\r\n#ifdef SQLITE_TEST\r\n  /* In test mode, increase the size of this structure a bit so that \r\n  ** it is larger than the struct CrashFile defined in test6.c.\r\n  */\r\n  char aPadding[32];\r\n#endif\r\n};\r\n\r\n/*\r\n** Allowed values for the unixFile.ctrlFlags bitmask:\r\n*/\r\n#define UNIXFILE_EXCL        0x01     /* Connections from one process only */\r\n#define UNIXFILE_RDONLY      0x02     /* Connection is read only */\r\n#define UNIXFILE_PERSIST_WAL 0x04     /* Persistent WAL mode */\r\n#ifndef SQLITE_DISABLE_DIRSYNC\r\n# define UNIXFILE_DIRSYNC    0x08     /* Directory sync needed */\r\n#else\r\n# define UNIXFILE_DIRSYNC    0x00\r\n#endif\r\n#define UNIXFILE_PSOW        0x10     /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */\r\n#define UNIXFILE_DELETE      0x20     /* Delete on close */\r\n#define UNIXFILE_URI         0x40     /* Filename might have query parameters */\r\n#define UNIXFILE_NOLOCK      0x80     /* Do no file locking */\r\n#define UNIXFILE_CHOWN      0x100     /* File ownership was changed */\r\n\r\n/*\r\n** Include code that is common to all os_*.c files\r\n*/\r\n/************** Include os_common.h in the middle of os_unix.c ***************/\r\n/************** Begin file os_common.h ***************************************/\r\n/*\r\n** 2004 May 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains macros and a little bit of code that is common to\r\n** all of the platform-specific files (os_*.c) and is #included into those\r\n** files.\r\n**\r\n** This file should be #included by the os_*.c files only.  It is not a\r\n** general purpose header file.\r\n*/\r\n#ifndef _OS_COMMON_H_\r\n#define _OS_COMMON_H_\r\n\r\n/*\r\n** At least two bugs have slipped in because we changed the MEMORY_DEBUG\r\n** macro to SQLITE_DEBUG and some older makefiles have not yet made the\r\n** switch.  The following code should catch this problem at compile-time.\r\n*/\r\n#ifdef MEMORY_DEBUG\r\n# error \"The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead.\"\r\n#endif\r\n\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n# ifndef SQLITE_DEBUG_OS_TRACE\r\n#   define SQLITE_DEBUG_OS_TRACE 0\r\n# endif\r\n  int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;\r\n# define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X\r\n#else\r\n# define OSTRACE(X)\r\n#endif\r\n\r\n/*\r\n** Macros for performance tracing.  Normally turned off.  Only works\r\n** on i486 hardware.\r\n*/\r\n#ifdef SQLITE_PERFORMANCE_TRACE\r\n\r\n/* \r\n** hwtime.h contains inline assembler code for implementing \r\n** high-performance timing routines.\r\n*/\r\n/************** Include hwtime.h in the middle of os_common.h ****************/\r\n/************** Begin file hwtime.h ******************************************/\r\n/*\r\n** 2008 May 27\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains inline asm code for retrieving \"high-performance\"\r\n** counters for x86 class CPUs.\r\n*/\r\n#ifndef _HWTIME_H_\r\n#define _HWTIME_H_\r\n\r\n/*\r\n** The following routine only works on pentium-class (or newer) processors.\r\n** It uses the RDTSC opcode to read the cycle count value out of the\r\n** processor and returns that value.  This can be used for high-res\r\n** profiling.\r\n*/\r\n#if (defined(__GNUC__) || defined(_MSC_VER)) && \\\r\n      (defined(i386) || defined(__i386__) || defined(_M_IX86))\r\n\r\n  #if defined(__GNUC__)\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n     unsigned int lo, hi;\r\n     __asm__ __volatile__ (\"rdtsc\" : \"=a\" (lo), \"=d\" (hi));\r\n     return (sqlite_uint64)hi << 32 | lo;\r\n  }\r\n\r\n  #elif defined(_MSC_VER)\r\n\r\n  __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){\r\n     __asm {\r\n        rdtsc\r\n        ret       ; return value at EDX:EAX\r\n     }\r\n  }\r\n\r\n  #endif\r\n\r\n#elif (defined(__GNUC__) && defined(__x86_64__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long val;\r\n      __asm__ __volatile__ (\"rdtsc\" : \"=A\" (val));\r\n      return val;\r\n  }\r\n \r\n#elif (defined(__GNUC__) && defined(__ppc__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long long retval;\r\n      unsigned long junk;\r\n      __asm__ __volatile__ (\"\\n\\\r\n          1:      mftbu   %1\\n\\\r\n                  mftb    %L0\\n\\\r\n                  mftbu   %0\\n\\\r\n                  cmpw    %0,%1\\n\\\r\n                  bne     1b\"\r\n                  : \"=r\" (retval), \"=r\" (junk));\r\n      return retval;\r\n  }\r\n\r\n#else\r\n\r\n  #error Need implementation of sqlite3Hwtime() for your platform.\r\n\r\n  /*\r\n  ** To compile without implementing sqlite3Hwtime() for your platform,\r\n  ** you can remove the above #error and use the following\r\n  ** stub function.  You will lose timing support for many\r\n  ** of the debugging and testing utilities, but it should at\r\n  ** least compile and run.\r\n  */\r\nSQLITE_PRIVATE   sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }\r\n\r\n#endif\r\n\r\n#endif /* !defined(_HWTIME_H_) */\r\n\r\n/************** End of hwtime.h **********************************************/\r\n/************** Continuing where we left off in os_common.h ******************/\r\n\r\nstatic sqlite_uint64 g_start;\r\nstatic sqlite_uint64 g_elapsed;\r\n#define TIMER_START       g_start=sqlite3Hwtime()\r\n#define TIMER_END         g_elapsed=sqlite3Hwtime()-g_start\r\n#define TIMER_ELAPSED     g_elapsed\r\n#else\r\n#define TIMER_START\r\n#define TIMER_END\r\n#define TIMER_ELAPSED     ((sqlite_uint64)0)\r\n#endif\r\n\r\n/*\r\n** If we compile with the SQLITE_TEST macro set, then the following block\r\n** of code will give us the ability to simulate a disk I/O error.  This\r\n** is used for testing the I/O recovery logic.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */\r\nSQLITE_API int sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */\r\nSQLITE_API int sqlite3_io_error_pending = 0;        /* Count down to first I/O error */\r\nSQLITE_API int sqlite3_io_error_persist = 0;        /* True if I/O errors persist */\r\nSQLITE_API int sqlite3_io_error_benign = 0;         /* True if errors are benign */\r\nSQLITE_API int sqlite3_diskfull_pending = 0;\r\nSQLITE_API int sqlite3_diskfull = 0;\r\n#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)\r\n#define SimulateIOError(CODE)  \\\r\n  if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \\\r\n       || sqlite3_io_error_pending-- == 1 )  \\\r\n              { local_ioerr(); CODE; }\r\nstatic void local_ioerr(){\r\n  IOTRACE((\"IOERR\\n\"));\r\n  sqlite3_io_error_hit++;\r\n  if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++;\r\n}\r\n#define SimulateDiskfullError(CODE) \\\r\n   if( sqlite3_diskfull_pending ){ \\\r\n     if( sqlite3_diskfull_pending == 1 ){ \\\r\n       local_ioerr(); \\\r\n       sqlite3_diskfull = 1; \\\r\n       sqlite3_io_error_hit = 1; \\\r\n       CODE; \\\r\n     }else{ \\\r\n       sqlite3_diskfull_pending--; \\\r\n     } \\\r\n   }\r\n#else\r\n#define SimulateIOErrorBenign(X)\r\n#define SimulateIOError(A)\r\n#define SimulateDiskfullError(A)\r\n#endif\r\n\r\n/*\r\n** When testing, keep a count of the number of open files.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_open_file_count = 0;\r\n#define OpenCounter(X)  sqlite3_open_file_count+=(X)\r\n#else\r\n#define OpenCounter(X)\r\n#endif\r\n\r\n#endif /* !defined(_OS_COMMON_H_) */\r\n\r\n/************** End of os_common.h *******************************************/\r\n/************** Continuing where we left off in os_unix.c ********************/\r\n\r\n/*\r\n** Define various macros that are missing from some systems.\r\n*/\r\n#ifndef O_LARGEFILE\r\n# define O_LARGEFILE 0\r\n#endif\r\n#ifdef SQLITE_DISABLE_LFS\r\n# undef O_LARGEFILE\r\n# define O_LARGEFILE 0\r\n#endif\r\n#ifndef O_NOFOLLOW\r\n# define O_NOFOLLOW 0\r\n#endif\r\n#ifndef O_BINARY\r\n# define O_BINARY 0\r\n#endif\r\n\r\n/*\r\n** The threadid macro resolves to the thread-id or to 0.  Used for\r\n** testing and debugging only.\r\n*/\r\n#if SQLITE_THREADSAFE\r\n#define threadid pthread_self()\r\n#else\r\n#define threadid 0\r\n#endif\r\n\r\n/*\r\n** Different Unix systems declare open() in different ways.  Same use\r\n** open(const char*,int,mode_t).  Others use open(const char*,int,...).\r\n** The difference is important when using a pointer to the function.\r\n**\r\n** The safest way to deal with the problem is to always use this wrapper\r\n** which always has the same well-defined interface.\r\n*/\r\nstatic int posixOpen(const char *zFile, int flags, int mode){\r\n  return open(zFile, flags, mode);\r\n}\r\n\r\n/* Forward reference */\r\nstatic int openDirectory(const char*, int*);\r\n\r\n/*\r\n** Many system calls are accessed through pointer-to-functions so that\r\n** they may be overridden at runtime to facilitate fault injection during\r\n** testing and sandboxing.  The following array holds the names and pointers\r\n** to all overrideable system calls.\r\n*/\r\nstatic struct unix_syscall {\r\n  const char *zName;            /* Name of the sytem call */\r\n  sqlite3_syscall_ptr pCurrent; /* Current value of the system call */\r\n  sqlite3_syscall_ptr pDefault; /* Default value */\r\n} aSyscall[] = {\r\n  { \"open\",         (sqlite3_syscall_ptr)posixOpen,  0  },\r\n#define osOpen      ((int(*)(const char*,int,int))aSyscall[0].pCurrent)\r\n\r\n  { \"close\",        (sqlite3_syscall_ptr)close,      0  },\r\n#define osClose     ((int(*)(int))aSyscall[1].pCurrent)\r\n\r\n  { \"access\",       (sqlite3_syscall_ptr)access,     0  },\r\n#define osAccess    ((int(*)(const char*,int))aSyscall[2].pCurrent)\r\n\r\n  { \"getcwd\",       (sqlite3_syscall_ptr)getcwd,     0  },\r\n#define osGetcwd    ((char*(*)(char*,size_t))aSyscall[3].pCurrent)\r\n\r\n  { \"stat\",         (sqlite3_syscall_ptr)stat,       0  },\r\n#define osStat      ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent)\r\n\r\n/*\r\n** The DJGPP compiler environment looks mostly like Unix, but it\r\n** lacks the fcntl() system call.  So redefine fcntl() to be something\r\n** that always succeeds.  This means that locking does not occur under\r\n** DJGPP.  But it is DOS - what did you expect?\r\n*/\r\n#ifdef __DJGPP__\r\n  { \"fstat\",        0,                 0  },\r\n#define osFstat(a,b,c)    0\r\n#else     \r\n  { \"fstat\",        (sqlite3_syscall_ptr)fstat,      0  },\r\n#define osFstat     ((int(*)(int,struct stat*))aSyscall[5].pCurrent)\r\n#endif\r\n\r\n  { \"ftruncate\",    (sqlite3_syscall_ptr)ftruncate,  0  },\r\n#define osFtruncate ((int(*)(int,off_t))aSyscall[6].pCurrent)\r\n\r\n  { \"fcntl\",        (sqlite3_syscall_ptr)fcntl,      0  },\r\n#define osFcntl     ((int(*)(int,int,...))aSyscall[7].pCurrent)\r\n\r\n  { \"read\",         (sqlite3_syscall_ptr)read,       0  },\r\n#define osRead      ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)\r\n\r\n#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE\r\n  { \"pread\",        (sqlite3_syscall_ptr)pread,      0  },\r\n#else\r\n  { \"pread\",        (sqlite3_syscall_ptr)0,          0  },\r\n#endif\r\n#define osPread     ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent)\r\n\r\n#if defined(USE_PREAD64)\r\n  { \"pread64\",      (sqlite3_syscall_ptr)pread64,    0  },\r\n#else\r\n  { \"pread64\",      (sqlite3_syscall_ptr)0,          0  },\r\n#endif\r\n#define osPread64   ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent)\r\n\r\n  { \"write\",        (sqlite3_syscall_ptr)write,      0  },\r\n#define osWrite     ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)\r\n\r\n#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE\r\n  { \"pwrite\",       (sqlite3_syscall_ptr)pwrite,     0  },\r\n#else\r\n  { \"pwrite\",       (sqlite3_syscall_ptr)0,          0  },\r\n#endif\r\n#define osPwrite    ((ssize_t(*)(int,const void*,size_t,off_t))\\\r\n                    aSyscall[12].pCurrent)\r\n\r\n#if defined(USE_PREAD64)\r\n  { \"pwrite64\",     (sqlite3_syscall_ptr)pwrite64,   0  },\r\n#else\r\n  { \"pwrite64\",     (sqlite3_syscall_ptr)0,          0  },\r\n#endif\r\n#define osPwrite64  ((ssize_t(*)(int,const void*,size_t,off_t))\\\r\n                    aSyscall[13].pCurrent)\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n  { \"fchmod\",       (sqlite3_syscall_ptr)fchmod,     0  },\r\n#else\r\n  { \"fchmod\",       (sqlite3_syscall_ptr)0,          0  },\r\n#endif\r\n#define osFchmod    ((int(*)(int,mode_t))aSyscall[14].pCurrent)\r\n\r\n#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE\r\n  { \"fallocate\",    (sqlite3_syscall_ptr)posix_fallocate,  0 },\r\n#else\r\n  { \"fallocate\",    (sqlite3_syscall_ptr)0,                0 },\r\n#endif\r\n#define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent)\r\n\r\n  { \"unlink\",       (sqlite3_syscall_ptr)unlink,           0 },\r\n#define osUnlink    ((int(*)(const char*))aSyscall[16].pCurrent)\r\n\r\n  { \"openDirectory\",    (sqlite3_syscall_ptr)openDirectory,      0 },\r\n#define osOpenDirectory ((int(*)(const char*,int*))aSyscall[17].pCurrent)\r\n\r\n  { \"mkdir\",        (sqlite3_syscall_ptr)mkdir,           0 },\r\n#define osMkdir     ((int(*)(const char*,mode_t))aSyscall[18].pCurrent)\r\n\r\n  { \"rmdir\",        (sqlite3_syscall_ptr)rmdir,           0 },\r\n#define osRmdir     ((int(*)(const char*))aSyscall[19].pCurrent)\r\n\r\n  { \"fchown\",       (sqlite3_syscall_ptr)fchown,          0 },\r\n#define osFchown    ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent)\r\n\r\n  { \"umask\",        (sqlite3_syscall_ptr)umask,           0 },\r\n#define osUmask     ((mode_t(*)(mode_t))aSyscall[21].pCurrent)\r\n\r\n}; /* End of the overrideable system calls */\r\n\r\n/*\r\n** This is the xSetSystemCall() method of sqlite3_vfs for all of the\r\n** \"unix\" VFSes.  Return SQLITE_OK opon successfully updating the\r\n** system call pointer, or SQLITE_NOTFOUND if there is no configurable\r\n** system call named zName.\r\n*/\r\nstatic int unixSetSystemCall(\r\n  sqlite3_vfs *pNotUsed,        /* The VFS pointer.  Not used */\r\n  const char *zName,            /* Name of system call to override */\r\n  sqlite3_syscall_ptr pNewFunc  /* Pointer to new system call value */\r\n){\r\n  unsigned int i;\r\n  int rc = SQLITE_NOTFOUND;\r\n\r\n  UNUSED_PARAMETER(pNotUsed);\r\n  if( zName==0 ){\r\n    /* If no zName is given, restore all system calls to their default\r\n    ** settings and return NULL\r\n    */\r\n    rc = SQLITE_OK;\r\n    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\r\n      if( aSyscall[i].pDefault ){\r\n        aSyscall[i].pCurrent = aSyscall[i].pDefault;\r\n      }\r\n    }\r\n  }else{\r\n    /* If zName is specified, operate on only the one system call\r\n    ** specified.\r\n    */\r\n    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\r\n      if( strcmp(zName, aSyscall[i].zName)==0 ){\r\n        if( aSyscall[i].pDefault==0 ){\r\n          aSyscall[i].pDefault = aSyscall[i].pCurrent;\r\n        }\r\n        rc = SQLITE_OK;\r\n        if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;\r\n        aSyscall[i].pCurrent = pNewFunc;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the value of a system call.  Return NULL if zName is not a\r\n** recognized system call name.  NULL is also returned if the system call\r\n** is currently undefined.\r\n*/\r\nstatic sqlite3_syscall_ptr unixGetSystemCall(\r\n  sqlite3_vfs *pNotUsed,\r\n  const char *zName\r\n){\r\n  unsigned int i;\r\n\r\n  UNUSED_PARAMETER(pNotUsed);\r\n  for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\r\n    if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return the name of the first system call after zName.  If zName==NULL\r\n** then return the name of the first system call.  Return NULL if zName\r\n** is the last system call or if zName is not the name of a valid\r\n** system call.\r\n*/\r\nstatic const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){\r\n  int i = -1;\r\n\r\n  UNUSED_PARAMETER(p);\r\n  if( zName ){\r\n    for(i=0; i<ArraySize(aSyscall)-1; i++){\r\n      if( strcmp(zName, aSyscall[i].zName)==0 ) break;\r\n    }\r\n  }\r\n  for(i++; i<ArraySize(aSyscall); i++){\r\n    if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Invoke open().  Do so multiple times, until it either succeeds or\r\n** files for some reason other than EINTR.\r\n**\r\n** If the file creation mode \"m\" is 0 then set it to the default for\r\n** SQLite.  The default is SQLITE_DEFAULT_FILE_PERMISSIONS (normally\r\n** 0644) as modified by the system umask.  If m is not 0, then\r\n** make the file creation mode be exactly m ignoring the umask.\r\n**\r\n** The m parameter will be non-zero only when creating -wal, -journal,\r\n** and -shm files.  We want those files to have *exactly* the same\r\n** permissions as their original database, unadulterated by the umask.\r\n** In that way, if a database file is -rw-rw-rw or -rw-rw-r-, and a\r\n** transaction crashes and leaves behind hot journals, then any\r\n** process that is able to write to the database will also be able to\r\n** recover the hot journals.\r\n*/\r\nstatic int robust_open(const char *z, int f, mode_t m){\r\n  int rc;\r\n  mode_t m2;\r\n  mode_t origM = 0;\r\n  if( m==0 ){\r\n    m2 = SQLITE_DEFAULT_FILE_PERMISSIONS;\r\n  }else{\r\n    m2 = m;\r\n    origM = osUmask(0);\r\n  }\r\n  do{ rc = osOpen(z,f,m2); }while( rc<0 && errno==EINTR );\r\n  if( m ){\r\n    osUmask(origM);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Helper functions to obtain and relinquish the global mutex. The\r\n** global mutex is used to protect the unixInodeInfo and\r\n** vxworksFileId objects used by this file, all of which may be \r\n** shared by multiple threads.\r\n**\r\n** Function unixMutexHeld() is used to assert() that the global mutex \r\n** is held when required. This function is only used as part of assert() \r\n** statements. e.g.\r\n**\r\n**   unixEnterMutex()\r\n**     assert( unixMutexHeld() );\r\n**   unixEnterLeave()\r\n*/\r\nstatic void unixEnterMutex(void){\r\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\nstatic void unixLeaveMutex(void){\r\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\n#ifdef SQLITE_DEBUG\r\nstatic int unixMutexHeld(void) {\r\n  return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\n#endif\r\n\r\n\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n/*\r\n** Helper function for printing out trace information from debugging\r\n** binaries. This returns the string represetation of the supplied\r\n** integer lock-type.\r\n*/\r\nstatic const char *azFileLock(int eFileLock){\r\n  switch( eFileLock ){\r\n    case NO_LOCK: return \"NONE\";\r\n    case SHARED_LOCK: return \"SHARED\";\r\n    case RESERVED_LOCK: return \"RESERVED\";\r\n    case PENDING_LOCK: return \"PENDING\";\r\n    case EXCLUSIVE_LOCK: return \"EXCLUSIVE\";\r\n  }\r\n  return \"ERROR\";\r\n}\r\n#endif\r\n\r\n#ifdef SQLITE_LOCK_TRACE\r\n/*\r\n** Print out information about all locking operations.\r\n**\r\n** This routine is used for troubleshooting locks on multithreaded\r\n** platforms.  Enable by compiling with the -DSQLITE_LOCK_TRACE\r\n** command-line option on the compiler.  This code is normally\r\n** turned off.\r\n*/\r\nstatic int lockTrace(int fd, int op, struct flock *p){\r\n  char *zOpName, *zType;\r\n  int s;\r\n  int savedErrno;\r\n  if( op==F_GETLK ){\r\n    zOpName = \"GETLK\";\r\n  }else if( op==F_SETLK ){\r\n    zOpName = \"SETLK\";\r\n  }else{\r\n    s = osFcntl(fd, op, p);\r\n    sqlite3DebugPrintf(\"fcntl unknown %d %d %d\\n\", fd, op, s);\r\n    return s;\r\n  }\r\n  if( p->l_type==F_RDLCK ){\r\n    zType = \"RDLCK\";\r\n  }else if( p->l_type==F_WRLCK ){\r\n    zType = \"WRLCK\";\r\n  }else if( p->l_type==F_UNLCK ){\r\n    zType = \"UNLCK\";\r\n  }else{\r\n    assert( 0 );\r\n  }\r\n  assert( p->l_whence==SEEK_SET );\r\n  s = osFcntl(fd, op, p);\r\n  savedErrno = errno;\r\n  sqlite3DebugPrintf(\"fcntl %d %d %s %s %d %d %d %d\\n\",\r\n     threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len,\r\n     (int)p->l_pid, s);\r\n  if( s==(-1) && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){\r\n    struct flock l2;\r\n    l2 = *p;\r\n    osFcntl(fd, F_GETLK, &l2);\r\n    if( l2.l_type==F_RDLCK ){\r\n      zType = \"RDLCK\";\r\n    }else if( l2.l_type==F_WRLCK ){\r\n      zType = \"WRLCK\";\r\n    }else if( l2.l_type==F_UNLCK ){\r\n      zType = \"UNLCK\";\r\n    }else{\r\n      assert( 0 );\r\n    }\r\n    sqlite3DebugPrintf(\"fcntl-failure-reason: %s %d %d %d\\n\",\r\n       zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid);\r\n  }\r\n  errno = savedErrno;\r\n  return s;\r\n}\r\n#undef osFcntl\r\n#define osFcntl lockTrace\r\n#endif /* SQLITE_LOCK_TRACE */\r\n\r\n/*\r\n** Retry ftruncate() calls that fail due to EINTR\r\n*/\r\nstatic int robust_ftruncate(int h, sqlite3_int64 sz){\r\n  int rc;\r\n  do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This routine translates a standard POSIX errno code into something\r\n** useful to the clients of the sqlite3 functions.  Specifically, it is\r\n** intended to translate a variety of \"try again\" errors into SQLITE_BUSY\r\n** and a variety of \"please close the file descriptor NOW\" errors into \r\n** SQLITE_IOERR\r\n** \r\n** Errors during initialization of locks, or file system support for locks,\r\n** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately.\r\n*/\r\nstatic int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {\r\n  switch (posixError) {\r\n#if 0\r\n  /* At one point this code was not commented out. In theory, this branch\r\n  ** should never be hit, as this function should only be called after\r\n  ** a locking-related function (i.e. fcntl()) has returned non-zero with\r\n  ** the value of errno as the first argument. Since a system call has failed,\r\n  ** errno should be non-zero.\r\n  **\r\n  ** Despite this, if errno really is zero, we still don't want to return\r\n  ** SQLITE_OK. The system call failed, and *some* SQLite error should be\r\n  ** propagated back to the caller. Commenting this branch out means errno==0\r\n  ** will be handled by the \"default:\" case below.\r\n  */\r\n  case 0: \r\n    return SQLITE_OK;\r\n#endif\r\n\r\n  case EAGAIN:\r\n  case ETIMEDOUT:\r\n  case EBUSY:\r\n  case EINTR:\r\n  case ENOLCK:  \r\n    /* random NFS retry error, unless during file system support \r\n     * introspection, in which it actually means what it says */\r\n    return SQLITE_BUSY;\r\n    \r\n  case EACCES: \r\n    /* EACCES is like EAGAIN during locking operations, but not any other time*/\r\n    if( (sqliteIOErr == SQLITE_IOERR_LOCK) || \r\n\t(sqliteIOErr == SQLITE_IOERR_UNLOCK) || \r\n\t(sqliteIOErr == SQLITE_IOERR_RDLOCK) ||\r\n\t(sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) ){\r\n      return SQLITE_BUSY;\r\n    }\r\n    /* else fall through */\r\n  case EPERM: \r\n    return SQLITE_PERM;\r\n    \r\n  /* EDEADLK is only possible if a call to fcntl(F_SETLKW) is made. And\r\n  ** this module never makes such a call. And the code in SQLite itself \r\n  ** asserts that SQLITE_IOERR_BLOCKED is never returned. For these reasons\r\n  ** this case is also commented out. If the system does set errno to EDEADLK,\r\n  ** the default SQLITE_IOERR_XXX code will be returned. */\r\n#if 0\r\n  case EDEADLK:\r\n    return SQLITE_IOERR_BLOCKED;\r\n#endif\r\n    \r\n#if EOPNOTSUPP!=ENOTSUP\r\n  case EOPNOTSUPP: \r\n    /* something went terribly awry, unless during file system support \r\n     * introspection, in which it actually means what it says */\r\n#endif\r\n#ifdef ENOTSUP\r\n  case ENOTSUP: \r\n    /* invalid fd, unless during file system support introspection, in which \r\n     * it actually means what it says */\r\n#endif\r\n  case EIO:\r\n  case EBADF:\r\n  case EINVAL:\r\n  case ENOTCONN:\r\n  case ENODEV:\r\n  case ENXIO:\r\n  case ENOENT:\r\n#ifdef ESTALE                     /* ESTALE is not defined on Interix systems */\r\n  case ESTALE:\r\n#endif\r\n  case ENOSYS:\r\n    /* these should force the client to close the file and reconnect */\r\n    \r\n  default: \r\n    return sqliteIOErr;\r\n  }\r\n}\r\n\r\n\r\n\r\n/******************************************************************************\r\n****************** Begin Unique File ID Utility Used By VxWorks ***************\r\n**\r\n** On most versions of unix, we can get a unique ID for a file by concatenating\r\n** the device number and the inode number.  But this does not work on VxWorks.\r\n** On VxWorks, a unique file id must be based on the canonical filename.\r\n**\r\n** A pointer to an instance of the following structure can be used as a\r\n** unique file ID in VxWorks.  Each instance of this structure contains\r\n** a copy of the canonical filename.  There is also a reference count.  \r\n** The structure is reclaimed when the number of pointers to it drops to\r\n** zero.\r\n**\r\n** There are never very many files open at one time and lookups are not\r\n** a performance-critical path, so it is sufficient to put these\r\n** structures on a linked list.\r\n*/\r\nstruct vxworksFileId {\r\n  struct vxworksFileId *pNext;  /* Next in a list of them all */\r\n  int nRef;                     /* Number of references to this one */\r\n  int nName;                    /* Length of the zCanonicalName[] string */\r\n  char *zCanonicalName;         /* Canonical filename */\r\n};\r\n\r\n#if OS_VXWORKS\r\n/* \r\n** All unique filenames are held on a linked list headed by this\r\n** variable:\r\n*/\r\nstatic struct vxworksFileId *vxworksFileList = 0;\r\n\r\n/*\r\n** Simplify a filename into its canonical form\r\n** by making the following changes:\r\n**\r\n**  * removing any trailing and duplicate /\r\n**  * convert /./ into just /\r\n**  * convert /A/../ where A is any simple name into just /\r\n**\r\n** Changes are made in-place.  Return the new name length.\r\n**\r\n** The original filename is in z[0..n-1].  Return the number of\r\n** characters in the simplified name.\r\n*/\r\nstatic int vxworksSimplifyName(char *z, int n){\r\n  int i, j;\r\n  while( n>1 && z[n-1]=='/' ){ n--; }\r\n  for(i=j=0; i<n; i++){\r\n    if( z[i]=='/' ){\r\n      if( z[i+1]=='/' ) continue;\r\n      if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){\r\n        i += 1;\r\n        continue;\r\n      }\r\n      if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){\r\n        while( j>0 && z[j-1]!='/' ){ j--; }\r\n        if( j>0 ){ j--; }\r\n        i += 2;\r\n        continue;\r\n      }\r\n    }\r\n    z[j++] = z[i];\r\n  }\r\n  z[j] = 0;\r\n  return j;\r\n}\r\n\r\n/*\r\n** Find a unique file ID for the given absolute pathname.  Return\r\n** a pointer to the vxworksFileId object.  This pointer is the unique\r\n** file ID.\r\n**\r\n** The nRef field of the vxworksFileId object is incremented before\r\n** the object is returned.  A new vxworksFileId object is created\r\n** and added to the global list if necessary.\r\n**\r\n** If a memory allocation error occurs, return NULL.\r\n*/\r\nstatic struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){\r\n  struct vxworksFileId *pNew;         /* search key and new file ID */\r\n  struct vxworksFileId *pCandidate;   /* For looping over existing file IDs */\r\n  int n;                              /* Length of zAbsoluteName string */\r\n\r\n  assert( zAbsoluteName[0]=='/' );\r\n  n = (int)strlen(zAbsoluteName);\r\n  pNew = sqlite3_malloc( sizeof(*pNew) + (n+1) );\r\n  if( pNew==0 ) return 0;\r\n  pNew->zCanonicalName = (char*)&pNew[1];\r\n  memcpy(pNew->zCanonicalName, zAbsoluteName, n+1);\r\n  n = vxworksSimplifyName(pNew->zCanonicalName, n);\r\n\r\n  /* Search for an existing entry that matching the canonical name.\r\n  ** If found, increment the reference count and return a pointer to\r\n  ** the existing file ID.\r\n  */\r\n  unixEnterMutex();\r\n  for(pCandidate=vxworksFileList; pCandidate; pCandidate=pCandidate->pNext){\r\n    if( pCandidate->nName==n \r\n     && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0\r\n    ){\r\n       sqlite3_free(pNew);\r\n       pCandidate->nRef++;\r\n       unixLeaveMutex();\r\n       return pCandidate;\r\n    }\r\n  }\r\n\r\n  /* No match was found.  We will make a new file ID */\r\n  pNew->nRef = 1;\r\n  pNew->nName = n;\r\n  pNew->pNext = vxworksFileList;\r\n  vxworksFileList = pNew;\r\n  unixLeaveMutex();\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Decrement the reference count on a vxworksFileId object.  Free\r\n** the object when the reference count reaches zero.\r\n*/\r\nstatic void vxworksReleaseFileId(struct vxworksFileId *pId){\r\n  unixEnterMutex();\r\n  assert( pId->nRef>0 );\r\n  pId->nRef--;\r\n  if( pId->nRef==0 ){\r\n    struct vxworksFileId **pp;\r\n    for(pp=&vxworksFileList; *pp && *pp!=pId; pp = &((*pp)->pNext)){}\r\n    assert( *pp==pId );\r\n    *pp = pId->pNext;\r\n    sqlite3_free(pId);\r\n  }\r\n  unixLeaveMutex();\r\n}\r\n#endif /* OS_VXWORKS */\r\n/*************** End of Unique File ID Utility Used By VxWorks ****************\r\n******************************************************************************/\r\n\r\n\r\n/******************************************************************************\r\n*************************** Posix Advisory Locking ****************************\r\n**\r\n** POSIX advisory locks are broken by design.  ANSI STD 1003.1 (1996)\r\n** section 6.5.2.2 lines 483 through 490 specify that when a process\r\n** sets or clears a lock, that operation overrides any prior locks set\r\n** by the same process.  It does not explicitly say so, but this implies\r\n** that it overrides locks set by the same process using a different\r\n** file descriptor.  Consider this test case:\r\n**\r\n**       int fd1 = open(\"./file1\", O_RDWR|O_CREAT, 0644);\r\n**       int fd2 = open(\"./file2\", O_RDWR|O_CREAT, 0644);\r\n**\r\n** Suppose ./file1 and ./file2 are really the same file (because\r\n** one is a hard or symbolic link to the other) then if you set\r\n** an exclusive lock on fd1, then try to get an exclusive lock\r\n** on fd2, it works.  I would have expected the second lock to\r\n** fail since there was already a lock on the file due to fd1.\r\n** But not so.  Since both locks came from the same process, the\r\n** second overrides the first, even though they were on different\r\n** file descriptors opened on different file names.\r\n**\r\n** This means that we cannot use POSIX locks to synchronize file access\r\n** among competing threads of the same process.  POSIX locks will work fine\r\n** to synchronize access for threads in separate processes, but not\r\n** threads within the same process.\r\n**\r\n** To work around the problem, SQLite has to manage file locks internally\r\n** on its own.  Whenever a new database is opened, we have to find the\r\n** specific inode of the database file (the inode is determined by the\r\n** st_dev and st_ino fields of the stat structure that fstat() fills in)\r\n** and check for locks already existing on that inode.  When locks are\r\n** created or removed, we have to look at our own internal record of the\r\n** locks to see if another thread has previously set a lock on that same\r\n** inode.\r\n**\r\n** (Aside: The use of inode numbers as unique IDs does not work on VxWorks.\r\n** For VxWorks, we have to use the alternative unique ID system based on\r\n** canonical filename and implemented in the previous division.)\r\n**\r\n** The sqlite3_file structure for POSIX is no longer just an integer file\r\n** descriptor.  It is now a structure that holds the integer file\r\n** descriptor and a pointer to a structure that describes the internal\r\n** locks on the corresponding inode.  There is one locking structure\r\n** per inode, so if the same inode is opened twice, both unixFile structures\r\n** point to the same locking structure.  The locking structure keeps\r\n** a reference count (so we will know when to delete it) and a \"cnt\"\r\n** field that tells us its internal lock status.  cnt==0 means the\r\n** file is unlocked.  cnt==-1 means the file has an exclusive lock.\r\n** cnt>0 means there are cnt shared locks on the file.\r\n**\r\n** Any attempt to lock or unlock a file first checks the locking\r\n** structure.  The fcntl() system call is only invoked to set a \r\n** POSIX lock if the internal lock structure transitions between\r\n** a locked and an unlocked state.\r\n**\r\n** But wait:  there are yet more problems with POSIX advisory locks.\r\n**\r\n** If you close a file descriptor that points to a file that has locks,\r\n** all locks on that file that are owned by the current process are\r\n** released.  To work around this problem, each unixInodeInfo object\r\n** maintains a count of the number of pending locks on tha inode.\r\n** When an attempt is made to close an unixFile, if there are\r\n** other unixFile open on the same inode that are holding locks, the call\r\n** to close() the file descriptor is deferred until all of the locks clear.\r\n** The unixInodeInfo structure keeps a list of file descriptors that need to\r\n** be closed and that list is walked (and cleared) when the last lock\r\n** clears.\r\n**\r\n** Yet another problem:  LinuxThreads do not play well with posix locks.\r\n**\r\n** Many older versions of linux use the LinuxThreads library which is\r\n** not posix compliant.  Under LinuxThreads, a lock created by thread\r\n** A cannot be modified or overridden by a different thread B.\r\n** Only thread A can modify the lock.  Locking behavior is correct\r\n** if the appliation uses the newer Native Posix Thread Library (NPTL)\r\n** on linux - with NPTL a lock created by thread A can override locks\r\n** in thread B.  But there is no way to know at compile-time which\r\n** threading library is being used.  So there is no way to know at\r\n** compile-time whether or not thread A can override locks on thread B.\r\n** One has to do a run-time check to discover the behavior of the\r\n** current process.\r\n**\r\n** SQLite used to support LinuxThreads.  But support for LinuxThreads\r\n** was dropped beginning with version 3.7.0.  SQLite will still work with\r\n** LinuxThreads provided that (1) there is no more than one connection \r\n** per database file in the same process and (2) database connections\r\n** do not move across threads.\r\n*/\r\n\r\n/*\r\n** An instance of the following structure serves as the key used\r\n** to locate a particular unixInodeInfo object.\r\n*/\r\nstruct unixFileId {\r\n  dev_t dev;                  /* Device number */\r\n#if OS_VXWORKS\r\n  struct vxworksFileId *pId;  /* Unique file ID for vxworks. */\r\n#else\r\n  ino_t ino;                  /* Inode number */\r\n#endif\r\n};\r\n\r\n/*\r\n** An instance of the following structure is allocated for each open\r\n** inode.  Or, on LinuxThreads, there is one of these structures for\r\n** each inode opened by each thread.\r\n**\r\n** A single inode can have multiple file descriptors, so each unixFile\r\n** structure contains a pointer to an instance of this object and this\r\n** object keeps a count of the number of unixFile pointing to it.\r\n*/\r\nstruct unixInodeInfo {\r\n  struct unixFileId fileId;       /* The lookup key */\r\n  int nShared;                    /* Number of SHARED locks held */\r\n  unsigned char eFileLock;        /* One of SHARED_LOCK, RESERVED_LOCK etc. */\r\n  unsigned char bProcessLock;     /* An exclusive process lock is held */\r\n  int nRef;                       /* Number of pointers to this structure */\r\n  unixShmNode *pShmNode;          /* Shared memory associated with this inode */\r\n  int nLock;                      /* Number of outstanding file locks */\r\n  UnixUnusedFd *pUnused;          /* Unused file descriptors to close */\r\n  unixInodeInfo *pNext;           /* List of all unixInodeInfo objects */\r\n  unixInodeInfo *pPrev;           /*    .... doubly linked */\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n  unsigned long long sharedByte;  /* for AFP simulated shared lock */\r\n#endif\r\n#if OS_VXWORKS\r\n  sem_t *pSem;                    /* Named POSIX semaphore */\r\n  char aSemName[MAX_PATHNAME+2];  /* Name of that semaphore */\r\n#endif\r\n};\r\n\r\n/*\r\n** A lists of all unixInodeInfo objects.\r\n*/\r\nstatic unixInodeInfo *inodeList = 0;\r\n\r\n/*\r\n**\r\n** This function - unixLogError_x(), is only ever called via the macro\r\n** unixLogError().\r\n**\r\n** It is invoked after an error occurs in an OS function and errno has been\r\n** set. It logs a message using sqlite3_log() containing the current value of\r\n** errno and, if possible, the human-readable equivalent from strerror() or\r\n** strerror_r().\r\n**\r\n** The first argument passed to the macro should be the error code that\r\n** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). \r\n** The two subsequent arguments should be the name of the OS function that\r\n** failed (e.g. \"unlink\", \"open\") and the the associated file-system path,\r\n** if any.\r\n*/\r\n#define unixLogError(a,b,c)     unixLogErrorAtLine(a,b,c,__LINE__)\r\nstatic int unixLogErrorAtLine(\r\n  int errcode,                    /* SQLite error code */\r\n  const char *zFunc,              /* Name of OS function that failed */\r\n  const char *zPath,              /* File path associated with error */\r\n  int iLine                       /* Source line number where error occurred */\r\n){\r\n  char *zErr;                     /* Message from strerror() or equivalent */\r\n  int iErrno = errno;             /* Saved syscall error number */\r\n\r\n  /* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use\r\n  ** the strerror() function to obtain the human-readable error message\r\n  ** equivalent to errno. Otherwise, use strerror_r().\r\n  */ \r\n#if SQLITE_THREADSAFE && defined(HAVE_STRERROR_R)\r\n  char aErr[80];\r\n  memset(aErr, 0, sizeof(aErr));\r\n  zErr = aErr;\r\n\r\n  /* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined,\r\n  ** assume that the system provides the the GNU version of strerror_r() that \r\n  ** returns a pointer to a buffer containing the error message. That pointer \r\n  ** may point to aErr[], or it may point to some static storage somewhere. \r\n  ** Otherwise, assume that the system provides the POSIX version of \r\n  ** strerror_r(), which always writes an error message into aErr[].\r\n  **\r\n  ** If the code incorrectly assumes that it is the POSIX version that is\r\n  ** available, the error message will often be an empty string. Not a\r\n  ** huge problem. Incorrectly concluding that the GNU version is available \r\n  ** could lead to a segfault though.\r\n  */\r\n#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)\r\n  zErr = \r\n# endif\r\n  strerror_r(iErrno, aErr, sizeof(aErr)-1);\r\n\r\n#elif SQLITE_THREADSAFE\r\n  /* This is a threadsafe build, but strerror_r() is not available. */\r\n  zErr = \"\";\r\n#else\r\n  /* Non-threadsafe build, use strerror(). */\r\n  zErr = strerror(iErrno);\r\n#endif\r\n\r\n  assert( errcode!=SQLITE_OK );\r\n  if( zPath==0 ) zPath = \"\";\r\n  sqlite3_log(errcode,\r\n      \"os_unix.c:%d: (%d) %s(%s) - %s\",\r\n      iLine, iErrno, zFunc, zPath, zErr\r\n  );\r\n\r\n  return errcode;\r\n}\r\n\r\n/*\r\n** Close a file descriptor.\r\n**\r\n** We assume that close() almost always works, since it is only in a\r\n** very sick application or on a very sick platform that it might fail.\r\n** If it does fail, simply leak the file descriptor, but do log the\r\n** error.\r\n**\r\n** Note that it is not safe to retry close() after EINTR since the\r\n** file descriptor might have already been reused by another thread.\r\n** So we don't even try to recover from an EINTR.  Just log the error\r\n** and move on.\r\n*/\r\nstatic void robust_close(unixFile *pFile, int h, int lineno){\r\n  if( osClose(h) ){\r\n    unixLogErrorAtLine(SQLITE_IOERR_CLOSE, \"close\",\r\n                       pFile ? pFile->zPath : 0, lineno);\r\n  }\r\n}\r\n\r\n/*\r\n** Close all file descriptors accumuated in the unixInodeInfo->pUnused list.\r\n*/ \r\nstatic void closePendingFds(unixFile *pFile){\r\n  unixInodeInfo *pInode = pFile->pInode;\r\n  UnixUnusedFd *p;\r\n  UnixUnusedFd *pNext;\r\n  for(p=pInode->pUnused; p; p=pNext){\r\n    pNext = p->pNext;\r\n    robust_close(pFile, p->fd, __LINE__);\r\n    sqlite3_free(p);\r\n  }\r\n  pInode->pUnused = 0;\r\n}\r\n\r\n/*\r\n** Release a unixInodeInfo structure previously allocated by findInodeInfo().\r\n**\r\n** The mutex entered using the unixEnterMutex() function must be held\r\n** when this function is called.\r\n*/\r\nstatic void releaseInodeInfo(unixFile *pFile){\r\n  unixInodeInfo *pInode = pFile->pInode;\r\n  assert( unixMutexHeld() );\r\n  if( ALWAYS(pInode) ){\r\n    pInode->nRef--;\r\n    if( pInode->nRef==0 ){\r\n      assert( pInode->pShmNode==0 );\r\n      closePendingFds(pFile);\r\n      if( pInode->pPrev ){\r\n        assert( pInode->pPrev->pNext==pInode );\r\n        pInode->pPrev->pNext = pInode->pNext;\r\n      }else{\r\n        assert( inodeList==pInode );\r\n        inodeList = pInode->pNext;\r\n      }\r\n      if( pInode->pNext ){\r\n        assert( pInode->pNext->pPrev==pInode );\r\n        pInode->pNext->pPrev = pInode->pPrev;\r\n      }\r\n      sqlite3_free(pInode);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Given a file descriptor, locate the unixInodeInfo object that\r\n** describes that file descriptor.  Create a new one if necessary.  The\r\n** return value might be uninitialized if an error occurs.\r\n**\r\n** The mutex entered using the unixEnterMutex() function must be held\r\n** when this function is called.\r\n**\r\n** Return an appropriate error code.\r\n*/\r\nstatic int findInodeInfo(\r\n  unixFile *pFile,               /* Unix file with file desc used in the key */\r\n  unixInodeInfo **ppInode        /* Return the unixInodeInfo object here */\r\n){\r\n  int rc;                        /* System call return code */\r\n  int fd;                        /* The file descriptor for pFile */\r\n  struct unixFileId fileId;      /* Lookup key for the unixInodeInfo */\r\n  struct stat statbuf;           /* Low-level file information */\r\n  unixInodeInfo *pInode = 0;     /* Candidate unixInodeInfo object */\r\n\r\n  assert( unixMutexHeld() );\r\n\r\n  /* Get low-level information about the file that we can used to\r\n  ** create a unique name for the file.\r\n  */\r\n  fd = pFile->h;\r\n  rc = osFstat(fd, &statbuf);\r\n  if( rc!=0 ){\r\n    pFile->lastErrno = errno;\r\n#ifdef EOVERFLOW\r\n    if( pFile->lastErrno==EOVERFLOW ) return SQLITE_NOLFS;\r\n#endif\r\n    return SQLITE_IOERR;\r\n  }\r\n\r\n#ifdef __APPLE__\r\n  /* On OS X on an msdos filesystem, the inode number is reported\r\n  ** incorrectly for zero-size files.  See ticket #3260.  To work\r\n  ** around this problem (we consider it a bug in OS X, not SQLite)\r\n  ** we always increase the file size to 1 by writing a single byte\r\n  ** prior to accessing the inode number.  The one byte written is\r\n  ** an ASCII 'S' character which also happens to be the first byte\r\n  ** in the header of every SQLite database.  In this way, if there\r\n  ** is a race condition such that another thread has already populated\r\n  ** the first page of the database, no damage is done.\r\n  */\r\n  if( statbuf.st_size==0 && (pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS)!=0 ){\r\n    do{ rc = osWrite(fd, \"S\", 1); }while( rc<0 && errno==EINTR );\r\n    if( rc!=1 ){\r\n      pFile->lastErrno = errno;\r\n      return SQLITE_IOERR;\r\n    }\r\n    rc = osFstat(fd, &statbuf);\r\n    if( rc!=0 ){\r\n      pFile->lastErrno = errno;\r\n      return SQLITE_IOERR;\r\n    }\r\n  }\r\n#endif\r\n\r\n  memset(&fileId, 0, sizeof(fileId));\r\n  fileId.dev = statbuf.st_dev;\r\n#if OS_VXWORKS\r\n  fileId.pId = pFile->pId;\r\n#else\r\n  fileId.ino = statbuf.st_ino;\r\n#endif\r\n  pInode = inodeList;\r\n  while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){\r\n    pInode = pInode->pNext;\r\n  }\r\n  if( pInode==0 ){\r\n    pInode = sqlite3_malloc( sizeof(*pInode) );\r\n    if( pInode==0 ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    memset(pInode, 0, sizeof(*pInode));\r\n    memcpy(&pInode->fileId, &fileId, sizeof(fileId));\r\n    pInode->nRef = 1;\r\n    pInode->pNext = inodeList;\r\n    pInode->pPrev = 0;\r\n    if( inodeList ) inodeList->pPrev = pInode;\r\n    inodeList = pInode;\r\n  }else{\r\n    pInode->nRef++;\r\n  }\r\n  *ppInode = pInode;\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, set *pResOut\r\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\r\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\r\n*/\r\nstatic int unixCheckReservedLock(sqlite3_file *id, int *pResOut){\r\n  int rc = SQLITE_OK;\r\n  int reserved = 0;\r\n  unixFile *pFile = (unixFile*)id;\r\n\r\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\r\n\r\n  assert( pFile );\r\n  unixEnterMutex(); /* Because pFile->pInode is shared across threads */\r\n\r\n  /* Check if a thread in this process holds such a lock */\r\n  if( pFile->pInode->eFileLock>SHARED_LOCK ){\r\n    reserved = 1;\r\n  }\r\n\r\n  /* Otherwise see if some other process holds it.\r\n  */\r\n#ifndef __DJGPP__\r\n  if( !reserved && !pFile->pInode->bProcessLock ){\r\n    struct flock lock;\r\n    lock.l_whence = SEEK_SET;\r\n    lock.l_start = RESERVED_BYTE;\r\n    lock.l_len = 1;\r\n    lock.l_type = F_WRLCK;\r\n    if( osFcntl(pFile->h, F_GETLK, &lock) ){\r\n      rc = SQLITE_IOERR_CHECKRESERVEDLOCK;\r\n      pFile->lastErrno = errno;\r\n    } else if( lock.l_type!=F_UNLCK ){\r\n      reserved = 1;\r\n    }\r\n  }\r\n#endif\r\n  \r\n  unixLeaveMutex();\r\n  OSTRACE((\"TEST WR-LOCK %d %d %d (unix)\\n\", pFile->h, rc, reserved));\r\n\r\n  *pResOut = reserved;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Attempt to set a system-lock on the file pFile.  The lock is \r\n** described by pLock.\r\n**\r\n** If the pFile was opened read/write from unix-excl, then the only lock\r\n** ever obtained is an exclusive lock, and it is obtained exactly once\r\n** the first time any lock is attempted.  All subsequent system locking\r\n** operations become no-ops.  Locking operations still happen internally,\r\n** in order to coordinate access between separate database connections\r\n** within this process, but all of that is handled in memory and the\r\n** operating system does not participate.\r\n**\r\n** This function is a pass-through to fcntl(F_SETLK) if pFile is using\r\n** any VFS other than \"unix-excl\" or if pFile is opened on \"unix-excl\"\r\n** and is read-only.\r\n**\r\n** Zero is returned if the call completes successfully, or -1 if a call\r\n** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).\r\n*/\r\nstatic int unixFileLock(unixFile *pFile, struct flock *pLock){\r\n  int rc;\r\n  unixInodeInfo *pInode = pFile->pInode;\r\n  assert( unixMutexHeld() );\r\n  assert( pInode!=0 );\r\n  if( ((pFile->ctrlFlags & UNIXFILE_EXCL)!=0 || pInode->bProcessLock)\r\n   && ((pFile->ctrlFlags & UNIXFILE_RDONLY)==0)\r\n  ){\r\n    if( pInode->bProcessLock==0 ){\r\n      struct flock lock;\r\n      assert( pInode->nLock==0 );\r\n      lock.l_whence = SEEK_SET;\r\n      lock.l_start = SHARED_FIRST;\r\n      lock.l_len = SHARED_SIZE;\r\n      lock.l_type = F_WRLCK;\r\n      rc = osFcntl(pFile->h, F_SETLK, &lock);\r\n      if( rc<0 ) return rc;\r\n      pInode->bProcessLock = 1;\r\n      pInode->nLock++;\r\n    }else{\r\n      rc = 0;\r\n    }\r\n  }else{\r\n    rc = osFcntl(pFile->h, F_SETLK, pLock);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter eFileLock - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\r\n** routine to lower a locking level.\r\n*/\r\nstatic int unixLock(sqlite3_file *id, int eFileLock){\r\n  /* The following describes the implementation of the various locks and\r\n  ** lock transitions in terms of the POSIX advisory shared and exclusive\r\n  ** lock primitives (called read-locks and write-locks below, to avoid\r\n  ** confusion with SQLite lock names). The algorithms are complicated\r\n  ** slightly in order to be compatible with windows systems simultaneously\r\n  ** accessing the same database file, in case that is ever required.\r\n  **\r\n  ** Symbols defined in os.h indentify the 'pending byte' and the 'reserved\r\n  ** byte', each single bytes at well known offsets, and the 'shared byte\r\n  ** range', a range of 510 bytes at a well known offset.\r\n  **\r\n  ** To obtain a SHARED lock, a read-lock is obtained on the 'pending\r\n  ** byte'.  If this is successful, a random byte from the 'shared byte\r\n  ** range' is read-locked and the lock on the 'pending byte' released.\r\n  **\r\n  ** A process may only obtain a RESERVED lock after it has a SHARED lock.\r\n  ** A RESERVED lock is implemented by grabbing a write-lock on the\r\n  ** 'reserved byte'. \r\n  **\r\n  ** A process may only obtain a PENDING lock after it has obtained a\r\n  ** SHARED lock. A PENDING lock is implemented by obtaining a write-lock\r\n  ** on the 'pending byte'. This ensures that no new SHARED locks can be\r\n  ** obtained, but existing SHARED locks are allowed to persist. A process\r\n  ** does not have to obtain a RESERVED lock on the way to a PENDING lock.\r\n  ** This property is used by the algorithm for rolling back a journal file\r\n  ** after a crash.\r\n  **\r\n  ** An EXCLUSIVE lock, obtained after a PENDING lock is held, is\r\n  ** implemented by obtaining a write-lock on the entire 'shared byte\r\n  ** range'. Since all other locks require a read-lock on one of the bytes\r\n  ** within this range, this ensures that no other locks are held on the\r\n  ** database. \r\n  **\r\n  ** The reason a single byte cannot be used instead of the 'shared byte\r\n  ** range' is that some versions of windows do not support read-locks. By\r\n  ** locking a random byte from a range, concurrent SHARED locks may exist\r\n  ** even if the locking primitive used is always a write-lock.\r\n  */\r\n  int rc = SQLITE_OK;\r\n  unixFile *pFile = (unixFile*)id;\r\n  unixInodeInfo *pInode;\r\n  struct flock lock;\r\n  int tErrno = 0;\r\n\r\n  assert( pFile );\r\n  OSTRACE((\"LOCK    %d %s was %s(%s,%d) pid=%d (unix)\\n\", pFile->h,\r\n      azFileLock(eFileLock), azFileLock(pFile->eFileLock),\r\n      azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared , getpid()));\r\n\r\n  /* If there is already a lock of this type or more restrictive on the\r\n  ** unixFile, do nothing. Don't use the end_lock: exit path, as\r\n  ** unixEnterMutex() hasn't been called yet.\r\n  */\r\n  if( pFile->eFileLock>=eFileLock ){\r\n    OSTRACE((\"LOCK    %d %s ok (already held) (unix)\\n\", pFile->h,\r\n            azFileLock(eFileLock)));\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Make sure the locking sequence is correct.\r\n  **  (1) We never move from unlocked to anything higher than shared lock.\r\n  **  (2) SQLite never explicitly requests a pendig lock.\r\n  **  (3) A shared lock is always held when a reserve lock is requested.\r\n  */\r\n  assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );\r\n  assert( eFileLock!=PENDING_LOCK );\r\n  assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );\r\n\r\n  /* This mutex is needed because pFile->pInode is shared across threads\r\n  */\r\n  unixEnterMutex();\r\n  pInode = pFile->pInode;\r\n\r\n  /* If some thread using this PID has a lock via a different unixFile*\r\n  ** handle that precludes the requested lock, return BUSY.\r\n  */\r\n  if( (pFile->eFileLock!=pInode->eFileLock && \r\n          (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))\r\n  ){\r\n    rc = SQLITE_BUSY;\r\n    goto end_lock;\r\n  }\r\n\r\n  /* If a SHARED lock is requested, and some thread using this PID already\r\n  ** has a SHARED or RESERVED lock, then increment reference counts and\r\n  ** return SQLITE_OK.\r\n  */\r\n  if( eFileLock==SHARED_LOCK && \r\n      (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){\r\n    assert( eFileLock==SHARED_LOCK );\r\n    assert( pFile->eFileLock==0 );\r\n    assert( pInode->nShared>0 );\r\n    pFile->eFileLock = SHARED_LOCK;\r\n    pInode->nShared++;\r\n    pInode->nLock++;\r\n    goto end_lock;\r\n  }\r\n\r\n\r\n  /* A PENDING lock is needed before acquiring a SHARED lock and before\r\n  ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will\r\n  ** be released.\r\n  */\r\n  lock.l_len = 1L;\r\n  lock.l_whence = SEEK_SET;\r\n  if( eFileLock==SHARED_LOCK \r\n      || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)\r\n  ){\r\n    lock.l_type = (eFileLock==SHARED_LOCK?F_RDLCK:F_WRLCK);\r\n    lock.l_start = PENDING_BYTE;\r\n    if( unixFileLock(pFile, &lock) ){\r\n      tErrno = errno;\r\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\r\n      if( rc!=SQLITE_BUSY ){\r\n        pFile->lastErrno = tErrno;\r\n      }\r\n      goto end_lock;\r\n    }\r\n  }\r\n\r\n\r\n  /* If control gets to this point, then actually go ahead and make\r\n  ** operating system calls for the specified lock.\r\n  */\r\n  if( eFileLock==SHARED_LOCK ){\r\n    assert( pInode->nShared==0 );\r\n    assert( pInode->eFileLock==0 );\r\n    assert( rc==SQLITE_OK );\r\n\r\n    /* Now get the read-lock */\r\n    lock.l_start = SHARED_FIRST;\r\n    lock.l_len = SHARED_SIZE;\r\n    if( unixFileLock(pFile, &lock) ){\r\n      tErrno = errno;\r\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\r\n    }\r\n\r\n    /* Drop the temporary PENDING lock */\r\n    lock.l_start = PENDING_BYTE;\r\n    lock.l_len = 1L;\r\n    lock.l_type = F_UNLCK;\r\n    if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){\r\n      /* This could happen with a network mount */\r\n      tErrno = errno;\r\n      rc = SQLITE_IOERR_UNLOCK; \r\n    }\r\n\r\n    if( rc ){\r\n      if( rc!=SQLITE_BUSY ){\r\n        pFile->lastErrno = tErrno;\r\n      }\r\n      goto end_lock;\r\n    }else{\r\n      pFile->eFileLock = SHARED_LOCK;\r\n      pInode->nLock++;\r\n      pInode->nShared = 1;\r\n    }\r\n  }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){\r\n    /* We are trying for an exclusive lock but another thread in this\r\n    ** same process is still holding a shared lock. */\r\n    rc = SQLITE_BUSY;\r\n  }else{\r\n    /* The request was for a RESERVED or EXCLUSIVE lock.  It is\r\n    ** assumed that there is a SHARED or greater lock on the file\r\n    ** already.\r\n    */\r\n    assert( 0!=pFile->eFileLock );\r\n    lock.l_type = F_WRLCK;\r\n\r\n    assert( eFileLock==RESERVED_LOCK || eFileLock==EXCLUSIVE_LOCK );\r\n    if( eFileLock==RESERVED_LOCK ){\r\n      lock.l_start = RESERVED_BYTE;\r\n      lock.l_len = 1L;\r\n    }else{\r\n      lock.l_start = SHARED_FIRST;\r\n      lock.l_len = SHARED_SIZE;\r\n    }\r\n\r\n    if( unixFileLock(pFile, &lock) ){\r\n      tErrno = errno;\r\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\r\n      if( rc!=SQLITE_BUSY ){\r\n        pFile->lastErrno = tErrno;\r\n      }\r\n    }\r\n  }\r\n  \r\n\r\n#ifndef NDEBUG\r\n  /* Set up the transaction-counter change checking flags when\r\n  ** transitioning from a SHARED to a RESERVED lock.  The change\r\n  ** from SHARED to RESERVED marks the beginning of a normal\r\n  ** write operation (not a hot journal rollback).\r\n  */\r\n  if( rc==SQLITE_OK\r\n   && pFile->eFileLock<=SHARED_LOCK\r\n   && eFileLock==RESERVED_LOCK\r\n  ){\r\n    pFile->transCntrChng = 0;\r\n    pFile->dbUpdate = 0;\r\n    pFile->inNormalWrite = 1;\r\n  }\r\n#endif\r\n\r\n\r\n  if( rc==SQLITE_OK ){\r\n    pFile->eFileLock = eFileLock;\r\n    pInode->eFileLock = eFileLock;\r\n  }else if( eFileLock==EXCLUSIVE_LOCK ){\r\n    pFile->eFileLock = PENDING_LOCK;\r\n    pInode->eFileLock = PENDING_LOCK;\r\n  }\r\n\r\nend_lock:\r\n  unixLeaveMutex();\r\n  OSTRACE((\"LOCK    %d %s %s (unix)\\n\", pFile->h, azFileLock(eFileLock), \r\n      rc==SQLITE_OK ? \"ok\" : \"failed\"));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Add the file descriptor used by file handle pFile to the corresponding\r\n** pUnused list.\r\n*/\r\nstatic void setPendingFd(unixFile *pFile){\r\n  unixInodeInfo *pInode = pFile->pInode;\r\n  UnixUnusedFd *p = pFile->pUnused;\r\n  p->pNext = pInode->pUnused;\r\n  pInode->pUnused = p;\r\n  pFile->h = -1;\r\n  pFile->pUnused = 0;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n** \r\n** If handleNFSUnlock is true, then on downgrading an EXCLUSIVE_LOCK to SHARED\r\n** the byte range is divided into 2 parts and the first part is unlocked then\r\n** set to a read lock, then the other part is simply unlocked.  This works \r\n** around a bug in BSD NFS lockd (also seen on MacOSX 10.3+) that fails to \r\n** remove the write lock on a region when a read lock is set.\r\n*/\r\nstatic int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){\r\n  unixFile *pFile = (unixFile*)id;\r\n  unixInodeInfo *pInode;\r\n  struct flock lock;\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pFile );\r\n  OSTRACE((\"UNLOCK  %d %d was %d(%d,%d) pid=%d (unix)\\n\", pFile->h, eFileLock,\r\n      pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,\r\n      getpid()));\r\n\r\n  assert( eFileLock<=SHARED_LOCK );\r\n  if( pFile->eFileLock<=eFileLock ){\r\n    return SQLITE_OK;\r\n  }\r\n  unixEnterMutex();\r\n  pInode = pFile->pInode;\r\n  assert( pInode->nShared!=0 );\r\n  if( pFile->eFileLock>SHARED_LOCK ){\r\n    assert( pInode->eFileLock==pFile->eFileLock );\r\n\r\n#ifndef NDEBUG\r\n    /* When reducing a lock such that other processes can start\r\n    ** reading the database file again, make sure that the\r\n    ** transaction counter was updated if any part of the database\r\n    ** file changed.  If the transaction counter is not updated,\r\n    ** other connections to the same file might not realize that\r\n    ** the file has changed and hence might not know to flush their\r\n    ** cache.  The use of a stale cache can lead to database corruption.\r\n    */\r\n    pFile->inNormalWrite = 0;\r\n#endif\r\n\r\n    /* downgrading to a shared lock on NFS involves clearing the write lock\r\n    ** before establishing the readlock - to avoid a race condition we downgrade\r\n    ** the lock in 2 blocks, so that part of the range will be covered by a \r\n    ** write lock until the rest is covered by a read lock:\r\n    **  1:   [WWWWW]\r\n    **  2:   [....W]\r\n    **  3:   [RRRRW]\r\n    **  4:   [RRRR.]\r\n    */\r\n    if( eFileLock==SHARED_LOCK ){\r\n\r\n#if !defined(__APPLE__) || !SQLITE_ENABLE_LOCKING_STYLE\r\n      (void)handleNFSUnlock;\r\n      assert( handleNFSUnlock==0 );\r\n#endif\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n      if( handleNFSUnlock ){\r\n        int tErrno;               /* Error code from system call errors */\r\n        off_t divSize = SHARED_SIZE - 1;\r\n        \r\n        lock.l_type = F_UNLCK;\r\n        lock.l_whence = SEEK_SET;\r\n        lock.l_start = SHARED_FIRST;\r\n        lock.l_len = divSize;\r\n        if( unixFileLock(pFile, &lock)==(-1) ){\r\n          tErrno = errno;\r\n          rc = SQLITE_IOERR_UNLOCK;\r\n          if( IS_LOCK_ERROR(rc) ){\r\n            pFile->lastErrno = tErrno;\r\n          }\r\n          goto end_unlock;\r\n        }\r\n        lock.l_type = F_RDLCK;\r\n        lock.l_whence = SEEK_SET;\r\n        lock.l_start = SHARED_FIRST;\r\n        lock.l_len = divSize;\r\n        if( unixFileLock(pFile, &lock)==(-1) ){\r\n          tErrno = errno;\r\n          rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);\r\n          if( IS_LOCK_ERROR(rc) ){\r\n            pFile->lastErrno = tErrno;\r\n          }\r\n          goto end_unlock;\r\n        }\r\n        lock.l_type = F_UNLCK;\r\n        lock.l_whence = SEEK_SET;\r\n        lock.l_start = SHARED_FIRST+divSize;\r\n        lock.l_len = SHARED_SIZE-divSize;\r\n        if( unixFileLock(pFile, &lock)==(-1) ){\r\n          tErrno = errno;\r\n          rc = SQLITE_IOERR_UNLOCK;\r\n          if( IS_LOCK_ERROR(rc) ){\r\n            pFile->lastErrno = tErrno;\r\n          }\r\n          goto end_unlock;\r\n        }\r\n      }else\r\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\r\n      {\r\n        lock.l_type = F_RDLCK;\r\n        lock.l_whence = SEEK_SET;\r\n        lock.l_start = SHARED_FIRST;\r\n        lock.l_len = SHARED_SIZE;\r\n        if( unixFileLock(pFile, &lock) ){\r\n          /* In theory, the call to unixFileLock() cannot fail because another\r\n          ** process is holding an incompatible lock. If it does, this \r\n          ** indicates that the other process is not following the locking\r\n          ** protocol. If this happens, return SQLITE_IOERR_RDLOCK. Returning\r\n          ** SQLITE_BUSY would confuse the upper layer (in practice it causes \r\n          ** an assert to fail). */ \r\n          rc = SQLITE_IOERR_RDLOCK;\r\n          pFile->lastErrno = errno;\r\n          goto end_unlock;\r\n        }\r\n      }\r\n    }\r\n    lock.l_type = F_UNLCK;\r\n    lock.l_whence = SEEK_SET;\r\n    lock.l_start = PENDING_BYTE;\r\n    lock.l_len = 2L;  assert( PENDING_BYTE+1==RESERVED_BYTE );\r\n    if( unixFileLock(pFile, &lock)==0 ){\r\n      pInode->eFileLock = SHARED_LOCK;\r\n    }else{\r\n      rc = SQLITE_IOERR_UNLOCK;\r\n      pFile->lastErrno = errno;\r\n      goto end_unlock;\r\n    }\r\n  }\r\n  if( eFileLock==NO_LOCK ){\r\n    /* Decrement the shared lock counter.  Release the lock using an\r\n    ** OS call only when all threads in this same process have released\r\n    ** the lock.\r\n    */\r\n    pInode->nShared--;\r\n    if( pInode->nShared==0 ){\r\n      lock.l_type = F_UNLCK;\r\n      lock.l_whence = SEEK_SET;\r\n      lock.l_start = lock.l_len = 0L;\r\n      if( unixFileLock(pFile, &lock)==0 ){\r\n        pInode->eFileLock = NO_LOCK;\r\n      }else{\r\n        rc = SQLITE_IOERR_UNLOCK;\r\n\tpFile->lastErrno = errno;\r\n        pInode->eFileLock = NO_LOCK;\r\n        pFile->eFileLock = NO_LOCK;\r\n      }\r\n    }\r\n\r\n    /* Decrement the count of locks against this same file.  When the\r\n    ** count reaches zero, close any other file descriptors whose close\r\n    ** was deferred because of outstanding locks.\r\n    */\r\n    pInode->nLock--;\r\n    assert( pInode->nLock>=0 );\r\n    if( pInode->nLock==0 ){\r\n      closePendingFds(pFile);\r\n    }\r\n  }\r\n\t\r\nend_unlock:\r\n  unixLeaveMutex();\r\n  if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n*/\r\nstatic int unixUnlock(sqlite3_file *id, int eFileLock){\r\n  return posixUnlock(id, eFileLock, 0);\r\n}\r\n\r\n/*\r\n** This function performs the parts of the \"close file\" operation \r\n** common to all locking schemes. It closes the directory and file\r\n** handles, if they are valid, and sets all fields of the unixFile\r\n** structure to 0.\r\n**\r\n** It is *not* necessary to hold the mutex when this routine is called,\r\n** even on VxWorks.  A mutex will be acquired on VxWorks by the\r\n** vxworksReleaseFileId() routine.\r\n*/\r\nstatic int closeUnixFile(sqlite3_file *id){\r\n  unixFile *pFile = (unixFile*)id;\r\n  if( pFile->h>=0 ){\r\n    robust_close(pFile, pFile->h, __LINE__);\r\n    pFile->h = -1;\r\n  }\r\n#if OS_VXWORKS\r\n  if( pFile->pId ){\r\n    if( pFile->ctrlFlags & UNIXFILE_DELETE ){\r\n      osUnlink(pFile->pId->zCanonicalName);\r\n    }\r\n    vxworksReleaseFileId(pFile->pId);\r\n    pFile->pId = 0;\r\n  }\r\n#endif\r\n  OSTRACE((\"CLOSE   %-3d\\n\", pFile->h));\r\n  OpenCounter(-1);\r\n  sqlite3_free(pFile->pUnused);\r\n  memset(pFile, 0, sizeof(unixFile));\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close a file.\r\n*/\r\nstatic int unixClose(sqlite3_file *id){\r\n  int rc = SQLITE_OK;\r\n  unixFile *pFile = (unixFile *)id;\r\n  unixUnlock(id, NO_LOCK);\r\n  unixEnterMutex();\r\n\r\n  /* unixFile.pInode is always valid here. Otherwise, a different close\r\n  ** routine (e.g. nolockClose()) would be called instead.\r\n  */\r\n  assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );\r\n  if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){\r\n    /* If there are outstanding locks, do not actually close the file just\r\n    ** yet because that would clear those locks.  Instead, add the file\r\n    ** descriptor to pInode->pUnused list.  It will be automatically closed \r\n    ** when the last lock is cleared.\r\n    */\r\n    setPendingFd(pFile);\r\n  }\r\n  releaseInodeInfo(pFile);\r\n  rc = closeUnixFile(id);\r\n  unixLeaveMutex();\r\n  return rc;\r\n}\r\n\r\n/************** End of the posix advisory lock implementation *****************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n****************************** No-op Locking **********************************\r\n**\r\n** Of the various locking implementations available, this is by far the\r\n** simplest:  locking is ignored.  No attempt is made to lock the database\r\n** file for reading or writing.\r\n**\r\n** This locking mode is appropriate for use on read-only databases\r\n** (ex: databases that are burned into CD-ROM, for example.)  It can\r\n** also be used if the application employs some external mechanism to\r\n** prevent simultaneous access of the same database by two or more\r\n** database connections.  But there is a serious risk of database\r\n** corruption if this locking mode is used in situations where multiple\r\n** database connections are accessing the same database file at the same\r\n** time and one or more of those connections are writing.\r\n*/\r\n\r\nstatic int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  *pResOut = 0;\r\n  return SQLITE_OK;\r\n}\r\nstatic int nolockLock(sqlite3_file *NotUsed, int NotUsed2){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  return SQLITE_OK;\r\n}\r\nstatic int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close the file.\r\n*/\r\nstatic int nolockClose(sqlite3_file *id) {\r\n  return closeUnixFile(id);\r\n}\r\n\r\n/******************* End of the no-op lock implementation *********************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n************************* Begin dot-file Locking ******************************\r\n**\r\n** The dotfile locking implementation uses the existance of separate lock\r\n** files (really a directory) to control access to the database.  This works\r\n** on just about every filesystem imaginable.  But there are serious downsides:\r\n**\r\n**    (1)  There is zero concurrency.  A single reader blocks all other\r\n**         connections from reading or writing the database.\r\n**\r\n**    (2)  An application crash or power loss can leave stale lock files\r\n**         sitting around that need to be cleared manually.\r\n**\r\n** Nevertheless, a dotlock is an appropriate locking mode for use if no\r\n** other locking strategy is available.\r\n**\r\n** Dotfile locking works by creating a subdirectory in the same directory as\r\n** the database and with the same name but with a \".lock\" extension added.\r\n** The existance of a lock directory implies an EXCLUSIVE lock.  All other\r\n** lock types (SHARED, RESERVED, PENDING) are mapped into EXCLUSIVE.\r\n*/\r\n\r\n/*\r\n** The file suffix added to the data base filename in order to create the\r\n** lock directory.\r\n*/\r\n#define DOTLOCK_SUFFIX \".lock\"\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, set *pResOut\r\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\r\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\r\n**\r\n** In dotfile locking, either a lock exists or it does not.  So in this\r\n** variation of CheckReservedLock(), *pResOut is set to true if any lock\r\n** is held on the file and false if the file is unlocked.\r\n*/\r\nstatic int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) {\r\n  int rc = SQLITE_OK;\r\n  int reserved = 0;\r\n  unixFile *pFile = (unixFile*)id;\r\n\r\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\r\n  \r\n  assert( pFile );\r\n\r\n  /* Check if a thread in this process holds such a lock */\r\n  if( pFile->eFileLock>SHARED_LOCK ){\r\n    /* Either this connection or some other connection in the same process\r\n    ** holds a lock on the file.  No need to check further. */\r\n    reserved = 1;\r\n  }else{\r\n    /* The lock is held if and only if the lockfile exists */\r\n    const char *zLockFile = (const char*)pFile->lockingContext;\r\n    reserved = osAccess(zLockFile, 0)==0;\r\n  }\r\n  OSTRACE((\"TEST WR-LOCK %d %d %d (dotlock)\\n\", pFile->h, rc, reserved));\r\n  *pResOut = reserved;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter eFileLock - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\r\n** routine to lower a locking level.\r\n**\r\n** With dotfile locking, we really only support state (4): EXCLUSIVE.\r\n** But we track the other locking levels internally.\r\n*/\r\nstatic int dotlockLock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  char *zLockFile = (char *)pFile->lockingContext;\r\n  int rc = SQLITE_OK;\r\n\r\n\r\n  /* If we have any lock, then the lock file already exists.  All we have\r\n  ** to do is adjust our internal record of the lock level.\r\n  */\r\n  if( pFile->eFileLock > NO_LOCK ){\r\n    pFile->eFileLock = eFileLock;\r\n    /* Always update the timestamp on the old file */\r\n#ifdef HAVE_UTIME\r\n    utime(zLockFile, NULL);\r\n#else\r\n    utimes(zLockFile, NULL);\r\n#endif\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* grab an exclusive lock */\r\n  rc = osMkdir(zLockFile, 0777);\r\n  if( rc<0 ){\r\n    /* failed to open/create the lock directory */\r\n    int tErrno = errno;\r\n    if( EEXIST == tErrno ){\r\n      rc = SQLITE_BUSY;\r\n    } else {\r\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\r\n      if( IS_LOCK_ERROR(rc) ){\r\n        pFile->lastErrno = tErrno;\r\n      }\r\n    }\r\n    return rc;\r\n  } \r\n  \r\n  /* got it, set the type and return ok */\r\n  pFile->eFileLock = eFileLock;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n**\r\n** When the locking level reaches NO_LOCK, delete the lock file.\r\n*/\r\nstatic int dotlockUnlock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  char *zLockFile = (char *)pFile->lockingContext;\r\n  int rc;\r\n\r\n  assert( pFile );\r\n  OSTRACE((\"UNLOCK  %d %d was %d pid=%d (dotlock)\\n\", pFile->h, eFileLock,\r\n\t   pFile->eFileLock, getpid()));\r\n  assert( eFileLock<=SHARED_LOCK );\r\n  \r\n  /* no-op if possible */\r\n  if( pFile->eFileLock==eFileLock ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* To downgrade to shared, simply update our internal notion of the\r\n  ** lock state.  No need to mess with the file on disk.\r\n  */\r\n  if( eFileLock==SHARED_LOCK ){\r\n    pFile->eFileLock = SHARED_LOCK;\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* To fully unlock the database, delete the lock file */\r\n  assert( eFileLock==NO_LOCK );\r\n  rc = osRmdir(zLockFile);\r\n  if( rc<0 && errno==ENOTDIR ) rc = osUnlink(zLockFile);\r\n  if( rc<0 ){\r\n    int tErrno = errno;\r\n    rc = 0;\r\n    if( ENOENT != tErrno ){\r\n      rc = SQLITE_IOERR_UNLOCK;\r\n    }\r\n    if( IS_LOCK_ERROR(rc) ){\r\n      pFile->lastErrno = tErrno;\r\n    }\r\n    return rc; \r\n  }\r\n  pFile->eFileLock = NO_LOCK;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close a file.  Make sure the lock has been released before closing.\r\n*/\r\nstatic int dotlockClose(sqlite3_file *id) {\r\n  int rc;\r\n  if( id ){\r\n    unixFile *pFile = (unixFile*)id;\r\n    dotlockUnlock(id, NO_LOCK);\r\n    sqlite3_free(pFile->lockingContext);\r\n  }\r\n  rc = closeUnixFile(id);\r\n  return rc;\r\n}\r\n/****************** End of the dot-file lock implementation *******************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n************************** Begin flock Locking ********************************\r\n**\r\n** Use the flock() system call to do file locking.\r\n**\r\n** flock() locking is like dot-file locking in that the various\r\n** fine-grain locking levels supported by SQLite are collapsed into\r\n** a single exclusive lock.  In other words, SHARED, RESERVED, and\r\n** PENDING locks are the same thing as an EXCLUSIVE lock.  SQLite\r\n** still works when you do this, but concurrency is reduced since\r\n** only a single process can be reading the database at a time.\r\n**\r\n** Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off or if\r\n** compiling for VXWORKS.\r\n*/\r\n#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS\r\n\r\n/*\r\n** Retry flock() calls that fail with EINTR\r\n*/\r\n#ifdef EINTR\r\nstatic int robust_flock(int fd, int op){\r\n  int rc;\r\n  do{ rc = flock(fd,op); }while( rc<0 && errno==EINTR );\r\n  return rc;\r\n}\r\n#else\r\n# define robust_flock(a,b) flock(a,b)\r\n#endif\r\n     \r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, set *pResOut\r\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\r\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\r\n*/\r\nstatic int flockCheckReservedLock(sqlite3_file *id, int *pResOut){\r\n  int rc = SQLITE_OK;\r\n  int reserved = 0;\r\n  unixFile *pFile = (unixFile*)id;\r\n  \r\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\r\n  \r\n  assert( pFile );\r\n  \r\n  /* Check if a thread in this process holds such a lock */\r\n  if( pFile->eFileLock>SHARED_LOCK ){\r\n    reserved = 1;\r\n  }\r\n  \r\n  /* Otherwise see if some other process holds it. */\r\n  if( !reserved ){\r\n    /* attempt to get the lock */\r\n    int lrc = robust_flock(pFile->h, LOCK_EX | LOCK_NB);\r\n    if( !lrc ){\r\n      /* got the lock, unlock it */\r\n      lrc = robust_flock(pFile->h, LOCK_UN);\r\n      if ( lrc ) {\r\n        int tErrno = errno;\r\n        /* unlock failed with an error */\r\n        lrc = SQLITE_IOERR_UNLOCK; \r\n        if( IS_LOCK_ERROR(lrc) ){\r\n          pFile->lastErrno = tErrno;\r\n          rc = lrc;\r\n        }\r\n      }\r\n    } else {\r\n      int tErrno = errno;\r\n      reserved = 1;\r\n      /* someone else might have it reserved */\r\n      lrc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); \r\n      if( IS_LOCK_ERROR(lrc) ){\r\n        pFile->lastErrno = tErrno;\r\n        rc = lrc;\r\n      }\r\n    }\r\n  }\r\n  OSTRACE((\"TEST WR-LOCK %d %d %d (flock)\\n\", pFile->h, rc, reserved));\r\n\r\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\r\n  if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){\r\n    rc = SQLITE_OK;\r\n    reserved=1;\r\n  }\r\n#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */\r\n  *pResOut = reserved;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter eFileLock - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** flock() only really support EXCLUSIVE locks.  We track intermediate\r\n** lock states in the sqlite3_file structure, but all locks SHARED or\r\n** above are really EXCLUSIVE locks and exclude all other processes from\r\n** access the file.\r\n**\r\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\r\n** routine to lower a locking level.\r\n*/\r\nstatic int flockLock(sqlite3_file *id, int eFileLock) {\r\n  int rc = SQLITE_OK;\r\n  unixFile *pFile = (unixFile*)id;\r\n\r\n  assert( pFile );\r\n\r\n  /* if we already have a lock, it is exclusive.  \r\n  ** Just adjust level and punt on outta here. */\r\n  if (pFile->eFileLock > NO_LOCK) {\r\n    pFile->eFileLock = eFileLock;\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* grab an exclusive lock */\r\n  \r\n  if (robust_flock(pFile->h, LOCK_EX | LOCK_NB)) {\r\n    int tErrno = errno;\r\n    /* didn't get, must be busy */\r\n    rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\r\n    if( IS_LOCK_ERROR(rc) ){\r\n      pFile->lastErrno = tErrno;\r\n    }\r\n  } else {\r\n    /* got it, set the type and return ok */\r\n    pFile->eFileLock = eFileLock;\r\n  }\r\n  OSTRACE((\"LOCK    %d %s %s (flock)\\n\", pFile->h, azFileLock(eFileLock), \r\n           rc==SQLITE_OK ? \"ok\" : \"failed\"));\r\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\r\n  if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){\r\n    rc = SQLITE_BUSY;\r\n  }\r\n#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n*/\r\nstatic int flockUnlock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  \r\n  assert( pFile );\r\n  OSTRACE((\"UNLOCK  %d %d was %d pid=%d (flock)\\n\", pFile->h, eFileLock,\r\n           pFile->eFileLock, getpid()));\r\n  assert( eFileLock<=SHARED_LOCK );\r\n  \r\n  /* no-op if possible */\r\n  if( pFile->eFileLock==eFileLock ){\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* shared can just be set because we always have an exclusive */\r\n  if (eFileLock==SHARED_LOCK) {\r\n    pFile->eFileLock = eFileLock;\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* no, really, unlock. */\r\n  if( robust_flock(pFile->h, LOCK_UN) ){\r\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\r\n    return SQLITE_OK;\r\n#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */\r\n    return SQLITE_IOERR_UNLOCK;\r\n  }else{\r\n    pFile->eFileLock = NO_LOCK;\r\n    return SQLITE_OK;\r\n  }\r\n}\r\n\r\n/*\r\n** Close a file.\r\n*/\r\nstatic int flockClose(sqlite3_file *id) {\r\n  if( id ){\r\n    flockUnlock(id, NO_LOCK);\r\n  }\r\n  return closeUnixFile(id);\r\n}\r\n\r\n#endif /* SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORK */\r\n\r\n/******************* End of the flock lock implementation *********************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n************************ Begin Named Semaphore Locking ************************\r\n**\r\n** Named semaphore locking is only supported on VxWorks.\r\n**\r\n** Semaphore locking is like dot-lock and flock in that it really only\r\n** supports EXCLUSIVE locking.  Only a single process can read or write\r\n** the database file at a time.  This reduces potential concurrency, but\r\n** makes the lock implementation much easier.\r\n*/\r\n#if OS_VXWORKS\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, set *pResOut\r\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\r\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\r\n*/\r\nstatic int semCheckReservedLock(sqlite3_file *id, int *pResOut) {\r\n  int rc = SQLITE_OK;\r\n  int reserved = 0;\r\n  unixFile *pFile = (unixFile*)id;\r\n\r\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\r\n  \r\n  assert( pFile );\r\n\r\n  /* Check if a thread in this process holds such a lock */\r\n  if( pFile->eFileLock>SHARED_LOCK ){\r\n    reserved = 1;\r\n  }\r\n  \r\n  /* Otherwise see if some other process holds it. */\r\n  if( !reserved ){\r\n    sem_t *pSem = pFile->pInode->pSem;\r\n    struct stat statBuf;\r\n\r\n    if( sem_trywait(pSem)==-1 ){\r\n      int tErrno = errno;\r\n      if( EAGAIN != tErrno ){\r\n        rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_CHECKRESERVEDLOCK);\r\n        pFile->lastErrno = tErrno;\r\n      } else {\r\n        /* someone else has the lock when we are in NO_LOCK */\r\n        reserved = (pFile->eFileLock < SHARED_LOCK);\r\n      }\r\n    }else{\r\n      /* we could have it if we want it */\r\n      sem_post(pSem);\r\n    }\r\n  }\r\n  OSTRACE((\"TEST WR-LOCK %d %d %d (sem)\\n\", pFile->h, rc, reserved));\r\n\r\n  *pResOut = reserved;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter eFileLock - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** Semaphore locks only really support EXCLUSIVE locks.  We track intermediate\r\n** lock states in the sqlite3_file structure, but all locks SHARED or\r\n** above are really EXCLUSIVE locks and exclude all other processes from\r\n** access the file.\r\n**\r\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\r\n** routine to lower a locking level.\r\n*/\r\nstatic int semLock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  int fd;\r\n  sem_t *pSem = pFile->pInode->pSem;\r\n  int rc = SQLITE_OK;\r\n\r\n  /* if we already have a lock, it is exclusive.  \r\n  ** Just adjust level and punt on outta here. */\r\n  if (pFile->eFileLock > NO_LOCK) {\r\n    pFile->eFileLock = eFileLock;\r\n    rc = SQLITE_OK;\r\n    goto sem_end_lock;\r\n  }\r\n  \r\n  /* lock semaphore now but bail out when already locked. */\r\n  if( sem_trywait(pSem)==-1 ){\r\n    rc = SQLITE_BUSY;\r\n    goto sem_end_lock;\r\n  }\r\n\r\n  /* got it, set the type and return ok */\r\n  pFile->eFileLock = eFileLock;\r\n\r\n sem_end_lock:\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n*/\r\nstatic int semUnlock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  sem_t *pSem = pFile->pInode->pSem;\r\n\r\n  assert( pFile );\r\n  assert( pSem );\r\n  OSTRACE((\"UNLOCK  %d %d was %d pid=%d (sem)\\n\", pFile->h, eFileLock,\r\n\t   pFile->eFileLock, getpid()));\r\n  assert( eFileLock<=SHARED_LOCK );\r\n  \r\n  /* no-op if possible */\r\n  if( pFile->eFileLock==eFileLock ){\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* shared can just be set because we always have an exclusive */\r\n  if (eFileLock==SHARED_LOCK) {\r\n    pFile->eFileLock = eFileLock;\r\n    return SQLITE_OK;\r\n  }\r\n  \r\n  /* no, really unlock. */\r\n  if ( sem_post(pSem)==-1 ) {\r\n    int rc, tErrno = errno;\r\n    rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);\r\n    if( IS_LOCK_ERROR(rc) ){\r\n      pFile->lastErrno = tErrno;\r\n    }\r\n    return rc; \r\n  }\r\n  pFile->eFileLock = NO_LOCK;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n ** Close a file.\r\n */\r\nstatic int semClose(sqlite3_file *id) {\r\n  if( id ){\r\n    unixFile *pFile = (unixFile*)id;\r\n    semUnlock(id, NO_LOCK);\r\n    assert( pFile );\r\n    unixEnterMutex();\r\n    releaseInodeInfo(pFile);\r\n    unixLeaveMutex();\r\n    closeUnixFile(id);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n#endif /* OS_VXWORKS */\r\n/*\r\n** Named semaphore locking is only available on VxWorks.\r\n**\r\n*************** End of the named semaphore lock implementation ****************\r\n******************************************************************************/\r\n\r\n\r\n/******************************************************************************\r\n*************************** Begin AFP Locking *********************************\r\n**\r\n** AFP is the Apple Filing Protocol.  AFP is a network filesystem found\r\n** on Apple Macintosh computers - both OS9 and OSX.\r\n**\r\n** Third-party implementations of AFP are available.  But this code here\r\n** only works on OSX.\r\n*/\r\n\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n/*\r\n** The afpLockingContext structure contains all afp lock specific state\r\n*/\r\ntypedef struct afpLockingContext afpLockingContext;\r\nstruct afpLockingContext {\r\n  int reserved;\r\n  const char *dbPath;             /* Name of the open file */\r\n};\r\n\r\nstruct ByteRangeLockPB2\r\n{\r\n  unsigned long long offset;        /* offset to first byte to lock */\r\n  unsigned long long length;        /* nbr of bytes to lock */\r\n  unsigned long long retRangeStart; /* nbr of 1st byte locked if successful */\r\n  unsigned char unLockFlag;         /* 1 = unlock, 0 = lock */\r\n  unsigned char startEndFlag;       /* 1=rel to end of fork, 0=rel to start */\r\n  int fd;                           /* file desc to assoc this lock with */\r\n};\r\n\r\n#define afpfsByteRangeLock2FSCTL        _IOWR('z', 23, struct ByteRangeLockPB2)\r\n\r\n/*\r\n** This is a utility for setting or clearing a bit-range lock on an\r\n** AFP filesystem.\r\n** \r\n** Return SQLITE_OK on success, SQLITE_BUSY on failure.\r\n*/\r\nstatic int afpSetLock(\r\n  const char *path,              /* Name of the file to be locked or unlocked */\r\n  unixFile *pFile,               /* Open file descriptor on path */\r\n  unsigned long long offset,     /* First byte to be locked */\r\n  unsigned long long length,     /* Number of bytes to lock */\r\n  int setLockFlag                /* True to set lock.  False to clear lock */\r\n){\r\n  struct ByteRangeLockPB2 pb;\r\n  int err;\r\n  \r\n  pb.unLockFlag = setLockFlag ? 0 : 1;\r\n  pb.startEndFlag = 0;\r\n  pb.offset = offset;\r\n  pb.length = length; \r\n  pb.fd = pFile->h;\r\n  \r\n  OSTRACE((\"AFPSETLOCK [%s] for %d%s in range %llx:%llx\\n\", \r\n    (setLockFlag?\"ON\":\"OFF\"), pFile->h, (pb.fd==-1?\"[testval-1]\":\"\"),\r\n    offset, length));\r\n  err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0);\r\n  if ( err==-1 ) {\r\n    int rc;\r\n    int tErrno = errno;\r\n    OSTRACE((\"AFPSETLOCK failed to fsctl() '%s' %d %s\\n\",\r\n             path, tErrno, strerror(tErrno)));\r\n#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS\r\n    rc = SQLITE_BUSY;\r\n#else\r\n    rc = sqliteErrorFromPosixError(tErrno,\r\n                    setLockFlag ? SQLITE_IOERR_LOCK : SQLITE_IOERR_UNLOCK);\r\n#endif /* SQLITE_IGNORE_AFP_LOCK_ERRORS */\r\n    if( IS_LOCK_ERROR(rc) ){\r\n      pFile->lastErrno = tErrno;\r\n    }\r\n    return rc;\r\n  } else {\r\n    return SQLITE_OK;\r\n  }\r\n}\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, set *pResOut\r\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\r\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\r\n*/\r\nstatic int afpCheckReservedLock(sqlite3_file *id, int *pResOut){\r\n  int rc = SQLITE_OK;\r\n  int reserved = 0;\r\n  unixFile *pFile = (unixFile*)id;\r\n  afpLockingContext *context;\r\n  \r\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\r\n  \r\n  assert( pFile );\r\n  context = (afpLockingContext *) pFile->lockingContext;\r\n  if( context->reserved ){\r\n    *pResOut = 1;\r\n    return SQLITE_OK;\r\n  }\r\n  unixEnterMutex(); /* Because pFile->pInode is shared across threads */\r\n  \r\n  /* Check if a thread in this process holds such a lock */\r\n  if( pFile->pInode->eFileLock>SHARED_LOCK ){\r\n    reserved = 1;\r\n  }\r\n  \r\n  /* Otherwise see if some other process holds it.\r\n   */\r\n  if( !reserved ){\r\n    /* lock the RESERVED byte */\r\n    int lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);  \r\n    if( SQLITE_OK==lrc ){\r\n      /* if we succeeded in taking the reserved lock, unlock it to restore\r\n      ** the original state */\r\n      lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);\r\n    } else {\r\n      /* if we failed to get the lock then someone else must have it */\r\n      reserved = 1;\r\n    }\r\n    if( IS_LOCK_ERROR(lrc) ){\r\n      rc=lrc;\r\n    }\r\n  }\r\n  \r\n  unixLeaveMutex();\r\n  OSTRACE((\"TEST WR-LOCK %d %d %d (afp)\\n\", pFile->h, rc, reserved));\r\n  \r\n  *pResOut = reserved;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter eFileLock - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\r\n** routine to lower a locking level.\r\n*/\r\nstatic int afpLock(sqlite3_file *id, int eFileLock){\r\n  int rc = SQLITE_OK;\r\n  unixFile *pFile = (unixFile*)id;\r\n  unixInodeInfo *pInode = pFile->pInode;\r\n  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;\r\n  \r\n  assert( pFile );\r\n  OSTRACE((\"LOCK    %d %s was %s(%s,%d) pid=%d (afp)\\n\", pFile->h,\r\n           azFileLock(eFileLock), azFileLock(pFile->eFileLock),\r\n           azFileLock(pInode->eFileLock), pInode->nShared , getpid()));\r\n\r\n  /* If there is already a lock of this type or more restrictive on the\r\n  ** unixFile, do nothing. Don't use the afp_end_lock: exit path, as\r\n  ** unixEnterMutex() hasn't been called yet.\r\n  */\r\n  if( pFile->eFileLock>=eFileLock ){\r\n    OSTRACE((\"LOCK    %d %s ok (already held) (afp)\\n\", pFile->h,\r\n           azFileLock(eFileLock)));\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Make sure the locking sequence is correct\r\n  **  (1) We never move from unlocked to anything higher than shared lock.\r\n  **  (2) SQLite never explicitly requests a pendig lock.\r\n  **  (3) A shared lock is always held when a reserve lock is requested.\r\n  */\r\n  assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );\r\n  assert( eFileLock!=PENDING_LOCK );\r\n  assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );\r\n  \r\n  /* This mutex is needed because pFile->pInode is shared across threads\r\n  */\r\n  unixEnterMutex();\r\n  pInode = pFile->pInode;\r\n\r\n  /* If some thread using this PID has a lock via a different unixFile*\r\n  ** handle that precludes the requested lock, return BUSY.\r\n  */\r\n  if( (pFile->eFileLock!=pInode->eFileLock && \r\n       (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))\r\n     ){\r\n    rc = SQLITE_BUSY;\r\n    goto afp_end_lock;\r\n  }\r\n  \r\n  /* If a SHARED lock is requested, and some thread using this PID already\r\n  ** has a SHARED or RESERVED lock, then increment reference counts and\r\n  ** return SQLITE_OK.\r\n  */\r\n  if( eFileLock==SHARED_LOCK && \r\n     (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){\r\n    assert( eFileLock==SHARED_LOCK );\r\n    assert( pFile->eFileLock==0 );\r\n    assert( pInode->nShared>0 );\r\n    pFile->eFileLock = SHARED_LOCK;\r\n    pInode->nShared++;\r\n    pInode->nLock++;\r\n    goto afp_end_lock;\r\n  }\r\n    \r\n  /* A PENDING lock is needed before acquiring a SHARED lock and before\r\n  ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will\r\n  ** be released.\r\n  */\r\n  if( eFileLock==SHARED_LOCK \r\n      || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)\r\n  ){\r\n    int failed;\r\n    failed = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 1);\r\n    if (failed) {\r\n      rc = failed;\r\n      goto afp_end_lock;\r\n    }\r\n  }\r\n  \r\n  /* If control gets to this point, then actually go ahead and make\r\n  ** operating system calls for the specified lock.\r\n  */\r\n  if( eFileLock==SHARED_LOCK ){\r\n    int lrc1, lrc2, lrc1Errno = 0;\r\n    long lk, mask;\r\n    \r\n    assert( pInode->nShared==0 );\r\n    assert( pInode->eFileLock==0 );\r\n        \r\n    mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff;\r\n    /* Now get the read-lock SHARED_LOCK */\r\n    /* note that the quality of the randomness doesn't matter that much */\r\n    lk = random(); \r\n    pInode->sharedByte = (lk & mask)%(SHARED_SIZE - 1);\r\n    lrc1 = afpSetLock(context->dbPath, pFile, \r\n          SHARED_FIRST+pInode->sharedByte, 1, 1);\r\n    if( IS_LOCK_ERROR(lrc1) ){\r\n      lrc1Errno = pFile->lastErrno;\r\n    }\r\n    /* Drop the temporary PENDING lock */\r\n    lrc2 = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);\r\n    \r\n    if( IS_LOCK_ERROR(lrc1) ) {\r\n      pFile->lastErrno = lrc1Errno;\r\n      rc = lrc1;\r\n      goto afp_end_lock;\r\n    } else if( IS_LOCK_ERROR(lrc2) ){\r\n      rc = lrc2;\r\n      goto afp_end_lock;\r\n    } else if( lrc1 != SQLITE_OK ) {\r\n      rc = lrc1;\r\n    } else {\r\n      pFile->eFileLock = SHARED_LOCK;\r\n      pInode->nLock++;\r\n      pInode->nShared = 1;\r\n    }\r\n  }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){\r\n    /* We are trying for an exclusive lock but another thread in this\r\n     ** same process is still holding a shared lock. */\r\n    rc = SQLITE_BUSY;\r\n  }else{\r\n    /* The request was for a RESERVED or EXCLUSIVE lock.  It is\r\n    ** assumed that there is a SHARED or greater lock on the file\r\n    ** already.\r\n    */\r\n    int failed = 0;\r\n    assert( 0!=pFile->eFileLock );\r\n    if (eFileLock >= RESERVED_LOCK && pFile->eFileLock < RESERVED_LOCK) {\r\n        /* Acquire a RESERVED lock */\r\n        failed = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);\r\n      if( !failed ){\r\n        context->reserved = 1;\r\n      }\r\n    }\r\n    if (!failed && eFileLock == EXCLUSIVE_LOCK) {\r\n      /* Acquire an EXCLUSIVE lock */\r\n        \r\n      /* Remove the shared lock before trying the range.  we'll need to \r\n      ** reestablish the shared lock if we can't get the  afpUnlock\r\n      */\r\n      if( !(failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST +\r\n                         pInode->sharedByte, 1, 0)) ){\r\n        int failed2 = SQLITE_OK;\r\n        /* now attemmpt to get the exclusive lock range */\r\n        failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST, \r\n                               SHARED_SIZE, 1);\r\n        if( failed && (failed2 = afpSetLock(context->dbPath, pFile, \r\n                       SHARED_FIRST + pInode->sharedByte, 1, 1)) ){\r\n          /* Can't reestablish the shared lock.  Sqlite can't deal, this is\r\n          ** a critical I/O error\r\n          */\r\n          rc = ((failed & SQLITE_IOERR) == SQLITE_IOERR) ? failed2 : \r\n               SQLITE_IOERR_LOCK;\r\n          goto afp_end_lock;\r\n        } \r\n      }else{\r\n        rc = failed; \r\n      }\r\n    }\r\n    if( failed ){\r\n      rc = failed;\r\n    }\r\n  }\r\n  \r\n  if( rc==SQLITE_OK ){\r\n    pFile->eFileLock = eFileLock;\r\n    pInode->eFileLock = eFileLock;\r\n  }else if( eFileLock==EXCLUSIVE_LOCK ){\r\n    pFile->eFileLock = PENDING_LOCK;\r\n    pInode->eFileLock = PENDING_LOCK;\r\n  }\r\n  \r\nafp_end_lock:\r\n  unixLeaveMutex();\r\n  OSTRACE((\"LOCK    %d %s %s (afp)\\n\", pFile->h, azFileLock(eFileLock), \r\n         rc==SQLITE_OK ? \"ok\" : \"failed\"));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n*/\r\nstatic int afpUnlock(sqlite3_file *id, int eFileLock) {\r\n  int rc = SQLITE_OK;\r\n  unixFile *pFile = (unixFile*)id;\r\n  unixInodeInfo *pInode;\r\n  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;\r\n  int skipShared = 0;\r\n#ifdef SQLITE_TEST\r\n  int h = pFile->h;\r\n#endif\r\n\r\n  assert( pFile );\r\n  OSTRACE((\"UNLOCK  %d %d was %d(%d,%d) pid=%d (afp)\\n\", pFile->h, eFileLock,\r\n           pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,\r\n           getpid()));\r\n\r\n  assert( eFileLock<=SHARED_LOCK );\r\n  if( pFile->eFileLock<=eFileLock ){\r\n    return SQLITE_OK;\r\n  }\r\n  unixEnterMutex();\r\n  pInode = pFile->pInode;\r\n  assert( pInode->nShared!=0 );\r\n  if( pFile->eFileLock>SHARED_LOCK ){\r\n    assert( pInode->eFileLock==pFile->eFileLock );\r\n    SimulateIOErrorBenign(1);\r\n    SimulateIOError( h=(-1) )\r\n    SimulateIOErrorBenign(0);\r\n    \r\n#ifndef NDEBUG\r\n    /* When reducing a lock such that other processes can start\r\n    ** reading the database file again, make sure that the\r\n    ** transaction counter was updated if any part of the database\r\n    ** file changed.  If the transaction counter is not updated,\r\n    ** other connections to the same file might not realize that\r\n    ** the file has changed and hence might not know to flush their\r\n    ** cache.  The use of a stale cache can lead to database corruption.\r\n    */\r\n    assert( pFile->inNormalWrite==0\r\n           || pFile->dbUpdate==0\r\n           || pFile->transCntrChng==1 );\r\n    pFile->inNormalWrite = 0;\r\n#endif\r\n    \r\n    if( pFile->eFileLock==EXCLUSIVE_LOCK ){\r\n      rc = afpSetLock(context->dbPath, pFile, SHARED_FIRST, SHARED_SIZE, 0);\r\n      if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1) ){\r\n        /* only re-establish the shared lock if necessary */\r\n        int sharedLockByte = SHARED_FIRST+pInode->sharedByte;\r\n        rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 1);\r\n      } else {\r\n        skipShared = 1;\r\n      }\r\n    }\r\n    if( rc==SQLITE_OK && pFile->eFileLock>=PENDING_LOCK ){\r\n      rc = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);\r\n    } \r\n    if( rc==SQLITE_OK && pFile->eFileLock>=RESERVED_LOCK && context->reserved ){\r\n      rc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);\r\n      if( !rc ){ \r\n        context->reserved = 0; \r\n      }\r\n    }\r\n    if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1)){\r\n      pInode->eFileLock = SHARED_LOCK;\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK && eFileLock==NO_LOCK ){\r\n\r\n    /* Decrement the shared lock counter.  Release the lock using an\r\n    ** OS call only when all threads in this same process have released\r\n    ** the lock.\r\n    */\r\n    unsigned long long sharedLockByte = SHARED_FIRST+pInode->sharedByte;\r\n    pInode->nShared--;\r\n    if( pInode->nShared==0 ){\r\n      SimulateIOErrorBenign(1);\r\n      SimulateIOError( h=(-1) )\r\n      SimulateIOErrorBenign(0);\r\n      if( !skipShared ){\r\n        rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0);\r\n      }\r\n      if( !rc ){\r\n        pInode->eFileLock = NO_LOCK;\r\n        pFile->eFileLock = NO_LOCK;\r\n      }\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      pInode->nLock--;\r\n      assert( pInode->nLock>=0 );\r\n      if( pInode->nLock==0 ){\r\n        closePendingFds(pFile);\r\n      }\r\n    }\r\n  }\r\n  \r\n  unixLeaveMutex();\r\n  if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close a file & cleanup AFP specific locking context \r\n*/\r\nstatic int afpClose(sqlite3_file *id) {\r\n  int rc = SQLITE_OK;\r\n  if( id ){\r\n    unixFile *pFile = (unixFile*)id;\r\n    afpUnlock(id, NO_LOCK);\r\n    unixEnterMutex();\r\n    if( pFile->pInode && pFile->pInode->nLock ){\r\n      /* If there are outstanding locks, do not actually close the file just\r\n      ** yet because that would clear those locks.  Instead, add the file\r\n      ** descriptor to pInode->aPending.  It will be automatically closed when\r\n      ** the last lock is cleared.\r\n      */\r\n      setPendingFd(pFile);\r\n    }\r\n    releaseInodeInfo(pFile);\r\n    sqlite3_free(pFile->lockingContext);\r\n    rc = closeUnixFile(id);\r\n    unixLeaveMutex();\r\n  }\r\n  return rc;\r\n}\r\n\r\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\r\n/*\r\n** The code above is the AFP lock implementation.  The code is specific\r\n** to MacOSX and does not work on other unix platforms.  No alternative\r\n** is available.  If you don't compile for a mac, then the \"unix-afp\"\r\n** VFS is not available.\r\n**\r\n********************* End of the AFP lock implementation **********************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n*************************** Begin NFS Locking ********************************/\r\n\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n/*\r\n ** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n ** must be either NO_LOCK or SHARED_LOCK.\r\n **\r\n ** If the locking level of the file descriptor is already at or below\r\n ** the requested locking level, this routine is a no-op.\r\n */\r\nstatic int nfsUnlock(sqlite3_file *id, int eFileLock){\r\n  return posixUnlock(id, eFileLock, 1);\r\n}\r\n\r\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\r\n/*\r\n** The code above is the NFS lock implementation.  The code is specific\r\n** to MacOSX and does not work on other unix platforms.  No alternative\r\n** is available.  \r\n**\r\n********************* End of the NFS lock implementation **********************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n**************** Non-locking sqlite3_file methods *****************************\r\n**\r\n** The next division contains implementations for all methods of the \r\n** sqlite3_file object other than the locking methods.  The locking\r\n** methods were defined in divisions above (one locking method per\r\n** division).  Those methods that are common to all locking modes\r\n** are gather together into this division.\r\n*/\r\n\r\n/*\r\n** Seek to the offset passed as the second argument, then read cnt \r\n** bytes into pBuf. Return the number of bytes actually read.\r\n**\r\n** NB:  If you define USE_PREAD or USE_PREAD64, then it might also\r\n** be necessary to define _XOPEN_SOURCE to be 500.  This varies from\r\n** one system to another.  Since SQLite does not define USE_PREAD\r\n** any any form by default, we will not attempt to define _XOPEN_SOURCE.\r\n** See tickets #2741 and #2681.\r\n**\r\n** To avoid stomping the errno value on a failed read the lastErrno value\r\n** is set before returning.\r\n*/\r\nstatic int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){\r\n  int got;\r\n  int prior = 0;\r\n#if (!defined(USE_PREAD) && !defined(USE_PREAD64))\r\n  i64 newOffset;\r\n#endif\r\n  TIMER_START;\r\n  do{\r\n#if defined(USE_PREAD)\r\n    got = osPread(id->h, pBuf, cnt, offset);\r\n    SimulateIOError( got = -1 );\r\n#elif defined(USE_PREAD64)\r\n    got = osPread64(id->h, pBuf, cnt, offset);\r\n    SimulateIOError( got = -1 );\r\n#else\r\n    newOffset = lseek(id->h, offset, SEEK_SET);\r\n    SimulateIOError( newOffset-- );\r\n    if( newOffset!=offset ){\r\n      if( newOffset == -1 ){\r\n        ((unixFile*)id)->lastErrno = errno;\r\n      }else{\r\n        ((unixFile*)id)->lastErrno = 0;\t\t\t\r\n      }\r\n      return -1;\r\n    }\r\n    got = osRead(id->h, pBuf, cnt);\r\n#endif\r\n    if( got==cnt ) break;\r\n    if( got<0 ){\r\n      if( errno==EINTR ){ got = 1; continue; }\r\n      prior = 0;\r\n      ((unixFile*)id)->lastErrno = errno;\r\n      break;\r\n    }else if( got>0 ){\r\n      cnt -= got;\r\n      offset += got;\r\n      prior += got;\r\n      pBuf = (void*)(got + (char*)pBuf);\r\n    }\r\n  }while( got>0 );\r\n  TIMER_END;\r\n  OSTRACE((\"READ    %-3d %5d %7lld %llu\\n\",\r\n            id->h, got+prior, offset-prior, TIMER_ELAPSED));\r\n  return got+prior;\r\n}\r\n\r\n/*\r\n** Read data from a file into a buffer.  Return SQLITE_OK if all\r\n** bytes were read successfully and SQLITE_IOERR if anything goes\r\n** wrong.\r\n*/\r\nstatic int unixRead(\r\n  sqlite3_file *id, \r\n  void *pBuf, \r\n  int amt,\r\n  sqlite3_int64 offset\r\n){\r\n  unixFile *pFile = (unixFile *)id;\r\n  int got;\r\n  assert( id );\r\n\r\n  /* If this is a database file (not a journal, master-journal or temp\r\n  ** file), the bytes in the locking range should never be read or written. */\r\n#if 0\r\n  assert( pFile->pUnused==0\r\n       || offset>=PENDING_BYTE+512\r\n       || offset+amt<=PENDING_BYTE \r\n  );\r\n#endif\r\n\r\n  got = seekAndRead(pFile, offset, pBuf, amt);\r\n  if( got==amt ){\r\n    return SQLITE_OK;\r\n  }else if( got<0 ){\r\n    /* lastErrno set by seekAndRead */\r\n    return SQLITE_IOERR_READ;\r\n  }else{\r\n    pFile->lastErrno = 0; /* not a system error */\r\n    /* Unread parts of the buffer must be zero-filled */\r\n    memset(&((char*)pBuf)[got], 0, amt-got);\r\n    return SQLITE_IOERR_SHORT_READ;\r\n  }\r\n}\r\n\r\n/*\r\n** Seek to the offset in id->offset then read cnt bytes into pBuf.\r\n** Return the number of bytes actually read.  Update the offset.\r\n**\r\n** To avoid stomping the errno value on a failed write the lastErrno value\r\n** is set before returning.\r\n*/\r\nstatic int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){\r\n  int got;\r\n#if (!defined(USE_PREAD) && !defined(USE_PREAD64))\r\n  i64 newOffset;\r\n#endif\r\n  TIMER_START;\r\n#if defined(USE_PREAD)\r\n  do{ got = osPwrite(id->h, pBuf, cnt, offset); }while( got<0 && errno==EINTR );\r\n#elif defined(USE_PREAD64)\r\n  do{ got = osPwrite64(id->h, pBuf, cnt, offset);}while( got<0 && errno==EINTR);\r\n#else\r\n  do{\r\n    newOffset = lseek(id->h, offset, SEEK_SET);\r\n    SimulateIOError( newOffset-- );\r\n    if( newOffset!=offset ){\r\n      if( newOffset == -1 ){\r\n        ((unixFile*)id)->lastErrno = errno;\r\n      }else{\r\n        ((unixFile*)id)->lastErrno = 0;\t\t\t\r\n      }\r\n      return -1;\r\n    }\r\n    got = osWrite(id->h, pBuf, cnt);\r\n  }while( got<0 && errno==EINTR );\r\n#endif\r\n  TIMER_END;\r\n  if( got<0 ){\r\n    ((unixFile*)id)->lastErrno = errno;\r\n  }\r\n\r\n  OSTRACE((\"WRITE   %-3d %5d %7lld %llu\\n\", id->h, got, offset, TIMER_ELAPSED));\r\n  return got;\r\n}\r\n\r\n\r\n/*\r\n** Write data from a buffer into a file.  Return SQLITE_OK on success\r\n** or some other error code on failure.\r\n*/\r\nstatic int unixWrite(\r\n  sqlite3_file *id, \r\n  const void *pBuf, \r\n  int amt,\r\n  sqlite3_int64 offset \r\n){\r\n  unixFile *pFile = (unixFile*)id;\r\n  int wrote = 0;\r\n  assert( id );\r\n  assert( amt>0 );\r\n\r\n  /* If this is a database file (not a journal, master-journal or temp\r\n  ** file), the bytes in the locking range should never be read or written. */\r\n#if 0\r\n  assert( pFile->pUnused==0\r\n       || offset>=PENDING_BYTE+512\r\n       || offset+amt<=PENDING_BYTE \r\n  );\r\n#endif\r\n\r\n#ifndef NDEBUG\r\n  /* If we are doing a normal write to a database file (as opposed to\r\n  ** doing a hot-journal rollback or a write to some file other than a\r\n  ** normal database file) then record the fact that the database\r\n  ** has changed.  If the transaction counter is modified, record that\r\n  ** fact too.\r\n  */\r\n  if( pFile->inNormalWrite ){\r\n    pFile->dbUpdate = 1;  /* The database has been modified */\r\n    if( offset<=24 && offset+amt>=27 ){\r\n      int rc;\r\n      char oldCntr[4];\r\n      SimulateIOErrorBenign(1);\r\n      rc = seekAndRead(pFile, 24, oldCntr, 4);\r\n      SimulateIOErrorBenign(0);\r\n      if( rc!=4 || memcmp(oldCntr, &((char*)pBuf)[24-offset], 4)!=0 ){\r\n        pFile->transCntrChng = 1;  /* The transaction counter has changed */\r\n      }\r\n    }\r\n  }\r\n#endif\r\n\r\n  while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){\r\n    amt -= wrote;\r\n    offset += wrote;\r\n    pBuf = &((char*)pBuf)[wrote];\r\n  }\r\n  SimulateIOError(( wrote=(-1), amt=1 ));\r\n  SimulateDiskfullError(( wrote=0, amt=1 ));\r\n\r\n  if( amt>0 ){\r\n    if( wrote<0 && pFile->lastErrno!=ENOSPC ){\r\n      /* lastErrno set by seekAndWrite */\r\n      return SQLITE_IOERR_WRITE;\r\n    }else{\r\n      pFile->lastErrno = 0; /* not a system error */\r\n      return SQLITE_FULL;\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** Count the number of fullsyncs and normal syncs.  This is used to test\r\n** that syncs and fullsyncs are occurring at the right times.\r\n*/\r\nSQLITE_API int sqlite3_sync_count = 0;\r\nSQLITE_API int sqlite3_fullsync_count = 0;\r\n#endif\r\n\r\n/*\r\n** We do not trust systems to provide a working fdatasync().  Some do.\r\n** Others do no.  To be safe, we will stick with the (slightly slower)\r\n** fsync(). If you know that your system does support fdatasync() correctly,\r\n** then simply compile with -Dfdatasync=fdatasync\r\n*/\r\n#if !defined(fdatasync)\r\n# define fdatasync fsync\r\n#endif\r\n\r\n/*\r\n** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not\r\n** the F_FULLFSYNC macro is defined.  F_FULLFSYNC is currently\r\n** only available on Mac OS X.  But that could change.\r\n*/\r\n#ifdef F_FULLFSYNC\r\n# define HAVE_FULLFSYNC 1\r\n#else\r\n# define HAVE_FULLFSYNC 0\r\n#endif\r\n\r\n\r\n/*\r\n** The fsync() system call does not work as advertised on many\r\n** unix systems.  The following procedure is an attempt to make\r\n** it work better.\r\n**\r\n** The SQLITE_NO_SYNC macro disables all fsync()s.  This is useful\r\n** for testing when we want to run through the test suite quickly.\r\n** You are strongly advised *not* to deploy with SQLITE_NO_SYNC\r\n** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash\r\n** or power failure will likely corrupt the database file.\r\n**\r\n** SQLite sets the dataOnly flag if the size of the file is unchanged.\r\n** The idea behind dataOnly is that it should only write the file content\r\n** to disk, not the inode.  We only set dataOnly if the file size is \r\n** unchanged since the file size is part of the inode.  However, \r\n** Ted Ts'o tells us that fdatasync() will also write the inode if the\r\n** file size has changed.  The only real difference between fdatasync()\r\n** and fsync(), Ted tells us, is that fdatasync() will not flush the\r\n** inode if the mtime or owner or other inode attributes have changed.\r\n** We only care about the file size, not the other file attributes, so\r\n** as far as SQLite is concerned, an fdatasync() is always adequate.\r\n** So, we always use fdatasync() if it is available, regardless of\r\n** the value of the dataOnly flag.\r\n*/\r\nstatic int full_fsync(int fd, int fullSync, int dataOnly){\r\n  int rc;\r\n\r\n  /* The following \"ifdef/elif/else/\" block has the same structure as\r\n  ** the one below. It is replicated here solely to avoid cluttering \r\n  ** up the real code with the UNUSED_PARAMETER() macros.\r\n  */\r\n#ifdef SQLITE_NO_SYNC\r\n  UNUSED_PARAMETER(fd);\r\n  UNUSED_PARAMETER(fullSync);\r\n  UNUSED_PARAMETER(dataOnly);\r\n#elif HAVE_FULLFSYNC\r\n  UNUSED_PARAMETER(dataOnly);\r\n#else\r\n  UNUSED_PARAMETER(fullSync);\r\n  UNUSED_PARAMETER(dataOnly);\r\n#endif\r\n\r\n  /* Record the number of times that we do a normal fsync() and \r\n  ** FULLSYNC.  This is used during testing to verify that this procedure\r\n  ** gets called with the correct arguments.\r\n  */\r\n#ifdef SQLITE_TEST\r\n  if( fullSync ) sqlite3_fullsync_count++;\r\n  sqlite3_sync_count++;\r\n#endif\r\n\r\n  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a\r\n  ** no-op\r\n  */\r\n#ifdef SQLITE_NO_SYNC\r\n  rc = SQLITE_OK;\r\n#elif HAVE_FULLFSYNC\r\n  if( fullSync ){\r\n    rc = osFcntl(fd, F_FULLFSYNC, 0);\r\n  }else{\r\n    rc = 1;\r\n  }\r\n  /* If the FULLFSYNC failed, fall back to attempting an fsync().\r\n  ** It shouldn't be possible for fullfsync to fail on the local \r\n  ** file system (on OSX), so failure indicates that FULLFSYNC\r\n  ** isn't supported for this file system. So, attempt an fsync \r\n  ** and (for now) ignore the overhead of a superfluous fcntl call.  \r\n  ** It'd be better to detect fullfsync support once and avoid \r\n  ** the fcntl call every time sync is called.\r\n  */\r\n  if( rc ) rc = fsync(fd);\r\n\r\n#elif defined(__APPLE__)\r\n  /* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly\r\n  ** so currently we default to the macro that redefines fdatasync to fsync\r\n  */\r\n  rc = fsync(fd);\r\n#else \r\n  rc = fdatasync(fd);\r\n#if OS_VXWORKS\r\n  if( rc==-1 && errno==ENOTSUP ){\r\n    rc = fsync(fd);\r\n  }\r\n#endif /* OS_VXWORKS */\r\n#endif /* ifdef SQLITE_NO_SYNC elif HAVE_FULLFSYNC */\r\n\r\n  if( OS_VXWORKS && rc!= -1 ){\r\n    rc = 0;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Open a file descriptor to the directory containing file zFilename.\r\n** If successful, *pFd is set to the opened file descriptor and\r\n** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM\r\n** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined\r\n** value.\r\n**\r\n** The directory file descriptor is used for only one thing - to\r\n** fsync() a directory to make sure file creation and deletion events\r\n** are flushed to disk.  Such fsyncs are not needed on newer\r\n** journaling filesystems, but are required on older filesystems.\r\n**\r\n** This routine can be overridden using the xSetSysCall interface.\r\n** The ability to override this routine was added in support of the\r\n** chromium sandbox.  Opening a directory is a security risk (we are\r\n** told) so making it overrideable allows the chromium sandbox to\r\n** replace this routine with a harmless no-op.  To make this routine\r\n** a no-op, replace it with a stub that returns SQLITE_OK but leaves\r\n** *pFd set to a negative number.\r\n**\r\n** If SQLITE_OK is returned, the caller is responsible for closing\r\n** the file descriptor *pFd using close().\r\n*/\r\nstatic int openDirectory(const char *zFilename, int *pFd){\r\n  int ii;\r\n  int fd = -1;\r\n  char zDirname[MAX_PATHNAME+1];\r\n\r\n  sqlite3_snprintf(MAX_PATHNAME, zDirname, \"%s\", zFilename);\r\n  for(ii=(int)strlen(zDirname); ii>1 && zDirname[ii]!='/'; ii--);\r\n  if( ii>0 ){\r\n    zDirname[ii] = '\\0';\r\n    fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0);\r\n    if( fd>=0 ){\r\n#ifdef FD_CLOEXEC\r\n      osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);\r\n#endif\r\n      OSTRACE((\"OPENDIR %-3d %s\\n\", fd, zDirname));\r\n    }\r\n  }\r\n  *pFd = fd;\r\n  return (fd>=0?SQLITE_OK:unixLogError(SQLITE_CANTOPEN_BKPT, \"open\", zDirname));\r\n}\r\n\r\n/*\r\n** Make sure all writes to a particular file are committed to disk.\r\n**\r\n** If dataOnly==0 then both the file itself and its metadata (file\r\n** size, access time, etc) are synced.  If dataOnly!=0 then only the\r\n** file data is synced.\r\n**\r\n** Under Unix, also make sure that the directory entry for the file\r\n** has been created by fsync-ing the directory that contains the file.\r\n** If we do not do this and we encounter a power failure, the directory\r\n** entry for the journal might not exist after we reboot.  The next\r\n** SQLite to access the file will not know that the journal exists (because\r\n** the directory entry for the journal was never created) and the transaction\r\n** will not roll back - possibly leading to database corruption.\r\n*/\r\nstatic int unixSync(sqlite3_file *id, int flags){\r\n  int rc;\r\n  unixFile *pFile = (unixFile*)id;\r\n\r\n  int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);\r\n  int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;\r\n\r\n  /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */\r\n  assert((flags&0x0F)==SQLITE_SYNC_NORMAL\r\n      || (flags&0x0F)==SQLITE_SYNC_FULL\r\n  );\r\n\r\n  /* Unix cannot, but some systems may return SQLITE_FULL from here. This\r\n  ** line is to test that doing so does not cause any problems.\r\n  */\r\n  SimulateDiskfullError( return SQLITE_FULL );\r\n\r\n  assert( pFile );\r\n  OSTRACE((\"SYNC    %-3d\\n\", pFile->h));\r\n  rc = full_fsync(pFile->h, isFullsync, isDataOnly);\r\n  SimulateIOError( rc=1 );\r\n  if( rc ){\r\n    pFile->lastErrno = errno;\r\n    return unixLogError(SQLITE_IOERR_FSYNC, \"full_fsync\", pFile->zPath);\r\n  }\r\n\r\n  /* Also fsync the directory containing the file if the DIRSYNC flag\r\n  ** is set.  This is a one-time occurrance.  Many systems (examples: AIX)\r\n  ** are unable to fsync a directory, so ignore errors on the fsync.\r\n  */\r\n  if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){\r\n    int dirfd;\r\n    OSTRACE((\"DIRSYNC %s (have_fullfsync=%d fullsync=%d)\\n\", pFile->zPath,\r\n            HAVE_FULLFSYNC, isFullsync));\r\n    rc = osOpenDirectory(pFile->zPath, &dirfd);\r\n    if( rc==SQLITE_OK && dirfd>=0 ){\r\n      full_fsync(dirfd, 0, 0);\r\n      robust_close(pFile, dirfd, __LINE__);\r\n    }else if( rc==SQLITE_CANTOPEN ){\r\n      rc = SQLITE_OK;\r\n    }\r\n    pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Truncate an open file to a specified size\r\n*/\r\nstatic int unixTruncate(sqlite3_file *id, i64 nByte){\r\n  unixFile *pFile = (unixFile *)id;\r\n  int rc;\r\n  assert( pFile );\r\n  SimulateIOError( return SQLITE_IOERR_TRUNCATE );\r\n\r\n  /* If the user has configured a chunk-size for this file, truncate the\r\n  ** file so that it consists of an integer number of chunks (i.e. the\r\n  ** actual file size after the operation may be larger than the requested\r\n  ** size).\r\n  */\r\n  if( pFile->szChunk ){\r\n    nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;\r\n  }\r\n\r\n  rc = robust_ftruncate(pFile->h, (off_t)nByte);\r\n  if( rc ){\r\n    pFile->lastErrno = errno;\r\n    return unixLogError(SQLITE_IOERR_TRUNCATE, \"ftruncate\", pFile->zPath);\r\n  }else{\r\n#ifndef NDEBUG\r\n    /* If we are doing a normal write to a database file (as opposed to\r\n    ** doing a hot-journal rollback or a write to some file other than a\r\n    ** normal database file) and we truncate the file to zero length,\r\n    ** that effectively updates the change counter.  This might happen\r\n    ** when restoring a database using the backup API from a zero-length\r\n    ** source.\r\n    */\r\n    if( pFile->inNormalWrite && nByte==0 ){\r\n      pFile->transCntrChng = 1;\r\n    }\r\n#endif\r\n\r\n    return SQLITE_OK;\r\n  }\r\n}\r\n\r\n/*\r\n** Determine the current size of a file in bytes\r\n*/\r\nstatic int unixFileSize(sqlite3_file *id, i64 *pSize){\r\n  int rc;\r\n  struct stat buf;\r\n  assert( id );\r\n  rc = osFstat(((unixFile*)id)->h, &buf);\r\n  SimulateIOError( rc=1 );\r\n  if( rc!=0 ){\r\n    ((unixFile*)id)->lastErrno = errno;\r\n    return SQLITE_IOERR_FSTAT;\r\n  }\r\n  *pSize = buf.st_size;\r\n\r\n  /* When opening a zero-size database, the findInodeInfo() procedure\r\n  ** writes a single byte into that file in order to work around a bug\r\n  ** in the OS-X msdos filesystem.  In order to avoid problems with upper\r\n  ** layers, we need to report this file size as zero even though it is\r\n  ** really 1.   Ticket #3260.\r\n  */\r\n  if( *pSize==1 ) *pSize = 0;\r\n\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\r\n/*\r\n** Handler for proxy-locking file-control verbs.  Defined below in the\r\n** proxying locking division.\r\n*/\r\nstatic int proxyFileControl(sqlite3_file*,int,void*);\r\n#endif\r\n\r\n/* \r\n** This function is called to handle the SQLITE_FCNTL_SIZE_HINT \r\n** file-control operation.  Enlarge the database to nBytes in size\r\n** (rounded up to the next chunk-size).  If the database is already\r\n** nBytes or larger, this routine is a no-op.\r\n*/\r\nstatic int fcntlSizeHint(unixFile *pFile, i64 nByte){\r\n  if( pFile->szChunk>0 ){\r\n    i64 nSize;                    /* Required file size */\r\n    struct stat buf;              /* Used to hold return values of fstat() */\r\n   \r\n    if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT;\r\n\r\n    nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;\r\n    if( nSize>(i64)buf.st_size ){\r\n\r\n#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE\r\n      /* The code below is handling the return value of osFallocate() \r\n      ** correctly. posix_fallocate() is defined to \"returns zero on success, \r\n      ** or an error number on  failure\". See the manpage for details. */\r\n      int err;\r\n      do{\r\n        err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size);\r\n      }while( err==EINTR );\r\n      if( err ) return SQLITE_IOERR_WRITE;\r\n#else\r\n      /* If the OS does not have posix_fallocate(), fake it. First use\r\n      ** ftruncate() to set the file size, then write a single byte to\r\n      ** the last byte in each block within the extended region. This\r\n      ** is the same technique used by glibc to implement posix_fallocate()\r\n      ** on systems that do not have a real fallocate() system call.\r\n      */\r\n      int nBlk = buf.st_blksize;  /* File-system block size */\r\n      i64 iWrite;                 /* Next offset to write to */\r\n\r\n      if( robust_ftruncate(pFile->h, nSize) ){\r\n        pFile->lastErrno = errno;\r\n        return unixLogError(SQLITE_IOERR_TRUNCATE, \"ftruncate\", pFile->zPath);\r\n      }\r\n      iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1;\r\n      while( iWrite<nSize ){\r\n        int nWrite = seekAndWrite(pFile, iWrite, \"\", 1);\r\n        if( nWrite!=1 ) return SQLITE_IOERR_WRITE;\r\n        iWrite += nBlk;\r\n      }\r\n#endif\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** If *pArg is inititially negative then this is a query.  Set *pArg to\r\n** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.\r\n**\r\n** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.\r\n*/\r\nstatic void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){\r\n  if( *pArg<0 ){\r\n    *pArg = (pFile->ctrlFlags & mask)!=0;\r\n  }else if( (*pArg)==0 ){\r\n    pFile->ctrlFlags &= ~mask;\r\n  }else{\r\n    pFile->ctrlFlags |= mask;\r\n  }\r\n}\r\n\r\n/*\r\n** Information and control of an open file handle.\r\n*/\r\nstatic int unixFileControl(sqlite3_file *id, int op, void *pArg){\r\n  unixFile *pFile = (unixFile*)id;\r\n  switch( op ){\r\n    case SQLITE_FCNTL_LOCKSTATE: {\r\n      *(int*)pArg = pFile->eFileLock;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_LAST_ERRNO: {\r\n      *(int*)pArg = pFile->lastErrno;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_CHUNK_SIZE: {\r\n      pFile->szChunk = *(int *)pArg;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_SIZE_HINT: {\r\n      int rc;\r\n      SimulateIOErrorBenign(1);\r\n      rc = fcntlSizeHint(pFile, *(i64 *)pArg);\r\n      SimulateIOErrorBenign(0);\r\n      return rc;\r\n    }\r\n    case SQLITE_FCNTL_PERSIST_WAL: {\r\n      unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int*)pArg);\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {\r\n      unixModeBit(pFile, UNIXFILE_PSOW, (int*)pArg);\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_VFSNAME: {\r\n      *(char**)pArg = sqlite3_mprintf(\"%s\", pFile->pVfs->zName);\r\n      return SQLITE_OK;\r\n    }\r\n#ifndef NDEBUG\r\n    /* The pager calls this method to signal that it has done\r\n    ** a rollback and that the database is therefore unchanged and\r\n    ** it hence it is OK for the transaction change counter to be\r\n    ** unchanged.\r\n    */\r\n    case SQLITE_FCNTL_DB_UNCHANGED: {\r\n      ((unixFile*)id)->dbUpdate = 0;\r\n      return SQLITE_OK;\r\n    }\r\n#endif\r\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\r\n    case SQLITE_SET_LOCKPROXYFILE:\r\n    case SQLITE_GET_LOCKPROXYFILE: {\r\n      return proxyFileControl(id,op,pArg);\r\n    }\r\n#endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */\r\n  }\r\n  return SQLITE_NOTFOUND;\r\n}\r\n\r\n/*\r\n** Return the sector size in bytes of the underlying block device for\r\n** the specified file. This is almost always 512 bytes, but may be\r\n** larger for some devices.\r\n**\r\n** SQLite code assumes this function cannot fail. It also assumes that\r\n** if two files are created in the same file-system directory (i.e.\r\n** a database and its journal file) that the sector size will be the\r\n** same for both.\r\n*/\r\nstatic int unixSectorSize(sqlite3_file *pFile){\r\n  (void)pFile;\r\n  return SQLITE_DEFAULT_SECTOR_SIZE;\r\n}\r\n\r\n/*\r\n** Return the device characteristics for the file.\r\n**\r\n** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default.\r\n** However, that choice is contraversial since technically the underlying\r\n** file system does not always provide powersafe overwrites.  (In other\r\n** words, after a power-loss event, parts of the file that were never\r\n** written might end up being altered.)  However, non-PSOW behavior is very,\r\n** very rare.  And asserting PSOW makes a large reduction in the amount\r\n** of required I/O for journaling, since a lot of padding is eliminated.\r\n**  Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control\r\n** available to turn it off and URI query parameter available to turn it off.\r\n*/\r\nstatic int unixDeviceCharacteristics(sqlite3_file *id){\r\n  unixFile *p = (unixFile*)id;\r\n  if( p->ctrlFlags & UNIXFILE_PSOW ){\r\n    return SQLITE_IOCAP_POWERSAFE_OVERWRITE;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n\r\n\r\n/*\r\n** Object used to represent an shared memory buffer.  \r\n**\r\n** When multiple threads all reference the same wal-index, each thread\r\n** has its own unixShm object, but they all point to a single instance\r\n** of this unixShmNode object.  In other words, each wal-index is opened\r\n** only once per process.\r\n**\r\n** Each unixShmNode object is connected to a single unixInodeInfo object.\r\n** We could coalesce this object into unixInodeInfo, but that would mean\r\n** every open file that does not use shared memory (in other words, most\r\n** open files) would have to carry around this extra information.  So\r\n** the unixInodeInfo object contains a pointer to this unixShmNode object\r\n** and the unixShmNode object is created only when needed.\r\n**\r\n** unixMutexHeld() must be true when creating or destroying\r\n** this object or while reading or writing the following fields:\r\n**\r\n**      nRef\r\n**\r\n** The following fields are read-only after the object is created:\r\n** \r\n**      fid\r\n**      zFilename\r\n**\r\n** Either unixShmNode.mutex must be held or unixShmNode.nRef==0 and\r\n** unixMutexHeld() is true when reading or writing any other field\r\n** in this structure.\r\n*/\r\nstruct unixShmNode {\r\n  unixInodeInfo *pInode;     /* unixInodeInfo that owns this SHM node */\r\n  sqlite3_mutex *mutex;      /* Mutex to access this object */\r\n  char *zFilename;           /* Name of the mmapped file */\r\n  int h;                     /* Open file descriptor */\r\n  int szRegion;              /* Size of shared-memory regions */\r\n  u16 nRegion;               /* Size of array apRegion */\r\n  u8 isReadonly;             /* True if read-only */\r\n  char **apRegion;           /* Array of mapped shared-memory regions */\r\n  int nRef;                  /* Number of unixShm objects pointing to this */\r\n  unixShm *pFirst;           /* All unixShm objects pointing to this */\r\n#ifdef SQLITE_DEBUG\r\n  u8 exclMask;               /* Mask of exclusive locks held */\r\n  u8 sharedMask;             /* Mask of shared locks held */\r\n  u8 nextShmId;              /* Next available unixShm.id value */\r\n#endif\r\n};\r\n\r\n/*\r\n** Structure used internally by this VFS to record the state of an\r\n** open shared memory connection.\r\n**\r\n** The following fields are initialized when this object is created and\r\n** are read-only thereafter:\r\n**\r\n**    unixShm.pFile\r\n**    unixShm.id\r\n**\r\n** All other fields are read/write.  The unixShm.pFile->mutex must be held\r\n** while accessing any read/write fields.\r\n*/\r\nstruct unixShm {\r\n  unixShmNode *pShmNode;     /* The underlying unixShmNode object */\r\n  unixShm *pNext;            /* Next unixShm with the same unixShmNode */\r\n  u8 hasMutex;               /* True if holding the unixShmNode mutex */\r\n  u8 id;                     /* Id of this connection within its unixShmNode */\r\n  u16 sharedMask;            /* Mask of shared locks held */\r\n  u16 exclMask;              /* Mask of exclusive locks held */\r\n};\r\n\r\n/*\r\n** Constants used for locking\r\n*/\r\n#define UNIX_SHM_BASE   ((22+SQLITE_SHM_NLOCK)*4)         /* first lock byte */\r\n#define UNIX_SHM_DMS    (UNIX_SHM_BASE+SQLITE_SHM_NLOCK)  /* deadman switch */\r\n\r\n/*\r\n** Apply posix advisory locks for all bytes from ofst through ofst+n-1.\r\n**\r\n** Locks block if the mask is exactly UNIX_SHM_C and are non-blocking\r\n** otherwise.\r\n*/\r\nstatic int unixShmSystemLock(\r\n  unixShmNode *pShmNode, /* Apply locks to this open shared-memory segment */\r\n  int lockType,          /* F_UNLCK, F_RDLCK, or F_WRLCK */\r\n  int ofst,              /* First byte of the locking range */\r\n  int n                  /* Number of bytes to lock */\r\n){\r\n  struct flock f;       /* The posix advisory locking structure */\r\n  int rc = SQLITE_OK;   /* Result code form fcntl() */\r\n\r\n  /* Access to the unixShmNode object is serialized by the caller */\r\n  assert( sqlite3_mutex_held(pShmNode->mutex) || pShmNode->nRef==0 );\r\n\r\n  /* Shared locks never span more than one byte */\r\n  assert( n==1 || lockType!=F_RDLCK );\r\n\r\n  /* Locks are within range */\r\n  assert( n>=1 && n<SQLITE_SHM_NLOCK );\r\n\r\n  if( pShmNode->h>=0 ){\r\n    /* Initialize the locking parameters */\r\n    memset(&f, 0, sizeof(f));\r\n    f.l_type = lockType;\r\n    f.l_whence = SEEK_SET;\r\n    f.l_start = ofst;\r\n    f.l_len = n;\r\n\r\n    rc = osFcntl(pShmNode->h, F_SETLK, &f);\r\n    rc = (rc!=(-1)) ? SQLITE_OK : SQLITE_BUSY;\r\n  }\r\n\r\n  /* Update the global lock state and do debug tracing */\r\n#ifdef SQLITE_DEBUG\r\n  { u16 mask;\r\n  OSTRACE((\"SHM-LOCK \"));\r\n  mask = (1<<(ofst+n)) - (1<<ofst);\r\n  if( rc==SQLITE_OK ){\r\n    if( lockType==F_UNLCK ){\r\n      OSTRACE((\"unlock %d ok\", ofst));\r\n      pShmNode->exclMask &= ~mask;\r\n      pShmNode->sharedMask &= ~mask;\r\n    }else if( lockType==F_RDLCK ){\r\n      OSTRACE((\"read-lock %d ok\", ofst));\r\n      pShmNode->exclMask &= ~mask;\r\n      pShmNode->sharedMask |= mask;\r\n    }else{\r\n      assert( lockType==F_WRLCK );\r\n      OSTRACE((\"write-lock %d ok\", ofst));\r\n      pShmNode->exclMask |= mask;\r\n      pShmNode->sharedMask &= ~mask;\r\n    }\r\n  }else{\r\n    if( lockType==F_UNLCK ){\r\n      OSTRACE((\"unlock %d failed\", ofst));\r\n    }else if( lockType==F_RDLCK ){\r\n      OSTRACE((\"read-lock failed\"));\r\n    }else{\r\n      assert( lockType==F_WRLCK );\r\n      OSTRACE((\"write-lock %d failed\", ofst));\r\n    }\r\n  }\r\n  OSTRACE((\" - afterwards %03x,%03x\\n\",\r\n           pShmNode->sharedMask, pShmNode->exclMask));\r\n  }\r\n#endif\r\n\r\n  return rc;        \r\n}\r\n\r\n\r\n/*\r\n** Purge the unixShmNodeList list of all entries with unixShmNode.nRef==0.\r\n**\r\n** This is not a VFS shared-memory method; it is a utility function called\r\n** by VFS shared-memory methods.\r\n*/\r\nstatic void unixShmPurge(unixFile *pFd){\r\n  unixShmNode *p = pFd->pInode->pShmNode;\r\n  assert( unixMutexHeld() );\r\n  if( p && p->nRef==0 ){\r\n    int i;\r\n    assert( p->pInode==pFd->pInode );\r\n    sqlite3_mutex_free(p->mutex);\r\n    for(i=0; i<p->nRegion; i++){\r\n      if( p->h>=0 ){\r\n        munmap(p->apRegion[i], p->szRegion);\r\n      }else{\r\n        sqlite3_free(p->apRegion[i]);\r\n      }\r\n    }\r\n    sqlite3_free(p->apRegion);\r\n    if( p->h>=0 ){\r\n      robust_close(pFd, p->h, __LINE__);\r\n      p->h = -1;\r\n    }\r\n    p->pInode->pShmNode = 0;\r\n    sqlite3_free(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Open a shared-memory area associated with open database file pDbFd.  \r\n** This particular implementation uses mmapped files.\r\n**\r\n** The file used to implement shared-memory is in the same directory\r\n** as the open database file and has the same name as the open database\r\n** file with the \"-shm\" suffix added.  For example, if the database file\r\n** is \"/home/user1/config.db\" then the file that is created and mmapped\r\n** for shared memory will be called \"/home/user1/config.db-shm\".  \r\n**\r\n** Another approach to is to use files in /dev/shm or /dev/tmp or an\r\n** some other tmpfs mount. But if a file in a different directory\r\n** from the database file is used, then differing access permissions\r\n** or a chroot() might cause two different processes on the same\r\n** database to end up using different files for shared memory - \r\n** meaning that their memory would not really be shared - resulting\r\n** in database corruption.  Nevertheless, this tmpfs file usage\r\n** can be enabled at compile-time using -DSQLITE_SHM_DIRECTORY=\"/dev/shm\"\r\n** or the equivalent.  The use of the SQLITE_SHM_DIRECTORY compile-time\r\n** option results in an incompatible build of SQLite;  builds of SQLite\r\n** that with differing SQLITE_SHM_DIRECTORY settings attempt to use the\r\n** same database file at the same time, database corruption will likely\r\n** result. The SQLITE_SHM_DIRECTORY compile-time option is considered\r\n** \"unsupported\" and may go away in a future SQLite release.\r\n**\r\n** When opening a new shared-memory file, if no other instances of that\r\n** file are currently open, in this process or in other processes, then\r\n** the file must be truncated to zero length or have its header cleared.\r\n**\r\n** If the original database file (pDbFd) is using the \"unix-excl\" VFS\r\n** that means that an exclusive lock is held on the database file and\r\n** that no other processes are able to read or write the database.  In\r\n** that case, we do not really need shared memory.  No shared memory\r\n** file is created.  The shared memory will be simulated with heap memory.\r\n*/\r\nstatic int unixOpenSharedMemory(unixFile *pDbFd){\r\n  struct unixShm *p = 0;          /* The connection to be opened */\r\n  struct unixShmNode *pShmNode;   /* The underlying mmapped file */\r\n  int rc;                         /* Result code */\r\n  unixInodeInfo *pInode;          /* The inode of fd */\r\n  char *zShmFilename;             /* Name of the file used for SHM */\r\n  int nShmFilename;               /* Size of the SHM filename in bytes */\r\n\r\n  /* Allocate space for the new unixShm object. */\r\n  p = sqlite3_malloc( sizeof(*p) );\r\n  if( p==0 ) return SQLITE_NOMEM;\r\n  memset(p, 0, sizeof(*p));\r\n  assert( pDbFd->pShm==0 );\r\n\r\n  /* Check to see if a unixShmNode object already exists. Reuse an existing\r\n  ** one if present. Create a new one if necessary.\r\n  */\r\n  unixEnterMutex();\r\n  pInode = pDbFd->pInode;\r\n  pShmNode = pInode->pShmNode;\r\n  if( pShmNode==0 ){\r\n    struct stat sStat;                 /* fstat() info for database file */\r\n\r\n    /* Call fstat() to figure out the permissions on the database file. If\r\n    ** a new *-shm file is created, an attempt will be made to create it\r\n    ** with the same permissions.\r\n    */\r\n    if( osFstat(pDbFd->h, &sStat) && pInode->bProcessLock==0 ){\r\n      rc = SQLITE_IOERR_FSTAT;\r\n      goto shm_open_err;\r\n    }\r\n\r\n#ifdef SQLITE_SHM_DIRECTORY\r\n    nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 31;\r\n#else\r\n    nShmFilename = 6 + (int)strlen(pDbFd->zPath);\r\n#endif\r\n    pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nShmFilename );\r\n    if( pShmNode==0 ){\r\n      rc = SQLITE_NOMEM;\r\n      goto shm_open_err;\r\n    }\r\n    memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename);\r\n    zShmFilename = pShmNode->zFilename = (char*)&pShmNode[1];\r\n#ifdef SQLITE_SHM_DIRECTORY\r\n    sqlite3_snprintf(nShmFilename, zShmFilename, \r\n                     SQLITE_SHM_DIRECTORY \"/sqlite-shm-%x-%x\",\r\n                     (u32)sStat.st_ino, (u32)sStat.st_dev);\r\n#else\r\n    sqlite3_snprintf(nShmFilename, zShmFilename, \"%s-shm\", pDbFd->zPath);\r\n    sqlite3FileSuffix3(pDbFd->zPath, zShmFilename);\r\n#endif\r\n    pShmNode->h = -1;\r\n    pDbFd->pInode->pShmNode = pShmNode;\r\n    pShmNode->pInode = pDbFd->pInode;\r\n    pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);\r\n    if( pShmNode->mutex==0 ){\r\n      rc = SQLITE_NOMEM;\r\n      goto shm_open_err;\r\n    }\r\n\r\n    if( pInode->bProcessLock==0 ){\r\n      int openFlags = O_RDWR | O_CREAT;\r\n      if( sqlite3_uri_boolean(pDbFd->zPath, \"readonly_shm\", 0) ){\r\n        openFlags = O_RDONLY;\r\n        pShmNode->isReadonly = 1;\r\n      }\r\n      pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777));\r\n      if( pShmNode->h<0 ){\r\n        rc = unixLogError(SQLITE_CANTOPEN_BKPT, \"open\", zShmFilename);\r\n        goto shm_open_err;\r\n      }\r\n\r\n      /* If this process is running as root, make sure that the SHM file\r\n      ** is owned by the same user that owns the original database.  Otherwise,\r\n      ** the original owner will not be able to connect. If this process is\r\n      ** not root, the following fchown() will fail, but we don't care.  The\r\n      ** if(){..} and the UNIXFILE_CHOWN flag are purely to silence compiler\r\n      ** warnings.\r\n      */\r\n      if( osFchown(pShmNode->h, sStat.st_uid, sStat.st_gid)==0 ){\r\n        pDbFd->ctrlFlags |= UNIXFILE_CHOWN;\r\n      }\r\n  \r\n      /* Check to see if another process is holding the dead-man switch.\r\n      ** If not, truncate the file to zero length. \r\n      */\r\n      rc = SQLITE_OK;\r\n      if( unixShmSystemLock(pShmNode, F_WRLCK, UNIX_SHM_DMS, 1)==SQLITE_OK ){\r\n        if( robust_ftruncate(pShmNode->h, 0) ){\r\n          rc = unixLogError(SQLITE_IOERR_SHMOPEN, \"ftruncate\", zShmFilename);\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        rc = unixShmSystemLock(pShmNode, F_RDLCK, UNIX_SHM_DMS, 1);\r\n      }\r\n      if( rc ) goto shm_open_err;\r\n    }\r\n  }\r\n\r\n  /* Make the new connection a child of the unixShmNode */\r\n  p->pShmNode = pShmNode;\r\n#ifdef SQLITE_DEBUG\r\n  p->id = pShmNode->nextShmId++;\r\n#endif\r\n  pShmNode->nRef++;\r\n  pDbFd->pShm = p;\r\n  unixLeaveMutex();\r\n\r\n  /* The reference count on pShmNode has already been incremented under\r\n  ** the cover of the unixEnterMutex() mutex and the pointer from the\r\n  ** new (struct unixShm) object to the pShmNode has been set. All that is\r\n  ** left to do is to link the new object into the linked list starting\r\n  ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex \r\n  ** mutex.\r\n  */\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  p->pNext = pShmNode->pFirst;\r\n  pShmNode->pFirst = p;\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  return SQLITE_OK;\r\n\r\n  /* Jump here on any error */\r\nshm_open_err:\r\n  unixShmPurge(pDbFd);       /* This call frees pShmNode if required */\r\n  sqlite3_free(p);\r\n  unixLeaveMutex();\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called to obtain a pointer to region iRegion of the \r\n** shared-memory associated with the database file fd. Shared-memory regions \r\n** are numbered starting from zero. Each shared-memory region is szRegion \r\n** bytes in size.\r\n**\r\n** If an error occurs, an error code is returned and *pp is set to NULL.\r\n**\r\n** Otherwise, if the bExtend parameter is 0 and the requested shared-memory\r\n** region has not been allocated (by any client, including one running in a\r\n** separate process), then *pp is set to NULL and SQLITE_OK returned. If \r\n** bExtend is non-zero and the requested shared-memory region has not yet \r\n** been allocated, it is allocated by this function.\r\n**\r\n** If the shared-memory region has already been allocated or is allocated by\r\n** this call as described above, then it is mapped into this processes \r\n** address space (if it is not already), *pp is set to point to the mapped \r\n** memory and SQLITE_OK returned.\r\n*/\r\nstatic int unixShmMap(\r\n  sqlite3_file *fd,               /* Handle open on database file */\r\n  int iRegion,                    /* Region to retrieve */\r\n  int szRegion,                   /* Size of regions */\r\n  int bExtend,                    /* True to extend file if necessary */\r\n  void volatile **pp              /* OUT: Mapped memory */\r\n){\r\n  unixFile *pDbFd = (unixFile*)fd;\r\n  unixShm *p;\r\n  unixShmNode *pShmNode;\r\n  int rc = SQLITE_OK;\r\n\r\n  /* If the shared-memory file has not yet been opened, open it now. */\r\n  if( pDbFd->pShm==0 ){\r\n    rc = unixOpenSharedMemory(pDbFd);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n\r\n  p = pDbFd->pShm;\r\n  pShmNode = p->pShmNode;\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );\r\n  assert( pShmNode->pInode==pDbFd->pInode );\r\n  assert( pShmNode->h>=0 || pDbFd->pInode->bProcessLock==1 );\r\n  assert( pShmNode->h<0 || pDbFd->pInode->bProcessLock==0 );\r\n\r\n  if( pShmNode->nRegion<=iRegion ){\r\n    char **apNew;                      /* New apRegion[] array */\r\n    int nByte = (iRegion+1)*szRegion;  /* Minimum required file size */\r\n    struct stat sStat;                 /* Used by fstat() */\r\n\r\n    pShmNode->szRegion = szRegion;\r\n\r\n    if( pShmNode->h>=0 ){\r\n      /* The requested region is not mapped into this processes address space.\r\n      ** Check to see if it has been allocated (i.e. if the wal-index file is\r\n      ** large enough to contain the requested region).\r\n      */\r\n      if( osFstat(pShmNode->h, &sStat) ){\r\n        rc = SQLITE_IOERR_SHMSIZE;\r\n        goto shmpage_out;\r\n      }\r\n  \r\n      if( sStat.st_size<nByte ){\r\n        /* The requested memory region does not exist. If bExtend is set to\r\n        ** false, exit early. *pp will be set to NULL and SQLITE_OK returned.\r\n        **\r\n        ** Alternatively, if bExtend is true, use ftruncate() to allocate\r\n        ** the requested memory region.\r\n        */\r\n        if( !bExtend ) goto shmpage_out;\r\n        if( robust_ftruncate(pShmNode->h, nByte) ){\r\n          rc = unixLogError(SQLITE_IOERR_SHMSIZE, \"ftruncate\",\r\n                            pShmNode->zFilename);\r\n          goto shmpage_out;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Map the requested memory region into this processes address space. */\r\n    apNew = (char **)sqlite3_realloc(\r\n        pShmNode->apRegion, (iRegion+1)*sizeof(char *)\r\n    );\r\n    if( !apNew ){\r\n      rc = SQLITE_IOERR_NOMEM;\r\n      goto shmpage_out;\r\n    }\r\n    pShmNode->apRegion = apNew;\r\n    while(pShmNode->nRegion<=iRegion){\r\n      void *pMem;\r\n      if( pShmNode->h>=0 ){\r\n        pMem = mmap(0, szRegion,\r\n            pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE, \r\n            MAP_SHARED, pShmNode->h, pShmNode->nRegion*szRegion\r\n        );\r\n        if( pMem==MAP_FAILED ){\r\n          rc = unixLogError(SQLITE_IOERR_SHMMAP, \"mmap\", pShmNode->zFilename);\r\n          goto shmpage_out;\r\n        }\r\n      }else{\r\n        pMem = sqlite3_malloc(szRegion);\r\n        if( pMem==0 ){\r\n          rc = SQLITE_NOMEM;\r\n          goto shmpage_out;\r\n        }\r\n        memset(pMem, 0, szRegion);\r\n      }\r\n      pShmNode->apRegion[pShmNode->nRegion] = pMem;\r\n      pShmNode->nRegion++;\r\n    }\r\n  }\r\n\r\nshmpage_out:\r\n  if( pShmNode->nRegion>iRegion ){\r\n    *pp = pShmNode->apRegion[iRegion];\r\n  }else{\r\n    *pp = 0;\r\n  }\r\n  if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Change the lock state for a shared-memory segment.\r\n**\r\n** Note that the relationship between SHAREd and EXCLUSIVE locks is a little\r\n** different here than in posix.  In xShmLock(), one can go from unlocked\r\n** to shared and back or from unlocked to exclusive and back.  But one may\r\n** not go from shared to exclusive or from exclusive to shared.\r\n*/\r\nstatic int unixShmLock(\r\n  sqlite3_file *fd,          /* Database file holding the shared memory */\r\n  int ofst,                  /* First lock to acquire or release */\r\n  int n,                     /* Number of locks to acquire or release */\r\n  int flags                  /* What to do with the lock */\r\n){\r\n  unixFile *pDbFd = (unixFile*)fd;      /* Connection holding shared memory */\r\n  unixShm *p = pDbFd->pShm;             /* The shared memory being locked */\r\n  unixShm *pX;                          /* For looping over all siblings */\r\n  unixShmNode *pShmNode = p->pShmNode;  /* The underlying file iNode */\r\n  int rc = SQLITE_OK;                   /* Result code */\r\n  u16 mask;                             /* Mask of locks to take or release */\r\n\r\n  assert( pShmNode==pDbFd->pInode->pShmNode );\r\n  assert( pShmNode->pInode==pDbFd->pInode );\r\n  assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );\r\n  assert( n>=1 );\r\n  assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)\r\n       || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)\r\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)\r\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) );\r\n  assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 );\r\n  assert( pShmNode->h>=0 || pDbFd->pInode->bProcessLock==1 );\r\n  assert( pShmNode->h<0 || pDbFd->pInode->bProcessLock==0 );\r\n\r\n  mask = (1<<(ofst+n)) - (1<<ofst);\r\n  assert( n>1 || mask==(1<<ofst) );\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  if( flags & SQLITE_SHM_UNLOCK ){\r\n    u16 allMask = 0; /* Mask of locks held by siblings */\r\n\r\n    /* See if any siblings hold this same lock */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( pX==p ) continue;\r\n      assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );\r\n      allMask |= pX->sharedMask;\r\n    }\r\n\r\n    /* Unlock the system-level locks */\r\n    if( (mask & allMask)==0 ){\r\n      rc = unixShmSystemLock(pShmNode, F_UNLCK, ofst+UNIX_SHM_BASE, n);\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n\r\n    /* Undo the local locks */\r\n    if( rc==SQLITE_OK ){\r\n      p->exclMask &= ~mask;\r\n      p->sharedMask &= ~mask;\r\n    } \r\n  }else if( flags & SQLITE_SHM_SHARED ){\r\n    u16 allShared = 0;  /* Union of locks held by connections other than \"p\" */\r\n\r\n    /* Find out which shared locks are already held by sibling connections.\r\n    ** If any sibling already holds an exclusive lock, go ahead and return\r\n    ** SQLITE_BUSY.\r\n    */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( (pX->exclMask & mask)!=0 ){\r\n        rc = SQLITE_BUSY;\r\n        break;\r\n      }\r\n      allShared |= pX->sharedMask;\r\n    }\r\n\r\n    /* Get shared locks at the system level, if necessary */\r\n    if( rc==SQLITE_OK ){\r\n      if( (allShared & mask)==0 ){\r\n        rc = unixShmSystemLock(pShmNode, F_RDLCK, ofst+UNIX_SHM_BASE, n);\r\n      }else{\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n\r\n    /* Get the local shared locks */\r\n    if( rc==SQLITE_OK ){\r\n      p->sharedMask |= mask;\r\n    }\r\n  }else{\r\n    /* Make sure no sibling connections hold locks that will block this\r\n    ** lock.  If any do, return SQLITE_BUSY right away.\r\n    */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){\r\n        rc = SQLITE_BUSY;\r\n        break;\r\n      }\r\n    }\r\n  \r\n    /* Get the exclusive locks at the system level.  Then if successful\r\n    ** also mark the local connection as being locked.\r\n    */\r\n    if( rc==SQLITE_OK ){\r\n      rc = unixShmSystemLock(pShmNode, F_WRLCK, ofst+UNIX_SHM_BASE, n);\r\n      if( rc==SQLITE_OK ){\r\n        assert( (p->sharedMask & mask)==0 );\r\n        p->exclMask |= mask;\r\n      }\r\n    }\r\n  }\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  OSTRACE((\"SHM-LOCK shmid-%d, pid-%d got %03x,%03x\\n\",\r\n           p->id, getpid(), p->sharedMask, p->exclMask));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Implement a memory barrier or memory fence on shared memory.  \r\n**\r\n** All loads and stores begun before the barrier must complete before\r\n** any load or store begun after the barrier.\r\n*/\r\nstatic void unixShmBarrier(\r\n  sqlite3_file *fd                /* Database file holding the shared memory */\r\n){\r\n  UNUSED_PARAMETER(fd);\r\n  unixEnterMutex();\r\n  unixLeaveMutex();\r\n}\r\n\r\n/*\r\n** Close a connection to shared-memory.  Delete the underlying \r\n** storage if deleteFlag is true.\r\n**\r\n** If there is no shared memory associated with the connection then this\r\n** routine is a harmless no-op.\r\n*/\r\nstatic int unixShmUnmap(\r\n  sqlite3_file *fd,               /* The underlying database file */\r\n  int deleteFlag                  /* Delete shared-memory if true */\r\n){\r\n  unixShm *p;                     /* The connection to be closed */\r\n  unixShmNode *pShmNode;          /* The underlying shared-memory file */\r\n  unixShm **pp;                   /* For looping over sibling connections */\r\n  unixFile *pDbFd;                /* The underlying database file */\r\n\r\n  pDbFd = (unixFile*)fd;\r\n  p = pDbFd->pShm;\r\n  if( p==0 ) return SQLITE_OK;\r\n  pShmNode = p->pShmNode;\r\n\r\n  assert( pShmNode==pDbFd->pInode->pShmNode );\r\n  assert( pShmNode->pInode==pDbFd->pInode );\r\n\r\n  /* Remove connection p from the set of connections associated\r\n  ** with pShmNode */\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}\r\n  *pp = p->pNext;\r\n\r\n  /* Free the connection p */\r\n  sqlite3_free(p);\r\n  pDbFd->pShm = 0;\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n\r\n  /* If pShmNode->nRef has reached 0, then close the underlying\r\n  ** shared-memory file, too */\r\n  unixEnterMutex();\r\n  assert( pShmNode->nRef>0 );\r\n  pShmNode->nRef--;\r\n  if( pShmNode->nRef==0 ){\r\n    if( deleteFlag && pShmNode->h>=0 ) osUnlink(pShmNode->zFilename);\r\n    unixShmPurge(pDbFd);\r\n  }\r\n  unixLeaveMutex();\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n#else\r\n# define unixShmMap     0\r\n# define unixShmLock    0\r\n# define unixShmBarrier 0\r\n# define unixShmUnmap   0\r\n#endif /* #ifndef SQLITE_OMIT_WAL */\r\n\r\n/*\r\n** Here ends the implementation of all sqlite3_file methods.\r\n**\r\n********************** End sqlite3_file Methods *******************************\r\n******************************************************************************/\r\n\r\n/*\r\n** This division contains definitions of sqlite3_io_methods objects that\r\n** implement various file locking strategies.  It also contains definitions\r\n** of \"finder\" functions.  A finder-function is used to locate the appropriate\r\n** sqlite3_io_methods object for a particular database file.  The pAppData\r\n** field of the sqlite3_vfs VFS objects are initialized to be pointers to\r\n** the correct finder-function for that VFS.\r\n**\r\n** Most finder functions return a pointer to a fixed sqlite3_io_methods\r\n** object.  The only interesting finder-function is autolockIoFinder, which\r\n** looks at the filesystem type and tries to guess the best locking\r\n** strategy from that.\r\n**\r\n** For finder-funtion F, two objects are created:\r\n**\r\n**    (1) The real finder-function named \"FImpt()\".\r\n**\r\n**    (2) A constant pointer to this function named just \"F\".\r\n**\r\n**\r\n** A pointer to the F pointer is used as the pAppData value for VFS\r\n** objects.  We have to do this instead of letting pAppData point\r\n** directly at the finder-function since C90 rules prevent a void*\r\n** from be cast into a function pointer.\r\n**\r\n**\r\n** Each instance of this macro generates two objects:\r\n**\r\n**   *  A constant sqlite3_io_methods object call METHOD that has locking\r\n**      methods CLOSE, LOCK, UNLOCK, CKRESLOCK.\r\n**\r\n**   *  An I/O method finder function called FINDER that returns a pointer\r\n**      to the METHOD object in the previous bullet.\r\n*/\r\n#define IOMETHODS(FINDER, METHOD, VERSION, CLOSE, LOCK, UNLOCK, CKLOCK)      \\\r\nstatic const sqlite3_io_methods METHOD = {                                   \\\r\n   VERSION,                    /* iVersion */                                \\\r\n   CLOSE,                      /* xClose */                                  \\\r\n   unixRead,                   /* xRead */                                   \\\r\n   unixWrite,                  /* xWrite */                                  \\\r\n   unixTruncate,               /* xTruncate */                               \\\r\n   unixSync,                   /* xSync */                                   \\\r\n   unixFileSize,               /* xFileSize */                               \\\r\n   LOCK,                       /* xLock */                                   \\\r\n   UNLOCK,                     /* xUnlock */                                 \\\r\n   CKLOCK,                     /* xCheckReservedLock */                      \\\r\n   unixFileControl,            /* xFileControl */                            \\\r\n   unixSectorSize,             /* xSectorSize */                             \\\r\n   unixDeviceCharacteristics,  /* xDeviceCapabilities */                     \\\r\n   unixShmMap,                 /* xShmMap */                                 \\\r\n   unixShmLock,                /* xShmLock */                                \\\r\n   unixShmBarrier,             /* xShmBarrier */                             \\\r\n   unixShmUnmap                /* xShmUnmap */                               \\\r\n};                                                                           \\\r\nstatic const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){   \\\r\n  UNUSED_PARAMETER(z); UNUSED_PARAMETER(p);                                  \\\r\n  return &METHOD;                                                            \\\r\n}                                                                            \\\r\nstatic const sqlite3_io_methods *(*const FINDER)(const char*,unixFile *p)    \\\r\n    = FINDER##Impl;\r\n\r\n/*\r\n** Here are all of the sqlite3_io_methods objects for each of the\r\n** locking strategies.  Functions that return pointers to these methods\r\n** are also created.\r\n*/\r\nIOMETHODS(\r\n  posixIoFinder,            /* Finder function name */\r\n  posixIoMethods,           /* sqlite3_io_methods object name */\r\n  2,                        /* shared memory is enabled */\r\n  unixClose,                /* xClose method */\r\n  unixLock,                 /* xLock method */\r\n  unixUnlock,               /* xUnlock method */\r\n  unixCheckReservedLock     /* xCheckReservedLock method */\r\n)\r\nIOMETHODS(\r\n  nolockIoFinder,           /* Finder function name */\r\n  nolockIoMethods,          /* sqlite3_io_methods object name */\r\n  1,                        /* shared memory is disabled */\r\n  nolockClose,              /* xClose method */\r\n  nolockLock,               /* xLock method */\r\n  nolockUnlock,             /* xUnlock method */\r\n  nolockCheckReservedLock   /* xCheckReservedLock method */\r\n)\r\nIOMETHODS(\r\n  dotlockIoFinder,          /* Finder function name */\r\n  dotlockIoMethods,         /* sqlite3_io_methods object name */\r\n  1,                        /* shared memory is disabled */\r\n  dotlockClose,             /* xClose method */\r\n  dotlockLock,              /* xLock method */\r\n  dotlockUnlock,            /* xUnlock method */\r\n  dotlockCheckReservedLock  /* xCheckReservedLock method */\r\n)\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS\r\nIOMETHODS(\r\n  flockIoFinder,            /* Finder function name */\r\n  flockIoMethods,           /* sqlite3_io_methods object name */\r\n  1,                        /* shared memory is disabled */\r\n  flockClose,               /* xClose method */\r\n  flockLock,                /* xLock method */\r\n  flockUnlock,              /* xUnlock method */\r\n  flockCheckReservedLock    /* xCheckReservedLock method */\r\n)\r\n#endif\r\n\r\n#if OS_VXWORKS\r\nIOMETHODS(\r\n  semIoFinder,              /* Finder function name */\r\n  semIoMethods,             /* sqlite3_io_methods object name */\r\n  1,                        /* shared memory is disabled */\r\n  semClose,                 /* xClose method */\r\n  semLock,                  /* xLock method */\r\n  semUnlock,                /* xUnlock method */\r\n  semCheckReservedLock      /* xCheckReservedLock method */\r\n)\r\n#endif\r\n\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\nIOMETHODS(\r\n  afpIoFinder,              /* Finder function name */\r\n  afpIoMethods,             /* sqlite3_io_methods object name */\r\n  1,                        /* shared memory is disabled */\r\n  afpClose,                 /* xClose method */\r\n  afpLock,                  /* xLock method */\r\n  afpUnlock,                /* xUnlock method */\r\n  afpCheckReservedLock      /* xCheckReservedLock method */\r\n)\r\n#endif\r\n\r\n/*\r\n** The proxy locking method is a \"super-method\" in the sense that it\r\n** opens secondary file descriptors for the conch and lock files and\r\n** it uses proxy, dot-file, AFP, and flock() locking methods on those\r\n** secondary files.  For this reason, the division that implements\r\n** proxy locking is located much further down in the file.  But we need\r\n** to go ahead and define the sqlite3_io_methods and finder function\r\n** for proxy locking here.  So we forward declare the I/O methods.\r\n*/\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\nstatic int proxyClose(sqlite3_file*);\r\nstatic int proxyLock(sqlite3_file*, int);\r\nstatic int proxyUnlock(sqlite3_file*, int);\r\nstatic int proxyCheckReservedLock(sqlite3_file*, int*);\r\nIOMETHODS(\r\n  proxyIoFinder,            /* Finder function name */\r\n  proxyIoMethods,           /* sqlite3_io_methods object name */\r\n  1,                        /* shared memory is disabled */\r\n  proxyClose,               /* xClose method */\r\n  proxyLock,                /* xLock method */\r\n  proxyUnlock,              /* xUnlock method */\r\n  proxyCheckReservedLock    /* xCheckReservedLock method */\r\n)\r\n#endif\r\n\r\n/* nfs lockd on OSX 10.3+ doesn't clear write locks when a read lock is set */\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\nIOMETHODS(\r\n  nfsIoFinder,               /* Finder function name */\r\n  nfsIoMethods,              /* sqlite3_io_methods object name */\r\n  1,                         /* shared memory is disabled */\r\n  unixClose,                 /* xClose method */\r\n  unixLock,                  /* xLock method */\r\n  nfsUnlock,                 /* xUnlock method */\r\n  unixCheckReservedLock      /* xCheckReservedLock method */\r\n)\r\n#endif\r\n\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n/* \r\n** This \"finder\" function attempts to determine the best locking strategy \r\n** for the database file \"filePath\".  It then returns the sqlite3_io_methods\r\n** object that implements that strategy.\r\n**\r\n** This is for MacOSX only.\r\n*/\r\nstatic const sqlite3_io_methods *autolockIoFinderImpl(\r\n  const char *filePath,    /* name of the database file */\r\n  unixFile *pNew           /* open file object for the database file */\r\n){\r\n  static const struct Mapping {\r\n    const char *zFilesystem;              /* Filesystem type name */\r\n    const sqlite3_io_methods *pMethods;   /* Appropriate locking method */\r\n  } aMap[] = {\r\n    { \"hfs\",    &posixIoMethods },\r\n    { \"ufs\",    &posixIoMethods },\r\n    { \"afpfs\",  &afpIoMethods },\r\n    { \"smbfs\",  &afpIoMethods },\r\n    { \"webdav\", &nolockIoMethods },\r\n    { 0, 0 }\r\n  };\r\n  int i;\r\n  struct statfs fsInfo;\r\n  struct flock lockInfo;\r\n\r\n  if( !filePath ){\r\n    /* If filePath==NULL that means we are dealing with a transient file\r\n    ** that does not need to be locked. */\r\n    return &nolockIoMethods;\r\n  }\r\n  if( statfs(filePath, &fsInfo) != -1 ){\r\n    if( fsInfo.f_flags & MNT_RDONLY ){\r\n      return &nolockIoMethods;\r\n    }\r\n    for(i=0; aMap[i].zFilesystem; i++){\r\n      if( strcmp(fsInfo.f_fstypename, aMap[i].zFilesystem)==0 ){\r\n        return aMap[i].pMethods;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Default case. Handles, amongst others, \"nfs\".\r\n  ** Test byte-range lock using fcntl(). If the call succeeds, \r\n  ** assume that the file-system supports POSIX style locks. \r\n  */\r\n  lockInfo.l_len = 1;\r\n  lockInfo.l_start = 0;\r\n  lockInfo.l_whence = SEEK_SET;\r\n  lockInfo.l_type = F_RDLCK;\r\n  if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {\r\n    if( strcmp(fsInfo.f_fstypename, \"nfs\")==0 ){\r\n      return &nfsIoMethods;\r\n    } else {\r\n      return &posixIoMethods;\r\n    }\r\n  }else{\r\n    return &dotlockIoMethods;\r\n  }\r\n}\r\nstatic const sqlite3_io_methods \r\n  *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;\r\n\r\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\r\n\r\n#if OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE\r\n/* \r\n** This \"finder\" function attempts to determine the best locking strategy \r\n** for the database file \"filePath\".  It then returns the sqlite3_io_methods\r\n** object that implements that strategy.\r\n**\r\n** This is for VXWorks only.\r\n*/\r\nstatic const sqlite3_io_methods *autolockIoFinderImpl(\r\n  const char *filePath,    /* name of the database file */\r\n  unixFile *pNew           /* the open file object */\r\n){\r\n  struct flock lockInfo;\r\n\r\n  if( !filePath ){\r\n    /* If filePath==NULL that means we are dealing with a transient file\r\n    ** that does not need to be locked. */\r\n    return &nolockIoMethods;\r\n  }\r\n\r\n  /* Test if fcntl() is supported and use POSIX style locks.\r\n  ** Otherwise fall back to the named semaphore method.\r\n  */\r\n  lockInfo.l_len = 1;\r\n  lockInfo.l_start = 0;\r\n  lockInfo.l_whence = SEEK_SET;\r\n  lockInfo.l_type = F_RDLCK;\r\n  if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {\r\n    return &posixIoMethods;\r\n  }else{\r\n    return &semIoMethods;\r\n  }\r\n}\r\nstatic const sqlite3_io_methods \r\n  *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;\r\n\r\n#endif /* OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE */\r\n\r\n/*\r\n** An abstract type for a pointer to a IO method finder function:\r\n*/\r\ntypedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);\r\n\r\n\r\n/****************************************************************************\r\n**************************** sqlite3_vfs methods ****************************\r\n**\r\n** This division contains the implementation of methods on the\r\n** sqlite3_vfs object.\r\n*/\r\n\r\n/*\r\n** Initialize the contents of the unixFile structure pointed to by pId.\r\n*/\r\nstatic int fillInUnixFile(\r\n  sqlite3_vfs *pVfs,      /* Pointer to vfs object */\r\n  int h,                  /* Open file descriptor of file being opened */\r\n  sqlite3_file *pId,      /* Write to the unixFile structure here */\r\n  const char *zFilename,  /* Name of the file being opened */\r\n  int ctrlFlags           /* Zero or more UNIXFILE_* values */\r\n){\r\n  const sqlite3_io_methods *pLockingStyle;\r\n  unixFile *pNew = (unixFile *)pId;\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pNew->pInode==NULL );\r\n\r\n  /* Usually the path zFilename should not be a relative pathname. The\r\n  ** exception is when opening the proxy \"conch\" file in builds that\r\n  ** include the special Apple locking styles.\r\n  */\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n  assert( zFilename==0 || zFilename[0]=='/' \r\n    || pVfs->pAppData==(void*)&autolockIoFinder );\r\n#else\r\n  assert( zFilename==0 || zFilename[0]=='/' );\r\n#endif\r\n\r\n  /* No locking occurs in temporary files */\r\n  assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 );\r\n\r\n  OSTRACE((\"OPEN    %-3d %s\\n\", h, zFilename));\r\n  pNew->h = h;\r\n  pNew->pVfs = pVfs;\r\n  pNew->zPath = zFilename;\r\n  pNew->ctrlFlags = (u8)ctrlFlags;\r\n  if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),\r\n                           \"psow\", SQLITE_POWERSAFE_OVERWRITE) ){\r\n    pNew->ctrlFlags |= UNIXFILE_PSOW;\r\n  }\r\n  if( memcmp(pVfs->zName,\"unix-excl\",10)==0 ){\r\n    pNew->ctrlFlags |= UNIXFILE_EXCL;\r\n  }\r\n\r\n#if OS_VXWORKS\r\n  pNew->pId = vxworksFindFileId(zFilename);\r\n  if( pNew->pId==0 ){\r\n    ctrlFlags |= UNIXFILE_NOLOCK;\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n#endif\r\n\r\n  if( ctrlFlags & UNIXFILE_NOLOCK ){\r\n    pLockingStyle = &nolockIoMethods;\r\n  }else{\r\n    pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew);\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n    /* Cache zFilename in the locking context (AFP and dotlock override) for\r\n    ** proxyLock activation is possible (remote proxy is based on db name)\r\n    ** zFilename remains valid until file is closed, to support */\r\n    pNew->lockingContext = (void*)zFilename;\r\n#endif\r\n  }\r\n\r\n  if( pLockingStyle == &posixIoMethods\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n    || pLockingStyle == &nfsIoMethods\r\n#endif\r\n  ){\r\n    unixEnterMutex();\r\n    rc = findInodeInfo(pNew, &pNew->pInode);\r\n    if( rc!=SQLITE_OK ){\r\n      /* If an error occured in findInodeInfo(), close the file descriptor\r\n      ** immediately, before releasing the mutex. findInodeInfo() may fail\r\n      ** in two scenarios:\r\n      **\r\n      **   (a) A call to fstat() failed.\r\n      **   (b) A malloc failed.\r\n      **\r\n      ** Scenario (b) may only occur if the process is holding no other\r\n      ** file descriptors open on the same file. If there were other file\r\n      ** descriptors on this file, then no malloc would be required by\r\n      ** findInodeInfo(). If this is the case, it is quite safe to close\r\n      ** handle h - as it is guaranteed that no posix locks will be released\r\n      ** by doing so.\r\n      **\r\n      ** If scenario (a) caused the error then things are not so safe. The\r\n      ** implicit assumption here is that if fstat() fails, things are in\r\n      ** such bad shape that dropping a lock or two doesn't matter much.\r\n      */\r\n      robust_close(pNew, h, __LINE__);\r\n      h = -1;\r\n    }\r\n    unixLeaveMutex();\r\n  }\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\r\n  else if( pLockingStyle == &afpIoMethods ){\r\n    /* AFP locking uses the file path so it needs to be included in\r\n    ** the afpLockingContext.\r\n    */\r\n    afpLockingContext *pCtx;\r\n    pNew->lockingContext = pCtx = sqlite3_malloc( sizeof(*pCtx) );\r\n    if( pCtx==0 ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      /* NB: zFilename exists and remains valid until the file is closed\r\n      ** according to requirement F11141.  So we do not need to make a\r\n      ** copy of the filename. */\r\n      pCtx->dbPath = zFilename;\r\n      pCtx->reserved = 0;\r\n      srandomdev();\r\n      unixEnterMutex();\r\n      rc = findInodeInfo(pNew, &pNew->pInode);\r\n      if( rc!=SQLITE_OK ){\r\n        sqlite3_free(pNew->lockingContext);\r\n        robust_close(pNew, h, __LINE__);\r\n        h = -1;\r\n      }\r\n      unixLeaveMutex();        \r\n    }\r\n  }\r\n#endif\r\n\r\n  else if( pLockingStyle == &dotlockIoMethods ){\r\n    /* Dotfile locking uses the file path so it needs to be included in\r\n    ** the dotlockLockingContext \r\n    */\r\n    char *zLockFile;\r\n    int nFilename;\r\n    assert( zFilename!=0 );\r\n    nFilename = (int)strlen(zFilename) + 6;\r\n    zLockFile = (char *)sqlite3_malloc(nFilename);\r\n    if( zLockFile==0 ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      sqlite3_snprintf(nFilename, zLockFile, \"%s\" DOTLOCK_SUFFIX, zFilename);\r\n    }\r\n    pNew->lockingContext = zLockFile;\r\n  }\r\n\r\n#if OS_VXWORKS\r\n  else if( pLockingStyle == &semIoMethods ){\r\n    /* Named semaphore locking uses the file path so it needs to be\r\n    ** included in the semLockingContext\r\n    */\r\n    unixEnterMutex();\r\n    rc = findInodeInfo(pNew, &pNew->pInode);\r\n    if( (rc==SQLITE_OK) && (pNew->pInode->pSem==NULL) ){\r\n      char *zSemName = pNew->pInode->aSemName;\r\n      int n;\r\n      sqlite3_snprintf(MAX_PATHNAME, zSemName, \"/%s.sem\",\r\n                       pNew->pId->zCanonicalName);\r\n      for( n=1; zSemName[n]; n++ )\r\n        if( zSemName[n]=='/' ) zSemName[n] = '_';\r\n      pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1);\r\n      if( pNew->pInode->pSem == SEM_FAILED ){\r\n        rc = SQLITE_NOMEM;\r\n        pNew->pInode->aSemName[0] = '\\0';\r\n      }\r\n    }\r\n    unixLeaveMutex();\r\n  }\r\n#endif\r\n  \r\n  pNew->lastErrno = 0;\r\n#if OS_VXWORKS\r\n  if( rc!=SQLITE_OK ){\r\n    if( h>=0 ) robust_close(pNew, h, __LINE__);\r\n    h = -1;\r\n    osUnlink(zFilename);\r\n    isDelete = 0;\r\n  }\r\n  if( isDelete ) pNew->ctrlFlags |= UNIXFILE_DELETE;\r\n#endif\r\n  if( rc!=SQLITE_OK ){\r\n    if( h>=0 ) robust_close(pNew, h, __LINE__);\r\n  }else{\r\n    pNew->pMethod = pLockingStyle;\r\n    OpenCounter(+1);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the name of a directory in which to put temporary files.\r\n** If no suitable temporary file directory can be found, return NULL.\r\n*/\r\nstatic const char *unixTempFileDir(void){\r\n  static const char *azDirs[] = {\r\n     0,\r\n     0,\r\n     \"/var/tmp\",\r\n     \"/usr/tmp\",\r\n     \"/tmp\",\r\n     0        /* List terminator */\r\n  };\r\n  unsigned int i;\r\n  struct stat buf;\r\n  const char *zDir = 0;\r\n\r\n  azDirs[0] = sqlite3_temp_directory;\r\n  if( !azDirs[1] ) azDirs[1] = getenv(\"TMPDIR\");\r\n  for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){\r\n    if( zDir==0 ) continue;\r\n    if( osStat(zDir, &buf) ) continue;\r\n    if( !S_ISDIR(buf.st_mode) ) continue;\r\n    if( osAccess(zDir, 07) ) continue;\r\n    break;\r\n  }\r\n  return zDir;\r\n}\r\n\r\n/*\r\n** Create a temporary file name in zBuf.  zBuf must be allocated\r\n** by the calling process and must be big enough to hold at least\r\n** pVfs->mxPathname bytes.\r\n*/\r\nstatic int unixGetTempname(int nBuf, char *zBuf){\r\n  static const unsigned char zChars[] =\r\n    \"abcdefghijklmnopqrstuvwxyz\"\r\n    \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\r\n    \"0123456789\";\r\n  unsigned int i, j;\r\n  const char *zDir;\r\n\r\n  /* It's odd to simulate an io-error here, but really this is just\r\n  ** using the io-error infrastructure to test that SQLite handles this\r\n  ** function failing. \r\n  */\r\n  SimulateIOError( return SQLITE_IOERR );\r\n\r\n  zDir = unixTempFileDir();\r\n  if( zDir==0 ) zDir = \".\";\r\n\r\n  /* Check that the output buffer is large enough for the temporary file \r\n  ** name. If it is not, return SQLITE_ERROR.\r\n  */\r\n  if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  do{\r\n    sqlite3_snprintf(nBuf-18, zBuf, \"%s/\"SQLITE_TEMP_FILE_PREFIX, zDir);\r\n    j = (int)strlen(zBuf);\r\n    sqlite3_randomness(15, &zBuf[j]);\r\n    for(i=0; i<15; i++, j++){\r\n      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];\r\n    }\r\n    zBuf[j] = 0;\r\n    zBuf[j+1] = 0;\r\n  }while( osAccess(zBuf,0)==0 );\r\n  return SQLITE_OK;\r\n}\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\r\n/*\r\n** Routine to transform a unixFile into a proxy-locking unixFile.\r\n** Implementation in the proxy-lock division, but used by unixOpen()\r\n** if SQLITE_PREFER_PROXY_LOCKING is defined.\r\n*/\r\nstatic int proxyTransformUnixFile(unixFile*, const char*);\r\n#endif\r\n\r\n/*\r\n** Search for an unused file descriptor that was opened on the database \r\n** file (not a journal or master-journal file) identified by pathname\r\n** zPath with SQLITE_OPEN_XXX flags matching those passed as the second\r\n** argument to this function.\r\n**\r\n** Such a file descriptor may exist if a database connection was closed\r\n** but the associated file descriptor could not be closed because some\r\n** other file descriptor open on the same file is holding a file-lock.\r\n** Refer to comments in the unixClose() function and the lengthy comment\r\n** describing \"Posix Advisory Locking\" at the start of this file for \r\n** further details. Also, ticket #4018.\r\n**\r\n** If a suitable file descriptor is found, then it is returned. If no\r\n** such file descriptor is located, -1 is returned.\r\n*/\r\nstatic UnixUnusedFd *findReusableFd(const char *zPath, int flags){\r\n  UnixUnusedFd *pUnused = 0;\r\n\r\n  /* Do not search for an unused file descriptor on vxworks. Not because\r\n  ** vxworks would not benefit from the change (it might, we're not sure),\r\n  ** but because no way to test it is currently available. It is better \r\n  ** not to risk breaking vxworks support for the sake of such an obscure \r\n  ** feature.  */\r\n#if !OS_VXWORKS\r\n  struct stat sStat;                   /* Results of stat() call */\r\n\r\n  /* A stat() call may fail for various reasons. If this happens, it is\r\n  ** almost certain that an open() call on the same path will also fail.\r\n  ** For this reason, if an error occurs in the stat() call here, it is\r\n  ** ignored and -1 is returned. The caller will try to open a new file\r\n  ** descriptor on the same path, fail, and return an error to SQLite.\r\n  **\r\n  ** Even if a subsequent open() call does succeed, the consequences of\r\n  ** not searching for a resusable file descriptor are not dire.  */\r\n  if( 0==osStat(zPath, &sStat) ){\r\n    unixInodeInfo *pInode;\r\n\r\n    unixEnterMutex();\r\n    pInode = inodeList;\r\n    while( pInode && (pInode->fileId.dev!=sStat.st_dev\r\n                     || pInode->fileId.ino!=sStat.st_ino) ){\r\n       pInode = pInode->pNext;\r\n    }\r\n    if( pInode ){\r\n      UnixUnusedFd **pp;\r\n      for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));\r\n      pUnused = *pp;\r\n      if( pUnused ){\r\n        *pp = pUnused->pNext;\r\n      }\r\n    }\r\n    unixLeaveMutex();\r\n  }\r\n#endif    /* if !OS_VXWORKS */\r\n  return pUnused;\r\n}\r\n\r\n/*\r\n** This function is called by unixOpen() to determine the unix permissions\r\n** to create new files with. If no error occurs, then SQLITE_OK is returned\r\n** and a value suitable for passing as the third argument to open(2) is\r\n** written to *pMode. If an IO error occurs, an SQLite error code is \r\n** returned and the value of *pMode is not modified.\r\n**\r\n** In most cases cases, this routine sets *pMode to 0, which will become\r\n** an indication to robust_open() to create the file using\r\n** SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask.\r\n** But if the file being opened is a WAL or regular journal file, then \r\n** this function queries the file-system for the permissions on the \r\n** corresponding database file and sets *pMode to this value. Whenever \r\n** possible, WAL and journal files are created using the same permissions \r\n** as the associated database file.\r\n**\r\n** If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the\r\n** original filename is unavailable.  But 8_3_NAMES is only used for\r\n** FAT filesystems and permissions do not matter there, so just use\r\n** the default permissions.\r\n*/\r\nstatic int findCreateFileMode(\r\n  const char *zPath,              /* Path of file (possibly) being created */\r\n  int flags,                      /* Flags passed as 4th argument to xOpen() */\r\n  mode_t *pMode,                  /* OUT: Permissions to open file with */\r\n  uid_t *pUid,                    /* OUT: uid to set on the file */\r\n  gid_t *pGid                     /* OUT: gid to set on the file */\r\n){\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n  *pMode = 0;\r\n  *pUid = 0;\r\n  *pGid = 0;\r\n  if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){\r\n    char zDb[MAX_PATHNAME+1];     /* Database file path */\r\n    int nDb;                      /* Number of valid bytes in zDb */\r\n    struct stat sStat;            /* Output of stat() on database file */\r\n\r\n    /* zPath is a path to a WAL or journal file. The following block derives\r\n    ** the path to the associated database file from zPath. This block handles\r\n    ** the following naming conventions:\r\n    **\r\n    **   \"<path to db>-journal\"\r\n    **   \"<path to db>-wal\"\r\n    **   \"<path to db>-journalNN\"\r\n    **   \"<path to db>-walNN\"\r\n    **\r\n    ** where NN is a decimal number. The NN naming schemes are \r\n    ** used by the test_multiplex.c module.\r\n    */\r\n    nDb = sqlite3Strlen30(zPath) - 1; \r\n#ifdef SQLITE_ENABLE_8_3_NAMES\r\n    while( nDb>0 && sqlite3Isalnum(zPath[nDb]) ) nDb--;\r\n    if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK;\r\n#else\r\n    while( zPath[nDb]!='-' ){\r\n      assert( nDb>0 );\r\n      assert( zPath[nDb]!='\\n' );\r\n      nDb--;\r\n    }\r\n#endif\r\n    memcpy(zDb, zPath, nDb);\r\n    zDb[nDb] = '\\0';\r\n\r\n    if( 0==osStat(zDb, &sStat) ){\r\n      *pMode = sStat.st_mode & 0777;\r\n      *pUid = sStat.st_uid;\r\n      *pGid = sStat.st_gid;\r\n    }else{\r\n      rc = SQLITE_IOERR_FSTAT;\r\n    }\r\n  }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){\r\n    *pMode = 0600;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Open the file zPath.\r\n** \r\n** Previously, the SQLite OS layer used three functions in place of this\r\n** one:\r\n**\r\n**     sqlite3OsOpenReadWrite();\r\n**     sqlite3OsOpenReadOnly();\r\n**     sqlite3OsOpenExclusive();\r\n**\r\n** These calls correspond to the following combinations of flags:\r\n**\r\n**     ReadWrite() ->     (READWRITE | CREATE)\r\n**     ReadOnly()  ->     (READONLY) \r\n**     OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE)\r\n**\r\n** The old OpenExclusive() accepted a boolean argument - \"delFlag\". If\r\n** true, the file was configured to be automatically deleted when the\r\n** file handle closed. To achieve the same effect using this new \r\n** interface, add the DELETEONCLOSE flag to those specified above for \r\n** OpenExclusive().\r\n*/\r\nstatic int unixOpen(\r\n  sqlite3_vfs *pVfs,           /* The VFS for which this is the xOpen method */\r\n  const char *zPath,           /* Pathname of file to be opened */\r\n  sqlite3_file *pFile,         /* The file descriptor to be filled in */\r\n  int flags,                   /* Input flags to control the opening */\r\n  int *pOutFlags               /* Output flags returned to SQLite core */\r\n){\r\n  unixFile *p = (unixFile *)pFile;\r\n  int fd = -1;                   /* File descriptor returned by open() */\r\n  int openFlags = 0;             /* Flags to pass to open() */\r\n  int eType = flags&0xFFFFFF00;  /* Type of file to open */\r\n  int noLock;                    /* True to omit locking primitives */\r\n  int rc = SQLITE_OK;            /* Function Return Code */\r\n  int ctrlFlags = 0;             /* UNIXFILE_* flags */\r\n\r\n  int isExclusive  = (flags & SQLITE_OPEN_EXCLUSIVE);\r\n  int isDelete     = (flags & SQLITE_OPEN_DELETEONCLOSE);\r\n  int isCreate     = (flags & SQLITE_OPEN_CREATE);\r\n  int isReadonly   = (flags & SQLITE_OPEN_READONLY);\r\n  int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n  int isAutoProxy  = (flags & SQLITE_OPEN_AUTOPROXY);\r\n#endif\r\n#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE\r\n  struct statfs fsInfo;\r\n#endif\r\n\r\n  /* If creating a master or main-file journal, this function will open\r\n  ** a file-descriptor on the directory too. The first time unixSync()\r\n  ** is called the directory file descriptor will be fsync()ed and close()d.\r\n  */\r\n  int syncDir = (isCreate && (\r\n        eType==SQLITE_OPEN_MASTER_JOURNAL \r\n     || eType==SQLITE_OPEN_MAIN_JOURNAL \r\n     || eType==SQLITE_OPEN_WAL\r\n  ));\r\n\r\n  /* If argument zPath is a NULL pointer, this function is required to open\r\n  ** a temporary file. Use this buffer to store the file name in.\r\n  */\r\n  char zTmpname[MAX_PATHNAME+2];\r\n  const char *zName = zPath;\r\n\r\n  /* Check the following statements are true: \r\n  **\r\n  **   (a) Exactly one of the READWRITE and READONLY flags must be set, and \r\n  **   (b) if CREATE is set, then READWRITE must also be set, and\r\n  **   (c) if EXCLUSIVE is set, then CREATE must also be set.\r\n  **   (d) if DELETEONCLOSE is set, then CREATE must also be set.\r\n  */\r\n  assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));\r\n  assert(isCreate==0 || isReadWrite);\r\n  assert(isExclusive==0 || isCreate);\r\n  assert(isDelete==0 || isCreate);\r\n\r\n  /* The main DB, main journal, WAL file and master journal are never \r\n  ** automatically deleted. Nor are they ever temporary files.  */\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL );\r\n\r\n  /* Assert that the upper layer has set one of the \"file-type\" flags. */\r\n  assert( eType==SQLITE_OPEN_MAIN_DB      || eType==SQLITE_OPEN_TEMP_DB \r\n       || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL \r\n       || eType==SQLITE_OPEN_SUBJOURNAL   || eType==SQLITE_OPEN_MASTER_JOURNAL \r\n       || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL\r\n  );\r\n\r\n  memset(p, 0, sizeof(unixFile));\r\n\r\n  if( eType==SQLITE_OPEN_MAIN_DB ){\r\n    UnixUnusedFd *pUnused;\r\n    pUnused = findReusableFd(zName, flags);\r\n    if( pUnused ){\r\n      fd = pUnused->fd;\r\n    }else{\r\n      pUnused = sqlite3_malloc(sizeof(*pUnused));\r\n      if( !pUnused ){\r\n        return SQLITE_NOMEM;\r\n      }\r\n    }\r\n    p->pUnused = pUnused;\r\n\r\n    /* Database filenames are double-zero terminated if they are not\r\n    ** URIs with parameters.  Hence, they can always be passed into\r\n    ** sqlite3_uri_parameter(). */\r\n    assert( (flags & SQLITE_OPEN_URI) || zName[strlen(zName)+1]==0 );\r\n\r\n  }else if( !zName ){\r\n    /* If zName is NULL, the upper layer is requesting a temp file. */\r\n    assert(isDelete && !syncDir);\r\n    rc = unixGetTempname(MAX_PATHNAME+2, zTmpname);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    zName = zTmpname;\r\n\r\n    /* Generated temporary filenames are always double-zero terminated\r\n    ** for use by sqlite3_uri_parameter(). */\r\n    assert( zName[strlen(zName)+1]==0 );\r\n  }\r\n\r\n  /* Determine the value of the flags parameter passed to POSIX function\r\n  ** open(). These must be calculated even if open() is not called, as\r\n  ** they may be stored as part of the file handle and used by the \r\n  ** 'conch file' locking functions later on.  */\r\n  if( isReadonly )  openFlags |= O_RDONLY;\r\n  if( isReadWrite ) openFlags |= O_RDWR;\r\n  if( isCreate )    openFlags |= O_CREAT;\r\n  if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);\r\n  openFlags |= (O_LARGEFILE|O_BINARY);\r\n\r\n  if( fd<0 ){\r\n    mode_t openMode;              /* Permissions to create file with */\r\n    uid_t uid;                    /* Userid for the file */\r\n    gid_t gid;                    /* Groupid for the file */\r\n    rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);\r\n    if( rc!=SQLITE_OK ){\r\n      assert( !p->pUnused );\r\n      assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );\r\n      return rc;\r\n    }\r\n    fd = robust_open(zName, openFlags, openMode);\r\n    OSTRACE((\"OPENX   %-3d %s 0%o\\n\", fd, zName, openFlags));\r\n    if( fd<0 && errno!=EISDIR && isReadWrite && !isExclusive ){\r\n      /* Failed to open the file for read/write access. Try read-only. */\r\n      flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);\r\n      openFlags &= ~(O_RDWR|O_CREAT);\r\n      flags |= SQLITE_OPEN_READONLY;\r\n      openFlags |= O_RDONLY;\r\n      isReadonly = 1;\r\n      fd = robust_open(zName, openFlags, openMode);\r\n    }\r\n    if( fd<0 ){\r\n      rc = unixLogError(SQLITE_CANTOPEN_BKPT, \"open\", zName);\r\n      goto open_finished;\r\n    }\r\n\r\n    /* If this process is running as root and if creating a new rollback\r\n    ** journal or WAL file, set the ownership of the journal or WAL to be\r\n    ** the same as the original database.  If we are not running as root,\r\n    ** then the fchown() call will fail, but that's ok.  The \"if(){}\" and\r\n    ** the setting of the UNIXFILE_CHOWN flag are purely to silence compiler\r\n    ** warnings from gcc.\r\n    */\r\n    if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){\r\n      if( osFchown(fd, uid, gid)==0 ){ p->ctrlFlags |= UNIXFILE_CHOWN; }\r\n    }\r\n  }\r\n  assert( fd>=0 );\r\n  if( pOutFlags ){\r\n    *pOutFlags = flags;\r\n  }\r\n\r\n  if( p->pUnused ){\r\n    p->pUnused->fd = fd;\r\n    p->pUnused->flags = flags;\r\n  }\r\n\r\n  if( isDelete ){\r\n#if OS_VXWORKS\r\n    zPath = zName;\r\n#else\r\n    osUnlink(zName);\r\n#endif\r\n  }\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n  else{\r\n    p->openFlags = openFlags;\r\n  }\r\n#endif\r\n\r\n#ifdef FD_CLOEXEC\r\n  osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);\r\n#endif\r\n\r\n  noLock = eType!=SQLITE_OPEN_MAIN_DB;\r\n\r\n  \r\n#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE\r\n  if( fstatfs(fd, &fsInfo) == -1 ){\r\n    ((unixFile*)pFile)->lastErrno = errno;\r\n    robust_close(p, fd, __LINE__);\r\n    return SQLITE_IOERR_ACCESS;\r\n  }\r\n  if (0 == strncmp(\"msdos\", fsInfo.f_fstypename, 5)) {\r\n    ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;\r\n  }\r\n#endif\r\n\r\n  /* Set up appropriate ctrlFlags */\r\n  if( isDelete )                ctrlFlags |= UNIXFILE_DELETE;\r\n  if( isReadonly )              ctrlFlags |= UNIXFILE_RDONLY;\r\n  if( noLock )                  ctrlFlags |= UNIXFILE_NOLOCK;\r\n  if( syncDir )                 ctrlFlags |= UNIXFILE_DIRSYNC;\r\n  if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;\r\n\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n#if SQLITE_PREFER_PROXY_LOCKING\r\n  isAutoProxy = 1;\r\n#endif\r\n  if( isAutoProxy && (zPath!=NULL) && (!noLock) && pVfs->xOpen ){\r\n    char *envforce = getenv(\"SQLITE_FORCE_PROXY_LOCKING\");\r\n    int useProxy = 0;\r\n\r\n    /* SQLITE_FORCE_PROXY_LOCKING==1 means force always use proxy, 0 means \r\n    ** never use proxy, NULL means use proxy for non-local files only.  */\r\n    if( envforce!=NULL ){\r\n      useProxy = atoi(envforce)>0;\r\n    }else{\r\n      if( statfs(zPath, &fsInfo) == -1 ){\r\n        /* In theory, the close(fd) call is sub-optimal. If the file opened\r\n        ** with fd is a database file, and there are other connections open\r\n        ** on that file that are currently holding advisory locks on it,\r\n        ** then the call to close() will cancel those locks. In practice,\r\n        ** we're assuming that statfs() doesn't fail very often. At least\r\n        ** not while other file descriptors opened by the same process on\r\n        ** the same file are working.  */\r\n        p->lastErrno = errno;\r\n        robust_close(p, fd, __LINE__);\r\n        rc = SQLITE_IOERR_ACCESS;\r\n        goto open_finished;\r\n      }\r\n      useProxy = !(fsInfo.f_flags&MNT_LOCAL);\r\n    }\r\n    if( useProxy ){\r\n      rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);\r\n      if( rc==SQLITE_OK ){\r\n        rc = proxyTransformUnixFile((unixFile*)pFile, \":auto:\");\r\n        if( rc!=SQLITE_OK ){\r\n          /* Use unixClose to clean up the resources added in fillInUnixFile \r\n          ** and clear all the structure's references.  Specifically, \r\n          ** pFile->pMethods will be NULL so sqlite3OsClose will be a no-op \r\n          */\r\n          unixClose(pFile);\r\n          return rc;\r\n        }\r\n      }\r\n      goto open_finished;\r\n    }\r\n  }\r\n#endif\r\n  \r\n  rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);\r\n\r\nopen_finished:\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3_free(p->pUnused);\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Delete the file at zPath. If the dirSync argument is true, fsync()\r\n** the directory after deleting the file.\r\n*/\r\nstatic int unixDelete(\r\n  sqlite3_vfs *NotUsed,     /* VFS containing this as the xDelete method */\r\n  const char *zPath,        /* Name of file to be deleted */\r\n  int dirSync               /* If true, fsync() directory after deleting file */\r\n){\r\n  int rc = SQLITE_OK;\r\n  UNUSED_PARAMETER(NotUsed);\r\n  SimulateIOError(return SQLITE_IOERR_DELETE);\r\n  if( osUnlink(zPath)==(-1) && errno!=ENOENT ){\r\n    return unixLogError(SQLITE_IOERR_DELETE, \"unlink\", zPath);\r\n  }\r\n#ifndef SQLITE_DISABLE_DIRSYNC\r\n  if( (dirSync & 1)!=0 ){\r\n    int fd;\r\n    rc = osOpenDirectory(zPath, &fd);\r\n    if( rc==SQLITE_OK ){\r\n#if OS_VXWORKS\r\n      if( fsync(fd)==-1 )\r\n#else\r\n      if( fsync(fd) )\r\n#endif\r\n      {\r\n        rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, \"fsync\", zPath);\r\n      }\r\n      robust_close(0, fd, __LINE__);\r\n    }else if( rc==SQLITE_CANTOPEN ){\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n#endif\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Test the existance of or access permissions of file zPath. The\r\n** test performed depends on the value of flags:\r\n**\r\n**     SQLITE_ACCESS_EXISTS: Return 1 if the file exists\r\n**     SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable.\r\n**     SQLITE_ACCESS_READONLY: Return 1 if the file is readable.\r\n**\r\n** Otherwise return 0.\r\n*/\r\nstatic int unixAccess(\r\n  sqlite3_vfs *NotUsed,   /* The VFS containing this xAccess method */\r\n  const char *zPath,      /* Path of the file to examine */\r\n  int flags,              /* What do we want to learn about the zPath file? */\r\n  int *pResOut            /* Write result boolean here */\r\n){\r\n  int amode = 0;\r\n  UNUSED_PARAMETER(NotUsed);\r\n  SimulateIOError( return SQLITE_IOERR_ACCESS; );\r\n  switch( flags ){\r\n    case SQLITE_ACCESS_EXISTS:\r\n      amode = F_OK;\r\n      break;\r\n    case SQLITE_ACCESS_READWRITE:\r\n      amode = W_OK|R_OK;\r\n      break;\r\n    case SQLITE_ACCESS_READ:\r\n      amode = R_OK;\r\n      break;\r\n\r\n    default:\r\n      assert(!\"Invalid flags argument\");\r\n  }\r\n  *pResOut = (osAccess(zPath, amode)==0);\r\n  if( flags==SQLITE_ACCESS_EXISTS && *pResOut ){\r\n    struct stat buf;\r\n    if( 0==osStat(zPath, &buf) && buf.st_size==0 ){\r\n      *pResOut = 0;\r\n    }\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Turn a relative pathname into a full pathname. The relative path\r\n** is stored as a nul-terminated string in the buffer pointed to by\r\n** zPath. \r\n**\r\n** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes \r\n** (in this case, MAX_PATHNAME bytes). The full-path is written to\r\n** this buffer before returning.\r\n*/\r\nstatic int unixFullPathname(\r\n  sqlite3_vfs *pVfs,            /* Pointer to vfs object */\r\n  const char *zPath,            /* Possibly relative input path */\r\n  int nOut,                     /* Size of output buffer in bytes */\r\n  char *zOut                    /* Output buffer */\r\n){\r\n\r\n  /* It's odd to simulate an io-error here, but really this is just\r\n  ** using the io-error infrastructure to test that SQLite handles this\r\n  ** function failing. This function could fail if, for example, the\r\n  ** current working directory has been unlinked.\r\n  */\r\n  SimulateIOError( return SQLITE_ERROR );\r\n\r\n  assert( pVfs->mxPathname==MAX_PATHNAME );\r\n  UNUSED_PARAMETER(pVfs);\r\n\r\n  zOut[nOut-1] = '\\0';\r\n  if( zPath[0]=='/' ){\r\n    sqlite3_snprintf(nOut, zOut, \"%s\", zPath);\r\n  }else{\r\n    int nCwd;\r\n    if( osGetcwd(zOut, nOut-1)==0 ){\r\n      return unixLogError(SQLITE_CANTOPEN_BKPT, \"getcwd\", zPath);\r\n    }\r\n    nCwd = (int)strlen(zOut);\r\n    sqlite3_snprintf(nOut-nCwd, &zOut[nCwd], \"/%s\", zPath);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\n/*\r\n** Interfaces for opening a shared library, finding entry points\r\n** within the shared library, and closing the shared library.\r\n*/\r\n#include <dlfcn.h>\r\nstatic void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);\r\n}\r\n\r\n/*\r\n** SQLite calls this function immediately after a call to unixDlSym() or\r\n** unixDlOpen() fails (returns a null pointer). If a more detailed error\r\n** message is available, it is written to zBufOut. If no error message\r\n** is available, zBufOut is left unmodified and SQLite uses a default\r\n** error message.\r\n*/\r\nstatic void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){\r\n  const char *zErr;\r\n  UNUSED_PARAMETER(NotUsed);\r\n  unixEnterMutex();\r\n  zErr = dlerror();\r\n  if( zErr ){\r\n    sqlite3_snprintf(nBuf, zBufOut, \"%s\", zErr);\r\n  }\r\n  unixLeaveMutex();\r\n}\r\nstatic void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){\r\n  /* \r\n  ** GCC with -pedantic-errors says that C90 does not allow a void* to be\r\n  ** cast into a pointer to a function.  And yet the library dlsym() routine\r\n  ** returns a void* which is really a pointer to a function.  So how do we\r\n  ** use dlsym() with -pedantic-errors?\r\n  **\r\n  ** Variable x below is defined to be a pointer to a function taking\r\n  ** parameters void* and const char* and returning a pointer to a function.\r\n  ** We initialize x by assigning it a pointer to the dlsym() function.\r\n  ** (That assignment requires a cast.)  Then we call the function that\r\n  ** x points to.  \r\n  **\r\n  ** This work-around is unlikely to work correctly on any system where\r\n  ** you really cannot cast a function pointer into void*.  But then, on the\r\n  ** other hand, dlsym() will not work on such a system either, so we have\r\n  ** not really lost anything.\r\n  */\r\n  void (*(*x)(void*,const char*))(void);\r\n  UNUSED_PARAMETER(NotUsed);\r\n  x = (void(*(*)(void*,const char*))(void))dlsym;\r\n  return (*x)(p, zSym);\r\n}\r\nstatic void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  dlclose(pHandle);\r\n}\r\n#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */\r\n  #define unixDlOpen  0\r\n  #define unixDlError 0\r\n  #define unixDlSym   0\r\n  #define unixDlClose 0\r\n#endif\r\n\r\n/*\r\n** Write nBuf bytes of random data to the supplied buffer zBuf.\r\n*/\r\nstatic int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  assert((size_t)nBuf>=(sizeof(time_t)+sizeof(int)));\r\n\r\n  /* We have to initialize zBuf to prevent valgrind from reporting\r\n  ** errors.  The reports issued by valgrind are incorrect - we would\r\n  ** prefer that the randomness be increased by making use of the\r\n  ** uninitialized space in zBuf - but valgrind errors tend to worry\r\n  ** some users.  Rather than argue, it seems easier just to initialize\r\n  ** the whole array and silence valgrind, even if that means less randomness\r\n  ** in the random seed.\r\n  **\r\n  ** When testing, initializing zBuf[] to zero is all we do.  That means\r\n  ** that we always use the same random number sequence.  This makes the\r\n  ** tests repeatable.\r\n  */\r\n  memset(zBuf, 0, nBuf);\r\n#if !defined(SQLITE_TEST)\r\n  {\r\n    int pid, fd, got;\r\n    fd = robust_open(\"/dev/urandom\", O_RDONLY, 0);\r\n    if( fd<0 ){\r\n      time_t t;\r\n      time(&t);\r\n      memcpy(zBuf, &t, sizeof(t));\r\n      pid = getpid();\r\n      memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));\r\n      assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf );\r\n      nBuf = sizeof(t) + sizeof(pid);\r\n    }else{\r\n      do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );\r\n      robust_close(0, fd, __LINE__);\r\n    }\r\n  }\r\n#endif\r\n  return nBuf;\r\n}\r\n\r\n\r\n/*\r\n** Sleep for a little while.  Return the amount of time slept.\r\n** The argument is the number of microseconds we want to sleep.\r\n** The return value is the number of microseconds of sleep actually\r\n** requested from the underlying operating system, a number which\r\n** might be greater than or equal to the argument, but not less\r\n** than the argument.\r\n*/\r\nstatic int unixSleep(sqlite3_vfs *NotUsed, int microseconds){\r\n#if OS_VXWORKS\r\n  struct timespec sp;\r\n\r\n  sp.tv_sec = microseconds / 1000000;\r\n  sp.tv_nsec = (microseconds % 1000000) * 1000;\r\n  nanosleep(&sp, NULL);\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return microseconds;\r\n#elif defined(HAVE_USLEEP) && HAVE_USLEEP\r\n  usleep(microseconds);\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return microseconds;\r\n#else\r\n  int seconds = (microseconds+999999)/1000000;\r\n  sleep(seconds);\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return seconds*1000000;\r\n#endif\r\n}\r\n\r\n/*\r\n** The following variable, if set to a non-zero value, is interpreted as\r\n** the number of seconds since 1970 and is used to set the result of\r\n** sqlite3OsCurrentTime() during testing.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_current_time = 0;  /* Fake system time in seconds since 1970. */\r\n#endif\r\n\r\n/*\r\n** Find the current time (in Universal Coordinated Time).  Write into *piNow\r\n** the current time and date as a Julian Day number times 86_400_000.  In\r\n** other words, write into *piNow the number of milliseconds since the Julian\r\n** epoch of noon in Greenwich on November 24, 4714 B.C according to the\r\n** proleptic Gregorian calendar.\r\n**\r\n** On success, return SQLITE_OK.  Return SQLITE_ERROR if the time and date \r\n** cannot be found.\r\n*/\r\nstatic int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){\r\n  static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;\r\n  int rc = SQLITE_OK;\r\n#if defined(NO_GETTOD)\r\n  time_t t;\r\n  time(&t);\r\n  *piNow = ((sqlite3_int64)t)*1000 + unixEpoch;\r\n#elif OS_VXWORKS\r\n  struct timespec sNow;\r\n  clock_gettime(CLOCK_REALTIME, &sNow);\r\n  *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_nsec/1000000;\r\n#else\r\n  struct timeval sNow;\r\n  if( gettimeofday(&sNow, 0)==0 ){\r\n    *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;\r\n  }else{\r\n    rc = SQLITE_ERROR;\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_TEST\r\n  if( sqlite3_current_time ){\r\n    *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch;\r\n  }\r\n#endif\r\n  UNUSED_PARAMETER(NotUsed);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Find the current time (in Universal Coordinated Time).  Write the\r\n** current time and date as a Julian Day number into *prNow and\r\n** return 0.  Return 1 if the time and date cannot be found.\r\n*/\r\nstatic int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){\r\n  sqlite3_int64 i = 0;\r\n  int rc;\r\n  UNUSED_PARAMETER(NotUsed);\r\n  rc = unixCurrentTimeInt64(0, &i);\r\n  *prNow = i/86400000.0;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** We added the xGetLastError() method with the intention of providing\r\n** better low-level error messages when operating-system problems come up\r\n** during SQLite operation.  But so far, none of that has been implemented\r\n** in the core.  So this routine is never called.  For now, it is merely\r\n** a place-holder.\r\n*/\r\nstatic int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  UNUSED_PARAMETER(NotUsed2);\r\n  UNUSED_PARAMETER(NotUsed3);\r\n  return 0;\r\n}\r\n\r\n\r\n/*\r\n************************ End of sqlite3_vfs methods ***************************\r\n******************************************************************************/\r\n\r\n/******************************************************************************\r\n************************** Begin Proxy Locking ********************************\r\n**\r\n** Proxy locking is a \"uber-locking-method\" in this sense:  It uses the\r\n** other locking methods on secondary lock files.  Proxy locking is a\r\n** meta-layer over top of the primitive locking implemented above.  For\r\n** this reason, the division that implements of proxy locking is deferred\r\n** until late in the file (here) after all of the other I/O methods have\r\n** been defined - so that the primitive locking methods are available\r\n** as services to help with the implementation of proxy locking.\r\n**\r\n****\r\n**\r\n** The default locking schemes in SQLite use byte-range locks on the\r\n** database file to coordinate safe, concurrent access by multiple readers\r\n** and writers [http://sqlite.org/lockingv3.html].  The five file locking\r\n** states (UNLOCKED, PENDING, SHARED, RESERVED, EXCLUSIVE) are implemented\r\n** as POSIX read & write locks over fixed set of locations (via fsctl),\r\n** on AFP and SMB only exclusive byte-range locks are available via fsctl\r\n** with _IOWR('z', 23, struct ByteRangeLockPB2) to track the same 5 states.\r\n** To simulate a F_RDLCK on the shared range, on AFP a randomly selected\r\n** address in the shared range is taken for a SHARED lock, the entire\r\n** shared range is taken for an EXCLUSIVE lock):\r\n**\r\n**      PENDING_BYTE        0x40000000\t\t   \t\r\n**      RESERVED_BYTE       0x40000001\r\n**      SHARED_RANGE        0x40000002 -> 0x40000200\r\n**\r\n** This works well on the local file system, but shows a nearly 100x\r\n** slowdown in read performance on AFP because the AFP client disables\r\n** the read cache when byte-range locks are present.  Enabling the read\r\n** cache exposes a cache coherency problem that is present on all OS X\r\n** supported network file systems.  NFS and AFP both observe the\r\n** close-to-open semantics for ensuring cache coherency\r\n** [http://nfs.sourceforge.net/#faq_a8], which does not effectively\r\n** address the requirements for concurrent database access by multiple\r\n** readers and writers\r\n** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html].\r\n**\r\n** To address the performance and cache coherency issues, proxy file locking\r\n** changes the way database access is controlled by limiting access to a\r\n** single host at a time and moving file locks off of the database file\r\n** and onto a proxy file on the local file system.  \r\n**\r\n**\r\n** Using proxy locks\r\n** -----------------\r\n**\r\n** C APIs\r\n**\r\n**  sqlite3_file_control(db, dbname, SQLITE_SET_LOCKPROXYFILE,\r\n**                       <proxy_path> | \":auto:\");\r\n**  sqlite3_file_control(db, dbname, SQLITE_GET_LOCKPROXYFILE, &<proxy_path>);\r\n**\r\n**\r\n** SQL pragmas\r\n**\r\n**  PRAGMA [database.]lock_proxy_file=<proxy_path> | :auto:\r\n**  PRAGMA [database.]lock_proxy_file\r\n**\r\n** Specifying \":auto:\" means that if there is a conch file with a matching\r\n** host ID in it, the proxy path in the conch file will be used, otherwise\r\n** a proxy path based on the user's temp dir\r\n** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the\r\n** actual proxy file name is generated from the name and path of the\r\n** database file.  For example:\r\n**\r\n**       For database path \"/Users/me/foo.db\" \r\n**       The lock path will be \"<tmpdir>/sqliteplocks/_Users_me_foo.db:auto:\")\r\n**\r\n** Once a lock proxy is configured for a database connection, it can not\r\n** be removed, however it may be switched to a different proxy path via\r\n** the above APIs (assuming the conch file is not being held by another\r\n** connection or process). \r\n**\r\n**\r\n** How proxy locking works\r\n** -----------------------\r\n**\r\n** Proxy file locking relies primarily on two new supporting files: \r\n**\r\n**   *  conch file to limit access to the database file to a single host\r\n**      at a time\r\n**\r\n**   *  proxy file to act as a proxy for the advisory locks normally\r\n**      taken on the database\r\n**\r\n** The conch file - to use a proxy file, sqlite must first \"hold the conch\"\r\n** by taking an sqlite-style shared lock on the conch file, reading the\r\n** contents and comparing the host's unique host ID (see below) and lock\r\n** proxy path against the values stored in the conch.  The conch file is\r\n** stored in the same directory as the database file and the file name\r\n** is patterned after the database file name as \".<databasename>-conch\".\r\n** If the conch file does not exist, or it's contents do not match the\r\n** host ID and/or proxy path, then the lock is escalated to an exclusive\r\n** lock and the conch file contents is updated with the host ID and proxy\r\n** path and the lock is downgraded to a shared lock again.  If the conch\r\n** is held by another process (with a shared lock), the exclusive lock\r\n** will fail and SQLITE_BUSY is returned.\r\n**\r\n** The proxy file - a single-byte file used for all advisory file locks\r\n** normally taken on the database file.   This allows for safe sharing\r\n** of the database file for multiple readers and writers on the same\r\n** host (the conch ensures that they all use the same local lock file).\r\n**\r\n** Requesting the lock proxy does not immediately take the conch, it is\r\n** only taken when the first request to lock database file is made.  \r\n** This matches the semantics of the traditional locking behavior, where\r\n** opening a connection to a database file does not take a lock on it.\r\n** The shared lock and an open file descriptor are maintained until \r\n** the connection to the database is closed. \r\n**\r\n** The proxy file and the lock file are never deleted so they only need\r\n** to be created the first time they are used.\r\n**\r\n** Configuration options\r\n** ---------------------\r\n**\r\n**  SQLITE_PREFER_PROXY_LOCKING\r\n**\r\n**       Database files accessed on non-local file systems are\r\n**       automatically configured for proxy locking, lock files are\r\n**       named automatically using the same logic as\r\n**       PRAGMA lock_proxy_file=\":auto:\"\r\n**    \r\n**  SQLITE_PROXY_DEBUG\r\n**\r\n**       Enables the logging of error messages during host id file\r\n**       retrieval and creation\r\n**\r\n**  LOCKPROXYDIR\r\n**\r\n**       Overrides the default directory used for lock proxy files that\r\n**       are named automatically via the \":auto:\" setting\r\n**\r\n**  SQLITE_DEFAULT_PROXYDIR_PERMISSIONS\r\n**\r\n**       Permissions to use when creating a directory for storing the\r\n**       lock proxy files, only used when LOCKPROXYDIR is not set.\r\n**    \r\n**    \r\n** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING,\r\n** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will\r\n** force proxy locking to be used for every database file opened, and 0\r\n** will force automatic proxy locking to be disabled for all database\r\n** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or\r\n** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).\r\n*/\r\n\r\n/*\r\n** Proxy locking is only available on MacOSX \r\n*/\r\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\r\n\r\n/*\r\n** The proxyLockingContext has the path and file structures for the remote \r\n** and local proxy files in it\r\n*/\r\ntypedef struct proxyLockingContext proxyLockingContext;\r\nstruct proxyLockingContext {\r\n  unixFile *conchFile;         /* Open conch file */\r\n  char *conchFilePath;         /* Name of the conch file */\r\n  unixFile *lockProxy;         /* Open proxy lock file */\r\n  char *lockProxyPath;         /* Name of the proxy lock file */\r\n  char *dbPath;                /* Name of the open file */\r\n  int conchHeld;               /* 1 if the conch is held, -1 if lockless */\r\n  void *oldLockingContext;     /* Original lockingcontext to restore on close */\r\n  sqlite3_io_methods const *pOldMethod;     /* Original I/O methods for close */\r\n};\r\n\r\n/* \r\n** The proxy lock file path for the database at dbPath is written into lPath, \r\n** which must point to valid, writable memory large enough for a maxLen length\r\n** file path. \r\n*/\r\nstatic int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){\r\n  int len;\r\n  int dbLen;\r\n  int i;\r\n\r\n#ifdef LOCKPROXYDIR\r\n  len = strlcpy(lPath, LOCKPROXYDIR, maxLen);\r\n#else\r\n# ifdef _CS_DARWIN_USER_TEMP_DIR\r\n  {\r\n    if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){\r\n      OSTRACE((\"GETLOCKPATH  failed %s errno=%d pid=%d\\n\",\r\n               lPath, errno, getpid()));\r\n      return SQLITE_IOERR_LOCK;\r\n    }\r\n    len = strlcat(lPath, \"sqliteplocks\", maxLen);    \r\n  }\r\n# else\r\n  len = strlcpy(lPath, \"/tmp/\", maxLen);\r\n# endif\r\n#endif\r\n\r\n  if( lPath[len-1]!='/' ){\r\n    len = strlcat(lPath, \"/\", maxLen);\r\n  }\r\n  \r\n  /* transform the db path to a unique cache name */\r\n  dbLen = (int)strlen(dbPath);\r\n  for( i=0; i<dbLen && (i+len+7)<(int)maxLen; i++){\r\n    char c = dbPath[i];\r\n    lPath[i+len] = (c=='/')?'_':c;\r\n  }\r\n  lPath[i+len]='\\0';\r\n  strlcat(lPath, \":auto:\", maxLen);\r\n  OSTRACE((\"GETLOCKPATH  proxy lock path=%s pid=%d\\n\", lPath, getpid()));\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n ** Creates the lock file and any missing directories in lockPath\r\n */\r\nstatic int proxyCreateLockPath(const char *lockPath){\r\n  int i, len;\r\n  char buf[MAXPATHLEN];\r\n  int start = 0;\r\n  \r\n  assert(lockPath!=NULL);\r\n  /* try to create all the intermediate directories */\r\n  len = (int)strlen(lockPath);\r\n  buf[0] = lockPath[0];\r\n  for( i=1; i<len; i++ ){\r\n    if( lockPath[i] == '/' && (i - start > 0) ){\r\n      /* only mkdir if leaf dir != \".\" or \"/\" or \"..\" */\r\n      if( i-start>2 || (i-start==1 && buf[start] != '.' && buf[start] != '/') \r\n         || (i-start==2 && buf[start] != '.' && buf[start+1] != '.') ){\r\n        buf[i]='\\0';\r\n        if( osMkdir(buf, SQLITE_DEFAULT_PROXYDIR_PERMISSIONS) ){\r\n          int err=errno;\r\n          if( err!=EEXIST ) {\r\n            OSTRACE((\"CREATELOCKPATH  FAILED creating %s, \"\r\n                     \"'%s' proxy lock path=%s pid=%d\\n\",\r\n                     buf, strerror(err), lockPath, getpid()));\r\n            return err;\r\n          }\r\n        }\r\n      }\r\n      start=i+1;\r\n    }\r\n    buf[i] = lockPath[i];\r\n  }\r\n  OSTRACE((\"CREATELOCKPATH  proxy lock path=%s pid=%d\\n\", lockPath, getpid()));\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Create a new VFS file descriptor (stored in memory obtained from\r\n** sqlite3_malloc) and open the file named \"path\" in the file descriptor.\r\n**\r\n** The caller is responsible not only for closing the file descriptor\r\n** but also for freeing the memory associated with the file descriptor.\r\n*/\r\nstatic int proxyCreateUnixFile(\r\n    const char *path,        /* path for the new unixFile */\r\n    unixFile **ppFile,       /* unixFile created and returned by ref */\r\n    int islockfile           /* if non zero missing dirs will be created */\r\n) {\r\n  int fd = -1;\r\n  unixFile *pNew;\r\n  int rc = SQLITE_OK;\r\n  int openFlags = O_RDWR | O_CREAT;\r\n  sqlite3_vfs dummyVfs;\r\n  int terrno = 0;\r\n  UnixUnusedFd *pUnused = NULL;\r\n\r\n  /* 1. first try to open/create the file\r\n  ** 2. if that fails, and this is a lock file (not-conch), try creating\r\n  ** the parent directories and then try again.\r\n  ** 3. if that fails, try to open the file read-only\r\n  ** otherwise return BUSY (if lock file) or CANTOPEN for the conch file\r\n  */\r\n  pUnused = findReusableFd(path, openFlags);\r\n  if( pUnused ){\r\n    fd = pUnused->fd;\r\n  }else{\r\n    pUnused = sqlite3_malloc(sizeof(*pUnused));\r\n    if( !pUnused ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n  }\r\n  if( fd<0 ){\r\n    fd = robust_open(path, openFlags, 0);\r\n    terrno = errno;\r\n    if( fd<0 && errno==ENOENT && islockfile ){\r\n      if( proxyCreateLockPath(path) == SQLITE_OK ){\r\n        fd = robust_open(path, openFlags, 0);\r\n      }\r\n    }\r\n  }\r\n  if( fd<0 ){\r\n    openFlags = O_RDONLY;\r\n    fd = robust_open(path, openFlags, 0);\r\n    terrno = errno;\r\n  }\r\n  if( fd<0 ){\r\n    if( islockfile ){\r\n      return SQLITE_BUSY;\r\n    }\r\n    switch (terrno) {\r\n      case EACCES:\r\n        return SQLITE_PERM;\r\n      case EIO: \r\n        return SQLITE_IOERR_LOCK; /* even though it is the conch */\r\n      default:\r\n        return SQLITE_CANTOPEN_BKPT;\r\n    }\r\n  }\r\n  \r\n  pNew = (unixFile *)sqlite3_malloc(sizeof(*pNew));\r\n  if( pNew==NULL ){\r\n    rc = SQLITE_NOMEM;\r\n    goto end_create_proxy;\r\n  }\r\n  memset(pNew, 0, sizeof(unixFile));\r\n  pNew->openFlags = openFlags;\r\n  memset(&dummyVfs, 0, sizeof(dummyVfs));\r\n  dummyVfs.pAppData = (void*)&autolockIoFinder;\r\n  dummyVfs.zName = \"dummy\";\r\n  pUnused->fd = fd;\r\n  pUnused->flags = openFlags;\r\n  pNew->pUnused = pUnused;\r\n  \r\n  rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0);\r\n  if( rc==SQLITE_OK ){\r\n    *ppFile = pNew;\r\n    return SQLITE_OK;\r\n  }\r\nend_create_proxy:    \r\n  robust_close(pNew, fd, __LINE__);\r\n  sqlite3_free(pNew);\r\n  sqlite3_free(pUnused);\r\n  return rc;\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/* simulate multiple hosts by creating unique hostid file paths */\r\nSQLITE_API int sqlite3_hostid_num = 0;\r\n#endif\r\n\r\n#define PROXY_HOSTIDLEN    16  /* conch file host id length */\r\n\r\n/* Not always defined in the headers as it ought to be */\r\nextern int gethostuuid(uuid_t id, const struct timespec *wait);\r\n\r\n/* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN \r\n** bytes of writable memory.\r\n*/\r\nstatic int proxyGetHostID(unsigned char *pHostID, int *pError){\r\n  assert(PROXY_HOSTIDLEN == sizeof(uuid_t));\r\n  memset(pHostID, 0, PROXY_HOSTIDLEN);\r\n#if defined(__MAX_OS_X_VERSION_MIN_REQUIRED)\\\r\n               && __MAC_OS_X_VERSION_MIN_REQUIRED<1050\r\n  {\r\n    static const struct timespec timeout = {1, 0}; /* 1 sec timeout */\r\n    if( gethostuuid(pHostID, &timeout) ){\r\n      int err = errno;\r\n      if( pError ){\r\n        *pError = err;\r\n      }\r\n      return SQLITE_IOERR;\r\n    }\r\n  }\r\n#else\r\n  UNUSED_PARAMETER(pError);\r\n#endif\r\n#ifdef SQLITE_TEST\r\n  /* simulate multiple hosts by creating unique hostid file paths */\r\n  if( sqlite3_hostid_num != 0){\r\n    pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF));\r\n  }\r\n#endif\r\n  \r\n  return SQLITE_OK;\r\n}\r\n\r\n/* The conch file contains the header, host id and lock file path\r\n */\r\n#define PROXY_CONCHVERSION 2   /* 1-byte header, 16-byte host id, path */\r\n#define PROXY_HEADERLEN    1   /* conch file header length */\r\n#define PROXY_PATHINDEX    (PROXY_HEADERLEN+PROXY_HOSTIDLEN)\r\n#define PROXY_MAXCONCHLEN  (PROXY_HEADERLEN+PROXY_HOSTIDLEN+MAXPATHLEN)\r\n\r\n/* \r\n** Takes an open conch file, copies the contents to a new path and then moves \r\n** it back.  The newly created file's file descriptor is assigned to the\r\n** conch file structure and finally the original conch file descriptor is \r\n** closed.  Returns zero if successful.\r\n*/\r\nstatic int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){\r\n  proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; \r\n  unixFile *conchFile = pCtx->conchFile;\r\n  char tPath[MAXPATHLEN];\r\n  char buf[PROXY_MAXCONCHLEN];\r\n  char *cPath = pCtx->conchFilePath;\r\n  size_t readLen = 0;\r\n  size_t pathLen = 0;\r\n  char errmsg[64] = \"\";\r\n  int fd = -1;\r\n  int rc = -1;\r\n  UNUSED_PARAMETER(myHostID);\r\n\r\n  /* create a new path by replace the trailing '-conch' with '-break' */\r\n  pathLen = strlcpy(tPath, cPath, MAXPATHLEN);\r\n  if( pathLen>MAXPATHLEN || pathLen<6 || \r\n     (strlcpy(&tPath[pathLen-5], \"break\", 6) != 5) ){\r\n    sqlite3_snprintf(sizeof(errmsg),errmsg,\"path error (len %d)\",(int)pathLen);\r\n    goto end_breaklock;\r\n  }\r\n  /* read the conch content */\r\n  readLen = osPread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0);\r\n  if( readLen<PROXY_PATHINDEX ){\r\n    sqlite3_snprintf(sizeof(errmsg),errmsg,\"read error (len %d)\",(int)readLen);\r\n    goto end_breaklock;\r\n  }\r\n  /* write it out to the temporary break file */\r\n  fd = robust_open(tPath, (O_RDWR|O_CREAT|O_EXCL), 0);\r\n  if( fd<0 ){\r\n    sqlite3_snprintf(sizeof(errmsg), errmsg, \"create failed (%d)\", errno);\r\n    goto end_breaklock;\r\n  }\r\n  if( osPwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){\r\n    sqlite3_snprintf(sizeof(errmsg), errmsg, \"write failed (%d)\", errno);\r\n    goto end_breaklock;\r\n  }\r\n  if( rename(tPath, cPath) ){\r\n    sqlite3_snprintf(sizeof(errmsg), errmsg, \"rename failed (%d)\", errno);\r\n    goto end_breaklock;\r\n  }\r\n  rc = 0;\r\n  fprintf(stderr, \"broke stale lock on %s\\n\", cPath);\r\n  robust_close(pFile, conchFile->h, __LINE__);\r\n  conchFile->h = fd;\r\n  conchFile->openFlags = O_RDWR | O_CREAT;\r\n\r\nend_breaklock:\r\n  if( rc ){\r\n    if( fd>=0 ){\r\n      osUnlink(tPath);\r\n      robust_close(pFile, fd, __LINE__);\r\n    }\r\n    fprintf(stderr, \"failed to break stale lock on %s, %s\\n\", cPath, errmsg);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* Take the requested lock on the conch file and break a stale lock if the \r\n** host id matches.\r\n*/\r\nstatic int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){\r\n  proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; \r\n  unixFile *conchFile = pCtx->conchFile;\r\n  int rc = SQLITE_OK;\r\n  int nTries = 0;\r\n  struct timespec conchModTime;\r\n  \r\n  memset(&conchModTime, 0, sizeof(conchModTime));\r\n  do {\r\n    rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType);\r\n    nTries ++;\r\n    if( rc==SQLITE_BUSY ){\r\n      /* If the lock failed (busy):\r\n       * 1st try: get the mod time of the conch, wait 0.5s and try again. \r\n       * 2nd try: fail if the mod time changed or host id is different, wait \r\n       *           10 sec and try again\r\n       * 3rd try: break the lock unless the mod time has changed.\r\n       */\r\n      struct stat buf;\r\n      if( osFstat(conchFile->h, &buf) ){\r\n        pFile->lastErrno = errno;\r\n        return SQLITE_IOERR_LOCK;\r\n      }\r\n      \r\n      if( nTries==1 ){\r\n        conchModTime = buf.st_mtimespec;\r\n        usleep(500000); /* wait 0.5 sec and try the lock again*/\r\n        continue;  \r\n      }\r\n\r\n      assert( nTries>1 );\r\n      if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec || \r\n         conchModTime.tv_nsec != buf.st_mtimespec.tv_nsec ){\r\n        return SQLITE_BUSY;\r\n      }\r\n      \r\n      if( nTries==2 ){  \r\n        char tBuf[PROXY_MAXCONCHLEN];\r\n        int len = osPread(conchFile->h, tBuf, PROXY_MAXCONCHLEN, 0);\r\n        if( len<0 ){\r\n          pFile->lastErrno = errno;\r\n          return SQLITE_IOERR_LOCK;\r\n        }\r\n        if( len>PROXY_PATHINDEX && tBuf[0]==(char)PROXY_CONCHVERSION){\r\n          /* don't break the lock if the host id doesn't match */\r\n          if( 0!=memcmp(&tBuf[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN) ){\r\n            return SQLITE_BUSY;\r\n          }\r\n        }else{\r\n          /* don't break the lock on short read or a version mismatch */\r\n          return SQLITE_BUSY;\r\n        }\r\n        usleep(10000000); /* wait 10 sec and try the lock again */\r\n        continue; \r\n      }\r\n      \r\n      assert( nTries==3 );\r\n      if( 0==proxyBreakConchLock(pFile, myHostID) ){\r\n        rc = SQLITE_OK;\r\n        if( lockType==EXCLUSIVE_LOCK ){\r\n          rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK);          \r\n        }\r\n        if( !rc ){\r\n          rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType);\r\n        }\r\n      }\r\n    }\r\n  } while( rc==SQLITE_BUSY && nTries<3 );\r\n  \r\n  return rc;\r\n}\r\n\r\n/* Takes the conch by taking a shared lock and read the contents conch, if \r\n** lockPath is non-NULL, the host ID and lock file path must match.  A NULL \r\n** lockPath means that the lockPath in the conch file will be used if the \r\n** host IDs match, or a new lock path will be generated automatically \r\n** and written to the conch file.\r\n*/\r\nstatic int proxyTakeConch(unixFile *pFile){\r\n  proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; \r\n  \r\n  if( pCtx->conchHeld!=0 ){\r\n    return SQLITE_OK;\r\n  }else{\r\n    unixFile *conchFile = pCtx->conchFile;\r\n    uuid_t myHostID;\r\n    int pError = 0;\r\n    char readBuf[PROXY_MAXCONCHLEN];\r\n    char lockPath[MAXPATHLEN];\r\n    char *tempLockPath = NULL;\r\n    int rc = SQLITE_OK;\r\n    int createConch = 0;\r\n    int hostIdMatch = 0;\r\n    int readLen = 0;\r\n    int tryOldLockPath = 0;\r\n    int forceNewLockPath = 0;\r\n    \r\n    OSTRACE((\"TAKECONCH  %d for %s pid=%d\\n\", conchFile->h,\r\n             (pCtx->lockProxyPath ? pCtx->lockProxyPath : \":auto:\"), getpid()));\r\n\r\n    rc = proxyGetHostID(myHostID, &pError);\r\n    if( (rc&0xff)==SQLITE_IOERR ){\r\n      pFile->lastErrno = pError;\r\n      goto end_takeconch;\r\n    }\r\n    rc = proxyConchLock(pFile, myHostID, SHARED_LOCK);\r\n    if( rc!=SQLITE_OK ){\r\n      goto end_takeconch;\r\n    }\r\n    /* read the existing conch file */\r\n    readLen = seekAndRead((unixFile*)conchFile, 0, readBuf, PROXY_MAXCONCHLEN);\r\n    if( readLen<0 ){\r\n      /* I/O error: lastErrno set by seekAndRead */\r\n      pFile->lastErrno = conchFile->lastErrno;\r\n      rc = SQLITE_IOERR_READ;\r\n      goto end_takeconch;\r\n    }else if( readLen<=(PROXY_HEADERLEN+PROXY_HOSTIDLEN) || \r\n             readBuf[0]!=(char)PROXY_CONCHVERSION ){\r\n      /* a short read or version format mismatch means we need to create a new \r\n      ** conch file. \r\n      */\r\n      createConch = 1;\r\n    }\r\n    /* if the host id matches and the lock path already exists in the conch\r\n    ** we'll try to use the path there, if we can't open that path, we'll \r\n    ** retry with a new auto-generated path \r\n    */\r\n    do { /* in case we need to try again for an :auto: named lock file */\r\n\r\n      if( !createConch && !forceNewLockPath ){\r\n        hostIdMatch = !memcmp(&readBuf[PROXY_HEADERLEN], myHostID, \r\n                                  PROXY_HOSTIDLEN);\r\n        /* if the conch has data compare the contents */\r\n        if( !pCtx->lockProxyPath ){\r\n          /* for auto-named local lock file, just check the host ID and we'll\r\n           ** use the local lock file path that's already in there\r\n           */\r\n          if( hostIdMatch ){\r\n            size_t pathLen = (readLen - PROXY_PATHINDEX);\r\n            \r\n            if( pathLen>=MAXPATHLEN ){\r\n              pathLen=MAXPATHLEN-1;\r\n            }\r\n            memcpy(lockPath, &readBuf[PROXY_PATHINDEX], pathLen);\r\n            lockPath[pathLen] = 0;\r\n            tempLockPath = lockPath;\r\n            tryOldLockPath = 1;\r\n            /* create a copy of the lock path if the conch is taken */\r\n            goto end_takeconch;\r\n          }\r\n        }else if( hostIdMatch\r\n               && !strncmp(pCtx->lockProxyPath, &readBuf[PROXY_PATHINDEX],\r\n                           readLen-PROXY_PATHINDEX)\r\n        ){\r\n          /* conch host and lock path match */\r\n          goto end_takeconch; \r\n        }\r\n      }\r\n      \r\n      /* if the conch isn't writable and doesn't match, we can't take it */\r\n      if( (conchFile->openFlags&O_RDWR) == 0 ){\r\n        rc = SQLITE_BUSY;\r\n        goto end_takeconch;\r\n      }\r\n      \r\n      /* either the conch didn't match or we need to create a new one */\r\n      if( !pCtx->lockProxyPath ){\r\n        proxyGetLockPath(pCtx->dbPath, lockPath, MAXPATHLEN);\r\n        tempLockPath = lockPath;\r\n        /* create a copy of the lock path _only_ if the conch is taken */\r\n      }\r\n      \r\n      /* update conch with host and path (this will fail if other process\r\n      ** has a shared lock already), if the host id matches, use the big\r\n      ** stick.\r\n      */\r\n      futimes(conchFile->h, NULL);\r\n      if( hostIdMatch && !createConch ){\r\n        if( conchFile->pInode && conchFile->pInode->nShared>1 ){\r\n          /* We are trying for an exclusive lock but another thread in this\r\n           ** same process is still holding a shared lock. */\r\n          rc = SQLITE_BUSY;\r\n        } else {          \r\n          rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK);\r\n        }\r\n      }else{\r\n        rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, EXCLUSIVE_LOCK);\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        char writeBuffer[PROXY_MAXCONCHLEN];\r\n        int writeSize = 0;\r\n        \r\n        writeBuffer[0] = (char)PROXY_CONCHVERSION;\r\n        memcpy(&writeBuffer[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN);\r\n        if( pCtx->lockProxyPath!=NULL ){\r\n          strlcpy(&writeBuffer[PROXY_PATHINDEX], pCtx->lockProxyPath, MAXPATHLEN);\r\n        }else{\r\n          strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN);\r\n        }\r\n        writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]);\r\n        robust_ftruncate(conchFile->h, writeSize);\r\n        rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0);\r\n        fsync(conchFile->h);\r\n        /* If we created a new conch file (not just updated the contents of a \r\n         ** valid conch file), try to match the permissions of the database \r\n         */\r\n        if( rc==SQLITE_OK && createConch ){\r\n          struct stat buf;\r\n          int err = osFstat(pFile->h, &buf);\r\n          if( err==0 ){\r\n            mode_t cmode = buf.st_mode&(S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP |\r\n                                        S_IROTH|S_IWOTH);\r\n            /* try to match the database file R/W permissions, ignore failure */\r\n#ifndef SQLITE_PROXY_DEBUG\r\n            osFchmod(conchFile->h, cmode);\r\n#else\r\n            do{\r\n              rc = osFchmod(conchFile->h, cmode);\r\n            }while( rc==(-1) && errno==EINTR );\r\n            if( rc!=0 ){\r\n              int code = errno;\r\n              fprintf(stderr, \"fchmod %o FAILED with %d %s\\n\",\r\n                      cmode, code, strerror(code));\r\n            } else {\r\n              fprintf(stderr, \"fchmod %o SUCCEDED\\n\",cmode);\r\n            }\r\n          }else{\r\n            int code = errno;\r\n            fprintf(stderr, \"STAT FAILED[%d] with %d %s\\n\", \r\n                    err, code, strerror(code));\r\n#endif\r\n          }\r\n        }\r\n      }\r\n      conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK);\r\n      \r\n    end_takeconch:\r\n      OSTRACE((\"TRANSPROXY: CLOSE  %d\\n\", pFile->h));\r\n      if( rc==SQLITE_OK && pFile->openFlags ){\r\n        int fd;\r\n        if( pFile->h>=0 ){\r\n          robust_close(pFile, pFile->h, __LINE__);\r\n        }\r\n        pFile->h = -1;\r\n        fd = robust_open(pCtx->dbPath, pFile->openFlags, 0);\r\n        OSTRACE((\"TRANSPROXY: OPEN  %d\\n\", fd));\r\n        if( fd>=0 ){\r\n          pFile->h = fd;\r\n        }else{\r\n          rc=SQLITE_CANTOPEN_BKPT; /* SQLITE_BUSY? proxyTakeConch called\r\n           during locking */\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK && !pCtx->lockProxy ){\r\n        char *path = tempLockPath ? tempLockPath : pCtx->lockProxyPath;\r\n        rc = proxyCreateUnixFile(path, &pCtx->lockProxy, 1);\r\n        if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM && tryOldLockPath ){\r\n          /* we couldn't create the proxy lock file with the old lock file path\r\n           ** so try again via auto-naming \r\n           */\r\n          forceNewLockPath = 1;\r\n          tryOldLockPath = 0;\r\n          continue; /* go back to the do {} while start point, try again */\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        /* Need to make a copy of path if we extracted the value\r\n         ** from the conch file or the path was allocated on the stack\r\n         */\r\n        if( tempLockPath ){\r\n          pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath);\r\n          if( !pCtx->lockProxyPath ){\r\n            rc = SQLITE_NOMEM;\r\n          }\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        pCtx->conchHeld = 1;\r\n        \r\n        if( pCtx->lockProxy->pMethod == &afpIoMethods ){\r\n          afpLockingContext *afpCtx;\r\n          afpCtx = (afpLockingContext *)pCtx->lockProxy->lockingContext;\r\n          afpCtx->dbPath = pCtx->lockProxyPath;\r\n        }\r\n      } else {\r\n        conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);\r\n      }\r\n      OSTRACE((\"TAKECONCH  %d %s\\n\", conchFile->h,\r\n               rc==SQLITE_OK?\"ok\":\"failed\"));\r\n      return rc;\r\n    } while (1); /* in case we need to retry the :auto: lock file - \r\n                 ** we should never get here except via the 'continue' call. */\r\n  }\r\n}\r\n\r\n/*\r\n** If pFile holds a lock on a conch file, then release that lock.\r\n*/\r\nstatic int proxyReleaseConch(unixFile *pFile){\r\n  int rc = SQLITE_OK;         /* Subroutine return code */\r\n  proxyLockingContext *pCtx;  /* The locking context for the proxy lock */\r\n  unixFile *conchFile;        /* Name of the conch file */\r\n\r\n  pCtx = (proxyLockingContext *)pFile->lockingContext;\r\n  conchFile = pCtx->conchFile;\r\n  OSTRACE((\"RELEASECONCH  %d for %s pid=%d\\n\", conchFile->h,\r\n           (pCtx->lockProxyPath ? pCtx->lockProxyPath : \":auto:\"), \r\n           getpid()));\r\n  if( pCtx->conchHeld>0 ){\r\n    rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);\r\n  }\r\n  pCtx->conchHeld = 0;\r\n  OSTRACE((\"RELEASECONCH  %d %s\\n\", conchFile->h,\r\n           (rc==SQLITE_OK ? \"ok\" : \"failed\")));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Given the name of a database file, compute the name of its conch file.\r\n** Store the conch filename in memory obtained from sqlite3_malloc().\r\n** Make *pConchPath point to the new name.  Return SQLITE_OK on success\r\n** or SQLITE_NOMEM if unable to obtain memory.\r\n**\r\n** The caller is responsible for ensuring that the allocated memory\r\n** space is eventually freed.\r\n**\r\n** *pConchPath is set to NULL if a memory allocation error occurs.\r\n*/\r\nstatic int proxyCreateConchPathname(char *dbPath, char **pConchPath){\r\n  int i;                        /* Loop counter */\r\n  int len = (int)strlen(dbPath); /* Length of database filename - dbPath */\r\n  char *conchPath;              /* buffer in which to construct conch name */\r\n\r\n  /* Allocate space for the conch filename and initialize the name to\r\n  ** the name of the original database file. */  \r\n  *pConchPath = conchPath = (char *)sqlite3_malloc(len + 8);\r\n  if( conchPath==0 ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memcpy(conchPath, dbPath, len+1);\r\n  \r\n  /* now insert a \".\" before the last / character */\r\n  for( i=(len-1); i>=0; i-- ){\r\n    if( conchPath[i]=='/' ){\r\n      i++;\r\n      break;\r\n    }\r\n  }\r\n  conchPath[i]='.';\r\n  while ( i<len ){\r\n    conchPath[i+1]=dbPath[i];\r\n    i++;\r\n  }\r\n\r\n  /* append the \"-conch\" suffix to the file */\r\n  memcpy(&conchPath[i+1], \"-conch\", 7);\r\n  assert( (int)strlen(conchPath) == len+7 );\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/* Takes a fully configured proxy locking-style unix file and switches\r\n** the local lock file path \r\n*/\r\nstatic int switchLockProxyPath(unixFile *pFile, const char *path) {\r\n  proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;\r\n  char *oldPath = pCtx->lockProxyPath;\r\n  int rc = SQLITE_OK;\r\n\r\n  if( pFile->eFileLock!=NO_LOCK ){\r\n    return SQLITE_BUSY;\r\n  }  \r\n\r\n  /* nothing to do if the path is NULL, :auto: or matches the existing path */\r\n  if( !path || path[0]=='\\0' || !strcmp(path, \":auto:\") ||\r\n    (oldPath && !strncmp(oldPath, path, MAXPATHLEN)) ){\r\n    return SQLITE_OK;\r\n  }else{\r\n    unixFile *lockProxy = pCtx->lockProxy;\r\n    pCtx->lockProxy=NULL;\r\n    pCtx->conchHeld = 0;\r\n    if( lockProxy!=NULL ){\r\n      rc=lockProxy->pMethod->xClose((sqlite3_file *)lockProxy);\r\n      if( rc ) return rc;\r\n      sqlite3_free(lockProxy);\r\n    }\r\n    sqlite3_free(oldPath);\r\n    pCtx->lockProxyPath = sqlite3DbStrDup(0, path);\r\n  }\r\n  \r\n  return rc;\r\n}\r\n\r\n/*\r\n** pFile is a file that has been opened by a prior xOpen call.  dbPath\r\n** is a string buffer at least MAXPATHLEN+1 characters in size.\r\n**\r\n** This routine find the filename associated with pFile and writes it\r\n** int dbPath.\r\n*/\r\nstatic int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){\r\n#if defined(__APPLE__)\r\n  if( pFile->pMethod == &afpIoMethods ){\r\n    /* afp style keeps a reference to the db path in the filePath field \r\n    ** of the struct */\r\n    assert( (int)strlen((char*)pFile->lockingContext)<=MAXPATHLEN );\r\n    strlcpy(dbPath, ((afpLockingContext *)pFile->lockingContext)->dbPath, MAXPATHLEN);\r\n  } else\r\n#endif\r\n  if( pFile->pMethod == &dotlockIoMethods ){\r\n    /* dot lock style uses the locking context to store the dot lock\r\n    ** file path */\r\n    int len = strlen((char *)pFile->lockingContext) - strlen(DOTLOCK_SUFFIX);\r\n    memcpy(dbPath, (char *)pFile->lockingContext, len + 1);\r\n  }else{\r\n    /* all other styles use the locking context to store the db file path */\r\n    assert( strlen((char*)pFile->lockingContext)<=MAXPATHLEN );\r\n    strlcpy(dbPath, (char *)pFile->lockingContext, MAXPATHLEN);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Takes an already filled in unix file and alters it so all file locking \r\n** will be performed on the local proxy lock file.  The following fields\r\n** are preserved in the locking context so that they can be restored and \r\n** the unix structure properly cleaned up at close time:\r\n**  ->lockingContext\r\n**  ->pMethod\r\n*/\r\nstatic int proxyTransformUnixFile(unixFile *pFile, const char *path) {\r\n  proxyLockingContext *pCtx;\r\n  char dbPath[MAXPATHLEN+1];       /* Name of the database file */\r\n  char *lockPath=NULL;\r\n  int rc = SQLITE_OK;\r\n  \r\n  if( pFile->eFileLock!=NO_LOCK ){\r\n    return SQLITE_BUSY;\r\n  }\r\n  proxyGetDbPathForUnixFile(pFile, dbPath);\r\n  if( !path || path[0]=='\\0' || !strcmp(path, \":auto:\") ){\r\n    lockPath=NULL;\r\n  }else{\r\n    lockPath=(char *)path;\r\n  }\r\n  \r\n  OSTRACE((\"TRANSPROXY  %d for %s pid=%d\\n\", pFile->h,\r\n           (lockPath ? lockPath : \":auto:\"), getpid()));\r\n\r\n  pCtx = sqlite3_malloc( sizeof(*pCtx) );\r\n  if( pCtx==0 ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pCtx, 0, sizeof(*pCtx));\r\n\r\n  rc = proxyCreateConchPathname(dbPath, &pCtx->conchFilePath);\r\n  if( rc==SQLITE_OK ){\r\n    rc = proxyCreateUnixFile(pCtx->conchFilePath, &pCtx->conchFile, 0);\r\n    if( rc==SQLITE_CANTOPEN && ((pFile->openFlags&O_RDWR) == 0) ){\r\n      /* if (a) the open flags are not O_RDWR, (b) the conch isn't there, and\r\n      ** (c) the file system is read-only, then enable no-locking access.\r\n      ** Ugh, since O_RDONLY==0x0000 we test for !O_RDWR since unixOpen asserts\r\n      ** that openFlags will have only one of O_RDONLY or O_RDWR.\r\n      */\r\n      struct statfs fsInfo;\r\n      struct stat conchInfo;\r\n      int goLockless = 0;\r\n\r\n      if( osStat(pCtx->conchFilePath, &conchInfo) == -1 ) {\r\n        int err = errno;\r\n        if( (err==ENOENT) && (statfs(dbPath, &fsInfo) != -1) ){\r\n          goLockless = (fsInfo.f_flags&MNT_RDONLY) == MNT_RDONLY;\r\n        }\r\n      }\r\n      if( goLockless ){\r\n        pCtx->conchHeld = -1; /* read only FS/ lockless */\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n  }  \r\n  if( rc==SQLITE_OK && lockPath ){\r\n    pCtx->lockProxyPath = sqlite3DbStrDup(0, lockPath);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    pCtx->dbPath = sqlite3DbStrDup(0, dbPath);\r\n    if( pCtx->dbPath==NULL ){\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    /* all memory is allocated, proxys are created and assigned, \r\n    ** switch the locking context and pMethod then return.\r\n    */\r\n    pCtx->oldLockingContext = pFile->lockingContext;\r\n    pFile->lockingContext = pCtx;\r\n    pCtx->pOldMethod = pFile->pMethod;\r\n    pFile->pMethod = &proxyIoMethods;\r\n  }else{\r\n    if( pCtx->conchFile ){ \r\n      pCtx->conchFile->pMethod->xClose((sqlite3_file *)pCtx->conchFile);\r\n      sqlite3_free(pCtx->conchFile);\r\n    }\r\n    sqlite3DbFree(0, pCtx->lockProxyPath);\r\n    sqlite3_free(pCtx->conchFilePath); \r\n    sqlite3_free(pCtx);\r\n  }\r\n  OSTRACE((\"TRANSPROXY  %d %s\\n\", pFile->h,\r\n           (rc==SQLITE_OK ? \"ok\" : \"failed\")));\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This routine handles sqlite3_file_control() calls that are specific\r\n** to proxy locking.\r\n*/\r\nstatic int proxyFileControl(sqlite3_file *id, int op, void *pArg){\r\n  switch( op ){\r\n    case SQLITE_GET_LOCKPROXYFILE: {\r\n      unixFile *pFile = (unixFile*)id;\r\n      if( pFile->pMethod == &proxyIoMethods ){\r\n        proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;\r\n        proxyTakeConch(pFile);\r\n        if( pCtx->lockProxyPath ){\r\n          *(const char **)pArg = pCtx->lockProxyPath;\r\n        }else{\r\n          *(const char **)pArg = \":auto: (not held)\";\r\n        }\r\n      } else {\r\n        *(const char **)pArg = NULL;\r\n      }\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_SET_LOCKPROXYFILE: {\r\n      unixFile *pFile = (unixFile*)id;\r\n      int rc = SQLITE_OK;\r\n      int isProxyStyle = (pFile->pMethod == &proxyIoMethods);\r\n      if( pArg==NULL || (const char *)pArg==0 ){\r\n        if( isProxyStyle ){\r\n          /* turn off proxy locking - not supported */\r\n          rc = SQLITE_ERROR /*SQLITE_PROTOCOL? SQLITE_MISUSE?*/;\r\n        }else{\r\n          /* turn off proxy locking - already off - NOOP */\r\n          rc = SQLITE_OK;\r\n        }\r\n      }else{\r\n        const char *proxyPath = (const char *)pArg;\r\n        if( isProxyStyle ){\r\n          proxyLockingContext *pCtx = \r\n            (proxyLockingContext*)pFile->lockingContext;\r\n          if( !strcmp(pArg, \":auto:\") \r\n           || (pCtx->lockProxyPath &&\r\n               !strncmp(pCtx->lockProxyPath, proxyPath, MAXPATHLEN))\r\n          ){\r\n            rc = SQLITE_OK;\r\n          }else{\r\n            rc = switchLockProxyPath(pFile, proxyPath);\r\n          }\r\n        }else{\r\n          /* turn on proxy file locking */\r\n          rc = proxyTransformUnixFile(pFile, proxyPath);\r\n        }\r\n      }\r\n      return rc;\r\n    }\r\n    default: {\r\n      assert( 0 );  /* The call assures that only valid opcodes are sent */\r\n    }\r\n  }\r\n  /*NOTREACHED*/\r\n  return SQLITE_ERROR;\r\n}\r\n\r\n/*\r\n** Within this division (the proxying locking implementation) the procedures\r\n** above this point are all utilities.  The lock-related methods of the\r\n** proxy-locking sqlite3_io_method object follow.\r\n*/\r\n\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, set *pResOut\r\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\r\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\r\n*/\r\nstatic int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  int rc = proxyTakeConch(pFile);\r\n  if( rc==SQLITE_OK ){\r\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\r\n    if( pCtx->conchHeld>0 ){\r\n      unixFile *proxy = pCtx->lockProxy;\r\n      return proxy->pMethod->xCheckReservedLock((sqlite3_file*)proxy, pResOut);\r\n    }else{ /* conchHeld < 0 is lockless */\r\n      pResOut=0;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter eFileLock - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\r\n** routine to lower a locking level.\r\n*/\r\nstatic int proxyLock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  int rc = proxyTakeConch(pFile);\r\n  if( rc==SQLITE_OK ){\r\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\r\n    if( pCtx->conchHeld>0 ){\r\n      unixFile *proxy = pCtx->lockProxy;\r\n      rc = proxy->pMethod->xLock((sqlite3_file*)proxy, eFileLock);\r\n      pFile->eFileLock = proxy->eFileLock;\r\n    }else{\r\n      /* conchHeld < 0 is lockless */\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n*/\r\nstatic int proxyUnlock(sqlite3_file *id, int eFileLock) {\r\n  unixFile *pFile = (unixFile*)id;\r\n  int rc = proxyTakeConch(pFile);\r\n  if( rc==SQLITE_OK ){\r\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\r\n    if( pCtx->conchHeld>0 ){\r\n      unixFile *proxy = pCtx->lockProxy;\r\n      rc = proxy->pMethod->xUnlock((sqlite3_file*)proxy, eFileLock);\r\n      pFile->eFileLock = proxy->eFileLock;\r\n    }else{\r\n      /* conchHeld < 0 is lockless */\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close a file that uses proxy locks.\r\n*/\r\nstatic int proxyClose(sqlite3_file *id) {\r\n  if( id ){\r\n    unixFile *pFile = (unixFile*)id;\r\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\r\n    unixFile *lockProxy = pCtx->lockProxy;\r\n    unixFile *conchFile = pCtx->conchFile;\r\n    int rc = SQLITE_OK;\r\n    \r\n    if( lockProxy ){\r\n      rc = lockProxy->pMethod->xUnlock((sqlite3_file*)lockProxy, NO_LOCK);\r\n      if( rc ) return rc;\r\n      rc = lockProxy->pMethod->xClose((sqlite3_file*)lockProxy);\r\n      if( rc ) return rc;\r\n      sqlite3_free(lockProxy);\r\n      pCtx->lockProxy = 0;\r\n    }\r\n    if( conchFile ){\r\n      if( pCtx->conchHeld ){\r\n        rc = proxyReleaseConch(pFile);\r\n        if( rc ) return rc;\r\n      }\r\n      rc = conchFile->pMethod->xClose((sqlite3_file*)conchFile);\r\n      if( rc ) return rc;\r\n      sqlite3_free(conchFile);\r\n    }\r\n    sqlite3DbFree(0, pCtx->lockProxyPath);\r\n    sqlite3_free(pCtx->conchFilePath);\r\n    sqlite3DbFree(0, pCtx->dbPath);\r\n    /* restore the original locking context and pMethod then close it */\r\n    pFile->lockingContext = pCtx->oldLockingContext;\r\n    pFile->pMethod = pCtx->pOldMethod;\r\n    sqlite3_free(pCtx);\r\n    return pFile->pMethod->xClose(id);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n\r\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\r\n/*\r\n** The proxy locking style is intended for use with AFP filesystems.\r\n** And since AFP is only supported on MacOSX, the proxy locking is also\r\n** restricted to MacOSX.\r\n** \r\n**\r\n******************* End of the proxy lock implementation **********************\r\n******************************************************************************/\r\n\r\n/*\r\n** Initialize the operating system interface.\r\n**\r\n** This routine registers all VFS implementations for unix-like operating\r\n** systems.  This routine, and the sqlite3_os_end() routine that follows,\r\n** should be the only routines in this file that are visible from other\r\n** files.\r\n**\r\n** This routine is called once during SQLite initialization and by a\r\n** single thread.  The memory allocation and mutex subsystems have not\r\n** necessarily been initialized when this routine is called, and so they\r\n** should not be used.\r\n*/\r\nSQLITE_API int sqlite3_os_init(void){ \r\n  /* \r\n  ** The following macro defines an initializer for an sqlite3_vfs object.\r\n  ** The name of the VFS is NAME.  The pAppData is a pointer to a pointer\r\n  ** to the \"finder\" function.  (pAppData is a pointer to a pointer because\r\n  ** silly C90 rules prohibit a void* from being cast to a function pointer\r\n  ** and so we have to go through the intermediate pointer to avoid problems\r\n  ** when compiling with -pedantic-errors on GCC.)\r\n  **\r\n  ** The FINDER parameter to this macro is the name of the pointer to the\r\n  ** finder-function.  The finder-function returns a pointer to the\r\n  ** sqlite_io_methods object that implements the desired locking\r\n  ** behaviors.  See the division above that contains the IOMETHODS\r\n  ** macro for addition information on finder-functions.\r\n  **\r\n  ** Most finders simply return a pointer to a fixed sqlite3_io_methods\r\n  ** object.  But the \"autolockIoFinder\" available on MacOSX does a little\r\n  ** more than that; it looks at the filesystem type that hosts the \r\n  ** database file and tries to choose an locking method appropriate for\r\n  ** that filesystem time.\r\n  */\r\n  #define UNIXVFS(VFSNAME, FINDER) {                        \\\r\n    3,                    /* iVersion */                    \\\r\n    sizeof(unixFile),     /* szOsFile */                    \\\r\n    MAX_PATHNAME,         /* mxPathname */                  \\\r\n    0,                    /* pNext */                       \\\r\n    VFSNAME,              /* zName */                       \\\r\n    (void*)&FINDER,       /* pAppData */                    \\\r\n    unixOpen,             /* xOpen */                       \\\r\n    unixDelete,           /* xDelete */                     \\\r\n    unixAccess,           /* xAccess */                     \\\r\n    unixFullPathname,     /* xFullPathname */               \\\r\n    unixDlOpen,           /* xDlOpen */                     \\\r\n    unixDlError,          /* xDlError */                    \\\r\n    unixDlSym,            /* xDlSym */                      \\\r\n    unixDlClose,          /* xDlClose */                    \\\r\n    unixRandomness,       /* xRandomness */                 \\\r\n    unixSleep,            /* xSleep */                      \\\r\n    unixCurrentTime,      /* xCurrentTime */                \\\r\n    unixGetLastError,     /* xGetLastError */               \\\r\n    unixCurrentTimeInt64, /* xCurrentTimeInt64 */           \\\r\n    unixSetSystemCall,    /* xSetSystemCall */              \\\r\n    unixGetSystemCall,    /* xGetSystemCall */              \\\r\n    unixNextSystemCall,   /* xNextSystemCall */             \\\r\n  }\r\n\r\n  /*\r\n  ** All default VFSes for unix are contained in the following array.\r\n  **\r\n  ** Note that the sqlite3_vfs.pNext field of the VFS object is modified\r\n  ** by the SQLite core when the VFS is registered.  So the following\r\n  ** array cannot be const.\r\n  */\r\n  static sqlite3_vfs aVfs[] = {\r\n#if SQLITE_ENABLE_LOCKING_STYLE && (OS_VXWORKS || defined(__APPLE__))\r\n    UNIXVFS(\"unix\",          autolockIoFinder ),\r\n#else\r\n    UNIXVFS(\"unix\",          posixIoFinder ),\r\n#endif\r\n    UNIXVFS(\"unix-none\",     nolockIoFinder ),\r\n    UNIXVFS(\"unix-dotfile\",  dotlockIoFinder ),\r\n    UNIXVFS(\"unix-excl\",     posixIoFinder ),\r\n#if OS_VXWORKS\r\n    UNIXVFS(\"unix-namedsem\", semIoFinder ),\r\n#endif\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n    UNIXVFS(\"unix-posix\",    posixIoFinder ),\r\n#if !OS_VXWORKS\r\n    UNIXVFS(\"unix-flock\",    flockIoFinder ),\r\n#endif\r\n#endif\r\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\r\n    UNIXVFS(\"unix-afp\",      afpIoFinder ),\r\n    UNIXVFS(\"unix-nfs\",      nfsIoFinder ),\r\n    UNIXVFS(\"unix-proxy\",    proxyIoFinder ),\r\n#endif\r\n  };\r\n  unsigned int i;          /* Loop counter */\r\n\r\n  /* Double-check that the aSyscall[] array has been constructed\r\n  ** correctly.  See ticket [bb3a86e890c8e96ab] */\r\n  assert( ArraySize(aSyscall)==22 );\r\n\r\n  /* Register all VFSes defined in the aVfs[] array */\r\n  for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){\r\n    sqlite3_vfs_register(&aVfs[i], i==0);\r\n  }\r\n  return SQLITE_OK; \r\n}\r\n\r\n/*\r\n** Shutdown the operating system interface.\r\n**\r\n** Some operating systems might need to do some cleanup in this routine,\r\n** to release dynamically allocated objects.  But not on unix.\r\n** This routine is a no-op for unix.\r\n*/\r\nSQLITE_API int sqlite3_os_end(void){ \r\n  return SQLITE_OK; \r\n}\r\n \r\n#endif /* SQLITE_OS_UNIX */\r\n\r\n/************** End of os_unix.c *********************************************/\r\n/************** Begin file os_win.c ******************************************/\r\n/*\r\n** 2004 May 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains code that is specific to Windows.\r\n*/\r\n#if SQLITE_OS_WIN               /* This file is used for Windows only */\r\n\r\n#ifdef __CYGWIN__\r\n# include <sys/cygwin.h>\r\n#endif\r\n\r\n/*\r\n** Include code that is common to all os_*.c files\r\n*/\r\n/************** Include os_common.h in the middle of os_win.c ****************/\r\n/************** Begin file os_common.h ***************************************/\r\n/*\r\n** 2004 May 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains macros and a little bit of code that is common to\r\n** all of the platform-specific files (os_*.c) and is #included into those\r\n** files.\r\n**\r\n** This file should be #included by the os_*.c files only.  It is not a\r\n** general purpose header file.\r\n*/\r\n#ifndef _OS_COMMON_H_\r\n#define _OS_COMMON_H_\r\n\r\n/*\r\n** At least two bugs have slipped in because we changed the MEMORY_DEBUG\r\n** macro to SQLITE_DEBUG and some older makefiles have not yet made the\r\n** switch.  The following code should catch this problem at compile-time.\r\n*/\r\n#ifdef MEMORY_DEBUG\r\n# error \"The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead.\"\r\n#endif\r\n\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n# ifndef SQLITE_DEBUG_OS_TRACE\r\n#   define SQLITE_DEBUG_OS_TRACE 0\r\n# endif\r\n  int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;\r\n# define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X\r\n#else\r\n# define OSTRACE(X)\r\n#endif\r\n\r\n/*\r\n** Macros for performance tracing.  Normally turned off.  Only works\r\n** on i486 hardware.\r\n*/\r\n#ifdef SQLITE_PERFORMANCE_TRACE\r\n\r\n/* \r\n** hwtime.h contains inline assembler code for implementing \r\n** high-performance timing routines.\r\n*/\r\n/************** Include hwtime.h in the middle of os_common.h ****************/\r\n/************** Begin file hwtime.h ******************************************/\r\n/*\r\n** 2008 May 27\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains inline asm code for retrieving \"high-performance\"\r\n** counters for x86 class CPUs.\r\n*/\r\n#ifndef _HWTIME_H_\r\n#define _HWTIME_H_\r\n\r\n/*\r\n** The following routine only works on pentium-class (or newer) processors.\r\n** It uses the RDTSC opcode to read the cycle count value out of the\r\n** processor and returns that value.  This can be used for high-res\r\n** profiling.\r\n*/\r\n#if (defined(__GNUC__) || defined(_MSC_VER)) && \\\r\n      (defined(i386) || defined(__i386__) || defined(_M_IX86))\r\n\r\n  #if defined(__GNUC__)\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n     unsigned int lo, hi;\r\n     __asm__ __volatile__ (\"rdtsc\" : \"=a\" (lo), \"=d\" (hi));\r\n     return (sqlite_uint64)hi << 32 | lo;\r\n  }\r\n\r\n  #elif defined(_MSC_VER)\r\n\r\n  __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){\r\n     __asm {\r\n        rdtsc\r\n        ret       ; return value at EDX:EAX\r\n     }\r\n  }\r\n\r\n  #endif\r\n\r\n#elif (defined(__GNUC__) && defined(__x86_64__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long val;\r\n      __asm__ __volatile__ (\"rdtsc\" : \"=A\" (val));\r\n      return val;\r\n  }\r\n \r\n#elif (defined(__GNUC__) && defined(__ppc__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long long retval;\r\n      unsigned long junk;\r\n      __asm__ __volatile__ (\"\\n\\\r\n          1:      mftbu   %1\\n\\\r\n                  mftb    %L0\\n\\\r\n                  mftbu   %0\\n\\\r\n                  cmpw    %0,%1\\n\\\r\n                  bne     1b\"\r\n                  : \"=r\" (retval), \"=r\" (junk));\r\n      return retval;\r\n  }\r\n\r\n#else\r\n\r\n  #error Need implementation of sqlite3Hwtime() for your platform.\r\n\r\n  /*\r\n  ** To compile without implementing sqlite3Hwtime() for your platform,\r\n  ** you can remove the above #error and use the following\r\n  ** stub function.  You will lose timing support for many\r\n  ** of the debugging and testing utilities, but it should at\r\n  ** least compile and run.\r\n  */\r\nSQLITE_PRIVATE   sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }\r\n\r\n#endif\r\n\r\n#endif /* !defined(_HWTIME_H_) */\r\n\r\n/************** End of hwtime.h **********************************************/\r\n/************** Continuing where we left off in os_common.h ******************/\r\n\r\nstatic sqlite_uint64 g_start;\r\nstatic sqlite_uint64 g_elapsed;\r\n#define TIMER_START       g_start=sqlite3Hwtime()\r\n#define TIMER_END         g_elapsed=sqlite3Hwtime()-g_start\r\n#define TIMER_ELAPSED     g_elapsed\r\n#else\r\n#define TIMER_START\r\n#define TIMER_END\r\n#define TIMER_ELAPSED     ((sqlite_uint64)0)\r\n#endif\r\n\r\n/*\r\n** If we compile with the SQLITE_TEST macro set, then the following block\r\n** of code will give us the ability to simulate a disk I/O error.  This\r\n** is used for testing the I/O recovery logic.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */\r\nSQLITE_API int sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */\r\nSQLITE_API int sqlite3_io_error_pending = 0;        /* Count down to first I/O error */\r\nSQLITE_API int sqlite3_io_error_persist = 0;        /* True if I/O errors persist */\r\nSQLITE_API int sqlite3_io_error_benign = 0;         /* True if errors are benign */\r\nSQLITE_API int sqlite3_diskfull_pending = 0;\r\nSQLITE_API int sqlite3_diskfull = 0;\r\n#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)\r\n#define SimulateIOError(CODE)  \\\r\n  if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \\\r\n       || sqlite3_io_error_pending-- == 1 )  \\\r\n              { local_ioerr(); CODE; }\r\nstatic void local_ioerr(){\r\n  IOTRACE((\"IOERR\\n\"));\r\n  sqlite3_io_error_hit++;\r\n  if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++;\r\n}\r\n#define SimulateDiskfullError(CODE) \\\r\n   if( sqlite3_diskfull_pending ){ \\\r\n     if( sqlite3_diskfull_pending == 1 ){ \\\r\n       local_ioerr(); \\\r\n       sqlite3_diskfull = 1; \\\r\n       sqlite3_io_error_hit = 1; \\\r\n       CODE; \\\r\n     }else{ \\\r\n       sqlite3_diskfull_pending--; \\\r\n     } \\\r\n   }\r\n#else\r\n#define SimulateIOErrorBenign(X)\r\n#define SimulateIOError(A)\r\n#define SimulateDiskfullError(A)\r\n#endif\r\n\r\n/*\r\n** When testing, keep a count of the number of open files.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_open_file_count = 0;\r\n#define OpenCounter(X)  sqlite3_open_file_count+=(X)\r\n#else\r\n#define OpenCounter(X)\r\n#endif\r\n\r\n#endif /* !defined(_OS_COMMON_H_) */\r\n\r\n/************** End of os_common.h *******************************************/\r\n/************** Continuing where we left off in os_win.c *********************/\r\n\r\n/*\r\n** Some Microsoft compilers lack this definition.\r\n*/\r\n#ifndef INVALID_FILE_ATTRIBUTES\r\n# define INVALID_FILE_ATTRIBUTES ((DWORD)-1) \r\n#endif\r\n\r\n/* Forward references */\r\ntypedef struct winShm winShm;           /* A connection to shared-memory */\r\ntypedef struct winShmNode winShmNode;   /* A region of shared-memory */\r\n\r\n/*\r\n** WinCE lacks native support for file locking so we have to fake it\r\n** with some code of our own.\r\n*/\r\n#if SQLITE_OS_WINCE\r\ntypedef struct winceLock {\r\n  int nReaders;       /* Number of reader locks obtained */\r\n  BOOL bPending;      /* Indicates a pending lock has been obtained */\r\n  BOOL bReserved;     /* Indicates a reserved lock has been obtained */\r\n  BOOL bExclusive;    /* Indicates an exclusive lock has been obtained */\r\n} winceLock;\r\n#endif\r\n\r\n/*\r\n** The winFile structure is a subclass of sqlite3_file* specific to the win32\r\n** portability layer.\r\n*/\r\ntypedef struct winFile winFile;\r\nstruct winFile {\r\n  const sqlite3_io_methods *pMethod; /*** Must be first ***/\r\n  sqlite3_vfs *pVfs;      /* The VFS used to open this file */\r\n  HANDLE h;               /* Handle for accessing the file */\r\n  u8 locktype;            /* Type of lock currently held on this file */\r\n  short sharedLockByte;   /* Randomly chosen byte used as a shared lock */\r\n  u8 ctrlFlags;           /* Flags.  See WINFILE_* below */\r\n  DWORD lastErrno;        /* The Windows errno from the last I/O error */\r\n  winShm *pShm;           /* Instance of shared memory on this file */\r\n  const char *zPath;      /* Full pathname of this file */\r\n  int szChunk;            /* Chunk size configured by FCNTL_CHUNK_SIZE */\r\n#if SQLITE_OS_WINCE\r\n  LPWSTR zDeleteOnClose;  /* Name of file to delete when closing */\r\n  HANDLE hMutex;          /* Mutex used to control access to shared lock */  \r\n  HANDLE hShared;         /* Shared memory segment used for locking */\r\n  winceLock local;        /* Locks obtained by this instance of winFile */\r\n  winceLock *shared;      /* Global shared lock memory for the file  */\r\n#endif\r\n};\r\n\r\n/*\r\n** Allowed values for winFile.ctrlFlags\r\n*/\r\n#define WINFILE_PERSIST_WAL     0x04   /* Persistent WAL mode */\r\n#define WINFILE_PSOW            0x10   /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */\r\n\r\n/*\r\n * If compiled with SQLITE_WIN32_MALLOC on Windows, we will use the\r\n * various Win32 API heap functions instead of our own.\r\n */\r\n#ifdef SQLITE_WIN32_MALLOC\r\n/*\r\n * The initial size of the Win32-specific heap.  This value may be zero.\r\n */\r\n#ifndef SQLITE_WIN32_HEAP_INIT_SIZE\r\n#  define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_DEFAULT_CACHE_SIZE) * \\\r\n                                       (SQLITE_DEFAULT_PAGE_SIZE) + 4194304)\r\n#endif\r\n\r\n/*\r\n * The maximum size of the Win32-specific heap.  This value may be zero.\r\n */\r\n#ifndef SQLITE_WIN32_HEAP_MAX_SIZE\r\n#  define SQLITE_WIN32_HEAP_MAX_SIZE  (0)\r\n#endif\r\n\r\n/*\r\n * The extra flags to use in calls to the Win32 heap APIs.  This value may be\r\n * zero for the default behavior.\r\n */\r\n#ifndef SQLITE_WIN32_HEAP_FLAGS\r\n#  define SQLITE_WIN32_HEAP_FLAGS     (0)\r\n#endif\r\n\r\n/*\r\n** The winMemData structure stores information required by the Win32-specific\r\n** sqlite3_mem_methods implementation.\r\n*/\r\ntypedef struct winMemData winMemData;\r\nstruct winMemData {\r\n#ifndef NDEBUG\r\n  u32 magic;    /* Magic number to detect structure corruption. */\r\n#endif\r\n  HANDLE hHeap; /* The handle to our heap. */\r\n  BOOL bOwned;  /* Do we own the heap (i.e. destroy it on shutdown)? */\r\n};\r\n\r\n#ifndef NDEBUG\r\n#define WINMEM_MAGIC     0x42b2830b\r\n#endif\r\n\r\nstatic struct winMemData win_mem_data = {\r\n#ifndef NDEBUG\r\n  WINMEM_MAGIC,\r\n#endif\r\n  NULL, FALSE\r\n};\r\n\r\n#ifndef NDEBUG\r\n#define winMemAssertMagic() assert( win_mem_data.magic==WINMEM_MAGIC )\r\n#else\r\n#define winMemAssertMagic()\r\n#endif\r\n\r\n#define winMemGetHeap() win_mem_data.hHeap\r\n\r\nstatic void *winMemMalloc(int nBytes);\r\nstatic void winMemFree(void *pPrior);\r\nstatic void *winMemRealloc(void *pPrior, int nBytes);\r\nstatic int winMemSize(void *p);\r\nstatic int winMemRoundup(int n);\r\nstatic int winMemInit(void *pAppData);\r\nstatic void winMemShutdown(void *pAppData);\r\n\r\nSQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void);\r\n#endif /* SQLITE_WIN32_MALLOC */\r\n\r\n/*\r\n** The following variable is (normally) set once and never changes\r\n** thereafter.  It records whether the operating system is Win9x\r\n** or WinNT.\r\n**\r\n** 0:   Operating system unknown.\r\n** 1:   Operating system is Win9x.\r\n** 2:   Operating system is WinNT.\r\n**\r\n** In order to facilitate testing on a WinNT system, the test fixture\r\n** can manually set this value to 1 to emulate Win98 behavior.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_os_type = 0;\r\n#else\r\nstatic int sqlite3_os_type = 0;\r\n#endif\r\n\r\n/*\r\n** Many system calls are accessed through pointer-to-functions so that\r\n** they may be overridden at runtime to facilitate fault injection during\r\n** testing and sandboxing.  The following array holds the names and pointers\r\n** to all overrideable system calls.\r\n*/\r\n#if !SQLITE_OS_WINCE\r\n#  define SQLITE_WIN32_HAS_ANSI\r\n#endif\r\n\r\n#if SQLITE_OS_WINCE || SQLITE_OS_WINNT\r\n#  define SQLITE_WIN32_HAS_WIDE\r\n#endif\r\n\r\n#ifndef SYSCALL\r\n#  define SYSCALL sqlite3_syscall_ptr\r\n#endif\r\n\r\n#if SQLITE_OS_WINCE\r\n/*\r\n** These macros are necessary because Windows CE does not natively support the\r\n** Win32 APIs LockFile, UnlockFile, and LockFileEx.\r\n */\r\n\r\n#  define LockFile(a,b,c,d,e)       winceLockFile(&a, b, c, d, e)\r\n#  define UnlockFile(a,b,c,d,e)     winceUnlockFile(&a, b, c, d, e)\r\n#  define LockFileEx(a,b,c,d,e,f)   winceLockFileEx(&a, b, c, d, e, f)\r\n\r\n/*\r\n** These are the special syscall hacks for Windows CE.  The locking related\r\n** defines here refer to the macros defined just above.\r\n */\r\n\r\n#  define osAreFileApisANSI()       1\r\n#  define osLockFile                LockFile\r\n#  define osUnlockFile              UnlockFile\r\n#  define osLockFileEx              LockFileEx\r\n#endif\r\n\r\nstatic struct win_syscall {\r\n  const char *zName;            /* Name of the sytem call */\r\n  sqlite3_syscall_ptr pCurrent; /* Current value of the system call */\r\n  sqlite3_syscall_ptr pDefault; /* Default value */\r\n} aSyscall[] = {\r\n#if !SQLITE_OS_WINCE\r\n  { \"AreFileApisANSI\",         (SYSCALL)AreFileApisANSI,         0 },\r\n\r\n#define osAreFileApisANSI ((BOOL(WINAPI*)(VOID))aSyscall[0].pCurrent)\r\n#else\r\n  { \"AreFileApisANSI\",         (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#if SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"CharLowerW\",              (SYSCALL)CharLowerW,              0 },\r\n#else\r\n  { \"CharLowerW\",              (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osCharLowerW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[1].pCurrent)\r\n\r\n#if SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"CharUpperW\",              (SYSCALL)CharUpperW,              0 },\r\n#else\r\n  { \"CharUpperW\",              (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osCharUpperW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[2].pCurrent)\r\n\r\n  { \"CloseHandle\",             (SYSCALL)CloseHandle,             0 },\r\n\r\n#define osCloseHandle ((BOOL(WINAPI*)(HANDLE))aSyscall[3].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"CreateFileA\",             (SYSCALL)CreateFileA,             0 },\r\n#else\r\n  { \"CreateFileA\",             (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \\\r\n        LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"CreateFileW\",             (SYSCALL)CreateFileW,             0 },\r\n#else\r\n  { \"CreateFileW\",             (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \\\r\n        LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)\r\n\r\n  { \"CreateFileMapping\",       (SYSCALL)CreateFileMapping,       0 },\r\n\r\n#define osCreateFileMapping ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \\\r\n        DWORD,DWORD,DWORD,LPCTSTR))aSyscall[6].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"CreateFileMappingW\",      (SYSCALL)CreateFileMappingW,      0 },\r\n#else\r\n  { \"CreateFileMappingW\",      (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \\\r\n        DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"CreateMutexW\",            (SYSCALL)CreateMutexW,            0 },\r\n#else\r\n  { \"CreateMutexW\",            (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \\\r\n        LPCWSTR))aSyscall[8].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"DeleteFileA\",             (SYSCALL)DeleteFileA,             0 },\r\n#else\r\n  { \"DeleteFileA\",             (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[9].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"DeleteFileW\",             (SYSCALL)DeleteFileW,             0 },\r\n#else\r\n  { \"DeleteFileW\",             (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[10].pCurrent)\r\n\r\n#if SQLITE_OS_WINCE\r\n  { \"FileTimeToLocalFileTime\", (SYSCALL)FileTimeToLocalFileTime, 0 },\r\n#else\r\n  { \"FileTimeToLocalFileTime\", (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \\\r\n        LPFILETIME))aSyscall[11].pCurrent)\r\n\r\n#if SQLITE_OS_WINCE\r\n  { \"FileTimeToSystemTime\",    (SYSCALL)FileTimeToSystemTime,    0 },\r\n#else\r\n  { \"FileTimeToSystemTime\",    (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \\\r\n        LPSYSTEMTIME))aSyscall[12].pCurrent)\r\n\r\n  { \"FlushFileBuffers\",        (SYSCALL)FlushFileBuffers,        0 },\r\n\r\n#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[13].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"FormatMessageA\",          (SYSCALL)FormatMessageA,          0 },\r\n#else\r\n  { \"FormatMessageA\",          (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \\\r\n        DWORD,va_list*))aSyscall[14].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"FormatMessageW\",          (SYSCALL)FormatMessageW,          0 },\r\n#else\r\n  { \"FormatMessageW\",          (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \\\r\n        DWORD,va_list*))aSyscall[15].pCurrent)\r\n\r\n  { \"FreeLibrary\",             (SYSCALL)FreeLibrary,             0 },\r\n\r\n#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[16].pCurrent)\r\n\r\n  { \"GetCurrentProcessId\",     (SYSCALL)GetCurrentProcessId,     0 },\r\n\r\n#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[17].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"GetDiskFreeSpaceA\",       (SYSCALL)GetDiskFreeSpaceA,       0 },\r\n#else\r\n  { \"GetDiskFreeSpaceA\",       (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \\\r\n        LPDWORD))aSyscall[18].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"GetDiskFreeSpaceW\",       (SYSCALL)GetDiskFreeSpaceW,       0 },\r\n#else\r\n  { \"GetDiskFreeSpaceW\",       (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \\\r\n        LPDWORD))aSyscall[19].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"GetFileAttributesA\",      (SYSCALL)GetFileAttributesA,      0 },\r\n#else\r\n  { \"GetFileAttributesA\",      (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"GetFileAttributesW\",      (SYSCALL)GetFileAttributesW,      0 },\r\n#else\r\n  { \"GetFileAttributesW\",      (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[21].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"GetFileAttributesExW\",    (SYSCALL)GetFileAttributesExW,    0 },\r\n#else\r\n  { \"GetFileAttributesExW\",    (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \\\r\n        LPVOID))aSyscall[22].pCurrent)\r\n\r\n  { \"GetFileSize\",             (SYSCALL)GetFileSize,             0 },\r\n\r\n#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"GetFullPathNameA\",        (SYSCALL)GetFullPathNameA,        0 },\r\n#else\r\n  { \"GetFullPathNameA\",        (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \\\r\n        LPSTR*))aSyscall[24].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"GetFullPathNameW\",        (SYSCALL)GetFullPathNameW,        0 },\r\n#else\r\n  { \"GetFullPathNameW\",        (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \\\r\n        LPWSTR*))aSyscall[25].pCurrent)\r\n\r\n  { \"GetLastError\",            (SYSCALL)GetLastError,            0 },\r\n\r\n#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[26].pCurrent)\r\n\r\n#if SQLITE_OS_WINCE\r\n  /* The GetProcAddressA() routine is only available on Windows CE. */\r\n  { \"GetProcAddressA\",         (SYSCALL)GetProcAddressA,         0 },\r\n#else\r\n  /* All other Windows platforms expect GetProcAddress() to take\r\n  ** an ANSI string regardless of the _UNICODE setting */\r\n  { \"GetProcAddressA\",         (SYSCALL)GetProcAddress,          0 },\r\n#endif\r\n\r\n#define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \\\r\n        LPCSTR))aSyscall[27].pCurrent)\r\n\r\n  { \"GetSystemInfo\",           (SYSCALL)GetSystemInfo,           0 },\r\n\r\n#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)\r\n\r\n  { \"GetSystemTime\",           (SYSCALL)GetSystemTime,           0 },\r\n\r\n#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE\r\n  { \"GetSystemTimeAsFileTime\", (SYSCALL)GetSystemTimeAsFileTime, 0 },\r\n#else\r\n  { \"GetSystemTimeAsFileTime\", (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \\\r\n        LPFILETIME))aSyscall[30].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"GetTempPathA\",            (SYSCALL)GetTempPathA,            0 },\r\n#else\r\n  { \"GetTempPathA\",            (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"GetTempPathW\",            (SYSCALL)GetTempPathW,            0 },\r\n#else\r\n  { \"GetTempPathW\",            (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)\r\n\r\n  { \"GetTickCount\",            (SYSCALL)GetTickCount,            0 },\r\n\r\n#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"GetVersionExA\",           (SYSCALL)GetVersionExA,           0 },\r\n#else\r\n  { \"GetVersionExA\",           (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osGetVersionExA ((BOOL(WINAPI*)( \\\r\n        LPOSVERSIONINFOA))aSyscall[34].pCurrent)\r\n\r\n  { \"HeapAlloc\",               (SYSCALL)HeapAlloc,               0 },\r\n\r\n#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \\\r\n        SIZE_T))aSyscall[35].pCurrent)\r\n\r\n  { \"HeapCreate\",              (SYSCALL)HeapCreate,              0 },\r\n\r\n#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \\\r\n        SIZE_T))aSyscall[36].pCurrent)\r\n\r\n  { \"HeapDestroy\",             (SYSCALL)HeapDestroy,             0 },\r\n\r\n#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[37].pCurrent)\r\n\r\n  { \"HeapFree\",                (SYSCALL)HeapFree,                0 },\r\n\r\n#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[38].pCurrent)\r\n\r\n  { \"HeapReAlloc\",             (SYSCALL)HeapReAlloc,             0 },\r\n\r\n#define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \\\r\n        SIZE_T))aSyscall[39].pCurrent)\r\n\r\n  { \"HeapSize\",                (SYSCALL)HeapSize,                0 },\r\n\r\n#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \\\r\n        LPCVOID))aSyscall[40].pCurrent)\r\n\r\n  { \"HeapValidate\",            (SYSCALL)HeapValidate,            0 },\r\n\r\n#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \\\r\n        LPCVOID))aSyscall[41].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_ANSI)\r\n  { \"LoadLibraryA\",            (SYSCALL)LoadLibraryA,            0 },\r\n#else\r\n  { \"LoadLibraryA\",            (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[42].pCurrent)\r\n\r\n#if defined(SQLITE_WIN32_HAS_WIDE)\r\n  { \"LoadLibraryW\",            (SYSCALL)LoadLibraryW,            0 },\r\n#else\r\n  { \"LoadLibraryW\",            (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[43].pCurrent)\r\n\r\n  { \"LocalFree\",               (SYSCALL)LocalFree,               0 },\r\n\r\n#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[44].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE\r\n  { \"LockFile\",                (SYSCALL)LockFile,                0 },\r\n\r\n#define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \\\r\n        DWORD))aSyscall[45].pCurrent)\r\n#else\r\n  { \"LockFile\",                (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#if !SQLITE_OS_WINCE\r\n  { \"LockFileEx\",              (SYSCALL)LockFileEx,              0 },\r\n\r\n#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \\\r\n        LPOVERLAPPED))aSyscall[46].pCurrent)\r\n#else\r\n  { \"LockFileEx\",              (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n  { \"MapViewOfFile\",           (SYSCALL)MapViewOfFile,           0 },\r\n\r\n#define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \\\r\n        SIZE_T))aSyscall[47].pCurrent)\r\n\r\n  { \"MultiByteToWideChar\",     (SYSCALL)MultiByteToWideChar,     0 },\r\n\r\n#define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \\\r\n        int))aSyscall[48].pCurrent)\r\n\r\n  { \"QueryPerformanceCounter\", (SYSCALL)QueryPerformanceCounter, 0 },\r\n\r\n#define osQueryPerformanceCounter ((BOOL(WINAPI*)( \\\r\n        LARGE_INTEGER*))aSyscall[49].pCurrent)\r\n\r\n  { \"ReadFile\",                (SYSCALL)ReadFile,                0 },\r\n\r\n#define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \\\r\n        LPOVERLAPPED))aSyscall[50].pCurrent)\r\n\r\n  { \"SetEndOfFile\",            (SYSCALL)SetEndOfFile,            0 },\r\n\r\n#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[51].pCurrent)\r\n\r\n  { \"SetFilePointer\",          (SYSCALL)SetFilePointer,          0 },\r\n\r\n#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \\\r\n        DWORD))aSyscall[52].pCurrent)\r\n\r\n  { \"Sleep\",                   (SYSCALL)Sleep,                   0 },\r\n\r\n#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[53].pCurrent)\r\n\r\n  { \"SystemTimeToFileTime\",    (SYSCALL)SystemTimeToFileTime,    0 },\r\n\r\n#define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \\\r\n        LPFILETIME))aSyscall[54].pCurrent)\r\n\r\n#if !SQLITE_OS_WINCE\r\n  { \"UnlockFile\",              (SYSCALL)UnlockFile,              0 },\r\n\r\n#define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \\\r\n        DWORD))aSyscall[55].pCurrent)\r\n#else\r\n  { \"UnlockFile\",              (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n#if !SQLITE_OS_WINCE\r\n  { \"UnlockFileEx\",            (SYSCALL)UnlockFileEx,            0 },\r\n\r\n#define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \\\r\n        LPOVERLAPPED))aSyscall[56].pCurrent)\r\n#else\r\n  { \"UnlockFileEx\",            (SYSCALL)0,                       0 },\r\n#endif\r\n\r\n  { \"UnmapViewOfFile\",         (SYSCALL)UnmapViewOfFile,         0 },\r\n\r\n#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[57].pCurrent)\r\n\r\n  { \"WideCharToMultiByte\",     (SYSCALL)WideCharToMultiByte,     0 },\r\n\r\n#define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \\\r\n        LPCSTR,LPBOOL))aSyscall[58].pCurrent)\r\n\r\n  { \"WriteFile\",               (SYSCALL)WriteFile,               0 },\r\n\r\n#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \\\r\n        LPOVERLAPPED))aSyscall[59].pCurrent)\r\n\r\n}; /* End of the overrideable system calls */\r\n\r\n/*\r\n** This is the xSetSystemCall() method of sqlite3_vfs for all of the\r\n** \"win32\" VFSes.  Return SQLITE_OK opon successfully updating the\r\n** system call pointer, or SQLITE_NOTFOUND if there is no configurable\r\n** system call named zName.\r\n*/\r\nstatic int winSetSystemCall(\r\n  sqlite3_vfs *pNotUsed,        /* The VFS pointer.  Not used */\r\n  const char *zName,            /* Name of system call to override */\r\n  sqlite3_syscall_ptr pNewFunc  /* Pointer to new system call value */\r\n){\r\n  unsigned int i;\r\n  int rc = SQLITE_NOTFOUND;\r\n\r\n  UNUSED_PARAMETER(pNotUsed);\r\n  if( zName==0 ){\r\n    /* If no zName is given, restore all system calls to their default\r\n    ** settings and return NULL\r\n    */\r\n    rc = SQLITE_OK;\r\n    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\r\n      if( aSyscall[i].pDefault ){\r\n        aSyscall[i].pCurrent = aSyscall[i].pDefault;\r\n      }\r\n    }\r\n  }else{\r\n    /* If zName is specified, operate on only the one system call\r\n    ** specified.\r\n    */\r\n    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\r\n      if( strcmp(zName, aSyscall[i].zName)==0 ){\r\n        if( aSyscall[i].pDefault==0 ){\r\n          aSyscall[i].pDefault = aSyscall[i].pCurrent;\r\n        }\r\n        rc = SQLITE_OK;\r\n        if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;\r\n        aSyscall[i].pCurrent = pNewFunc;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the value of a system call.  Return NULL if zName is not a\r\n** recognized system call name.  NULL is also returned if the system call\r\n** is currently undefined.\r\n*/\r\nstatic sqlite3_syscall_ptr winGetSystemCall(\r\n  sqlite3_vfs *pNotUsed,\r\n  const char *zName\r\n){\r\n  unsigned int i;\r\n\r\n  UNUSED_PARAMETER(pNotUsed);\r\n  for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\r\n    if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return the name of the first system call after zName.  If zName==NULL\r\n** then return the name of the first system call.  Return NULL if zName\r\n** is the last system call or if zName is not the name of a valid\r\n** system call.\r\n*/\r\nstatic const char *winNextSystemCall(sqlite3_vfs *p, const char *zName){\r\n  int i = -1;\r\n\r\n  UNUSED_PARAMETER(p);\r\n  if( zName ){\r\n    for(i=0; i<ArraySize(aSyscall)-1; i++){\r\n      if( strcmp(zName, aSyscall[i].zName)==0 ) break;\r\n    }\r\n  }\r\n  for(i++; i<ArraySize(aSyscall); i++){\r\n    if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,\r\n** or WinCE.  Return false (zero) for Win95, Win98, or WinME.\r\n**\r\n** Here is an interesting observation:  Win95, Win98, and WinME lack\r\n** the LockFileEx() API.  But we can still statically link against that\r\n** API as long as we don't call it when running Win95/98/ME.  A call to\r\n** this routine is used to determine if the host is Win95/98/ME or\r\n** WinNT/2K/XP so that we will know whether or not we can safely call\r\n** the LockFileEx() API.\r\n*/\r\n#if SQLITE_OS_WINCE\r\n# define isNT()  (1)\r\n#else\r\n  static int isNT(void){\r\n    if( sqlite3_os_type==0 ){\r\n      OSVERSIONINFOA sInfo;\r\n      sInfo.dwOSVersionInfoSize = sizeof(sInfo);\r\n      osGetVersionExA(&sInfo);\r\n      sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;\r\n    }\r\n    return sqlite3_os_type==2;\r\n  }\r\n#endif /* SQLITE_OS_WINCE */\r\n\r\n#ifdef SQLITE_WIN32_MALLOC\r\n/*\r\n** Allocate nBytes of memory.\r\n*/\r\nstatic void *winMemMalloc(int nBytes){\r\n  HANDLE hHeap;\r\n  void *p;\r\n\r\n  winMemAssertMagic();\r\n  hHeap = winMemGetHeap();\r\n  assert( hHeap!=0 );\r\n  assert( hHeap!=INVALID_HANDLE_VALUE );\r\n#ifdef SQLITE_WIN32_MALLOC_VALIDATE\r\n  assert ( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );\r\n#endif\r\n  assert( nBytes>=0 );\r\n  p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);\r\n  if( !p ){\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to HeapAlloc %u bytes (%d), heap=%p\",\r\n                nBytes, osGetLastError(), (void*)hHeap);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Free memory.\r\n*/\r\nstatic void winMemFree(void *pPrior){\r\n  HANDLE hHeap;\r\n\r\n  winMemAssertMagic();\r\n  hHeap = winMemGetHeap();\r\n  assert( hHeap!=0 );\r\n  assert( hHeap!=INVALID_HANDLE_VALUE );\r\n#ifdef SQLITE_WIN32_MALLOC_VALIDATE\r\n  assert ( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );\r\n#endif\r\n  if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */\r\n  if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to HeapFree block %p (%d), heap=%p\",\r\n                pPrior, osGetLastError(), (void*)hHeap);\r\n  }\r\n}\r\n\r\n/*\r\n** Change the size of an existing memory allocation\r\n*/\r\nstatic void *winMemRealloc(void *pPrior, int nBytes){\r\n  HANDLE hHeap;\r\n  void *p;\r\n\r\n  winMemAssertMagic();\r\n  hHeap = winMemGetHeap();\r\n  assert( hHeap!=0 );\r\n  assert( hHeap!=INVALID_HANDLE_VALUE );\r\n#ifdef SQLITE_WIN32_MALLOC_VALIDATE\r\n  assert ( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );\r\n#endif\r\n  assert( nBytes>=0 );\r\n  if( !pPrior ){\r\n    p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);\r\n  }else{\r\n    p = osHeapReAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior, (SIZE_T)nBytes);\r\n  }\r\n  if( !p ){\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to %s %u bytes (%d), heap=%p\",\r\n                pPrior ? \"HeapReAlloc\" : \"HeapAlloc\", nBytes, osGetLastError(),\r\n                (void*)hHeap);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Return the size of an outstanding allocation, in bytes.\r\n*/\r\nstatic int winMemSize(void *p){\r\n  HANDLE hHeap;\r\n  SIZE_T n;\r\n\r\n  winMemAssertMagic();\r\n  hHeap = winMemGetHeap();\r\n  assert( hHeap!=0 );\r\n  assert( hHeap!=INVALID_HANDLE_VALUE );\r\n#ifdef SQLITE_WIN32_MALLOC_VALIDATE\r\n  assert ( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );\r\n#endif\r\n  if( !p ) return 0;\r\n  n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);\r\n  if( n==(SIZE_T)-1 ){\r\n    sqlite3_log(SQLITE_NOMEM, \"failed to HeapSize block %p (%d), heap=%p\",\r\n                p, osGetLastError(), (void*)hHeap);\r\n    return 0;\r\n  }\r\n  return (int)n;\r\n}\r\n\r\n/*\r\n** Round up a request size to the next valid allocation size.\r\n*/\r\nstatic int winMemRoundup(int n){\r\n  return n;\r\n}\r\n\r\n/*\r\n** Initialize this module.\r\n*/\r\nstatic int winMemInit(void *pAppData){\r\n  winMemData *pWinMemData = (winMemData *)pAppData;\r\n\r\n  if( !pWinMemData ) return SQLITE_ERROR;\r\n  assert( pWinMemData->magic==WINMEM_MAGIC );\r\n  if( !pWinMemData->hHeap ){\r\n    pWinMemData->hHeap = osHeapCreate(SQLITE_WIN32_HEAP_FLAGS,\r\n                                      SQLITE_WIN32_HEAP_INIT_SIZE,\r\n                                      SQLITE_WIN32_HEAP_MAX_SIZE);\r\n    if( !pWinMemData->hHeap ){\r\n      sqlite3_log(SQLITE_NOMEM,\r\n          \"failed to HeapCreate (%d), flags=%u, initSize=%u, maxSize=%u\",\r\n          osGetLastError(), SQLITE_WIN32_HEAP_FLAGS,\r\n          SQLITE_WIN32_HEAP_INIT_SIZE, SQLITE_WIN32_HEAP_MAX_SIZE);\r\n      return SQLITE_NOMEM;\r\n    }\r\n    pWinMemData->bOwned = TRUE;\r\n  }\r\n  assert( pWinMemData->hHeap!=0 );\r\n  assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );\r\n#ifdef SQLITE_WIN32_MALLOC_VALIDATE\r\n  assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );\r\n#endif\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Deinitialize this module.\r\n*/\r\nstatic void winMemShutdown(void *pAppData){\r\n  winMemData *pWinMemData = (winMemData *)pAppData;\r\n\r\n  if( !pWinMemData ) return;\r\n  if( pWinMemData->hHeap ){\r\n    assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );\r\n#ifdef SQLITE_WIN32_MALLOC_VALIDATE\r\n    assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );\r\n#endif\r\n    if( pWinMemData->bOwned ){\r\n      if( !osHeapDestroy(pWinMemData->hHeap) ){\r\n        sqlite3_log(SQLITE_NOMEM, \"failed to HeapDestroy (%d), heap=%p\",\r\n                    osGetLastError(), (void*)pWinMemData->hHeap);\r\n      }\r\n      pWinMemData->bOwned = FALSE;\r\n    }\r\n    pWinMemData->hHeap = NULL;\r\n  }\r\n}\r\n\r\n/*\r\n** Populate the low-level memory allocation function pointers in\r\n** sqlite3GlobalConfig.m with pointers to the routines in this file. The\r\n** arguments specify the block of memory to manage.\r\n**\r\n** This routine is only called by sqlite3_config(), and therefore\r\n** is not required to be threadsafe (it is not).\r\n*/\r\nSQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void){\r\n  static const sqlite3_mem_methods winMemMethods = {\r\n    winMemMalloc,\r\n    winMemFree,\r\n    winMemRealloc,\r\n    winMemSize,\r\n    winMemRoundup,\r\n    winMemInit,\r\n    winMemShutdown,\r\n    &win_mem_data\r\n  };\r\n  return &winMemMethods;\r\n}\r\n\r\nSQLITE_PRIVATE void sqlite3MemSetDefault(void){\r\n  sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetWin32());\r\n}\r\n#endif /* SQLITE_WIN32_MALLOC */\r\n\r\n/*\r\n** Convert a UTF-8 string to Microsoft Unicode (UTF-16?). \r\n**\r\n** Space to hold the returned string is obtained from malloc.\r\n*/\r\nstatic LPWSTR utf8ToUnicode(const char *zFilename){\r\n  int nChar;\r\n  LPWSTR zWideFilename;\r\n\r\n  nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);\r\n  if( nChar==0 ){\r\n    return 0;\r\n  }\r\n  zWideFilename = sqlite3_malloc( nChar*sizeof(zWideFilename[0]) );\r\n  if( zWideFilename==0 ){\r\n    return 0;\r\n  }\r\n  nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename,\r\n                                nChar);\r\n  if( nChar==0 ){\r\n    sqlite3_free(zWideFilename);\r\n    zWideFilename = 0;\r\n  }\r\n  return zWideFilename;\r\n}\r\n\r\n/*\r\n** Convert Microsoft Unicode to UTF-8.  Space to hold the returned string is\r\n** obtained from sqlite3_malloc().\r\n*/\r\nstatic char *unicodeToUtf8(LPCWSTR zWideFilename){\r\n  int nByte;\r\n  char *zFilename;\r\n\r\n  nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0);\r\n  if( nByte == 0 ){\r\n    return 0;\r\n  }\r\n  zFilename = sqlite3_malloc( nByte );\r\n  if( zFilename==0 ){\r\n    return 0;\r\n  }\r\n  nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte,\r\n                                0, 0);\r\n  if( nByte == 0 ){\r\n    sqlite3_free(zFilename);\r\n    zFilename = 0;\r\n  }\r\n  return zFilename;\r\n}\r\n\r\n/*\r\n** Convert an ANSI string to Microsoft Unicode, based on the\r\n** current codepage settings for file apis.\r\n** \r\n** Space to hold the returned string is obtained\r\n** from sqlite3_malloc.\r\n*/\r\nstatic LPWSTR mbcsToUnicode(const char *zFilename){\r\n  int nByte;\r\n  LPWSTR zMbcsFilename;\r\n  int codepage = osAreFileApisANSI() ? CP_ACP : CP_OEMCP;\r\n\r\n  nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, NULL,\r\n                                0)*sizeof(WCHAR);\r\n  if( nByte==0 ){\r\n    return 0;\r\n  }\r\n  zMbcsFilename = sqlite3_malloc( nByte*sizeof(zMbcsFilename[0]) );\r\n  if( zMbcsFilename==0 ){\r\n    return 0;\r\n  }\r\n  nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename,\r\n                                nByte);\r\n  if( nByte==0 ){\r\n    sqlite3_free(zMbcsFilename);\r\n    zMbcsFilename = 0;\r\n  }\r\n  return zMbcsFilename;\r\n}\r\n\r\n/*\r\n** Convert Microsoft Unicode to multi-byte character string, based on the\r\n** user's ANSI codepage.\r\n**\r\n** Space to hold the returned string is obtained from\r\n** sqlite3_malloc().\r\n*/\r\nstatic char *unicodeToMbcs(LPCWSTR zWideFilename){\r\n  int nByte;\r\n  char *zFilename;\r\n  int codepage = osAreFileApisANSI() ? CP_ACP : CP_OEMCP;\r\n\r\n  nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0);\r\n  if( nByte == 0 ){\r\n    return 0;\r\n  }\r\n  zFilename = sqlite3_malloc( nByte );\r\n  if( zFilename==0 ){\r\n    return 0;\r\n  }\r\n  nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename,\r\n                                nByte, 0, 0);\r\n  if( nByte == 0 ){\r\n    sqlite3_free(zFilename);\r\n    zFilename = 0;\r\n  }\r\n  return zFilename;\r\n}\r\n\r\n/*\r\n** Convert multibyte character string to UTF-8.  Space to hold the\r\n** returned string is obtained from sqlite3_malloc().\r\n*/\r\nSQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zFilename){\r\n  char *zFilenameUtf8;\r\n  LPWSTR zTmpWide;\r\n\r\n  zTmpWide = mbcsToUnicode(zFilename);\r\n  if( zTmpWide==0 ){\r\n    return 0;\r\n  }\r\n  zFilenameUtf8 = unicodeToUtf8(zTmpWide);\r\n  sqlite3_free(zTmpWide);\r\n  return zFilenameUtf8;\r\n}\r\n\r\n/*\r\n** Convert UTF-8 to multibyte character string.  Space to hold the \r\n** returned string is obtained from sqlite3_malloc().\r\n*/\r\nSQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zFilename){\r\n  char *zFilenameMbcs;\r\n  LPWSTR zTmpWide;\r\n\r\n  zTmpWide = utf8ToUnicode(zFilename);\r\n  if( zTmpWide==0 ){\r\n    return 0;\r\n  }\r\n  zFilenameMbcs = unicodeToMbcs(zTmpWide);\r\n  sqlite3_free(zTmpWide);\r\n  return zFilenameMbcs;\r\n}\r\n\r\n\r\n/*\r\n** The return value of getLastErrorMsg\r\n** is zero if the error message fits in the buffer, or non-zero\r\n** otherwise (if the message was truncated).\r\n*/\r\nstatic int getLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){\r\n  /* FormatMessage returns 0 on failure.  Otherwise it\r\n  ** returns the number of TCHARs written to the output\r\n  ** buffer, excluding the terminating null char.\r\n  */\r\n  DWORD dwLen = 0;\r\n  char *zOut = 0;\r\n\r\n  if( isNT() ){\r\n    LPWSTR zTempWide = NULL;\r\n    dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |\r\n                             FORMAT_MESSAGE_FROM_SYSTEM |\r\n                             FORMAT_MESSAGE_IGNORE_INSERTS,\r\n                             NULL,\r\n                             lastErrno,\r\n                             0,\r\n                             (LPWSTR) &zTempWide,\r\n                             0,\r\n                             0);\r\n    if( dwLen > 0 ){\r\n      /* allocate a buffer and convert to UTF8 */\r\n      sqlite3BeginBenignMalloc();\r\n      zOut = unicodeToUtf8(zTempWide);\r\n      sqlite3EndBenignMalloc();\r\n      /* free the system buffer allocated by FormatMessage */\r\n      osLocalFree(zTempWide);\r\n    }\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    char *zTemp = NULL;\r\n    dwLen = osFormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |\r\n                             FORMAT_MESSAGE_FROM_SYSTEM |\r\n                             FORMAT_MESSAGE_IGNORE_INSERTS,\r\n                             NULL,\r\n                             lastErrno,\r\n                             0,\r\n                             (LPSTR) &zTemp,\r\n                             0,\r\n                             0);\r\n    if( dwLen > 0 ){\r\n      /* allocate a buffer and convert to UTF8 */\r\n      sqlite3BeginBenignMalloc();\r\n      zOut = sqlite3_win32_mbcs_to_utf8(zTemp);\r\n      sqlite3EndBenignMalloc();\r\n      /* free the system buffer allocated by FormatMessage */\r\n      osLocalFree(zTemp);\r\n    }\r\n#endif\r\n  }\r\n  if( 0 == dwLen ){\r\n    sqlite3_snprintf(nBuf, zBuf, \"OsError 0x%x (%u)\", lastErrno, lastErrno);\r\n  }else{\r\n    /* copy a maximum of nBuf chars to output buffer */\r\n    sqlite3_snprintf(nBuf, zBuf, \"%s\", zOut);\r\n    /* free the UTF8 buffer */\r\n    sqlite3_free(zOut);\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n**\r\n** This function - winLogErrorAtLine() - is only ever called via the macro\r\n** winLogError().\r\n**\r\n** This routine is invoked after an error occurs in an OS function.\r\n** It logs a message using sqlite3_log() containing the current value of\r\n** error code and, if possible, the human-readable equivalent from \r\n** FormatMessage.\r\n**\r\n** The first argument passed to the macro should be the error code that\r\n** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). \r\n** The two subsequent arguments should be the name of the OS function that\r\n** failed and the the associated file-system path, if any.\r\n*/\r\n#define winLogError(a,b,c,d)   winLogErrorAtLine(a,b,c,d,__LINE__)\r\nstatic int winLogErrorAtLine(\r\n  int errcode,                    /* SQLite error code */\r\n  DWORD lastErrno,                /* Win32 last error */\r\n  const char *zFunc,              /* Name of OS function that failed */\r\n  const char *zPath,              /* File path associated with error */\r\n  int iLine                       /* Source line number where error occurred */\r\n){\r\n  char zMsg[500];                 /* Human readable error text */\r\n  int i;                          /* Loop counter */\r\n\r\n  zMsg[0] = 0;\r\n  getLastErrorMsg(lastErrno, sizeof(zMsg), zMsg);\r\n  assert( errcode!=SQLITE_OK );\r\n  if( zPath==0 ) zPath = \"\";\r\n  for(i=0; zMsg[i] && zMsg[i]!='\\r' && zMsg[i]!='\\n'; i++){}\r\n  zMsg[i] = 0;\r\n  sqlite3_log(errcode,\r\n      \"os_win.c:%d: (%d) %s(%s) - %s\",\r\n      iLine, lastErrno, zFunc, zPath, zMsg\r\n  );\r\n\r\n  return errcode;\r\n}\r\n\r\n/*\r\n** The number of times that a ReadFile(), WriteFile(), and DeleteFile()\r\n** will be retried following a locking error - probably caused by \r\n** antivirus software.  Also the initial delay before the first retry.\r\n** The delay increases linearly with each retry.\r\n*/\r\n#ifndef SQLITE_WIN32_IOERR_RETRY\r\n# define SQLITE_WIN32_IOERR_RETRY 10\r\n#endif\r\n#ifndef SQLITE_WIN32_IOERR_RETRY_DELAY\r\n# define SQLITE_WIN32_IOERR_RETRY_DELAY 25\r\n#endif\r\nstatic int win32IoerrRetry = SQLITE_WIN32_IOERR_RETRY;\r\nstatic int win32IoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY;\r\n\r\n/*\r\n** If a ReadFile() or WriteFile() error occurs, invoke this routine\r\n** to see if it should be retried.  Return TRUE to retry.  Return FALSE\r\n** to give up with an error.\r\n*/\r\nstatic int retryIoerr(int *pnRetry, DWORD *pError){\r\n  DWORD e = osGetLastError();\r\n  if( *pnRetry>=win32IoerrRetry ){\r\n    if( pError ){\r\n      *pError = e;\r\n    }\r\n    return 0;\r\n  }\r\n  if( e==ERROR_ACCESS_DENIED ||\r\n      e==ERROR_LOCK_VIOLATION ||\r\n      e==ERROR_SHARING_VIOLATION ){\r\n    osSleep(win32IoerrRetryDelay*(1+*pnRetry));\r\n    ++*pnRetry;\r\n    return 1;\r\n  }\r\n  if( pError ){\r\n    *pError = e;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Log a I/O error retry episode.\r\n*/\r\nstatic void logIoerr(int nRetry){\r\n  if( nRetry ){\r\n    sqlite3_log(SQLITE_IOERR, \r\n      \"delayed %dms for lock/sharing conflict\",\r\n      win32IoerrRetryDelay*nRetry*(nRetry+1)/2\r\n    );\r\n  }\r\n}\r\n\r\n#if SQLITE_OS_WINCE\r\n/*************************************************************************\r\n** This section contains code for WinCE only.\r\n*/\r\n/*\r\n** Windows CE does not have a localtime() function.  So create a\r\n** substitute.\r\n*/\r\n/* #include <time.h> */\r\nstruct tm *__cdecl localtime(const time_t *t)\r\n{\r\n  static struct tm y;\r\n  FILETIME uTm, lTm;\r\n  SYSTEMTIME pTm;\r\n  sqlite3_int64 t64;\r\n  t64 = *t;\r\n  t64 = (t64 + 11644473600)*10000000;\r\n  uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF);\r\n  uTm.dwHighDateTime= (DWORD)(t64 >> 32);\r\n  osFileTimeToLocalFileTime(&uTm,&lTm);\r\n  osFileTimeToSystemTime(&lTm,&pTm);\r\n  y.tm_year = pTm.wYear - 1900;\r\n  y.tm_mon = pTm.wMonth - 1;\r\n  y.tm_wday = pTm.wDayOfWeek;\r\n  y.tm_mday = pTm.wDay;\r\n  y.tm_hour = pTm.wHour;\r\n  y.tm_min = pTm.wMinute;\r\n  y.tm_sec = pTm.wSecond;\r\n  return &y;\r\n}\r\n\r\n#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)]\r\n\r\n/*\r\n** Acquire a lock on the handle h\r\n*/\r\nstatic void winceMutexAcquire(HANDLE h){\r\n   DWORD dwErr;\r\n   do {\r\n     dwErr = WaitForSingleObject(h, INFINITE);\r\n   } while (dwErr != WAIT_OBJECT_0 && dwErr != WAIT_ABANDONED);\r\n}\r\n/*\r\n** Release a lock acquired by winceMutexAcquire()\r\n*/\r\n#define winceMutexRelease(h) ReleaseMutex(h)\r\n\r\n/*\r\n** Create the mutex and shared memory used for locking in the file\r\n** descriptor pFile\r\n*/\r\nstatic BOOL winceCreateLock(const char *zFilename, winFile *pFile){\r\n  LPWSTR zTok;\r\n  LPWSTR zName;\r\n  BOOL bInit = TRUE;\r\n\r\n  zName = utf8ToUnicode(zFilename);\r\n  if( zName==0 ){\r\n    /* out of memory */\r\n    return FALSE;\r\n  }\r\n\r\n  /* Initialize the local lockdata */\r\n  memset(&pFile->local, 0, sizeof(pFile->local));\r\n\r\n  /* Replace the backslashes from the filename and lowercase it\r\n  ** to derive a mutex name. */\r\n  zTok = osCharLowerW(zName);\r\n  for (;*zTok;zTok++){\r\n    if (*zTok == '\\\\') *zTok = '_';\r\n  }\r\n\r\n  /* Create/open the named mutex */\r\n  pFile->hMutex = osCreateMutexW(NULL, FALSE, zName);\r\n  if (!pFile->hMutex){\r\n    pFile->lastErrno = osGetLastError();\r\n    winLogError(SQLITE_ERROR, pFile->lastErrno, \"winceCreateLock1\", zFilename);\r\n    sqlite3_free(zName);\r\n    return FALSE;\r\n  }\r\n\r\n  /* Acquire the mutex before continuing */\r\n  winceMutexAcquire(pFile->hMutex);\r\n  \r\n  /* Since the names of named mutexes, semaphores, file mappings etc are \r\n  ** case-sensitive, take advantage of that by uppercasing the mutex name\r\n  ** and using that as the shared filemapping name.\r\n  */\r\n  osCharUpperW(zName);\r\n  pFile->hShared = osCreateFileMappingW(INVALID_HANDLE_VALUE, NULL,\r\n                                        PAGE_READWRITE, 0, sizeof(winceLock),\r\n                                        zName);  \r\n\r\n  /* Set a flag that indicates we're the first to create the memory so it \r\n  ** must be zero-initialized */\r\n  if (osGetLastError() == ERROR_ALREADY_EXISTS){\r\n    bInit = FALSE;\r\n  }\r\n\r\n  sqlite3_free(zName);\r\n\r\n  /* If we succeeded in making the shared memory handle, map it. */\r\n  if (pFile->hShared){\r\n    pFile->shared = (winceLock*)osMapViewOfFile(pFile->hShared, \r\n             FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(winceLock));\r\n    /* If mapping failed, close the shared memory handle and erase it */\r\n    if (!pFile->shared){\r\n      pFile->lastErrno = osGetLastError();\r\n      winLogError(SQLITE_ERROR, pFile->lastErrno,\r\n               \"winceCreateLock2\", zFilename);\r\n      osCloseHandle(pFile->hShared);\r\n      pFile->hShared = NULL;\r\n    }\r\n  }\r\n\r\n  /* If shared memory could not be created, then close the mutex and fail */\r\n  if (pFile->hShared == NULL){\r\n    winceMutexRelease(pFile->hMutex);\r\n    osCloseHandle(pFile->hMutex);\r\n    pFile->hMutex = NULL;\r\n    return FALSE;\r\n  }\r\n  \r\n  /* Initialize the shared memory if we're supposed to */\r\n  if (bInit) {\r\n    memset(pFile->shared, 0, sizeof(winceLock));\r\n  }\r\n\r\n  winceMutexRelease(pFile->hMutex);\r\n  return TRUE;\r\n}\r\n\r\n/*\r\n** Destroy the part of winFile that deals with wince locks\r\n*/\r\nstatic void winceDestroyLock(winFile *pFile){\r\n  if (pFile->hMutex){\r\n    /* Acquire the mutex */\r\n    winceMutexAcquire(pFile->hMutex);\r\n\r\n    /* The following blocks should probably assert in debug mode, but they\r\n       are to cleanup in case any locks remained open */\r\n    if (pFile->local.nReaders){\r\n      pFile->shared->nReaders --;\r\n    }\r\n    if (pFile->local.bReserved){\r\n      pFile->shared->bReserved = FALSE;\r\n    }\r\n    if (pFile->local.bPending){\r\n      pFile->shared->bPending = FALSE;\r\n    }\r\n    if (pFile->local.bExclusive){\r\n      pFile->shared->bExclusive = FALSE;\r\n    }\r\n\r\n    /* De-reference and close our copy of the shared memory handle */\r\n    osUnmapViewOfFile(pFile->shared);\r\n    osCloseHandle(pFile->hShared);\r\n\r\n    /* Done with the mutex */\r\n    winceMutexRelease(pFile->hMutex);    \r\n    osCloseHandle(pFile->hMutex);\r\n    pFile->hMutex = NULL;\r\n  }\r\n}\r\n\r\n/* \r\n** An implementation of the LockFile() API of Windows for CE\r\n*/\r\nstatic BOOL winceLockFile(\r\n  HANDLE *phFile,\r\n  DWORD dwFileOffsetLow,\r\n  DWORD dwFileOffsetHigh,\r\n  DWORD nNumberOfBytesToLockLow,\r\n  DWORD nNumberOfBytesToLockHigh\r\n){\r\n  winFile *pFile = HANDLE_TO_WINFILE(phFile);\r\n  BOOL bReturn = FALSE;\r\n\r\n  UNUSED_PARAMETER(dwFileOffsetHigh);\r\n  UNUSED_PARAMETER(nNumberOfBytesToLockHigh);\r\n\r\n  if (!pFile->hMutex) return TRUE;\r\n  winceMutexAcquire(pFile->hMutex);\r\n\r\n  /* Wanting an exclusive lock? */\r\n  if (dwFileOffsetLow == (DWORD)SHARED_FIRST\r\n       && nNumberOfBytesToLockLow == (DWORD)SHARED_SIZE){\r\n    if (pFile->shared->nReaders == 0 && pFile->shared->bExclusive == 0){\r\n       pFile->shared->bExclusive = TRUE;\r\n       pFile->local.bExclusive = TRUE;\r\n       bReturn = TRUE;\r\n    }\r\n  }\r\n\r\n  /* Want a read-only lock? */\r\n  else if (dwFileOffsetLow == (DWORD)SHARED_FIRST &&\r\n           nNumberOfBytesToLockLow == 1){\r\n    if (pFile->shared->bExclusive == 0){\r\n      pFile->local.nReaders ++;\r\n      if (pFile->local.nReaders == 1){\r\n        pFile->shared->nReaders ++;\r\n      }\r\n      bReturn = TRUE;\r\n    }\r\n  }\r\n\r\n  /* Want a pending lock? */\r\n  else if (dwFileOffsetLow == (DWORD)PENDING_BYTE && nNumberOfBytesToLockLow == 1){\r\n    /* If no pending lock has been acquired, then acquire it */\r\n    if (pFile->shared->bPending == 0) {\r\n      pFile->shared->bPending = TRUE;\r\n      pFile->local.bPending = TRUE;\r\n      bReturn = TRUE;\r\n    }\r\n  }\r\n\r\n  /* Want a reserved lock? */\r\n  else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE && nNumberOfBytesToLockLow == 1){\r\n    if (pFile->shared->bReserved == 0) {\r\n      pFile->shared->bReserved = TRUE;\r\n      pFile->local.bReserved = TRUE;\r\n      bReturn = TRUE;\r\n    }\r\n  }\r\n\r\n  winceMutexRelease(pFile->hMutex);\r\n  return bReturn;\r\n}\r\n\r\n/*\r\n** An implementation of the UnlockFile API of Windows for CE\r\n*/\r\nstatic BOOL winceUnlockFile(\r\n  HANDLE *phFile,\r\n  DWORD dwFileOffsetLow,\r\n  DWORD dwFileOffsetHigh,\r\n  DWORD nNumberOfBytesToUnlockLow,\r\n  DWORD nNumberOfBytesToUnlockHigh\r\n){\r\n  winFile *pFile = HANDLE_TO_WINFILE(phFile);\r\n  BOOL bReturn = FALSE;\r\n\r\n  UNUSED_PARAMETER(dwFileOffsetHigh);\r\n  UNUSED_PARAMETER(nNumberOfBytesToUnlockHigh);\r\n\r\n  if (!pFile->hMutex) return TRUE;\r\n  winceMutexAcquire(pFile->hMutex);\r\n\r\n  /* Releasing a reader lock or an exclusive lock */\r\n  if (dwFileOffsetLow == (DWORD)SHARED_FIRST){\r\n    /* Did we have an exclusive lock? */\r\n    if (pFile->local.bExclusive){\r\n      assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE);\r\n      pFile->local.bExclusive = FALSE;\r\n      pFile->shared->bExclusive = FALSE;\r\n      bReturn = TRUE;\r\n    }\r\n\r\n    /* Did we just have a reader lock? */\r\n    else if (pFile->local.nReaders){\r\n      assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE || nNumberOfBytesToUnlockLow == 1);\r\n      pFile->local.nReaders --;\r\n      if (pFile->local.nReaders == 0)\r\n      {\r\n        pFile->shared->nReaders --;\r\n      }\r\n      bReturn = TRUE;\r\n    }\r\n  }\r\n\r\n  /* Releasing a pending lock */\r\n  else if (dwFileOffsetLow == (DWORD)PENDING_BYTE && nNumberOfBytesToUnlockLow == 1){\r\n    if (pFile->local.bPending){\r\n      pFile->local.bPending = FALSE;\r\n      pFile->shared->bPending = FALSE;\r\n      bReturn = TRUE;\r\n    }\r\n  }\r\n  /* Releasing a reserved lock */\r\n  else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE && nNumberOfBytesToUnlockLow == 1){\r\n    if (pFile->local.bReserved) {\r\n      pFile->local.bReserved = FALSE;\r\n      pFile->shared->bReserved = FALSE;\r\n      bReturn = TRUE;\r\n    }\r\n  }\r\n\r\n  winceMutexRelease(pFile->hMutex);\r\n  return bReturn;\r\n}\r\n\r\n/*\r\n** An implementation of the LockFileEx() API of Windows for CE\r\n*/\r\nstatic BOOL winceLockFileEx(\r\n  HANDLE *phFile,\r\n  DWORD dwFlags,\r\n  DWORD dwReserved,\r\n  DWORD nNumberOfBytesToLockLow,\r\n  DWORD nNumberOfBytesToLockHigh,\r\n  LPOVERLAPPED lpOverlapped\r\n){\r\n  UNUSED_PARAMETER(dwReserved);\r\n  UNUSED_PARAMETER(nNumberOfBytesToLockHigh);\r\n\r\n  /* If the caller wants a shared read lock, forward this call\r\n  ** to winceLockFile */\r\n  if (lpOverlapped->Offset == (DWORD)SHARED_FIRST &&\r\n      dwFlags == 1 &&\r\n      nNumberOfBytesToLockLow == (DWORD)SHARED_SIZE){\r\n    return winceLockFile(phFile, SHARED_FIRST, 0, 1, 0);\r\n  }\r\n  return FALSE;\r\n}\r\n/*\r\n** End of the special code for wince\r\n*****************************************************************************/\r\n#endif /* SQLITE_OS_WINCE */\r\n\r\n/*****************************************************************************\r\n** The next group of routines implement the I/O methods specified\r\n** by the sqlite3_io_methods object.\r\n******************************************************************************/\r\n\r\n/*\r\n** Some Microsoft compilers lack this definition.\r\n*/\r\n#ifndef INVALID_SET_FILE_POINTER\r\n# define INVALID_SET_FILE_POINTER ((DWORD)-1)\r\n#endif\r\n\r\n/*\r\n** Move the current position of the file handle passed as the first \r\n** argument to offset iOffset within the file. If successful, return 0. \r\n** Otherwise, set pFile->lastErrno and return non-zero.\r\n*/\r\nstatic int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){\r\n  LONG upperBits;                 /* Most sig. 32 bits of new offset */\r\n  LONG lowerBits;                 /* Least sig. 32 bits of new offset */\r\n  DWORD dwRet;                    /* Value returned by SetFilePointer() */\r\n  DWORD lastErrno;                /* Value returned by GetLastError() */\r\n\r\n  upperBits = (LONG)((iOffset>>32) & 0x7fffffff);\r\n  lowerBits = (LONG)(iOffset & 0xffffffff);\r\n\r\n  /* API oddity: If successful, SetFilePointer() returns a dword \r\n  ** containing the lower 32-bits of the new file-offset. Or, if it fails,\r\n  ** it returns INVALID_SET_FILE_POINTER. However according to MSDN, \r\n  ** INVALID_SET_FILE_POINTER may also be a valid new offset. So to determine \r\n  ** whether an error has actually occured, it is also necessary to call \r\n  ** GetLastError().\r\n  */\r\n  dwRet = osSetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);\r\n\r\n  if( (dwRet==INVALID_SET_FILE_POINTER\r\n      && ((lastErrno = osGetLastError())!=NO_ERROR)) ){\r\n    pFile->lastErrno = lastErrno;\r\n    winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno,\r\n             \"seekWinFile\", pFile->zPath);\r\n    return 1;\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Close a file.\r\n**\r\n** It is reported that an attempt to close a handle might sometimes\r\n** fail.  This is a very unreasonable result, but Windows is notorious\r\n** for being unreasonable so I do not doubt that it might happen.  If\r\n** the close fails, we pause for 100 milliseconds and try again.  As\r\n** many as MX_CLOSE_ATTEMPT attempts to close the handle are made before\r\n** giving up and returning an error.\r\n*/\r\n#define MX_CLOSE_ATTEMPT 3\r\nstatic int winClose(sqlite3_file *id){\r\n  int rc, cnt = 0;\r\n  winFile *pFile = (winFile*)id;\r\n\r\n  assert( id!=0 );\r\n  assert( pFile->pShm==0 );\r\n  OSTRACE((\"CLOSE %d\\n\", pFile->h));\r\n  do{\r\n    rc = osCloseHandle(pFile->h);\r\n    /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */\r\n  }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (osSleep(100), 1) );\r\n#if SQLITE_OS_WINCE\r\n#define WINCE_DELETION_ATTEMPTS 3\r\n  winceDestroyLock(pFile);\r\n  if( pFile->zDeleteOnClose ){\r\n    int cnt = 0;\r\n    while(\r\n           osDeleteFileW(pFile->zDeleteOnClose)==0\r\n        && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff \r\n        && cnt++ < WINCE_DELETION_ATTEMPTS\r\n    ){\r\n       osSleep(100);  /* Wait a little before trying again */\r\n    }\r\n    sqlite3_free(pFile->zDeleteOnClose);\r\n  }\r\n#endif\r\n  OSTRACE((\"CLOSE %d %s\\n\", pFile->h, rc ? \"ok\" : \"failed\"));\r\n  OpenCounter(-1);\r\n  return rc ? SQLITE_OK\r\n            : winLogError(SQLITE_IOERR_CLOSE, osGetLastError(),\r\n                          \"winClose\", pFile->zPath);\r\n}\r\n\r\n/*\r\n** Read data from a file into a buffer.  Return SQLITE_OK if all\r\n** bytes were read successfully and SQLITE_IOERR if anything goes\r\n** wrong.\r\n*/\r\nstatic int winRead(\r\n  sqlite3_file *id,          /* File to read from */\r\n  void *pBuf,                /* Write content into this buffer */\r\n  int amt,                   /* Number of bytes to read */\r\n  sqlite3_int64 offset       /* Begin reading at this offset */\r\n){\r\n  winFile *pFile = (winFile*)id;  /* file handle */\r\n  DWORD nRead;                    /* Number of bytes actually read from file */\r\n  int nRetry = 0;                 /* Number of retrys */\r\n\r\n  assert( id!=0 );\r\n  SimulateIOError(return SQLITE_IOERR_READ);\r\n  OSTRACE((\"READ %d lock=%d\\n\", pFile->h, pFile->locktype));\r\n\r\n  if( seekWinFile(pFile, offset) ){\r\n    return SQLITE_FULL;\r\n  }\r\n  while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){\r\n    DWORD lastErrno;\r\n    if( retryIoerr(&nRetry, &lastErrno) ) continue;\r\n    pFile->lastErrno = lastErrno;\r\n    return winLogError(SQLITE_IOERR_READ, pFile->lastErrno,\r\n             \"winRead\", pFile->zPath);\r\n  }\r\n  logIoerr(nRetry);\r\n  if( nRead<(DWORD)amt ){\r\n    /* Unread parts of the buffer must be zero-filled */\r\n    memset(&((char*)pBuf)[nRead], 0, amt-nRead);\r\n    return SQLITE_IOERR_SHORT_READ;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Write data from a buffer into a file.  Return SQLITE_OK on success\r\n** or some other error code on failure.\r\n*/\r\nstatic int winWrite(\r\n  sqlite3_file *id,               /* File to write into */\r\n  const void *pBuf,               /* The bytes to be written */\r\n  int amt,                        /* Number of bytes to write */\r\n  sqlite3_int64 offset            /* Offset into the file to begin writing at */\r\n){\r\n  int rc;                         /* True if error has occured, else false */\r\n  winFile *pFile = (winFile*)id;  /* File handle */\r\n  int nRetry = 0;                 /* Number of retries */\r\n\r\n  assert( amt>0 );\r\n  assert( pFile );\r\n  SimulateIOError(return SQLITE_IOERR_WRITE);\r\n  SimulateDiskfullError(return SQLITE_FULL);\r\n\r\n  OSTRACE((\"WRITE %d lock=%d\\n\", pFile->h, pFile->locktype));\r\n\r\n  rc = seekWinFile(pFile, offset);\r\n  if( rc==0 ){\r\n    u8 *aRem = (u8 *)pBuf;        /* Data yet to be written */\r\n    int nRem = amt;               /* Number of bytes yet to be written */\r\n    DWORD nWrite;                 /* Bytes written by each WriteFile() call */\r\n    DWORD lastErrno = NO_ERROR;   /* Value returned by GetLastError() */\r\n\r\n    while( nRem>0 ){\r\n      if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){\r\n        if( retryIoerr(&nRetry, &lastErrno) ) continue;\r\n        break;\r\n      }\r\n      if( nWrite<=0 ) break;\r\n      aRem += nWrite;\r\n      nRem -= nWrite;\r\n    }\r\n    if( nRem>0 ){\r\n      pFile->lastErrno = lastErrno;\r\n      rc = 1;\r\n    }\r\n  }\r\n\r\n  if( rc ){\r\n    if(   ( pFile->lastErrno==ERROR_HANDLE_DISK_FULL )\r\n       || ( pFile->lastErrno==ERROR_DISK_FULL )){\r\n      return SQLITE_FULL;\r\n    }\r\n    return winLogError(SQLITE_IOERR_WRITE, pFile->lastErrno,\r\n             \"winWrite\", pFile->zPath);\r\n  }else{\r\n    logIoerr(nRetry);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Truncate an open file to a specified size\r\n*/\r\nstatic int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){\r\n  winFile *pFile = (winFile*)id;  /* File handle object */\r\n  int rc = SQLITE_OK;             /* Return code for this function */\r\n\r\n  assert( pFile );\r\n\r\n  OSTRACE((\"TRUNCATE %d %lld\\n\", pFile->h, nByte));\r\n  SimulateIOError(return SQLITE_IOERR_TRUNCATE);\r\n\r\n  /* If the user has configured a chunk-size for this file, truncate the\r\n  ** file so that it consists of an integer number of chunks (i.e. the\r\n  ** actual file size after the operation may be larger than the requested\r\n  ** size).\r\n  */\r\n  if( pFile->szChunk>0 ){\r\n    nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;\r\n  }\r\n\r\n  /* SetEndOfFile() returns non-zero when successful, or zero when it fails. */\r\n  if( seekWinFile(pFile, nByte) ){\r\n    rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,\r\n             \"winTruncate1\", pFile->zPath);\r\n  }else if( 0==osSetEndOfFile(pFile->h) ){\r\n    pFile->lastErrno = osGetLastError();\r\n    rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,\r\n             \"winTruncate2\", pFile->zPath);\r\n  }\r\n\r\n  OSTRACE((\"TRUNCATE %d %lld %s\\n\", pFile->h, nByte, rc ? \"failed\" : \"ok\"));\r\n  return rc;\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** Count the number of fullsyncs and normal syncs.  This is used to test\r\n** that syncs and fullsyncs are occuring at the right times.\r\n*/\r\nSQLITE_API int sqlite3_sync_count = 0;\r\nSQLITE_API int sqlite3_fullsync_count = 0;\r\n#endif\r\n\r\n/*\r\n** Make sure all writes to a particular file are committed to disk.\r\n*/\r\nstatic int winSync(sqlite3_file *id, int flags){\r\n#ifndef SQLITE_NO_SYNC\r\n  /*\r\n  ** Used only when SQLITE_NO_SYNC is not defined.\r\n   */\r\n  BOOL rc;\r\n#endif\r\n#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || \\\r\n    (defined(SQLITE_TEST) && defined(SQLITE_DEBUG))\r\n  /*\r\n  ** Used when SQLITE_NO_SYNC is not defined and by the assert() and/or\r\n  ** OSTRACE() macros.\r\n   */\r\n  winFile *pFile = (winFile*)id;\r\n#else\r\n  UNUSED_PARAMETER(id);\r\n#endif\r\n\r\n  assert( pFile );\r\n  /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */\r\n  assert((flags&0x0F)==SQLITE_SYNC_NORMAL\r\n      || (flags&0x0F)==SQLITE_SYNC_FULL\r\n  );\r\n\r\n  OSTRACE((\"SYNC %d lock=%d\\n\", pFile->h, pFile->locktype));\r\n\r\n  /* Unix cannot, but some systems may return SQLITE_FULL from here. This\r\n  ** line is to test that doing so does not cause any problems.\r\n  */\r\n  SimulateDiskfullError( return SQLITE_FULL );\r\n\r\n#ifndef SQLITE_TEST\r\n  UNUSED_PARAMETER(flags);\r\n#else\r\n  if( (flags&0x0F)==SQLITE_SYNC_FULL ){\r\n    sqlite3_fullsync_count++;\r\n  }\r\n  sqlite3_sync_count++;\r\n#endif\r\n\r\n  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a\r\n  ** no-op\r\n  */\r\n#ifdef SQLITE_NO_SYNC\r\n  return SQLITE_OK;\r\n#else\r\n  rc = osFlushFileBuffers(pFile->h);\r\n  SimulateIOError( rc=FALSE );\r\n  if( rc ){\r\n    return SQLITE_OK;\r\n  }else{\r\n    pFile->lastErrno = osGetLastError();\r\n    return winLogError(SQLITE_IOERR_FSYNC, pFile->lastErrno,\r\n             \"winSync\", pFile->zPath);\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Determine the current size of a file in bytes\r\n*/\r\nstatic int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){\r\n  DWORD upperBits;\r\n  DWORD lowerBits;\r\n  winFile *pFile = (winFile*)id;\r\n  DWORD lastErrno;\r\n\r\n  assert( id!=0 );\r\n  SimulateIOError(return SQLITE_IOERR_FSTAT);\r\n  lowerBits = osGetFileSize(pFile->h, &upperBits);\r\n  if(   (lowerBits == INVALID_FILE_SIZE)\r\n     && ((lastErrno = osGetLastError())!=NO_ERROR) )\r\n  {\r\n    pFile->lastErrno = lastErrno;\r\n    return winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,\r\n             \"winFileSize\", pFile->zPath);\r\n  }\r\n  *pSize = (((sqlite3_int64)upperBits)<<32) + lowerBits;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems.\r\n*/\r\n#ifndef LOCKFILE_FAIL_IMMEDIATELY\r\n# define LOCKFILE_FAIL_IMMEDIATELY 1\r\n#endif\r\n\r\n/*\r\n** Acquire a reader lock.\r\n** Different API routines are called depending on whether or not this\r\n** is Win9x or WinNT.\r\n*/\r\nstatic int getReadLock(winFile *pFile){\r\n  int res;\r\n  if( isNT() ){\r\n    OVERLAPPED ovlp;\r\n    ovlp.Offset = SHARED_FIRST;\r\n    ovlp.OffsetHigh = 0;\r\n    ovlp.hEvent = 0;\r\n    res = osLockFileEx(pFile->h, LOCKFILE_FAIL_IMMEDIATELY,\r\n                       0, SHARED_SIZE, 0, &ovlp);\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    int lk;\r\n    sqlite3_randomness(sizeof(lk), &lk);\r\n    pFile->sharedLockByte = (short)((lk & 0x7fffffff)%(SHARED_SIZE - 1));\r\n    res = osLockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);\r\n#endif\r\n  }\r\n  if( res == 0 ){\r\n    pFile->lastErrno = osGetLastError();\r\n    /* No need to log a failure to lock */\r\n  }\r\n  return res;\r\n}\r\n\r\n/*\r\n** Undo a readlock\r\n*/\r\nstatic int unlockReadLock(winFile *pFile){\r\n  int res;\r\n  DWORD lastErrno;\r\n  if( isNT() ){\r\n    res = osUnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    res = osUnlockFile(pFile->h, SHARED_FIRST + pFile->sharedLockByte, 0, 1, 0);\r\n#endif\r\n  }\r\n  if( res==0 && ((lastErrno = osGetLastError())!=ERROR_NOT_LOCKED) ){\r\n    pFile->lastErrno = lastErrno;\r\n    winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno,\r\n             \"unlockReadLock\", pFile->zPath);\r\n  }\r\n  return res;\r\n}\r\n\r\n/*\r\n** Lock the file with the lock specified by parameter locktype - one\r\n** of the following:\r\n**\r\n**     (1) SHARED_LOCK\r\n**     (2) RESERVED_LOCK\r\n**     (3) PENDING_LOCK\r\n**     (4) EXCLUSIVE_LOCK\r\n**\r\n** Sometimes when requesting one lock state, additional lock states\r\n** are inserted in between.  The locking might fail on one of the later\r\n** transitions leaving the lock state different from what it started but\r\n** still short of its goal.  The following chart shows the allowed\r\n** transitions and the inserted intermediate states:\r\n**\r\n**    UNLOCKED -> SHARED\r\n**    SHARED -> RESERVED\r\n**    SHARED -> (PENDING) -> EXCLUSIVE\r\n**    RESERVED -> (PENDING) -> EXCLUSIVE\r\n**    PENDING -> EXCLUSIVE\r\n**\r\n** This routine will only increase a lock.  The winUnlock() routine\r\n** erases all locks at once and returns us immediately to locking level 0.\r\n** It is not possible to lower the locking level one step at a time.  You\r\n** must go straight to locking level 0.\r\n*/\r\nstatic int winLock(sqlite3_file *id, int locktype){\r\n  int rc = SQLITE_OK;    /* Return code from subroutines */\r\n  int res = 1;           /* Result of a Windows lock call */\r\n  int newLocktype;       /* Set pFile->locktype to this value before exiting */\r\n  int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */\r\n  winFile *pFile = (winFile*)id;\r\n  DWORD lastErrno = NO_ERROR;\r\n\r\n  assert( id!=0 );\r\n  OSTRACE((\"LOCK %d %d was %d(%d)\\n\",\r\n           pFile->h, locktype, pFile->locktype, pFile->sharedLockByte));\r\n\r\n  /* If there is already a lock of this type or more restrictive on the\r\n  ** OsFile, do nothing. Don't use the end_lock: exit path, as\r\n  ** sqlite3OsEnterMutex() hasn't been called yet.\r\n  */\r\n  if( pFile->locktype>=locktype ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Make sure the locking sequence is correct\r\n  */\r\n  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );\r\n  assert( locktype!=PENDING_LOCK );\r\n  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );\r\n\r\n  /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or\r\n  ** a SHARED lock.  If we are acquiring a SHARED lock, the acquisition of\r\n  ** the PENDING_LOCK byte is temporary.\r\n  */\r\n  newLocktype = pFile->locktype;\r\n  if(   (pFile->locktype==NO_LOCK)\r\n     || (   (locktype==EXCLUSIVE_LOCK)\r\n         && (pFile->locktype==RESERVED_LOCK))\r\n  ){\r\n    int cnt = 3;\r\n    while( cnt-->0 && (res = osLockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){\r\n      /* Try 3 times to get the pending lock.  This is needed to work\r\n      ** around problems caused by indexing and/or anti-virus software on\r\n      ** Windows systems.\r\n      ** If you are using this code as a model for alternative VFSes, do not\r\n      ** copy this retry logic.  It is a hack intended for Windows only.\r\n      */\r\n      OSTRACE((\"could not get a PENDING lock. cnt=%d\\n\", cnt));\r\n      if( cnt ) osSleep(1);\r\n    }\r\n    gotPendingLock = res;\r\n    if( !res ){\r\n      lastErrno = osGetLastError();\r\n    }\r\n  }\r\n\r\n  /* Acquire a shared lock\r\n  */\r\n  if( locktype==SHARED_LOCK && res ){\r\n    assert( pFile->locktype==NO_LOCK );\r\n    res = getReadLock(pFile);\r\n    if( res ){\r\n      newLocktype = SHARED_LOCK;\r\n    }else{\r\n      lastErrno = osGetLastError();\r\n    }\r\n  }\r\n\r\n  /* Acquire a RESERVED lock\r\n  */\r\n  if( locktype==RESERVED_LOCK && res ){\r\n    assert( pFile->locktype==SHARED_LOCK );\r\n    res = osLockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);\r\n    if( res ){\r\n      newLocktype = RESERVED_LOCK;\r\n    }else{\r\n      lastErrno = osGetLastError();\r\n    }\r\n  }\r\n\r\n  /* Acquire a PENDING lock\r\n  */\r\n  if( locktype==EXCLUSIVE_LOCK && res ){\r\n    newLocktype = PENDING_LOCK;\r\n    gotPendingLock = 0;\r\n  }\r\n\r\n  /* Acquire an EXCLUSIVE lock\r\n  */\r\n  if( locktype==EXCLUSIVE_LOCK && res ){\r\n    assert( pFile->locktype>=SHARED_LOCK );\r\n    res = unlockReadLock(pFile);\r\n    OSTRACE((\"unreadlock = %d\\n\", res));\r\n    res = osLockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);\r\n    if( res ){\r\n      newLocktype = EXCLUSIVE_LOCK;\r\n    }else{\r\n      lastErrno = osGetLastError();\r\n      OSTRACE((\"error-code = %d\\n\", lastErrno));\r\n      getReadLock(pFile);\r\n    }\r\n  }\r\n\r\n  /* If we are holding a PENDING lock that ought to be released, then\r\n  ** release it now.\r\n  */\r\n  if( gotPendingLock && locktype==SHARED_LOCK ){\r\n    osUnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);\r\n  }\r\n\r\n  /* Update the state of the lock has held in the file descriptor then\r\n  ** return the appropriate result code.\r\n  */\r\n  if( res ){\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    OSTRACE((\"LOCK FAILED %d trying for %d but got %d\\n\", pFile->h,\r\n           locktype, newLocktype));\r\n    pFile->lastErrno = lastErrno;\r\n    rc = SQLITE_BUSY;\r\n  }\r\n  pFile->locktype = (u8)newLocktype;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This routine checks if there is a RESERVED lock held on the specified\r\n** file by this or any other process. If such a lock is held, return\r\n** non-zero, otherwise zero.\r\n*/\r\nstatic int winCheckReservedLock(sqlite3_file *id, int *pResOut){\r\n  int rc;\r\n  winFile *pFile = (winFile*)id;\r\n\r\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\r\n\r\n  assert( id!=0 );\r\n  if( pFile->locktype>=RESERVED_LOCK ){\r\n    rc = 1;\r\n    OSTRACE((\"TEST WR-LOCK %d %d (local)\\n\", pFile->h, rc));\r\n  }else{\r\n    rc = osLockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);\r\n    if( rc ){\r\n      osUnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);\r\n    }\r\n    rc = !rc;\r\n    OSTRACE((\"TEST WR-LOCK %d %d (remote)\\n\", pFile->h, rc));\r\n  }\r\n  *pResOut = rc;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Lower the locking level on file descriptor id to locktype.  locktype\r\n** must be either NO_LOCK or SHARED_LOCK.\r\n**\r\n** If the locking level of the file descriptor is already at or below\r\n** the requested locking level, this routine is a no-op.\r\n**\r\n** It is not possible for this routine to fail if the second argument\r\n** is NO_LOCK.  If the second argument is SHARED_LOCK then this routine\r\n** might return SQLITE_IOERR;\r\n*/\r\nstatic int winUnlock(sqlite3_file *id, int locktype){\r\n  int type;\r\n  winFile *pFile = (winFile*)id;\r\n  int rc = SQLITE_OK;\r\n  assert( pFile!=0 );\r\n  assert( locktype<=SHARED_LOCK );\r\n  OSTRACE((\"UNLOCK %d to %d was %d(%d)\\n\", pFile->h, locktype,\r\n          pFile->locktype, pFile->sharedLockByte));\r\n  type = pFile->locktype;\r\n  if( type>=EXCLUSIVE_LOCK ){\r\n    osUnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);\r\n    if( locktype==SHARED_LOCK && !getReadLock(pFile) ){\r\n      /* This should never happen.  We should always be able to\r\n      ** reacquire the read lock */\r\n      rc = winLogError(SQLITE_IOERR_UNLOCK, osGetLastError(),\r\n               \"winUnlock\", pFile->zPath);\r\n    }\r\n  }\r\n  if( type>=RESERVED_LOCK ){\r\n    osUnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);\r\n  }\r\n  if( locktype==NO_LOCK && type>=SHARED_LOCK ){\r\n    unlockReadLock(pFile);\r\n  }\r\n  if( type>=PENDING_LOCK ){\r\n    osUnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);\r\n  }\r\n  pFile->locktype = (u8)locktype;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If *pArg is inititially negative then this is a query.  Set *pArg to\r\n** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.\r\n**\r\n** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.\r\n*/\r\nstatic void winModeBit(winFile *pFile, unsigned char mask, int *pArg){\r\n  if( *pArg<0 ){\r\n    *pArg = (pFile->ctrlFlags & mask)!=0;\r\n  }else if( (*pArg)==0 ){\r\n    pFile->ctrlFlags &= ~mask;\r\n  }else{\r\n    pFile->ctrlFlags |= mask;\r\n  }\r\n}\r\n\r\n/*\r\n** Control and query of the open file handle.\r\n*/\r\nstatic int winFileControl(sqlite3_file *id, int op, void *pArg){\r\n  winFile *pFile = (winFile*)id;\r\n  switch( op ){\r\n    case SQLITE_FCNTL_LOCKSTATE: {\r\n      *(int*)pArg = pFile->locktype;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_LAST_ERRNO: {\r\n      *(int*)pArg = (int)pFile->lastErrno;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_CHUNK_SIZE: {\r\n      pFile->szChunk = *(int *)pArg;\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_SIZE_HINT: {\r\n      if( pFile->szChunk>0 ){\r\n        sqlite3_int64 oldSz;\r\n        int rc = winFileSize(id, &oldSz);\r\n        if( rc==SQLITE_OK ){\r\n          sqlite3_int64 newSz = *(sqlite3_int64*)pArg;\r\n          if( newSz>oldSz ){\r\n            SimulateIOErrorBenign(1);\r\n            rc = winTruncate(id, newSz);\r\n            SimulateIOErrorBenign(0);\r\n          }\r\n        }\r\n        return rc;\r\n      }\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_PERSIST_WAL: {\r\n      winModeBit(pFile, WINFILE_PERSIST_WAL, (int*)pArg);\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {\r\n      winModeBit(pFile, WINFILE_PSOW, (int*)pArg);\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_VFSNAME: {\r\n      *(char**)pArg = sqlite3_mprintf(\"win32\");\r\n      return SQLITE_OK;\r\n    }\r\n    case SQLITE_FCNTL_WIN32_AV_RETRY: {\r\n      int *a = (int*)pArg;\r\n      if( a[0]>0 ){\r\n        win32IoerrRetry = a[0];\r\n      }else{\r\n        a[0] = win32IoerrRetry;\r\n      }\r\n      if( a[1]>0 ){\r\n        win32IoerrRetryDelay = a[1];\r\n      }else{\r\n        a[1] = win32IoerrRetryDelay;\r\n      }\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n  return SQLITE_NOTFOUND;\r\n}\r\n\r\n/*\r\n** Return the sector size in bytes of the underlying block device for\r\n** the specified file. This is almost always 512 bytes, but may be\r\n** larger for some devices.\r\n**\r\n** SQLite code assumes this function cannot fail. It also assumes that\r\n** if two files are created in the same file-system directory (i.e.\r\n** a database and its journal file) that the sector size will be the\r\n** same for both.\r\n*/\r\nstatic int winSectorSize(sqlite3_file *id){\r\n  (void)id;\r\n  return SQLITE_DEFAULT_SECTOR_SIZE;\r\n}\r\n\r\n/*\r\n** Return a vector of device characteristics.\r\n*/\r\nstatic int winDeviceCharacteristics(sqlite3_file *id){\r\n  winFile *p = (winFile*)id;\r\n  return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |\r\n         ((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n\r\n/* \r\n** Windows will only let you create file view mappings\r\n** on allocation size granularity boundaries.\r\n** During sqlite3_os_init() we do a GetSystemInfo()\r\n** to get the granularity size.\r\n*/\r\nSYSTEM_INFO winSysInfo;\r\n\r\n/*\r\n** Helper functions to obtain and relinquish the global mutex. The\r\n** global mutex is used to protect the winLockInfo objects used by \r\n** this file, all of which may be shared by multiple threads.\r\n**\r\n** Function winShmMutexHeld() is used to assert() that the global mutex \r\n** is held when required. This function is only used as part of assert() \r\n** statements. e.g.\r\n**\r\n**   winShmEnterMutex()\r\n**     assert( winShmMutexHeld() );\r\n**   winShmLeaveMutex()\r\n*/\r\nstatic void winShmEnterMutex(void){\r\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\nstatic void winShmLeaveMutex(void){\r\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\n#ifdef SQLITE_DEBUG\r\nstatic int winShmMutexHeld(void) {\r\n  return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\n#endif\r\n\r\n/*\r\n** Object used to represent a single file opened and mmapped to provide\r\n** shared memory.  When multiple threads all reference the same\r\n** log-summary, each thread has its own winFile object, but they all\r\n** point to a single instance of this object.  In other words, each\r\n** log-summary is opened only once per process.\r\n**\r\n** winShmMutexHeld() must be true when creating or destroying\r\n** this object or while reading or writing the following fields:\r\n**\r\n**      nRef\r\n**      pNext \r\n**\r\n** The following fields are read-only after the object is created:\r\n** \r\n**      fid\r\n**      zFilename\r\n**\r\n** Either winShmNode.mutex must be held or winShmNode.nRef==0 and\r\n** winShmMutexHeld() is true when reading or writing any other field\r\n** in this structure.\r\n**\r\n*/\r\nstruct winShmNode {\r\n  sqlite3_mutex *mutex;      /* Mutex to access this object */\r\n  char *zFilename;           /* Name of the file */\r\n  winFile hFile;             /* File handle from winOpen */\r\n\r\n  int szRegion;              /* Size of shared-memory regions */\r\n  int nRegion;               /* Size of array apRegion */\r\n  struct ShmRegion {\r\n    HANDLE hMap;             /* File handle from CreateFileMapping */\r\n    void *pMap;\r\n  } *aRegion;\r\n  DWORD lastErrno;           /* The Windows errno from the last I/O error */\r\n\r\n  int nRef;                  /* Number of winShm objects pointing to this */\r\n  winShm *pFirst;            /* All winShm objects pointing to this */\r\n  winShmNode *pNext;         /* Next in list of all winShmNode objects */\r\n#ifdef SQLITE_DEBUG\r\n  u8 nextShmId;              /* Next available winShm.id value */\r\n#endif\r\n};\r\n\r\n/*\r\n** A global array of all winShmNode objects.\r\n**\r\n** The winShmMutexHeld() must be true while reading or writing this list.\r\n*/\r\nstatic winShmNode *winShmNodeList = 0;\r\n\r\n/*\r\n** Structure used internally by this VFS to record the state of an\r\n** open shared memory connection.\r\n**\r\n** The following fields are initialized when this object is created and\r\n** are read-only thereafter:\r\n**\r\n**    winShm.pShmNode\r\n**    winShm.id\r\n**\r\n** All other fields are read/write.  The winShm.pShmNode->mutex must be held\r\n** while accessing any read/write fields.\r\n*/\r\nstruct winShm {\r\n  winShmNode *pShmNode;      /* The underlying winShmNode object */\r\n  winShm *pNext;             /* Next winShm with the same winShmNode */\r\n  u8 hasMutex;               /* True if holding the winShmNode mutex */\r\n  u16 sharedMask;            /* Mask of shared locks held */\r\n  u16 exclMask;              /* Mask of exclusive locks held */\r\n#ifdef SQLITE_DEBUG\r\n  u8 id;                     /* Id of this connection with its winShmNode */\r\n#endif\r\n};\r\n\r\n/*\r\n** Constants used for locking\r\n*/\r\n#define WIN_SHM_BASE   ((22+SQLITE_SHM_NLOCK)*4)        /* first lock byte */\r\n#define WIN_SHM_DMS    (WIN_SHM_BASE+SQLITE_SHM_NLOCK)  /* deadman switch */\r\n\r\n/*\r\n** Apply advisory locks for all n bytes beginning at ofst.\r\n*/\r\n#define _SHM_UNLCK  1\r\n#define _SHM_RDLCK  2\r\n#define _SHM_WRLCK  3\r\nstatic int winShmSystemLock(\r\n  winShmNode *pFile,    /* Apply locks to this open shared-memory segment */\r\n  int lockType,         /* _SHM_UNLCK, _SHM_RDLCK, or _SHM_WRLCK */\r\n  int ofst,             /* Offset to first byte to be locked/unlocked */\r\n  int nByte             /* Number of bytes to lock or unlock */\r\n){\r\n  OVERLAPPED ovlp;\r\n  DWORD dwFlags;\r\n  int rc = 0;           /* Result code form Lock/UnlockFileEx() */\r\n\r\n  /* Access to the winShmNode object is serialized by the caller */\r\n  assert( sqlite3_mutex_held(pFile->mutex) || pFile->nRef==0 );\r\n\r\n  /* Initialize the locking parameters */\r\n  dwFlags = LOCKFILE_FAIL_IMMEDIATELY;\r\n  if( lockType == _SHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK;\r\n\r\n  memset(&ovlp, 0, sizeof(OVERLAPPED));\r\n  ovlp.Offset = ofst;\r\n\r\n  /* Release/Acquire the system-level lock */\r\n  if( lockType==_SHM_UNLCK ){\r\n    rc = osUnlockFileEx(pFile->hFile.h, 0, nByte, 0, &ovlp);\r\n  }else{\r\n    rc = osLockFileEx(pFile->hFile.h, dwFlags, 0, nByte, 0, &ovlp);\r\n  }\r\n  \r\n  if( rc!= 0 ){\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    pFile->lastErrno =  osGetLastError();\r\n    rc = SQLITE_BUSY;\r\n  }\r\n\r\n  OSTRACE((\"SHM-LOCK %d %s %s 0x%08lx\\n\", \r\n           pFile->hFile.h,\r\n           rc==SQLITE_OK ? \"ok\" : \"failed\",\r\n           lockType==_SHM_UNLCK ? \"UnlockFileEx\" : \"LockFileEx\",\r\n           pFile->lastErrno));\r\n\r\n  return rc;\r\n}\r\n\r\n/* Forward references to VFS methods */\r\nstatic int winOpen(sqlite3_vfs*,const char*,sqlite3_file*,int,int*);\r\nstatic int winDelete(sqlite3_vfs *,const char*,int);\r\n\r\n/*\r\n** Purge the winShmNodeList list of all entries with winShmNode.nRef==0.\r\n**\r\n** This is not a VFS shared-memory method; it is a utility function called\r\n** by VFS shared-memory methods.\r\n*/\r\nstatic void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){\r\n  winShmNode **pp;\r\n  winShmNode *p;\r\n  BOOL bRc;\r\n  assert( winShmMutexHeld() );\r\n  pp = &winShmNodeList;\r\n  while( (p = *pp)!=0 ){\r\n    if( p->nRef==0 ){\r\n      int i;\r\n      if( p->mutex ) sqlite3_mutex_free(p->mutex);\r\n      for(i=0; i<p->nRegion; i++){\r\n        bRc = osUnmapViewOfFile(p->aRegion[i].pMap);\r\n        OSTRACE((\"SHM-PURGE pid-%d unmap region=%d %s\\n\",\r\n                 (int)osGetCurrentProcessId(), i,\r\n                 bRc ? \"ok\" : \"failed\"));\r\n        bRc = osCloseHandle(p->aRegion[i].hMap);\r\n        OSTRACE((\"SHM-PURGE pid-%d close region=%d %s\\n\",\r\n                 (int)osGetCurrentProcessId(), i,\r\n                 bRc ? \"ok\" : \"failed\"));\r\n      }\r\n      if( p->hFile.h != INVALID_HANDLE_VALUE ){\r\n        SimulateIOErrorBenign(1);\r\n        winClose((sqlite3_file *)&p->hFile);\r\n        SimulateIOErrorBenign(0);\r\n      }\r\n      if( deleteFlag ){\r\n        SimulateIOErrorBenign(1);\r\n        sqlite3BeginBenignMalloc();\r\n        winDelete(pVfs, p->zFilename, 0);\r\n        sqlite3EndBenignMalloc();\r\n        SimulateIOErrorBenign(0);\r\n      }\r\n      *pp = p->pNext;\r\n      sqlite3_free(p->aRegion);\r\n      sqlite3_free(p);\r\n    }else{\r\n      pp = &p->pNext;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Open the shared-memory area associated with database file pDbFd.\r\n**\r\n** When opening a new shared-memory file, if no other instances of that\r\n** file are currently open, in this process or in other processes, then\r\n** the file must be truncated to zero length or have its header cleared.\r\n*/\r\nstatic int winOpenSharedMemory(winFile *pDbFd){\r\n  struct winShm *p;                  /* The connection to be opened */\r\n  struct winShmNode *pShmNode = 0;   /* The underlying mmapped file */\r\n  int rc;                            /* Result code */\r\n  struct winShmNode *pNew;           /* Newly allocated winShmNode */\r\n  int nName;                         /* Size of zName in bytes */\r\n\r\n  assert( pDbFd->pShm==0 );    /* Not previously opened */\r\n\r\n  /* Allocate space for the new sqlite3_shm object.  Also speculatively\r\n  ** allocate space for a new winShmNode and filename.\r\n  */\r\n  p = sqlite3_malloc( sizeof(*p) );\r\n  if( p==0 ) return SQLITE_IOERR_NOMEM;\r\n  memset(p, 0, sizeof(*p));\r\n  nName = sqlite3Strlen30(pDbFd->zPath);\r\n  pNew = sqlite3_malloc( sizeof(*pShmNode) + nName + 17 );\r\n  if( pNew==0 ){\r\n    sqlite3_free(p);\r\n    return SQLITE_IOERR_NOMEM;\r\n  }\r\n  memset(pNew, 0, sizeof(*pNew) + nName + 17);\r\n  pNew->zFilename = (char*)&pNew[1];\r\n  sqlite3_snprintf(nName+15, pNew->zFilename, \"%s-shm\", pDbFd->zPath);\r\n  sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); \r\n\r\n  /* Look to see if there is an existing winShmNode that can be used.\r\n  ** If no matching winShmNode currently exists, create a new one.\r\n  */\r\n  winShmEnterMutex();\r\n  for(pShmNode = winShmNodeList; pShmNode; pShmNode=pShmNode->pNext){\r\n    /* TBD need to come up with better match here.  Perhaps\r\n    ** use FILE_ID_BOTH_DIR_INFO Structure.\r\n    */\r\n    if( sqlite3StrICmp(pShmNode->zFilename, pNew->zFilename)==0 ) break;\r\n  }\r\n  if( pShmNode ){\r\n    sqlite3_free(pNew);\r\n  }else{\r\n    pShmNode = pNew;\r\n    pNew = 0;\r\n    ((winFile*)(&pShmNode->hFile))->h = INVALID_HANDLE_VALUE;\r\n    pShmNode->pNext = winShmNodeList;\r\n    winShmNodeList = pShmNode;\r\n\r\n    pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);\r\n    if( pShmNode->mutex==0 ){\r\n      rc = SQLITE_IOERR_NOMEM;\r\n      goto shm_open_err;\r\n    }\r\n\r\n    rc = winOpen(pDbFd->pVfs,\r\n                 pShmNode->zFilename,             /* Name of the file (UTF-8) */\r\n                 (sqlite3_file*)&pShmNode->hFile,  /* File handle here */\r\n                 SQLITE_OPEN_WAL | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, /* Mode flags */\r\n                 0);\r\n    if( SQLITE_OK!=rc ){\r\n      goto shm_open_err;\r\n    }\r\n\r\n    /* Check to see if another process is holding the dead-man switch.\r\n    ** If not, truncate the file to zero length. \r\n    */\r\n    if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){\r\n      rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0);\r\n      if( rc!=SQLITE_OK ){\r\n        rc = winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(),\r\n                 \"winOpenShm\", pDbFd->zPath);\r\n      }\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1);\r\n      rc = winShmSystemLock(pShmNode, _SHM_RDLCK, WIN_SHM_DMS, 1);\r\n    }\r\n    if( rc ) goto shm_open_err;\r\n  }\r\n\r\n  /* Make the new connection a child of the winShmNode */\r\n  p->pShmNode = pShmNode;\r\n#ifdef SQLITE_DEBUG\r\n  p->id = pShmNode->nextShmId++;\r\n#endif\r\n  pShmNode->nRef++;\r\n  pDbFd->pShm = p;\r\n  winShmLeaveMutex();\r\n\r\n  /* The reference count on pShmNode has already been incremented under\r\n  ** the cover of the winShmEnterMutex() mutex and the pointer from the\r\n  ** new (struct winShm) object to the pShmNode has been set. All that is\r\n  ** left to do is to link the new object into the linked list starting\r\n  ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex \r\n  ** mutex.\r\n  */\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  p->pNext = pShmNode->pFirst;\r\n  pShmNode->pFirst = p;\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  return SQLITE_OK;\r\n\r\n  /* Jump here on any error */\r\nshm_open_err:\r\n  winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1);\r\n  winShmPurge(pDbFd->pVfs, 0);      /* This call frees pShmNode if required */\r\n  sqlite3_free(p);\r\n  sqlite3_free(pNew);\r\n  winShmLeaveMutex();\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close a connection to shared-memory.  Delete the underlying \r\n** storage if deleteFlag is true.\r\n*/\r\nstatic int winShmUnmap(\r\n  sqlite3_file *fd,          /* Database holding shared memory */\r\n  int deleteFlag             /* Delete after closing if true */\r\n){\r\n  winFile *pDbFd;       /* Database holding shared-memory */\r\n  winShm *p;            /* The connection to be closed */\r\n  winShmNode *pShmNode; /* The underlying shared-memory file */\r\n  winShm **pp;          /* For looping over sibling connections */\r\n\r\n  pDbFd = (winFile*)fd;\r\n  p = pDbFd->pShm;\r\n  if( p==0 ) return SQLITE_OK;\r\n  pShmNode = p->pShmNode;\r\n\r\n  /* Remove connection p from the set of connections associated\r\n  ** with pShmNode */\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}\r\n  *pp = p->pNext;\r\n\r\n  /* Free the connection p */\r\n  sqlite3_free(p);\r\n  pDbFd->pShm = 0;\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n\r\n  /* If pShmNode->nRef has reached 0, then close the underlying\r\n  ** shared-memory file, too */\r\n  winShmEnterMutex();\r\n  assert( pShmNode->nRef>0 );\r\n  pShmNode->nRef--;\r\n  if( pShmNode->nRef==0 ){\r\n    winShmPurge(pDbFd->pVfs, deleteFlag);\r\n  }\r\n  winShmLeaveMutex();\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Change the lock state for a shared-memory segment.\r\n*/\r\nstatic int winShmLock(\r\n  sqlite3_file *fd,          /* Database file holding the shared memory */\r\n  int ofst,                  /* First lock to acquire or release */\r\n  int n,                     /* Number of locks to acquire or release */\r\n  int flags                  /* What to do with the lock */\r\n){\r\n  winFile *pDbFd = (winFile*)fd;        /* Connection holding shared memory */\r\n  winShm *p = pDbFd->pShm;              /* The shared memory being locked */\r\n  winShm *pX;                           /* For looping over all siblings */\r\n  winShmNode *pShmNode = p->pShmNode;\r\n  int rc = SQLITE_OK;                   /* Result code */\r\n  u16 mask;                             /* Mask of locks to take or release */\r\n\r\n  assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );\r\n  assert( n>=1 );\r\n  assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)\r\n       || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)\r\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)\r\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) );\r\n  assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 );\r\n\r\n  mask = (u16)((1U<<(ofst+n)) - (1U<<ofst));\r\n  assert( n>1 || mask==(1<<ofst) );\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  if( flags & SQLITE_SHM_UNLOCK ){\r\n    u16 allMask = 0; /* Mask of locks held by siblings */\r\n\r\n    /* See if any siblings hold this same lock */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( pX==p ) continue;\r\n      assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );\r\n      allMask |= pX->sharedMask;\r\n    }\r\n\r\n    /* Unlock the system-level locks */\r\n    if( (mask & allMask)==0 ){\r\n      rc = winShmSystemLock(pShmNode, _SHM_UNLCK, ofst+WIN_SHM_BASE, n);\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n\r\n    /* Undo the local locks */\r\n    if( rc==SQLITE_OK ){\r\n      p->exclMask &= ~mask;\r\n      p->sharedMask &= ~mask;\r\n    } \r\n  }else if( flags & SQLITE_SHM_SHARED ){\r\n    u16 allShared = 0;  /* Union of locks held by connections other than \"p\" */\r\n\r\n    /* Find out which shared locks are already held by sibling connections.\r\n    ** If any sibling already holds an exclusive lock, go ahead and return\r\n    ** SQLITE_BUSY.\r\n    */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( (pX->exclMask & mask)!=0 ){\r\n        rc = SQLITE_BUSY;\r\n        break;\r\n      }\r\n      allShared |= pX->sharedMask;\r\n    }\r\n\r\n    /* Get shared locks at the system level, if necessary */\r\n    if( rc==SQLITE_OK ){\r\n      if( (allShared & mask)==0 ){\r\n        rc = winShmSystemLock(pShmNode, _SHM_RDLCK, ofst+WIN_SHM_BASE, n);\r\n      }else{\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n\r\n    /* Get the local shared locks */\r\n    if( rc==SQLITE_OK ){\r\n      p->sharedMask |= mask;\r\n    }\r\n  }else{\r\n    /* Make sure no sibling connections hold locks that will block this\r\n    ** lock.  If any do, return SQLITE_BUSY right away.\r\n    */\r\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\r\n      if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){\r\n        rc = SQLITE_BUSY;\r\n        break;\r\n      }\r\n    }\r\n  \r\n    /* Get the exclusive locks at the system level.  Then if successful\r\n    ** also mark the local connection as being locked.\r\n    */\r\n    if( rc==SQLITE_OK ){\r\n      rc = winShmSystemLock(pShmNode, _SHM_WRLCK, ofst+WIN_SHM_BASE, n);\r\n      if( rc==SQLITE_OK ){\r\n        assert( (p->sharedMask & mask)==0 );\r\n        p->exclMask |= mask;\r\n      }\r\n    }\r\n  }\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  OSTRACE((\"SHM-LOCK shmid-%d, pid-%d got %03x,%03x %s\\n\",\r\n           p->id, (int)osGetCurrentProcessId(), p->sharedMask, p->exclMask,\r\n           rc ? \"failed\" : \"ok\"));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Implement a memory barrier or memory fence on shared memory.  \r\n**\r\n** All loads and stores begun before the barrier must complete before\r\n** any load or store begun after the barrier.\r\n*/\r\nstatic void winShmBarrier(\r\n  sqlite3_file *fd          /* Database holding the shared memory */\r\n){\r\n  UNUSED_PARAMETER(fd);\r\n  /* MemoryBarrier(); // does not work -- do not know why not */\r\n  winShmEnterMutex();\r\n  winShmLeaveMutex();\r\n}\r\n\r\n/*\r\n** This function is called to obtain a pointer to region iRegion of the \r\n** shared-memory associated with the database file fd. Shared-memory regions \r\n** are numbered starting from zero. Each shared-memory region is szRegion \r\n** bytes in size.\r\n**\r\n** If an error occurs, an error code is returned and *pp is set to NULL.\r\n**\r\n** Otherwise, if the isWrite parameter is 0 and the requested shared-memory\r\n** region has not been allocated (by any client, including one running in a\r\n** separate process), then *pp is set to NULL and SQLITE_OK returned. If \r\n** isWrite is non-zero and the requested shared-memory region has not yet \r\n** been allocated, it is allocated by this function.\r\n**\r\n** If the shared-memory region has already been allocated or is allocated by\r\n** this call as described above, then it is mapped into this processes \r\n** address space (if it is not already), *pp is set to point to the mapped \r\n** memory and SQLITE_OK returned.\r\n*/\r\nstatic int winShmMap(\r\n  sqlite3_file *fd,               /* Handle open on database file */\r\n  int iRegion,                    /* Region to retrieve */\r\n  int szRegion,                   /* Size of regions */\r\n  int isWrite,                    /* True to extend file if necessary */\r\n  void volatile **pp              /* OUT: Mapped memory */\r\n){\r\n  winFile *pDbFd = (winFile*)fd;\r\n  winShm *p = pDbFd->pShm;\r\n  winShmNode *pShmNode;\r\n  int rc = SQLITE_OK;\r\n\r\n  if( !p ){\r\n    rc = winOpenSharedMemory(pDbFd);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n    p = pDbFd->pShm;\r\n  }\r\n  pShmNode = p->pShmNode;\r\n\r\n  sqlite3_mutex_enter(pShmNode->mutex);\r\n  assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );\r\n\r\n  if( pShmNode->nRegion<=iRegion ){\r\n    struct ShmRegion *apNew;           /* New aRegion[] array */\r\n    int nByte = (iRegion+1)*szRegion;  /* Minimum required file size */\r\n    sqlite3_int64 sz;                  /* Current size of wal-index file */\r\n\r\n    pShmNode->szRegion = szRegion;\r\n\r\n    /* The requested region is not mapped into this processes address space.\r\n    ** Check to see if it has been allocated (i.e. if the wal-index file is\r\n    ** large enough to contain the requested region).\r\n    */\r\n    rc = winFileSize((sqlite3_file *)&pShmNode->hFile, &sz);\r\n    if( rc!=SQLITE_OK ){\r\n      rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(),\r\n               \"winShmMap1\", pDbFd->zPath);\r\n      goto shmpage_out;\r\n    }\r\n\r\n    if( sz<nByte ){\r\n      /* The requested memory region does not exist. If isWrite is set to\r\n      ** zero, exit early. *pp will be set to NULL and SQLITE_OK returned.\r\n      **\r\n      ** Alternatively, if isWrite is non-zero, use ftruncate() to allocate\r\n      ** the requested memory region.\r\n      */\r\n      if( !isWrite ) goto shmpage_out;\r\n      rc = winTruncate((sqlite3_file *)&pShmNode->hFile, nByte);\r\n      if( rc!=SQLITE_OK ){\r\n        rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(),\r\n                 \"winShmMap2\", pDbFd->zPath);\r\n        goto shmpage_out;\r\n      }\r\n    }\r\n\r\n    /* Map the requested memory region into this processes address space. */\r\n    apNew = (struct ShmRegion *)sqlite3_realloc(\r\n        pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0])\r\n    );\r\n    if( !apNew ){\r\n      rc = SQLITE_IOERR_NOMEM;\r\n      goto shmpage_out;\r\n    }\r\n    pShmNode->aRegion = apNew;\r\n\r\n    while( pShmNode->nRegion<=iRegion ){\r\n      HANDLE hMap;                /* file-mapping handle */\r\n      void *pMap = 0;             /* Mapped memory region */\r\n     \r\n      hMap = osCreateFileMapping(pShmNode->hFile.h, \r\n          NULL, PAGE_READWRITE, 0, nByte, NULL\r\n      );\r\n      OSTRACE((\"SHM-MAP pid-%d create region=%d nbyte=%d %s\\n\",\r\n               (int)osGetCurrentProcessId(), pShmNode->nRegion, nByte,\r\n               hMap ? \"ok\" : \"failed\"));\r\n      if( hMap ){\r\n        int iOffset = pShmNode->nRegion*szRegion;\r\n        int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;\r\n        pMap = osMapViewOfFile(hMap, FILE_MAP_WRITE | FILE_MAP_READ,\r\n            0, iOffset - iOffsetShift, szRegion + iOffsetShift\r\n        );\r\n        OSTRACE((\"SHM-MAP pid-%d map region=%d offset=%d size=%d %s\\n\",\r\n                 (int)osGetCurrentProcessId(), pShmNode->nRegion, iOffset,\r\n                 szRegion, pMap ? \"ok\" : \"failed\"));\r\n      }\r\n      if( !pMap ){\r\n        pShmNode->lastErrno = osGetLastError();\r\n        rc = winLogError(SQLITE_IOERR_SHMMAP, pShmNode->lastErrno,\r\n                 \"winShmMap3\", pDbFd->zPath);\r\n        if( hMap ) osCloseHandle(hMap);\r\n        goto shmpage_out;\r\n      }\r\n\r\n      pShmNode->aRegion[pShmNode->nRegion].pMap = pMap;\r\n      pShmNode->aRegion[pShmNode->nRegion].hMap = hMap;\r\n      pShmNode->nRegion++;\r\n    }\r\n  }\r\n\r\nshmpage_out:\r\n  if( pShmNode->nRegion>iRegion ){\r\n    int iOffset = iRegion*szRegion;\r\n    int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;\r\n    char *p = (char *)pShmNode->aRegion[iRegion].pMap;\r\n    *pp = (void *)&p[iOffsetShift];\r\n  }else{\r\n    *pp = 0;\r\n  }\r\n  sqlite3_mutex_leave(pShmNode->mutex);\r\n  return rc;\r\n}\r\n\r\n#else\r\n# define winShmMap     0\r\n# define winShmLock    0\r\n# define winShmBarrier 0\r\n# define winShmUnmap   0\r\n#endif /* #ifndef SQLITE_OMIT_WAL */\r\n\r\n/*\r\n** Here ends the implementation of all sqlite3_file methods.\r\n**\r\n********************** End sqlite3_file Methods *******************************\r\n******************************************************************************/\r\n\r\n/*\r\n** This vector defines all the methods that can operate on an\r\n** sqlite3_file for win32.\r\n*/\r\nstatic const sqlite3_io_methods winIoMethod = {\r\n  2,                              /* iVersion */\r\n  winClose,                       /* xClose */\r\n  winRead,                        /* xRead */\r\n  winWrite,                       /* xWrite */\r\n  winTruncate,                    /* xTruncate */\r\n  winSync,                        /* xSync */\r\n  winFileSize,                    /* xFileSize */\r\n  winLock,                        /* xLock */\r\n  winUnlock,                      /* xUnlock */\r\n  winCheckReservedLock,           /* xCheckReservedLock */\r\n  winFileControl,                 /* xFileControl */\r\n  winSectorSize,                  /* xSectorSize */\r\n  winDeviceCharacteristics,       /* xDeviceCharacteristics */\r\n  winShmMap,                      /* xShmMap */\r\n  winShmLock,                     /* xShmLock */\r\n  winShmBarrier,                  /* xShmBarrier */\r\n  winShmUnmap                     /* xShmUnmap */\r\n};\r\n\r\n/****************************************************************************\r\n**************************** sqlite3_vfs methods ****************************\r\n**\r\n** This division contains the implementation of methods on the\r\n** sqlite3_vfs object.\r\n*/\r\n\r\n/*\r\n** Convert a UTF-8 filename into whatever form the underlying\r\n** operating system wants filenames in.  Space to hold the result\r\n** is obtained from malloc and must be freed by the calling\r\n** function.\r\n*/\r\nstatic void *convertUtf8Filename(const char *zFilename){\r\n  void *zConverted = 0;\r\n  if( isNT() ){\r\n    zConverted = utf8ToUnicode(zFilename);\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    zConverted = sqlite3_win32_utf8_to_mbcs(zFilename);\r\n#endif\r\n  }\r\n  /* caller will handle out of memory */\r\n  return zConverted;\r\n}\r\n\r\n/*\r\n** Create a temporary file name in zBuf.  zBuf must be big enough to\r\n** hold at pVfs->mxPathname characters.\r\n*/\r\nstatic int getTempname(int nBuf, char *zBuf){\r\n  static char zChars[] =\r\n    \"abcdefghijklmnopqrstuvwxyz\"\r\n    \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\r\n    \"0123456789\";\r\n  size_t i, j;\r\n  char zTempPath[MAX_PATH+2];\r\n\r\n  /* It's odd to simulate an io-error here, but really this is just\r\n  ** using the io-error infrastructure to test that SQLite handles this\r\n  ** function failing. \r\n  */\r\n  SimulateIOError( return SQLITE_IOERR );\r\n\r\n  if( sqlite3_temp_directory ){\r\n    sqlite3_snprintf(MAX_PATH-30, zTempPath, \"%s\", sqlite3_temp_directory);\r\n  }else if( isNT() ){\r\n    char *zMulti;\r\n    WCHAR zWidePath[MAX_PATH];\r\n    osGetTempPathW(MAX_PATH-30, zWidePath);\r\n    zMulti = unicodeToUtf8(zWidePath);\r\n    if( zMulti ){\r\n      sqlite3_snprintf(MAX_PATH-30, zTempPath, \"%s\", zMulti);\r\n      sqlite3_free(zMulti);\r\n    }else{\r\n      return SQLITE_IOERR_NOMEM;\r\n    }\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    char *zUtf8;\r\n    char zMbcsPath[MAX_PATH];\r\n    osGetTempPathA(MAX_PATH-30, zMbcsPath);\r\n    zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath);\r\n    if( zUtf8 ){\r\n      sqlite3_snprintf(MAX_PATH-30, zTempPath, \"%s\", zUtf8);\r\n      sqlite3_free(zUtf8);\r\n    }else{\r\n      return SQLITE_IOERR_NOMEM;\r\n    }\r\n#endif\r\n  }\r\n\r\n  /* Check that the output buffer is large enough for the temporary file \r\n  ** name. If it is not, return SQLITE_ERROR.\r\n  */\r\n  if( (sqlite3Strlen30(zTempPath) + sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX) + 18) >= nBuf ){\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  for(i=sqlite3Strlen30(zTempPath); i>0 && zTempPath[i-1]=='\\\\'; i--){}\r\n  zTempPath[i] = 0;\r\n\r\n  sqlite3_snprintf(nBuf-18, zBuf,\r\n                   \"%s\\\\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);\r\n  j = sqlite3Strlen30(zBuf);\r\n  sqlite3_randomness(15, &zBuf[j]);\r\n  for(i=0; i<15; i++, j++){\r\n    zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];\r\n  }\r\n  zBuf[j] = 0;\r\n  zBuf[j+1] = 0;\r\n\r\n  OSTRACE((\"TEMP FILENAME: %s\\n\", zBuf));\r\n  return SQLITE_OK; \r\n}\r\n\r\n/*\r\n** Open a file.\r\n*/\r\nstatic int winOpen(\r\n  sqlite3_vfs *pVfs,        /* Not used */\r\n  const char *zName,        /* Name of the file (UTF-8) */\r\n  sqlite3_file *id,         /* Write the SQLite file handle here */\r\n  int flags,                /* Open mode flags */\r\n  int *pOutFlags            /* Status return flags */\r\n){\r\n  HANDLE h;\r\n  DWORD lastErrno;\r\n  DWORD dwDesiredAccess;\r\n  DWORD dwShareMode;\r\n  DWORD dwCreationDisposition;\r\n  DWORD dwFlagsAndAttributes = 0;\r\n#if SQLITE_OS_WINCE\r\n  int isTemp = 0;\r\n#endif\r\n  winFile *pFile = (winFile*)id;\r\n  void *zConverted;              /* Filename in OS encoding */\r\n  const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */\r\n  int cnt = 0;\r\n\r\n  /* If argument zPath is a NULL pointer, this function is required to open\r\n  ** a temporary file. Use this buffer to store the file name in.\r\n  */\r\n  char zTmpname[MAX_PATH+2];     /* Buffer used to create temp filename */\r\n\r\n  int rc = SQLITE_OK;            /* Function Return Code */\r\n#if !defined(NDEBUG) || SQLITE_OS_WINCE\r\n  int eType = flags&0xFFFFFF00;  /* Type of file to open */\r\n#endif\r\n\r\n  int isExclusive  = (flags & SQLITE_OPEN_EXCLUSIVE);\r\n  int isDelete     = (flags & SQLITE_OPEN_DELETEONCLOSE);\r\n  int isCreate     = (flags & SQLITE_OPEN_CREATE);\r\n#ifndef NDEBUG\r\n  int isReadonly   = (flags & SQLITE_OPEN_READONLY);\r\n#endif\r\n  int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);\r\n\r\n#ifndef NDEBUG\r\n  int isOpenJournal = (isCreate && (\r\n        eType==SQLITE_OPEN_MASTER_JOURNAL \r\n     || eType==SQLITE_OPEN_MAIN_JOURNAL \r\n     || eType==SQLITE_OPEN_WAL\r\n  ));\r\n#endif\r\n\r\n  /* Check the following statements are true: \r\n  **\r\n  **   (a) Exactly one of the READWRITE and READONLY flags must be set, and \r\n  **   (b) if CREATE is set, then READWRITE must also be set, and\r\n  **   (c) if EXCLUSIVE is set, then CREATE must also be set.\r\n  **   (d) if DELETEONCLOSE is set, then CREATE must also be set.\r\n  */\r\n  assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));\r\n  assert(isCreate==0 || isReadWrite);\r\n  assert(isExclusive==0 || isCreate);\r\n  assert(isDelete==0 || isCreate);\r\n\r\n  /* The main DB, main journal, WAL file and master journal are never \r\n  ** automatically deleted. Nor are they ever temporary files.  */\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL );\r\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL );\r\n\r\n  /* Assert that the upper layer has set one of the \"file-type\" flags. */\r\n  assert( eType==SQLITE_OPEN_MAIN_DB      || eType==SQLITE_OPEN_TEMP_DB \r\n       || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL \r\n       || eType==SQLITE_OPEN_SUBJOURNAL   || eType==SQLITE_OPEN_MASTER_JOURNAL \r\n       || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL\r\n  );\r\n\r\n  assert( id!=0 );\r\n  UNUSED_PARAMETER(pVfs);\r\n\r\n  pFile->h = INVALID_HANDLE_VALUE;\r\n\r\n  /* If the second argument to this function is NULL, generate a \r\n  ** temporary file name to use \r\n  */\r\n  if( !zUtf8Name ){\r\n    assert(isDelete && !isOpenJournal);\r\n    rc = getTempname(MAX_PATH+2, zTmpname);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    zUtf8Name = zTmpname;\r\n  }\r\n\r\n  /* Database filenames are double-zero terminated if they are not\r\n  ** URIs with parameters.  Hence, they can always be passed into\r\n  ** sqlite3_uri_parameter().\r\n  */\r\n  assert( (eType!=SQLITE_OPEN_MAIN_DB) || (flags & SQLITE_OPEN_URI) ||\r\n        zUtf8Name[strlen(zUtf8Name)+1]==0 );\r\n\r\n  /* Convert the filename to the system encoding. */\r\n  zConverted = convertUtf8Filename(zUtf8Name);\r\n  if( zConverted==0 ){\r\n    return SQLITE_IOERR_NOMEM;\r\n  }\r\n\r\n  if( isReadWrite ){\r\n    dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;\r\n  }else{\r\n    dwDesiredAccess = GENERIC_READ;\r\n  }\r\n\r\n  /* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is \r\n  ** created. SQLite doesn't use it to indicate \"exclusive access\" \r\n  ** as it is usually understood.\r\n  */\r\n  if( isExclusive ){\r\n    /* Creates a new file, only if it does not already exist. */\r\n    /* If the file exists, it fails. */\r\n    dwCreationDisposition = CREATE_NEW;\r\n  }else if( isCreate ){\r\n    /* Open existing file, or create if it doesn't exist */\r\n    dwCreationDisposition = OPEN_ALWAYS;\r\n  }else{\r\n    /* Opens a file, only if it exists. */\r\n    dwCreationDisposition = OPEN_EXISTING;\r\n  }\r\n\r\n  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;\r\n\r\n  if( isDelete ){\r\n#if SQLITE_OS_WINCE\r\n    dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN;\r\n    isTemp = 1;\r\n#else\r\n    dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY\r\n                               | FILE_ATTRIBUTE_HIDDEN\r\n                               | FILE_FLAG_DELETE_ON_CLOSE;\r\n#endif\r\n  }else{\r\n    dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;\r\n  }\r\n  /* Reports from the internet are that performance is always\r\n  ** better if FILE_FLAG_RANDOM_ACCESS is used.  Ticket #2699. */\r\n#if SQLITE_OS_WINCE\r\n  dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;\r\n#endif\r\n\r\n  if( isNT() ){\r\n    while( (h = osCreateFileW((LPCWSTR)zConverted,\r\n                              dwDesiredAccess,\r\n                              dwShareMode, NULL,\r\n                              dwCreationDisposition,\r\n                              dwFlagsAndAttributes,\r\n                              NULL))==INVALID_HANDLE_VALUE &&\r\n                              retryIoerr(&cnt, &lastErrno) ){}\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    while( (h = osCreateFileA((LPCSTR)zConverted,\r\n                              dwDesiredAccess,\r\n                              dwShareMode, NULL,\r\n                              dwCreationDisposition,\r\n                              dwFlagsAndAttributes,\r\n                              NULL))==INVALID_HANDLE_VALUE &&\r\n                              retryIoerr(&cnt, &lastErrno) ){}\r\n#endif\r\n  }\r\n\r\n  logIoerr(cnt);\r\n\r\n  OSTRACE((\"OPEN %d %s 0x%lx %s\\n\", \r\n           h, zName, dwDesiredAccess, \r\n           h==INVALID_HANDLE_VALUE ? \"failed\" : \"ok\"));\r\n\r\n  if( h==INVALID_HANDLE_VALUE ){\r\n    pFile->lastErrno = lastErrno;\r\n    winLogError(SQLITE_CANTOPEN, pFile->lastErrno, \"winOpen\", zUtf8Name);\r\n    sqlite3_free(zConverted);\r\n    if( isReadWrite && !isExclusive ){\r\n      return winOpen(pVfs, zName, id, \r\n             ((flags|SQLITE_OPEN_READONLY)&~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), pOutFlags);\r\n    }else{\r\n      return SQLITE_CANTOPEN_BKPT;\r\n    }\r\n  }\r\n\r\n  if( pOutFlags ){\r\n    if( isReadWrite ){\r\n      *pOutFlags = SQLITE_OPEN_READWRITE;\r\n    }else{\r\n      *pOutFlags = SQLITE_OPEN_READONLY;\r\n    }\r\n  }\r\n\r\n  memset(pFile, 0, sizeof(*pFile));\r\n  pFile->pMethod = &winIoMethod;\r\n  pFile->h = h;\r\n  pFile->lastErrno = NO_ERROR;\r\n  pFile->pVfs = pVfs;\r\n  pFile->pShm = 0;\r\n  pFile->zPath = zName;\r\n  if( sqlite3_uri_boolean(zName, \"psow\", SQLITE_POWERSAFE_OVERWRITE) ){\r\n    pFile->ctrlFlags |= WINFILE_PSOW;\r\n  }\r\n\r\n#if SQLITE_OS_WINCE\r\n  if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB\r\n       && !winceCreateLock(zName, pFile)\r\n  ){\r\n    osCloseHandle(h);\r\n    sqlite3_free(zConverted);\r\n    return SQLITE_CANTOPEN_BKPT;\r\n  }\r\n  if( isTemp ){\r\n    pFile->zDeleteOnClose = zConverted;\r\n  }else\r\n#endif\r\n  {\r\n    sqlite3_free(zConverted);\r\n  }\r\n\r\n  OpenCounter(+1);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Delete the named file.\r\n**\r\n** Note that Windows does not allow a file to be deleted if some other\r\n** process has it open.  Sometimes a virus scanner or indexing program\r\n** will open a journal file shortly after it is created in order to do\r\n** whatever it does.  While this other process is holding the\r\n** file open, we will be unable to delete it.  To work around this\r\n** problem, we delay 100 milliseconds and try to delete again.  Up\r\n** to MX_DELETION_ATTEMPTs deletion attempts are run before giving\r\n** up and returning an error.\r\n*/\r\nstatic int winDelete(\r\n  sqlite3_vfs *pVfs,          /* Not used on win32 */\r\n  const char *zFilename,      /* Name of file to delete */\r\n  int syncDir                 /* Not used on win32 */\r\n){\r\n  int cnt = 0;\r\n  int rc;\r\n  DWORD lastErrno;\r\n  void *zConverted;\r\n  UNUSED_PARAMETER(pVfs);\r\n  UNUSED_PARAMETER(syncDir);\r\n\r\n  SimulateIOError(return SQLITE_IOERR_DELETE);\r\n  zConverted = convertUtf8Filename(zFilename);\r\n  if( zConverted==0 ){\r\n    return SQLITE_IOERR_NOMEM;\r\n  }\r\n  if( isNT() ){\r\n    rc = 1;\r\n    while( osGetFileAttributesW(zConverted)!=INVALID_FILE_ATTRIBUTES &&\r\n         (rc = osDeleteFileW(zConverted))==0 && retryIoerr(&cnt, &lastErrno) ){}\r\n    rc = rc ? SQLITE_OK : SQLITE_ERROR;\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    rc = 1;\r\n    while( osGetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES &&\r\n         (rc = osDeleteFileA(zConverted))==0 && retryIoerr(&cnt, &lastErrno) ){}\r\n    rc = rc ? SQLITE_OK : SQLITE_ERROR;\r\n#endif\r\n  }\r\n  if( rc ){\r\n    rc = winLogError(SQLITE_IOERR_DELETE, lastErrno,\r\n             \"winDelete\", zFilename);\r\n  }else{\r\n    logIoerr(cnt);\r\n  }\r\n  sqlite3_free(zConverted);\r\n  OSTRACE((\"DELETE \\\"%s\\\" %s\\n\", zFilename, (rc ? \"failed\" : \"ok\" )));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Check the existance and status of a file.\r\n*/\r\nstatic int winAccess(\r\n  sqlite3_vfs *pVfs,         /* Not used on win32 */\r\n  const char *zFilename,     /* Name of file to check */\r\n  int flags,                 /* Type of test to make on this file */\r\n  int *pResOut               /* OUT: Result */\r\n){\r\n  DWORD attr;\r\n  int rc = 0;\r\n  DWORD lastErrno;\r\n  void *zConverted;\r\n  UNUSED_PARAMETER(pVfs);\r\n\r\n  SimulateIOError( return SQLITE_IOERR_ACCESS; );\r\n  zConverted = convertUtf8Filename(zFilename);\r\n  if( zConverted==0 ){\r\n    return SQLITE_IOERR_NOMEM;\r\n  }\r\n  if( isNT() ){\r\n    int cnt = 0;\r\n    WIN32_FILE_ATTRIBUTE_DATA sAttrData;\r\n    memset(&sAttrData, 0, sizeof(sAttrData));\r\n    while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted,\r\n                             GetFileExInfoStandard, \r\n                             &sAttrData)) && retryIoerr(&cnt, &lastErrno) ){}\r\n    if( rc ){\r\n      /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file\r\n      ** as if it does not exist.\r\n      */\r\n      if(    flags==SQLITE_ACCESS_EXISTS\r\n          && sAttrData.nFileSizeHigh==0 \r\n          && sAttrData.nFileSizeLow==0 ){\r\n        attr = INVALID_FILE_ATTRIBUTES;\r\n      }else{\r\n        attr = sAttrData.dwFileAttributes;\r\n      }\r\n    }else{\r\n      logIoerr(cnt);\r\n      if( lastErrno!=ERROR_FILE_NOT_FOUND ){\r\n        winLogError(SQLITE_IOERR_ACCESS, lastErrno, \"winAccess\", zFilename);\r\n        sqlite3_free(zConverted);\r\n        return SQLITE_IOERR_ACCESS;\r\n      }else{\r\n        attr = INVALID_FILE_ATTRIBUTES;\r\n      }\r\n    }\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    attr = osGetFileAttributesA((char*)zConverted);\r\n#endif\r\n  }\r\n  sqlite3_free(zConverted);\r\n  switch( flags ){\r\n    case SQLITE_ACCESS_READ:\r\n    case SQLITE_ACCESS_EXISTS:\r\n      rc = attr!=INVALID_FILE_ATTRIBUTES;\r\n      break;\r\n    case SQLITE_ACCESS_READWRITE:\r\n      rc = attr!=INVALID_FILE_ATTRIBUTES &&\r\n             (attr & FILE_ATTRIBUTE_READONLY)==0;\r\n      break;\r\n    default:\r\n      assert(!\"Invalid flags argument\");\r\n  }\r\n  *pResOut = rc;\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Turn a relative pathname into a full pathname.  Write the full\r\n** pathname into zOut[].  zOut[] will be at least pVfs->mxPathname\r\n** bytes in size.\r\n*/\r\nstatic int winFullPathname(\r\n  sqlite3_vfs *pVfs,            /* Pointer to vfs object */\r\n  const char *zRelative,        /* Possibly relative input path */\r\n  int nFull,                    /* Size of output buffer in bytes */\r\n  char *zFull                   /* Output buffer */\r\n){\r\n  \r\n#if defined(__CYGWIN__)\r\n  SimulateIOError( return SQLITE_ERROR );\r\n  UNUSED_PARAMETER(nFull);\r\n  cygwin_conv_to_full_win32_path(zRelative, zFull);\r\n  return SQLITE_OK;\r\n#endif\r\n\r\n#if SQLITE_OS_WINCE\r\n  SimulateIOError( return SQLITE_ERROR );\r\n  UNUSED_PARAMETER(nFull);\r\n  /* WinCE has no concept of a relative pathname, or so I am told. */\r\n  sqlite3_snprintf(pVfs->mxPathname, zFull, \"%s\", zRelative);\r\n  return SQLITE_OK;\r\n#endif\r\n\r\n#if !SQLITE_OS_WINCE && !defined(__CYGWIN__)\r\n  int nByte;\r\n  void *zConverted;\r\n  char *zOut;\r\n\r\n  /* If this path name begins with \"/X:\", where \"X\" is any alphabetic\r\n  ** character, discard the initial \"/\" from the pathname.\r\n  */\r\n  if( zRelative[0]=='/' && sqlite3Isalpha(zRelative[1]) && zRelative[2]==':' ){\r\n    zRelative++;\r\n  }\r\n\r\n  /* It's odd to simulate an io-error here, but really this is just\r\n  ** using the io-error infrastructure to test that SQLite handles this\r\n  ** function failing. This function could fail if, for example, the\r\n  ** current working directory has been unlinked.\r\n  */\r\n  SimulateIOError( return SQLITE_ERROR );\r\n  UNUSED_PARAMETER(nFull);\r\n  zConverted = convertUtf8Filename(zRelative);\r\n  if( zConverted==0 ){\r\n    return SQLITE_IOERR_NOMEM;\r\n  }\r\n  if( isNT() ){\r\n    LPWSTR zTemp;\r\n    nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0) + 3;\r\n    zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) );\r\n    if( zTemp==0 ){\r\n      sqlite3_free(zConverted);\r\n      return SQLITE_IOERR_NOMEM;\r\n    }\r\n    osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0);\r\n    sqlite3_free(zConverted);\r\n    zOut = unicodeToUtf8(zTemp);\r\n    sqlite3_free(zTemp);\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    char *zTemp;\r\n    nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0) + 3;\r\n    zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) );\r\n    if( zTemp==0 ){\r\n      sqlite3_free(zConverted);\r\n      return SQLITE_IOERR_NOMEM;\r\n    }\r\n    osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0);\r\n    sqlite3_free(zConverted);\r\n    zOut = sqlite3_win32_mbcs_to_utf8(zTemp);\r\n    sqlite3_free(zTemp);\r\n#endif\r\n  }\r\n  if( zOut ){\r\n    sqlite3_snprintf(pVfs->mxPathname, zFull, \"%s\", zOut);\r\n    sqlite3_free(zOut);\r\n    return SQLITE_OK;\r\n  }else{\r\n    return SQLITE_IOERR_NOMEM;\r\n  }\r\n#endif\r\n}\r\n\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\n/*\r\n** Interfaces for opening a shared library, finding entry points\r\n** within the shared library, and closing the shared library.\r\n*/\r\n/*\r\n** Interfaces for opening a shared library, finding entry points\r\n** within the shared library, and closing the shared library.\r\n*/\r\nstatic void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){\r\n  HANDLE h;\r\n  void *zConverted = convertUtf8Filename(zFilename);\r\n  UNUSED_PARAMETER(pVfs);\r\n  if( zConverted==0 ){\r\n    return 0;\r\n  }\r\n  if( isNT() ){\r\n    h = osLoadLibraryW((LPCWSTR)zConverted);\r\n/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. \r\n** Since the ANSI version of these Windows API do not exist for WINCE,\r\n** it's important to not reference them for WINCE builds.\r\n*/\r\n#if SQLITE_OS_WINCE==0\r\n  }else{\r\n    h = osLoadLibraryA((char*)zConverted);\r\n#endif\r\n  }\r\n  sqlite3_free(zConverted);\r\n  return (void*)h;\r\n}\r\nstatic void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){\r\n  UNUSED_PARAMETER(pVfs);\r\n  getLastErrorMsg(osGetLastError(), nBuf, zBufOut);\r\n}\r\nstatic void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){\r\n  UNUSED_PARAMETER(pVfs);\r\n  return (void(*)(void))osGetProcAddressA((HANDLE)pHandle, zSymbol);\r\n}\r\nstatic void winDlClose(sqlite3_vfs *pVfs, void *pHandle){\r\n  UNUSED_PARAMETER(pVfs);\r\n  osFreeLibrary((HANDLE)pHandle);\r\n}\r\n#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */\r\n  #define winDlOpen  0\r\n  #define winDlError 0\r\n  #define winDlSym   0\r\n  #define winDlClose 0\r\n#endif\r\n\r\n\r\n/*\r\n** Write up to nBuf bytes of randomness into zBuf.\r\n*/\r\nstatic int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){\r\n  int n = 0;\r\n  UNUSED_PARAMETER(pVfs);\r\n#if defined(SQLITE_TEST)\r\n  n = nBuf;\r\n  memset(zBuf, 0, nBuf);\r\n#else\r\n  if( sizeof(SYSTEMTIME)<=nBuf-n ){\r\n    SYSTEMTIME x;\r\n    osGetSystemTime(&x);\r\n    memcpy(&zBuf[n], &x, sizeof(x));\r\n    n += sizeof(x);\r\n  }\r\n  if( sizeof(DWORD)<=nBuf-n ){\r\n    DWORD pid = osGetCurrentProcessId();\r\n    memcpy(&zBuf[n], &pid, sizeof(pid));\r\n    n += sizeof(pid);\r\n  }\r\n  if( sizeof(DWORD)<=nBuf-n ){\r\n    DWORD cnt = osGetTickCount();\r\n    memcpy(&zBuf[n], &cnt, sizeof(cnt));\r\n    n += sizeof(cnt);\r\n  }\r\n  if( sizeof(LARGE_INTEGER)<=nBuf-n ){\r\n    LARGE_INTEGER i;\r\n    osQueryPerformanceCounter(&i);\r\n    memcpy(&zBuf[n], &i, sizeof(i));\r\n    n += sizeof(i);\r\n  }\r\n#endif\r\n  return n;\r\n}\r\n\r\n\r\n/*\r\n** Sleep for a little while.  Return the amount of time slept.\r\n*/\r\nstatic int winSleep(sqlite3_vfs *pVfs, int microsec){\r\n  osSleep((microsec+999)/1000);\r\n  UNUSED_PARAMETER(pVfs);\r\n  return ((microsec+999)/1000)*1000;\r\n}\r\n\r\n/*\r\n** The following variable, if set to a non-zero value, is interpreted as\r\n** the number of seconds since 1970 and is used to set the result of\r\n** sqlite3OsCurrentTime() during testing.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_current_time = 0;  /* Fake system time in seconds since 1970. */\r\n#endif\r\n\r\n/*\r\n** Find the current time (in Universal Coordinated Time).  Write into *piNow\r\n** the current time and date as a Julian Day number times 86_400_000.  In\r\n** other words, write into *piNow the number of milliseconds since the Julian\r\n** epoch of noon in Greenwich on November 24, 4714 B.C according to the\r\n** proleptic Gregorian calendar.\r\n**\r\n** On success, return SQLITE_OK.  Return SQLITE_ERROR if the time and date \r\n** cannot be found.\r\n*/\r\nstatic int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){\r\n  /* FILETIME structure is a 64-bit value representing the number of \r\n     100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). \r\n  */\r\n  FILETIME ft;\r\n  static const sqlite3_int64 winFiletimeEpoch = 23058135*(sqlite3_int64)8640000;\r\n#ifdef SQLITE_TEST\r\n  static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;\r\n#endif\r\n  /* 2^32 - to avoid use of LL and warnings in gcc */\r\n  static const sqlite3_int64 max32BitValue = \r\n      (sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 + (sqlite3_int64)294967296;\r\n\r\n#if SQLITE_OS_WINCE\r\n  SYSTEMTIME time;\r\n  osGetSystemTime(&time);\r\n  /* if SystemTimeToFileTime() fails, it returns zero. */\r\n  if (!osSystemTimeToFileTime(&time,&ft)){\r\n    return SQLITE_ERROR;\r\n  }\r\n#else\r\n  osGetSystemTimeAsFileTime( &ft );\r\n#endif\r\n\r\n  *piNow = winFiletimeEpoch +\r\n            ((((sqlite3_int64)ft.dwHighDateTime)*max32BitValue) + \r\n               (sqlite3_int64)ft.dwLowDateTime)/(sqlite3_int64)10000;\r\n\r\n#ifdef SQLITE_TEST\r\n  if( sqlite3_current_time ){\r\n    *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch;\r\n  }\r\n#endif\r\n  UNUSED_PARAMETER(pVfs);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Find the current time (in Universal Coordinated Time).  Write the\r\n** current time and date as a Julian Day number into *prNow and\r\n** return 0.  Return 1 if the time and date cannot be found.\r\n*/\r\nstatic int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){\r\n  int rc;\r\n  sqlite3_int64 i;\r\n  rc = winCurrentTimeInt64(pVfs, &i);\r\n  if( !rc ){\r\n    *prNow = i/86400000.0;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The idea is that this function works like a combination of\r\n** GetLastError() and FormatMessage() on Windows (or errno and\r\n** strerror_r() on Unix). After an error is returned by an OS\r\n** function, SQLite calls this function with zBuf pointing to\r\n** a buffer of nBuf bytes. The OS layer should populate the\r\n** buffer with a nul-terminated UTF-8 encoded error message\r\n** describing the last IO error to have occurred within the calling\r\n** thread.\r\n**\r\n** If the error message is too large for the supplied buffer,\r\n** it should be truncated. The return value of xGetLastError\r\n** is zero if the error message fits in the buffer, or non-zero\r\n** otherwise (if the message was truncated). If non-zero is returned,\r\n** then it is not necessary to include the nul-terminator character\r\n** in the output buffer.\r\n**\r\n** Not supplying an error message will have no adverse effect\r\n** on SQLite. It is fine to have an implementation that never\r\n** returns an error message:\r\n**\r\n**   int xGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){\r\n**     assert(zBuf[0]=='\\0');\r\n**     return 0;\r\n**   }\r\n**\r\n** However if an error message is supplied, it will be incorporated\r\n** by sqlite into the error message available to the user using\r\n** sqlite3_errmsg(), possibly making IO errors easier to debug.\r\n*/\r\nstatic int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){\r\n  UNUSED_PARAMETER(pVfs);\r\n  return getLastErrorMsg(osGetLastError(), nBuf, zBuf);\r\n}\r\n\r\n/*\r\n** Initialize and deinitialize the operating system interface.\r\n*/\r\nSQLITE_API int sqlite3_os_init(void){\r\n  static sqlite3_vfs winVfs = {\r\n    3,                   /* iVersion */\r\n    sizeof(winFile),     /* szOsFile */\r\n    MAX_PATH,            /* mxPathname */\r\n    0,                   /* pNext */\r\n    \"win32\",             /* zName */\r\n    0,                   /* pAppData */\r\n    winOpen,             /* xOpen */\r\n    winDelete,           /* xDelete */\r\n    winAccess,           /* xAccess */\r\n    winFullPathname,     /* xFullPathname */\r\n    winDlOpen,           /* xDlOpen */\r\n    winDlError,          /* xDlError */\r\n    winDlSym,            /* xDlSym */\r\n    winDlClose,          /* xDlClose */\r\n    winRandomness,       /* xRandomness */\r\n    winSleep,            /* xSleep */\r\n    winCurrentTime,      /* xCurrentTime */\r\n    winGetLastError,     /* xGetLastError */\r\n    winCurrentTimeInt64, /* xCurrentTimeInt64 */\r\n    winSetSystemCall,    /* xSetSystemCall */\r\n    winGetSystemCall,    /* xGetSystemCall */\r\n    winNextSystemCall,   /* xNextSystemCall */\r\n  };\r\n\r\n  /* Double-check that the aSyscall[] array has been constructed\r\n  ** correctly.  See ticket [bb3a86e890c8e96ab] */\r\n  assert( ArraySize(aSyscall)==60 );\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n  /* get memory map allocation granularity */\r\n  memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));\r\n  osGetSystemInfo(&winSysInfo);\r\n  assert(winSysInfo.dwAllocationGranularity > 0);\r\n#endif\r\n\r\n  sqlite3_vfs_register(&winVfs, 1);\r\n  return SQLITE_OK; \r\n}\r\n\r\nSQLITE_API int sqlite3_os_end(void){ \r\n  return SQLITE_OK;\r\n}\r\n\r\n#endif /* SQLITE_OS_WIN */\r\n\r\n/************** End of os_win.c **********************************************/\r\n/************** Begin file bitvec.c ******************************************/\r\n/*\r\n** 2008 February 16\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file implements an object that represents a fixed-length\r\n** bitmap.  Bits are numbered starting with 1.\r\n**\r\n** A bitmap is used to record which pages of a database file have been\r\n** journalled during a transaction, or which pages have the \"dont-write\"\r\n** property.  Usually only a few pages are meet either condition.\r\n** So the bitmap is usually sparse and has low cardinality.\r\n** But sometimes (for example when during a DROP of a large table) most\r\n** or all of the pages in a database can get journalled.  In those cases, \r\n** the bitmap becomes dense with high cardinality.  The algorithm needs \r\n** to handle both cases well.\r\n**\r\n** The size of the bitmap is fixed when the object is created.\r\n**\r\n** All bits are clear when the bitmap is created.  Individual bits\r\n** may be set or cleared one at a time.\r\n**\r\n** Test operations are about 100 times more common that set operations.\r\n** Clear operations are exceedingly rare.  There are usually between\r\n** 5 and 500 set operations per Bitvec object, though the number of sets can\r\n** sometimes grow into tens of thousands or larger.  The size of the\r\n** Bitvec object is the number of pages in the database file at the\r\n** start of a transaction, and is thus usually less than a few thousand,\r\n** but can be as large as 2 billion for a really big database.\r\n*/\r\n\r\n/* Size of the Bitvec structure in bytes. */\r\n#define BITVEC_SZ        512\r\n\r\n/* Round the union size down to the nearest pointer boundary, since that's how \r\n** it will be aligned within the Bitvec struct. */\r\n#define BITVEC_USIZE     (((BITVEC_SZ-(3*sizeof(u32)))/sizeof(Bitvec*))*sizeof(Bitvec*))\r\n\r\n/* Type of the array \"element\" for the bitmap representation. \r\n** Should be a power of 2, and ideally, evenly divide into BITVEC_USIZE. \r\n** Setting this to the \"natural word\" size of your CPU may improve\r\n** performance. */\r\n#define BITVEC_TELEM     u8\r\n/* Size, in bits, of the bitmap element. */\r\n#define BITVEC_SZELEM    8\r\n/* Number of elements in a bitmap array. */\r\n#define BITVEC_NELEM     (BITVEC_USIZE/sizeof(BITVEC_TELEM))\r\n/* Number of bits in the bitmap array. */\r\n#define BITVEC_NBIT      (BITVEC_NELEM*BITVEC_SZELEM)\r\n\r\n/* Number of u32 values in hash table. */\r\n#define BITVEC_NINT      (BITVEC_USIZE/sizeof(u32))\r\n/* Maximum number of entries in hash table before \r\n** sub-dividing and re-hashing. */\r\n#define BITVEC_MXHASH    (BITVEC_NINT/2)\r\n/* Hashing function for the aHash representation.\r\n** Empirical testing showed that the *37 multiplier \r\n** (an arbitrary prime)in the hash function provided \r\n** no fewer collisions than the no-op *1. */\r\n#define BITVEC_HASH(X)   (((X)*1)%BITVEC_NINT)\r\n\r\n#define BITVEC_NPTR      (BITVEC_USIZE/sizeof(Bitvec *))\r\n\r\n\r\n/*\r\n** A bitmap is an instance of the following structure.\r\n**\r\n** This bitmap records the existance of zero or more bits\r\n** with values between 1 and iSize, inclusive.\r\n**\r\n** There are three possible representations of the bitmap.\r\n** If iSize<=BITVEC_NBIT, then Bitvec.u.aBitmap[] is a straight\r\n** bitmap.  The least significant bit is bit 1.\r\n**\r\n** If iSize>BITVEC_NBIT and iDivisor==0 then Bitvec.u.aHash[] is\r\n** a hash table that will hold up to BITVEC_MXHASH distinct values.\r\n**\r\n** Otherwise, the value i is redirected into one of BITVEC_NPTR\r\n** sub-bitmaps pointed to by Bitvec.u.apSub[].  Each subbitmap\r\n** handles up to iDivisor separate values of i.  apSub[0] holds\r\n** values between 1 and iDivisor.  apSub[1] holds values between\r\n** iDivisor+1 and 2*iDivisor.  apSub[N] holds values between\r\n** N*iDivisor+1 and (N+1)*iDivisor.  Each subbitmap is normalized\r\n** to hold deal with values between 1 and iDivisor.\r\n*/\r\nstruct Bitvec {\r\n  u32 iSize;      /* Maximum bit index.  Max iSize is 4,294,967,296. */\r\n  u32 nSet;       /* Number of bits that are set - only valid for aHash\r\n                  ** element.  Max is BITVEC_NINT.  For BITVEC_SZ of 512,\r\n                  ** this would be 125. */\r\n  u32 iDivisor;   /* Number of bits handled by each apSub[] entry. */\r\n                  /* Should >=0 for apSub element. */\r\n                  /* Max iDivisor is max(u32) / BITVEC_NPTR + 1.  */\r\n                  /* For a BITVEC_SZ of 512, this would be 34,359,739. */\r\n  union {\r\n    BITVEC_TELEM aBitmap[BITVEC_NELEM];    /* Bitmap representation */\r\n    u32 aHash[BITVEC_NINT];      /* Hash table representation */\r\n    Bitvec *apSub[BITVEC_NPTR];  /* Recursive representation */\r\n  } u;\r\n};\r\n\r\n/*\r\n** Create a new bitmap object able to handle bits between 0 and iSize,\r\n** inclusive.  Return a pointer to the new object.  Return NULL if \r\n** malloc fails.\r\n*/\r\nSQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32 iSize){\r\n  Bitvec *p;\r\n  assert( sizeof(*p)==BITVEC_SZ );\r\n  p = sqlite3MallocZero( sizeof(*p) );\r\n  if( p ){\r\n    p->iSize = iSize;\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Check to see if the i-th bit is set.  Return true or false.\r\n** If p is NULL (if the bitmap has not been created) or if\r\n** i is out of range, then return false.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){\r\n  if( p==0 ) return 0;\r\n  if( i>p->iSize || i==0 ) return 0;\r\n  i--;\r\n  while( p->iDivisor ){\r\n    u32 bin = i/p->iDivisor;\r\n    i = i%p->iDivisor;\r\n    p = p->u.apSub[bin];\r\n    if (!p) {\r\n      return 0;\r\n    }\r\n  }\r\n  if( p->iSize<=BITVEC_NBIT ){\r\n    return (p->u.aBitmap[i/BITVEC_SZELEM] & (1<<(i&(BITVEC_SZELEM-1))))!=0;\r\n  } else{\r\n    u32 h = BITVEC_HASH(i++);\r\n    while( p->u.aHash[h] ){\r\n      if( p->u.aHash[h]==i ) return 1;\r\n      h = (h+1) % BITVEC_NINT;\r\n    }\r\n    return 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Set the i-th bit.  Return 0 on success and an error code if\r\n** anything goes wrong.\r\n**\r\n** This routine might cause sub-bitmaps to be allocated.  Failing\r\n** to get the memory needed to hold the sub-bitmap is the only\r\n** that can go wrong with an insert, assuming p and i are valid.\r\n**\r\n** The calling function must ensure that p is a valid Bitvec object\r\n** and that the value for \"i\" is within range of the Bitvec object.\r\n** Otherwise the behavior is undefined.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){\r\n  u32 h;\r\n  if( p==0 ) return SQLITE_OK;\r\n  assert( i>0 );\r\n  assert( i<=p->iSize );\r\n  i--;\r\n  while((p->iSize > BITVEC_NBIT) && p->iDivisor) {\r\n    u32 bin = i/p->iDivisor;\r\n    i = i%p->iDivisor;\r\n    if( p->u.apSub[bin]==0 ){\r\n      p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );\r\n      if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM;\r\n    }\r\n    p = p->u.apSub[bin];\r\n  }\r\n  if( p->iSize<=BITVEC_NBIT ){\r\n    p->u.aBitmap[i/BITVEC_SZELEM] |= 1 << (i&(BITVEC_SZELEM-1));\r\n    return SQLITE_OK;\r\n  }\r\n  h = BITVEC_HASH(i++);\r\n  /* if there wasn't a hash collision, and this doesn't */\r\n  /* completely fill the hash, then just add it without */\r\n  /* worring about sub-dividing and re-hashing. */\r\n  if( !p->u.aHash[h] ){\r\n    if (p->nSet<(BITVEC_NINT-1)) {\r\n      goto bitvec_set_end;\r\n    } else {\r\n      goto bitvec_set_rehash;\r\n    }\r\n  }\r\n  /* there was a collision, check to see if it's already */\r\n  /* in hash, if not, try to find a spot for it */\r\n  do {\r\n    if( p->u.aHash[h]==i ) return SQLITE_OK;\r\n    h++;\r\n    if( h>=BITVEC_NINT ) h = 0;\r\n  } while( p->u.aHash[h] );\r\n  /* we didn't find it in the hash.  h points to the first */\r\n  /* available free spot. check to see if this is going to */\r\n  /* make our hash too \"full\".  */\r\nbitvec_set_rehash:\r\n  if( p->nSet>=BITVEC_MXHASH ){\r\n    unsigned int j;\r\n    int rc;\r\n    u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));\r\n    if( aiValues==0 ){\r\n      return SQLITE_NOMEM;\r\n    }else{\r\n      memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));\r\n      memset(p->u.apSub, 0, sizeof(p->u.apSub));\r\n      p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR;\r\n      rc = sqlite3BitvecSet(p, i);\r\n      for(j=0; j<BITVEC_NINT; j++){\r\n        if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);\r\n      }\r\n      sqlite3StackFree(0, aiValues);\r\n      return rc;\r\n    }\r\n  }\r\nbitvec_set_end:\r\n  p->nSet++;\r\n  p->u.aHash[h] = i;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Clear the i-th bit.\r\n**\r\n** pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage\r\n** that BitvecClear can use to rebuilt its hash table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){\r\n  if( p==0 ) return;\r\n  assert( i>0 );\r\n  i--;\r\n  while( p->iDivisor ){\r\n    u32 bin = i/p->iDivisor;\r\n    i = i%p->iDivisor;\r\n    p = p->u.apSub[bin];\r\n    if (!p) {\r\n      return;\r\n    }\r\n  }\r\n  if( p->iSize<=BITVEC_NBIT ){\r\n    p->u.aBitmap[i/BITVEC_SZELEM] &= ~(1 << (i&(BITVEC_SZELEM-1)));\r\n  }else{\r\n    unsigned int j;\r\n    u32 *aiValues = pBuf;\r\n    memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));\r\n    memset(p->u.aHash, 0, sizeof(p->u.aHash));\r\n    p->nSet = 0;\r\n    for(j=0; j<BITVEC_NINT; j++){\r\n      if( aiValues[j] && aiValues[j]!=(i+1) ){\r\n        u32 h = BITVEC_HASH(aiValues[j]-1);\r\n        p->nSet++;\r\n        while( p->u.aHash[h] ){\r\n          h++;\r\n          if( h>=BITVEC_NINT ) h = 0;\r\n        }\r\n        p->u.aHash[h] = aiValues[j];\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Destroy a bitmap object.  Reclaim all memory used.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec *p){\r\n  if( p==0 ) return;\r\n  if( p->iDivisor ){\r\n    unsigned int i;\r\n    for(i=0; i<BITVEC_NPTR; i++){\r\n      sqlite3BitvecDestroy(p->u.apSub[i]);\r\n    }\r\n  }\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** Return the value of the iSize parameter specified when Bitvec *p\r\n** was created.\r\n*/\r\nSQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec *p){\r\n  return p->iSize;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\n/*\r\n** Let V[] be an array of unsigned characters sufficient to hold\r\n** up to N bits.  Let I be an integer between 0 and N.  0<=I<N.\r\n** Then the following macros can be used to set, clear, or test\r\n** individual bits within V.\r\n*/\r\n#define SETBIT(V,I)      V[I>>3] |= (1<<(I&7))\r\n#define CLEARBIT(V,I)    V[I>>3] &= ~(1<<(I&7))\r\n#define TESTBIT(V,I)     (V[I>>3]&(1<<(I&7)))!=0\r\n\r\n/*\r\n** This routine runs an extensive test of the Bitvec code.\r\n**\r\n** The input is an array of integers that acts as a program\r\n** to test the Bitvec.  The integers are opcodes followed\r\n** by 0, 1, or 3 operands, depending on the opcode.  Another\r\n** opcode follows immediately after the last operand.\r\n**\r\n** There are 6 opcodes numbered from 0 through 5.  0 is the\r\n** \"halt\" opcode and causes the test to end.\r\n**\r\n**    0          Halt and return the number of errors\r\n**    1 N S X    Set N bits beginning with S and incrementing by X\r\n**    2 N S X    Clear N bits beginning with S and incrementing by X\r\n**    3 N        Set N randomly chosen bits\r\n**    4 N        Clear N randomly chosen bits\r\n**    5 N S X    Set N bits from S increment X in array only, not in bitvec\r\n**\r\n** The opcodes 1 through 4 perform set and clear operations are performed\r\n** on both a Bitvec object and on a linear array of bits obtained from malloc.\r\n** Opcode 5 works on the linear array only, not on the Bitvec.\r\n** Opcode 5 is used to deliberately induce a fault in order to\r\n** confirm that error detection works.\r\n**\r\n** At the conclusion of the test the linear array is compared\r\n** against the Bitvec object.  If there are any differences,\r\n** an error is returned.  If they are the same, zero is returned.\r\n**\r\n** If a memory allocation error occurs, return -1.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){\r\n  Bitvec *pBitvec = 0;\r\n  unsigned char *pV = 0;\r\n  int rc = -1;\r\n  int i, nx, pc, op;\r\n  void *pTmpSpace;\r\n\r\n  /* Allocate the Bitvec to be tested and a linear array of\r\n  ** bits to act as the reference */\r\n  pBitvec = sqlite3BitvecCreate( sz );\r\n  pV = sqlite3_malloc( (sz+7)/8 + 1 );\r\n  pTmpSpace = sqlite3_malloc(BITVEC_SZ);\r\n  if( pBitvec==0 || pV==0 || pTmpSpace==0  ) goto bitvec_end;\r\n  memset(pV, 0, (sz+7)/8 + 1);\r\n\r\n  /* NULL pBitvec tests */\r\n  sqlite3BitvecSet(0, 1);\r\n  sqlite3BitvecClear(0, 1, pTmpSpace);\r\n\r\n  /* Run the program */\r\n  pc = 0;\r\n  while( (op = aOp[pc])!=0 ){\r\n    switch( op ){\r\n      case 1:\r\n      case 2:\r\n      case 5: {\r\n        nx = 4;\r\n        i = aOp[pc+2] - 1;\r\n        aOp[pc+2] += aOp[pc+3];\r\n        break;\r\n      }\r\n      case 3:\r\n      case 4: \r\n      default: {\r\n        nx = 2;\r\n        sqlite3_randomness(sizeof(i), &i);\r\n        break;\r\n      }\r\n    }\r\n    if( (--aOp[pc+1]) > 0 ) nx = 0;\r\n    pc += nx;\r\n    i = (i & 0x7fffffff)%sz;\r\n    if( (op & 1)!=0 ){\r\n      SETBIT(pV, (i+1));\r\n      if( op!=5 ){\r\n        if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end;\r\n      }\r\n    }else{\r\n      CLEARBIT(pV, (i+1));\r\n      sqlite3BitvecClear(pBitvec, i+1, pTmpSpace);\r\n    }\r\n  }\r\n\r\n  /* Test to make sure the linear array exactly matches the\r\n  ** Bitvec object.  Start with the assumption that they do\r\n  ** match (rc==0).  Change rc to non-zero if a discrepancy\r\n  ** is found.\r\n  */\r\n  rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1)\r\n          + sqlite3BitvecTest(pBitvec, 0)\r\n          + (sqlite3BitvecSize(pBitvec) - sz);\r\n  for(i=1; i<=sz; i++){\r\n    if(  (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){\r\n      rc = i;\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* Free allocated structure */\r\nbitvec_end:\r\n  sqlite3_free(pTmpSpace);\r\n  sqlite3_free(pV);\r\n  sqlite3BitvecDestroy(pBitvec);\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_BUILTIN_TEST */\r\n\r\n/************** End of bitvec.c **********************************************/\r\n/************** Begin file pcache.c ******************************************/\r\n/*\r\n** 2008 August 05\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file implements that page cache.\r\n*/\r\n\r\n/*\r\n** A complete page cache is an instance of this structure.\r\n*/\r\nstruct PCache {\r\n  PgHdr *pDirty, *pDirtyTail;         /* List of dirty pages in LRU order */\r\n  PgHdr *pSynced;                     /* Last synced page in dirty page list */\r\n  int nRef;                           /* Number of referenced pages */\r\n  int szCache;                        /* Configured cache size */\r\n  int szPage;                         /* Size of every page in this cache */\r\n  int szExtra;                        /* Size of extra space for each page */\r\n  int bPurgeable;                     /* True if pages are on backing store */\r\n  int (*xStress)(void*,PgHdr*);       /* Call to try make a page clean */\r\n  void *pStress;                      /* Argument to xStress */\r\n  sqlite3_pcache *pCache;             /* Pluggable cache module */\r\n  PgHdr *pPage1;                      /* Reference to page 1 */\r\n};\r\n\r\n/*\r\n** Some of the assert() macros in this code are too expensive to run\r\n** even during normal debugging.  Use them only rarely on long-running\r\n** tests.  Enable the expensive asserts using the\r\n** -DSQLITE_ENABLE_EXPENSIVE_ASSERT=1 compile-time option.\r\n*/\r\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\r\n# define expensive_assert(X)  assert(X)\r\n#else\r\n# define expensive_assert(X)\r\n#endif\r\n\r\n/********************************** Linked List Management ********************/\r\n\r\n#if !defined(NDEBUG) && defined(SQLITE_ENABLE_EXPENSIVE_ASSERT)\r\n/*\r\n** Check that the pCache->pSynced variable is set correctly. If it\r\n** is not, either fail an assert or return zero. Otherwise, return\r\n** non-zero. This is only used in debugging builds, as follows:\r\n**\r\n**   expensive_assert( pcacheCheckSynced(pCache) );\r\n*/\r\nstatic int pcacheCheckSynced(PCache *pCache){\r\n  PgHdr *p;\r\n  for(p=pCache->pDirtyTail; p!=pCache->pSynced; p=p->pDirtyPrev){\r\n    assert( p->nRef || (p->flags&PGHDR_NEED_SYNC) );\r\n  }\r\n  return (p==0 || p->nRef || (p->flags&PGHDR_NEED_SYNC)==0);\r\n}\r\n#endif /* !NDEBUG && SQLITE_ENABLE_EXPENSIVE_ASSERT */\r\n\r\n/*\r\n** Remove page pPage from the list of dirty pages.\r\n*/\r\nstatic void pcacheRemoveFromDirtyList(PgHdr *pPage){\r\n  PCache *p = pPage->pCache;\r\n\r\n  assert( pPage->pDirtyNext || pPage==p->pDirtyTail );\r\n  assert( pPage->pDirtyPrev || pPage==p->pDirty );\r\n\r\n  /* Update the PCache1.pSynced variable if necessary. */\r\n  if( p->pSynced==pPage ){\r\n    PgHdr *pSynced = pPage->pDirtyPrev;\r\n    while( pSynced && (pSynced->flags&PGHDR_NEED_SYNC) ){\r\n      pSynced = pSynced->pDirtyPrev;\r\n    }\r\n    p->pSynced = pSynced;\r\n  }\r\n\r\n  if( pPage->pDirtyNext ){\r\n    pPage->pDirtyNext->pDirtyPrev = pPage->pDirtyPrev;\r\n  }else{\r\n    assert( pPage==p->pDirtyTail );\r\n    p->pDirtyTail = pPage->pDirtyPrev;\r\n  }\r\n  if( pPage->pDirtyPrev ){\r\n    pPage->pDirtyPrev->pDirtyNext = pPage->pDirtyNext;\r\n  }else{\r\n    assert( pPage==p->pDirty );\r\n    p->pDirty = pPage->pDirtyNext;\r\n  }\r\n  pPage->pDirtyNext = 0;\r\n  pPage->pDirtyPrev = 0;\r\n\r\n  expensive_assert( pcacheCheckSynced(p) );\r\n}\r\n\r\n/*\r\n** Add page pPage to the head of the dirty list (PCache1.pDirty is set to\r\n** pPage).\r\n*/\r\nstatic void pcacheAddToDirtyList(PgHdr *pPage){\r\n  PCache *p = pPage->pCache;\r\n\r\n  assert( pPage->pDirtyNext==0 && pPage->pDirtyPrev==0 && p->pDirty!=pPage );\r\n\r\n  pPage->pDirtyNext = p->pDirty;\r\n  if( pPage->pDirtyNext ){\r\n    assert( pPage->pDirtyNext->pDirtyPrev==0 );\r\n    pPage->pDirtyNext->pDirtyPrev = pPage;\r\n  }\r\n  p->pDirty = pPage;\r\n  if( !p->pDirtyTail ){\r\n    p->pDirtyTail = pPage;\r\n  }\r\n  if( !p->pSynced && 0==(pPage->flags&PGHDR_NEED_SYNC) ){\r\n    p->pSynced = pPage;\r\n  }\r\n  expensive_assert( pcacheCheckSynced(p) );\r\n}\r\n\r\n/*\r\n** Wrapper around the pluggable caches xUnpin method. If the cache is\r\n** being used for an in-memory database, this function is a no-op.\r\n*/\r\nstatic void pcacheUnpin(PgHdr *p){\r\n  PCache *pCache = p->pCache;\r\n  if( pCache->bPurgeable ){\r\n    if( p->pgno==1 ){\r\n      pCache->pPage1 = 0;\r\n    }\r\n    sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 0);\r\n  }\r\n}\r\n\r\n/*************************************************** General Interfaces ******\r\n**\r\n** Initialize and shutdown the page cache subsystem. Neither of these \r\n** functions are threadsafe.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheInitialize(void){\r\n  if( sqlite3GlobalConfig.pcache2.xInit==0 ){\r\n    /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the\r\n    ** built-in default page cache is used instead of the application defined\r\n    ** page cache. */\r\n    sqlite3PCacheSetDefault();\r\n  }\r\n  return sqlite3GlobalConfig.pcache2.xInit(sqlite3GlobalConfig.pcache2.pArg);\r\n}\r\nSQLITE_PRIVATE void sqlite3PcacheShutdown(void){\r\n  if( sqlite3GlobalConfig.pcache2.xShutdown ){\r\n    /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */\r\n    sqlite3GlobalConfig.pcache2.xShutdown(sqlite3GlobalConfig.pcache2.pArg);\r\n  }\r\n}\r\n\r\n/*\r\n** Return the size in bytes of a PCache object.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheSize(void){ return sizeof(PCache); }\r\n\r\n/*\r\n** Create a new PCache object. Storage space to hold the object\r\n** has already been allocated and is passed in as the p pointer. \r\n** The caller discovers how much space needs to be allocated by \r\n** calling sqlite3PcacheSize().\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheOpen(\r\n  int szPage,                  /* Size of every page */\r\n  int szExtra,                 /* Extra space associated with each page */\r\n  int bPurgeable,              /* True if pages are on backing store */\r\n  int (*xStress)(void*,PgHdr*),/* Call to try to make pages clean */\r\n  void *pStress,               /* Argument to xStress */\r\n  PCache *p                    /* Preallocated space for the PCache */\r\n){\r\n  memset(p, 0, sizeof(PCache));\r\n  p->szPage = szPage;\r\n  p->szExtra = szExtra;\r\n  p->bPurgeable = bPurgeable;\r\n  p->xStress = xStress;\r\n  p->pStress = pStress;\r\n  p->szCache = 100;\r\n}\r\n\r\n/*\r\n** Change the page size for PCache object. The caller must ensure that there\r\n** are no outstanding page references when this function is called.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *pCache, int szPage){\r\n  assert( pCache->nRef==0 && pCache->pDirty==0 );\r\n  if( pCache->pCache ){\r\n    sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);\r\n    pCache->pCache = 0;\r\n    pCache->pPage1 = 0;\r\n  }\r\n  pCache->szPage = szPage;\r\n}\r\n\r\n/*\r\n** Compute the number of pages of cache requested.\r\n*/\r\nstatic int numberOfCachePages(PCache *p){\r\n  if( p->szCache>=0 ){\r\n    return p->szCache;\r\n  }else{\r\n    return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));\r\n  }\r\n}\r\n\r\n/*\r\n** Try to obtain a page from the cache.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheFetch(\r\n  PCache *pCache,       /* Obtain the page from this cache */\r\n  Pgno pgno,            /* Page number to obtain */\r\n  int createFlag,       /* If true, create page if it does not exist already */\r\n  PgHdr **ppPage        /* Write the page here */\r\n){\r\n  sqlite3_pcache_page *pPage = 0;\r\n  PgHdr *pPgHdr = 0;\r\n  int eCreate;\r\n\r\n  assert( pCache!=0 );\r\n  assert( createFlag==1 || createFlag==0 );\r\n  assert( pgno>0 );\r\n\r\n  /* If the pluggable cache (sqlite3_pcache*) has not been allocated,\r\n  ** allocate it now.\r\n  */\r\n  if( !pCache->pCache && createFlag ){\r\n    sqlite3_pcache *p;\r\n    p = sqlite3GlobalConfig.pcache2.xCreate(\r\n        pCache->szPage, pCache->szExtra + sizeof(PgHdr), pCache->bPurgeable\r\n    );\r\n    if( !p ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    sqlite3GlobalConfig.pcache2.xCachesize(p, numberOfCachePages(pCache));\r\n    pCache->pCache = p;\r\n  }\r\n\r\n  eCreate = createFlag * (1 + (!pCache->bPurgeable || !pCache->pDirty));\r\n  if( pCache->pCache ){\r\n    pPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate);\r\n  }\r\n\r\n  if( !pPage && eCreate==1 ){\r\n    PgHdr *pPg;\r\n\r\n    /* Find a dirty page to write-out and recycle. First try to find a \r\n    ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC\r\n    ** cleared), but if that is not possible settle for any other \r\n    ** unreferenced dirty page.\r\n    */\r\n    expensive_assert( pcacheCheckSynced(pCache) );\r\n    for(pPg=pCache->pSynced; \r\n        pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC)); \r\n        pPg=pPg->pDirtyPrev\r\n    );\r\n    pCache->pSynced = pPg;\r\n    if( !pPg ){\r\n      for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);\r\n    }\r\n    if( pPg ){\r\n      int rc;\r\n#ifdef SQLITE_LOG_CACHE_SPILL\r\n      sqlite3_log(SQLITE_FULL, \r\n                  \"spill page %d making room for %d - cache used: %d/%d\",\r\n                  pPg->pgno, pgno,\r\n                  sqlite3GlobalConfig.pcache.xPagecount(pCache->pCache),\r\n                  numberOfCachePages(pCache));\r\n#endif\r\n      rc = pCache->xStress(pCache->pStress, pPg);\r\n      if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){\r\n        return rc;\r\n      }\r\n    }\r\n\r\n    pPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);\r\n  }\r\n\r\n  if( pPage ){\r\n    pPgHdr = (PgHdr *)pPage->pExtra;\r\n\r\n    if( !pPgHdr->pPage ){\r\n      memset(pPgHdr, 0, sizeof(PgHdr));\r\n      pPgHdr->pPage = pPage;\r\n      pPgHdr->pData = pPage->pBuf;\r\n      pPgHdr->pExtra = (void *)&pPgHdr[1];\r\n      memset(pPgHdr->pExtra, 0, pCache->szExtra);\r\n      pPgHdr->pCache = pCache;\r\n      pPgHdr->pgno = pgno;\r\n    }\r\n    assert( pPgHdr->pCache==pCache );\r\n    assert( pPgHdr->pgno==pgno );\r\n    assert( pPgHdr->pData==pPage->pBuf );\r\n    assert( pPgHdr->pExtra==(void *)&pPgHdr[1] );\r\n\r\n    if( 0==pPgHdr->nRef ){\r\n      pCache->nRef++;\r\n    }\r\n    pPgHdr->nRef++;\r\n    if( pgno==1 ){\r\n      pCache->pPage1 = pPgHdr;\r\n    }\r\n  }\r\n  *ppPage = pPgHdr;\r\n  return (pPgHdr==0 && eCreate) ? SQLITE_NOMEM : SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Decrement the reference count on a page. If the page is clean and the\r\n** reference count drops to 0, then it is made elible for recycling.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr *p){\r\n  assert( p->nRef>0 );\r\n  p->nRef--;\r\n  if( p->nRef==0 ){\r\n    PCache *pCache = p->pCache;\r\n    pCache->nRef--;\r\n    if( (p->flags&PGHDR_DIRTY)==0 ){\r\n      pcacheUnpin(p);\r\n    }else{\r\n      /* Move the page to the head of the dirty list. */\r\n      pcacheRemoveFromDirtyList(p);\r\n      pcacheAddToDirtyList(p);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Increase the reference count of a supplied page by 1.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheRef(PgHdr *p){\r\n  assert(p->nRef>0);\r\n  p->nRef++;\r\n}\r\n\r\n/*\r\n** Drop a page from the cache. There must be exactly one reference to the\r\n** page. This function deletes that reference, so after it returns the\r\n** page pointed to by p is invalid.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){\r\n  PCache *pCache;\r\n  assert( p->nRef==1 );\r\n  if( p->flags&PGHDR_DIRTY ){\r\n    pcacheRemoveFromDirtyList(p);\r\n  }\r\n  pCache = p->pCache;\r\n  pCache->nRef--;\r\n  if( p->pgno==1 ){\r\n    pCache->pPage1 = 0;\r\n  }\r\n  sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 1);\r\n}\r\n\r\n/*\r\n** Make sure the page is marked as dirty. If it isn't dirty already,\r\n** make it so.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){\r\n  p->flags &= ~PGHDR_DONT_WRITE;\r\n  assert( p->nRef>0 );\r\n  if( 0==(p->flags & PGHDR_DIRTY) ){\r\n    p->flags |= PGHDR_DIRTY;\r\n    pcacheAddToDirtyList( p);\r\n  }\r\n}\r\n\r\n/*\r\n** Make sure the page is marked as clean. If it isn't clean already,\r\n** make it so.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){\r\n  if( (p->flags & PGHDR_DIRTY) ){\r\n    pcacheRemoveFromDirtyList(p);\r\n    p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC);\r\n    if( p->nRef==0 ){\r\n      pcacheUnpin(p);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Make every page in the cache clean.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache *pCache){\r\n  PgHdr *p;\r\n  while( (p = pCache->pDirty)!=0 ){\r\n    sqlite3PcacheMakeClean(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Clear the PGHDR_NEED_SYNC flag from all dirty pages.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){\r\n  PgHdr *p;\r\n  for(p=pCache->pDirty; p; p=p->pDirtyNext){\r\n    p->flags &= ~PGHDR_NEED_SYNC;\r\n  }\r\n  pCache->pSynced = pCache->pDirtyTail;\r\n}\r\n\r\n/*\r\n** Change the page number of page p to newPgno. \r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){\r\n  PCache *pCache = p->pCache;\r\n  assert( p->nRef>0 );\r\n  assert( newPgno>0 );\r\n  sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);\r\n  p->pgno = newPgno;\r\n  if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){\r\n    pcacheRemoveFromDirtyList(p);\r\n    pcacheAddToDirtyList(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Drop every cache entry whose page number is greater than \"pgno\". The\r\n** caller must ensure that there are no outstanding references to any pages\r\n** other than page 1 with a page number greater than pgno.\r\n**\r\n** If there is a reference to page 1 and the pgno parameter passed to this\r\n** function is 0, then the data area associated with page 1 is zeroed, but\r\n** the page object is not dropped.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){\r\n  if( pCache->pCache ){\r\n    PgHdr *p;\r\n    PgHdr *pNext;\r\n    for(p=pCache->pDirty; p; p=pNext){\r\n      pNext = p->pDirtyNext;\r\n      /* This routine never gets call with a positive pgno except right\r\n      ** after sqlite3PcacheCleanAll().  So if there are dirty pages,\r\n      ** it must be that pgno==0.\r\n      */\r\n      assert( p->pgno>0 );\r\n      if( ALWAYS(p->pgno>pgno) ){\r\n        assert( p->flags&PGHDR_DIRTY );\r\n        sqlite3PcacheMakeClean(p);\r\n      }\r\n    }\r\n    if( pgno==0 && pCache->pPage1 ){\r\n      memset(pCache->pPage1->pData, 0, pCache->szPage);\r\n      pgno = 1;\r\n    }\r\n    sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1);\r\n  }\r\n}\r\n\r\n/*\r\n** Close a cache.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheClose(PCache *pCache){\r\n  if( pCache->pCache ){\r\n    sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);\r\n  }\r\n}\r\n\r\n/* \r\n** Discard the contents of the cache.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheClear(PCache *pCache){\r\n  sqlite3PcacheTruncate(pCache, 0);\r\n}\r\n\r\n/*\r\n** Merge two lists of pages connected by pDirty and in pgno order.\r\n** Do not both fixing the pDirtyPrev pointers.\r\n*/\r\nstatic PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){\r\n  PgHdr result, *pTail;\r\n  pTail = &result;\r\n  while( pA && pB ){\r\n    if( pA->pgno<pB->pgno ){\r\n      pTail->pDirty = pA;\r\n      pTail = pA;\r\n      pA = pA->pDirty;\r\n    }else{\r\n      pTail->pDirty = pB;\r\n      pTail = pB;\r\n      pB = pB->pDirty;\r\n    }\r\n  }\r\n  if( pA ){\r\n    pTail->pDirty = pA;\r\n  }else if( pB ){\r\n    pTail->pDirty = pB;\r\n  }else{\r\n    pTail->pDirty = 0;\r\n  }\r\n  return result.pDirty;\r\n}\r\n\r\n/*\r\n** Sort the list of pages in accending order by pgno.  Pages are\r\n** connected by pDirty pointers.  The pDirtyPrev pointers are\r\n** corrupted by this sort.\r\n**\r\n** Since there cannot be more than 2^31 distinct pages in a database,\r\n** there cannot be more than 31 buckets required by the merge sorter.\r\n** One extra bucket is added to catch overflow in case something\r\n** ever changes to make the previous sentence incorrect.\r\n*/\r\n#define N_SORT_BUCKET  32\r\nstatic PgHdr *pcacheSortDirtyList(PgHdr *pIn){\r\n  PgHdr *a[N_SORT_BUCKET], *p;\r\n  int i;\r\n  memset(a, 0, sizeof(a));\r\n  while( pIn ){\r\n    p = pIn;\r\n    pIn = p->pDirty;\r\n    p->pDirty = 0;\r\n    for(i=0; ALWAYS(i<N_SORT_BUCKET-1); i++){\r\n      if( a[i]==0 ){\r\n        a[i] = p;\r\n        break;\r\n      }else{\r\n        p = pcacheMergeDirtyList(a[i], p);\r\n        a[i] = 0;\r\n      }\r\n    }\r\n    if( NEVER(i==N_SORT_BUCKET-1) ){\r\n      /* To get here, there need to be 2^(N_SORT_BUCKET) elements in\r\n      ** the input list.  But that is impossible.\r\n      */\r\n      a[i] = pcacheMergeDirtyList(a[i], p);\r\n    }\r\n  }\r\n  p = a[0];\r\n  for(i=1; i<N_SORT_BUCKET; i++){\r\n    p = pcacheMergeDirtyList(p, a[i]);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Return a list of all dirty pages in the cache, sorted by page number.\r\n*/\r\nSQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache *pCache){\r\n  PgHdr *p;\r\n  for(p=pCache->pDirty; p; p=p->pDirtyNext){\r\n    p->pDirty = p->pDirtyNext;\r\n  }\r\n  return pcacheSortDirtyList(pCache->pDirty);\r\n}\r\n\r\n/* \r\n** Return the total number of referenced pages held by the cache.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){\r\n  return pCache->nRef;\r\n}\r\n\r\n/*\r\n** Return the number of references to the page supplied as an argument.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){\r\n  return p->nRef;\r\n}\r\n\r\n/* \r\n** Return the total number of pages in the cache.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcachePagecount(PCache *pCache){\r\n  int nPage = 0;\r\n  if( pCache->pCache ){\r\n    nPage = sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache);\r\n  }\r\n  return nPage;\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** Get the suggested cache-size value.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *pCache){\r\n  return numberOfCachePages(pCache);\r\n}\r\n#endif\r\n\r\n/*\r\n** Set the suggested cache-size value.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){\r\n  pCache->szCache = mxPage;\r\n  if( pCache->pCache ){\r\n    sqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache,\r\n                                           numberOfCachePages(pCache));\r\n  }\r\n}\r\n\r\n/*\r\n** Free up as much memory as possible from the page cache.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){\r\n  if( pCache->pCache ){\r\n    sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache);\r\n  }\r\n}\r\n\r\n#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)\r\n/*\r\n** For all dirty pages currently in the cache, invoke the specified\r\n** callback. This is only used if the SQLITE_CHECK_PAGES macro is\r\n** defined.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)){\r\n  PgHdr *pDirty;\r\n  for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext){\r\n    xIter(pDirty);\r\n  }\r\n}\r\n#endif\r\n\r\n/************** End of pcache.c **********************************************/\r\n/************** Begin file pcache1.c *****************************************/\r\n/*\r\n** 2008 November 05\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file implements the default page cache implementation (the\r\n** sqlite3_pcache interface). It also contains part of the implementation\r\n** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.\r\n** If the default page cache implementation is overriden, then neither of\r\n** these two features are available.\r\n*/\r\n\r\n\r\ntypedef struct PCache1 PCache1;\r\ntypedef struct PgHdr1 PgHdr1;\r\ntypedef struct PgFreeslot PgFreeslot;\r\ntypedef struct PGroup PGroup;\r\n\r\n/* Each page cache (or PCache) belongs to a PGroup.  A PGroup is a set \r\n** of one or more PCaches that are able to recycle each others unpinned\r\n** pages when they are under memory pressure.  A PGroup is an instance of\r\n** the following object.\r\n**\r\n** This page cache implementation works in one of two modes:\r\n**\r\n**   (1)  Every PCache is the sole member of its own PGroup.  There is\r\n**        one PGroup per PCache.\r\n**\r\n**   (2)  There is a single global PGroup that all PCaches are a member\r\n**        of.\r\n**\r\n** Mode 1 uses more memory (since PCache instances are not able to rob\r\n** unused pages from other PCaches) but it also operates without a mutex,\r\n** and is therefore often faster.  Mode 2 requires a mutex in order to be\r\n** threadsafe, but recycles pages more efficiently.\r\n**\r\n** For mode (1), PGroup.mutex is NULL.  For mode (2) there is only a single\r\n** PGroup which is the pcache1.grp global variable and its mutex is\r\n** SQLITE_MUTEX_STATIC_LRU.\r\n*/\r\nstruct PGroup {\r\n  sqlite3_mutex *mutex;          /* MUTEX_STATIC_LRU or NULL */\r\n  unsigned int nMaxPage;         /* Sum of nMax for purgeable caches */\r\n  unsigned int nMinPage;         /* Sum of nMin for purgeable caches */\r\n  unsigned int mxPinned;         /* nMaxpage + 10 - nMinPage */\r\n  unsigned int nCurrentPage;     /* Number of purgeable pages allocated */\r\n  PgHdr1 *pLruHead, *pLruTail;   /* LRU list of unpinned pages */\r\n};\r\n\r\n/* Each page cache is an instance of the following object.  Every\r\n** open database file (including each in-memory database and each\r\n** temporary or transient database) has a single page cache which\r\n** is an instance of this object.\r\n**\r\n** Pointers to structures of this type are cast and returned as \r\n** opaque sqlite3_pcache* handles.\r\n*/\r\nstruct PCache1 {\r\n  /* Cache configuration parameters. Page size (szPage) and the purgeable\r\n  ** flag (bPurgeable) are set when the cache is created. nMax may be \r\n  ** modified at any time by a call to the pcache1Cachesize() method.\r\n  ** The PGroup mutex must be held when accessing nMax.\r\n  */\r\n  PGroup *pGroup;                     /* PGroup this cache belongs to */\r\n  int szPage;                         /* Size of allocated pages in bytes */\r\n  int szExtra;                        /* Size of extra space in bytes */\r\n  int bPurgeable;                     /* True if cache is purgeable */\r\n  unsigned int nMin;                  /* Minimum number of pages reserved */\r\n  unsigned int nMax;                  /* Configured \"cache_size\" value */\r\n  unsigned int n90pct;                /* nMax*9/10 */\r\n  unsigned int iMaxKey;               /* Largest key seen since xTruncate() */\r\n\r\n  /* Hash table of all pages. The following variables may only be accessed\r\n  ** when the accessor is holding the PGroup mutex.\r\n  */\r\n  unsigned int nRecyclable;           /* Number of pages in the LRU list */\r\n  unsigned int nPage;                 /* Total number of pages in apHash */\r\n  unsigned int nHash;                 /* Number of slots in apHash[] */\r\n  PgHdr1 **apHash;                    /* Hash table for fast lookup by key */\r\n};\r\n\r\n/*\r\n** Each cache entry is represented by an instance of the following \r\n** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of\r\n** PgHdr1.pCache->szPage bytes is allocated directly before this structure \r\n** in memory.\r\n*/\r\nstruct PgHdr1 {\r\n  sqlite3_pcache_page page;\r\n  unsigned int iKey;             /* Key value (page number) */\r\n  PgHdr1 *pNext;                 /* Next in hash table chain */\r\n  PCache1 *pCache;               /* Cache that currently owns this page */\r\n  PgHdr1 *pLruNext;              /* Next in LRU list of unpinned pages */\r\n  PgHdr1 *pLruPrev;              /* Previous in LRU list of unpinned pages */\r\n};\r\n\r\n/*\r\n** Free slots in the allocator used to divide up the buffer provided using\r\n** the SQLITE_CONFIG_PAGECACHE mechanism.\r\n*/\r\nstruct PgFreeslot {\r\n  PgFreeslot *pNext;  /* Next free slot */\r\n};\r\n\r\n/*\r\n** Global data used by this cache.\r\n*/\r\nstatic SQLITE_WSD struct PCacheGlobal {\r\n  PGroup grp;                    /* The global PGroup for mode (2) */\r\n\r\n  /* Variables related to SQLITE_CONFIG_PAGECACHE settings.  The\r\n  ** szSlot, nSlot, pStart, pEnd, nReserve, and isInit values are all\r\n  ** fixed at sqlite3_initialize() time and do not require mutex protection.\r\n  ** The nFreeSlot and pFree values do require mutex protection.\r\n  */\r\n  int isInit;                    /* True if initialized */\r\n  int szSlot;                    /* Size of each free slot */\r\n  int nSlot;                     /* The number of pcache slots */\r\n  int nReserve;                  /* Try to keep nFreeSlot above this */\r\n  void *pStart, *pEnd;           /* Bounds of pagecache malloc range */\r\n  /* Above requires no mutex.  Use mutex below for variable that follow. */\r\n  sqlite3_mutex *mutex;          /* Mutex for accessing the following: */\r\n  PgFreeslot *pFree;             /* Free page blocks */\r\n  int nFreeSlot;                 /* Number of unused pcache slots */\r\n  /* The following value requires a mutex to change.  We skip the mutex on\r\n  ** reading because (1) most platforms read a 32-bit integer atomically and\r\n  ** (2) even if an incorrect value is read, no great harm is done since this\r\n  ** is really just an optimization. */\r\n  int bUnderPressure;            /* True if low on PAGECACHE memory */\r\n} pcache1_g;\r\n\r\n/*\r\n** All code in this file should access the global structure above via the\r\n** alias \"pcache1\". This ensures that the WSD emulation is used when\r\n** compiling for systems that do not support real WSD.\r\n*/\r\n#define pcache1 (GLOBAL(struct PCacheGlobal, pcache1_g))\r\n\r\n/*\r\n** Macros to enter and leave the PCache LRU mutex.\r\n*/\r\n#define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex)\r\n#define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex)\r\n\r\n/******************************************************************************/\r\n/******** Page Allocation/SQLITE_CONFIG_PCACHE Related Functions **************/\r\n\r\n/*\r\n** This function is called during initialization if a static buffer is \r\n** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE\r\n** verb to sqlite3_config(). Parameter pBuf points to an allocation large\r\n** enough to contain 'n' buffers of 'sz' bytes each.\r\n**\r\n** This routine is called from sqlite3_initialize() and so it is guaranteed\r\n** to be serialized already.  There is no need for further mutexing.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){\r\n  if( pcache1.isInit ){\r\n    PgFreeslot *p;\r\n    sz = ROUNDDOWN8(sz);\r\n    pcache1.szSlot = sz;\r\n    pcache1.nSlot = pcache1.nFreeSlot = n;\r\n    pcache1.nReserve = n>90 ? 10 : (n/10 + 1);\r\n    pcache1.pStart = pBuf;\r\n    pcache1.pFree = 0;\r\n    pcache1.bUnderPressure = 0;\r\n    while( n-- ){\r\n      p = (PgFreeslot*)pBuf;\r\n      p->pNext = pcache1.pFree;\r\n      pcache1.pFree = p;\r\n      pBuf = (void*)&((char*)pBuf)[sz];\r\n    }\r\n    pcache1.pEnd = pBuf;\r\n  }\r\n}\r\n\r\n/*\r\n** Malloc function used within this file to allocate space from the buffer\r\n** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no \r\n** such buffer exists or there is no space left in it, this function falls \r\n** back to sqlite3Malloc().\r\n**\r\n** Multiple threads can run this routine at the same time.  Global variables\r\n** in pcache1 need to be protected via mutex.\r\n*/\r\nstatic void *pcache1Alloc(int nByte){\r\n  void *p = 0;\r\n  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );\r\n  sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, nByte);\r\n  if( nByte<=pcache1.szSlot ){\r\n    sqlite3_mutex_enter(pcache1.mutex);\r\n    p = (PgHdr1 *)pcache1.pFree;\r\n    if( p ){\r\n      pcache1.pFree = pcache1.pFree->pNext;\r\n      pcache1.nFreeSlot--;\r\n      pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;\r\n      assert( pcache1.nFreeSlot>=0 );\r\n      sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1);\r\n    }\r\n    sqlite3_mutex_leave(pcache1.mutex);\r\n  }\r\n  if( p==0 ){\r\n    /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool.  Get\r\n    ** it from sqlite3Malloc instead.\r\n    */\r\n    p = sqlite3Malloc(nByte);\r\n    if( p ){\r\n      int sz = sqlite3MallocSize(p);\r\n      sqlite3_mutex_enter(pcache1.mutex);\r\n      sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);\r\n      sqlite3_mutex_leave(pcache1.mutex);\r\n    }\r\n    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Free an allocated buffer obtained from pcache1Alloc().\r\n*/\r\nstatic int pcache1Free(void *p){\r\n  int nFreed = 0;\r\n  if( p==0 ) return 0;\r\n  if( p>=pcache1.pStart && p<pcache1.pEnd ){\r\n    PgFreeslot *pSlot;\r\n    sqlite3_mutex_enter(pcache1.mutex);\r\n    sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, -1);\r\n    pSlot = (PgFreeslot*)p;\r\n    pSlot->pNext = pcache1.pFree;\r\n    pcache1.pFree = pSlot;\r\n    pcache1.nFreeSlot++;\r\n    pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;\r\n    assert( pcache1.nFreeSlot<=pcache1.nSlot );\r\n    sqlite3_mutex_leave(pcache1.mutex);\r\n  }else{\r\n    assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );\r\n    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\r\n    nFreed = sqlite3MallocSize(p);\r\n    sqlite3_mutex_enter(pcache1.mutex);\r\n    sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -nFreed);\r\n    sqlite3_mutex_leave(pcache1.mutex);\r\n    sqlite3_free(p);\r\n  }\r\n  return nFreed;\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\r\n/*\r\n** Return the size of a pcache allocation\r\n*/\r\nstatic int pcache1MemSize(void *p){\r\n  if( p>=pcache1.pStart && p<pcache1.pEnd ){\r\n    return pcache1.szSlot;\r\n  }else{\r\n    int iSize;\r\n    assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );\r\n    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\r\n    iSize = sqlite3MallocSize(p);\r\n    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);\r\n    return iSize;\r\n  }\r\n}\r\n#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */\r\n\r\n/*\r\n** Allocate a new page object initially associated with cache pCache.\r\n*/\r\nstatic PgHdr1 *pcache1AllocPage(PCache1 *pCache){\r\n  PgHdr1 *p = 0;\r\n  void *pPg;\r\n\r\n  /* The group mutex must be released before pcache1Alloc() is called. This\r\n  ** is because it may call sqlite3_release_memory(), which assumes that \r\n  ** this mutex is not held. */\r\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\r\n  pcache1LeaveMutex(pCache->pGroup);\r\n#ifdef SQLITE_PCACHE_SEPARATE_HEADER\r\n  pPg = pcache1Alloc(pCache->szPage);\r\n  p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra);\r\n  if( !pPg || !p ){\r\n    pcache1Free(pPg);\r\n    sqlite3_free(p);\r\n    pPg = 0;\r\n  }\r\n#else\r\n  pPg = pcache1Alloc(sizeof(PgHdr1) + pCache->szPage + pCache->szExtra);\r\n  p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage];\r\n#endif\r\n  pcache1EnterMutex(pCache->pGroup);\r\n\r\n  if( pPg ){\r\n    p->page.pBuf = pPg;\r\n    p->page.pExtra = &p[1];\r\n    if( pCache->bPurgeable ){\r\n      pCache->pGroup->nCurrentPage++;\r\n    }\r\n    return p;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Free a page object allocated by pcache1AllocPage().\r\n**\r\n** The pointer is allowed to be NULL, which is prudent.  But it turns out\r\n** that the current implementation happens to never call this routine\r\n** with a NULL pointer, so we mark the NULL test with ALWAYS().\r\n*/\r\nstatic void pcache1FreePage(PgHdr1 *p){\r\n  if( ALWAYS(p) ){\r\n    PCache1 *pCache = p->pCache;\r\n    assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) );\r\n    pcache1Free(p->page.pBuf);\r\n#ifdef SQLITE_PCACHE_SEPARATE_HEADER\r\n    sqlite3_free(p);\r\n#endif\r\n    if( pCache->bPurgeable ){\r\n      pCache->pGroup->nCurrentPage--;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Malloc function used by SQLite to obtain space from the buffer configured\r\n** using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer\r\n** exists, this function falls back to sqlite3Malloc().\r\n*/\r\nSQLITE_PRIVATE void *sqlite3PageMalloc(int sz){\r\n  return pcache1Alloc(sz);\r\n}\r\n\r\n/*\r\n** Free an allocated buffer obtained from sqlite3PageMalloc().\r\n*/\r\nSQLITE_PRIVATE void sqlite3PageFree(void *p){\r\n  pcache1Free(p);\r\n}\r\n\r\n\r\n/*\r\n** Return true if it desirable to avoid allocating a new page cache\r\n** entry.\r\n**\r\n** If memory was allocated specifically to the page cache using\r\n** SQLITE_CONFIG_PAGECACHE but that memory has all been used, then\r\n** it is desirable to avoid allocating a new page cache entry because\r\n** presumably SQLITE_CONFIG_PAGECACHE was suppose to be sufficient\r\n** for all page cache needs and we should not need to spill the\r\n** allocation onto the heap.\r\n**\r\n** Or, the heap is used for all page cache memory but the heap is\r\n** under memory pressure, then again it is desirable to avoid\r\n** allocating a new page cache entry in order to avoid stressing\r\n** the heap even further.\r\n*/\r\nstatic int pcache1UnderMemoryPressure(PCache1 *pCache){\r\n  if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){\r\n    return pcache1.bUnderPressure;\r\n  }else{\r\n    return sqlite3HeapNearlyFull();\r\n  }\r\n}\r\n\r\n/******************************************************************************/\r\n/******** General Implementation Functions ************************************/\r\n\r\n/*\r\n** This function is used to resize the hash table used by the cache passed\r\n** as the first argument.\r\n**\r\n** The PCache mutex must be held when this function is called.\r\n*/\r\nstatic int pcache1ResizeHash(PCache1 *p){\r\n  PgHdr1 **apNew;\r\n  unsigned int nNew;\r\n  unsigned int i;\r\n\r\n  assert( sqlite3_mutex_held(p->pGroup->mutex) );\r\n\r\n  nNew = p->nHash*2;\r\n  if( nNew<256 ){\r\n    nNew = 256;\r\n  }\r\n\r\n  pcache1LeaveMutex(p->pGroup);\r\n  if( p->nHash ){ sqlite3BeginBenignMalloc(); }\r\n  apNew = (PgHdr1 **)sqlite3_malloc(sizeof(PgHdr1 *)*nNew);\r\n  if( p->nHash ){ sqlite3EndBenignMalloc(); }\r\n  pcache1EnterMutex(p->pGroup);\r\n  if( apNew ){\r\n    memset(apNew, 0, sizeof(PgHdr1 *)*nNew);\r\n    for(i=0; i<p->nHash; i++){\r\n      PgHdr1 *pPage;\r\n      PgHdr1 *pNext = p->apHash[i];\r\n      while( (pPage = pNext)!=0 ){\r\n        unsigned int h = pPage->iKey % nNew;\r\n        pNext = pPage->pNext;\r\n        pPage->pNext = apNew[h];\r\n        apNew[h] = pPage;\r\n      }\r\n    }\r\n    sqlite3_free(p->apHash);\r\n    p->apHash = apNew;\r\n    p->nHash = nNew;\r\n  }\r\n\r\n  return (p->apHash ? SQLITE_OK : SQLITE_NOMEM);\r\n}\r\n\r\n/*\r\n** This function is used internally to remove the page pPage from the \r\n** PGroup LRU list, if is part of it. If pPage is not part of the PGroup\r\n** LRU list, then this function is a no-op.\r\n**\r\n** The PGroup mutex must be held when this function is called.\r\n**\r\n** If pPage is NULL then this routine is a no-op.\r\n*/\r\nstatic void pcache1PinPage(PgHdr1 *pPage){\r\n  PCache1 *pCache;\r\n  PGroup *pGroup;\r\n\r\n  if( pPage==0 ) return;\r\n  pCache = pPage->pCache;\r\n  pGroup = pCache->pGroup;\r\n  assert( sqlite3_mutex_held(pGroup->mutex) );\r\n  if( pPage->pLruNext || pPage==pGroup->pLruTail ){\r\n    if( pPage->pLruPrev ){\r\n      pPage->pLruPrev->pLruNext = pPage->pLruNext;\r\n    }\r\n    if( pPage->pLruNext ){\r\n      pPage->pLruNext->pLruPrev = pPage->pLruPrev;\r\n    }\r\n    if( pGroup->pLruHead==pPage ){\r\n      pGroup->pLruHead = pPage->pLruNext;\r\n    }\r\n    if( pGroup->pLruTail==pPage ){\r\n      pGroup->pLruTail = pPage->pLruPrev;\r\n    }\r\n    pPage->pLruNext = 0;\r\n    pPage->pLruPrev = 0;\r\n    pPage->pCache->nRecyclable--;\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** Remove the page supplied as an argument from the hash table \r\n** (PCache1.apHash structure) that it is currently stored in.\r\n**\r\n** The PGroup mutex must be held when this function is called.\r\n*/\r\nstatic void pcache1RemoveFromHash(PgHdr1 *pPage){\r\n  unsigned int h;\r\n  PCache1 *pCache = pPage->pCache;\r\n  PgHdr1 **pp;\r\n\r\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\r\n  h = pPage->iKey % pCache->nHash;\r\n  for(pp=&pCache->apHash[h]; (*pp)!=pPage; pp=&(*pp)->pNext);\r\n  *pp = (*pp)->pNext;\r\n\r\n  pCache->nPage--;\r\n}\r\n\r\n/*\r\n** If there are currently more than nMaxPage pages allocated, try\r\n** to recycle pages to reduce the number allocated to nMaxPage.\r\n*/\r\nstatic void pcache1EnforceMaxPage(PGroup *pGroup){\r\n  assert( sqlite3_mutex_held(pGroup->mutex) );\r\n  while( pGroup->nCurrentPage>pGroup->nMaxPage && pGroup->pLruTail ){\r\n    PgHdr1 *p = pGroup->pLruTail;\r\n    assert( p->pCache->pGroup==pGroup );\r\n    pcache1PinPage(p);\r\n    pcache1RemoveFromHash(p);\r\n    pcache1FreePage(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Discard all pages from cache pCache with a page number (key value) \r\n** greater than or equal to iLimit. Any pinned pages that meet this \r\n** criteria are unpinned before they are discarded.\r\n**\r\n** The PCache mutex must be held when this function is called.\r\n*/\r\nstatic void pcache1TruncateUnsafe(\r\n  PCache1 *pCache,             /* The cache to truncate */\r\n  unsigned int iLimit          /* Drop pages with this pgno or larger */\r\n){\r\n  TESTONLY( unsigned int nPage = 0; )  /* To assert pCache->nPage is correct */\r\n  unsigned int h;\r\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\r\n  for(h=0; h<pCache->nHash; h++){\r\n    PgHdr1 **pp = &pCache->apHash[h]; \r\n    PgHdr1 *pPage;\r\n    while( (pPage = *pp)!=0 ){\r\n      if( pPage->iKey>=iLimit ){\r\n        pCache->nPage--;\r\n        *pp = pPage->pNext;\r\n        pcache1PinPage(pPage);\r\n        pcache1FreePage(pPage);\r\n      }else{\r\n        pp = &pPage->pNext;\r\n        TESTONLY( nPage++; )\r\n      }\r\n    }\r\n  }\r\n  assert( pCache->nPage==nPage );\r\n}\r\n\r\n/******************************************************************************/\r\n/******** sqlite3_pcache Methods **********************************************/\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xInit method.\r\n*/\r\nstatic int pcache1Init(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  assert( pcache1.isInit==0 );\r\n  memset(&pcache1, 0, sizeof(pcache1));\r\n  if( sqlite3GlobalConfig.bCoreMutex ){\r\n    pcache1.grp.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_LRU);\r\n    pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_PMEM);\r\n  }\r\n  pcache1.grp.mxPinned = 10;\r\n  pcache1.isInit = 1;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xShutdown method.\r\n** Note that the static mutex allocated in xInit does \r\n** not need to be freed.\r\n*/\r\nstatic void pcache1Shutdown(void *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  assert( pcache1.isInit!=0 );\r\n  memset(&pcache1, 0, sizeof(pcache1));\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xCreate method.\r\n**\r\n** Allocate a new cache.\r\n*/\r\nstatic sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){\r\n  PCache1 *pCache;      /* The newly created page cache */\r\n  PGroup *pGroup;       /* The group the new page cache will belong to */\r\n  int sz;               /* Bytes of memory required to allocate the new cache */\r\n\r\n  /*\r\n  ** The seperateCache variable is true if each PCache has its own private\r\n  ** PGroup.  In other words, separateCache is true for mode (1) where no\r\n  ** mutexing is required.\r\n  **\r\n  **   *  Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT\r\n  **\r\n  **   *  Always use a unified cache in single-threaded applications\r\n  **\r\n  **   *  Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off)\r\n  **      use separate caches (mode-1)\r\n  */\r\n#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0\r\n  const int separateCache = 0;\r\n#else\r\n  int separateCache = sqlite3GlobalConfig.bCoreMutex>0;\r\n#endif\r\n\r\n  assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 );\r\n  assert( szExtra < 300 );\r\n\r\n  sz = sizeof(PCache1) + sizeof(PGroup)*separateCache;\r\n  pCache = (PCache1 *)sqlite3_malloc(sz);\r\n  if( pCache ){\r\n    memset(pCache, 0, sz);\r\n    if( separateCache ){\r\n      pGroup = (PGroup*)&pCache[1];\r\n      pGroup->mxPinned = 10;\r\n    }else{\r\n      pGroup = &pcache1.grp;\r\n    }\r\n    pCache->pGroup = pGroup;\r\n    pCache->szPage = szPage;\r\n    pCache->szExtra = szExtra;\r\n    pCache->bPurgeable = (bPurgeable ? 1 : 0);\r\n    if( bPurgeable ){\r\n      pCache->nMin = 10;\r\n      pcache1EnterMutex(pGroup);\r\n      pGroup->nMinPage += pCache->nMin;\r\n      pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;\r\n      pcache1LeaveMutex(pGroup);\r\n    }\r\n  }\r\n  return (sqlite3_pcache *)pCache;\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xCachesize method. \r\n**\r\n** Configure the cache_size limit for a cache.\r\n*/\r\nstatic void pcache1Cachesize(sqlite3_pcache *p, int nMax){\r\n  PCache1 *pCache = (PCache1 *)p;\r\n  if( pCache->bPurgeable ){\r\n    PGroup *pGroup = pCache->pGroup;\r\n    pcache1EnterMutex(pGroup);\r\n    pGroup->nMaxPage += (nMax - pCache->nMax);\r\n    pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;\r\n    pCache->nMax = nMax;\r\n    pCache->n90pct = pCache->nMax*9/10;\r\n    pcache1EnforceMaxPage(pGroup);\r\n    pcache1LeaveMutex(pGroup);\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xShrink method. \r\n**\r\n** Free up as much memory as possible.\r\n*/\r\nstatic void pcache1Shrink(sqlite3_pcache *p){\r\n  PCache1 *pCache = (PCache1*)p;\r\n  if( pCache->bPurgeable ){\r\n    PGroup *pGroup = pCache->pGroup;\r\n    int savedMaxPage;\r\n    pcache1EnterMutex(pGroup);\r\n    savedMaxPage = pGroup->nMaxPage;\r\n    pGroup->nMaxPage = 0;\r\n    pcache1EnforceMaxPage(pGroup);\r\n    pGroup->nMaxPage = savedMaxPage;\r\n    pcache1LeaveMutex(pGroup);\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xPagecount method. \r\n*/\r\nstatic int pcache1Pagecount(sqlite3_pcache *p){\r\n  int n;\r\n  PCache1 *pCache = (PCache1*)p;\r\n  pcache1EnterMutex(pCache->pGroup);\r\n  n = pCache->nPage;\r\n  pcache1LeaveMutex(pCache->pGroup);\r\n  return n;\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xFetch method. \r\n**\r\n** Fetch a page by key value.\r\n**\r\n** Whether or not a new page may be allocated by this function depends on\r\n** the value of the createFlag argument.  0 means do not allocate a new\r\n** page.  1 means allocate a new page if space is easily available.  2 \r\n** means to try really hard to allocate a new page.\r\n**\r\n** For a non-purgeable cache (a cache used as the storage for an in-memory\r\n** database) there is really no difference between createFlag 1 and 2.  So\r\n** the calling function (pcache.c) will never have a createFlag of 1 on\r\n** a non-purgeable cache.\r\n**\r\n** There are three different approaches to obtaining space for a page,\r\n** depending on the value of parameter createFlag (which may be 0, 1 or 2).\r\n**\r\n**   1. Regardless of the value of createFlag, the cache is searched for a \r\n**      copy of the requested page. If one is found, it is returned.\r\n**\r\n**   2. If createFlag==0 and the page is not already in the cache, NULL is\r\n**      returned.\r\n**\r\n**   3. If createFlag is 1, and the page is not already in the cache, then\r\n**      return NULL (do not allocate a new page) if any of the following\r\n**      conditions are true:\r\n**\r\n**       (a) the number of pages pinned by the cache is greater than\r\n**           PCache1.nMax, or\r\n**\r\n**       (b) the number of pages pinned by the cache is greater than\r\n**           the sum of nMax for all purgeable caches, less the sum of \r\n**           nMin for all other purgeable caches, or\r\n**\r\n**   4. If none of the first three conditions apply and the cache is marked\r\n**      as purgeable, and if one of the following is true:\r\n**\r\n**       (a) The number of pages allocated for the cache is already \r\n**           PCache1.nMax, or\r\n**\r\n**       (b) The number of pages allocated for all purgeable caches is\r\n**           already equal to or greater than the sum of nMax for all\r\n**           purgeable caches,\r\n**\r\n**       (c) The system is under memory pressure and wants to avoid\r\n**           unnecessary pages cache entry allocations\r\n**\r\n**      then attempt to recycle a page from the LRU list. If it is the right\r\n**      size, return the recycled buffer. Otherwise, free the buffer and\r\n**      proceed to step 5. \r\n**\r\n**   5. Otherwise, allocate and return a new page buffer.\r\n*/\r\nstatic sqlite3_pcache_page *pcache1Fetch(\r\n  sqlite3_pcache *p, \r\n  unsigned int iKey, \r\n  int createFlag\r\n){\r\n  unsigned int nPinned;\r\n  PCache1 *pCache = (PCache1 *)p;\r\n  PGroup *pGroup;\r\n  PgHdr1 *pPage = 0;\r\n\r\n  assert( pCache->bPurgeable || createFlag!=1 );\r\n  assert( pCache->bPurgeable || pCache->nMin==0 );\r\n  assert( pCache->bPurgeable==0 || pCache->nMin==10 );\r\n  assert( pCache->nMin==0 || pCache->bPurgeable );\r\n  pcache1EnterMutex(pGroup = pCache->pGroup);\r\n\r\n  /* Step 1: Search the hash table for an existing entry. */\r\n  if( pCache->nHash>0 ){\r\n    unsigned int h = iKey % pCache->nHash;\r\n    for(pPage=pCache->apHash[h]; pPage&&pPage->iKey!=iKey; pPage=pPage->pNext);\r\n  }\r\n\r\n  /* Step 2: Abort if no existing page is found and createFlag is 0 */\r\n  if( pPage || createFlag==0 ){\r\n    pcache1PinPage(pPage);\r\n    goto fetch_out;\r\n  }\r\n\r\n  /* The pGroup local variable will normally be initialized by the\r\n  ** pcache1EnterMutex() macro above.  But if SQLITE_MUTEX_OMIT is defined,\r\n  ** then pcache1EnterMutex() is a no-op, so we have to initialize the\r\n  ** local variable here.  Delaying the initialization of pGroup is an\r\n  ** optimization:  The common case is to exit the module before reaching\r\n  ** this point.\r\n  */\r\n#ifdef SQLITE_MUTEX_OMIT\r\n  pGroup = pCache->pGroup;\r\n#endif\r\n\r\n  /* Step 3: Abort if createFlag is 1 but the cache is nearly full */\r\n  assert( pCache->nPage >= pCache->nRecyclable );\r\n  nPinned = pCache->nPage - pCache->nRecyclable;\r\n  assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage );\r\n  assert( pCache->n90pct == pCache->nMax*9/10 );\r\n  if( createFlag==1 && (\r\n        nPinned>=pGroup->mxPinned\r\n     || nPinned>=pCache->n90pct\r\n     || pcache1UnderMemoryPressure(pCache)\r\n  )){\r\n    goto fetch_out;\r\n  }\r\n\r\n  if( pCache->nPage>=pCache->nHash && pcache1ResizeHash(pCache) ){\r\n    goto fetch_out;\r\n  }\r\n\r\n  /* Step 4. Try to recycle a page. */\r\n  if( pCache->bPurgeable && pGroup->pLruTail && (\r\n         (pCache->nPage+1>=pCache->nMax)\r\n      || pGroup->nCurrentPage>=pGroup->nMaxPage\r\n      || pcache1UnderMemoryPressure(pCache)\r\n  )){\r\n    PCache1 *pOther;\r\n    pPage = pGroup->pLruTail;\r\n    pcache1RemoveFromHash(pPage);\r\n    pcache1PinPage(pPage);\r\n    pOther = pPage->pCache;\r\n\r\n    /* We want to verify that szPage and szExtra are the same for pOther\r\n    ** and pCache.  Assert that we can verify this by comparing sums. */\r\n    assert( (pCache->szPage & (pCache->szPage-1))==0 && pCache->szPage>=512 );\r\n    assert( pCache->szExtra<512 );\r\n    assert( (pOther->szPage & (pOther->szPage-1))==0 && pOther->szPage>=512 );\r\n    assert( pOther->szExtra<512 );\r\n\r\n    if( pOther->szPage+pOther->szExtra != pCache->szPage+pCache->szExtra ){\r\n      pcache1FreePage(pPage);\r\n      pPage = 0;\r\n    }else{\r\n      pGroup->nCurrentPage -= (pOther->bPurgeable - pCache->bPurgeable);\r\n    }\r\n  }\r\n\r\n  /* Step 5. If a usable page buffer has still not been found, \r\n  ** attempt to allocate a new one. \r\n  */\r\n  if( !pPage ){\r\n    if( createFlag==1 ) sqlite3BeginBenignMalloc();\r\n    pPage = pcache1AllocPage(pCache);\r\n    if( createFlag==1 ) sqlite3EndBenignMalloc();\r\n  }\r\n\r\n  if( pPage ){\r\n    unsigned int h = iKey % pCache->nHash;\r\n    pCache->nPage++;\r\n    pPage->iKey = iKey;\r\n    pPage->pNext = pCache->apHash[h];\r\n    pPage->pCache = pCache;\r\n    pPage->pLruPrev = 0;\r\n    pPage->pLruNext = 0;\r\n    *(void **)pPage->page.pExtra = 0;\r\n    pCache->apHash[h] = pPage;\r\n  }\r\n\r\nfetch_out:\r\n  if( pPage && iKey>pCache->iMaxKey ){\r\n    pCache->iMaxKey = iKey;\r\n  }\r\n  pcache1LeaveMutex(pGroup);\r\n  return &pPage->page;\r\n}\r\n\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xUnpin method.\r\n**\r\n** Mark a page as unpinned (eligible for asynchronous recycling).\r\n*/\r\nstatic void pcache1Unpin(\r\n  sqlite3_pcache *p, \r\n  sqlite3_pcache_page *pPg, \r\n  int reuseUnlikely\r\n){\r\n  PCache1 *pCache = (PCache1 *)p;\r\n  PgHdr1 *pPage = (PgHdr1 *)pPg;\r\n  PGroup *pGroup = pCache->pGroup;\r\n \r\n  assert( pPage->pCache==pCache );\r\n  pcache1EnterMutex(pGroup);\r\n\r\n  /* It is an error to call this function if the page is already \r\n  ** part of the PGroup LRU list.\r\n  */\r\n  assert( pPage->pLruPrev==0 && pPage->pLruNext==0 );\r\n  assert( pGroup->pLruHead!=pPage && pGroup->pLruTail!=pPage );\r\n\r\n  if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){\r\n    pcache1RemoveFromHash(pPage);\r\n    pcache1FreePage(pPage);\r\n  }else{\r\n    /* Add the page to the PGroup LRU list. */\r\n    if( pGroup->pLruHead ){\r\n      pGroup->pLruHead->pLruPrev = pPage;\r\n      pPage->pLruNext = pGroup->pLruHead;\r\n      pGroup->pLruHead = pPage;\r\n    }else{\r\n      pGroup->pLruTail = pPage;\r\n      pGroup->pLruHead = pPage;\r\n    }\r\n    pCache->nRecyclable++;\r\n  }\r\n\r\n  pcache1LeaveMutex(pCache->pGroup);\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xRekey method. \r\n*/\r\nstatic void pcache1Rekey(\r\n  sqlite3_pcache *p,\r\n  sqlite3_pcache_page *pPg,\r\n  unsigned int iOld,\r\n  unsigned int iNew\r\n){\r\n  PCache1 *pCache = (PCache1 *)p;\r\n  PgHdr1 *pPage = (PgHdr1 *)pPg;\r\n  PgHdr1 **pp;\r\n  unsigned int h; \r\n  assert( pPage->iKey==iOld );\r\n  assert( pPage->pCache==pCache );\r\n\r\n  pcache1EnterMutex(pCache->pGroup);\r\n\r\n  h = iOld%pCache->nHash;\r\n  pp = &pCache->apHash[h];\r\n  while( (*pp)!=pPage ){\r\n    pp = &(*pp)->pNext;\r\n  }\r\n  *pp = pPage->pNext;\r\n\r\n  h = iNew%pCache->nHash;\r\n  pPage->iKey = iNew;\r\n  pPage->pNext = pCache->apHash[h];\r\n  pCache->apHash[h] = pPage;\r\n  if( iNew>pCache->iMaxKey ){\r\n    pCache->iMaxKey = iNew;\r\n  }\r\n\r\n  pcache1LeaveMutex(pCache->pGroup);\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xTruncate method. \r\n**\r\n** Discard all unpinned pages in the cache with a page number equal to\r\n** or greater than parameter iLimit. Any pinned pages with a page number\r\n** equal to or greater than iLimit are implicitly unpinned.\r\n*/\r\nstatic void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){\r\n  PCache1 *pCache = (PCache1 *)p;\r\n  pcache1EnterMutex(pCache->pGroup);\r\n  if( iLimit<=pCache->iMaxKey ){\r\n    pcache1TruncateUnsafe(pCache, iLimit);\r\n    pCache->iMaxKey = iLimit-1;\r\n  }\r\n  pcache1LeaveMutex(pCache->pGroup);\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite3_pcache.xDestroy method. \r\n**\r\n** Destroy a cache allocated using pcache1Create().\r\n*/\r\nstatic void pcache1Destroy(sqlite3_pcache *p){\r\n  PCache1 *pCache = (PCache1 *)p;\r\n  PGroup *pGroup = pCache->pGroup;\r\n  assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) );\r\n  pcache1EnterMutex(pGroup);\r\n  pcache1TruncateUnsafe(pCache, 0);\r\n  assert( pGroup->nMaxPage >= pCache->nMax );\r\n  pGroup->nMaxPage -= pCache->nMax;\r\n  assert( pGroup->nMinPage >= pCache->nMin );\r\n  pGroup->nMinPage -= pCache->nMin;\r\n  pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;\r\n  pcache1EnforceMaxPage(pGroup);\r\n  pcache1LeaveMutex(pGroup);\r\n  sqlite3_free(pCache->apHash);\r\n  sqlite3_free(pCache);\r\n}\r\n\r\n/*\r\n** This function is called during initialization (sqlite3_initialize()) to\r\n** install the default pluggable cache module, assuming the user has not\r\n** already provided an alternative.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PCacheSetDefault(void){\r\n  static const sqlite3_pcache_methods2 defaultMethods = {\r\n    1,                       /* iVersion */\r\n    0,                       /* pArg */\r\n    pcache1Init,             /* xInit */\r\n    pcache1Shutdown,         /* xShutdown */\r\n    pcache1Create,           /* xCreate */\r\n    pcache1Cachesize,        /* xCachesize */\r\n    pcache1Pagecount,        /* xPagecount */\r\n    pcache1Fetch,            /* xFetch */\r\n    pcache1Unpin,            /* xUnpin */\r\n    pcache1Rekey,            /* xRekey */\r\n    pcache1Truncate,         /* xTruncate */\r\n    pcache1Destroy,          /* xDestroy */\r\n    pcache1Shrink            /* xShrink */\r\n  };\r\n  sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\r\n/*\r\n** This function is called to free superfluous dynamically allocated memory\r\n** held by the pager system. Memory in use by any SQLite pager allocated\r\n** by the current thread may be sqlite3_free()ed.\r\n**\r\n** nReq is the number of bytes of memory required. Once this much has\r\n** been released, the function returns. The return value is the total number \r\n** of bytes of memory released.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){\r\n  int nFree = 0;\r\n  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );\r\n  assert( sqlite3_mutex_notheld(pcache1.mutex) );\r\n  if( pcache1.pStart==0 ){\r\n    PgHdr1 *p;\r\n    pcache1EnterMutex(&pcache1.grp);\r\n    while( (nReq<0 || nFree<nReq) && ((p=pcache1.grp.pLruTail)!=0) ){\r\n      nFree += pcache1MemSize(p->page.pBuf);\r\n#ifdef SQLITE_PCACHE_SEPARATE_HEADER\r\n      nFree += sqlite3MemSize(p);\r\n#endif\r\n      pcache1PinPage(p);\r\n      pcache1RemoveFromHash(p);\r\n      pcache1FreePage(p);\r\n    }\r\n    pcache1LeaveMutex(&pcache1.grp);\r\n  }\r\n  return nFree;\r\n}\r\n#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** This function is used by test procedures to inspect the internal state\r\n** of the global cache.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PcacheStats(\r\n  int *pnCurrent,      /* OUT: Total number of pages cached */\r\n  int *pnMax,          /* OUT: Global maximum cache size */\r\n  int *pnMin,          /* OUT: Sum of PCache1.nMin for purgeable caches */\r\n  int *pnRecyclable    /* OUT: Total number of pages available for recycling */\r\n){\r\n  PgHdr1 *p;\r\n  int nRecyclable = 0;\r\n  for(p=pcache1.grp.pLruHead; p; p=p->pLruNext){\r\n    nRecyclable++;\r\n  }\r\n  *pnCurrent = pcache1.grp.nCurrentPage;\r\n  *pnMax = (int)pcache1.grp.nMaxPage;\r\n  *pnMin = (int)pcache1.grp.nMinPage;\r\n  *pnRecyclable = nRecyclable;\r\n}\r\n#endif\r\n\r\n/************** End of pcache1.c *********************************************/\r\n/************** Begin file rowset.c ******************************************/\r\n/*\r\n** 2008 December 3\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This module implements an object we call a \"RowSet\".\r\n**\r\n** The RowSet object is a collection of rowids.  Rowids\r\n** are inserted into the RowSet in an arbitrary order.  Inserts\r\n** can be intermixed with tests to see if a given rowid has been\r\n** previously inserted into the RowSet.\r\n**\r\n** After all inserts are finished, it is possible to extract the\r\n** elements of the RowSet in sorted order.  Once this extraction\r\n** process has started, no new elements may be inserted.\r\n**\r\n** Hence, the primitive operations for a RowSet are:\r\n**\r\n**    CREATE\r\n**    INSERT\r\n**    TEST\r\n**    SMALLEST\r\n**    DESTROY\r\n**\r\n** The CREATE and DESTROY primitives are the constructor and destructor,\r\n** obviously.  The INSERT primitive adds a new element to the RowSet.\r\n** TEST checks to see if an element is already in the RowSet.  SMALLEST\r\n** extracts the least value from the RowSet.\r\n**\r\n** The INSERT primitive might allocate additional memory.  Memory is\r\n** allocated in chunks so most INSERTs do no allocation.  There is an \r\n** upper bound on the size of allocated memory.  No memory is freed\r\n** until DESTROY.\r\n**\r\n** The TEST primitive includes a \"batch\" number.  The TEST primitive\r\n** will only see elements that were inserted before the last change\r\n** in the batch number.  In other words, if an INSERT occurs between\r\n** two TESTs where the TESTs have the same batch nubmer, then the\r\n** value added by the INSERT will not be visible to the second TEST.\r\n** The initial batch number is zero, so if the very first TEST contains\r\n** a non-zero batch number, it will see all prior INSERTs.\r\n**\r\n** No INSERTs may occurs after a SMALLEST.  An assertion will fail if\r\n** that is attempted.\r\n**\r\n** The cost of an INSERT is roughly constant.  (Sometime new memory\r\n** has to be allocated on an INSERT.)  The cost of a TEST with a new\r\n** batch number is O(NlogN) where N is the number of elements in the RowSet.\r\n** The cost of a TEST using the same batch number is O(logN).  The cost\r\n** of the first SMALLEST is O(NlogN).  Second and subsequent SMALLEST\r\n** primitives are constant time.  The cost of DESTROY is O(N).\r\n**\r\n** There is an added cost of O(N) when switching between TEST and\r\n** SMALLEST primitives.\r\n*/\r\n\r\n\r\n/*\r\n** Target size for allocation chunks.\r\n*/\r\n#define ROWSET_ALLOCATION_SIZE 1024\r\n\r\n/*\r\n** The number of rowset entries per allocation chunk.\r\n*/\r\n#define ROWSET_ENTRY_PER_CHUNK  \\\r\n                       ((ROWSET_ALLOCATION_SIZE-8)/sizeof(struct RowSetEntry))\r\n\r\n/*\r\n** Each entry in a RowSet is an instance of the following object.\r\n*/\r\nstruct RowSetEntry {            \r\n  i64 v;                        /* ROWID value for this entry */\r\n  struct RowSetEntry *pRight;   /* Right subtree (larger entries) or list */\r\n  struct RowSetEntry *pLeft;    /* Left subtree (smaller entries) */\r\n};\r\n\r\n/*\r\n** RowSetEntry objects are allocated in large chunks (instances of the\r\n** following structure) to reduce memory allocation overhead.  The\r\n** chunks are kept on a linked list so that they can be deallocated\r\n** when the RowSet is destroyed.\r\n*/\r\nstruct RowSetChunk {\r\n  struct RowSetChunk *pNextChunk;        /* Next chunk on list of them all */\r\n  struct RowSetEntry aEntry[ROWSET_ENTRY_PER_CHUNK]; /* Allocated entries */\r\n};\r\n\r\n/*\r\n** A RowSet in an instance of the following structure.\r\n**\r\n** A typedef of this structure if found in sqliteInt.h.\r\n*/\r\nstruct RowSet {\r\n  struct RowSetChunk *pChunk;    /* List of all chunk allocations */\r\n  sqlite3 *db;                   /* The database connection */\r\n  struct RowSetEntry *pEntry;    /* List of entries using pRight */\r\n  struct RowSetEntry *pLast;     /* Last entry on the pEntry list */\r\n  struct RowSetEntry *pFresh;    /* Source of new entry objects */\r\n  struct RowSetEntry *pTree;     /* Binary tree of entries */\r\n  u16 nFresh;                    /* Number of objects on pFresh */\r\n  u8 isSorted;                   /* True if pEntry is sorted */\r\n  u8 iBatch;                     /* Current insert batch */\r\n};\r\n\r\n/*\r\n** Turn bulk memory into a RowSet object.  N bytes of memory\r\n** are available at pSpace.  The db pointer is used as a memory context\r\n** for any subsequent allocations that need to occur.\r\n** Return a pointer to the new RowSet object.\r\n**\r\n** It must be the case that N is sufficient to make a Rowset.  If not\r\n** an assertion fault occurs.\r\n** \r\n** If N is larger than the minimum, use the surplus as an initial\r\n** allocation of entries available to be filled.\r\n*/\r\nSQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3 *db, void *pSpace, unsigned int N){\r\n  RowSet *p;\r\n  assert( N >= ROUND8(sizeof(*p)) );\r\n  p = pSpace;\r\n  p->pChunk = 0;\r\n  p->db = db;\r\n  p->pEntry = 0;\r\n  p->pLast = 0;\r\n  p->pTree = 0;\r\n  p->pFresh = (struct RowSetEntry*)(ROUND8(sizeof(*p)) + (char*)p);\r\n  p->nFresh = (u16)((N - ROUND8(sizeof(*p)))/sizeof(struct RowSetEntry));\r\n  p->isSorted = 1;\r\n  p->iBatch = 0;\r\n  return p;\r\n}\r\n\r\n/*\r\n** Deallocate all chunks from a RowSet.  This frees all memory that\r\n** the RowSet has allocated over its lifetime.  This routine is\r\n** the destructor for the RowSet.\r\n*/\r\nSQLITE_PRIVATE void sqlite3RowSetClear(RowSet *p){\r\n  struct RowSetChunk *pChunk, *pNextChunk;\r\n  for(pChunk=p->pChunk; pChunk; pChunk = pNextChunk){\r\n    pNextChunk = pChunk->pNextChunk;\r\n    sqlite3DbFree(p->db, pChunk);\r\n  }\r\n  p->pChunk = 0;\r\n  p->nFresh = 0;\r\n  p->pEntry = 0;\r\n  p->pLast = 0;\r\n  p->pTree = 0;\r\n  p->isSorted = 1;\r\n}\r\n\r\n/*\r\n** Insert a new value into a RowSet.\r\n**\r\n** The mallocFailed flag of the database connection is set if a\r\n** memory allocation fails.\r\n*/\r\nSQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){\r\n  struct RowSetEntry *pEntry;  /* The new entry */\r\n  struct RowSetEntry *pLast;   /* The last prior entry */\r\n  assert( p!=0 );\r\n  if( p->nFresh==0 ){\r\n    struct RowSetChunk *pNew;\r\n    pNew = sqlite3DbMallocRaw(p->db, sizeof(*pNew));\r\n    if( pNew==0 ){\r\n      return;\r\n    }\r\n    pNew->pNextChunk = p->pChunk;\r\n    p->pChunk = pNew;\r\n    p->pFresh = pNew->aEntry;\r\n    p->nFresh = ROWSET_ENTRY_PER_CHUNK;\r\n  }\r\n  pEntry = p->pFresh++;\r\n  p->nFresh--;\r\n  pEntry->v = rowid;\r\n  pEntry->pRight = 0;\r\n  pLast = p->pLast;\r\n  if( pLast ){\r\n    if( p->isSorted && rowid<=pLast->v ){\r\n      p->isSorted = 0;\r\n    }\r\n    pLast->pRight = pEntry;\r\n  }else{\r\n    assert( p->pEntry==0 ); /* Fires if INSERT after SMALLEST */\r\n    p->pEntry = pEntry;\r\n  }\r\n  p->pLast = pEntry;\r\n}\r\n\r\n/*\r\n** Merge two lists of RowSetEntry objects.  Remove duplicates.\r\n**\r\n** The input lists are connected via pRight pointers and are \r\n** assumed to each already be in sorted order.\r\n*/\r\nstatic struct RowSetEntry *rowSetMerge(\r\n  struct RowSetEntry *pA,    /* First sorted list to be merged */\r\n  struct RowSetEntry *pB     /* Second sorted list to be merged */\r\n){\r\n  struct RowSetEntry head;\r\n  struct RowSetEntry *pTail;\r\n\r\n  pTail = &head;\r\n  while( pA && pB ){\r\n    assert( pA->pRight==0 || pA->v<=pA->pRight->v );\r\n    assert( pB->pRight==0 || pB->v<=pB->pRight->v );\r\n    if( pA->v<pB->v ){\r\n      pTail->pRight = pA;\r\n      pA = pA->pRight;\r\n      pTail = pTail->pRight;\r\n    }else if( pB->v<pA->v ){\r\n      pTail->pRight = pB;\r\n      pB = pB->pRight;\r\n      pTail = pTail->pRight;\r\n    }else{\r\n      pA = pA->pRight;\r\n    }\r\n  }\r\n  if( pA ){\r\n    assert( pA->pRight==0 || pA->v<=pA->pRight->v );\r\n    pTail->pRight = pA;\r\n  }else{\r\n    assert( pB==0 || pB->pRight==0 || pB->v<=pB->pRight->v );\r\n    pTail->pRight = pB;\r\n  }\r\n  return head.pRight;\r\n}\r\n\r\n/*\r\n** Sort all elements on the pEntry list of the RowSet into ascending order.\r\n*/ \r\nstatic void rowSetSort(RowSet *p){\r\n  unsigned int i;\r\n  struct RowSetEntry *pEntry;\r\n  struct RowSetEntry *aBucket[40];\r\n\r\n  assert( p->isSorted==0 );\r\n  memset(aBucket, 0, sizeof(aBucket));\r\n  while( p->pEntry ){\r\n    pEntry = p->pEntry;\r\n    p->pEntry = pEntry->pRight;\r\n    pEntry->pRight = 0;\r\n    for(i=0; aBucket[i]; i++){\r\n      pEntry = rowSetMerge(aBucket[i], pEntry);\r\n      aBucket[i] = 0;\r\n    }\r\n    aBucket[i] = pEntry;\r\n  }\r\n  pEntry = 0;\r\n  for(i=0; i<sizeof(aBucket)/sizeof(aBucket[0]); i++){\r\n    pEntry = rowSetMerge(pEntry, aBucket[i]);\r\n  }\r\n  p->pEntry = pEntry;\r\n  p->pLast = 0;\r\n  p->isSorted = 1;\r\n}\r\n\r\n\r\n/*\r\n** The input, pIn, is a binary tree (or subtree) of RowSetEntry objects.\r\n** Convert this tree into a linked list connected by the pRight pointers\r\n** and return pointers to the first and last elements of the new list.\r\n*/\r\nstatic void rowSetTreeToList(\r\n  struct RowSetEntry *pIn,         /* Root of the input tree */\r\n  struct RowSetEntry **ppFirst,    /* Write head of the output list here */\r\n  struct RowSetEntry **ppLast      /* Write tail of the output list here */\r\n){\r\n  assert( pIn!=0 );\r\n  if( pIn->pLeft ){\r\n    struct RowSetEntry *p;\r\n    rowSetTreeToList(pIn->pLeft, ppFirst, &p);\r\n    p->pRight = pIn;\r\n  }else{\r\n    *ppFirst = pIn;\r\n  }\r\n  if( pIn->pRight ){\r\n    rowSetTreeToList(pIn->pRight, &pIn->pRight, ppLast);\r\n  }else{\r\n    *ppLast = pIn;\r\n  }\r\n  assert( (*ppLast)->pRight==0 );\r\n}\r\n\r\n\r\n/*\r\n** Convert a sorted list of elements (connected by pRight) into a binary\r\n** tree with depth of iDepth.  A depth of 1 means the tree contains a single\r\n** node taken from the head of *ppList.  A depth of 2 means a tree with\r\n** three nodes.  And so forth.\r\n**\r\n** Use as many entries from the input list as required and update the\r\n** *ppList to point to the unused elements of the list.  If the input\r\n** list contains too few elements, then construct an incomplete tree\r\n** and leave *ppList set to NULL.\r\n**\r\n** Return a pointer to the root of the constructed binary tree.\r\n*/\r\nstatic struct RowSetEntry *rowSetNDeepTree(\r\n  struct RowSetEntry **ppList,\r\n  int iDepth\r\n){\r\n  struct RowSetEntry *p;         /* Root of the new tree */\r\n  struct RowSetEntry *pLeft;     /* Left subtree */\r\n  if( *ppList==0 ){\r\n    return 0;\r\n  }\r\n  if( iDepth==1 ){\r\n    p = *ppList;\r\n    *ppList = p->pRight;\r\n    p->pLeft = p->pRight = 0;\r\n    return p;\r\n  }\r\n  pLeft = rowSetNDeepTree(ppList, iDepth-1);\r\n  p = *ppList;\r\n  if( p==0 ){\r\n    return pLeft;\r\n  }\r\n  p->pLeft = pLeft;\r\n  *ppList = p->pRight;\r\n  p->pRight = rowSetNDeepTree(ppList, iDepth-1);\r\n  return p;\r\n}\r\n\r\n/*\r\n** Convert a sorted list of elements into a binary tree. Make the tree\r\n** as deep as it needs to be in order to contain the entire list.\r\n*/\r\nstatic struct RowSetEntry *rowSetListToTree(struct RowSetEntry *pList){\r\n  int iDepth;           /* Depth of the tree so far */\r\n  struct RowSetEntry *p;       /* Current tree root */\r\n  struct RowSetEntry *pLeft;   /* Left subtree */\r\n\r\n  assert( pList!=0 );\r\n  p = pList;\r\n  pList = p->pRight;\r\n  p->pLeft = p->pRight = 0;\r\n  for(iDepth=1; pList; iDepth++){\r\n    pLeft = p;\r\n    p = pList;\r\n    pList = p->pRight;\r\n    p->pLeft = pLeft;\r\n    p->pRight = rowSetNDeepTree(&pList, iDepth);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Convert the list in p->pEntry into a sorted list if it is not\r\n** sorted already.  If there is a binary tree on p->pTree, then\r\n** convert it into a list too and merge it into the p->pEntry list.\r\n*/\r\nstatic void rowSetToList(RowSet *p){\r\n  if( !p->isSorted ){\r\n    rowSetSort(p);\r\n  }\r\n  if( p->pTree ){\r\n    struct RowSetEntry *pHead, *pTail;\r\n    rowSetTreeToList(p->pTree, &pHead, &pTail);\r\n    p->pTree = 0;\r\n    p->pEntry = rowSetMerge(p->pEntry, pHead);\r\n  }\r\n}\r\n\r\n/*\r\n** Extract the smallest element from the RowSet.\r\n** Write the element into *pRowid.  Return 1 on success.  Return\r\n** 0 if the RowSet is already empty.\r\n**\r\n** After this routine has been called, the sqlite3RowSetInsert()\r\n** routine may not be called again.  \r\n*/\r\nSQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){\r\n  rowSetToList(p);\r\n  if( p->pEntry ){\r\n    *pRowid = p->pEntry->v;\r\n    p->pEntry = p->pEntry->pRight;\r\n    if( p->pEntry==0 ){\r\n      sqlite3RowSetClear(p);\r\n    }\r\n    return 1;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Check to see if element iRowid was inserted into the the rowset as\r\n** part of any insert batch prior to iBatch.  Return 1 or 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, u8 iBatch, sqlite3_int64 iRowid){\r\n  struct RowSetEntry *p;\r\n  if( iBatch!=pRowSet->iBatch ){\r\n    if( pRowSet->pEntry ){\r\n      rowSetToList(pRowSet);\r\n      pRowSet->pTree = rowSetListToTree(pRowSet->pEntry);\r\n      pRowSet->pEntry = 0;\r\n      pRowSet->pLast = 0;\r\n    }\r\n    pRowSet->iBatch = iBatch;\r\n  }\r\n  p = pRowSet->pTree;\r\n  while( p ){\r\n    if( p->v<iRowid ){\r\n      p = p->pRight;\r\n    }else if( p->v>iRowid ){\r\n      p = p->pLeft;\r\n    }else{\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/************** End of rowset.c **********************************************/\r\n/************** Begin file pager.c *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This is the implementation of the page cache subsystem or \"pager\".\r\n** \r\n** The pager is used to access a database disk file.  It implements\r\n** atomic commit and rollback through the use of a journal file that\r\n** is separate from the database file.  The pager also implements file\r\n** locking to prevent two processes from writing the same database\r\n** file simultaneously, or one process from reading the database while\r\n** another is writing.\r\n*/\r\n#ifndef SQLITE_OMIT_DISKIO\r\n/************** Include wal.h in the middle of pager.c ***********************/\r\n/************** Begin file wal.h *********************************************/\r\n/*\r\n** 2010 February 1\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the interface to the write-ahead logging \r\n** system. Refer to the comments below and the header comment attached to \r\n** the implementation of each function in log.c for further details.\r\n*/\r\n\r\n#ifndef _WAL_H_\r\n#define _WAL_H_\r\n\r\n\r\n/* Additional values that can be added to the sync_flags argument of\r\n** sqlite3WalFrames():\r\n*/\r\n#define WAL_SYNC_TRANSACTIONS  0x20   /* Sync at the end of each transaction */\r\n#define SQLITE_SYNC_MASK       0x13   /* Mask off the SQLITE_SYNC_* values */\r\n\r\n#ifdef SQLITE_OMIT_WAL\r\n# define sqlite3WalOpen(x,y,z)                   0\r\n# define sqlite3WalLimit(x,y)\r\n# define sqlite3WalClose(w,x,y,z)                0\r\n# define sqlite3WalBeginReadTransaction(y,z)     0\r\n# define sqlite3WalEndReadTransaction(z)\r\n# define sqlite3WalRead(v,w,x,y,z)               0\r\n# define sqlite3WalDbsize(y)                     0\r\n# define sqlite3WalBeginWriteTransaction(y)      0\r\n# define sqlite3WalEndWriteTransaction(x)        0\r\n# define sqlite3WalUndo(x,y,z)                   0\r\n# define sqlite3WalSavepoint(y,z)\r\n# define sqlite3WalSavepointUndo(y,z)            0\r\n# define sqlite3WalFrames(u,v,w,x,y,z)           0\r\n# define sqlite3WalCheckpoint(r,s,t,u,v,w,x,y,z) 0\r\n# define sqlite3WalCallback(z)                   0\r\n# define sqlite3WalExclusiveMode(y,z)            0\r\n# define sqlite3WalHeapMemory(z)                 0\r\n# define sqlite3WalFramesize(z)                  0\r\n#else\r\n\r\n#define WAL_SAVEPOINT_NDATA 4\r\n\r\n/* Connection to a write-ahead log (WAL) file. \r\n** There is one object of this type for each pager. \r\n*/\r\ntypedef struct Wal Wal;\r\n\r\n/* Open and close a connection to a write-ahead log. */\r\nSQLITE_PRIVATE int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**);\r\nSQLITE_PRIVATE int sqlite3WalClose(Wal *pWal, int sync_flags, int, u8 *);\r\n\r\n/* Set the limiting size of a WAL file. */\r\nSQLITE_PRIVATE void sqlite3WalLimit(Wal*, i64);\r\n\r\n/* Used by readers to open (lock) and close (unlock) a snapshot.  A \r\n** snapshot is like a read-transaction.  It is the state of the database\r\n** at an instant in time.  sqlite3WalOpenSnapshot gets a read lock and\r\n** preserves the current state even if the other threads or processes\r\n** write to or checkpoint the WAL.  sqlite3WalCloseSnapshot() closes the\r\n** transaction and releases the lock.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *);\r\nSQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal);\r\n\r\n/* Read a page from the write-ahead log, if it is present. */\r\nSQLITE_PRIVATE int sqlite3WalRead(Wal *pWal, Pgno pgno, int *pInWal, int nOut, u8 *pOut);\r\n\r\n/* If the WAL is not empty, return the size of the database. */\r\nSQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal);\r\n\r\n/* Obtain or release the WRITER lock. */\r\nSQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal);\r\nSQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal);\r\n\r\n/* Undo any frames written (but not committed) to the log */\r\nSQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx);\r\n\r\n/* Return an integer that records the current (uncommitted) write\r\n** position in the WAL */\r\nSQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData);\r\n\r\n/* Move the write position of the WAL back to iFrame.  Called in\r\n** response to a ROLLBACK TO command. */\r\nSQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData);\r\n\r\n/* Write a frame or frames to the log. */\r\nSQLITE_PRIVATE int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);\r\n\r\n/* Copy pages from the log to the database file */ \r\nSQLITE_PRIVATE int sqlite3WalCheckpoint(\r\n  Wal *pWal,                      /* Write-ahead log connection */\r\n  int eMode,                      /* One of PASSIVE, FULL and RESTART */\r\n  int (*xBusy)(void*),            /* Function to call when busy */\r\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\r\n  int sync_flags,                 /* Flags to sync db file with (or 0) */\r\n  int nBuf,                       /* Size of buffer nBuf */\r\n  u8 *zBuf,                       /* Temporary buffer to use */\r\n  int *pnLog,                     /* OUT: Number of frames in WAL */\r\n  int *pnCkpt                     /* OUT: Number of backfilled frames in WAL */\r\n);\r\n\r\n/* Return the value to pass to a sqlite3_wal_hook callback, the\r\n** number of frames in the WAL at the point of the last commit since\r\n** sqlite3WalCallback() was called.  If no commits have occurred since\r\n** the last call, then return 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal);\r\n\r\n/* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released)\r\n** by the pager layer on the database file.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op);\r\n\r\n/* Return true if the argument is non-NULL and the WAL module is using\r\n** heap-memory for the wal-index. Otherwise, if the argument is NULL or the\r\n** WAL module is using shared-memory, return false. \r\n*/\r\nSQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal);\r\n\r\n#ifdef SQLITE_ENABLE_ZIPVFS\r\n/* If the WAL file is not empty, return the number of bytes of content\r\n** stored in each frame (i.e. the db page-size when the WAL was created).\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal);\r\n#endif\r\n\r\n#endif /* ifndef SQLITE_OMIT_WAL */\r\n#endif /* _WAL_H_ */\r\n\r\n/************** End of wal.h *************************************************/\r\n/************** Continuing where we left off in pager.c **********************/\r\n\r\n\r\n/******************* NOTES ON THE DESIGN OF THE PAGER ************************\r\n**\r\n** This comment block describes invariants that hold when using a rollback\r\n** journal.  These invariants do not apply for journal_mode=WAL,\r\n** journal_mode=MEMORY, or journal_mode=OFF.\r\n**\r\n** Within this comment block, a page is deemed to have been synced\r\n** automatically as soon as it is written when PRAGMA synchronous=OFF.\r\n** Otherwise, the page is not synced until the xSync method of the VFS\r\n** is called successfully on the file containing the page.\r\n**\r\n** Definition:  A page of the database file is said to be \"overwriteable\" if\r\n** one or more of the following are true about the page:\r\n** \r\n**     (a)  The original content of the page as it was at the beginning of\r\n**          the transaction has been written into the rollback journal and\r\n**          synced.\r\n** \r\n**     (b)  The page was a freelist leaf page at the start of the transaction.\r\n** \r\n**     (c)  The page number is greater than the largest page that existed in\r\n**          the database file at the start of the transaction.\r\n** \r\n** (1) A page of the database file is never overwritten unless one of the\r\n**     following are true:\r\n** \r\n**     (a) The page and all other pages on the same sector are overwriteable.\r\n** \r\n**     (b) The atomic page write optimization is enabled, and the entire\r\n**         transaction other than the update of the transaction sequence\r\n**         number consists of a single page change.\r\n** \r\n** (2) The content of a page written into the rollback journal exactly matches\r\n**     both the content in the database when the rollback journal was written\r\n**     and the content in the database at the beginning of the current\r\n**     transaction.\r\n** \r\n** (3) Writes to the database file are an integer multiple of the page size\r\n**     in length and are aligned on a page boundary.\r\n** \r\n** (4) Reads from the database file are either aligned on a page boundary and\r\n**     an integer multiple of the page size in length or are taken from the\r\n**     first 100 bytes of the database file.\r\n** \r\n** (5) All writes to the database file are synced prior to the rollback journal\r\n**     being deleted, truncated, or zeroed.\r\n** \r\n** (6) If a master journal file is used, then all writes to the database file\r\n**     are synced prior to the master journal being deleted.\r\n** \r\n** Definition: Two databases (or the same database at two points it time)\r\n** are said to be \"logically equivalent\" if they give the same answer to\r\n** all queries.  Note in particular the the content of freelist leaf\r\n** pages can be changed arbitarily without effecting the logical equivalence\r\n** of the database.\r\n** \r\n** (7) At any time, if any subset, including the empty set and the total set,\r\n**     of the unsynced changes to a rollback journal are removed and the \r\n**     journal is rolled back, the resulting database file will be logical\r\n**     equivalent to the database file at the beginning of the transaction.\r\n** \r\n** (8) When a transaction is rolled back, the xTruncate method of the VFS\r\n**     is called to restore the database file to the same size it was at\r\n**     the beginning of the transaction.  (In some VFSes, the xTruncate\r\n**     method is a no-op, but that does not change the fact the SQLite will\r\n**     invoke it.)\r\n** \r\n** (9) Whenever the database file is modified, at least one bit in the range\r\n**     of bytes from 24 through 39 inclusive will be changed prior to releasing\r\n**     the EXCLUSIVE lock, thus signaling other connections on the same\r\n**     database to flush their caches.\r\n**\r\n** (10) The pattern of bits in bytes 24 through 39 shall not repeat in less\r\n**      than one billion transactions.\r\n**\r\n** (11) A database file is well-formed at the beginning and at the conclusion\r\n**      of every transaction.\r\n**\r\n** (12) An EXCLUSIVE lock is held on the database file when writing to\r\n**      the database file.\r\n**\r\n** (13) A SHARED lock is held on the database file while reading any\r\n**      content out of the database file.\r\n**\r\n******************************************************************************/\r\n\r\n/*\r\n** Macros for troubleshooting.  Normally turned off\r\n*/\r\n#if 0\r\nint sqlite3PagerTrace=1;  /* True to enable tracing */\r\n#define sqlite3DebugPrintf printf\r\n#define PAGERTRACE(X)     if( sqlite3PagerTrace ){ sqlite3DebugPrintf X; }\r\n#else\r\n#define PAGERTRACE(X)\r\n#endif\r\n\r\n/*\r\n** The following two macros are used within the PAGERTRACE() macros above\r\n** to print out file-descriptors. \r\n**\r\n** PAGERID() takes a pointer to a Pager struct as its argument. The\r\n** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file\r\n** struct as its argument.\r\n*/\r\n#define PAGERID(p) ((int)(p->fd))\r\n#define FILEHANDLEID(fd) ((int)fd)\r\n\r\n/*\r\n** The Pager.eState variable stores the current 'state' of a pager. A\r\n** pager may be in any one of the seven states shown in the following\r\n** state diagram.\r\n**\r\n**                            OPEN <------+------+\r\n**                              |         |      |\r\n**                              V         |      |\r\n**               +---------> READER-------+      |\r\n**               |              |                |\r\n**               |              V                |\r\n**               |<-------WRITER_LOCKED------> ERROR\r\n**               |              |                ^  \r\n**               |              V                |\r\n**               |<------WRITER_CACHEMOD-------->|\r\n**               |              |                |\r\n**               |              V                |\r\n**               |<-------WRITER_DBMOD---------->|\r\n**               |              |                |\r\n**               |              V                |\r\n**               +<------WRITER_FINISHED-------->+\r\n**\r\n**\r\n** List of state transitions and the C [function] that performs each:\r\n** \r\n**   OPEN              -> READER              [sqlite3PagerSharedLock]\r\n**   READER            -> OPEN                [pager_unlock]\r\n**\r\n**   READER            -> WRITER_LOCKED       [sqlite3PagerBegin]\r\n**   WRITER_LOCKED     -> WRITER_CACHEMOD     [pager_open_journal]\r\n**   WRITER_CACHEMOD   -> WRITER_DBMOD        [syncJournal]\r\n**   WRITER_DBMOD      -> WRITER_FINISHED     [sqlite3PagerCommitPhaseOne]\r\n**   WRITER_***        -> READER              [pager_end_transaction]\r\n**\r\n**   WRITER_***        -> ERROR               [pager_error]\r\n**   ERROR             -> OPEN                [pager_unlock]\r\n** \r\n**\r\n**  OPEN:\r\n**\r\n**    The pager starts up in this state. Nothing is guaranteed in this\r\n**    state - the file may or may not be locked and the database size is\r\n**    unknown. The database may not be read or written.\r\n**\r\n**    * No read or write transaction is active.\r\n**    * Any lock, or no lock at all, may be held on the database file.\r\n**    * The dbSize, dbOrigSize and dbFileSize variables may not be trusted.\r\n**\r\n**  READER:\r\n**\r\n**    In this state all the requirements for reading the database in \r\n**    rollback (non-WAL) mode are met. Unless the pager is (or recently\r\n**    was) in exclusive-locking mode, a user-level read transaction is \r\n**    open. The database size is known in this state.\r\n**\r\n**    A connection running with locking_mode=normal enters this state when\r\n**    it opens a read-transaction on the database and returns to state\r\n**    OPEN after the read-transaction is completed. However a connection\r\n**    running in locking_mode=exclusive (including temp databases) remains in\r\n**    this state even after the read-transaction is closed. The only way\r\n**    a locking_mode=exclusive connection can transition from READER to OPEN\r\n**    is via the ERROR state (see below).\r\n** \r\n**    * A read transaction may be active (but a write-transaction cannot).\r\n**    * A SHARED or greater lock is held on the database file.\r\n**    * The dbSize variable may be trusted (even if a user-level read \r\n**      transaction is not active). The dbOrigSize and dbFileSize variables\r\n**      may not be trusted at this point.\r\n**    * If the database is a WAL database, then the WAL connection is open.\r\n**    * Even if a read-transaction is not open, it is guaranteed that \r\n**      there is no hot-journal in the file-system.\r\n**\r\n**  WRITER_LOCKED:\r\n**\r\n**    The pager moves to this state from READER when a write-transaction\r\n**    is first opened on the database. In WRITER_LOCKED state, all locks \r\n**    required to start a write-transaction are held, but no actual \r\n**    modifications to the cache or database have taken place.\r\n**\r\n**    In rollback mode, a RESERVED or (if the transaction was opened with \r\n**    BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when\r\n**    moving to this state, but the journal file is not written to or opened \r\n**    to in this state. If the transaction is committed or rolled back while \r\n**    in WRITER_LOCKED state, all that is required is to unlock the database \r\n**    file.\r\n**\r\n**    IN WAL mode, WalBeginWriteTransaction() is called to lock the log file.\r\n**    If the connection is running with locking_mode=exclusive, an attempt\r\n**    is made to obtain an EXCLUSIVE lock on the database file.\r\n**\r\n**    * A write transaction is active.\r\n**    * If the connection is open in rollback-mode, a RESERVED or greater \r\n**      lock is held on the database file.\r\n**    * If the connection is open in WAL-mode, a WAL write transaction\r\n**      is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully\r\n**      called).\r\n**    * The dbSize, dbOrigSize and dbFileSize variables are all valid.\r\n**    * The contents of the pager cache have not been modified.\r\n**    * The journal file may or may not be open.\r\n**    * Nothing (not even the first header) has been written to the journal.\r\n**\r\n**  WRITER_CACHEMOD:\r\n**\r\n**    A pager moves from WRITER_LOCKED state to this state when a page is\r\n**    first modified by the upper layer. In rollback mode the journal file\r\n**    is opened (if it is not already open) and a header written to the\r\n**    start of it. The database file on disk has not been modified.\r\n**\r\n**    * A write transaction is active.\r\n**    * A RESERVED or greater lock is held on the database file.\r\n**    * The journal file is open and the first header has been written \r\n**      to it, but the header has not been synced to disk.\r\n**    * The contents of the page cache have been modified.\r\n**\r\n**  WRITER_DBMOD:\r\n**\r\n**    The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state\r\n**    when it modifies the contents of the database file. WAL connections\r\n**    never enter this state (since they do not modify the database file,\r\n**    just the log file).\r\n**\r\n**    * A write transaction is active.\r\n**    * An EXCLUSIVE or greater lock is held on the database file.\r\n**    * The journal file is open and the first header has been written \r\n**      and synced to disk.\r\n**    * The contents of the page cache have been modified (and possibly\r\n**      written to disk).\r\n**\r\n**  WRITER_FINISHED:\r\n**\r\n**    It is not possible for a WAL connection to enter this state.\r\n**\r\n**    A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD\r\n**    state after the entire transaction has been successfully written into the\r\n**    database file. In this state the transaction may be committed simply\r\n**    by finalizing the journal file. Once in WRITER_FINISHED state, it is \r\n**    not possible to modify the database further. At this point, the upper \r\n**    layer must either commit or rollback the transaction.\r\n**\r\n**    * A write transaction is active.\r\n**    * An EXCLUSIVE or greater lock is held on the database file.\r\n**    * All writing and syncing of journal and database data has finished.\r\n**      If no error occured, all that remains is to finalize the journal to\r\n**      commit the transaction. If an error did occur, the caller will need\r\n**      to rollback the transaction. \r\n**\r\n**  ERROR:\r\n**\r\n**    The ERROR state is entered when an IO or disk-full error (including\r\n**    SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it \r\n**    difficult to be sure that the in-memory pager state (cache contents, \r\n**    db size etc.) are consistent with the contents of the file-system.\r\n**\r\n**    Temporary pager files may enter the ERROR state, but in-memory pagers\r\n**    cannot.\r\n**\r\n**    For example, if an IO error occurs while performing a rollback, \r\n**    the contents of the page-cache may be left in an inconsistent state.\r\n**    At this point it would be dangerous to change back to READER state\r\n**    (as usually happens after a rollback). Any subsequent readers might\r\n**    report database corruption (due to the inconsistent cache), and if\r\n**    they upgrade to writers, they may inadvertently corrupt the database\r\n**    file. To avoid this hazard, the pager switches into the ERROR state\r\n**    instead of READER following such an error.\r\n**\r\n**    Once it has entered the ERROR state, any attempt to use the pager\r\n**    to read or write data returns an error. Eventually, once all \r\n**    outstanding transactions have been abandoned, the pager is able to\r\n**    transition back to OPEN state, discarding the contents of the \r\n**    page-cache and any other in-memory state at the same time. Everything\r\n**    is reloaded from disk (and, if necessary, hot-journal rollback peformed)\r\n**    when a read-transaction is next opened on the pager (transitioning\r\n**    the pager into READER state). At that point the system has recovered \r\n**    from the error.\r\n**\r\n**    Specifically, the pager jumps into the ERROR state if:\r\n**\r\n**      1. An error occurs while attempting a rollback. This happens in\r\n**         function sqlite3PagerRollback().\r\n**\r\n**      2. An error occurs while attempting to finalize a journal file\r\n**         following a commit in function sqlite3PagerCommitPhaseTwo().\r\n**\r\n**      3. An error occurs while attempting to write to the journal or\r\n**         database file in function pagerStress() in order to free up\r\n**         memory.\r\n**\r\n**    In other cases, the error is returned to the b-tree layer. The b-tree\r\n**    layer then attempts a rollback operation. If the error condition \r\n**    persists, the pager enters the ERROR state via condition (1) above.\r\n**\r\n**    Condition (3) is necessary because it can be triggered by a read-only\r\n**    statement executed within a transaction. In this case, if the error\r\n**    code were simply returned to the user, the b-tree layer would not\r\n**    automatically attempt a rollback, as it assumes that an error in a\r\n**    read-only statement cannot leave the pager in an internally inconsistent \r\n**    state.\r\n**\r\n**    * The Pager.errCode variable is set to something other than SQLITE_OK.\r\n**    * There are one or more outstanding references to pages (after the\r\n**      last reference is dropped the pager should move back to OPEN state).\r\n**    * The pager is not an in-memory pager.\r\n**    \r\n**\r\n** Notes:\r\n**\r\n**   * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the\r\n**     connection is open in WAL mode. A WAL connection is always in one\r\n**     of the first four states.\r\n**\r\n**   * Normally, a connection open in exclusive mode is never in PAGER_OPEN\r\n**     state. There are two exceptions: immediately after exclusive-mode has\r\n**     been turned on (and before any read or write transactions are \r\n**     executed), and when the pager is leaving the \"error state\".\r\n**\r\n**   * See also: assert_pager_state().\r\n*/\r\n#define PAGER_OPEN                  0\r\n#define PAGER_READER                1\r\n#define PAGER_WRITER_LOCKED         2\r\n#define PAGER_WRITER_CACHEMOD       3\r\n#define PAGER_WRITER_DBMOD          4\r\n#define PAGER_WRITER_FINISHED       5\r\n#define PAGER_ERROR                 6\r\n\r\n/*\r\n** The Pager.eLock variable is almost always set to one of the \r\n** following locking-states, according to the lock currently held on\r\n** the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.\r\n** This variable is kept up to date as locks are taken and released by\r\n** the pagerLockDb() and pagerUnlockDb() wrappers.\r\n**\r\n** If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY\r\n** (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not\r\n** the operation was successful. In these circumstances pagerLockDb() and\r\n** pagerUnlockDb() take a conservative approach - eLock is always updated\r\n** when unlocking the file, and only updated when locking the file if the\r\n** VFS call is successful. This way, the Pager.eLock variable may be set\r\n** to a less exclusive (lower) value than the lock that is actually held\r\n** at the system level, but it is never set to a more exclusive value.\r\n**\r\n** This is usually safe. If an xUnlock fails or appears to fail, there may \r\n** be a few redundant xLock() calls or a lock may be held for longer than\r\n** required, but nothing really goes wrong.\r\n**\r\n** The exception is when the database file is unlocked as the pager moves\r\n** from ERROR to OPEN state. At this point there may be a hot-journal file \r\n** in the file-system that needs to be rolled back (as part of a OPEN->SHARED\r\n** transition, by the same pager or any other). If the call to xUnlock()\r\n** fails at this point and the pager is left holding an EXCLUSIVE lock, this\r\n** can confuse the call to xCheckReservedLock() call made later as part\r\n** of hot-journal detection.\r\n**\r\n** xCheckReservedLock() is defined as returning true \"if there is a RESERVED \r\n** lock held by this process or any others\". So xCheckReservedLock may \r\n** return true because the caller itself is holding an EXCLUSIVE lock (but\r\n** doesn't know it because of a previous error in xUnlock). If this happens\r\n** a hot-journal may be mistaken for a journal being created by an active\r\n** transaction in another process, causing SQLite to read from the database\r\n** without rolling it back.\r\n**\r\n** To work around this, if a call to xUnlock() fails when unlocking the\r\n** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It\r\n** is only changed back to a real locking state after a successful call\r\n** to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition\r\n** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK \r\n** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE\r\n** lock on the database file before attempting to roll it back. See function\r\n** PagerSharedLock() for more detail.\r\n**\r\n** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in \r\n** PAGER_OPEN state.\r\n*/\r\n#define UNKNOWN_LOCK                (EXCLUSIVE_LOCK+1)\r\n\r\n/*\r\n** A macro used for invoking the codec if there is one\r\n*/\r\n#ifdef SQLITE_HAS_CODEC\r\n# define CODEC1(P,D,N,X,E) \\\r\n    if( P->xCodec && P->xCodec(P->pCodec,D,N,X)==0 ){ E; }\r\n# define CODEC2(P,D,N,X,E,O) \\\r\n    if( P->xCodec==0 ){ O=(char*)D; }else \\\r\n    if( (O=(char*)(P->xCodec(P->pCodec,D,N,X)))==0 ){ E; }\r\n#else\r\n# define CODEC1(P,D,N,X,E)   /* NO-OP */\r\n# define CODEC2(P,D,N,X,E,O) O=(char*)D\r\n#endif\r\n\r\n/*\r\n** The maximum allowed sector size. 64KiB. If the xSectorsize() method \r\n** returns a value larger than this, then MAX_SECTOR_SIZE is used instead.\r\n** This could conceivably cause corruption following a power failure on\r\n** such a system. This is currently an undocumented limit.\r\n*/\r\n#define MAX_SECTOR_SIZE 0x10000\r\n\r\n/*\r\n** An instance of the following structure is allocated for each active\r\n** savepoint and statement transaction in the system. All such structures\r\n** are stored in the Pager.aSavepoint[] array, which is allocated and\r\n** resized using sqlite3Realloc().\r\n**\r\n** When a savepoint is created, the PagerSavepoint.iHdrOffset field is\r\n** set to 0. If a journal-header is written into the main journal while\r\n** the savepoint is active, then iHdrOffset is set to the byte offset \r\n** immediately following the last journal record written into the main\r\n** journal before the journal-header. This is required during savepoint\r\n** rollback (see pagerPlaybackSavepoint()).\r\n*/\r\ntypedef struct PagerSavepoint PagerSavepoint;\r\nstruct PagerSavepoint {\r\n  i64 iOffset;                 /* Starting offset in main journal */\r\n  i64 iHdrOffset;              /* See above */\r\n  Bitvec *pInSavepoint;        /* Set of pages in this savepoint */\r\n  Pgno nOrig;                  /* Original number of pages in file */\r\n  Pgno iSubRec;                /* Index of first record in sub-journal */\r\n#ifndef SQLITE_OMIT_WAL\r\n  u32 aWalData[WAL_SAVEPOINT_NDATA];        /* WAL savepoint context */\r\n#endif\r\n};\r\n\r\n/*\r\n** A open page cache is an instance of struct Pager. A description of\r\n** some of the more important member variables follows:\r\n**\r\n** eState\r\n**\r\n**   The current 'state' of the pager object. See the comment and state\r\n**   diagram above for a description of the pager state.\r\n**\r\n** eLock\r\n**\r\n**   For a real on-disk database, the current lock held on the database file -\r\n**   NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.\r\n**\r\n**   For a temporary or in-memory database (neither of which require any\r\n**   locks), this variable is always set to EXCLUSIVE_LOCK. Since such\r\n**   databases always have Pager.exclusiveMode==1, this tricks the pager\r\n**   logic into thinking that it already has all the locks it will ever\r\n**   need (and no reason to release them).\r\n**\r\n**   In some (obscure) circumstances, this variable may also be set to\r\n**   UNKNOWN_LOCK. See the comment above the #define of UNKNOWN_LOCK for\r\n**   details.\r\n**\r\n** changeCountDone\r\n**\r\n**   This boolean variable is used to make sure that the change-counter \r\n**   (the 4-byte header field at byte offset 24 of the database file) is \r\n**   not updated more often than necessary. \r\n**\r\n**   It is set to true when the change-counter field is updated, which \r\n**   can only happen if an exclusive lock is held on the database file.\r\n**   It is cleared (set to false) whenever an exclusive lock is \r\n**   relinquished on the database file. Each time a transaction is committed,\r\n**   The changeCountDone flag is inspected. If it is true, the work of\r\n**   updating the change-counter is omitted for the current transaction.\r\n**\r\n**   This mechanism means that when running in exclusive mode, a connection \r\n**   need only update the change-counter once, for the first transaction\r\n**   committed.\r\n**\r\n** setMaster\r\n**\r\n**   When PagerCommitPhaseOne() is called to commit a transaction, it may\r\n**   (or may not) specify a master-journal name to be written into the \r\n**   journal file before it is synced to disk.\r\n**\r\n**   Whether or not a journal file contains a master-journal pointer affects \r\n**   the way in which the journal file is finalized after the transaction is \r\n**   committed or rolled back when running in \"journal_mode=PERSIST\" mode.\r\n**   If a journal file does not contain a master-journal pointer, it is\r\n**   finalized by overwriting the first journal header with zeroes. If\r\n**   it does contain a master-journal pointer the journal file is finalized \r\n**   by truncating it to zero bytes, just as if the connection were \r\n**   running in \"journal_mode=truncate\" mode.\r\n**\r\n**   Journal files that contain master journal pointers cannot be finalized\r\n**   simply by overwriting the first journal-header with zeroes, as the\r\n**   master journal pointer could interfere with hot-journal rollback of any\r\n**   subsequently interrupted transaction that reuses the journal file.\r\n**\r\n**   The flag is cleared as soon as the journal file is finalized (either\r\n**   by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the\r\n**   journal file from being successfully finalized, the setMaster flag\r\n**   is cleared anyway (and the pager will move to ERROR state).\r\n**\r\n** doNotSpill, doNotSyncSpill\r\n**\r\n**   These two boolean variables control the behaviour of cache-spills\r\n**   (calls made by the pcache module to the pagerStress() routine to\r\n**   write cached data to the file-system in order to free up memory).\r\n**\r\n**   When doNotSpill is non-zero, writing to the database from pagerStress()\r\n**   is disabled altogether. This is done in a very obscure case that\r\n**   comes up during savepoint rollback that requires the pcache module\r\n**   to allocate a new page to prevent the journal file from being written\r\n**   while it is being traversed by code in pager_playback().\r\n** \r\n**   If doNotSyncSpill is non-zero, writing to the database from pagerStress()\r\n**   is permitted, but syncing the journal file is not. This flag is set\r\n**   by sqlite3PagerWrite() when the file-system sector-size is larger than\r\n**   the database page-size in order to prevent a journal sync from happening \r\n**   in between the journalling of two pages on the same sector. \r\n**\r\n** subjInMemory\r\n**\r\n**   This is a boolean variable. If true, then any required sub-journal\r\n**   is opened as an in-memory journal file. If false, then in-memory\r\n**   sub-journals are only used for in-memory pager files.\r\n**\r\n**   This variable is updated by the upper layer each time a new \r\n**   write-transaction is opened.\r\n**\r\n** dbSize, dbOrigSize, dbFileSize\r\n**\r\n**   Variable dbSize is set to the number of pages in the database file.\r\n**   It is valid in PAGER_READER and higher states (all states except for\r\n**   OPEN and ERROR). \r\n**\r\n**   dbSize is set based on the size of the database file, which may be \r\n**   larger than the size of the database (the value stored at offset\r\n**   28 of the database header by the btree). If the size of the file\r\n**   is not an integer multiple of the page-size, the value stored in\r\n**   dbSize is rounded down (i.e. a 5KB file with 2K page-size has dbSize==2).\r\n**   Except, any file that is greater than 0 bytes in size is considered\r\n**   to have at least one page. (i.e. a 1KB file with 2K page-size leads\r\n**   to dbSize==1).\r\n**\r\n**   During a write-transaction, if pages with page-numbers greater than\r\n**   dbSize are modified in the cache, dbSize is updated accordingly.\r\n**   Similarly, if the database is truncated using PagerTruncateImage(), \r\n**   dbSize is updated.\r\n**\r\n**   Variables dbOrigSize and dbFileSize are valid in states \r\n**   PAGER_WRITER_LOCKED and higher. dbOrigSize is a copy of the dbSize\r\n**   variable at the start of the transaction. It is used during rollback,\r\n**   and to determine whether or not pages need to be journalled before\r\n**   being modified.\r\n**\r\n**   Throughout a write-transaction, dbFileSize contains the size of\r\n**   the file on disk in pages. It is set to a copy of dbSize when the\r\n**   write-transaction is first opened, and updated when VFS calls are made\r\n**   to write or truncate the database file on disk. \r\n**\r\n**   The only reason the dbFileSize variable is required is to suppress \r\n**   unnecessary calls to xTruncate() after committing a transaction. If, \r\n**   when a transaction is committed, the dbFileSize variable indicates \r\n**   that the database file is larger than the database image (Pager.dbSize), \r\n**   pager_truncate() is called. The pager_truncate() call uses xFilesize()\r\n**   to measure the database file on disk, and then truncates it if required.\r\n**   dbFileSize is not used when rolling back a transaction. In this case\r\n**   pager_truncate() is called unconditionally (which means there may be\r\n**   a call to xFilesize() that is not strictly required). In either case,\r\n**   pager_truncate() may cause the file to become smaller or larger.\r\n**\r\n** dbHintSize\r\n**\r\n**   The dbHintSize variable is used to limit the number of calls made to\r\n**   the VFS xFileControl(FCNTL_SIZE_HINT) method. \r\n**\r\n**   dbHintSize is set to a copy of the dbSize variable when a\r\n**   write-transaction is opened (at the same time as dbFileSize and\r\n**   dbOrigSize). If the xFileControl(FCNTL_SIZE_HINT) method is called,\r\n**   dbHintSize is increased to the number of pages that correspond to the\r\n**   size-hint passed to the method call. See pager_write_pagelist() for \r\n**   details.\r\n**\r\n** errCode\r\n**\r\n**   The Pager.errCode variable is only ever used in PAGER_ERROR state. It\r\n**   is set to zero in all other states. In PAGER_ERROR state, Pager.errCode \r\n**   is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX \r\n**   sub-codes.\r\n*/\r\nstruct Pager {\r\n  sqlite3_vfs *pVfs;          /* OS functions to use for IO */\r\n  u8 exclusiveMode;           /* Boolean. True if locking_mode==EXCLUSIVE */\r\n  u8 journalMode;             /* One of the PAGER_JOURNALMODE_* values */\r\n  u8 useJournal;              /* Use a rollback journal on this file */\r\n  u8 noSync;                  /* Do not sync the journal if true */\r\n  u8 fullSync;                /* Do extra syncs of the journal for robustness */\r\n  u8 ckptSyncFlags;           /* SYNC_NORMAL or SYNC_FULL for checkpoint */\r\n  u8 walSyncFlags;            /* SYNC_NORMAL or SYNC_FULL for wal writes */\r\n  u8 syncFlags;               /* SYNC_NORMAL or SYNC_FULL otherwise */\r\n  u8 tempFile;                /* zFilename is a temporary file */\r\n  u8 readOnly;                /* True for a read-only database */\r\n  u8 memDb;                   /* True to inhibit all file I/O */\r\n\r\n  /**************************************************************************\r\n  ** The following block contains those class members that change during\r\n  ** routine opertion.  Class members not in this block are either fixed\r\n  ** when the pager is first created or else only change when there is a\r\n  ** significant mode change (such as changing the page_size, locking_mode,\r\n  ** or the journal_mode).  From another view, these class members describe\r\n  ** the \"state\" of the pager, while other class members describe the\r\n  ** \"configuration\" of the pager.\r\n  */\r\n  u8 eState;                  /* Pager state (OPEN, READER, WRITER_LOCKED..) */\r\n  u8 eLock;                   /* Current lock held on database file */\r\n  u8 changeCountDone;         /* Set after incrementing the change-counter */\r\n  u8 setMaster;               /* True if a m-j name has been written to jrnl */\r\n  u8 doNotSpill;              /* Do not spill the cache when non-zero */\r\n  u8 doNotSyncSpill;          /* Do not do a spill that requires jrnl sync */\r\n  u8 subjInMemory;            /* True to use in-memory sub-journals */\r\n  Pgno dbSize;                /* Number of pages in the database */\r\n  Pgno dbOrigSize;            /* dbSize before the current transaction */\r\n  Pgno dbFileSize;            /* Number of pages in the database file */\r\n  Pgno dbHintSize;            /* Value passed to FCNTL_SIZE_HINT call */\r\n  int errCode;                /* One of several kinds of errors */\r\n  int nRec;                   /* Pages journalled since last j-header written */\r\n  u32 cksumInit;              /* Quasi-random value added to every checksum */\r\n  u32 nSubRec;                /* Number of records written to sub-journal */\r\n  Bitvec *pInJournal;         /* One bit for each page in the database file */\r\n  sqlite3_file *fd;           /* File descriptor for database */\r\n  sqlite3_file *jfd;          /* File descriptor for main journal */\r\n  sqlite3_file *sjfd;         /* File descriptor for sub-journal */\r\n  i64 journalOff;             /* Current write offset in the journal file */\r\n  i64 journalHdr;             /* Byte offset to previous journal header */\r\n  sqlite3_backup *pBackup;    /* Pointer to list of ongoing backup processes */\r\n  PagerSavepoint *aSavepoint; /* Array of active savepoints */\r\n  int nSavepoint;             /* Number of elements in aSavepoint[] */\r\n  char dbFileVers[16];        /* Changes whenever database file changes */\r\n  /*\r\n  ** End of the routinely-changing class members\r\n  ***************************************************************************/\r\n\r\n  u16 nExtra;                 /* Add this many bytes to each in-memory page */\r\n  i16 nReserve;               /* Number of unused bytes at end of each page */\r\n  u32 vfsFlags;               /* Flags for sqlite3_vfs.xOpen() */\r\n  u32 sectorSize;             /* Assumed sector size during rollback */\r\n  int pageSize;               /* Number of bytes in a page */\r\n  Pgno mxPgno;                /* Maximum allowed size of the database */\r\n  i64 journalSizeLimit;       /* Size limit for persistent journal files */\r\n  char *zFilename;            /* Name of the database file */\r\n  char *zJournal;             /* Name of the journal file */\r\n  int (*xBusyHandler)(void*); /* Function to call when busy */\r\n  void *pBusyHandlerArg;      /* Context argument for xBusyHandler */\r\n  int nHit, nMiss;            /* Total cache hits and misses */\r\n#ifdef SQLITE_TEST\r\n  int nRead, nWrite;          /* Database pages read/written */\r\n#endif\r\n  void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */\r\n#ifdef SQLITE_HAS_CODEC\r\n  void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */\r\n  void (*xCodecSizeChng)(void*,int,int); /* Notify of page size changes */\r\n  void (*xCodecFree)(void*);             /* Destructor for the codec */\r\n  void *pCodec;               /* First argument to xCodec... methods */\r\n#endif\r\n  char *pTmpSpace;            /* Pager.pageSize bytes of space for tmp use */\r\n  PCache *pPCache;            /* Pointer to page cache object */\r\n#ifndef SQLITE_OMIT_WAL\r\n  Wal *pWal;                  /* Write-ahead log used by \"journal_mode=wal\" */\r\n  char *zWal;                 /* File name for write-ahead log */\r\n#endif\r\n};\r\n\r\n/*\r\n** The following global variables hold counters used for\r\n** testing purposes only.  These variables do not exist in\r\n** a non-testing build.  These variables are not thread-safe.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_pager_readdb_count = 0;    /* Number of full pages read from DB */\r\nSQLITE_API int sqlite3_pager_writedb_count = 0;   /* Number of full pages written to DB */\r\nSQLITE_API int sqlite3_pager_writej_count = 0;    /* Number of pages written to journal */\r\n# define PAGER_INCR(v)  v++\r\n#else\r\n# define PAGER_INCR(v)\r\n#endif\r\n\r\n\r\n\r\n/*\r\n** Journal files begin with the following magic string.  The data\r\n** was obtained from /dev/random.  It is used only as a sanity check.\r\n**\r\n** Since version 2.8.0, the journal format contains additional sanity\r\n** checking information.  If the power fails while the journal is being\r\n** written, semi-random garbage data might appear in the journal\r\n** file after power is restored.  If an attempt is then made\r\n** to roll the journal back, the database could be corrupted.  The additional\r\n** sanity checking data is an attempt to discover the garbage in the\r\n** journal and ignore it.\r\n**\r\n** The sanity checking information for the new journal format consists\r\n** of a 32-bit checksum on each page of data.  The checksum covers both\r\n** the page number and the pPager->pageSize bytes of data for the page.\r\n** This cksum is initialized to a 32-bit random value that appears in the\r\n** journal file right after the header.  The random initializer is important,\r\n** because garbage data that appears at the end of a journal is likely\r\n** data that was once in other files that have now been deleted.  If the\r\n** garbage data came from an obsolete journal file, the checksums might\r\n** be correct.  But by initializing the checksum to random value which\r\n** is different for every journal, we minimize that risk.\r\n*/\r\nstatic const unsigned char aJournalMagic[] = {\r\n  0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd7,\r\n};\r\n\r\n/*\r\n** The size of the of each page record in the journal is given by\r\n** the following macro.\r\n*/\r\n#define JOURNAL_PG_SZ(pPager)  ((pPager->pageSize) + 8)\r\n\r\n/*\r\n** The journal header size for this pager. This is usually the same \r\n** size as a single disk sector. See also setSectorSize().\r\n*/\r\n#define JOURNAL_HDR_SZ(pPager) (pPager->sectorSize)\r\n\r\n/*\r\n** The macro MEMDB is true if we are dealing with an in-memory database.\r\n** We do this as a macro so that if the SQLITE_OMIT_MEMORYDB macro is set,\r\n** the value of MEMDB will be a constant and the compiler will optimize\r\n** out code that would never execute.\r\n*/\r\n#ifdef SQLITE_OMIT_MEMORYDB\r\n# define MEMDB 0\r\n#else\r\n# define MEMDB pPager->memDb\r\n#endif\r\n\r\n/*\r\n** The maximum legal page number is (2^31 - 1).\r\n*/\r\n#define PAGER_MAX_PGNO 2147483647\r\n\r\n/*\r\n** The argument to this macro is a file descriptor (type sqlite3_file*).\r\n** Return 0 if it is not open, or non-zero (but not 1) if it is.\r\n**\r\n** This is so that expressions can be written as:\r\n**\r\n**   if( isOpen(pPager->jfd) ){ ...\r\n**\r\n** instead of\r\n**\r\n**   if( pPager->jfd->pMethods ){ ...\r\n*/\r\n#define isOpen(pFd) ((pFd)->pMethods)\r\n\r\n/*\r\n** Return true if this pager uses a write-ahead log instead of the usual\r\n** rollback journal. Otherwise false.\r\n*/\r\n#ifndef SQLITE_OMIT_WAL\r\nstatic int pagerUseWal(Pager *pPager){\r\n  return (pPager->pWal!=0);\r\n}\r\n#else\r\n# define pagerUseWal(x) 0\r\n# define pagerRollbackWal(x) 0\r\n# define pagerWalFrames(v,w,x,y) 0\r\n# define pagerOpenWalIfPresent(z) SQLITE_OK\r\n# define pagerBeginReadTransaction(z) SQLITE_OK\r\n#endif\r\n\r\n#ifndef NDEBUG \r\n/*\r\n** Usage:\r\n**\r\n**   assert( assert_pager_state(pPager) );\r\n**\r\n** This function runs many asserts to try to find inconsistencies in\r\n** the internal state of the Pager object.\r\n*/\r\nstatic int assert_pager_state(Pager *p){\r\n  Pager *pPager = p;\r\n\r\n  /* State must be valid. */\r\n  assert( p->eState==PAGER_OPEN\r\n       || p->eState==PAGER_READER\r\n       || p->eState==PAGER_WRITER_LOCKED\r\n       || p->eState==PAGER_WRITER_CACHEMOD\r\n       || p->eState==PAGER_WRITER_DBMOD\r\n       || p->eState==PAGER_WRITER_FINISHED\r\n       || p->eState==PAGER_ERROR\r\n  );\r\n\r\n  /* Regardless of the current state, a temp-file connection always behaves\r\n  ** as if it has an exclusive lock on the database file. It never updates\r\n  ** the change-counter field, so the changeCountDone flag is always set.\r\n  */\r\n  assert( p->tempFile==0 || p->eLock==EXCLUSIVE_LOCK );\r\n  assert( p->tempFile==0 || pPager->changeCountDone );\r\n\r\n  /* If the useJournal flag is clear, the journal-mode must be \"OFF\". \r\n  ** And if the journal-mode is \"OFF\", the journal file must not be open.\r\n  */\r\n  assert( p->journalMode==PAGER_JOURNALMODE_OFF || p->useJournal );\r\n  assert( p->journalMode!=PAGER_JOURNALMODE_OFF || !isOpen(p->jfd) );\r\n\r\n  /* Check that MEMDB implies noSync. And an in-memory journal. Since \r\n  ** this means an in-memory pager performs no IO at all, it cannot encounter \r\n  ** either SQLITE_IOERR or SQLITE_FULL during rollback or while finalizing \r\n  ** a journal file. (although the in-memory journal implementation may \r\n  ** return SQLITE_IOERR_NOMEM while the journal file is being written). It \r\n  ** is therefore not possible for an in-memory pager to enter the ERROR \r\n  ** state.\r\n  */\r\n  if( MEMDB ){\r\n    assert( p->noSync );\r\n    assert( p->journalMode==PAGER_JOURNALMODE_OFF \r\n         || p->journalMode==PAGER_JOURNALMODE_MEMORY \r\n    );\r\n    assert( p->eState!=PAGER_ERROR && p->eState!=PAGER_OPEN );\r\n    assert( pagerUseWal(p)==0 );\r\n  }\r\n\r\n  /* If changeCountDone is set, a RESERVED lock or greater must be held\r\n  ** on the file.\r\n  */\r\n  assert( pPager->changeCountDone==0 || pPager->eLock>=RESERVED_LOCK );\r\n  assert( p->eLock!=PENDING_LOCK );\r\n\r\n  switch( p->eState ){\r\n    case PAGER_OPEN:\r\n      assert( !MEMDB );\r\n      assert( pPager->errCode==SQLITE_OK );\r\n      assert( sqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile );\r\n      break;\r\n\r\n    case PAGER_READER:\r\n      assert( pPager->errCode==SQLITE_OK );\r\n      assert( p->eLock!=UNKNOWN_LOCK );\r\n      assert( p->eLock>=SHARED_LOCK );\r\n      break;\r\n\r\n    case PAGER_WRITER_LOCKED:\r\n      assert( p->eLock!=UNKNOWN_LOCK );\r\n      assert( pPager->errCode==SQLITE_OK );\r\n      if( !pagerUseWal(pPager) ){\r\n        assert( p->eLock>=RESERVED_LOCK );\r\n      }\r\n      assert( pPager->dbSize==pPager->dbOrigSize );\r\n      assert( pPager->dbOrigSize==pPager->dbFileSize );\r\n      assert( pPager->dbOrigSize==pPager->dbHintSize );\r\n      assert( pPager->setMaster==0 );\r\n      break;\r\n\r\n    case PAGER_WRITER_CACHEMOD:\r\n      assert( p->eLock!=UNKNOWN_LOCK );\r\n      assert( pPager->errCode==SQLITE_OK );\r\n      if( !pagerUseWal(pPager) ){\r\n        /* It is possible that if journal_mode=wal here that neither the\r\n        ** journal file nor the WAL file are open. This happens during\r\n        ** a rollback transaction that switches from journal_mode=off\r\n        ** to journal_mode=wal.\r\n        */\r\n        assert( p->eLock>=RESERVED_LOCK );\r\n        assert( isOpen(p->jfd) \r\n             || p->journalMode==PAGER_JOURNALMODE_OFF \r\n             || p->journalMode==PAGER_JOURNALMODE_WAL \r\n        );\r\n      }\r\n      assert( pPager->dbOrigSize==pPager->dbFileSize );\r\n      assert( pPager->dbOrigSize==pPager->dbHintSize );\r\n      break;\r\n\r\n    case PAGER_WRITER_DBMOD:\r\n      assert( p->eLock==EXCLUSIVE_LOCK );\r\n      assert( pPager->errCode==SQLITE_OK );\r\n      assert( !pagerUseWal(pPager) );\r\n      assert( p->eLock>=EXCLUSIVE_LOCK );\r\n      assert( isOpen(p->jfd) \r\n           || p->journalMode==PAGER_JOURNALMODE_OFF \r\n           || p->journalMode==PAGER_JOURNALMODE_WAL \r\n      );\r\n      assert( pPager->dbOrigSize<=pPager->dbHintSize );\r\n      break;\r\n\r\n    case PAGER_WRITER_FINISHED:\r\n      assert( p->eLock==EXCLUSIVE_LOCK );\r\n      assert( pPager->errCode==SQLITE_OK );\r\n      assert( !pagerUseWal(pPager) );\r\n      assert( isOpen(p->jfd) \r\n           || p->journalMode==PAGER_JOURNALMODE_OFF \r\n           || p->journalMode==PAGER_JOURNALMODE_WAL \r\n      );\r\n      break;\r\n\r\n    case PAGER_ERROR:\r\n      /* There must be at least one outstanding reference to the pager if\r\n      ** in ERROR state. Otherwise the pager should have already dropped\r\n      ** back to OPEN state.\r\n      */\r\n      assert( pPager->errCode!=SQLITE_OK );\r\n      assert( sqlite3PcacheRefCount(pPager->pPCache)>0 );\r\n      break;\r\n  }\r\n\r\n  return 1;\r\n}\r\n#endif /* ifndef NDEBUG */\r\n\r\n#ifdef SQLITE_DEBUG \r\n/*\r\n** Return a pointer to a human readable string in a static buffer\r\n** containing the state of the Pager object passed as an argument. This\r\n** is intended to be used within debuggers. For example, as an alternative\r\n** to \"print *pPager\" in gdb:\r\n**\r\n** (gdb) printf \"%s\", print_pager_state(pPager)\r\n*/\r\nstatic char *print_pager_state(Pager *p){\r\n  static char zRet[1024];\r\n\r\n  sqlite3_snprintf(1024, zRet,\r\n      \"Filename:      %s\\n\"\r\n      \"State:         %s errCode=%d\\n\"\r\n      \"Lock:          %s\\n\"\r\n      \"Locking mode:  locking_mode=%s\\n\"\r\n      \"Journal mode:  journal_mode=%s\\n\"\r\n      \"Backing store: tempFile=%d memDb=%d useJournal=%d\\n\"\r\n      \"Journal:       journalOff=%lld journalHdr=%lld\\n\"\r\n      \"Size:          dbsize=%d dbOrigSize=%d dbFileSize=%d\\n\"\r\n      , p->zFilename\r\n      , p->eState==PAGER_OPEN            ? \"OPEN\" :\r\n        p->eState==PAGER_READER          ? \"READER\" :\r\n        p->eState==PAGER_WRITER_LOCKED   ? \"WRITER_LOCKED\" :\r\n        p->eState==PAGER_WRITER_CACHEMOD ? \"WRITER_CACHEMOD\" :\r\n        p->eState==PAGER_WRITER_DBMOD    ? \"WRITER_DBMOD\" :\r\n        p->eState==PAGER_WRITER_FINISHED ? \"WRITER_FINISHED\" :\r\n        p->eState==PAGER_ERROR           ? \"ERROR\" : \"?error?\"\r\n      , (int)p->errCode\r\n      , p->eLock==NO_LOCK         ? \"NO_LOCK\" :\r\n        p->eLock==RESERVED_LOCK   ? \"RESERVED\" :\r\n        p->eLock==EXCLUSIVE_LOCK  ? \"EXCLUSIVE\" :\r\n        p->eLock==SHARED_LOCK     ? \"SHARED\" :\r\n        p->eLock==UNKNOWN_LOCK    ? \"UNKNOWN\" : \"?error?\"\r\n      , p->exclusiveMode ? \"exclusive\" : \"normal\"\r\n      , p->journalMode==PAGER_JOURNALMODE_MEMORY   ? \"memory\" :\r\n        p->journalMode==PAGER_JOURNALMODE_OFF      ? \"off\" :\r\n        p->journalMode==PAGER_JOURNALMODE_DELETE   ? \"delete\" :\r\n        p->journalMode==PAGER_JOURNALMODE_PERSIST  ? \"persist\" :\r\n        p->journalMode==PAGER_JOURNALMODE_TRUNCATE ? \"truncate\" :\r\n        p->journalMode==PAGER_JOURNALMODE_WAL      ? \"wal\" : \"?error?\"\r\n      , (int)p->tempFile, (int)p->memDb, (int)p->useJournal\r\n      , p->journalOff, p->journalHdr\r\n      , (int)p->dbSize, (int)p->dbOrigSize, (int)p->dbFileSize\r\n  );\r\n\r\n  return zRet;\r\n}\r\n#endif\r\n\r\n/*\r\n** Return true if it is necessary to write page *pPg into the sub-journal.\r\n** A page needs to be written into the sub-journal if there exists one\r\n** or more open savepoints for which:\r\n**\r\n**   * The page-number is less than or equal to PagerSavepoint.nOrig, and\r\n**   * The bit corresponding to the page-number is not set in\r\n**     PagerSavepoint.pInSavepoint.\r\n*/\r\nstatic int subjRequiresPage(PgHdr *pPg){\r\n  Pgno pgno = pPg->pgno;\r\n  Pager *pPager = pPg->pPager;\r\n  int i;\r\n  for(i=0; i<pPager->nSavepoint; i++){\r\n    PagerSavepoint *p = &pPager->aSavepoint[i];\r\n    if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return true if the page is already in the journal file.\r\n*/\r\nstatic int pageInJournal(PgHdr *pPg){\r\n  return sqlite3BitvecTest(pPg->pPager->pInJournal, pPg->pgno);\r\n}\r\n\r\n/*\r\n** Read a 32-bit integer from the given file descriptor.  Store the integer\r\n** that is read in *pRes.  Return SQLITE_OK if everything worked, or an\r\n** error code is something goes wrong.\r\n**\r\n** All values are stored on disk as big-endian.\r\n*/\r\nstatic int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){\r\n  unsigned char ac[4];\r\n  int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset);\r\n  if( rc==SQLITE_OK ){\r\n    *pRes = sqlite3Get4byte(ac);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Write a 32-bit integer into a string buffer in big-endian byte order.\r\n*/\r\n#define put32bits(A,B)  sqlite3Put4byte((u8*)A,B)\r\n\r\n\r\n/*\r\n** Write a 32-bit integer into the given file descriptor.  Return SQLITE_OK\r\n** on success or an error code is something goes wrong.\r\n*/\r\nstatic int write32bits(sqlite3_file *fd, i64 offset, u32 val){\r\n  char ac[4];\r\n  put32bits(ac, val);\r\n  return sqlite3OsWrite(fd, ac, 4, offset);\r\n}\r\n\r\n/*\r\n** Unlock the database file to level eLock, which must be either NO_LOCK\r\n** or SHARED_LOCK. Regardless of whether or not the call to xUnlock()\r\n** succeeds, set the Pager.eLock variable to match the (attempted) new lock.\r\n**\r\n** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is\r\n** called, do not modify it. See the comment above the #define of \r\n** UNKNOWN_LOCK for an explanation of this.\r\n*/\r\nstatic int pagerUnlockDb(Pager *pPager, int eLock){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( !pPager->exclusiveMode || pPager->eLock==eLock );\r\n  assert( eLock==NO_LOCK || eLock==SHARED_LOCK );\r\n  assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );\r\n  if( isOpen(pPager->fd) ){\r\n    assert( pPager->eLock>=eLock );\r\n    rc = sqlite3OsUnlock(pPager->fd, eLock);\r\n    if( pPager->eLock!=UNKNOWN_LOCK ){\r\n      pPager->eLock = (u8)eLock;\r\n    }\r\n    IOTRACE((\"UNLOCK %p %d\\n\", pPager, eLock))\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Lock the database file to level eLock, which must be either SHARED_LOCK,\r\n** RESERVED_LOCK or EXCLUSIVE_LOCK. If the caller is successful, set the\r\n** Pager.eLock variable to the new locking state. \r\n**\r\n** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is \r\n** called, do not modify it unless the new locking state is EXCLUSIVE_LOCK. \r\n** See the comment above the #define of UNKNOWN_LOCK for an explanation \r\n** of this.\r\n*/\r\nstatic int pagerLockDb(Pager *pPager, int eLock){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );\r\n  if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){\r\n    rc = sqlite3OsLock(pPager->fd, eLock);\r\n    if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){\r\n      pPager->eLock = (u8)eLock;\r\n      IOTRACE((\"LOCK %p %d\\n\", pPager, eLock))\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function determines whether or not the atomic-write optimization\r\n** can be used with this pager. The optimization can be used if:\r\n**\r\n**  (a) the value returned by OsDeviceCharacteristics() indicates that\r\n**      a database page may be written atomically, and\r\n**  (b) the value returned by OsSectorSize() is less than or equal\r\n**      to the page size.\r\n**\r\n** The optimization is also always enabled for temporary files. It is\r\n** an error to call this function if pPager is opened on an in-memory\r\n** database.\r\n**\r\n** If the optimization cannot be used, 0 is returned. If it can be used,\r\n** then the value returned is the size of the journal file when it\r\n** contains rollback data for exactly one page.\r\n*/\r\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\nstatic int jrnlBufferSize(Pager *pPager){\r\n  assert( !MEMDB );\r\n  if( !pPager->tempFile ){\r\n    int dc;                           /* Device characteristics */\r\n    int nSector;                      /* Sector size */\r\n    int szPage;                       /* Page size */\r\n\r\n    assert( isOpen(pPager->fd) );\r\n    dc = sqlite3OsDeviceCharacteristics(pPager->fd);\r\n    nSector = pPager->sectorSize;\r\n    szPage = pPager->pageSize;\r\n\r\n    assert(SQLITE_IOCAP_ATOMIC512==(512>>8));\r\n    assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));\r\n    if( 0==(dc&(SQLITE_IOCAP_ATOMIC|(szPage>>8)) || nSector>szPage) ){\r\n      return 0;\r\n    }\r\n  }\r\n\r\n  return JOURNAL_HDR_SZ(pPager) + JOURNAL_PG_SZ(pPager);\r\n}\r\n#endif\r\n\r\n/*\r\n** If SQLITE_CHECK_PAGES is defined then we do some sanity checking\r\n** on the cache using a hash function.  This is used for testing\r\n** and debugging only.\r\n*/\r\n#ifdef SQLITE_CHECK_PAGES\r\n/*\r\n** Return a 32-bit hash of the page data for pPage.\r\n*/\r\nstatic u32 pager_datahash(int nByte, unsigned char *pData){\r\n  u32 hash = 0;\r\n  int i;\r\n  for(i=0; i<nByte; i++){\r\n    hash = (hash*1039) + pData[i];\r\n  }\r\n  return hash;\r\n}\r\nstatic u32 pager_pagehash(PgHdr *pPage){\r\n  return pager_datahash(pPage->pPager->pageSize, (unsigned char *)pPage->pData);\r\n}\r\nstatic void pager_set_pagehash(PgHdr *pPage){\r\n  pPage->pageHash = pager_pagehash(pPage);\r\n}\r\n\r\n/*\r\n** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES\r\n** is defined, and NDEBUG is not defined, an assert() statement checks\r\n** that the page is either dirty or still matches the calculated page-hash.\r\n*/\r\n#define CHECK_PAGE(x) checkPage(x)\r\nstatic void checkPage(PgHdr *pPg){\r\n  Pager *pPager = pPg->pPager;\r\n  assert( pPager->eState!=PAGER_ERROR );\r\n  assert( (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) );\r\n}\r\n\r\n#else\r\n#define pager_datahash(X,Y)  0\r\n#define pager_pagehash(X)  0\r\n#define pager_set_pagehash(X)\r\n#define CHECK_PAGE(x)\r\n#endif  /* SQLITE_CHECK_PAGES */\r\n\r\n/*\r\n** When this is called the journal file for pager pPager must be open.\r\n** This function attempts to read a master journal file name from the \r\n** end of the file and, if successful, copies it into memory supplied \r\n** by the caller. See comments above writeMasterJournal() for the format\r\n** used to store a master journal file name at the end of a journal file.\r\n**\r\n** zMaster must point to a buffer of at least nMaster bytes allocated by\r\n** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is\r\n** enough space to write the master journal name). If the master journal\r\n** name in the journal is longer than nMaster bytes (including a\r\n** nul-terminator), then this is handled as if no master journal name\r\n** were present in the journal.\r\n**\r\n** If a master journal file name is present at the end of the journal\r\n** file, then it is copied into the buffer pointed to by zMaster. A\r\n** nul-terminator byte is appended to the buffer following the master\r\n** journal file name.\r\n**\r\n** If it is determined that no master journal file name is present \r\n** zMaster[0] is set to 0 and SQLITE_OK returned.\r\n**\r\n** If an error occurs while reading from the journal file, an SQLite\r\n** error code is returned.\r\n*/\r\nstatic int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){\r\n  int rc;                    /* Return code */\r\n  u32 len;                   /* Length in bytes of master journal name */\r\n  i64 szJ;                   /* Total size in bytes of journal file pJrnl */\r\n  u32 cksum;                 /* MJ checksum value read from journal */\r\n  u32 u;                     /* Unsigned loop counter */\r\n  unsigned char aMagic[8];   /* A buffer to hold the magic header */\r\n  zMaster[0] = '\\0';\r\n\r\n  if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))\r\n   || szJ<16\r\n   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))\r\n   || len>=nMaster \r\n   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))\r\n   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))\r\n   || memcmp(aMagic, aJournalMagic, 8)\r\n   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len))\r\n  ){\r\n    return rc;\r\n  }\r\n\r\n  /* See if the checksum matches the master journal name */\r\n  for(u=0; u<len; u++){\r\n    cksum -= zMaster[u];\r\n  }\r\n  if( cksum ){\r\n    /* If the checksum doesn't add up, then one or more of the disk sectors\r\n    ** containing the master journal filename is corrupted. This means\r\n    ** definitely roll back, so just return SQLITE_OK and report a (nul)\r\n    ** master-journal filename.\r\n    */\r\n    len = 0;\r\n  }\r\n  zMaster[len] = '\\0';\r\n   \r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Return the offset of the sector boundary at or immediately \r\n** following the value in pPager->journalOff, assuming a sector \r\n** size of pPager->sectorSize bytes.\r\n**\r\n** i.e for a sector size of 512:\r\n**\r\n**   Pager.journalOff          Return value\r\n**   ---------------------------------------\r\n**   0                         0\r\n**   512                       512\r\n**   100                       512\r\n**   2000                      2048\r\n** \r\n*/\r\nstatic i64 journalHdrOffset(Pager *pPager){\r\n  i64 offset = 0;\r\n  i64 c = pPager->journalOff;\r\n  if( c ){\r\n    offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);\r\n  }\r\n  assert( offset%JOURNAL_HDR_SZ(pPager)==0 );\r\n  assert( offset>=c );\r\n  assert( (offset-c)<JOURNAL_HDR_SZ(pPager) );\r\n  return offset;\r\n}\r\n\r\n/*\r\n** The journal file must be open when this function is called.\r\n**\r\n** This function is a no-op if the journal file has not been written to\r\n** within the current transaction (i.e. if Pager.journalOff==0).\r\n**\r\n** If doTruncate is non-zero or the Pager.journalSizeLimit variable is\r\n** set to 0, then truncate the journal file to zero bytes in size. Otherwise,\r\n** zero the 28-byte header at the start of the journal file. In either case, \r\n** if the pager is not in no-sync mode, sync the journal file immediately \r\n** after writing or truncating it.\r\n**\r\n** If Pager.journalSizeLimit is set to a positive, non-zero value, and\r\n** following the truncation or zeroing described above the size of the \r\n** journal file in bytes is larger than this value, then truncate the\r\n** journal file to Pager.journalSizeLimit bytes. The journal file does\r\n** not need to be synced following this operation.\r\n**\r\n** If an IO error occurs, abandon processing and return the IO error code.\r\n** Otherwise, return SQLITE_OK.\r\n*/\r\nstatic int zeroJournalHdr(Pager *pPager, int doTruncate){\r\n  int rc = SQLITE_OK;                               /* Return code */\r\n  assert( isOpen(pPager->jfd) );\r\n  if( pPager->journalOff ){\r\n    const i64 iLimit = pPager->journalSizeLimit;    /* Local cache of jsl */\r\n\r\n    IOTRACE((\"JZEROHDR %p\\n\", pPager))\r\n    if( doTruncate || iLimit==0 ){\r\n      rc = sqlite3OsTruncate(pPager->jfd, 0);\r\n    }else{\r\n      static const char zeroHdr[28] = {0};\r\n      rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0);\r\n    }\r\n    if( rc==SQLITE_OK && !pPager->noSync ){\r\n      rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags);\r\n    }\r\n\r\n    /* At this point the transaction is committed but the write lock \r\n    ** is still held on the file. If there is a size limit configured for \r\n    ** the persistent journal and the journal file currently consumes more\r\n    ** space than that limit allows for, truncate it now. There is no need\r\n    ** to sync the file following this operation.\r\n    */\r\n    if( rc==SQLITE_OK && iLimit>0 ){\r\n      i64 sz;\r\n      rc = sqlite3OsFileSize(pPager->jfd, &sz);\r\n      if( rc==SQLITE_OK && sz>iLimit ){\r\n        rc = sqlite3OsTruncate(pPager->jfd, iLimit);\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The journal file must be open when this routine is called. A journal\r\n** header (JOURNAL_HDR_SZ bytes) is written into the journal file at the\r\n** current location.\r\n**\r\n** The format for the journal header is as follows:\r\n** - 8 bytes: Magic identifying journal format.\r\n** - 4 bytes: Number of records in journal, or -1 no-sync mode is on.\r\n** - 4 bytes: Random number used for page hash.\r\n** - 4 bytes: Initial database page count.\r\n** - 4 bytes: Sector size used by the process that wrote this journal.\r\n** - 4 bytes: Database page size.\r\n** \r\n** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space.\r\n*/\r\nstatic int writeJournalHdr(Pager *pPager){\r\n  int rc = SQLITE_OK;                 /* Return code */\r\n  char *zHeader = pPager->pTmpSpace;  /* Temporary space used to build header */\r\n  u32 nHeader = (u32)pPager->pageSize;/* Size of buffer pointed to by zHeader */\r\n  u32 nWrite;                         /* Bytes of header sector written */\r\n  int ii;                             /* Loop counter */\r\n\r\n  assert( isOpen(pPager->jfd) );      /* Journal file must be open. */\r\n\r\n  if( nHeader>JOURNAL_HDR_SZ(pPager) ){\r\n    nHeader = JOURNAL_HDR_SZ(pPager);\r\n  }\r\n\r\n  /* If there are active savepoints and any of them were created \r\n  ** since the most recent journal header was written, update the \r\n  ** PagerSavepoint.iHdrOffset fields now.\r\n  */\r\n  for(ii=0; ii<pPager->nSavepoint; ii++){\r\n    if( pPager->aSavepoint[ii].iHdrOffset==0 ){\r\n      pPager->aSavepoint[ii].iHdrOffset = pPager->journalOff;\r\n    }\r\n  }\r\n\r\n  pPager->journalHdr = pPager->journalOff = journalHdrOffset(pPager);\r\n\r\n  /* \r\n  ** Write the nRec Field - the number of page records that follow this\r\n  ** journal header. Normally, zero is written to this value at this time.\r\n  ** After the records are added to the journal (and the journal synced, \r\n  ** if in full-sync mode), the zero is overwritten with the true number\r\n  ** of records (see syncJournal()).\r\n  **\r\n  ** A faster alternative is to write 0xFFFFFFFF to the nRec field. When\r\n  ** reading the journal this value tells SQLite to assume that the\r\n  ** rest of the journal file contains valid page records. This assumption\r\n  ** is dangerous, as if a failure occurred whilst writing to the journal\r\n  ** file it may contain some garbage data. There are two scenarios\r\n  ** where this risk can be ignored:\r\n  **\r\n  **   * When the pager is in no-sync mode. Corruption can follow a\r\n  **     power failure in this case anyway.\r\n  **\r\n  **   * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees\r\n  **     that garbage data is never appended to the journal file.\r\n  */\r\n  assert( isOpen(pPager->fd) || pPager->noSync );\r\n  if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY)\r\n   || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) \r\n  ){\r\n    memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));\r\n    put32bits(&zHeader[sizeof(aJournalMagic)], 0xffffffff);\r\n  }else{\r\n    memset(zHeader, 0, sizeof(aJournalMagic)+4);\r\n  }\r\n\r\n  /* The random check-hash initialiser */ \r\n  sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);\r\n  put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);\r\n  /* The initial database size */\r\n  put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize);\r\n  /* The assumed sector size for this process */\r\n  put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);\r\n\r\n  /* The page size */\r\n  put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);\r\n\r\n  /* Initializing the tail of the buffer is not necessary.  Everything\r\n  ** works find if the following memset() is omitted.  But initializing\r\n  ** the memory prevents valgrind from complaining, so we are willing to\r\n  ** take the performance hit.\r\n  */\r\n  memset(&zHeader[sizeof(aJournalMagic)+20], 0,\r\n         nHeader-(sizeof(aJournalMagic)+20));\r\n\r\n  /* In theory, it is only necessary to write the 28 bytes that the \r\n  ** journal header consumes to the journal file here. Then increment the \r\n  ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next \r\n  ** record is written to the following sector (leaving a gap in the file\r\n  ** that will be implicitly filled in by the OS).\r\n  **\r\n  ** However it has been discovered that on some systems this pattern can \r\n  ** be significantly slower than contiguously writing data to the file,\r\n  ** even if that means explicitly writing data to the block of \r\n  ** (JOURNAL_HDR_SZ - 28) bytes that will not be used. So that is what\r\n  ** is done. \r\n  **\r\n  ** The loop is required here in case the sector-size is larger than the \r\n  ** database page size. Since the zHeader buffer is only Pager.pageSize\r\n  ** bytes in size, more than one call to sqlite3OsWrite() may be required\r\n  ** to populate the entire journal header sector.\r\n  */ \r\n  for(nWrite=0; rc==SQLITE_OK&&nWrite<JOURNAL_HDR_SZ(pPager); nWrite+=nHeader){\r\n    IOTRACE((\"JHDR %p %lld %d\\n\", pPager, pPager->journalHdr, nHeader))\r\n    rc = sqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff);\r\n    assert( pPager->journalHdr <= pPager->journalOff );\r\n    pPager->journalOff += nHeader;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The journal file must be open when this is called. A journal header file\r\n** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal\r\n** file. The current location in the journal file is given by\r\n** pPager->journalOff. See comments above function writeJournalHdr() for\r\n** a description of the journal header format.\r\n**\r\n** If the header is read successfully, *pNRec is set to the number of\r\n** page records following this header and *pDbSize is set to the size of the\r\n** database before the transaction began, in pages. Also, pPager->cksumInit\r\n** is set to the value read from the journal header. SQLITE_OK is returned\r\n** in this case.\r\n**\r\n** If the journal header file appears to be corrupted, SQLITE_DONE is\r\n** returned and *pNRec and *PDbSize are undefined.  If JOURNAL_HDR_SZ bytes\r\n** cannot be read from the journal file an error code is returned.\r\n*/\r\nstatic int readJournalHdr(\r\n  Pager *pPager,               /* Pager object */\r\n  int isHot,\r\n  i64 journalSize,             /* Size of the open journal file in bytes */\r\n  u32 *pNRec,                  /* OUT: Value read from the nRec field */\r\n  u32 *pDbSize                 /* OUT: Value of original database size field */\r\n){\r\n  int rc;                      /* Return code */\r\n  unsigned char aMagic[8];     /* A buffer to hold the magic header */\r\n  i64 iHdrOff;                 /* Offset of journal header being read */\r\n\r\n  assert( isOpen(pPager->jfd) );      /* Journal file must be open. */\r\n\r\n  /* Advance Pager.journalOff to the start of the next sector. If the\r\n  ** journal file is too small for there to be a header stored at this\r\n  ** point, return SQLITE_DONE.\r\n  */\r\n  pPager->journalOff = journalHdrOffset(pPager);\r\n  if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){\r\n    return SQLITE_DONE;\r\n  }\r\n  iHdrOff = pPager->journalOff;\r\n\r\n  /* Read in the first 8 bytes of the journal header. If they do not match\r\n  ** the  magic string found at the start of each journal header, return\r\n  ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise,\r\n  ** proceed.\r\n  */\r\n  if( isHot || iHdrOff!=pPager->journalHdr ){\r\n    rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff);\r\n    if( rc ){\r\n      return rc;\r\n    }\r\n    if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){\r\n      return SQLITE_DONE;\r\n    }\r\n  }\r\n\r\n  /* Read the first three 32-bit fields of the journal header: The nRec\r\n  ** field, the checksum-initializer and the database size at the start\r\n  ** of the transaction. Return an error code if anything goes wrong.\r\n  */\r\n  if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+8, pNRec))\r\n   || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+12, &pPager->cksumInit))\r\n   || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+16, pDbSize))\r\n  ){\r\n    return rc;\r\n  }\r\n\r\n  if( pPager->journalOff==0 ){\r\n    u32 iPageSize;               /* Page-size field of journal header */\r\n    u32 iSectorSize;             /* Sector-size field of journal header */\r\n\r\n    /* Read the page-size and sector-size journal header fields. */\r\n    if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))\r\n     || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))\r\n    ){\r\n      return rc;\r\n    }\r\n\r\n    /* Versions of SQLite prior to 3.5.8 set the page-size field of the\r\n    ** journal header to zero. In this case, assume that the Pager.pageSize\r\n    ** variable is already set to the correct page size.\r\n    */\r\n    if( iPageSize==0 ){\r\n      iPageSize = pPager->pageSize;\r\n    }\r\n\r\n    /* Check that the values read from the page-size and sector-size fields\r\n    ** are within range. To be 'in range', both values need to be a power\r\n    ** of two greater than or equal to 512 or 32, and not greater than their \r\n    ** respective compile time maximum limits.\r\n    */\r\n    if( iPageSize<512                  || iSectorSize<32\r\n     || iPageSize>SQLITE_MAX_PAGE_SIZE || iSectorSize>MAX_SECTOR_SIZE\r\n     || ((iPageSize-1)&iPageSize)!=0   || ((iSectorSize-1)&iSectorSize)!=0 \r\n    ){\r\n      /* If the either the page-size or sector-size in the journal-header is \r\n      ** invalid, then the process that wrote the journal-header must have \r\n      ** crashed before the header was synced. In this case stop reading \r\n      ** the journal file here.\r\n      */\r\n      return SQLITE_DONE;\r\n    }\r\n\r\n    /* Update the page-size to match the value read from the journal. \r\n    ** Use a testcase() macro to make sure that malloc failure within \r\n    ** PagerSetPagesize() is tested.\r\n    */\r\n    rc = sqlite3PagerSetPagesize(pPager, &iPageSize, -1);\r\n    testcase( rc!=SQLITE_OK );\r\n\r\n    /* Update the assumed sector-size to match the value used by \r\n    ** the process that created this journal. If this journal was\r\n    ** created by a process other than this one, then this routine\r\n    ** is being called from within pager_playback(). The local value\r\n    ** of Pager.sectorSize is restored at the end of that routine.\r\n    */\r\n    pPager->sectorSize = iSectorSize;\r\n  }\r\n\r\n  pPager->journalOff += JOURNAL_HDR_SZ(pPager);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Write the supplied master journal name into the journal file for pager\r\n** pPager at the current location. The master journal name must be the last\r\n** thing written to a journal file. If the pager is in full-sync mode, the\r\n** journal file descriptor is advanced to the next sector boundary before\r\n** anything is written. The format is:\r\n**\r\n**   + 4 bytes: PAGER_MJ_PGNO.\r\n**   + N bytes: Master journal filename in utf-8.\r\n**   + 4 bytes: N (length of master journal name in bytes, no nul-terminator).\r\n**   + 4 bytes: Master journal name checksum.\r\n**   + 8 bytes: aJournalMagic[].\r\n**\r\n** The master journal page checksum is the sum of the bytes in the master\r\n** journal name, where each byte is interpreted as a signed 8-bit integer.\r\n**\r\n** If zMaster is a NULL pointer (occurs for a single database transaction), \r\n** this call is a no-op.\r\n*/\r\nstatic int writeMasterJournal(Pager *pPager, const char *zMaster){\r\n  int rc;                          /* Return code */\r\n  int nMaster;                     /* Length of string zMaster */\r\n  i64 iHdrOff;                     /* Offset of header in journal file */\r\n  i64 jrnlSize;                    /* Size of journal file on disk */\r\n  u32 cksum = 0;                   /* Checksum of string zMaster */\r\n\r\n  assert( pPager->setMaster==0 );\r\n  assert( !pagerUseWal(pPager) );\r\n\r\n  if( !zMaster \r\n   || pPager->journalMode==PAGER_JOURNALMODE_MEMORY \r\n   || pPager->journalMode==PAGER_JOURNALMODE_OFF \r\n  ){\r\n    return SQLITE_OK;\r\n  }\r\n  pPager->setMaster = 1;\r\n  assert( isOpen(pPager->jfd) );\r\n  assert( pPager->journalHdr <= pPager->journalOff );\r\n\r\n  /* Calculate the length in bytes and the checksum of zMaster */\r\n  for(nMaster=0; zMaster[nMaster]; nMaster++){\r\n    cksum += zMaster[nMaster];\r\n  }\r\n\r\n  /* If in full-sync mode, advance to the next disk sector before writing\r\n  ** the master journal name. This is in case the previous page written to\r\n  ** the journal has already been synced.\r\n  */\r\n  if( pPager->fullSync ){\r\n    pPager->journalOff = journalHdrOffset(pPager);\r\n  }\r\n  iHdrOff = pPager->journalOff;\r\n\r\n  /* Write the master journal data to the end of the journal file. If\r\n  ** an error occurs, return the error code to the caller.\r\n  */\r\n  if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_MJ_PGNO(pPager))))\r\n   || (0 != (rc = sqlite3OsWrite(pPager->jfd, zMaster, nMaster, iHdrOff+4)))\r\n   || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster, nMaster)))\r\n   || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster+4, cksum)))\r\n   || (0 != (rc = sqlite3OsWrite(pPager->jfd, aJournalMagic, 8, iHdrOff+4+nMaster+8)))\r\n  ){\r\n    return rc;\r\n  }\r\n  pPager->journalOff += (nMaster+20);\r\n\r\n  /* If the pager is in peristent-journal mode, then the physical \r\n  ** journal-file may extend past the end of the master-journal name\r\n  ** and 8 bytes of magic data just written to the file. This is \r\n  ** dangerous because the code to rollback a hot-journal file\r\n  ** will not be able to find the master-journal name to determine \r\n  ** whether or not the journal is hot. \r\n  **\r\n  ** Easiest thing to do in this scenario is to truncate the journal \r\n  ** file to the required size.\r\n  */ \r\n  if( SQLITE_OK==(rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize))\r\n   && jrnlSize>pPager->journalOff\r\n  ){\r\n    rc = sqlite3OsTruncate(pPager->jfd, pPager->journalOff);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Find a page in the hash table given its page number. Return\r\n** a pointer to the page or NULL if the requested page is not \r\n** already in memory.\r\n*/\r\nstatic PgHdr *pager_lookup(Pager *pPager, Pgno pgno){\r\n  PgHdr *p;                         /* Return value */\r\n\r\n  /* It is not possible for a call to PcacheFetch() with createFlag==0 to\r\n  ** fail, since no attempt to allocate dynamic memory will be made.\r\n  */\r\n  (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &p);\r\n  return p;\r\n}\r\n\r\n/*\r\n** Discard the entire contents of the in-memory page-cache.\r\n*/\r\nstatic void pager_reset(Pager *pPager){\r\n  sqlite3BackupRestart(pPager->pBackup);\r\n  sqlite3PcacheClear(pPager->pPCache);\r\n}\r\n\r\n/*\r\n** Free all structures in the Pager.aSavepoint[] array and set both\r\n** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal\r\n** if it is open and the pager is not in exclusive mode.\r\n*/\r\nstatic void releaseAllSavepoints(Pager *pPager){\r\n  int ii;               /* Iterator for looping through Pager.aSavepoint */\r\n  for(ii=0; ii<pPager->nSavepoint; ii++){\r\n    sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);\r\n  }\r\n  if( !pPager->exclusiveMode || sqlite3IsMemJournal(pPager->sjfd) ){\r\n    sqlite3OsClose(pPager->sjfd);\r\n  }\r\n  sqlite3_free(pPager->aSavepoint);\r\n  pPager->aSavepoint = 0;\r\n  pPager->nSavepoint = 0;\r\n  pPager->nSubRec = 0;\r\n}\r\n\r\n/*\r\n** Set the bit number pgno in the PagerSavepoint.pInSavepoint \r\n** bitvecs of all open savepoints. Return SQLITE_OK if successful\r\n** or SQLITE_NOMEM if a malloc failure occurs.\r\n*/\r\nstatic int addToSavepointBitvecs(Pager *pPager, Pgno pgno){\r\n  int ii;                   /* Loop counter */\r\n  int rc = SQLITE_OK;       /* Result code */\r\n\r\n  for(ii=0; ii<pPager->nSavepoint; ii++){\r\n    PagerSavepoint *p = &pPager->aSavepoint[ii];\r\n    if( pgno<=p->nOrig ){\r\n      rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);\r\n      testcase( rc==SQLITE_NOMEM );\r\n      assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is a no-op if the pager is in exclusive mode and not\r\n** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN\r\n** state.\r\n**\r\n** If the pager is not in exclusive-access mode, the database file is\r\n** completely unlocked. If the file is unlocked and the file-system does\r\n** not exhibit the UNDELETABLE_WHEN_OPEN property, the journal file is\r\n** closed (if it is open).\r\n**\r\n** If the pager is in ERROR state when this function is called, the \r\n** contents of the pager cache are discarded before switching back to \r\n** the OPEN state. Regardless of whether the pager is in exclusive-mode\r\n** or not, any journal file left in the file-system will be treated\r\n** as a hot-journal and rolled back the next time a read-transaction\r\n** is opened (by this or by any other connection).\r\n*/\r\nstatic void pager_unlock(Pager *pPager){\r\n\r\n  assert( pPager->eState==PAGER_READER \r\n       || pPager->eState==PAGER_OPEN \r\n       || pPager->eState==PAGER_ERROR \r\n  );\r\n\r\n  sqlite3BitvecDestroy(pPager->pInJournal);\r\n  pPager->pInJournal = 0;\r\n  releaseAllSavepoints(pPager);\r\n\r\n  if( pagerUseWal(pPager) ){\r\n    assert( !isOpen(pPager->jfd) );\r\n    sqlite3WalEndReadTransaction(pPager->pWal);\r\n    pPager->eState = PAGER_OPEN;\r\n  }else if( !pPager->exclusiveMode ){\r\n    int rc;                       /* Error code returned by pagerUnlockDb() */\r\n    int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0;\r\n\r\n    /* If the operating system support deletion of open files, then\r\n    ** close the journal file when dropping the database lock.  Otherwise\r\n    ** another connection with journal_mode=delete might delete the file\r\n    ** out from under us.\r\n    */\r\n    assert( (PAGER_JOURNALMODE_MEMORY   & 5)!=1 );\r\n    assert( (PAGER_JOURNALMODE_OFF      & 5)!=1 );\r\n    assert( (PAGER_JOURNALMODE_WAL      & 5)!=1 );\r\n    assert( (PAGER_JOURNALMODE_DELETE   & 5)!=1 );\r\n    assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );\r\n    assert( (PAGER_JOURNALMODE_PERSIST  & 5)==1 );\r\n    if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN)\r\n     || 1!=(pPager->journalMode & 5)\r\n    ){\r\n      sqlite3OsClose(pPager->jfd);\r\n    }\r\n\r\n    /* If the pager is in the ERROR state and the call to unlock the database\r\n    ** file fails, set the current lock to UNKNOWN_LOCK. See the comment\r\n    ** above the #define for UNKNOWN_LOCK for an explanation of why this\r\n    ** is necessary.\r\n    */\r\n    rc = pagerUnlockDb(pPager, NO_LOCK);\r\n    if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){\r\n      pPager->eLock = UNKNOWN_LOCK;\r\n    }\r\n\r\n    /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here\r\n    ** without clearing the error code. This is intentional - the error\r\n    ** code is cleared and the cache reset in the block below.\r\n    */\r\n    assert( pPager->errCode || pPager->eState!=PAGER_ERROR );\r\n    pPager->changeCountDone = 0;\r\n    pPager->eState = PAGER_OPEN;\r\n  }\r\n\r\n  /* If Pager.errCode is set, the contents of the pager cache cannot be\r\n  ** trusted. Now that there are no outstanding references to the pager,\r\n  ** it can safely move back to PAGER_OPEN state. This happens in both\r\n  ** normal and exclusive-locking mode.\r\n  */\r\n  if( pPager->errCode ){\r\n    assert( !MEMDB );\r\n    pager_reset(pPager);\r\n    pPager->changeCountDone = pPager->tempFile;\r\n    pPager->eState = PAGER_OPEN;\r\n    pPager->errCode = SQLITE_OK;\r\n  }\r\n\r\n  pPager->journalOff = 0;\r\n  pPager->journalHdr = 0;\r\n  pPager->setMaster = 0;\r\n}\r\n\r\n/*\r\n** This function is called whenever an IOERR or FULL error that requires\r\n** the pager to transition into the ERROR state may ahve occurred.\r\n** The first argument is a pointer to the pager structure, the second \r\n** the error-code about to be returned by a pager API function. The \r\n** value returned is a copy of the second argument to this function. \r\n**\r\n** If the second argument is SQLITE_FULL, SQLITE_IOERR or one of the\r\n** IOERR sub-codes, the pager enters the ERROR state and the error code\r\n** is stored in Pager.errCode. While the pager remains in the ERROR state,\r\n** all major API calls on the Pager will immediately return Pager.errCode.\r\n**\r\n** The ERROR state indicates that the contents of the pager-cache \r\n** cannot be trusted. This state can be cleared by completely discarding \r\n** the contents of the pager-cache. If a transaction was active when\r\n** the persistent error occurred, then the rollback journal may need\r\n** to be replayed to restore the contents of the database file (as if\r\n** it were a hot-journal).\r\n*/\r\nstatic int pager_error(Pager *pPager, int rc){\r\n  int rc2 = rc & 0xff;\r\n  assert( rc==SQLITE_OK || !MEMDB );\r\n  assert(\r\n       pPager->errCode==SQLITE_FULL ||\r\n       pPager->errCode==SQLITE_OK ||\r\n       (pPager->errCode & 0xff)==SQLITE_IOERR\r\n  );\r\n  if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){\r\n    pPager->errCode = rc;\r\n    pPager->eState = PAGER_ERROR;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This routine ends a transaction. A transaction is usually ended by \r\n** either a COMMIT or a ROLLBACK operation. This routine may be called \r\n** after rollback of a hot-journal, or if an error occurs while opening\r\n** the journal file or writing the very first journal-header of a\r\n** database transaction.\r\n** \r\n** This routine is never called in PAGER_ERROR state. If it is called\r\n** in PAGER_NONE or PAGER_SHARED state and the lock held is less\r\n** exclusive than a RESERVED lock, it is a no-op.\r\n**\r\n** Otherwise, any active savepoints are released.\r\n**\r\n** If the journal file is open, then it is \"finalized\". Once a journal \r\n** file has been finalized it is not possible to use it to roll back a \r\n** transaction. Nor will it be considered to be a hot-journal by this\r\n** or any other database connection. Exactly how a journal is finalized\r\n** depends on whether or not the pager is running in exclusive mode and\r\n** the current journal-mode (Pager.journalMode value), as follows:\r\n**\r\n**   journalMode==MEMORY\r\n**     Journal file descriptor is simply closed. This destroys an \r\n**     in-memory journal.\r\n**\r\n**   journalMode==TRUNCATE\r\n**     Journal file is truncated to zero bytes in size.\r\n**\r\n**   journalMode==PERSIST\r\n**     The first 28 bytes of the journal file are zeroed. This invalidates\r\n**     the first journal header in the file, and hence the entire journal\r\n**     file. An invalid journal file cannot be rolled back.\r\n**\r\n**   journalMode==DELETE\r\n**     The journal file is closed and deleted using sqlite3OsDelete().\r\n**\r\n**     If the pager is running in exclusive mode, this method of finalizing\r\n**     the journal file is never used. Instead, if the journalMode is\r\n**     DELETE and the pager is in exclusive mode, the method described under\r\n**     journalMode==PERSIST is used instead.\r\n**\r\n** After the journal is finalized, the pager moves to PAGER_READER state.\r\n** If running in non-exclusive rollback mode, the lock on the file is \r\n** downgraded to a SHARED_LOCK.\r\n**\r\n** SQLITE_OK is returned if no error occurs. If an error occurs during\r\n** any of the IO operations to finalize the journal file or unlock the\r\n** database then the IO error code is returned to the user. If the \r\n** operation to finalize the journal file fails, then the code still\r\n** tries to unlock the database file if not in exclusive mode. If the\r\n** unlock operation fails as well, then the first error code related\r\n** to the first error encountered (the journal finalization one) is\r\n** returned.\r\n*/\r\nstatic int pager_end_transaction(Pager *pPager, int hasMaster){\r\n  int rc = SQLITE_OK;      /* Error code from journal finalization operation */\r\n  int rc2 = SQLITE_OK;     /* Error code from db file unlock operation */\r\n\r\n  /* Do nothing if the pager does not have an open write transaction\r\n  ** or at least a RESERVED lock. This function may be called when there\r\n  ** is no write-transaction active but a RESERVED or greater lock is\r\n  ** held under two circumstances:\r\n  **\r\n  **   1. After a successful hot-journal rollback, it is called with\r\n  **      eState==PAGER_NONE and eLock==EXCLUSIVE_LOCK.\r\n  **\r\n  **   2. If a connection with locking_mode=exclusive holding an EXCLUSIVE \r\n  **      lock switches back to locking_mode=normal and then executes a\r\n  **      read-transaction, this function is called with eState==PAGER_READER \r\n  **      and eLock==EXCLUSIVE_LOCK when the read-transaction is closed.\r\n  */\r\n  assert( assert_pager_state(pPager) );\r\n  assert( pPager->eState!=PAGER_ERROR );\r\n  if( pPager->eState<PAGER_WRITER_LOCKED && pPager->eLock<RESERVED_LOCK ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  releaseAllSavepoints(pPager);\r\n  assert( isOpen(pPager->jfd) || pPager->pInJournal==0 );\r\n  if( isOpen(pPager->jfd) ){\r\n    assert( !pagerUseWal(pPager) );\r\n\r\n    /* Finalize the journal file. */\r\n    if( sqlite3IsMemJournal(pPager->jfd) ){\r\n      assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY );\r\n      sqlite3OsClose(pPager->jfd);\r\n    }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){\r\n      if( pPager->journalOff==0 ){\r\n        rc = SQLITE_OK;\r\n      }else{\r\n        rc = sqlite3OsTruncate(pPager->jfd, 0);\r\n      }\r\n      pPager->journalOff = 0;\r\n    }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST\r\n      || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL)\r\n    ){\r\n      rc = zeroJournalHdr(pPager, hasMaster);\r\n      pPager->journalOff = 0;\r\n    }else{\r\n      /* This branch may be executed with Pager.journalMode==MEMORY if\r\n      ** a hot-journal was just rolled back. In this case the journal\r\n      ** file should be closed and deleted. If this connection writes to\r\n      ** the database file, it will do so using an in-memory journal. \r\n      */\r\n      assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE \r\n           || pPager->journalMode==PAGER_JOURNALMODE_MEMORY \r\n           || pPager->journalMode==PAGER_JOURNALMODE_WAL \r\n      );\r\n      sqlite3OsClose(pPager->jfd);\r\n      if( !pPager->tempFile ){\r\n        rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);\r\n      }\r\n    }\r\n  }\r\n\r\n#ifdef SQLITE_CHECK_PAGES\r\n  sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash);\r\n  if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){\r\n    PgHdr *p = pager_lookup(pPager, 1);\r\n    if( p ){\r\n      p->pageHash = 0;\r\n      sqlite3PagerUnref(p);\r\n    }\r\n  }\r\n#endif\r\n\r\n  sqlite3BitvecDestroy(pPager->pInJournal);\r\n  pPager->pInJournal = 0;\r\n  pPager->nRec = 0;\r\n  sqlite3PcacheCleanAll(pPager->pPCache);\r\n  sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize);\r\n\r\n  if( pagerUseWal(pPager) ){\r\n    /* Drop the WAL write-lock, if any. Also, if the connection was in \r\n    ** locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE \r\n    ** lock held on the database file.\r\n    */\r\n    rc2 = sqlite3WalEndWriteTransaction(pPager->pWal);\r\n    assert( rc2==SQLITE_OK );\r\n  }\r\n  if( !pPager->exclusiveMode \r\n   && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0))\r\n  ){\r\n    rc2 = pagerUnlockDb(pPager, SHARED_LOCK);\r\n    pPager->changeCountDone = 0;\r\n  }\r\n  pPager->eState = PAGER_READER;\r\n  pPager->setMaster = 0;\r\n\r\n  return (rc==SQLITE_OK?rc2:rc);\r\n}\r\n\r\n/*\r\n** Execute a rollback if a transaction is active and unlock the \r\n** database file. \r\n**\r\n** If the pager has already entered the ERROR state, do not attempt \r\n** the rollback at this time. Instead, pager_unlock() is called. The\r\n** call to pager_unlock() will discard all in-memory pages, unlock\r\n** the database file and move the pager back to OPEN state. If this \r\n** means that there is a hot-journal left in the file-system, the next \r\n** connection to obtain a shared lock on the pager (which may be this one) \r\n** will roll it back.\r\n**\r\n** If the pager has not already entered the ERROR state, but an IO or\r\n** malloc error occurs during a rollback, then this will itself cause \r\n** the pager to enter the ERROR state. Which will be cleared by the\r\n** call to pager_unlock(), as described above.\r\n*/\r\nstatic void pagerUnlockAndRollback(Pager *pPager){\r\n  if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){\r\n    assert( assert_pager_state(pPager) );\r\n    if( pPager->eState>=PAGER_WRITER_LOCKED ){\r\n      sqlite3BeginBenignMalloc();\r\n      sqlite3PagerRollback(pPager);\r\n      sqlite3EndBenignMalloc();\r\n    }else if( !pPager->exclusiveMode ){\r\n      assert( pPager->eState==PAGER_READER );\r\n      pager_end_transaction(pPager, 0);\r\n    }\r\n  }\r\n  pager_unlock(pPager);\r\n}\r\n\r\n/*\r\n** Parameter aData must point to a buffer of pPager->pageSize bytes\r\n** of data. Compute and return a checksum based ont the contents of the \r\n** page of data and the current value of pPager->cksumInit.\r\n**\r\n** This is not a real checksum. It is really just the sum of the \r\n** random initial value (pPager->cksumInit) and every 200th byte\r\n** of the page data, starting with byte offset (pPager->pageSize%200).\r\n** Each byte is interpreted as an 8-bit unsigned integer.\r\n**\r\n** Changing the formula used to compute this checksum results in an\r\n** incompatible journal file format.\r\n**\r\n** If journal corruption occurs due to a power failure, the most likely \r\n** scenario is that one end or the other of the record will be changed. \r\n** It is much less likely that the two ends of the journal record will be\r\n** correct and the middle be corrupt.  Thus, this \"checksum\" scheme,\r\n** though fast and simple, catches the mostly likely kind of corruption.\r\n*/\r\nstatic u32 pager_cksum(Pager *pPager, const u8 *aData){\r\n  u32 cksum = pPager->cksumInit;         /* Checksum value to return */\r\n  int i = pPager->pageSize-200;          /* Loop counter */\r\n  while( i>0 ){\r\n    cksum += aData[i];\r\n    i -= 200;\r\n  }\r\n  return cksum;\r\n}\r\n\r\n/*\r\n** Report the current page size and number of reserved bytes back\r\n** to the codec.\r\n*/\r\n#ifdef SQLITE_HAS_CODEC\r\nstatic void pagerReportSize(Pager *pPager){\r\n  if( pPager->xCodecSizeChng ){\r\n    pPager->xCodecSizeChng(pPager->pCodec, pPager->pageSize,\r\n                           (int)pPager->nReserve);\r\n  }\r\n}\r\n#else\r\n# define pagerReportSize(X)     /* No-op if we do not support a codec */\r\n#endif\r\n\r\n/*\r\n** Read a single page from either the journal file (if isMainJrnl==1) or\r\n** from the sub-journal (if isMainJrnl==0) and playback that page.\r\n** The page begins at offset *pOffset into the file. The *pOffset\r\n** value is increased to the start of the next page in the journal.\r\n**\r\n** The main rollback journal uses checksums - the statement journal does \r\n** not.\r\n**\r\n** If the page number of the page record read from the (sub-)journal file\r\n** is greater than the current value of Pager.dbSize, then playback is\r\n** skipped and SQLITE_OK is returned.\r\n**\r\n** If pDone is not NULL, then it is a record of pages that have already\r\n** been played back.  If the page at *pOffset has already been played back\r\n** (if the corresponding pDone bit is set) then skip the playback.\r\n** Make sure the pDone bit corresponding to the *pOffset page is set\r\n** prior to returning.\r\n**\r\n** If the page record is successfully read from the (sub-)journal file\r\n** and played back, then SQLITE_OK is returned. If an IO error occurs\r\n** while reading the record from the (sub-)journal file or while writing\r\n** to the database file, then the IO error code is returned. If data\r\n** is successfully read from the (sub-)journal file but appears to be\r\n** corrupted, SQLITE_DONE is returned. Data is considered corrupted in\r\n** two circumstances:\r\n** \r\n**   * If the record page-number is illegal (0 or PAGER_MJ_PGNO), or\r\n**   * If the record is being rolled back from the main journal file\r\n**     and the checksum field does not match the record content.\r\n**\r\n** Neither of these two scenarios are possible during a savepoint rollback.\r\n**\r\n** If this is a savepoint rollback, then memory may have to be dynamically\r\n** allocated by this function. If this is the case and an allocation fails,\r\n** SQLITE_NOMEM is returned.\r\n*/\r\nstatic int pager_playback_one_page(\r\n  Pager *pPager,                /* The pager being played back */\r\n  i64 *pOffset,                 /* Offset of record to playback */\r\n  Bitvec *pDone,                /* Bitvec of pages already played back */\r\n  int isMainJrnl,               /* 1 -> main journal. 0 -> sub-journal. */\r\n  int isSavepnt                 /* True for a savepoint rollback */\r\n){\r\n  int rc;\r\n  PgHdr *pPg;                   /* An existing page in the cache */\r\n  Pgno pgno;                    /* The page number of a page in journal */\r\n  u32 cksum;                    /* Checksum used for sanity checking */\r\n  char *aData;                  /* Temporary storage for the page */\r\n  sqlite3_file *jfd;            /* The file descriptor for the journal file */\r\n  int isSynced;                 /* True if journal page is synced */\r\n\r\n  assert( (isMainJrnl&~1)==0 );      /* isMainJrnl is 0 or 1 */\r\n  assert( (isSavepnt&~1)==0 );       /* isSavepnt is 0 or 1 */\r\n  assert( isMainJrnl || pDone );     /* pDone always used on sub-journals */\r\n  assert( isSavepnt || pDone==0 );   /* pDone never used on non-savepoint */\r\n\r\n  aData = pPager->pTmpSpace;\r\n  assert( aData );         /* Temp storage must have already been allocated */\r\n  assert( pagerUseWal(pPager)==0 || (!isMainJrnl && isSavepnt) );\r\n\r\n  /* Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction \r\n  ** or savepoint rollback done at the request of the caller) or this is\r\n  ** a hot-journal rollback. If it is a hot-journal rollback, the pager\r\n  ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback\r\n  ** only reads from the main journal, not the sub-journal.\r\n  */\r\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD\r\n       || (pPager->eState==PAGER_OPEN && pPager->eLock==EXCLUSIVE_LOCK)\r\n  );\r\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD || isMainJrnl );\r\n\r\n  /* Read the page number and page data from the journal or sub-journal\r\n  ** file. Return an error code to the caller if an IO error occurs.\r\n  */\r\n  jfd = isMainJrnl ? pPager->jfd : pPager->sjfd;\r\n  rc = read32bits(jfd, *pOffset, &pgno);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n  rc = sqlite3OsRead(jfd, (u8*)aData, pPager->pageSize, (*pOffset)+4);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n  *pOffset += pPager->pageSize + 4 + isMainJrnl*4;\r\n\r\n  /* Sanity checking on the page.  This is more important that I originally\r\n  ** thought.  If a power failure occurs while the journal is being written,\r\n  ** it could cause invalid data to be written into the journal.  We need to\r\n  ** detect this invalid data (with high probability) and ignore it.\r\n  */\r\n  if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){\r\n    assert( !isSavepnt );\r\n    return SQLITE_DONE;\r\n  }\r\n  if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){\r\n    return SQLITE_OK;\r\n  }\r\n  if( isMainJrnl ){\r\n    rc = read32bits(jfd, (*pOffset)-4, &cksum);\r\n    if( rc ) return rc;\r\n    if( !isSavepnt && pager_cksum(pPager, (u8*)aData)!=cksum ){\r\n      return SQLITE_DONE;\r\n    }\r\n  }\r\n\r\n  /* If this page has already been played by before during the current\r\n  ** rollback, then don't bother to play it back again.\r\n  */\r\n  if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  /* When playing back page 1, restore the nReserve setting\r\n  */\r\n  if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){\r\n    pPager->nReserve = ((u8*)aData)[20];\r\n    pagerReportSize(pPager);\r\n  }\r\n\r\n  /* If the pager is in CACHEMOD state, then there must be a copy of this\r\n  ** page in the pager cache. In this case just update the pager cache,\r\n  ** not the database file. The page is left marked dirty in this case.\r\n  **\r\n  ** An exception to the above rule: If the database is in no-sync mode\r\n  ** and a page is moved during an incremental vacuum then the page may\r\n  ** not be in the pager cache. Later: if a malloc() or IO error occurs\r\n  ** during a Movepage() call, then the page may not be in the cache\r\n  ** either. So the condition described in the above paragraph is not\r\n  ** assert()able.\r\n  **\r\n  ** If in WRITER_DBMOD, WRITER_FINISHED or OPEN state, then we update the\r\n  ** pager cache if it exists and the main file. The page is then marked \r\n  ** not dirty. Since this code is only executed in PAGER_OPEN state for\r\n  ** a hot-journal rollback, it is guaranteed that the page-cache is empty\r\n  ** if the pager is in OPEN state.\r\n  **\r\n  ** Ticket #1171:  The statement journal might contain page content that is\r\n  ** different from the page content at the start of the transaction.\r\n  ** This occurs when a page is changed prior to the start of a statement\r\n  ** then changed again within the statement.  When rolling back such a\r\n  ** statement we must not write to the original database unless we know\r\n  ** for certain that original page contents are synced into the main rollback\r\n  ** journal.  Otherwise, a power loss might leave modified data in the\r\n  ** database file without an entry in the rollback journal that can\r\n  ** restore the database to its original form.  Two conditions must be\r\n  ** met before writing to the database files. (1) the database must be\r\n  ** locked.  (2) we know that the original page content is fully synced\r\n  ** in the main journal either because the page is not in cache or else\r\n  ** the page is marked as needSync==0.\r\n  **\r\n  ** 2008-04-14:  When attempting to vacuum a corrupt database file, it\r\n  ** is possible to fail a statement on a database that does not yet exist.\r\n  ** Do not attempt to write if database file has never been opened.\r\n  */\r\n  if( pagerUseWal(pPager) ){\r\n    pPg = 0;\r\n  }else{\r\n    pPg = pager_lookup(pPager, pgno);\r\n  }\r\n  assert( pPg || !MEMDB );\r\n  assert( pPager->eState!=PAGER_OPEN || pPg==0 );\r\n  PAGERTRACE((\"PLAYBACK %d page %d hash(%08x) %s\\n\",\r\n           PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, (u8*)aData),\r\n           (isMainJrnl?\"main-journal\":\"sub-journal\")\r\n  ));\r\n  if( isMainJrnl ){\r\n    isSynced = pPager->noSync || (*pOffset <= pPager->journalHdr);\r\n  }else{\r\n    isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC));\r\n  }\r\n  if( isOpen(pPager->fd)\r\n   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)\r\n   && isSynced\r\n  ){\r\n    i64 ofst = (pgno-1)*(i64)pPager->pageSize;\r\n    testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );\r\n    assert( !pagerUseWal(pPager) );\r\n    rc = sqlite3OsWrite(pPager->fd, (u8*)aData, pPager->pageSize, ofst);\r\n    if( pgno>pPager->dbFileSize ){\r\n      pPager->dbFileSize = pgno;\r\n    }\r\n    if( pPager->pBackup ){\r\n      CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM);\r\n      sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);\r\n      CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM, aData);\r\n    }\r\n  }else if( !isMainJrnl && pPg==0 ){\r\n    /* If this is a rollback of a savepoint and data was not written to\r\n    ** the database and the page is not in-memory, there is a potential\r\n    ** problem. When the page is next fetched by the b-tree layer, it \r\n    ** will be read from the database file, which may or may not be \r\n    ** current. \r\n    **\r\n    ** There are a couple of different ways this can happen. All are quite\r\n    ** obscure. When running in synchronous mode, this can only happen \r\n    ** if the page is on the free-list at the start of the transaction, then\r\n    ** populated, then moved using sqlite3PagerMovepage().\r\n    **\r\n    ** The solution is to add an in-memory page to the cache containing\r\n    ** the data just read from the sub-journal. Mark the page as dirty \r\n    ** and if the pager requires a journal-sync, then mark the page as \r\n    ** requiring a journal-sync before it is written.\r\n    */\r\n    assert( isSavepnt );\r\n    assert( pPager->doNotSpill==0 );\r\n    pPager->doNotSpill++;\r\n    rc = sqlite3PagerAcquire(pPager, pgno, &pPg, 1);\r\n    assert( pPager->doNotSpill==1 );\r\n    pPager->doNotSpill--;\r\n    if( rc!=SQLITE_OK ) return rc;\r\n    pPg->flags &= ~PGHDR_NEED_READ;\r\n    sqlite3PcacheMakeDirty(pPg);\r\n  }\r\n  if( pPg ){\r\n    /* No page should ever be explicitly rolled back that is in use, except\r\n    ** for page 1 which is held in use in order to keep the lock on the\r\n    ** database active. However such a page may be rolled back as a result\r\n    ** of an internal error resulting in an automatic call to\r\n    ** sqlite3PagerRollback().\r\n    */\r\n    void *pData;\r\n    pData = pPg->pData;\r\n    memcpy(pData, (u8*)aData, pPager->pageSize);\r\n    pPager->xReiniter(pPg);\r\n    if( isMainJrnl && (!isSavepnt || *pOffset<=pPager->journalHdr) ){\r\n      /* If the contents of this page were just restored from the main \r\n      ** journal file, then its content must be as they were when the \r\n      ** transaction was first opened. In this case we can mark the page\r\n      ** as clean, since there will be no need to write it out to the\r\n      ** database.\r\n      **\r\n      ** There is one exception to this rule. If the page is being rolled\r\n      ** back as part of a savepoint (or statement) rollback from an \r\n      ** unsynced portion of the main journal file, then it is not safe\r\n      ** to mark the page as clean. This is because marking the page as\r\n      ** clean will clear the PGHDR_NEED_SYNC flag. Since the page is\r\n      ** already in the journal file (recorded in Pager.pInJournal) and\r\n      ** the PGHDR_NEED_SYNC flag is cleared, if the page is written to\r\n      ** again within this transaction, it will be marked as dirty but\r\n      ** the PGHDR_NEED_SYNC flag will not be set. It could then potentially\r\n      ** be written out into the database file before its journal file\r\n      ** segment is synced. If a crash occurs during or following this,\r\n      ** database corruption may ensue.\r\n      */\r\n      assert( !pagerUseWal(pPager) );\r\n      sqlite3PcacheMakeClean(pPg);\r\n    }\r\n    pager_set_pagehash(pPg);\r\n\r\n    /* If this was page 1, then restore the value of Pager.dbFileVers.\r\n    ** Do this before any decoding. */\r\n    if( pgno==1 ){\r\n      memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));\r\n    }\r\n\r\n    /* Decode the page just read from disk */\r\n    CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM);\r\n    sqlite3PcacheRelease(pPg);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Parameter zMaster is the name of a master journal file. A single journal\r\n** file that referred to the master journal file has just been rolled back.\r\n** This routine checks if it is possible to delete the master journal file,\r\n** and does so if it is.\r\n**\r\n** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not \r\n** available for use within this function.\r\n**\r\n** When a master journal file is created, it is populated with the names \r\n** of all of its child journals, one after another, formatted as utf-8 \r\n** encoded text. The end of each child journal file is marked with a \r\n** nul-terminator byte (0x00). i.e. the entire contents of a master journal\r\n** file for a transaction involving two databases might be:\r\n**\r\n**   \"/home/bill/a.db-journal\\x00/home/bill/b.db-journal\\x00\"\r\n**\r\n** A master journal file may only be deleted once all of its child \r\n** journals have been rolled back.\r\n**\r\n** This function reads the contents of the master-journal file into \r\n** memory and loops through each of the child journal names. For\r\n** each child journal, it checks if:\r\n**\r\n**   * if the child journal exists, and if so\r\n**   * if the child journal contains a reference to master journal \r\n**     file zMaster\r\n**\r\n** If a child journal can be found that matches both of the criteria\r\n** above, this function returns without doing anything. Otherwise, if\r\n** no such child journal can be found, file zMaster is deleted from\r\n** the file-system using sqlite3OsDelete().\r\n**\r\n** If an IO error within this function, an error code is returned. This\r\n** function allocates memory by calling sqlite3Malloc(). If an allocation\r\n** fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors \r\n** occur, SQLITE_OK is returned.\r\n**\r\n** TODO: This function allocates a single block of memory to load\r\n** the entire contents of the master journal file. This could be\r\n** a couple of kilobytes or so - potentially larger than the page \r\n** size.\r\n*/\r\nstatic int pager_delmaster(Pager *pPager, const char *zMaster){\r\n  sqlite3_vfs *pVfs = pPager->pVfs;\r\n  int rc;                   /* Return code */\r\n  sqlite3_file *pMaster;    /* Malloc'd master-journal file descriptor */\r\n  sqlite3_file *pJournal;   /* Malloc'd child-journal file descriptor */\r\n  char *zMasterJournal = 0; /* Contents of master journal file */\r\n  i64 nMasterJournal;       /* Size of master journal file */\r\n  char *zJournal;           /* Pointer to one journal within MJ file */\r\n  char *zMasterPtr;         /* Space to hold MJ filename from a journal file */\r\n  int nMasterPtr;           /* Amount of space allocated to zMasterPtr[] */\r\n\r\n  /* Allocate space for both the pJournal and pMaster file descriptors.\r\n  ** If successful, open the master journal file for reading.\r\n  */\r\n  pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);\r\n  pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile);\r\n  if( !pMaster ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL);\r\n    rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0);\r\n  }\r\n  if( rc!=SQLITE_OK ) goto delmaster_out;\r\n\r\n  /* Load the entire master journal file into space obtained from\r\n  ** sqlite3_malloc() and pointed to by zMasterJournal.   Also obtain\r\n  ** sufficient space (in zMasterPtr) to hold the names of master\r\n  ** journal files extracted from regular rollback-journals.\r\n  */\r\n  rc = sqlite3OsFileSize(pMaster, &nMasterJournal);\r\n  if( rc!=SQLITE_OK ) goto delmaster_out;\r\n  nMasterPtr = pVfs->mxPathname+1;\r\n  zMasterJournal = sqlite3Malloc((int)nMasterJournal + nMasterPtr + 1);\r\n  if( !zMasterJournal ){\r\n    rc = SQLITE_NOMEM;\r\n    goto delmaster_out;\r\n  }\r\n  zMasterPtr = &zMasterJournal[nMasterJournal+1];\r\n  rc = sqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0);\r\n  if( rc!=SQLITE_OK ) goto delmaster_out;\r\n  zMasterJournal[nMasterJournal] = 0;\r\n\r\n  zJournal = zMasterJournal;\r\n  while( (zJournal-zMasterJournal)<nMasterJournal ){\r\n    int exists;\r\n    rc = sqlite3OsAccess(pVfs, zJournal, SQLITE_ACCESS_EXISTS, &exists);\r\n    if( rc!=SQLITE_OK ){\r\n      goto delmaster_out;\r\n    }\r\n    if( exists ){\r\n      /* One of the journals pointed to by the master journal exists.\r\n      ** Open it and check if it points at the master journal. If\r\n      ** so, return without deleting the master journal file.\r\n      */\r\n      int c;\r\n      int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL);\r\n      rc = sqlite3OsOpen(pVfs, zJournal, pJournal, flags, 0);\r\n      if( rc!=SQLITE_OK ){\r\n        goto delmaster_out;\r\n      }\r\n\r\n      rc = readMasterJournal(pJournal, zMasterPtr, nMasterPtr);\r\n      sqlite3OsClose(pJournal);\r\n      if( rc!=SQLITE_OK ){\r\n        goto delmaster_out;\r\n      }\r\n\r\n      c = zMasterPtr[0]!=0 && strcmp(zMasterPtr, zMaster)==0;\r\n      if( c ){\r\n        /* We have a match. Do not delete the master journal file. */\r\n        goto delmaster_out;\r\n      }\r\n    }\r\n    zJournal += (sqlite3Strlen30(zJournal)+1);\r\n  }\r\n \r\n  sqlite3OsClose(pMaster);\r\n  rc = sqlite3OsDelete(pVfs, zMaster, 0);\r\n\r\ndelmaster_out:\r\n  sqlite3_free(zMasterJournal);\r\n  if( pMaster ){\r\n    sqlite3OsClose(pMaster);\r\n    assert( !isOpen(pJournal) );\r\n    sqlite3_free(pMaster);\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This function is used to change the actual size of the database \r\n** file in the file-system. This only happens when committing a transaction,\r\n** or rolling back a transaction (including rolling back a hot-journal).\r\n**\r\n** If the main database file is not open, or the pager is not in either\r\n** DBMOD or OPEN state, this function is a no-op. Otherwise, the size \r\n** of the file is changed to nPage pages (nPage*pPager->pageSize bytes). \r\n** If the file on disk is currently larger than nPage pages, then use the VFS\r\n** xTruncate() method to truncate it.\r\n**\r\n** Or, it might might be the case that the file on disk is smaller than \r\n** nPage pages. Some operating system implementations can get confused if \r\n** you try to truncate a file to some size that is larger than it \r\n** currently is, so detect this case and write a single zero byte to \r\n** the end of the new file instead.\r\n**\r\n** If successful, return SQLITE_OK. If an IO error occurs while modifying\r\n** the database file, return the error code to the caller.\r\n*/\r\nstatic int pager_truncate(Pager *pPager, Pgno nPage){\r\n  int rc = SQLITE_OK;\r\n  assert( pPager->eState!=PAGER_ERROR );\r\n  assert( pPager->eState!=PAGER_READER );\r\n  \r\n  if( isOpen(pPager->fd) \r\n   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) \r\n  ){\r\n    i64 currentSize, newSize;\r\n    int szPage = pPager->pageSize;\r\n    assert( pPager->eLock==EXCLUSIVE_LOCK );\r\n    /* TODO: Is it safe to use Pager.dbFileSize here? */\r\n    rc = sqlite3OsFileSize(pPager->fd, &currentSize);\r\n    newSize = szPage*(i64)nPage;\r\n    if( rc==SQLITE_OK && currentSize!=newSize ){\r\n      if( currentSize>newSize ){\r\n        rc = sqlite3OsTruncate(pPager->fd, newSize);\r\n      }else if( (currentSize+szPage)<=newSize ){\r\n        char *pTmp = pPager->pTmpSpace;\r\n        memset(pTmp, 0, szPage);\r\n        testcase( (newSize-szPage) == currentSize );\r\n        testcase( (newSize-szPage) >  currentSize );\r\n        rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage);\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        pPager->dbFileSize = nPage;\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set the value of the Pager.sectorSize variable for the given\r\n** pager based on the value returned by the xSectorSize method\r\n** of the open database file. The sector size will be used used \r\n** to determine the size and alignment of journal header and \r\n** master journal pointers within created journal files.\r\n**\r\n** For temporary files the effective sector size is always 512 bytes.\r\n**\r\n** Otherwise, for non-temporary files, the effective sector size is\r\n** the value returned by the xSectorSize() method rounded up to 32 if\r\n** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it\r\n** is greater than MAX_SECTOR_SIZE.\r\n**\r\n** If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set\r\n** the effective sector size to its minimum value (512).  The purpose of\r\n** pPager->sectorSize is to define the \"blast radius\" of bytes that\r\n** might change if a crash occurs while writing to a single byte in\r\n** that range.  But with POWERSAFE_OVERWRITE, the blast radius is zero\r\n** (that is what POWERSAFE_OVERWRITE means), so we minimize the sector\r\n** size.  For backwards compatibility of the rollback journal file format,\r\n** we cannot reduce the effective sector size below 512.\r\n*/\r\nstatic void setSectorSize(Pager *pPager){\r\n  assert( isOpen(pPager->fd) || pPager->tempFile );\r\n\r\n  if( pPager->tempFile\r\n   || (sqlite3OsDeviceCharacteristics(pPager->fd) & \r\n              SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0\r\n  ){\r\n    /* Sector size doesn't matter for temporary files. Also, the file\r\n    ** may not have been opened yet, in which case the OsSectorSize()\r\n    ** call will segfault. */\r\n    pPager->sectorSize = 512;\r\n  }else{\r\n    pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);\r\n    if( pPager->sectorSize<32 ){\r\n      pPager->sectorSize = 512;\r\n    }\r\n    if( pPager->sectorSize>MAX_SECTOR_SIZE ){\r\n      assert( MAX_SECTOR_SIZE>=512 );\r\n      pPager->sectorSize = MAX_SECTOR_SIZE;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Playback the journal and thus restore the database file to\r\n** the state it was in before we started making changes.  \r\n**\r\n** The journal file format is as follows: \r\n**\r\n**  (1)  8 byte prefix.  A copy of aJournalMagic[].\r\n**  (2)  4 byte big-endian integer which is the number of valid page records\r\n**       in the journal.  If this value is 0xffffffff, then compute the\r\n**       number of page records from the journal size.\r\n**  (3)  4 byte big-endian integer which is the initial value for the \r\n**       sanity checksum.\r\n**  (4)  4 byte integer which is the number of pages to truncate the\r\n**       database to during a rollback.\r\n**  (5)  4 byte big-endian integer which is the sector size.  The header\r\n**       is this many bytes in size.\r\n**  (6)  4 byte big-endian integer which is the page size.\r\n**  (7)  zero padding out to the next sector size.\r\n**  (8)  Zero or more pages instances, each as follows:\r\n**        +  4 byte page number.\r\n**        +  pPager->pageSize bytes of data.\r\n**        +  4 byte checksum\r\n**\r\n** When we speak of the journal header, we mean the first 7 items above.\r\n** Each entry in the journal is an instance of the 8th item.\r\n**\r\n** Call the value from the second bullet \"nRec\".  nRec is the number of\r\n** valid page entries in the journal.  In most cases, you can compute the\r\n** value of nRec from the size of the journal file.  But if a power\r\n** failure occurred while the journal was being written, it could be the\r\n** case that the size of the journal file had already been increased but\r\n** the extra entries had not yet made it safely to disk.  In such a case,\r\n** the value of nRec computed from the file size would be too large.  For\r\n** that reason, we always use the nRec value in the header.\r\n**\r\n** If the nRec value is 0xffffffff it means that nRec should be computed\r\n** from the file size.  This value is used when the user selects the\r\n** no-sync option for the journal.  A power failure could lead to corruption\r\n** in this case.  But for things like temporary table (which will be\r\n** deleted when the power is restored) we don't care.  \r\n**\r\n** If the file opened as the journal file is not a well-formed\r\n** journal file then all pages up to the first corrupted page are rolled\r\n** back (or no pages if the journal header is corrupted). The journal file\r\n** is then deleted and SQLITE_OK returned, just as if no corruption had\r\n** been encountered.\r\n**\r\n** If an I/O or malloc() error occurs, the journal-file is not deleted\r\n** and an error code is returned.\r\n**\r\n** The isHot parameter indicates that we are trying to rollback a journal\r\n** that might be a hot journal.  Or, it could be that the journal is \r\n** preserved because of JOURNALMODE_PERSIST or JOURNALMODE_TRUNCATE.\r\n** If the journal really is hot, reset the pager cache prior rolling\r\n** back any content.  If the journal is merely persistent, no reset is\r\n** needed.\r\n*/\r\nstatic int pager_playback(Pager *pPager, int isHot){\r\n  sqlite3_vfs *pVfs = pPager->pVfs;\r\n  i64 szJ;                 /* Size of the journal file in bytes */\r\n  u32 nRec;                /* Number of Records in the journal */\r\n  u32 u;                   /* Unsigned loop counter */\r\n  Pgno mxPg = 0;           /* Size of the original file in pages */\r\n  int rc;                  /* Result code of a subroutine */\r\n  int res = 1;             /* Value returned by sqlite3OsAccess() */\r\n  char *zMaster = 0;       /* Name of master journal file if any */\r\n  int needPagerReset;      /* True to reset page prior to first page rollback */\r\n\r\n  /* Figure out how many records are in the journal.  Abort early if\r\n  ** the journal is empty.\r\n  */\r\n  assert( isOpen(pPager->jfd) );\r\n  rc = sqlite3OsFileSize(pPager->jfd, &szJ);\r\n  if( rc!=SQLITE_OK ){\r\n    goto end_playback;\r\n  }\r\n\r\n  /* Read the master journal name from the journal, if it is present.\r\n  ** If a master journal file name is specified, but the file is not\r\n  ** present on disk, then the journal is not hot and does not need to be\r\n  ** played back.\r\n  **\r\n  ** TODO: Technically the following is an error because it assumes that\r\n  ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that\r\n  ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c,\r\n  **  mxPathname is 512, which is the same as the minimum allowable value\r\n  ** for pageSize.\r\n  */\r\n  zMaster = pPager->pTmpSpace;\r\n  rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);\r\n  if( rc==SQLITE_OK && zMaster[0] ){\r\n    rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res);\r\n  }\r\n  zMaster = 0;\r\n  if( rc!=SQLITE_OK || !res ){\r\n    goto end_playback;\r\n  }\r\n  pPager->journalOff = 0;\r\n  needPagerReset = isHot;\r\n\r\n  /* This loop terminates either when a readJournalHdr() or \r\n  ** pager_playback_one_page() call returns SQLITE_DONE or an IO error \r\n  ** occurs. \r\n  */\r\n  while( 1 ){\r\n    /* Read the next journal header from the journal file.  If there are\r\n    ** not enough bytes left in the journal file for a complete header, or\r\n    ** it is corrupted, then a process must have failed while writing it.\r\n    ** This indicates nothing more needs to be rolled back.\r\n    */\r\n    rc = readJournalHdr(pPager, isHot, szJ, &nRec, &mxPg);\r\n    if( rc!=SQLITE_OK ){ \r\n      if( rc==SQLITE_DONE ){\r\n        rc = SQLITE_OK;\r\n      }\r\n      goto end_playback;\r\n    }\r\n\r\n    /* If nRec is 0xffffffff, then this journal was created by a process\r\n    ** working in no-sync mode. This means that the rest of the journal\r\n    ** file consists of pages, there are no more journal headers. Compute\r\n    ** the value of nRec based on this assumption.\r\n    */\r\n    if( nRec==0xffffffff ){\r\n      assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) );\r\n      nRec = (int)((szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager));\r\n    }\r\n\r\n    /* If nRec is 0 and this rollback is of a transaction created by this\r\n    ** process and if this is the final header in the journal, then it means\r\n    ** that this part of the journal was being filled but has not yet been\r\n    ** synced to disk.  Compute the number of pages based on the remaining\r\n    ** size of the file.\r\n    **\r\n    ** The third term of the test was added to fix ticket #2565.\r\n    ** When rolling back a hot journal, nRec==0 always means that the next\r\n    ** chunk of the journal contains zero pages to be rolled back.  But\r\n    ** when doing a ROLLBACK and the nRec==0 chunk is the last chunk in\r\n    ** the journal, it means that the journal might contain additional\r\n    ** pages that need to be rolled back and that the number of pages \r\n    ** should be computed based on the journal file size.\r\n    */\r\n    if( nRec==0 && !isHot &&\r\n        pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){\r\n      nRec = (int)((szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager));\r\n    }\r\n\r\n    /* If this is the first header read from the journal, truncate the\r\n    ** database file back to its original size.\r\n    */\r\n    if( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ){\r\n      rc = pager_truncate(pPager, mxPg);\r\n      if( rc!=SQLITE_OK ){\r\n        goto end_playback;\r\n      }\r\n      pPager->dbSize = mxPg;\r\n    }\r\n\r\n    /* Copy original pages out of the journal and back into the \r\n    ** database file and/or page cache.\r\n    */\r\n    for(u=0; u<nRec; u++){\r\n      if( needPagerReset ){\r\n        pager_reset(pPager);\r\n        needPagerReset = 0;\r\n      }\r\n      rc = pager_playback_one_page(pPager,&pPager->journalOff,0,1,0);\r\n      if( rc!=SQLITE_OK ){\r\n        if( rc==SQLITE_DONE ){\r\n          pPager->journalOff = szJ;\r\n          break;\r\n        }else if( rc==SQLITE_IOERR_SHORT_READ ){\r\n          /* If the journal has been truncated, simply stop reading and\r\n          ** processing the journal. This might happen if the journal was\r\n          ** not completely written and synced prior to a crash.  In that\r\n          ** case, the database should have never been written in the\r\n          ** first place so it is OK to simply abandon the rollback. */\r\n          rc = SQLITE_OK;\r\n          goto end_playback;\r\n        }else{\r\n          /* If we are unable to rollback, quit and return the error\r\n          ** code.  This will cause the pager to enter the error state\r\n          ** so that no further harm will be done.  Perhaps the next\r\n          ** process to come along will be able to rollback the database.\r\n          */\r\n          goto end_playback;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  /*NOTREACHED*/\r\n  assert( 0 );\r\n\r\nend_playback:\r\n  /* Following a rollback, the database file should be back in its original\r\n  ** state prior to the start of the transaction, so invoke the\r\n  ** SQLITE_FCNTL_DB_UNCHANGED file-control method to disable the\r\n  ** assertion that the transaction counter was modified.\r\n  */\r\n#ifdef SQLITE_DEBUG\r\n  if( pPager->fd->pMethods ){\r\n    sqlite3OsFileControlHint(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0);\r\n  }\r\n#endif\r\n\r\n  /* If this playback is happening automatically as a result of an IO or \r\n  ** malloc error that occurred after the change-counter was updated but \r\n  ** before the transaction was committed, then the change-counter \r\n  ** modification may just have been reverted. If this happens in exclusive \r\n  ** mode, then subsequent transactions performed by the connection will not\r\n  ** update the change-counter at all. This may lead to cache inconsistency\r\n  ** problems for other processes at some point in the future. So, just\r\n  ** in case this has happened, clear the changeCountDone flag now.\r\n  */\r\n  pPager->changeCountDone = pPager->tempFile;\r\n\r\n  if( rc==SQLITE_OK ){\r\n    zMaster = pPager->pTmpSpace;\r\n    rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);\r\n    testcase( rc!=SQLITE_OK );\r\n  }\r\n  if( rc==SQLITE_OK\r\n   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)\r\n  ){\r\n    rc = sqlite3PagerSync(pPager);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    rc = pager_end_transaction(pPager, zMaster[0]!='\\0');\r\n    testcase( rc!=SQLITE_OK );\r\n  }\r\n  if( rc==SQLITE_OK && zMaster[0] && res ){\r\n    /* If there was a master journal and this routine will return success,\r\n    ** see if it is possible to delete the master journal.\r\n    */\r\n    rc = pager_delmaster(pPager, zMaster);\r\n    testcase( rc!=SQLITE_OK );\r\n  }\r\n\r\n  /* The Pager.sectorSize variable may have been updated while rolling\r\n  ** back a journal created by a process with a different sector size\r\n  ** value. Reset it to the correct value for this process.\r\n  */\r\n  setSectorSize(pPager);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Read the content for page pPg out of the database file and into \r\n** pPg->pData. A shared lock or greater must be held on the database\r\n** file before this function is called.\r\n**\r\n** If page 1 is read, then the value of Pager.dbFileVers[] is set to\r\n** the value read from the database file.\r\n**\r\n** If an IO error occurs, then the IO error is returned to the caller.\r\n** Otherwise, SQLITE_OK is returned.\r\n*/\r\nstatic int readDbPage(PgHdr *pPg){\r\n  Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */\r\n  Pgno pgno = pPg->pgno;       /* Page number to read */\r\n  int rc = SQLITE_OK;          /* Return code */\r\n  int isInWal = 0;             /* True if page is in log file */\r\n  int pgsz = pPager->pageSize; /* Number of bytes to read */\r\n\r\n  assert( pPager->eState>=PAGER_READER && !MEMDB );\r\n  assert( isOpen(pPager->fd) );\r\n\r\n  if( NEVER(!isOpen(pPager->fd)) ){\r\n    assert( pPager->tempFile );\r\n    memset(pPg->pData, 0, pPager->pageSize);\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  if( pagerUseWal(pPager) ){\r\n    /* Try to pull the page from the write-ahead log. */\r\n    rc = sqlite3WalRead(pPager->pWal, pgno, &isInWal, pgsz, pPg->pData);\r\n  }\r\n  if( rc==SQLITE_OK && !isInWal ){\r\n    i64 iOffset = (pgno-1)*(i64)pPager->pageSize;\r\n    rc = sqlite3OsRead(pPager->fd, pPg->pData, pgsz, iOffset);\r\n    if( rc==SQLITE_IOERR_SHORT_READ ){\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n\r\n  if( pgno==1 ){\r\n    if( rc ){\r\n      /* If the read is unsuccessful, set the dbFileVers[] to something\r\n      ** that will never be a valid file version.  dbFileVers[] is a copy\r\n      ** of bytes 24..39 of the database.  Bytes 28..31 should always be\r\n      ** zero or the size of the database in page. Bytes 32..35 and 35..39\r\n      ** should be page numbers which are never 0xffffffff.  So filling\r\n      ** pPager->dbFileVers[] with all 0xff bytes should suffice.\r\n      **\r\n      ** For an encrypted database, the situation is more complex:  bytes\r\n      ** 24..39 of the database are white noise.  But the probability of\r\n      ** white noising equaling 16 bytes of 0xff is vanishingly small so\r\n      ** we should still be ok.\r\n      */\r\n      memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));\r\n    }else{\r\n      u8 *dbFileVers = &((u8*)pPg->pData)[24];\r\n      memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));\r\n    }\r\n  }\r\n  CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);\r\n\r\n  PAGER_INCR(sqlite3_pager_readdb_count);\r\n  PAGER_INCR(pPager->nRead);\r\n  IOTRACE((\"PGIN %p %d\\n\", pPager, pgno));\r\n  PAGERTRACE((\"FETCH %d page %d hash(%08x)\\n\",\r\n               PAGERID(pPager), pgno, pager_pagehash(pPg)));\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Update the value of the change-counter at offsets 24 and 92 in\r\n** the header and the sqlite version number at offset 96.\r\n**\r\n** This is an unconditional update.  See also the pager_incr_changecounter()\r\n** routine which only updates the change-counter if the update is actually\r\n** needed, as determined by the pPager->changeCountDone state variable.\r\n*/\r\nstatic void pager_write_changecounter(PgHdr *pPg){\r\n  u32 change_counter;\r\n\r\n  /* Increment the value just read and write it back to byte 24. */\r\n  change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1;\r\n  put32bits(((char*)pPg->pData)+24, change_counter);\r\n\r\n  /* Also store the SQLite version number in bytes 96..99 and in\r\n  ** bytes 92..95 store the change counter for which the version number\r\n  ** is valid. */\r\n  put32bits(((char*)pPg->pData)+92, change_counter);\r\n  put32bits(((char*)pPg->pData)+96, SQLITE_VERSION_NUMBER);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/*\r\n** This function is invoked once for each page that has already been \r\n** written into the log file when a WAL transaction is rolled back.\r\n** Parameter iPg is the page number of said page. The pCtx argument \r\n** is actually a pointer to the Pager structure.\r\n**\r\n** If page iPg is present in the cache, and has no outstanding references,\r\n** it is discarded. Otherwise, if there are one or more outstanding\r\n** references, the page content is reloaded from the database. If the\r\n** attempt to reload content from the database is required and fails, \r\n** return an SQLite error code. Otherwise, SQLITE_OK.\r\n*/\r\nstatic int pagerUndoCallback(void *pCtx, Pgno iPg){\r\n  int rc = SQLITE_OK;\r\n  Pager *pPager = (Pager *)pCtx;\r\n  PgHdr *pPg;\r\n\r\n  pPg = sqlite3PagerLookup(pPager, iPg);\r\n  if( pPg ){\r\n    if( sqlite3PcachePageRefcount(pPg)==1 ){\r\n      sqlite3PcacheDrop(pPg);\r\n    }else{\r\n      rc = readDbPage(pPg);\r\n      if( rc==SQLITE_OK ){\r\n        pPager->xReiniter(pPg);\r\n      }\r\n      sqlite3PagerUnref(pPg);\r\n    }\r\n  }\r\n\r\n  /* Normally, if a transaction is rolled back, any backup processes are\r\n  ** updated as data is copied out of the rollback journal and into the\r\n  ** database. This is not generally possible with a WAL database, as\r\n  ** rollback involves simply truncating the log file. Therefore, if one\r\n  ** or more frames have already been written to the log (and therefore \r\n  ** also copied into the backup databases) as part of this transaction,\r\n  ** the backups must be restarted.\r\n  */\r\n  sqlite3BackupRestart(pPager->pBackup);\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called to rollback a transaction on a WAL database.\r\n*/\r\nstatic int pagerRollbackWal(Pager *pPager){\r\n  int rc;                         /* Return Code */\r\n  PgHdr *pList;                   /* List of dirty pages to revert */\r\n\r\n  /* For all pages in the cache that are currently dirty or have already\r\n  ** been written (but not committed) to the log file, do one of the \r\n  ** following:\r\n  **\r\n  **   + Discard the cached page (if refcount==0), or\r\n  **   + Reload page content from the database (if refcount>0).\r\n  */\r\n  pPager->dbSize = pPager->dbOrigSize;\r\n  rc = sqlite3WalUndo(pPager->pWal, pagerUndoCallback, (void *)pPager);\r\n  pList = sqlite3PcacheDirtyList(pPager->pPCache);\r\n  while( pList && rc==SQLITE_OK ){\r\n    PgHdr *pNext = pList->pDirty;\r\n    rc = pagerUndoCallback((void *)pPager, pList->pgno);\r\n    pList = pNext;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is a wrapper around sqlite3WalFrames(). As well as logging\r\n** the contents of the list of pages headed by pList (connected by pDirty),\r\n** this function notifies any active backup processes that the pages have\r\n** changed. \r\n**\r\n** The list of pages passed into this routine is always sorted by page number.\r\n** Hence, if page 1 appears anywhere on the list, it will be the first page.\r\n*/ \r\nstatic int pagerWalFrames(\r\n  Pager *pPager,                  /* Pager object */\r\n  PgHdr *pList,                   /* List of frames to log */\r\n  Pgno nTruncate,                 /* Database size after this commit */\r\n  int isCommit                    /* True if this is a commit */\r\n){\r\n  int rc;                         /* Return code */\r\n#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES)\r\n  PgHdr *p;                       /* For looping over pages */\r\n#endif\r\n\r\n  assert( pPager->pWal );\r\n  assert( pList );\r\n#ifdef SQLITE_DEBUG\r\n  /* Verify that the page list is in accending order */\r\n  for(p=pList; p && p->pDirty; p=p->pDirty){\r\n    assert( p->pgno < p->pDirty->pgno );\r\n  }\r\n#endif\r\n\r\n  if( isCommit ){\r\n    /* If a WAL transaction is being committed, there is no point in writing\r\n    ** any pages with page numbers greater than nTruncate into the WAL file.\r\n    ** They will never be read by any client. So remove them from the pDirty\r\n    ** list here. */\r\n    PgHdr *p;\r\n    PgHdr **ppNext = &pList;\r\n    for(p=pList; (*ppNext = p); p=p->pDirty){\r\n      if( p->pgno<=nTruncate ) ppNext = &p->pDirty;\r\n    }\r\n    assert( pList );\r\n  }\r\n\r\n  if( pList->pgno==1 ) pager_write_changecounter(pList);\r\n  rc = sqlite3WalFrames(pPager->pWal, \r\n      pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags\r\n  );\r\n  if( rc==SQLITE_OK && pPager->pBackup ){\r\n    PgHdr *p;\r\n    for(p=pList; p; p=p->pDirty){\r\n      sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);\r\n    }\r\n  }\r\n\r\n#ifdef SQLITE_CHECK_PAGES\r\n  pList = sqlite3PcacheDirtyList(pPager->pPCache);\r\n  for(p=pList; p; p=p->pDirty){\r\n    pager_set_pagehash(p);\r\n  }\r\n#endif\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Begin a read transaction on the WAL.\r\n**\r\n** This routine used to be called \"pagerOpenSnapshot()\" because it essentially\r\n** makes a snapshot of the database at the current point in time and preserves\r\n** that snapshot for use by the reader in spite of concurrently changes by\r\n** other writers or checkpointers.\r\n*/\r\nstatic int pagerBeginReadTransaction(Pager *pPager){\r\n  int rc;                         /* Return code */\r\n  int changed = 0;                /* True if cache must be reset */\r\n\r\n  assert( pagerUseWal(pPager) );\r\n  assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );\r\n\r\n  /* sqlite3WalEndReadTransaction() was not called for the previous\r\n  ** transaction in locking_mode=EXCLUSIVE.  So call it now.  If we\r\n  ** are in locking_mode=NORMAL and EndRead() was previously called,\r\n  ** the duplicate call is harmless.\r\n  */\r\n  sqlite3WalEndReadTransaction(pPager->pWal);\r\n\r\n  rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);\r\n  if( rc!=SQLITE_OK || changed ){\r\n    pager_reset(pPager);\r\n  }\r\n\r\n  return rc;\r\n}\r\n#endif\r\n\r\n/*\r\n** This function is called as part of the transition from PAGER_OPEN\r\n** to PAGER_READER state to determine the size of the database file\r\n** in pages (assuming the page size currently stored in Pager.pageSize).\r\n**\r\n** If no error occurs, SQLITE_OK is returned and the size of the database\r\n** in pages is stored in *pnPage. Otherwise, an error code (perhaps\r\n** SQLITE_IOERR_FSTAT) is returned and *pnPage is left unmodified.\r\n*/\r\nstatic int pagerPagecount(Pager *pPager, Pgno *pnPage){\r\n  Pgno nPage;                     /* Value to return via *pnPage */\r\n\r\n  /* Query the WAL sub-system for the database size. The WalDbsize()\r\n  ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or\r\n  ** if the database size is not available. The database size is not\r\n  ** available from the WAL sub-system if the log file is empty or\r\n  ** contains no valid committed transactions.\r\n  */\r\n  assert( pPager->eState==PAGER_OPEN );\r\n  assert( pPager->eLock>=SHARED_LOCK );\r\n  nPage = sqlite3WalDbsize(pPager->pWal);\r\n\r\n  /* If the database size was not available from the WAL sub-system,\r\n  ** determine it based on the size of the database file. If the size\r\n  ** of the database file is not an integer multiple of the page-size,\r\n  ** round down to the nearest page. Except, any file larger than 0\r\n  ** bytes in size is considered to contain at least one page.\r\n  */\r\n  if( nPage==0 ){\r\n    i64 n = 0;                    /* Size of db file in bytes */\r\n    assert( isOpen(pPager->fd) || pPager->tempFile );\r\n    if( isOpen(pPager->fd) ){\r\n      int rc = sqlite3OsFileSize(pPager->fd, &n);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n    }\r\n    nPage = (Pgno)((n+pPager->pageSize-1) / pPager->pageSize);\r\n  }\r\n\r\n  /* If the current number of pages in the file is greater than the\r\n  ** configured maximum pager number, increase the allowed limit so\r\n  ** that the file can be read.\r\n  */\r\n  if( nPage>pPager->mxPgno ){\r\n    pPager->mxPgno = (Pgno)nPage;\r\n  }\r\n\r\n  *pnPage = nPage;\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/*\r\n** Check if the *-wal file that corresponds to the database opened by pPager\r\n** exists if the database is not empy, or verify that the *-wal file does\r\n** not exist (by deleting it) if the database file is empty.\r\n**\r\n** If the database is not empty and the *-wal file exists, open the pager\r\n** in WAL mode.  If the database is empty or if no *-wal file exists and\r\n** if no error occurs, make sure Pager.journalMode is not set to\r\n** PAGER_JOURNALMODE_WAL.\r\n**\r\n** Return SQLITE_OK or an error code.\r\n**\r\n** The caller must hold a SHARED lock on the database file to call this\r\n** function. Because an EXCLUSIVE lock on the db file is required to delete \r\n** a WAL on a none-empty database, this ensures there is no race condition \r\n** between the xAccess() below and an xDelete() being executed by some \r\n** other connection.\r\n*/\r\nstatic int pagerOpenWalIfPresent(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n  assert( pPager->eState==PAGER_OPEN );\r\n  assert( pPager->eLock>=SHARED_LOCK );\r\n\r\n  if( !pPager->tempFile ){\r\n    int isWal;                    /* True if WAL file exists */\r\n    Pgno nPage;                   /* Size of the database file */\r\n\r\n    rc = pagerPagecount(pPager, &nPage);\r\n    if( rc ) return rc;\r\n    if( nPage==0 ){\r\n      rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);\r\n      isWal = 0;\r\n    }else{\r\n      rc = sqlite3OsAccess(\r\n          pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal\r\n      );\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      if( isWal ){\r\n        testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );\r\n        rc = sqlite3PagerOpenWal(pPager, 0);\r\n      }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){\r\n        pPager->journalMode = PAGER_JOURNALMODE_DELETE;\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n#endif\r\n\r\n/*\r\n** Playback savepoint pSavepoint. Or, if pSavepoint==NULL, then playback\r\n** the entire master journal file. The case pSavepoint==NULL occurs when \r\n** a ROLLBACK TO command is invoked on a SAVEPOINT that is a transaction \r\n** savepoint.\r\n**\r\n** When pSavepoint is not NULL (meaning a non-transaction savepoint is \r\n** being rolled back), then the rollback consists of up to three stages,\r\n** performed in the order specified:\r\n**\r\n**   * Pages are played back from the main journal starting at byte\r\n**     offset PagerSavepoint.iOffset and continuing to \r\n**     PagerSavepoint.iHdrOffset, or to the end of the main journal\r\n**     file if PagerSavepoint.iHdrOffset is zero.\r\n**\r\n**   * If PagerSavepoint.iHdrOffset is not zero, then pages are played\r\n**     back starting from the journal header immediately following \r\n**     PagerSavepoint.iHdrOffset to the end of the main journal file.\r\n**\r\n**   * Pages are then played back from the sub-journal file, starting\r\n**     with the PagerSavepoint.iSubRec and continuing to the end of\r\n**     the journal file.\r\n**\r\n** Throughout the rollback process, each time a page is rolled back, the\r\n** corresponding bit is set in a bitvec structure (variable pDone in the\r\n** implementation below). This is used to ensure that a page is only\r\n** rolled back the first time it is encountered in either journal.\r\n**\r\n** If pSavepoint is NULL, then pages are only played back from the main\r\n** journal file. There is no need for a bitvec in this case.\r\n**\r\n** In either case, before playback commences the Pager.dbSize variable\r\n** is reset to the value that it held at the start of the savepoint \r\n** (or transaction). No page with a page-number greater than this value\r\n** is played back. If one is encountered it is simply skipped.\r\n*/\r\nstatic int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){\r\n  i64 szJ;                 /* Effective size of the main journal */\r\n  i64 iHdrOff;             /* End of first segment of main-journal records */\r\n  int rc = SQLITE_OK;      /* Return code */\r\n  Bitvec *pDone = 0;       /* Bitvec to ensure pages played back only once */\r\n\r\n  assert( pPager->eState!=PAGER_ERROR );\r\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\r\n\r\n  /* Allocate a bitvec to use to store the set of pages rolled back */\r\n  if( pSavepoint ){\r\n    pDone = sqlite3BitvecCreate(pSavepoint->nOrig);\r\n    if( !pDone ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n  }\r\n\r\n  /* Set the database size back to the value it was before the savepoint \r\n  ** being reverted was opened.\r\n  */\r\n  pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize;\r\n  pPager->changeCountDone = pPager->tempFile;\r\n\r\n  if( !pSavepoint && pagerUseWal(pPager) ){\r\n    return pagerRollbackWal(pPager);\r\n  }\r\n\r\n  /* Use pPager->journalOff as the effective size of the main rollback\r\n  ** journal.  The actual file might be larger than this in\r\n  ** PAGER_JOURNALMODE_TRUNCATE or PAGER_JOURNALMODE_PERSIST.  But anything\r\n  ** past pPager->journalOff is off-limits to us.\r\n  */\r\n  szJ = pPager->journalOff;\r\n  assert( pagerUseWal(pPager)==0 || szJ==0 );\r\n\r\n  /* Begin by rolling back records from the main journal starting at\r\n  ** PagerSavepoint.iOffset and continuing to the next journal header.\r\n  ** There might be records in the main journal that have a page number\r\n  ** greater than the current database size (pPager->dbSize) but those\r\n  ** will be skipped automatically.  Pages are added to pDone as they\r\n  ** are played back.\r\n  */\r\n  if( pSavepoint && !pagerUseWal(pPager) ){\r\n    iHdrOff = pSavepoint->iHdrOffset ? pSavepoint->iHdrOffset : szJ;\r\n    pPager->journalOff = pSavepoint->iOffset;\r\n    while( rc==SQLITE_OK && pPager->journalOff<iHdrOff ){\r\n      rc = pager_playback_one_page(pPager, &pPager->journalOff, pDone, 1, 1);\r\n    }\r\n    assert( rc!=SQLITE_DONE );\r\n  }else{\r\n    pPager->journalOff = 0;\r\n  }\r\n\r\n  /* Continue rolling back records out of the main journal starting at\r\n  ** the first journal header seen and continuing until the effective end\r\n  ** of the main journal file.  Continue to skip out-of-range pages and\r\n  ** continue adding pages rolled back to pDone.\r\n  */\r\n  while( rc==SQLITE_OK && pPager->journalOff<szJ ){\r\n    u32 ii;            /* Loop counter */\r\n    u32 nJRec = 0;     /* Number of Journal Records */\r\n    u32 dummy;\r\n    rc = readJournalHdr(pPager, 0, szJ, &nJRec, &dummy);\r\n    assert( rc!=SQLITE_DONE );\r\n\r\n    /*\r\n    ** The \"pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff\"\r\n    ** test is related to ticket #2565.  See the discussion in the\r\n    ** pager_playback() function for additional information.\r\n    */\r\n    if( nJRec==0 \r\n     && pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff\r\n    ){\r\n      nJRec = (u32)((szJ - pPager->journalOff)/JOURNAL_PG_SZ(pPager));\r\n    }\r\n    for(ii=0; rc==SQLITE_OK && ii<nJRec && pPager->journalOff<szJ; ii++){\r\n      rc = pager_playback_one_page(pPager, &pPager->journalOff, pDone, 1, 1);\r\n    }\r\n    assert( rc!=SQLITE_DONE );\r\n  }\r\n  assert( rc!=SQLITE_OK || pPager->journalOff>=szJ );\r\n\r\n  /* Finally,  rollback pages from the sub-journal.  Page that were\r\n  ** previously rolled back out of the main journal (and are hence in pDone)\r\n  ** will be skipped.  Out-of-range pages are also skipped.\r\n  */\r\n  if( pSavepoint ){\r\n    u32 ii;            /* Loop counter */\r\n    i64 offset = (i64)pSavepoint->iSubRec*(4+pPager->pageSize);\r\n\r\n    if( pagerUseWal(pPager) ){\r\n      rc = sqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData);\r\n    }\r\n    for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && ii<pPager->nSubRec; ii++){\r\n      assert( offset==(i64)ii*(4+pPager->pageSize) );\r\n      rc = pager_playback_one_page(pPager, &offset, pDone, 0, 1);\r\n    }\r\n    assert( rc!=SQLITE_DONE );\r\n  }\r\n\r\n  sqlite3BitvecDestroy(pDone);\r\n  if( rc==SQLITE_OK ){\r\n    pPager->journalOff = szJ;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Change the maximum number of in-memory pages that are allowed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){\r\n  sqlite3PcacheSetCachesize(pPager->pPCache, mxPage);\r\n}\r\n\r\n/*\r\n** Free as much memory as possible from the pager.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){\r\n  sqlite3PcacheShrink(pPager->pPCache);\r\n}\r\n\r\n/*\r\n** Adjust the robustness of the database to damage due to OS crashes\r\n** or power failures by changing the number of syncs()s when writing\r\n** the rollback journal.  There are three levels:\r\n**\r\n**    OFF       sqlite3OsSync() is never called.  This is the default\r\n**              for temporary and transient files.\r\n**\r\n**    NORMAL    The journal is synced once before writes begin on the\r\n**              database.  This is normally adequate protection, but\r\n**              it is theoretically possible, though very unlikely,\r\n**              that an inopertune power failure could leave the journal\r\n**              in a state which would cause damage to the database\r\n**              when it is rolled back.\r\n**\r\n**    FULL      The journal is synced twice before writes begin on the\r\n**              database (with some additional information - the nRec field\r\n**              of the journal header - being written in between the two\r\n**              syncs).  If we assume that writing a\r\n**              single disk sector is atomic, then this mode provides\r\n**              assurance that the journal will not be corrupted to the\r\n**              point of causing damage to the database during rollback.\r\n**\r\n** The above is for a rollback-journal mode.  For WAL mode, OFF continues\r\n** to mean that no syncs ever occur.  NORMAL means that the WAL is synced\r\n** prior to the start of checkpoint and that the database file is synced\r\n** at the conclusion of the checkpoint if the entire content of the WAL\r\n** was written back into the database.  But no sync operations occur for\r\n** an ordinary commit in NORMAL mode with WAL.  FULL means that the WAL\r\n** file is synced following each commit operation, in addition to the\r\n** syncs associated with NORMAL.\r\n**\r\n** Do not confuse synchronous=FULL with SQLITE_SYNC_FULL.  The\r\n** SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync\r\n** using fcntl(F_FULLFSYNC).  SQLITE_SYNC_NORMAL means to do an\r\n** ordinary fsync() call.  There is no difference between SQLITE_SYNC_FULL\r\n** and SQLITE_SYNC_NORMAL on platforms other than MacOSX.  But the\r\n** synchronous=FULL versus synchronous=NORMAL setting determines when\r\n** the xSync primitive is called and is relevant to all platforms.\r\n**\r\n** Numeric values associated with these states are OFF==1, NORMAL=2,\r\n** and FULL=3.\r\n*/\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\nSQLITE_PRIVATE void sqlite3PagerSetSafetyLevel(\r\n  Pager *pPager,        /* The pager to set safety level for */\r\n  int level,            /* PRAGMA synchronous.  1=OFF, 2=NORMAL, 3=FULL */  \r\n  int bFullFsync,       /* PRAGMA fullfsync */\r\n  int bCkptFullFsync    /* PRAGMA checkpoint_fullfsync */\r\n){\r\n  assert( level>=1 && level<=3 );\r\n  pPager->noSync =  (level==1 || pPager->tempFile) ?1:0;\r\n  pPager->fullSync = (level==3 && !pPager->tempFile) ?1:0;\r\n  if( pPager->noSync ){\r\n    pPager->syncFlags = 0;\r\n    pPager->ckptSyncFlags = 0;\r\n  }else if( bFullFsync ){\r\n    pPager->syncFlags = SQLITE_SYNC_FULL;\r\n    pPager->ckptSyncFlags = SQLITE_SYNC_FULL;\r\n  }else if( bCkptFullFsync ){\r\n    pPager->syncFlags = SQLITE_SYNC_NORMAL;\r\n    pPager->ckptSyncFlags = SQLITE_SYNC_FULL;\r\n  }else{\r\n    pPager->syncFlags = SQLITE_SYNC_NORMAL;\r\n    pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;\r\n  }\r\n  pPager->walSyncFlags = pPager->syncFlags;\r\n  if( pPager->fullSync ){\r\n    pPager->walSyncFlags |= WAL_SYNC_TRANSACTIONS;\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** The following global variable is incremented whenever the library\r\n** attempts to open a temporary file.  This information is used for\r\n** testing and analysis only.  \r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_opentemp_count = 0;\r\n#endif\r\n\r\n/*\r\n** Open a temporary file.\r\n**\r\n** Write the file descriptor into *pFile. Return SQLITE_OK on success \r\n** or some other error code if we fail. The OS will automatically \r\n** delete the temporary file when it is closed.\r\n**\r\n** The flags passed to the VFS layer xOpen() call are those specified\r\n** by parameter vfsFlags ORed with the following:\r\n**\r\n**     SQLITE_OPEN_READWRITE\r\n**     SQLITE_OPEN_CREATE\r\n**     SQLITE_OPEN_EXCLUSIVE\r\n**     SQLITE_OPEN_DELETEONCLOSE\r\n*/\r\nstatic int pagerOpentemp(\r\n  Pager *pPager,        /* The pager object */\r\n  sqlite3_file *pFile,  /* Write the file descriptor here */\r\n  int vfsFlags          /* Flags passed through to the VFS */\r\n){\r\n  int rc;               /* Return code */\r\n\r\n#ifdef SQLITE_TEST\r\n  sqlite3_opentemp_count++;  /* Used for testing and analysis only */\r\n#endif\r\n\r\n  vfsFlags |=  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |\r\n            SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE;\r\n  rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0);\r\n  assert( rc!=SQLITE_OK || isOpen(pFile) );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set the busy handler function.\r\n**\r\n** The pager invokes the busy-handler if sqlite3OsLock() returns \r\n** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock,\r\n** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE \r\n** lock. It does *not* invoke the busy handler when upgrading from\r\n** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE\r\n** (which occurs during hot-journal rollback). Summary:\r\n**\r\n**   Transition                        | Invokes xBusyHandler\r\n**   --------------------------------------------------------\r\n**   NO_LOCK       -> SHARED_LOCK      | Yes\r\n**   SHARED_LOCK   -> RESERVED_LOCK    | No\r\n**   SHARED_LOCK   -> EXCLUSIVE_LOCK   | No\r\n**   RESERVED_LOCK -> EXCLUSIVE_LOCK   | Yes\r\n**\r\n** If the busy-handler callback returns non-zero, the lock is \r\n** retried. If it returns zero, then the SQLITE_BUSY error is\r\n** returned to the caller of the pager API function.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerSetBusyhandler(\r\n  Pager *pPager,                       /* Pager object */\r\n  int (*xBusyHandler)(void *),         /* Pointer to busy-handler function */\r\n  void *pBusyHandlerArg                /* Argument to pass to xBusyHandler */\r\n){  \r\n  pPager->xBusyHandler = xBusyHandler;\r\n  pPager->pBusyHandlerArg = pBusyHandlerArg;\r\n}\r\n\r\n/*\r\n** Change the page size used by the Pager object. The new page size \r\n** is passed in *pPageSize.\r\n**\r\n** If the pager is in the error state when this function is called, it\r\n** is a no-op. The value returned is the error state error code (i.e. \r\n** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL).\r\n**\r\n** Otherwise, if all of the following are true:\r\n**\r\n**   * the new page size (value of *pPageSize) is valid (a power \r\n**     of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and\r\n**\r\n**   * there are no outstanding page references, and\r\n**\r\n**   * the database is either not an in-memory database or it is\r\n**     an in-memory database that currently consists of zero pages.\r\n**\r\n** then the pager object page size is set to *pPageSize.\r\n**\r\n** If the page size is changed, then this function uses sqlite3PagerMalloc() \r\n** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt \r\n** fails, SQLITE_NOMEM is returned and the page size remains unchanged. \r\n** In all other cases, SQLITE_OK is returned.\r\n**\r\n** If the page size is not changed, either because one of the enumerated\r\n** conditions above is not true, the pager was in error state when this\r\n** function was called, or because the memory allocation attempt failed, \r\n** then *pPageSize is set to the old, retained page size before returning.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){\r\n  int rc = SQLITE_OK;\r\n\r\n  /* It is not possible to do a full assert_pager_state() here, as this\r\n  ** function may be called from within PagerOpen(), before the state\r\n  ** of the Pager object is internally consistent.\r\n  **\r\n  ** At one point this function returned an error if the pager was in \r\n  ** PAGER_ERROR state. But since PAGER_ERROR state guarantees that\r\n  ** there is at least one outstanding page reference, this function\r\n  ** is a no-op for that case anyhow.\r\n  */\r\n\r\n  u32 pageSize = *pPageSize;\r\n  assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );\r\n  if( (pPager->memDb==0 || pPager->dbSize==0)\r\n   && sqlite3PcacheRefCount(pPager->pPCache)==0 \r\n   && pageSize && pageSize!=(u32)pPager->pageSize \r\n  ){\r\n    char *pNew = NULL;             /* New temp space */\r\n    i64 nByte = 0;\r\n\r\n    if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){\r\n      rc = sqlite3OsFileSize(pPager->fd, &nByte);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      pNew = (char *)sqlite3PageMalloc(pageSize);\r\n      if( !pNew ) rc = SQLITE_NOMEM;\r\n    }\r\n\r\n    if( rc==SQLITE_OK ){\r\n      pager_reset(pPager);\r\n      pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);\r\n      pPager->pageSize = pageSize;\r\n      sqlite3PageFree(pPager->pTmpSpace);\r\n      pPager->pTmpSpace = pNew;\r\n      sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);\r\n    }\r\n  }\r\n\r\n  *pPageSize = pPager->pageSize;\r\n  if( rc==SQLITE_OK ){\r\n    if( nReserve<0 ) nReserve = pPager->nReserve;\r\n    assert( nReserve>=0 && nReserve<1000 );\r\n    pPager->nReserve = (i16)nReserve;\r\n    pagerReportSize(pPager);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return a pointer to the \"temporary page\" buffer held internally\r\n** by the pager.  This is a buffer that is big enough to hold the\r\n** entire content of a database page.  This buffer is used internally\r\n** during rollback and will be overwritten whenever a rollback\r\n** occurs.  But other modules are free to use it too, as long as\r\n** no rollbacks are happening.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){\r\n  return pPager->pTmpSpace;\r\n}\r\n\r\n/*\r\n** Attempt to set the maximum database page count if mxPage is positive. \r\n** Make no changes if mxPage is zero or negative.  And never reduce the\r\n** maximum page count below the current size of the database.\r\n**\r\n** Regardless of mxPage, return the current maximum page count.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){\r\n  if( mxPage>0 ){\r\n    pPager->mxPgno = mxPage;\r\n  }\r\n  assert( pPager->eState!=PAGER_OPEN );      /* Called only by OP_MaxPgcnt */\r\n  assert( pPager->mxPgno>=pPager->dbSize );  /* OP_MaxPgcnt enforces this */\r\n  return pPager->mxPgno;\r\n}\r\n\r\n/*\r\n** The following set of routines are used to disable the simulated\r\n** I/O error mechanism.  These routines are used to avoid simulated\r\n** errors in places where we do not care about errors.\r\n**\r\n** Unless -DSQLITE_TEST=1 is used, these routines are all no-ops\r\n** and generate no code.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API extern int sqlite3_io_error_pending;\r\nSQLITE_API extern int sqlite3_io_error_hit;\r\nstatic int saved_cnt;\r\nvoid disable_simulated_io_errors(void){\r\n  saved_cnt = sqlite3_io_error_pending;\r\n  sqlite3_io_error_pending = -1;\r\n}\r\nvoid enable_simulated_io_errors(void){\r\n  sqlite3_io_error_pending = saved_cnt;\r\n}\r\n#else\r\n# define disable_simulated_io_errors()\r\n# define enable_simulated_io_errors()\r\n#endif\r\n\r\n/*\r\n** Read the first N bytes from the beginning of the file into memory\r\n** that pDest points to. \r\n**\r\n** If the pager was opened on a transient file (zFilename==\"\"), or\r\n** opened on a file less than N bytes in size, the output buffer is\r\n** zeroed and SQLITE_OK returned. The rationale for this is that this \r\n** function is used to read database headers, and a new transient or\r\n** zero sized database has a header than consists entirely of zeroes.\r\n**\r\n** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered,\r\n** the error code is returned to the caller and the contents of the\r\n** output buffer undefined.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){\r\n  int rc = SQLITE_OK;\r\n  memset(pDest, 0, N);\r\n  assert( isOpen(pPager->fd) || pPager->tempFile );\r\n\r\n  /* This routine is only called by btree immediately after creating\r\n  ** the Pager object.  There has not been an opportunity to transition\r\n  ** to WAL mode yet.\r\n  */\r\n  assert( !pagerUseWal(pPager) );\r\n\r\n  if( isOpen(pPager->fd) ){\r\n    IOTRACE((\"DBHDR %p 0 %d\\n\", pPager, N))\r\n    rc = sqlite3OsRead(pPager->fd, pDest, N, 0);\r\n    if( rc==SQLITE_IOERR_SHORT_READ ){\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function may only be called when a read-transaction is open on\r\n** the pager. It returns the total number of pages in the database.\r\n**\r\n** However, if the file is between 1 and <page-size> bytes in size, then \r\n** this is considered a 1 page file.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){\r\n  assert( pPager->eState>=PAGER_READER );\r\n  assert( pPager->eState!=PAGER_WRITER_FINISHED );\r\n  *pnPage = (int)pPager->dbSize;\r\n}\r\n\r\n\r\n/*\r\n** Try to obtain a lock of type locktype on the database file. If\r\n** a similar or greater lock is already held, this function is a no-op\r\n** (returning SQLITE_OK immediately).\r\n**\r\n** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke \r\n** the busy callback if the lock is currently not available. Repeat \r\n** until the busy callback returns false or until the attempt to \r\n** obtain the lock succeeds.\r\n**\r\n** Return SQLITE_OK on success and an error code if we cannot obtain\r\n** the lock. If the lock is obtained successfully, set the Pager.state \r\n** variable to locktype before returning.\r\n*/\r\nstatic int pager_wait_on_lock(Pager *pPager, int locktype){\r\n  int rc;                              /* Return code */\r\n\r\n  /* Check that this is either a no-op (because the requested lock is \r\n  ** already held, or one of the transistions that the busy-handler\r\n  ** may be invoked during, according to the comment above\r\n  ** sqlite3PagerSetBusyhandler().\r\n  */\r\n  assert( (pPager->eLock>=locktype)\r\n       || (pPager->eLock==NO_LOCK && locktype==SHARED_LOCK)\r\n       || (pPager->eLock==RESERVED_LOCK && locktype==EXCLUSIVE_LOCK)\r\n  );\r\n\r\n  do {\r\n    rc = pagerLockDb(pPager, locktype);\r\n  }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Function assertTruncateConstraint(pPager) checks that one of the \r\n** following is true for all dirty pages currently in the page-cache:\r\n**\r\n**   a) The page number is less than or equal to the size of the \r\n**      current database image, in pages, OR\r\n**\r\n**   b) if the page content were written at this time, it would not\r\n**      be necessary to write the current content out to the sub-journal\r\n**      (as determined by function subjRequiresPage()).\r\n**\r\n** If the condition asserted by this function were not true, and the\r\n** dirty page were to be discarded from the cache via the pagerStress()\r\n** routine, pagerStress() would not write the current page content to\r\n** the database file. If a savepoint transaction were rolled back after\r\n** this happened, the correct behaviour would be to restore the current\r\n** content of the page. However, since this content is not present in either\r\n** the database file or the portion of the rollback journal and \r\n** sub-journal rolled back the content could not be restored and the\r\n** database image would become corrupt. It is therefore fortunate that \r\n** this circumstance cannot arise.\r\n*/\r\n#if defined(SQLITE_DEBUG)\r\nstatic void assertTruncateConstraintCb(PgHdr *pPg){\r\n  assert( pPg->flags&PGHDR_DIRTY );\r\n  assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );\r\n}\r\nstatic void assertTruncateConstraint(Pager *pPager){\r\n  sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);\r\n}\r\n#else\r\n# define assertTruncateConstraint(pPager)\r\n#endif\r\n\r\n/*\r\n** Truncate the in-memory database file image to nPage pages. This \r\n** function does not actually modify the database file on disk. It \r\n** just sets the internal state of the pager object so that the \r\n** truncation will be done when the current transaction is committed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){\r\n  assert( pPager->dbSize>=nPage );\r\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD );\r\n  pPager->dbSize = nPage;\r\n  assertTruncateConstraint(pPager);\r\n}\r\n\r\n\r\n/*\r\n** This function is called before attempting a hot-journal rollback. It\r\n** syncs the journal file to disk, then sets pPager->journalHdr to the\r\n** size of the journal file so that the pager_playback() routine knows\r\n** that the entire journal file has been synced.\r\n**\r\n** Syncing a hot-journal to disk before attempting to roll it back ensures \r\n** that if a power-failure occurs during the rollback, the process that\r\n** attempts rollback following system recovery sees the same journal\r\n** content as this process.\r\n**\r\n** If everything goes as planned, SQLITE_OK is returned. Otherwise, \r\n** an SQLite error code.\r\n*/\r\nstatic int pagerSyncHotJournal(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n  if( !pPager->noSync ){\r\n    rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_NORMAL);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Shutdown the page cache.  Free all memory and close all files.\r\n**\r\n** If a transaction was in progress when this routine is called, that\r\n** transaction is rolled back.  All outstanding pages are invalidated\r\n** and their memory is freed.  Any attempt to use a page associated\r\n** with this page cache after this function returns will likely\r\n** result in a coredump.\r\n**\r\n** This function always succeeds. If a transaction is active an attempt\r\n** is made to roll it back. If an error occurs during the rollback \r\n** a hot journal may be left in the filesystem but no error is returned\r\n** to the caller.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){\r\n  u8 *pTmp = (u8 *)pPager->pTmpSpace;\r\n\r\n  assert( assert_pager_state(pPager) );\r\n  disable_simulated_io_errors();\r\n  sqlite3BeginBenignMalloc();\r\n  /* pPager->errCode = 0; */\r\n  pPager->exclusiveMode = 0;\r\n#ifndef SQLITE_OMIT_WAL\r\n  sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp);\r\n  pPager->pWal = 0;\r\n#endif\r\n  pager_reset(pPager);\r\n  if( MEMDB ){\r\n    pager_unlock(pPager);\r\n  }else{\r\n    /* If it is open, sync the journal file before calling UnlockAndRollback.\r\n    ** If this is not done, then an unsynced portion of the open journal \r\n    ** file may be played back into the database. If a power failure occurs \r\n    ** while this is happening, the database could become corrupt.\r\n    **\r\n    ** If an error occurs while trying to sync the journal, shift the pager\r\n    ** into the ERROR state. This causes UnlockAndRollback to unlock the\r\n    ** database and close the journal file without attempting to roll it\r\n    ** back or finalize it. The next database user will have to do hot-journal\r\n    ** rollback before accessing the database file.\r\n    */\r\n    if( isOpen(pPager->jfd) ){\r\n      pager_error(pPager, pagerSyncHotJournal(pPager));\r\n    }\r\n    pagerUnlockAndRollback(pPager);\r\n  }\r\n  sqlite3EndBenignMalloc();\r\n  enable_simulated_io_errors();\r\n  PAGERTRACE((\"CLOSE %d\\n\", PAGERID(pPager)));\r\n  IOTRACE((\"CLOSE %p\\n\", pPager))\r\n  sqlite3OsClose(pPager->jfd);\r\n  sqlite3OsClose(pPager->fd);\r\n  sqlite3PageFree(pTmp);\r\n  sqlite3PcacheClose(pPager->pPCache);\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);\r\n#endif\r\n\r\n  assert( !pPager->aSavepoint && !pPager->pInJournal );\r\n  assert( !isOpen(pPager->jfd) && !isOpen(pPager->sjfd) );\r\n\r\n  sqlite3_free(pPager);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#if !defined(NDEBUG) || defined(SQLITE_TEST)\r\n/*\r\n** Return the page number for page pPg.\r\n*/\r\nSQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){\r\n  return pPg->pgno;\r\n}\r\n#endif\r\n\r\n/*\r\n** Increment the reference count for page pPg.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerRef(DbPage *pPg){\r\n  sqlite3PcacheRef(pPg);\r\n}\r\n\r\n/*\r\n** Sync the journal. In other words, make sure all the pages that have\r\n** been written to the journal have actually reached the surface of the\r\n** disk and can be restored in the event of a hot-journal rollback.\r\n**\r\n** If the Pager.noSync flag is set, then this function is a no-op.\r\n** Otherwise, the actions required depend on the journal-mode and the \r\n** device characteristics of the the file-system, as follows:\r\n**\r\n**   * If the journal file is an in-memory journal file, no action need\r\n**     be taken.\r\n**\r\n**   * Otherwise, if the device does not support the SAFE_APPEND property,\r\n**     then the nRec field of the most recently written journal header\r\n**     is updated to contain the number of journal records that have\r\n**     been written following it. If the pager is operating in full-sync\r\n**     mode, then the journal file is synced before this field is updated.\r\n**\r\n**   * If the device does not support the SEQUENTIAL property, then \r\n**     journal file is synced.\r\n**\r\n** Or, in pseudo-code:\r\n**\r\n**   if( NOT <in-memory journal> ){\r\n**     if( NOT SAFE_APPEND ){\r\n**       if( <full-sync mode> ) xSync(<journal file>);\r\n**       <update nRec field>\r\n**     } \r\n**     if( NOT SEQUENTIAL ) xSync(<journal file>);\r\n**   }\r\n**\r\n** If successful, this routine clears the PGHDR_NEED_SYNC flag of every \r\n** page currently held in memory before returning SQLITE_OK. If an IO\r\n** error is encountered, then the IO error code is returned to the caller.\r\n*/\r\nstatic int syncJournal(Pager *pPager, int newHdr){\r\n  int rc;                         /* Return code */\r\n\r\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD\r\n       || pPager->eState==PAGER_WRITER_DBMOD\r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n  assert( !pagerUseWal(pPager) );\r\n\r\n  rc = sqlite3PagerExclusiveLock(pPager);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  if( !pPager->noSync ){\r\n    assert( !pPager->tempFile );\r\n    if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){\r\n      const int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);\r\n      assert( isOpen(pPager->jfd) );\r\n\r\n      if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){\r\n        /* This block deals with an obscure problem. If the last connection\r\n        ** that wrote to this database was operating in persistent-journal\r\n        ** mode, then the journal file may at this point actually be larger\r\n        ** than Pager.journalOff bytes. If the next thing in the journal\r\n        ** file happens to be a journal-header (written as part of the\r\n        ** previous connection's transaction), and a crash or power-failure \r\n        ** occurs after nRec is updated but before this connection writes \r\n        ** anything else to the journal file (or commits/rolls back its \r\n        ** transaction), then SQLite may become confused when doing the \r\n        ** hot-journal rollback following recovery. It may roll back all\r\n        ** of this connections data, then proceed to rolling back the old,\r\n        ** out-of-date data that follows it. Database corruption.\r\n        **\r\n        ** To work around this, if the journal file does appear to contain\r\n        ** a valid header following Pager.journalOff, then write a 0x00\r\n        ** byte to the start of it to prevent it from being recognized.\r\n        **\r\n        ** Variable iNextHdrOffset is set to the offset at which this\r\n        ** problematic header will occur, if it exists. aMagic is used \r\n        ** as a temporary buffer to inspect the first couple of bytes of\r\n        ** the potential journal header.\r\n        */\r\n        i64 iNextHdrOffset;\r\n        u8 aMagic[8];\r\n        u8 zHeader[sizeof(aJournalMagic)+4];\r\n\r\n        memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));\r\n        put32bits(&zHeader[sizeof(aJournalMagic)], pPager->nRec);\r\n\r\n        iNextHdrOffset = journalHdrOffset(pPager);\r\n        rc = sqlite3OsRead(pPager->jfd, aMagic, 8, iNextHdrOffset);\r\n        if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){\r\n          static const u8 zerobyte = 0;\r\n          rc = sqlite3OsWrite(pPager->jfd, &zerobyte, 1, iNextHdrOffset);\r\n        }\r\n        if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){\r\n          return rc;\r\n        }\r\n\r\n        /* Write the nRec value into the journal file header. If in\r\n        ** full-synchronous mode, sync the journal first. This ensures that\r\n        ** all data has really hit the disk before nRec is updated to mark\r\n        ** it as a candidate for rollback.\r\n        **\r\n        ** This is not required if the persistent media supports the\r\n        ** SAFE_APPEND property. Because in this case it is not possible \r\n        ** for garbage data to be appended to the file, the nRec field\r\n        ** is populated with 0xFFFFFFFF when the journal header is written\r\n        ** and never needs to be updated.\r\n        */\r\n        if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){\r\n          PAGERTRACE((\"SYNC journal of %d\\n\", PAGERID(pPager)));\r\n          IOTRACE((\"JSYNC %p\\n\", pPager))\r\n          rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);\r\n          if( rc!=SQLITE_OK ) return rc;\r\n        }\r\n        IOTRACE((\"JHDR %p %lld\\n\", pPager, pPager->journalHdr));\r\n        rc = sqlite3OsWrite(\r\n            pPager->jfd, zHeader, sizeof(zHeader), pPager->journalHdr\r\n        );\r\n        if( rc!=SQLITE_OK ) return rc;\r\n      }\r\n      if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){\r\n        PAGERTRACE((\"SYNC journal of %d\\n\", PAGERID(pPager)));\r\n        IOTRACE((\"JSYNC %p\\n\", pPager))\r\n        rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags| \r\n          (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)\r\n        );\r\n        if( rc!=SQLITE_OK ) return rc;\r\n      }\r\n\r\n      pPager->journalHdr = pPager->journalOff;\r\n      if( newHdr && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){\r\n        pPager->nRec = 0;\r\n        rc = writeJournalHdr(pPager);\r\n        if( rc!=SQLITE_OK ) return rc;\r\n      }\r\n    }else{\r\n      pPager->journalHdr = pPager->journalOff;\r\n    }\r\n  }\r\n\r\n  /* Unless the pager is in noSync mode, the journal file was just \r\n  ** successfully synced. Either way, clear the PGHDR_NEED_SYNC flag on \r\n  ** all pages.\r\n  */\r\n  sqlite3PcacheClearSyncFlags(pPager->pPCache);\r\n  pPager->eState = PAGER_WRITER_DBMOD;\r\n  assert( assert_pager_state(pPager) );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The argument is the first in a linked list of dirty pages connected\r\n** by the PgHdr.pDirty pointer. This function writes each one of the\r\n** in-memory pages in the list to the database file. The argument may\r\n** be NULL, representing an empty list. In this case this function is\r\n** a no-op.\r\n**\r\n** The pager must hold at least a RESERVED lock when this function\r\n** is called. Before writing anything to the database file, this lock\r\n** is upgraded to an EXCLUSIVE lock. If the lock cannot be obtained,\r\n** SQLITE_BUSY is returned and no data is written to the database file.\r\n** \r\n** If the pager is a temp-file pager and the actual file-system file\r\n** is not yet open, it is created and opened before any data is \r\n** written out.\r\n**\r\n** Once the lock has been upgraded and, if necessary, the file opened,\r\n** the pages are written out to the database file in list order. Writing\r\n** a page is skipped if it meets either of the following criteria:\r\n**\r\n**   * The page number is greater than Pager.dbSize, or\r\n**   * The PGHDR_DONT_WRITE flag is set on the page.\r\n**\r\n** If writing out a page causes the database file to grow, Pager.dbFileSize\r\n** is updated accordingly. If page 1 is written out, then the value cached\r\n** in Pager.dbFileVers[] is updated to match the new value stored in\r\n** the database file.\r\n**\r\n** If everything is successful, SQLITE_OK is returned. If an IO error \r\n** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot\r\n** be obtained, SQLITE_BUSY is returned.\r\n*/\r\nstatic int pager_write_pagelist(Pager *pPager, PgHdr *pList){\r\n  int rc = SQLITE_OK;                  /* Return code */\r\n\r\n  /* This function is only called for rollback pagers in WRITER_DBMOD state. */\r\n  assert( !pagerUseWal(pPager) );\r\n  assert( pPager->eState==PAGER_WRITER_DBMOD );\r\n  assert( pPager->eLock==EXCLUSIVE_LOCK );\r\n\r\n  /* If the file is a temp-file has not yet been opened, open it now. It\r\n  ** is not possible for rc to be other than SQLITE_OK if this branch\r\n  ** is taken, as pager_wait_on_lock() is a no-op for temp-files.\r\n  */\r\n  if( !isOpen(pPager->fd) ){\r\n    assert( pPager->tempFile && rc==SQLITE_OK );\r\n    rc = pagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);\r\n  }\r\n\r\n  /* Before the first write, give the VFS a hint of what the final\r\n  ** file size will be.\r\n  */\r\n  assert( rc!=SQLITE_OK || isOpen(pPager->fd) );\r\n  if( rc==SQLITE_OK && pPager->dbSize>pPager->dbHintSize ){\r\n    sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize;\r\n    sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);\r\n    pPager->dbHintSize = pPager->dbSize;\r\n  }\r\n\r\n  while( rc==SQLITE_OK && pList ){\r\n    Pgno pgno = pList->pgno;\r\n\r\n    /* If there are dirty pages in the page cache with page numbers greater\r\n    ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to\r\n    ** make the file smaller (presumably by auto-vacuum code). Do not write\r\n    ** any such pages to the file.\r\n    **\r\n    ** Also, do not write out any page that has the PGHDR_DONT_WRITE flag\r\n    ** set (set by sqlite3PagerDontWrite()).\r\n    */\r\n    if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){\r\n      i64 offset = (pgno-1)*(i64)pPager->pageSize;   /* Offset to write */\r\n      char *pData;                                   /* Data to write */    \r\n\r\n      assert( (pList->flags&PGHDR_NEED_SYNC)==0 );\r\n      if( pList->pgno==1 ) pager_write_changecounter(pList);\r\n\r\n      /* Encode the database */\r\n      CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);\r\n\r\n      /* Write out the page data. */\r\n      rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);\r\n\r\n      /* If page 1 was just written, update Pager.dbFileVers to match\r\n      ** the value now stored in the database file. If writing this \r\n      ** page caused the database file to grow, update dbFileSize. \r\n      */\r\n      if( pgno==1 ){\r\n        memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers));\r\n      }\r\n      if( pgno>pPager->dbFileSize ){\r\n        pPager->dbFileSize = pgno;\r\n      }\r\n\r\n      /* Update any backup objects copying the contents of this pager. */\r\n      sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData);\r\n\r\n      PAGERTRACE((\"STORE %d page %d hash(%08x)\\n\",\r\n                   PAGERID(pPager), pgno, pager_pagehash(pList)));\r\n      IOTRACE((\"PGOUT %p %d\\n\", pPager, pgno));\r\n      PAGER_INCR(sqlite3_pager_writedb_count);\r\n      PAGER_INCR(pPager->nWrite);\r\n    }else{\r\n      PAGERTRACE((\"NOSTORE %d page %d\\n\", PAGERID(pPager), pgno));\r\n    }\r\n    pager_set_pagehash(pList);\r\n    pList = pList->pDirty;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Ensure that the sub-journal file is open. If it is already open, this \r\n** function is a no-op.\r\n**\r\n** SQLITE_OK is returned if everything goes according to plan. An \r\n** SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen() \r\n** fails.\r\n*/\r\nstatic int openSubJournal(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n  if( !isOpen(pPager->sjfd) ){\r\n    if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){\r\n      sqlite3MemJournalOpen(pPager->sjfd);\r\n    }else{\r\n      rc = pagerOpentemp(pPager, pPager->sjfd, SQLITE_OPEN_SUBJOURNAL);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Append a record of the current state of page pPg to the sub-journal. \r\n** It is the callers responsibility to use subjRequiresPage() to check \r\n** that it is really required before calling this function.\r\n**\r\n** If successful, set the bit corresponding to pPg->pgno in the bitvecs\r\n** for all open savepoints before returning.\r\n**\r\n** This function returns SQLITE_OK if everything is successful, an IO\r\n** error code if the attempt to write to the sub-journal fails, or \r\n** SQLITE_NOMEM if a malloc fails while setting a bit in a savepoint\r\n** bitvec.\r\n*/\r\nstatic int subjournalPage(PgHdr *pPg){\r\n  int rc = SQLITE_OK;\r\n  Pager *pPager = pPg->pPager;\r\n  if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){\r\n\r\n    /* Open the sub-journal, if it has not already been opened */\r\n    assert( pPager->useJournal );\r\n    assert( isOpen(pPager->jfd) || pagerUseWal(pPager) );\r\n    assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 );\r\n    assert( pagerUseWal(pPager) \r\n         || pageInJournal(pPg) \r\n         || pPg->pgno>pPager->dbOrigSize \r\n    );\r\n    rc = openSubJournal(pPager);\r\n\r\n    /* If the sub-journal was opened successfully (or was already open),\r\n    ** write the journal record into the file.  */\r\n    if( rc==SQLITE_OK ){\r\n      void *pData = pPg->pData;\r\n      i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);\r\n      char *pData2;\r\n  \r\n      CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);\r\n      PAGERTRACE((\"STMT-JOURNAL %d page %d\\n\", PAGERID(pPager), pPg->pgno));\r\n      rc = write32bits(pPager->sjfd, offset, pPg->pgno);\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);\r\n      }\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    pPager->nSubRec++;\r\n    assert( pPager->nSavepoint>0 );\r\n    rc = addToSavepointBitvecs(pPager, pPg->pgno);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called by the pcache layer when it has reached some\r\n** soft memory limit. The first argument is a pointer to a Pager object\r\n** (cast as a void*). The pager is always 'purgeable' (not an in-memory\r\n** database). The second argument is a reference to a page that is \r\n** currently dirty but has no outstanding references. The page\r\n** is always associated with the Pager object passed as the first \r\n** argument.\r\n**\r\n** The job of this function is to make pPg clean by writing its contents\r\n** out to the database file, if possible. This may involve syncing the\r\n** journal file. \r\n**\r\n** If successful, sqlite3PcacheMakeClean() is called on the page and\r\n** SQLITE_OK returned. If an IO error occurs while trying to make the\r\n** page clean, the IO error code is returned. If the page cannot be\r\n** made clean for some other reason, but no error occurs, then SQLITE_OK\r\n** is returned by sqlite3PcacheMakeClean() is not called.\r\n*/\r\nstatic int pagerStress(void *p, PgHdr *pPg){\r\n  Pager *pPager = (Pager *)p;\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pPg->pPager==pPager );\r\n  assert( pPg->flags&PGHDR_DIRTY );\r\n\r\n  /* The doNotSyncSpill flag is set during times when doing a sync of\r\n  ** journal (and adding a new header) is not allowed.  This occurs\r\n  ** during calls to sqlite3PagerWrite() while trying to journal multiple\r\n  ** pages belonging to the same sector.\r\n  **\r\n  ** The doNotSpill flag inhibits all cache spilling regardless of whether\r\n  ** or not a sync is required.  This is set during a rollback.\r\n  **\r\n  ** Spilling is also prohibited when in an error state since that could\r\n  ** lead to database corruption.   In the current implementaton it \r\n  ** is impossible for sqlite3PcacheFetch() to be called with createFlag==1\r\n  ** while in the error state, hence it is impossible for this routine to\r\n  ** be called in the error state.  Nevertheless, we include a NEVER()\r\n  ** test for the error state as a safeguard against future changes.\r\n  */\r\n  if( NEVER(pPager->errCode) ) return SQLITE_OK;\r\n  if( pPager->doNotSpill ) return SQLITE_OK;\r\n  if( pPager->doNotSyncSpill && (pPg->flags & PGHDR_NEED_SYNC)!=0 ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  pPg->pDirty = 0;\r\n  if( pagerUseWal(pPager) ){\r\n    /* Write a single frame for this page to the log. */\r\n    if( subjRequiresPage(pPg) ){ \r\n      rc = subjournalPage(pPg); \r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      rc = pagerWalFrames(pPager, pPg, 0, 0);\r\n    }\r\n  }else{\r\n  \r\n    /* Sync the journal file if required. */\r\n    if( pPg->flags&PGHDR_NEED_SYNC \r\n     || pPager->eState==PAGER_WRITER_CACHEMOD\r\n    ){\r\n      rc = syncJournal(pPager, 1);\r\n    }\r\n  \r\n    /* If the page number of this page is larger than the current size of\r\n    ** the database image, it may need to be written to the sub-journal.\r\n    ** This is because the call to pager_write_pagelist() below will not\r\n    ** actually write data to the file in this case.\r\n    **\r\n    ** Consider the following sequence of events:\r\n    **\r\n    **   BEGIN;\r\n    **     <journal page X>\r\n    **     <modify page X>\r\n    **     SAVEPOINT sp;\r\n    **       <shrink database file to Y pages>\r\n    **       pagerStress(page X)\r\n    **     ROLLBACK TO sp;\r\n    **\r\n    ** If (X>Y), then when pagerStress is called page X will not be written\r\n    ** out to the database file, but will be dropped from the cache. Then,\r\n    ** following the \"ROLLBACK TO sp\" statement, reading page X will read\r\n    ** data from the database file. This will be the copy of page X as it\r\n    ** was when the transaction started, not as it was when \"SAVEPOINT sp\"\r\n    ** was executed.\r\n    **\r\n    ** The solution is to write the current data for page X into the \r\n    ** sub-journal file now (if it is not already there), so that it will\r\n    ** be restored to its current value when the \"ROLLBACK TO sp\" is \r\n    ** executed.\r\n    */\r\n    if( NEVER(\r\n        rc==SQLITE_OK && pPg->pgno>pPager->dbSize && subjRequiresPage(pPg)\r\n    ) ){\r\n      rc = subjournalPage(pPg);\r\n    }\r\n  \r\n    /* Write the contents of the page out to the database file. */\r\n    if( rc==SQLITE_OK ){\r\n      assert( (pPg->flags&PGHDR_NEED_SYNC)==0 );\r\n      rc = pager_write_pagelist(pPager, pPg);\r\n    }\r\n  }\r\n\r\n  /* Mark the page as clean. */\r\n  if( rc==SQLITE_OK ){\r\n    PAGERTRACE((\"STRESS %d page %d\\n\", PAGERID(pPager), pPg->pgno));\r\n    sqlite3PcacheMakeClean(pPg);\r\n  }\r\n\r\n  return pager_error(pPager, rc); \r\n}\r\n\r\n\r\n/*\r\n** Allocate and initialize a new Pager object and put a pointer to it\r\n** in *ppPager. The pager should eventually be freed by passing it\r\n** to sqlite3PagerClose().\r\n**\r\n** The zFilename argument is the path to the database file to open.\r\n** If zFilename is NULL then a randomly-named temporary file is created\r\n** and used as the file to be cached. Temporary files are be deleted\r\n** automatically when they are closed. If zFilename is \":memory:\" then \r\n** all information is held in cache. It is never written to disk. \r\n** This can be used to implement an in-memory database.\r\n**\r\n** The nExtra parameter specifies the number of bytes of space allocated\r\n** along with each page reference. This space is available to the user\r\n** via the sqlite3PagerGetExtra() API.\r\n**\r\n** The flags argument is used to specify properties that affect the\r\n** operation of the pager. It should be passed some bitwise combination\r\n** of the PAGER_* flags.\r\n**\r\n** The vfsFlags parameter is a bitmask to pass to the flags parameter\r\n** of the xOpen() method of the supplied VFS when opening files. \r\n**\r\n** If the pager object is allocated and the specified file opened \r\n** successfully, SQLITE_OK is returned and *ppPager set to point to\r\n** the new pager object. If an error occurs, *ppPager is set to NULL\r\n** and error code returned. This function may return SQLITE_NOMEM\r\n** (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or \r\n** various SQLITE_IO_XXX errors.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerOpen(\r\n  sqlite3_vfs *pVfs,       /* The virtual file system to use */\r\n  Pager **ppPager,         /* OUT: Return the Pager structure here */\r\n  const char *zFilename,   /* Name of the database file to open */\r\n  int nExtra,              /* Extra bytes append to each in-memory page */\r\n  int flags,               /* flags controlling this file */\r\n  int vfsFlags,            /* flags passed through to sqlite3_vfs.xOpen() */\r\n  void (*xReinit)(DbPage*) /* Function to reinitialize pages */\r\n){\r\n  u8 *pPtr;\r\n  Pager *pPager = 0;       /* Pager object to allocate and return */\r\n  int rc = SQLITE_OK;      /* Return code */\r\n  int tempFile = 0;        /* True for temp files (incl. in-memory files) */\r\n  int memDb = 0;           /* True if this is an in-memory file */\r\n  int readOnly = 0;        /* True if this is a read-only file */\r\n  int journalFileSize;     /* Bytes to allocate for each journal fd */\r\n  char *zPathname = 0;     /* Full path to database file */\r\n  int nPathname = 0;       /* Number of bytes in zPathname */\r\n  int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */\r\n  int pcacheSize = sqlite3PcacheSize();       /* Bytes to allocate for PCache */\r\n  u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE;  /* Default page size */\r\n  const char *zUri = 0;    /* URI args to copy */\r\n  int nUri = 0;            /* Number of bytes of URI args at *zUri */\r\n\r\n  /* Figure out how much space is required for each journal file-handle\r\n  ** (there are two of them, the main journal and the sub-journal). This\r\n  ** is the maximum space required for an in-memory journal file handle \r\n  ** and a regular journal file-handle. Note that a \"regular journal-handle\"\r\n  ** may be a wrapper capable of caching the first portion of the journal\r\n  ** file in memory to implement the atomic-write optimization (see \r\n  ** source file journal.c).\r\n  */\r\n  if( sqlite3JournalSize(pVfs)>sqlite3MemJournalSize() ){\r\n    journalFileSize = ROUND8(sqlite3JournalSize(pVfs));\r\n  }else{\r\n    journalFileSize = ROUND8(sqlite3MemJournalSize());\r\n  }\r\n\r\n  /* Set the output variable to NULL in case an error occurs. */\r\n  *ppPager = 0;\r\n\r\n#ifndef SQLITE_OMIT_MEMORYDB\r\n  if( flags & PAGER_MEMORY ){\r\n    memDb = 1;\r\n    zFilename = 0;\r\n  }\r\n#endif\r\n\r\n  /* Compute and store the full pathname in an allocated buffer pointed\r\n  ** to by zPathname, length nPathname. Or, if this is a temporary file,\r\n  ** leave both nPathname and zPathname set to 0.\r\n  */\r\n  if( zFilename && zFilename[0] ){\r\n    const char *z;\r\n    nPathname = pVfs->mxPathname+1;\r\n    zPathname = sqlite3Malloc(nPathname*2);\r\n    if( zPathname==0 ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */\r\n    rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);\r\n    nPathname = sqlite3Strlen30(zPathname);\r\n    z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1];\r\n    while( *z ){\r\n      z += sqlite3Strlen30(z)+1;\r\n      z += sqlite3Strlen30(z)+1;\r\n    }\r\n    nUri = (int)(&z[1] - zUri);\r\n    assert( nUri>=0 );\r\n    if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){\r\n      /* This branch is taken when the journal path required by\r\n      ** the database being opened will be more than pVfs->mxPathname\r\n      ** bytes in length. This means the database cannot be opened,\r\n      ** as it will not be possible to open the journal file or even\r\n      ** check for a hot-journal before reading.\r\n      */\r\n      rc = SQLITE_CANTOPEN_BKPT;\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3_free(zPathname);\r\n      return rc;\r\n    }\r\n  }\r\n\r\n  /* Allocate memory for the Pager structure, PCache object, the\r\n  ** three file descriptors, the database file name and the journal \r\n  ** file name. The layout in memory is as follows:\r\n  **\r\n  **     Pager object                    (sizeof(Pager) bytes)\r\n  **     PCache object                   (sqlite3PcacheSize() bytes)\r\n  **     Database file handle            (pVfs->szOsFile bytes)\r\n  **     Sub-journal file handle         (journalFileSize bytes)\r\n  **     Main journal file handle        (journalFileSize bytes)\r\n  **     Database file name              (nPathname+1 bytes)\r\n  **     Journal file name               (nPathname+8+1 bytes)\r\n  */\r\n  pPtr = (u8 *)sqlite3MallocZero(\r\n    ROUND8(sizeof(*pPager)) +      /* Pager structure */\r\n    ROUND8(pcacheSize) +           /* PCache object */\r\n    ROUND8(pVfs->szOsFile) +       /* The main db file */\r\n    journalFileSize * 2 +          /* The two journal files */ \r\n    nPathname + 1 + nUri +         /* zFilename */\r\n    nPathname + 8 + 2              /* zJournal */\r\n#ifndef SQLITE_OMIT_WAL\r\n    + nPathname + 4 + 2            /* zWal */\r\n#endif\r\n  );\r\n  assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );\r\n  if( !pPtr ){\r\n    sqlite3_free(zPathname);\r\n    return SQLITE_NOMEM;\r\n  }\r\n  pPager =              (Pager*)(pPtr);\r\n  pPager->pPCache =    (PCache*)(pPtr += ROUND8(sizeof(*pPager)));\r\n  pPager->fd =   (sqlite3_file*)(pPtr += ROUND8(pcacheSize));\r\n  pPager->sjfd = (sqlite3_file*)(pPtr += ROUND8(pVfs->szOsFile));\r\n  pPager->jfd =  (sqlite3_file*)(pPtr += journalFileSize);\r\n  pPager->zFilename =    (char*)(pPtr += journalFileSize);\r\n  assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) );\r\n\r\n  /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */\r\n  if( zPathname ){\r\n    assert( nPathname>0 );\r\n    pPager->zJournal =   (char*)(pPtr += nPathname + 1 + nUri);\r\n    memcpy(pPager->zFilename, zPathname, nPathname);\r\n    memcpy(&pPager->zFilename[nPathname+1], zUri, nUri);\r\n    memcpy(pPager->zJournal, zPathname, nPathname);\r\n    memcpy(&pPager->zJournal[nPathname], \"-journal\\000\", 8+1);\r\n    sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal);\r\n#ifndef SQLITE_OMIT_WAL\r\n    pPager->zWal = &pPager->zJournal[nPathname+8+1];\r\n    memcpy(pPager->zWal, zPathname, nPathname);\r\n    memcpy(&pPager->zWal[nPathname], \"-wal\\000\", 4+1);\r\n    sqlite3FileSuffix3(pPager->zFilename, pPager->zWal);\r\n#endif\r\n    sqlite3_free(zPathname);\r\n  }\r\n  pPager->pVfs = pVfs;\r\n  pPager->vfsFlags = vfsFlags;\r\n\r\n  /* Open the pager file.\r\n  */\r\n  if( zFilename && zFilename[0] ){\r\n    int fout = 0;                    /* VFS flags returned by xOpen() */\r\n    rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout);\r\n    assert( !memDb );\r\n    readOnly = (fout&SQLITE_OPEN_READONLY);\r\n\r\n    /* If the file was successfully opened for read/write access,\r\n    ** choose a default page size in case we have to create the\r\n    ** database file. The default page size is the maximum of:\r\n    **\r\n    **    + SQLITE_DEFAULT_PAGE_SIZE,\r\n    **    + The value returned by sqlite3OsSectorSize()\r\n    **    + The largest page size that can be written atomically.\r\n    */\r\n    if( rc==SQLITE_OK && !readOnly ){\r\n      setSectorSize(pPager);\r\n      assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE);\r\n      if( szPageDflt<pPager->sectorSize ){\r\n        if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){\r\n          szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE;\r\n        }else{\r\n          szPageDflt = (u32)pPager->sectorSize;\r\n        }\r\n      }\r\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\n      {\r\n        int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);\r\n        int ii;\r\n        assert(SQLITE_IOCAP_ATOMIC512==(512>>8));\r\n        assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));\r\n        assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536);\r\n        for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){\r\n          if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ){\r\n            szPageDflt = ii;\r\n          }\r\n        }\r\n      }\r\n#endif\r\n    }\r\n  }else{\r\n    /* If a temporary file is requested, it is not opened immediately.\r\n    ** In this case we accept the default page size and delay actually\r\n    ** opening the file until the first call to OsWrite().\r\n    **\r\n    ** This branch is also run for an in-memory database. An in-memory\r\n    ** database is the same as a temp-file that is never written out to\r\n    ** disk and uses an in-memory rollback journal.\r\n    */ \r\n    tempFile = 1;\r\n    pPager->eState = PAGER_READER;\r\n    pPager->eLock = EXCLUSIVE_LOCK;\r\n    readOnly = (vfsFlags&SQLITE_OPEN_READONLY);\r\n  }\r\n\r\n  /* The following call to PagerSetPagesize() serves to set the value of \r\n  ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer.\r\n  */\r\n  if( rc==SQLITE_OK ){\r\n    assert( pPager->memDb==0 );\r\n    rc = sqlite3PagerSetPagesize(pPager, &szPageDflt, -1);\r\n    testcase( rc!=SQLITE_OK );\r\n  }\r\n\r\n  /* If an error occurred in either of the blocks above, free the \r\n  ** Pager structure and close the file.\r\n  */\r\n  if( rc!=SQLITE_OK ){\r\n    assert( !pPager->pTmpSpace );\r\n    sqlite3OsClose(pPager->fd);\r\n    sqlite3_free(pPager);\r\n    return rc;\r\n  }\r\n\r\n  /* Initialize the PCache object. */\r\n  assert( nExtra<1000 );\r\n  nExtra = ROUND8(nExtra);\r\n  sqlite3PcacheOpen(szPageDflt, nExtra, !memDb,\r\n                    !memDb?pagerStress:0, (void *)pPager, pPager->pPCache);\r\n\r\n  PAGERTRACE((\"OPEN %d %s\\n\", FILEHANDLEID(pPager->fd), pPager->zFilename));\r\n  IOTRACE((\"OPEN %p %s\\n\", pPager, pPager->zFilename))\r\n\r\n  pPager->useJournal = (u8)useJournal;\r\n  /* pPager->stmtOpen = 0; */\r\n  /* pPager->stmtInUse = 0; */\r\n  /* pPager->nRef = 0; */\r\n  /* pPager->stmtSize = 0; */\r\n  /* pPager->stmtJSize = 0; */\r\n  /* pPager->nPage = 0; */\r\n  pPager->mxPgno = SQLITE_MAX_PAGE_COUNT;\r\n  /* pPager->state = PAGER_UNLOCK; */\r\n#if 0\r\n  assert( pPager->state == (tempFile ? PAGER_EXCLUSIVE : PAGER_UNLOCK) );\r\n#endif\r\n  /* pPager->errMask = 0; */\r\n  pPager->tempFile = (u8)tempFile;\r\n  assert( tempFile==PAGER_LOCKINGMODE_NORMAL \r\n          || tempFile==PAGER_LOCKINGMODE_EXCLUSIVE );\r\n  assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 );\r\n  pPager->exclusiveMode = (u8)tempFile; \r\n  pPager->changeCountDone = pPager->tempFile;\r\n  pPager->memDb = (u8)memDb;\r\n  pPager->readOnly = (u8)readOnly;\r\n  assert( useJournal || pPager->tempFile );\r\n  pPager->noSync = pPager->tempFile;\r\n  if( pPager->noSync ){\r\n    assert( pPager->fullSync==0 );\r\n    assert( pPager->syncFlags==0 );\r\n    assert( pPager->walSyncFlags==0 );\r\n    assert( pPager->ckptSyncFlags==0 );\r\n  }else{\r\n    pPager->fullSync = 1;\r\n    pPager->syncFlags = SQLITE_SYNC_NORMAL;\r\n    pPager->walSyncFlags = SQLITE_SYNC_NORMAL | WAL_SYNC_TRANSACTIONS;\r\n    pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;\r\n  }\r\n  /* pPager->pFirst = 0; */\r\n  /* pPager->pFirstSynced = 0; */\r\n  /* pPager->pLast = 0; */\r\n  pPager->nExtra = (u16)nExtra;\r\n  pPager->journalSizeLimit = SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT;\r\n  assert( isOpen(pPager->fd) || tempFile );\r\n  setSectorSize(pPager);\r\n  if( !useJournal ){\r\n    pPager->journalMode = PAGER_JOURNALMODE_OFF;\r\n  }else if( memDb ){\r\n    pPager->journalMode = PAGER_JOURNALMODE_MEMORY;\r\n  }\r\n  /* pPager->xBusyHandler = 0; */\r\n  /* pPager->pBusyHandlerArg = 0; */\r\n  pPager->xReiniter = xReinit;\r\n  /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */\r\n\r\n  *ppPager = pPager;\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n\r\n/*\r\n** This function is called after transitioning from PAGER_UNLOCK to\r\n** PAGER_SHARED state. It tests if there is a hot journal present in\r\n** the file-system for the given pager. A hot journal is one that \r\n** needs to be played back. According to this function, a hot-journal\r\n** file exists if the following criteria are met:\r\n**\r\n**   * The journal file exists in the file system, and\r\n**   * No process holds a RESERVED or greater lock on the database file, and\r\n**   * The database file itself is greater than 0 bytes in size, and\r\n**   * The first byte of the journal file exists and is not 0x00.\r\n**\r\n** If the current size of the database file is 0 but a journal file\r\n** exists, that is probably an old journal left over from a prior\r\n** database with the same name. In this case the journal file is\r\n** just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK\r\n** is returned.\r\n**\r\n** This routine does not check if there is a master journal filename\r\n** at the end of the file. If there is, and that master journal file\r\n** does not exist, then the journal file is not really hot. In this\r\n** case this routine will return a false-positive. The pager_playback()\r\n** routine will discover that the journal file is not really hot and \r\n** will not roll it back. \r\n**\r\n** If a hot-journal file is found to exist, *pExists is set to 1 and \r\n** SQLITE_OK returned. If no hot-journal file is present, *pExists is\r\n** set to 0 and SQLITE_OK returned. If an IO error occurs while trying\r\n** to determine whether or not a hot-journal file exists, the IO error\r\n** code is returned and the value of *pExists is undefined.\r\n*/\r\nstatic int hasHotJournal(Pager *pPager, int *pExists){\r\n  int rc = SQLITE_OK;           /* Return code */\r\n  *pExists = 0;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called to obtain a shared lock on the database file.\r\n** It is illegal to call sqlite3PagerAcquire() until after this function\r\n** has been successfully called. If a shared-lock is already held when\r\n** this function is called, it is a no-op.\r\n**\r\n** The following operations are also performed by this function.\r\n**\r\n**   1) If the pager is currently in PAGER_OPEN state (no lock held\r\n**      on the database file), then an attempt is made to obtain a\r\n**      SHARED lock on the database file. Immediately after obtaining\r\n**      the SHARED lock, the file-system is checked for a hot-journal,\r\n**      which is played back if present. Following any hot-journal \r\n**      rollback, the contents of the cache are validated by checking\r\n**      the 'change-counter' field of the database file header and\r\n**      discarded if they are found to be invalid.\r\n**\r\n**   2) If the pager is running in exclusive-mode, and there are currently\r\n**      no outstanding references to any pages, and is in the error state,\r\n**      then an attempt is made to clear the error state by discarding\r\n**      the contents of the page cache and rolling back any open journal\r\n**      file.\r\n**\r\n** If everything is successful, SQLITE_OK is returned. If an IO error \r\n** occurs while locking the database, checking for a hot-journal file or \r\n** rolling back a journal file, the IO error code is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){\r\n  int rc = SQLITE_OK;                /* Return code */\r\n\r\n  /* This routine is only called from b-tree and only when there are no\r\n  ** outstanding pages. This implies that the pager state should either\r\n  ** be OPEN or READER. READER is only possible if the pager is or was in \r\n  ** exclusive access mode.\r\n  */\r\n  assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );\r\n  assert( assert_pager_state(pPager) );\r\n  assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );\r\n  if( NEVER(MEMDB && pPager->errCode) ){ return pPager->errCode; }\r\n\r\n  if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){\r\n    int bHotJournal = 1;          /* True if there exists a hot journal-file */\r\n\r\n    assert( !MEMDB );\r\n\r\n    rc = pager_wait_on_lock(pPager, SHARED_LOCK);\r\n    if( rc!=SQLITE_OK ){\r\n      assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );\r\n      goto failed;\r\n    }\r\n\r\n    /* If a journal file exists, and there is no RESERVED lock on the\r\n    ** database file, then it either needs to be played back or deleted.\r\n    */\r\n    if( pPager->eLock<=SHARED_LOCK ){\r\n      rc = hasHotJournal(pPager, &bHotJournal);\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      goto failed;\r\n    }\r\n    if( bHotJournal ){\r\n      /* Get an EXCLUSIVE lock on the database file. At this point it is\r\n      ** important that a RESERVED lock is not obtained on the way to the\r\n      ** EXCLUSIVE lock. If it were, another process might open the\r\n      ** database file, detect the RESERVED lock, and conclude that the\r\n      ** database is safe to read while this process is still rolling the \r\n      ** hot-journal back.\r\n      ** \r\n      ** Because the intermediate RESERVED lock is not requested, any\r\n      ** other process attempting to access the database file will get to \r\n      ** this point in the code and fail to obtain its own EXCLUSIVE lock \r\n      ** on the database file.\r\n      **\r\n      ** Unless the pager is in locking_mode=exclusive mode, the lock is\r\n      ** downgraded to SHARED_LOCK before this function returns.\r\n      */\r\n      rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);\r\n      if( rc!=SQLITE_OK ){\r\n        goto failed;\r\n      }\r\n \r\n      /* If it is not already open and the file exists on disk, open the \r\n      ** journal for read/write access. Write access is required because \r\n      ** in exclusive-access mode the file descriptor will be kept open \r\n      ** and possibly used for a transaction later on. Also, write-access \r\n      ** is usually required to finalize the journal in journal_mode=persist \r\n      ** mode (and also for journal_mode=truncate on some systems).\r\n      **\r\n      ** If the journal does not exist, it usually means that some \r\n      ** other connection managed to get in and roll it back before \r\n      ** this connection obtained the exclusive lock above. Or, it \r\n      ** may mean that the pager was in the error-state when this\r\n      ** function was called and the journal file does not exist.\r\n      */\r\n      if( !isOpen(pPager->jfd) ){\r\n        sqlite3_vfs * const pVfs = pPager->pVfs;\r\n        int bExists;              /* True if journal file exists */\r\n        rc = sqlite3OsAccess(\r\n            pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists);\r\n        if( rc==SQLITE_OK && bExists ){\r\n          int fout = 0;\r\n          int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL;\r\n          assert( !pPager->tempFile );\r\n          rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout);\r\n          assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );\r\n          if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){\r\n            rc = SQLITE_CANTOPEN_BKPT;\r\n            sqlite3OsClose(pPager->jfd);\r\n          }\r\n        }\r\n      }\r\n \r\n      /* Playback and delete the journal.  Drop the database write\r\n      ** lock and reacquire the read lock. Purge the cache before\r\n      ** playing back the hot-journal so that we don't end up with\r\n      ** an inconsistent cache.  Sync the hot journal before playing\r\n      ** it back since the process that crashed and left the hot journal\r\n      ** probably did not sync it and we are required to always sync\r\n      ** the journal before playing it back.\r\n      */\r\n      if( isOpen(pPager->jfd) ){\r\n        assert( rc==SQLITE_OK );\r\n        rc = pagerSyncHotJournal(pPager);\r\n        if( rc==SQLITE_OK ){\r\n          rc = pager_playback(pPager, 1);\r\n          pPager->eState = PAGER_OPEN;\r\n        }\r\n      }else if( !pPager->exclusiveMode ){\r\n        pagerUnlockDb(pPager, SHARED_LOCK);\r\n      }\r\n\r\n      if( rc!=SQLITE_OK ){\r\n        /* This branch is taken if an error occurs while trying to open\r\n        ** or roll back a hot-journal while holding an EXCLUSIVE lock. The\r\n        ** pager_unlock() routine will be called before returning to unlock\r\n        ** the file. If the unlock attempt fails, then Pager.eLock must be\r\n        ** set to UNKNOWN_LOCK (see the comment above the #define for \r\n        ** UNKNOWN_LOCK above for an explanation). \r\n        **\r\n        ** In order to get pager_unlock() to do this, set Pager.eState to\r\n        ** PAGER_ERROR now. This is not actually counted as a transition\r\n        ** to ERROR state in the state diagram at the top of this file,\r\n        ** since we know that the same call to pager_unlock() will very\r\n        ** shortly transition the pager object to the OPEN state. Calling\r\n        ** assert_pager_state() would fail now, as it should not be possible\r\n        ** to be in ERROR state when there are zero outstanding page \r\n        ** references.\r\n        */\r\n        pager_error(pPager, rc);\r\n        goto failed;\r\n      }\r\n\r\n      assert( pPager->eState==PAGER_OPEN );\r\n      assert( (pPager->eLock==SHARED_LOCK)\r\n           || (pPager->exclusiveMode && pPager->eLock>SHARED_LOCK)\r\n      );\r\n    }\r\n\r\n    if( !pPager->tempFile \r\n     && (pPager->pBackup || sqlite3PcachePagecount(pPager->pPCache)>0) \r\n    ){\r\n      /* The shared-lock has just been acquired on the database file\r\n      ** and there are already pages in the cache (from a previous\r\n      ** read or write transaction).  Check to see if the database\r\n      ** has been modified.  If the database has changed, flush the\r\n      ** cache.\r\n      **\r\n      ** Database changes is detected by looking at 15 bytes beginning\r\n      ** at offset 24 into the file.  The first 4 of these 16 bytes are\r\n      ** a 32-bit counter that is incremented with each change.  The\r\n      ** other bytes change randomly with each file change when\r\n      ** a codec is in use.\r\n      ** \r\n      ** There is a vanishingly small chance that a change will not be \r\n      ** detected.  The chance of an undetected change is so small that\r\n      ** it can be neglected.\r\n      */\r\n      Pgno nPage = 0;\r\n      char dbFileVers[sizeof(pPager->dbFileVers)];\r\n\r\n      rc = pagerPagecount(pPager, &nPage);\r\n      if( rc ) goto failed;\r\n\r\n      if( nPage>0 ){\r\n        IOTRACE((\"CKVERS %p %d\\n\", pPager, sizeof(dbFileVers)));\r\n        rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);\r\n        if( rc!=SQLITE_OK ){\r\n          goto failed;\r\n        }\r\n      }else{\r\n        memset(dbFileVers, 0, sizeof(dbFileVers));\r\n      }\r\n\r\n      if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){\r\n        pager_reset(pPager);\r\n      }\r\n    }\r\n\r\n    /* If there is a WAL file in the file-system, open this database in WAL\r\n    ** mode. Otherwise, the following function call is a no-op.\r\n    */\r\n    // rc = pagerOpenWalIfPresent(pPager);\r\n  }\r\n\r\n  /*if( pagerUseWal(pPager) ){\r\n    assert( rc==SQLITE_OK );\r\n    rc = pagerBeginReadTransaction(pPager);\r\n  }*/\r\n\r\n  if( pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){\r\n    rc = pagerPagecount(pPager, &pPager->dbSize);\r\n  }\r\n\r\n failed:\r\n  if( rc!=SQLITE_OK ){\r\n    assert( !MEMDB );\r\n    pager_unlock(pPager);\r\n    assert( pPager->eState==PAGER_OPEN );\r\n  }else{\r\n    pPager->eState = PAGER_READER;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If the reference count has reached zero, rollback any active\r\n** transaction and unlock the pager.\r\n**\r\n** Except, in locking_mode=EXCLUSIVE when there is nothing to in\r\n** the rollback journal, the unlock is not performed and there is\r\n** nothing to rollback, so this routine is a no-op.\r\n*/ \r\nstatic void pagerUnlockIfUnused(Pager *pPager){\r\n  if( (sqlite3PcacheRefCount(pPager->pPCache)==0) ){\r\n    pagerUnlockAndRollback(pPager);\r\n  }\r\n}\r\n\r\n/*\r\n** Acquire a reference to page number pgno in pager pPager (a page\r\n** reference has type DbPage*). If the requested reference is \r\n** successfully obtained, it is copied to *ppPage and SQLITE_OK returned.\r\n**\r\n** If the requested page is already in the cache, it is returned. \r\n** Otherwise, a new page object is allocated and populated with data\r\n** read from the database file. In some cases, the pcache module may\r\n** choose not to allocate a new page object and may reuse an existing\r\n** object with no outstanding references.\r\n**\r\n** The extra data appended to a page is always initialized to zeros the \r\n** first time a page is loaded into memory. If the page requested is \r\n** already in the cache when this function is called, then the extra\r\n** data is left as it was when the page object was last used.\r\n**\r\n** If the database image is smaller than the requested page or if a \r\n** non-zero value is passed as the noContent parameter and the \r\n** requested page is not already stored in the cache, then no \r\n** actual disk read occurs. In this case the memory image of the \r\n** page is initialized to all zeros. \r\n**\r\n** If noContent is true, it means that we do not care about the contents\r\n** of the page. This occurs in two seperate scenarios:\r\n**\r\n**   a) When reading a free-list leaf page from the database, and\r\n**\r\n**   b) When a savepoint is being rolled back and we need to load\r\n**      a new page into the cache to be filled with the data read\r\n**      from the savepoint journal.\r\n**\r\n** If noContent is true, then the data returned is zeroed instead of\r\n** being read from the database. Additionally, the bits corresponding\r\n** to pgno in Pager.pInJournal (bitvec of pages already written to the\r\n** journal file) and the PagerSavepoint.pInSavepoint bitvecs of any open\r\n** savepoints are set. This means if the page is made writable at any\r\n** point in the future, using a call to sqlite3PagerWrite(), its contents\r\n** will not be journaled. This saves IO.\r\n**\r\n** The acquisition might fail for several reasons.  In all cases,\r\n** an appropriate error code is returned and *ppPage is set to NULL.\r\n**\r\n** See also sqlite3PagerLookup().  Both this routine and Lookup() attempt\r\n** to find a page in the in-memory cache first.  If the page is not already\r\n** in memory, this routine goes to disk to read it in whereas Lookup()\r\n** just returns 0.  This routine acquires a read-lock the first time it\r\n** has to go to disk, and could also playback an old journal if necessary.\r\n** Since Lookup() never goes to disk, it never has to deal with locks\r\n** or journal files.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerAcquire(\r\n  Pager *pPager,      /* The pager open on the database file */\r\n  Pgno pgno,          /* Page number to fetch */\r\n  DbPage **ppPage,    /* Write a pointer to the page here */\r\n  int noContent       /* Do not bother reading content from disk if true */\r\n){\r\n  int rc;\r\n  PgHdr *pPg;\r\n\r\n  assert( pPager->eState>=PAGER_READER );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  if( pgno==0 ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n\r\n  /* If the pager is in the error state, return an error immediately. \r\n  ** Otherwise, request the page from the PCache layer. */\r\n  if( pPager->errCode!=SQLITE_OK ){\r\n    rc = pPager->errCode;\r\n  }else{\r\n    rc = sqlite3PcacheFetch(pPager->pPCache, pgno, 1, ppPage);\r\n  }\r\n\r\n  if( rc!=SQLITE_OK ){\r\n    /* Either the call to sqlite3PcacheFetch() returned an error or the\r\n    ** pager was already in the error-state when this function was called.\r\n    ** Set pPg to 0 and jump to the exception handler.  */\r\n    pPg = 0;\r\n    goto pager_acquire_err;\r\n  }\r\n  assert( (*ppPage)->pgno==pgno );\r\n  assert( (*ppPage)->pPager==pPager || (*ppPage)->pPager==0 );\r\n\r\n  if( (*ppPage)->pPager && !noContent ){\r\n    /* In this case the pcache already contains an initialized copy of\r\n    ** the page. Return without further ado.  */\r\n    assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) );\r\n    pPager->nHit++;\r\n    return SQLITE_OK;\r\n\r\n  }else{\r\n    /* The pager cache has created a new page. Its content needs to \r\n    ** be initialized.  */\r\n\r\n    pPg = *ppPage;\r\n    pPg->pPager = pPager;\r\n\r\n    /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page\r\n    ** number greater than this, or the unused locking-page, is requested. */\r\n    if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n      goto pager_acquire_err;\r\n    }\r\n\r\n    if( MEMDB || pPager->dbSize<pgno || noContent || !isOpen(pPager->fd) ){\r\n      if( pgno>pPager->mxPgno ){\r\n        rc = SQLITE_FULL;\r\n        goto pager_acquire_err;\r\n      }\r\n      if( noContent ){\r\n        /* Failure to set the bits in the InJournal bit-vectors is benign.\r\n        ** It merely means that we might do some extra work to journal a \r\n        ** page that does not need to be journaled.  Nevertheless, be sure \r\n        ** to test the case where a malloc error occurs while trying to set \r\n        ** a bit in a bit vector.\r\n        */\r\n        sqlite3BeginBenignMalloc();\r\n        if( pgno<=pPager->dbOrigSize ){\r\n          TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno);\r\n          testcase( rc==SQLITE_NOMEM );\r\n        }\r\n        TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno);\r\n        testcase( rc==SQLITE_NOMEM );\r\n        sqlite3EndBenignMalloc();\r\n      }\r\n      memset(pPg->pData, 0, pPager->pageSize);\r\n      IOTRACE((\"ZERO %p %d\\n\", pPager, pgno));\r\n    }else{\r\n      assert( pPg->pPager==pPager );\r\n      pPager->nMiss++;\r\n      rc = readDbPage(pPg);\r\n      if( rc!=SQLITE_OK ){\r\n        goto pager_acquire_err;\r\n      }\r\n    }\r\n    pager_set_pagehash(pPg);\r\n  }\r\n\r\n  return SQLITE_OK;\r\n\r\npager_acquire_err:\r\n  assert( rc!=SQLITE_OK );\r\n  if( pPg ){\r\n    sqlite3PcacheDrop(pPg);\r\n  }\r\n  pagerUnlockIfUnused(pPager);\r\n\r\n  *ppPage = 0;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Acquire a page if it is already in the in-memory cache.  Do\r\n** not read the page from disk.  Return a pointer to the page,\r\n** or 0 if the page is not in cache. \r\n**\r\n** See also sqlite3PagerGet().  The difference between this routine\r\n** and sqlite3PagerGet() is that _get() will go to the disk and read\r\n** in the page if the page is not already in cache.  This routine\r\n** returns NULL if the page is not in cache or if a disk I/O error \r\n** has ever happened.\r\n*/\r\nSQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){\r\n  PgHdr *pPg = 0;\r\n  assert( pPager!=0 );\r\n  assert( pgno!=0 );\r\n  assert( pPager->pPCache!=0 );\r\n  assert( pPager->eState>=PAGER_READER && pPager->eState!=PAGER_ERROR );\r\n  sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);\r\n  return pPg;\r\n}\r\n\r\n/*\r\n** Release a page reference.\r\n**\r\n** If the number of references to the page drop to zero, then the\r\n** page is added to the LRU list.  When all references to all pages\r\n** are released, a rollback occurs and the lock on the database is\r\n** removed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){\r\n  if( pPg ){\r\n    Pager *pPager = pPg->pPager;\r\n    sqlite3PcacheRelease(pPg);\r\n    pagerUnlockIfUnused(pPager);\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called at the start of every write transaction.\r\n** There must already be a RESERVED or EXCLUSIVE lock on the database \r\n** file when this routine is called.\r\n**\r\n** Open the journal file for pager pPager and write a journal header\r\n** to the start of it. If there are active savepoints, open the sub-journal\r\n** as well. This function is only used when the journal file is being \r\n** opened to write a rollback log for a transaction. It is not used \r\n** when opening a hot journal file to roll it back.\r\n**\r\n** If the journal file is already open (as it may be in exclusive mode),\r\n** then this function just writes a journal header to the start of the\r\n** already open file. \r\n**\r\n** Whether or not the journal file is opened by this function, the\r\n** Pager.pInJournal bitvec structure is allocated.\r\n**\r\n** Return SQLITE_OK if everything is successful. Otherwise, return \r\n** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or \r\n** an IO error code if opening or writing the journal file fails.\r\n*/\r\nstatic int pager_open_journal(Pager *pPager){\r\n  int rc = SQLITE_OK;                        /* Return code */\r\n  sqlite3_vfs * const pVfs = pPager->pVfs;   /* Local cache of vfs pointer */\r\n\r\n  assert( pPager->eState==PAGER_WRITER_LOCKED );\r\n  assert( assert_pager_state(pPager) );\r\n  assert( pPager->pInJournal==0 );\r\n  \r\n  /* If already in the error state, this function is a no-op.  But on\r\n  ** the other hand, this routine is never called if we are already in\r\n  ** an error state. */\r\n  if( NEVER(pPager->errCode) ) return pPager->errCode;\r\n\r\n  if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){\r\n    pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);\r\n    if( pPager->pInJournal==0 ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n  \r\n    /* Open the journal file if it is not already open. */\r\n    if( !isOpen(pPager->jfd) ){\r\n      if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){\r\n        sqlite3MemJournalOpen(pPager->jfd);\r\n      }else{\r\n        const int flags =                   /* VFS flags to open journal file */\r\n          SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|\r\n          (pPager->tempFile ? \r\n            (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL):\r\n            (SQLITE_OPEN_MAIN_JOURNAL)\r\n          );\r\n  #ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\n        rc = sqlite3JournalOpen(\r\n            pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager)\r\n        );\r\n  #else\r\n        rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);\r\n  #endif\r\n      }\r\n      assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );\r\n    }\r\n  \r\n  \r\n    /* Write the first journal header to the journal file and open \r\n    ** the sub-journal if necessary.\r\n    */\r\n    if( rc==SQLITE_OK ){\r\n      /* TODO: Check if all of these are really required. */\r\n      pPager->nRec = 0;\r\n      pPager->journalOff = 0;\r\n      pPager->setMaster = 0;\r\n      pPager->journalHdr = 0;\r\n      rc = writeJournalHdr(pPager);\r\n    }\r\n  }\r\n\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3BitvecDestroy(pPager->pInJournal);\r\n    pPager->pInJournal = 0;\r\n  }else{\r\n    assert( pPager->eState==PAGER_WRITER_LOCKED );\r\n    pPager->eState = PAGER_WRITER_CACHEMOD;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Begin a write-transaction on the specified pager object. If a \r\n** write-transaction has already been opened, this function is a no-op.\r\n**\r\n** If the exFlag argument is false, then acquire at least a RESERVED\r\n** lock on the database file. If exFlag is true, then acquire at least\r\n** an EXCLUSIVE lock. If such a lock is already held, no locking \r\n** functions need be called.\r\n**\r\n** If the subjInMemory argument is non-zero, then any sub-journal opened\r\n** within this transaction will be opened as an in-memory file. This\r\n** has no effect if the sub-journal is already opened (as it may be when\r\n** running in exclusive mode) or if the transaction does not require a\r\n** sub-journal. If the subjInMemory argument is zero, then any required\r\n** sub-journal is implemented in-memory if pPager is an in-memory database, \r\n** or using a temporary file otherwise.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){\r\n  int rc = SQLITE_OK;\r\n\r\n  if( pPager->errCode ) return pPager->errCode;\r\n  assert( pPager->eState>=PAGER_READER && pPager->eState<PAGER_ERROR );\r\n  pPager->subjInMemory = (u8)subjInMemory;\r\n\r\n  if( ALWAYS(pPager->eState==PAGER_READER) ){\r\n    assert( pPager->pInJournal==0 );\r\n\r\n    if( pagerUseWal(pPager) ){\r\n      /* If the pager is configured to use locking_mode=exclusive, and an\r\n      ** exclusive lock on the database is not already held, obtain it now.\r\n      */\r\n      if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){\r\n        rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        sqlite3WalExclusiveMode(pPager->pWal, 1);\r\n      }\r\n\r\n      /* Grab the write lock on the log file. If successful, upgrade to\r\n      ** PAGER_RESERVED state. Otherwise, return an error code to the caller.\r\n      ** The busy-handler is not invoked if another connection already\r\n      ** holds the write-lock. If possible, the upper layer will call it.\r\n      */\r\n      rc = sqlite3WalBeginWriteTransaction(pPager->pWal);\r\n    }else{\r\n      /* Obtain a RESERVED lock on the database file. If the exFlag parameter\r\n      ** is true, then immediately upgrade this to an EXCLUSIVE lock. The\r\n      ** busy-handler callback can be used when upgrading to the EXCLUSIVE\r\n      ** lock, but not when obtaining the RESERVED lock.\r\n      */\r\n      rc = pagerLockDb(pPager, RESERVED_LOCK);\r\n      if( rc==SQLITE_OK && exFlag ){\r\n        rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);\r\n      }\r\n    }\r\n\r\n    if( rc==SQLITE_OK ){\r\n      /* Change to WRITER_LOCKED state.\r\n      **\r\n      ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD\r\n      ** when it has an open transaction, but never to DBMOD or FINISHED.\r\n      ** This is because in those states the code to roll back savepoint \r\n      ** transactions may copy data from the sub-journal into the database \r\n      ** file as well as into the page cache. Which would be incorrect in \r\n      ** WAL mode.\r\n      */\r\n      pPager->eState = PAGER_WRITER_LOCKED;\r\n      pPager->dbHintSize = pPager->dbSize;\r\n      pPager->dbFileSize = pPager->dbSize;\r\n      pPager->dbOrigSize = pPager->dbSize;\r\n      pPager->journalOff = 0;\r\n    }\r\n\r\n    assert( rc==SQLITE_OK || pPager->eState==PAGER_READER );\r\n    assert( rc!=SQLITE_OK || pPager->eState==PAGER_WRITER_LOCKED );\r\n    assert( assert_pager_state(pPager) );\r\n  }\r\n\r\n  PAGERTRACE((\"TRANSACTION %d\\n\", PAGERID(pPager)));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Mark a single data page as writeable. The page is written into the \r\n** main journal or sub-journal as required. If the page is written into\r\n** one of the journals, the corresponding bit is set in the \r\n** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs\r\n** of any open savepoints as appropriate.\r\n*/\r\nstatic int pager_write(PgHdr *pPg){\r\n  void *pData = pPg->pData;\r\n  Pager *pPager = pPg->pPager;\r\n  int rc = SQLITE_OK;\r\n\r\n  /* This routine is not called unless a write-transaction has already \r\n  ** been started. The journal file may or may not be open at this point.\r\n  ** It is never called in the ERROR state.\r\n  */\r\n  assert( pPager->eState==PAGER_WRITER_LOCKED\r\n       || pPager->eState==PAGER_WRITER_CACHEMOD\r\n       || pPager->eState==PAGER_WRITER_DBMOD\r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  /* If an error has been previously detected, report the same error\r\n  ** again. This should not happen, but the check provides robustness. */\r\n  if( NEVER(pPager->errCode) )  return pPager->errCode;\r\n\r\n  /* Higher-level routines never call this function if database is not\r\n  ** writable.  But check anyway, just for robustness. */\r\n  if( NEVER(pPager->readOnly) ) return SQLITE_PERM;\r\n\r\n  CHECK_PAGE(pPg);\r\n\r\n  /* The journal file needs to be opened. Higher level routines have already\r\n  ** obtained the necessary locks to begin the write-transaction, but the\r\n  ** rollback journal might not yet be open. Open it now if this is the case.\r\n  **\r\n  ** This is done before calling sqlite3PcacheMakeDirty() on the page. \r\n  ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then\r\n  ** an error might occur and the pager would end up in WRITER_LOCKED state\r\n  ** with pages marked as dirty in the cache.\r\n  */\r\n  if( pPager->eState==PAGER_WRITER_LOCKED ){\r\n    rc = pager_open_journal(pPager);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  /* Mark the page as dirty.  If the page has already been written\r\n  ** to the journal then we can return right away.\r\n  */\r\n  sqlite3PcacheMakeDirty(pPg);\r\n  if( pageInJournal(pPg) && !subjRequiresPage(pPg) ){\r\n    assert( !pagerUseWal(pPager) );\r\n  }else{\r\n  \r\n    /* The transaction journal now exists and we have a RESERVED or an\r\n    ** EXCLUSIVE lock on the main database file.  Write the current page to\r\n    ** the transaction journal if it is not there already.\r\n    */\r\n    if( !pageInJournal(pPg) && !pagerUseWal(pPager) ){\r\n      assert( pagerUseWal(pPager)==0 );\r\n      if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){\r\n        u32 cksum;\r\n        char *pData2;\r\n        i64 iOff = pPager->journalOff;\r\n\r\n        /* We should never write to the journal file the page that\r\n        ** contains the database locks.  The following assert verifies\r\n        ** that we do not. */\r\n        assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );\r\n\r\n        assert( pPager->journalHdr<=pPager->journalOff );\r\n        CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);\r\n        cksum = pager_cksum(pPager, (u8*)pData2);\r\n\r\n        /* Even if an IO or diskfull error occurs while journalling the\r\n        ** page in the block above, set the need-sync flag for the page.\r\n        ** Otherwise, when the transaction is rolled back, the logic in\r\n        ** playback_one_page() will think that the page needs to be restored\r\n        ** in the database file. And if an IO error occurs while doing so,\r\n        ** then corruption may follow.\r\n        */\r\n        pPg->flags |= PGHDR_NEED_SYNC;\r\n\r\n        rc = write32bits(pPager->jfd, iOff, pPg->pgno);\r\n        if( rc!=SQLITE_OK ) return rc;\r\n        rc = sqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize, iOff+4);\r\n        if( rc!=SQLITE_OK ) return rc;\r\n        rc = write32bits(pPager->jfd, iOff+pPager->pageSize+4, cksum);\r\n        if( rc!=SQLITE_OK ) return rc;\r\n\r\n        IOTRACE((\"JOUT %p %d %lld %d\\n\", pPager, pPg->pgno, \r\n                 pPager->journalOff, pPager->pageSize));\r\n        PAGER_INCR(sqlite3_pager_writej_count);\r\n        PAGERTRACE((\"JOURNAL %d page %d needSync=%d hash(%08x)\\n\",\r\n             PAGERID(pPager), pPg->pgno, \r\n             ((pPg->flags&PGHDR_NEED_SYNC)?1:0), pager_pagehash(pPg)));\r\n\r\n        pPager->journalOff += 8 + pPager->pageSize;\r\n        pPager->nRec++;\r\n        assert( pPager->pInJournal!=0 );\r\n        rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);\r\n        testcase( rc==SQLITE_NOMEM );\r\n        assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );\r\n        rc |= addToSavepointBitvecs(pPager, pPg->pgno);\r\n        if( rc!=SQLITE_OK ){\r\n          assert( rc==SQLITE_NOMEM );\r\n          return rc;\r\n        }\r\n      }else{\r\n        if( pPager->eState!=PAGER_WRITER_DBMOD ){\r\n          pPg->flags |= PGHDR_NEED_SYNC;\r\n        }\r\n        PAGERTRACE((\"APPEND %d page %d needSync=%d\\n\",\r\n                PAGERID(pPager), pPg->pgno,\r\n               ((pPg->flags&PGHDR_NEED_SYNC)?1:0)));\r\n      }\r\n    }\r\n  \r\n    /* If the statement journal is open and the page is not in it,\r\n    ** then write the current page to the statement journal.  Note that\r\n    ** the statement journal format differs from the standard journal format\r\n    ** in that it omits the checksums and the header.\r\n    */\r\n    if( subjRequiresPage(pPg) ){\r\n      rc = subjournalPage(pPg);\r\n    }\r\n  }\r\n\r\n  /* Update the database size and return.\r\n  */\r\n  if( pPager->dbSize<pPg->pgno ){\r\n    pPager->dbSize = pPg->pgno;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Mark a data page as writeable. This routine must be called before \r\n** making changes to a page. The caller must check the return value \r\n** of this function and be careful not to change any page data unless \r\n** this routine returns SQLITE_OK.\r\n**\r\n** The difference between this function and pager_write() is that this\r\n** function also deals with the special case where 2 or more pages\r\n** fit on a single disk sector. In this case all co-resident pages\r\n** must have been written to the journal file before returning.\r\n**\r\n** If an error occurs, SQLITE_NOMEM or an IO error code is returned\r\n** as appropriate. Otherwise, SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerWrite(DbPage *pDbPage){\r\n  int rc = SQLITE_OK;\r\n\r\n  PgHdr *pPg = pDbPage;\r\n  Pager *pPager = pPg->pPager;\r\n  Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize);\r\n\r\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\r\n  assert( pPager->eState!=PAGER_ERROR );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  if( nPagePerSector>1 ){\r\n    Pgno nPageCount;          /* Total number of pages in database file */\r\n    Pgno pg1;                 /* First page of the sector pPg is located on. */\r\n    int nPage = 0;            /* Number of pages starting at pg1 to journal */\r\n    int ii;                   /* Loop counter */\r\n    int needSync = 0;         /* True if any page has PGHDR_NEED_SYNC */\r\n\r\n    /* Set the doNotSyncSpill flag to 1. This is because we cannot allow\r\n    ** a journal header to be written between the pages journaled by\r\n    ** this function.\r\n    */\r\n    assert( !MEMDB );\r\n    assert( pPager->doNotSyncSpill==0 );\r\n    pPager->doNotSyncSpill++;\r\n\r\n    /* This trick assumes that both the page-size and sector-size are\r\n    ** an integer power of 2. It sets variable pg1 to the identifier\r\n    ** of the first page of the sector pPg is located on.\r\n    */\r\n    pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;\r\n\r\n    nPageCount = pPager->dbSize;\r\n    if( pPg->pgno>nPageCount ){\r\n      nPage = (pPg->pgno - pg1)+1;\r\n    }else if( (pg1+nPagePerSector-1)>nPageCount ){\r\n      nPage = nPageCount+1-pg1;\r\n    }else{\r\n      nPage = nPagePerSector;\r\n    }\r\n    assert(nPage>0);\r\n    assert(pg1<=pPg->pgno);\r\n    assert((pg1+nPage)>pPg->pgno);\r\n\r\n    for(ii=0; ii<nPage && rc==SQLITE_OK; ii++){\r\n      Pgno pg = pg1+ii;\r\n      PgHdr *pPage;\r\n      if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){\r\n        if( pg!=PAGER_MJ_PGNO(pPager) ){\r\n          rc = sqlite3PagerGet(pPager, pg, &pPage);\r\n          if( rc==SQLITE_OK ){\r\n            rc = pager_write(pPage);\r\n            if( pPage->flags&PGHDR_NEED_SYNC ){\r\n              needSync = 1;\r\n            }\r\n            sqlite3PagerUnref(pPage);\r\n          }\r\n        }\r\n      }else if( (pPage = pager_lookup(pPager, pg))!=0 ){\r\n        if( pPage->flags&PGHDR_NEED_SYNC ){\r\n          needSync = 1;\r\n        }\r\n        sqlite3PagerUnref(pPage);\r\n      }\r\n    }\r\n\r\n    /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages \r\n    ** starting at pg1, then it needs to be set for all of them. Because\r\n    ** writing to any of these nPage pages may damage the others, the\r\n    ** journal file must contain sync()ed copies of all of them\r\n    ** before any of them can be written out to the database file.\r\n    */\r\n    if( rc==SQLITE_OK && needSync ){\r\n      assert( !MEMDB );\r\n      for(ii=0; ii<nPage; ii++){\r\n        PgHdr *pPage = pager_lookup(pPager, pg1+ii);\r\n        if( pPage ){\r\n          pPage->flags |= PGHDR_NEED_SYNC;\r\n          sqlite3PagerUnref(pPage);\r\n        }\r\n      }\r\n    }\r\n\r\n    assert( pPager->doNotSyncSpill==1 );\r\n    pPager->doNotSyncSpill--;\r\n  }else{\r\n    rc = pager_write(pDbPage);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return TRUE if the page given in the argument was previously passed\r\n** to sqlite3PagerWrite().  In other words, return TRUE if it is ok\r\n** to change the content of the page.\r\n*/\r\n#ifndef NDEBUG\r\nSQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){\r\n  return pPg->flags&PGHDR_DIRTY;\r\n}\r\n#endif\r\n\r\n/*\r\n** A call to this routine tells the pager that it is not necessary to\r\n** write the information on page pPg back to the disk, even though\r\n** that page might be marked as dirty.  This happens, for example, when\r\n** the page has been added as a leaf of the freelist and so its\r\n** content no longer matters.\r\n**\r\n** The overlying software layer calls this routine when all of the data\r\n** on the given page is unused. The pager marks the page as clean so\r\n** that it does not get written to disk.\r\n**\r\n** Tests show that this optimization can quadruple the speed of large \r\n** DELETE operations.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){\r\n  Pager *pPager = pPg->pPager;\r\n  if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){\r\n    PAGERTRACE((\"DONT_WRITE page %d of %d\\n\", pPg->pgno, PAGERID(pPager)));\r\n    IOTRACE((\"CLEAN %p %d\\n\", pPager, pPg->pgno))\r\n    pPg->flags |= PGHDR_DONT_WRITE;\r\n    pager_set_pagehash(pPg);\r\n  }\r\n}\r\n\r\n/*\r\n** This routine is called to increment the value of the database file \r\n** change-counter, stored as a 4-byte big-endian integer starting at \r\n** byte offset 24 of the pager file.  The secondary change counter at\r\n** 92 is also updated, as is the SQLite version number at offset 96.\r\n**\r\n** But this only happens if the pPager->changeCountDone flag is false.\r\n** To avoid excess churning of page 1, the update only happens once.\r\n** See also the pager_write_changecounter() routine that does an \r\n** unconditional update of the change counters.\r\n**\r\n** If the isDirectMode flag is zero, then this is done by calling \r\n** sqlite3PagerWrite() on page 1, then modifying the contents of the\r\n** page data. In this case the file will be updated when the current\r\n** transaction is committed.\r\n**\r\n** The isDirectMode flag may only be non-zero if the library was compiled\r\n** with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case,\r\n** if isDirect is non-zero, then the database file is updated directly\r\n** by writing an updated version of page 1 using a call to the \r\n** sqlite3OsWrite() function.\r\n*/\r\nstatic int pager_incr_changecounter(Pager *pPager, int isDirectMode){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD\r\n       || pPager->eState==PAGER_WRITER_DBMOD\r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  /* Declare and initialize constant integer 'isDirect'. If the\r\n  ** atomic-write optimization is enabled in this build, then isDirect\r\n  ** is initialized to the value passed as the isDirectMode parameter\r\n  ** to this function. Otherwise, it is always set to zero.\r\n  **\r\n  ** The idea is that if the atomic-write optimization is not\r\n  ** enabled at compile time, the compiler can omit the tests of\r\n  ** 'isDirect' below, as well as the block enclosed in the\r\n  ** \"if( isDirect )\" condition.\r\n  */\r\n#ifndef SQLITE_ENABLE_ATOMIC_WRITE\r\n# define DIRECT_MODE 0\r\n  assert( isDirectMode==0 );\r\n  UNUSED_PARAMETER(isDirectMode);\r\n#else\r\n# define DIRECT_MODE isDirectMode\r\n#endif\r\n\r\n  if( !pPager->changeCountDone && pPager->dbSize>0 ){\r\n    PgHdr *pPgHdr;                /* Reference to page 1 */\r\n\r\n    assert( !pPager->tempFile && isOpen(pPager->fd) );\r\n\r\n    /* Open page 1 of the file for writing. */\r\n    rc = sqlite3PagerGet(pPager, 1, &pPgHdr);\r\n    assert( pPgHdr==0 || rc==SQLITE_OK );\r\n\r\n    /* If page one was fetched successfully, and this function is not\r\n    ** operating in direct-mode, make page 1 writable.  When not in \r\n    ** direct mode, page 1 is always held in cache and hence the PagerGet()\r\n    ** above is always successful - hence the ALWAYS on rc==SQLITE_OK.\r\n    */\r\n    if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){\r\n      rc = sqlite3PagerWrite(pPgHdr);\r\n    }\r\n\r\n    if( rc==SQLITE_OK ){\r\n      /* Actually do the update of the change counter */\r\n      pager_write_changecounter(pPgHdr);\r\n\r\n      /* If running in direct mode, write the contents of page 1 to the file. */\r\n      if( DIRECT_MODE ){\r\n        const void *zBuf;\r\n        assert( pPager->dbFileSize>0 );\r\n        CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM, zBuf);\r\n        if( rc==SQLITE_OK ){\r\n          rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0);\r\n        }\r\n        if( rc==SQLITE_OK ){\r\n          pPager->changeCountDone = 1;\r\n        }\r\n      }else{\r\n        pPager->changeCountDone = 1;\r\n      }\r\n    }\r\n\r\n    /* Release the page reference. */\r\n    sqlite3PagerUnref(pPgHdr);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Sync the database file to disk. This is a no-op for in-memory databases\r\n** or pages with the Pager.noSync flag set.\r\n**\r\n** If successful, or if called on a pager for which it is a no-op, this\r\n** function returns SQLITE_OK. Otherwise, an IO error code is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n  if( !pPager->noSync ){\r\n    assert( !MEMDB );\r\n    rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);\r\n  }else if( isOpen(pPager->fd) ){\r\n    assert( !MEMDB );\r\n    rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC_OMITTED, 0);\r\n    if( rc==SQLITE_NOTFOUND ){\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function may only be called while a write-transaction is active in\r\n** rollback. If the connection is in WAL mode, this call is a no-op. \r\n** Otherwise, if the connection does not already have an EXCLUSIVE lock on \r\n** the database file, an attempt is made to obtain one.\r\n**\r\n** If the EXCLUSIVE lock is already held or the attempt to obtain it is\r\n** successful, or the connection is in WAL mode, SQLITE_OK is returned.\r\n** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is \r\n** returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD \r\n       || pPager->eState==PAGER_WRITER_DBMOD \r\n       || pPager->eState==PAGER_WRITER_LOCKED \r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n  if( 0==pagerUseWal(pPager) ){\r\n    rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Sync the database file for the pager pPager. zMaster points to the name\r\n** of a master journal file that should be written into the individual\r\n** journal file. zMaster may be NULL, which is interpreted as no master\r\n** journal (a single database transaction).\r\n**\r\n** This routine ensures that:\r\n**\r\n**   * The database file change-counter is updated,\r\n**   * the journal is synced (unless the atomic-write optimization is used),\r\n**   * all dirty pages are written to the database file, \r\n**   * the database file is truncated (if required), and\r\n**   * the database file synced. \r\n**\r\n** The only thing that remains to commit the transaction is to finalize \r\n** (delete, truncate or zero the first part of) the journal file (or \r\n** delete the master journal file if specified).\r\n**\r\n** Note that if zMaster==NULL, this does not overwrite a previous value\r\n** passed to an sqlite3PagerCommitPhaseOne() call.\r\n**\r\n** If the final parameter - noSync - is true, then the database file itself\r\n** is not synced. The caller must call sqlite3PagerSync() directly to\r\n** sync the database file before calling CommitPhaseTwo() to delete the\r\n** journal file in this case.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(\r\n  Pager *pPager,                  /* Pager object */\r\n  const char *zMaster,            /* If not NULL, the master journal name */\r\n  int noSync                      /* True to omit the xSync on the db file */\r\n){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n\r\n  assert( pPager->eState==PAGER_WRITER_LOCKED\r\n       || pPager->eState==PAGER_WRITER_CACHEMOD\r\n       || pPager->eState==PAGER_WRITER_DBMOD\r\n       || pPager->eState==PAGER_ERROR\r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  /* If a prior error occurred, report that error again. */\r\n  if( NEVER(pPager->errCode) ) return pPager->errCode;\r\n\r\n  PAGERTRACE((\"DATABASE SYNC: File=%s zMaster=%s nSize=%d\\n\", \r\n      pPager->zFilename, zMaster, pPager->dbSize));\r\n\r\n  /* If no database changes have been made, return early. */\r\n  if( pPager->eState<PAGER_WRITER_CACHEMOD ) return SQLITE_OK;\r\n\r\n  if( MEMDB ){\r\n    /* If this is an in-memory db, or no pages have been written to, or this\r\n    ** function has already been called, it is mostly a no-op.  However, any\r\n    ** backup in progress needs to be restarted.\r\n    */\r\n    sqlite3BackupRestart(pPager->pBackup);\r\n  }else{\r\n    if( pagerUseWal(pPager) ){\r\n      PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);\r\n      PgHdr *pPageOne = 0;\r\n      if( pList==0 ){\r\n        /* Must have at least one page for the WAL commit flag.\r\n        ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */\r\n        rc = sqlite3PagerGet(pPager, 1, &pPageOne);\r\n        pList = pPageOne;\r\n        pList->pDirty = 0;\r\n      }\r\n      assert( rc==SQLITE_OK );\r\n      if( ALWAYS(pList) ){\r\n        rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1);\r\n      }\r\n      sqlite3PagerUnref(pPageOne);\r\n      if( rc==SQLITE_OK ){\r\n        sqlite3PcacheCleanAll(pPager->pPCache);\r\n      }\r\n    }else{\r\n      /* The following block updates the change-counter. Exactly how it\r\n      ** does this depends on whether or not the atomic-update optimization\r\n      ** was enabled at compile time, and if this transaction meets the \r\n      ** runtime criteria to use the operation: \r\n      **\r\n      **    * The file-system supports the atomic-write property for\r\n      **      blocks of size page-size, and \r\n      **    * This commit is not part of a multi-file transaction, and\r\n      **    * Exactly one page has been modified and store in the journal file.\r\n      **\r\n      ** If the optimization was not enabled at compile time, then the\r\n      ** pager_incr_changecounter() function is called to update the change\r\n      ** counter in 'indirect-mode'. If the optimization is compiled in but\r\n      ** is not applicable to this transaction, call sqlite3JournalCreate()\r\n      ** to make sure the journal file has actually been created, then call\r\n      ** pager_incr_changecounter() to update the change-counter in indirect\r\n      ** mode. \r\n      **\r\n      ** Otherwise, if the optimization is both enabled and applicable,\r\n      ** then call pager_incr_changecounter() to update the change-counter\r\n      ** in 'direct' mode. In this case the journal file will never be\r\n      ** created for this transaction.\r\n      */\r\n  #ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\n      PgHdr *pPg;\r\n      assert( isOpen(pPager->jfd) \r\n           || pPager->journalMode==PAGER_JOURNALMODE_OFF \r\n           || pPager->journalMode==PAGER_JOURNALMODE_WAL \r\n      );\r\n      if( !zMaster && isOpen(pPager->jfd) \r\n       && pPager->journalOff==jrnlBufferSize(pPager) \r\n       && pPager->dbSize>=pPager->dbOrigSize\r\n       && (0==(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)\r\n      ){\r\n        /* Update the db file change counter via the direct-write method. The \r\n        ** following call will modify the in-memory representation of page 1 \r\n        ** to include the updated change counter and then write page 1 \r\n        ** directly to the database file. Because of the atomic-write \r\n        ** property of the host file-system, this is safe.\r\n        */\r\n        rc = pager_incr_changecounter(pPager, 1);\r\n      }else{\r\n        rc = sqlite3JournalCreate(pPager->jfd);\r\n        if( rc==SQLITE_OK ){\r\n          rc = pager_incr_changecounter(pPager, 0);\r\n        }\r\n      }\r\n  #else\r\n      rc = pager_incr_changecounter(pPager, 0);\r\n  #endif\r\n      if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\r\n  \r\n      /* If this transaction has made the database smaller, then all pages\r\n      ** being discarded by the truncation must be written to the journal\r\n      ** file. This can only happen in auto-vacuum mode.\r\n      **\r\n      ** Before reading the pages with page numbers larger than the \r\n      ** current value of Pager.dbSize, set dbSize back to the value\r\n      ** that it took at the start of the transaction. Otherwise, the\r\n      ** calls to sqlite3PagerGet() return zeroed pages instead of \r\n      ** reading data from the database file.\r\n      */\r\n  #ifndef SQLITE_OMIT_AUTOVACUUM\r\n      if( pPager->dbSize<pPager->dbOrigSize \r\n       && pPager->journalMode!=PAGER_JOURNALMODE_OFF\r\n      ){\r\n        Pgno i;                                   /* Iterator variable */\r\n        const Pgno iSkip = PAGER_MJ_PGNO(pPager); /* Pending lock page */\r\n        const Pgno dbSize = pPager->dbSize;       /* Database image size */ \r\n        pPager->dbSize = pPager->dbOrigSize;\r\n        for( i=dbSize+1; i<=pPager->dbOrigSize; i++ ){\r\n          if( !sqlite3BitvecTest(pPager->pInJournal, i) && i!=iSkip ){\r\n            PgHdr *pPage;             /* Page to journal */\r\n            rc = sqlite3PagerGet(pPager, i, &pPage);\r\n            if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\r\n            rc = sqlite3PagerWrite(pPage);\r\n            sqlite3PagerUnref(pPage);\r\n            if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\r\n          }\r\n        }\r\n        pPager->dbSize = dbSize;\r\n      } \r\n  #endif\r\n  \r\n      /* Write the master journal name into the journal file. If a master \r\n      ** journal file name has already been written to the journal file, \r\n      ** or if zMaster is NULL (no master journal), then this call is a no-op.\r\n      */\r\n      rc = writeMasterJournal(pPager, zMaster);\r\n      if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\r\n  \r\n      /* Sync the journal file and write all dirty pages to the database.\r\n      ** If the atomic-update optimization is being used, this sync will not \r\n      ** create the journal file or perform any real IO.\r\n      **\r\n      ** Because the change-counter page was just modified, unless the\r\n      ** atomic-update optimization is used it is almost certain that the\r\n      ** journal requires a sync here. However, in locking_mode=exclusive\r\n      ** on a system under memory pressure it is just possible that this is \r\n      ** not the case. In this case it is likely enough that the redundant\r\n      ** xSync() call will be changed to a no-op by the OS anyhow. \r\n      */\r\n      rc = syncJournal(pPager, 0);\r\n      if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\r\n  \r\n      rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache));\r\n      if( rc!=SQLITE_OK ){\r\n        assert( rc!=SQLITE_IOERR_BLOCKED );\r\n        goto commit_phase_one_exit;\r\n      }\r\n      sqlite3PcacheCleanAll(pPager->pPCache);\r\n  \r\n      /* If the file on disk is not the same size as the database image,\r\n      ** then use pager_truncate to grow or shrink the file here.\r\n      */\r\n      if( pPager->dbSize!=pPager->dbFileSize ){\r\n        Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_MJ_PGNO(pPager));\r\n        assert( pPager->eState==PAGER_WRITER_DBMOD );\r\n        rc = pager_truncate(pPager, nNew);\r\n        if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\r\n      }\r\n  \r\n      /* Finally, sync the database file. */\r\n      if( !noSync ){\r\n        rc = sqlite3PagerSync(pPager);\r\n      }\r\n      IOTRACE((\"DBSYNC %p\\n\", pPager))\r\n    }\r\n  }\r\n\r\ncommit_phase_one_exit:\r\n  if( rc==SQLITE_OK && !pagerUseWal(pPager) ){\r\n    pPager->eState = PAGER_WRITER_FINISHED;\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** When this function is called, the database file has been completely\r\n** updated to reflect the changes made by the current transaction and\r\n** synced to disk. The journal file still exists in the file-system \r\n** though, and if a failure occurs at this point it will eventually\r\n** be used as a hot-journal and the current transaction rolled back.\r\n**\r\n** This function finalizes the journal file, either by deleting, \r\n** truncating or partially zeroing it, so that it cannot be used \r\n** for hot-journal rollback. Once this is done the transaction is\r\n** irrevocably committed.\r\n**\r\n** If an error occurs, an IO error code is returned and the pager\r\n** moves into the error state. Otherwise, SQLITE_OK is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){\r\n  int rc = SQLITE_OK;                  /* Return code */\r\n\r\n  /* This routine should not be called if a prior error has occurred.\r\n  ** But if (due to a coding error elsewhere in the system) it does get\r\n  ** called, just return the same error code without doing anything. */\r\n  if( NEVER(pPager->errCode) ) return pPager->errCode;\r\n\r\n  assert( pPager->eState==PAGER_WRITER_LOCKED\r\n       || pPager->eState==PAGER_WRITER_FINISHED\r\n       || (pagerUseWal(pPager) && pPager->eState==PAGER_WRITER_CACHEMOD)\r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  /* An optimization. If the database was not actually modified during\r\n  ** this transaction, the pager is running in exclusive-mode and is\r\n  ** using persistent journals, then this function is a no-op.\r\n  **\r\n  ** The start of the journal file currently contains a single journal \r\n  ** header with the nRec field set to 0. If such a journal is used as\r\n  ** a hot-journal during hot-journal rollback, 0 changes will be made\r\n  ** to the database file. So there is no need to zero the journal \r\n  ** header. Since the pager is in exclusive mode, there is no need\r\n  ** to drop any locks either.\r\n  */\r\n  if( pPager->eState==PAGER_WRITER_LOCKED \r\n   && pPager->exclusiveMode \r\n   && pPager->journalMode==PAGER_JOURNALMODE_PERSIST\r\n  ){\r\n    assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) || !pPager->journalOff );\r\n    pPager->eState = PAGER_READER;\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  PAGERTRACE((\"COMMIT %d\\n\", PAGERID(pPager)));\r\n  rc = pager_end_transaction(pPager, pPager->setMaster);\r\n  return pager_error(pPager, rc);\r\n}\r\n\r\n/*\r\n** If a write transaction is open, then all changes made within the \r\n** transaction are reverted and the current write-transaction is closed.\r\n** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR\r\n** state if an error occurs.\r\n**\r\n** If the pager is already in PAGER_ERROR state when this function is called,\r\n** it returns Pager.errCode immediately. No work is performed in this case.\r\n**\r\n** Otherwise, in rollback mode, this function performs two functions:\r\n**\r\n**   1) It rolls back the journal file, restoring all database file and \r\n**      in-memory cache pages to the state they were in when the transaction\r\n**      was opened, and\r\n**\r\n**   2) It finalizes the journal file, so that it is not used for hot\r\n**      rollback at any point in the future.\r\n**\r\n** Finalization of the journal file (task 2) is only performed if the \r\n** rollback is successful.\r\n**\r\n** In WAL mode, all cache-entries containing data modified within the\r\n** current transaction are either expelled from the cache or reverted to\r\n** their pre-transaction state by re-reading data from the database or\r\n** WAL files. The WAL transaction is then closed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){\r\n  int rc = SQLITE_OK;                  /* Return code */\r\n  PAGERTRACE((\"ROLLBACK %d\\n\", PAGERID(pPager)));\r\n\r\n  /* PagerRollback() is a no-op if called in READER or OPEN state. If\r\n  ** the pager is already in the ERROR state, the rollback is not \r\n  ** attempted here. Instead, the error code is returned to the caller.\r\n  */\r\n  assert( assert_pager_state(pPager) );\r\n  if( pPager->eState==PAGER_ERROR ) return pPager->errCode;\r\n  if( pPager->eState<=PAGER_READER ) return SQLITE_OK;\r\n\r\n  if( pagerUseWal(pPager) ){\r\n    int rc2;\r\n    rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, -1);\r\n    rc2 = pager_end_transaction(pPager, pPager->setMaster);\r\n    if( rc==SQLITE_OK ) rc = rc2;\r\n  }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){\r\n    int eState = pPager->eState;\r\n    rc = pager_end_transaction(pPager, 0);\r\n    if( !MEMDB && eState>PAGER_WRITER_LOCKED ){\r\n      /* This can happen using journal_mode=off. Move the pager to the error \r\n      ** state to indicate that the contents of the cache may not be trusted.\r\n      ** Any active readers will get SQLITE_ABORT.\r\n      */\r\n      pPager->errCode = SQLITE_ABORT;\r\n      pPager->eState = PAGER_ERROR;\r\n      return rc;\r\n    }\r\n  }else{\r\n    rc = pager_playback(pPager, 0);\r\n  }\r\n\r\n  assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK );\r\n  assert( rc==SQLITE_OK || rc==SQLITE_FULL\r\n          || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR );\r\n\r\n  /* If an error occurs during a ROLLBACK, we can no longer trust the pager\r\n  ** cache. So call pager_error() on the way out to make any error persistent.\r\n  */\r\n  return pager_error(pPager, rc);\r\n}\r\n\r\n/*\r\n** Return TRUE if the database file is opened read-only.  Return FALSE\r\n** if the database is (in theory) writable.\r\n*/\r\nSQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){\r\n  return pPager->readOnly;\r\n}\r\n\r\n/*\r\n** Return the number of references to the pager.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){\r\n  return sqlite3PcacheRefCount(pPager->pPCache);\r\n}\r\n\r\n/*\r\n** Return the approximate number of bytes of memory currently\r\n** used by the pager and its associated cache.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){\r\n  int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr)\r\n                                     + 5*sizeof(void*);\r\n  return perPageSize*sqlite3PcachePagecount(pPager->pPCache)\r\n           + sqlite3MallocSize(pPager)\r\n           + pPager->pageSize;\r\n}\r\n\r\n/*\r\n** Return the number of references to the specified page.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage *pPage){\r\n  return sqlite3PcachePageRefcount(pPage);\r\n}\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** This routine is used for testing and analysis only.\r\n*/\r\nSQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){\r\n  static int a[11];\r\n  a[0] = sqlite3PcacheRefCount(pPager->pPCache);\r\n  a[1] = sqlite3PcachePagecount(pPager->pPCache);\r\n  a[2] = sqlite3PcacheGetCachesize(pPager->pPCache);\r\n  a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize;\r\n  a[4] = pPager->eState;\r\n  a[5] = pPager->errCode;\r\n  a[6] = pPager->nHit;\r\n  a[7] = pPager->nMiss;\r\n  a[8] = 0;  /* Used to be pPager->nOvfl */\r\n  a[9] = pPager->nRead;\r\n  a[10] = pPager->nWrite;\r\n  return a;\r\n}\r\n#endif\r\n\r\n/*\r\n** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or\r\n** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the\r\n** current cache hit or miss count, according to the value of eStat. If the \r\n** reset parameter is non-zero, the cache hit or miss count is zeroed before \r\n** returning.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){\r\n  int *piStat;\r\n\r\n  assert( eStat==SQLITE_DBSTATUS_CACHE_HIT\r\n       || eStat==SQLITE_DBSTATUS_CACHE_MISS\r\n  );\r\n  if( eStat==SQLITE_DBSTATUS_CACHE_HIT ){\r\n    piStat = &pPager->nHit;\r\n  }else{\r\n    piStat = &pPager->nMiss;\r\n  }\r\n\r\n  *pnVal += *piStat;\r\n  if( reset ){\r\n    *piStat = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Return true if this is an in-memory pager.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){\r\n  return MEMDB;\r\n}\r\n\r\n/*\r\n** Check that there are at least nSavepoint savepoints open. If there are\r\n** currently less than nSavepoints open, then open one or more savepoints\r\n** to make up the difference. If the number of savepoints is already\r\n** equal to nSavepoint, then this function is a no-op.\r\n**\r\n** If a memory allocation fails, SQLITE_NOMEM is returned. If an error \r\n** occurs while opening the sub-journal file, then an IO error code is\r\n** returned. Otherwise, SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){\r\n  int rc = SQLITE_OK;                       /* Return code */\r\n  int nCurrent = pPager->nSavepoint;        /* Current number of savepoints */\r\n\r\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  if( nSavepoint>nCurrent && pPager->useJournal ){\r\n    int ii;                                 /* Iterator variable */\r\n    PagerSavepoint *aNew;                   /* New Pager.aSavepoint array */\r\n\r\n    /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM\r\n    ** if the allocation fails. Otherwise, zero the new portion in case a \r\n    ** malloc failure occurs while populating it in the for(...) loop below.\r\n    */\r\n    aNew = (PagerSavepoint *)sqlite3Realloc(\r\n        pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint\r\n    );\r\n    if( !aNew ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint));\r\n    pPager->aSavepoint = aNew;\r\n\r\n    /* Populate the PagerSavepoint structures just allocated. */\r\n    for(ii=nCurrent; ii<nSavepoint; ii++){\r\n      aNew[ii].nOrig = pPager->dbSize;\r\n      if( isOpen(pPager->jfd) && pPager->journalOff>0 ){\r\n        aNew[ii].iOffset = pPager->journalOff;\r\n      }else{\r\n        aNew[ii].iOffset = JOURNAL_HDR_SZ(pPager);\r\n      }\r\n      aNew[ii].iSubRec = pPager->nSubRec;\r\n      aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);\r\n      if( !aNew[ii].pInSavepoint ){\r\n        return SQLITE_NOMEM;\r\n      }\r\n      if( pagerUseWal(pPager) ){\r\n        sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData);\r\n      }\r\n      pPager->nSavepoint = ii+1;\r\n    }\r\n    assert( pPager->nSavepoint==nSavepoint );\r\n    assertTruncateConstraint(pPager);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called to rollback or release (commit) a savepoint.\r\n** The savepoint to release or rollback need not be the most recently \r\n** created savepoint.\r\n**\r\n** Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE.\r\n** If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with\r\n** index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes\r\n** that have occurred since the specified savepoint was created.\r\n**\r\n** The savepoint to rollback or release is identified by parameter \r\n** iSavepoint. A value of 0 means to operate on the outermost savepoint\r\n** (the first created). A value of (Pager.nSavepoint-1) means operate\r\n** on the most recently created savepoint. If iSavepoint is greater than\r\n** (Pager.nSavepoint-1), then this function is a no-op.\r\n**\r\n** If a negative value is passed to this function, then the current\r\n** transaction is rolled back. This is different to calling \r\n** sqlite3PagerRollback() because this function does not terminate\r\n** the transaction or unlock the database, it just restores the \r\n** contents of the database to its original state. \r\n**\r\n** In any case, all savepoints with an index greater than iSavepoint \r\n** are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE),\r\n** then savepoint iSavepoint is also destroyed.\r\n**\r\n** This function may return SQLITE_NOMEM if a memory allocation fails,\r\n** or an IO error code if an IO error occurs while rolling back a \r\n** savepoint. If no errors occur, SQLITE_OK is returned.\r\n*/ \r\nSQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){\r\n  int rc = pPager->errCode;       /* Return code */\r\n\r\n  assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );\r\n  assert( iSavepoint>=0 || op==SAVEPOINT_ROLLBACK );\r\n\r\n  if( rc==SQLITE_OK && iSavepoint<pPager->nSavepoint ){\r\n    int ii;            /* Iterator variable */\r\n    int nNew;          /* Number of remaining savepoints after this op. */\r\n\r\n    /* Figure out how many savepoints will still be active after this\r\n    ** operation. Store this value in nNew. Then free resources associated \r\n    ** with any savepoints that are destroyed by this operation.\r\n    */\r\n    nNew = iSavepoint + (( op==SAVEPOINT_RELEASE ) ? 0 : 1);\r\n    for(ii=nNew; ii<pPager->nSavepoint; ii++){\r\n      sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);\r\n    }\r\n    pPager->nSavepoint = nNew;\r\n\r\n    /* If this is a release of the outermost savepoint, truncate \r\n    ** the sub-journal to zero bytes in size. */\r\n    if( op==SAVEPOINT_RELEASE ){\r\n      if( nNew==0 && isOpen(pPager->sjfd) ){\r\n        /* Only truncate if it is an in-memory sub-journal. */\r\n        if( sqlite3IsMemJournal(pPager->sjfd) ){\r\n          rc = sqlite3OsTruncate(pPager->sjfd, 0);\r\n          assert( rc==SQLITE_OK );\r\n        }\r\n        pPager->nSubRec = 0;\r\n      }\r\n    }\r\n    /* Else this is a rollback operation, playback the specified savepoint.\r\n    ** If this is a temp-file, it is possible that the journal file has\r\n    ** not yet been opened. In this case there have been no changes to\r\n    ** the database file, so the playback operation can be skipped.\r\n    */\r\n    else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){\r\n      PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1];\r\n      rc = pagerPlaybackSavepoint(pPager, pSavepoint);\r\n      assert(rc!=SQLITE_DONE);\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the full pathname of the database file.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3PagerFilename(Pager *pPager){\r\n  return pPager->zFilename;\r\n}\r\n\r\n/*\r\n** Return the VFS structure for the pager.\r\n*/\r\nSQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){\r\n  return pPager->pVfs;\r\n}\r\n\r\n/*\r\n** Return the file handle for the database file associated\r\n** with the pager.  This might return NULL if the file has\r\n** not yet been opened.\r\n*/\r\nSQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){\r\n  return pPager->fd;\r\n}\r\n\r\n/*\r\n** Return the full pathname of the journal file.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){\r\n  return pPager->zJournal;\r\n}\r\n\r\n/*\r\n** Return true if fsync() calls are disabled for this pager.  Return FALSE\r\n** if fsync()s are executed normally.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerNosync(Pager *pPager){\r\n  return pPager->noSync;\r\n}\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n/*\r\n** Set or retrieve the codec for this pager\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerSetCodec(\r\n  Pager *pPager,\r\n  void *(*xCodec)(void*,void*,Pgno,int),\r\n  void (*xCodecSizeChng)(void*,int,int),\r\n  void (*xCodecFree)(void*),\r\n  void *pCodec\r\n){\r\n  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);\r\n  pPager->xCodec = pPager->memDb ? 0 : xCodec;\r\n  pPager->xCodecSizeChng = xCodecSizeChng;\r\n  pPager->xCodecFree = xCodecFree;\r\n  pPager->pCodec = pCodec;\r\n  pagerReportSize(pPager);\r\n}\r\nSQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){\r\n  return pPager->pCodec;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n/*\r\n** Move the page pPg to location pgno in the file.\r\n**\r\n** There must be no references to the page previously located at\r\n** pgno (which we call pPgOld) though that page is allowed to be\r\n** in cache.  If the page previously located at pgno is not already\r\n** in the rollback journal, it is not put there by by this routine.\r\n**\r\n** References to the page pPg remain valid. Updating any\r\n** meta-data associated with pPg (i.e. data stored in the nExtra bytes\r\n** allocated along with the page) is the responsibility of the caller.\r\n**\r\n** A transaction must be active when this routine is called. It used to be\r\n** required that a statement transaction was not active, but this restriction\r\n** has been removed (CREATE INDEX needs to move a page when a statement\r\n** transaction is active).\r\n**\r\n** If the fourth argument, isCommit, is non-zero, then this page is being\r\n** moved as part of a database reorganization just before the transaction \r\n** is being committed. In this case, it is guaranteed that the database page \r\n** pPg refers to will not be written to again within this transaction.\r\n**\r\n** This function may return SQLITE_NOMEM or an IO error code if an error\r\n** occurs. Otherwise, it returns SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){\r\n  PgHdr *pPgOld;               /* The page being overwritten. */\r\n  Pgno needSyncPgno = 0;       /* Old value of pPg->pgno, if sync is required */\r\n  int rc;                      /* Return code */\r\n  Pgno origPgno;               /* The original page number */\r\n\r\n  assert( pPg->nRef>0 );\r\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD\r\n       || pPager->eState==PAGER_WRITER_DBMOD\r\n  );\r\n  assert( assert_pager_state(pPager) );\r\n\r\n  /* In order to be able to rollback, an in-memory database must journal\r\n  ** the page we are moving from.\r\n  */\r\n  if( MEMDB ){\r\n    rc = sqlite3PagerWrite(pPg);\r\n    if( rc ) return rc;\r\n  }\r\n\r\n  /* If the page being moved is dirty and has not been saved by the latest\r\n  ** savepoint, then save the current contents of the page into the \r\n  ** sub-journal now. This is required to handle the following scenario:\r\n  **\r\n  **   BEGIN;\r\n  **     <journal page X, then modify it in memory>\r\n  **     SAVEPOINT one;\r\n  **       <Move page X to location Y>\r\n  **     ROLLBACK TO one;\r\n  **\r\n  ** If page X were not written to the sub-journal here, it would not\r\n  ** be possible to restore its contents when the \"ROLLBACK TO one\"\r\n  ** statement were is processed.\r\n  **\r\n  ** subjournalPage() may need to allocate space to store pPg->pgno into\r\n  ** one or more savepoint bitvecs. This is the reason this function\r\n  ** may return SQLITE_NOMEM.\r\n  */\r\n  if( pPg->flags&PGHDR_DIRTY\r\n   && subjRequiresPage(pPg)\r\n   && SQLITE_OK!=(rc = subjournalPage(pPg))\r\n  ){\r\n    return rc;\r\n  }\r\n\r\n  PAGERTRACE((\"MOVE %d page %d (needSync=%d) moves to %d\\n\", \r\n      PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno));\r\n  IOTRACE((\"MOVE %p %d %d\\n\", pPager, pPg->pgno, pgno))\r\n\r\n  /* If the journal needs to be sync()ed before page pPg->pgno can\r\n  ** be written to, store pPg->pgno in local variable needSyncPgno.\r\n  **\r\n  ** If the isCommit flag is set, there is no need to remember that\r\n  ** the journal needs to be sync()ed before database page pPg->pgno \r\n  ** can be written to. The caller has already promised not to write to it.\r\n  */\r\n  if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){\r\n    needSyncPgno = pPg->pgno;\r\n    assert( pageInJournal(pPg) || pPg->pgno>pPager->dbOrigSize );\r\n    assert( pPg->flags&PGHDR_DIRTY );\r\n  }\r\n\r\n  /* If the cache contains a page with page-number pgno, remove it\r\n  ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for \r\n  ** page pgno before the 'move' operation, it needs to be retained \r\n  ** for the page moved there.\r\n  */\r\n  pPg->flags &= ~PGHDR_NEED_SYNC;\r\n  pPgOld = pager_lookup(pPager, pgno);\r\n  assert( !pPgOld || pPgOld->nRef==1 );\r\n  if( pPgOld ){\r\n    pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC);\r\n    if( MEMDB ){\r\n      /* Do not discard pages from an in-memory database since we might\r\n      ** need to rollback later.  Just move the page out of the way. */\r\n      sqlite3PcacheMove(pPgOld, pPager->dbSize+1);\r\n    }else{\r\n      sqlite3PcacheDrop(pPgOld);\r\n    }\r\n  }\r\n\r\n  origPgno = pPg->pgno;\r\n  sqlite3PcacheMove(pPg, pgno);\r\n  sqlite3PcacheMakeDirty(pPg);\r\n\r\n  /* For an in-memory database, make sure the original page continues\r\n  ** to exist, in case the transaction needs to roll back.  Use pPgOld\r\n  ** as the original page since it has already been allocated.\r\n  */\r\n  if( MEMDB ){\r\n    assert( pPgOld );\r\n    sqlite3PcacheMove(pPgOld, origPgno);\r\n    sqlite3PagerUnref(pPgOld);\r\n  }\r\n\r\n  if( needSyncPgno ){\r\n    /* If needSyncPgno is non-zero, then the journal file needs to be \r\n    ** sync()ed before any data is written to database file page needSyncPgno.\r\n    ** Currently, no such page exists in the page-cache and the \r\n    ** \"is journaled\" bitvec flag has been set. This needs to be remedied by\r\n    ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC\r\n    ** flag.\r\n    **\r\n    ** If the attempt to load the page into the page-cache fails, (due\r\n    ** to a malloc() or IO failure), clear the bit in the pInJournal[]\r\n    ** array. Otherwise, if the page is loaded and written again in\r\n    ** this transaction, it may be written to the database file before\r\n    ** it is synced into the journal file. This way, it may end up in\r\n    ** the journal file twice, but that is not a problem.\r\n    */\r\n    PgHdr *pPgHdr;\r\n    rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr);\r\n    if( rc!=SQLITE_OK ){\r\n      if( needSyncPgno<=pPager->dbOrigSize ){\r\n        assert( pPager->pTmpSpace!=0 );\r\n        sqlite3BitvecClear(pPager->pInJournal, needSyncPgno, pPager->pTmpSpace);\r\n      }\r\n      return rc;\r\n    }\r\n    pPgHdr->flags |= PGHDR_NEED_SYNC;\r\n    sqlite3PcacheMakeDirty(pPgHdr);\r\n    sqlite3PagerUnref(pPgHdr);\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n/*\r\n** Return a pointer to the data for the specified page.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){\r\n  assert( pPg->nRef>0 || pPg->pPager->memDb );\r\n  return pPg->pData;\r\n}\r\n\r\n/*\r\n** Return a pointer to the Pager.nExtra bytes of \"extra\" space \r\n** allocated along with the specified page.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){\r\n  return pPg->pExtra;\r\n}\r\n\r\n/*\r\n** Get/set the locking-mode for this pager. Parameter eMode must be one\r\n** of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or \r\n** PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then\r\n** the locking-mode is set to the value specified.\r\n**\r\n** The returned value is either PAGER_LOCKINGMODE_NORMAL or\r\n** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated)\r\n** locking-mode.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){\r\n  assert( eMode==PAGER_LOCKINGMODE_QUERY\r\n            || eMode==PAGER_LOCKINGMODE_NORMAL\r\n            || eMode==PAGER_LOCKINGMODE_EXCLUSIVE );\r\n  assert( PAGER_LOCKINGMODE_QUERY<0 );\r\n  assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 );\r\n  assert( pPager->exclusiveMode || 0==sqlite3WalHeapMemory(pPager->pWal) );\r\n  if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){\r\n    pPager->exclusiveMode = (u8)eMode;\r\n  }\r\n  return (int)pPager->exclusiveMode;\r\n}\r\n\r\n/*\r\n** Set the journal-mode for this pager. Parameter eMode must be one of:\r\n**\r\n**    PAGER_JOURNALMODE_DELETE\r\n**    PAGER_JOURNALMODE_TRUNCATE\r\n**    PAGER_JOURNALMODE_PERSIST\r\n**    PAGER_JOURNALMODE_OFF\r\n**    PAGER_JOURNALMODE_MEMORY\r\n**    PAGER_JOURNALMODE_WAL\r\n**\r\n** The journalmode is set to the value specified if the change is allowed.\r\n** The change may be disallowed for the following reasons:\r\n**\r\n**   *  An in-memory database can only have its journal_mode set to _OFF\r\n**      or _MEMORY.\r\n**\r\n**   *  Temporary databases cannot have _WAL journalmode.\r\n**\r\n** The returned indicate the current (possibly updated) journal-mode.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){\r\n  u8 eOld = pPager->journalMode;    /* Prior journalmode */\r\n\r\n#ifdef SQLITE_DEBUG\r\n  /* The print_pager_state() routine is intended to be used by the debugger\r\n  ** only.  We invoke it once here to suppress a compiler warning. */\r\n  print_pager_state(pPager);\r\n#endif\r\n\r\n\r\n  /* The eMode parameter is always valid */\r\n  assert(      eMode==PAGER_JOURNALMODE_DELETE\r\n            || eMode==PAGER_JOURNALMODE_TRUNCATE\r\n            || eMode==PAGER_JOURNALMODE_PERSIST\r\n            || eMode==PAGER_JOURNALMODE_OFF \r\n            || eMode==PAGER_JOURNALMODE_WAL \r\n            || eMode==PAGER_JOURNALMODE_MEMORY );\r\n\r\n  /* This routine is only called from the OP_JournalMode opcode, and\r\n  ** the logic there will never allow a temporary file to be changed\r\n  ** to WAL mode.\r\n  */\r\n  assert( pPager->tempFile==0 || eMode!=PAGER_JOURNALMODE_WAL );\r\n\r\n  /* Do allow the journalmode of an in-memory database to be set to\r\n  ** anything other than MEMORY or OFF\r\n  */\r\n  if( MEMDB ){\r\n    assert( eOld==PAGER_JOURNALMODE_MEMORY || eOld==PAGER_JOURNALMODE_OFF );\r\n    if( eMode!=PAGER_JOURNALMODE_MEMORY && eMode!=PAGER_JOURNALMODE_OFF ){\r\n      eMode = eOld;\r\n    }\r\n  }\r\n\r\n  if( eMode!=eOld ){\r\n\r\n    /* Change the journal mode. */\r\n    assert( pPager->eState!=PAGER_ERROR );\r\n    pPager->journalMode = (u8)eMode;\r\n\r\n    /* When transistioning from TRUNCATE or PERSIST to any other journal\r\n    ** mode except WAL, unless the pager is in locking_mode=exclusive mode,\r\n    ** delete the journal file.\r\n    */\r\n    assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );\r\n    assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 );\r\n    assert( (PAGER_JOURNALMODE_DELETE & 5)==0 );\r\n    assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 );\r\n    assert( (PAGER_JOURNALMODE_OFF & 5)==0 );\r\n    assert( (PAGER_JOURNALMODE_WAL & 5)==5 );\r\n\r\n    assert( isOpen(pPager->fd) || pPager->exclusiveMode );\r\n    if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){\r\n\r\n      /* In this case we would like to delete the journal file. If it is\r\n      ** not possible, then that is not a problem. Deleting the journal file\r\n      ** here is an optimization only.\r\n      **\r\n      ** Before deleting the journal file, obtain a RESERVED lock on the\r\n      ** database file. This ensures that the journal file is not deleted\r\n      ** while it is in use by some other client.\r\n      */\r\n      sqlite3OsClose(pPager->jfd);\r\n      if( pPager->eLock>=RESERVED_LOCK ){\r\n        sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);\r\n      }else{\r\n        int rc = SQLITE_OK;\r\n        int state = pPager->eState;\r\n        assert( state==PAGER_OPEN || state==PAGER_READER );\r\n        if( state==PAGER_OPEN ){\r\n          rc = sqlite3PagerSharedLock(pPager);\r\n        }\r\n        if( pPager->eState==PAGER_READER ){\r\n          assert( rc==SQLITE_OK );\r\n          rc = pagerLockDb(pPager, RESERVED_LOCK);\r\n        }\r\n        if( rc==SQLITE_OK ){\r\n          sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);\r\n        }\r\n        if( rc==SQLITE_OK && state==PAGER_READER ){\r\n          pagerUnlockDb(pPager, SHARED_LOCK);\r\n        }else if( state==PAGER_OPEN ){\r\n          pager_unlock(pPager);\r\n        }\r\n        assert( state==pPager->eState );\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Return the new journal mode */\r\n  return (int)pPager->journalMode;\r\n}\r\n\r\n/*\r\n** Return the current journal mode.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){\r\n  return (int)pPager->journalMode;\r\n}\r\n\r\n/*\r\n** Return TRUE if the pager is in a state where it is OK to change the\r\n** journalmode.  Journalmode changes can only happen when the database\r\n** is unmodified.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){\r\n  assert( assert_pager_state(pPager) );\r\n  if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;\r\n  if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Get/set the size-limit used for persistent journal files.\r\n**\r\n** Setting the size limit to -1 means no limit is enforced.\r\n** An attempt to set a limit smaller than -1 is a no-op.\r\n*/\r\nSQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){\r\n  if( iLimit>=-1 ){\r\n    pPager->journalSizeLimit = iLimit;\r\n    sqlite3WalLimit(pPager->pWal, iLimit);\r\n  }\r\n  return pPager->journalSizeLimit;\r\n}\r\n\r\n/*\r\n** Return a pointer to the pPager->pBackup variable. The backup module\r\n** in backup.c maintains the content of this variable. This module\r\n** uses it opaquely as an argument to sqlite3BackupRestart() and\r\n** sqlite3BackupUpdate() only.\r\n*/\r\nSQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){\r\n  return &pPager->pBackup;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_VACUUM\r\n/*\r\n** Unless this is an in-memory or temporary database, clear the pager cache.\r\n*/\r\nSQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){\r\n  if( !MEMDB && pPager->tempFile==0 ) pager_reset(pPager);\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/*\r\n** This function is called when the user invokes \"PRAGMA wal_checkpoint\",\r\n** \"PRAGMA wal_blocking_checkpoint\" or calls the sqlite3_wal_checkpoint()\r\n** or wal_blocking_checkpoint() API functions.\r\n**\r\n** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){\r\n  int rc = SQLITE_OK;\r\n  if( pPager->pWal ){\r\n    rc = sqlite3WalCheckpoint(pPager->pWal, eMode,\r\n        pPager->xBusyHandler, pPager->pBusyHandlerArg,\r\n        pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,\r\n        pnLog, pnCkpt\r\n    );\r\n  }\r\n  return rc;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){\r\n  return sqlite3WalCallback(pPager->pWal);\r\n}\r\n\r\n/*\r\n** Return true if the underlying VFS for the given pager supports the\r\n** primitives necessary for write-ahead logging.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){\r\n  const sqlite3_io_methods *pMethods = pPager->fd->pMethods;\r\n  return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);\r\n}\r\n\r\n/*\r\n** Attempt to take an exclusive lock on the database file. If a PENDING lock\r\n** is obtained instead, immediately release it.\r\n*/\r\nstatic int pagerExclusiveLock(Pager *pPager){\r\n  int rc;                         /* Return code */\r\n\r\n  assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );\r\n  rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);\r\n  if( rc!=SQLITE_OK ){\r\n    /* If the attempt to grab the exclusive lock failed, release the \r\n    ** pending lock that may have been obtained instead.  */\r\n    pagerUnlockDb(pPager, SHARED_LOCK);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Call sqlite3WalOpen() to open the WAL handle. If the pager is in \r\n** exclusive-locking mode when this function is called, take an EXCLUSIVE\r\n** lock on the database file and use heap-memory to store the wal-index\r\n** in. Otherwise, use the normal shared-memory.\r\n*/\r\nstatic int pagerOpenWal(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pPager->pWal==0 && pPager->tempFile==0 );\r\n  assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );\r\n\r\n  /* If the pager is already in exclusive-mode, the WAL module will use \r\n  ** heap-memory for the wal-index instead of the VFS shared-memory \r\n  ** implementation. Take the exclusive lock now, before opening the WAL\r\n  ** file, to make sure this is safe.\r\n  */\r\n  if( pPager->exclusiveMode ){\r\n    rc = pagerExclusiveLock(pPager);\r\n  }\r\n\r\n  /* Open the connection to the log file. If this operation fails, \r\n  ** (e.g. due to malloc() failure), return an error code.\r\n  */\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3WalOpen(pPager->pVfs, \r\n        pPager->fd, pPager->zWal, pPager->exclusiveMode,\r\n        pPager->journalSizeLimit, &pPager->pWal\r\n    );\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** The caller must be holding a SHARED lock on the database file to call\r\n** this function.\r\n**\r\n** If the pager passed as the first argument is open on a real database\r\n** file (not a temp file or an in-memory database), and the WAL file\r\n** is not already open, make an attempt to open it now. If successful,\r\n** return SQLITE_OK. If an error occurs or the VFS used by the pager does \r\n** not support the xShmXXX() methods, return an error code. *pbOpen is\r\n** not modified in either case.\r\n**\r\n** If the pager is open on a temp-file (or in-memory database), or if\r\n** the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK\r\n** without doing anything.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerOpenWal(\r\n  Pager *pPager,                  /* Pager object */\r\n  int *pbOpen                     /* OUT: Set to true if call is a no-op */\r\n){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n\r\n  assert( assert_pager_state(pPager) );\r\n  assert( pPager->eState==PAGER_OPEN   || pbOpen );\r\n  assert( pPager->eState==PAGER_READER || !pbOpen );\r\n  assert( pbOpen==0 || *pbOpen==0 );\r\n  assert( pbOpen!=0 || (!pPager->tempFile && !pPager->pWal) );\r\n\r\n  if( !pPager->tempFile && !pPager->pWal ){\r\n    if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN;\r\n\r\n    /* Close any rollback journal previously open */\r\n    sqlite3OsClose(pPager->jfd);\r\n\r\n    rc = pagerOpenWal(pPager);\r\n    if( rc==SQLITE_OK ){\r\n      pPager->journalMode = PAGER_JOURNALMODE_WAL;\r\n      pPager->eState = PAGER_OPEN;\r\n    }\r\n  }else{\r\n    *pbOpen = 1;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called to close the connection to the log file prior\r\n** to switching from WAL to rollback mode.\r\n**\r\n** Before closing the log file, this function attempts to take an \r\n** EXCLUSIVE lock on the database file. If this cannot be obtained, an\r\n** error (SQLITE_BUSY) is returned and the log connection is not closed.\r\n** If successful, the EXCLUSIVE lock is not released before returning.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pPager->journalMode==PAGER_JOURNALMODE_WAL );\r\n\r\n  /* If the log file is not already open, but does exist in the file-system,\r\n  ** it may need to be checkpointed before the connection can switch to\r\n  ** rollback mode. Open it now so this can happen.\r\n  */\r\n  if( !pPager->pWal ){\r\n    int logexists = 0;\r\n    rc = pagerLockDb(pPager, SHARED_LOCK);\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3OsAccess(\r\n          pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists\r\n      );\r\n    }\r\n    if( rc==SQLITE_OK && logexists ){\r\n      rc = pagerOpenWal(pPager);\r\n    }\r\n  }\r\n    \r\n  /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on\r\n  ** the database file, the log and log-summary files will be deleted.\r\n  */\r\n  if( rc==SQLITE_OK && pPager->pWal ){\r\n    rc = pagerExclusiveLock(pPager);\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags,\r\n                           pPager->pageSize, (u8*)pPager->pTmpSpace);\r\n      pPager->pWal = 0;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_ZIPVFS\r\n/*\r\n** A read-lock must be held on the pager when this function is called. If\r\n** the pager is in WAL mode and the WAL file currently contains one or more\r\n** frames, return the size in bytes of the page images stored within the\r\n** WAL frames. Otherwise, if this is not a WAL database or the WAL file\r\n** is empty, return 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){\r\n  assert( pPager->eState==PAGER_READER );\r\n  return sqlite3WalFramesize(pPager->pWal);\r\n}\r\n#endif\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n/*\r\n** This function is called by the wal module when writing page content\r\n** into the log file.\r\n**\r\n** This function returns a pointer to a buffer containing the encrypted\r\n** page content. If a malloc fails, this function may return NULL.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3PagerCodec(PgHdr *pPg){\r\n  void *aData = 0;\r\n  CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData);\r\n  return aData;\r\n}\r\n#endif /* SQLITE_HAS_CODEC */\r\n\r\n#endif /* !SQLITE_OMIT_WAL */\r\n\r\n#endif /* SQLITE_OMIT_DISKIO */\r\n\r\n/************** End of pager.c ***********************************************/\r\n/************** Begin file wal.c *********************************************/\r\n/*\r\n** 2010 February 1\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains the implementation of a write-ahead log (WAL) used in \r\n** \"journal_mode=WAL\" mode.\r\n**\r\n** WRITE-AHEAD LOG (WAL) FILE FORMAT\r\n**\r\n** A WAL file consists of a header followed by zero or more \"frames\".\r\n** Each frame records the revised content of a single page from the\r\n** database file.  All changes to the database are recorded by writing\r\n** frames into the WAL.  Transactions commit when a frame is written that\r\n** contains a commit marker.  A single WAL can and usually does record \r\n** multiple transactions.  Periodically, the content of the WAL is\r\n** transferred back into the database file in an operation called a\r\n** \"checkpoint\".\r\n**\r\n** A single WAL file can be used multiple times.  In other words, the\r\n** WAL can fill up with frames and then be checkpointed and then new\r\n** frames can overwrite the old ones.  A WAL always grows from beginning\r\n** toward the end.  Checksums and counters attached to each frame are\r\n** used to determine which frames within the WAL are valid and which\r\n** are leftovers from prior checkpoints.\r\n**\r\n** The WAL header is 32 bytes in size and consists of the following eight\r\n** big-endian 32-bit unsigned integer values:\r\n**\r\n**     0: Magic number.  0x377f0682 or 0x377f0683\r\n**     4: File format version.  Currently 3007000\r\n**     8: Database page size.  Example: 1024\r\n**    12: Checkpoint sequence number\r\n**    16: Salt-1, random integer incremented with each checkpoint\r\n**    20: Salt-2, a different random integer changing with each ckpt\r\n**    24: Checksum-1 (first part of checksum for first 24 bytes of header).\r\n**    28: Checksum-2 (second part of checksum for first 24 bytes of header).\r\n**\r\n** Immediately following the wal-header are zero or more frames. Each\r\n** frame consists of a 24-byte frame-header followed by a <page-size> bytes\r\n** of page data. The frame-header is six big-endian 32-bit unsigned \r\n** integer values, as follows:\r\n**\r\n**     0: Page number.\r\n**     4: For commit records, the size of the database image in pages \r\n**        after the commit. For all other records, zero.\r\n**     8: Salt-1 (copied from the header)\r\n**    12: Salt-2 (copied from the header)\r\n**    16: Checksum-1.\r\n**    20: Checksum-2.\r\n**\r\n** A frame is considered valid if and only if the following conditions are\r\n** true:\r\n**\r\n**    (1) The salt-1 and salt-2 values in the frame-header match\r\n**        salt values in the wal-header\r\n**\r\n**    (2) The checksum values in the final 8 bytes of the frame-header\r\n**        exactly match the checksum computed consecutively on the\r\n**        WAL header and the first 8 bytes and the content of all frames\r\n**        up to and including the current frame.\r\n**\r\n** The checksum is computed using 32-bit big-endian integers if the\r\n** magic number in the first 4 bytes of the WAL is 0x377f0683 and it\r\n** is computed using little-endian if the magic number is 0x377f0682.\r\n** The checksum values are always stored in the frame header in a\r\n** big-endian format regardless of which byte order is used to compute\r\n** the checksum.  The checksum is computed by interpreting the input as\r\n** an even number of unsigned 32-bit integers: x[0] through x[N].  The\r\n** algorithm used for the checksum is as follows:\r\n** \r\n**   for i from 0 to n-1 step 2:\r\n**     s0 += x[i] + s1;\r\n**     s1 += x[i+1] + s0;\r\n**   endfor\r\n**\r\n** Note that s0 and s1 are both weighted checksums using fibonacci weights\r\n** in reverse order (the largest fibonacci weight occurs on the first element\r\n** of the sequence being summed.)  The s1 value spans all 32-bit \r\n** terms of the sequence whereas s0 omits the final term.\r\n**\r\n** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the\r\n** WAL is transferred into the database, then the database is VFS.xSync-ed.\r\n** The VFS.xSync operations serve as write barriers - all writes launched\r\n** before the xSync must complete before any write that launches after the\r\n** xSync begins.\r\n**\r\n** After each checkpoint, the salt-1 value is incremented and the salt-2\r\n** value is randomized.  This prevents old and new frames in the WAL from\r\n** being considered valid at the same time and being checkpointing together\r\n** following a crash.\r\n**\r\n** READER ALGORITHM\r\n**\r\n** To read a page from the database (call it page number P), a reader\r\n** first checks the WAL to see if it contains page P.  If so, then the\r\n** last valid instance of page P that is a followed by a commit frame\r\n** or is a commit frame itself becomes the value read.  If the WAL\r\n** contains no copies of page P that are valid and which are a commit\r\n** frame or are followed by a commit frame, then page P is read from\r\n** the database file.\r\n**\r\n** To start a read transaction, the reader records the index of the last\r\n** valid frame in the WAL.  The reader uses this recorded \"mxFrame\" value\r\n** for all subsequent read operations.  New transactions can be appended\r\n** to the WAL, but as long as the reader uses its original mxFrame value\r\n** and ignores the newly appended content, it will see a consistent snapshot\r\n** of the database from a single point in time.  This technique allows\r\n** multiple concurrent readers to view different versions of the database\r\n** content simultaneously.\r\n**\r\n** The reader algorithm in the previous paragraphs works correctly, but \r\n** because frames for page P can appear anywhere within the WAL, the\r\n** reader has to scan the entire WAL looking for page P frames.  If the\r\n** WAL is large (multiple megabytes is typical) that scan can be slow,\r\n** and read performance suffers.  To overcome this problem, a separate\r\n** data structure called the wal-index is maintained to expedite the\r\n** search for frames of a particular page.\r\n** \r\n** WAL-INDEX FORMAT\r\n**\r\n** Conceptually, the wal-index is shared memory, though VFS implementations\r\n** might choose to implement the wal-index using a mmapped file.  Because\r\n** the wal-index is shared memory, SQLite does not support journal_mode=WAL \r\n** on a network filesystem.  All users of the database must be able to\r\n** share memory.\r\n**\r\n** The wal-index is transient.  After a crash, the wal-index can (and should\r\n** be) reconstructed from the original WAL file.  In fact, the VFS is required\r\n** to either truncate or zero the header of the wal-index when the last\r\n** connection to it closes.  Because the wal-index is transient, it can\r\n** use an architecture-specific format; it does not have to be cross-platform.\r\n** Hence, unlike the database and WAL file formats which store all values\r\n** as big endian, the wal-index can store multi-byte values in the native\r\n** byte order of the host computer.\r\n**\r\n** The purpose of the wal-index is to answer this question quickly:  Given\r\n** a page number P, return the index of the last frame for page P in the WAL,\r\n** or return NULL if there are no frames for page P in the WAL.\r\n**\r\n** The wal-index consists of a header region, followed by an one or\r\n** more index blocks.  \r\n**\r\n** The wal-index header contains the total number of frames within the WAL\r\n** in the the mxFrame field.  \r\n**\r\n** Each index block except for the first contains information on \r\n** HASHTABLE_NPAGE frames. The first index block contains information on\r\n** HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and \r\n** HASHTABLE_NPAGE are selected so that together the wal-index header and\r\n** first index block are the same size as all other index blocks in the\r\n** wal-index.\r\n**\r\n** Each index block contains two sections, a page-mapping that contains the\r\n** database page number associated with each wal frame, and a hash-table \r\n** that allows readers to query an index block for a specific page number.\r\n** The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE\r\n** for the first index block) 32-bit page numbers. The first entry in the \r\n** first index-block contains the database page number corresponding to the\r\n** first frame in the WAL file. The first entry in the second index block\r\n** in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in\r\n** the log, and so on.\r\n**\r\n** The last index block in a wal-index usually contains less than the full\r\n** complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers,\r\n** depending on the contents of the WAL file. This does not change the\r\n** allocated size of the page-mapping array - the page-mapping array merely\r\n** contains unused entries.\r\n**\r\n** Even without using the hash table, the last frame for page P\r\n** can be found by scanning the page-mapping sections of each index block\r\n** starting with the last index block and moving toward the first, and\r\n** within each index block, starting at the end and moving toward the\r\n** beginning.  The first entry that equals P corresponds to the frame\r\n** holding the content for that page.\r\n**\r\n** The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers.\r\n** HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the\r\n** hash table for each page number in the mapping section, so the hash \r\n** table is never more than half full.  The expected number of collisions \r\n** prior to finding a match is 1.  Each entry of the hash table is an\r\n** 1-based index of an entry in the mapping section of the same\r\n** index block.   Let K be the 1-based index of the largest entry in\r\n** the mapping section.  (For index blocks other than the last, K will\r\n** always be exactly HASHTABLE_NPAGE (4096) and for the last index block\r\n** K will be (mxFrame%HASHTABLE_NPAGE).)  Unused slots of the hash table\r\n** contain a value of 0.\r\n**\r\n** To look for page P in the hash table, first compute a hash iKey on\r\n** P as follows:\r\n**\r\n**      iKey = (P * 383) % HASHTABLE_NSLOT\r\n**\r\n** Then start scanning entries of the hash table, starting with iKey\r\n** (wrapping around to the beginning when the end of the hash table is\r\n** reached) until an unused hash slot is found. Let the first unused slot\r\n** be at index iUnused.  (iUnused might be less than iKey if there was\r\n** wrap-around.) Because the hash table is never more than half full,\r\n** the search is guaranteed to eventually hit an unused entry.  Let \r\n** iMax be the value between iKey and iUnused, closest to iUnused,\r\n** where aHash[iMax]==P.  If there is no iMax entry (if there exists\r\n** no hash slot such that aHash[i]==p) then page P is not in the\r\n** current index block.  Otherwise the iMax-th mapping entry of the\r\n** current index block corresponds to the last entry that references \r\n** page P.\r\n**\r\n** A hash search begins with the last index block and moves toward the\r\n** first index block, looking for entries corresponding to page P.  On\r\n** average, only two or three slots in each index block need to be\r\n** examined in order to either find the last entry for page P, or to\r\n** establish that no such entry exists in the block.  Each index block\r\n** holds over 4000 entries.  So two or three index blocks are sufficient\r\n** to cover a typical 10 megabyte WAL file, assuming 1K pages.  8 or 10\r\n** comparisons (on average) suffice to either locate a frame in the\r\n** WAL or to establish that the frame does not exist in the WAL.  This\r\n** is much faster than scanning the entire 10MB WAL.\r\n**\r\n** Note that entries are added in order of increasing K.  Hence, one\r\n** reader might be using some value K0 and a second reader that started\r\n** at a later time (after additional transactions were added to the WAL\r\n** and to the wal-index) might be using a different value K1, where K1>K0.\r\n** Both readers can use the same hash table and mapping section to get\r\n** the correct result.  There may be entries in the hash table with\r\n** K>K0 but to the first reader, those entries will appear to be unused\r\n** slots in the hash table and so the first reader will get an answer as\r\n** if no values greater than K0 had ever been inserted into the hash table\r\n** in the first place - which is what reader one wants.  Meanwhile, the\r\n** second reader using K1 will see additional values that were inserted\r\n** later, which is exactly what reader two wants.  \r\n**\r\n** When a rollback occurs, the value of K is decreased. Hash table entries\r\n** that correspond to frames greater than the new K value are removed\r\n** from the hash table at this point.\r\n*/\r\n#ifndef SQLITE_OMIT_WAL\r\n\r\n\r\n/*\r\n** Trace output macros\r\n*/\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\nSQLITE_PRIVATE int sqlite3WalTrace = 0;\r\n# define WALTRACE(X)  if(sqlite3WalTrace) sqlite3DebugPrintf X\r\n#else\r\n# define WALTRACE(X)\r\n#endif\r\n\r\n/*\r\n** The maximum (and only) versions of the wal and wal-index formats\r\n** that may be interpreted by this version of SQLite.\r\n**\r\n** If a client begins recovering a WAL file and finds that (a) the checksum\r\n** values in the wal-header are correct and (b) the version field is not\r\n** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN.\r\n**\r\n** Similarly, if a client successfully reads a wal-index header (i.e. the \r\n** checksum test is successful) and finds that the version field is not\r\n** WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite\r\n** returns SQLITE_CANTOPEN.\r\n*/\r\n#define WAL_MAX_VERSION      3007000\r\n#define WALINDEX_MAX_VERSION 3007000\r\n\r\n/*\r\n** Indices of various locking bytes.   WAL_NREADER is the number\r\n** of available reader locks and should be at least 3.\r\n*/\r\n#define WAL_WRITE_LOCK         0\r\n#define WAL_ALL_BUT_WRITE      1\r\n#define WAL_CKPT_LOCK          1\r\n#define WAL_RECOVER_LOCK       2\r\n#define WAL_READ_LOCK(I)       (3+(I))\r\n#define WAL_NREADER            (SQLITE_SHM_NLOCK-3)\r\n\r\n\r\n/* Object declarations */\r\ntypedef struct WalIndexHdr WalIndexHdr;\r\ntypedef struct WalIterator WalIterator;\r\ntypedef struct WalCkptInfo WalCkptInfo;\r\n\r\n\r\n/*\r\n** The following object holds a copy of the wal-index header content.\r\n**\r\n** The actual header in the wal-index consists of two copies of this\r\n** object.\r\n**\r\n** The szPage value can be any power of 2 between 512 and 32768, inclusive.\r\n** Or it can be 1 to represent a 65536-byte page.  The latter case was\r\n** added in 3.7.1 when support for 64K pages was added.  \r\n*/\r\nstruct WalIndexHdr {\r\n  u32 iVersion;                   /* Wal-index version */\r\n  u32 unused;                     /* Unused (padding) field */\r\n  u32 iChange;                    /* Counter incremented each transaction */\r\n  u8 isInit;                      /* 1 when initialized */\r\n  u8 bigEndCksum;                 /* True if checksums in WAL are big-endian */\r\n  u16 szPage;                     /* Database page size in bytes. 1==64K */\r\n  u32 mxFrame;                    /* Index of last valid frame in the WAL */\r\n  u32 nPage;                      /* Size of database in pages */\r\n  u32 aFrameCksum[2];             /* Checksum of last frame in log */\r\n  u32 aSalt[2];                   /* Two salt values copied from WAL header */\r\n  u32 aCksum[2];                  /* Checksum over all prior fields */\r\n};\r\n\r\n/*\r\n** A copy of the following object occurs in the wal-index immediately\r\n** following the second copy of the WalIndexHdr.  This object stores\r\n** information used by checkpoint.\r\n**\r\n** nBackfill is the number of frames in the WAL that have been written\r\n** back into the database. (We call the act of moving content from WAL to\r\n** database \"backfilling\".)  The nBackfill number is never greater than\r\n** WalIndexHdr.mxFrame.  nBackfill can only be increased by threads\r\n** holding the WAL_CKPT_LOCK lock (which includes a recovery thread).\r\n** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from\r\n** mxFrame back to zero when the WAL is reset.\r\n**\r\n** There is one entry in aReadMark[] for each reader lock.  If a reader\r\n** holds read-lock K, then the value in aReadMark[K] is no greater than\r\n** the mxFrame for that reader.  The value READMARK_NOT_USED (0xffffffff)\r\n** for any aReadMark[] means that entry is unused.  aReadMark[0] is \r\n** a special case; its value is never used and it exists as a place-holder\r\n** to avoid having to offset aReadMark[] indexs by one.  Readers holding\r\n** WAL_READ_LOCK(0) always ignore the entire WAL and read all content\r\n** directly from the database.\r\n**\r\n** The value of aReadMark[K] may only be changed by a thread that\r\n** is holding an exclusive lock on WAL_READ_LOCK(K).  Thus, the value of\r\n** aReadMark[K] cannot changed while there is a reader is using that mark\r\n** since the reader will be holding a shared lock on WAL_READ_LOCK(K).\r\n**\r\n** The checkpointer may only transfer frames from WAL to database where\r\n** the frame numbers are less than or equal to every aReadMark[] that is\r\n** in use (that is, every aReadMark[j] for which there is a corresponding\r\n** WAL_READ_LOCK(j)).  New readers (usually) pick the aReadMark[] with the\r\n** largest value and will increase an unused aReadMark[] to mxFrame if there\r\n** is not already an aReadMark[] equal to mxFrame.  The exception to the\r\n** previous sentence is when nBackfill equals mxFrame (meaning that everything\r\n** in the WAL has been backfilled into the database) then new readers\r\n** will choose aReadMark[0] which has value 0 and hence such reader will\r\n** get all their all content directly from the database file and ignore \r\n** the WAL.\r\n**\r\n** Writers normally append new frames to the end of the WAL.  However,\r\n** if nBackfill equals mxFrame (meaning that all WAL content has been\r\n** written back into the database) and if no readers are using the WAL\r\n** (in other words, if there are no WAL_READ_LOCK(i) where i>0) then\r\n** the writer will first \"reset\" the WAL back to the beginning and start\r\n** writing new content beginning at frame 1.\r\n**\r\n** We assume that 32-bit loads are atomic and so no locks are needed in\r\n** order to read from any aReadMark[] entries.\r\n*/\r\nstruct WalCkptInfo {\r\n  u32 nBackfill;                  /* Number of WAL frames backfilled into DB */\r\n  u32 aReadMark[WAL_NREADER];     /* Reader marks */\r\n};\r\n#define READMARK_NOT_USED  0xffffffff\r\n\r\n\r\n/* A block of WALINDEX_LOCK_RESERVED bytes beginning at\r\n** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems\r\n** only support mandatory file-locks, we do not read or write data\r\n** from the region of the file on which locks are applied.\r\n*/\r\n#define WALINDEX_LOCK_OFFSET   (sizeof(WalIndexHdr)*2 + sizeof(WalCkptInfo))\r\n#define WALINDEX_LOCK_RESERVED 16\r\n#define WALINDEX_HDR_SIZE      (WALINDEX_LOCK_OFFSET+WALINDEX_LOCK_RESERVED)\r\n\r\n/* Size of header before each frame in wal */\r\n#define WAL_FRAME_HDRSIZE 24\r\n\r\n/* Size of write ahead log header, including checksum. */\r\n/* #define WAL_HDRSIZE 24 */\r\n#define WAL_HDRSIZE 32\r\n\r\n/* WAL magic value. Either this value, or the same value with the least\r\n** significant bit also set (WAL_MAGIC | 0x00000001) is stored in 32-bit\r\n** big-endian format in the first 4 bytes of a WAL file.\r\n**\r\n** If the LSB is set, then the checksums for each frame within the WAL\r\n** file are calculated by treating all data as an array of 32-bit \r\n** big-endian words. Otherwise, they are calculated by interpreting \r\n** all data as 32-bit little-endian words.\r\n*/\r\n#define WAL_MAGIC 0x377f0682\r\n\r\n/*\r\n** Return the offset of frame iFrame in the write-ahead log file, \r\n** assuming a database page size of szPage bytes. The offset returned\r\n** is to the start of the write-ahead log frame-header.\r\n*/\r\n#define walFrameOffset(iFrame, szPage) (                               \\\r\n  WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE)         \\\r\n)\r\n\r\n/*\r\n** An open write-ahead log file is represented by an instance of the\r\n** following object.\r\n*/\r\nstruct Wal {\r\n  sqlite3_vfs *pVfs;         /* The VFS used to create pDbFd */\r\n  sqlite3_file *pDbFd;       /* File handle for the database file */\r\n  sqlite3_file *pWalFd;      /* File handle for WAL file */\r\n  u32 iCallback;             /* Value to pass to log callback (or 0) */\r\n  i64 mxWalSize;             /* Truncate WAL to this size upon reset */\r\n  int nWiData;               /* Size of array apWiData */\r\n  int szFirstBlock;          /* Size of first block written to WAL file */\r\n  volatile u32 **apWiData;   /* Pointer to wal-index content in memory */\r\n  u32 szPage;                /* Database page size */\r\n  i16 readLock;              /* Which read lock is being held.  -1 for none */\r\n  u8 syncFlags;              /* Flags to use to sync header writes */\r\n  u8 exclusiveMode;          /* Non-zero if connection is in exclusive mode */\r\n  u8 writeLock;              /* True if in a write transaction */\r\n  u8 ckptLock;               /* True if holding a checkpoint lock */\r\n  u8 readOnly;               /* WAL_RDWR, WAL_RDONLY, or WAL_SHM_RDONLY */\r\n  u8 truncateOnCommit;       /* True to truncate WAL file on commit */\r\n  u8 syncHeader;             /* Fsync the WAL header if true */\r\n  u8 padToSectorBoundary;    /* Pad transactions out to the next sector */\r\n  WalIndexHdr hdr;           /* Wal-index header for current transaction */\r\n  const char *zWalName;      /* Name of WAL file */\r\n  u32 nCkpt;                 /* Checkpoint sequence counter in the wal-header */\r\n#ifdef SQLITE_DEBUG\r\n  u8 lockError;              /* True if a locking error has occurred */\r\n#endif\r\n};\r\n\r\n/*\r\n** Candidate values for Wal.exclusiveMode.\r\n*/\r\n#define WAL_NORMAL_MODE     0\r\n#define WAL_EXCLUSIVE_MODE  1     \r\n#define WAL_HEAPMEMORY_MODE 2\r\n\r\n/*\r\n** Possible values for WAL.readOnly\r\n*/\r\n#define WAL_RDWR        0    /* Normal read/write connection */\r\n#define WAL_RDONLY      1    /* The WAL file is readonly */\r\n#define WAL_SHM_RDONLY  2    /* The SHM file is readonly */\r\n\r\n/*\r\n** Each page of the wal-index mapping contains a hash-table made up of\r\n** an array of HASHTABLE_NSLOT elements of the following type.\r\n*/\r\ntypedef u16 ht_slot;\r\n\r\n/*\r\n** This structure is used to implement an iterator that loops through\r\n** all frames in the WAL in database page order. Where two or more frames\r\n** correspond to the same database page, the iterator visits only the \r\n** frame most recently written to the WAL (in other words, the frame with\r\n** the largest index).\r\n**\r\n** The internals of this structure are only accessed by:\r\n**\r\n**   walIteratorInit() - Create a new iterator,\r\n**   walIteratorNext() - Step an iterator,\r\n**   walIteratorFree() - Free an iterator.\r\n**\r\n** This functionality is used by the checkpoint code (see walCheckpoint()).\r\n*/\r\nstruct WalIterator {\r\n  int iPrior;                     /* Last result returned from the iterator */\r\n  int nSegment;                   /* Number of entries in aSegment[] */\r\n  struct WalSegment {\r\n    int iNext;                    /* Next slot in aIndex[] not yet returned */\r\n    ht_slot *aIndex;              /* i0, i1, i2... such that aPgno[iN] ascend */\r\n    u32 *aPgno;                   /* Array of page numbers. */\r\n    int nEntry;                   /* Nr. of entries in aPgno[] and aIndex[] */\r\n    int iZero;                    /* Frame number associated with aPgno[0] */\r\n  } aSegment[1];                  /* One for every 32KB page in the wal-index */\r\n};\r\n\r\n/*\r\n** Define the parameters of the hash tables in the wal-index file. There\r\n** is a hash-table following every HASHTABLE_NPAGE page numbers in the\r\n** wal-index.\r\n**\r\n** Changing any of these constants will alter the wal-index format and\r\n** create incompatibilities.\r\n*/\r\n#define HASHTABLE_NPAGE      4096                 /* Must be power of 2 */\r\n#define HASHTABLE_HASH_1     383                  /* Should be prime */\r\n#define HASHTABLE_NSLOT      (HASHTABLE_NPAGE*2)  /* Must be a power of 2 */\r\n\r\n/* \r\n** The block of page numbers associated with the first hash-table in a\r\n** wal-index is smaller than usual. This is so that there is a complete\r\n** hash-table on each aligned 32KB page of the wal-index.\r\n*/\r\n#define HASHTABLE_NPAGE_ONE  (HASHTABLE_NPAGE - (WALINDEX_HDR_SIZE/sizeof(u32)))\r\n\r\n/* The wal-index is divided into pages of WALINDEX_PGSZ bytes each. */\r\n#define WALINDEX_PGSZ   (                                         \\\r\n    sizeof(ht_slot)*HASHTABLE_NSLOT + HASHTABLE_NPAGE*sizeof(u32) \\\r\n)\r\n\r\n/*\r\n** Obtain a pointer to the iPage'th page of the wal-index. The wal-index\r\n** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are\r\n** numbered from zero.\r\n**\r\n** If this call is successful, *ppPage is set to point to the wal-index\r\n** page and SQLITE_OK is returned. If an error (an OOM or VFS error) occurs,\r\n** then an SQLite error code is returned and *ppPage is set to 0.\r\n*/\r\nstatic int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){\r\n  int rc = SQLITE_OK;\r\n\r\n  /* Enlarge the pWal->apWiData[] array if required */\r\n  if( pWal->nWiData<=iPage ){\r\n    int nByte = sizeof(u32*)*(iPage+1);\r\n    volatile u32 **apNew;\r\n    apNew = (volatile u32 **)sqlite3_realloc((void *)pWal->apWiData, nByte);\r\n    if( !apNew ){\r\n      *ppPage = 0;\r\n      return SQLITE_NOMEM;\r\n    }\r\n    memset((void*)&apNew[pWal->nWiData], 0,\r\n           sizeof(u32*)*(iPage+1-pWal->nWiData));\r\n    pWal->apWiData = apNew;\r\n    pWal->nWiData = iPage+1;\r\n  }\r\n\r\n  /* Request a pointer to the required page from the VFS */\r\n  if( pWal->apWiData[iPage]==0 ){\r\n    if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){\r\n      pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);\r\n      if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM;\r\n    }else{\r\n      rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, \r\n          pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]\r\n      );\r\n      if( rc==SQLITE_READONLY ){\r\n        pWal->readOnly |= WAL_SHM_RDONLY;\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n  }\r\n\r\n  *ppPage = pWal->apWiData[iPage];\r\n  assert( iPage==0 || *ppPage || rc!=SQLITE_OK );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return a pointer to the WalCkptInfo structure in the wal-index.\r\n*/\r\nstatic volatile WalCkptInfo *walCkptInfo(Wal *pWal){\r\n  assert( pWal->nWiData>0 && pWal->apWiData[0] );\r\n  return (volatile WalCkptInfo*)&(pWal->apWiData[0][sizeof(WalIndexHdr)/2]);\r\n}\r\n\r\n/*\r\n** Return a pointer to the WalIndexHdr structure in the wal-index.\r\n*/\r\nstatic volatile WalIndexHdr *walIndexHdr(Wal *pWal){\r\n  assert( pWal->nWiData>0 && pWal->apWiData[0] );\r\n  return (volatile WalIndexHdr*)pWal->apWiData[0];\r\n}\r\n\r\n/*\r\n** The argument to this macro must be of type u32. On a little-endian\r\n** architecture, it returns the u32 value that results from interpreting\r\n** the 4 bytes as a big-endian value. On a big-endian architecture, it\r\n** returns the value that would be produced by intepreting the 4 bytes\r\n** of the input value as a little-endian integer.\r\n*/\r\n#define BYTESWAP32(x) ( \\\r\n    (((x)&0x000000FF)<<24) + (((x)&0x0000FF00)<<8)  \\\r\n  + (((x)&0x00FF0000)>>8)  + (((x)&0xFF000000)>>24) \\\r\n)\r\n\r\n/*\r\n** Generate or extend an 8 byte checksum based on the data in \r\n** array aByte[] and the initial values of aIn[0] and aIn[1] (or\r\n** initial values of 0 and 0 if aIn==NULL).\r\n**\r\n** The checksum is written back into aOut[] before returning.\r\n**\r\n** nByte must be a positive multiple of 8.\r\n*/\r\nstatic void walChecksumBytes(\r\n  int nativeCksum, /* True for native byte-order, false for non-native */\r\n  u8 *a,           /* Content to be checksummed */\r\n  int nByte,       /* Bytes of content in a[].  Must be a multiple of 8. */\r\n  const u32 *aIn,  /* Initial checksum value input */\r\n  u32 *aOut        /* OUT: Final checksum value output */\r\n){\r\n  u32 s1, s2;\r\n  u32 *aData = (u32 *)a;\r\n  u32 *aEnd = (u32 *)&a[nByte];\r\n\r\n  if( aIn ){\r\n    s1 = aIn[0];\r\n    s2 = aIn[1];\r\n  }else{\r\n    s1 = s2 = 0;\r\n  }\r\n\r\n  assert( nByte>=8 );\r\n  assert( (nByte&0x00000007)==0 );\r\n\r\n  if( nativeCksum ){\r\n    do {\r\n      s1 += *aData++ + s2;\r\n      s2 += *aData++ + s1;\r\n    }while( aData<aEnd );\r\n  }else{\r\n    do {\r\n      s1 += BYTESWAP32(aData[0]) + s2;\r\n      s2 += BYTESWAP32(aData[1]) + s1;\r\n      aData += 2;\r\n    }while( aData<aEnd );\r\n  }\r\n\r\n  aOut[0] = s1;\r\n  aOut[1] = s2;\r\n}\r\n\r\nstatic void walShmBarrier(Wal *pWal){\r\n  if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){\r\n    sqlite3OsShmBarrier(pWal->pDbFd);\r\n  }\r\n}\r\n\r\n/*\r\n** Write the header information in pWal->hdr into the wal-index.\r\n**\r\n** The checksum on pWal->hdr is updated before it is written.\r\n*/\r\nstatic void walIndexWriteHdr(Wal *pWal){\r\n  volatile WalIndexHdr *aHdr = walIndexHdr(pWal);\r\n  const int nCksum = offsetof(WalIndexHdr, aCksum);\r\n\r\n  assert( pWal->writeLock );\r\n  pWal->hdr.isInit = 1;\r\n  pWal->hdr.iVersion = WALINDEX_MAX_VERSION;\r\n  walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);\r\n  memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr));\r\n  walShmBarrier(pWal);\r\n  memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr));\r\n}\r\n\r\n/*\r\n** This function encodes a single frame header and writes it to a buffer\r\n** supplied by the caller. A frame-header is made up of a series of \r\n** 4-byte big-endian integers, as follows:\r\n**\r\n**     0: Page number.\r\n**     4: For commit records, the size of the database image in pages \r\n**        after the commit. For all other records, zero.\r\n**     8: Salt-1 (copied from the wal-header)\r\n**    12: Salt-2 (copied from the wal-header)\r\n**    16: Checksum-1.\r\n**    20: Checksum-2.\r\n*/\r\nstatic void walEncodeFrame(\r\n  Wal *pWal,                      /* The write-ahead log */\r\n  u32 iPage,                      /* Database page number for frame */\r\n  u32 nTruncate,                  /* New db size (or 0 for non-commit frames) */\r\n  u8 *aData,                      /* Pointer to page data */\r\n  u8 *aFrame                      /* OUT: Write encoded frame here */\r\n){\r\n  int nativeCksum;                /* True for native byte-order checksums */\r\n  u32 *aCksum = pWal->hdr.aFrameCksum;\r\n  assert( WAL_FRAME_HDRSIZE==24 );\r\n  sqlite3Put4byte(&aFrame[0], iPage);\r\n  sqlite3Put4byte(&aFrame[4], nTruncate);\r\n  memcpy(&aFrame[8], pWal->hdr.aSalt, 8);\r\n\r\n  nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);\r\n  walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);\r\n  walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);\r\n\r\n  sqlite3Put4byte(&aFrame[16], aCksum[0]);\r\n  sqlite3Put4byte(&aFrame[20], aCksum[1]);\r\n}\r\n\r\n/*\r\n** Check to see if the frame with header in aFrame[] and content\r\n** in aData[] is valid.  If it is a valid frame, fill *piPage and\r\n** *pnTruncate and return true.  Return if the frame is not valid.\r\n*/\r\nstatic int walDecodeFrame(\r\n  Wal *pWal,                      /* The write-ahead log */\r\n  u32 *piPage,                    /* OUT: Database page number for frame */\r\n  u32 *pnTruncate,                /* OUT: New db size (or 0 if not commit) */\r\n  u8 *aData,                      /* Pointer to page data (for checksum) */\r\n  u8 *aFrame                      /* Frame data */\r\n){\r\n  int nativeCksum;                /* True for native byte-order checksums */\r\n  u32 *aCksum = pWal->hdr.aFrameCksum;\r\n  u32 pgno;                       /* Page number of the frame */\r\n  assert( WAL_FRAME_HDRSIZE==24 );\r\n\r\n  /* A frame is only valid if the salt values in the frame-header\r\n  ** match the salt values in the wal-header. \r\n  */\r\n  if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){\r\n    return 0;\r\n  }\r\n\r\n  /* A frame is only valid if the page number is creater than zero.\r\n  */\r\n  pgno = sqlite3Get4byte(&aFrame[0]);\r\n  if( pgno==0 ){\r\n    return 0;\r\n  }\r\n\r\n  /* A frame is only valid if a checksum of the WAL header,\r\n  ** all prior frams, the first 16 bytes of this frame-header, \r\n  ** and the frame-data matches the checksum in the last 8 \r\n  ** bytes of this frame-header.\r\n  */\r\n  nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);\r\n  walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);\r\n  walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);\r\n  if( aCksum[0]!=sqlite3Get4byte(&aFrame[16]) \r\n   || aCksum[1]!=sqlite3Get4byte(&aFrame[20]) \r\n  ){\r\n    /* Checksum failed. */\r\n    return 0;\r\n  }\r\n\r\n  /* If we reach this point, the frame is valid.  Return the page number\r\n  ** and the new database size.\r\n  */\r\n  *piPage = pgno;\r\n  *pnTruncate = sqlite3Get4byte(&aFrame[4]);\r\n  return 1;\r\n}\r\n\r\n\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n/*\r\n** Names of locks.  This routine is used to provide debugging output and is not\r\n** a part of an ordinary build.\r\n*/\r\nstatic const char *walLockName(int lockIdx){\r\n  if( lockIdx==WAL_WRITE_LOCK ){\r\n    return \"WRITE-LOCK\";\r\n  }else if( lockIdx==WAL_CKPT_LOCK ){\r\n    return \"CKPT-LOCK\";\r\n  }else if( lockIdx==WAL_RECOVER_LOCK ){\r\n    return \"RECOVER-LOCK\";\r\n  }else{\r\n    static char zName[15];\r\n    sqlite3_snprintf(sizeof(zName), zName, \"READ-LOCK[%d]\",\r\n                     lockIdx-WAL_READ_LOCK(0));\r\n    return zName;\r\n  }\r\n}\r\n#endif /*defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */\r\n    \r\n\r\n/*\r\n** Set or release locks on the WAL.  Locks are either shared or exclusive.\r\n** A lock cannot be moved directly between shared and exclusive - it must go\r\n** through the unlocked state first.\r\n**\r\n** In locking_mode=EXCLUSIVE, all of these routines become no-ops.\r\n*/\r\nstatic int walLockShared(Wal *pWal, int lockIdx){\r\n  int rc;\r\n  if( pWal->exclusiveMode ) return SQLITE_OK;\r\n  rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1,\r\n                        SQLITE_SHM_LOCK | SQLITE_SHM_SHARED);\r\n  WALTRACE((\"WAL%p: acquire SHARED-%s %s\\n\", pWal,\r\n            walLockName(lockIdx), rc ? \"failed\" : \"ok\"));\r\n  VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); )\r\n  return rc;\r\n}\r\nstatic void walUnlockShared(Wal *pWal, int lockIdx){\r\n  if( pWal->exclusiveMode ) return;\r\n  (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1,\r\n                         SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED);\r\n  WALTRACE((\"WAL%p: release SHARED-%s\\n\", pWal, walLockName(lockIdx)));\r\n}\r\nstatic int walLockExclusive(Wal *pWal, int lockIdx, int n){\r\n  int rc;\r\n  if( pWal->exclusiveMode ) return SQLITE_OK;\r\n  rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, n,\r\n                        SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE);\r\n  WALTRACE((\"WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\\n\", pWal,\r\n            walLockName(lockIdx), n, rc ? \"failed\" : \"ok\"));\r\n  VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); )\r\n  return rc;\r\n}\r\nstatic void walUnlockExclusive(Wal *pWal, int lockIdx, int n){\r\n  if( pWal->exclusiveMode ) return;\r\n  (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, n,\r\n                         SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE);\r\n  WALTRACE((\"WAL%p: release EXCLUSIVE-%s cnt=%d\\n\", pWal,\r\n             walLockName(lockIdx), n));\r\n}\r\n\r\n/*\r\n** Compute a hash on a page number.  The resulting hash value must land\r\n** between 0 and (HASHTABLE_NSLOT-1).  The walHashNext() function advances\r\n** the hash to the next value in the event of a collision.\r\n*/\r\nstatic int walHash(u32 iPage){\r\n  assert( iPage>0 );\r\n  assert( (HASHTABLE_NSLOT & (HASHTABLE_NSLOT-1))==0 );\r\n  return (iPage*HASHTABLE_HASH_1) & (HASHTABLE_NSLOT-1);\r\n}\r\nstatic int walNextHash(int iPriorHash){\r\n  return (iPriorHash+1)&(HASHTABLE_NSLOT-1);\r\n}\r\n\r\n/* \r\n** Return pointers to the hash table and page number array stored on\r\n** page iHash of the wal-index. The wal-index is broken into 32KB pages\r\n** numbered starting from 0.\r\n**\r\n** Set output variable *paHash to point to the start of the hash table\r\n** in the wal-index file. Set *piZero to one less than the frame \r\n** number of the first frame indexed by this hash table. If a\r\n** slot in the hash table is set to N, it refers to frame number \r\n** (*piZero+N) in the log.\r\n**\r\n** Finally, set *paPgno so that *paPgno[1] is the page number of the\r\n** first frame indexed by the hash table, frame (*piZero+1).\r\n*/\r\nstatic int walHashGet(\r\n  Wal *pWal,                      /* WAL handle */\r\n  int iHash,                      /* Find the iHash'th table */\r\n  volatile ht_slot **paHash,      /* OUT: Pointer to hash index */\r\n  volatile u32 **paPgno,          /* OUT: Pointer to page number array */\r\n  u32 *piZero                     /* OUT: Frame associated with *paPgno[0] */\r\n){\r\n  int rc;                         /* Return code */\r\n  volatile u32 *aPgno;\r\n\r\n  rc = walIndexPage(pWal, iHash, &aPgno);\r\n  assert( rc==SQLITE_OK || iHash>0 );\r\n\r\n  if( rc==SQLITE_OK ){\r\n    u32 iZero;\r\n    volatile ht_slot *aHash;\r\n\r\n    aHash = (volatile ht_slot *)&aPgno[HASHTABLE_NPAGE];\r\n    if( iHash==0 ){\r\n      aPgno = &aPgno[WALINDEX_HDR_SIZE/sizeof(u32)];\r\n      iZero = 0;\r\n    }else{\r\n      iZero = HASHTABLE_NPAGE_ONE + (iHash-1)*HASHTABLE_NPAGE;\r\n    }\r\n  \r\n    *paPgno = &aPgno[-1];\r\n    *paHash = aHash;\r\n    *piZero = iZero;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the number of the wal-index page that contains the hash-table\r\n** and page-number array that contain entries corresponding to WAL frame\r\n** iFrame. The wal-index is broken up into 32KB pages. Wal-index pages \r\n** are numbered starting from 0.\r\n*/\r\nstatic int walFramePage(u32 iFrame){\r\n  int iHash = (iFrame+HASHTABLE_NPAGE-HASHTABLE_NPAGE_ONE-1) / HASHTABLE_NPAGE;\r\n  assert( (iHash==0 || iFrame>HASHTABLE_NPAGE_ONE)\r\n       && (iHash>=1 || iFrame<=HASHTABLE_NPAGE_ONE)\r\n       && (iHash<=1 || iFrame>(HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE))\r\n       && (iHash>=2 || iFrame<=HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE)\r\n       && (iHash<=2 || iFrame>(HASHTABLE_NPAGE_ONE+2*HASHTABLE_NPAGE))\r\n  );\r\n  return iHash;\r\n}\r\n\r\n/*\r\n** Return the page number associated with frame iFrame in this WAL.\r\n*/\r\nstatic u32 walFramePgno(Wal *pWal, u32 iFrame){\r\n  int iHash = walFramePage(iFrame);\r\n  if( iHash==0 ){\r\n    return pWal->apWiData[0][WALINDEX_HDR_SIZE/sizeof(u32) + iFrame - 1];\r\n  }\r\n  return pWal->apWiData[iHash][(iFrame-1-HASHTABLE_NPAGE_ONE)%HASHTABLE_NPAGE];\r\n}\r\n\r\n/*\r\n** Remove entries from the hash table that point to WAL slots greater\r\n** than pWal->hdr.mxFrame.\r\n**\r\n** This function is called whenever pWal->hdr.mxFrame is decreased due\r\n** to a rollback or savepoint.\r\n**\r\n** At most only the hash table containing pWal->hdr.mxFrame needs to be\r\n** updated.  Any later hash tables will be automatically cleared when\r\n** pWal->hdr.mxFrame advances to the point where those hash tables are\r\n** actually needed.\r\n*/\r\nstatic void walCleanupHash(Wal *pWal){\r\n  volatile ht_slot *aHash = 0;    /* Pointer to hash table to clear */\r\n  volatile u32 *aPgno = 0;        /* Page number array for hash table */\r\n  u32 iZero = 0;                  /* frame == (aHash[x]+iZero) */\r\n  int iLimit = 0;                 /* Zero values greater than this */\r\n  int nByte;                      /* Number of bytes to zero in aPgno[] */\r\n  int i;                          /* Used to iterate through aHash[] */\r\n\r\n  assert( pWal->writeLock );\r\n  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );\r\n  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );\r\n  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );\r\n\r\n  if( pWal->hdr.mxFrame==0 ) return;\r\n\r\n  /* Obtain pointers to the hash-table and page-number array containing \r\n  ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed\r\n  ** that the page said hash-table and array reside on is already mapped.\r\n  */\r\n  assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );\r\n  assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );\r\n  walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &aHash, &aPgno, &iZero);\r\n\r\n  /* Zero all hash-table entries that correspond to frame numbers greater\r\n  ** than pWal->hdr.mxFrame.\r\n  */\r\n  iLimit = pWal->hdr.mxFrame - iZero;\r\n  assert( iLimit>0 );\r\n  for(i=0; i<HASHTABLE_NSLOT; i++){\r\n    if( aHash[i]>iLimit ){\r\n      aHash[i] = 0;\r\n    }\r\n  }\r\n  \r\n  /* Zero the entries in the aPgno array that correspond to frames with\r\n  ** frame numbers greater than pWal->hdr.mxFrame. \r\n  */\r\n  nByte = (int)((char *)aHash - (char *)&aPgno[iLimit+1]);\r\n  memset((void *)&aPgno[iLimit+1], 0, nByte);\r\n\r\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\r\n  /* Verify that the every entry in the mapping region is still reachable\r\n  ** via the hash table even after the cleanup.\r\n  */\r\n  if( iLimit ){\r\n    int i;           /* Loop counter */\r\n    int iKey;        /* Hash key */\r\n    for(i=1; i<=iLimit; i++){\r\n      for(iKey=walHash(aPgno[i]); aHash[iKey]; iKey=walNextHash(iKey)){\r\n        if( aHash[iKey]==i ) break;\r\n      }\r\n      assert( aHash[iKey]==i );\r\n    }\r\n  }\r\n#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */\r\n}\r\n\r\n\r\n/*\r\n** Set an entry in the wal-index that will map database page number\r\n** pPage into WAL frame iFrame.\r\n*/\r\nstatic int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){\r\n  int rc;                         /* Return code */\r\n  u32 iZero = 0;                  /* One less than frame number of aPgno[1] */\r\n  volatile u32 *aPgno = 0;        /* Page number array */\r\n  volatile ht_slot *aHash = 0;    /* Hash table */\r\n\r\n  rc = walHashGet(pWal, walFramePage(iFrame), &aHash, &aPgno, &iZero);\r\n\r\n  /* Assuming the wal-index file was successfully mapped, populate the\r\n  ** page number array and hash table entry.\r\n  */\r\n  if( rc==SQLITE_OK ){\r\n    int iKey;                     /* Hash table key */\r\n    int idx;                      /* Value to write to hash-table slot */\r\n    int nCollide;                 /* Number of hash collisions */\r\n\r\n    idx = iFrame - iZero;\r\n    assert( idx <= HASHTABLE_NSLOT/2 + 1 );\r\n    \r\n    /* If this is the first entry to be added to this hash-table, zero the\r\n    ** entire hash table and aPgno[] array before proceding. \r\n    */\r\n    if( idx==1 ){\r\n      int nByte = (int)((u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]);\r\n      memset((void*)&aPgno[1], 0, nByte);\r\n    }\r\n\r\n    /* If the entry in aPgno[] is already set, then the previous writer\r\n    ** must have exited unexpectedly in the middle of a transaction (after\r\n    ** writing one or more dirty pages to the WAL to free up memory). \r\n    ** Remove the remnants of that writers uncommitted transaction from \r\n    ** the hash-table before writing any new entries.\r\n    */\r\n    if( aPgno[idx] ){\r\n      walCleanupHash(pWal);\r\n      assert( !aPgno[idx] );\r\n    }\r\n\r\n    /* Write the aPgno[] array entry and the hash-table slot. */\r\n    nCollide = idx;\r\n    for(iKey=walHash(iPage); aHash[iKey]; iKey=walNextHash(iKey)){\r\n      if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    aPgno[idx] = iPage;\r\n    aHash[iKey] = (ht_slot)idx;\r\n\r\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\r\n    /* Verify that the number of entries in the hash table exactly equals\r\n    ** the number of entries in the mapping region.\r\n    */\r\n    {\r\n      int i;           /* Loop counter */\r\n      int nEntry = 0;  /* Number of entries in the hash table */\r\n      for(i=0; i<HASHTABLE_NSLOT; i++){ if( aHash[i] ) nEntry++; }\r\n      assert( nEntry==idx );\r\n    }\r\n\r\n    /* Verify that the every entry in the mapping region is reachable\r\n    ** via the hash table.  This turns out to be a really, really expensive\r\n    ** thing to check, so only do this occasionally - not on every\r\n    ** iteration.\r\n    */\r\n    if( (idx&0x3ff)==0 ){\r\n      int i;           /* Loop counter */\r\n      for(i=1; i<=idx; i++){\r\n        for(iKey=walHash(aPgno[i]); aHash[iKey]; iKey=walNextHash(iKey)){\r\n          if( aHash[iKey]==i ) break;\r\n        }\r\n        assert( aHash[iKey]==i );\r\n      }\r\n    }\r\n#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */\r\n  }\r\n\r\n\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Recover the wal-index by reading the write-ahead log file. \r\n**\r\n** This routine first tries to establish an exclusive lock on the\r\n** wal-index to prevent other threads/processes from doing anything\r\n** with the WAL or wal-index while recovery is running.  The\r\n** WAL_RECOVER_LOCK is also held so that other threads will know\r\n** that this thread is running recovery.  If unable to establish\r\n** the necessary locks, this routine returns SQLITE_BUSY.\r\n*/\r\nstatic int walIndexRecover(Wal *pWal){\r\n  int rc;                         /* Return Code */\r\n  i64 nSize;                      /* Size of log file */\r\n  u32 aFrameCksum[2] = {0, 0};\r\n  int iLock;                      /* Lock offset to lock for checkpoint */\r\n  int nLock;                      /* Number of locks to hold */\r\n\r\n  /* Obtain an exclusive lock on all byte in the locking range not already\r\n  ** locked by the caller. The caller is guaranteed to have locked the\r\n  ** WAL_WRITE_LOCK byte, and may have also locked the WAL_CKPT_LOCK byte.\r\n  ** If successful, the same bytes that are locked here are unlocked before\r\n  ** this function returns.\r\n  */\r\n  assert( pWal->ckptLock==1 || pWal->ckptLock==0 );\r\n  assert( WAL_ALL_BUT_WRITE==WAL_WRITE_LOCK+1 );\r\n  assert( WAL_CKPT_LOCK==WAL_ALL_BUT_WRITE );\r\n  assert( pWal->writeLock );\r\n  iLock = WAL_ALL_BUT_WRITE + pWal->ckptLock;\r\n  nLock = SQLITE_SHM_NLOCK - iLock;\r\n  rc = walLockExclusive(pWal, iLock, nLock);\r\n  if( rc ){\r\n    return rc;\r\n  }\r\n  WALTRACE((\"WAL%p: recovery begin...\\n\", pWal));\r\n\r\n  memset(&pWal->hdr, 0, sizeof(WalIndexHdr));\r\n\r\n  rc = sqlite3OsFileSize(pWal->pWalFd, &nSize);\r\n  if( rc!=SQLITE_OK ){\r\n    goto recovery_error;\r\n  }\r\n\r\n  if( nSize>WAL_HDRSIZE ){\r\n    u8 aBuf[WAL_HDRSIZE];         /* Buffer to load WAL header into */\r\n    u8 *aFrame = 0;               /* Malloc'd buffer to load entire frame */\r\n    int szFrame;                  /* Number of bytes in buffer aFrame[] */\r\n    u8 *aData;                    /* Pointer to data part of aFrame buffer */\r\n    int iFrame;                   /* Index of last frame read */\r\n    i64 iOffset;                  /* Next offset to read from log file */\r\n    int szPage;                   /* Page size according to the log */\r\n    u32 magic;                    /* Magic value read from WAL header */\r\n    u32 version;                  /* Magic value read from WAL header */\r\n    int isValid;                  /* True if this frame is valid */\r\n\r\n    /* Read in the WAL header. */\r\n    rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0);\r\n    if( rc!=SQLITE_OK ){\r\n      goto recovery_error;\r\n    }\r\n\r\n    /* If the database page size is not a power of two, or is greater than\r\n    ** SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid \r\n    ** data. Similarly, if the 'magic' value is invalid, ignore the whole\r\n    ** WAL file.\r\n    */\r\n    magic = sqlite3Get4byte(&aBuf[0]);\r\n    szPage = sqlite3Get4byte(&aBuf[8]);\r\n    if( (magic&0xFFFFFFFE)!=WAL_MAGIC \r\n     || szPage&(szPage-1) \r\n     || szPage>SQLITE_MAX_PAGE_SIZE \r\n     || szPage<512 \r\n    ){\r\n      goto finished;\r\n    }\r\n    pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);\r\n    pWal->szPage = szPage;\r\n    pWal->nCkpt = sqlite3Get4byte(&aBuf[12]);\r\n    memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);\r\n\r\n    /* Verify that the WAL header checksum is correct */\r\n    walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN, \r\n        aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum\r\n    );\r\n    if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])\r\n     || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])\r\n    ){\r\n      goto finished;\r\n    }\r\n\r\n    /* Verify that the version number on the WAL format is one that\r\n    ** are able to understand */\r\n    version = sqlite3Get4byte(&aBuf[4]);\r\n    if( version!=WAL_MAX_VERSION ){\r\n      rc = SQLITE_CANTOPEN_BKPT;\r\n      goto finished;\r\n    }\r\n\r\n    /* Malloc a buffer to read frames into. */\r\n    szFrame = szPage + WAL_FRAME_HDRSIZE;\r\n    aFrame = (u8 *)sqlite3_malloc(szFrame);\r\n    if( !aFrame ){\r\n      rc = SQLITE_NOMEM;\r\n      goto recovery_error;\r\n    }\r\n    aData = &aFrame[WAL_FRAME_HDRSIZE];\r\n\r\n    /* Read all frames from the log file. */\r\n    iFrame = 0;\r\n    for(iOffset=WAL_HDRSIZE; (iOffset+szFrame)<=nSize; iOffset+=szFrame){\r\n      u32 pgno;                   /* Database page number for frame */\r\n      u32 nTruncate;              /* dbsize field from frame header */\r\n\r\n      /* Read and decode the next log frame. */\r\n      iFrame++;\r\n      rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset);\r\n      if( rc!=SQLITE_OK ) break;\r\n      isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame);\r\n      if( !isValid ) break;\r\n      rc = walIndexAppend(pWal, iFrame, pgno);\r\n      if( rc!=SQLITE_OK ) break;\r\n\r\n      /* If nTruncate is non-zero, this is a commit record. */\r\n      if( nTruncate ){\r\n        pWal->hdr.mxFrame = iFrame;\r\n        pWal->hdr.nPage = nTruncate;\r\n        pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));\r\n        testcase( szPage<=32768 );\r\n        testcase( szPage>=65536 );\r\n        aFrameCksum[0] = pWal->hdr.aFrameCksum[0];\r\n        aFrameCksum[1] = pWal->hdr.aFrameCksum[1];\r\n      }\r\n    }\r\n\r\n    sqlite3_free(aFrame);\r\n  }\r\n\r\nfinished:\r\n  if( rc==SQLITE_OK ){\r\n    volatile WalCkptInfo *pInfo;\r\n    int i;\r\n    pWal->hdr.aFrameCksum[0] = aFrameCksum[0];\r\n    pWal->hdr.aFrameCksum[1] = aFrameCksum[1];\r\n    walIndexWriteHdr(pWal);\r\n\r\n    /* Reset the checkpoint-header. This is safe because this thread is \r\n    ** currently holding locks that exclude all other readers, writers and\r\n    ** checkpointers.\r\n    */\r\n    pInfo = walCkptInfo(pWal);\r\n    pInfo->nBackfill = 0;\r\n    pInfo->aReadMark[0] = 0;\r\n    for(i=1; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;\r\n\r\n    /* If more than one frame was recovered from the log file, report an\r\n    ** event via sqlite3_log(). This is to help with identifying performance\r\n    ** problems caused by applications routinely shutting down without\r\n    ** checkpointing the log file.\r\n    */\r\n    if( pWal->hdr.nPage ){\r\n      sqlite3_log(SQLITE_OK, \"Recovered %d frames from WAL file %s\",\r\n          pWal->hdr.nPage, pWal->zWalName\r\n      );\r\n    }\r\n  }\r\n\r\nrecovery_error:\r\n  WALTRACE((\"WAL%p: recovery %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\r\n  walUnlockExclusive(pWal, iLock, nLock);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close an open wal-index.\r\n*/\r\nstatic void walIndexClose(Wal *pWal, int isDelete){\r\n  if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){\r\n    int i;\r\n    for(i=0; i<pWal->nWiData; i++){\r\n      sqlite3_free((void *)pWal->apWiData[i]);\r\n      pWal->apWiData[i] = 0;\r\n    }\r\n  }else{\r\n    sqlite3OsShmUnmap(pWal->pDbFd, isDelete);\r\n  }\r\n}\r\n\r\n/* \r\n** Open a connection to the WAL file zWalName. The database file must \r\n** already be opened on connection pDbFd. The buffer that zWalName points\r\n** to must remain valid for the lifetime of the returned Wal* handle.\r\n**\r\n** A SHARED lock should be held on the database file when this function\r\n** is called. The purpose of this SHARED lock is to prevent any other\r\n** client from unlinking the WAL or wal-index file. If another process\r\n** were to do this just after this client opened one of these files, the\r\n** system would be badly broken.\r\n**\r\n** If the log file is successfully opened, SQLITE_OK is returned and \r\n** *ppWal is set to point to a new WAL handle. If an error occurs,\r\n** an SQLite error code is returned and *ppWal is left unmodified.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalOpen(\r\n  sqlite3_vfs *pVfs,              /* vfs module to open wal and wal-index */\r\n  sqlite3_file *pDbFd,            /* The open database file */\r\n  const char *zWalName,           /* Name of the WAL file */\r\n  int bNoShm,                     /* True to run in heap-memory mode */\r\n  i64 mxWalSize,                  /* Truncate WAL to this size on reset */\r\n  Wal **ppWal                     /* OUT: Allocated Wal handle */\r\n){\r\n  int rc;                         /* Return Code */\r\n  Wal *pRet;                      /* Object to allocate and return */\r\n  int flags;                      /* Flags passed to OsOpen() */\r\n\r\n  assert( zWalName && zWalName[0] );\r\n  assert( pDbFd );\r\n\r\n  /* In the amalgamation, the os_unix.c and os_win.c source files come before\r\n  ** this source file.  Verify that the #defines of the locking byte offsets\r\n  ** in os_unix.c and os_win.c agree with the WALINDEX_LOCK_OFFSET value.\r\n  */\r\n#ifdef WIN_SHM_BASE\r\n  assert( WIN_SHM_BASE==WALINDEX_LOCK_OFFSET );\r\n#endif\r\n#ifdef UNIX_SHM_BASE\r\n  assert( UNIX_SHM_BASE==WALINDEX_LOCK_OFFSET );\r\n#endif\r\n\r\n\r\n  /* Allocate an instance of struct Wal to return. */\r\n  *ppWal = 0;\r\n  pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);\r\n  if( !pRet ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  pRet->pVfs = pVfs;\r\n  pRet->pWalFd = (sqlite3_file *)&pRet[1];\r\n  pRet->pDbFd = pDbFd;\r\n  pRet->readLock = -1;\r\n  pRet->mxWalSize = mxWalSize;\r\n  pRet->zWalName = zWalName;\r\n  pRet->syncHeader = 1;\r\n  pRet->padToSectorBoundary = 1;\r\n  pRet->exclusiveMode = (bNoShm ? WAL_HEAPMEMORY_MODE: WAL_NORMAL_MODE);\r\n\r\n  /* Open file handle on the write-ahead log file. */\r\n  flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_WAL);\r\n  rc = sqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags);\r\n  if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){\r\n    pRet->readOnly = WAL_RDONLY;\r\n  }\r\n\r\n  if( rc!=SQLITE_OK ){\r\n    walIndexClose(pRet, 0);\r\n    sqlite3OsClose(pRet->pWalFd);\r\n    sqlite3_free(pRet);\r\n  }else{\r\n    int iDC = sqlite3OsDeviceCharacteristics(pRet->pWalFd);\r\n    if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; }\r\n    if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){\r\n      pRet->padToSectorBoundary = 0;\r\n    }\r\n    *ppWal = pRet;\r\n    WALTRACE((\"WAL%d: opened\\n\", pRet));\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Change the size to which the WAL file is trucated on each reset.\r\n*/\r\nSQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){\r\n  if( pWal ) pWal->mxWalSize = iLimit;\r\n}\r\n\r\n/*\r\n** Find the smallest page number out of all pages held in the WAL that\r\n** has not been returned by any prior invocation of this method on the\r\n** same WalIterator object.   Write into *piFrame the frame index where\r\n** that page was last written into the WAL.  Write into *piPage the page\r\n** number.\r\n**\r\n** Return 0 on success.  If there are no pages in the WAL with a page\r\n** number larger than *piPage, then return 1.\r\n*/\r\nstatic int walIteratorNext(\r\n  WalIterator *p,               /* Iterator */\r\n  u32 *piPage,                  /* OUT: The page number of the next page */\r\n  u32 *piFrame                  /* OUT: Wal frame index of next page */\r\n){\r\n  u32 iMin;                     /* Result pgno must be greater than iMin */\r\n  u32 iRet = 0xFFFFFFFF;        /* 0xffffffff is never a valid page number */\r\n  int i;                        /* For looping through segments */\r\n\r\n  iMin = p->iPrior;\r\n  assert( iMin<0xffffffff );\r\n  for(i=p->nSegment-1; i>=0; i--){\r\n    struct WalSegment *pSegment = &p->aSegment[i];\r\n    while( pSegment->iNext<pSegment->nEntry ){\r\n      u32 iPg = pSegment->aPgno[pSegment->aIndex[pSegment->iNext]];\r\n      if( iPg>iMin ){\r\n        if( iPg<iRet ){\r\n          iRet = iPg;\r\n          *piFrame = pSegment->iZero + pSegment->aIndex[pSegment->iNext];\r\n        }\r\n        break;\r\n      }\r\n      pSegment->iNext++;\r\n    }\r\n  }\r\n\r\n  *piPage = p->iPrior = iRet;\r\n  return (iRet==0xFFFFFFFF);\r\n}\r\n\r\n/*\r\n** This function merges two sorted lists into a single sorted list.\r\n**\r\n** aLeft[] and aRight[] are arrays of indices.  The sort key is\r\n** aContent[aLeft[]] and aContent[aRight[]].  Upon entry, the following\r\n** is guaranteed for all J<K:\r\n**\r\n**        aContent[aLeft[J]] < aContent[aLeft[K]]\r\n**        aContent[aRight[J]] < aContent[aRight[K]]\r\n**\r\n** This routine overwrites aRight[] with a new (probably longer) sequence\r\n** of indices such that the aRight[] contains every index that appears in\r\n** either aLeft[] or the old aRight[] and such that the second condition\r\n** above is still met.\r\n**\r\n** The aContent[aLeft[X]] values will be unique for all X.  And the\r\n** aContent[aRight[X]] values will be unique too.  But there might be\r\n** one or more combinations of X and Y such that\r\n**\r\n**      aLeft[X]!=aRight[Y]  &&  aContent[aLeft[X]] == aContent[aRight[Y]]\r\n**\r\n** When that happens, omit the aLeft[X] and use the aRight[Y] index.\r\n*/\r\nstatic void walMerge(\r\n  const u32 *aContent,            /* Pages in wal - keys for the sort */\r\n  ht_slot *aLeft,                 /* IN: Left hand input list */\r\n  int nLeft,                      /* IN: Elements in array *paLeft */\r\n  ht_slot **paRight,              /* IN/OUT: Right hand input list */\r\n  int *pnRight,                   /* IN/OUT: Elements in *paRight */\r\n  ht_slot *aTmp                   /* Temporary buffer */\r\n){\r\n  int iLeft = 0;                  /* Current index in aLeft */\r\n  int iRight = 0;                 /* Current index in aRight */\r\n  int iOut = 0;                   /* Current index in output buffer */\r\n  int nRight = *pnRight;\r\n  ht_slot *aRight = *paRight;\r\n\r\n  assert( nLeft>0 && nRight>0 );\r\n  while( iRight<nRight || iLeft<nLeft ){\r\n    ht_slot logpage;\r\n    Pgno dbpage;\r\n\r\n    if( (iLeft<nLeft) \r\n     && (iRight>=nRight || aContent[aLeft[iLeft]]<aContent[aRight[iRight]])\r\n    ){\r\n      logpage = aLeft[iLeft++];\r\n    }else{\r\n      logpage = aRight[iRight++];\r\n    }\r\n    dbpage = aContent[logpage];\r\n\r\n    aTmp[iOut++] = logpage;\r\n    if( iLeft<nLeft && aContent[aLeft[iLeft]]==dbpage ) iLeft++;\r\n\r\n    assert( iLeft>=nLeft || aContent[aLeft[iLeft]]>dbpage );\r\n    assert( iRight>=nRight || aContent[aRight[iRight]]>dbpage );\r\n  }\r\n\r\n  *paRight = aLeft;\r\n  *pnRight = iOut;\r\n  memcpy(aLeft, aTmp, sizeof(aTmp[0])*iOut);\r\n}\r\n\r\n/*\r\n** Sort the elements in list aList using aContent[] as the sort key.\r\n** Remove elements with duplicate keys, preferring to keep the\r\n** larger aList[] values.\r\n**\r\n** The aList[] entries are indices into aContent[].  The values in\r\n** aList[] are to be sorted so that for all J<K:\r\n**\r\n**      aContent[aList[J]] < aContent[aList[K]]\r\n**\r\n** For any X and Y such that\r\n**\r\n**      aContent[aList[X]] == aContent[aList[Y]]\r\n**\r\n** Keep the larger of the two values aList[X] and aList[Y] and discard\r\n** the smaller.\r\n*/\r\nstatic void walMergesort(\r\n  const u32 *aContent,            /* Pages in wal */\r\n  ht_slot *aBuffer,               /* Buffer of at least *pnList items to use */\r\n  ht_slot *aList,                 /* IN/OUT: List to sort */\r\n  int *pnList                     /* IN/OUT: Number of elements in aList[] */\r\n){\r\n  struct Sublist {\r\n    int nList;                    /* Number of elements in aList */\r\n    ht_slot *aList;               /* Pointer to sub-list content */\r\n  };\r\n\r\n  const int nList = *pnList;      /* Size of input list */\r\n  int nMerge = 0;                 /* Number of elements in list aMerge */\r\n  ht_slot *aMerge = 0;            /* List to be merged */\r\n  int iList;                      /* Index into input list */\r\n  int iSub = 0;                   /* Index into aSub array */\r\n  struct Sublist aSub[13];        /* Array of sub-lists */\r\n\r\n  memset(aSub, 0, sizeof(aSub));\r\n  assert( nList<=HASHTABLE_NPAGE && nList>0 );\r\n  assert( HASHTABLE_NPAGE==(1<<(ArraySize(aSub)-1)) );\r\n\r\n  for(iList=0; iList<nList; iList++){\r\n    nMerge = 1;\r\n    aMerge = &aList[iList];\r\n    for(iSub=0; iList & (1<<iSub); iSub++){\r\n      struct Sublist *p = &aSub[iSub];\r\n      assert( p->aList && p->nList<=(1<<iSub) );\r\n      assert( p->aList==&aList[iList&~((2<<iSub)-1)] );\r\n      walMerge(aContent, p->aList, p->nList, &aMerge, &nMerge, aBuffer);\r\n    }\r\n    aSub[iSub].aList = aMerge;\r\n    aSub[iSub].nList = nMerge;\r\n  }\r\n\r\n  for(iSub++; iSub<ArraySize(aSub); iSub++){\r\n    if( nList & (1<<iSub) ){\r\n      struct Sublist *p = &aSub[iSub];\r\n      assert( p->nList<=(1<<iSub) );\r\n      assert( p->aList==&aList[nList&~((2<<iSub)-1)] );\r\n      walMerge(aContent, p->aList, p->nList, &aMerge, &nMerge, aBuffer);\r\n    }\r\n  }\r\n  assert( aMerge==aList );\r\n  *pnList = nMerge;\r\n\r\n#ifdef SQLITE_DEBUG\r\n  {\r\n    int i;\r\n    for(i=1; i<*pnList; i++){\r\n      assert( aContent[aList[i]] > aContent[aList[i-1]] );\r\n    }\r\n  }\r\n#endif\r\n}\r\n\r\n/* \r\n** Free an iterator allocated by walIteratorInit().\r\n*/\r\nstatic void walIteratorFree(WalIterator *p){\r\n  sqlite3ScratchFree(p);\r\n}\r\n\r\n/*\r\n** Construct a WalInterator object that can be used to loop over all \r\n** pages in the WAL in ascending order. The caller must hold the checkpoint\r\n** lock.\r\n**\r\n** On success, make *pp point to the newly allocated WalInterator object\r\n** return SQLITE_OK. Otherwise, return an error code. If this routine\r\n** returns an error, the value of *pp is undefined.\r\n**\r\n** The calling routine should invoke walIteratorFree() to destroy the\r\n** WalIterator object when it has finished with it.\r\n*/\r\nstatic int walIteratorInit(Wal *pWal, WalIterator **pp){\r\n  WalIterator *p;                 /* Return value */\r\n  int nSegment;                   /* Number of segments to merge */\r\n  u32 iLast;                      /* Last frame in log */\r\n  int nByte;                      /* Number of bytes to allocate */\r\n  int i;                          /* Iterator variable */\r\n  ht_slot *aTmp;                  /* Temp space used by merge-sort */\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n\r\n  /* This routine only runs while holding the checkpoint lock. And\r\n  ** it only runs if there is actually content in the log (mxFrame>0).\r\n  */\r\n  assert( pWal->ckptLock && pWal->hdr.mxFrame>0 );\r\n  iLast = pWal->hdr.mxFrame;\r\n\r\n  /* Allocate space for the WalIterator object. */\r\n  nSegment = walFramePage(iLast) + 1;\r\n  nByte = sizeof(WalIterator) \r\n        + (nSegment-1)*sizeof(struct WalSegment)\r\n        + iLast*sizeof(ht_slot);\r\n  p = (WalIterator *)sqlite3ScratchMalloc(nByte);\r\n  if( !p ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(p, 0, nByte);\r\n  p->nSegment = nSegment;\r\n\r\n  /* Allocate temporary space used by the merge-sort routine. This block\r\n  ** of memory will be freed before this function returns.\r\n  */\r\n  aTmp = (ht_slot *)sqlite3ScratchMalloc(\r\n      sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)\r\n  );\r\n  if( !aTmp ){\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n\r\n  for(i=0; rc==SQLITE_OK && i<nSegment; i++){\r\n    volatile ht_slot *aHash;\r\n    u32 iZero;\r\n    volatile u32 *aPgno;\r\n\r\n    rc = walHashGet(pWal, i, &aHash, &aPgno, &iZero);\r\n    if( rc==SQLITE_OK ){\r\n      int j;                      /* Counter variable */\r\n      int nEntry;                 /* Number of entries in this segment */\r\n      ht_slot *aIndex;            /* Sorted index for this segment */\r\n\r\n      aPgno++;\r\n      if( (i+1)==nSegment ){\r\n        nEntry = (int)(iLast - iZero);\r\n      }else{\r\n        nEntry = (int)((u32*)aHash - (u32*)aPgno);\r\n      }\r\n      aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[iZero];\r\n      iZero++;\r\n  \r\n      for(j=0; j<nEntry; j++){\r\n        aIndex[j] = (ht_slot)j;\r\n      }\r\n      walMergesort((u32 *)aPgno, aTmp, aIndex, &nEntry);\r\n      p->aSegment[i].iZero = iZero;\r\n      p->aSegment[i].nEntry = nEntry;\r\n      p->aSegment[i].aIndex = aIndex;\r\n      p->aSegment[i].aPgno = (u32 *)aPgno;\r\n    }\r\n  }\r\n  sqlite3ScratchFree(aTmp);\r\n\r\n  if( rc!=SQLITE_OK ){\r\n    walIteratorFree(p);\r\n  }\r\n  *pp = p;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and\r\n** n. If the attempt fails and parameter xBusy is not NULL, then it is a\r\n** busy-handler function. Invoke it and retry the lock until either the\r\n** lock is successfully obtained or the busy-handler returns 0.\r\n*/\r\nstatic int walBusyLock(\r\n  Wal *pWal,                      /* WAL connection */\r\n  int (*xBusy)(void*),            /* Function to call when busy */\r\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\r\n  int lockIdx,                    /* Offset of first byte to lock */\r\n  int n                           /* Number of bytes to lock */\r\n){\r\n  int rc;\r\n  do {\r\n    rc = walLockExclusive(pWal, lockIdx, n);\r\n  }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The cache of the wal-index header must be valid to call this function.\r\n** Return the page-size in bytes used by the database.\r\n*/\r\nstatic int walPagesize(Wal *pWal){\r\n  return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);\r\n}\r\n\r\n/*\r\n** Copy as much content as we can from the WAL back into the database file\r\n** in response to an sqlite3_wal_checkpoint() request or the equivalent.\r\n**\r\n** The amount of information copies from WAL to database might be limited\r\n** by active readers.  This routine will never overwrite a database page\r\n** that a concurrent reader might be using.\r\n**\r\n** All I/O barrier operations (a.k.a fsyncs) occur in this routine when\r\n** SQLite is in WAL-mode in synchronous=NORMAL.  That means that if \r\n** checkpoints are always run by a background thread or background \r\n** process, foreground threads will never block on a lengthy fsync call.\r\n**\r\n** Fsync is called on the WAL before writing content out of the WAL and\r\n** into the database.  This ensures that if the new content is persistent\r\n** in the WAL and can be recovered following a power-loss or hard reset.\r\n**\r\n** Fsync is also called on the database file if (and only if) the entire\r\n** WAL content is copied into the database file.  This second fsync makes\r\n** it safe to delete the WAL since the new content will persist in the\r\n** database file.\r\n**\r\n** This routine uses and updates the nBackfill field of the wal-index header.\r\n** This is the only routine tha will increase the value of nBackfill.  \r\n** (A WAL reset or recovery will revert nBackfill to zero, but not increase\r\n** its value.)\r\n**\r\n** The caller must be holding sufficient locks to ensure that no other\r\n** checkpoint is running (in any other thread or process) at the same\r\n** time.\r\n*/\r\nstatic int walCheckpoint(\r\n  Wal *pWal,                      /* Wal connection */\r\n  int eMode,                      /* One of PASSIVE, FULL or RESTART */\r\n  int (*xBusyCall)(void*),        /* Function to call when busy */\r\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\r\n  int sync_flags,                 /* Flags for OsSync() (or 0) */\r\n  u8 *zBuf                        /* Temporary buffer to use */\r\n){\r\n  int rc;                         /* Return code */\r\n  int szPage;                     /* Database page-size */\r\n  WalIterator *pIter = 0;         /* Wal iterator context */\r\n  u32 iDbpage = 0;                /* Next database page to write */\r\n  u32 iFrame = 0;                 /* Wal frame containing data for iDbpage */\r\n  u32 mxSafeFrame;                /* Max frame that can be backfilled */\r\n  u32 mxPage;                     /* Max database page to write */\r\n  int i;                          /* Loop counter */\r\n  volatile WalCkptInfo *pInfo;    /* The checkpoint status information */\r\n  int (*xBusy)(void*) = 0;        /* Function to call when waiting for locks */\r\n\r\n  szPage = walPagesize(pWal);\r\n  testcase( szPage<=32768 );\r\n  testcase( szPage>=65536 );\r\n  pInfo = walCkptInfo(pWal);\r\n  if( pInfo->nBackfill>=pWal->hdr.mxFrame ) return SQLITE_OK;\r\n\r\n  /* Allocate the iterator */\r\n  rc = walIteratorInit(pWal, &pIter);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n  assert( pIter );\r\n\r\n  if( eMode!=SQLITE_CHECKPOINT_PASSIVE ) xBusy = xBusyCall;\r\n\r\n  /* Compute in mxSafeFrame the index of the last frame of the WAL that is\r\n  ** safe to write into the database.  Frames beyond mxSafeFrame might\r\n  ** overwrite database pages that are in use by active readers and thus\r\n  ** cannot be backfilled from the WAL.\r\n  */\r\n  mxSafeFrame = pWal->hdr.mxFrame;\r\n  mxPage = pWal->hdr.nPage;\r\n  for(i=1; i<WAL_NREADER; i++){\r\n    u32 y = pInfo->aReadMark[i];\r\n    if( mxSafeFrame>y ){\r\n      assert( y<=pWal->hdr.mxFrame );\r\n      rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);\r\n      if( rc==SQLITE_OK ){\r\n        pInfo->aReadMark[i] = READMARK_NOT_USED;\r\n        walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);\r\n      }else if( rc==SQLITE_BUSY ){\r\n        mxSafeFrame = y;\r\n        xBusy = 0;\r\n      }else{\r\n        goto walcheckpoint_out;\r\n      }\r\n    }\r\n  }\r\n\r\n  if( pInfo->nBackfill<mxSafeFrame\r\n   && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0), 1))==SQLITE_OK\r\n  ){\r\n    i64 nSize;                    /* Current size of database file */\r\n    u32 nBackfill = pInfo->nBackfill;\r\n\r\n    /* Sync the WAL to disk */\r\n    if( sync_flags ){\r\n      rc = sqlite3OsSync(pWal->pWalFd, sync_flags);\r\n    }\r\n\r\n    /* If the database file may grow as a result of this checkpoint, hint\r\n    ** about the eventual size of the db file to the VFS layer. \r\n    */\r\n    if( rc==SQLITE_OK ){\r\n      i64 nReq = ((i64)mxPage * szPage);\r\n      rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);\r\n      if( rc==SQLITE_OK && nSize<nReq ){\r\n        sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);\r\n      }\r\n    }\r\n\r\n    /* Iterate through the contents of the WAL, copying data to the db file. */\r\n    while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){\r\n      i64 iOffset;\r\n      assert( walFramePgno(pWal, iFrame)==iDbpage );\r\n      if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ) continue;\r\n      iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE;\r\n      /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */\r\n      rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset);\r\n      if( rc!=SQLITE_OK ) break;\r\n      iOffset = (iDbpage-1)*(i64)szPage;\r\n      testcase( IS_BIG_INT(iOffset) );\r\n      rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);\r\n      if( rc!=SQLITE_OK ) break;\r\n    }\r\n\r\n    /* If work was actually accomplished... */\r\n    if( rc==SQLITE_OK ){\r\n      if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){\r\n        i64 szDb = pWal->hdr.nPage*(i64)szPage;\r\n        testcase( IS_BIG_INT(szDb) );\r\n        rc = sqlite3OsTruncate(pWal->pDbFd, szDb);\r\n        if( rc==SQLITE_OK && sync_flags ){\r\n          rc = sqlite3OsSync(pWal->pDbFd, sync_flags);\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        pInfo->nBackfill = mxSafeFrame;\r\n      }\r\n    }\r\n\r\n    /* Release the reader lock held while backfilling */\r\n    walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);\r\n  }\r\n\r\n  if( rc==SQLITE_BUSY ){\r\n    /* Reset the return code so as not to report a checkpoint failure\r\n    ** just because there are active readers.  */\r\n    rc = SQLITE_OK;\r\n  }\r\n\r\n  /* If this is an SQLITE_CHECKPOINT_RESTART operation, and the entire wal\r\n  ** file has been copied into the database file, then block until all\r\n  ** readers have finished using the wal file. This ensures that the next\r\n  ** process to write to the database restarts the wal file.\r\n  */\r\n  if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){\r\n    assert( pWal->writeLock );\r\n    if( pInfo->nBackfill<pWal->hdr.mxFrame ){\r\n      rc = SQLITE_BUSY;\r\n    }else if( eMode==SQLITE_CHECKPOINT_RESTART ){\r\n      assert( mxSafeFrame==pWal->hdr.mxFrame );\r\n      rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);\r\n      if( rc==SQLITE_OK ){\r\n        walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);\r\n      }\r\n    }\r\n  }\r\n\r\n walcheckpoint_out:\r\n  walIteratorFree(pIter);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If the WAL file is currently larger than nMax bytes in size, truncate\r\n** it to exactly nMax bytes. If an error occurs while doing so, ignore it.\r\n*/\r\nstatic void walLimitSize(Wal *pWal, i64 nMax){\r\n  i64 sz;\r\n  int rx;\r\n  sqlite3BeginBenignMalloc();\r\n  rx = sqlite3OsFileSize(pWal->pWalFd, &sz);\r\n  if( rx==SQLITE_OK && (sz > nMax ) ){\r\n    rx = sqlite3OsTruncate(pWal->pWalFd, nMax);\r\n  }\r\n  sqlite3EndBenignMalloc();\r\n  if( rx ){\r\n    sqlite3_log(rx, \"cannot limit WAL size: %s\", pWal->zWalName);\r\n  }\r\n}\r\n\r\n/*\r\n** Close a connection to a log file.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalClose(\r\n  Wal *pWal,                      /* Wal to close */\r\n  int sync_flags,                 /* Flags to pass to OsSync() (or 0) */\r\n  int nBuf,\r\n  u8 *zBuf                        /* Buffer of at least nBuf bytes */\r\n){\r\n  int rc = SQLITE_OK;\r\n  if( pWal ){\r\n    int isDelete = 0;             /* True to unlink wal and wal-index files */\r\n\r\n    /* If an EXCLUSIVE lock can be obtained on the database file (using the\r\n    ** ordinary, rollback-mode locking methods, this guarantees that the\r\n    ** connection associated with this log file is the only connection to\r\n    ** the database. In this case checkpoint the database and unlink both\r\n    ** the wal and wal-index files.\r\n    **\r\n    ** The EXCLUSIVE lock is not released before returning.\r\n    */\r\n    rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE);\r\n    if( rc==SQLITE_OK ){\r\n      if( pWal->exclusiveMode==WAL_NORMAL_MODE ){\r\n        pWal->exclusiveMode = WAL_EXCLUSIVE_MODE;\r\n      }\r\n      rc = sqlite3WalCheckpoint(\r\n          pWal, SQLITE_CHECKPOINT_PASSIVE, 0, 0, sync_flags, nBuf, zBuf, 0, 0\r\n      );\r\n      if( rc==SQLITE_OK ){\r\n        int bPersist = -1;\r\n        sqlite3OsFileControlHint(\r\n            pWal->pDbFd, SQLITE_FCNTL_PERSIST_WAL, &bPersist\r\n        );\r\n        if( bPersist!=1 ){\r\n          /* Try to delete the WAL file if the checkpoint completed and\r\n          ** fsyned (rc==SQLITE_OK) and if we are not in persistent-wal\r\n          ** mode (!bPersist) */\r\n          isDelete = 1;\r\n        }else if( pWal->mxWalSize>=0 ){\r\n          /* Try to truncate the WAL file to zero bytes if the checkpoint\r\n          ** completed and fsynced (rc==SQLITE_OK) and we are in persistent\r\n          ** WAL mode (bPersist) and if the PRAGMA journal_size_limit is a\r\n          ** non-negative value (pWal->mxWalSize>=0).  Note that we truncate\r\n          ** to zero bytes as truncating to the journal_size_limit might\r\n          ** leave a corrupt WAL file on disk. */\r\n          walLimitSize(pWal, 0);\r\n        }\r\n      }\r\n    }\r\n\r\n    walIndexClose(pWal, isDelete);\r\n    sqlite3OsClose(pWal->pWalFd);\r\n    if( isDelete ){\r\n      sqlite3BeginBenignMalloc();\r\n      sqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0);\r\n      sqlite3EndBenignMalloc();\r\n    }\r\n    WALTRACE((\"WAL%p: closed\\n\", pWal));\r\n    sqlite3_free((void *)pWal->apWiData);\r\n    sqlite3_free(pWal);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Try to read the wal-index header.  Return 0 on success and 1 if\r\n** there is a problem.\r\n**\r\n** The wal-index is in shared memory.  Another thread or process might\r\n** be writing the header at the same time this procedure is trying to\r\n** read it, which might result in inconsistency.  A dirty read is detected\r\n** by verifying that both copies of the header are the same and also by\r\n** a checksum on the header.\r\n**\r\n** If and only if the read is consistent and the header is different from\r\n** pWal->hdr, then pWal->hdr is updated to the content of the new header\r\n** and *pChanged is set to 1.\r\n**\r\n** If the checksum cannot be verified return non-zero. If the header\r\n** is read successfully and the checksum verified, return zero.\r\n*/\r\nstatic int walIndexTryHdr(Wal *pWal, int *pChanged){\r\n  u32 aCksum[2];                  /* Checksum on the header content */\r\n  WalIndexHdr h1, h2;             /* Two copies of the header content */\r\n  WalIndexHdr volatile *aHdr;     /* Header in shared memory */\r\n\r\n  /* The first page of the wal-index must be mapped at this point. */\r\n  assert( pWal->nWiData>0 && pWal->apWiData[0] );\r\n\r\n  /* Read the header. This might happen concurrently with a write to the\r\n  ** same area of shared memory on a different CPU in a SMP,\r\n  ** meaning it is possible that an inconsistent snapshot is read\r\n  ** from the file. If this happens, return non-zero.\r\n  **\r\n  ** There are two copies of the header at the beginning of the wal-index.\r\n  ** When reading, read [0] first then [1].  Writes are in the reverse order.\r\n  ** Memory barriers are used to prevent the compiler or the hardware from\r\n  ** reordering the reads and writes.\r\n  */\r\n  aHdr = walIndexHdr(pWal);\r\n  memcpy(&h1, (void *)&aHdr[0], sizeof(h1));\r\n  walShmBarrier(pWal);\r\n  memcpy(&h2, (void *)&aHdr[1], sizeof(h2));\r\n\r\n  if( memcmp(&h1, &h2, sizeof(h1))!=0 ){\r\n    return 1;   /* Dirty read */\r\n  }  \r\n  if( h1.isInit==0 ){\r\n    return 1;   /* Malformed header - probably all zeros */\r\n  }\r\n  walChecksumBytes(1, (u8*)&h1, sizeof(h1)-sizeof(h1.aCksum), 0, aCksum);\r\n  if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){\r\n    return 1;   /* Checksum does not match */\r\n  }\r\n\r\n  if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){\r\n    *pChanged = 1;\r\n    memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));\r\n    pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);\r\n    testcase( pWal->szPage<=32768 );\r\n    testcase( pWal->szPage>=65536 );\r\n  }\r\n\r\n  /* The header was successfully read. Return zero. */\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Read the wal-index header from the wal-index and into pWal->hdr.\r\n** If the wal-header appears to be corrupt, try to reconstruct the\r\n** wal-index from the WAL before returning.\r\n**\r\n** Set *pChanged to 1 if the wal-index header value in pWal->hdr is\r\n** changed by this opertion.  If pWal->hdr is unchanged, set *pChanged\r\n** to 0.\r\n**\r\n** If the wal-index header is successfully read, return SQLITE_OK. \r\n** Otherwise an SQLite error code.\r\n*/\r\nstatic int walIndexReadHdr(Wal *pWal, int *pChanged){\r\n  int rc;                         /* Return code */\r\n  int badHdr;                     /* True if a header read failed */\r\n  volatile u32 *page0;            /* Chunk of wal-index containing header */\r\n\r\n  /* Ensure that page 0 of the wal-index (the page that contains the \r\n  ** wal-index header) is mapped. Return early if an error occurs here.\r\n  */\r\n  assert( pChanged );\r\n  rc = walIndexPage(pWal, 0, &page0);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  };\r\n  assert( page0 || pWal->writeLock==0 );\r\n\r\n  /* If the first page of the wal-index has been mapped, try to read the\r\n  ** wal-index header immediately, without holding any lock. This usually\r\n  ** works, but may fail if the wal-index header is corrupt or currently \r\n  ** being modified by another thread or process.\r\n  */\r\n  badHdr = (page0 ? walIndexTryHdr(pWal, pChanged) : 1);\r\n\r\n  /* If the first attempt failed, it might have been due to a race\r\n  ** with a writer.  So get a WRITE lock and try again.\r\n  */\r\n  assert( badHdr==0 || pWal->writeLock==0 );\r\n  if( badHdr ){\r\n    if( pWal->readOnly & WAL_SHM_RDONLY ){\r\n      if( SQLITE_OK==(rc = walLockShared(pWal, WAL_WRITE_LOCK)) ){\r\n        walUnlockShared(pWal, WAL_WRITE_LOCK);\r\n        rc = SQLITE_READONLY_RECOVERY;\r\n      }\r\n    }else if( SQLITE_OK==(rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1)) ){\r\n      pWal->writeLock = 1;\r\n      if( SQLITE_OK==(rc = walIndexPage(pWal, 0, &page0)) ){\r\n        badHdr = walIndexTryHdr(pWal, pChanged);\r\n        if( badHdr ){\r\n          /* If the wal-index header is still malformed even while holding\r\n          ** a WRITE lock, it can only mean that the header is corrupted and\r\n          ** needs to be reconstructed.  So run recovery to do exactly that.\r\n          */\r\n          rc = walIndexRecover(pWal);\r\n          *pChanged = 1;\r\n        }\r\n      }\r\n      pWal->writeLock = 0;\r\n      walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);\r\n    }\r\n  }\r\n\r\n  /* If the header is read successfully, check the version number to make\r\n  ** sure the wal-index was not constructed with some future format that\r\n  ** this version of SQLite cannot understand.\r\n  */\r\n  if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){\r\n    rc = SQLITE_CANTOPEN_BKPT;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This is the value that walTryBeginRead returns when it needs to\r\n** be retried.\r\n*/\r\n#define WAL_RETRY  (-1)\r\n\r\n/*\r\n** Attempt to start a read transaction.  This might fail due to a race or\r\n** other transient condition.  When that happens, it returns WAL_RETRY to\r\n** indicate to the caller that it is safe to retry immediately.\r\n**\r\n** On success return SQLITE_OK.  On a permanent failure (such an\r\n** I/O error or an SQLITE_BUSY because another process is running\r\n** recovery) return a positive error code.\r\n**\r\n** The useWal parameter is true to force the use of the WAL and disable\r\n** the case where the WAL is bypassed because it has been completely\r\n** checkpointed.  If useWal==0 then this routine calls walIndexReadHdr() \r\n** to make a copy of the wal-index header into pWal->hdr.  If the \r\n** wal-index header has changed, *pChanged is set to 1 (as an indication \r\n** to the caller that the local paget cache is obsolete and needs to be \r\n** flushed.)  When useWal==1, the wal-index header is assumed to already\r\n** be loaded and the pChanged parameter is unused.\r\n**\r\n** The caller must set the cnt parameter to the number of prior calls to\r\n** this routine during the current read attempt that returned WAL_RETRY.\r\n** This routine will start taking more aggressive measures to clear the\r\n** race conditions after multiple WAL_RETRY returns, and after an excessive\r\n** number of errors will ultimately return SQLITE_PROTOCOL.  The\r\n** SQLITE_PROTOCOL return indicates that some other process has gone rogue\r\n** and is not honoring the locking protocol.  There is a vanishingly small\r\n** chance that SQLITE_PROTOCOL could be returned because of a run of really\r\n** bad luck when there is lots of contention for the wal-index, but that\r\n** possibility is so small that it can be safely neglected, we believe.\r\n**\r\n** On success, this routine obtains a read lock on \r\n** WAL_READ_LOCK(pWal->readLock).  The pWal->readLock integer is\r\n** in the range 0 <= pWal->readLock < WAL_NREADER.  If pWal->readLock==(-1)\r\n** that means the Wal does not hold any read lock.  The reader must not\r\n** access any database page that is modified by a WAL frame up to and\r\n** including frame number aReadMark[pWal->readLock].  The reader will\r\n** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0\r\n** Or if pWal->readLock==0, then the reader will ignore the WAL\r\n** completely and get all content directly from the database file.\r\n** If the useWal parameter is 1 then the WAL will never be ignored and\r\n** this routine will always set pWal->readLock>0 on success.\r\n** When the read transaction is completed, the caller must release the\r\n** lock on WAL_READ_LOCK(pWal->readLock) and set pWal->readLock to -1.\r\n**\r\n** This routine uses the nBackfill and aReadMark[] fields of the header\r\n** to select a particular WAL_READ_LOCK() that strives to let the\r\n** checkpoint process do as much work as possible.  This routine might\r\n** update values of the aReadMark[] array in the header, but if it does\r\n** so it takes care to hold an exclusive lock on the corresponding\r\n** WAL_READ_LOCK() while changing values.\r\n*/\r\nstatic int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){\r\n  volatile WalCkptInfo *pInfo;    /* Checkpoint information in wal-index */\r\n  u32 mxReadMark;                 /* Largest aReadMark[] value */\r\n  int mxI;                        /* Index of largest aReadMark[] value */\r\n  int i;                          /* Loop counter */\r\n  int rc = SQLITE_OK;             /* Return code  */\r\n\r\n  assert( pWal->readLock<0 );     /* Not currently locked */\r\n\r\n  /* Take steps to avoid spinning forever if there is a protocol error.\r\n  **\r\n  ** Circumstances that cause a RETRY should only last for the briefest\r\n  ** instances of time.  No I/O or other system calls are done while the\r\n  ** locks are held, so the locks should not be held for very long. But \r\n  ** if we are unlucky, another process that is holding a lock might get\r\n  ** paged out or take a page-fault that is time-consuming to resolve, \r\n  ** during the few nanoseconds that it is holding the lock.  In that case,\r\n  ** it might take longer than normal for the lock to free.\r\n  **\r\n  ** After 5 RETRYs, we begin calling sqlite3OsSleep().  The first few\r\n  ** calls to sqlite3OsSleep() have a delay of 1 microsecond.  Really this\r\n  ** is more of a scheduler yield than an actual delay.  But on the 10th\r\n  ** an subsequent retries, the delays start becoming longer and longer, \r\n  ** so that on the 100th (and last) RETRY we delay for 21 milliseconds.\r\n  ** The total delay time before giving up is less than 1 second.\r\n  */\r\n  if( cnt>5 ){\r\n    int nDelay = 1;                      /* Pause time in microseconds */\r\n    if( cnt>100 ){\r\n      VVA_ONLY( pWal->lockError = 1; )\r\n      return SQLITE_PROTOCOL;\r\n    }\r\n    if( cnt>=10 ) nDelay = (cnt-9)*238;  /* Max delay 21ms. Total delay 996ms */\r\n    sqlite3OsSleep(pWal->pVfs, nDelay);\r\n  }\r\n\r\n  if( !useWal ){\r\n    rc = walIndexReadHdr(pWal, pChanged);\r\n    if( rc==SQLITE_BUSY ){\r\n      /* If there is not a recovery running in another thread or process\r\n      ** then convert BUSY errors to WAL_RETRY.  If recovery is known to\r\n      ** be running, convert BUSY to BUSY_RECOVERY.  There is a race here\r\n      ** which might cause WAL_RETRY to be returned even if BUSY_RECOVERY\r\n      ** would be technically correct.  But the race is benign since with\r\n      ** WAL_RETRY this routine will be called again and will probably be\r\n      ** right on the second iteration.\r\n      */\r\n      if( pWal->apWiData[0]==0 ){\r\n        /* This branch is taken when the xShmMap() method returns SQLITE_BUSY.\r\n        ** We assume this is a transient condition, so return WAL_RETRY. The\r\n        ** xShmMap() implementation used by the default unix and win32 VFS \r\n        ** modules may return SQLITE_BUSY due to a race condition in the \r\n        ** code that determines whether or not the shared-memory region \r\n        ** must be zeroed before the requested page is returned.\r\n        */\r\n        rc = WAL_RETRY;\r\n      }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){\r\n        walUnlockShared(pWal, WAL_RECOVER_LOCK);\r\n        rc = WAL_RETRY;\r\n      }else if( rc==SQLITE_BUSY ){\r\n        rc = SQLITE_BUSY_RECOVERY;\r\n      }\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n  }\r\n\r\n  pInfo = walCkptInfo(pWal);\r\n  if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame ){\r\n    /* The WAL has been completely backfilled (or it is empty).\r\n    ** and can be safely ignored.\r\n    */\r\n    rc = walLockShared(pWal, WAL_READ_LOCK(0));\r\n    walShmBarrier(pWal);\r\n    if( rc==SQLITE_OK ){\r\n      if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){\r\n        /* It is not safe to allow the reader to continue here if frames\r\n        ** may have been appended to the log before READ_LOCK(0) was obtained.\r\n        ** When holding READ_LOCK(0), the reader ignores the entire log file,\r\n        ** which implies that the database file contains a trustworthy\r\n        ** snapshoT. Since holding READ_LOCK(0) prevents a checkpoint from\r\n        ** happening, this is usually correct.\r\n        **\r\n        ** However, if frames have been appended to the log (or if the log \r\n        ** is wrapped and written for that matter) before the READ_LOCK(0)\r\n        ** is obtained, that is not necessarily true. A checkpointer may\r\n        ** have started to backfill the appended frames but crashed before\r\n        ** it finished. Leaving a corrupt image in the database file.\r\n        */\r\n        walUnlockShared(pWal, WAL_READ_LOCK(0));\r\n        return WAL_RETRY;\r\n      }\r\n      pWal->readLock = 0;\r\n      return SQLITE_OK;\r\n    }else if( rc!=SQLITE_BUSY ){\r\n      return rc;\r\n    }\r\n  }\r\n\r\n  /* If we get this far, it means that the reader will want to use\r\n  ** the WAL to get at content from recent commits.  The job now is\r\n  ** to select one of the aReadMark[] entries that is closest to\r\n  ** but not exceeding pWal->hdr.mxFrame and lock that entry.\r\n  */\r\n  mxReadMark = 0;\r\n  mxI = 0;\r\n  for(i=1; i<WAL_NREADER; i++){\r\n    u32 thisMark = pInfo->aReadMark[i];\r\n    if( mxReadMark<=thisMark && thisMark<=pWal->hdr.mxFrame ){\r\n      assert( thisMark!=READMARK_NOT_USED );\r\n      mxReadMark = thisMark;\r\n      mxI = i;\r\n    }\r\n  }\r\n  /* There was once an \"if\" here. The extra \"{\" is to preserve indentation. */\r\n  {\r\n    if( (pWal->readOnly & WAL_SHM_RDONLY)==0\r\n     && (mxReadMark<pWal->hdr.mxFrame || mxI==0)\r\n    ){\r\n      for(i=1; i<WAL_NREADER; i++){\r\n        rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);\r\n        if( rc==SQLITE_OK ){\r\n          mxReadMark = pInfo->aReadMark[i] = pWal->hdr.mxFrame;\r\n          mxI = i;\r\n          walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);\r\n          break;\r\n        }else if( rc!=SQLITE_BUSY ){\r\n          return rc;\r\n        }\r\n      }\r\n    }\r\n    if( mxI==0 ){\r\n      assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 );\r\n      return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTLOCK;\r\n    }\r\n\r\n    rc = walLockShared(pWal, WAL_READ_LOCK(mxI));\r\n    if( rc ){\r\n      return rc==SQLITE_BUSY ? WAL_RETRY : rc;\r\n    }\r\n    /* Now that the read-lock has been obtained, check that neither the\r\n    ** value in the aReadMark[] array or the contents of the wal-index\r\n    ** header have changed.\r\n    **\r\n    ** It is necessary to check that the wal-index header did not change\r\n    ** between the time it was read and when the shared-lock was obtained\r\n    ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility\r\n    ** that the log file may have been wrapped by a writer, or that frames\r\n    ** that occur later in the log than pWal->hdr.mxFrame may have been\r\n    ** copied into the database by a checkpointer. If either of these things\r\n    ** happened, then reading the database with the current value of\r\n    ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry\r\n    ** instead.\r\n    **\r\n    ** This does not guarantee that the copy of the wal-index header is up to\r\n    ** date before proceeding. That would not be possible without somehow\r\n    ** blocking writers. It only guarantees that a dangerous checkpoint or \r\n    ** log-wrap (either of which would require an exclusive lock on\r\n    ** WAL_READ_LOCK(mxI)) has not occurred since the snapshot was valid.\r\n    */\r\n    walShmBarrier(pWal);\r\n    if( pInfo->aReadMark[mxI]!=mxReadMark\r\n     || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))\r\n    ){\r\n      walUnlockShared(pWal, WAL_READ_LOCK(mxI));\r\n      return WAL_RETRY;\r\n    }else{\r\n      assert( mxReadMark<=pWal->hdr.mxFrame );\r\n      pWal->readLock = (i16)mxI;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Begin a read transaction on the database.\r\n**\r\n** This routine used to be called sqlite3OpenSnapshot() and with good reason:\r\n** it takes a snapshot of the state of the WAL and wal-index for the current\r\n** instant in time.  The current thread will continue to use this snapshot.\r\n** Other threads might append new content to the WAL and wal-index but\r\n** that extra content is ignored by the current thread.\r\n**\r\n** If the database contents have changes since the previous read\r\n** transaction, then *pChanged is set to 1 before returning.  The\r\n** Pager layer will use this to know that is cache is stale and\r\n** needs to be flushed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){\r\n  int rc;                         /* Return code */\r\n  int cnt = 0;                    /* Number of TryBeginRead attempts */\r\n\r\n  do{\r\n    rc = walTryBeginRead(pWal, pChanged, 0, ++cnt);\r\n  }while( rc==WAL_RETRY );\r\n  testcase( (rc&0xff)==SQLITE_BUSY );\r\n  testcase( (rc&0xff)==SQLITE_IOERR );\r\n  testcase( rc==SQLITE_PROTOCOL );\r\n  testcase( rc==SQLITE_OK );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Finish with a read transaction.  All this does is release the\r\n** read-lock.\r\n*/\r\nSQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){\r\n  sqlite3WalEndWriteTransaction(pWal);\r\n  if( pWal->readLock>=0 ){\r\n    walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));\r\n    pWal->readLock = -1;\r\n  }\r\n}\r\n\r\n/*\r\n** Read a page from the WAL, if it is present in the WAL and if the \r\n** current read transaction is configured to use the WAL.  \r\n**\r\n** The *pInWal is set to 1 if the requested page is in the WAL and\r\n** has been loaded.  Or *pInWal is set to 0 if the page was not in \r\n** the WAL and needs to be read out of the database.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalRead(\r\n  Wal *pWal,                      /* WAL handle */\r\n  Pgno pgno,                      /* Database page number to read data for */\r\n  int *pInWal,                    /* OUT: True if data is read from WAL */\r\n  int nOut,                       /* Size of buffer pOut in bytes */\r\n  u8 *pOut                        /* Buffer to write page data to */\r\n){\r\n  u32 iRead = 0;                  /* If !=0, WAL frame to return data from */\r\n  u32 iLast = pWal->hdr.mxFrame;  /* Last page in WAL for this reader */\r\n  int iHash;                      /* Used to loop through N hash tables */\r\n\r\n  /* This routine is only be called from within a read transaction. */\r\n  assert( pWal->readLock>=0 || pWal->lockError );\r\n\r\n  /* If the \"last page\" field of the wal-index header snapshot is 0, then\r\n  ** no data will be read from the wal under any circumstances. Return early\r\n  ** in this case as an optimization.  Likewise, if pWal->readLock==0, \r\n  ** then the WAL is ignored by the reader so return early, as if the \r\n  ** WAL were empty.\r\n  */\r\n  if( iLast==0 || pWal->readLock==0 ){\r\n    *pInWal = 0;\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Search the hash table or tables for an entry matching page number\r\n  ** pgno. Each iteration of the following for() loop searches one\r\n  ** hash table (each hash table indexes up to HASHTABLE_NPAGE frames).\r\n  **\r\n  ** This code might run concurrently to the code in walIndexAppend()\r\n  ** that adds entries to the wal-index (and possibly to this hash \r\n  ** table). This means the value just read from the hash \r\n  ** slot (aHash[iKey]) may have been added before or after the \r\n  ** current read transaction was opened. Values added after the\r\n  ** read transaction was opened may have been written incorrectly -\r\n  ** i.e. these slots may contain garbage data. However, we assume\r\n  ** that any slots written before the current read transaction was\r\n  ** opened remain unmodified.\r\n  **\r\n  ** For the reasons above, the if(...) condition featured in the inner\r\n  ** loop of the following block is more stringent that would be required \r\n  ** if we had exclusive access to the hash-table:\r\n  **\r\n  **   (aPgno[iFrame]==pgno): \r\n  **     This condition filters out normal hash-table collisions.\r\n  **\r\n  **   (iFrame<=iLast): \r\n  **     This condition filters out entries that were added to the hash\r\n  **     table after the current read-transaction had started.\r\n  */\r\n  for(iHash=walFramePage(iLast); iHash>=0 && iRead==0; iHash--){\r\n    volatile ht_slot *aHash;      /* Pointer to hash table */\r\n    volatile u32 *aPgno;          /* Pointer to array of page numbers */\r\n    u32 iZero;                    /* Frame number corresponding to aPgno[0] */\r\n    int iKey;                     /* Hash slot index */\r\n    int nCollide;                 /* Number of hash collisions remaining */\r\n    int rc;                       /* Error code */\r\n\r\n    rc = walHashGet(pWal, iHash, &aHash, &aPgno, &iZero);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    nCollide = HASHTABLE_NSLOT;\r\n    for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){\r\n      u32 iFrame = aHash[iKey] + iZero;\r\n      if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){\r\n        /* assert( iFrame>iRead ); -- not true if there is corruption */\r\n        iRead = iFrame;\r\n      }\r\n      if( (nCollide--)==0 ){\r\n        return SQLITE_CORRUPT_BKPT;\r\n      }\r\n    }\r\n  }\r\n\r\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\r\n  /* If expensive assert() statements are available, do a linear search\r\n  ** of the wal-index file content. Make sure the results agree with the\r\n  ** result obtained using the hash indexes above.  */\r\n  {\r\n    u32 iRead2 = 0;\r\n    u32 iTest;\r\n    for(iTest=iLast; iTest>0; iTest--){\r\n      if( walFramePgno(pWal, iTest)==pgno ){\r\n        iRead2 = iTest;\r\n        break;\r\n      }\r\n    }\r\n    assert( iRead==iRead2 );\r\n  }\r\n#endif\r\n\r\n  /* If iRead is non-zero, then it is the log frame number that contains the\r\n  ** required page. Read and return data from the log file.\r\n  */\r\n  if( iRead ){\r\n    int sz;\r\n    i64 iOffset;\r\n    sz = pWal->hdr.szPage;\r\n    sz = (sz&0xfe00) + ((sz&0x0001)<<16);\r\n    testcase( sz<=32768 );\r\n    testcase( sz>=65536 );\r\n    iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE;\r\n    *pInWal = 1;\r\n    /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */\r\n    return sqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset);\r\n  }\r\n\r\n  *pInWal = 0;\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/* \r\n** Return the size of the database in pages (or zero, if unknown).\r\n*/\r\nSQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){\r\n  if( pWal && ALWAYS(pWal->readLock>=0) ){\r\n    return pWal->hdr.nPage;\r\n  }\r\n  return 0;\r\n}\r\n\r\n\r\n/* \r\n** This function starts a write transaction on the WAL.\r\n**\r\n** A read transaction must have already been started by a prior call\r\n** to sqlite3WalBeginReadTransaction().\r\n**\r\n** If another thread or process has written into the database since\r\n** the read transaction was started, then it is not possible for this\r\n** thread to write as doing so would cause a fork.  So this routine\r\n** returns SQLITE_BUSY in that case and no write transaction is started.\r\n**\r\n** There can only be a single writer active at a time.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){\r\n  int rc;\r\n\r\n  /* Cannot start a write transaction without first holding a read\r\n  ** transaction. */\r\n  assert( pWal->readLock>=0 );\r\n\r\n  if( pWal->readOnly ){\r\n    return SQLITE_READONLY;\r\n  }\r\n\r\n  /* Only one writer allowed at a time.  Get the write lock.  Return\r\n  ** SQLITE_BUSY if unable.\r\n  */\r\n  rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1);\r\n  if( rc ){\r\n    return rc;\r\n  }\r\n  pWal->writeLock = 1;\r\n\r\n  /* If another connection has written to the database file since the\r\n  ** time the read transaction on this connection was started, then\r\n  ** the write is disallowed.\r\n  */\r\n  if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){\r\n    walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);\r\n    pWal->writeLock = 0;\r\n    rc = SQLITE_BUSY;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** End a write transaction.  The commit has already been done.  This\r\n** routine merely releases the lock.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal){\r\n  if( pWal->writeLock ){\r\n    walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);\r\n    pWal->writeLock = 0;\r\n    pWal->truncateOnCommit = 0;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** If any data has been written (but not committed) to the log file, this\r\n** function moves the write-pointer back to the start of the transaction.\r\n**\r\n** Additionally, the callback function is invoked for each frame written\r\n** to the WAL since the start of the transaction. If the callback returns\r\n** other than SQLITE_OK, it is not invoked again and the error code is\r\n** returned to the caller.\r\n**\r\n** Otherwise, if the callback function does not return an error, this\r\n** function returns SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){\r\n  int rc = SQLITE_OK;\r\n  if( ALWAYS(pWal->writeLock) ){\r\n    Pgno iMax = pWal->hdr.mxFrame;\r\n    Pgno iFrame;\r\n  \r\n    /* Restore the clients cache of the wal-index header to the state it\r\n    ** was in before the client began writing to the database. \r\n    */\r\n    memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr));\r\n\r\n    for(iFrame=pWal->hdr.mxFrame+1; \r\n        ALWAYS(rc==SQLITE_OK) && iFrame<=iMax; \r\n        iFrame++\r\n    ){\r\n      /* This call cannot fail. Unless the page for which the page number\r\n      ** is passed as the second argument is (a) in the cache and \r\n      ** (b) has an outstanding reference, then xUndo is either a no-op\r\n      ** (if (a) is false) or simply expels the page from the cache (if (b)\r\n      ** is false).\r\n      **\r\n      ** If the upper layer is doing a rollback, it is guaranteed that there\r\n      ** are no outstanding references to any page other than page 1. And\r\n      ** page 1 is never written to the log until the transaction is\r\n      ** committed. As a result, the call to xUndo may not fail.\r\n      */\r\n      assert( walFramePgno(pWal, iFrame)!=1 );\r\n      rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame));\r\n    }\r\n    walCleanupHash(pWal);\r\n  }\r\n  assert( rc==SQLITE_OK );\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32 \r\n** values. This function populates the array with values required to \r\n** \"rollback\" the write position of the WAL handle back to the current \r\n** point in the event of a savepoint rollback (via WalSavepointUndo()).\r\n*/\r\nSQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){\r\n  assert( pWal->writeLock );\r\n  aWalData[0] = pWal->hdr.mxFrame;\r\n  aWalData[1] = pWal->hdr.aFrameCksum[0];\r\n  aWalData[2] = pWal->hdr.aFrameCksum[1];\r\n  aWalData[3] = pWal->nCkpt;\r\n}\r\n\r\n/* \r\n** Move the write position of the WAL back to the point identified by\r\n** the values in the aWalData[] array. aWalData must point to an array\r\n** of WAL_SAVEPOINT_NDATA u32 values that has been previously populated\r\n** by a call to WalSavepoint().\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( pWal->writeLock );\r\n  assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame );\r\n\r\n  if( aWalData[3]!=pWal->nCkpt ){\r\n    /* This savepoint was opened immediately after the write-transaction\r\n    ** was started. Right after that, the writer decided to wrap around\r\n    ** to the start of the log. Update the savepoint values to match.\r\n    */\r\n    aWalData[0] = 0;\r\n    aWalData[3] = pWal->nCkpt;\r\n  }\r\n\r\n  if( aWalData[0]<pWal->hdr.mxFrame ){\r\n    pWal->hdr.mxFrame = aWalData[0];\r\n    pWal->hdr.aFrameCksum[0] = aWalData[1];\r\n    pWal->hdr.aFrameCksum[1] = aWalData[2];\r\n    walCleanupHash(pWal);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This function is called just before writing a set of frames to the log\r\n** file (see sqlite3WalFrames()). It checks to see if, instead of appending\r\n** to the current log file, it is possible to overwrite the start of the\r\n** existing log file with the new frames (i.e. \"reset\" the log). If so,\r\n** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left\r\n** unchanged.\r\n**\r\n** SQLITE_OK is returned if no error is encountered (regardless of whether\r\n** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned\r\n** if an error occurs.\r\n*/\r\nstatic int walRestartLog(Wal *pWal){\r\n  int rc = SQLITE_OK;\r\n  int cnt;\r\n\r\n  if( pWal->readLock==0 ){\r\n    volatile WalCkptInfo *pInfo = walCkptInfo(pWal);\r\n    assert( pInfo->nBackfill==pWal->hdr.mxFrame );\r\n    if( pInfo->nBackfill>0 ){\r\n      u32 salt1;\r\n      sqlite3_randomness(4, &salt1);\r\n      rc = walLockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);\r\n      if( rc==SQLITE_OK ){\r\n        /* If all readers are using WAL_READ_LOCK(0) (in other words if no\r\n        ** readers are currently using the WAL), then the transactions\r\n        ** frames will overwrite the start of the existing log. Update the\r\n        ** wal-index header to reflect this.\r\n        **\r\n        ** In theory it would be Ok to update the cache of the header only\r\n        ** at this point. But updating the actual wal-index header is also\r\n        ** safe and means there is no special case for sqlite3WalUndo()\r\n        ** to handle if this transaction is rolled back.\r\n        */\r\n        int i;                    /* Loop counter */\r\n        u32 *aSalt = pWal->hdr.aSalt;       /* Big-endian salt values */\r\n\r\n        pWal->nCkpt++;\r\n        pWal->hdr.mxFrame = 0;\r\n        sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));\r\n        aSalt[1] = salt1;\r\n        walIndexWriteHdr(pWal);\r\n        pInfo->nBackfill = 0;\r\n        for(i=1; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;\r\n        assert( pInfo->aReadMark[0]==0 );\r\n        walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);\r\n      }else if( rc!=SQLITE_BUSY ){\r\n        return rc;\r\n      }\r\n    }\r\n    walUnlockShared(pWal, WAL_READ_LOCK(0));\r\n    pWal->readLock = -1;\r\n    cnt = 0;\r\n    do{\r\n      int notUsed;\r\n      rc = walTryBeginRead(pWal, &notUsed, 1, ++cnt);\r\n    }while( rc==WAL_RETRY );\r\n    assert( (rc&0xff)!=SQLITE_BUSY ); /* BUSY not possible when useWal==1 */\r\n    testcase( (rc&0xff)==SQLITE_IOERR );\r\n    testcase( rc==SQLITE_PROTOCOL );\r\n    testcase( rc==SQLITE_OK );\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Information about the current state of the WAL file and where\r\n** the next fsync should occur - passed from sqlite3WalFrames() into\r\n** walWriteToLog().\r\n*/\r\ntypedef struct WalWriter {\r\n  Wal *pWal;                   /* The complete WAL information */\r\n  sqlite3_file *pFd;           /* The WAL file to which we write */\r\n  sqlite3_int64 iSyncPoint;    /* Fsync at this offset */\r\n  int syncFlags;               /* Flags for the fsync */\r\n  int szPage;                  /* Size of one page */\r\n} WalWriter;\r\n\r\n/*\r\n** Write iAmt bytes of content into the WAL file beginning at iOffset.\r\n** Do a sync when crossing the p->iSyncPoint boundary.\r\n**\r\n** In other words, if iSyncPoint is in between iOffset and iOffset+iAmt,\r\n** first write the part before iSyncPoint, then sync, then write the\r\n** rest.\r\n*/\r\nstatic int walWriteToLog(\r\n  WalWriter *p,              /* WAL to write to */\r\n  void *pContent,            /* Content to be written */\r\n  int iAmt,                  /* Number of bytes to write */\r\n  sqlite3_int64 iOffset      /* Start writing at this offset */\r\n){\r\n  int rc;\r\n  if( iOffset<p->iSyncPoint && iOffset+iAmt>=p->iSyncPoint ){\r\n    int iFirstAmt = (int)(p->iSyncPoint - iOffset);\r\n    rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);\r\n    if( rc ) return rc;\r\n    iOffset += iFirstAmt;\r\n    iAmt -= iFirstAmt;\r\n    pContent = (void*)(iFirstAmt + (char*)pContent);\r\n    assert( p->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) );\r\n    rc = sqlite3OsSync(p->pFd, p->syncFlags);\r\n    if( iAmt==0 || rc ) return rc;\r\n  }\r\n  rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Write out a single frame of the WAL\r\n*/\r\nstatic int walWriteOneFrame(\r\n  WalWriter *p,               /* Where to write the frame */\r\n  PgHdr *pPage,               /* The page of the frame to be written */\r\n  int nTruncate,              /* The commit flag.  Usually 0.  >0 for commit */\r\n  sqlite3_int64 iOffset       /* Byte offset at which to write */\r\n){\r\n  int rc;                         /* Result code from subfunctions */\r\n  void *pData;                    /* Data actually written */\r\n  u8 aFrame[WAL_FRAME_HDRSIZE];   /* Buffer to assemble frame-header in */\r\n#if defined(SQLITE_HAS_CODEC)\r\n  if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM;\r\n#else\r\n  pData = pPage->pData;\r\n#endif\r\n  walEncodeFrame(p->pWal, pPage->pgno, nTruncate, pData, aFrame);\r\n  rc = walWriteToLog(p, aFrame, sizeof(aFrame), iOffset);\r\n  if( rc ) return rc;\r\n  /* Write the page data */\r\n  rc = walWriteToLog(p, pData, p->szPage, iOffset+sizeof(aFrame));\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Write a set of frames to the log. The caller must hold the write-lock\r\n** on the log file (obtained using sqlite3WalBeginWriteTransaction()).\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalFrames(\r\n  Wal *pWal,                      /* Wal handle to write to */\r\n  int szPage,                     /* Database page-size in bytes */\r\n  PgHdr *pList,                   /* List of dirty pages to write */\r\n  Pgno nTruncate,                 /* Database size after this commit */\r\n  int isCommit,                   /* True if this is a commit */\r\n  int sync_flags                  /* Flags to pass to OsSync() (or 0) */\r\n){\r\n  int rc;                         /* Used to catch return codes */\r\n  u32 iFrame;                     /* Next frame address */\r\n  PgHdr *p;                       /* Iterator to run through pList with. */\r\n  PgHdr *pLast = 0;               /* Last frame in list */\r\n  int nExtra = 0;                 /* Number of extra copies of last page */\r\n  int szFrame;                    /* The size of a single frame */\r\n  i64 iOffset;                    /* Next byte to write in WAL file */\r\n  WalWriter w;                    /* The writer */\r\n\r\n  assert( pList );\r\n  assert( pWal->writeLock );\r\n\r\n  /* If this frame set completes a transaction, then nTruncate>0.  If\r\n  ** nTruncate==0 then this frame set does not complete the transaction. */\r\n  assert( (isCommit!=0)==(nTruncate!=0) );\r\n\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n  { int cnt; for(cnt=0, p=pList; p; p=p->pDirty, cnt++){}\r\n    WALTRACE((\"WAL%p: frame write begin. %d frames. mxFrame=%d. %s\\n\",\r\n              pWal, cnt, pWal->hdr.mxFrame, isCommit ? \"Commit\" : \"Spill\"));\r\n  }\r\n#endif\r\n\r\n  /* See if it is possible to write these frames into the start of the\r\n  ** log file, instead of appending to it at pWal->hdr.mxFrame.\r\n  */\r\n  if( SQLITE_OK!=(rc = walRestartLog(pWal)) ){\r\n    return rc;\r\n  }\r\n\r\n  /* If this is the first frame written into the log, write the WAL\r\n  ** header to the start of the WAL file. See comments at the top of\r\n  ** this source file for a description of the WAL header format.\r\n  */\r\n  iFrame = pWal->hdr.mxFrame;\r\n  if( iFrame==0 ){\r\n    u8 aWalHdr[WAL_HDRSIZE];      /* Buffer to assemble wal-header in */\r\n    u32 aCksum[2];                /* Checksum for wal-header */\r\n\r\n    sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN));\r\n    sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION);\r\n    sqlite3Put4byte(&aWalHdr[8], szPage);\r\n    sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt);\r\n    if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);\r\n    memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);\r\n    walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum);\r\n    sqlite3Put4byte(&aWalHdr[24], aCksum[0]);\r\n    sqlite3Put4byte(&aWalHdr[28], aCksum[1]);\r\n    \r\n    pWal->szPage = szPage;\r\n    pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;\r\n    pWal->hdr.aFrameCksum[0] = aCksum[0];\r\n    pWal->hdr.aFrameCksum[1] = aCksum[1];\r\n    pWal->truncateOnCommit = 1;\r\n\r\n    rc = sqlite3OsWrite(pWal->pWalFd, aWalHdr, sizeof(aWalHdr), 0);\r\n    WALTRACE((\"WAL%p: wal-header write %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n\r\n    /* Sync the header (unless SQLITE_IOCAP_SEQUENTIAL is true or unless\r\n    ** all syncing is turned off by PRAGMA synchronous=OFF).  Otherwise\r\n    ** an out-of-order write following a WAL restart could result in\r\n    ** database corruption.  See the ticket:\r\n    **\r\n    **     http://localhost:591/sqlite/info/ff5be73dee\r\n    */\r\n    if( pWal->syncHeader && sync_flags ){\r\n      rc = sqlite3OsSync(pWal->pWalFd, sync_flags & SQLITE_SYNC_MASK);\r\n      if( rc ) return rc;\r\n    }\r\n  }\r\n  assert( (int)pWal->szPage==szPage );\r\n\r\n  /* Setup information needed to write frames into the WAL */\r\n  w.pWal = pWal;\r\n  w.pFd = pWal->pWalFd;\r\n  w.iSyncPoint = 0;\r\n  w.syncFlags = sync_flags;\r\n  w.szPage = szPage;\r\n  iOffset = walFrameOffset(iFrame+1, szPage);\r\n  szFrame = szPage + WAL_FRAME_HDRSIZE;\r\n\r\n  /* Write all frames into the log file exactly once */\r\n  for(p=pList; p; p=p->pDirty){\r\n    int nDbSize;   /* 0 normally.  Positive == commit flag */\r\n    iFrame++;\r\n    assert( iOffset==walFrameOffset(iFrame, szPage) );\r\n    nDbSize = (isCommit && p->pDirty==0) ? nTruncate : 0;\r\n    rc = walWriteOneFrame(&w, p, nDbSize, iOffset);\r\n    if( rc ) return rc;\r\n    pLast = p;\r\n    iOffset += szFrame;\r\n  }\r\n\r\n  /* If this is the end of a transaction, then we might need to pad\r\n  ** the transaction and/or sync the WAL file.\r\n  **\r\n  ** Padding and syncing only occur if this set of frames complete a\r\n  ** transaction and if PRAGMA synchronous=FULL.  If synchronous==NORMAL\r\n  ** or synchonous==OFF, then no padding or syncing are needed.\r\n  **\r\n  ** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not\r\n  ** needed and only the sync is done.  If padding is needed, then the\r\n  ** final frame is repeated (with its commit mark) until the next sector\r\n  ** boundary is crossed.  Only the part of the WAL prior to the last\r\n  ** sector boundary is synced; the part of the last frame that extends\r\n  ** past the sector boundary is written after the sync.\r\n  */\r\n  if( isCommit && (sync_flags & WAL_SYNC_TRANSACTIONS)!=0 ){\r\n    if( pWal->padToSectorBoundary ){\r\n      int sectorSize = sqlite3OsSectorSize(pWal->pWalFd);\r\n      w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize;\r\n      while( iOffset<w.iSyncPoint ){\r\n        rc = walWriteOneFrame(&w, pLast, nTruncate, iOffset);\r\n        if( rc ) return rc;\r\n        iOffset += szFrame;\r\n        nExtra++;\r\n      }\r\n    }else{\r\n      rc = sqlite3OsSync(w.pFd, sync_flags & SQLITE_SYNC_MASK);\r\n    }\r\n  }\r\n\r\n  /* If this frame set completes the first transaction in the WAL and\r\n  ** if PRAGMA journal_size_limit is set, then truncate the WAL to the\r\n  ** journal size limit, if possible.\r\n  */\r\n  if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ){\r\n    i64 sz = pWal->mxWalSize;\r\n    if( walFrameOffset(iFrame+nExtra+1, szPage)>pWal->mxWalSize ){\r\n      sz = walFrameOffset(iFrame+nExtra+1, szPage);\r\n    }\r\n    walLimitSize(pWal, sz);\r\n    pWal->truncateOnCommit = 0;\r\n  }\r\n\r\n  /* Append data to the wal-index. It is not necessary to lock the \r\n  ** wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index\r\n  ** guarantees that there are no other writers, and no data that may\r\n  ** be in use by existing readers is being overwritten.\r\n  */\r\n  iFrame = pWal->hdr.mxFrame;\r\n  for(p=pList; p && rc==SQLITE_OK; p=p->pDirty){\r\n    iFrame++;\r\n    rc = walIndexAppend(pWal, iFrame, p->pgno);\r\n  }\r\n  while( rc==SQLITE_OK && nExtra>0 ){\r\n    iFrame++;\r\n    nExtra--;\r\n    rc = walIndexAppend(pWal, iFrame, pLast->pgno);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    /* Update the private copy of the header. */\r\n    pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));\r\n    testcase( szPage<=32768 );\r\n    testcase( szPage>=65536 );\r\n    pWal->hdr.mxFrame = iFrame;\r\n    if( isCommit ){\r\n      pWal->hdr.iChange++;\r\n      pWal->hdr.nPage = nTruncate;\r\n    }\r\n    /* If this is a commit, update the wal-index header too. */\r\n    if( isCommit ){\r\n      walIndexWriteHdr(pWal);\r\n      pWal->iCallback = iFrame;\r\n    }\r\n  }\r\n\r\n  WALTRACE((\"WAL%p: frame write %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\r\n  return rc;\r\n}\r\n\r\n/* \r\n** This routine is called to implement sqlite3_wal_checkpoint() and\r\n** related interfaces.\r\n**\r\n** Obtain a CHECKPOINT lock and then backfill as much information as\r\n** we can from WAL into the database.\r\n**\r\n** If parameter xBusy is not NULL, it is a pointer to a busy-handler\r\n** callback. In this case this function runs a blocking checkpoint.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalCheckpoint(\r\n  Wal *pWal,                      /* Wal connection */\r\n  int eMode,                      /* PASSIVE, FULL or RESTART */\r\n  int (*xBusy)(void*),            /* Function to call when busy */\r\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\r\n  int sync_flags,                 /* Flags to sync db file with (or 0) */\r\n  int nBuf,                       /* Size of temporary buffer */\r\n  u8 *zBuf,                       /* Temporary buffer to use */\r\n  int *pnLog,                     /* OUT: Number of frames in WAL */\r\n  int *pnCkpt                     /* OUT: Number of backfilled frames in WAL */\r\n){\r\n  int rc;                         /* Return code */\r\n  int isChanged = 0;              /* True if a new wal-index header is loaded */\r\n  int eMode2 = eMode;             /* Mode to pass to walCheckpoint() */\r\n\r\n  assert( pWal->ckptLock==0 );\r\n  assert( pWal->writeLock==0 );\r\n\r\n  if( pWal->readOnly ) return SQLITE_READONLY;\r\n  WALTRACE((\"WAL%p: checkpoint begins\\n\", pWal));\r\n  rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);\r\n  if( rc ){\r\n    /* Usually this is SQLITE_BUSY meaning that another thread or process\r\n    ** is already running a checkpoint, or maybe a recovery.  But it might\r\n    ** also be SQLITE_IOERR. */\r\n    return rc;\r\n  }\r\n  pWal->ckptLock = 1;\r\n\r\n  /* If this is a blocking-checkpoint, then obtain the write-lock as well\r\n  ** to prevent any writers from running while the checkpoint is underway.\r\n  ** This has to be done before the call to walIndexReadHdr() below.\r\n  **\r\n  ** If the writer lock cannot be obtained, then a passive checkpoint is\r\n  ** run instead. Since the checkpointer is not holding the writer lock,\r\n  ** there is no point in blocking waiting for any readers. Assuming no \r\n  ** other error occurs, this function will return SQLITE_BUSY to the caller.\r\n  */\r\n  if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){\r\n    rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_WRITE_LOCK, 1);\r\n    if( rc==SQLITE_OK ){\r\n      pWal->writeLock = 1;\r\n    }else if( rc==SQLITE_BUSY ){\r\n      eMode2 = SQLITE_CHECKPOINT_PASSIVE;\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n\r\n  /* Read the wal-index header. */\r\n  if( rc==SQLITE_OK ){\r\n    rc = walIndexReadHdr(pWal, &isChanged);\r\n  }\r\n\r\n  /* Copy data from the log to the database file. */\r\n  if( rc==SQLITE_OK ){\r\n    if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n    }else{\r\n      rc = walCheckpoint(pWal, eMode2, xBusy, pBusyArg, sync_flags, zBuf);\r\n    }\r\n\r\n    /* If no error occurred, set the output variables. */\r\n    if( rc==SQLITE_OK || rc==SQLITE_BUSY ){\r\n      if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;\r\n      if( pnCkpt ) *pnCkpt = (int)(walCkptInfo(pWal)->nBackfill);\r\n    }\r\n  }\r\n\r\n  if( isChanged ){\r\n    /* If a new wal-index header was loaded before the checkpoint was \r\n    ** performed, then the pager-cache associated with pWal is now\r\n    ** out of date. So zero the cached wal-index header to ensure that\r\n    ** next time the pager opens a snapshot on this database it knows that\r\n    ** the cache needs to be reset.\r\n    */\r\n    memset(&pWal->hdr, 0, sizeof(WalIndexHdr));\r\n  }\r\n\r\n  /* Release the locks. */\r\n  sqlite3WalEndWriteTransaction(pWal);\r\n  walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);\r\n  pWal->ckptLock = 0;\r\n  WALTRACE((\"WAL%p: checkpoint %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\r\n  return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc);\r\n}\r\n\r\n/* Return the value to pass to a sqlite3_wal_hook callback, the\r\n** number of frames in the WAL at the point of the last commit since\r\n** sqlite3WalCallback() was called.  If no commits have occurred since\r\n** the last call, then return 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){\r\n  u32 ret = 0;\r\n  if( pWal ){\r\n    ret = pWal->iCallback;\r\n    pWal->iCallback = 0;\r\n  }\r\n  return (int)ret;\r\n}\r\n\r\n/*\r\n** This function is called to change the WAL subsystem into or out\r\n** of locking_mode=EXCLUSIVE.\r\n**\r\n** If op is zero, then attempt to change from locking_mode=EXCLUSIVE\r\n** into locking_mode=NORMAL.  This means that we must acquire a lock\r\n** on the pWal->readLock byte.  If the WAL is already in locking_mode=NORMAL\r\n** or if the acquisition of the lock fails, then return 0.  If the\r\n** transition out of exclusive-mode is successful, return 1.  This\r\n** operation must occur while the pager is still holding the exclusive\r\n** lock on the main database file.\r\n**\r\n** If op is one, then change from locking_mode=NORMAL into \r\n** locking_mode=EXCLUSIVE.  This means that the pWal->readLock must\r\n** be released.  Return 1 if the transition is made and 0 if the\r\n** WAL is already in exclusive-locking mode - meaning that this\r\n** routine is a no-op.  The pager must already hold the exclusive lock\r\n** on the main database file before invoking this operation.\r\n**\r\n** If op is negative, then do a dry-run of the op==1 case but do\r\n** not actually change anything. The pager uses this to see if it\r\n** should acquire the database exclusive lock prior to invoking\r\n** the op==1 case.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){\r\n  int rc;\r\n  assert( pWal->writeLock==0 );\r\n  assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 );\r\n\r\n  /* pWal->readLock is usually set, but might be -1 if there was a \r\n  ** prior error while attempting to acquire are read-lock. This cannot \r\n  ** happen if the connection is actually in exclusive mode (as no xShmLock\r\n  ** locks are taken in this case). Nor should the pager attempt to\r\n  ** upgrade to exclusive-mode following such an error.\r\n  */\r\n  assert( pWal->readLock>=0 || pWal->lockError );\r\n  assert( pWal->readLock>=0 || (op<=0 && pWal->exclusiveMode==0) );\r\n\r\n  if( op==0 ){\r\n    if( pWal->exclusiveMode ){\r\n      pWal->exclusiveMode = 0;\r\n      if( walLockShared(pWal, WAL_READ_LOCK(pWal->readLock))!=SQLITE_OK ){\r\n        pWal->exclusiveMode = 1;\r\n      }\r\n      rc = pWal->exclusiveMode==0;\r\n    }else{\r\n      /* Already in locking_mode=NORMAL */\r\n      rc = 0;\r\n    }\r\n  }else if( op>0 ){\r\n    assert( pWal->exclusiveMode==0 );\r\n    assert( pWal->readLock>=0 );\r\n    walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));\r\n    pWal->exclusiveMode = 1;\r\n    rc = 1;\r\n  }else{\r\n    rc = pWal->exclusiveMode==0;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Return true if the argument is non-NULL and the WAL module is using\r\n** heap-memory for the wal-index. Otherwise, if the argument is NULL or the\r\n** WAL module is using shared-memory, return false. \r\n*/\r\nSQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal){\r\n  return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE );\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_ZIPVFS\r\n/*\r\n** If the argument is not NULL, it points to a Wal object that holds a\r\n** read-lock. This function returns the database page-size if it is known,\r\n** or zero if it is not (or if pWal is NULL).\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal){\r\n  assert( pWal==0 || pWal->readLock>=0 );\r\n  return (pWal ? pWal->szPage : 0);\r\n}\r\n#endif\r\n\r\n#endif /* #ifndef SQLITE_OMIT_WAL */\r\n\r\n/************** End of wal.c *************************************************/\r\n/************** Begin file btmutex.c *****************************************/\r\n/*\r\n** 2007 August 27\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code used to implement mutexes on Btree objects.\r\n** This code really belongs in btree.c.  But btree.c is getting too\r\n** big and we want to break it down some.  This packaged seemed like\r\n** a good breakout.\r\n*/\r\n/************** Include btreeInt.h in the middle of btmutex.c ****************/\r\n/************** Begin file btreeInt.h ****************************************/\r\n/*\r\n** 2004 April 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file implements a external (disk-based) database using BTrees.\r\n** For a detailed discussion of BTrees, refer to\r\n**\r\n**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:\r\n**     \"Sorting And Searching\", pages 473-480. Addison-Wesley\r\n**     Publishing Company, Reading, Massachusetts.\r\n**\r\n** The basic idea is that each page of the file contains N database\r\n** entries and N+1 pointers to subpages.\r\n**\r\n**   ----------------------------------------------------------------\r\n**   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |\r\n**   ----------------------------------------------------------------\r\n**\r\n** All of the keys on the page that Ptr(0) points to have values less\r\n** than Key(0).  All of the keys on page Ptr(1) and its subpages have\r\n** values greater than Key(0) and less than Key(1).  All of the keys\r\n** on Ptr(N) and its subpages have values greater than Key(N-1).  And\r\n** so forth.\r\n**\r\n** Finding a particular key requires reading O(log(M)) pages from the \r\n** disk where M is the number of entries in the tree.\r\n**\r\n** In this implementation, a single file can hold one or more separate \r\n** BTrees.  Each BTree is identified by the index of its root page.  The\r\n** key and data for any entry are combined to form the \"payload\".  A\r\n** fixed amount of payload can be carried directly on the database\r\n** page.  If the payload is larger than the preset amount then surplus\r\n** bytes are stored on overflow pages.  The payload for an entry\r\n** and the preceding pointer are combined to form a \"Cell\".  Each \r\n** page has a small header which contains the Ptr(N) pointer and other\r\n** information such as the size of key and data.\r\n**\r\n** FORMAT DETAILS\r\n**\r\n** The file is divided into pages.  The first page is called page 1,\r\n** the second is page 2, and so forth.  A page number of zero indicates\r\n** \"no such page\".  The page size can be any power of 2 between 512 and 65536.\r\n** Each page can be either a btree page, a freelist page, an overflow\r\n** page, or a pointer-map page.\r\n**\r\n** The first page is always a btree page.  The first 100 bytes of the first\r\n** page contain a special header (the \"file header\") that describes the file.\r\n** The format of the file header is as follows:\r\n**\r\n**   OFFSET   SIZE    DESCRIPTION\r\n**      0      16     Header string: \"SQLite format 3\\000\"\r\n**     16       2     Page size in bytes.  \r\n**     18       1     File format write version\r\n**     19       1     File format read version\r\n**     20       1     Bytes of unused space at the end of each page\r\n**     21       1     Max embedded payload fraction\r\n**     22       1     Min embedded payload fraction\r\n**     23       1     Min leaf payload fraction\r\n**     24       4     File change counter\r\n**     28       4     Reserved for future use\r\n**     32       4     First freelist page\r\n**     36       4     Number of freelist pages in the file\r\n**     40      60     15 4-byte meta values passed to higher layers\r\n**\r\n**     40       4     Schema cookie\r\n**     44       4     File format of schema layer\r\n**     48       4     Size of page cache\r\n**     52       4     Largest root-page (auto/incr_vacuum)\r\n**     56       4     1=UTF-8 2=UTF16le 3=UTF16be\r\n**     60       4     User version\r\n**     64       4     Incremental vacuum mode\r\n**     68       4     unused\r\n**     72       4     unused\r\n**     76       4     unused\r\n**\r\n** All of the integer values are big-endian (most significant byte first).\r\n**\r\n** The file change counter is incremented when the database is changed\r\n** This counter allows other processes to know when the file has changed\r\n** and thus when they need to flush their cache.\r\n**\r\n** The max embedded payload fraction is the amount of the total usable\r\n** space in a page that can be consumed by a single cell for standard\r\n** B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default\r\n** is to limit the maximum cell size so that at least 4 cells will fit\r\n** on one page.  Thus the default max embedded payload fraction is 64.\r\n**\r\n** If the payload for a cell is larger than the max payload, then extra\r\n** payload is spilled to overflow pages.  Once an overflow page is allocated,\r\n** as many bytes as possible are moved into the overflow pages without letting\r\n** the cell size drop below the min embedded payload fraction.\r\n**\r\n** The min leaf payload fraction is like the min embedded payload fraction\r\n** except that it applies to leaf nodes in a LEAFDATA tree.  The maximum\r\n** payload fraction for a LEAFDATA tree is always 100% (or 255) and it\r\n** not specified in the header.\r\n**\r\n** Each btree pages is divided into three sections:  The header, the\r\n** cell pointer array, and the cell content area.  Page 1 also has a 100-byte\r\n** file header that occurs before the page header.\r\n**\r\n**      |----------------|\r\n**      | file header    |   100 bytes.  Page 1 only.\r\n**      |----------------|\r\n**      | page header    |   8 bytes for leaves.  12 bytes for interior nodes\r\n**      |----------------|\r\n**      | cell pointer   |   |  2 bytes per cell.  Sorted order.\r\n**      | array          |   |  Grows downward\r\n**      |                |   v\r\n**      |----------------|\r\n**      | unallocated    |\r\n**      | space          |\r\n**      |----------------|   ^  Grows upwards\r\n**      | cell content   |   |  Arbitrary order interspersed with freeblocks.\r\n**      | area           |   |  and free space fragments.\r\n**      |----------------|\r\n**\r\n** The page headers looks like this:\r\n**\r\n**   OFFSET   SIZE     DESCRIPTION\r\n**      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf\r\n**      1       2      byte offset to the first freeblock\r\n**      3       2      number of cells on this page\r\n**      5       2      first byte of the cell content area\r\n**      7       1      number of fragmented free bytes\r\n**      8       4      Right child (the Ptr(N) value).  Omitted on leaves.\r\n**\r\n** The flags define the format of this btree page.  The leaf flag means that\r\n** this page has no children.  The zerodata flag means that this page carries\r\n** only keys and no data.  The intkey flag means that the key is a integer\r\n** which is stored in the key size entry of the cell header rather than in\r\n** the payload area.\r\n**\r\n** The cell pointer array begins on the first byte after the page header.\r\n** The cell pointer array contains zero or more 2-byte numbers which are\r\n** offsets from the beginning of the page to the cell content in the cell\r\n** content area.  The cell pointers occur in sorted order.  The system strives\r\n** to keep free space after the last cell pointer so that new cells can\r\n** be easily added without having to defragment the page.\r\n**\r\n** Cell content is stored at the very end of the page and grows toward the\r\n** beginning of the page.\r\n**\r\n** Unused space within the cell content area is collected into a linked list of\r\n** freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset\r\n** to the first freeblock is given in the header.  Freeblocks occur in\r\n** increasing order.  Because a freeblock must be at least 4 bytes in size,\r\n** any group of 3 or fewer unused bytes in the cell content area cannot\r\n** exist on the freeblock chain.  A group of 3 or fewer free bytes is called\r\n** a fragment.  The total number of bytes in all fragments is recorded.\r\n** in the page header at offset 7.\r\n**\r\n**    SIZE    DESCRIPTION\r\n**      2     Byte offset of the next freeblock\r\n**      2     Bytes in this freeblock\r\n**\r\n** Cells are of variable length.  Cells are stored in the cell content area at\r\n** the end of the page.  Pointers to the cells are in the cell pointer array\r\n** that immediately follows the page header.  Cells is not necessarily\r\n** contiguous or in order, but cell pointers are contiguous and in order.\r\n**\r\n** Cell content makes use of variable length integers.  A variable\r\n** length integer is 1 to 9 bytes where the lower 7 bits of each \r\n** byte are used.  The integer consists of all bytes that have bit 8 set and\r\n** the first byte with bit 8 clear.  The most significant byte of the integer\r\n** appears first.  A variable-length integer may not be more than 9 bytes long.\r\n** As a special case, all 8 bytes of the 9th byte are used as data.  This\r\n** allows a 64-bit integer to be encoded in 9 bytes.\r\n**\r\n**    0x00                      becomes  0x00000000\r\n**    0x7f                      becomes  0x0000007f\r\n**    0x81 0x00                 becomes  0x00000080\r\n**    0x82 0x00                 becomes  0x00000100\r\n**    0x80 0x7f                 becomes  0x0000007f\r\n**    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678\r\n**    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081\r\n**\r\n** Variable length integers are used for rowids and to hold the number of\r\n** bytes of key and data in a btree cell.\r\n**\r\n** The content of a cell looks like this:\r\n**\r\n**    SIZE    DESCRIPTION\r\n**      4     Page number of the left child. Omitted if leaf flag is set.\r\n**     var    Number of bytes of data. Omitted if the zerodata flag is set.\r\n**     var    Number of bytes of key. Or the key itself if intkey flag is set.\r\n**      *     Payload\r\n**      4     First page of the overflow chain.  Omitted if no overflow\r\n**\r\n** Overflow pages form a linked list.  Each page except the last is completely\r\n** filled with data (pagesize - 4 bytes).  The last page can have as little\r\n** as 1 byte of data.\r\n**\r\n**    SIZE    DESCRIPTION\r\n**      4     Page number of next overflow page\r\n**      *     Data\r\n**\r\n** Freelist pages come in two subtypes: trunk pages and leaf pages.  The\r\n** file header points to the first in a linked list of trunk page.  Each trunk\r\n** page points to multiple leaf pages.  The content of a leaf page is\r\n** unspecified.  A trunk page looks like this:\r\n**\r\n**    SIZE    DESCRIPTION\r\n**      4     Page number of next trunk page\r\n**      4     Number of leaf pointers on this page\r\n**      *     zero or more pages numbers of leaves\r\n*/\r\n\r\n\r\n/* The following value is the maximum cell size assuming a maximum page\r\n** size give above.\r\n*/\r\n#define MX_CELL_SIZE(pBt)  ((int)(pBt->pageSize-8))\r\n\r\n/* The maximum number of cells on a single page of the database.  This\r\n** assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself\r\n** plus 2 bytes for the index to the cell in the page header).  Such\r\n** small cells will be rare, but they are possible.\r\n*/\r\n#define MX_CELL(pBt) ((pBt->pageSize-8)/6)\r\n\r\n/* Forward declarations */\r\ntypedef struct MemPage MemPage;\r\ntypedef struct BtLock BtLock;\r\n\r\n/*\r\n** This is a magic string that appears at the beginning of every\r\n** SQLite database in order to identify the file as a real database.\r\n**\r\n** You can change this value at compile-time by specifying a\r\n** -DSQLITE_FILE_HEADER=\"...\" on the compiler command-line.  The\r\n** header must be exactly 16 bytes including the zero-terminator so\r\n** the string itself should be 15 characters long.  If you change\r\n** the header, then your custom library will not be able to read \r\n** databases generated by the standard tools and the standard tools\r\n** will not be able to read databases created by your custom library.\r\n*/\r\n#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */\r\n#  define SQLITE_FILE_HEADER \"SQLite format 3\"\r\n#endif\r\n\r\n/*\r\n** Page type flags.  An ORed combination of these flags appear as the\r\n** first byte of on-disk image of every BTree page.\r\n*/\r\n#define PTF_INTKEY    0x01\r\n#define PTF_ZERODATA  0x02\r\n#define PTF_LEAFDATA  0x04\r\n#define PTF_LEAF      0x08\r\n\r\n/*\r\n** As each page of the file is loaded into memory, an instance of the following\r\n** structure is appended and initialized to zero.  This structure stores\r\n** information about the page that is decoded from the raw file page.\r\n**\r\n** The pParent field points back to the parent page.  This allows us to\r\n** walk up the BTree from any leaf to the root.  Care must be taken to\r\n** unref() the parent page pointer when this page is no longer referenced.\r\n** The pageDestructor() routine handles that chore.\r\n**\r\n** Access to all fields of this structure is controlled by the mutex\r\n** stored in MemPage.pBt->mutex.\r\n*/\r\nstruct MemPage {\r\n  u8 isInit;           /* True if previously initialized. MUST BE FIRST! */\r\n  u8 nOverflow;        /* Number of overflow cell bodies in aCell[] */\r\n  u8 intKey;           /* True if intkey flag is set */\r\n  u8 leaf;             /* True if leaf flag is set */\r\n  u8 hasData;          /* True if this page stores data */\r\n  u8 hdrOffset;        /* 100 for page 1.  0 otherwise */\r\n  u8 childPtrSize;     /* 0 if leaf==1.  4 if leaf==0 */\r\n  u8 max1bytePayload;  /* min(maxLocal,127) */\r\n  u16 maxLocal;        /* Copy of BtShared.maxLocal or BtShared.maxLeaf */\r\n  u16 minLocal;        /* Copy of BtShared.minLocal or BtShared.minLeaf */\r\n  u16 cellOffset;      /* Index in aData of first cell pointer */\r\n  u16 nFree;           /* Number of free bytes on the page */\r\n  u16 nCell;           /* Number of cells on this page, local and ovfl */\r\n  u16 maskPage;        /* Mask for page offset */\r\n  u16 aiOvfl[5];       /* Insert the i-th overflow cell before the aiOvfl-th\r\n                       ** non-overflow cell */\r\n  u8 *apOvfl[5];       /* Pointers to the body of overflow cells */\r\n  BtShared *pBt;       /* Pointer to BtShared that this page is part of */\r\n  u8 *aData;           /* Pointer to disk image of the page data */\r\n  u8 *aDataEnd;        /* One byte past the end of usable data */\r\n  u8 *aCellIdx;        /* The cell index area */\r\n  DbPage *pDbPage;     /* Pager page handle */\r\n  Pgno pgno;           /* Page number for this page */\r\n};\r\n\r\n/*\r\n** The in-memory image of a disk page has the auxiliary information appended\r\n** to the end.  EXTRA_SIZE is the number of bytes of space needed to hold\r\n** that extra information.\r\n*/\r\n#define EXTRA_SIZE sizeof(MemPage)\r\n\r\n/*\r\n** A linked list of the following structures is stored at BtShared.pLock.\r\n** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor \r\n** is opened on the table with root page BtShared.iTable. Locks are removed\r\n** from this list when a transaction is committed or rolled back, or when\r\n** a btree handle is closed.\r\n*/\r\nstruct BtLock {\r\n  Btree *pBtree;        /* Btree handle holding this lock */\r\n  Pgno iTable;          /* Root page of table */\r\n  u8 eLock;             /* READ_LOCK or WRITE_LOCK */\r\n  BtLock *pNext;        /* Next in BtShared.pLock list */\r\n};\r\n\r\n/* Candidate values for BtLock.eLock */\r\n#define READ_LOCK     1\r\n#define WRITE_LOCK    2\r\n\r\n/* A Btree handle\r\n**\r\n** A database connection contains a pointer to an instance of\r\n** this object for every database file that it has open.  This structure\r\n** is opaque to the database connection.  The database connection cannot\r\n** see the internals of this structure and only deals with pointers to\r\n** this structure.\r\n**\r\n** For some database files, the same underlying database cache might be \r\n** shared between multiple connections.  In that case, each connection\r\n** has it own instance of this object.  But each instance of this object\r\n** points to the same BtShared object.  The database cache and the\r\n** schema associated with the database file are all contained within\r\n** the BtShared object.\r\n**\r\n** All fields in this structure are accessed under sqlite3.mutex.\r\n** The pBt pointer itself may not be changed while there exists cursors \r\n** in the referenced BtShared that point back to this Btree since those\r\n** cursors have to go through this Btree to find their BtShared and\r\n** they often do so without holding sqlite3.mutex.\r\n*/\r\nstruct Btree {\r\n  sqlite3 *db;       /* The database connection holding this btree */\r\n  BtShared *pBt;     /* Sharable content of this btree */\r\n  u8 inTrans;        /* TRANS_NONE, TRANS_READ or TRANS_WRITE */\r\n  u8 sharable;       /* True if we can share pBt with another db */\r\n  u8 locked;         /* True if db currently has pBt locked */\r\n  int wantToLock;    /* Number of nested calls to sqlite3BtreeEnter() */\r\n  int nBackup;       /* Number of backup operations reading this btree */\r\n  Btree *pNext;      /* List of other sharable Btrees from the same db */\r\n  Btree *pPrev;      /* Back pointer of the same list */\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  BtLock lock;       /* Object used to lock page 1 */\r\n#endif\r\n};\r\n\r\n/*\r\n** Btree.inTrans may take one of the following values.\r\n**\r\n** If the shared-data extension is enabled, there may be multiple users\r\n** of the Btree structure. At most one of these may open a write transaction,\r\n** but any number may have active read transactions.\r\n*/\r\n#define TRANS_NONE  0\r\n#define TRANS_READ  1\r\n#define TRANS_WRITE 2\r\n\r\n/*\r\n** An instance of this object represents a single database file.\r\n** \r\n** A single database file can be in use at the same time by two\r\n** or more database connections.  When two or more connections are\r\n** sharing the same database file, each connection has it own\r\n** private Btree object for the file and each of those Btrees points\r\n** to this one BtShared object.  BtShared.nRef is the number of\r\n** connections currently sharing this database file.\r\n**\r\n** Fields in this structure are accessed under the BtShared.mutex\r\n** mutex, except for nRef and pNext which are accessed under the\r\n** global SQLITE_MUTEX_STATIC_MASTER mutex.  The pPager field\r\n** may not be modified once it is initially set as long as nRef>0.\r\n** The pSchema field may be set once under BtShared.mutex and\r\n** thereafter is unchanged as long as nRef>0.\r\n**\r\n** isPending:\r\n**\r\n**   If a BtShared client fails to obtain a write-lock on a database\r\n**   table (because there exists one or more read-locks on the table),\r\n**   the shared-cache enters 'pending-lock' state and isPending is\r\n**   set to true.\r\n**\r\n**   The shared-cache leaves the 'pending lock' state when either of\r\n**   the following occur:\r\n**\r\n**     1) The current writer (BtShared.pWriter) concludes its transaction, OR\r\n**     2) The number of locks held by other connections drops to zero.\r\n**\r\n**   while in the 'pending-lock' state, no connection may start a new\r\n**   transaction.\r\n**\r\n**   This feature is included to help prevent writer-starvation.\r\n*/\r\nstruct BtShared {\r\n  Pager *pPager;        /* The page cache */\r\n  sqlite3 *db;          /* Database connection currently using this Btree */\r\n  BtCursor *pCursor;    /* A list of all open cursors */\r\n  MemPage *pPage1;      /* First page of the database */\r\n  u8 openFlags;         /* Flags to sqlite3BtreeOpen() */\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  u8 autoVacuum;        /* True if auto-vacuum is enabled */\r\n  u8 incrVacuum;        /* True if incr-vacuum is enabled */\r\n#endif\r\n  u8 inTransaction;     /* Transaction state */\r\n  u8 max1bytePayload;   /* Maximum first byte of cell for a 1-byte payload */\r\n  u16 btsFlags;         /* Boolean parameters.  See BTS_* macros below */\r\n  u16 maxLocal;         /* Maximum local payload in non-LEAFDATA tables */\r\n  u16 minLocal;         /* Minimum local payload in non-LEAFDATA tables */\r\n  u16 maxLeaf;          /* Maximum local payload in a LEAFDATA table */\r\n  u16 minLeaf;          /* Minimum local payload in a LEAFDATA table */\r\n  u32 pageSize;         /* Total number of bytes on a page */\r\n  u32 usableSize;       /* Number of usable bytes on each page */\r\n  int nTransaction;     /* Number of open transactions (read + write) */\r\n  u32 nPage;            /* Number of pages in the database */\r\n  void *pSchema;        /* Pointer to space allocated by sqlite3BtreeSchema() */\r\n  void (*xFreeSchema)(void*);  /* Destructor for BtShared.pSchema */\r\n  sqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */\r\n  Bitvec *pHasContent;  /* Set of pages moved to free-list this transaction */\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  int nRef;             /* Number of references to this structure */\r\n  BtShared *pNext;      /* Next on a list of sharable BtShared structs */\r\n  BtLock *pLock;        /* List of locks held on this shared-btree struct */\r\n  Btree *pWriter;       /* Btree with currently open write transaction */\r\n#endif\r\n  u8 *pTmpSpace;        /* BtShared.pageSize bytes of space for tmp use */\r\n};\r\n\r\n/*\r\n** Allowed values for BtShared.btsFlags\r\n*/\r\n#define BTS_READ_ONLY        0x0001   /* Underlying file is readonly */\r\n#define BTS_PAGESIZE_FIXED   0x0002   /* Page size can no longer be changed */\r\n#define BTS_SECURE_DELETE    0x0004   /* PRAGMA secure_delete is enabled */\r\n#define BTS_INITIALLY_EMPTY  0x0008   /* Database was empty at trans start */\r\n#define BTS_NO_WAL           0x0010   /* Do not open write-ahead-log files */\r\n#define BTS_EXCLUSIVE        0x0020   /* pWriter has an exclusive lock */\r\n#define BTS_PENDING          0x0040   /* Waiting for read-locks to clear */\r\n\r\n/*\r\n** An instance of the following structure is used to hold information\r\n** about a cell.  The parseCellPtr() function fills in this structure\r\n** based on information extract from the raw disk page.\r\n*/\r\ntypedef struct CellInfo CellInfo;\r\nstruct CellInfo {\r\n  i64 nKey;      /* The key for INTKEY tables, or number of bytes in key */\r\n  u8 *pCell;     /* Pointer to the start of cell content */\r\n  u32 nData;     /* Number of bytes of data */\r\n  u32 nPayload;  /* Total amount of payload */\r\n  u16 nHeader;   /* Size of the cell content header in bytes */\r\n  u16 nLocal;    /* Amount of payload held locally */\r\n  u16 iOverflow; /* Offset to overflow page number.  Zero if no overflow */\r\n  u16 nSize;     /* Size of the cell content on the main b-tree page */\r\n};\r\n\r\n/*\r\n** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than\r\n** this will be declared corrupt. This value is calculated based on a\r\n** maximum database size of 2^31 pages a minimum fanout of 2 for a\r\n** root-node and 3 for all other internal nodes.\r\n**\r\n** If a tree that appears to be taller than this is encountered, it is\r\n** assumed that the database is corrupt.\r\n*/\r\n#define BTCURSOR_MAX_DEPTH 20\r\n\r\n/*\r\n** A cursor is a pointer to a particular entry within a particular\r\n** b-tree within a database file.\r\n**\r\n** The entry is identified by its MemPage and the index in\r\n** MemPage.aCell[] of the entry.\r\n**\r\n** A single database file can be shared by two more database connections,\r\n** but cursors cannot be shared.  Each cursor is associated with a\r\n** particular database connection identified BtCursor.pBtree.db.\r\n**\r\n** Fields in this structure are accessed under the BtShared.mutex\r\n** found at self->pBt->mutex. \r\n*/\r\nstruct BtCursor {\r\n  Btree *pBtree;            /* The Btree to which this cursor belongs */\r\n  BtShared *pBt;            /* The BtShared this cursor points to */\r\n  BtCursor *pNext, *pPrev;  /* Forms a linked list of all cursors */\r\n  struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n  Pgno *aOverflow;          /* Cache of overflow page locations */\r\n#endif\r\n  Pgno pgnoRoot;            /* The root page of this tree */\r\n  sqlite3_int64 cachedRowid; /* Next rowid cache.  0 means not valid */\r\n  CellInfo info;            /* A parse of the cell we are pointing at */\r\n  i64 nKey;        /* Size of pKey, or last integer key */\r\n  void *pKey;      /* Saved key that was cursor's last known position */\r\n  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive */\r\n  u8 wrFlag;                /* True if writable */\r\n  u8 atLast;                /* Cursor pointing to the last entry */\r\n  u8 validNKey;             /* True if info.nKey is valid */\r\n  u8 eState;                /* One of the CURSOR_XXX constants (see below) */\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n  u8 isIncrblobHandle;      /* True if this cursor is an incr. io handle */\r\n#endif\r\n  i16 iPage;                            /* Index of current page in apPage */\r\n  u16 aiIdx[BTCURSOR_MAX_DEPTH];        /* Current index in apPage[i] */\r\n  MemPage *apPage[BTCURSOR_MAX_DEPTH];  /* Pages from root to current page */\r\n};\r\n\r\n/*\r\n** Potential values for BtCursor.eState.\r\n**\r\n** CURSOR_VALID:\r\n**   Cursor points to a valid entry. getPayload() etc. may be called.\r\n**\r\n** CURSOR_INVALID:\r\n**   Cursor does not point to a valid entry. This can happen (for example) \r\n**   because the table is empty or because BtreeCursorFirst() has not been\r\n**   called.\r\n**\r\n** CURSOR_REQUIRESEEK:\r\n**   The table that this cursor was opened on still exists, but has been \r\n**   modified since the cursor was last used. The cursor position is saved\r\n**   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in \r\n**   this state, restoreCursorPosition() can be called to attempt to\r\n**   seek the cursor to the saved position.\r\n**\r\n** CURSOR_FAULT:\r\n**   A unrecoverable error (an I/O error or a malloc failure) has occurred\r\n**   on a different connection that shares the BtShared cache with this\r\n**   cursor.  The error has left the cache in an inconsistent state.\r\n**   Do nothing else with this cursor.  Any attempt to use the cursor\r\n**   should return the error code stored in BtCursor.skip\r\n*/\r\n#define CURSOR_INVALID           0\r\n#define CURSOR_VALID             1\r\n#define CURSOR_REQUIRESEEK       2\r\n#define CURSOR_FAULT             3\r\n\r\n/* \r\n** The database page the PENDING_BYTE occupies. This page is never used.\r\n*/\r\n# define PENDING_BYTE_PAGE(pBt) PAGER_MJ_PGNO(pBt)\r\n\r\n/*\r\n** These macros define the location of the pointer-map entry for a \r\n** database page. The first argument to each is the number of usable\r\n** bytes on each page of the database (often 1024). The second is the\r\n** page number to look up in the pointer map.\r\n**\r\n** PTRMAP_PAGENO returns the database page number of the pointer-map\r\n** page that stores the required pointer. PTRMAP_PTROFFSET returns\r\n** the offset of the requested map entry.\r\n**\r\n** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,\r\n** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be\r\n** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements\r\n** this test.\r\n*/\r\n#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)\r\n#define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))\r\n#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))\r\n\r\n/*\r\n** The pointer map is a lookup table that identifies the parent page for\r\n** each child page in the database file.  The parent page is the page that\r\n** contains a pointer to the child.  Every page in the database contains\r\n** 0 or 1 parent pages.  (In this context 'database page' refers\r\n** to any page that is not part of the pointer map itself.)  Each pointer map\r\n** entry consists of a single byte 'type' and a 4 byte parent page number.\r\n** The PTRMAP_XXX identifiers below are the valid types.\r\n**\r\n** The purpose of the pointer map is to facility moving pages from one\r\n** position in the file to another as part of autovacuum.  When a page\r\n** is moved, the pointer in its parent must be updated to point to the\r\n** new location.  The pointer map is used to locate the parent page quickly.\r\n**\r\n** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not\r\n**                  used in this case.\r\n**\r\n** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number \r\n**                  is not used in this case.\r\n**\r\n** PTRMAP_OVERFLOW1: The database page is the first page in a list of \r\n**                   overflow pages. The page number identifies the page that\r\n**                   contains the cell with a pointer to this overflow page.\r\n**\r\n** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of\r\n**                   overflow pages. The page-number identifies the previous\r\n**                   page in the overflow page list.\r\n**\r\n** PTRMAP_BTREE: The database page is a non-root btree page. The page number\r\n**               identifies the parent page in the btree.\r\n*/\r\n#define PTRMAP_ROOTPAGE 1\r\n#define PTRMAP_FREEPAGE 2\r\n#define PTRMAP_OVERFLOW1 3\r\n#define PTRMAP_OVERFLOW2 4\r\n#define PTRMAP_BTREE 5\r\n\r\n/* A bunch of assert() statements to check the transaction state variables\r\n** of handle p (type Btree*) are internally consistent.\r\n*/\r\n#define btreeIntegrity(p) \\\r\n  assert( p->pBt->inTransaction!=TRANS_NONE || p->pBt->nTransaction==0 ); \\\r\n  assert( p->pBt->inTransaction>=p->inTrans ); \r\n\r\n\r\n/*\r\n** The ISAUTOVACUUM macro is used within balance_nonroot() to determine\r\n** if the database supports auto-vacuum or not. Because it is used\r\n** within an expression that is an argument to another macro \r\n** (sqliteMallocRaw), it is not possible to use conditional compilation.\r\n** So, this macro is defined instead.\r\n*/\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n#define ISAUTOVACUUM (pBt->autoVacuum)\r\n#else\r\n#define ISAUTOVACUUM 0\r\n#endif\r\n\r\n\r\n/*\r\n** This structure is passed around through all the sanity checking routines\r\n** in order to keep track of some global state information.\r\n*/\r\ntypedef struct IntegrityCk IntegrityCk;\r\nstruct IntegrityCk {\r\n  BtShared *pBt;    /* The tree being checked out */\r\n  Pager *pPager;    /* The associated pager.  Also accessible by pBt->pPager */\r\n  int *anRef;       /* Number of times each page is referenced */\r\n  Pgno nPage;       /* Number of pages in the database */\r\n  int mxErr;        /* Stop accumulating errors when this reaches zero */\r\n  int nErr;         /* Number of messages written to zErrMsg so far */\r\n  int mallocFailed; /* A memory allocation error has occurred */\r\n  StrAccum errMsg;  /* Accumulate the error message text here */\r\n};\r\n\r\n/*\r\n** Routines to read or write a two- and four-byte big-endian integer values.\r\n*/\r\n#define get2byte(x)   ((x)[0]<<8 | (x)[1])\r\n#define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v))\r\n#define get4byte sqlite3Get4byte\r\n#define put4byte sqlite3Put4byte\r\n\r\n/************** End of btreeInt.h ********************************************/\r\n/************** Continuing where we left off in btmutex.c ********************/\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n#if SQLITE_THREADSAFE\r\n\r\n/*\r\n** Obtain the BtShared mutex associated with B-Tree handle p. Also,\r\n** set BtShared.db to the database handle associated with p and the\r\n** p->locked boolean to true.\r\n*/\r\nstatic void lockBtreeMutex(Btree *p){\r\n  assert( p->locked==0 );\r\n  assert( sqlite3_mutex_notheld(p->pBt->mutex) );\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n\r\n  sqlite3_mutex_enter(p->pBt->mutex);\r\n  p->pBt->db = p->db;\r\n  p->locked = 1;\r\n}\r\n\r\n/*\r\n** Release the BtShared mutex associated with B-Tree handle p and\r\n** clear the p->locked boolean.\r\n*/\r\nstatic void unlockBtreeMutex(Btree *p){\r\n  BtShared *pBt = p->pBt;\r\n  assert( p->locked==1 );\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  assert( p->db==pBt->db );\r\n\r\n  sqlite3_mutex_leave(pBt->mutex);\r\n  p->locked = 0;\r\n}\r\n\r\n/*\r\n** Enter a mutex on the given BTree object.\r\n**\r\n** If the object is not sharable, then no mutex is ever required\r\n** and this routine is a no-op.  The underlying mutex is non-recursive.\r\n** But we keep a reference count in Btree.wantToLock so the behavior\r\n** of this interface is recursive.\r\n**\r\n** To avoid deadlocks, multiple Btrees are locked in the same order\r\n** by all database connections.  The p->pNext is a list of other\r\n** Btrees belonging to the same database connection as the p Btree\r\n** which need to be locked after p.  If we cannot get a lock on\r\n** p, then first unlock all of the others on p->pNext, then wait\r\n** for the lock to become available on p, then relock all of the\r\n** subsequent Btrees that desire a lock.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){\r\n  Btree *pLater;\r\n\r\n  /* Some basic sanity checking on the Btree.  The list of Btrees\r\n  ** connected by pNext and pPrev should be in sorted order by\r\n  ** Btree.pBt value. All elements of the list should belong to\r\n  ** the same connection. Only shared Btrees are on the list. */\r\n  assert( p->pNext==0 || p->pNext->pBt>p->pBt );\r\n  assert( p->pPrev==0 || p->pPrev->pBt<p->pBt );\r\n  assert( p->pNext==0 || p->pNext->db==p->db );\r\n  assert( p->pPrev==0 || p->pPrev->db==p->db );\r\n  assert( p->sharable || (p->pNext==0 && p->pPrev==0) );\r\n\r\n  /* Check for locking consistency */\r\n  assert( !p->locked || p->wantToLock>0 );\r\n  assert( p->sharable || p->wantToLock==0 );\r\n\r\n  /* We should already hold a lock on the database connection */\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n\r\n  /* Unless the database is sharable and unlocked, then BtShared.db\r\n  ** should already be set correctly. */\r\n  assert( (p->locked==0 && p->sharable) || p->pBt->db==p->db );\r\n\r\n  if( !p->sharable ) return;\r\n  p->wantToLock++;\r\n  if( p->locked ) return;\r\n\r\n  /* In most cases, we should be able to acquire the lock we\r\n  ** want without having to go throught the ascending lock\r\n  ** procedure that follows.  Just be sure not to block.\r\n  */\r\n  if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){\r\n    p->pBt->db = p->db;\r\n    p->locked = 1;\r\n    return;\r\n  }\r\n\r\n  /* To avoid deadlock, first release all locks with a larger\r\n  ** BtShared address.  Then acquire our lock.  Then reacquire\r\n  ** the other BtShared locks that we used to hold in ascending\r\n  ** order.\r\n  */\r\n  for(pLater=p->pNext; pLater; pLater=pLater->pNext){\r\n    assert( pLater->sharable );\r\n    assert( pLater->pNext==0 || pLater->pNext->pBt>pLater->pBt );\r\n    assert( !pLater->locked || pLater->wantToLock>0 );\r\n    if( pLater->locked ){\r\n      unlockBtreeMutex(pLater);\r\n    }\r\n  }\r\n  lockBtreeMutex(p);\r\n  for(pLater=p->pNext; pLater; pLater=pLater->pNext){\r\n    if( pLater->wantToLock ){\r\n      lockBtreeMutex(pLater);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Exit the recursive mutex on a Btree.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){\r\n  if( p->sharable ){\r\n    assert( p->wantToLock>0 );\r\n    p->wantToLock--;\r\n    if( p->wantToLock==0 ){\r\n      unlockBtreeMutex(p);\r\n    }\r\n  }\r\n}\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** Return true if the BtShared mutex is held on the btree, or if the\r\n** B-Tree is not marked as sharable.\r\n**\r\n** This routine is used only from within assert() statements.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){\r\n  assert( p->sharable==0 || p->locked==0 || p->wantToLock>0 );\r\n  assert( p->sharable==0 || p->locked==0 || p->db==p->pBt->db );\r\n  assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->pBt->mutex) );\r\n  assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->db->mutex) );\r\n\r\n  return (p->sharable==0 || p->locked);\r\n}\r\n#endif\r\n\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n/*\r\n** Enter and leave a mutex on a Btree given a cursor owned by that\r\n** Btree.  These entry points are used by incremental I/O and can be\r\n** omitted if that module is not used.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor *pCur){\r\n  sqlite3BtreeEnter(pCur->pBtree);\r\n}\r\nSQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur){\r\n  sqlite3BtreeLeave(pCur->pBtree);\r\n}\r\n#endif /* SQLITE_OMIT_INCRBLOB */\r\n\r\n\r\n/*\r\n** Enter the mutex on every Btree associated with a database\r\n** connection.  This is needed (for example) prior to parsing\r\n** a statement since we will be comparing table and column names\r\n** against all schemas and we do not want those schemas being\r\n** reset out from under us.\r\n**\r\n** There is a corresponding leave-all procedures.\r\n**\r\n** Enter the mutexes in accending order by BtShared pointer address\r\n** to avoid the possibility of deadlock when two threads with\r\n** two or more btrees in common both try to lock all their btrees\r\n** at the same instant.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){\r\n  int i;\r\n  Btree *p;\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  for(i=0; i<db->nDb; i++){\r\n    p = db->aDb[i].pBt;\r\n    if( p ) sqlite3BtreeEnter(p);\r\n  }\r\n}\r\nSQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){\r\n  int i;\r\n  Btree *p;\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  for(i=0; i<db->nDb; i++){\r\n    p = db->aDb[i].pBt;\r\n    if( p ) sqlite3BtreeLeave(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Return true if a particular Btree requires a lock.  Return FALSE if\r\n** no lock is ever required since it is not sharable.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){\r\n  return p->sharable;\r\n}\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** Return true if the current thread holds the database connection\r\n** mutex and all required BtShared mutexes.\r\n**\r\n** This routine is used inside assert() statements only.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){\r\n  int i;\r\n  if( !sqlite3_mutex_held(db->mutex) ){\r\n    return 0;\r\n  }\r\n  for(i=0; i<db->nDb; i++){\r\n    Btree *p;\r\n    p = db->aDb[i].pBt;\r\n    if( p && p->sharable &&\r\n         (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){\r\n      return 0;\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n#endif /* NDEBUG */\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** Return true if the correct mutexes are held for accessing the\r\n** db->aDb[iDb].pSchema structure.  The mutexes required for schema\r\n** access are:\r\n**\r\n**   (1) The mutex on db\r\n**   (2) if iDb!=1, then the mutex on db->aDb[iDb].pBt.\r\n**\r\n** If pSchema is not NULL, then iDb is computed from pSchema and\r\n** db using sqlite3SchemaToIndex().\r\n*/\r\nSQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){\r\n  Btree *p;\r\n  assert( db!=0 );\r\n  if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  if( !sqlite3_mutex_held(db->mutex) ) return 0;\r\n  if( iDb==1 ) return 1;\r\n  p = db->aDb[iDb].pBt;\r\n  assert( p!=0 );\r\n  return p->sharable==0 || p->locked==1;\r\n}\r\n#endif /* NDEBUG */\r\n\r\n#else /* SQLITE_THREADSAFE>0 above.  SQLITE_THREADSAFE==0 below */\r\n/*\r\n** The following are special cases for mutex enter routines for use\r\n** in single threaded applications that use shared cache.  Except for\r\n** these two routines, all mutex operations are no-ops in that case and\r\n** are null #defines in btree.h.\r\n**\r\n** If shared cache is disabled, then all btree mutex routines, including\r\n** the ones below, are no-ops and are null #defines in btree.h.\r\n*/\r\n\r\nSQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){\r\n  p->pBt->db = p->db;\r\n}\r\nSQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){\r\n  int i;\r\n  for(i=0; i<db->nDb; i++){\r\n    Btree *p = db->aDb[i].pBt;\r\n    if( p ){\r\n      p->pBt->db = p->db;\r\n    }\r\n  }\r\n}\r\n#endif /* if SQLITE_THREADSAFE */\r\n#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */\r\n\r\n/************** End of btmutex.c *********************************************/\r\n/************** Begin file btree.c *******************************************/\r\n/*\r\n** 2004 April 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file implements a external (disk-based) database using BTrees.\r\n** See the header comment on \"btreeInt.h\" for additional information.\r\n** Including a description of file format and an overview of operation.\r\n*/\r\n\r\n/*\r\n** The header string that appears at the beginning of every\r\n** SQLite database.\r\n*/\r\nstatic const char zMagicHeader[] = SQLITE_FILE_HEADER;\r\n\r\n/*\r\n** Set this global variable to 1 to enable tracing using the TRACE\r\n** macro.\r\n*/\r\n#if 0\r\nint sqlite3BtreeTrace=1;  /* True to enable tracing */\r\n# define TRACE(X)  if(sqlite3BtreeTrace){printf X;fflush(stdout);}\r\n#else\r\n# define TRACE(X)\r\n#endif\r\n\r\n/*\r\n** Extract a 2-byte big-endian integer from an array of unsigned bytes.\r\n** But if the value is zero, make it 65536.\r\n**\r\n** This routine is used to extract the \"offset to cell content area\" value\r\n** from the header of a btree page.  If the page size is 65536 and the page\r\n** is empty, the offset should be 65536, but the 2-byte value stores zero.\r\n** This routine makes the necessary adjustment to 65536.\r\n*/\r\n#define get2byteNotZero(X)  (((((int)get2byte(X))-1)&0xffff)+1)\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/*\r\n** A list of BtShared objects that are eligible for participation\r\n** in shared cache.  This variable has file scope during normal builds,\r\n** but the test harness needs to access it so we make it global for \r\n** test builds.\r\n**\r\n** Access to this variable is protected by SQLITE_MUTEX_STATIC_MASTER.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;\r\n#else\r\nstatic BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;\r\n#endif\r\n#endif /* SQLITE_OMIT_SHARED_CACHE */\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/*\r\n** Enable or disable the shared pager and schema features.\r\n**\r\n** This routine has no effect on existing database connections.\r\n** The shared cache setting effects only future calls to\r\n** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().\r\n*/\r\nSQLITE_API int sqlite3_enable_shared_cache(int enable){\r\n  sqlite3GlobalConfig.sharedCacheEnabled = enable;\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n\r\n\r\n#ifdef SQLITE_OMIT_SHARED_CACHE\r\n  /*\r\n  ** The functions querySharedCacheTableLock(), setSharedCacheTableLock(),\r\n  ** and clearAllSharedCacheTableLocks()\r\n  ** manipulate entries in the BtShared.pLock linked list used to store\r\n  ** shared-cache table level locks. If the library is compiled with the\r\n  ** shared-cache feature disabled, then there is only ever one user\r\n  ** of each BtShared structure and so this locking is not necessary. \r\n  ** So define the lock related functions as no-ops.\r\n  */\r\n  #define querySharedCacheTableLock(a,b,c) SQLITE_OK\r\n  #define setSharedCacheTableLock(a,b,c) SQLITE_OK\r\n  #define clearAllSharedCacheTableLocks(a)\r\n  #define downgradeAllSharedCacheTableLocks(a)\r\n  #define hasSharedCacheTableLock(a,b,c,d) 1\r\n  #define hasReadConflicts(a, b) 0\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n**** This function is only used as part of an assert() statement. ***\r\n**\r\n** Check to see if pBtree holds the required locks to read or write to the \r\n** table with root page iRoot.   Return 1 if it does and 0 if not.\r\n**\r\n** For example, when writing to a table with root-page iRoot via \r\n** Btree connection pBtree:\r\n**\r\n**    assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) );\r\n**\r\n** When writing to an index that resides in a sharable database, the \r\n** caller should have first obtained a lock specifying the root page of\r\n** the corresponding table. This makes things a bit more complicated,\r\n** as this module treats each table as a separate structure. To determine\r\n** the table corresponding to the index being written, this\r\n** function has to search through the database schema.\r\n**\r\n** Instead of a lock on the table/index rooted at page iRoot, the caller may\r\n** hold a write-lock on the schema table (root page 1). This is also\r\n** acceptable.\r\n*/\r\nstatic int hasSharedCacheTableLock(\r\n  Btree *pBtree,         /* Handle that must hold lock */\r\n  Pgno iRoot,            /* Root page of b-tree */\r\n  int isIndex,           /* True if iRoot is the root of an index b-tree */\r\n  int eLockType          /* Required lock type (READ_LOCK or WRITE_LOCK) */\r\n){\r\n  Schema *pSchema = (Schema *)pBtree->pBt->pSchema;\r\n  Pgno iTab = 0;\r\n  BtLock *pLock;\r\n\r\n  /* If this database is not shareable, or if the client is reading\r\n  ** and has the read-uncommitted flag set, then no lock is required. \r\n  ** Return true immediately.\r\n  */\r\n  if( (pBtree->sharable==0)\r\n   || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))\r\n  ){\r\n    return 1;\r\n  }\r\n\r\n  /* If the client is reading  or writing an index and the schema is\r\n  ** not loaded, then it is too difficult to actually check to see if\r\n  ** the correct locks are held.  So do not bother - just return true.\r\n  ** This case does not come up very often anyhow.\r\n  */\r\n  if( isIndex && (!pSchema || (pSchema->flags&DB_SchemaLoaded)==0) ){\r\n    return 1;\r\n  }\r\n\r\n  /* Figure out the root-page that the lock should be held on. For table\r\n  ** b-trees, this is just the root page of the b-tree being read or\r\n  ** written. For index b-trees, it is the root page of the associated\r\n  ** table.  */\r\n  if( isIndex ){\r\n    HashElem *p;\r\n    for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){\r\n      Index *pIdx = (Index *)sqliteHashData(p);\r\n      if( pIdx->tnum==(int)iRoot ){\r\n        iTab = pIdx->pTable->tnum;\r\n      }\r\n    }\r\n  }else{\r\n    iTab = iRoot;\r\n  }\r\n\r\n  /* Search for the required lock. Either a write-lock on root-page iTab, a \r\n  ** write-lock on the schema table, or (if the client is reading) a\r\n  ** read-lock on iTab will suffice. Return 1 if any of these are found.  */\r\n  for(pLock=pBtree->pBt->pLock; pLock; pLock=pLock->pNext){\r\n    if( pLock->pBtree==pBtree \r\n     && (pLock->iTable==iTab || (pLock->eLock==WRITE_LOCK && pLock->iTable==1))\r\n     && pLock->eLock>=eLockType \r\n    ){\r\n      return 1;\r\n    }\r\n  }\r\n\r\n  /* Failed to find the required lock. */\r\n  return 0;\r\n}\r\n#endif /* SQLITE_DEBUG */\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n**** This function may be used as part of assert() statements only. ****\r\n**\r\n** Return true if it would be illegal for pBtree to write into the\r\n** table or index rooted at iRoot because other shared connections are\r\n** simultaneously reading that same table or index.\r\n**\r\n** It is illegal for pBtree to write if some other Btree object that\r\n** shares the same BtShared object is currently reading or writing\r\n** the iRoot table.  Except, if the other Btree object has the\r\n** read-uncommitted flag set, then it is OK for the other object to\r\n** have a read cursor.\r\n**\r\n** For example, before writing to any part of the table or index\r\n** rooted at page iRoot, one should call:\r\n**\r\n**    assert( !hasReadConflicts(pBtree, iRoot) );\r\n*/\r\nstatic int hasReadConflicts(Btree *pBtree, Pgno iRoot){\r\n  BtCursor *p;\r\n  for(p=pBtree->pBt->pCursor; p; p=p->pNext){\r\n    if( p->pgnoRoot==iRoot \r\n     && p->pBtree!=pBtree\r\n     && 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted)\r\n    ){\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n#endif    /* #ifdef SQLITE_DEBUG */\r\n\r\n/*\r\n** Query to see if Btree handle p may obtain a lock of type eLock \r\n** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return\r\n** SQLITE_OK if the lock may be obtained (by calling\r\n** setSharedCacheTableLock()), or SQLITE_LOCKED if not.\r\n*/\r\nstatic int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){\r\n  BtShared *pBt = p->pBt;\r\n  BtLock *pIter;\r\n\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( eLock==READ_LOCK || eLock==WRITE_LOCK );\r\n  assert( p->db!=0 );\r\n  assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 );\r\n  \r\n  /* If requesting a write-lock, then the Btree must have an open write\r\n  ** transaction on this file. And, obviously, for this to be so there \r\n  ** must be an open write transaction on the file itself.\r\n  */\r\n  assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );\r\n  assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE );\r\n  \r\n  /* This routine is a no-op if the shared-cache is not enabled */\r\n  if( !p->sharable ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* If some other connection is holding an exclusive lock, the\r\n  ** requested lock may not be obtained.\r\n  */\r\n  if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){\r\n    sqlite3ConnectionBlocked(p->db, pBt->pWriter->db);\r\n    return SQLITE_LOCKED_SHAREDCACHE;\r\n  }\r\n\r\n  for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){\r\n    /* The condition (pIter->eLock!=eLock) in the following if(...) \r\n    ** statement is a simplification of:\r\n    **\r\n    **   (eLock==WRITE_LOCK || pIter->eLock==WRITE_LOCK)\r\n    **\r\n    ** since we know that if eLock==WRITE_LOCK, then no other connection\r\n    ** may hold a WRITE_LOCK on any table in this file (since there can\r\n    ** only be a single writer).\r\n    */\r\n    assert( pIter->eLock==READ_LOCK || pIter->eLock==WRITE_LOCK );\r\n    assert( eLock==READ_LOCK || pIter->pBtree==p || pIter->eLock==READ_LOCK);\r\n    if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){\r\n      sqlite3ConnectionBlocked(p->db, pIter->pBtree->db);\r\n      if( eLock==WRITE_LOCK ){\r\n        assert( p==pBt->pWriter );\r\n        pBt->btsFlags |= BTS_PENDING;\r\n      }\r\n      return SQLITE_LOCKED_SHAREDCACHE;\r\n    }\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n#endif /* !SQLITE_OMIT_SHARED_CACHE */\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/*\r\n** Add a lock on the table with root-page iTable to the shared-btree used\r\n** by Btree handle p. Parameter eLock must be either READ_LOCK or \r\n** WRITE_LOCK.\r\n**\r\n** This function assumes the following:\r\n**\r\n**   (a) The specified Btree object p is connected to a sharable\r\n**       database (one with the BtShared.sharable flag set), and\r\n**\r\n**   (b) No other Btree objects hold a lock that conflicts\r\n**       with the requested lock (i.e. querySharedCacheTableLock() has\r\n**       already been called and returned SQLITE_OK).\r\n**\r\n** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM \r\n** is returned if a malloc attempt fails.\r\n*/\r\nstatic int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){\r\n  BtShared *pBt = p->pBt;\r\n  BtLock *pLock = 0;\r\n  BtLock *pIter;\r\n\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( eLock==READ_LOCK || eLock==WRITE_LOCK );\r\n  assert( p->db!=0 );\r\n\r\n  /* A connection with the read-uncommitted flag set will never try to\r\n  ** obtain a read-lock using this function. The only read-lock obtained\r\n  ** by a connection in read-uncommitted mode is on the sqlite_master \r\n  ** table, and that lock is obtained in BtreeBeginTrans().  */\r\n  assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK );\r\n\r\n  /* This function should only be called on a sharable b-tree after it \r\n  ** has been determined that no other b-tree holds a conflicting lock.  */\r\n  assert( p->sharable );\r\n  assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) );\r\n\r\n  /* First search the list for an existing lock on this table. */\r\n  for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){\r\n    if( pIter->iTable==iTable && pIter->pBtree==p ){\r\n      pLock = pIter;\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* If the above search did not find a BtLock struct associating Btree p\r\n  ** with table iTable, allocate one and link it into the list.\r\n  */\r\n  if( !pLock ){\r\n    pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));\r\n    if( !pLock ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    pLock->iTable = iTable;\r\n    pLock->pBtree = p;\r\n    pLock->pNext = pBt->pLock;\r\n    pBt->pLock = pLock;\r\n  }\r\n\r\n  /* Set the BtLock.eLock variable to the maximum of the current lock\r\n  ** and the requested lock. This means if a write-lock was already held\r\n  ** and a read-lock requested, we don't incorrectly downgrade the lock.\r\n  */\r\n  assert( WRITE_LOCK>READ_LOCK );\r\n  if( eLock>pLock->eLock ){\r\n    pLock->eLock = eLock;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n#endif /* !SQLITE_OMIT_SHARED_CACHE */\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/*\r\n** Release all the table locks (locks obtained via calls to\r\n** the setSharedCacheTableLock() procedure) held by Btree object p.\r\n**\r\n** This function assumes that Btree p has an open read or write \r\n** transaction. If it does not, then the BTS_PENDING flag\r\n** may be incorrectly cleared.\r\n*/\r\nstatic void clearAllSharedCacheTableLocks(Btree *p){\r\n  BtShared *pBt = p->pBt;\r\n  BtLock **ppIter = &pBt->pLock;\r\n\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( p->sharable || 0==*ppIter );\r\n  assert( p->inTrans>0 );\r\n\r\n  while( *ppIter ){\r\n    BtLock *pLock = *ppIter;\r\n    assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );\r\n    assert( pLock->pBtree->inTrans>=pLock->eLock );\r\n    if( pLock->pBtree==p ){\r\n      *ppIter = pLock->pNext;\r\n      assert( pLock->iTable!=1 || pLock==&p->lock );\r\n      if( pLock->iTable!=1 ){\r\n        sqlite3_free(pLock);\r\n      }\r\n    }else{\r\n      ppIter = &pLock->pNext;\r\n    }\r\n  }\r\n\r\n  assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter );\r\n  if( pBt->pWriter==p ){\r\n    pBt->pWriter = 0;\r\n    pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);\r\n  }else if( pBt->nTransaction==2 ){\r\n    /* This function is called when Btree p is concluding its \r\n    ** transaction. If there currently exists a writer, and p is not\r\n    ** that writer, then the number of locks held by connections other\r\n    ** than the writer must be about to drop to zero. In this case\r\n    ** set the BTS_PENDING flag to 0.\r\n    **\r\n    ** If there is not currently a writer, then BTS_PENDING must\r\n    ** be zero already. So this next line is harmless in that case.\r\n    */\r\n    pBt->btsFlags &= ~BTS_PENDING;\r\n  }\r\n}\r\n\r\n/*\r\n** This function changes all write-locks held by Btree p into read-locks.\r\n*/\r\nstatic void downgradeAllSharedCacheTableLocks(Btree *p){\r\n  BtShared *pBt = p->pBt;\r\n  if( pBt->pWriter==p ){\r\n    BtLock *pLock;\r\n    pBt->pWriter = 0;\r\n    pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);\r\n    for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){\r\n      assert( pLock->eLock==READ_LOCK || pLock->pBtree==p );\r\n      pLock->eLock = READ_LOCK;\r\n    }\r\n  }\r\n}\r\n\r\n#endif /* SQLITE_OMIT_SHARED_CACHE */\r\n\r\nstatic void releasePage(MemPage *pPage);  /* Forward reference */\r\n\r\n/*\r\n***** This routine is used inside of assert() only ****\r\n**\r\n** Verify that the cursor holds the mutex on its BtShared\r\n*/\r\n#ifdef SQLITE_DEBUG\r\nstatic int cursorHoldsMutex(BtCursor *p){\r\n  return sqlite3_mutex_held(p->pBt->mutex);\r\n}\r\n#endif\r\n\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n/*\r\n** Invalidate the overflow page-list cache for cursor pCur, if any.\r\n*/\r\nstatic void invalidateOverflowCache(BtCursor *pCur){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  sqlite3_free(pCur->aOverflow);\r\n  pCur->aOverflow = 0;\r\n}\r\n\r\n/*\r\n** Invalidate the overflow page-list cache for all cursors opened\r\n** on the shared btree structure pBt.\r\n*/\r\nstatic void invalidateAllOverflowCache(BtShared *pBt){\r\n  BtCursor *p;\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  for(p=pBt->pCursor; p; p=p->pNext){\r\n    invalidateOverflowCache(p);\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called before modifying the contents of a table\r\n** to invalidate any incrblob cursors that are open on the\r\n** row or one of the rows being modified.\r\n**\r\n** If argument isClearTable is true, then the entire contents of the\r\n** table is about to be deleted. In this case invalidate all incrblob\r\n** cursors open on any row within the table with root-page pgnoRoot.\r\n**\r\n** Otherwise, if argument isClearTable is false, then the row with\r\n** rowid iRow is being replaced or deleted. In this case invalidate\r\n** only those incrblob cursors open on that specific row.\r\n*/\r\nstatic void invalidateIncrblobCursors(\r\n  Btree *pBtree,          /* The database file to check */\r\n  i64 iRow,               /* The rowid that might be changing */\r\n  int isClearTable        /* True if all rows are being deleted */\r\n){\r\n  BtCursor *p;\r\n  BtShared *pBt = pBtree->pBt;\r\n  assert( sqlite3BtreeHoldsMutex(pBtree) );\r\n  for(p=pBt->pCursor; p; p=p->pNext){\r\n    if( p->isIncrblobHandle && (isClearTable || p->info.nKey==iRow) ){\r\n      p->eState = CURSOR_INVALID;\r\n    }\r\n  }\r\n}\r\n\r\n#else\r\n  /* Stub functions when INCRBLOB is omitted */\r\n  #define invalidateOverflowCache(x)\r\n  #define invalidateAllOverflowCache(x)\r\n  #define invalidateIncrblobCursors(x,y,z)\r\n#endif /* SQLITE_OMIT_INCRBLOB */\r\n\r\n/*\r\n** Set bit pgno of the BtShared.pHasContent bitvec. This is called \r\n** when a page that previously contained data becomes a free-list leaf \r\n** page.\r\n**\r\n** The BtShared.pHasContent bitvec exists to work around an obscure\r\n** bug caused by the interaction of two useful IO optimizations surrounding\r\n** free-list leaf pages:\r\n**\r\n**   1) When all data is deleted from a page and the page becomes\r\n**      a free-list leaf page, the page is not written to the database\r\n**      (as free-list leaf pages contain no meaningful data). Sometimes\r\n**      such a page is not even journalled (as it will not be modified,\r\n**      why bother journalling it?).\r\n**\r\n**   2) When a free-list leaf page is reused, its content is not read\r\n**      from the database or written to the journal file (why should it\r\n**      be, if it is not at all meaningful?).\r\n**\r\n** By themselves, these optimizations work fine and provide a handy\r\n** performance boost to bulk delete or insert operations. However, if\r\n** a page is moved to the free-list and then reused within the same\r\n** transaction, a problem comes up. If the page is not journalled when\r\n** it is moved to the free-list and it is also not journalled when it\r\n** is extracted from the free-list and reused, then the original data\r\n** may be lost. In the event of a rollback, it may not be possible\r\n** to restore the database to its original configuration.\r\n**\r\n** The solution is the BtShared.pHasContent bitvec. Whenever a page is \r\n** moved to become a free-list leaf page, the corresponding bit is\r\n** set in the bitvec. Whenever a leaf page is extracted from the free-list,\r\n** optimization 2 above is omitted if the corresponding bit is already\r\n** set in BtShared.pHasContent. The contents of the bitvec are cleared\r\n** at the end of every transaction.\r\n*/\r\nstatic int btreeSetHasContent(BtShared *pBt, Pgno pgno){\r\n  int rc = SQLITE_OK;\r\n  if( !pBt->pHasContent ){\r\n    assert( pgno<=pBt->nPage );\r\n    pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);\r\n    if( !pBt->pHasContent ){\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){\r\n    rc = sqlite3BitvecSet(pBt->pHasContent, pgno);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Query the BtShared.pHasContent vector.\r\n**\r\n** This function is called when a free-list leaf page is removed from the\r\n** free-list for reuse. It returns false if it is safe to retrieve the\r\n** page from the pager layer with the 'no-content' flag set. True otherwise.\r\n*/\r\nstatic int btreeGetHasContent(BtShared *pBt, Pgno pgno){\r\n  Bitvec *p = pBt->pHasContent;\r\n  return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));\r\n}\r\n\r\n/*\r\n** Clear (destroy) the BtShared.pHasContent bitvec. This should be\r\n** invoked at the conclusion of each write-transaction.\r\n*/\r\nstatic void btreeClearHasContent(BtShared *pBt){\r\n  sqlite3BitvecDestroy(pBt->pHasContent);\r\n  pBt->pHasContent = 0;\r\n}\r\n\r\n/*\r\n** Save the current cursor position in the variables BtCursor.nKey \r\n** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK.\r\n**\r\n** The caller must ensure that the cursor is valid (has eState==CURSOR_VALID)\r\n** prior to calling this routine.  \r\n*/\r\nstatic int saveCursorPosition(BtCursor *pCur){\r\n  int rc;\r\n\r\n  assert( CURSOR_VALID==pCur->eState );\r\n  assert( 0==pCur->pKey );\r\n  assert( cursorHoldsMutex(pCur) );\r\n\r\n  rc = sqlite3BtreeKeySize(pCur, &pCur->nKey);\r\n  assert( rc==SQLITE_OK );  /* KeySize() cannot fail */\r\n\r\n  /* If this is an intKey table, then the above call to BtreeKeySize()\r\n  ** stores the integer key in pCur->nKey. In this case this value is\r\n  ** all that is required. Otherwise, if pCur is not open on an intKey\r\n  ** table, then malloc space for and store the pCur->nKey bytes of key \r\n  ** data.\r\n  */\r\n  if( 0==pCur->apPage[0]->intKey ){\r\n    void *pKey = sqlite3Malloc( (int)pCur->nKey );\r\n    if( pKey ){\r\n      rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey);\r\n      if( rc==SQLITE_OK ){\r\n        pCur->pKey = pKey;\r\n      }else{\r\n        sqlite3_free(pKey);\r\n      }\r\n    }else{\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n  }\r\n  assert( !pCur->apPage[0]->intKey || !pCur->pKey );\r\n\r\n  if( rc==SQLITE_OK ){\r\n    int i;\r\n    for(i=0; i<=pCur->iPage; i++){\r\n      releasePage(pCur->apPage[i]);\r\n      pCur->apPage[i] = 0;\r\n    }\r\n    pCur->iPage = -1;\r\n    pCur->eState = CURSOR_REQUIRESEEK;\r\n  }\r\n\r\n  invalidateOverflowCache(pCur);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Save the positions of all cursors (except pExcept) that are open on\r\n** the table  with root-page iRoot. Usually, this is called just before cursor\r\n** pExcept is used to modify the table (BtreeDelete() or BtreeInsert()).\r\n*/\r\nstatic int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){\r\n  BtCursor *p;\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( pExcept==0 || pExcept->pBt==pBt );\r\n  for(p=pBt->pCursor; p; p=p->pNext){\r\n    if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) && \r\n        p->eState==CURSOR_VALID ){\r\n      int rc = saveCursorPosition(p);\r\n      if( SQLITE_OK!=rc ){\r\n        return rc;\r\n      }\r\n    }\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Clear the current cursor position.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  sqlite3_free(pCur->pKey);\r\n  pCur->pKey = 0;\r\n  pCur->eState = CURSOR_INVALID;\r\n}\r\n\r\n/*\r\n** In this version of BtreeMoveto, pKey is a packed index record\r\n** such as is generated by the OP_MakeRecord opcode.  Unpack the\r\n** record and then call BtreeMovetoUnpacked() to do the work.\r\n*/\r\nstatic int btreeMoveto(\r\n  BtCursor *pCur,     /* Cursor open on the btree to be searched */\r\n  const void *pKey,   /* Packed key if the btree is an index */\r\n  i64 nKey,           /* Integer key for tables.  Size of pKey for indices */\r\n  int bias,           /* Bias search to the high end */\r\n  int *pRes           /* Write search results here */\r\n){\r\n  int rc;                    /* Status code */\r\n  UnpackedRecord *pIdxKey;   /* Unpacked index key */\r\n  char aSpace[150];          /* Temp space for pIdxKey - to avoid a malloc */\r\n  char *pFree = 0;\r\n\r\n  if( pKey ){\r\n    assert( nKey==(i64)(int)nKey );\r\n    pIdxKey = sqlite3VdbeAllocUnpackedRecord(\r\n        pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree\r\n    );\r\n    if( pIdxKey==0 ) return SQLITE_NOMEM;\r\n    sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);\r\n  }else{\r\n    pIdxKey = 0;\r\n  }\r\n  rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);\r\n  if( pFree ){\r\n    sqlite3DbFree(pCur->pKeyInfo->db, pFree);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Restore the cursor to the position it was in (or as close to as possible)\r\n** when saveCursorPosition() was called. Note that this call deletes the \r\n** saved position info stored by saveCursorPosition(), so there can be\r\n** at most one effective restoreCursorPosition() call after each \r\n** saveCursorPosition().\r\n*/\r\nstatic int btreeRestoreCursorPosition(BtCursor *pCur){\r\n  int rc;\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState>=CURSOR_REQUIRESEEK );\r\n  if( pCur->eState==CURSOR_FAULT ){\r\n    return pCur->skipNext;\r\n  }\r\n  pCur->eState = CURSOR_INVALID;\r\n  rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &pCur->skipNext);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_free(pCur->pKey);\r\n    pCur->pKey = 0;\r\n    assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );\r\n  }\r\n  return rc;\r\n}\r\n\r\n#define restoreCursorPosition(p) \\\r\n  (p->eState>=CURSOR_REQUIRESEEK ? \\\r\n         btreeRestoreCursorPosition(p) : \\\r\n         SQLITE_OK)\r\n\r\n/*\r\n** Determine whether or not a cursor has moved from the position it\r\n** was last placed at.  Cursors can move when the row they are pointing\r\n** at is deleted out from under them.\r\n**\r\n** This routine returns an error code if something goes wrong.  The\r\n** integer *pHasMoved is set to one if the cursor has moved and 0 if not.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur, int *pHasMoved){\r\n  int rc;\r\n\r\n  rc = restoreCursorPosition(pCur);\r\n  if( rc ){\r\n    *pHasMoved = 1;\r\n    return rc;\r\n  }\r\n  if( pCur->eState!=CURSOR_VALID || pCur->skipNext!=0 ){\r\n    *pHasMoved = 1;\r\n  }else{\r\n    *pHasMoved = 0;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n/*\r\n** Given a page number of a regular database page, return the page\r\n** number for the pointer-map page that contains the entry for the\r\n** input page number.\r\n**\r\n** Return 0 (not a valid page) for pgno==1 since there is\r\n** no pointer map associated with page 1.  The integrity_check logic\r\n** requires that ptrmapPageno(*,1)!=1.\r\n*/\r\nstatic Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){\r\n  int nPagesPerMapPage;\r\n  Pgno iPtrMap, ret;\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  if( pgno<2 ) return 0;\r\n  nPagesPerMapPage = (pBt->usableSize/5)+1;\r\n  iPtrMap = (pgno-2)/nPagesPerMapPage;\r\n  ret = (iPtrMap*nPagesPerMapPage) + 2; \r\n  if( ret==PENDING_BYTE_PAGE(pBt) ){\r\n    ret++;\r\n  }\r\n  return ret;\r\n}\r\n\r\n/*\r\n** Write an entry into the pointer map.\r\n**\r\n** This routine updates the pointer map entry for page number 'key'\r\n** so that it maps to type 'eType' and parent page number 'pgno'.\r\n**\r\n** If *pRC is initially non-zero (non-SQLITE_OK) then this routine is\r\n** a no-op.  If an error occurs, the appropriate error code is written\r\n** into *pRC.\r\n*/\r\nstatic void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){\r\n  DbPage *pDbPage;  /* The pointer map page */\r\n  u8 *pPtrmap;      /* The pointer map data */\r\n  Pgno iPtrmap;     /* The pointer map page number */\r\n  int offset;       /* Offset in pointer map page */\r\n  int rc;           /* Return code from subfunctions */\r\n\r\n  if( *pRC ) return;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  /* The master-journal page number must never be used as a pointer map page */\r\n  assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) );\r\n\r\n  assert( pBt->autoVacuum );\r\n  if( key==0 ){\r\n    *pRC = SQLITE_CORRUPT_BKPT;\r\n    return;\r\n  }\r\n  iPtrmap = PTRMAP_PAGENO(pBt, key);\r\n  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage);\r\n  if( rc!=SQLITE_OK ){\r\n    *pRC = rc;\r\n    return;\r\n  }\r\n  offset = PTRMAP_PTROFFSET(iPtrmap, key);\r\n  if( offset<0 ){\r\n    *pRC = SQLITE_CORRUPT_BKPT;\r\n    goto ptrmap_exit;\r\n  }\r\n  assert( offset <= (int)pBt->usableSize-5 );\r\n  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);\r\n\r\n  if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){\r\n    TRACE((\"PTRMAP_UPDATE: %d->(%d,%d)\\n\", key, eType, parent));\r\n    *pRC= rc = sqlite3PagerWrite(pDbPage);\r\n    if( rc==SQLITE_OK ){\r\n      pPtrmap[offset] = eType;\r\n      put4byte(&pPtrmap[offset+1], parent);\r\n    }\r\n  }\r\n\r\nptrmap_exit:\r\n  sqlite3PagerUnref(pDbPage);\r\n}\r\n\r\n/*\r\n** Read an entry from the pointer map.\r\n**\r\n** This routine retrieves the pointer map entry for page 'key', writing\r\n** the type and parent page number to *pEType and *pPgno respectively.\r\n** An error code is returned if something goes wrong, otherwise SQLITE_OK.\r\n*/\r\nstatic int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){\r\n  DbPage *pDbPage;   /* The pointer map page */\r\n  int iPtrmap;       /* Pointer map page index */\r\n  u8 *pPtrmap;       /* Pointer map page data */\r\n  int offset;        /* Offset of entry in pointer map */\r\n  int rc;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n\r\n  iPtrmap = PTRMAP_PAGENO(pBt, key);\r\n  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage);\r\n  if( rc!=0 ){\r\n    return rc;\r\n  }\r\n  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);\r\n\r\n  offset = PTRMAP_PTROFFSET(iPtrmap, key);\r\n  if( offset<0 ){\r\n    sqlite3PagerUnref(pDbPage);\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  assert( offset <= (int)pBt->usableSize-5 );\r\n  assert( pEType!=0 );\r\n  *pEType = pPtrmap[offset];\r\n  if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);\r\n\r\n  sqlite3PagerUnref(pDbPage);\r\n  if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;\r\n  return SQLITE_OK;\r\n}\r\n\r\n#else /* if defined SQLITE_OMIT_AUTOVACUUM */\r\n  #define ptrmapPut(w,x,y,z,rc)\r\n  #define ptrmapGet(w,x,y,z) SQLITE_OK\r\n  #define ptrmapPutOvflPtr(x, y, rc)\r\n#endif\r\n\r\n/*\r\n** Given a btree page and a cell index (0 means the first cell on\r\n** the page, 1 means the second cell, and so forth) return a pointer\r\n** to the cell content.\r\n**\r\n** This routine works only for pages that do not contain overflow cells.\r\n*/\r\n#define findCell(P,I) \\\r\n  ((P)->aData + ((P)->maskPage & get2byte(&(P)->aCellIdx[2*(I)])))\r\n#define findCellv2(D,M,O,I) (D+(M&get2byte(D+(O+2*(I)))))\r\n\r\n\r\n/*\r\n** This a more complex version of findCell() that works for\r\n** pages that do contain overflow cells.\r\n*/\r\nstatic u8 *findOverflowCell(MemPage *pPage, int iCell){\r\n  int i;\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  for(i=pPage->nOverflow-1; i>=0; i--){\r\n    int k;\r\n    k = pPage->aiOvfl[i];\r\n    if( k<=iCell ){\r\n      if( k==iCell ){\r\n        return pPage->apOvfl[i];\r\n      }\r\n      iCell--;\r\n    }\r\n  }\r\n  return findCell(pPage, iCell);\r\n}\r\n\r\n/*\r\n** Parse a cell content block and fill in the CellInfo structure.  There\r\n** are two versions of this function.  btreeParseCell() takes a \r\n** cell index as the second argument and btreeParseCellPtr() \r\n** takes a pointer to the body of the cell as its second argument.\r\n**\r\n** Within this file, the parseCell() macro can be called instead of\r\n** btreeParseCellPtr(). Using some compilers, this will be faster.\r\n*/\r\nstatic void btreeParseCellPtr(\r\n  MemPage *pPage,         /* Page containing the cell */\r\n  u8 *pCell,              /* Pointer to the cell text. */\r\n  CellInfo *pInfo         /* Fill in this structure */\r\n){\r\n  u16 n;                  /* Number bytes in cell content header */\r\n  u32 nPayload;           /* Number of bytes of cell payload */\r\n\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n\r\n  pInfo->pCell = pCell;\r\n  assert( pPage->leaf==0 || pPage->leaf==1 );\r\n  n = pPage->childPtrSize;\r\n  assert( n==4-4*pPage->leaf );\r\n  if( pPage->intKey ){\r\n    if( pPage->hasData ){\r\n      n += getVarint32(&pCell[n], nPayload);\r\n    }else{\r\n      nPayload = 0;\r\n    }\r\n    n += getVarint(&pCell[n], (u64*)&pInfo->nKey);\r\n    pInfo->nData = nPayload;\r\n  }else{\r\n    pInfo->nData = 0;\r\n    n += getVarint32(&pCell[n], nPayload);\r\n    pInfo->nKey = nPayload;\r\n  }\r\n  pInfo->nPayload = nPayload;\r\n  pInfo->nHeader = n;\r\n  testcase( nPayload==pPage->maxLocal );\r\n  testcase( nPayload==pPage->maxLocal+1 );\r\n  if( likely(nPayload<=pPage->maxLocal) ){\r\n    /* This is the (easy) common case where the entire payload fits\r\n    ** on the local page.  No overflow is required.\r\n    */\r\n    if( (pInfo->nSize = (u16)(n+nPayload))<4 ) pInfo->nSize = 4;\r\n    pInfo->nLocal = (u16)nPayload;\r\n    pInfo->iOverflow = 0;\r\n  }else{\r\n    /* If the payload will not fit completely on the local page, we have\r\n    ** to decide how much to store locally and how much to spill onto\r\n    ** overflow pages.  The strategy is to minimize the amount of unused\r\n    ** space on overflow pages while keeping the amount of local storage\r\n    ** in between minLocal and maxLocal.\r\n    **\r\n    ** Warning:  changing the way overflow payload is distributed in any\r\n    ** way will result in an incompatible file format.\r\n    */\r\n    int minLocal;  /* Minimum amount of payload held locally */\r\n    int maxLocal;  /* Maximum amount of payload held locally */\r\n    int surplus;   /* Overflow payload available for local storage */\r\n\r\n    minLocal = pPage->minLocal;\r\n    maxLocal = pPage->maxLocal;\r\n    surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize - 4);\r\n    testcase( surplus==maxLocal );\r\n    testcase( surplus==maxLocal+1 );\r\n    if( surplus <= maxLocal ){\r\n      pInfo->nLocal = (u16)surplus;\r\n    }else{\r\n      pInfo->nLocal = (u16)minLocal;\r\n    }\r\n    pInfo->iOverflow = (u16)(pInfo->nLocal + n);\r\n    pInfo->nSize = pInfo->iOverflow + 4;\r\n  }\r\n}\r\n#define parseCell(pPage, iCell, pInfo) \\\r\n  btreeParseCellPtr((pPage), findCell((pPage), (iCell)), (pInfo))\r\nstatic void btreeParseCell(\r\n  MemPage *pPage,         /* Page containing the cell */\r\n  int iCell,              /* The cell index.  First cell is 0 */\r\n  CellInfo *pInfo         /* Fill in this structure */\r\n){\r\n  parseCell(pPage, iCell, pInfo);\r\n}\r\n\r\n/*\r\n** Compute the total number of bytes that a Cell needs in the cell\r\n** data area of the btree-page.  The return number includes the cell\r\n** data header and the local payload, but not any overflow page or\r\n** the space used by the cell pointer.\r\n*/\r\nstatic u16 cellSizePtr(MemPage *pPage, u8 *pCell){\r\n  u8 *pIter = &pCell[pPage->childPtrSize];\r\n  u32 nSize;\r\n\r\n#ifdef SQLITE_DEBUG\r\n  /* The value returned by this function should always be the same as\r\n  ** the (CellInfo.nSize) value found by doing a full parse of the\r\n  ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of\r\n  ** this function verifies that this invariant is not violated. */\r\n  CellInfo debuginfo;\r\n  btreeParseCellPtr(pPage, pCell, &debuginfo);\r\n#endif\r\n\r\n  if( pPage->intKey ){\r\n    u8 *pEnd;\r\n    if( pPage->hasData ){\r\n      pIter += getVarint32(pIter, nSize);\r\n    }else{\r\n      nSize = 0;\r\n    }\r\n\r\n    /* pIter now points at the 64-bit integer key value, a variable length \r\n    ** integer. The following block moves pIter to point at the first byte\r\n    ** past the end of the key value. */\r\n    pEnd = &pIter[9];\r\n    while( (*pIter++)&0x80 && pIter<pEnd );\r\n  }else{\r\n    pIter += getVarint32(pIter, nSize);\r\n  }\r\n\r\n  testcase( nSize==pPage->maxLocal );\r\n  testcase( nSize==pPage->maxLocal+1 );\r\n  if( nSize>pPage->maxLocal ){\r\n    int minLocal = pPage->minLocal;\r\n    nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);\r\n    testcase( nSize==pPage->maxLocal );\r\n    testcase( nSize==pPage->maxLocal+1 );\r\n    if( nSize>pPage->maxLocal ){\r\n      nSize = minLocal;\r\n    }\r\n    nSize += 4;\r\n  }\r\n  nSize += (u32)(pIter - pCell);\r\n\r\n  /* The minimum size of any cell is 4 bytes. */\r\n  if( nSize<4 ){\r\n    nSize = 4;\r\n  }\r\n\r\n  assert( nSize==debuginfo.nSize );\r\n  return (u16)nSize;\r\n}\r\n\r\n#ifdef SQLITE_DEBUG\r\n/* This variation on cellSizePtr() is used inside of assert() statements\r\n** only. */\r\nstatic u16 cellSize(MemPage *pPage, int iCell){\r\n  return cellSizePtr(pPage, findCell(pPage, iCell));\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n/*\r\n** If the cell pCell, part of page pPage contains a pointer\r\n** to an overflow page, insert an entry into the pointer-map\r\n** for the overflow page.\r\n*/\r\nstatic void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){\r\n  CellInfo info;\r\n  if( *pRC ) return;\r\n  assert( pCell!=0 );\r\n  btreeParseCellPtr(pPage, pCell, &info);\r\n  assert( (info.nData+(pPage->intKey?0:info.nKey))==info.nPayload );\r\n  if( info.iOverflow ){\r\n    Pgno ovfl = get4byte(&pCell[info.iOverflow]);\r\n    ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);\r\n  }\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Defragment the page given.  All Cells are moved to the\r\n** end of the page and all free space is collected into one\r\n** big FreeBlk that occurs in between the header and cell\r\n** pointer array and the cell content area.\r\n*/\r\nstatic int defragmentPage(MemPage *pPage){\r\n  int i;                     /* Loop counter */\r\n  int pc;                    /* Address of a i-th cell */\r\n  int hdr;                   /* Offset to the page header */\r\n  int size;                  /* Size of a cell */\r\n  int usableSize;            /* Number of usable bytes on a page */\r\n  int cellOffset;            /* Offset to the cell pointer array */\r\n  int cbrk;                  /* Offset to the cell content area */\r\n  int nCell;                 /* Number of cells on the page */\r\n  unsigned char *data;       /* The page data */\r\n  unsigned char *temp;       /* Temp area for cell content */\r\n  int iCellFirst;            /* First allowable cell index */\r\n  int iCellLast;             /* Last possible cell index */\r\n\r\n\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  assert( pPage->pBt!=0 );\r\n  assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );\r\n  assert( pPage->nOverflow==0 );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  temp = sqlite3PagerTempSpace(pPage->pBt->pPager);\r\n  data = pPage->aData;\r\n  hdr = pPage->hdrOffset;\r\n  cellOffset = pPage->cellOffset;\r\n  nCell = pPage->nCell;\r\n  assert( nCell==get2byte(&data[hdr+3]) );\r\n  usableSize = pPage->pBt->usableSize;\r\n  cbrk = get2byte(&data[hdr+5]);\r\n  memcpy(&temp[cbrk], &data[cbrk], usableSize - cbrk);\r\n  cbrk = usableSize;\r\n  iCellFirst = cellOffset + 2*nCell;\r\n  iCellLast = usableSize - 4;\r\n  for(i=0; i<nCell; i++){\r\n    u8 *pAddr;     /* The i-th cell pointer */\r\n    pAddr = &data[cellOffset + i*2];\r\n    pc = get2byte(pAddr);\r\n    testcase( pc==iCellFirst );\r\n    testcase( pc==iCellLast );\r\n#if !defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)\r\n    /* These conditions have already been verified in btreeInitPage()\r\n    ** if SQLITE_ENABLE_OVERSIZE_CELL_CHECK is defined \r\n    */\r\n    if( pc<iCellFirst || pc>iCellLast ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n#endif\r\n    assert( pc>=iCellFirst && pc<=iCellLast );\r\n    size = cellSizePtr(pPage, &temp[pc]);\r\n    cbrk -= size;\r\n#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)\r\n    if( cbrk<iCellFirst ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n#else\r\n    if( cbrk<iCellFirst || pc+size>usableSize ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n#endif\r\n    assert( cbrk+size<=usableSize && cbrk>=iCellFirst );\r\n    testcase( cbrk+size==usableSize );\r\n    testcase( pc+size==usableSize );\r\n    memcpy(&data[cbrk], &temp[pc], size);\r\n    put2byte(pAddr, cbrk);\r\n  }\r\n  assert( cbrk>=iCellFirst );\r\n  put2byte(&data[hdr+5], cbrk);\r\n  data[hdr+1] = 0;\r\n  data[hdr+2] = 0;\r\n  data[hdr+7] = 0;\r\n  memset(&data[iCellFirst], 0, cbrk-iCellFirst);\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  if( cbrk-iCellFirst!=pPage->nFree ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Allocate nByte bytes of space from within the B-Tree page passed\r\n** as the first argument. Write into *pIdx the index into pPage->aData[]\r\n** of the first byte of allocated space. Return either SQLITE_OK or\r\n** an error code (usually SQLITE_CORRUPT).\r\n**\r\n** The caller guarantees that there is sufficient space to make the\r\n** allocation.  This routine might need to defragment in order to bring\r\n** all the space together, however.  This routine will avoid using\r\n** the first two bytes past the cell pointer area since presumably this\r\n** allocation is being made in order to insert a new cell, so we will\r\n** also end up needing a new cell pointer.\r\n*/\r\nstatic int allocateSpace(MemPage *pPage, int nByte, int *pIdx){\r\n  const int hdr = pPage->hdrOffset;    /* Local cache of pPage->hdrOffset */\r\n  u8 * const data = pPage->aData;      /* Local cache of pPage->aData */\r\n  int nFrag;                           /* Number of fragmented bytes on pPage */\r\n  int top;                             /* First byte of cell content area */\r\n  int gap;        /* First byte of gap between cell pointers and cell content */\r\n  int rc;         /* Integer return code */\r\n  int usableSize; /* Usable size of the page */\r\n  \r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  assert( pPage->pBt );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  assert( nByte>=0 );  /* Minimum cell size is 4 */\r\n  assert( pPage->nFree>=nByte );\r\n  assert( pPage->nOverflow==0 );\r\n  usableSize = pPage->pBt->usableSize;\r\n  assert( nByte < usableSize-8 );\r\n\r\n  nFrag = data[hdr+7];\r\n  assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );\r\n  gap = pPage->cellOffset + 2*pPage->nCell;\r\n  top = get2byteNotZero(&data[hdr+5]);\r\n  if( gap>top ) return SQLITE_CORRUPT_BKPT;\r\n  testcase( gap+2==top );\r\n  testcase( gap+1==top );\r\n  testcase( gap==top );\r\n\r\n  if( nFrag>=60 ){\r\n    /* Always defragment highly fragmented pages */\r\n    rc = defragmentPage(pPage);\r\n    if( rc ) return rc;\r\n    top = get2byteNotZero(&data[hdr+5]);\r\n  }else if( gap+2<=top ){\r\n    /* Search the freelist looking for a free slot big enough to satisfy \r\n    ** the request. The allocation is made from the first free slot in \r\n    ** the list that is large enough to accomadate it.\r\n    */\r\n    int pc, addr;\r\n    for(addr=hdr+1; (pc = get2byte(&data[addr]))>0; addr=pc){\r\n      int size;            /* Size of the free slot */\r\n      if( pc>usableSize-4 || pc<addr+4 ){\r\n        return SQLITE_CORRUPT_BKPT;\r\n      }\r\n      size = get2byte(&data[pc+2]);\r\n      if( size>=nByte ){\r\n        int x = size - nByte;\r\n        testcase( x==4 );\r\n        testcase( x==3 );\r\n        if( x<4 ){\r\n          /* Remove the slot from the free-list. Update the number of\r\n          ** fragmented bytes within the page. */\r\n          memcpy(&data[addr], &data[pc], 2);\r\n          data[hdr+7] = (u8)(nFrag + x);\r\n        }else if( size+pc > usableSize ){\r\n          return SQLITE_CORRUPT_BKPT;\r\n        }else{\r\n          /* The slot remains on the free-list. Reduce its size to account\r\n          ** for the portion used by the new allocation. */\r\n          put2byte(&data[pc+2], x);\r\n        }\r\n        *pIdx = pc + x;\r\n        return SQLITE_OK;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Check to make sure there is enough space in the gap to satisfy\r\n  ** the allocation.  If not, defragment.\r\n  */\r\n  testcase( gap+2+nByte==top );\r\n  if( gap+2+nByte>top ){\r\n    rc = defragmentPage(pPage);\r\n    if( rc ) return rc;\r\n    top = get2byteNotZero(&data[hdr+5]);\r\n    assert( gap+nByte<=top );\r\n  }\r\n\r\n\r\n  /* Allocate memory from the gap in between the cell pointer array\r\n  ** and the cell content area.  The btreeInitPage() call has already\r\n  ** validated the freelist.  Given that the freelist is valid, there\r\n  ** is no way that the allocation can extend off the end of the page.\r\n  ** The assert() below verifies the previous sentence.\r\n  */\r\n  top -= nByte;\r\n  put2byte(&data[hdr+5], top);\r\n  assert( top+nByte <= (int)pPage->pBt->usableSize );\r\n  *pIdx = top;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Return a section of the pPage->aData to the freelist.\r\n** The first byte of the new free block is pPage->aDisk[start]\r\n** and the size of the block is \"size\" bytes.\r\n**\r\n** Most of the effort here is involved in coalesing adjacent\r\n** free blocks into a single big free block.\r\n*/\r\nstatic int freeSpace(MemPage *pPage, int start, int size){\r\n  int addr, pbegin, hdr;\r\n  int iLast;                        /* Largest possible freeblock offset */\r\n  unsigned char *data = pPage->aData;\r\n\r\n  assert( pPage->pBt!=0 );\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  assert( start>=pPage->hdrOffset+6+pPage->childPtrSize );\r\n  assert( (start + size) <= (int)pPage->pBt->usableSize );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  assert( size>=0 );   /* Minimum cell size is 4 */\r\n\r\n  if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){\r\n    /* Overwrite deleted information with zeros when the secure_delete\r\n    ** option is enabled */\r\n    memset(&data[start], 0, size);\r\n  }\r\n\r\n  /* Add the space back into the linked list of freeblocks.  Note that\r\n  ** even though the freeblock list was checked by btreeInitPage(),\r\n  ** btreeInitPage() did not detect overlapping cells or\r\n  ** freeblocks that overlapped cells.   Nor does it detect when the\r\n  ** cell content area exceeds the value in the page header.  If these\r\n  ** situations arise, then subsequent insert operations might corrupt\r\n  ** the freelist.  So we do need to check for corruption while scanning\r\n  ** the freelist.\r\n  */\r\n  hdr = pPage->hdrOffset;\r\n  addr = hdr + 1;\r\n  iLast = pPage->pBt->usableSize - 4;\r\n  assert( start<=iLast );\r\n  while( (pbegin = get2byte(&data[addr]))<start && pbegin>0 ){\r\n    if( pbegin<addr+4 ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    addr = pbegin;\r\n  }\r\n  if( pbegin>iLast ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  assert( pbegin>addr || pbegin==0 );\r\n  put2byte(&data[addr], start);\r\n  put2byte(&data[start], pbegin);\r\n  put2byte(&data[start+2], size);\r\n  pPage->nFree = pPage->nFree + (u16)size;\r\n\r\n  /* Coalesce adjacent free blocks */\r\n  addr = hdr + 1;\r\n  while( (pbegin = get2byte(&data[addr]))>0 ){\r\n    int pnext, psize, x;\r\n    assert( pbegin>addr );\r\n    assert( pbegin <= (int)pPage->pBt->usableSize-4 );\r\n    pnext = get2byte(&data[pbegin]);\r\n    psize = get2byte(&data[pbegin+2]);\r\n    if( pbegin + psize + 3 >= pnext && pnext>0 ){\r\n      int frag = pnext - (pbegin+psize);\r\n      if( (frag<0) || (frag>(int)data[hdr+7]) ){\r\n        return SQLITE_CORRUPT_BKPT;\r\n      }\r\n      data[hdr+7] -= (u8)frag;\r\n      x = get2byte(&data[pnext]);\r\n      put2byte(&data[pbegin], x);\r\n      x = pnext + get2byte(&data[pnext+2]) - pbegin;\r\n      put2byte(&data[pbegin+2], x);\r\n    }else{\r\n      addr = pbegin;\r\n    }\r\n  }\r\n\r\n  /* If the cell content area begins with a freeblock, remove it. */\r\n  if( data[hdr+1]==data[hdr+5] && data[hdr+2]==data[hdr+6] ){\r\n    int top;\r\n    pbegin = get2byte(&data[hdr+1]);\r\n    memcpy(&data[hdr+1], &data[pbegin], 2);\r\n    top = get2byte(&data[hdr+5]) + get2byte(&data[pbegin+2]);\r\n    put2byte(&data[hdr+5], top);\r\n  }\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Decode the flags byte (the first byte of the header) for a page\r\n** and initialize fields of the MemPage structure accordingly.\r\n**\r\n** Only the following combinations are supported.  Anything different\r\n** indicates a corrupt database files:\r\n**\r\n**         PTF_ZERODATA\r\n**         PTF_ZERODATA | PTF_LEAF\r\n**         PTF_LEAFDATA | PTF_INTKEY\r\n**         PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF\r\n*/\r\nstatic int decodeFlags(MemPage *pPage, int flagByte){\r\n  BtShared *pBt;     /* A copy of pPage->pBt */\r\n\r\n  assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  pPage->leaf = (u8)(flagByte>>3);  assert( PTF_LEAF == 1<<3 );\r\n  flagByte &= ~PTF_LEAF;\r\n  pPage->childPtrSize = 4-4*pPage->leaf;\r\n  pBt = pPage->pBt;\r\n  if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){\r\n    pPage->intKey = 1;\r\n    pPage->hasData = pPage->leaf;\r\n    pPage->maxLocal = pBt->maxLeaf;\r\n    pPage->minLocal = pBt->minLeaf;\r\n  }else if( flagByte==PTF_ZERODATA ){\r\n    pPage->intKey = 0;\r\n    pPage->hasData = 0;\r\n    pPage->maxLocal = pBt->maxLocal;\r\n    pPage->minLocal = pBt->minLocal;\r\n  }else{\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  pPage->max1bytePayload = pBt->max1bytePayload;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Initialize the auxiliary information for a disk block.\r\n**\r\n** Return SQLITE_OK on success.  If we see that the page does\r\n** not contain a well-formed database page, then return \r\n** SQLITE_CORRUPT.  Note that a return of SQLITE_OK does not\r\n** guarantee that the page is well-formed.  It only shows that\r\n** we failed to detect any corruption.\r\n*/\r\nstatic int btreeInitPage(MemPage *pPage){\r\n\r\n  assert( pPage->pBt!=0 );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );\r\n  assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );\r\n  assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );\r\n\r\n  if( !pPage->isInit ){\r\n    u16 pc;            /* Address of a freeblock within pPage->aData[] */\r\n    u8 hdr;            /* Offset to beginning of page header */\r\n    u8 *data;          /* Equal to pPage->aData */\r\n    BtShared *pBt;        /* The main btree structure */\r\n    int usableSize;    /* Amount of usable space on each page */\r\n    u16 cellOffset;    /* Offset from start of page to first cell pointer */\r\n    int nFree;         /* Number of unused bytes on the page */\r\n    int top;           /* First byte of the cell content area */\r\n    int iCellFirst;    /* First allowable cell or freeblock offset */\r\n    int iCellLast;     /* Last possible cell or freeblock offset */\r\n\r\n    pBt = pPage->pBt;\r\n\r\n    hdr = pPage->hdrOffset;\r\n    data = pPage->aData;\r\n    if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;\r\n    assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );\r\n    pPage->maskPage = (u16)(pBt->pageSize - 1);\r\n    pPage->nOverflow = 0;\r\n    usableSize = pBt->usableSize;\r\n    pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;\r\n    pPage->aDataEnd = &data[usableSize];\r\n    pPage->aCellIdx = &data[cellOffset];\r\n    top = get2byteNotZero(&data[hdr+5]);\r\n    pPage->nCell = get2byte(&data[hdr+3]);\r\n    if( pPage->nCell>MX_CELL(pBt) ){\r\n      /* To many cells for a single page.  The page must be corrupt */\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    testcase( pPage->nCell==MX_CELL(pBt) );\r\n\r\n    /* A malformed database page might cause us to read past the end\r\n    ** of page when parsing a cell.  \r\n    **\r\n    ** The following block of code checks early to see if a cell extends\r\n    ** past the end of a page boundary and causes SQLITE_CORRUPT to be \r\n    ** returned if it does.\r\n    */\r\n    iCellFirst = cellOffset + 2*pPage->nCell;\r\n    iCellLast = usableSize - 4;\r\n#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)\r\n    {\r\n      int i;            /* Index into the cell pointer array */\r\n      int sz;           /* Size of a cell */\r\n\r\n      if( !pPage->leaf ) iCellLast--;\r\n      for(i=0; i<pPage->nCell; i++){\r\n        pc = get2byte(&data[cellOffset+i*2]);\r\n        testcase( pc==iCellFirst );\r\n        testcase( pc==iCellLast );\r\n        if( pc<iCellFirst || pc>iCellLast ){\r\n          return SQLITE_CORRUPT_BKPT;\r\n        }\r\n        sz = cellSizePtr(pPage, &data[pc]);\r\n        testcase( pc+sz==usableSize );\r\n        if( pc+sz>usableSize ){\r\n          return SQLITE_CORRUPT_BKPT;\r\n        }\r\n      }\r\n      if( !pPage->leaf ) iCellLast++;\r\n    }  \r\n#endif\r\n\r\n    /* Compute the total free space on the page */\r\n    pc = get2byte(&data[hdr+1]);\r\n    nFree = data[hdr+7] + top;\r\n    while( pc>0 ){\r\n      u16 next, size;\r\n      if( pc<iCellFirst || pc>iCellLast ){\r\n        /* Start of free block is off the page */\r\n        return SQLITE_CORRUPT_BKPT; \r\n      }\r\n      next = get2byte(&data[pc]);\r\n      size = get2byte(&data[pc+2]);\r\n      if( (next>0 && next<=pc+size+3) || pc+size>usableSize ){\r\n        /* Free blocks must be in ascending order. And the last byte of\r\n\t** the free-block must lie on the database page.  */\r\n        return SQLITE_CORRUPT_BKPT; \r\n      }\r\n      nFree = nFree + size;\r\n      pc = next;\r\n    }\r\n\r\n    /* At this point, nFree contains the sum of the offset to the start\r\n    ** of the cell-content area plus the number of free bytes within\r\n    ** the cell-content area. If this is greater than the usable-size\r\n    ** of the page, then the page must be corrupted. This check also\r\n    ** serves to verify that the offset to the start of the cell-content\r\n    ** area, according to the page header, lies within the page.\r\n    */\r\n    if( nFree>usableSize ){\r\n      return SQLITE_CORRUPT_BKPT; \r\n    }\r\n    pPage->nFree = (u16)(nFree - iCellFirst);\r\n    pPage->isInit = 1;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Set up a raw page so that it looks like a database page holding\r\n** no entries.\r\n*/\r\nstatic void zeroPage(MemPage *pPage, int flags){\r\n  unsigned char *data = pPage->aData;\r\n  BtShared *pBt = pPage->pBt;\r\n  u8 hdr = pPage->hdrOffset;\r\n  u16 first;\r\n\r\n  assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );\r\n  assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );\r\n  assert( sqlite3PagerGetData(pPage->pDbPage) == data );\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  if( pBt->btsFlags & BTS_SECURE_DELETE ){\r\n    memset(&data[hdr], 0, pBt->usableSize - hdr);\r\n  }\r\n  data[hdr] = (char)flags;\r\n  first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);\r\n  memset(&data[hdr+1], 0, 4);\r\n  data[hdr+7] = 0;\r\n  put2byte(&data[hdr+5], pBt->usableSize);\r\n  pPage->nFree = (u16)(pBt->usableSize - first);\r\n  decodeFlags(pPage, flags);\r\n  pPage->hdrOffset = hdr;\r\n  pPage->cellOffset = first;\r\n  pPage->aDataEnd = &data[pBt->usableSize];\r\n  pPage->aCellIdx = &data[first];\r\n  pPage->nOverflow = 0;\r\n  assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );\r\n  pPage->maskPage = (u16)(pBt->pageSize - 1);\r\n  pPage->nCell = 0;\r\n  pPage->isInit = 1;\r\n}\r\n\r\n\r\n/*\r\n** Convert a DbPage obtained from the pager into a MemPage used by\r\n** the btree layer.\r\n*/\r\nstatic MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){\r\n  MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);\r\n  pPage->aData = sqlite3PagerGetData(pDbPage);\r\n  pPage->pDbPage = pDbPage;\r\n  pPage->pBt = pBt;\r\n  pPage->pgno = pgno;\r\n  pPage->hdrOffset = pPage->pgno==1 ? 100 : 0;\r\n  return pPage; \r\n}\r\n\r\n/*\r\n** Get a page from the pager.  Initialize the MemPage.pBt and\r\n** MemPage.aData elements if needed.\r\n**\r\n** If the noContent flag is set, it means that we do not care about\r\n** the content of the page at this time.  So do not go to the disk\r\n** to fetch the content.  Just fill in the content with zeros for now.\r\n** If in the future we call sqlite3PagerWrite() on this page, that\r\n** means we have started to be concerned about content and the disk\r\n** read should occur at that point.\r\n*/\r\nstatic int btreeGetPage(\r\n  BtShared *pBt,       /* The btree */\r\n  Pgno pgno,           /* Number of the page to fetch */\r\n  MemPage **ppPage,    /* Return the page in this parameter */\r\n  int noContent        /* Do not load page content if true */\r\n){\r\n  int rc;\r\n  DbPage *pDbPage;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, noContent);\r\n  if( rc ) return rc;\r\n  *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Retrieve a page from the pager cache. If the requested page is not\r\n** already in the pager cache return NULL. Initialize the MemPage.pBt and\r\n** MemPage.aData elements if needed.\r\n*/\r\nstatic MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){\r\n  DbPage *pDbPage;\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);\r\n  if( pDbPage ){\r\n    return btreePageFromDbPage(pDbPage, pgno, pBt);\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return the size of the database file in pages. If there is any kind of\r\n** error, return ((unsigned int)-1).\r\n*/\r\nstatic Pgno btreePagecount(BtShared *pBt){\r\n  return pBt->nPage;\r\n}\r\nSQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree *p){\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( ((p->pBt->nPage)&0x8000000)==0 );\r\n  return (int)btreePagecount(p->pBt);\r\n}\r\n\r\n/*\r\n** Get a page from the pager and initialize it.  This routine is just a\r\n** convenience wrapper around separate calls to btreeGetPage() and \r\n** btreeInitPage().\r\n**\r\n** If an error occurs, then the value *ppPage is set to is undefined. It\r\n** may remain unchanged, or it may be set to an invalid value.\r\n*/\r\nstatic int getAndInitPage(\r\n  BtShared *pBt,          /* The database file */\r\n  Pgno pgno,           /* Number of the page to get */\r\n  MemPage **ppPage     /* Write the page pointer here */\r\n){\r\n  int rc;\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n\r\n  if( pgno>btreePagecount(pBt) ){\r\n    rc = SQLITE_CORRUPT_BKPT;\r\n  }else{\r\n    rc = btreeGetPage(pBt, pgno, ppPage, 0);\r\n    if( rc==SQLITE_OK ){\r\n      rc = btreeInitPage(*ppPage);\r\n      if( rc!=SQLITE_OK ){\r\n        releasePage(*ppPage);\r\n      }\r\n    }\r\n  }\r\n\r\n  testcase( pgno==0 );\r\n  assert( pgno!=0 || rc==SQLITE_CORRUPT );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Release a MemPage.  This should be called once for each prior\r\n** call to btreeGetPage.\r\n*/\r\nstatic void releasePage(MemPage *pPage){\r\n  if( pPage ){\r\n    assert( pPage->aData );\r\n    assert( pPage->pBt );\r\n    assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );\r\n    assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );\r\n    assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n    sqlite3PagerUnref(pPage->pDbPage);\r\n  }\r\n}\r\n\r\n/*\r\n** During a rollback, when the pager reloads information into the cache\r\n** so that the cache is restored to its original state at the start of\r\n** the transaction, for each page restored this routine is called.\r\n**\r\n** This routine needs to reset the extra data section at the end of the\r\n** page to agree with the restored data.\r\n*/\r\nstatic void pageReinit(DbPage *pData){\r\n  MemPage *pPage;\r\n  pPage = (MemPage *)sqlite3PagerGetExtra(pData);\r\n  assert( sqlite3PagerPageRefcount(pData)>0 );\r\n  if( pPage->isInit ){\r\n    assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n    pPage->isInit = 0;\r\n    if( sqlite3PagerPageRefcount(pData)>1 ){\r\n      /* pPage might not be a btree page;  it might be an overflow page\r\n      ** or ptrmap page or a free page.  In those cases, the following\r\n      ** call to btreeInitPage() will likely return SQLITE_CORRUPT.\r\n      ** But no harm is done by this.  And it is very important that\r\n      ** btreeInitPage() be called on every btree page so we make\r\n      ** the call for every page that comes in for re-initing. */\r\n      btreeInitPage(pPage);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Invoke the busy handler for a btree.\r\n*/\r\nstatic int btreeInvokeBusyHandler(void *pArg){\r\n  BtShared *pBt = (BtShared*)pArg;\r\n  assert( pBt->db );\r\n  assert( sqlite3_mutex_held(pBt->db->mutex) );\r\n  return sqlite3InvokeBusyHandler(&pBt->db->busyHandler);\r\n}\r\n\r\n/*\r\n** Open a database file.\r\n** \r\n** zFilename is the name of the database file.  If zFilename is NULL\r\n** then an ephemeral database is created.  The ephemeral database might\r\n** be exclusively in memory, or it might use a disk-based memory cache.\r\n** Either way, the ephemeral database will be automatically deleted \r\n** when sqlite3BtreeClose() is called.\r\n**\r\n** If zFilename is \":memory:\" then an in-memory database is created\r\n** that is automatically destroyed when it is closed.\r\n**\r\n** The \"flags\" parameter is a bitmask that might contain bits like\r\n** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY.\r\n**\r\n** If the database is already opened in the same database connection\r\n** and we are in shared cache mode, then the open will fail with an\r\n** SQLITE_CONSTRAINT error.  We cannot allow two or more BtShared\r\n** objects in the same database connection since doing so will lead\r\n** to problems with locking.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeOpen(\r\n  sqlite3_vfs *pVfs,      /* VFS to use for this b-tree */\r\n  const char *zFilename,  /* Name of the file containing the BTree database */\r\n  sqlite3 *db,            /* Associated database handle */\r\n  Btree **ppBtree,        /* Pointer to new Btree object written here */\r\n  int flags,              /* Options */\r\n  int vfsFlags            /* Flags passed through to sqlite3_vfs.xOpen() */\r\n){\r\n  BtShared *pBt = 0;             /* Shared part of btree structure */\r\n  Btree *p;                      /* Handle to return */\r\n  sqlite3_mutex *mutexOpen = 0;  /* Prevents a race condition. Ticket #3537 */\r\n  int rc = SQLITE_OK;            /* Result code from this function */\r\n  u8 nReserve;                   /* Byte of unused space on each page */\r\n  unsigned char zDbHeader[100];  /* Database header content */\r\n\r\n  /* True if opening an ephemeral, temporary database */\r\n  const int isTempDb = zFilename==0 || zFilename[0]==0;\r\n\r\n  /* Set the variable isMemdb to true for an in-memory database, or \r\n  ** false for a file-based database.\r\n  */\r\n#ifdef SQLITE_OMIT_MEMORYDB\r\n  const int isMemdb = 0;\r\n#else\r\n  const int isMemdb = (zFilename && strcmp(zFilename, \":memory:\")==0)\r\n                       || (isTempDb && sqlite3TempInMemory(db));\r\n#endif\r\n\r\n  assert( db!=0 );\r\n  assert( pVfs!=0 );\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  assert( (flags&0xff)==flags );   /* flags fit in 8 bits */\r\n\r\n  /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */\r\n  assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );\r\n\r\n  /* A BTREE_SINGLE database is always a temporary and/or ephemeral */\r\n  assert( (flags & BTREE_SINGLE)==0 || isTempDb );\r\n\r\n  if( isMemdb ){\r\n    flags |= BTREE_MEMORY;\r\n  }\r\n  if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){\r\n    vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;\r\n  }\r\n  p = sqlite3MallocZero(sizeof(Btree));\r\n  if( !p ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  p->inTrans = TRANS_NONE;\r\n  p->db = db;\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  p->lock.pBtree = p;\r\n  p->lock.iTable = 1;\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)\r\n  /*\r\n  ** If this Btree is a candidate for shared cache, try to find an\r\n  ** existing BtShared object that we can share with\r\n  */\r\n  if( isMemdb==0 && isTempDb==0 ){\r\n    if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){\r\n      int nFullPathname = pVfs->mxPathname+1;\r\n      char *zFullPathname = sqlite3Malloc(nFullPathname);\r\n      MUTEX_LOGIC( sqlite3_mutex *mutexShared; )\r\n      p->sharable = 1;\r\n      if( !zFullPathname ){\r\n        sqlite3_free(p);\r\n        return SQLITE_NOMEM;\r\n      }\r\n      rc = sqlite3OsFullPathname(pVfs, zFilename, nFullPathname, zFullPathname);\r\n      if( rc ){\r\n        sqlite3_free(zFullPathname);\r\n        sqlite3_free(p);\r\n        return rc;\r\n      }\r\n#if SQLITE_THREADSAFE\r\n      mutexOpen = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN);\r\n      sqlite3_mutex_enter(mutexOpen);\r\n      mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n      sqlite3_mutex_enter(mutexShared);\r\n#endif\r\n      for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){\r\n        assert( pBt->nRef>0 );\r\n        if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager))\r\n                 && sqlite3PagerVfs(pBt->pPager)==pVfs ){\r\n          int iDb;\r\n          for(iDb=db->nDb-1; iDb>=0; iDb--){\r\n            Btree *pExisting = db->aDb[iDb].pBt;\r\n            if( pExisting && pExisting->pBt==pBt ){\r\n              sqlite3_mutex_leave(mutexShared);\r\n              sqlite3_mutex_leave(mutexOpen);\r\n              sqlite3_free(zFullPathname);\r\n              sqlite3_free(p);\r\n              return SQLITE_CONSTRAINT;\r\n            }\r\n          }\r\n          p->pBt = pBt;\r\n          pBt->nRef++;\r\n          break;\r\n        }\r\n      }\r\n      sqlite3_mutex_leave(mutexShared);\r\n      sqlite3_free(zFullPathname);\r\n    }\r\n#ifdef SQLITE_DEBUG\r\n    else{\r\n      /* In debug mode, we mark all persistent databases as sharable\r\n      ** even when they are not.  This exercises the locking code and\r\n      ** gives more opportunity for asserts(sqlite3_mutex_held())\r\n      ** statements to find locking problems.\r\n      */\r\n      p->sharable = 1;\r\n    }\r\n#endif\r\n  }\r\n#endif\r\n  if( pBt==0 ){\r\n    /*\r\n    ** The following asserts make sure that structures used by the btree are\r\n    ** the right size.  This is to guard against size changes that result\r\n    ** when compiling on a different architecture.\r\n    */\r\n    assert( sizeof(i64)==8 || sizeof(i64)==4 );\r\n    assert( sizeof(u64)==8 || sizeof(u64)==4 );\r\n    assert( sizeof(u32)==4 );\r\n    assert( sizeof(u16)==2 );\r\n    assert( sizeof(Pgno)==4 );\r\n  \r\n    pBt = sqlite3MallocZero( sizeof(*pBt) );\r\n    if( pBt==0 ){\r\n      rc = SQLITE_NOMEM;\r\n      goto btree_open_out;\r\n    }\r\n    rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,\r\n                          EXTRA_SIZE, flags, vfsFlags, pageReinit);\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      goto btree_open_out;\r\n    }\r\n    pBt->openFlags = (u8)flags;\r\n    pBt->db = db;\r\n    sqlite3PagerSetBusyhandler(pBt->pPager, btreeInvokeBusyHandler, pBt);\r\n    p->pBt = pBt;\r\n  \r\n    pBt->pCursor = 0;\r\n    pBt->pPage1 = 0;\r\n    if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;\r\n#ifdef SQLITE_SECURE_DELETE\r\n    pBt->btsFlags |= BTS_SECURE_DELETE;\r\n#endif\r\n    pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);\r\n    if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE\r\n         || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){\r\n      pBt->pageSize = 0;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      /* If the magic name \":memory:\" will create an in-memory database, then\r\n      ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if\r\n      ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if\r\n      ** SQLITE_OMIT_MEMORYDB has been defined, then \":memory:\" is just a\r\n      ** regular file-name. In this case the auto-vacuum applies as per normal.\r\n      */\r\n      if( zFilename && !isMemdb ){\r\n        pBt->autoVacuum = (SQLITE_DEFAULT_AUTOVACUUM ? 1 : 0);\r\n        pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);\r\n      }\r\n#endif\r\n      nReserve = 0;\r\n    }else{\r\n      nReserve = zDbHeader[20];\r\n      pBt->btsFlags |= BTS_PAGESIZE_FIXED;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);\r\n      pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);\r\n#endif\r\n    }\r\n    rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);\r\n    if( rc ) goto btree_open_out;\r\n    pBt->usableSize = pBt->pageSize - nReserve;\r\n    assert( (pBt->pageSize & 7)==0 );  /* 8-byte alignment of pageSize */\r\n   \r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)\r\n    /* Add the new BtShared object to the linked list sharable BtShareds.\r\n    */\r\n    if( p->sharable ){\r\n      MUTEX_LOGIC( sqlite3_mutex *mutexShared; )\r\n      pBt->nRef = 1;\r\n      MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);)\r\n      if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){\r\n        pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);\r\n        if( pBt->mutex==0 ){\r\n          rc = SQLITE_NOMEM;\r\n          db->mallocFailed = 0;\r\n          goto btree_open_out;\r\n        }\r\n      }\r\n      sqlite3_mutex_enter(mutexShared);\r\n      pBt->pNext = GLOBAL(BtShared*,sqlite3SharedCacheList);\r\n      GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt;\r\n      sqlite3_mutex_leave(mutexShared);\r\n    }\r\n#endif\r\n  }\r\n\r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)\r\n  /* If the new Btree uses a sharable pBtShared, then link the new\r\n  ** Btree into the list of all sharable Btrees for the same connection.\r\n  ** The list is kept in ascending order by pBt address.\r\n  */\r\n  if( p->sharable ){\r\n    int i;\r\n    Btree *pSib;\r\n    for(i=0; i<db->nDb; i++){\r\n      if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){\r\n        while( pSib->pPrev ){ pSib = pSib->pPrev; }\r\n        if( p->pBt<pSib->pBt ){\r\n          p->pNext = pSib;\r\n          p->pPrev = 0;\r\n          pSib->pPrev = p;\r\n        }else{\r\n          while( pSib->pNext && pSib->pNext->pBt<p->pBt ){\r\n            pSib = pSib->pNext;\r\n          }\r\n          p->pNext = pSib->pNext;\r\n          p->pPrev = pSib;\r\n          if( p->pNext ){\r\n            p->pNext->pPrev = p;\r\n          }\r\n          pSib->pNext = p;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n  }\r\n#endif\r\n  *ppBtree = p;\r\n\r\nbtree_open_out:\r\n  if( rc!=SQLITE_OK ){\r\n    if( pBt && pBt->pPager ){\r\n      sqlite3PagerClose(pBt->pPager);\r\n    }\r\n    sqlite3_free(pBt);\r\n    sqlite3_free(p);\r\n    *ppBtree = 0;\r\n  }else{\r\n    /* If the B-Tree was successfully opened, set the pager-cache size to the\r\n    ** default value. Except, when opening on an existing shared pager-cache,\r\n    ** do not change the pager-cache size.\r\n    */\r\n    if( sqlite3BtreeSchema(p, 0, 0)==0 ){\r\n      sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE);\r\n    }\r\n  }\r\n  if( mutexOpen ){\r\n    assert( sqlite3_mutex_held(mutexOpen) );\r\n    sqlite3_mutex_leave(mutexOpen);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Decrement the BtShared.nRef counter.  When it reaches zero,\r\n** remove the BtShared structure from the sharing list.  Return\r\n** true if the BtShared.nRef counter reaches zero and return\r\n** false if it is still positive.\r\n*/\r\nstatic int removeFromSharingList(BtShared *pBt){\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  MUTEX_LOGIC( sqlite3_mutex *pMaster; )\r\n  BtShared *pList;\r\n  int removed = 0;\r\n\r\n  assert( sqlite3_mutex_notheld(pBt->mutex) );\r\n  MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )\r\n  sqlite3_mutex_enter(pMaster);\r\n  pBt->nRef--;\r\n  if( pBt->nRef<=0 ){\r\n    if( GLOBAL(BtShared*,sqlite3SharedCacheList)==pBt ){\r\n      GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt->pNext;\r\n    }else{\r\n      pList = GLOBAL(BtShared*,sqlite3SharedCacheList);\r\n      while( ALWAYS(pList) && pList->pNext!=pBt ){\r\n        pList=pList->pNext;\r\n      }\r\n      if( ALWAYS(pList) ){\r\n        pList->pNext = pBt->pNext;\r\n      }\r\n    }\r\n    if( SQLITE_THREADSAFE ){\r\n      sqlite3_mutex_free(pBt->mutex);\r\n    }\r\n    removed = 1;\r\n  }\r\n  sqlite3_mutex_leave(pMaster);\r\n  return removed;\r\n#else\r\n  return 1;\r\n#endif\r\n}\r\n\r\n/*\r\n** Make sure pBt->pTmpSpace points to an allocation of \r\n** MX_CELL_SIZE(pBt) bytes.\r\n*/\r\nstatic void allocateTempSpace(BtShared *pBt){\r\n  if( !pBt->pTmpSpace ){\r\n    pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );\r\n  }\r\n}\r\n\r\n/*\r\n** Free the pBt->pTmpSpace allocation\r\n*/\r\nstatic void freeTempSpace(BtShared *pBt){\r\n  sqlite3PageFree( pBt->pTmpSpace);\r\n  pBt->pTmpSpace = 0;\r\n}\r\n\r\n/*\r\n** Close an open database and invalidate all cursors.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){\r\n  BtShared *pBt = p->pBt;\r\n  BtCursor *pCur;\r\n\r\n  /* Close all cursors opened via this handle.  */\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  sqlite3BtreeEnter(p);\r\n  pCur = pBt->pCursor;\r\n  while( pCur ){\r\n    BtCursor *pTmp = pCur;\r\n    pCur = pCur->pNext;\r\n    if( pTmp->pBtree==p ){\r\n      sqlite3BtreeCloseCursor(pTmp);\r\n    }\r\n  }\r\n\r\n  /* Rollback any active transaction and free the handle structure.\r\n  ** The call to sqlite3BtreeRollback() drops any table-locks held by\r\n  ** this handle.\r\n  */\r\n  sqlite3BtreeRollback(p, SQLITE_OK);\r\n  sqlite3BtreeLeave(p);\r\n\r\n  /* If there are still other outstanding references to the shared-btree\r\n  ** structure, return now. The remainder of this procedure cleans \r\n  ** up the shared-btree.\r\n  */\r\n  assert( p->wantToLock==0 && p->locked==0 );\r\n  if( !p->sharable || removeFromSharingList(pBt) ){\r\n    /* The pBt is no longer on the sharing list, so we can access\r\n    ** it without having to hold the mutex.\r\n    **\r\n    ** Clean out and delete the BtShared object.\r\n    */\r\n    assert( !pBt->pCursor );\r\n    sqlite3PagerClose(pBt->pPager);\r\n    if( pBt->xFreeSchema && pBt->pSchema ){\r\n      pBt->xFreeSchema(pBt->pSchema);\r\n    }\r\n    sqlite3DbFree(0, pBt->pSchema);\r\n    freeTempSpace(pBt);\r\n    sqlite3_free(pBt);\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  assert( p->wantToLock==0 );\r\n  assert( p->locked==0 );\r\n  if( p->pPrev ) p->pPrev->pNext = p->pNext;\r\n  if( p->pNext ) p->pNext->pPrev = p->pPrev;\r\n#endif\r\n\r\n  sqlite3_free(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Change the limit on the number of pages allowed in the cache.\r\n**\r\n** The maximum number of cache pages is set to the absolute\r\n** value of mxPage.  If mxPage is negative, the pager will\r\n** operate asynchronously - it will not stop to do fsync()s\r\n** to insure data is written to the disk surface before\r\n** continuing.  Transactions still work if synchronous is off,\r\n** and the database cannot be corrupted if this program\r\n** crashes.  But if the operating system crashes or there is\r\n** an abrupt power failure when synchronous is off, the database\r\n** could be left in an inconsistent and unrecoverable state.\r\n** Synchronous is on by default so database corruption is not\r\n** normally a worry.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){\r\n  BtShared *pBt = p->pBt;\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  sqlite3BtreeEnter(p);\r\n  sqlite3PagerSetCachesize(pBt->pPager, mxPage);\r\n  sqlite3BtreeLeave(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Change the way data is synced to disk in order to increase or decrease\r\n** how well the database resists damage due to OS crashes and power\r\n** failures.  Level 1 is the same as asynchronous (no syncs() occur and\r\n** there is a high probability of damage)  Level 2 is the default.  There\r\n** is a very low but non-zero probability of damage.  Level 3 reduces the\r\n** probability of damage to near zero but with a write performance reduction.\r\n*/\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\nSQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(\r\n  Btree *p,              /* The btree to set the safety level on */\r\n  int level,             /* PRAGMA synchronous.  1=OFF, 2=NORMAL, 3=FULL */\r\n  int fullSync,          /* PRAGMA fullfsync. */\r\n  int ckptFullSync       /* PRAGMA checkpoint_fullfync */\r\n){\r\n  BtShared *pBt = p->pBt;\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  assert( level>=1 && level<=3 );\r\n  sqlite3BtreeEnter(p);\r\n  sqlite3PagerSetSafetyLevel(pBt->pPager, level, fullSync, ckptFullSync);\r\n  sqlite3BtreeLeave(p);\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n/*\r\n** Return TRUE if the given btree is set to safety level 1.  In other\r\n** words, return TRUE if no sync() occurs on the disk files.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree *p){\r\n  BtShared *pBt = p->pBt;\r\n  int rc;\r\n  assert( sqlite3_mutex_held(p->db->mutex) );  \r\n  sqlite3BtreeEnter(p);\r\n  assert( pBt && pBt->pPager );\r\n  rc = sqlite3PagerNosync(pBt->pPager);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Change the default pages size and the number of reserved bytes per page.\r\n** Or, if the page size has already been fixed, return SQLITE_READONLY \r\n** without changing anything.\r\n**\r\n** The page size must be a power of 2 between 512 and 65536.  If the page\r\n** size supplied does not meet this constraint then the page size is not\r\n** changed.\r\n**\r\n** Page sizes are constrained to be a power of two so that the region\r\n** of the database file used for locking (beginning at PENDING_BYTE,\r\n** the first byte past the 1GB boundary, 0x40000000) needs to occur\r\n** at the beginning of a page.\r\n**\r\n** If parameter nReserve is less than zero, then the number of reserved\r\n** bytes per page is left unchanged.\r\n**\r\n** If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size\r\n** and autovacuum mode can no longer be changed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){\r\n  int rc = SQLITE_OK;\r\n  BtShared *pBt = p->pBt;\r\n  assert( nReserve>=-1 && nReserve<=255 );\r\n  sqlite3BtreeEnter(p);\r\n  if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){\r\n    sqlite3BtreeLeave(p);\r\n    return SQLITE_READONLY;\r\n  }\r\n  if( nReserve<0 ){\r\n    nReserve = pBt->pageSize - pBt->usableSize;\r\n  }\r\n  assert( nReserve>=0 && nReserve<=255 );\r\n  if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&\r\n        ((pageSize-1)&pageSize)==0 ){\r\n    assert( (pageSize & 7)==0 );\r\n    assert( !pBt->pPage1 && !pBt->pCursor );\r\n    pBt->pageSize = (u32)pageSize;\r\n    freeTempSpace(pBt);\r\n  }\r\n  rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);\r\n  pBt->usableSize = pBt->pageSize - (u16)nReserve;\r\n  if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the currently defined page size\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){\r\n  return p->pBt->pageSize;\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)\r\n/*\r\n** Return the number of bytes of space at the end of every page that\r\n** are intentually left unused.  This is the \"reserved\" space that is\r\n** sometimes used by extensions.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree *p){\r\n  int n;\r\n  sqlite3BtreeEnter(p);\r\n  n = p->pBt->pageSize - p->pBt->usableSize;\r\n  sqlite3BtreeLeave(p);\r\n  return n;\r\n}\r\n\r\n/*\r\n** Set the maximum page count for a database if mxPage is positive.\r\n** No changes are made if mxPage is 0 or negative.\r\n** Regardless of the value of mxPage, return the maximum page count.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){\r\n  int n;\r\n  sqlite3BtreeEnter(p);\r\n  n = sqlite3PagerMaxPageCount(p->pBt->pPager, mxPage);\r\n  sqlite3BtreeLeave(p);\r\n  return n;\r\n}\r\n\r\n/*\r\n** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1.  If newFlag is -1,\r\n** then make no changes.  Always return the value of the BTS_SECURE_DELETE\r\n** setting after the change.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){\r\n  int b;\r\n  if( p==0 ) return 0;\r\n  sqlite3BtreeEnter(p);\r\n  if( newFlag>=0 ){\r\n    p->pBt->btsFlags &= ~BTS_SECURE_DELETE;\r\n    if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE;\r\n  } \r\n  b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0;\r\n  sqlite3BtreeLeave(p);\r\n  return b;\r\n}\r\n#endif /* !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) */\r\n\r\n/*\r\n** Change the 'auto-vacuum' property of the database. If the 'autoVacuum'\r\n** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it\r\n** is disabled. The default value for the auto-vacuum property is \r\n** determined by the SQLITE_DEFAULT_AUTOVACUUM macro.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n  return SQLITE_READONLY;\r\n#else\r\n  BtShared *pBt = p->pBt;\r\n  int rc = SQLITE_OK;\r\n  u8 av = (u8)autoVacuum;\r\n\r\n  sqlite3BtreeEnter(p);\r\n  if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){\r\n    rc = SQLITE_READONLY;\r\n  }else{\r\n    pBt->autoVacuum = av ?1:0;\r\n    pBt->incrVacuum = av==2 ?1:0;\r\n  }\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n#endif\r\n}\r\n\r\n/*\r\n** Return the value of the 'auto-vacuum' property. If auto-vacuum is \r\n** enabled 1 is returned. Otherwise 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n  return BTREE_AUTOVACUUM_NONE;\r\n#else\r\n  int rc;\r\n  sqlite3BtreeEnter(p);\r\n  rc = (\r\n    (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE:\r\n    (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL:\r\n    BTREE_AUTOVACUUM_INCR\r\n  );\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n#endif\r\n}\r\n\r\n\r\n/*\r\n** Get a reference to pPage1 of the database file.  This will\r\n** also acquire a readlock on that file.\r\n**\r\n** SQLITE_OK is returned on success.  If the file is not a\r\n** well-formed database file, then SQLITE_CORRUPT is returned.\r\n** SQLITE_BUSY is returned if the database is locked.  SQLITE_NOMEM\r\n** is returned if we run out of memory. \r\n*/\r\nstatic int lockBtree(BtShared *pBt){\r\n  int rc;              /* Result code from subfunctions */\r\n  MemPage *pPage1;     /* Page 1 of the database file */\r\n  int nPage;           /* Number of pages in the database */\r\n  int nPageFile = 0;   /* Number of pages in the database file */\r\n  int nPageHeader;     /* Number of pages in the database according to hdr */\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( pBt->pPage1==0 );\r\n  rc = sqlite3PagerSharedLock(pBt->pPager);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n  rc = btreeGetPage(pBt, 1, &pPage1, 0);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  /* Do some checking to help insure the file we opened really is\r\n  ** a valid database file. \r\n  */\r\n  nPage = nPageHeader = get4byte(28+(u8*)pPage1->aData);\r\n  sqlite3PagerPagecount(pBt->pPager, &nPageFile);\r\n  if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){\r\n    nPage = nPageFile;\r\n  }\r\n  if( nPage>0 ){\r\n    u32 pageSize;\r\n    u32 usableSize;\r\n    u8 *page1 = pPage1->aData;\r\n    rc = SQLITE_NOTADB;\r\n    if( memcmp(page1, zMagicHeader, 16)!=0 ){\r\n      goto page1_init_failed;\r\n    }\r\n\r\n#ifdef SQLITE_OMIT_WAL\r\n    if( page1[18]>1 ){\r\n      pBt->btsFlags |= BTS_READ_ONLY;\r\n    }\r\n    if( page1[19]>1 ){\r\n      goto page1_init_failed;\r\n    }\r\n#else\r\n    if( page1[18]>2 ){\r\n      pBt->btsFlags |= BTS_READ_ONLY;\r\n    }\r\n    if( page1[19]>2 ){\r\n      goto page1_init_failed;\r\n    }\r\n\r\n    /* If the write version is set to 2, this database should be accessed\r\n    ** in WAL mode. If the log is not already open, open it now. Then \r\n    ** return SQLITE_OK and return without populating BtShared.pPage1.\r\n    ** The caller detects this and calls this function again. This is\r\n    ** required as the version of page 1 currently in the page1 buffer\r\n    ** may not be the latest version - there may be a newer one in the log\r\n    ** file.\r\n    */\r\n    if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){\r\n      int isOpen = 0;\r\n      rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen);\r\n      if( rc!=SQLITE_OK ){\r\n        goto page1_init_failed;\r\n      }else if( isOpen==0 ){\r\n        releasePage(pPage1);\r\n        return SQLITE_OK;\r\n      }\r\n      rc = SQLITE_NOTADB;\r\n    }\r\n#endif\r\n\r\n    /* The maximum embedded fraction must be exactly 25%.  And the minimum\r\n    ** embedded fraction must be 12.5% for both leaf-data and non-leaf-data.\r\n    ** The original design allowed these amounts to vary, but as of\r\n    ** version 3.6.0, we require them to be fixed.\r\n    */\r\n    if( memcmp(&page1[21], \"\\100\\040\\040\",3)!=0 ){\r\n      goto page1_init_failed;\r\n    }\r\n    pageSize = (page1[16]<<8) | (page1[17]<<16);\r\n    if( ((pageSize-1)&pageSize)!=0\r\n     || pageSize>SQLITE_MAX_PAGE_SIZE \r\n     || pageSize<=256 \r\n    ){\r\n      goto page1_init_failed;\r\n    }\r\n    assert( (pageSize & 7)==0 );\r\n    usableSize = pageSize - page1[20];\r\n    if( (u32)pageSize!=pBt->pageSize ){\r\n      /* After reading the first page of the database assuming a page size\r\n      ** of BtShared.pageSize, we have discovered that the page-size is\r\n      ** actually pageSize. Unlock the database, leave pBt->pPage1 at\r\n      ** zero and return SQLITE_OK. The caller will call this function\r\n      ** again with the correct page-size.\r\n      */\r\n      releasePage(pPage1);\r\n      pBt->usableSize = usableSize;\r\n      pBt->pageSize = pageSize;\r\n      freeTempSpace(pBt);\r\n      rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize,\r\n                                   pageSize-usableSize);\r\n      return rc;\r\n    }\r\n    if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n      goto page1_init_failed;\r\n    }\r\n    if( usableSize<480 ){\r\n      goto page1_init_failed;\r\n    }\r\n    pBt->pageSize = pageSize;\r\n    pBt->usableSize = usableSize;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);\r\n    pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);\r\n#endif\r\n  }\r\n\r\n  /* maxLocal is the maximum amount of payload to store locally for\r\n  ** a cell.  Make sure it is small enough so that at least minFanout\r\n  ** cells can will fit on one page.  We assume a 10-byte page header.\r\n  ** Besides the payload, the cell must store:\r\n  **     2-byte pointer to the cell\r\n  **     4-byte child pointer\r\n  **     9-byte nKey value\r\n  **     4-byte nData value\r\n  **     4-byte overflow page pointer\r\n  ** So a cell consists of a 2-byte pointer, a header which is as much as\r\n  ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow\r\n  ** page pointer.\r\n  */\r\n  pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23);\r\n  pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23);\r\n  pBt->maxLeaf = (u16)(pBt->usableSize - 35);\r\n  pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23);\r\n  if( pBt->maxLocal>127 ){\r\n    pBt->max1bytePayload = 127;\r\n  }else{\r\n    pBt->max1bytePayload = (u8)pBt->maxLocal;\r\n  }\r\n  assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );\r\n  pBt->pPage1 = pPage1;\r\n  pBt->nPage = nPage;\r\n  return SQLITE_OK;\r\n\r\npage1_init_failed:\r\n  releasePage(pPage1);\r\n  pBt->pPage1 = 0;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If there are no outstanding cursors and we are not in the middle\r\n** of a transaction but there is a read lock on the database, then\r\n** this routine unrefs the first page of the database file which \r\n** has the effect of releasing the read lock.\r\n**\r\n** If there is a transaction in progress, this routine is a no-op.\r\n*/\r\nstatic void unlockBtreeIfUnused(BtShared *pBt){\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( pBt->pCursor==0 || pBt->inTransaction>TRANS_NONE );\r\n  if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){\r\n    assert( pBt->pPage1->aData );\r\n    assert( sqlite3PagerRefcount(pBt->pPager)==1 );\r\n    assert( pBt->pPage1->aData );\r\n    releasePage(pBt->pPage1);\r\n    pBt->pPage1 = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** If pBt points to an empty file then convert that empty file\r\n** into a new empty database by initializing the first page of\r\n** the database.\r\n*/\r\nstatic int newDatabase(BtShared *pBt){\r\n  MemPage *pP1;\r\n  unsigned char *data;\r\n  int rc;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  if( pBt->nPage>0 ){\r\n    return SQLITE_OK;\r\n  }\r\n  pP1 = pBt->pPage1;\r\n  assert( pP1!=0 );\r\n  data = pP1->aData;\r\n  rc = sqlite3PagerWrite(pP1->pDbPage);\r\n  if( rc ) return rc;\r\n  memcpy(data, zMagicHeader, sizeof(zMagicHeader));\r\n  assert( sizeof(zMagicHeader)==16 );\r\n  data[16] = (u8)((pBt->pageSize>>8)&0xff);\r\n  data[17] = (u8)((pBt->pageSize>>16)&0xff);\r\n  data[18] = 1;\r\n  data[19] = 1;\r\n  assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);\r\n  data[20] = (u8)(pBt->pageSize - pBt->usableSize);\r\n  data[21] = 64;\r\n  data[22] = 32;\r\n  data[23] = 32;\r\n  memset(&data[24], 0, 100-24);\r\n  zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA );\r\n  pBt->btsFlags |= BTS_PAGESIZE_FIXED;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 );\r\n  assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 );\r\n  put4byte(&data[36 + 4*4], pBt->autoVacuum);\r\n  put4byte(&data[36 + 7*4], pBt->incrVacuum);\r\n#endif\r\n  pBt->nPage = 1;\r\n  data[31] = 1;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Attempt to start a new transaction. A write-transaction\r\n** is started if the second argument is nonzero, otherwise a read-\r\n** transaction.  If the second argument is 2 or more and exclusive\r\n** transaction is started, meaning that no other process is allowed\r\n** to access the database.  A preexisting transaction may not be\r\n** upgraded to exclusive by calling this routine a second time - the\r\n** exclusivity flag only works for a new transaction.\r\n**\r\n** A write-transaction must be started before attempting any \r\n** changes to the database.  None of the following routines \r\n** will work unless a transaction is started first:\r\n**\r\n**      sqlite3BtreeCreateTable()\r\n**      sqlite3BtreeCreateIndex()\r\n**      sqlite3BtreeClearTable()\r\n**      sqlite3BtreeDropTable()\r\n**      sqlite3BtreeInsert()\r\n**      sqlite3BtreeDelete()\r\n**      sqlite3BtreeUpdateMeta()\r\n**\r\n** If an initial attempt to acquire the lock fails because of lock contention\r\n** and the database was previously unlocked, then invoke the busy handler\r\n** if there is one.  But if there was previously a read-lock, do not\r\n** invoke the busy handler - just return SQLITE_BUSY.  SQLITE_BUSY is \r\n** returned when there is already a read-lock in order to avoid a deadlock.\r\n**\r\n** Suppose there are two processes A and B.  A has a read lock and B has\r\n** a reserved lock.  B tries to promote to exclusive but is blocked because\r\n** of A's read lock.  A tries to promote to reserved but is blocked by B.\r\n** One or the other of the two processes must give way or there can be\r\n** no progress.  By returning SQLITE_BUSY and not invoking the busy callback\r\n** when A already has a read lock, we encourage A to give up and let B\r\n** proceed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag){\r\n  sqlite3 *pBlock = 0;\r\n  BtShared *pBt = p->pBt;\r\n  int rc = SQLITE_OK;\r\n\r\n  sqlite3BtreeEnter(p);\r\n  btreeIntegrity(p);\r\n\r\n  /* If the btree is already in a write-transaction, or it\r\n  ** is already in a read-transaction and a read-transaction\r\n  ** is requested, this is a no-op.\r\n  */\r\n  if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){\r\n    goto trans_begun;\r\n  }\r\n\r\n  /* Write transactions are not possible on a read-only database */\r\n  if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){\r\n    rc = SQLITE_READONLY;\r\n    goto trans_begun;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  /* If another database handle has already opened a write transaction \r\n  ** on this shared-btree structure and a second write transaction is\r\n  ** requested, return SQLITE_LOCKED.\r\n  */\r\n  if( (wrflag && pBt->inTransaction==TRANS_WRITE)\r\n   || (pBt->btsFlags & BTS_PENDING)!=0\r\n  ){\r\n    pBlock = pBt->pWriter->db;\r\n  }else if( wrflag>1 ){\r\n    BtLock *pIter;\r\n    for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){\r\n      if( pIter->pBtree!=p ){\r\n        pBlock = pIter->pBtree->db;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  if( pBlock ){\r\n    sqlite3ConnectionBlocked(p->db, pBlock);\r\n    rc = SQLITE_LOCKED_SHAREDCACHE;\r\n    goto trans_begun;\r\n  }\r\n#endif\r\n\r\n  /* Any read-only or read-write transaction implies a read-lock on \r\n  ** page 1. So if some other shared-cache client already has a write-lock \r\n  ** on page 1, the transaction cannot be opened. */\r\n  rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK);\r\n  if( SQLITE_OK!=rc ) goto trans_begun;\r\n\r\n  pBt->btsFlags &= ~BTS_INITIALLY_EMPTY;\r\n  if( pBt->nPage==0 ) pBt->btsFlags |= BTS_INITIALLY_EMPTY;\r\n  do {\r\n    /* Call lockBtree() until either pBt->pPage1 is populated or\r\n    ** lockBtree() returns something other than SQLITE_OK. lockBtree()\r\n    ** may return SQLITE_OK but leave pBt->pPage1 set to 0 if after\r\n    ** reading page 1 it discovers that the page-size of the database \r\n    ** file is not pBt->pageSize. In this case lockBtree() will update\r\n    ** pBt->pageSize to the page-size of the file on disk.\r\n    */\r\n    while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );\r\n\r\n    if( rc==SQLITE_OK && wrflag ){\r\n      if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){\r\n        rc = SQLITE_READONLY;\r\n      }else{\r\n        rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db));\r\n        if( rc==SQLITE_OK ){\r\n          rc = newDatabase(pBt);\r\n        }\r\n      }\r\n    }\r\n  \r\n    if( rc!=SQLITE_OK ){\r\n      unlockBtreeIfUnused(pBt);\r\n    }\r\n  }while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&\r\n          btreeInvokeBusyHandler(pBt) );\r\n\r\n  if( rc==SQLITE_OK ){\r\n    if( p->inTrans==TRANS_NONE ){\r\n      pBt->nTransaction++;\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n      if( p->sharable ){\r\n\tassert( p->lock.pBtree==p && p->lock.iTable==1 );\r\n        p->lock.eLock = READ_LOCK;\r\n        p->lock.pNext = pBt->pLock;\r\n        pBt->pLock = &p->lock;\r\n      }\r\n#endif\r\n    }\r\n    p->inTrans = (wrflag?TRANS_WRITE:TRANS_READ);\r\n    if( p->inTrans>pBt->inTransaction ){\r\n      pBt->inTransaction = p->inTrans;\r\n    }\r\n    if( wrflag ){\r\n      MemPage *pPage1 = pBt->pPage1;\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n      assert( !pBt->pWriter );\r\n      pBt->pWriter = p;\r\n      pBt->btsFlags &= ~BTS_EXCLUSIVE;\r\n      if( wrflag>1 ) pBt->btsFlags |= BTS_EXCLUSIVE;\r\n#endif\r\n\r\n      /* If the db-size header field is incorrect (as it may be if an old\r\n      ** client has been writing the database file), update it now. Doing\r\n      ** this sooner rather than later means the database size can safely \r\n      ** re-read the database size from page 1 if a savepoint or transaction\r\n      ** rollback occurs within the transaction.\r\n      */\r\n      if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){\r\n        rc = sqlite3PagerWrite(pPage1->pDbPage);\r\n        if( rc==SQLITE_OK ){\r\n          put4byte(&pPage1->aData[28], pBt->nPage);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\ntrans_begun:\r\n  if( rc==SQLITE_OK && wrflag ){\r\n    /* This call makes sure that the pager has the correct number of\r\n    ** open savepoints. If the second parameter is greater than 0 and\r\n    ** the sub-journal is not already open, then it will be opened here.\r\n    */\r\n    rc = sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint);\r\n  }\r\n\r\n  btreeIntegrity(p);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n\r\n/*\r\n** Set the pointer-map entries for all children of page pPage. Also, if\r\n** pPage contains cells that point to overflow pages, set the pointer\r\n** map entries for the overflow pages as well.\r\n*/\r\nstatic int setChildPtrmaps(MemPage *pPage){\r\n  int i;                             /* Counter variable */\r\n  int nCell;                         /* Number of cells in page pPage */\r\n  int rc;                            /* Return code */\r\n  BtShared *pBt = pPage->pBt;\r\n  u8 isInitOrig = pPage->isInit;\r\n  Pgno pgno = pPage->pgno;\r\n\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  rc = btreeInitPage(pPage);\r\n  if( rc!=SQLITE_OK ){\r\n    goto set_child_ptrmaps_out;\r\n  }\r\n  nCell = pPage->nCell;\r\n\r\n  for(i=0; i<nCell; i++){\r\n    u8 *pCell = findCell(pPage, i);\r\n\r\n    ptrmapPutOvflPtr(pPage, pCell, &rc);\r\n\r\n    if( !pPage->leaf ){\r\n      Pgno childPgno = get4byte(pCell);\r\n      ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);\r\n    }\r\n  }\r\n\r\n  if( !pPage->leaf ){\r\n    Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);\r\n    ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);\r\n  }\r\n\r\nset_child_ptrmaps_out:\r\n  pPage->isInit = isInitOrig;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Somewhere on pPage is a pointer to page iFrom.  Modify this pointer so\r\n** that it points to iTo. Parameter eType describes the type of pointer to\r\n** be modified, as  follows:\r\n**\r\n** PTRMAP_BTREE:     pPage is a btree-page. The pointer points at a child \r\n**                   page of pPage.\r\n**\r\n** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow\r\n**                   page pointed to by one of the cells on pPage.\r\n**\r\n** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next\r\n**                   overflow page in the list.\r\n*/\r\nstatic int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  if( eType==PTRMAP_OVERFLOW2 ){\r\n    /* The pointer is always the first 4 bytes of the page in this case.  */\r\n    if( get4byte(pPage->aData)!=iFrom ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    put4byte(pPage->aData, iTo);\r\n  }else{\r\n    u8 isInitOrig = pPage->isInit;\r\n    int i;\r\n    int nCell;\r\n\r\n    btreeInitPage(pPage);\r\n    nCell = pPage->nCell;\r\n\r\n    for(i=0; i<nCell; i++){\r\n      u8 *pCell = findCell(pPage, i);\r\n      if( eType==PTRMAP_OVERFLOW1 ){\r\n        CellInfo info;\r\n        btreeParseCellPtr(pPage, pCell, &info);\r\n        if( info.iOverflow\r\n         && pCell+info.iOverflow+3<=pPage->aData+pPage->maskPage\r\n         && iFrom==get4byte(&pCell[info.iOverflow])\r\n        ){\r\n          put4byte(&pCell[info.iOverflow], iTo);\r\n          break;\r\n        }\r\n      }else{\r\n        if( get4byte(pCell)==iFrom ){\r\n          put4byte(pCell, iTo);\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  \r\n    if( i==nCell ){\r\n      if( eType!=PTRMAP_BTREE || \r\n          get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){\r\n        return SQLITE_CORRUPT_BKPT;\r\n      }\r\n      put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);\r\n    }\r\n\r\n    pPage->isInit = isInitOrig;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Move the open database page pDbPage to location iFreePage in the \r\n** database. The pDbPage reference remains valid.\r\n**\r\n** The isCommit flag indicates that there is no need to remember that\r\n** the journal needs to be sync()ed before database page pDbPage->pgno \r\n** can be written to. The caller has already promised not to write to that\r\n** page.\r\n*/\r\nstatic int relocatePage(\r\n  BtShared *pBt,           /* Btree */\r\n  MemPage *pDbPage,        /* Open page to move */\r\n  u8 eType,                /* Pointer map 'type' entry for pDbPage */\r\n  Pgno iPtrPage,           /* Pointer map 'page-no' entry for pDbPage */\r\n  Pgno iFreePage,          /* The location to move pDbPage to */\r\n  int isCommit             /* isCommit flag passed to sqlite3PagerMovepage */\r\n){\r\n  MemPage *pPtrPage;   /* The page that contains a pointer to pDbPage */\r\n  Pgno iDbPage = pDbPage->pgno;\r\n  Pager *pPager = pBt->pPager;\r\n  int rc;\r\n\r\n  assert( eType==PTRMAP_OVERFLOW2 || eType==PTRMAP_OVERFLOW1 || \r\n      eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE );\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( pDbPage->pBt==pBt );\r\n\r\n  /* Move page iDbPage from its current location to page number iFreePage */\r\n  TRACE((\"AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\\n\", \r\n      iDbPage, iFreePage, iPtrPage, eType));\r\n  rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n  pDbPage->pgno = iFreePage;\r\n\r\n  /* If pDbPage was a btree-page, then it may have child pages and/or cells\r\n  ** that point to overflow pages. The pointer map entries for all these\r\n  ** pages need to be changed.\r\n  **\r\n  ** If pDbPage is an overflow page, then the first 4 bytes may store a\r\n  ** pointer to a subsequent overflow page. If this is the case, then\r\n  ** the pointer map needs to be updated for the subsequent overflow page.\r\n  */\r\n  if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){\r\n    rc = setChildPtrmaps(pDbPage);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n  }else{\r\n    Pgno nextOvfl = get4byte(pDbPage->aData);\r\n    if( nextOvfl!=0 ){\r\n      ptrmapPut(pBt, nextOvfl, PTRMAP_OVERFLOW2, iFreePage, &rc);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Fix the database pointer on page iPtrPage that pointed at iDbPage so\r\n  ** that it points at iFreePage. Also fix the pointer map entry for\r\n  ** iPtrPage.\r\n  */\r\n  if( eType!=PTRMAP_ROOTPAGE ){\r\n    rc = btreeGetPage(pBt, iPtrPage, &pPtrPage, 0);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    rc = sqlite3PagerWrite(pPtrPage->pDbPage);\r\n    if( rc!=SQLITE_OK ){\r\n      releasePage(pPtrPage);\r\n      return rc;\r\n    }\r\n    rc = modifyPagePointer(pPtrPage, iDbPage, iFreePage, eType);\r\n    releasePage(pPtrPage);\r\n    if( rc==SQLITE_OK ){\r\n      ptrmapPut(pBt, iFreePage, eType, iPtrPage, &rc);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* Forward declaration required by incrVacuumStep(). */\r\nstatic int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);\r\n\r\n/*\r\n** Perform a single step of an incremental-vacuum. If successful,\r\n** return SQLITE_OK. If there is no work to do (and therefore no\r\n** point in calling this function again), return SQLITE_DONE.\r\n**\r\n** More specificly, this function attempts to re-organize the \r\n** database so that the last page of the file currently in use\r\n** is no longer in use.\r\n**\r\n** If the nFin parameter is non-zero, this function assumes\r\n** that the caller will keep calling incrVacuumStep() until\r\n** it returns SQLITE_DONE or an error, and that nFin is the\r\n** number of pages the database file will contain after this \r\n** process is complete.  If nFin is zero, it is assumed that\r\n** incrVacuumStep() will be called a finite amount of times\r\n** which may or may not empty the freelist.  A full autovacuum\r\n** has nFin>0.  A \"PRAGMA incremental_vacuum\" has nFin==0.\r\n*/\r\nstatic int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg){\r\n  Pgno nFreeList;           /* Number of pages still on the free-list */\r\n  int rc;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( iLastPg>nFin );\r\n\r\n  if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){\r\n    u8 eType;\r\n    Pgno iPtrPage;\r\n\r\n    nFreeList = get4byte(&pBt->pPage1->aData[36]);\r\n    if( nFreeList==0 ){\r\n      return SQLITE_DONE;\r\n    }\r\n\r\n    rc = ptrmapGet(pBt, iLastPg, &eType, &iPtrPage);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    if( eType==PTRMAP_ROOTPAGE ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n\r\n    if( eType==PTRMAP_FREEPAGE ){\r\n      if( nFin==0 ){\r\n        /* Remove the page from the files free-list. This is not required\r\n        ** if nFin is non-zero. In that case, the free-list will be\r\n        ** truncated to zero after this function returns, so it doesn't \r\n        ** matter if it still contains some garbage entries.\r\n        */\r\n        Pgno iFreePg;\r\n        MemPage *pFreePg;\r\n        rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iLastPg, 1);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        assert( iFreePg==iLastPg );\r\n        releasePage(pFreePg);\r\n      }\r\n    } else {\r\n      Pgno iFreePg;             /* Index of free page to move pLastPg to */\r\n      MemPage *pLastPg;\r\n\r\n      rc = btreeGetPage(pBt, iLastPg, &pLastPg, 0);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n\r\n      /* If nFin is zero, this loop runs exactly once and page pLastPg\r\n      ** is swapped with the first free page pulled off the free list.\r\n      **\r\n      ** On the other hand, if nFin is greater than zero, then keep\r\n      ** looping until a free-page located within the first nFin pages\r\n      ** of the file is found.\r\n      */\r\n      do {\r\n        MemPage *pFreePg;\r\n        rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, 0, 0);\r\n        if( rc!=SQLITE_OK ){\r\n          releasePage(pLastPg);\r\n          return rc;\r\n        }\r\n        releasePage(pFreePg);\r\n      }while( nFin!=0 && iFreePg>nFin );\r\n      assert( iFreePg<iLastPg );\r\n      \r\n      rc = sqlite3PagerWrite(pLastPg->pDbPage);\r\n      if( rc==SQLITE_OK ){\r\n        rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, nFin!=0);\r\n      }\r\n      releasePage(pLastPg);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n    }\r\n  }\r\n\r\n  if( nFin==0 ){\r\n    iLastPg--;\r\n    while( iLastPg==PENDING_BYTE_PAGE(pBt)||PTRMAP_ISPAGE(pBt, iLastPg) ){\r\n      if( PTRMAP_ISPAGE(pBt, iLastPg) ){\r\n        MemPage *pPg;\r\n        rc = btreeGetPage(pBt, iLastPg, &pPg, 0);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        rc = sqlite3PagerWrite(pPg->pDbPage);\r\n        releasePage(pPg);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n      }\r\n      iLastPg--;\r\n    }\r\n    sqlite3PagerTruncateImage(pBt->pPager, iLastPg);\r\n    pBt->nPage = iLastPg;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** A write-transaction must be opened before calling this function.\r\n** It performs a single unit of work towards an incremental vacuum.\r\n**\r\n** If the incremental vacuum is finished after this function has run,\r\n** SQLITE_DONE is returned. If it is not finished, but no error occurred,\r\n** SQLITE_OK is returned. Otherwise an SQLite error code. \r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){\r\n  int rc;\r\n  BtShared *pBt = p->pBt;\r\n\r\n  sqlite3BtreeEnter(p);\r\n  assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE );\r\n  if( !pBt->autoVacuum ){\r\n    rc = SQLITE_DONE;\r\n  }else{\r\n    invalidateAllOverflowCache(pBt);\r\n    rc = incrVacuumStep(pBt, 0, btreePagecount(pBt));\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\r\n      put4byte(&pBt->pPage1->aData[28], pBt->nPage);\r\n    }\r\n  }\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This routine is called prior to sqlite3PagerCommit when a transaction\r\n** is commited for an auto-vacuum database.\r\n**\r\n** If SQLITE_OK is returned, then *pnTrunc is set to the number of pages\r\n** the database file should be truncated to during the commit process. \r\n** i.e. the database has been reorganized so that only the first *pnTrunc\r\n** pages are in use.\r\n*/\r\nstatic int autoVacuumCommit(BtShared *pBt){\r\n  int rc = SQLITE_OK;\r\n  Pager *pPager = pBt->pPager;\r\n  VVA_ONLY( int nRef = sqlite3PagerRefcount(pPager) );\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  invalidateAllOverflowCache(pBt);\r\n  assert(pBt->autoVacuum);\r\n  if( !pBt->incrVacuum ){\r\n    Pgno nFin;         /* Number of pages in database after autovacuuming */\r\n    Pgno nFree;        /* Number of pages on the freelist initially */\r\n    Pgno nPtrmap;      /* Number of PtrMap pages to be freed */\r\n    Pgno iFree;        /* The next page to be freed */\r\n    int nEntry;        /* Number of entries on one ptrmap page */\r\n    Pgno nOrig;        /* Database size before freeing */\r\n\r\n    nOrig = btreePagecount(pBt);\r\n    if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){\r\n      /* It is not possible to create a database for which the final page\r\n      ** is either a pointer-map page or the pending-byte page. If one\r\n      ** is encountered, this indicates corruption.\r\n      */\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n\r\n    nFree = get4byte(&pBt->pPage1->aData[36]);\r\n    nEntry = pBt->usableSize/5;\r\n    nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+nEntry)/nEntry;\r\n    nFin = nOrig - nFree - nPtrmap;\r\n    if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin<PENDING_BYTE_PAGE(pBt) ){\r\n      nFin--;\r\n    }\r\n    while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){\r\n      nFin--;\r\n    }\r\n    if( nFin>nOrig ) return SQLITE_CORRUPT_BKPT;\r\n\r\n    for(iFree=nOrig; iFree>nFin && rc==SQLITE_OK; iFree--){\r\n      rc = incrVacuumStep(pBt, nFin, iFree);\r\n    }\r\n    if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){\r\n      rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\r\n      put4byte(&pBt->pPage1->aData[32], 0);\r\n      put4byte(&pBt->pPage1->aData[36], 0);\r\n      put4byte(&pBt->pPage1->aData[28], nFin);\r\n      sqlite3PagerTruncateImage(pBt->pPager, nFin);\r\n      pBt->nPage = nFin;\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3PagerRollback(pPager);\r\n    }\r\n  }\r\n\r\n  assert( nRef==sqlite3PagerRefcount(pPager) );\r\n  return rc;\r\n}\r\n\r\n#else /* ifndef SQLITE_OMIT_AUTOVACUUM */\r\n# define setChildPtrmaps(x) SQLITE_OK\r\n#endif\r\n\r\n/*\r\n** This routine does the first phase of a two-phase commit.  This routine\r\n** causes a rollback journal to be created (if it does not already exist)\r\n** and populated with enough information so that if a power loss occurs\r\n** the database can be restored to its original state by playing back\r\n** the journal.  Then the contents of the journal are flushed out to\r\n** the disk.  After the journal is safely on oxide, the changes to the\r\n** database are written into the database file and flushed to oxide.\r\n** At the end of this call, the rollback journal still exists on the\r\n** disk and we are still holding all locks, so the transaction has not\r\n** committed.  See sqlite3BtreeCommitPhaseTwo() for the second phase of the\r\n** commit process.\r\n**\r\n** This call is a no-op if no write-transaction is currently active on pBt.\r\n**\r\n** Otherwise, sync the database file for the btree pBt. zMaster points to\r\n** the name of a master journal file that should be written into the\r\n** individual journal file, or is NULL, indicating no master journal file \r\n** (single database transaction).\r\n**\r\n** When this is called, the master journal should already have been\r\n** created, populated with this journal pointer and synced to disk.\r\n**\r\n** Once this is routine has returned, the only thing required to commit\r\n** the write-transaction for this database file is to delete the journal.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){\r\n  int rc = SQLITE_OK;\r\n  if( p->inTrans==TRANS_WRITE ){\r\n    BtShared *pBt = p->pBt;\r\n    sqlite3BtreeEnter(p);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( pBt->autoVacuum ){\r\n      rc = autoVacuumCommit(pBt);\r\n      if( rc!=SQLITE_OK ){\r\n        sqlite3BtreeLeave(p);\r\n        return rc;\r\n      }\r\n    }\r\n#endif\r\n    rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zMaster, 0);\r\n    sqlite3BtreeLeave(p);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()\r\n** at the conclusion of a transaction.\r\n*/\r\nstatic void btreeEndTransaction(Btree *p){\r\n  BtShared *pBt = p->pBt;\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n\r\n  btreeClearHasContent(pBt);\r\n  if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){\r\n    /* If there are other active statements that belong to this database\r\n    ** handle, downgrade to a read-only transaction. The other statements\r\n    ** may still be reading from the database.  */\r\n    downgradeAllSharedCacheTableLocks(p);\r\n    p->inTrans = TRANS_READ;\r\n  }else{\r\n    /* If the handle had any kind of transaction open, decrement the \r\n    ** transaction count of the shared btree. If the transaction count \r\n    ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()\r\n    ** call below will unlock the pager.  */\r\n    if( p->inTrans!=TRANS_NONE ){\r\n      clearAllSharedCacheTableLocks(p);\r\n      pBt->nTransaction--;\r\n      if( 0==pBt->nTransaction ){\r\n        pBt->inTransaction = TRANS_NONE;\r\n      }\r\n    }\r\n\r\n    /* Set the current transaction state to TRANS_NONE and unlock the \r\n    ** pager if this call closed the only read or write transaction.  */\r\n    p->inTrans = TRANS_NONE;\r\n    unlockBtreeIfUnused(pBt);\r\n  }\r\n\r\n  btreeIntegrity(p);\r\n}\r\n\r\n/*\r\n** Commit the transaction currently in progress.\r\n**\r\n** This routine implements the second phase of a 2-phase commit.  The\r\n** sqlite3BtreeCommitPhaseOne() routine does the first phase and should\r\n** be invoked prior to calling this routine.  The sqlite3BtreeCommitPhaseOne()\r\n** routine did all the work of writing information out to disk and flushing the\r\n** contents so that they are written onto the disk platter.  All this\r\n** routine has to do is delete or truncate or zero the header in the\r\n** the rollback journal (which causes the transaction to commit) and\r\n** drop locks.\r\n**\r\n** Normally, if an error occurs while the pager layer is attempting to \r\n** finalize the underlying journal file, this function returns an error and\r\n** the upper layer will attempt a rollback. However, if the second argument\r\n** is non-zero then this b-tree transaction is part of a multi-file \r\n** transaction. In this case, the transaction has already been committed \r\n** (by deleting a master journal file) and the caller will ignore this \r\n** functions return code. So, even if an error occurs in the pager layer,\r\n** reset the b-tree objects internal state to indicate that the write\r\n** transaction has been closed. This is quite safe, as the pager will have\r\n** transitioned to the error state.\r\n**\r\n** This will release the write lock on the database file.  If there\r\n** are no active cursors, it also releases the read lock.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){\r\n\r\n  if( p->inTrans==TRANS_NONE ) return SQLITE_OK;\r\n  sqlite3BtreeEnter(p);\r\n  btreeIntegrity(p);\r\n\r\n  /* If the handle has a write-transaction open, commit the shared-btrees \r\n  ** transaction and set the shared state to TRANS_READ.\r\n  */\r\n  if( p->inTrans==TRANS_WRITE ){\r\n    int rc;\r\n    BtShared *pBt = p->pBt;\r\n    assert( pBt->inTransaction==TRANS_WRITE );\r\n    assert( pBt->nTransaction>0 );\r\n    rc = sqlite3PagerCommitPhaseTwo(pBt->pPager);\r\n    if( rc!=SQLITE_OK && bCleanup==0 ){\r\n      sqlite3BtreeLeave(p);\r\n      return rc;\r\n    }\r\n    pBt->inTransaction = TRANS_READ;\r\n  }\r\n\r\n  btreeEndTransaction(p);\r\n  sqlite3BtreeLeave(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Do both phases of a commit.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){\r\n  int rc;\r\n  sqlite3BtreeEnter(p);\r\n  rc = sqlite3BtreeCommitPhaseOne(p, 0);\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3BtreeCommitPhaseTwo(p, 0);\r\n  }\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** Return the number of write-cursors open on this handle. This is for use\r\n** in assert() expressions, so it is only compiled if NDEBUG is not\r\n** defined.\r\n**\r\n** For the purposes of this routine, a write-cursor is any cursor that\r\n** is capable of writing to the databse.  That means the cursor was\r\n** originally opened for writing and the cursor has not be disabled\r\n** by having its state changed to CURSOR_FAULT.\r\n*/\r\nstatic int countWriteCursors(BtShared *pBt){\r\n  BtCursor *pCur;\r\n  int r = 0;\r\n  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){\r\n    if( pCur->wrFlag && pCur->eState!=CURSOR_FAULT ) r++; \r\n  }\r\n  return r;\r\n}\r\n#endif\r\n\r\n/*\r\n** This routine sets the state to CURSOR_FAULT and the error\r\n** code to errCode for every cursor on BtShared that pBtree\r\n** references.\r\n**\r\n** Every cursor is tripped, including cursors that belong\r\n** to other database connections that happen to be sharing\r\n** the cache with pBtree.\r\n**\r\n** This routine gets called when a rollback occurs.\r\n** All cursors using the same cache must be tripped\r\n** to prevent them from trying to use the btree after\r\n** the rollback.  The rollback may have deleted tables\r\n** or moved root pages, so it is not sufficient to\r\n** save the state of the cursor.  The cursor must be\r\n** invalidated.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){\r\n  BtCursor *p;\r\n  if( pBtree==0 ) return;\r\n  sqlite3BtreeEnter(pBtree);\r\n  for(p=pBtree->pBt->pCursor; p; p=p->pNext){\r\n    int i;\r\n    sqlite3BtreeClearCursor(p);\r\n    p->eState = CURSOR_FAULT;\r\n    p->skipNext = errCode;\r\n    for(i=0; i<=p->iPage; i++){\r\n      releasePage(p->apPage[i]);\r\n      p->apPage[i] = 0;\r\n    }\r\n  }\r\n  sqlite3BtreeLeave(pBtree);\r\n}\r\n\r\n/*\r\n** Rollback the transaction in progress.  All cursors will be\r\n** invalided by this operation.  Any attempt to use a cursor\r\n** that was open at the beginning of this operation will result\r\n** in an error.\r\n**\r\n** This will release the write lock on the database file.  If there\r\n** are no active cursors, it also releases the read lock.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode){\r\n  int rc;\r\n  BtShared *pBt = p->pBt;\r\n  MemPage *pPage1;\r\n\r\n  sqlite3BtreeEnter(p);\r\n  if( tripCode==SQLITE_OK ){\r\n    rc = tripCode = saveAllCursors(pBt, 0, 0);\r\n  }else{\r\n    rc = SQLITE_OK;\r\n  }\r\n  if( tripCode ){\r\n    sqlite3BtreeTripAllCursors(p, tripCode);\r\n  }\r\n  btreeIntegrity(p);\r\n\r\n  if( p->inTrans==TRANS_WRITE ){\r\n    int rc2;\r\n\r\n    assert( TRANS_WRITE==pBt->inTransaction );\r\n    rc2 = sqlite3PagerRollback(pBt->pPager);\r\n    if( rc2!=SQLITE_OK ){\r\n      rc = rc2;\r\n    }\r\n\r\n    /* The rollback may have destroyed the pPage1->aData value.  So\r\n    ** call btreeGetPage() on page 1 again to make\r\n    ** sure pPage1->aData is set correctly. */\r\n    if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){\r\n      int nPage = get4byte(28+(u8*)pPage1->aData);\r\n      testcase( nPage==0 );\r\n      if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);\r\n      testcase( pBt->nPage!=nPage );\r\n      pBt->nPage = nPage;\r\n      releasePage(pPage1);\r\n    }\r\n    assert( countWriteCursors(pBt)==0 );\r\n    pBt->inTransaction = TRANS_READ;\r\n  }\r\n\r\n  btreeEndTransaction(p);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Start a statement subtransaction. The subtransaction can can be rolled\r\n** back independently of the main transaction. You must start a transaction \r\n** before starting a subtransaction. The subtransaction is ended automatically \r\n** if the main transaction commits or rolls back.\r\n**\r\n** Statement subtransactions are used around individual SQL statements\r\n** that are contained within a BEGIN...COMMIT block.  If a constraint\r\n** error occurs within the statement, the effect of that one statement\r\n** can be rolled back without having to rollback the entire transaction.\r\n**\r\n** A statement sub-transaction is implemented as an anonymous savepoint. The\r\n** value passed as the second parameter is the total number of savepoints,\r\n** including the new anonymous savepoint, open on the B-Tree. i.e. if there\r\n** are no active savepoints and no other statement-transactions open,\r\n** iStatement is 1. This anonymous savepoint can be released or rolled back\r\n** using the sqlite3BtreeSavepoint() function.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){\r\n  int rc;\r\n  BtShared *pBt = p->pBt;\r\n  sqlite3BtreeEnter(p);\r\n  assert( p->inTrans==TRANS_WRITE );\r\n  assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );\r\n  assert( iStatement>0 );\r\n  assert( iStatement>p->db->nSavepoint );\r\n  assert( pBt->inTransaction==TRANS_WRITE );\r\n  /* At the pager level, a statement transaction is a savepoint with\r\n  ** an index greater than all savepoints created explicitly using\r\n  ** SQL statements. It is illegal to open, release or rollback any\r\n  ** such savepoints while the statement transaction savepoint is active.\r\n  */\r\n  rc = sqlite3PagerOpenSavepoint(pBt->pPager, iStatement);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The second argument to this function, op, is always SAVEPOINT_ROLLBACK\r\n** or SAVEPOINT_RELEASE. This function either releases or rolls back the\r\n** savepoint identified by parameter iSavepoint, depending on the value \r\n** of op.\r\n**\r\n** Normally, iSavepoint is greater than or equal to zero. However, if op is\r\n** SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the \r\n** contents of the entire transaction are rolled back. This is different\r\n** from a normal transaction rollback, as no locks are released and the\r\n** transaction remains open.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){\r\n  int rc = SQLITE_OK;\r\n  if( p && p->inTrans==TRANS_WRITE ){\r\n    BtShared *pBt = p->pBt;\r\n    assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );\r\n    assert( iSavepoint>=0 || (iSavepoint==-1 && op==SAVEPOINT_ROLLBACK) );\r\n    sqlite3BtreeEnter(p);\r\n    rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint);\r\n    if( rc==SQLITE_OK ){\r\n      if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){\r\n        pBt->nPage = 0;\r\n      }\r\n      rc = newDatabase(pBt);\r\n      pBt->nPage = get4byte(28 + pBt->pPage1->aData);\r\n\r\n      /* The database size was written into the offset 28 of the header\r\n      ** when the transaction started, so we know that the value at offset\r\n      ** 28 is nonzero. */\r\n      assert( pBt->nPage>0 );\r\n    }\r\n    sqlite3BtreeLeave(p);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Create a new cursor for the BTree whose root is on the page\r\n** iTable. If a read-only cursor is requested, it is assumed that\r\n** the caller already has at least a read-only transaction open\r\n** on the database already. If a write-cursor is requested, then\r\n** the caller is assumed to have an open write transaction.\r\n**\r\n** If wrFlag==0, then the cursor can only be used for reading.\r\n** If wrFlag==1, then the cursor can be used for reading or for\r\n** writing if other conditions for writing are also met.  These\r\n** are the conditions that must be met in order for writing to\r\n** be allowed:\r\n**\r\n** 1:  The cursor must have been opened with wrFlag==1\r\n**\r\n** 2:  Other database connections that share the same pager cache\r\n**     but which are not in the READ_UNCOMMITTED state may not have\r\n**     cursors open with wrFlag==0 on the same table.  Otherwise\r\n**     the changes made by this write cursor would be visible to\r\n**     the read cursors in the other database connection.\r\n**\r\n** 3:  The database must be writable (not on read-only media)\r\n**\r\n** 4:  There must be an active transaction.\r\n**\r\n** No checking is done to make sure that page iTable really is the\r\n** root page of a b-tree.  If it is not, then the cursor acquired\r\n** will not work correctly.\r\n**\r\n** It is assumed that the sqlite3BtreeCursorZero() has been called\r\n** on pCur to initialize the memory space prior to invoking this routine.\r\n*/\r\nstatic int btreeCursor(\r\n  Btree *p,                              /* The btree */\r\n  int iTable,                            /* Root page of table to open */\r\n  int wrFlag,                            /* 1 to write. 0 read-only */\r\n  struct KeyInfo *pKeyInfo,              /* First arg to comparison function */\r\n  BtCursor *pCur                         /* Space for new cursor */\r\n){\r\n  BtShared *pBt = p->pBt;                /* Shared b-tree handle */\r\n\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( wrFlag==0 || wrFlag==1 );\r\n\r\n  /* The following assert statements verify that if this is a sharable \r\n  ** b-tree database, the connection is holding the required table locks, \r\n  ** and that no other connection has any open cursor that conflicts with \r\n  ** this lock.  */\r\n  assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, wrFlag+1) );\r\n  assert( wrFlag==0 || !hasReadConflicts(p, iTable) );\r\n\r\n  /* Assert that the caller has opened the required transaction. */\r\n  assert( p->inTrans>TRANS_NONE );\r\n  assert( wrFlag==0 || p->inTrans==TRANS_WRITE );\r\n  assert( pBt->pPage1 && pBt->pPage1->aData );\r\n\r\n  if( NEVER(wrFlag && (pBt->btsFlags & BTS_READ_ONLY)!=0) ){\r\n    return SQLITE_READONLY;\r\n  }\r\n  if( iTable==1 && btreePagecount(pBt)==0 ){\r\n    assert( wrFlag==0 );\r\n    iTable = 0;\r\n  }\r\n\r\n  /* Now that no other errors can occur, finish filling in the BtCursor\r\n  ** variables and link the cursor into the BtShared list.  */\r\n  pCur->pgnoRoot = (Pgno)iTable;\r\n  pCur->iPage = -1;\r\n  pCur->pKeyInfo = pKeyInfo;\r\n  pCur->pBtree = p;\r\n  pCur->pBt = pBt;\r\n  pCur->wrFlag = (u8)wrFlag;\r\n  pCur->pNext = pBt->pCursor;\r\n  if( pCur->pNext ){\r\n    pCur->pNext->pPrev = pCur;\r\n  }\r\n  pBt->pCursor = pCur;\r\n  pCur->eState = CURSOR_INVALID;\r\n  pCur->cachedRowid = 0;\r\n  return SQLITE_OK;\r\n}\r\nSQLITE_PRIVATE int sqlite3BtreeCursor(\r\n  Btree *p,                                   /* The btree */\r\n  int iTable,                                 /* Root page of table to open */\r\n  int wrFlag,                                 /* 1 to write. 0 read-only */\r\n  struct KeyInfo *pKeyInfo,                   /* First arg to xCompare() */\r\n  BtCursor *pCur                              /* Write new cursor here */\r\n){\r\n  int rc;\r\n  sqlite3BtreeEnter(p);\r\n  rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the size of a BtCursor object in bytes.\r\n**\r\n** This interfaces is needed so that users of cursors can preallocate\r\n** sufficient storage to hold a cursor.  The BtCursor object is opaque\r\n** to users so they cannot do the sizeof() themselves - they must call\r\n** this routine.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCursorSize(void){\r\n  return ROUND8(sizeof(BtCursor));\r\n}\r\n\r\n/*\r\n** Initialize memory that will be converted into a BtCursor object.\r\n**\r\n** The simple approach here would be to memset() the entire object\r\n** to zero.  But it turns out that the apPage[] and aiIdx[] arrays\r\n** do not need to be zeroed and they are large, so we can save a lot\r\n** of run-time by skipping the initialization of those elements.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){\r\n  memset(p, 0, offsetof(BtCursor, iPage));\r\n}\r\n\r\n/*\r\n** Set the cached rowid value of every cursor in the same database file\r\n** as pCur and having the same root page number as pCur.  The value is\r\n** set to iRowid.\r\n**\r\n** Only positive rowid values are considered valid for this cache.\r\n** The cache is initialized to zero, indicating an invalid cache.\r\n** A btree will work fine with zero or negative rowids.  We just cannot\r\n** cache zero or negative rowids, which means tables that use zero or\r\n** negative rowids might run a little slower.  But in practice, zero\r\n** or negative rowids are very uncommon so this should not be a problem.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeSetCachedRowid(BtCursor *pCur, sqlite3_int64 iRowid){\r\n  BtCursor *p;\r\n  for(p=pCur->pBt->pCursor; p; p=p->pNext){\r\n    if( p->pgnoRoot==pCur->pgnoRoot ) p->cachedRowid = iRowid;\r\n  }\r\n  assert( pCur->cachedRowid==iRowid );\r\n}\r\n\r\n/*\r\n** Return the cached rowid for the given cursor.  A negative or zero\r\n** return value indicates that the rowid cache is invalid and should be\r\n** ignored.  If the rowid cache has never before been set, then a\r\n** zero is returned.\r\n*/\r\nSQLITE_PRIVATE sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor *pCur){\r\n  return pCur->cachedRowid;\r\n}\r\n\r\n/*\r\n** Close a cursor.  The read lock on the database file is released\r\n** when the last cursor is closed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){\r\n  Btree *pBtree = pCur->pBtree;\r\n  if( pBtree ){\r\n    int i;\r\n    BtShared *pBt = pCur->pBt;\r\n    sqlite3BtreeEnter(pBtree);\r\n    sqlite3BtreeClearCursor(pCur);\r\n    if( pCur->pPrev ){\r\n      pCur->pPrev->pNext = pCur->pNext;\r\n    }else{\r\n      pBt->pCursor = pCur->pNext;\r\n    }\r\n    if( pCur->pNext ){\r\n      pCur->pNext->pPrev = pCur->pPrev;\r\n    }\r\n    for(i=0; i<=pCur->iPage; i++){\r\n      releasePage(pCur->apPage[i]);\r\n    }\r\n    unlockBtreeIfUnused(pBt);\r\n    invalidateOverflowCache(pCur);\r\n    /* sqlite3_free(pCur); */\r\n    sqlite3BtreeLeave(pBtree);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Make sure the BtCursor* given in the argument has a valid\r\n** BtCursor.info structure.  If it is not already valid, call\r\n** btreeParseCell() to fill it in.\r\n**\r\n** BtCursor.info is a cache of the information in the current cell.\r\n** Using this cache reduces the number of calls to btreeParseCell().\r\n**\r\n** 2007-06-25:  There is a bug in some versions of MSVC that cause the\r\n** compiler to crash when getCellInfo() is implemented as a macro.\r\n** But there is a measureable speed advantage to using the macro on gcc\r\n** (when less compiler optimizations like -Os or -O0 are used and the\r\n** compiler is not doing agressive inlining.)  So we use a real function\r\n** for MSVC and a macro for everything else.  Ticket #2457.\r\n*/\r\n#ifndef NDEBUG\r\n  static void assertCellInfo(BtCursor *pCur){\r\n    CellInfo info;\r\n    int iPage = pCur->iPage;\r\n    memset(&info, 0, sizeof(info));\r\n    btreeParseCell(pCur->apPage[iPage], pCur->aiIdx[iPage], &info);\r\n    assert( memcmp(&info, &pCur->info, sizeof(info))==0 );\r\n  }\r\n#else\r\n  #define assertCellInfo(x)\r\n#endif\r\n#ifdef _MSC_VER\r\n  /* Use a real function in MSVC to work around bugs in that compiler. */\r\n  static void getCellInfo(BtCursor *pCur){\r\n    if( pCur->info.nSize==0 ){\r\n      int iPage = pCur->iPage;\r\n      btreeParseCell(pCur->apPage[iPage],pCur->aiIdx[iPage],&pCur->info);\r\n      pCur->validNKey = 1;\r\n    }else{\r\n      assertCellInfo(pCur);\r\n    }\r\n  }\r\n#else /* if not _MSC_VER */\r\n  /* Use a macro in all other compilers so that the function is inlined */\r\n#define getCellInfo(pCur)                                                      \\\r\n  if( pCur->info.nSize==0 ){                                                   \\\r\n    int iPage = pCur->iPage;                                                   \\\r\n    btreeParseCell(pCur->apPage[iPage],pCur->aiIdx[iPage],&pCur->info); \\\r\n    pCur->validNKey = 1;                                                       \\\r\n  }else{                                                                       \\\r\n    assertCellInfo(pCur);                                                      \\\r\n  }\r\n#endif /* _MSC_VER */\r\n\r\n#ifndef NDEBUG  /* The next routine used only within assert() statements */\r\n/*\r\n** Return true if the given BtCursor is valid.  A valid cursor is one\r\n** that is currently pointing to a row in a (non-empty) table.\r\n** This is a verification routine is used only within assert() statements.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor *pCur){\r\n  return pCur && pCur->eState==CURSOR_VALID;\r\n}\r\n#endif /* NDEBUG */\r\n\r\n/*\r\n** Set *pSize to the size of the buffer needed to hold the value of\r\n** the key for the current entry.  If the cursor is not pointing\r\n** to a valid entry, *pSize is set to 0. \r\n**\r\n** For a table with the INTKEY flag set, this routine returns the key\r\n** itself, not the number of bytes in the key.\r\n**\r\n** The caller must position the cursor prior to invoking this routine.\r\n** \r\n** This routine cannot fail.  It always returns SQLITE_OK.  \r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );\r\n  if( pCur->eState!=CURSOR_VALID ){\r\n    *pSize = 0;\r\n  }else{\r\n    getCellInfo(pCur);\r\n    *pSize = pCur->info.nKey;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Set *pSize to the number of bytes of data in the entry the\r\n** cursor currently points to.\r\n**\r\n** The caller must guarantee that the cursor is pointing to a non-NULL\r\n** valid entry.  In other words, the calling procedure must guarantee\r\n** that the cursor has Cursor.eState==CURSOR_VALID.\r\n**\r\n** Failure is not possible.  This function always returns SQLITE_OK.\r\n** It might just as well be a procedure (returning void) but we continue\r\n** to return an integer result code for historical reasons.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  getCellInfo(pCur);\r\n  *pSize = pCur->info.nData;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Given the page number of an overflow page in the database (parameter\r\n** ovfl), this function finds the page number of the next page in the \r\n** linked list of overflow pages. If possible, it uses the auto-vacuum\r\n** pointer-map data instead of reading the content of page ovfl to do so. \r\n**\r\n** If an error occurs an SQLite error code is returned. Otherwise:\r\n**\r\n** The page number of the next overflow page in the linked list is \r\n** written to *pPgnoNext. If page ovfl is the last page in its linked \r\n** list, *pPgnoNext is set to zero. \r\n**\r\n** If ppPage is not NULL, and a reference to the MemPage object corresponding\r\n** to page number pOvfl was obtained, then *ppPage is set to point to that\r\n** reference. It is the responsibility of the caller to call releasePage()\r\n** on *ppPage to free the reference. In no reference was obtained (because\r\n** the pointer-map was used to obtain the value for *pPgnoNext), then\r\n** *ppPage is set to zero.\r\n*/\r\nstatic int getOverflowPage(\r\n  BtShared *pBt,               /* The database file */\r\n  Pgno ovfl,                   /* Current overflow page number */\r\n  MemPage **ppPage,            /* OUT: MemPage handle (may be NULL) */\r\n  Pgno *pPgnoNext              /* OUT: Next overflow page number */\r\n){\r\n  Pgno next = 0;\r\n  MemPage *pPage = 0;\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert(pPgnoNext);\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  /* Try to find the next page in the overflow list using the\r\n  ** autovacuum pointer-map pages. Guess that the next page in \r\n  ** the overflow list is page number (ovfl+1). If that guess turns \r\n  ** out to be wrong, fall back to loading the data of page \r\n  ** number ovfl to determine the next page number.\r\n  */\r\n  if( pBt->autoVacuum ){\r\n    Pgno pgno;\r\n    Pgno iGuess = ovfl+1;\r\n    u8 eType;\r\n\r\n    while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){\r\n      iGuess++;\r\n    }\r\n\r\n    if( iGuess<=btreePagecount(pBt) ){\r\n      rc = ptrmapGet(pBt, iGuess, &eType, &pgno);\r\n      if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){\r\n        next = iGuess;\r\n        rc = SQLITE_DONE;\r\n      }\r\n    }\r\n  }\r\n#endif\r\n\r\n  assert( next==0 || rc==SQLITE_DONE );\r\n  if( rc==SQLITE_OK ){\r\n    rc = btreeGetPage(pBt, ovfl, &pPage, 0);\r\n    assert( rc==SQLITE_OK || pPage==0 );\r\n    if( rc==SQLITE_OK ){\r\n      next = get4byte(pPage->aData);\r\n    }\r\n  }\r\n\r\n  *pPgnoNext = next;\r\n  if( ppPage ){\r\n    *ppPage = pPage;\r\n  }else{\r\n    releasePage(pPage);\r\n  }\r\n  return (rc==SQLITE_DONE ? SQLITE_OK : rc);\r\n}\r\n\r\n/*\r\n** Copy data from a buffer to a page, or from a page to a buffer.\r\n**\r\n** pPayload is a pointer to data stored on database page pDbPage.\r\n** If argument eOp is false, then nByte bytes of data are copied\r\n** from pPayload to the buffer pointed at by pBuf. If eOp is true,\r\n** then sqlite3PagerWrite() is called on pDbPage and nByte bytes\r\n** of data are copied from the buffer pBuf to pPayload.\r\n**\r\n** SQLITE_OK is returned on success, otherwise an error code.\r\n*/\r\nstatic int copyPayload(\r\n  void *pPayload,           /* Pointer to page data */\r\n  void *pBuf,               /* Pointer to buffer */\r\n  int nByte,                /* Number of bytes to copy */\r\n  int eOp,                  /* 0 -> copy from page, 1 -> copy to page */\r\n  DbPage *pDbPage           /* Page containing pPayload */\r\n){\r\n  if( eOp ){\r\n    /* Copy data from buffer to page (a write operation) */\r\n    int rc = sqlite3PagerWrite(pDbPage);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    memcpy(pPayload, pBuf, nByte);\r\n  }else{\r\n    /* Copy data from page to buffer (a read operation) */\r\n    memcpy(pBuf, pPayload, nByte);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is used to read or overwrite payload information\r\n** for the entry that the pCur cursor is pointing to. If the eOp\r\n** parameter is 0, this is a read operation (data copied into\r\n** buffer pBuf). If it is non-zero, a write (data copied from\r\n** buffer pBuf).\r\n**\r\n** A total of \"amt\" bytes are read or written beginning at \"offset\".\r\n** Data is read to or from the buffer pBuf.\r\n**\r\n** The content being read or written might appear on the main page\r\n** or be scattered out on multiple overflow pages.\r\n**\r\n** If the BtCursor.isIncrblobHandle flag is set, and the current\r\n** cursor entry uses one or more overflow pages, this function\r\n** allocates space for and lazily popluates the overflow page-list \r\n** cache array (BtCursor.aOverflow). Subsequent calls use this\r\n** cache to make seeking to the supplied offset more efficient.\r\n**\r\n** Once an overflow page-list cache has been allocated, it may be\r\n** invalidated if some other cursor writes to the same table, or if\r\n** the cursor is moved to a different row. Additionally, in auto-vacuum\r\n** mode, the following events may invalidate an overflow page-list cache.\r\n**\r\n**   * An incremental vacuum,\r\n**   * A commit in auto_vacuum=\"full\" mode,\r\n**   * Creating a table (may require moving an overflow page).\r\n*/\r\nstatic int accessPayload(\r\n  BtCursor *pCur,      /* Cursor pointing to entry to read from */\r\n  u32 offset,          /* Begin reading this far into payload */\r\n  u32 amt,             /* Read this many bytes */\r\n  unsigned char *pBuf, /* Write the bytes into this buffer */ \r\n  int eOp              /* zero to read. non-zero to write. */\r\n){\r\n  unsigned char *aPayload;\r\n  int rc = SQLITE_OK;\r\n  u32 nKey;\r\n  int iIdx = 0;\r\n  MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */\r\n  BtShared *pBt = pCur->pBt;                  /* Btree this cursor belongs to */\r\n\r\n  assert( pPage );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );\r\n  assert( cursorHoldsMutex(pCur) );\r\n\r\n  getCellInfo(pCur);\r\n  aPayload = pCur->info.pCell + pCur->info.nHeader;\r\n  nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey);\r\n\r\n  if( NEVER(offset+amt > nKey+pCur->info.nData) \r\n   || &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]\r\n  ){\r\n    /* Trying to read or write past the end of the data is an error */\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n\r\n  /* Check if data must be read/written to/from the btree page itself. */\r\n  if( offset<pCur->info.nLocal ){\r\n    int a = amt;\r\n    if( a+offset>pCur->info.nLocal ){\r\n      a = pCur->info.nLocal - offset;\r\n    }\r\n    rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage);\r\n    offset = 0;\r\n    pBuf += a;\r\n    amt -= a;\r\n  }else{\r\n    offset -= pCur->info.nLocal;\r\n  }\r\n\r\n  if( rc==SQLITE_OK && amt>0 ){\r\n    const u32 ovflSize = pBt->usableSize - 4;  /* Bytes content per ovfl page */\r\n    Pgno nextPage;\r\n\r\n    nextPage = get4byte(&aPayload[pCur->info.nLocal]);\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n    /* If the isIncrblobHandle flag is set and the BtCursor.aOverflow[]\r\n    ** has not been allocated, allocate it now. The array is sized at\r\n    ** one entry for each overflow page in the overflow chain. The\r\n    ** page number of the first overflow page is stored in aOverflow[0],\r\n    ** etc. A value of 0 in the aOverflow[] array means \"not yet known\"\r\n    ** (the cache is lazily populated).\r\n    */\r\n    if( pCur->isIncrblobHandle && !pCur->aOverflow ){\r\n      int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;\r\n      pCur->aOverflow = (Pgno *)sqlite3MallocZero(sizeof(Pgno)*nOvfl);\r\n      /* nOvfl is always positive.  If it were zero, fetchPayload would have\r\n      ** been used instead of this routine. */\r\n      if( ALWAYS(nOvfl) && !pCur->aOverflow ){\r\n        rc = SQLITE_NOMEM;\r\n      }\r\n    }\r\n\r\n    /* If the overflow page-list cache has been allocated and the\r\n    ** entry for the first required overflow page is valid, skip\r\n    ** directly to it.\r\n    */\r\n    if( pCur->aOverflow && pCur->aOverflow[offset/ovflSize] ){\r\n      iIdx = (offset/ovflSize);\r\n      nextPage = pCur->aOverflow[iIdx];\r\n      offset = (offset%ovflSize);\r\n    }\r\n#endif\r\n\r\n    for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n      /* If required, populate the overflow page-list cache. */\r\n      if( pCur->aOverflow ){\r\n        assert(!pCur->aOverflow[iIdx] || pCur->aOverflow[iIdx]==nextPage);\r\n        pCur->aOverflow[iIdx] = nextPage;\r\n      }\r\n#endif\r\n\r\n      if( offset>=ovflSize ){\r\n        /* The only reason to read this page is to obtain the page\r\n        ** number for the next page in the overflow chain. The page\r\n        ** data is not required. So first try to lookup the overflow\r\n        ** page-list cache, if any, then fall back to the getOverflowPage()\r\n        ** function.\r\n        */\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n        if( pCur->aOverflow && pCur->aOverflow[iIdx+1] ){\r\n          nextPage = pCur->aOverflow[iIdx+1];\r\n        } else \r\n#endif\r\n          rc = getOverflowPage(pBt, nextPage, 0, &nextPage);\r\n        offset -= ovflSize;\r\n      }else{\r\n        /* Need to read this page properly. It contains some of the\r\n        ** range of data that is being read (eOp==0) or written (eOp!=0).\r\n        */\r\n#ifdef SQLITE_DIRECT_OVERFLOW_READ\r\n        sqlite3_file *fd;\r\n#endif\r\n        int a = amt;\r\n        if( a + offset > ovflSize ){\r\n          a = ovflSize - offset;\r\n        }\r\n\r\n#ifdef SQLITE_DIRECT_OVERFLOW_READ\r\n        /* If all the following are true:\r\n        **\r\n        **   1) this is a read operation, and \r\n        **   2) data is required from the start of this overflow page, and\r\n        **   3) the database is file-backed, and\r\n        **   4) there is no open write-transaction, and\r\n        **   5) the database is not a WAL database,\r\n        **\r\n        ** then data can be read directly from the database file into the\r\n        ** output buffer, bypassing the page-cache altogether. This speeds\r\n        ** up loading large records that span many overflow pages.\r\n        */\r\n        if( eOp==0                                             /* (1) */\r\n         && offset==0                                          /* (2) */\r\n         && pBt->inTransaction==TRANS_READ                     /* (4) */\r\n         && (fd = sqlite3PagerFile(pBt->pPager))->pMethods     /* (3) */\r\n         && pBt->pPage1->aData[19]==0x01                       /* (5) */\r\n        ){\r\n          u8 aSave[4];\r\n          u8 *aWrite = &pBuf[-4];\r\n          memcpy(aSave, aWrite, 4);\r\n          rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));\r\n          nextPage = get4byte(aWrite);\r\n          memcpy(aWrite, aSave, 4);\r\n        }else\r\n#endif\r\n\r\n        {\r\n          DbPage *pDbPage;\r\n          rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage);\r\n          if( rc==SQLITE_OK ){\r\n            aPayload = sqlite3PagerGetData(pDbPage);\r\n            nextPage = get4byte(aPayload);\r\n            rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage);\r\n            sqlite3PagerUnref(pDbPage);\r\n            offset = 0;\r\n          }\r\n        }\r\n        amt -= a;\r\n        pBuf += a;\r\n      }\r\n    }\r\n  }\r\n\r\n  if( rc==SQLITE_OK && amt>0 ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Read part of the key associated with cursor pCur.  Exactly\r\n** \"amt\" bytes will be transfered into pBuf[].  The transfer\r\n** begins at \"offset\".\r\n**\r\n** The caller must ensure that pCur is pointing to a valid row\r\n** in the table.\r\n**\r\n** Return SQLITE_OK on success or an error code if anything goes\r\n** wrong.  An error is returned if \"offset+amt\" is larger than\r\n** the available payload.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] );\r\n  assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\r\n  return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);\r\n}\r\n\r\n/*\r\n** Read part of the data associated with cursor pCur.  Exactly\r\n** \"amt\" bytes will be transfered into pBuf[].  The transfer\r\n** begins at \"offset\".\r\n**\r\n** Return SQLITE_OK on success or an error code if anything goes\r\n** wrong.  An error is returned if \"offset+amt\" is larger than\r\n** the available payload.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeData(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){\r\n  int rc;\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n  if ( pCur->eState==CURSOR_INVALID ){\r\n    return SQLITE_ABORT;\r\n  }\r\n#endif\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  rc = restoreCursorPosition(pCur);\r\n  if( rc==SQLITE_OK ){\r\n    assert( pCur->eState==CURSOR_VALID );\r\n    assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] );\r\n    assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\r\n    rc = accessPayload(pCur, offset, amt, pBuf, 0);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return a pointer to payload information from the entry that the \r\n** pCur cursor is pointing to.  The pointer is to the beginning of\r\n** the key if skipKey==0 and it points to the beginning of data if\r\n** skipKey==1.  The number of bytes of available key/data is written\r\n** into *pAmt.  If *pAmt==0, then the value returned will not be\r\n** a valid pointer.\r\n**\r\n** This routine is an optimization.  It is common for the entire key\r\n** and data to fit on the local page and for there to be no overflow\r\n** pages.  When that is so, this routine can be used to access the\r\n** key and data without making a copy.  If the key and/or data spills\r\n** onto overflow pages, then accessPayload() must be used to reassemble\r\n** the key/data and copy it into a preallocated buffer.\r\n**\r\n** The pointer returned by this routine looks directly into the cached\r\n** page of the database.  The data might change or move the next time\r\n** any btree routine is called.\r\n*/\r\nstatic const unsigned char *fetchPayload(\r\n  BtCursor *pCur,      /* Cursor pointing to entry to read from */\r\n  int *pAmt,           /* Write the number of available bytes here */\r\n  int skipKey          /* read beginning at data if this is true */\r\n){\r\n  unsigned char *aPayload;\r\n  MemPage *pPage;\r\n  u32 nKey;\r\n  u32 nLocal;\r\n\r\n  assert( pCur!=0 && pCur->iPage>=0 && pCur->apPage[pCur->iPage]);\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  assert( cursorHoldsMutex(pCur) );\r\n  pPage = pCur->apPage[pCur->iPage];\r\n  assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );\r\n  if( NEVER(pCur->info.nSize==0) ){\r\n    btreeParseCell(pCur->apPage[pCur->iPage], pCur->aiIdx[pCur->iPage],\r\n                   &pCur->info);\r\n  }\r\n  aPayload = pCur->info.pCell;\r\n  aPayload += pCur->info.nHeader;\r\n  if( pPage->intKey ){\r\n    nKey = 0;\r\n  }else{\r\n    nKey = (int)pCur->info.nKey;\r\n  }\r\n  if( skipKey ){\r\n    aPayload += nKey;\r\n    nLocal = pCur->info.nLocal - nKey;\r\n  }else{\r\n    nLocal = pCur->info.nLocal;\r\n    assert( nLocal<=nKey );\r\n  }\r\n  *pAmt = nLocal;\r\n  return aPayload;\r\n}\r\n\r\n\r\n/*\r\n** For the entry that cursor pCur is point to, return as\r\n** many bytes of the key or data as are available on the local\r\n** b-tree page.  Write the number of available bytes into *pAmt.\r\n**\r\n** The pointer returned is ephemeral.  The key/data may move\r\n** or be destroyed on the next call to any Btree routine,\r\n** including calls from other threads against the same cache.\r\n** Hence, a mutex on the BtShared should be held prior to calling\r\n** this routine.\r\n**\r\n** These routines is used to get quick access to key and data\r\n** in the common case where no overflow pages are used.\r\n*/\r\nSQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){\r\n  const void *p = 0;\r\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\r\n  assert( cursorHoldsMutex(pCur) );\r\n  if( ALWAYS(pCur->eState==CURSOR_VALID) ){\r\n    p = (const void*)fetchPayload(pCur, pAmt, 0);\r\n  }\r\n  return p;\r\n}\r\nSQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor *pCur, int *pAmt){\r\n  const void *p = 0;\r\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\r\n  assert( cursorHoldsMutex(pCur) );\r\n  if( ALWAYS(pCur->eState==CURSOR_VALID) ){\r\n    p = (const void*)fetchPayload(pCur, pAmt, 1);\r\n  }\r\n  return p;\r\n}\r\n\r\n\r\n/*\r\n** Move the cursor down to a new child page.  The newPgno argument is the\r\n** page number of the child page to move to.\r\n**\r\n** This function returns SQLITE_CORRUPT if the page-header flags field of\r\n** the new child page does not match the flags field of the parent (i.e.\r\n** if an intkey page appears to be the parent of a non-intkey page, or\r\n** vice-versa).\r\n*/\r\nstatic int moveToChild(BtCursor *pCur, u32 newPgno){\r\n  int rc;\r\n  int i = pCur->iPage;\r\n  MemPage *pNewPage;\r\n  BtShared *pBt = pCur->pBt;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  assert( pCur->iPage<BTCURSOR_MAX_DEPTH );\r\n  if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  rc = getAndInitPage(pBt, newPgno, &pNewPage);\r\n  if( rc ) return rc;\r\n  pCur->apPage[i+1] = pNewPage;\r\n  pCur->aiIdx[i+1] = 0;\r\n  pCur->iPage++;\r\n\r\n  pCur->info.nSize = 0;\r\n  pCur->validNKey = 0;\r\n  if( pNewPage->nCell<1 || pNewPage->intKey!=pCur->apPage[i]->intKey ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n#if 0\r\n/*\r\n** Page pParent is an internal (non-leaf) tree page. This function \r\n** asserts that page number iChild is the left-child if the iIdx'th\r\n** cell in page pParent. Or, if iIdx is equal to the total number of\r\n** cells in pParent, that page number iChild is the right-child of\r\n** the page.\r\n*/\r\nstatic void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){\r\n  assert( iIdx<=pParent->nCell );\r\n  if( iIdx==pParent->nCell ){\r\n    assert( get4byte(&pParent->aData[pParent->hdrOffset+8])==iChild );\r\n  }else{\r\n    assert( get4byte(findCell(pParent, iIdx))==iChild );\r\n  }\r\n}\r\n#else\r\n#  define assertParentIndex(x,y,z) \r\n#endif\r\n\r\n/*\r\n** Move the cursor up to the parent page.\r\n**\r\n** pCur->idx is set to the cell index that contains the pointer\r\n** to the page we are coming from.  If we are coming from the\r\n** right-most child page then pCur->idx is set to one more than\r\n** the largest cell index.\r\n*/\r\nstatic void moveToParent(BtCursor *pCur){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  assert( pCur->iPage>0 );\r\n  assert( pCur->apPage[pCur->iPage] );\r\n\r\n  /* UPDATE: It is actually possible for the condition tested by the assert\r\n  ** below to be untrue if the database file is corrupt. This can occur if\r\n  ** one cursor has modified page pParent while a reference to it is held \r\n  ** by a second cursor. Which can only happen if a single page is linked\r\n  ** into more than one b-tree structure in a corrupt database.  */\r\n#if 0\r\n  assertParentIndex(\r\n    pCur->apPage[pCur->iPage-1], \r\n    pCur->aiIdx[pCur->iPage-1], \r\n    pCur->apPage[pCur->iPage]->pgno\r\n  );\r\n#endif\r\n  testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell );\r\n\r\n  releasePage(pCur->apPage[pCur->iPage]);\r\n  pCur->iPage--;\r\n  pCur->info.nSize = 0;\r\n  pCur->validNKey = 0;\r\n}\r\n\r\n/*\r\n** Move the cursor to point to the root page of its b-tree structure.\r\n**\r\n** If the table has a virtual root page, then the cursor is moved to point\r\n** to the virtual root page instead of the actual root page. A table has a\r\n** virtual root page when the actual root page contains no cells and a \r\n** single child page. This can only happen with the table rooted at page 1.\r\n**\r\n** If the b-tree structure is empty, the cursor state is set to \r\n** CURSOR_INVALID. Otherwise, the cursor is set to point to the first\r\n** cell located on the root (or virtual root) page and the cursor state\r\n** is set to CURSOR_VALID.\r\n**\r\n** If this function returns successfully, it may be assumed that the\r\n** page-header flags indicate that the [virtual] root-page is the expected \r\n** kind of b-tree page (i.e. if when opening the cursor the caller did not\r\n** specify a KeyInfo structure the flags byte is set to 0x05 or 0x0D,\r\n** indicating a table b-tree, or if the caller did specify a KeyInfo \r\n** structure the flags byte is set to 0x02 or 0x0A, indicating an index\r\n** b-tree).\r\n*/\r\nstatic int moveToRoot(BtCursor *pCur){\r\n  MemPage *pRoot;\r\n  int rc = SQLITE_OK;\r\n  Btree *p = pCur->pBtree;\r\n  BtShared *pBt = p->pBt;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );\r\n  assert( CURSOR_VALID   < CURSOR_REQUIRESEEK );\r\n  assert( CURSOR_FAULT   > CURSOR_REQUIRESEEK );\r\n  if( pCur->eState>=CURSOR_REQUIRESEEK ){\r\n    if( pCur->eState==CURSOR_FAULT ){\r\n      assert( pCur->skipNext!=SQLITE_OK );\r\n      return pCur->skipNext;\r\n    }\r\n    sqlite3BtreeClearCursor(pCur);\r\n  }\r\n\r\n  if( pCur->iPage>=0 ){\r\n    int i;\r\n    for(i=1; i<=pCur->iPage; i++){\r\n      releasePage(pCur->apPage[i]);\r\n    }\r\n    pCur->iPage = 0;\r\n  }else if( pCur->pgnoRoot==0 ){\r\n    pCur->eState = CURSOR_INVALID;\r\n    return SQLITE_OK;\r\n  }else{\r\n    rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0]);\r\n    if( rc!=SQLITE_OK ){\r\n      pCur->eState = CURSOR_INVALID;\r\n      return rc;\r\n    }\r\n    pCur->iPage = 0;\r\n\r\n    /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor\r\n    ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is\r\n    ** NULL, the caller expects a table b-tree. If this is not the case,\r\n    ** return an SQLITE_CORRUPT error.  */\r\n    assert( pCur->apPage[0]->intKey==1 || pCur->apPage[0]->intKey==0 );\r\n    if( (pCur->pKeyInfo==0)!=pCur->apPage[0]->intKey ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n  }\r\n\r\n  /* Assert that the root page is of the correct type. This must be the\r\n  ** case as the call to this function that loaded the root-page (either\r\n  ** this call or a previous invocation) would have detected corruption \r\n  ** if the assumption were not true, and it is not possible for the flags \r\n  ** byte to have been modified while this cursor is holding a reference\r\n  ** to the page.  */\r\n  pRoot = pCur->apPage[0];\r\n  assert( pRoot->pgno==pCur->pgnoRoot );\r\n  assert( pRoot->isInit && (pCur->pKeyInfo==0)==pRoot->intKey );\r\n\r\n  pCur->aiIdx[0] = 0;\r\n  pCur->info.nSize = 0;\r\n  pCur->atLast = 0;\r\n  pCur->validNKey = 0;\r\n\r\n  if( pRoot->nCell==0 && !pRoot->leaf ){\r\n    Pgno subpage;\r\n    if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;\r\n    subpage = get4byte(&pRoot->aData[pRoot->hdrOffset+8]);\r\n    pCur->eState = CURSOR_VALID;\r\n    rc = moveToChild(pCur, subpage);\r\n  }else{\r\n    pCur->eState = ((pRoot->nCell>0)?CURSOR_VALID:CURSOR_INVALID);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Move the cursor down to the left-most leaf entry beneath the\r\n** entry to which it is currently pointing.\r\n**\r\n** The left-most leaf is the one with the smallest key - the first\r\n** in ascending order.\r\n*/\r\nstatic int moveToLeftmost(BtCursor *pCur){\r\n  Pgno pgno;\r\n  int rc = SQLITE_OK;\r\n  MemPage *pPage;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){\r\n    assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );\r\n    pgno = get4byte(findCell(pPage, pCur->aiIdx[pCur->iPage]));\r\n    rc = moveToChild(pCur, pgno);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Move the cursor down to the right-most leaf entry beneath the\r\n** page to which it is currently pointing.  Notice the difference\r\n** between moveToLeftmost() and moveToRightmost().  moveToLeftmost()\r\n** finds the left-most entry beneath the *entry* whereas moveToRightmost()\r\n** finds the right-most entry beneath the *page*.\r\n**\r\n** The right-most entry is the one with the largest key - the last\r\n** key in ascending order.\r\n*/\r\nstatic int moveToRightmost(BtCursor *pCur){\r\n  Pgno pgno;\r\n  int rc = SQLITE_OK;\r\n  MemPage *pPage = 0;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->eState==CURSOR_VALID );\r\n  while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){\r\n    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);\r\n    pCur->aiIdx[pCur->iPage] = pPage->nCell;\r\n    rc = moveToChild(pCur, pgno);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    pCur->aiIdx[pCur->iPage] = pPage->nCell-1;\r\n    pCur->info.nSize = 0;\r\n    pCur->validNKey = 0;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* Move the cursor to the first entry in the table.  Return SQLITE_OK\r\n** on success.  Set *pRes to 0 if the cursor actually points to something\r\n** or set *pRes to 1 if the table is empty.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){\r\n  int rc;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\r\n  rc = moveToRoot(pCur);\r\n  if( rc==SQLITE_OK ){\r\n    if( pCur->eState==CURSOR_INVALID ){\r\n      assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );\r\n      *pRes = 1;\r\n    }else{\r\n      assert( pCur->apPage[pCur->iPage]->nCell>0 );\r\n      *pRes = 0;\r\n      rc = moveToLeftmost(pCur);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* Move the cursor to the last entry in the table.  Return SQLITE_OK\r\n** on success.  Set *pRes to 0 if the cursor actually points to something\r\n** or set *pRes to 1 if the table is empty.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){\r\n  int rc;\r\n \r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\r\n\r\n  /* If the cursor already points to the last entry, this is a no-op. */\r\n  if( CURSOR_VALID==pCur->eState && pCur->atLast ){\r\n#ifdef SQLITE_DEBUG\r\n    /* This block serves to assert() that the cursor really does point \r\n    ** to the last entry in the b-tree. */\r\n    int ii;\r\n    for(ii=0; ii<pCur->iPage; ii++){\r\n      assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );\r\n    }\r\n    assert( pCur->aiIdx[pCur->iPage]==pCur->apPage[pCur->iPage]->nCell-1 );\r\n    assert( pCur->apPage[pCur->iPage]->leaf );\r\n#endif\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  rc = moveToRoot(pCur);\r\n  if( rc==SQLITE_OK ){\r\n    if( CURSOR_INVALID==pCur->eState ){\r\n      assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );\r\n      *pRes = 1;\r\n    }else{\r\n      assert( pCur->eState==CURSOR_VALID );\r\n      *pRes = 0;\r\n      rc = moveToRightmost(pCur);\r\n      pCur->atLast = rc==SQLITE_OK ?1:0;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* Move the cursor so that it points to an entry near the key \r\n** specified by pIdxKey or intKey.   Return a success code.\r\n**\r\n** For INTKEY tables, the intKey parameter is used.  pIdxKey \r\n** must be NULL.  For index tables, pIdxKey is used and intKey\r\n** is ignored.\r\n**\r\n** If an exact match is not found, then the cursor is always\r\n** left pointing at a leaf page which would hold the entry if it\r\n** were present.  The cursor might point to an entry that comes\r\n** before or after the key.\r\n**\r\n** An integer is written into *pRes which is the result of\r\n** comparing the key with the entry to which the cursor is \r\n** pointing.  The meaning of the integer written into\r\n** *pRes is as follows:\r\n**\r\n**     *pRes<0      The cursor is left pointing at an entry that\r\n**                  is smaller than intKey/pIdxKey or if the table is empty\r\n**                  and the cursor is therefore left point to nothing.\r\n**\r\n**     *pRes==0     The cursor is left pointing at an entry that\r\n**                  exactly matches intKey/pIdxKey.\r\n**\r\n**     *pRes>0      The cursor is left pointing at an entry that\r\n**                  is larger than intKey/pIdxKey.\r\n**\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(\r\n  BtCursor *pCur,          /* The cursor to be moved */\r\n  UnpackedRecord *pIdxKey, /* Unpacked index key */\r\n  i64 intKey,              /* The table key */\r\n  int biasRight,           /* If true, bias the search to the high end */\r\n  int *pRes                /* Write search results here */\r\n){\r\n  int rc;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\r\n  assert( pRes );\r\n  assert( (pIdxKey==0)==(pCur->pKeyInfo==0) );\r\n\r\n  /* If the cursor is already positioned at the point we are trying\r\n  ** to move to, then just return without doing any work */\r\n  if( pCur->eState==CURSOR_VALID && pCur->validNKey \r\n   && pCur->apPage[0]->intKey \r\n  ){\r\n    if( pCur->info.nKey==intKey ){\r\n      *pRes = 0;\r\n      return SQLITE_OK;\r\n    }\r\n    if( pCur->atLast && pCur->info.nKey<intKey ){\r\n      *pRes = -1;\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n\r\n  rc = moveToRoot(pCur);\r\n  if( rc ){\r\n    return rc;\r\n  }\r\n  assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage] );\r\n  assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->isInit );\r\n  assert( pCur->eState==CURSOR_INVALID || pCur->apPage[pCur->iPage]->nCell>0 );\r\n  if( pCur->eState==CURSOR_INVALID ){\r\n    *pRes = -1;\r\n    assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );\r\n    return SQLITE_OK;\r\n  }\r\n  assert( pCur->apPage[0]->intKey || pIdxKey );\r\n  for(;;){\r\n    int lwr, upr, idx;\r\n    Pgno chldPg;\r\n    MemPage *pPage = pCur->apPage[pCur->iPage];\r\n    int c;\r\n\r\n    /* pPage->nCell must be greater than zero. If this is the root-page\r\n    ** the cursor would have been INVALID above and this for(;;) loop\r\n    ** not run. If this is not the root-page, then the moveToChild() routine\r\n    ** would have already detected db corruption. Similarly, pPage must\r\n    ** be the right kind (index or table) of b-tree page. Otherwise\r\n    ** a moveToChild() or moveToRoot() call would have detected corruption.  */\r\n    assert( pPage->nCell>0 );\r\n    assert( pPage->intKey==(pIdxKey==0) );\r\n    lwr = 0;\r\n    upr = pPage->nCell-1;\r\n    if( biasRight ){\r\n      pCur->aiIdx[pCur->iPage] = (u16)(idx = upr);\r\n    }else{\r\n      pCur->aiIdx[pCur->iPage] = (u16)(idx = (upr+lwr)/2);\r\n    }\r\n    for(;;){\r\n      u8 *pCell;                          /* Pointer to current cell in pPage */\r\n\r\n      assert( idx==pCur->aiIdx[pCur->iPage] );\r\n      pCur->info.nSize = 0;\r\n      pCell = findCell(pPage, idx) + pPage->childPtrSize;\r\n      if( pPage->intKey ){\r\n        i64 nCellKey;\r\n        if( pPage->hasData ){\r\n          u32 dummy;\r\n          pCell += getVarint32(pCell, dummy);\r\n        }\r\n        getVarint(pCell, (u64*)&nCellKey);\r\n        if( nCellKey==intKey ){\r\n          c = 0;\r\n        }else if( nCellKey<intKey ){\r\n          c = -1;\r\n        }else{\r\n          assert( nCellKey>intKey );\r\n          c = +1;\r\n        }\r\n        pCur->validNKey = 1;\r\n        pCur->info.nKey = nCellKey;\r\n      }else{\r\n        /* The maximum supported page-size is 65536 bytes. This means that\r\n        ** the maximum number of record bytes stored on an index B-Tree\r\n        ** page is less than 16384 bytes and may be stored as a 2-byte\r\n        ** varint. This information is used to attempt to avoid parsing \r\n        ** the entire cell by checking for the cases where the record is \r\n        ** stored entirely within the b-tree page by inspecting the first \r\n        ** 2 bytes of the cell.\r\n        */\r\n        int nCell = pCell[0];\r\n        if( nCell<=pPage->max1bytePayload\r\n         /* && (pCell+nCell)<pPage->aDataEnd */\r\n        ){\r\n          /* This branch runs if the record-size field of the cell is a\r\n          ** single byte varint and the record fits entirely on the main\r\n          ** b-tree page.  */\r\n          testcase( pCell+nCell+1==pPage->aDataEnd );\r\n          c = sqlite3VdbeRecordCompare(nCell, (void*)&pCell[1], pIdxKey);\r\n        }else if( !(pCell[1] & 0x80) \r\n          && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal\r\n          /* && (pCell+nCell+2)<=pPage->aDataEnd */\r\n        ){\r\n          /* The record-size field is a 2 byte varint and the record \r\n          ** fits entirely on the main b-tree page.  */\r\n          testcase( pCell+nCell+2==pPage->aDataEnd );\r\n          c = sqlite3VdbeRecordCompare(nCell, (void*)&pCell[2], pIdxKey);\r\n        }else{\r\n          /* The record flows over onto one or more overflow pages. In\r\n          ** this case the whole cell needs to be parsed, a buffer allocated\r\n          ** and accessPayload() used to retrieve the record into the\r\n          ** buffer before VdbeRecordCompare() can be called. */\r\n          void *pCellKey;\r\n          u8 * const pCellBody = pCell - pPage->childPtrSize;\r\n          btreeParseCellPtr(pPage, pCellBody, &pCur->info);\r\n          nCell = (int)pCur->info.nKey;\r\n          pCellKey = sqlite3Malloc( nCell );\r\n          if( pCellKey==0 ){\r\n            rc = SQLITE_NOMEM;\r\n            goto moveto_finish;\r\n          }\r\n          rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0);\r\n          if( rc ){\r\n            sqlite3_free(pCellKey);\r\n            goto moveto_finish;\r\n          }\r\n          c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey);\r\n          sqlite3_free(pCellKey);\r\n        }\r\n      }\r\n      if( c==0 ){\r\n        if( pPage->intKey && !pPage->leaf ){\r\n          lwr = idx;\r\n          break;\r\n        }else{\r\n          *pRes = 0;\r\n          rc = SQLITE_OK;\r\n          goto moveto_finish;\r\n        }\r\n      }\r\n      if( c<0 ){\r\n        lwr = idx+1;\r\n      }else{\r\n        upr = idx-1;\r\n      }\r\n      if( lwr>upr ){\r\n        break;\r\n      }\r\n      pCur->aiIdx[pCur->iPage] = (u16)(idx = (lwr+upr)/2);\r\n    }\r\n    assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );\r\n    assert( pPage->isInit );\r\n    if( pPage->leaf ){\r\n      chldPg = 0;\r\n    }else if( lwr>=pPage->nCell ){\r\n      chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]);\r\n    }else{\r\n      chldPg = get4byte(findCell(pPage, lwr));\r\n    }\r\n    if( chldPg==0 ){\r\n      assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\r\n      *pRes = c;\r\n      rc = SQLITE_OK;\r\n      goto moveto_finish;\r\n    }\r\n    pCur->aiIdx[pCur->iPage] = (u16)lwr;\r\n    pCur->info.nSize = 0;\r\n    pCur->validNKey = 0;\r\n    rc = moveToChild(pCur, chldPg);\r\n    if( rc ) goto moveto_finish;\r\n  }\r\nmoveto_finish:\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Return TRUE if the cursor is not pointing at an entry of the table.\r\n**\r\n** TRUE will be returned after a call to sqlite3BtreeNext() moves\r\n** past the last entry in the table or sqlite3BtreePrev() moves past\r\n** the first entry.  TRUE is also returned if the table is empty.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeEof(BtCursor *pCur){\r\n  /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries\r\n  ** have been deleted? This API will need to change to return an error code\r\n  ** as well as the boolean result value.\r\n  */\r\n  return (CURSOR_VALID!=pCur->eState);\r\n}\r\n\r\n/*\r\n** Advance the cursor to the next entry in the database.  If\r\n** successful then set *pRes=0.  If the cursor\r\n** was already pointing to the last entry in the database before\r\n** this routine was called, then set *pRes=1.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){\r\n  int rc;\r\n  int idx;\r\n  MemPage *pPage;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  rc = restoreCursorPosition(pCur);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n  assert( pRes!=0 );\r\n  if( CURSOR_INVALID==pCur->eState ){\r\n    *pRes = 1;\r\n    return SQLITE_OK;\r\n  }\r\n  if( pCur->skipNext>0 ){\r\n    pCur->skipNext = 0;\r\n    *pRes = 0;\r\n    return SQLITE_OK;\r\n  }\r\n  pCur->skipNext = 0;\r\n\r\n  pPage = pCur->apPage[pCur->iPage];\r\n  idx = ++pCur->aiIdx[pCur->iPage];\r\n  assert( pPage->isInit );\r\n\r\n  /* If the database file is corrupt, it is possible for the value of idx \r\n  ** to be invalid here. This can only occur if a second cursor modifies\r\n  ** the page while cursor pCur is holding a reference to it. Which can\r\n  ** only happen if the database is corrupt in such a way as to link the\r\n  ** page into more than one b-tree structure. */\r\n  testcase( idx>pPage->nCell );\r\n\r\n  pCur->info.nSize = 0;\r\n  pCur->validNKey = 0;\r\n  if( idx>=pPage->nCell ){\r\n    if( !pPage->leaf ){\r\n      rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));\r\n      if( rc ) return rc;\r\n      rc = moveToLeftmost(pCur);\r\n      *pRes = 0;\r\n      return rc;\r\n    }\r\n    do{\r\n      if( pCur->iPage==0 ){\r\n        *pRes = 1;\r\n        pCur->eState = CURSOR_INVALID;\r\n        return SQLITE_OK;\r\n      }\r\n      moveToParent(pCur);\r\n      pPage = pCur->apPage[pCur->iPage];\r\n    }while( pCur->aiIdx[pCur->iPage]>=pPage->nCell );\r\n    *pRes = 0;\r\n    if( pPage->intKey ){\r\n      rc = sqlite3BtreeNext(pCur, pRes);\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n    return rc;\r\n  }\r\n  *pRes = 0;\r\n  if( pPage->leaf ){\r\n    return SQLITE_OK;\r\n  }\r\n  rc = moveToLeftmost(pCur);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Step the cursor to the back to the previous entry in the database.  If\r\n** successful then set *pRes=0.  If the cursor\r\n** was already pointing to the first entry in the database before\r\n** this routine was called, then set *pRes=1.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){\r\n  int rc;\r\n  MemPage *pPage;\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  rc = restoreCursorPosition(pCur);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n  pCur->atLast = 0;\r\n  if( CURSOR_INVALID==pCur->eState ){\r\n    *pRes = 1;\r\n    return SQLITE_OK;\r\n  }\r\n  if( pCur->skipNext<0 ){\r\n    pCur->skipNext = 0;\r\n    *pRes = 0;\r\n    return SQLITE_OK;\r\n  }\r\n  pCur->skipNext = 0;\r\n\r\n  pPage = pCur->apPage[pCur->iPage];\r\n  assert( pPage->isInit );\r\n  if( !pPage->leaf ){\r\n    int idx = pCur->aiIdx[pCur->iPage];\r\n    rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));\r\n    if( rc ){\r\n      return rc;\r\n    }\r\n    rc = moveToRightmost(pCur);\r\n  }else{\r\n    while( pCur->aiIdx[pCur->iPage]==0 ){\r\n      if( pCur->iPage==0 ){\r\n        pCur->eState = CURSOR_INVALID;\r\n        *pRes = 1;\r\n        return SQLITE_OK;\r\n      }\r\n      moveToParent(pCur);\r\n    }\r\n    pCur->info.nSize = 0;\r\n    pCur->validNKey = 0;\r\n\r\n    pCur->aiIdx[pCur->iPage]--;\r\n    pPage = pCur->apPage[pCur->iPage];\r\n    if( pPage->intKey && !pPage->leaf ){\r\n      rc = sqlite3BtreePrevious(pCur, pRes);\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n  *pRes = 0;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Allocate a new page from the database file.\r\n**\r\n** The new page is marked as dirty.  (In other words, sqlite3PagerWrite()\r\n** has already been called on the new page.)  The new page has also\r\n** been referenced and the calling routine is responsible for calling\r\n** sqlite3PagerUnref() on the new page when it is done.\r\n**\r\n** SQLITE_OK is returned on success.  Any other return value indicates\r\n** an error.  *ppPage and *pPgno are undefined in the event of an error.\r\n** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned.\r\n**\r\n** If the \"nearby\" parameter is not 0, then a (feeble) effort is made to \r\n** locate a page close to the page number \"nearby\".  This can be used in an\r\n** attempt to keep related pages close to each other in the database file,\r\n** which in turn can make database access faster.\r\n**\r\n** If the \"exact\" parameter is not 0, and the page-number nearby exists \r\n** anywhere on the free-list, then it is guarenteed to be returned. This\r\n** is only used by auto-vacuum databases when allocating a new table.\r\n*/\r\nstatic int allocateBtreePage(\r\n  BtShared *pBt, \r\n  MemPage **ppPage, \r\n  Pgno *pPgno, \r\n  Pgno nearby,\r\n  u8 exact\r\n){\r\n  MemPage *pPage1;\r\n  int rc;\r\n  u32 n;     /* Number of pages on the freelist */\r\n  u32 k;     /* Number of leaves on the trunk of the freelist */\r\n  MemPage *pTrunk = 0;\r\n  MemPage *pPrevTrunk = 0;\r\n  Pgno mxPage;     /* Total size of the database file */\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  pPage1 = pBt->pPage1;\r\n  mxPage = btreePagecount(pBt);\r\n  n = get4byte(&pPage1->aData[36]);\r\n  testcase( n==mxPage-1 );\r\n  if( n>=mxPage ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  if( n>0 ){\r\n    /* There are pages on the freelist.  Reuse one of those pages. */\r\n    Pgno iTrunk;\r\n    u8 searchList = 0; /* If the free-list must be searched for 'nearby' */\r\n    \r\n    /* If the 'exact' parameter was true and a query of the pointer-map\r\n    ** shows that the page 'nearby' is somewhere on the free-list, then\r\n    ** the entire-list will be searched for that page.\r\n    */\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( exact && nearby<=mxPage ){\r\n      u8 eType;\r\n      assert( nearby>0 );\r\n      assert( pBt->autoVacuum );\r\n      rc = ptrmapGet(pBt, nearby, &eType, 0);\r\n      if( rc ) return rc;\r\n      if( eType==PTRMAP_FREEPAGE ){\r\n        searchList = 1;\r\n      }\r\n      *pPgno = nearby;\r\n    }\r\n#endif\r\n\r\n    /* Decrement the free-list count by 1. Set iTrunk to the index of the\r\n    ** first free-list trunk page. iPrevTrunk is initially 1.\r\n    */\r\n    rc = sqlite3PagerWrite(pPage1->pDbPage);\r\n    if( rc ) return rc;\r\n    put4byte(&pPage1->aData[36], n-1);\r\n\r\n    /* The code within this loop is run only once if the 'searchList' variable\r\n    ** is not true. Otherwise, it runs once for each trunk-page on the\r\n    ** free-list until the page 'nearby' is located.\r\n    */\r\n    do {\r\n      pPrevTrunk = pTrunk;\r\n      if( pPrevTrunk ){\r\n        iTrunk = get4byte(&pPrevTrunk->aData[0]);\r\n      }else{\r\n        iTrunk = get4byte(&pPage1->aData[32]);\r\n      }\r\n      testcase( iTrunk==mxPage );\r\n      if( iTrunk>mxPage ){\r\n        rc = SQLITE_CORRUPT_BKPT;\r\n      }else{\r\n        rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);\r\n      }\r\n      if( rc ){\r\n        pTrunk = 0;\r\n        goto end_allocate_page;\r\n      }\r\n      assert( pTrunk!=0 );\r\n      assert( pTrunk->aData!=0 );\r\n\r\n      k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */\r\n      if( k==0 && !searchList ){\r\n        /* The trunk has no leaves and the list is not being searched. \r\n        ** So extract the trunk page itself and use it as the newly \r\n        ** allocated page */\r\n        assert( pPrevTrunk==0 );\r\n        rc = sqlite3PagerWrite(pTrunk->pDbPage);\r\n        if( rc ){\r\n          goto end_allocate_page;\r\n        }\r\n        *pPgno = iTrunk;\r\n        memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);\r\n        *ppPage = pTrunk;\r\n        pTrunk = 0;\r\n        TRACE((\"ALLOCATE: %d trunk - %d free pages left\\n\", *pPgno, n-1));\r\n      }else if( k>(u32)(pBt->usableSize/4 - 2) ){\r\n        /* Value of k is out of range.  Database corruption */\r\n        rc = SQLITE_CORRUPT_BKPT;\r\n        goto end_allocate_page;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      }else if( searchList && nearby==iTrunk ){\r\n        /* The list is being searched and this trunk page is the page\r\n        ** to allocate, regardless of whether it has leaves.\r\n        */\r\n        assert( *pPgno==iTrunk );\r\n        *ppPage = pTrunk;\r\n        searchList = 0;\r\n        rc = sqlite3PagerWrite(pTrunk->pDbPage);\r\n        if( rc ){\r\n          goto end_allocate_page;\r\n        }\r\n        if( k==0 ){\r\n          if( !pPrevTrunk ){\r\n            memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);\r\n          }else{\r\n            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);\r\n            if( rc!=SQLITE_OK ){\r\n              goto end_allocate_page;\r\n            }\r\n            memcpy(&pPrevTrunk->aData[0], &pTrunk->aData[0], 4);\r\n          }\r\n        }else{\r\n          /* The trunk page is required by the caller but it contains \r\n          ** pointers to free-list leaves. The first leaf becomes a trunk\r\n          ** page in this case.\r\n          */\r\n          MemPage *pNewTrunk;\r\n          Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);\r\n          if( iNewTrunk>mxPage ){ \r\n            rc = SQLITE_CORRUPT_BKPT;\r\n            goto end_allocate_page;\r\n          }\r\n          testcase( iNewTrunk==mxPage );\r\n          rc = btreeGetPage(pBt, iNewTrunk, &pNewTrunk, 0);\r\n          if( rc!=SQLITE_OK ){\r\n            goto end_allocate_page;\r\n          }\r\n          rc = sqlite3PagerWrite(pNewTrunk->pDbPage);\r\n          if( rc!=SQLITE_OK ){\r\n            releasePage(pNewTrunk);\r\n            goto end_allocate_page;\r\n          }\r\n          memcpy(&pNewTrunk->aData[0], &pTrunk->aData[0], 4);\r\n          put4byte(&pNewTrunk->aData[4], k-1);\r\n          memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4);\r\n          releasePage(pNewTrunk);\r\n          if( !pPrevTrunk ){\r\n            assert( sqlite3PagerIswriteable(pPage1->pDbPage) );\r\n            put4byte(&pPage1->aData[32], iNewTrunk);\r\n          }else{\r\n            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);\r\n            if( rc ){\r\n              goto end_allocate_page;\r\n            }\r\n            put4byte(&pPrevTrunk->aData[0], iNewTrunk);\r\n          }\r\n        }\r\n        pTrunk = 0;\r\n        TRACE((\"ALLOCATE: %d trunk - %d free pages left\\n\", *pPgno, n-1));\r\n#endif\r\n      }else if( k>0 ){\r\n        /* Extract a leaf from the trunk */\r\n        u32 closest;\r\n        Pgno iPage;\r\n        unsigned char *aData = pTrunk->aData;\r\n        if( nearby>0 ){\r\n          u32 i;\r\n          int dist;\r\n          closest = 0;\r\n          dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);\r\n          for(i=1; i<k; i++){\r\n            int d2 = sqlite3AbsInt32(get4byte(&aData[8+i*4]) - nearby);\r\n            if( d2<dist ){\r\n              closest = i;\r\n              dist = d2;\r\n            }\r\n          }\r\n        }else{\r\n          closest = 0;\r\n        }\r\n\r\n        iPage = get4byte(&aData[8+closest*4]);\r\n        testcase( iPage==mxPage );\r\n        if( iPage>mxPage ){\r\n          rc = SQLITE_CORRUPT_BKPT;\r\n          goto end_allocate_page;\r\n        }\r\n        testcase( iPage==mxPage );\r\n        if( !searchList || iPage==nearby ){\r\n          int noContent;\r\n          *pPgno = iPage;\r\n          TRACE((\"ALLOCATE: %d was leaf %d of %d on trunk %d\"\r\n                 \": %d more free pages\\n\",\r\n                 *pPgno, closest+1, k, pTrunk->pgno, n-1));\r\n          rc = sqlite3PagerWrite(pTrunk->pDbPage);\r\n          if( rc ) goto end_allocate_page;\r\n          if( closest<k-1 ){\r\n            memcpy(&aData[8+closest*4], &aData[4+k*4], 4);\r\n          }\r\n          put4byte(&aData[4], k-1);\r\n          noContent = !btreeGetHasContent(pBt, *pPgno);\r\n          rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);\r\n          if( rc==SQLITE_OK ){\r\n            rc = sqlite3PagerWrite((*ppPage)->pDbPage);\r\n            if( rc!=SQLITE_OK ){\r\n              releasePage(*ppPage);\r\n            }\r\n          }\r\n          searchList = 0;\r\n        }\r\n      }\r\n      releasePage(pPrevTrunk);\r\n      pPrevTrunk = 0;\r\n    }while( searchList );\r\n  }else{\r\n    /* There are no pages on the freelist, so create a new page at the\r\n    ** end of the file */\r\n    rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\r\n    if( rc ) return rc;\r\n    pBt->nPage++;\r\n    if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){\r\n      /* If *pPgno refers to a pointer-map page, allocate two new pages\r\n      ** at the end of the file instead of one. The first allocated page\r\n      ** becomes a new pointer-map page, the second is used by the caller.\r\n      */\r\n      MemPage *pPg = 0;\r\n      TRACE((\"ALLOCATE: %d from end of file (pointer-map page)\\n\", pBt->nPage));\r\n      assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );\r\n      rc = btreeGetPage(pBt, pBt->nPage, &pPg, 1);\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3PagerWrite(pPg->pDbPage);\r\n        releasePage(pPg);\r\n      }\r\n      if( rc ) return rc;\r\n      pBt->nPage++;\r\n      if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ){ pBt->nPage++; }\r\n    }\r\n#endif\r\n    put4byte(28 + (u8*)pBt->pPage1->aData, pBt->nPage);\r\n    *pPgno = pBt->nPage;\r\n\r\n    assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );\r\n    rc = btreeGetPage(pBt, *pPgno, ppPage, 1);\r\n    if( rc ) return rc;\r\n    rc = sqlite3PagerWrite((*ppPage)->pDbPage);\r\n    if( rc!=SQLITE_OK ){\r\n      releasePage(*ppPage);\r\n    }\r\n    TRACE((\"ALLOCATE: %d from end of file\\n\", *pPgno));\r\n  }\r\n\r\n  assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );\r\n\r\nend_allocate_page:\r\n  releasePage(pTrunk);\r\n  releasePage(pPrevTrunk);\r\n  if( rc==SQLITE_OK ){\r\n    if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){\r\n      releasePage(*ppPage);\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    (*ppPage)->isInit = 0;\r\n  }else{\r\n    *ppPage = 0;\r\n  }\r\n  assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is used to add page iPage to the database file free-list. \r\n** It is assumed that the page is not already a part of the free-list.\r\n**\r\n** The value passed as the second argument to this function is optional.\r\n** If the caller happens to have a pointer to the MemPage object \r\n** corresponding to page iPage handy, it may pass it as the second value. \r\n** Otherwise, it may pass NULL.\r\n**\r\n** If a pointer to a MemPage object is passed as the second argument,\r\n** its reference count is not altered by this function.\r\n*/\r\nstatic int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){\r\n  MemPage *pTrunk = 0;                /* Free-list trunk page */\r\n  Pgno iTrunk = 0;                    /* Page number of free-list trunk page */ \r\n  MemPage *pPage1 = pBt->pPage1;      /* Local reference to page 1 */\r\n  MemPage *pPage;                     /* Page being freed. May be NULL. */\r\n  int rc;                             /* Return Code */\r\n  int nFree;                          /* Initial number of pages on free-list */\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( iPage>1 );\r\n  assert( !pMemPage || pMemPage->pgno==iPage );\r\n\r\n  if( pMemPage ){\r\n    pPage = pMemPage;\r\n    sqlite3PagerRef(pPage->pDbPage);\r\n  }else{\r\n    pPage = btreePageLookup(pBt, iPage);\r\n  }\r\n\r\n  /* Increment the free page count on pPage1 */\r\n  rc = sqlite3PagerWrite(pPage1->pDbPage);\r\n  if( rc ) goto freepage_out;\r\n  nFree = get4byte(&pPage1->aData[36]);\r\n  put4byte(&pPage1->aData[36], nFree+1);\r\n\r\n  if( pBt->btsFlags & BTS_SECURE_DELETE ){\r\n    /* If the secure_delete option is enabled, then\r\n    ** always fully overwrite deleted information with zeros.\r\n    */\r\n    if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) )\r\n     ||            ((rc = sqlite3PagerWrite(pPage->pDbPage))!=0)\r\n    ){\r\n      goto freepage_out;\r\n    }\r\n    memset(pPage->aData, 0, pPage->pBt->pageSize);\r\n  }\r\n\r\n  /* If the database supports auto-vacuum, write an entry in the pointer-map\r\n  ** to indicate that the page is free.\r\n  */\r\n  if( ISAUTOVACUUM ){\r\n    ptrmapPut(pBt, iPage, PTRMAP_FREEPAGE, 0, &rc);\r\n    if( rc ) goto freepage_out;\r\n  }\r\n\r\n  /* Now manipulate the actual database free-list structure. There are two\r\n  ** possibilities. If the free-list is currently empty, or if the first\r\n  ** trunk page in the free-list is full, then this page will become a\r\n  ** new free-list trunk page. Otherwise, it will become a leaf of the\r\n  ** first trunk page in the current free-list. This block tests if it\r\n  ** is possible to add the page as a new free-list leaf.\r\n  */\r\n  if( nFree!=0 ){\r\n    u32 nLeaf;                /* Initial number of leaf cells on trunk page */\r\n\r\n    iTrunk = get4byte(&pPage1->aData[32]);\r\n    rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);\r\n    if( rc!=SQLITE_OK ){\r\n      goto freepage_out;\r\n    }\r\n\r\n    nLeaf = get4byte(&pTrunk->aData[4]);\r\n    assert( pBt->usableSize>32 );\r\n    if( nLeaf > (u32)pBt->usableSize/4 - 2 ){\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n      goto freepage_out;\r\n    }\r\n    if( nLeaf < (u32)pBt->usableSize/4 - 8 ){\r\n      /* In this case there is room on the trunk page to insert the page\r\n      ** being freed as a new leaf.\r\n      **\r\n      ** Note that the trunk page is not really full until it contains\r\n      ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have\r\n      ** coded.  But due to a coding error in versions of SQLite prior to\r\n      ** 3.6.0, databases with freelist trunk pages holding more than\r\n      ** usableSize/4 - 8 entries will be reported as corrupt.  In order\r\n      ** to maintain backwards compatibility with older versions of SQLite,\r\n      ** we will continue to restrict the number of entries to usableSize/4 - 8\r\n      ** for now.  At some point in the future (once everyone has upgraded\r\n      ** to 3.6.0 or later) we should consider fixing the conditional above\r\n      ** to read \"usableSize/4-2\" instead of \"usableSize/4-8\".\r\n      */\r\n      rc = sqlite3PagerWrite(pTrunk->pDbPage);\r\n      if( rc==SQLITE_OK ){\r\n        put4byte(&pTrunk->aData[4], nLeaf+1);\r\n        put4byte(&pTrunk->aData[8+nLeaf*4], iPage);\r\n        if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){\r\n          sqlite3PagerDontWrite(pPage->pDbPage);\r\n        }\r\n        rc = btreeSetHasContent(pBt, iPage);\r\n      }\r\n      TRACE((\"FREE-PAGE: %d leaf on trunk page %d\\n\",pPage->pgno,pTrunk->pgno));\r\n      goto freepage_out;\r\n    }\r\n  }\r\n\r\n  /* If control flows to this point, then it was not possible to add the\r\n  ** the page being freed as a leaf page of the first trunk in the free-list.\r\n  ** Possibly because the free-list is empty, or possibly because the \r\n  ** first trunk in the free-list is full. Either way, the page being freed\r\n  ** will become the new first trunk page in the free-list.\r\n  */\r\n  if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){\r\n    goto freepage_out;\r\n  }\r\n  rc = sqlite3PagerWrite(pPage->pDbPage);\r\n  if( rc!=SQLITE_OK ){\r\n    goto freepage_out;\r\n  }\r\n  put4byte(pPage->aData, iTrunk);\r\n  put4byte(&pPage->aData[4], 0);\r\n  put4byte(&pPage1->aData[32], iPage);\r\n  TRACE((\"FREE-PAGE: %d new trunk page replacing %d\\n\", pPage->pgno, iTrunk));\r\n\r\nfreepage_out:\r\n  if( pPage ){\r\n    pPage->isInit = 0;\r\n  }\r\n  releasePage(pPage);\r\n  releasePage(pTrunk);\r\n  return rc;\r\n}\r\nstatic void freePage(MemPage *pPage, int *pRC){\r\n  if( (*pRC)==SQLITE_OK ){\r\n    *pRC = freePage2(pPage->pBt, pPage, pPage->pgno);\r\n  }\r\n}\r\n\r\n/*\r\n** Free any overflow pages associated with the given Cell.\r\n*/\r\nstatic int clearCell(MemPage *pPage, unsigned char *pCell){\r\n  BtShared *pBt = pPage->pBt;\r\n  CellInfo info;\r\n  Pgno ovflPgno;\r\n  int rc;\r\n  int nOvfl;\r\n  u32 ovflPageSize;\r\n\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  btreeParseCellPtr(pPage, pCell, &info);\r\n  if( info.iOverflow==0 ){\r\n    return SQLITE_OK;  /* No overflow pages. Return without doing anything */\r\n  }\r\n  if( pCell+info.iOverflow+3 > pPage->aData+pPage->maskPage ){\r\n    return SQLITE_CORRUPT;  /* Cell extends past end of page */\r\n  }\r\n  ovflPgno = get4byte(&pCell[info.iOverflow]);\r\n  assert( pBt->usableSize > 4 );\r\n  ovflPageSize = pBt->usableSize - 4;\r\n  nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;\r\n  assert( ovflPgno==0 || nOvfl>0 );\r\n  while( nOvfl-- ){\r\n    Pgno iNext = 0;\r\n    MemPage *pOvfl = 0;\r\n    if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){\r\n      /* 0 is not a legal page number and page 1 cannot be an \r\n      ** overflow page. Therefore if ovflPgno<2 or past the end of the \r\n      ** file the database must be corrupt. */\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    if( nOvfl ){\r\n      rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);\r\n      if( rc ) return rc;\r\n    }\r\n\r\n    if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )\r\n     && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1\r\n    ){\r\n      /* There is no reason any cursor should have an outstanding reference \r\n      ** to an overflow page belonging to a cell that is being deleted/updated.\r\n      ** So if there exists more than one reference to this page, then it \r\n      ** must not really be an overflow page and the database must be corrupt. \r\n      ** It is helpful to detect this before calling freePage2(), as \r\n      ** freePage2() may zero the page contents if secure-delete mode is\r\n      ** enabled. If this 'overflow' page happens to be a page that the\r\n      ** caller is iterating through or using in some other way, this\r\n      ** can be problematic.\r\n      */\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n    }else{\r\n      rc = freePage2(pBt, pOvfl, ovflPgno);\r\n    }\r\n\r\n    if( pOvfl ){\r\n      sqlite3PagerUnref(pOvfl->pDbPage);\r\n    }\r\n    if( rc ) return rc;\r\n    ovflPgno = iNext;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Create the byte sequence used to represent a cell on page pPage\r\n** and write that byte sequence into pCell[].  Overflow pages are\r\n** allocated and filled in as necessary.  The calling procedure\r\n** is responsible for making sure sufficient space has been allocated\r\n** for pCell[].\r\n**\r\n** Note that pCell does not necessary need to point to the pPage->aData\r\n** area.  pCell might point to some temporary storage.  The cell will\r\n** be constructed in this temporary area then copied into pPage->aData\r\n** later.\r\n*/\r\nstatic int fillInCell(\r\n  MemPage *pPage,                /* The page that contains the cell */\r\n  unsigned char *pCell,          /* Complete text of the cell */\r\n  const void *pKey, i64 nKey,    /* The key */\r\n  const void *pData,int nData,   /* The data */\r\n  int nZero,                     /* Extra zero bytes to append to pData */\r\n  int *pnSize                    /* Write cell size here */\r\n){\r\n  int nPayload;\r\n  const u8 *pSrc;\r\n  int nSrc, n, rc;\r\n  int spaceLeft;\r\n  MemPage *pOvfl = 0;\r\n  MemPage *pToRelease = 0;\r\n  unsigned char *pPrior;\r\n  unsigned char *pPayload;\r\n  BtShared *pBt = pPage->pBt;\r\n  Pgno pgnoOvfl = 0;\r\n  int nHeader;\r\n  CellInfo info;\r\n\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n\r\n  /* pPage is not necessarily writeable since pCell might be auxiliary\r\n  ** buffer space that is separate from the pPage buffer area */\r\n  assert( pCell<pPage->aData || pCell>=&pPage->aData[pBt->pageSize]\r\n            || sqlite3PagerIswriteable(pPage->pDbPage) );\r\n\r\n  /* Fill in the header. */\r\n  nHeader = 0;\r\n  if( !pPage->leaf ){\r\n    nHeader += 4;\r\n  }\r\n  if( pPage->hasData ){\r\n    nHeader += putVarint(&pCell[nHeader], nData+nZero);\r\n  }else{\r\n    nData = nZero = 0;\r\n  }\r\n  nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey);\r\n  btreeParseCellPtr(pPage, pCell, &info);\r\n  assert( info.nHeader==nHeader );\r\n  assert( info.nKey==nKey );\r\n  assert( info.nData==(u32)(nData+nZero) );\r\n  \r\n  /* Fill in the payload */\r\n  nPayload = nData + nZero;\r\n  if( pPage->intKey ){\r\n    pSrc = pData;\r\n    nSrc = nData;\r\n    nData = 0;\r\n  }else{ \r\n    if( NEVER(nKey>0x7fffffff || pKey==0) ){\r\n      return SQLITE_CORRUPT_BKPT;\r\n    }\r\n    nPayload += (int)nKey;\r\n    pSrc = pKey;\r\n    nSrc = (int)nKey;\r\n  }\r\n  *pnSize = info.nSize;\r\n  spaceLeft = info.nLocal;\r\n  pPayload = &pCell[nHeader];\r\n  pPrior = &pCell[info.iOverflow];\r\n\r\n  while( nPayload>0 ){\r\n    if( spaceLeft==0 ){\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */\r\n      if( pBt->autoVacuum ){\r\n        do{\r\n          pgnoOvfl++;\r\n        } while( \r\n          PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) \r\n        );\r\n      }\r\n#endif\r\n      rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, 0);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      /* If the database supports auto-vacuum, and the second or subsequent\r\n      ** overflow page is being allocated, add an entry to the pointer-map\r\n      ** for that page now. \r\n      **\r\n      ** If this is the first overflow page, then write a partial entry \r\n      ** to the pointer-map. If we write nothing to this pointer-map slot,\r\n      ** then the optimistic overflow chain processing in clearCell()\r\n      ** may misinterpret the uninitialised values and delete the\r\n      ** wrong pages from the database.\r\n      */\r\n      if( pBt->autoVacuum && rc==SQLITE_OK ){\r\n        u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1);\r\n        ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap, &rc);\r\n        if( rc ){\r\n          releasePage(pOvfl);\r\n        }\r\n      }\r\n#endif\r\n      if( rc ){\r\n        releasePage(pToRelease);\r\n        return rc;\r\n      }\r\n\r\n      /* If pToRelease is not zero than pPrior points into the data area\r\n      ** of pToRelease.  Make sure pToRelease is still writeable. */\r\n      assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );\r\n\r\n      /* If pPrior is part of the data area of pPage, then make sure pPage\r\n      ** is still writeable */\r\n      assert( pPrior<pPage->aData || pPrior>=&pPage->aData[pBt->pageSize]\r\n            || sqlite3PagerIswriteable(pPage->pDbPage) );\r\n\r\n      put4byte(pPrior, pgnoOvfl);\r\n      releasePage(pToRelease);\r\n      pToRelease = pOvfl;\r\n      pPrior = pOvfl->aData;\r\n      put4byte(pPrior, 0);\r\n      pPayload = &pOvfl->aData[4];\r\n      spaceLeft = pBt->usableSize - 4;\r\n    }\r\n    n = nPayload;\r\n    if( n>spaceLeft ) n = spaceLeft;\r\n\r\n    /* If pToRelease is not zero than pPayload points into the data area\r\n    ** of pToRelease.  Make sure pToRelease is still writeable. */\r\n    assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );\r\n\r\n    /* If pPayload is part of the data area of pPage, then make sure pPage\r\n    ** is still writeable */\r\n    assert( pPayload<pPage->aData || pPayload>=&pPage->aData[pBt->pageSize]\r\n            || sqlite3PagerIswriteable(pPage->pDbPage) );\r\n\r\n    if( nSrc>0 ){\r\n      if( n>nSrc ) n = nSrc;\r\n      assert( pSrc );\r\n      memcpy(pPayload, pSrc, n);\r\n    }else{\r\n      memset(pPayload, 0, n);\r\n    }\r\n    nPayload -= n;\r\n    pPayload += n;\r\n    pSrc += n;\r\n    nSrc -= n;\r\n    spaceLeft -= n;\r\n    if( nSrc==0 ){\r\n      nSrc = nData;\r\n      pSrc = pData;\r\n    }\r\n  }\r\n  releasePage(pToRelease);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Remove the i-th cell from pPage.  This routine effects pPage only.\r\n** The cell content is not freed or deallocated.  It is assumed that\r\n** the cell content has been copied someplace else.  This routine just\r\n** removes the reference to the cell from pPage.\r\n**\r\n** \"sz\" must be the number of bytes in the cell.\r\n*/\r\nstatic void dropCell(MemPage *pPage, int idx, int sz, int *pRC){\r\n  u32 pc;         /* Offset to cell content of cell being deleted */\r\n  u8 *data;       /* pPage->aData */\r\n  u8 *ptr;        /* Used to move bytes around within data[] */\r\n  u8 *endPtr;     /* End of loop */\r\n  int rc;         /* The return code */\r\n  int hdr;        /* Beginning of the header.  0 most pages.  100 page 1 */\r\n\r\n  if( *pRC ) return;\r\n\r\n  assert( idx>=0 && idx<pPage->nCell );\r\n  assert( sz==cellSize(pPage, idx) );\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  data = pPage->aData;\r\n  ptr = &pPage->aCellIdx[2*idx];\r\n  pc = get2byte(ptr);\r\n  hdr = pPage->hdrOffset;\r\n  testcase( pc==get2byte(&data[hdr+5]) );\r\n  testcase( pc+sz==pPage->pBt->usableSize );\r\n  if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){\r\n    *pRC = SQLITE_CORRUPT_BKPT;\r\n    return;\r\n  }\r\n  rc = freeSpace(pPage, pc, sz);\r\n  if( rc ){\r\n    *pRC = rc;\r\n    return;\r\n  }\r\n  endPtr = &pPage->aCellIdx[2*pPage->nCell - 2];\r\n  assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 );  /* ptr is always 2-byte aligned */\r\n  while( ptr<endPtr ){\r\n    *(u16*)ptr = *(u16*)&ptr[2];\r\n    ptr += 2;\r\n  }\r\n  pPage->nCell--;\r\n  put2byte(&data[hdr+3], pPage->nCell);\r\n  pPage->nFree += 2;\r\n}\r\n\r\n/*\r\n** Insert a new cell on pPage at cell index \"i\".  pCell points to the\r\n** content of the cell.\r\n**\r\n** If the cell content will fit on the page, then put it there.  If it\r\n** will not fit, then make a copy of the cell content into pTemp if\r\n** pTemp is not null.  Regardless of pTemp, allocate a new entry\r\n** in pPage->apOvfl[] and make it point to the cell content (either\r\n** in pTemp or the original pCell) and also record its index. \r\n** Allocating a new entry in pPage->aCell[] implies that \r\n** pPage->nOverflow is incremented.\r\n**\r\n** If nSkip is non-zero, then do not copy the first nSkip bytes of the\r\n** cell. The caller will overwrite them after this function returns. If\r\n** nSkip is non-zero, then pCell may not point to an invalid memory location \r\n** (but pCell+nSkip is always valid).\r\n*/\r\nstatic void insertCell(\r\n  MemPage *pPage,   /* Page into which we are copying */\r\n  int i,            /* New cell becomes the i-th cell of the page */\r\n  u8 *pCell,        /* Content of the new cell */\r\n  int sz,           /* Bytes of content in pCell */\r\n  u8 *pTemp,        /* Temp storage space for pCell, if needed */\r\n  Pgno iChild,      /* If non-zero, replace first 4 bytes with this value */\r\n  int *pRC          /* Read and write return code from here */\r\n){\r\n  int idx = 0;      /* Where to write new cell content in data[] */\r\n  int j;            /* Loop counter */\r\n  int end;          /* First byte past the last cell pointer in data[] */\r\n  int ins;          /* Index in data[] where new cell pointer is inserted */\r\n  int cellOffset;   /* Address of first cell pointer in data[] */\r\n  u8 *data;         /* The content of the whole page */\r\n  u8 *ptr;          /* Used for moving information around in data[] */\r\n  u8 *endPtr;       /* End of the loop */\r\n\r\n  int nSkip = (iChild ? 4 : 0);\r\n\r\n  if( *pRC ) return;\r\n\r\n  assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );\r\n  assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921 );\r\n  assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );\r\n  assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  /* The cell should normally be sized correctly.  However, when moving a\r\n  ** malformed cell from a leaf page to an interior page, if the cell size\r\n  ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size\r\n  ** might be less than 8 (leaf-size + pointer) on the interior node.  Hence\r\n  ** the term after the || in the following assert(). */\r\n  assert( sz==cellSizePtr(pPage, pCell) || (sz==8 && iChild>0) );\r\n  if( pPage->nOverflow || sz+2>pPage->nFree ){\r\n    if( pTemp ){\r\n      memcpy(pTemp+nSkip, pCell+nSkip, sz-nSkip);\r\n      pCell = pTemp;\r\n    }\r\n    if( iChild ){\r\n      put4byte(pCell, iChild);\r\n    }\r\n    j = pPage->nOverflow++;\r\n    assert( j<(int)(sizeof(pPage->apOvfl)/sizeof(pPage->apOvfl[0])) );\r\n    pPage->apOvfl[j] = pCell;\r\n    pPage->aiOvfl[j] = (u16)i;\r\n  }else{\r\n    int rc = sqlite3PagerWrite(pPage->pDbPage);\r\n    if( rc!=SQLITE_OK ){\r\n      *pRC = rc;\r\n      return;\r\n    }\r\n    assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n    data = pPage->aData;\r\n    cellOffset = pPage->cellOffset;\r\n    end = cellOffset + 2*pPage->nCell;\r\n    ins = cellOffset + 2*i;\r\n    rc = allocateSpace(pPage, sz, &idx);\r\n    if( rc ){ *pRC = rc; return; }\r\n    /* The allocateSpace() routine guarantees the following two properties\r\n    ** if it returns success */\r\n    assert( idx >= end+2 );\r\n    assert( idx+sz <= (int)pPage->pBt->usableSize );\r\n    pPage->nCell++;\r\n    pPage->nFree -= (u16)(2 + sz);\r\n    memcpy(&data[idx+nSkip], pCell+nSkip, sz-nSkip);\r\n    if( iChild ){\r\n      put4byte(&data[idx], iChild);\r\n    }\r\n    ptr = &data[end];\r\n    endPtr = &data[ins];\r\n    assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 );  /* ptr is always 2-byte aligned */\r\n    while( ptr>endPtr ){\r\n      *(u16*)ptr = *(u16*)&ptr[-2];\r\n      ptr -= 2;\r\n    }\r\n    put2byte(&data[ins], idx);\r\n    put2byte(&data[pPage->hdrOffset+3], pPage->nCell);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( pPage->pBt->autoVacuum ){\r\n      /* The cell may contain a pointer to an overflow page. If so, write\r\n      ** the entry for the overflow page into the pointer map.\r\n      */\r\n      ptrmapPutOvflPtr(pPage, pCell, pRC);\r\n    }\r\n#endif\r\n  }\r\n}\r\n\r\n/*\r\n** Add a list of cells to a page.  The page should be initially empty.\r\n** The cells are guaranteed to fit on the page.\r\n*/\r\nstatic void assemblePage(\r\n  MemPage *pPage,   /* The page to be assemblied */\r\n  int nCell,        /* The number of cells to add to this page */\r\n  u8 **apCell,      /* Pointers to cell bodies */\r\n  u16 *aSize        /* Sizes of the cells */\r\n){\r\n  int i;            /* Loop counter */\r\n  u8 *pCellptr;     /* Address of next cell pointer */\r\n  int cellbody;     /* Address of next cell body */\r\n  u8 * const data = pPage->aData;             /* Pointer to data for pPage */\r\n  const int hdr = pPage->hdrOffset;           /* Offset of header on pPage */\r\n  const int nUsable = pPage->pBt->usableSize; /* Usable size of page */\r\n\r\n  assert( pPage->nOverflow==0 );\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  assert( nCell>=0 && nCell<=(int)MX_CELL(pPage->pBt)\r\n            && (int)MX_CELL(pPage->pBt)<=10921);\r\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\r\n\r\n  /* Check that the page has just been zeroed by zeroPage() */\r\n  assert( pPage->nCell==0 );\r\n  assert( get2byteNotZero(&data[hdr+5])==nUsable );\r\n\r\n  pCellptr = &pPage->aCellIdx[nCell*2];\r\n  cellbody = nUsable;\r\n  for(i=nCell-1; i>=0; i--){\r\n    u16 sz = aSize[i];\r\n    pCellptr -= 2;\r\n    cellbody -= sz;\r\n    put2byte(pCellptr, cellbody);\r\n    memcpy(&data[cellbody], apCell[i], sz);\r\n  }\r\n  put2byte(&data[hdr+3], nCell);\r\n  put2byte(&data[hdr+5], cellbody);\r\n  pPage->nFree -= (nCell*2 + nUsable - cellbody);\r\n  pPage->nCell = (u16)nCell;\r\n}\r\n\r\n/*\r\n** The following parameters determine how many adjacent pages get involved\r\n** in a balancing operation.  NN is the number of neighbors on either side\r\n** of the page that participate in the balancing operation.  NB is the\r\n** total number of pages that participate, including the target page and\r\n** NN neighbors on either side.\r\n**\r\n** The minimum value of NN is 1 (of course).  Increasing NN above 1\r\n** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance\r\n** in exchange for a larger degradation in INSERT and UPDATE performance.\r\n** The value of NN appears to give the best results overall.\r\n*/\r\n#define NN 1             /* Number of neighbors on either side of pPage */\r\n#define NB (NN*2+1)      /* Total pages involved in the balance */\r\n\r\n\r\n#ifndef SQLITE_OMIT_QUICKBALANCE\r\n/*\r\n** This version of balance() handles the common special case where\r\n** a new entry is being inserted on the extreme right-end of the\r\n** tree, in other words, when the new entry will become the largest\r\n** entry in the tree.\r\n**\r\n** Instead of trying to balance the 3 right-most leaf pages, just add\r\n** a new page to the right-hand side and put the one new entry in\r\n** that page.  This leaves the right side of the tree somewhat\r\n** unbalanced.  But odds are that we will be inserting new entries\r\n** at the end soon afterwards so the nearly empty page will quickly\r\n** fill up.  On average.\r\n**\r\n** pPage is the leaf page which is the right-most page in the tree.\r\n** pParent is its parent.  pPage must have a single overflow entry\r\n** which is also the right-most entry on the page.\r\n**\r\n** The pSpace buffer is used to store a temporary copy of the divider\r\n** cell that will be inserted into pParent. Such a cell consists of a 4\r\n** byte page number followed by a variable length integer. In other\r\n** words, at most 13 bytes. Hence the pSpace buffer must be at\r\n** least 13 bytes in size.\r\n*/\r\nstatic int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){\r\n  BtShared *const pBt = pPage->pBt;    /* B-Tree Database */\r\n  MemPage *pNew;                       /* Newly allocated page */\r\n  int rc;                              /* Return Code */\r\n  Pgno pgnoNew;                        /* Page number of pNew */\r\n\r\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\r\n  assert( sqlite3PagerIswriteable(pParent->pDbPage) );\r\n  assert( pPage->nOverflow==1 );\r\n\r\n  /* This error condition is now caught prior to reaching this function */\r\n  if( pPage->nCell<=0 ) return SQLITE_CORRUPT_BKPT;\r\n\r\n  /* Allocate a new page. This page will become the right-sibling of \r\n  ** pPage. Make the parent page writable, so that the new divider cell\r\n  ** may be inserted. If both these operations are successful, proceed.\r\n  */\r\n  rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);\r\n\r\n  if( rc==SQLITE_OK ){\r\n\r\n    u8 *pOut = &pSpace[4];\r\n    u8 *pCell = pPage->apOvfl[0];\r\n    u16 szCell = cellSizePtr(pPage, pCell);\r\n    u8 *pStop;\r\n\r\n    assert( sqlite3PagerIswriteable(pNew->pDbPage) );\r\n    assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );\r\n    zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);\r\n    assemblePage(pNew, 1, &pCell, &szCell);\r\n\r\n    /* If this is an auto-vacuum database, update the pointer map\r\n    ** with entries for the new page, and any pointer from the \r\n    ** cell on the page to an overflow page. If either of these\r\n    ** operations fails, the return code is set, but the contents\r\n    ** of the parent page are still manipulated by thh code below.\r\n    ** That is Ok, at this point the parent page is guaranteed to\r\n    ** be marked as dirty. Returning an error code will cause a\r\n    ** rollback, undoing any changes made to the parent page.\r\n    */\r\n    if( ISAUTOVACUUM ){\r\n      ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc);\r\n      if( szCell>pNew->minLocal ){\r\n        ptrmapPutOvflPtr(pNew, pCell, &rc);\r\n      }\r\n    }\r\n  \r\n    /* Create a divider cell to insert into pParent. The divider cell\r\n    ** consists of a 4-byte page number (the page number of pPage) and\r\n    ** a variable length key value (which must be the same value as the\r\n    ** largest key on pPage).\r\n    **\r\n    ** To find the largest key value on pPage, first find the right-most \r\n    ** cell on pPage. The first two fields of this cell are the \r\n    ** record-length (a variable length integer at most 32-bits in size)\r\n    ** and the key value (a variable length integer, may have any value).\r\n    ** The first of the while(...) loops below skips over the record-length\r\n    ** field. The second while(...) loop copies the key value from the\r\n    ** cell on pPage into the pSpace buffer.\r\n    */\r\n    pCell = findCell(pPage, pPage->nCell-1);\r\n    pStop = &pCell[9];\r\n    while( (*(pCell++)&0x80) && pCell<pStop );\r\n    pStop = &pCell[9];\r\n    while( ((*(pOut++) = *(pCell++))&0x80) && pCell<pStop );\r\n\r\n    /* Insert the new divider cell into pParent. */\r\n    insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace),\r\n               0, pPage->pgno, &rc);\r\n\r\n    /* Set the right-child pointer of pParent to point to the new page. */\r\n    put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew);\r\n  \r\n    /* Release the reference to the new page. */\r\n    releasePage(pNew);\r\n  }\r\n\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_QUICKBALANCE */\r\n\r\n#if 0\r\n/*\r\n** This function does not contribute anything to the operation of SQLite.\r\n** it is sometimes activated temporarily while debugging code responsible \r\n** for setting pointer-map entries.\r\n*/\r\nstatic int ptrmapCheckPages(MemPage **apPage, int nPage){\r\n  int i, j;\r\n  for(i=0; i<nPage; i++){\r\n    Pgno n;\r\n    u8 e;\r\n    MemPage *pPage = apPage[i];\r\n    BtShared *pBt = pPage->pBt;\r\n    assert( pPage->isInit );\r\n\r\n    for(j=0; j<pPage->nCell; j++){\r\n      CellInfo info;\r\n      u8 *z;\r\n     \r\n      z = findCell(pPage, j);\r\n      btreeParseCellPtr(pPage, z, &info);\r\n      if( info.iOverflow ){\r\n        Pgno ovfl = get4byte(&z[info.iOverflow]);\r\n        ptrmapGet(pBt, ovfl, &e, &n);\r\n        assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );\r\n      }\r\n      if( !pPage->leaf ){\r\n        Pgno child = get4byte(z);\r\n        ptrmapGet(pBt, child, &e, &n);\r\n        assert( n==pPage->pgno && e==PTRMAP_BTREE );\r\n      }\r\n    }\r\n    if( !pPage->leaf ){\r\n      Pgno child = get4byte(&pPage->aData[pPage->hdrOffset+8]);\r\n      ptrmapGet(pBt, child, &e, &n);\r\n      assert( n==pPage->pgno && e==PTRMAP_BTREE );\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n#endif\r\n\r\n/*\r\n** This function is used to copy the contents of the b-tree node stored \r\n** on page pFrom to page pTo. If page pFrom was not a leaf page, then\r\n** the pointer-map entries for each child page are updated so that the\r\n** parent page stored in the pointer map is page pTo. If pFrom contained\r\n** any cells with overflow page pointers, then the corresponding pointer\r\n** map entries are also updated so that the parent page is page pTo.\r\n**\r\n** If pFrom is currently carrying any overflow cells (entries in the\r\n** MemPage.apOvfl[] array), they are not copied to pTo. \r\n**\r\n** Before returning, page pTo is reinitialized using btreeInitPage().\r\n**\r\n** The performance of this function is not critical. It is only used by \r\n** the balance_shallower() and balance_deeper() procedures, neither of\r\n** which are called often under normal circumstances.\r\n*/\r\nstatic void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){\r\n  if( (*pRC)==SQLITE_OK ){\r\n    BtShared * const pBt = pFrom->pBt;\r\n    u8 * const aFrom = pFrom->aData;\r\n    u8 * const aTo = pTo->aData;\r\n    int const iFromHdr = pFrom->hdrOffset;\r\n    int const iToHdr = ((pTo->pgno==1) ? 100 : 0);\r\n    int rc;\r\n    int iData;\r\n  \r\n  \r\n    assert( pFrom->isInit );\r\n    assert( pFrom->nFree>=iToHdr );\r\n    assert( get2byte(&aFrom[iFromHdr+5]) <= (int)pBt->usableSize );\r\n  \r\n    /* Copy the b-tree node content from page pFrom to page pTo. */\r\n    iData = get2byte(&aFrom[iFromHdr+5]);\r\n    memcpy(&aTo[iData], &aFrom[iData], pBt->usableSize-iData);\r\n    memcpy(&aTo[iToHdr], &aFrom[iFromHdr], pFrom->cellOffset + 2*pFrom->nCell);\r\n  \r\n    /* Reinitialize page pTo so that the contents of the MemPage structure\r\n    ** match the new data. The initialization of pTo can actually fail under\r\n    ** fairly obscure circumstances, even though it is a copy of initialized \r\n    ** page pFrom.\r\n    */\r\n    pTo->isInit = 0;\r\n    rc = btreeInitPage(pTo);\r\n    if( rc!=SQLITE_OK ){\r\n      *pRC = rc;\r\n      return;\r\n    }\r\n  \r\n    /* If this is an auto-vacuum database, update the pointer-map entries\r\n    ** for any b-tree or overflow pages that pTo now contains the pointers to.\r\n    */\r\n    if( ISAUTOVACUUM ){\r\n      *pRC = setChildPtrmaps(pTo);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** This routine redistributes cells on the iParentIdx'th child of pParent\r\n** (hereafter \"the page\") and up to 2 siblings so that all pages have about the\r\n** same amount of free space. Usually a single sibling on either side of the\r\n** page are used in the balancing, though both siblings might come from one\r\n** side if the page is the first or last child of its parent. If the page \r\n** has fewer than 2 siblings (something which can only happen if the page\r\n** is a root page or a child of a root page) then all available siblings\r\n** participate in the balancing.\r\n**\r\n** The number of siblings of the page might be increased or decreased by \r\n** one or two in an effort to keep pages nearly full but not over full. \r\n**\r\n** Note that when this routine is called, some of the cells on the page\r\n** might not actually be stored in MemPage.aData[]. This can happen\r\n** if the page is overfull. This routine ensures that all cells allocated\r\n** to the page and its siblings fit into MemPage.aData[] before returning.\r\n**\r\n** In the course of balancing the page and its siblings, cells may be\r\n** inserted into or removed from the parent page (pParent). Doing so\r\n** may cause the parent page to become overfull or underfull. If this\r\n** happens, it is the responsibility of the caller to invoke the correct\r\n** balancing routine to fix this problem (see the balance() routine). \r\n**\r\n** If this routine fails for any reason, it might leave the database\r\n** in a corrupted state. So if this routine fails, the database should\r\n** be rolled back.\r\n**\r\n** The third argument to this function, aOvflSpace, is a pointer to a\r\n** buffer big enough to hold one page. If while inserting cells into the parent\r\n** page (pParent) the parent page becomes overfull, this buffer is\r\n** used to store the parent's overflow cells. Because this function inserts\r\n** a maximum of four divider cells into the parent page, and the maximum\r\n** size of a cell stored within an internal node is always less than 1/4\r\n** of the page-size, the aOvflSpace[] buffer is guaranteed to be large\r\n** enough for all overflow cells.\r\n**\r\n** If aOvflSpace is set to a null pointer, this function returns \r\n** SQLITE_NOMEM.\r\n*/\r\nstatic int balance_nonroot(\r\n  MemPage *pParent,               /* Parent page of siblings being balanced */\r\n  int iParentIdx,                 /* Index of \"the page\" in pParent */\r\n  u8 *aOvflSpace,                 /* page-size bytes of space for parent ovfl */\r\n  int isRoot                      /* True if pParent is a root-page */\r\n){\r\n  BtShared *pBt;               /* The whole database */\r\n  int nCell = 0;               /* Number of cells in apCell[] */\r\n  int nMaxCells = 0;           /* Allocated size of apCell, szCell, aFrom. */\r\n  int nNew = 0;                /* Number of pages in apNew[] */\r\n  int nOld;                    /* Number of pages in apOld[] */\r\n  int i, j, k;                 /* Loop counters */\r\n  int nxDiv;                   /* Next divider slot in pParent->aCell[] */\r\n  int rc = SQLITE_OK;          /* The return code */\r\n  u16 leafCorrection;          /* 4 if pPage is a leaf.  0 if not */\r\n  int leafData;                /* True if pPage is a leaf of a LEAFDATA tree */\r\n  int usableSpace;             /* Bytes in pPage beyond the header */\r\n  int pageFlags;               /* Value of pPage->aData[0] */\r\n  int subtotal;                /* Subtotal of bytes in cells on one page */\r\n  int iSpace1 = 0;             /* First unused byte of aSpace1[] */\r\n  int iOvflSpace = 0;          /* First unused byte of aOvflSpace[] */\r\n  int szScratch;               /* Size of scratch memory requested */\r\n  MemPage *apOld[NB];          /* pPage and up to two siblings */\r\n  MemPage *apCopy[NB];         /* Private copies of apOld[] pages */\r\n  MemPage *apNew[NB+2];        /* pPage and up to NB siblings after balancing */\r\n  u8 *pRight;                  /* Location in parent of right-sibling pointer */\r\n  u8 *apDiv[NB-1];             /* Divider cells in pParent */\r\n  int cntNew[NB+2];            /* Index in aCell[] of cell after i-th page */\r\n  int szNew[NB+2];             /* Combined size of cells place on i-th page */\r\n  u8 **apCell = 0;             /* All cells begin balanced */\r\n  u16 *szCell;                 /* Local size of all cells in apCell[] */\r\n  u8 *aSpace1;                 /* Space for copies of dividers cells */\r\n  Pgno pgno;                   /* Temp var to store a page number in */\r\n\r\n  pBt = pParent->pBt;\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  assert( sqlite3PagerIswriteable(pParent->pDbPage) );\r\n\r\n#if 0\r\n  TRACE((\"BALANCE: begin page %d child of %d\\n\", pPage->pgno, pParent->pgno));\r\n#endif\r\n\r\n  /* At this point pParent may have at most one overflow cell. And if\r\n  ** this overflow cell is present, it must be the cell with \r\n  ** index iParentIdx. This scenario comes about when this function\r\n  ** is called (indirectly) from sqlite3BtreeDelete().\r\n  */\r\n  assert( pParent->nOverflow==0 || pParent->nOverflow==1 );\r\n  assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );\r\n\r\n  if( !aOvflSpace ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  /* Find the sibling pages to balance. Also locate the cells in pParent \r\n  ** that divide the siblings. An attempt is made to find NN siblings on \r\n  ** either side of pPage. More siblings are taken from one side, however, \r\n  ** if there are fewer than NN siblings on the other side. If pParent\r\n  ** has NB or fewer children then all children of pParent are taken.  \r\n  **\r\n  ** This loop also drops the divider cells from the parent page. This\r\n  ** way, the remainder of the function does not have to deal with any\r\n  ** overflow cells in the parent page, since if any existed they will\r\n  ** have already been removed.\r\n  */\r\n  i = pParent->nOverflow + pParent->nCell;\r\n  if( i<2 ){\r\n    nxDiv = 0;\r\n    nOld = i+1;\r\n  }else{\r\n    nOld = 3;\r\n    if( iParentIdx==0 ){                 \r\n      nxDiv = 0;\r\n    }else if( iParentIdx==i ){\r\n      nxDiv = i-2;\r\n    }else{\r\n      nxDiv = iParentIdx-1;\r\n    }\r\n    i = 2;\r\n  }\r\n  if( (i+nxDiv-pParent->nOverflow)==pParent->nCell ){\r\n    pRight = &pParent->aData[pParent->hdrOffset+8];\r\n  }else{\r\n    pRight = findCell(pParent, i+nxDiv-pParent->nOverflow);\r\n  }\r\n  pgno = get4byte(pRight);\r\n  while( 1 ){\r\n    rc = getAndInitPage(pBt, pgno, &apOld[i]);\r\n    if( rc ){\r\n      memset(apOld, 0, (i+1)*sizeof(MemPage*));\r\n      goto balance_cleanup;\r\n    }\r\n    nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;\r\n    if( (i--)==0 ) break;\r\n\r\n    if( i+nxDiv==pParent->aiOvfl[0] && pParent->nOverflow ){\r\n      apDiv[i] = pParent->apOvfl[0];\r\n      pgno = get4byte(apDiv[i]);\r\n      szNew[i] = cellSizePtr(pParent, apDiv[i]);\r\n      pParent->nOverflow = 0;\r\n    }else{\r\n      apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow);\r\n      pgno = get4byte(apDiv[i]);\r\n      szNew[i] = cellSizePtr(pParent, apDiv[i]);\r\n\r\n      /* Drop the cell from the parent page. apDiv[i] still points to\r\n      ** the cell within the parent, even though it has been dropped.\r\n      ** This is safe because dropping a cell only overwrites the first\r\n      ** four bytes of it, and this function does not need the first\r\n      ** four bytes of the divider cell. So the pointer is safe to use\r\n      ** later on.  \r\n      **\r\n      ** But not if we are in secure-delete mode. In secure-delete mode,\r\n      ** the dropCell() routine will overwrite the entire cell with zeroes.\r\n      ** In this case, temporarily copy the cell into the aOvflSpace[]\r\n      ** buffer. It will be copied out again as soon as the aSpace[] buffer\r\n      ** is allocated.  */\r\n      if( pBt->btsFlags & BTS_SECURE_DELETE ){\r\n        int iOff;\r\n\r\n        iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);\r\n        if( (iOff+szNew[i])>(int)pBt->usableSize ){\r\n          rc = SQLITE_CORRUPT_BKPT;\r\n          memset(apOld, 0, (i+1)*sizeof(MemPage*));\r\n          goto balance_cleanup;\r\n        }else{\r\n          memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);\r\n          apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];\r\n        }\r\n      }\r\n      dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc);\r\n    }\r\n  }\r\n\r\n  /* Make nMaxCells a multiple of 4 in order to preserve 8-byte\r\n  ** alignment */\r\n  nMaxCells = (nMaxCells + 3)&~3;\r\n\r\n  /*\r\n  ** Allocate space for memory structures\r\n  */\r\n  k = pBt->pageSize + ROUND8(sizeof(MemPage));\r\n  szScratch =\r\n       nMaxCells*sizeof(u8*)                       /* apCell */\r\n     + nMaxCells*sizeof(u16)                       /* szCell */\r\n     + pBt->pageSize                               /* aSpace1 */\r\n     + k*nOld;                                     /* Page copies (apCopy) */\r\n  apCell = sqlite3ScratchMalloc( szScratch ); \r\n  if( apCell==0 ){\r\n    rc = SQLITE_NOMEM;\r\n    goto balance_cleanup;\r\n  }\r\n  szCell = (u16*)&apCell[nMaxCells];\r\n  aSpace1 = (u8*)&szCell[nMaxCells];\r\n  assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );\r\n\r\n  /*\r\n  ** Load pointers to all cells on sibling pages and the divider cells\r\n  ** into the local apCell[] array.  Make copies of the divider cells\r\n  ** into space obtained from aSpace1[] and remove the the divider Cells\r\n  ** from pParent.\r\n  **\r\n  ** If the siblings are on leaf pages, then the child pointers of the\r\n  ** divider cells are stripped from the cells before they are copied\r\n  ** into aSpace1[].  In this way, all cells in apCell[] are without\r\n  ** child pointers.  If siblings are not leaves, then all cell in\r\n  ** apCell[] include child pointers.  Either way, all cells in apCell[]\r\n  ** are alike.\r\n  **\r\n  ** leafCorrection:  4 if pPage is a leaf.  0 if pPage is not a leaf.\r\n  **       leafData:  1 if pPage holds key+data and pParent holds only keys.\r\n  */\r\n  leafCorrection = apOld[0]->leaf*4;\r\n  leafData = apOld[0]->hasData;\r\n  for(i=0; i<nOld; i++){\r\n    int limit;\r\n    \r\n    /* Before doing anything else, take a copy of the i'th original sibling\r\n    ** The rest of this function will use data from the copies rather\r\n    ** that the original pages since the original pages will be in the\r\n    ** process of being overwritten.  */\r\n    MemPage *pOld = apCopy[i] = (MemPage*)&aSpace1[pBt->pageSize + k*i];\r\n    memcpy(pOld, apOld[i], sizeof(MemPage));\r\n    pOld->aData = (void*)&pOld[1];\r\n    memcpy(pOld->aData, apOld[i]->aData, pBt->pageSize);\r\n\r\n    limit = pOld->nCell+pOld->nOverflow;\r\n    if( pOld->nOverflow>0 ){\r\n      for(j=0; j<limit; j++){\r\n        assert( nCell<nMaxCells );\r\n        apCell[nCell] = findOverflowCell(pOld, j);\r\n        szCell[nCell] = cellSizePtr(pOld, apCell[nCell]);\r\n        nCell++;\r\n      }\r\n    }else{\r\n      u8 *aData = pOld->aData;\r\n      u16 maskPage = pOld->maskPage;\r\n      u16 cellOffset = pOld->cellOffset;\r\n      for(j=0; j<limit; j++){\r\n        assert( nCell<nMaxCells );\r\n        apCell[nCell] = findCellv2(aData, maskPage, cellOffset, j);\r\n        szCell[nCell] = cellSizePtr(pOld, apCell[nCell]);\r\n        nCell++;\r\n      }\r\n    }       \r\n    if( i<nOld-1 && !leafData){\r\n      u16 sz = (u16)szNew[i];\r\n      u8 *pTemp;\r\n      assert( nCell<nMaxCells );\r\n      szCell[nCell] = sz;\r\n      pTemp = &aSpace1[iSpace1];\r\n      iSpace1 += sz;\r\n      assert( sz<=pBt->maxLocal+23 );\r\n      assert( iSpace1 <= (int)pBt->pageSize );\r\n      memcpy(pTemp, apDiv[i], sz);\r\n      apCell[nCell] = pTemp+leafCorrection;\r\n      assert( leafCorrection==0 || leafCorrection==4 );\r\n      szCell[nCell] = szCell[nCell] - leafCorrection;\r\n      if( !pOld->leaf ){\r\n        assert( leafCorrection==0 );\r\n        assert( pOld->hdrOffset==0 );\r\n        /* The right pointer of the child page pOld becomes the left\r\n        ** pointer of the divider cell */\r\n        memcpy(apCell[nCell], &pOld->aData[8], 4);\r\n      }else{\r\n        assert( leafCorrection==4 );\r\n        if( szCell[nCell]<4 ){\r\n          /* Do not allow any cells smaller than 4 bytes. */\r\n          szCell[nCell] = 4;\r\n        }\r\n      }\r\n      nCell++;\r\n    }\r\n  }\r\n\r\n  /*\r\n  ** Figure out the number of pages needed to hold all nCell cells.\r\n  ** Store this number in \"k\".  Also compute szNew[] which is the total\r\n  ** size of all cells on the i-th page and cntNew[] which is the index\r\n  ** in apCell[] of the cell that divides page i from page i+1.  \r\n  ** cntNew[k] should equal nCell.\r\n  **\r\n  ** Values computed by this block:\r\n  **\r\n  **           k: The total number of sibling pages\r\n  **    szNew[i]: Spaced used on the i-th sibling page.\r\n  **   cntNew[i]: Index in apCell[] and szCell[] for the first cell to\r\n  **              the right of the i-th sibling page.\r\n  ** usableSpace: Number of bytes of space available on each sibling.\r\n  ** \r\n  */\r\n  usableSpace = pBt->usableSize - 12 + leafCorrection;\r\n  for(subtotal=k=i=0; i<nCell; i++){\r\n    assert( i<nMaxCells );\r\n    subtotal += szCell[i] + 2;\r\n    if( subtotal > usableSpace ){\r\n      szNew[k] = subtotal - szCell[i];\r\n      cntNew[k] = i;\r\n      if( leafData ){ i--; }\r\n      subtotal = 0;\r\n      k++;\r\n      if( k>NB+1 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }\r\n    }\r\n  }\r\n  szNew[k] = subtotal;\r\n  cntNew[k] = nCell;\r\n  k++;\r\n\r\n  /*\r\n  ** The packing computed by the previous block is biased toward the siblings\r\n  ** on the left side.  The left siblings are always nearly full, while the\r\n  ** right-most sibling might be nearly empty.  This block of code attempts\r\n  ** to adjust the packing of siblings to get a better balance.\r\n  **\r\n  ** This adjustment is more than an optimization.  The packing above might\r\n  ** be so out of balance as to be illegal.  For example, the right-most\r\n  ** sibling might be completely empty.  This adjustment is not optional.\r\n  */\r\n  for(i=k-1; i>0; i--){\r\n    int szRight = szNew[i];  /* Size of sibling on the right */\r\n    int szLeft = szNew[i-1]; /* Size of sibling on the left */\r\n    int r;              /* Index of right-most cell in left sibling */\r\n    int d;              /* Index of first cell to the left of right sibling */\r\n\r\n    r = cntNew[i-1] - 1;\r\n    d = r + 1 - leafData;\r\n    assert( d<nMaxCells );\r\n    assert( r<nMaxCells );\r\n    while( szRight==0 || szRight+szCell[d]+2<=szLeft-(szCell[r]+2) ){\r\n      szRight += szCell[d] + 2;\r\n      szLeft -= szCell[r] + 2;\r\n      cntNew[i-1]--;\r\n      r = cntNew[i-1] - 1;\r\n      d = r + 1 - leafData;\r\n    }\r\n    szNew[i] = szRight;\r\n    szNew[i-1] = szLeft;\r\n  }\r\n\r\n  /* Either we found one or more cells (cntnew[0])>0) or pPage is\r\n  ** a virtual root page.  A virtual root page is when the real root\r\n  ** page is page 1 and we are the only child of that page.\r\n  **\r\n  ** UPDATE:  The assert() below is not necessarily true if the database\r\n  ** file is corrupt.  The corruption will be detected and reported later\r\n  ** in this procedure so there is no need to act upon it now.\r\n  */\r\n#if 0\r\n  assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );\r\n#endif\r\n\r\n  TRACE((\"BALANCE: old: %d %d %d  \",\r\n    apOld[0]->pgno, \r\n    nOld>=2 ? apOld[1]->pgno : 0,\r\n    nOld>=3 ? apOld[2]->pgno : 0\r\n  ));\r\n\r\n  /*\r\n  ** Allocate k new pages.  Reuse old pages where possible.\r\n  */\r\n  if( apOld[0]->pgno<=1 ){\r\n    rc = SQLITE_CORRUPT_BKPT;\r\n    goto balance_cleanup;\r\n  }\r\n  pageFlags = apOld[0]->aData[0];\r\n  for(i=0; i<k; i++){\r\n    MemPage *pNew;\r\n    if( i<nOld ){\r\n      pNew = apNew[i] = apOld[i];\r\n      apOld[i] = 0;\r\n      rc = sqlite3PagerWrite(pNew->pDbPage);\r\n      nNew++;\r\n      if( rc ) goto balance_cleanup;\r\n    }else{\r\n      assert( i>0 );\r\n      rc = allocateBtreePage(pBt, &pNew, &pgno, pgno, 0);\r\n      if( rc ) goto balance_cleanup;\r\n      apNew[i] = pNew;\r\n      nNew++;\r\n\r\n      /* Set the pointer-map entry for the new sibling page. */\r\n      if( ISAUTOVACUUM ){\r\n        ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);\r\n        if( rc!=SQLITE_OK ){\r\n          goto balance_cleanup;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Free any old pages that were not reused as new pages.\r\n  */\r\n  while( i<nOld ){\r\n    freePage(apOld[i], &rc);\r\n    if( rc ) goto balance_cleanup;\r\n    releasePage(apOld[i]);\r\n    apOld[i] = 0;\r\n    i++;\r\n  }\r\n\r\n  /*\r\n  ** Put the new pages in accending order.  This helps to\r\n  ** keep entries in the disk file in order so that a scan\r\n  ** of the table is a linear scan through the file.  That\r\n  ** in turn helps the operating system to deliver pages\r\n  ** from the disk more rapidly.\r\n  **\r\n  ** An O(n^2) insertion sort algorithm is used, but since\r\n  ** n is never more than NB (a small constant), that should\r\n  ** not be a problem.\r\n  **\r\n  ** When NB==3, this one optimization makes the database\r\n  ** about 25% faster for large insertions and deletions.\r\n  */\r\n  for(i=0; i<k-1; i++){\r\n    int minV = apNew[i]->pgno;\r\n    int minI = i;\r\n    for(j=i+1; j<k; j++){\r\n      if( apNew[j]->pgno<(unsigned)minV ){\r\n        minI = j;\r\n        minV = apNew[j]->pgno;\r\n      }\r\n    }\r\n    if( minI>i ){\r\n      MemPage *pT;\r\n      pT = apNew[i];\r\n      apNew[i] = apNew[minI];\r\n      apNew[minI] = pT;\r\n    }\r\n  }\r\n  TRACE((\"new: %d(%d) %d(%d) %d(%d) %d(%d) %d(%d)\\n\",\r\n    apNew[0]->pgno, szNew[0],\r\n    nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,\r\n    nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,\r\n    nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,\r\n    nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0));\r\n\r\n  assert( sqlite3PagerIswriteable(pParent->pDbPage) );\r\n  put4byte(pRight, apNew[nNew-1]->pgno);\r\n\r\n  /*\r\n  ** Evenly distribute the data in apCell[] across the new pages.\r\n  ** Insert divider cells into pParent as necessary.\r\n  */\r\n  j = 0;\r\n  for(i=0; i<nNew; i++){\r\n    /* Assemble the new sibling page. */\r\n    MemPage *pNew = apNew[i];\r\n    assert( j<nMaxCells );\r\n    zeroPage(pNew, pageFlags);\r\n    assemblePage(pNew, cntNew[i]-j, &apCell[j], &szCell[j]);\r\n    assert( pNew->nCell>0 || (nNew==1 && cntNew[0]==0) );\r\n    assert( pNew->nOverflow==0 );\r\n\r\n    j = cntNew[i];\r\n\r\n    /* If the sibling page assembled above was not the right-most sibling,\r\n    ** insert a divider cell into the parent page.\r\n    */\r\n    assert( i<nNew-1 || j==nCell );\r\n    if( j<nCell ){\r\n      u8 *pCell;\r\n      u8 *pTemp;\r\n      int sz;\r\n\r\n      assert( j<nMaxCells );\r\n      pCell = apCell[j];\r\n      sz = szCell[j] + leafCorrection;\r\n      pTemp = &aOvflSpace[iOvflSpace];\r\n      if( !pNew->leaf ){\r\n        memcpy(&pNew->aData[8], pCell, 4);\r\n      }else if( leafData ){\r\n        /* If the tree is a leaf-data tree, and the siblings are leaves, \r\n        ** then there is no divider cell in apCell[]. Instead, the divider \r\n        ** cell consists of the integer key for the right-most cell of \r\n        ** the sibling-page assembled above only.\r\n        */\r\n        CellInfo info;\r\n        j--;\r\n        btreeParseCellPtr(pNew, apCell[j], &info);\r\n        pCell = pTemp;\r\n        sz = 4 + putVarint(&pCell[4], info.nKey);\r\n        pTemp = 0;\r\n      }else{\r\n        pCell -= 4;\r\n        /* Obscure case for non-leaf-data trees: If the cell at pCell was\r\n        ** previously stored on a leaf node, and its reported size was 4\r\n        ** bytes, then it may actually be smaller than this \r\n        ** (see btreeParseCellPtr(), 4 bytes is the minimum size of\r\n        ** any cell). But it is important to pass the correct size to \r\n        ** insertCell(), so reparse the cell now.\r\n        **\r\n        ** Note that this can never happen in an SQLite data file, as all\r\n        ** cells are at least 4 bytes. It only happens in b-trees used\r\n        ** to evaluate \"IN (SELECT ...)\" and similar clauses.\r\n        */\r\n        if( szCell[j]==4 ){\r\n          assert(leafCorrection==4);\r\n          sz = cellSizePtr(pParent, pCell);\r\n        }\r\n      }\r\n      iOvflSpace += sz;\r\n      assert( sz<=pBt->maxLocal+23 );\r\n      assert( iOvflSpace <= (int)pBt->pageSize );\r\n      insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);\r\n      if( rc!=SQLITE_OK ) goto balance_cleanup;\r\n      assert( sqlite3PagerIswriteable(pParent->pDbPage) );\r\n\r\n      j++;\r\n      nxDiv++;\r\n    }\r\n  }\r\n  assert( j==nCell );\r\n  assert( nOld>0 );\r\n  assert( nNew>0 );\r\n  if( (pageFlags & PTF_LEAF)==0 ){\r\n    u8 *zChild = &apCopy[nOld-1]->aData[8];\r\n    memcpy(&apNew[nNew-1]->aData[8], zChild, 4);\r\n  }\r\n\r\n  if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){\r\n    /* The root page of the b-tree now contains no cells. The only sibling\r\n    ** page is the right-child of the parent. Copy the contents of the\r\n    ** child page into the parent, decreasing the overall height of the\r\n    ** b-tree structure by one. This is described as the \"balance-shallower\"\r\n    ** sub-algorithm in some documentation.\r\n    **\r\n    ** If this is an auto-vacuum database, the call to copyNodeContent() \r\n    ** sets all pointer-map entries corresponding to database image pages \r\n    ** for which the pointer is stored within the content being copied.\r\n    **\r\n    ** The second assert below verifies that the child page is defragmented\r\n    ** (it must be, as it was just reconstructed using assemblePage()). This\r\n    ** is important if the parent page happens to be page 1 of the database\r\n    ** image.  */\r\n    assert( nNew==1 );\r\n    assert( apNew[0]->nFree == \r\n        (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2) \r\n    );\r\n    copyNodeContent(apNew[0], pParent, &rc);\r\n    freePage(apNew[0], &rc);\r\n  }else if( ISAUTOVACUUM ){\r\n    /* Fix the pointer-map entries for all the cells that were shifted around. \r\n    ** There are several different types of pointer-map entries that need to\r\n    ** be dealt with by this routine. Some of these have been set already, but\r\n    ** many have not. The following is a summary:\r\n    **\r\n    **   1) The entries associated with new sibling pages that were not\r\n    **      siblings when this function was called. These have already\r\n    **      been set. We don't need to worry about old siblings that were\r\n    **      moved to the free-list - the freePage() code has taken care\r\n    **      of those.\r\n    **\r\n    **   2) The pointer-map entries associated with the first overflow\r\n    **      page in any overflow chains used by new divider cells. These \r\n    **      have also already been taken care of by the insertCell() code.\r\n    **\r\n    **   3) If the sibling pages are not leaves, then the child pages of\r\n    **      cells stored on the sibling pages may need to be updated.\r\n    **\r\n    **   4) If the sibling pages are not internal intkey nodes, then any\r\n    **      overflow pages used by these cells may need to be updated\r\n    **      (internal intkey nodes never contain pointers to overflow pages).\r\n    **\r\n    **   5) If the sibling pages are not leaves, then the pointer-map\r\n    **      entries for the right-child pages of each sibling may need\r\n    **      to be updated.\r\n    **\r\n    ** Cases 1 and 2 are dealt with above by other code. The next\r\n    ** block deals with cases 3 and 4 and the one after that, case 5. Since\r\n    ** setting a pointer map entry is a relatively expensive operation, this\r\n    ** code only sets pointer map entries for child or overflow pages that have\r\n    ** actually moved between pages.  */\r\n    MemPage *pNew = apNew[0];\r\n    MemPage *pOld = apCopy[0];\r\n    int nOverflow = pOld->nOverflow;\r\n    int iNextOld = pOld->nCell + nOverflow;\r\n    int iOverflow = (nOverflow ? pOld->aiOvfl[0] : -1);\r\n    j = 0;                             /* Current 'old' sibling page */\r\n    k = 0;                             /* Current 'new' sibling page */\r\n    for(i=0; i<nCell; i++){\r\n      int isDivider = 0;\r\n      while( i==iNextOld ){\r\n        /* Cell i is the cell immediately following the last cell on old\r\n        ** sibling page j. If the siblings are not leaf pages of an\r\n        ** intkey b-tree, then cell i was a divider cell. */\r\n        assert( j+1 < ArraySize(apCopy) );\r\n        pOld = apCopy[++j];\r\n        iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;\r\n        if( pOld->nOverflow ){\r\n          nOverflow = pOld->nOverflow;\r\n          iOverflow = i + !leafData + pOld->aiOvfl[0];\r\n        }\r\n        isDivider = !leafData;  \r\n      }\r\n\r\n      assert(nOverflow>0 || iOverflow<i );\r\n      assert(nOverflow<2 || pOld->aiOvfl[0]==pOld->aiOvfl[1]-1);\r\n      assert(nOverflow<3 || pOld->aiOvfl[1]==pOld->aiOvfl[2]-1);\r\n      if( i==iOverflow ){\r\n        isDivider = 1;\r\n        if( (--nOverflow)>0 ){\r\n          iOverflow++;\r\n        }\r\n      }\r\n\r\n      if( i==cntNew[k] ){\r\n        /* Cell i is the cell immediately following the last cell on new\r\n        ** sibling page k. If the siblings are not leaf pages of an\r\n        ** intkey b-tree, then cell i is a divider cell.  */\r\n        pNew = apNew[++k];\r\n        if( !leafData ) continue;\r\n      }\r\n      assert( j<nOld );\r\n      assert( k<nNew );\r\n\r\n      /* If the cell was originally divider cell (and is not now) or\r\n      ** an overflow cell, or if the cell was located on a different sibling\r\n      ** page before the balancing, then the pointer map entries associated\r\n      ** with any child or overflow pages need to be updated.  */\r\n      if( isDivider || pOld->pgno!=pNew->pgno ){\r\n        if( !leafCorrection ){\r\n          ptrmapPut(pBt, get4byte(apCell[i]), PTRMAP_BTREE, pNew->pgno, &rc);\r\n        }\r\n        if( szCell[i]>pNew->minLocal ){\r\n          ptrmapPutOvflPtr(pNew, apCell[i], &rc);\r\n        }\r\n      }\r\n    }\r\n\r\n    if( !leafCorrection ){\r\n      for(i=0; i<nNew; i++){\r\n        u32 key = get4byte(&apNew[i]->aData[8]);\r\n        ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);\r\n      }\r\n    }\r\n\r\n#if 0\r\n    /* The ptrmapCheckPages() contains assert() statements that verify that\r\n    ** all pointer map pages are set correctly. This is helpful while \r\n    ** debugging. This is usually disabled because a corrupt database may\r\n    ** cause an assert() statement to fail.  */\r\n    ptrmapCheckPages(apNew, nNew);\r\n    ptrmapCheckPages(&pParent, 1);\r\n#endif\r\n  }\r\n\r\n  assert( pParent->isInit );\r\n  TRACE((\"BALANCE: finished: old=%d new=%d cells=%d\\n\",\r\n          nOld, nNew, nCell));\r\n\r\n  /*\r\n  ** Cleanup before returning.\r\n  */\r\nbalance_cleanup:\r\n  sqlite3ScratchFree(apCell);\r\n  for(i=0; i<nOld; i++){\r\n    releasePage(apOld[i]);\r\n  }\r\n  for(i=0; i<nNew; i++){\r\n    releasePage(apNew[i]);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This function is called when the root page of a b-tree structure is\r\n** overfull (has one or more overflow pages).\r\n**\r\n** A new child page is allocated and the contents of the current root\r\n** page, including overflow cells, are copied into the child. The root\r\n** page is then overwritten to make it an empty page with the right-child \r\n** pointer pointing to the new page.\r\n**\r\n** Before returning, all pointer-map entries corresponding to pages \r\n** that the new child-page now contains pointers to are updated. The\r\n** entry corresponding to the new right-child pointer of the root\r\n** page is also updated.\r\n**\r\n** If successful, *ppChild is set to contain a reference to the child \r\n** page and SQLITE_OK is returned. In this case the caller is required\r\n** to call releasePage() on *ppChild exactly once. If an error occurs,\r\n** an error code is returned and *ppChild is set to 0.\r\n*/\r\nstatic int balance_deeper(MemPage *pRoot, MemPage **ppChild){\r\n  int rc;                        /* Return value from subprocedures */\r\n  MemPage *pChild = 0;           /* Pointer to a new child page */\r\n  Pgno pgnoChild = 0;            /* Page number of the new child page */\r\n  BtShared *pBt = pRoot->pBt;    /* The BTree */\r\n\r\n  assert( pRoot->nOverflow>0 );\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n\r\n  /* Make pRoot, the root page of the b-tree, writable. Allocate a new \r\n  ** page that will become the new right-child of pPage. Copy the contents\r\n  ** of the node stored on pRoot into the new child page.\r\n  */\r\n  rc = sqlite3PagerWrite(pRoot->pDbPage);\r\n  if( rc==SQLITE_OK ){\r\n    rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0);\r\n    copyNodeContent(pRoot, pChild, &rc);\r\n    if( ISAUTOVACUUM ){\r\n      ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc);\r\n    }\r\n  }\r\n  if( rc ){\r\n    *ppChild = 0;\r\n    releasePage(pChild);\r\n    return rc;\r\n  }\r\n  assert( sqlite3PagerIswriteable(pChild->pDbPage) );\r\n  assert( sqlite3PagerIswriteable(pRoot->pDbPage) );\r\n  assert( pChild->nCell==pRoot->nCell );\r\n\r\n  TRACE((\"BALANCE: copy root %d into %d\\n\", pRoot->pgno, pChild->pgno));\r\n\r\n  /* Copy the overflow cells from pRoot to pChild */\r\n  memcpy(pChild->aiOvfl, pRoot->aiOvfl,\r\n         pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));\r\n  memcpy(pChild->apOvfl, pRoot->apOvfl,\r\n         pRoot->nOverflow*sizeof(pRoot->apOvfl[0]));\r\n  pChild->nOverflow = pRoot->nOverflow;\r\n\r\n  /* Zero the contents of pRoot. Then install pChild as the right-child. */\r\n  zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);\r\n  put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);\r\n\r\n  *ppChild = pChild;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The page that pCur currently points to has just been modified in\r\n** some way. This function figures out if this modification means the\r\n** tree needs to be balanced, and if so calls the appropriate balancing \r\n** routine. Balancing routines are:\r\n**\r\n**   balance_quick()\r\n**   balance_deeper()\r\n**   balance_nonroot()\r\n*/\r\nstatic int balance(BtCursor *pCur){\r\n  int rc = SQLITE_OK;\r\n  const int nMin = pCur->pBt->usableSize * 2 / 3;\r\n  u8 aBalanceQuickSpace[13];\r\n  u8 *pFree = 0;\r\n\r\n  TESTONLY( int balance_quick_called = 0 );\r\n  TESTONLY( int balance_deeper_called = 0 );\r\n\r\n  do {\r\n    int iPage = pCur->iPage;\r\n    MemPage *pPage = pCur->apPage[iPage];\r\n\r\n    if( iPage==0 ){\r\n      if( pPage->nOverflow ){\r\n        /* The root page of the b-tree is overfull. In this case call the\r\n        ** balance_deeper() function to create a new child for the root-page\r\n        ** and copy the current contents of the root-page to it. The\r\n        ** next iteration of the do-loop will balance the child page.\r\n        */ \r\n        assert( (balance_deeper_called++)==0 );\r\n        rc = balance_deeper(pPage, &pCur->apPage[1]);\r\n        if( rc==SQLITE_OK ){\r\n          pCur->iPage = 1;\r\n          pCur->aiIdx[0] = 0;\r\n          pCur->aiIdx[1] = 0;\r\n          assert( pCur->apPage[1]->nOverflow );\r\n        }\r\n      }else{\r\n        break;\r\n      }\r\n    }else if( pPage->nOverflow==0 && pPage->nFree<=nMin ){\r\n      break;\r\n    }else{\r\n      MemPage * const pParent = pCur->apPage[iPage-1];\r\n      int const iIdx = pCur->aiIdx[iPage-1];\r\n\r\n      rc = sqlite3PagerWrite(pParent->pDbPage);\r\n      if( rc==SQLITE_OK ){\r\n#ifndef SQLITE_OMIT_QUICKBALANCE\r\n        if( pPage->hasData\r\n         && pPage->nOverflow==1\r\n         && pPage->aiOvfl[0]==pPage->nCell\r\n         && pParent->pgno!=1\r\n         && pParent->nCell==iIdx\r\n        ){\r\n          /* Call balance_quick() to create a new sibling of pPage on which\r\n          ** to store the overflow cell. balance_quick() inserts a new cell\r\n          ** into pParent, which may cause pParent overflow. If this\r\n          ** happens, the next interation of the do-loop will balance pParent \r\n          ** use either balance_nonroot() or balance_deeper(). Until this\r\n          ** happens, the overflow cell is stored in the aBalanceQuickSpace[]\r\n          ** buffer. \r\n          **\r\n          ** The purpose of the following assert() is to check that only a\r\n          ** single call to balance_quick() is made for each call to this\r\n          ** function. If this were not verified, a subtle bug involving reuse\r\n          ** of the aBalanceQuickSpace[] might sneak in.\r\n          */\r\n          assert( (balance_quick_called++)==0 );\r\n          rc = balance_quick(pParent, pPage, aBalanceQuickSpace);\r\n        }else\r\n#endif\r\n        {\r\n          /* In this case, call balance_nonroot() to redistribute cells\r\n          ** between pPage and up to 2 of its sibling pages. This involves\r\n          ** modifying the contents of pParent, which may cause pParent to\r\n          ** become overfull or underfull. The next iteration of the do-loop\r\n          ** will balance the parent page to correct this.\r\n          ** \r\n          ** If the parent page becomes overfull, the overflow cell or cells\r\n          ** are stored in the pSpace buffer allocated immediately below. \r\n          ** A subsequent iteration of the do-loop will deal with this by\r\n          ** calling balance_nonroot() (balance_deeper() may be called first,\r\n          ** but it doesn't deal with overflow cells - just moves them to a\r\n          ** different page). Once this subsequent call to balance_nonroot() \r\n          ** has completed, it is safe to release the pSpace buffer used by\r\n          ** the previous call, as the overflow cell data will have been \r\n          ** copied either into the body of a database page or into the new\r\n          ** pSpace buffer passed to the latter call to balance_nonroot().\r\n          */\r\n          u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize);\r\n          rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1);\r\n          if( pFree ){\r\n            /* If pFree is not NULL, it points to the pSpace buffer used \r\n            ** by a previous call to balance_nonroot(). Its contents are\r\n            ** now stored either on real database pages or within the \r\n            ** new pSpace buffer, so it may be safely freed here. */\r\n            sqlite3PageFree(pFree);\r\n          }\r\n\r\n          /* The pSpace buffer will be freed after the next call to\r\n          ** balance_nonroot(), or just before this function returns, whichever\r\n          ** comes first. */\r\n          pFree = pSpace;\r\n        }\r\n      }\r\n\r\n      pPage->nOverflow = 0;\r\n\r\n      /* The next iteration of the do-loop balances the parent page. */\r\n      releasePage(pPage);\r\n      pCur->iPage--;\r\n    }\r\n  }while( rc==SQLITE_OK );\r\n\r\n  if( pFree ){\r\n    sqlite3PageFree(pFree);\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Insert a new record into the BTree.  The key is given by (pKey,nKey)\r\n** and the data is given by (pData,nData).  The cursor is used only to\r\n** define what table the record should be inserted into.  The cursor\r\n** is left pointing at a random location.\r\n**\r\n** For an INTKEY table, only the nKey value of the key is used.  pKey is\r\n** ignored.  For a ZERODATA table, the pData and nData are both ignored.\r\n**\r\n** If the seekResult parameter is non-zero, then a successful call to\r\n** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already\r\n** been performed. seekResult is the search result returned (a negative\r\n** number if pCur points at an entry that is smaller than (pKey, nKey), or\r\n** a positive value if pCur points at an etry that is larger than \r\n** (pKey, nKey)). \r\n**\r\n** If the seekResult parameter is non-zero, then the caller guarantees that\r\n** cursor pCur is pointing at the existing copy of a row that is to be\r\n** overwritten.  If the seekResult parameter is 0, then cursor pCur may\r\n** point to any entry or to no entry at all and so this function has to seek\r\n** the cursor before the new key can be inserted.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeInsert(\r\n  BtCursor *pCur,                /* Insert data into the table of this cursor */\r\n  const void *pKey, i64 nKey,    /* The key of the new record */\r\n  const void *pData, int nData,  /* The data of the new record */\r\n  int nZero,                     /* Number of extra 0 bytes to append to data */\r\n  int appendBias,                /* True if this is likely an append */\r\n  int seekResult                 /* Result of prior MovetoUnpacked() call */\r\n){\r\n  int rc;\r\n  int loc = seekResult;          /* -1: before desired location  +1: after */\r\n  int szNew = 0;\r\n  int idx;\r\n  MemPage *pPage;\r\n  Btree *p = pCur->pBtree;\r\n  BtShared *pBt = p->pBt;\r\n  unsigned char *oldCell;\r\n  unsigned char *newCell = 0;\r\n\r\n  if( pCur->eState==CURSOR_FAULT ){\r\n    assert( pCur->skipNext!=SQLITE_OK );\r\n    return pCur->skipNext;\r\n  }\r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pCur->wrFlag && pBt->inTransaction==TRANS_WRITE\r\n              && (pBt->btsFlags & BTS_READ_ONLY)==0 );\r\n  assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );\r\n\r\n  /* Assert that the caller has been consistent. If this cursor was opened\r\n  ** expecting an index b-tree, then the caller should be inserting blob\r\n  ** keys with no associated data. If the cursor was opened expecting an\r\n  ** intkey table, the caller should be inserting integer keys with a\r\n  ** blob of associated data.  */\r\n  assert( (pKey==0)==(pCur->pKeyInfo==0) );\r\n\r\n  /* If this is an insert into a table b-tree, invalidate any incrblob \r\n  ** cursors open on the row being replaced (assuming this is a replace\r\n  ** operation - if it is not, the following is a no-op).  */\r\n  if( pCur->pKeyInfo==0 ){\r\n    invalidateIncrblobCursors(p, nKey, 0);\r\n  }\r\n\r\n  /* Save the positions of any other cursors open on this table.\r\n  **\r\n  ** In some cases, the call to btreeMoveto() below is a no-op. For\r\n  ** example, when inserting data into a table with auto-generated integer\r\n  ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the \r\n  ** integer key to use. It then calls this function to actually insert the \r\n  ** data into the intkey B-Tree. In this case btreeMoveto() recognizes\r\n  ** that the cursor is already where it needs to be and returns without\r\n  ** doing any work. To avoid thwarting these optimizations, it is important\r\n  ** not to clear the cursor here.\r\n  */\r\n  rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur);\r\n  if( rc ) return rc;\r\n  if( !loc ){\r\n    rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc);\r\n    if( rc ) return rc;\r\n  }\r\n  assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );\r\n\r\n  pPage = pCur->apPage[pCur->iPage];\r\n  assert( pPage->intKey || nKey>=0 );\r\n  assert( pPage->leaf || !pPage->intKey );\r\n\r\n  TRACE((\"INSERT: table=%d nkey=%lld ndata=%d page=%d %s\\n\",\r\n          pCur->pgnoRoot, nKey, nData, pPage->pgno,\r\n          loc==0 ? \"overwrite\" : \"new entry\"));\r\n  assert( pPage->isInit );\r\n  allocateTempSpace(pBt);\r\n  newCell = pBt->pTmpSpace;\r\n  if( newCell==0 ) return SQLITE_NOMEM;\r\n  rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew);\r\n  if( rc ) goto end_insert;\r\n  assert( szNew==cellSizePtr(pPage, newCell) );\r\n  assert( szNew <= MX_CELL_SIZE(pBt) );\r\n  idx = pCur->aiIdx[pCur->iPage];\r\n  if( loc==0 ){\r\n    u16 szOld;\r\n    assert( idx<pPage->nCell );\r\n    rc = sqlite3PagerWrite(pPage->pDbPage);\r\n    if( rc ){\r\n      goto end_insert;\r\n    }\r\n    oldCell = findCell(pPage, idx);\r\n    if( !pPage->leaf ){\r\n      memcpy(newCell, oldCell, 4);\r\n    }\r\n    szOld = cellSizePtr(pPage, oldCell);\r\n    rc = clearCell(pPage, oldCell);\r\n    dropCell(pPage, idx, szOld, &rc);\r\n    if( rc ) goto end_insert;\r\n  }else if( loc<0 && pPage->nCell>0 ){\r\n    assert( pPage->leaf );\r\n    idx = ++pCur->aiIdx[pCur->iPage];\r\n  }else{\r\n    assert( pPage->leaf );\r\n  }\r\n  insertCell(pPage, idx, newCell, szNew, 0, 0, &rc);\r\n  assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );\r\n\r\n  /* If no error has occured and pPage has an overflow cell, call balance() \r\n  ** to redistribute the cells within the tree. Since balance() may move\r\n  ** the cursor, zero the BtCursor.info.nSize and BtCursor.validNKey\r\n  ** variables.\r\n  **\r\n  ** Previous versions of SQLite called moveToRoot() to move the cursor\r\n  ** back to the root page as balance() used to invalidate the contents\r\n  ** of BtCursor.apPage[] and BtCursor.aiIdx[]. Instead of doing that,\r\n  ** set the cursor state to \"invalid\". This makes common insert operations\r\n  ** slightly faster.\r\n  **\r\n  ** There is a subtle but important optimization here too. When inserting\r\n  ** multiple records into an intkey b-tree using a single cursor (as can\r\n  ** happen while processing an \"INSERT INTO ... SELECT\" statement), it\r\n  ** is advantageous to leave the cursor pointing to the last entry in\r\n  ** the b-tree if possible. If the cursor is left pointing to the last\r\n  ** entry in the table, and the next row inserted has an integer key\r\n  ** larger than the largest existing key, it is possible to insert the\r\n  ** row without seeking the cursor. This can be a big performance boost.\r\n  */\r\n  pCur->info.nSize = 0;\r\n  pCur->validNKey = 0;\r\n  if( rc==SQLITE_OK && pPage->nOverflow ){\r\n    rc = balance(pCur);\r\n\r\n    /* Must make sure nOverflow is reset to zero even if the balance()\r\n    ** fails. Internal data structure corruption will result otherwise. \r\n    ** Also, set the cursor state to invalid. This stops saveCursorPosition()\r\n    ** from trying to save the current position of the cursor.  */\r\n    pCur->apPage[pCur->iPage]->nOverflow = 0;\r\n    pCur->eState = CURSOR_INVALID;\r\n  }\r\n  assert( pCur->apPage[pCur->iPage]->nOverflow==0 );\r\n\r\nend_insert:\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Delete the entry that the cursor is pointing to.  The cursor\r\n** is left pointing at a arbitrary location.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur){\r\n  Btree *p = pCur->pBtree;\r\n  BtShared *pBt = p->pBt;              \r\n  int rc;                              /* Return code */\r\n  MemPage *pPage;                      /* Page to delete cell from */\r\n  unsigned char *pCell;                /* Pointer to cell to delete */\r\n  int iCellIdx;                        /* Index of cell to delete */\r\n  int iCellDepth;                      /* Depth of node containing pCell */ \r\n\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( pBt->inTransaction==TRANS_WRITE );\r\n  assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );\r\n  assert( pCur->wrFlag );\r\n  assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );\r\n  assert( !hasReadConflicts(p, pCur->pgnoRoot) );\r\n\r\n  if( NEVER(pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell) \r\n   || NEVER(pCur->eState!=CURSOR_VALID)\r\n  ){\r\n    return SQLITE_ERROR;  /* Something has gone awry. */\r\n  }\r\n\r\n  /* If this is a delete operation to remove a row from a table b-tree,\r\n  ** invalidate any incrblob cursors open on the row being deleted.  */\r\n  if( pCur->pKeyInfo==0 ){\r\n    invalidateIncrblobCursors(p, pCur->info.nKey, 0);\r\n  }\r\n\r\n  iCellDepth = pCur->iPage;\r\n  iCellIdx = pCur->aiIdx[iCellDepth];\r\n  pPage = pCur->apPage[iCellDepth];\r\n  pCell = findCell(pPage, iCellIdx);\r\n\r\n  /* If the page containing the entry to delete is not a leaf page, move\r\n  ** the cursor to the largest entry in the tree that is smaller than\r\n  ** the entry being deleted. This cell will replace the cell being deleted\r\n  ** from the internal node. The 'previous' entry is used for this instead\r\n  ** of the 'next' entry, as the previous entry is always a part of the\r\n  ** sub-tree headed by the child page of the cell being deleted. This makes\r\n  ** balancing the tree following the delete operation easier.  */\r\n  if( !pPage->leaf ){\r\n    int notUsed;\r\n    rc = sqlite3BtreePrevious(pCur, &notUsed);\r\n    if( rc ) return rc;\r\n  }\r\n\r\n  /* Save the positions of any other cursors open on this table before\r\n  ** making any modifications. Make the page containing the entry to be \r\n  ** deleted writable. Then free any overflow pages associated with the \r\n  ** entry and finally remove the cell itself from within the page.  \r\n  */\r\n  rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur);\r\n  if( rc ) return rc;\r\n  rc = sqlite3PagerWrite(pPage->pDbPage);\r\n  if( rc ) return rc;\r\n  rc = clearCell(pPage, pCell);\r\n  dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell), &rc);\r\n  if( rc ) return rc;\r\n\r\n  /* If the cell deleted was not located on a leaf page, then the cursor\r\n  ** is currently pointing to the largest entry in the sub-tree headed\r\n  ** by the child-page of the cell that was just deleted from an internal\r\n  ** node. The cell from the leaf node needs to be moved to the internal\r\n  ** node to replace the deleted cell.  */\r\n  if( !pPage->leaf ){\r\n    MemPage *pLeaf = pCur->apPage[pCur->iPage];\r\n    int nCell;\r\n    Pgno n = pCur->apPage[iCellDepth+1]->pgno;\r\n    unsigned char *pTmp;\r\n\r\n    pCell = findCell(pLeaf, pLeaf->nCell-1);\r\n    nCell = cellSizePtr(pLeaf, pCell);\r\n    assert( MX_CELL_SIZE(pBt) >= nCell );\r\n\r\n    allocateTempSpace(pBt);\r\n    pTmp = pBt->pTmpSpace;\r\n\r\n    rc = sqlite3PagerWrite(pLeaf->pDbPage);\r\n    insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc);\r\n    dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc);\r\n    if( rc ) return rc;\r\n  }\r\n\r\n  /* Balance the tree. If the entry deleted was located on a leaf page,\r\n  ** then the cursor still points to that page. In this case the first\r\n  ** call to balance() repairs the tree, and the if(...) condition is\r\n  ** never true.\r\n  **\r\n  ** Otherwise, if the entry deleted was on an internal node page, then\r\n  ** pCur is pointing to the leaf page from which a cell was removed to\r\n  ** replace the cell deleted from the internal node. This is slightly\r\n  ** tricky as the leaf node may be underfull, and the internal node may\r\n  ** be either under or overfull. In this case run the balancing algorithm\r\n  ** on the leaf node first. If the balance proceeds far enough up the\r\n  ** tree that we can be sure that any problem in the internal node has\r\n  ** been corrected, so be it. Otherwise, after balancing the leaf node,\r\n  ** walk the cursor up the tree to the internal node and balance it as \r\n  ** well.  */\r\n  rc = balance(pCur);\r\n  if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){\r\n    while( pCur->iPage>iCellDepth ){\r\n      releasePage(pCur->apPage[pCur->iPage--]);\r\n    }\r\n    rc = balance(pCur);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    moveToRoot(pCur);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Create a new BTree table.  Write into *piTable the page\r\n** number for the root page of the new table.\r\n**\r\n** The type of type is determined by the flags parameter.  Only the\r\n** following values of flags are currently in use.  Other values for\r\n** flags might not work:\r\n**\r\n**     BTREE_INTKEY|BTREE_LEAFDATA     Used for SQL tables with rowid keys\r\n**     BTREE_ZERODATA                  Used for SQL indices\r\n*/\r\nstatic int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){\r\n  BtShared *pBt = p->pBt;\r\n  MemPage *pRoot;\r\n  Pgno pgnoRoot;\r\n  int rc;\r\n  int ptfFlags;          /* Page-type flage for the root page of new table */\r\n\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( pBt->inTransaction==TRANS_WRITE );\r\n  assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );\r\n\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n  rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);\r\n  if( rc ){\r\n    return rc;\r\n  }\r\n#else\r\n  if( pBt->autoVacuum ){\r\n    Pgno pgnoMove;      /* Move a page here to make room for the root-page */\r\n    MemPage *pPageMove; /* The page to move to. */\r\n\r\n    /* Creating a new table may probably require moving an existing database\r\n    ** to make room for the new tables root page. In case this page turns\r\n    ** out to be an overflow page, delete all overflow page-map caches\r\n    ** held by open cursors.\r\n    */\r\n    invalidateAllOverflowCache(pBt);\r\n\r\n    /* Read the value of meta[3] from the database to determine where the\r\n    ** root page of the new table should go. meta[3] is the largest root-page\r\n    ** created so far, so the new root-page is (meta[3]+1).\r\n    */\r\n    sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);\r\n    pgnoRoot++;\r\n\r\n    /* The new root-page may not be allocated on a pointer-map page, or the\r\n    ** PENDING_BYTE page.\r\n    */\r\n    while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||\r\n        pgnoRoot==PENDING_BYTE_PAGE(pBt) ){\r\n      pgnoRoot++;\r\n    }\r\n    assert( pgnoRoot>=3 );\r\n\r\n    /* Allocate a page. The page that currently resides at pgnoRoot will\r\n    ** be moved to the allocated page (unless the allocated page happens\r\n    ** to reside at pgnoRoot).\r\n    */\r\n    rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, 1);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n\r\n    if( pgnoMove!=pgnoRoot ){\r\n      /* pgnoRoot is the page that will be used for the root-page of\r\n      ** the new table (assuming an error did not occur). But we were\r\n      ** allocated pgnoMove. If required (i.e. if it was not allocated\r\n      ** by extending the file), the current page at position pgnoMove\r\n      ** is already journaled.\r\n      */\r\n      u8 eType = 0;\r\n      Pgno iPtrPage = 0;\r\n\r\n      releasePage(pPageMove);\r\n\r\n      /* Move the page currently at pgnoRoot to pgnoMove. */\r\n      rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n      rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);\r\n      if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){\r\n        rc = SQLITE_CORRUPT_BKPT;\r\n      }\r\n      if( rc!=SQLITE_OK ){\r\n        releasePage(pRoot);\r\n        return rc;\r\n      }\r\n      assert( eType!=PTRMAP_ROOTPAGE );\r\n      assert( eType!=PTRMAP_FREEPAGE );\r\n      rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0);\r\n      releasePage(pRoot);\r\n\r\n      /* Obtain the page at pgnoRoot */\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n      rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n      rc = sqlite3PagerWrite(pRoot->pDbPage);\r\n      if( rc!=SQLITE_OK ){\r\n        releasePage(pRoot);\r\n        return rc;\r\n      }\r\n    }else{\r\n      pRoot = pPageMove;\r\n    } \r\n\r\n    /* Update the pointer-map and meta-data with the new root-page number. */\r\n    ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc);\r\n    if( rc ){\r\n      releasePage(pRoot);\r\n      return rc;\r\n    }\r\n\r\n    /* When the new root page was allocated, page 1 was made writable in\r\n    ** order either to increase the database filesize, or to decrement the\r\n    ** freelist count.  Hence, the sqlite3BtreeUpdateMeta() call cannot fail.\r\n    */\r\n    assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) );\r\n    rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot);\r\n    if( NEVER(rc) ){\r\n      releasePage(pRoot);\r\n      return rc;\r\n    }\r\n\r\n  }else{\r\n    rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);\r\n    if( rc ) return rc;\r\n  }\r\n#endif\r\n  assert( sqlite3PagerIswriteable(pRoot->pDbPage) );\r\n  if( createTabFlags & BTREE_INTKEY ){\r\n    ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF;\r\n  }else{\r\n    ptfFlags = PTF_ZERODATA | PTF_LEAF;\r\n  }\r\n  zeroPage(pRoot, ptfFlags);\r\n  sqlite3PagerUnref(pRoot->pDbPage);\r\n  assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );\r\n  *piTable = (int)pgnoRoot;\r\n  return SQLITE_OK;\r\n}\r\nSQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){\r\n  int rc;\r\n  sqlite3BtreeEnter(p);\r\n  rc = btreeCreateTable(p, piTable, flags);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Erase the given database page and all its children.  Return\r\n** the page to the freelist.\r\n*/\r\nstatic int clearDatabasePage(\r\n  BtShared *pBt,           /* The BTree that contains the table */\r\n  Pgno pgno,               /* Page number to clear */\r\n  int freePageFlag,        /* Deallocate page if true */\r\n  int *pnChange            /* Add number of Cells freed to this counter */\r\n){\r\n  MemPage *pPage;\r\n  int rc;\r\n  unsigned char *pCell;\r\n  int i;\r\n\r\n  assert( sqlite3_mutex_held(pBt->mutex) );\r\n  if( pgno>btreePagecount(pBt) ){\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n\r\n  rc = getAndInitPage(pBt, pgno, &pPage);\r\n  if( rc ) return rc;\r\n  for(i=0; i<pPage->nCell; i++){\r\n    pCell = findCell(pPage, i);\r\n    if( !pPage->leaf ){\r\n      rc = clearDatabasePage(pBt, get4byte(pCell), 1, pnChange);\r\n      if( rc ) goto cleardatabasepage_out;\r\n    }\r\n    rc = clearCell(pPage, pCell);\r\n    if( rc ) goto cleardatabasepage_out;\r\n  }\r\n  if( !pPage->leaf ){\r\n    rc = clearDatabasePage(pBt, get4byte(&pPage->aData[8]), 1, pnChange);\r\n    if( rc ) goto cleardatabasepage_out;\r\n  }else if( pnChange ){\r\n    assert( pPage->intKey );\r\n    *pnChange += pPage->nCell;\r\n  }\r\n  if( freePageFlag ){\r\n    freePage(pPage, &rc);\r\n  }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){\r\n    zeroPage(pPage, pPage->aData[0] | PTF_LEAF);\r\n  }\r\n\r\ncleardatabasepage_out:\r\n  releasePage(pPage);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Delete all information from a single table in the database.  iTable is\r\n** the page number of the root of the table.  After this routine returns,\r\n** the root page is empty, but still exists.\r\n**\r\n** This routine will fail with SQLITE_LOCKED if there are any open\r\n** read cursors on the table.  Open write cursors are moved to the\r\n** root of the table.\r\n**\r\n** If pnChange is not NULL, then table iTable must be an intkey table. The\r\n** integer value pointed to by pnChange is incremented by the number of\r\n** entries in the table.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){\r\n  int rc;\r\n  BtShared *pBt = p->pBt;\r\n  sqlite3BtreeEnter(p);\r\n  assert( p->inTrans==TRANS_WRITE );\r\n\r\n  /* Invalidate all incrblob cursors open on table iTable (assuming iTable\r\n  ** is the root of a table b-tree - if it is not, the following call is\r\n  ** a no-op).  */\r\n  invalidateIncrblobCursors(p, 0, 1);\r\n\r\n  rc = saveAllCursors(pBt, (Pgno)iTable, 0);\r\n  if( SQLITE_OK==rc ){\r\n    rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);\r\n  }\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Erase all information in a table and add the root of the table to\r\n** the freelist.  Except, the root of the principle table (the one on\r\n** page 1) is never added to the freelist.\r\n**\r\n** This routine will fail with SQLITE_LOCKED if there are any open\r\n** cursors on the table.\r\n**\r\n** If AUTOVACUUM is enabled and the page at iTable is not the last\r\n** root page in the database file, then the last root page \r\n** in the database file is moved into the slot formerly occupied by\r\n** iTable and that last slot formerly occupied by the last root page\r\n** is added to the freelist instead of iTable.  In this say, all\r\n** root pages are kept at the beginning of the database file, which\r\n** is necessary for AUTOVACUUM to work right.  *piMoved is set to the \r\n** page number that used to be the last root page in the file before\r\n** the move.  If no page gets moved, *piMoved is set to 0.\r\n** The last root page is recorded in meta[3] and the value of\r\n** meta[3] is updated by this procedure.\r\n*/\r\nstatic int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){\r\n  int rc;\r\n  MemPage *pPage = 0;\r\n  BtShared *pBt = p->pBt;\r\n\r\n  assert( sqlite3BtreeHoldsMutex(p) );\r\n  assert( p->inTrans==TRANS_WRITE );\r\n\r\n  /* It is illegal to drop a table if any cursors are open on the\r\n  ** database. This is because in auto-vacuum mode the backend may\r\n  ** need to move another root-page to fill a gap left by the deleted\r\n  ** root page. If an open cursor was using this page a problem would \r\n  ** occur.\r\n  **\r\n  ** This error is caught long before control reaches this point.\r\n  */\r\n  if( NEVER(pBt->pCursor) ){\r\n    sqlite3ConnectionBlocked(p->db, pBt->pCursor->pBtree->db);\r\n    return SQLITE_LOCKED_SHAREDCACHE;\r\n  }\r\n\r\n  rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);\r\n  if( rc ) return rc;\r\n  rc = sqlite3BtreeClearTable(p, iTable, 0);\r\n  if( rc ){\r\n    releasePage(pPage);\r\n    return rc;\r\n  }\r\n\r\n  *piMoved = 0;\r\n\r\n  if( iTable>1 ){\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n    freePage(pPage, &rc);\r\n    releasePage(pPage);\r\n#else\r\n    if( pBt->autoVacuum ){\r\n      Pgno maxRootPgno;\r\n      sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &maxRootPgno);\r\n\r\n      if( iTable==maxRootPgno ){\r\n        /* If the table being dropped is the table with the largest root-page\r\n        ** number in the database, put the root page on the free list. \r\n        */\r\n        freePage(pPage, &rc);\r\n        releasePage(pPage);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n      }else{\r\n        /* The table being dropped does not have the largest root-page\r\n        ** number in the database. So move the page that does into the \r\n        ** gap left by the deleted root-page.\r\n        */\r\n        MemPage *pMove;\r\n        releasePage(pPage);\r\n        rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        rc = relocatePage(pBt, pMove, PTRMAP_ROOTPAGE, 0, iTable, 0);\r\n        releasePage(pMove);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        pMove = 0;\r\n        rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);\r\n        freePage(pMove, &rc);\r\n        releasePage(pMove);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        *piMoved = maxRootPgno;\r\n      }\r\n\r\n      /* Set the new 'max-root-page' value in the database header. This\r\n      ** is the old value less one, less one more if that happens to\r\n      ** be a root-page number, less one again if that is the\r\n      ** PENDING_BYTE_PAGE.\r\n      */\r\n      maxRootPgno--;\r\n      while( maxRootPgno==PENDING_BYTE_PAGE(pBt)\r\n             || PTRMAP_ISPAGE(pBt, maxRootPgno) ){\r\n        maxRootPgno--;\r\n      }\r\n      assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) );\r\n\r\n      rc = sqlite3BtreeUpdateMeta(p, 4, maxRootPgno);\r\n    }else{\r\n      freePage(pPage, &rc);\r\n      releasePage(pPage);\r\n    }\r\n#endif\r\n  }else{\r\n    /* If sqlite3BtreeDropTable was called on page 1.\r\n    ** This really never should happen except in a corrupt\r\n    ** database. \r\n    */\r\n    zeroPage(pPage, PTF_INTKEY|PTF_LEAF );\r\n    releasePage(pPage);\r\n  }\r\n  return rc;  \r\n}\r\nSQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){\r\n  int rc;\r\n  sqlite3BtreeEnter(p);\r\n  rc = btreeDropTable(p, iTable, piMoved);\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This function may only be called if the b-tree connection already\r\n** has a read or write transaction open on the database.\r\n**\r\n** Read the meta-information out of a database file.  Meta[0]\r\n** is the number of free pages currently in the database.  Meta[1]\r\n** through meta[15] are available for use by higher layers.  Meta[0]\r\n** is read-only, the others are read/write.\r\n** \r\n** The schema layer numbers meta values differently.  At the schema\r\n** layer (and the SetCookie and ReadCookie opcodes) the number of\r\n** free pages is not visible.  So Cookie[0] is the same as Meta[1].\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){\r\n  BtShared *pBt = p->pBt;\r\n\r\n  sqlite3BtreeEnter(p);\r\n  assert( p->inTrans>TRANS_NONE );\r\n  assert( SQLITE_OK==querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK) );\r\n  assert( pBt->pPage1 );\r\n  assert( idx>=0 && idx<=15 );\r\n\r\n  *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);\r\n\r\n  /* If auto-vacuum is disabled in this build and this is an auto-vacuum\r\n  ** database, mark the database as read-only.  */\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n  if( idx==BTREE_LARGEST_ROOT_PAGE && *pMeta>0 ){\r\n    pBt->btsFlags |= BTS_READ_ONLY;\r\n  }\r\n#endif\r\n\r\n  sqlite3BtreeLeave(p);\r\n}\r\n\r\n/*\r\n** Write meta-information back into the database.  Meta[0] is\r\n** read-only and may not be written.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){\r\n  BtShared *pBt = p->pBt;\r\n  unsigned char *pP1;\r\n  int rc;\r\n  assert( idx>=1 && idx<=15 );\r\n  sqlite3BtreeEnter(p);\r\n  assert( p->inTrans==TRANS_WRITE );\r\n  assert( pBt->pPage1!=0 );\r\n  pP1 = pBt->pPage1->aData;\r\n  rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\r\n  if( rc==SQLITE_OK ){\r\n    put4byte(&pP1[36 + idx*4], iMeta);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( idx==BTREE_INCR_VACUUM ){\r\n      assert( pBt->autoVacuum || iMeta==0 );\r\n      assert( iMeta==0 || iMeta==1 );\r\n      pBt->incrVacuum = (u8)iMeta;\r\n    }\r\n#endif\r\n  }\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_BTREECOUNT\r\n/*\r\n** The first argument, pCur, is a cursor opened on some b-tree. Count the\r\n** number of entries in the b-tree and write the result to *pnEntry.\r\n**\r\n** SQLITE_OK is returned if the operation is successfully executed. \r\n** Otherwise, if an error is encountered (i.e. an IO error or database\r\n** corruption) an SQLite error code is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){\r\n  i64 nEntry = 0;                      /* Value to return in *pnEntry */\r\n  int rc;                              /* Return code */\r\n\r\n  if( pCur->pgnoRoot==0 ){\r\n    *pnEntry = 0;\r\n    return SQLITE_OK;\r\n  }\r\n  rc = moveToRoot(pCur);\r\n\r\n  /* Unless an error occurs, the following loop runs one iteration for each\r\n  ** page in the B-Tree structure (not including overflow pages). \r\n  */\r\n  while( rc==SQLITE_OK ){\r\n    int iIdx;                          /* Index of child node in parent */\r\n    MemPage *pPage;                    /* Current page of the b-tree */\r\n\r\n    /* If this is a leaf page or the tree is not an int-key tree, then \r\n    ** this page contains countable entries. Increment the entry counter\r\n    ** accordingly.\r\n    */\r\n    pPage = pCur->apPage[pCur->iPage];\r\n    if( pPage->leaf || !pPage->intKey ){\r\n      nEntry += pPage->nCell;\r\n    }\r\n\r\n    /* pPage is a leaf node. This loop navigates the cursor so that it \r\n    ** points to the first interior cell that it points to the parent of\r\n    ** the next page in the tree that has not yet been visited. The\r\n    ** pCur->aiIdx[pCur->iPage] value is set to the index of the parent cell\r\n    ** of the page, or to the number of cells in the page if the next page\r\n    ** to visit is the right-child of its parent.\r\n    **\r\n    ** If all pages in the tree have been visited, return SQLITE_OK to the\r\n    ** caller.\r\n    */\r\n    if( pPage->leaf ){\r\n      do {\r\n        if( pCur->iPage==0 ){\r\n          /* All pages of the b-tree have been visited. Return successfully. */\r\n          *pnEntry = nEntry;\r\n          return SQLITE_OK;\r\n        }\r\n        moveToParent(pCur);\r\n      }while ( pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell );\r\n\r\n      pCur->aiIdx[pCur->iPage]++;\r\n      pPage = pCur->apPage[pCur->iPage];\r\n    }\r\n\r\n    /* Descend to the child node of the cell that the cursor currently \r\n    ** points at. This is the right-child if (iIdx==pPage->nCell).\r\n    */\r\n    iIdx = pCur->aiIdx[pCur->iPage];\r\n    if( iIdx==pPage->nCell ){\r\n      rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));\r\n    }else{\r\n      rc = moveToChild(pCur, get4byte(findCell(pPage, iIdx)));\r\n    }\r\n  }\r\n\r\n  /* An error has occurred. Return an error code. */\r\n  return rc;\r\n}\r\n#endif\r\n\r\n/*\r\n** Return the pager associated with a BTree.  This routine is used for\r\n** testing and debugging only.\r\n*/\r\nSQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){\r\n  return p->pBt->pPager;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\r\n/*\r\n** Append a message to the error message string.\r\n*/\r\nstatic void checkAppendMsg(\r\n  IntegrityCk *pCheck,\r\n  char *zMsg1,\r\n  const char *zFormat,\r\n  ...\r\n){\r\n  va_list ap;\r\n  if( !pCheck->mxErr ) return;\r\n  pCheck->mxErr--;\r\n  pCheck->nErr++;\r\n  va_start(ap, zFormat);\r\n  if( pCheck->errMsg.nChar ){\r\n    sqlite3StrAccumAppend(&pCheck->errMsg, \"\\n\", 1);\r\n  }\r\n  if( zMsg1 ){\r\n    sqlite3StrAccumAppend(&pCheck->errMsg, zMsg1, -1);\r\n  }\r\n  sqlite3VXPrintf(&pCheck->errMsg, 1, zFormat, ap);\r\n  va_end(ap);\r\n  if( pCheck->errMsg.mallocFailed ){\r\n    pCheck->mallocFailed = 1;\r\n  }\r\n}\r\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\r\n\r\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\r\n/*\r\n** Add 1 to the reference count for page iPage.  If this is the second\r\n** reference to the page, add an error message to pCheck->zErrMsg.\r\n** Return 1 if there are 2 ore more references to the page and 0 if\r\n** if this is the first reference to the page.\r\n**\r\n** Also check that the page number is in bounds.\r\n*/\r\nstatic int checkRef(IntegrityCk *pCheck, Pgno iPage, char *zContext){\r\n  if( iPage==0 ) return 1;\r\n  if( iPage>pCheck->nPage ){\r\n    checkAppendMsg(pCheck, zContext, \"invalid page number %d\", iPage);\r\n    return 1;\r\n  }\r\n  if( pCheck->anRef[iPage]==1 ){\r\n    checkAppendMsg(pCheck, zContext, \"2nd reference to page %d\", iPage);\r\n    return 1;\r\n  }\r\n  return  (pCheck->anRef[iPage]++)>1;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n/*\r\n** Check that the entry in the pointer-map for page iChild maps to \r\n** page iParent, pointer type ptrType. If not, append an error message\r\n** to pCheck.\r\n*/\r\nstatic void checkPtrmap(\r\n  IntegrityCk *pCheck,   /* Integrity check context */\r\n  Pgno iChild,           /* Child page number */\r\n  u8 eType,              /* Expected pointer map type */\r\n  Pgno iParent,          /* Expected pointer map parent page number */\r\n  char *zContext         /* Context description (used for error msg) */\r\n){\r\n  int rc;\r\n  u8 ePtrmapType;\r\n  Pgno iPtrmapParent;\r\n\r\n  rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);\r\n  if( rc!=SQLITE_OK ){\r\n    if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1;\r\n    checkAppendMsg(pCheck, zContext, \"Failed to read ptrmap key=%d\", iChild);\r\n    return;\r\n  }\r\n\r\n  if( ePtrmapType!=eType || iPtrmapParent!=iParent ){\r\n    checkAppendMsg(pCheck, zContext, \r\n      \"Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\", \r\n      iChild, eType, iParent, ePtrmapType, iPtrmapParent);\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** Check the integrity of the freelist or of an overflow page list.\r\n** Verify that the number of pages on the list is N.\r\n*/\r\nstatic void checkList(\r\n  IntegrityCk *pCheck,  /* Integrity checking context */\r\n  int isFreeList,       /* True for a freelist.  False for overflow page list */\r\n  int iPage,            /* Page number for first page in the list */\r\n  int N,                /* Expected number of pages in the list */\r\n  char *zContext        /* Context for error messages */\r\n){\r\n  int i;\r\n  int expected = N;\r\n  int iFirst = iPage;\r\n  while( N-- > 0 && pCheck->mxErr ){\r\n    DbPage *pOvflPage;\r\n    unsigned char *pOvflData;\r\n    if( iPage<1 ){\r\n      checkAppendMsg(pCheck, zContext,\r\n         \"%d of %d pages missing from overflow list starting at %d\",\r\n          N+1, expected, iFirst);\r\n      break;\r\n    }\r\n    if( checkRef(pCheck, iPage, zContext) ) break;\r\n    if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage) ){\r\n      checkAppendMsg(pCheck, zContext, \"failed to get page %d\", iPage);\r\n      break;\r\n    }\r\n    pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);\r\n    if( isFreeList ){\r\n      int n = get4byte(&pOvflData[4]);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      if( pCheck->pBt->autoVacuum ){\r\n        checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0, zContext);\r\n      }\r\n#endif\r\n      if( n>(int)pCheck->pBt->usableSize/4-2 ){\r\n        checkAppendMsg(pCheck, zContext,\r\n           \"freelist leaf count too big on page %d\", iPage);\r\n        N--;\r\n      }else{\r\n        for(i=0; i<n; i++){\r\n          Pgno iFreePage = get4byte(&pOvflData[8+i*4]);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n          if( pCheck->pBt->autoVacuum ){\r\n            checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0, zContext);\r\n          }\r\n#endif\r\n          checkRef(pCheck, iFreePage, zContext);\r\n        }\r\n        N -= n;\r\n      }\r\n    }\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    else{\r\n      /* If this database supports auto-vacuum and iPage is not the last\r\n      ** page in this overflow list, check that the pointer-map entry for\r\n      ** the following page matches iPage.\r\n      */\r\n      if( pCheck->pBt->autoVacuum && N>0 ){\r\n        i = get4byte(pOvflData);\r\n        checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage, zContext);\r\n      }\r\n    }\r\n#endif\r\n    iPage = get4byte(pOvflData);\r\n    sqlite3PagerUnref(pOvflPage);\r\n  }\r\n}\r\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\r\n\r\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\r\n/*\r\n** Do various sanity checks on a single page of a tree.  Return\r\n** the tree depth.  Root pages return 0.  Parents of root pages\r\n** return 1, and so forth.\r\n** \r\n** These checks are done:\r\n**\r\n**      1.  Make sure that cells and freeblocks do not overlap\r\n**          but combine to completely cover the page.\r\n**  NO  2.  Make sure cell keys are in order.\r\n**  NO  3.  Make sure no key is less than or equal to zLowerBound.\r\n**  NO  4.  Make sure no key is greater than or equal to zUpperBound.\r\n**      5.  Check the integrity of overflow pages.\r\n**      6.  Recursively call checkTreePage on all children.\r\n**      7.  Verify that the depth of all children is the same.\r\n**      8.  Make sure this page is at least 33% full or else it is\r\n**          the root of the tree.\r\n*/\r\nstatic int checkTreePage(\r\n  IntegrityCk *pCheck,  /* Context for the sanity check */\r\n  int iPage,            /* Page number of the page to check */\r\n  char *zParentContext, /* Parent context */\r\n  i64 *pnParentMinKey, \r\n  i64 *pnParentMaxKey\r\n){\r\n  MemPage *pPage;\r\n  int i, rc, depth, d2, pgno, cnt;\r\n  int hdr, cellStart;\r\n  int nCell;\r\n  u8 *data;\r\n  BtShared *pBt;\r\n  int usableSize;\r\n  char zContext[100];\r\n  char *hit = 0;\r\n  i64 nMinKey = 0;\r\n  i64 nMaxKey = 0;\r\n\r\n  sqlite3_snprintf(sizeof(zContext), zContext, \"Page %d: \", iPage);\r\n\r\n  /* Check that the page exists\r\n  */\r\n  pBt = pCheck->pBt;\r\n  usableSize = pBt->usableSize;\r\n  if( iPage==0 ) return 0;\r\n  if( checkRef(pCheck, iPage, zParentContext) ) return 0;\r\n  if( (rc = btreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){\r\n    checkAppendMsg(pCheck, zContext,\r\n       \"unable to get the page. error code=%d\", rc);\r\n    return 0;\r\n  }\r\n\r\n  /* Clear MemPage.isInit to make sure the corruption detection code in\r\n  ** btreeInitPage() is executed.  */\r\n  pPage->isInit = 0;\r\n  if( (rc = btreeInitPage(pPage))!=0 ){\r\n    assert( rc==SQLITE_CORRUPT );  /* The only possible error from InitPage */\r\n    checkAppendMsg(pCheck, zContext, \r\n                   \"btreeInitPage() returns error code %d\", rc);\r\n    releasePage(pPage);\r\n    return 0;\r\n  }\r\n\r\n  /* Check out all the cells.\r\n  */\r\n  depth = 0;\r\n  for(i=0; i<pPage->nCell && pCheck->mxErr; i++){\r\n    u8 *pCell;\r\n    u32 sz;\r\n    CellInfo info;\r\n\r\n    /* Check payload overflow pages\r\n    */\r\n    sqlite3_snprintf(sizeof(zContext), zContext,\r\n             \"On tree page %d cell %d: \", iPage, i);\r\n    pCell = findCell(pPage,i);\r\n    btreeParseCellPtr(pPage, pCell, &info);\r\n    sz = info.nData;\r\n    if( !pPage->intKey ) sz += (int)info.nKey;\r\n    /* For intKey pages, check that the keys are in order.\r\n    */\r\n    else if( i==0 ) nMinKey = nMaxKey = info.nKey;\r\n    else{\r\n      if( info.nKey <= nMaxKey ){\r\n        checkAppendMsg(pCheck, zContext, \r\n            \"Rowid %lld out of order (previous was %lld)\", info.nKey, nMaxKey);\r\n      }\r\n      nMaxKey = info.nKey;\r\n    }\r\n    assert( sz==info.nPayload );\r\n    if( (sz>info.nLocal) \r\n     && (&pCell[info.iOverflow]<=&pPage->aData[pBt->usableSize])\r\n    ){\r\n      int nPage = (sz - info.nLocal + usableSize - 5)/(usableSize - 4);\r\n      Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      if( pBt->autoVacuum ){\r\n        checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage, zContext);\r\n      }\r\n#endif\r\n      checkList(pCheck, 0, pgnoOvfl, nPage, zContext);\r\n    }\r\n\r\n    /* Check sanity of left child page.\r\n    */\r\n    if( !pPage->leaf ){\r\n      pgno = get4byte(pCell);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n      if( pBt->autoVacuum ){\r\n        checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);\r\n      }\r\n#endif\r\n      d2 = checkTreePage(pCheck, pgno, zContext, &nMinKey, i==0 ? NULL : &nMaxKey);\r\n      if( i>0 && d2!=depth ){\r\n        checkAppendMsg(pCheck, zContext, \"Child page depth differs\");\r\n      }\r\n      depth = d2;\r\n    }\r\n  }\r\n\r\n  if( !pPage->leaf ){\r\n    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);\r\n    sqlite3_snprintf(sizeof(zContext), zContext, \r\n                     \"On page %d at right child: \", iPage);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( pBt->autoVacuum ){\r\n      checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);\r\n    }\r\n#endif\r\n    checkTreePage(pCheck, pgno, zContext, NULL, !pPage->nCell ? NULL : &nMaxKey);\r\n  }\r\n \r\n  /* For intKey leaf pages, check that the min/max keys are in order\r\n  ** with any left/parent/right pages.\r\n  */\r\n  if( pPage->leaf && pPage->intKey ){\r\n    /* if we are a left child page */\r\n    if( pnParentMinKey ){\r\n      /* if we are the left most child page */\r\n      if( !pnParentMaxKey ){\r\n        if( nMaxKey > *pnParentMinKey ){\r\n          checkAppendMsg(pCheck, zContext, \r\n              \"Rowid %lld out of order (max larger than parent min of %lld)\",\r\n              nMaxKey, *pnParentMinKey);\r\n        }\r\n      }else{\r\n        if( nMinKey <= *pnParentMinKey ){\r\n          checkAppendMsg(pCheck, zContext, \r\n              \"Rowid %lld out of order (min less than parent min of %lld)\",\r\n              nMinKey, *pnParentMinKey);\r\n        }\r\n        if( nMaxKey > *pnParentMaxKey ){\r\n          checkAppendMsg(pCheck, zContext, \r\n              \"Rowid %lld out of order (max larger than parent max of %lld)\",\r\n              nMaxKey, *pnParentMaxKey);\r\n        }\r\n        *pnParentMinKey = nMaxKey;\r\n      }\r\n    /* else if we're a right child page */\r\n    } else if( pnParentMaxKey ){\r\n      if( nMinKey <= *pnParentMaxKey ){\r\n        checkAppendMsg(pCheck, zContext, \r\n            \"Rowid %lld out of order (min less than parent max of %lld)\",\r\n            nMinKey, *pnParentMaxKey);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Check for complete coverage of the page\r\n  */\r\n  data = pPage->aData;\r\n  hdr = pPage->hdrOffset;\r\n  hit = sqlite3PageMalloc( pBt->pageSize );\r\n  if( hit==0 ){\r\n    pCheck->mallocFailed = 1;\r\n  }else{\r\n    int contentOffset = get2byteNotZero(&data[hdr+5]);\r\n    assert( contentOffset<=usableSize );  /* Enforced by btreeInitPage() */\r\n    memset(hit+contentOffset, 0, usableSize-contentOffset);\r\n    memset(hit, 1, contentOffset);\r\n    nCell = get2byte(&data[hdr+3]);\r\n    cellStart = hdr + 12 - 4*pPage->leaf;\r\n    for(i=0; i<nCell; i++){\r\n      int pc = get2byte(&data[cellStart+i*2]);\r\n      u32 size = 65536;\r\n      int j;\r\n      if( pc<=usableSize-4 ){\r\n        size = cellSizePtr(pPage, &data[pc]);\r\n      }\r\n      if( (int)(pc+size-1)>=usableSize ){\r\n        checkAppendMsg(pCheck, 0, \r\n            \"Corruption detected in cell %d on page %d\",i,iPage);\r\n      }else{\r\n        for(j=pc+size-1; j>=pc; j--) hit[j]++;\r\n      }\r\n    }\r\n    i = get2byte(&data[hdr+1]);\r\n    while( i>0 ){\r\n      int size, j;\r\n      assert( i<=usableSize-4 );     /* Enforced by btreeInitPage() */\r\n      size = get2byte(&data[i+2]);\r\n      assert( i+size<=usableSize );  /* Enforced by btreeInitPage() */\r\n      for(j=i+size-1; j>=i; j--) hit[j]++;\r\n      j = get2byte(&data[i]);\r\n      assert( j==0 || j>i+size );  /* Enforced by btreeInitPage() */\r\n      assert( j<=usableSize-4 );   /* Enforced by btreeInitPage() */\r\n      i = j;\r\n    }\r\n    for(i=cnt=0; i<usableSize; i++){\r\n      if( hit[i]==0 ){\r\n        cnt++;\r\n      }else if( hit[i]>1 ){\r\n        checkAppendMsg(pCheck, 0,\r\n          \"Multiple uses for byte %d of page %d\", i, iPage);\r\n        break;\r\n      }\r\n    }\r\n    if( cnt!=data[hdr+7] ){\r\n      checkAppendMsg(pCheck, 0, \r\n          \"Fragmentation of %d bytes reported as %d on page %d\",\r\n          cnt, data[hdr+7], iPage);\r\n    }\r\n  }\r\n  sqlite3PageFree(hit);\r\n  releasePage(pPage);\r\n  return depth+1;\r\n}\r\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\r\n\r\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\r\n/*\r\n** This routine does a complete check of the given BTree file.  aRoot[] is\r\n** an array of pages numbers were each page number is the root page of\r\n** a table.  nRoot is the number of entries in aRoot.\r\n**\r\n** A read-only or read-write transaction must be opened before calling\r\n** this function.\r\n**\r\n** Write the number of error seen in *pnErr.  Except for some memory\r\n** allocation errors,  an error message held in memory obtained from\r\n** malloc is returned if *pnErr is non-zero.  If *pnErr==0 then NULL is\r\n** returned.  If a memory allocation error occurs, NULL is returned.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(\r\n  Btree *p,     /* The btree to be checked */\r\n  int *aRoot,   /* An array of root pages numbers for individual trees */\r\n  int nRoot,    /* Number of entries in aRoot[] */\r\n  int mxErr,    /* Stop reporting errors after this many */\r\n  int *pnErr    /* Write number of errors seen to this variable */\r\n){\r\n  Pgno i;\r\n  int nRef;\r\n  IntegrityCk sCheck;\r\n  BtShared *pBt = p->pBt;\r\n  char zErr[100];\r\n\r\n  sqlite3BtreeEnter(p);\r\n  assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE );\r\n  nRef = sqlite3PagerRefcount(pBt->pPager);\r\n  sCheck.pBt = pBt;\r\n  sCheck.pPager = pBt->pPager;\r\n  sCheck.nPage = btreePagecount(sCheck.pBt);\r\n  sCheck.mxErr = mxErr;\r\n  sCheck.nErr = 0;\r\n  sCheck.mallocFailed = 0;\r\n  *pnErr = 0;\r\n  if( sCheck.nPage==0 ){\r\n    sqlite3BtreeLeave(p);\r\n    return 0;\r\n  }\r\n  sCheck.anRef = sqlite3Malloc( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );\r\n  if( !sCheck.anRef ){\r\n    *pnErr = 1;\r\n    sqlite3BtreeLeave(p);\r\n    return 0;\r\n  }\r\n  for(i=0; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }\r\n  i = PENDING_BYTE_PAGE(pBt);\r\n  if( i<=sCheck.nPage ){\r\n    sCheck.anRef[i] = 1;\r\n  }\r\n  sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), 20000);\r\n  sCheck.errMsg.useMalloc = 2;\r\n\r\n  /* Check the integrity of the freelist\r\n  */\r\n  checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),\r\n            get4byte(&pBt->pPage1->aData[36]), \"Main freelist: \");\r\n\r\n  /* Check all the tables.\r\n  */\r\n  for(i=0; (int)i<nRoot && sCheck.mxErr; i++){\r\n    if( aRoot[i]==0 ) continue;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( pBt->autoVacuum && aRoot[i]>1 ){\r\n      checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0, 0);\r\n    }\r\n#endif\r\n    checkTreePage(&sCheck, aRoot[i], \"List of tree roots: \", NULL, NULL);\r\n  }\r\n\r\n  /* Make sure every page in the file is referenced\r\n  */\r\n  for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n    if( sCheck.anRef[i]==0 ){\r\n      checkAppendMsg(&sCheck, 0, \"Page %d is never used\", i);\r\n    }\r\n#else\r\n    /* If the database supports auto-vacuum, make sure no tables contain\r\n    ** references to pointer-map pages.\r\n    */\r\n    if( sCheck.anRef[i]==0 && \r\n       (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){\r\n      checkAppendMsg(&sCheck, 0, \"Page %d is never used\", i);\r\n    }\r\n    if( sCheck.anRef[i]!=0 && \r\n       (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){\r\n      checkAppendMsg(&sCheck, 0, \"Pointer map page %d is referenced\", i);\r\n    }\r\n#endif\r\n  }\r\n\r\n  /* Make sure this analysis did not leave any unref() pages.\r\n  ** This is an internal consistency check; an integrity check\r\n  ** of the integrity check.\r\n  */\r\n  if( NEVER(nRef != sqlite3PagerRefcount(pBt->pPager)) ){\r\n    checkAppendMsg(&sCheck, 0, \r\n      \"Outstanding page count goes from %d to %d during this analysis\",\r\n      nRef, sqlite3PagerRefcount(pBt->pPager)\r\n    );\r\n  }\r\n\r\n  /* Clean  up and report errors.\r\n  */\r\n  sqlite3BtreeLeave(p);\r\n  sqlite3_free(sCheck.anRef);\r\n  if( sCheck.mallocFailed ){\r\n    sqlite3StrAccumReset(&sCheck.errMsg);\r\n    *pnErr = sCheck.nErr+1;\r\n    return 0;\r\n  }\r\n  *pnErr = sCheck.nErr;\r\n  if( sCheck.nErr==0 ) sqlite3StrAccumReset(&sCheck.errMsg);\r\n  return sqlite3StrAccumFinish(&sCheck.errMsg);\r\n}\r\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\r\n\r\n/*\r\n** Return the full pathname of the underlying database file.\r\n**\r\n** The pager filename is invariant as long as the pager is\r\n** open so it is safe to access without the BtShared mutex.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){\r\n  assert( p->pBt->pPager!=0 );\r\n  return sqlite3PagerFilename(p->pBt->pPager);\r\n}\r\n\r\n/*\r\n** Return the pathname of the journal file for this database. The return\r\n** value of this routine is the same regardless of whether the journal file\r\n** has been created or not.\r\n**\r\n** The pager journal filename is invariant as long as the pager is\r\n** open so it is safe to access without the BtShared mutex.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *p){\r\n  assert( p->pBt->pPager!=0 );\r\n  return sqlite3PagerJournalname(p->pBt->pPager);\r\n}\r\n\r\n/*\r\n** Return non-zero if a transaction is active.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree *p){\r\n  assert( p==0 || sqlite3_mutex_held(p->db->mutex) );\r\n  return (p && (p->inTrans==TRANS_WRITE));\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/*\r\n** Run a checkpoint on the Btree passed as the first argument.\r\n**\r\n** Return SQLITE_LOCKED if this or any other connection has an open \r\n** transaction on the shared-cache the argument Btree is connected to.\r\n**\r\n** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){\r\n  int rc = SQLITE_OK;\r\n  if( p ){\r\n    BtShared *pBt = p->pBt;\r\n    sqlite3BtreeEnter(p);\r\n    if( pBt->inTransaction!=TRANS_NONE ){\r\n      rc = SQLITE_LOCKED;\r\n    }else{\r\n      rc = sqlite3PagerCheckpoint(pBt->pPager, eMode, pnLog, pnCkpt);\r\n    }\r\n    sqlite3BtreeLeave(p);\r\n  }\r\n  return rc;\r\n}\r\n#endif\r\n\r\n/*\r\n** Return non-zero if a read (or write) transaction is active.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree *p){\r\n  assert( p );\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  return p->inTrans!=TRANS_NONE;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){\r\n  assert( p );\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  return p->nBackup!=0;\r\n}\r\n\r\n/*\r\n** This function returns a pointer to a blob of memory associated with\r\n** a single shared-btree. The memory is used by client code for its own\r\n** purposes (for example, to store a high-level schema associated with \r\n** the shared-btree). The btree layer manages reference counting issues.\r\n**\r\n** The first time this is called on a shared-btree, nBytes bytes of memory\r\n** are allocated, zeroed, and returned to the caller. For each subsequent \r\n** call the nBytes parameter is ignored and a pointer to the same blob\r\n** of memory returned. \r\n**\r\n** If the nBytes parameter is 0 and the blob of memory has not yet been\r\n** allocated, a null pointer is returned. If the blob has already been\r\n** allocated, it is returned as normal.\r\n**\r\n** Just before the shared-btree is closed, the function passed as the \r\n** xFree argument when the memory allocation was made is invoked on the \r\n** blob of allocated memory. The xFree function should not call sqlite3_free()\r\n** on the memory, the btree layer does that.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){\r\n  BtShared *pBt = p->pBt;\r\n  sqlite3BtreeEnter(p);\r\n  if( !pBt->pSchema && nBytes ){\r\n    pBt->pSchema = sqlite3DbMallocZero(0, nBytes);\r\n    pBt->xFreeSchema = xFree;\r\n  }\r\n  sqlite3BtreeLeave(p);\r\n  return pBt->pSchema;\r\n}\r\n\r\n/*\r\n** Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared \r\n** btree as the argument handle holds an exclusive lock on the \r\n** sqlite_master table. Otherwise SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){\r\n  int rc;\r\n  assert( sqlite3_mutex_held(p->db->mutex) );\r\n  sqlite3BtreeEnter(p);\r\n  rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK);\r\n  assert( rc==SQLITE_OK || rc==SQLITE_LOCKED_SHAREDCACHE );\r\n  sqlite3BtreeLeave(p);\r\n  return rc;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/*\r\n** Obtain a lock on the table whose root page is iTab.  The\r\n** lock is a write lock if isWritelock is true or a read lock\r\n** if it is false.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){\r\n  int rc = SQLITE_OK;\r\n  assert( p->inTrans!=TRANS_NONE );\r\n  if( p->sharable ){\r\n    u8 lockType = READ_LOCK + isWriteLock;\r\n    assert( READ_LOCK+1==WRITE_LOCK );\r\n    assert( isWriteLock==0 || isWriteLock==1 );\r\n\r\n    sqlite3BtreeEnter(p);\r\n    rc = querySharedCacheTableLock(p, iTab, lockType);\r\n    if( rc==SQLITE_OK ){\r\n      rc = setSharedCacheTableLock(p, iTab, lockType);\r\n    }\r\n    sqlite3BtreeLeave(p);\r\n  }\r\n  return rc;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n/*\r\n** Argument pCsr must be a cursor opened for writing on an \r\n** INTKEY table currently pointing at a valid table entry. \r\n** This function modifies the data stored as part of that entry.\r\n**\r\n** Only the data content may only be modified, it is not possible to \r\n** change the length of the data stored. If this function is called with\r\n** parameters that attempt to write past the end of the existing data,\r\n** no modifications are made and SQLITE_CORRUPT is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){\r\n  int rc;\r\n  assert( cursorHoldsMutex(pCsr) );\r\n  assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) );\r\n  assert( pCsr->isIncrblobHandle );\r\n\r\n  rc = restoreCursorPosition(pCsr);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n  assert( pCsr->eState!=CURSOR_REQUIRESEEK );\r\n  if( pCsr->eState!=CURSOR_VALID ){\r\n    return SQLITE_ABORT;\r\n  }\r\n\r\n  /* Check some assumptions: \r\n  **   (a) the cursor is open for writing,\r\n  **   (b) there is a read/write transaction open,\r\n  **   (c) the connection holds a write-lock on the table (if required),\r\n  **   (d) there are no conflicting read-locks, and\r\n  **   (e) the cursor points at a valid row of an intKey table.\r\n  */\r\n  if( !pCsr->wrFlag ){\r\n    return SQLITE_READONLY;\r\n  }\r\n  assert( (pCsr->pBt->btsFlags & BTS_READ_ONLY)==0\r\n              && pCsr->pBt->inTransaction==TRANS_WRITE );\r\n  assert( hasSharedCacheTableLock(pCsr->pBtree, pCsr->pgnoRoot, 0, 2) );\r\n  assert( !hasReadConflicts(pCsr->pBtree, pCsr->pgnoRoot) );\r\n  assert( pCsr->apPage[pCsr->iPage]->intKey );\r\n\r\n  return accessPayload(pCsr, offset, amt, (unsigned char *)z, 1);\r\n}\r\n\r\n/* \r\n** Set a flag on this cursor to cache the locations of pages from the \r\n** overflow list for the current row. This is used by cursors opened\r\n** for incremental blob IO only.\r\n**\r\n** This function sets a flag only. The actual page location cache\r\n** (stored in BtCursor.aOverflow[]) is allocated and used by function\r\n** accessPayload() (the worker function for sqlite3BtreeData() and\r\n** sqlite3BtreePutData()).\r\n*/\r\nSQLITE_PRIVATE void sqlite3BtreeCacheOverflow(BtCursor *pCur){\r\n  assert( cursorHoldsMutex(pCur) );\r\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\r\n  invalidateOverflowCache(pCur);\r\n  pCur->isIncrblobHandle = 1;\r\n}\r\n#endif\r\n\r\n/*\r\n** Set both the \"read version\" (single byte at byte offset 18) and \r\n** \"write version\" (single byte at byte offset 19) fields in the database\r\n** header to iVersion.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){\r\n  BtShared *pBt = pBtree->pBt;\r\n  int rc;                         /* Return code */\r\n \r\n  assert( iVersion==1 || iVersion==2 );\r\n\r\n  /* If setting the version fields to 1, do not automatically open the\r\n  ** WAL connection, even if the version fields are currently set to 2.\r\n  */\r\n  pBt->btsFlags &= ~BTS_NO_WAL;\r\n  if( iVersion==1 ) pBt->btsFlags |= BTS_NO_WAL;\r\n\r\n  rc = sqlite3BtreeBeginTrans(pBtree, 0);\r\n  if( rc==SQLITE_OK ){\r\n    u8 *aData = pBt->pPage1->aData;\r\n    if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){\r\n      rc = sqlite3BtreeBeginTrans(pBtree, 2);\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\r\n        if( rc==SQLITE_OK ){\r\n          aData[18] = (u8)iVersion;\r\n          aData[19] = (u8)iVersion;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  pBt->btsFlags &= ~BTS_NO_WAL;\r\n  return rc;\r\n}\r\n\r\n/************** End of btree.c ***********************************************/\r\n/************** Begin file backup.c ******************************************/\r\n/*\r\n** 2009 January 28\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the implementation of the sqlite3_backup_XXX() \r\n** API functions and the related features.\r\n*/\r\n\r\n/* Macro to find the minimum of two numeric values.\r\n*/\r\n#ifndef MIN\r\n# define MIN(x,y) ((x)<(y)?(x):(y))\r\n#endif\r\n\r\n/*\r\n** Structure allocated for each backup operation.\r\n*/\r\nstruct sqlite3_backup {\r\n  sqlite3* pDestDb;        /* Destination database handle */\r\n  Btree *pDest;            /* Destination b-tree file */\r\n  u32 iDestSchema;         /* Original schema cookie in destination */\r\n  int bDestLocked;         /* True once a write-transaction is open on pDest */\r\n\r\n  Pgno iNext;              /* Page number of the next source page to copy */\r\n  sqlite3* pSrcDb;         /* Source database handle */\r\n  Btree *pSrc;             /* Source b-tree file */\r\n\r\n  int rc;                  /* Backup process error code */\r\n\r\n  /* These two variables are set by every call to backup_step(). They are\r\n  ** read by calls to backup_remaining() and backup_pagecount().\r\n  */\r\n  Pgno nRemaining;         /* Number of pages left to copy */\r\n  Pgno nPagecount;         /* Total number of pages to copy */\r\n\r\n  int isAttached;          /* True once backup has been registered with pager */\r\n  sqlite3_backup *pNext;   /* Next backup associated with source pager */\r\n};\r\n\r\n/*\r\n** THREAD SAFETY NOTES:\r\n**\r\n**   Once it has been created using backup_init(), a single sqlite3_backup\r\n**   structure may be accessed via two groups of thread-safe entry points:\r\n**\r\n**     * Via the sqlite3_backup_XXX() API function backup_step() and \r\n**       backup_finish(). Both these functions obtain the source database\r\n**       handle mutex and the mutex associated with the source BtShared \r\n**       structure, in that order.\r\n**\r\n**     * Via the BackupUpdate() and BackupRestart() functions, which are\r\n**       invoked by the pager layer to report various state changes in\r\n**       the page cache associated with the source database. The mutex\r\n**       associated with the source database BtShared structure will always \r\n**       be held when either of these functions are invoked.\r\n**\r\n**   The other sqlite3_backup_XXX() API functions, backup_remaining() and\r\n**   backup_pagecount() are not thread-safe functions. If they are called\r\n**   while some other thread is calling backup_step() or backup_finish(),\r\n**   the values returned may be invalid. There is no way for a call to\r\n**   BackupUpdate() or BackupRestart() to interfere with backup_remaining()\r\n**   or backup_pagecount().\r\n**\r\n**   Depending on the SQLite configuration, the database handles and/or\r\n**   the Btree objects may have their own mutexes that require locking.\r\n**   Non-sharable Btrees (in-memory databases for example), do not have\r\n**   associated mutexes.\r\n*/\r\n\r\n/*\r\n** Return a pointer corresponding to database zDb (i.e. \"main\", \"temp\")\r\n** in connection handle pDb. If such a database cannot be found, return\r\n** a NULL pointer and write an error message to pErrorDb.\r\n**\r\n** If the \"temp\" database is requested, it may need to be opened by this \r\n** function. If an error occurs while doing so, return 0 and write an \r\n** error message to pErrorDb.\r\n*/\r\nstatic Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){\r\n  int i = sqlite3FindDbName(pDb, zDb);\r\n\r\n  if( i==1 ){\r\n    Parse *pParse;\r\n    int rc = 0;\r\n    pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse));\r\n    if( pParse==0 ){\r\n      sqlite3Error(pErrorDb, SQLITE_NOMEM, \"out of memory\");\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      pParse->db = pDb;\r\n      if( sqlite3OpenTempDatabase(pParse) ){\r\n        sqlite3Error(pErrorDb, pParse->rc, \"%s\", pParse->zErrMsg);\r\n        rc = SQLITE_ERROR;\r\n      }\r\n      sqlite3DbFree(pErrorDb, pParse->zErrMsg);\r\n      sqlite3StackFree(pErrorDb, pParse);\r\n    }\r\n    if( rc ){\r\n      return 0;\r\n    }\r\n  }\r\n\r\n  if( i<0 ){\r\n    sqlite3Error(pErrorDb, SQLITE_ERROR, \"unknown database %s\", zDb);\r\n    return 0;\r\n  }\r\n\r\n  return pDb->aDb[i].pBt;\r\n}\r\n\r\n/*\r\n** Attempt to set the page size of the destination to match the page size\r\n** of the source.\r\n*/\r\nstatic int setDestPgsz(sqlite3_backup *p){\r\n  int rc;\r\n  rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Create an sqlite3_backup process to copy the contents of zSrcDb from\r\n** connection handle pSrcDb to zDestDb in pDestDb. If successful, return\r\n** a pointer to the new sqlite3_backup object.\r\n**\r\n** If an error occurs, NULL is returned and an error code and error message\r\n** stored in database handle pDestDb.\r\n*/\r\nSQLITE_API sqlite3_backup *sqlite3_backup_init(\r\n  sqlite3* pDestDb,                     /* Database to write to */\r\n  const char *zDestDb,                  /* Name of database within pDestDb */\r\n  sqlite3* pSrcDb,                      /* Database connection to read from */\r\n  const char *zSrcDb                    /* Name of database within pSrcDb */\r\n){\r\n  sqlite3_backup *p;                    /* Value to return */\r\n\r\n  /* Lock the source database handle. The destination database\r\n  ** handle is not locked in this routine, but it is locked in\r\n  ** sqlite3_backup_step(). The user is required to ensure that no\r\n  ** other thread accesses the destination handle for the duration\r\n  ** of the backup operation.  Any attempt to use the destination\r\n  ** database connection while a backup is in progress may cause\r\n  ** a malfunction or a deadlock.\r\n  */\r\n  sqlite3_mutex_enter(pSrcDb->mutex);\r\n  sqlite3_mutex_enter(pDestDb->mutex);\r\n\r\n  if( pSrcDb==pDestDb ){\r\n    sqlite3Error(\r\n        pDestDb, SQLITE_ERROR, \"source and destination must be distinct\"\r\n    );\r\n    p = 0;\r\n  }else {\r\n    /* Allocate space for a new sqlite3_backup object...\r\n    ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a\r\n    ** call to sqlite3_backup_init() and is destroyed by a call to\r\n    ** sqlite3_backup_finish(). */\r\n    p = (sqlite3_backup *)sqlite3_malloc(sizeof(sqlite3_backup));\r\n    if( !p ){\r\n      sqlite3Error(pDestDb, SQLITE_NOMEM, 0);\r\n    }\r\n  }\r\n\r\n  /* If the allocation succeeded, populate the new object. */\r\n  if( p ){\r\n    memset(p, 0, sizeof(sqlite3_backup));\r\n    p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);\r\n    p->pDest = findBtree(pDestDb, pDestDb, zDestDb);\r\n    p->pDestDb = pDestDb;\r\n    p->pSrcDb = pSrcDb;\r\n    p->iNext = 1;\r\n    p->isAttached = 0;\r\n\r\n    if( 0==p->pSrc || 0==p->pDest || setDestPgsz(p)==SQLITE_NOMEM ){\r\n      /* One (or both) of the named databases did not exist or an OOM\r\n      ** error was hit.  The error has already been written into the\r\n      ** pDestDb handle.  All that is left to do here is free the\r\n      ** sqlite3_backup structure.\r\n      */\r\n      sqlite3_free(p);\r\n      p = 0;\r\n    }\r\n  }\r\n  if( p ){\r\n    p->pSrc->nBackup++;\r\n  }\r\n\r\n  sqlite3_mutex_leave(pDestDb->mutex);\r\n  sqlite3_mutex_leave(pSrcDb->mutex);\r\n  return p;\r\n}\r\n\r\n/*\r\n** Argument rc is an SQLite error code. Return true if this error is \r\n** considered fatal if encountered during a backup operation. All errors\r\n** are considered fatal except for SQLITE_BUSY and SQLITE_LOCKED.\r\n*/\r\nstatic int isFatalError(int rc){\r\n  return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED));\r\n}\r\n\r\n/*\r\n** Parameter zSrcData points to a buffer containing the data for \r\n** page iSrcPg from the source database. Copy this data into the \r\n** destination database.\r\n*/\r\nstatic int backupOnePage(sqlite3_backup *p, Pgno iSrcPg, const u8 *zSrcData){\r\n  Pager * const pDestPager = sqlite3BtreePager(p->pDest);\r\n  const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);\r\n  int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest);\r\n  const int nCopy = MIN(nSrcPgsz, nDestPgsz);\r\n  const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz;\r\n#ifdef SQLITE_HAS_CODEC\r\n  int nSrcReserve = sqlite3BtreeGetReserve(p->pSrc);\r\n  int nDestReserve = sqlite3BtreeGetReserve(p->pDest);\r\n#endif\r\n\r\n  int rc = SQLITE_OK;\r\n  i64 iOff;\r\n\r\n  assert( p->bDestLocked );\r\n  assert( !isFatalError(p->rc) );\r\n  assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) );\r\n  assert( zSrcData );\r\n\r\n  /* Catch the case where the destination is an in-memory database and the\r\n  ** page sizes of the source and destination differ. \r\n  */\r\n  if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){\r\n    rc = SQLITE_READONLY;\r\n  }\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n  /* Backup is not possible if the page size of the destination is changing\r\n  ** and a codec is in use.\r\n  */\r\n  if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){\r\n    rc = SQLITE_READONLY;\r\n  }\r\n\r\n  /* Backup is not possible if the number of bytes of reserve space differ\r\n  ** between source and destination.  If there is a difference, try to\r\n  ** fix the destination to agree with the source.  If that is not possible,\r\n  ** then the backup cannot proceed.\r\n  */\r\n  if( nSrcReserve!=nDestReserve ){\r\n    u32 newPgsz = nSrcPgsz;\r\n    rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve);\r\n    if( rc==SQLITE_OK && newPgsz!=nSrcPgsz ) rc = SQLITE_READONLY;\r\n  }\r\n#endif\r\n\r\n  /* This loop runs once for each destination page spanned by the source \r\n  ** page. For each iteration, variable iOff is set to the byte offset\r\n  ** of the destination page.\r\n  */\r\n  for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOff<iEnd; iOff+=nDestPgsz){\r\n    DbPage *pDestPg = 0;\r\n    Pgno iDest = (Pgno)(iOff/nDestPgsz)+1;\r\n    if( iDest==PENDING_BYTE_PAGE(p->pDest->pBt) ) continue;\r\n    if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg))\r\n     && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg))\r\n    ){\r\n      const u8 *zIn = &zSrcData[iOff%nSrcPgsz];\r\n      u8 *zDestData = sqlite3PagerGetData(pDestPg);\r\n      u8 *zOut = &zDestData[iOff%nDestPgsz];\r\n\r\n      /* Copy the data from the source page into the destination page.\r\n      ** Then clear the Btree layer MemPage.isInit flag. Both this module\r\n      ** and the pager code use this trick (clearing the first byte\r\n      ** of the page 'extra' space to invalidate the Btree layers\r\n      ** cached parse of the page). MemPage.isInit is marked \r\n      ** \"MUST BE FIRST\" for this purpose.\r\n      */\r\n      memcpy(zOut, zIn, nCopy);\r\n      ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0;\r\n    }\r\n    sqlite3PagerUnref(pDestPg);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If pFile is currently larger than iSize bytes, then truncate it to\r\n** exactly iSize bytes. If pFile is not larger than iSize bytes, then\r\n** this function is a no-op.\r\n**\r\n** Return SQLITE_OK if everything is successful, or an SQLite error \r\n** code if an error occurs.\r\n*/\r\nstatic int backupTruncateFile(sqlite3_file *pFile, i64 iSize){\r\n  i64 iCurrent;\r\n  int rc = sqlite3OsFileSize(pFile, &iCurrent);\r\n  if( rc==SQLITE_OK && iCurrent>iSize ){\r\n    rc = sqlite3OsTruncate(pFile, iSize);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Register this backup object with the associated source pager for\r\n** callbacks when pages are changed or the cache invalidated.\r\n*/\r\nstatic void attachBackupObject(sqlite3_backup *p){\r\n  sqlite3_backup **pp;\r\n  assert( sqlite3BtreeHoldsMutex(p->pSrc) );\r\n  pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));\r\n  p->pNext = *pp;\r\n  *pp = p;\r\n  p->isAttached = 1;\r\n}\r\n\r\n/*\r\n** Copy nPage pages from the source b-tree to the destination.\r\n*/\r\nSQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){\r\n  int rc;\r\n  int destMode;       /* Destination journal mode */\r\n  int pgszSrc = 0;    /* Source page size */\r\n  int pgszDest = 0;   /* Destination page size */\r\n\r\n  sqlite3_mutex_enter(p->pSrcDb->mutex);\r\n  sqlite3BtreeEnter(p->pSrc);\r\n  if( p->pDestDb ){\r\n    sqlite3_mutex_enter(p->pDestDb->mutex);\r\n  }\r\n\r\n  rc = p->rc;\r\n  if( !isFatalError(rc) ){\r\n    Pager * const pSrcPager = sqlite3BtreePager(p->pSrc);     /* Source pager */\r\n    Pager * const pDestPager = sqlite3BtreePager(p->pDest);   /* Dest pager */\r\n    int ii;                            /* Iterator variable */\r\n    int nSrcPage = -1;                 /* Size of source db in pages */\r\n    int bCloseTrans = 0;               /* True if src db requires unlocking */\r\n\r\n    /* If the source pager is currently in a write-transaction, return\r\n    ** SQLITE_BUSY immediately.\r\n    */\r\n    if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){\r\n      rc = SQLITE_BUSY;\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n\r\n    /* Lock the destination database, if it is not locked already. */\r\n    if( SQLITE_OK==rc && p->bDestLocked==0\r\n     && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2)) \r\n    ){\r\n      p->bDestLocked = 1;\r\n      sqlite3BtreeGetMeta(p->pDest, BTREE_SCHEMA_VERSION, &p->iDestSchema);\r\n    }\r\n\r\n    /* If there is no open read-transaction on the source database, open\r\n    ** one now. If a transaction is opened here, then it will be closed\r\n    ** before this function exits.\r\n    */\r\n    if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){\r\n      rc = sqlite3BtreeBeginTrans(p->pSrc, 0);\r\n      bCloseTrans = 1;\r\n    }\r\n\r\n    /* Do not allow backup if the destination database is in WAL mode\r\n    ** and the page sizes are different between source and destination */\r\n    pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);\r\n    pgszDest = sqlite3BtreeGetPageSize(p->pDest);\r\n    destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest));\r\n    if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){\r\n      rc = SQLITE_READONLY;\r\n    }\r\n  \r\n    /* Now that there is a read-lock on the source database, query the\r\n    ** source pager for the number of pages in the database.\r\n    */\r\n    nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);\r\n    assert( nSrcPage>=0 );\r\n    for(ii=0; (nPage<0 || ii<nPage) && p->iNext<=(Pgno)nSrcPage && !rc; ii++){\r\n      const Pgno iSrcPg = p->iNext;                 /* Source page number */\r\n      if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){\r\n        DbPage *pSrcPg;                             /* Source page object */\r\n        rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);\r\n        if( rc==SQLITE_OK ){\r\n          rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg));\r\n          sqlite3PagerUnref(pSrcPg);\r\n        }\r\n      }\r\n      p->iNext++;\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      p->nPagecount = nSrcPage;\r\n      p->nRemaining = nSrcPage+1-p->iNext;\r\n      if( p->iNext>(Pgno)nSrcPage ){\r\n        rc = SQLITE_DONE;\r\n      }else if( !p->isAttached ){\r\n        attachBackupObject(p);\r\n      }\r\n    }\r\n  \r\n    /* Update the schema version field in the destination database. This\r\n    ** is to make sure that the schema-version really does change in\r\n    ** the case where the source and destination databases have the\r\n    ** same schema version.\r\n    */\r\n    if( rc==SQLITE_DONE ){\r\n      rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1);\r\n      if( rc==SQLITE_OK ){\r\n        if( p->pDestDb ){\r\n          sqlite3ResetInternalSchema(p->pDestDb, -1);\r\n        }\r\n        if( destMode==PAGER_JOURNALMODE_WAL ){\r\n          rc = sqlite3BtreeSetVersion(p->pDest, 2);\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        int nDestTruncate;\r\n        /* Set nDestTruncate to the final number of pages in the destination\r\n        ** database. The complication here is that the destination page\r\n        ** size may be different to the source page size. \r\n        **\r\n        ** If the source page size is smaller than the destination page size, \r\n        ** round up. In this case the call to sqlite3OsTruncate() below will\r\n        ** fix the size of the file. However it is important to call\r\n        ** sqlite3PagerTruncateImage() here so that any pages in the \r\n        ** destination file that lie beyond the nDestTruncate page mark are\r\n        ** journalled by PagerCommitPhaseOne() before they are destroyed\r\n        ** by the file truncation.\r\n        */\r\n        assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );\r\n        assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) );\r\n        if( pgszSrc<pgszDest ){\r\n          int ratio = pgszDest/pgszSrc;\r\n          nDestTruncate = (nSrcPage+ratio-1)/ratio;\r\n          if( nDestTruncate==(int)PENDING_BYTE_PAGE(p->pDest->pBt) ){\r\n            nDestTruncate--;\r\n          }\r\n        }else{\r\n          nDestTruncate = nSrcPage * (pgszSrc/pgszDest);\r\n        }\r\n        sqlite3PagerTruncateImage(pDestPager, nDestTruncate);\r\n\r\n        if( pgszSrc<pgszDest ){\r\n          /* If the source page-size is smaller than the destination page-size,\r\n          ** two extra things may need to happen:\r\n          **\r\n          **   * The destination may need to be truncated, and\r\n          **\r\n          **   * Data stored on the pages immediately following the \r\n          **     pending-byte page in the source database may need to be\r\n          **     copied into the destination database.\r\n          */\r\n          const i64 iSize = (i64)pgszSrc * (i64)nSrcPage;\r\n          sqlite3_file * const pFile = sqlite3PagerFile(pDestPager);\r\n          i64 iOff;\r\n          i64 iEnd;\r\n\r\n          assert( pFile );\r\n          assert( (i64)nDestTruncate*(i64)pgszDest >= iSize || (\r\n                nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1)\r\n             && iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest\r\n          ));\r\n\r\n          /* This call ensures that all data required to recreate the original\r\n          ** database has been stored in the journal for pDestPager and the\r\n          ** journal synced to disk. So at this point we may safely modify\r\n          ** the database file in any way, knowing that if a power failure\r\n          ** occurs, the original database will be reconstructed from the \r\n          ** journal file.  */\r\n          rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1);\r\n\r\n          /* Write the extra pages and truncate the database file as required */\r\n          iEnd = MIN(PENDING_BYTE + pgszDest, iSize);\r\n          for(\r\n            iOff=PENDING_BYTE+pgszSrc; \r\n            rc==SQLITE_OK && iOff<iEnd; \r\n            iOff+=pgszSrc\r\n          ){\r\n            PgHdr *pSrcPg = 0;\r\n            const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);\r\n            rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);\r\n            if( rc==SQLITE_OK ){\r\n              u8 *zData = sqlite3PagerGetData(pSrcPg);\r\n              rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);\r\n            }\r\n            sqlite3PagerUnref(pSrcPg);\r\n          }\r\n          if( rc==SQLITE_OK ){\r\n            rc = backupTruncateFile(pFile, iSize);\r\n          }\r\n\r\n          /* Sync the database file to disk. */\r\n          if( rc==SQLITE_OK ){\r\n            rc = sqlite3PagerSync(pDestPager);\r\n          }\r\n        }else{\r\n          rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0);\r\n        }\r\n    \r\n        /* Finish committing the transaction to the destination database. */\r\n        if( SQLITE_OK==rc\r\n         && SQLITE_OK==(rc = sqlite3BtreeCommitPhaseTwo(p->pDest, 0))\r\n        ){\r\n          rc = SQLITE_DONE;\r\n        }\r\n      }\r\n    }\r\n  \r\n    /* If bCloseTrans is true, then this function opened a read transaction\r\n    ** on the source database. Close the read transaction here. There is\r\n    ** no need to check the return values of the btree methods here, as\r\n    ** \"committing\" a read-only transaction cannot fail.\r\n    */\r\n    if( bCloseTrans ){\r\n      TESTONLY( int rc2 );\r\n      TESTONLY( rc2  = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);\r\n      TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0);\r\n      assert( rc2==SQLITE_OK );\r\n    }\r\n  \r\n    if( rc==SQLITE_IOERR_NOMEM ){\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n    p->rc = rc;\r\n  }\r\n  if( p->pDestDb ){\r\n    sqlite3_mutex_leave(p->pDestDb->mutex);\r\n  }\r\n  sqlite3BtreeLeave(p->pSrc);\r\n  sqlite3_mutex_leave(p->pSrcDb->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Release all resources associated with an sqlite3_backup* handle.\r\n*/\r\nSQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){\r\n  sqlite3_backup **pp;                 /* Ptr to head of pagers backup list */\r\n  MUTEX_LOGIC( sqlite3_mutex *mutex; ) /* Mutex to protect source database */\r\n  int rc;                              /* Value to return */\r\n\r\n  /* Enter the mutexes */\r\n  if( p==0 ) return SQLITE_OK;\r\n  sqlite3_mutex_enter(p->pSrcDb->mutex);\r\n  sqlite3BtreeEnter(p->pSrc);\r\n  MUTEX_LOGIC( mutex = p->pSrcDb->mutex; )\r\n  if( p->pDestDb ){\r\n    sqlite3_mutex_enter(p->pDestDb->mutex);\r\n  }\r\n\r\n  /* Detach this backup from the source pager. */\r\n  if( p->pDestDb ){\r\n    p->pSrc->nBackup--;\r\n  }\r\n  if( p->isAttached ){\r\n    pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));\r\n    while( *pp!=p ){\r\n      pp = &(*pp)->pNext;\r\n    }\r\n    *pp = p->pNext;\r\n  }\r\n\r\n  /* If a transaction is still open on the Btree, roll it back. */\r\n  sqlite3BtreeRollback(p->pDest, SQLITE_OK);\r\n\r\n  /* Set the error code of the destination database handle. */\r\n  rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;\r\n  sqlite3Error(p->pDestDb, rc, 0);\r\n\r\n  /* Exit the mutexes and free the backup context structure. */\r\n  if( p->pDestDb ){\r\n    sqlite3_mutex_leave(p->pDestDb->mutex);\r\n  }\r\n  sqlite3BtreeLeave(p->pSrc);\r\n  if( p->pDestDb ){\r\n    /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a\r\n    ** call to sqlite3_backup_init() and is destroyed by a call to\r\n    ** sqlite3_backup_finish(). */\r\n    sqlite3_free(p);\r\n  }\r\n  sqlite3_mutex_leave(mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the number of pages still to be backed up as of the most recent\r\n** call to sqlite3_backup_step().\r\n*/\r\nSQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){\r\n  return p->nRemaining;\r\n}\r\n\r\n/*\r\n** Return the total number of pages in the source database as of the most \r\n** recent call to sqlite3_backup_step().\r\n*/\r\nSQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){\r\n  return p->nPagecount;\r\n}\r\n\r\n/*\r\n** This function is called after the contents of page iPage of the\r\n** source database have been modified. If page iPage has already been \r\n** copied into the destination database, then the data written to the\r\n** destination is now invalidated. The destination copy of iPage needs\r\n** to be updated with the new data before the backup operation is\r\n** complete.\r\n**\r\n** It is assumed that the mutex associated with the BtShared object\r\n** corresponding to the source database is held when this function is\r\n** called.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){\r\n  sqlite3_backup *p;                   /* Iterator variable */\r\n  for(p=pBackup; p; p=p->pNext){\r\n    assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );\r\n    if( !isFatalError(p->rc) && iPage<p->iNext ){\r\n      /* The backup process p has already copied page iPage. But now it\r\n      ** has been modified by a transaction on the source pager. Copy\r\n      ** the new data into the backup.\r\n      */\r\n      int rc;\r\n      assert( p->pDestDb );\r\n      sqlite3_mutex_enter(p->pDestDb->mutex);\r\n      rc = backupOnePage(p, iPage, aData);\r\n      sqlite3_mutex_leave(p->pDestDb->mutex);\r\n      assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED );\r\n      if( rc!=SQLITE_OK ){\r\n        p->rc = rc;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Restart the backup process. This is called when the pager layer\r\n** detects that the database has been modified by an external database\r\n** connection. In this case there is no way of knowing which of the\r\n** pages that have been copied into the destination database are still \r\n** valid and which are not, so the entire process needs to be restarted.\r\n**\r\n** It is assumed that the mutex associated with the BtShared object\r\n** corresponding to the source database is held when this function is\r\n** called.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *pBackup){\r\n  sqlite3_backup *p;                   /* Iterator variable */\r\n  for(p=pBackup; p; p=p->pNext){\r\n    assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );\r\n    p->iNext = 1;\r\n  }\r\n}\r\n\r\n#ifndef SQLITE_OMIT_VACUUM\r\n/*\r\n** Copy the complete content of pBtFrom into pBtTo.  A transaction\r\n** must be active for both files.\r\n**\r\n** The size of file pTo may be reduced by this operation. If anything \r\n** goes wrong, the transaction on pTo is rolled back. If successful, the \r\n** transaction is committed before returning.\r\n*/\r\nSQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){\r\n  int rc;\r\n  sqlite3_file *pFd;              /* File descriptor for database pTo */\r\n  sqlite3_backup b;\r\n  sqlite3BtreeEnter(pTo);\r\n  sqlite3BtreeEnter(pFrom);\r\n\r\n  assert( sqlite3BtreeIsInTrans(pTo) );\r\n  pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));\r\n  if( pFd->pMethods ){\r\n    i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom);\r\n    rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);\r\n    if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;\r\n    if( rc ) goto copy_finished;\r\n  }\r\n\r\n  /* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set\r\n  ** to 0. This is used by the implementations of sqlite3_backup_step()\r\n  ** and sqlite3_backup_finish() to detect that they are being called\r\n  ** from this function, not directly by the user.\r\n  */\r\n  memset(&b, 0, sizeof(b));\r\n  b.pSrcDb = pFrom->db;\r\n  b.pSrc = pFrom;\r\n  b.pDest = pTo;\r\n  b.iNext = 1;\r\n\r\n  /* 0x7FFFFFFF is the hard limit for the number of pages in a database\r\n  ** file. By passing this as the number of pages to copy to\r\n  ** sqlite3_backup_step(), we can guarantee that the copy finishes \r\n  ** within a single call (unless an error occurs). The assert() statement\r\n  ** checks this assumption - (p->rc) should be set to either SQLITE_DONE \r\n  ** or an error code.\r\n  */\r\n  sqlite3_backup_step(&b, 0x7FFFFFFF);\r\n  assert( b.rc!=SQLITE_OK );\r\n  rc = sqlite3_backup_finish(&b);\r\n  if( rc==SQLITE_OK ){\r\n    pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED;\r\n  }else{\r\n    sqlite3PagerClearCache(sqlite3BtreePager(b.pDest));\r\n  }\r\n\r\n  assert( sqlite3BtreeIsInTrans(pTo)==0 );\r\ncopy_finished:\r\n  sqlite3BtreeLeave(pFrom);\r\n  sqlite3BtreeLeave(pTo);\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_VACUUM */\r\n\r\n/************** End of backup.c **********************************************/\r\n/************** Begin file vdbemem.c *****************************************/\r\n/*\r\n** 2004 May 26\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code use to manipulate \"Mem\" structure.  A \"Mem\"\r\n** stores a single value in the VDBE.  Mem is an opaque structure visible\r\n** only within the VDBE.  Interface routines refer to a Mem using the\r\n** name sqlite_value\r\n*/\r\n\r\n/*\r\n** If pMem is an object with a valid string representation, this routine\r\n** ensures the internal encoding for the string representation is\r\n** 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE.\r\n**\r\n** If pMem is not a string object, or the encoding of the string\r\n** representation is already stored using the requested encoding, then this\r\n** routine is a no-op.\r\n**\r\n** SQLITE_OK is returned if the conversion is successful (or not required).\r\n** SQLITE_NOMEM may be returned if a malloc() fails during conversion\r\n** between formats.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){\r\n  int rc;\r\n  assert( (pMem->flags&MEM_RowSet)==0 );\r\n  assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE\r\n           || desiredEnc==SQLITE_UTF16BE );\r\n  if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){\r\n    return SQLITE_OK;\r\n  }\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n#ifdef SQLITE_OMIT_UTF16\r\n  return SQLITE_ERROR;\r\n#else\r\n\r\n  /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned,\r\n  ** then the encoding of the value may not have changed.\r\n  */\r\n  rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);\r\n  assert(rc==SQLITE_OK    || rc==SQLITE_NOMEM);\r\n  assert(rc==SQLITE_OK    || pMem->enc!=desiredEnc);\r\n  assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);\r\n  return rc;\r\n#endif\r\n}\r\n\r\n/*\r\n** Make sure pMem->z points to a writable allocation of at least \r\n** n bytes.\r\n**\r\n** If the memory cell currently contains string or blob data\r\n** and the third argument passed to this function is true, the \r\n** current content of the cell is preserved. Otherwise, it may\r\n** be discarded.  \r\n**\r\n** This function sets the MEM_Dyn flag and clears any xDel callback.\r\n** It also clears MEM_Ephem and MEM_Static. If the preserve flag is \r\n** not set, Mem.n is zeroed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){\r\n  assert( 1 >=\r\n    ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) +\r\n    (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) + \r\n    ((pMem->flags&MEM_Ephem) ? 1 : 0) + \r\n    ((pMem->flags&MEM_Static) ? 1 : 0)\r\n  );\r\n  assert( (pMem->flags&MEM_RowSet)==0 );\r\n\r\n  if( n<32 ) n = 32;\r\n  if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){\r\n    if( preserve && pMem->z==pMem->zMalloc ){\r\n      pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);\r\n      preserve = 0;\r\n    }else{\r\n      sqlite3DbFree(pMem->db, pMem->zMalloc);\r\n      pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);\r\n    }\r\n  }\r\n\r\n  if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){\r\n    memcpy(pMem->zMalloc, pMem->z, pMem->n);\r\n  }\r\n  if( pMem->flags&MEM_Dyn && pMem->xDel ){\r\n    assert( pMem->xDel!=SQLITE_DYNAMIC );\r\n    pMem->xDel((void *)(pMem->z));\r\n  }\r\n\r\n  pMem->z = pMem->zMalloc;\r\n  if( pMem->z==0 ){\r\n    pMem->flags = MEM_Null;\r\n  }else{\r\n    pMem->flags &= ~(MEM_Ephem|MEM_Static);\r\n  }\r\n  pMem->xDel = 0;\r\n  return (pMem->z ? SQLITE_OK : SQLITE_NOMEM);\r\n}\r\n\r\n/*\r\n** Make the given Mem object MEM_Dyn.  In other words, make it so\r\n** that any TEXT or BLOB content is stored in memory obtained from\r\n** malloc().  In this way, we know that the memory is safe to be\r\n** overwritten or altered.\r\n**\r\n** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){\r\n  int f;\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( (pMem->flags&MEM_RowSet)==0 );\r\n  ExpandBlob(pMem);\r\n  f = pMem->flags;\r\n  if( (f&(MEM_Str|MEM_Blob)) && pMem->z!=pMem->zMalloc ){\r\n    if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    pMem->z[pMem->n] = 0;\r\n    pMem->z[pMem->n+1] = 0;\r\n    pMem->flags |= MEM_Term;\r\n#ifdef SQLITE_DEBUG\r\n    pMem->pScopyFrom = 0;\r\n#endif\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** If the given Mem* has a zero-filled tail, turn it into an ordinary\r\n** blob stored in dynamically allocated space.\r\n*/\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\nSQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){\r\n  if( pMem->flags & MEM_Zero ){\r\n    int nByte;\r\n    assert( pMem->flags&MEM_Blob );\r\n    assert( (pMem->flags&MEM_RowSet)==0 );\r\n    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n\r\n    /* Set nByte to the number of bytes required to store the expanded blob. */\r\n    nByte = pMem->n + pMem->u.nZero;\r\n    if( nByte<=0 ){\r\n      nByte = 1;\r\n    }\r\n    if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n\r\n    memset(&pMem->z[pMem->n], 0, pMem->u.nZero);\r\n    pMem->n += pMem->u.nZero;\r\n    pMem->flags &= ~(MEM_Zero|MEM_Term);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Make sure the given Mem is \\u0000 terminated.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  if( (pMem->flags & MEM_Term)!=0 || (pMem->flags & MEM_Str)==0 ){\r\n    return SQLITE_OK;   /* Nothing to do */\r\n  }\r\n  if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  pMem->z[pMem->n] = 0;\r\n  pMem->z[pMem->n+1] = 0;\r\n  pMem->flags |= MEM_Term;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Add MEM_Str to the set of representations for the given Mem.  Numbers\r\n** are converted using sqlite3_snprintf().  Converting a BLOB to a string\r\n** is a no-op.\r\n**\r\n** Existing representations MEM_Int and MEM_Real are *not* invalidated.\r\n**\r\n** A MEM_Null value will never be passed to this function. This function is\r\n** used for converting values to text for returning to the user (i.e. via\r\n** sqlite3_value_text()), or for ensuring that values to be used as btree\r\n** keys are strings. In the former case a NULL pointer is returned the\r\n** user and the later is an internal programming error.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, int enc){\r\n  int rc = SQLITE_OK;\r\n  int fg = pMem->flags;\r\n  const int nByte = 32;\r\n\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( !(fg&MEM_Zero) );\r\n  assert( !(fg&(MEM_Str|MEM_Blob)) );\r\n  assert( fg&(MEM_Int|MEM_Real) );\r\n  assert( (pMem->flags&MEM_RowSet)==0 );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n\r\n\r\n  if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  /* For a Real or Integer, use sqlite3_mprintf() to produce the UTF-8\r\n  ** string representation of the value. Then, if the required encoding\r\n  ** is UTF-16le or UTF-16be do a translation.\r\n  ** \r\n  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.\r\n  */\r\n  if( fg & MEM_Int ){\r\n    sqlite3_snprintf(nByte, pMem->z, \"%lld\", pMem->u.i);\r\n  }else{\r\n    assert( fg & MEM_Real );\r\n    sqlite3_snprintf(nByte, pMem->z, \"%!.15g\", pMem->r);\r\n  }\r\n  pMem->n = sqlite3Strlen30(pMem->z);\r\n  pMem->enc = SQLITE_UTF8;\r\n  pMem->flags |= MEM_Str|MEM_Term;\r\n  sqlite3VdbeChangeEncoding(pMem, enc);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Memory cell pMem contains the context of an aggregate function.\r\n** This routine calls the finalize method for that function.  The\r\n** result of the aggregate is stored back into pMem.\r\n**\r\n** Return SQLITE_ERROR if the finalizer reports an error.  SQLITE_OK\r\n** otherwise.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){\r\n  int rc = SQLITE_OK;\r\n  if( ALWAYS(pFunc && pFunc->xFinalize) ){\r\n    sqlite3_context ctx;\r\n    assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );\r\n    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n    memset(&ctx, 0, sizeof(ctx));\r\n    ctx.s.flags = MEM_Null;\r\n    ctx.s.db = pMem->db;\r\n    ctx.pMem = pMem;\r\n    ctx.pFunc = pFunc;\r\n    pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */\r\n    assert( 0==(pMem->flags&MEM_Dyn) && !pMem->xDel );\r\n    sqlite3DbFree(pMem->db, pMem->zMalloc);\r\n    memcpy(pMem, &ctx.s, sizeof(ctx.s));\r\n    rc = ctx.isError;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If the memory cell contains a string value that must be freed by\r\n** invoking an external callback, free it now. Calling this function\r\n** does not free any Mem.zMalloc buffer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p){\r\n  assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );\r\n  if( p->flags&MEM_Agg ){\r\n    sqlite3VdbeMemFinalize(p, p->u.pDef);\r\n    assert( (p->flags & MEM_Agg)==0 );\r\n    sqlite3VdbeMemRelease(p);\r\n  }else if( p->flags&MEM_Dyn && p->xDel ){\r\n    assert( (p->flags&MEM_RowSet)==0 );\r\n    assert( p->xDel!=SQLITE_DYNAMIC );\r\n    p->xDel((void *)p->z);\r\n    p->xDel = 0;\r\n  }else if( p->flags&MEM_RowSet ){\r\n    sqlite3RowSetClear(p->u.pRowSet);\r\n  }else if( p->flags&MEM_Frame ){\r\n    sqlite3VdbeMemSetNull(p);\r\n  }\r\n}\r\n\r\n/*\r\n** Release any memory held by the Mem. This may leave the Mem in an\r\n** inconsistent state, for example with (Mem.z==0) and\r\n** (Mem.type==SQLITE_TEXT).\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){\r\n  VdbeMemRelease(p);\r\n  sqlite3DbFree(p->db, p->zMalloc);\r\n  p->z = 0;\r\n  p->zMalloc = 0;\r\n  p->xDel = 0;\r\n}\r\n\r\n/*\r\n** Convert a 64-bit IEEE double into a 64-bit signed integer.\r\n** If the double is too large, return 0x8000000000000000.\r\n**\r\n** Most systems appear to do this simply by assigning\r\n** variables and without the extra range tests.  But\r\n** there are reports that windows throws an expection\r\n** if the floating point value is out of range. (See ticket #2880.)\r\n** Because we do not completely understand the problem, we will\r\n** take the conservative approach and always do range tests\r\n** before attempting the conversion.\r\n*/\r\nstatic i64 doubleToInt64(double r){\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n  /* When floating-point is omitted, double and int64 are the same thing */\r\n  return r;\r\n#else\r\n  /*\r\n  ** Many compilers we encounter do not define constants for the\r\n  ** minimum and maximum 64-bit integers, or they define them\r\n  ** inconsistently.  And many do not understand the \"LL\" notation.\r\n  ** So we define our own static constants here using nothing\r\n  ** larger than a 32-bit integer constant.\r\n  */\r\n  static const i64 maxInt = LARGEST_INT64;\r\n  static const i64 minInt = SMALLEST_INT64;\r\n\r\n  if( r<(double)minInt ){\r\n    return minInt;\r\n  }else if( r>(double)maxInt ){\r\n    /* minInt is correct here - not maxInt.  It turns out that assigning\r\n    ** a very large positive number to an integer results in a very large\r\n    ** negative integer.  This makes no sense, but it is what x86 hardware\r\n    ** does so for compatibility we will do the same in software. */\r\n    return minInt;\r\n  }else{\r\n    return (i64)r;\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Return some kind of integer value which is the best we can do\r\n** at representing the value that *pMem describes as an integer.\r\n** If pMem is an integer, then the value is exact.  If pMem is\r\n** a floating-point then the value returned is the integer part.\r\n** If pMem is a string or blob, then we make an attempt to convert\r\n** it into a integer and return that.  If pMem represents an\r\n** an SQL-NULL value, return 0.\r\n**\r\n** If pMem represents a string value, its encoding might be changed.\r\n*/\r\nSQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){\r\n  int flags;\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n  flags = pMem->flags;\r\n  if( flags & MEM_Int ){\r\n    return pMem->u.i;\r\n  }else if( flags & MEM_Real ){\r\n    return doubleToInt64(pMem->r);\r\n  }else if( flags & (MEM_Str|MEM_Blob) ){\r\n    i64 value = 0;\r\n    assert( pMem->z || pMem->n==0 );\r\n    testcase( pMem->z==0 );\r\n    sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);\r\n    return value;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Return the best representation of pMem that we can get into a\r\n** double.  If pMem is already a double or an integer, return its\r\n** value.  If it is a string or blob, try to convert it to a double.\r\n** If it is a NULL, return 0.0.\r\n*/\r\nSQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n  if( pMem->flags & MEM_Real ){\r\n    return pMem->r;\r\n  }else if( pMem->flags & MEM_Int ){\r\n    return (double)pMem->u.i;\r\n  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){\r\n    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\r\n    double val = (double)0;\r\n    sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc);\r\n    return val;\r\n  }else{\r\n    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\r\n    return (double)0;\r\n  }\r\n}\r\n\r\n/*\r\n** The MEM structure is already a MEM_Real.  Try to also make it a\r\n** MEM_Int if we can.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){\r\n  assert( pMem->flags & MEM_Real );\r\n  assert( (pMem->flags & MEM_RowSet)==0 );\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n\r\n  pMem->u.i = doubleToInt64(pMem->r);\r\n\r\n  /* Only mark the value as an integer if\r\n  **\r\n  **    (1) the round-trip conversion real->int->real is a no-op, and\r\n  **    (2) The integer is neither the largest nor the smallest\r\n  **        possible integer (ticket #3922)\r\n  **\r\n  ** The second and third terms in the following conditional enforces\r\n  ** the second condition under the assumption that addition overflow causes\r\n  ** values to wrap around.  On x86 hardware, the third term is always\r\n  ** true and could be omitted.  But we leave it in because other\r\n  ** architectures might behave differently.\r\n  */\r\n  if( pMem->r==(double)pMem->u.i\r\n   && pMem->u.i>SMALLEST_INT64\r\n#if defined(__i486__) || defined(__x86_64__)\r\n   && ALWAYS(pMem->u.i<LARGEST_INT64)\r\n#else\r\n   && pMem->u.i<LARGEST_INT64\r\n#endif\r\n  ){\r\n    pMem->flags |= MEM_Int;\r\n  }\r\n}\r\n\r\n/*\r\n** Convert pMem to type integer.  Invalidate any prior representations.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( (pMem->flags & MEM_RowSet)==0 );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n\r\n  pMem->u.i = sqlite3VdbeIntValue(pMem);\r\n  MemSetTypeFlag(pMem, MEM_Int);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Convert pMem so that it is of type MEM_Real.\r\n** Invalidate any prior representations.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n\r\n  pMem->r = sqlite3VdbeRealValue(pMem);\r\n  MemSetTypeFlag(pMem, MEM_Real);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Convert pMem so that it has types MEM_Real or MEM_Int or both.\r\n** Invalidate any prior representations.\r\n**\r\n** Every effort is made to force the conversion, even if the input\r\n** is a string that does not look completely like a number.  Convert\r\n** as much of the string as we can and ignore the rest.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){\r\n  if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){\r\n    assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );\r\n    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n    if( 0==sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc) ){\r\n      MemSetTypeFlag(pMem, MEM_Int);\r\n    }else{\r\n      pMem->r = sqlite3VdbeRealValue(pMem);\r\n      MemSetTypeFlag(pMem, MEM_Real);\r\n      sqlite3VdbeIntegerAffinity(pMem);\r\n    }\r\n  }\r\n  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );\r\n  pMem->flags &= ~(MEM_Str|MEM_Blob);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Delete any previous value and set the value stored in *pMem to NULL.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){\r\n  if( pMem->flags & MEM_Frame ){\r\n    VdbeFrame *pFrame = pMem->u.pFrame;\r\n    pFrame->pParent = pFrame->v->pDelFrame;\r\n    pFrame->v->pDelFrame = pFrame;\r\n  }\r\n  if( pMem->flags & MEM_RowSet ){\r\n    sqlite3RowSetClear(pMem->u.pRowSet);\r\n  }\r\n  MemSetTypeFlag(pMem, MEM_Null);\r\n  pMem->type = SQLITE_NULL;\r\n}\r\n\r\n/*\r\n** Delete any previous value and set the value to be a BLOB of length\r\n** n containing all zeros.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){\r\n  sqlite3VdbeMemRelease(pMem);\r\n  pMem->flags = MEM_Blob|MEM_Zero;\r\n  pMem->type = SQLITE_BLOB;\r\n  pMem->n = 0;\r\n  if( n<0 ) n = 0;\r\n  pMem->u.nZero = n;\r\n  pMem->enc = SQLITE_UTF8;\r\n\r\n#ifdef SQLITE_OMIT_INCRBLOB\r\n  sqlite3VdbeMemGrow(pMem, n, 0);\r\n  if( pMem->z ){\r\n    pMem->n = n;\r\n    memset(pMem->z, 0, n);\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Delete any previous value and set the value stored in *pMem to val,\r\n** manifest type INTEGER.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){\r\n  sqlite3VdbeMemRelease(pMem);\r\n  pMem->u.i = val;\r\n  pMem->flags = MEM_Int;\r\n  pMem->type = SQLITE_INTEGER;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n/*\r\n** Delete any previous value and set the value stored in *pMem to val,\r\n** manifest type REAL.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){\r\n  if( sqlite3IsNaN(val) ){\r\n    sqlite3VdbeMemSetNull(pMem);\r\n  }else{\r\n    sqlite3VdbeMemRelease(pMem);\r\n    pMem->r = val;\r\n    pMem->flags = MEM_Real;\r\n    pMem->type = SQLITE_FLOAT;\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** Delete any previous value and set the value of pMem to be an\r\n** empty boolean index.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){\r\n  sqlite3 *db = pMem->db;\r\n  assert( db!=0 );\r\n  assert( (pMem->flags & MEM_RowSet)==0 );\r\n  sqlite3VdbeMemRelease(pMem);\r\n  pMem->zMalloc = sqlite3DbMallocRaw(db, 64);\r\n  if( db->mallocFailed ){\r\n    pMem->flags = MEM_Null;\r\n  }else{\r\n    assert( pMem->zMalloc );\r\n    pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc, \r\n                                       sqlite3DbMallocSize(db, pMem->zMalloc));\r\n    assert( pMem->u.pRowSet!=0 );\r\n    pMem->flags = MEM_RowSet;\r\n  }\r\n}\r\n\r\n/*\r\n** Return true if the Mem object contains a TEXT or BLOB that is\r\n** too large - whose size exceeds SQLITE_MAX_LENGTH.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){\r\n  assert( p->db!=0 );\r\n  if( p->flags & (MEM_Str|MEM_Blob) ){\r\n    int n = p->n;\r\n    if( p->flags & MEM_Zero ){\r\n      n += p->u.nZero;\r\n    }\r\n    return n>p->db->aLimit[SQLITE_LIMIT_LENGTH];\r\n  }\r\n  return 0; \r\n}\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** This routine prepares a memory cell for modication by breaking\r\n** its link to a shallow copy and by marking any current shallow\r\n** copies of this cell as invalid.\r\n**\r\n** This is used for testing and debugging only - to make sure shallow\r\n** copies are not misused.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){\r\n  int i;\r\n  Mem *pX;\r\n  for(i=1, pX=&pVdbe->aMem[1]; i<=pVdbe->nMem; i++, pX++){\r\n    if( pX->pScopyFrom==pMem ){\r\n      pX->flags |= MEM_Invalid;\r\n      pX->pScopyFrom = 0;\r\n    }\r\n  }\r\n  pMem->pScopyFrom = 0;\r\n}\r\n#endif /* SQLITE_DEBUG */\r\n\r\n/*\r\n** Size of struct Mem not including the Mem.zMalloc member.\r\n*/\r\n#define MEMCELLSIZE (size_t)(&(((Mem *)0)->zMalloc))\r\n\r\n/*\r\n** Make an shallow copy of pFrom into pTo.  Prior contents of\r\n** pTo are freed.  The pFrom->z field is not duplicated.  If\r\n** pFrom->z is used, then pTo->z points to the same thing as pFrom->z\r\n** and flags gets srcType (either MEM_Ephem or MEM_Static).\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){\r\n  assert( (pFrom->flags & MEM_RowSet)==0 );\r\n  VdbeMemRelease(pTo);\r\n  memcpy(pTo, pFrom, MEMCELLSIZE);\r\n  pTo->xDel = 0;\r\n  if( (pFrom->flags&MEM_Static)==0 ){\r\n    pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);\r\n    assert( srcType==MEM_Ephem || srcType==MEM_Static );\r\n    pTo->flags |= srcType;\r\n  }\r\n}\r\n\r\n/*\r\n** Make a full copy of pFrom into pTo.  Prior contents of pTo are\r\n** freed before the copy is made.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( (pFrom->flags & MEM_RowSet)==0 );\r\n  VdbeMemRelease(pTo);\r\n  memcpy(pTo, pFrom, MEMCELLSIZE);\r\n  pTo->flags &= ~MEM_Dyn;\r\n\r\n  if( pTo->flags&(MEM_Str|MEM_Blob) ){\r\n    if( 0==(pFrom->flags&MEM_Static) ){\r\n      pTo->flags |= MEM_Ephem;\r\n      rc = sqlite3VdbeMemMakeWriteable(pTo);\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Transfer the contents of pFrom to pTo. Any existing value in pTo is\r\n** freed. If pFrom contains ephemeral data, a copy is made.\r\n**\r\n** pFrom contains an SQL NULL when this routine returns.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){\r\n  assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) );\r\n  assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) );\r\n  assert( pFrom->db==0 || pTo->db==0 || pFrom->db==pTo->db );\r\n\r\n  sqlite3VdbeMemRelease(pTo);\r\n  memcpy(pTo, pFrom, sizeof(Mem));\r\n  pFrom->flags = MEM_Null;\r\n  pFrom->xDel = 0;\r\n  pFrom->zMalloc = 0;\r\n}\r\n\r\n/*\r\n** Change the value of a Mem to be a string or a BLOB.\r\n**\r\n** The memory management strategy depends on the value of the xDel\r\n** parameter. If the value passed is SQLITE_TRANSIENT, then the \r\n** string is copied into a (possibly existing) buffer managed by the \r\n** Mem structure. Otherwise, any existing buffer is freed and the\r\n** pointer copied.\r\n**\r\n** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH\r\n** size limit) then no memory allocation occurs.  If the string can be\r\n** stored without allocating memory, then it is.  If a memory allocation\r\n** is required to store the string, then value of pMem is unchanged.  In\r\n** either case, SQLITE_TOOBIG is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemSetStr(\r\n  Mem *pMem,          /* Memory cell to set to string value */\r\n  const char *z,      /* String pointer */\r\n  int n,              /* Bytes in string, or negative */\r\n  u8 enc,             /* Encoding of z.  0 for BLOBs */\r\n  void (*xDel)(void*) /* Destructor function */\r\n){\r\n  int nByte = n;      /* New value for pMem->n */\r\n  int iLimit;         /* Maximum allowed string or blob size */\r\n  u16 flags = 0;      /* New value for pMem->flags */\r\n\r\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\r\n  assert( (pMem->flags & MEM_RowSet)==0 );\r\n\r\n  /* If z is a NULL pointer, set pMem to contain an SQL NULL. */\r\n  if( !z ){\r\n    sqlite3VdbeMemSetNull(pMem);\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  if( pMem->db ){\r\n    iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];\r\n  }else{\r\n    iLimit = SQLITE_MAX_LENGTH;\r\n  }\r\n  flags = (enc==0?MEM_Blob:MEM_Str);\r\n  if( nByte<0 ){\r\n    assert( enc!=0 );\r\n    if( enc==SQLITE_UTF8 ){\r\n      for(nByte=0; nByte<=iLimit && z[nByte]; nByte++){}\r\n    }else{\r\n      for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}\r\n    }\r\n    flags |= MEM_Term;\r\n  }\r\n\r\n  /* The following block sets the new values of Mem.z and Mem.xDel. It\r\n  ** also sets a flag in local variable \"flags\" to indicate the memory\r\n  ** management (one of MEM_Dyn or MEM_Static).\r\n  */\r\n  if( xDel==SQLITE_TRANSIENT ){\r\n    int nAlloc = nByte;\r\n    if( flags&MEM_Term ){\r\n      nAlloc += (enc==SQLITE_UTF8?1:2);\r\n    }\r\n    if( nByte>iLimit ){\r\n      return SQLITE_TOOBIG;\r\n    }\r\n    if( sqlite3VdbeMemGrow(pMem, nAlloc, 0) ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    memcpy(pMem->z, z, nAlloc);\r\n  }else if( xDel==SQLITE_DYNAMIC ){\r\n    sqlite3VdbeMemRelease(pMem);\r\n    pMem->zMalloc = pMem->z = (char *)z;\r\n    pMem->xDel = 0;\r\n  }else{\r\n    sqlite3VdbeMemRelease(pMem);\r\n    pMem->z = (char *)z;\r\n    pMem->xDel = xDel;\r\n    flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);\r\n  }\r\n\r\n  pMem->n = nByte;\r\n  pMem->flags = flags;\r\n  pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);\r\n  pMem->type = (enc==0 ? SQLITE_BLOB : SQLITE_TEXT);\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n  if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n#endif\r\n\r\n  if( nByte>iLimit ){\r\n    return SQLITE_TOOBIG;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Compare the values contained by the two memory cells, returning\r\n** negative, zero or positive if pMem1 is less than, equal to, or greater\r\n** than pMem2. Sorting order is NULL's first, followed by numbers (integers\r\n** and reals) sorted numerically, followed by text ordered by the collating\r\n** sequence pColl and finally blob's ordered by memcmp().\r\n**\r\n** Two NULL values are considered equal by this function.\r\n*/\r\nSQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){\r\n  int rc;\r\n  int f1, f2;\r\n  int combined_flags;\r\n\r\n  f1 = pMem1->flags;\r\n  f2 = pMem2->flags;\r\n  combined_flags = f1|f2;\r\n  assert( (combined_flags & MEM_RowSet)==0 );\r\n \r\n  /* If one value is NULL, it is less than the other. If both values\r\n  ** are NULL, return 0.\r\n  */\r\n  if( combined_flags&MEM_Null ){\r\n    return (f2&MEM_Null) - (f1&MEM_Null);\r\n  }\r\n\r\n  /* If one value is a number and the other is not, the number is less.\r\n  ** If both are numbers, compare as reals if one is a real, or as integers\r\n  ** if both values are integers.\r\n  */\r\n  if( combined_flags&(MEM_Int|MEM_Real) ){\r\n    if( !(f1&(MEM_Int|MEM_Real)) ){\r\n      return 1;\r\n    }\r\n    if( !(f2&(MEM_Int|MEM_Real)) ){\r\n      return -1;\r\n    }\r\n    if( (f1 & f2 & MEM_Int)==0 ){\r\n      double r1, r2;\r\n      if( (f1&MEM_Real)==0 ){\r\n        r1 = (double)pMem1->u.i;\r\n      }else{\r\n        r1 = pMem1->r;\r\n      }\r\n      if( (f2&MEM_Real)==0 ){\r\n        r2 = (double)pMem2->u.i;\r\n      }else{\r\n        r2 = pMem2->r;\r\n      }\r\n      if( r1<r2 ) return -1;\r\n      if( r1>r2 ) return 1;\r\n      return 0;\r\n    }else{\r\n      assert( f1&MEM_Int );\r\n      assert( f2&MEM_Int );\r\n      if( pMem1->u.i < pMem2->u.i ) return -1;\r\n      if( pMem1->u.i > pMem2->u.i ) return 1;\r\n      return 0;\r\n    }\r\n  }\r\n\r\n  /* If one value is a string and the other is a blob, the string is less.\r\n  ** If both are strings, compare using the collating functions.\r\n  */\r\n  if( combined_flags&MEM_Str ){\r\n    if( (f1 & MEM_Str)==0 ){\r\n      return 1;\r\n    }\r\n    if( (f2 & MEM_Str)==0 ){\r\n      return -1;\r\n    }\r\n\r\n    assert( pMem1->enc==pMem2->enc );\r\n    assert( pMem1->enc==SQLITE_UTF8 || \r\n            pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );\r\n\r\n    /* The collation sequence must be defined at this point, even if\r\n    ** the user deletes the collation sequence after the vdbe program is\r\n    ** compiled (this was not always the case).\r\n    */\r\n    assert( !pColl || pColl->xCmp );\r\n\r\n    if( pColl ){\r\n      if( pMem1->enc==pColl->enc ){\r\n        /* The strings are already in the correct encoding.  Call the\r\n        ** comparison function directly */\r\n        return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z);\r\n      }else{\r\n        const void *v1, *v2;\r\n        int n1, n2;\r\n        Mem c1;\r\n        Mem c2;\r\n        memset(&c1, 0, sizeof(c1));\r\n        memset(&c2, 0, sizeof(c2));\r\n        sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem);\r\n        sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem);\r\n        v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc);\r\n        n1 = v1==0 ? 0 : c1.n;\r\n        v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);\r\n        n2 = v2==0 ? 0 : c2.n;\r\n        rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);\r\n        sqlite3VdbeMemRelease(&c1);\r\n        sqlite3VdbeMemRelease(&c2);\r\n        return rc;\r\n      }\r\n    }\r\n    /* If a NULL pointer was passed as the collate function, fall through\r\n    ** to the blob case and use memcmp().  */\r\n  }\r\n \r\n  /* Both values must be blobs.  Compare using memcmp().  */\r\n  rc = memcmp(pMem1->z, pMem2->z, (pMem1->n>pMem2->n)?pMem2->n:pMem1->n);\r\n  if( rc==0 ){\r\n    rc = pMem1->n - pMem2->n;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Move data out of a btree key or data field and into a Mem structure.\r\n** The data or key is taken from the entry that pCur is currently pointing\r\n** to.  offset and amt determine what portion of the data or key to retrieve.\r\n** key is true to get the key or false to get data.  The result is written\r\n** into the pMem element.\r\n**\r\n** The pMem structure is assumed to be uninitialized.  Any prior content\r\n** is overwritten without being freed.\r\n**\r\n** If this routine fails for any reason (malloc returns NULL or unable\r\n** to read from the disk) then the pMem is left in an inconsistent state.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMemFromBtree(\r\n  BtCursor *pCur,   /* Cursor pointing at record to retrieve. */\r\n  int offset,       /* Offset from the start of data to return bytes from. */\r\n  int amt,          /* Number of bytes to return. */\r\n  int key,          /* If true, retrieve from the btree key, not data. */\r\n  Mem *pMem         /* OUT: Return data in this Mem structure. */\r\n){\r\n  char *zData;        /* Data from the btree layer */\r\n  int available = 0;  /* Number of bytes available on the local btree page */\r\n  int rc = SQLITE_OK; /* Return code */\r\n\r\n  assert( sqlite3BtreeCursorIsValid(pCur) );\r\n\r\n  /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() \r\n  ** that both the BtShared and database handle mutexes are held. */\r\n  assert( (pMem->flags & MEM_RowSet)==0 );\r\n  if( key ){\r\n    zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);\r\n  }else{\r\n    zData = (char *)sqlite3BtreeDataFetch(pCur, &available);\r\n  }\r\n  assert( zData!=0 );\r\n\r\n  if( offset+amt<=available && (pMem->flags&MEM_Dyn)==0 ){\r\n    sqlite3VdbeMemRelease(pMem);\r\n    pMem->z = &zData[offset];\r\n    pMem->flags = MEM_Blob|MEM_Ephem;\r\n  }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){\r\n    pMem->flags = MEM_Blob|MEM_Dyn|MEM_Term;\r\n    pMem->enc = 0;\r\n    pMem->type = SQLITE_BLOB;\r\n    if( key ){\r\n      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);\r\n    }else{\r\n      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);\r\n    }\r\n    pMem->z[amt] = 0;\r\n    pMem->z[amt+1] = 0;\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3VdbeMemRelease(pMem);\r\n    }\r\n  }\r\n  pMem->n = amt;\r\n\r\n  return rc;\r\n}\r\n\r\n/* This function is only available internally, it is not part of the\r\n** external API. It works in a similar way to sqlite3_value_text(),\r\n** except the data returned is in the encoding specified by the second\r\n** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or\r\n** SQLITE_UTF8.\r\n**\r\n** (2006-02-16:)  The enc value can be or-ed with SQLITE_UTF16_ALIGNED.\r\n** If that is the case, then the result must be aligned on an even byte\r\n** boundary.\r\n*/\r\nSQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){\r\n  if( !pVal ) return 0;\r\n\r\n  assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );\r\n  assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );\r\n  assert( (pVal->flags & MEM_RowSet)==0 );\r\n\r\n  if( pVal->flags&MEM_Null ){\r\n    return 0;\r\n  }\r\n  assert( (MEM_Blob>>3) == MEM_Str );\r\n  pVal->flags |= (pVal->flags & MEM_Blob)>>3;\r\n  ExpandBlob(pVal);\r\n  if( pVal->flags&MEM_Str ){\r\n    sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);\r\n    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){\r\n      assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );\r\n      if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){\r\n        return 0;\r\n      }\r\n    }\r\n    sqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */\r\n  }else{\r\n    assert( (pVal->flags&MEM_Blob)==0 );\r\n    sqlite3VdbeMemStringify(pVal, enc);\r\n    assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );\r\n  }\r\n  assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0\r\n              || pVal->db->mallocFailed );\r\n  if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){\r\n    return pVal->z;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Create a new sqlite3_value object.\r\n*/\r\nSQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){\r\n  Mem *p = sqlite3DbMallocZero(db, sizeof(*p));\r\n  if( p ){\r\n    p->flags = MEM_Null;\r\n    p->type = SQLITE_NULL;\r\n    p->db = db;\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Create a new sqlite3_value object, containing the value of pExpr.\r\n**\r\n** This only works for very simple expressions that consist of one constant\r\n** token (i.e. \"5\", \"5.1\", \"'a string'\"). If the expression can\r\n** be converted directly into a value, then the value is allocated and\r\n** a pointer written to *ppVal. The caller is responsible for deallocating\r\n** the value by passing it to sqlite3ValueFree() later on. If the expression\r\n** cannot be converted to a value, then *ppVal is set to NULL.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ValueFromExpr(\r\n  sqlite3 *db,              /* The database connection */\r\n  Expr *pExpr,              /* The expression to evaluate */\r\n  u8 enc,                   /* Encoding to use */\r\n  u8 affinity,              /* Affinity to use */\r\n  sqlite3_value **ppVal     /* Write the new value here */\r\n){\r\n  int op;\r\n  char *zVal = 0;\r\n  sqlite3_value *pVal = 0;\r\n  int negInt = 1;\r\n  const char *zNeg = \"\";\r\n\r\n  if( !pExpr ){\r\n    *ppVal = 0;\r\n    return SQLITE_OK;\r\n  }\r\n  op = pExpr->op;\r\n\r\n  /* op can only be TK_REGISTER if we have compiled with SQLITE_ENABLE_STAT3.\r\n  ** The ifdef here is to enable us to achieve 100% branch test coverage even\r\n  ** when SQLITE_ENABLE_STAT3 is omitted.\r\n  */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  if( op==TK_REGISTER ) op = pExpr->op2;\r\n#else\r\n  if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;\r\n#endif\r\n\r\n  /* Handle negative integers in a single step.  This is needed in the\r\n  ** case when the value is -9223372036854775808.\r\n  */\r\n  if( op==TK_UMINUS\r\n   && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){\r\n    pExpr = pExpr->pLeft;\r\n    op = pExpr->op;\r\n    negInt = -1;\r\n    zNeg = \"-\";\r\n  }\r\n\r\n  if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){\r\n    pVal = sqlite3ValueNew(db);\r\n    if( pVal==0 ) goto no_mem;\r\n    if( ExprHasProperty(pExpr, EP_IntValue) ){\r\n      sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt);\r\n    }else{\r\n      zVal = sqlite3MPrintf(db, \"%s%s\", zNeg, pExpr->u.zToken);\r\n      if( zVal==0 ) goto no_mem;\r\n      sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);\r\n      if( op==TK_FLOAT ) pVal->type = SQLITE_FLOAT;\r\n    }\r\n    if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){\r\n      sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);\r\n    }else{\r\n      sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);\r\n    }\r\n    if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str;\r\n    if( enc!=SQLITE_UTF8 ){\r\n      sqlite3VdbeChangeEncoding(pVal, enc);\r\n    }\r\n  }else if( op==TK_UMINUS ) {\r\n    /* This branch happens for multiple negative signs.  Ex: -(-5) */\r\n    if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) ){\r\n      sqlite3VdbeMemNumerify(pVal);\r\n      if( pVal->u.i==SMALLEST_INT64 ){\r\n        pVal->flags &= MEM_Int;\r\n        pVal->flags |= MEM_Real;\r\n        pVal->r = (double)LARGEST_INT64;\r\n      }else{\r\n        pVal->u.i = -pVal->u.i;\r\n      }\r\n      pVal->r = -pVal->r;\r\n      sqlite3ValueApplyAffinity(pVal, affinity, enc);\r\n    }\r\n  }else if( op==TK_NULL ){\r\n    pVal = sqlite3ValueNew(db);\r\n    if( pVal==0 ) goto no_mem;\r\n  }\r\n#ifndef SQLITE_OMIT_BLOB_LITERAL\r\n  else if( op==TK_BLOB ){\r\n    int nVal;\r\n    assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );\r\n    assert( pExpr->u.zToken[1]=='\\'' );\r\n    pVal = sqlite3ValueNew(db);\r\n    if( !pVal ) goto no_mem;\r\n    zVal = &pExpr->u.zToken[2];\r\n    nVal = sqlite3Strlen30(zVal)-1;\r\n    assert( zVal[nVal]=='\\'' );\r\n    sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,\r\n                         0, SQLITE_DYNAMIC);\r\n  }\r\n#endif\r\n\r\n  if( pVal ){\r\n    sqlite3VdbeMemStoreType(pVal);\r\n  }\r\n  *ppVal = pVal;\r\n  return SQLITE_OK;\r\n\r\nno_mem:\r\n  db->mallocFailed = 1;\r\n  sqlite3DbFree(db, zVal);\r\n  sqlite3ValueFree(pVal);\r\n  *ppVal = 0;\r\n  return SQLITE_NOMEM;\r\n}\r\n\r\n/*\r\n** Change the string value of an sqlite3_value object\r\n*/\r\nSQLITE_PRIVATE void sqlite3ValueSetStr(\r\n  sqlite3_value *v,     /* Value to be set */\r\n  int n,                /* Length of string z */\r\n  const void *z,        /* Text of the new string */\r\n  u8 enc,               /* Encoding to use */\r\n  void (*xDel)(void*)   /* Destructor for the string */\r\n){\r\n  if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);\r\n}\r\n\r\n/*\r\n** Free an sqlite3_value object\r\n*/\r\nSQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value *v){\r\n  if( !v ) return;\r\n  sqlite3VdbeMemRelease((Mem *)v);\r\n  sqlite3DbFree(((Mem*)v)->db, v);\r\n}\r\n\r\n/*\r\n** Return the number of bytes in the sqlite3_value object assuming\r\n** that it uses the encoding \"enc\"\r\n*/\r\nSQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){\r\n  Mem *p = (Mem*)pVal;\r\n  if( (p->flags & MEM_Blob)!=0 || sqlite3ValueText(pVal, enc) ){\r\n    if( p->flags & MEM_Zero ){\r\n      return p->n + p->u.nZero;\r\n    }else{\r\n      return p->n;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/************** End of vdbemem.c *********************************************/\r\n/************** Begin file vdbeaux.c *****************************************/\r\n/*\r\n** 2003 September 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used for creating, destroying, and populating\r\n** a VDBE (or an \"sqlite3_stmt\" as it is known to the outside world.)  Prior\r\n** to version 2.8.7, all this code was combined into the vdbe.c source file.\r\n** But that file was getting too big so this subroutines were split out.\r\n*/\r\n\r\n\r\n\r\n/*\r\n** When debugging the code generator in a symbolic debugger, one can\r\n** set the sqlite3VdbeAddopTrace to 1 and all opcodes will be printed\r\n** as they are added to the instruction stream.\r\n*/\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE int sqlite3VdbeAddopTrace = 0;\r\n#endif\r\n\r\n\r\n/*\r\n** Create a new virtual database engine.\r\n*/\r\nSQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3 *db){\r\n  Vdbe *p;\r\n  p = sqlite3DbMallocZero(db, sizeof(Vdbe) );\r\n  if( p==0 ) return 0;\r\n  p->db = db;\r\n  if( db->pVdbe ){\r\n    db->pVdbe->pPrev = p;\r\n  }\r\n  p->pNext = db->pVdbe;\r\n  p->pPrev = 0;\r\n  db->pVdbe = p;\r\n  p->magic = VDBE_MAGIC_INIT;\r\n  return p;\r\n}\r\n\r\n/*\r\n** Remember the SQL string for a prepared statement.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){\r\n  assert( isPrepareV2==1 || isPrepareV2==0 );\r\n  if( p==0 ) return;\r\n#ifdef SQLITE_OMIT_TRACE\r\n  if( !isPrepareV2 ) return;\r\n#endif\r\n  assert( p->zSql==0 );\r\n  p->zSql = sqlite3DbStrNDup(p->db, z, n);\r\n  p->isPrepareV2 = (u8)isPrepareV2;\r\n}\r\n\r\n/*\r\n** Return the SQL associated with a prepared statement\r\n*/\r\nSQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  return (p && p->isPrepareV2) ? p->zSql : 0;\r\n}\r\n\r\n/*\r\n** Swap all content between two VDBE structures.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){\r\n  Vdbe tmp, *pTmp;\r\n  char *zTmp;\r\n  tmp = *pA;\r\n  *pA = *pB;\r\n  *pB = tmp;\r\n  pTmp = pA->pNext;\r\n  pA->pNext = pB->pNext;\r\n  pB->pNext = pTmp;\r\n  pTmp = pA->pPrev;\r\n  pA->pPrev = pB->pPrev;\r\n  pB->pPrev = pTmp;\r\n  zTmp = pA->zSql;\r\n  pA->zSql = pB->zSql;\r\n  pB->zSql = zTmp;\r\n  pB->isPrepareV2 = pA->isPrepareV2;\r\n}\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** Turn tracing on or off\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeTrace(Vdbe *p, FILE *trace){\r\n  p->trace = trace;\r\n}\r\n#endif\r\n\r\n/*\r\n** Resize the Vdbe.aOp array so that it is at least one op larger than \r\n** it was.\r\n**\r\n** If an out-of-memory error occurs while resizing the array, return\r\n** SQLITE_NOMEM. In this case Vdbe.aOp and Vdbe.nOpAlloc remain \r\n** unchanged (this is so that any opcodes already allocated can be \r\n** correctly deallocated along with the rest of the Vdbe).\r\n*/\r\nstatic int growOpArray(Vdbe *p){\r\n  VdbeOp *pNew;\r\n  int nNew = (p->nOpAlloc ? p->nOpAlloc*2 : (int)(1024/sizeof(Op)));\r\n  pNew = sqlite3DbRealloc(p->db, p->aOp, nNew*sizeof(Op));\r\n  if( pNew ){\r\n    p->nOpAlloc = sqlite3DbMallocSize(p->db, pNew)/sizeof(Op);\r\n    p->aOp = pNew;\r\n  }\r\n  return (pNew ? SQLITE_OK : SQLITE_NOMEM);\r\n}\r\n\r\n/*\r\n** Add a new instruction to the list of instructions current in the\r\n** VDBE.  Return the address of the new instruction.\r\n**\r\n** Parameters:\r\n**\r\n**    p               Pointer to the VDBE\r\n**\r\n**    op              The opcode for this instruction\r\n**\r\n**    p1, p2, p3      Operands\r\n**\r\n** Use the sqlite3VdbeResolveLabel() function to fix an address and\r\n** the sqlite3VdbeChangeP4() function to change the value of the P4\r\n** operand.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){\r\n  int i;\r\n  VdbeOp *pOp;\r\n\r\n  i = p->nOp;\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  assert( op>0 && op<0xff );\r\n  if( p->nOpAlloc<=i ){\r\n    if( growOpArray(p) ){\r\n      return 1;\r\n    }\r\n  }\r\n  p->nOp++;\r\n  pOp = &p->aOp[i];\r\n  pOp->opcode = (u8)op;\r\n  pOp->p5 = 0;\r\n  pOp->p1 = p1;\r\n  pOp->p2 = p2;\r\n  pOp->p3 = p3;\r\n  pOp->p4.p = 0;\r\n  pOp->p4type = P4_NOTUSED;\r\n#ifdef SQLITE_DEBUG\r\n  pOp->zComment = 0;\r\n  if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);\r\n#endif\r\n#ifdef VDBE_PROFILE\r\n  pOp->cycles = 0;\r\n  pOp->cnt = 0;\r\n#endif\r\n  return i;\r\n}\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe *p, int op){\r\n  return sqlite3VdbeAddOp3(p, op, 0, 0, 0);\r\n}\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){\r\n  return sqlite3VdbeAddOp3(p, op, p1, 0, 0);\r\n}\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){\r\n  return sqlite3VdbeAddOp3(p, op, p1, p2, 0);\r\n}\r\n\r\n\r\n/*\r\n** Add an opcode that includes the p4 value as a pointer.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp4(\r\n  Vdbe *p,            /* Add the opcode to this VM */\r\n  int op,             /* The new opcode */\r\n  int p1,             /* The P1 operand */\r\n  int p2,             /* The P2 operand */\r\n  int p3,             /* The P3 operand */\r\n  const char *zP4,    /* The P4 operand */\r\n  int p4type          /* P4 operand type */\r\n){\r\n  int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);\r\n  sqlite3VdbeChangeP4(p, addr, zP4, p4type);\r\n  return addr;\r\n}\r\n\r\n/*\r\n** Add an OP_ParseSchema opcode.  This routine is broken out from\r\n** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees\r\n** as having been used.\r\n**\r\n** The zWhere string must have been obtained from sqlite3_malloc().\r\n** This routine will take ownership of the allocated memory.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){\r\n  int j;\r\n  int addr = sqlite3VdbeAddOp3(p, OP_ParseSchema, iDb, 0, 0);\r\n  sqlite3VdbeChangeP4(p, addr, zWhere, P4_DYNAMIC);\r\n  for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);\r\n}\r\n\r\n/*\r\n** Add an opcode that includes the p4 value as an integer.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeAddOp4Int(\r\n  Vdbe *p,            /* Add the opcode to this VM */\r\n  int op,             /* The new opcode */\r\n  int p1,             /* The P1 operand */\r\n  int p2,             /* The P2 operand */\r\n  int p3,             /* The P3 operand */\r\n  int p4              /* The P4 operand as an integer */\r\n){\r\n  int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);\r\n  sqlite3VdbeChangeP4(p, addr, SQLITE_INT_TO_PTR(p4), P4_INT32);\r\n  return addr;\r\n}\r\n\r\n/*\r\n** Create a new symbolic label for an instruction that has yet to be\r\n** coded.  The symbolic label is really just a negative number.  The\r\n** label can be used as the P2 value of an operation.  Later, when\r\n** the label is resolved to a specific address, the VDBE will scan\r\n** through its operation list and change all values of P2 which match\r\n** the label into the resolved address.\r\n**\r\n** The VDBE knows that a P2 value is a label because labels are\r\n** always negative and P2 values are suppose to be non-negative.\r\n** Hence, a negative P2 value is a label that has yet to be resolved.\r\n**\r\n** Zero is returned if a malloc() fails.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *p){\r\n  int i = p->nLabel++;\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  if( (i & (i-1))==0 ){\r\n    p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel, \r\n                                       (i*2+1)*sizeof(p->aLabel[0]));\r\n  }\r\n  if( p->aLabel ){\r\n    p->aLabel[i] = -1;\r\n  }\r\n  return -1-i;\r\n}\r\n\r\n/*\r\n** Resolve label \"x\" to be the address of the next instruction to\r\n** be inserted.  The parameter \"x\" must have been obtained from\r\n** a prior call to sqlite3VdbeMakeLabel().\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *p, int x){\r\n  int j = -1-x;\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  assert( j>=0 && j<p->nLabel );\r\n  if( p->aLabel ){\r\n    p->aLabel[j] = p->nOp;\r\n  }\r\n}\r\n\r\n/*\r\n** Mark the VDBE as one that can only be run one time.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){\r\n  p->runOnlyOnce = 1;\r\n}\r\n\r\n#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */\r\n\r\n/*\r\n** The following type and function are used to iterate through all opcodes\r\n** in a Vdbe main program and each of the sub-programs (triggers) it may \r\n** invoke directly or indirectly. It should be used as follows:\r\n**\r\n**   Op *pOp;\r\n**   VdbeOpIter sIter;\r\n**\r\n**   memset(&sIter, 0, sizeof(sIter));\r\n**   sIter.v = v;                            // v is of type Vdbe* \r\n**   while( (pOp = opIterNext(&sIter)) ){\r\n**     // Do something with pOp\r\n**   }\r\n**   sqlite3DbFree(v->db, sIter.apSub);\r\n** \r\n*/\r\ntypedef struct VdbeOpIter VdbeOpIter;\r\nstruct VdbeOpIter {\r\n  Vdbe *v;                   /* Vdbe to iterate through the opcodes of */\r\n  SubProgram **apSub;        /* Array of subprograms */\r\n  int nSub;                  /* Number of entries in apSub */\r\n  int iAddr;                 /* Address of next instruction to return */\r\n  int iSub;                  /* 0 = main program, 1 = first sub-program etc. */\r\n};\r\nstatic Op *opIterNext(VdbeOpIter *p){\r\n  Vdbe *v = p->v;\r\n  Op *pRet = 0;\r\n  Op *aOp;\r\n  int nOp;\r\n\r\n  if( p->iSub<=p->nSub ){\r\n\r\n    if( p->iSub==0 ){\r\n      aOp = v->aOp;\r\n      nOp = v->nOp;\r\n    }else{\r\n      aOp = p->apSub[p->iSub-1]->aOp;\r\n      nOp = p->apSub[p->iSub-1]->nOp;\r\n    }\r\n    assert( p->iAddr<nOp );\r\n\r\n    pRet = &aOp[p->iAddr];\r\n    p->iAddr++;\r\n    if( p->iAddr==nOp ){\r\n      p->iSub++;\r\n      p->iAddr = 0;\r\n    }\r\n  \r\n    if( pRet->p4type==P4_SUBPROGRAM ){\r\n      int nByte = (p->nSub+1)*sizeof(SubProgram*);\r\n      int j;\r\n      for(j=0; j<p->nSub; j++){\r\n        if( p->apSub[j]==pRet->p4.pProgram ) break;\r\n      }\r\n      if( j==p->nSub ){\r\n        p->apSub = sqlite3DbReallocOrFree(v->db, p->apSub, nByte);\r\n        if( !p->apSub ){\r\n          pRet = 0;\r\n        }else{\r\n          p->apSub[p->nSub++] = pRet->p4.pProgram;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  return pRet;\r\n}\r\n\r\n/*\r\n** Check if the program stored in the VM associated with pParse may\r\n** throw an ABORT exception (causing the statement, but not entire transaction\r\n** to be rolled back). This condition is true if the main program or any\r\n** sub-programs contains any of the following:\r\n**\r\n**   *  OP_Halt with P1=SQLITE_CONSTRAINT and P2=OE_Abort.\r\n**   *  OP_HaltIfNull with P1=SQLITE_CONSTRAINT and P2=OE_Abort.\r\n**   *  OP_Destroy\r\n**   *  OP_VUpdate\r\n**   *  OP_VRename\r\n**   *  OP_FkCounter with P2==0 (immediate foreign key constraint)\r\n**\r\n** Then check that the value of Parse.mayAbort is true if an\r\n** ABORT may be thrown, or false otherwise. Return true if it does\r\n** match, or false otherwise. This function is intended to be used as\r\n** part of an assert statement in the compiler. Similar to:\r\n**\r\n**   assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) );\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){\r\n  int hasAbort = 0;\r\n  Op *pOp;\r\n  VdbeOpIter sIter;\r\n  memset(&sIter, 0, sizeof(sIter));\r\n  sIter.v = v;\r\n\r\n  while( (pOp = opIterNext(&sIter))!=0 ){\r\n    int opcode = pOp->opcode;\r\n    if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename \r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n     || (opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1) \r\n#endif\r\n     || ((opcode==OP_Halt || opcode==OP_HaltIfNull) \r\n      && (pOp->p1==SQLITE_CONSTRAINT && pOp->p2==OE_Abort))\r\n    ){\r\n      hasAbort = 1;\r\n      break;\r\n    }\r\n  }\r\n  sqlite3DbFree(v->db, sIter.apSub);\r\n\r\n  /* Return true if hasAbort==mayAbort. Or if a malloc failure occured.\r\n  ** If malloc failed, then the while() loop above may not have iterated\r\n  ** through all opcodes and hasAbort may be set incorrectly. Return\r\n  ** true for this case to prevent the assert() in the callers frame\r\n  ** from failing.  */\r\n  return ( v->db->mallocFailed || hasAbort==mayAbort );\r\n}\r\n#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */\r\n\r\n/*\r\n** Loop through the program looking for P2 values that are negative\r\n** on jump instructions.  Each such value is a label.  Resolve the\r\n** label by setting the P2 value to its correct non-zero value.\r\n**\r\n** This routine is called once after all opcodes have been inserted.\r\n**\r\n** Variable *pMaxFuncArgs is set to the maximum value of any P2 argument \r\n** to an OP_Function, OP_AggStep or OP_VFilter opcode. This is used by \r\n** sqlite3VdbeMakeReady() to size the Vdbe.apArg[] array.\r\n**\r\n** The Op.opflags field is set on all opcodes.\r\n*/\r\nstatic void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){\r\n  int i;\r\n  int nMaxArgs = *pMaxFuncArgs;\r\n  Op *pOp;\r\n  int *aLabel = p->aLabel;\r\n  p->readOnly = 1;\r\n  for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){\r\n    u8 opcode = pOp->opcode;\r\n\r\n    pOp->opflags = sqlite3OpcodeProperty[opcode];\r\n    if( opcode==OP_Function || opcode==OP_AggStep ){\r\n      if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;\r\n    }else if( (opcode==OP_Transaction && pOp->p2!=0) || opcode==OP_Vacuum ){\r\n      p->readOnly = 0;\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    }else if( opcode==OP_VUpdate ){\r\n      if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;\r\n    }else if( opcode==OP_VFilter ){\r\n      int n;\r\n      assert( p->nOp - i >= 3 );\r\n      assert( pOp[-1].opcode==OP_Integer );\r\n      n = pOp[-1].p1;\r\n      if( n>nMaxArgs ) nMaxArgs = n;\r\n#endif\r\n    }else if( opcode==OP_Next || opcode==OP_SorterNext ){\r\n      pOp->p4.xAdvance = sqlite3BtreeNext;\r\n      pOp->p4type = P4_ADVANCE;\r\n    }else if( opcode==OP_Prev ){\r\n      pOp->p4.xAdvance = sqlite3BtreePrevious;\r\n      pOp->p4type = P4_ADVANCE;\r\n    }\r\n\r\n    if( (pOp->opflags & OPFLG_JUMP)!=0 && pOp->p2<0 ){\r\n      assert( -1-pOp->p2<p->nLabel );\r\n      pOp->p2 = aLabel[-1-pOp->p2];\r\n    }\r\n  }\r\n  sqlite3DbFree(p->db, p->aLabel);\r\n  p->aLabel = 0;\r\n\r\n  *pMaxFuncArgs = nMaxArgs;\r\n}\r\n\r\n/*\r\n** Return the address of the next instruction to be inserted.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  return p->nOp;\r\n}\r\n\r\n/*\r\n** This function returns a pointer to the array of opcodes associated with\r\n** the Vdbe passed as the first argument. It is the callers responsibility\r\n** to arrange for the returned array to be eventually freed using the \r\n** vdbeFreeOpArray() function.\r\n**\r\n** Before returning, *pnOp is set to the number of entries in the returned\r\n** array. Also, *pnMaxArg is set to the larger of its current value and \r\n** the number of entries in the Vdbe.apArg[] array required to execute the \r\n** returned program.\r\n*/\r\nSQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){\r\n  VdbeOp *aOp = p->aOp;\r\n  assert( aOp && !p->db->mallocFailed );\r\n\r\n  /* Check that sqlite3VdbeUsesBtree() was not called on this VM */\r\n  assert( p->btreeMask==0 );\r\n\r\n  resolveP2Values(p, pnMaxArg);\r\n  *pnOp = p->nOp;\r\n  p->aOp = 0;\r\n  return aOp;\r\n}\r\n\r\n/*\r\n** Add a whole list of operations to the operation stack.  Return the\r\n** address of the first operation added.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){\r\n  int addr;\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  if( p->nOp + nOp > p->nOpAlloc && growOpArray(p) ){\r\n    return 0;\r\n  }\r\n  addr = p->nOp;\r\n  if( ALWAYS(nOp>0) ){\r\n    int i;\r\n    VdbeOpList const *pIn = aOp;\r\n    for(i=0; i<nOp; i++, pIn++){\r\n      int p2 = pIn->p2;\r\n      VdbeOp *pOut = &p->aOp[i+addr];\r\n      pOut->opcode = pIn->opcode;\r\n      pOut->p1 = pIn->p1;\r\n      if( p2<0 && (sqlite3OpcodeProperty[pOut->opcode] & OPFLG_JUMP)!=0 ){\r\n        pOut->p2 = addr + ADDR(p2);\r\n      }else{\r\n        pOut->p2 = p2;\r\n      }\r\n      pOut->p3 = pIn->p3;\r\n      pOut->p4type = P4_NOTUSED;\r\n      pOut->p4.p = 0;\r\n      pOut->p5 = 0;\r\n#ifdef SQLITE_DEBUG\r\n      pOut->zComment = 0;\r\n      if( sqlite3VdbeAddopTrace ){\r\n        sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]);\r\n      }\r\n#endif\r\n    }\r\n    p->nOp += nOp;\r\n  }\r\n  return addr;\r\n}\r\n\r\n/*\r\n** Change the value of the P1 operand for a specific instruction.\r\n** This routine is useful when a large program is loaded from a\r\n** static array using sqlite3VdbeAddOpList but we want to make a\r\n** few minor changes to the program.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, u32 addr, int val){\r\n  assert( p!=0 );\r\n  if( ((u32)p->nOp)>addr ){\r\n    p->aOp[addr].p1 = val;\r\n  }\r\n}\r\n\r\n/*\r\n** Change the value of the P2 operand for a specific instruction.\r\n** This routine is useful for setting a jump destination.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){\r\n  assert( p!=0 );\r\n  if( ((u32)p->nOp)>addr ){\r\n    p->aOp[addr].p2 = val;\r\n  }\r\n}\r\n\r\n/*\r\n** Change the value of the P3 operand for a specific instruction.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){\r\n  assert( p!=0 );\r\n  if( ((u32)p->nOp)>addr ){\r\n    p->aOp[addr].p3 = val;\r\n  }\r\n}\r\n\r\n/*\r\n** Change the value of the P5 operand for the most recently\r\n** added operation.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 val){\r\n  assert( p!=0 );\r\n  if( p->aOp ){\r\n    assert( p->nOp>0 );\r\n    p->aOp[p->nOp-1].p5 = val;\r\n  }\r\n}\r\n\r\n/*\r\n** Change the P2 operand of instruction addr so that it points to\r\n** the address of the next instruction to be coded.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){\r\n  assert( addr>=0 || p->db->mallocFailed );\r\n  if( addr>=0 ) sqlite3VdbeChangeP2(p, addr, p->nOp);\r\n}\r\n\r\n\r\n/*\r\n** If the input FuncDef structure is ephemeral, then free it.  If\r\n** the FuncDef is not ephermal, then do nothing.\r\n*/\r\nstatic void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){\r\n  if( ALWAYS(pDef) && (pDef->flags & SQLITE_FUNC_EPHEM)!=0 ){\r\n    sqlite3DbFree(db, pDef);\r\n  }\r\n}\r\n\r\nstatic void vdbeFreeOpArray(sqlite3 *, Op *, int);\r\n\r\n/*\r\n** Delete a P4 value if necessary.\r\n*/\r\nstatic void freeP4(sqlite3 *db, int p4type, void *p4){\r\n  if( p4 ){\r\n    assert( db );\r\n    switch( p4type ){\r\n      case P4_REAL:\r\n      case P4_INT64:\r\n      case P4_DYNAMIC:\r\n      case P4_KEYINFO:\r\n      case P4_INTARRAY:\r\n      case P4_KEYINFO_HANDOFF: {\r\n        sqlite3DbFree(db, p4);\r\n        break;\r\n      }\r\n      case P4_MPRINTF: {\r\n        if( db->pnBytesFreed==0 ) sqlite3_free(p4);\r\n        break;\r\n      }\r\n      case P4_VDBEFUNC: {\r\n        VdbeFunc *pVdbeFunc = (VdbeFunc *)p4;\r\n        freeEphemeralFunction(db, pVdbeFunc->pFunc);\r\n        if( db->pnBytesFreed==0 ) sqlite3VdbeDeleteAuxData(pVdbeFunc, 0);\r\n        sqlite3DbFree(db, pVdbeFunc);\r\n        break;\r\n      }\r\n      case P4_FUNCDEF: {\r\n        freeEphemeralFunction(db, (FuncDef*)p4);\r\n        break;\r\n      }\r\n      case P4_MEM: {\r\n        if( db->pnBytesFreed==0 ){\r\n          sqlite3ValueFree((sqlite3_value*)p4);\r\n        }else{\r\n          Mem *p = (Mem*)p4;\r\n          sqlite3DbFree(db, p->zMalloc);\r\n          sqlite3DbFree(db, p);\r\n        }\r\n        break;\r\n      }\r\n      case P4_VTAB : {\r\n        if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);\r\n        break;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Free the space allocated for aOp and any p4 values allocated for the\r\n** opcodes contained within. If aOp is not NULL it is assumed to contain \r\n** nOp entries. \r\n*/\r\nstatic void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){\r\n  if( aOp ){\r\n    Op *pOp;\r\n    for(pOp=aOp; pOp<&aOp[nOp]; pOp++){\r\n      freeP4(db, pOp->p4type, pOp->p4.p);\r\n#ifdef SQLITE_DEBUG\r\n      sqlite3DbFree(db, pOp->zComment);\r\n#endif     \r\n    }\r\n  }\r\n  sqlite3DbFree(db, aOp);\r\n}\r\n\r\n/*\r\n** Link the SubProgram object passed as the second argument into the linked\r\n** list at Vdbe.pSubProgram. This list is used to delete all sub-program\r\n** objects when the VM is no longer required.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){\r\n  p->pNext = pVdbe->pProgram;\r\n  pVdbe->pProgram = p;\r\n}\r\n\r\n/*\r\n** Change the opcode at addr into OP_Noop\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe *p, int addr){\r\n  if( p->aOp ){\r\n    VdbeOp *pOp = &p->aOp[addr];\r\n    sqlite3 *db = p->db;\r\n    freeP4(db, pOp->p4type, pOp->p4.p);\r\n    memset(pOp, 0, sizeof(pOp[0]));\r\n    pOp->opcode = OP_Noop;\r\n  }\r\n}\r\n\r\n/*\r\n** Change the value of the P4 operand for a specific instruction.\r\n** This routine is useful when a large program is loaded from a\r\n** static array using sqlite3VdbeAddOpList but we want to make a\r\n** few minor changes to the program.\r\n**\r\n** If n>=0 then the P4 operand is dynamic, meaning that a copy of\r\n** the string is made into memory obtained from sqlite3_malloc().\r\n** A value of n==0 means copy bytes of zP4 up to and including the\r\n** first null byte.  If n>0 then copy n+1 bytes of zP4.\r\n**\r\n** If n==P4_KEYINFO it means that zP4 is a pointer to a KeyInfo structure.\r\n** A copy is made of the KeyInfo structure into memory obtained from\r\n** sqlite3_malloc, to be freed when the Vdbe is finalized.\r\n** n==P4_KEYINFO_HANDOFF indicates that zP4 points to a KeyInfo structure\r\n** stored in memory that the caller has obtained from sqlite3_malloc. The \r\n** caller should not free the allocation, it will be freed when the Vdbe is\r\n** finalized.\r\n** \r\n** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points\r\n** to a string or structure that is guaranteed to exist for the lifetime of\r\n** the Vdbe. In these cases we can just copy the pointer.\r\n**\r\n** If addr<0 then change P4 on the most recently inserted instruction.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){\r\n  Op *pOp;\r\n  sqlite3 *db;\r\n  assert( p!=0 );\r\n  db = p->db;\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  if( p->aOp==0 || db->mallocFailed ){\r\n    if ( n!=P4_KEYINFO && n!=P4_VTAB ) {\r\n      freeP4(db, n, (void*)*(char**)&zP4);\r\n    }\r\n    return;\r\n  }\r\n  assert( p->nOp>0 );\r\n  assert( addr<p->nOp );\r\n  if( addr<0 ){\r\n    addr = p->nOp - 1;\r\n  }\r\n  pOp = &p->aOp[addr];\r\n  freeP4(db, pOp->p4type, pOp->p4.p);\r\n  pOp->p4.p = 0;\r\n  if( n==P4_INT32 ){\r\n    /* Note: this cast is safe, because the origin data point was an int\r\n    ** that was cast to a (const char *). */\r\n    pOp->p4.i = SQLITE_PTR_TO_INT(zP4);\r\n    pOp->p4type = P4_INT32;\r\n  }else if( zP4==0 ){\r\n    pOp->p4.p = 0;\r\n    pOp->p4type = P4_NOTUSED;\r\n  }else if( n==P4_KEYINFO ){\r\n    KeyInfo *pKeyInfo;\r\n    int nField, nByte;\r\n\r\n    nField = ((KeyInfo*)zP4)->nField;\r\n    nByte = sizeof(*pKeyInfo) + (nField-1)*sizeof(pKeyInfo->aColl[0]) + nField;\r\n    pKeyInfo = sqlite3DbMallocRaw(0, nByte);\r\n    pOp->p4.pKeyInfo = pKeyInfo;\r\n    if( pKeyInfo ){\r\n      u8 *aSortOrder;\r\n      memcpy((char*)pKeyInfo, zP4, nByte - nField);\r\n      aSortOrder = pKeyInfo->aSortOrder;\r\n      if( aSortOrder ){\r\n        pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField];\r\n        memcpy(pKeyInfo->aSortOrder, aSortOrder, nField);\r\n      }\r\n      pOp->p4type = P4_KEYINFO;\r\n    }else{\r\n      p->db->mallocFailed = 1;\r\n      pOp->p4type = P4_NOTUSED;\r\n    }\r\n  }else if( n==P4_KEYINFO_HANDOFF ){\r\n    pOp->p4.p = (void*)zP4;\r\n    pOp->p4type = P4_KEYINFO;\r\n  }else if( n==P4_VTAB ){\r\n    pOp->p4.p = (void*)zP4;\r\n    pOp->p4type = P4_VTAB;\r\n    sqlite3VtabLock((VTable *)zP4);\r\n    assert( ((VTable *)zP4)->db==p->db );\r\n  }else if( n<0 ){\r\n    pOp->p4.p = (void*)zP4;\r\n    pOp->p4type = (signed char)n;\r\n  }else{\r\n    if( n==0 ) n = sqlite3Strlen30(zP4);\r\n    pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);\r\n    pOp->p4type = P4_DYNAMIC;\r\n  }\r\n}\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** Change the comment on the the most recently coded instruction.  Or\r\n** insert a No-op and add the comment to that new instruction.  This\r\n** makes the code easier to read during debugging.  None of this happens\r\n** in a production build.\r\n*/\r\nstatic void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){\r\n  assert( p->nOp>0 || p->aOp==0 );\r\n  assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed );\r\n  if( p->nOp ){\r\n    assert( p->aOp );\r\n    sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment);\r\n    p->aOp[p->nOp-1].zComment = sqlite3VMPrintf(p->db, zFormat, ap);\r\n  }\r\n}\r\nSQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){\r\n  va_list ap;\r\n  if( p ){\r\n    va_start(ap, zFormat);\r\n    vdbeVComment(p, zFormat, ap);\r\n    va_end(ap);\r\n  }\r\n}\r\nSQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){\r\n  va_list ap;\r\n  if( p ){\r\n    sqlite3VdbeAddOp0(p, OP_Noop);\r\n    va_start(ap, zFormat);\r\n    vdbeVComment(p, zFormat, ap);\r\n    va_end(ap);\r\n  }\r\n}\r\n#endif  /* NDEBUG */\r\n\r\n/*\r\n** Return the opcode for a given address.  If the address is -1, then\r\n** return the most recently inserted opcode.\r\n**\r\n** If a memory allocation error has occurred prior to the calling of this\r\n** routine, then a pointer to a dummy VdbeOp will be returned.  That opcode\r\n** is readable but not writable, though it is cast to a writable value.\r\n** The return of a dummy opcode allows the call to continue functioning\r\n** after a OOM fault without having to check to see if the return from \r\n** this routine is a valid pointer.  But because the dummy.opcode is 0,\r\n** dummy will never be written to.  This is verified by code inspection and\r\n** by running with Valgrind.\r\n**\r\n** About the #ifdef SQLITE_OMIT_TRACE:  Normally, this routine is never called\r\n** unless p->nOp>0.  This is because in the absense of SQLITE_OMIT_TRACE,\r\n** an OP_Trace instruction is always inserted by sqlite3VdbeGet() as soon as\r\n** a new VDBE is created.  So we are free to set addr to p->nOp-1 without\r\n** having to double-check to make sure that the result is non-negative. But\r\n** if SQLITE_OMIT_TRACE is defined, the OP_Trace is omitted and we do need to\r\n** check the value of p->nOp-1 before continuing.\r\n*/\r\nSQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){\r\n  /* C89 specifies that the constant \"dummy\" will be initialized to all\r\n  ** zeros, which is correct.  MSVC generates a warning, nevertheless. */\r\n  static VdbeOp dummy;  /* Ignore the MSVC warning about no initializer */\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  if( addr<0 ){\r\n#ifdef SQLITE_OMIT_TRACE\r\n    if( p->nOp==0 ) return (VdbeOp*)&dummy;\r\n#endif\r\n    addr = p->nOp - 1;\r\n  }\r\n  assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );\r\n  if( p->db->mallocFailed ){\r\n    return (VdbeOp*)&dummy;\r\n  }else{\r\n    return &p->aOp[addr];\r\n  }\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \\\r\n     || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)\r\n/*\r\n** Compute a string that describes the P4 parameter for an opcode.\r\n** Use zTemp for any required temporary buffer space.\r\n*/\r\nstatic char *displayP4(Op *pOp, char *zTemp, int nTemp){\r\n  char *zP4 = zTemp;\r\n  assert( nTemp>=20 );\r\n  switch( pOp->p4type ){\r\n    case P4_KEYINFO_STATIC:\r\n    case P4_KEYINFO: {\r\n      int i, j;\r\n      KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;\r\n      sqlite3_snprintf(nTemp, zTemp, \"keyinfo(%d\", pKeyInfo->nField);\r\n      i = sqlite3Strlen30(zTemp);\r\n      for(j=0; j<pKeyInfo->nField; j++){\r\n        CollSeq *pColl = pKeyInfo->aColl[j];\r\n        if( pColl ){\r\n          int n = sqlite3Strlen30(pColl->zName);\r\n          if( i+n>nTemp-6 ){\r\n            memcpy(&zTemp[i],\",...\",4);\r\n            break;\r\n          }\r\n          zTemp[i++] = ',';\r\n          if( pKeyInfo->aSortOrder && pKeyInfo->aSortOrder[j] ){\r\n            zTemp[i++] = '-';\r\n          }\r\n          memcpy(&zTemp[i], pColl->zName,n+1);\r\n          i += n;\r\n        }else if( i+4<nTemp-6 ){\r\n          memcpy(&zTemp[i],\",nil\",4);\r\n          i += 4;\r\n        }\r\n      }\r\n      zTemp[i++] = ')';\r\n      zTemp[i] = 0;\r\n      assert( i<nTemp );\r\n      break;\r\n    }\r\n    case P4_COLLSEQ: {\r\n      CollSeq *pColl = pOp->p4.pColl;\r\n      sqlite3_snprintf(nTemp, zTemp, \"collseq(%.20s)\", pColl->zName);\r\n      break;\r\n    }\r\n    case P4_FUNCDEF: {\r\n      FuncDef *pDef = pOp->p4.pFunc;\r\n      sqlite3_snprintf(nTemp, zTemp, \"%s(%d)\", pDef->zName, pDef->nArg);\r\n      break;\r\n    }\r\n    case P4_INT64: {\r\n      sqlite3_snprintf(nTemp, zTemp, \"%lld\", *pOp->p4.pI64);\r\n      break;\r\n    }\r\n    case P4_INT32: {\r\n      sqlite3_snprintf(nTemp, zTemp, \"%d\", pOp->p4.i);\r\n      break;\r\n    }\r\n    case P4_REAL: {\r\n      sqlite3_snprintf(nTemp, zTemp, \"%.16g\", *pOp->p4.pReal);\r\n      break;\r\n    }\r\n    case P4_MEM: {\r\n      Mem *pMem = pOp->p4.pMem;\r\n      if( pMem->flags & MEM_Str ){\r\n        zP4 = pMem->z;\r\n      }else if( pMem->flags & MEM_Int ){\r\n        sqlite3_snprintf(nTemp, zTemp, \"%lld\", pMem->u.i);\r\n      }else if( pMem->flags & MEM_Real ){\r\n        sqlite3_snprintf(nTemp, zTemp, \"%.16g\", pMem->r);\r\n      }else if( pMem->flags & MEM_Null ){\r\n        sqlite3_snprintf(nTemp, zTemp, \"NULL\");\r\n      }else{\r\n        assert( pMem->flags & MEM_Blob );\r\n        zP4 = \"(blob)\";\r\n      }\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    case P4_VTAB: {\r\n      sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab;\r\n      sqlite3_snprintf(nTemp, zTemp, \"vtab:%p:%p\", pVtab, pVtab->pModule);\r\n      break;\r\n    }\r\n#endif\r\n    case P4_INTARRAY: {\r\n      sqlite3_snprintf(nTemp, zTemp, \"intarray\");\r\n      break;\r\n    }\r\n    case P4_SUBPROGRAM: {\r\n      sqlite3_snprintf(nTemp, zTemp, \"program\");\r\n      break;\r\n    }\r\n    case P4_ADVANCE: {\r\n      zTemp[0] = 0;\r\n      break;\r\n    }\r\n    default: {\r\n      zP4 = pOp->p4.z;\r\n      if( zP4==0 ){\r\n        zP4 = zTemp;\r\n        zTemp[0] = 0;\r\n      }\r\n    }\r\n  }\r\n  assert( zP4!=0 );\r\n  return zP4;\r\n}\r\n#endif\r\n\r\n/*\r\n** Declare to the Vdbe that the BTree object at db->aDb[i] is used.\r\n**\r\n** The prepared statements need to know in advance the complete set of\r\n** attached databases that will be use.  A mask of these databases\r\n** is maintained in p->btreeMask.  The p->lockMask value is the subset of\r\n** p->btreeMask of databases that will require a lock.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){\r\n  assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );\r\n  assert( i<(int)sizeof(p->btreeMask)*8 );\r\n  p->btreeMask |= ((yDbMask)1)<<i;\r\n  if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){\r\n    p->lockMask |= ((yDbMask)1)<<i;\r\n  }\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0\r\n/*\r\n** If SQLite is compiled to support shared-cache mode and to be threadsafe,\r\n** this routine obtains the mutex associated with each BtShared structure\r\n** that may be accessed by the VM passed as an argument. In doing so it also\r\n** sets the BtShared.db member of each of the BtShared structures, ensuring\r\n** that the correct busy-handler callback is invoked if required.\r\n**\r\n** If SQLite is not threadsafe but does support shared-cache mode, then\r\n** sqlite3BtreeEnter() is invoked to set the BtShared.db variables\r\n** of all of BtShared structures accessible via the database handle \r\n** associated with the VM.\r\n**\r\n** If SQLite is not threadsafe and does not support shared-cache mode, this\r\n** function is a no-op.\r\n**\r\n** The p->btreeMask field is a bitmask of all btrees that the prepared \r\n** statement p will ever use.  Let N be the number of bits in p->btreeMask\r\n** corresponding to btrees that use shared cache.  Then the runtime of\r\n** this routine is N*N.  But as N is rarely more than 1, this should not\r\n** be a problem.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){\r\n  int i;\r\n  yDbMask mask;\r\n  sqlite3 *db;\r\n  Db *aDb;\r\n  int nDb;\r\n  if( p->lockMask==0 ) return;  /* The common case */\r\n  db = p->db;\r\n  aDb = db->aDb;\r\n  nDb = db->nDb;\r\n  for(i=0, mask=1; i<nDb; i++, mask += mask){\r\n    if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){\r\n      sqlite3BtreeEnter(aDb[i].pBt);\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0\r\n/*\r\n** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){\r\n  int i;\r\n  yDbMask mask;\r\n  sqlite3 *db;\r\n  Db *aDb;\r\n  int nDb;\r\n  if( p->lockMask==0 ) return;  /* The common case */\r\n  db = p->db;\r\n  aDb = db->aDb;\r\n  nDb = db->nDb;\r\n  for(i=0, mask=1; i<nDb; i++, mask += mask){\r\n    if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){\r\n      sqlite3BtreeLeave(aDb[i].pBt);\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\n#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)\r\n/*\r\n** Print a single opcode.  This routine is used for debugging only.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){\r\n  char *zP4;\r\n  char zPtr[50];\r\n  static const char *zFormat1 = \"%4d %-13s %4d %4d %4d %-4s %.2X %s\\n\";\r\n  if( pOut==0 ) pOut = stdout;\r\n  zP4 = displayP4(pOp, zPtr, sizeof(zPtr));\r\n  fprintf(pOut, zFormat1, pc, \r\n      sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,\r\n#ifdef SQLITE_DEBUG\r\n      pOp->zComment ? pOp->zComment : \"\"\r\n#else\r\n      \"\"\r\n#endif\r\n  );\r\n  fflush(pOut);\r\n}\r\n#endif\r\n\r\n/*\r\n** Release an array of N Mem elements\r\n*/\r\nstatic void releaseMemArray(Mem *p, int N){\r\n  if( p && N ){\r\n    Mem *pEnd;\r\n    sqlite3 *db = p->db;\r\n    u8 malloc_failed = db->mallocFailed;\r\n    if( db->pnBytesFreed ){\r\n      for(pEnd=&p[N]; p<pEnd; p++){\r\n        sqlite3DbFree(db, p->zMalloc);\r\n      }\r\n      return;\r\n    }\r\n    for(pEnd=&p[N]; p<pEnd; p++){\r\n      assert( (&p[1])==pEnd || p[0].db==p[1].db );\r\n\r\n      /* This block is really an inlined version of sqlite3VdbeMemRelease()\r\n      ** that takes advantage of the fact that the memory cell value is \r\n      ** being set to NULL after releasing any dynamic resources.\r\n      **\r\n      ** The justification for duplicating code is that according to \r\n      ** callgrind, this causes a certain test case to hit the CPU 4.7 \r\n      ** percent less (x86 linux, gcc version 4.1.2, -O6) than if \r\n      ** sqlite3MemRelease() were called from here. With -O2, this jumps\r\n      ** to 6.6 percent. The test case is inserting 1000 rows into a table \r\n      ** with no indexes using a single prepared INSERT statement, bind() \r\n      ** and reset(). Inserts are grouped into a transaction.\r\n      */\r\n      if( p->flags&(MEM_Agg|MEM_Dyn|MEM_Frame|MEM_RowSet) ){\r\n        sqlite3VdbeMemRelease(p);\r\n      }else if( p->zMalloc ){\r\n        sqlite3DbFree(db, p->zMalloc);\r\n        p->zMalloc = 0;\r\n      }\r\n\r\n      p->flags = MEM_Invalid;\r\n    }\r\n    db->mallocFailed = malloc_failed;\r\n  }\r\n}\r\n\r\n/*\r\n** Delete a VdbeFrame object and its contents. VdbeFrame objects are\r\n** allocated by the OP_Program opcode in sqlite3VdbeExec().\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){\r\n  int i;\r\n  Mem *aMem = VdbeFrameMem(p);\r\n  VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem];\r\n  for(i=0; i<p->nChildCsr; i++){\r\n    sqlite3VdbeFreeCursor(p->v, apCsr[i]);\r\n  }\r\n  releaseMemArray(aMem, p->nChildMem);\r\n  sqlite3DbFree(p->v->db, p);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n/*\r\n** Give a listing of the program in the virtual machine.\r\n**\r\n** The interface is the same as sqlite3VdbeExec().  But instead of\r\n** running the code, it invokes the callback once for each instruction.\r\n** This feature is used to implement \"EXPLAIN\".\r\n**\r\n** When p->explain==1, each instruction is listed.  When\r\n** p->explain==2, only OP_Explain instructions are listed and these\r\n** are shown in a different format.  p->explain==2 is used to implement\r\n** EXPLAIN QUERY PLAN.\r\n**\r\n** When p->explain==1, first the main program is listed, then each of\r\n** the trigger subprograms are listed one by one.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeList(\r\n  Vdbe *p                   /* The VDBE */\r\n){\r\n  int nRow;                            /* Stop when row count reaches this */\r\n  int nSub = 0;                        /* Number of sub-vdbes seen so far */\r\n  SubProgram **apSub = 0;              /* Array of sub-vdbes */\r\n  Mem *pSub = 0;                       /* Memory cell hold array of subprogs */\r\n  sqlite3 *db = p->db;                 /* The database connection */\r\n  int i;                               /* Loop counter */\r\n  int rc = SQLITE_OK;                  /* Return code */\r\n  Mem *pMem = &p->aMem[1];             /* First Mem of result set */\r\n\r\n  assert( p->explain );\r\n  assert( p->magic==VDBE_MAGIC_RUN );\r\n  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );\r\n\r\n  /* Even though this opcode does not use dynamic strings for\r\n  ** the result, result columns may become dynamic if the user calls\r\n  ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.\r\n  */\r\n  releaseMemArray(pMem, 8);\r\n  p->pResultSet = 0;\r\n\r\n  if( p->rc==SQLITE_NOMEM ){\r\n    /* This happens if a malloc() inside a call to sqlite3_column_text() or\r\n    ** sqlite3_column_text16() failed.  */\r\n    db->mallocFailed = 1;\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  /* When the number of output rows reaches nRow, that means the\r\n  ** listing has finished and sqlite3_step() should return SQLITE_DONE.\r\n  ** nRow is the sum of the number of rows in the main program, plus\r\n  ** the sum of the number of rows in all trigger subprograms encountered\r\n  ** so far.  The nRow value will increase as new trigger subprograms are\r\n  ** encountered, but p->pc will eventually catch up to nRow.\r\n  */\r\n  nRow = p->nOp;\r\n  if( p->explain==1 ){\r\n    /* The first 8 memory cells are used for the result set.  So we will\r\n    ** commandeer the 9th cell to use as storage for an array of pointers\r\n    ** to trigger subprograms.  The VDBE is guaranteed to have at least 9\r\n    ** cells.  */\r\n    assert( p->nMem>9 );\r\n    pSub = &p->aMem[9];\r\n    if( pSub->flags&MEM_Blob ){\r\n      /* On the first call to sqlite3_step(), pSub will hold a NULL.  It is\r\n      ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */\r\n      nSub = pSub->n/sizeof(Vdbe*);\r\n      apSub = (SubProgram **)pSub->z;\r\n    }\r\n    for(i=0; i<nSub; i++){\r\n      nRow += apSub[i]->nOp;\r\n    }\r\n  }\r\n\r\n  do{\r\n    i = p->pc++;\r\n  }while( i<nRow && p->explain==2 && p->aOp[i].opcode!=OP_Explain );\r\n  if( i>=nRow ){\r\n    p->rc = SQLITE_OK;\r\n    rc = SQLITE_DONE;\r\n  }else if( db->u1.isInterrupted ){\r\n    p->rc = SQLITE_INTERRUPT;\r\n    rc = SQLITE_ERROR;\r\n    sqlite3SetString(&p->zErrMsg, db, \"%s\", sqlite3ErrStr(p->rc));\r\n  }else{\r\n    char *z;\r\n    Op *pOp;\r\n    if( i<p->nOp ){\r\n      /* The output line number is small enough that we are still in the\r\n      ** main program. */\r\n      pOp = &p->aOp[i];\r\n    }else{\r\n      /* We are currently listing subprograms.  Figure out which one and\r\n      ** pick up the appropriate opcode. */\r\n      int j;\r\n      i -= p->nOp;\r\n      for(j=0; i>=apSub[j]->nOp; j++){\r\n        i -= apSub[j]->nOp;\r\n      }\r\n      pOp = &apSub[j]->aOp[i];\r\n    }\r\n    if( p->explain==1 ){\r\n      pMem->flags = MEM_Int;\r\n      pMem->type = SQLITE_INTEGER;\r\n      pMem->u.i = i;                                /* Program counter */\r\n      pMem++;\r\n  \r\n      pMem->flags = MEM_Static|MEM_Str|MEM_Term;\r\n      pMem->z = (char*)sqlite3OpcodeName(pOp->opcode);  /* Opcode */\r\n      assert( pMem->z!=0 );\r\n      pMem->n = sqlite3Strlen30(pMem->z);\r\n      pMem->type = SQLITE_TEXT;\r\n      pMem->enc = SQLITE_UTF8;\r\n      pMem++;\r\n\r\n      /* When an OP_Program opcode is encounter (the only opcode that has\r\n      ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms\r\n      ** kept in p->aMem[9].z to hold the new program - assuming this subprogram\r\n      ** has not already been seen.\r\n      */\r\n      if( pOp->p4type==P4_SUBPROGRAM ){\r\n        int nByte = (nSub+1)*sizeof(SubProgram*);\r\n        int j;\r\n        for(j=0; j<nSub; j++){\r\n          if( apSub[j]==pOp->p4.pProgram ) break;\r\n        }\r\n        if( j==nSub && SQLITE_OK==sqlite3VdbeMemGrow(pSub, nByte, 1) ){\r\n          apSub = (SubProgram **)pSub->z;\r\n          apSub[nSub++] = pOp->p4.pProgram;\r\n          pSub->flags |= MEM_Blob;\r\n          pSub->n = nSub*sizeof(SubProgram*);\r\n        }\r\n      }\r\n    }\r\n\r\n    pMem->flags = MEM_Int;\r\n    pMem->u.i = pOp->p1;                          /* P1 */\r\n    pMem->type = SQLITE_INTEGER;\r\n    pMem++;\r\n\r\n    pMem->flags = MEM_Int;\r\n    pMem->u.i = pOp->p2;                          /* P2 */\r\n    pMem->type = SQLITE_INTEGER;\r\n    pMem++;\r\n\r\n    pMem->flags = MEM_Int;\r\n    pMem->u.i = pOp->p3;                          /* P3 */\r\n    pMem->type = SQLITE_INTEGER;\r\n    pMem++;\r\n\r\n    if( sqlite3VdbeMemGrow(pMem, 32, 0) ){            /* P4 */\r\n      assert( p->db->mallocFailed );\r\n      return SQLITE_ERROR;\r\n    }\r\n    pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;\r\n    z = displayP4(pOp, pMem->z, 32);\r\n    if( z!=pMem->z ){\r\n      sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0);\r\n    }else{\r\n      assert( pMem->z!=0 );\r\n      pMem->n = sqlite3Strlen30(pMem->z);\r\n      pMem->enc = SQLITE_UTF8;\r\n    }\r\n    pMem->type = SQLITE_TEXT;\r\n    pMem++;\r\n\r\n    if( p->explain==1 ){\r\n      if( sqlite3VdbeMemGrow(pMem, 4, 0) ){\r\n        assert( p->db->mallocFailed );\r\n        return SQLITE_ERROR;\r\n      }\r\n      pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;\r\n      pMem->n = 2;\r\n      sqlite3_snprintf(3, pMem->z, \"%.2x\", pOp->p5);   /* P5 */\r\n      pMem->type = SQLITE_TEXT;\r\n      pMem->enc = SQLITE_UTF8;\r\n      pMem++;\r\n  \r\n#ifdef SQLITE_DEBUG\r\n      if( pOp->zComment ){\r\n        pMem->flags = MEM_Str|MEM_Term;\r\n        pMem->z = pOp->zComment;\r\n        pMem->n = sqlite3Strlen30(pMem->z);\r\n        pMem->enc = SQLITE_UTF8;\r\n        pMem->type = SQLITE_TEXT;\r\n      }else\r\n#endif\r\n      {\r\n        pMem->flags = MEM_Null;                       /* Comment */\r\n        pMem->type = SQLITE_NULL;\r\n      }\r\n    }\r\n\r\n    p->nResColumn = 8 - 4*(p->explain-1);\r\n    p->pResultSet = &p->aMem[1];\r\n    p->rc = SQLITE_OK;\r\n    rc = SQLITE_ROW;\r\n  }\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_EXPLAIN */\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** Print the SQL that was used to generate a VDBE program.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){\r\n  int nOp = p->nOp;\r\n  VdbeOp *pOp;\r\n  if( nOp<1 ) return;\r\n  pOp = &p->aOp[0];\r\n  if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){\r\n    const char *z = pOp->p4.z;\r\n    while( sqlite3Isspace(*z) ) z++;\r\n    printf(\"SQL: [%s]\\n\", z);\r\n  }\r\n}\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)\r\n/*\r\n** Print an IOTRACE message showing SQL content.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){\r\n  int nOp = p->nOp;\r\n  VdbeOp *pOp;\r\n  if( sqlite3IoTrace==0 ) return;\r\n  if( nOp<1 ) return;\r\n  pOp = &p->aOp[0];\r\n  if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){\r\n    int i, j;\r\n    char z[1000];\r\n    sqlite3_snprintf(sizeof(z), z, \"%s\", pOp->p4.z);\r\n    for(i=0; sqlite3Isspace(z[i]); i++){}\r\n    for(j=0; z[i]; i++){\r\n      if( sqlite3Isspace(z[i]) ){\r\n        if( z[i-1]!=' ' ){\r\n          z[j++] = ' ';\r\n        }\r\n      }else{\r\n        z[j++] = z[i];\r\n      }\r\n    }\r\n    z[j] = 0;\r\n    sqlite3IoTrace(\"SQL %s\\n\", z);\r\n  }\r\n}\r\n#endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */\r\n\r\n/*\r\n** Allocate space from a fixed size buffer and return a pointer to\r\n** that space.  If insufficient space is available, return NULL.\r\n**\r\n** The pBuf parameter is the initial value of a pointer which will\r\n** receive the new memory.  pBuf is normally NULL.  If pBuf is not\r\n** NULL, it means that memory space has already been allocated and that\r\n** this routine should not allocate any new memory.  When pBuf is not\r\n** NULL simply return pBuf.  Only allocate new memory space when pBuf\r\n** is NULL.\r\n**\r\n** nByte is the number of bytes of space needed.\r\n**\r\n** *ppFrom points to available space and pEnd points to the end of the\r\n** available space.  When space is allocated, *ppFrom is advanced past\r\n** the end of the allocated space.\r\n**\r\n** *pnByte is a counter of the number of bytes of space that have failed\r\n** to allocate.  If there is insufficient space in *ppFrom to satisfy the\r\n** request, then increment *pnByte by the amount of the request.\r\n*/\r\nstatic void *allocSpace(\r\n  void *pBuf,          /* Where return pointer will be stored */\r\n  int nByte,           /* Number of bytes to allocate */\r\n  u8 **ppFrom,         /* IN/OUT: Allocate from *ppFrom */\r\n  u8 *pEnd,            /* Pointer to 1 byte past the end of *ppFrom buffer */\r\n  int *pnByte          /* If allocation cannot be made, increment *pnByte */\r\n){\r\n  assert( EIGHT_BYTE_ALIGNMENT(*ppFrom) );\r\n  if( pBuf ) return pBuf;\r\n  nByte = ROUND8(nByte);\r\n  if( &(*ppFrom)[nByte] <= pEnd ){\r\n    pBuf = (void*)*ppFrom;\r\n    *ppFrom += nByte;\r\n  }else{\r\n    *pnByte += nByte;\r\n  }\r\n  return pBuf;\r\n}\r\n\r\n/*\r\n** Rewind the VDBE back to the beginning in preparation for\r\n** running it.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){\r\n#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)\r\n  int i;\r\n#endif\r\n  assert( p!=0 );\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n\r\n  /* There should be at least one opcode.\r\n  */\r\n  assert( p->nOp>0 );\r\n\r\n  /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */\r\n  p->magic = VDBE_MAGIC_RUN;\r\n\r\n#ifdef SQLITE_DEBUG\r\n  for(i=1; i<p->nMem; i++){\r\n    assert( p->aMem[i].db==p->db );\r\n  }\r\n#endif\r\n  p->pc = -1;\r\n  p->rc = SQLITE_OK;\r\n  p->errorAction = OE_Abort;\r\n  p->magic = VDBE_MAGIC_RUN;\r\n  p->nChange = 0;\r\n  p->cacheCtr = 1;\r\n  p->minWriteFileFormat = 255;\r\n  p->iStatement = 0;\r\n  p->nFkConstraint = 0;\r\n#ifdef VDBE_PROFILE\r\n  for(i=0; i<p->nOp; i++){\r\n    p->aOp[i].cnt = 0;\r\n    p->aOp[i].cycles = 0;\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Prepare a virtual machine for execution for the first time after\r\n** creating the virtual machine.  This involves things such\r\n** as allocating stack space and initializing the program counter.\r\n** After the VDBE has be prepped, it can be executed by one or more\r\n** calls to sqlite3VdbeExec().  \r\n**\r\n** This function may be called exact once on a each virtual machine.\r\n** After this routine is called the VM has been \"packaged\" and is ready\r\n** to run.  After this routine is called, futher calls to \r\n** sqlite3VdbeAddOp() functions are prohibited.  This routine disconnects\r\n** the Vdbe from the Parse object that helped generate it so that the\r\n** the Vdbe becomes an independent entity and the Parse object can be\r\n** destroyed.\r\n**\r\n** Use the sqlite3VdbeRewind() procedure to restore a virtual machine back\r\n** to its initial state after it has been run.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMakeReady(\r\n  Vdbe *p,                       /* The VDBE */\r\n  Parse *pParse                  /* Parsing context */\r\n){\r\n  sqlite3 *db;                   /* The database connection */\r\n  int nVar;                      /* Number of parameters */\r\n  int nMem;                      /* Number of VM memory registers */\r\n  int nCursor;                   /* Number of cursors required */\r\n  int nArg;                      /* Number of arguments in subprograms */\r\n  int nOnce;                     /* Number of OP_Once instructions */\r\n  int n;                         /* Loop counter */\r\n  u8 *zCsr;                      /* Memory available for allocation */\r\n  u8 *zEnd;                      /* First byte past allocated memory */\r\n  int nByte;                     /* How much extra memory is needed */\r\n\r\n  assert( p!=0 );\r\n  assert( p->nOp>0 );\r\n  assert( pParse!=0 );\r\n  assert( p->magic==VDBE_MAGIC_INIT );\r\n  db = p->db;\r\n  assert( db->mallocFailed==0 );\r\n  nVar = pParse->nVar;\r\n  nMem = pParse->nMem;\r\n  nCursor = pParse->nTab;\r\n  nArg = pParse->nMaxArg;\r\n  nOnce = pParse->nOnce;\r\n  if( nOnce==0 ) nOnce = 1; /* Ensure at least one byte in p->aOnceFlag[] */\r\n  \r\n  /* For each cursor required, also allocate a memory cell. Memory\r\n  ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by\r\n  ** the vdbe program. Instead they are used to allocate space for\r\n  ** VdbeCursor/BtCursor structures. The blob of memory associated with \r\n  ** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1)\r\n  ** stores the blob of memory associated with cursor 1, etc.\r\n  **\r\n  ** See also: allocateCursor().\r\n  */\r\n  nMem += nCursor;\r\n\r\n  /* Allocate space for memory registers, SQL variables, VDBE cursors and \r\n  ** an array to marshal SQL function arguments in.\r\n  */\r\n  zCsr = (u8*)&p->aOp[p->nOp];       /* Memory avaliable for allocation */\r\n  zEnd = (u8*)&p->aOp[p->nOpAlloc];  /* First byte past end of zCsr[] */\r\n\r\n  resolveP2Values(p, &nArg);\r\n  p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);\r\n  if( pParse->explain && nMem<10 ){\r\n    nMem = 10;\r\n  }\r\n  memset(zCsr, 0, zEnd-zCsr);\r\n  zCsr += (zCsr - (u8*)0)&7;\r\n  assert( EIGHT_BYTE_ALIGNMENT(zCsr) );\r\n  p->expired = 0;\r\n\r\n  /* Memory for registers, parameters, cursor, etc, is allocated in two\r\n  ** passes.  On the first pass, we try to reuse unused space at the \r\n  ** end of the opcode array.  If we are unable to satisfy all memory\r\n  ** requirements by reusing the opcode array tail, then the second\r\n  ** pass will fill in the rest using a fresh allocation.  \r\n  **\r\n  ** This two-pass approach that reuses as much memory as possible from\r\n  ** the leftover space at the end of the opcode array can significantly\r\n  ** reduce the amount of memory held by a prepared statement.\r\n  */\r\n  do {\r\n    nByte = 0;\r\n    p->aMem = allocSpace(p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);\r\n    p->aVar = allocSpace(p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte);\r\n    p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);\r\n    p->azVar = allocSpace(p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte);\r\n    p->apCsr = allocSpace(p->apCsr, nCursor*sizeof(VdbeCursor*),\r\n                          &zCsr, zEnd, &nByte);\r\n    p->aOnceFlag = allocSpace(p->aOnceFlag, nOnce, &zCsr, zEnd, &nByte);\r\n    if( nByte ){\r\n      p->pFree = sqlite3DbMallocZero(db, nByte);\r\n    }\r\n    zCsr = p->pFree;\r\n    zEnd = &zCsr[nByte];\r\n  }while( nByte && !db->mallocFailed );\r\n\r\n  p->nCursor = (u16)nCursor;\r\n  p->nOnceFlag = nOnce;\r\n  if( p->aVar ){\r\n    p->nVar = (ynVar)nVar;\r\n    for(n=0; n<nVar; n++){\r\n      p->aVar[n].flags = MEM_Null;\r\n      p->aVar[n].db = db;\r\n    }\r\n  }\r\n  if( p->azVar ){\r\n    p->nzVar = pParse->nzVar;\r\n    memcpy(p->azVar, pParse->azVar, p->nzVar*sizeof(p->azVar[0]));\r\n    memset(pParse->azVar, 0, pParse->nzVar*sizeof(pParse->azVar[0]));\r\n  }\r\n  if( p->aMem ){\r\n    p->aMem--;                      /* aMem[] goes from 1..nMem */\r\n    p->nMem = nMem;                 /*       not from 0..nMem-1 */\r\n    for(n=1; n<=nMem; n++){\r\n      p->aMem[n].flags = MEM_Invalid;\r\n      p->aMem[n].db = db;\r\n    }\r\n  }\r\n  p->explain = pParse->explain;\r\n  sqlite3VdbeRewind(p);\r\n}\r\n\r\n/*\r\n** Close a VDBE cursor and release all the resources that cursor \r\n** happens to hold.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){\r\n  if( pCx==0 ){\r\n    return;\r\n  }\r\n  sqlite3VdbeSorterClose(p->db, pCx);\r\n  if( pCx->pBt ){\r\n    sqlite3BtreeClose(pCx->pBt);\r\n    /* The pCx->pCursor will be close automatically, if it exists, by\r\n    ** the call above. */\r\n  }else if( pCx->pCursor ){\r\n    sqlite3BtreeCloseCursor(pCx->pCursor);\r\n  }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( pCx->pVtabCursor ){\r\n    sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor;\r\n    const sqlite3_module *pModule = pCx->pModule;\r\n    p->inVtabMethod = 1;\r\n    pModule->xClose(pVtabCursor);\r\n    p->inVtabMethod = 0;\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Copy the values stored in the VdbeFrame structure to its Vdbe. This\r\n** is used, for example, when a trigger sub-program is halted to restore\r\n** control to the main program.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){\r\n  Vdbe *v = pFrame->v;\r\n  v->aOnceFlag = pFrame->aOnceFlag;\r\n  v->nOnceFlag = pFrame->nOnceFlag;\r\n  v->aOp = pFrame->aOp;\r\n  v->nOp = pFrame->nOp;\r\n  v->aMem = pFrame->aMem;\r\n  v->nMem = pFrame->nMem;\r\n  v->apCsr = pFrame->apCsr;\r\n  v->nCursor = pFrame->nCursor;\r\n  v->db->lastRowid = pFrame->lastRowid;\r\n  v->nChange = pFrame->nChange;\r\n  return pFrame->pc;\r\n}\r\n\r\n/*\r\n** Close all cursors.\r\n**\r\n** Also release any dynamic memory held by the VM in the Vdbe.aMem memory \r\n** cell array. This is necessary as the memory cell array may contain\r\n** pointers to VdbeFrame objects, which may in turn contain pointers to\r\n** open cursors.\r\n*/\r\nstatic void closeAllCursors(Vdbe *p){\r\n  if( p->pFrame ){\r\n    VdbeFrame *pFrame;\r\n    for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);\r\n    sqlite3VdbeFrameRestore(pFrame);\r\n  }\r\n  p->pFrame = 0;\r\n  p->nFrame = 0;\r\n\r\n  if( p->apCsr ){\r\n    int i;\r\n    for(i=0; i<p->nCursor; i++){\r\n      VdbeCursor *pC = p->apCsr[i];\r\n      if( pC ){\r\n        sqlite3VdbeFreeCursor(p, pC);\r\n        p->apCsr[i] = 0;\r\n      }\r\n    }\r\n  }\r\n  if( p->aMem ){\r\n    releaseMemArray(&p->aMem[1], p->nMem);\r\n  }\r\n  while( p->pDelFrame ){\r\n    VdbeFrame *pDel = p->pDelFrame;\r\n    p->pDelFrame = pDel->pParent;\r\n    sqlite3VdbeFrameDelete(pDel);\r\n  }\r\n}\r\n\r\n/*\r\n** Clean up the VM after execution.\r\n**\r\n** This routine will automatically close any cursors, lists, and/or\r\n** sorters that were left open.  It also deletes the values of\r\n** variables in the aVar[] array.\r\n*/\r\nstatic void Cleanup(Vdbe *p){\r\n  sqlite3 *db = p->db;\r\n\r\n#ifdef SQLITE_DEBUG\r\n  /* Execute assert() statements to ensure that the Vdbe.apCsr[] and \r\n  ** Vdbe.aMem[] arrays have already been cleaned up.  */\r\n  int i;\r\n  if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );\r\n  if( p->aMem ){\r\n    for(i=1; i<=p->nMem; i++) assert( p->aMem[i].flags==MEM_Invalid );\r\n  }\r\n#endif\r\n\r\n  sqlite3DbFree(db, p->zErrMsg);\r\n  p->zErrMsg = 0;\r\n  p->pResultSet = 0;\r\n}\r\n\r\n/*\r\n** Set the number of result columns that will be returned by this SQL\r\n** statement. This is now set at compile time, rather than during\r\n** execution of the vdbe program so that sqlite3_column_count() can\r\n** be called on an SQL statement before sqlite3_step().\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){\r\n  Mem *pColName;\r\n  int n;\r\n  sqlite3 *db = p->db;\r\n\r\n  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);\r\n  sqlite3DbFree(db, p->aColName);\r\n  n = nResColumn*COLNAME_N;\r\n  p->nResColumn = (u16)nResColumn;\r\n  p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );\r\n  if( p->aColName==0 ) return;\r\n  while( n-- > 0 ){\r\n    pColName->flags = MEM_Null;\r\n    pColName->db = p->db;\r\n    pColName++;\r\n  }\r\n}\r\n\r\n/*\r\n** Set the name of the idx'th column to be returned by the SQL statement.\r\n** zName must be a pointer to a nul terminated string.\r\n**\r\n** This call must be made after a call to sqlite3VdbeSetNumCols().\r\n**\r\n** The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC\r\n** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed\r\n** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSetColName(\r\n  Vdbe *p,                         /* Vdbe being configured */\r\n  int idx,                         /* Index of column zName applies to */\r\n  int var,                         /* One of the COLNAME_* constants */\r\n  const char *zName,               /* Pointer to buffer containing name */\r\n  void (*xDel)(void*)              /* Memory management strategy for zName */\r\n){\r\n  int rc;\r\n  Mem *pColName;\r\n  assert( idx<p->nResColumn );\r\n  assert( var<COLNAME_N );\r\n  if( p->db->mallocFailed ){\r\n    assert( !zName || xDel!=SQLITE_DYNAMIC );\r\n    return SQLITE_NOMEM;\r\n  }\r\n  assert( p->aColName!=0 );\r\n  pColName = &(p->aColName[idx+var*p->nResColumn]);\r\n  rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel);\r\n  assert( rc!=0 || !zName || (pColName->flags&MEM_Term)!=0 );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** A read or write transaction may or may not be active on database handle\r\n** db. If a transaction is active, commit it. If there is a\r\n** write-transaction spanning more than one database file, this routine\r\n** takes care of the master journal trickery.\r\n*/\r\nstatic int vdbeCommit(sqlite3 *db, Vdbe *p){\r\n  int i;\r\n  int nTrans = 0;  /* Number of databases with an active write-transaction */\r\n  int rc = SQLITE_OK;\r\n  int needXcommit = 0;\r\n\r\n#ifdef SQLITE_OMIT_VIRTUALTABLE\r\n  /* With this option, sqlite3VtabSync() is defined to be simply \r\n  ** SQLITE_OK so p is not used. \r\n  */\r\n  UNUSED_PARAMETER(p);\r\n#endif\r\n\r\n  /* Before doing anything else, call the xSync() callback for any\r\n  ** virtual module tables written in this transaction. This has to\r\n  ** be done before determining whether a master journal file is \r\n  ** required, as an xSync() callback may add an attached database\r\n  ** to the transaction.\r\n  */\r\n  rc = sqlite3VtabSync(db, &p->zErrMsg);\r\n\r\n  /* This loop determines (a) if the commit hook should be invoked and\r\n  ** (b) how many database files have open write transactions, not \r\n  ** including the temp database. (b) is important because if more than \r\n  ** one database file has an open write transaction, a master journal\r\n  ** file is required for an atomic commit.\r\n  */ \r\n  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ \r\n    Btree *pBt = db->aDb[i].pBt;\r\n    if( sqlite3BtreeIsInTrans(pBt) ){\r\n      needXcommit = 1;\r\n      if( i!=1 ) nTrans++;\r\n      rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt));\r\n    }\r\n  }\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  /* If there are any write-transactions at all, invoke the commit hook */\r\n  if( needXcommit && db->xCommitCallback ){\r\n    rc = db->xCommitCallback(db->pCommitArg);\r\n    if( rc ){\r\n      return SQLITE_CONSTRAINT;\r\n    }\r\n  }\r\n\r\n  /* The simple case - no more than one database file (not counting the\r\n  ** TEMP database) has a transaction active.   There is no need for the\r\n  ** master-journal.\r\n  **\r\n  ** If the return value of sqlite3BtreeGetFilename() is a zero length\r\n  ** string, it means the main database is :memory: or a temp file.  In \r\n  ** that case we do not support atomic multi-file commits, so use the \r\n  ** simple case then too.\r\n  */\r\n  if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt))\r\n   || nTrans<=1\r\n  ){\r\n    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\r\n      Btree *pBt = db->aDb[i].pBt;\r\n      if( pBt ){\r\n        rc = sqlite3BtreeCommitPhaseOne(pBt, 0);\r\n      }\r\n    }\r\n\r\n    /* Do the commit only if all databases successfully complete phase 1. \r\n    ** If one of the BtreeCommitPhaseOne() calls fails, this indicates an\r\n    ** IO error while deleting or truncating a journal file. It is unlikely,\r\n    ** but could happen. In this case abandon processing and return the error.\r\n    */\r\n    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\r\n      Btree *pBt = db->aDb[i].pBt;\r\n      if( pBt ){\r\n        rc = sqlite3BtreeCommitPhaseTwo(pBt, 0);\r\n      }\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3VtabCommit(db);\r\n    }\r\n  }\r\n\r\n  /* The complex case - There is a multi-file write-transaction active.\r\n  ** This requires a master journal file to ensure the transaction is\r\n  ** committed atomicly.\r\n  */\r\n#ifndef SQLITE_OMIT_DISKIO\r\n  else{\r\n    sqlite3_vfs *pVfs = db->pVfs;\r\n    int needSync = 0;\r\n    char *zMaster = 0;   /* File-name for the master journal */\r\n    char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);\r\n    sqlite3_file *pMaster = 0;\r\n    i64 offset = 0;\r\n    int res;\r\n    int retryCount = 0;\r\n    int nMainFile;\r\n\r\n    /* Select a master journal file name */\r\n    nMainFile = sqlite3Strlen30(zMainFile);\r\n    zMaster = sqlite3MPrintf(db, \"%s-mjXXXXXX9XXz\", zMainFile);\r\n    if( zMaster==0 ) return SQLITE_NOMEM;\r\n    do {\r\n      u32 iRandom;\r\n      if( retryCount ){\r\n        if( retryCount>100 ){\r\n          sqlite3_log(SQLITE_FULL, \"MJ delete: %s\", zMaster);\r\n          sqlite3OsDelete(pVfs, zMaster, 0);\r\n          break;\r\n        }else if( retryCount==1 ){\r\n          sqlite3_log(SQLITE_FULL, \"MJ collide: %s\", zMaster);\r\n        }\r\n      }\r\n      retryCount++;\r\n      sqlite3_randomness(sizeof(iRandom), &iRandom);\r\n      sqlite3_snprintf(13, &zMaster[nMainFile], \"-mj%06X9%02X\",\r\n                               (iRandom>>8)&0xffffff, iRandom&0xff);\r\n      /* The antipenultimate character of the master journal name must\r\n      ** be \"9\" to avoid name collisions when using 8+3 filenames. */\r\n      assert( zMaster[sqlite3Strlen30(zMaster)-3]=='9' );\r\n      sqlite3FileSuffix3(zMainFile, zMaster);\r\n      rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res);\r\n    }while( rc==SQLITE_OK && res );\r\n    if( rc==SQLITE_OK ){\r\n      /* Open the master journal. */\r\n      rc = sqlite3OsOpenMalloc(pVfs, zMaster, &pMaster, \r\n          SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|\r\n          SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_MASTER_JOURNAL, 0\r\n      );\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3DbFree(db, zMaster);\r\n      return rc;\r\n    }\r\n \r\n    /* Write the name of each database file in the transaction into the new\r\n    ** master journal file. If an error occurs at this point close\r\n    ** and delete the master journal file. All the individual journal files\r\n    ** still have 'null' as the master journal pointer, so they will roll\r\n    ** back independently if a failure occurs.\r\n    */\r\n    for(i=0; i<db->nDb; i++){\r\n      Btree *pBt = db->aDb[i].pBt;\r\n      if( sqlite3BtreeIsInTrans(pBt) ){\r\n        char const *zFile = sqlite3BtreeGetJournalname(pBt);\r\n        if( zFile==0 ){\r\n          continue;  /* Ignore TEMP and :memory: databases */\r\n        }\r\n        assert( zFile[0]!=0 );\r\n        if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){\r\n          needSync = 1;\r\n        }\r\n        rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset);\r\n        offset += sqlite3Strlen30(zFile)+1;\r\n        if( rc!=SQLITE_OK ){\r\n          sqlite3OsCloseFree(pMaster);\r\n          sqlite3OsDelete(pVfs, zMaster, 0);\r\n          sqlite3DbFree(db, zMaster);\r\n          return rc;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Sync the master journal file. If the IOCAP_SEQUENTIAL device\r\n    ** flag is set this is not required.\r\n    */\r\n    if( needSync \r\n     && 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)\r\n     && SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL))\r\n    ){\r\n      sqlite3OsCloseFree(pMaster);\r\n      sqlite3OsDelete(pVfs, zMaster, 0);\r\n      sqlite3DbFree(db, zMaster);\r\n      return rc;\r\n    }\r\n\r\n    /* Sync all the db files involved in the transaction. The same call\r\n    ** sets the master journal pointer in each individual journal. If\r\n    ** an error occurs here, do not delete the master journal file.\r\n    **\r\n    ** If the error occurs during the first call to\r\n    ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the\r\n    ** master journal file will be orphaned. But we cannot delete it,\r\n    ** in case the master journal file name was written into the journal\r\n    ** file before the failure occurred.\r\n    */\r\n    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ \r\n      Btree *pBt = db->aDb[i].pBt;\r\n      if( pBt ){\r\n        rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster);\r\n      }\r\n    }\r\n    sqlite3OsCloseFree(pMaster);\r\n    assert( rc!=SQLITE_BUSY );\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3DbFree(db, zMaster);\r\n      return rc;\r\n    }\r\n\r\n    /* Delete the master journal file. This commits the transaction. After\r\n    ** doing this the directory is synced again before any individual\r\n    ** transaction files are deleted.\r\n    */\r\n    rc = sqlite3OsDelete(pVfs, zMaster, 1);\r\n    sqlite3DbFree(db, zMaster);\r\n    zMaster = 0;\r\n    if( rc ){\r\n      return rc;\r\n    }\r\n\r\n    /* All files and directories have already been synced, so the following\r\n    ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and\r\n    ** deleting or truncating journals. If something goes wrong while\r\n    ** this is happening we don't really care. The integrity of the\r\n    ** transaction is already guaranteed, but some stray 'cold' journals\r\n    ** may be lying around. Returning an error code won't help matters.\r\n    */\r\n    disable_simulated_io_errors();\r\n    sqlite3BeginBenignMalloc();\r\n    for(i=0; i<db->nDb; i++){ \r\n      Btree *pBt = db->aDb[i].pBt;\r\n      if( pBt ){\r\n        sqlite3BtreeCommitPhaseTwo(pBt, 1);\r\n      }\r\n    }\r\n    sqlite3EndBenignMalloc();\r\n    enable_simulated_io_errors();\r\n\r\n    sqlite3VtabCommit(db);\r\n  }\r\n#endif\r\n\r\n  return rc;\r\n}\r\n\r\n/* \r\n** This routine checks that the sqlite3.activeVdbeCnt count variable\r\n** matches the number of vdbe's in the list sqlite3.pVdbe that are\r\n** currently active. An assertion fails if the two counts do not match.\r\n** This is an internal self-check only - it is not an essential processing\r\n** step.\r\n**\r\n** This is a no-op if NDEBUG is defined.\r\n*/\r\n#ifndef NDEBUG\r\nstatic void checkActiveVdbeCnt(sqlite3 *db){\r\n  Vdbe *p;\r\n  int cnt = 0;\r\n  int nWrite = 0;\r\n  p = db->pVdbe;\r\n  while( p ){\r\n    if( p->magic==VDBE_MAGIC_RUN && p->pc>=0 ){\r\n      cnt++;\r\n      if( p->readOnly==0 ) nWrite++;\r\n    }\r\n    p = p->pNext;\r\n  }\r\n  assert( cnt==db->activeVdbeCnt );\r\n  assert( nWrite==db->writeVdbeCnt );\r\n}\r\n#else\r\n#define checkActiveVdbeCnt(x)\r\n#endif\r\n\r\n/*\r\n** If the Vdbe passed as the first argument opened a statement-transaction,\r\n** close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or\r\n** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement\r\n** transaction is rolled back. If eOp is SAVEPOINT_RELEASE, then the \r\n** statement transaction is commtted.\r\n**\r\n** If an IO error occurs, an SQLITE_IOERR_XXX error code is returned. \r\n** Otherwise SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){\r\n  sqlite3 *const db = p->db;\r\n  int rc = SQLITE_OK;\r\n\r\n  /* If p->iStatement is greater than zero, then this Vdbe opened a \r\n  ** statement transaction that should be closed here. The only exception\r\n  ** is that an IO error may have occured, causing an emergency rollback.\r\n  ** In this case (db->nStatement==0), and there is nothing to do.\r\n  */\r\n  if( db->nStatement && p->iStatement ){\r\n    int i;\r\n    const int iSavepoint = p->iStatement-1;\r\n\r\n    assert( eOp==SAVEPOINT_ROLLBACK || eOp==SAVEPOINT_RELEASE);\r\n    assert( db->nStatement>0 );\r\n    assert( p->iStatement==(db->nStatement+db->nSavepoint) );\r\n\r\n    for(i=0; i<db->nDb; i++){ \r\n      int rc2 = SQLITE_OK;\r\n      Btree *pBt = db->aDb[i].pBt;\r\n      if( pBt ){\r\n        if( eOp==SAVEPOINT_ROLLBACK ){\r\n          rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint);\r\n        }\r\n        if( rc2==SQLITE_OK ){\r\n          rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint);\r\n        }\r\n        if( rc==SQLITE_OK ){\r\n          rc = rc2;\r\n        }\r\n      }\r\n    }\r\n    db->nStatement--;\r\n    p->iStatement = 0;\r\n\r\n    if( rc==SQLITE_OK ){\r\n      if( eOp==SAVEPOINT_ROLLBACK ){\r\n        rc = sqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint);\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint);\r\n      }\r\n    }\r\n\r\n    /* If the statement transaction is being rolled back, also restore the \r\n    ** database handles deferred constraint counter to the value it had when \r\n    ** the statement transaction was opened.  */\r\n    if( eOp==SAVEPOINT_ROLLBACK ){\r\n      db->nDeferredCons = p->nStmtDefCons;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called when a transaction opened by the database \r\n** handle associated with the VM passed as an argument is about to be \r\n** committed. If there are outstanding deferred foreign key constraint\r\n** violations, return SQLITE_ERROR. Otherwise, SQLITE_OK.\r\n**\r\n** If there are outstanding FK violations and this function returns \r\n** SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT and write\r\n** an error message to it. Then return SQLITE_ERROR.\r\n*/\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\nSQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){\r\n  sqlite3 *db = p->db;\r\n  if( (deferred && db->nDeferredCons>0) || (!deferred && p->nFkConstraint>0) ){\r\n    p->rc = SQLITE_CONSTRAINT;\r\n    p->errorAction = OE_Abort;\r\n    sqlite3SetString(&p->zErrMsg, db, \"foreign key constraint failed\");\r\n    return SQLITE_ERROR;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n/*\r\n** This routine is called the when a VDBE tries to halt.  If the VDBE\r\n** has made changes and is in autocommit mode, then commit those\r\n** changes.  If a rollback is needed, then do the rollback.\r\n**\r\n** This routine is the only way to move the state of a VM from\r\n** SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT.  It is harmless to\r\n** call this on a VM that is in the SQLITE_MAGIC_HALT state.\r\n**\r\n** Return an error code.  If the commit could not complete because of\r\n** lock contention, return SQLITE_BUSY.  If SQLITE_BUSY is returned, it\r\n** means the close did not happen and needs to be repeated.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){\r\n  int rc;                         /* Used to store transient return codes */\r\n  sqlite3 *db = p->db;\r\n\r\n  /* This function contains the logic that determines if a statement or\r\n  ** transaction will be committed or rolled back as a result of the\r\n  ** execution of this virtual machine. \r\n  **\r\n  ** If any of the following errors occur:\r\n  **\r\n  **     SQLITE_NOMEM\r\n  **     SQLITE_IOERR\r\n  **     SQLITE_FULL\r\n  **     SQLITE_INTERRUPT\r\n  **\r\n  ** Then the internal cache might have been left in an inconsistent\r\n  ** state.  We need to rollback the statement transaction, if there is\r\n  ** one, or the complete transaction if there is no statement transaction.\r\n  */\r\n\r\n  if( p->db->mallocFailed ){\r\n    p->rc = SQLITE_NOMEM;\r\n  }\r\n  if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag);\r\n  closeAllCursors(p);\r\n  if( p->magic!=VDBE_MAGIC_RUN ){\r\n    return SQLITE_OK;\r\n  }\r\n  checkActiveVdbeCnt(db);\r\n\r\n  /* No commit or rollback needed if the program never started */\r\n  if( p->pc>=0 ){\r\n    int mrc;   /* Primary error code from p->rc */\r\n    int eStatementOp = 0;\r\n    int isSpecialError;            /* Set to true if a 'special' error */\r\n\r\n    /* Lock all btrees used by the statement */\r\n    sqlite3VdbeEnter(p);\r\n\r\n    /* Check for one of the special errors */\r\n    mrc = p->rc & 0xff;\r\n    assert( p->rc!=SQLITE_IOERR_BLOCKED );  /* This error no longer exists */\r\n    isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR\r\n                     || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;\r\n    if( isSpecialError ){\r\n      /* If the query was read-only and the error code is SQLITE_INTERRUPT, \r\n      ** no rollback is necessary. Otherwise, at least a savepoint \r\n      ** transaction must be rolled back to restore the database to a \r\n      ** consistent state.\r\n      **\r\n      ** Even if the statement is read-only, it is important to perform\r\n      ** a statement or transaction rollback operation. If the error \r\n      ** occured while writing to the journal, sub-journal or database\r\n      ** file as part of an effort to free up cache space (see function\r\n      ** pagerStress() in pager.c), the rollback is required to restore \r\n      ** the pager to a consistent state.\r\n      */\r\n      if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){\r\n        if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){\r\n          eStatementOp = SAVEPOINT_ROLLBACK;\r\n        }else{\r\n          /* We are forced to roll back the active transaction. Before doing\r\n          ** so, abort any other statements this handle currently has active.\r\n          */\r\n          sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\r\n          sqlite3CloseSavepoints(db);\r\n          db->autoCommit = 1;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Check for immediate foreign key violations. */\r\n    if( p->rc==SQLITE_OK ){\r\n      sqlite3VdbeCheckFk(p, 0);\r\n    }\r\n  \r\n    /* If the auto-commit flag is set and this is the only active writer \r\n    ** VM, then we do either a commit or rollback of the current transaction. \r\n    **\r\n    ** Note: This block also runs if one of the special errors handled \r\n    ** above has occurred. \r\n    */\r\n    if( !sqlite3VtabInSync(db) \r\n     && db->autoCommit \r\n     && db->writeVdbeCnt==(p->readOnly==0) \r\n    ){\r\n      if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){\r\n        rc = sqlite3VdbeCheckFk(p, 1);\r\n        if( rc!=SQLITE_OK ){\r\n          if( NEVER(p->readOnly) ){\r\n            sqlite3VdbeLeave(p);\r\n            return SQLITE_ERROR;\r\n          }\r\n          rc = SQLITE_CONSTRAINT;\r\n        }else{ \r\n          /* The auto-commit flag is true, the vdbe program was successful \r\n          ** or hit an 'OR FAIL' constraint and there are no deferred foreign\r\n          ** key constraints to hold up the transaction. This means a commit \r\n          ** is required. */\r\n          rc = vdbeCommit(db, p);\r\n        }\r\n        if( rc==SQLITE_BUSY && p->readOnly ){\r\n          sqlite3VdbeLeave(p);\r\n          return SQLITE_BUSY;\r\n        }else if( rc!=SQLITE_OK ){\r\n          p->rc = rc;\r\n          sqlite3RollbackAll(db, SQLITE_OK);\r\n        }else{\r\n          db->nDeferredCons = 0;\r\n          sqlite3CommitInternalChanges(db);\r\n        }\r\n      }else{\r\n        sqlite3RollbackAll(db, SQLITE_OK);\r\n      }\r\n      db->nStatement = 0;\r\n    }else if( eStatementOp==0 ){\r\n      if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){\r\n        eStatementOp = SAVEPOINT_RELEASE;\r\n      }else if( p->errorAction==OE_Abort ){\r\n        eStatementOp = SAVEPOINT_ROLLBACK;\r\n      }else{\r\n        sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\r\n        sqlite3CloseSavepoints(db);\r\n        db->autoCommit = 1;\r\n      }\r\n    }\r\n  \r\n    /* If eStatementOp is non-zero, then a statement transaction needs to\r\n    ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to\r\n    ** do so. If this operation returns an error, and the current statement\r\n    ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the\r\n    ** current statement error code.\r\n    */\r\n    if( eStatementOp ){\r\n      rc = sqlite3VdbeCloseStatement(p, eStatementOp);\r\n      if( rc ){\r\n        if( p->rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT ){\r\n          p->rc = rc;\r\n          sqlite3DbFree(db, p->zErrMsg);\r\n          p->zErrMsg = 0;\r\n        }\r\n        sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\r\n        sqlite3CloseSavepoints(db);\r\n        db->autoCommit = 1;\r\n      }\r\n    }\r\n  \r\n    /* If this was an INSERT, UPDATE or DELETE and no statement transaction\r\n    ** has been rolled back, update the database connection change-counter. \r\n    */\r\n    if( p->changeCntOn ){\r\n      if( eStatementOp!=SAVEPOINT_ROLLBACK ){\r\n        sqlite3VdbeSetChanges(db, p->nChange);\r\n      }else{\r\n        sqlite3VdbeSetChanges(db, 0);\r\n      }\r\n      p->nChange = 0;\r\n    }\r\n\r\n    /* Release the locks */\r\n    sqlite3VdbeLeave(p);\r\n  }\r\n\r\n  /* We have successfully halted and closed the VM.  Record this fact. */\r\n  if( p->pc>=0 ){\r\n    db->activeVdbeCnt--;\r\n    if( !p->readOnly ){\r\n      db->writeVdbeCnt--;\r\n    }\r\n    assert( db->activeVdbeCnt>=db->writeVdbeCnt );\r\n  }\r\n  p->magic = VDBE_MAGIC_HALT;\r\n  checkActiveVdbeCnt(db);\r\n  if( p->db->mallocFailed ){\r\n    p->rc = SQLITE_NOMEM;\r\n  }\r\n\r\n  /* If the auto-commit flag is set to true, then any locks that were held\r\n  ** by connection db have now been released. Call sqlite3ConnectionUnlocked() \r\n  ** to invoke any required unlock-notify callbacks.\r\n  */\r\n  if( db->autoCommit ){\r\n    sqlite3ConnectionUnlocked(db);\r\n  }\r\n\r\n  assert( db->activeVdbeCnt>0 || db->autoCommit==0 || db->nStatement==0 );\r\n  return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);\r\n}\r\n\r\n\r\n/*\r\n** Each VDBE holds the result of the most recent sqlite3_step() call\r\n** in p->rc.  This routine sets that result back to SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){\r\n  p->rc = SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Copy the error code and error message belonging to the VDBE passed\r\n** as the first argument to its database handle (so that they will be \r\n** returned by calls to sqlite3_errcode() and sqlite3_errmsg()).\r\n**\r\n** This function does not clear the VDBE error code or message, just\r\n** copies them to the database handle.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){\r\n  sqlite3 *db = p->db;\r\n  int rc = p->rc;\r\n  if( p->zErrMsg ){\r\n    u8 mallocFailed = db->mallocFailed;\r\n    sqlite3BeginBenignMalloc();\r\n    sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);\r\n    sqlite3EndBenignMalloc();\r\n    db->mallocFailed = mallocFailed;\r\n    db->errCode = rc;\r\n  }else{\r\n    sqlite3Error(db, rc, 0);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Clean up a VDBE after execution but do not delete the VDBE just yet.\r\n** Write any error messages into *pzErrMsg.  Return the result code.\r\n**\r\n** After this routine is run, the VDBE should be ready to be executed\r\n** again.\r\n**\r\n** To look at it another way, this routine resets the state of the\r\n** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to\r\n** VDBE_MAGIC_INIT.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){\r\n  sqlite3 *db;\r\n  db = p->db;\r\n\r\n  /* If the VM did not run to completion or if it encountered an\r\n  ** error, then it might not have been halted properly.  So halt\r\n  ** it now.\r\n  */\r\n  sqlite3VdbeHalt(p);\r\n\r\n  /* If the VDBE has be run even partially, then transfer the error code\r\n  ** and error message from the VDBE into the main database structure.  But\r\n  ** if the VDBE has just been set to run but has not actually executed any\r\n  ** instructions yet, leave the main database error information unchanged.\r\n  */\r\n  if( p->pc>=0 ){\r\n    sqlite3VdbeTransferError(p);\r\n    sqlite3DbFree(db, p->zErrMsg);\r\n    p->zErrMsg = 0;\r\n    if( p->runOnlyOnce ) p->expired = 1;\r\n  }else if( p->rc && p->expired ){\r\n    /* The expired flag was set on the VDBE before the first call\r\n    ** to sqlite3_step(). For consistency (since sqlite3_step() was\r\n    ** called), set the database error in this case as well.\r\n    */\r\n    sqlite3Error(db, p->rc, 0);\r\n    sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);\r\n    sqlite3DbFree(db, p->zErrMsg);\r\n    p->zErrMsg = 0;\r\n  }\r\n\r\n  /* Reclaim all memory used by the VDBE\r\n  */\r\n  Cleanup(p);\r\n\r\n  /* Save profiling information from this VDBE run.\r\n  */\r\n#ifdef VDBE_PROFILE\r\n  {\r\n    FILE *out = fopen(\"vdbe_profile.out\", \"a\");\r\n    if( out ){\r\n      int i;\r\n      fprintf(out, \"---- \");\r\n      for(i=0; i<p->nOp; i++){\r\n        fprintf(out, \"%02x\", p->aOp[i].opcode);\r\n      }\r\n      fprintf(out, \"\\n\");\r\n      for(i=0; i<p->nOp; i++){\r\n        fprintf(out, \"%6d %10lld %8lld \",\r\n           p->aOp[i].cnt,\r\n           p->aOp[i].cycles,\r\n           p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0\r\n        );\r\n        sqlite3VdbePrintOp(out, i, &p->aOp[i]);\r\n      }\r\n      fclose(out);\r\n    }\r\n  }\r\n#endif\r\n  p->magic = VDBE_MAGIC_INIT;\r\n  return p->rc & db->errMask;\r\n}\r\n \r\n/*\r\n** Clean up and delete a VDBE after execution.  Return an integer which is\r\n** the result code.  Write any error message text into *pzErrMsg.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){\r\n  int rc = SQLITE_OK;\r\n  if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){\r\n    rc = sqlite3VdbeReset(p);\r\n    assert( (rc & p->db->errMask)==rc );\r\n  }\r\n  sqlite3VdbeDelete(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Call the destructor for each auxdata entry in pVdbeFunc for which\r\n** the corresponding bit in mask is clear.  Auxdata entries beyond 31\r\n** are always destroyed.  To destroy all auxdata entries, call this\r\n** routine with mask==0.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(VdbeFunc *pVdbeFunc, int mask){\r\n  int i;\r\n  for(i=0; i<pVdbeFunc->nAux; i++){\r\n    struct AuxData *pAux = &pVdbeFunc->apAux[i];\r\n    if( (i>31 || !(mask&(((u32)1)<<i))) && pAux->pAux ){\r\n      if( pAux->xDelete ){\r\n        pAux->xDelete(pAux->pAux);\r\n      }\r\n      pAux->pAux = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Free all memory associated with the Vdbe passed as the second argument.\r\n** The difference between this function and sqlite3VdbeDelete() is that\r\n** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with\r\n** the database connection.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeDeleteObject(sqlite3 *db, Vdbe *p){\r\n  SubProgram *pSub, *pNext;\r\n  int i;\r\n  assert( p->db==0 || p->db==db );\r\n  releaseMemArray(p->aVar, p->nVar);\r\n  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);\r\n  for(pSub=p->pProgram; pSub; pSub=pNext){\r\n    pNext = pSub->pNext;\r\n    vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);\r\n    sqlite3DbFree(db, pSub);\r\n  }\r\n  for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);\r\n  vdbeFreeOpArray(db, p->aOp, p->nOp);\r\n  sqlite3DbFree(db, p->aLabel);\r\n  sqlite3DbFree(db, p->aColName);\r\n  sqlite3DbFree(db, p->zSql);\r\n  sqlite3DbFree(db, p->pFree);\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\n  sqlite3DbFree(db, p->zExplain);\r\n  sqlite3DbFree(db, p->pExplain);\r\n#endif\r\n  sqlite3DbFree(db, p);\r\n}\r\n\r\n/*\r\n** Delete an entire VDBE.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){\r\n  sqlite3 *db;\r\n\r\n  if( NEVER(p==0) ) return;\r\n  db = p->db;\r\n  if( p->pPrev ){\r\n    p->pPrev->pNext = p->pNext;\r\n  }else{\r\n    assert( db->pVdbe==p );\r\n    db->pVdbe = p->pNext;\r\n  }\r\n  if( p->pNext ){\r\n    p->pNext->pPrev = p->pPrev;\r\n  }\r\n  p->magic = VDBE_MAGIC_DEAD;\r\n  p->db = 0;\r\n  sqlite3VdbeDeleteObject(db, p);\r\n}\r\n\r\n/*\r\n** Make sure the cursor p is ready to read or write the row to which it\r\n** was last positioned.  Return an error code if an OOM fault or I/O error\r\n** prevents us from positioning the cursor to its correct position.\r\n**\r\n** If a MoveTo operation is pending on the given cursor, then do that\r\n** MoveTo now.  If no move is pending, check to see if the row has been\r\n** deleted out from under the cursor and if it has, mark the row as\r\n** a NULL row.\r\n**\r\n** If the cursor is already pointing to the correct row and that row has\r\n** not been deleted out from under the cursor, then this routine is a no-op.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor *p){\r\n  if( p->deferredMoveto ){\r\n    int res, rc;\r\n#ifdef SQLITE_TEST\r\n    extern int sqlite3_search_count;\r\n#endif\r\n    assert( p->isTable );\r\n    rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);\r\n    if( rc ) return rc;\r\n    p->lastRowid = p->movetoTarget;\r\n    if( res!=0 ) return SQLITE_CORRUPT_BKPT;\r\n    p->rowidIsValid = 1;\r\n#ifdef SQLITE_TEST\r\n    sqlite3_search_count++;\r\n#endif\r\n    p->deferredMoveto = 0;\r\n    p->cacheStatus = CACHE_STALE;\r\n  }else if( ALWAYS(p->pCursor) ){\r\n    int hasMoved;\r\n    int rc = sqlite3BtreeCursorHasMoved(p->pCursor, &hasMoved);\r\n    if( rc ) return rc;\r\n    if( hasMoved ){\r\n      p->cacheStatus = CACHE_STALE;\r\n      p->nullRow = 1;\r\n    }\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The following functions:\r\n**\r\n** sqlite3VdbeSerialType()\r\n** sqlite3VdbeSerialTypeLen()\r\n** sqlite3VdbeSerialLen()\r\n** sqlite3VdbeSerialPut()\r\n** sqlite3VdbeSerialGet()\r\n**\r\n** encapsulate the code that serializes values for storage in SQLite\r\n** data and index records. Each serialized value consists of a\r\n** 'serial-type' and a blob of data. The serial type is an 8-byte unsigned\r\n** integer, stored as a varint.\r\n**\r\n** In an SQLite index record, the serial type is stored directly before\r\n** the blob of data that it corresponds to. In a table record, all serial\r\n** types are stored at the start of the record, and the blobs of data at\r\n** the end. Hence these functions allow the caller to handle the\r\n** serial-type and data blob seperately.\r\n**\r\n** The following table describes the various storage classes for data:\r\n**\r\n**   serial type        bytes of data      type\r\n**   --------------     ---------------    ---------------\r\n**      0                     0            NULL\r\n**      1                     1            signed integer\r\n**      2                     2            signed integer\r\n**      3                     3            signed integer\r\n**      4                     4            signed integer\r\n**      5                     6            signed integer\r\n**      6                     8            signed integer\r\n**      7                     8            IEEE float\r\n**      8                     0            Integer constant 0\r\n**      9                     0            Integer constant 1\r\n**     10,11                               reserved for expansion\r\n**    N>=12 and even       (N-12)/2        BLOB\r\n**    N>=13 and odd        (N-13)/2        text\r\n**\r\n** The 8 and 9 types were added in 3.3.0, file format 4.  Prior versions\r\n** of SQLite will not understand those serial types.\r\n*/\r\n\r\n/*\r\n** Return the serial-type for the value stored in pMem.\r\n*/\r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){\r\n  int flags = pMem->flags;\r\n  int n;\r\n\r\n  if( flags&MEM_Null ){\r\n    return 0;\r\n  }\r\n  if( flags&MEM_Int ){\r\n    /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */\r\n#   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)\r\n    i64 i = pMem->u.i;\r\n    u64 u;\r\n    if( file_format>=4 && (i&1)==i ){\r\n      return 8+(u32)i;\r\n    }\r\n    if( i<0 ){\r\n      if( i<(-MAX_6BYTE) ) return 6;\r\n      /* Previous test prevents:  u = -(-9223372036854775808) */\r\n      u = -i;\r\n    }else{\r\n      u = i;\r\n    }\r\n    if( u<=127 ) return 1;\r\n    if( u<=32767 ) return 2;\r\n    if( u<=8388607 ) return 3;\r\n    if( u<=2147483647 ) return 4;\r\n    if( u<=MAX_6BYTE ) return 5;\r\n    return 6;\r\n  }\r\n  if( flags&MEM_Real ){\r\n    return 7;\r\n  }\r\n  assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );\r\n  n = pMem->n;\r\n  if( flags & MEM_Zero ){\r\n    n += pMem->u.nZero;\r\n  }\r\n  assert( n>=0 );\r\n  return ((n*2) + 12 + ((flags&MEM_Str)!=0));\r\n}\r\n\r\n/*\r\n** Return the length of the data corresponding to the supplied serial-type.\r\n*/\r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32 serial_type){\r\n  if( serial_type>=12 ){\r\n    return (serial_type-12)/2;\r\n  }else{\r\n    static const u8 aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 };\r\n    return aSize[serial_type];\r\n  }\r\n}\r\n\r\n/*\r\n** If we are on an architecture with mixed-endian floating \r\n** points (ex: ARM7) then swap the lower 4 bytes with the \r\n** upper 4 bytes.  Return the result.\r\n**\r\n** For most architectures, this is a no-op.\r\n**\r\n** (later):  It is reported to me that the mixed-endian problem\r\n** on ARM7 is an issue with GCC, not with the ARM7 chip.  It seems\r\n** that early versions of GCC stored the two words of a 64-bit\r\n** float in the wrong order.  And that error has been propagated\r\n** ever since.  The blame is not necessarily with GCC, though.\r\n** GCC might have just copying the problem from a prior compiler.\r\n** I am also told that newer versions of GCC that follow a different\r\n** ABI get the byte order right.\r\n**\r\n** Developers using SQLite on an ARM7 should compile and run their\r\n** application using -DSQLITE_DEBUG=1 at least once.  With DEBUG\r\n** enabled, some asserts below will ensure that the byte order of\r\n** floating point values is correct.\r\n**\r\n** (2007-08-30)  Frank van Vugt has studied this problem closely\r\n** and has send his findings to the SQLite developers.  Frank\r\n** writes that some Linux kernels offer floating point hardware\r\n** emulation that uses only 32-bit mantissas instead of a full \r\n** 48-bits as required by the IEEE standard.  (This is the\r\n** CONFIG_FPE_FASTFPE option.)  On such systems, floating point\r\n** byte swapping becomes very complicated.  To avoid problems,\r\n** the necessary byte swapping is carried out using a 64-bit integer\r\n** rather than a 64-bit float.  Frank assures us that the code here\r\n** works for him.  We, the developers, have no way to independently\r\n** verify this, but Frank seems to know what he is talking about\r\n** so we trust him.\r\n*/\r\n#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT\r\nstatic u64 floatSwap(u64 in){\r\n  union {\r\n    u64 r;\r\n    u32 i[2];\r\n  } u;\r\n  u32 t;\r\n\r\n  u.r = in;\r\n  t = u.i[0];\r\n  u.i[0] = u.i[1];\r\n  u.i[1] = t;\r\n  return u.r;\r\n}\r\n# define swapMixedEndianFloat(X)  X = floatSwap(X)\r\n#else\r\n# define swapMixedEndianFloat(X)\r\n#endif\r\n\r\n/*\r\n** Write the serialized data blob for the value stored in pMem into \r\n** buf. It is assumed that the caller has allocated sufficient space.\r\n** Return the number of bytes written.\r\n**\r\n** nBuf is the amount of space left in buf[].  nBuf must always be\r\n** large enough to hold the entire field.  Except, if the field is\r\n** a blob with a zero-filled tail, then buf[] might be just the right\r\n** size to hold everything except for the zero-filled tail.  If buf[]\r\n** is only big enough to hold the non-zero prefix, then only write that\r\n** prefix into buf[].  But if buf[] is large enough to hold both the\r\n** prefix and the tail then write the prefix and set the tail to all\r\n** zeros.\r\n**\r\n** Return the number of bytes actually written into buf[].  The number\r\n** of bytes in the zero-filled tail is included in the return value only\r\n** if those bytes were zeroed in buf[].\r\n*/ \r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, int nBuf, Mem *pMem, int file_format){\r\n  u32 serial_type = sqlite3VdbeSerialType(pMem, file_format);\r\n  u32 len;\r\n\r\n  /* Integer and Real */\r\n  if( serial_type<=7 && serial_type>0 ){\r\n    u64 v;\r\n    u32 i;\r\n    if( serial_type==7 ){\r\n      assert( sizeof(v)==sizeof(pMem->r) );\r\n      memcpy(&v, &pMem->r, sizeof(v));\r\n      swapMixedEndianFloat(v);\r\n    }else{\r\n      v = pMem->u.i;\r\n    }\r\n    len = i = sqlite3VdbeSerialTypeLen(serial_type);\r\n    assert( len<=(u32)nBuf );\r\n    while( i-- ){\r\n      buf[i] = (u8)(v&0xFF);\r\n      v >>= 8;\r\n    }\r\n    return len;\r\n  }\r\n\r\n  /* String or blob */\r\n  if( serial_type>=12 ){\r\n    assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)\r\n             == (int)sqlite3VdbeSerialTypeLen(serial_type) );\r\n    assert( pMem->n<=nBuf );\r\n    len = pMem->n;\r\n    memcpy(buf, pMem->z, len);\r\n    if( pMem->flags & MEM_Zero ){\r\n      len += pMem->u.nZero;\r\n      assert( nBuf>=0 );\r\n      if( len > (u32)nBuf ){\r\n        len = (u32)nBuf;\r\n      }\r\n      memset(&buf[pMem->n], 0, len-pMem->n);\r\n    }\r\n    return len;\r\n  }\r\n\r\n  /* NULL or constants 0 or 1 */\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Deserialize the data blob pointed to by buf as serial type serial_type\r\n** and store the result in pMem.  Return the number of bytes read.\r\n*/ \r\nSQLITE_PRIVATE u32 sqlite3VdbeSerialGet(\r\n  const unsigned char *buf,     /* Buffer to deserialize from */\r\n  u32 serial_type,              /* Serial type to deserialize */\r\n  Mem *pMem                     /* Memory cell to write value into */\r\n){\r\n  switch( serial_type ){\r\n    case 10:   /* Reserved for future use */\r\n    case 11:   /* Reserved for future use */\r\n    case 0: {  /* NULL */\r\n      pMem->flags = MEM_Null;\r\n      break;\r\n    }\r\n    case 1: { /* 1-byte signed integer */\r\n      pMem->u.i = (signed char)buf[0];\r\n      pMem->flags = MEM_Int;\r\n      return 1;\r\n    }\r\n    case 2: { /* 2-byte signed integer */\r\n      pMem->u.i = (((signed char)buf[0])<<8) | buf[1];\r\n      pMem->flags = MEM_Int;\r\n      return 2;\r\n    }\r\n    case 3: { /* 3-byte signed integer */\r\n      pMem->u.i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];\r\n      pMem->flags = MEM_Int;\r\n      return 3;\r\n    }\r\n    case 4: { /* 4-byte signed integer */\r\n      pMem->u.i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];\r\n      pMem->flags = MEM_Int;\r\n      return 4;\r\n    }\r\n    case 5: { /* 6-byte signed integer */\r\n      u64 x = (((signed char)buf[0])<<8) | buf[1];\r\n      u32 y = (buf[2]<<24) | (buf[3]<<16) | (buf[4]<<8) | buf[5];\r\n      x = (x<<32) | y;\r\n      pMem->u.i = *(i64*)&x;\r\n      pMem->flags = MEM_Int;\r\n      return 6;\r\n    }\r\n    case 6:   /* 8-byte signed integer */\r\n    case 7: { /* IEEE floating point */\r\n      u64 x;\r\n      u32 y;\r\n#if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)\r\n      /* Verify that integers and floating point values use the same\r\n      ** byte order.  Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is\r\n      ** defined that 64-bit floating point values really are mixed\r\n      ** endian.\r\n      */\r\n      static const u64 t1 = ((u64)0x3ff00000)<<32;\r\n      static const double r1 = 1.0;\r\n      u64 t2 = t1;\r\n      swapMixedEndianFloat(t2);\r\n      assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 );\r\n#endif\r\n\r\n      x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];\r\n      y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];\r\n      x = (x<<32) | y;\r\n      if( serial_type==6 ){\r\n        pMem->u.i = *(i64*)&x;\r\n        pMem->flags = MEM_Int;\r\n      }else{\r\n        assert( sizeof(x)==8 && sizeof(pMem->r)==8 );\r\n        swapMixedEndianFloat(x);\r\n        memcpy(&pMem->r, &x, sizeof(x));\r\n        pMem->flags = sqlite3IsNaN(pMem->r) ? MEM_Null : MEM_Real;\r\n      }\r\n      return 8;\r\n    }\r\n    case 8:    /* Integer 0 */\r\n    case 9: {  /* Integer 1 */\r\n      pMem->u.i = serial_type-8;\r\n      pMem->flags = MEM_Int;\r\n      return 0;\r\n    }\r\n    default: {\r\n      u32 len = (serial_type-12)/2;\r\n      pMem->z = (char *)buf;\r\n      pMem->n = len;\r\n      pMem->xDel = 0;\r\n      if( serial_type&0x01 ){\r\n        pMem->flags = MEM_Str | MEM_Ephem;\r\n      }else{\r\n        pMem->flags = MEM_Blob | MEM_Ephem;\r\n      }\r\n      return len;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** This routine is used to allocate sufficient space for an UnpackedRecord\r\n** structure large enough to be used with sqlite3VdbeRecordUnpack() if\r\n** the first argument is a pointer to KeyInfo structure pKeyInfo.\r\n**\r\n** The space is either allocated using sqlite3DbMallocRaw() or from within\r\n** the unaligned buffer passed via the second and third arguments (presumably\r\n** stack space). If the former, then *ppFree is set to a pointer that should\r\n** be eventually freed by the caller using sqlite3DbFree(). Or, if the \r\n** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL\r\n** before returning.\r\n**\r\n** If an OOM error occurs, NULL is returned.\r\n*/\r\nSQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(\r\n  KeyInfo *pKeyInfo,              /* Description of the record */\r\n  char *pSpace,                   /* Unaligned space available */\r\n  int szSpace,                    /* Size of pSpace[] in bytes */\r\n  char **ppFree                   /* OUT: Caller should free this pointer */\r\n){\r\n  UnpackedRecord *p;              /* Unpacked record to return */\r\n  int nOff;                       /* Increment pSpace by nOff to align it */\r\n  int nByte;                      /* Number of bytes required for *p */\r\n\r\n  /* We want to shift the pointer pSpace up such that it is 8-byte aligned.\r\n  ** Thus, we need to calculate a value, nOff, between 0 and 7, to shift \r\n  ** it by.  If pSpace is already 8-byte aligned, nOff should be zero.\r\n  */\r\n  nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7;\r\n  nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);\r\n  if( nByte>szSpace+nOff ){\r\n    p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);\r\n    *ppFree = (char *)p;\r\n    if( !p ) return 0;\r\n  }else{\r\n    p = (UnpackedRecord*)&pSpace[nOff];\r\n    *ppFree = 0;\r\n  }\r\n\r\n  p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];\r\n  p->pKeyInfo = pKeyInfo;\r\n  p->nField = pKeyInfo->nField + 1;\r\n  return p;\r\n}\r\n\r\n/*\r\n** Given the nKey-byte encoding of a record in pKey[], populate the \r\n** UnpackedRecord structure indicated by the fourth argument with the\r\n** contents of the decoded record.\r\n*/ \r\nSQLITE_PRIVATE void sqlite3VdbeRecordUnpack(\r\n  KeyInfo *pKeyInfo,     /* Information about the record format */\r\n  int nKey,              /* Size of the binary record */\r\n  const void *pKey,      /* The binary record */\r\n  UnpackedRecord *p      /* Populate this structure before returning. */\r\n){\r\n  const unsigned char *aKey = (const unsigned char *)pKey;\r\n  int d; \r\n  u32 idx;                        /* Offset in aKey[] to read from */\r\n  u16 u;                          /* Unsigned loop counter */\r\n  u32 szHdr;\r\n  Mem *pMem = p->aMem;\r\n\r\n  p->flags = 0;\r\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\r\n  idx = getVarint32(aKey, szHdr);\r\n  d = szHdr;\r\n  u = 0;\r\n  while( idx<szHdr && u<p->nField && d<=nKey ){\r\n    u32 serial_type;\r\n\r\n    idx += getVarint32(&aKey[idx], serial_type);\r\n    pMem->enc = pKeyInfo->enc;\r\n    pMem->db = pKeyInfo->db;\r\n    /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */\r\n    pMem->zMalloc = 0;\r\n    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);\r\n    pMem++;\r\n    u++;\r\n  }\r\n  assert( u<=pKeyInfo->nField + 1 );\r\n  p->nField = u;\r\n}\r\n\r\n/*\r\n** This function compares the two table rows or index records\r\n** specified by {nKey1, pKey1} and pPKey2.  It returns a negative, zero\r\n** or positive integer if key1 is less than, equal to or \r\n** greater than key2.  The {nKey1, pKey1} key must be a blob\r\n** created by th OP_MakeRecord opcode of the VDBE.  The pPKey2\r\n** key must be a parsed key such as obtained from\r\n** sqlite3VdbeParseRecord.\r\n**\r\n** Key1 and Key2 do not have to contain the same number of fields.\r\n** The key with fewer fields is usually compares less than the \r\n** longer key.  However if the UNPACKED_INCRKEY flags in pPKey2 is set\r\n** and the common prefixes are equal, then key1 is less than key2.\r\n** Or if the UNPACKED_MATCH_PREFIX flag is set and the prefixes are\r\n** equal, then the keys are considered to be equal and\r\n** the parts beyond the common prefix are ignored.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeRecordCompare(\r\n  int nKey1, const void *pKey1, /* Left key */\r\n  UnpackedRecord *pPKey2        /* Right key */\r\n){\r\n  int d1;            /* Offset into aKey[] of next data element */\r\n  u32 idx1;          /* Offset into aKey[] of next header element */\r\n  u32 szHdr1;        /* Number of bytes in header */\r\n  int i = 0;\r\n  int nField;\r\n  int rc = 0;\r\n  const unsigned char *aKey1 = (const unsigned char *)pKey1;\r\n  KeyInfo *pKeyInfo;\r\n  Mem mem1;\r\n\r\n  pKeyInfo = pPKey2->pKeyInfo;\r\n  mem1.enc = pKeyInfo->enc;\r\n  mem1.db = pKeyInfo->db;\r\n  /* mem1.flags = 0;  // Will be initialized by sqlite3VdbeSerialGet() */\r\n  VVA_ONLY( mem1.zMalloc = 0; ) /* Only needed by assert() statements */\r\n\r\n  /* Compilers may complain that mem1.u.i is potentially uninitialized.\r\n  ** We could initialize it, as shown here, to silence those complaints.\r\n  ** But in fact, mem1.u.i will never actually be used uninitialized, and doing \r\n  ** the unnecessary initialization has a measurable negative performance\r\n  ** impact, since this routine is a very high runner.  And so, we choose\r\n  ** to ignore the compiler warnings and leave this variable uninitialized.\r\n  */\r\n  /*  mem1.u.i = 0;  // not needed, here to silence compiler warning */\r\n  \r\n  idx1 = getVarint32(aKey1, szHdr1);\r\n  d1 = szHdr1;\r\n  nField = pKeyInfo->nField;\r\n  while( idx1<szHdr1 && i<pPKey2->nField ){\r\n    u32 serial_type1;\r\n\r\n    /* Read the serial types for the next element in each key. */\r\n    idx1 += getVarint32( aKey1+idx1, serial_type1 );\r\n    if( d1>=nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break;\r\n\r\n    /* Extract the values to be compared.\r\n    */\r\n    d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);\r\n\r\n    /* Do the comparison\r\n    */\r\n    rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],\r\n                           i<nField ? pKeyInfo->aColl[i] : 0);\r\n    if( rc!=0 ){\r\n      assert( mem1.zMalloc==0 );  /* See comment below */\r\n\r\n      /* Invert the result if we are using DESC sort order. */\r\n      if( pKeyInfo->aSortOrder && i<nField && pKeyInfo->aSortOrder[i] ){\r\n        rc = -rc;\r\n      }\r\n    \r\n      /* If the PREFIX_SEARCH flag is set and all fields except the final\r\n      ** rowid field were equal, then clear the PREFIX_SEARCH flag and set \r\n      ** pPKey2->rowid to the value of the rowid field in (pKey1, nKey1).\r\n      ** This is used by the OP_IsUnique opcode.\r\n      */\r\n      if( (pPKey2->flags & UNPACKED_PREFIX_SEARCH) && i==(pPKey2->nField-1) ){\r\n        assert( idx1==szHdr1 && rc );\r\n        assert( mem1.flags & MEM_Int );\r\n        pPKey2->flags &= ~UNPACKED_PREFIX_SEARCH;\r\n        pPKey2->rowid = mem1.u.i;\r\n      }\r\n    \r\n      return rc;\r\n    }\r\n    i++;\r\n  }\r\n\r\n  /* No memory allocation is ever used on mem1.  Prove this using\r\n  ** the following assert().  If the assert() fails, it indicates a\r\n  ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1).\r\n  */\r\n  assert( mem1.zMalloc==0 );\r\n\r\n  /* rc==0 here means that one of the keys ran out of fields and\r\n  ** all the fields up to that point were equal. If the UNPACKED_INCRKEY\r\n  ** flag is set, then break the tie by treating key2 as larger.\r\n  ** If the UPACKED_PREFIX_MATCH flag is set, then keys with common prefixes\r\n  ** are considered to be equal.  Otherwise, the longer key is the \r\n  ** larger.  As it happens, the pPKey2 will always be the longer\r\n  ** if there is a difference.\r\n  */\r\n  assert( rc==0 );\r\n  if( pPKey2->flags & UNPACKED_INCRKEY ){\r\n    rc = -1;\r\n  }else if( pPKey2->flags & UNPACKED_PREFIX_MATCH ){\r\n    /* Leave rc==0 */\r\n  }else if( idx1<szHdr1 ){\r\n    rc = 1;\r\n  }\r\n  return rc;\r\n}\r\n \r\n\r\n/*\r\n** pCur points at an index entry created using the OP_MakeRecord opcode.\r\n** Read the rowid (the last field in the record) and store it in *rowid.\r\n** Return SQLITE_OK if everything works, or an error code otherwise.\r\n**\r\n** pCur might be pointing to text obtained from a corrupt database file.\r\n** So the content cannot be trusted.  Do appropriate checks on the content.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){\r\n  i64 nCellKey = 0;\r\n  int rc;\r\n  u32 szHdr;        /* Size of the header */\r\n  u32 typeRowid;    /* Serial type of the rowid */\r\n  u32 lenRowid;     /* Size of the rowid */\r\n  Mem m, v;\r\n\r\n  UNUSED_PARAMETER(db);\r\n\r\n  /* Get the size of the index entry.  Only indices entries of less\r\n  ** than 2GiB are support - anything large must be database corruption.\r\n  ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so\r\n  ** this code can safely assume that nCellKey is 32-bits  \r\n  */\r\n  assert( sqlite3BtreeCursorIsValid(pCur) );\r\n  VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey);\r\n  assert( rc==SQLITE_OK );     /* pCur is always valid so KeySize cannot fail */\r\n  assert( (nCellKey & SQLITE_MAX_U32)==(u64)nCellKey );\r\n\r\n  /* Read in the complete content of the index entry */\r\n  memset(&m, 0, sizeof(m));\r\n  rc = sqlite3VdbeMemFromBtree(pCur, 0, (int)nCellKey, 1, &m);\r\n  if( rc ){\r\n    return rc;\r\n  }\r\n\r\n  /* The index entry must begin with a header size */\r\n  (void)getVarint32((u8*)m.z, szHdr);\r\n  testcase( szHdr==3 );\r\n  testcase( szHdr==m.n );\r\n  if( unlikely(szHdr<3 || (int)szHdr>m.n) ){\r\n    goto idx_rowid_corruption;\r\n  }\r\n\r\n  /* The last field of the index should be an integer - the ROWID.\r\n  ** Verify that the last entry really is an integer. */\r\n  (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);\r\n  testcase( typeRowid==1 );\r\n  testcase( typeRowid==2 );\r\n  testcase( typeRowid==3 );\r\n  testcase( typeRowid==4 );\r\n  testcase( typeRowid==5 );\r\n  testcase( typeRowid==6 );\r\n  testcase( typeRowid==8 );\r\n  testcase( typeRowid==9 );\r\n  if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){\r\n    goto idx_rowid_corruption;\r\n  }\r\n  lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);\r\n  testcase( (u32)m.n==szHdr+lenRowid );\r\n  if( unlikely((u32)m.n<szHdr+lenRowid) ){\r\n    goto idx_rowid_corruption;\r\n  }\r\n\r\n  /* Fetch the integer off the end of the index record */\r\n  sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);\r\n  *rowid = v.u.i;\r\n  sqlite3VdbeMemRelease(&m);\r\n  return SQLITE_OK;\r\n\r\n  /* Jump here if database corruption is detected after m has been\r\n  ** allocated.  Free the m object and return SQLITE_CORRUPT. */\r\nidx_rowid_corruption:\r\n  testcase( m.zMalloc!=0 );\r\n  sqlite3VdbeMemRelease(&m);\r\n  return SQLITE_CORRUPT_BKPT;\r\n}\r\n\r\n/*\r\n** Compare the key of the index entry that cursor pC is pointing to against\r\n** the key string in pUnpacked.  Write into *pRes a number\r\n** that is negative, zero, or positive if pC is less than, equal to,\r\n** or greater than pUnpacked.  Return SQLITE_OK on success.\r\n**\r\n** pUnpacked is either created without a rowid or is truncated so that it\r\n** omits the rowid at the end.  The rowid at the end of the index entry\r\n** is ignored as well.  Hence, this routine only compares the prefixes \r\n** of the keys prior to the final rowid, not the entire key.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(\r\n  VdbeCursor *pC,             /* The cursor to compare against */\r\n  UnpackedRecord *pUnpacked,  /* Unpacked version of key to compare against */\r\n  int *res                    /* Write the comparison result here */\r\n){\r\n  i64 nCellKey = 0;\r\n  int rc;\r\n  BtCursor *pCur = pC->pCursor;\r\n  Mem m;\r\n\r\n  assert( sqlite3BtreeCursorIsValid(pCur) );\r\n  VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey);\r\n  assert( rc==SQLITE_OK );    /* pCur is always valid so KeySize cannot fail */\r\n  /* nCellKey will always be between 0 and 0xffffffff because of the say\r\n  ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */\r\n  if( nCellKey<=0 || nCellKey>0x7fffffff ){\r\n    *res = 0;\r\n    return SQLITE_CORRUPT_BKPT;\r\n  }\r\n  memset(&m, 0, sizeof(m));\r\n  rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (int)nCellKey, 1, &m);\r\n  if( rc ){\r\n    return rc;\r\n  }\r\n  assert( pUnpacked->flags & UNPACKED_PREFIX_MATCH );\r\n  *res = sqlite3VdbeRecordCompare(m.n, m.z, pUnpacked);\r\n  sqlite3VdbeMemRelease(&m);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This routine sets the value to be returned by subsequent calls to\r\n** sqlite3_changes() on the database handle 'db'. \r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  db->nChange = nChange;\r\n  db->nTotalChange += nChange;\r\n}\r\n\r\n/*\r\n** Set a flag in the vdbe to update the change counter when it is finalised\r\n** or reset.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe *v){\r\n  v->changeCntOn = 1;\r\n}\r\n\r\n/*\r\n** Mark every prepared statement associated with a database connection\r\n** as expired.\r\n**\r\n** An expired statement means that recompilation of the statement is\r\n** recommend.  Statements expire when things happen that make their\r\n** programs obsolete.  Removing user-defined functions or collating\r\n** sequences, or changing an authorization function are the types of\r\n** things that make prepared statements obsolete.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db){\r\n  Vdbe *p;\r\n  for(p = db->pVdbe; p; p=p->pNext){\r\n    p->expired = 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Return the database associated with the Vdbe.\r\n*/\r\nSQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){\r\n  return v->db;\r\n}\r\n\r\n/*\r\n** Return a pointer to an sqlite3_value structure containing the value bound\r\n** parameter iVar of VM v. Except, if the value is an SQL NULL, return \r\n** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_*\r\n** constants) to the value before returning it.\r\n**\r\n** The returned value must be freed by the caller using sqlite3ValueFree().\r\n*/\r\nSQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe *v, int iVar, u8 aff){\r\n  assert( iVar>0 );\r\n  if( v ){\r\n    Mem *pMem = &v->aVar[iVar-1];\r\n    if( 0==(pMem->flags & MEM_Null) ){\r\n      sqlite3_value *pRet = sqlite3ValueNew(v->db);\r\n      if( pRet ){\r\n        sqlite3VdbeMemCopy((Mem *)pRet, pMem);\r\n        sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8);\r\n        sqlite3VdbeMemStoreType((Mem *)pRet);\r\n      }\r\n      return pRet;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Configure SQL variable iVar so that binding a new value to it signals\r\n** to sqlite3_reoptimize() that re-preparing the statement may result\r\n** in a better query plan.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){\r\n  assert( iVar>0 );\r\n  if( iVar>32 ){\r\n    v->expmask = 0xffffffff;\r\n  }else{\r\n    v->expmask |= ((u32)1 << (iVar-1));\r\n  }\r\n}\r\n\r\n/************** End of vdbeaux.c *********************************************/\r\n/************** Begin file vdbeapi.c *****************************************/\r\n/*\r\n** 2004 May 26\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code use to implement APIs that are part of the\r\n** VDBE.\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n/*\r\n** Return TRUE (non-zero) of the statement supplied as an argument needs\r\n** to be recompiled.  A statement needs to be recompiled whenever the\r\n** execution environment changes in a way that would alter the program\r\n** that sqlite3_prepare() generates.  For example, if new functions or\r\n** collating sequences are registered or if an authorizer function is\r\n** added or changed.\r\n*/\r\nSQLITE_API int sqlite3_expired(sqlite3_stmt *pStmt){\r\n  Vdbe *p = (Vdbe*)pStmt;\r\n  return p==0 || p->expired;\r\n}\r\n#endif\r\n\r\n/*\r\n** Check on a Vdbe to make sure it has not been finalized.  Log\r\n** an error and return true if it has been finalized (or is otherwise\r\n** invalid).  Return false if it is ok.\r\n*/\r\nstatic int vdbeSafety(Vdbe *p){\r\n  if( p->db==0 ){\r\n    sqlite3_log(SQLITE_MISUSE, \"API called with finalized prepared statement\");\r\n    return 1;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\nstatic int vdbeSafetyNotNull(Vdbe *p){\r\n  if( p==0 ){\r\n    sqlite3_log(SQLITE_MISUSE, \"API called with NULL prepared statement\");\r\n    return 1;\r\n  }else{\r\n    return vdbeSafety(p);\r\n  }\r\n}\r\n\r\n/*\r\n** The following routine destroys a virtual machine that is created by\r\n** the sqlite3_compile() routine. The integer returned is an SQLITE_\r\n** success/failure code that describes the result of executing the virtual\r\n** machine.\r\n**\r\n** This routine sets the error code and string returned by\r\n** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().\r\n*/\r\nSQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt){\r\n  int rc;\r\n  if( pStmt==0 ){\r\n    /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL\r\n    ** pointer is a harmless no-op. */\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    Vdbe *v = (Vdbe*)pStmt;\r\n    sqlite3 *db = v->db;\r\n#if SQLITE_THREADSAFE\r\n    sqlite3_mutex *mutex;\r\n#endif\r\n    if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT;\r\n#if SQLITE_THREADSAFE\r\n    mutex = v->db->mutex;\r\n#endif\r\n    sqlite3_mutex_enter(mutex);\r\n    rc = sqlite3VdbeFinalize(v);\r\n    rc = sqlite3ApiExit(db, rc);\r\n    sqlite3_mutex_leave(mutex);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Terminate the current execution of an SQL statement and reset it\r\n** back to its starting state so that it can be reused. A success code from\r\n** the prior execution is returned.\r\n**\r\n** This routine sets the error code and string returned by\r\n** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().\r\n*/\r\nSQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt){\r\n  int rc;\r\n  if( pStmt==0 ){\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    Vdbe *v = (Vdbe*)pStmt;\r\n    sqlite3_mutex_enter(v->db->mutex);\r\n    rc = sqlite3VdbeReset(v);\r\n    sqlite3VdbeRewind(v);\r\n    assert( (rc & (v->db->errMask))==rc );\r\n    rc = sqlite3ApiExit(v->db, rc);\r\n    sqlite3_mutex_leave(v->db->mutex);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set all the parameters in the compiled SQL statement to NULL.\r\n*/\r\nSQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){\r\n  int i;\r\n  int rc = SQLITE_OK;\r\n  Vdbe *p = (Vdbe*)pStmt;\r\n#if SQLITE_THREADSAFE\r\n  sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;\r\n#endif\r\n  sqlite3_mutex_enter(mutex);\r\n  for(i=0; i<p->nVar; i++){\r\n    sqlite3VdbeMemRelease(&p->aVar[i]);\r\n    p->aVar[i].flags = MEM_Null;\r\n  }\r\n  if( p->isPrepareV2 && p->expmask ){\r\n    p->expired = 1;\r\n  }\r\n  sqlite3_mutex_leave(mutex);\r\n  return rc;\r\n}\r\n\r\n\r\n/**************************** sqlite3_value_  *******************************\r\n** The following routines extract information from a Mem or sqlite3_value\r\n** structure.\r\n*/\r\nSQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){\r\n  Mem *p = (Mem*)pVal;\r\n  if( p->flags & (MEM_Blob|MEM_Str) ){\r\n    sqlite3VdbeMemExpandBlob(p);\r\n    p->flags &= ~MEM_Str;\r\n    p->flags |= MEM_Blob;\r\n    return p->n ? p->z : 0;\r\n  }else{\r\n    return sqlite3_value_text(pVal);\r\n  }\r\n}\r\nSQLITE_API int sqlite3_value_bytes(sqlite3_value *pVal){\r\n  return sqlite3ValueBytes(pVal, SQLITE_UTF8);\r\n}\r\nSQLITE_API int sqlite3_value_bytes16(sqlite3_value *pVal){\r\n  return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);\r\n}\r\nSQLITE_API double sqlite3_value_double(sqlite3_value *pVal){\r\n  return sqlite3VdbeRealValue((Mem*)pVal);\r\n}\r\nSQLITE_API int sqlite3_value_int(sqlite3_value *pVal){\r\n  return (int)sqlite3VdbeIntValue((Mem*)pVal);\r\n}\r\nSQLITE_API sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){\r\n  return sqlite3VdbeIntValue((Mem*)pVal);\r\n}\r\nSQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value *pVal){\r\n  return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_value_text16(sqlite3_value* pVal){\r\n  return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);\r\n}\r\nSQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){\r\n  return sqlite3ValueText(pVal, SQLITE_UTF16BE);\r\n}\r\nSQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){\r\n  return sqlite3ValueText(pVal, SQLITE_UTF16LE);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\nSQLITE_API int sqlite3_value_type(sqlite3_value* pVal){\r\n  return pVal->type;\r\n}\r\n\r\n/**************************** sqlite3_result_  *******************************\r\n** The following routines are used by user-defined functions to specify\r\n** the function result.\r\n**\r\n** The setStrOrError() funtion calls sqlite3VdbeMemSetStr() to store the\r\n** result as a string or blob but if the string or blob is too large, it\r\n** then sets the error code to SQLITE_TOOBIG\r\n*/\r\nstatic void setResultStrOrError(\r\n  sqlite3_context *pCtx,  /* Function context */\r\n  const char *z,          /* String pointer */\r\n  int n,                  /* Bytes in string, or negative */\r\n  u8 enc,                 /* Encoding of z.  0 for BLOBs */\r\n  void (*xDel)(void*)     /* Destructor function */\r\n){\r\n  if( sqlite3VdbeMemSetStr(&pCtx->s, z, n, enc, xDel)==SQLITE_TOOBIG ){\r\n    sqlite3_result_error_toobig(pCtx);\r\n  }\r\n}\r\nSQLITE_API void sqlite3_result_blob(\r\n  sqlite3_context *pCtx, \r\n  const void *z, \r\n  int n, \r\n  void (*xDel)(void *)\r\n){\r\n  assert( n>=0 );\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  setResultStrOrError(pCtx, z, n, 0, xDel);\r\n}\r\nSQLITE_API void sqlite3_result_double(sqlite3_context *pCtx, double rVal){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemSetDouble(&pCtx->s, rVal);\r\n}\r\nSQLITE_API void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  pCtx->isError = SQLITE_ERROR;\r\n  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  pCtx->isError = SQLITE_ERROR;\r\n  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);\r\n}\r\n#endif\r\nSQLITE_API void sqlite3_result_int(sqlite3_context *pCtx, int iVal){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal);\r\n}\r\nSQLITE_API void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemSetInt64(&pCtx->s, iVal);\r\n}\r\nSQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemSetNull(&pCtx->s);\r\n}\r\nSQLITE_API void sqlite3_result_text(\r\n  sqlite3_context *pCtx, \r\n  const char *z, \r\n  int n,\r\n  void (*xDel)(void *)\r\n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API void sqlite3_result_text16(\r\n  sqlite3_context *pCtx, \r\n  const void *z, \r\n  int n, \r\n  void (*xDel)(void *)\r\n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel);\r\n}\r\nSQLITE_API void sqlite3_result_text16be(\r\n  sqlite3_context *pCtx, \r\n  const void *z, \r\n  int n, \r\n  void (*xDel)(void *)\r\n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel);\r\n}\r\nSQLITE_API void sqlite3_result_text16le(\r\n  sqlite3_context *pCtx, \r\n  const void *z, \r\n  int n, \r\n  void (*xDel)(void *)\r\n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\nSQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemCopy(&pCtx->s, pValue);\r\n}\r\nSQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemSetZeroBlob(&pCtx->s, n);\r\n}\r\nSQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){\r\n  pCtx->isError = errCode;\r\n  if( pCtx->s.flags & MEM_Null ){\r\n    sqlite3VdbeMemSetStr(&pCtx->s, sqlite3ErrStr(errCode), -1, \r\n                         SQLITE_UTF8, SQLITE_STATIC);\r\n  }\r\n}\r\n\r\n/* Force an SQLITE_TOOBIG error. */\r\nSQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  pCtx->isError = SQLITE_TOOBIG;\r\n  sqlite3VdbeMemSetStr(&pCtx->s, \"string or blob too big\", -1, \r\n                       SQLITE_UTF8, SQLITE_STATIC);\r\n}\r\n\r\n/* An SQLITE_NOMEM error. */\r\nSQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  sqlite3VdbeMemSetNull(&pCtx->s);\r\n  pCtx->isError = SQLITE_NOMEM;\r\n  pCtx->s.db->mallocFailed = 1;\r\n}\r\n\r\n/*\r\n** This function is called after a transaction has been committed. It \r\n** invokes callbacks registered with sqlite3_wal_hook() as required.\r\n*/\r\nstatic int doWalCallbacks(sqlite3 *db){\r\n  int rc = SQLITE_OK;\r\n#ifndef SQLITE_OMIT_WAL\r\n  int i;\r\n  for(i=0; i<db->nDb; i++){\r\n    Btree *pBt = db->aDb[i].pBt;\r\n    if( pBt ){\r\n      int nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt));\r\n      if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK ){\r\n        rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zName, nEntry);\r\n      }\r\n    }\r\n  }\r\n#endif\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Execute the statement pStmt, either until a row of data is ready, the\r\n** statement is completely executed or an error occurs.\r\n**\r\n** This routine implements the bulk of the logic behind the sqlite_step()\r\n** API.  The only thing omitted is the automatic recompile if a \r\n** schema change has occurred.  That detail is handled by the\r\n** outer sqlite3_step() wrapper procedure.\r\n*/\r\nstatic int sqlite3Step(Vdbe *p){\r\n  sqlite3 *db;\r\n  int rc;\r\n\r\n  assert(p);\r\n  if( p->magic!=VDBE_MAGIC_RUN ){\r\n    /* We used to require that sqlite3_reset() be called before retrying\r\n    ** sqlite3_step() after any error or after SQLITE_DONE.  But beginning\r\n    ** with version 3.7.0, we changed this so that sqlite3_reset() would\r\n    ** be called automatically instead of throwing the SQLITE_MISUSE error.\r\n    ** This \"automatic-reset\" change is not technically an incompatibility, \r\n    ** since any application that receives an SQLITE_MISUSE is broken by\r\n    ** definition.\r\n    **\r\n    ** Nevertheless, some published applications that were originally written\r\n    ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE \r\n    ** returns, and those were broken by the automatic-reset change.  As a\r\n    ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the\r\n    ** legacy behavior of returning SQLITE_MISUSE for cases where the \r\n    ** previous sqlite3_step() returned something other than a SQLITE_LOCKED\r\n    ** or SQLITE_BUSY error.\r\n    */\r\n#ifdef SQLITE_OMIT_AUTORESET\r\n    if( p->rc==SQLITE_BUSY || p->rc==SQLITE_LOCKED ){\r\n      sqlite3_reset((sqlite3_stmt*)p);\r\n    }else{\r\n      return SQLITE_MISUSE_BKPT;\r\n    }\r\n#else\r\n    sqlite3_reset((sqlite3_stmt*)p);\r\n#endif\r\n  }\r\n\r\n  /* Check that malloc() has not failed. If it has, return early. */\r\n  db = p->db;\r\n  if( db->mallocFailed ){\r\n    p->rc = SQLITE_NOMEM;\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  if( p->pc<=0 && p->expired ){\r\n    p->rc = SQLITE_SCHEMA;\r\n    rc = SQLITE_ERROR;\r\n    goto end_of_step;\r\n  }\r\n  if( p->pc<0 ){\r\n    /* If there are no other statements currently running, then\r\n    ** reset the interrupt flag.  This prevents a call to sqlite3_interrupt\r\n    ** from interrupting a statement that has not yet started.\r\n    */\r\n    if( db->activeVdbeCnt==0 ){\r\n      db->u1.isInterrupted = 0;\r\n    }\r\n\r\n    assert( db->writeVdbeCnt>0 || db->autoCommit==0 || db->nDeferredCons==0 );\r\n\r\n#ifndef SQLITE_OMIT_TRACE\r\n    if( db->xProfile && !db->init.busy ){\r\n      sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);\r\n    }\r\n#endif\r\n\r\n    db->activeVdbeCnt++;\r\n    if( p->readOnly==0 ) db->writeVdbeCnt++;\r\n    p->pc = 0;\r\n  }\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  if( p->explain ){\r\n    rc = sqlite3VdbeList(p);\r\n  }else\r\n#endif /* SQLITE_OMIT_EXPLAIN */\r\n  {\r\n    db->vdbeExecCnt++;\r\n    rc = sqlite3VdbeExec(p);\r\n    db->vdbeExecCnt--;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_TRACE\r\n  /* Invoke the profile callback if there is one\r\n  */\r\n  if( rc!=SQLITE_ROW && db->xProfile && !db->init.busy && p->zSql ){\r\n    sqlite3_int64 iNow;\r\n    sqlite3OsCurrentTimeInt64(db->pVfs, &iNow);\r\n    db->xProfile(db->pProfileArg, p->zSql, (iNow - p->startTime)*1000000);\r\n  }\r\n#endif\r\n\r\n  if( rc==SQLITE_DONE ){\r\n    assert( p->rc==SQLITE_OK );\r\n    p->rc = doWalCallbacks(db);\r\n    if( p->rc!=SQLITE_OK ){\r\n      rc = SQLITE_ERROR;\r\n    }\r\n  }\r\n\r\n  db->errCode = rc;\r\n  if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){\r\n    p->rc = SQLITE_NOMEM;\r\n  }\r\nend_of_step:\r\n  /* At this point local variable rc holds the value that should be \r\n  ** returned if this statement was compiled using the legacy \r\n  ** sqlite3_prepare() interface. According to the docs, this can only\r\n  ** be one of the values in the first assert() below. Variable p->rc \r\n  ** contains the value that would be returned if sqlite3_finalize() \r\n  ** were called on statement p.\r\n  */\r\n  assert( rc==SQLITE_ROW  || rc==SQLITE_DONE   || rc==SQLITE_ERROR \r\n       || rc==SQLITE_BUSY || rc==SQLITE_MISUSE\r\n  );\r\n  assert( p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE );\r\n  if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){\r\n    /* If this statement was prepared using sqlite3_prepare_v2(), and an\r\n    ** error has occured, then return the error code in p->rc to the\r\n    ** caller. Set the error code in the database handle to the same value.\r\n    */ \r\n    rc = sqlite3VdbeTransferError(p);\r\n  }\r\n  return (rc&db->errMask);\r\n}\r\n\r\n/*\r\n** The maximum number of times that a statement will try to reparse\r\n** itself before giving up and returning SQLITE_SCHEMA.\r\n*/\r\n#ifndef SQLITE_MAX_SCHEMA_RETRY\r\n# define SQLITE_MAX_SCHEMA_RETRY 5\r\n#endif\r\n\r\n/*\r\n** This is the top-level implementation of sqlite3_step().  Call\r\n** sqlite3Step() to do most of the work.  If a schema error occurs,\r\n** call sqlite3Reprepare() and try again.\r\n*/\r\nSQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){\r\n  int rc = SQLITE_OK;      /* Result from sqlite3Step() */\r\n  int rc2 = SQLITE_OK;     /* Result from sqlite3Reprepare() */\r\n  Vdbe *v = (Vdbe*)pStmt;  /* the prepared statement */\r\n  int cnt = 0;             /* Counter to prevent infinite loop of reprepares */\r\n  sqlite3 *db;             /* The database connection */\r\n\r\n  if( vdbeSafetyNotNull(v) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  db = v->db;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  while( (rc = sqlite3Step(v))==SQLITE_SCHEMA\r\n         && cnt++ < SQLITE_MAX_SCHEMA_RETRY\r\n         && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){\r\n    sqlite3_reset(pStmt);\r\n    assert( v->expired==0 );\r\n  }\r\n  if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){\r\n    /* This case occurs after failing to recompile an sql statement. \r\n    ** The error message from the SQL compiler has already been loaded \r\n    ** into the database handle. This block copies the error message \r\n    ** from the database handle into the statement and sets the statement\r\n    ** program counter to 0 to ensure that when the statement is \r\n    ** finalized or reset the parser error message is available via\r\n    ** sqlite3_errmsg() and sqlite3_errcode().\r\n    */\r\n    const char *zErr = (const char *)sqlite3_value_text(db->pErr); \r\n    sqlite3DbFree(db, v->zErrMsg);\r\n    if( !db->mallocFailed ){\r\n      v->zErrMsg = sqlite3DbStrDup(db, zErr);\r\n      v->rc = rc2;\r\n    } else {\r\n      v->zErrMsg = 0;\r\n      v->rc = rc = SQLITE_NOMEM;\r\n    }\r\n  }\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Extract the user data from a sqlite3_context structure and return a\r\n** pointer to it.\r\n*/\r\nSQLITE_API void *sqlite3_user_data(sqlite3_context *p){\r\n  assert( p && p->pFunc );\r\n  return p->pFunc->pUserData;\r\n}\r\n\r\n/*\r\n** Extract the user data from a sqlite3_context structure and return a\r\n** pointer to it.\r\n**\r\n** IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface\r\n** returns a copy of the pointer to the database connection (the 1st\r\n** parameter) of the sqlite3_create_function() and\r\n** sqlite3_create_function16() routines that originally registered the\r\n** application defined function.\r\n*/\r\nSQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){\r\n  assert( p && p->pFunc );\r\n  return p->s.db;\r\n}\r\n\r\n/*\r\n** The following is the implementation of an SQL function that always\r\n** fails with an error message stating that the function is used in the\r\n** wrong context.  The sqlite3_overload_function() API might construct\r\n** SQL function that use this routine so that the functions will exist\r\n** for name resolution but are actually overloaded by the xFindFunction\r\n** method of virtual tables.\r\n*/\r\nSQLITE_PRIVATE void sqlite3InvalidFunction(\r\n  sqlite3_context *context,  /* The function calling context */\r\n  int NotUsed,               /* Number of arguments to the function */\r\n  sqlite3_value **NotUsed2   /* Value of each argument */\r\n){\r\n  const char *zName = context->pFunc->zName;\r\n  char *zErr;\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  zErr = sqlite3_mprintf(\r\n      \"unable to use function %s in the requested context\", zName);\r\n  sqlite3_result_error(context, zErr, -1);\r\n  sqlite3_free(zErr);\r\n}\r\n\r\n/*\r\n** Allocate or return the aggregate context for a user function.  A new\r\n** context is allocated on the first call.  Subsequent calls return the\r\n** same context that was returned on prior calls.\r\n*/\r\nSQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){\r\n  Mem *pMem;\r\n  assert( p && p->pFunc && p->pFunc->xStep );\r\n  assert( sqlite3_mutex_held(p->s.db->mutex) );\r\n  pMem = p->pMem;\r\n  testcase( nByte<0 );\r\n  if( (pMem->flags & MEM_Agg)==0 ){\r\n    if( nByte<=0 ){\r\n      sqlite3VdbeMemReleaseExternal(pMem);\r\n      pMem->flags = MEM_Null;\r\n      pMem->z = 0;\r\n    }else{\r\n      sqlite3VdbeMemGrow(pMem, nByte, 0);\r\n      pMem->flags = MEM_Agg;\r\n      pMem->u.pDef = p->pFunc;\r\n      if( pMem->z ){\r\n        memset(pMem->z, 0, nByte);\r\n      }\r\n    }\r\n  }\r\n  return (void*)pMem->z;\r\n}\r\n\r\n/*\r\n** Return the auxilary data pointer, if any, for the iArg'th argument to\r\n** the user-function defined by pCtx.\r\n*/\r\nSQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){\r\n  VdbeFunc *pVdbeFunc;\r\n\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  pVdbeFunc = pCtx->pVdbeFunc;\r\n  if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){\r\n    return 0;\r\n  }\r\n  return pVdbeFunc->apAux[iArg].pAux;\r\n}\r\n\r\n/*\r\n** Set the auxilary data pointer and delete function, for the iArg'th\r\n** argument to the user-function defined by pCtx. Any previous value is\r\n** deleted by calling the delete function specified when it was set.\r\n*/\r\nSQLITE_API void sqlite3_set_auxdata(\r\n  sqlite3_context *pCtx, \r\n  int iArg, \r\n  void *pAux, \r\n  void (*xDelete)(void*)\r\n){\r\n  struct AuxData *pAuxData;\r\n  VdbeFunc *pVdbeFunc;\r\n  if( iArg<0 ) goto failed;\r\n\r\n  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );\r\n  pVdbeFunc = pCtx->pVdbeFunc;\r\n  if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){\r\n    int nAux = (pVdbeFunc ? pVdbeFunc->nAux : 0);\r\n    int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;\r\n    pVdbeFunc = sqlite3DbRealloc(pCtx->s.db, pVdbeFunc, nMalloc);\r\n    if( !pVdbeFunc ){\r\n      goto failed;\r\n    }\r\n    pCtx->pVdbeFunc = pVdbeFunc;\r\n    memset(&pVdbeFunc->apAux[nAux], 0, sizeof(struct AuxData)*(iArg+1-nAux));\r\n    pVdbeFunc->nAux = iArg+1;\r\n    pVdbeFunc->pFunc = pCtx->pFunc;\r\n  }\r\n\r\n  pAuxData = &pVdbeFunc->apAux[iArg];\r\n  if( pAuxData->pAux && pAuxData->xDelete ){\r\n    pAuxData->xDelete(pAuxData->pAux);\r\n  }\r\n  pAuxData->pAux = pAux;\r\n  pAuxData->xDelete = xDelete;\r\n  return;\r\n\r\nfailed:\r\n  if( xDelete ){\r\n    xDelete(pAux);\r\n  }\r\n}\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n/*\r\n** Return the number of times the Step function of a aggregate has been \r\n** called.\r\n**\r\n** This function is deprecated.  Do not use it for new code.  It is\r\n** provide only to avoid breaking legacy code.  New aggregate function\r\n** implementations should keep their own counts within their aggregate\r\n** context.\r\n*/\r\nSQLITE_API int sqlite3_aggregate_count(sqlite3_context *p){\r\n  assert( p && p->pMem && p->pFunc && p->pFunc->xStep );\r\n  return p->pMem->n;\r\n}\r\n#endif\r\n\r\n/*\r\n** Return the number of columns in the result set for the statement pStmt.\r\n*/\r\nSQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt){\r\n  Vdbe *pVm = (Vdbe *)pStmt;\r\n  return pVm ? pVm->nResColumn : 0;\r\n}\r\n\r\n/*\r\n** Return the number of values available from the current row of the\r\n** currently executing statement pStmt.\r\n*/\r\nSQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt){\r\n  Vdbe *pVm = (Vdbe *)pStmt;\r\n  if( pVm==0 || pVm->pResultSet==0 ) return 0;\r\n  return pVm->nResColumn;\r\n}\r\n\r\n\r\n/*\r\n** Check to see if column iCol of the given statement is valid.  If\r\n** it is, return a pointer to the Mem for the value of that column.\r\n** If iCol is not valid, return a pointer to a Mem which has a value\r\n** of NULL.\r\n*/\r\nstatic Mem *columnMem(sqlite3_stmt *pStmt, int i){\r\n  Vdbe *pVm;\r\n  Mem *pOut;\r\n\r\n  pVm = (Vdbe *)pStmt;\r\n  if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){\r\n    sqlite3_mutex_enter(pVm->db->mutex);\r\n    pOut = &pVm->pResultSet[i];\r\n  }else{\r\n    /* If the value passed as the second argument is out of range, return\r\n    ** a pointer to the following static Mem object which contains the\r\n    ** value SQL NULL. Even though the Mem structure contains an element\r\n    ** of type i64, on certain architectures (x86) with certain compiler\r\n    ** switches (-Os), gcc may align this Mem object on a 4-byte boundary\r\n    ** instead of an 8-byte one. This all works fine, except that when\r\n    ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s\r\n    ** that a Mem structure is located on an 8-byte boundary. To prevent\r\n    ** these assert()s from failing, when building with SQLITE_DEBUG defined\r\n    ** using gcc, we force nullMem to be 8-byte aligned using the magical\r\n    ** __attribute__((aligned(8))) macro.  */\r\n    static const Mem nullMem \r\n#if defined(SQLITE_DEBUG) && defined(__GNUC__)\r\n      __attribute__((aligned(8))) \r\n#endif\r\n      = {0, \"\", (double)0, {0}, 0, MEM_Null, SQLITE_NULL, 0,\r\n#ifdef SQLITE_DEBUG\r\n         0, 0,  /* pScopyFrom, pFiller */\r\n#endif\r\n         0, 0 };\r\n\r\n    if( pVm && ALWAYS(pVm->db) ){\r\n      sqlite3_mutex_enter(pVm->db->mutex);\r\n      sqlite3Error(pVm->db, SQLITE_RANGE, 0);\r\n    }\r\n    pOut = (Mem*)&nullMem;\r\n  }\r\n  return pOut;\r\n}\r\n\r\n/*\r\n** This function is called after invoking an sqlite3_value_XXX function on a \r\n** column value (i.e. a value returned by evaluating an SQL expression in the\r\n** select list of a SELECT statement) that may cause a malloc() failure. If \r\n** malloc() has failed, the threads mallocFailed flag is cleared and the result\r\n** code of statement pStmt set to SQLITE_NOMEM.\r\n**\r\n** Specifically, this is called from within:\r\n**\r\n**     sqlite3_column_int()\r\n**     sqlite3_column_int64()\r\n**     sqlite3_column_text()\r\n**     sqlite3_column_text16()\r\n**     sqlite3_column_real()\r\n**     sqlite3_column_bytes()\r\n**     sqlite3_column_bytes16()\r\n**     sqiite3_column_blob()\r\n*/\r\nstatic void columnMallocFailure(sqlite3_stmt *pStmt)\r\n{\r\n  /* If malloc() failed during an encoding conversion within an\r\n  ** sqlite3_column_XXX API, then set the return code of the statement to\r\n  ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR\r\n  ** and _finalize() will return NOMEM.\r\n  */\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  if( p ){\r\n    p->rc = sqlite3ApiExit(p->db, p->rc);\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n  }\r\n}\r\n\r\n/**************************** sqlite3_column_  *******************************\r\n** The following routines are used to access elements of the current row\r\n** in the result set.\r\n*/\r\nSQLITE_API const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){\r\n  const void *val;\r\n  val = sqlite3_value_blob( columnMem(pStmt,i) );\r\n  /* Even though there is no encoding conversion, value_blob() might\r\n  ** need to call malloc() to expand the result of a zeroblob() \r\n  ** expression. \r\n  */\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){\r\n  int val = sqlite3_value_bytes( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){\r\n  int val = sqlite3_value_bytes16( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API double sqlite3_column_double(sqlite3_stmt *pStmt, int i){\r\n  double val = sqlite3_value_double( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API int sqlite3_column_int(sqlite3_stmt *pStmt, int i){\r\n  int val = sqlite3_value_int( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){\r\n  sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){\r\n  const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\nSQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){\r\n  Mem *pOut = columnMem(pStmt, i);\r\n  if( pOut->flags&MEM_Static ){\r\n    pOut->flags &= ~MEM_Static;\r\n    pOut->flags |= MEM_Ephem;\r\n  }\r\n  columnMallocFailure(pStmt);\r\n  return (sqlite3_value *)pOut;\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){\r\n  const void *val = sqlite3_value_text16( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return val;\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\nSQLITE_API int sqlite3_column_type(sqlite3_stmt *pStmt, int i){\r\n  int iType = sqlite3_value_type( columnMem(pStmt,i) );\r\n  columnMallocFailure(pStmt);\r\n  return iType;\r\n}\r\n\r\n/* The following function is experimental and subject to change or\r\n** removal */\r\n/*int sqlite3_column_numeric_type(sqlite3_stmt *pStmt, int i){\r\n**  return sqlite3_value_numeric_type( columnMem(pStmt,i) );\r\n**}\r\n*/\r\n\r\n/*\r\n** Convert the N-th element of pStmt->pColName[] into a string using\r\n** xFunc() then return that string.  If N is out of range, return 0.\r\n**\r\n** There are up to 5 names for each column.  useType determines which\r\n** name is returned.  Here are the names:\r\n**\r\n**    0      The column name as it should be displayed for output\r\n**    1      The datatype name for the column\r\n**    2      The name of the database that the column derives from\r\n**    3      The name of the table that the column derives from\r\n**    4      The name of the table column that the result column derives from\r\n**\r\n** If the result is not a simple column reference (if it is an expression\r\n** or a constant) then useTypes 2, 3, and 4 return NULL.\r\n*/\r\nstatic const void *columnName(\r\n  sqlite3_stmt *pStmt,\r\n  int N,\r\n  const void *(*xFunc)(Mem*),\r\n  int useType\r\n){\r\n  const void *ret = 0;\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  int n;\r\n  sqlite3 *db = p->db;\r\n  \r\n  assert( db!=0 );\r\n  n = sqlite3_column_count(pStmt);\r\n  if( N<n && N>=0 ){\r\n    N += useType*n;\r\n    sqlite3_mutex_enter(db->mutex);\r\n    assert( db->mallocFailed==0 );\r\n    ret = xFunc(&p->aColName[N]);\r\n     /* A malloc may have failed inside of the xFunc() call. If this\r\n    ** is the case, clear the mallocFailed flag and return NULL.\r\n    */\r\n    if( db->mallocFailed ){\r\n      db->mallocFailed = 0;\r\n      ret = 0;\r\n    }\r\n    sqlite3_mutex_leave(db->mutex);\r\n  }\r\n  return ret;\r\n}\r\n\r\n/*\r\n** Return the name of the Nth column of the result set returned by SQL\r\n** statement pStmt.\r\n*/\r\nSQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);\r\n}\r\n#endif\r\n\r\n/*\r\n** Constraint:  If you have ENABLE_COLUMN_METADATA then you must\r\n** not define OMIT_DECLTYPE.\r\n*/\r\n#if defined(SQLITE_OMIT_DECLTYPE) && defined(SQLITE_ENABLE_COLUMN_METADATA)\r\n# error \"Must not define both SQLITE_OMIT_DECLTYPE \\\r\n         and SQLITE_ENABLE_COLUMN_METADATA\"\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_DECLTYPE\r\n/*\r\n** Return the column declaration type (if applicable) of the 'i'th column\r\n** of the result set of SQL statement pStmt.\r\n*/\r\nSQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n#endif /* SQLITE_OMIT_DECLTYPE */\r\n\r\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\r\n/*\r\n** Return the name of the database from which a result column derives.\r\n** NULL is returned if the result column is an expression or constant or\r\n** anything else which is not an unabiguous reference to a database column.\r\n*/\r\nSQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/*\r\n** Return the name of the table from which a result column derives.\r\n** NULL is returned if the result column is an expression or constant or\r\n** anything else which is not an unabiguous reference to a database column.\r\n*/\r\nSQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/*\r\n** Return the name of the table column from which a result column derives.\r\n** NULL is returned if the result column is an expression or constant or\r\n** anything else which is not an unabiguous reference to a database column.\r\n*/\r\nSQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){\r\n  return columnName(\r\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n#endif /* SQLITE_ENABLE_COLUMN_METADATA */\r\n\r\n\r\n/******************************* sqlite3_bind_  ***************************\r\n** \r\n** Routines used to attach values to wildcards in a compiled SQL statement.\r\n*/\r\n/*\r\n** Unbind the value bound to variable i in virtual machine p. This is the \r\n** the same as binding a NULL value to the column. If the \"i\" parameter is\r\n** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK.\r\n**\r\n** A successful evaluation of this routine acquires the mutex on p.\r\n** the mutex is released if any kind of error occurs.\r\n**\r\n** The error code stored in database p->db is overwritten with the return\r\n** value in any case.\r\n*/\r\nstatic int vdbeUnbind(Vdbe *p, int i){\r\n  Mem *pVar;\r\n  if( vdbeSafetyNotNull(p) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  sqlite3_mutex_enter(p->db->mutex);\r\n  if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){\r\n    sqlite3Error(p->db, SQLITE_MISUSE, 0);\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n    sqlite3_log(SQLITE_MISUSE, \r\n        \"bind on a busy prepared statement: [%s]\", p->zSql);\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  if( i<1 || i>p->nVar ){\r\n    sqlite3Error(p->db, SQLITE_RANGE, 0);\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n    return SQLITE_RANGE;\r\n  }\r\n  i--;\r\n  pVar = &p->aVar[i];\r\n  sqlite3VdbeMemRelease(pVar);\r\n  pVar->flags = MEM_Null;\r\n  sqlite3Error(p->db, SQLITE_OK, 0);\r\n\r\n  /* If the bit corresponding to this variable in Vdbe.expmask is set, then \r\n  ** binding a new value to this variable invalidates the current query plan.\r\n  **\r\n  ** IMPLEMENTATION-OF: R-48440-37595 If the specific value bound to host\r\n  ** parameter in the WHERE clause might influence the choice of query plan\r\n  ** for a statement, then the statement will be automatically recompiled,\r\n  ** as if there had been a schema change, on the first sqlite3_step() call\r\n  ** following any change to the bindings of that parameter.\r\n  */\r\n  if( p->isPrepareV2 &&\r\n     ((i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff)\r\n  ){\r\n    p->expired = 1;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Bind a text or BLOB value.\r\n*/\r\nstatic int bindText(\r\n  sqlite3_stmt *pStmt,   /* The statement to bind against */\r\n  int i,                 /* Index of the parameter to bind */\r\n  const void *zData,     /* Pointer to the data to be bound */\r\n  int nData,             /* Number of bytes of data to be bound */\r\n  void (*xDel)(void*),   /* Destructor for the data */\r\n  u8 encoding            /* Encoding for the data */\r\n){\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  Mem *pVar;\r\n  int rc;\r\n\r\n  rc = vdbeUnbind(p, i);\r\n  if( rc==SQLITE_OK ){\r\n    if( zData!=0 ){\r\n      pVar = &p->aVar[i-1];\r\n      rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);\r\n      if( rc==SQLITE_OK && encoding!=0 ){\r\n        rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));\r\n      }\r\n      sqlite3Error(p->db, rc, 0);\r\n      rc = sqlite3ApiExit(p->db, rc);\r\n    }\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n  }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){\r\n    xDel((void*)zData);\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Bind a blob value to an SQL statement variable.\r\n*/\r\nSQLITE_API int sqlite3_bind_blob(\r\n  sqlite3_stmt *pStmt, \r\n  int i, \r\n  const void *zData, \r\n  int nData, \r\n  void (*xDel)(void*)\r\n){\r\n  return bindText(pStmt, i, zData, nData, xDel, 0);\r\n}\r\nSQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){\r\n  int rc;\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  rc = vdbeUnbind(p, i);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n  }\r\n  return rc;\r\n}\r\nSQLITE_API int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){\r\n  return sqlite3_bind_int64(p, i, (i64)iValue);\r\n}\r\nSQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){\r\n  int rc;\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  rc = vdbeUnbind(p, i);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n  }\r\n  return rc;\r\n}\r\nSQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){\r\n  int rc;\r\n  Vdbe *p = (Vdbe*)pStmt;\r\n  rc = vdbeUnbind(p, i);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n  }\r\n  return rc;\r\n}\r\nSQLITE_API int sqlite3_bind_text( \r\n  sqlite3_stmt *pStmt, \r\n  int i, \r\n  const char *zData, \r\n  int nData, \r\n  void (*xDel)(void*)\r\n){\r\n  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);\r\n}\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API int sqlite3_bind_text16(\r\n  sqlite3_stmt *pStmt, \r\n  int i, \r\n  const void *zData, \r\n  int nData, \r\n  void (*xDel)(void*)\r\n){\r\n  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\nSQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){\r\n  int rc;\r\n  switch( pValue->type ){\r\n    case SQLITE_INTEGER: {\r\n      rc = sqlite3_bind_int64(pStmt, i, pValue->u.i);\r\n      break;\r\n    }\r\n    case SQLITE_FLOAT: {\r\n      rc = sqlite3_bind_double(pStmt, i, pValue->r);\r\n      break;\r\n    }\r\n    case SQLITE_BLOB: {\r\n      if( pValue->flags & MEM_Zero ){\r\n        rc = sqlite3_bind_zeroblob(pStmt, i, pValue->u.nZero);\r\n      }else{\r\n        rc = sqlite3_bind_blob(pStmt, i, pValue->z, pValue->n,SQLITE_TRANSIENT);\r\n      }\r\n      break;\r\n    }\r\n    case SQLITE_TEXT: {\r\n      rc = bindText(pStmt,i,  pValue->z, pValue->n, SQLITE_TRANSIENT,\r\n                              pValue->enc);\r\n      break;\r\n    }\r\n    default: {\r\n      rc = sqlite3_bind_null(pStmt, i);\r\n      break;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\nSQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){\r\n  int rc;\r\n  Vdbe *p = (Vdbe *)pStmt;\r\n  rc = vdbeUnbind(p, i);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);\r\n    sqlite3_mutex_leave(p->db->mutex);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the number of wildcards that can be potentially bound to.\r\n** This routine is added to support DBD::SQLite.  \r\n*/\r\nSQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){\r\n  Vdbe *p = (Vdbe*)pStmt;\r\n  return p ? p->nVar : 0;\r\n}\r\n\r\n/*\r\n** Return the name of a wildcard parameter.  Return NULL if the index\r\n** is out of range or if the wildcard is unnamed.\r\n**\r\n** The result is always UTF-8.\r\n*/\r\nSQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){\r\n  Vdbe *p = (Vdbe*)pStmt;\r\n  if( p==0 || i<1 || i>p->nzVar ){\r\n    return 0;\r\n  }\r\n  return p->azVar[i-1];\r\n}\r\n\r\n/*\r\n** Given a wildcard parameter name, return the index of the variable\r\n** with that name.  If there is no variable with the given name,\r\n** return 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){\r\n  int i;\r\n  if( p==0 ){\r\n    return 0;\r\n  }\r\n  if( zName ){\r\n    for(i=0; i<p->nzVar; i++){\r\n      const char *z = p->azVar[i];\r\n      if( z && memcmp(z,zName,nName)==0 && z[nName]==0 ){\r\n        return i+1;\r\n      }\r\n    }\r\n  }\r\n  return 0;\r\n}\r\nSQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){\r\n  return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));\r\n}\r\n\r\n/*\r\n** Transfer all bindings from the first statement over to the second.\r\n*/\r\nSQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){\r\n  Vdbe *pFrom = (Vdbe*)pFromStmt;\r\n  Vdbe *pTo = (Vdbe*)pToStmt;\r\n  int i;\r\n  assert( pTo->db==pFrom->db );\r\n  assert( pTo->nVar==pFrom->nVar );\r\n  sqlite3_mutex_enter(pTo->db->mutex);\r\n  for(i=0; i<pFrom->nVar; i++){\r\n    sqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]);\r\n  }\r\n  sqlite3_mutex_leave(pTo->db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n/*\r\n** Deprecated external interface.  Internal/core SQLite code\r\n** should call sqlite3TransferBindings.\r\n**\r\n** Is is misuse to call this routine with statements from different\r\n** database connections.  But as this is a deprecated interface, we\r\n** will not bother to check for that condition.\r\n**\r\n** If the two statements contain a different number of bindings, then\r\n** an SQLITE_ERROR is returned.  Nothing else can go wrong, so otherwise\r\n** SQLITE_OK is returned.\r\n*/\r\nSQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){\r\n  Vdbe *pFrom = (Vdbe*)pFromStmt;\r\n  Vdbe *pTo = (Vdbe*)pToStmt;\r\n  if( pFrom->nVar!=pTo->nVar ){\r\n    return SQLITE_ERROR;\r\n  }\r\n  if( pTo->isPrepareV2 && pTo->expmask ){\r\n    pTo->expired = 1;\r\n  }\r\n  if( pFrom->isPrepareV2 && pFrom->expmask ){\r\n    pFrom->expired = 1;\r\n  }\r\n  return sqlite3TransferBindings(pFromStmt, pToStmt);\r\n}\r\n#endif\r\n\r\n/*\r\n** Return the sqlite3* database handle to which the prepared statement given\r\n** in the argument belongs.  This is the same database handle that was\r\n** the first argument to the sqlite3_prepare() that was used to create\r\n** the statement in the first place.\r\n*/\r\nSQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){\r\n  return pStmt ? ((Vdbe*)pStmt)->db : 0;\r\n}\r\n\r\n/*\r\n** Return true if the prepared statement is guaranteed to not modify the\r\n** database.\r\n*/\r\nSQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){\r\n  return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;\r\n}\r\n\r\n/*\r\n** Return true if the prepared statement is in need of being reset.\r\n*/\r\nSQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){\r\n  Vdbe *v = (Vdbe*)pStmt;\r\n  return v!=0 && v->pc>0 && v->magic==VDBE_MAGIC_RUN;\r\n}\r\n\r\n/*\r\n** Return a pointer to the next prepared statement after pStmt associated\r\n** with database connection pDb.  If pStmt is NULL, return the first\r\n** prepared statement for the database connection.  Return NULL if there\r\n** are no more.\r\n*/\r\nSQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){\r\n  sqlite3_stmt *pNext;\r\n  sqlite3_mutex_enter(pDb->mutex);\r\n  if( pStmt==0 ){\r\n    pNext = (sqlite3_stmt*)pDb->pVdbe;\r\n  }else{\r\n    pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;\r\n  }\r\n  sqlite3_mutex_leave(pDb->mutex);\r\n  return pNext;\r\n}\r\n\r\n/*\r\n** Return the value of a status counter for a prepared statement\r\n*/\r\nSQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){\r\n  Vdbe *pVdbe = (Vdbe*)pStmt;\r\n  int v = pVdbe->aCounter[op-1];\r\n  if( resetFlag ) pVdbe->aCounter[op-1] = 0;\r\n  return v;\r\n}\r\n\r\n/************** End of vdbeapi.c *********************************************/\r\n/************** Begin file vdbetrace.c ***************************************/\r\n/*\r\n** 2009 November 25\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code used to insert the values of host parameters\r\n** (aka \"wildcards\") into the SQL text output by sqlite3_trace().\r\n**\r\n** The Vdbe parse-tree explainer is also found here.\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_TRACE\r\n\r\n/*\r\n** zSql is a zero-terminated string of UTF-8 SQL text.  Return the number of\r\n** bytes in this text up to but excluding the first character in\r\n** a host parameter.  If the text contains no host parameters, return\r\n** the total number of bytes in the text.\r\n*/\r\nstatic int findNextHostParameter(const char *zSql, int *pnToken){\r\n  int tokenType;\r\n  int nTotal = 0;\r\n  int n;\r\n\r\n  *pnToken = 0;\r\n  while( zSql[0] ){\r\n    n = sqlite3GetToken((u8*)zSql, &tokenType);\r\n    assert( n>0 && tokenType!=TK_ILLEGAL );\r\n    if( tokenType==TK_VARIABLE ){\r\n      *pnToken = n;\r\n      break;\r\n    }\r\n    nTotal += n;\r\n    zSql += n;\r\n  }\r\n  return nTotal;\r\n}\r\n\r\n/*\r\n** This function returns a pointer to a nul-terminated string in memory\r\n** obtained from sqlite3DbMalloc(). If sqlite3.vdbeExecCnt is 1, then the\r\n** string contains a copy of zRawSql but with host parameters expanded to \r\n** their current bindings. Or, if sqlite3.vdbeExecCnt is greater than 1, \r\n** then the returned string holds a copy of zRawSql with \"-- \" prepended\r\n** to each line of text.\r\n**\r\n** The calling function is responsible for making sure the memory returned\r\n** is eventually freed.\r\n**\r\n** ALGORITHM:  Scan the input string looking for host parameters in any of\r\n** these forms:  ?, ?N, $A, @A, :A.  Take care to avoid text within\r\n** string literals, quoted identifier names, and comments.  For text forms,\r\n** the host parameter index is found by scanning the perpared\r\n** statement for the corresponding OP_Variable opcode.  Once the host\r\n** parameter index is known, locate the value in p->aVar[].  Then render\r\n** the value as a literal in place of the host parameter name.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3VdbeExpandSql(\r\n  Vdbe *p,                 /* The prepared statement being evaluated */\r\n  const char *zRawSql      /* Raw text of the SQL statement */\r\n){\r\n  sqlite3 *db;             /* The database connection */\r\n  int idx = 0;             /* Index of a host parameter */\r\n  int nextIndex = 1;       /* Index of next ? host parameter */\r\n  int n;                   /* Length of a token prefix */\r\n  int nToken;              /* Length of the parameter token */\r\n  int i;                   /* Loop counter */\r\n  Mem *pVar;               /* Value of a host parameter */\r\n  StrAccum out;            /* Accumulate the output here */\r\n  char zBase[100];         /* Initial working space */\r\n\r\n  db = p->db;\r\n  sqlite3StrAccumInit(&out, zBase, sizeof(zBase), \r\n                      db->aLimit[SQLITE_LIMIT_LENGTH]);\r\n  out.db = db;\r\n  if( db->vdbeExecCnt>1 ){\r\n    while( *zRawSql ){\r\n      const char *zStart = zRawSql;\r\n      while( *(zRawSql++)!='\\n' && *zRawSql );\r\n      sqlite3StrAccumAppend(&out, \"-- \", 3);\r\n      sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart));\r\n    }\r\n  }else{\r\n    while( zRawSql[0] ){\r\n      n = findNextHostParameter(zRawSql, &nToken);\r\n      assert( n>0 );\r\n      sqlite3StrAccumAppend(&out, zRawSql, n);\r\n      zRawSql += n;\r\n      assert( zRawSql[0] || nToken==0 );\r\n      if( nToken==0 ) break;\r\n      if( zRawSql[0]=='?' ){\r\n        if( nToken>1 ){\r\n          assert( sqlite3Isdigit(zRawSql[1]) );\r\n          sqlite3GetInt32(&zRawSql[1], &idx);\r\n        }else{\r\n          idx = nextIndex;\r\n        }\r\n      }else{\r\n        assert( zRawSql[0]==':' || zRawSql[0]=='$' || zRawSql[0]=='@' );\r\n        testcase( zRawSql[0]==':' );\r\n        testcase( zRawSql[0]=='$' );\r\n        testcase( zRawSql[0]=='@' );\r\n        idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken);\r\n        assert( idx>0 );\r\n      }\r\n      zRawSql += nToken;\r\n      nextIndex = idx + 1;\r\n      assert( idx>0 && idx<=p->nVar );\r\n      pVar = &p->aVar[idx-1];\r\n      if( pVar->flags & MEM_Null ){\r\n        sqlite3StrAccumAppend(&out, \"NULL\", 4);\r\n      }else if( pVar->flags & MEM_Int ){\r\n        sqlite3XPrintf(&out, \"%lld\", pVar->u.i);\r\n      }else if( pVar->flags & MEM_Real ){\r\n        sqlite3XPrintf(&out, \"%!.15g\", pVar->r);\r\n      }else if( pVar->flags & MEM_Str ){\r\n#ifndef SQLITE_OMIT_UTF16\r\n        u8 enc = ENC(db);\r\n        if( enc!=SQLITE_UTF8 ){\r\n          Mem utf8;\r\n          memset(&utf8, 0, sizeof(utf8));\r\n          utf8.db = db;\r\n          sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC);\r\n          sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8);\r\n          sqlite3XPrintf(&out, \"'%.*q'\", utf8.n, utf8.z);\r\n          sqlite3VdbeMemRelease(&utf8);\r\n        }else\r\n#endif\r\n        {\r\n          sqlite3XPrintf(&out, \"'%.*q'\", pVar->n, pVar->z);\r\n        }\r\n      }else if( pVar->flags & MEM_Zero ){\r\n        sqlite3XPrintf(&out, \"zeroblob(%d)\", pVar->u.nZero);\r\n      }else{\r\n        assert( pVar->flags & MEM_Blob );\r\n        sqlite3StrAccumAppend(&out, \"x'\", 2);\r\n        for(i=0; i<pVar->n; i++){\r\n          sqlite3XPrintf(&out, \"%02x\", pVar->z[i]&0xff);\r\n        }\r\n        sqlite3StrAccumAppend(&out, \"'\", 1);\r\n      }\r\n    }\r\n  }\r\n  return sqlite3StrAccumFinish(&out);\r\n}\r\n\r\n#endif /* #ifndef SQLITE_OMIT_TRACE */\r\n\r\n/*****************************************************************************\r\n** The following code implements the data-structure explaining logic\r\n** for the Vdbe.\r\n*/\r\n\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\n\r\n/*\r\n** Allocate a new Explain object\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainBegin(Vdbe *pVdbe){\r\n  if( pVdbe ){\r\n    sqlite3BeginBenignMalloc();\r\n    Explain *p = sqlite3_malloc( sizeof(Explain) );\r\n    if( p ){\r\n      memset(p, 0, sizeof(*p));\r\n      p->pVdbe = pVdbe;\r\n      sqlite3_free(pVdbe->pExplain);\r\n      pVdbe->pExplain = p;\r\n      sqlite3StrAccumInit(&p->str, p->zBase, sizeof(p->zBase),\r\n                          SQLITE_MAX_LENGTH);\r\n      p->str.useMalloc = 2;\r\n    }else{\r\n      sqlite3EndBenignMalloc();\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Return true if the Explain ends with a new-line.\r\n*/\r\nstatic int endsWithNL(Explain *p){\r\n  return p && p->str.zText && p->str.nChar\r\n           && p->str.zText[p->str.nChar-1]=='\\n';\r\n}\r\n    \r\n/*\r\n** Append text to the indentation\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainPrintf(Vdbe *pVdbe, const char *zFormat, ...){\r\n  Explain *p;\r\n  if( pVdbe && (p = pVdbe->pExplain)!=0 ){\r\n    va_list ap;\r\n    if( p->nIndent && endsWithNL(p) ){\r\n      int n = p->nIndent;\r\n      if( n>ArraySize(p->aIndent) ) n = ArraySize(p->aIndent);\r\n      sqlite3AppendSpace(&p->str, p->aIndent[n-1]);\r\n    }   \r\n    va_start(ap, zFormat);\r\n    sqlite3VXPrintf(&p->str, 1, zFormat, ap);\r\n    va_end(ap);\r\n  }\r\n}\r\n\r\n/*\r\n** Append a '\\n' if there is not already one.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainNL(Vdbe *pVdbe){\r\n  Explain *p;\r\n  if( pVdbe && (p = pVdbe->pExplain)!=0 && !endsWithNL(p) ){\r\n    sqlite3StrAccumAppend(&p->str, \"\\n\", 1);\r\n  }\r\n}\r\n\r\n/*\r\n** Push a new indentation level.  Subsequent lines will be indented\r\n** so that they begin at the current cursor position.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainPush(Vdbe *pVdbe){\r\n  Explain *p;\r\n  if( pVdbe && (p = pVdbe->pExplain)!=0 ){\r\n    if( p->str.zText && p->nIndent<ArraySize(p->aIndent) ){\r\n      const char *z = p->str.zText;\r\n      int i = p->str.nChar-1;\r\n      int x;\r\n      while( i>=0 && z[i]!='\\n' ){ i--; }\r\n      x = (p->str.nChar - 1) - i;\r\n      if( p->nIndent && x<p->aIndent[p->nIndent-1] ){\r\n        x = p->aIndent[p->nIndent-1];\r\n      }\r\n      p->aIndent[p->nIndent] = x;\r\n    }\r\n    p->nIndent++;\r\n  }\r\n}\r\n\r\n/*\r\n** Pop the indentation stack by one level.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainPop(Vdbe *p){\r\n  if( p && p->pExplain ) p->pExplain->nIndent--;\r\n}\r\n\r\n/*\r\n** Free the indentation structure\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainFinish(Vdbe *pVdbe){\r\n  if( pVdbe && pVdbe->pExplain ){\r\n    sqlite3_free(pVdbe->zExplain);\r\n    sqlite3ExplainNL(pVdbe);\r\n    pVdbe->zExplain = sqlite3StrAccumFinish(&pVdbe->pExplain->str);\r\n    sqlite3_free(pVdbe->pExplain);\r\n    pVdbe->pExplain = 0;\r\n    sqlite3EndBenignMalloc();\r\n  }\r\n}\r\n\r\n/*\r\n** Return the explanation of a virtual machine.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3VdbeExplanation(Vdbe *pVdbe){\r\n  return (pVdbe && pVdbe->zExplain) ? pVdbe->zExplain : 0;\r\n}\r\n#endif /* defined(SQLITE_DEBUG) */\r\n\r\n/************** End of vdbetrace.c *******************************************/\r\n/************** Begin file vdbe.c ********************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** The code in this file implements execution method of the \r\n** Virtual Database Engine (VDBE).  A separate file (\"vdbeaux.c\")\r\n** handles housekeeping details such as creating and deleting\r\n** VDBE instances.  This file is solely interested in executing\r\n** the VDBE program.\r\n**\r\n** In the external interface, an \"sqlite3_stmt*\" is an opaque pointer\r\n** to a VDBE.\r\n**\r\n** The SQL parser generates a program which is then executed by\r\n** the VDBE to do the work of the SQL statement.  VDBE programs are \r\n** similar in form to assembly language.  The program consists of\r\n** a linear sequence of operations.  Each operation has an opcode \r\n** and 5 operands.  Operands P1, P2, and P3 are integers.  Operand P4 \r\n** is a null-terminated string.  Operand P5 is an unsigned character.\r\n** Few opcodes use all 5 operands.\r\n**\r\n** Computation results are stored on a set of registers numbered beginning\r\n** with 1 and going up to Vdbe.nMem.  Each register can store\r\n** either an integer, a null-terminated string, a floating point\r\n** number, or the SQL \"NULL\" value.  An implicit conversion from one\r\n** type to the other occurs as necessary.\r\n** \r\n** Most of the code in this file is taken up by the sqlite3VdbeExec()\r\n** function which does the work of interpreting a VDBE program.\r\n** But other routines are also provided to help in building up\r\n** a program instruction by instruction.\r\n**\r\n** Various scripts scan this source file in order to generate HTML\r\n** documentation, headers files, or other derived files.  The formatting\r\n** of the code in this file is, therefore, important.  See other comments\r\n** in this file for details.  If in doubt, do not deviate from existing\r\n** commenting and indentation practices when changing or adding code.\r\n*/\r\n\r\n/*\r\n** Invoke this macro on memory cells just prior to changing the\r\n** value of the cell.  This macro verifies that shallow copies are\r\n** not misused.\r\n*/\r\n#ifdef SQLITE_DEBUG\r\n# define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)\r\n#else\r\n# define memAboutToChange(P,M)\r\n#endif\r\n\r\n/*\r\n** The following global variable is incremented every time a cursor\r\n** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes.  The test\r\n** procedures use this information to make sure that indices are\r\n** working correctly.  This variable has no function other than to\r\n** help verify the correct operation of the library.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_search_count = 0;\r\n#endif\r\n\r\n/*\r\n** When this global variable is positive, it gets decremented once before\r\n** each instruction in the VDBE.  When it reaches zero, the u1.isInterrupted\r\n** field of the sqlite3 structure is set in order to simulate an interrupt.\r\n**\r\n** This facility is used for testing purposes only.  It does not function\r\n** in an ordinary build.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_interrupt_count = 0;\r\n#endif\r\n\r\n/*\r\n** The next global variable is incremented each type the OP_Sort opcode\r\n** is executed.  The test procedures use this information to make sure that\r\n** sorting is occurring or not occurring at appropriate times.   This variable\r\n** has no function other than to help verify the correct operation of the\r\n** library.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_sort_count = 0;\r\n#endif\r\n\r\n/*\r\n** The next global variable records the size of the largest MEM_Blob\r\n** or MEM_Str that has been used by a VDBE opcode.  The test procedures\r\n** use this information to make sure that the zero-blob functionality\r\n** is working correctly.   This variable has no function other than to\r\n** help verify the correct operation of the library.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_max_blobsize = 0;\r\nstatic void updateMaxBlobsize(Mem *p){\r\n  if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){\r\n    sqlite3_max_blobsize = p->n;\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** The next global variable is incremented each type the OP_Found opcode\r\n** is executed. This is used to test whether or not the foreign key\r\n** operation implemented using OP_FkIsZero is working. This variable\r\n** has no function other than to help verify the correct operation of the\r\n** library.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_found_count = 0;\r\n#endif\r\n\r\n/*\r\n** Test a register to see if it exceeds the current maximum blob size.\r\n** If it does, record the new maximum blob size.\r\n*/\r\n#if defined(SQLITE_TEST) && !defined(SQLITE_OMIT_BUILTIN_TEST)\r\n# define UPDATE_MAX_BLOBSIZE(P)  updateMaxBlobsize(P)\r\n#else\r\n# define UPDATE_MAX_BLOBSIZE(P)\r\n#endif\r\n\r\n/*\r\n** Convert the given register into a string if it isn't one\r\n** already. Return non-zero if a malloc() fails.\r\n*/\r\n#define Stringify(P, enc) \\\r\n   if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc)) \\\r\n     { goto no_mem; }\r\n\r\n/*\r\n** An ephemeral string value (signified by the MEM_Ephem flag) contains\r\n** a pointer to a dynamically allocated string where some other entity\r\n** is responsible for deallocating that string.  Because the register\r\n** does not control the string, it might be deleted without the register\r\n** knowing it.\r\n**\r\n** This routine converts an ephemeral string into a dynamically allocated\r\n** string that the register itself controls.  In other words, it\r\n** converts an MEM_Ephem string into an MEM_Dyn string.\r\n*/\r\n#define Deephemeralize(P) \\\r\n   if( ((P)->flags&MEM_Ephem)!=0 \\\r\n       && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;}\r\n\r\n/* Return true if the cursor was opened using the OP_OpenSorter opcode. */\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n# define isSorter(x) 0\r\n#else\r\n# define isSorter(x) ((x)->pSorter!=0)\r\n#endif\r\n\r\n/*\r\n** Argument pMem points at a register that will be passed to a\r\n** user-defined function or returned to the user as the result of a query.\r\n** This routine sets the pMem->type variable used by the sqlite3_value_*() \r\n** routines.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){\r\n  int flags = pMem->flags;\r\n  if( flags & MEM_Null ){\r\n    pMem->type = SQLITE_NULL;\r\n  }\r\n  else if( flags & MEM_Int ){\r\n    pMem->type = SQLITE_INTEGER;\r\n  }\r\n  else if( flags & MEM_Real ){\r\n    pMem->type = SQLITE_FLOAT;\r\n  }\r\n  else if( flags & MEM_Str ){\r\n    pMem->type = SQLITE_TEXT;\r\n  }else{\r\n    pMem->type = SQLITE_BLOB;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate VdbeCursor number iCur.  Return a pointer to it.  Return NULL\r\n** if we run out of memory.\r\n*/\r\nstatic VdbeCursor *allocateCursor(\r\n  Vdbe *p,              /* The virtual machine */\r\n  int iCur,             /* Index of the new VdbeCursor */\r\n  int nField,           /* Number of fields in the table or index */\r\n  int iDb,              /* Database the cursor belongs to, or -1 */\r\n  int isBtreeCursor     /* True for B-Tree.  False for pseudo-table or vtab */\r\n){\r\n  /* Find the memory cell that will be used to store the blob of memory\r\n  ** required for this VdbeCursor structure. It is convenient to use a \r\n  ** vdbe memory cell to manage the memory allocation required for a\r\n  ** VdbeCursor structure for the following reasons:\r\n  **\r\n  **   * Sometimes cursor numbers are used for a couple of different\r\n  **     purposes in a vdbe program. The different uses might require\r\n  **     different sized allocations. Memory cells provide growable\r\n  **     allocations.\r\n  **\r\n  **   * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can\r\n  **     be freed lazily via the sqlite3_release_memory() API. This\r\n  **     minimizes the number of malloc calls made by the system.\r\n  **\r\n  ** Memory cells for cursors are allocated at the top of the address\r\n  ** space. Memory cell (p->nMem) corresponds to cursor 0. Space for\r\n  ** cursor 1 is managed by memory cell (p->nMem-1), etc.\r\n  */\r\n  Mem *pMem = &p->aMem[p->nMem-iCur];\r\n\r\n  int nByte;\r\n  VdbeCursor *pCx = 0;\r\n  nByte = \r\n      ROUND8(sizeof(VdbeCursor)) + \r\n      (isBtreeCursor?sqlite3BtreeCursorSize():0) + \r\n      2*nField*sizeof(u32);\r\n\r\n  assert( iCur<p->nCursor );\r\n  if( p->apCsr[iCur] ){\r\n    sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);\r\n    p->apCsr[iCur] = 0;\r\n  }\r\n  if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){\r\n    p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;\r\n    memset(pCx, 0, sizeof(VdbeCursor));\r\n    pCx->iDb = iDb;\r\n    pCx->nField = nField;\r\n    if( nField ){\r\n      pCx->aType = (u32 *)&pMem->z[ROUND8(sizeof(VdbeCursor))];\r\n    }\r\n    if( isBtreeCursor ){\r\n      pCx->pCursor = (BtCursor*)\r\n          &pMem->z[ROUND8(sizeof(VdbeCursor))+2*nField*sizeof(u32)];\r\n      sqlite3BtreeCursorZero(pCx->pCursor);\r\n    }\r\n  }\r\n  return pCx;\r\n}\r\n\r\n/*\r\n** Try to convert a value into a numeric representation if we can\r\n** do so without loss of information.  In other words, if the string\r\n** looks like a number, convert it into a number.  If it does not\r\n** look like a number, leave it alone.\r\n*/\r\nstatic void applyNumericAffinity(Mem *pRec){\r\n  if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){\r\n    double rValue;\r\n    i64 iValue;\r\n    u8 enc = pRec->enc;\r\n    if( (pRec->flags&MEM_Str)==0 ) return;\r\n    if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return;\r\n    if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){\r\n      pRec->u.i = iValue;\r\n      pRec->flags |= MEM_Int;\r\n    }else{\r\n      pRec->r = rValue;\r\n      pRec->flags |= MEM_Real;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Processing is determine by the affinity parameter:\r\n**\r\n** SQLITE_AFF_INTEGER:\r\n** SQLITE_AFF_REAL:\r\n** SQLITE_AFF_NUMERIC:\r\n**    Try to convert pRec to an integer representation or a \r\n**    floating-point representation if an integer representation\r\n**    is not possible.  Note that the integer representation is\r\n**    always preferred, even if the affinity is REAL, because\r\n**    an integer representation is more space efficient on disk.\r\n**\r\n** SQLITE_AFF_TEXT:\r\n**    Convert pRec to a text representation.\r\n**\r\n** SQLITE_AFF_NONE:\r\n**    No-op.  pRec is unchanged.\r\n*/\r\nstatic void applyAffinity(\r\n  Mem *pRec,          /* The value to apply affinity to */\r\n  char affinity,      /* The affinity to be applied */\r\n  u8 enc              /* Use this text encoding */\r\n){\r\n  if( affinity==SQLITE_AFF_TEXT ){\r\n    /* Only attempt the conversion to TEXT if there is an integer or real\r\n    ** representation (blob and NULL do not get converted) but no string\r\n    ** representation.\r\n    */\r\n    if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){\r\n      sqlite3VdbeMemStringify(pRec, enc);\r\n    }\r\n    pRec->flags &= ~(MEM_Real|MEM_Int);\r\n  }else if( affinity!=SQLITE_AFF_NONE ){\r\n    assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL\r\n             || affinity==SQLITE_AFF_NUMERIC );\r\n    applyNumericAffinity(pRec);\r\n    if( pRec->flags & MEM_Real ){\r\n      sqlite3VdbeIntegerAffinity(pRec);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Try to convert the type of a function argument or a result column\r\n** into a numeric representation.  Use either INTEGER or REAL whichever\r\n** is appropriate.  But only do the conversion if it is possible without\r\n** loss of information and return the revised type of the argument.\r\n*/\r\nSQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){\r\n  Mem *pMem = (Mem*)pVal;\r\n  if( pMem->type==SQLITE_TEXT ){\r\n    applyNumericAffinity(pMem);\r\n    sqlite3VdbeMemStoreType(pMem);\r\n  }\r\n  return pMem->type;\r\n}\r\n\r\n/*\r\n** Exported version of applyAffinity(). This one works on sqlite3_value*, \r\n** not the internal Mem* type.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ValueApplyAffinity(\r\n  sqlite3_value *pVal, \r\n  u8 affinity, \r\n  u8 enc\r\n){\r\n  applyAffinity((Mem *)pVal, affinity, enc);\r\n}\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** Write a nice string representation of the contents of cell pMem\r\n** into buffer zBuf, length nBuf.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){\r\n  char *zCsr = zBuf;\r\n  int f = pMem->flags;\r\n\r\n  static const char *const encnames[] = {\"(X)\", \"(8)\", \"(16LE)\", \"(16BE)\"};\r\n\r\n  if( f&MEM_Blob ){\r\n    int i;\r\n    char c;\r\n    if( f & MEM_Dyn ){\r\n      c = 'z';\r\n      assert( (f & (MEM_Static|MEM_Ephem))==0 );\r\n    }else if( f & MEM_Static ){\r\n      c = 't';\r\n      assert( (f & (MEM_Dyn|MEM_Ephem))==0 );\r\n    }else if( f & MEM_Ephem ){\r\n      c = 'e';\r\n      assert( (f & (MEM_Static|MEM_Dyn))==0 );\r\n    }else{\r\n      c = 's';\r\n    }\r\n\r\n    sqlite3_snprintf(100, zCsr, \"%c\", c);\r\n    zCsr += sqlite3Strlen30(zCsr);\r\n    sqlite3_snprintf(100, zCsr, \"%d[\", pMem->n);\r\n    zCsr += sqlite3Strlen30(zCsr);\r\n    for(i=0; i<16 && i<pMem->n; i++){\r\n      sqlite3_snprintf(100, zCsr, \"%02X\", ((int)pMem->z[i] & 0xFF));\r\n      zCsr += sqlite3Strlen30(zCsr);\r\n    }\r\n    for(i=0; i<16 && i<pMem->n; i++){\r\n      char z = pMem->z[i];\r\n      if( z<32 || z>126 ) *zCsr++ = '.';\r\n      else *zCsr++ = z;\r\n    }\r\n\r\n    sqlite3_snprintf(100, zCsr, \"]%s\", encnames[pMem->enc]);\r\n    zCsr += sqlite3Strlen30(zCsr);\r\n    if( f & MEM_Zero ){\r\n      sqlite3_snprintf(100, zCsr,\"+%dz\",pMem->u.nZero);\r\n      zCsr += sqlite3Strlen30(zCsr);\r\n    }\r\n    *zCsr = '\\0';\r\n  }else if( f & MEM_Str ){\r\n    int j, k;\r\n    zBuf[0] = ' ';\r\n    if( f & MEM_Dyn ){\r\n      zBuf[1] = 'z';\r\n      assert( (f & (MEM_Static|MEM_Ephem))==0 );\r\n    }else if( f & MEM_Static ){\r\n      zBuf[1] = 't';\r\n      assert( (f & (MEM_Dyn|MEM_Ephem))==0 );\r\n    }else if( f & MEM_Ephem ){\r\n      zBuf[1] = 'e';\r\n      assert( (f & (MEM_Static|MEM_Dyn))==0 );\r\n    }else{\r\n      zBuf[1] = 's';\r\n    }\r\n    k = 2;\r\n    sqlite3_snprintf(100, &zBuf[k], \"%d\", pMem->n);\r\n    k += sqlite3Strlen30(&zBuf[k]);\r\n    zBuf[k++] = '[';\r\n    for(j=0; j<15 && j<pMem->n; j++){\r\n      u8 c = pMem->z[j];\r\n      if( c>=0x20 && c<0x7f ){\r\n        zBuf[k++] = c;\r\n      }else{\r\n        zBuf[k++] = '.';\r\n      }\r\n    }\r\n    zBuf[k++] = ']';\r\n    sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]);\r\n    k += sqlite3Strlen30(&zBuf[k]);\r\n    zBuf[k++] = 0;\r\n  }\r\n}\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** Print the value of a register for tracing purposes:\r\n*/\r\nstatic void memTracePrint(FILE *out, Mem *p){\r\n  if( p->flags & MEM_Null ){\r\n    fprintf(out, \" NULL\");\r\n  }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){\r\n    fprintf(out, \" si:%lld\", p->u.i);\r\n  }else if( p->flags & MEM_Int ){\r\n    fprintf(out, \" i:%lld\", p->u.i);\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n  }else if( p->flags & MEM_Real ){\r\n    fprintf(out, \" r:%g\", p->r);\r\n#endif\r\n  }else if( p->flags & MEM_RowSet ){\r\n    fprintf(out, \" (rowset)\");\r\n  }else{\r\n    char zBuf[200];\r\n    sqlite3VdbeMemPrettyPrint(p, zBuf);\r\n    fprintf(out, \" \");\r\n    fprintf(out, \"%s\", zBuf);\r\n  }\r\n}\r\nstatic void registerTrace(FILE *out, int iReg, Mem *p){\r\n  fprintf(out, \"REG[%d] = \", iReg);\r\n  memTracePrint(out, p);\r\n  fprintf(out, \"\\n\");\r\n}\r\n#endif\r\n\r\n#ifdef SQLITE_DEBUG\r\n#  define REGISTER_TRACE(R,M) if(p->trace)registerTrace(p->trace,R,M)\r\n#else\r\n#  define REGISTER_TRACE(R,M)\r\n#endif\r\n\r\n\r\n#ifdef VDBE_PROFILE\r\n\r\n/* \r\n** hwtime.h contains inline assembler code for implementing \r\n** high-performance timing routines.\r\n*/\r\n/************** Include hwtime.h in the middle of vdbe.c *********************/\r\n/************** Begin file hwtime.h ******************************************/\r\n/*\r\n** 2008 May 27\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file contains inline asm code for retrieving \"high-performance\"\r\n** counters for x86 class CPUs.\r\n*/\r\n#ifndef _HWTIME_H_\r\n#define _HWTIME_H_\r\n\r\n/*\r\n** The following routine only works on pentium-class (or newer) processors.\r\n** It uses the RDTSC opcode to read the cycle count value out of the\r\n** processor and returns that value.  This can be used for high-res\r\n** profiling.\r\n*/\r\n#if (defined(__GNUC__) || defined(_MSC_VER)) && \\\r\n      (defined(i386) || defined(__i386__) || defined(_M_IX86))\r\n\r\n  #if defined(__GNUC__)\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n     unsigned int lo, hi;\r\n     __asm__ __volatile__ (\"rdtsc\" : \"=a\" (lo), \"=d\" (hi));\r\n     return (sqlite_uint64)hi << 32 | lo;\r\n  }\r\n\r\n  #elif defined(_MSC_VER)\r\n\r\n  __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){\r\n     __asm {\r\n        rdtsc\r\n        ret       ; return value at EDX:EAX\r\n     }\r\n  }\r\n\r\n  #endif\r\n\r\n#elif (defined(__GNUC__) && defined(__x86_64__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long val;\r\n      __asm__ __volatile__ (\"rdtsc\" : \"=A\" (val));\r\n      return val;\r\n  }\r\n \r\n#elif (defined(__GNUC__) && defined(__ppc__))\r\n\r\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\r\n      unsigned long long retval;\r\n      unsigned long junk;\r\n      __asm__ __volatile__ (\"\\n\\\r\n          1:      mftbu   %1\\n\\\r\n                  mftb    %L0\\n\\\r\n                  mftbu   %0\\n\\\r\n                  cmpw    %0,%1\\n\\\r\n                  bne     1b\"\r\n                  : \"=r\" (retval), \"=r\" (junk));\r\n      return retval;\r\n  }\r\n\r\n#else\r\n\r\n  #error Need implementation of sqlite3Hwtime() for your platform.\r\n\r\n  /*\r\n  ** To compile without implementing sqlite3Hwtime() for your platform,\r\n  ** you can remove the above #error and use the following\r\n  ** stub function.  You will lose timing support for many\r\n  ** of the debugging and testing utilities, but it should at\r\n  ** least compile and run.\r\n  */\r\nSQLITE_PRIVATE   sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }\r\n\r\n#endif\r\n\r\n#endif /* !defined(_HWTIME_H_) */\r\n\r\n/************** End of hwtime.h **********************************************/\r\n/************** Continuing where we left off in vdbe.c ***********************/\r\n\r\n#endif\r\n\r\n/*\r\n** The CHECK_FOR_INTERRUPT macro defined here looks to see if the\r\n** sqlite3_interrupt() routine has been called.  If it has been, then\r\n** processing of the VDBE program is interrupted.\r\n**\r\n** This macro added to every instruction that does a jump in order to\r\n** implement a loop.  This test used to be on every single instruction,\r\n** but that meant we more testing than we needed.  By only testing the\r\n** flag on jump instructions, we get a (small) speed improvement.\r\n*/\r\n#define CHECK_FOR_INTERRUPT \\\r\n   if( db->u1.isInterrupted ) goto abort_due_to_interrupt;\r\n\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** This function is only called from within an assert() expression. It\r\n** checks that the sqlite3.nTransaction variable is correctly set to\r\n** the number of non-transaction savepoints currently in the \r\n** linked list starting at sqlite3.pSavepoint.\r\n** \r\n** Usage:\r\n**\r\n**     assert( checkSavepointCount(db) );\r\n*/\r\nstatic int checkSavepointCount(sqlite3 *db){\r\n  int n = 0;\r\n  Savepoint *p;\r\n  for(p=db->pSavepoint; p; p=p->pNext) n++;\r\n  assert( n==(db->nSavepoint + db->isTransactionSavepoint) );\r\n  return 1;\r\n}\r\n#endif\r\n\r\n/*\r\n** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored\r\n** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored\r\n** in memory obtained from sqlite3DbMalloc).\r\n*/\r\nstatic void importVtabErrMsg(Vdbe *p, sqlite3_vtab *pVtab){\r\n  sqlite3 *db = p->db;\r\n  sqlite3DbFree(db, p->zErrMsg);\r\n  p->zErrMsg = sqlite3DbStrDup(db, pVtab->zErrMsg);\r\n  sqlite3_free(pVtab->zErrMsg);\r\n  pVtab->zErrMsg = 0;\r\n}\r\n\r\n\r\n/*\r\n** Execute as much of a VDBE program as we can then return.\r\n**\r\n** sqlite3VdbeMakeReady() must be called before this routine in order to\r\n** close the program with a final OP_Halt and to set up the callbacks\r\n** and the error message pointer.\r\n**\r\n** Whenever a row or result data is available, this routine will either\r\n** invoke the result callback (if there is one) or return with\r\n** SQLITE_ROW.\r\n**\r\n** If an attempt is made to open a locked database, then this routine\r\n** will either invoke the busy callback (if there is one) or it will\r\n** return SQLITE_BUSY.\r\n**\r\n** If an error occurs, an error message is written to memory obtained\r\n** from sqlite3_malloc() and p->zErrMsg is made to point to that memory.\r\n** The error code is stored in p->rc and this routine returns SQLITE_ERROR.\r\n**\r\n** If the callback ever returns non-zero, then the program exits\r\n** immediately.  There will be no error message but the p->rc field is\r\n** set to SQLITE_ABORT and this routine will return SQLITE_ERROR.\r\n**\r\n** A memory allocation error causes p->rc to be set to SQLITE_NOMEM and this\r\n** routine to return SQLITE_ERROR.\r\n**\r\n** Other fatal errors return SQLITE_ERROR.\r\n**\r\n** After this routine has finished, sqlite3VdbeFinalize() should be\r\n** used to clean up the mess that was left behind.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeExec(\r\n  Vdbe *p                    /* The VDBE */\r\n){\r\n  int pc=0;                  /* The program counter */\r\n  Op *aOp = p->aOp;          /* Copy of p->aOp */\r\n  Op *pOp;                   /* Current operation */\r\n  int rc = SQLITE_OK;        /* Value to return */\r\n  sqlite3 *db = p->db;       /* The database */\r\n  u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */\r\n  u8 encoding = ENC(db);     /* The database encoding */\r\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\r\n  int checkProgress;         /* True if progress callbacks are enabled */\r\n  int nProgressOps = 0;      /* Opcodes executed since progress callback. */\r\n#endif\r\n  Mem *aMem = p->aMem;       /* Copy of p->aMem */\r\n  Mem *pIn1 = 0;             /* 1st input operand */\r\n  Mem *pIn2 = 0;             /* 2nd input operand */\r\n  Mem *pIn3 = 0;             /* 3rd input operand */\r\n  Mem *pOut = 0;             /* Output operand */\r\n  int iCompare = 0;          /* Result of last OP_Compare operation */\r\n  int *aPermute = 0;         /* Permutation of columns for OP_Compare */\r\n  i64 lastRowid = db->lastRowid;  /* Saved value of the last insert ROWID */\r\n#ifdef VDBE_PROFILE\r\n  u64 start;                 /* CPU clock count at start of opcode */\r\n  int origPc;                /* Program counter at start of opcode */\r\n#endif\r\n  /********************************************************************\r\n  ** Automatically generated code\r\n  **\r\n  ** The following union is automatically generated by the\r\n  ** vdbe-compress.tcl script.  The purpose of this union is to\r\n  ** reduce the amount of stack space required by this function.\r\n  ** See comments in the vdbe-compress.tcl script for details.\r\n  */\r\n  union vdbeExecUnion {\r\n    struct OP_Yield_stack_vars {\r\n      int pcDest;\r\n    } aa;\r\n    struct OP_Null_stack_vars {\r\n      int cnt;\r\n    } ab;\r\n    struct OP_Variable_stack_vars {\r\n      Mem *pVar;       /* Value being transferred */\r\n    } ac;\r\n    struct OP_Move_stack_vars {\r\n      char *zMalloc;   /* Holding variable for allocated memory */\r\n      int n;           /* Number of registers left to copy */\r\n      int p1;          /* Register to copy from */\r\n      int p2;          /* Register to copy to */\r\n    } ad;\r\n    struct OP_ResultRow_stack_vars {\r\n      Mem *pMem;\r\n      int i;\r\n    } ae;\r\n    struct OP_Concat_stack_vars {\r\n      i64 nByte;\r\n    } af;\r\n    struct OP_Remainder_stack_vars {\r\n      int flags;      /* Combined MEM_* flags from both inputs */\r\n      i64 iA;         /* Integer value of left operand */\r\n      i64 iB;         /* Integer value of right operand */\r\n      double rA;      /* Real value of left operand */\r\n      double rB;      /* Real value of right operand */\r\n    } ag;\r\n    struct OP_Function_stack_vars {\r\n      int i;\r\n      Mem *pArg;\r\n      sqlite3_context ctx;\r\n      sqlite3_value **apVal;\r\n      int n;\r\n    } ah;\r\n    struct OP_ShiftRight_stack_vars {\r\n      i64 iA;\r\n      u64 uA;\r\n      i64 iB;\r\n      u8 op;\r\n    } ai;\r\n    struct OP_Ge_stack_vars {\r\n      int res;            /* Result of the comparison of pIn1 against pIn3 */\r\n      char affinity;      /* Affinity to use for comparison */\r\n      u16 flags1;         /* Copy of initial value of pIn1->flags */\r\n      u16 flags3;         /* Copy of initial value of pIn3->flags */\r\n    } aj;\r\n    struct OP_Compare_stack_vars {\r\n      int n;\r\n      int i;\r\n      int p1;\r\n      int p2;\r\n      const KeyInfo *pKeyInfo;\r\n      int idx;\r\n      CollSeq *pColl;    /* Collating sequence to use on this term */\r\n      int bRev;          /* True for DESCENDING sort order */\r\n    } ak;\r\n    struct OP_Or_stack_vars {\r\n      int v1;    /* Left operand:  0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */\r\n      int v2;    /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */\r\n    } al;\r\n    struct OP_IfNot_stack_vars {\r\n      int c;\r\n    } am;\r\n    struct OP_Column_stack_vars {\r\n      u32 payloadSize;   /* Number of bytes in the record */\r\n      i64 payloadSize64; /* Number of bytes in the record */\r\n      int p1;            /* P1 value of the opcode */\r\n      int p2;            /* column number to retrieve */\r\n      VdbeCursor *pC;    /* The VDBE cursor */\r\n      char *zRec;        /* Pointer to complete record-data */\r\n      BtCursor *pCrsr;   /* The BTree cursor */\r\n      u32 *aType;        /* aType[i] holds the numeric type of the i-th column */\r\n      u32 *aOffset;      /* aOffset[i] is offset to start of data for i-th column */\r\n      int nField;        /* number of fields in the record */\r\n      int len;           /* The length of the serialized data for the column */\r\n      int i;             /* Loop counter */\r\n      char *zData;       /* Part of the record being decoded */\r\n      Mem *pDest;        /* Where to write the extracted value */\r\n      Mem sMem;          /* For storing the record being decoded */\r\n      u8 *zIdx;          /* Index into header */\r\n      u8 *zEndHdr;       /* Pointer to first byte after the header */\r\n      u32 offset;        /* Offset into the data */\r\n      u32 szField;       /* Number of bytes in the content of a field */\r\n      int szHdr;         /* Size of the header size field at start of record */\r\n      int avail;         /* Number of bytes of available data */\r\n      u32 t;             /* A type code from the record header */\r\n      Mem *pReg;         /* PseudoTable input register */\r\n    } an;\r\n    struct OP_Affinity_stack_vars {\r\n      const char *zAffinity;   /* The affinity to be applied */\r\n      char cAff;               /* A single character of affinity */\r\n    } ao;\r\n    struct OP_MakeRecord_stack_vars {\r\n      u8 *zNewRecord;        /* A buffer to hold the data for the new record */\r\n      Mem *pRec;             /* The new record */\r\n      u64 nData;             /* Number of bytes of data space */\r\n      int nHdr;              /* Number of bytes of header space */\r\n      i64 nByte;             /* Data space required for this record */\r\n      int nZero;             /* Number of zero bytes at the end of the record */\r\n      int nVarint;           /* Number of bytes in a varint */\r\n      u32 serial_type;       /* Type field */\r\n      Mem *pData0;           /* First field to be combined into the record */\r\n      Mem *pLast;            /* Last field of the record */\r\n      int nField;            /* Number of fields in the record */\r\n      char *zAffinity;       /* The affinity string for the record */\r\n      int file_format;       /* File format to use for encoding */\r\n      int i;                 /* Space used in zNewRecord[] */\r\n      int len;               /* Length of a field */\r\n    } ap;\r\n    struct OP_Count_stack_vars {\r\n      i64 nEntry;\r\n      BtCursor *pCrsr;\r\n    } aq;\r\n    struct OP_Savepoint_stack_vars {\r\n      int p1;                         /* Value of P1 operand */\r\n      char *zName;                    /* Name of savepoint */\r\n      int nName;\r\n      Savepoint *pNew;\r\n      Savepoint *pSavepoint;\r\n      Savepoint *pTmp;\r\n      int iSavepoint;\r\n      int ii;\r\n    } ar;\r\n    struct OP_AutoCommit_stack_vars {\r\n      int desiredAutoCommit;\r\n      int iRollback;\r\n      int turnOnAC;\r\n    } as;\r\n    struct OP_Transaction_stack_vars {\r\n      Btree *pBt;\r\n    } at;\r\n    struct OP_ReadCookie_stack_vars {\r\n      int iMeta;\r\n      int iDb;\r\n      int iCookie;\r\n    } au;\r\n    struct OP_SetCookie_stack_vars {\r\n      Db *pDb;\r\n    } av;\r\n    struct OP_VerifyCookie_stack_vars {\r\n      int iMeta;\r\n      int iGen;\r\n      Btree *pBt;\r\n    } aw;\r\n    struct OP_OpenWrite_stack_vars {\r\n      int nField;\r\n      KeyInfo *pKeyInfo;\r\n      int p2;\r\n      int iDb;\r\n      int wrFlag;\r\n      Btree *pX;\r\n      VdbeCursor *pCur;\r\n      Db *pDb;\r\n    } ax;\r\n    struct OP_OpenEphemeral_stack_vars {\r\n      VdbeCursor *pCx;\r\n    } ay;\r\n    struct OP_SorterOpen_stack_vars {\r\n      VdbeCursor *pCx;\r\n    } az;\r\n    struct OP_OpenPseudo_stack_vars {\r\n      VdbeCursor *pCx;\r\n    } ba;\r\n    struct OP_SeekGt_stack_vars {\r\n      int res;\r\n      int oc;\r\n      VdbeCursor *pC;\r\n      UnpackedRecord r;\r\n      int nField;\r\n      i64 iKey;      /* The rowid we are to seek to */\r\n    } bb;\r\n    struct OP_Seek_stack_vars {\r\n      VdbeCursor *pC;\r\n    } bc;\r\n    struct OP_Found_stack_vars {\r\n      int alreadyExists;\r\n      VdbeCursor *pC;\r\n      int res;\r\n      char *pFree;\r\n      UnpackedRecord *pIdxKey;\r\n      UnpackedRecord r;\r\n      char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];\r\n    } bd;\r\n    struct OP_IsUnique_stack_vars {\r\n      u16 ii;\r\n      VdbeCursor *pCx;\r\n      BtCursor *pCrsr;\r\n      u16 nField;\r\n      Mem *aMx;\r\n      UnpackedRecord r;                  /* B-Tree index search key */\r\n      i64 R;                             /* Rowid stored in register P3 */\r\n    } be;\r\n    struct OP_NotExists_stack_vars {\r\n      VdbeCursor *pC;\r\n      BtCursor *pCrsr;\r\n      int res;\r\n      u64 iKey;\r\n    } bf;\r\n    struct OP_NewRowid_stack_vars {\r\n      i64 v;                 /* The new rowid */\r\n      VdbeCursor *pC;        /* Cursor of table to get the new rowid */\r\n      int res;               /* Result of an sqlite3BtreeLast() */\r\n      int cnt;               /* Counter to limit the number of searches */\r\n      Mem *pMem;             /* Register holding largest rowid for AUTOINCREMENT */\r\n      VdbeFrame *pFrame;     /* Root frame of VDBE */\r\n    } bg;\r\n    struct OP_InsertInt_stack_vars {\r\n      Mem *pData;       /* MEM cell holding data for the record to be inserted */\r\n      Mem *pKey;        /* MEM cell holding key  for the record */\r\n      i64 iKey;         /* The integer ROWID or key for the record to be inserted */\r\n      VdbeCursor *pC;   /* Cursor to table into which insert is written */\r\n      int nZero;        /* Number of zero-bytes to append */\r\n      int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */\r\n      const char *zDb;  /* database name - used by the update hook */\r\n      const char *zTbl; /* Table name - used by the opdate hook */\r\n      int op;           /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */\r\n    } bh;\r\n    struct OP_Delete_stack_vars {\r\n      i64 iKey;\r\n      VdbeCursor *pC;\r\n    } bi;\r\n    struct OP_SorterCompare_stack_vars {\r\n      VdbeCursor *pC;\r\n      int res;\r\n    } bj;\r\n    struct OP_SorterData_stack_vars {\r\n      VdbeCursor *pC;\r\n    } bk;\r\n    struct OP_RowData_stack_vars {\r\n      VdbeCursor *pC;\r\n      BtCursor *pCrsr;\r\n      u32 n;\r\n      i64 n64;\r\n    } bl;\r\n    struct OP_Rowid_stack_vars {\r\n      VdbeCursor *pC;\r\n      i64 v;\r\n      sqlite3_vtab *pVtab;\r\n      const sqlite3_module *pModule;\r\n    } bm;\r\n    struct OP_NullRow_stack_vars {\r\n      VdbeCursor *pC;\r\n    } bn;\r\n    struct OP_Last_stack_vars {\r\n      VdbeCursor *pC;\r\n      BtCursor *pCrsr;\r\n      int res;\r\n    } bo;\r\n    struct OP_Rewind_stack_vars {\r\n      VdbeCursor *pC;\r\n      BtCursor *pCrsr;\r\n      int res;\r\n    } bp;\r\n    struct OP_Next_stack_vars {\r\n      VdbeCursor *pC;\r\n      int res;\r\n    } bq;\r\n    struct OP_IdxInsert_stack_vars {\r\n      VdbeCursor *pC;\r\n      BtCursor *pCrsr;\r\n      int nKey;\r\n      const char *zKey;\r\n    } br;\r\n    struct OP_IdxDelete_stack_vars {\r\n      VdbeCursor *pC;\r\n      BtCursor *pCrsr;\r\n      int res;\r\n      UnpackedRecord r;\r\n    } bs;\r\n    struct OP_IdxRowid_stack_vars {\r\n      BtCursor *pCrsr;\r\n      VdbeCursor *pC;\r\n      i64 rowid;\r\n    } bt;\r\n    struct OP_IdxGE_stack_vars {\r\n      VdbeCursor *pC;\r\n      int res;\r\n      UnpackedRecord r;\r\n    } bu;\r\n    struct OP_Destroy_stack_vars {\r\n      int iMoved;\r\n      int iCnt;\r\n      Vdbe *pVdbe;\r\n      int iDb;\r\n    } bv;\r\n    struct OP_Clear_stack_vars {\r\n      int nChange;\r\n    } bw;\r\n    struct OP_CreateTable_stack_vars {\r\n      int pgno;\r\n      int flags;\r\n      Db *pDb;\r\n    } bx;\r\n    struct OP_ParseSchema_stack_vars {\r\n      int iDb;\r\n      const char *zMaster;\r\n      char *zSql;\r\n      InitData initData;\r\n    } by;\r\n    struct OP_IntegrityCk_stack_vars {\r\n      int nRoot;      /* Number of tables to check.  (Number of root pages.) */\r\n      int *aRoot;     /* Array of rootpage numbers for tables to be checked */\r\n      int j;          /* Loop counter */\r\n      int nErr;       /* Number of errors reported */\r\n      char *z;        /* Text of the error report */\r\n      Mem *pnErr;     /* Register keeping track of errors remaining */\r\n    } bz;\r\n    struct OP_RowSetRead_stack_vars {\r\n      i64 val;\r\n    } ca;\r\n    struct OP_RowSetTest_stack_vars {\r\n      int iSet;\r\n      int exists;\r\n    } cb;\r\n    struct OP_Program_stack_vars {\r\n      int nMem;               /* Number of memory registers for sub-program */\r\n      int nByte;              /* Bytes of runtime space required for sub-program */\r\n      Mem *pRt;               /* Register to allocate runtime space */\r\n      Mem *pMem;              /* Used to iterate through memory cells */\r\n      Mem *pEnd;              /* Last memory cell in new array */\r\n      VdbeFrame *pFrame;      /* New vdbe frame to execute in */\r\n      SubProgram *pProgram;   /* Sub-program to execute */\r\n      void *t;                /* Token identifying trigger */\r\n    } cc;\r\n    struct OP_Param_stack_vars {\r\n      VdbeFrame *pFrame;\r\n      Mem *pIn;\r\n    } cd;\r\n    struct OP_MemMax_stack_vars {\r\n      Mem *pIn1;\r\n      VdbeFrame *pFrame;\r\n    } ce;\r\n    struct OP_AggStep_stack_vars {\r\n      int n;\r\n      int i;\r\n      Mem *pMem;\r\n      Mem *pRec;\r\n      sqlite3_context ctx;\r\n      sqlite3_value **apVal;\r\n    } cf;\r\n    struct OP_AggFinal_stack_vars {\r\n      Mem *pMem;\r\n    } cg;\r\n    struct OP_Checkpoint_stack_vars {\r\n      int i;                          /* Loop counter */\r\n      int aRes[3];                    /* Results */\r\n      Mem *pMem;                      /* Write results here */\r\n    } ch;\r\n    struct OP_JournalMode_stack_vars {\r\n      Btree *pBt;                     /* Btree to change journal mode of */\r\n      Pager *pPager;                  /* Pager associated with pBt */\r\n      int eNew;                       /* New journal mode */\r\n      int eOld;                       /* The old journal mode */\r\n      const char *zFilename;          /* Name of database file for pPager */\r\n    } ci;\r\n    struct OP_IncrVacuum_stack_vars {\r\n      Btree *pBt;\r\n    } cj;\r\n    struct OP_VBegin_stack_vars {\r\n      VTable *pVTab;\r\n    } ck;\r\n    struct OP_VOpen_stack_vars {\r\n      VdbeCursor *pCur;\r\n      sqlite3_vtab_cursor *pVtabCursor;\r\n      sqlite3_vtab *pVtab;\r\n      sqlite3_module *pModule;\r\n    } cl;\r\n    struct OP_VFilter_stack_vars {\r\n      int nArg;\r\n      int iQuery;\r\n      const sqlite3_module *pModule;\r\n      Mem *pQuery;\r\n      Mem *pArgc;\r\n      sqlite3_vtab_cursor *pVtabCursor;\r\n      sqlite3_vtab *pVtab;\r\n      VdbeCursor *pCur;\r\n      int res;\r\n      int i;\r\n      Mem **apArg;\r\n    } cm;\r\n    struct OP_VColumn_stack_vars {\r\n      sqlite3_vtab *pVtab;\r\n      const sqlite3_module *pModule;\r\n      Mem *pDest;\r\n      sqlite3_context sContext;\r\n    } cn;\r\n    struct OP_VNext_stack_vars {\r\n      sqlite3_vtab *pVtab;\r\n      const sqlite3_module *pModule;\r\n      int res;\r\n      VdbeCursor *pCur;\r\n    } co;\r\n    struct OP_VRename_stack_vars {\r\n      sqlite3_vtab *pVtab;\r\n      Mem *pName;\r\n    } cp;\r\n    struct OP_VUpdate_stack_vars {\r\n      sqlite3_vtab *pVtab;\r\n      sqlite3_module *pModule;\r\n      int nArg;\r\n      int i;\r\n      sqlite_int64 rowid;\r\n      Mem **apArg;\r\n      Mem *pX;\r\n    } cq;\r\n    struct OP_Trace_stack_vars {\r\n      char *zTrace;\r\n      char *z;\r\n    } cr;\r\n  } u;\r\n  /* End automatically generated code\r\n  ********************************************************************/\r\n\r\n  assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */\r\n  sqlite3VdbeEnter(p);\r\n  if( p->rc==SQLITE_NOMEM ){\r\n    /* This happens if a malloc() inside a call to sqlite3_column_text() or\r\n    ** sqlite3_column_text16() failed.  */\r\n    goto no_mem;\r\n  }\r\n  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );\r\n  p->rc = SQLITE_OK;\r\n  assert( p->explain==0 );\r\n  p->pResultSet = 0;\r\n  db->busyHandler.nBusy = 0;\r\n  CHECK_FOR_INTERRUPT;\r\n  sqlite3VdbeIOTraceSql(p);\r\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\r\n  checkProgress = db->xProgress!=0;\r\n#endif\r\n#ifdef SQLITE_DEBUG\r\n  sqlite3BeginBenignMalloc();\r\n  if( p->pc==0  && (p->db->flags & SQLITE_VdbeListing)!=0 ){\r\n    int i;\r\n    printf(\"VDBE Program Listing:\\n\");\r\n    sqlite3VdbePrintSql(p);\r\n    for(i=0; i<p->nOp; i++){\r\n      sqlite3VdbePrintOp(stdout, i, &aOp[i]);\r\n    }\r\n  }\r\n  sqlite3EndBenignMalloc();\r\n#endif\r\n  for(pc=p->pc; rc==SQLITE_OK; pc++){\r\n    assert( pc>=0 && pc<p->nOp );\r\n    if( db->mallocFailed ) goto no_mem;\r\n#ifdef VDBE_PROFILE\r\n    origPc = pc;\r\n    start = sqlite3Hwtime();\r\n#endif\r\n    pOp = &aOp[pc];\r\n\r\n    /* Only allow tracing if SQLITE_DEBUG is defined.\r\n    */\r\n#ifdef SQLITE_DEBUG\r\n    if( p->trace ){\r\n      if( pc==0 ){\r\n        printf(\"VDBE Execution Trace:\\n\");\r\n        sqlite3VdbePrintSql(p);\r\n      }\r\n      sqlite3VdbePrintOp(p->trace, pc, pOp);\r\n    }\r\n#endif\r\n      \r\n\r\n    /* Check to see if we need to simulate an interrupt.  This only happens\r\n    ** if we have a special test build.\r\n    */\r\n#ifdef SQLITE_TEST\r\n    if( sqlite3_interrupt_count>0 ){\r\n      sqlite3_interrupt_count--;\r\n      if( sqlite3_interrupt_count==0 ){\r\n        sqlite3_interrupt(db);\r\n      }\r\n    }\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\r\n    /* Call the progress callback if it is configured and the required number\r\n    ** of VDBE ops have been executed (either since this invocation of\r\n    ** sqlite3VdbeExec() or since last time the progress callback was called).\r\n    ** If the progress callback returns non-zero, exit the virtual machine with\r\n    ** a return code SQLITE_ABORT.\r\n    */\r\n    if( checkProgress ){\r\n      if( db->nProgressOps==nProgressOps ){\r\n        int prc;\r\n        prc = db->xProgress(db->pProgressArg);\r\n        if( prc!=0 ){\r\n          rc = SQLITE_INTERRUPT;\r\n          goto vdbe_error_halt;\r\n        }\r\n        nProgressOps = 0;\r\n      }\r\n      nProgressOps++;\r\n    }\r\n#endif\r\n\r\n    /* On any opcode with the \"out2-prerelase\" tag, free any\r\n    ** external allocations out of mem[p2] and set mem[p2] to be\r\n    ** an undefined integer.  Opcodes will either fill in the integer\r\n    ** value or convert mem[p2] to a different type.\r\n    */\r\n    assert( pOp->opflags==sqlite3OpcodeProperty[pOp->opcode] );\r\n    if( pOp->opflags & OPFLG_OUT2_PRERELEASE ){\r\n      assert( pOp->p2>0 );\r\n      assert( pOp->p2<=p->nMem );\r\n      pOut = &aMem[pOp->p2];\r\n      memAboutToChange(p, pOut);\r\n      VdbeMemRelease(pOut);\r\n      pOut->flags = MEM_Int;\r\n    }\r\n\r\n    /* Sanity checking on other operands */\r\n#ifdef SQLITE_DEBUG\r\n    if( (pOp->opflags & OPFLG_IN1)!=0 ){\r\n      assert( pOp->p1>0 );\r\n      assert( pOp->p1<=p->nMem );\r\n      assert( memIsValid(&aMem[pOp->p1]) );\r\n      REGISTER_TRACE(pOp->p1, &aMem[pOp->p1]);\r\n    }\r\n    if( (pOp->opflags & OPFLG_IN2)!=0 ){\r\n      assert( pOp->p2>0 );\r\n      assert( pOp->p2<=p->nMem );\r\n      assert( memIsValid(&aMem[pOp->p2]) );\r\n      REGISTER_TRACE(pOp->p2, &aMem[pOp->p2]);\r\n    }\r\n    if( (pOp->opflags & OPFLG_IN3)!=0 ){\r\n      assert( pOp->p3>0 );\r\n      assert( pOp->p3<=p->nMem );\r\n      assert( memIsValid(&aMem[pOp->p3]) );\r\n      REGISTER_TRACE(pOp->p3, &aMem[pOp->p3]);\r\n    }\r\n    if( (pOp->opflags & OPFLG_OUT2)!=0 ){\r\n      assert( pOp->p2>0 );\r\n      assert( pOp->p2<=p->nMem );\r\n      memAboutToChange(p, &aMem[pOp->p2]);\r\n    }\r\n    if( (pOp->opflags & OPFLG_OUT3)!=0 ){\r\n      assert( pOp->p3>0 );\r\n      assert( pOp->p3<=p->nMem );\r\n      memAboutToChange(p, &aMem[pOp->p3]);\r\n    }\r\n#endif\r\n  \r\n    switch( pOp->opcode ){\r\n\r\n/*****************************************************************************\r\n** What follows is a massive switch statement where each case implements a\r\n** separate instruction in the virtual machine.  If we follow the usual\r\n** indentation conventions, each case should be indented by 6 spaces.  But\r\n** that is a lot of wasted space on the left margin.  So the code within\r\n** the switch statement will break with convention and be flush-left. Another\r\n** big comment (similar to this one) will mark the point in the code where\r\n** we transition back to normal indentation.\r\n**\r\n** The formatting of each case is important.  The makefile for SQLite\r\n** generates two C files \"opcodes.h\" and \"opcodes.c\" by scanning this\r\n** file looking for lines that begin with \"case OP_\".  The opcodes.h files\r\n** will be filled with #defines that give unique integer values to each\r\n** opcode and the opcodes.c file is filled with an array of strings where\r\n** each string is the symbolic name for the corresponding opcode.  If the\r\n** case statement is followed by a comment of the form \"/# same as ... #/\"\r\n** that comment is used to determine the particular value of the opcode.\r\n**\r\n** Other keywords in the comment that follows each case are used to\r\n** construct the OPFLG_INITIALIZER value that initializes opcodeProperty[].\r\n** Keywords include: in1, in2, in3, out2_prerelease, out2, out3.  See\r\n** the mkopcodeh.awk script for additional information.\r\n**\r\n** Documentation about VDBE opcodes is generated by scanning this file\r\n** for lines of that contain \"Opcode:\".  That line and all subsequent\r\n** comment lines are used in the generation of the opcode.html documentation\r\n** file.\r\n**\r\n** SUMMARY:\r\n**\r\n**     Formatting is important to scripts that scan this file.\r\n**     Do not deviate from the formatting style currently in use.\r\n**\r\n*****************************************************************************/\r\n\r\n/* Opcode:  Goto * P2 * * *\r\n**\r\n** An unconditional jump to address P2.\r\n** The next instruction executed will be \r\n** the one at index P2 from the beginning of\r\n** the program.\r\n*/\r\ncase OP_Goto: {             /* jump */\r\n  CHECK_FOR_INTERRUPT;\r\n  pc = pOp->p2 - 1;\r\n  break;\r\n}\r\n\r\n/* Opcode:  Gosub P1 P2 * * *\r\n**\r\n** Write the current address onto register P1\r\n** and then jump to address P2.\r\n*/\r\ncase OP_Gosub: {            /* jump */\r\n  assert( pOp->p1>0 && pOp->p1<=p->nMem );\r\n  pIn1 = &aMem[pOp->p1];\r\n  assert( (pIn1->flags & MEM_Dyn)==0 );\r\n  memAboutToChange(p, pIn1);\r\n  pIn1->flags = MEM_Int;\r\n  pIn1->u.i = pc;\r\n  REGISTER_TRACE(pOp->p1, pIn1);\r\n  pc = pOp->p2 - 1;\r\n  break;\r\n}\r\n\r\n/* Opcode:  Return P1 * * * *\r\n**\r\n** Jump to the next instruction after the address in register P1.\r\n*/\r\ncase OP_Return: {           /* in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  assert( pIn1->flags & MEM_Int );\r\n  pc = (int)pIn1->u.i;\r\n  break;\r\n}\r\n\r\n/* Opcode:  Yield P1 * * * *\r\n**\r\n** Swap the program counter with the value in register P1.\r\n*/\r\ncase OP_Yield: {            /* in1 */\r\n#if 0  /* local variables moved into u.aa */\r\n  int pcDest;\r\n#endif /* local variables moved into u.aa */\r\n  pIn1 = &aMem[pOp->p1];\r\n  assert( (pIn1->flags & MEM_Dyn)==0 );\r\n  pIn1->flags = MEM_Int;\r\n  u.aa.pcDest = (int)pIn1->u.i;\r\n  pIn1->u.i = pc;\r\n  REGISTER_TRACE(pOp->p1, pIn1);\r\n  pc = u.aa.pcDest;\r\n  break;\r\n}\r\n\r\n/* Opcode:  HaltIfNull  P1 P2 P3 P4 *\r\n**\r\n** Check the value in register P3.  If it is NULL then Halt using\r\n** parameter P1, P2, and P4 as if this were a Halt instruction.  If the\r\n** value in register P3 is not NULL, then this routine is a no-op.\r\n*/\r\ncase OP_HaltIfNull: {      /* in3 */\r\n  pIn3 = &aMem[pOp->p3];\r\n  if( (pIn3->flags & MEM_Null)==0 ) break;\r\n  /* Fall through into OP_Halt */\r\n}\r\n\r\n/* Opcode:  Halt P1 P2 * P4 *\r\n**\r\n** Exit immediately.  All open cursors, etc are closed\r\n** automatically.\r\n**\r\n** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(),\r\n** or sqlite3_finalize().  For a normal halt, this should be SQLITE_OK (0).\r\n** For errors, it can be some other value.  If P1!=0 then P2 will determine\r\n** whether or not to rollback the current transaction.  Do not rollback\r\n** if P2==OE_Fail. Do the rollback if P2==OE_Rollback.  If P2==OE_Abort,\r\n** then back out all changes that have occurred during this execution of the\r\n** VDBE, but do not rollback the transaction. \r\n**\r\n** If P4 is not null then it is an error message string.\r\n**\r\n** There is an implied \"Halt 0 0 0\" instruction inserted at the very end of\r\n** every program.  So a jump past the last instruction of the program\r\n** is the same as executing Halt.\r\n*/\r\ncase OP_Halt: {\r\n  if( pOp->p1==SQLITE_OK && p->pFrame ){\r\n    /* Halt the sub-program. Return control to the parent frame. */\r\n    VdbeFrame *pFrame = p->pFrame;\r\n    p->pFrame = pFrame->pParent;\r\n    p->nFrame--;\r\n    sqlite3VdbeSetChanges(db, p->nChange);\r\n    pc = sqlite3VdbeFrameRestore(pFrame);\r\n    lastRowid = db->lastRowid;\r\n    if( pOp->p2==OE_Ignore ){\r\n      /* Instruction pc is the OP_Program that invoked the sub-program \r\n      ** currently being halted. If the p2 instruction of this OP_Halt\r\n      ** instruction is set to OE_Ignore, then the sub-program is throwing\r\n      ** an IGNORE exception. In this case jump to the address specified\r\n      ** as the p2 of the calling OP_Program.  */\r\n      pc = p->aOp[pc].p2-1;\r\n    }\r\n    aOp = p->aOp;\r\n    aMem = p->aMem;\r\n    break;\r\n  }\r\n\r\n  p->rc = pOp->p1;\r\n  p->errorAction = (u8)pOp->p2;\r\n  p->pc = pc;\r\n  if( pOp->p4.z ){\r\n    assert( p->rc!=SQLITE_OK );\r\n    sqlite3SetString(&p->zErrMsg, db, \"%s\", pOp->p4.z);\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(pOp->p1, \"abort at %d in [%s]: %s\", pc, p->zSql, pOp->p4.z);\r\n  }else if( p->rc ){\r\n    testcase( sqlite3GlobalConfig.xLog!=0 );\r\n    sqlite3_log(pOp->p1, \"constraint failed at %d in [%s]\", pc, p->zSql);\r\n  }\r\n  rc = sqlite3VdbeHalt(p);\r\n  assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );\r\n  if( rc==SQLITE_BUSY ){\r\n    p->rc = rc = SQLITE_BUSY;\r\n  }else{\r\n    assert( rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT );\r\n    assert( rc==SQLITE_OK || db->nDeferredCons>0 );\r\n    rc = p->rc ? SQLITE_ERROR : SQLITE_DONE;\r\n  }\r\n  goto vdbe_return;\r\n}\r\n\r\n/* Opcode: Integer P1 P2 * * *\r\n**\r\n** The 32-bit integer value P1 is written into register P2.\r\n*/\r\ncase OP_Integer: {         /* out2-prerelease */\r\n  pOut->u.i = pOp->p1;\r\n  break;\r\n}\r\n\r\n/* Opcode: Int64 * P2 * P4 *\r\n**\r\n** P4 is a pointer to a 64-bit integer value.\r\n** Write that value into register P2.\r\n*/\r\ncase OP_Int64: {           /* out2-prerelease */\r\n  assert( pOp->p4.pI64!=0 );\r\n  pOut->u.i = *pOp->p4.pI64;\r\n  break;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n/* Opcode: Real * P2 * P4 *\r\n**\r\n** P4 is a pointer to a 64-bit floating point value.\r\n** Write that value into register P2.\r\n*/\r\ncase OP_Real: {            /* same as TK_FLOAT, out2-prerelease */\r\n  pOut->flags = MEM_Real;\r\n  assert( !sqlite3IsNaN(*pOp->p4.pReal) );\r\n  pOut->r = *pOp->p4.pReal;\r\n  break;\r\n}\r\n#endif\r\n\r\n/* Opcode: String8 * P2 * P4 *\r\n**\r\n** P4 points to a nul terminated UTF-8 string. This opcode is transformed \r\n** into an OP_String before it is executed for the first time.\r\n*/\r\ncase OP_String8: {         /* same as TK_STRING, out2-prerelease */\r\n  assert( pOp->p4.z!=0 );\r\n  pOp->opcode = OP_String;\r\n  pOp->p1 = sqlite3Strlen30(pOp->p4.z);\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n  if( encoding!=SQLITE_UTF8 ){\r\n    rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);\r\n    if( rc==SQLITE_TOOBIG ) goto too_big;\r\n    if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;\r\n    assert( pOut->zMalloc==pOut->z );\r\n    assert( pOut->flags & MEM_Dyn );\r\n    pOut->zMalloc = 0;\r\n    pOut->flags |= MEM_Static;\r\n    pOut->flags &= ~MEM_Dyn;\r\n    if( pOp->p4type==P4_DYNAMIC ){\r\n      sqlite3DbFree(db, pOp->p4.z);\r\n    }\r\n    pOp->p4type = P4_DYNAMIC;\r\n    pOp->p4.z = pOut->z;\r\n    pOp->p1 = pOut->n;\r\n  }\r\n#endif\r\n  if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    goto too_big;\r\n  }\r\n  /* Fall through to the next case, OP_String */\r\n}\r\n  \r\n/* Opcode: String P1 P2 * P4 *\r\n**\r\n** The string value P4 of length P1 (bytes) is stored in register P2.\r\n*/\r\ncase OP_String: {          /* out2-prerelease */\r\n  assert( pOp->p4.z!=0 );\r\n  pOut->flags = MEM_Str|MEM_Static|MEM_Term;\r\n  pOut->z = pOp->p4.z;\r\n  pOut->n = pOp->p1;\r\n  pOut->enc = encoding;\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: Null * P2 P3 * *\r\n**\r\n** Write a NULL into registers P2.  If P3 greater than P2, then also write\r\n** NULL into register P3 and ever register in between P2 and P3.  If P3\r\n** is less than P2 (typically P3 is zero) then only register P2 is\r\n** set to NULL\r\n*/\r\ncase OP_Null: {           /* out2-prerelease */\r\n#if 0  /* local variables moved into u.ab */\r\n  int cnt;\r\n#endif /* local variables moved into u.ab */\r\n  u.ab.cnt = pOp->p3-pOp->p2;\r\n  assert( pOp->p3<=p->nMem );\r\n  pOut->flags = MEM_Null;\r\n  while( u.ab.cnt>0 ){\r\n    pOut++;\r\n    memAboutToChange(p, pOut);\r\n    VdbeMemRelease(pOut);\r\n    pOut->flags = MEM_Null;\r\n    u.ab.cnt--;\r\n  }\r\n  break;\r\n}\r\n\r\n\r\n/* Opcode: Blob P1 P2 * P4\r\n**\r\n** P4 points to a blob of data P1 bytes long.  Store this\r\n** blob in register P2.\r\n*/\r\ncase OP_Blob: {                /* out2-prerelease */\r\n  assert( pOp->p1 <= SQLITE_MAX_LENGTH );\r\n  sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);\r\n  pOut->enc = encoding;\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: Variable P1 P2 * P4 *\r\n**\r\n** Transfer the values of bound parameter P1 into register P2\r\n**\r\n** If the parameter is named, then its name appears in P4 and P3==1.\r\n** The P4 value is used by sqlite3_bind_parameter_name().\r\n*/\r\ncase OP_Variable: {            /* out2-prerelease */\r\n#if 0  /* local variables moved into u.ac */\r\n  Mem *pVar;       /* Value being transferred */\r\n#endif /* local variables moved into u.ac */\r\n\r\n  assert( pOp->p1>0 && pOp->p1<=p->nVar );\r\n  assert( pOp->p4.z==0 || pOp->p4.z==p->azVar[pOp->p1-1] );\r\n  u.ac.pVar = &p->aVar[pOp->p1 - 1];\r\n  if( sqlite3VdbeMemTooBig(u.ac.pVar) ){\r\n    goto too_big;\r\n  }\r\n  sqlite3VdbeMemShallowCopy(pOut, u.ac.pVar, MEM_Static);\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: Move P1 P2 P3 * *\r\n**\r\n** Move the values in register P1..P1+P3-1 over into\r\n** registers P2..P2+P3-1.  Registers P1..P1+P1-1 are\r\n** left holding a NULL.  It is an error for register ranges\r\n** P1..P1+P3-1 and P2..P2+P3-1 to overlap.\r\n*/\r\ncase OP_Move: {\r\n#if 0  /* local variables moved into u.ad */\r\n  char *zMalloc;   /* Holding variable for allocated memory */\r\n  int n;           /* Number of registers left to copy */\r\n  int p1;          /* Register to copy from */\r\n  int p2;          /* Register to copy to */\r\n#endif /* local variables moved into u.ad */\r\n\r\n  u.ad.n = pOp->p3;\r\n  u.ad.p1 = pOp->p1;\r\n  u.ad.p2 = pOp->p2;\r\n  assert( u.ad.n>0 && u.ad.p1>0 && u.ad.p2>0 );\r\n  assert( u.ad.p1+u.ad.n<=u.ad.p2 || u.ad.p2+u.ad.n<=u.ad.p1 );\r\n\r\n  pIn1 = &aMem[u.ad.p1];\r\n  pOut = &aMem[u.ad.p2];\r\n  while( u.ad.n-- ){\r\n    assert( pOut<=&aMem[p->nMem] );\r\n    assert( pIn1<=&aMem[p->nMem] );\r\n    assert( memIsValid(pIn1) );\r\n    memAboutToChange(p, pOut);\r\n    u.ad.zMalloc = pOut->zMalloc;\r\n    pOut->zMalloc = 0;\r\n    sqlite3VdbeMemMove(pOut, pIn1);\r\n#ifdef SQLITE_DEBUG\r\n    if( pOut->pScopyFrom>=&aMem[u.ad.p1] && pOut->pScopyFrom<&aMem[u.ad.p1+pOp->p3] ){\r\n      pOut->pScopyFrom += u.ad.p1 - pOp->p2;\r\n    }\r\n#endif\r\n    pIn1->zMalloc = u.ad.zMalloc;\r\n    REGISTER_TRACE(u.ad.p2++, pOut);\r\n    pIn1++;\r\n    pOut++;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Copy P1 P2 * * *\r\n**\r\n** Make a copy of register P1 into register P2.\r\n**\r\n** This instruction makes a deep copy of the value.  A duplicate\r\n** is made of any string or blob constant.  See also OP_SCopy.\r\n*/\r\ncase OP_Copy: {             /* in1, out2 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  pOut = &aMem[pOp->p2];\r\n  assert( pOut!=pIn1 );\r\n  sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);\r\n  Deephemeralize(pOut);\r\n  REGISTER_TRACE(pOp->p2, pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: SCopy P1 P2 * * *\r\n**\r\n** Make a shallow copy of register P1 into register P2.\r\n**\r\n** This instruction makes a shallow copy of the value.  If the value\r\n** is a string or blob, then the copy is only a pointer to the\r\n** original and hence if the original changes so will the copy.\r\n** Worse, if the original is deallocated, the copy becomes invalid.\r\n** Thus the program must guarantee that the original will not change\r\n** during the lifetime of the copy.  Use OP_Copy to make a complete\r\n** copy.\r\n*/\r\ncase OP_SCopy: {            /* in1, out2 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  pOut = &aMem[pOp->p2];\r\n  assert( pOut!=pIn1 );\r\n  sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);\r\n#ifdef SQLITE_DEBUG\r\n  if( pOut->pScopyFrom==0 ) pOut->pScopyFrom = pIn1;\r\n#endif\r\n  REGISTER_TRACE(pOp->p2, pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: ResultRow P1 P2 * * *\r\n**\r\n** The registers P1 through P1+P2-1 contain a single row of\r\n** results. This opcode causes the sqlite3_step() call to terminate\r\n** with an SQLITE_ROW return code and it sets up the sqlite3_stmt\r\n** structure to provide access to the top P1 values as the result\r\n** row.\r\n*/\r\ncase OP_ResultRow: {\r\n#if 0  /* local variables moved into u.ae */\r\n  Mem *pMem;\r\n  int i;\r\n#endif /* local variables moved into u.ae */\r\n  assert( p->nResColumn==pOp->p2 );\r\n  assert( pOp->p1>0 );\r\n  assert( pOp->p1+pOp->p2<=p->nMem+1 );\r\n\r\n  /* If this statement has violated immediate foreign key constraints, do\r\n  ** not return the number of rows modified. And do not RELEASE the statement\r\n  ** transaction. It needs to be rolled back.  */\r\n  if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){\r\n    assert( db->flags&SQLITE_CountRows );\r\n    assert( p->usesStmtJournal );\r\n    break;\r\n  }\r\n\r\n  /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then\r\n  ** DML statements invoke this opcode to return the number of rows\r\n  ** modified to the user. This is the only way that a VM that\r\n  ** opens a statement transaction may invoke this opcode.\r\n  **\r\n  ** In case this is such a statement, close any statement transaction\r\n  ** opened by this VM before returning control to the user. This is to\r\n  ** ensure that statement-transactions are always nested, not overlapping.\r\n  ** If the open statement-transaction is not closed here, then the user\r\n  ** may step another VM that opens its own statement transaction. This\r\n  ** may lead to overlapping statement transactions.\r\n  **\r\n  ** The statement transaction is never a top-level transaction.  Hence\r\n  ** the RELEASE call below can never fail.\r\n  */\r\n  assert( p->iStatement==0 || db->flags&SQLITE_CountRows );\r\n  rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);\r\n  if( NEVER(rc!=SQLITE_OK) ){\r\n    break;\r\n  }\r\n\r\n  /* Invalidate all ephemeral cursor row caches */\r\n  p->cacheCtr = (p->cacheCtr + 2)|1;\r\n\r\n  /* Make sure the results of the current row are \\000 terminated\r\n  ** and have an assigned type.  The results are de-ephemeralized as\r\n  ** a side effect.\r\n  */\r\n  u.ae.pMem = p->pResultSet = &aMem[pOp->p1];\r\n  for(u.ae.i=0; u.ae.i<pOp->p2; u.ae.i++){\r\n    assert( memIsValid(&u.ae.pMem[u.ae.i]) );\r\n    Deephemeralize(&u.ae.pMem[u.ae.i]);\r\n    assert( (u.ae.pMem[u.ae.i].flags & MEM_Ephem)==0\r\n            || (u.ae.pMem[u.ae.i].flags & (MEM_Str|MEM_Blob))==0 );\r\n    sqlite3VdbeMemNulTerminate(&u.ae.pMem[u.ae.i]);\r\n    sqlite3VdbeMemStoreType(&u.ae.pMem[u.ae.i]);\r\n    REGISTER_TRACE(pOp->p1+u.ae.i, &u.ae.pMem[u.ae.i]);\r\n  }\r\n  if( db->mallocFailed ) goto no_mem;\r\n\r\n  /* Return SQLITE_ROW\r\n  */\r\n  p->pc = pc + 1;\r\n  rc = SQLITE_ROW;\r\n  goto vdbe_return;\r\n}\r\n\r\n/* Opcode: Concat P1 P2 P3 * *\r\n**\r\n** Add the text in register P1 onto the end of the text in\r\n** register P2 and store the result in register P3.\r\n** If either the P1 or P2 text are NULL then store NULL in P3.\r\n**\r\n**   P3 = P2 || P1\r\n**\r\n** It is illegal for P1 and P3 to be the same register. Sometimes,\r\n** if P3 is the same register as P2, the implementation is able\r\n** to avoid a memcpy().\r\n*/\r\ncase OP_Concat: {           /* same as TK_CONCAT, in1, in2, out3 */\r\n#if 0  /* local variables moved into u.af */\r\n  i64 nByte;\r\n#endif /* local variables moved into u.af */\r\n\r\n  pIn1 = &aMem[pOp->p1];\r\n  pIn2 = &aMem[pOp->p2];\r\n  pOut = &aMem[pOp->p3];\r\n  assert( pIn1!=pOut );\r\n  if( (pIn1->flags | pIn2->flags) & MEM_Null ){\r\n    sqlite3VdbeMemSetNull(pOut);\r\n    break;\r\n  }\r\n  if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;\r\n  Stringify(pIn1, encoding);\r\n  Stringify(pIn2, encoding);\r\n  u.af.nByte = pIn1->n + pIn2->n;\r\n  if( u.af.nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    goto too_big;\r\n  }\r\n  MemSetTypeFlag(pOut, MEM_Str);\r\n  if( sqlite3VdbeMemGrow(pOut, (int)u.af.nByte+2, pOut==pIn2) ){\r\n    goto no_mem;\r\n  }\r\n  if( pOut!=pIn2 ){\r\n    memcpy(pOut->z, pIn2->z, pIn2->n);\r\n  }\r\n  memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);\r\n  pOut->z[u.af.nByte] = 0;\r\n  pOut->z[u.af.nByte+1] = 0;\r\n  pOut->flags |= MEM_Term;\r\n  pOut->n = (int)u.af.nByte;\r\n  pOut->enc = encoding;\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: Add P1 P2 P3 * *\r\n**\r\n** Add the value in register P1 to the value in register P2\r\n** and store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\n/* Opcode: Multiply P1 P2 P3 * *\r\n**\r\n**\r\n** Multiply the value in register P1 by the value in register P2\r\n** and store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\n/* Opcode: Subtract P1 P2 P3 * *\r\n**\r\n** Subtract the value in register P1 from the value in register P2\r\n** and store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\n/* Opcode: Divide P1 P2 P3 * *\r\n**\r\n** Divide the value in register P1 by the value in register P2\r\n** and store the result in register P3 (P3=P2/P1). If the value in \r\n** register P1 is zero, then the result is NULL. If either input is \r\n** NULL, the result is NULL.\r\n*/\r\n/* Opcode: Remainder P1 P2 P3 * *\r\n**\r\n** Compute the remainder after integer division of the value in\r\n** register P1 by the value in register P2 and store the result in P3. \r\n** If the value in register P2 is zero the result is NULL.\r\n** If either operand is NULL, the result is NULL.\r\n*/\r\ncase OP_Add:                   /* same as TK_PLUS, in1, in2, out3 */\r\ncase OP_Subtract:              /* same as TK_MINUS, in1, in2, out3 */\r\ncase OP_Multiply:              /* same as TK_STAR, in1, in2, out3 */\r\ncase OP_Divide:                /* same as TK_SLASH, in1, in2, out3 */\r\ncase OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */\r\n#if 0  /* local variables moved into u.ag */\r\n  int flags;      /* Combined MEM_* flags from both inputs */\r\n  i64 iA;         /* Integer value of left operand */\r\n  i64 iB;         /* Integer value of right operand */\r\n  double rA;      /* Real value of left operand */\r\n  double rB;      /* Real value of right operand */\r\n#endif /* local variables moved into u.ag */\r\n\r\n  pIn1 = &aMem[pOp->p1];\r\n  applyNumericAffinity(pIn1);\r\n  pIn2 = &aMem[pOp->p2];\r\n  applyNumericAffinity(pIn2);\r\n  pOut = &aMem[pOp->p3];\r\n  u.ag.flags = pIn1->flags | pIn2->flags;\r\n  if( (u.ag.flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;\r\n  if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){\r\n    u.ag.iA = pIn1->u.i;\r\n    u.ag.iB = pIn2->u.i;\r\n    switch( pOp->opcode ){\r\n      case OP_Add:       if( sqlite3AddInt64(&u.ag.iB,u.ag.iA) ) goto fp_math;  break;\r\n      case OP_Subtract:  if( sqlite3SubInt64(&u.ag.iB,u.ag.iA) ) goto fp_math;  break;\r\n      case OP_Multiply:  if( sqlite3MulInt64(&u.ag.iB,u.ag.iA) ) goto fp_math;  break;\r\n      case OP_Divide: {\r\n        if( u.ag.iA==0 ) goto arithmetic_result_is_null;\r\n        if( u.ag.iA==-1 && u.ag.iB==SMALLEST_INT64 ) goto fp_math;\r\n        u.ag.iB /= u.ag.iA;\r\n        break;\r\n      }\r\n      default: {\r\n        if( u.ag.iA==0 ) goto arithmetic_result_is_null;\r\n        if( u.ag.iA==-1 ) u.ag.iA = 1;\r\n        u.ag.iB %= u.ag.iA;\r\n        break;\r\n      }\r\n    }\r\n    pOut->u.i = u.ag.iB;\r\n    MemSetTypeFlag(pOut, MEM_Int);\r\n  }else{\r\nfp_math:\r\n    u.ag.rA = sqlite3VdbeRealValue(pIn1);\r\n    u.ag.rB = sqlite3VdbeRealValue(pIn2);\r\n    switch( pOp->opcode ){\r\n      case OP_Add:         u.ag.rB += u.ag.rA;       break;\r\n      case OP_Subtract:    u.ag.rB -= u.ag.rA;       break;\r\n      case OP_Multiply:    u.ag.rB *= u.ag.rA;       break;\r\n      case OP_Divide: {\r\n        /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\r\n        if( u.ag.rA==(double)0 ) goto arithmetic_result_is_null;\r\n        u.ag.rB /= u.ag.rA;\r\n        break;\r\n      }\r\n      default: {\r\n        u.ag.iA = (i64)u.ag.rA;\r\n        u.ag.iB = (i64)u.ag.rB;\r\n        if( u.ag.iA==0 ) goto arithmetic_result_is_null;\r\n        if( u.ag.iA==-1 ) u.ag.iA = 1;\r\n        u.ag.rB = (double)(u.ag.iB % u.ag.iA);\r\n        break;\r\n      }\r\n    }\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n    pOut->u.i = u.ag.rB;\r\n    MemSetTypeFlag(pOut, MEM_Int);\r\n#else\r\n    if( sqlite3IsNaN(u.ag.rB) ){\r\n      goto arithmetic_result_is_null;\r\n    }\r\n    pOut->r = u.ag.rB;\r\n    MemSetTypeFlag(pOut, MEM_Real);\r\n    if( (u.ag.flags & MEM_Real)==0 ){\r\n      sqlite3VdbeIntegerAffinity(pOut);\r\n    }\r\n#endif\r\n  }\r\n  break;\r\n\r\narithmetic_result_is_null:\r\n  sqlite3VdbeMemSetNull(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: CollSeq P1 * * P4\r\n**\r\n** P4 is a pointer to a CollSeq struct. If the next call to a user function\r\n** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will\r\n** be returned. This is used by the built-in min(), max() and nullif()\r\n** functions.\r\n**\r\n** If P1 is not zero, then it is a register that a subsequent min() or\r\n** max() aggregate will set to 1 if the current row is not the minimum or\r\n** maximum.  The P1 register is initialized to 0 by this instruction.\r\n**\r\n** The interface used by the implementation of the aforementioned functions\r\n** to retrieve the collation sequence set by this opcode is not available\r\n** publicly, only to user functions defined in func.c.\r\n*/\r\ncase OP_CollSeq: {\r\n  assert( pOp->p4type==P4_COLLSEQ );\r\n  if( pOp->p1 ){\r\n    sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0);\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Function P1 P2 P3 P4 P5\r\n**\r\n** Invoke a user function (P4 is a pointer to a Function structure that\r\n** defines the function) with P5 arguments taken from register P2 and\r\n** successors.  The result of the function is stored in register P3.\r\n** Register P3 must not be one of the function inputs.\r\n**\r\n** P1 is a 32-bit bitmask indicating whether or not each argument to the \r\n** function was determined to be constant at compile time. If the first\r\n** argument was constant then bit 0 of P1 is set. This is used to determine\r\n** whether meta data associated with a user function argument using the\r\n** sqlite3_set_auxdata() API may be safely retained until the next\r\n** invocation of this opcode.\r\n**\r\n** See also: AggStep and AggFinal\r\n*/\r\ncase OP_Function: {\r\n#if 0  /* local variables moved into u.ah */\r\n  int i;\r\n  Mem *pArg;\r\n  sqlite3_context ctx;\r\n  sqlite3_value **apVal;\r\n  int n;\r\n#endif /* local variables moved into u.ah */\r\n\r\n  u.ah.n = pOp->p5;\r\n  u.ah.apVal = p->apArg;\r\n  assert( u.ah.apVal || u.ah.n==0 );\r\n  assert( pOp->p3>0 && pOp->p3<=p->nMem );\r\n  pOut = &aMem[pOp->p3];\r\n  memAboutToChange(p, pOut);\r\n\r\n  assert( u.ah.n==0 || (pOp->p2>0 && pOp->p2+u.ah.n<=p->nMem+1) );\r\n  assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+u.ah.n );\r\n  u.ah.pArg = &aMem[pOp->p2];\r\n  for(u.ah.i=0; u.ah.i<u.ah.n; u.ah.i++, u.ah.pArg++){\r\n    assert( memIsValid(u.ah.pArg) );\r\n    u.ah.apVal[u.ah.i] = u.ah.pArg;\r\n    Deephemeralize(u.ah.pArg);\r\n    sqlite3VdbeMemStoreType(u.ah.pArg);\r\n    REGISTER_TRACE(pOp->p2+u.ah.i, u.ah.pArg);\r\n  }\r\n\r\n  assert( pOp->p4type==P4_FUNCDEF || pOp->p4type==P4_VDBEFUNC );\r\n  if( pOp->p4type==P4_FUNCDEF ){\r\n    u.ah.ctx.pFunc = pOp->p4.pFunc;\r\n    u.ah.ctx.pVdbeFunc = 0;\r\n  }else{\r\n    u.ah.ctx.pVdbeFunc = (VdbeFunc*)pOp->p4.pVdbeFunc;\r\n    u.ah.ctx.pFunc = u.ah.ctx.pVdbeFunc->pFunc;\r\n  }\r\n\r\n  u.ah.ctx.s.flags = MEM_Null;\r\n  u.ah.ctx.s.db = db;\r\n  u.ah.ctx.s.xDel = 0;\r\n  u.ah.ctx.s.zMalloc = 0;\r\n\r\n  /* The output cell may already have a buffer allocated. Move\r\n  ** the pointer to u.ah.ctx.s so in case the user-function can use\r\n  ** the already allocated buffer instead of allocating a new one.\r\n  */\r\n  sqlite3VdbeMemMove(&u.ah.ctx.s, pOut);\r\n  MemSetTypeFlag(&u.ah.ctx.s, MEM_Null);\r\n\r\n  u.ah.ctx.isError = 0;\r\n  if( u.ah.ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){\r\n    assert( pOp>aOp );\r\n    assert( pOp[-1].p4type==P4_COLLSEQ );\r\n    assert( pOp[-1].opcode==OP_CollSeq );\r\n    u.ah.ctx.pColl = pOp[-1].p4.pColl;\r\n  }\r\n  db->lastRowid = lastRowid;\r\n  (*u.ah.ctx.pFunc->xFunc)(&u.ah.ctx, u.ah.n, u.ah.apVal); /* IMP: R-24505-23230 */\r\n  lastRowid = db->lastRowid;\r\n\r\n  /* If any auxiliary data functions have been called by this user function,\r\n  ** immediately call the destructor for any non-static values.\r\n  */\r\n  if( u.ah.ctx.pVdbeFunc ){\r\n    sqlite3VdbeDeleteAuxData(u.ah.ctx.pVdbeFunc, pOp->p1);\r\n    pOp->p4.pVdbeFunc = u.ah.ctx.pVdbeFunc;\r\n    pOp->p4type = P4_VDBEFUNC;\r\n  }\r\n\r\n  if( db->mallocFailed ){\r\n    /* Even though a malloc() has failed, the implementation of the\r\n    ** user function may have called an sqlite3_result_XXX() function\r\n    ** to return a value. The following call releases any resources\r\n    ** associated with such a value.\r\n    */\r\n    sqlite3VdbeMemRelease(&u.ah.ctx.s);\r\n    goto no_mem;\r\n  }\r\n\r\n  /* If the function returned an error, throw an exception */\r\n  if( u.ah.ctx.isError ){\r\n    sqlite3SetString(&p->zErrMsg, db, \"%s\", sqlite3_value_text(&u.ah.ctx.s));\r\n    rc = u.ah.ctx.isError;\r\n  }\r\n\r\n  /* Copy the result of the function into register P3 */\r\n  sqlite3VdbeChangeEncoding(&u.ah.ctx.s, encoding);\r\n  sqlite3VdbeMemMove(pOut, &u.ah.ctx.s);\r\n  if( sqlite3VdbeMemTooBig(pOut) ){\r\n    goto too_big;\r\n  }\r\n\r\n#if 0\r\n  /* The app-defined function has done something that as caused this\r\n  ** statement to expire.  (Perhaps the function called sqlite3_exec()\r\n  ** with a CREATE TABLE statement.)\r\n  */\r\n  if( p->expired ) rc = SQLITE_ABORT;\r\n#endif\r\n\r\n  REGISTER_TRACE(pOp->p3, pOut);\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: BitAnd P1 P2 P3 * *\r\n**\r\n** Take the bit-wise AND of the values in register P1 and P2 and\r\n** store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\n/* Opcode: BitOr P1 P2 P3 * *\r\n**\r\n** Take the bit-wise OR of the values in register P1 and P2 and\r\n** store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\n/* Opcode: ShiftLeft P1 P2 P3 * *\r\n**\r\n** Shift the integer value in register P2 to the left by the\r\n** number of bits specified by the integer in register P1.\r\n** Store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\n/* Opcode: ShiftRight P1 P2 P3 * *\r\n**\r\n** Shift the integer value in register P2 to the right by the\r\n** number of bits specified by the integer in register P1.\r\n** Store the result in register P3.\r\n** If either input is NULL, the result is NULL.\r\n*/\r\ncase OP_BitAnd:                 /* same as TK_BITAND, in1, in2, out3 */\r\ncase OP_BitOr:                  /* same as TK_BITOR, in1, in2, out3 */\r\ncase OP_ShiftLeft:              /* same as TK_LSHIFT, in1, in2, out3 */\r\ncase OP_ShiftRight: {           /* same as TK_RSHIFT, in1, in2, out3 */\r\n#if 0  /* local variables moved into u.ai */\r\n  i64 iA;\r\n  u64 uA;\r\n  i64 iB;\r\n  u8 op;\r\n#endif /* local variables moved into u.ai */\r\n\r\n  pIn1 = &aMem[pOp->p1];\r\n  pIn2 = &aMem[pOp->p2];\r\n  pOut = &aMem[pOp->p3];\r\n  if( (pIn1->flags | pIn2->flags) & MEM_Null ){\r\n    sqlite3VdbeMemSetNull(pOut);\r\n    break;\r\n  }\r\n  u.ai.iA = sqlite3VdbeIntValue(pIn2);\r\n  u.ai.iB = sqlite3VdbeIntValue(pIn1);\r\n  u.ai.op = pOp->opcode;\r\n  if( u.ai.op==OP_BitAnd ){\r\n    u.ai.iA &= u.ai.iB;\r\n  }else if( u.ai.op==OP_BitOr ){\r\n    u.ai.iA |= u.ai.iB;\r\n  }else if( u.ai.iB!=0 ){\r\n    assert( u.ai.op==OP_ShiftRight || u.ai.op==OP_ShiftLeft );\r\n\r\n    /* If shifting by a negative amount, shift in the other direction */\r\n    if( u.ai.iB<0 ){\r\n      assert( OP_ShiftRight==OP_ShiftLeft+1 );\r\n      u.ai.op = 2*OP_ShiftLeft + 1 - u.ai.op;\r\n      u.ai.iB = u.ai.iB>(-64) ? -u.ai.iB : 64;\r\n    }\r\n\r\n    if( u.ai.iB>=64 ){\r\n      u.ai.iA = (u.ai.iA>=0 || u.ai.op==OP_ShiftLeft) ? 0 : -1;\r\n    }else{\r\n      memcpy(&u.ai.uA, &u.ai.iA, sizeof(u.ai.uA));\r\n      if( u.ai.op==OP_ShiftLeft ){\r\n        u.ai.uA <<= u.ai.iB;\r\n      }else{\r\n        u.ai.uA >>= u.ai.iB;\r\n        /* Sign-extend on a right shift of a negative number */\r\n        if( u.ai.iA<0 ) u.ai.uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-u.ai.iB);\r\n      }\r\n      memcpy(&u.ai.iA, &u.ai.uA, sizeof(u.ai.iA));\r\n    }\r\n  }\r\n  pOut->u.i = u.ai.iA;\r\n  MemSetTypeFlag(pOut, MEM_Int);\r\n  break;\r\n}\r\n\r\n/* Opcode: AddImm  P1 P2 * * *\r\n** \r\n** Add the constant P2 to the value in register P1.\r\n** The result is always an integer.\r\n**\r\n** To force any register to be an integer, just add 0.\r\n*/\r\ncase OP_AddImm: {            /* in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  memAboutToChange(p, pIn1);\r\n  sqlite3VdbeMemIntegerify(pIn1);\r\n  pIn1->u.i += pOp->p2;\r\n  break;\r\n}\r\n\r\n/* Opcode: MustBeInt P1 P2 * * *\r\n** \r\n** Force the value in register P1 to be an integer.  If the value\r\n** in P1 is not an integer and cannot be converted into an integer\r\n** without data loss, then jump immediately to P2, or if P2==0\r\n** raise an SQLITE_MISMATCH exception.\r\n*/\r\ncase OP_MustBeInt: {            /* jump, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);\r\n  if( (pIn1->flags & MEM_Int)==0 ){\r\n    if( pOp->p2==0 ){\r\n      rc = SQLITE_MISMATCH;\r\n      goto abort_due_to_error;\r\n    }else{\r\n      pc = pOp->p2 - 1;\r\n    }\r\n  }else{\r\n    MemSetTypeFlag(pIn1, MEM_Int);\r\n  }\r\n  break;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n/* Opcode: RealAffinity P1 * * * *\r\n**\r\n** If register P1 holds an integer convert it to a real value.\r\n**\r\n** This opcode is used when extracting information from a column that\r\n** has REAL affinity.  Such column values may still be stored as\r\n** integers, for space efficiency, but after extraction we want them\r\n** to have only a real value.\r\n*/\r\ncase OP_RealAffinity: {                  /* in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( pIn1->flags & MEM_Int ){\r\n    sqlite3VdbeMemRealify(pIn1);\r\n  }\r\n  break;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_CAST\r\n/* Opcode: ToText P1 * * * *\r\n**\r\n** Force the value in register P1 to be text.\r\n** If the value is numeric, convert it to a string using the\r\n** equivalent of printf().  Blob values are unchanged and\r\n** are afterwards simply interpreted as text.\r\n**\r\n** A NULL value is not changed by this routine.  It remains NULL.\r\n*/\r\ncase OP_ToText: {                  /* same as TK_TO_TEXT, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  memAboutToChange(p, pIn1);\r\n  if( pIn1->flags & MEM_Null ) break;\r\n  assert( MEM_Str==(MEM_Blob>>3) );\r\n  pIn1->flags |= (pIn1->flags&MEM_Blob)>>3;\r\n  applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding);\r\n  rc = ExpandBlob(pIn1);\r\n  assert( pIn1->flags & MEM_Str || db->mallocFailed );\r\n  pIn1->flags &= ~(MEM_Int|MEM_Real|MEM_Blob|MEM_Zero);\r\n  UPDATE_MAX_BLOBSIZE(pIn1);\r\n  break;\r\n}\r\n\r\n/* Opcode: ToBlob P1 * * * *\r\n**\r\n** Force the value in register P1 to be a BLOB.\r\n** If the value is numeric, convert it to a string first.\r\n** Strings are simply reinterpreted as blobs with no change\r\n** to the underlying data.\r\n**\r\n** A NULL value is not changed by this routine.  It remains NULL.\r\n*/\r\ncase OP_ToBlob: {                  /* same as TK_TO_BLOB, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( pIn1->flags & MEM_Null ) break;\r\n  if( (pIn1->flags & MEM_Blob)==0 ){\r\n    applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding);\r\n    assert( pIn1->flags & MEM_Str || db->mallocFailed );\r\n    MemSetTypeFlag(pIn1, MEM_Blob);\r\n  }else{\r\n    pIn1->flags &= ~(MEM_TypeMask&~MEM_Blob);\r\n  }\r\n  UPDATE_MAX_BLOBSIZE(pIn1);\r\n  break;\r\n}\r\n\r\n/* Opcode: ToNumeric P1 * * * *\r\n**\r\n** Force the value in register P1 to be numeric (either an\r\n** integer or a floating-point number.)\r\n** If the value is text or blob, try to convert it to an using the\r\n** equivalent of atoi() or atof() and store 0 if no such conversion \r\n** is possible.\r\n**\r\n** A NULL value is not changed by this routine.  It remains NULL.\r\n*/\r\ncase OP_ToNumeric: {                  /* same as TK_TO_NUMERIC, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  sqlite3VdbeMemNumerify(pIn1);\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_CAST */\r\n\r\n/* Opcode: ToInt P1 * * * *\r\n**\r\n** Force the value in register P1 to be an integer.  If\r\n** The value is currently a real number, drop its fractional part.\r\n** If the value is text or blob, try to convert it to an integer using the\r\n** equivalent of atoi() and store 0 if no such conversion is possible.\r\n**\r\n** A NULL value is not changed by this routine.  It remains NULL.\r\n*/\r\ncase OP_ToInt: {                  /* same as TK_TO_INT, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( (pIn1->flags & MEM_Null)==0 ){\r\n    sqlite3VdbeMemIntegerify(pIn1);\r\n  }\r\n  break;\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT)\r\n/* Opcode: ToReal P1 * * * *\r\n**\r\n** Force the value in register P1 to be a floating point number.\r\n** If The value is currently an integer, convert it.\r\n** If the value is text or blob, try to convert it to an integer using the\r\n** equivalent of atoi() and store 0.0 if no such conversion is possible.\r\n**\r\n** A NULL value is not changed by this routine.  It remains NULL.\r\n*/\r\ncase OP_ToReal: {                  /* same as TK_TO_REAL, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  memAboutToChange(p, pIn1);\r\n  if( (pIn1->flags & MEM_Null)==0 ){\r\n    sqlite3VdbeMemRealify(pIn1);\r\n  }\r\n  break;\r\n}\r\n#endif /* !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT) */\r\n\r\n/* Opcode: Lt P1 P2 P3 P4 P5\r\n**\r\n** Compare the values in register P1 and P3.  If reg(P3)<reg(P1) then\r\n** jump to address P2.  \r\n**\r\n** If the SQLITE_JUMPIFNULL bit of P5 is set and either reg(P1) or\r\n** reg(P3) is NULL then take the jump.  If the SQLITE_JUMPIFNULL \r\n** bit is clear then fall through if either operand is NULL.\r\n**\r\n** The SQLITE_AFF_MASK portion of P5 must be an affinity character -\r\n** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made \r\n** to coerce both inputs according to this affinity before the\r\n** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric\r\n** affinity is used. Note that the affinity conversions are stored\r\n** back into the input registers P1 and P3.  So this opcode can cause\r\n** persistent changes to registers P1 and P3.\r\n**\r\n** Once any conversions have taken place, and neither value is NULL, \r\n** the values are compared. If both values are blobs then memcmp() is\r\n** used to determine the results of the comparison.  If both values\r\n** are text, then the appropriate collating function specified in\r\n** P4 is  used to do the comparison.  If P4 is not specified then\r\n** memcmp() is used to compare text string.  If both values are\r\n** numeric, then a numeric comparison is used. If the two values\r\n** are of different types, then numbers are considered less than\r\n** strings and strings are considered less than blobs.\r\n**\r\n** If the SQLITE_STOREP2 bit of P5 is set, then do not jump.  Instead,\r\n** store a boolean result (either 0, or 1, or NULL) in register P2.\r\n*/\r\n/* Opcode: Ne P1 P2 P3 P4 P5\r\n**\r\n** This works just like the Lt opcode except that the jump is taken if\r\n** the operands in registers P1 and P3 are not equal.  See the Lt opcode for\r\n** additional information.\r\n**\r\n** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either\r\n** true or false and is never NULL.  If both operands are NULL then the result\r\n** of comparison is false.  If either operand is NULL then the result is true.\r\n** If neither operand is NULL the result is the same as it would be if\r\n** the SQLITE_NULLEQ flag were omitted from P5.\r\n*/\r\n/* Opcode: Eq P1 P2 P3 P4 P5\r\n**\r\n** This works just like the Lt opcode except that the jump is taken if\r\n** the operands in registers P1 and P3 are equal.\r\n** See the Lt opcode for additional information.\r\n**\r\n** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either\r\n** true or false and is never NULL.  If both operands are NULL then the result\r\n** of comparison is true.  If either operand is NULL then the result is false.\r\n** If neither operand is NULL the result is the same as it would be if\r\n** the SQLITE_NULLEQ flag were omitted from P5.\r\n*/\r\n/* Opcode: Le P1 P2 P3 P4 P5\r\n**\r\n** This works just like the Lt opcode except that the jump is taken if\r\n** the content of register P3 is less than or equal to the content of\r\n** register P1.  See the Lt opcode for additional information.\r\n*/\r\n/* Opcode: Gt P1 P2 P3 P4 P5\r\n**\r\n** This works just like the Lt opcode except that the jump is taken if\r\n** the content of register P3 is greater than the content of\r\n** register P1.  See the Lt opcode for additional information.\r\n*/\r\n/* Opcode: Ge P1 P2 P3 P4 P5\r\n**\r\n** This works just like the Lt opcode except that the jump is taken if\r\n** the content of register P3 is greater than or equal to the content of\r\n** register P1.  See the Lt opcode for additional information.\r\n*/\r\ncase OP_Eq:               /* same as TK_EQ, jump, in1, in3 */\r\ncase OP_Ne:               /* same as TK_NE, jump, in1, in3 */\r\ncase OP_Lt:               /* same as TK_LT, jump, in1, in3 */\r\ncase OP_Le:               /* same as TK_LE, jump, in1, in3 */\r\ncase OP_Gt:               /* same as TK_GT, jump, in1, in3 */\r\ncase OP_Ge: {             /* same as TK_GE, jump, in1, in3 */\r\n#if 0  /* local variables moved into u.aj */\r\n  int res;            /* Result of the comparison of pIn1 against pIn3 */\r\n  char affinity;      /* Affinity to use for comparison */\r\n  u16 flags1;         /* Copy of initial value of pIn1->flags */\r\n  u16 flags3;         /* Copy of initial value of pIn3->flags */\r\n#endif /* local variables moved into u.aj */\r\n\r\n  pIn1 = &aMem[pOp->p1];\r\n  pIn3 = &aMem[pOp->p3];\r\n  u.aj.flags1 = pIn1->flags;\r\n  u.aj.flags3 = pIn3->flags;\r\n  if( (u.aj.flags1 | u.aj.flags3)&MEM_Null ){\r\n    /* One or both operands are NULL */\r\n    if( pOp->p5 & SQLITE_NULLEQ ){\r\n      /* If SQLITE_NULLEQ is set (which will only happen if the operator is\r\n      ** OP_Eq or OP_Ne) then take the jump or not depending on whether\r\n      ** or not both operands are null.\r\n      */\r\n      assert( pOp->opcode==OP_Eq || pOp->opcode==OP_Ne );\r\n      u.aj.res = (u.aj.flags1 & u.aj.flags3 & MEM_Null)==0;\r\n    }else{\r\n      /* SQLITE_NULLEQ is clear and at least one operand is NULL,\r\n      ** then the result is always NULL.\r\n      ** The jump is taken if the SQLITE_JUMPIFNULL bit is set.\r\n      */\r\n      if( pOp->p5 & SQLITE_STOREP2 ){\r\n        pOut = &aMem[pOp->p2];\r\n        MemSetTypeFlag(pOut, MEM_Null);\r\n        REGISTER_TRACE(pOp->p2, pOut);\r\n      }else if( pOp->p5 & SQLITE_JUMPIFNULL ){\r\n        pc = pOp->p2-1;\r\n      }\r\n      break;\r\n    }\r\n  }else{\r\n    /* Neither operand is NULL.  Do a comparison. */\r\n    u.aj.affinity = pOp->p5 & SQLITE_AFF_MASK;\r\n    if( u.aj.affinity ){\r\n      applyAffinity(pIn1, u.aj.affinity, encoding);\r\n      applyAffinity(pIn3, u.aj.affinity, encoding);\r\n      if( db->mallocFailed ) goto no_mem;\r\n    }\r\n\r\n    assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );\r\n    ExpandBlob(pIn1);\r\n    ExpandBlob(pIn3);\r\n    u.aj.res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);\r\n  }\r\n  switch( pOp->opcode ){\r\n    case OP_Eq:    u.aj.res = u.aj.res==0;     break;\r\n    case OP_Ne:    u.aj.res = u.aj.res!=0;     break;\r\n    case OP_Lt:    u.aj.res = u.aj.res<0;      break;\r\n    case OP_Le:    u.aj.res = u.aj.res<=0;     break;\r\n    case OP_Gt:    u.aj.res = u.aj.res>0;      break;\r\n    default:       u.aj.res = u.aj.res>=0;     break;\r\n  }\r\n\r\n  if( pOp->p5 & SQLITE_STOREP2 ){\r\n    pOut = &aMem[pOp->p2];\r\n    memAboutToChange(p, pOut);\r\n    MemSetTypeFlag(pOut, MEM_Int);\r\n    pOut->u.i = u.aj.res;\r\n    REGISTER_TRACE(pOp->p2, pOut);\r\n  }else if( u.aj.res ){\r\n    pc = pOp->p2-1;\r\n  }\r\n\r\n  /* Undo any changes made by applyAffinity() to the input registers. */\r\n  pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (u.aj.flags1&MEM_TypeMask);\r\n  pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (u.aj.flags3&MEM_TypeMask);\r\n  break;\r\n}\r\n\r\n/* Opcode: Permutation * * * P4 *\r\n**\r\n** Set the permutation used by the OP_Compare operator to be the array\r\n** of integers in P4.\r\n**\r\n** The permutation is only valid until the next OP_Permutation, OP_Compare,\r\n** OP_Halt, or OP_ResultRow.  Typically the OP_Permutation should occur\r\n** immediately prior to the OP_Compare.\r\n*/\r\ncase OP_Permutation: {\r\n  assert( pOp->p4type==P4_INTARRAY );\r\n  assert( pOp->p4.ai );\r\n  aPermute = pOp->p4.ai;\r\n  break;\r\n}\r\n\r\n/* Opcode: Compare P1 P2 P3 P4 *\r\n**\r\n** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this\r\n** vector \"A\") and in reg(P2)..reg(P2+P3-1) (\"B\").  Save the result of\r\n** the comparison for use by the next OP_Jump instruct.\r\n**\r\n** P4 is a KeyInfo structure that defines collating sequences and sort\r\n** orders for the comparison.  The permutation applies to registers\r\n** only.  The KeyInfo elements are used sequentially.\r\n**\r\n** The comparison is a sort comparison, so NULLs compare equal,\r\n** NULLs are less than numbers, numbers are less than strings,\r\n** and strings are less than blobs.\r\n*/\r\ncase OP_Compare: {\r\n#if 0  /* local variables moved into u.ak */\r\n  int n;\r\n  int i;\r\n  int p1;\r\n  int p2;\r\n  const KeyInfo *pKeyInfo;\r\n  int idx;\r\n  CollSeq *pColl;    /* Collating sequence to use on this term */\r\n  int bRev;          /* True for DESCENDING sort order */\r\n#endif /* local variables moved into u.ak */\r\n\r\n  u.ak.n = pOp->p3;\r\n  u.ak.pKeyInfo = pOp->p4.pKeyInfo;\r\n  assert( u.ak.n>0 );\r\n  assert( u.ak.pKeyInfo!=0 );\r\n  u.ak.p1 = pOp->p1;\r\n  u.ak.p2 = pOp->p2;\r\n#if SQLITE_DEBUG\r\n  if( aPermute ){\r\n    int k, mx = 0;\r\n    for(k=0; k<u.ak.n; k++) if( aPermute[k]>mx ) mx = aPermute[k];\r\n    assert( u.ak.p1>0 && u.ak.p1+mx<=p->nMem+1 );\r\n    assert( u.ak.p2>0 && u.ak.p2+mx<=p->nMem+1 );\r\n  }else{\r\n    assert( u.ak.p1>0 && u.ak.p1+u.ak.n<=p->nMem+1 );\r\n    assert( u.ak.p2>0 && u.ak.p2+u.ak.n<=p->nMem+1 );\r\n  }\r\n#endif /* SQLITE_DEBUG */\r\n  for(u.ak.i=0; u.ak.i<u.ak.n; u.ak.i++){\r\n    u.ak.idx = aPermute ? aPermute[u.ak.i] : u.ak.i;\r\n    assert( memIsValid(&aMem[u.ak.p1+u.ak.idx]) );\r\n    assert( memIsValid(&aMem[u.ak.p2+u.ak.idx]) );\r\n    REGISTER_TRACE(u.ak.p1+u.ak.idx, &aMem[u.ak.p1+u.ak.idx]);\r\n    REGISTER_TRACE(u.ak.p2+u.ak.idx, &aMem[u.ak.p2+u.ak.idx]);\r\n    assert( u.ak.i<u.ak.pKeyInfo->nField );\r\n    u.ak.pColl = u.ak.pKeyInfo->aColl[u.ak.i];\r\n    u.ak.bRev = u.ak.pKeyInfo->aSortOrder[u.ak.i];\r\n    iCompare = sqlite3MemCompare(&aMem[u.ak.p1+u.ak.idx], &aMem[u.ak.p2+u.ak.idx], u.ak.pColl);\r\n    if( iCompare ){\r\n      if( u.ak.bRev ) iCompare = -iCompare;\r\n      break;\r\n    }\r\n  }\r\n  aPermute = 0;\r\n  break;\r\n}\r\n\r\n/* Opcode: Jump P1 P2 P3 * *\r\n**\r\n** Jump to the instruction at address P1, P2, or P3 depending on whether\r\n** in the most recent OP_Compare instruction the P1 vector was less than\r\n** equal to, or greater than the P2 vector, respectively.\r\n*/\r\ncase OP_Jump: {             /* jump */\r\n  if( iCompare<0 ){\r\n    pc = pOp->p1 - 1;\r\n  }else if( iCompare==0 ){\r\n    pc = pOp->p2 - 1;\r\n  }else{\r\n    pc = pOp->p3 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: And P1 P2 P3 * *\r\n**\r\n** Take the logical AND of the values in registers P1 and P2 and\r\n** write the result into register P3.\r\n**\r\n** If either P1 or P2 is 0 (false) then the result is 0 even if\r\n** the other input is NULL.  A NULL and true or two NULLs give\r\n** a NULL output.\r\n*/\r\n/* Opcode: Or P1 P2 P3 * *\r\n**\r\n** Take the logical OR of the values in register P1 and P2 and\r\n** store the answer in register P3.\r\n**\r\n** If either P1 or P2 is nonzero (true) then the result is 1 (true)\r\n** even if the other input is NULL.  A NULL and false or two NULLs\r\n** give a NULL output.\r\n*/\r\ncase OP_And:              /* same as TK_AND, in1, in2, out3 */\r\ncase OP_Or: {             /* same as TK_OR, in1, in2, out3 */\r\n#if 0  /* local variables moved into u.al */\r\n  int v1;    /* Left operand:  0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */\r\n  int v2;    /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */\r\n#endif /* local variables moved into u.al */\r\n\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( pIn1->flags & MEM_Null ){\r\n    u.al.v1 = 2;\r\n  }else{\r\n    u.al.v1 = sqlite3VdbeIntValue(pIn1)!=0;\r\n  }\r\n  pIn2 = &aMem[pOp->p2];\r\n  if( pIn2->flags & MEM_Null ){\r\n    u.al.v2 = 2;\r\n  }else{\r\n    u.al.v2 = sqlite3VdbeIntValue(pIn2)!=0;\r\n  }\r\n  if( pOp->opcode==OP_And ){\r\n    static const unsigned char and_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 };\r\n    u.al.v1 = and_logic[u.al.v1*3+u.al.v2];\r\n  }else{\r\n    static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 };\r\n    u.al.v1 = or_logic[u.al.v1*3+u.al.v2];\r\n  }\r\n  pOut = &aMem[pOp->p3];\r\n  if( u.al.v1==2 ){\r\n    MemSetTypeFlag(pOut, MEM_Null);\r\n  }else{\r\n    pOut->u.i = u.al.v1;\r\n    MemSetTypeFlag(pOut, MEM_Int);\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Not P1 P2 * * *\r\n**\r\n** Interpret the value in register P1 as a boolean value.  Store the\r\n** boolean complement in register P2.  If the value in register P1 is \r\n** NULL, then a NULL is stored in P2.\r\n*/\r\ncase OP_Not: {                /* same as TK_NOT, in1, out2 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  pOut = &aMem[pOp->p2];\r\n  if( pIn1->flags & MEM_Null ){\r\n    sqlite3VdbeMemSetNull(pOut);\r\n  }else{\r\n    sqlite3VdbeMemSetInt64(pOut, !sqlite3VdbeIntValue(pIn1));\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: BitNot P1 P2 * * *\r\n**\r\n** Interpret the content of register P1 as an integer.  Store the\r\n** ones-complement of the P1 value into register P2.  If P1 holds\r\n** a NULL then store a NULL in P2.\r\n*/\r\ncase OP_BitNot: {             /* same as TK_BITNOT, in1, out2 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  pOut = &aMem[pOp->p2];\r\n  if( pIn1->flags & MEM_Null ){\r\n    sqlite3VdbeMemSetNull(pOut);\r\n  }else{\r\n    sqlite3VdbeMemSetInt64(pOut, ~sqlite3VdbeIntValue(pIn1));\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Once P1 P2 * * *\r\n**\r\n** Check if OP_Once flag P1 is set. If so, jump to instruction P2. Otherwise,\r\n** set the flag and fall through to the next instruction.\r\n**\r\n** See also: JumpOnce\r\n*/\r\ncase OP_Once: {             /* jump */\r\n  assert( pOp->p1<p->nOnceFlag );\r\n  if( p->aOnceFlag[pOp->p1] ){\r\n    pc = pOp->p2-1;\r\n  }else{\r\n    p->aOnceFlag[pOp->p1] = 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: If P1 P2 P3 * *\r\n**\r\n** Jump to P2 if the value in register P1 is true.  The value\r\n** is considered true if it is numeric and non-zero.  If the value\r\n** in P1 is NULL then take the jump if P3 is non-zero.\r\n*/\r\n/* Opcode: IfNot P1 P2 P3 * *\r\n**\r\n** Jump to P2 if the value in register P1 is False.  The value\r\n** is considered false if it has a numeric value of zero.  If the value\r\n** in P1 is NULL then take the jump if P3 is zero.\r\n*/\r\ncase OP_If:                 /* jump, in1 */\r\ncase OP_IfNot: {            /* jump, in1 */\r\n#if 0  /* local variables moved into u.am */\r\n  int c;\r\n#endif /* local variables moved into u.am */\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( pIn1->flags & MEM_Null ){\r\n    u.am.c = pOp->p3;\r\n  }else{\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n    u.am.c = sqlite3VdbeIntValue(pIn1)!=0;\r\n#else\r\n    u.am.c = sqlite3VdbeRealValue(pIn1)!=0.0;\r\n#endif\r\n    if( pOp->opcode==OP_IfNot ) u.am.c = !u.am.c;\r\n  }\r\n  if( u.am.c ){\r\n    pc = pOp->p2-1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IsNull P1 P2 * * *\r\n**\r\n** Jump to P2 if the value in register P1 is NULL.\r\n*/\r\ncase OP_IsNull: {            /* same as TK_ISNULL, jump, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( (pIn1->flags & MEM_Null)!=0 ){\r\n    pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: NotNull P1 P2 * * *\r\n**\r\n** Jump to P2 if the value in register P1 is not NULL.  \r\n*/\r\ncase OP_NotNull: {            /* same as TK_NOTNULL, jump, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( (pIn1->flags & MEM_Null)==0 ){\r\n    pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Column P1 P2 P3 P4 P5\r\n**\r\n** Interpret the data that cursor P1 points to as a structure built using\r\n** the MakeRecord instruction.  (See the MakeRecord opcode for additional\r\n** information about the format of the data.)  Extract the P2-th column\r\n** from this record.  If there are less that (P2+1) \r\n** values in the record, extract a NULL.\r\n**\r\n** The value extracted is stored in register P3.\r\n**\r\n** If the column contains fewer than P2 fields, then extract a NULL.  Or,\r\n** if the P4 argument is a P4_MEM use the value of the P4 argument as\r\n** the result.\r\n**\r\n** If the OPFLAG_CLEARCACHE bit is set on P5 and P1 is a pseudo-table cursor,\r\n** then the cache of the cursor is reset prior to extracting the column.\r\n** The first OP_Column against a pseudo-table after the value of the content\r\n** register has changed should have this bit set.\r\n*/\r\ncase OP_Column: {\r\n#if 0  /* local variables moved into u.an */\r\n  u32 payloadSize;   /* Number of bytes in the record */\r\n  i64 payloadSize64; /* Number of bytes in the record */\r\n  int p1;            /* P1 value of the opcode */\r\n  int p2;            /* column number to retrieve */\r\n  VdbeCursor *pC;    /* The VDBE cursor */\r\n  char *zRec;        /* Pointer to complete record-data */\r\n  BtCursor *pCrsr;   /* The BTree cursor */\r\n  u32 *aType;        /* aType[i] holds the numeric type of the i-th column */\r\n  u32 *aOffset;      /* aOffset[i] is offset to start of data for i-th column */\r\n  int nField;        /* number of fields in the record */\r\n  int len;           /* The length of the serialized data for the column */\r\n  int i;             /* Loop counter */\r\n  char *zData;       /* Part of the record being decoded */\r\n  Mem *pDest;        /* Where to write the extracted value */\r\n  Mem sMem;          /* For storing the record being decoded */\r\n  u8 *zIdx;          /* Index into header */\r\n  u8 *zEndHdr;       /* Pointer to first byte after the header */\r\n  u32 offset;        /* Offset into the data */\r\n  u32 szField;       /* Number of bytes in the content of a field */\r\n  int szHdr;         /* Size of the header size field at start of record */\r\n  int avail;         /* Number of bytes of available data */\r\n  u32 t;             /* A type code from the record header */\r\n  Mem *pReg;         /* PseudoTable input register */\r\n#endif /* local variables moved into u.an */\r\n\r\n\r\n  u.an.p1 = pOp->p1;\r\n  u.an.p2 = pOp->p2;\r\n  u.an.pC = 0;\r\n  memset(&u.an.sMem, 0, sizeof(u.an.sMem));\r\n  assert( u.an.p1<p->nCursor );\r\n  assert( pOp->p3>0 && pOp->p3<=p->nMem );\r\n  u.an.pDest = &aMem[pOp->p3];\r\n  memAboutToChange(p, u.an.pDest);\r\n  u.an.zRec = 0;\r\n\r\n  /* This block sets the variable u.an.payloadSize to be the total number of\r\n  ** bytes in the record.\r\n  **\r\n  ** u.an.zRec is set to be the complete text of the record if it is available.\r\n  ** The complete record text is always available for pseudo-tables\r\n  ** If the record is stored in a cursor, the complete record text\r\n  ** might be available in the  u.an.pC->aRow cache.  Or it might not be.\r\n  ** If the data is unavailable,  u.an.zRec is set to NULL.\r\n  **\r\n  ** We also compute the number of columns in the record.  For cursors,\r\n  ** the number of columns is stored in the VdbeCursor.nField element.\r\n  */\r\n  u.an.pC = p->apCsr[u.an.p1];\r\n  assert( u.an.pC!=0 );\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  assert( u.an.pC->pVtabCursor==0 );\r\n#endif\r\n  u.an.pCrsr = u.an.pC->pCursor;\r\n  if( u.an.pCrsr!=0 ){\r\n    /* The record is stored in a B-Tree */\r\n    rc = sqlite3VdbeCursorMoveto(u.an.pC);\r\n    if( rc ) goto abort_due_to_error;\r\n    if( u.an.pC->nullRow ){\r\n      u.an.payloadSize = 0;\r\n    }else if( u.an.pC->cacheStatus==p->cacheCtr ){\r\n      u.an.payloadSize = u.an.pC->payloadSize;\r\n      u.an.zRec = (char*)u.an.pC->aRow;\r\n    }else if( u.an.pC->isIndex ){\r\n      assert( sqlite3BtreeCursorIsValid(u.an.pCrsr) );\r\n      VVA_ONLY(rc =) sqlite3BtreeKeySize(u.an.pCrsr, &u.an.payloadSize64);\r\n      assert( rc==SQLITE_OK );   /* True because of CursorMoveto() call above */\r\n      /* sqlite3BtreeParseCellPtr() uses getVarint32() to extract the\r\n      ** payload size, so it is impossible for u.an.payloadSize64 to be\r\n      ** larger than 32 bits. */\r\n      assert( (u.an.payloadSize64 & SQLITE_MAX_U32)==(u64)u.an.payloadSize64 );\r\n      u.an.payloadSize = (u32)u.an.payloadSize64;\r\n    }else{\r\n      assert( sqlite3BtreeCursorIsValid(u.an.pCrsr) );\r\n      VVA_ONLY(rc =) sqlite3BtreeDataSize(u.an.pCrsr, &u.an.payloadSize);\r\n      assert( rc==SQLITE_OK );   /* DataSize() cannot fail */\r\n    }\r\n  }else if( ALWAYS(u.an.pC->pseudoTableReg>0) ){\r\n    u.an.pReg = &aMem[u.an.pC->pseudoTableReg];\r\n    assert( u.an.pReg->flags & MEM_Blob );\r\n    assert( memIsValid(u.an.pReg) );\r\n    u.an.payloadSize = u.an.pReg->n;\r\n    u.an.zRec = u.an.pReg->z;\r\n    u.an.pC->cacheStatus = (pOp->p5&OPFLAG_CLEARCACHE) ? CACHE_STALE : p->cacheCtr;\r\n    assert( u.an.payloadSize==0 || u.an.zRec!=0 );\r\n  }else{\r\n    /* Consider the row to be NULL */\r\n    u.an.payloadSize = 0;\r\n  }\r\n\r\n  /* If u.an.payloadSize is 0, then just store a NULL.  This can happen because of\r\n  ** nullRow or because of a corrupt database. */\r\n  if( u.an.payloadSize==0 ){\r\n    MemSetTypeFlag(u.an.pDest, MEM_Null);\r\n    goto op_column_out;\r\n  }\r\n  assert( db->aLimit[SQLITE_LIMIT_LENGTH]>=0 );\r\n  if( u.an.payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    goto too_big;\r\n  }\r\n\r\n  u.an.nField = u.an.pC->nField;\r\n  assert( u.an.p2<u.an.nField );\r\n\r\n  /* Read and parse the table header.  Store the results of the parse\r\n  ** into the record header cache fields of the cursor.\r\n  */\r\n  u.an.aType = u.an.pC->aType;\r\n  if( u.an.pC->cacheStatus==p->cacheCtr ){\r\n    u.an.aOffset = u.an.pC->aOffset;\r\n  }else{\r\n    assert(u.an.aType);\r\n    u.an.avail = 0;\r\n    u.an.pC->aOffset = u.an.aOffset = &u.an.aType[u.an.nField];\r\n    u.an.pC->payloadSize = u.an.payloadSize;\r\n    u.an.pC->cacheStatus = p->cacheCtr;\r\n\r\n    /* Figure out how many bytes are in the header */\r\n    if( u.an.zRec ){\r\n      u.an.zData = u.an.zRec;\r\n    }else{\r\n      if( u.an.pC->isIndex ){\r\n        u.an.zData = (char*)sqlite3BtreeKeyFetch(u.an.pCrsr, &u.an.avail);\r\n      }else{\r\n        u.an.zData = (char*)sqlite3BtreeDataFetch(u.an.pCrsr, &u.an.avail);\r\n      }\r\n      /* If KeyFetch()/DataFetch() managed to get the entire payload,\r\n      ** save the payload in the u.an.pC->aRow cache.  That will save us from\r\n      ** having to make additional calls to fetch the content portion of\r\n      ** the record.\r\n      */\r\n      assert( u.an.avail>=0 );\r\n      if( u.an.payloadSize <= (u32)u.an.avail ){\r\n        u.an.zRec = u.an.zData;\r\n        u.an.pC->aRow = (u8*)u.an.zData;\r\n      }else{\r\n        u.an.pC->aRow = 0;\r\n      }\r\n    }\r\n    /* The following assert is true in all cases accept when\r\n    ** the database file has been corrupted externally.\r\n    **    assert( u.an.zRec!=0 || u.an.avail>=u.an.payloadSize || u.an.avail>=9 ); */\r\n    u.an.szHdr = getVarint32((u8*)u.an.zData, u.an.offset);\r\n\r\n    /* Make sure a corrupt database has not given us an oversize header.\r\n    ** Do this now to avoid an oversize memory allocation.\r\n    **\r\n    ** Type entries can be between 1 and 5 bytes each.  But 4 and 5 byte\r\n    ** types use so much data space that there can only be 4096 and 32 of\r\n    ** them, respectively.  So the maximum header length results from a\r\n    ** 3-byte type for each of the maximum of 32768 columns plus three\r\n    ** extra bytes for the header length itself.  32768*3 + 3 = 98307.\r\n    */\r\n    if( u.an.offset > 98307 ){\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n      goto op_column_out;\r\n    }\r\n\r\n    /* Compute in u.an.len the number of bytes of data we need to read in order\r\n    ** to get u.an.nField type values.  u.an.offset is an upper bound on this.  But\r\n    ** u.an.nField might be significantly less than the true number of columns\r\n    ** in the table, and in that case, 5*u.an.nField+3 might be smaller than u.an.offset.\r\n    ** We want to minimize u.an.len in order to limit the size of the memory\r\n    ** allocation, especially if a corrupt database file has caused u.an.offset\r\n    ** to be oversized. Offset is limited to 98307 above.  But 98307 might\r\n    ** still exceed Robson memory allocation limits on some configurations.\r\n    ** On systems that cannot tolerate large memory allocations, u.an.nField*5+3\r\n    ** will likely be much smaller since u.an.nField will likely be less than\r\n    ** 20 or so.  This insures that Robson memory allocation limits are\r\n    ** not exceeded even for corrupt database files.\r\n    */\r\n    u.an.len = u.an.nField*5 + 3;\r\n    if( u.an.len > (int)u.an.offset ) u.an.len = (int)u.an.offset;\r\n\r\n    /* The KeyFetch() or DataFetch() above are fast and will get the entire\r\n    ** record header in most cases.  But they will fail to get the complete\r\n    ** record header if the record header does not fit on a single page\r\n    ** in the B-Tree.  When that happens, use sqlite3VdbeMemFromBtree() to\r\n    ** acquire the complete header text.\r\n    */\r\n    if( !u.an.zRec && u.an.avail<u.an.len ){\r\n      u.an.sMem.flags = 0;\r\n      u.an.sMem.db = 0;\r\n      rc = sqlite3VdbeMemFromBtree(u.an.pCrsr, 0, u.an.len, u.an.pC->isIndex, &u.an.sMem);\r\n      if( rc!=SQLITE_OK ){\r\n        goto op_column_out;\r\n      }\r\n      u.an.zData = u.an.sMem.z;\r\n    }\r\n    u.an.zEndHdr = (u8 *)&u.an.zData[u.an.len];\r\n    u.an.zIdx = (u8 *)&u.an.zData[u.an.szHdr];\r\n\r\n    /* Scan the header and use it to fill in the u.an.aType[] and u.an.aOffset[]\r\n    ** arrays.  u.an.aType[u.an.i] will contain the type integer for the u.an.i-th\r\n    ** column and u.an.aOffset[u.an.i] will contain the u.an.offset from the beginning\r\n    ** of the record to the start of the data for the u.an.i-th column\r\n    */\r\n    for(u.an.i=0; u.an.i<u.an.nField; u.an.i++){\r\n      if( u.an.zIdx<u.an.zEndHdr ){\r\n        u.an.aOffset[u.an.i] = u.an.offset;\r\n        if( u.an.zIdx[0]<0x80 ){\r\n          u.an.t = u.an.zIdx[0];\r\n          u.an.zIdx++;\r\n        }else{\r\n          u.an.zIdx += sqlite3GetVarint32(u.an.zIdx, &u.an.t);\r\n        }\r\n        u.an.aType[u.an.i] = u.an.t;\r\n        u.an.szField = sqlite3VdbeSerialTypeLen(u.an.t);\r\n        u.an.offset += u.an.szField;\r\n        if( u.an.offset<u.an.szField ){  /* True if u.an.offset overflows */\r\n          u.an.zIdx = &u.an.zEndHdr[1];  /* Forces SQLITE_CORRUPT return below */\r\n          break;\r\n        }\r\n      }else{\r\n        /* If u.an.i is less that u.an.nField, then there are less fields in this\r\n        ** record than SetNumColumns indicated there are columns in the\r\n        ** table. Set the u.an.offset for any extra columns not present in\r\n        ** the record to 0. This tells code below to store a NULL\r\n        ** instead of deserializing a value from the record.\r\n        */\r\n        u.an.aOffset[u.an.i] = 0;\r\n      }\r\n    }\r\n    sqlite3VdbeMemRelease(&u.an.sMem);\r\n    u.an.sMem.flags = MEM_Null;\r\n\r\n    /* If we have read more header data than was contained in the header,\r\n    ** or if the end of the last field appears to be past the end of the\r\n    ** record, or if the end of the last field appears to be before the end\r\n    ** of the record (when all fields present), then we must be dealing\r\n    ** with a corrupt database.\r\n    */\r\n    if( (u.an.zIdx > u.an.zEndHdr) || (u.an.offset > u.an.payloadSize)\r\n         || (u.an.zIdx==u.an.zEndHdr && u.an.offset!=u.an.payloadSize) ){\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n      goto op_column_out;\r\n    }\r\n  }\r\n\r\n  /* Get the column information. If u.an.aOffset[u.an.p2] is non-zero, then\r\n  ** deserialize the value from the record. If u.an.aOffset[u.an.p2] is zero,\r\n  ** then there are not enough fields in the record to satisfy the\r\n  ** request.  In this case, set the value NULL or to P4 if P4 is\r\n  ** a pointer to a Mem object.\r\n  */\r\n  if( u.an.aOffset[u.an.p2] ){\r\n    assert( rc==SQLITE_OK );\r\n    if( u.an.zRec ){\r\n      VdbeMemRelease(u.an.pDest);\r\n      sqlite3VdbeSerialGet((u8 *)&u.an.zRec[u.an.aOffset[u.an.p2]], u.an.aType[u.an.p2], u.an.pDest);\r\n    }else{\r\n      u.an.len = sqlite3VdbeSerialTypeLen(u.an.aType[u.an.p2]);\r\n      sqlite3VdbeMemMove(&u.an.sMem, u.an.pDest);\r\n      rc = sqlite3VdbeMemFromBtree(u.an.pCrsr, u.an.aOffset[u.an.p2], u.an.len, u.an.pC->isIndex, &u.an.sMem);\r\n      if( rc!=SQLITE_OK ){\r\n        goto op_column_out;\r\n      }\r\n      u.an.zData = u.an.sMem.z;\r\n      sqlite3VdbeSerialGet((u8*)u.an.zData, u.an.aType[u.an.p2], u.an.pDest);\r\n    }\r\n    u.an.pDest->enc = encoding;\r\n  }else{\r\n    if( pOp->p4type==P4_MEM ){\r\n      sqlite3VdbeMemShallowCopy(u.an.pDest, pOp->p4.pMem, MEM_Static);\r\n    }else{\r\n      MemSetTypeFlag(u.an.pDest, MEM_Null);\r\n    }\r\n  }\r\n\r\n  /* If we dynamically allocated space to hold the data (in the\r\n  ** sqlite3VdbeMemFromBtree() call above) then transfer control of that\r\n  ** dynamically allocated space over to the u.an.pDest structure.\r\n  ** This prevents a memory copy.\r\n  */\r\n  if( u.an.sMem.zMalloc ){\r\n    assert( u.an.sMem.z==u.an.sMem.zMalloc );\r\n    assert( !(u.an.pDest->flags & MEM_Dyn) );\r\n    assert( !(u.an.pDest->flags & (MEM_Blob|MEM_Str)) || u.an.pDest->z==u.an.sMem.z );\r\n    u.an.pDest->flags &= ~(MEM_Ephem|MEM_Static);\r\n    u.an.pDest->flags |= MEM_Term;\r\n    u.an.pDest->z = u.an.sMem.z;\r\n    u.an.pDest->zMalloc = u.an.sMem.zMalloc;\r\n  }\r\n\r\n  rc = sqlite3VdbeMemMakeWriteable(u.an.pDest);\r\n\r\nop_column_out:\r\n  UPDATE_MAX_BLOBSIZE(u.an.pDest);\r\n  REGISTER_TRACE(pOp->p3, u.an.pDest);\r\n  break;\r\n}\r\n\r\n/* Opcode: Affinity P1 P2 * P4 *\r\n**\r\n** Apply affinities to a range of P2 registers starting with P1.\r\n**\r\n** P4 is a string that is P2 characters long. The nth character of the\r\n** string indicates the column affinity that should be used for the nth\r\n** memory cell in the range.\r\n*/\r\ncase OP_Affinity: {\r\n#if 0  /* local variables moved into u.ao */\r\n  const char *zAffinity;   /* The affinity to be applied */\r\n  char cAff;               /* A single character of affinity */\r\n#endif /* local variables moved into u.ao */\r\n\r\n  u.ao.zAffinity = pOp->p4.z;\r\n  assert( u.ao.zAffinity!=0 );\r\n  assert( u.ao.zAffinity[pOp->p2]==0 );\r\n  pIn1 = &aMem[pOp->p1];\r\n  while( (u.ao.cAff = *(u.ao.zAffinity++))!=0 ){\r\n    assert( pIn1 <= &p->aMem[p->nMem] );\r\n    assert( memIsValid(pIn1) );\r\n    ExpandBlob(pIn1);\r\n    applyAffinity(pIn1, u.ao.cAff, encoding);\r\n    pIn1++;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: MakeRecord P1 P2 P3 P4 *\r\n**\r\n** Convert P2 registers beginning with P1 into the [record format]\r\n** use as a data record in a database table or as a key\r\n** in an index.  The OP_Column opcode can decode the record later.\r\n**\r\n** P4 may be a string that is P2 characters long.  The nth character of the\r\n** string indicates the column affinity that should be used for the nth\r\n** field of the index key.\r\n**\r\n** The mapping from character to affinity is given by the SQLITE_AFF_\r\n** macros defined in sqliteInt.h.\r\n**\r\n** If P4 is NULL then all index fields have the affinity NONE.\r\n*/\r\ncase OP_MakeRecord: {\r\n#if 0  /* local variables moved into u.ap */\r\n  u8 *zNewRecord;        /* A buffer to hold the data for the new record */\r\n  Mem *pRec;             /* The new record */\r\n  u64 nData;             /* Number of bytes of data space */\r\n  int nHdr;              /* Number of bytes of header space */\r\n  i64 nByte;             /* Data space required for this record */\r\n  int nZero;             /* Number of zero bytes at the end of the record */\r\n  int nVarint;           /* Number of bytes in a varint */\r\n  u32 serial_type;       /* Type field */\r\n  Mem *pData0;           /* First field to be combined into the record */\r\n  Mem *pLast;            /* Last field of the record */\r\n  int nField;            /* Number of fields in the record */\r\n  char *zAffinity;       /* The affinity string for the record */\r\n  int file_format;       /* File format to use for encoding */\r\n  int i;                 /* Space used in zNewRecord[] */\r\n  int len;               /* Length of a field */\r\n#endif /* local variables moved into u.ap */\r\n\r\n  /* Assuming the record contains N fields, the record format looks\r\n  ** like this:\r\n  **\r\n  ** ------------------------------------------------------------------------\r\n  ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 |\r\n  ** ------------------------------------------------------------------------\r\n  **\r\n  ** Data(0) is taken from register P1.  Data(1) comes from register P1+1\r\n  ** and so froth.\r\n  **\r\n  ** Each type field is a varint representing the serial type of the\r\n  ** corresponding data element (see sqlite3VdbeSerialType()). The\r\n  ** hdr-size field is also a varint which is the offset from the beginning\r\n  ** of the record to data0.\r\n  */\r\n  u.ap.nData = 0;         /* Number of bytes of data space */\r\n  u.ap.nHdr = 0;          /* Number of bytes of header space */\r\n  u.ap.nZero = 0;         /* Number of zero bytes at the end of the record */\r\n  u.ap.nField = pOp->p1;\r\n  u.ap.zAffinity = pOp->p4.z;\r\n  assert( u.ap.nField>0 && pOp->p2>0 && pOp->p2+u.ap.nField<=p->nMem+1 );\r\n  u.ap.pData0 = &aMem[u.ap.nField];\r\n  u.ap.nField = pOp->p2;\r\n  u.ap.pLast = &u.ap.pData0[u.ap.nField-1];\r\n  u.ap.file_format = p->minWriteFileFormat;\r\n\r\n  /* Identify the output register */\r\n  assert( pOp->p3<pOp->p1 || pOp->p3>=pOp->p1+pOp->p2 );\r\n  pOut = &aMem[pOp->p3];\r\n  memAboutToChange(p, pOut);\r\n\r\n  /* Loop through the elements that will make up the record to figure\r\n  ** out how much space is required for the new record.\r\n  */\r\n  for(u.ap.pRec=u.ap.pData0; u.ap.pRec<=u.ap.pLast; u.ap.pRec++){\r\n    assert( memIsValid(u.ap.pRec) );\r\n    if( u.ap.zAffinity ){\r\n      applyAffinity(u.ap.pRec, u.ap.zAffinity[u.ap.pRec-u.ap.pData0], encoding);\r\n    }\r\n    if( u.ap.pRec->flags&MEM_Zero && u.ap.pRec->n>0 ){\r\n      sqlite3VdbeMemExpandBlob(u.ap.pRec);\r\n    }\r\n    u.ap.serial_type = sqlite3VdbeSerialType(u.ap.pRec, u.ap.file_format);\r\n    u.ap.len = sqlite3VdbeSerialTypeLen(u.ap.serial_type);\r\n    u.ap.nData += u.ap.len;\r\n    u.ap.nHdr += sqlite3VarintLen(u.ap.serial_type);\r\n    if( u.ap.pRec->flags & MEM_Zero ){\r\n      /* Only pure zero-filled BLOBs can be input to this Opcode.\r\n      ** We do not allow blobs with a prefix and a zero-filled tail. */\r\n      u.ap.nZero += u.ap.pRec->u.nZero;\r\n    }else if( u.ap.len ){\r\n      u.ap.nZero = 0;\r\n    }\r\n  }\r\n\r\n  /* Add the initial header varint and total the size */\r\n  u.ap.nHdr += u.ap.nVarint = sqlite3VarintLen(u.ap.nHdr);\r\n  if( u.ap.nVarint<sqlite3VarintLen(u.ap.nHdr) ){\r\n    u.ap.nHdr++;\r\n  }\r\n  u.ap.nByte = u.ap.nHdr+u.ap.nData-u.ap.nZero;\r\n  if( u.ap.nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    goto too_big;\r\n  }\r\n\r\n  /* Make sure the output register has a buffer large enough to store\r\n  ** the new record. The output register (pOp->p3) is not allowed to\r\n  ** be one of the input registers (because the following call to\r\n  ** sqlite3VdbeMemGrow() could clobber the value before it is used).\r\n  */\r\n  if( sqlite3VdbeMemGrow(pOut, (int)u.ap.nByte, 0) ){\r\n    goto no_mem;\r\n  }\r\n  u.ap.zNewRecord = (u8 *)pOut->z;\r\n\r\n  /* Write the record */\r\n  u.ap.i = putVarint32(u.ap.zNewRecord, u.ap.nHdr);\r\n  for(u.ap.pRec=u.ap.pData0; u.ap.pRec<=u.ap.pLast; u.ap.pRec++){\r\n    u.ap.serial_type = sqlite3VdbeSerialType(u.ap.pRec, u.ap.file_format);\r\n    u.ap.i += putVarint32(&u.ap.zNewRecord[u.ap.i], u.ap.serial_type);      /* serial type */\r\n  }\r\n  for(u.ap.pRec=u.ap.pData0; u.ap.pRec<=u.ap.pLast; u.ap.pRec++){  /* serial data */\r\n    u.ap.i += sqlite3VdbeSerialPut(&u.ap.zNewRecord[u.ap.i], (int)(u.ap.nByte-u.ap.i), u.ap.pRec,u.ap.file_format);\r\n  }\r\n  assert( u.ap.i==u.ap.nByte );\r\n\r\n  assert( pOp->p3>0 && pOp->p3<=p->nMem );\r\n  pOut->n = (int)u.ap.nByte;\r\n  pOut->flags = MEM_Blob | MEM_Dyn;\r\n  pOut->xDel = 0;\r\n  if( u.ap.nZero ){\r\n    pOut->u.nZero = u.ap.nZero;\r\n    pOut->flags |= MEM_Zero;\r\n  }\r\n  pOut->enc = SQLITE_UTF8;  /* In case the blob is ever converted to text */\r\n  REGISTER_TRACE(pOp->p3, pOut);\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: Count P1 P2 * * *\r\n**\r\n** Store the number of entries (an integer value) in the table or index \r\n** opened by cursor P1 in register P2\r\n*/\r\n#ifndef SQLITE_OMIT_BTREECOUNT\r\ncase OP_Count: {         /* out2-prerelease */\r\n#if 0  /* local variables moved into u.aq */\r\n  i64 nEntry;\r\n  BtCursor *pCrsr;\r\n#endif /* local variables moved into u.aq */\r\n\r\n  u.aq.pCrsr = p->apCsr[pOp->p1]->pCursor;\r\n  if( ALWAYS(u.aq.pCrsr) ){\r\n    rc = sqlite3BtreeCount(u.aq.pCrsr, &u.aq.nEntry);\r\n  }else{\r\n    u.aq.nEntry = 0;\r\n  }\r\n  pOut->u.i = u.aq.nEntry;\r\n  break;\r\n}\r\n#endif\r\n\r\n/* Opcode: Savepoint P1 * * P4 *\r\n**\r\n** Open, release or rollback the savepoint named by parameter P4, depending\r\n** on the value of P1. To open a new savepoint, P1==0. To release (commit) an\r\n** existing savepoint, P1==1, or to rollback an existing savepoint P1==2.\r\n*/\r\ncase OP_Savepoint: {\r\n#if 0  /* local variables moved into u.ar */\r\n  int p1;                         /* Value of P1 operand */\r\n  char *zName;                    /* Name of savepoint */\r\n  int nName;\r\n  Savepoint *pNew;\r\n  Savepoint *pSavepoint;\r\n  Savepoint *pTmp;\r\n  int iSavepoint;\r\n  int ii;\r\n#endif /* local variables moved into u.ar */\r\n\r\n  u.ar.p1 = pOp->p1;\r\n  u.ar.zName = pOp->p4.z;\r\n\r\n  /* Assert that the u.ar.p1 parameter is valid. Also that if there is no open\r\n  ** transaction, then there cannot be any savepoints.\r\n  */\r\n  assert( db->pSavepoint==0 || db->autoCommit==0 );\r\n  assert( u.ar.p1==SAVEPOINT_BEGIN||u.ar.p1==SAVEPOINT_RELEASE||u.ar.p1==SAVEPOINT_ROLLBACK );\r\n  assert( db->pSavepoint || db->isTransactionSavepoint==0 );\r\n  assert( checkSavepointCount(db) );\r\n\r\n  if( u.ar.p1==SAVEPOINT_BEGIN ){\r\n    if( db->writeVdbeCnt>0 ){\r\n      /* A new savepoint cannot be created if there are active write\r\n      ** statements (i.e. open read/write incremental blob handles).\r\n      */\r\n      sqlite3SetString(&p->zErrMsg, db, \"cannot open savepoint - \"\r\n        \"SQL statements in progress\");\r\n      rc = SQLITE_BUSY;\r\n    }else{\r\n      u.ar.nName = sqlite3Strlen30(u.ar.zName);\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n      /* This call is Ok even if this savepoint is actually a transaction\r\n      ** savepoint (and therefore should not prompt xSavepoint()) callbacks.\r\n      ** If this is a transaction savepoint being opened, it is guaranteed\r\n      ** that the db->aVTrans[] array is empty.  */\r\n      assert( db->autoCommit==0 || db->nVTrans==0 );\r\n      rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN,\r\n                                db->nStatement+db->nSavepoint);\r\n      if( rc!=SQLITE_OK ) goto abort_due_to_error;\r\n#endif\r\n\r\n      /* Create a new savepoint structure. */\r\n      u.ar.pNew = sqlite3DbMallocRaw(db, sizeof(Savepoint)+u.ar.nName+1);\r\n      if( u.ar.pNew ){\r\n        u.ar.pNew->zName = (char *)&u.ar.pNew[1];\r\n        memcpy(u.ar.pNew->zName, u.ar.zName, u.ar.nName+1);\r\n\r\n        /* If there is no open transaction, then mark this as a special\r\n        ** \"transaction savepoint\". */\r\n        if( db->autoCommit ){\r\n          db->autoCommit = 0;\r\n          db->isTransactionSavepoint = 1;\r\n        }else{\r\n          db->nSavepoint++;\r\n        }\r\n\r\n        /* Link the new savepoint into the database handle's list. */\r\n        u.ar.pNew->pNext = db->pSavepoint;\r\n        db->pSavepoint = u.ar.pNew;\r\n        u.ar.pNew->nDeferredCons = db->nDeferredCons;\r\n      }\r\n    }\r\n  }else{\r\n    u.ar.iSavepoint = 0;\r\n\r\n    /* Find the named savepoint. If there is no such savepoint, then an\r\n    ** an error is returned to the user.  */\r\n    for(\r\n      u.ar.pSavepoint = db->pSavepoint;\r\n      u.ar.pSavepoint && sqlite3StrICmp(u.ar.pSavepoint->zName, u.ar.zName);\r\n      u.ar.pSavepoint = u.ar.pSavepoint->pNext\r\n    ){\r\n      u.ar.iSavepoint++;\r\n    }\r\n    if( !u.ar.pSavepoint ){\r\n      sqlite3SetString(&p->zErrMsg, db, \"no such savepoint: %s\", u.ar.zName);\r\n      rc = SQLITE_ERROR;\r\n    }else if( db->writeVdbeCnt>0 && u.ar.p1==SAVEPOINT_RELEASE ){\r\n      /* It is not possible to release (commit) a savepoint if there are\r\n      ** active write statements.\r\n      */\r\n      sqlite3SetString(&p->zErrMsg, db,\r\n        \"cannot release savepoint - SQL statements in progress\"\r\n      );\r\n      rc = SQLITE_BUSY;\r\n    }else{\r\n\r\n      /* Determine whether or not this is a transaction savepoint. If so,\r\n      ** and this is a RELEASE command, then the current transaction\r\n      ** is committed.\r\n      */\r\n      int isTransaction = u.ar.pSavepoint->pNext==0 && db->isTransactionSavepoint;\r\n      if( isTransaction && u.ar.p1==SAVEPOINT_RELEASE ){\r\n        if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){\r\n          goto vdbe_return;\r\n        }\r\n        db->autoCommit = 1;\r\n        if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){\r\n          p->pc = pc;\r\n          db->autoCommit = 0;\r\n          p->rc = rc = SQLITE_BUSY;\r\n          goto vdbe_return;\r\n        }\r\n        db->isTransactionSavepoint = 0;\r\n        rc = p->rc;\r\n      }else{\r\n        u.ar.iSavepoint = db->nSavepoint - u.ar.iSavepoint - 1;\r\n        for(u.ar.ii=0; u.ar.ii<db->nDb; u.ar.ii++){\r\n          sqlite3BtreeTripAllCursors(db->aDb[u.ar.ii].pBt, SQLITE_ABORT);\r\n        }\r\n        for(u.ar.ii=0; u.ar.ii<db->nDb; u.ar.ii++){\r\n          rc = sqlite3BtreeSavepoint(db->aDb[u.ar.ii].pBt, u.ar.p1, u.ar.iSavepoint);\r\n          if( rc!=SQLITE_OK ){\r\n            goto abort_due_to_error;\r\n          }\r\n        }\r\n        if( u.ar.p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){\r\n          sqlite3ExpirePreparedStatements(db);\r\n          sqlite3ResetInternalSchema(db, -1);\r\n          db->flags = (db->flags | SQLITE_InternChanges);\r\n        }\r\n      }\r\n\r\n      /* Regardless of whether this is a RELEASE or ROLLBACK, destroy all\r\n      ** savepoints nested inside of the savepoint being operated on. */\r\n      while( db->pSavepoint!=u.ar.pSavepoint ){\r\n        u.ar.pTmp = db->pSavepoint;\r\n        db->pSavepoint = u.ar.pTmp->pNext;\r\n        sqlite3DbFree(db, u.ar.pTmp);\r\n        db->nSavepoint--;\r\n      }\r\n\r\n      /* If it is a RELEASE, then destroy the savepoint being operated on\r\n      ** too. If it is a ROLLBACK TO, then set the number of deferred\r\n      ** constraint violations present in the database to the value stored\r\n      ** when the savepoint was created.  */\r\n      if( u.ar.p1==SAVEPOINT_RELEASE ){\r\n        assert( u.ar.pSavepoint==db->pSavepoint );\r\n        db->pSavepoint = u.ar.pSavepoint->pNext;\r\n        sqlite3DbFree(db, u.ar.pSavepoint);\r\n        if( !isTransaction ){\r\n          db->nSavepoint--;\r\n        }\r\n      }else{\r\n        db->nDeferredCons = u.ar.pSavepoint->nDeferredCons;\r\n      }\r\n\r\n      if( !isTransaction ){\r\n        rc = sqlite3VtabSavepoint(db, u.ar.p1, u.ar.iSavepoint);\r\n        if( rc!=SQLITE_OK ) goto abort_due_to_error;\r\n      }\r\n    }\r\n  }\r\n\r\n  break;\r\n}\r\n\r\n/* Opcode: AutoCommit P1 P2 * * *\r\n**\r\n** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll\r\n** back any currently active btree transactions. If there are any active\r\n** VMs (apart from this one), then a ROLLBACK fails.  A COMMIT fails if\r\n** there are active writing VMs or active VMs that use shared cache.\r\n**\r\n** This instruction causes the VM to halt.\r\n*/\r\ncase OP_AutoCommit: {\r\n#if 0  /* local variables moved into u.as */\r\n  int desiredAutoCommit;\r\n  int iRollback;\r\n  int turnOnAC;\r\n#endif /* local variables moved into u.as */\r\n\r\n  u.as.desiredAutoCommit = pOp->p1;\r\n  u.as.iRollback = pOp->p2;\r\n  u.as.turnOnAC = u.as.desiredAutoCommit && !db->autoCommit;\r\n  assert( u.as.desiredAutoCommit==1 || u.as.desiredAutoCommit==0 );\r\n  assert( u.as.desiredAutoCommit==1 || u.as.iRollback==0 );\r\n  assert( db->activeVdbeCnt>0 );  /* At least this one VM is active */\r\n\r\n#if 0\r\n  if( u.as.turnOnAC && u.as.iRollback && db->activeVdbeCnt>1 ){\r\n    /* If this instruction implements a ROLLBACK and other VMs are\r\n    ** still running, and a transaction is active, return an error indicating\r\n    ** that the other VMs must complete first.\r\n    */\r\n    sqlite3SetString(&p->zErrMsg, db, \"cannot rollback transaction - \"\r\n        \"SQL statements in progress\");\r\n    rc = SQLITE_BUSY;\r\n  }else\r\n#endif\r\n  if( u.as.turnOnAC && !u.as.iRollback && db->writeVdbeCnt>0 ){\r\n    /* If this instruction implements a COMMIT and other VMs are writing\r\n    ** return an error indicating that the other VMs must complete first.\r\n    */\r\n    sqlite3SetString(&p->zErrMsg, db, \"cannot commit transaction - \"\r\n        \"SQL statements in progress\");\r\n    rc = SQLITE_BUSY;\r\n  }else if( u.as.desiredAutoCommit!=db->autoCommit ){\r\n    if( u.as.iRollback ){\r\n      assert( u.as.desiredAutoCommit==1 );\r\n      sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\r\n      db->autoCommit = 1;\r\n    }else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){\r\n      goto vdbe_return;\r\n    }else{\r\n      db->autoCommit = (u8)u.as.desiredAutoCommit;\r\n      if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){\r\n        p->pc = pc;\r\n        db->autoCommit = (u8)(1-u.as.desiredAutoCommit);\r\n        p->rc = rc = SQLITE_BUSY;\r\n        goto vdbe_return;\r\n      }\r\n    }\r\n    assert( db->nStatement==0 );\r\n    sqlite3CloseSavepoints(db);\r\n    if( p->rc==SQLITE_OK ){\r\n      rc = SQLITE_DONE;\r\n    }else{\r\n      rc = SQLITE_ERROR;\r\n    }\r\n    goto vdbe_return;\r\n  }else{\r\n    sqlite3SetString(&p->zErrMsg, db,\r\n        (!u.as.desiredAutoCommit)?\"cannot start a transaction within a transaction\":(\r\n        (u.as.iRollback)?\"cannot rollback - no transaction is active\":\r\n                   \"cannot commit - no transaction is active\"));\r\n\r\n    rc = SQLITE_ERROR;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Transaction P1 P2 * * *\r\n**\r\n** Begin a transaction.  The transaction ends when a Commit or Rollback\r\n** opcode is encountered.  Depending on the ON CONFLICT setting, the\r\n** transaction might also be rolled back if an error is encountered.\r\n**\r\n** P1 is the index of the database file on which the transaction is\r\n** started.  Index 0 is the main database file and index 1 is the\r\n** file used for temporary tables.  Indices of 2 or more are used for\r\n** attached databases.\r\n**\r\n** If P2 is non-zero, then a write-transaction is started.  A RESERVED lock is\r\n** obtained on the database file when a write-transaction is started.  No\r\n** other process can start another write transaction while this transaction is\r\n** underway.  Starting a write transaction also creates a rollback journal. A\r\n** write transaction must be started before any changes can be made to the\r\n** database.  If P2 is 2 or greater then an EXCLUSIVE lock is also obtained\r\n** on the file.\r\n**\r\n** If a write-transaction is started and the Vdbe.usesStmtJournal flag is\r\n** true (this flag is set if the Vdbe may modify more than one row and may\r\n** throw an ABORT exception), a statement transaction may also be opened.\r\n** More specifically, a statement transaction is opened iff the database\r\n** connection is currently not in autocommit mode, or if there are other\r\n** active statements. A statement transaction allows the changes made by this\r\n** VDBE to be rolled back after an error without having to roll back the\r\n** entire transaction. If no error is encountered, the statement transaction\r\n** will automatically commit when the VDBE halts.\r\n**\r\n** If P2 is zero, then a read-lock is obtained on the database file.\r\n*/\r\ncase OP_Transaction: {\r\n#if 0  /* local variables moved into u.at */\r\n  Btree *pBt;\r\n#endif /* local variables moved into u.at */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );\r\n  u.at.pBt = db->aDb[pOp->p1].pBt;\r\n\r\n  if( u.at.pBt ){\r\n    rc = sqlite3BtreeBeginTrans(u.at.pBt, pOp->p2);\r\n    if( rc==SQLITE_BUSY ){\r\n      p->pc = pc;\r\n      p->rc = rc = SQLITE_BUSY;\r\n      goto vdbe_return;\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      goto abort_due_to_error;\r\n    }\r\n\r\n    if( pOp->p2 && p->usesStmtJournal\r\n     && (db->autoCommit==0 || db->activeVdbeCnt>1)\r\n    ){\r\n      assert( sqlite3BtreeIsInTrans(u.at.pBt) );\r\n      if( p->iStatement==0 ){\r\n        assert( db->nStatement>=0 && db->nSavepoint>=0 );\r\n        db->nStatement++;\r\n        p->iStatement = db->nSavepoint + db->nStatement;\r\n      }\r\n\r\n      rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1);\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3BtreeBeginStmt(u.at.pBt, p->iStatement);\r\n      }\r\n\r\n      /* Store the current value of the database handles deferred constraint\r\n      ** counter. If the statement transaction needs to be rolled back,\r\n      ** the value of this counter needs to be restored too.  */\r\n      p->nStmtDefCons = db->nDeferredCons;\r\n    }\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: ReadCookie P1 P2 P3 * *\r\n**\r\n** Read cookie number P3 from database P1 and write it into register P2.\r\n** P3==1 is the schema version.  P3==2 is the database format.\r\n** P3==3 is the recommended pager cache size, and so forth.  P1==0 is\r\n** the main database file and P1==1 is the database file used to store\r\n** temporary tables.\r\n**\r\n** There must be a read-lock on the database (either a transaction\r\n** must be started or there must be an open cursor) before\r\n** executing this instruction.\r\n*/\r\ncase OP_ReadCookie: {               /* out2-prerelease */\r\n#if 0  /* local variables moved into u.au */\r\n  int iMeta;\r\n  int iDb;\r\n  int iCookie;\r\n#endif /* local variables moved into u.au */\r\n\r\n  u.au.iDb = pOp->p1;\r\n  u.au.iCookie = pOp->p3;\r\n  assert( pOp->p3<SQLITE_N_BTREE_META );\r\n  assert( u.au.iDb>=0 && u.au.iDb<db->nDb );\r\n  assert( db->aDb[u.au.iDb].pBt!=0 );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<u.au.iDb))!=0 );\r\n\r\n  sqlite3BtreeGetMeta(db->aDb[u.au.iDb].pBt, u.au.iCookie, (u32 *)&u.au.iMeta);\r\n  pOut->u.i = u.au.iMeta;\r\n  break;\r\n}\r\n\r\n/* Opcode: SetCookie P1 P2 P3 * *\r\n**\r\n** Write the content of register P3 (interpreted as an integer)\r\n** into cookie number P2 of database P1.  P2==1 is the schema version.  \r\n** P2==2 is the database format. P2==3 is the recommended pager cache \r\n** size, and so forth.  P1==0 is the main database file and P1==1 is the \r\n** database file used to store temporary tables.\r\n**\r\n** A transaction must be started before executing this opcode.\r\n*/\r\ncase OP_SetCookie: {       /* in3 */\r\n#if 0  /* local variables moved into u.av */\r\n  Db *pDb;\r\n#endif /* local variables moved into u.av */\r\n  assert( pOp->p2<SQLITE_N_BTREE_META );\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );\r\n  u.av.pDb = &db->aDb[pOp->p1];\r\n  assert( u.av.pDb->pBt!=0 );\r\n  assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) );\r\n  pIn3 = &aMem[pOp->p3];\r\n  sqlite3VdbeMemIntegerify(pIn3);\r\n  /* See note about index shifting on OP_ReadCookie */\r\n  rc = sqlite3BtreeUpdateMeta(u.av.pDb->pBt, pOp->p2, (int)pIn3->u.i);\r\n  if( pOp->p2==BTREE_SCHEMA_VERSION ){\r\n    /* When the schema cookie changes, record the new cookie internally */\r\n    u.av.pDb->pSchema->schema_cookie = (int)pIn3->u.i;\r\n    db->flags |= SQLITE_InternChanges;\r\n  }else if( pOp->p2==BTREE_FILE_FORMAT ){\r\n    /* Record changes in the file format */\r\n    u.av.pDb->pSchema->file_format = (u8)pIn3->u.i;\r\n  }\r\n  if( pOp->p1==1 ){\r\n    /* Invalidate all prepared statements whenever the TEMP database\r\n    ** schema is changed.  Ticket #1644 */\r\n    sqlite3ExpirePreparedStatements(db);\r\n    p->expired = 0;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: VerifyCookie P1 P2 P3 * *\r\n**\r\n** Check the value of global database parameter number 0 (the\r\n** schema version) and make sure it is equal to P2 and that the\r\n** generation counter on the local schema parse equals P3.\r\n**\r\n** P1 is the database number which is 0 for the main database file\r\n** and 1 for the file holding temporary tables and some higher number\r\n** for auxiliary databases.\r\n**\r\n** The cookie changes its value whenever the database schema changes.\r\n** This operation is used to detect when that the cookie has changed\r\n** and that the current process needs to reread the schema.\r\n**\r\n** Either a transaction needs to have been started or an OP_Open needs\r\n** to be executed (to establish a read lock) before this opcode is\r\n** invoked.\r\n*/\r\ncase OP_VerifyCookie: {\r\n#if 0  /* local variables moved into u.aw */\r\n  int iMeta;\r\n  int iGen;\r\n  Btree *pBt;\r\n#endif /* local variables moved into u.aw */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );\r\n  assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) );\r\n  u.aw.pBt = db->aDb[pOp->p1].pBt;\r\n  if( u.aw.pBt ){\r\n    sqlite3BtreeGetMeta(u.aw.pBt, BTREE_SCHEMA_VERSION, (u32 *)&u.aw.iMeta);\r\n    u.aw.iGen = db->aDb[pOp->p1].pSchema->iGeneration;\r\n  }else{\r\n    u.aw.iGen = u.aw.iMeta = 0;\r\n  }\r\n  if( u.aw.iMeta!=pOp->p2 || u.aw.iGen!=pOp->p3 ){\r\n    sqlite3DbFree(db, p->zErrMsg);\r\n    p->zErrMsg = sqlite3DbStrDup(db, \"database schema has changed\");\r\n    /* If the schema-cookie from the database file matches the cookie\r\n    ** stored with the in-memory representation of the schema, do\r\n    ** not reload the schema from the database file.\r\n    **\r\n    ** If virtual-tables are in use, this is not just an optimization.\r\n    ** Often, v-tables store their data in other SQLite tables, which\r\n    ** are queried from within xNext() and other v-table methods using\r\n    ** prepared queries. If such a query is out-of-date, we do not want to\r\n    ** discard the database schema, as the user code implementing the\r\n    ** v-table would have to be ready for the sqlite3_vtab structure itself\r\n    ** to be invalidated whenever sqlite3_step() is called from within\r\n    ** a v-table method.\r\n    */\r\n    if( db->aDb[pOp->p1].pSchema->schema_cookie!=u.aw.iMeta ){\r\n      sqlite3ResetInternalSchema(db, pOp->p1);\r\n    }\r\n\r\n    p->expired = 1;\r\n    rc = SQLITE_SCHEMA;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: OpenRead P1 P2 P3 P4 P5\r\n**\r\n** Open a read-only cursor for the database table whose root page is\r\n** P2 in a database file.  The database file is determined by P3. \r\n** P3==0 means the main database, P3==1 means the database used for \r\n** temporary tables, and P3>1 means used the corresponding attached\r\n** database.  Give the new cursor an identifier of P1.  The P1\r\n** values need not be contiguous but all P1 values should be small integers.\r\n** It is an error for P1 to be negative.\r\n**\r\n** If P5!=0 then use the content of register P2 as the root page, not\r\n** the value of P2 itself.\r\n**\r\n** There will be a read lock on the database whenever there is an\r\n** open cursor.  If the database was unlocked prior to this instruction\r\n** then a read lock is acquired as part of this instruction.  A read\r\n** lock allows other processes to read the database but prohibits\r\n** any other process from modifying the database.  The read lock is\r\n** released when all cursors are closed.  If this instruction attempts\r\n** to get a read lock but fails, the script terminates with an\r\n** SQLITE_BUSY error code.\r\n**\r\n** The P4 value may be either an integer (P4_INT32) or a pointer to\r\n** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo \r\n** structure, then said structure defines the content and collating \r\n** sequence of the index being opened. Otherwise, if P4 is an integer \r\n** value, it is set to the number of columns in the table.\r\n**\r\n** See also OpenWrite.\r\n*/\r\n/* Opcode: OpenWrite P1 P2 P3 P4 P5\r\n**\r\n** Open a read/write cursor named P1 on the table or index whose root\r\n** page is P2.  Or if P5!=0 use the content of register P2 to find the\r\n** root page.\r\n**\r\n** The P4 value may be either an integer (P4_INT32) or a pointer to\r\n** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo \r\n** structure, then said structure defines the content and collating \r\n** sequence of the index being opened. Otherwise, if P4 is an integer \r\n** value, it is set to the number of columns in the table, or to the\r\n** largest index of any column of the table that is actually used.\r\n**\r\n** This instruction works just like OpenRead except that it opens the cursor\r\n** in read/write mode.  For a given table, there can be one or more read-only\r\n** cursors or a single read/write cursor but not both.\r\n**\r\n** See also OpenRead.\r\n*/\r\ncase OP_OpenRead:\r\ncase OP_OpenWrite: {\r\n#if 0  /* local variables moved into u.ax */\r\n  int nField;\r\n  KeyInfo *pKeyInfo;\r\n  int p2;\r\n  int iDb;\r\n  int wrFlag;\r\n  Btree *pX;\r\n  VdbeCursor *pCur;\r\n  Db *pDb;\r\n#endif /* local variables moved into u.ax */\r\n\r\n  if( p->expired ){\r\n    rc = SQLITE_ABORT;\r\n    break;\r\n  }\r\n\r\n  u.ax.nField = 0;\r\n  u.ax.pKeyInfo = 0;\r\n  u.ax.p2 = pOp->p2;\r\n  u.ax.iDb = pOp->p3;\r\n  assert( u.ax.iDb>=0 && u.ax.iDb<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<u.ax.iDb))!=0 );\r\n  u.ax.pDb = &db->aDb[u.ax.iDb];\r\n  u.ax.pX = u.ax.pDb->pBt;\r\n  assert( u.ax.pX!=0 );\r\n  if( pOp->opcode==OP_OpenWrite ){\r\n    u.ax.wrFlag = 1;\r\n    assert( sqlite3SchemaMutexHeld(db, u.ax.iDb, 0) );\r\n    if( u.ax.pDb->pSchema->file_format < p->minWriteFileFormat ){\r\n      p->minWriteFileFormat = u.ax.pDb->pSchema->file_format;\r\n    }\r\n  }else{\r\n    u.ax.wrFlag = 0;\r\n  }\r\n  if( pOp->p5 ){\r\n    assert( u.ax.p2>0 );\r\n    assert( u.ax.p2<=p->nMem );\r\n    pIn2 = &aMem[u.ax.p2];\r\n    assert( memIsValid(pIn2) );\r\n    assert( (pIn2->flags & MEM_Int)!=0 );\r\n    sqlite3VdbeMemIntegerify(pIn2);\r\n    u.ax.p2 = (int)pIn2->u.i;\r\n    /* The u.ax.p2 value always comes from a prior OP_CreateTable opcode and\r\n    ** that opcode will always set the u.ax.p2 value to 2 or more or else fail.\r\n    ** If there were a failure, the prepared statement would have halted\r\n    ** before reaching this instruction. */\r\n    if( NEVER(u.ax.p2<2) ) {\r\n      rc = SQLITE_CORRUPT_BKPT;\r\n      goto abort_due_to_error;\r\n    }\r\n  }\r\n  if( pOp->p4type==P4_KEYINFO ){\r\n    u.ax.pKeyInfo = pOp->p4.pKeyInfo;\r\n    u.ax.pKeyInfo->enc = ENC(p->db);\r\n    u.ax.nField = u.ax.pKeyInfo->nField+1;\r\n  }else if( pOp->p4type==P4_INT32 ){\r\n    u.ax.nField = pOp->p4.i;\r\n  }\r\n  assert( pOp->p1>=0 );\r\n  u.ax.pCur = allocateCursor(p, pOp->p1, u.ax.nField, u.ax.iDb, 1);\r\n  if( u.ax.pCur==0 ) goto no_mem;\r\n  u.ax.pCur->nullRow = 1;\r\n  u.ax.pCur->isOrdered = 1;\r\n  rc = sqlite3BtreeCursor(u.ax.pX, u.ax.p2, u.ax.wrFlag, u.ax.pKeyInfo, u.ax.pCur->pCursor);\r\n  u.ax.pCur->pKeyInfo = u.ax.pKeyInfo;\r\n\r\n  /* Since it performs no memory allocation or IO, the only value that\r\n  ** sqlite3BtreeCursor() may return is SQLITE_OK. */\r\n  assert( rc==SQLITE_OK );\r\n\r\n  /* Set the VdbeCursor.isTable and isIndex variables. Previous versions of\r\n  ** SQLite used to check if the root-page flags were sane at this point\r\n  ** and report database corruption if they were not, but this check has\r\n  ** since moved into the btree layer.  */\r\n  u.ax.pCur->isTable = pOp->p4type!=P4_KEYINFO;\r\n  u.ax.pCur->isIndex = !u.ax.pCur->isTable;\r\n  break;\r\n}\r\n\r\n/* Opcode: OpenEphemeral P1 P2 * P4 P5\r\n**\r\n** Open a new cursor P1 to a transient table.\r\n** The cursor is always opened read/write even if \r\n** the main database is read-only.  The ephemeral\r\n** table is deleted automatically when the cursor is closed.\r\n**\r\n** P2 is the number of columns in the ephemeral table.\r\n** The cursor points to a BTree table if P4==0 and to a BTree index\r\n** if P4 is not 0.  If P4 is not NULL, it points to a KeyInfo structure\r\n** that defines the format of keys in the index.\r\n**\r\n** This opcode was once called OpenTemp.  But that created\r\n** confusion because the term \"temp table\", might refer either\r\n** to a TEMP table at the SQL level, or to a table opened by\r\n** this opcode.  Then this opcode was call OpenVirtual.  But\r\n** that created confusion with the whole virtual-table idea.\r\n**\r\n** The P5 parameter can be a mask of the BTREE_* flags defined\r\n** in btree.h.  These flags control aspects of the operation of\r\n** the btree.  The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are\r\n** added automatically.\r\n*/\r\n/* Opcode: OpenAutoindex P1 P2 * P4 *\r\n**\r\n** This opcode works the same as OP_OpenEphemeral.  It has a\r\n** different name to distinguish its use.  Tables created using\r\n** by this opcode will be used for automatically created transient\r\n** indices in joins.\r\n*/\r\ncase OP_OpenAutoindex: \r\ncase OP_OpenEphemeral: {\r\n#if 0  /* local variables moved into u.ay */\r\n  VdbeCursor *pCx;\r\n#endif /* local variables moved into u.ay */\r\n  static const int vfsFlags =\r\n      SQLITE_OPEN_READWRITE |\r\n      SQLITE_OPEN_CREATE |\r\n      SQLITE_OPEN_EXCLUSIVE |\r\n      SQLITE_OPEN_DELETEONCLOSE |\r\n      SQLITE_OPEN_TRANSIENT_DB;\r\n\r\n  assert( pOp->p1>=0 );\r\n  u.ay.pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, 1);\r\n  if( u.ay.pCx==0 ) goto no_mem;\r\n  u.ay.pCx->nullRow = 1;\r\n  rc = sqlite3BtreeOpen(db->pVfs, 0, db, &u.ay.pCx->pBt,\r\n                        BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, vfsFlags);\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3BtreeBeginTrans(u.ay.pCx->pBt, 1);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    /* If a transient index is required, create it by calling\r\n    ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before\r\n    ** opening it. If a transient table is required, just use the\r\n    ** automatically created table with root-page 1 (an BLOB_INTKEY table).\r\n    */\r\n    if( pOp->p4.pKeyInfo ){\r\n      int pgno;\r\n      assert( pOp->p4type==P4_KEYINFO );\r\n      rc = sqlite3BtreeCreateTable(u.ay.pCx->pBt, &pgno, BTREE_BLOBKEY | pOp->p5);\r\n      if( rc==SQLITE_OK ){\r\n        assert( pgno==MASTER_ROOT+1 );\r\n        rc = sqlite3BtreeCursor(u.ay.pCx->pBt, pgno, 1,\r\n                                (KeyInfo*)pOp->p4.z, u.ay.pCx->pCursor);\r\n        u.ay.pCx->pKeyInfo = pOp->p4.pKeyInfo;\r\n        u.ay.pCx->pKeyInfo->enc = ENC(p->db);\r\n      }\r\n      u.ay.pCx->isTable = 0;\r\n    }else{\r\n      rc = sqlite3BtreeCursor(u.ay.pCx->pBt, MASTER_ROOT, 1, 0, u.ay.pCx->pCursor);\r\n      u.ay.pCx->isTable = 1;\r\n    }\r\n  }\r\n  u.ay.pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);\r\n  u.ay.pCx->isIndex = !u.ay.pCx->isTable;\r\n  break;\r\n}\r\n\r\n/* Opcode: OpenSorter P1 P2 * P4 *\r\n**\r\n** This opcode works like OP_OpenEphemeral except that it opens\r\n** a transient index that is specifically designed to sort large\r\n** tables using an external merge-sort algorithm.\r\n*/\r\ncase OP_SorterOpen: {\r\n#if 0  /* local variables moved into u.az */\r\n  VdbeCursor *pCx;\r\n#endif /* local variables moved into u.az */\r\n#ifndef SQLITE_OMIT_MERGE_SORT\r\n  u.az.pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, 1);\r\n  if( u.az.pCx==0 ) goto no_mem;\r\n  u.az.pCx->pKeyInfo = pOp->p4.pKeyInfo;\r\n  u.az.pCx->pKeyInfo->enc = ENC(p->db);\r\n  u.az.pCx->isSorter = 1;\r\n  rc = sqlite3VdbeSorterInit(db, u.az.pCx);\r\n#else\r\n  pOp->opcode = OP_OpenEphemeral;\r\n  pc--;\r\n#endif\r\n  break;\r\n}\r\n\r\n/* Opcode: OpenPseudo P1 P2 P3 * *\r\n**\r\n** Open a new cursor that points to a fake table that contains a single\r\n** row of data.  The content of that one row in the content of memory\r\n** register P2.  In other words, cursor P1 becomes an alias for the \r\n** MEM_Blob content contained in register P2.\r\n**\r\n** A pseudo-table created by this opcode is used to hold a single\r\n** row output from the sorter so that the row can be decomposed into\r\n** individual columns using the OP_Column opcode.  The OP_Column opcode\r\n** is the only cursor opcode that works with a pseudo-table.\r\n**\r\n** P3 is the number of fields in the records that will be stored by\r\n** the pseudo-table.\r\n*/\r\ncase OP_OpenPseudo: {\r\n#if 0  /* local variables moved into u.ba */\r\n  VdbeCursor *pCx;\r\n#endif /* local variables moved into u.ba */\r\n\r\n  assert( pOp->p1>=0 );\r\n  u.ba.pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, 0);\r\n  if( u.ba.pCx==0 ) goto no_mem;\r\n  u.ba.pCx->nullRow = 1;\r\n  u.ba.pCx->pseudoTableReg = pOp->p2;\r\n  u.ba.pCx->isTable = 1;\r\n  u.ba.pCx->isIndex = 0;\r\n  break;\r\n}\r\n\r\n/* Opcode: Close P1 * * * *\r\n**\r\n** Close a cursor previously opened as P1.  If P1 is not\r\n** currently open, this instruction is a no-op.\r\n*/\r\ncase OP_Close: {\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  sqlite3VdbeFreeCursor(p, p->apCsr[pOp->p1]);\r\n  p->apCsr[pOp->p1] = 0;\r\n  break;\r\n}\r\n\r\n/* Opcode: SeekGe P1 P2 P3 P4 *\r\n**\r\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \r\n** use the value in register P3 as the key.  If cursor P1 refers \r\n** to an SQL index, then P3 is the first in an array of P4 registers \r\n** that are used as an unpacked index key. \r\n**\r\n** Reposition cursor P1 so that  it points to the smallest entry that \r\n** is greater than or equal to the key value. If there are no records \r\n** greater than or equal to the key and P2 is not zero, then jump to P2.\r\n**\r\n** See also: Found, NotFound, Distinct, SeekLt, SeekGt, SeekLe\r\n*/\r\n/* Opcode: SeekGt P1 P2 P3 P4 *\r\n**\r\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \r\n** use the value in register P3 as a key. If cursor P1 refers \r\n** to an SQL index, then P3 is the first in an array of P4 registers \r\n** that are used as an unpacked index key. \r\n**\r\n** Reposition cursor P1 so that  it points to the smallest entry that \r\n** is greater than the key value. If there are no records greater than \r\n** the key and P2 is not zero, then jump to P2.\r\n**\r\n** See also: Found, NotFound, Distinct, SeekLt, SeekGe, SeekLe\r\n*/\r\n/* Opcode: SeekLt P1 P2 P3 P4 * \r\n**\r\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \r\n** use the value in register P3 as a key. If cursor P1 refers \r\n** to an SQL index, then P3 is the first in an array of P4 registers \r\n** that are used as an unpacked index key. \r\n**\r\n** Reposition cursor P1 so that  it points to the largest entry that \r\n** is less than the key value. If there are no records less than \r\n** the key and P2 is not zero, then jump to P2.\r\n**\r\n** See also: Found, NotFound, Distinct, SeekGt, SeekGe, SeekLe\r\n*/\r\n/* Opcode: SeekLe P1 P2 P3 P4 *\r\n**\r\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \r\n** use the value in register P3 as a key. If cursor P1 refers \r\n** to an SQL index, then P3 is the first in an array of P4 registers \r\n** that are used as an unpacked index key. \r\n**\r\n** Reposition cursor P1 so that it points to the largest entry that \r\n** is less than or equal to the key value. If there are no records \r\n** less than or equal to the key and P2 is not zero, then jump to P2.\r\n**\r\n** See also: Found, NotFound, Distinct, SeekGt, SeekGe, SeekLt\r\n*/\r\ncase OP_SeekLt:         /* jump, in3 */\r\ncase OP_SeekLe:         /* jump, in3 */\r\ncase OP_SeekGe:         /* jump, in3 */\r\ncase OP_SeekGt: {       /* jump, in3 */\r\n#if 0  /* local variables moved into u.bb */\r\n  int res;\r\n  int oc;\r\n  VdbeCursor *pC;\r\n  UnpackedRecord r;\r\n  int nField;\r\n  i64 iKey;      /* The rowid we are to seek to */\r\n#endif /* local variables moved into u.bb */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  assert( pOp->p2!=0 );\r\n  u.bb.pC = p->apCsr[pOp->p1];\r\n  assert( u.bb.pC!=0 );\r\n  assert( u.bb.pC->pseudoTableReg==0 );\r\n  assert( OP_SeekLe == OP_SeekLt+1 );\r\n  assert( OP_SeekGe == OP_SeekLt+2 );\r\n  assert( OP_SeekGt == OP_SeekLt+3 );\r\n  assert( u.bb.pC->isOrdered );\r\n  if( ALWAYS(u.bb.pC->pCursor!=0) ){\r\n    u.bb.oc = pOp->opcode;\r\n    u.bb.pC->nullRow = 0;\r\n    if( u.bb.pC->isTable ){\r\n      /* The input value in P3 might be of any type: integer, real, string,\r\n      ** blob, or NULL.  But it needs to be an integer before we can do\r\n      ** the seek, so covert it. */\r\n      pIn3 = &aMem[pOp->p3];\r\n      applyNumericAffinity(pIn3);\r\n      u.bb.iKey = sqlite3VdbeIntValue(pIn3);\r\n      u.bb.pC->rowidIsValid = 0;\r\n\r\n      /* If the P3 value could not be converted into an integer without\r\n      ** loss of information, then special processing is required... */\r\n      if( (pIn3->flags & MEM_Int)==0 ){\r\n        if( (pIn3->flags & MEM_Real)==0 ){\r\n          /* If the P3 value cannot be converted into any kind of a number,\r\n          ** then the seek is not possible, so jump to P2 */\r\n          pc = pOp->p2 - 1;\r\n          break;\r\n        }\r\n        /* If we reach this point, then the P3 value must be a floating\r\n        ** point number. */\r\n        assert( (pIn3->flags & MEM_Real)!=0 );\r\n\r\n        if( u.bb.iKey==SMALLEST_INT64 && (pIn3->r<(double)u.bb.iKey || pIn3->r>0) ){\r\n          /* The P3 value is too large in magnitude to be expressed as an\r\n          ** integer. */\r\n          u.bb.res = 1;\r\n          if( pIn3->r<0 ){\r\n            if( u.bb.oc>=OP_SeekGe ){  assert( u.bb.oc==OP_SeekGe || u.bb.oc==OP_SeekGt );\r\n              rc = sqlite3BtreeFirst(u.bb.pC->pCursor, &u.bb.res);\r\n              if( rc!=SQLITE_OK ) goto abort_due_to_error;\r\n            }\r\n          }else{\r\n            if( u.bb.oc<=OP_SeekLe ){  assert( u.bb.oc==OP_SeekLt || u.bb.oc==OP_SeekLe );\r\n              rc = sqlite3BtreeLast(u.bb.pC->pCursor, &u.bb.res);\r\n              if( rc!=SQLITE_OK ) goto abort_due_to_error;\r\n            }\r\n          }\r\n          if( u.bb.res ){\r\n            pc = pOp->p2 - 1;\r\n          }\r\n          break;\r\n        }else if( u.bb.oc==OP_SeekLt || u.bb.oc==OP_SeekGe ){\r\n          /* Use the ceiling() function to convert real->int */\r\n          if( pIn3->r > (double)u.bb.iKey ) u.bb.iKey++;\r\n        }else{\r\n          /* Use the floor() function to convert real->int */\r\n          assert( u.bb.oc==OP_SeekLe || u.bb.oc==OP_SeekGt );\r\n          if( pIn3->r < (double)u.bb.iKey ) u.bb.iKey--;\r\n        }\r\n      }\r\n      rc = sqlite3BtreeMovetoUnpacked(u.bb.pC->pCursor, 0, (u64)u.bb.iKey, 0, &u.bb.res);\r\n      if( rc!=SQLITE_OK ){\r\n        goto abort_due_to_error;\r\n      }\r\n      if( u.bb.res==0 ){\r\n        u.bb.pC->rowidIsValid = 1;\r\n        u.bb.pC->lastRowid = u.bb.iKey;\r\n      }\r\n    }else{\r\n      u.bb.nField = pOp->p4.i;\r\n      assert( pOp->p4type==P4_INT32 );\r\n      assert( u.bb.nField>0 );\r\n      u.bb.r.pKeyInfo = u.bb.pC->pKeyInfo;\r\n      u.bb.r.nField = (u16)u.bb.nField;\r\n\r\n      /* The next line of code computes as follows, only faster:\r\n      **   if( u.bb.oc==OP_SeekGt || u.bb.oc==OP_SeekLe ){\r\n      **     u.bb.r.flags = UNPACKED_INCRKEY;\r\n      **   }else{\r\n      **     u.bb.r.flags = 0;\r\n      **   }\r\n      */\r\n      u.bb.r.flags = (u16)(UNPACKED_INCRKEY * (1 & (u.bb.oc - OP_SeekLt)));\r\n      assert( u.bb.oc!=OP_SeekGt || u.bb.r.flags==UNPACKED_INCRKEY );\r\n      assert( u.bb.oc!=OP_SeekLe || u.bb.r.flags==UNPACKED_INCRKEY );\r\n      assert( u.bb.oc!=OP_SeekGe || u.bb.r.flags==0 );\r\n      assert( u.bb.oc!=OP_SeekLt || u.bb.r.flags==0 );\r\n\r\n      u.bb.r.aMem = &aMem[pOp->p3];\r\n#ifdef SQLITE_DEBUG\r\n      { int i; for(i=0; i<u.bb.r.nField; i++) assert( memIsValid(&u.bb.r.aMem[i]) ); }\r\n#endif\r\n      ExpandBlob(u.bb.r.aMem);\r\n      rc = sqlite3BtreeMovetoUnpacked(u.bb.pC->pCursor, &u.bb.r, 0, 0, &u.bb.res);\r\n      if( rc!=SQLITE_OK ){\r\n        goto abort_due_to_error;\r\n      }\r\n      u.bb.pC->rowidIsValid = 0;\r\n    }\r\n    u.bb.pC->deferredMoveto = 0;\r\n    u.bb.pC->cacheStatus = CACHE_STALE;\r\n#ifdef SQLITE_TEST\r\n    sqlite3_search_count++;\r\n#endif\r\n    if( u.bb.oc>=OP_SeekGe ){  assert( u.bb.oc==OP_SeekGe || u.bb.oc==OP_SeekGt );\r\n      if( u.bb.res<0 || (u.bb.res==0 && u.bb.oc==OP_SeekGt) ){\r\n        rc = sqlite3BtreeNext(u.bb.pC->pCursor, &u.bb.res);\r\n        if( rc!=SQLITE_OK ) goto abort_due_to_error;\r\n        u.bb.pC->rowidIsValid = 0;\r\n      }else{\r\n        u.bb.res = 0;\r\n      }\r\n    }else{\r\n      assert( u.bb.oc==OP_SeekLt || u.bb.oc==OP_SeekLe );\r\n      if( u.bb.res>0 || (u.bb.res==0 && u.bb.oc==OP_SeekLt) ){\r\n        rc = sqlite3BtreePrevious(u.bb.pC->pCursor, &u.bb.res);\r\n        if( rc!=SQLITE_OK ) goto abort_due_to_error;\r\n        u.bb.pC->rowidIsValid = 0;\r\n      }else{\r\n        /* u.bb.res might be negative because the table is empty.  Check to\r\n        ** see if this is the case.\r\n        */\r\n        u.bb.res = sqlite3BtreeEof(u.bb.pC->pCursor);\r\n      }\r\n    }\r\n    assert( pOp->p2>0 );\r\n    if( u.bb.res ){\r\n      pc = pOp->p2 - 1;\r\n    }\r\n  }else{\r\n    /* This happens when attempting to open the sqlite3_master table\r\n    ** for read access returns SQLITE_EMPTY. In this case always\r\n    ** take the jump (since there are no records in the table).\r\n    */\r\n    pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Seek P1 P2 * * *\r\n**\r\n** P1 is an open table cursor and P2 is a rowid integer.  Arrange\r\n** for P1 to move so that it points to the rowid given by P2.\r\n**\r\n** This is actually a deferred seek.  Nothing actually happens until\r\n** the cursor is used to read a record.  That way, if no reads\r\n** occur, no unnecessary I/O happens.\r\n*/\r\ncase OP_Seek: {    /* in2 */\r\n#if 0  /* local variables moved into u.bc */\r\n  VdbeCursor *pC;\r\n#endif /* local variables moved into u.bc */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bc.pC = p->apCsr[pOp->p1];\r\n  assert( u.bc.pC!=0 );\r\n  if( ALWAYS(u.bc.pC->pCursor!=0) ){\r\n    assert( u.bc.pC->isTable );\r\n    u.bc.pC->nullRow = 0;\r\n    pIn2 = &aMem[pOp->p2];\r\n    u.bc.pC->movetoTarget = sqlite3VdbeIntValue(pIn2);\r\n    u.bc.pC->rowidIsValid = 0;\r\n    u.bc.pC->deferredMoveto = 1;\r\n  }\r\n  break;\r\n}\r\n  \r\n\r\n/* Opcode: Found P1 P2 P3 P4 *\r\n**\r\n** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If\r\n** P4>0 then register P3 is the first of P4 registers that form an unpacked\r\n** record.\r\n**\r\n** Cursor P1 is on an index btree.  If the record identified by P3 and P4\r\n** is a prefix of any entry in P1 then a jump is made to P2 and\r\n** P1 is left pointing at the matching entry.\r\n*/\r\n/* Opcode: NotFound P1 P2 P3 P4 *\r\n**\r\n** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If\r\n** P4>0 then register P3 is the first of P4 registers that form an unpacked\r\n** record.\r\n** \r\n** Cursor P1 is on an index btree.  If the record identified by P3 and P4\r\n** is not the prefix of any entry in P1 then a jump is made to P2.  If P1 \r\n** does contain an entry whose prefix matches the P3/P4 record then control\r\n** falls through to the next instruction and P1 is left pointing at the\r\n** matching entry.\r\n**\r\n** See also: Found, NotExists, IsUnique\r\n*/\r\ncase OP_NotFound:       /* jump, in3 */\r\ncase OP_Found: {        /* jump, in3 */\r\n#if 0  /* local variables moved into u.bd */\r\n  int alreadyExists;\r\n  VdbeCursor *pC;\r\n  int res;\r\n  char *pFree;\r\n  UnpackedRecord *pIdxKey;\r\n  UnpackedRecord r;\r\n  char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];\r\n#endif /* local variables moved into u.bd */\r\n\r\n#ifdef SQLITE_TEST\r\n  sqlite3_found_count++;\r\n#endif\r\n\r\n  u.bd.alreadyExists = 0;\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  assert( pOp->p4type==P4_INT32 );\r\n  u.bd.pC = p->apCsr[pOp->p1];\r\n  assert( u.bd.pC!=0 );\r\n  pIn3 = &aMem[pOp->p3];\r\n  if( ALWAYS(u.bd.pC->pCursor!=0) ){\r\n\r\n    assert( u.bd.pC->isTable==0 );\r\n    if( pOp->p4.i>0 ){\r\n      u.bd.r.pKeyInfo = u.bd.pC->pKeyInfo;\r\n      u.bd.r.nField = (u16)pOp->p4.i;\r\n      u.bd.r.aMem = pIn3;\r\n#ifdef SQLITE_DEBUG\r\n      { int i; for(i=0; i<u.bd.r.nField; i++) assert( memIsValid(&u.bd.r.aMem[i]) ); }\r\n#endif\r\n      u.bd.r.flags = UNPACKED_PREFIX_MATCH;\r\n      u.bd.pIdxKey = &u.bd.r;\r\n    }else{\r\n      u.bd.pIdxKey = sqlite3VdbeAllocUnpackedRecord(\r\n          u.bd.pC->pKeyInfo, u.bd.aTempRec, sizeof(u.bd.aTempRec), &u.bd.pFree\r\n      );\r\n      if( u.bd.pIdxKey==0 ) goto no_mem;\r\n      assert( pIn3->flags & MEM_Blob );\r\n      assert( (pIn3->flags & MEM_Zero)==0 );  /* zeroblobs already expanded */\r\n      sqlite3VdbeRecordUnpack(u.bd.pC->pKeyInfo, pIn3->n, pIn3->z, u.bd.pIdxKey);\r\n      u.bd.pIdxKey->flags |= UNPACKED_PREFIX_MATCH;\r\n    }\r\n    rc = sqlite3BtreeMovetoUnpacked(u.bd.pC->pCursor, u.bd.pIdxKey, 0, 0, &u.bd.res);\r\n    if( pOp->p4.i==0 ){\r\n      sqlite3DbFree(db, u.bd.pFree);\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      break;\r\n    }\r\n    u.bd.alreadyExists = (u.bd.res==0);\r\n    u.bd.pC->deferredMoveto = 0;\r\n    u.bd.pC->cacheStatus = CACHE_STALE;\r\n  }\r\n  if( pOp->opcode==OP_Found ){\r\n    if( u.bd.alreadyExists ) pc = pOp->p2 - 1;\r\n  }else{\r\n    if( !u.bd.alreadyExists ) pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IsUnique P1 P2 P3 P4 *\r\n**\r\n** Cursor P1 is open on an index b-tree - that is to say, a btree which\r\n** no data and where the key are records generated by OP_MakeRecord with\r\n** the list field being the integer ROWID of the entry that the index\r\n** entry refers to.\r\n**\r\n** The P3 register contains an integer record number. Call this record \r\n** number R. Register P4 is the first in a set of N contiguous registers\r\n** that make up an unpacked index key that can be used with cursor P1.\r\n** The value of N can be inferred from the cursor. N includes the rowid\r\n** value appended to the end of the index record. This rowid value may\r\n** or may not be the same as R.\r\n**\r\n** If any of the N registers beginning with register P4 contains a NULL\r\n** value, jump immediately to P2.\r\n**\r\n** Otherwise, this instruction checks if cursor P1 contains an entry\r\n** where the first (N-1) fields match but the rowid value at the end\r\n** of the index entry is not R. If there is no such entry, control jumps\r\n** to instruction P2. Otherwise, the rowid of the conflicting index\r\n** entry is copied to register P3 and control falls through to the next\r\n** instruction.\r\n**\r\n** See also: NotFound, NotExists, Found\r\n*/\r\ncase OP_IsUnique: {        /* jump, in3 */\r\n#if 0  /* local variables moved into u.be */\r\n  u16 ii;\r\n  VdbeCursor *pCx;\r\n  BtCursor *pCrsr;\r\n  u16 nField;\r\n  Mem *aMx;\r\n  UnpackedRecord r;                  /* B-Tree index search key */\r\n  i64 R;                             /* Rowid stored in register P3 */\r\n#endif /* local variables moved into u.be */\r\n\r\n  pIn3 = &aMem[pOp->p3];\r\n  u.be.aMx = &aMem[pOp->p4.i];\r\n  /* Assert that the values of parameters P1 and P4 are in range. */\r\n  assert( pOp->p4type==P4_INT32 );\r\n  assert( pOp->p4.i>0 && pOp->p4.i<=p->nMem );\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n\r\n  /* Find the index cursor. */\r\n  u.be.pCx = p->apCsr[pOp->p1];\r\n  assert( u.be.pCx->deferredMoveto==0 );\r\n  u.be.pCx->seekResult = 0;\r\n  u.be.pCx->cacheStatus = CACHE_STALE;\r\n  u.be.pCrsr = u.be.pCx->pCursor;\r\n\r\n  /* If any of the values are NULL, take the jump. */\r\n  u.be.nField = u.be.pCx->pKeyInfo->nField;\r\n  for(u.be.ii=0; u.be.ii<u.be.nField; u.be.ii++){\r\n    if( u.be.aMx[u.be.ii].flags & MEM_Null ){\r\n      pc = pOp->p2 - 1;\r\n      u.be.pCrsr = 0;\r\n      break;\r\n    }\r\n  }\r\n  assert( (u.be.aMx[u.be.nField].flags & MEM_Null)==0 );\r\n\r\n  if( u.be.pCrsr!=0 ){\r\n    /* Populate the index search key. */\r\n    u.be.r.pKeyInfo = u.be.pCx->pKeyInfo;\r\n    u.be.r.nField = u.be.nField + 1;\r\n    u.be.r.flags = UNPACKED_PREFIX_SEARCH;\r\n    u.be.r.aMem = u.be.aMx;\r\n#ifdef SQLITE_DEBUG\r\n    { int i; for(i=0; i<u.be.r.nField; i++) assert( memIsValid(&u.be.r.aMem[i]) ); }\r\n#endif\r\n\r\n    /* Extract the value of u.be.R from register P3. */\r\n    sqlite3VdbeMemIntegerify(pIn3);\r\n    u.be.R = pIn3->u.i;\r\n\r\n    /* Search the B-Tree index. If no conflicting record is found, jump\r\n    ** to P2. Otherwise, copy the rowid of the conflicting record to\r\n    ** register P3 and fall through to the next instruction.  */\r\n    rc = sqlite3BtreeMovetoUnpacked(u.be.pCrsr, &u.be.r, 0, 0, &u.be.pCx->seekResult);\r\n    if( (u.be.r.flags & UNPACKED_PREFIX_SEARCH) || u.be.r.rowid==u.be.R ){\r\n      pc = pOp->p2 - 1;\r\n    }else{\r\n      pIn3->u.i = u.be.r.rowid;\r\n    }\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: NotExists P1 P2 P3 * *\r\n**\r\n** Use the content of register P3 as an integer key.  If a record \r\n** with that key does not exist in table of P1, then jump to P2. \r\n** If the record does exist, then fall through.  The cursor is left \r\n** pointing to the record if it exists.\r\n**\r\n** The difference between this operation and NotFound is that this\r\n** operation assumes the key is an integer and that P1 is a table whereas\r\n** NotFound assumes key is a blob constructed from MakeRecord and\r\n** P1 is an index.\r\n**\r\n** See also: Found, NotFound, IsUnique\r\n*/\r\ncase OP_NotExists: {        /* jump, in3 */\r\n#if 0  /* local variables moved into u.bf */\r\n  VdbeCursor *pC;\r\n  BtCursor *pCrsr;\r\n  int res;\r\n  u64 iKey;\r\n#endif /* local variables moved into u.bf */\r\n\r\n  pIn3 = &aMem[pOp->p3];\r\n  assert( pIn3->flags & MEM_Int );\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bf.pC = p->apCsr[pOp->p1];\r\n  assert( u.bf.pC!=0 );\r\n  assert( u.bf.pC->isTable );\r\n  assert( u.bf.pC->pseudoTableReg==0 );\r\n  u.bf.pCrsr = u.bf.pC->pCursor;\r\n  if( ALWAYS(u.bf.pCrsr!=0) ){\r\n    u.bf.res = 0;\r\n    u.bf.iKey = pIn3->u.i;\r\n    rc = sqlite3BtreeMovetoUnpacked(u.bf.pCrsr, 0, u.bf.iKey, 0, &u.bf.res);\r\n    u.bf.pC->lastRowid = pIn3->u.i;\r\n    u.bf.pC->rowidIsValid = u.bf.res==0 ?1:0;\r\n    u.bf.pC->nullRow = 0;\r\n    u.bf.pC->cacheStatus = CACHE_STALE;\r\n    u.bf.pC->deferredMoveto = 0;\r\n    if( u.bf.res!=0 ){\r\n      pc = pOp->p2 - 1;\r\n      assert( u.bf.pC->rowidIsValid==0 );\r\n    }\r\n    u.bf.pC->seekResult = u.bf.res;\r\n  }else{\r\n    /* This happens when an attempt to open a read cursor on the\r\n    ** sqlite_master table returns SQLITE_EMPTY.\r\n    */\r\n    pc = pOp->p2 - 1;\r\n    assert( u.bf.pC->rowidIsValid==0 );\r\n    u.bf.pC->seekResult = 0;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Sequence P1 P2 * * *\r\n**\r\n** Find the next available sequence number for cursor P1.\r\n** Write the sequence number into register P2.\r\n** The sequence number on the cursor is incremented after this\r\n** instruction.  \r\n*/\r\ncase OP_Sequence: {           /* out2-prerelease */\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  assert( p->apCsr[pOp->p1]!=0 );\r\n  pOut->u.i = p->apCsr[pOp->p1]->seqCount++;\r\n  break;\r\n}\r\n\r\n\r\n/* Opcode: NewRowid P1 P2 P3 * *\r\n**\r\n** Get a new integer record number (a.k.a \"rowid\") used as the key to a table.\r\n** The record number is not previously used as a key in the database\r\n** table that cursor P1 points to.  The new record number is written\r\n** written to register P2.\r\n**\r\n** If P3>0 then P3 is a register in the root frame of this VDBE that holds \r\n** the largest previously generated record number. No new record numbers are\r\n** allowed to be less than this value. When this value reaches its maximum, \r\n** an SQLITE_FULL error is generated. The P3 register is updated with the '\r\n** generated record number. This P3 mechanism is used to help implement the\r\n** AUTOINCREMENT feature.\r\n*/\r\ncase OP_NewRowid: {           /* out2-prerelease */\r\n#if 0  /* local variables moved into u.bg */\r\n  i64 v;                 /* The new rowid */\r\n  VdbeCursor *pC;        /* Cursor of table to get the new rowid */\r\n  int res;               /* Result of an sqlite3BtreeLast() */\r\n  int cnt;               /* Counter to limit the number of searches */\r\n  Mem *pMem;             /* Register holding largest rowid for AUTOINCREMENT */\r\n  VdbeFrame *pFrame;     /* Root frame of VDBE */\r\n#endif /* local variables moved into u.bg */\r\n\r\n  u.bg.v = 0;\r\n  u.bg.res = 0;\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bg.pC = p->apCsr[pOp->p1];\r\n  assert( u.bg.pC!=0 );\r\n  if( NEVER(u.bg.pC->pCursor==0) ){\r\n    /* The zero initialization above is all that is needed */\r\n  }else{\r\n    /* The next rowid or record number (different terms for the same\r\n    ** thing) is obtained in a two-step algorithm.\r\n    **\r\n    ** First we attempt to find the largest existing rowid and add one\r\n    ** to that.  But if the largest existing rowid is already the maximum\r\n    ** positive integer, we have to fall through to the second\r\n    ** probabilistic algorithm\r\n    **\r\n    ** The second algorithm is to select a rowid at random and see if\r\n    ** it already exists in the table.  If it does not exist, we have\r\n    ** succeeded.  If the random rowid does exist, we select a new one\r\n    ** and try again, up to 100 times.\r\n    */\r\n    assert( u.bg.pC->isTable );\r\n\r\n#ifdef SQLITE_32BIT_ROWID\r\n#   define MAX_ROWID 0x7fffffff\r\n#else\r\n    /* Some compilers complain about constants of the form 0x7fffffffffffffff.\r\n    ** Others complain about 0x7ffffffffffffffffLL.  The following macro seems\r\n    ** to provide the constant while making all compilers happy.\r\n    */\r\n#   define MAX_ROWID  (i64)( (((u64)0x7fffffff)<<32) | (u64)0xffffffff )\r\n#endif\r\n\r\n    if( !u.bg.pC->useRandomRowid ){\r\n      u.bg.v = sqlite3BtreeGetCachedRowid(u.bg.pC->pCursor);\r\n      if( u.bg.v==0 ){\r\n        rc = sqlite3BtreeLast(u.bg.pC->pCursor, &u.bg.res);\r\n        if( rc!=SQLITE_OK ){\r\n          goto abort_due_to_error;\r\n        }\r\n        if( u.bg.res ){\r\n          u.bg.v = 1;   /* IMP: R-61914-48074 */\r\n        }else{\r\n          assert( sqlite3BtreeCursorIsValid(u.bg.pC->pCursor) );\r\n          rc = sqlite3BtreeKeySize(u.bg.pC->pCursor, &u.bg.v);\r\n          assert( rc==SQLITE_OK );   /* Cannot fail following BtreeLast() */\r\n          if( u.bg.v>=MAX_ROWID ){\r\n            u.bg.pC->useRandomRowid = 1;\r\n          }else{\r\n            u.bg.v++;   /* IMP: R-29538-34987 */\r\n          }\r\n        }\r\n      }\r\n\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n      if( pOp->p3 ){\r\n        /* Assert that P3 is a valid memory cell. */\r\n        assert( pOp->p3>0 );\r\n        if( p->pFrame ){\r\n          for(u.bg.pFrame=p->pFrame; u.bg.pFrame->pParent; u.bg.pFrame=u.bg.pFrame->pParent);\r\n          /* Assert that P3 is a valid memory cell. */\r\n          assert( pOp->p3<=u.bg.pFrame->nMem );\r\n          u.bg.pMem = &u.bg.pFrame->aMem[pOp->p3];\r\n        }else{\r\n          /* Assert that P3 is a valid memory cell. */\r\n          assert( pOp->p3<=p->nMem );\r\n          u.bg.pMem = &aMem[pOp->p3];\r\n          memAboutToChange(p, u.bg.pMem);\r\n        }\r\n        assert( memIsValid(u.bg.pMem) );\r\n\r\n        REGISTER_TRACE(pOp->p3, u.bg.pMem);\r\n        sqlite3VdbeMemIntegerify(u.bg.pMem);\r\n        assert( (u.bg.pMem->flags & MEM_Int)!=0 );  /* mem(P3) holds an integer */\r\n        if( u.bg.pMem->u.i==MAX_ROWID || u.bg.pC->useRandomRowid ){\r\n          rc = SQLITE_FULL;   /* IMP: R-12275-61338 */\r\n          goto abort_due_to_error;\r\n        }\r\n        if( u.bg.v<u.bg.pMem->u.i+1 ){\r\n          u.bg.v = u.bg.pMem->u.i + 1;\r\n        }\r\n        u.bg.pMem->u.i = u.bg.v;\r\n      }\r\n#endif\r\n\r\n      sqlite3BtreeSetCachedRowid(u.bg.pC->pCursor, u.bg.v<MAX_ROWID ? u.bg.v+1 : 0);\r\n    }\r\n    if( u.bg.pC->useRandomRowid ){\r\n      /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the\r\n      ** largest possible integer (9223372036854775807) then the database\r\n      ** engine starts picking positive candidate ROWIDs at random until\r\n      ** it finds one that is not previously used. */\r\n      assert( pOp->p3==0 );  /* We cannot be in random rowid mode if this is\r\n                             ** an AUTOINCREMENT table. */\r\n      /* on the first attempt, simply do one more than previous */\r\n      u.bg.v = lastRowid;\r\n      u.bg.v &= (MAX_ROWID>>1); /* ensure doesn't go negative */\r\n      u.bg.v++; /* ensure non-zero */\r\n      u.bg.cnt = 0;\r\n      while(   ((rc = sqlite3BtreeMovetoUnpacked(u.bg.pC->pCursor, 0, (u64)u.bg.v,\r\n                                                 0, &u.bg.res))==SQLITE_OK)\r\n            && (u.bg.res==0)\r\n            && (++u.bg.cnt<100)){\r\n        /* collision - try another random rowid */\r\n        sqlite3_randomness(sizeof(u.bg.v), &u.bg.v);\r\n        if( u.bg.cnt<5 ){\r\n          /* try \"small\" random rowids for the initial attempts */\r\n          u.bg.v &= 0xffffff;\r\n        }else{\r\n          u.bg.v &= (MAX_ROWID>>1); /* ensure doesn't go negative */\r\n        }\r\n        u.bg.v++; /* ensure non-zero */\r\n      }\r\n      if( rc==SQLITE_OK && u.bg.res==0 ){\r\n        rc = SQLITE_FULL;   /* IMP: R-38219-53002 */\r\n        goto abort_due_to_error;\r\n      }\r\n      assert( u.bg.v>0 );  /* EV: R-40812-03570 */\r\n    }\r\n    u.bg.pC->rowidIsValid = 0;\r\n    u.bg.pC->deferredMoveto = 0;\r\n    u.bg.pC->cacheStatus = CACHE_STALE;\r\n  }\r\n  pOut->u.i = u.bg.v;\r\n  break;\r\n}\r\n\r\n/* Opcode: Insert P1 P2 P3 P4 P5\r\n**\r\n** Write an entry into the table of cursor P1.  A new entry is\r\n** created if it doesn't already exist or the data for an existing\r\n** entry is overwritten.  The data is the value MEM_Blob stored in register\r\n** number P2. The key is stored in register P3. The key must\r\n** be a MEM_Int.\r\n**\r\n** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is\r\n** incremented (otherwise not).  If the OPFLAG_LASTROWID flag of P5 is set,\r\n** then rowid is stored for subsequent return by the\r\n** sqlite3_last_insert_rowid() function (otherwise it is unmodified).\r\n**\r\n** If the OPFLAG_USESEEKRESULT flag of P5 is set and if the result of\r\n** the last seek operation (OP_NotExists) was a success, then this\r\n** operation will not attempt to find the appropriate row before doing\r\n** the insert but will instead overwrite the row that the cursor is\r\n** currently pointing to.  Presumably, the prior OP_NotExists opcode\r\n** has already positioned the cursor correctly.  This is an optimization\r\n** that boosts performance by avoiding redundant seeks.\r\n**\r\n** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an\r\n** UPDATE operation.  Otherwise (if the flag is clear) then this opcode\r\n** is part of an INSERT operation.  The difference is only important to\r\n** the update hook.\r\n**\r\n** Parameter P4 may point to a string containing the table-name, or\r\n** may be NULL. If it is not NULL, then the update-hook \r\n** (sqlite3.xUpdateCallback) is invoked following a successful insert.\r\n**\r\n** (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically\r\n** allocated, then ownership of P2 is transferred to the pseudo-cursor\r\n** and register P2 becomes ephemeral.  If the cursor is changed, the\r\n** value of register P2 will then change.  Make sure this does not\r\n** cause any problems.)\r\n**\r\n** This instruction only works on tables.  The equivalent instruction\r\n** for indices is OP_IdxInsert.\r\n*/\r\n/* Opcode: InsertInt P1 P2 P3 P4 P5\r\n**\r\n** This works exactly like OP_Insert except that the key is the\r\n** integer value P3, not the value of the integer stored in register P3.\r\n*/\r\ncase OP_Insert: \r\ncase OP_InsertInt: {\r\n#if 0  /* local variables moved into u.bh */\r\n  Mem *pData;       /* MEM cell holding data for the record to be inserted */\r\n  Mem *pKey;        /* MEM cell holding key  for the record */\r\n  i64 iKey;         /* The integer ROWID or key for the record to be inserted */\r\n  VdbeCursor *pC;   /* Cursor to table into which insert is written */\r\n  int nZero;        /* Number of zero-bytes to append */\r\n  int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */\r\n  const char *zDb;  /* database name - used by the update hook */\r\n  const char *zTbl; /* Table name - used by the opdate hook */\r\n  int op;           /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */\r\n#endif /* local variables moved into u.bh */\r\n\r\n  u.bh.pData = &aMem[pOp->p2];\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  assert( memIsValid(u.bh.pData) );\r\n  u.bh.pC = p->apCsr[pOp->p1];\r\n  assert( u.bh.pC!=0 );\r\n  assert( u.bh.pC->pCursor!=0 );\r\n  assert( u.bh.pC->pseudoTableReg==0 );\r\n  assert( u.bh.pC->isTable );\r\n  REGISTER_TRACE(pOp->p2, u.bh.pData);\r\n\r\n  if( pOp->opcode==OP_Insert ){\r\n    u.bh.pKey = &aMem[pOp->p3];\r\n    assert( u.bh.pKey->flags & MEM_Int );\r\n    assert( memIsValid(u.bh.pKey) );\r\n    REGISTER_TRACE(pOp->p3, u.bh.pKey);\r\n    u.bh.iKey = u.bh.pKey->u.i;\r\n  }else{\r\n    assert( pOp->opcode==OP_InsertInt );\r\n    u.bh.iKey = pOp->p3;\r\n  }\r\n\r\n  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;\r\n  if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = u.bh.iKey;\r\n  if( u.bh.pData->flags & MEM_Null ){\r\n    u.bh.pData->z = 0;\r\n    u.bh.pData->n = 0;\r\n  }else{\r\n    assert( u.bh.pData->flags & (MEM_Blob|MEM_Str) );\r\n  }\r\n  u.bh.seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? u.bh.pC->seekResult : 0);\r\n  if( u.bh.pData->flags & MEM_Zero ){\r\n    u.bh.nZero = u.bh.pData->u.nZero;\r\n  }else{\r\n    u.bh.nZero = 0;\r\n  }\r\n  sqlite3BtreeSetCachedRowid(u.bh.pC->pCursor, 0);\r\n  rc = sqlite3BtreeInsert(u.bh.pC->pCursor, 0, u.bh.iKey,\r\n                          u.bh.pData->z, u.bh.pData->n, u.bh.nZero,\r\n                          pOp->p5 & OPFLAG_APPEND, u.bh.seekResult\r\n  );\r\n  u.bh.pC->rowidIsValid = 0;\r\n  u.bh.pC->deferredMoveto = 0;\r\n  u.bh.pC->cacheStatus = CACHE_STALE;\r\n\r\n  /* Invoke the update-hook if required. */\r\n  if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){\r\n    u.bh.zDb = db->aDb[u.bh.pC->iDb].zName;\r\n    u.bh.zTbl = pOp->p4.z;\r\n    u.bh.op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT);\r\n    assert( u.bh.pC->isTable );\r\n    db->xUpdateCallback(db->pUpdateArg, u.bh.op, u.bh.zDb, u.bh.zTbl, u.bh.iKey);\r\n    assert( u.bh.pC->iDb>=0 );\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Delete P1 P2 * P4 *\r\n**\r\n** Delete the record at which the P1 cursor is currently pointing.\r\n**\r\n** The cursor will be left pointing at either the next or the previous\r\n** record in the table. If it is left pointing at the next record, then\r\n** the next Next instruction will be a no-op.  Hence it is OK to delete\r\n** a record from within an Next loop.\r\n**\r\n** If the OPFLAG_NCHANGE flag of P2 is set, then the row change count is\r\n** incremented (otherwise not).\r\n**\r\n** P1 must not be pseudo-table.  It has to be a real table with\r\n** multiple rows.\r\n**\r\n** If P4 is not NULL, then it is the name of the table that P1 is\r\n** pointing to.  The update hook will be invoked, if it exists.\r\n** If P4 is not NULL then the P1 cursor must have been positioned\r\n** using OP_NotFound prior to invoking this opcode.\r\n*/\r\ncase OP_Delete: {\r\n#if 0  /* local variables moved into u.bi */\r\n  i64 iKey;\r\n  VdbeCursor *pC;\r\n#endif /* local variables moved into u.bi */\r\n\r\n  u.bi.iKey = 0;\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bi.pC = p->apCsr[pOp->p1];\r\n  assert( u.bi.pC!=0 );\r\n  assert( u.bi.pC->pCursor!=0 );  /* Only valid for real tables, no pseudotables */\r\n\r\n  /* If the update-hook will be invoked, set u.bi.iKey to the rowid of the\r\n  ** row being deleted.\r\n  */\r\n  if( db->xUpdateCallback && pOp->p4.z ){\r\n    assert( u.bi.pC->isTable );\r\n    assert( u.bi.pC->rowidIsValid );  /* lastRowid set by previous OP_NotFound */\r\n    u.bi.iKey = u.bi.pC->lastRowid;\r\n  }\r\n\r\n  /* The OP_Delete opcode always follows an OP_NotExists or OP_Last or\r\n  ** OP_Column on the same table without any intervening operations that\r\n  ** might move or invalidate the cursor.  Hence cursor u.bi.pC is always pointing\r\n  ** to the row to be deleted and the sqlite3VdbeCursorMoveto() operation\r\n  ** below is always a no-op and cannot fail.  We will run it anyhow, though,\r\n  ** to guard against future changes to the code generator.\r\n  **/\r\n  assert( u.bi.pC->deferredMoveto==0 );\r\n  rc = sqlite3VdbeCursorMoveto(u.bi.pC);\r\n  if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error;\r\n\r\n  sqlite3BtreeSetCachedRowid(u.bi.pC->pCursor, 0);\r\n  rc = sqlite3BtreeDelete(u.bi.pC->pCursor);\r\n  u.bi.pC->cacheStatus = CACHE_STALE;\r\n\r\n  /* Invoke the update-hook if required. */\r\n  if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){\r\n    const char *zDb = db->aDb[u.bi.pC->iDb].zName;\r\n    const char *zTbl = pOp->p4.z;\r\n    db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, zTbl, u.bi.iKey);\r\n    assert( u.bi.pC->iDb>=0 );\r\n  }\r\n  if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++;\r\n  break;\r\n}\r\n/* Opcode: ResetCount * * * * *\r\n**\r\n** The value of the change counter is copied to the database handle\r\n** change counter (returned by subsequent calls to sqlite3_changes()).\r\n** Then the VMs internal change counter resets to 0.\r\n** This is used by trigger programs.\r\n*/\r\ncase OP_ResetCount: {\r\n  sqlite3VdbeSetChanges(db, p->nChange);\r\n  p->nChange = 0;\r\n  break;\r\n}\r\n\r\n/* Opcode: SorterCompare P1 P2 P3\r\n**\r\n** P1 is a sorter cursor. This instruction compares the record blob in \r\n** register P3 with the entry that the sorter cursor currently points to.\r\n** If, excluding the rowid fields at the end, the two records are a match,\r\n** fall through to the next instruction. Otherwise, jump to instruction P2.\r\n*/\r\ncase OP_SorterCompare: {\r\n#if 0  /* local variables moved into u.bj */\r\n  VdbeCursor *pC;\r\n  int res;\r\n#endif /* local variables moved into u.bj */\r\n\r\n  u.bj.pC = p->apCsr[pOp->p1];\r\n  assert( isSorter(u.bj.pC) );\r\n  pIn3 = &aMem[pOp->p3];\r\n  rc = sqlite3VdbeSorterCompare(u.bj.pC, pIn3, &u.bj.res);\r\n  if( u.bj.res ){\r\n    pc = pOp->p2-1;\r\n  }\r\n  break;\r\n};\r\n\r\n/* Opcode: SorterData P1 P2 * * *\r\n**\r\n** Write into register P2 the current sorter data for sorter cursor P1.\r\n*/\r\ncase OP_SorterData: {\r\n#if 0  /* local variables moved into u.bk */\r\n  VdbeCursor *pC;\r\n#endif /* local variables moved into u.bk */\r\n#ifndef SQLITE_OMIT_MERGE_SORT\r\n  pOut = &aMem[pOp->p2];\r\n  u.bk.pC = p->apCsr[pOp->p1];\r\n  assert( u.bk.pC->isSorter );\r\n  rc = sqlite3VdbeSorterRowkey(u.bk.pC, pOut);\r\n#else\r\n  pOp->opcode = OP_RowKey;\r\n  pc--;\r\n#endif\r\n  break;\r\n}\r\n\r\n/* Opcode: RowData P1 P2 * * *\r\n**\r\n** Write into register P2 the complete row data for cursor P1.\r\n** There is no interpretation of the data.  \r\n** It is just copied onto the P2 register exactly as \r\n** it is found in the database file.\r\n**\r\n** If the P1 cursor must be pointing to a valid row (not a NULL row)\r\n** of a real table, not a pseudo-table.\r\n*/\r\n/* Opcode: RowKey P1 P2 * * *\r\n**\r\n** Write into register P2 the complete row key for cursor P1.\r\n** There is no interpretation of the data.  \r\n** The key is copied onto the P3 register exactly as \r\n** it is found in the database file.\r\n**\r\n** If the P1 cursor must be pointing to a valid row (not a NULL row)\r\n** of a real table, not a pseudo-table.\r\n*/\r\ncase OP_RowKey:\r\ncase OP_RowData: {\r\n#if 0  /* local variables moved into u.bl */\r\n  VdbeCursor *pC;\r\n  BtCursor *pCrsr;\r\n  u32 n;\r\n  i64 n64;\r\n#endif /* local variables moved into u.bl */\r\n\r\n  pOut = &aMem[pOp->p2];\r\n  memAboutToChange(p, pOut);\r\n\r\n  /* Note that RowKey and RowData are really exactly the same instruction */\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bl.pC = p->apCsr[pOp->p1];\r\n  assert( u.bl.pC->isSorter==0 );\r\n  assert( u.bl.pC->isTable || pOp->opcode!=OP_RowData );\r\n  assert( u.bl.pC->isIndex || pOp->opcode==OP_RowData );\r\n  assert( u.bl.pC!=0 );\r\n  assert( u.bl.pC->nullRow==0 );\r\n  assert( u.bl.pC->pseudoTableReg==0 );\r\n  assert( !u.bl.pC->isSorter );\r\n  assert( u.bl.pC->pCursor!=0 );\r\n  u.bl.pCrsr = u.bl.pC->pCursor;\r\n  assert( sqlite3BtreeCursorIsValid(u.bl.pCrsr) );\r\n\r\n  /* The OP_RowKey and OP_RowData opcodes always follow OP_NotExists or\r\n  ** OP_Rewind/Op_Next with no intervening instructions that might invalidate\r\n  ** the cursor.  Hence the following sqlite3VdbeCursorMoveto() call is always\r\n  ** a no-op and can never fail.  But we leave it in place as a safety.\r\n  */\r\n  assert( u.bl.pC->deferredMoveto==0 );\r\n  rc = sqlite3VdbeCursorMoveto(u.bl.pC);\r\n  if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error;\r\n\r\n  if( u.bl.pC->isIndex ){\r\n    assert( !u.bl.pC->isTable );\r\n    VVA_ONLY(rc =) sqlite3BtreeKeySize(u.bl.pCrsr, &u.bl.n64);\r\n    assert( rc==SQLITE_OK );    /* True because of CursorMoveto() call above */\r\n    if( u.bl.n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n      goto too_big;\r\n    }\r\n    u.bl.n = (u32)u.bl.n64;\r\n  }else{\r\n    VVA_ONLY(rc =) sqlite3BtreeDataSize(u.bl.pCrsr, &u.bl.n);\r\n    assert( rc==SQLITE_OK );    /* DataSize() cannot fail */\r\n    if( u.bl.n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n      goto too_big;\r\n    }\r\n  }\r\n  if( sqlite3VdbeMemGrow(pOut, u.bl.n, 0) ){\r\n    goto no_mem;\r\n  }\r\n  pOut->n = u.bl.n;\r\n  MemSetTypeFlag(pOut, MEM_Blob);\r\n  if( u.bl.pC->isIndex ){\r\n    rc = sqlite3BtreeKey(u.bl.pCrsr, 0, u.bl.n, pOut->z);\r\n  }else{\r\n    rc = sqlite3BtreeData(u.bl.pCrsr, 0, u.bl.n, pOut->z);\r\n  }\r\n  pOut->enc = SQLITE_UTF8;  /* In case the blob is ever cast to text */\r\n  UPDATE_MAX_BLOBSIZE(pOut);\r\n  break;\r\n}\r\n\r\n/* Opcode: Rowid P1 P2 * * *\r\n**\r\n** Store in register P2 an integer which is the key of the table entry that\r\n** P1 is currently point to.\r\n**\r\n** P1 can be either an ordinary table or a virtual table.  There used to\r\n** be a separate OP_VRowid opcode for use with virtual tables, but this\r\n** one opcode now works for both table types.\r\n*/\r\ncase OP_Rowid: {                 /* out2-prerelease */\r\n#if 0  /* local variables moved into u.bm */\r\n  VdbeCursor *pC;\r\n  i64 v;\r\n  sqlite3_vtab *pVtab;\r\n  const sqlite3_module *pModule;\r\n#endif /* local variables moved into u.bm */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bm.pC = p->apCsr[pOp->p1];\r\n  assert( u.bm.pC!=0 );\r\n  assert( u.bm.pC->pseudoTableReg==0 );\r\n  if( u.bm.pC->nullRow ){\r\n    pOut->flags = MEM_Null;\r\n    break;\r\n  }else if( u.bm.pC->deferredMoveto ){\r\n    u.bm.v = u.bm.pC->movetoTarget;\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  }else if( u.bm.pC->pVtabCursor ){\r\n    u.bm.pVtab = u.bm.pC->pVtabCursor->pVtab;\r\n    u.bm.pModule = u.bm.pVtab->pModule;\r\n    assert( u.bm.pModule->xRowid );\r\n    rc = u.bm.pModule->xRowid(u.bm.pC->pVtabCursor, &u.bm.v);\r\n    importVtabErrMsg(p, u.bm.pVtab);\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n  }else{\r\n    assert( u.bm.pC->pCursor!=0 );\r\n    rc = sqlite3VdbeCursorMoveto(u.bm.pC);\r\n    if( rc ) goto abort_due_to_error;\r\n    if( u.bm.pC->rowidIsValid ){\r\n      u.bm.v = u.bm.pC->lastRowid;\r\n    }else{\r\n      rc = sqlite3BtreeKeySize(u.bm.pC->pCursor, &u.bm.v);\r\n      assert( rc==SQLITE_OK );  /* Always so because of CursorMoveto() above */\r\n    }\r\n  }\r\n  pOut->u.i = u.bm.v;\r\n  break;\r\n}\r\n\r\n/* Opcode: NullRow P1 * * * *\r\n**\r\n** Move the cursor P1 to a null row.  Any OP_Column operations\r\n** that occur while the cursor is on the null row will always\r\n** write a NULL.\r\n*/\r\ncase OP_NullRow: {\r\n#if 0  /* local variables moved into u.bn */\r\n  VdbeCursor *pC;\r\n#endif /* local variables moved into u.bn */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bn.pC = p->apCsr[pOp->p1];\r\n  assert( u.bn.pC!=0 );\r\n  u.bn.pC->nullRow = 1;\r\n  u.bn.pC->rowidIsValid = 0;\r\n  assert( u.bn.pC->pCursor || u.bn.pC->pVtabCursor );\r\n  if( u.bn.pC->pCursor ){\r\n    sqlite3BtreeClearCursor(u.bn.pC->pCursor);\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Last P1 P2 * * *\r\n**\r\n** The next use of the Rowid or Column or Next instruction for P1 \r\n** will refer to the last entry in the database table or index.\r\n** If the table or index is empty and P2>0, then jump immediately to P2.\r\n** If P2 is 0 or if the table or index is not empty, fall through\r\n** to the following instruction.\r\n*/\r\ncase OP_Last: {        /* jump */\r\n#if 0  /* local variables moved into u.bo */\r\n  VdbeCursor *pC;\r\n  BtCursor *pCrsr;\r\n  int res;\r\n#endif /* local variables moved into u.bo */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bo.pC = p->apCsr[pOp->p1];\r\n  assert( u.bo.pC!=0 );\r\n  u.bo.pCrsr = u.bo.pC->pCursor;\r\n  u.bo.res = 0;\r\n  if( ALWAYS(u.bo.pCrsr!=0) ){\r\n    rc = sqlite3BtreeLast(u.bo.pCrsr, &u.bo.res);\r\n  }\r\n  u.bo.pC->nullRow = (u8)u.bo.res;\r\n  u.bo.pC->deferredMoveto = 0;\r\n  u.bo.pC->rowidIsValid = 0;\r\n  u.bo.pC->cacheStatus = CACHE_STALE;\r\n  if( pOp->p2>0 && u.bo.res ){\r\n    pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n\r\n/* Opcode: Sort P1 P2 * * *\r\n**\r\n** This opcode does exactly the same thing as OP_Rewind except that\r\n** it increments an undocumented global variable used for testing.\r\n**\r\n** Sorting is accomplished by writing records into a sorting index,\r\n** then rewinding that index and playing it back from beginning to\r\n** end.  We use the OP_Sort opcode instead of OP_Rewind to do the\r\n** rewinding so that the global variable will be incremented and\r\n** regression tests can determine whether or not the optimizer is\r\n** correctly optimizing out sorts.\r\n*/\r\ncase OP_SorterSort:    /* jump */\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n  pOp->opcode = OP_Sort;\r\n#endif\r\ncase OP_Sort: {        /* jump */\r\n#ifdef SQLITE_TEST\r\n  sqlite3_sort_count++;\r\n  sqlite3_search_count--;\r\n#endif\r\n  p->aCounter[SQLITE_STMTSTATUS_SORT-1]++;\r\n  /* Fall through into OP_Rewind */\r\n}\r\n/* Opcode: Rewind P1 P2 * * *\r\n**\r\n** The next use of the Rowid or Column or Next instruction for P1 \r\n** will refer to the first entry in the database table or index.\r\n** If the table or index is empty and P2>0, then jump immediately to P2.\r\n** If P2 is 0 or if the table or index is not empty, fall through\r\n** to the following instruction.\r\n*/\r\ncase OP_Rewind: {        /* jump */\r\n#if 0  /* local variables moved into u.bp */\r\n  VdbeCursor *pC;\r\n  BtCursor *pCrsr;\r\n  int res;\r\n#endif /* local variables moved into u.bp */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bp.pC = p->apCsr[pOp->p1];\r\n  assert( u.bp.pC!=0 );\r\n  assert( u.bp.pC->isSorter==(pOp->opcode==OP_SorterSort) );\r\n  u.bp.res = 1;\r\n  if( isSorter(u.bp.pC) ){\r\n    rc = sqlite3VdbeSorterRewind(db, u.bp.pC, &u.bp.res);\r\n  }else{\r\n    u.bp.pCrsr = u.bp.pC->pCursor;\r\n    assert( u.bp.pCrsr );\r\n    rc = sqlite3BtreeFirst(u.bp.pCrsr, &u.bp.res);\r\n    u.bp.pC->atFirst = u.bp.res==0 ?1:0;\r\n    u.bp.pC->deferredMoveto = 0;\r\n    u.bp.pC->cacheStatus = CACHE_STALE;\r\n    u.bp.pC->rowidIsValid = 0;\r\n  }\r\n  u.bp.pC->nullRow = (u8)u.bp.res;\r\n  assert( pOp->p2>0 && pOp->p2<p->nOp );\r\n  if( u.bp.res ){\r\n    pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Next P1 P2 * P4 P5\r\n**\r\n** Advance cursor P1 so that it points to the next key/data pair in its\r\n** table or index.  If there are no more key/value pairs then fall through\r\n** to the following instruction.  But if the cursor advance was successful,\r\n** jump immediately to P2.\r\n**\r\n** The P1 cursor must be for a real table, not a pseudo-table.\r\n**\r\n** P4 is always of type P4_ADVANCE. The function pointer points to\r\n** sqlite3BtreeNext().\r\n**\r\n** If P5 is positive and the jump is taken, then event counter\r\n** number P5-1 in the prepared statement is incremented.\r\n**\r\n** See also: Prev\r\n*/\r\n/* Opcode: Prev P1 P2 * * P5\r\n**\r\n** Back up cursor P1 so that it points to the previous key/data pair in its\r\n** table or index.  If there is no previous key/value pairs then fall through\r\n** to the following instruction.  But if the cursor backup was successful,\r\n** jump immediately to P2.\r\n**\r\n** The P1 cursor must be for a real table, not a pseudo-table.\r\n**\r\n** P4 is always of type P4_ADVANCE. The function pointer points to\r\n** sqlite3BtreePrevious().\r\n**\r\n** If P5 is positive and the jump is taken, then event counter\r\n** number P5-1 in the prepared statement is incremented.\r\n*/\r\ncase OP_SorterNext:    /* jump */\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n  pOp->opcode = OP_Next;\r\n#endif\r\ncase OP_Prev:          /* jump */\r\ncase OP_Next: {        /* jump */\r\n#if 0  /* local variables moved into u.bq */\r\n  VdbeCursor *pC;\r\n  int res;\r\n#endif /* local variables moved into u.bq */\r\n\r\n  CHECK_FOR_INTERRUPT;\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  assert( pOp->p5<=ArraySize(p->aCounter) );\r\n  u.bq.pC = p->apCsr[pOp->p1];\r\n  if( u.bq.pC==0 ){\r\n    break;  /* See ticket #2273 */\r\n  }\r\n  assert( u.bq.pC->isSorter==(pOp->opcode==OP_SorterNext) );\r\n  if( isSorter(u.bq.pC) ){\r\n    assert( pOp->opcode==OP_SorterNext );\r\n    rc = sqlite3VdbeSorterNext(db, u.bq.pC, &u.bq.res);\r\n  }else{\r\n    u.bq.res = 1;\r\n    assert( u.bq.pC->deferredMoveto==0 );\r\n    assert( u.bq.pC->pCursor );\r\n    assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );\r\n    assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious );\r\n    rc = pOp->p4.xAdvance(u.bq.pC->pCursor, &u.bq.res);\r\n  }\r\n  u.bq.pC->nullRow = (u8)u.bq.res;\r\n  u.bq.pC->cacheStatus = CACHE_STALE;\r\n  if( u.bq.res==0 ){\r\n    pc = pOp->p2 - 1;\r\n    if( pOp->p5 ) p->aCounter[pOp->p5-1]++;\r\n#ifdef SQLITE_TEST\r\n    sqlite3_search_count++;\r\n#endif\r\n  }\r\n  u.bq.pC->rowidIsValid = 0;\r\n  break;\r\n}\r\n\r\n/* Opcode: IdxInsert P1 P2 P3 * P5\r\n**\r\n** Register P2 holds an SQL index key made using the\r\n** MakeRecord instructions.  This opcode writes that key\r\n** into the index P1.  Data for the entry is nil.\r\n**\r\n** P3 is a flag that provides a hint to the b-tree layer that this\r\n** insert is likely to be an append.\r\n**\r\n** This instruction only works for indices.  The equivalent instruction\r\n** for tables is OP_Insert.\r\n*/\r\ncase OP_SorterInsert:       /* in2 */\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n  pOp->opcode = OP_IdxInsert;\r\n#endif\r\ncase OP_IdxInsert: {        /* in2 */\r\n#if 0  /* local variables moved into u.br */\r\n  VdbeCursor *pC;\r\n  BtCursor *pCrsr;\r\n  int nKey;\r\n  const char *zKey;\r\n#endif /* local variables moved into u.br */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.br.pC = p->apCsr[pOp->p1];\r\n  assert( u.br.pC!=0 );\r\n  assert( u.br.pC->isSorter==(pOp->opcode==OP_SorterInsert) );\r\n  pIn2 = &aMem[pOp->p2];\r\n  assert( pIn2->flags & MEM_Blob );\r\n  u.br.pCrsr = u.br.pC->pCursor;\r\n  if( ALWAYS(u.br.pCrsr!=0) ){\r\n    assert( u.br.pC->isTable==0 );\r\n    rc = ExpandBlob(pIn2);\r\n    if( rc==SQLITE_OK ){\r\n      if( isSorter(u.br.pC) ){\r\n        rc = sqlite3VdbeSorterWrite(db, u.br.pC, pIn2);\r\n      }else{\r\n        u.br.nKey = pIn2->n;\r\n        u.br.zKey = pIn2->z;\r\n        rc = sqlite3BtreeInsert(u.br.pCrsr, u.br.zKey, u.br.nKey, \"\", 0, 0, pOp->p3,\r\n            ((pOp->p5 & OPFLAG_USESEEKRESULT) ? u.br.pC->seekResult : 0)\r\n            );\r\n        assert( u.br.pC->deferredMoveto==0 );\r\n        u.br.pC->cacheStatus = CACHE_STALE;\r\n      }\r\n    }\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IdxDelete P1 P2 P3 * *\r\n**\r\n** The content of P3 registers starting at register P2 form\r\n** an unpacked index key. This opcode removes that entry from the \r\n** index opened by cursor P1.\r\n*/\r\ncase OP_IdxDelete: {\r\n#if 0  /* local variables moved into u.bs */\r\n  VdbeCursor *pC;\r\n  BtCursor *pCrsr;\r\n  int res;\r\n  UnpackedRecord r;\r\n#endif /* local variables moved into u.bs */\r\n\r\n  assert( pOp->p3>0 );\r\n  assert( pOp->p2>0 && pOp->p2+pOp->p3<=p->nMem+1 );\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bs.pC = p->apCsr[pOp->p1];\r\n  assert( u.bs.pC!=0 );\r\n  u.bs.pCrsr = u.bs.pC->pCursor;\r\n  if( ALWAYS(u.bs.pCrsr!=0) ){\r\n    u.bs.r.pKeyInfo = u.bs.pC->pKeyInfo;\r\n    u.bs.r.nField = (u16)pOp->p3;\r\n    u.bs.r.flags = 0;\r\n    u.bs.r.aMem = &aMem[pOp->p2];\r\n#ifdef SQLITE_DEBUG\r\n    { int i; for(i=0; i<u.bs.r.nField; i++) assert( memIsValid(&u.bs.r.aMem[i]) ); }\r\n#endif\r\n    rc = sqlite3BtreeMovetoUnpacked(u.bs.pCrsr, &u.bs.r, 0, 0, &u.bs.res);\r\n    if( rc==SQLITE_OK && u.bs.res==0 ){\r\n      rc = sqlite3BtreeDelete(u.bs.pCrsr);\r\n    }\r\n    assert( u.bs.pC->deferredMoveto==0 );\r\n    u.bs.pC->cacheStatus = CACHE_STALE;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IdxRowid P1 P2 * * *\r\n**\r\n** Write into register P2 an integer which is the last entry in the record at\r\n** the end of the index key pointed to by cursor P1.  This integer should be\r\n** the rowid of the table entry to which this index entry points.\r\n**\r\n** See also: Rowid, MakeRecord.\r\n*/\r\ncase OP_IdxRowid: {              /* out2-prerelease */\r\n#if 0  /* local variables moved into u.bt */\r\n  BtCursor *pCrsr;\r\n  VdbeCursor *pC;\r\n  i64 rowid;\r\n#endif /* local variables moved into u.bt */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bt.pC = p->apCsr[pOp->p1];\r\n  assert( u.bt.pC!=0 );\r\n  u.bt.pCrsr = u.bt.pC->pCursor;\r\n  pOut->flags = MEM_Null;\r\n  if( ALWAYS(u.bt.pCrsr!=0) ){\r\n    rc = sqlite3VdbeCursorMoveto(u.bt.pC);\r\n    if( NEVER(rc) ) goto abort_due_to_error;\r\n    assert( u.bt.pC->deferredMoveto==0 );\r\n    assert( u.bt.pC->isTable==0 );\r\n    if( !u.bt.pC->nullRow ){\r\n      rc = sqlite3VdbeIdxRowid(db, u.bt.pCrsr, &u.bt.rowid);\r\n      if( rc!=SQLITE_OK ){\r\n        goto abort_due_to_error;\r\n      }\r\n      pOut->u.i = u.bt.rowid;\r\n      pOut->flags = MEM_Int;\r\n    }\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IdxGE P1 P2 P3 P4 P5\r\n**\r\n** The P4 register values beginning with P3 form an unpacked index \r\n** key that omits the ROWID.  Compare this key value against the index \r\n** that P1 is currently pointing to, ignoring the ROWID on the P1 index.\r\n**\r\n** If the P1 index entry is greater than or equal to the key value\r\n** then jump to P2.  Otherwise fall through to the next instruction.\r\n**\r\n** If P5 is non-zero then the key value is increased by an epsilon \r\n** prior to the comparison.  This make the opcode work like IdxGT except\r\n** that if the key from register P3 is a prefix of the key in the cursor,\r\n** the result is false whereas it would be true with IdxGT.\r\n*/\r\n/* Opcode: IdxLT P1 P2 P3 P4 P5\r\n**\r\n** The P4 register values beginning with P3 form an unpacked index \r\n** key that omits the ROWID.  Compare this key value against the index \r\n** that P1 is currently pointing to, ignoring the ROWID on the P1 index.\r\n**\r\n** If the P1 index entry is less than the key value then jump to P2.\r\n** Otherwise fall through to the next instruction.\r\n**\r\n** If P5 is non-zero then the key value is increased by an epsilon prior \r\n** to the comparison.  This makes the opcode work like IdxLE.\r\n*/\r\ncase OP_IdxLT:          /* jump */\r\ncase OP_IdxGE: {        /* jump */\r\n#if 0  /* local variables moved into u.bu */\r\n  VdbeCursor *pC;\r\n  int res;\r\n  UnpackedRecord r;\r\n#endif /* local variables moved into u.bu */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\r\n  u.bu.pC = p->apCsr[pOp->p1];\r\n  assert( u.bu.pC!=0 );\r\n  assert( u.bu.pC->isOrdered );\r\n  if( ALWAYS(u.bu.pC->pCursor!=0) ){\r\n    assert( u.bu.pC->deferredMoveto==0 );\r\n    assert( pOp->p5==0 || pOp->p5==1 );\r\n    assert( pOp->p4type==P4_INT32 );\r\n    u.bu.r.pKeyInfo = u.bu.pC->pKeyInfo;\r\n    u.bu.r.nField = (u16)pOp->p4.i;\r\n    if( pOp->p5 ){\r\n      u.bu.r.flags = UNPACKED_INCRKEY | UNPACKED_PREFIX_MATCH;\r\n    }else{\r\n      u.bu.r.flags = UNPACKED_PREFIX_MATCH;\r\n    }\r\n    u.bu.r.aMem = &aMem[pOp->p3];\r\n#ifdef SQLITE_DEBUG\r\n    { int i; for(i=0; i<u.bu.r.nField; i++) assert( memIsValid(&u.bu.r.aMem[i]) ); }\r\n#endif\r\n    rc = sqlite3VdbeIdxKeyCompare(u.bu.pC, &u.bu.r, &u.bu.res);\r\n    if( pOp->opcode==OP_IdxLT ){\r\n      u.bu.res = -u.bu.res;\r\n    }else{\r\n      assert( pOp->opcode==OP_IdxGE );\r\n      u.bu.res++;\r\n    }\r\n    if( u.bu.res>0 ){\r\n      pc = pOp->p2 - 1 ;\r\n    }\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Destroy P1 P2 P3 * *\r\n**\r\n** Delete an entire database table or index whose root page in the database\r\n** file is given by P1.\r\n**\r\n** The table being destroyed is in the main database file if P3==0.  If\r\n** P3==1 then the table to be clear is in the auxiliary database file\r\n** that is used to store tables create using CREATE TEMPORARY TABLE.\r\n**\r\n** If AUTOVACUUM is enabled then it is possible that another root page\r\n** might be moved into the newly deleted root page in order to keep all\r\n** root pages contiguous at the beginning of the database.  The former\r\n** value of the root page that moved - its value before the move occurred -\r\n** is stored in register P2.  If no page \r\n** movement was required (because the table being dropped was already \r\n** the last one in the database) then a zero is stored in register P2.\r\n** If AUTOVACUUM is disabled then a zero is stored in register P2.\r\n**\r\n** See also: Clear\r\n*/\r\ncase OP_Destroy: {     /* out2-prerelease */\r\n#if 0  /* local variables moved into u.bv */\r\n  int iMoved;\r\n  int iCnt;\r\n  Vdbe *pVdbe;\r\n  int iDb;\r\n#endif /* local variables moved into u.bv */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  u.bv.iCnt = 0;\r\n  for(u.bv.pVdbe=db->pVdbe; u.bv.pVdbe; u.bv.pVdbe = u.bv.pVdbe->pNext){\r\n    if( u.bv.pVdbe->magic==VDBE_MAGIC_RUN && u.bv.pVdbe->inVtabMethod<2 && u.bv.pVdbe->pc>=0 ){\r\n      u.bv.iCnt++;\r\n    }\r\n  }\r\n#else\r\n  u.bv.iCnt = db->activeVdbeCnt;\r\n#endif\r\n  pOut->flags = MEM_Null;\r\n  if( u.bv.iCnt>1 ){\r\n    rc = SQLITE_LOCKED;\r\n    p->errorAction = OE_Abort;\r\n  }else{\r\n    u.bv.iDb = pOp->p3;\r\n    assert( u.bv.iCnt==1 );\r\n    assert( (p->btreeMask & (((yDbMask)1)<<u.bv.iDb))!=0 );\r\n    rc = sqlite3BtreeDropTable(db->aDb[u.bv.iDb].pBt, pOp->p1, &u.bv.iMoved);\r\n    pOut->flags = MEM_Int;\r\n    pOut->u.i = u.bv.iMoved;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    if( rc==SQLITE_OK && u.bv.iMoved!=0 ){\r\n      sqlite3RootPageMoved(db, u.bv.iDb, u.bv.iMoved, pOp->p1);\r\n      /* All OP_Destroy operations occur on the same btree */\r\n      assert( resetSchemaOnFault==0 || resetSchemaOnFault==u.bv.iDb+1 );\r\n      resetSchemaOnFault = u.bv.iDb+1;\r\n    }\r\n#endif\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: Clear P1 P2 P3\r\n**\r\n** Delete all contents of the database table or index whose root page\r\n** in the database file is given by P1.  But, unlike Destroy, do not\r\n** remove the table or index from the database file.\r\n**\r\n** The table being clear is in the main database file if P2==0.  If\r\n** P2==1 then the table to be clear is in the auxiliary database file\r\n** that is used to store tables create using CREATE TEMPORARY TABLE.\r\n**\r\n** If the P3 value is non-zero, then the table referred to must be an\r\n** intkey table (an SQL table, not an index). In this case the row change \r\n** count is incremented by the number of rows in the table being cleared. \r\n** If P3 is greater than zero, then the value stored in register P3 is\r\n** also incremented by the number of rows in the table being cleared.\r\n**\r\n** See also: Destroy\r\n*/\r\ncase OP_Clear: {\r\n#if 0  /* local variables moved into u.bw */\r\n  int nChange;\r\n#endif /* local variables moved into u.bw */\r\n\r\n  u.bw.nChange = 0;\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p2))!=0 );\r\n  rc = sqlite3BtreeClearTable(\r\n      db->aDb[pOp->p2].pBt, pOp->p1, (pOp->p3 ? &u.bw.nChange : 0)\r\n  );\r\n  if( pOp->p3 ){\r\n    p->nChange += u.bw.nChange;\r\n    if( pOp->p3>0 ){\r\n      assert( memIsValid(&aMem[pOp->p3]) );\r\n      memAboutToChange(p, &aMem[pOp->p3]);\r\n      aMem[pOp->p3].u.i += u.bw.nChange;\r\n    }\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: CreateTable P1 P2 * * *\r\n**\r\n** Allocate a new table in the main database file if P1==0 or in the\r\n** auxiliary database file if P1==1 or in an attached database if\r\n** P1>1.  Write the root page number of the new table into\r\n** register P2\r\n**\r\n** The difference between a table and an index is this:  A table must\r\n** have a 4-byte integer key and can have arbitrary data.  An index\r\n** has an arbitrary key but no data.\r\n**\r\n** See also: CreateIndex\r\n*/\r\n/* Opcode: CreateIndex P1 P2 * * *\r\n**\r\n** Allocate a new index in the main database file if P1==0 or in the\r\n** auxiliary database file if P1==1 or in an attached database if\r\n** P1>1.  Write the root page number of the new table into\r\n** register P2.\r\n**\r\n** See documentation on OP_CreateTable for additional information.\r\n*/\r\ncase OP_CreateIndex:            /* out2-prerelease */\r\ncase OP_CreateTable: {          /* out2-prerelease */\r\n#if 0  /* local variables moved into u.bx */\r\n  int pgno;\r\n  int flags;\r\n  Db *pDb;\r\n#endif /* local variables moved into u.bx */\r\n\r\n  u.bx.pgno = 0;\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );\r\n  u.bx.pDb = &db->aDb[pOp->p1];\r\n  assert( u.bx.pDb->pBt!=0 );\r\n  if( pOp->opcode==OP_CreateTable ){\r\n    /* u.bx.flags = BTREE_INTKEY; */\r\n    u.bx.flags = BTREE_INTKEY;\r\n  }else{\r\n    u.bx.flags = BTREE_BLOBKEY;\r\n  }\r\n  rc = sqlite3BtreeCreateTable(u.bx.pDb->pBt, &u.bx.pgno, u.bx.flags);\r\n  pOut->u.i = u.bx.pgno;\r\n  break;\r\n}\r\n\r\n/* Opcode: ParseSchema P1 * * P4 *\r\n**\r\n** Read and parse all entries from the SQLITE_MASTER table of database P1\r\n** that match the WHERE clause P4. \r\n**\r\n** This opcode invokes the parser to create a new virtual machine,\r\n** then runs the new virtual machine.  It is thus a re-entrant opcode.\r\n*/\r\ncase OP_ParseSchema: {\r\n#if 0  /* local variables moved into u.by */\r\n  int iDb;\r\n  const char *zMaster;\r\n  char *zSql;\r\n  InitData initData;\r\n#endif /* local variables moved into u.by */\r\n\r\n  /* Any prepared statement that invokes this opcode will hold mutexes\r\n  ** on every btree.  This is a prerequisite for invoking\r\n  ** sqlite3InitCallback().\r\n  */\r\n#ifdef SQLITE_DEBUG\r\n  for(u.by.iDb=0; u.by.iDb<db->nDb; u.by.iDb++){\r\n    assert( u.by.iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[u.by.iDb].pBt) );\r\n  }\r\n#endif\r\n\r\n  u.by.iDb = pOp->p1;\r\n  assert( u.by.iDb>=0 && u.by.iDb<db->nDb );\r\n  assert( DbHasProperty(db, u.by.iDb, DB_SchemaLoaded) );\r\n  /* Used to be a conditional */ {\r\n    u.by.zMaster = SCHEMA_TABLE(u.by.iDb);\r\n    u.by.initData.db = db;\r\n    u.by.initData.iDb = pOp->p1;\r\n    u.by.initData.pzErrMsg = &p->zErrMsg;\r\n    u.by.zSql = sqlite3MPrintf(db,\r\n       \"SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid\",\r\n       db->aDb[u.by.iDb].zName, u.by.zMaster, pOp->p4.z);\r\n    if( u.by.zSql==0 ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      assert( db->init.busy==0 );\r\n      db->init.busy = 1;\r\n      u.by.initData.rc = SQLITE_OK;\r\n      assert( !db->mallocFailed );\r\n      rc = sqlite3_exec(db, u.by.zSql, sqlite3InitCallback, &u.by.initData, 0);\r\n      if( rc==SQLITE_OK ) rc = u.by.initData.rc;\r\n      sqlite3DbFree(db, u.by.zSql);\r\n      db->init.busy = 0;\r\n    }\r\n  }\r\n  if( rc ) sqlite3ResetInternalSchema(db, -1);\r\n  if( rc==SQLITE_NOMEM ){\r\n    goto no_mem;\r\n  }\r\n  break;\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_ANALYZE)\r\n/* Opcode: LoadAnalysis P1 * * * *\r\n**\r\n** Read the sqlite_stat1 table for database P1 and load the content\r\n** of that table into the internal index hash table.  This will cause\r\n** the analysis to be used when preparing all subsequent queries.\r\n*/\r\ncase OP_LoadAnalysis: {\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n  rc = sqlite3AnalysisLoad(db, pOp->p1);\r\n  break;  \r\n}\r\n#endif /* !defined(SQLITE_OMIT_ANALYZE) */\r\n\r\n/* Opcode: DropTable P1 * * P4 *\r\n**\r\n** Remove the internal (in-memory) data structures that describe\r\n** the table named P4 in database P1.  This is called after a table\r\n** is dropped in order to keep the internal representation of the\r\n** schema consistent with what is on disk.\r\n*/\r\ncase OP_DropTable: {\r\n  sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z);\r\n  break;\r\n}\r\n\r\n/* Opcode: DropIndex P1 * * P4 *\r\n**\r\n** Remove the internal (in-memory) data structures that describe\r\n** the index named P4 in database P1.  This is called after an index\r\n** is dropped in order to keep the internal representation of the\r\n** schema consistent with what is on disk.\r\n*/\r\ncase OP_DropIndex: {\r\n  sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z);\r\n  break;\r\n}\r\n\r\n/* Opcode: DropTrigger P1 * * P4 *\r\n**\r\n** Remove the internal (in-memory) data structures that describe\r\n** the trigger named P4 in database P1.  This is called after a trigger\r\n** is dropped in order to keep the internal representation of the\r\n** schema consistent with what is on disk.\r\n*/\r\ncase OP_DropTrigger: {\r\n  sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z);\r\n  break;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\r\n/* Opcode: IntegrityCk P1 P2 P3 * P5\r\n**\r\n** Do an analysis of the currently open database.  Store in\r\n** register P1 the text of an error message describing any problems.\r\n** If no problems are found, store a NULL in register P1.\r\n**\r\n** The register P3 contains the maximum number of allowed errors.\r\n** At most reg(P3) errors will be reported.\r\n** In other words, the analysis stops as soon as reg(P1) errors are \r\n** seen.  Reg(P1) is updated with the number of errors remaining.\r\n**\r\n** The root page numbers of all tables in the database are integer\r\n** stored in reg(P1), reg(P1+1), reg(P1+2), ....  There are P2 tables\r\n** total.\r\n**\r\n** If P5 is not zero, the check is done on the auxiliary database\r\n** file, not the main database file.\r\n**\r\n** This opcode is used to implement the integrity_check pragma.\r\n*/\r\ncase OP_IntegrityCk: {\r\n#if 0  /* local variables moved into u.bz */\r\n  int nRoot;      /* Number of tables to check.  (Number of root pages.) */\r\n  int *aRoot;     /* Array of rootpage numbers for tables to be checked */\r\n  int j;          /* Loop counter */\r\n  int nErr;       /* Number of errors reported */\r\n  char *z;        /* Text of the error report */\r\n  Mem *pnErr;     /* Register keeping track of errors remaining */\r\n#endif /* local variables moved into u.bz */\r\n\r\n  u.bz.nRoot = pOp->p2;\r\n  assert( u.bz.nRoot>0 );\r\n  u.bz.aRoot = sqlite3DbMallocRaw(db, sizeof(int)*(u.bz.nRoot+1) );\r\n  if( u.bz.aRoot==0 ) goto no_mem;\r\n  assert( pOp->p3>0 && pOp->p3<=p->nMem );\r\n  u.bz.pnErr = &aMem[pOp->p3];\r\n  assert( (u.bz.pnErr->flags & MEM_Int)!=0 );\r\n  assert( (u.bz.pnErr->flags & (MEM_Str|MEM_Blob))==0 );\r\n  pIn1 = &aMem[pOp->p1];\r\n  for(u.bz.j=0; u.bz.j<u.bz.nRoot; u.bz.j++){\r\n    u.bz.aRoot[u.bz.j] = (int)sqlite3VdbeIntValue(&pIn1[u.bz.j]);\r\n  }\r\n  u.bz.aRoot[u.bz.j] = 0;\r\n  assert( pOp->p5<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p5))!=0 );\r\n  u.bz.z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, u.bz.aRoot, u.bz.nRoot,\r\n                                 (int)u.bz.pnErr->u.i, &u.bz.nErr);\r\n  sqlite3DbFree(db, u.bz.aRoot);\r\n  u.bz.pnErr->u.i -= u.bz.nErr;\r\n  sqlite3VdbeMemSetNull(pIn1);\r\n  if( u.bz.nErr==0 ){\r\n    assert( u.bz.z==0 );\r\n  }else if( u.bz.z==0 ){\r\n    goto no_mem;\r\n  }else{\r\n    sqlite3VdbeMemSetStr(pIn1, u.bz.z, -1, SQLITE_UTF8, sqlite3_free);\r\n  }\r\n  UPDATE_MAX_BLOBSIZE(pIn1);\r\n  sqlite3VdbeChangeEncoding(pIn1, encoding);\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\r\n\r\n/* Opcode: RowSetAdd P1 P2 * * *\r\n**\r\n** Insert the integer value held by register P2 into a boolean index\r\n** held in register P1.\r\n**\r\n** An assertion fails if P2 is not an integer.\r\n*/\r\ncase OP_RowSetAdd: {       /* in1, in2 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  pIn2 = &aMem[pOp->p2];\r\n  assert( (pIn2->flags & MEM_Int)!=0 );\r\n  if( (pIn1->flags & MEM_RowSet)==0 ){\r\n    sqlite3VdbeMemSetRowSet(pIn1);\r\n    if( (pIn1->flags & MEM_RowSet)==0 ) goto no_mem;\r\n  }\r\n  sqlite3RowSetInsert(pIn1->u.pRowSet, pIn2->u.i);\r\n  break;\r\n}\r\n\r\n/* Opcode: RowSetRead P1 P2 P3 * *\r\n**\r\n** Extract the smallest value from boolean index P1 and put that value into\r\n** register P3.  Or, if boolean index P1 is initially empty, leave P3\r\n** unchanged and jump to instruction P2.\r\n*/\r\ncase OP_RowSetRead: {       /* jump, in1, out3 */\r\n#if 0  /* local variables moved into u.ca */\r\n  i64 val;\r\n#endif /* local variables moved into u.ca */\r\n  CHECK_FOR_INTERRUPT;\r\n  pIn1 = &aMem[pOp->p1];\r\n  if( (pIn1->flags & MEM_RowSet)==0\r\n   || sqlite3RowSetNext(pIn1->u.pRowSet, &u.ca.val)==0\r\n  ){\r\n    /* The boolean index is empty */\r\n    sqlite3VdbeMemSetNull(pIn1);\r\n    pc = pOp->p2 - 1;\r\n  }else{\r\n    /* A value was pulled from the index */\r\n    sqlite3VdbeMemSetInt64(&aMem[pOp->p3], u.ca.val);\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: RowSetTest P1 P2 P3 P4\r\n**\r\n** Register P3 is assumed to hold a 64-bit integer value. If register P1\r\n** contains a RowSet object and that RowSet object contains\r\n** the value held in P3, jump to register P2. Otherwise, insert the\r\n** integer in P3 into the RowSet and continue on to the\r\n** next opcode.\r\n**\r\n** The RowSet object is optimized for the case where successive sets\r\n** of integers, where each set contains no duplicates. Each set\r\n** of values is identified by a unique P4 value. The first set\r\n** must have P4==0, the final set P4=-1.  P4 must be either -1 or\r\n** non-negative.  For non-negative values of P4 only the lower 4\r\n** bits are significant.\r\n**\r\n** This allows optimizations: (a) when P4==0 there is no need to test\r\n** the rowset object for P3, as it is guaranteed not to contain it,\r\n** (b) when P4==-1 there is no need to insert the value, as it will\r\n** never be tested for, and (c) when a value that is part of set X is\r\n** inserted, there is no need to search to see if the same value was\r\n** previously inserted as part of set X (only if it was previously\r\n** inserted as part of some other set).\r\n*/\r\ncase OP_RowSetTest: {                     /* jump, in1, in3 */\r\n#if 0  /* local variables moved into u.cb */\r\n  int iSet;\r\n  int exists;\r\n#endif /* local variables moved into u.cb */\r\n\r\n  pIn1 = &aMem[pOp->p1];\r\n  pIn3 = &aMem[pOp->p3];\r\n  u.cb.iSet = pOp->p4.i;\r\n  assert( pIn3->flags&MEM_Int );\r\n\r\n  /* If there is anything other than a rowset object in memory cell P1,\r\n  ** delete it now and initialize P1 with an empty rowset\r\n  */\r\n  if( (pIn1->flags & MEM_RowSet)==0 ){\r\n    sqlite3VdbeMemSetRowSet(pIn1);\r\n    if( (pIn1->flags & MEM_RowSet)==0 ) goto no_mem;\r\n  }\r\n\r\n  assert( pOp->p4type==P4_INT32 );\r\n  assert( u.cb.iSet==-1 || u.cb.iSet>=0 );\r\n  if( u.cb.iSet ){\r\n    u.cb.exists = sqlite3RowSetTest(pIn1->u.pRowSet,\r\n                               (u8)(u.cb.iSet>=0 ? u.cb.iSet & 0xf : 0xff),\r\n                               pIn3->u.i);\r\n    if( u.cb.exists ){\r\n      pc = pOp->p2 - 1;\r\n      break;\r\n    }\r\n  }\r\n  if( u.cb.iSet>=0 ){\r\n    sqlite3RowSetInsert(pIn1->u.pRowSet, pIn3->u.i);\r\n  }\r\n  break;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n\r\n/* Opcode: Program P1 P2 P3 P4 *\r\n**\r\n** Execute the trigger program passed as P4 (type P4_SUBPROGRAM). \r\n**\r\n** P1 contains the address of the memory cell that contains the first memory \r\n** cell in an array of values used as arguments to the sub-program. P2 \r\n** contains the address to jump to if the sub-program throws an IGNORE \r\n** exception using the RAISE() function. Register P3 contains the address \r\n** of a memory cell in this (the parent) VM that is used to allocate the \r\n** memory required by the sub-vdbe at runtime.\r\n**\r\n** P4 is a pointer to the VM containing the trigger program.\r\n*/\r\ncase OP_Program: {        /* jump */\r\n#if 0  /* local variables moved into u.cc */\r\n  int nMem;               /* Number of memory registers for sub-program */\r\n  int nByte;              /* Bytes of runtime space required for sub-program */\r\n  Mem *pRt;               /* Register to allocate runtime space */\r\n  Mem *pMem;              /* Used to iterate through memory cells */\r\n  Mem *pEnd;              /* Last memory cell in new array */\r\n  VdbeFrame *pFrame;      /* New vdbe frame to execute in */\r\n  SubProgram *pProgram;   /* Sub-program to execute */\r\n  void *t;                /* Token identifying trigger */\r\n#endif /* local variables moved into u.cc */\r\n\r\n  u.cc.pProgram = pOp->p4.pProgram;\r\n  u.cc.pRt = &aMem[pOp->p3];\r\n  assert( u.cc.pProgram->nOp>0 );\r\n\r\n  /* If the p5 flag is clear, then recursive invocation of triggers is\r\n  ** disabled for backwards compatibility (p5 is set if this sub-program\r\n  ** is really a trigger, not a foreign key action, and the flag set\r\n  ** and cleared by the \"PRAGMA recursive_triggers\" command is clear).\r\n  **\r\n  ** It is recursive invocation of triggers, at the SQL level, that is\r\n  ** disabled. In some cases a single trigger may generate more than one\r\n  ** SubProgram (if the trigger may be executed with more than one different\r\n  ** ON CONFLICT algorithm). SubProgram structures associated with a\r\n  ** single trigger all have the same value for the SubProgram.token\r\n  ** variable.  */\r\n  if( pOp->p5 ){\r\n    u.cc.t = u.cc.pProgram->token;\r\n    for(u.cc.pFrame=p->pFrame; u.cc.pFrame && u.cc.pFrame->token!=u.cc.t; u.cc.pFrame=u.cc.pFrame->pParent);\r\n    if( u.cc.pFrame ) break;\r\n  }\r\n\r\n  if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){\r\n    rc = SQLITE_ERROR;\r\n    sqlite3SetString(&p->zErrMsg, db, \"too many levels of trigger recursion\");\r\n    break;\r\n  }\r\n\r\n  /* Register u.cc.pRt is used to store the memory required to save the state\r\n  ** of the current program, and the memory required at runtime to execute\r\n  ** the trigger program. If this trigger has been fired before, then u.cc.pRt\r\n  ** is already allocated. Otherwise, it must be initialized.  */\r\n  if( (u.cc.pRt->flags&MEM_Frame)==0 ){\r\n    /* SubProgram.nMem is set to the number of memory cells used by the\r\n    ** program stored in SubProgram.aOp. As well as these, one memory\r\n    ** cell is required for each cursor used by the program. Set local\r\n    ** variable u.cc.nMem (and later, VdbeFrame.nChildMem) to this value.\r\n    */\r\n    u.cc.nMem = u.cc.pProgram->nMem + u.cc.pProgram->nCsr;\r\n    u.cc.nByte = ROUND8(sizeof(VdbeFrame))\r\n              + u.cc.nMem * sizeof(Mem)\r\n              + u.cc.pProgram->nCsr * sizeof(VdbeCursor *)\r\n              + u.cc.pProgram->nOnce * sizeof(u8);\r\n    u.cc.pFrame = sqlite3DbMallocZero(db, u.cc.nByte);\r\n    if( !u.cc.pFrame ){\r\n      goto no_mem;\r\n    }\r\n    sqlite3VdbeMemRelease(u.cc.pRt);\r\n    u.cc.pRt->flags = MEM_Frame;\r\n    u.cc.pRt->u.pFrame = u.cc.pFrame;\r\n\r\n    u.cc.pFrame->v = p;\r\n    u.cc.pFrame->nChildMem = u.cc.nMem;\r\n    u.cc.pFrame->nChildCsr = u.cc.pProgram->nCsr;\r\n    u.cc.pFrame->pc = pc;\r\n    u.cc.pFrame->aMem = p->aMem;\r\n    u.cc.pFrame->nMem = p->nMem;\r\n    u.cc.pFrame->apCsr = p->apCsr;\r\n    u.cc.pFrame->nCursor = p->nCursor;\r\n    u.cc.pFrame->aOp = p->aOp;\r\n    u.cc.pFrame->nOp = p->nOp;\r\n    u.cc.pFrame->token = u.cc.pProgram->token;\r\n    u.cc.pFrame->aOnceFlag = p->aOnceFlag;\r\n    u.cc.pFrame->nOnceFlag = p->nOnceFlag;\r\n\r\n    u.cc.pEnd = &VdbeFrameMem(u.cc.pFrame)[u.cc.pFrame->nChildMem];\r\n    for(u.cc.pMem=VdbeFrameMem(u.cc.pFrame); u.cc.pMem!=u.cc.pEnd; u.cc.pMem++){\r\n      u.cc.pMem->flags = MEM_Invalid;\r\n      u.cc.pMem->db = db;\r\n    }\r\n  }else{\r\n    u.cc.pFrame = u.cc.pRt->u.pFrame;\r\n    assert( u.cc.pProgram->nMem+u.cc.pProgram->nCsr==u.cc.pFrame->nChildMem );\r\n    assert( u.cc.pProgram->nCsr==u.cc.pFrame->nChildCsr );\r\n    assert( pc==u.cc.pFrame->pc );\r\n  }\r\n\r\n  p->nFrame++;\r\n  u.cc.pFrame->pParent = p->pFrame;\r\n  u.cc.pFrame->lastRowid = lastRowid;\r\n  u.cc.pFrame->nChange = p->nChange;\r\n  p->nChange = 0;\r\n  p->pFrame = u.cc.pFrame;\r\n  p->aMem = aMem = &VdbeFrameMem(u.cc.pFrame)[-1];\r\n  p->nMem = u.cc.pFrame->nChildMem;\r\n  p->nCursor = (u16)u.cc.pFrame->nChildCsr;\r\n  p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];\r\n  p->aOp = aOp = u.cc.pProgram->aOp;\r\n  p->nOp = u.cc.pProgram->nOp;\r\n  p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];\r\n  p->nOnceFlag = u.cc.pProgram->nOnce;\r\n  pc = -1;\r\n  memset(p->aOnceFlag, 0, p->nOnceFlag);\r\n\r\n  break;\r\n}\r\n\r\n/* Opcode: Param P1 P2 * * *\r\n**\r\n** This opcode is only ever present in sub-programs called via the \r\n** OP_Program instruction. Copy a value currently stored in a memory \r\n** cell of the calling (parent) frame to cell P2 in the current frames \r\n** address space. This is used by trigger programs to access the new.* \r\n** and old.* values.\r\n**\r\n** The address of the cell in the parent frame is determined by adding\r\n** the value of the P1 argument to the value of the P1 argument to the\r\n** calling OP_Program instruction.\r\n*/\r\ncase OP_Param: {           /* out2-prerelease */\r\n#if 0  /* local variables moved into u.cd */\r\n  VdbeFrame *pFrame;\r\n  Mem *pIn;\r\n#endif /* local variables moved into u.cd */\r\n  u.cd.pFrame = p->pFrame;\r\n  u.cd.pIn = &u.cd.pFrame->aMem[pOp->p1 + u.cd.pFrame->aOp[u.cd.pFrame->pc].p1];\r\n  sqlite3VdbeMemShallowCopy(pOut, u.cd.pIn, MEM_Ephem);\r\n  break;\r\n}\r\n\r\n#endif /* #ifndef SQLITE_OMIT_TRIGGER */\r\n\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n/* Opcode: FkCounter P1 P2 * * *\r\n**\r\n** Increment a \"constraint counter\" by P2 (P2 may be negative or positive).\r\n** If P1 is non-zero, the database constraint counter is incremented \r\n** (deferred foreign key constraints). Otherwise, if P1 is zero, the \r\n** statement counter is incremented (immediate foreign key constraints).\r\n*/\r\ncase OP_FkCounter: {\r\n  if( pOp->p1 ){\r\n    db->nDeferredCons += pOp->p2;\r\n  }else{\r\n    p->nFkConstraint += pOp->p2;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: FkIfZero P1 P2 * * *\r\n**\r\n** This opcode tests if a foreign key constraint-counter is currently zero.\r\n** If so, jump to instruction P2. Otherwise, fall through to the next \r\n** instruction.\r\n**\r\n** If P1 is non-zero, then the jump is taken if the database constraint-counter\r\n** is zero (the one that counts deferred constraint violations). If P1 is\r\n** zero, the jump is taken if the statement constraint-counter is zero\r\n** (immediate foreign key constraint violations).\r\n*/\r\ncase OP_FkIfZero: {         /* jump */\r\n  if( pOp->p1 ){\r\n    if( db->nDeferredCons==0 ) pc = pOp->p2-1;\r\n  }else{\r\n    if( p->nFkConstraint==0 ) pc = pOp->p2-1;\r\n  }\r\n  break;\r\n}\r\n#endif /* #ifndef SQLITE_OMIT_FOREIGN_KEY */\r\n\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n/* Opcode: MemMax P1 P2 * * *\r\n**\r\n** P1 is a register in the root frame of this VM (the root frame is\r\n** different from the current frame if this instruction is being executed\r\n** within a sub-program). Set the value of register P1 to the maximum of \r\n** its current value and the value in register P2.\r\n**\r\n** This instruction throws an error if the memory cell is not initially\r\n** an integer.\r\n*/\r\ncase OP_MemMax: {        /* in2 */\r\n#if 0  /* local variables moved into u.ce */\r\n  Mem *pIn1;\r\n  VdbeFrame *pFrame;\r\n#endif /* local variables moved into u.ce */\r\n  if( p->pFrame ){\r\n    for(u.ce.pFrame=p->pFrame; u.ce.pFrame->pParent; u.ce.pFrame=u.ce.pFrame->pParent);\r\n    u.ce.pIn1 = &u.ce.pFrame->aMem[pOp->p1];\r\n  }else{\r\n    u.ce.pIn1 = &aMem[pOp->p1];\r\n  }\r\n  assert( memIsValid(u.ce.pIn1) );\r\n  sqlite3VdbeMemIntegerify(u.ce.pIn1);\r\n  pIn2 = &aMem[pOp->p2];\r\n  sqlite3VdbeMemIntegerify(pIn2);\r\n  if( u.ce.pIn1->u.i<pIn2->u.i){\r\n    u.ce.pIn1->u.i = pIn2->u.i;\r\n  }\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_AUTOINCREMENT */\r\n\r\n/* Opcode: IfPos P1 P2 * * *\r\n**\r\n** If the value of register P1 is 1 or greater, jump to P2.\r\n**\r\n** It is illegal to use this instruction on a register that does\r\n** not contain an integer.  An assertion fault will result if you try.\r\n*/\r\ncase OP_IfPos: {        /* jump, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  assert( pIn1->flags&MEM_Int );\r\n  if( pIn1->u.i>0 ){\r\n     pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IfNeg P1 P2 * * *\r\n**\r\n** If the value of register P1 is less than zero, jump to P2. \r\n**\r\n** It is illegal to use this instruction on a register that does\r\n** not contain an integer.  An assertion fault will result if you try.\r\n*/\r\ncase OP_IfNeg: {        /* jump, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  assert( pIn1->flags&MEM_Int );\r\n  if( pIn1->u.i<0 ){\r\n     pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: IfZero P1 P2 P3 * *\r\n**\r\n** The register P1 must contain an integer.  Add literal P3 to the\r\n** value in register P1.  If the result is exactly 0, jump to P2. \r\n**\r\n** It is illegal to use this instruction on a register that does\r\n** not contain an integer.  An assertion fault will result if you try.\r\n*/\r\ncase OP_IfZero: {        /* jump, in1 */\r\n  pIn1 = &aMem[pOp->p1];\r\n  assert( pIn1->flags&MEM_Int );\r\n  pIn1->u.i += pOp->p3;\r\n  if( pIn1->u.i==0 ){\r\n     pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n\r\n/* Opcode: AggStep * P2 P3 P4 P5\r\n**\r\n** Execute the step function for an aggregate.  The\r\n** function has P5 arguments.   P4 is a pointer to the FuncDef\r\n** structure that specifies the function.  Use register\r\n** P3 as the accumulator.\r\n**\r\n** The P5 arguments are taken from register P2 and its\r\n** successors.\r\n*/\r\ncase OP_AggStep: {\r\n#if 0  /* local variables moved into u.cf */\r\n  int n;\r\n  int i;\r\n  Mem *pMem;\r\n  Mem *pRec;\r\n  sqlite3_context ctx;\r\n  sqlite3_value **apVal;\r\n#endif /* local variables moved into u.cf */\r\n\r\n  u.cf.n = pOp->p5;\r\n  assert( u.cf.n>=0 );\r\n  u.cf.pRec = &aMem[pOp->p2];\r\n  u.cf.apVal = p->apArg;\r\n  assert( u.cf.apVal || u.cf.n==0 );\r\n  for(u.cf.i=0; u.cf.i<u.cf.n; u.cf.i++, u.cf.pRec++){\r\n    assert( memIsValid(u.cf.pRec) );\r\n    u.cf.apVal[u.cf.i] = u.cf.pRec;\r\n    memAboutToChange(p, u.cf.pRec);\r\n    sqlite3VdbeMemStoreType(u.cf.pRec);\r\n  }\r\n  u.cf.ctx.pFunc = pOp->p4.pFunc;\r\n  assert( pOp->p3>0 && pOp->p3<=p->nMem );\r\n  u.cf.ctx.pMem = u.cf.pMem = &aMem[pOp->p3];\r\n  u.cf.pMem->n++;\r\n  u.cf.ctx.s.flags = MEM_Null;\r\n  u.cf.ctx.s.z = 0;\r\n  u.cf.ctx.s.zMalloc = 0;\r\n  u.cf.ctx.s.xDel = 0;\r\n  u.cf.ctx.s.db = db;\r\n  u.cf.ctx.isError = 0;\r\n  u.cf.ctx.pColl = 0;\r\n  u.cf.ctx.skipFlag = 0;\r\n  if( u.cf.ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){\r\n    assert( pOp>p->aOp );\r\n    assert( pOp[-1].p4type==P4_COLLSEQ );\r\n    assert( pOp[-1].opcode==OP_CollSeq );\r\n    u.cf.ctx.pColl = pOp[-1].p4.pColl;\r\n  }\r\n  (u.cf.ctx.pFunc->xStep)(&u.cf.ctx, u.cf.n, u.cf.apVal); /* IMP: R-24505-23230 */\r\n  if( u.cf.ctx.isError ){\r\n    sqlite3SetString(&p->zErrMsg, db, \"%s\", sqlite3_value_text(&u.cf.ctx.s));\r\n    rc = u.cf.ctx.isError;\r\n  }\r\n  if( u.cf.ctx.skipFlag ){\r\n    assert( pOp[-1].opcode==OP_CollSeq );\r\n    u.cf.i = pOp[-1].p1;\r\n    if( u.cf.i ) sqlite3VdbeMemSetInt64(&aMem[u.cf.i], 1);\r\n  }\r\n\r\n  sqlite3VdbeMemRelease(&u.cf.ctx.s);\r\n\r\n  break;\r\n}\r\n\r\n/* Opcode: AggFinal P1 P2 * P4 *\r\n**\r\n** Execute the finalizer function for an aggregate.  P1 is\r\n** the memory location that is the accumulator for the aggregate.\r\n**\r\n** P2 is the number of arguments that the step function takes and\r\n** P4 is a pointer to the FuncDef for this function.  The P2\r\n** argument is not used by this opcode.  It is only there to disambiguate\r\n** functions that can take varying numbers of arguments.  The\r\n** P4 argument is only needed for the degenerate case where\r\n** the step function was not previously called.\r\n*/\r\ncase OP_AggFinal: {\r\n#if 0  /* local variables moved into u.cg */\r\n  Mem *pMem;\r\n#endif /* local variables moved into u.cg */\r\n  assert( pOp->p1>0 && pOp->p1<=p->nMem );\r\n  u.cg.pMem = &aMem[pOp->p1];\r\n  assert( (u.cg.pMem->flags & ~(MEM_Null|MEM_Agg))==0 );\r\n  rc = sqlite3VdbeMemFinalize(u.cg.pMem, pOp->p4.pFunc);\r\n  if( rc ){\r\n    sqlite3SetString(&p->zErrMsg, db, \"%s\", sqlite3_value_text(u.cg.pMem));\r\n  }\r\n  sqlite3VdbeChangeEncoding(u.cg.pMem, encoding);\r\n  UPDATE_MAX_BLOBSIZE(u.cg.pMem);\r\n  if( sqlite3VdbeMemTooBig(u.cg.pMem) ){\r\n    goto too_big;\r\n  }\r\n  break;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/* Opcode: Checkpoint P1 P2 P3 * *\r\n**\r\n** Checkpoint database P1. This is a no-op if P1 is not currently in\r\n** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL\r\n** or RESTART.  Write 1 or 0 into mem[P3] if the checkpoint returns\r\n** SQLITE_BUSY or not, respectively.  Write the number of pages in the\r\n** WAL after the checkpoint into mem[P3+1] and the number of pages\r\n** in the WAL that have been checkpointed after the checkpoint\r\n** completes into mem[P3+2].  However on an error, mem[P3+1] and\r\n** mem[P3+2] are initialized to -1.\r\n*/\r\ncase OP_Checkpoint: {\r\n#if 0  /* local variables moved into u.ch */\r\n  int i;                          /* Loop counter */\r\n  int aRes[3];                    /* Results */\r\n  Mem *pMem;                      /* Write results here */\r\n#endif /* local variables moved into u.ch */\r\n\r\n  u.ch.aRes[0] = 0;\r\n  u.ch.aRes[1] = u.ch.aRes[2] = -1;\r\n  assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE\r\n       || pOp->p2==SQLITE_CHECKPOINT_FULL\r\n       || pOp->p2==SQLITE_CHECKPOINT_RESTART\r\n  );\r\n  rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &u.ch.aRes[1], &u.ch.aRes[2]);\r\n  if( rc==SQLITE_BUSY ){\r\n    rc = SQLITE_OK;\r\n    u.ch.aRes[0] = 1;\r\n  }\r\n  for(u.ch.i=0, u.ch.pMem = &aMem[pOp->p3]; u.ch.i<3; u.ch.i++, u.ch.pMem++){\r\n    sqlite3VdbeMemSetInt64(u.ch.pMem, (i64)u.ch.aRes[u.ch.i]);\r\n  }\r\n  break;\r\n};  \r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_PRAGMA\r\n/* Opcode: JournalMode P1 P2 P3 * P5\r\n**\r\n** Change the journal mode of database P1 to P3. P3 must be one of the\r\n** PAGER_JOURNALMODE_XXX values. If changing between the various rollback\r\n** modes (delete, truncate, persist, off and memory), this is a simple\r\n** operation. No IO is required.\r\n**\r\n** If changing into or out of WAL mode the procedure is more complicated.\r\n**\r\n** Write a string containing the final journal-mode to register P2.\r\n*/\r\ncase OP_JournalMode: {    /* out2-prerelease */\r\n#if 0  /* local variables moved into u.ci */\r\n  Btree *pBt;                     /* Btree to change journal mode of */\r\n  Pager *pPager;                  /* Pager associated with pBt */\r\n  int eNew;                       /* New journal mode */\r\n  int eOld;                       /* The old journal mode */\r\n  const char *zFilename;          /* Name of database file for pPager */\r\n#endif /* local variables moved into u.ci */\r\n\r\n  u.ci.eNew = pOp->p3;\r\n  assert( u.ci.eNew==PAGER_JOURNALMODE_DELETE\r\n       || u.ci.eNew==PAGER_JOURNALMODE_TRUNCATE\r\n       || u.ci.eNew==PAGER_JOURNALMODE_PERSIST\r\n       || u.ci.eNew==PAGER_JOURNALMODE_OFF\r\n       || u.ci.eNew==PAGER_JOURNALMODE_MEMORY\r\n       || u.ci.eNew==PAGER_JOURNALMODE_WAL\r\n       || u.ci.eNew==PAGER_JOURNALMODE_QUERY\r\n  );\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n\r\n  u.ci.pBt = db->aDb[pOp->p1].pBt;\r\n  u.ci.pPager = sqlite3BtreePager(u.ci.pBt);\r\n  u.ci.eOld = sqlite3PagerGetJournalMode(u.ci.pPager);\r\n  if( u.ci.eNew==PAGER_JOURNALMODE_QUERY ) u.ci.eNew = u.ci.eOld;\r\n  if( !sqlite3PagerOkToChangeJournalMode(u.ci.pPager) ) u.ci.eNew = u.ci.eOld;\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n  u.ci.zFilename = sqlite3PagerFilename(u.ci.pPager);\r\n\r\n  /* Do not allow a transition to journal_mode=WAL for a database\r\n  ** in temporary storage or if the VFS does not support shared memory\r\n  */\r\n  if( u.ci.eNew==PAGER_JOURNALMODE_WAL\r\n   && (sqlite3Strlen30(u.ci.zFilename)==0           /* Temp file */\r\n       || !sqlite3PagerWalSupported(u.ci.pPager))   /* No shared-memory support */\r\n  ){\r\n    u.ci.eNew = u.ci.eOld;\r\n  }\r\n\r\n  if( (u.ci.eNew!=u.ci.eOld)\r\n   && (u.ci.eOld==PAGER_JOURNALMODE_WAL || u.ci.eNew==PAGER_JOURNALMODE_WAL)\r\n  ){\r\n    if( !db->autoCommit || db->activeVdbeCnt>1 ){\r\n      rc = SQLITE_ERROR;\r\n      sqlite3SetString(&p->zErrMsg, db,\r\n          \"cannot change %s wal mode from within a transaction\",\r\n          (u.ci.eNew==PAGER_JOURNALMODE_WAL ? \"into\" : \"out of\")\r\n      );\r\n      break;\r\n    }else{\r\n\r\n      if( u.ci.eOld==PAGER_JOURNALMODE_WAL ){\r\n        /* If leaving WAL mode, close the log file. If successful, the call\r\n        ** to PagerCloseWal() checkpoints and deletes the write-ahead-log\r\n        ** file. An EXCLUSIVE lock may still be held on the database file\r\n        ** after a successful return.\r\n        */\r\n        rc = sqlite3PagerCloseWal(u.ci.pPager);\r\n        if( rc==SQLITE_OK ){\r\n          sqlite3PagerSetJournalMode(u.ci.pPager, u.ci.eNew);\r\n        }\r\n      }else if( u.ci.eOld==PAGER_JOURNALMODE_MEMORY ){\r\n        /* Cannot transition directly from MEMORY to WAL.  Use mode OFF\r\n        ** as an intermediate */\r\n        sqlite3PagerSetJournalMode(u.ci.pPager, PAGER_JOURNALMODE_OFF);\r\n      }\r\n\r\n      /* Open a transaction on the database file. Regardless of the journal\r\n      ** mode, this transaction always uses a rollback journal.\r\n      */\r\n      assert( sqlite3BtreeIsInTrans(u.ci.pBt)==0 );\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3BtreeSetVersion(u.ci.pBt, (u.ci.eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));\r\n      }\r\n    }\r\n  }\r\n#endif /* ifndef SQLITE_OMIT_WAL */\r\n\r\n  if( rc ){\r\n    u.ci.eNew = u.ci.eOld;\r\n  }\r\n  u.ci.eNew = sqlite3PagerSetJournalMode(u.ci.pPager, u.ci.eNew);\r\n\r\n  pOut = &aMem[pOp->p2];\r\n  pOut->flags = MEM_Str|MEM_Static|MEM_Term;\r\n  pOut->z = (char *)sqlite3JournalModename(u.ci.eNew);\r\n  pOut->n = sqlite3Strlen30(pOut->z);\r\n  pOut->enc = SQLITE_UTF8;\r\n  sqlite3VdbeChangeEncoding(pOut, encoding);\r\n  break;\r\n};\r\n#endif /* SQLITE_OMIT_PRAGMA */\r\n\r\n#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)\r\n/* Opcode: Vacuum * * * * *\r\n**\r\n** Vacuum the entire database.  This opcode will cause other virtual\r\n** machines to be created and run.  It may not be called from within\r\n** a transaction.\r\n*/\r\ncase OP_Vacuum: {\r\n  rc = sqlite3RunVacuum(&p->zErrMsg, db);\r\n  break;\r\n}\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_AUTOVACUUM)\r\n/* Opcode: IncrVacuum P1 P2 * * *\r\n**\r\n** Perform a single step of the incremental vacuum procedure on\r\n** the P1 database. If the vacuum has finished, jump to instruction\r\n** P2. Otherwise, fall through to the next instruction.\r\n*/\r\ncase OP_IncrVacuum: {        /* jump */\r\n#if 0  /* local variables moved into u.cj */\r\n  Btree *pBt;\r\n#endif /* local variables moved into u.cj */\r\n\r\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\r\n  assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );\r\n  u.cj.pBt = db->aDb[pOp->p1].pBt;\r\n  rc = sqlite3BtreeIncrVacuum(u.cj.pBt);\r\n  if( rc==SQLITE_DONE ){\r\n    pc = pOp->p2 - 1;\r\n    rc = SQLITE_OK;\r\n  }\r\n  break;\r\n}\r\n#endif\r\n\r\n/* Opcode: Expire P1 * * * *\r\n**\r\n** Cause precompiled statements to become expired. An expired statement\r\n** fails with an error code of SQLITE_SCHEMA if it is ever executed \r\n** (via sqlite3_step()).\r\n** \r\n** If P1 is 0, then all SQL statements become expired. If P1 is non-zero,\r\n** then only the currently executing statement is affected. \r\n*/\r\ncase OP_Expire: {\r\n  if( !pOp->p1 ){\r\n    sqlite3ExpirePreparedStatements(db);\r\n  }else{\r\n    p->expired = 1;\r\n  }\r\n  break;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/* Opcode: TableLock P1 P2 P3 P4 *\r\n**\r\n** Obtain a lock on a particular table. This instruction is only used when\r\n** the shared-cache feature is enabled. \r\n**\r\n** P1 is the index of the database in sqlite3.aDb[] of the database\r\n** on which the lock is acquired.  A readlock is obtained if P3==0 or\r\n** a write lock if P3==1.\r\n**\r\n** P2 contains the root-page of the table to lock.\r\n**\r\n** P4 contains a pointer to the name of the table being locked. This is only\r\n** used to generate an error message if the lock cannot be obtained.\r\n*/\r\ncase OP_TableLock: {\r\n  u8 isWriteLock = (u8)pOp->p3;\r\n  if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){\r\n    int p1 = pOp->p1; \r\n    assert( p1>=0 && p1<db->nDb );\r\n    assert( (p->btreeMask & (((yDbMask)1)<<p1))!=0 );\r\n    assert( isWriteLock==0 || isWriteLock==1 );\r\n    rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);\r\n    if( (rc&0xFF)==SQLITE_LOCKED ){\r\n      const char *z = pOp->p4.z;\r\n      sqlite3SetString(&p->zErrMsg, db, \"database table is locked: %s\", z);\r\n    }\r\n  }\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_SHARED_CACHE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VBegin * * * P4 *\r\n**\r\n** P4 may be a pointer to an sqlite3_vtab structure. If so, call the \r\n** xBegin method for that table.\r\n**\r\n** Also, whether or not P4 is set, check that this is not being called from\r\n** within a callback to a virtual table xSync() method. If it is, the error\r\n** code will be set to SQLITE_LOCKED.\r\n*/\r\ncase OP_VBegin: {\r\n#if 0  /* local variables moved into u.ck */\r\n  VTable *pVTab;\r\n#endif /* local variables moved into u.ck */\r\n  u.ck.pVTab = pOp->p4.pVtab;\r\n  rc = sqlite3VtabBegin(db, u.ck.pVTab);\r\n  if( u.ck.pVTab ) importVtabErrMsg(p, u.ck.pVTab->pVtab);\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VCreate P1 * * P4 *\r\n**\r\n** P4 is the name of a virtual table in database P1. Call the xCreate method\r\n** for that table.\r\n*/\r\ncase OP_VCreate: {\r\n  rc = sqlite3VtabCallCreate(db, pOp->p1, pOp->p4.z, &p->zErrMsg);\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VDestroy P1 * * P4 *\r\n**\r\n** P4 is the name of a virtual table in database P1.  Call the xDestroy method\r\n** of that table.\r\n*/\r\ncase OP_VDestroy: {\r\n  p->inVtabMethod = 2;\r\n  rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);\r\n  p->inVtabMethod = 0;\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VOpen P1 * * P4 *\r\n**\r\n** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.\r\n** P1 is a cursor number.  This opcode opens a cursor to the virtual\r\n** table and stores that cursor in P1.\r\n*/\r\ncase OP_VOpen: {\r\n#if 0  /* local variables moved into u.cl */\r\n  VdbeCursor *pCur;\r\n  sqlite3_vtab_cursor *pVtabCursor;\r\n  sqlite3_vtab *pVtab;\r\n  sqlite3_module *pModule;\r\n#endif /* local variables moved into u.cl */\r\n\r\n  u.cl.pCur = 0;\r\n  u.cl.pVtabCursor = 0;\r\n  u.cl.pVtab = pOp->p4.pVtab->pVtab;\r\n  u.cl.pModule = (sqlite3_module *)u.cl.pVtab->pModule;\r\n  assert(u.cl.pVtab && u.cl.pModule);\r\n  rc = u.cl.pModule->xOpen(u.cl.pVtab, &u.cl.pVtabCursor);\r\n  importVtabErrMsg(p, u.cl.pVtab);\r\n  if( SQLITE_OK==rc ){\r\n    /* Initialize sqlite3_vtab_cursor base class */\r\n    u.cl.pVtabCursor->pVtab = u.cl.pVtab;\r\n\r\n    /* Initialise vdbe cursor object */\r\n    u.cl.pCur = allocateCursor(p, pOp->p1, 0, -1, 0);\r\n    if( u.cl.pCur ){\r\n      u.cl.pCur->pVtabCursor = u.cl.pVtabCursor;\r\n      u.cl.pCur->pModule = u.cl.pVtabCursor->pVtab->pModule;\r\n    }else{\r\n      db->mallocFailed = 1;\r\n      u.cl.pModule->xClose(u.cl.pVtabCursor);\r\n    }\r\n  }\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VFilter P1 P2 P3 P4 *\r\n**\r\n** P1 is a cursor opened using VOpen.  P2 is an address to jump to if\r\n** the filtered result set is empty.\r\n**\r\n** P4 is either NULL or a string that was generated by the xBestIndex\r\n** method of the module.  The interpretation of the P4 string is left\r\n** to the module implementation.\r\n**\r\n** This opcode invokes the xFilter method on the virtual table specified\r\n** by P1.  The integer query plan parameter to xFilter is stored in register\r\n** P3. Register P3+1 stores the argc parameter to be passed to the\r\n** xFilter method. Registers P3+2..P3+1+argc are the argc\r\n** additional parameters which are passed to\r\n** xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter.\r\n**\r\n** A jump is made to P2 if the result set after filtering would be empty.\r\n*/\r\ncase OP_VFilter: {   /* jump */\r\n#if 0  /* local variables moved into u.cm */\r\n  int nArg;\r\n  int iQuery;\r\n  const sqlite3_module *pModule;\r\n  Mem *pQuery;\r\n  Mem *pArgc;\r\n  sqlite3_vtab_cursor *pVtabCursor;\r\n  sqlite3_vtab *pVtab;\r\n  VdbeCursor *pCur;\r\n  int res;\r\n  int i;\r\n  Mem **apArg;\r\n#endif /* local variables moved into u.cm */\r\n\r\n  u.cm.pQuery = &aMem[pOp->p3];\r\n  u.cm.pArgc = &u.cm.pQuery[1];\r\n  u.cm.pCur = p->apCsr[pOp->p1];\r\n  assert( memIsValid(u.cm.pQuery) );\r\n  REGISTER_TRACE(pOp->p3, u.cm.pQuery);\r\n  assert( u.cm.pCur->pVtabCursor );\r\n  u.cm.pVtabCursor = u.cm.pCur->pVtabCursor;\r\n  u.cm.pVtab = u.cm.pVtabCursor->pVtab;\r\n  u.cm.pModule = u.cm.pVtab->pModule;\r\n\r\n  /* Grab the index number and argc parameters */\r\n  assert( (u.cm.pQuery->flags&MEM_Int)!=0 && u.cm.pArgc->flags==MEM_Int );\r\n  u.cm.nArg = (int)u.cm.pArgc->u.i;\r\n  u.cm.iQuery = (int)u.cm.pQuery->u.i;\r\n\r\n  /* Invoke the xFilter method */\r\n  {\r\n    u.cm.res = 0;\r\n    u.cm.apArg = p->apArg;\r\n    for(u.cm.i = 0; u.cm.i<u.cm.nArg; u.cm.i++){\r\n      u.cm.apArg[u.cm.i] = &u.cm.pArgc[u.cm.i+1];\r\n      sqlite3VdbeMemStoreType(u.cm.apArg[u.cm.i]);\r\n    }\r\n\r\n    p->inVtabMethod = 1;\r\n    rc = u.cm.pModule->xFilter(u.cm.pVtabCursor, u.cm.iQuery, pOp->p4.z, u.cm.nArg, u.cm.apArg);\r\n    p->inVtabMethod = 0;\r\n    importVtabErrMsg(p, u.cm.pVtab);\r\n    if( rc==SQLITE_OK ){\r\n      u.cm.res = u.cm.pModule->xEof(u.cm.pVtabCursor);\r\n    }\r\n\r\n    if( u.cm.res ){\r\n      pc = pOp->p2 - 1;\r\n    }\r\n  }\r\n  u.cm.pCur->nullRow = 0;\r\n\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VColumn P1 P2 P3 * *\r\n**\r\n** Store the value of the P2-th column of\r\n** the row of the virtual-table that the \r\n** P1 cursor is pointing to into register P3.\r\n*/\r\ncase OP_VColumn: {\r\n#if 0  /* local variables moved into u.cn */\r\n  sqlite3_vtab *pVtab;\r\n  const sqlite3_module *pModule;\r\n  Mem *pDest;\r\n  sqlite3_context sContext;\r\n#endif /* local variables moved into u.cn */\r\n\r\n  VdbeCursor *pCur = p->apCsr[pOp->p1];\r\n  assert( pCur->pVtabCursor );\r\n  assert( pOp->p3>0 && pOp->p3<=p->nMem );\r\n  u.cn.pDest = &aMem[pOp->p3];\r\n  memAboutToChange(p, u.cn.pDest);\r\n  if( pCur->nullRow ){\r\n    sqlite3VdbeMemSetNull(u.cn.pDest);\r\n    break;\r\n  }\r\n  u.cn.pVtab = pCur->pVtabCursor->pVtab;\r\n  u.cn.pModule = u.cn.pVtab->pModule;\r\n  assert( u.cn.pModule->xColumn );\r\n  memset(&u.cn.sContext, 0, sizeof(u.cn.sContext));\r\n\r\n  /* The output cell may already have a buffer allocated. Move\r\n  ** the current contents to u.cn.sContext.s so in case the user-function\r\n  ** can use the already allocated buffer instead of allocating a\r\n  ** new one.\r\n  */\r\n  sqlite3VdbeMemMove(&u.cn.sContext.s, u.cn.pDest);\r\n  MemSetTypeFlag(&u.cn.sContext.s, MEM_Null);\r\n\r\n  rc = u.cn.pModule->xColumn(pCur->pVtabCursor, &u.cn.sContext, pOp->p2);\r\n  importVtabErrMsg(p, u.cn.pVtab);\r\n  if( u.cn.sContext.isError ){\r\n    rc = u.cn.sContext.isError;\r\n  }\r\n\r\n  /* Copy the result of the function to the P3 register. We\r\n  ** do this regardless of whether or not an error occurred to ensure any\r\n  ** dynamic allocation in u.cn.sContext.s (a Mem struct) is  released.\r\n  */\r\n  sqlite3VdbeChangeEncoding(&u.cn.sContext.s, encoding);\r\n  sqlite3VdbeMemMove(u.cn.pDest, &u.cn.sContext.s);\r\n  REGISTER_TRACE(pOp->p3, u.cn.pDest);\r\n  UPDATE_MAX_BLOBSIZE(u.cn.pDest);\r\n\r\n  if( sqlite3VdbeMemTooBig(u.cn.pDest) ){\r\n    goto too_big;\r\n  }\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VNext P1 P2 * * *\r\n**\r\n** Advance virtual table P1 to the next row in its result set and\r\n** jump to instruction P2.  Or, if the virtual table has reached\r\n** the end of its result set, then fall through to the next instruction.\r\n*/\r\ncase OP_VNext: {   /* jump */\r\n#if 0  /* local variables moved into u.co */\r\n  sqlite3_vtab *pVtab;\r\n  const sqlite3_module *pModule;\r\n  int res;\r\n  VdbeCursor *pCur;\r\n#endif /* local variables moved into u.co */\r\n\r\n  u.co.res = 0;\r\n  u.co.pCur = p->apCsr[pOp->p1];\r\n  assert( u.co.pCur->pVtabCursor );\r\n  if( u.co.pCur->nullRow ){\r\n    break;\r\n  }\r\n  u.co.pVtab = u.co.pCur->pVtabCursor->pVtab;\r\n  u.co.pModule = u.co.pVtab->pModule;\r\n  assert( u.co.pModule->xNext );\r\n\r\n  /* Invoke the xNext() method of the module. There is no way for the\r\n  ** underlying implementation to return an error if one occurs during\r\n  ** xNext(). Instead, if an error occurs, true is returned (indicating that\r\n  ** data is available) and the error code returned when xColumn or\r\n  ** some other method is next invoked on the save virtual table cursor.\r\n  */\r\n  p->inVtabMethod = 1;\r\n  rc = u.co.pModule->xNext(u.co.pCur->pVtabCursor);\r\n  p->inVtabMethod = 0;\r\n  importVtabErrMsg(p, u.co.pVtab);\r\n  if( rc==SQLITE_OK ){\r\n    u.co.res = u.co.pModule->xEof(u.co.pCur->pVtabCursor);\r\n  }\r\n\r\n  if( !u.co.res ){\r\n    /* If there is data, jump to P2 */\r\n    pc = pOp->p2 - 1;\r\n  }\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VRename P1 * * P4 *\r\n**\r\n** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.\r\n** This opcode invokes the corresponding xRename method. The value\r\n** in register P1 is passed as the zName argument to the xRename method.\r\n*/\r\ncase OP_VRename: {\r\n#if 0  /* local variables moved into u.cp */\r\n  sqlite3_vtab *pVtab;\r\n  Mem *pName;\r\n#endif /* local variables moved into u.cp */\r\n\r\n  u.cp.pVtab = pOp->p4.pVtab->pVtab;\r\n  u.cp.pName = &aMem[pOp->p1];\r\n  assert( u.cp.pVtab->pModule->xRename );\r\n  assert( memIsValid(u.cp.pName) );\r\n  REGISTER_TRACE(pOp->p1, u.cp.pName);\r\n  assert( u.cp.pName->flags & MEM_Str );\r\n  testcase( u.cp.pName->enc==SQLITE_UTF8 );\r\n  testcase( u.cp.pName->enc==SQLITE_UTF16BE );\r\n  testcase( u.cp.pName->enc==SQLITE_UTF16LE );\r\n  rc = sqlite3VdbeChangeEncoding(u.cp.pName, SQLITE_UTF8);\r\n  if( rc==SQLITE_OK ){\r\n    rc = u.cp.pVtab->pModule->xRename(u.cp.pVtab, u.cp.pName->z);\r\n    importVtabErrMsg(p, u.cp.pVtab);\r\n    p->expired = 0;\r\n  }\r\n  break;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Opcode: VUpdate P1 P2 P3 P4 *\r\n**\r\n** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.\r\n** This opcode invokes the corresponding xUpdate method. P2 values\r\n** are contiguous memory cells starting at P3 to pass to the xUpdate \r\n** invocation. The value in register (P3+P2-1) corresponds to the \r\n** p2th element of the argv array passed to xUpdate.\r\n**\r\n** The xUpdate method will do a DELETE or an INSERT or both.\r\n** The argv[0] element (which corresponds to memory cell P3)\r\n** is the rowid of a row to delete.  If argv[0] is NULL then no \r\n** deletion occurs.  The argv[1] element is the rowid of the new \r\n** row.  This can be NULL to have the virtual table select the new \r\n** rowid for itself.  The subsequent elements in the array are \r\n** the values of columns in the new row.\r\n**\r\n** If P2==1 then no insert is performed.  argv[0] is the rowid of\r\n** a row to delete.\r\n**\r\n** P1 is a boolean flag. If it is set to true and the xUpdate call\r\n** is successful, then the value returned by sqlite3_last_insert_rowid() \r\n** is set to the value of the rowid for the row just inserted.\r\n*/\r\ncase OP_VUpdate: {\r\n#if 0  /* local variables moved into u.cq */\r\n  sqlite3_vtab *pVtab;\r\n  sqlite3_module *pModule;\r\n  int nArg;\r\n  int i;\r\n  sqlite_int64 rowid;\r\n  Mem **apArg;\r\n  Mem *pX;\r\n#endif /* local variables moved into u.cq */\r\n\r\n  assert( pOp->p2==1        || pOp->p5==OE_Fail   || pOp->p5==OE_Rollback\r\n       || pOp->p5==OE_Abort || pOp->p5==OE_Ignore || pOp->p5==OE_Replace\r\n  );\r\n  u.cq.pVtab = pOp->p4.pVtab->pVtab;\r\n  u.cq.pModule = (sqlite3_module *)u.cq.pVtab->pModule;\r\n  u.cq.nArg = pOp->p2;\r\n  assert( pOp->p4type==P4_VTAB );\r\n  if( ALWAYS(u.cq.pModule->xUpdate) ){\r\n    u8 vtabOnConflict = db->vtabOnConflict;\r\n    u.cq.apArg = p->apArg;\r\n    u.cq.pX = &aMem[pOp->p3];\r\n    for(u.cq.i=0; u.cq.i<u.cq.nArg; u.cq.i++){\r\n      assert( memIsValid(u.cq.pX) );\r\n      memAboutToChange(p, u.cq.pX);\r\n      sqlite3VdbeMemStoreType(u.cq.pX);\r\n      u.cq.apArg[u.cq.i] = u.cq.pX;\r\n      u.cq.pX++;\r\n    }\r\n    db->vtabOnConflict = pOp->p5;\r\n    rc = u.cq.pModule->xUpdate(u.cq.pVtab, u.cq.nArg, u.cq.apArg, &u.cq.rowid);\r\n    db->vtabOnConflict = vtabOnConflict;\r\n    importVtabErrMsg(p, u.cq.pVtab);\r\n    if( rc==SQLITE_OK && pOp->p1 ){\r\n      assert( u.cq.nArg>1 && u.cq.apArg[0] && (u.cq.apArg[0]->flags&MEM_Null) );\r\n      db->lastRowid = lastRowid = u.cq.rowid;\r\n    }\r\n    if( rc==SQLITE_CONSTRAINT && pOp->p4.pVtab->bConstraint ){\r\n      if( pOp->p5==OE_Ignore ){\r\n        rc = SQLITE_OK;\r\n      }else{\r\n        p->errorAction = ((pOp->p5==OE_Replace) ? OE_Abort : pOp->p5);\r\n      }\r\n    }else{\r\n      p->nChange++;\r\n    }\r\n  }\r\n  break;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifndef  SQLITE_OMIT_PAGER_PRAGMAS\r\n/* Opcode: Pagecount P1 P2 * * *\r\n**\r\n** Write the current number of pages in database P1 to memory cell P2.\r\n*/\r\ncase OP_Pagecount: {            /* out2-prerelease */\r\n  pOut->u.i = sqlite3BtreeLastPage(db->aDb[pOp->p1].pBt);\r\n  break;\r\n}\r\n#endif\r\n\r\n\r\n#ifndef  SQLITE_OMIT_PAGER_PRAGMAS\r\n/* Opcode: MaxPgcnt P1 P2 P3 * *\r\n**\r\n** Try to set the maximum page count for database P1 to the value in P3.\r\n** Do not let the maximum page count fall below the current page count and\r\n** do not change the maximum page count value if P3==0.\r\n**\r\n** Store the maximum page count after the change in register P2.\r\n*/\r\ncase OP_MaxPgcnt: {            /* out2-prerelease */\r\n  unsigned int newMax;\r\n  Btree *pBt;\r\n\r\n  pBt = db->aDb[pOp->p1].pBt;\r\n  newMax = 0;\r\n  if( pOp->p3 ){\r\n    newMax = sqlite3BtreeLastPage(pBt);\r\n    if( newMax < (unsigned)pOp->p3 ) newMax = (unsigned)pOp->p3;\r\n  }\r\n  pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax);\r\n  break;\r\n}\r\n#endif\r\n\r\n\r\n#ifndef SQLITE_OMIT_TRACE\r\n/* Opcode: Trace * * * P4 *\r\n**\r\n** If tracing is enabled (by the sqlite3_trace()) interface, then\r\n** the UTF-8 string contained in P4 is emitted on the trace callback.\r\n*/\r\ncase OP_Trace: {\r\n#if 0  /* local variables moved into u.cr */\r\n  char *zTrace;\r\n  char *z;\r\n#endif /* local variables moved into u.cr */\r\n\r\n  if( db->xTrace && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){\r\n    u.cr.z = sqlite3VdbeExpandSql(p, u.cr.zTrace);\r\n    db->xTrace(db->pTraceArg, u.cr.z);\r\n    sqlite3DbFree(db, u.cr.z);\r\n  }\r\n#ifdef SQLITE_DEBUG\r\n  if( (db->flags & SQLITE_SqlTrace)!=0\r\n   && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0\r\n  ){\r\n    sqlite3DebugPrintf(\"SQL-trace: %s\\n\", u.cr.zTrace);\r\n  }\r\n#endif /* SQLITE_DEBUG */\r\n  break;\r\n}\r\n#endif\r\n\r\n\r\n/* Opcode: Noop * * * * *\r\n**\r\n** Do nothing.  This instruction is often useful as a jump\r\n** destination.\r\n*/\r\n/*\r\n** The magic Explain opcode are only inserted when explain==2 (which\r\n** is to say when the EXPLAIN QUERY PLAN syntax is used.)\r\n** This opcode records information from the optimizer.  It is the\r\n** the same as a no-op.  This opcodesnever appears in a real VM program.\r\n*/\r\ndefault: {          /* This is really OP_Noop and OP_Explain */\r\n  assert( pOp->opcode==OP_Noop || pOp->opcode==OP_Explain );\r\n  break;\r\n}\r\n\r\n/*****************************************************************************\r\n** The cases of the switch statement above this line should all be indented\r\n** by 6 spaces.  But the left-most 6 spaces have been removed to improve the\r\n** readability.  From this point on down, the normal indentation rules are\r\n** restored.\r\n*****************************************************************************/\r\n    }\r\n\r\n#ifdef VDBE_PROFILE\r\n    {\r\n      u64 elapsed = sqlite3Hwtime() - start;\r\n      pOp->cycles += elapsed;\r\n      pOp->cnt++;\r\n#if 0\r\n        fprintf(stdout, \"%10llu \", elapsed);\r\n        sqlite3VdbePrintOp(stdout, origPc, &aOp[origPc]);\r\n#endif\r\n    }\r\n#endif\r\n\r\n    /* The following code adds nothing to the actual functionality\r\n    ** of the program.  It is only here for testing and debugging.\r\n    ** On the other hand, it does burn CPU cycles every time through\r\n    ** the evaluator loop.  So we can leave it out when NDEBUG is defined.\r\n    */\r\n#ifndef NDEBUG\r\n    assert( pc>=-1 && pc<p->nOp );\r\n\r\n#ifdef SQLITE_DEBUG\r\n    if( p->trace ){\r\n      if( rc!=0 ) fprintf(p->trace,\"rc=%d\\n\",rc);\r\n      if( pOp->opflags & (OPFLG_OUT2_PRERELEASE|OPFLG_OUT2) ){\r\n        registerTrace(p->trace, pOp->p2, &aMem[pOp->p2]);\r\n      }\r\n      if( pOp->opflags & OPFLG_OUT3 ){\r\n        registerTrace(p->trace, pOp->p3, &aMem[pOp->p3]);\r\n      }\r\n    }\r\n#endif  /* SQLITE_DEBUG */\r\n#endif  /* NDEBUG */\r\n  }  /* The end of the for(;;) loop the loops through opcodes */\r\n\r\n  /* If we reach this point, it means that execution is finished with\r\n  ** an error of some kind.\r\n  */\r\nvdbe_error_halt:\r\n  assert( rc );\r\n  p->rc = rc;\r\n  testcase( sqlite3GlobalConfig.xLog!=0 );\r\n  sqlite3_log(rc, \"statement aborts at %d: [%s] %s\", \r\n                   pc, p->zSql, p->zErrMsg);\r\n  sqlite3VdbeHalt(p);\r\n  if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1;\r\n  rc = SQLITE_ERROR;\r\n  if( resetSchemaOnFault>0 ){\r\n    sqlite3ResetInternalSchema(db, resetSchemaOnFault-1);\r\n  }\r\n\r\n  /* This is the only way out of this procedure.  We have to\r\n  ** release the mutexes on btrees that were acquired at the\r\n  ** top. */\r\nvdbe_return:\r\n  db->lastRowid = lastRowid;\r\n  sqlite3VdbeLeave(p);\r\n  return rc;\r\n\r\n  /* Jump to here if a string or blob larger than SQLITE_MAX_LENGTH\r\n  ** is encountered.\r\n  */\r\ntoo_big:\r\n  sqlite3SetString(&p->zErrMsg, db, \"string or blob too big\");\r\n  rc = SQLITE_TOOBIG;\r\n  goto vdbe_error_halt;\r\n\r\n  /* Jump to here if a malloc() fails.\r\n  */\r\nno_mem:\r\n  db->mallocFailed = 1;\r\n  sqlite3SetString(&p->zErrMsg, db, \"out of memory\");\r\n  rc = SQLITE_NOMEM;\r\n  goto vdbe_error_halt;\r\n\r\n  /* Jump to here for any other kind of fatal error.  The \"rc\" variable\r\n  ** should hold the error number.\r\n  */\r\nabort_due_to_error:\r\n  assert( p->zErrMsg==0 );\r\n  if( db->mallocFailed ) rc = SQLITE_NOMEM;\r\n  if( rc!=SQLITE_IOERR_NOMEM ){\r\n    sqlite3SetString(&p->zErrMsg, db, \"%s\", sqlite3ErrStr(rc));\r\n  }\r\n  goto vdbe_error_halt;\r\n\r\n  /* Jump to here if the sqlite3_interrupt() API sets the interrupt\r\n  ** flag.\r\n  */\r\nabort_due_to_interrupt:\r\n  assert( db->u1.isInterrupted );\r\n  rc = SQLITE_INTERRUPT;\r\n  p->rc = rc;\r\n  sqlite3SetString(&p->zErrMsg, db, \"%s\", sqlite3ErrStr(rc));\r\n  goto vdbe_error_halt;\r\n}\r\n\r\n/************** End of vdbe.c ************************************************/\r\n/************** Begin file vdbeblob.c ****************************************/\r\n/*\r\n** 2007 May 1\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code used to implement incremental BLOB I/O.\r\n*/\r\n\r\n\r\n#ifndef SQLITE_OMIT_INCRBLOB\r\n\r\n/*\r\n** Valid sqlite3_blob* handles point to Incrblob structures.\r\n*/\r\ntypedef struct Incrblob Incrblob;\r\nstruct Incrblob {\r\n  int flags;              /* Copy of \"flags\" passed to sqlite3_blob_open() */\r\n  int nByte;              /* Size of open blob, in bytes */\r\n  int iOffset;            /* Byte offset of blob in cursor data */\r\n  int iCol;               /* Table column this handle is open on */\r\n  BtCursor *pCsr;         /* Cursor pointing at blob row */\r\n  sqlite3_stmt *pStmt;    /* Statement holding cursor open */\r\n  sqlite3 *db;            /* The associated database */\r\n};\r\n\r\n\r\n/*\r\n** This function is used by both blob_open() and blob_reopen(). It seeks\r\n** the b-tree cursor associated with blob handle p to point to row iRow.\r\n** If successful, SQLITE_OK is returned and subsequent calls to\r\n** sqlite3_blob_read() or sqlite3_blob_write() access the specified row.\r\n**\r\n** If an error occurs, or if the specified row does not exist or does not\r\n** contain a value of type TEXT or BLOB in the column nominated when the\r\n** blob handle was opened, then an error code is returned and *pzErr may\r\n** be set to point to a buffer containing an error message. It is the\r\n** responsibility of the caller to free the error message buffer using\r\n** sqlite3DbFree().\r\n**\r\n** If an error does occur, then the b-tree cursor is closed. All subsequent\r\n** calls to sqlite3_blob_read(), blob_write() or blob_reopen() will \r\n** immediately return SQLITE_ABORT.\r\n*/\r\nstatic int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){\r\n  int rc;                         /* Error code */\r\n  char *zErr = 0;                 /* Error message */\r\n  Vdbe *v = (Vdbe *)p->pStmt;\r\n\r\n  /* Set the value of the SQL statements only variable to integer iRow. \r\n  ** This is done directly instead of using sqlite3_bind_int64() to avoid \r\n  ** triggering asserts related to mutexes.\r\n  */\r\n  assert( v->aVar[0].flags&MEM_Int );\r\n  v->aVar[0].u.i = iRow;\r\n\r\n  rc = sqlite3_step(p->pStmt);\r\n  if( rc==SQLITE_ROW ){\r\n    u32 type = v->apCsr[0]->aType[p->iCol];\r\n    if( type<12 ){\r\n      zErr = sqlite3MPrintf(p->db, \"cannot open value of type %s\",\r\n          type==0?\"null\": type==7?\"real\": \"integer\"\r\n      );\r\n      rc = SQLITE_ERROR;\r\n      sqlite3_finalize(p->pStmt);\r\n      p->pStmt = 0;\r\n    }else{\r\n      p->iOffset = v->apCsr[0]->aOffset[p->iCol];\r\n      p->nByte = sqlite3VdbeSerialTypeLen(type);\r\n      p->pCsr =  v->apCsr[0]->pCursor;\r\n      sqlite3BtreeEnterCursor(p->pCsr);\r\n      sqlite3BtreeCacheOverflow(p->pCsr);\r\n      sqlite3BtreeLeaveCursor(p->pCsr);\r\n    }\r\n  }\r\n\r\n  if( rc==SQLITE_ROW ){\r\n    rc = SQLITE_OK;\r\n  }else if( p->pStmt ){\r\n    rc = sqlite3_finalize(p->pStmt);\r\n    p->pStmt = 0;\r\n    if( rc==SQLITE_OK ){\r\n      zErr = sqlite3MPrintf(p->db, \"no such rowid: %lld\", iRow);\r\n      rc = SQLITE_ERROR;\r\n    }else{\r\n      zErr = sqlite3MPrintf(p->db, \"%s\", sqlite3_errmsg(p->db));\r\n    }\r\n  }\r\n\r\n  assert( rc!=SQLITE_OK || zErr==0 );\r\n  assert( rc!=SQLITE_ROW && rc!=SQLITE_DONE );\r\n\r\n  *pzErr = zErr;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Open a blob handle.\r\n*/\r\nSQLITE_API int sqlite3_blob_open(\r\n  sqlite3* db,            /* The database connection */\r\n  const char *zDb,        /* The attached database containing the blob */\r\n  const char *zTable,     /* The table containing the blob */\r\n  const char *zColumn,    /* The column containing the blob */\r\n  sqlite_int64 iRow,      /* The row containing the glob */\r\n  int flags,              /* True -> read/write access, false -> read-only */\r\n  sqlite3_blob **ppBlob   /* Handle for accessing the blob returned here */\r\n){\r\n  int nAttempt = 0;\r\n  int iCol;               /* Index of zColumn in row-record */\r\n\r\n  /* This VDBE program seeks a btree cursor to the identified \r\n  ** db/table/row entry. The reason for using a vdbe program instead\r\n  ** of writing code to use the b-tree layer directly is that the\r\n  ** vdbe program will take advantage of the various transaction,\r\n  ** locking and error handling infrastructure built into the vdbe.\r\n  **\r\n  ** After seeking the cursor, the vdbe executes an OP_ResultRow.\r\n  ** Code external to the Vdbe then \"borrows\" the b-tree cursor and\r\n  ** uses it to implement the blob_read(), blob_write() and \r\n  ** blob_bytes() functions.\r\n  **\r\n  ** The sqlite3_blob_close() function finalizes the vdbe program,\r\n  ** which closes the b-tree cursor and (possibly) commits the \r\n  ** transaction.\r\n  */\r\n  static const VdbeOpList openBlob[] = {\r\n    {OP_Transaction, 0, 0, 0},     /* 0: Start a transaction */\r\n    {OP_VerifyCookie, 0, 0, 0},    /* 1: Check the schema cookie */\r\n    {OP_TableLock, 0, 0, 0},       /* 2: Acquire a read or write lock */\r\n\r\n    /* One of the following two instructions is replaced by an OP_Noop. */\r\n    {OP_OpenRead, 0, 0, 0},        /* 3: Open cursor 0 for reading */\r\n    {OP_OpenWrite, 0, 0, 0},       /* 4: Open cursor 0 for read/write */\r\n\r\n    {OP_Variable, 1, 1, 1},        /* 5: Push the rowid to the stack */\r\n    {OP_NotExists, 0, 10, 1},      /* 6: Seek the cursor */\r\n    {OP_Column, 0, 0, 1},          /* 7  */\r\n    {OP_ResultRow, 1, 0, 0},       /* 8  */\r\n    {OP_Goto, 0, 5, 0},            /* 9  */\r\n    {OP_Close, 0, 0, 0},           /* 10 */\r\n    {OP_Halt, 0, 0, 0},            /* 11 */\r\n  };\r\n\r\n  int rc = SQLITE_OK;\r\n  char *zErr = 0;\r\n  Table *pTab;\r\n  Parse *pParse = 0;\r\n  Incrblob *pBlob = 0;\r\n\r\n  flags = !!flags;                /* flags = (flags ? 1 : 0); */\r\n  *ppBlob = 0;\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n\r\n  pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob));\r\n  if( !pBlob ) goto blob_open_out;\r\n  pParse = sqlite3StackAllocRaw(db, sizeof(*pParse));\r\n  if( !pParse ) goto blob_open_out;\r\n\r\n  do {\r\n    memset(pParse, 0, sizeof(Parse));\r\n    pParse->db = db;\r\n    sqlite3DbFree(db, zErr);\r\n    zErr = 0;\r\n\r\n    sqlite3BtreeEnterAll(db);\r\n    pTab = sqlite3LocateTable(pParse, 0, zTable, zDb);\r\n    if( pTab && IsVirtual(pTab) ){\r\n      pTab = 0;\r\n      sqlite3ErrorMsg(pParse, \"cannot open virtual table: %s\", zTable);\r\n    }\r\n#ifndef SQLITE_OMIT_VIEW\r\n    if( pTab && pTab->pSelect ){\r\n      pTab = 0;\r\n      sqlite3ErrorMsg(pParse, \"cannot open view: %s\", zTable);\r\n    }\r\n#endif\r\n    if( !pTab ){\r\n      if( pParse->zErrMsg ){\r\n        sqlite3DbFree(db, zErr);\r\n        zErr = pParse->zErrMsg;\r\n        pParse->zErrMsg = 0;\r\n      }\r\n      rc = SQLITE_ERROR;\r\n      sqlite3BtreeLeaveAll(db);\r\n      goto blob_open_out;\r\n    }\r\n\r\n    /* Now search pTab for the exact column. */\r\n    for(iCol=0; iCol<pTab->nCol; iCol++) {\r\n      if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){\r\n        break;\r\n      }\r\n    }\r\n    if( iCol==pTab->nCol ){\r\n      sqlite3DbFree(db, zErr);\r\n      zErr = sqlite3MPrintf(db, \"no such column: \\\"%s\\\"\", zColumn);\r\n      rc = SQLITE_ERROR;\r\n      sqlite3BtreeLeaveAll(db);\r\n      goto blob_open_out;\r\n    }\r\n\r\n    /* If the value is being opened for writing, check that the\r\n    ** column is not indexed, and that it is not part of a foreign key. \r\n    ** It is against the rules to open a column to which either of these\r\n    ** descriptions applies for writing.  */\r\n    if( flags ){\r\n      const char *zFault = 0;\r\n      Index *pIdx;\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n      if( db->flags&SQLITE_ForeignKeys ){\r\n        /* Check that the column is not part of an FK child key definition. It\r\n        ** is not necessary to check if it is part of a parent key, as parent\r\n        ** key columns must be indexed. The check below will pick up this \r\n        ** case.  */\r\n        FKey *pFKey;\r\n        for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){\r\n          int j;\r\n          for(j=0; j<pFKey->nCol; j++){\r\n            if( pFKey->aCol[j].iFrom==iCol ){\r\n              zFault = \"foreign key\";\r\n            }\r\n          }\r\n        }\r\n      }\r\n#endif\r\n      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n        int j;\r\n        for(j=0; j<pIdx->nColumn; j++){\r\n          if( pIdx->aiColumn[j]==iCol ){\r\n            zFault = \"indexed\";\r\n          }\r\n        }\r\n      }\r\n      if( zFault ){\r\n        sqlite3DbFree(db, zErr);\r\n        zErr = sqlite3MPrintf(db, \"cannot open %s column for writing\", zFault);\r\n        rc = SQLITE_ERROR;\r\n        sqlite3BtreeLeaveAll(db);\r\n        goto blob_open_out;\r\n      }\r\n    }\r\n\r\n    pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(db);\r\n    assert( pBlob->pStmt || db->mallocFailed );\r\n    if( pBlob->pStmt ){\r\n      Vdbe *v = (Vdbe *)pBlob->pStmt;\r\n      int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n\r\n      sqlite3VdbeAddOpList(v, sizeof(openBlob)/sizeof(VdbeOpList), openBlob);\r\n\r\n\r\n      /* Configure the OP_Transaction */\r\n      sqlite3VdbeChangeP1(v, 0, iDb);\r\n      sqlite3VdbeChangeP2(v, 0, flags);\r\n\r\n      /* Configure the OP_VerifyCookie */\r\n      sqlite3VdbeChangeP1(v, 1, iDb);\r\n      sqlite3VdbeChangeP2(v, 1, pTab->pSchema->schema_cookie);\r\n      sqlite3VdbeChangeP3(v, 1, pTab->pSchema->iGeneration);\r\n\r\n      /* Make sure a mutex is held on the table to be accessed */\r\n      sqlite3VdbeUsesBtree(v, iDb); \r\n\r\n      /* Configure the OP_TableLock instruction */\r\n#ifdef SQLITE_OMIT_SHARED_CACHE\r\n      sqlite3VdbeChangeToNoop(v, 2);\r\n#else\r\n      sqlite3VdbeChangeP1(v, 2, iDb);\r\n      sqlite3VdbeChangeP2(v, 2, pTab->tnum);\r\n      sqlite3VdbeChangeP3(v, 2, flags);\r\n      sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT);\r\n#endif\r\n\r\n      /* Remove either the OP_OpenWrite or OpenRead. Set the P2 \r\n      ** parameter of the other to pTab->tnum.  */\r\n      sqlite3VdbeChangeToNoop(v, 4 - flags);\r\n      sqlite3VdbeChangeP2(v, 3 + flags, pTab->tnum);\r\n      sqlite3VdbeChangeP3(v, 3 + flags, iDb);\r\n\r\n      /* Configure the number of columns. Configure the cursor to\r\n      ** think that the table has one more column than it really\r\n      ** does. An OP_Column to retrieve this imaginary column will\r\n      ** always return an SQL NULL. This is useful because it means\r\n      ** we can invoke OP_Column to fill in the vdbe cursors type \r\n      ** and offset cache without causing any IO.\r\n      */\r\n      sqlite3VdbeChangeP4(v, 3+flags, SQLITE_INT_TO_PTR(pTab->nCol+1),P4_INT32);\r\n      sqlite3VdbeChangeP2(v, 7, pTab->nCol);\r\n      if( !db->mallocFailed ){\r\n        pParse->nVar = 1;\r\n        pParse->nMem = 1;\r\n        pParse->nTab = 1;\r\n        sqlite3VdbeMakeReady(v, pParse);\r\n      }\r\n    }\r\n   \r\n    pBlob->flags = flags;\r\n    pBlob->iCol = iCol;\r\n    pBlob->db = db;\r\n    sqlite3BtreeLeaveAll(db);\r\n    if( db->mallocFailed ){\r\n      goto blob_open_out;\r\n    }\r\n    sqlite3_bind_int64(pBlob->pStmt, 1, iRow);\r\n    rc = blobSeekToRow(pBlob, iRow, &zErr);\r\n  } while( (++nAttempt)<5 && rc==SQLITE_SCHEMA );\r\n\r\nblob_open_out:\r\n  if( rc==SQLITE_OK && db->mallocFailed==0 ){\r\n    *ppBlob = (sqlite3_blob *)pBlob;\r\n  }else{\r\n    if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt);\r\n    sqlite3DbFree(db, pBlob);\r\n  }\r\n  sqlite3Error(db, rc, (zErr ? \"%s\" : 0), zErr);\r\n  sqlite3DbFree(db, zErr);\r\n  sqlite3StackFree(db, pParse);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close a blob handle that was previously created using\r\n** sqlite3_blob_open().\r\n*/\r\nSQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){\r\n  Incrblob *p = (Incrblob *)pBlob;\r\n  int rc;\r\n  sqlite3 *db;\r\n\r\n  if( p ){\r\n    db = p->db;\r\n    sqlite3_mutex_enter(db->mutex);\r\n    rc = sqlite3_finalize(p->pStmt);\r\n    sqlite3DbFree(db, p);\r\n    sqlite3_mutex_leave(db->mutex);\r\n  }else{\r\n    rc = SQLITE_OK;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Perform a read or write operation on a blob\r\n*/\r\nstatic int blobReadWrite(\r\n  sqlite3_blob *pBlob, \r\n  void *z, \r\n  int n, \r\n  int iOffset, \r\n  int (*xCall)(BtCursor*, u32, u32, void*)\r\n){\r\n  int rc;\r\n  Incrblob *p = (Incrblob *)pBlob;\r\n  Vdbe *v;\r\n  sqlite3 *db;\r\n\r\n  if( p==0 ) return SQLITE_MISUSE_BKPT;\r\n  db = p->db;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  v = (Vdbe*)p->pStmt;\r\n\r\n  if( n<0 || iOffset<0 || (iOffset+n)>p->nByte ){\r\n    /* Request is out of range. Return a transient error. */\r\n    rc = SQLITE_ERROR;\r\n    sqlite3Error(db, SQLITE_ERROR, 0);\r\n  }else if( v==0 ){\r\n    /* If there is no statement handle, then the blob-handle has\r\n    ** already been invalidated. Return SQLITE_ABORT in this case.\r\n    */\r\n    rc = SQLITE_ABORT;\r\n  }else{\r\n    /* Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is\r\n    ** returned, clean-up the statement handle.\r\n    */\r\n    assert( db == v->db );\r\n    sqlite3BtreeEnterCursor(p->pCsr);\r\n    rc = xCall(p->pCsr, iOffset+p->iOffset, n, z);\r\n    sqlite3BtreeLeaveCursor(p->pCsr);\r\n    if( rc==SQLITE_ABORT ){\r\n      sqlite3VdbeFinalize(v);\r\n      p->pStmt = 0;\r\n    }else{\r\n      db->errCode = rc;\r\n      v->rc = rc;\r\n    }\r\n  }\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Read data from a blob handle.\r\n*/\r\nSQLITE_API int sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){\r\n  return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);\r\n}\r\n\r\n/*\r\n** Write data to a blob handle.\r\n*/\r\nSQLITE_API int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){\r\n  return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);\r\n}\r\n\r\n/*\r\n** Query a blob handle for the size of the data.\r\n**\r\n** The Incrblob.nByte field is fixed for the lifetime of the Incrblob\r\n** so no mutex is required for access.\r\n*/\r\nSQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){\r\n  Incrblob *p = (Incrblob *)pBlob;\r\n  return (p && p->pStmt) ? p->nByte : 0;\r\n}\r\n\r\n/*\r\n** Move an existing blob handle to point to a different row of the same\r\n** database table.\r\n**\r\n** If an error occurs, or if the specified row does not exist or does not\r\n** contain a blob or text value, then an error code is returned and the\r\n** database handle error code and message set. If this happens, then all \r\n** subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) \r\n** immediately return SQLITE_ABORT.\r\n*/\r\nSQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){\r\n  int rc;\r\n  Incrblob *p = (Incrblob *)pBlob;\r\n  sqlite3 *db;\r\n\r\n  if( p==0 ) return SQLITE_MISUSE_BKPT;\r\n  db = p->db;\r\n  sqlite3_mutex_enter(db->mutex);\r\n\r\n  if( p->pStmt==0 ){\r\n    /* If there is no statement handle, then the blob-handle has\r\n    ** already been invalidated. Return SQLITE_ABORT in this case.\r\n    */\r\n    rc = SQLITE_ABORT;\r\n  }else{\r\n    char *zErr;\r\n    rc = blobSeekToRow(p, iRow, &zErr);\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3Error(db, rc, (zErr ? \"%s\" : 0), zErr);\r\n      sqlite3DbFree(db, zErr);\r\n    }\r\n    assert( rc!=SQLITE_SCHEMA );\r\n  }\r\n\r\n  rc = sqlite3ApiExit(db, rc);\r\n  assert( rc==SQLITE_OK || p->pStmt==0 );\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n#endif /* #ifndef SQLITE_OMIT_INCRBLOB */\r\n\r\n/************** End of vdbeblob.c ********************************************/\r\n/************** Begin file vdbesort.c ****************************************/\r\n/*\r\n** 2011 July 9\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code for the VdbeSorter object, used in concert with\r\n** a VdbeCursor to sort large numbers of keys (as may be required, for\r\n** example, by CREATE INDEX statements on tables too large to fit in main\r\n** memory).\r\n*/\r\n\r\n\r\n#ifndef SQLITE_OMIT_MERGE_SORT\r\n\r\ntypedef struct VdbeSorterIter VdbeSorterIter;\r\ntypedef struct SorterRecord SorterRecord;\r\n\r\n/*\r\n** NOTES ON DATA STRUCTURE USED FOR N-WAY MERGES:\r\n**\r\n** As keys are added to the sorter, they are written to disk in a series\r\n** of sorted packed-memory-arrays (PMAs). The size of each PMA is roughly\r\n** the same as the cache-size allowed for temporary databases. In order\r\n** to allow the caller to extract keys from the sorter in sorted order,\r\n** all PMAs currently stored on disk must be merged together. This comment\r\n** describes the data structure used to do so. The structure supports \r\n** merging any number of arrays in a single pass with no redundant comparison \r\n** operations.\r\n**\r\n** The aIter[] array contains an iterator for each of the PMAs being merged.\r\n** An aIter[] iterator either points to a valid key or else is at EOF. For \r\n** the purposes of the paragraphs below, we assume that the array is actually \r\n** N elements in size, where N is the smallest power of 2 greater to or equal \r\n** to the number of iterators being merged. The extra aIter[] elements are \r\n** treated as if they are empty (always at EOF).\r\n**\r\n** The aTree[] array is also N elements in size. The value of N is stored in\r\n** the VdbeSorter.nTree variable.\r\n**\r\n** The final (N/2) elements of aTree[] contain the results of comparing\r\n** pairs of iterator keys together. Element i contains the result of \r\n** comparing aIter[2*i-N] and aIter[2*i-N+1]. Whichever key is smaller, the\r\n** aTree element is set to the index of it. \r\n**\r\n** For the purposes of this comparison, EOF is considered greater than any\r\n** other key value. If the keys are equal (only possible with two EOF\r\n** values), it doesn't matter which index is stored.\r\n**\r\n** The (N/4) elements of aTree[] that preceed the final (N/2) described \r\n** above contains the index of the smallest of each block of 4 iterators.\r\n** And so on. So that aTree[1] contains the index of the iterator that \r\n** currently points to the smallest key value. aTree[0] is unused.\r\n**\r\n** Example:\r\n**\r\n**     aIter[0] -> Banana\r\n**     aIter[1] -> Feijoa\r\n**     aIter[2] -> Elderberry\r\n**     aIter[3] -> Currant\r\n**     aIter[4] -> Grapefruit\r\n**     aIter[5] -> Apple\r\n**     aIter[6] -> Durian\r\n**     aIter[7] -> EOF\r\n**\r\n**     aTree[] = { X, 5   0, 5    0, 3, 5, 6 }\r\n**\r\n** The current element is \"Apple\" (the value of the key indicated by \r\n** iterator 5). When the Next() operation is invoked, iterator 5 will\r\n** be advanced to the next key in its segment. Say the next key is\r\n** \"Eggplant\":\r\n**\r\n**     aIter[5] -> Eggplant\r\n**\r\n** The contents of aTree[] are updated first by comparing the new iterator\r\n** 5 key to the current key of iterator 4 (still \"Grapefruit\"). The iterator\r\n** 5 value is still smaller, so aTree[6] is set to 5. And so on up the tree.\r\n** The value of iterator 6 - \"Durian\" - is now smaller than that of iterator\r\n** 5, so aTree[3] is set to 6. Key 0 is smaller than key 6 (Banana<Durian),\r\n** so the value written into element 1 of the array is 0. As follows:\r\n**\r\n**     aTree[] = { X, 0   0, 6    0, 3, 5, 6 }\r\n**\r\n** In other words, each time we advance to the next sorter element, log2(N)\r\n** key comparison operations are required, where N is the number of segments\r\n** being merged (rounded up to the next power of 2).\r\n*/\r\nstruct VdbeSorter {\r\n  i64 iWriteOff;                  /* Current write offset within file pTemp1 */\r\n  i64 iReadOff;                   /* Current read offset within file pTemp1 */\r\n  int nInMemory;                  /* Current size of pRecord list as PMA */\r\n  int nTree;                      /* Used size of aTree/aIter (power of 2) */\r\n  int nPMA;                       /* Number of PMAs stored in pTemp1 */\r\n  int mnPmaSize;                  /* Minimum PMA size, in bytes */\r\n  int mxPmaSize;                  /* Maximum PMA size, in bytes.  0==no limit */\r\n  VdbeSorterIter *aIter;          /* Array of iterators to merge */\r\n  int *aTree;                     /* Current state of incremental merge */\r\n  sqlite3_file *pTemp1;           /* PMA file 1 */\r\n  SorterRecord *pRecord;          /* Head of in-memory record list */\r\n  UnpackedRecord *pUnpacked;      /* Used to unpack keys */\r\n};\r\n\r\n/*\r\n** The following type is an iterator for a PMA. It caches the current key in \r\n** variables nKey/aKey. If the iterator is at EOF, pFile==0.\r\n*/\r\nstruct VdbeSorterIter {\r\n  i64 iReadOff;                   /* Current read offset */\r\n  i64 iEof;                       /* 1 byte past EOF for this iterator */\r\n  int nAlloc;                     /* Bytes of space at aAlloc */\r\n  int nKey;                       /* Number of bytes in key */\r\n  sqlite3_file *pFile;            /* File iterator is reading from */\r\n  u8 *aAlloc;                     /* Allocated space */\r\n  u8 *aKey;                       /* Pointer to current key */\r\n};\r\n\r\n/*\r\n** A structure to store a single record. All in-memory records are connected\r\n** together into a linked list headed at VdbeSorter.pRecord using the \r\n** SorterRecord.pNext pointer.\r\n*/\r\nstruct SorterRecord {\r\n  void *pVal;\r\n  int nVal;\r\n  SorterRecord *pNext;\r\n};\r\n\r\n/* Minimum allowable value for the VdbeSorter.nWorking variable */\r\n#define SORTER_MIN_WORKING 10\r\n\r\n/* Maximum number of segments to merge in a single pass. */\r\n#define SORTER_MAX_MERGE_COUNT 16\r\n\r\n/*\r\n** Free all memory belonging to the VdbeSorterIter object passed as the second\r\n** argument. All structure fields are set to zero before returning.\r\n*/\r\nstatic void vdbeSorterIterZero(sqlite3 *db, VdbeSorterIter *pIter){\r\n  sqlite3DbFree(db, pIter->aAlloc);\r\n  memset(pIter, 0, sizeof(VdbeSorterIter));\r\n}\r\n\r\n/*\r\n** Advance iterator pIter to the next key in its PMA. Return SQLITE_OK if\r\n** no error occurs, or an SQLite error code if one does.\r\n*/\r\nstatic int vdbeSorterIterNext(\r\n  sqlite3 *db,                    /* Database handle (for sqlite3DbMalloc() ) */\r\n  VdbeSorterIter *pIter           /* Iterator to advance */\r\n){\r\n  int rc;                         /* Return Code */\r\n  int nRead;                      /* Number of bytes read */\r\n  int nRec = 0;                   /* Size of record in bytes */\r\n  int iOff = 0;                   /* Size of serialized size varint in bytes */\r\n\r\n  assert( pIter->iEof>=pIter->iReadOff );\r\n  if( pIter->iEof-pIter->iReadOff>5 ){\r\n    nRead = 5;\r\n  }else{\r\n    nRead = (int)(pIter->iEof - pIter->iReadOff);\r\n  }\r\n  if( nRead<=0 ){\r\n    /* This is an EOF condition */\r\n    vdbeSorterIterZero(db, pIter);\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  rc = sqlite3OsRead(pIter->pFile, pIter->aAlloc, nRead, pIter->iReadOff);\r\n  if( rc==SQLITE_OK ){\r\n    iOff = getVarint32(pIter->aAlloc, nRec);\r\n    if( (iOff+nRec)>nRead ){\r\n      int nRead2;                   /* Number of extra bytes to read */\r\n      if( (iOff+nRec)>pIter->nAlloc ){\r\n        int nNew = pIter->nAlloc*2;\r\n        while( (iOff+nRec)>nNew ) nNew = nNew*2;\r\n        pIter->aAlloc = sqlite3DbReallocOrFree(db, pIter->aAlloc, nNew);\r\n        if( !pIter->aAlloc ) return SQLITE_NOMEM;\r\n        pIter->nAlloc = nNew;\r\n      }\r\n  \r\n      nRead2 = iOff + nRec - nRead;\r\n      rc = sqlite3OsRead(\r\n          pIter->pFile, &pIter->aAlloc[nRead], nRead2, pIter->iReadOff+nRead\r\n      );\r\n    }\r\n  }\r\n\r\n  assert( rc!=SQLITE_OK || nRec>0 );\r\n  pIter->iReadOff += iOff+nRec;\r\n  pIter->nKey = nRec;\r\n  pIter->aKey = &pIter->aAlloc[iOff];\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Write a single varint, value iVal, to file-descriptor pFile. Return\r\n** SQLITE_OK if successful, or an SQLite error code if some error occurs.\r\n**\r\n** The value of *piOffset when this function is called is used as the byte\r\n** offset in file pFile to write to. Before returning, *piOffset is \r\n** incremented by the number of bytes written.\r\n*/\r\nstatic int vdbeSorterWriteVarint(\r\n  sqlite3_file *pFile,            /* File to write to */\r\n  i64 iVal,                       /* Value to write as a varint */\r\n  i64 *piOffset                   /* IN/OUT: Write offset in file pFile */\r\n){\r\n  u8 aVarint[9];                  /* Buffer large enough for a varint */\r\n  int nVarint;                    /* Number of used bytes in varint */\r\n  int rc;                         /* Result of write() call */\r\n\r\n  nVarint = sqlite3PutVarint(aVarint, iVal);\r\n  rc = sqlite3OsWrite(pFile, aVarint, nVarint, *piOffset);\r\n  *piOffset += nVarint;\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Read a single varint from file-descriptor pFile. Return SQLITE_OK if\r\n** successful, or an SQLite error code if some error occurs.\r\n**\r\n** The value of *piOffset when this function is called is used as the\r\n** byte offset in file pFile from whence to read the varint. If successful\r\n** (i.e. if no IO error occurs), then *piOffset is set to the offset of\r\n** the first byte past the end of the varint before returning. *piVal is\r\n** set to the integer value read. If an error occurs, the final values of\r\n** both *piOffset and *piVal are undefined.\r\n*/\r\nstatic int vdbeSorterReadVarint(\r\n  sqlite3_file *pFile,            /* File to read from */\r\n  i64 *piOffset,                  /* IN/OUT: Read offset in pFile */\r\n  i64 *piVal                      /* OUT: Value read from file */\r\n){\r\n  u8 aVarint[9];                  /* Buffer large enough for a varint */\r\n  i64 iOff = *piOffset;           /* Offset in file to read from */\r\n  int rc;                         /* Return code */\r\n\r\n  rc = sqlite3OsRead(pFile, aVarint, 9, iOff);\r\n  if( rc==SQLITE_OK ){\r\n    *piOffset += getVarint(aVarint, (u64 *)piVal);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Initialize iterator pIter to scan through the PMA stored in file pFile\r\n** starting at offset iStart and ending at offset iEof-1. This function \r\n** leaves the iterator pointing to the first key in the PMA (or EOF if the \r\n** PMA is empty).\r\n*/\r\nstatic int vdbeSorterIterInit(\r\n  sqlite3 *db,                    /* Database handle */\r\n  VdbeSorter *pSorter,            /* Sorter object */\r\n  i64 iStart,                     /* Start offset in pFile */\r\n  VdbeSorterIter *pIter,          /* Iterator to populate */\r\n  i64 *pnByte                     /* IN/OUT: Increment this value by PMA size */\r\n){\r\n  int rc;\r\n\r\n  assert( pSorter->iWriteOff>iStart );\r\n  assert( pIter->aAlloc==0 );\r\n  pIter->pFile = pSorter->pTemp1;\r\n  pIter->iReadOff = iStart;\r\n  pIter->nAlloc = 128;\r\n  pIter->aAlloc = (u8 *)sqlite3DbMallocRaw(db, pIter->nAlloc);\r\n  if( !pIter->aAlloc ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    i64 nByte;                         /* Total size of PMA in bytes */\r\n    rc = vdbeSorterReadVarint(pSorter->pTemp1, &pIter->iReadOff, &nByte);\r\n    *pnByte += nByte;\r\n    pIter->iEof = pIter->iReadOff + nByte;\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    rc = vdbeSorterIterNext(db, pIter);\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Compare key1 (buffer pKey1, size nKey1 bytes) with key2 (buffer pKey2, \r\n** size nKey2 bytes).  Argument pKeyInfo supplies the collation functions\r\n** used by the comparison. If an error occurs, return an SQLite error code.\r\n** Otherwise, return SQLITE_OK and set *pRes to a negative, zero or positive\r\n** value, depending on whether key1 is smaller, equal to or larger than key2.\r\n**\r\n** If the bOmitRowid argument is non-zero, assume both keys end in a rowid\r\n** field. For the purposes of the comparison, ignore it. Also, if bOmitRowid\r\n** is true and key1 contains even a single NULL value, it is considered to\r\n** be less than key2. Even if key2 also contains NULL values.\r\n**\r\n** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace\r\n** has been allocated and contains an unpacked record that is used as key2.\r\n*/\r\nstatic void vdbeSorterCompare(\r\n  VdbeCursor *pCsr,               /* Cursor object (for pKeyInfo) */\r\n  int bOmitRowid,                 /* Ignore rowid field at end of keys */\r\n  void *pKey1, int nKey1,         /* Left side of comparison */\r\n  void *pKey2, int nKey2,         /* Right side of comparison */\r\n  int *pRes                       /* OUT: Result of comparison */\r\n){\r\n  KeyInfo *pKeyInfo = pCsr->pKeyInfo;\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  UnpackedRecord *r2 = pSorter->pUnpacked;\r\n  int i;\r\n\r\n  if( pKey2 ){\r\n    sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, r2);\r\n  }\r\n\r\n  if( bOmitRowid ){\r\n    r2->nField = pKeyInfo->nField;\r\n    assert( r2->nField>0 );\r\n    for(i=0; i<r2->nField; i++){\r\n      if( r2->aMem[i].flags & MEM_Null ){\r\n        *pRes = -1;\r\n        return;\r\n      }\r\n    }\r\n    r2->flags |= UNPACKED_PREFIX_MATCH;\r\n  }\r\n\r\n  *pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2);\r\n}\r\n\r\n/*\r\n** This function is called to compare two iterator keys when merging \r\n** multiple b-tree segments. Parameter iOut is the index of the aTree[] \r\n** value to recalculate.\r\n*/\r\nstatic int vdbeSorterDoCompare(VdbeCursor *pCsr, int iOut){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  int i1;\r\n  int i2;\r\n  int iRes;\r\n  VdbeSorterIter *p1;\r\n  VdbeSorterIter *p2;\r\n\r\n  assert( iOut<pSorter->nTree && iOut>0 );\r\n\r\n  if( iOut>=(pSorter->nTree/2) ){\r\n    i1 = (iOut - pSorter->nTree/2) * 2;\r\n    i2 = i1 + 1;\r\n  }else{\r\n    i1 = pSorter->aTree[iOut*2];\r\n    i2 = pSorter->aTree[iOut*2+1];\r\n  }\r\n\r\n  p1 = &pSorter->aIter[i1];\r\n  p2 = &pSorter->aIter[i2];\r\n\r\n  if( p1->pFile==0 ){\r\n    iRes = i2;\r\n  }else if( p2->pFile==0 ){\r\n    iRes = i1;\r\n  }else{\r\n    int res;\r\n    assert( pCsr->pSorter->pUnpacked!=0 );  /* allocated in vdbeSorterMerge() */\r\n    vdbeSorterCompare(\r\n        pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res\r\n    );\r\n    if( res<=0 ){\r\n      iRes = i1;\r\n    }else{\r\n      iRes = i2;\r\n    }\r\n  }\r\n\r\n  pSorter->aTree[iOut] = iRes;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Initialize the temporary index cursor just opened as a sorter cursor.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){\r\n  int pgsz;                       /* Page size of main database */\r\n  int mxCache;                    /* Cache size */\r\n  VdbeSorter *pSorter;            /* The new sorter */\r\n  char *d;                        /* Dummy */\r\n\r\n  assert( pCsr->pKeyInfo && pCsr->pBt==0 );\r\n  pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));\r\n  if( pSorter==0 ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  \r\n  pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pCsr->pKeyInfo, 0, 0, &d);\r\n  if( pSorter->pUnpacked==0 ) return SQLITE_NOMEM;\r\n  assert( pSorter->pUnpacked==(UnpackedRecord *)d );\r\n\r\n  if( !sqlite3TempInMemory(db) ){\r\n    pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);\r\n    pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;\r\n    mxCache = db->aDb[0].pSchema->cache_size;\r\n    if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;\r\n    pSorter->mxPmaSize = mxCache * pgsz;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Free the list of sorted records starting at pRecord.\r\n*/\r\nstatic void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){\r\n  SorterRecord *p;\r\n  SorterRecord *pNext;\r\n  for(p=pRecord; p; p=pNext){\r\n    pNext = p->pNext;\r\n    sqlite3DbFree(db, p);\r\n  }\r\n}\r\n\r\n/*\r\n** Free any cursor components allocated by sqlite3VdbeSorterXXX routines.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  if( pSorter ){\r\n    if( pSorter->aIter ){\r\n      int i;\r\n      for(i=0; i<pSorter->nTree; i++){\r\n        vdbeSorterIterZero(db, &pSorter->aIter[i]);\r\n      }\r\n      sqlite3DbFree(db, pSorter->aIter);\r\n    }\r\n    if( pSorter->pTemp1 ){\r\n      sqlite3OsCloseFree(pSorter->pTemp1);\r\n    }\r\n    vdbeSorterRecordFree(db, pSorter->pRecord);\r\n    sqlite3DbFree(db, pSorter->pUnpacked);\r\n    sqlite3DbFree(db, pSorter);\r\n    pCsr->pSorter = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate space for a file-handle and open a temporary file. If successful,\r\n** set *ppFile to point to the malloc'd file-handle and return SQLITE_OK.\r\n** Otherwise, set *ppFile to 0 and return an SQLite error code.\r\n*/\r\nstatic int vdbeSorterOpenTempFile(sqlite3 *db, sqlite3_file **ppFile){\r\n  int dummy;\r\n  return sqlite3OsOpenMalloc(db->pVfs, 0, ppFile,\r\n      SQLITE_OPEN_TEMP_JOURNAL |\r\n      SQLITE_OPEN_READWRITE    | SQLITE_OPEN_CREATE |\r\n      SQLITE_OPEN_EXCLUSIVE    | SQLITE_OPEN_DELETEONCLOSE, &dummy\r\n  );\r\n}\r\n\r\n/*\r\n** Merge the two sorted lists p1 and p2 into a single list.\r\n** Set *ppOut to the head of the new list.\r\n*/\r\nstatic void vdbeSorterMerge(\r\n  VdbeCursor *pCsr,               /* For pKeyInfo */\r\n  SorterRecord *p1,               /* First list to merge */\r\n  SorterRecord *p2,               /* Second list to merge */\r\n  SorterRecord **ppOut            /* OUT: Head of merged list */\r\n){\r\n  SorterRecord *pFinal = 0;\r\n  SorterRecord **pp = &pFinal;\r\n  void *pVal2 = p2 ? p2->pVal : 0;\r\n\r\n  while( p1 && p2 ){\r\n    int res;\r\n    vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res);\r\n    if( res<=0 ){\r\n      *pp = p1;\r\n      pp = &p1->pNext;\r\n      p1 = p1->pNext;\r\n      pVal2 = 0;\r\n    }else{\r\n      *pp = p2;\r\n       pp = &p2->pNext;\r\n      p2 = p2->pNext;\r\n      if( p2==0 ) break;\r\n      pVal2 = p2->pVal;\r\n    }\r\n  }\r\n  *pp = p1 ? p1 : p2;\r\n  *ppOut = pFinal;\r\n}\r\n\r\n/*\r\n** Sort the linked list of records headed at pCsr->pRecord. Return SQLITE_OK\r\n** if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if an error\r\n** occurs.\r\n*/\r\nstatic int vdbeSorterSort(VdbeCursor *pCsr){\r\n  int i;\r\n  SorterRecord **aSlot;\r\n  SorterRecord *p;\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n\r\n  aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *));\r\n  if( !aSlot ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  p = pSorter->pRecord;\r\n  while( p ){\r\n    SorterRecord *pNext = p->pNext;\r\n    p->pNext = 0;\r\n    for(i=0; aSlot[i]; i++){\r\n      vdbeSorterMerge(pCsr, p, aSlot[i], &p);\r\n      aSlot[i] = 0;\r\n    }\r\n    aSlot[i] = p;\r\n    p = pNext;\r\n  }\r\n\r\n  p = 0;\r\n  for(i=0; i<64; i++){\r\n    vdbeSorterMerge(pCsr, p, aSlot[i], &p);\r\n  }\r\n  pSorter->pRecord = p;\r\n\r\n  sqlite3_free(aSlot);\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Write the current contents of the in-memory linked-list to a PMA. Return\r\n** SQLITE_OK if successful, or an SQLite error code otherwise.\r\n**\r\n** The format of a PMA is:\r\n**\r\n**     * A varint. This varint contains the total number of bytes of content\r\n**       in the PMA (not including the varint itself).\r\n**\r\n**     * One or more records packed end-to-end in order of ascending keys. \r\n**       Each record consists of a varint followed by a blob of data (the \r\n**       key). The varint is the number of bytes in the blob of data.\r\n*/\r\nstatic int vdbeSorterListToPMA(sqlite3 *db, VdbeCursor *pCsr){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n\r\n  if( pSorter->nInMemory==0 ){\r\n    assert( pSorter->pRecord==0 );\r\n    return rc;\r\n  }\r\n\r\n  rc = vdbeSorterSort(pCsr);\r\n\r\n  /* If the first temporary PMA file has not been opened, open it now. */\r\n  if( rc==SQLITE_OK && pSorter->pTemp1==0 ){\r\n    rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1);\r\n    assert( rc!=SQLITE_OK || pSorter->pTemp1 );\r\n    assert( pSorter->iWriteOff==0 );\r\n    assert( pSorter->nPMA==0 );\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    i64 iOff = pSorter->iWriteOff;\r\n    SorterRecord *p;\r\n    SorterRecord *pNext = 0;\r\n    static const char eightZeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };\r\n\r\n    pSorter->nPMA++;\r\n    rc = vdbeSorterWriteVarint(pSorter->pTemp1, pSorter->nInMemory, &iOff);\r\n    for(p=pSorter->pRecord; rc==SQLITE_OK && p; p=pNext){\r\n      pNext = p->pNext;\r\n      rc = vdbeSorterWriteVarint(pSorter->pTemp1, p->nVal, &iOff);\r\n\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3OsWrite(pSorter->pTemp1, p->pVal, p->nVal, iOff);\r\n        iOff += p->nVal;\r\n      }\r\n\r\n      sqlite3DbFree(db, p);\r\n    }\r\n\r\n    /* This assert verifies that unless an error has occurred, the size of \r\n    ** the PMA on disk is the same as the expected size stored in\r\n    ** pSorter->nInMemory. */ \r\n    assert( rc!=SQLITE_OK || pSorter->nInMemory==(\r\n          iOff-pSorter->iWriteOff-sqlite3VarintLen(pSorter->nInMemory)\r\n    ));\r\n\r\n    pSorter->iWriteOff = iOff;\r\n    if( rc==SQLITE_OK ){\r\n      /* Terminate each file with 8 extra bytes so that from any offset\r\n      ** in the file we can always read 9 bytes without a SHORT_READ error */\r\n      rc = sqlite3OsWrite(pSorter->pTemp1, eightZeros, 8, iOff);\r\n    }\r\n    pSorter->pRecord = p;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Add a record to the sorter.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSorterWrite(\r\n  sqlite3 *db,                    /* Database handle */\r\n  VdbeCursor *pCsr,               /* Sorter cursor */\r\n  Mem *pVal                       /* Memory cell containing record */\r\n){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n  SorterRecord *pNew;             /* New list element */\r\n\r\n  assert( pSorter );\r\n  pSorter->nInMemory += sqlite3VarintLen(pVal->n) + pVal->n;\r\n\r\n  pNew = (SorterRecord *)sqlite3DbMallocRaw(db, pVal->n + sizeof(SorterRecord));\r\n  if( pNew==0 ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    pNew->pVal = (void *)&pNew[1];\r\n    memcpy(pNew->pVal, pVal->z, pVal->n);\r\n    pNew->nVal = pVal->n;\r\n    pNew->pNext = pSorter->pRecord;\r\n    pSorter->pRecord = pNew;\r\n  }\r\n\r\n  /* See if the contents of the sorter should now be written out. They\r\n  ** are written out when either of the following are true:\r\n  **\r\n  **   * The total memory allocated for the in-memory list is greater \r\n  **     than (page-size * cache-size), or\r\n  **\r\n  **   * The total memory allocated for the in-memory list is greater \r\n  **     than (page-size * 10) and sqlite3HeapNearlyFull() returns true.\r\n  */\r\n  if( rc==SQLITE_OK && pSorter->mxPmaSize>0 && (\r\n        (pSorter->nInMemory>pSorter->mxPmaSize)\r\n     || (pSorter->nInMemory>pSorter->mnPmaSize && sqlite3HeapNearlyFull())\r\n  )){\r\n    rc = vdbeSorterListToPMA(db, pCsr);\r\n    pSorter->nInMemory = 0;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Helper function for sqlite3VdbeSorterRewind(). \r\n*/\r\nstatic int vdbeSorterInitMerge(\r\n  sqlite3 *db,                    /* Database handle */\r\n  VdbeCursor *pCsr,               /* Cursor handle for this sorter */\r\n  i64 *pnByte                     /* Sum of bytes in all opened PMAs */\r\n){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  int i;                          /* Used to iterator through aIter[] */\r\n  i64 nByte = 0;                  /* Total bytes in all opened PMAs */\r\n\r\n  /* Initialize the iterators. */\r\n  for(i=0; i<SORTER_MAX_MERGE_COUNT; i++){\r\n    VdbeSorterIter *pIter = &pSorter->aIter[i];\r\n    rc = vdbeSorterIterInit(db, pSorter, pSorter->iReadOff, pIter, &nByte);\r\n    pSorter->iReadOff = pIter->iEof;\r\n    assert( rc!=SQLITE_OK || pSorter->iReadOff<=pSorter->iWriteOff );\r\n    if( rc!=SQLITE_OK || pSorter->iReadOff>=pSorter->iWriteOff ) break;\r\n  }\r\n\r\n  /* Initialize the aTree[] array. */\r\n  for(i=pSorter->nTree-1; rc==SQLITE_OK && i>0; i--){\r\n    rc = vdbeSorterDoCompare(pCsr, i);\r\n  }\r\n\r\n  *pnByte = nByte;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Once the sorter has been populated, this function is called to prepare\r\n** for iterating through its contents in sorted order.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSorterRewind(sqlite3 *db, VdbeCursor *pCsr, int *pbEof){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  int rc;                         /* Return code */\r\n  sqlite3_file *pTemp2 = 0;       /* Second temp file to use */\r\n  i64 iWrite2 = 0;                /* Write offset for pTemp2 */\r\n  int nIter;                      /* Number of iterators used */\r\n  int nByte;                      /* Bytes of space required for aIter/aTree */\r\n  int N = 2;                      /* Power of 2 >= nIter */\r\n\r\n  assert( pSorter );\r\n\r\n  /* If no data has been written to disk, then do not do so now. Instead,\r\n  ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly\r\n  ** from the in-memory list.  */\r\n  if( pSorter->nPMA==0 ){\r\n    *pbEof = !pSorter->pRecord;\r\n    assert( pSorter->aTree==0 );\r\n    return vdbeSorterSort(pCsr);\r\n  }\r\n\r\n  /* Write the current b-tree to a PMA. Close the b-tree cursor. */\r\n  rc = vdbeSorterListToPMA(db, pCsr);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  /* Allocate space for aIter[] and aTree[]. */\r\n  nIter = pSorter->nPMA;\r\n  if( nIter>SORTER_MAX_MERGE_COUNT ) nIter = SORTER_MAX_MERGE_COUNT;\r\n  assert( nIter>0 );\r\n  while( N<nIter ) N += N;\r\n  nByte = N * (sizeof(int) + sizeof(VdbeSorterIter));\r\n  pSorter->aIter = (VdbeSorterIter *)sqlite3DbMallocZero(db, nByte);\r\n  if( !pSorter->aIter ) return SQLITE_NOMEM;\r\n  pSorter->aTree = (int *)&pSorter->aIter[N];\r\n  pSorter->nTree = N;\r\n\r\n  do {\r\n    int iNew;                     /* Index of new, merged, PMA */\r\n\r\n    for(iNew=0; \r\n        rc==SQLITE_OK && iNew*SORTER_MAX_MERGE_COUNT<pSorter->nPMA; \r\n        iNew++\r\n    ){\r\n      i64 nWrite;                 /* Number of bytes in new PMA */\r\n\r\n      /* If there are SORTER_MAX_MERGE_COUNT or less PMAs in file pTemp1,\r\n      ** initialize an iterator for each of them and break out of the loop.\r\n      ** These iterators will be incrementally merged as the VDBE layer calls\r\n      ** sqlite3VdbeSorterNext().\r\n      **\r\n      ** Otherwise, if pTemp1 contains more than SORTER_MAX_MERGE_COUNT PMAs,\r\n      ** initialize interators for SORTER_MAX_MERGE_COUNT of them. These PMAs\r\n      ** are merged into a single PMA that is written to file pTemp2.\r\n      */\r\n      rc = vdbeSorterInitMerge(db, pCsr, &nWrite);\r\n      assert( rc!=SQLITE_OK || pSorter->aIter[ pSorter->aTree[1] ].pFile );\r\n      if( rc!=SQLITE_OK || pSorter->nPMA<=SORTER_MAX_MERGE_COUNT ){\r\n        break;\r\n      }\r\n\r\n      /* Open the second temp file, if it is not already open. */\r\n      if( pTemp2==0 ){\r\n        assert( iWrite2==0 );\r\n        rc = vdbeSorterOpenTempFile(db, &pTemp2);\r\n      }\r\n\r\n      if( rc==SQLITE_OK ){\r\n        rc = vdbeSorterWriteVarint(pTemp2, nWrite, &iWrite2);\r\n      }\r\n\r\n      if( rc==SQLITE_OK ){\r\n        int bEof = 0;\r\n        while( rc==SQLITE_OK && bEof==0 ){\r\n          int nToWrite;\r\n          VdbeSorterIter *pIter = &pSorter->aIter[ pSorter->aTree[1] ];\r\n          assert( pIter->pFile );\r\n          nToWrite = pIter->nKey + sqlite3VarintLen(pIter->nKey);\r\n          rc = sqlite3OsWrite(pTemp2, pIter->aAlloc, nToWrite, iWrite2);\r\n          iWrite2 += nToWrite;\r\n          if( rc==SQLITE_OK ){\r\n            rc = sqlite3VdbeSorterNext(db, pCsr, &bEof);\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    if( pSorter->nPMA<=SORTER_MAX_MERGE_COUNT ){\r\n      break;\r\n    }else{\r\n      sqlite3_file *pTmp = pSorter->pTemp1;\r\n      pSorter->nPMA = iNew;\r\n      pSorter->pTemp1 = pTemp2;\r\n      pTemp2 = pTmp;\r\n      pSorter->iWriteOff = iWrite2;\r\n      pSorter->iReadOff = 0;\r\n      iWrite2 = 0;\r\n    }\r\n  }while( rc==SQLITE_OK );\r\n\r\n  if( pTemp2 ){\r\n    sqlite3OsCloseFree(pTemp2);\r\n  }\r\n  *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Advance to the next element in the sorter.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, VdbeCursor *pCsr, int *pbEof){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  int rc;                         /* Return code */\r\n\r\n  if( pSorter->aTree ){\r\n    int iPrev = pSorter->aTree[1];/* Index of iterator to advance */\r\n    int i;                        /* Index of aTree[] to recalculate */\r\n\r\n    rc = vdbeSorterIterNext(db, &pSorter->aIter[iPrev]);\r\n    for(i=(pSorter->nTree+iPrev)/2; rc==SQLITE_OK && i>0; i=i/2){\r\n      rc = vdbeSorterDoCompare(pCsr, i);\r\n    }\r\n\r\n    *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0);\r\n  }else{\r\n    SorterRecord *pFree = pSorter->pRecord;\r\n    pSorter->pRecord = pFree->pNext;\r\n    pFree->pNext = 0;\r\n    vdbeSorterRecordFree(db, pFree);\r\n    *pbEof = !pSorter->pRecord;\r\n    rc = SQLITE_OK;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return a pointer to a buffer owned by the sorter that contains the \r\n** current key.\r\n*/\r\nstatic void *vdbeSorterRowkey(\r\n  VdbeSorter *pSorter,            /* Sorter object */\r\n  int *pnKey                      /* OUT: Size of current key in bytes */\r\n){\r\n  void *pKey;\r\n  if( pSorter->aTree ){\r\n    VdbeSorterIter *pIter;\r\n    pIter = &pSorter->aIter[ pSorter->aTree[1] ];\r\n    *pnKey = pIter->nKey;\r\n    pKey = pIter->aKey;\r\n  }else{\r\n    *pnKey = pSorter->pRecord->nVal;\r\n    pKey = pSorter->pRecord->pVal;\r\n  }\r\n  return pKey;\r\n}\r\n\r\n/*\r\n** Copy the current sorter key into the memory cell pOut.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSorterRowkey(VdbeCursor *pCsr, Mem *pOut){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  void *pKey; int nKey;           /* Sorter key to copy into pOut */\r\n\r\n  pKey = vdbeSorterRowkey(pSorter, &nKey);\r\n  if( sqlite3VdbeMemGrow(pOut, nKey, 0) ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  pOut->n = nKey;\r\n  MemSetTypeFlag(pOut, MEM_Blob);\r\n  memcpy(pOut->z, pKey, nKey);\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Compare the key in memory cell pVal with the key that the sorter cursor\r\n** passed as the first argument currently points to. For the purposes of\r\n** the comparison, ignore the rowid field at the end of each record.\r\n**\r\n** If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM).\r\n** Otherwise, set *pRes to a negative, zero or positive value if the\r\n** key in pVal is smaller than, equal to or larger than the current sorter\r\n** key.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VdbeSorterCompare(\r\n  VdbeCursor *pCsr,               /* Sorter cursor */\r\n  Mem *pVal,                      /* Value to compare to current sorter key */\r\n  int *pRes                       /* OUT: Result of comparison */\r\n){\r\n  VdbeSorter *pSorter = pCsr->pSorter;\r\n  void *pKey; int nKey;           /* Sorter key to compare pVal with */\r\n\r\n  pKey = vdbeSorterRowkey(pSorter, &nKey);\r\n  vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#endif /* #ifndef SQLITE_OMIT_MERGE_SORT */\r\n\r\n/************** End of vdbesort.c ********************************************/\r\n/************** Begin file journal.c *****************************************/\r\n/*\r\n** 2007 August 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file implements a special kind of sqlite3_file object used\r\n** by SQLite to create journal files if the atomic-write optimization\r\n** is enabled.\r\n**\r\n** The distinctive characteristic of this sqlite3_file is that the\r\n** actual on disk file is created lazily. When the file is created,\r\n** the caller specifies a buffer size for an in-memory buffer to\r\n** be used to service read() and write() requests. The actual file\r\n** on disk is not created or populated until either:\r\n**\r\n**   1) The in-memory representation grows too large for the allocated \r\n**      buffer, or\r\n**   2) The sqlite3JournalCreate() function is called.\r\n*/\r\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\r\n\r\n\r\n/*\r\n** A JournalFile object is a subclass of sqlite3_file used by\r\n** as an open file handle for journal files.\r\n*/\r\nstruct JournalFile {\r\n  sqlite3_io_methods *pMethod;    /* I/O methods on journal files */\r\n  int nBuf;                       /* Size of zBuf[] in bytes */\r\n  char *zBuf;                     /* Space to buffer journal writes */\r\n  int iSize;                      /* Amount of zBuf[] currently used */\r\n  int flags;                      /* xOpen flags */\r\n  sqlite3_vfs *pVfs;              /* The \"real\" underlying VFS */\r\n  sqlite3_file *pReal;            /* The \"real\" underlying file descriptor */\r\n  const char *zJournal;           /* Name of the journal file */\r\n};\r\ntypedef struct JournalFile JournalFile;\r\n\r\n/*\r\n** If it does not already exists, create and populate the on-disk file \r\n** for JournalFile p.\r\n*/\r\nstatic int createFile(JournalFile *p){\r\n  int rc = SQLITE_OK;\r\n  if( !p->pReal ){\r\n    sqlite3_file *pReal = (sqlite3_file *)&p[1];\r\n    rc = sqlite3OsOpen(p->pVfs, p->zJournal, pReal, p->flags, 0);\r\n    if( rc==SQLITE_OK ){\r\n      p->pReal = pReal;\r\n      if( p->iSize>0 ){\r\n        assert(p->iSize<=p->nBuf);\r\n        rc = sqlite3OsWrite(p->pReal, p->zBuf, p->iSize, 0);\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close the file.\r\n*/\r\nstatic int jrnlClose(sqlite3_file *pJfd){\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  if( p->pReal ){\r\n    sqlite3OsClose(p->pReal);\r\n  }\r\n  sqlite3_free(p->zBuf);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Read data from the file.\r\n*/\r\nstatic int jrnlRead(\r\n  sqlite3_file *pJfd,    /* The journal file from which to read */\r\n  void *zBuf,            /* Put the results here */\r\n  int iAmt,              /* Number of bytes to read */\r\n  sqlite_int64 iOfst     /* Begin reading at this offset */\r\n){\r\n  int rc = SQLITE_OK;\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  if( p->pReal ){\r\n    rc = sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst);\r\n  }else if( (iAmt+iOfst)>p->iSize ){\r\n    rc = SQLITE_IOERR_SHORT_READ;\r\n  }else{\r\n    memcpy(zBuf, &p->zBuf[iOfst], iAmt);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Write data to the file.\r\n*/\r\nstatic int jrnlWrite(\r\n  sqlite3_file *pJfd,    /* The journal file into which to write */\r\n  const void *zBuf,      /* Take data to be written from here */\r\n  int iAmt,              /* Number of bytes to write */\r\n  sqlite_int64 iOfst     /* Begin writing at this offset into the file */\r\n){\r\n  int rc = SQLITE_OK;\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  if( !p->pReal && (iOfst+iAmt)>p->nBuf ){\r\n    rc = createFile(p);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    if( p->pReal ){\r\n      rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);\r\n    }else{\r\n      memcpy(&p->zBuf[iOfst], zBuf, iAmt);\r\n      if( p->iSize<(iOfst+iAmt) ){\r\n        p->iSize = (iOfst+iAmt);\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Truncate the file.\r\n*/\r\nstatic int jrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){\r\n  int rc = SQLITE_OK;\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  if( p->pReal ){\r\n    rc = sqlite3OsTruncate(p->pReal, size);\r\n  }else if( size<p->iSize ){\r\n    p->iSize = size;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Sync the file.\r\n*/\r\nstatic int jrnlSync(sqlite3_file *pJfd, int flags){\r\n  int rc;\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  if( p->pReal ){\r\n    rc = sqlite3OsSync(p->pReal, flags);\r\n  }else{\r\n    rc = SQLITE_OK;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Query the size of the file in bytes.\r\n*/\r\nstatic int jrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){\r\n  int rc = SQLITE_OK;\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  if( p->pReal ){\r\n    rc = sqlite3OsFileSize(p->pReal, pSize);\r\n  }else{\r\n    *pSize = (sqlite_int64) p->iSize;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Table of methods for JournalFile sqlite3_file object.\r\n*/\r\nstatic struct sqlite3_io_methods JournalFileMethods = {\r\n  1,             /* iVersion */\r\n  jrnlClose,     /* xClose */\r\n  jrnlRead,      /* xRead */\r\n  jrnlWrite,     /* xWrite */\r\n  jrnlTruncate,  /* xTruncate */\r\n  jrnlSync,      /* xSync */\r\n  jrnlFileSize,  /* xFileSize */\r\n  0,             /* xLock */\r\n  0,             /* xUnlock */\r\n  0,             /* xCheckReservedLock */\r\n  0,             /* xFileControl */\r\n  0,             /* xSectorSize */\r\n  0,             /* xDeviceCharacteristics */\r\n  0,             /* xShmMap */\r\n  0,             /* xShmLock */\r\n  0,             /* xShmBarrier */\r\n  0              /* xShmUnmap */\r\n};\r\n\r\n/* \r\n** Open a journal file.\r\n*/\r\nSQLITE_PRIVATE int sqlite3JournalOpen(\r\n  sqlite3_vfs *pVfs,         /* The VFS to use for actual file I/O */\r\n  const char *zName,         /* Name of the journal file */\r\n  sqlite3_file *pJfd,        /* Preallocated, blank file handle */\r\n  int flags,                 /* Opening flags */\r\n  int nBuf                   /* Bytes buffered before opening the file */\r\n){\r\n  JournalFile *p = (JournalFile *)pJfd;\r\n  memset(p, 0, sqlite3JournalSize(pVfs));\r\n  if( nBuf>0 ){\r\n    p->zBuf = sqlite3MallocZero(nBuf);\r\n    if( !p->zBuf ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n  }else{\r\n    return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0);\r\n  }\r\n  p->pMethod = &JournalFileMethods;\r\n  p->nBuf = nBuf;\r\n  p->flags = flags;\r\n  p->zJournal = zName;\r\n  p->pVfs = pVfs;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** If the argument p points to a JournalFile structure, and the underlying\r\n** file has not yet been created, create it now.\r\n*/\r\nSQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *p){\r\n  if( p->pMethods!=&JournalFileMethods ){\r\n    return SQLITE_OK;\r\n  }\r\n  return createFile((JournalFile *)p);\r\n}\r\n\r\n/* \r\n** Return the number of bytes required to store a JournalFile that uses vfs\r\n** pVfs to create the underlying on-disk files.\r\n*/\r\nSQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *pVfs){\r\n  return (pVfs->szOsFile+sizeof(JournalFile));\r\n}\r\n#endif\r\n\r\n/************** End of journal.c *********************************************/\r\n/************** Begin file memjournal.c **************************************/\r\n/*\r\n** 2008 October 7\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains code use to implement an in-memory rollback journal.\r\n** The in-memory rollback journal is used to journal transactions for\r\n** \":memory:\" databases and when the journal_mode=MEMORY pragma is used.\r\n*/\r\n\r\n/* Forward references to internal structures */\r\ntypedef struct MemJournal MemJournal;\r\ntypedef struct FilePoint FilePoint;\r\ntypedef struct FileChunk FileChunk;\r\n\r\n/* Space to hold the rollback journal is allocated in increments of\r\n** this many bytes.\r\n**\r\n** The size chosen is a little less than a power of two.  That way,\r\n** the FileChunk object will have a size that almost exactly fills\r\n** a power-of-two allocation.  This mimimizes wasted space in power-of-two\r\n** memory allocators.\r\n*/\r\n#define JOURNAL_CHUNKSIZE ((int)(1024-sizeof(FileChunk*)))\r\n\r\n/* Macro to find the minimum of two numeric values.\r\n*/\r\n#ifndef MIN\r\n# define MIN(x,y) ((x)<(y)?(x):(y))\r\n#endif\r\n\r\n/*\r\n** The rollback journal is composed of a linked list of these structures.\r\n*/\r\nstruct FileChunk {\r\n  FileChunk *pNext;               /* Next chunk in the journal */\r\n  u8 zChunk[JOURNAL_CHUNKSIZE];   /* Content of this chunk */\r\n};\r\n\r\n/*\r\n** An instance of this object serves as a cursor into the rollback journal.\r\n** The cursor can be either for reading or writing.\r\n*/\r\nstruct FilePoint {\r\n  sqlite3_int64 iOffset;          /* Offset from the beginning of the file */\r\n  FileChunk *pChunk;              /* Specific chunk into which cursor points */\r\n};\r\n\r\n/*\r\n** This subclass is a subclass of sqlite3_file.  Each open memory-journal\r\n** is an instance of this class.\r\n*/\r\nstruct MemJournal {\r\n  sqlite3_io_methods *pMethod;    /* Parent class. MUST BE FIRST */\r\n  FileChunk *pFirst;              /* Head of in-memory chunk-list */\r\n  FilePoint endpoint;             /* Pointer to the end of the file */\r\n  FilePoint readpoint;            /* Pointer to the end of the last xRead() */\r\n};\r\n\r\n/*\r\n** Read data from the in-memory journal file.  This is the implementation\r\n** of the sqlite3_vfs.xRead method.\r\n*/\r\nstatic int memjrnlRead(\r\n  sqlite3_file *pJfd,    /* The journal file from which to read */\r\n  void *zBuf,            /* Put the results here */\r\n  int iAmt,              /* Number of bytes to read */\r\n  sqlite_int64 iOfst     /* Begin reading at this offset */\r\n){\r\n  MemJournal *p = (MemJournal *)pJfd;\r\n  u8 *zOut = zBuf;\r\n  int nRead = iAmt;\r\n  int iChunkOffset;\r\n  FileChunk *pChunk;\r\n\r\n  /* SQLite never tries to read past the end of a rollback journal file */\r\n  assert( iOfst+iAmt<=p->endpoint.iOffset );\r\n\r\n  if( p->readpoint.iOffset!=iOfst || iOfst==0 ){\r\n    sqlite3_int64 iOff = 0;\r\n    for(pChunk=p->pFirst; \r\n        ALWAYS(pChunk) && (iOff+JOURNAL_CHUNKSIZE)<=iOfst;\r\n        pChunk=pChunk->pNext\r\n    ){\r\n      iOff += JOURNAL_CHUNKSIZE;\r\n    }\r\n  }else{\r\n    pChunk = p->readpoint.pChunk;\r\n  }\r\n\r\n  iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE);\r\n  do {\r\n    int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset;\r\n    int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset));\r\n    memcpy(zOut, &pChunk->zChunk[iChunkOffset], nCopy);\r\n    zOut += nCopy;\r\n    nRead -= iSpace;\r\n    iChunkOffset = 0;\r\n  } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );\r\n  p->readpoint.iOffset = iOfst+iAmt;\r\n  p->readpoint.pChunk = pChunk;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Write data to the file.\r\n*/\r\nstatic int memjrnlWrite(\r\n  sqlite3_file *pJfd,    /* The journal file into which to write */\r\n  const void *zBuf,      /* Take data to be written from here */\r\n  int iAmt,              /* Number of bytes to write */\r\n  sqlite_int64 iOfst     /* Begin writing at this offset into the file */\r\n){\r\n  MemJournal *p = (MemJournal *)pJfd;\r\n  int nWrite = iAmt;\r\n  u8 *zWrite = (u8 *)zBuf;\r\n\r\n  /* An in-memory journal file should only ever be appended to. Random\r\n  ** access writes are not required by sqlite.\r\n  */\r\n  assert( iOfst==p->endpoint.iOffset );\r\n  UNUSED_PARAMETER(iOfst);\r\n\r\n  while( nWrite>0 ){\r\n    FileChunk *pChunk = p->endpoint.pChunk;\r\n    int iChunkOffset = (int)(p->endpoint.iOffset%JOURNAL_CHUNKSIZE);\r\n    int iSpace = MIN(nWrite, JOURNAL_CHUNKSIZE - iChunkOffset);\r\n\r\n    if( iChunkOffset==0 ){\r\n      /* New chunk is required to extend the file. */\r\n      FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk));\r\n      if( !pNew ){\r\n        return SQLITE_IOERR_NOMEM;\r\n      }\r\n      pNew->pNext = 0;\r\n      if( pChunk ){\r\n        assert( p->pFirst );\r\n        pChunk->pNext = pNew;\r\n      }else{\r\n        assert( !p->pFirst );\r\n        p->pFirst = pNew;\r\n      }\r\n      p->endpoint.pChunk = pNew;\r\n    }\r\n\r\n    memcpy(&p->endpoint.pChunk->zChunk[iChunkOffset], zWrite, iSpace);\r\n    zWrite += iSpace;\r\n    nWrite -= iSpace;\r\n    p->endpoint.iOffset += iSpace;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Truncate the file.\r\n*/\r\nstatic int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){\r\n  MemJournal *p = (MemJournal *)pJfd;\r\n  FileChunk *pChunk;\r\n  assert(size==0);\r\n  UNUSED_PARAMETER(size);\r\n  pChunk = p->pFirst;\r\n  while( pChunk ){\r\n    FileChunk *pTmp = pChunk;\r\n    pChunk = pChunk->pNext;\r\n    sqlite3_free(pTmp);\r\n  }\r\n  sqlite3MemJournalOpen(pJfd);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close the file.\r\n*/\r\nstatic int memjrnlClose(sqlite3_file *pJfd){\r\n  memjrnlTruncate(pJfd, 0);\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Sync the file.\r\n**\r\n** Syncing an in-memory journal is a no-op.  And, in fact, this routine\r\n** is never called in a working implementation.  This implementation\r\n** exists purely as a contingency, in case some malfunction in some other\r\n** part of SQLite causes Sync to be called by mistake.\r\n*/\r\nstatic int memjrnlSync(sqlite3_file *NotUsed, int NotUsed2){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Query the size of the file in bytes.\r\n*/\r\nstatic int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){\r\n  MemJournal *p = (MemJournal *)pJfd;\r\n  *pSize = (sqlite_int64) p->endpoint.iOffset;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Table of methods for MemJournal sqlite3_file object.\r\n*/\r\nstatic const struct sqlite3_io_methods MemJournalMethods = {\r\n  1,                /* iVersion */\r\n  memjrnlClose,     /* xClose */\r\n  memjrnlRead,      /* xRead */\r\n  memjrnlWrite,     /* xWrite */\r\n  memjrnlTruncate,  /* xTruncate */\r\n  memjrnlSync,      /* xSync */\r\n  memjrnlFileSize,  /* xFileSize */\r\n  0,                /* xLock */\r\n  0,                /* xUnlock */\r\n  0,                /* xCheckReservedLock */\r\n  0,                /* xFileControl */\r\n  0,                /* xSectorSize */\r\n  0,                /* xDeviceCharacteristics */\r\n  0,                /* xShmMap */\r\n  0,                /* xShmLock */\r\n  0,                /* xShmBarrier */\r\n  0                 /* xShmUnlock */\r\n};\r\n\r\n/* \r\n** Open a journal file.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *pJfd){\r\n  MemJournal *p = (MemJournal *)pJfd;\r\n  assert( EIGHT_BYTE_ALIGNMENT(p) );\r\n  memset(p, 0, sqlite3MemJournalSize());\r\n  p->pMethod = (sqlite3_io_methods*)&MemJournalMethods;\r\n}\r\n\r\n/*\r\n** Return true if the file-handle passed as an argument is \r\n** an in-memory journal \r\n*/\r\nSQLITE_PRIVATE int sqlite3IsMemJournal(sqlite3_file *pJfd){\r\n  return pJfd->pMethods==&MemJournalMethods;\r\n}\r\n\r\n/* \r\n** Return the number of bytes required to store a MemJournal file descriptor.\r\n*/\r\nSQLITE_PRIVATE int sqlite3MemJournalSize(void){\r\n  return sizeof(MemJournal);\r\n}\r\n\r\n/************** End of memjournal.c ******************************************/\r\n/************** Begin file walker.c ******************************************/\r\n/*\r\n** 2008 August 16\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains routines used for walking the parser tree for\r\n** an SQL statement.\r\n*/\r\n/* #include <stdlib.h> */\r\n/* #include <string.h> */\r\n\r\n\r\n/*\r\n** Walk an expression tree.  Invoke the callback once for each node\r\n** of the expression, while decending.  (In other words, the callback\r\n** is invoked before visiting children.)\r\n**\r\n** The return value from the callback should be one of the WRC_*\r\n** constants to specify how to proceed with the walk.\r\n**\r\n**    WRC_Continue      Continue descending down the tree.\r\n**\r\n**    WRC_Prune         Do not descend into child nodes.  But allow\r\n**                      the walk to continue with sibling nodes.\r\n**\r\n**    WRC_Abort         Do no more callbacks.  Unwind the stack and\r\n**                      return the top-level walk call.\r\n**\r\n** The return value from this routine is WRC_Abort to abandon the tree walk\r\n** and WRC_Continue to continue.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){\r\n  int rc;\r\n  if( pExpr==0 ) return WRC_Continue;\r\n  testcase( ExprHasProperty(pExpr, EP_TokenOnly) );\r\n  testcase( ExprHasProperty(pExpr, EP_Reduced) );\r\n  rc = pWalker->xExprCallback(pWalker, pExpr);\r\n  if( rc==WRC_Continue\r\n              && !ExprHasAnyProperty(pExpr,EP_TokenOnly) ){\r\n    if( sqlite3WalkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;\r\n    if( sqlite3WalkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;\r\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n      if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;\r\n    }else{\r\n      if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;\r\n    }\r\n  }\r\n  return rc & WRC_Abort;\r\n}\r\n\r\n/*\r\n** Call sqlite3WalkExpr() for every expression in list p or until\r\n** an abort request is seen.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalkExprList(Walker *pWalker, ExprList *p){\r\n  int i;\r\n  struct ExprList_item *pItem;\r\n  if( p ){\r\n    for(i=p->nExpr, pItem=p->a; i>0; i--, pItem++){\r\n      if( sqlite3WalkExpr(pWalker, pItem->pExpr) ) return WRC_Abort;\r\n    }\r\n  }\r\n  return WRC_Continue;\r\n}\r\n\r\n/*\r\n** Walk all expressions associated with SELECT statement p.  Do\r\n** not invoke the SELECT callback on p, but do (of course) invoke\r\n** any expr callbacks and SELECT callbacks that come from subqueries.\r\n** Return WRC_Abort or WRC_Continue.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker *pWalker, Select *p){\r\n  if( sqlite3WalkExprList(pWalker, p->pEList) ) return WRC_Abort;\r\n  if( sqlite3WalkExpr(pWalker, p->pWhere) ) return WRC_Abort;\r\n  if( sqlite3WalkExprList(pWalker, p->pGroupBy) ) return WRC_Abort;\r\n  if( sqlite3WalkExpr(pWalker, p->pHaving) ) return WRC_Abort;\r\n  if( sqlite3WalkExprList(pWalker, p->pOrderBy) ) return WRC_Abort;\r\n  if( sqlite3WalkExpr(pWalker, p->pLimit) ) return WRC_Abort;\r\n  if( sqlite3WalkExpr(pWalker, p->pOffset) ) return WRC_Abort;\r\n  return WRC_Continue;\r\n}\r\n\r\n/*\r\n** Walk the parse trees associated with all subqueries in the\r\n** FROM clause of SELECT statement p.  Do not invoke the select\r\n** callback on p, but do invoke it on each FROM clause subquery\r\n** and on any subqueries further down in the tree.  Return \r\n** WRC_Abort or WRC_Continue;\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){\r\n  SrcList *pSrc;\r\n  int i;\r\n  struct SrcList_item *pItem;\r\n\r\n  pSrc = p->pSrc;\r\n  if( ALWAYS(pSrc) ){\r\n    for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){\r\n      if( sqlite3WalkSelect(pWalker, pItem->pSelect) ){\r\n        return WRC_Abort;\r\n      }\r\n    }\r\n  }\r\n  return WRC_Continue;\r\n} \r\n\r\n/*\r\n** Call sqlite3WalkExpr() for every expression in Select statement p.\r\n** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and\r\n** on the compound select chain, p->pPrior.\r\n**\r\n** Return WRC_Continue under normal conditions.  Return WRC_Abort if\r\n** there is an abort request.\r\n**\r\n** If the Walker does not have an xSelectCallback() then this routine\r\n** is a no-op returning WRC_Continue.\r\n*/\r\nSQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){\r\n  int rc;\r\n  if( p==0 || pWalker->xSelectCallback==0 ) return WRC_Continue;\r\n  rc = WRC_Continue;\r\n  while( p  ){\r\n    rc = pWalker->xSelectCallback(pWalker, p);\r\n    if( rc ) break;\r\n    if( sqlite3WalkSelectExpr(pWalker, p) ) return WRC_Abort;\r\n    if( sqlite3WalkSelectFrom(pWalker, p) ) return WRC_Abort;\r\n    p = p->pPrior;\r\n  }\r\n  return rc & WRC_Abort;\r\n}\r\n\r\n/************** End of walker.c **********************************************/\r\n/************** Begin file resolve.c *****************************************/\r\n/*\r\n** 2008 August 18\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains routines used for walking the parser tree and\r\n** resolve all identifiers by associating them with a particular\r\n** table and column.\r\n*/\r\n/* #include <stdlib.h> */\r\n/* #include <string.h> */\r\n\r\n/*\r\n** Turn the pExpr expression into an alias for the iCol-th column of the\r\n** result set in pEList.\r\n**\r\n** If the result set column is a simple column reference, then this routine\r\n** makes an exact copy.  But for any other kind of expression, this\r\n** routine make a copy of the result set column as the argument to the\r\n** TK_AS operator.  The TK_AS operator causes the expression to be\r\n** evaluated just once and then reused for each alias.\r\n**\r\n** The reason for suppressing the TK_AS term when the expression is a simple\r\n** column reference is so that the column reference will be recognized as\r\n** usable by indices within the WHERE clause processing logic. \r\n**\r\n** Hack:  The TK_AS operator is inhibited if zType[0]=='G'.  This means\r\n** that in a GROUP BY clause, the expression is evaluated twice.  Hence:\r\n**\r\n**     SELECT random()%5 AS x, count(*) FROM tab GROUP BY x\r\n**\r\n** Is equivalent to:\r\n**\r\n**     SELECT random()%5 AS x, count(*) FROM tab GROUP BY random()%5\r\n**\r\n** The result of random()%5 in the GROUP BY clause is probably different\r\n** from the result in the result-set.  We might fix this someday.  Or\r\n** then again, we might not...\r\n*/\r\nstatic void resolveAlias(\r\n  Parse *pParse,         /* Parsing context */\r\n  ExprList *pEList,      /* A result set */\r\n  int iCol,              /* A column in the result set.  0..pEList->nExpr-1 */\r\n  Expr *pExpr,           /* Transform this into an alias to the result set */\r\n  const char *zType      /* \"GROUP\" or \"ORDER\" or \"\" */\r\n){\r\n  Expr *pOrig;           /* The iCol-th column of the result set */\r\n  Expr *pDup;            /* Copy of pOrig */\r\n  sqlite3 *db;           /* The database connection */\r\n\r\n  assert( iCol>=0 && iCol<pEList->nExpr );\r\n  pOrig = pEList->a[iCol].pExpr;\r\n  assert( pOrig!=0 );\r\n  assert( pOrig->flags & EP_Resolved );\r\n  db = pParse->db;\r\n  if( pOrig->op!=TK_COLUMN && zType[0]!='G' ){\r\n    pDup = sqlite3ExprDup(db, pOrig, 0);\r\n    pDup = sqlite3PExpr(pParse, TK_AS, pDup, 0, 0);\r\n    if( pDup==0 ) return;\r\n    if( pEList->a[iCol].iAlias==0 ){\r\n      pEList->a[iCol].iAlias = (u16)(++pParse->nAlias);\r\n    }\r\n    pDup->iTable = pEList->a[iCol].iAlias;\r\n  }else if( ExprHasProperty(pOrig, EP_IntValue) || pOrig->u.zToken==0 ){\r\n    pDup = sqlite3ExprDup(db, pOrig, 0);\r\n    if( pDup==0 ) return;\r\n  }else{\r\n    char *zToken = pOrig->u.zToken;\r\n    assert( zToken!=0 );\r\n    pOrig->u.zToken = 0;\r\n    pDup = sqlite3ExprDup(db, pOrig, 0);\r\n    pOrig->u.zToken = zToken;\r\n    if( pDup==0 ) return;\r\n    assert( (pDup->flags & (EP_Reduced|EP_TokenOnly))==0 );\r\n    pDup->flags2 |= EP2_MallocedToken;\r\n    pDup->u.zToken = sqlite3DbStrDup(db, zToken);\r\n  }\r\n  if( pExpr->flags & EP_ExpCollate ){\r\n    pDup->pColl = pExpr->pColl;\r\n    pDup->flags |= EP_ExpCollate;\r\n  }\r\n\r\n  /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This \r\n  ** prevents ExprDelete() from deleting the Expr structure itself,\r\n  ** allowing it to be repopulated by the memcpy() on the following line.\r\n  */\r\n  ExprSetProperty(pExpr, EP_Static);\r\n  sqlite3ExprDelete(db, pExpr);\r\n  memcpy(pExpr, pDup, sizeof(*pExpr));\r\n  sqlite3DbFree(db, pDup);\r\n}\r\n\r\n\r\n/*\r\n** Return TRUE if the name zCol occurs anywhere in the USING clause.\r\n**\r\n** Return FALSE if the USING clause is NULL or if it does not contain\r\n** zCol.\r\n*/\r\nstatic int nameInUsingClause(IdList *pUsing, const char *zCol){\r\n  if( pUsing ){\r\n    int k;\r\n    for(k=0; k<pUsing->nId; k++){\r\n      if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n\r\n/*\r\n** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up\r\n** that name in the set of source tables in pSrcList and make the pExpr \r\n** expression node refer back to that source column.  The following changes\r\n** are made to pExpr:\r\n**\r\n**    pExpr->iDb           Set the index in db->aDb[] of the database X\r\n**                         (even if X is implied).\r\n**    pExpr->iTable        Set to the cursor number for the table obtained\r\n**                         from pSrcList.\r\n**    pExpr->pTab          Points to the Table structure of X.Y (even if\r\n**                         X and/or Y are implied.)\r\n**    pExpr->iColumn       Set to the column number within the table.\r\n**    pExpr->op            Set to TK_COLUMN.\r\n**    pExpr->pLeft         Any expression this points to is deleted\r\n**    pExpr->pRight        Any expression this points to is deleted.\r\n**\r\n** The zDb variable is the name of the database (the \"X\").  This value may be\r\n** NULL meaning that name is of the form Y.Z or Z.  Any available database\r\n** can be used.  The zTable variable is the name of the table (the \"Y\").  This\r\n** value can be NULL if zDb is also NULL.  If zTable is NULL it\r\n** means that the form of the name is Z and that columns from any table\r\n** can be used.\r\n**\r\n** If the name cannot be resolved unambiguously, leave an error message\r\n** in pParse and return WRC_Abort.  Return WRC_Prune on success.\r\n*/\r\nstatic int lookupName(\r\n  Parse *pParse,       /* The parsing context */\r\n  const char *zDb,     /* Name of the database containing table, or NULL */\r\n  const char *zTab,    /* Name of table containing column, or NULL */\r\n  const char *zCol,    /* Name of the column. */\r\n  NameContext *pNC,    /* The name context used to resolve the name */\r\n  Expr *pExpr          /* Make this EXPR node point to the selected column */\r\n){\r\n  int i, j;            /* Loop counters */\r\n  int cnt = 0;                      /* Number of matching column names */\r\n  int cntTab = 0;                   /* Number of matching table names */\r\n  sqlite3 *db = pParse->db;         /* The database connection */\r\n  struct SrcList_item *pItem;       /* Use for looping over pSrcList items */\r\n  struct SrcList_item *pMatch = 0;  /* The matching pSrcList item */\r\n  NameContext *pTopNC = pNC;        /* First namecontext in the list */\r\n  Schema *pSchema = 0;              /* Schema of the expression */\r\n  int isTrigger = 0;\r\n\r\n  assert( pNC );     /* the name context cannot be NULL. */\r\n  assert( zCol );    /* The Z in X.Y.Z cannot be NULL */\r\n  assert( ~ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );\r\n\r\n  /* Initialize the node to no-match */\r\n  pExpr->iTable = -1;\r\n  pExpr->pTab = 0;\r\n  ExprSetIrreducible(pExpr);\r\n\r\n  /* Start at the inner-most context and move outward until a match is found */\r\n  while( pNC && cnt==0 ){\r\n    ExprList *pEList;\r\n    SrcList *pSrcList = pNC->pSrcList;\r\n\r\n    if( pSrcList ){\r\n      for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){\r\n        Table *pTab;\r\n        int iDb;\r\n        Column *pCol;\r\n  \r\n        pTab = pItem->pTab;\r\n        assert( pTab!=0 && pTab->zName!=0 );\r\n        iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n        assert( pTab->nCol>0 );\r\n        if( zTab ){\r\n          if( pItem->zAlias ){\r\n            char *zTabName = pItem->zAlias;\r\n            if( sqlite3StrICmp(zTabName, zTab)!=0 ) continue;\r\n          }else{\r\n            char *zTabName = pTab->zName;\r\n            if( NEVER(zTabName==0) || sqlite3StrICmp(zTabName, zTab)!=0 ){\r\n              continue;\r\n            }\r\n            if( zDb!=0 && sqlite3StrICmp(db->aDb[iDb].zName, zDb)!=0 ){\r\n              continue;\r\n            }\r\n          }\r\n        }\r\n        if( 0==(cntTab++) ){\r\n          pExpr->iTable = pItem->iCursor;\r\n          pExpr->pTab = pTab;\r\n          pSchema = pTab->pSchema;\r\n          pMatch = pItem;\r\n        }\r\n        for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){\r\n          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){\r\n            /* If there has been exactly one prior match and this match\r\n            ** is for the right-hand table of a NATURAL JOIN or is in a \r\n            ** USING clause, then skip this match.\r\n            */\r\n            if( cnt==1 ){\r\n              if( pItem->jointype & JT_NATURAL ) continue;\r\n              if( nameInUsingClause(pItem->pUsing, zCol) ) continue;\r\n            }\r\n            cnt++;\r\n            pExpr->iTable = pItem->iCursor;\r\n            pExpr->pTab = pTab;\r\n            pMatch = pItem;\r\n            pSchema = pTab->pSchema;\r\n            /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */\r\n            pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;\r\n            break;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n    /* If we have not already resolved the name, then maybe \r\n    ** it is a new.* or old.* trigger argument reference\r\n    */\r\n    if( zDb==0 && zTab!=0 && cnt==0 && pParse->pTriggerTab!=0 ){\r\n      int op = pParse->eTriggerOp;\r\n      Table *pTab = 0;\r\n      assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );\r\n      if( op!=TK_DELETE && sqlite3StrICmp(\"new\",zTab) == 0 ){\r\n        pExpr->iTable = 1;\r\n        pTab = pParse->pTriggerTab;\r\n      }else if( op!=TK_INSERT && sqlite3StrICmp(\"old\",zTab)==0 ){\r\n        pExpr->iTable = 0;\r\n        pTab = pParse->pTriggerTab;\r\n      }\r\n\r\n      if( pTab ){ \r\n        int iCol;\r\n        pSchema = pTab->pSchema;\r\n        cntTab++;\r\n        for(iCol=0; iCol<pTab->nCol; iCol++){\r\n          Column *pCol = &pTab->aCol[iCol];\r\n          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){\r\n            if( iCol==pTab->iPKey ){\r\n              iCol = -1;\r\n            }\r\n            break;\r\n          }\r\n        }\r\n        if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) ){\r\n          iCol = -1;        /* IMP: R-44911-55124 */\r\n        }\r\n        if( iCol<pTab->nCol ){\r\n          cnt++;\r\n          if( iCol<0 ){\r\n            pExpr->affinity = SQLITE_AFF_INTEGER;\r\n          }else if( pExpr->iTable==0 ){\r\n            testcase( iCol==31 );\r\n            testcase( iCol==32 );\r\n            pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));\r\n          }else{\r\n            testcase( iCol==31 );\r\n            testcase( iCol==32 );\r\n            pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));\r\n          }\r\n          pExpr->iColumn = (i16)iCol;\r\n          pExpr->pTab = pTab;\r\n          isTrigger = 1;\r\n        }\r\n      }\r\n    }\r\n#endif /* !defined(SQLITE_OMIT_TRIGGER) */\r\n\r\n    /*\r\n    ** Perhaps the name is a reference to the ROWID\r\n    */\r\n    if( cnt==0 && cntTab==1 && sqlite3IsRowid(zCol) ){\r\n      cnt = 1;\r\n      pExpr->iColumn = -1;     /* IMP: R-44911-55124 */\r\n      pExpr->affinity = SQLITE_AFF_INTEGER;\r\n    }\r\n\r\n    /*\r\n    ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z\r\n    ** might refer to an result-set alias.  This happens, for example, when\r\n    ** we are resolving names in the WHERE clause of the following command:\r\n    **\r\n    **     SELECT a+b AS x FROM table WHERE x<10;\r\n    **\r\n    ** In cases like this, replace pExpr with a copy of the expression that\r\n    ** forms the result set entry (\"a+b\" in the example) and return immediately.\r\n    ** Note that the expression in the result set should have already been\r\n    ** resolved by the time the WHERE clause is resolved.\r\n    */\r\n    if( cnt==0 && (pEList = pNC->pEList)!=0 && zTab==0 ){\r\n      for(j=0; j<pEList->nExpr; j++){\r\n        char *zAs = pEList->a[j].zName;\r\n        if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){\r\n          Expr *pOrig;\r\n          assert( pExpr->pLeft==0 && pExpr->pRight==0 );\r\n          assert( pExpr->x.pList==0 );\r\n          assert( pExpr->x.pSelect==0 );\r\n          pOrig = pEList->a[j].pExpr;\r\n          if( !pNC->allowAgg && ExprHasProperty(pOrig, EP_Agg) ){\r\n            sqlite3ErrorMsg(pParse, \"misuse of aliased aggregate %s\", zAs);\r\n            return WRC_Abort;\r\n          }\r\n          resolveAlias(pParse, pEList, j, pExpr, \"\");\r\n          cnt = 1;\r\n          pMatch = 0;\r\n          assert( zTab==0 && zDb==0 );\r\n          goto lookupname_end;\r\n        }\r\n      } \r\n    }\r\n\r\n    /* Advance to the next name context.  The loop will exit when either\r\n    ** we have a match (cnt>0) or when we run out of name contexts.\r\n    */\r\n    if( cnt==0 ){\r\n      pNC = pNC->pNext;\r\n    }\r\n  }\r\n\r\n  /*\r\n  ** If X and Y are NULL (in other words if only the column name Z is\r\n  ** supplied) and the value of Z is enclosed in double-quotes, then\r\n  ** Z is a string literal if it doesn't match any column names.  In that\r\n  ** case, we need to return right away and not make any changes to\r\n  ** pExpr.\r\n  **\r\n  ** Because no reference was made to outer contexts, the pNC->nRef\r\n  ** fields are not changed in any context.\r\n  */\r\n  if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){\r\n    pExpr->op = TK_STRING;\r\n    pExpr->pTab = 0;\r\n    return WRC_Prune;\r\n  }\r\n\r\n  /*\r\n  ** cnt==0 means there was not match.  cnt>1 means there were two or\r\n  ** more matches.  Either way, we have an error.\r\n  */\r\n  if( cnt!=1 ){\r\n    const char *zErr;\r\n    zErr = cnt==0 ? \"no such column\" : \"ambiguous column name\";\r\n    if( zDb ){\r\n      sqlite3ErrorMsg(pParse, \"%s: %s.%s.%s\", zErr, zDb, zTab, zCol);\r\n    }else if( zTab ){\r\n      sqlite3ErrorMsg(pParse, \"%s: %s.%s\", zErr, zTab, zCol);\r\n    }else{\r\n      sqlite3ErrorMsg(pParse, \"%s: %s\", zErr, zCol);\r\n    }\r\n    pParse->checkSchema = 1;\r\n    pTopNC->nErr++;\r\n  }\r\n\r\n  /* If a column from a table in pSrcList is referenced, then record\r\n  ** this fact in the pSrcList.a[].colUsed bitmask.  Column 0 causes\r\n  ** bit 0 to be set.  Column 1 sets bit 1.  And so forth.  If the\r\n  ** column number is greater than the number of bits in the bitmask\r\n  ** then set the high-order bit of the bitmask.\r\n  */\r\n  if( pExpr->iColumn>=0 && pMatch!=0 ){\r\n    int n = pExpr->iColumn;\r\n    testcase( n==BMS-1 );\r\n    if( n>=BMS ){\r\n      n = BMS-1;\r\n    }\r\n    assert( pMatch->iCursor==pExpr->iTable );\r\n    pMatch->colUsed |= ((Bitmask)1)<<n;\r\n  }\r\n\r\n  /* Clean up and return\r\n  */\r\n  sqlite3ExprDelete(db, pExpr->pLeft);\r\n  pExpr->pLeft = 0;\r\n  sqlite3ExprDelete(db, pExpr->pRight);\r\n  pExpr->pRight = 0;\r\n  pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);\r\nlookupname_end:\r\n  if( cnt==1 ){\r\n    assert( pNC!=0 );\r\n    sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);\r\n    /* Increment the nRef value on all name contexts from TopNC up to\r\n    ** the point where the name matched. */\r\n    for(;;){\r\n      assert( pTopNC!=0 );\r\n      pTopNC->nRef++;\r\n      if( pTopNC==pNC ) break;\r\n      pTopNC = pTopNC->pNext;\r\n    }\r\n    return WRC_Prune;\r\n  } else {\r\n    return WRC_Abort;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate and return a pointer to an expression to load the column iCol\r\n** from datasource iSrc in SrcList pSrc.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){\r\n  Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);\r\n  if( p ){\r\n    struct SrcList_item *pItem = &pSrc->a[iSrc];\r\n    p->pTab = pItem->pTab;\r\n    p->iTable = pItem->iCursor;\r\n    if( p->pTab->iPKey==iCol ){\r\n      p->iColumn = -1;\r\n    }else{\r\n      p->iColumn = (ynVar)iCol;\r\n      testcase( iCol==BMS );\r\n      testcase( iCol==BMS-1 );\r\n      pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);\r\n    }\r\n    ExprSetProperty(p, EP_Resolved);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** This routine is callback for sqlite3WalkExpr().\r\n**\r\n** Resolve symbolic names into TK_COLUMN operators for the current\r\n** node in the expression tree.  Return 0 to continue the search down\r\n** the tree or 2 to abort the tree walk.\r\n**\r\n** This routine also does error checking and name resolution for\r\n** function names.  The operator for aggregate functions is changed\r\n** to TK_AGG_FUNCTION.\r\n*/\r\nstatic int resolveExprStep(Walker *pWalker, Expr *pExpr){\r\n  NameContext *pNC;\r\n  Parse *pParse;\r\n\r\n  pNC = pWalker->u.pNC;\r\n  assert( pNC!=0 );\r\n  pParse = pNC->pParse;\r\n  assert( pParse==pWalker->pParse );\r\n\r\n  if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return WRC_Prune;\r\n  ExprSetProperty(pExpr, EP_Resolved);\r\n#ifndef NDEBUG\r\n  if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){\r\n    SrcList *pSrcList = pNC->pSrcList;\r\n    int i;\r\n    for(i=0; i<pNC->pSrcList->nSrc; i++){\r\n      assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);\r\n    }\r\n  }\r\n#endif\r\n  switch( pExpr->op ){\r\n\r\n#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)\r\n    /* The special operator TK_ROW means use the rowid for the first\r\n    ** column in the FROM clause.  This is used by the LIMIT and ORDER BY\r\n    ** clause processing on UPDATE and DELETE statements.\r\n    */\r\n    case TK_ROW: {\r\n      SrcList *pSrcList = pNC->pSrcList;\r\n      struct SrcList_item *pItem;\r\n      assert( pSrcList && pSrcList->nSrc==1 );\r\n      pItem = pSrcList->a; \r\n      pExpr->op = TK_COLUMN;\r\n      pExpr->pTab = pItem->pTab;\r\n      pExpr->iTable = pItem->iCursor;\r\n      pExpr->iColumn = -1;\r\n      pExpr->affinity = SQLITE_AFF_INTEGER;\r\n      break;\r\n    }\r\n#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) */\r\n\r\n    /* A lone identifier is the name of a column.\r\n    */\r\n    case TK_ID: {\r\n      return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);\r\n    }\r\n  \r\n    /* A table name and column name:     ID.ID\r\n    ** Or a database, table and column:  ID.ID.ID\r\n    */\r\n    case TK_DOT: {\r\n      const char *zColumn;\r\n      const char *zTable;\r\n      const char *zDb;\r\n      Expr *pRight;\r\n\r\n      /* if( pSrcList==0 ) break; */\r\n      pRight = pExpr->pRight;\r\n      if( pRight->op==TK_ID ){\r\n        zDb = 0;\r\n        zTable = pExpr->pLeft->u.zToken;\r\n        zColumn = pRight->u.zToken;\r\n      }else{\r\n        assert( pRight->op==TK_DOT );\r\n        zDb = pExpr->pLeft->u.zToken;\r\n        zTable = pRight->pLeft->u.zToken;\r\n        zColumn = pRight->pRight->u.zToken;\r\n      }\r\n      return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);\r\n    }\r\n\r\n    /* Resolve function names\r\n    */\r\n    case TK_CONST_FUNC:\r\n    case TK_FUNCTION: {\r\n      ExprList *pList = pExpr->x.pList;    /* The argument list */\r\n      int n = pList ? pList->nExpr : 0;    /* Number of arguments */\r\n      int no_such_func = 0;       /* True if no such function exists */\r\n      int wrong_num_args = 0;     /* True if wrong number of arguments */\r\n      int is_agg = 0;             /* True if is an aggregate function */\r\n      int auth;                   /* Authorization to use the function */\r\n      int nId;                    /* Number of characters in function name */\r\n      const char *zId;            /* The function name. */\r\n      FuncDef *pDef;              /* Information about the function */\r\n      u8 enc = ENC(pParse->db);   /* The database encoding */\r\n\r\n      testcase( pExpr->op==TK_CONST_FUNC );\r\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\r\n      zId = pExpr->u.zToken;\r\n      nId = sqlite3Strlen30(zId);\r\n      pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);\r\n      if( pDef==0 ){\r\n        pDef = sqlite3FindFunction(pParse->db, zId, nId, -1, enc, 0);\r\n        if( pDef==0 ){\r\n          no_such_func = 1;\r\n        }else{\r\n          wrong_num_args = 1;\r\n        }\r\n      }else{\r\n        is_agg = pDef->xFunc==0;\r\n      }\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n      if( pDef ){\r\n        auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);\r\n        if( auth!=SQLITE_OK ){\r\n          if( auth==SQLITE_DENY ){\r\n            sqlite3ErrorMsg(pParse, \"not authorized to use function: %s\",\r\n                                    pDef->zName);\r\n            pNC->nErr++;\r\n          }\r\n          pExpr->op = TK_NULL;\r\n          return WRC_Prune;\r\n        }\r\n      }\r\n#endif\r\n      if( is_agg && !pNC->allowAgg ){\r\n        sqlite3ErrorMsg(pParse, \"misuse of aggregate function %.*s()\", nId,zId);\r\n        pNC->nErr++;\r\n        is_agg = 0;\r\n      }else if( no_such_func ){\r\n        sqlite3ErrorMsg(pParse, \"no such function: %.*s\", nId, zId);\r\n        pNC->nErr++;\r\n      }else if( wrong_num_args ){\r\n        sqlite3ErrorMsg(pParse,\"wrong number of arguments to function %.*s()\",\r\n             nId, zId);\r\n        pNC->nErr++;\r\n      }\r\n      if( is_agg ){\r\n        pExpr->op = TK_AGG_FUNCTION;\r\n        pNC->hasAgg = 1;\r\n      }\r\n      if( is_agg ) pNC->allowAgg = 0;\r\n      sqlite3WalkExprList(pWalker, pList);\r\n      if( is_agg ) pNC->allowAgg = 1;\r\n      /* FIX ME:  Compute pExpr->affinity based on the expected return\r\n      ** type of the function \r\n      */\r\n      return WRC_Prune;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case TK_SELECT:\r\n    case TK_EXISTS:  testcase( pExpr->op==TK_EXISTS );\r\n#endif\r\n    case TK_IN: {\r\n      testcase( pExpr->op==TK_IN );\r\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n        int nRef = pNC->nRef;\r\n#ifndef SQLITE_OMIT_CHECK\r\n        if( pNC->isCheck ){\r\n          sqlite3ErrorMsg(pParse,\"subqueries prohibited in CHECK constraints\");\r\n        }\r\n#endif\r\n        sqlite3WalkSelect(pWalker, pExpr->x.pSelect);\r\n        assert( pNC->nRef>=nRef );\r\n        if( nRef!=pNC->nRef ){\r\n          ExprSetProperty(pExpr, EP_VarSelect);\r\n        }\r\n      }\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_CHECK\r\n    case TK_VARIABLE: {\r\n      if( pNC->isCheck ){\r\n        sqlite3ErrorMsg(pParse,\"parameters prohibited in CHECK constraints\");\r\n      }\r\n      break;\r\n    }\r\n#endif\r\n  }\r\n  return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;\r\n}\r\n\r\n/*\r\n** pEList is a list of expressions which are really the result set of the\r\n** a SELECT statement.  pE is a term in an ORDER BY or GROUP BY clause.\r\n** This routine checks to see if pE is a simple identifier which corresponds\r\n** to the AS-name of one of the terms of the expression list.  If it is,\r\n** this routine return an integer between 1 and N where N is the number of\r\n** elements in pEList, corresponding to the matching entry.  If there is\r\n** no match, or if pE is not a simple identifier, then this routine\r\n** return 0.\r\n**\r\n** pEList has been resolved.  pE has not.\r\n*/\r\nstatic int resolveAsName(\r\n  Parse *pParse,     /* Parsing context for error messages */\r\n  ExprList *pEList,  /* List of expressions to scan */\r\n  Expr *pE           /* Expression we are trying to match */\r\n){\r\n  int i;             /* Loop counter */\r\n\r\n  UNUSED_PARAMETER(pParse);\r\n\r\n  if( pE->op==TK_ID ){\r\n    char *zCol = pE->u.zToken;\r\n    for(i=0; i<pEList->nExpr; i++){\r\n      char *zAs = pEList->a[i].zName;\r\n      if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){\r\n        return i+1;\r\n      }\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** pE is a pointer to an expression which is a single term in the\r\n** ORDER BY of a compound SELECT.  The expression has not been\r\n** name resolved.\r\n**\r\n** At the point this routine is called, we already know that the\r\n** ORDER BY term is not an integer index into the result set.  That\r\n** case is handled by the calling routine.\r\n**\r\n** Attempt to match pE against result set columns in the left-most\r\n** SELECT statement.  Return the index i of the matching column,\r\n** as an indication to the caller that it should sort by the i-th column.\r\n** The left-most column is 1.  In other words, the value returned is the\r\n** same integer value that would be used in the SQL statement to indicate\r\n** the column.\r\n**\r\n** If there is no match, return 0.  Return -1 if an error occurs.\r\n*/\r\nstatic int resolveOrderByTermToExprList(\r\n  Parse *pParse,     /* Parsing context for error messages */\r\n  Select *pSelect,   /* The SELECT statement with the ORDER BY clause */\r\n  Expr *pE           /* The specific ORDER BY term */\r\n){\r\n  int i;             /* Loop counter */\r\n  ExprList *pEList;  /* The columns of the result set */\r\n  NameContext nc;    /* Name context for resolving pE */\r\n  sqlite3 *db;       /* Database connection */\r\n  int rc;            /* Return code from subprocedures */\r\n  u8 savedSuppErr;   /* Saved value of db->suppressErr */\r\n\r\n  assert( sqlite3ExprIsInteger(pE, &i)==0 );\r\n  pEList = pSelect->pEList;\r\n\r\n  /* Resolve all names in the ORDER BY term expression\r\n  */\r\n  memset(&nc, 0, sizeof(nc));\r\n  nc.pParse = pParse;\r\n  nc.pSrcList = pSelect->pSrc;\r\n  nc.pEList = pEList;\r\n  nc.allowAgg = 1;\r\n  nc.nErr = 0;\r\n  db = pParse->db;\r\n  savedSuppErr = db->suppressErr;\r\n  db->suppressErr = 1;\r\n  rc = sqlite3ResolveExprNames(&nc, pE);\r\n  db->suppressErr = savedSuppErr;\r\n  if( rc ) return 0;\r\n\r\n  /* Try to match the ORDER BY expression against an expression\r\n  ** in the result set.  Return an 1-based index of the matching\r\n  ** result-set entry.\r\n  */\r\n  for(i=0; i<pEList->nExpr; i++){\r\n    if( sqlite3ExprCompare(pEList->a[i].pExpr, pE)<2 ){\r\n      return i+1;\r\n    }\r\n  }\r\n\r\n  /* If no match, return 0. */\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Generate an ORDER BY or GROUP BY term out-of-range error.\r\n*/\r\nstatic void resolveOutOfRangeError(\r\n  Parse *pParse,         /* The error context into which to write the error */\r\n  const char *zType,     /* \"ORDER\" or \"GROUP\" */\r\n  int i,                 /* The index (1-based) of the term out of range */\r\n  int mx                 /* Largest permissible value of i */\r\n){\r\n  sqlite3ErrorMsg(pParse, \r\n    \"%r %s BY term out of range - should be \"\r\n    \"between 1 and %d\", i, zType, mx);\r\n}\r\n\r\n/*\r\n** Analyze the ORDER BY clause in a compound SELECT statement.   Modify\r\n** each term of the ORDER BY clause is a constant integer between 1\r\n** and N where N is the number of columns in the compound SELECT.\r\n**\r\n** ORDER BY terms that are already an integer between 1 and N are\r\n** unmodified.  ORDER BY terms that are integers outside the range of\r\n** 1 through N generate an error.  ORDER BY terms that are expressions\r\n** are matched against result set expressions of compound SELECT\r\n** beginning with the left-most SELECT and working toward the right.\r\n** At the first match, the ORDER BY expression is transformed into\r\n** the integer column number.\r\n**\r\n** Return the number of errors seen.\r\n*/\r\nstatic int resolveCompoundOrderBy(\r\n  Parse *pParse,        /* Parsing context.  Leave error messages here */\r\n  Select *pSelect       /* The SELECT statement containing the ORDER BY */\r\n){\r\n  int i;\r\n  ExprList *pOrderBy;\r\n  ExprList *pEList;\r\n  sqlite3 *db;\r\n  int moreToDo = 1;\r\n\r\n  pOrderBy = pSelect->pOrderBy;\r\n  if( pOrderBy==0 ) return 0;\r\n  db = pParse->db;\r\n#if SQLITE_MAX_COLUMN\r\n  if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){\r\n    sqlite3ErrorMsg(pParse, \"too many terms in ORDER BY clause\");\r\n    return 1;\r\n  }\r\n#endif\r\n  for(i=0; i<pOrderBy->nExpr; i++){\r\n    pOrderBy->a[i].done = 0;\r\n  }\r\n  pSelect->pNext = 0;\r\n  while( pSelect->pPrior ){\r\n    pSelect->pPrior->pNext = pSelect;\r\n    pSelect = pSelect->pPrior;\r\n  }\r\n  while( pSelect && moreToDo ){\r\n    struct ExprList_item *pItem;\r\n    moreToDo = 0;\r\n    pEList = pSelect->pEList;\r\n    assert( pEList!=0 );\r\n    for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){\r\n      int iCol = -1;\r\n      Expr *pE, *pDup;\r\n      if( pItem->done ) continue;\r\n      pE = pItem->pExpr;\r\n      if( sqlite3ExprIsInteger(pE, &iCol) ){\r\n        if( iCol<=0 || iCol>pEList->nExpr ){\r\n          resolveOutOfRangeError(pParse, \"ORDER\", i+1, pEList->nExpr);\r\n          return 1;\r\n        }\r\n      }else{\r\n        iCol = resolveAsName(pParse, pEList, pE);\r\n        if( iCol==0 ){\r\n          pDup = sqlite3ExprDup(db, pE, 0);\r\n          if( !db->mallocFailed ){\r\n            assert(pDup);\r\n            iCol = resolveOrderByTermToExprList(pParse, pSelect, pDup);\r\n          }\r\n          sqlite3ExprDelete(db, pDup);\r\n        }\r\n      }\r\n      if( iCol>0 ){\r\n        CollSeq *pColl = pE->pColl;\r\n        int flags = pE->flags & EP_ExpCollate;\r\n        sqlite3ExprDelete(db, pE);\r\n        pItem->pExpr = pE = sqlite3Expr(db, TK_INTEGER, 0);\r\n        if( pE==0 ) return 1;\r\n        pE->pColl = pColl;\r\n        pE->flags |= EP_IntValue | flags;\r\n        pE->u.iValue = iCol;\r\n        pItem->iOrderByCol = (u16)iCol;\r\n        pItem->done = 1;\r\n      }else{\r\n        moreToDo = 1;\r\n      }\r\n    }\r\n    pSelect = pSelect->pNext;\r\n  }\r\n  for(i=0; i<pOrderBy->nExpr; i++){\r\n    if( pOrderBy->a[i].done==0 ){\r\n      sqlite3ErrorMsg(pParse, \"%r ORDER BY term does not match any \"\r\n            \"column in the result set\", i+1);\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Check every term in the ORDER BY or GROUP BY clause pOrderBy of\r\n** the SELECT statement pSelect.  If any term is reference to a\r\n** result set expression (as determined by the ExprList.a.iCol field)\r\n** then convert that term into a copy of the corresponding result set\r\n** column.\r\n**\r\n** If any errors are detected, add an error message to pParse and\r\n** return non-zero.  Return zero if no errors are seen.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(\r\n  Parse *pParse,        /* Parsing context.  Leave error messages here */\r\n  Select *pSelect,      /* The SELECT statement containing the clause */\r\n  ExprList *pOrderBy,   /* The ORDER BY or GROUP BY clause to be processed */\r\n  const char *zType     /* \"ORDER\" or \"GROUP\" */\r\n){\r\n  int i;\r\n  sqlite3 *db = pParse->db;\r\n  ExprList *pEList;\r\n  struct ExprList_item *pItem;\r\n\r\n  if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;\r\n#if SQLITE_MAX_COLUMN\r\n  if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){\r\n    sqlite3ErrorMsg(pParse, \"too many terms in %s BY clause\", zType);\r\n    return 1;\r\n  }\r\n#endif\r\n  pEList = pSelect->pEList;\r\n  assert( pEList!=0 );  /* sqlite3SelectNew() guarantees this */\r\n  for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){\r\n    if( pItem->iOrderByCol ){\r\n      if( pItem->iOrderByCol>pEList->nExpr ){\r\n        resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);\r\n        return 1;\r\n      }\r\n      resolveAlias(pParse, pEList, pItem->iOrderByCol-1, pItem->pExpr, zType);\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.\r\n** The Name context of the SELECT statement is pNC.  zType is either\r\n** \"ORDER\" or \"GROUP\" depending on which type of clause pOrderBy is.\r\n**\r\n** This routine resolves each term of the clause into an expression.\r\n** If the order-by term is an integer I between 1 and N (where N is the\r\n** number of columns in the result set of the SELECT) then the expression\r\n** in the resolution is a copy of the I-th result-set expression.  If\r\n** the order-by term is an identify that corresponds to the AS-name of\r\n** a result-set expression, then the term resolves to a copy of the\r\n** result-set expression.  Otherwise, the expression is resolved in\r\n** the usual way - using sqlite3ResolveExprNames().\r\n**\r\n** This routine returns the number of errors.  If errors occur, then\r\n** an appropriate error message might be left in pParse.  (OOM errors\r\n** excepted.)\r\n*/\r\nstatic int resolveOrderGroupBy(\r\n  NameContext *pNC,     /* The name context of the SELECT statement */\r\n  Select *pSelect,      /* The SELECT statement holding pOrderBy */\r\n  ExprList *pOrderBy,   /* An ORDER BY or GROUP BY clause to resolve */\r\n  const char *zType     /* Either \"ORDER\" or \"GROUP\", as appropriate */\r\n){\r\n  int i;                         /* Loop counter */\r\n  int iCol;                      /* Column number */\r\n  struct ExprList_item *pItem;   /* A term of the ORDER BY clause */\r\n  Parse *pParse;                 /* Parsing context */\r\n  int nResult;                   /* Number of terms in the result set */\r\n\r\n  if( pOrderBy==0 ) return 0;\r\n  nResult = pSelect->pEList->nExpr;\r\n  pParse = pNC->pParse;\r\n  for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){\r\n    Expr *pE = pItem->pExpr;\r\n    iCol = resolveAsName(pParse, pSelect->pEList, pE);\r\n    if( iCol>0 ){\r\n      /* If an AS-name match is found, mark this ORDER BY column as being\r\n      ** a copy of the iCol-th result-set column.  The subsequent call to\r\n      ** sqlite3ResolveOrderGroupBy() will convert the expression to a\r\n      ** copy of the iCol-th result-set expression. */\r\n      pItem->iOrderByCol = (u16)iCol;\r\n      continue;\r\n    }\r\n    if( sqlite3ExprIsInteger(pE, &iCol) ){\r\n      /* The ORDER BY term is an integer constant.  Again, set the column\r\n      ** number so that sqlite3ResolveOrderGroupBy() will convert the\r\n      ** order-by term to a copy of the result-set expression */\r\n      if( iCol<1 ){\r\n        resolveOutOfRangeError(pParse, zType, i+1, nResult);\r\n        return 1;\r\n      }\r\n      pItem->iOrderByCol = (u16)iCol;\r\n      continue;\r\n    }\r\n\r\n    /* Otherwise, treat the ORDER BY term as an ordinary expression */\r\n    pItem->iOrderByCol = 0;\r\n    if( sqlite3ResolveExprNames(pNC, pE) ){\r\n      return 1;\r\n    }\r\n  }\r\n  return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);\r\n}\r\n\r\n/*\r\n** Resolve names in the SELECT statement p and all of its descendents.\r\n*/\r\nstatic int resolveSelectStep(Walker *pWalker, Select *p){\r\n  NameContext *pOuterNC;  /* Context that contains this SELECT */\r\n  NameContext sNC;        /* Name context of this SELECT */\r\n  int isCompound;         /* True if p is a compound select */\r\n  int nCompound;          /* Number of compound terms processed so far */\r\n  Parse *pParse;          /* Parsing context */\r\n  ExprList *pEList;       /* Result set expression list */\r\n  int i;                  /* Loop counter */\r\n  ExprList *pGroupBy;     /* The GROUP BY clause */\r\n  Select *pLeftmost;      /* Left-most of SELECT of a compound */\r\n  sqlite3 *db;            /* Database connection */\r\n  \r\n\r\n  assert( p!=0 );\r\n  if( p->selFlags & SF_Resolved ){\r\n    return WRC_Prune;\r\n  }\r\n  pOuterNC = pWalker->u.pNC;\r\n  pParse = pWalker->pParse;\r\n  db = pParse->db;\r\n\r\n  /* Normally sqlite3SelectExpand() will be called first and will have\r\n  ** already expanded this SELECT.  However, if this is a subquery within\r\n  ** an expression, sqlite3ResolveExprNames() will be called without a\r\n  ** prior call to sqlite3SelectExpand().  When that happens, let\r\n  ** sqlite3SelectPrep() do all of the processing for this SELECT.\r\n  ** sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and\r\n  ** this routine in the correct order.\r\n  */\r\n  if( (p->selFlags & SF_Expanded)==0 ){\r\n    sqlite3SelectPrep(pParse, p, pOuterNC);\r\n    return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune;\r\n  }\r\n\r\n  isCompound = p->pPrior!=0;\r\n  nCompound = 0;\r\n  pLeftmost = p;\r\n  while( p ){\r\n    assert( (p->selFlags & SF_Expanded)!=0 );\r\n    assert( (p->selFlags & SF_Resolved)==0 );\r\n    p->selFlags |= SF_Resolved;\r\n\r\n    /* Resolve the expressions in the LIMIT and OFFSET clauses. These\r\n    ** are not allowed to refer to any names, so pass an empty NameContext.\r\n    */\r\n    memset(&sNC, 0, sizeof(sNC));\r\n    sNC.pParse = pParse;\r\n    if( sqlite3ResolveExprNames(&sNC, p->pLimit) ||\r\n        sqlite3ResolveExprNames(&sNC, p->pOffset) ){\r\n      return WRC_Abort;\r\n    }\r\n  \r\n    /* Set up the local name-context to pass to sqlite3ResolveExprNames() to\r\n    ** resolve the result-set expression list.\r\n    */\r\n    sNC.allowAgg = 1;\r\n    sNC.pSrcList = p->pSrc;\r\n    sNC.pNext = pOuterNC;\r\n  \r\n    /* Resolve names in the result set. */\r\n    pEList = p->pEList;\r\n    assert( pEList!=0 );\r\n    for(i=0; i<pEList->nExpr; i++){\r\n      Expr *pX = pEList->a[i].pExpr;\r\n      if( sqlite3ResolveExprNames(&sNC, pX) ){\r\n        return WRC_Abort;\r\n      }\r\n    }\r\n  \r\n    /* Recursively resolve names in all subqueries\r\n    */\r\n    for(i=0; i<p->pSrc->nSrc; i++){\r\n      struct SrcList_item *pItem = &p->pSrc->a[i];\r\n      if( pItem->pSelect ){\r\n        NameContext *pNC;         /* Used to iterate name contexts */\r\n        int nRef = 0;             /* Refcount for pOuterNC and outer contexts */\r\n        const char *zSavedContext = pParse->zAuthContext;\r\n\r\n        /* Count the total number of references to pOuterNC and all of its\r\n        ** parent contexts. After resolving references to expressions in\r\n        ** pItem->pSelect, check if this value has changed. If so, then\r\n        ** SELECT statement pItem->pSelect must be correlated. Set the\r\n        ** pItem->isCorrelated flag if this is the case. */\r\n        for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef += pNC->nRef;\r\n\r\n        if( pItem->zName ) pParse->zAuthContext = pItem->zName;\r\n        sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC);\r\n        pParse->zAuthContext = zSavedContext;\r\n        if( pParse->nErr || db->mallocFailed ) return WRC_Abort;\r\n\r\n        for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef -= pNC->nRef;\r\n        assert( pItem->isCorrelated==0 && nRef<=0 );\r\n        pItem->isCorrelated = (nRef!=0);\r\n      }\r\n    }\r\n  \r\n    /* If there are no aggregate functions in the result-set, and no GROUP BY \r\n    ** expression, do not allow aggregates in any of the other expressions.\r\n    */\r\n    assert( (p->selFlags & SF_Aggregate)==0 );\r\n    pGroupBy = p->pGroupBy;\r\n    if( pGroupBy || sNC.hasAgg ){\r\n      p->selFlags |= SF_Aggregate;\r\n    }else{\r\n      sNC.allowAgg = 0;\r\n    }\r\n  \r\n    /* If a HAVING clause is present, then there must be a GROUP BY clause.\r\n    */\r\n    if( p->pHaving && !pGroupBy ){\r\n      sqlite3ErrorMsg(pParse, \"a GROUP BY clause is required before HAVING\");\r\n      return WRC_Abort;\r\n    }\r\n  \r\n    /* Add the expression list to the name-context before parsing the\r\n    ** other expressions in the SELECT statement. This is so that\r\n    ** expressions in the WHERE clause (etc.) can refer to expressions by\r\n    ** aliases in the result set.\r\n    **\r\n    ** Minor point: If this is the case, then the expression will be\r\n    ** re-evaluated for each reference to it.\r\n    */\r\n    sNC.pEList = p->pEList;\r\n    if( sqlite3ResolveExprNames(&sNC, p->pWhere) ||\r\n       sqlite3ResolveExprNames(&sNC, p->pHaving)\r\n    ){\r\n      return WRC_Abort;\r\n    }\r\n\r\n    /* The ORDER BY and GROUP BY clauses may not refer to terms in\r\n    ** outer queries \r\n    */\r\n    sNC.pNext = 0;\r\n    sNC.allowAgg = 1;\r\n\r\n    /* Process the ORDER BY clause for singleton SELECT statements.\r\n    ** The ORDER BY clause for compounds SELECT statements is handled\r\n    ** below, after all of the result-sets for all of the elements of\r\n    ** the compound have been resolved.\r\n    */\r\n    if( !isCompound && resolveOrderGroupBy(&sNC, p, p->pOrderBy, \"ORDER\") ){\r\n      return WRC_Abort;\r\n    }\r\n    if( db->mallocFailed ){\r\n      return WRC_Abort;\r\n    }\r\n  \r\n    /* Resolve the GROUP BY clause.  At the same time, make sure \r\n    ** the GROUP BY clause does not contain aggregate functions.\r\n    */\r\n    if( pGroupBy ){\r\n      struct ExprList_item *pItem;\r\n    \r\n      if( resolveOrderGroupBy(&sNC, p, pGroupBy, \"GROUP\") || db->mallocFailed ){\r\n        return WRC_Abort;\r\n      }\r\n      for(i=0, pItem=pGroupBy->a; i<pGroupBy->nExpr; i++, pItem++){\r\n        if( ExprHasProperty(pItem->pExpr, EP_Agg) ){\r\n          sqlite3ErrorMsg(pParse, \"aggregate functions are not allowed in \"\r\n              \"the GROUP BY clause\");\r\n          return WRC_Abort;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Advance to the next term of the compound\r\n    */\r\n    p = p->pPrior;\r\n    nCompound++;\r\n  }\r\n\r\n  /* Resolve the ORDER BY on a compound SELECT after all terms of\r\n  ** the compound have been resolved.\r\n  */\r\n  if( isCompound && resolveCompoundOrderBy(pParse, pLeftmost) ){\r\n    return WRC_Abort;\r\n  }\r\n\r\n  return WRC_Prune;\r\n}\r\n\r\n/*\r\n** This routine walks an expression tree and resolves references to\r\n** table columns and result-set columns.  At the same time, do error\r\n** checking on function usage and set a flag if any aggregate functions\r\n** are seen.\r\n**\r\n** To resolve table columns references we look for nodes (or subtrees) of the \r\n** form X.Y.Z or Y.Z or just Z where\r\n**\r\n**      X:   The name of a database.  Ex:  \"main\" or \"temp\" or\r\n**           the symbolic name assigned to an ATTACH-ed database.\r\n**\r\n**      Y:   The name of a table in a FROM clause.  Or in a trigger\r\n**           one of the special names \"old\" or \"new\".\r\n**\r\n**      Z:   The name of a column in table Y.\r\n**\r\n** The node at the root of the subtree is modified as follows:\r\n**\r\n**    Expr.op        Changed to TK_COLUMN\r\n**    Expr.pTab      Points to the Table object for X.Y\r\n**    Expr.iColumn   The column index in X.Y.  -1 for the rowid.\r\n**    Expr.iTable    The VDBE cursor number for X.Y\r\n**\r\n**\r\n** To resolve result-set references, look for expression nodes of the\r\n** form Z (with no X and Y prefix) where the Z matches the right-hand\r\n** size of an AS clause in the result-set of a SELECT.  The Z expression\r\n** is replaced by a copy of the left-hand side of the result-set expression.\r\n** Table-name and function resolution occurs on the substituted expression\r\n** tree.  For example, in:\r\n**\r\n**      SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x;\r\n**\r\n** The \"x\" term of the order by is replaced by \"a+b\" to render:\r\n**\r\n**      SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;\r\n**\r\n** Function calls are checked to make sure that the function is \r\n** defined and that the correct number of arguments are specified.\r\n** If the function is an aggregate function, then the pNC->hasAgg is\r\n** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.\r\n** If an expression contains aggregate functions then the EP_Agg\r\n** property on the expression is set.\r\n**\r\n** An error message is left in pParse if anything is amiss.  The number\r\n** if errors is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ResolveExprNames( \r\n  NameContext *pNC,       /* Namespace to resolve expressions in. */\r\n  Expr *pExpr             /* The expression to be analyzed. */\r\n){\r\n  int savedHasAgg;\r\n  Walker w;\r\n\r\n  if( pExpr==0 ) return 0;\r\n#if SQLITE_MAX_EXPR_DEPTH>0\r\n  {\r\n    Parse *pParse = pNC->pParse;\r\n    if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){\r\n      return 1;\r\n    }\r\n    pParse->nHeight += pExpr->nHeight;\r\n  }\r\n#endif\r\n  savedHasAgg = pNC->hasAgg;\r\n  pNC->hasAgg = 0;\r\n  w.xExprCallback = resolveExprStep;\r\n  w.xSelectCallback = resolveSelectStep;\r\n  w.pParse = pNC->pParse;\r\n  w.u.pNC = pNC;\r\n  sqlite3WalkExpr(&w, pExpr);\r\n#if SQLITE_MAX_EXPR_DEPTH>0\r\n  pNC->pParse->nHeight -= pExpr->nHeight;\r\n#endif\r\n  if( pNC->nErr>0 || w.pParse->nErr>0 ){\r\n    ExprSetProperty(pExpr, EP_Error);\r\n  }\r\n  if( pNC->hasAgg ){\r\n    ExprSetProperty(pExpr, EP_Agg);\r\n  }else if( savedHasAgg ){\r\n    pNC->hasAgg = 1;\r\n  }\r\n  return ExprHasProperty(pExpr, EP_Error);\r\n}\r\n\r\n\r\n/*\r\n** Resolve all names in all expressions of a SELECT and in all\r\n** decendents of the SELECT, including compounds off of p->pPrior,\r\n** subqueries in expressions, and subqueries used as FROM clause\r\n** terms.\r\n**\r\n** See sqlite3ResolveExprNames() for a description of the kinds of\r\n** transformations that occur.\r\n**\r\n** All SELECT statements should have been expanded using\r\n** sqlite3SelectExpand() prior to invoking this routine.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ResolveSelectNames(\r\n  Parse *pParse,         /* The parser context */\r\n  Select *p,             /* The SELECT statement being coded. */\r\n  NameContext *pOuterNC  /* Name context for parent SELECT statement */\r\n){\r\n  Walker w;\r\n\r\n  assert( p!=0 );\r\n  w.xExprCallback = resolveExprStep;\r\n  w.xSelectCallback = resolveSelectStep;\r\n  w.pParse = pParse;\r\n  w.u.pNC = pOuterNC;\r\n  sqlite3WalkSelect(&w, p);\r\n}\r\n\r\n/************** End of resolve.c *********************************************/\r\n/************** Begin file expr.c ********************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains routines used for analyzing expressions and\r\n** for generating VDBE code that evaluates expressions in SQLite.\r\n*/\r\n\r\n/*\r\n** Return the 'affinity' of the expression pExpr if any.\r\n**\r\n** If pExpr is a column, a reference to a column via an 'AS' alias,\r\n** or a sub-select with a column as the return value, then the \r\n** affinity of that column is returned. Otherwise, 0x00 is returned,\r\n** indicating no affinity for the expression.\r\n**\r\n** i.e. the WHERE clause expresssions in the following statements all\r\n** have an affinity:\r\n**\r\n** CREATE TABLE t1(a);\r\n** SELECT * FROM t1 WHERE a;\r\n** SELECT a AS b FROM t1 WHERE b;\r\n** SELECT * FROM t1 WHERE (select a from t1);\r\n*/\r\nSQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){\r\n  int op = pExpr->op;\r\n  if( op==TK_SELECT ){\r\n    assert( pExpr->flags&EP_xIsSelect );\r\n    return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);\r\n  }\r\n#ifndef SQLITE_OMIT_CAST\r\n  if( op==TK_CAST ){\r\n    assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n    return sqlite3AffinityType(pExpr->u.zToken);\r\n  }\r\n#endif\r\n  if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_REGISTER) \r\n   && pExpr->pTab!=0\r\n  ){\r\n    /* op==TK_REGISTER && pExpr->pTab!=0 happens when pExpr was originally\r\n    ** a TK_COLUMN but was previously evaluated and cached in a register */\r\n    int j = pExpr->iColumn;\r\n    if( j<0 ) return SQLITE_AFF_INTEGER;\r\n    assert( pExpr->pTab && j<pExpr->pTab->nCol );\r\n    return pExpr->pTab->aCol[j].affinity;\r\n  }\r\n  return pExpr->affinity;\r\n}\r\n\r\n/*\r\n** Set the explicit collating sequence for an expression to the\r\n** collating sequence supplied in the second argument.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3ExprSetColl(Expr *pExpr, CollSeq *pColl){\r\n  if( pExpr && pColl ){\r\n    pExpr->pColl = pColl;\r\n    pExpr->flags |= EP_ExpCollate;\r\n  }\r\n  return pExpr;\r\n}\r\n\r\n/*\r\n** Set the collating sequence for expression pExpr to be the collating\r\n** sequence named by pToken.   Return a pointer to the revised expression.\r\n** The collating sequence is marked as \"explicit\" using the EP_ExpCollate\r\n** flag.  An explicit collating sequence will override implicit\r\n** collating sequences.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3ExprSetCollByToken(Parse *pParse, Expr *pExpr, Token *pCollName){\r\n  char *zColl = 0;            /* Dequoted name of collation sequence */\r\n  CollSeq *pColl;\r\n  sqlite3 *db = pParse->db;\r\n  zColl = sqlite3NameFromToken(db, pCollName);\r\n  pColl = sqlite3LocateCollSeq(pParse, zColl);\r\n  sqlite3ExprSetColl(pExpr, pColl);\r\n  sqlite3DbFree(db, zColl);\r\n  return pExpr;\r\n}\r\n\r\n/*\r\n** Return the default collation sequence for the expression pExpr. If\r\n** there is no default collation type, return 0.\r\n*/\r\nSQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){\r\n  CollSeq *pColl = 0;\r\n  Expr *p = pExpr;\r\n  while( p ){\r\n    int op;\r\n    pColl = p->pColl;\r\n    if( pColl ) break;\r\n    op = p->op;\r\n    if( p->pTab!=0 && (\r\n        op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_REGISTER || op==TK_TRIGGER\r\n    )){\r\n      /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally\r\n      ** a TK_COLUMN but was previously evaluated and cached in a register */\r\n      const char *zColl;\r\n      int j = p->iColumn;\r\n      if( j>=0 ){\r\n        sqlite3 *db = pParse->db;\r\n        zColl = p->pTab->aCol[j].zColl;\r\n        pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);\r\n        pExpr->pColl = pColl;\r\n      }\r\n      break;\r\n    }\r\n    if( op!=TK_CAST && op!=TK_UPLUS ){\r\n      break;\r\n    }\r\n    p = p->pLeft;\r\n  }\r\n  if( sqlite3CheckCollSeq(pParse, pColl) ){ \r\n    pColl = 0;\r\n  }\r\n  return pColl;\r\n}\r\n\r\n/*\r\n** pExpr is an operand of a comparison operator.  aff2 is the\r\n** type affinity of the other operand.  This routine returns the\r\n** type affinity that should be used for the comparison operator.\r\n*/\r\nSQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2){\r\n  char aff1 = sqlite3ExprAffinity(pExpr);\r\n  if( aff1 && aff2 ){\r\n    /* Both sides of the comparison are columns. If one has numeric\r\n    ** affinity, use that. Otherwise use no affinity.\r\n    */\r\n    if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){\r\n      return SQLITE_AFF_NUMERIC;\r\n    }else{\r\n      return SQLITE_AFF_NONE;\r\n    }\r\n  }else if( !aff1 && !aff2 ){\r\n    /* Neither side of the comparison is a column.  Compare the\r\n    ** results directly.\r\n    */\r\n    return SQLITE_AFF_NONE;\r\n  }else{\r\n    /* One side is a column, the other is not. Use the columns affinity. */\r\n    assert( aff1==0 || aff2==0 );\r\n    return (aff1 + aff2);\r\n  }\r\n}\r\n\r\n/*\r\n** pExpr is a comparison operator.  Return the type affinity that should\r\n** be applied to both operands prior to doing the comparison.\r\n*/\r\nstatic char comparisonAffinity(Expr *pExpr){\r\n  char aff;\r\n  assert( pExpr->op==TK_EQ || pExpr->op==TK_IN || pExpr->op==TK_LT ||\r\n          pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE ||\r\n          pExpr->op==TK_NE || pExpr->op==TK_IS || pExpr->op==TK_ISNOT );\r\n  assert( pExpr->pLeft );\r\n  aff = sqlite3ExprAffinity(pExpr->pLeft);\r\n  if( pExpr->pRight ){\r\n    aff = sqlite3CompareAffinity(pExpr->pRight, aff);\r\n  }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n    aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff);\r\n  }else if( !aff ){\r\n    aff = SQLITE_AFF_NONE;\r\n  }\r\n  return aff;\r\n}\r\n\r\n/*\r\n** pExpr is a comparison expression, eg. '=', '<', IN(...) etc.\r\n** idx_affinity is the affinity of an indexed column. Return true\r\n** if the index with affinity idx_affinity may be used to implement\r\n** the comparison in pExpr.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){\r\n  char aff = comparisonAffinity(pExpr);\r\n  switch( aff ){\r\n    case SQLITE_AFF_NONE:\r\n      return 1;\r\n    case SQLITE_AFF_TEXT:\r\n      return idx_affinity==SQLITE_AFF_TEXT;\r\n    default:\r\n      return sqlite3IsNumericAffinity(idx_affinity);\r\n  }\r\n}\r\n\r\n/*\r\n** Return the P5 value that should be used for a binary comparison\r\n** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2.\r\n*/\r\nstatic u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){\r\n  u8 aff = (char)sqlite3ExprAffinity(pExpr2);\r\n  aff = (u8)sqlite3CompareAffinity(pExpr1, aff) | (u8)jumpIfNull;\r\n  return aff;\r\n}\r\n\r\n/*\r\n** Return a pointer to the collation sequence that should be used by\r\n** a binary comparison operator comparing pLeft and pRight.\r\n**\r\n** If the left hand expression has a collating sequence type, then it is\r\n** used. Otherwise the collation sequence for the right hand expression\r\n** is used, or the default (BINARY) if neither expression has a collating\r\n** type.\r\n**\r\n** Argument pRight (but not pLeft) may be a null pointer. In this case,\r\n** it is not considered.\r\n*/\r\nSQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(\r\n  Parse *pParse, \r\n  Expr *pLeft, \r\n  Expr *pRight\r\n){\r\n  CollSeq *pColl;\r\n  assert( pLeft );\r\n  if( pLeft->flags & EP_ExpCollate ){\r\n    assert( pLeft->pColl );\r\n    pColl = pLeft->pColl;\r\n  }else if( pRight && pRight->flags & EP_ExpCollate ){\r\n    assert( pRight->pColl );\r\n    pColl = pRight->pColl;\r\n  }else{\r\n    pColl = sqlite3ExprCollSeq(pParse, pLeft);\r\n    if( !pColl ){\r\n      pColl = sqlite3ExprCollSeq(pParse, pRight);\r\n    }\r\n  }\r\n  return pColl;\r\n}\r\n\r\n/*\r\n** Generate code for a comparison operator.\r\n*/\r\nstatic int codeCompare(\r\n  Parse *pParse,    /* The parsing (and code generating) context */\r\n  Expr *pLeft,      /* The left operand */\r\n  Expr *pRight,     /* The right operand */\r\n  int opcode,       /* The comparison opcode */\r\n  int in1, int in2, /* Register holding operands */\r\n  int dest,         /* Jump here if true.  */\r\n  int jumpIfNull    /* If true, jump if either operand is NULL */\r\n){\r\n  int p5;\r\n  int addr;\r\n  CollSeq *p4;\r\n\r\n  p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);\r\n  p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);\r\n  addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,\r\n                           (void*)p4, P4_COLLSEQ);\r\n  sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);\r\n  return addr;\r\n}\r\n\r\n#if SQLITE_MAX_EXPR_DEPTH>0\r\n/*\r\n** Check that argument nHeight is less than or equal to the maximum\r\n** expression depth allowed. If it is not, leave an error message in\r\n** pParse.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){\r\n  int rc = SQLITE_OK;\r\n  int mxHeight = pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH];\r\n  if( nHeight>mxHeight ){\r\n    sqlite3ErrorMsg(pParse, \r\n       \"Expression tree is too large (maximum depth %d)\", mxHeight\r\n    );\r\n    rc = SQLITE_ERROR;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* The following three functions, heightOfExpr(), heightOfExprList()\r\n** and heightOfSelect(), are used to determine the maximum height\r\n** of any expression tree referenced by the structure passed as the\r\n** first argument.\r\n**\r\n** If this maximum height is greater than the current value pointed\r\n** to by pnHeight, the second parameter, then set *pnHeight to that\r\n** value.\r\n*/\r\nstatic void heightOfExpr(Expr *p, int *pnHeight){\r\n  if( p ){\r\n    if( p->nHeight>*pnHeight ){\r\n      *pnHeight = p->nHeight;\r\n    }\r\n  }\r\n}\r\nstatic void heightOfExprList(ExprList *p, int *pnHeight){\r\n  if( p ){\r\n    int i;\r\n    for(i=0; i<p->nExpr; i++){\r\n      heightOfExpr(p->a[i].pExpr, pnHeight);\r\n    }\r\n  }\r\n}\r\nstatic void heightOfSelect(Select *p, int *pnHeight){\r\n  if( p ){\r\n    heightOfExpr(p->pWhere, pnHeight);\r\n    heightOfExpr(p->pHaving, pnHeight);\r\n    heightOfExpr(p->pLimit, pnHeight);\r\n    heightOfExpr(p->pOffset, pnHeight);\r\n    heightOfExprList(p->pEList, pnHeight);\r\n    heightOfExprList(p->pGroupBy, pnHeight);\r\n    heightOfExprList(p->pOrderBy, pnHeight);\r\n    heightOfSelect(p->pPrior, pnHeight);\r\n  }\r\n}\r\n\r\n/*\r\n** Set the Expr.nHeight variable in the structure passed as an \r\n** argument. An expression with no children, Expr.pList or \r\n** Expr.pSelect member has a height of 1. Any other expression\r\n** has a height equal to the maximum height of any other \r\n** referenced Expr plus one.\r\n*/\r\nstatic void exprSetHeight(Expr *p){\r\n  int nHeight = 0;\r\n  heightOfExpr(p->pLeft, &nHeight);\r\n  heightOfExpr(p->pRight, &nHeight);\r\n  if( ExprHasProperty(p, EP_xIsSelect) ){\r\n    heightOfSelect(p->x.pSelect, &nHeight);\r\n  }else{\r\n    heightOfExprList(p->x.pList, &nHeight);\r\n  }\r\n  p->nHeight = nHeight + 1;\r\n}\r\n\r\n/*\r\n** Set the Expr.nHeight variable using the exprSetHeight() function. If\r\n** the height is greater than the maximum allowed expression depth,\r\n** leave an error in pParse.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprSetHeight(Parse *pParse, Expr *p){\r\n  exprSetHeight(p);\r\n  sqlite3ExprCheckHeight(pParse, p->nHeight);\r\n}\r\n\r\n/*\r\n** Return the maximum height of any expression tree referenced\r\n** by the select statement passed as an argument.\r\n*/\r\nSQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){\r\n  int nHeight = 0;\r\n  heightOfSelect(p, &nHeight);\r\n  return nHeight;\r\n}\r\n#else\r\n  #define exprSetHeight(y)\r\n#endif /* SQLITE_MAX_EXPR_DEPTH>0 */\r\n\r\n/*\r\n** This routine is the core allocator for Expr nodes.\r\n**\r\n** Construct a new expression node and return a pointer to it.  Memory\r\n** for this node and for the pToken argument is a single allocation\r\n** obtained from sqlite3DbMalloc().  The calling function\r\n** is responsible for making sure the node eventually gets freed.\r\n**\r\n** If dequote is true, then the token (if it exists) is dequoted.\r\n** If dequote is false, no dequoting is performance.  The deQuote\r\n** parameter is ignored if pToken is NULL or if the token does not\r\n** appear to be quoted.  If the quotes were of the form \"...\" (double-quotes)\r\n** then the EP_DblQuoted flag is set on the expression node.\r\n**\r\n** Special case:  If op==TK_INTEGER and pToken points to a string that\r\n** can be translated into a 32-bit integer, then the token is not\r\n** stored in u.zToken.  Instead, the integer values is written\r\n** into u.iValue and the EP_IntValue flag is set.  No extra storage\r\n** is allocated to hold the integer text and the dequote flag is ignored.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3ExprAlloc(\r\n  sqlite3 *db,            /* Handle for sqlite3DbMallocZero() (may be null) */\r\n  int op,                 /* Expression opcode */\r\n  const Token *pToken,    /* Token argument.  Might be NULL */\r\n  int dequote             /* True to dequote */\r\n){\r\n  Expr *pNew;\r\n  int nExtra = 0;\r\n  int iValue = 0;\r\n\r\n  if( pToken ){\r\n    if( op!=TK_INTEGER || pToken->z==0\r\n          || sqlite3GetInt32(pToken->z, &iValue)==0 ){\r\n      nExtra = pToken->n+1;\r\n      assert( iValue>=0 );\r\n    }\r\n  }\r\n  pNew = sqlite3DbMallocZero(db, sizeof(Expr)+nExtra);\r\n  if( pNew ){\r\n    pNew->op = (u8)op;\r\n    pNew->iAgg = -1;\r\n    if( pToken ){\r\n      if( nExtra==0 ){\r\n        pNew->flags |= EP_IntValue;\r\n        pNew->u.iValue = iValue;\r\n      }else{\r\n        int c;\r\n        pNew->u.zToken = (char*)&pNew[1];\r\n        assert( pToken->z!=0 || pToken->n==0 );\r\n        if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);\r\n        pNew->u.zToken[pToken->n] = 0;\r\n        if( dequote && nExtra>=3 \r\n             && ((c = pToken->z[0])=='\\'' || c=='\"' || c=='[' || c=='`') ){\r\n          sqlite3Dequote(pNew->u.zToken);\r\n          if( c=='\"' ) pNew->flags |= EP_DblQuoted;\r\n        }\r\n      }\r\n    }\r\n#if SQLITE_MAX_EXPR_DEPTH>0\r\n    pNew->nHeight = 1;\r\n#endif  \r\n  }\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Allocate a new expression node from a zero-terminated token that has\r\n** already been dequoted.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3Expr(\r\n  sqlite3 *db,            /* Handle for sqlite3DbMallocZero() (may be null) */\r\n  int op,                 /* Expression opcode */\r\n  const char *zToken      /* Token argument.  Might be NULL */\r\n){\r\n  Token x;\r\n  x.z = zToken;\r\n  x.n = zToken ? sqlite3Strlen30(zToken) : 0;\r\n  return sqlite3ExprAlloc(db, op, &x, 0);\r\n}\r\n\r\n/*\r\n** Attach subtrees pLeft and pRight to the Expr node pRoot.\r\n**\r\n** If pRoot==NULL that means that a memory allocation error has occurred.\r\n** In that case, delete the subtrees pLeft and pRight.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprAttachSubtrees(\r\n  sqlite3 *db,\r\n  Expr *pRoot,\r\n  Expr *pLeft,\r\n  Expr *pRight\r\n){\r\n  if( pRoot==0 ){\r\n    assert( db->mallocFailed );\r\n    sqlite3ExprDelete(db, pLeft);\r\n    sqlite3ExprDelete(db, pRight);\r\n  }else{\r\n    if( pRight ){\r\n      pRoot->pRight = pRight;\r\n      if( pRight->flags & EP_ExpCollate ){\r\n        pRoot->flags |= EP_ExpCollate;\r\n        pRoot->pColl = pRight->pColl;\r\n      }\r\n    }\r\n    if( pLeft ){\r\n      pRoot->pLeft = pLeft;\r\n      if( pLeft->flags & EP_ExpCollate ){\r\n        pRoot->flags |= EP_ExpCollate;\r\n        pRoot->pColl = pLeft->pColl;\r\n      }\r\n    }\r\n    exprSetHeight(pRoot);\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate a Expr node which joins as many as two subtrees.\r\n**\r\n** One or both of the subtrees can be NULL.  Return a pointer to the new\r\n** Expr node.  Or, if an OOM error occurs, set pParse->db->mallocFailed,\r\n** free the subtrees and return NULL.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3PExpr(\r\n  Parse *pParse,          /* Parsing context */\r\n  int op,                 /* Expression opcode */\r\n  Expr *pLeft,            /* Left operand */\r\n  Expr *pRight,           /* Right operand */\r\n  const Token *pToken     /* Argument token */\r\n){\r\n  Expr *p = sqlite3ExprAlloc(pParse->db, op, pToken, 1);\r\n  sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);\r\n  if( p ) {\r\n    sqlite3ExprCheckHeight(pParse, p->nHeight);\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Join two expressions using an AND operator.  If either expression is\r\n** NULL, then just return the other expression.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){\r\n  if( pLeft==0 ){\r\n    return pRight;\r\n  }else if( pRight==0 ){\r\n    return pLeft;\r\n  }else{\r\n    Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);\r\n    sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);\r\n    return pNew;\r\n  }\r\n}\r\n\r\n/*\r\n** Construct a new expression node for a function with multiple\r\n** arguments.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){\r\n  Expr *pNew;\r\n  sqlite3 *db = pParse->db;\r\n  assert( pToken );\r\n  pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);\r\n  if( pNew==0 ){\r\n    sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */\r\n    return 0;\r\n  }\r\n  pNew->x.pList = pList;\r\n  assert( !ExprHasProperty(pNew, EP_xIsSelect) );\r\n  sqlite3ExprSetHeight(pParse, pNew);\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Assign a variable number to an expression that encodes a wildcard\r\n** in the original SQL statement.  \r\n**\r\n** Wildcards consisting of a single \"?\" are assigned the next sequential\r\n** variable number.\r\n**\r\n** Wildcards of the form \"?nnn\" are assigned the number \"nnn\".  We make\r\n** sure \"nnn\" is not too be to avoid a denial of service attack when\r\n** the SQL statement comes from an external source.\r\n**\r\n** Wildcards of the form \":aaa\", \"@aaa\", or \"$aaa\" are assigned the same number\r\n** as the previous instance of the same wildcard.  Or if this is the first\r\n** instance of the wildcard, the next sequenial variable number is\r\n** assigned.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){\r\n  sqlite3 *db = pParse->db;\r\n  const char *z;\r\n\r\n  if( pExpr==0 ) return;\r\n  assert( !ExprHasAnyProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );\r\n  z = pExpr->u.zToken;\r\n  assert( z!=0 );\r\n  assert( z[0]!=0 );\r\n  if( z[1]==0 ){\r\n    /* Wildcard of the form \"?\".  Assign the next variable number */\r\n    assert( z[0]=='?' );\r\n    pExpr->iColumn = (ynVar)(++pParse->nVar);\r\n  }else{\r\n    ynVar x = 0;\r\n    u32 n = sqlite3Strlen30(z);\r\n    if( z[0]=='?' ){\r\n      /* Wildcard of the form \"?nnn\".  Convert \"nnn\" to an integer and\r\n      ** use it as the variable number */\r\n      i64 i;\r\n      int bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);\r\n      pExpr->iColumn = x = (ynVar)i;\r\n      testcase( i==0 );\r\n      testcase( i==1 );\r\n      testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );\r\n      testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );\r\n      if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){\r\n        sqlite3ErrorMsg(pParse, \"variable number must be between ?1 and ?%d\",\r\n            db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);\r\n        x = 0;\r\n      }\r\n      if( i>pParse->nVar ){\r\n        pParse->nVar = (int)i;\r\n      }\r\n    }else{\r\n      /* Wildcards like \":aaa\", \"$aaa\" or \"@aaa\".  Reuse the same variable\r\n      ** number as the prior appearance of the same name, or if the name\r\n      ** has never appeared before, reuse the same variable number\r\n      */\r\n      ynVar i;\r\n      for(i=0; i<pParse->nzVar; i++){\r\n        if( pParse->azVar[i] && memcmp(pParse->azVar[i],z,n+1)==0 ){\r\n          pExpr->iColumn = x = (ynVar)i+1;\r\n          break;\r\n        }\r\n      }\r\n      if( x==0 ) x = pExpr->iColumn = (ynVar)(++pParse->nVar);\r\n    }\r\n    if( x>0 ){\r\n      if( x>pParse->nzVar ){\r\n        char **a;\r\n        a = sqlite3DbRealloc(db, pParse->azVar, x*sizeof(a[0]));\r\n        if( a==0 ) return;  /* Error reported through db->mallocFailed */\r\n        pParse->azVar = a;\r\n        memset(&a[pParse->nzVar], 0, (x-pParse->nzVar)*sizeof(a[0]));\r\n        pParse->nzVar = x;\r\n      }\r\n      if( z[0]!='?' || pParse->azVar[x-1]==0 ){\r\n        sqlite3DbFree(db, pParse->azVar[x-1]);\r\n        pParse->azVar[x-1] = sqlite3DbStrNDup(db, z, n);\r\n      }\r\n    }\r\n  } \r\n  if( !pParse->nErr && pParse->nVar>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){\r\n    sqlite3ErrorMsg(pParse, \"too many SQL variables\");\r\n  }\r\n}\r\n\r\n/*\r\n** Recursively delete an expression tree.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){\r\n  if( p==0 ) return;\r\n  /* Sanity check: Assert that the IntValue is non-negative if it exists */\r\n  assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 );\r\n  if( !ExprHasAnyProperty(p, EP_TokenOnly) ){\r\n    sqlite3ExprDelete(db, p->pLeft);\r\n    sqlite3ExprDelete(db, p->pRight);\r\n    if( !ExprHasProperty(p, EP_Reduced) && (p->flags2 & EP2_MallocedToken)!=0 ){\r\n      sqlite3DbFree(db, p->u.zToken);\r\n    }\r\n    if( ExprHasProperty(p, EP_xIsSelect) ){\r\n      sqlite3SelectDelete(db, p->x.pSelect);\r\n    }else{\r\n      sqlite3ExprListDelete(db, p->x.pList);\r\n    }\r\n  }\r\n  if( !ExprHasProperty(p, EP_Static) ){\r\n    sqlite3DbFree(db, p);\r\n  }\r\n}\r\n\r\n/*\r\n** Return the number of bytes allocated for the expression structure \r\n** passed as the first argument. This is always one of EXPR_FULLSIZE,\r\n** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.\r\n*/\r\nstatic int exprStructSize(Expr *p){\r\n  if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE;\r\n  if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE;\r\n  return EXPR_FULLSIZE;\r\n}\r\n\r\n/*\r\n** The dupedExpr*Size() routines each return the number of bytes required\r\n** to store a copy of an expression or expression tree.  They differ in\r\n** how much of the tree is measured.\r\n**\r\n**     dupedExprStructSize()     Size of only the Expr structure \r\n**     dupedExprNodeSize()       Size of Expr + space for token\r\n**     dupedExprSize()           Expr + token + subtree components\r\n**\r\n***************************************************************************\r\n**\r\n** The dupedExprStructSize() function returns two values OR-ed together:  \r\n** (1) the space required for a copy of the Expr structure only and \r\n** (2) the EP_xxx flags that indicate what the structure size should be.\r\n** The return values is always one of:\r\n**\r\n**      EXPR_FULLSIZE\r\n**      EXPR_REDUCEDSIZE   | EP_Reduced\r\n**      EXPR_TOKENONLYSIZE | EP_TokenOnly\r\n**\r\n** The size of the structure can be found by masking the return value\r\n** of this routine with 0xfff.  The flags can be found by masking the\r\n** return value with EP_Reduced|EP_TokenOnly.\r\n**\r\n** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size\r\n** (unreduced) Expr objects as they or originally constructed by the parser.\r\n** During expression analysis, extra information is computed and moved into\r\n** later parts of teh Expr object and that extra information might get chopped\r\n** off if the expression is reduced.  Note also that it does not work to\r\n** make a EXPRDUP_REDUCE copy of a reduced expression.  It is only legal\r\n** to reduce a pristine expression tree from the parser.  The implementation\r\n** of dupedExprStructSize() contain multiple assert() statements that attempt\r\n** to enforce this constraint.\r\n*/\r\nstatic int dupedExprStructSize(Expr *p, int flags){\r\n  int nSize;\r\n  assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */\r\n  if( 0==(flags&EXPRDUP_REDUCE) ){\r\n    nSize = EXPR_FULLSIZE;\r\n  }else{\r\n    assert( !ExprHasAnyProperty(p, EP_TokenOnly|EP_Reduced) );\r\n    assert( !ExprHasProperty(p, EP_FromJoin) ); \r\n    assert( (p->flags2 & EP2_MallocedToken)==0 );\r\n    assert( (p->flags2 & EP2_Irreducible)==0 );\r\n    if( p->pLeft || p->pRight || p->pColl || p->x.pList ){\r\n      nSize = EXPR_REDUCEDSIZE | EP_Reduced;\r\n    }else{\r\n      nSize = EXPR_TOKENONLYSIZE | EP_TokenOnly;\r\n    }\r\n  }\r\n  return nSize;\r\n}\r\n\r\n/*\r\n** This function returns the space in bytes required to store the copy \r\n** of the Expr structure and a copy of the Expr.u.zToken string (if that\r\n** string is defined.)\r\n*/\r\nstatic int dupedExprNodeSize(Expr *p, int flags){\r\n  int nByte = dupedExprStructSize(p, flags) & 0xfff;\r\n  if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){\r\n    nByte += sqlite3Strlen30(p->u.zToken)+1;\r\n  }\r\n  return ROUND8(nByte);\r\n}\r\n\r\n/*\r\n** Return the number of bytes required to create a duplicate of the \r\n** expression passed as the first argument. The second argument is a\r\n** mask containing EXPRDUP_XXX flags.\r\n**\r\n** The value returned includes space to create a copy of the Expr struct\r\n** itself and the buffer referred to by Expr.u.zToken, if any.\r\n**\r\n** If the EXPRDUP_REDUCE flag is set, then the return value includes \r\n** space to duplicate all Expr nodes in the tree formed by Expr.pLeft \r\n** and Expr.pRight variables (but not for any structures pointed to or \r\n** descended from the Expr.x.pList or Expr.x.pSelect variables).\r\n*/\r\nstatic int dupedExprSize(Expr *p, int flags){\r\n  int nByte = 0;\r\n  if( p ){\r\n    nByte = dupedExprNodeSize(p, flags);\r\n    if( flags&EXPRDUP_REDUCE ){\r\n      nByte += dupedExprSize(p->pLeft, flags) + dupedExprSize(p->pRight, flags);\r\n    }\r\n  }\r\n  return nByte;\r\n}\r\n\r\n/*\r\n** This function is similar to sqlite3ExprDup(), except that if pzBuffer \r\n** is not NULL then *pzBuffer is assumed to point to a buffer large enough \r\n** to store the copy of expression p, the copies of p->u.zToken\r\n** (if applicable), and the copies of the p->pLeft and p->pRight expressions,\r\n** if any. Before returning, *pzBuffer is set to the first byte passed the\r\n** portion of the buffer copied into by this function.\r\n*/\r\nstatic Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){\r\n  Expr *pNew = 0;                      /* Value to return */\r\n  if( p ){\r\n    const int isReduced = (flags&EXPRDUP_REDUCE);\r\n    u8 *zAlloc;\r\n    u32 staticFlag = 0;\r\n\r\n    assert( pzBuffer==0 || isReduced );\r\n\r\n    /* Figure out where to write the new Expr structure. */\r\n    if( pzBuffer ){\r\n      zAlloc = *pzBuffer;\r\n      staticFlag = EP_Static;\r\n    }else{\r\n      zAlloc = sqlite3DbMallocRaw(db, dupedExprSize(p, flags));\r\n    }\r\n    pNew = (Expr *)zAlloc;\r\n\r\n    if( pNew ){\r\n      /* Set nNewSize to the size allocated for the structure pointed to\r\n      ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or\r\n      ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed\r\n      ** by the copy of the p->u.zToken string (if any).\r\n      */\r\n      const unsigned nStructSize = dupedExprStructSize(p, flags);\r\n      const int nNewSize = nStructSize & 0xfff;\r\n      int nToken;\r\n      if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){\r\n        nToken = sqlite3Strlen30(p->u.zToken) + 1;\r\n      }else{\r\n        nToken = 0;\r\n      }\r\n      if( isReduced ){\r\n        assert( ExprHasProperty(p, EP_Reduced)==0 );\r\n        memcpy(zAlloc, p, nNewSize);\r\n      }else{\r\n        int nSize = exprStructSize(p);\r\n        memcpy(zAlloc, p, nSize);\r\n        memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);\r\n      }\r\n\r\n      /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */\r\n      pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static);\r\n      pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly);\r\n      pNew->flags |= staticFlag;\r\n\r\n      /* Copy the p->u.zToken string, if any. */\r\n      if( nToken ){\r\n        char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize];\r\n        memcpy(zToken, p->u.zToken, nToken);\r\n      }\r\n\r\n      if( 0==((p->flags|pNew->flags) & EP_TokenOnly) ){\r\n        /* Fill in the pNew->x.pSelect or pNew->x.pList member. */\r\n        if( ExprHasProperty(p, EP_xIsSelect) ){\r\n          pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, isReduced);\r\n        }else{\r\n          pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, isReduced);\r\n        }\r\n      }\r\n\r\n      /* Fill in pNew->pLeft and pNew->pRight. */\r\n      if( ExprHasAnyProperty(pNew, EP_Reduced|EP_TokenOnly) ){\r\n        zAlloc += dupedExprNodeSize(p, flags);\r\n        if( ExprHasProperty(pNew, EP_Reduced) ){\r\n          pNew->pLeft = exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc);\r\n          pNew->pRight = exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc);\r\n        }\r\n        if( pzBuffer ){\r\n          *pzBuffer = zAlloc;\r\n        }\r\n      }else{\r\n        pNew->flags2 = 0;\r\n        if( !ExprHasAnyProperty(p, EP_TokenOnly) ){\r\n          pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);\r\n          pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);\r\n        }\r\n      }\r\n\r\n    }\r\n  }\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** The following group of routines make deep copies of expressions,\r\n** expression lists, ID lists, and select statements.  The copies can\r\n** be deleted (by being passed to their respective ...Delete() routines)\r\n** without effecting the originals.\r\n**\r\n** The expression list, ID, and source lists return by sqlite3ExprListDup(),\r\n** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded \r\n** by subsequent calls to sqlite*ListAppend() routines.\r\n**\r\n** Any tables that the SrcList might point to are not duplicated.\r\n**\r\n** The flags parameter contains a combination of the EXPRDUP_XXX flags.\r\n** If the EXPRDUP_REDUCE flag is set, then the structure returned is a\r\n** truncated version of the usual Expr structure that will be stored as\r\n** part of the in-memory representation of the database schema.\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){\r\n  return exprDup(db, p, flags, 0);\r\n}\r\nSQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){\r\n  ExprList *pNew;\r\n  struct ExprList_item *pItem, *pOldItem;\r\n  int i;\r\n  if( p==0 ) return 0;\r\n  pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );\r\n  if( pNew==0 ) return 0;\r\n  pNew->iECursor = 0;\r\n  pNew->nExpr = i = p->nExpr;\r\n  if( (flags & EXPRDUP_REDUCE)==0 ) for(i=1; i<p->nExpr; i+=i){}\r\n  pNew->a = pItem = sqlite3DbMallocRaw(db,  i*sizeof(p->a[0]) );\r\n  if( pItem==0 ){\r\n    sqlite3DbFree(db, pNew);\r\n    return 0;\r\n  } \r\n  pOldItem = p->a;\r\n  for(i=0; i<p->nExpr; i++, pItem++, pOldItem++){\r\n    Expr *pOldExpr = pOldItem->pExpr;\r\n    pItem->pExpr = sqlite3ExprDup(db, pOldExpr, flags);\r\n    pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);\r\n    pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);\r\n    pItem->sortOrder = pOldItem->sortOrder;\r\n    pItem->done = 0;\r\n    pItem->iOrderByCol = pOldItem->iOrderByCol;\r\n    pItem->iAlias = pOldItem->iAlias;\r\n  }\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** If cursors, triggers, views and subqueries are all omitted from\r\n** the build, then none of the following routines, except for \r\n** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes\r\n** called with a NULL argument.\r\n*/\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \\\r\n || !defined(SQLITE_OMIT_SUBQUERY)\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){\r\n  SrcList *pNew;\r\n  int i;\r\n  int nByte;\r\n  if( p==0 ) return 0;\r\n  nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);\r\n  pNew = sqlite3DbMallocRaw(db, nByte );\r\n  if( pNew==0 ) return 0;\r\n  pNew->nSrc = pNew->nAlloc = p->nSrc;\r\n  for(i=0; i<p->nSrc; i++){\r\n    struct SrcList_item *pNewItem = &pNew->a[i];\r\n    struct SrcList_item *pOldItem = &p->a[i];\r\n    Table *pTab;\r\n    pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);\r\n    pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);\r\n    pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);\r\n    pNewItem->jointype = pOldItem->jointype;\r\n    pNewItem->iCursor = pOldItem->iCursor;\r\n    pNewItem->addrFillSub = pOldItem->addrFillSub;\r\n    pNewItem->regReturn = pOldItem->regReturn;\r\n    pNewItem->isCorrelated = pOldItem->isCorrelated;\r\n    pNewItem->zIndex = sqlite3DbStrDup(db, pOldItem->zIndex);\r\n    pNewItem->notIndexed = pOldItem->notIndexed;\r\n    pNewItem->pIndex = pOldItem->pIndex;\r\n    pTab = pNewItem->pTab = pOldItem->pTab;\r\n    if( pTab ){\r\n      pTab->nRef++;\r\n    }\r\n    pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect, flags);\r\n    pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn, flags);\r\n    pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing);\r\n    pNewItem->colUsed = pOldItem->colUsed;\r\n  }\r\n  return pNew;\r\n}\r\nSQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){\r\n  IdList *pNew;\r\n  int i;\r\n  if( p==0 ) return 0;\r\n  pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );\r\n  if( pNew==0 ) return 0;\r\n  pNew->nId = p->nId;\r\n  pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) );\r\n  if( pNew->a==0 ){\r\n    sqlite3DbFree(db, pNew);\r\n    return 0;\r\n  }\r\n  /* Note that because the size of the allocation for p->a[] is not\r\n  ** necessarily a power of two, sqlite3IdListAppend() may not be called\r\n  ** on the duplicate created by this function. */\r\n  for(i=0; i<p->nId; i++){\r\n    struct IdList_item *pNewItem = &pNew->a[i];\r\n    struct IdList_item *pOldItem = &p->a[i];\r\n    pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);\r\n    pNewItem->idx = pOldItem->idx;\r\n  }\r\n  return pNew;\r\n}\r\nSQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){\r\n  Select *pNew, *pPrior;\r\n  if( p==0 ) return 0;\r\n  pNew = sqlite3DbMallocRaw(db, sizeof(*p) );\r\n  if( pNew==0 ) return 0;\r\n  pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags);\r\n  pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);\r\n  pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags);\r\n  pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags);\r\n  pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags);\r\n  pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags);\r\n  pNew->op = p->op;\r\n  pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags);\r\n  if( pPrior ) pPrior->pNext = pNew;\r\n  pNew->pNext = 0;\r\n  pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags);\r\n  pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags);\r\n  pNew->iLimit = 0;\r\n  pNew->iOffset = 0;\r\n  pNew->selFlags = p->selFlags & ~SF_UsesEphemeral;\r\n  pNew->pRightmost = 0;\r\n  pNew->addrOpenEphm[0] = -1;\r\n  pNew->addrOpenEphm[1] = -1;\r\n  pNew->addrOpenEphm[2] = -1;\r\n  return pNew;\r\n}\r\n#else\r\nSQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){\r\n  assert( p==0 );\r\n  return 0;\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Add a new element to the end of an expression list.  If pList is\r\n** initially NULL, then create a new expression list.\r\n**\r\n** If a memory allocation error occurs, the entire list is freed and\r\n** NULL is returned.  If non-NULL is returned, then it is guaranteed\r\n** that the new entry was successfully appended.\r\n*/\r\nSQLITE_PRIVATE ExprList *sqlite3ExprListAppend(\r\n  Parse *pParse,          /* Parsing context */\r\n  ExprList *pList,        /* List to which to append. Might be NULL */\r\n  Expr *pExpr             /* Expression to be appended. Might be NULL */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n  if( pList==0 ){\r\n    pList = sqlite3DbMallocZero(db, sizeof(ExprList) );\r\n    if( pList==0 ){\r\n      goto no_mem;\r\n    }\r\n    pList->a = sqlite3DbMallocRaw(db, sizeof(pList->a[0]));\r\n    if( pList->a==0 ) goto no_mem;\r\n  }else if( (pList->nExpr & (pList->nExpr-1))==0 ){\r\n    struct ExprList_item *a;\r\n    assert( pList->nExpr>0 );\r\n    a = sqlite3DbRealloc(db, pList->a, pList->nExpr*2*sizeof(pList->a[0]));\r\n    if( a==0 ){\r\n      goto no_mem;\r\n    }\r\n    pList->a = a;\r\n  }\r\n  assert( pList->a!=0 );\r\n  if( 1 ){\r\n    struct ExprList_item *pItem = &pList->a[pList->nExpr++];\r\n    memset(pItem, 0, sizeof(*pItem));\r\n    pItem->pExpr = pExpr;\r\n  }\r\n  return pList;\r\n\r\nno_mem:     \r\n  /* Avoid leaking memory if malloc has failed. */\r\n  sqlite3ExprDelete(db, pExpr);\r\n  sqlite3ExprListDelete(db, pList);\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Set the ExprList.a[].zName element of the most recently added item\r\n** on the expression list.\r\n**\r\n** pList might be NULL following an OOM error.  But pName should never be\r\n** NULL.  If a memory allocation fails, the pParse->db->mallocFailed flag\r\n** is set.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprListSetName(\r\n  Parse *pParse,          /* Parsing context */\r\n  ExprList *pList,        /* List to which to add the span. */\r\n  Token *pName,           /* Name to be added */\r\n  int dequote             /* True to cause the name to be dequoted */\r\n){\r\n  assert( pList!=0 || pParse->db->mallocFailed!=0 );\r\n  if( pList ){\r\n    struct ExprList_item *pItem;\r\n    assert( pList->nExpr>0 );\r\n    pItem = &pList->a[pList->nExpr-1];\r\n    assert( pItem->zName==0 );\r\n    pItem->zName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n);\r\n    if( dequote && pItem->zName ) sqlite3Dequote(pItem->zName);\r\n  }\r\n}\r\n\r\n/*\r\n** Set the ExprList.a[].zSpan element of the most recently added item\r\n** on the expression list.\r\n**\r\n** pList might be NULL following an OOM error.  But pSpan should never be\r\n** NULL.  If a memory allocation fails, the pParse->db->mallocFailed flag\r\n** is set.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprListSetSpan(\r\n  Parse *pParse,          /* Parsing context */\r\n  ExprList *pList,        /* List to which to add the span. */\r\n  ExprSpan *pSpan         /* The span to be added */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n  assert( pList!=0 || db->mallocFailed!=0 );\r\n  if( pList ){\r\n    struct ExprList_item *pItem = &pList->a[pList->nExpr-1];\r\n    assert( pList->nExpr>0 );\r\n    assert( db->mallocFailed || pItem->pExpr==pSpan->pExpr );\r\n    sqlite3DbFree(db, pItem->zSpan);\r\n    pItem->zSpan = sqlite3DbStrNDup(db, (char*)pSpan->zStart,\r\n                                    (int)(pSpan->zEnd - pSpan->zStart));\r\n  }\r\n}\r\n\r\n/*\r\n** If the expression list pEList contains more than iLimit elements,\r\n** leave an error message in pParse.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprListCheckLength(\r\n  Parse *pParse,\r\n  ExprList *pEList,\r\n  const char *zObject\r\n){\r\n  int mx = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];\r\n  testcase( pEList && pEList->nExpr==mx );\r\n  testcase( pEList && pEList->nExpr==mx+1 );\r\n  if( pEList && pEList->nExpr>mx ){\r\n    sqlite3ErrorMsg(pParse, \"too many columns in %s\", zObject);\r\n  }\r\n}\r\n\r\n/*\r\n** Delete an entire expression list.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){\r\n  int i;\r\n  struct ExprList_item *pItem;\r\n  if( pList==0 ) return;\r\n  assert( pList->a!=0 || pList->nExpr==0 );\r\n  for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){\r\n    sqlite3ExprDelete(db, pItem->pExpr);\r\n    sqlite3DbFree(db, pItem->zName);\r\n    sqlite3DbFree(db, pItem->zSpan);\r\n  }\r\n  sqlite3DbFree(db, pList->a);\r\n  sqlite3DbFree(db, pList);\r\n}\r\n\r\n/*\r\n** These routines are Walker callbacks.  Walker.u.pi is a pointer\r\n** to an integer.  These routines are checking an expression to see\r\n** if it is a constant.  Set *Walker.u.pi to 0 if the expression is\r\n** not constant.\r\n**\r\n** These callback routines are used to implement the following:\r\n**\r\n**     sqlite3ExprIsConstant()\r\n**     sqlite3ExprIsConstantNotJoin()\r\n**     sqlite3ExprIsConstantOrFunction()\r\n**\r\n*/\r\nstatic int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){\r\n\r\n  /* If pWalker->u.i is 3 then any term of the expression that comes from\r\n  ** the ON or USING clauses of a join disqualifies the expression\r\n  ** from being considered constant. */\r\n  if( pWalker->u.i==3 && ExprHasAnyProperty(pExpr, EP_FromJoin) ){\r\n    pWalker->u.i = 0;\r\n    return WRC_Abort;\r\n  }\r\n\r\n  switch( pExpr->op ){\r\n    /* Consider functions to be constant if all their arguments are constant\r\n    ** and pWalker->u.i==2 */\r\n    case TK_FUNCTION:\r\n      if( pWalker->u.i==2 ) return 0;\r\n      /* Fall through */\r\n    case TK_ID:\r\n    case TK_COLUMN:\r\n    case TK_AGG_FUNCTION:\r\n    case TK_AGG_COLUMN:\r\n      testcase( pExpr->op==TK_ID );\r\n      testcase( pExpr->op==TK_COLUMN );\r\n      testcase( pExpr->op==TK_AGG_FUNCTION );\r\n      testcase( pExpr->op==TK_AGG_COLUMN );\r\n      pWalker->u.i = 0;\r\n      return WRC_Abort;\r\n    default:\r\n      testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */\r\n      testcase( pExpr->op==TK_EXISTS ); /* selectNodeIsConstant will disallow */\r\n      return WRC_Continue;\r\n  }\r\n}\r\nstatic int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){\r\n  UNUSED_PARAMETER(NotUsed);\r\n  pWalker->u.i = 0;\r\n  return WRC_Abort;\r\n}\r\nstatic int exprIsConst(Expr *p, int initFlag){\r\n  Walker w;\r\n  w.u.i = initFlag;\r\n  w.xExprCallback = exprNodeIsConstant;\r\n  w.xSelectCallback = selectNodeIsConstant;\r\n  sqlite3WalkExpr(&w, p);\r\n  return w.u.i;\r\n}\r\n\r\n/*\r\n** Walk an expression tree.  Return 1 if the expression is constant\r\n** and 0 if it involves variables or function calls.\r\n**\r\n** For the purposes of this function, a double-quoted string (ex: \"abc\")\r\n** is considered a variable but a single-quoted string (ex: 'abc') is\r\n** a constant.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){\r\n  return exprIsConst(p, 1);\r\n}\r\n\r\n/*\r\n** Walk an expression tree.  Return 1 if the expression is constant\r\n** that does no originate from the ON or USING clauses of a join.\r\n** Return 0 if it involves variables or function calls or terms from\r\n** an ON or USING clause.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){\r\n  return exprIsConst(p, 3);\r\n}\r\n\r\n/*\r\n** Walk an expression tree.  Return 1 if the expression is constant\r\n** or a function call with constant arguments.  Return and 0 if there\r\n** are any variables.\r\n**\r\n** For the purposes of this function, a double-quoted string (ex: \"abc\")\r\n** is considered a variable but a single-quoted string (ex: 'abc') is\r\n** a constant.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p){\r\n  return exprIsConst(p, 2);\r\n}\r\n\r\n/*\r\n** If the expression p codes a constant integer that is small enough\r\n** to fit in a 32-bit integer, return 1 and put the value of the integer\r\n** in *pValue.  If the expression is not an integer or if it is too big\r\n** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){\r\n  int rc = 0;\r\n\r\n  /* If an expression is an integer literal that fits in a signed 32-bit\r\n  ** integer, then the EP_IntValue flag will have already been set */\r\n  assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0\r\n           || sqlite3GetInt32(p->u.zToken, &rc)==0 );\r\n\r\n  if( p->flags & EP_IntValue ){\r\n    *pValue = p->u.iValue;\r\n    return 1;\r\n  }\r\n  switch( p->op ){\r\n    case TK_UPLUS: {\r\n      rc = sqlite3ExprIsInteger(p->pLeft, pValue);\r\n      break;\r\n    }\r\n    case TK_UMINUS: {\r\n      int v;\r\n      if( sqlite3ExprIsInteger(p->pLeft, &v) ){\r\n        *pValue = -v;\r\n        rc = 1;\r\n      }\r\n      break;\r\n    }\r\n    default: break;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return FALSE if there is no chance that the expression can be NULL.\r\n**\r\n** If the expression might be NULL or if the expression is too complex\r\n** to tell return TRUE.  \r\n**\r\n** This routine is used as an optimization, to skip OP_IsNull opcodes\r\n** when we know that a value cannot be NULL.  Hence, a false positive\r\n** (returning TRUE when in fact the expression can never be NULL) might\r\n** be a small performance hit but is otherwise harmless.  On the other\r\n** hand, a false negative (returning FALSE when the result could be NULL)\r\n** will likely result in an incorrect answer.  So when in doubt, return\r\n** TRUE.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){\r\n  u8 op;\r\n  while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }\r\n  op = p->op;\r\n  if( op==TK_REGISTER ) op = p->op2;\r\n  switch( op ){\r\n    case TK_INTEGER:\r\n    case TK_STRING:\r\n    case TK_FLOAT:\r\n    case TK_BLOB:\r\n      return 0;\r\n    default:\r\n      return 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Generate an OP_IsNull instruction that tests register iReg and jumps\r\n** to location iDest if the value in iReg is NULL.  The value in iReg \r\n** was computed by pExpr.  If we can look at pExpr at compile-time and\r\n** determine that it can never generate a NULL, then the OP_IsNull operation\r\n** can be omitted.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCodeIsNullJump(\r\n  Vdbe *v,            /* The VDBE under construction */\r\n  const Expr *pExpr,  /* Only generate OP_IsNull if this expr can be NULL */\r\n  int iReg,           /* Test the value in this register for NULL */\r\n  int iDest           /* Jump here if the value is null */\r\n){\r\n  if( sqlite3ExprCanBeNull(pExpr) ){\r\n    sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iDest);\r\n  }\r\n}\r\n\r\n/*\r\n** Return TRUE if the given expression is a constant which would be\r\n** unchanged by OP_Affinity with the affinity given in the second\r\n** argument.\r\n**\r\n** This routine is used to determine if the OP_Affinity operation\r\n** can be omitted.  When in doubt return FALSE.  A false negative\r\n** is harmless.  A false positive, however, can result in the wrong\r\n** answer.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){\r\n  u8 op;\r\n  if( aff==SQLITE_AFF_NONE ) return 1;\r\n  while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }\r\n  op = p->op;\r\n  if( op==TK_REGISTER ) op = p->op2;\r\n  switch( op ){\r\n    case TK_INTEGER: {\r\n      return aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC;\r\n    }\r\n    case TK_FLOAT: {\r\n      return aff==SQLITE_AFF_REAL || aff==SQLITE_AFF_NUMERIC;\r\n    }\r\n    case TK_STRING: {\r\n      return aff==SQLITE_AFF_TEXT;\r\n    }\r\n    case TK_BLOB: {\r\n      return 1;\r\n    }\r\n    case TK_COLUMN: {\r\n      assert( p->iTable>=0 );  /* p cannot be part of a CHECK constraint */\r\n      return p->iColumn<0\r\n          && (aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC);\r\n    }\r\n    default: {\r\n      return 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Return TRUE if the given string is a row-id column name.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IsRowid(const char *z){\r\n  if( sqlite3StrICmp(z, \"_ROWID_\")==0 ) return 1;\r\n  if( sqlite3StrICmp(z, \"ROWID\")==0 ) return 1;\r\n  if( sqlite3StrICmp(z, \"OID\")==0 ) return 1;\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return true if we are able to the IN operator optimization on a\r\n** query of the form\r\n**\r\n**       x IN (SELECT ...)\r\n**\r\n** Where the SELECT... clause is as specified by the parameter to this\r\n** routine.\r\n**\r\n** The Select object passed in has already been preprocessed and no\r\n** errors have been found.\r\n*/\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\nstatic int isCandidateForInOpt(Select *p){\r\n  SrcList *pSrc;\r\n  ExprList *pEList;\r\n  Table *pTab;\r\n  if( p==0 ) return 0;                   /* right-hand side of IN is SELECT */\r\n  if( p->pPrior ) return 0;              /* Not a compound SELECT */\r\n  if( p->selFlags & (SF_Distinct|SF_Aggregate) ){\r\n    testcase( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\r\n    testcase( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\r\n    return 0; /* No DISTINCT keyword and no aggregate functions */\r\n  }\r\n  assert( p->pGroupBy==0 );              /* Has no GROUP BY clause */\r\n  if( p->pLimit ) return 0;              /* Has no LIMIT clause */\r\n  assert( p->pOffset==0 );               /* No LIMIT means no OFFSET */\r\n  if( p->pWhere ) return 0;              /* Has no WHERE clause */\r\n  pSrc = p->pSrc;\r\n  assert( pSrc!=0 );\r\n  if( pSrc->nSrc!=1 ) return 0;          /* Single term in FROM clause */\r\n  if( pSrc->a[0].pSelect ) return 0;     /* FROM is not a subquery or view */\r\n  pTab = pSrc->a[0].pTab;\r\n  if( NEVER(pTab==0) ) return 0;\r\n  assert( pTab->pSelect==0 );            /* FROM clause is not a view */\r\n  if( IsVirtual(pTab) ) return 0;        /* FROM clause not a virtual table */\r\n  pEList = p->pEList;\r\n  if( pEList->nExpr!=1 ) return 0;       /* One column in the result set */\r\n  if( pEList->a[0].pExpr->op!=TK_COLUMN ) return 0; /* Result is a column */\r\n  return 1;\r\n}\r\n#endif /* SQLITE_OMIT_SUBQUERY */\r\n\r\n/*\r\n** Code an OP_Once instruction and allocate space for its flag. Return the \r\n** address of the new instruction.\r\n*/\r\nSQLITE_PRIVATE int sqlite3CodeOnce(Parse *pParse){\r\n  Vdbe *v = sqlite3GetVdbe(pParse);      /* Virtual machine being coded */\r\n  return sqlite3VdbeAddOp1(v, OP_Once, pParse->nOnce++);\r\n}\r\n\r\n/*\r\n** This function is used by the implementation of the IN (...) operator.\r\n** It's job is to find or create a b-tree structure that may be used\r\n** either to test for membership of the (...) set or to iterate through\r\n** its members, skipping duplicates.\r\n**\r\n** The index of the cursor opened on the b-tree (database table, database index \r\n** or ephermal table) is stored in pX->iTable before this function returns.\r\n** The returned value of this function indicates the b-tree type, as follows:\r\n**\r\n**   IN_INDEX_ROWID - The cursor was opened on a database table.\r\n**   IN_INDEX_INDEX - The cursor was opened on a database index.\r\n**   IN_INDEX_EPH -   The cursor was opened on a specially created and\r\n**                    populated epheremal table.\r\n**\r\n** An existing b-tree may only be used if the SELECT is of the simple\r\n** form:\r\n**\r\n**     SELECT <column> FROM <table>\r\n**\r\n** If the prNotFound parameter is 0, then the b-tree will be used to iterate\r\n** through the set members, skipping any duplicates. In this case an\r\n** epheremal table must be used unless the selected <column> is guaranteed\r\n** to be unique - either because it is an INTEGER PRIMARY KEY or it\r\n** has a UNIQUE constraint or UNIQUE index.\r\n**\r\n** If the prNotFound parameter is not 0, then the b-tree will be used \r\n** for fast set membership tests. In this case an epheremal table must \r\n** be used unless <column> is an INTEGER PRIMARY KEY or an index can \r\n** be found with <column> as its left-most column.\r\n**\r\n** When the b-tree is being used for membership tests, the calling function\r\n** needs to know whether or not the structure contains an SQL NULL \r\n** value in order to correctly evaluate expressions like \"X IN (Y, Z)\".\r\n** If there is any chance that the (...) might contain a NULL value at\r\n** runtime, then a register is allocated and the register number written\r\n** to *prNotFound. If there is no chance that the (...) contains a\r\n** NULL value, then *prNotFound is left unchanged.\r\n**\r\n** If a register is allocated and its location stored in *prNotFound, then\r\n** its initial value is NULL.  If the (...) does not remain constant\r\n** for the duration of the query (i.e. the SELECT within the (...)\r\n** is a correlated subquery) then the value of the allocated register is\r\n** reset to NULL each time the subquery is rerun. This allows the\r\n** caller to use vdbe code equivalent to the following:\r\n**\r\n**   if( register==NULL ){\r\n**     has_null = <test if data structure contains null>\r\n**     register = 1\r\n**   }\r\n**\r\n** in order to avoid running the <test if data structure contains null>\r\n** test more often than is necessary.\r\n*/\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\nSQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){\r\n  Select *p;                            /* SELECT to the right of IN operator */\r\n  int eType = 0;                        /* Type of RHS table. IN_INDEX_* */\r\n  int iTab = pParse->nTab++;            /* Cursor of the RHS table */\r\n  int mustBeUnique = (prNotFound==0);   /* True if RHS must be unique */\r\n  Vdbe *v = sqlite3GetVdbe(pParse);     /* Virtual machine being coded */\r\n\r\n  assert( pX->op==TK_IN );\r\n\r\n  /* Check to see if an existing table or index can be used to\r\n  ** satisfy the query.  This is preferable to generating a new \r\n  ** ephemeral table.\r\n  */\r\n  p = (ExprHasProperty(pX, EP_xIsSelect) ? pX->x.pSelect : 0);\r\n  if( ALWAYS(pParse->nErr==0) && isCandidateForInOpt(p) ){\r\n    sqlite3 *db = pParse->db;              /* Database connection */\r\n    Table *pTab;                           /* Table <table>. */\r\n    Expr *pExpr;                           /* Expression <column> */\r\n    int iCol;                              /* Index of column <column> */\r\n    int iDb;                               /* Database idx for pTab */\r\n\r\n    assert( p );                        /* Because of isCandidateForInOpt(p) */\r\n    assert( p->pEList!=0 );             /* Because of isCandidateForInOpt(p) */\r\n    assert( p->pEList->a[0].pExpr!=0 ); /* Because of isCandidateForInOpt(p) */\r\n    assert( p->pSrc!=0 );               /* Because of isCandidateForInOpt(p) */\r\n    pTab = p->pSrc->a[0].pTab;\r\n    pExpr = p->pEList->a[0].pExpr;\r\n    iCol = pExpr->iColumn;\r\n   \r\n    /* Code an OP_VerifyCookie and OP_TableLock for <table>. */\r\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n    sqlite3CodeVerifySchema(pParse, iDb);\r\n    sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\r\n\r\n    /* This function is only called from two places. In both cases the vdbe\r\n    ** has already been allocated. So assume sqlite3GetVdbe() is always\r\n    ** successful here.\r\n    */\r\n    assert(v);\r\n    if( iCol<0 ){\r\n      int iAddr;\r\n\r\n      iAddr = sqlite3CodeOnce(pParse);\r\n\r\n      sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);\r\n      eType = IN_INDEX_ROWID;\r\n\r\n      sqlite3VdbeJumpHere(v, iAddr);\r\n    }else{\r\n      Index *pIdx;                         /* Iterator variable */\r\n\r\n      /* The collation sequence used by the comparison. If an index is to\r\n      ** be used in place of a temp-table, it must be ordered according\r\n      ** to this collation sequence.  */\r\n      CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pExpr);\r\n\r\n      /* Check that the affinity that will be used to perform the \r\n      ** comparison is the same as the affinity of the column. If\r\n      ** it is not, it is not possible to use any index.\r\n      */\r\n      char aff = comparisonAffinity(pX);\r\n      int affinity_ok = (pTab->aCol[iCol].affinity==aff||aff==SQLITE_AFF_NONE);\r\n\r\n      for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){\r\n        if( (pIdx->aiColumn[0]==iCol)\r\n         && sqlite3FindCollSeq(db, ENC(db), pIdx->azColl[0], 0)==pReq\r\n         && (!mustBeUnique || (pIdx->nColumn==1 && pIdx->onError!=OE_None))\r\n        ){\r\n          int iAddr;\r\n          char *pKey;\r\n  \r\n          pKey = (char *)sqlite3IndexKeyinfo(pParse, pIdx);\r\n          iAddr = sqlite3CodeOnce(pParse);\r\n  \r\n          sqlite3VdbeAddOp4(v, OP_OpenRead, iTab, pIdx->tnum, iDb,\r\n                               pKey,P4_KEYINFO_HANDOFF);\r\n          VdbeComment((v, \"%s\", pIdx->zName));\r\n          eType = IN_INDEX_INDEX;\r\n\r\n          sqlite3VdbeJumpHere(v, iAddr);\r\n          if( prNotFound && !pTab->aCol[iCol].notNull ){\r\n            *prNotFound = ++pParse->nMem;\r\n            sqlite3VdbeAddOp2(v, OP_Null, 0, *prNotFound);\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  if( eType==0 ){\r\n    /* Could not found an existing table or index to use as the RHS b-tree.\r\n    ** We will have to generate an ephemeral table to do the job.\r\n    */\r\n    double savedNQueryLoop = pParse->nQueryLoop;\r\n    int rMayHaveNull = 0;\r\n    eType = IN_INDEX_EPH;\r\n    if( prNotFound ){\r\n      *prNotFound = rMayHaveNull = ++pParse->nMem;\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, *prNotFound);\r\n    }else{\r\n      testcase( pParse->nQueryLoop>(double)1 );\r\n      pParse->nQueryLoop = (double)1;\r\n      if( pX->pLeft->iColumn<0 && !ExprHasAnyProperty(pX, EP_xIsSelect) ){\r\n        eType = IN_INDEX_ROWID;\r\n      }\r\n    }\r\n    sqlite3CodeSubselect(pParse, pX, rMayHaveNull, eType==IN_INDEX_ROWID);\r\n    pParse->nQueryLoop = savedNQueryLoop;\r\n  }else{\r\n    pX->iTable = iTab;\r\n  }\r\n  return eType;\r\n}\r\n#endif\r\n\r\n/*\r\n** Generate code for scalar subqueries used as a subquery expression, EXISTS,\r\n** or IN operators.  Examples:\r\n**\r\n**     (SELECT a FROM b)          -- subquery\r\n**     EXISTS (SELECT a FROM b)   -- EXISTS subquery\r\n**     x IN (4,5,11)              -- IN operator with list on right-hand side\r\n**     x IN (SELECT a FROM b)     -- IN operator with subquery on the right\r\n**\r\n** The pExpr parameter describes the expression that contains the IN\r\n** operator or subquery.\r\n**\r\n** If parameter isRowid is non-zero, then expression pExpr is guaranteed\r\n** to be of the form \"<rowid> IN (?, ?, ?)\", where <rowid> is a reference\r\n** to some integer key column of a table B-Tree. In this case, use an\r\n** intkey B-Tree to store the set of IN(...) values instead of the usual\r\n** (slower) variable length keys B-Tree.\r\n**\r\n** If rMayHaveNull is non-zero, that means that the operation is an IN\r\n** (not a SELECT or EXISTS) and that the RHS might contains NULLs.\r\n** Furthermore, the IN is in a WHERE clause and that we really want\r\n** to iterate over the RHS of the IN operator in order to quickly locate\r\n** all corresponding LHS elements.  All this routine does is initialize\r\n** the register given by rMayHaveNull to NULL.  Calling routines will take\r\n** care of changing this register value to non-NULL if the RHS is NULL-free.\r\n**\r\n** If rMayHaveNull is zero, that means that the subquery is being used\r\n** for membership testing only.  There is no need to initialize any\r\n** registers to indicate the presense or absence of NULLs on the RHS.\r\n**\r\n** For a SELECT or EXISTS operator, return the register that holds the\r\n** result.  For IN operators or if an error occurs, the return value is 0.\r\n*/\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\nSQLITE_PRIVATE int sqlite3CodeSubselect(\r\n  Parse *pParse,          /* Parsing context */\r\n  Expr *pExpr,            /* The IN, SELECT, or EXISTS operator */\r\n  int rMayHaveNull,       /* Register that records whether NULLs exist in RHS */\r\n  int isRowid             /* If true, LHS of IN operator is a rowid */\r\n){\r\n  int testAddr = -1;                      /* One-time test address */\r\n  int rReg = 0;                           /* Register storing resulting */\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  if( NEVER(v==0) ) return 0;\r\n  sqlite3ExprCachePush(pParse);\r\n\r\n  /* This code must be run in its entirety every time it is encountered\r\n  ** if any of the following is true:\r\n  **\r\n  **    *  The right-hand side is a correlated subquery\r\n  **    *  The right-hand side is an expression list containing variables\r\n  **    *  We are inside a trigger\r\n  **\r\n  ** If all of the above are false, then we can run this code just once\r\n  ** save the results, and reuse the same result on subsequent invocations.\r\n  */\r\n  if( !ExprHasAnyProperty(pExpr, EP_VarSelect) ){\r\n    testAddr = sqlite3CodeOnce(pParse);\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  if( pParse->explain==2 ){\r\n    char *zMsg = sqlite3MPrintf(\r\n        pParse->db, \"EXECUTE %s%s SUBQUERY %d\", testAddr>=0?\"\":\"CORRELATED \",\r\n        pExpr->op==TK_IN?\"LIST\":\"SCALAR\", pParse->iNextSelectId\r\n    );\r\n    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);\r\n  }\r\n#endif\r\n\r\n  switch( pExpr->op ){\r\n    case TK_IN: {\r\n      char affinity;              /* Affinity of the LHS of the IN */\r\n      KeyInfo keyInfo;            /* Keyinfo for the generated table */\r\n      int addr;                   /* Address of OP_OpenEphemeral instruction */\r\n      Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */\r\n\r\n      if( rMayHaveNull ){\r\n        sqlite3VdbeAddOp2(v, OP_Null, 0, rMayHaveNull);\r\n      }\r\n\r\n      affinity = sqlite3ExprAffinity(pLeft);\r\n\r\n      /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)'\r\n      ** expression it is handled the same way.  An ephemeral table is \r\n      ** filled with single-field index keys representing the results\r\n      ** from the SELECT or the <exprlist>.\r\n      **\r\n      ** If the 'x' expression is a column value, or the SELECT...\r\n      ** statement returns a column value, then the affinity of that\r\n      ** column is used to build the index keys. If both 'x' and the\r\n      ** SELECT... statement are columns, then numeric affinity is used\r\n      ** if either column has NUMERIC or INTEGER affinity. If neither\r\n      ** 'x' nor the SELECT... statement are columns, then numeric affinity\r\n      ** is used.\r\n      */\r\n      pExpr->iTable = pParse->nTab++;\r\n      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, !isRowid);\r\n      if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED);\r\n      memset(&keyInfo, 0, sizeof(keyInfo));\r\n      keyInfo.nField = 1;\r\n\r\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n        /* Case 1:     expr IN (SELECT ...)\r\n        **\r\n        ** Generate code to write the results of the select into the temporary\r\n        ** table allocated and opened above.\r\n        */\r\n        SelectDest dest;\r\n        ExprList *pEList;\r\n\r\n        assert( !isRowid );\r\n        sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);\r\n        dest.affinity = (u8)affinity;\r\n        assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );\r\n        pExpr->x.pSelect->iLimit = 0;\r\n        if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){\r\n          return 0;\r\n        }\r\n        pEList = pExpr->x.pSelect->pEList;\r\n        if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){ \r\n          keyInfo.aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft,\r\n              pEList->a[0].pExpr);\r\n        }\r\n      }else if( ALWAYS(pExpr->x.pList!=0) ){\r\n        /* Case 2:     expr IN (exprlist)\r\n        **\r\n        ** For each expression, build an index key from the evaluation and\r\n        ** store it in the temporary table. If <expr> is a column, then use\r\n        ** that columns affinity when building index keys. If <expr> is not\r\n        ** a column, use numeric affinity.\r\n        */\r\n        int i;\r\n        ExprList *pList = pExpr->x.pList;\r\n        struct ExprList_item *pItem;\r\n        int r1, r2, r3;\r\n\r\n        if( !affinity ){\r\n          affinity = SQLITE_AFF_NONE;\r\n        }\r\n        keyInfo.aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft);\r\n\r\n        /* Loop through each expression in <exprlist>. */\r\n        r1 = sqlite3GetTempReg(pParse);\r\n        r2 = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp2(v, OP_Null, 0, r2);\r\n        for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){\r\n          Expr *pE2 = pItem->pExpr;\r\n          int iValToIns;\r\n\r\n          /* If the expression is not constant then we will need to\r\n          ** disable the test that was generated above that makes sure\r\n          ** this code only executes once.  Because for a non-constant\r\n          ** expression we need to rerun this code each time.\r\n          */\r\n          if( testAddr>=0 && !sqlite3ExprIsConstant(pE2) ){\r\n            sqlite3VdbeChangeToNoop(v, testAddr);\r\n            testAddr = -1;\r\n          }\r\n\r\n          /* Evaluate the expression and insert it into the temp table */\r\n          if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){\r\n            sqlite3VdbeAddOp3(v, OP_InsertInt, pExpr->iTable, r2, iValToIns);\r\n          }else{\r\n            r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);\r\n            if( isRowid ){\r\n              sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,\r\n                                sqlite3VdbeCurrentAddr(v)+2);\r\n              sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);\r\n            }else{\r\n              sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);\r\n              sqlite3ExprCacheAffinityChange(pParse, r3, 1);\r\n              sqlite3VdbeAddOp2(v, OP_IdxInsert, pExpr->iTable, r2);\r\n            }\r\n          }\r\n        }\r\n        sqlite3ReleaseTempReg(pParse, r1);\r\n        sqlite3ReleaseTempReg(pParse, r2);\r\n      }\r\n      if( !isRowid ){\r\n        sqlite3VdbeChangeP4(v, addr, (void *)&keyInfo, P4_KEYINFO);\r\n      }\r\n      break;\r\n    }\r\n\r\n    case TK_EXISTS:\r\n    case TK_SELECT:\r\n    default: {\r\n      /* If this has to be a scalar SELECT.  Generate code to put the\r\n      ** value of this select in a memory cell and record the number\r\n      ** of the memory cell in iColumn.  If this is an EXISTS, write\r\n      ** an integer 0 (not exists) or 1 (exists) into a memory cell\r\n      ** and record that memory cell in iColumn.\r\n      */\r\n      Select *pSel;                         /* SELECT statement to encode */\r\n      SelectDest dest;                      /* How to deal with SELECt result */\r\n\r\n      testcase( pExpr->op==TK_EXISTS );\r\n      testcase( pExpr->op==TK_SELECT );\r\n      assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );\r\n\r\n      assert( ExprHasProperty(pExpr, EP_xIsSelect) );\r\n      pSel = pExpr->x.pSelect;\r\n      sqlite3SelectDestInit(&dest, 0, ++pParse->nMem);\r\n      if( pExpr->op==TK_SELECT ){\r\n        dest.eDest = SRT_Mem;\r\n        sqlite3VdbeAddOp2(v, OP_Null, 0, dest.iParm);\r\n        VdbeComment((v, \"Init subquery result\"));\r\n      }else{\r\n        dest.eDest = SRT_Exists;\r\n        sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iParm);\r\n        VdbeComment((v, \"Init EXISTS result\"));\r\n      }\r\n      sqlite3ExprDelete(pParse->db, pSel->pLimit);\r\n      pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0,\r\n                                  &sqlite3IntTokens[1]);\r\n      pSel->iLimit = 0;\r\n      if( sqlite3Select(pParse, pSel, &dest) ){\r\n        return 0;\r\n      }\r\n      rReg = dest.iParm;\r\n      ExprSetIrreducible(pExpr);\r\n      break;\r\n    }\r\n  }\r\n\r\n  if( testAddr>=0 ){\r\n    sqlite3VdbeJumpHere(v, testAddr);\r\n  }\r\n  sqlite3ExprCachePop(pParse, 1);\r\n\r\n  return rReg;\r\n}\r\n#endif /* SQLITE_OMIT_SUBQUERY */\r\n\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n/*\r\n** Generate code for an IN expression.\r\n**\r\n**      x IN (SELECT ...)\r\n**      x IN (value, value, ...)\r\n**\r\n** The left-hand side (LHS) is a scalar expression.  The right-hand side (RHS)\r\n** is an array of zero or more values.  The expression is true if the LHS is\r\n** contained within the RHS.  The value of the expression is unknown (NULL)\r\n** if the LHS is NULL or if the LHS is not contained within the RHS and the\r\n** RHS contains one or more NULL values.\r\n**\r\n** This routine generates code will jump to destIfFalse if the LHS is not \r\n** contained within the RHS.  If due to NULLs we cannot determine if the LHS\r\n** is contained in the RHS then jump to destIfNull.  If the LHS is contained\r\n** within the RHS then fall through.\r\n*/\r\nstatic void sqlite3ExprCodeIN(\r\n  Parse *pParse,        /* Parsing and code generating context */\r\n  Expr *pExpr,          /* The IN expression */\r\n  int destIfFalse,      /* Jump here if LHS is not contained in the RHS */\r\n  int destIfNull        /* Jump here if the results are unknown due to NULLs */\r\n){\r\n  int rRhsHasNull = 0;  /* Register that is true if RHS contains NULL values */\r\n  char affinity;        /* Comparison affinity to use */\r\n  int eType;            /* Type of the RHS */\r\n  int r1;               /* Temporary use register */\r\n  Vdbe *v;              /* Statement under construction */\r\n\r\n  /* Compute the RHS.   After this step, the table with cursor\r\n  ** pExpr->iTable will contains the values that make up the RHS.\r\n  */\r\n  v = pParse->pVdbe;\r\n  assert( v!=0 );       /* OOM detected prior to this routine */\r\n  VdbeNoopComment((v, \"begin IN expr\"));\r\n  eType = sqlite3FindInIndex(pParse, pExpr, &rRhsHasNull);\r\n\r\n  /* Figure out the affinity to use to create a key from the results\r\n  ** of the expression. affinityStr stores a static string suitable for\r\n  ** P4 of OP_MakeRecord.\r\n  */\r\n  affinity = comparisonAffinity(pExpr);\r\n\r\n  /* Code the LHS, the <expr> from \"<expr> IN (...)\".\r\n  */\r\n  sqlite3ExprCachePush(pParse);\r\n  r1 = sqlite3GetTempReg(pParse);\r\n  sqlite3ExprCode(pParse, pExpr->pLeft, r1);\r\n\r\n  /* If the LHS is NULL, then the result is either false or NULL depending\r\n  ** on whether the RHS is empty or not, respectively.\r\n  */\r\n  if( destIfNull==destIfFalse ){\r\n    /* Shortcut for the common case where the false and NULL outcomes are\r\n    ** the same. */\r\n    sqlite3VdbeAddOp2(v, OP_IsNull, r1, destIfNull);\r\n  }else{\r\n    int addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1);\r\n    sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull);\r\n    sqlite3VdbeJumpHere(v, addr1);\r\n  }\r\n\r\n  if( eType==IN_INDEX_ROWID ){\r\n    /* In this case, the RHS is the ROWID of table b-tree\r\n    */\r\n    sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, destIfFalse);\r\n    sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, destIfFalse, r1);\r\n  }else{\r\n    /* In this case, the RHS is an index b-tree.\r\n    */\r\n    sqlite3VdbeAddOp4(v, OP_Affinity, r1, 1, 0, &affinity, 1);\r\n\r\n    /* If the set membership test fails, then the result of the \r\n    ** \"x IN (...)\" expression must be either 0 or NULL. If the set\r\n    ** contains no NULL values, then the result is 0. If the set \r\n    ** contains one or more NULL values, then the result of the\r\n    ** expression is also NULL.\r\n    */\r\n    if( rRhsHasNull==0 || destIfFalse==destIfNull ){\r\n      /* This branch runs if it is known at compile time that the RHS\r\n      ** cannot contain NULL values. This happens as the result\r\n      ** of a \"NOT NULL\" constraint in the database schema.\r\n      **\r\n      ** Also run this branch if NULL is equivalent to FALSE\r\n      ** for this particular IN operator.\r\n      */\r\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, pExpr->iTable, destIfFalse, r1, 1);\r\n\r\n    }else{\r\n      /* In this branch, the RHS of the IN might contain a NULL and\r\n      ** the presence of a NULL on the RHS makes a difference in the\r\n      ** outcome.\r\n      */\r\n      int j1, j2, j3;\r\n\r\n      /* First check to see if the LHS is contained in the RHS.  If so,\r\n      ** then the presence of NULLs in the RHS does not matter, so jump\r\n      ** over all of the code that follows.\r\n      */\r\n      j1 = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, r1, 1);\r\n\r\n      /* Here we begin generating code that runs if the LHS is not\r\n      ** contained within the RHS.  Generate additional code that\r\n      ** tests the RHS for NULLs.  If the RHS contains a NULL then\r\n      ** jump to destIfNull.  If there are no NULLs in the RHS then\r\n      ** jump to destIfFalse.\r\n      */\r\n      j2 = sqlite3VdbeAddOp1(v, OP_NotNull, rRhsHasNull);\r\n      j3 = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, rRhsHasNull, 1);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, -1, rRhsHasNull);\r\n      sqlite3VdbeJumpHere(v, j3);\r\n      sqlite3VdbeAddOp2(v, OP_AddImm, rRhsHasNull, 1);\r\n      sqlite3VdbeJumpHere(v, j2);\r\n\r\n      /* Jump to the appropriate target depending on whether or not\r\n      ** the RHS contains a NULL\r\n      */\r\n      sqlite3VdbeAddOp2(v, OP_If, rRhsHasNull, destIfNull);\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfFalse);\r\n\r\n      /* The OP_Found at the top of this branch jumps here when true, \r\n      ** causing the overall IN expression evaluation to fall through.\r\n      */\r\n      sqlite3VdbeJumpHere(v, j1);\r\n    }\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, r1);\r\n  sqlite3ExprCachePop(pParse, 1);\r\n  VdbeComment((v, \"end IN expr\"));\r\n}\r\n#endif /* SQLITE_OMIT_SUBQUERY */\r\n\r\n/*\r\n** Duplicate an 8-byte value\r\n*/\r\nstatic char *dup8bytes(Vdbe *v, const char *in){\r\n  char *out = sqlite3DbMallocRaw(sqlite3VdbeDb(v), 8);\r\n  if( out ){\r\n    memcpy(out, in, 8);\r\n  }\r\n  return out;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n/*\r\n** Generate an instruction that will put the floating point\r\n** value described by z[0..n-1] into register iMem.\r\n**\r\n** The z[] string will probably not be zero-terminated.  But the \r\n** z[n] character is guaranteed to be something that does not look\r\n** like the continuation of the number.\r\n*/\r\nstatic void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){\r\n  if( ALWAYS(z!=0) ){\r\n    double value;\r\n    char *zV;\r\n    sqlite3AtoF(z, &value, sqlite3Strlen30(z), SQLITE_UTF8);\r\n    assert( !sqlite3IsNaN(value) ); /* The new AtoF never returns NaN */\r\n    if( negateFlag ) value = -value;\r\n    zV = dup8bytes(v, (char*)&value);\r\n    sqlite3VdbeAddOp4(v, OP_Real, 0, iMem, 0, zV, P4_REAL);\r\n  }\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Generate an instruction that will put the integer describe by\r\n** text z[0..n-1] into register iMem.\r\n**\r\n** Expr.u.zToken is always UTF8 and zero-terminated.\r\n*/\r\nstatic void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){\r\n  Vdbe *v = pParse->pVdbe;\r\n  if( pExpr->flags & EP_IntValue ){\r\n    int i = pExpr->u.iValue;\r\n    assert( i>=0 );\r\n    if( negFlag ) i = -i;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, i, iMem);\r\n  }else{\r\n    int c;\r\n    i64 value;\r\n    const char *z = pExpr->u.zToken;\r\n    assert( z!=0 );\r\n    c = sqlite3Atoi64(z, &value, sqlite3Strlen30(z), SQLITE_UTF8);\r\n    if( c==0 || (c==2 && negFlag) ){\r\n      char *zV;\r\n      if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; }\r\n      zV = dup8bytes(v, (char*)&value);\r\n      sqlite3VdbeAddOp4(v, OP_Int64, 0, iMem, 0, zV, P4_INT64);\r\n    }else{\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n      sqlite3ErrorMsg(pParse, \"oversized integer: %s%s\", negFlag ? \"-\" : \"\", z);\r\n#else\r\n      codeReal(v, z, negFlag, iMem);\r\n#endif\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Clear a cache entry.\r\n*/\r\nstatic void cacheEntryClear(Parse *pParse, struct yColCache *p){\r\n  if( p->tempReg ){\r\n    if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){\r\n      pParse->aTempReg[pParse->nTempReg++] = p->iReg;\r\n    }\r\n    p->tempReg = 0;\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** Record in the column cache that a particular column from a\r\n** particular table is stored in a particular register.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){\r\n  int i;\r\n  int minLru;\r\n  int idxLru;\r\n  struct yColCache *p;\r\n\r\n  assert( iReg>0 );  /* Register numbers are always positive */\r\n  assert( iCol>=-1 && iCol<32768 );  /* Finite column numbers */\r\n\r\n  /* The SQLITE_ColumnCache flag disables the column cache.  This is used\r\n  ** for testing only - to verify that SQLite always gets the same answer\r\n  ** with and without the column cache.\r\n  */\r\n  if( pParse->db->flags & SQLITE_ColumnCache ) return;\r\n\r\n  /* First replace any existing entry.\r\n  **\r\n  ** Actually, the way the column cache is currently used, we are guaranteed\r\n  ** that the object will never already be in cache.  Verify this guarantee.\r\n  */\r\n#ifndef NDEBUG\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n#if 0 /* This code wold remove the entry from the cache if it existed */\r\n    if( p->iReg && p->iTable==iTab && p->iColumn==iCol ){\r\n      cacheEntryClear(pParse, p);\r\n      p->iLevel = pParse->iCacheLevel;\r\n      p->iReg = iReg;\r\n      p->lru = pParse->iCacheCnt++;\r\n      return;\r\n    }\r\n#endif\r\n    assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol );\r\n  }\r\n#endif\r\n\r\n  /* Find an empty slot and replace it */\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    if( p->iReg==0 ){\r\n      p->iLevel = pParse->iCacheLevel;\r\n      p->iTable = iTab;\r\n      p->iColumn = iCol;\r\n      p->iReg = iReg;\r\n      p->tempReg = 0;\r\n      p->lru = pParse->iCacheCnt++;\r\n      return;\r\n    }\r\n  }\r\n\r\n  /* Replace the last recently used */\r\n  minLru = 0x7fffffff;\r\n  idxLru = -1;\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    if( p->lru<minLru ){\r\n      idxLru = i;\r\n      minLru = p->lru;\r\n    }\r\n  }\r\n  if( ALWAYS(idxLru>=0) ){\r\n    p = &pParse->aColCache[idxLru];\r\n    p->iLevel = pParse->iCacheLevel;\r\n    p->iTable = iTab;\r\n    p->iColumn = iCol;\r\n    p->iReg = iReg;\r\n    p->tempReg = 0;\r\n    p->lru = pParse->iCacheCnt++;\r\n    return;\r\n  }\r\n}\r\n\r\n/*\r\n** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.\r\n** Purge the range of registers from the column cache.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){\r\n  int i;\r\n  int iLast = iReg + nReg - 1;\r\n  struct yColCache *p;\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    int r = p->iReg;\r\n    if( r>=iReg && r<=iLast ){\r\n      cacheEntryClear(pParse, p);\r\n      p->iReg = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Remember the current column cache context.  Any new entries added\r\n** added to the column cache after this call are removed when the\r\n** corresponding pop occurs.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){\r\n  pParse->iCacheLevel++;\r\n}\r\n\r\n/*\r\n** Remove from the column cache any entries that were added since the\r\n** the previous N Push operations.  In other words, restore the cache\r\n** to the state it was in N Pushes ago.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse, int N){\r\n  int i;\r\n  struct yColCache *p;\r\n  assert( N>0 );\r\n  assert( pParse->iCacheLevel>=N );\r\n  pParse->iCacheLevel -= N;\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    if( p->iReg && p->iLevel>pParse->iCacheLevel ){\r\n      cacheEntryClear(pParse, p);\r\n      p->iReg = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** When a cached column is reused, make sure that its register is\r\n** no longer available as a temp register.  ticket #3879:  that same\r\n** register might be in the cache in multiple places, so be sure to\r\n** get them all.\r\n*/\r\nstatic void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){\r\n  int i;\r\n  struct yColCache *p;\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    if( p->iReg==iReg ){\r\n      p->tempReg = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Generate code to extract the value of the iCol-th column of a table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(\r\n  Vdbe *v,        /* The VDBE under construction */\r\n  Table *pTab,    /* The table containing the value */\r\n  int iTabCur,    /* The cursor for this table */\r\n  int iCol,       /* Index of the column to extract */\r\n  int regOut      /* Extract the valud into this register */\r\n){\r\n  if( iCol<0 || iCol==pTab->iPKey ){\r\n    sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);\r\n  }else{\r\n    int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;\r\n    sqlite3VdbeAddOp3(v, op, iTabCur, iCol, regOut);\r\n  }\r\n  if( iCol>=0 ){\r\n    sqlite3ColumnDefault(v, pTab, iCol, regOut);\r\n  }\r\n}\r\n\r\n/*\r\n** Generate code that will extract the iColumn-th column from\r\n** table pTab and store the column value in a register.  An effort\r\n** is made to store the column value in register iReg, but this is\r\n** not guaranteed.  The location of the column value is returned.\r\n**\r\n** There must be an open cursor to pTab in iTable when this routine\r\n** is called.  If iColumn<0 then code is generated that extracts the rowid.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCodeGetColumn(\r\n  Parse *pParse,   /* Parsing and code generating context */\r\n  Table *pTab,     /* Description of the table we are reading from */\r\n  int iColumn,     /* Index of the table column */\r\n  int iTable,      /* The cursor pointing to the table */\r\n  int iReg         /* Store results here */\r\n){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  struct yColCache *p;\r\n\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn ){\r\n      p->lru = pParse->iCacheCnt++;\r\n      sqlite3ExprCachePinRegister(pParse, p->iReg);\r\n      return p->iReg;\r\n    }\r\n  }  \r\n  assert( v!=0 );\r\n  sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);\r\n  sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg);\r\n  return iReg;\r\n}\r\n\r\n/*\r\n** Clear all column cache entries.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){\r\n  int i;\r\n  struct yColCache *p;\r\n\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    if( p->iReg ){\r\n      cacheEntryClear(pParse, p);\r\n      p->iReg = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Record the fact that an affinity change has occurred on iCount\r\n** registers starting with iStart.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){\r\n  sqlite3ExprCacheRemove(pParse, iStart, iCount);\r\n}\r\n\r\n/*\r\n** Generate code to move content from registers iFrom...iFrom+nReg-1\r\n** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){\r\n  int i;\r\n  struct yColCache *p;\r\n  if( NEVER(iFrom==iTo) ) return;\r\n  sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    int x = p->iReg;\r\n    if( x>=iFrom && x<iFrom+nReg ){\r\n      p->iReg += iTo-iFrom;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Generate code to copy content from registers iFrom...iFrom+nReg-1\r\n** over to iTo..iTo+nReg-1.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, int iFrom, int iTo, int nReg){\r\n  int i;\r\n  if( NEVER(iFrom==iTo) ) return;\r\n  for(i=0; i<nReg; i++){\r\n    sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, iFrom+i, iTo+i);\r\n  }\r\n}\r\n\r\n#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)\r\n/*\r\n** Return true if any register in the range iFrom..iTo (inclusive)\r\n** is used as part of the column cache.\r\n**\r\n** This routine is used within assert() and testcase() macros only\r\n** and does not appear in a normal build.\r\n*/\r\nstatic int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){\r\n  int i;\r\n  struct yColCache *p;\r\n  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n    int r = p->iReg;\r\n    if( r>=iFrom && r<=iTo ) return 1;    /*NO_TEST*/\r\n  }\r\n  return 0;\r\n}\r\n#endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */\r\n\r\n/*\r\n** Generate code into the current Vdbe to evaluate the given\r\n** expression.  Attempt to store the results in register \"target\".\r\n** Return the register where results are stored.\r\n**\r\n** With this routine, there is no guarantee that results will\r\n** be stored in target.  The result might be stored in some other\r\n** register if it is convenient to do so.  The calling function\r\n** must check the return code and move the results to the desired\r\n** register.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){\r\n  Vdbe *v = pParse->pVdbe;  /* The VM under construction */\r\n  int op;                   /* The opcode being coded */\r\n  int inReg = target;       /* Results stored in register inReg */\r\n  int regFree1 = 0;         /* If non-zero free this temporary register */\r\n  int regFree2 = 0;         /* If non-zero free this temporary register */\r\n  int r1, r2, r3, r4;       /* Various register numbers */\r\n  sqlite3 *db = pParse->db; /* The database connection */\r\n\r\n  assert( target>0 && target<=pParse->nMem );\r\n  if( v==0 ){\r\n    assert( pParse->db->mallocFailed );\r\n    return 0;\r\n  }\r\n\r\n  if( pExpr==0 ){\r\n    op = TK_NULL;\r\n  }else{\r\n    op = pExpr->op;\r\n  }\r\n  switch( op ){\r\n    case TK_AGG_COLUMN: {\r\n      AggInfo *pAggInfo = pExpr->pAggInfo;\r\n      struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];\r\n      if( !pAggInfo->directMode ){\r\n        assert( pCol->iMem>0 );\r\n        inReg = pCol->iMem;\r\n        break;\r\n      }else if( pAggInfo->useSortingIdx ){\r\n        sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,\r\n                              pCol->iSorterColumn, target);\r\n        break;\r\n      }\r\n      /* Otherwise, fall thru into the TK_COLUMN case */\r\n    }\r\n    case TK_COLUMN: {\r\n      if( pExpr->iTable<0 ){\r\n        /* This only happens when coding check constraints */\r\n        assert( pParse->ckBase>0 );\r\n        inReg = pExpr->iColumn + pParse->ckBase;\r\n      }else{\r\n        inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,\r\n                                 pExpr->iColumn, pExpr->iTable, target);\r\n      }\r\n      break;\r\n    }\r\n    case TK_INTEGER: {\r\n      codeInteger(pParse, pExpr, 0, target);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n    case TK_FLOAT: {\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      codeReal(v, pExpr->u.zToken, 0, target);\r\n      break;\r\n    }\r\n#endif\r\n    case TK_STRING: {\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, target, 0, pExpr->u.zToken, 0);\r\n      break;\r\n    }\r\n    case TK_NULL: {\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, target);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_BLOB_LITERAL\r\n    case TK_BLOB: {\r\n      int n;\r\n      const char *z;\r\n      char *zBlob;\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );\r\n      assert( pExpr->u.zToken[1]=='\\'' );\r\n      z = &pExpr->u.zToken[2];\r\n      n = sqlite3Strlen30(z) - 1;\r\n      assert( z[n]=='\\'' );\r\n      zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n);\r\n      sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC);\r\n      break;\r\n    }\r\n#endif\r\n    case TK_VARIABLE: {\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      assert( pExpr->u.zToken!=0 );\r\n      assert( pExpr->u.zToken[0]!=0 );\r\n      sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target);\r\n      if( pExpr->u.zToken[1]!=0 ){\r\n        assert( pExpr->u.zToken[0]=='?' \r\n             || strcmp(pExpr->u.zToken, pParse->azVar[pExpr->iColumn-1])==0 );\r\n        sqlite3VdbeChangeP4(v, -1, pParse->azVar[pExpr->iColumn-1], P4_STATIC);\r\n      }\r\n      break;\r\n    }\r\n    case TK_REGISTER: {\r\n      inReg = pExpr->iTable;\r\n      break;\r\n    }\r\n    case TK_AS: {\r\n      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_CAST\r\n    case TK_CAST: {\r\n      /* Expressions of the form:   CAST(pLeft AS token) */\r\n      int aff, to_op;\r\n      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      aff = sqlite3AffinityType(pExpr->u.zToken);\r\n      to_op = aff - SQLITE_AFF_TEXT + OP_ToText;\r\n      assert( to_op==OP_ToText    || aff!=SQLITE_AFF_TEXT    );\r\n      assert( to_op==OP_ToBlob    || aff!=SQLITE_AFF_NONE    );\r\n      assert( to_op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC );\r\n      assert( to_op==OP_ToInt     || aff!=SQLITE_AFF_INTEGER );\r\n      assert( to_op==OP_ToReal    || aff!=SQLITE_AFF_REAL    );\r\n      testcase( to_op==OP_ToText );\r\n      testcase( to_op==OP_ToBlob );\r\n      testcase( to_op==OP_ToNumeric );\r\n      testcase( to_op==OP_ToInt );\r\n      testcase( to_op==OP_ToReal );\r\n      if( inReg!=target ){\r\n        sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);\r\n        inReg = target;\r\n      }\r\n      sqlite3VdbeAddOp1(v, to_op, inReg);\r\n      testcase( usedAsColumnCache(pParse, inReg, inReg) );\r\n      sqlite3ExprCacheAffinityChange(pParse, inReg, 1);\r\n      break;\r\n    }\r\n#endif /* SQLITE_OMIT_CAST */\r\n    case TK_LT:\r\n    case TK_LE:\r\n    case TK_GT:\r\n    case TK_GE:\r\n    case TK_NE:\r\n    case TK_EQ: {\r\n      assert( TK_LT==OP_Lt );\r\n      assert( TK_LE==OP_Le );\r\n      assert( TK_GT==OP_Gt );\r\n      assert( TK_GE==OP_Ge );\r\n      assert( TK_EQ==OP_Eq );\r\n      assert( TK_NE==OP_Ne );\r\n      testcase( op==TK_LT );\r\n      testcase( op==TK_LE );\r\n      testcase( op==TK_GT );\r\n      testcase( op==TK_GE );\r\n      testcase( op==TK_EQ );\r\n      testcase( op==TK_NE );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\r\n                  r1, r2, inReg, SQLITE_STOREP2);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_IS:\r\n    case TK_ISNOT: {\r\n      testcase( op==TK_IS );\r\n      testcase( op==TK_ISNOT );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      op = (op==TK_IS) ? TK_EQ : TK_NE;\r\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\r\n                  r1, r2, inReg, SQLITE_STOREP2 | SQLITE_NULLEQ);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_AND:\r\n    case TK_OR:\r\n    case TK_PLUS:\r\n    case TK_STAR:\r\n    case TK_MINUS:\r\n    case TK_REM:\r\n    case TK_BITAND:\r\n    case TK_BITOR:\r\n    case TK_SLASH:\r\n    case TK_LSHIFT:\r\n    case TK_RSHIFT: \r\n    case TK_CONCAT: {\r\n      assert( TK_AND==OP_And );\r\n      assert( TK_OR==OP_Or );\r\n      assert( TK_PLUS==OP_Add );\r\n      assert( TK_MINUS==OP_Subtract );\r\n      assert( TK_REM==OP_Remainder );\r\n      assert( TK_BITAND==OP_BitAnd );\r\n      assert( TK_BITOR==OP_BitOr );\r\n      assert( TK_SLASH==OP_Divide );\r\n      assert( TK_LSHIFT==OP_ShiftLeft );\r\n      assert( TK_RSHIFT==OP_ShiftRight );\r\n      assert( TK_CONCAT==OP_Concat );\r\n      testcase( op==TK_AND );\r\n      testcase( op==TK_OR );\r\n      testcase( op==TK_PLUS );\r\n      testcase( op==TK_MINUS );\r\n      testcase( op==TK_REM );\r\n      testcase( op==TK_BITAND );\r\n      testcase( op==TK_BITOR );\r\n      testcase( op==TK_SLASH );\r\n      testcase( op==TK_LSHIFT );\r\n      testcase( op==TK_RSHIFT );\r\n      testcase( op==TK_CONCAT );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      sqlite3VdbeAddOp3(v, op, r2, r1, target);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_UMINUS: {\r\n      Expr *pLeft = pExpr->pLeft;\r\n      assert( pLeft );\r\n      if( pLeft->op==TK_INTEGER ){\r\n        codeInteger(pParse, pLeft, 1, target);\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n      }else if( pLeft->op==TK_FLOAT ){\r\n        assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n        codeReal(v, pLeft->u.zToken, 1, target);\r\n#endif\r\n      }else{\r\n        regFree1 = r1 = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp2(v, OP_Integer, 0, r1);\r\n        r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);\r\n        sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);\r\n        testcase( regFree2==0 );\r\n      }\r\n      inReg = target;\r\n      break;\r\n    }\r\n    case TK_BITNOT:\r\n    case TK_NOT: {\r\n      assert( TK_BITNOT==OP_BitNot );\r\n      assert( TK_NOT==OP_Not );\r\n      testcase( op==TK_BITNOT );\r\n      testcase( op==TK_NOT );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      testcase( regFree1==0 );\r\n      inReg = target;\r\n      sqlite3VdbeAddOp2(v, op, r1, inReg);\r\n      break;\r\n    }\r\n    case TK_ISNULL:\r\n    case TK_NOTNULL: {\r\n      int addr;\r\n      assert( TK_ISNULL==OP_IsNull );\r\n      assert( TK_NOTNULL==OP_NotNull );\r\n      testcase( op==TK_ISNULL );\r\n      testcase( op==TK_NOTNULL );\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      testcase( regFree1==0 );\r\n      addr = sqlite3VdbeAddOp1(v, op, r1);\r\n      sqlite3VdbeAddOp2(v, OP_AddImm, target, -1);\r\n      sqlite3VdbeJumpHere(v, addr);\r\n      break;\r\n    }\r\n    case TK_AGG_FUNCTION: {\r\n      AggInfo *pInfo = pExpr->pAggInfo;\r\n      if( pInfo==0 ){\r\n        assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n        sqlite3ErrorMsg(pParse, \"misuse of aggregate: %s()\", pExpr->u.zToken);\r\n      }else{\r\n        inReg = pInfo->aFunc[pExpr->iAgg].iMem;\r\n      }\r\n      break;\r\n    }\r\n    case TK_CONST_FUNC:\r\n    case TK_FUNCTION: {\r\n      ExprList *pFarg;       /* List of function arguments */\r\n      int nFarg;             /* Number of function arguments */\r\n      FuncDef *pDef;         /* The function definition object */\r\n      int nId;               /* Length of the function name in bytes */\r\n      const char *zId;       /* The function name */\r\n      int constMask = 0;     /* Mask of function arguments that are constant */\r\n      int i;                 /* Loop counter */\r\n      u8 enc = ENC(db);      /* The text encoding used by this database */\r\n      CollSeq *pColl = 0;    /* A collating sequence */\r\n\r\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\r\n      testcase( op==TK_CONST_FUNC );\r\n      testcase( op==TK_FUNCTION );\r\n      if( ExprHasAnyProperty(pExpr, EP_TokenOnly) ){\r\n        pFarg = 0;\r\n      }else{\r\n        pFarg = pExpr->x.pList;\r\n      }\r\n      nFarg = pFarg ? pFarg->nExpr : 0;\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      zId = pExpr->u.zToken;\r\n      nId = sqlite3Strlen30(zId);\r\n      pDef = sqlite3FindFunction(db, zId, nId, nFarg, enc, 0);\r\n      if( pDef==0 ){\r\n        sqlite3ErrorMsg(pParse, \"unknown function: %.*s()\", nId, zId);\r\n        break;\r\n      }\r\n\r\n      /* Attempt a direct implementation of the built-in COALESCE() and\r\n      ** IFNULL() functions.  This avoids unnecessary evalation of\r\n      ** arguments past the first non-NULL argument.\r\n      */\r\n      if( pDef->flags & SQLITE_FUNC_COALESCE ){\r\n        int endCoalesce = sqlite3VdbeMakeLabel(v);\r\n        assert( nFarg>=2 );\r\n        sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target);\r\n        for(i=1; i<nFarg; i++){\r\n          sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce);\r\n          sqlite3ExprCacheRemove(pParse, target, 1);\r\n          sqlite3ExprCachePush(pParse);\r\n          sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target);\r\n          sqlite3ExprCachePop(pParse, 1);\r\n        }\r\n        sqlite3VdbeResolveLabel(v, endCoalesce);\r\n        break;\r\n      }\r\n\r\n\r\n      if( pFarg ){\r\n        r1 = sqlite3GetTempRange(pParse, nFarg);\r\n        sqlite3ExprCachePush(pParse);     /* Ticket 2ea2425d34be */\r\n        sqlite3ExprCodeExprList(pParse, pFarg, r1, 1);\r\n        sqlite3ExprCachePop(pParse, 1);   /* Ticket 2ea2425d34be */\r\n      }else{\r\n        r1 = 0;\r\n      }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n      /* Possibly overload the function if the first argument is\r\n      ** a virtual table column.\r\n      **\r\n      ** For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the\r\n      ** second argument, not the first, as the argument to test to\r\n      ** see if it is a column in a virtual table.  This is done because\r\n      ** the left operand of infix functions (the operand we want to\r\n      ** control overloading) ends up as the second argument to the\r\n      ** function.  The expression \"A glob B\" is equivalent to \r\n      ** \"glob(B,A).  We want to use the A in \"A glob B\" to test\r\n      ** for function overloading.  But we use the B term in \"glob(B,A)\".\r\n      */\r\n      if( nFarg>=2 && (pExpr->flags & EP_InfixFunc) ){\r\n        pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[1].pExpr);\r\n      }else if( nFarg>0 ){\r\n        pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr);\r\n      }\r\n#endif\r\n      for(i=0; i<nFarg; i++){\r\n        if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){\r\n          constMask |= (1<<i);\r\n        }\r\n        if( (pDef->flags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){\r\n          pColl = sqlite3ExprCollSeq(pParse, pFarg->a[i].pExpr);\r\n        }\r\n      }\r\n      if( pDef->flags & SQLITE_FUNC_NEEDCOLL ){\r\n        if( !pColl ) pColl = db->pDfltColl; \r\n        sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);\r\n      }\r\n      sqlite3VdbeAddOp4(v, OP_Function, constMask, r1, target,\r\n                        (char*)pDef, P4_FUNCDEF);\r\n      sqlite3VdbeChangeP5(v, (u8)nFarg);\r\n      if( nFarg ){\r\n        sqlite3ReleaseTempRange(pParse, r1, nFarg);\r\n      }\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case TK_EXISTS:\r\n    case TK_SELECT: {\r\n      testcase( op==TK_EXISTS );\r\n      testcase( op==TK_SELECT );\r\n      inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);\r\n      break;\r\n    }\r\n    case TK_IN: {\r\n      int destIfFalse = sqlite3VdbeMakeLabel(v);\r\n      int destIfNull = sqlite3VdbeMakeLabel(v);\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, target);\r\n      sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);\r\n      sqlite3VdbeResolveLabel(v, destIfFalse);\r\n      sqlite3VdbeAddOp2(v, OP_AddImm, target, 0);\r\n      sqlite3VdbeResolveLabel(v, destIfNull);\r\n      break;\r\n    }\r\n#endif /* SQLITE_OMIT_SUBQUERY */\r\n\r\n\r\n    /*\r\n    **    x BETWEEN y AND z\r\n    **\r\n    ** This is equivalent to\r\n    **\r\n    **    x>=y AND x<=z\r\n    **\r\n    ** X is stored in pExpr->pLeft.\r\n    ** Y is stored in pExpr->pList->a[0].pExpr.\r\n    ** Z is stored in pExpr->pList->a[1].pExpr.\r\n    */\r\n    case TK_BETWEEN: {\r\n      Expr *pLeft = pExpr->pLeft;\r\n      struct ExprList_item *pLItem = pExpr->x.pList->a;\r\n      Expr *pRight = pLItem->pExpr;\r\n\r\n      r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pRight, &regFree2);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      r3 = sqlite3GetTempReg(pParse);\r\n      r4 = sqlite3GetTempReg(pParse);\r\n      codeCompare(pParse, pLeft, pRight, OP_Ge,\r\n                  r1, r2, r3, SQLITE_STOREP2);\r\n      pLItem++;\r\n      pRight = pLItem->pExpr;\r\n      sqlite3ReleaseTempReg(pParse, regFree2);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pRight, &regFree2);\r\n      testcase( regFree2==0 );\r\n      codeCompare(pParse, pLeft, pRight, OP_Le, r1, r2, r4, SQLITE_STOREP2);\r\n      sqlite3VdbeAddOp3(v, OP_And, r3, r4, target);\r\n      sqlite3ReleaseTempReg(pParse, r3);\r\n      sqlite3ReleaseTempReg(pParse, r4);\r\n      break;\r\n    }\r\n    case TK_UPLUS: {\r\n      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);\r\n      break;\r\n    }\r\n\r\n    case TK_TRIGGER: {\r\n      /* If the opcode is TK_TRIGGER, then the expression is a reference\r\n      ** to a column in the new.* or old.* pseudo-tables available to\r\n      ** trigger programs. In this case Expr.iTable is set to 1 for the\r\n      ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn\r\n      ** is set to the column of the pseudo-table to read, or to -1 to\r\n      ** read the rowid field.\r\n      **\r\n      ** The expression is implemented using an OP_Param opcode. The p1\r\n      ** parameter is set to 0 for an old.rowid reference, or to (i+1)\r\n      ** to reference another column of the old.* pseudo-table, where \r\n      ** i is the index of the column. For a new.rowid reference, p1 is\r\n      ** set to (n+1), where n is the number of columns in each pseudo-table.\r\n      ** For a reference to any other column in the new.* pseudo-table, p1\r\n      ** is set to (n+2+i), where n and i are as defined previously. For\r\n      ** example, if the table on which triggers are being fired is\r\n      ** declared as:\r\n      **\r\n      **   CREATE TABLE t1(a, b);\r\n      **\r\n      ** Then p1 is interpreted as follows:\r\n      **\r\n      **   p1==0   ->    old.rowid     p1==3   ->    new.rowid\r\n      **   p1==1   ->    old.a         p1==4   ->    new.a\r\n      **   p1==2   ->    old.b         p1==5   ->    new.b       \r\n      */\r\n      Table *pTab = pExpr->pTab;\r\n      int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + pExpr->iColumn;\r\n\r\n      assert( pExpr->iTable==0 || pExpr->iTable==1 );\r\n      assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );\r\n      assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );\r\n      assert( p1>=0 && p1<(pTab->nCol*2+2) );\r\n\r\n      sqlite3VdbeAddOp2(v, OP_Param, p1, target);\r\n      VdbeComment((v, \"%s.%s -> $%d\",\r\n        (pExpr->iTable ? \"new\" : \"old\"),\r\n        (pExpr->iColumn<0 ? \"rowid\" : pExpr->pTab->aCol[pExpr->iColumn].zName),\r\n        target\r\n      ));\r\n\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n      /* If the column has REAL affinity, it may currently be stored as an\r\n      ** integer. Use OP_RealAffinity to make sure it is really real.  */\r\n      if( pExpr->iColumn>=0 \r\n       && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL\r\n      ){\r\n        sqlite3VdbeAddOp1(v, OP_RealAffinity, target);\r\n      }\r\n#endif\r\n      break;\r\n    }\r\n\r\n\r\n    /*\r\n    ** Form A:\r\n    **   CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END\r\n    **\r\n    ** Form B:\r\n    **   CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END\r\n    **\r\n    ** Form A is can be transformed into the equivalent form B as follows:\r\n    **   CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ...\r\n    **        WHEN x=eN THEN rN ELSE y END\r\n    **\r\n    ** X (if it exists) is in pExpr->pLeft.\r\n    ** Y is in pExpr->pRight.  The Y is also optional.  If there is no\r\n    ** ELSE clause and no other term matches, then the result of the\r\n    ** exprssion is NULL.\r\n    ** Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1].\r\n    **\r\n    ** The result of the expression is the Ri for the first matching Ei,\r\n    ** or if there is no matching Ei, the ELSE term Y, or if there is\r\n    ** no ELSE term, NULL.\r\n    */\r\n    default: assert( op==TK_CASE ); {\r\n      int endLabel;                     /* GOTO label for end of CASE stmt */\r\n      int nextCase;                     /* GOTO label for next WHEN clause */\r\n      int nExpr;                        /* 2x number of WHEN terms */\r\n      int i;                            /* Loop counter */\r\n      ExprList *pEList;                 /* List of WHEN terms */\r\n      struct ExprList_item *aListelem;  /* Array of WHEN terms */\r\n      Expr opCompare;                   /* The X==Ei expression */\r\n      Expr cacheX;                      /* Cached expression X */\r\n      Expr *pX;                         /* The X expression */\r\n      Expr *pTest = 0;                  /* X==Ei (form A) or just Ei (form B) */\r\n      VVA_ONLY( int iCacheLevel = pParse->iCacheLevel; )\r\n\r\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList );\r\n      assert((pExpr->x.pList->nExpr % 2) == 0);\r\n      assert(pExpr->x.pList->nExpr > 0);\r\n      pEList = pExpr->x.pList;\r\n      aListelem = pEList->a;\r\n      nExpr = pEList->nExpr;\r\n      endLabel = sqlite3VdbeMakeLabel(v);\r\n      if( (pX = pExpr->pLeft)!=0 ){\r\n        cacheX = *pX;\r\n        testcase( pX->op==TK_COLUMN );\r\n        testcase( pX->op==TK_REGISTER );\r\n        cacheX.iTable = sqlite3ExprCodeTemp(pParse, pX, &regFree1);\r\n        testcase( regFree1==0 );\r\n        cacheX.op = TK_REGISTER;\r\n        opCompare.op = TK_EQ;\r\n        opCompare.pLeft = &cacheX;\r\n        pTest = &opCompare;\r\n        /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001:\r\n        ** The value in regFree1 might get SCopy-ed into the file result.\r\n        ** So make sure that the regFree1 register is not reused for other\r\n        ** purposes and possibly overwritten.  */\r\n        regFree1 = 0;\r\n      }\r\n      for(i=0; i<nExpr; i=i+2){\r\n        sqlite3ExprCachePush(pParse);\r\n        if( pX ){\r\n          assert( pTest!=0 );\r\n          opCompare.pRight = aListelem[i].pExpr;\r\n        }else{\r\n          pTest = aListelem[i].pExpr;\r\n        }\r\n        nextCase = sqlite3VdbeMakeLabel(v);\r\n        testcase( pTest->op==TK_COLUMN );\r\n        sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);\r\n        testcase( aListelem[i+1].pExpr->op==TK_COLUMN );\r\n        testcase( aListelem[i+1].pExpr->op==TK_REGISTER );\r\n        sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, endLabel);\r\n        sqlite3ExprCachePop(pParse, 1);\r\n        sqlite3VdbeResolveLabel(v, nextCase);\r\n      }\r\n      if( pExpr->pRight ){\r\n        sqlite3ExprCachePush(pParse);\r\n        sqlite3ExprCode(pParse, pExpr->pRight, target);\r\n        sqlite3ExprCachePop(pParse, 1);\r\n      }else{\r\n        sqlite3VdbeAddOp2(v, OP_Null, 0, target);\r\n      }\r\n      assert( db->mallocFailed || pParse->nErr>0 \r\n           || pParse->iCacheLevel==iCacheLevel );\r\n      sqlite3VdbeResolveLabel(v, endLabel);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n    case TK_RAISE: {\r\n      assert( pExpr->affinity==OE_Rollback \r\n           || pExpr->affinity==OE_Abort\r\n           || pExpr->affinity==OE_Fail\r\n           || pExpr->affinity==OE_Ignore\r\n      );\r\n      if( !pParse->pTriggerTab ){\r\n        sqlite3ErrorMsg(pParse,\r\n                       \"RAISE() may only be used within a trigger-program\");\r\n        return 0;\r\n      }\r\n      if( pExpr->affinity==OE_Abort ){\r\n        sqlite3MayAbort(pParse);\r\n      }\r\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n      if( pExpr->affinity==OE_Ignore ){\r\n        sqlite3VdbeAddOp4(\r\n            v, OP_Halt, SQLITE_OK, OE_Ignore, 0, pExpr->u.zToken,0);\r\n      }else{\r\n        sqlite3HaltConstraint(pParse, pExpr->affinity, pExpr->u.zToken, 0);\r\n      }\r\n\r\n      break;\r\n    }\r\n#endif\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, regFree1);\r\n  sqlite3ReleaseTempReg(pParse, regFree2);\r\n  return inReg;\r\n}\r\n\r\n/*\r\n** Generate code to evaluate an expression and store the results\r\n** into a register.  Return the register number where the results\r\n** are stored.\r\n**\r\n** If the register is a temporary register that can be deallocated,\r\n** then write its number into *pReg.  If the result register is not\r\n** a temporary, then set *pReg to zero.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){\r\n  int r1 = sqlite3GetTempReg(pParse);\r\n  int r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);\r\n  if( r2==r1 ){\r\n    *pReg = r1;\r\n  }else{\r\n    sqlite3ReleaseTempReg(pParse, r1);\r\n    *pReg = 0;\r\n  }\r\n  return r2;\r\n}\r\n\r\n/*\r\n** Generate code that will evaluate expression pExpr and store the\r\n** results in register target.  The results are guaranteed to appear\r\n** in register target.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){\r\n  int inReg;\r\n\r\n  assert( target>0 && target<=pParse->nMem );\r\n  if( pExpr && pExpr->op==TK_REGISTER ){\r\n    sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target);\r\n  }else{\r\n    inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);\r\n    assert( pParse->pVdbe || pParse->db->mallocFailed );\r\n    if( inReg!=target && pParse->pVdbe ){\r\n      sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target);\r\n    }\r\n  }\r\n  return target;\r\n}\r\n\r\n/*\r\n** Generate code that evalutes the given expression and puts the result\r\n** in register target.\r\n**\r\n** Also make a copy of the expression results into another \"cache\" register\r\n** and modify the expression so that the next time it is evaluated,\r\n** the result is a copy of the cache register.\r\n**\r\n** This routine is used for expressions that are used multiple \r\n** times.  They are evaluated once and the results of the expression\r\n** are reused.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int inReg;\r\n  inReg = sqlite3ExprCode(pParse, pExpr, target);\r\n  assert( target>0 );\r\n  /* This routine is called for terms to INSERT or UPDATE.  And the only\r\n  ** other place where expressions can be converted into TK_REGISTER is\r\n  ** in WHERE clause processing.  So as currently implemented, there is\r\n  ** no way for a TK_REGISTER to exist here.  But it seems prudent to\r\n  ** keep the ALWAYS() in case the conditions above change with future\r\n  ** modifications or enhancements. */\r\n  if( ALWAYS(pExpr->op!=TK_REGISTER) ){  \r\n    int iMem;\r\n    iMem = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);\r\n    pExpr->iTable = iMem;\r\n    pExpr->op2 = pExpr->op;\r\n    pExpr->op = TK_REGISTER;\r\n  }\r\n  return inReg;\r\n}\r\n\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\n/*\r\n** Generate a human-readable explanation of an expression tree.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){\r\n  int op;                   /* The opcode being coded */\r\n  const char *zBinOp = 0;   /* Binary operator */\r\n  const char *zUniOp = 0;   /* Unary operator */\r\n  if( pExpr==0 ){\r\n    op = TK_NULL;\r\n  }else{\r\n    op = pExpr->op;\r\n  }\r\n  switch( op ){\r\n    case TK_AGG_COLUMN: {\r\n      sqlite3ExplainPrintf(pOut, \"AGG{%d:%d}\",\r\n            pExpr->iTable, pExpr->iColumn);\r\n      break;\r\n    }\r\n    case TK_COLUMN: {\r\n      if( pExpr->iTable<0 ){\r\n        /* This only happens when coding check constraints */\r\n        sqlite3ExplainPrintf(pOut, \"COLUMN(%d)\", pExpr->iColumn);\r\n      }else{\r\n        sqlite3ExplainPrintf(pOut, \"{%d:%d}\",\r\n                             pExpr->iTable, pExpr->iColumn);\r\n      }\r\n      break;\r\n    }\r\n    case TK_INTEGER: {\r\n      if( pExpr->flags & EP_IntValue ){\r\n        sqlite3ExplainPrintf(pOut, \"%d\", pExpr->u.iValue);\r\n      }else{\r\n        sqlite3ExplainPrintf(pOut, \"%s\", pExpr->u.zToken);\r\n      }\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n    case TK_FLOAT: {\r\n      sqlite3ExplainPrintf(pOut,\"%s\", pExpr->u.zToken);\r\n      break;\r\n    }\r\n#endif\r\n    case TK_STRING: {\r\n      sqlite3ExplainPrintf(pOut,\"%Q\", pExpr->u.zToken);\r\n      break;\r\n    }\r\n    case TK_NULL: {\r\n      sqlite3ExplainPrintf(pOut,\"NULL\");\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_BLOB_LITERAL\r\n    case TK_BLOB: {\r\n      sqlite3ExplainPrintf(pOut,\"%s\", pExpr->u.zToken);\r\n      break;\r\n    }\r\n#endif\r\n    case TK_VARIABLE: {\r\n      sqlite3ExplainPrintf(pOut,\"VARIABLE(%s,%d)\",\r\n                           pExpr->u.zToken, pExpr->iColumn);\r\n      break;\r\n    }\r\n    case TK_REGISTER: {\r\n      sqlite3ExplainPrintf(pOut,\"REGISTER(%d)\", pExpr->iTable);\r\n      break;\r\n    }\r\n    case TK_AS: {\r\n      sqlite3ExplainExpr(pOut, pExpr->pLeft);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_CAST\r\n    case TK_CAST: {\r\n      /* Expressions of the form:   CAST(pLeft AS token) */\r\n      const char *zAff = \"unk\";\r\n      switch( sqlite3AffinityType(pExpr->u.zToken) ){\r\n        case SQLITE_AFF_TEXT:    zAff = \"TEXT\";     break;\r\n        case SQLITE_AFF_NONE:    zAff = \"NONE\";     break;\r\n        case SQLITE_AFF_NUMERIC: zAff = \"NUMERIC\";  break;\r\n        case SQLITE_AFF_INTEGER: zAff = \"INTEGER\";  break;\r\n        case SQLITE_AFF_REAL:    zAff = \"REAL\";     break;\r\n      }\r\n      sqlite3ExplainPrintf(pOut, \"CAST-%s(\", zAff);\r\n      sqlite3ExplainExpr(pOut, pExpr->pLeft);\r\n      sqlite3ExplainPrintf(pOut, \")\");\r\n      break;\r\n    }\r\n#endif /* SQLITE_OMIT_CAST */\r\n    case TK_LT:      zBinOp = \"LT\";     break;\r\n    case TK_LE:      zBinOp = \"LE\";     break;\r\n    case TK_GT:      zBinOp = \"GT\";     break;\r\n    case TK_GE:      zBinOp = \"GE\";     break;\r\n    case TK_NE:      zBinOp = \"NE\";     break;\r\n    case TK_EQ:      zBinOp = \"EQ\";     break;\r\n    case TK_IS:      zBinOp = \"IS\";     break;\r\n    case TK_ISNOT:   zBinOp = \"ISNOT\";  break;\r\n    case TK_AND:     zBinOp = \"AND\";    break;\r\n    case TK_OR:      zBinOp = \"OR\";     break;\r\n    case TK_PLUS:    zBinOp = \"ADD\";    break;\r\n    case TK_STAR:    zBinOp = \"MUL\";    break;\r\n    case TK_MINUS:   zBinOp = \"SUB\";    break;\r\n    case TK_REM:     zBinOp = \"REM\";    break;\r\n    case TK_BITAND:  zBinOp = \"BITAND\"; break;\r\n    case TK_BITOR:   zBinOp = \"BITOR\";  break;\r\n    case TK_SLASH:   zBinOp = \"DIV\";    break;\r\n    case TK_LSHIFT:  zBinOp = \"LSHIFT\"; break;\r\n    case TK_RSHIFT:  zBinOp = \"RSHIFT\"; break;\r\n    case TK_CONCAT:  zBinOp = \"CONCAT\"; break;\r\n\r\n    case TK_UMINUS:  zUniOp = \"UMINUS\"; break;\r\n    case TK_UPLUS:   zUniOp = \"UPLUS\";  break;\r\n    case TK_BITNOT:  zUniOp = \"BITNOT\"; break;\r\n    case TK_NOT:     zUniOp = \"NOT\";    break;\r\n    case TK_ISNULL:  zUniOp = \"ISNULL\"; break;\r\n    case TK_NOTNULL: zUniOp = \"NOTNULL\"; break;\r\n\r\n    case TK_AGG_FUNCTION:\r\n    case TK_CONST_FUNC:\r\n    case TK_FUNCTION: {\r\n      ExprList *pFarg;       /* List of function arguments */\r\n      if( ExprHasAnyProperty(pExpr, EP_TokenOnly) ){\r\n        pFarg = 0;\r\n      }else{\r\n        pFarg = pExpr->x.pList;\r\n      }\r\n      sqlite3ExplainPrintf(pOut, \"%sFUNCTION:%s(\",\r\n                           op==TK_AGG_FUNCTION ? \"AGG_\" : \"\",\r\n                           pExpr->u.zToken);\r\n      if( pFarg ){\r\n        sqlite3ExplainExprList(pOut, pFarg);\r\n      }\r\n      sqlite3ExplainPrintf(pOut, \")\");\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case TK_EXISTS: {\r\n      sqlite3ExplainPrintf(pOut, \"EXISTS(\");\r\n      sqlite3ExplainSelect(pOut, pExpr->x.pSelect);\r\n      sqlite3ExplainPrintf(pOut,\")\");\r\n      break;\r\n    }\r\n    case TK_SELECT: {\r\n      sqlite3ExplainPrintf(pOut, \"(\");\r\n      sqlite3ExplainSelect(pOut, pExpr->x.pSelect);\r\n      sqlite3ExplainPrintf(pOut, \")\");\r\n      break;\r\n    }\r\n    case TK_IN: {\r\n      sqlite3ExplainPrintf(pOut, \"IN(\");\r\n      sqlite3ExplainExpr(pOut, pExpr->pLeft);\r\n      sqlite3ExplainPrintf(pOut, \",\");\r\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n        sqlite3ExplainSelect(pOut, pExpr->x.pSelect);\r\n      }else{\r\n        sqlite3ExplainExprList(pOut, pExpr->x.pList);\r\n      }\r\n      sqlite3ExplainPrintf(pOut, \")\");\r\n      break;\r\n    }\r\n#endif /* SQLITE_OMIT_SUBQUERY */\r\n\r\n    /*\r\n    **    x BETWEEN y AND z\r\n    **\r\n    ** This is equivalent to\r\n    **\r\n    **    x>=y AND x<=z\r\n    **\r\n    ** X is stored in pExpr->pLeft.\r\n    ** Y is stored in pExpr->pList->a[0].pExpr.\r\n    ** Z is stored in pExpr->pList->a[1].pExpr.\r\n    */\r\n    case TK_BETWEEN: {\r\n      Expr *pX = pExpr->pLeft;\r\n      Expr *pY = pExpr->x.pList->a[0].pExpr;\r\n      Expr *pZ = pExpr->x.pList->a[1].pExpr;\r\n      sqlite3ExplainPrintf(pOut, \"BETWEEN(\");\r\n      sqlite3ExplainExpr(pOut, pX);\r\n      sqlite3ExplainPrintf(pOut, \",\");\r\n      sqlite3ExplainExpr(pOut, pY);\r\n      sqlite3ExplainPrintf(pOut, \",\");\r\n      sqlite3ExplainExpr(pOut, pZ);\r\n      sqlite3ExplainPrintf(pOut, \")\");\r\n      break;\r\n    }\r\n    case TK_TRIGGER: {\r\n      /* If the opcode is TK_TRIGGER, then the expression is a reference\r\n      ** to a column in the new.* or old.* pseudo-tables available to\r\n      ** trigger programs. In this case Expr.iTable is set to 1 for the\r\n      ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn\r\n      ** is set to the column of the pseudo-table to read, or to -1 to\r\n      ** read the rowid field.\r\n      */\r\n      sqlite3ExplainPrintf(pOut, \"%s(%d)\", \r\n          pExpr->iTable ? \"NEW\" : \"OLD\", pExpr->iColumn);\r\n      break;\r\n    }\r\n    case TK_CASE: {\r\n      sqlite3ExplainPrintf(pOut, \"CASE(\");\r\n      sqlite3ExplainExpr(pOut, pExpr->pLeft);\r\n      sqlite3ExplainPrintf(pOut, \",\");\r\n      sqlite3ExplainExprList(pOut, pExpr->x.pList);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n    case TK_RAISE: {\r\n      const char *zType = \"unk\";\r\n      switch( pExpr->affinity ){\r\n        case OE_Rollback:   zType = \"rollback\";  break;\r\n        case OE_Abort:      zType = \"abort\";     break;\r\n        case OE_Fail:       zType = \"fail\";      break;\r\n        case OE_Ignore:     zType = \"ignore\";    break;\r\n      }\r\n      sqlite3ExplainPrintf(pOut, \"RAISE-%s(%s)\", zType, pExpr->u.zToken);\r\n      break;\r\n    }\r\n#endif\r\n  }\r\n  if( zBinOp ){\r\n    sqlite3ExplainPrintf(pOut,\"%s(\", zBinOp);\r\n    sqlite3ExplainExpr(pOut, pExpr->pLeft);\r\n    sqlite3ExplainPrintf(pOut,\",\");\r\n    sqlite3ExplainExpr(pOut, pExpr->pRight);\r\n    sqlite3ExplainPrintf(pOut,\")\");\r\n  }else if( zUniOp ){\r\n    sqlite3ExplainPrintf(pOut,\"%s(\", zUniOp);\r\n    sqlite3ExplainExpr(pOut, pExpr->pLeft);\r\n    sqlite3ExplainPrintf(pOut,\")\");\r\n  }\r\n}\r\n#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */\r\n\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\n/*\r\n** Generate a human-readable explanation of an expression list.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExplainExprList(Vdbe *pOut, ExprList *pList){\r\n  int i;\r\n  if( pList==0 || pList->nExpr==0 ){\r\n    sqlite3ExplainPrintf(pOut, \"(empty-list)\");\r\n    return;\r\n  }else if( pList->nExpr==1 ){\r\n    sqlite3ExplainExpr(pOut, pList->a[0].pExpr);\r\n  }else{\r\n    sqlite3ExplainPush(pOut);\r\n    for(i=0; i<pList->nExpr; i++){\r\n      sqlite3ExplainPrintf(pOut, \"item[%d] = \", i);\r\n      sqlite3ExplainPush(pOut);\r\n      sqlite3ExplainExpr(pOut, pList->a[i].pExpr);\r\n      sqlite3ExplainPop(pOut);\r\n      if( i<pList->nExpr-1 ){\r\n        sqlite3ExplainNL(pOut);\r\n      }\r\n    }\r\n    sqlite3ExplainPop(pOut);\r\n  }\r\n}\r\n#endif /* SQLITE_DEBUG */\r\n\r\n/*\r\n** Return TRUE if pExpr is an constant expression that is appropriate\r\n** for factoring out of a loop.  Appropriate expressions are:\r\n**\r\n**    *  Any expression that evaluates to two or more opcodes.\r\n**\r\n**    *  Any OP_Integer, OP_Real, OP_String, OP_Blob, OP_Null, \r\n**       or OP_Variable that does not need to be placed in a \r\n**       specific register.\r\n**\r\n** There is no point in factoring out single-instruction constant\r\n** expressions that need to be placed in a particular register.  \r\n** We could factor them out, but then we would end up adding an\r\n** OP_SCopy instruction to move the value into the correct register\r\n** later.  We might as well just use the original instruction and\r\n** avoid the OP_SCopy.\r\n*/\r\nstatic int isAppropriateForFactoring(Expr *p){\r\n  if( !sqlite3ExprIsConstantNotJoin(p) ){\r\n    return 0;  /* Only constant expressions are appropriate for factoring */\r\n  }\r\n  if( (p->flags & EP_FixedDest)==0 ){\r\n    return 1;  /* Any constant without a fixed destination is appropriate */\r\n  }\r\n  while( p->op==TK_UPLUS ) p = p->pLeft;\r\n  switch( p->op ){\r\n#ifndef SQLITE_OMIT_BLOB_LITERAL\r\n    case TK_BLOB:\r\n#endif\r\n    case TK_VARIABLE:\r\n    case TK_INTEGER:\r\n    case TK_FLOAT:\r\n    case TK_NULL:\r\n    case TK_STRING: {\r\n      testcase( p->op==TK_BLOB );\r\n      testcase( p->op==TK_VARIABLE );\r\n      testcase( p->op==TK_INTEGER );\r\n      testcase( p->op==TK_FLOAT );\r\n      testcase( p->op==TK_NULL );\r\n      testcase( p->op==TK_STRING );\r\n      /* Single-instruction constants with a fixed destination are\r\n      ** better done in-line.  If we factor them, they will just end\r\n      ** up generating an OP_SCopy to move the value to the destination\r\n      ** register. */\r\n      return 0;\r\n    }\r\n    case TK_UMINUS: {\r\n      if( p->pLeft->op==TK_FLOAT || p->pLeft->op==TK_INTEGER ){\r\n        return 0;\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      break;\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n\r\n/*\r\n** If pExpr is a constant expression that is appropriate for\r\n** factoring out of a loop, then evaluate the expression\r\n** into a register and convert the expression into a TK_REGISTER\r\n** expression.\r\n*/\r\nstatic int evalConstExpr(Walker *pWalker, Expr *pExpr){\r\n  Parse *pParse = pWalker->pParse;\r\n  switch( pExpr->op ){\r\n    case TK_IN:\r\n    case TK_REGISTER: {\r\n      return WRC_Prune;\r\n    }\r\n    case TK_FUNCTION:\r\n    case TK_AGG_FUNCTION:\r\n    case TK_CONST_FUNC: {\r\n      /* The arguments to a function have a fixed destination.\r\n      ** Mark them this way to avoid generated unneeded OP_SCopy\r\n      ** instructions. \r\n      */\r\n      ExprList *pList = pExpr->x.pList;\r\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\r\n      if( pList ){\r\n        int i = pList->nExpr;\r\n        struct ExprList_item *pItem = pList->a;\r\n        for(; i>0; i--, pItem++){\r\n          if( ALWAYS(pItem->pExpr) ) pItem->pExpr->flags |= EP_FixedDest;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  if( isAppropriateForFactoring(pExpr) ){\r\n    int r1 = ++pParse->nMem;\r\n    int r2;\r\n    r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);\r\n    if( NEVER(r1!=r2) ) sqlite3ReleaseTempReg(pParse, r1);\r\n    pExpr->op2 = pExpr->op;\r\n    pExpr->op = TK_REGISTER;\r\n    pExpr->iTable = r2;\r\n    return WRC_Prune;\r\n  }\r\n  return WRC_Continue;\r\n}\r\n\r\n/*\r\n** Preevaluate constant subexpressions within pExpr and store the\r\n** results in registers.  Modify pExpr so that the constant subexpresions\r\n** are TK_REGISTER opcodes that refer to the precomputed values.\r\n**\r\n** This routine is a no-op if the jump to the cookie-check code has\r\n** already occur.  Since the cookie-check jump is generated prior to\r\n** any other serious processing, this check ensures that there is no\r\n** way to accidently bypass the constant initializations.\r\n**\r\n** This routine is also a no-op if the SQLITE_FactorOutConst optimization\r\n** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS)\r\n** interface.  This allows test logic to verify that the same answer is\r\n** obtained for queries regardless of whether or not constants are\r\n** precomputed into registers or if they are inserted in-line.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){\r\n  Walker w;\r\n  if( pParse->cookieGoto ) return;\r\n  if( (pParse->db->flags & SQLITE_FactorOutConst)!=0 ) return;\r\n  w.xExprCallback = evalConstExpr;\r\n  w.xSelectCallback = 0;\r\n  w.pParse = pParse;\r\n  sqlite3WalkExpr(&w, pExpr);\r\n}\r\n\r\n\r\n/*\r\n** Generate code that pushes the value of every element of the given\r\n** expression list into a sequence of registers beginning at target.\r\n**\r\n** Return the number of elements evaluated.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCodeExprList(\r\n  Parse *pParse,     /* Parsing context */\r\n  ExprList *pList,   /* The expression list to be coded */\r\n  int target,        /* Where to write results */\r\n  int doHardCopy     /* Make a hard copy of every element */\r\n){\r\n  struct ExprList_item *pItem;\r\n  int i, n;\r\n  assert( pList!=0 );\r\n  assert( target>0 );\r\n  assert( pParse->pVdbe!=0 );  /* Never gets this far otherwise */\r\n  n = pList->nExpr;\r\n  for(pItem=pList->a, i=0; i<n; i++, pItem++){\r\n    Expr *pExpr = pItem->pExpr;\r\n    int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);\r\n    if( inReg!=target+i ){\r\n      sqlite3VdbeAddOp2(pParse->pVdbe, doHardCopy ? OP_Copy : OP_SCopy,\r\n                        inReg, target+i);\r\n    }\r\n  }\r\n  return n;\r\n}\r\n\r\n/*\r\n** Generate code for a BETWEEN operator.\r\n**\r\n**    x BETWEEN y AND z\r\n**\r\n** The above is equivalent to \r\n**\r\n**    x>=y AND x<=z\r\n**\r\n** Code it as such, taking care to do the common subexpression\r\n** elementation of x.\r\n*/\r\nstatic void exprCodeBetween(\r\n  Parse *pParse,    /* Parsing and code generating context */\r\n  Expr *pExpr,      /* The BETWEEN expression */\r\n  int dest,         /* Jump here if the jump is taken */\r\n  int jumpIfTrue,   /* Take the jump if the BETWEEN is true */\r\n  int jumpIfNull    /* Take the jump if the BETWEEN is NULL */\r\n){\r\n  Expr exprAnd;     /* The AND operator in  x>=y AND x<=z  */\r\n  Expr compLeft;    /* The  x>=y  term */\r\n  Expr compRight;   /* The  x<=z  term */\r\n  Expr exprX;       /* The  x  subexpression */\r\n  int regFree1 = 0; /* Temporary use register */\r\n\r\n  assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\r\n  exprX = *pExpr->pLeft;\r\n  exprAnd.op = TK_AND;\r\n  exprAnd.pLeft = &compLeft;\r\n  exprAnd.pRight = &compRight;\r\n  compLeft.op = TK_GE;\r\n  compLeft.pLeft = &exprX;\r\n  compLeft.pRight = pExpr->x.pList->a[0].pExpr;\r\n  compRight.op = TK_LE;\r\n  compRight.pLeft = &exprX;\r\n  compRight.pRight = pExpr->x.pList->a[1].pExpr;\r\n  exprX.iTable = sqlite3ExprCodeTemp(pParse, &exprX, &regFree1);\r\n  exprX.op = TK_REGISTER;\r\n  if( jumpIfTrue ){\r\n    sqlite3ExprIfTrue(pParse, &exprAnd, dest, jumpIfNull);\r\n  }else{\r\n    sqlite3ExprIfFalse(pParse, &exprAnd, dest, jumpIfNull);\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, regFree1);\r\n\r\n  /* Ensure adequate test coverage */\r\n  testcase( jumpIfTrue==0 && jumpIfNull==0 && regFree1==0 );\r\n  testcase( jumpIfTrue==0 && jumpIfNull==0 && regFree1!=0 );\r\n  testcase( jumpIfTrue==0 && jumpIfNull!=0 && regFree1==0 );\r\n  testcase( jumpIfTrue==0 && jumpIfNull!=0 && regFree1!=0 );\r\n  testcase( jumpIfTrue!=0 && jumpIfNull==0 && regFree1==0 );\r\n  testcase( jumpIfTrue!=0 && jumpIfNull==0 && regFree1!=0 );\r\n  testcase( jumpIfTrue!=0 && jumpIfNull!=0 && regFree1==0 );\r\n  testcase( jumpIfTrue!=0 && jumpIfNull!=0 && regFree1!=0 );\r\n}\r\n\r\n/*\r\n** Generate code for a boolean expression such that a jump is made\r\n** to the label \"dest\" if the expression is true but execution\r\n** continues straight thru if the expression is false.\r\n**\r\n** If the expression evaluates to NULL (neither true nor false), then\r\n** take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL.\r\n**\r\n** This code depends on the fact that certain token values (ex: TK_EQ)\r\n** are the same as opcode values (ex: OP_Eq) that implement the corresponding\r\n** operation.  Special comments in vdbe.c and the mkopcodeh.awk script in\r\n** the make process cause these values to align.  Assert()s in the code\r\n** below verify that the numbers are aligned correctly.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int op = 0;\r\n  int regFree1 = 0;\r\n  int regFree2 = 0;\r\n  int r1, r2;\r\n\r\n  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );\r\n  if( NEVER(v==0) )     return;  /* Existance of VDBE checked by caller */\r\n  if( NEVER(pExpr==0) ) return;  /* No way this can happen */\r\n  op = pExpr->op;\r\n  switch( op ){\r\n    case TK_AND: {\r\n      int d2 = sqlite3VdbeMakeLabel(v);\r\n      testcase( jumpIfNull==0 );\r\n      sqlite3ExprCachePush(pParse);\r\n      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);\r\n      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);\r\n      sqlite3VdbeResolveLabel(v, d2);\r\n      sqlite3ExprCachePop(pParse, 1);\r\n      break;\r\n    }\r\n    case TK_OR: {\r\n      testcase( jumpIfNull==0 );\r\n      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);\r\n      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);\r\n      break;\r\n    }\r\n    case TK_NOT: {\r\n      testcase( jumpIfNull==0 );\r\n      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);\r\n      break;\r\n    }\r\n    case TK_LT:\r\n    case TK_LE:\r\n    case TK_GT:\r\n    case TK_GE:\r\n    case TK_NE:\r\n    case TK_EQ: {\r\n      assert( TK_LT==OP_Lt );\r\n      assert( TK_LE==OP_Le );\r\n      assert( TK_GT==OP_Gt );\r\n      assert( TK_GE==OP_Ge );\r\n      assert( TK_EQ==OP_Eq );\r\n      assert( TK_NE==OP_Ne );\r\n      testcase( op==TK_LT );\r\n      testcase( op==TK_LE );\r\n      testcase( op==TK_GT );\r\n      testcase( op==TK_GE );\r\n      testcase( op==TK_EQ );\r\n      testcase( op==TK_NE );\r\n      testcase( jumpIfNull==0 );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\r\n                  r1, r2, dest, jumpIfNull);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_IS:\r\n    case TK_ISNOT: {\r\n      testcase( op==TK_IS );\r\n      testcase( op==TK_ISNOT );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      op = (op==TK_IS) ? TK_EQ : TK_NE;\r\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\r\n                  r1, r2, dest, SQLITE_NULLEQ);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_ISNULL:\r\n    case TK_NOTNULL: {\r\n      assert( TK_ISNULL==OP_IsNull );\r\n      assert( TK_NOTNULL==OP_NotNull );\r\n      testcase( op==TK_ISNULL );\r\n      testcase( op==TK_NOTNULL );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      sqlite3VdbeAddOp2(v, op, r1, dest);\r\n      testcase( regFree1==0 );\r\n      break;\r\n    }\r\n    case TK_BETWEEN: {\r\n      testcase( jumpIfNull==0 );\r\n      exprCodeBetween(pParse, pExpr, dest, 1, jumpIfNull);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case TK_IN: {\r\n      int destIfFalse = sqlite3VdbeMakeLabel(v);\r\n      int destIfNull = jumpIfNull ? dest : destIfFalse;\r\n      sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, dest);\r\n      sqlite3VdbeResolveLabel(v, destIfFalse);\r\n      break;\r\n    }\r\n#endif\r\n    default: {\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);\r\n      sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);\r\n      testcase( regFree1==0 );\r\n      testcase( jumpIfNull==0 );\r\n      break;\r\n    }\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, regFree1);\r\n  sqlite3ReleaseTempReg(pParse, regFree2);  \r\n}\r\n\r\n/*\r\n** Generate code for a boolean expression such that a jump is made\r\n** to the label \"dest\" if the expression is false but execution\r\n** continues straight thru if the expression is true.\r\n**\r\n** If the expression evaluates to NULL (neither true nor false) then\r\n** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull\r\n** is 0.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int op = 0;\r\n  int regFree1 = 0;\r\n  int regFree2 = 0;\r\n  int r1, r2;\r\n\r\n  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );\r\n  if( NEVER(v==0) ) return; /* Existance of VDBE checked by caller */\r\n  if( pExpr==0 )    return;\r\n\r\n  /* The value of pExpr->op and op are related as follows:\r\n  **\r\n  **       pExpr->op            op\r\n  **       ---------          ----------\r\n  **       TK_ISNULL          OP_NotNull\r\n  **       TK_NOTNULL         OP_IsNull\r\n  **       TK_NE              OP_Eq\r\n  **       TK_EQ              OP_Ne\r\n  **       TK_GT              OP_Le\r\n  **       TK_LE              OP_Gt\r\n  **       TK_GE              OP_Lt\r\n  **       TK_LT              OP_Ge\r\n  **\r\n  ** For other values of pExpr->op, op is undefined and unused.\r\n  ** The value of TK_ and OP_ constants are arranged such that we\r\n  ** can compute the mapping above using the following expression.\r\n  ** Assert()s verify that the computation is correct.\r\n  */\r\n  op = ((pExpr->op+(TK_ISNULL&1))^1)-(TK_ISNULL&1);\r\n\r\n  /* Verify correct alignment of TK_ and OP_ constants\r\n  */\r\n  assert( pExpr->op!=TK_ISNULL || op==OP_NotNull );\r\n  assert( pExpr->op!=TK_NOTNULL || op==OP_IsNull );\r\n  assert( pExpr->op!=TK_NE || op==OP_Eq );\r\n  assert( pExpr->op!=TK_EQ || op==OP_Ne );\r\n  assert( pExpr->op!=TK_LT || op==OP_Ge );\r\n  assert( pExpr->op!=TK_LE || op==OP_Gt );\r\n  assert( pExpr->op!=TK_GT || op==OP_Le );\r\n  assert( pExpr->op!=TK_GE || op==OP_Lt );\r\n\r\n  switch( pExpr->op ){\r\n    case TK_AND: {\r\n      testcase( jumpIfNull==0 );\r\n      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);\r\n      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);\r\n      break;\r\n    }\r\n    case TK_OR: {\r\n      int d2 = sqlite3VdbeMakeLabel(v);\r\n      testcase( jumpIfNull==0 );\r\n      sqlite3ExprCachePush(pParse);\r\n      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);\r\n      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);\r\n      sqlite3VdbeResolveLabel(v, d2);\r\n      sqlite3ExprCachePop(pParse, 1);\r\n      break;\r\n    }\r\n    case TK_NOT: {\r\n      testcase( jumpIfNull==0 );\r\n      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);\r\n      break;\r\n    }\r\n    case TK_LT:\r\n    case TK_LE:\r\n    case TK_GT:\r\n    case TK_GE:\r\n    case TK_NE:\r\n    case TK_EQ: {\r\n      testcase( op==TK_LT );\r\n      testcase( op==TK_LE );\r\n      testcase( op==TK_GT );\r\n      testcase( op==TK_GE );\r\n      testcase( op==TK_EQ );\r\n      testcase( op==TK_NE );\r\n      testcase( jumpIfNull==0 );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\r\n                  r1, r2, dest, jumpIfNull);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_IS:\r\n    case TK_ISNOT: {\r\n      testcase( pExpr->op==TK_IS );\r\n      testcase( pExpr->op==TK_ISNOT );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\r\n      op = (pExpr->op==TK_IS) ? TK_NE : TK_EQ;\r\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\r\n                  r1, r2, dest, SQLITE_NULLEQ);\r\n      testcase( regFree1==0 );\r\n      testcase( regFree2==0 );\r\n      break;\r\n    }\r\n    case TK_ISNULL:\r\n    case TK_NOTNULL: {\r\n      testcase( op==TK_ISNULL );\r\n      testcase( op==TK_NOTNULL );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\r\n      sqlite3VdbeAddOp2(v, op, r1, dest);\r\n      testcase( regFree1==0 );\r\n      break;\r\n    }\r\n    case TK_BETWEEN: {\r\n      testcase( jumpIfNull==0 );\r\n      exprCodeBetween(pParse, pExpr, dest, 0, jumpIfNull);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case TK_IN: {\r\n      if( jumpIfNull ){\r\n        sqlite3ExprCodeIN(pParse, pExpr, dest, dest);\r\n      }else{\r\n        int destIfNull = sqlite3VdbeMakeLabel(v);\r\n        sqlite3ExprCodeIN(pParse, pExpr, dest, destIfNull);\r\n        sqlite3VdbeResolveLabel(v, destIfNull);\r\n      }\r\n      break;\r\n    }\r\n#endif\r\n    default: {\r\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);\r\n      sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);\r\n      testcase( regFree1==0 );\r\n      testcase( jumpIfNull==0 );\r\n      break;\r\n    }\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, regFree1);\r\n  sqlite3ReleaseTempReg(pParse, regFree2);\r\n}\r\n\r\n/*\r\n** Do a deep comparison of two expression trees.  Return 0 if the two\r\n** expressions are completely identical.  Return 1 if they differ only\r\n** by a COLLATE operator at the top level.  Return 2 if there are differences\r\n** other than the top-level COLLATE operator.\r\n**\r\n** Sometimes this routine will return 2 even if the two expressions\r\n** really are equivalent.  If we cannot prove that the expressions are\r\n** identical, we return 2 just to be safe.  So if this routine\r\n** returns 2, then you do not really know for certain if the two\r\n** expressions are the same.  But if you get a 0 or 1 return, then you\r\n** can be sure the expressions are the same.  In the places where\r\n** this routine is used, it does not hurt to get an extra 2 - that\r\n** just might result in some slightly slower code.  But returning\r\n** an incorrect 0 or 1 could lead to a malfunction.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB){\r\n  if( pA==0||pB==0 ){\r\n    return pB==pA ? 0 : 2;\r\n  }\r\n  assert( !ExprHasAnyProperty(pA, EP_TokenOnly|EP_Reduced) );\r\n  assert( !ExprHasAnyProperty(pB, EP_TokenOnly|EP_Reduced) );\r\n  if( ExprHasProperty(pA, EP_xIsSelect) || ExprHasProperty(pB, EP_xIsSelect) ){\r\n    return 2;\r\n  }\r\n  if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;\r\n  if( pA->op!=pB->op ) return 2;\r\n  if( sqlite3ExprCompare(pA->pLeft, pB->pLeft) ) return 2;\r\n  if( sqlite3ExprCompare(pA->pRight, pB->pRight) ) return 2;\r\n  if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList) ) return 2;\r\n  if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 2;\r\n  if( ExprHasProperty(pA, EP_IntValue) ){\r\n    if( !ExprHasProperty(pB, EP_IntValue) || pA->u.iValue!=pB->u.iValue ){\r\n      return 2;\r\n    }\r\n  }else if( pA->op!=TK_COLUMN && pA->u.zToken ){\r\n    if( ExprHasProperty(pB, EP_IntValue) || NEVER(pB->u.zToken==0) ) return 2;\r\n    if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){\r\n      return 2;\r\n    }\r\n  }\r\n  if( (pA->flags & EP_ExpCollate)!=(pB->flags & EP_ExpCollate) ) return 1;\r\n  if( (pA->flags & EP_ExpCollate)!=0 && pA->pColl!=pB->pColl ) return 2;\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Compare two ExprList objects.  Return 0 if they are identical and \r\n** non-zero if they differ in any way.\r\n**\r\n** This routine might return non-zero for equivalent ExprLists.  The\r\n** only consequence will be disabled optimizations.  But this routine\r\n** must never return 0 if the two ExprList objects are different, or\r\n** a malfunction will result.\r\n**\r\n** Two NULL pointers are considered to be the same.  But a NULL pointer\r\n** always differs from a non-NULL pointer.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB){\r\n  int i;\r\n  if( pA==0 && pB==0 ) return 0;\r\n  if( pA==0 || pB==0 ) return 1;\r\n  if( pA->nExpr!=pB->nExpr ) return 1;\r\n  for(i=0; i<pA->nExpr; i++){\r\n    Expr *pExprA = pA->a[i].pExpr;\r\n    Expr *pExprB = pB->a[i].pExpr;\r\n    if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;\r\n    if( sqlite3ExprCompare(pExprA, pExprB) ) return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Add a new element to the pAggInfo->aCol[] array.  Return the index of\r\n** the new element.  Return a negative number if malloc fails.\r\n*/\r\nstatic int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){\r\n  int i;\r\n  pInfo->aCol = sqlite3ArrayAllocate(\r\n       db,\r\n       pInfo->aCol,\r\n       sizeof(pInfo->aCol[0]),\r\n       &pInfo->nColumn,\r\n       &i\r\n  );\r\n  return i;\r\n}    \r\n\r\n/*\r\n** Add a new element to the pAggInfo->aFunc[] array.  Return the index of\r\n** the new element.  Return a negative number if malloc fails.\r\n*/\r\nstatic int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){\r\n  int i;\r\n  pInfo->aFunc = sqlite3ArrayAllocate(\r\n       db, \r\n       pInfo->aFunc,\r\n       sizeof(pInfo->aFunc[0]),\r\n       &pInfo->nFunc,\r\n       &i\r\n  );\r\n  return i;\r\n}    \r\n\r\n/*\r\n** This is the xExprCallback for a tree walker.  It is used to\r\n** implement sqlite3ExprAnalyzeAggregates().  See sqlite3ExprAnalyzeAggregates\r\n** for additional information.\r\n*/\r\nstatic int analyzeAggregate(Walker *pWalker, Expr *pExpr){\r\n  int i;\r\n  NameContext *pNC = pWalker->u.pNC;\r\n  Parse *pParse = pNC->pParse;\r\n  SrcList *pSrcList = pNC->pSrcList;\r\n  AggInfo *pAggInfo = pNC->pAggInfo;\r\n\r\n  switch( pExpr->op ){\r\n    case TK_AGG_COLUMN:\r\n    case TK_COLUMN: {\r\n      testcase( pExpr->op==TK_AGG_COLUMN );\r\n      testcase( pExpr->op==TK_COLUMN );\r\n      /* Check to see if the column is in one of the tables in the FROM\r\n      ** clause of the aggregate query */\r\n      if( ALWAYS(pSrcList!=0) ){\r\n        struct SrcList_item *pItem = pSrcList->a;\r\n        for(i=0; i<pSrcList->nSrc; i++, pItem++){\r\n          struct AggInfo_col *pCol;\r\n          assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );\r\n          if( pExpr->iTable==pItem->iCursor ){\r\n            /* If we reach this point, it means that pExpr refers to a table\r\n            ** that is in the FROM clause of the aggregate query.  \r\n            **\r\n            ** Make an entry for the column in pAggInfo->aCol[] if there\r\n            ** is not an entry there already.\r\n            */\r\n            int k;\r\n            pCol = pAggInfo->aCol;\r\n            for(k=0; k<pAggInfo->nColumn; k++, pCol++){\r\n              if( pCol->iTable==pExpr->iTable &&\r\n                  pCol->iColumn==pExpr->iColumn ){\r\n                break;\r\n              }\r\n            }\r\n            if( (k>=pAggInfo->nColumn)\r\n             && (k = addAggInfoColumn(pParse->db, pAggInfo))>=0 \r\n            ){\r\n              pCol = &pAggInfo->aCol[k];\r\n              pCol->pTab = pExpr->pTab;\r\n              pCol->iTable = pExpr->iTable;\r\n              pCol->iColumn = pExpr->iColumn;\r\n              pCol->iMem = ++pParse->nMem;\r\n              pCol->iSorterColumn = -1;\r\n              pCol->pExpr = pExpr;\r\n              if( pAggInfo->pGroupBy ){\r\n                int j, n;\r\n                ExprList *pGB = pAggInfo->pGroupBy;\r\n                struct ExprList_item *pTerm = pGB->a;\r\n                n = pGB->nExpr;\r\n                for(j=0; j<n; j++, pTerm++){\r\n                  Expr *pE = pTerm->pExpr;\r\n                  if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&\r\n                      pE->iColumn==pExpr->iColumn ){\r\n                    pCol->iSorterColumn = j;\r\n                    break;\r\n                  }\r\n                }\r\n              }\r\n              if( pCol->iSorterColumn<0 ){\r\n                pCol->iSorterColumn = pAggInfo->nSortingColumn++;\r\n              }\r\n            }\r\n            /* There is now an entry for pExpr in pAggInfo->aCol[] (either\r\n            ** because it was there before or because we just created it).\r\n            ** Convert the pExpr to be a TK_AGG_COLUMN referring to that\r\n            ** pAggInfo->aCol[] entry.\r\n            */\r\n            ExprSetIrreducible(pExpr);\r\n            pExpr->pAggInfo = pAggInfo;\r\n            pExpr->op = TK_AGG_COLUMN;\r\n            pExpr->iAgg = (i16)k;\r\n            break;\r\n          } /* endif pExpr->iTable==pItem->iCursor */\r\n        } /* end loop over pSrcList */\r\n      }\r\n      return WRC_Prune;\r\n    }\r\n    case TK_AGG_FUNCTION: {\r\n      /* The pNC->nDepth==0 test causes aggregate functions in subqueries\r\n      ** to be ignored */\r\n      if( pNC->nDepth==0 ){\r\n        /* Check to see if pExpr is a duplicate of another aggregate \r\n        ** function that is already in the pAggInfo structure\r\n        */\r\n        struct AggInfo_func *pItem = pAggInfo->aFunc;\r\n        for(i=0; i<pAggInfo->nFunc; i++, pItem++){\r\n          if( sqlite3ExprCompare(pItem->pExpr, pExpr)==0 ){\r\n            break;\r\n          }\r\n        }\r\n        if( i>=pAggInfo->nFunc ){\r\n          /* pExpr is original.  Make a new entry in pAggInfo->aFunc[]\r\n          */\r\n          u8 enc = ENC(pParse->db);\r\n          i = addAggInfoFunc(pParse->db, pAggInfo);\r\n          if( i>=0 ){\r\n            assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\r\n            pItem = &pAggInfo->aFunc[i];\r\n            pItem->pExpr = pExpr;\r\n            pItem->iMem = ++pParse->nMem;\r\n            assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n            pItem->pFunc = sqlite3FindFunction(pParse->db,\r\n                   pExpr->u.zToken, sqlite3Strlen30(pExpr->u.zToken),\r\n                   pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0);\r\n            if( pExpr->flags & EP_Distinct ){\r\n              pItem->iDistinct = pParse->nTab++;\r\n            }else{\r\n              pItem->iDistinct = -1;\r\n            }\r\n          }\r\n        }\r\n        /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry\r\n        */\r\n        assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );\r\n        ExprSetIrreducible(pExpr);\r\n        pExpr->iAgg = (i16)i;\r\n        pExpr->pAggInfo = pAggInfo;\r\n        return WRC_Prune;\r\n      }\r\n    }\r\n  }\r\n  return WRC_Continue;\r\n}\r\nstatic int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){\r\n  NameContext *pNC = pWalker->u.pNC;\r\n  if( pNC->nDepth==0 ){\r\n    pNC->nDepth++;\r\n    sqlite3WalkSelect(pWalker, pSelect);\r\n    pNC->nDepth--;\r\n    return WRC_Prune;\r\n  }else{\r\n    return WRC_Continue;\r\n  }\r\n}\r\n\r\n/*\r\n** Analyze the given expression looking for aggregate functions and\r\n** for variables that need to be added to the pParse->aAgg[] array.\r\n** Make additional entries to the pParse->aAgg[] array as necessary.\r\n**\r\n** This routine should only be called after the expression has been\r\n** analyzed by sqlite3ResolveExprNames().\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){\r\n  Walker w;\r\n  w.xExprCallback = analyzeAggregate;\r\n  w.xSelectCallback = analyzeAggregatesInSelect;\r\n  w.u.pNC = pNC;\r\n  assert( pNC->pSrcList!=0 );\r\n  sqlite3WalkExpr(&w, pExpr);\r\n}\r\n\r\n/*\r\n** Call sqlite3ExprAnalyzeAggregates() for every expression in an\r\n** expression list.  Return the number of errors.\r\n**\r\n** If an error is found, the analysis is cut short.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){\r\n  struct ExprList_item *pItem;\r\n  int i;\r\n  if( pList ){\r\n    for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){\r\n      sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate a single new register for use to hold some intermediate result.\r\n*/\r\nSQLITE_PRIVATE int sqlite3GetTempReg(Parse *pParse){\r\n  if( pParse->nTempReg==0 ){\r\n    return ++pParse->nMem;\r\n  }\r\n  return pParse->aTempReg[--pParse->nTempReg];\r\n}\r\n\r\n/*\r\n** Deallocate a register, making available for reuse for some other\r\n** purpose.\r\n**\r\n** If a register is currently being used by the column cache, then\r\n** the dallocation is deferred until the column cache line that uses\r\n** the register becomes stale.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){\r\n  if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){\r\n    int i;\r\n    struct yColCache *p;\r\n    for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\r\n      if( p->iReg==iReg ){\r\n        p->tempReg = 1;\r\n        return;\r\n      }\r\n    }\r\n    pParse->aTempReg[pParse->nTempReg++] = iReg;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate or deallocate a block of nReg consecutive registers\r\n*/\r\nSQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){\r\n  int i, n;\r\n  i = pParse->iRangeReg;\r\n  n = pParse->nRangeReg;\r\n  if( nReg<=n ){\r\n    assert( !usedAsColumnCache(pParse, i, i+n-1) );\r\n    pParse->iRangeReg += nReg;\r\n    pParse->nRangeReg -= nReg;\r\n  }else{\r\n    i = pParse->nMem+1;\r\n    pParse->nMem += nReg;\r\n  }\r\n  return i;\r\n}\r\nSQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){\r\n  sqlite3ExprCacheRemove(pParse, iReg, nReg);\r\n  if( nReg>pParse->nRangeReg ){\r\n    pParse->nRangeReg = nReg;\r\n    pParse->iRangeReg = iReg;\r\n  }\r\n}\r\n\r\n/*\r\n** Mark all temporary registers as being unavailable for reuse.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){\r\n  pParse->nTempReg = 0;\r\n  pParse->nRangeReg = 0;\r\n}\r\n\r\n/************** End of expr.c ************************************************/\r\n/************** Begin file alter.c *******************************************/\r\n/*\r\n** 2005 February 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains C code routines that used to generate VDBE code\r\n** that implements the ALTER TABLE command.\r\n*/\r\n\r\n/*\r\n** The code in this file only exists if we are not omitting the\r\n** ALTER TABLE logic from the build.\r\n*/\r\n#ifndef SQLITE_OMIT_ALTERTABLE\r\n\r\n\r\n/*\r\n** This function is used by SQL generated to implement the \r\n** ALTER TABLE command. The first argument is the text of a CREATE TABLE or\r\n** CREATE INDEX command. The second is a table name. The table name in \r\n** the CREATE TABLE or CREATE INDEX statement is replaced with the third\r\n** argument and the result returned. Examples:\r\n**\r\n** sqlite_rename_table('CREATE TABLE abc(a, b, c)', 'def')\r\n**     -> 'CREATE TABLE def(a, b, c)'\r\n**\r\n** sqlite_rename_table('CREATE INDEX i ON abc(a)', 'def')\r\n**     -> 'CREATE INDEX i ON def(a, b, c)'\r\n*/\r\nstatic void renameTableFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  unsigned char const *zSql = sqlite3_value_text(argv[0]);\r\n  unsigned char const *zTableName = sqlite3_value_text(argv[1]);\r\n\r\n  int token;\r\n  Token tname;\r\n  unsigned char const *zCsr = zSql;\r\n  int len = 0;\r\n  char *zRet;\r\n\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n\r\n  UNUSED_PARAMETER(NotUsed);\r\n\r\n  /* The principle used to locate the table name in the CREATE TABLE \r\n  ** statement is that the table name is the first non-space token that\r\n  ** is immediately followed by a TK_LP or TK_USING token.\r\n  */\r\n  if( zSql ){\r\n    do {\r\n      if( !*zCsr ){\r\n        /* Ran out of input before finding an opening bracket. Return NULL. */\r\n        return;\r\n      }\r\n\r\n      /* Store the token that zCsr points to in tname. */\r\n      tname.z = (char*)zCsr;\r\n      tname.n = len;\r\n\r\n      /* Advance zCsr to the next token. Store that token type in 'token',\r\n      ** and its length in 'len' (to be used next iteration of this loop).\r\n      */\r\n      do {\r\n        zCsr += len;\r\n        len = sqlite3GetToken(zCsr, &token);\r\n      } while( token==TK_SPACE );\r\n      assert( len>0 );\r\n    } while( token!=TK_LP && token!=TK_USING );\r\n\r\n    zRet = sqlite3MPrintf(db, \"%.*s\\\"%w\\\"%s\", ((u8*)tname.z) - zSql, zSql, \r\n       zTableName, tname.z+tname.n);\r\n    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);\r\n  }\r\n}\r\n\r\n/*\r\n** This C function implements an SQL user function that is used by SQL code\r\n** generated by the ALTER TABLE ... RENAME command to modify the definition\r\n** of any foreign key constraints that use the table being renamed as the \r\n** parent table. It is passed three arguments:\r\n**\r\n**   1) The complete text of the CREATE TABLE statement being modified,\r\n**   2) The old name of the table being renamed, and\r\n**   3) The new name of the table being renamed.\r\n**\r\n** It returns the new CREATE TABLE statement. For example:\r\n**\r\n**   sqlite_rename_parent('CREATE TABLE t1(a REFERENCES t2)', 't2', 't3')\r\n**       -> 'CREATE TABLE t1(a REFERENCES t3)'\r\n*/\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\nstatic void renameParentFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  char *zOutput = 0;\r\n  char *zResult;\r\n  unsigned char const *zInput = sqlite3_value_text(argv[0]);\r\n  unsigned char const *zOld = sqlite3_value_text(argv[1]);\r\n  unsigned char const *zNew = sqlite3_value_text(argv[2]);\r\n\r\n  unsigned const char *z;         /* Pointer to token */\r\n  int n;                          /* Length of token z */\r\n  int token;                      /* Type of token */\r\n\r\n  UNUSED_PARAMETER(NotUsed);\r\n  for(z=zInput; *z; z=z+n){\r\n    n = sqlite3GetToken(z, &token);\r\n    if( token==TK_REFERENCES ){\r\n      char *zParent;\r\n      do {\r\n        z += n;\r\n        n = sqlite3GetToken(z, &token);\r\n      }while( token==TK_SPACE );\r\n\r\n      zParent = sqlite3DbStrNDup(db, (const char *)z, n);\r\n      if( zParent==0 ) break;\r\n      sqlite3Dequote(zParent);\r\n      if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){\r\n        char *zOut = sqlite3MPrintf(db, \"%s%.*s\\\"%w\\\"\", \r\n            (zOutput?zOutput:\"\"), z-zInput, zInput, (const char *)zNew\r\n        );\r\n        sqlite3DbFree(db, zOutput);\r\n        zOutput = zOut;\r\n        zInput = &z[n];\r\n      }\r\n      sqlite3DbFree(db, zParent);\r\n    }\r\n  }\r\n\r\n  zResult = sqlite3MPrintf(db, \"%s%s\", (zOutput?zOutput:\"\"), zInput), \r\n  sqlite3_result_text(context, zResult, -1, SQLITE_DYNAMIC);\r\n  sqlite3DbFree(db, zOutput);\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n/* This function is used by SQL generated to implement the\r\n** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER \r\n** statement. The second is a table name. The table name in the CREATE \r\n** TRIGGER statement is replaced with the third argument and the result \r\n** returned. This is analagous to renameTableFunc() above, except for CREATE\r\n** TRIGGER, not CREATE INDEX and CREATE TABLE.\r\n*/\r\nstatic void renameTriggerFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  unsigned char const *zSql = sqlite3_value_text(argv[0]);\r\n  unsigned char const *zTableName = sqlite3_value_text(argv[1]);\r\n\r\n  int token;\r\n  Token tname;\r\n  int dist = 3;\r\n  unsigned char const *zCsr = zSql;\r\n  int len = 0;\r\n  char *zRet;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n\r\n  UNUSED_PARAMETER(NotUsed);\r\n\r\n  /* The principle used to locate the table name in the CREATE TRIGGER \r\n  ** statement is that the table name is the first token that is immediatedly\r\n  ** preceded by either TK_ON or TK_DOT and immediatedly followed by one\r\n  ** of TK_WHEN, TK_BEGIN or TK_FOR.\r\n  */\r\n  if( zSql ){\r\n    do {\r\n\r\n      if( !*zCsr ){\r\n        /* Ran out of input before finding the table name. Return NULL. */\r\n        return;\r\n      }\r\n\r\n      /* Store the token that zCsr points to in tname. */\r\n      tname.z = (char*)zCsr;\r\n      tname.n = len;\r\n\r\n      /* Advance zCsr to the next token. Store that token type in 'token',\r\n      ** and its length in 'len' (to be used next iteration of this loop).\r\n      */\r\n      do {\r\n        zCsr += len;\r\n        len = sqlite3GetToken(zCsr, &token);\r\n      }while( token==TK_SPACE );\r\n      assert( len>0 );\r\n\r\n      /* Variable 'dist' stores the number of tokens read since the most\r\n      ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN \r\n      ** token is read and 'dist' equals 2, the condition stated above\r\n      ** to be met.\r\n      **\r\n      ** Note that ON cannot be a database, table or column name, so\r\n      ** there is no need to worry about syntax like \r\n      ** \"CREATE TRIGGER ... ON ON.ON BEGIN ...\" etc.\r\n      */\r\n      dist++;\r\n      if( token==TK_DOT || token==TK_ON ){\r\n        dist = 0;\r\n      }\r\n    } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) );\r\n\r\n    /* Variable tname now contains the token that is the old table-name\r\n    ** in the CREATE TRIGGER statement.\r\n    */\r\n    zRet = sqlite3MPrintf(db, \"%.*s\\\"%w\\\"%s\", ((u8*)tname.z) - zSql, zSql, \r\n       zTableName, tname.z+tname.n);\r\n    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);\r\n  }\r\n}\r\n#endif   /* !SQLITE_OMIT_TRIGGER */\r\n\r\n/*\r\n** Register built-in functions used to help implement ALTER TABLE\r\n*/\r\nSQLITE_PRIVATE void sqlite3AlterFunctions(void){\r\n  static SQLITE_WSD FuncDef aAlterTableFuncs[] = {\r\n    FUNCTION(sqlite_rename_table,   2, 0, 0, renameTableFunc),\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n    FUNCTION(sqlite_rename_trigger, 2, 0, 0, renameTriggerFunc),\r\n#endif\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n    FUNCTION(sqlite_rename_parent,  3, 0, 0, renameParentFunc),\r\n#endif\r\n  };\r\n  int i;\r\n  FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);\r\n  FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aAlterTableFuncs);\r\n\r\n  for(i=0; i<ArraySize(aAlterTableFuncs); i++){\r\n    sqlite3FuncDefInsert(pHash, &aFunc[i]);\r\n  }\r\n}\r\n\r\n/*\r\n** This function is used to create the text of expressions of the form:\r\n**\r\n**   name=<constant1> OR name=<constant2> OR ...\r\n**\r\n** If argument zWhere is NULL, then a pointer string containing the text \r\n** \"name=<constant>\" is returned, where <constant> is the quoted version\r\n** of the string passed as argument zConstant. The returned buffer is\r\n** allocated using sqlite3DbMalloc(). It is the responsibility of the\r\n** caller to ensure that it is eventually freed.\r\n**\r\n** If argument zWhere is not NULL, then the string returned is \r\n** \"<where> OR name=<constant>\", where <where> is the contents of zWhere.\r\n** In this case zWhere is passed to sqlite3DbFree() before returning.\r\n** \r\n*/\r\nstatic char *whereOrName(sqlite3 *db, char *zWhere, char *zConstant){\r\n  char *zNew;\r\n  if( !zWhere ){\r\n    zNew = sqlite3MPrintf(db, \"name=%Q\", zConstant);\r\n  }else{\r\n    zNew = sqlite3MPrintf(db, \"%s OR name=%Q\", zWhere, zConstant);\r\n    sqlite3DbFree(db, zWhere);\r\n  }\r\n  return zNew;\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\r\n/*\r\n** Generate the text of a WHERE expression which can be used to select all\r\n** tables that have foreign key constraints that refer to table pTab (i.e.\r\n** constraints for which pTab is the parent table) from the sqlite_master\r\n** table.\r\n*/\r\nstatic char *whereForeignKeys(Parse *pParse, Table *pTab){\r\n  FKey *p;\r\n  char *zWhere = 0;\r\n  for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\r\n    zWhere = whereOrName(pParse->db, zWhere, p->pFrom->zName);\r\n  }\r\n  return zWhere;\r\n}\r\n#endif\r\n\r\n/*\r\n** Generate the text of a WHERE expression which can be used to select all\r\n** temporary triggers on table pTab from the sqlite_temp_master table. If\r\n** table pTab has no temporary triggers, or is itself stored in the \r\n** temporary database, NULL is returned.\r\n*/\r\nstatic char *whereTempTriggers(Parse *pParse, Table *pTab){\r\n  Trigger *pTrig;\r\n  char *zWhere = 0;\r\n  const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */\r\n\r\n  /* If the table is not located in the temp-db (in which case NULL is \r\n  ** returned, loop through the tables list of triggers. For each trigger\r\n  ** that is not part of the temp-db schema, add a clause to the WHERE \r\n  ** expression being built up in zWhere.\r\n  */\r\n  if( pTab->pSchema!=pTempSchema ){\r\n    sqlite3 *db = pParse->db;\r\n    for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){\r\n      if( pTrig->pSchema==pTempSchema ){\r\n        zWhere = whereOrName(db, zWhere, pTrig->zName);\r\n      }\r\n    }\r\n  }\r\n  if( zWhere ){\r\n    char *zNew = sqlite3MPrintf(pParse->db, \"type='trigger' AND (%s)\", zWhere);\r\n    sqlite3DbFree(pParse->db, zWhere);\r\n    zWhere = zNew;\r\n  }\r\n  return zWhere;\r\n}\r\n\r\n/*\r\n** Generate code to drop and reload the internal representation of table\r\n** pTab from the database, including triggers and temporary triggers.\r\n** Argument zName is the name of the table in the database schema at\r\n** the time the generated code is executed. This can be different from\r\n** pTab->zName if this function is being called to code part of an \r\n** \"ALTER TABLE RENAME TO\" statement.\r\n*/\r\nstatic void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){\r\n  Vdbe *v;\r\n  char *zWhere;\r\n  int iDb;                   /* Index of database containing pTab */\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  Trigger *pTrig;\r\n#endif\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( NEVER(v==0) ) return;\r\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n  assert( iDb>=0 );\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  /* Drop any table triggers from the internal schema. */\r\n  for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){\r\n    int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);\r\n    assert( iTrigDb==iDb || iTrigDb==1 );\r\n    sqlite3VdbeAddOp4(v, OP_DropTrigger, iTrigDb, 0, 0, pTrig->zName, 0);\r\n  }\r\n#endif\r\n\r\n  /* Drop the table and index from the internal schema.  */\r\n  sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);\r\n\r\n  /* Reload the table, index and permanent trigger schemas. */\r\n  zWhere = sqlite3MPrintf(pParse->db, \"tbl_name=%Q\", zName);\r\n  if( !zWhere ) return;\r\n  sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  /* Now, if the table is not stored in the temp database, reload any temp \r\n  ** triggers. Don't use IN(...) in case SQLITE_OMIT_SUBQUERY is defined. \r\n  */\r\n  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){\r\n    sqlite3VdbeAddParseSchemaOp(v, 1, zWhere);\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Parameter zName is the name of a table that is about to be altered\r\n** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN).\r\n** If the table is a system table, this function leaves an error message\r\n** in pParse->zErr (system tables may not be altered) and returns non-zero.\r\n**\r\n** Or, if zName is not a system table, zero is returned.\r\n*/\r\nstatic int isSystemTable(Parse *pParse, const char *zName){\r\n  if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, \"sqlite_\", 7) ){\r\n    sqlite3ErrorMsg(pParse, \"table %s may not be altered\", zName);\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Generate code to implement the \"ALTER TABLE xxx RENAME TO yyy\" \r\n** command. \r\n*/\r\nSQLITE_PRIVATE void sqlite3AlterRenameTable(\r\n  Parse *pParse,            /* Parser context. */\r\n  SrcList *pSrc,            /* The table to rename. */\r\n  Token *pName              /* The new table name. */\r\n){\r\n  int iDb;                  /* Database that contains the table */\r\n  char *zDb;                /* Name of database iDb */\r\n  Table *pTab;              /* Table being renamed */\r\n  char *zName = 0;          /* NULL-terminated version of pName */ \r\n  sqlite3 *db = pParse->db; /* Database connection */\r\n  int nTabName;             /* Number of UTF-8 characters in zTabName */\r\n  const char *zTabName;     /* Original name of the table */\r\n  Vdbe *v;\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  char *zWhere = 0;         /* Where clause to locate temp triggers */\r\n#endif\r\n  VTable *pVTab = 0;        /* Non-zero if this is a v-tab with an xRename() */\r\n  int savedDbFlags;         /* Saved value of db->flags */\r\n\r\n  savedDbFlags = db->flags;  \r\n  if( NEVER(db->mallocFailed) ) goto exit_rename_table;\r\n  assert( pSrc->nSrc==1 );\r\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\r\n\r\n  pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);\r\n  if( !pTab ) goto exit_rename_table;\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n  zDb = db->aDb[iDb].zName;\r\n  db->flags |= SQLITE_PreferBuiltin;\r\n\r\n  /* Get a NULL terminated version of the new table name. */\r\n  zName = sqlite3NameFromToken(db, pName);\r\n  if( !zName ) goto exit_rename_table;\r\n\r\n  /* Check that a table or index named 'zName' does not already exist\r\n  ** in database iDb. If so, this is an error.\r\n  */\r\n  if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){\r\n    sqlite3ErrorMsg(pParse, \r\n        \"there is already another table or index with this name: %s\", zName);\r\n    goto exit_rename_table;\r\n  }\r\n\r\n  /* Make sure it is not a system table being altered, or a reserved name\r\n  ** that the table is being renamed to.\r\n  */\r\n  if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){\r\n    goto exit_rename_table;\r\n  }\r\n  if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto\r\n    exit_rename_table;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_VIEW\r\n  if( pTab->pSelect ){\r\n    sqlite3ErrorMsg(pParse, \"view %s may not be altered\", pTab->zName);\r\n    goto exit_rename_table;\r\n  }\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  /* Invoke the authorization callback. */\r\n  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){\r\n    goto exit_rename_table;\r\n  }\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\r\n    goto exit_rename_table;\r\n  }\r\n  if( IsVirtual(pTab) ){\r\n    pVTab = sqlite3GetVTable(db, pTab);\r\n    if( pVTab->pVtab->pModule->xRename==0 ){\r\n      pVTab = 0;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Begin a transaction and code the VerifyCookie for database iDb. \r\n  ** Then modify the schema cookie (since the ALTER TABLE modifies the\r\n  ** schema). Open a statement transaction if the table is a virtual\r\n  ** table.\r\n  */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ){\r\n    goto exit_rename_table;\r\n  }\r\n  sqlite3BeginWriteOperation(pParse, pVTab!=0, iDb);\r\n  sqlite3ChangeCookie(pParse, iDb);\r\n\r\n  /* If this is a virtual table, invoke the xRename() function if\r\n  ** one is defined. The xRename() callback will modify the names\r\n  ** of any resources used by the v-table implementation (including other\r\n  ** SQLite tables) that are identified by the name of the virtual table.\r\n  */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( pVTab ){\r\n    int i = ++pParse->nMem;\r\n    sqlite3VdbeAddOp4(v, OP_String8, 0, i, 0, zName, 0);\r\n    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);\r\n    sqlite3MayAbort(pParse);\r\n  }\r\n#endif\r\n\r\n  /* figure out how many UTF-8 characters are in zName */\r\n  zTabName = pTab->zName;\r\n  nTabName = sqlite3Utf8CharLen(zTabName, -1);\r\n\r\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\r\n  if( db->flags&SQLITE_ForeignKeys ){\r\n    /* If foreign-key support is enabled, rewrite the CREATE TABLE \r\n    ** statements corresponding to all child tables of foreign key constraints\r\n    ** for which the renamed table is the parent table.  */\r\n    if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){\r\n      sqlite3NestedParse(pParse, \r\n          \"UPDATE \\\"%w\\\".%s SET \"\r\n              \"sql = sqlite_rename_parent(sql, %Q, %Q) \"\r\n              \"WHERE %s;\", zDb, SCHEMA_TABLE(iDb), zTabName, zName, zWhere);\r\n      sqlite3DbFree(db, zWhere);\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Modify the sqlite_master table to use the new table name. */\r\n  sqlite3NestedParse(pParse,\r\n      \"UPDATE %Q.%s SET \"\r\n#ifdef SQLITE_OMIT_TRIGGER\r\n          \"sql = sqlite_rename_table(sql, %Q), \"\r\n#else\r\n          \"sql = CASE \"\r\n            \"WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)\"\r\n            \"ELSE sqlite_rename_table(sql, %Q) END, \"\r\n#endif\r\n          \"tbl_name = %Q, \"\r\n          \"name = CASE \"\r\n            \"WHEN type='table' THEN %Q \"\r\n            \"WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN \"\r\n             \"'sqlite_autoindex_' || %Q || substr(name,%d+18) \"\r\n            \"ELSE name END \"\r\n      \"WHERE tbl_name=%Q COLLATE nocase AND \"\r\n          \"(type='table' OR type='index' OR type='trigger');\", \r\n      zDb, SCHEMA_TABLE(iDb), zName, zName, zName, \r\n#ifndef SQLITE_OMIT_TRIGGER\r\n      zName,\r\n#endif\r\n      zName, nTabName, zTabName\r\n  );\r\n\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n  /* If the sqlite_sequence table exists in this database, then update \r\n  ** it with the new table name.\r\n  */\r\n  if( sqlite3FindTable(db, \"sqlite_sequence\", zDb) ){\r\n    sqlite3NestedParse(pParse,\r\n        \"UPDATE \\\"%w\\\".sqlite_sequence set name = %Q WHERE name = %Q\",\r\n        zDb, zName, pTab->zName);\r\n  }\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  /* If there are TEMP triggers on this table, modify the sqlite_temp_master\r\n  ** table. Don't do this if the table being ALTERed is itself located in\r\n  ** the temp database.\r\n  */\r\n  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){\r\n    sqlite3NestedParse(pParse, \r\n        \"UPDATE sqlite_temp_master SET \"\r\n            \"sql = sqlite_rename_trigger(sql, %Q), \"\r\n            \"tbl_name = %Q \"\r\n            \"WHERE %s;\", zName, zName, zWhere);\r\n    sqlite3DbFree(db, zWhere);\r\n  }\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\r\n  if( db->flags&SQLITE_ForeignKeys ){\r\n    FKey *p;\r\n    for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\r\n      Table *pFrom = p->pFrom;\r\n      if( pFrom!=pTab ){\r\n        reloadTableSchema(pParse, p->pFrom, pFrom->zName);\r\n      }\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Drop and reload the internal table schema. */\r\n  reloadTableSchema(pParse, pTab, zName);\r\n\r\nexit_rename_table:\r\n  sqlite3SrcListDelete(db, pSrc);\r\n  sqlite3DbFree(db, zName);\r\n  db->flags = savedDbFlags;\r\n}\r\n\r\n\r\n/*\r\n** Generate code to make sure the file format number is at least minFormat.\r\n** The generated code will increase the file format number if necessary.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MinimumFileFormat(Parse *pParse, int iDb, int minFormat){\r\n  Vdbe *v;\r\n  v = sqlite3GetVdbe(pParse);\r\n  /* The VDBE should have been allocated before this routine is called.\r\n  ** If that allocation failed, we would have quit before reaching this\r\n  ** point */\r\n  if( ALWAYS(v) ){\r\n    int r1 = sqlite3GetTempReg(pParse);\r\n    int r2 = sqlite3GetTempReg(pParse);\r\n    int j1;\r\n    sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT);\r\n    sqlite3VdbeUsesBtree(v, iDb);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, minFormat, r2);\r\n    j1 = sqlite3VdbeAddOp3(v, OP_Ge, r2, 0, r1);\r\n    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, r2);\r\n    sqlite3VdbeJumpHere(v, j1);\r\n    sqlite3ReleaseTempReg(pParse, r1);\r\n    sqlite3ReleaseTempReg(pParse, r2);\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called after an \"ALTER TABLE ... ADD\" statement\r\n** has been parsed. Argument pColDef contains the text of the new\r\n** column definition.\r\n**\r\n** The Table structure pParse->pNewTable was extended to include\r\n** the new column during parsing.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){\r\n  Table *pNew;              /* Copy of pParse->pNewTable */\r\n  Table *pTab;              /* Table being altered */\r\n  int iDb;                  /* Database number */\r\n  const char *zDb;          /* Database name */\r\n  const char *zTab;         /* Table name */\r\n  char *zCol;               /* Null-terminated column definition */\r\n  Column *pCol;             /* The new column */\r\n  Expr *pDflt;              /* Default value for the new column */\r\n  sqlite3 *db;              /* The database connection; */\r\n\r\n  db = pParse->db;\r\n  if( pParse->nErr || db->mallocFailed ) return;\r\n  pNew = pParse->pNewTable;\r\n  assert( pNew );\r\n\r\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\r\n  iDb = sqlite3SchemaToIndex(db, pNew->pSchema);\r\n  zDb = db->aDb[iDb].zName;\r\n  zTab = &pNew->zName[16];  /* Skip the \"sqlite_altertab_\" prefix on the name */\r\n  pCol = &pNew->aCol[pNew->nCol-1];\r\n  pDflt = pCol->pDflt;\r\n  pTab = sqlite3FindTable(db, zTab, zDb);\r\n  assert( pTab );\r\n\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  /* Invoke the authorization callback. */\r\n  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){\r\n    return;\r\n  }\r\n#endif\r\n\r\n  /* If the default value for the new column was specified with a \r\n  ** literal NULL, then set pDflt to 0. This simplifies checking\r\n  ** for an SQL NULL default below.\r\n  */\r\n  if( pDflt && pDflt->op==TK_NULL ){\r\n    pDflt = 0;\r\n  }\r\n\r\n  /* Check that the new column is not specified as PRIMARY KEY or UNIQUE.\r\n  ** If there is a NOT NULL constraint, then the default value for the\r\n  ** column must not be NULL.\r\n  */\r\n  if( pCol->isPrimKey ){\r\n    sqlite3ErrorMsg(pParse, \"Cannot add a PRIMARY KEY column\");\r\n    return;\r\n  }\r\n  if( pNew->pIndex ){\r\n    sqlite3ErrorMsg(pParse, \"Cannot add a UNIQUE column\");\r\n    return;\r\n  }\r\n  if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){\r\n    sqlite3ErrorMsg(pParse, \r\n        \"Cannot add a REFERENCES column with non-NULL default value\");\r\n    return;\r\n  }\r\n  if( pCol->notNull && !pDflt ){\r\n    sqlite3ErrorMsg(pParse, \r\n        \"Cannot add a NOT NULL column with default value NULL\");\r\n    return;\r\n  }\r\n\r\n  /* Ensure the default expression is something that sqlite3ValueFromExpr()\r\n  ** can handle (i.e. not CURRENT_TIME etc.)\r\n  */\r\n  if( pDflt ){\r\n    sqlite3_value *pVal;\r\n    if( sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal) ){\r\n      db->mallocFailed = 1;\r\n      return;\r\n    }\r\n    if( !pVal ){\r\n      sqlite3ErrorMsg(pParse, \"Cannot add a column with non-constant default\");\r\n      return;\r\n    }\r\n    sqlite3ValueFree(pVal);\r\n  }\r\n\r\n  /* Modify the CREATE TABLE statement. */\r\n  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);\r\n  if( zCol ){\r\n    char *zEnd = &zCol[pColDef->n-1];\r\n    int savedDbFlags = db->flags;\r\n    while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){\r\n      *zEnd-- = '\\0';\r\n    }\r\n    db->flags |= SQLITE_PreferBuiltin;\r\n    sqlite3NestedParse(pParse, \r\n        \"UPDATE \\\"%w\\\".%s SET \"\r\n          \"sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) \"\r\n        \"WHERE type = 'table' AND name = %Q\", \r\n      zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,\r\n      zTab\r\n    );\r\n    sqlite3DbFree(db, zCol);\r\n    db->flags = savedDbFlags;\r\n  }\r\n\r\n  /* If the default value of the new column is NULL, then set the file\r\n  ** format to 2. If the default value of the new column is not NULL,\r\n  ** the file format becomes 3.\r\n  */\r\n  sqlite3MinimumFileFormat(pParse, iDb, pDflt ? 3 : 2);\r\n\r\n  /* Reload the schema of the modified table. */\r\n  reloadTableSchema(pParse, pTab, pTab->zName);\r\n}\r\n\r\n/*\r\n** This function is called by the parser after the table-name in\r\n** an \"ALTER TABLE <table-name> ADD\" statement is parsed. Argument \r\n** pSrc is the full-name of the table being altered.\r\n**\r\n** This routine makes a (partial) copy of the Table structure\r\n** for the table being altered and sets Parse.pNewTable to point\r\n** to it. Routines called by the parser as the column definition\r\n** is parsed (i.e. sqlite3AddColumn()) add the new Column data to \r\n** the copy. The copy of the Table structure is deleted by tokenize.c \r\n** after parsing is finished.\r\n**\r\n** Routine sqlite3AlterFinishAddColumn() will be called to complete\r\n** coding the \"ALTER TABLE ... ADD\" statement.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){\r\n  Table *pNew;\r\n  Table *pTab;\r\n  Vdbe *v;\r\n  int iDb;\r\n  int i;\r\n  int nAlloc;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  /* Look up the table being altered. */\r\n  assert( pParse->pNewTable==0 );\r\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\r\n  if( db->mallocFailed ) goto exit_begin_add_column;\r\n  pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);\r\n  if( !pTab ) goto exit_begin_add_column;\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( IsVirtual(pTab) ){\r\n    sqlite3ErrorMsg(pParse, \"virtual tables may not be altered\");\r\n    goto exit_begin_add_column;\r\n  }\r\n#endif\r\n\r\n  /* Make sure this is not an attempt to ALTER a view. */\r\n  if( pTab->pSelect ){\r\n    sqlite3ErrorMsg(pParse, \"Cannot add a column to a view\");\r\n    goto exit_begin_add_column;\r\n  }\r\n  if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){\r\n    goto exit_begin_add_column;\r\n  }\r\n\r\n  assert( pTab->addColOffset>0 );\r\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n\r\n  /* Put a copy of the Table struct in Parse.pNewTable for the\r\n  ** sqlite3AddColumn() function and friends to modify.  But modify\r\n  ** the name by adding an \"sqlite_altertab_\" prefix.  By adding this\r\n  ** prefix, we insure that the name will not collide with an existing\r\n  ** table because user table are not allowed to have the \"sqlite_\"\r\n  ** prefix on their name.\r\n  */\r\n  pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table));\r\n  if( !pNew ) goto exit_begin_add_column;\r\n  pParse->pNewTable = pNew;\r\n  pNew->nRef = 1;\r\n  pNew->nCol = pTab->nCol;\r\n  assert( pNew->nCol>0 );\r\n  nAlloc = (((pNew->nCol-1)/8)*8)+8;\r\n  assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 );\r\n  pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc);\r\n  pNew->zName = sqlite3MPrintf(db, \"sqlite_altertab_%s\", pTab->zName);\r\n  if( !pNew->aCol || !pNew->zName ){\r\n    db->mallocFailed = 1;\r\n    goto exit_begin_add_column;\r\n  }\r\n  memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol);\r\n  for(i=0; i<pNew->nCol; i++){\r\n    Column *pCol = &pNew->aCol[i];\r\n    pCol->zName = sqlite3DbStrDup(db, pCol->zName);\r\n    pCol->zColl = 0;\r\n    pCol->zType = 0;\r\n    pCol->pDflt = 0;\r\n    pCol->zDflt = 0;\r\n  }\r\n  pNew->pSchema = db->aDb[iDb].pSchema;\r\n  pNew->addColOffset = pTab->addColOffset;\r\n  pNew->nRef = 1;\r\n\r\n  /* Begin a transaction and increment the schema cookie.  */\r\n  sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( !v ) goto exit_begin_add_column;\r\n  sqlite3ChangeCookie(pParse, iDb);\r\n\r\nexit_begin_add_column:\r\n  sqlite3SrcListDelete(db, pSrc);\r\n  return;\r\n}\r\n#endif  /* SQLITE_ALTER_TABLE */\r\n\r\n/************** End of alter.c ***********************************************/\r\n/************** Begin file analyze.c *****************************************/\r\n/*\r\n** 2005 July 8\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code associated with the ANALYZE command.\r\n**\r\n** The ANALYZE command gather statistics about the content of tables\r\n** and indices.  These statistics are made available to the query planner\r\n** to help it make better decisions about how to perform queries.\r\n**\r\n** The following system tables are or have been supported:\r\n**\r\n**    CREATE TABLE sqlite_stat1(tbl, idx, stat);\r\n**    CREATE TABLE sqlite_stat2(tbl, idx, sampleno, sample);\r\n**    CREATE TABLE sqlite_stat3(tbl, idx, nEq, nLt, nDLt, sample);\r\n**\r\n** Additional tables might be added in future releases of SQLite.\r\n** The sqlite_stat2 table is not created or used unless the SQLite version\r\n** is between 3.6.18 and 3.7.8, inclusive, and unless SQLite is compiled\r\n** with SQLITE_ENABLE_STAT2.  The sqlite_stat2 table is deprecated.\r\n** The sqlite_stat2 table is superceded by sqlite_stat3, which is only\r\n** created and used by SQLite versions 3.7.9 and later and with\r\n** SQLITE_ENABLE_STAT3 defined.  The fucntionality of sqlite_stat3\r\n** is a superset of sqlite_stat2.  \r\n**\r\n** Format of sqlite_stat1:\r\n**\r\n** There is normally one row per index, with the index identified by the\r\n** name in the idx column.  The tbl column is the name of the table to\r\n** which the index belongs.  In each such row, the stat column will be\r\n** a string consisting of a list of integers.  The first integer in this\r\n** list is the number of rows in the index and in the table.  The second\r\n** integer is the average number of rows in the index that have the same\r\n** value in the first column of the index.  The third integer is the average\r\n** number of rows in the index that have the same value for the first two\r\n** columns.  The N-th integer (for N>1) is the average number of rows in \r\n** the index which have the same value for the first N-1 columns.  For\r\n** a K-column index, there will be K+1 integers in the stat column.  If\r\n** the index is unique, then the last integer will be 1.\r\n**\r\n** The list of integers in the stat column can optionally be followed\r\n** by the keyword \"unordered\".  The \"unordered\" keyword, if it is present,\r\n** must be separated from the last integer by a single space.  If the\r\n** \"unordered\" keyword is present, then the query planner assumes that\r\n** the index is unordered and will not use the index for a range query.\r\n** \r\n** If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat\r\n** column contains a single integer which is the (estimated) number of\r\n** rows in the table identified by sqlite_stat1.tbl.\r\n**\r\n** Format of sqlite_stat2:\r\n**\r\n** The sqlite_stat2 is only created and is only used if SQLite is compiled\r\n** with SQLITE_ENABLE_STAT2 and if the SQLite version number is between\r\n** 3.6.18 and 3.7.8.  The \"stat2\" table contains additional information\r\n** about the distribution of keys within an index.  The index is identified by\r\n** the \"idx\" column and the \"tbl\" column is the name of the table to which\r\n** the index belongs.  There are usually 10 rows in the sqlite_stat2\r\n** table for each index.\r\n**\r\n** The sqlite_stat2 entries for an index that have sampleno between 0 and 9\r\n** inclusive are samples of the left-most key value in the index taken at\r\n** evenly spaced points along the index.  Let the number of samples be S\r\n** (10 in the standard build) and let C be the number of rows in the index.\r\n** Then the sampled rows are given by:\r\n**\r\n**     rownumber = (i*C*2 + C)/(S*2)\r\n**\r\n** For i between 0 and S-1.  Conceptually, the index space is divided into\r\n** S uniform buckets and the samples are the middle row from each bucket.\r\n**\r\n** The format for sqlite_stat2 is recorded here for legacy reference.  This\r\n** version of SQLite does not support sqlite_stat2.  It neither reads nor\r\n** writes the sqlite_stat2 table.  This version of SQLite only supports\r\n** sqlite_stat3.\r\n**\r\n** Format for sqlite_stat3:\r\n**\r\n** The sqlite_stat3 is an enhancement to sqlite_stat2.  A new name is\r\n** used to avoid compatibility problems.  \r\n**\r\n** The format of the sqlite_stat3 table is similar to the format of\r\n** the sqlite_stat2 table.  There are multiple entries for each index.\r\n** The idx column names the index and the tbl column is the table of the\r\n** index.  If the idx and tbl columns are the same, then the sample is\r\n** of the INTEGER PRIMARY KEY.  The sample column is a value taken from\r\n** the left-most column of the index.  The nEq column is the approximate\r\n** number of entires in the index whose left-most column exactly matches\r\n** the sample.  nLt is the approximate number of entires whose left-most\r\n** column is less than the sample.  The nDLt column is the approximate\r\n** number of distinct left-most entries in the index that are less than\r\n** the sample.\r\n**\r\n** Future versions of SQLite might change to store a string containing\r\n** multiple integers values in the nDLt column of sqlite_stat3.  The first\r\n** integer will be the number of prior index entires that are distinct in\r\n** the left-most column.  The second integer will be the number of prior index\r\n** entries that are distinct in the first two columns.  The third integer\r\n** will be the number of prior index entries that are distinct in the first\r\n** three columns.  And so forth.  With that extension, the nDLt field is\r\n** similar in function to the sqlite_stat1.stat field.\r\n**\r\n** There can be an arbitrary number of sqlite_stat3 entries per index.\r\n** The ANALYZE command will typically generate sqlite_stat3 tables\r\n** that contain between 10 and 40 samples which are distributed across\r\n** the key space, though not uniformly, and which include samples with\r\n** largest possible nEq values.\r\n*/\r\n#ifndef SQLITE_OMIT_ANALYZE\r\n\r\n/*\r\n** This routine generates code that opens the sqlite_stat1 table for\r\n** writing with cursor iStatCur. If the library was built with the\r\n** SQLITE_ENABLE_STAT3 macro defined, then the sqlite_stat3 table is\r\n** opened for writing using cursor (iStatCur+1)\r\n**\r\n** If the sqlite_stat1 tables does not previously exist, it is created.\r\n** Similarly, if the sqlite_stat3 table does not exist and the library\r\n** is compiled with SQLITE_ENABLE_STAT3 defined, it is created. \r\n**\r\n** Argument zWhere may be a pointer to a buffer containing a table name,\r\n** or it may be a NULL pointer. If it is not NULL, then all entries in\r\n** the sqlite_stat1 and (if applicable) sqlite_stat3 tables associated\r\n** with the named table are deleted. If zWhere==0, then code is generated\r\n** to delete all stat table entries.\r\n*/\r\nstatic void openStatTable(\r\n  Parse *pParse,          /* Parsing context */\r\n  int iDb,                /* The database we are looking in */\r\n  int iStatCur,           /* Open the sqlite_stat1 table on this cursor */\r\n  const char *zWhere,     /* Delete entries for this table or index */\r\n  const char *zWhereType  /* Either \"tbl\" or \"idx\" */\r\n){\r\n  static const struct {\r\n    const char *zName;\r\n    const char *zCols;\r\n  } aTable[] = {\r\n    { \"sqlite_stat1\", \"tbl,idx,stat\" },\r\n#ifdef SQLITE_ENABLE_STAT3\r\n    { \"sqlite_stat3\", \"tbl,idx,neq,nlt,ndlt,sample\" },\r\n#endif\r\n  };\r\n\r\n  int aRoot[] = {0, 0};\r\n  u8 aCreateTbl[] = {0, 0};\r\n\r\n  int i;\r\n  sqlite3 *db = pParse->db;\r\n  Db *pDb;\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ) return;\r\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\r\n  assert( sqlite3VdbeDb(v)==db );\r\n  pDb = &db->aDb[iDb];\r\n\r\n  /* Create new statistic tables if they do not exist, or clear them\r\n  ** if they do already exist.\r\n  */\r\n  for(i=0; i<ArraySize(aTable); i++){\r\n    const char *zTab = aTable[i].zName;\r\n    Table *pStat;\r\n    if( (pStat = sqlite3FindTable(db, zTab, pDb->zName))==0 ){\r\n      /* The sqlite_stat[12] table does not exist. Create it. Note that a \r\n      ** side-effect of the CREATE TABLE statement is to leave the rootpage \r\n      ** of the new table in register pParse->regRoot. This is important \r\n      ** because the OpenWrite opcode below will be needing it. */\r\n      sqlite3NestedParse(pParse,\r\n          \"CREATE TABLE %Q.%s(%s)\", pDb->zName, zTab, aTable[i].zCols\r\n      );\r\n      aRoot[i] = pParse->regRoot;\r\n      aCreateTbl[i] = 1;\r\n    }else{\r\n      /* The table already exists. If zWhere is not NULL, delete all entries \r\n      ** associated with the table zWhere. If zWhere is NULL, delete the\r\n      ** entire contents of the table. */\r\n      aRoot[i] = pStat->tnum;\r\n      sqlite3TableLock(pParse, iDb, aRoot[i], 1, zTab);\r\n      if( zWhere ){\r\n        sqlite3NestedParse(pParse,\r\n           \"DELETE FROM %Q.%s WHERE %s=%Q\", pDb->zName, zTab, zWhereType, zWhere\r\n        );\r\n      }else{\r\n        /* The sqlite_stat[12] table already exists.  Delete all rows. */\r\n        sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], iDb);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Open the sqlite_stat[13] tables for writing. */\r\n  for(i=0; i<ArraySize(aTable); i++){\r\n    sqlite3VdbeAddOp3(v, OP_OpenWrite, iStatCur+i, aRoot[i], iDb);\r\n    sqlite3VdbeChangeP4(v, -1, (char *)3, P4_INT32);\r\n    sqlite3VdbeChangeP5(v, aCreateTbl[i]);\r\n  }\r\n}\r\n\r\n/*\r\n** Recommended number of samples for sqlite_stat3\r\n*/\r\n#ifndef SQLITE_STAT3_SAMPLES\r\n# define SQLITE_STAT3_SAMPLES 24\r\n#endif\r\n\r\n/*\r\n** Three SQL functions - stat3_init(), stat3_push(), and stat3_pop() -\r\n** share an instance of the following structure to hold their state\r\n** information.\r\n*/\r\ntypedef struct Stat3Accum Stat3Accum;\r\nstruct Stat3Accum {\r\n  tRowcnt nRow;             /* Number of rows in the entire table */\r\n  tRowcnt nPSample;         /* How often to do a periodic sample */\r\n  int iMin;                 /* Index of entry with minimum nEq and hash */\r\n  int mxSample;             /* Maximum number of samples to accumulate */\r\n  int nSample;              /* Current number of samples */\r\n  u32 iPrn;                 /* Pseudo-random number used for sampling */\r\n  struct Stat3Sample {\r\n    i64 iRowid;                /* Rowid in main table of the key */\r\n    tRowcnt nEq;               /* sqlite_stat3.nEq */\r\n    tRowcnt nLt;               /* sqlite_stat3.nLt */\r\n    tRowcnt nDLt;              /* sqlite_stat3.nDLt */\r\n    u8 isPSample;              /* True if a periodic sample */\r\n    u32 iHash;                 /* Tiebreaker hash */\r\n  } *a;                     /* An array of samples */\r\n};\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n/*\r\n** Implementation of the stat3_init(C,S) SQL function.  The two parameters\r\n** are the number of rows in the table or index (C) and the number of samples\r\n** to accumulate (S).\r\n**\r\n** This routine allocates the Stat3Accum object.\r\n**\r\n** The return value is the Stat3Accum object (P).\r\n*/\r\nstatic void stat3Init(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  Stat3Accum *p;\r\n  tRowcnt nRow;\r\n  int mxSample;\r\n  int n;\r\n\r\n  UNUSED_PARAMETER(argc);\r\n  nRow = (tRowcnt)sqlite3_value_int64(argv[0]);\r\n  mxSample = sqlite3_value_int(argv[1]);\r\n  n = sizeof(*p) + sizeof(p->a[0])*mxSample;\r\n  p = sqlite3_malloc( n );\r\n  if( p==0 ){\r\n    sqlite3_result_error_nomem(context);\r\n    return;\r\n  }\r\n  memset(p, 0, n);\r\n  p->a = (struct Stat3Sample*)&p[1];\r\n  p->nRow = nRow;\r\n  p->mxSample = mxSample;\r\n  p->nPSample = p->nRow/(mxSample/3+1) + 1;\r\n  sqlite3_randomness(sizeof(p->iPrn), &p->iPrn);\r\n  sqlite3_result_blob(context, p, sizeof(p), sqlite3_free);\r\n}\r\nstatic const FuncDef stat3InitFuncdef = {\r\n  2,                /* nArg */\r\n  SQLITE_UTF8,      /* iPrefEnc */\r\n  0,                /* flags */\r\n  0,                /* pUserData */\r\n  0,                /* pNext */\r\n  stat3Init,        /* xFunc */\r\n  0,                /* xStep */\r\n  0,                /* xFinalize */\r\n  \"stat3_init\",     /* zName */\r\n  0,                /* pHash */\r\n  0                 /* pDestructor */\r\n};\r\n\r\n\r\n/*\r\n** Implementation of the stat3_push(nEq,nLt,nDLt,rowid,P) SQL function.  The\r\n** arguments describe a single key instance.  This routine makes the \r\n** decision about whether or not to retain this key for the sqlite_stat3\r\n** table.\r\n**\r\n** The return value is NULL.\r\n*/\r\nstatic void stat3Push(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  Stat3Accum *p = (Stat3Accum*)sqlite3_value_blob(argv[4]);\r\n  tRowcnt nEq = sqlite3_value_int64(argv[0]);\r\n  tRowcnt nLt = sqlite3_value_int64(argv[1]);\r\n  tRowcnt nDLt = sqlite3_value_int64(argv[2]);\r\n  i64 rowid = sqlite3_value_int64(argv[3]);\r\n  u8 isPSample = 0;\r\n  u8 doInsert = 0;\r\n  int iMin = p->iMin;\r\n  struct Stat3Sample *pSample;\r\n  int i;\r\n  u32 h;\r\n\r\n  UNUSED_PARAMETER(context);\r\n  UNUSED_PARAMETER(argc);\r\n  if( nEq==0 ) return;\r\n  h = p->iPrn = p->iPrn*1103515245 + 12345;\r\n  if( (nLt/p->nPSample)!=((nEq+nLt)/p->nPSample) ){\r\n    doInsert = isPSample = 1;\r\n  }else if( p->nSample<p->mxSample ){\r\n    doInsert = 1;\r\n  }else{\r\n    if( nEq>p->a[iMin].nEq || (nEq==p->a[iMin].nEq && h>p->a[iMin].iHash) ){\r\n      doInsert = 1;\r\n    }\r\n  }\r\n  if( !doInsert ) return;\r\n  if( p->nSample==p->mxSample ){\r\n    assert( p->nSample - iMin - 1 >= 0 );\r\n    memmove(&p->a[iMin], &p->a[iMin+1], sizeof(p->a[0])*(p->nSample-iMin-1));\r\n    pSample = &p->a[p->nSample-1];\r\n  }else{\r\n    pSample = &p->a[p->nSample++];\r\n  }\r\n  pSample->iRowid = rowid;\r\n  pSample->nEq = nEq;\r\n  pSample->nLt = nLt;\r\n  pSample->nDLt = nDLt;\r\n  pSample->iHash = h;\r\n  pSample->isPSample = isPSample;\r\n\r\n  /* Find the new minimum */\r\n  if( p->nSample==p->mxSample ){\r\n    pSample = p->a;\r\n    i = 0;\r\n    while( pSample->isPSample ){\r\n      i++;\r\n      pSample++;\r\n      assert( i<p->nSample );\r\n    }\r\n    nEq = pSample->nEq;\r\n    h = pSample->iHash;\r\n    iMin = i;\r\n    for(i++, pSample++; i<p->nSample; i++, pSample++){\r\n      if( pSample->isPSample ) continue;\r\n      if( pSample->nEq<nEq\r\n       || (pSample->nEq==nEq && pSample->iHash<h)\r\n      ){\r\n        iMin = i;\r\n        nEq = pSample->nEq;\r\n        h = pSample->iHash;\r\n      }\r\n    }\r\n    p->iMin = iMin;\r\n  }\r\n}\r\nstatic const FuncDef stat3PushFuncdef = {\r\n  5,                /* nArg */\r\n  SQLITE_UTF8,      /* iPrefEnc */\r\n  0,                /* flags */\r\n  0,                /* pUserData */\r\n  0,                /* pNext */\r\n  stat3Push,        /* xFunc */\r\n  0,                /* xStep */\r\n  0,                /* xFinalize */\r\n  \"stat3_push\",     /* zName */\r\n  0,                /* pHash */\r\n  0                 /* pDestructor */\r\n};\r\n\r\n/*\r\n** Implementation of the stat3_get(P,N,...) SQL function.  This routine is\r\n** used to query the results.  Content is returned for the Nth sqlite_stat3\r\n** row where N is between 0 and S-1 and S is the number of samples.  The\r\n** value returned depends on the number of arguments.\r\n**\r\n**   argc==2    result:  rowid\r\n**   argc==3    result:  nEq\r\n**   argc==4    result:  nLt\r\n**   argc==5    result:  nDLt\r\n*/\r\nstatic void stat3Get(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int n = sqlite3_value_int(argv[1]);\r\n  Stat3Accum *p = (Stat3Accum*)sqlite3_value_blob(argv[0]);\r\n\r\n  assert( p!=0 );\r\n  if( p->nSample<=n ) return;\r\n  switch( argc ){\r\n    case 2:  sqlite3_result_int64(context, p->a[n].iRowid); break;\r\n    case 3:  sqlite3_result_int64(context, p->a[n].nEq);    break;\r\n    case 4:  sqlite3_result_int64(context, p->a[n].nLt);    break;\r\n    default: sqlite3_result_int64(context, p->a[n].nDLt);   break;\r\n  }\r\n}\r\nstatic const FuncDef stat3GetFuncdef = {\r\n  -1,               /* nArg */\r\n  SQLITE_UTF8,      /* iPrefEnc */\r\n  0,                /* flags */\r\n  0,                /* pUserData */\r\n  0,                /* pNext */\r\n  stat3Get,         /* xFunc */\r\n  0,                /* xStep */\r\n  0,                /* xFinalize */\r\n  \"stat3_get\",     /* zName */\r\n  0,                /* pHash */\r\n  0                 /* pDestructor */\r\n};\r\n#endif /* SQLITE_ENABLE_STAT3 */\r\n\r\n\r\n\r\n\r\n/*\r\n** Generate code to do an analysis of all indices associated with\r\n** a single table.\r\n*/\r\nstatic void analyzeOneTable(\r\n  Parse *pParse,   /* Parser context */\r\n  Table *pTab,     /* Table whose indices are to be analyzed */\r\n  Index *pOnlyIdx, /* If not NULL, only analyze this one index */\r\n  int iStatCur,    /* Index of VdbeCursor that writes the sqlite_stat1 table */\r\n  int iMem         /* Available memory locations begin here */\r\n){\r\n  sqlite3 *db = pParse->db;    /* Database handle */\r\n  Index *pIdx;                 /* An index to being analyzed */\r\n  int iIdxCur;                 /* Cursor open on index being analyzed */\r\n  Vdbe *v;                     /* The virtual machine being built up */\r\n  int i;                       /* Loop counter */\r\n  int topOfLoop;               /* The top of the loop */\r\n  int endOfLoop;               /* The end of the loop */\r\n  int jZeroRows = -1;          /* Jump from here if number of rows is zero */\r\n  int iDb;                     /* Index of database containing pTab */\r\n  int regTabname = iMem++;     /* Register containing table name */\r\n  int regIdxname = iMem++;     /* Register containing index name */\r\n  int regStat1 = iMem++;       /* The stat column of sqlite_stat1 */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  int regNumEq = regStat1;     /* Number of instances.  Same as regStat1 */\r\n  int regNumLt = iMem++;       /* Number of keys less than regSample */\r\n  int regNumDLt = iMem++;      /* Number of distinct keys less than regSample */\r\n  int regSample = iMem++;      /* The next sample value */\r\n  int regRowid = regSample;    /* Rowid of a sample */\r\n  int regAccum = iMem++;       /* Register to hold Stat3Accum object */\r\n  int regLoop = iMem++;        /* Loop counter */\r\n  int regCount = iMem++;       /* Number of rows in the table or index */\r\n  int regTemp1 = iMem++;       /* Intermediate register */\r\n  int regTemp2 = iMem++;       /* Intermediate register */\r\n  int once = 1;                /* One-time initialization */\r\n  int shortJump = 0;           /* Instruction address */\r\n  int iTabCur = pParse->nTab++; /* Table cursor */\r\n#endif\r\n  int regCol = iMem++;         /* Content of a column in analyzed table */\r\n  int regRec = iMem++;         /* Register holding completed record */\r\n  int regTemp = iMem++;        /* Temporary use register */\r\n  int regNewRowid = iMem++;    /* Rowid for the inserted record */\r\n\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 || NEVER(pTab==0) ){\r\n    return;\r\n  }\r\n  if( pTab->tnum==0 ){\r\n    /* Do not gather statistics on views or virtual tables */\r\n    return;\r\n  }\r\n  if( memcmp(pTab->zName, \"sqlite_\", 7)==0 ){\r\n    /* Do not gather statistics on system tables */\r\n    return;\r\n  }\r\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\r\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n  assert( iDb>=0 );\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,\r\n      db->aDb[iDb].zName ) ){\r\n    return;\r\n  }\r\n#endif\r\n\r\n  /* Establish a read-lock on the table at the shared-cache level. */\r\n  sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\r\n\r\n  iIdxCur = pParse->nTab++;\r\n  sqlite3VdbeAddOp4(v, OP_String8, 0, regTabname, 0, pTab->zName, 0);\r\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n    int nCol;\r\n    KeyInfo *pKey;\r\n    int addrIfNot = 0;           /* address of OP_IfNot */\r\n    int *aChngAddr;              /* Array of jump instruction addresses */\r\n\r\n    if( pOnlyIdx && pOnlyIdx!=pIdx ) continue;\r\n    VdbeNoopComment((v, \"Begin analysis of %s\", pIdx->zName));\r\n    nCol = pIdx->nColumn;\r\n    aChngAddr = sqlite3DbMallocRaw(db, sizeof(int)*nCol);\r\n    if( aChngAddr==0 ) continue;\r\n    pKey = sqlite3IndexKeyinfo(pParse, pIdx);\r\n    if( iMem+1+(nCol*2)>pParse->nMem ){\r\n      pParse->nMem = iMem+1+(nCol*2);\r\n    }\r\n\r\n    /* Open a cursor to the index to be analyzed. */\r\n    assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );\r\n    sqlite3VdbeAddOp4(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb,\r\n        (char *)pKey, P4_KEYINFO_HANDOFF);\r\n    VdbeComment((v, \"%s\", pIdx->zName));\r\n\r\n    /* Populate the register containing the index name. */\r\n    sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, pIdx->zName, 0);\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n    if( once ){\r\n      once = 0;\r\n      sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regCount);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, SQLITE_STAT3_SAMPLES, regTemp1);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regNumEq);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regNumLt);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, -1, regNumDLt);\r\n    sqlite3VdbeAddOp3(v, OP_Null, 0, regSample, regAccum);\r\n    sqlite3VdbeAddOp4(v, OP_Function, 1, regCount, regAccum,\r\n                      (char*)&stat3InitFuncdef, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, 2);\r\n#endif /* SQLITE_ENABLE_STAT3 */\r\n\r\n    /* The block of memory cells initialized here is used as follows.\r\n    **\r\n    **    iMem:                \r\n    **        The total number of rows in the table.\r\n    **\r\n    **    iMem+1 .. iMem+nCol: \r\n    **        Number of distinct entries in index considering the \r\n    **        left-most N columns only, where N is between 1 and nCol, \r\n    **        inclusive.\r\n    **\r\n    **    iMem+nCol+1 .. Mem+2*nCol:  \r\n    **        Previous value of indexed columns, from left to right.\r\n    **\r\n    ** Cells iMem through iMem+nCol are initialized to 0. The others are \r\n    ** initialized to contain an SQL NULL.\r\n    */\r\n    for(i=0; i<=nCol; i++){\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, iMem+i);\r\n    }\r\n    for(i=0; i<nCol; i++){\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, iMem+nCol+i+1);\r\n    }\r\n\r\n    /* Start the analysis loop. This loop runs through all the entries in\r\n    ** the index b-tree.  */\r\n    endOfLoop = sqlite3VdbeMakeLabel(v);\r\n    sqlite3VdbeAddOp2(v, OP_Rewind, iIdxCur, endOfLoop);\r\n    topOfLoop = sqlite3VdbeCurrentAddr(v);\r\n    sqlite3VdbeAddOp2(v, OP_AddImm, iMem, 1);  /* Increment row counter */\r\n\r\n    for(i=0; i<nCol; i++){\r\n      CollSeq *pColl;\r\n      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regCol);\r\n      if( i==0 ){\r\n        /* Always record the very first row */\r\n        addrIfNot = sqlite3VdbeAddOp1(v, OP_IfNot, iMem+1);\r\n      }\r\n      assert( pIdx->azColl!=0 );\r\n      assert( pIdx->azColl[i]!=0 );\r\n      pColl = sqlite3LocateCollSeq(pParse, pIdx->azColl[i]);\r\n      aChngAddr[i] = sqlite3VdbeAddOp4(v, OP_Ne, regCol, 0, iMem+nCol+i+1,\r\n                                      (char*)pColl, P4_COLLSEQ);\r\n      sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);\r\n      VdbeComment((v, \"jump if column %d changed\", i));\r\n#ifdef SQLITE_ENABLE_STAT3\r\n      if( i==0 ){\r\n        sqlite3VdbeAddOp2(v, OP_AddImm, regNumEq, 1);\r\n        VdbeComment((v, \"incr repeat count\"));\r\n      }\r\n#endif\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, endOfLoop);\r\n    for(i=0; i<nCol; i++){\r\n      sqlite3VdbeJumpHere(v, aChngAddr[i]);  /* Set jump dest for the OP_Ne */\r\n      if( i==0 ){\r\n        sqlite3VdbeJumpHere(v, addrIfNot);   /* Jump dest for OP_IfNot */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n        sqlite3VdbeAddOp4(v, OP_Function, 1, regNumEq, regTemp2,\r\n                          (char*)&stat3PushFuncdef, P4_FUNCDEF);\r\n        sqlite3VdbeChangeP5(v, 5);\r\n        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, pIdx->nColumn, regRowid);\r\n        sqlite3VdbeAddOp3(v, OP_Add, regNumEq, regNumLt, regNumLt);\r\n        sqlite3VdbeAddOp2(v, OP_AddImm, regNumDLt, 1);\r\n        sqlite3VdbeAddOp2(v, OP_Integer, 1, regNumEq);\r\n#endif        \r\n      }\r\n      sqlite3VdbeAddOp2(v, OP_AddImm, iMem+i+1, 1);\r\n      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, iMem+nCol+i+1);\r\n    }\r\n    sqlite3DbFree(db, aChngAddr);\r\n\r\n    /* Always jump here after updating the iMem+1...iMem+1+nCol counters */\r\n    sqlite3VdbeResolveLabel(v, endOfLoop);\r\n\r\n    sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, topOfLoop);\r\n    sqlite3VdbeAddOp1(v, OP_Close, iIdxCur);\r\n#ifdef SQLITE_ENABLE_STAT3\r\n    sqlite3VdbeAddOp4(v, OP_Function, 1, regNumEq, regTemp2,\r\n                      (char*)&stat3PushFuncdef, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, 5);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, -1, regLoop);\r\n    shortJump = \r\n    sqlite3VdbeAddOp2(v, OP_AddImm, regLoop, 1);\r\n    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regTemp1,\r\n                      (char*)&stat3GetFuncdef, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, 2);\r\n    sqlite3VdbeAddOp1(v, OP_IsNull, regTemp1);\r\n    sqlite3VdbeAddOp3(v, OP_NotExists, iTabCur, shortJump, regTemp1);\r\n    sqlite3VdbeAddOp3(v, OP_Column, iTabCur, pIdx->aiColumn[0], regSample);\r\n    sqlite3ColumnDefault(v, pTab, pIdx->aiColumn[0], regSample);\r\n    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regNumEq,\r\n                      (char*)&stat3GetFuncdef, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, 3);\r\n    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regNumLt,\r\n                      (char*)&stat3GetFuncdef, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, 4);\r\n    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regNumDLt,\r\n                      (char*)&stat3GetFuncdef, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, 5);\r\n    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 6, regRec, \"bbbbbb\", 0);\r\n    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid);\r\n    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur+1, regRec, regNewRowid);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, shortJump);\r\n    sqlite3VdbeJumpHere(v, shortJump+2);\r\n#endif        \r\n\r\n    /* Store the results in sqlite_stat1.\r\n    **\r\n    ** The result is a single row of the sqlite_stat1 table.  The first\r\n    ** two columns are the names of the table and index.  The third column\r\n    ** is a string composed of a list of integer statistics about the\r\n    ** index.  The first integer in the list is the total number of entries\r\n    ** in the index.  There is one additional integer in the list for each\r\n    ** column of the table.  This additional integer is a guess of how many\r\n    ** rows of the table the index will select.  If D is the count of distinct\r\n    ** values and K is the total number of rows, then the integer is computed\r\n    ** as:\r\n    **\r\n    **        I = (K+D-1)/D\r\n    **\r\n    ** If K==0 then no entry is made into the sqlite_stat1 table.  \r\n    ** If K>0 then it is always the case the D>0 so division by zero\r\n    ** is never possible.\r\n    */\r\n    sqlite3VdbeAddOp2(v, OP_SCopy, iMem, regStat1);\r\n    if( jZeroRows<0 ){\r\n      jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, iMem);\r\n    }\r\n    for(i=0; i<nCol; i++){\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, regTemp, 0, \" \", 0);\r\n      sqlite3VdbeAddOp3(v, OP_Concat, regTemp, regStat1, regStat1);\r\n      sqlite3VdbeAddOp3(v, OP_Add, iMem, iMem+i+1, regTemp);\r\n      sqlite3VdbeAddOp2(v, OP_AddImm, regTemp, -1);\r\n      sqlite3VdbeAddOp3(v, OP_Divide, iMem+i+1, regTemp, regTemp);\r\n      sqlite3VdbeAddOp1(v, OP_ToInt, regTemp);\r\n      sqlite3VdbeAddOp3(v, OP_Concat, regTemp, regStat1, regStat1);\r\n    }\r\n    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regRec, \"aaa\", 0);\r\n    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);\r\n    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regRec, regNewRowid);\r\n    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n  }\r\n\r\n  /* If the table has no indices, create a single sqlite_stat1 entry\r\n  ** containing NULL as the index name and the row count as the content.\r\n  */\r\n  if( pTab->pIndex==0 ){\r\n    sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pTab->tnum, iDb);\r\n    VdbeComment((v, \"%s\", pTab->zName));\r\n    sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat1);\r\n    sqlite3VdbeAddOp1(v, OP_Close, iIdxCur);\r\n    jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1);\r\n  }else{\r\n    sqlite3VdbeJumpHere(v, jZeroRows);\r\n    jZeroRows = sqlite3VdbeAddOp0(v, OP_Goto);\r\n  }\r\n  sqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname);\r\n  sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regRec, \"aaa\", 0);\r\n  sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);\r\n  sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regRec, regNewRowid);\r\n  sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n  if( pParse->nMem<regRec ) pParse->nMem = regRec;\r\n  sqlite3VdbeJumpHere(v, jZeroRows);\r\n}\r\n\r\n\r\n/*\r\n** Generate code that will cause the most recent index analysis to\r\n** be loaded into internal hash tables where is can be used.\r\n*/\r\nstatic void loadAnalysis(Parse *pParse, int iDb){\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  if( v ){\r\n    sqlite3VdbeAddOp1(v, OP_LoadAnalysis, iDb);\r\n  }\r\n}\r\n\r\n/*\r\n** Generate code that will do an analysis of an entire database\r\n*/\r\nstatic void analyzeDatabase(Parse *pParse, int iDb){\r\n  sqlite3 *db = pParse->db;\r\n  Schema *pSchema = db->aDb[iDb].pSchema;    /* Schema of database iDb */\r\n  HashElem *k;\r\n  int iStatCur;\r\n  int iMem;\r\n\r\n  sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n  iStatCur = pParse->nTab;\r\n  pParse->nTab += 3;\r\n  openStatTable(pParse, iDb, iStatCur, 0, 0);\r\n  iMem = pParse->nMem+1;\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){\r\n    Table *pTab = (Table*)sqliteHashData(k);\r\n    analyzeOneTable(pParse, pTab, 0, iStatCur, iMem);\r\n  }\r\n  loadAnalysis(pParse, iDb);\r\n}\r\n\r\n/*\r\n** Generate code that will do an analysis of a single table in\r\n** a database.  If pOnlyIdx is not NULL then it is a single index\r\n** in pTab that should be analyzed.\r\n*/\r\nstatic void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){\r\n  int iDb;\r\n  int iStatCur;\r\n\r\n  assert( pTab!=0 );\r\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n  sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n  iStatCur = pParse->nTab;\r\n  pParse->nTab += 3;\r\n  if( pOnlyIdx ){\r\n    openStatTable(pParse, iDb, iStatCur, pOnlyIdx->zName, \"idx\");\r\n  }else{\r\n    openStatTable(pParse, iDb, iStatCur, pTab->zName, \"tbl\");\r\n  }\r\n  analyzeOneTable(pParse, pTab, pOnlyIdx, iStatCur, pParse->nMem+1);\r\n  loadAnalysis(pParse, iDb);\r\n}\r\n\r\n/*\r\n** Generate code for the ANALYZE command.  The parser calls this routine\r\n** when it recognizes an ANALYZE command.\r\n**\r\n**        ANALYZE                            -- 1\r\n**        ANALYZE  <database>                -- 2\r\n**        ANALYZE  ?<database>.?<tablename>  -- 3\r\n**\r\n** Form 1 causes all indices in all attached databases to be analyzed.\r\n** Form 2 analyzes all indices the single database named.\r\n** Form 3 analyzes all indices associated with the named table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){\r\n  sqlite3 *db = pParse->db;\r\n  int iDb;\r\n  int i;\r\n  char *z, *zDb;\r\n  Table *pTab;\r\n  Index *pIdx;\r\n  Token *pTableName;\r\n\r\n  /* Read the database schema. If an error occurs, leave an error message\r\n  ** and code in pParse and return NULL. */\r\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\r\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n    return;\r\n  }\r\n\r\n  assert( pName2!=0 || pName1==0 );\r\n  if( pName1==0 ){\r\n    /* Form 1:  Analyze everything */\r\n    for(i=0; i<db->nDb; i++){\r\n      if( i==1 ) continue;  /* Do not analyze the TEMP database */\r\n      analyzeDatabase(pParse, i);\r\n    }\r\n  }else if( pName2->n==0 ){\r\n    /* Form 2:  Analyze the database or table named */\r\n    iDb = sqlite3FindDb(db, pName1);\r\n    if( iDb>=0 ){\r\n      analyzeDatabase(pParse, iDb);\r\n    }else{\r\n      z = sqlite3NameFromToken(db, pName1);\r\n      if( z ){\r\n        if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){\r\n          analyzeTable(pParse, pIdx->pTable, pIdx);\r\n        }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){\r\n          analyzeTable(pParse, pTab, 0);\r\n        }\r\n        sqlite3DbFree(db, z);\r\n      }\r\n    }\r\n  }else{\r\n    /* Form 3: Analyze the fully qualified table name */\r\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);\r\n    if( iDb>=0 ){\r\n      zDb = db->aDb[iDb].zName;\r\n      z = sqlite3NameFromToken(db, pTableName);\r\n      if( z ){\r\n        if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){\r\n          analyzeTable(pParse, pIdx->pTable, pIdx);\r\n        }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){\r\n          analyzeTable(pParse, pTab, 0);\r\n        }\r\n        sqlite3DbFree(db, z);\r\n      }\r\n    }   \r\n  }\r\n}\r\n\r\n/*\r\n** Used to pass information from the analyzer reader through to the\r\n** callback routine.\r\n*/\r\ntypedef struct analysisInfo analysisInfo;\r\nstruct analysisInfo {\r\n  sqlite3 *db;\r\n  const char *zDatabase;\r\n};\r\n\r\n/*\r\n** This callback is invoked once for each index when reading the\r\n** sqlite_stat1 table.  \r\n**\r\n**     argv[0] = name of the table\r\n**     argv[1] = name of the index (might be NULL)\r\n**     argv[2] = results of analysis - on integer for each column\r\n**\r\n** Entries for which argv[1]==NULL simply record the number of rows in\r\n** the table.\r\n*/\r\nstatic int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){\r\n  analysisInfo *pInfo = (analysisInfo*)pData;\r\n  Index *pIndex;\r\n  Table *pTable;\r\n  int i, c, n;\r\n  tRowcnt v;\r\n  const char *z;\r\n\r\n  assert( argc==3 );\r\n  UNUSED_PARAMETER2(NotUsed, argc);\r\n\r\n  if( argv==0 || argv[0]==0 || argv[2]==0 ){\r\n    return 0;\r\n  }\r\n  pTable = sqlite3FindTable(pInfo->db, argv[0], pInfo->zDatabase);\r\n  if( pTable==0 ){\r\n    return 0;\r\n  }\r\n  if( argv[1] ){\r\n    pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);\r\n  }else{\r\n    pIndex = 0;\r\n  }\r\n  n = pIndex ? pIndex->nColumn : 0;\r\n  z = argv[2];\r\n  for(i=0; *z && i<=n; i++){\r\n    v = 0;\r\n    while( (c=z[0])>='0' && c<='9' ){\r\n      v = v*10 + c - '0';\r\n      z++;\r\n    }\r\n    if( i==0 ) pTable->nRowEst = v;\r\n    if( pIndex==0 ) break;\r\n    pIndex->aiRowEst[i] = v;\r\n    if( *z==' ' ) z++;\r\n    if( memcmp(z, \"unordered\", 10)==0 ){\r\n      pIndex->bUnordered = 1;\r\n      break;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** If the Index.aSample variable is not NULL, delete the aSample[] array\r\n** and its contents.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  if( pIdx->aSample ){\r\n    int j;\r\n    for(j=0; j<pIdx->nSample; j++){\r\n      IndexSample *p = &pIdx->aSample[j];\r\n      if( p->eType==SQLITE_TEXT || p->eType==SQLITE_BLOB ){\r\n        sqlite3DbFree(db, p->u.z);\r\n      }\r\n    }\r\n    sqlite3DbFree(db, pIdx->aSample);\r\n  }\r\n  if( db && db->pnBytesFreed==0 ){\r\n    pIdx->nSample = 0;\r\n    pIdx->aSample = 0;\r\n  }\r\n#else\r\n  UNUSED_PARAMETER(db);\r\n  UNUSED_PARAMETER(pIdx);\r\n#endif\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n/*\r\n** Load content from the sqlite_stat3 table into the Index.aSample[]\r\n** arrays of all indices.\r\n*/\r\nstatic int loadStat3(sqlite3 *db, const char *zDb){\r\n  int rc;                       /* Result codes from subroutines */\r\n  sqlite3_stmt *pStmt = 0;      /* An SQL statement being run */\r\n  char *zSql;                   /* Text of the SQL statement */\r\n  Index *pPrevIdx = 0;          /* Previous index in the loop */\r\n  int idx = 0;                  /* slot in pIdx->aSample[] for next sample */\r\n  int eType;                    /* Datatype of a sample */\r\n  IndexSample *pSample;         /* A slot in pIdx->aSample[] */\r\n\r\n  assert( db->lookaside.bEnabled==0 );\r\n  if( !sqlite3FindTable(db, \"sqlite_stat3\", zDb) ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  zSql = sqlite3MPrintf(db, \r\n      \"SELECT idx,count(*) FROM %Q.sqlite_stat3\"\r\n      \" GROUP BY idx\", zDb);\r\n  if( !zSql ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\r\n  sqlite3DbFree(db, zSql);\r\n  if( rc ) return rc;\r\n\r\n  while( sqlite3_step(pStmt)==SQLITE_ROW ){\r\n    char *zIndex;   /* Index name */\r\n    Index *pIdx;    /* Pointer to the index object */\r\n    int nSample;    /* Number of samples */\r\n\r\n    zIndex = (char *)sqlite3_column_text(pStmt, 0);\r\n    if( zIndex==0 ) continue;\r\n    nSample = sqlite3_column_int(pStmt, 1);\r\n    pIdx = sqlite3FindIndex(db, zIndex, zDb);\r\n    if( pIdx==0 ) continue;\r\n    assert( pIdx->nSample==0 );\r\n    pIdx->nSample = nSample;\r\n    pIdx->aSample = sqlite3DbMallocZero(db, nSample*sizeof(IndexSample));\r\n    pIdx->avgEq = pIdx->aiRowEst[1];\r\n    if( pIdx->aSample==0 ){\r\n      db->mallocFailed = 1;\r\n      sqlite3_finalize(pStmt);\r\n      return SQLITE_NOMEM;\r\n    }\r\n  }\r\n  rc = sqlite3_finalize(pStmt);\r\n  if( rc ) return rc;\r\n\r\n  zSql = sqlite3MPrintf(db, \r\n      \"SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat3\", zDb);\r\n  if( !zSql ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\r\n  sqlite3DbFree(db, zSql);\r\n  if( rc ) return rc;\r\n\r\n  while( sqlite3_step(pStmt)==SQLITE_ROW ){\r\n    char *zIndex;   /* Index name */\r\n    Index *pIdx;    /* Pointer to the index object */\r\n    int i;          /* Loop counter */\r\n    tRowcnt sumEq;  /* Sum of the nEq values */\r\n\r\n    zIndex = (char *)sqlite3_column_text(pStmt, 0);\r\n    if( zIndex==0 ) continue;\r\n    pIdx = sqlite3FindIndex(db, zIndex, zDb);\r\n    if( pIdx==0 ) continue;\r\n    if( pIdx==pPrevIdx ){\r\n      idx++;\r\n    }else{\r\n      pPrevIdx = pIdx;\r\n      idx = 0;\r\n    }\r\n    assert( idx<pIdx->nSample );\r\n    pSample = &pIdx->aSample[idx];\r\n    pSample->nEq = (tRowcnt)sqlite3_column_int64(pStmt, 1);\r\n    pSample->nLt = (tRowcnt)sqlite3_column_int64(pStmt, 2);\r\n    pSample->nDLt = (tRowcnt)sqlite3_column_int64(pStmt, 3);\r\n    if( idx==pIdx->nSample-1 ){\r\n      if( pSample->nDLt>0 ){\r\n        for(i=0, sumEq=0; i<=idx-1; i++) sumEq += pIdx->aSample[i].nEq;\r\n        pIdx->avgEq = (pSample->nLt - sumEq)/pSample->nDLt;\r\n      }\r\n      if( pIdx->avgEq<=0 ) pIdx->avgEq = 1;\r\n    }\r\n    eType = sqlite3_column_type(pStmt, 4);\r\n    pSample->eType = (u8)eType;\r\n    switch( eType ){\r\n      case SQLITE_INTEGER: {\r\n        pSample->u.i = sqlite3_column_int64(pStmt, 4);\r\n        break;\r\n      }\r\n      case SQLITE_FLOAT: {\r\n        pSample->u.r = sqlite3_column_double(pStmt, 4);\r\n        break;\r\n      }\r\n      case SQLITE_NULL: {\r\n        break;\r\n      }\r\n      default: assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB ); {\r\n        const char *z = (const char *)(\r\n              (eType==SQLITE_BLOB) ?\r\n              sqlite3_column_blob(pStmt, 4):\r\n              sqlite3_column_text(pStmt, 4)\r\n           );\r\n        int n = z ? sqlite3_column_bytes(pStmt, 4) : 0;\r\n        pSample->nByte = n;\r\n        if( n < 1){\r\n          pSample->u.z = 0;\r\n        }else{\r\n          pSample->u.z = sqlite3DbMallocRaw(db, n);\r\n          if( pSample->u.z==0 ){\r\n            db->mallocFailed = 1;\r\n            sqlite3_finalize(pStmt);\r\n            return SQLITE_NOMEM;\r\n          }\r\n          memcpy(pSample->u.z, z, n);\r\n        }\r\n      }\r\n    }\r\n  }\r\n  return sqlite3_finalize(pStmt);\r\n}\r\n#endif /* SQLITE_ENABLE_STAT3 */\r\n\r\n/*\r\n** Load the content of the sqlite_stat1 and sqlite_stat3 tables. The\r\n** contents of sqlite_stat1 are used to populate the Index.aiRowEst[]\r\n** arrays. The contents of sqlite_stat3 are used to populate the\r\n** Index.aSample[] arrays.\r\n**\r\n** If the sqlite_stat1 table is not present in the database, SQLITE_ERROR\r\n** is returned. In this case, even if SQLITE_ENABLE_STAT3 was defined \r\n** during compilation and the sqlite_stat3 table is present, no data is \r\n** read from it.\r\n**\r\n** If SQLITE_ENABLE_STAT3 was defined during compilation and the \r\n** sqlite_stat3 table is not present in the database, SQLITE_ERROR is\r\n** returned. However, in this case, data is read from the sqlite_stat1\r\n** table (if it is present) before returning.\r\n**\r\n** If an OOM error occurs, this function always sets db->mallocFailed.\r\n** This means if the caller does not care about other errors, the return\r\n** code may be ignored.\r\n*/\r\nSQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){\r\n  analysisInfo sInfo;\r\n  HashElem *i;\r\n  char *zSql;\r\n  int rc;\r\n\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  assert( db->aDb[iDb].pBt!=0 );\r\n\r\n  /* Clear any prior statistics */\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){\r\n    Index *pIdx = sqliteHashData(i);\r\n    sqlite3DefaultRowEst(pIdx);\r\n#ifdef SQLITE_ENABLE_STAT3\r\n    sqlite3DeleteIndexSamples(db, pIdx);\r\n    pIdx->aSample = 0;\r\n#endif\r\n  }\r\n\r\n  /* Check to make sure the sqlite_stat1 table exists */\r\n  sInfo.db = db;\r\n  sInfo.zDatabase = db->aDb[iDb].zName;\r\n  if( sqlite3FindTable(db, \"sqlite_stat1\", sInfo.zDatabase)==0 ){\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  /* Load new statistics out of the sqlite_stat1 table */\r\n  zSql = sqlite3MPrintf(db, \r\n      \"SELECT tbl,idx,stat FROM %Q.sqlite_stat1\", sInfo.zDatabase);\r\n  if( zSql==0 ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);\r\n    sqlite3DbFree(db, zSql);\r\n  }\r\n\r\n\r\n  /* Load the statistics from the sqlite_stat3 table. */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  if( rc==SQLITE_OK ){\r\n    int lookasideEnabled = db->lookaside.bEnabled;\r\n    db->lookaside.bEnabled = 0;\r\n    rc = loadStat3(db, sInfo.zDatabase);\r\n    db->lookaside.bEnabled = lookasideEnabled;\r\n  }\r\n#endif\r\n\r\n  if( rc==SQLITE_NOMEM ){\r\n    db->mallocFailed = 1;\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n#endif /* SQLITE_OMIT_ANALYZE */\r\n\r\n/************** End of analyze.c *********************************************/\r\n/************** Begin file attach.c ******************************************/\r\n/*\r\n** 2003 April 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used to implement the ATTACH and DETACH commands.\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_ATTACH\r\n/*\r\n** Resolve an expression that was part of an ATTACH or DETACH statement. This\r\n** is slightly different from resolving a normal SQL expression, because simple\r\n** identifiers are treated as strings, not possible column names or aliases.\r\n**\r\n** i.e. if the parser sees:\r\n**\r\n**     ATTACH DATABASE abc AS def\r\n**\r\n** it treats the two expressions as literal strings 'abc' and 'def' instead of\r\n** looking for columns of the same name.\r\n**\r\n** This only applies to the root node of pExpr, so the statement:\r\n**\r\n**     ATTACH DATABASE abc||def AS 'db2'\r\n**\r\n** will fail because neither abc or def can be resolved.\r\n*/\r\nstatic int resolveAttachExpr(NameContext *pName, Expr *pExpr)\r\n{\r\n  int rc = SQLITE_OK;\r\n  if( pExpr ){\r\n    if( pExpr->op!=TK_ID ){\r\n      rc = sqlite3ResolveExprNames(pName, pExpr);\r\n      if( rc==SQLITE_OK && !sqlite3ExprIsConstant(pExpr) ){\r\n        sqlite3ErrorMsg(pName->pParse, \"invalid name: \\\"%s\\\"\", pExpr->u.zToken);\r\n        return SQLITE_ERROR;\r\n      }\r\n    }else{\r\n      pExpr->op = TK_STRING;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** An SQL user-function registered to do the work of an ATTACH statement. The\r\n** three arguments to the function come directly from an attach statement:\r\n**\r\n**     ATTACH DATABASE x AS y KEY z\r\n**\r\n**     SELECT sqlite_attach(x, y, z)\r\n**\r\n** If the optional \"KEY z\" syntax is omitted, an SQL NULL is passed as the\r\n** third argument.\r\n*/\r\nstatic void attachFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  int i;\r\n  int rc = 0;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  const char *zName;\r\n  const char *zFile;\r\n  char *zPath = 0;\r\n  char *zErr = 0;\r\n  unsigned int flags;\r\n  Db *aNew;\r\n  char *zErrDyn = 0;\r\n  sqlite3_vfs *pVfs;\r\n\r\n  UNUSED_PARAMETER(NotUsed);\r\n\r\n  zFile = (const char *)sqlite3_value_text(argv[0]);\r\n  zName = (const char *)sqlite3_value_text(argv[1]);\r\n  if( zFile==0 ) zFile = \"\";\r\n  if( zName==0 ) zName = \"\";\r\n\r\n  /* Check for the following errors:\r\n  **\r\n  **     * Too many attached databases,\r\n  **     * Transaction currently open\r\n  **     * Specified database name already being used.\r\n  */\r\n  if( db->nDb>=db->aLimit[SQLITE_LIMIT_ATTACHED]+2 ){\r\n    zErrDyn = sqlite3MPrintf(db, \"too many attached databases - max %d\", \r\n      db->aLimit[SQLITE_LIMIT_ATTACHED]\r\n    );\r\n    goto attach_error;\r\n  }\r\n  if( !db->autoCommit ){\r\n    zErrDyn = sqlite3MPrintf(db, \"cannot ATTACH database within transaction\");\r\n    goto attach_error;\r\n  }\r\n  for(i=0; i<db->nDb; i++){\r\n    char *z = db->aDb[i].zName;\r\n    assert( z && zName );\r\n    if( sqlite3StrICmp(z, zName)==0 ){\r\n      zErrDyn = sqlite3MPrintf(db, \"database %s is already in use\", zName);\r\n      goto attach_error;\r\n    }\r\n  }\r\n\r\n  /* Allocate the new entry in the db->aDb[] array and initialise the schema\r\n  ** hash tables.\r\n  */\r\n  if( db->aDb==db->aDbStatic ){\r\n    aNew = sqlite3DbMallocRaw(db, sizeof(db->aDb[0])*3 );\r\n    if( aNew==0 ) return;\r\n    memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2);\r\n  }else{\r\n    aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) );\r\n    if( aNew==0 ) return;\r\n  }\r\n  db->aDb = aNew;\r\n  aNew = &db->aDb[db->nDb];\r\n  memset(aNew, 0, sizeof(*aNew));\r\n\r\n  /* Open the database file. If the btree is successfully opened, use\r\n  ** it to obtain the database schema. At this point the schema may\r\n  ** or may not be initialised.\r\n  */\r\n  flags = db->openFlags;\r\n  rc = sqlite3ParseUri(db->pVfs->zName, zFile, &flags, &pVfs, &zPath, &zErr);\r\n  if( rc!=SQLITE_OK ){\r\n    if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;\r\n    sqlite3_result_error(context, zErr, -1);\r\n    sqlite3_free(zErr);\r\n    return;\r\n  }\r\n  assert( pVfs );\r\n  flags |= SQLITE_OPEN_MAIN_DB;\r\n  rc = sqlite3BtreeOpen(pVfs, zPath, db, &aNew->pBt, 0, flags);\r\n  sqlite3_free( zPath );\r\n  db->nDb++;\r\n  if( rc==SQLITE_CONSTRAINT ){\r\n    rc = SQLITE_ERROR;\r\n    zErrDyn = sqlite3MPrintf(db, \"database is already attached\");\r\n  }else if( rc==SQLITE_OK ){\r\n    Pager *pPager;\r\n    aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);\r\n    if( !aNew->pSchema ){\r\n      rc = SQLITE_NOMEM;\r\n    }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){\r\n      zErrDyn = sqlite3MPrintf(db, \r\n        \"attached databases must use the same text encoding as main database\");\r\n      rc = SQLITE_ERROR;\r\n    }\r\n    pPager = sqlite3BtreePager(aNew->pBt);\r\n    sqlite3PagerLockingMode(pPager, db->dfltLockMode);\r\n    sqlite3BtreeSecureDelete(aNew->pBt,\r\n                             sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) );\r\n  }\r\n  aNew->safety_level = 3;\r\n  aNew->zName = sqlite3DbStrDup(db, zName);\r\n  if( rc==SQLITE_OK && aNew->zName==0 ){\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n  if( rc==SQLITE_OK ){\r\n    extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);\r\n    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);\r\n    int nKey;\r\n    char *zKey;\r\n    int t = sqlite3_value_type(argv[2]);\r\n    switch( t ){\r\n      case SQLITE_INTEGER:\r\n      case SQLITE_FLOAT:\r\n        zErrDyn = sqlite3DbStrDup(db, \"Invalid key value\");\r\n        rc = SQLITE_ERROR;\r\n        break;\r\n        \r\n      case SQLITE_TEXT:\r\n      case SQLITE_BLOB:\r\n        nKey = sqlite3_value_bytes(argv[2]);\r\n        zKey = (char *)sqlite3_value_blob(argv[2]);\r\n        rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);\r\n        break;\r\n\r\n      case SQLITE_NULL:\r\n        /* No key specified.  Use the key from the main database */\r\n        sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);\r\n        if( nKey>0 || sqlite3BtreeGetReserve(db->aDb[0].pBt)>0 ){\r\n          rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);\r\n        }\r\n        break;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* If the file was opened successfully, read the schema for the new database.\r\n  ** If this fails, or if opening the file failed, then close the file and \r\n  ** remove the entry from the db->aDb[] array. i.e. put everything back the way\r\n  ** we found it.\r\n  */\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3BtreeEnterAll(db);\r\n    rc = sqlite3Init(db, &zErrDyn);\r\n    sqlite3BtreeLeaveAll(db);\r\n  }\r\n  if( rc ){\r\n    int iDb = db->nDb - 1;\r\n    assert( iDb>=2 );\r\n    if( db->aDb[iDb].pBt ){\r\n      sqlite3BtreeClose(db->aDb[iDb].pBt);\r\n      db->aDb[iDb].pBt = 0;\r\n      db->aDb[iDb].pSchema = 0;\r\n    }\r\n    sqlite3ResetInternalSchema(db, -1);\r\n    db->nDb = iDb;\r\n    if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){\r\n      db->mallocFailed = 1;\r\n      sqlite3DbFree(db, zErrDyn);\r\n      zErrDyn = sqlite3MPrintf(db, \"out of memory\");\r\n    }else if( zErrDyn==0 ){\r\n      zErrDyn = sqlite3MPrintf(db, \"unable to open database: %s\", zFile);\r\n    }\r\n    goto attach_error;\r\n  }\r\n  \r\n  return;\r\n\r\nattach_error:\r\n  /* Return an error if we get here */\r\n  if( zErrDyn ){\r\n    sqlite3_result_error(context, zErrDyn, -1);\r\n    sqlite3DbFree(db, zErrDyn);\r\n  }\r\n  if( rc ) sqlite3_result_error_code(context, rc);\r\n}\r\n\r\n/*\r\n** An SQL user-function registered to do the work of an DETACH statement. The\r\n** three arguments to the function come directly from a detach statement:\r\n**\r\n**     DETACH DATABASE x\r\n**\r\n**     SELECT sqlite_detach(x)\r\n*/\r\nstatic void detachFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  const char *zName = (const char *)sqlite3_value_text(argv[0]);\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  int i;\r\n  Db *pDb = 0;\r\n  char zErr[128];\r\n\r\n  UNUSED_PARAMETER(NotUsed);\r\n\r\n  if( zName==0 ) zName = \"\";\r\n  for(i=0; i<db->nDb; i++){\r\n    pDb = &db->aDb[i];\r\n    if( pDb->pBt==0 ) continue;\r\n    if( sqlite3StrICmp(pDb->zName, zName)==0 ) break;\r\n  }\r\n\r\n  if( i>=db->nDb ){\r\n    sqlite3_snprintf(sizeof(zErr),zErr, \"no such database: %s\", zName);\r\n    goto detach_error;\r\n  }\r\n  if( i<2 ){\r\n    sqlite3_snprintf(sizeof(zErr),zErr, \"cannot detach database %s\", zName);\r\n    goto detach_error;\r\n  }\r\n  if( !db->autoCommit ){\r\n    sqlite3_snprintf(sizeof(zErr), zErr,\r\n                     \"cannot DETACH database within transaction\");\r\n    goto detach_error;\r\n  }\r\n  if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){\r\n    sqlite3_snprintf(sizeof(zErr),zErr, \"database %s is locked\", zName);\r\n    goto detach_error;\r\n  }\r\n\r\n  sqlite3BtreeClose(pDb->pBt);\r\n  pDb->pBt = 0;\r\n  pDb->pSchema = 0;\r\n  sqlite3ResetInternalSchema(db, -1);\r\n  return;\r\n\r\ndetach_error:\r\n  sqlite3_result_error(context, zErr, -1);\r\n}\r\n\r\n/*\r\n** This procedure generates VDBE code for a single invocation of either the\r\n** sqlite_detach() or sqlite_attach() SQL user functions.\r\n*/\r\nstatic void codeAttach(\r\n  Parse *pParse,       /* The parser context */\r\n  int type,            /* Either SQLITE_ATTACH or SQLITE_DETACH */\r\n  FuncDef const *pFunc,/* FuncDef wrapper for detachFunc() or attachFunc() */\r\n  Expr *pAuthArg,      /* Expression to pass to authorization callback */\r\n  Expr *pFilename,     /* Name of database file */\r\n  Expr *pDbname,       /* Name of the database to use internally */\r\n  Expr *pKey           /* Database key for encryption extension */\r\n){\r\n  int rc;\r\n  NameContext sName;\r\n  Vdbe *v;\r\n  sqlite3* db = pParse->db;\r\n  int regArgs;\r\n\r\n  memset(&sName, 0, sizeof(NameContext));\r\n  sName.pParse = pParse;\r\n\r\n  if( \r\n      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) ||\r\n      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) ||\r\n      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pKey))\r\n  ){\r\n    pParse->nErr++;\r\n    goto attach_end;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  if( pAuthArg ){\r\n    char *zAuthArg;\r\n    if( pAuthArg->op==TK_STRING ){\r\n      zAuthArg = pAuthArg->u.zToken;\r\n    }else{\r\n      zAuthArg = 0;\r\n    }\r\n    rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);\r\n    if(rc!=SQLITE_OK ){\r\n      goto attach_end;\r\n    }\r\n  }\r\n#endif /* SQLITE_OMIT_AUTHORIZATION */\r\n\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  regArgs = sqlite3GetTempRange(pParse, 4);\r\n  sqlite3ExprCode(pParse, pFilename, regArgs);\r\n  sqlite3ExprCode(pParse, pDbname, regArgs+1);\r\n  sqlite3ExprCode(pParse, pKey, regArgs+2);\r\n\r\n  assert( v || db->mallocFailed );\r\n  if( v ){\r\n    sqlite3VdbeAddOp3(v, OP_Function, 0, regArgs+3-pFunc->nArg, regArgs+3);\r\n    assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg );\r\n    sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg));\r\n    sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF);\r\n\r\n    /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this\r\n    ** statement only). For DETACH, set it to false (expire all existing\r\n    ** statements).\r\n    */\r\n    sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH));\r\n  }\r\n  \r\nattach_end:\r\n  sqlite3ExprDelete(db, pFilename);\r\n  sqlite3ExprDelete(db, pDbname);\r\n  sqlite3ExprDelete(db, pKey);\r\n}\r\n\r\n/*\r\n** Called by the parser to compile a DETACH statement.\r\n**\r\n**     DETACH pDbname\r\n*/\r\nSQLITE_PRIVATE void sqlite3Detach(Parse *pParse, Expr *pDbname){\r\n  static const FuncDef detach_func = {\r\n    1,                /* nArg */\r\n    SQLITE_UTF8,      /* iPrefEnc */\r\n    0,                /* flags */\r\n    0,                /* pUserData */\r\n    0,                /* pNext */\r\n    detachFunc,       /* xFunc */\r\n    0,                /* xStep */\r\n    0,                /* xFinalize */\r\n    \"sqlite_detach\",  /* zName */\r\n    0,                /* pHash */\r\n    0                 /* pDestructor */\r\n  };\r\n  codeAttach(pParse, SQLITE_DETACH, &detach_func, pDbname, 0, 0, pDbname);\r\n}\r\n\r\n/*\r\n** Called by the parser to compile an ATTACH statement.\r\n**\r\n**     ATTACH p AS pDbname KEY pKey\r\n*/\r\nSQLITE_PRIVATE void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){\r\n  static const FuncDef attach_func = {\r\n    3,                /* nArg */\r\n    SQLITE_UTF8,      /* iPrefEnc */\r\n    0,                /* flags */\r\n    0,                /* pUserData */\r\n    0,                /* pNext */\r\n    attachFunc,       /* xFunc */\r\n    0,                /* xStep */\r\n    0,                /* xFinalize */\r\n    \"sqlite_attach\",  /* zName */\r\n    0,                /* pHash */\r\n    0                 /* pDestructor */\r\n  };\r\n  codeAttach(pParse, SQLITE_ATTACH, &attach_func, p, p, pDbname, pKey);\r\n}\r\n#endif /* SQLITE_OMIT_ATTACH */\r\n\r\n/*\r\n** Initialize a DbFixer structure.  This routine must be called prior\r\n** to passing the structure to one of the sqliteFixAAAA() routines below.\r\n**\r\n** The return value indicates whether or not fixation is required.  TRUE\r\n** means we do need to fix the database references, FALSE means we do not.\r\n*/\r\nSQLITE_PRIVATE int sqlite3FixInit(\r\n  DbFixer *pFix,      /* The fixer to be initialized */\r\n  Parse *pParse,      /* Error messages will be written here */\r\n  int iDb,            /* This is the database that must be used */\r\n  const char *zType,  /* \"view\", \"trigger\", or \"index\" */\r\n  const Token *pName  /* Name of the view, trigger, or index */\r\n){\r\n  sqlite3 *db;\r\n\r\n  if( NEVER(iDb<0) || iDb==1 ) return 0;\r\n  db = pParse->db;\r\n  assert( db->nDb>iDb );\r\n  pFix->pParse = pParse;\r\n  pFix->zDb = db->aDb[iDb].zName;\r\n  pFix->zType = zType;\r\n  pFix->pName = pName;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** The following set of routines walk through the parse tree and assign\r\n** a specific database to all table references where the database name\r\n** was left unspecified in the original SQL statement.  The pFix structure\r\n** must have been initialized by a prior call to sqlite3FixInit().\r\n**\r\n** These routines are used to make sure that an index, trigger, or\r\n** view in one database does not refer to objects in a different database.\r\n** (Exception: indices, triggers, and views in the TEMP database are\r\n** allowed to refer to anything.)  If a reference is explicitly made\r\n** to an object in a different database, an error message is added to\r\n** pParse->zErrMsg and these routines return non-zero.  If everything\r\n** checks out, these routines return 0.\r\n*/\r\nSQLITE_PRIVATE int sqlite3FixSrcList(\r\n  DbFixer *pFix,       /* Context of the fixation */\r\n  SrcList *pList       /* The Source list to check and modify */\r\n){\r\n  int i;\r\n  const char *zDb;\r\n  struct SrcList_item *pItem;\r\n\r\n  if( NEVER(pList==0) ) return 0;\r\n  zDb = pFix->zDb;\r\n  for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){\r\n    if( pItem->zDatabase==0 ){\r\n      pItem->zDatabase = sqlite3DbStrDup(pFix->pParse->db, zDb);\r\n    }else if( sqlite3StrICmp(pItem->zDatabase,zDb)!=0 ){\r\n      sqlite3ErrorMsg(pFix->pParse,\r\n         \"%s %T cannot reference objects in database %s\",\r\n         pFix->zType, pFix->pName, pItem->zDatabase);\r\n      return 1;\r\n    }\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)\r\n    if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;\r\n    if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;\r\n#endif\r\n  }\r\n  return 0;\r\n}\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)\r\nSQLITE_PRIVATE int sqlite3FixSelect(\r\n  DbFixer *pFix,       /* Context of the fixation */\r\n  Select *pSelect      /* The SELECT statement to be fixed to one database */\r\n){\r\n  while( pSelect ){\r\n    if( sqlite3FixExprList(pFix, pSelect->pEList) ){\r\n      return 1;\r\n    }\r\n    if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){\r\n      return 1;\r\n    }\r\n    if( sqlite3FixExpr(pFix, pSelect->pWhere) ){\r\n      return 1;\r\n    }\r\n    if( sqlite3FixExpr(pFix, pSelect->pHaving) ){\r\n      return 1;\r\n    }\r\n    pSelect = pSelect->pPrior;\r\n  }\r\n  return 0;\r\n}\r\nSQLITE_PRIVATE int sqlite3FixExpr(\r\n  DbFixer *pFix,     /* Context of the fixation */\r\n  Expr *pExpr        /* The expression to be fixed to one database */\r\n){\r\n  while( pExpr ){\r\n    if( ExprHasAnyProperty(pExpr, EP_TokenOnly) ) break;\r\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n      if( sqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1;\r\n    }else{\r\n      if( sqlite3FixExprList(pFix, pExpr->x.pList) ) return 1;\r\n    }\r\n    if( sqlite3FixExpr(pFix, pExpr->pRight) ){\r\n      return 1;\r\n    }\r\n    pExpr = pExpr->pLeft;\r\n  }\r\n  return 0;\r\n}\r\nSQLITE_PRIVATE int sqlite3FixExprList(\r\n  DbFixer *pFix,     /* Context of the fixation */\r\n  ExprList *pList    /* The expression to be fixed to one database */\r\n){\r\n  int i;\r\n  struct ExprList_item *pItem;\r\n  if( pList==0 ) return 0;\r\n  for(i=0, pItem=pList->a; i<pList->nExpr; i++, pItem++){\r\n    if( sqlite3FixExpr(pFix, pItem->pExpr) ){\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\nSQLITE_PRIVATE int sqlite3FixTriggerStep(\r\n  DbFixer *pFix,     /* Context of the fixation */\r\n  TriggerStep *pStep /* The trigger step be fixed to one database */\r\n){\r\n  while( pStep ){\r\n    if( sqlite3FixSelect(pFix, pStep->pSelect) ){\r\n      return 1;\r\n    }\r\n    if( sqlite3FixExpr(pFix, pStep->pWhere) ){\r\n      return 1;\r\n    }\r\n    if( sqlite3FixExprList(pFix, pStep->pExprList) ){\r\n      return 1;\r\n    }\r\n    pStep = pStep->pNext;\r\n  }\r\n  return 0;\r\n}\r\n#endif\r\n\r\n/************** End of attach.c **********************************************/\r\n/************** Begin file auth.c ********************************************/\r\n/*\r\n** 2003 January 11\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used to implement the sqlite3_set_authorizer()\r\n** API.  This facility is an optional feature of the library.  Embedded\r\n** systems that do not need this facility may omit it by recompiling\r\n** the library with -DSQLITE_OMIT_AUTHORIZATION=1\r\n*/\r\n\r\n/*\r\n** All of the code in this file may be omitted by defining a single\r\n** macro.\r\n*/\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n\r\n/*\r\n** Set or clear the access authorization function.\r\n**\r\n** The access authorization function is be called during the compilation\r\n** phase to verify that the user has read and/or write access permission on\r\n** various fields of the database.  The first argument to the auth function\r\n** is a copy of the 3rd argument to this routine.  The second argument\r\n** to the auth function is one of these constants:\r\n**\r\n**       SQLITE_CREATE_INDEX\r\n**       SQLITE_CREATE_TABLE\r\n**       SQLITE_CREATE_TEMP_INDEX\r\n**       SQLITE_CREATE_TEMP_TABLE\r\n**       SQLITE_CREATE_TEMP_TRIGGER\r\n**       SQLITE_CREATE_TEMP_VIEW\r\n**       SQLITE_CREATE_TRIGGER\r\n**       SQLITE_CREATE_VIEW\r\n**       SQLITE_DELETE\r\n**       SQLITE_DROP_INDEX\r\n**       SQLITE_DROP_TABLE\r\n**       SQLITE_DROP_TEMP_INDEX\r\n**       SQLITE_DROP_TEMP_TABLE\r\n**       SQLITE_DROP_TEMP_TRIGGER\r\n**       SQLITE_DROP_TEMP_VIEW\r\n**       SQLITE_DROP_TRIGGER\r\n**       SQLITE_DROP_VIEW\r\n**       SQLITE_INSERT\r\n**       SQLITE_PRAGMA\r\n**       SQLITE_READ\r\n**       SQLITE_SELECT\r\n**       SQLITE_TRANSACTION\r\n**       SQLITE_UPDATE\r\n**\r\n** The third and fourth arguments to the auth function are the name of\r\n** the table and the column that are being accessed.  The auth function\r\n** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE.  If\r\n** SQLITE_OK is returned, it means that access is allowed.  SQLITE_DENY\r\n** means that the SQL statement will never-run - the sqlite3_exec() call\r\n** will return with an error.  SQLITE_IGNORE means that the SQL statement\r\n** should run but attempts to read the specified column will return NULL\r\n** and attempts to write the column will be ignored.\r\n**\r\n** Setting the auth function to NULL disables this hook.  The default\r\n** setting of the auth function is NULL.\r\n*/\r\nSQLITE_API int sqlite3_set_authorizer(\r\n  sqlite3 *db,\r\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),\r\n  void *pArg\r\n){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  db->xAuth = xAuth;\r\n  db->pAuthArg = pArg;\r\n  sqlite3ExpirePreparedStatements(db);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Write an error message into pParse->zErrMsg that explains that the\r\n** user-supplied authorization function returned an illegal value.\r\n*/\r\nstatic void sqliteAuthBadReturnCode(Parse *pParse){\r\n  sqlite3ErrorMsg(pParse, \"authorizer malfunction\");\r\n  pParse->rc = SQLITE_ERROR;\r\n}\r\n\r\n/*\r\n** Invoke the authorization callback for permission to read column zCol from\r\n** table zTab in database zDb. This function assumes that an authorization\r\n** callback has been registered (i.e. that sqlite3.xAuth is not NULL).\r\n**\r\n** If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed\r\n** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE\r\n** is treated as SQLITE_DENY. In this case an error is left in pParse.\r\n*/\r\nSQLITE_PRIVATE int sqlite3AuthReadCol(\r\n  Parse *pParse,                  /* The parser context */\r\n  const char *zTab,               /* Table name */\r\n  const char *zCol,               /* Column name */\r\n  int iDb                         /* Index of containing database. */\r\n){\r\n  sqlite3 *db = pParse->db;       /* Database handle */\r\n  char *zDb = db->aDb[iDb].zName; /* Name of attached database */\r\n  int rc;                         /* Auth callback return code */\r\n\r\n  rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext);\r\n  if( rc==SQLITE_DENY ){\r\n    if( db->nDb>2 || iDb!=0 ){\r\n      sqlite3ErrorMsg(pParse, \"access to %s.%s.%s is prohibited\",zDb,zTab,zCol);\r\n    }else{\r\n      sqlite3ErrorMsg(pParse, \"access to %s.%s is prohibited\", zTab, zCol);\r\n    }\r\n    pParse->rc = SQLITE_AUTH;\r\n  }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){\r\n    sqliteAuthBadReturnCode(pParse);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The pExpr should be a TK_COLUMN expression.  The table referred to\r\n** is in pTabList or else it is the NEW or OLD table of a trigger.  \r\n** Check to see if it is OK to read this particular column.\r\n**\r\n** If the auth function returns SQLITE_IGNORE, change the TK_COLUMN \r\n** instruction into a TK_NULL.  If the auth function returns SQLITE_DENY,\r\n** then generate an error.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AuthRead(\r\n  Parse *pParse,        /* The parser context */\r\n  Expr *pExpr,          /* The expression to check authorization on */\r\n  Schema *pSchema,      /* The schema of the expression */\r\n  SrcList *pTabList     /* All table that pExpr might refer to */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n  Table *pTab = 0;      /* The table being read */\r\n  const char *zCol;     /* Name of the column of the table */\r\n  int iSrc;             /* Index in pTabList->a[] of table being read */\r\n  int iDb;              /* The index of the database the expression refers to */\r\n  int iCol;             /* Index of column in table */\r\n\r\n  if( db->xAuth==0 ) return;\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pSchema);\r\n  if( iDb<0 ){\r\n    /* An attempt to read a column out of a subquery or other\r\n    ** temporary table. */\r\n    return;\r\n  }\r\n\r\n  assert( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER );\r\n  if( pExpr->op==TK_TRIGGER ){\r\n    pTab = pParse->pTriggerTab;\r\n  }else{\r\n    assert( pTabList );\r\n    for(iSrc=0; ALWAYS(iSrc<pTabList->nSrc); iSrc++){\r\n      if( pExpr->iTable==pTabList->a[iSrc].iCursor ){\r\n        pTab = pTabList->a[iSrc].pTab;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  iCol = pExpr->iColumn;\r\n  if( NEVER(pTab==0) ) return;\r\n\r\n  if( iCol>=0 ){\r\n    assert( iCol<pTab->nCol );\r\n    zCol = pTab->aCol[iCol].zName;\r\n  }else if( pTab->iPKey>=0 ){\r\n    assert( pTab->iPKey<pTab->nCol );\r\n    zCol = pTab->aCol[pTab->iPKey].zName;\r\n  }else{\r\n    zCol = \"ROWID\";\r\n  }\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){\r\n    pExpr->op = TK_NULL;\r\n  }\r\n}\r\n\r\n/*\r\n** Do an authorization check using the code and arguments given.  Return\r\n** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY\r\n** is returned, then the error count and error message in pParse are\r\n** modified appropriately.\r\n*/\r\nSQLITE_PRIVATE int sqlite3AuthCheck(\r\n  Parse *pParse,\r\n  int code,\r\n  const char *zArg1,\r\n  const char *zArg2,\r\n  const char *zArg3\r\n){\r\n  sqlite3 *db = pParse->db;\r\n  int rc;\r\n\r\n  /* Don't do any authorization checks if the database is initialising\r\n  ** or if the parser is being invoked from within sqlite3_declare_vtab.\r\n  */\r\n  if( db->init.busy || IN_DECLARE_VTAB ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  if( db->xAuth==0 ){\r\n    return SQLITE_OK;\r\n  }\r\n  rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext);\r\n  if( rc==SQLITE_DENY ){\r\n    sqlite3ErrorMsg(pParse, \"not authorized\");\r\n    pParse->rc = SQLITE_AUTH;\r\n  }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){\r\n    rc = SQLITE_DENY;\r\n    sqliteAuthBadReturnCode(pParse);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Push an authorization context.  After this routine is called, the\r\n** zArg3 argument to authorization callbacks will be zContext until\r\n** popped.  Or if pParse==0, this routine is a no-op.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AuthContextPush(\r\n  Parse *pParse,\r\n  AuthContext *pContext, \r\n  const char *zContext\r\n){\r\n  assert( pParse );\r\n  pContext->pParse = pParse;\r\n  pContext->zAuthContext = pParse->zAuthContext;\r\n  pParse->zAuthContext = zContext;\r\n}\r\n\r\n/*\r\n** Pop an authorization context that was previously pushed\r\n** by sqlite3AuthContextPush\r\n*/\r\nSQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext){\r\n  if( pContext->pParse ){\r\n    pContext->pParse->zAuthContext = pContext->zAuthContext;\r\n    pContext->pParse = 0;\r\n  }\r\n}\r\n\r\n#endif /* SQLITE_OMIT_AUTHORIZATION */\r\n\r\n/************** End of auth.c ************************************************/\r\n/************** Begin file build.c *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains C code routines that are called by the SQLite parser\r\n** when syntax rules are reduced.  The routines in this file handle the\r\n** following kinds of SQL syntax:\r\n**\r\n**     CREATE TABLE\r\n**     DROP TABLE\r\n**     CREATE INDEX\r\n**     DROP INDEX\r\n**     creating ID lists\r\n**     BEGIN TRANSACTION\r\n**     COMMIT\r\n**     ROLLBACK\r\n*/\r\n\r\n/*\r\n** This routine is called when a new SQL statement is beginning to\r\n** be parsed.  Initialize the pParse structure as needed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BeginParse(Parse *pParse, int explainFlag){\r\n  pParse->explain = (u8)explainFlag;\r\n  pParse->nVar = 0;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n/*\r\n** The TableLock structure is only used by the sqlite3TableLock() and\r\n** codeTableLocks() functions.\r\n*/\r\nstruct TableLock {\r\n  int iDb;             /* The database containing the table to be locked */\r\n  int iTab;            /* The root page of the table to be locked */\r\n  u8 isWriteLock;      /* True for write lock.  False for a read lock */\r\n  const char *zName;   /* Name of the table */\r\n};\r\n\r\n/*\r\n** Record the fact that we want to lock a table at run-time.  \r\n**\r\n** The table to be locked has root page iTab and is found in database iDb.\r\n** A read or a write lock can be taken depending on isWritelock.\r\n**\r\n** This routine just records the fact that the lock is desired.  The\r\n** code to make the lock occur is generated by a later call to\r\n** codeTableLocks() which occurs during sqlite3FinishCoding().\r\n*/\r\nSQLITE_PRIVATE void sqlite3TableLock(\r\n  Parse *pParse,     /* Parsing context */\r\n  int iDb,           /* Index of the database containing the table to lock */\r\n  int iTab,          /* Root page number of the table to be locked */\r\n  u8 isWriteLock,    /* True for a write lock */\r\n  const char *zName  /* Name of the table to be locked */\r\n){\r\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n  int i;\r\n  int nBytes;\r\n  TableLock *p;\r\n  assert( iDb>=0 );\r\n\r\n  for(i=0; i<pToplevel->nTableLock; i++){\r\n    p = &pToplevel->aTableLock[i];\r\n    if( p->iDb==iDb && p->iTab==iTab ){\r\n      p->isWriteLock = (p->isWriteLock || isWriteLock);\r\n      return;\r\n    }\r\n  }\r\n\r\n  nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1);\r\n  pToplevel->aTableLock =\r\n      sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes);\r\n  if( pToplevel->aTableLock ){\r\n    p = &pToplevel->aTableLock[pToplevel->nTableLock++];\r\n    p->iDb = iDb;\r\n    p->iTab = iTab;\r\n    p->isWriteLock = isWriteLock;\r\n    p->zName = zName;\r\n  }else{\r\n    pToplevel->nTableLock = 0;\r\n    pToplevel->db->mallocFailed = 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Code an OP_TableLock instruction for each table locked by the\r\n** statement (configured by calls to sqlite3TableLock()).\r\n*/\r\nstatic void codeTableLocks(Parse *pParse){\r\n  int i;\r\n  Vdbe *pVdbe; \r\n\r\n  pVdbe = sqlite3GetVdbe(pParse);\r\n  assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */\r\n\r\n  for(i=0; i<pParse->nTableLock; i++){\r\n    TableLock *p = &pParse->aTableLock[i];\r\n    int p1 = p->iDb;\r\n    sqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock,\r\n                      p->zName, P4_STATIC);\r\n  }\r\n}\r\n#else\r\n  #define codeTableLocks(x)\r\n#endif\r\n\r\n/*\r\n** This routine is called after a single SQL statement has been\r\n** parsed and a VDBE program to execute that statement has been\r\n** prepared.  This routine puts the finishing touches on the\r\n** VDBE program and resets the pParse structure for the next\r\n** parse.\r\n**\r\n** Note that if an error occurred, it might be the case that\r\n** no VDBE code was generated.\r\n*/\r\nSQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){\r\n  sqlite3 *db;\r\n  Vdbe *v;\r\n\r\n  db = pParse->db;\r\n  if( db->mallocFailed ) return;\r\n  if( pParse->nested ) return;\r\n  if( pParse->nErr ) return;\r\n\r\n  /* Begin by generating some termination code at the end of the\r\n  ** vdbe program\r\n  */\r\n  v = sqlite3GetVdbe(pParse);\r\n  assert( !pParse->isMultiWrite \r\n       || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));\r\n  if( v ){\r\n    sqlite3VdbeAddOp0(v, OP_Halt);\r\n\r\n    /* The cookie mask contains one bit for each database file open.\r\n    ** (Bit 0 is for main, bit 1 is for temp, and so forth.)  Bits are\r\n    ** set for each database that is used.  Generate code to start a\r\n    ** transaction on each used database and to verify the schema cookie\r\n    ** on each used database.\r\n    */\r\n    if( pParse->cookieGoto>0 ){\r\n      yDbMask mask;\r\n      int iDb;\r\n      sqlite3VdbeJumpHere(v, pParse->cookieGoto-1);\r\n      for(iDb=0, mask=1; iDb<db->nDb; mask<<=1, iDb++){\r\n        if( (mask & pParse->cookieMask)==0 ) continue;\r\n        sqlite3VdbeUsesBtree(v, iDb);\r\n        sqlite3VdbeAddOp2(v,OP_Transaction, iDb, (mask & pParse->writeMask)!=0);\r\n        if( db->init.busy==0 ){\r\n          assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n          sqlite3VdbeAddOp3(v, OP_VerifyCookie,\r\n                            iDb, pParse->cookieValue[iDb],\r\n                            db->aDb[iDb].pSchema->iGeneration);\r\n        }\r\n      }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n      {\r\n        int i;\r\n        for(i=0; i<pParse->nVtabLock; i++){\r\n          char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);\r\n          sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);\r\n        }\r\n        pParse->nVtabLock = 0;\r\n      }\r\n#endif\r\n\r\n      /* Once all the cookies have been verified and transactions opened, \r\n      ** obtain the required table-locks. This is a no-op unless the \r\n      ** shared-cache feature is enabled.\r\n      */\r\n      codeTableLocks(pParse);\r\n\r\n      /* Initialize any AUTOINCREMENT data structures required.\r\n      */\r\n      sqlite3AutoincrementBegin(pParse);\r\n\r\n      /* Finally, jump back to the beginning of the executable code. */\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, pParse->cookieGoto);\r\n    }\r\n  }\r\n\r\n\r\n  /* Get the VDBE program ready for execution\r\n  */\r\n  if( v && ALWAYS(pParse->nErr==0) && !db->mallocFailed ){\r\n#ifdef SQLITE_DEBUG\r\n    FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;\r\n    sqlite3VdbeTrace(v, trace);\r\n#endif\r\n    assert( pParse->iCacheLevel==0 );  /* Disables and re-enables match */\r\n    /* A minimum of one cursor is required if autoincrement is used\r\n    *  See ticket [a696379c1f08866] */\r\n    if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;\r\n    sqlite3VdbeMakeReady(v, pParse);\r\n    pParse->rc = SQLITE_DONE;\r\n    pParse->colNamesSet = 0;\r\n  }else{\r\n    pParse->rc = SQLITE_ERROR;\r\n  }\r\n  pParse->nTab = 0;\r\n  pParse->nMem = 0;\r\n  pParse->nSet = 0;\r\n  pParse->nVar = 0;\r\n  pParse->cookieMask = 0;\r\n  pParse->cookieGoto = 0;\r\n}\r\n\r\n/*\r\n** Run the parser and code generator recursively in order to generate\r\n** code for the SQL statement given onto the end of the pParse context\r\n** currently under construction.  When the parser is run recursively\r\n** this way, the final OP_Halt is not appended and other initialization\r\n** and finalization steps are omitted because those are handling by the\r\n** outermost parser.\r\n**\r\n** Not everything is nestable.  This facility is designed to permit\r\n** INSERT, UPDATE, and DELETE operations against SQLITE_MASTER.  Use\r\n** care if you decide to try to use this routine for some other purposes.\r\n*/\r\nSQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){\r\n  va_list ap;\r\n  char *zSql;\r\n  char *zErrMsg = 0;\r\n  sqlite3 *db = pParse->db;\r\n# define SAVE_SZ  (sizeof(Parse) - offsetof(Parse,nVar))\r\n  char saveBuf[SAVE_SZ];\r\n\r\n  if( pParse->nErr ) return;\r\n  assert( pParse->nested<10 );  /* Nesting should only be of limited depth */\r\n  va_start(ap, zFormat);\r\n  zSql = sqlite3VMPrintf(db, zFormat, ap);\r\n  va_end(ap);\r\n  if( zSql==0 ){\r\n    return;   /* A malloc must have failed */\r\n  }\r\n  pParse->nested++;\r\n  memcpy(saveBuf, &pParse->nVar, SAVE_SZ);\r\n  memset(&pParse->nVar, 0, SAVE_SZ);\r\n  sqlite3RunParser(pParse, zSql, &zErrMsg);\r\n  sqlite3DbFree(db, zErrMsg);\r\n  sqlite3DbFree(db, zSql);\r\n  memcpy(&pParse->nVar, saveBuf, SAVE_SZ);\r\n  pParse->nested--;\r\n}\r\n\r\n/*\r\n** Locate the in-memory structure that describes a particular database\r\n** table given the name of that table and (optionally) the name of the\r\n** database containing the table.  Return NULL if not found.\r\n**\r\n** If zDatabase is 0, all databases are searched for the table and the\r\n** first matching table is returned.  (No checking for duplicate table\r\n** names is done.)  The search order is TEMP first, then MAIN, then any\r\n** auxiliary databases added using the ATTACH command.\r\n**\r\n** See also sqlite3LocateTable().\r\n*/\r\nSQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){\r\n  Table *p = 0;\r\n  int i;\r\n  int nName;\r\n  assert( zName!=0 );\r\n  nName = sqlite3Strlen30(zName);\r\n  /* All mutexes are required for schema access.  Make sure we hold them. */\r\n  assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );\r\n  for(i=OMIT_TEMPDB; i<db->nDb; i++){\r\n    int j = (i<2) ? i^1 : i;   /* Search TEMP before MAIN */\r\n    if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue;\r\n    assert( sqlite3SchemaMutexHeld(db, j, 0) );\r\n    p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName, nName);\r\n    if( p ) break;\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Locate the in-memory structure that describes a particular database\r\n** table given the name of that table and (optionally) the name of the\r\n** database containing the table.  Return NULL if not found.  Also leave an\r\n** error message in pParse->zErrMsg.\r\n**\r\n** The difference between this routine and sqlite3FindTable() is that this\r\n** routine leaves an error message in pParse->zErrMsg where\r\n** sqlite3FindTable() does not.\r\n*/\r\nSQLITE_PRIVATE Table *sqlite3LocateTable(\r\n  Parse *pParse,         /* context in which to report errors */\r\n  int isView,            /* True if looking for a VIEW rather than a TABLE */\r\n  const char *zName,     /* Name of the table we are looking for */\r\n  const char *zDbase     /* Name of the database.  Might be NULL */\r\n){\r\n  Table *p;\r\n\r\n  /* Read the database schema. If an error occurs, leave an error message\r\n  ** and code in pParse and return NULL. */\r\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n    return 0;\r\n  }\r\n\r\n  p = sqlite3FindTable(pParse->db, zName, zDbase);\r\n  if( p==0 ){\r\n    const char *zMsg = isView ? \"no such view\" : \"no such table\";\r\n    if( zDbase ){\r\n      sqlite3ErrorMsg(pParse, \"%s: %s.%s\", zMsg, zDbase, zName);\r\n    }else{\r\n      sqlite3ErrorMsg(pParse, \"%s: %s\", zMsg, zName);\r\n    }\r\n    pParse->checkSchema = 1;\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Locate the in-memory structure that describes \r\n** a particular index given the name of that index\r\n** and the name of the database that contains the index.\r\n** Return NULL if not found.\r\n**\r\n** If zDatabase is 0, all databases are searched for the\r\n** table and the first matching index is returned.  (No checking\r\n** for duplicate index names is done.)  The search order is\r\n** TEMP first, then MAIN, then any auxiliary databases added\r\n** using the ATTACH command.\r\n*/\r\nSQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){\r\n  Index *p = 0;\r\n  int i;\r\n  int nName = sqlite3Strlen30(zName);\r\n  /* All mutexes are required for schema access.  Make sure we hold them. */\r\n  assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) );\r\n  for(i=OMIT_TEMPDB; i<db->nDb; i++){\r\n    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */\r\n    Schema *pSchema = db->aDb[j].pSchema;\r\n    assert( pSchema );\r\n    if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue;\r\n    assert( sqlite3SchemaMutexHeld(db, j, 0) );\r\n    p = sqlite3HashFind(&pSchema->idxHash, zName, nName);\r\n    if( p ) break;\r\n  }\r\n  return p;\r\n}\r\n\r\n/*\r\n** Reclaim the memory used by an index\r\n*/\r\nstatic void freeIndex(sqlite3 *db, Index *p){\r\n#ifndef SQLITE_OMIT_ANALYZE\r\n  sqlite3DeleteIndexSamples(db, p);\r\n#endif\r\n  sqlite3DbFree(db, p->zColAff);\r\n  sqlite3DbFree(db, p);\r\n}\r\n\r\n/*\r\n** For the index called zIdxName which is found in the database iDb,\r\n** unlike that index from its Table then remove the index from\r\n** the index hash table and free all memory structures associated\r\n** with the index.\r\n*/\r\nSQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){\r\n  Index *pIndex;\r\n  int len;\r\n  Hash *pHash;\r\n\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  pHash = &db->aDb[iDb].pSchema->idxHash;\r\n  len = sqlite3Strlen30(zIdxName);\r\n  pIndex = sqlite3HashInsert(pHash, zIdxName, len, 0);\r\n  if( ALWAYS(pIndex) ){\r\n    if( pIndex->pTable->pIndex==pIndex ){\r\n      pIndex->pTable->pIndex = pIndex->pNext;\r\n    }else{\r\n      Index *p;\r\n      /* Justification of ALWAYS();  The index must be on the list of\r\n      ** indices. */\r\n      p = pIndex->pTable->pIndex;\r\n      while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }\r\n      if( ALWAYS(p && p->pNext==pIndex) ){\r\n        p->pNext = pIndex->pNext;\r\n      }\r\n    }\r\n    freeIndex(db, pIndex);\r\n  }\r\n  db->flags |= SQLITE_InternChanges;\r\n}\r\n\r\n/*\r\n** Erase all schema information from the in-memory hash tables of\r\n** a single database.  This routine is called to reclaim memory\r\n** before the database closes.  It is also called during a rollback\r\n** if there were schema changes during the transaction or if a\r\n** schema-cookie mismatch occurs.\r\n**\r\n** If iDb<0 then reset the internal schema tables for all database\r\n** files.  If iDb>=0 then reset the internal schema for only the\r\n** single file indicated.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ResetInternalSchema(sqlite3 *db, int iDb){\r\n  int i, j;\r\n  assert( iDb<db->nDb );\r\n\r\n  if( iDb>=0 ){\r\n    /* Case 1:  Reset the single schema identified by iDb */\r\n    Db *pDb = &db->aDb[iDb];\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    assert( pDb->pSchema!=0 );\r\n    sqlite3SchemaClear(pDb->pSchema);\r\n\r\n    /* If any database other than TEMP is reset, then also reset TEMP\r\n    ** since TEMP might be holding triggers that reference tables in the\r\n    ** other database.\r\n    */\r\n    if( iDb!=1 ){\r\n      pDb = &db->aDb[1];\r\n      assert( pDb->pSchema!=0 );\r\n      sqlite3SchemaClear(pDb->pSchema);\r\n    }\r\n    return;\r\n  }\r\n  /* Case 2 (from here to the end): Reset all schemas for all attached\r\n  ** databases. */\r\n  assert( iDb<0 );\r\n  sqlite3BtreeEnterAll(db);\r\n  for(i=0; i<db->nDb; i++){\r\n    Db *pDb = &db->aDb[i];\r\n    if( pDb->pSchema ){\r\n      sqlite3SchemaClear(pDb->pSchema);\r\n    }\r\n  }\r\n  db->flags &= ~SQLITE_InternChanges;\r\n  sqlite3VtabUnlockList(db);\r\n  sqlite3BtreeLeaveAll(db);\r\n\r\n  /* If one or more of the auxiliary database files has been closed,\r\n  ** then remove them from the auxiliary database list.  We take the\r\n  ** opportunity to do this here since we have just deleted all of the\r\n  ** schema hash tables and therefore do not have to make any changes\r\n  ** to any of those tables.\r\n  */\r\n  for(i=j=2; i<db->nDb; i++){\r\n    struct Db *pDb = &db->aDb[i];\r\n    if( pDb->pBt==0 ){\r\n      sqlite3DbFree(db, pDb->zName);\r\n      pDb->zName = 0;\r\n      continue;\r\n    }\r\n    if( j<i ){\r\n      db->aDb[j] = db->aDb[i];\r\n    }\r\n    j++;\r\n  }\r\n  memset(&db->aDb[j], 0, (db->nDb-j)*sizeof(db->aDb[j]));\r\n  db->nDb = j;\r\n  if( db->nDb<=2 && db->aDb!=db->aDbStatic ){\r\n    memcpy(db->aDbStatic, db->aDb, 2*sizeof(db->aDb[0]));\r\n    sqlite3DbFree(db, db->aDb);\r\n    db->aDb = db->aDbStatic;\r\n  }\r\n}\r\n\r\n/*\r\n** This routine is called when a commit occurs.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){\r\n  db->flags &= ~SQLITE_InternChanges;\r\n}\r\n\r\n/*\r\n** Delete memory allocated for the column names of a table or view (the\r\n** Table.aCol[] array).\r\n*/\r\nstatic void sqliteDeleteColumnNames(sqlite3 *db, Table *pTable){\r\n  int i;\r\n  Column *pCol;\r\n  assert( pTable!=0 );\r\n  if( (pCol = pTable->aCol)!=0 ){\r\n    for(i=0; i<pTable->nCol; i++, pCol++){\r\n      sqlite3DbFree(db, pCol->zName);\r\n      sqlite3ExprDelete(db, pCol->pDflt);\r\n      sqlite3DbFree(db, pCol->zDflt);\r\n      sqlite3DbFree(db, pCol->zType);\r\n      sqlite3DbFree(db, pCol->zColl);\r\n    }\r\n    sqlite3DbFree(db, pTable->aCol);\r\n  }\r\n}\r\n\r\n/*\r\n** Remove the memory data structures associated with the given\r\n** Table.  No changes are made to disk by this routine.\r\n**\r\n** This routine just deletes the data structure.  It does not unlink\r\n** the table data structure from the hash table.  But it does destroy\r\n** memory structures of the indices and foreign keys associated with \r\n** the table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){\r\n  Index *pIndex, *pNext;\r\n\r\n  assert( !pTable || pTable->nRef>0 );\r\n\r\n  /* Do not delete the table until the reference count reaches zero. */\r\n  if( !pTable ) return;\r\n  if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;\r\n\r\n  /* Delete all indices associated with this table. */\r\n  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){\r\n    pNext = pIndex->pNext;\r\n    assert( pIndex->pSchema==pTable->pSchema );\r\n    if( !db || db->pnBytesFreed==0 ){\r\n      char *zName = pIndex->zName; \r\n      TESTONLY ( Index *pOld = ) sqlite3HashInsert(\r\n\t  &pIndex->pSchema->idxHash, zName, sqlite3Strlen30(zName), 0\r\n      );\r\n      assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );\r\n      assert( pOld==pIndex || pOld==0 );\r\n    }\r\n    freeIndex(db, pIndex);\r\n  }\r\n\r\n  /* Delete any foreign keys attached to this table. */\r\n  sqlite3FkDelete(db, pTable);\r\n\r\n  /* Delete the Table structure itself.\r\n  */\r\n  sqliteDeleteColumnNames(db, pTable);\r\n  sqlite3DbFree(db, pTable->zName);\r\n  sqlite3DbFree(db, pTable->zColAff);\r\n  sqlite3SelectDelete(db, pTable->pSelect);\r\n#ifndef SQLITE_OMIT_CHECK\r\n  sqlite3ExprDelete(db, pTable->pCheck);\r\n#endif\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  sqlite3VtabClear(db, pTable);\r\n#endif\r\n  sqlite3DbFree(db, pTable);\r\n}\r\n\r\n/*\r\n** Unlink the given table from the hash tables and the delete the\r\n** table structure with all its indices and foreign keys.\r\n*/\r\nSQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){\r\n  Table *p;\r\n  Db *pDb;\r\n\r\n  assert( db!=0 );\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  assert( zTabName );\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  testcase( zTabName[0]==0 );  /* Zero-length table names are allowed */\r\n  pDb = &db->aDb[iDb];\r\n  p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName,\r\n                        sqlite3Strlen30(zTabName),0);\r\n  sqlite3DeleteTable(db, p);\r\n  db->flags |= SQLITE_InternChanges;\r\n}\r\n\r\n/*\r\n** Given a token, return a string that consists of the text of that\r\n** token.  Space to hold the returned string\r\n** is obtained from sqliteMalloc() and must be freed by the calling\r\n** function.\r\n**\r\n** Any quotation marks (ex:  \"name\", 'name', [name], or `name`) that\r\n** surround the body of the token are removed.\r\n**\r\n** Tokens are often just pointers into the original SQL text and so\r\n** are not \\000 terminated and are not persistent.  The returned string\r\n** is \\000 terminated and is persistent.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){\r\n  char *zName;\r\n  if( pName ){\r\n    zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n);\r\n    sqlite3Dequote(zName);\r\n  }else{\r\n    zName = 0;\r\n  }\r\n  return zName;\r\n}\r\n\r\n/*\r\n** Open the sqlite_master table stored in database number iDb for\r\n** writing. The table is opened using cursor 0.\r\n*/\r\nSQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *p, int iDb){\r\n  Vdbe *v = sqlite3GetVdbe(p);\r\n  sqlite3TableLock(p, iDb, MASTER_ROOT, 1, SCHEMA_TABLE(iDb));\r\n  sqlite3VdbeAddOp3(v, OP_OpenWrite, 0, MASTER_ROOT, iDb);\r\n  sqlite3VdbeChangeP4(v, -1, (char *)5, P4_INT32);  /* 5 column table */\r\n  if( p->nTab==0 ){\r\n    p->nTab = 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Parameter zName points to a nul-terminated buffer containing the name\r\n** of a database (\"main\", \"temp\" or the name of an attached db). This\r\n** function returns the index of the named database in db->aDb[], or\r\n** -1 if the named db cannot be found.\r\n*/\r\nSQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *db, const char *zName){\r\n  int i = -1;         /* Database number */\r\n  if( zName ){\r\n    Db *pDb;\r\n    int n = sqlite3Strlen30(zName);\r\n    for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){\r\n      if( (!OMIT_TEMPDB || i!=1 ) && n==sqlite3Strlen30(pDb->zName) && \r\n          0==sqlite3StrICmp(pDb->zName, zName) ){\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  return i;\r\n}\r\n\r\n/*\r\n** The token *pName contains the name of a database (either \"main\" or\r\n** \"temp\" or the name of an attached db). This routine returns the\r\n** index of the named database in db->aDb[], or -1 if the named db \r\n** does not exist.\r\n*/\r\nSQLITE_PRIVATE int sqlite3FindDb(sqlite3 *db, Token *pName){\r\n  int i;                               /* Database number */\r\n  char *zName;                         /* Name we are searching for */\r\n  zName = sqlite3NameFromToken(db, pName);\r\n  i = sqlite3FindDbName(db, zName);\r\n  sqlite3DbFree(db, zName);\r\n  return i;\r\n}\r\n\r\n/* The table or view or trigger name is passed to this routine via tokens\r\n** pName1 and pName2. If the table name was fully qualified, for example:\r\n**\r\n** CREATE TABLE xxx.yyy (...);\r\n** \r\n** Then pName1 is set to \"xxx\" and pName2 \"yyy\". On the other hand if\r\n** the table name is not fully qualified, i.e.:\r\n**\r\n** CREATE TABLE yyy(...);\r\n**\r\n** Then pName1 is set to \"yyy\" and pName2 is \"\".\r\n**\r\n** This routine sets the *ppUnqual pointer to point at the token (pName1 or\r\n** pName2) that stores the unqualified table name.  The index of the\r\n** database \"xxx\" is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3TwoPartName(\r\n  Parse *pParse,      /* Parsing and code generating context */\r\n  Token *pName1,      /* The \"xxx\" in the name \"xxx.yyy\" or \"xxx\" */\r\n  Token *pName2,      /* The \"yyy\" in the name \"xxx.yyy\" */\r\n  Token **pUnqual     /* Write the unqualified object name here */\r\n){\r\n  int iDb;                    /* Database holding the object */\r\n  sqlite3 *db = pParse->db;\r\n\r\n  if( ALWAYS(pName2!=0) && pName2->n>0 ){\r\n    if( db->init.busy ) {\r\n      sqlite3ErrorMsg(pParse, \"corrupt database\");\r\n      pParse->nErr++;\r\n      return -1;\r\n    }\r\n    *pUnqual = pName2;\r\n    iDb = sqlite3FindDb(db, pName1);\r\n    if( iDb<0 ){\r\n      sqlite3ErrorMsg(pParse, \"unknown database %T\", pName1);\r\n      pParse->nErr++;\r\n      return -1;\r\n    }\r\n  }else{\r\n    assert( db->init.iDb==0 || db->init.busy );\r\n    iDb = db->init.iDb;\r\n    *pUnqual = pName1;\r\n  }\r\n  return iDb;\r\n}\r\n\r\n/*\r\n** This routine is used to check if the UTF-8 string zName is a legal\r\n** unqualified name for a new schema object (table, index, view or\r\n** trigger). All names are legal except those that begin with the string\r\n** \"sqlite_\" (in upper, lower or mixed case). This portion of the namespace\r\n** is reserved for internal use.\r\n*/\r\nSQLITE_PRIVATE int sqlite3CheckObjectName(Parse *pParse, const char *zName){\r\n  if( !pParse->db->init.busy && pParse->nested==0 \r\n          && (pParse->db->flags & SQLITE_WriteSchema)==0\r\n          && 0==sqlite3StrNICmp(zName, \"sqlite_\", 7) ){\r\n    sqlite3ErrorMsg(pParse, \"object name reserved for internal use: %s\", zName);\r\n    return SQLITE_ERROR;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Begin constructing a new table representation in memory.  This is\r\n** the first of several action routines that get called in response\r\n** to a CREATE TABLE statement.  In particular, this routine is called\r\n** after seeing tokens \"CREATE\" and \"TABLE\" and the table name. The isTemp\r\n** flag is true if the table should be stored in the auxiliary database\r\n** file instead of in the main database file.  This is normally the case\r\n** when the \"TEMP\" or \"TEMPORARY\" keyword occurs in between\r\n** CREATE and TABLE.\r\n**\r\n** The new table record is initialized and put in pParse->pNewTable.\r\n** As more of the CREATE TABLE statement is parsed, additional action\r\n** routines will be called to add more information to this record.\r\n** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine\r\n** is called to complete the construction of the new table record.\r\n*/\r\nSQLITE_PRIVATE void sqlite3StartTable(\r\n  Parse *pParse,   /* Parser context */\r\n  Token *pName1,   /* First part of the name of the table or view */\r\n  Token *pName2,   /* Second part of the name of the table or view */\r\n  int isTemp,      /* True if this is a TEMP table */\r\n  int isView,      /* True if this is a VIEW */\r\n  int isVirtual,   /* True if this is a VIRTUAL table */\r\n  int noErr        /* Do nothing if table already exists */\r\n){\r\n  Table *pTable;\r\n  char *zName = 0; /* The name of the new table */\r\n  sqlite3 *db = pParse->db;\r\n  Vdbe *v;\r\n  int iDb;         /* Database number to create the table in */\r\n  Token *pName;    /* Unqualified name of the table to create */\r\n\r\n  /* The table or view name to create is passed to this routine via tokens\r\n  ** pName1 and pName2. If the table name was fully qualified, for example:\r\n  **\r\n  ** CREATE TABLE xxx.yyy (...);\r\n  ** \r\n  ** Then pName1 is set to \"xxx\" and pName2 \"yyy\". On the other hand if\r\n  ** the table name is not fully qualified, i.e.:\r\n  **\r\n  ** CREATE TABLE yyy(...);\r\n  **\r\n  ** Then pName1 is set to \"yyy\" and pName2 is \"\".\r\n  **\r\n  ** The call below sets the pName pointer to point at the token (pName1 or\r\n  ** pName2) that stores the unqualified table name. The variable iDb is\r\n  ** set to the index of the database that the table or view is to be\r\n  ** created in.\r\n  */\r\n  iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);\r\n  if( iDb<0 ) return;\r\n  if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){\r\n    /* If creating a temp table, the name may not be qualified. Unless \r\n    ** the database name is \"temp\" anyway.  */\r\n    sqlite3ErrorMsg(pParse, \"temporary table name must be unqualified\");\r\n    return;\r\n  }\r\n  if( !OMIT_TEMPDB && isTemp ) iDb = 1;\r\n\r\n  pParse->sNameToken = *pName;\r\n  zName = sqlite3NameFromToken(db, pName);\r\n  if( zName==0 ) return;\r\n  if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){\r\n    goto begin_table_error;\r\n  }\r\n  if( db->init.iDb==1 ) isTemp = 1;\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  assert( (isTemp & 1)==isTemp );\r\n  {\r\n    int code;\r\n    char *zDb = db->aDb[iDb].zName;\r\n    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){\r\n      goto begin_table_error;\r\n    }\r\n    if( isView ){\r\n      if( !OMIT_TEMPDB && isTemp ){\r\n        code = SQLITE_CREATE_TEMP_VIEW;\r\n      }else{\r\n        code = SQLITE_CREATE_VIEW;\r\n      }\r\n    }else{\r\n      if( !OMIT_TEMPDB && isTemp ){\r\n        code = SQLITE_CREATE_TEMP_TABLE;\r\n      }else{\r\n        code = SQLITE_CREATE_TABLE;\r\n      }\r\n    }\r\n    if( !isVirtual && sqlite3AuthCheck(pParse, code, zName, 0, zDb) ){\r\n      goto begin_table_error;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Make sure the new table name does not collide with an existing\r\n  ** index or table name in the same database.  Issue an error message if\r\n  ** it does. The exception is if the statement being parsed was passed\r\n  ** to an sqlite3_declare_vtab() call. In that case only the column names\r\n  ** and types will be used, so there is no need to test for namespace\r\n  ** collisions.\r\n  */\r\n  if( !IN_DECLARE_VTAB ){\r\n    char *zDb = db->aDb[iDb].zName;\r\n    if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n      goto begin_table_error;\r\n    }\r\n    pTable = sqlite3FindTable(db, zName, zDb);\r\n    if( pTable ){\r\n      if( !noErr ){\r\n        sqlite3ErrorMsg(pParse, \"table %T already exists\", pName);\r\n      }else{\r\n        assert( !db->init.busy );\r\n        sqlite3CodeVerifySchema(pParse, iDb);\r\n      }\r\n      goto begin_table_error;\r\n    }\r\n    if( sqlite3FindIndex(db, zName, zDb)!=0 ){\r\n      sqlite3ErrorMsg(pParse, \"there is already an index named %s\", zName);\r\n      goto begin_table_error;\r\n    }\r\n  }\r\n\r\n  pTable = sqlite3DbMallocZero(db, sizeof(Table));\r\n  if( pTable==0 ){\r\n    db->mallocFailed = 1;\r\n    pParse->rc = SQLITE_NOMEM;\r\n    pParse->nErr++;\r\n    goto begin_table_error;\r\n  }\r\n  pTable->zName = zName;\r\n  pTable->iPKey = -1;\r\n  pTable->pSchema = db->aDb[iDb].pSchema;\r\n  pTable->nRef = 1;\r\n  pTable->nRowEst = 1000000;\r\n  assert( pParse->pNewTable==0 );\r\n  pParse->pNewTable = pTable;\r\n\r\n  /* If this is the magic sqlite_sequence table used by autoincrement,\r\n  ** then record a pointer to this table in the main database structure\r\n  ** so that INSERT can find the table easily.\r\n  */\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n  if( !pParse->nested && strcmp(zName, \"sqlite_sequence\")==0 ){\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    pTable->pSchema->pSeqTab = pTable;\r\n  }\r\n#endif\r\n\r\n  /* Begin generating the code that will insert the table record into\r\n  ** the SQLITE_MASTER table.  Note in particular that we must go ahead\r\n  ** and allocate the record number for the table entry now.  Before any\r\n  ** PRIMARY KEY or UNIQUE keywords are parsed.  Those keywords will cause\r\n  ** indices to be created and the table record must come before the \r\n  ** indices.  Hence, the record number for the table must be allocated\r\n  ** now.\r\n  */\r\n  if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){\r\n    int j1;\r\n    int fileFormat;\r\n    int reg1, reg2, reg3;\r\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    if( isVirtual ){\r\n      sqlite3VdbeAddOp0(v, OP_VBegin);\r\n    }\r\n#endif\r\n\r\n    /* If the file format and encoding in the database have not been set, \r\n    ** set them now.\r\n    */\r\n    reg1 = pParse->regRowid = ++pParse->nMem;\r\n    reg2 = pParse->regRoot = ++pParse->nMem;\r\n    reg3 = ++pParse->nMem;\r\n    sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT);\r\n    sqlite3VdbeUsesBtree(v, iDb);\r\n    j1 = sqlite3VdbeAddOp1(v, OP_If, reg3);\r\n    fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ?\r\n                  1 : SQLITE_MAX_FILE_FORMAT;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, fileFormat, reg3);\r\n    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, reg3);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, ENC(db), reg3);\r\n    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, reg3);\r\n    sqlite3VdbeJumpHere(v, j1);\r\n\r\n    /* This just creates a place-holder record in the sqlite_master table.\r\n    ** The record created does not contain anything yet.  It will be replaced\r\n    ** by the real entry in code generated at sqlite3EndTable().\r\n    **\r\n    ** The rowid for the new entry is left in register pParse->regRowid.\r\n    ** The root page number of the new table is left in reg pParse->regRoot.\r\n    ** The rowid and root page number values are needed by the code that\r\n    ** sqlite3EndTable will generate.\r\n    */\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)\r\n    if( isView || isVirtual ){\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2);\r\n    }else\r\n#endif\r\n    {\r\n      sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2);\r\n    }\r\n    sqlite3OpenMasterTable(pParse, iDb);\r\n    sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1);\r\n    sqlite3VdbeAddOp2(v, OP_Null, 0, reg3);\r\n    sqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1);\r\n    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n    sqlite3VdbeAddOp0(v, OP_Close);\r\n  }\r\n\r\n  /* Normal (non-error) return. */\r\n  return;\r\n\r\n  /* If an error occurs, we jump here */\r\nbegin_table_error:\r\n  sqlite3DbFree(db, zName);\r\n  return;\r\n}\r\n\r\n/*\r\n** This macro is used to compare two strings in a case-insensitive manner.\r\n** It is slightly faster than calling sqlite3StrICmp() directly, but\r\n** produces larger code.\r\n**\r\n** WARNING: This macro is not compatible with the strcmp() family. It\r\n** returns true if the two strings are equal, otherwise false.\r\n*/\r\n#define STRICMP(x, y) (\\\r\nsqlite3UpperToLower[*(unsigned char *)(x)]==   \\\r\nsqlite3UpperToLower[*(unsigned char *)(y)]     \\\r\n&& sqlite3StrICmp((x)+1,(y)+1)==0 )\r\n\r\n/*\r\n** Add a new column to the table currently being constructed.\r\n**\r\n** The parser calls this routine once for each column declaration\r\n** in a CREATE TABLE statement.  sqlite3StartTable() gets called\r\n** first to get things going.  Then this routine is called for each\r\n** column.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName){\r\n  Table *p;\r\n  int i;\r\n  char *z;\r\n  Column *pCol;\r\n  sqlite3 *db = pParse->db;\r\n  if( (p = pParse->pNewTable)==0 ) return;\r\n#if SQLITE_MAX_COLUMN\r\n  if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){\r\n    sqlite3ErrorMsg(pParse, \"too many columns on %s\", p->zName);\r\n    return;\r\n  }\r\n#endif\r\n  z = sqlite3NameFromToken(db, pName);\r\n  if( z==0 ) return;\r\n  for(i=0; i<p->nCol; i++){\r\n    if( STRICMP(z, p->aCol[i].zName) ){\r\n      sqlite3ErrorMsg(pParse, \"duplicate column name: %s\", z);\r\n      sqlite3DbFree(db, z);\r\n      return;\r\n    }\r\n  }\r\n  if( (p->nCol & 0x7)==0 ){\r\n    Column *aNew;\r\n    aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0]));\r\n    if( aNew==0 ){\r\n      sqlite3DbFree(db, z);\r\n      return;\r\n    }\r\n    p->aCol = aNew;\r\n  }\r\n  pCol = &p->aCol[p->nCol];\r\n  memset(pCol, 0, sizeof(p->aCol[0]));\r\n  pCol->zName = z;\r\n \r\n  /* If there is no type specified, columns have the default affinity\r\n  ** 'NONE'. If there is a type specified, then sqlite3AddColumnType() will\r\n  ** be called next to set pCol->affinity correctly.\r\n  */\r\n  pCol->affinity = SQLITE_AFF_NONE;\r\n  p->nCol++;\r\n}\r\n\r\n/*\r\n** This routine is called by the parser while in the middle of\r\n** parsing a CREATE TABLE statement.  A \"NOT NULL\" constraint has\r\n** been seen on a column.  This routine sets the notNull flag on\r\n** the column currently under construction.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){\r\n  Table *p;\r\n  p = pParse->pNewTable;\r\n  if( p==0 || NEVER(p->nCol<1) ) return;\r\n  p->aCol[p->nCol-1].notNull = (u8)onError;\r\n}\r\n\r\n/*\r\n** Scan the column type name zType (length nType) and return the\r\n** associated affinity type.\r\n**\r\n** This routine does a case-independent search of zType for the \r\n** substrings in the following table. If one of the substrings is\r\n** found, the corresponding affinity is returned. If zType contains\r\n** more than one of the substrings, entries toward the top of \r\n** the table take priority. For example, if zType is 'BLOBINT', \r\n** SQLITE_AFF_INTEGER is returned.\r\n**\r\n** Substring     | Affinity\r\n** --------------------------------\r\n** 'INT'         | SQLITE_AFF_INTEGER\r\n** 'CHAR'        | SQLITE_AFF_TEXT\r\n** 'CLOB'        | SQLITE_AFF_TEXT\r\n** 'TEXT'        | SQLITE_AFF_TEXT\r\n** 'BLOB'        | SQLITE_AFF_NONE\r\n** 'REAL'        | SQLITE_AFF_REAL\r\n** 'FLOA'        | SQLITE_AFF_REAL\r\n** 'DOUB'        | SQLITE_AFF_REAL\r\n**\r\n** If none of the substrings in the above table are found,\r\n** SQLITE_AFF_NUMERIC is returned.\r\n*/\r\nSQLITE_PRIVATE char sqlite3AffinityType(const char *zIn){\r\n  u32 h = 0;\r\n  char aff = SQLITE_AFF_NUMERIC;\r\n\r\n  if( zIn ) while( zIn[0] ){\r\n    h = (h<<8) + sqlite3UpperToLower[(*zIn)&0xff];\r\n    zIn++;\r\n    if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){             /* CHAR */\r\n      aff = SQLITE_AFF_TEXT; \r\n    }else if( h==(('c'<<24)+('l'<<16)+('o'<<8)+'b') ){       /* CLOB */\r\n      aff = SQLITE_AFF_TEXT;\r\n    }else if( h==(('t'<<24)+('e'<<16)+('x'<<8)+'t') ){       /* TEXT */\r\n      aff = SQLITE_AFF_TEXT;\r\n    }else if( h==(('b'<<24)+('l'<<16)+('o'<<8)+'b')          /* BLOB */\r\n        && (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){\r\n      aff = SQLITE_AFF_NONE;\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n    }else if( h==(('r'<<24)+('e'<<16)+('a'<<8)+'l')          /* REAL */\r\n        && aff==SQLITE_AFF_NUMERIC ){\r\n      aff = SQLITE_AFF_REAL;\r\n    }else if( h==(('f'<<24)+('l'<<16)+('o'<<8)+'a')          /* FLOA */\r\n        && aff==SQLITE_AFF_NUMERIC ){\r\n      aff = SQLITE_AFF_REAL;\r\n    }else if( h==(('d'<<24)+('o'<<16)+('u'<<8)+'b')          /* DOUB */\r\n        && aff==SQLITE_AFF_NUMERIC ){\r\n      aff = SQLITE_AFF_REAL;\r\n#endif\r\n    }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){    /* INT */\r\n      aff = SQLITE_AFF_INTEGER;\r\n      break;\r\n    }\r\n  }\r\n\r\n  return aff;\r\n}\r\n\r\n/*\r\n** This routine is called by the parser while in the middle of\r\n** parsing a CREATE TABLE statement.  The pFirst token is the first\r\n** token in the sequence of tokens that describe the type of the\r\n** column currently under construction.   pLast is the last token\r\n** in the sequence.  Use this information to construct a string\r\n** that contains the typename of the column and store that string\r\n** in zType.\r\n*/ \r\nSQLITE_PRIVATE void sqlite3AddColumnType(Parse *pParse, Token *pType){\r\n  Table *p;\r\n  Column *pCol;\r\n\r\n  p = pParse->pNewTable;\r\n  if( p==0 || NEVER(p->nCol<1) ) return;\r\n  pCol = &p->aCol[p->nCol-1];\r\n  assert( pCol->zType==0 );\r\n  pCol->zType = sqlite3NameFromToken(pParse->db, pType);\r\n  pCol->affinity = sqlite3AffinityType(pCol->zType);\r\n}\r\n\r\n/*\r\n** The expression is the default value for the most recently added column\r\n** of the table currently under construction.\r\n**\r\n** Default value expressions must be constant.  Raise an exception if this\r\n** is not the case.\r\n**\r\n** This routine is called by the parser while in the middle of\r\n** parsing a CREATE TABLE statement.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AddDefaultValue(Parse *pParse, ExprSpan *pSpan){\r\n  Table *p;\r\n  Column *pCol;\r\n  sqlite3 *db = pParse->db;\r\n  p = pParse->pNewTable;\r\n  if( p!=0 ){\r\n    pCol = &(p->aCol[p->nCol-1]);\r\n    if( !sqlite3ExprIsConstantOrFunction(pSpan->pExpr) ){\r\n      sqlite3ErrorMsg(pParse, \"default value of column [%s] is not constant\",\r\n          pCol->zName);\r\n    }else{\r\n      /* A copy of pExpr is used instead of the original, as pExpr contains\r\n      ** tokens that point to volatile memory. The 'span' of the expression\r\n      ** is required by pragma table_info.\r\n      */\r\n      sqlite3ExprDelete(db, pCol->pDflt);\r\n      pCol->pDflt = sqlite3ExprDup(db, pSpan->pExpr, EXPRDUP_REDUCE);\r\n      sqlite3DbFree(db, pCol->zDflt);\r\n      pCol->zDflt = sqlite3DbStrNDup(db, (char*)pSpan->zStart,\r\n                                     (int)(pSpan->zEnd - pSpan->zStart));\r\n    }\r\n  }\r\n  sqlite3ExprDelete(db, pSpan->pExpr);\r\n}\r\n\r\n/*\r\n** Designate the PRIMARY KEY for the table.  pList is a list of names \r\n** of columns that form the primary key.  If pList is NULL, then the\r\n** most recently added column of the table is the primary key.\r\n**\r\n** A table can have at most one primary key.  If the table already has\r\n** a primary key (and this is the second primary key) then create an\r\n** error.\r\n**\r\n** If the PRIMARY KEY is on a single column whose datatype is INTEGER,\r\n** then we will try to use that column as the rowid.  Set the Table.iPKey\r\n** field of the table under construction to be the index of the\r\n** INTEGER PRIMARY KEY column.  Table.iPKey is set to -1 if there is\r\n** no INTEGER PRIMARY KEY.\r\n**\r\n** If the key is not an INTEGER PRIMARY KEY, then create a unique\r\n** index for the key.  No index is created for INTEGER PRIMARY KEYs.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AddPrimaryKey(\r\n  Parse *pParse,    /* Parsing context */\r\n  ExprList *pList,  /* List of field names to be indexed */\r\n  int onError,      /* What to do with a uniqueness conflict */\r\n  int autoInc,      /* True if the AUTOINCREMENT keyword is present */\r\n  int sortOrder     /* SQLITE_SO_ASC or SQLITE_SO_DESC */\r\n){\r\n  Table *pTab = pParse->pNewTable;\r\n  char *zType = 0;\r\n  int iCol = -1, i;\r\n  if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit;\r\n  if( pTab->tabFlags & TF_HasPrimaryKey ){\r\n    sqlite3ErrorMsg(pParse, \r\n      \"table \\\"%s\\\" has more than one primary key\", pTab->zName);\r\n    goto primary_key_exit;\r\n  }\r\n  pTab->tabFlags |= TF_HasPrimaryKey;\r\n  if( pList==0 ){\r\n    iCol = pTab->nCol - 1;\r\n    pTab->aCol[iCol].isPrimKey = 1;\r\n  }else{\r\n    for(i=0; i<pList->nExpr; i++){\r\n      for(iCol=0; iCol<pTab->nCol; iCol++){\r\n        if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){\r\n          break;\r\n        }\r\n      }\r\n      if( iCol<pTab->nCol ){\r\n        pTab->aCol[iCol].isPrimKey = 1;\r\n      }\r\n    }\r\n    if( pList->nExpr>1 ) iCol = -1;\r\n  }\r\n  if( iCol>=0 && iCol<pTab->nCol ){\r\n    zType = pTab->aCol[iCol].zType;\r\n  }\r\n  if( zType && sqlite3StrICmp(zType, \"INTEGER\")==0\r\n        && sortOrder==SQLITE_SO_ASC ){\r\n    pTab->iPKey = iCol;\r\n    pTab->keyConf = (u8)onError;\r\n    assert( autoInc==0 || autoInc==1 );\r\n    pTab->tabFlags |= autoInc*TF_Autoincrement;\r\n  }else if( autoInc ){\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n    sqlite3ErrorMsg(pParse, \"AUTOINCREMENT is only allowed on an \"\r\n       \"INTEGER PRIMARY KEY\");\r\n#endif\r\n  }else{\r\n    Index *p;\r\n    p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, 0, sortOrder, 0);\r\n    if( p ){\r\n      p->autoIndex = 2;\r\n    }\r\n    pList = 0;\r\n  }\r\n\r\nprimary_key_exit:\r\n  sqlite3ExprListDelete(pParse->db, pList);\r\n  return;\r\n}\r\n\r\n/*\r\n** Add a new CHECK constraint to the table currently under construction.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AddCheckConstraint(\r\n  Parse *pParse,    /* Parsing context */\r\n  Expr *pCheckExpr  /* The check expression */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n#ifndef SQLITE_OMIT_CHECK\r\n  Table *pTab = pParse->pNewTable;\r\n  if( pTab && !IN_DECLARE_VTAB ){\r\n    pTab->pCheck = sqlite3ExprAnd(db, pTab->pCheck, pCheckExpr);\r\n  }else\r\n#endif\r\n  {\r\n    sqlite3ExprDelete(db, pCheckExpr);\r\n  }\r\n}\r\n\r\n/*\r\n** Set the collation function of the most recently parsed table column\r\n** to the CollSeq given.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){\r\n  Table *p;\r\n  int i;\r\n  char *zColl;              /* Dequoted name of collation sequence */\r\n  sqlite3 *db;\r\n\r\n  if( (p = pParse->pNewTable)==0 ) return;\r\n  i = p->nCol-1;\r\n  db = pParse->db;\r\n  zColl = sqlite3NameFromToken(db, pToken);\r\n  if( !zColl ) return;\r\n\r\n  if( sqlite3LocateCollSeq(pParse, zColl) ){\r\n    Index *pIdx;\r\n    p->aCol[i].zColl = zColl;\r\n  \r\n    /* If the column is declared as \"<name> PRIMARY KEY COLLATE <type>\",\r\n    ** then an index may have been created on this column before the\r\n    ** collation type was added. Correct this if it is the case.\r\n    */\r\n    for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){\r\n      assert( pIdx->nColumn==1 );\r\n      if( pIdx->aiColumn[0]==i ){\r\n        pIdx->azColl[0] = p->aCol[i].zColl;\r\n      }\r\n    }\r\n  }else{\r\n    sqlite3DbFree(db, zColl);\r\n  }\r\n}\r\n\r\n/*\r\n** This function returns the collation sequence for database native text\r\n** encoding identified by the string zName, length nName.\r\n**\r\n** If the requested collation sequence is not available, or not available\r\n** in the database native encoding, the collation factory is invoked to\r\n** request it. If the collation factory does not supply such a sequence,\r\n** and the sequence is available in another text encoding, then that is\r\n** returned instead.\r\n**\r\n** If no versions of the requested collations sequence are available, or\r\n** another error occurs, NULL is returned and an error message written into\r\n** pParse.\r\n**\r\n** This routine is a wrapper around sqlite3FindCollSeq().  This routine\r\n** invokes the collation factory if the named collation cannot be found\r\n** and generates an error message.\r\n**\r\n** See also: sqlite3FindCollSeq(), sqlite3GetCollSeq()\r\n*/\r\nSQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName){\r\n  sqlite3 *db = pParse->db;\r\n  u8 enc = ENC(db);\r\n  u8 initbusy = db->init.busy;\r\n  CollSeq *pColl;\r\n\r\n  pColl = sqlite3FindCollSeq(db, enc, zName, initbusy);\r\n  if( !initbusy && (!pColl || !pColl->xCmp) ){\r\n    pColl = sqlite3GetCollSeq(db, enc, pColl, zName);\r\n    if( !pColl ){\r\n      sqlite3ErrorMsg(pParse, \"no such collation sequence: %s\", zName);\r\n    }\r\n  }\r\n\r\n  return pColl;\r\n}\r\n\r\n\r\n/*\r\n** Generate code that will increment the schema cookie.\r\n**\r\n** The schema cookie is used to determine when the schema for the\r\n** database changes.  After each schema change, the cookie value\r\n** changes.  When a process first reads the schema it records the\r\n** cookie.  Thereafter, whenever it goes to access the database,\r\n** it checks the cookie to make sure the schema has not changed\r\n** since it was last read.\r\n**\r\n** This plan is not completely bullet-proof.  It is possible for\r\n** the schema to change multiple times and for the cookie to be\r\n** set back to prior value.  But schema changes are infrequent\r\n** and the probability of hitting the same cookie value is only\r\n** 1 chance in 2^32.  So we're safe enough.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ChangeCookie(Parse *pParse, int iDb){\r\n  int r1 = sqlite3GetTempReg(pParse);\r\n  sqlite3 *db = pParse->db;\r\n  Vdbe *v = pParse->pVdbe;\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  sqlite3VdbeAddOp2(v, OP_Integer, db->aDb[iDb].pSchema->schema_cookie+1, r1);\r\n  sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, r1);\r\n  sqlite3ReleaseTempReg(pParse, r1);\r\n}\r\n\r\n/*\r\n** Measure the number of characters needed to output the given\r\n** identifier.  The number returned includes any quotes used\r\n** but does not include the null terminator.\r\n**\r\n** The estimate is conservative.  It might be larger that what is\r\n** really needed.\r\n*/\r\nstatic int identLength(const char *z){\r\n  int n;\r\n  for(n=0; *z; n++, z++){\r\n    if( *z=='\"' ){ n++; }\r\n  }\r\n  return n + 2;\r\n}\r\n\r\n/*\r\n** The first parameter is a pointer to an output buffer. The second \r\n** parameter is a pointer to an integer that contains the offset at\r\n** which to write into the output buffer. This function copies the\r\n** nul-terminated string pointed to by the third parameter, zSignedIdent,\r\n** to the specified offset in the buffer and updates *pIdx to refer\r\n** to the first byte after the last byte written before returning.\r\n** \r\n** If the string zSignedIdent consists entirely of alpha-numeric\r\n** characters, does not begin with a digit and is not an SQL keyword,\r\n** then it is copied to the output buffer exactly as it is. Otherwise,\r\n** it is quoted using double-quotes.\r\n*/\r\nstatic void identPut(char *z, int *pIdx, char *zSignedIdent){\r\n  unsigned char *zIdent = (unsigned char*)zSignedIdent;\r\n  int i, j, needQuote;\r\n  i = *pIdx;\r\n\r\n  for(j=0; zIdent[j]; j++){\r\n    if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break;\r\n  }\r\n  needQuote = sqlite3Isdigit(zIdent[0]) || sqlite3KeywordCode(zIdent, j)!=TK_ID;\r\n  if( !needQuote ){\r\n    needQuote = zIdent[j];\r\n  }\r\n\r\n  if( needQuote ) z[i++] = '\"';\r\n  for(j=0; zIdent[j]; j++){\r\n    z[i++] = zIdent[j];\r\n    if( zIdent[j]=='\"' ) z[i++] = '\"';\r\n  }\r\n  if( needQuote ) z[i++] = '\"';\r\n  z[i] = 0;\r\n  *pIdx = i;\r\n}\r\n\r\n/*\r\n** Generate a CREATE TABLE statement appropriate for the given\r\n** table.  Memory to hold the text of the statement is obtained\r\n** from sqliteMalloc() and must be freed by the calling function.\r\n*/\r\nstatic char *createTableStmt(sqlite3 *db, Table *p){\r\n  int i, k, n;\r\n  char *zStmt;\r\n  char *zSep, *zSep2, *zEnd;\r\n  Column *pCol;\r\n  n = 0;\r\n  for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){\r\n    n += identLength(pCol->zName) + 5;\r\n  }\r\n  n += identLength(p->zName);\r\n  if( n<50 ){ \r\n    zSep = \"\";\r\n    zSep2 = \",\";\r\n    zEnd = \")\";\r\n  }else{\r\n    zSep = \"\\n  \";\r\n    zSep2 = \",\\n  \";\r\n    zEnd = \"\\n)\";\r\n  }\r\n  n += 35 + 6*p->nCol;\r\n  zStmt = sqlite3DbMallocRaw(0, n);\r\n  if( zStmt==0 ){\r\n    db->mallocFailed = 1;\r\n    return 0;\r\n  }\r\n  sqlite3_snprintf(n, zStmt, \"CREATE TABLE \");\r\n  k = sqlite3Strlen30(zStmt);\r\n  identPut(zStmt, &k, p->zName);\r\n  zStmt[k++] = '(';\r\n  for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){\r\n    static const char * const azType[] = {\r\n        /* SQLITE_AFF_TEXT    */ \" TEXT\",\r\n        /* SQLITE_AFF_NONE    */ \"\",\r\n        /* SQLITE_AFF_NUMERIC */ \" NUM\",\r\n        /* SQLITE_AFF_INTEGER */ \" INT\",\r\n        /* SQLITE_AFF_REAL    */ \" REAL\"\r\n    };\r\n    int len;\r\n    const char *zType;\r\n\r\n    sqlite3_snprintf(n-k, &zStmt[k], zSep);\r\n    k += sqlite3Strlen30(&zStmt[k]);\r\n    zSep = zSep2;\r\n    identPut(zStmt, &k, pCol->zName);\r\n    assert( pCol->affinity-SQLITE_AFF_TEXT >= 0 );\r\n    assert( pCol->affinity-SQLITE_AFF_TEXT < ArraySize(azType) );\r\n    testcase( pCol->affinity==SQLITE_AFF_TEXT );\r\n    testcase( pCol->affinity==SQLITE_AFF_NONE );\r\n    testcase( pCol->affinity==SQLITE_AFF_NUMERIC );\r\n    testcase( pCol->affinity==SQLITE_AFF_INTEGER );\r\n    testcase( pCol->affinity==SQLITE_AFF_REAL );\r\n    \r\n    zType = azType[pCol->affinity - SQLITE_AFF_TEXT];\r\n    len = sqlite3Strlen30(zType);\r\n    assert( pCol->affinity==SQLITE_AFF_NONE \r\n            || pCol->affinity==sqlite3AffinityType(zType) );\r\n    memcpy(&zStmt[k], zType, len);\r\n    k += len;\r\n    assert( k<=n );\r\n  }\r\n  sqlite3_snprintf(n-k, &zStmt[k], \"%s\", zEnd);\r\n  return zStmt;\r\n}\r\n\r\n/*\r\n** This routine is called to report the final \")\" that terminates\r\n** a CREATE TABLE statement.\r\n**\r\n** The table structure that other action routines have been building\r\n** is added to the internal hash tables, assuming no errors have\r\n** occurred.\r\n**\r\n** An entry for the table is made in the master table on disk, unless\r\n** this is a temporary table or db->init.busy==1.  When db->init.busy==1\r\n** it means we are reading the sqlite_master table because we just\r\n** connected to the database or because the sqlite_master table has\r\n** recently changed, so the entry for this table already exists in\r\n** the sqlite_master table.  We do not want to create it again.\r\n**\r\n** If the pSelect argument is not NULL, it means that this routine\r\n** was called to create a table generated from a \r\n** \"CREATE TABLE ... AS SELECT ...\" statement.  The column names of\r\n** the new table will match the result set of the SELECT.\r\n*/\r\nSQLITE_PRIVATE void sqlite3EndTable(\r\n  Parse *pParse,          /* Parse context */\r\n  Token *pCons,           /* The ',' token after the last column defn. */\r\n  Token *pEnd,            /* The final ')' token in the CREATE TABLE */\r\n  Select *pSelect         /* Select from a \"CREATE ... AS SELECT\" */\r\n){\r\n  Table *p;\r\n  sqlite3 *db = pParse->db;\r\n  int iDb;\r\n\r\n  if( (pEnd==0 && pSelect==0) || db->mallocFailed ){\r\n    return;\r\n  }\r\n  p = pParse->pNewTable;\r\n  if( p==0 ) return;\r\n\r\n  assert( !db->init.busy || !pSelect );\r\n\r\n  iDb = sqlite3SchemaToIndex(db, p->pSchema);\r\n\r\n#ifndef SQLITE_OMIT_CHECK\r\n  /* Resolve names in all CHECK constraint expressions.\r\n  */\r\n  if( p->pCheck ){\r\n    SrcList sSrc;                   /* Fake SrcList for pParse->pNewTable */\r\n    NameContext sNC;                /* Name context for pParse->pNewTable */\r\n\r\n    memset(&sNC, 0, sizeof(sNC));\r\n    memset(&sSrc, 0, sizeof(sSrc));\r\n    sSrc.nSrc = 1;\r\n    sSrc.a[0].zName = p->zName;\r\n    sSrc.a[0].pTab = p;\r\n    sSrc.a[0].iCursor = -1;\r\n    sNC.pParse = pParse;\r\n    sNC.pSrcList = &sSrc;\r\n    sNC.isCheck = 1;\r\n    if( sqlite3ResolveExprNames(&sNC, p->pCheck) ){\r\n      return;\r\n    }\r\n  }\r\n#endif /* !defined(SQLITE_OMIT_CHECK) */\r\n\r\n  /* If the db->init.busy is 1 it means we are reading the SQL off the\r\n  ** \"sqlite_master\" or \"sqlite_temp_master\" table on the disk.\r\n  ** So do not write to the disk again.  Extract the root page number\r\n  ** for the table from the db->init.newTnum field.  (The page number\r\n  ** should have been put there by the sqliteOpenCb routine.)\r\n  */\r\n  if( db->init.busy ){\r\n    p->tnum = db->init.newTnum;\r\n  }\r\n\r\n  /* If not initializing, then create a record for the new table\r\n  ** in the SQLITE_MASTER table of the database.\r\n  **\r\n  ** If this is a TEMPORARY table, write the entry into the auxiliary\r\n  ** file instead of into the main database file.\r\n  */\r\n  if( !db->init.busy ){\r\n    int n;\r\n    Vdbe *v;\r\n    char *zType;    /* \"view\" or \"table\" */\r\n    char *zType2;   /* \"VIEW\" or \"TABLE\" */\r\n    char *zStmt;    /* Text of the CREATE TABLE or CREATE VIEW statement */\r\n\r\n    v = sqlite3GetVdbe(pParse);\r\n    if( NEVER(v==0) ) return;\r\n\r\n    sqlite3VdbeAddOp1(v, OP_Close, 0);\r\n\r\n    /* \r\n    ** Initialize zType for the new view or table.\r\n    */\r\n    if( p->pSelect==0 ){\r\n      /* A regular table */\r\n      zType = \"table\";\r\n      zType2 = \"TABLE\";\r\n#ifndef SQLITE_OMIT_VIEW\r\n    }else{\r\n      /* A view */\r\n      zType = \"view\";\r\n      zType2 = \"VIEW\";\r\n#endif\r\n    }\r\n\r\n    /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT\r\n    ** statement to populate the new table. The root-page number for the\r\n    ** new table is in register pParse->regRoot.\r\n    **\r\n    ** Once the SELECT has been coded by sqlite3Select(), it is in a\r\n    ** suitable state to query for the column names and types to be used\r\n    ** by the new table.\r\n    **\r\n    ** A shared-cache write-lock is not required to write to the new table,\r\n    ** as a schema-lock must have already been obtained to create it. Since\r\n    ** a schema-lock excludes all other database users, the write-lock would\r\n    ** be redundant.\r\n    */\r\n    if( pSelect ){\r\n      SelectDest dest;\r\n      Table *pSelTab;\r\n\r\n      assert(pParse->nTab==1);\r\n      sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);\r\n      sqlite3VdbeChangeP5(v, 1);\r\n      pParse->nTab = 2;\r\n      sqlite3SelectDestInit(&dest, SRT_Table, 1);\r\n      sqlite3Select(pParse, pSelect, &dest);\r\n      sqlite3VdbeAddOp1(v, OP_Close, 1);\r\n      if( pParse->nErr==0 ){\r\n        pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect);\r\n        if( pSelTab==0 ) return;\r\n        assert( p->aCol==0 );\r\n        p->nCol = pSelTab->nCol;\r\n        p->aCol = pSelTab->aCol;\r\n        pSelTab->nCol = 0;\r\n        pSelTab->aCol = 0;\r\n        sqlite3DeleteTable(db, pSelTab);\r\n      }\r\n    }\r\n\r\n    /* Compute the complete text of the CREATE statement */\r\n    if( pSelect ){\r\n      zStmt = createTableStmt(db, p);\r\n    }else{\r\n      n = (int)(pEnd->z - pParse->sNameToken.z) + 1;\r\n      zStmt = sqlite3MPrintf(db, \r\n          \"CREATE %s %.*s\", zType2, n, pParse->sNameToken.z\r\n      );\r\n    }\r\n\r\n    /* A slot for the record has already been allocated in the \r\n    ** SQLITE_MASTER table.  We just need to update that slot with all\r\n    ** the information we've collected.\r\n    */\r\n    sqlite3NestedParse(pParse,\r\n      \"UPDATE %Q.%s \"\r\n         \"SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q \"\r\n       \"WHERE rowid=#%d\",\r\n      db->aDb[iDb].zName, SCHEMA_TABLE(iDb),\r\n      zType,\r\n      p->zName,\r\n      p->zName,\r\n      pParse->regRoot,\r\n      zStmt,\r\n      pParse->regRowid\r\n    );\r\n    sqlite3DbFree(db, zStmt);\r\n    sqlite3ChangeCookie(pParse, iDb);\r\n\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n    /* Check to see if we need to create an sqlite_sequence table for\r\n    ** keeping track of autoincrement keys.\r\n    */\r\n    if( p->tabFlags & TF_Autoincrement ){\r\n      Db *pDb = &db->aDb[iDb];\r\n      assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n      if( pDb->pSchema->pSeqTab==0 ){\r\n        sqlite3NestedParse(pParse,\r\n          \"CREATE TABLE %Q.sqlite_sequence(name,seq)\",\r\n          pDb->zName\r\n        );\r\n      }\r\n    }\r\n#endif\r\n\r\n    /* Reparse everything to update our internal data structures */\r\n    sqlite3VdbeAddParseSchemaOp(v, iDb,\r\n               sqlite3MPrintf(db, \"tbl_name='%q'\", p->zName));\r\n  }\r\n\r\n\r\n  /* Add the table to the in-memory representation of the database.\r\n  */\r\n  if( db->init.busy ){\r\n    Table *pOld;\r\n    Schema *pSchema = p->pSchema;\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName,\r\n                             sqlite3Strlen30(p->zName),p);\r\n    if( pOld ){\r\n      assert( p==pOld );  /* Malloc must have failed inside HashInsert() */\r\n      db->mallocFailed = 1;\r\n      return;\r\n    }\r\n    pParse->pNewTable = 0;\r\n    db->flags |= SQLITE_InternChanges;\r\n\r\n#ifndef SQLITE_OMIT_ALTERTABLE\r\n    if( !p->pSelect ){\r\n      const char *zName = (const char *)pParse->sNameToken.z;\r\n      int nName;\r\n      assert( !pSelect && pCons && pEnd );\r\n      if( pCons->z==0 ){\r\n        pCons = pEnd;\r\n      }\r\n      nName = (int)((const char *)pCons->z - zName);\r\n      p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);\r\n    }\r\n#endif\r\n  }\r\n}\r\n\r\n#ifndef SQLITE_OMIT_VIEW\r\n/*\r\n** The parser calls this routine in order to create a new VIEW\r\n*/\r\nSQLITE_PRIVATE void sqlite3CreateView(\r\n  Parse *pParse,     /* The parsing context */\r\n  Token *pBegin,     /* The CREATE token that begins the statement */\r\n  Token *pName1,     /* The token that holds the name of the view */\r\n  Token *pName2,     /* The token that holds the name of the view */\r\n  Select *pSelect,   /* A SELECT statement that will become the new view */\r\n  int isTemp,        /* TRUE for a TEMPORARY view */\r\n  int noErr          /* Suppress error messages if VIEW already exists */\r\n){\r\n  Table *p;\r\n  int n;\r\n  const char *z;\r\n  Token sEnd;\r\n  DbFixer sFix;\r\n  Token *pName = 0;\r\n  int iDb;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  if( pParse->nVar>0 ){\r\n    sqlite3ErrorMsg(pParse, \"parameters are not allowed in views\");\r\n    sqlite3SelectDelete(db, pSelect);\r\n    return;\r\n  }\r\n  sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr);\r\n  p = pParse->pNewTable;\r\n  if( p==0 || pParse->nErr ){\r\n    sqlite3SelectDelete(db, pSelect);\r\n    return;\r\n  }\r\n  sqlite3TwoPartName(pParse, pName1, pName2, &pName);\r\n  iDb = sqlite3SchemaToIndex(db, p->pSchema);\r\n  if( sqlite3FixInit(&sFix, pParse, iDb, \"view\", pName)\r\n    && sqlite3FixSelect(&sFix, pSelect)\r\n  ){\r\n    sqlite3SelectDelete(db, pSelect);\r\n    return;\r\n  }\r\n\r\n  /* Make a copy of the entire SELECT statement that defines the view.\r\n  ** This will force all the Expr.token.z values to be dynamically\r\n  ** allocated rather than point to the input string - which means that\r\n  ** they will persist after the current sqlite3_exec() call returns.\r\n  */\r\n  p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);\r\n  sqlite3SelectDelete(db, pSelect);\r\n  if( db->mallocFailed ){\r\n    return;\r\n  }\r\n  if( !db->init.busy ){\r\n    sqlite3ViewGetColumnNames(pParse, p);\r\n  }\r\n\r\n  /* Locate the end of the CREATE VIEW statement.  Make sEnd point to\r\n  ** the end.\r\n  */\r\n  sEnd = pParse->sLastToken;\r\n  if( ALWAYS(sEnd.z[0]!=0) && sEnd.z[0]!=';' ){\r\n    sEnd.z += sEnd.n;\r\n  }\r\n  sEnd.n = 0;\r\n  n = (int)(sEnd.z - pBegin->z);\r\n  z = pBegin->z;\r\n  while( ALWAYS(n>0) && sqlite3Isspace(z[n-1]) ){ n--; }\r\n  sEnd.z = &z[n-1];\r\n  sEnd.n = 1;\r\n\r\n  /* Use sqlite3EndTable() to add the view to the SQLITE_MASTER table */\r\n  sqlite3EndTable(pParse, 0, &sEnd, 0);\r\n  return;\r\n}\r\n#endif /* SQLITE_OMIT_VIEW */\r\n\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)\r\n/*\r\n** The Table structure pTable is really a VIEW.  Fill in the names of\r\n** the columns of the view in the pTable structure.  Return the number\r\n** of errors.  If an error is seen leave an error message in pParse->zErrMsg.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){\r\n  Table *pSelTab;   /* A fake table from which we get the result set */\r\n  Select *pSel;     /* Copy of the SELECT that implements the view */\r\n  int nErr = 0;     /* Number of errors encountered */\r\n  int n;            /* Temporarily holds the number of cursors assigned */\r\n  sqlite3 *db = pParse->db;  /* Database connection for malloc errors */\r\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);\r\n\r\n  assert( pTable );\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( sqlite3VtabCallConnect(pParse, pTable) ){\r\n    return SQLITE_ERROR;\r\n  }\r\n  if( IsVirtual(pTable) ) return 0;\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_VIEW\r\n  /* A positive nCol means the columns names for this view are\r\n  ** already known.\r\n  */\r\n  if( pTable->nCol>0 ) return 0;\r\n\r\n  /* A negative nCol is a special marker meaning that we are currently\r\n  ** trying to compute the column names.  If we enter this routine with\r\n  ** a negative nCol, it means two or more views form a loop, like this:\r\n  **\r\n  **     CREATE VIEW one AS SELECT * FROM two;\r\n  **     CREATE VIEW two AS SELECT * FROM one;\r\n  **\r\n  ** Actually, the error above is now caught prior to reaching this point.\r\n  ** But the following test is still important as it does come up\r\n  ** in the following:\r\n  ** \r\n  **     CREATE TABLE main.ex1(a);\r\n  **     CREATE TEMP VIEW ex1 AS SELECT a FROM ex1;\r\n  **     SELECT * FROM temp.ex1;\r\n  */\r\n  if( pTable->nCol<0 ){\r\n    sqlite3ErrorMsg(pParse, \"view %s is circularly defined\", pTable->zName);\r\n    return 1;\r\n  }\r\n  assert( pTable->nCol>=0 );\r\n\r\n  /* If we get this far, it means we need to compute the table names.\r\n  ** Note that the call to sqlite3ResultSetOfSelect() will expand any\r\n  ** \"*\" elements in the results set of the view and will assign cursors\r\n  ** to the elements of the FROM clause.  But we do not want these changes\r\n  ** to be permanent.  So the computation is done on a copy of the SELECT\r\n  ** statement that defines the view.\r\n  */\r\n  assert( pTable->pSelect );\r\n  pSel = sqlite3SelectDup(db, pTable->pSelect, 0);\r\n  if( pSel ){\r\n    u8 enableLookaside = db->lookaside.bEnabled;\r\n    n = pParse->nTab;\r\n    sqlite3SrcListAssignCursors(pParse, pSel->pSrc);\r\n    pTable->nCol = -1;\r\n    db->lookaside.bEnabled = 0;\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n    xAuth = db->xAuth;\r\n    db->xAuth = 0;\r\n    pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);\r\n    db->xAuth = xAuth;\r\n#else\r\n    pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);\r\n#endif\r\n    db->lookaside.bEnabled = enableLookaside;\r\n    pParse->nTab = n;\r\n    if( pSelTab ){\r\n      assert( pTable->aCol==0 );\r\n      pTable->nCol = pSelTab->nCol;\r\n      pTable->aCol = pSelTab->aCol;\r\n      pSelTab->nCol = 0;\r\n      pSelTab->aCol = 0;\r\n      sqlite3DeleteTable(db, pSelTab);\r\n      assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );\r\n      pTable->pSchema->flags |= DB_UnresetViews;\r\n    }else{\r\n      pTable->nCol = 0;\r\n      nErr++;\r\n    }\r\n    sqlite3SelectDelete(db, pSel);\r\n  } else {\r\n    nErr++;\r\n  }\r\n#endif /* SQLITE_OMIT_VIEW */\r\n  return nErr;  \r\n}\r\n#endif /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */\r\n\r\n#ifndef SQLITE_OMIT_VIEW\r\n/*\r\n** Clear the column names from every VIEW in database idx.\r\n*/\r\nstatic void sqliteViewResetAll(sqlite3 *db, int idx){\r\n  HashElem *i;\r\n  assert( sqlite3SchemaMutexHeld(db, idx, 0) );\r\n  if( !DbHasProperty(db, idx, DB_UnresetViews) ) return;\r\n  for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){\r\n    Table *pTab = sqliteHashData(i);\r\n    if( pTab->pSelect ){\r\n      sqliteDeleteColumnNames(db, pTab);\r\n      pTab->aCol = 0;\r\n      pTab->nCol = 0;\r\n    }\r\n  }\r\n  DbClearProperty(db, idx, DB_UnresetViews);\r\n}\r\n#else\r\n# define sqliteViewResetAll(A,B)\r\n#endif /* SQLITE_OMIT_VIEW */\r\n\r\n/*\r\n** This function is called by the VDBE to adjust the internal schema\r\n** used by SQLite when the btree layer moves a table root page. The\r\n** root-page of a table or index in database iDb has changed from iFrom\r\n** to iTo.\r\n**\r\n** Ticket #1728:  The symbol table might still contain information\r\n** on tables and/or indices that are the process of being deleted.\r\n** If you are unlucky, one of those deleted indices or tables might\r\n** have the same rootpage number as the real table or index that is\r\n** being moved.  So we cannot stop searching after the first match \r\n** because the first match might be for one of the deleted indices\r\n** or tables and not the table/index that is actually being moved.\r\n** We must continue looping until all tables and indices with\r\n** rootpage==iFrom have been converted to have a rootpage of iTo\r\n** in order to be certain that we got the right one.\r\n*/\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\nSQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){\r\n  HashElem *pElem;\r\n  Hash *pHash;\r\n  Db *pDb;\r\n\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  pDb = &db->aDb[iDb];\r\n  pHash = &pDb->pSchema->tblHash;\r\n  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){\r\n    Table *pTab = sqliteHashData(pElem);\r\n    if( pTab->tnum==iFrom ){\r\n      pTab->tnum = iTo;\r\n    }\r\n  }\r\n  pHash = &pDb->pSchema->idxHash;\r\n  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){\r\n    Index *pIdx = sqliteHashData(pElem);\r\n    if( pIdx->tnum==iFrom ){\r\n      pIdx->tnum = iTo;\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** Write code to erase the table with root-page iTable from database iDb.\r\n** Also write code to modify the sqlite_master table and internal schema\r\n** if a root-page of another table is moved by the btree-layer whilst\r\n** erasing iTable (this can happen with an auto-vacuum database).\r\n*/ \r\nstatic void destroyRootPage(Parse *pParse, int iTable, int iDb){\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  int r1 = sqlite3GetTempReg(pParse);\r\n  sqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb);\r\n  sqlite3MayAbort(pParse);\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  /* OP_Destroy stores an in integer r1. If this integer\r\n  ** is non-zero, then it is the root page number of a table moved to\r\n  ** location iTable. The following code modifies the sqlite_master table to\r\n  ** reflect this.\r\n  **\r\n  ** The \"#NNN\" in the SQL is a special constant that means whatever value\r\n  ** is in register NNN.  See grammar rules associated with the TK_REGISTER\r\n  ** token for additional information.\r\n  */\r\n  sqlite3NestedParse(pParse, \r\n     \"UPDATE %Q.%s SET rootpage=%d WHERE #%d AND rootpage=#%d\",\r\n     pParse->db->aDb[iDb].zName, SCHEMA_TABLE(iDb), iTable, r1, r1);\r\n#endif\r\n  sqlite3ReleaseTempReg(pParse, r1);\r\n}\r\n\r\n/*\r\n** Write VDBE code to erase table pTab and all associated indices on disk.\r\n** Code to update the sqlite_master tables and internal schema definitions\r\n** in case a root-page belonging to another table is moved by the btree layer\r\n** is also added (this can happen with an auto-vacuum database).\r\n*/\r\nstatic void destroyTable(Parse *pParse, Table *pTab){\r\n#ifdef SQLITE_OMIT_AUTOVACUUM\r\n  Index *pIdx;\r\n  int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n  destroyRootPage(pParse, pTab->tnum, iDb);\r\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n    destroyRootPage(pParse, pIdx->tnum, iDb);\r\n  }\r\n#else\r\n  /* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM\r\n  ** is not defined), then it is important to call OP_Destroy on the\r\n  ** table and index root-pages in order, starting with the numerically \r\n  ** largest root-page number. This guarantees that none of the root-pages\r\n  ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the\r\n  ** following were coded:\r\n  **\r\n  ** OP_Destroy 4 0\r\n  ** ...\r\n  ** OP_Destroy 5 0\r\n  **\r\n  ** and root page 5 happened to be the largest root-page number in the\r\n  ** database, then root page 5 would be moved to page 4 by the \r\n  ** \"OP_Destroy 4 0\" opcode. The subsequent \"OP_Destroy 5 0\" would hit\r\n  ** a free-list page.\r\n  */\r\n  int iTab = pTab->tnum;\r\n  int iDestroyed = 0;\r\n\r\n  while( 1 ){\r\n    Index *pIdx;\r\n    int iLargest = 0;\r\n\r\n    if( iDestroyed==0 || iTab<iDestroyed ){\r\n      iLargest = iTab;\r\n    }\r\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n      int iIdx = pIdx->tnum;\r\n      assert( pIdx->pSchema==pTab->pSchema );\r\n      if( (iDestroyed==0 || (iIdx<iDestroyed)) && iIdx>iLargest ){\r\n        iLargest = iIdx;\r\n      }\r\n    }\r\n    if( iLargest==0 ){\r\n      return;\r\n    }else{\r\n      int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n      destroyRootPage(pParse, iLargest, iDb);\r\n      iDestroyed = iLargest;\r\n    }\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** Remove entries from the sqlite_statN tables (for N in (1,2,3))\r\n** after a DROP INDEX or DROP TABLE command.\r\n*/\r\nstatic void sqlite3ClearStatTables(\r\n  Parse *pParse,         /* The parsing context */\r\n  int iDb,               /* The database number */\r\n  const char *zType,     /* \"idx\" or \"tbl\" */\r\n  const char *zName      /* Name of index or table */\r\n){\r\n  int i;\r\n  const char *zDbName = pParse->db->aDb[iDb].zName;\r\n  for(i=1; i<=3; i++){\r\n    char zTab[24];\r\n    sqlite3_snprintf(sizeof(zTab),zTab,\"sqlite_stat%d\",i);\r\n    if( sqlite3FindTable(pParse->db, zTab, zDbName) ){\r\n      sqlite3NestedParse(pParse,\r\n        \"DELETE FROM %Q.%s WHERE %s=%Q\",\r\n        zDbName, zTab, zType, zName\r\n      );\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Generate code to drop a table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){\r\n  Vdbe *v;\r\n  sqlite3 *db = pParse->db;\r\n  Trigger *pTrigger;\r\n  Db *pDb = &db->aDb[iDb];\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  assert( v!=0 );\r\n  sqlite3BeginWriteOperation(pParse, 1, iDb);\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( IsVirtual(pTab) ){\r\n    sqlite3VdbeAddOp0(v, OP_VBegin);\r\n  }\r\n#endif\r\n\r\n  /* Drop all triggers associated with the table being dropped. Code\r\n  ** is generated to remove entries from sqlite_master and/or\r\n  ** sqlite_temp_master if required.\r\n  */\r\n  pTrigger = sqlite3TriggerList(pParse, pTab);\r\n  while( pTrigger ){\r\n    assert( pTrigger->pSchema==pTab->pSchema || \r\n        pTrigger->pSchema==db->aDb[1].pSchema );\r\n    sqlite3DropTriggerPtr(pParse, pTrigger);\r\n    pTrigger = pTrigger->pNext;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n  /* Remove any entries of the sqlite_sequence table associated with\r\n  ** the table being dropped. This is done before the table is dropped\r\n  ** at the btree level, in case the sqlite_sequence table needs to\r\n  ** move as a result of the drop (can happen in auto-vacuum mode).\r\n  */\r\n  if( pTab->tabFlags & TF_Autoincrement ){\r\n    sqlite3NestedParse(pParse,\r\n      \"DELETE FROM %Q.sqlite_sequence WHERE name=%Q\",\r\n      pDb->zName, pTab->zName\r\n    );\r\n  }\r\n#endif\r\n\r\n  /* Drop all SQLITE_MASTER table and index entries that refer to the\r\n  ** table. The program name loops through the master table and deletes\r\n  ** every row that refers to a table of the same name as the one being\r\n  ** dropped. Triggers are handled seperately because a trigger can be\r\n  ** created in the temp database that refers to a table in another\r\n  ** database.\r\n  */\r\n  sqlite3NestedParse(pParse, \r\n      \"DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'\",\r\n      pDb->zName, SCHEMA_TABLE(iDb), pTab->zName);\r\n  if( !isView && !IsVirtual(pTab) ){\r\n    destroyTable(pParse, pTab);\r\n  }\r\n\r\n  /* Remove the table entry from SQLite's internal schema and modify\r\n  ** the schema cookie.\r\n  */\r\n  if( IsVirtual(pTab) ){\r\n    sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);\r\n  }\r\n  sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);\r\n  sqlite3ChangeCookie(pParse, iDb);\r\n  sqliteViewResetAll(db, iDb);\r\n}\r\n\r\n/*\r\n** This routine is called to do the work of a DROP TABLE statement.\r\n** pName is the name of the table to be dropped.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){\r\n  Table *pTab;\r\n  Vdbe *v;\r\n  sqlite3 *db = pParse->db;\r\n  int iDb;\r\n\r\n  if( db->mallocFailed ){\r\n    goto exit_drop_table;\r\n  }\r\n  assert( pParse->nErr==0 );\r\n  assert( pName->nSrc==1 );\r\n  if( noErr ) db->suppressErr++;\r\n  pTab = sqlite3LocateTable(pParse, isView, \r\n                            pName->a[0].zName, pName->a[0].zDatabase);\r\n  if( noErr ) db->suppressErr--;\r\n\r\n  if( pTab==0 ){\r\n    if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase);\r\n    goto exit_drop_table;\r\n  }\r\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n\r\n  /* If pTab is a virtual table, call ViewGetColumnNames() to ensure\r\n  ** it is initialized.\r\n  */\r\n  if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){\r\n    goto exit_drop_table;\r\n  }\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  {\r\n    int code;\r\n    const char *zTab = SCHEMA_TABLE(iDb);\r\n    const char *zDb = db->aDb[iDb].zName;\r\n    const char *zArg2 = 0;\r\n    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){\r\n      goto exit_drop_table;\r\n    }\r\n    if( isView ){\r\n      if( !OMIT_TEMPDB && iDb==1 ){\r\n        code = SQLITE_DROP_TEMP_VIEW;\r\n      }else{\r\n        code = SQLITE_DROP_VIEW;\r\n      }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    }else if( IsVirtual(pTab) ){\r\n      code = SQLITE_DROP_VTABLE;\r\n      zArg2 = sqlite3GetVTable(db, pTab)->pMod->zName;\r\n#endif\r\n    }else{\r\n      if( !OMIT_TEMPDB && iDb==1 ){\r\n        code = SQLITE_DROP_TEMP_TABLE;\r\n      }else{\r\n        code = SQLITE_DROP_TABLE;\r\n      }\r\n    }\r\n    if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){\r\n      goto exit_drop_table;\r\n    }\r\n    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){\r\n      goto exit_drop_table;\r\n    }\r\n  }\r\n#endif\r\n  if( sqlite3StrNICmp(pTab->zName, \"sqlite_\", 7)==0 \r\n    && sqlite3StrNICmp(pTab->zName, \"sqlite_stat\", 11)!=0 ){\r\n    sqlite3ErrorMsg(pParse, \"table %s may not be dropped\", pTab->zName);\r\n    goto exit_drop_table;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_VIEW\r\n  /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used\r\n  ** on a table.\r\n  */\r\n  if( isView && pTab->pSelect==0 ){\r\n    sqlite3ErrorMsg(pParse, \"use DROP TABLE to delete table %s\", pTab->zName);\r\n    goto exit_drop_table;\r\n  }\r\n  if( !isView && pTab->pSelect ){\r\n    sqlite3ErrorMsg(pParse, \"use DROP VIEW to delete view %s\", pTab->zName);\r\n    goto exit_drop_table;\r\n  }\r\n#endif\r\n\r\n  /* Generate code to remove the table from the master table\r\n  ** on disk.\r\n  */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v ){\r\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\r\n    sqlite3ClearStatTables(pParse, iDb, \"tbl\", pTab->zName);\r\n    sqlite3FkDropTable(pParse, pName, pTab);\r\n    sqlite3CodeDropTable(pParse, pTab, iDb, isView);\r\n  }\r\n\r\nexit_drop_table:\r\n  sqlite3SrcListDelete(db, pName);\r\n}\r\n\r\n/*\r\n** This routine is called to create a new foreign key on the table\r\n** currently under construction.  pFromCol determines which columns\r\n** in the current table point to the foreign key.  If pFromCol==0 then\r\n** connect the key to the last column inserted.  pTo is the name of\r\n** the table referred to.  pToCol is a list of tables in the other\r\n** pTo table that the foreign key points to.  flags contains all\r\n** information about the conflict resolution algorithms specified\r\n** in the ON DELETE, ON UPDATE and ON INSERT clauses.\r\n**\r\n** An FKey structure is created and added to the table currently\r\n** under construction in the pParse->pNewTable field.\r\n**\r\n** The foreign key is set for IMMEDIATE processing.  A subsequent call\r\n** to sqlite3DeferForeignKey() might change this to DEFERRED.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CreateForeignKey(\r\n  Parse *pParse,       /* Parsing context */\r\n  ExprList *pFromCol,  /* Columns in this table that point to other table */\r\n  Token *pTo,          /* Name of the other table */\r\n  ExprList *pToCol,    /* Columns in the other table */\r\n  int flags            /* Conflict resolution algorithms. */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n  FKey *pFKey = 0;\r\n  FKey *pNextTo;\r\n  Table *p = pParse->pNewTable;\r\n  int nByte;\r\n  int i;\r\n  int nCol;\r\n  char *z;\r\n\r\n  assert( pTo!=0 );\r\n  if( p==0 || IN_DECLARE_VTAB ) goto fk_end;\r\n  if( pFromCol==0 ){\r\n    int iCol = p->nCol-1;\r\n    if( NEVER(iCol<0) ) goto fk_end;\r\n    if( pToCol && pToCol->nExpr!=1 ){\r\n      sqlite3ErrorMsg(pParse, \"foreign key on %s\"\r\n         \" should reference only one column of table %T\",\r\n         p->aCol[iCol].zName, pTo);\r\n      goto fk_end;\r\n    }\r\n    nCol = 1;\r\n  }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){\r\n    sqlite3ErrorMsg(pParse,\r\n        \"number of columns in foreign key does not match the number of \"\r\n        \"columns in the referenced table\");\r\n    goto fk_end;\r\n  }else{\r\n    nCol = pFromCol->nExpr;\r\n  }\r\n  nByte = sizeof(*pFKey) + (nCol-1)*sizeof(pFKey->aCol[0]) + pTo->n + 1;\r\n  if( pToCol ){\r\n    for(i=0; i<pToCol->nExpr; i++){\r\n      nByte += sqlite3Strlen30(pToCol->a[i].zName) + 1;\r\n    }\r\n  }\r\n  pFKey = sqlite3DbMallocZero(db, nByte );\r\n  if( pFKey==0 ){\r\n    goto fk_end;\r\n  }\r\n  pFKey->pFrom = p;\r\n  pFKey->pNextFrom = p->pFKey;\r\n  z = (char*)&pFKey->aCol[nCol];\r\n  pFKey->zTo = z;\r\n  memcpy(z, pTo->z, pTo->n);\r\n  z[pTo->n] = 0;\r\n  sqlite3Dequote(z);\r\n  z += pTo->n+1;\r\n  pFKey->nCol = nCol;\r\n  if( pFromCol==0 ){\r\n    pFKey->aCol[0].iFrom = p->nCol-1;\r\n  }else{\r\n    for(i=0; i<nCol; i++){\r\n      int j;\r\n      for(j=0; j<p->nCol; j++){\r\n        if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){\r\n          pFKey->aCol[i].iFrom = j;\r\n          break;\r\n        }\r\n      }\r\n      if( j>=p->nCol ){\r\n        sqlite3ErrorMsg(pParse, \r\n          \"unknown column \\\"%s\\\" in foreign key definition\", \r\n          pFromCol->a[i].zName);\r\n        goto fk_end;\r\n      }\r\n    }\r\n  }\r\n  if( pToCol ){\r\n    for(i=0; i<nCol; i++){\r\n      int n = sqlite3Strlen30(pToCol->a[i].zName);\r\n      pFKey->aCol[i].zCol = z;\r\n      memcpy(z, pToCol->a[i].zName, n);\r\n      z[n] = 0;\r\n      z += n+1;\r\n    }\r\n  }\r\n  pFKey->isDeferred = 0;\r\n  pFKey->aAction[0] = (u8)(flags & 0xff);            /* ON DELETE action */\r\n  pFKey->aAction[1] = (u8)((flags >> 8 ) & 0xff);    /* ON UPDATE action */\r\n\r\n  assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );\r\n  pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash, \r\n      pFKey->zTo, sqlite3Strlen30(pFKey->zTo), (void *)pFKey\r\n  );\r\n  if( pNextTo==pFKey ){\r\n    db->mallocFailed = 1;\r\n    goto fk_end;\r\n  }\r\n  if( pNextTo ){\r\n    assert( pNextTo->pPrevTo==0 );\r\n    pFKey->pNextTo = pNextTo;\r\n    pNextTo->pPrevTo = pFKey;\r\n  }\r\n\r\n  /* Link the foreign key to the table as the last step.\r\n  */\r\n  p->pFKey = pFKey;\r\n  pFKey = 0;\r\n\r\nfk_end:\r\n  sqlite3DbFree(db, pFKey);\r\n#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */\r\n  sqlite3ExprListDelete(db, pFromCol);\r\n  sqlite3ExprListDelete(db, pToCol);\r\n}\r\n\r\n/*\r\n** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED\r\n** clause is seen as part of a foreign key definition.  The isDeferred\r\n** parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE.\r\n** The behavior of the most recently created foreign key is adjusted\r\n** accordingly.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n  Table *pTab;\r\n  FKey *pFKey;\r\n  if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;\r\n  assert( isDeferred==0 || isDeferred==1 ); /* EV: R-30323-21917 */\r\n  pFKey->isDeferred = (u8)isDeferred;\r\n#endif\r\n}\r\n\r\n/*\r\n** Generate code that will erase and refill index *pIdx.  This is\r\n** used to initialize a newly created index or to recompute the\r\n** content of an index in response to a REINDEX command.\r\n**\r\n** if memRootPage is not negative, it means that the index is newly\r\n** created.  The register specified by memRootPage contains the\r\n** root page number of the index.  If memRootPage is negative, then\r\n** the index already exists and must be cleared before being refilled and\r\n** the root page number of the index is taken from pIndex->tnum.\r\n*/\r\nstatic void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){\r\n  Table *pTab = pIndex->pTable;  /* The table that is indexed */\r\n  int iTab = pParse->nTab++;     /* Btree cursor used for pTab */\r\n  int iIdx = pParse->nTab++;     /* Btree cursor used for pIndex */\r\n  int iSorter;                   /* Cursor opened by OpenSorter (if in use) */\r\n  int addr1;                     /* Address of top of loop */\r\n  int addr2;                     /* Address to jump to for next iteration */\r\n  int tnum;                      /* Root page of index */\r\n  Vdbe *v;                       /* Generate code into this virtual machine */\r\n  KeyInfo *pKey;                 /* KeyInfo for index */\r\n#ifdef SQLITE_OMIT_MERGE_SORT\r\n  int regIdxKey;                 /* Registers containing the index key */\r\n#endif\r\n  int regRecord;                 /* Register holding assemblied index record */\r\n  sqlite3 *db = pParse->db;      /* The database connection */\r\n  int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);\r\n\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,\r\n      db->aDb[iDb].zName ) ){\r\n    return;\r\n  }\r\n#endif\r\n\r\n  /* Require a write-lock on the table to perform this operation */\r\n  sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ) return;\r\n  if( memRootPage>=0 ){\r\n    tnum = memRootPage;\r\n  }else{\r\n    tnum = pIndex->tnum;\r\n    sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);\r\n  }\r\n  pKey = sqlite3IndexKeyinfo(pParse, pIndex);\r\n  sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, \r\n                    (char *)pKey, P4_KEYINFO_HANDOFF);\r\n  if( memRootPage>=0 ){\r\n    sqlite3VdbeChangeP5(v, 1);\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_MERGE_SORT\r\n  /* Open the sorter cursor if we are to use one. */\r\n  iSorter = pParse->nTab++;\r\n  sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, 0, (char*)pKey, P4_KEYINFO);\r\n#else\r\n  iSorter = iTab;\r\n#endif\r\n\r\n  /* Open the table. Loop through all rows of the table, inserting index\r\n  ** records into the sorter. */\r\n  sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);\r\n  addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0);\r\n  regRecord = sqlite3GetTempReg(pParse);\r\n\r\n#ifndef SQLITE_OMIT_MERGE_SORT\r\n  sqlite3GenerateIndexKey(pParse, pIndex, iTab, regRecord, 1);\r\n  sqlite3VdbeAddOp2(v, OP_SorterInsert, iSorter, regRecord);\r\n  sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1);\r\n  sqlite3VdbeJumpHere(v, addr1);\r\n  addr1 = sqlite3VdbeAddOp2(v, OP_SorterSort, iSorter, 0);\r\n  if( pIndex->onError!=OE_None ){\r\n    int j2 = sqlite3VdbeCurrentAddr(v) + 3;\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, j2);\r\n    addr2 = sqlite3VdbeCurrentAddr(v);\r\n    sqlite3VdbeAddOp3(v, OP_SorterCompare, iSorter, j2, regRecord);\r\n    sqlite3HaltConstraint(\r\n        pParse, OE_Abort, \"indexed columns are not unique\", P4_STATIC\r\n    );\r\n  }else{\r\n    addr2 = sqlite3VdbeCurrentAddr(v);\r\n  }\r\n  sqlite3VdbeAddOp2(v, OP_SorterData, iSorter, regRecord);\r\n  sqlite3VdbeAddOp3(v, OP_IdxInsert, iIdx, regRecord, 1);\r\n  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\r\n#else\r\n  regIdxKey = sqlite3GenerateIndexKey(pParse, pIndex, iTab, regRecord, 1);\r\n  addr2 = addr1 + 1;\r\n  if( pIndex->onError!=OE_None ){\r\n    const int regRowid = regIdxKey + pIndex->nColumn;\r\n    const int j2 = sqlite3VdbeCurrentAddr(v) + 2;\r\n    void * const pRegKey = SQLITE_INT_TO_PTR(regIdxKey);\r\n\r\n    /* The registers accessed by the OP_IsUnique opcode were allocated\r\n    ** using sqlite3GetTempRange() inside of the sqlite3GenerateIndexKey()\r\n    ** call above. Just before that function was freed they were released\r\n    ** (made available to the compiler for reuse) using \r\n    ** sqlite3ReleaseTempRange(). So in some ways having the OP_IsUnique\r\n    ** opcode use the values stored within seems dangerous. However, since\r\n    ** we can be sure that no other temp registers have been allocated\r\n    ** since sqlite3ReleaseTempRange() was called, it is safe to do so.\r\n    */\r\n    sqlite3VdbeAddOp4(v, OP_IsUnique, iIdx, j2, regRowid, pRegKey, P4_INT32);\r\n    sqlite3HaltConstraint(\r\n        pParse, OE_Abort, \"indexed columns are not unique\", P4_STATIC);\r\n  }\r\n  sqlite3VdbeAddOp3(v, OP_IdxInsert, iIdx, regRecord, 0);\r\n  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\r\n#endif\r\n  sqlite3ReleaseTempReg(pParse, regRecord);\r\n  sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2);\r\n  sqlite3VdbeJumpHere(v, addr1);\r\n\r\n  sqlite3VdbeAddOp1(v, OP_Close, iTab);\r\n  sqlite3VdbeAddOp1(v, OP_Close, iIdx);\r\n  sqlite3VdbeAddOp1(v, OP_Close, iSorter);\r\n}\r\n\r\n/*\r\n** Create a new index for an SQL table.  pName1.pName2 is the name of the index \r\n** and pTblList is the name of the table that is to be indexed.  Both will \r\n** be NULL for a primary key or an index that is created to satisfy a\r\n** UNIQUE constraint.  If pTable and pIndex are NULL, use pParse->pNewTable\r\n** as the table to be indexed.  pParse->pNewTable is a table that is\r\n** currently being constructed by a CREATE TABLE statement.\r\n**\r\n** pList is a list of columns to be indexed.  pList will be NULL if this\r\n** is a primary key or unique-constraint on the most recent column added\r\n** to the table currently under construction.  \r\n**\r\n** If the index is created successfully, return a pointer to the new Index\r\n** structure. This is used by sqlite3AddPrimaryKey() to mark the index\r\n** as the tables primary key (Index.autoIndex==2).\r\n*/\r\nSQLITE_PRIVATE Index *sqlite3CreateIndex(\r\n  Parse *pParse,     /* All information about this parse */\r\n  Token *pName1,     /* First part of index name. May be NULL */\r\n  Token *pName2,     /* Second part of index name. May be NULL */\r\n  SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */\r\n  ExprList *pList,   /* A list of columns to be indexed */\r\n  int onError,       /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */\r\n  Token *pStart,     /* The CREATE token that begins this statement */\r\n  Token *pEnd,       /* The \")\" that closes the CREATE INDEX statement */\r\n  int sortOrder,     /* Sort order of primary key when pList==NULL */\r\n  int ifNotExist     /* Omit error if index already exists */\r\n){\r\n  Index *pRet = 0;     /* Pointer to return */\r\n  Table *pTab = 0;     /* Table to be indexed */\r\n  Index *pIndex = 0;   /* The index to be created */\r\n  char *zName = 0;     /* Name of the index */\r\n  int nName;           /* Number of characters in zName */\r\n  int i, j;\r\n  Token nullId;        /* Fake token for an empty ID list */\r\n  DbFixer sFix;        /* For assigning database names to pTable */\r\n  int sortOrderMask;   /* 1 to honor DESC in index.  0 to ignore. */\r\n  sqlite3 *db = pParse->db;\r\n  Db *pDb;             /* The specific table containing the indexed database */\r\n  int iDb;             /* Index of the database that is being written */\r\n  Token *pName = 0;    /* Unqualified name of the index to create */\r\n  struct ExprList_item *pListItem; /* For looping over pList */\r\n  int nCol;\r\n  int nExtra = 0;\r\n  char *zExtra;\r\n\r\n  assert( pStart==0 || pEnd!=0 ); /* pEnd must be non-NULL if pStart is */\r\n  assert( pParse->nErr==0 );      /* Never called with prior errors */\r\n  if( db->mallocFailed || IN_DECLARE_VTAB ){\r\n    goto exit_create_index;\r\n  }\r\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n    goto exit_create_index;\r\n  }\r\n\r\n  /*\r\n  ** Find the table that is to be indexed.  Return early if not found.\r\n  */\r\n  if( pTblName!=0 ){\r\n\r\n    /* Use the two-part index name to determine the database \r\n    ** to search for the table. 'Fix' the table name to this db\r\n    ** before looking up the table.\r\n    */\r\n    assert( pName1 && pName2 );\r\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);\r\n    if( iDb<0 ) goto exit_create_index;\r\n    assert( pName && pName->z );\r\n\r\n#ifndef SQLITE_OMIT_TEMPDB\r\n    /* If the index name was unqualified, check if the the table\r\n    ** is a temp table. If so, set the database to 1. Do not do this\r\n    ** if initialising a database schema.\r\n    */\r\n    if( !db->init.busy ){\r\n      pTab = sqlite3SrcListLookup(pParse, pTblName);\r\n      if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){\r\n        iDb = 1;\r\n      }\r\n    }\r\n#endif\r\n\r\n    if( sqlite3FixInit(&sFix, pParse, iDb, \"index\", pName) &&\r\n        sqlite3FixSrcList(&sFix, pTblName)\r\n    ){\r\n      /* Because the parser constructs pTblName from a single identifier,\r\n      ** sqlite3FixSrcList can never fail. */\r\n      assert(0);\r\n    }\r\n    pTab = sqlite3LocateTable(pParse, 0, pTblName->a[0].zName, \r\n        pTblName->a[0].zDatabase);\r\n    if( !pTab || db->mallocFailed ) goto exit_create_index;\r\n    assert( db->aDb[iDb].pSchema==pTab->pSchema );\r\n  }else{\r\n    assert( pName==0 );\r\n    assert( pStart==0 );\r\n    pTab = pParse->pNewTable;\r\n    if( !pTab ) goto exit_create_index;\r\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n  }\r\n  pDb = &db->aDb[iDb];\r\n\r\n  assert( pTab!=0 );\r\n  assert( pParse->nErr==0 );\r\n  if( sqlite3StrNICmp(pTab->zName, \"sqlite_\", 7)==0 \r\n       && memcmp(&pTab->zName[7],\"altertab_\",9)!=0 ){\r\n    sqlite3ErrorMsg(pParse, \"table %s may not be indexed\", pTab->zName);\r\n    goto exit_create_index;\r\n  }\r\n#ifndef SQLITE_OMIT_VIEW\r\n  if( pTab->pSelect ){\r\n    sqlite3ErrorMsg(pParse, \"views may not be indexed\");\r\n    goto exit_create_index;\r\n  }\r\n#endif\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( IsVirtual(pTab) ){\r\n    sqlite3ErrorMsg(pParse, \"virtual tables may not be indexed\");\r\n    goto exit_create_index;\r\n  }\r\n#endif\r\n\r\n  /*\r\n  ** Find the name of the index.  Make sure there is not already another\r\n  ** index or table with the same name.  \r\n  **\r\n  ** Exception:  If we are reading the names of permanent indices from the\r\n  ** sqlite_master table (because some other process changed the schema) and\r\n  ** one of the index names collides with the name of a temporary table or\r\n  ** index, then we will continue to process this index.\r\n  **\r\n  ** If pName==0 it means that we are\r\n  ** dealing with a primary key or UNIQUE constraint.  We have to invent our\r\n  ** own name.\r\n  */\r\n  if( pName ){\r\n    zName = sqlite3NameFromToken(db, pName);\r\n    if( zName==0 ) goto exit_create_index;\r\n    assert( pName->z!=0 );\r\n    if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){\r\n      goto exit_create_index;\r\n    }\r\n    if( !db->init.busy ){\r\n      if( sqlite3FindTable(db, zName, 0)!=0 ){\r\n        sqlite3ErrorMsg(pParse, \"there is already a table named %s\", zName);\r\n        goto exit_create_index;\r\n      }\r\n    }\r\n    if( sqlite3FindIndex(db, zName, pDb->zName)!=0 ){\r\n      if( !ifNotExist ){\r\n        sqlite3ErrorMsg(pParse, \"index %s already exists\", zName);\r\n      }else{\r\n        assert( !db->init.busy );\r\n        sqlite3CodeVerifySchema(pParse, iDb);\r\n      }\r\n      goto exit_create_index;\r\n    }\r\n  }else{\r\n    int n;\r\n    Index *pLoop;\r\n    for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}\r\n    zName = sqlite3MPrintf(db, \"sqlite_autoindex_%s_%d\", pTab->zName, n);\r\n    if( zName==0 ){\r\n      goto exit_create_index;\r\n    }\r\n  }\r\n\r\n  /* Check for authorization to create an index.\r\n  */\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  {\r\n    const char *zDb = pDb->zName;\r\n    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){\r\n      goto exit_create_index;\r\n    }\r\n    i = SQLITE_CREATE_INDEX;\r\n    if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX;\r\n    if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){\r\n      goto exit_create_index;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* If pList==0, it means this routine was called to make a primary\r\n  ** key out of the last column added to the table under construction.\r\n  ** So create a fake list to simulate this.\r\n  */\r\n  if( pList==0 ){\r\n    nullId.z = pTab->aCol[pTab->nCol-1].zName;\r\n    nullId.n = sqlite3Strlen30((char*)nullId.z);\r\n    pList = sqlite3ExprListAppend(pParse, 0, 0);\r\n    if( pList==0 ) goto exit_create_index;\r\n    sqlite3ExprListSetName(pParse, pList, &nullId, 0);\r\n    pList->a[0].sortOrder = (u8)sortOrder;\r\n  }\r\n\r\n  /* Figure out how many bytes of space are required to store explicitly\r\n  ** specified collation sequence names.\r\n  */\r\n  for(i=0; i<pList->nExpr; i++){\r\n    Expr *pExpr = pList->a[i].pExpr;\r\n    if( pExpr ){\r\n      CollSeq *pColl = pExpr->pColl;\r\n      /* Either pColl!=0 or there was an OOM failure.  But if an OOM\r\n      ** failure we have quit before reaching this point. */\r\n      if( ALWAYS(pColl) ){\r\n        nExtra += (1 + sqlite3Strlen30(pColl->zName));\r\n      }\r\n    }\r\n  }\r\n\r\n  /* \r\n  ** Allocate the index structure. \r\n  */\r\n  nName = sqlite3Strlen30(zName);\r\n  nCol = pList->nExpr;\r\n  pIndex = sqlite3DbMallocZero(db, \r\n      ROUND8(sizeof(Index)) +              /* Index structure  */\r\n      ROUND8(sizeof(tRowcnt)*(nCol+1)) +   /* Index.aiRowEst   */\r\n      sizeof(char *)*nCol +                /* Index.azColl     */\r\n      sizeof(int)*nCol +                   /* Index.aiColumn   */\r\n      sizeof(u8)*nCol +                    /* Index.aSortOrder */\r\n      nName + 1 +                          /* Index.zName      */\r\n      nExtra                               /* Collation sequence names */\r\n  );\r\n  if( db->mallocFailed ){\r\n    goto exit_create_index;\r\n  }\r\n  zExtra = (char*)pIndex;\r\n  pIndex->aiRowEst = (tRowcnt*)&zExtra[ROUND8(sizeof(Index))];\r\n  pIndex->azColl = (char**)\r\n     ((char*)pIndex->aiRowEst + ROUND8(sizeof(tRowcnt)*nCol+1));\r\n  assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowEst) );\r\n  assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) );\r\n  pIndex->aiColumn = (int *)(&pIndex->azColl[nCol]);\r\n  pIndex->aSortOrder = (u8 *)(&pIndex->aiColumn[nCol]);\r\n  pIndex->zName = (char *)(&pIndex->aSortOrder[nCol]);\r\n  zExtra = (char *)(&pIndex->zName[nName+1]);\r\n  memcpy(pIndex->zName, zName, nName+1);\r\n  pIndex->pTable = pTab;\r\n  pIndex->nColumn = pList->nExpr;\r\n  pIndex->onError = (u8)onError;\r\n  pIndex->autoIndex = (u8)(pName==0);\r\n  pIndex->pSchema = db->aDb[iDb].pSchema;\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n\r\n  /* Check to see if we should honor DESC requests on index columns\r\n  */\r\n  if( pDb->pSchema->file_format>=4 ){\r\n    sortOrderMask = -1;   /* Honor DESC */\r\n  }else{\r\n    sortOrderMask = 0;    /* Ignore DESC */\r\n  }\r\n\r\n  /* Scan the names of the columns of the table to be indexed and\r\n  ** load the column indices into the Index structure.  Report an error\r\n  ** if any column is not found.\r\n  **\r\n  ** TODO:  Add a test to make sure that the same column is not named\r\n  ** more than once within the same index.  Only the first instance of\r\n  ** the column will ever be used by the optimizer.  Note that using the\r\n  ** same column more than once cannot be an error because that would \r\n  ** break backwards compatibility - it needs to be a warning.\r\n  */\r\n  for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){\r\n    const char *zColName = pListItem->zName;\r\n    Column *pTabCol;\r\n    int requestedSortOrder;\r\n    char *zColl;                   /* Collation sequence name */\r\n\r\n    for(j=0, pTabCol=pTab->aCol; j<pTab->nCol; j++, pTabCol++){\r\n      if( sqlite3StrICmp(zColName, pTabCol->zName)==0 ) break;\r\n    }\r\n    if( j>=pTab->nCol ){\r\n      sqlite3ErrorMsg(pParse, \"table %s has no column named %s\",\r\n        pTab->zName, zColName);\r\n      pParse->checkSchema = 1;\r\n      goto exit_create_index;\r\n    }\r\n    pIndex->aiColumn[i] = j;\r\n    /* Justification of the ALWAYS(pListItem->pExpr->pColl):  Because of\r\n    ** the way the \"idxlist\" non-terminal is constructed by the parser,\r\n    ** if pListItem->pExpr is not null then either pListItem->pExpr->pColl\r\n    ** must exist or else there must have been an OOM error.  But if there\r\n    ** was an OOM error, we would never reach this point. */\r\n    if( pListItem->pExpr && ALWAYS(pListItem->pExpr->pColl) ){\r\n      int nColl;\r\n      zColl = pListItem->pExpr->pColl->zName;\r\n      nColl = sqlite3Strlen30(zColl) + 1;\r\n      assert( nExtra>=nColl );\r\n      memcpy(zExtra, zColl, nColl);\r\n      zColl = zExtra;\r\n      zExtra += nColl;\r\n      nExtra -= nColl;\r\n    }else{\r\n      zColl = pTab->aCol[j].zColl;\r\n      if( !zColl ){\r\n        zColl = db->pDfltColl->zName;\r\n      }\r\n    }\r\n    if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){\r\n      goto exit_create_index;\r\n    }\r\n    pIndex->azColl[i] = zColl;\r\n    requestedSortOrder = pListItem->sortOrder & sortOrderMask;\r\n    pIndex->aSortOrder[i] = (u8)requestedSortOrder;\r\n  }\r\n  sqlite3DefaultRowEst(pIndex);\r\n\r\n  if( pTab==pParse->pNewTable ){\r\n    /* This routine has been called to create an automatic index as a\r\n    ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or\r\n    ** a PRIMARY KEY or UNIQUE clause following the column definitions.\r\n    ** i.e. one of:\r\n    **\r\n    ** CREATE TABLE t(x PRIMARY KEY, y);\r\n    ** CREATE TABLE t(x, y, UNIQUE(x, y));\r\n    **\r\n    ** Either way, check to see if the table already has such an index. If\r\n    ** so, don't bother creating this one. This only applies to\r\n    ** automatically created indices. Users can do as they wish with\r\n    ** explicit indices.\r\n    **\r\n    ** Two UNIQUE or PRIMARY KEY constraints are considered equivalent\r\n    ** (and thus suppressing the second one) even if they have different\r\n    ** sort orders.\r\n    **\r\n    ** If there are different collating sequences or if the columns of\r\n    ** the constraint occur in different orders, then the constraints are\r\n    ** considered distinct and both result in separate indices.\r\n    */\r\n    Index *pIdx;\r\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n      int k;\r\n      assert( pIdx->onError!=OE_None );\r\n      assert( pIdx->autoIndex );\r\n      assert( pIndex->onError!=OE_None );\r\n\r\n      if( pIdx->nColumn!=pIndex->nColumn ) continue;\r\n      for(k=0; k<pIdx->nColumn; k++){\r\n        const char *z1;\r\n        const char *z2;\r\n        if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;\r\n        z1 = pIdx->azColl[k];\r\n        z2 = pIndex->azColl[k];\r\n        if( z1!=z2 && sqlite3StrICmp(z1, z2) ) break;\r\n      }\r\n      if( k==pIdx->nColumn ){\r\n        if( pIdx->onError!=pIndex->onError ){\r\n          /* This constraint creates the same index as a previous\r\n          ** constraint specified somewhere in the CREATE TABLE statement.\r\n          ** However the ON CONFLICT clauses are different. If both this \r\n          ** constraint and the previous equivalent constraint have explicit\r\n          ** ON CONFLICT clauses this is an error. Otherwise, use the\r\n          ** explicitly specified behaviour for the index.\r\n          */\r\n          if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){\r\n            sqlite3ErrorMsg(pParse, \r\n                \"conflicting ON CONFLICT clauses specified\", 0);\r\n          }\r\n          if( pIdx->onError==OE_Default ){\r\n            pIdx->onError = pIndex->onError;\r\n          }\r\n        }\r\n        goto exit_create_index;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Link the new Index structure to its table and to the other\r\n  ** in-memory database structures. \r\n  */\r\n  if( db->init.busy ){\r\n    Index *p;\r\n    assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );\r\n    p = sqlite3HashInsert(&pIndex->pSchema->idxHash, \r\n                          pIndex->zName, sqlite3Strlen30(pIndex->zName),\r\n                          pIndex);\r\n    if( p ){\r\n      assert( p==pIndex );  /* Malloc must have failed */\r\n      db->mallocFailed = 1;\r\n      goto exit_create_index;\r\n    }\r\n    db->flags |= SQLITE_InternChanges;\r\n    if( pTblName!=0 ){\r\n      pIndex->tnum = db->init.newTnum;\r\n    }\r\n  }\r\n\r\n  /* If the db->init.busy is 0 then create the index on disk.  This\r\n  ** involves writing the index into the master table and filling in the\r\n  ** index with the current table contents.\r\n  **\r\n  ** The db->init.busy is 0 when the user first enters a CREATE INDEX \r\n  ** command.  db->init.busy is 1 when a database is opened and \r\n  ** CREATE INDEX statements are read out of the master table.  In\r\n  ** the latter case the index already exists on disk, which is why\r\n  ** we don't want to recreate it.\r\n  **\r\n  ** If pTblName==0 it means this index is generated as a primary key\r\n  ** or UNIQUE constraint of a CREATE TABLE statement.  Since the table\r\n  ** has just been created, it contains no data and the index initialization\r\n  ** step can be skipped.\r\n  */\r\n  else{ /* if( db->init.busy==0 ) */\r\n    Vdbe *v;\r\n    char *zStmt;\r\n    int iMem = ++pParse->nMem;\r\n\r\n    v = sqlite3GetVdbe(pParse);\r\n    if( v==0 ) goto exit_create_index;\r\n\r\n\r\n    /* Create the rootpage for the index\r\n    */\r\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\r\n    sqlite3VdbeAddOp2(v, OP_CreateIndex, iDb, iMem);\r\n\r\n    /* Gather the complete text of the CREATE INDEX statement into\r\n    ** the zStmt variable\r\n    */\r\n    if( pStart ){\r\n      assert( pEnd!=0 );\r\n      /* A named index with an explicit CREATE INDEX statement */\r\n      zStmt = sqlite3MPrintf(db, \"CREATE%s INDEX %.*s\",\r\n        onError==OE_None ? \"\" : \" UNIQUE\",\r\n        (int)(pEnd->z - pName->z) + 1,\r\n        pName->z);\r\n    }else{\r\n      /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */\r\n      /* zStmt = sqlite3MPrintf(\"\"); */\r\n      zStmt = 0;\r\n    }\r\n\r\n    /* Add an entry in sqlite_master for this index\r\n    */\r\n    sqlite3NestedParse(pParse, \r\n        \"INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);\",\r\n        db->aDb[iDb].zName, SCHEMA_TABLE(iDb),\r\n        pIndex->zName,\r\n        pTab->zName,\r\n        iMem,\r\n        zStmt\r\n    );\r\n    sqlite3DbFree(db, zStmt);\r\n\r\n    /* Fill the index with data and reparse the schema. Code an OP_Expire\r\n    ** to invalidate all pre-compiled statements.\r\n    */\r\n    if( pTblName ){\r\n      sqlite3RefillIndex(pParse, pIndex, iMem);\r\n      sqlite3ChangeCookie(pParse, iDb);\r\n      sqlite3VdbeAddParseSchemaOp(v, iDb,\r\n         sqlite3MPrintf(db, \"name='%q' AND type='index'\", pIndex->zName));\r\n      sqlite3VdbeAddOp1(v, OP_Expire, 0);\r\n    }\r\n  }\r\n\r\n  /* When adding an index to the list of indices for a table, make\r\n  ** sure all indices labeled OE_Replace come after all those labeled\r\n  ** OE_Ignore.  This is necessary for the correct constraint check\r\n  ** processing (in sqlite3GenerateConstraintChecks()) as part of\r\n  ** UPDATE and INSERT statements.  \r\n  */\r\n  if( db->init.busy || pTblName==0 ){\r\n    if( onError!=OE_Replace || pTab->pIndex==0\r\n         || pTab->pIndex->onError==OE_Replace){\r\n      pIndex->pNext = pTab->pIndex;\r\n      pTab->pIndex = pIndex;\r\n    }else{\r\n      Index *pOther = pTab->pIndex;\r\n      while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){\r\n        pOther = pOther->pNext;\r\n      }\r\n      pIndex->pNext = pOther->pNext;\r\n      pOther->pNext = pIndex;\r\n    }\r\n    pRet = pIndex;\r\n    pIndex = 0;\r\n  }\r\n\r\n  /* Clean up before exiting */\r\nexit_create_index:\r\n  if( pIndex ){\r\n    sqlite3DbFree(db, pIndex->zColAff);\r\n    sqlite3DbFree(db, pIndex);\r\n  }\r\n  sqlite3ExprListDelete(db, pList);\r\n  sqlite3SrcListDelete(db, pTblName);\r\n  sqlite3DbFree(db, zName);\r\n  return pRet;\r\n}\r\n\r\n/*\r\n** Fill the Index.aiRowEst[] array with default information - information\r\n** to be used when we have not run the ANALYZE command.\r\n**\r\n** aiRowEst[0] is suppose to contain the number of elements in the index.\r\n** Since we do not know, guess 1 million.  aiRowEst[1] is an estimate of the\r\n** number of rows in the table that match any particular value of the\r\n** first column of the index.  aiRowEst[2] is an estimate of the number\r\n** of rows that match any particular combiniation of the first 2 columns\r\n** of the index.  And so forth.  It must always be the case that\r\n*\r\n**           aiRowEst[N]<=aiRowEst[N-1]\r\n**           aiRowEst[N]>=1\r\n**\r\n** Apart from that, we have little to go on besides intuition as to\r\n** how aiRowEst[] should be initialized.  The numbers generated here\r\n** are based on typical values found in actual indices.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){\r\n  tRowcnt *a = pIdx->aiRowEst;\r\n  int i;\r\n  tRowcnt n;\r\n  assert( a!=0 );\r\n  a[0] = pIdx->pTable->nRowEst;\r\n  if( a[0]<10 ) a[0] = 10;\r\n  n = 10;\r\n  for(i=1; i<=pIdx->nColumn; i++){\r\n    a[i] = n;\r\n    if( n>5 ) n--;\r\n  }\r\n  if( pIdx->onError!=OE_None ){\r\n    a[pIdx->nColumn] = 1;\r\n  }\r\n}\r\n\r\n/*\r\n** This routine will drop an existing named index.  This routine\r\n** implements the DROP INDEX statement.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){\r\n  Index *pIndex;\r\n  Vdbe *v;\r\n  sqlite3 *db = pParse->db;\r\n  int iDb;\r\n\r\n  assert( pParse->nErr==0 );   /* Never called with prior errors */\r\n  if( db->mallocFailed ){\r\n    goto exit_drop_index;\r\n  }\r\n  assert( pName->nSrc==1 );\r\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n    goto exit_drop_index;\r\n  }\r\n  pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);\r\n  if( pIndex==0 ){\r\n    if( !ifExists ){\r\n      sqlite3ErrorMsg(pParse, \"no such index: %S\", pName, 0);\r\n    }else{\r\n      sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase);\r\n    }\r\n    pParse->checkSchema = 1;\r\n    goto exit_drop_index;\r\n  }\r\n  if( pIndex->autoIndex ){\r\n    sqlite3ErrorMsg(pParse, \"index associated with UNIQUE \"\r\n      \"or PRIMARY KEY constraint cannot be dropped\", 0);\r\n    goto exit_drop_index;\r\n  }\r\n  iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  {\r\n    int code = SQLITE_DROP_INDEX;\r\n    Table *pTab = pIndex->pTable;\r\n    const char *zDb = db->aDb[iDb].zName;\r\n    const char *zTab = SCHEMA_TABLE(iDb);\r\n    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){\r\n      goto exit_drop_index;\r\n    }\r\n    if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX;\r\n    if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){\r\n      goto exit_drop_index;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Generate code to remove the index and from the master table */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v ){\r\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\r\n    sqlite3NestedParse(pParse,\r\n       \"DELETE FROM %Q.%s WHERE name=%Q AND type='index'\",\r\n       db->aDb[iDb].zName, SCHEMA_TABLE(iDb), pIndex->zName\r\n    );\r\n    sqlite3ClearStatTables(pParse, iDb, \"idx\", pIndex->zName);\r\n    sqlite3ChangeCookie(pParse, iDb);\r\n    destroyRootPage(pParse, pIndex->tnum, iDb);\r\n    sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);\r\n  }\r\n\r\nexit_drop_index:\r\n  sqlite3SrcListDelete(db, pName);\r\n}\r\n\r\n/*\r\n** pArray is a pointer to an array of objects.  Each object in the\r\n** array is szEntry bytes in size.  This routine allocates a new\r\n** object on the end of the array.\r\n**\r\n** *pnEntry is the number of entries already in use.  *pnAlloc is\r\n** the previously allocated size of the array.  initSize is the\r\n** suggested initial array size allocation.\r\n**\r\n** The index of the new entry is returned in *pIdx.\r\n**\r\n** This routine returns a pointer to the array of objects.  This\r\n** might be the same as the pArray parameter or it might be a different\r\n** pointer if the array was resized.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3ArrayAllocate(\r\n  sqlite3 *db,      /* Connection to notify of malloc failures */\r\n  void *pArray,     /* Array of objects.  Might be reallocated */\r\n  int szEntry,      /* Size of each object in the array */\r\n  int *pnEntry,     /* Number of objects currently in use */\r\n  int *pIdx         /* Write the index of a new slot here */\r\n){\r\n  char *z;\r\n  int n = *pnEntry;\r\n  if( (n & (n-1))==0 ){\r\n    int sz = (n==0) ? 1 : 2*n;\r\n    void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry);\r\n    if( pNew==0 ){\r\n      *pIdx = -1;\r\n      return pArray;\r\n    }\r\n    pArray = pNew;\r\n  }\r\n  z = (char*)pArray;\r\n  memset(&z[n * szEntry], 0, szEntry);\r\n  *pIdx = n;\r\n  ++*pnEntry;\r\n  return pArray;\r\n}\r\n\r\n/*\r\n** Append a new element to the given IdList.  Create a new IdList if\r\n** need be.\r\n**\r\n** A new IdList is returned, or NULL if malloc() fails.\r\n*/\r\nSQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){\r\n  int i;\r\n  if( pList==0 ){\r\n    pList = sqlite3DbMallocZero(db, sizeof(IdList) );\r\n    if( pList==0 ) return 0;\r\n  }\r\n  pList->a = sqlite3ArrayAllocate(\r\n      db,\r\n      pList->a,\r\n      sizeof(pList->a[0]),\r\n      &pList->nId,\r\n      &i\r\n  );\r\n  if( i<0 ){\r\n    sqlite3IdListDelete(db, pList);\r\n    return 0;\r\n  }\r\n  pList->a[i].zName = sqlite3NameFromToken(db, pToken);\r\n  return pList;\r\n}\r\n\r\n/*\r\n** Delete an IdList.\r\n*/\r\nSQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){\r\n  int i;\r\n  if( pList==0 ) return;\r\n  for(i=0; i<pList->nId; i++){\r\n    sqlite3DbFree(db, pList->a[i].zName);\r\n  }\r\n  sqlite3DbFree(db, pList->a);\r\n  sqlite3DbFree(db, pList);\r\n}\r\n\r\n/*\r\n** Return the index in pList of the identifier named zId.  Return -1\r\n** if not found.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IdListIndex(IdList *pList, const char *zName){\r\n  int i;\r\n  if( pList==0 ) return -1;\r\n  for(i=0; i<pList->nId; i++){\r\n    if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;\r\n  }\r\n  return -1;\r\n}\r\n\r\n/*\r\n** Expand the space allocated for the given SrcList object by\r\n** creating nExtra new slots beginning at iStart.  iStart is zero based.\r\n** New slots are zeroed.\r\n**\r\n** For example, suppose a SrcList initially contains two entries: A,B.\r\n** To append 3 new entries onto the end, do this:\r\n**\r\n**    sqlite3SrcListEnlarge(db, pSrclist, 3, 2);\r\n**\r\n** After the call above it would contain:  A, B, nil, nil, nil.\r\n** If the iStart argument had been 1 instead of 2, then the result\r\n** would have been:  A, nil, nil, nil, B.  To prepend the new slots,\r\n** the iStart value would be 0.  The result then would\r\n** be: nil, nil, nil, A, B.\r\n**\r\n** If a memory allocation fails the SrcList is unchanged.  The\r\n** db->mallocFailed flag will be set to true.\r\n*/\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(\r\n  sqlite3 *db,       /* Database connection to notify of OOM errors */\r\n  SrcList *pSrc,     /* The SrcList to be enlarged */\r\n  int nExtra,        /* Number of new slots to add to pSrc->a[] */\r\n  int iStart         /* Index in pSrc->a[] of first new slot */\r\n){\r\n  int i;\r\n\r\n  /* Sanity checking on calling parameters */\r\n  assert( iStart>=0 );\r\n  assert( nExtra>=1 );\r\n  assert( pSrc!=0 );\r\n  assert( iStart<=pSrc->nSrc );\r\n\r\n  /* Allocate additional space if needed */\r\n  if( pSrc->nSrc+nExtra>pSrc->nAlloc ){\r\n    SrcList *pNew;\r\n    int nAlloc = pSrc->nSrc+nExtra;\r\n    int nGot;\r\n    pNew = sqlite3DbRealloc(db, pSrc,\r\n               sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );\r\n    if( pNew==0 ){\r\n      assert( db->mallocFailed );\r\n      return pSrc;\r\n    }\r\n    pSrc = pNew;\r\n    nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1;\r\n    pSrc->nAlloc = (u16)nGot;\r\n  }\r\n\r\n  /* Move existing slots that come after the newly inserted slots\r\n  ** out of the way */\r\n  for(i=pSrc->nSrc-1; i>=iStart; i--){\r\n    pSrc->a[i+nExtra] = pSrc->a[i];\r\n  }\r\n  pSrc->nSrc += (i16)nExtra;\r\n\r\n  /* Zero the newly allocated slots */\r\n  memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra);\r\n  for(i=iStart; i<iStart+nExtra; i++){\r\n    pSrc->a[i].iCursor = -1;\r\n  }\r\n\r\n  /* Return a pointer to the enlarged SrcList */\r\n  return pSrc;\r\n}\r\n\r\n\r\n/*\r\n** Append a new table name to the given SrcList.  Create a new SrcList if\r\n** need be.  A new entry is created in the SrcList even if pTable is NULL.\r\n**\r\n** A SrcList is returned, or NULL if there is an OOM error.  The returned\r\n** SrcList might be the same as the SrcList that was input or it might be\r\n** a new one.  If an OOM error does occurs, then the prior value of pList\r\n** that is input to this routine is automatically freed.\r\n**\r\n** If pDatabase is not null, it means that the table has an optional\r\n** database name prefix.  Like this:  \"database.table\".  The pDatabase\r\n** points to the table name and the pTable points to the database name.\r\n** The SrcList.a[].zName field is filled with the table name which might\r\n** come from pTable (if pDatabase is NULL) or from pDatabase.  \r\n** SrcList.a[].zDatabase is filled with the database name from pTable,\r\n** or with NULL if no database is specified.\r\n**\r\n** In other words, if call like this:\r\n**\r\n**         sqlite3SrcListAppend(D,A,B,0);\r\n**\r\n** Then B is a table name and the database name is unspecified.  If called\r\n** like this:\r\n**\r\n**         sqlite3SrcListAppend(D,A,B,C);\r\n**\r\n** Then C is the table name and B is the database name.  If C is defined\r\n** then so is B.  In other words, we never have a case where:\r\n**\r\n**         sqlite3SrcListAppend(D,A,0,C);\r\n**\r\n** Both pTable and pDatabase are assumed to be quoted.  They are dequoted\r\n** before being added to the SrcList.\r\n*/\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListAppend(\r\n  sqlite3 *db,        /* Connection to notify of malloc failures */\r\n  SrcList *pList,     /* Append to this SrcList. NULL creates a new SrcList */\r\n  Token *pTable,      /* Table to append */\r\n  Token *pDatabase    /* Database of the table */\r\n){\r\n  struct SrcList_item *pItem;\r\n  assert( pDatabase==0 || pTable!=0 );  /* Cannot have C without B */\r\n  if( pList==0 ){\r\n    pList = sqlite3DbMallocZero(db, sizeof(SrcList) );\r\n    if( pList==0 ) return 0;\r\n    pList->nAlloc = 1;\r\n  }\r\n  pList = sqlite3SrcListEnlarge(db, pList, 1, pList->nSrc);\r\n  if( db->mallocFailed ){\r\n    sqlite3SrcListDelete(db, pList);\r\n    return 0;\r\n  }\r\n  pItem = &pList->a[pList->nSrc-1];\r\n  if( pDatabase && pDatabase->z==0 ){\r\n    pDatabase = 0;\r\n  }\r\n  if( pDatabase ){\r\n    Token *pTemp = pDatabase;\r\n    pDatabase = pTable;\r\n    pTable = pTemp;\r\n  }\r\n  pItem->zName = sqlite3NameFromToken(db, pTable);\r\n  pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);\r\n  return pList;\r\n}\r\n\r\n/*\r\n** Assign VdbeCursor index numbers to all tables in a SrcList\r\n*/\r\nSQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){\r\n  int i;\r\n  struct SrcList_item *pItem;\r\n  assert(pList || pParse->db->mallocFailed );\r\n  if( pList ){\r\n    for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){\r\n      if( pItem->iCursor>=0 ) break;\r\n      pItem->iCursor = pParse->nTab++;\r\n      if( pItem->pSelect ){\r\n        sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Delete an entire SrcList including all its substructure.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){\r\n  int i;\r\n  struct SrcList_item *pItem;\r\n  if( pList==0 ) return;\r\n  for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){\r\n    sqlite3DbFree(db, pItem->zDatabase);\r\n    sqlite3DbFree(db, pItem->zName);\r\n    sqlite3DbFree(db, pItem->zAlias);\r\n    sqlite3DbFree(db, pItem->zIndex);\r\n    sqlite3DeleteTable(db, pItem->pTab);\r\n    sqlite3SelectDelete(db, pItem->pSelect);\r\n    sqlite3ExprDelete(db, pItem->pOn);\r\n    sqlite3IdListDelete(db, pItem->pUsing);\r\n  }\r\n  sqlite3DbFree(db, pList);\r\n}\r\n\r\n/*\r\n** This routine is called by the parser to add a new term to the\r\n** end of a growing FROM clause.  The \"p\" parameter is the part of\r\n** the FROM clause that has already been constructed.  \"p\" is NULL\r\n** if this is the first term of the FROM clause.  pTable and pDatabase\r\n** are the name of the table and database named in the FROM clause term.\r\n** pDatabase is NULL if the database name qualifier is missing - the\r\n** usual case.  If the term has a alias, then pAlias points to the\r\n** alias token.  If the term is a subquery, then pSubquery is the\r\n** SELECT statement that the subquery encodes.  The pTable and\r\n** pDatabase parameters are NULL for subqueries.  The pOn and pUsing\r\n** parameters are the content of the ON and USING clauses.\r\n**\r\n** Return a new SrcList which encodes is the FROM with the new\r\n** term added.\r\n*/\r\nSQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(\r\n  Parse *pParse,          /* Parsing context */\r\n  SrcList *p,             /* The left part of the FROM clause already seen */\r\n  Token *pTable,          /* Name of the table to add to the FROM clause */\r\n  Token *pDatabase,       /* Name of the database containing pTable */\r\n  Token *pAlias,          /* The right-hand side of the AS subexpression */\r\n  Select *pSubquery,      /* A subquery used in place of a table name */\r\n  Expr *pOn,              /* The ON clause of a join */\r\n  IdList *pUsing          /* The USING clause of a join */\r\n){\r\n  struct SrcList_item *pItem;\r\n  sqlite3 *db = pParse->db;\r\n  if( !p && (pOn || pUsing) ){\r\n    sqlite3ErrorMsg(pParse, \"a JOIN clause is required before %s\", \r\n      (pOn ? \"ON\" : \"USING\")\r\n    );\r\n    goto append_from_error;\r\n  }\r\n  p = sqlite3SrcListAppend(db, p, pTable, pDatabase);\r\n  if( p==0 || NEVER(p->nSrc==0) ){\r\n    goto append_from_error;\r\n  }\r\n  pItem = &p->a[p->nSrc-1];\r\n  assert( pAlias!=0 );\r\n  if( pAlias->n ){\r\n    pItem->zAlias = sqlite3NameFromToken(db, pAlias);\r\n  }\r\n  pItem->pSelect = pSubquery;\r\n  pItem->pOn = pOn;\r\n  pItem->pUsing = pUsing;\r\n  return p;\r\n\r\n append_from_error:\r\n  assert( p==0 );\r\n  sqlite3ExprDelete(db, pOn);\r\n  sqlite3IdListDelete(db, pUsing);\r\n  sqlite3SelectDelete(db, pSubquery);\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Add an INDEXED BY or NOT INDEXED clause to the most recently added \r\n** element of the source-list passed as the second argument.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){\r\n  assert( pIndexedBy!=0 );\r\n  if( p && ALWAYS(p->nSrc>0) ){\r\n    struct SrcList_item *pItem = &p->a[p->nSrc-1];\r\n    assert( pItem->notIndexed==0 && pItem->zIndex==0 );\r\n    if( pIndexedBy->n==1 && !pIndexedBy->z ){\r\n      /* A \"NOT INDEXED\" clause was supplied. See parse.y \r\n      ** construct \"indexed_opt\" for details. */\r\n      pItem->notIndexed = 1;\r\n    }else{\r\n      pItem->zIndex = sqlite3NameFromToken(pParse->db, pIndexedBy);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** When building up a FROM clause in the parser, the join operator\r\n** is initially attached to the left operand.  But the code generator\r\n** expects the join operator to be on the right operand.  This routine\r\n** Shifts all join operators from left to right for an entire FROM\r\n** clause.\r\n**\r\n** Example: Suppose the join is like this:\r\n**\r\n**           A natural cross join B\r\n**\r\n** The operator is \"natural cross join\".  The A and B operands are stored\r\n** in p->a[0] and p->a[1], respectively.  The parser initially stores the\r\n** operator with A.  This routine shifts that operator over to B.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList *p){\r\n  if( p ){\r\n    int i;\r\n    assert( p->a || p->nSrc==0 );\r\n    for(i=p->nSrc-1; i>0; i--){\r\n      p->a[i].jointype = p->a[i-1].jointype;\r\n    }\r\n    p->a[0].jointype = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Begin a transaction\r\n*/\r\nSQLITE_PRIVATE void sqlite3BeginTransaction(Parse *pParse, int type){\r\n  sqlite3 *db;\r\n  Vdbe *v;\r\n  int i;\r\n\r\n  assert( pParse!=0 );\r\n  db = pParse->db;\r\n  assert( db!=0 );\r\n/*  if( db->aDb[0].pBt==0 ) return; */\r\n  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, \"BEGIN\", 0, 0) ){\r\n    return;\r\n  }\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( !v ) return;\r\n  if( type!=TK_DEFERRED ){\r\n    for(i=0; i<db->nDb; i++){\r\n      sqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1);\r\n      sqlite3VdbeUsesBtree(v, i);\r\n    }\r\n  }\r\n  sqlite3VdbeAddOp2(v, OP_AutoCommit, 0, 0);\r\n}\r\n\r\n/*\r\n** Commit a transaction\r\n*/\r\nSQLITE_PRIVATE void sqlite3CommitTransaction(Parse *pParse){\r\n  Vdbe *v;\r\n\r\n  assert( pParse!=0 );\r\n  assert( pParse->db!=0 );\r\n  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, \"COMMIT\", 0, 0) ){\r\n    return;\r\n  }\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v ){\r\n    sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 0);\r\n  }\r\n}\r\n\r\n/*\r\n** Rollback a transaction\r\n*/\r\nSQLITE_PRIVATE void sqlite3RollbackTransaction(Parse *pParse){\r\n  Vdbe *v;\r\n\r\n  assert( pParse!=0 );\r\n  assert( pParse->db!=0 );\r\n  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, \"ROLLBACK\", 0, 0) ){\r\n    return;\r\n  }\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v ){\r\n    sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1);\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called by the parser when it parses a command to create,\r\n** release or rollback an SQL savepoint. \r\n*/\r\nSQLITE_PRIVATE void sqlite3Savepoint(Parse *pParse, int op, Token *pName){\r\n  char *zName = sqlite3NameFromToken(pParse->db, pName);\r\n  if( zName ){\r\n    Vdbe *v = sqlite3GetVdbe(pParse);\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n    static const char * const az[] = { \"BEGIN\", \"RELEASE\", \"ROLLBACK\" };\r\n    assert( !SAVEPOINT_BEGIN && SAVEPOINT_RELEASE==1 && SAVEPOINT_ROLLBACK==2 );\r\n#endif\r\n    if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){\r\n      sqlite3DbFree(pParse->db, zName);\r\n      return;\r\n    }\r\n    sqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, P4_DYNAMIC);\r\n  }\r\n}\r\n\r\n/*\r\n** Make sure the TEMP database is open and available for use.  Return\r\n** the number of errors.  Leave any error messages in the pParse structure.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){\r\n  sqlite3 *db = pParse->db;\r\n  if( db->aDb[1].pBt==0 && !pParse->explain ){\r\n    int rc;\r\n    Btree *pBt;\r\n    static const int flags = \r\n          SQLITE_OPEN_READWRITE |\r\n          SQLITE_OPEN_CREATE |\r\n          SQLITE_OPEN_EXCLUSIVE |\r\n          SQLITE_OPEN_DELETEONCLOSE |\r\n          SQLITE_OPEN_TEMP_DB;\r\n\r\n    rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pBt, 0, flags);\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3ErrorMsg(pParse, \"unable to open a temporary database \"\r\n        \"file for storing temporary tables\");\r\n      pParse->rc = rc;\r\n      return 1;\r\n    }\r\n    db->aDb[1].pBt = pBt;\r\n    assert( db->aDb[1].pSchema );\r\n    if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){\r\n      db->mallocFailed = 1;\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Generate VDBE code that will verify the schema cookie and start\r\n** a read-transaction for all named database files.\r\n**\r\n** It is important that all schema cookies be verified and all\r\n** read transactions be started before anything else happens in\r\n** the VDBE program.  But this routine can be called after much other\r\n** code has been generated.  So here is what we do:\r\n**\r\n** The first time this routine is called, we code an OP_Goto that\r\n** will jump to a subroutine at the end of the program.  Then we\r\n** record every database that needs its schema verified in the\r\n** pParse->cookieMask field.  Later, after all other code has been\r\n** generated, the subroutine that does the cookie verifications and\r\n** starts the transactions will be coded and the OP_Goto P2 value\r\n** will be made to point to that subroutine.  The generation of the\r\n** cookie verification subroutine code happens in sqlite3FinishCoding().\r\n**\r\n** If iDb<0 then code the OP_Goto only - don't set flag to verify the\r\n** schema on any databases.  This can be used to position the OP_Goto\r\n** early in the code, before we know if any database tables will be used.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){\r\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n\r\n  if( pToplevel->cookieGoto==0 ){\r\n    Vdbe *v = sqlite3GetVdbe(pToplevel);\r\n    if( v==0 ) return;  /* This only happens if there was a prior error */\r\n    pToplevel->cookieGoto = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0)+1;\r\n  }\r\n  if( iDb>=0 ){\r\n    sqlite3 *db = pToplevel->db;\r\n    yDbMask mask;\r\n\r\n    assert( iDb<db->nDb );\r\n    assert( db->aDb[iDb].pBt!=0 || iDb==1 );\r\n    assert( iDb<SQLITE_MAX_ATTACHED+2 );\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    mask = ((yDbMask)1)<<iDb;\r\n    if( (pToplevel->cookieMask & mask)==0 ){\r\n      pToplevel->cookieMask |= mask;\r\n      pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;\r\n      if( !OMIT_TEMPDB && iDb==1 ){\r\n        sqlite3OpenTempDatabase(pToplevel);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each \r\n** attached database. Otherwise, invoke it for the database named zDb only.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb){\r\n  sqlite3 *db = pParse->db;\r\n  int i;\r\n  for(i=0; i<db->nDb; i++){\r\n    Db *pDb = &db->aDb[i];\r\n    if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zName)) ){\r\n      sqlite3CodeVerifySchema(pParse, i);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Generate VDBE code that prepares for doing an operation that\r\n** might change the database.\r\n**\r\n** This routine starts a new transaction if we are not already within\r\n** a transaction.  If we are already within a transaction, then a checkpoint\r\n** is set if the setStatement parameter is true.  A checkpoint should\r\n** be set for operations that might fail (due to a constraint) part of\r\n** the way through and which will need to undo some writes without having to\r\n** rollback the whole transaction.  For operations where all constraints\r\n** can be checked before any changes are made to the database, it is never\r\n** necessary to undo a write and the checkpoint should not be set.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){\r\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n  sqlite3CodeVerifySchema(pParse, iDb);\r\n  pToplevel->writeMask |= ((yDbMask)1)<<iDb;\r\n  pToplevel->isMultiWrite |= setStatement;\r\n}\r\n\r\n/*\r\n** Indicate that the statement currently under construction might write\r\n** more than one entry (example: deleting one row then inserting another,\r\n** inserting multiple rows in a table, or inserting a row and index entries.)\r\n** If an abort occurs after some of these writes have completed, then it will\r\n** be necessary to undo the completed writes.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MultiWrite(Parse *pParse){\r\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n  pToplevel->isMultiWrite = 1;\r\n}\r\n\r\n/* \r\n** The code generator calls this routine if is discovers that it is\r\n** possible to abort a statement prior to completion.  In order to \r\n** perform this abort without corrupting the database, we need to make\r\n** sure that the statement is protected by a statement transaction.\r\n**\r\n** Technically, we only need to set the mayAbort flag if the\r\n** isMultiWrite flag was previously set.  There is a time dependency\r\n** such that the abort must occur after the multiwrite.  This makes\r\n** some statements involving the REPLACE conflict resolution algorithm\r\n** go a little faster.  But taking advantage of this time dependency\r\n** makes it more difficult to prove that the code is correct (in \r\n** particular, it prevents us from writing an effective\r\n** implementation of sqlite3AssertMayAbort()) and so we have chosen\r\n** to take the safe route and skip the optimization.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MayAbort(Parse *pParse){\r\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n  pToplevel->mayAbort = 1;\r\n}\r\n\r\n/*\r\n** Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT\r\n** error. The onError parameter determines which (if any) of the statement\r\n** and/or current transaction is rolled back.\r\n*/\r\nSQLITE_PRIVATE void sqlite3HaltConstraint(Parse *pParse, int onError, char *p4, int p4type){\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  if( onError==OE_Abort ){\r\n    sqlite3MayAbort(pParse);\r\n  }\r\n  sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, onError, 0, p4, p4type);\r\n}\r\n\r\n/*\r\n** Check to see if pIndex uses the collating sequence pColl.  Return\r\n** true if it does and false if it does not.\r\n*/\r\n#ifndef SQLITE_OMIT_REINDEX\r\nstatic int collationMatch(const char *zColl, Index *pIndex){\r\n  int i;\r\n  assert( zColl!=0 );\r\n  for(i=0; i<pIndex->nColumn; i++){\r\n    const char *z = pIndex->azColl[i];\r\n    assert( z!=0 );\r\n    if( 0==sqlite3StrICmp(z, zColl) ){\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n#endif\r\n\r\n/*\r\n** Recompute all indices of pTab that use the collating sequence pColl.\r\n** If pColl==0 then recompute all indices of pTab.\r\n*/\r\n#ifndef SQLITE_OMIT_REINDEX\r\nstatic void reindexTable(Parse *pParse, Table *pTab, char const *zColl){\r\n  Index *pIndex;              /* An index associated with pTab */\r\n\r\n  for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){\r\n    if( zColl==0 || collationMatch(zColl, pIndex) ){\r\n      int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n      sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n      sqlite3RefillIndex(pParse, pIndex, -1);\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** Recompute all indices of all tables in all databases where the\r\n** indices use the collating sequence pColl.  If pColl==0 then recompute\r\n** all indices everywhere.\r\n*/\r\n#ifndef SQLITE_OMIT_REINDEX\r\nstatic void reindexDatabases(Parse *pParse, char const *zColl){\r\n  Db *pDb;                    /* A single database */\r\n  int iDb;                    /* The database index number */\r\n  sqlite3 *db = pParse->db;   /* The database connection */\r\n  HashElem *k;                /* For looping over tables in pDb */\r\n  Table *pTab;                /* A table in the database */\r\n\r\n  assert( sqlite3BtreeHoldsAllMutexes(db) );  /* Needed for schema access */\r\n  for(iDb=0, pDb=db->aDb; iDb<db->nDb; iDb++, pDb++){\r\n    assert( pDb!=0 );\r\n    for(k=sqliteHashFirst(&pDb->pSchema->tblHash);  k; k=sqliteHashNext(k)){\r\n      pTab = (Table*)sqliteHashData(k);\r\n      reindexTable(pParse, pTab, zColl);\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** Generate code for the REINDEX command.\r\n**\r\n**        REINDEX                            -- 1\r\n**        REINDEX  <collation>               -- 2\r\n**        REINDEX  ?<database>.?<tablename>  -- 3\r\n**        REINDEX  ?<database>.?<indexname>  -- 4\r\n**\r\n** Form 1 causes all indices in all attached databases to be rebuilt.\r\n** Form 2 rebuilds all indices in all databases that use the named\r\n** collating function.  Forms 3 and 4 rebuild the named index or all\r\n** indices associated with the named table.\r\n*/\r\n#ifndef SQLITE_OMIT_REINDEX\r\nSQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){\r\n  CollSeq *pColl;             /* Collating sequence to be reindexed, or NULL */\r\n  char *z;                    /* Name of a table or index */\r\n  const char *zDb;            /* Name of the database */\r\n  Table *pTab;                /* A table in the database */\r\n  Index *pIndex;              /* An index associated with pTab */\r\n  int iDb;                    /* The database index number */\r\n  sqlite3 *db = pParse->db;   /* The database connection */\r\n  Token *pObjName;            /* Name of the table or index to be reindexed */\r\n\r\n  /* Read the database schema. If an error occurs, leave an error message\r\n  ** and code in pParse and return NULL. */\r\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n    return;\r\n  }\r\n\r\n  if( pName1==0 ){\r\n    reindexDatabases(pParse, 0);\r\n    return;\r\n  }else if( NEVER(pName2==0) || pName2->z==0 ){\r\n    char *zColl;\r\n    assert( pName1->z );\r\n    zColl = sqlite3NameFromToken(pParse->db, pName1);\r\n    if( !zColl ) return;\r\n    pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);\r\n    if( pColl ){\r\n      reindexDatabases(pParse, zColl);\r\n      sqlite3DbFree(db, zColl);\r\n      return;\r\n    }\r\n    sqlite3DbFree(db, zColl);\r\n  }\r\n  iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pObjName);\r\n  if( iDb<0 ) return;\r\n  z = sqlite3NameFromToken(db, pObjName);\r\n  if( z==0 ) return;\r\n  zDb = db->aDb[iDb].zName;\r\n  pTab = sqlite3FindTable(db, z, zDb);\r\n  if( pTab ){\r\n    reindexTable(pParse, pTab, 0);\r\n    sqlite3DbFree(db, z);\r\n    return;\r\n  }\r\n  pIndex = sqlite3FindIndex(db, z, zDb);\r\n  sqlite3DbFree(db, z);\r\n  if( pIndex ){\r\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n    sqlite3RefillIndex(pParse, pIndex, -1);\r\n    return;\r\n  }\r\n  sqlite3ErrorMsg(pParse, \"unable to identify the object to be reindexed\");\r\n}\r\n#endif\r\n\r\n/*\r\n** Return a dynamicly allocated KeyInfo structure that can be used\r\n** with OP_OpenRead or OP_OpenWrite to access database index pIdx.\r\n**\r\n** If successful, a pointer to the new structure is returned. In this case\r\n** the caller is responsible for calling sqlite3DbFree(db, ) on the returned \r\n** pointer. If an error occurs (out of memory or missing collation \r\n** sequence), NULL is returned and the state of pParse updated to reflect\r\n** the error.\r\n*/\r\nSQLITE_PRIVATE KeyInfo *sqlite3IndexKeyinfo(Parse *pParse, Index *pIdx){\r\n  int i;\r\n  int nCol = pIdx->nColumn;\r\n  int nBytes = sizeof(KeyInfo) + (nCol-1)*sizeof(CollSeq*) + nCol;\r\n  sqlite3 *db = pParse->db;\r\n  KeyInfo *pKey = (KeyInfo *)sqlite3DbMallocZero(db, nBytes);\r\n\r\n  if( pKey ){\r\n    pKey->db = pParse->db;\r\n    pKey->aSortOrder = (u8 *)&(pKey->aColl[nCol]);\r\n    assert( &pKey->aSortOrder[nCol]==&(((u8 *)pKey)[nBytes]) );\r\n    for(i=0; i<nCol; i++){\r\n      char *zColl = pIdx->azColl[i];\r\n      assert( zColl );\r\n      pKey->aColl[i] = sqlite3LocateCollSeq(pParse, zColl);\r\n      pKey->aSortOrder[i] = pIdx->aSortOrder[i];\r\n    }\r\n    pKey->nField = (u16)nCol;\r\n  }\r\n\r\n  if( pParse->nErr ){\r\n    sqlite3DbFree(db, pKey);\r\n    pKey = 0;\r\n  }\r\n  return pKey;\r\n}\r\n\r\n/************** End of build.c ***********************************************/\r\n/************** Begin file callback.c ****************************************/\r\n/*\r\n** 2005 May 23 \r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains functions used to access the internal hash tables\r\n** of user defined functions and collation sequences.\r\n*/\r\n\r\n\r\n/*\r\n** Invoke the 'collation needed' callback to request a collation sequence\r\n** in the encoding enc of name zName, length nName.\r\n*/\r\nstatic void callCollNeeded(sqlite3 *db, int enc, const char *zName){\r\n  assert( !db->xCollNeeded || !db->xCollNeeded16 );\r\n  if( db->xCollNeeded ){\r\n    char *zExternal = sqlite3DbStrDup(db, zName);\r\n    if( !zExternal ) return;\r\n    db->xCollNeeded(db->pCollNeededArg, db, enc, zExternal);\r\n    sqlite3DbFree(db, zExternal);\r\n  }\r\n#ifndef SQLITE_OMIT_UTF16\r\n  if( db->xCollNeeded16 ){\r\n    char const *zExternal;\r\n    sqlite3_value *pTmp = sqlite3ValueNew(db);\r\n    sqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF8, SQLITE_STATIC);\r\n    zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE);\r\n    if( zExternal ){\r\n      db->xCollNeeded16(db->pCollNeededArg, db, (int)ENC(db), zExternal);\r\n    }\r\n    sqlite3ValueFree(pTmp);\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** This routine is called if the collation factory fails to deliver a\r\n** collation function in the best encoding but there may be other versions\r\n** of this collation function (for other text encodings) available. Use one\r\n** of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if\r\n** possible.\r\n*/\r\nstatic int synthCollSeq(sqlite3 *db, CollSeq *pColl){\r\n  CollSeq *pColl2;\r\n  char *z = pColl->zName;\r\n  int i;\r\n  static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 };\r\n  for(i=0; i<3; i++){\r\n    pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, 0);\r\n    if( pColl2->xCmp!=0 ){\r\n      memcpy(pColl, pColl2, sizeof(CollSeq));\r\n      pColl->xDel = 0;         /* Do not copy the destructor */\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n  return SQLITE_ERROR;\r\n}\r\n\r\n/*\r\n** This function is responsible for invoking the collation factory callback\r\n** or substituting a collation sequence of a different encoding when the\r\n** requested collation sequence is not available in the desired encoding.\r\n** \r\n** If it is not NULL, then pColl must point to the database native encoding \r\n** collation sequence with name zName, length nName.\r\n**\r\n** The return value is either the collation sequence to be used in database\r\n** db for collation type name zName, length nName, or NULL, if no collation\r\n** sequence can be found.\r\n**\r\n** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq()\r\n*/\r\nSQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(\r\n  sqlite3* db,          /* The database connection */\r\n  u8 enc,               /* The desired encoding for the collating sequence */\r\n  CollSeq *pColl,       /* Collating sequence with native encoding, or NULL */\r\n  const char *zName     /* Collating sequence name */\r\n){\r\n  CollSeq *p;\r\n\r\n  p = pColl;\r\n  if( !p ){\r\n    p = sqlite3FindCollSeq(db, enc, zName, 0);\r\n  }\r\n  if( !p || !p->xCmp ){\r\n    /* No collation sequence of this type for this encoding is registered.\r\n    ** Call the collation factory to see if it can supply us with one.\r\n    */\r\n    callCollNeeded(db, enc, zName);\r\n    p = sqlite3FindCollSeq(db, enc, zName, 0);\r\n  }\r\n  if( p && !p->xCmp && synthCollSeq(db, p) ){\r\n    p = 0;\r\n  }\r\n  assert( !p || p->xCmp );\r\n  return p;\r\n}\r\n\r\n/*\r\n** This routine is called on a collation sequence before it is used to\r\n** check that it is defined. An undefined collation sequence exists when\r\n** a database is loaded that contains references to collation sequences\r\n** that have not been defined by sqlite3_create_collation() etc.\r\n**\r\n** If required, this routine calls the 'collation needed' callback to\r\n** request a definition of the collating sequence. If this doesn't work, \r\n** an equivalent collating sequence that uses a text encoding different\r\n** from the main database is substituted, if one is available.\r\n*/\r\nSQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){\r\n  if( pColl ){\r\n    const char *zName = pColl->zName;\r\n    sqlite3 *db = pParse->db;\r\n    CollSeq *p = sqlite3GetCollSeq(db, ENC(db), pColl, zName);\r\n    if( !p ){\r\n      sqlite3ErrorMsg(pParse, \"no such collation sequence: %s\", zName);\r\n      pParse->nErr++;\r\n      return SQLITE_ERROR;\r\n    }\r\n    assert( p==pColl );\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n\r\n/*\r\n** Locate and return an entry from the db.aCollSeq hash table. If the entry\r\n** specified by zName and nName is not found and parameter 'create' is\r\n** true, then create a new entry. Otherwise return NULL.\r\n**\r\n** Each pointer stored in the sqlite3.aCollSeq hash table contains an\r\n** array of three CollSeq structures. The first is the collation sequence\r\n** prefferred for UTF-8, the second UTF-16le, and the third UTF-16be.\r\n**\r\n** Stored immediately after the three collation sequences is a copy of\r\n** the collation sequence name. A pointer to this string is stored in\r\n** each collation sequence structure.\r\n*/\r\nstatic CollSeq *findCollSeqEntry(\r\n  sqlite3 *db,          /* Database connection */\r\n  const char *zName,    /* Name of the collating sequence */\r\n  int create            /* Create a new entry if true */\r\n){\r\n  CollSeq *pColl;\r\n  int nName = sqlite3Strlen30(zName);\r\n  pColl = sqlite3HashFind(&db->aCollSeq, zName, nName);\r\n\r\n  if( 0==pColl && create ){\r\n    pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1 );\r\n    if( pColl ){\r\n      CollSeq *pDel = 0;\r\n      pColl[0].zName = (char*)&pColl[3];\r\n      pColl[0].enc = SQLITE_UTF8;\r\n      pColl[1].zName = (char*)&pColl[3];\r\n      pColl[1].enc = SQLITE_UTF16LE;\r\n      pColl[2].zName = (char*)&pColl[3];\r\n      pColl[2].enc = SQLITE_UTF16BE;\r\n      memcpy(pColl[0].zName, zName, nName);\r\n      pColl[0].zName[nName] = 0;\r\n      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl);\r\n\r\n      /* If a malloc() failure occurred in sqlite3HashInsert(), it will \r\n      ** return the pColl pointer to be deleted (because it wasn't added\r\n      ** to the hash table).\r\n      */\r\n      assert( pDel==0 || pDel==pColl );\r\n      if( pDel!=0 ){\r\n        db->mallocFailed = 1;\r\n        sqlite3DbFree(db, pDel);\r\n        pColl = 0;\r\n      }\r\n    }\r\n  }\r\n  return pColl;\r\n}\r\n\r\n/*\r\n** Parameter zName points to a UTF-8 encoded string nName bytes long.\r\n** Return the CollSeq* pointer for the collation sequence named zName\r\n** for the encoding 'enc' from the database 'db'.\r\n**\r\n** If the entry specified is not found and 'create' is true, then create a\r\n** new entry.  Otherwise return NULL.\r\n**\r\n** A separate function sqlite3LocateCollSeq() is a wrapper around\r\n** this routine.  sqlite3LocateCollSeq() invokes the collation factory\r\n** if necessary and generates an error message if the collating sequence\r\n** cannot be found.\r\n**\r\n** See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq()\r\n*/\r\nSQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(\r\n  sqlite3 *db,\r\n  u8 enc,\r\n  const char *zName,\r\n  int create\r\n){\r\n  CollSeq *pColl;\r\n  if( zName ){\r\n    pColl = findCollSeqEntry(db, zName, create);\r\n  }else{\r\n    pColl = db->pDfltColl;\r\n  }\r\n  assert( SQLITE_UTF8==1 && SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );\r\n  assert( enc>=SQLITE_UTF8 && enc<=SQLITE_UTF16BE );\r\n  if( pColl ) pColl += enc-1;\r\n  return pColl;\r\n}\r\n\r\n/* During the search for the best function definition, this procedure\r\n** is called to test how well the function passed as the first argument\r\n** matches the request for a function with nArg arguments in a system\r\n** that uses encoding enc. The value returned indicates how well the\r\n** request is matched. A higher value indicates a better match.\r\n**\r\n** The returned value is always between 0 and 6, as follows:\r\n**\r\n** 0: Not a match, or if nArg<0 and the function is has no implementation.\r\n** 1: A variable arguments function that prefers UTF-8 when a UTF-16\r\n**    encoding is requested, or vice versa.\r\n** 2: A variable arguments function that uses UTF-16BE when UTF-16LE is\r\n**    requested, or vice versa.\r\n** 3: A variable arguments function using the same text encoding.\r\n** 4: A function with the exact number of arguments requested that\r\n**    prefers UTF-8 when a UTF-16 encoding is requested, or vice versa.\r\n** 5: A function with the exact number of arguments requested that\r\n**    prefers UTF-16LE when UTF-16BE is requested, or vice versa.\r\n** 6: An exact match.\r\n**\r\n*/\r\nstatic int matchQuality(FuncDef *p, int nArg, u8 enc){\r\n  int match = 0;\r\n  if( p->nArg==-1 || p->nArg==nArg \r\n   || (nArg==-1 && (p->xFunc!=0 || p->xStep!=0))\r\n  ){\r\n    match = 1;\r\n    if( p->nArg==nArg || nArg==-1 ){\r\n      match = 4;\r\n    }\r\n    if( enc==p->iPrefEnc ){\r\n      match += 2;\r\n    }\r\n    else if( (enc==SQLITE_UTF16LE && p->iPrefEnc==SQLITE_UTF16BE) ||\r\n             (enc==SQLITE_UTF16BE && p->iPrefEnc==SQLITE_UTF16LE) ){\r\n      match += 1;\r\n    }\r\n  }\r\n  return match;\r\n}\r\n\r\n/*\r\n** Search a FuncDefHash for a function with the given name.  Return\r\n** a pointer to the matching FuncDef if found, or 0 if there is no match.\r\n*/\r\nstatic FuncDef *functionSearch(\r\n  FuncDefHash *pHash,  /* Hash table to search */\r\n  int h,               /* Hash of the name */\r\n  const char *zFunc,   /* Name of function */\r\n  int nFunc            /* Number of bytes in zFunc */\r\n){\r\n  FuncDef *p;\r\n  for(p=pHash->a[h]; p; p=p->pHash){\r\n    if( sqlite3StrNICmp(p->zName, zFunc, nFunc)==0 && p->zName[nFunc]==0 ){\r\n      return p;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Insert a new FuncDef into a FuncDefHash hash table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3FuncDefInsert(\r\n  FuncDefHash *pHash,  /* The hash table into which to insert */\r\n  FuncDef *pDef        /* The function definition to insert */\r\n){\r\n  FuncDef *pOther;\r\n  int nName = sqlite3Strlen30(pDef->zName);\r\n  u8 c1 = (u8)pDef->zName[0];\r\n  int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a);\r\n  pOther = functionSearch(pHash, h, pDef->zName, nName);\r\n  if( pOther ){\r\n    assert( pOther!=pDef && pOther->pNext!=pDef );\r\n    pDef->pNext = pOther->pNext;\r\n    pOther->pNext = pDef;\r\n  }else{\r\n    pDef->pNext = 0;\r\n    pDef->pHash = pHash->a[h];\r\n    pHash->a[h] = pDef;\r\n  }\r\n}\r\n  \r\n  \r\n\r\n/*\r\n** Locate a user function given a name, a number of arguments and a flag\r\n** indicating whether the function prefers UTF-16 over UTF-8.  Return a\r\n** pointer to the FuncDef structure that defines that function, or return\r\n** NULL if the function does not exist.\r\n**\r\n** If the createFlag argument is true, then a new (blank) FuncDef\r\n** structure is created and liked into the \"db\" structure if a\r\n** no matching function previously existed.  When createFlag is true\r\n** and the nArg parameter is -1, then only a function that accepts\r\n** any number of arguments will be returned.\r\n**\r\n** If createFlag is false and nArg is -1, then the first valid\r\n** function found is returned.  A function is valid if either xFunc\r\n** or xStep is non-zero.\r\n**\r\n** If createFlag is false, then a function with the required name and\r\n** number of arguments may be returned even if the eTextRep flag does not\r\n** match that requested.\r\n*/\r\nSQLITE_PRIVATE FuncDef *sqlite3FindFunction(\r\n  sqlite3 *db,       /* An open database */\r\n  const char *zName, /* Name of the function.  Not null-terminated */\r\n  int nName,         /* Number of characters in the name */\r\n  int nArg,          /* Number of arguments.  -1 means any number */\r\n  u8 enc,            /* Preferred text encoding */\r\n  int createFlag     /* Create new entry if true and does not otherwise exist */\r\n){\r\n  FuncDef *p;         /* Iterator variable */\r\n  FuncDef *pBest = 0; /* Best match found so far */\r\n  int bestScore = 0;  /* Score of best match */\r\n  int h;              /* Hash value */\r\n\r\n\r\n  assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );\r\n  h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a);\r\n\r\n  /* First search for a match amongst the application-defined functions.\r\n  */\r\n  p = functionSearch(&db->aFunc, h, zName, nName);\r\n  while( p ){\r\n    int score = matchQuality(p, nArg, enc);\r\n    if( score>bestScore ){\r\n      pBest = p;\r\n      bestScore = score;\r\n    }\r\n    p = p->pNext;\r\n  }\r\n\r\n  /* If no match is found, search the built-in functions.\r\n  **\r\n  ** If the SQLITE_PreferBuiltin flag is set, then search the built-in\r\n  ** functions even if a prior app-defined function was found.  And give\r\n  ** priority to built-in functions.\r\n  **\r\n  ** Except, if createFlag is true, that means that we are trying to\r\n  ** install a new function.  Whatever FuncDef structure is returned it will\r\n  ** have fields overwritten with new information appropriate for the\r\n  ** new function.  But the FuncDefs for built-in functions are read-only.\r\n  ** So we must not search for built-ins when creating a new function.\r\n  */ \r\n  if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){\r\n    FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);\r\n    bestScore = 0;\r\n    p = functionSearch(pHash, h, zName, nName);\r\n    while( p ){\r\n      int score = matchQuality(p, nArg, enc);\r\n      if( score>bestScore ){\r\n        pBest = p;\r\n        bestScore = score;\r\n      }\r\n      p = p->pNext;\r\n    }\r\n  }\r\n\r\n  /* If the createFlag parameter is true and the search did not reveal an\r\n  ** exact match for the name, number of arguments and encoding, then add a\r\n  ** new entry to the hash table and return it.\r\n  */\r\n  if( createFlag && (bestScore<6 || pBest->nArg!=nArg) && \r\n      (pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){\r\n    pBest->zName = (char *)&pBest[1];\r\n    pBest->nArg = (u16)nArg;\r\n    pBest->iPrefEnc = enc;\r\n    memcpy(pBest->zName, zName, nName);\r\n    pBest->zName[nName] = 0;\r\n    sqlite3FuncDefInsert(&db->aFunc, pBest);\r\n  }\r\n\r\n  if( pBest && (pBest->xStep || pBest->xFunc || createFlag) ){\r\n    return pBest;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Free all resources held by the schema structure. The void* argument points\r\n** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the \r\n** pointer itself, it just cleans up subsidiary resources (i.e. the contents\r\n** of the schema hash tables).\r\n**\r\n** The Schema.cache_size variable is not cleared.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SchemaClear(void *p){\r\n  Hash temp1;\r\n  Hash temp2;\r\n  HashElem *pElem;\r\n  Schema *pSchema = (Schema *)p;\r\n\r\n  temp1 = pSchema->tblHash;\r\n  temp2 = pSchema->trigHash;\r\n  sqlite3HashInit(&pSchema->trigHash);\r\n  sqlite3HashClear(&pSchema->idxHash);\r\n  for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){\r\n    sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem));\r\n  }\r\n  sqlite3HashClear(&temp2);\r\n  sqlite3HashInit(&pSchema->tblHash);\r\n  for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){\r\n    Table *pTab = sqliteHashData(pElem);\r\n    sqlite3DeleteTable(0, pTab);\r\n  }\r\n  sqlite3HashClear(&temp1);\r\n  sqlite3HashClear(&pSchema->fkeyHash);\r\n  pSchema->pSeqTab = 0;\r\n  if( pSchema->flags & DB_SchemaLoaded ){\r\n    pSchema->iGeneration++;\r\n    pSchema->flags &= ~DB_SchemaLoaded;\r\n  }\r\n}\r\n\r\n/*\r\n** Find and return the schema associated with a BTree.  Create\r\n** a new one if necessary.\r\n*/\r\nSQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){\r\n  Schema * p;\r\n  if( pBt ){\r\n    p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear);\r\n  }else{\r\n    p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));\r\n  }\r\n  if( !p ){\r\n    db->mallocFailed = 1;\r\n  }else if ( 0==p->file_format ){\r\n    sqlite3HashInit(&p->tblHash);\r\n    sqlite3HashInit(&p->idxHash);\r\n    sqlite3HashInit(&p->trigHash);\r\n    sqlite3HashInit(&p->fkeyHash);\r\n    p->enc = SQLITE_UTF8;\r\n  }\r\n  return p;\r\n}\r\n\r\n/************** End of callback.c ********************************************/\r\n/************** Begin file delete.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains C code routines that are called by the parser\r\n** in order to generate code for DELETE FROM statements.\r\n*/\r\n\r\n/*\r\n** While a SrcList can in general represent multiple tables and subqueries\r\n** (as in the FROM clause of a SELECT statement) in this case it contains\r\n** the name of a single table, as one might find in an INSERT, DELETE,\r\n** or UPDATE statement.  Look up that table in the symbol table and\r\n** return a pointer.  Set an error message and return NULL if the table \r\n** name is not found or if any other error occurs.\r\n**\r\n** The following fields are initialized appropriate in pSrc:\r\n**\r\n**    pSrc->a[0].pTab       Pointer to the Table object\r\n**    pSrc->a[0].pIndex     Pointer to the INDEXED BY index, if there is one\r\n**\r\n*/\r\nSQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){\r\n  struct SrcList_item *pItem = pSrc->a;\r\n  Table *pTab;\r\n  assert( pItem && pSrc->nSrc==1 );\r\n  pTab = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);\r\n  sqlite3DeleteTable(pParse->db, pItem->pTab);\r\n  pItem->pTab = pTab;\r\n  if( pTab ){\r\n    pTab->nRef++;\r\n  }\r\n  if( sqlite3IndexedByLookup(pParse, pItem) ){\r\n    pTab = 0;\r\n  }\r\n  return pTab;\r\n}\r\n\r\n/*\r\n** Check to make sure the given table is writable.  If it is not\r\n** writable, generate an error message and return 1.  If it is\r\n** writable return 0;\r\n*/\r\nSQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){\r\n  /* A table is not writable under the following circumstances:\r\n  **\r\n  **   1) It is a virtual table and no implementation of the xUpdate method\r\n  **      has been provided, or\r\n  **   2) It is a system table (i.e. sqlite_master), this call is not\r\n  **      part of a nested parse and writable_schema pragma has not \r\n  **      been specified.\r\n  **\r\n  ** In either case leave an error message in pParse and return non-zero.\r\n  */\r\n  if( ( IsVirtual(pTab) \r\n     && sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 )\r\n   || ( (pTab->tabFlags & TF_Readonly)!=0\r\n     && (pParse->db->flags & SQLITE_WriteSchema)==0\r\n     && pParse->nested==0 )\r\n  ){\r\n    sqlite3ErrorMsg(pParse, \"table %s may not be modified\", pTab->zName);\r\n    return 1;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_VIEW\r\n  if( !viewOk && pTab->pSelect ){\r\n    sqlite3ErrorMsg(pParse,\"cannot modify %s because it is a view\",pTab->zName);\r\n    return 1;\r\n  }\r\n#endif\r\n  return 0;\r\n}\r\n\r\n\r\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\r\n/*\r\n** Evaluate a view and store its result in an ephemeral table.  The\r\n** pWhere argument is an optional WHERE clause that restricts the\r\n** set of rows in the view that are to be added to the ephemeral table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3MaterializeView(\r\n  Parse *pParse,       /* Parsing context */\r\n  Table *pView,        /* View definition */\r\n  Expr *pWhere,        /* Optional WHERE clause to be added */\r\n  int iCur             /* Cursor number for ephemerial table */\r\n){\r\n  SelectDest dest;\r\n  Select *pDup;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  pDup = sqlite3SelectDup(db, pView->pSelect, 0);\r\n  if( pWhere ){\r\n    SrcList *pFrom;\r\n    \r\n    pWhere = sqlite3ExprDup(db, pWhere, 0);\r\n    pFrom = sqlite3SrcListAppend(db, 0, 0, 0);\r\n    if( pFrom ){\r\n      assert( pFrom->nSrc==1 );\r\n      pFrom->a[0].zAlias = sqlite3DbStrDup(db, pView->zName);\r\n      pFrom->a[0].pSelect = pDup;\r\n      assert( pFrom->a[0].pOn==0 );\r\n      assert( pFrom->a[0].pUsing==0 );\r\n    }else{\r\n      sqlite3SelectDelete(db, pDup);\r\n    }\r\n    pDup = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);\r\n  }\r\n  sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);\r\n  sqlite3Select(pParse, pDup, &dest);\r\n  sqlite3SelectDelete(db, pDup);\r\n}\r\n#endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */\r\n\r\n#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)\r\n/*\r\n** Generate an expression tree to implement the WHERE, ORDER BY,\r\n** and LIMIT/OFFSET portion of DELETE and UPDATE statements.\r\n**\r\n**     DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1;\r\n**                            \\__________________________/\r\n**                               pLimitWhere (pInClause)\r\n*/\r\nSQLITE_PRIVATE Expr *sqlite3LimitWhere(\r\n  Parse *pParse,               /* The parser context */\r\n  SrcList *pSrc,               /* the FROM clause -- which tables to scan */\r\n  Expr *pWhere,                /* The WHERE clause.  May be null */\r\n  ExprList *pOrderBy,          /* The ORDER BY clause.  May be null */\r\n  Expr *pLimit,                /* The LIMIT clause.  May be null */\r\n  Expr *pOffset,               /* The OFFSET clause.  May be null */\r\n  char *zStmtType              /* Either DELETE or UPDATE.  For error messages. */\r\n){\r\n  Expr *pWhereRowid = NULL;    /* WHERE rowid .. */\r\n  Expr *pInClause = NULL;      /* WHERE rowid IN ( select ) */\r\n  Expr *pSelectRowid = NULL;   /* SELECT rowid ... */\r\n  ExprList *pEList = NULL;     /* Expression list contaning only pSelectRowid */\r\n  SrcList *pSelectSrc = NULL;  /* SELECT rowid FROM x ... (dup of pSrc) */\r\n  Select *pSelect = NULL;      /* Complete SELECT tree */\r\n\r\n  /* Check that there isn't an ORDER BY without a LIMIT clause.\r\n  */\r\n  if( pOrderBy && (pLimit == 0) ) {\r\n    sqlite3ErrorMsg(pParse, \"ORDER BY without LIMIT on %s\", zStmtType);\r\n    goto limit_where_cleanup_2;\r\n  }\r\n\r\n  /* We only need to generate a select expression if there\r\n  ** is a limit/offset term to enforce.\r\n  */\r\n  if( pLimit == 0 ) {\r\n    /* if pLimit is null, pOffset will always be null as well. */\r\n    assert( pOffset == 0 );\r\n    return pWhere;\r\n  }\r\n\r\n  /* Generate a select expression tree to enforce the limit/offset \r\n  ** term for the DELETE or UPDATE statement.  For example:\r\n  **   DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1\r\n  ** becomes:\r\n  **   DELETE FROM table_a WHERE rowid IN ( \r\n  **     SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1\r\n  **   );\r\n  */\r\n\r\n  pSelectRowid = sqlite3PExpr(pParse, TK_ROW, 0, 0, 0);\r\n  if( pSelectRowid == 0 ) goto limit_where_cleanup_2;\r\n  pEList = sqlite3ExprListAppend(pParse, 0, pSelectRowid);\r\n  if( pEList == 0 ) goto limit_where_cleanup_2;\r\n\r\n  /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree\r\n  ** and the SELECT subtree. */\r\n  pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);\r\n  if( pSelectSrc == 0 ) {\r\n    sqlite3ExprListDelete(pParse->db, pEList);\r\n    goto limit_where_cleanup_2;\r\n  }\r\n\r\n  /* generate the SELECT expression tree. */\r\n  pSelect = sqlite3SelectNew(pParse,pEList,pSelectSrc,pWhere,0,0,\r\n                             pOrderBy,0,pLimit,pOffset);\r\n  if( pSelect == 0 ) return 0;\r\n\r\n  /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */\r\n  pWhereRowid = sqlite3PExpr(pParse, TK_ROW, 0, 0, 0);\r\n  if( pWhereRowid == 0 ) goto limit_where_cleanup_1;\r\n  pInClause = sqlite3PExpr(pParse, TK_IN, pWhereRowid, 0, 0);\r\n  if( pInClause == 0 ) goto limit_where_cleanup_1;\r\n\r\n  pInClause->x.pSelect = pSelect;\r\n  pInClause->flags |= EP_xIsSelect;\r\n  sqlite3ExprSetHeight(pParse, pInClause);\r\n  return pInClause;\r\n\r\n  /* something went wrong. clean up anything allocated. */\r\nlimit_where_cleanup_1:\r\n  sqlite3SelectDelete(pParse->db, pSelect);\r\n  return 0;\r\n\r\nlimit_where_cleanup_2:\r\n  sqlite3ExprDelete(pParse->db, pWhere);\r\n  sqlite3ExprListDelete(pParse->db, pOrderBy);\r\n  sqlite3ExprDelete(pParse->db, pLimit);\r\n  sqlite3ExprDelete(pParse->db, pOffset);\r\n  return 0;\r\n}\r\n#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) */\r\n\r\n/*\r\n** Generate code for a DELETE FROM statement.\r\n**\r\n**     DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;\r\n**                 \\________/       \\________________/\r\n**                  pTabList              pWhere\r\n*/\r\nSQLITE_PRIVATE void sqlite3DeleteFrom(\r\n  Parse *pParse,         /* The parser context */\r\n  SrcList *pTabList,     /* The table from which we should delete things */\r\n  Expr *pWhere           /* The WHERE clause.  May be null */\r\n){\r\n  Vdbe *v;               /* The virtual database engine */\r\n  Table *pTab;           /* The table from which records will be deleted */\r\n  const char *zDb;       /* Name of database holding pTab */\r\n  int end, addr = 0;     /* A couple addresses of generated code */\r\n  int i;                 /* Loop counter */\r\n  WhereInfo *pWInfo;     /* Information about the WHERE clause */\r\n  Index *pIdx;           /* For looping over indices of the table */\r\n  int iCur;              /* VDBE Cursor number for pTab */\r\n  sqlite3 *db;           /* Main database structure */\r\n  AuthContext sContext;  /* Authorization context */\r\n  NameContext sNC;       /* Name context to resolve expressions in */\r\n  int iDb;               /* Database number */\r\n  int memCnt = -1;       /* Memory cell used for change counting */\r\n  int rcauth;            /* Value returned by authorization callback */\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  int isView;                  /* True if attempting to delete from a view */\r\n  Trigger *pTrigger;           /* List of table triggers, if required */\r\n#endif\r\n\r\n  memset(&sContext, 0, sizeof(sContext));\r\n  db = pParse->db;\r\n  if( pParse->nErr || db->mallocFailed ){\r\n    goto delete_from_cleanup;\r\n  }\r\n  assert( pTabList->nSrc==1 );\r\n\r\n  /* Locate the table which we want to delete.  This table has to be\r\n  ** put in an SrcList structure because some of the subroutines we\r\n  ** will be calling are designed to work with multiple tables and expect\r\n  ** an SrcList* parameter instead of just a Table* parameter.\r\n  */\r\n  pTab = sqlite3SrcListLookup(pParse, pTabList);\r\n  if( pTab==0 )  goto delete_from_cleanup;\r\n\r\n  /* Figure out if we have any triggers and if the table being\r\n  ** deleted from is a view\r\n  */\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);\r\n  isView = pTab->pSelect!=0;\r\n#else\r\n# define pTrigger 0\r\n# define isView 0\r\n#endif\r\n#ifdef SQLITE_OMIT_VIEW\r\n# undef isView\r\n# define isView 0\r\n#endif\r\n\r\n  /* If pTab is really a view, make sure it has been initialized.\r\n  */\r\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\r\n    goto delete_from_cleanup;\r\n  }\r\n\r\n  if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){\r\n    goto delete_from_cleanup;\r\n  }\r\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n  assert( iDb<db->nDb );\r\n  zDb = db->aDb[iDb].zName;\r\n  rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb);\r\n  assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE );\r\n  if( rcauth==SQLITE_DENY ){\r\n    goto delete_from_cleanup;\r\n  }\r\n  assert(!isView || pTrigger);\r\n\r\n  /* Assign  cursor number to the table and all its indices.\r\n  */\r\n  assert( pTabList->nSrc==1 );\r\n  iCur = pTabList->a[0].iCursor = pParse->nTab++;\r\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n    pParse->nTab++;\r\n  }\r\n\r\n  /* Start the view context\r\n  */\r\n  if( isView ){\r\n    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);\r\n  }\r\n\r\n  /* Begin generating code.\r\n  */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ){\r\n    goto delete_from_cleanup;\r\n  }\r\n  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);\r\n  sqlite3BeginWriteOperation(pParse, 1, iDb);\r\n\r\n  /* If we are trying to delete from a view, realize that view into\r\n  ** a ephemeral table.\r\n  */\r\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\r\n  if( isView ){\r\n    sqlite3MaterializeView(pParse, pTab, pWhere, iCur);\r\n  }\r\n#endif\r\n\r\n  /* Resolve the column names in the WHERE clause.\r\n  */\r\n  memset(&sNC, 0, sizeof(sNC));\r\n  sNC.pParse = pParse;\r\n  sNC.pSrcList = pTabList;\r\n  if( sqlite3ResolveExprNames(&sNC, pWhere) ){\r\n    goto delete_from_cleanup;\r\n  }\r\n\r\n  /* Initialize the counter of the number of rows deleted, if\r\n  ** we are counting rows.\r\n  */\r\n  if( db->flags & SQLITE_CountRows ){\r\n    memCnt = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION\r\n  /* Special case: A DELETE without a WHERE clause deletes everything.\r\n  ** It is easier just to erase the whole table. Prior to version 3.6.5,\r\n  ** this optimization caused the row change count (the value returned by \r\n  ** API function sqlite3_count_changes) to be set incorrectly.  */\r\n  if( rcauth==SQLITE_OK && pWhere==0 && !pTrigger && !IsVirtual(pTab) \r\n   && 0==sqlite3FkRequired(pParse, pTab, 0, 0)\r\n  ){\r\n    assert( !isView );\r\n    sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,\r\n                      pTab->zName, P4_STATIC);\r\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n      assert( pIdx->pSchema==pTab->pSchema );\r\n      sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);\r\n    }\r\n  }else\r\n#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */\r\n  /* The usual case: There is a WHERE clause so we have to scan through\r\n  ** the table and pick which records to delete.\r\n  */\r\n  {\r\n    int iRowSet = ++pParse->nMem;   /* Register for rowset of rows to delete */\r\n    int iRowid = ++pParse->nMem;    /* Used for storing rowid values. */\r\n    int regRowid;                   /* Actual register containing rowids */\r\n\r\n    /* Collect rowids of every row to be deleted.\r\n    */\r\n    sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet);\r\n    pWInfo = sqlite3WhereBegin(\r\n        pParse, pTabList, pWhere, 0, 0, WHERE_DUPLICATES_OK\r\n    );\r\n    if( pWInfo==0 ) goto delete_from_cleanup;\r\n    regRowid = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, iRowid);\r\n    sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, regRowid);\r\n    if( db->flags & SQLITE_CountRows ){\r\n      sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);\r\n    }\r\n    sqlite3WhereEnd(pWInfo);\r\n\r\n    /* Delete every item whose key was written to the list during the\r\n    ** database scan.  We have to delete items after the scan is complete\r\n    ** because deleting an item can change the scan order.  */\r\n    end = sqlite3VdbeMakeLabel(v);\r\n\r\n    /* Unless this is a view, open cursors for the table we are \r\n    ** deleting from and all its indices. If this is a view, then the\r\n    ** only effect this statement has is to fire the INSTEAD OF \r\n    ** triggers.  */\r\n    if( !isView ){\r\n      sqlite3OpenTableAndIndices(pParse, pTab, iCur, OP_OpenWrite);\r\n    }\r\n\r\n    addr = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, end, iRowid);\r\n\r\n    /* Delete the row */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    if( IsVirtual(pTab) ){\r\n      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);\r\n      sqlite3VtabMakeWritable(pParse, pTab);\r\n      sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iRowid, pVTab, P4_VTAB);\r\n      sqlite3VdbeChangeP5(v, OE_Abort);\r\n      sqlite3MayAbort(pParse);\r\n    }else\r\n#endif\r\n    {\r\n      int count = (pParse->nested==0);    /* True to count changes */\r\n      sqlite3GenerateRowDelete(pParse, pTab, iCur, iRowid, count, pTrigger, OE_Default);\r\n    }\r\n\r\n    /* End of the delete loop */\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr);\r\n    sqlite3VdbeResolveLabel(v, end);\r\n\r\n    /* Close the cursors open on the table and its indexes. */\r\n    if( !isView && !IsVirtual(pTab) ){\r\n      for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){\r\n        sqlite3VdbeAddOp2(v, OP_Close, iCur + i, pIdx->tnum);\r\n      }\r\n      sqlite3VdbeAddOp1(v, OP_Close, iCur);\r\n    }\r\n  }\r\n\r\n  /* Update the sqlite_sequence table by storing the content of the\r\n  ** maximum rowid counter values recorded while inserting into\r\n  ** autoincrement tables.\r\n  */\r\n  if( pParse->nested==0 && pParse->pTriggerTab==0 ){\r\n    sqlite3AutoincrementEnd(pParse);\r\n  }\r\n\r\n  /* Return the number of rows that were deleted. If this routine is \r\n  ** generating code because of a call to sqlite3NestedParse(), do not\r\n  ** invoke the callback function.\r\n  */\r\n  if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"rows deleted\", SQLITE_STATIC);\r\n  }\r\n\r\ndelete_from_cleanup:\r\n  sqlite3AuthContextPop(&sContext);\r\n  sqlite3SrcListDelete(db, pTabList);\r\n  sqlite3ExprDelete(db, pWhere);\r\n  return;\r\n}\r\n/* Make sure \"isView\" and other macros defined above are undefined. Otherwise\r\n** thely may interfere with compilation of other functions in this file\r\n** (or in another file, if this file becomes part of the amalgamation).  */\r\n#ifdef isView\r\n #undef isView\r\n#endif\r\n#ifdef pTrigger\r\n #undef pTrigger\r\n#endif\r\n\r\n/*\r\n** This routine generates VDBE code that causes a single row of a\r\n** single table to be deleted.\r\n**\r\n** The VDBE must be in a particular state when this routine is called.\r\n** These are the requirements:\r\n**\r\n**   1.  A read/write cursor pointing to pTab, the table containing the row\r\n**       to be deleted, must be opened as cursor number $iCur.\r\n**\r\n**   2.  Read/write cursors for all indices of pTab must be open as\r\n**       cursor number base+i for the i-th index.\r\n**\r\n**   3.  The record number of the row to be deleted must be stored in\r\n**       memory cell iRowid.\r\n**\r\n** This routine generates code to remove both the table record and all \r\n** index entries that point to that record.\r\n*/\r\nSQLITE_PRIVATE void sqlite3GenerateRowDelete(\r\n  Parse *pParse,     /* Parsing context */\r\n  Table *pTab,       /* Table containing the row to be deleted */\r\n  int iCur,          /* Cursor number for the table */\r\n  int iRowid,        /* Memory cell that contains the rowid to delete */\r\n  int count,         /* If non-zero, increment the row change counter */\r\n  Trigger *pTrigger, /* List of triggers to (potentially) fire */\r\n  int onconf         /* Default ON CONFLICT policy for triggers */\r\n){\r\n  Vdbe *v = pParse->pVdbe;        /* Vdbe */\r\n  int iOld = 0;                   /* First register in OLD.* array */\r\n  int iLabel;                     /* Label resolved to end of generated code */\r\n\r\n  /* Vdbe is guaranteed to have been allocated by this stage. */\r\n  assert( v );\r\n\r\n  /* Seek cursor iCur to the row to delete. If this row no longer exists \r\n  ** (this can happen if a trigger program has already deleted it), do\r\n  ** not attempt to delete it or fire any DELETE triggers.  */\r\n  iLabel = sqlite3VdbeMakeLabel(v);\r\n  sqlite3VdbeAddOp3(v, OP_NotExists, iCur, iLabel, iRowid);\r\n \r\n  /* If there are any triggers to fire, allocate a range of registers to\r\n  ** use for the old.* references in the triggers.  */\r\n  if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){\r\n    u32 mask;                     /* Mask of OLD.* columns in use */\r\n    int iCol;                     /* Iterator used while populating OLD.* */\r\n\r\n    /* TODO: Could use temporary registers here. Also could attempt to\r\n    ** avoid copying the contents of the rowid register.  */\r\n    mask = sqlite3TriggerColmask(\r\n        pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf\r\n    );\r\n    mask |= sqlite3FkOldmask(pParse, pTab);\r\n    iOld = pParse->nMem+1;\r\n    pParse->nMem += (1 + pTab->nCol);\r\n\r\n    /* Populate the OLD.* pseudo-table register array. These values will be \r\n    ** used by any BEFORE and AFTER triggers that exist.  */\r\n    sqlite3VdbeAddOp2(v, OP_Copy, iRowid, iOld);\r\n    for(iCol=0; iCol<pTab->nCol; iCol++){\r\n      if( mask==0xffffffff || mask&(1<<iCol) ){\r\n        sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, iOld+iCol+1);\r\n      }\r\n    }\r\n\r\n    /* Invoke BEFORE DELETE trigger programs. */\r\n    sqlite3CodeRowTrigger(pParse, pTrigger, \r\n        TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel\r\n    );\r\n\r\n    /* Seek the cursor to the row to be deleted again. It may be that\r\n    ** the BEFORE triggers coded above have already removed the row\r\n    ** being deleted. Do not attempt to delete the row a second time, and \r\n    ** do not fire AFTER triggers.  */\r\n    sqlite3VdbeAddOp3(v, OP_NotExists, iCur, iLabel, iRowid);\r\n\r\n    /* Do FK processing. This call checks that any FK constraints that\r\n    ** refer to this table (i.e. constraints attached to other tables) \r\n    ** are not violated by deleting this row.  */\r\n    sqlite3FkCheck(pParse, pTab, iOld, 0);\r\n  }\r\n\r\n  /* Delete the index and table entries. Skip this step if pTab is really\r\n  ** a view (in which case the only effect of the DELETE statement is to\r\n  ** fire the INSTEAD OF triggers).  */ \r\n  if( pTab->pSelect==0 ){\r\n    sqlite3GenerateRowIndexDelete(pParse, pTab, iCur, 0);\r\n    sqlite3VdbeAddOp2(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0));\r\n    if( count ){\r\n      sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);\r\n    }\r\n  }\r\n\r\n  /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to\r\n  ** handle rows (possibly in other tables) that refer via a foreign key\r\n  ** to the row just deleted. */ \r\n  sqlite3FkActions(pParse, pTab, 0, iOld);\r\n\r\n  /* Invoke AFTER DELETE trigger programs. */\r\n  sqlite3CodeRowTrigger(pParse, pTrigger, \r\n      TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel\r\n  );\r\n\r\n  /* Jump here if the row had already been deleted before any BEFORE\r\n  ** trigger programs were invoked. Or if a trigger program throws a \r\n  ** RAISE(IGNORE) exception.  */\r\n  sqlite3VdbeResolveLabel(v, iLabel);\r\n}\r\n\r\n/*\r\n** This routine generates VDBE code that causes the deletion of all\r\n** index entries associated with a single row of a single table.\r\n**\r\n** The VDBE must be in a particular state when this routine is called.\r\n** These are the requirements:\r\n**\r\n**   1.  A read/write cursor pointing to pTab, the table containing the row\r\n**       to be deleted, must be opened as cursor number \"iCur\".\r\n**\r\n**   2.  Read/write cursors for all indices of pTab must be open as\r\n**       cursor number iCur+i for the i-th index.\r\n**\r\n**   3.  The \"iCur\" cursor must be pointing to the row that is to be\r\n**       deleted.\r\n*/\r\nSQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(\r\n  Parse *pParse,     /* Parsing and code generating context */\r\n  Table *pTab,       /* Table containing the row to be deleted */\r\n  int iCur,          /* Cursor number for the table */\r\n  int *aRegIdx       /* Only delete if aRegIdx!=0 && aRegIdx[i]>0 */\r\n){\r\n  int i;\r\n  Index *pIdx;\r\n  int r1;\r\n\r\n  for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){\r\n    if( aRegIdx!=0 && aRegIdx[i-1]==0 ) continue;\r\n    r1 = sqlite3GenerateIndexKey(pParse, pIdx, iCur, 0, 0);\r\n    sqlite3VdbeAddOp3(pParse->pVdbe, OP_IdxDelete, iCur+i, r1,pIdx->nColumn+1);\r\n  }\r\n}\r\n\r\n/*\r\n** Generate code that will assemble an index key and put it in register\r\n** regOut.  The key with be for index pIdx which is an index on pTab.\r\n** iCur is the index of a cursor open on the pTab table and pointing to\r\n** the entry that needs indexing.\r\n**\r\n** Return a register number which is the first in a block of\r\n** registers that holds the elements of the index key.  The\r\n** block of registers has already been deallocated by the time\r\n** this routine returns.\r\n*/\r\nSQLITE_PRIVATE int sqlite3GenerateIndexKey(\r\n  Parse *pParse,     /* Parsing context */\r\n  Index *pIdx,       /* The index for which to generate a key */\r\n  int iCur,          /* Cursor number for the pIdx->pTable table */\r\n  int regOut,        /* Write the new index key to this register */\r\n  int doMakeRec      /* Run the OP_MakeRecord instruction if true */\r\n){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int j;\r\n  Table *pTab = pIdx->pTable;\r\n  int regBase;\r\n  int nCol;\r\n\r\n  nCol = pIdx->nColumn;\r\n  regBase = sqlite3GetTempRange(pParse, nCol+1);\r\n  sqlite3VdbeAddOp2(v, OP_Rowid, iCur, regBase+nCol);\r\n  for(j=0; j<nCol; j++){\r\n    int idx = pIdx->aiColumn[j];\r\n    if( idx==pTab->iPKey ){\r\n      sqlite3VdbeAddOp2(v, OP_SCopy, regBase+nCol, regBase+j);\r\n    }else{\r\n      sqlite3VdbeAddOp3(v, OP_Column, iCur, idx, regBase+j);\r\n      sqlite3ColumnDefault(v, pTab, idx, -1);\r\n    }\r\n  }\r\n  if( doMakeRec ){\r\n    const char *zAff;\r\n    if( pTab->pSelect || (pParse->db->flags & SQLITE_IdxRealAsInt)!=0 ){\r\n      zAff = 0;\r\n    }else{\r\n      zAff = sqlite3IndexAffinityStr(v, pIdx);\r\n    }\r\n    sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol+1, regOut);\r\n    sqlite3VdbeChangeP4(v, -1, zAff, P4_TRANSIENT);\r\n  }\r\n  sqlite3ReleaseTempRange(pParse, regBase, nCol+1);\r\n  return regBase;\r\n}\r\n\r\n/************** End of delete.c **********************************************/\r\n/************** Begin file func.c ********************************************/\r\n/*\r\n** 2002 February 23\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the C functions that implement various SQL\r\n** functions of SQLite.  \r\n**\r\n** There is only one exported symbol in this file - the function\r\n** sqliteRegisterBuildinFunctions() found at the bottom of the file.\r\n** All other code has file scope.\r\n*/\r\n/* #include <stdlib.h> */\r\n/* #include <assert.h> */\r\n\r\n/*\r\n** Return the collating function associated with a function.\r\n*/\r\nstatic CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){\r\n  return context->pColl;\r\n}\r\n\r\n/*\r\n** Indicate that the accumulator load should be skipped on this\r\n** iteration of the aggregate loop.\r\n*/\r\nstatic void sqlite3SkipAccumulatorLoad(sqlite3_context *context){\r\n  context->skipFlag = 1;\r\n}\r\n\r\n/*\r\n** Implementation of the non-aggregate min() and max() functions\r\n*/\r\nstatic void minmaxFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int i;\r\n  int mask;    /* 0 for min() or 0xffffffff for max() */\r\n  int iBest;\r\n  CollSeq *pColl;\r\n\r\n  assert( argc>1 );\r\n  mask = sqlite3_user_data(context)==0 ? 0 : -1;\r\n  pColl = sqlite3GetFuncCollSeq(context);\r\n  assert( pColl );\r\n  assert( mask==-1 || mask==0 );\r\n  iBest = 0;\r\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;\r\n  for(i=1; i<argc; i++){\r\n    if( sqlite3_value_type(argv[i])==SQLITE_NULL ) return;\r\n    if( (sqlite3MemCompare(argv[iBest], argv[i], pColl)^mask)>=0 ){\r\n      testcase( mask==0 );\r\n      iBest = i;\r\n    }\r\n  }\r\n  sqlite3_result_value(context, argv[iBest]);\r\n}\r\n\r\n/*\r\n** Return the type of the argument.\r\n*/\r\nstatic void typeofFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  const char *z = 0;\r\n  UNUSED_PARAMETER(NotUsed);\r\n  switch( sqlite3_value_type(argv[0]) ){\r\n    case SQLITE_INTEGER: z = \"integer\"; break;\r\n    case SQLITE_TEXT:    z = \"text\";    break;\r\n    case SQLITE_FLOAT:   z = \"real\";    break;\r\n    case SQLITE_BLOB:    z = \"blob\";    break;\r\n    default:             z = \"null\";    break;\r\n  }\r\n  sqlite3_result_text(context, z, -1, SQLITE_STATIC);\r\n}\r\n\r\n\r\n/*\r\n** Implementation of the length() function\r\n*/\r\nstatic void lengthFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int len;\r\n\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  switch( sqlite3_value_type(argv[0]) ){\r\n    case SQLITE_BLOB:\r\n    case SQLITE_INTEGER:\r\n    case SQLITE_FLOAT: {\r\n      sqlite3_result_int(context, sqlite3_value_bytes(argv[0]));\r\n      break;\r\n    }\r\n    case SQLITE_TEXT: {\r\n      const unsigned char *z = sqlite3_value_text(argv[0]);\r\n      if( z==0 ) return;\r\n      len = 0;\r\n      while( *z ){\r\n        len++;\r\n        SQLITE_SKIP_UTF8(z);\r\n      }\r\n      sqlite3_result_int(context, len);\r\n      break;\r\n    }\r\n    default: {\r\n      sqlite3_result_null(context);\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the abs() function.\r\n**\r\n** IMP: R-23979-26855 The abs(X) function returns the absolute value of\r\n** the numeric argument X. \r\n*/\r\nstatic void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  switch( sqlite3_value_type(argv[0]) ){\r\n    case SQLITE_INTEGER: {\r\n      i64 iVal = sqlite3_value_int64(argv[0]);\r\n      if( iVal<0 ){\r\n        if( (iVal<<1)==0 ){\r\n          /* IMP: R-35460-15084 If X is the integer -9223372036854775807 then\r\n          ** abs(X) throws an integer overflow error since there is no\r\n          ** equivalent positive 64-bit two complement value. */\r\n          sqlite3_result_error(context, \"integer overflow\", -1);\r\n          return;\r\n        }\r\n        iVal = -iVal;\r\n      } \r\n      sqlite3_result_int64(context, iVal);\r\n      break;\r\n    }\r\n    case SQLITE_NULL: {\r\n      /* IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. */\r\n      sqlite3_result_null(context);\r\n      break;\r\n    }\r\n    default: {\r\n      /* Because sqlite3_value_double() returns 0.0 if the argument is not\r\n      ** something that can be converted into a number, we have:\r\n      ** IMP: R-57326-31541 Abs(X) return 0.0 if X is a string or blob that\r\n      ** cannot be converted to a numeric value. \r\n      */\r\n      double rVal = sqlite3_value_double(argv[0]);\r\n      if( rVal<0 ) rVal = -rVal;\r\n      sqlite3_result_double(context, rVal);\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the substr() function.\r\n**\r\n** substr(x,p1,p2)  returns p2 characters of x[] beginning with p1.\r\n** p1 is 1-indexed.  So substr(x,1,1) returns the first character\r\n** of x.  If x is text, then we actually count UTF-8 characters.\r\n** If x is a blob, then we count bytes.\r\n**\r\n** If p1 is negative, then we begin abs(p1) from the end of x[].\r\n**\r\n** If p2 is negative, return the p2 characters preceeding p1.\r\n*/\r\nstatic void substrFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  const unsigned char *z;\r\n  const unsigned char *z2;\r\n  int len;\r\n  int p0type;\r\n  i64 p1, p2;\r\n  int negP2 = 0;\r\n\r\n  assert( argc==3 || argc==2 );\r\n  if( sqlite3_value_type(argv[1])==SQLITE_NULL\r\n   || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL)\r\n  ){\r\n    return;\r\n  }\r\n  p0type = sqlite3_value_type(argv[0]);\r\n  p1 = sqlite3_value_int(argv[1]);\r\n  if( p0type==SQLITE_BLOB ){\r\n    len = sqlite3_value_bytes(argv[0]);\r\n    z = sqlite3_value_blob(argv[0]);\r\n    if( z==0 ) return;\r\n    assert( len==sqlite3_value_bytes(argv[0]) );\r\n  }else{\r\n    z = sqlite3_value_text(argv[0]);\r\n    if( z==0 ) return;\r\n    len = 0;\r\n    if( p1<0 ){\r\n      for(z2=z; *z2; len++){\r\n        SQLITE_SKIP_UTF8(z2);\r\n      }\r\n    }\r\n  }\r\n  if( argc==3 ){\r\n    p2 = sqlite3_value_int(argv[2]);\r\n    if( p2<0 ){\r\n      p2 = -p2;\r\n      negP2 = 1;\r\n    }\r\n  }else{\r\n    p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH];\r\n  }\r\n  if( p1<0 ){\r\n    p1 += len;\r\n    if( p1<0 ){\r\n      p2 += p1;\r\n      if( p2<0 ) p2 = 0;\r\n      p1 = 0;\r\n    }\r\n  }else if( p1>0 ){\r\n    p1--;\r\n  }else if( p2>0 ){\r\n    p2--;\r\n  }\r\n  if( negP2 ){\r\n    p1 -= p2;\r\n    if( p1<0 ){\r\n      p2 += p1;\r\n      p1 = 0;\r\n    }\r\n  }\r\n  assert( p1>=0 && p2>=0 );\r\n  if( p0type!=SQLITE_BLOB ){\r\n    while( *z && p1 ){\r\n      SQLITE_SKIP_UTF8(z);\r\n      p1--;\r\n    }\r\n    for(z2=z; *z2 && p2; p2--){\r\n      SQLITE_SKIP_UTF8(z2);\r\n    }\r\n    sqlite3_result_text(context, (char*)z, (int)(z2-z), SQLITE_TRANSIENT);\r\n  }else{\r\n    if( p1+p2>len ){\r\n      p2 = len-p1;\r\n      if( p2<0 ) p2 = 0;\r\n    }\r\n    sqlite3_result_blob(context, (char*)&z[p1], (int)p2, SQLITE_TRANSIENT);\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the round() function\r\n*/\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\nstatic void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  int n = 0;\r\n  double r;\r\n  char *zBuf;\r\n  assert( argc==1 || argc==2 );\r\n  if( argc==2 ){\r\n    if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;\r\n    n = sqlite3_value_int(argv[1]);\r\n    if( n>30 ) n = 30;\r\n    if( n<0 ) n = 0;\r\n  }\r\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;\r\n  r = sqlite3_value_double(argv[0]);\r\n  /* If Y==0 and X will fit in a 64-bit int,\r\n  ** handle the rounding directly,\r\n  ** otherwise use printf.\r\n  */\r\n  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){\r\n    r = (double)((sqlite_int64)(r+0.5));\r\n  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){\r\n    r = -(double)((sqlite_int64)((-r)+0.5));\r\n  }else{\r\n    zBuf = sqlite3_mprintf(\"%.*f\",n,r);\r\n    if( zBuf==0 ){\r\n      sqlite3_result_error_nomem(context);\r\n      return;\r\n    }\r\n    sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);\r\n    sqlite3_free(zBuf);\r\n  }\r\n  sqlite3_result_double(context, r);\r\n}\r\n#endif\r\n\r\n/*\r\n** Allocate nByte bytes of space using sqlite3_malloc(). If the\r\n** allocation fails, call sqlite3_result_error_nomem() to notify\r\n** the database handle that malloc() has failed and return NULL.\r\n** If nByte is larger than the maximum string or blob length, then\r\n** raise an SQLITE_TOOBIG exception and return NULL.\r\n*/\r\nstatic void *contextMalloc(sqlite3_context *context, i64 nByte){\r\n  char *z;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  assert( nByte>0 );\r\n  testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH] );\r\n  testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH]+1 );\r\n  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    sqlite3_result_error_toobig(context);\r\n    z = 0;\r\n  }else{\r\n    z = sqlite3Malloc((int)nByte);\r\n    if( !z ){\r\n      sqlite3_result_error_nomem(context);\r\n    }\r\n  }\r\n  return z;\r\n}\r\n\r\n/*\r\n** Implementation of the upper() and lower() SQL functions.\r\n*/\r\nstatic void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  char *z1;\r\n  const char *z2;\r\n  int i, n;\r\n  UNUSED_PARAMETER(argc);\r\n  z2 = (char*)sqlite3_value_text(argv[0]);\r\n  n = sqlite3_value_bytes(argv[0]);\r\n  /* Verify that the call to _bytes() does not invalidate the _text() pointer */\r\n  assert( z2==(char*)sqlite3_value_text(argv[0]) );\r\n  if( z2 ){\r\n    z1 = contextMalloc(context, ((i64)n)+1);\r\n    if( z1 ){\r\n      for(i=0; i<n; i++){\r\n        z1[i] = (char)sqlite3Toupper(z2[i]);\r\n      }\r\n      sqlite3_result_text(context, z1, n, sqlite3_free);\r\n    }\r\n  }\r\n}\r\nstatic void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  char *z1;\r\n  const char *z2;\r\n  int i, n;\r\n  UNUSED_PARAMETER(argc);\r\n  z2 = (char*)sqlite3_value_text(argv[0]);\r\n  n = sqlite3_value_bytes(argv[0]);\r\n  /* Verify that the call to _bytes() does not invalidate the _text() pointer */\r\n  assert( z2==(char*)sqlite3_value_text(argv[0]) );\r\n  if( z2 ){\r\n    z1 = contextMalloc(context, ((i64)n)+1);\r\n    if( z1 ){\r\n      for(i=0; i<n; i++){\r\n        z1[i] = sqlite3Tolower(z2[i]);\r\n      }\r\n      sqlite3_result_text(context, z1, n, sqlite3_free);\r\n    }\r\n  }\r\n}\r\n\r\n\r\n#if 0  /* This function is never used. */\r\n/*\r\n** The COALESCE() and IFNULL() functions used to be implemented as shown\r\n** here.  But now they are implemented as VDBE code so that unused arguments\r\n** do not have to be computed.  This legacy implementation is retained as\r\n** comment.\r\n*/\r\n/*\r\n** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  \r\n** All three do the same thing.  They return the first non-NULL\r\n** argument.\r\n*/\r\nstatic void ifnullFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int i;\r\n  for(i=0; i<argc; i++){\r\n    if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){\r\n      sqlite3_result_value(context, argv[i]);\r\n      break;\r\n    }\r\n  }\r\n}\r\n#endif /* NOT USED */\r\n#define ifnullFunc versionFunc   /* Substitute function - never called */\r\n\r\n/*\r\n** Implementation of random().  Return a random integer.  \r\n*/\r\nstatic void randomFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  sqlite_int64 r;\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  sqlite3_randomness(sizeof(r), &r);\r\n  if( r<0 ){\r\n    /* We need to prevent a random number of 0x8000000000000000 \r\n    ** (or -9223372036854775808) since when you do abs() of that\r\n    ** number of you get the same value back again.  To do this\r\n    ** in a way that is testable, mask the sign bit off of negative\r\n    ** values, resulting in a positive value.  Then take the \r\n    ** 2s complement of that positive value.  The end result can\r\n    ** therefore be no less than -9223372036854775807.\r\n    */\r\n    r = -(r & LARGEST_INT64);\r\n  }\r\n  sqlite3_result_int64(context, r);\r\n}\r\n\r\n/*\r\n** Implementation of randomblob(N).  Return a random blob\r\n** that is N bytes long.\r\n*/\r\nstatic void randomBlob(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int n;\r\n  unsigned char *p;\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  n = sqlite3_value_int(argv[0]);\r\n  if( n<1 ){\r\n    n = 1;\r\n  }\r\n  p = contextMalloc(context, n);\r\n  if( p ){\r\n    sqlite3_randomness(n, p);\r\n    sqlite3_result_blob(context, (char*)p, n, sqlite3_free);\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the last_insert_rowid() SQL function.  The return\r\n** value is the same as the sqlite3_last_insert_rowid() API function.\r\n*/\r\nstatic void last_insert_rowid(\r\n  sqlite3_context *context, \r\n  int NotUsed, \r\n  sqlite3_value **NotUsed2\r\n){\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  /* IMP: R-51513-12026 The last_insert_rowid() SQL function is a\r\n  ** wrapper around the sqlite3_last_insert_rowid() C/C++ interface\r\n  ** function. */\r\n  sqlite3_result_int64(context, sqlite3_last_insert_rowid(db));\r\n}\r\n\r\n/*\r\n** Implementation of the changes() SQL function.\r\n**\r\n** IMP: R-62073-11209 The changes() SQL function is a wrapper\r\n** around the sqlite3_changes() C/C++ function and hence follows the same\r\n** rules for counting changes.\r\n*/\r\nstatic void changes(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  sqlite3_result_int(context, sqlite3_changes(db));\r\n}\r\n\r\n/*\r\n** Implementation of the total_changes() SQL function.  The return value is\r\n** the same as the sqlite3_total_changes() API function.\r\n*/\r\nstatic void total_changes(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  /* IMP: R-52756-41993 This function is a wrapper around the\r\n  ** sqlite3_total_changes() C/C++ interface. */\r\n  sqlite3_result_int(context, sqlite3_total_changes(db));\r\n}\r\n\r\n/*\r\n** A structure defining how to do GLOB-style comparisons.\r\n*/\r\nstruct compareInfo {\r\n  u8 matchAll;\r\n  u8 matchOne;\r\n  u8 matchSet;\r\n  u8 noCase;\r\n};\r\n\r\n/*\r\n** For LIKE and GLOB matching on EBCDIC machines, assume that every\r\n** character is exactly one byte in size.  Also, all characters are\r\n** able to participate in upper-case-to-lower-case mappings in EBCDIC\r\n** whereas only characters less than 0x80 do in ASCII.\r\n*/\r\n#if defined(SQLITE_EBCDIC)\r\n# define sqlite3Utf8Read(A,C)  (*(A++))\r\n# define GlogUpperToLower(A)   A = sqlite3UpperToLower[A]\r\n#else\r\n# define GlogUpperToLower(A)   if( !((A)&~0x7f) ){ A = sqlite3UpperToLower[A]; }\r\n#endif\r\n\r\nstatic const struct compareInfo globInfo = { '*', '?', '[', 0 };\r\n/* The correct SQL-92 behavior is for the LIKE operator to ignore\r\n** case.  Thus  'a' LIKE 'A' would be true. */\r\nstatic const struct compareInfo likeInfoNorm = { '%', '_',   0, 1 };\r\n/* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator\r\n** is case sensitive causing 'a' LIKE 'A' to be false */\r\nstatic const struct compareInfo likeInfoAlt = { '%', '_',   0, 0 };\r\n\r\n/*\r\n** Compare two UTF-8 strings for equality where the first string can\r\n** potentially be a \"glob\" expression.  Return true (1) if they\r\n** are the same and false (0) if they are different.\r\n**\r\n** Globbing rules:\r\n**\r\n**      '*'       Matches any sequence of zero or more characters.\r\n**\r\n**      '?'       Matches exactly one character.\r\n**\r\n**     [...]      Matches one character from the enclosed list of\r\n**                characters.\r\n**\r\n**     [^...]     Matches one character not in the enclosed list.\r\n**\r\n** With the [...] and [^...] matching, a ']' character can be included\r\n** in the list by making it the first character after '[' or '^'.  A\r\n** range of characters can be specified using '-'.  Example:\r\n** \"[a-z]\" matches any single lower-case letter.  To match a '-', make\r\n** it the last character in the list.\r\n**\r\n** This routine is usually quick, but can be N**2 in the worst case.\r\n**\r\n** Hints: to match '*' or '?', put them in \"[]\".  Like this:\r\n**\r\n**         abc[*]xyz        Matches \"abc*xyz\" only\r\n*/\r\nstatic int patternCompare(\r\n  const u8 *zPattern,              /* The glob pattern */\r\n  const u8 *zString,               /* The string to compare against the glob */\r\n  const struct compareInfo *pInfo, /* Information about how to do the compare */\r\n  u32 esc                          /* The escape character */\r\n){\r\n  u32 c, c2;\r\n  int invert;\r\n  int seen;\r\n  u8 matchOne = pInfo->matchOne;\r\n  u8 matchAll = pInfo->matchAll;\r\n  u8 matchSet = pInfo->matchSet;\r\n  u8 noCase = pInfo->noCase; \r\n  int prevEscape = 0;     /* True if the previous character was 'escape' */\r\n\r\n  while( (c = sqlite3Utf8Read(zPattern,&zPattern))!=0 ){\r\n    if( !prevEscape && c==matchAll ){\r\n      while( (c=sqlite3Utf8Read(zPattern,&zPattern)) == matchAll\r\n               || c == matchOne ){\r\n        if( c==matchOne && sqlite3Utf8Read(zString, &zString)==0 ){\r\n          return 0;\r\n        }\r\n      }\r\n      if( c==0 ){\r\n        return 1;\r\n      }else if( c==esc ){\r\n        c = sqlite3Utf8Read(zPattern, &zPattern);\r\n        if( c==0 ){\r\n          return 0;\r\n        }\r\n      }else if( c==matchSet ){\r\n        assert( esc==0 );         /* This is GLOB, not LIKE */\r\n        assert( matchSet<0x80 );  /* '[' is a single-byte character */\r\n        while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){\r\n          SQLITE_SKIP_UTF8(zString);\r\n        }\r\n        return *zString!=0;\r\n      }\r\n      while( (c2 = sqlite3Utf8Read(zString,&zString))!=0 ){\r\n        if( noCase ){\r\n          GlogUpperToLower(c2);\r\n          GlogUpperToLower(c);\r\n          while( c2 != 0 && c2 != c ){\r\n            c2 = sqlite3Utf8Read(zString, &zString);\r\n            GlogUpperToLower(c2);\r\n          }\r\n        }else{\r\n          while( c2 != 0 && c2 != c ){\r\n            c2 = sqlite3Utf8Read(zString, &zString);\r\n          }\r\n        }\r\n        if( c2==0 ) return 0;\r\n        if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;\r\n      }\r\n      return 0;\r\n    }else if( !prevEscape && c==matchOne ){\r\n      if( sqlite3Utf8Read(zString, &zString)==0 ){\r\n        return 0;\r\n      }\r\n    }else if( c==matchSet ){\r\n      u32 prior_c = 0;\r\n      assert( esc==0 );    /* This only occurs for GLOB, not LIKE */\r\n      seen = 0;\r\n      invert = 0;\r\n      c = sqlite3Utf8Read(zString, &zString);\r\n      if( c==0 ) return 0;\r\n      c2 = sqlite3Utf8Read(zPattern, &zPattern);\r\n      if( c2=='^' ){\r\n        invert = 1;\r\n        c2 = sqlite3Utf8Read(zPattern, &zPattern);\r\n      }\r\n      if( c2==']' ){\r\n        if( c==']' ) seen = 1;\r\n        c2 = sqlite3Utf8Read(zPattern, &zPattern);\r\n      }\r\n      while( c2 && c2!=']' ){\r\n        if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){\r\n          c2 = sqlite3Utf8Read(zPattern, &zPattern);\r\n          if( c>=prior_c && c<=c2 ) seen = 1;\r\n          prior_c = 0;\r\n        }else{\r\n          if( c==c2 ){\r\n            seen = 1;\r\n          }\r\n          prior_c = c2;\r\n        }\r\n        c2 = sqlite3Utf8Read(zPattern, &zPattern);\r\n      }\r\n      if( c2==0 || (seen ^ invert)==0 ){\r\n        return 0;\r\n      }\r\n    }else if( esc==c && !prevEscape ){\r\n      prevEscape = 1;\r\n    }else{\r\n      c2 = sqlite3Utf8Read(zString, &zString);\r\n      if( noCase ){\r\n        GlogUpperToLower(c);\r\n        GlogUpperToLower(c2);\r\n      }\r\n      if( c!=c2 ){\r\n        return 0;\r\n      }\r\n      prevEscape = 0;\r\n    }\r\n  }\r\n  return *zString==0;\r\n}\r\n\r\n/*\r\n** Count the number of times that the LIKE operator (or GLOB which is\r\n** just a variation of LIKE) gets called.  This is used for testing\r\n** only.\r\n*/\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_like_count = 0;\r\n#endif\r\n\r\n\r\n/*\r\n** Implementation of the like() SQL function.  This function implements\r\n** the build-in LIKE operator.  The first argument to the function is the\r\n** pattern and the second argument is the string.  So, the SQL statements:\r\n**\r\n**       A LIKE B\r\n**\r\n** is implemented as like(B,A).\r\n**\r\n** This same function (with a different compareInfo structure) computes\r\n** the GLOB operator.\r\n*/\r\nstatic void likeFunc(\r\n  sqlite3_context *context, \r\n  int argc, \r\n  sqlite3_value **argv\r\n){\r\n  const unsigned char *zA, *zB;\r\n  u32 escape = 0;\r\n  int nPat;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n\r\n  zB = sqlite3_value_text(argv[0]);\r\n  zA = sqlite3_value_text(argv[1]);\r\n\r\n  /* Limit the length of the LIKE or GLOB pattern to avoid problems\r\n  ** of deep recursion and N*N behavior in patternCompare().\r\n  */\r\n  nPat = sqlite3_value_bytes(argv[0]);\r\n  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );\r\n  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );\r\n  if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){\r\n    sqlite3_result_error(context, \"LIKE or GLOB pattern too complex\", -1);\r\n    return;\r\n  }\r\n  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */\r\n\r\n  if( argc==3 ){\r\n    /* The escape character string must consist of a single UTF-8 character.\r\n    ** Otherwise, return an error.\r\n    */\r\n    const unsigned char *zEsc = sqlite3_value_text(argv[2]);\r\n    if( zEsc==0 ) return;\r\n    if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){\r\n      sqlite3_result_error(context, \r\n          \"ESCAPE expression must be a single character\", -1);\r\n      return;\r\n    }\r\n    escape = sqlite3Utf8Read(zEsc, &zEsc);\r\n  }\r\n  if( zA && zB ){\r\n    struct compareInfo *pInfo = sqlite3_user_data(context);\r\n#ifdef SQLITE_TEST\r\n    sqlite3_like_count++;\r\n#endif\r\n    \r\n    sqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape));\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the NULLIF(x,y) function.  The result is the first\r\n** argument if the arguments are different.  The result is NULL if the\r\n** arguments are equal to each other.\r\n*/\r\nstatic void nullifFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **argv\r\n){\r\n  CollSeq *pColl = sqlite3GetFuncCollSeq(context);\r\n  UNUSED_PARAMETER(NotUsed);\r\n  if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){\r\n    sqlite3_result_value(context, argv[0]);\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite_version() function.  The result is the version\r\n** of the SQLite library that is running.\r\n*/\r\nstatic void versionFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  /* IMP: R-48699-48617 This function is an SQL wrapper around the\r\n  ** sqlite3_libversion() C-interface. */\r\n  sqlite3_result_text(context, sqlite3_libversion(), -1, SQLITE_STATIC);\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite_source_id() function. The result is a string\r\n** that identifies the particular version of the source code used to build\r\n** SQLite.\r\n*/\r\nstatic void sourceidFunc(\r\n  sqlite3_context *context,\r\n  int NotUsed,\r\n  sqlite3_value **NotUsed2\r\n){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  /* IMP: R-24470-31136 This function is an SQL wrapper around the\r\n  ** sqlite3_sourceid() C interface. */\r\n  sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC);\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite_log() function.  This is a wrapper around\r\n** sqlite3_log().  The return value is NULL.  The function exists purely for\r\n** its side-effects.\r\n*/\r\nstatic void errlogFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  UNUSED_PARAMETER(argc);\r\n  UNUSED_PARAMETER(context);\r\n  sqlite3_log(sqlite3_value_int(argv[0]), \"%s\", sqlite3_value_text(argv[1]));\r\n}\r\n\r\n/*\r\n** Implementation of the sqlite_compileoption_used() function.\r\n** The result is an integer that identifies if the compiler option\r\n** was used to build SQLite.\r\n*/\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\nstatic void compileoptionusedFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  const char *zOptName;\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL\r\n  ** function is a wrapper around the sqlite3_compileoption_used() C/C++\r\n  ** function.\r\n  */\r\n  if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){\r\n    sqlite3_result_int(context, sqlite3_compileoption_used(zOptName));\r\n  }\r\n}\r\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\r\n\r\n/*\r\n** Implementation of the sqlite_compileoption_get() function. \r\n** The result is a string that identifies the compiler options \r\n** used to build SQLite.\r\n*/\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\nstatic void compileoptiongetFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int n;\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function\r\n  ** is a wrapper around the sqlite3_compileoption_get() C/C++ function.\r\n  */\r\n  n = sqlite3_value_int(argv[0]);\r\n  sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC);\r\n}\r\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\r\n\r\n/* Array for converting from half-bytes (nybbles) into ASCII hex\r\n** digits. */\r\nstatic const char hexdigits[] = {\r\n  '0', '1', '2', '3', '4', '5', '6', '7',\r\n  '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' \r\n};\r\n\r\n/*\r\n** EXPERIMENTAL - This is not an official function.  The interface may\r\n** change.  This function may disappear.  Do not write code that depends\r\n** on this function.\r\n**\r\n** Implementation of the QUOTE() function.  This function takes a single\r\n** argument.  If the argument is numeric, the return value is the same as\r\n** the argument.  If the argument is NULL, the return value is the string\r\n** \"NULL\".  Otherwise, the argument is enclosed in single quotes with\r\n** single-quote escapes.\r\n*/\r\nstatic void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  switch( sqlite3_value_type(argv[0]) ){\r\n    case SQLITE_INTEGER:\r\n    case SQLITE_FLOAT: {\r\n      sqlite3_result_value(context, argv[0]);\r\n      break;\r\n    }\r\n    case SQLITE_BLOB: {\r\n      char *zText = 0;\r\n      char const *zBlob = sqlite3_value_blob(argv[0]);\r\n      int nBlob = sqlite3_value_bytes(argv[0]);\r\n      assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */\r\n      zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); \r\n      if( zText ){\r\n        int i;\r\n        for(i=0; i<nBlob; i++){\r\n          zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];\r\n          zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];\r\n        }\r\n        zText[(nBlob*2)+2] = '\\'';\r\n        zText[(nBlob*2)+3] = '\\0';\r\n        zText[0] = 'X';\r\n        zText[1] = '\\'';\r\n        sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);\r\n        sqlite3_free(zText);\r\n      }\r\n      break;\r\n    }\r\n    case SQLITE_TEXT: {\r\n      int i,j;\r\n      u64 n;\r\n      const unsigned char *zArg = sqlite3_value_text(argv[0]);\r\n      char *z;\r\n\r\n      if( zArg==0 ) return;\r\n      for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\\'' ) n++; }\r\n      z = contextMalloc(context, ((i64)i)+((i64)n)+3);\r\n      if( z ){\r\n        z[0] = '\\'';\r\n        for(i=0, j=1; zArg[i]; i++){\r\n          z[j++] = zArg[i];\r\n          if( zArg[i]=='\\'' ){\r\n            z[j++] = '\\'';\r\n          }\r\n        }\r\n        z[j++] = '\\'';\r\n        z[j] = 0;\r\n        sqlite3_result_text(context, z, j, sqlite3_free);\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      assert( sqlite3_value_type(argv[0])==SQLITE_NULL );\r\n      sqlite3_result_text(context, \"NULL\", 4, SQLITE_STATIC);\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** The hex() function.  Interpret the argument as a blob.  Return\r\n** a hexadecimal rendering as text.\r\n*/\r\nstatic void hexFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int i, n;\r\n  const unsigned char *pBlob;\r\n  char *zHex, *z;\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  pBlob = sqlite3_value_blob(argv[0]);\r\n  n = sqlite3_value_bytes(argv[0]);\r\n  assert( pBlob==sqlite3_value_blob(argv[0]) );  /* No encoding change */\r\n  z = zHex = contextMalloc(context, ((i64)n)*2 + 1);\r\n  if( zHex ){\r\n    for(i=0; i<n; i++, pBlob++){\r\n      unsigned char c = *pBlob;\r\n      *(z++) = hexdigits[(c>>4)&0xf];\r\n      *(z++) = hexdigits[c&0xf];\r\n    }\r\n    *z = 0;\r\n    sqlite3_result_text(context, zHex, n*2, sqlite3_free);\r\n  }\r\n}\r\n\r\n/*\r\n** The zeroblob(N) function returns a zero-filled blob of size N bytes.\r\n*/\r\nstatic void zeroblobFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  i64 n;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  n = sqlite3_value_int64(argv[0]);\r\n  testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH] );\r\n  testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH]+1 );\r\n  if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n    sqlite3_result_error_toobig(context);\r\n  }else{\r\n    sqlite3_result_zeroblob(context, (int)n); /* IMP: R-00293-64994 */\r\n  }\r\n}\r\n\r\n/*\r\n** The replace() function.  Three arguments are all strings: call\r\n** them A, B, and C. The result is also a string which is derived\r\n** from A by replacing every occurance of B with C.  The match\r\n** must be exact.  Collating sequences are not used.\r\n*/\r\nstatic void replaceFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  const unsigned char *zStr;        /* The input string A */\r\n  const unsigned char *zPattern;    /* The pattern string B */\r\n  const unsigned char *zRep;        /* The replacement string C */\r\n  unsigned char *zOut;              /* The output */\r\n  int nStr;                /* Size of zStr */\r\n  int nPattern;            /* Size of zPattern */\r\n  int nRep;                /* Size of zRep */\r\n  i64 nOut;                /* Maximum size of zOut */\r\n  int loopLimit;           /* Last zStr[] that might match zPattern[] */\r\n  int i, j;                /* Loop counters */\r\n\r\n  assert( argc==3 );\r\n  UNUSED_PARAMETER(argc);\r\n  zStr = sqlite3_value_text(argv[0]);\r\n  if( zStr==0 ) return;\r\n  nStr = sqlite3_value_bytes(argv[0]);\r\n  assert( zStr==sqlite3_value_text(argv[0]) );  /* No encoding change */\r\n  zPattern = sqlite3_value_text(argv[1]);\r\n  if( zPattern==0 ){\r\n    assert( sqlite3_value_type(argv[1])==SQLITE_NULL\r\n            || sqlite3_context_db_handle(context)->mallocFailed );\r\n    return;\r\n  }\r\n  if( zPattern[0]==0 ){\r\n    assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );\r\n    sqlite3_result_value(context, argv[0]);\r\n    return;\r\n  }\r\n  nPattern = sqlite3_value_bytes(argv[1]);\r\n  assert( zPattern==sqlite3_value_text(argv[1]) );  /* No encoding change */\r\n  zRep = sqlite3_value_text(argv[2]);\r\n  if( zRep==0 ) return;\r\n  nRep = sqlite3_value_bytes(argv[2]);\r\n  assert( zRep==sqlite3_value_text(argv[2]) );\r\n  nOut = nStr + 1;\r\n  assert( nOut<SQLITE_MAX_LENGTH );\r\n  zOut = contextMalloc(context, (i64)nOut);\r\n  if( zOut==0 ){\r\n    return;\r\n  }\r\n  loopLimit = nStr - nPattern;  \r\n  for(i=j=0; i<=loopLimit; i++){\r\n    if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){\r\n      zOut[j++] = zStr[i];\r\n    }else{\r\n      u8 *zOld;\r\n      sqlite3 *db = sqlite3_context_db_handle(context);\r\n      nOut += nRep - nPattern;\r\n      testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );\r\n      testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );\r\n      if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){\r\n        sqlite3_result_error_toobig(context);\r\n        sqlite3_free(zOut);\r\n        return;\r\n      }\r\n      zOld = zOut;\r\n      zOut = sqlite3_realloc(zOut, (int)nOut);\r\n      if( zOut==0 ){\r\n        sqlite3_result_error_nomem(context);\r\n        sqlite3_free(zOld);\r\n        return;\r\n      }\r\n      memcpy(&zOut[j], zRep, nRep);\r\n      j += nRep;\r\n      i += nPattern-1;\r\n    }\r\n  }\r\n  assert( j+nStr-i+1==nOut );\r\n  memcpy(&zOut[j], &zStr[i], nStr-i);\r\n  j += nStr - i;\r\n  assert( j<=nOut );\r\n  zOut[j] = 0;\r\n  sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);\r\n}\r\n\r\n/*\r\n** Implementation of the TRIM(), LTRIM(), and RTRIM() functions.\r\n** The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both.\r\n*/\r\nstatic void trimFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  const unsigned char *zIn;         /* Input string */\r\n  const unsigned char *zCharSet;    /* Set of characters to trim */\r\n  int nIn;                          /* Number of bytes in input */\r\n  int flags;                        /* 1: trimleft  2: trimright  3: trim */\r\n  int i;                            /* Loop counter */\r\n  unsigned char *aLen = 0;          /* Length of each character in zCharSet */\r\n  unsigned char **azChar = 0;       /* Individual characters in zCharSet */\r\n  int nChar;                        /* Number of characters in zCharSet */\r\n\r\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ){\r\n    return;\r\n  }\r\n  zIn = sqlite3_value_text(argv[0]);\r\n  if( zIn==0 ) return;\r\n  nIn = sqlite3_value_bytes(argv[0]);\r\n  assert( zIn==sqlite3_value_text(argv[0]) );\r\n  if( argc==1 ){\r\n    static const unsigned char lenOne[] = { 1 };\r\n    static unsigned char * const azOne[] = { (u8*)\" \" };\r\n    nChar = 1;\r\n    aLen = (u8*)lenOne;\r\n    azChar = (unsigned char **)azOne;\r\n    zCharSet = 0;\r\n  }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){\r\n    return;\r\n  }else{\r\n    const unsigned char *z;\r\n    for(z=zCharSet, nChar=0; *z; nChar++){\r\n      SQLITE_SKIP_UTF8(z);\r\n    }\r\n    if( nChar>0 ){\r\n      azChar = contextMalloc(context, ((i64)nChar)*(sizeof(char*)+1));\r\n      if( azChar==0 ){\r\n        return;\r\n      }\r\n      aLen = (unsigned char*)&azChar[nChar];\r\n      for(z=zCharSet, nChar=0; *z; nChar++){\r\n        azChar[nChar] = (unsigned char *)z;\r\n        SQLITE_SKIP_UTF8(z);\r\n        aLen[nChar] = (u8)(z - azChar[nChar]);\r\n      }\r\n    }\r\n  }\r\n  if( nChar>0 ){\r\n    flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context));\r\n    if( flags & 1 ){\r\n      while( nIn>0 ){\r\n        int len = 0;\r\n        for(i=0; i<nChar; i++){\r\n          len = aLen[i];\r\n          if( len<=nIn && memcmp(zIn, azChar[i], len)==0 ) break;\r\n        }\r\n        if( i>=nChar ) break;\r\n        zIn += len;\r\n        nIn -= len;\r\n      }\r\n    }\r\n    if( flags & 2 ){\r\n      while( nIn>0 ){\r\n        int len = 0;\r\n        for(i=0; i<nChar; i++){\r\n          len = aLen[i];\r\n          if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break;\r\n        }\r\n        if( i>=nChar ) break;\r\n        nIn -= len;\r\n      }\r\n    }\r\n    if( zCharSet ){\r\n      sqlite3_free(azChar);\r\n    }\r\n  }\r\n  sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT);\r\n}\r\n\r\n\r\n/* IMP: R-25361-16150 This function is omitted from SQLite by default. It\r\n** is only available if the SQLITE_SOUNDEX compile-time option is used\r\n** when SQLite is built.\r\n*/\r\n#ifdef SQLITE_SOUNDEX\r\n/*\r\n** Compute the soundex encoding of a word.\r\n**\r\n** IMP: R-59782-00072 The soundex(X) function returns a string that is the\r\n** soundex encoding of the string X. \r\n*/\r\nstatic void soundexFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  char zResult[8];\r\n  const u8 *zIn;\r\n  int i, j;\r\n  static const unsigned char iCode[] = {\r\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,\r\n    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,\r\n    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,\r\n    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,\r\n  };\r\n  assert( argc==1 );\r\n  zIn = (u8*)sqlite3_value_text(argv[0]);\r\n  if( zIn==0 ) zIn = (u8*)\"\";\r\n  for(i=0; zIn[i] && !sqlite3Isalpha(zIn[i]); i++){}\r\n  if( zIn[i] ){\r\n    u8 prevcode = iCode[zIn[i]&0x7f];\r\n    zResult[0] = sqlite3Toupper(zIn[i]);\r\n    for(j=1; j<4 && zIn[i]; i++){\r\n      int code = iCode[zIn[i]&0x7f];\r\n      if( code>0 ){\r\n        if( code!=prevcode ){\r\n          prevcode = code;\r\n          zResult[j++] = code + '0';\r\n        }\r\n      }else{\r\n        prevcode = 0;\r\n      }\r\n    }\r\n    while( j<4 ){\r\n      zResult[j++] = '0';\r\n    }\r\n    zResult[j] = 0;\r\n    sqlite3_result_text(context, zResult, 4, SQLITE_TRANSIENT);\r\n  }else{\r\n    /* IMP: R-64894-50321 The string \"?000\" is returned if the argument\r\n    ** is NULL or contains no ASCII alphabetic characters. */\r\n    sqlite3_result_text(context, \"?000\", 4, SQLITE_STATIC);\r\n  }\r\n}\r\n#endif /* SQLITE_SOUNDEX */\r\n\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\n/*\r\n** A function that loads a shared-library extension then returns NULL.\r\n*/\r\nstatic void loadExt(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  const char *zFile = (const char *)sqlite3_value_text(argv[0]);\r\n  const char *zProc;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n  char *zErrMsg = 0;\r\n\r\n  if( argc==2 ){\r\n    zProc = (const char *)sqlite3_value_text(argv[1]);\r\n  }else{\r\n    zProc = 0;\r\n  }\r\n  if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){\r\n    sqlite3_result_error(context, zErrMsg, -1);\r\n    sqlite3_free(zErrMsg);\r\n  }\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** An instance of the following structure holds the context of a\r\n** sum() or avg() aggregate computation.\r\n*/\r\ntypedef struct SumCtx SumCtx;\r\nstruct SumCtx {\r\n  double rSum;      /* Floating point sum */\r\n  i64 iSum;         /* Integer sum */   \r\n  i64 cnt;          /* Number of elements summed */\r\n  u8 overflow;      /* True if integer overflow seen */\r\n  u8 approx;        /* True if non-integer value was input to the sum */\r\n};\r\n\r\n/*\r\n** Routines used to compute the sum, average, and total.\r\n**\r\n** The SUM() function follows the (broken) SQL standard which means\r\n** that it returns NULL if it sums over no inputs.  TOTAL returns\r\n** 0.0 in that case.  In addition, TOTAL always returns a float where\r\n** SUM might return an integer if it never encounters a floating point\r\n** value.  TOTAL never fails, but SUM might through an exception if\r\n** it overflows an integer.\r\n*/\r\nstatic void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  SumCtx *p;\r\n  int type;\r\n  assert( argc==1 );\r\n  UNUSED_PARAMETER(argc);\r\n  p = sqlite3_aggregate_context(context, sizeof(*p));\r\n  type = sqlite3_value_numeric_type(argv[0]);\r\n  if( p && type!=SQLITE_NULL ){\r\n    p->cnt++;\r\n    if( type==SQLITE_INTEGER ){\r\n      i64 v = sqlite3_value_int64(argv[0]);\r\n      p->rSum += v;\r\n      if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){\r\n        p->overflow = 1;\r\n      }\r\n    }else{\r\n      p->rSum += sqlite3_value_double(argv[0]);\r\n      p->approx = 1;\r\n    }\r\n  }\r\n}\r\nstatic void sumFinalize(sqlite3_context *context){\r\n  SumCtx *p;\r\n  p = sqlite3_aggregate_context(context, 0);\r\n  if( p && p->cnt>0 ){\r\n    if( p->overflow ){\r\n      sqlite3_result_error(context,\"integer overflow\",-1);\r\n    }else if( p->approx ){\r\n      sqlite3_result_double(context, p->rSum);\r\n    }else{\r\n      sqlite3_result_int64(context, p->iSum);\r\n    }\r\n  }\r\n}\r\nstatic void avgFinalize(sqlite3_context *context){\r\n  SumCtx *p;\r\n  p = sqlite3_aggregate_context(context, 0);\r\n  if( p && p->cnt>0 ){\r\n    sqlite3_result_double(context, p->rSum/(double)p->cnt);\r\n  }\r\n}\r\nstatic void totalFinalize(sqlite3_context *context){\r\n  SumCtx *p;\r\n  p = sqlite3_aggregate_context(context, 0);\r\n  /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\r\n  sqlite3_result_double(context, p ? p->rSum : (double)0);\r\n}\r\n\r\n/*\r\n** The following structure keeps track of state information for the\r\n** count() aggregate function.\r\n*/\r\ntypedef struct CountCtx CountCtx;\r\nstruct CountCtx {\r\n  i64 n;\r\n};\r\n\r\n/*\r\n** Routines to implement the count() aggregate function.\r\n*/\r\nstatic void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){\r\n  CountCtx *p;\r\n  p = sqlite3_aggregate_context(context, sizeof(*p));\r\n  if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){\r\n    p->n++;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n  /* The sqlite3_aggregate_count() function is deprecated.  But just to make\r\n  ** sure it still operates correctly, verify that its count agrees with our \r\n  ** internal count when using count(*) and when the total count can be\r\n  ** expressed as a 32-bit integer. */\r\n  assert( argc==1 || p==0 || p->n>0x7fffffff\r\n          || p->n==sqlite3_aggregate_count(context) );\r\n#endif\r\n}   \r\nstatic void countFinalize(sqlite3_context *context){\r\n  CountCtx *p;\r\n  p = sqlite3_aggregate_context(context, 0);\r\n  sqlite3_result_int64(context, p ? p->n : 0);\r\n}\r\n\r\n/*\r\n** Routines to implement min() and max() aggregate functions.\r\n*/\r\nstatic void minmaxStep(\r\n  sqlite3_context *context, \r\n  int NotUsed, \r\n  sqlite3_value **argv\r\n){\r\n  Mem *pArg  = (Mem *)argv[0];\r\n  Mem *pBest;\r\n  UNUSED_PARAMETER(NotUsed);\r\n\r\n  pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));\r\n  if( !pBest ) return;\r\n\r\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ){\r\n    if( pBest->flags ) sqlite3SkipAccumulatorLoad(context);\r\n  }else if( pBest->flags ){\r\n    int max;\r\n    int cmp;\r\n    CollSeq *pColl = sqlite3GetFuncCollSeq(context);\r\n    /* This step function is used for both the min() and max() aggregates,\r\n    ** the only difference between the two being that the sense of the\r\n    ** comparison is inverted. For the max() aggregate, the\r\n    ** sqlite3_user_data() function returns (void *)-1. For min() it\r\n    ** returns (void *)db, where db is the sqlite3* database pointer.\r\n    ** Therefore the next statement sets variable 'max' to 1 for the max()\r\n    ** aggregate, or 0 for min().\r\n    */\r\n    max = sqlite3_user_data(context)!=0;\r\n    cmp = sqlite3MemCompare(pBest, pArg, pColl);\r\n    if( (max && cmp<0) || (!max && cmp>0) ){\r\n      sqlite3VdbeMemCopy(pBest, pArg);\r\n    }else{\r\n      sqlite3SkipAccumulatorLoad(context);\r\n    }\r\n  }else{\r\n    sqlite3VdbeMemCopy(pBest, pArg);\r\n  }\r\n}\r\nstatic void minMaxFinalize(sqlite3_context *context){\r\n  sqlite3_value *pRes;\r\n  pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);\r\n  if( pRes ){\r\n    if( pRes->flags ){\r\n      sqlite3_result_value(context, pRes);\r\n    }\r\n    sqlite3VdbeMemRelease(pRes);\r\n  }\r\n}\r\n\r\n/*\r\n** group_concat(EXPR, ?SEPARATOR?)\r\n*/\r\nstatic void groupConcatStep(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  const char *zVal;\r\n  StrAccum *pAccum;\r\n  const char *zSep;\r\n  int nVal, nSep;\r\n  assert( argc==1 || argc==2 );\r\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;\r\n  pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum));\r\n\r\n  if( pAccum ){\r\n    sqlite3 *db = sqlite3_context_db_handle(context);\r\n    int firstTerm = pAccum->useMalloc==0;\r\n    pAccum->useMalloc = 2;\r\n    pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH];\r\n    if( !firstTerm ){\r\n      if( argc==2 ){\r\n        zSep = (char*)sqlite3_value_text(argv[1]);\r\n        nSep = sqlite3_value_bytes(argv[1]);\r\n      }else{\r\n        zSep = \",\";\r\n        nSep = 1;\r\n      }\r\n      sqlite3StrAccumAppend(pAccum, zSep, nSep);\r\n    }\r\n    zVal = (char*)sqlite3_value_text(argv[0]);\r\n    nVal = sqlite3_value_bytes(argv[0]);\r\n    sqlite3StrAccumAppend(pAccum, zVal, nVal);\r\n  }\r\n}\r\nstatic void groupConcatFinalize(sqlite3_context *context){\r\n  StrAccum *pAccum;\r\n  pAccum = sqlite3_aggregate_context(context, 0);\r\n  if( pAccum ){\r\n    if( pAccum->tooBig ){\r\n      sqlite3_result_error_toobig(context);\r\n    }else if( pAccum->mallocFailed ){\r\n      sqlite3_result_error_nomem(context);\r\n    }else{    \r\n      sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, \r\n                          sqlite3_free);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** This routine does per-connection function registration.  Most\r\n** of the built-in functions above are part of the global function set.\r\n** This routine only deals with those that are not global.\r\n*/\r\nSQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(sqlite3 *db){\r\n  int rc = sqlite3_overload_function(db, \"MATCH\", 2);\r\n  assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );\r\n  if( rc==SQLITE_NOMEM ){\r\n    db->mallocFailed = 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Set the LIKEOPT flag on the 2-argument function with the given name.\r\n*/\r\nstatic void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){\r\n  FuncDef *pDef;\r\n  pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName),\r\n                             2, SQLITE_UTF8, 0);\r\n  if( ALWAYS(pDef) ){\r\n    pDef->flags = flagVal;\r\n  }\r\n}\r\n\r\n/*\r\n** Register the built-in LIKE and GLOB functions.  The caseSensitive\r\n** parameter determines whether or not the LIKE operator is case\r\n** sensitive.  GLOB is always case sensitive.\r\n*/\r\nSQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){\r\n  struct compareInfo *pInfo;\r\n  if( caseSensitive ){\r\n    pInfo = (struct compareInfo*)&likeInfoAlt;\r\n  }else{\r\n    pInfo = (struct compareInfo*)&likeInfoNorm;\r\n  }\r\n  sqlite3CreateFunc(db, \"like\", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0);\r\n  sqlite3CreateFunc(db, \"like\", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0);\r\n  sqlite3CreateFunc(db, \"glob\", 2, SQLITE_UTF8, \r\n      (struct compareInfo*)&globInfo, likeFunc, 0, 0, 0);\r\n  setLikeOptFlag(db, \"glob\", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);\r\n  setLikeOptFlag(db, \"like\", \r\n      caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);\r\n}\r\n\r\n/*\r\n** pExpr points to an expression which implements a function.  If\r\n** it is appropriate to apply the LIKE optimization to that function\r\n** then set aWc[0] through aWc[2] to the wildcard characters and\r\n** return TRUE.  If the function is not a LIKE-style function then\r\n** return FALSE.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){\r\n  FuncDef *pDef;\r\n  if( pExpr->op!=TK_FUNCTION \r\n   || !pExpr->x.pList \r\n   || pExpr->x.pList->nExpr!=2\r\n  ){\r\n    return 0;\r\n  }\r\n  assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\r\n  pDef = sqlite3FindFunction(db, pExpr->u.zToken, \r\n                             sqlite3Strlen30(pExpr->u.zToken),\r\n                             2, SQLITE_UTF8, 0);\r\n  if( NEVER(pDef==0) || (pDef->flags & SQLITE_FUNC_LIKE)==0 ){\r\n    return 0;\r\n  }\r\n\r\n  /* The memcpy() statement assumes that the wildcard characters are\r\n  ** the first three statements in the compareInfo structure.  The\r\n  ** asserts() that follow verify that assumption\r\n  */\r\n  memcpy(aWc, pDef->pUserData, 3);\r\n  assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );\r\n  assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );\r\n  assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );\r\n  *pIsNocase = (pDef->flags & SQLITE_FUNC_CASE)==0;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** All all of the FuncDef structures in the aBuiltinFunc[] array above\r\n** to the global function hash table.  This occurs at start-time (as\r\n** a consequence of calling sqlite3_initialize()).\r\n**\r\n** After this routine runs\r\n*/\r\nSQLITE_PRIVATE void sqlite3RegisterGlobalFunctions(void){\r\n  /*\r\n  ** The following array holds FuncDef structures for all of the functions\r\n  ** defined in this file.\r\n  **\r\n  ** The array cannot be constant since changes are made to the\r\n  ** FuncDef.pHash elements at start-time.  The elements of this array\r\n  ** are read-only after initialization is complete.\r\n  */\r\n  static SQLITE_WSD FuncDef aBuiltinFunc[] = {\r\n    FUNCTION(ltrim,              1, 1, 0, trimFunc         ),\r\n    FUNCTION(ltrim,              2, 1, 0, trimFunc         ),\r\n    FUNCTION(rtrim,              1, 2, 0, trimFunc         ),\r\n    FUNCTION(rtrim,              2, 2, 0, trimFunc         ),\r\n    FUNCTION(trim,               1, 3, 0, trimFunc         ),\r\n    FUNCTION(trim,               2, 3, 0, trimFunc         ),\r\n    FUNCTION(min,               -1, 0, 1, minmaxFunc       ),\r\n    FUNCTION(min,                0, 0, 1, 0                ),\r\n    AGGREGATE(min,               1, 0, 1, minmaxStep,      minMaxFinalize ),\r\n    FUNCTION(max,               -1, 1, 1, minmaxFunc       ),\r\n    FUNCTION(max,                0, 1, 1, 0                ),\r\n    AGGREGATE(max,               1, 1, 1, minmaxStep,      minMaxFinalize ),\r\n    FUNCTION(typeof,             1, 0, 0, typeofFunc       ),\r\n    FUNCTION(length,             1, 0, 0, lengthFunc       ),\r\n    FUNCTION(substr,             2, 0, 0, substrFunc       ),\r\n    FUNCTION(substr,             3, 0, 0, substrFunc       ),\r\n    FUNCTION(abs,                1, 0, 0, absFunc          ),\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n    FUNCTION(round,              1, 0, 0, roundFunc        ),\r\n    FUNCTION(round,              2, 0, 0, roundFunc        ),\r\n#endif\r\n    FUNCTION(upper,              1, 0, 0, upperFunc        ),\r\n    FUNCTION(lower,              1, 0, 0, lowerFunc        ),\r\n    FUNCTION(coalesce,           1, 0, 0, 0                ),\r\n    FUNCTION(coalesce,           0, 0, 0, 0                ),\r\n/*  FUNCTION(coalesce,          -1, 0, 0, ifnullFunc       ), */\r\n    {-1,SQLITE_UTF8,SQLITE_FUNC_COALESCE,0,0,ifnullFunc,0,0,\"coalesce\",0,0},\r\n    FUNCTION(hex,                1, 0, 0, hexFunc          ),\r\n/*  FUNCTION(ifnull,             2, 0, 0, ifnullFunc       ), */\r\n    {2,SQLITE_UTF8,SQLITE_FUNC_COALESCE,0,0,ifnullFunc,0,0,\"ifnull\",0,0},\r\n    FUNCTION(random,             0, 0, 0, randomFunc       ),\r\n    FUNCTION(randomblob,         1, 0, 0, randomBlob       ),\r\n    FUNCTION(nullif,             2, 0, 1, nullifFunc       ),\r\n    FUNCTION(sqlite_version,     0, 0, 0, versionFunc      ),\r\n    FUNCTION(sqlite_source_id,   0, 0, 0, sourceidFunc     ),\r\n    FUNCTION(sqlite_log,         2, 0, 0, errlogFunc       ),\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\n    FUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc  ),\r\n    FUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc  ),\r\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\r\n    FUNCTION(quote,              1, 0, 0, quoteFunc        ),\r\n    FUNCTION(last_insert_rowid,  0, 0, 0, last_insert_rowid),\r\n    FUNCTION(changes,            0, 0, 0, changes          ),\r\n    FUNCTION(total_changes,      0, 0, 0, total_changes    ),\r\n    FUNCTION(replace,            3, 0, 0, replaceFunc      ),\r\n    FUNCTION(zeroblob,           1, 0, 0, zeroblobFunc     ),\r\n  #ifdef SQLITE_SOUNDEX\r\n    FUNCTION(soundex,            1, 0, 0, soundexFunc      ),\r\n  #endif\r\n  #ifndef SQLITE_OMIT_LOAD_EXTENSION\r\n    FUNCTION(load_extension,     1, 0, 0, loadExt          ),\r\n    FUNCTION(load_extension,     2, 0, 0, loadExt          ),\r\n  #endif\r\n    AGGREGATE(sum,               1, 0, 0, sumStep,         sumFinalize    ),\r\n    AGGREGATE(total,             1, 0, 0, sumStep,         totalFinalize    ),\r\n    AGGREGATE(avg,               1, 0, 0, sumStep,         avgFinalize    ),\r\n /* AGGREGATE(count,             0, 0, 0, countStep,       countFinalize  ), */\r\n    {0,SQLITE_UTF8,SQLITE_FUNC_COUNT,0,0,0,countStep,countFinalize,\"count\",0,0},\r\n    AGGREGATE(count,             1, 0, 0, countStep,       countFinalize  ),\r\n    AGGREGATE(group_concat,      1, 0, 0, groupConcatStep, groupConcatFinalize),\r\n    AGGREGATE(group_concat,      2, 0, 0, groupConcatStep, groupConcatFinalize),\r\n  \r\n    LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE),\r\n  #ifdef SQLITE_CASE_SENSITIVE_LIKE\r\n    LIKEFUNC(like, 2, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE),\r\n    LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE),\r\n  #else\r\n    LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE),\r\n    LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),\r\n  #endif\r\n  };\r\n\r\n  int i;\r\n  FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);\r\n  FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aBuiltinFunc);\r\n\r\n  for(i=0; i<ArraySize(aBuiltinFunc); i++){\r\n    sqlite3FuncDefInsert(pHash, &aFunc[i]);\r\n  }\r\n  sqlite3RegisterDateTimeFunctions();\r\n#ifndef SQLITE_OMIT_ALTERTABLE\r\n  sqlite3AlterFunctions();\r\n#endif\r\n}\r\n\r\n/************** End of func.c ************************************************/\r\n/************** Begin file fkey.c ********************************************/\r\n/*\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used by the compiler to add foreign key\r\n** support to compiled SQL statements.\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n\r\n/*\r\n** Deferred and Immediate FKs\r\n** --------------------------\r\n**\r\n** Foreign keys in SQLite come in two flavours: deferred and immediate.\r\n** If an immediate foreign key constraint is violated, SQLITE_CONSTRAINT\r\n** is returned and the current statement transaction rolled back. If a \r\n** deferred foreign key constraint is violated, no action is taken \r\n** immediately. However if the application attempts to commit the \r\n** transaction before fixing the constraint violation, the attempt fails.\r\n**\r\n** Deferred constraints are implemented using a simple counter associated\r\n** with the database handle. The counter is set to zero each time a \r\n** database transaction is opened. Each time a statement is executed \r\n** that causes a foreign key violation, the counter is incremented. Each\r\n** time a statement is executed that removes an existing violation from\r\n** the database, the counter is decremented. When the transaction is\r\n** committed, the commit fails if the current value of the counter is\r\n** greater than zero. This scheme has two big drawbacks:\r\n**\r\n**   * When a commit fails due to a deferred foreign key constraint, \r\n**     there is no way to tell which foreign constraint is not satisfied,\r\n**     or which row it is not satisfied for.\r\n**\r\n**   * If the database contains foreign key violations when the \r\n**     transaction is opened, this may cause the mechanism to malfunction.\r\n**\r\n** Despite these problems, this approach is adopted as it seems simpler\r\n** than the alternatives.\r\n**\r\n** INSERT operations:\r\n**\r\n**   I.1) For each FK for which the table is the child table, search\r\n**        the parent table for a match. If none is found increment the\r\n**        constraint counter.\r\n**\r\n**   I.2) For each FK for which the table is the parent table, \r\n**        search the child table for rows that correspond to the new\r\n**        row in the parent table. Decrement the counter for each row\r\n**        found (as the constraint is now satisfied).\r\n**\r\n** DELETE operations:\r\n**\r\n**   D.1) For each FK for which the table is the child table, \r\n**        search the parent table for a row that corresponds to the \r\n**        deleted row in the child table. If such a row is not found, \r\n**        decrement the counter.\r\n**\r\n**   D.2) For each FK for which the table is the parent table, search \r\n**        the child table for rows that correspond to the deleted row \r\n**        in the parent table. For each found increment the counter.\r\n**\r\n** UPDATE operations:\r\n**\r\n**   An UPDATE command requires that all 4 steps above are taken, but only\r\n**   for FK constraints for which the affected columns are actually \r\n**   modified (values must be compared at runtime).\r\n**\r\n** Note that I.1 and D.1 are very similar operations, as are I.2 and D.2.\r\n** This simplifies the implementation a bit.\r\n**\r\n** For the purposes of immediate FK constraints, the OR REPLACE conflict\r\n** resolution is considered to delete rows before the new row is inserted.\r\n** If a delete caused by OR REPLACE violates an FK constraint, an exception\r\n** is thrown, even if the FK constraint would be satisfied after the new \r\n** row is inserted.\r\n**\r\n** Immediate constraints are usually handled similarly. The only difference \r\n** is that the counter used is stored as part of each individual statement\r\n** object (struct Vdbe). If, after the statement has run, its immediate\r\n** constraint counter is greater than zero, it returns SQLITE_CONSTRAINT\r\n** and the statement transaction is rolled back. An exception is an INSERT\r\n** statement that inserts a single row only (no triggers). In this case,\r\n** instead of using a counter, an exception is thrown immediately if the\r\n** INSERT violates a foreign key constraint. This is necessary as such\r\n** an INSERT does not open a statement transaction.\r\n**\r\n** TODO: How should dropping a table be handled? How should renaming a \r\n** table be handled?\r\n**\r\n**\r\n** Query API Notes\r\n** ---------------\r\n**\r\n** Before coding an UPDATE or DELETE row operation, the code-generator\r\n** for those two operations needs to know whether or not the operation\r\n** requires any FK processing and, if so, which columns of the original\r\n** row are required by the FK processing VDBE code (i.e. if FKs were\r\n** implemented using triggers, which of the old.* columns would be \r\n** accessed). No information is required by the code-generator before\r\n** coding an INSERT operation. The functions used by the UPDATE/DELETE\r\n** generation code to query for this information are:\r\n**\r\n**   sqlite3FkRequired() - Test to see if FK processing is required.\r\n**   sqlite3FkOldmask()  - Query for the set of required old.* columns.\r\n**\r\n**\r\n** Externally accessible module functions\r\n** --------------------------------------\r\n**\r\n**   sqlite3FkCheck()    - Check for foreign key violations.\r\n**   sqlite3FkActions()  - Code triggers for ON UPDATE/ON DELETE actions.\r\n**   sqlite3FkDelete()   - Delete an FKey structure.\r\n*/\r\n\r\n/*\r\n** VDBE Calling Convention\r\n** -----------------------\r\n**\r\n** Example:\r\n**\r\n**   For the following INSERT statement:\r\n**\r\n**     CREATE TABLE t1(a, b INTEGER PRIMARY KEY, c);\r\n**     INSERT INTO t1 VALUES(1, 2, 3.1);\r\n**\r\n**   Register (x):        2    (type integer)\r\n**   Register (x+1):      1    (type integer)\r\n**   Register (x+2):      NULL (type NULL)\r\n**   Register (x+3):      3.1  (type real)\r\n*/\r\n\r\n/*\r\n** A foreign key constraint requires that the key columns in the parent\r\n** table are collectively subject to a UNIQUE or PRIMARY KEY constraint.\r\n** Given that pParent is the parent table for foreign key constraint pFKey, \r\n** search the schema a unique index on the parent key columns. \r\n**\r\n** If successful, zero is returned. If the parent key is an INTEGER PRIMARY \r\n** KEY column, then output variable *ppIdx is set to NULL. Otherwise, *ppIdx \r\n** is set to point to the unique index. \r\n** \r\n** If the parent key consists of a single column (the foreign key constraint\r\n** is not a composite foreign key), output variable *paiCol is set to NULL.\r\n** Otherwise, it is set to point to an allocated array of size N, where\r\n** N is the number of columns in the parent key. The first element of the\r\n** array is the index of the child table column that is mapped by the FK\r\n** constraint to the parent table column stored in the left-most column\r\n** of index *ppIdx. The second element of the array is the index of the\r\n** child table column that corresponds to the second left-most column of\r\n** *ppIdx, and so on.\r\n**\r\n** If the required index cannot be found, either because:\r\n**\r\n**   1) The named parent key columns do not exist, or\r\n**\r\n**   2) The named parent key columns do exist, but are not subject to a\r\n**      UNIQUE or PRIMARY KEY constraint, or\r\n**\r\n**   3) No parent key columns were provided explicitly as part of the\r\n**      foreign key definition, and the parent table does not have a\r\n**      PRIMARY KEY, or\r\n**\r\n**   4) No parent key columns were provided explicitly as part of the\r\n**      foreign key definition, and the PRIMARY KEY of the parent table \r\n**      consists of a a different number of columns to the child key in \r\n**      the child table.\r\n**\r\n** then non-zero is returned, and a \"foreign key mismatch\" error loaded\r\n** into pParse. If an OOM error occurs, non-zero is returned and the\r\n** pParse->db->mallocFailed flag is set.\r\n*/\r\nstatic int locateFkeyIndex(\r\n  Parse *pParse,                  /* Parse context to store any error in */\r\n  Table *pParent,                 /* Parent table of FK constraint pFKey */\r\n  FKey *pFKey,                    /* Foreign key to find index for */\r\n  Index **ppIdx,                  /* OUT: Unique index on parent table */\r\n  int **paiCol                    /* OUT: Map of index columns in pFKey */\r\n){\r\n  Index *pIdx = 0;                    /* Value to return via *ppIdx */\r\n  int *aiCol = 0;                     /* Value to return via *paiCol */\r\n  int nCol = pFKey->nCol;             /* Number of columns in parent key */\r\n  char *zKey = pFKey->aCol[0].zCol;   /* Name of left-most parent key column */\r\n\r\n  /* The caller is responsible for zeroing output parameters. */\r\n  assert( ppIdx && *ppIdx==0 );\r\n  assert( !paiCol || *paiCol==0 );\r\n  assert( pParse );\r\n\r\n  /* If this is a non-composite (single column) foreign key, check if it \r\n  ** maps to the INTEGER PRIMARY KEY of table pParent. If so, leave *ppIdx \r\n  ** and *paiCol set to zero and return early. \r\n  **\r\n  ** Otherwise, for a composite foreign key (more than one column), allocate\r\n  ** space for the aiCol array (returned via output parameter *paiCol).\r\n  ** Non-composite foreign keys do not require the aiCol array.\r\n  */\r\n  if( nCol==1 ){\r\n    /* The FK maps to the IPK if any of the following are true:\r\n    **\r\n    **   1) There is an INTEGER PRIMARY KEY column and the FK is implicitly \r\n    **      mapped to the primary key of table pParent, or\r\n    **   2) The FK is explicitly mapped to a column declared as INTEGER\r\n    **      PRIMARY KEY.\r\n    */\r\n    if( pParent->iPKey>=0 ){\r\n      if( !zKey ) return 0;\r\n      if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0;\r\n    }\r\n  }else if( paiCol ){\r\n    assert( nCol>1 );\r\n    aiCol = (int *)sqlite3DbMallocRaw(pParse->db, nCol*sizeof(int));\r\n    if( !aiCol ) return 1;\r\n    *paiCol = aiCol;\r\n  }\r\n\r\n  for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){\r\n    if( pIdx->nColumn==nCol && pIdx->onError!=OE_None ){ \r\n      /* pIdx is a UNIQUE index (or a PRIMARY KEY) and has the right number\r\n      ** of columns. If each indexed column corresponds to a foreign key\r\n      ** column of pFKey, then this index is a winner.  */\r\n\r\n      if( zKey==0 ){\r\n        /* If zKey is NULL, then this foreign key is implicitly mapped to \r\n        ** the PRIMARY KEY of table pParent. The PRIMARY KEY index may be \r\n        ** identified by the test (Index.autoIndex==2).  */\r\n        if( pIdx->autoIndex==2 ){\r\n          if( aiCol ){\r\n            int i;\r\n            for(i=0; i<nCol; i++) aiCol[i] = pFKey->aCol[i].iFrom;\r\n          }\r\n          break;\r\n        }\r\n      }else{\r\n        /* If zKey is non-NULL, then this foreign key was declared to\r\n        ** map to an explicit list of columns in table pParent. Check if this\r\n        ** index matches those columns. Also, check that the index uses\r\n        ** the default collation sequences for each column. */\r\n        int i, j;\r\n        for(i=0; i<nCol; i++){\r\n          int iCol = pIdx->aiColumn[i];     /* Index of column in parent tbl */\r\n          char *zDfltColl;                  /* Def. collation for column */\r\n          char *zIdxCol;                    /* Name of indexed column */\r\n\r\n          /* If the index uses a collation sequence that is different from\r\n          ** the default collation sequence for the column, this index is\r\n          ** unusable. Bail out early in this case.  */\r\n          zDfltColl = pParent->aCol[iCol].zColl;\r\n          if( !zDfltColl ){\r\n            zDfltColl = \"BINARY\";\r\n          }\r\n          if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;\r\n\r\n          zIdxCol = pParent->aCol[iCol].zName;\r\n          for(j=0; j<nCol; j++){\r\n            if( sqlite3StrICmp(pFKey->aCol[j].zCol, zIdxCol)==0 ){\r\n              if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom;\r\n              break;\r\n            }\r\n          }\r\n          if( j==nCol ) break;\r\n        }\r\n        if( i==nCol ) break;      /* pIdx is usable */\r\n      }\r\n    }\r\n  }\r\n\r\n  if( !pIdx ){\r\n    if( !pParse->disableTriggers ){\r\n      sqlite3ErrorMsg(pParse, \"foreign key mismatch\");\r\n    }\r\n    sqlite3DbFree(pParse->db, aiCol);\r\n    return 1;\r\n  }\r\n\r\n  *ppIdx = pIdx;\r\n  return 0;\r\n}\r\n\r\n/*\r\n** This function is called when a row is inserted into or deleted from the \r\n** child table of foreign key constraint pFKey. If an SQL UPDATE is executed \r\n** on the child table of pFKey, this function is invoked twice for each row\r\n** affected - once to \"delete\" the old row, and then again to \"insert\" the\r\n** new row.\r\n**\r\n** Each time it is called, this function generates VDBE code to locate the\r\n** row in the parent table that corresponds to the row being inserted into \r\n** or deleted from the child table. If the parent row can be found, no \r\n** special action is taken. Otherwise, if the parent row can *not* be\r\n** found in the parent table:\r\n**\r\n**   Operation | FK type   | Action taken\r\n**   --------------------------------------------------------------------------\r\n**   INSERT      immediate   Increment the \"immediate constraint counter\".\r\n**\r\n**   DELETE      immediate   Decrement the \"immediate constraint counter\".\r\n**\r\n**   INSERT      deferred    Increment the \"deferred constraint counter\".\r\n**\r\n**   DELETE      deferred    Decrement the \"deferred constraint counter\".\r\n**\r\n** These operations are identified in the comment at the top of this file \r\n** (fkey.c) as \"I.1\" and \"D.1\".\r\n*/\r\nstatic void fkLookupParent(\r\n  Parse *pParse,        /* Parse context */\r\n  int iDb,              /* Index of database housing pTab */\r\n  Table *pTab,          /* Parent table of FK pFKey */\r\n  Index *pIdx,          /* Unique index on parent key columns in pTab */\r\n  FKey *pFKey,          /* Foreign key constraint */\r\n  int *aiCol,           /* Map from parent key columns to child table columns */\r\n  int regData,          /* Address of array containing child table row */\r\n  int nIncr,            /* Increment constraint counter by this */\r\n  int isIgnore          /* If true, pretend pTab contains all NULL values */\r\n){\r\n  int i;                                    /* Iterator variable */\r\n  Vdbe *v = sqlite3GetVdbe(pParse);         /* Vdbe to add code to */\r\n  int iCur = pParse->nTab - 1;              /* Cursor number to use */\r\n  int iOk = sqlite3VdbeMakeLabel(v);        /* jump here if parent key found */\r\n\r\n  /* If nIncr is less than zero, then check at runtime if there are any\r\n  ** outstanding constraints to resolve. If there are not, there is no need\r\n  ** to check if deleting this row resolves any outstanding violations.\r\n  **\r\n  ** Check if any of the key columns in the child table row are NULL. If \r\n  ** any are, then the constraint is considered satisfied. No need to \r\n  ** search for a matching row in the parent table.  */\r\n  if( nIncr<0 ){\r\n    sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk);\r\n  }\r\n  for(i=0; i<pFKey->nCol; i++){\r\n    int iReg = aiCol[i] + regData + 1;\r\n    sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iOk);\r\n  }\r\n\r\n  if( isIgnore==0 ){\r\n    if( pIdx==0 ){\r\n      /* If pIdx is NULL, then the parent key is the INTEGER PRIMARY KEY\r\n      ** column of the parent table (table pTab).  */\r\n      int iMustBeInt;               /* Address of MustBeInt instruction */\r\n      int regTemp = sqlite3GetTempReg(pParse);\r\n  \r\n      /* Invoke MustBeInt to coerce the child key value to an integer (i.e. \r\n      ** apply the affinity of the parent key). If this fails, then there\r\n      ** is no matching parent key. Before using MustBeInt, make a copy of\r\n      ** the value. Otherwise, the value inserted into the child key column\r\n      ** will have INTEGER affinity applied to it, which may not be correct.  */\r\n      sqlite3VdbeAddOp2(v, OP_SCopy, aiCol[0]+1+regData, regTemp);\r\n      iMustBeInt = sqlite3VdbeAddOp2(v, OP_MustBeInt, regTemp, 0);\r\n  \r\n      /* If the parent table is the same as the child table, and we are about\r\n      ** to increment the constraint-counter (i.e. this is an INSERT operation),\r\n      ** then check if the row being inserted matches itself. If so, do not\r\n      ** increment the constraint-counter.  */\r\n      if( pTab==pFKey->pFrom && nIncr==1 ){\r\n        sqlite3VdbeAddOp3(v, OP_Eq, regData, iOk, regTemp);\r\n      }\r\n  \r\n      sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);\r\n      sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regTemp);\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, iOk);\r\n      sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);\r\n      sqlite3VdbeJumpHere(v, iMustBeInt);\r\n      sqlite3ReleaseTempReg(pParse, regTemp);\r\n    }else{\r\n      int nCol = pFKey->nCol;\r\n      int regTemp = sqlite3GetTempRange(pParse, nCol);\r\n      int regRec = sqlite3GetTempReg(pParse);\r\n      KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);\r\n  \r\n      sqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb);\r\n      sqlite3VdbeChangeP4(v, -1, (char*)pKey, P4_KEYINFO_HANDOFF);\r\n      for(i=0; i<nCol; i++){\r\n        sqlite3VdbeAddOp2(v, OP_Copy, aiCol[i]+1+regData, regTemp+i);\r\n      }\r\n  \r\n      /* If the parent table is the same as the child table, and we are about\r\n      ** to increment the constraint-counter (i.e. this is an INSERT operation),\r\n      ** then check if the row being inserted matches itself. If so, do not\r\n      ** increment the constraint-counter. \r\n      **\r\n      ** If any of the parent-key values are NULL, then the row cannot match \r\n      ** itself. So set JUMPIFNULL to make sure we do the OP_Found if any\r\n      ** of the parent-key values are NULL (at this point it is known that\r\n      ** none of the child key values are).\r\n      */\r\n      if( pTab==pFKey->pFrom && nIncr==1 ){\r\n        int iJump = sqlite3VdbeCurrentAddr(v) + nCol + 1;\r\n        for(i=0; i<nCol; i++){\r\n          int iChild = aiCol[i]+1+regData;\r\n          int iParent = pIdx->aiColumn[i]+1+regData;\r\n          assert( aiCol[i]!=pTab->iPKey );\r\n          if( pIdx->aiColumn[i]==pTab->iPKey ){\r\n            /* The parent key is a composite key that includes the IPK column */\r\n            iParent = regData;\r\n          }\r\n          sqlite3VdbeAddOp3(v, OP_Ne, iChild, iJump, iParent);\r\n          sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL);\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, iOk);\r\n      }\r\n  \r\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regTemp, nCol, regRec);\r\n      sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v,pIdx), P4_TRANSIENT);\r\n      sqlite3VdbeAddOp4Int(v, OP_Found, iCur, iOk, regRec, 0);\r\n  \r\n      sqlite3ReleaseTempReg(pParse, regRec);\r\n      sqlite3ReleaseTempRange(pParse, regTemp, nCol);\r\n    }\r\n  }\r\n\r\n  if( !pFKey->isDeferred && !pParse->pToplevel && !pParse->isMultiWrite ){\r\n    /* Special case: If this is an INSERT statement that will insert exactly\r\n    ** one row into the table, raise a constraint immediately instead of\r\n    ** incrementing a counter. This is necessary as the VM code is being\r\n    ** generated for will not open a statement transaction.  */\r\n    assert( nIncr==1 );\r\n    sqlite3HaltConstraint(\r\n        pParse, OE_Abort, \"foreign key constraint failed\", P4_STATIC\r\n    );\r\n  }else{\r\n    if( nIncr>0 && pFKey->isDeferred==0 ){\r\n      sqlite3ParseToplevel(pParse)->mayAbort = 1;\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);\r\n  }\r\n\r\n  sqlite3VdbeResolveLabel(v, iOk);\r\n  sqlite3VdbeAddOp1(v, OP_Close, iCur);\r\n}\r\n\r\n/*\r\n** This function is called to generate code executed when a row is deleted\r\n** from the parent table of foreign key constraint pFKey and, if pFKey is \r\n** deferred, when a row is inserted into the same table. When generating\r\n** code for an SQL UPDATE operation, this function may be called twice -\r\n** once to \"delete\" the old row and once to \"insert\" the new row.\r\n**\r\n** The code generated by this function scans through the rows in the child\r\n** table that correspond to the parent table row being deleted or inserted.\r\n** For each child row found, one of the following actions is taken:\r\n**\r\n**   Operation | FK type   | Action taken\r\n**   --------------------------------------------------------------------------\r\n**   DELETE      immediate   Increment the \"immediate constraint counter\".\r\n**                           Or, if the ON (UPDATE|DELETE) action is RESTRICT,\r\n**                           throw a \"foreign key constraint failed\" exception.\r\n**\r\n**   INSERT      immediate   Decrement the \"immediate constraint counter\".\r\n**\r\n**   DELETE      deferred    Increment the \"deferred constraint counter\".\r\n**                           Or, if the ON (UPDATE|DELETE) action is RESTRICT,\r\n**                           throw a \"foreign key constraint failed\" exception.\r\n**\r\n**   INSERT      deferred    Decrement the \"deferred constraint counter\".\r\n**\r\n** These operations are identified in the comment at the top of this file \r\n** (fkey.c) as \"I.2\" and \"D.2\".\r\n*/\r\nstatic void fkScanChildren(\r\n  Parse *pParse,                  /* Parse context */\r\n  SrcList *pSrc,                  /* SrcList containing the table to scan */\r\n  Table *pTab,\r\n  Index *pIdx,                    /* Foreign key index */\r\n  FKey *pFKey,                    /* Foreign key relationship */\r\n  int *aiCol,                     /* Map from pIdx cols to child table cols */\r\n  int regData,                    /* Referenced table data starts here */\r\n  int nIncr                       /* Amount to increment deferred counter by */\r\n){\r\n  sqlite3 *db = pParse->db;       /* Database handle */\r\n  int i;                          /* Iterator variable */\r\n  Expr *pWhere = 0;               /* WHERE clause to scan with */\r\n  NameContext sNameContext;       /* Context used to resolve WHERE clause */\r\n  WhereInfo *pWInfo;              /* Context used by sqlite3WhereXXX() */\r\n  int iFkIfZero = 0;              /* Address of OP_FkIfZero */\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n\r\n  assert( !pIdx || pIdx->pTable==pTab );\r\n\r\n  if( nIncr<0 ){\r\n    iFkIfZero = sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0);\r\n  }\r\n\r\n  /* Create an Expr object representing an SQL expression like:\r\n  **\r\n  **   <parent-key1> = <child-key1> AND <parent-key2> = <child-key2> ...\r\n  **\r\n  ** The collation sequence used for the comparison should be that of\r\n  ** the parent key columns. The affinity of the parent key column should\r\n  ** be applied to each child key value before the comparison takes place.\r\n  */\r\n  for(i=0; i<pFKey->nCol; i++){\r\n    Expr *pLeft;                  /* Value from parent table row */\r\n    Expr *pRight;                 /* Column ref to child table */\r\n    Expr *pEq;                    /* Expression (pLeft = pRight) */\r\n    int iCol;                     /* Index of column in child table */ \r\n    const char *zCol;             /* Name of column in child table */\r\n\r\n    pLeft = sqlite3Expr(db, TK_REGISTER, 0);\r\n    if( pLeft ){\r\n      /* Set the collation sequence and affinity of the LHS of each TK_EQ\r\n      ** expression to the parent key column defaults.  */\r\n      if( pIdx ){\r\n        Column *pCol;\r\n        iCol = pIdx->aiColumn[i];\r\n        pCol = &pTab->aCol[iCol];\r\n        if( pTab->iPKey==iCol ) iCol = -1;\r\n        pLeft->iTable = regData+iCol+1;\r\n        pLeft->affinity = pCol->affinity;\r\n        pLeft->pColl = sqlite3LocateCollSeq(pParse, pCol->zColl);\r\n      }else{\r\n        pLeft->iTable = regData;\r\n        pLeft->affinity = SQLITE_AFF_INTEGER;\r\n      }\r\n    }\r\n    iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;\r\n    assert( iCol>=0 );\r\n    zCol = pFKey->pFrom->aCol[iCol].zName;\r\n    pRight = sqlite3Expr(db, TK_ID, zCol);\r\n    pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight, 0);\r\n    pWhere = sqlite3ExprAnd(db, pWhere, pEq);\r\n  }\r\n\r\n  /* If the child table is the same as the parent table, and this scan\r\n  ** is taking place as part of a DELETE operation (operation D.2), omit the\r\n  ** row being deleted from the scan by adding ($rowid != rowid) to the WHERE \r\n  ** clause, where $rowid is the rowid of the row being deleted.  */\r\n  if( pTab==pFKey->pFrom && nIncr>0 ){\r\n    Expr *pEq;                    /* Expression (pLeft = pRight) */\r\n    Expr *pLeft;                  /* Value from parent table row */\r\n    Expr *pRight;                 /* Column ref to child table */\r\n    pLeft = sqlite3Expr(db, TK_REGISTER, 0);\r\n    pRight = sqlite3Expr(db, TK_COLUMN, 0);\r\n    if( pLeft && pRight ){\r\n      pLeft->iTable = regData;\r\n      pLeft->affinity = SQLITE_AFF_INTEGER;\r\n      pRight->iTable = pSrc->a[0].iCursor;\r\n      pRight->iColumn = -1;\r\n    }\r\n    pEq = sqlite3PExpr(pParse, TK_NE, pLeft, pRight, 0);\r\n    pWhere = sqlite3ExprAnd(db, pWhere, pEq);\r\n  }\r\n\r\n  /* Resolve the references in the WHERE clause. */\r\n  memset(&sNameContext, 0, sizeof(NameContext));\r\n  sNameContext.pSrcList = pSrc;\r\n  sNameContext.pParse = pParse;\r\n  sqlite3ResolveExprNames(&sNameContext, pWhere);\r\n\r\n  /* Create VDBE to loop through the entries in pSrc that match the WHERE\r\n  ** clause. If the constraint is not deferred, throw an exception for\r\n  ** each row found. Otherwise, for deferred constraints, increment the\r\n  ** deferred constraint counter by nIncr for each row selected.  */\r\n  pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0);\r\n  if( nIncr>0 && pFKey->isDeferred==0 ){\r\n    sqlite3ParseToplevel(pParse)->mayAbort = 1;\r\n  }\r\n  sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);\r\n  if( pWInfo ){\r\n    sqlite3WhereEnd(pWInfo);\r\n  }\r\n\r\n  /* Clean up the WHERE clause constructed above. */\r\n  sqlite3ExprDelete(db, pWhere);\r\n  if( iFkIfZero ){\r\n    sqlite3VdbeJumpHere(v, iFkIfZero);\r\n  }\r\n}\r\n\r\n/*\r\n** This function returns a pointer to the head of a linked list of FK\r\n** constraints for which table pTab is the parent table. For example,\r\n** given the following schema:\r\n**\r\n**   CREATE TABLE t1(a PRIMARY KEY);\r\n**   CREATE TABLE t2(b REFERENCES t1(a);\r\n**\r\n** Calling this function with table \"t1\" as an argument returns a pointer\r\n** to the FKey structure representing the foreign key constraint on table\r\n** \"t2\". Calling this function with \"t2\" as the argument would return a\r\n** NULL pointer (as there are no FK constraints for which t2 is the parent\r\n** table).\r\n*/\r\nSQLITE_PRIVATE FKey *sqlite3FkReferences(Table *pTab){\r\n  int nName = sqlite3Strlen30(pTab->zName);\r\n  return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName, nName);\r\n}\r\n\r\n/*\r\n** The second argument is a Trigger structure allocated by the \r\n** fkActionTrigger() routine. This function deletes the Trigger structure\r\n** and all of its sub-components.\r\n**\r\n** The Trigger structure or any of its sub-components may be allocated from\r\n** the lookaside buffer belonging to database handle dbMem.\r\n*/\r\nstatic void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){\r\n  if( p ){\r\n    TriggerStep *pStep = p->step_list;\r\n    sqlite3ExprDelete(dbMem, pStep->pWhere);\r\n    sqlite3ExprListDelete(dbMem, pStep->pExprList);\r\n    sqlite3SelectDelete(dbMem, pStep->pSelect);\r\n    sqlite3ExprDelete(dbMem, p->pWhen);\r\n    sqlite3DbFree(dbMem, p);\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called to generate code that runs when table pTab is\r\n** being dropped from the database. The SrcList passed as the second argument\r\n** to this function contains a single entry guaranteed to resolve to\r\n** table pTab.\r\n**\r\n** Normally, no code is required. However, if either\r\n**\r\n**   (a) The table is the parent table of a FK constraint, or\r\n**   (b) The table is the child table of a deferred FK constraint and it is\r\n**       determined at runtime that there are outstanding deferred FK \r\n**       constraint violations in the database,\r\n**\r\n** then the equivalent of \"DELETE FROM <tbl>\" is executed before dropping\r\n** the table from the database. Triggers are disabled while running this\r\n** DELETE, but foreign key actions are not.\r\n*/\r\nSQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){\r\n  sqlite3 *db = pParse->db;\r\n  if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){\r\n    int iSkip = 0;\r\n    Vdbe *v = sqlite3GetVdbe(pParse);\r\n\r\n    assert( v );                  /* VDBE has already been allocated */\r\n    if( sqlite3FkReferences(pTab)==0 ){\r\n      /* Search for a deferred foreign key constraint for which this table\r\n      ** is the child table. If one cannot be found, return without \r\n      ** generating any VDBE code. If one can be found, then jump over\r\n      ** the entire DELETE if there are no outstanding deferred constraints\r\n      ** when this statement is run.  */\r\n      FKey *p;\r\n      for(p=pTab->pFKey; p; p=p->pNextFrom){\r\n        if( p->isDeferred ) break;\r\n      }\r\n      if( !p ) return;\r\n      iSkip = sqlite3VdbeMakeLabel(v);\r\n      sqlite3VdbeAddOp2(v, OP_FkIfZero, 1, iSkip);\r\n    }\r\n\r\n    pParse->disableTriggers = 1;\r\n    sqlite3DeleteFrom(pParse, sqlite3SrcListDup(db, pName, 0), 0);\r\n    pParse->disableTriggers = 0;\r\n\r\n    /* If the DELETE has generated immediate foreign key constraint \r\n    ** violations, halt the VDBE and return an error at this point, before\r\n    ** any modifications to the schema are made. This is because statement\r\n    ** transactions are not able to rollback schema changes.  */\r\n    sqlite3VdbeAddOp2(v, OP_FkIfZero, 0, sqlite3VdbeCurrentAddr(v)+2);\r\n    sqlite3HaltConstraint(\r\n        pParse, OE_Abort, \"foreign key constraint failed\", P4_STATIC\r\n    );\r\n\r\n    if( iSkip ){\r\n      sqlite3VdbeResolveLabel(v, iSkip);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called when inserting, deleting or updating a row of\r\n** table pTab to generate VDBE code to perform foreign key constraint \r\n** processing for the operation.\r\n**\r\n** For a DELETE operation, parameter regOld is passed the index of the\r\n** first register in an array of (pTab->nCol+1) registers containing the\r\n** rowid of the row being deleted, followed by each of the column values\r\n** of the row being deleted, from left to right. Parameter regNew is passed\r\n** zero in this case.\r\n**\r\n** For an INSERT operation, regOld is passed zero and regNew is passed the\r\n** first register of an array of (pTab->nCol+1) registers containing the new\r\n** row data.\r\n**\r\n** For an UPDATE operation, this function is called twice. Once before\r\n** the original record is deleted from the table using the calling convention\r\n** described for DELETE. Then again after the original record is deleted\r\n** but before the new record is inserted using the INSERT convention. \r\n*/\r\nSQLITE_PRIVATE void sqlite3FkCheck(\r\n  Parse *pParse,                  /* Parse context */\r\n  Table *pTab,                    /* Row is being deleted from this table */ \r\n  int regOld,                     /* Previous row data is stored here */\r\n  int regNew                      /* New row data is stored here */\r\n){\r\n  sqlite3 *db = pParse->db;       /* Database handle */\r\n  FKey *pFKey;                    /* Used to iterate through FKs */\r\n  int iDb;                        /* Index of database containing pTab */\r\n  const char *zDb;                /* Name of database containing pTab */\r\n  int isIgnoreErrors = pParse->disableTriggers;\r\n\r\n  /* Exactly one of regOld and regNew should be non-zero. */\r\n  assert( (regOld==0)!=(regNew==0) );\r\n\r\n  /* If foreign-keys are disabled, this function is a no-op. */\r\n  if( (db->flags&SQLITE_ForeignKeys)==0 ) return;\r\n\r\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n  zDb = db->aDb[iDb].zName;\r\n\r\n  /* Loop through all the foreign key constraints for which pTab is the\r\n  ** child table (the table that the foreign key definition is part of).  */\r\n  for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){\r\n    Table *pTo;                   /* Parent table of foreign key pFKey */\r\n    Index *pIdx = 0;              /* Index on key columns in pTo */\r\n    int *aiFree = 0;\r\n    int *aiCol;\r\n    int iCol;\r\n    int i;\r\n    int isIgnore = 0;\r\n\r\n    /* Find the parent table of this foreign key. Also find a unique index \r\n    ** on the parent key columns in the parent table. If either of these \r\n    ** schema items cannot be located, set an error in pParse and return \r\n    ** early.  */\r\n    if( pParse->disableTriggers ){\r\n      pTo = sqlite3FindTable(db, pFKey->zTo, zDb);\r\n    }else{\r\n      pTo = sqlite3LocateTable(pParse, 0, pFKey->zTo, zDb);\r\n    }\r\n    if( !pTo || locateFkeyIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){\r\n      assert( isIgnoreErrors==0 || (regOld!=0 && regNew==0) );\r\n      if( !isIgnoreErrors || db->mallocFailed ) return;\r\n      if( pTo==0 ){\r\n        /* If isIgnoreErrors is true, then a table is being dropped. In this\r\n        ** case SQLite runs a \"DELETE FROM xxx\" on the table being dropped\r\n        ** before actually dropping it in order to check FK constraints.\r\n        ** If the parent table of an FK constraint on the current table is\r\n        ** missing, behave as if it is empty. i.e. decrement the relevant\r\n        ** FK counter for each row of the current table with non-NULL keys.\r\n        */\r\n        Vdbe *v = sqlite3GetVdbe(pParse);\r\n        int iJump = sqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1;\r\n        for(i=0; i<pFKey->nCol; i++){\r\n          int iReg = pFKey->aCol[i].iFrom + regOld + 1;\r\n          sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iJump);\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1);\r\n      }\r\n      continue;\r\n    }\r\n    assert( pFKey->nCol==1 || (aiFree && pIdx) );\r\n\r\n    if( aiFree ){\r\n      aiCol = aiFree;\r\n    }else{\r\n      iCol = pFKey->aCol[0].iFrom;\r\n      aiCol = &iCol;\r\n    }\r\n    for(i=0; i<pFKey->nCol; i++){\r\n      if( aiCol[i]==pTab->iPKey ){\r\n        aiCol[i] = -1;\r\n      }\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n      /* Request permission to read the parent key columns. If the \r\n      ** authorization callback returns SQLITE_IGNORE, behave as if any\r\n      ** values read from the parent table are NULL. */\r\n      if( db->xAuth ){\r\n        int rcauth;\r\n        char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName;\r\n        rcauth = sqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb);\r\n        isIgnore = (rcauth==SQLITE_IGNORE);\r\n      }\r\n#endif\r\n    }\r\n\r\n    /* Take a shared-cache advisory read-lock on the parent table. Allocate \r\n    ** a cursor to use to search the unique index on the parent key columns \r\n    ** in the parent table.  */\r\n    sqlite3TableLock(pParse, iDb, pTo->tnum, 0, pTo->zName);\r\n    pParse->nTab++;\r\n\r\n    if( regOld!=0 ){\r\n      /* A row is being removed from the child table. Search for the parent.\r\n      ** If the parent does not exist, removing the child row resolves an \r\n      ** outstanding foreign key constraint violation. */\r\n      fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regOld, -1,isIgnore);\r\n    }\r\n    if( regNew!=0 ){\r\n      /* A row is being added to the child table. If a parent row cannot\r\n      ** be found, adding the child row has violated the FK constraint. */ \r\n      fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1,isIgnore);\r\n    }\r\n\r\n    sqlite3DbFree(db, aiFree);\r\n  }\r\n\r\n  /* Loop through all the foreign key constraints that refer to this table */\r\n  for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){\r\n    Index *pIdx = 0;              /* Foreign key index for pFKey */\r\n    SrcList *pSrc;\r\n    int *aiCol = 0;\r\n\r\n    if( !pFKey->isDeferred && !pParse->pToplevel && !pParse->isMultiWrite ){\r\n      assert( regOld==0 && regNew!=0 );\r\n      /* Inserting a single row into a parent table cannot cause an immediate\r\n      ** foreign key violation. So do nothing in this case.  */\r\n      continue;\r\n    }\r\n\r\n    if( locateFkeyIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){\r\n      if( !isIgnoreErrors || db->mallocFailed ) return;\r\n      continue;\r\n    }\r\n    assert( aiCol || pFKey->nCol==1 );\r\n\r\n    /* Create a SrcList structure containing a single table (the table \r\n    ** the foreign key that refers to this table is attached to). This\r\n    ** is required for the sqlite3WhereXXX() interface.  */\r\n    pSrc = sqlite3SrcListAppend(db, 0, 0, 0);\r\n    if( pSrc ){\r\n      struct SrcList_item *pItem = pSrc->a;\r\n      pItem->pTab = pFKey->pFrom;\r\n      pItem->zName = pFKey->pFrom->zName;\r\n      pItem->pTab->nRef++;\r\n      pItem->iCursor = pParse->nTab++;\r\n  \r\n      if( regNew!=0 ){\r\n        fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);\r\n      }\r\n      if( regOld!=0 ){\r\n        /* If there is a RESTRICT action configured for the current operation\r\n        ** on the parent table of this FK, then throw an exception \r\n        ** immediately if the FK constraint is violated, even if this is a\r\n        ** deferred trigger. That's what RESTRICT means. To defer checking\r\n        ** the constraint, the FK should specify NO ACTION (represented\r\n        ** using OE_None). NO ACTION is the default.  */\r\n        fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);\r\n      }\r\n      pItem->zName = 0;\r\n      sqlite3SrcListDelete(db, pSrc);\r\n    }\r\n    sqlite3DbFree(db, aiCol);\r\n  }\r\n}\r\n\r\n#define COLUMN_MASK(x) (((x)>31) ? 0xffffffff : ((u32)1<<(x)))\r\n\r\n/*\r\n** This function is called before generating code to update or delete a \r\n** row contained in table pTab.\r\n*/\r\nSQLITE_PRIVATE u32 sqlite3FkOldmask(\r\n  Parse *pParse,                  /* Parse context */\r\n  Table *pTab                     /* Table being modified */\r\n){\r\n  u32 mask = 0;\r\n  if( pParse->db->flags&SQLITE_ForeignKeys ){\r\n    FKey *p;\r\n    int i;\r\n    for(p=pTab->pFKey; p; p=p->pNextFrom){\r\n      for(i=0; i<p->nCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom);\r\n    }\r\n    for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\r\n      Index *pIdx = 0;\r\n      locateFkeyIndex(pParse, pTab, p, &pIdx, 0);\r\n      if( pIdx ){\r\n        for(i=0; i<pIdx->nColumn; i++) mask |= COLUMN_MASK(pIdx->aiColumn[i]);\r\n      }\r\n    }\r\n  }\r\n  return mask;\r\n}\r\n\r\n/*\r\n** This function is called before generating code to update or delete a \r\n** row contained in table pTab. If the operation is a DELETE, then\r\n** parameter aChange is passed a NULL value. For an UPDATE, aChange points\r\n** to an array of size N, where N is the number of columns in table pTab.\r\n** If the i'th column is not modified by the UPDATE, then the corresponding \r\n** entry in the aChange[] array is set to -1. If the column is modified,\r\n** the value is 0 or greater. Parameter chngRowid is set to true if the\r\n** UPDATE statement modifies the rowid fields of the table.\r\n**\r\n** If any foreign key processing will be required, this function returns\r\n** true. If there is no foreign key related processing, this function \r\n** returns false.\r\n*/\r\nSQLITE_PRIVATE int sqlite3FkRequired(\r\n  Parse *pParse,                  /* Parse context */\r\n  Table *pTab,                    /* Table being modified */\r\n  int *aChange,                   /* Non-NULL for UPDATE operations */\r\n  int chngRowid                   /* True for UPDATE that affects rowid */\r\n){\r\n  if( pParse->db->flags&SQLITE_ForeignKeys ){\r\n    if( !aChange ){\r\n      /* A DELETE operation. Foreign key processing is required if the \r\n      ** table in question is either the child or parent table for any \r\n      ** foreign key constraint.  */\r\n      return (sqlite3FkReferences(pTab) || pTab->pFKey);\r\n    }else{\r\n      /* This is an UPDATE. Foreign key processing is only required if the\r\n      ** operation modifies one or more child or parent key columns. */\r\n      int i;\r\n      FKey *p;\r\n\r\n      /* Check if any child key columns are being modified. */\r\n      for(p=pTab->pFKey; p; p=p->pNextFrom){\r\n        for(i=0; i<p->nCol; i++){\r\n          int iChildKey = p->aCol[i].iFrom;\r\n          if( aChange[iChildKey]>=0 ) return 1;\r\n          if( iChildKey==pTab->iPKey && chngRowid ) return 1;\r\n        }\r\n      }\r\n\r\n      /* Check if any parent key columns are being modified. */\r\n      for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\r\n        for(i=0; i<p->nCol; i++){\r\n          char *zKey = p->aCol[i].zCol;\r\n          int iKey;\r\n          for(iKey=0; iKey<pTab->nCol; iKey++){\r\n            Column *pCol = &pTab->aCol[iKey];\r\n            if( (zKey ? !sqlite3StrICmp(pCol->zName, zKey) : pCol->isPrimKey) ){\r\n              if( aChange[iKey]>=0 ) return 1;\r\n              if( iKey==pTab->iPKey && chngRowid ) return 1;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** This function is called when an UPDATE or DELETE operation is being \r\n** compiled on table pTab, which is the parent table of foreign-key pFKey.\r\n** If the current operation is an UPDATE, then the pChanges parameter is\r\n** passed a pointer to the list of columns being modified. If it is a\r\n** DELETE, pChanges is passed a NULL pointer.\r\n**\r\n** It returns a pointer to a Trigger structure containing a trigger\r\n** equivalent to the ON UPDATE or ON DELETE action specified by pFKey.\r\n** If the action is \"NO ACTION\" or \"RESTRICT\", then a NULL pointer is\r\n** returned (these actions require no special handling by the triggers\r\n** sub-system, code for them is created by fkScanChildren()).\r\n**\r\n** For example, if pFKey is the foreign key and pTab is table \"p\" in \r\n** the following schema:\r\n**\r\n**   CREATE TABLE p(pk PRIMARY KEY);\r\n**   CREATE TABLE c(ck REFERENCES p ON DELETE CASCADE);\r\n**\r\n** then the returned trigger structure is equivalent to:\r\n**\r\n**   CREATE TRIGGER ... DELETE ON p BEGIN\r\n**     DELETE FROM c WHERE ck = old.pk;\r\n**   END;\r\n**\r\n** The returned pointer is cached as part of the foreign key object. It\r\n** is eventually freed along with the rest of the foreign key object by \r\n** sqlite3FkDelete().\r\n*/\r\nstatic Trigger *fkActionTrigger(\r\n  Parse *pParse,                  /* Parse context */\r\n  Table *pTab,                    /* Table being updated or deleted from */\r\n  FKey *pFKey,                    /* Foreign key to get action for */\r\n  ExprList *pChanges              /* Change-list for UPDATE, NULL for DELETE */\r\n){\r\n  sqlite3 *db = pParse->db;       /* Database handle */\r\n  int action;                     /* One of OE_None, OE_Cascade etc. */\r\n  Trigger *pTrigger;              /* Trigger definition to return */\r\n  int iAction = (pChanges!=0);    /* 1 for UPDATE, 0 for DELETE */\r\n\r\n  action = pFKey->aAction[iAction];\r\n  pTrigger = pFKey->apTrigger[iAction];\r\n\r\n  if( action!=OE_None && !pTrigger ){\r\n    u8 enableLookaside;           /* Copy of db->lookaside.bEnabled */\r\n    char const *zFrom;            /* Name of child table */\r\n    int nFrom;                    /* Length in bytes of zFrom */\r\n    Index *pIdx = 0;              /* Parent key index for this FK */\r\n    int *aiCol = 0;               /* child table cols -> parent key cols */\r\n    TriggerStep *pStep = 0;        /* First (only) step of trigger program */\r\n    Expr *pWhere = 0;             /* WHERE clause of trigger step */\r\n    ExprList *pList = 0;          /* Changes list if ON UPDATE CASCADE */\r\n    Select *pSelect = 0;          /* If RESTRICT, \"SELECT RAISE(...)\" */\r\n    int i;                        /* Iterator variable */\r\n    Expr *pWhen = 0;              /* WHEN clause for the trigger */\r\n\r\n    if( locateFkeyIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;\r\n    assert( aiCol || pFKey->nCol==1 );\r\n\r\n    for(i=0; i<pFKey->nCol; i++){\r\n      Token tOld = { \"old\", 3 };  /* Literal \"old\" token */\r\n      Token tNew = { \"new\", 3 };  /* Literal \"new\" token */\r\n      Token tFromCol;             /* Name of column in child table */\r\n      Token tToCol;               /* Name of column in parent table */\r\n      int iFromCol;               /* Idx of column in child table */\r\n      Expr *pEq;                  /* tFromCol = OLD.tToCol */\r\n\r\n      iFromCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;\r\n      assert( iFromCol>=0 );\r\n      tToCol.z = pIdx ? pTab->aCol[pIdx->aiColumn[i]].zName : \"oid\";\r\n      tFromCol.z = pFKey->pFrom->aCol[iFromCol].zName;\r\n\r\n      tToCol.n = sqlite3Strlen30(tToCol.z);\r\n      tFromCol.n = sqlite3Strlen30(tFromCol.z);\r\n\r\n      /* Create the expression \"OLD.zToCol = zFromCol\". It is important\r\n      ** that the \"OLD.zToCol\" term is on the LHS of the = operator, so\r\n      ** that the affinity and collation sequence associated with the\r\n      ** parent table are used for the comparison. */\r\n      pEq = sqlite3PExpr(pParse, TK_EQ,\r\n          sqlite3PExpr(pParse, TK_DOT, \r\n            sqlite3PExpr(pParse, TK_ID, 0, 0, &tOld),\r\n            sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol)\r\n          , 0),\r\n          sqlite3PExpr(pParse, TK_ID, 0, 0, &tFromCol)\r\n      , 0);\r\n      pWhere = sqlite3ExprAnd(db, pWhere, pEq);\r\n\r\n      /* For ON UPDATE, construct the next term of the WHEN clause.\r\n      ** The final WHEN clause will be like this:\r\n      **\r\n      **    WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN)\r\n      */\r\n      if( pChanges ){\r\n        pEq = sqlite3PExpr(pParse, TK_IS,\r\n            sqlite3PExpr(pParse, TK_DOT, \r\n              sqlite3PExpr(pParse, TK_ID, 0, 0, &tOld),\r\n              sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol),\r\n              0),\r\n            sqlite3PExpr(pParse, TK_DOT, \r\n              sqlite3PExpr(pParse, TK_ID, 0, 0, &tNew),\r\n              sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol),\r\n              0),\r\n            0);\r\n        pWhen = sqlite3ExprAnd(db, pWhen, pEq);\r\n      }\r\n  \r\n      if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){\r\n        Expr *pNew;\r\n        if( action==OE_Cascade ){\r\n          pNew = sqlite3PExpr(pParse, TK_DOT, \r\n            sqlite3PExpr(pParse, TK_ID, 0, 0, &tNew),\r\n            sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol)\r\n          , 0);\r\n        }else if( action==OE_SetDflt ){\r\n          Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt;\r\n          if( pDflt ){\r\n            pNew = sqlite3ExprDup(db, pDflt, 0);\r\n          }else{\r\n            pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);\r\n          }\r\n        }else{\r\n          pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);\r\n        }\r\n        pList = sqlite3ExprListAppend(pParse, pList, pNew);\r\n        sqlite3ExprListSetName(pParse, pList, &tFromCol, 0);\r\n      }\r\n    }\r\n    sqlite3DbFree(db, aiCol);\r\n\r\n    zFrom = pFKey->pFrom->zName;\r\n    nFrom = sqlite3Strlen30(zFrom);\r\n\r\n    if( action==OE_Restrict ){\r\n      Token tFrom;\r\n      Expr *pRaise; \r\n\r\n      tFrom.z = zFrom;\r\n      tFrom.n = nFrom;\r\n      pRaise = sqlite3Expr(db, TK_RAISE, \"foreign key constraint failed\");\r\n      if( pRaise ){\r\n        pRaise->affinity = OE_Abort;\r\n      }\r\n      pSelect = sqlite3SelectNew(pParse, \r\n          sqlite3ExprListAppend(pParse, 0, pRaise),\r\n          sqlite3SrcListAppend(db, 0, &tFrom, 0),\r\n          pWhere,\r\n          0, 0, 0, 0, 0, 0\r\n      );\r\n      pWhere = 0;\r\n    }\r\n\r\n    /* Disable lookaside memory allocation */\r\n    enableLookaside = db->lookaside.bEnabled;\r\n    db->lookaside.bEnabled = 0;\r\n\r\n    pTrigger = (Trigger *)sqlite3DbMallocZero(db, \r\n        sizeof(Trigger) +         /* struct Trigger */\r\n        sizeof(TriggerStep) +     /* Single step in trigger program */\r\n        nFrom + 1                 /* Space for pStep->target.z */\r\n    );\r\n    if( pTrigger ){\r\n      pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1];\r\n      pStep->target.z = (char *)&pStep[1];\r\n      pStep->target.n = nFrom;\r\n      memcpy((char *)pStep->target.z, zFrom, nFrom);\r\n  \r\n      pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);\r\n      pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE);\r\n      pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);\r\n      if( pWhen ){\r\n        pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0, 0);\r\n        pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE);\r\n      }\r\n    }\r\n\r\n    /* Re-enable the lookaside buffer, if it was disabled earlier. */\r\n    db->lookaside.bEnabled = enableLookaside;\r\n\r\n    sqlite3ExprDelete(db, pWhere);\r\n    sqlite3ExprDelete(db, pWhen);\r\n    sqlite3ExprListDelete(db, pList);\r\n    sqlite3SelectDelete(db, pSelect);\r\n    if( db->mallocFailed==1 ){\r\n      fkTriggerDelete(db, pTrigger);\r\n      return 0;\r\n    }\r\n    assert( pStep!=0 );\r\n\r\n    switch( action ){\r\n      case OE_Restrict:\r\n        pStep->op = TK_SELECT; \r\n        break;\r\n      case OE_Cascade: \r\n        if( !pChanges ){ \r\n          pStep->op = TK_DELETE; \r\n          break; \r\n        }\r\n      default:\r\n        pStep->op = TK_UPDATE;\r\n    }\r\n    pStep->pTrig = pTrigger;\r\n    pTrigger->pSchema = pTab->pSchema;\r\n    pTrigger->pTabSchema = pTab->pSchema;\r\n    pFKey->apTrigger[iAction] = pTrigger;\r\n    pTrigger->op = (pChanges ? TK_UPDATE : TK_DELETE);\r\n  }\r\n\r\n  return pTrigger;\r\n}\r\n\r\n/*\r\n** This function is called when deleting or updating a row to implement\r\n** any required CASCADE, SET NULL or SET DEFAULT actions.\r\n*/\r\nSQLITE_PRIVATE void sqlite3FkActions(\r\n  Parse *pParse,                  /* Parse context */\r\n  Table *pTab,                    /* Table being updated or deleted from */\r\n  ExprList *pChanges,             /* Change-list for UPDATE, NULL for DELETE */\r\n  int regOld                      /* Address of array containing old row */\r\n){\r\n  /* If foreign-key support is enabled, iterate through all FKs that \r\n  ** refer to table pTab. If there is an action associated with the FK \r\n  ** for this operation (either update or delete), invoke the associated \r\n  ** trigger sub-program.  */\r\n  if( pParse->db->flags&SQLITE_ForeignKeys ){\r\n    FKey *pFKey;                  /* Iterator variable */\r\n    for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){\r\n      Trigger *pAction = fkActionTrigger(pParse, pTab, pFKey, pChanges);\r\n      if( pAction ){\r\n        sqlite3CodeRowTriggerDirect(pParse, pAction, pTab, regOld, OE_Abort, 0);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n#endif /* ifndef SQLITE_OMIT_TRIGGER */\r\n\r\n/*\r\n** Free all memory associated with foreign key definitions attached to\r\n** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash\r\n** hash table.\r\n*/\r\nSQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){\r\n  FKey *pFKey;                    /* Iterator variable */\r\n  FKey *pNext;                    /* Copy of pFKey->pNextFrom */\r\n\r\n  assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );\r\n  for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){\r\n\r\n    /* Remove the FK from the fkeyHash hash table. */\r\n    if( !db || db->pnBytesFreed==0 ){\r\n      if( pFKey->pPrevTo ){\r\n        pFKey->pPrevTo->pNextTo = pFKey->pNextTo;\r\n      }else{\r\n        void *p = (void *)pFKey->pNextTo;\r\n        const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo);\r\n        sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, sqlite3Strlen30(z), p);\r\n      }\r\n      if( pFKey->pNextTo ){\r\n        pFKey->pNextTo->pPrevTo = pFKey->pPrevTo;\r\n      }\r\n    }\r\n\r\n    /* EV: R-30323-21917 Each foreign key constraint in SQLite is\r\n    ** classified as either immediate or deferred.\r\n    */\r\n    assert( pFKey->isDeferred==0 || pFKey->isDeferred==1 );\r\n\r\n    /* Delete any triggers created to implement actions for this FK. */\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n    fkTriggerDelete(db, pFKey->apTrigger[0]);\r\n    fkTriggerDelete(db, pFKey->apTrigger[1]);\r\n#endif\r\n\r\n    pNext = pFKey->pNextFrom;\r\n    sqlite3DbFree(db, pFKey);\r\n  }\r\n}\r\n#endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */\r\n\r\n/************** End of fkey.c ************************************************/\r\n/************** Begin file insert.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains C code routines that are called by the parser\r\n** to handle INSERT statements in SQLite.\r\n*/\r\n\r\n/*\r\n** Generate code that will open a table for reading.\r\n*/\r\nSQLITE_PRIVATE void sqlite3OpenTable(\r\n  Parse *p,       /* Generate code into this VDBE */\r\n  int iCur,       /* The cursor number of the table */\r\n  int iDb,        /* The database index in sqlite3.aDb[] */\r\n  Table *pTab,    /* The table to be opened */\r\n  int opcode      /* OP_OpenRead or OP_OpenWrite */\r\n){\r\n  Vdbe *v;\r\n  if( IsVirtual(pTab) ) return;\r\n  v = sqlite3GetVdbe(p);\r\n  assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );\r\n  sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite)?1:0, pTab->zName);\r\n  sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb);\r\n  sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(pTab->nCol), P4_INT32);\r\n  VdbeComment((v, \"%s\", pTab->zName));\r\n}\r\n\r\n/*\r\n** Return a pointer to the column affinity string associated with index\r\n** pIdx. A column affinity string has one character for each column in \r\n** the table, according to the affinity of the column:\r\n**\r\n**  Character      Column affinity\r\n**  ------------------------------\r\n**  'a'            TEXT\r\n**  'b'            NONE\r\n**  'c'            NUMERIC\r\n**  'd'            INTEGER\r\n**  'e'            REAL\r\n**\r\n** An extra 'd' is appended to the end of the string to cover the\r\n** rowid that appears as the last column in every index.\r\n**\r\n** Memory for the buffer containing the column index affinity string\r\n** is managed along with the rest of the Index structure. It will be\r\n** released when sqlite3DeleteIndex() is called.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){\r\n  if( !pIdx->zColAff ){\r\n    /* The first time a column affinity string for a particular index is\r\n    ** required, it is allocated and populated here. It is then stored as\r\n    ** a member of the Index structure for subsequent use.\r\n    **\r\n    ** The column affinity string will eventually be deleted by\r\n    ** sqliteDeleteIndex() when the Index structure itself is cleaned\r\n    ** up.\r\n    */\r\n    int n;\r\n    Table *pTab = pIdx->pTable;\r\n    sqlite3 *db = sqlite3VdbeDb(v);\r\n    pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+2);\r\n    if( !pIdx->zColAff ){\r\n      db->mallocFailed = 1;\r\n      return 0;\r\n    }\r\n    for(n=0; n<pIdx->nColumn; n++){\r\n      pIdx->zColAff[n] = pTab->aCol[pIdx->aiColumn[n]].affinity;\r\n    }\r\n    pIdx->zColAff[n++] = SQLITE_AFF_INTEGER;\r\n    pIdx->zColAff[n] = 0;\r\n  }\r\n \r\n  return pIdx->zColAff;\r\n}\r\n\r\n/*\r\n** Set P4 of the most recently inserted opcode to a column affinity\r\n** string for table pTab. A column affinity string has one character\r\n** for each column indexed by the index, according to the affinity of the\r\n** column:\r\n**\r\n**  Character      Column affinity\r\n**  ------------------------------\r\n**  'a'            TEXT\r\n**  'b'            NONE\r\n**  'c'            NUMERIC\r\n**  'd'            INTEGER\r\n**  'e'            REAL\r\n*/\r\nSQLITE_PRIVATE void sqlite3TableAffinityStr(Vdbe *v, Table *pTab){\r\n  /* The first time a column affinity string for a particular table\r\n  ** is required, it is allocated and populated here. It is then \r\n  ** stored as a member of the Table structure for subsequent use.\r\n  **\r\n  ** The column affinity string will eventually be deleted by\r\n  ** sqlite3DeleteTable() when the Table structure itself is cleaned up.\r\n  */\r\n  if( !pTab->zColAff ){\r\n    char *zColAff;\r\n    int i;\r\n    sqlite3 *db = sqlite3VdbeDb(v);\r\n\r\n    zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1);\r\n    if( !zColAff ){\r\n      db->mallocFailed = 1;\r\n      return;\r\n    }\r\n\r\n    for(i=0; i<pTab->nCol; i++){\r\n      zColAff[i] = pTab->aCol[i].affinity;\r\n    }\r\n    zColAff[pTab->nCol] = '\\0';\r\n\r\n    pTab->zColAff = zColAff;\r\n  }\r\n\r\n  sqlite3VdbeChangeP4(v, -1, pTab->zColAff, P4_TRANSIENT);\r\n}\r\n\r\n/*\r\n** Return non-zero if the table pTab in database iDb or any of its indices\r\n** have been opened at any point in the VDBE program beginning at location\r\n** iStartAddr throught the end of the program.  This is used to see if \r\n** a statement of the form  \"INSERT INTO <iDb, pTab> SELECT ...\" can \r\n** run without using temporary table for the results of the SELECT. \r\n*/\r\nstatic int readsTable(Parse *p, int iStartAddr, int iDb, Table *pTab){\r\n  Vdbe *v = sqlite3GetVdbe(p);\r\n  int i;\r\n  int iEnd = sqlite3VdbeCurrentAddr(v);\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0;\r\n#endif\r\n\r\n  for(i=iStartAddr; i<iEnd; i++){\r\n    VdbeOp *pOp = sqlite3VdbeGetOp(v, i);\r\n    assert( pOp!=0 );\r\n    if( pOp->opcode==OP_OpenRead && pOp->p3==iDb ){\r\n      Index *pIndex;\r\n      int tnum = pOp->p2;\r\n      if( tnum==pTab->tnum ){\r\n        return 1;\r\n      }\r\n      for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){\r\n        if( tnum==pIndex->tnum ){\r\n          return 1;\r\n        }\r\n      }\r\n    }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    if( pOp->opcode==OP_VOpen && pOp->p4.pVtab==pVTab ){\r\n      assert( pOp->p4.pVtab!=0 );\r\n      assert( pOp->p4type==P4_VTAB );\r\n      return 1;\r\n    }\r\n#endif\r\n  }\r\n  return 0;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_AUTOINCREMENT\r\n/*\r\n** Locate or create an AutoincInfo structure associated with table pTab\r\n** which is in database iDb.  Return the register number for the register\r\n** that holds the maximum rowid.\r\n**\r\n** There is at most one AutoincInfo structure per table even if the\r\n** same table is autoincremented multiple times due to inserts within\r\n** triggers.  A new AutoincInfo structure is created if this is the\r\n** first use of table pTab.  On 2nd and subsequent uses, the original\r\n** AutoincInfo structure is used.\r\n**\r\n** Three memory locations are allocated:\r\n**\r\n**   (1)  Register to hold the name of the pTab table.\r\n**   (2)  Register to hold the maximum ROWID of pTab.\r\n**   (3)  Register to hold the rowid in sqlite_sequence of pTab\r\n**\r\n** The 2nd register is the one that is returned.  That is all the\r\n** insert routine needs to know about.\r\n*/\r\nstatic int autoIncBegin(\r\n  Parse *pParse,      /* Parsing context */\r\n  int iDb,            /* Index of the database holding pTab */\r\n  Table *pTab         /* The table we are writing to */\r\n){\r\n  int memId = 0;      /* Register holding maximum rowid */\r\n  if( pTab->tabFlags & TF_Autoincrement ){\r\n    Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n    AutoincInfo *pInfo;\r\n\r\n    pInfo = pToplevel->pAinc;\r\n    while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }\r\n    if( pInfo==0 ){\r\n      pInfo = sqlite3DbMallocRaw(pParse->db, sizeof(*pInfo));\r\n      if( pInfo==0 ) return 0;\r\n      pInfo->pNext = pToplevel->pAinc;\r\n      pToplevel->pAinc = pInfo;\r\n      pInfo->pTab = pTab;\r\n      pInfo->iDb = iDb;\r\n      pToplevel->nMem++;                  /* Register to hold name of table */\r\n      pInfo->regCtr = ++pToplevel->nMem;  /* Max rowid register */\r\n      pToplevel->nMem++;                  /* Rowid in sqlite_sequence */\r\n    }\r\n    memId = pInfo->regCtr;\r\n  }\r\n  return memId;\r\n}\r\n\r\n/*\r\n** This routine generates code that will initialize all of the\r\n** register used by the autoincrement tracker.  \r\n*/\r\nSQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){\r\n  AutoincInfo *p;            /* Information about an AUTOINCREMENT */\r\n  sqlite3 *db = pParse->db;  /* The database connection */\r\n  Db *pDb;                   /* Database only autoinc table */\r\n  int memId;                 /* Register holding max rowid */\r\n  int addr;                  /* A VDBE address */\r\n  Vdbe *v = pParse->pVdbe;   /* VDBE under construction */\r\n\r\n  /* This routine is never called during trigger-generation.  It is\r\n  ** only called from the top-level */\r\n  assert( pParse->pTriggerTab==0 );\r\n  assert( pParse==sqlite3ParseToplevel(pParse) );\r\n\r\n  assert( v );   /* We failed long ago if this is not so */\r\n  for(p = pParse->pAinc; p; p = p->pNext){\r\n    pDb = &db->aDb[p->iDb];\r\n    memId = p->regCtr;\r\n    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );\r\n    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);\r\n    sqlite3VdbeAddOp3(v, OP_Null, 0, memId, memId+1);\r\n    addr = sqlite3VdbeCurrentAddr(v);\r\n    sqlite3VdbeAddOp4(v, OP_String8, 0, memId-1, 0, p->pTab->zName, 0);\r\n    sqlite3VdbeAddOp2(v, OP_Rewind, 0, addr+9);\r\n    sqlite3VdbeAddOp3(v, OP_Column, 0, 0, memId);\r\n    sqlite3VdbeAddOp3(v, OP_Ne, memId-1, addr+7, memId);\r\n    sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL);\r\n    sqlite3VdbeAddOp2(v, OP_Rowid, 0, memId+1);\r\n    sqlite3VdbeAddOp3(v, OP_Column, 0, 1, memId);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr+9);\r\n    sqlite3VdbeAddOp2(v, OP_Next, 0, addr+2);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, memId);\r\n    sqlite3VdbeAddOp0(v, OP_Close);\r\n  }\r\n}\r\n\r\n/*\r\n** Update the maximum rowid for an autoincrement calculation.\r\n**\r\n** This routine should be called when the top of the stack holds a\r\n** new rowid that is about to be inserted.  If that new rowid is\r\n** larger than the maximum rowid in the memId memory cell, then the\r\n** memory cell is updated.  The stack is unchanged.\r\n*/\r\nstatic void autoIncStep(Parse *pParse, int memId, int regRowid){\r\n  if( memId>0 ){\r\n    sqlite3VdbeAddOp2(pParse->pVdbe, OP_MemMax, memId, regRowid);\r\n  }\r\n}\r\n\r\n/*\r\n** This routine generates the code needed to write autoincrement\r\n** maximum rowid values back into the sqlite_sequence register.\r\n** Every statement that might do an INSERT into an autoincrement\r\n** table (either directly or through triggers) needs to call this\r\n** routine just before the \"exit\" code.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){\r\n  AutoincInfo *p;\r\n  Vdbe *v = pParse->pVdbe;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  assert( v );\r\n  for(p = pParse->pAinc; p; p = p->pNext){\r\n    Db *pDb = &db->aDb[p->iDb];\r\n    int j1, j2, j3, j4, j5;\r\n    int iRec;\r\n    int memId = p->regCtr;\r\n\r\n    iRec = sqlite3GetTempReg(pParse);\r\n    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );\r\n    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);\r\n    j1 = sqlite3VdbeAddOp1(v, OP_NotNull, memId+1);\r\n    j2 = sqlite3VdbeAddOp0(v, OP_Rewind);\r\n    j3 = sqlite3VdbeAddOp3(v, OP_Column, 0, 0, iRec);\r\n    j4 = sqlite3VdbeAddOp3(v, OP_Eq, memId-1, 0, iRec);\r\n    sqlite3VdbeAddOp2(v, OP_Next, 0, j3);\r\n    sqlite3VdbeJumpHere(v, j2);\r\n    sqlite3VdbeAddOp2(v, OP_NewRowid, 0, memId+1);\r\n    j5 = sqlite3VdbeAddOp0(v, OP_Goto);\r\n    sqlite3VdbeJumpHere(v, j4);\r\n    sqlite3VdbeAddOp2(v, OP_Rowid, 0, memId+1);\r\n    sqlite3VdbeJumpHere(v, j1);\r\n    sqlite3VdbeJumpHere(v, j5);\r\n    sqlite3VdbeAddOp3(v, OP_MakeRecord, memId-1, 2, iRec);\r\n    sqlite3VdbeAddOp3(v, OP_Insert, 0, iRec, memId+1);\r\n    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n    sqlite3VdbeAddOp0(v, OP_Close);\r\n    sqlite3ReleaseTempReg(pParse, iRec);\r\n  }\r\n}\r\n#else\r\n/*\r\n** If SQLITE_OMIT_AUTOINCREMENT is defined, then the three routines\r\n** above are all no-ops\r\n*/\r\n# define autoIncBegin(A,B,C) (0)\r\n# define autoIncStep(A,B,C)\r\n#endif /* SQLITE_OMIT_AUTOINCREMENT */\r\n\r\n\r\n/* Forward declaration */\r\nstatic int xferOptimization(\r\n  Parse *pParse,        /* Parser context */\r\n  Table *pDest,         /* The table we are inserting into */\r\n  Select *pSelect,      /* A SELECT statement to use as the data source */\r\n  int onError,          /* How to handle constraint errors */\r\n  int iDbDest           /* The database of pDest */\r\n);\r\n\r\n/*\r\n** This routine is call to handle SQL of the following forms:\r\n**\r\n**    insert into TABLE (IDLIST) values(EXPRLIST)\r\n**    insert into TABLE (IDLIST) select\r\n**\r\n** The IDLIST following the table name is always optional.  If omitted,\r\n** then a list of all columns for the table is substituted.  The IDLIST\r\n** appears in the pColumn parameter.  pColumn is NULL if IDLIST is omitted.\r\n**\r\n** The pList parameter holds EXPRLIST in the first form of the INSERT\r\n** statement above, and pSelect is NULL.  For the second form, pList is\r\n** NULL and pSelect is a pointer to the select statement used to generate\r\n** data for the insert.\r\n**\r\n** The code generated follows one of four templates.  For a simple\r\n** select with data coming from a VALUES clause, the code executes\r\n** once straight down through.  Pseudo-code follows (we call this\r\n** the \"1st template\"):\r\n**\r\n**         open write cursor to <table> and its indices\r\n**         puts VALUES clause expressions onto the stack\r\n**         write the resulting record into <table>\r\n**         cleanup\r\n**\r\n** The three remaining templates assume the statement is of the form\r\n**\r\n**   INSERT INTO <table> SELECT ...\r\n**\r\n** If the SELECT clause is of the restricted form \"SELECT * FROM <table2>\" -\r\n** in other words if the SELECT pulls all columns from a single table\r\n** and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and\r\n** if <table2> and <table1> are distinct tables but have identical\r\n** schemas, including all the same indices, then a special optimization\r\n** is invoked that copies raw records from <table2> over to <table1>.\r\n** See the xferOptimization() function for the implementation of this\r\n** template.  This is the 2nd template.\r\n**\r\n**         open a write cursor to <table>\r\n**         open read cursor on <table2>\r\n**         transfer all records in <table2> over to <table>\r\n**         close cursors\r\n**         foreach index on <table>\r\n**           open a write cursor on the <table> index\r\n**           open a read cursor on the corresponding <table2> index\r\n**           transfer all records from the read to the write cursors\r\n**           close cursors\r\n**         end foreach\r\n**\r\n** The 3rd template is for when the second template does not apply\r\n** and the SELECT clause does not read from <table> at any time.\r\n** The generated code follows this template:\r\n**\r\n**         EOF <- 0\r\n**         X <- A\r\n**         goto B\r\n**      A: setup for the SELECT\r\n**         loop over the rows in the SELECT\r\n**           load values into registers R..R+n\r\n**           yield X\r\n**         end loop\r\n**         cleanup after the SELECT\r\n**         EOF <- 1\r\n**         yield X\r\n**         goto A\r\n**      B: open write cursor to <table> and its indices\r\n**      C: yield X\r\n**         if EOF goto D\r\n**         insert the select result into <table> from R..R+n\r\n**         goto C\r\n**      D: cleanup\r\n**\r\n** The 4th template is used if the insert statement takes its\r\n** values from a SELECT but the data is being inserted into a table\r\n** that is also read as part of the SELECT.  In the third form,\r\n** we have to use a intermediate table to store the results of\r\n** the select.  The template is like this:\r\n**\r\n**         EOF <- 0\r\n**         X <- A\r\n**         goto B\r\n**      A: setup for the SELECT\r\n**         loop over the tables in the SELECT\r\n**           load value into register R..R+n\r\n**           yield X\r\n**         end loop\r\n**         cleanup after the SELECT\r\n**         EOF <- 1\r\n**         yield X\r\n**         halt-error\r\n**      B: open temp table\r\n**      L: yield X\r\n**         if EOF goto M\r\n**         insert row from R..R+n into temp table\r\n**         goto L\r\n**      M: open write cursor to <table> and its indices\r\n**         rewind temp table\r\n**      C: loop over rows of intermediate table\r\n**           transfer values form intermediate table into <table>\r\n**         end loop\r\n**      D: cleanup\r\n*/\r\nSQLITE_PRIVATE void sqlite3Insert(\r\n  Parse *pParse,        /* Parser context */\r\n  SrcList *pTabList,    /* Name of table into which we are inserting */\r\n  ExprList *pList,      /* List of values to be inserted */\r\n  Select *pSelect,      /* A SELECT statement to use as the data source */\r\n  IdList *pColumn,      /* Column names corresponding to IDLIST. */\r\n  int onError           /* How to handle constraint errors */\r\n){\r\n  sqlite3 *db;          /* The main database structure */\r\n  Table *pTab;          /* The table to insert into.  aka TABLE */\r\n  char *zTab;           /* Name of the table into which we are inserting */\r\n  const char *zDb;      /* Name of the database holding this table */\r\n  int i, j, idx;        /* Loop counters */\r\n  Vdbe *v;              /* Generate code into this virtual machine */\r\n  Index *pIdx;          /* For looping over indices of the table */\r\n  int nColumn;          /* Number of columns in the data */\r\n  int nHidden = 0;      /* Number of hidden columns if TABLE is virtual */\r\n  int baseCur = 0;      /* VDBE Cursor number for pTab */\r\n  int keyColumn = -1;   /* Column that is the INTEGER PRIMARY KEY */\r\n  int endOfLoop;        /* Label for the end of the insertion loop */\r\n  int useTempTable = 0; /* Store SELECT results in intermediate table */\r\n  int srcTab = 0;       /* Data comes from this temporary cursor if >=0 */\r\n  int addrInsTop = 0;   /* Jump to label \"D\" */\r\n  int addrCont = 0;     /* Top of insert loop. Label \"C\" in templates 3 and 4 */\r\n  int addrSelect = 0;   /* Address of coroutine that implements the SELECT */\r\n  SelectDest dest;      /* Destination for SELECT on rhs of INSERT */\r\n  int iDb;              /* Index of database holding TABLE */\r\n  Db *pDb;              /* The database containing table being inserted into */\r\n  int appendFlag = 0;   /* True if the insert is likely to be an append */\r\n\r\n  /* Register allocations */\r\n  int regFromSelect = 0;/* Base register for data coming from SELECT */\r\n  int regAutoinc = 0;   /* Register holding the AUTOINCREMENT counter */\r\n  int regRowCount = 0;  /* Memory cell used for the row counter */\r\n  int regIns;           /* Block of regs holding rowid+data being inserted */\r\n  int regRowid;         /* registers holding insert rowid */\r\n  int regData;          /* register holding first column to insert */\r\n  int regEof = 0;       /* Register recording end of SELECT data */\r\n  int *aRegIdx = 0;     /* One register allocated to each index */\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  int isView;                 /* True if attempting to insert into a view */\r\n  Trigger *pTrigger;          /* List of triggers on pTab, if required */\r\n  int tmask;                  /* Mask of trigger times */\r\n#endif\r\n\r\n  db = pParse->db;\r\n  memset(&dest, 0, sizeof(dest));\r\n  if( pParse->nErr || db->mallocFailed ){\r\n    goto insert_cleanup;\r\n  }\r\n\r\n  /* Locate the table into which we will be inserting new information.\r\n  */\r\n  assert( pTabList->nSrc==1 );\r\n  zTab = pTabList->a[0].zName;\r\n  if( NEVER(zTab==0) ) goto insert_cleanup;\r\n  pTab = sqlite3SrcListLookup(pParse, pTabList);\r\n  if( pTab==0 ){\r\n    goto insert_cleanup;\r\n  }\r\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n  assert( iDb<db->nDb );\r\n  pDb = &db->aDb[iDb];\r\n  zDb = pDb->zName;\r\n  if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){\r\n    goto insert_cleanup;\r\n  }\r\n\r\n  /* Figure out if we have any triggers and if the table being\r\n  ** inserted into is a view\r\n  */\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask);\r\n  isView = pTab->pSelect!=0;\r\n#else\r\n# define pTrigger 0\r\n# define tmask 0\r\n# define isView 0\r\n#endif\r\n#ifdef SQLITE_OMIT_VIEW\r\n# undef isView\r\n# define isView 0\r\n#endif\r\n  assert( (pTrigger && tmask) || (pTrigger==0 && tmask==0) );\r\n\r\n  /* If pTab is really a view, make sure it has been initialized.\r\n  ** ViewGetColumnNames() is a no-op if pTab is not a view (or virtual \r\n  ** module table).\r\n  */\r\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\r\n    goto insert_cleanup;\r\n  }\r\n\r\n  /* Ensure that:\r\n  *  (a) the table is not read-only, \r\n  *  (b) that if it is a view then ON INSERT triggers exist\r\n  */\r\n  if( sqlite3IsReadOnly(pParse, pTab, tmask) ){\r\n    goto insert_cleanup;\r\n  }\r\n\r\n  /* Allocate a VDBE\r\n  */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ) goto insert_cleanup;\r\n  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);\r\n  sqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb);\r\n\r\n#ifndef SQLITE_OMIT_XFER_OPT\r\n  /* If the statement is of the form\r\n  **\r\n  **       INSERT INTO <table1> SELECT * FROM <table2>;\r\n  **\r\n  ** Then special optimizations can be applied that make the transfer\r\n  ** very fast and which reduce fragmentation of indices.\r\n  **\r\n  ** This is the 2nd template.\r\n  */\r\n  if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){\r\n    assert( !pTrigger );\r\n    assert( pList==0 );\r\n    goto insert_end;\r\n  }\r\n#endif /* SQLITE_OMIT_XFER_OPT */\r\n\r\n  /* If this is an AUTOINCREMENT table, look up the sequence number in the\r\n  ** sqlite_sequence table and store it in memory cell regAutoinc.\r\n  */\r\n  regAutoinc = autoIncBegin(pParse, iDb, pTab);\r\n\r\n  /* Figure out how many columns of data are supplied.  If the data\r\n  ** is coming from a SELECT statement, then generate a co-routine that\r\n  ** produces a single row of the SELECT on each invocation.  The\r\n  ** co-routine is the common header to the 3rd and 4th templates.\r\n  */\r\n  if( pSelect ){\r\n    /* Data is coming from a SELECT.  Generate code to implement that SELECT\r\n    ** as a co-routine.  The code is common to both the 3rd and 4th\r\n    ** templates:\r\n    **\r\n    **         EOF <- 0\r\n    **         X <- A\r\n    **         goto B\r\n    **      A: setup for the SELECT\r\n    **         loop over the tables in the SELECT\r\n    **           load value into register R..R+n\r\n    **           yield X\r\n    **         end loop\r\n    **         cleanup after the SELECT\r\n    **         EOF <- 1\r\n    **         yield X\r\n    **         halt-error\r\n    **\r\n    ** On each invocation of the co-routine, it puts a single row of the\r\n    ** SELECT result into registers dest.iMem...dest.iMem+dest.nMem-1.\r\n    ** (These output registers are allocated by sqlite3Select().)  When\r\n    ** the SELECT completes, it sets the EOF flag stored in regEof.\r\n    */\r\n    int rc, j1;\r\n\r\n    regEof = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof);      /* EOF <- 0 */\r\n    VdbeComment((v, \"SELECT eof flag\"));\r\n    sqlite3SelectDestInit(&dest, SRT_Coroutine, ++pParse->nMem);\r\n    addrSelect = sqlite3VdbeCurrentAddr(v)+2;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, addrSelect-1, dest.iParm);\r\n    j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);\r\n    VdbeComment((v, \"Jump over SELECT coroutine\"));\r\n\r\n    /* Resolve the expressions in the SELECT statement and execute it. */\r\n    rc = sqlite3Select(pParse, pSelect, &dest);\r\n    assert( pParse->nErr==0 || rc );\r\n    if( rc || NEVER(pParse->nErr) || db->mallocFailed ){\r\n      goto insert_cleanup;\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof);         /* EOF <- 1 */\r\n    sqlite3VdbeAddOp1(v, OP_Yield, dest.iParm);   /* yield X */\r\n    sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort);\r\n    VdbeComment((v, \"End of SELECT coroutine\"));\r\n    sqlite3VdbeJumpHere(v, j1);                          /* label B: */\r\n\r\n    regFromSelect = dest.iMem;\r\n    assert( pSelect->pEList );\r\n    nColumn = pSelect->pEList->nExpr;\r\n    assert( dest.nMem==nColumn );\r\n\r\n    /* Set useTempTable to TRUE if the result of the SELECT statement\r\n    ** should be written into a temporary table (template 4).  Set to\r\n    ** FALSE if each* row of the SELECT can be written directly into\r\n    ** the destination table (template 3).\r\n    **\r\n    ** A temp table must be used if the table being updated is also one\r\n    ** of the tables being read by the SELECT statement.  Also use a \r\n    ** temp table in the case of row triggers.\r\n    */\r\n    if( pTrigger || readsTable(pParse, addrSelect, iDb, pTab) ){\r\n      useTempTable = 1;\r\n    }\r\n\r\n    if( useTempTable ){\r\n      /* Invoke the coroutine to extract information from the SELECT\r\n      ** and add it to a transient table srcTab.  The code generated\r\n      ** here is from the 4th template:\r\n      **\r\n      **      B: open temp table\r\n      **      L: yield X\r\n      **         if EOF goto M\r\n      **         insert row from R..R+n into temp table\r\n      **         goto L\r\n      **      M: ...\r\n      */\r\n      int regRec;          /* Register to hold packed record */\r\n      int regTempRowid;    /* Register to hold temp table ROWID */\r\n      int addrTop;         /* Label \"L\" */\r\n      int addrIf;          /* Address of jump to M */\r\n\r\n      srcTab = pParse->nTab++;\r\n      regRec = sqlite3GetTempReg(pParse);\r\n      regTempRowid = sqlite3GetTempReg(pParse);\r\n      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn);\r\n      addrTop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iParm);\r\n      addrIf = sqlite3VdbeAddOp1(v, OP_If, regEof);\r\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regFromSelect, nColumn, regRec);\r\n      sqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, regTempRowid);\r\n      sqlite3VdbeAddOp3(v, OP_Insert, srcTab, regRec, regTempRowid);\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop);\r\n      sqlite3VdbeJumpHere(v, addrIf);\r\n      sqlite3ReleaseTempReg(pParse, regRec);\r\n      sqlite3ReleaseTempReg(pParse, regTempRowid);\r\n    }\r\n  }else{\r\n    /* This is the case if the data for the INSERT is coming from a VALUES\r\n    ** clause\r\n    */\r\n    NameContext sNC;\r\n    memset(&sNC, 0, sizeof(sNC));\r\n    sNC.pParse = pParse;\r\n    srcTab = -1;\r\n    assert( useTempTable==0 );\r\n    nColumn = pList ? pList->nExpr : 0;\r\n    for(i=0; i<nColumn; i++){\r\n      if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){\r\n        goto insert_cleanup;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Make sure the number of columns in the source data matches the number\r\n  ** of columns to be inserted into the table.\r\n  */\r\n  if( IsVirtual(pTab) ){\r\n    for(i=0; i<pTab->nCol; i++){\r\n      nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);\r\n    }\r\n  }\r\n  if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){\r\n    sqlite3ErrorMsg(pParse, \r\n       \"table %S has %d columns but %d values were supplied\",\r\n       pTabList, 0, pTab->nCol-nHidden, nColumn);\r\n    goto insert_cleanup;\r\n  }\r\n  if( pColumn!=0 && nColumn!=pColumn->nId ){\r\n    sqlite3ErrorMsg(pParse, \"%d values for %d columns\", nColumn, pColumn->nId);\r\n    goto insert_cleanup;\r\n  }\r\n\r\n  /* If the INSERT statement included an IDLIST term, then make sure\r\n  ** all elements of the IDLIST really are columns of the table and \r\n  ** remember the column indices.\r\n  **\r\n  ** If the table has an INTEGER PRIMARY KEY column and that column\r\n  ** is named in the IDLIST, then record in the keyColumn variable\r\n  ** the index into IDLIST of the primary key column.  keyColumn is\r\n  ** the index of the primary key as it appears in IDLIST, not as\r\n  ** is appears in the original table.  (The index of the primary\r\n  ** key in the original table is pTab->iPKey.)\r\n  */\r\n  if( pColumn ){\r\n    for(i=0; i<pColumn->nId; i++){\r\n      pColumn->a[i].idx = -1;\r\n    }\r\n    for(i=0; i<pColumn->nId; i++){\r\n      for(j=0; j<pTab->nCol; j++){\r\n        if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){\r\n          pColumn->a[i].idx = j;\r\n          if( j==pTab->iPKey ){\r\n            keyColumn = i;\r\n          }\r\n          break;\r\n        }\r\n      }\r\n      if( j>=pTab->nCol ){\r\n        if( sqlite3IsRowid(pColumn->a[i].zName) ){\r\n          keyColumn = i;\r\n        }else{\r\n          sqlite3ErrorMsg(pParse, \"table %S has no column named %s\",\r\n              pTabList, 0, pColumn->a[i].zName);\r\n          pParse->checkSchema = 1;\r\n          goto insert_cleanup;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  /* If there is no IDLIST term but the table has an integer primary\r\n  ** key, the set the keyColumn variable to the primary key column index\r\n  ** in the original table definition.\r\n  */\r\n  if( pColumn==0 && nColumn>0 ){\r\n    keyColumn = pTab->iPKey;\r\n  }\r\n    \r\n  /* Initialize the count of rows to be inserted\r\n  */\r\n  if( db->flags & SQLITE_CountRows ){\r\n    regRowCount = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);\r\n  }\r\n\r\n  /* If this is not a view, open the table and and all indices */\r\n  if( !isView ){\r\n    int nIdx;\r\n\r\n    baseCur = pParse->nTab;\r\n    nIdx = sqlite3OpenTableAndIndices(pParse, pTab, baseCur, OP_OpenWrite);\r\n    aRegIdx = sqlite3DbMallocRaw(db, sizeof(int)*(nIdx+1));\r\n    if( aRegIdx==0 ){\r\n      goto insert_cleanup;\r\n    }\r\n    for(i=0; i<nIdx; i++){\r\n      aRegIdx[i] = ++pParse->nMem;\r\n    }\r\n  }\r\n\r\n  /* This is the top of the main insertion loop */\r\n  if( useTempTable ){\r\n    /* This block codes the top of loop only.  The complete loop is the\r\n    ** following pseudocode (template 4):\r\n    **\r\n    **         rewind temp table\r\n    **      C: loop over rows of intermediate table\r\n    **           transfer values form intermediate table into <table>\r\n    **         end loop\r\n    **      D: ...\r\n    */\r\n    addrInsTop = sqlite3VdbeAddOp1(v, OP_Rewind, srcTab);\r\n    addrCont = sqlite3VdbeCurrentAddr(v);\r\n  }else if( pSelect ){\r\n    /* This block codes the top of loop only.  The complete loop is the\r\n    ** following pseudocode (template 3):\r\n    **\r\n    **      C: yield X\r\n    **         if EOF goto D\r\n    **         insert the select result into <table> from R..R+n\r\n    **         goto C\r\n    **      D: ...\r\n    */\r\n    addrCont = sqlite3VdbeAddOp1(v, OP_Yield, dest.iParm);\r\n    addrInsTop = sqlite3VdbeAddOp1(v, OP_If, regEof);\r\n  }\r\n\r\n  /* Allocate registers for holding the rowid of the new row,\r\n  ** the content of the new row, and the assemblied row record.\r\n  */\r\n  regRowid = regIns = pParse->nMem+1;\r\n  pParse->nMem += pTab->nCol + 1;\r\n  if( IsVirtual(pTab) ){\r\n    regRowid++;\r\n    pParse->nMem++;\r\n  }\r\n  regData = regRowid+1;\r\n\r\n  /* Run the BEFORE and INSTEAD OF triggers, if there are any\r\n  */\r\n  endOfLoop = sqlite3VdbeMakeLabel(v);\r\n  if( tmask & TRIGGER_BEFORE ){\r\n    int regCols = sqlite3GetTempRange(pParse, pTab->nCol+1);\r\n\r\n    /* build the NEW.* reference row.  Note that if there is an INTEGER\r\n    ** PRIMARY KEY into which a NULL is being inserted, that NULL will be\r\n    ** translated into a unique ID for the row.  But on a BEFORE trigger,\r\n    ** we do not know what the unique ID will be (because the insert has\r\n    ** not happened yet) so we substitute a rowid of -1\r\n    */\r\n    if( keyColumn<0 ){\r\n      sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols);\r\n    }else{\r\n      int j1;\r\n      if( useTempTable ){\r\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, keyColumn, regCols);\r\n      }else{\r\n        assert( pSelect==0 );  /* Otherwise useTempTable is true */\r\n        sqlite3ExprCode(pParse, pList->a[keyColumn].pExpr, regCols);\r\n      }\r\n      j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regCols);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols);\r\n      sqlite3VdbeJumpHere(v, j1);\r\n      sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols);\r\n    }\r\n\r\n    /* Cannot have triggers on a virtual table. If it were possible,\r\n    ** this block would have to account for hidden column.\r\n    */\r\n    assert( !IsVirtual(pTab) );\r\n\r\n    /* Create the new column data\r\n    */\r\n    for(i=0; i<pTab->nCol; i++){\r\n      if( pColumn==0 ){\r\n        j = i;\r\n      }else{\r\n        for(j=0; j<pColumn->nId; j++){\r\n          if( pColumn->a[j].idx==i ) break;\r\n        }\r\n      }\r\n      if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId) ){\r\n        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1);\r\n      }else if( useTempTable ){\r\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, regCols+i+1); \r\n      }else{\r\n        assert( pSelect==0 ); /* Otherwise useTempTable is true */\r\n        sqlite3ExprCodeAndCache(pParse, pList->a[j].pExpr, regCols+i+1);\r\n      }\r\n    }\r\n\r\n    /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger,\r\n    ** do not attempt any conversions before assembling the record.\r\n    ** If this is a real table, attempt conversions as required by the\r\n    ** table column affinities.\r\n    */\r\n    if( !isView ){\r\n      sqlite3VdbeAddOp2(v, OP_Affinity, regCols+1, pTab->nCol);\r\n      sqlite3TableAffinityStr(v, pTab);\r\n    }\r\n\r\n    /* Fire BEFORE or INSTEAD OF triggers */\r\n    sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_BEFORE, \r\n        pTab, regCols-pTab->nCol-1, onError, endOfLoop);\r\n\r\n    sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1);\r\n  }\r\n\r\n  /* Push the record number for the new entry onto the stack.  The\r\n  ** record number is a randomly generate integer created by NewRowid\r\n  ** except when the table has an INTEGER PRIMARY KEY column, in which\r\n  ** case the record number is the same as that column. \r\n  */\r\n  if( !isView ){\r\n    if( IsVirtual(pTab) ){\r\n      /* The row that the VUpdate opcode will delete: none */\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regIns);\r\n    }\r\n    if( keyColumn>=0 ){\r\n      if( useTempTable ){\r\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, keyColumn, regRowid);\r\n      }else if( pSelect ){\r\n        sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+keyColumn, regRowid);\r\n      }else{\r\n        VdbeOp *pOp;\r\n        sqlite3ExprCode(pParse, pList->a[keyColumn].pExpr, regRowid);\r\n        pOp = sqlite3VdbeGetOp(v, -1);\r\n        if( ALWAYS(pOp) && pOp->opcode==OP_Null && !IsVirtual(pTab) ){\r\n          appendFlag = 1;\r\n          pOp->opcode = OP_NewRowid;\r\n          pOp->p1 = baseCur;\r\n          pOp->p2 = regRowid;\r\n          pOp->p3 = regAutoinc;\r\n        }\r\n      }\r\n      /* If the PRIMARY KEY expression is NULL, then use OP_NewRowid\r\n      ** to generate a unique primary key value.\r\n      */\r\n      if( !appendFlag ){\r\n        int j1;\r\n        if( !IsVirtual(pTab) ){\r\n          j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid);\r\n          sqlite3VdbeAddOp3(v, OP_NewRowid, baseCur, regRowid, regAutoinc);\r\n          sqlite3VdbeJumpHere(v, j1);\r\n        }else{\r\n          j1 = sqlite3VdbeCurrentAddr(v);\r\n          sqlite3VdbeAddOp2(v, OP_IsNull, regRowid, j1+2);\r\n        }\r\n        sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid);\r\n      }\r\n    }else if( IsVirtual(pTab) ){\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regRowid);\r\n    }else{\r\n      sqlite3VdbeAddOp3(v, OP_NewRowid, baseCur, regRowid, regAutoinc);\r\n      appendFlag = 1;\r\n    }\r\n    autoIncStep(pParse, regAutoinc, regRowid);\r\n\r\n    /* Push onto the stack, data for all columns of the new entry, beginning\r\n    ** with the first column.\r\n    */\r\n    nHidden = 0;\r\n    for(i=0; i<pTab->nCol; i++){\r\n      int iRegStore = regRowid+1+i;\r\n      if( i==pTab->iPKey ){\r\n        /* The value of the INTEGER PRIMARY KEY column is always a NULL.\r\n        ** Whenever this column is read, the record number will be substituted\r\n        ** in its place.  So will fill this column with a NULL to avoid\r\n        ** taking up data space with information that will never be used. */\r\n        sqlite3VdbeAddOp2(v, OP_Null, 0, iRegStore);\r\n        continue;\r\n      }\r\n      if( pColumn==0 ){\r\n        if( IsHiddenColumn(&pTab->aCol[i]) ){\r\n          assert( IsVirtual(pTab) );\r\n          j = -1;\r\n          nHidden++;\r\n        }else{\r\n          j = i - nHidden;\r\n        }\r\n      }else{\r\n        for(j=0; j<pColumn->nId; j++){\r\n          if( pColumn->a[j].idx==i ) break;\r\n        }\r\n      }\r\n      if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){\r\n        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, iRegStore);\r\n      }else if( useTempTable ){\r\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, iRegStore); \r\n      }else if( pSelect ){\r\n        sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+j, iRegStore);\r\n      }else{\r\n        sqlite3ExprCode(pParse, pList->a[j].pExpr, iRegStore);\r\n      }\r\n    }\r\n\r\n    /* Generate code to check constraints and generate index keys and\r\n    ** do the insertion.\r\n    */\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    if( IsVirtual(pTab) ){\r\n      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);\r\n      sqlite3VtabMakeWritable(pParse, pTab);\r\n      sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB);\r\n      sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);\r\n      sqlite3MayAbort(pParse);\r\n    }else\r\n#endif\r\n    {\r\n      int isReplace;    /* Set to true if constraints may cause a replace */\r\n      sqlite3GenerateConstraintChecks(pParse, pTab, baseCur, regIns, aRegIdx,\r\n          keyColumn>=0, 0, onError, endOfLoop, &isReplace\r\n      );\r\n      sqlite3FkCheck(pParse, pTab, 0, regIns);\r\n      sqlite3CompleteInsertion(\r\n          pParse, pTab, baseCur, regIns, aRegIdx, 0, appendFlag, isReplace==0\r\n      );\r\n    }\r\n  }\r\n\r\n  /* Update the count of rows that are inserted\r\n  */\r\n  if( (db->flags & SQLITE_CountRows)!=0 ){\r\n    sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);\r\n  }\r\n\r\n  if( pTrigger ){\r\n    /* Code AFTER triggers */\r\n    sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_AFTER, \r\n        pTab, regData-2-pTab->nCol, onError, endOfLoop);\r\n  }\r\n\r\n  /* The bottom of the main insertion loop, if the data source\r\n  ** is a SELECT statement.\r\n  */\r\n  sqlite3VdbeResolveLabel(v, endOfLoop);\r\n  if( useTempTable ){\r\n    sqlite3VdbeAddOp2(v, OP_Next, srcTab, addrCont);\r\n    sqlite3VdbeJumpHere(v, addrInsTop);\r\n    sqlite3VdbeAddOp1(v, OP_Close, srcTab);\r\n  }else if( pSelect ){\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, addrCont);\r\n    sqlite3VdbeJumpHere(v, addrInsTop);\r\n  }\r\n\r\n  if( !IsVirtual(pTab) && !isView ){\r\n    /* Close all tables opened */\r\n    sqlite3VdbeAddOp1(v, OP_Close, baseCur);\r\n    for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){\r\n      sqlite3VdbeAddOp1(v, OP_Close, idx+baseCur);\r\n    }\r\n  }\r\n\r\ninsert_end:\r\n  /* Update the sqlite_sequence table by storing the content of the\r\n  ** maximum rowid counter values recorded while inserting into\r\n  ** autoincrement tables.\r\n  */\r\n  if( pParse->nested==0 && pParse->pTriggerTab==0 ){\r\n    sqlite3AutoincrementEnd(pParse);\r\n  }\r\n\r\n  /*\r\n  ** Return the number of rows inserted. If this routine is \r\n  ** generating code because of a call to sqlite3NestedParse(), do not\r\n  ** invoke the callback function.\r\n  */\r\n  if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"rows inserted\", SQLITE_STATIC);\r\n  }\r\n\r\ninsert_cleanup:\r\n  sqlite3SrcListDelete(db, pTabList);\r\n  sqlite3ExprListDelete(db, pList);\r\n  sqlite3SelectDelete(db, pSelect);\r\n  sqlite3IdListDelete(db, pColumn);\r\n  sqlite3DbFree(db, aRegIdx);\r\n}\r\n\r\n/* Make sure \"isView\" and other macros defined above are undefined. Otherwise\r\n** thely may interfere with compilation of other functions in this file\r\n** (or in another file, if this file becomes part of the amalgamation).  */\r\n#ifdef isView\r\n #undef isView\r\n#endif\r\n#ifdef pTrigger\r\n #undef pTrigger\r\n#endif\r\n#ifdef tmask\r\n #undef tmask\r\n#endif\r\n\r\n\r\n/*\r\n** Generate code to do constraint checks prior to an INSERT or an UPDATE.\r\n**\r\n** The input is a range of consecutive registers as follows:\r\n**\r\n**    1.  The rowid of the row after the update.\r\n**\r\n**    2.  The data in the first column of the entry after the update.\r\n**\r\n**    i.  Data from middle columns...\r\n**\r\n**    N.  The data in the last column of the entry after the update.\r\n**\r\n** The regRowid parameter is the index of the register containing (1).\r\n**\r\n** If isUpdate is true and rowidChng is non-zero, then rowidChng contains\r\n** the address of a register containing the rowid before the update takes\r\n** place. isUpdate is true for UPDATEs and false for INSERTs. If isUpdate\r\n** is false, indicating an INSERT statement, then a non-zero rowidChng \r\n** indicates that the rowid was explicitly specified as part of the\r\n** INSERT statement. If rowidChng is false, it means that  the rowid is\r\n** computed automatically in an insert or that the rowid value is not \r\n** modified by an update.\r\n**\r\n** The code generated by this routine store new index entries into\r\n** registers identified by aRegIdx[].  No index entry is created for\r\n** indices where aRegIdx[i]==0.  The order of indices in aRegIdx[] is\r\n** the same as the order of indices on the linked list of indices\r\n** attached to the table.\r\n**\r\n** This routine also generates code to check constraints.  NOT NULL,\r\n** CHECK, and UNIQUE constraints are all checked.  If a constraint fails,\r\n** then the appropriate action is performed.  There are five possible\r\n** actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE.\r\n**\r\n**  Constraint type  Action       What Happens\r\n**  ---------------  ----------   ----------------------------------------\r\n**  any              ROLLBACK     The current transaction is rolled back and\r\n**                                sqlite3_exec() returns immediately with a\r\n**                                return code of SQLITE_CONSTRAINT.\r\n**\r\n**  any              ABORT        Back out changes from the current command\r\n**                                only (do not do a complete rollback) then\r\n**                                cause sqlite3_exec() to return immediately\r\n**                                with SQLITE_CONSTRAINT.\r\n**\r\n**  any              FAIL         Sqlite3_exec() returns immediately with a\r\n**                                return code of SQLITE_CONSTRAINT.  The\r\n**                                transaction is not rolled back and any\r\n**                                prior changes are retained.\r\n**\r\n**  any              IGNORE       The record number and data is popped from\r\n**                                the stack and there is an immediate jump\r\n**                                to label ignoreDest.\r\n**\r\n**  NOT NULL         REPLACE      The NULL value is replace by the default\r\n**                                value for that column.  If the default value\r\n**                                is NULL, the action is the same as ABORT.\r\n**\r\n**  UNIQUE           REPLACE      The other row that conflicts with the row\r\n**                                being inserted is removed.\r\n**\r\n**  CHECK            REPLACE      Illegal.  The results in an exception.\r\n**\r\n** Which action to take is determined by the overrideError parameter.\r\n** Or if overrideError==OE_Default, then the pParse->onError parameter\r\n** is used.  Or if pParse->onError==OE_Default then the onError value\r\n** for the constraint is used.\r\n**\r\n** The calling routine must open a read/write cursor for pTab with\r\n** cursor number \"baseCur\".  All indices of pTab must also have open\r\n** read/write cursors with cursor number baseCur+i for the i-th cursor.\r\n** Except, if there is no possibility of a REPLACE action then\r\n** cursors do not need to be open for indices where aRegIdx[i]==0.\r\n*/\r\nSQLITE_PRIVATE void sqlite3GenerateConstraintChecks(\r\n  Parse *pParse,      /* The parser context */\r\n  Table *pTab,        /* the table into which we are inserting */\r\n  int baseCur,        /* Index of a read/write cursor pointing at pTab */\r\n  int regRowid,       /* Index of the range of input registers */\r\n  int *aRegIdx,       /* Register used by each index.  0 for unused indices */\r\n  int rowidChng,      /* True if the rowid might collide with existing entry */\r\n  int isUpdate,       /* True for UPDATE, False for INSERT */\r\n  int overrideError,  /* Override onError to this if not OE_Default */\r\n  int ignoreDest,     /* Jump to this label on an OE_Ignore resolution */\r\n  int *pbMayReplace   /* OUT: Set to true if constraint may cause a replace */\r\n){\r\n  int i;              /* loop counter */\r\n  Vdbe *v;            /* VDBE under constrution */\r\n  int nCol;           /* Number of columns */\r\n  int onError;        /* Conflict resolution strategy */\r\n  int j1;             /* Addresss of jump instruction */\r\n  int j2 = 0, j3;     /* Addresses of jump instructions */\r\n  int regData;        /* Register containing first data column */\r\n  int iCur;           /* Table cursor number */\r\n  Index *pIdx;         /* Pointer to one of the indices */\r\n  int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */\r\n  int regOldRowid = (rowidChng && isUpdate) ? rowidChng : regRowid;\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  assert( v!=0 );\r\n  assert( pTab->pSelect==0 );  /* This table is not a VIEW */\r\n  nCol = pTab->nCol;\r\n  regData = regRowid + 1;\r\n\r\n  /* Test all NOT NULL constraints.\r\n  */\r\n  for(i=0; i<nCol; i++){\r\n    if( i==pTab->iPKey ){\r\n      continue;\r\n    }\r\n    onError = pTab->aCol[i].notNull;\r\n    if( onError==OE_None ) continue;\r\n    if( overrideError!=OE_Default ){\r\n      onError = overrideError;\r\n    }else if( onError==OE_Default ){\r\n      onError = OE_Abort;\r\n    }\r\n    if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){\r\n      onError = OE_Abort;\r\n    }\r\n    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail\r\n        || onError==OE_Ignore || onError==OE_Replace );\r\n    switch( onError ){\r\n      case OE_Abort:\r\n        sqlite3MayAbort(pParse);\r\n      case OE_Rollback:\r\n      case OE_Fail: {\r\n        char *zMsg;\r\n        sqlite3VdbeAddOp3(v, OP_HaltIfNull,\r\n                                  SQLITE_CONSTRAINT, onError, regData+i);\r\n        zMsg = sqlite3MPrintf(pParse->db, \"%s.%s may not be NULL\",\r\n                              pTab->zName, pTab->aCol[i].zName);\r\n        sqlite3VdbeChangeP4(v, -1, zMsg, P4_DYNAMIC);\r\n        break;\r\n      }\r\n      case OE_Ignore: {\r\n        sqlite3VdbeAddOp2(v, OP_IsNull, regData+i, ignoreDest);\r\n        break;\r\n      }\r\n      default: {\r\n        assert( onError==OE_Replace );\r\n        j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regData+i);\r\n        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regData+i);\r\n        sqlite3VdbeJumpHere(v, j1);\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Test all CHECK constraints\r\n  */\r\n#ifndef SQLITE_OMIT_CHECK\r\n  if( pTab->pCheck && (pParse->db->flags & SQLITE_IgnoreChecks)==0 ){\r\n    int allOk = sqlite3VdbeMakeLabel(v);\r\n    pParse->ckBase = regData;\r\n    sqlite3ExprIfTrue(pParse, pTab->pCheck, allOk, SQLITE_JUMPIFNULL);\r\n    onError = overrideError!=OE_Default ? overrideError : OE_Abort;\r\n    if( onError==OE_Ignore ){\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);\r\n    }else{\r\n      if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */\r\n      sqlite3HaltConstraint(pParse, onError, 0, 0);\r\n    }\r\n    sqlite3VdbeResolveLabel(v, allOk);\r\n  }\r\n#endif /* !defined(SQLITE_OMIT_CHECK) */\r\n\r\n  /* If we have an INTEGER PRIMARY KEY, make sure the primary key\r\n  ** of the new record does not previously exist.  Except, if this\r\n  ** is an UPDATE and the primary key is not changing, that is OK.\r\n  */\r\n  if( rowidChng ){\r\n    onError = pTab->keyConf;\r\n    if( overrideError!=OE_Default ){\r\n      onError = overrideError;\r\n    }else if( onError==OE_Default ){\r\n      onError = OE_Abort;\r\n    }\r\n    \r\n    if( isUpdate ){\r\n      j2 = sqlite3VdbeAddOp3(v, OP_Eq, regRowid, 0, rowidChng);\r\n    }\r\n    j3 = sqlite3VdbeAddOp3(v, OP_NotExists, baseCur, 0, regRowid);\r\n    switch( onError ){\r\n      default: {\r\n        onError = OE_Abort;\r\n        /* Fall thru into the next case */\r\n      }\r\n      case OE_Rollback:\r\n      case OE_Abort:\r\n      case OE_Fail: {\r\n        sqlite3HaltConstraint(\r\n          pParse, onError, \"PRIMARY KEY must be unique\", P4_STATIC);\r\n        break;\r\n      }\r\n      case OE_Replace: {\r\n        /* If there are DELETE triggers on this table and the\r\n        ** recursive-triggers flag is set, call GenerateRowDelete() to\r\n        ** remove the conflicting row from the the table. This will fire\r\n        ** the triggers and remove both the table and index b-tree entries.\r\n        **\r\n        ** Otherwise, if there are no triggers or the recursive-triggers\r\n        ** flag is not set, but the table has one or more indexes, call \r\n        ** GenerateRowIndexDelete(). This removes the index b-tree entries \r\n        ** only. The table b-tree entry will be replaced by the new entry \r\n        ** when it is inserted.  \r\n        **\r\n        ** If either GenerateRowDelete() or GenerateRowIndexDelete() is called,\r\n        ** also invoke MultiWrite() to indicate that this VDBE may require\r\n        ** statement rollback (if the statement is aborted after the delete\r\n        ** takes place). Earlier versions called sqlite3MultiWrite() regardless,\r\n        ** but being more selective here allows statements like:\r\n        **\r\n        **   REPLACE INTO t(rowid) VALUES($newrowid)\r\n        **\r\n        ** to run without a statement journal if there are no indexes on the\r\n        ** table.\r\n        */\r\n        Trigger *pTrigger = 0;\r\n        if( pParse->db->flags&SQLITE_RecTriggers ){\r\n          pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);\r\n        }\r\n        if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){\r\n          sqlite3MultiWrite(pParse);\r\n          sqlite3GenerateRowDelete(\r\n              pParse, pTab, baseCur, regRowid, 0, pTrigger, OE_Replace\r\n          );\r\n        }else if( pTab->pIndex ){\r\n          sqlite3MultiWrite(pParse);\r\n          sqlite3GenerateRowIndexDelete(pParse, pTab, baseCur, 0);\r\n        }\r\n        seenReplace = 1;\r\n        break;\r\n      }\r\n      case OE_Ignore: {\r\n        assert( seenReplace==0 );\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);\r\n        break;\r\n      }\r\n    }\r\n    sqlite3VdbeJumpHere(v, j3);\r\n    if( isUpdate ){\r\n      sqlite3VdbeJumpHere(v, j2);\r\n    }\r\n  }\r\n\r\n  /* Test all UNIQUE constraints by creating entries for each UNIQUE\r\n  ** index and making sure that duplicate entries do not already exist.\r\n  ** Add the new records to the indices as we go.\r\n  */\r\n  for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){\r\n    int regIdx;\r\n    int regR;\r\n\r\n    if( aRegIdx[iCur]==0 ) continue;  /* Skip unused indices */\r\n\r\n    /* Create a key for accessing the index entry */\r\n    regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn+1);\r\n    for(i=0; i<pIdx->nColumn; i++){\r\n      int idx = pIdx->aiColumn[i];\r\n      if( idx==pTab->iPKey ){\r\n        sqlite3VdbeAddOp2(v, OP_SCopy, regRowid, regIdx+i);\r\n      }else{\r\n        sqlite3VdbeAddOp2(v, OP_SCopy, regData+idx, regIdx+i);\r\n      }\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_SCopy, regRowid, regIdx+i);\r\n    sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn+1, aRegIdx[iCur]);\r\n    sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);\r\n    sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn+1);\r\n\r\n    /* Find out what action to take in case there is an indexing conflict */\r\n    onError = pIdx->onError;\r\n    if( onError==OE_None ){ \r\n      sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn+1);\r\n      continue;  /* pIdx is not a UNIQUE index */\r\n    }\r\n    if( overrideError!=OE_Default ){\r\n      onError = overrideError;\r\n    }else if( onError==OE_Default ){\r\n      onError = OE_Abort;\r\n    }\r\n    if( seenReplace ){\r\n      if( onError==OE_Ignore ) onError = OE_Replace;\r\n      else if( onError==OE_Fail ) onError = OE_Abort;\r\n    }\r\n    \r\n    /* Check to see if the new index entry will be unique */\r\n    regR = sqlite3GetTempReg(pParse);\r\n    sqlite3VdbeAddOp2(v, OP_SCopy, regOldRowid, regR);\r\n    j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0,\r\n                           regR, SQLITE_INT_TO_PTR(regIdx),\r\n                           P4_INT32);\r\n    sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn+1);\r\n\r\n    /* Generate code that executes if the new index entry is not unique */\r\n    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail\r\n        || onError==OE_Ignore || onError==OE_Replace );\r\n    switch( onError ){\r\n      case OE_Rollback:\r\n      case OE_Abort:\r\n      case OE_Fail: {\r\n        int j;\r\n        StrAccum errMsg;\r\n        const char *zSep;\r\n        char *zErr;\r\n\r\n        sqlite3StrAccumInit(&errMsg, 0, 0, 200);\r\n        errMsg.db = pParse->db;\r\n        zSep = pIdx->nColumn>1 ? \"columns \" : \"column \";\r\n        for(j=0; j<pIdx->nColumn; j++){\r\n          char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName;\r\n          sqlite3StrAccumAppend(&errMsg, zSep, -1);\r\n          zSep = \", \";\r\n          sqlite3StrAccumAppend(&errMsg, zCol, -1);\r\n        }\r\n        sqlite3StrAccumAppend(&errMsg,\r\n            pIdx->nColumn>1 ? \" are not unique\" : \" is not unique\", -1);\r\n        zErr = sqlite3StrAccumFinish(&errMsg);\r\n        sqlite3HaltConstraint(pParse, onError, zErr, 0);\r\n        sqlite3DbFree(errMsg.db, zErr);\r\n        break;\r\n      }\r\n      case OE_Ignore: {\r\n        assert( seenReplace==0 );\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);\r\n        break;\r\n      }\r\n      default: {\r\n        Trigger *pTrigger = 0;\r\n        assert( onError==OE_Replace );\r\n        sqlite3MultiWrite(pParse);\r\n        if( pParse->db->flags&SQLITE_RecTriggers ){\r\n          pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);\r\n        }\r\n        sqlite3GenerateRowDelete(\r\n            pParse, pTab, baseCur, regR, 0, pTrigger, OE_Replace\r\n        );\r\n        seenReplace = 1;\r\n        break;\r\n      }\r\n    }\r\n    sqlite3VdbeJumpHere(v, j3);\r\n    sqlite3ReleaseTempReg(pParse, regR);\r\n  }\r\n  \r\n  if( pbMayReplace ){\r\n    *pbMayReplace = seenReplace;\r\n  }\r\n}\r\n\r\n/*\r\n** This routine generates code to finish the INSERT or UPDATE operation\r\n** that was started by a prior call to sqlite3GenerateConstraintChecks.\r\n** A consecutive range of registers starting at regRowid contains the\r\n** rowid and the content to be inserted.\r\n**\r\n** The arguments to this routine should be the same as the first six\r\n** arguments to sqlite3GenerateConstraintChecks.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CompleteInsertion(\r\n  Parse *pParse,      /* The parser context */\r\n  Table *pTab,        /* the table into which we are inserting */\r\n  int baseCur,        /* Index of a read/write cursor pointing at pTab */\r\n  int regRowid,       /* Range of content */\r\n  int *aRegIdx,       /* Register used by each index.  0 for unused indices */\r\n  int isUpdate,       /* True for UPDATE, False for INSERT */\r\n  int appendBias,     /* True if this is likely to be an append */\r\n  int useSeekResult   /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */\r\n){\r\n  int i;\r\n  Vdbe *v;\r\n  int nIdx;\r\n  Index *pIdx;\r\n  u8 pik_flags;\r\n  int regData;\r\n  int regRec;\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  assert( v!=0 );\r\n  assert( pTab->pSelect==0 );  /* This table is not a VIEW */\r\n  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}\r\n  for(i=nIdx-1; i>=0; i--){\r\n    if( aRegIdx[i]==0 ) continue;\r\n    sqlite3VdbeAddOp2(v, OP_IdxInsert, baseCur+i+1, aRegIdx[i]);\r\n    if( useSeekResult ){\r\n      sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\r\n    }\r\n  }\r\n  regData = regRowid + 1;\r\n  regRec = sqlite3GetTempReg(pParse);\r\n  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);\r\n  sqlite3TableAffinityStr(v, pTab);\r\n  sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);\r\n  if( pParse->nested ){\r\n    pik_flags = 0;\r\n  }else{\r\n    pik_flags = OPFLAG_NCHANGE;\r\n    pik_flags |= (isUpdate?OPFLAG_ISUPDATE:OPFLAG_LASTROWID);\r\n  }\r\n  if( appendBias ){\r\n    pik_flags |= OPFLAG_APPEND;\r\n  }\r\n  if( useSeekResult ){\r\n    pik_flags |= OPFLAG_USESEEKRESULT;\r\n  }\r\n  sqlite3VdbeAddOp3(v, OP_Insert, baseCur, regRec, regRowid);\r\n  if( !pParse->nested ){\r\n    sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);\r\n  }\r\n  sqlite3VdbeChangeP5(v, pik_flags);\r\n}\r\n\r\n/*\r\n** Generate code that will open cursors for a table and for all\r\n** indices of that table.  The \"baseCur\" parameter is the cursor number used\r\n** for the table.  Indices are opened on subsequent cursors.\r\n**\r\n** Return the number of indices on the table.\r\n*/\r\nSQLITE_PRIVATE int sqlite3OpenTableAndIndices(\r\n  Parse *pParse,   /* Parsing context */\r\n  Table *pTab,     /* Table to be opened */\r\n  int baseCur,     /* Cursor number assigned to the table */\r\n  int op           /* OP_OpenRead or OP_OpenWrite */\r\n){\r\n  int i;\r\n  int iDb;\r\n  Index *pIdx;\r\n  Vdbe *v;\r\n\r\n  if( IsVirtual(pTab) ) return 0;\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n  v = sqlite3GetVdbe(pParse);\r\n  assert( v!=0 );\r\n  sqlite3OpenTable(pParse, baseCur, iDb, pTab, op);\r\n  for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){\r\n    KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);\r\n    assert( pIdx->pSchema==pTab->pSchema );\r\n    sqlite3VdbeAddOp4(v, op, i+baseCur, pIdx->tnum, iDb,\r\n                      (char*)pKey, P4_KEYINFO_HANDOFF);\r\n    VdbeComment((v, \"%s\", pIdx->zName));\r\n  }\r\n  if( pParse->nTab<baseCur+i ){\r\n    pParse->nTab = baseCur+i;\r\n  }\r\n  return i-1;\r\n}\r\n\r\n\r\n#ifdef SQLITE_TEST\r\n/*\r\n** The following global variable is incremented whenever the\r\n** transfer optimization is used.  This is used for testing\r\n** purposes only - to make sure the transfer optimization really\r\n** is happening when it is suppose to.\r\n*/\r\nSQLITE_API int sqlite3_xferopt_count;\r\n#endif /* SQLITE_TEST */\r\n\r\n\r\n#ifndef SQLITE_OMIT_XFER_OPT\r\n/*\r\n** Check to collation names to see if they are compatible.\r\n*/\r\nstatic int xferCompatibleCollation(const char *z1, const char *z2){\r\n  if( z1==0 ){\r\n    return z2==0;\r\n  }\r\n  if( z2==0 ){\r\n    return 0;\r\n  }\r\n  return sqlite3StrICmp(z1, z2)==0;\r\n}\r\n\r\n\r\n/*\r\n** Check to see if index pSrc is compatible as a source of data\r\n** for index pDest in an insert transfer optimization.  The rules\r\n** for a compatible index:\r\n**\r\n**    *   The index is over the same set of columns\r\n**    *   The same DESC and ASC markings occurs on all columns\r\n**    *   The same onError processing (OE_Abort, OE_Ignore, etc)\r\n**    *   The same collating sequence on each column\r\n*/\r\nstatic int xferCompatibleIndex(Index *pDest, Index *pSrc){\r\n  int i;\r\n  assert( pDest && pSrc );\r\n  assert( pDest->pTable!=pSrc->pTable );\r\n  if( pDest->nColumn!=pSrc->nColumn ){\r\n    return 0;   /* Different number of columns */\r\n  }\r\n  if( pDest->onError!=pSrc->onError ){\r\n    return 0;   /* Different conflict resolution strategies */\r\n  }\r\n  for(i=0; i<pSrc->nColumn; i++){\r\n    if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){\r\n      return 0;   /* Different columns indexed */\r\n    }\r\n    if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){\r\n      return 0;   /* Different sort orders */\r\n    }\r\n    if( !xferCompatibleCollation(pSrc->azColl[i],pDest->azColl[i]) ){\r\n      return 0;   /* Different collating sequences */\r\n    }\r\n  }\r\n\r\n  /* If no test above fails then the indices must be compatible */\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Attempt the transfer optimization on INSERTs of the form\r\n**\r\n**     INSERT INTO tab1 SELECT * FROM tab2;\r\n**\r\n** The xfer optimization transfers raw records from tab2 over to tab1.  \r\n** Columns are not decoded and reassemblied, which greatly improves\r\n** performance.  Raw index records are transferred in the same way.\r\n**\r\n** The xfer optimization is only attempted if tab1 and tab2 are compatible.\r\n** There are lots of rules for determining compatibility - see comments\r\n** embedded in the code for details.\r\n**\r\n** This routine returns TRUE if the optimization is guaranteed to be used.\r\n** Sometimes the xfer optimization will only work if the destination table\r\n** is empty - a factor that can only be determined at run-time.  In that\r\n** case, this routine generates code for the xfer optimization but also\r\n** does a test to see if the destination table is empty and jumps over the\r\n** xfer optimization code if the test fails.  In that case, this routine\r\n** returns FALSE so that the caller will know to go ahead and generate\r\n** an unoptimized transfer.  This routine also returns FALSE if there\r\n** is no chance that the xfer optimization can be applied.\r\n**\r\n** This optimization is particularly useful at making VACUUM run faster.\r\n*/\r\nstatic int xferOptimization(\r\n  Parse *pParse,        /* Parser context */\r\n  Table *pDest,         /* The table we are inserting into */\r\n  Select *pSelect,      /* A SELECT statement to use as the data source */\r\n  int onError,          /* How to handle constraint errors */\r\n  int iDbDest           /* The database of pDest */\r\n){\r\n  ExprList *pEList;                /* The result set of the SELECT */\r\n  Table *pSrc;                     /* The table in the FROM clause of SELECT */\r\n  Index *pSrcIdx, *pDestIdx;       /* Source and destination indices */\r\n  struct SrcList_item *pItem;      /* An element of pSelect->pSrc */\r\n  int i;                           /* Loop counter */\r\n  int iDbSrc;                      /* The database of pSrc */\r\n  int iSrc, iDest;                 /* Cursors from source and destination */\r\n  int addr1, addr2;                /* Loop addresses */\r\n  int emptyDestTest;               /* Address of test for empty pDest */\r\n  int emptySrcTest;                /* Address of test for empty pSrc */\r\n  Vdbe *v;                         /* The VDBE we are building */\r\n  KeyInfo *pKey;                   /* Key information for an index */\r\n  int regAutoinc;                  /* Memory register used by AUTOINC */\r\n  int destHasUniqueIdx = 0;        /* True if pDest has a UNIQUE index */\r\n  int regData, regRowid;           /* Registers holding data and rowid */\r\n\r\n  if( pSelect==0 ){\r\n    return 0;   /* Must be of the form  INSERT INTO ... SELECT ... */\r\n  }\r\n  if( sqlite3TriggerList(pParse, pDest) ){\r\n    return 0;   /* tab1 must not have triggers */\r\n  }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( pDest->tabFlags & TF_Virtual ){\r\n    return 0;   /* tab1 must not be a virtual table */\r\n  }\r\n#endif\r\n  if( onError==OE_Default ){\r\n    if( pDest->iPKey>=0 ) onError = pDest->keyConf;\r\n    if( onError==OE_Default ) onError = OE_Abort;\r\n  }\r\n  assert(pSelect->pSrc);   /* allocated even if there is no FROM clause */\r\n  if( pSelect->pSrc->nSrc!=1 ){\r\n    return 0;   /* FROM clause must have exactly one term */\r\n  }\r\n  if( pSelect->pSrc->a[0].pSelect ){\r\n    return 0;   /* FROM clause cannot contain a subquery */\r\n  }\r\n  if( pSelect->pWhere ){\r\n    return 0;   /* SELECT may not have a WHERE clause */\r\n  }\r\n  if( pSelect->pOrderBy ){\r\n    return 0;   /* SELECT may not have an ORDER BY clause */\r\n  }\r\n  /* Do not need to test for a HAVING clause.  If HAVING is present but\r\n  ** there is no ORDER BY, we will get an error. */\r\n  if( pSelect->pGroupBy ){\r\n    return 0;   /* SELECT may not have a GROUP BY clause */\r\n  }\r\n  if( pSelect->pLimit ){\r\n    return 0;   /* SELECT may not have a LIMIT clause */\r\n  }\r\n  assert( pSelect->pOffset==0 );  /* Must be so if pLimit==0 */\r\n  if( pSelect->pPrior ){\r\n    return 0;   /* SELECT may not be a compound query */\r\n  }\r\n  if( pSelect->selFlags & SF_Distinct ){\r\n    return 0;   /* SELECT may not be DISTINCT */\r\n  }\r\n  pEList = pSelect->pEList;\r\n  assert( pEList!=0 );\r\n  if( pEList->nExpr!=1 ){\r\n    return 0;   /* The result set must have exactly one column */\r\n  }\r\n  assert( pEList->a[0].pExpr );\r\n  if( pEList->a[0].pExpr->op!=TK_ALL ){\r\n    return 0;   /* The result set must be the special operator \"*\" */\r\n  }\r\n\r\n  /* At this point we have established that the statement is of the\r\n  ** correct syntactic form to participate in this optimization.  Now\r\n  ** we have to check the semantics.\r\n  */\r\n  pItem = pSelect->pSrc->a;\r\n  pSrc = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);\r\n  if( pSrc==0 ){\r\n    return 0;   /* FROM clause does not contain a real table */\r\n  }\r\n  if( pSrc==pDest ){\r\n    return 0;   /* tab1 and tab2 may not be the same table */\r\n  }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( pSrc->tabFlags & TF_Virtual ){\r\n    return 0;   /* tab2 must not be a virtual table */\r\n  }\r\n#endif\r\n  if( pSrc->pSelect ){\r\n    return 0;   /* tab2 may not be a view */\r\n  }\r\n  if( pDest->nCol!=pSrc->nCol ){\r\n    return 0;   /* Number of columns must be the same in tab1 and tab2 */\r\n  }\r\n  if( pDest->iPKey!=pSrc->iPKey ){\r\n    return 0;   /* Both tables must have the same INTEGER PRIMARY KEY */\r\n  }\r\n  for(i=0; i<pDest->nCol; i++){\r\n    if( pDest->aCol[i].affinity!=pSrc->aCol[i].affinity ){\r\n      return 0;    /* Affinity must be the same on all columns */\r\n    }\r\n    if( !xferCompatibleCollation(pDest->aCol[i].zColl, pSrc->aCol[i].zColl) ){\r\n      return 0;    /* Collating sequence must be the same on all columns */\r\n    }\r\n    if( pDest->aCol[i].notNull && !pSrc->aCol[i].notNull ){\r\n      return 0;    /* tab2 must be NOT NULL if tab1 is */\r\n    }\r\n  }\r\n  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){\r\n    if( pDestIdx->onError!=OE_None ){\r\n      destHasUniqueIdx = 1;\r\n    }\r\n    for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){\r\n      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;\r\n    }\r\n    if( pSrcIdx==0 ){\r\n      return 0;    /* pDestIdx has no corresponding index in pSrc */\r\n    }\r\n  }\r\n#ifndef SQLITE_OMIT_CHECK\r\n  if( pDest->pCheck && sqlite3ExprCompare(pSrc->pCheck, pDest->pCheck) ){\r\n    return 0;   /* Tables have different CHECK constraints.  Ticket #2252 */\r\n  }\r\n#endif\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n  /* Disallow the transfer optimization if the destination table constains\r\n  ** any foreign key constraints.  This is more restrictive than necessary.\r\n  ** But the main beneficiary of the transfer optimization is the VACUUM \r\n  ** command, and the VACUUM command disables foreign key constraints.  So\r\n  ** the extra complication to make this rule less restrictive is probably\r\n  ** not worth the effort.  Ticket [6284df89debdfa61db8073e062908af0c9b6118e]\r\n  */\r\n  if( (pParse->db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){\r\n    return 0;\r\n  }\r\n#endif\r\n  if( (pParse->db->flags & SQLITE_CountRows)!=0 ){\r\n    return 0;  /* xfer opt does not play well with PRAGMA count_changes */\r\n  }\r\n\r\n  /* If we get this far, it means that the xfer optimization is at\r\n  ** least a possibility, though it might only work if the destination\r\n  ** table (tab1) is initially empty.\r\n  */\r\n#ifdef SQLITE_TEST\r\n  sqlite3_xferopt_count++;\r\n#endif\r\n  iDbSrc = sqlite3SchemaToIndex(pParse->db, pSrc->pSchema);\r\n  v = sqlite3GetVdbe(pParse);\r\n  sqlite3CodeVerifySchema(pParse, iDbSrc);\r\n  iSrc = pParse->nTab++;\r\n  iDest = pParse->nTab++;\r\n  regAutoinc = autoIncBegin(pParse, iDbDest, pDest);\r\n  sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);\r\n  if( (pDest->iPKey<0 && pDest->pIndex!=0)          /* (1) */\r\n   || destHasUniqueIdx                              /* (2) */\r\n   || (onError!=OE_Abort && onError!=OE_Rollback)   /* (3) */\r\n  ){\r\n    /* In some circumstances, we are able to run the xfer optimization\r\n    ** only if the destination table is initially empty.  This code makes\r\n    ** that determination.  Conditions under which the destination must\r\n    ** be empty:\r\n    **\r\n    ** (1) There is no INTEGER PRIMARY KEY but there are indices.\r\n    **     (If the destination is not initially empty, the rowid fields\r\n    **     of index entries might need to change.)\r\n    **\r\n    ** (2) The destination has a unique index.  (The xfer optimization \r\n    **     is unable to test uniqueness.)\r\n    **\r\n    ** (3) onError is something other than OE_Abort and OE_Rollback.\r\n    */\r\n    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0);\r\n    emptyDestTest = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);\r\n    sqlite3VdbeJumpHere(v, addr1);\r\n  }else{\r\n    emptyDestTest = 0;\r\n  }\r\n  sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);\r\n  emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0);\r\n  regData = sqlite3GetTempReg(pParse);\r\n  regRowid = sqlite3GetTempReg(pParse);\r\n  if( pDest->iPKey>=0 ){\r\n    addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);\r\n    addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);\r\n    sqlite3HaltConstraint(\r\n        pParse, onError, \"PRIMARY KEY must be unique\", P4_STATIC);\r\n    sqlite3VdbeJumpHere(v, addr2);\r\n    autoIncStep(pParse, regAutoinc, regRowid);\r\n  }else if( pDest->pIndex==0 ){\r\n    addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);\r\n  }else{\r\n    addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);\r\n    assert( (pDest->tabFlags & TF_Autoincrement)==0 );\r\n  }\r\n  sqlite3VdbeAddOp2(v, OP_RowData, iSrc, regData);\r\n  sqlite3VdbeAddOp3(v, OP_Insert, iDest, regData, regRowid);\r\n  sqlite3VdbeChangeP5(v, OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND);\r\n  sqlite3VdbeChangeP4(v, -1, pDest->zName, 0);\r\n  sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1);\r\n  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){\r\n    for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){\r\n      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;\r\n    }\r\n    assert( pSrcIdx );\r\n    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);\r\n    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);\r\n    pKey = sqlite3IndexKeyinfo(pParse, pSrcIdx);\r\n    sqlite3VdbeAddOp4(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc,\r\n                      (char*)pKey, P4_KEYINFO_HANDOFF);\r\n    VdbeComment((v, \"%s\", pSrcIdx->zName));\r\n    pKey = sqlite3IndexKeyinfo(pParse, pDestIdx);\r\n    sqlite3VdbeAddOp4(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest,\r\n                      (char*)pKey, P4_KEYINFO_HANDOFF);\r\n    VdbeComment((v, \"%s\", pDestIdx->zName));\r\n    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0);\r\n    sqlite3VdbeAddOp2(v, OP_RowKey, iSrc, regData);\r\n    sqlite3VdbeAddOp3(v, OP_IdxInsert, iDest, regData, 1);\r\n    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1);\r\n    sqlite3VdbeJumpHere(v, addr1);\r\n  }\r\n  sqlite3VdbeJumpHere(v, emptySrcTest);\r\n  sqlite3ReleaseTempReg(pParse, regRowid);\r\n  sqlite3ReleaseTempReg(pParse, regData);\r\n  sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);\r\n  sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);\r\n  if( emptyDestTest ){\r\n    sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0);\r\n    sqlite3VdbeJumpHere(v, emptyDestTest);\r\n    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);\r\n    return 0;\r\n  }else{\r\n    return 1;\r\n  }\r\n}\r\n#endif /* SQLITE_OMIT_XFER_OPT */\r\n\r\n/************** End of insert.c **********************************************/\r\n/************** Begin file legacy.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** Main file for the SQLite library.  The routines in this file\r\n** implement the programmer interface to the library.  Routines in\r\n** other files are for internal use by SQLite and should not be\r\n** accessed by users of the library.\r\n*/\r\n\r\n\r\n/*\r\n** Execute SQL code.  Return one of the SQLITE_ success/failure\r\n** codes.  Also write an error message into memory obtained from\r\n** malloc() and make *pzErrMsg point to that message.\r\n**\r\n** If the SQL is a query, then for each row in the query result\r\n** the xCallback() function is called.  pArg becomes the first\r\n** argument to xCallback().  If xCallback=NULL then no callback\r\n** is invoked, even for queries.\r\n*/\r\nSQLITE_API int sqlite3_exec(\r\n  sqlite3 *db,                /* The database on which the SQL executes */\r\n  const char *zSql,           /* The SQL to be executed */\r\n  sqlite3_callback xCallback, /* Invoke this callback routine */\r\n  void *pArg,                 /* First argument to xCallback() */\r\n  char **pzErrMsg             /* Write error messages here */\r\n){\r\n  int rc = SQLITE_OK;         /* Return code */\r\n  const char *zLeftover;      /* Tail of unprocessed SQL */\r\n  sqlite3_stmt *pStmt = 0;    /* The current SQL statement */\r\n  char **azCols = 0;          /* Names of result columns */\r\n  int nRetry = 0;             /* Number of retry attempts */\r\n  int callbackIsInit;         /* True if callback data is initialized */\r\n\r\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\r\n  if( zSql==0 ) zSql = \"\";\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n  sqlite3Error(db, SQLITE_OK, 0);\r\n  while( (rc==SQLITE_OK || (rc==SQLITE_SCHEMA && (++nRetry)<2)) && zSql[0] ){\r\n    int nCol;\r\n    char **azVals = 0;\r\n\r\n    pStmt = 0;\r\n    rc = sqlite3_prepare(db, zSql, -1, &pStmt, &zLeftover);\r\n    assert( rc==SQLITE_OK || pStmt==0 );\r\n    if( rc!=SQLITE_OK ){\r\n      continue;\r\n    }\r\n    if( !pStmt ){\r\n      /* this happens for a comment or white-space */\r\n      zSql = zLeftover;\r\n      continue;\r\n    }\r\n\r\n    callbackIsInit = 0;\r\n    nCol = sqlite3_column_count(pStmt);\r\n\r\n    while( 1 ){\r\n      int i;\r\n      rc = sqlite3_step(pStmt);\r\n\r\n      /* Invoke the callback function if required */\r\n      if( xCallback && (SQLITE_ROW==rc || \r\n          (SQLITE_DONE==rc && !callbackIsInit\r\n                           && db->flags&SQLITE_NullCallback)) ){\r\n        if( !callbackIsInit ){\r\n          azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);\r\n          if( azCols==0 ){\r\n            goto exec_out;\r\n          }\r\n          for(i=0; i<nCol; i++){\r\n            azCols[i] = (char *)sqlite3_column_name(pStmt, i);\r\n            /* sqlite3VdbeSetColName() installs column names as UTF8\r\n            ** strings so there is no way for sqlite3_column_name() to fail. */\r\n            assert( azCols[i]!=0 );\r\n          }\r\n          callbackIsInit = 1;\r\n        }\r\n        if( rc==SQLITE_ROW ){\r\n          azVals = &azCols[nCol];\r\n          for(i=0; i<nCol; i++){\r\n            azVals[i] = (char *)sqlite3_column_text(pStmt, i);\r\n            if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){\r\n              db->mallocFailed = 1;\r\n              goto exec_out;\r\n            }\r\n          }\r\n        }\r\n        if( xCallback(pArg, nCol, azVals, azCols) ){\r\n          rc = SQLITE_ABORT;\r\n          sqlite3VdbeFinalize((Vdbe *)pStmt);\r\n          pStmt = 0;\r\n          sqlite3Error(db, SQLITE_ABORT, 0);\r\n          goto exec_out;\r\n        }\r\n      }\r\n\r\n      if( rc!=SQLITE_ROW ){\r\n        rc = sqlite3VdbeFinalize((Vdbe *)pStmt);\r\n        pStmt = 0;\r\n        if( rc!=SQLITE_SCHEMA ){\r\n          nRetry = 0;\r\n          zSql = zLeftover;\r\n          while( sqlite3Isspace(zSql[0]) ) zSql++;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n\r\n    sqlite3DbFree(db, azCols);\r\n    azCols = 0;\r\n  }\r\n\r\nexec_out:\r\n  if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt);\r\n  sqlite3DbFree(db, azCols);\r\n\r\n  rc = sqlite3ApiExit(db, rc);\r\n  if( rc!=SQLITE_OK && ALWAYS(rc==sqlite3_errcode(db)) && pzErrMsg ){\r\n    int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db));\r\n    *pzErrMsg = sqlite3Malloc(nErrMsg);\r\n    if( *pzErrMsg ){\r\n      memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);\r\n    }else{\r\n      rc = SQLITE_NOMEM;\r\n      sqlite3Error(db, SQLITE_NOMEM, 0);\r\n    }\r\n  }else if( pzErrMsg ){\r\n    *pzErrMsg = 0;\r\n  }\r\n\r\n  assert( (rc&db->errMask)==rc );\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/************** End of legacy.c **********************************************/\r\n/************** Begin file loadext.c *****************************************/\r\n/*\r\n** 2006 June 7\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used to dynamically load extensions into\r\n** the SQLite library.\r\n*/\r\n\r\n#ifndef SQLITE_CORE\r\n  #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */\r\n#endif\r\n/************** Include sqlite3ext.h in the middle of loadext.c **************/\r\n/************** Begin file sqlite3ext.h **************************************/\r\n/*\r\n** 2006 June 7\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the SQLite interface for use by\r\n** shared libraries that want to be imported as extensions into\r\n** an SQLite instance.  Shared libraries that intend to be loaded\r\n** as extensions by SQLite should #include this file instead of \r\n** sqlite3.h.\r\n*/\r\n#ifndef _SQLITE3EXT_H_\r\n#define _SQLITE3EXT_H_\r\n\r\ntypedef struct sqlite3_api_routines sqlite3_api_routines;\r\n\r\n/*\r\n** The following structure holds pointers to all of the SQLite API\r\n** routines.\r\n**\r\n** WARNING:  In order to maintain backwards compatibility, add new\r\n** interfaces to the end of this structure only.  If you insert new\r\n** interfaces in the middle of this structure, then older different\r\n** versions of SQLite will not be able to load each others' shared\r\n** libraries!\r\n*/\r\nstruct sqlite3_api_routines {\r\n  void * (*aggregate_context)(sqlite3_context*,int nBytes);\r\n  int  (*aggregate_count)(sqlite3_context*);\r\n  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));\r\n  int  (*bind_double)(sqlite3_stmt*,int,double);\r\n  int  (*bind_int)(sqlite3_stmt*,int,int);\r\n  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);\r\n  int  (*bind_null)(sqlite3_stmt*,int);\r\n  int  (*bind_parameter_count)(sqlite3_stmt*);\r\n  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);\r\n  const char * (*bind_parameter_name)(sqlite3_stmt*,int);\r\n  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));\r\n  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));\r\n  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);\r\n  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);\r\n  int  (*busy_timeout)(sqlite3*,int ms);\r\n  int  (*changes)(sqlite3*);\r\n  int  (*close)(sqlite3*);\r\n  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,\r\n                           int eTextRep,const char*));\r\n  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,\r\n                             int eTextRep,const void*));\r\n  const void * (*column_blob)(sqlite3_stmt*,int iCol);\r\n  int  (*column_bytes)(sqlite3_stmt*,int iCol);\r\n  int  (*column_bytes16)(sqlite3_stmt*,int iCol);\r\n  int  (*column_count)(sqlite3_stmt*pStmt);\r\n  const char * (*column_database_name)(sqlite3_stmt*,int);\r\n  const void * (*column_database_name16)(sqlite3_stmt*,int);\r\n  const char * (*column_decltype)(sqlite3_stmt*,int i);\r\n  const void * (*column_decltype16)(sqlite3_stmt*,int);\r\n  double  (*column_double)(sqlite3_stmt*,int iCol);\r\n  int  (*column_int)(sqlite3_stmt*,int iCol);\r\n  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);\r\n  const char * (*column_name)(sqlite3_stmt*,int);\r\n  const void * (*column_name16)(sqlite3_stmt*,int);\r\n  const char * (*column_origin_name)(sqlite3_stmt*,int);\r\n  const void * (*column_origin_name16)(sqlite3_stmt*,int);\r\n  const char * (*column_table_name)(sqlite3_stmt*,int);\r\n  const void * (*column_table_name16)(sqlite3_stmt*,int);\r\n  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);\r\n  const void * (*column_text16)(sqlite3_stmt*,int iCol);\r\n  int  (*column_type)(sqlite3_stmt*,int iCol);\r\n  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);\r\n  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);\r\n  int  (*complete)(const char*sql);\r\n  int  (*complete16)(const void*sql);\r\n  int  (*create_collation)(sqlite3*,const char*,int,void*,\r\n                           int(*)(void*,int,const void*,int,const void*));\r\n  int  (*create_collation16)(sqlite3*,const void*,int,void*,\r\n                             int(*)(void*,int,const void*,int,const void*));\r\n  int  (*create_function)(sqlite3*,const char*,int,int,void*,\r\n                          void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                          void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n                          void (*xFinal)(sqlite3_context*));\r\n  int  (*create_function16)(sqlite3*,const void*,int,int,void*,\r\n                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xFinal)(sqlite3_context*));\r\n  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);\r\n  int  (*data_count)(sqlite3_stmt*pStmt);\r\n  sqlite3 * (*db_handle)(sqlite3_stmt*);\r\n  int (*declare_vtab)(sqlite3*,const char*);\r\n  int  (*enable_shared_cache)(int);\r\n  int  (*errcode)(sqlite3*db);\r\n  const char * (*errmsg)(sqlite3*);\r\n  const void * (*errmsg16)(sqlite3*);\r\n  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);\r\n  int  (*expired)(sqlite3_stmt*);\r\n  int  (*finalize)(sqlite3_stmt*pStmt);\r\n  void  (*free)(void*);\r\n  void  (*free_table)(char**result);\r\n  int  (*get_autocommit)(sqlite3*);\r\n  void * (*get_auxdata)(sqlite3_context*,int);\r\n  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);\r\n  int  (*global_recover)(void);\r\n  void  (*interruptx)(sqlite3*);\r\n  sqlite_int64  (*last_insert_rowid)(sqlite3*);\r\n  const char * (*libversion)(void);\r\n  int  (*libversion_number)(void);\r\n  void *(*malloc)(int);\r\n  char * (*mprintf)(const char*,...);\r\n  int  (*open)(const char*,sqlite3**);\r\n  int  (*open16)(const void*,sqlite3**);\r\n  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);\r\n  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);\r\n  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);\r\n  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);\r\n  void *(*realloc)(void*,int);\r\n  int  (*reset)(sqlite3_stmt*pStmt);\r\n  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_double)(sqlite3_context*,double);\r\n  void  (*result_error)(sqlite3_context*,const char*,int);\r\n  void  (*result_error16)(sqlite3_context*,const void*,int);\r\n  void  (*result_int)(sqlite3_context*,int);\r\n  void  (*result_int64)(sqlite3_context*,sqlite_int64);\r\n  void  (*result_null)(sqlite3_context*);\r\n  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));\r\n  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_value)(sqlite3_context*,sqlite3_value*);\r\n  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);\r\n  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,\r\n                         const char*,const char*),void*);\r\n  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));\r\n  char * (*snprintf)(int,char*,const char*,...);\r\n  int  (*step)(sqlite3_stmt*);\r\n  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,\r\n                                char const**,char const**,int*,int*,int*);\r\n  void  (*thread_cleanup)(void);\r\n  int  (*total_changes)(sqlite3*);\r\n  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);\r\n  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);\r\n  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,\r\n                                         sqlite_int64),void*);\r\n  void * (*user_data)(sqlite3_context*);\r\n  const void * (*value_blob)(sqlite3_value*);\r\n  int  (*value_bytes)(sqlite3_value*);\r\n  int  (*value_bytes16)(sqlite3_value*);\r\n  double  (*value_double)(sqlite3_value*);\r\n  int  (*value_int)(sqlite3_value*);\r\n  sqlite_int64  (*value_int64)(sqlite3_value*);\r\n  int  (*value_numeric_type)(sqlite3_value*);\r\n  const unsigned char * (*value_text)(sqlite3_value*);\r\n  const void * (*value_text16)(sqlite3_value*);\r\n  const void * (*value_text16be)(sqlite3_value*);\r\n  const void * (*value_text16le)(sqlite3_value*);\r\n  int  (*value_type)(sqlite3_value*);\r\n  char *(*vmprintf)(const char*,va_list);\r\n  /* Added ??? */\r\n  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);\r\n  /* Added by 3.3.13 */\r\n  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);\r\n  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);\r\n  int (*clear_bindings)(sqlite3_stmt*);\r\n  /* Added by 3.4.1 */\r\n  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,\r\n                          void (*xDestroy)(void *));\r\n  /* Added by 3.5.0 */\r\n  int (*bind_zeroblob)(sqlite3_stmt*,int,int);\r\n  int (*blob_bytes)(sqlite3_blob*);\r\n  int (*blob_close)(sqlite3_blob*);\r\n  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,\r\n                   int,sqlite3_blob**);\r\n  int (*blob_read)(sqlite3_blob*,void*,int,int);\r\n  int (*blob_write)(sqlite3_blob*,const void*,int,int);\r\n  int (*create_collation_v2)(sqlite3*,const char*,int,void*,\r\n                             int(*)(void*,int,const void*,int,const void*),\r\n                             void(*)(void*));\r\n  int (*file_control)(sqlite3*,const char*,int,void*);\r\n  sqlite3_int64 (*memory_highwater)(int);\r\n  sqlite3_int64 (*memory_used)(void);\r\n  sqlite3_mutex *(*mutex_alloc)(int);\r\n  void (*mutex_enter)(sqlite3_mutex*);\r\n  void (*mutex_free)(sqlite3_mutex*);\r\n  void (*mutex_leave)(sqlite3_mutex*);\r\n  int (*mutex_try)(sqlite3_mutex*);\r\n  int (*open_v2)(const char*,sqlite3**,int,const char*);\r\n  int (*release_memory)(int);\r\n  void (*result_error_nomem)(sqlite3_context*);\r\n  void (*result_error_toobig)(sqlite3_context*);\r\n  int (*sleep)(int);\r\n  void (*soft_heap_limit)(int);\r\n  sqlite3_vfs *(*vfs_find)(const char*);\r\n  int (*vfs_register)(sqlite3_vfs*,int);\r\n  int (*vfs_unregister)(sqlite3_vfs*);\r\n  int (*xthreadsafe)(void);\r\n  void (*result_zeroblob)(sqlite3_context*,int);\r\n  void (*result_error_code)(sqlite3_context*,int);\r\n  int (*test_control)(int, ...);\r\n  void (*randomness)(int,void*);\r\n  sqlite3 *(*context_db_handle)(sqlite3_context*);\r\n  int (*extended_result_codes)(sqlite3*,int);\r\n  int (*limit)(sqlite3*,int,int);\r\n  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);\r\n  const char *(*sql)(sqlite3_stmt*);\r\n  int (*status)(int,int*,int*,int);\r\n  int (*backup_finish)(sqlite3_backup*);\r\n  sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);\r\n  int (*backup_pagecount)(sqlite3_backup*);\r\n  int (*backup_remaining)(sqlite3_backup*);\r\n  int (*backup_step)(sqlite3_backup*,int);\r\n  const char *(*compileoption_get)(int);\r\n  int (*compileoption_used)(const char*);\r\n  int (*create_function_v2)(sqlite3*,const char*,int,int,void*,\r\n                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xFinal)(sqlite3_context*),\r\n                            void(*xDestroy)(void*));\r\n  int (*db_config)(sqlite3*,int,...);\r\n  sqlite3_mutex *(*db_mutex)(sqlite3*);\r\n  int (*db_status)(sqlite3*,int,int*,int*,int);\r\n  int (*extended_errcode)(sqlite3*);\r\n  void (*log)(int,const char*,...);\r\n  sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);\r\n  const char *(*sourceid)(void);\r\n  int (*stmt_status)(sqlite3_stmt*,int,int);\r\n  int (*strnicmp)(const char*,const char*,int);\r\n  int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);\r\n  int (*wal_autocheckpoint)(sqlite3*,int);\r\n  int (*wal_checkpoint)(sqlite3*,const char*);\r\n  void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);\r\n  int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);\r\n  int (*vtab_config)(sqlite3*,int op,...);\r\n  int (*vtab_on_conflict)(sqlite3*);\r\n};\r\n\r\n/*\r\n** The following macros redefine the API routines so that they are\r\n** redirected throught the global sqlite3_api structure.\r\n**\r\n** This header file is also used by the loadext.c source file\r\n** (part of the main SQLite library - not an extension) so that\r\n** it can get access to the sqlite3_api_routines structure\r\n** definition.  But the main library does not want to redefine\r\n** the API.  So the redefinition macros are only valid if the\r\n** SQLITE_CORE macros is undefined.\r\n*/\r\n#ifndef SQLITE_CORE\r\n#define sqlite3_aggregate_context      sqlite3_api->aggregate_context\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_aggregate_count        sqlite3_api->aggregate_count\r\n#endif\r\n#define sqlite3_bind_blob              sqlite3_api->bind_blob\r\n#define sqlite3_bind_double            sqlite3_api->bind_double\r\n#define sqlite3_bind_int               sqlite3_api->bind_int\r\n#define sqlite3_bind_int64             sqlite3_api->bind_int64\r\n#define sqlite3_bind_null              sqlite3_api->bind_null\r\n#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count\r\n#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index\r\n#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name\r\n#define sqlite3_bind_text              sqlite3_api->bind_text\r\n#define sqlite3_bind_text16            sqlite3_api->bind_text16\r\n#define sqlite3_bind_value             sqlite3_api->bind_value\r\n#define sqlite3_busy_handler           sqlite3_api->busy_handler\r\n#define sqlite3_busy_timeout           sqlite3_api->busy_timeout\r\n#define sqlite3_changes                sqlite3_api->changes\r\n#define sqlite3_close                  sqlite3_api->close\r\n#define sqlite3_collation_needed       sqlite3_api->collation_needed\r\n#define sqlite3_collation_needed16     sqlite3_api->collation_needed16\r\n#define sqlite3_column_blob            sqlite3_api->column_blob\r\n#define sqlite3_column_bytes           sqlite3_api->column_bytes\r\n#define sqlite3_column_bytes16         sqlite3_api->column_bytes16\r\n#define sqlite3_column_count           sqlite3_api->column_count\r\n#define sqlite3_column_database_name   sqlite3_api->column_database_name\r\n#define sqlite3_column_database_name16 sqlite3_api->column_database_name16\r\n#define sqlite3_column_decltype        sqlite3_api->column_decltype\r\n#define sqlite3_column_decltype16      sqlite3_api->column_decltype16\r\n#define sqlite3_column_double          sqlite3_api->column_double\r\n#define sqlite3_column_int             sqlite3_api->column_int\r\n#define sqlite3_column_int64           sqlite3_api->column_int64\r\n#define sqlite3_column_name            sqlite3_api->column_name\r\n#define sqlite3_column_name16          sqlite3_api->column_name16\r\n#define sqlite3_column_origin_name     sqlite3_api->column_origin_name\r\n#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16\r\n#define sqlite3_column_table_name      sqlite3_api->column_table_name\r\n#define sqlite3_column_table_name16    sqlite3_api->column_table_name16\r\n#define sqlite3_column_text            sqlite3_api->column_text\r\n#define sqlite3_column_text16          sqlite3_api->column_text16\r\n#define sqlite3_column_type            sqlite3_api->column_type\r\n#define sqlite3_column_value           sqlite3_api->column_value\r\n#define sqlite3_commit_hook            sqlite3_api->commit_hook\r\n#define sqlite3_complete               sqlite3_api->complete\r\n#define sqlite3_complete16             sqlite3_api->complete16\r\n#define sqlite3_create_collation       sqlite3_api->create_collation\r\n#define sqlite3_create_collation16     sqlite3_api->create_collation16\r\n#define sqlite3_create_function        sqlite3_api->create_function\r\n#define sqlite3_create_function16      sqlite3_api->create_function16\r\n#define sqlite3_create_module          sqlite3_api->create_module\r\n#define sqlite3_create_module_v2       sqlite3_api->create_module_v2\r\n#define sqlite3_data_count             sqlite3_api->data_count\r\n#define sqlite3_db_handle              sqlite3_api->db_handle\r\n#define sqlite3_declare_vtab           sqlite3_api->declare_vtab\r\n#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache\r\n#define sqlite3_errcode                sqlite3_api->errcode\r\n#define sqlite3_errmsg                 sqlite3_api->errmsg\r\n#define sqlite3_errmsg16               sqlite3_api->errmsg16\r\n#define sqlite3_exec                   sqlite3_api->exec\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_expired                sqlite3_api->expired\r\n#endif\r\n#define sqlite3_finalize               sqlite3_api->finalize\r\n#define sqlite3_free                   sqlite3_api->free\r\n#define sqlite3_free_table             sqlite3_api->free_table\r\n#define sqlite3_get_autocommit         sqlite3_api->get_autocommit\r\n#define sqlite3_get_auxdata            sqlite3_api->get_auxdata\r\n#define sqlite3_get_table              sqlite3_api->get_table\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_global_recover         sqlite3_api->global_recover\r\n#endif\r\n#define sqlite3_interrupt              sqlite3_api->interruptx\r\n#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid\r\n#define sqlite3_libversion             sqlite3_api->libversion\r\n#define sqlite3_libversion_number      sqlite3_api->libversion_number\r\n#define sqlite3_malloc                 sqlite3_api->malloc\r\n#define sqlite3_mprintf                sqlite3_api->mprintf\r\n#define sqlite3_open                   sqlite3_api->open\r\n#define sqlite3_open16                 sqlite3_api->open16\r\n#define sqlite3_prepare                sqlite3_api->prepare\r\n#define sqlite3_prepare16              sqlite3_api->prepare16\r\n#define sqlite3_prepare_v2             sqlite3_api->prepare_v2\r\n#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2\r\n#define sqlite3_profile                sqlite3_api->profile\r\n#define sqlite3_progress_handler       sqlite3_api->progress_handler\r\n#define sqlite3_realloc                sqlite3_api->realloc\r\n#define sqlite3_reset                  sqlite3_api->reset\r\n#define sqlite3_result_blob            sqlite3_api->result_blob\r\n#define sqlite3_result_double          sqlite3_api->result_double\r\n#define sqlite3_result_error           sqlite3_api->result_error\r\n#define sqlite3_result_error16         sqlite3_api->result_error16\r\n#define sqlite3_result_int             sqlite3_api->result_int\r\n#define sqlite3_result_int64           sqlite3_api->result_int64\r\n#define sqlite3_result_null            sqlite3_api->result_null\r\n#define sqlite3_result_text            sqlite3_api->result_text\r\n#define sqlite3_result_text16          sqlite3_api->result_text16\r\n#define sqlite3_result_text16be        sqlite3_api->result_text16be\r\n#define sqlite3_result_text16le        sqlite3_api->result_text16le\r\n#define sqlite3_result_value           sqlite3_api->result_value\r\n#define sqlite3_rollback_hook          sqlite3_api->rollback_hook\r\n#define sqlite3_set_authorizer         sqlite3_api->set_authorizer\r\n#define sqlite3_set_auxdata            sqlite3_api->set_auxdata\r\n#define sqlite3_snprintf               sqlite3_api->snprintf\r\n#define sqlite3_step                   sqlite3_api->step\r\n#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata\r\n#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup\r\n#define sqlite3_total_changes          sqlite3_api->total_changes\r\n#define sqlite3_trace                  sqlite3_api->trace\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings\r\n#endif\r\n#define sqlite3_update_hook            sqlite3_api->update_hook\r\n#define sqlite3_user_data              sqlite3_api->user_data\r\n#define sqlite3_value_blob             sqlite3_api->value_blob\r\n#define sqlite3_value_bytes            sqlite3_api->value_bytes\r\n#define sqlite3_value_bytes16          sqlite3_api->value_bytes16\r\n#define sqlite3_value_double           sqlite3_api->value_double\r\n#define sqlite3_value_int              sqlite3_api->value_int\r\n#define sqlite3_value_int64            sqlite3_api->value_int64\r\n#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type\r\n#define sqlite3_value_text             sqlite3_api->value_text\r\n#define sqlite3_value_text16           sqlite3_api->value_text16\r\n#define sqlite3_value_text16be         sqlite3_api->value_text16be\r\n#define sqlite3_value_text16le         sqlite3_api->value_text16le\r\n#define sqlite3_value_type             sqlite3_api->value_type\r\n#define sqlite3_vmprintf               sqlite3_api->vmprintf\r\n#define sqlite3_overload_function      sqlite3_api->overload_function\r\n#define sqlite3_prepare_v2             sqlite3_api->prepare_v2\r\n#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2\r\n#define sqlite3_clear_bindings         sqlite3_api->clear_bindings\r\n#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob\r\n#define sqlite3_blob_bytes             sqlite3_api->blob_bytes\r\n#define sqlite3_blob_close             sqlite3_api->blob_close\r\n#define sqlite3_blob_open              sqlite3_api->blob_open\r\n#define sqlite3_blob_read              sqlite3_api->blob_read\r\n#define sqlite3_blob_write             sqlite3_api->blob_write\r\n#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2\r\n#define sqlite3_file_control           sqlite3_api->file_control\r\n#define sqlite3_memory_highwater       sqlite3_api->memory_highwater\r\n#define sqlite3_memory_used            sqlite3_api->memory_used\r\n#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc\r\n#define sqlite3_mutex_enter            sqlite3_api->mutex_enter\r\n#define sqlite3_mutex_free             sqlite3_api->mutex_free\r\n#define sqlite3_mutex_leave            sqlite3_api->mutex_leave\r\n#define sqlite3_mutex_try              sqlite3_api->mutex_try\r\n#define sqlite3_open_v2                sqlite3_api->open_v2\r\n#define sqlite3_release_memory         sqlite3_api->release_memory\r\n#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem\r\n#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig\r\n#define sqlite3_sleep                  sqlite3_api->sleep\r\n#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit\r\n#define sqlite3_vfs_find               sqlite3_api->vfs_find\r\n#define sqlite3_vfs_register           sqlite3_api->vfs_register\r\n#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister\r\n#define sqlite3_threadsafe             sqlite3_api->xthreadsafe\r\n#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob\r\n#define sqlite3_result_error_code      sqlite3_api->result_error_code\r\n#define sqlite3_test_control           sqlite3_api->test_control\r\n#define sqlite3_randomness             sqlite3_api->randomness\r\n#define sqlite3_context_db_handle      sqlite3_api->context_db_handle\r\n#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes\r\n#define sqlite3_limit                  sqlite3_api->limit\r\n#define sqlite3_next_stmt              sqlite3_api->next_stmt\r\n#define sqlite3_sql                    sqlite3_api->sql\r\n#define sqlite3_status                 sqlite3_api->status\r\n#define sqlite3_backup_finish          sqlite3_api->backup_finish\r\n#define sqlite3_backup_init            sqlite3_api->backup_init\r\n#define sqlite3_backup_pagecount       sqlite3_api->backup_pagecount\r\n#define sqlite3_backup_remaining       sqlite3_api->backup_remaining\r\n#define sqlite3_backup_step            sqlite3_api->backup_step\r\n#define sqlite3_compileoption_get      sqlite3_api->compileoption_get\r\n#define sqlite3_compileoption_used     sqlite3_api->compileoption_used\r\n#define sqlite3_create_function_v2     sqlite3_api->create_function_v2\r\n#define sqlite3_db_config              sqlite3_api->db_config\r\n#define sqlite3_db_mutex               sqlite3_api->db_mutex\r\n#define sqlite3_db_status              sqlite3_api->db_status\r\n#define sqlite3_extended_errcode       sqlite3_api->extended_errcode\r\n#define sqlite3_log                    sqlite3_api->log\r\n#define sqlite3_soft_heap_limit64      sqlite3_api->soft_heap_limit64\r\n#define sqlite3_sourceid               sqlite3_api->sourceid\r\n#define sqlite3_stmt_status            sqlite3_api->stmt_status\r\n#define sqlite3_strnicmp               sqlite3_api->strnicmp\r\n#define sqlite3_unlock_notify          sqlite3_api->unlock_notify\r\n#define sqlite3_wal_autocheckpoint     sqlite3_api->wal_autocheckpoint\r\n#define sqlite3_wal_checkpoint         sqlite3_api->wal_checkpoint\r\n#define sqlite3_wal_hook               sqlite3_api->wal_hook\r\n#define sqlite3_blob_reopen            sqlite3_api->blob_reopen\r\n#define sqlite3_vtab_config            sqlite3_api->vtab_config\r\n#define sqlite3_vtab_on_conflict       sqlite3_api->vtab_on_conflict\r\n#endif /* SQLITE_CORE */\r\n\r\n#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;\r\n#define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;\r\n\r\n#endif /* _SQLITE3EXT_H_ */\r\n\r\n/************** End of sqlite3ext.h ******************************************/\r\n/************** Continuing where we left off in loadext.c ********************/\r\n/* #include <string.h> */\r\n\r\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\r\n\r\n/*\r\n** Some API routines are omitted when various features are\r\n** excluded from a build of SQLite.  Substitute a NULL pointer\r\n** for any missing APIs.\r\n*/\r\n#ifndef SQLITE_ENABLE_COLUMN_METADATA\r\n# define sqlite3_column_database_name   0\r\n# define sqlite3_column_database_name16 0\r\n# define sqlite3_column_table_name      0\r\n# define sqlite3_column_table_name16    0\r\n# define sqlite3_column_origin_name     0\r\n# define sqlite3_column_origin_name16   0\r\n# define sqlite3_table_column_metadata  0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_AUTHORIZATION\r\n# define sqlite3_set_authorizer         0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_UTF16\r\n# define sqlite3_bind_text16            0\r\n# define sqlite3_collation_needed16     0\r\n# define sqlite3_column_decltype16      0\r\n# define sqlite3_column_name16          0\r\n# define sqlite3_column_text16          0\r\n# define sqlite3_complete16             0\r\n# define sqlite3_create_collation16     0\r\n# define sqlite3_create_function16      0\r\n# define sqlite3_errmsg16               0\r\n# define sqlite3_open16                 0\r\n# define sqlite3_prepare16              0\r\n# define sqlite3_prepare16_v2           0\r\n# define sqlite3_result_error16         0\r\n# define sqlite3_result_text16          0\r\n# define sqlite3_result_text16be        0\r\n# define sqlite3_result_text16le        0\r\n# define sqlite3_value_text16           0\r\n# define sqlite3_value_text16be         0\r\n# define sqlite3_value_text16le         0\r\n# define sqlite3_column_database_name16 0\r\n# define sqlite3_column_table_name16    0\r\n# define sqlite3_column_origin_name16   0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_COMPLETE\r\n# define sqlite3_complete 0\r\n# define sqlite3_complete16 0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_DECLTYPE\r\n# define sqlite3_column_decltype16      0\r\n# define sqlite3_column_decltype        0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_PROGRESS_CALLBACK\r\n# define sqlite3_progress_handler 0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_VIRTUALTABLE\r\n# define sqlite3_create_module 0\r\n# define sqlite3_create_module_v2 0\r\n# define sqlite3_declare_vtab 0\r\n# define sqlite3_vtab_config 0\r\n# define sqlite3_vtab_on_conflict 0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_SHARED_CACHE\r\n# define sqlite3_enable_shared_cache 0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_TRACE\r\n# define sqlite3_profile       0\r\n# define sqlite3_trace         0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_GET_TABLE\r\n# define sqlite3_free_table    0\r\n# define sqlite3_get_table     0\r\n#endif\r\n\r\n#ifdef SQLITE_OMIT_INCRBLOB\r\n#define sqlite3_bind_zeroblob  0\r\n#define sqlite3_blob_bytes     0\r\n#define sqlite3_blob_close     0\r\n#define sqlite3_blob_open      0\r\n#define sqlite3_blob_read      0\r\n#define sqlite3_blob_write     0\r\n#define sqlite3_blob_reopen    0\r\n#endif\r\n\r\n/*\r\n** The following structure contains pointers to all SQLite API routines.\r\n** A pointer to this structure is passed into extensions when they are\r\n** loaded so that the extension can make calls back into the SQLite\r\n** library.\r\n**\r\n** When adding new APIs, add them to the bottom of this structure\r\n** in order to preserve backwards compatibility.\r\n**\r\n** Extensions that use newer APIs should first call the\r\n** sqlite3_libversion_number() to make sure that the API they\r\n** intend to use is supported by the library.  Extensions should\r\n** also check to make sure that the pointer to the function is\r\n** not NULL before calling it.\r\n*/\r\nstatic const sqlite3_api_routines sqlite3Apis = {\r\n  sqlite3_aggregate_context,\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n  sqlite3_aggregate_count,\r\n#else\r\n  0,\r\n#endif\r\n  sqlite3_bind_blob,\r\n  sqlite3_bind_double,\r\n  sqlite3_bind_int,\r\n  sqlite3_bind_int64,\r\n  sqlite3_bind_null,\r\n  sqlite3_bind_parameter_count,\r\n  sqlite3_bind_parameter_index,\r\n  sqlite3_bind_parameter_name,\r\n  sqlite3_bind_text,\r\n  sqlite3_bind_text16,\r\n  sqlite3_bind_value,\r\n  sqlite3_busy_handler,\r\n  sqlite3_busy_timeout,\r\n  sqlite3_changes,\r\n  sqlite3_close,\r\n  sqlite3_collation_needed,\r\n  sqlite3_collation_needed16,\r\n  sqlite3_column_blob,\r\n  sqlite3_column_bytes,\r\n  sqlite3_column_bytes16,\r\n  sqlite3_column_count,\r\n  sqlite3_column_database_name,\r\n  sqlite3_column_database_name16,\r\n  sqlite3_column_decltype,\r\n  sqlite3_column_decltype16,\r\n  sqlite3_column_double,\r\n  sqlite3_column_int,\r\n  sqlite3_column_int64,\r\n  sqlite3_column_name,\r\n  sqlite3_column_name16,\r\n  sqlite3_column_origin_name,\r\n  sqlite3_column_origin_name16,\r\n  sqlite3_column_table_name,\r\n  sqlite3_column_table_name16,\r\n  sqlite3_column_text,\r\n  sqlite3_column_text16,\r\n  sqlite3_column_type,\r\n  sqlite3_column_value,\r\n  sqlite3_commit_hook,\r\n  sqlite3_complete,\r\n  sqlite3_complete16,\r\n  sqlite3_create_collation,\r\n  sqlite3_create_collation16,\r\n  sqlite3_create_function,\r\n  sqlite3_create_function16,\r\n  sqlite3_create_module,\r\n  sqlite3_data_count,\r\n  sqlite3_db_handle,\r\n  sqlite3_declare_vtab,\r\n  sqlite3_enable_shared_cache,\r\n  sqlite3_errcode,\r\n  sqlite3_errmsg,\r\n  sqlite3_errmsg16,\r\n  sqlite3_exec,\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n  sqlite3_expired,\r\n#else\r\n  0,\r\n#endif\r\n  sqlite3_finalize,\r\n  sqlite3_free,\r\n  sqlite3_free_table,\r\n  sqlite3_get_autocommit,\r\n  sqlite3_get_auxdata,\r\n  sqlite3_get_table,\r\n  0,     /* Was sqlite3_global_recover(), but that function is deprecated */\r\n  sqlite3_interrupt,\r\n  sqlite3_last_insert_rowid,\r\n  sqlite3_libversion,\r\n  sqlite3_libversion_number,\r\n  sqlite3_malloc,\r\n  sqlite3_mprintf,\r\n  sqlite3_open,\r\n  sqlite3_open16,\r\n  sqlite3_prepare,\r\n  sqlite3_prepare16,\r\n  sqlite3_profile,\r\n  sqlite3_progress_handler,\r\n  sqlite3_realloc,\r\n  sqlite3_reset,\r\n  sqlite3_result_blob,\r\n  sqlite3_result_double,\r\n  sqlite3_result_error,\r\n  sqlite3_result_error16,\r\n  sqlite3_result_int,\r\n  sqlite3_result_int64,\r\n  sqlite3_result_null,\r\n  sqlite3_result_text,\r\n  sqlite3_result_text16,\r\n  sqlite3_result_text16be,\r\n  sqlite3_result_text16le,\r\n  sqlite3_result_value,\r\n  sqlite3_rollback_hook,\r\n  sqlite3_set_authorizer,\r\n  sqlite3_set_auxdata,\r\n  sqlite3_snprintf,\r\n  sqlite3_step,\r\n  sqlite3_table_column_metadata,\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n  sqlite3_thread_cleanup,\r\n#else\r\n  0,\r\n#endif\r\n  sqlite3_total_changes,\r\n  sqlite3_trace,\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n  sqlite3_transfer_bindings,\r\n#else\r\n  0,\r\n#endif\r\n  sqlite3_update_hook,\r\n  sqlite3_user_data,\r\n  sqlite3_value_blob,\r\n  sqlite3_value_bytes,\r\n  sqlite3_value_bytes16,\r\n  sqlite3_value_double,\r\n  sqlite3_value_int,\r\n  sqlite3_value_int64,\r\n  sqlite3_value_numeric_type,\r\n  sqlite3_value_text,\r\n  sqlite3_value_text16,\r\n  sqlite3_value_text16be,\r\n  sqlite3_value_text16le,\r\n  sqlite3_value_type,\r\n  sqlite3_vmprintf,\r\n  /*\r\n  ** The original API set ends here.  All extensions can call any\r\n  ** of the APIs above provided that the pointer is not NULL.  But\r\n  ** before calling APIs that follow, extension should check the\r\n  ** sqlite3_libversion_number() to make sure they are dealing with\r\n  ** a library that is new enough to support that API.\r\n  *************************************************************************\r\n  */\r\n  sqlite3_overload_function,\r\n\r\n  /*\r\n  ** Added after 3.3.13\r\n  */\r\n  sqlite3_prepare_v2,\r\n  sqlite3_prepare16_v2,\r\n  sqlite3_clear_bindings,\r\n\r\n  /*\r\n  ** Added for 3.4.1\r\n  */\r\n  sqlite3_create_module_v2,\r\n\r\n  /*\r\n  ** Added for 3.5.0\r\n  */\r\n  sqlite3_bind_zeroblob,\r\n  sqlite3_blob_bytes,\r\n  sqlite3_blob_close,\r\n  sqlite3_blob_open,\r\n  sqlite3_blob_read,\r\n  sqlite3_blob_write,\r\n  sqlite3_create_collation_v2,\r\n  sqlite3_file_control,\r\n  sqlite3_memory_highwater,\r\n  sqlite3_memory_used,\r\n#ifdef SQLITE_MUTEX_OMIT\r\n  0, \r\n  0, \r\n  0,\r\n  0,\r\n  0,\r\n#else\r\n  sqlite3_mutex_alloc,\r\n  sqlite3_mutex_enter,\r\n  sqlite3_mutex_free,\r\n  sqlite3_mutex_leave,\r\n  sqlite3_mutex_try,\r\n#endif\r\n  sqlite3_open_v2,\r\n  sqlite3_release_memory,\r\n  sqlite3_result_error_nomem,\r\n  sqlite3_result_error_toobig,\r\n  sqlite3_sleep,\r\n  sqlite3_soft_heap_limit,\r\n  sqlite3_vfs_find,\r\n  sqlite3_vfs_register,\r\n  sqlite3_vfs_unregister,\r\n\r\n  /*\r\n  ** Added for 3.5.8\r\n  */\r\n  sqlite3_threadsafe,\r\n  sqlite3_result_zeroblob,\r\n  sqlite3_result_error_code,\r\n  sqlite3_test_control,\r\n  sqlite3_randomness,\r\n  sqlite3_context_db_handle,\r\n\r\n  /*\r\n  ** Added for 3.6.0\r\n  */\r\n  sqlite3_extended_result_codes,\r\n  sqlite3_limit,\r\n  sqlite3_next_stmt,\r\n  sqlite3_sql,\r\n  sqlite3_status,\r\n\r\n  /*\r\n  ** Added for 3.7.4\r\n  */\r\n  sqlite3_backup_finish,\r\n  sqlite3_backup_init,\r\n  sqlite3_backup_pagecount,\r\n  sqlite3_backup_remaining,\r\n  sqlite3_backup_step,\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\n  sqlite3_compileoption_get,\r\n  sqlite3_compileoption_used,\r\n#else\r\n  0,\r\n  0,\r\n#endif\r\n  sqlite3_create_function_v2,\r\n  sqlite3_db_config,\r\n  sqlite3_db_mutex,\r\n  sqlite3_db_status,\r\n  sqlite3_extended_errcode,\r\n  sqlite3_log,\r\n  sqlite3_soft_heap_limit64,\r\n  sqlite3_sourceid,\r\n  sqlite3_stmt_status,\r\n  sqlite3_strnicmp,\r\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\r\n  sqlite3_unlock_notify,\r\n#else\r\n  0,\r\n#endif\r\n#ifndef SQLITE_OMIT_WAL\r\n  sqlite3_wal_autocheckpoint,\r\n  sqlite3_wal_checkpoint,\r\n  sqlite3_wal_hook,\r\n#else\r\n  0,\r\n  0,\r\n  0,\r\n#endif\r\n  sqlite3_blob_reopen,\r\n  sqlite3_vtab_config,\r\n  sqlite3_vtab_on_conflict,\r\n};\r\n\r\n/*\r\n** Attempt to load an SQLite extension library contained in the file\r\n** zFile.  The entry point is zProc.  zProc may be 0 in which case a\r\n** default entry point name (sqlite3_extension_init) is used.  Use\r\n** of the default name is recommended.\r\n**\r\n** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong.\r\n**\r\n** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with \r\n** error message text.  The calling function should free this memory\r\n** by calling sqlite3DbFree(db, ).\r\n*/\r\nstatic int sqlite3LoadExtension(\r\n  sqlite3 *db,          /* Load the extension into this database connection */\r\n  const char *zFile,    /* Name of the shared library containing extension */\r\n  const char *zProc,    /* Entry point.  Use \"sqlite3_extension_init\" if 0 */\r\n  char **pzErrMsg       /* Put error message here if not 0 */\r\n){\r\n  sqlite3_vfs *pVfs = db->pVfs;\r\n  void *handle;\r\n  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);\r\n  char *zErrmsg = 0;\r\n  void **aHandle;\r\n  int nMsg = 300 + sqlite3Strlen30(zFile);\r\n\r\n  if( pzErrMsg ) *pzErrMsg = 0;\r\n\r\n  /* Ticket #1863.  To avoid a creating security problems for older\r\n  ** applications that relink against newer versions of SQLite, the\r\n  ** ability to run load_extension is turned off by default.  One\r\n  ** must call sqlite3_enable_load_extension() to turn on extension\r\n  ** loading.  Otherwise you get the following error.\r\n  */\r\n  if( (db->flags & SQLITE_LoadExtension)==0 ){\r\n    if( pzErrMsg ){\r\n      *pzErrMsg = sqlite3_mprintf(\"not authorized\");\r\n    }\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  if( zProc==0 ){\r\n    zProc = \"sqlite3_extension_init\";\r\n  }\r\n\r\n  handle = sqlite3OsDlOpen(pVfs, zFile);\r\n  if( handle==0 ){\r\n    if( pzErrMsg ){\r\n      *pzErrMsg = zErrmsg = sqlite3_malloc(nMsg);\r\n      if( zErrmsg ){\r\n        sqlite3_snprintf(nMsg, zErrmsg, \r\n            \"unable to open shared library [%s]\", zFile);\r\n        sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);\r\n      }\r\n    }\r\n    return SQLITE_ERROR;\r\n  }\r\n  xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))\r\n                   sqlite3OsDlSym(pVfs, handle, zProc);\r\n  if( xInit==0 ){\r\n    if( pzErrMsg ){\r\n      nMsg += sqlite3Strlen30(zProc);\r\n      *pzErrMsg = zErrmsg = sqlite3_malloc(nMsg);\r\n      if( zErrmsg ){\r\n        sqlite3_snprintf(nMsg, zErrmsg,\r\n            \"no entry point [%s] in shared library [%s]\", zProc,zFile);\r\n        sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);\r\n      }\r\n      sqlite3OsDlClose(pVfs, handle);\r\n    }\r\n    return SQLITE_ERROR;\r\n  }else if( xInit(db, &zErrmsg, &sqlite3Apis) ){\r\n    if( pzErrMsg ){\r\n      *pzErrMsg = sqlite3_mprintf(\"error during initialization: %s\", zErrmsg);\r\n    }\r\n    sqlite3_free(zErrmsg);\r\n    sqlite3OsDlClose(pVfs, handle);\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  /* Append the new shared library handle to the db->aExtension array. */\r\n  aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1));\r\n  if( aHandle==0 ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  if( db->nExtension>0 ){\r\n    memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension);\r\n  }\r\n  sqlite3DbFree(db, db->aExtension);\r\n  db->aExtension = aHandle;\r\n\r\n  db->aExtension[db->nExtension++] = handle;\r\n  return SQLITE_OK;\r\n}\r\nSQLITE_API int sqlite3_load_extension(\r\n  sqlite3 *db,          /* Load the extension into this database connection */\r\n  const char *zFile,    /* Name of the shared library containing extension */\r\n  const char *zProc,    /* Entry point.  Use \"sqlite3_extension_init\" if 0 */\r\n  char **pzErrMsg       /* Put error message here if not 0 */\r\n){\r\n  int rc;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Call this routine when the database connection is closing in order\r\n** to clean up loaded extensions\r\n*/\r\nSQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3 *db){\r\n  int i;\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  for(i=0; i<db->nExtension; i++){\r\n    sqlite3OsDlClose(db->pVfs, db->aExtension[i]);\r\n  }\r\n  sqlite3DbFree(db, db->aExtension);\r\n}\r\n\r\n/*\r\n** Enable or disable extension loading.  Extension loading is disabled by\r\n** default so as not to open security holes in older applications.\r\n*/\r\nSQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( onoff ){\r\n    db->flags |= SQLITE_LoadExtension;\r\n  }else{\r\n    db->flags &= ~SQLITE_LoadExtension;\r\n  }\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#endif /* SQLITE_OMIT_LOAD_EXTENSION */\r\n\r\n/*\r\n** The auto-extension code added regardless of whether or not extension\r\n** loading is supported.  We need a dummy sqlite3Apis pointer for that\r\n** code if regular extension loading is not available.  This is that\r\n** dummy pointer.\r\n*/\r\n#ifdef SQLITE_OMIT_LOAD_EXTENSION\r\nstatic const sqlite3_api_routines sqlite3Apis = { 0 };\r\n#endif\r\n\r\n\r\n/*\r\n** The following object holds the list of automatically loaded\r\n** extensions.\r\n**\r\n** This list is shared across threads.  The SQLITE_MUTEX_STATIC_MASTER\r\n** mutex must be held while accessing this list.\r\n*/\r\ntypedef struct sqlite3AutoExtList sqlite3AutoExtList;\r\nstatic SQLITE_WSD struct sqlite3AutoExtList {\r\n  int nExt;              /* Number of entries in aExt[] */          \r\n  void (**aExt)(void);   /* Pointers to the extension init functions */\r\n} sqlite3Autoext = { 0, 0 };\r\n\r\n/* The \"wsdAutoext\" macro will resolve to the autoextension\r\n** state vector.  If writable static data is unsupported on the target,\r\n** we have to locate the state vector at run-time.  In the more common\r\n** case where writable static data is supported, wsdStat can refer directly\r\n** to the \"sqlite3Autoext\" state vector declared above.\r\n*/\r\n#ifdef SQLITE_OMIT_WSD\r\n# define wsdAutoextInit \\\r\n  sqlite3AutoExtList *x = &GLOBAL(sqlite3AutoExtList,sqlite3Autoext)\r\n# define wsdAutoext x[0]\r\n#else\r\n# define wsdAutoextInit\r\n# define wsdAutoext sqlite3Autoext\r\n#endif\r\n\r\n\r\n/*\r\n** Register a statically linked extension that is automatically\r\n** loaded by every new database connection.\r\n*/\r\nSQLITE_API int sqlite3_auto_extension(void (*xInit)(void)){\r\n  int rc = SQLITE_OK;\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  rc = sqlite3_initialize();\r\n  if( rc ){\r\n    return rc;\r\n  }else\r\n#endif\r\n  {\r\n    int i;\r\n#if SQLITE_THREADSAFE\r\n    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n#endif\r\n    wsdAutoextInit;\r\n    sqlite3_mutex_enter(mutex);\r\n    for(i=0; i<wsdAutoext.nExt; i++){\r\n      if( wsdAutoext.aExt[i]==xInit ) break;\r\n    }\r\n    if( i==wsdAutoext.nExt ){\r\n      int nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);\r\n      void (**aNew)(void);\r\n      aNew = sqlite3_realloc(wsdAutoext.aExt, nByte);\r\n      if( aNew==0 ){\r\n        rc = SQLITE_NOMEM;\r\n      }else{\r\n        wsdAutoext.aExt = aNew;\r\n        wsdAutoext.aExt[wsdAutoext.nExt] = xInit;\r\n        wsdAutoext.nExt++;\r\n      }\r\n    }\r\n    sqlite3_mutex_leave(mutex);\r\n    assert( (rc&0xff)==rc );\r\n    return rc;\r\n  }\r\n}\r\n\r\n/*\r\n** Reset the automatic extension loading mechanism.\r\n*/\r\nSQLITE_API void sqlite3_reset_auto_extension(void){\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  if( sqlite3_initialize()==SQLITE_OK )\r\n#endif\r\n  {\r\n#if SQLITE_THREADSAFE\r\n    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n#endif\r\n    wsdAutoextInit;\r\n    sqlite3_mutex_enter(mutex);\r\n    sqlite3_free(wsdAutoext.aExt);\r\n    wsdAutoext.aExt = 0;\r\n    wsdAutoext.nExt = 0;\r\n    sqlite3_mutex_leave(mutex);\r\n  }\r\n}\r\n\r\n/*\r\n** Load all automatic extensions.\r\n**\r\n** If anything goes wrong, set an error in the database connection.\r\n*/\r\nSQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){\r\n  int i;\r\n  int go = 1;\r\n  int rc;\r\n  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);\r\n\r\n  wsdAutoextInit;\r\n  if( wsdAutoext.nExt==0 ){\r\n    /* Common case: early out without every having to acquire a mutex */\r\n    return;\r\n  }\r\n  for(i=0; go; i++){\r\n    char *zErrmsg;\r\n#if SQLITE_THREADSAFE\r\n    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\r\n#endif\r\n    sqlite3_mutex_enter(mutex);\r\n    if( i>=wsdAutoext.nExt ){\r\n      xInit = 0;\r\n      go = 0;\r\n    }else{\r\n      xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))\r\n              wsdAutoext.aExt[i];\r\n    }\r\n    sqlite3_mutex_leave(mutex);\r\n    zErrmsg = 0;\r\n    if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){\r\n      sqlite3Error(db, rc,\r\n            \"automatic extension loading failed: %s\", zErrmsg);\r\n      go = 0;\r\n    }\r\n    sqlite3_free(zErrmsg);\r\n  }\r\n}\r\n\r\n/************** End of loadext.c *********************************************/\r\n/************** Begin file pragma.c ******************************************/\r\n/*\r\n** 2003 April 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used to implement the PRAGMA command.\r\n*/\r\n\r\n/*\r\n** Interpret the given string as a safety level.  Return 0 for OFF,\r\n** 1 for ON or NORMAL and 2 for FULL.  Return 1 for an empty or \r\n** unrecognized string argument.  The FULL option is disallowed\r\n** if the omitFull parameter it 1.\r\n**\r\n** Note that the values returned are one less that the values that\r\n** should be passed into sqlite3BtreeSetSafetyLevel().  The is done\r\n** to support legacy SQL code.  The safety level used to be boolean\r\n** and older scripts may have used numbers 0 for OFF and 1 for ON.\r\n*/\r\nstatic u8 getSafetyLevel(const char *z, int omitFull, int dflt){\r\n                             /* 123456789 123456789 */\r\n  static const char zText[] = \"onoffalseyestruefull\";\r\n  static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};\r\n  static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};\r\n  static const u8 iValue[] =  {1, 0, 0, 0, 1, 1, 2};\r\n  int i, n;\r\n  if( sqlite3Isdigit(*z) ){\r\n    return (u8)sqlite3Atoi(z);\r\n  }\r\n  n = sqlite3Strlen30(z);\r\n  for(i=0; i<ArraySize(iLength)-omitFull; i++){\r\n    if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){\r\n      return iValue[i];\r\n    }\r\n  }\r\n  return dflt;\r\n}\r\n\r\n/*\r\n** Interpret the given string as a boolean value.\r\n*/\r\nSQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z, int dflt){\r\n  return getSafetyLevel(z,1,dflt)!=0;\r\n}\r\n\r\n/* The sqlite3GetBoolean() function is used by other modules but the\r\n** remainder of this file is specific to PRAGMA processing.  So omit\r\n** the rest of the file if PRAGMAs are omitted from the build.\r\n*/\r\n#if !defined(SQLITE_OMIT_PRAGMA)\r\n\r\n/*\r\n** Interpret the given string as a locking mode value.\r\n*/\r\nstatic int getLockingMode(const char *z){\r\n  if( z ){\r\n    if( 0==sqlite3StrICmp(z, \"exclusive\") ) return PAGER_LOCKINGMODE_EXCLUSIVE;\r\n    if( 0==sqlite3StrICmp(z, \"normal\") ) return PAGER_LOCKINGMODE_NORMAL;\r\n  }\r\n  return PAGER_LOCKINGMODE_QUERY;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n/*\r\n** Interpret the given string as an auto-vacuum mode value.\r\n**\r\n** The following strings, \"none\", \"full\" and \"incremental\" are \r\n** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively.\r\n*/\r\nstatic int getAutoVacuum(const char *z){\r\n  int i;\r\n  if( 0==sqlite3StrICmp(z, \"none\") ) return BTREE_AUTOVACUUM_NONE;\r\n  if( 0==sqlite3StrICmp(z, \"full\") ) return BTREE_AUTOVACUUM_FULL;\r\n  if( 0==sqlite3StrICmp(z, \"incremental\") ) return BTREE_AUTOVACUUM_INCR;\r\n  i = sqlite3Atoi(z);\r\n  return (u8)((i>=0&&i<=2)?i:0);\r\n}\r\n#endif /* ifndef SQLITE_OMIT_AUTOVACUUM */\r\n\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\n/*\r\n** Interpret the given string as a temp db location. Return 1 for file\r\n** backed temporary databases, 2 for the Red-Black tree in memory database\r\n** and 0 to use the compile-time default.\r\n*/\r\nstatic int getTempStore(const char *z){\r\n  if( z[0]>='0' && z[0]<='2' ){\r\n    return z[0] - '0';\r\n  }else if( sqlite3StrICmp(z, \"file\")==0 ){\r\n    return 1;\r\n  }else if( sqlite3StrICmp(z, \"memory\")==0 ){\r\n    return 2;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\n#endif /* SQLITE_PAGER_PRAGMAS */\r\n\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\n/*\r\n** Invalidate temp storage, either when the temp storage is changed\r\n** from default, or when 'file' and the temp_store_directory has changed\r\n*/\r\nstatic int invalidateTempStorage(Parse *pParse){\r\n  sqlite3 *db = pParse->db;\r\n  if( db->aDb[1].pBt!=0 ){\r\n    if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){\r\n      sqlite3ErrorMsg(pParse, \"temporary storage cannot be changed \"\r\n        \"from within a transaction\");\r\n      return SQLITE_ERROR;\r\n    }\r\n    sqlite3BtreeClose(db->aDb[1].pBt);\r\n    db->aDb[1].pBt = 0;\r\n    sqlite3ResetInternalSchema(db, -1);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n#endif /* SQLITE_PAGER_PRAGMAS */\r\n\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\n/*\r\n** If the TEMP database is open, close it and mark the database schema\r\n** as needing reloading.  This must be done when using the SQLITE_TEMP_STORE\r\n** or DEFAULT_TEMP_STORE pragmas.\r\n*/\r\nstatic int changeTempStorage(Parse *pParse, const char *zStorageType){\r\n  int ts = getTempStore(zStorageType);\r\n  sqlite3 *db = pParse->db;\r\n  if( db->temp_store==ts ) return SQLITE_OK;\r\n  if( invalidateTempStorage( pParse ) != SQLITE_OK ){\r\n    return SQLITE_ERROR;\r\n  }\r\n  db->temp_store = (u8)ts;\r\n  return SQLITE_OK;\r\n}\r\n#endif /* SQLITE_PAGER_PRAGMAS */\r\n\r\n/*\r\n** Generate code to return a single integer value.\r\n*/\r\nstatic void returnSingleInt(Parse *pParse, const char *zLabel, i64 value){\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  int mem = ++pParse->nMem;\r\n  i64 *pI64 = sqlite3DbMallocRaw(pParse->db, sizeof(value));\r\n  if( pI64 ){\r\n    memcpy(pI64, &value, sizeof(value));\r\n  }\r\n  sqlite3VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64);\r\n  sqlite3VdbeSetNumCols(v, 1);\r\n  sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC);\r\n  sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_FLAG_PRAGMAS\r\n/*\r\n** Check to see if zRight and zLeft refer to a pragma that queries\r\n** or changes one of the flags in db->flags.  Return 1 if so and 0 if not.\r\n** Also, implement the pragma.\r\n*/\r\nstatic int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){\r\n  static const struct sPragmaType {\r\n    const char *zName;  /* Name of the pragma */\r\n    int mask;           /* Mask for the db->flags value */\r\n  } aPragma[] = {\r\n    { \"full_column_names\",        SQLITE_FullColNames  },\r\n    { \"short_column_names\",       SQLITE_ShortColNames },\r\n    { \"count_changes\",            SQLITE_CountRows     },\r\n    { \"empty_result_callbacks\",   SQLITE_NullCallback  },\r\n    { \"legacy_file_format\",       SQLITE_LegacyFileFmt },\r\n    { \"fullfsync\",                SQLITE_FullFSync     },\r\n    { \"checkpoint_fullfsync\",     SQLITE_CkptFullFSync },\r\n    { \"reverse_unordered_selects\", SQLITE_ReverseOrder  },\r\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\r\n    { \"automatic_index\",          SQLITE_AutoIndex     },\r\n#endif\r\n#ifdef SQLITE_DEBUG\r\n    { \"sql_trace\",                SQLITE_SqlTrace      },\r\n    { \"vdbe_listing\",             SQLITE_VdbeListing   },\r\n    { \"vdbe_trace\",               SQLITE_VdbeTrace     },\r\n#endif\r\n#ifndef SQLITE_OMIT_CHECK\r\n    { \"ignore_check_constraints\", SQLITE_IgnoreChecks  },\r\n#endif\r\n    /* The following is VERY experimental */\r\n    { \"writable_schema\",          SQLITE_WriteSchema|SQLITE_RecoveryMode },\r\n\r\n    /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted\r\n    ** flag if there are any active statements. */\r\n    { \"read_uncommitted\",         SQLITE_ReadUncommitted },\r\n    { \"recursive_triggers\",       SQLITE_RecTriggers },\r\n\r\n    /* This flag may only be set if both foreign-key and trigger support\r\n    ** are present in the build.  */\r\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\r\n    { \"foreign_keys\",             SQLITE_ForeignKeys },\r\n#endif\r\n  };\r\n  int i;\r\n  const struct sPragmaType *p;\r\n  for(i=0, p=aPragma; i<ArraySize(aPragma); i++, p++){\r\n    if( sqlite3StrICmp(zLeft, p->zName)==0 ){\r\n      sqlite3 *db = pParse->db;\r\n      Vdbe *v;\r\n      v = sqlite3GetVdbe(pParse);\r\n      assert( v!=0 );  /* Already allocated by sqlite3Pragma() */\r\n      if( ALWAYS(v) ){\r\n        if( zRight==0 ){\r\n          returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 );\r\n        }else{\r\n          int mask = p->mask;          /* Mask of bits to set or clear. */\r\n          if( db->autoCommit==0 ){\r\n            /* Foreign key support may not be enabled or disabled while not\r\n            ** in auto-commit mode.  */\r\n            mask &= ~(SQLITE_ForeignKeys);\r\n          }\r\n\r\n          if( sqlite3GetBoolean(zRight, 0) ){\r\n            db->flags |= mask;\r\n          }else{\r\n            db->flags &= ~mask;\r\n          }\r\n\r\n          /* Many of the flag-pragmas modify the code generated by the SQL \r\n          ** compiler (eg. count_changes). So add an opcode to expire all\r\n          ** compiled SQL statements after modifying a pragma value.\r\n          */\r\n          sqlite3VdbeAddOp2(v, OP_Expire, 0, 0);\r\n        }\r\n      }\r\n\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n#endif /* SQLITE_OMIT_FLAG_PRAGMAS */\r\n\r\n/*\r\n** Return a human-readable name for a constraint resolution action.\r\n*/\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\nstatic const char *actionName(u8 action){\r\n  const char *zName;\r\n  switch( action ){\r\n    case OE_SetNull:  zName = \"SET NULL\";        break;\r\n    case OE_SetDflt:  zName = \"SET DEFAULT\";     break;\r\n    case OE_Cascade:  zName = \"CASCADE\";         break;\r\n    case OE_Restrict: zName = \"RESTRICT\";        break;\r\n    default:          zName = \"NO ACTION\";  \r\n                      assert( action==OE_None ); break;\r\n  }\r\n  return zName;\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants\r\n** defined in pager.h. This function returns the associated lowercase\r\n** journal-mode name.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3JournalModename(int eMode){\r\n  static char * const azModeName[] = {\r\n    \"delete\", \"persist\", \"off\", \"truncate\", \"memory\"\r\n#ifndef SQLITE_OMIT_WAL\r\n     , \"wal\"\r\n#endif\r\n  };\r\n  assert( PAGER_JOURNALMODE_DELETE==0 );\r\n  assert( PAGER_JOURNALMODE_PERSIST==1 );\r\n  assert( PAGER_JOURNALMODE_OFF==2 );\r\n  assert( PAGER_JOURNALMODE_TRUNCATE==3 );\r\n  assert( PAGER_JOURNALMODE_MEMORY==4 );\r\n  assert( PAGER_JOURNALMODE_WAL==5 );\r\n  assert( eMode>=0 && eMode<=ArraySize(azModeName) );\r\n\r\n  if( eMode==ArraySize(azModeName) ) return 0;\r\n  return azModeName[eMode];\r\n}\r\n\r\n/*\r\n** Process a pragma statement.  \r\n**\r\n** Pragmas are of this form:\r\n**\r\n**      PRAGMA [database.]id [= value]\r\n**\r\n** The identifier might also be a string.  The value is a string, and\r\n** identifier, or a number.  If minusFlag is true, then the value is\r\n** a number that was preceded by a minus sign.\r\n**\r\n** If the left side is \"database.id\" then pId1 is the database name\r\n** and pId2 is the id.  If the left side is just \"id\" then pId1 is the\r\n** id and pId2 is any empty string.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Pragma(\r\n  Parse *pParse, \r\n  Token *pId1,        /* First part of [database.]id field */\r\n  Token *pId2,        /* Second part of [database.]id field, or NULL */\r\n  Token *pValue,      /* Token for <value>, or NULL */\r\n  int minusFlag       /* True if a '-' sign preceded <value> */\r\n){\r\n\r\n  char *zLeft = 0;       /* Nul-terminated UTF-8 string <id> */\r\n  char *zRight = 0;      /* Nul-terminated UTF-8 string <value>, or NULL */\r\n  const char *zDb = 0;   /* The database name */\r\n  Token *pId;            /* Pointer to <id> token */\r\n  int iDb;               /* Database index for <database> */\r\n  char *aFcntl[4];       /* Argument to SQLITE_FCNTL_PRAGMA */\r\n  int rc;                      /* return value form SQLITE_FCNTL_PRAGMA */\r\n  sqlite3 *db = pParse->db;    /* The database connection */\r\n  Db *pDb;                     /* The specific database being pragmaed */\r\n  Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(db);  /* Prepared statement */\r\n\r\n  if( v==0 ) return;\r\n  sqlite3VdbeRunOnlyOnce(v);\r\n  pParse->nMem = 2;\r\n\r\n  /* Interpret the [database.] part of the pragma statement. iDb is the\r\n  ** index of the database this pragma is being applied to in db.aDb[]. */\r\n  iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId);\r\n  if( iDb<0 ) return;\r\n  pDb = &db->aDb[iDb];\r\n\r\n  /* If the temp database has been explicitly named as part of the \r\n  ** pragma, make sure it is open. \r\n  */\r\n  if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){\r\n    return;\r\n  }\r\n\r\n  zLeft = sqlite3NameFromToken(db, pId);\r\n  if( !zLeft ) return;\r\n  if( minusFlag ){\r\n    zRight = sqlite3MPrintf(db, \"-%T\", pValue);\r\n  }else{\r\n    zRight = sqlite3NameFromToken(db, pValue);\r\n  }\r\n\r\n  assert( pId2 );\r\n  zDb = pId2->n>0 ? pDb->zName : 0;\r\n  if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){\r\n    goto pragma_out;\r\n  }\r\n\r\n  /* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS\r\n  ** connection.  If it returns SQLITE_OK, then assume that the VFS\r\n  ** handled the pragma and generate a no-op prepared statement.\r\n  */\r\n  aFcntl[0] = 0;\r\n  aFcntl[1] = zLeft;\r\n  aFcntl[2] = zRight;\r\n  aFcntl[3] = 0;\r\n  rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);\r\n\r\n  if( rc==SQLITE_OK ){\r\n    if( aFcntl[0] ){\r\n      int mem = ++pParse->nMem;\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, mem, 0, aFcntl[0], 0);\r\n      sqlite3VdbeSetNumCols(v, 1);\r\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"result\", SQLITE_STATIC);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1);\r\n      sqlite3_free(aFcntl[0]);\r\n    }\r\n  }else if( rc!=SQLITE_NOTFOUND ){\r\n    if( aFcntl[0] ){\r\n      sqlite3ErrorMsg(pParse, \"%s\", aFcntl[0]);\r\n      sqlite3_free(aFcntl[0]);\r\n    }\r\n    pParse->nErr++;\r\n    pParse->rc = rc;\r\n  }else\r\n                            \r\n \r\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)\r\n\r\n  /*\r\n  **  PRAGMA [database.]default_cache_size\r\n  **  PRAGMA [database.]default_cache_size=N\r\n  **\r\n  ** The first form reports the current persistent setting for the\r\n  ** page cache size.  The value returned is the maximum number of\r\n  ** pages in the page cache.  The second form sets both the current\r\n  ** page cache size value and the persistent page cache size value\r\n  ** stored in the database file.\r\n  **\r\n  ** Older versions of SQLite would set the default cache size to a\r\n  ** negative number to indicate synchronous=OFF.  These days, synchronous\r\n  ** is always on by default regardless of the sign of the default cache\r\n  ** size.  But continue to take the absolute value of the default cache\r\n  ** size of historical compatibility.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"default_cache_size\")==0 ){\r\n    static const VdbeOpList getCacheSize[] = {\r\n      { OP_Transaction, 0, 0,        0},                         /* 0 */\r\n      { OP_ReadCookie,  0, 1,        BTREE_DEFAULT_CACHE_SIZE},  /* 1 */\r\n      { OP_IfPos,       1, 7,        0},\r\n      { OP_Integer,     0, 2,        0},\r\n      { OP_Subtract,    1, 2,        1},\r\n      { OP_IfPos,       1, 7,        0},\r\n      { OP_Integer,     0, 1,        0},                         /* 6 */\r\n      { OP_ResultRow,   1, 1,        0},\r\n    };\r\n    int addr;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    sqlite3VdbeUsesBtree(v, iDb);\r\n    if( !zRight ){\r\n      sqlite3VdbeSetNumCols(v, 1);\r\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"cache_size\", SQLITE_STATIC);\r\n      pParse->nMem += 2;\r\n      addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);\r\n      sqlite3VdbeChangeP1(v, addr, iDb);\r\n      sqlite3VdbeChangeP1(v, addr+1, iDb);\r\n      sqlite3VdbeChangeP1(v, addr+6, SQLITE_DEFAULT_CACHE_SIZE);\r\n    }else{\r\n      int size = sqlite3AbsInt32(sqlite3Atoi(zRight));\r\n      sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, size, 1);\r\n      sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, 1);\r\n      assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n      pDb->pSchema->cache_size = size;\r\n      sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);\r\n    }\r\n  }else\r\n#endif /* !SQLITE_OMIT_PAGER_PRAGMAS && !SQLITE_OMIT_DEPRECATED */\r\n\r\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\r\n  /*\r\n  **  PRAGMA [database.]page_size\r\n  **  PRAGMA [database.]page_size=N\r\n  **\r\n  ** The first form reports the current setting for the\r\n  ** database page size in bytes.  The second form sets the\r\n  ** database page size value.  The value can only be set if\r\n  ** the database has not yet been created.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"page_size\")==0 ){\r\n    Btree *pBt = pDb->pBt;\r\n    assert( pBt!=0 );\r\n    if( !zRight ){\r\n      int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;\r\n      returnSingleInt(pParse, \"page_size\", size);\r\n    }else{\r\n      /* Malloc may fail when setting the page-size, as there is an internal\r\n      ** buffer that the pager module resizes using sqlite3_realloc().\r\n      */\r\n      db->nextPagesize = sqlite3Atoi(zRight);\r\n      if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){\r\n        db->mallocFailed = 1;\r\n      }\r\n    }\r\n  }else\r\n\r\n  /*\r\n  **  PRAGMA [database.]secure_delete\r\n  **  PRAGMA [database.]secure_delete=ON/OFF\r\n  **\r\n  ** The first form reports the current setting for the\r\n  ** secure_delete flag.  The second form changes the secure_delete\r\n  ** flag setting and reports thenew value.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"secure_delete\")==0 ){\r\n    Btree *pBt = pDb->pBt;\r\n    int b = -1;\r\n    assert( pBt!=0 );\r\n    if( zRight ){\r\n      b = sqlite3GetBoolean(zRight, 0);\r\n    }\r\n    if( pId2->n==0 && b>=0 ){\r\n      int ii;\r\n      for(ii=0; ii<db->nDb; ii++){\r\n        sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);\r\n      }\r\n    }\r\n    b = sqlite3BtreeSecureDelete(pBt, b);\r\n    returnSingleInt(pParse, \"secure_delete\", b);\r\n  }else\r\n\r\n  /*\r\n  **  PRAGMA [database.]max_page_count\r\n  **  PRAGMA [database.]max_page_count=N\r\n  **\r\n  ** The first form reports the current setting for the\r\n  ** maximum number of pages in the database file.  The \r\n  ** second form attempts to change this setting.  Both\r\n  ** forms return the current setting.\r\n  **\r\n  ** The absolute value of N is used.  This is undocumented and might\r\n  ** change.  The only purpose is to provide an easy way to test\r\n  ** the sqlite3AbsInt32() function.\r\n  **\r\n  **  PRAGMA [database.]page_count\r\n  **\r\n  ** Return the number of pages in the specified database.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"page_count\")==0\r\n   || sqlite3StrICmp(zLeft,\"max_page_count\")==0\r\n  ){\r\n    int iReg;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    sqlite3CodeVerifySchema(pParse, iDb);\r\n    iReg = ++pParse->nMem;\r\n    if( sqlite3Tolower(zLeft[0])=='p' ){\r\n      sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);\r\n    }else{\r\n      sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, \r\n                        sqlite3AbsInt32(sqlite3Atoi(zRight)));\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);\r\n  }else\r\n\r\n  /*\r\n  **  PRAGMA [database.]locking_mode\r\n  **  PRAGMA [database.]locking_mode = (normal|exclusive)\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"locking_mode\")==0 ){\r\n    const char *zRet = \"normal\";\r\n    int eMode = getLockingMode(zRight);\r\n\r\n    if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){\r\n      /* Simple \"PRAGMA locking_mode;\" statement. This is a query for\r\n      ** the current default locking mode (which may be different to\r\n      ** the locking-mode of the main database).\r\n      */\r\n      eMode = db->dfltLockMode;\r\n    }else{\r\n      Pager *pPager;\r\n      if( pId2->n==0 ){\r\n        /* This indicates that no database name was specified as part\r\n        ** of the PRAGMA command. In this case the locking-mode must be\r\n        ** set on all attached databases, as well as the main db file.\r\n        **\r\n        ** Also, the sqlite3.dfltLockMode variable is set so that\r\n        ** any subsequently attached databases also use the specified\r\n        ** locking mode.\r\n        */\r\n        int ii;\r\n        assert(pDb==&db->aDb[0]);\r\n        for(ii=2; ii<db->nDb; ii++){\r\n          pPager = sqlite3BtreePager(db->aDb[ii].pBt);\r\n          sqlite3PagerLockingMode(pPager, eMode);\r\n        }\r\n        db->dfltLockMode = (u8)eMode;\r\n      }\r\n      pPager = sqlite3BtreePager(pDb->pBt);\r\n      eMode = sqlite3PagerLockingMode(pPager, eMode);\r\n    }\r\n\r\n    assert(eMode==PAGER_LOCKINGMODE_NORMAL||eMode==PAGER_LOCKINGMODE_EXCLUSIVE);\r\n    if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){\r\n      zRet = \"exclusive\";\r\n    }\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"locking_mode\", SQLITE_STATIC);\r\n    sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, zRet, 0);\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\r\n  }else {\r\n\t// Break IF/ELSE CHAIN\r\n  }\r\n\r\n  /*\r\n  **  PRAGMA [database.]journal_mode\r\n  **  PRAGMA [database.]journal_mode =\r\n  **                      (delete|persist|off|truncate|memory|wal|off)\r\n  */\r\n  if( 1 ){ // REDRUM... REDRUM...\r\n    int eMode;        /* One of the PAGER_JOURNALMODE_XXX symbols */\r\n    int ii;           /* Loop counter */\r\n\r\n    /* Force the schema to be loaded on all databases.  This causes all\r\n    ** database files to be opened and the journal_modes set.  This is\r\n    ** necessary because subsequent processing must know if the databases\r\n    ** are in WAL mode. */\r\n    if( sqlite3ReadSchema(pParse) ){\r\n      goto pragma_out;\r\n    }\r\n\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"journal_mode\", SQLITE_STATIC);\r\n\r\n    if( zRight==0 ){\r\n      /* If there is no \"=MODE\" part of the pragma, do a query for the\r\n      ** current mode */\r\n      eMode = PAGER_JOURNALMODE_QUERY;\r\n    }else{\r\n      const char *zMode;\r\n      int n = sqlite3Strlen30(zRight);\r\n      for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){\r\n        if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;\r\n      }\r\n      if( !zMode ){\r\n        /* If the \"=MODE\" part does not match any known journal mode,\r\n        ** then do a query */\r\n        eMode = PAGER_JOURNALMODE_QUERY;\r\n      }\r\n    }\r\n    if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){\r\n      /* Convert \"PRAGMA journal_mode\" into \"PRAGMA main.journal_mode\" */\r\n      iDb = 0;\r\n      pId2->n = 1;\r\n    }\r\n    for(ii=db->nDb-1; ii>=0; ii--){\r\n      if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){\r\n        sqlite3VdbeUsesBtree(v, ii);\r\n        sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);\r\n      }\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\r\n  } else\r\n\r\n  /*\r\n  **  PRAGMA [database.]journal_size_limit\r\n  **  PRAGMA [database.]journal_size_limit=N\r\n  **\r\n  ** Get or set the size limit on rollback journal files.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"journal_size_limit\")==0 ){\r\n    Pager *pPager = sqlite3BtreePager(pDb->pBt);\r\n    i64 iLimit = -2;\r\n    if( zRight ){\r\n      sqlite3Atoi64(zRight, &iLimit, 1000000, SQLITE_UTF8);\r\n      if( iLimit<-1 ) iLimit = -1;\r\n    }\r\n    iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);\r\n    returnSingleInt(pParse, \"journal_size_limit\", iLimit);\r\n  }else\r\n\r\n#endif /* SQLITE_OMIT_PAGER_PRAGMAS */\r\n\r\n  /*\r\n  **  PRAGMA [database.]auto_vacuum\r\n  **  PRAGMA [database.]auto_vacuum=N\r\n  **\r\n  ** Get or set the value of the database 'auto-vacuum' parameter.\r\n  ** The value is one of:  0 NONE 1 FULL 2 INCREMENTAL\r\n  */\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  if( sqlite3StrICmp(zLeft,\"auto_vacuum\")==0 ){\r\n    Btree *pBt = pDb->pBt;\r\n    assert( pBt!=0 );\r\n    if( sqlite3ReadSchema(pParse) ){\r\n      goto pragma_out;\r\n    }\r\n    if( !zRight ){\r\n      int auto_vacuum;\r\n      if( ALWAYS(pBt) ){\r\n         auto_vacuum = sqlite3BtreeGetAutoVacuum(pBt);\r\n      }else{\r\n         auto_vacuum = SQLITE_DEFAULT_AUTOVACUUM;\r\n      }\r\n      returnSingleInt(pParse, \"auto_vacuum\", auto_vacuum);\r\n    }else{\r\n      int eAuto = getAutoVacuum(zRight);\r\n      assert( eAuto>=0 && eAuto<=2 );\r\n      db->nextAutovac = (u8)eAuto;\r\n      if( ALWAYS(eAuto>=0) ){\r\n        /* Call SetAutoVacuum() to set initialize the internal auto and\r\n        ** incr-vacuum flags. This is required in case this connection\r\n        ** creates the database file. It is important that it is created\r\n        ** as an auto-vacuum capable db.\r\n        */\r\n        rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto);\r\n        if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){\r\n          /* When setting the auto_vacuum mode to either \"full\" or \r\n          ** \"incremental\", write the value of meta[6] in the database\r\n          ** file. Before writing to meta[6], check that meta[3] indicates\r\n          ** that this really is an auto-vacuum capable database.\r\n          */\r\n          static const VdbeOpList setMeta6[] = {\r\n            { OP_Transaction,    0,         1,                 0},    /* 0 */\r\n            { OP_ReadCookie,     0,         1,         BTREE_LARGEST_ROOT_PAGE},\r\n            { OP_If,             1,         0,                 0},    /* 2 */\r\n            { OP_Halt,           SQLITE_OK, OE_Abort,          0},    /* 3 */\r\n            { OP_Integer,        0,         1,                 0},    /* 4 */\r\n            { OP_SetCookie,      0,         BTREE_INCR_VACUUM, 1},    /* 5 */\r\n          };\r\n          int iAddr;\r\n          iAddr = sqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6);\r\n          sqlite3VdbeChangeP1(v, iAddr, iDb);\r\n          sqlite3VdbeChangeP1(v, iAddr+1, iDb);\r\n          sqlite3VdbeChangeP2(v, iAddr+2, iAddr+4);\r\n          sqlite3VdbeChangeP1(v, iAddr+4, eAuto-1);\r\n          sqlite3VdbeChangeP1(v, iAddr+5, iDb);\r\n          sqlite3VdbeUsesBtree(v, iDb);\r\n        }\r\n      }\r\n    }\r\n  }else\r\n#endif\r\n\r\n  /*\r\n  **  PRAGMA [database.]incremental_vacuum(N)\r\n  **\r\n  ** Do N steps of incremental vacuuming on a database.\r\n  */\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  if( sqlite3StrICmp(zLeft,\"incremental_vacuum\")==0 ){\r\n    int iLimit, addr;\r\n    if( sqlite3ReadSchema(pParse) ){\r\n      goto pragma_out;\r\n    }\r\n    if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){\r\n      iLimit = 0x7fffffff;\r\n    }\r\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);\r\n    addr = sqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb);\r\n    sqlite3VdbeAddOp1(v, OP_ResultRow, 1);\r\n    sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);\r\n    sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr);\r\n    sqlite3VdbeJumpHere(v, addr);\r\n  }else\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\n  /*\r\n  **  PRAGMA [database.]cache_size\r\n  **  PRAGMA [database.]cache_size=N\r\n  **\r\n  ** The first form reports the current local setting for the\r\n  ** page cache size. The second form sets the local\r\n  ** page cache size value.  If N is positive then that is the\r\n  ** number of pages in the cache.  If N is negative, then the\r\n  ** number of pages is adjusted so that the cache uses -N kibibytes\r\n  ** of memory.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"cache_size\")==0 ){\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    if( !zRight ){\r\n      returnSingleInt(pParse, \"cache_size\", pDb->pSchema->cache_size);\r\n    }else{\r\n      int size = sqlite3Atoi(zRight);\r\n      pDb->pSchema->cache_size = size;\r\n      sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);\r\n    }\r\n  }else\r\n\r\n  /*\r\n  **   PRAGMA temp_store\r\n  **   PRAGMA temp_store = \"default\"|\"memory\"|\"file\"\r\n  **\r\n  ** Return or set the local value of the temp_store flag.  Changing\r\n  ** the local value does not make changes to the disk file and the default\r\n  ** value will be restored the next time the database is opened.\r\n  **\r\n  ** Note that it is possible for the library compile-time options to\r\n  ** override this setting\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"temp_store\")==0 ){\r\n    if( !zRight ){\r\n      returnSingleInt(pParse, \"temp_store\", db->temp_store);\r\n    }else{\r\n      changeTempStorage(pParse, zRight);\r\n    }\r\n  }else\r\n\r\n  /*\r\n  **   PRAGMA temp_store_directory\r\n  **   PRAGMA temp_store_directory = \"\"|\"directory_name\"\r\n  **\r\n  ** Return or set the local value of the temp_store_directory flag.  Changing\r\n  ** the value sets a specific directory to be used for temporary files.\r\n  ** Setting to a null string reverts to the default temporary directory search.\r\n  ** If temporary directory is changed, then invalidateTempStorage.\r\n  **\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"temp_store_directory\")==0 ){\r\n    if( !zRight ){\r\n      if( sqlite3_temp_directory ){\r\n        sqlite3VdbeSetNumCols(v, 1);\r\n        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \r\n            \"temp_store_directory\", SQLITE_STATIC);\r\n        sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, sqlite3_temp_directory, 0);\r\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\r\n      }\r\n    }else{\r\n#ifndef SQLITE_OMIT_WSD\r\n      if( zRight[0] ){\r\n        int res;\r\n        rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);\r\n        if( rc!=SQLITE_OK || res==0 ){\r\n          sqlite3ErrorMsg(pParse, \"not a writable directory\");\r\n          goto pragma_out;\r\n        }\r\n      }\r\n      if( SQLITE_TEMP_STORE==0\r\n       || (SQLITE_TEMP_STORE==1 && db->temp_store<=1)\r\n       || (SQLITE_TEMP_STORE==2 && db->temp_store==1)\r\n      ){\r\n        invalidateTempStorage(pParse);\r\n      }\r\n      sqlite3_free(sqlite3_temp_directory);\r\n      if( zRight[0] ){\r\n        sqlite3_temp_directory = sqlite3_mprintf(\"%s\", zRight);\r\n      }else{\r\n        sqlite3_temp_directory = 0;\r\n      }\r\n#endif /* SQLITE_OMIT_WSD */\r\n    }\r\n  }else\r\n\r\n#if !defined(SQLITE_ENABLE_LOCKING_STYLE)\r\n#  if defined(__APPLE__)\r\n#    define SQLITE_ENABLE_LOCKING_STYLE 1\r\n#  else\r\n#    define SQLITE_ENABLE_LOCKING_STYLE 0\r\n#  endif\r\n#endif\r\n#if SQLITE_ENABLE_LOCKING_STYLE\r\n  /*\r\n   **   PRAGMA [database.]lock_proxy_file\r\n   **   PRAGMA [database.]lock_proxy_file = \":auto:\"|\"lock_file_path\"\r\n   **\r\n   ** Return or set the value of the lock_proxy_file flag.  Changing\r\n   ** the value sets a specific file to be used for database access locks.\r\n   **\r\n   */\r\n  if( sqlite3StrICmp(zLeft, \"lock_proxy_file\")==0 ){\r\n    if( !zRight ){\r\n      Pager *pPager = sqlite3BtreePager(pDb->pBt);\r\n      char *proxy_file_path = NULL;\r\n      sqlite3_file *pFile = sqlite3PagerFile(pPager);\r\n      sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE, \r\n                           &proxy_file_path);\r\n      \r\n      if( proxy_file_path ){\r\n        sqlite3VdbeSetNumCols(v, 1);\r\n        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \r\n                              \"lock_proxy_file\", SQLITE_STATIC);\r\n        sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, proxy_file_path, 0);\r\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\r\n      }\r\n    }else{\r\n      Pager *pPager = sqlite3BtreePager(pDb->pBt);\r\n      sqlite3_file *pFile = sqlite3PagerFile(pPager);\r\n      int res;\r\n      if( zRight[0] ){\r\n        res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, \r\n                                     zRight);\r\n      } else {\r\n        res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, \r\n                                     NULL);\r\n      }\r\n      if( res!=SQLITE_OK ){\r\n        sqlite3ErrorMsg(pParse, \"failed to set lock proxy file\");\r\n        goto pragma_out;\r\n      }\r\n    }\r\n  }else\r\n#endif /* SQLITE_ENABLE_LOCKING_STYLE */      \r\n    \r\n  /*\r\n  **   PRAGMA [database.]synchronous\r\n  **   PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL\r\n  **\r\n  ** Return or set the local value of the synchronous flag.  Changing\r\n  ** the local value does not make changes to the disk file and the\r\n  ** default value will be restored the next time the database is\r\n  ** opened.\r\n  */\r\n  if( sqlite3StrICmp(zLeft,\"synchronous\")==0 ){\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    if( !zRight ){\r\n      returnSingleInt(pParse, \"synchronous\", pDb->safety_level-1);\r\n    }else{\r\n      if( !db->autoCommit ){\r\n        sqlite3ErrorMsg(pParse, \r\n            \"Safety level may not be changed inside a transaction\");\r\n      }else{\r\n        pDb->safety_level = getSafetyLevel(zRight,0,1)+1;\r\n      }\r\n    }\r\n  }else\r\n#endif /* SQLITE_OMIT_PAGER_PRAGMAS */\r\n\r\n#ifndef SQLITE_OMIT_FLAG_PRAGMAS\r\n  if( flagPragma(pParse, zLeft, zRight) ){\r\n    /* The flagPragma() subroutine also generates any necessary code\r\n    ** there is nothing more to do here */\r\n  }else\r\n#endif /* SQLITE_OMIT_FLAG_PRAGMAS */\r\n\r\n#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS\r\n  /*\r\n  **   PRAGMA table_info(<table>)\r\n  **\r\n  ** Return a single row for each column of the named table. The columns of\r\n  ** the returned data set are:\r\n  **\r\n  ** cid:        Column id (numbered from left to right, starting at 0)\r\n  ** name:       Column name\r\n  ** type:       Column declaration type.\r\n  ** notnull:    True if 'NOT NULL' is part of column declaration\r\n  ** dflt_value: The default value for the column, if any.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"table_info\")==0 && zRight ){\r\n    Table *pTab;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    pTab = sqlite3FindTable(db, zRight, zDb);\r\n    if( pTab ){\r\n      int i;\r\n      int nHidden = 0;\r\n      Column *pCol;\r\n      sqlite3VdbeSetNumCols(v, 6);\r\n      pParse->nMem = 6;\r\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"cid\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"name\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 2, COLNAME_NAME, \"type\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 3, COLNAME_NAME, \"notnull\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 4, COLNAME_NAME, \"dflt_value\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 5, COLNAME_NAME, \"pk\", SQLITE_STATIC);\r\n      sqlite3ViewGetColumnNames(pParse, pTab);\r\n      for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){\r\n        if( IsHiddenColumn(pCol) ){\r\n          nHidden++;\r\n          continue;\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_Integer, i-nHidden, 1);\r\n        sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pCol->zName, 0);\r\n        sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,\r\n           pCol->zType ? pCol->zType : \"\", 0);\r\n        sqlite3VdbeAddOp2(v, OP_Integer, (pCol->notNull ? 1 : 0), 4);\r\n        if( pCol->zDflt ){\r\n          sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0);\r\n        }else{\r\n          sqlite3VdbeAddOp2(v, OP_Null, 0, 5);\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_Integer, pCol->isPrimKey, 6);\r\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);\r\n      }\r\n    }\r\n  }else\r\n\r\n  if( sqlite3StrICmp(zLeft, \"index_info\")==0 && zRight ){\r\n    Index *pIdx;\r\n    Table *pTab;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    pIdx = sqlite3FindIndex(db, zRight, zDb);\r\n    if( pIdx ){\r\n      int i;\r\n      pTab = pIdx->pTable;\r\n      sqlite3VdbeSetNumCols(v, 3);\r\n      pParse->nMem = 3;\r\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"seqno\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"cid\", SQLITE_STATIC);\r\n      sqlite3VdbeSetColName(v, 2, COLNAME_NAME, \"name\", SQLITE_STATIC);\r\n      for(i=0; i<pIdx->nColumn; i++){\r\n        int cnum = pIdx->aiColumn[i];\r\n        sqlite3VdbeAddOp2(v, OP_Integer, i, 1);\r\n        sqlite3VdbeAddOp2(v, OP_Integer, cnum, 2);\r\n        assert( pTab->nCol>cnum );\r\n        sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pTab->aCol[cnum].zName, 0);\r\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);\r\n      }\r\n    }\r\n  }else\r\n\r\n  if( sqlite3StrICmp(zLeft, \"index_list\")==0 && zRight ){\r\n    Index *pIdx;\r\n    Table *pTab;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    pTab = sqlite3FindTable(db, zRight, zDb);\r\n    if( pTab ){\r\n      v = sqlite3GetVdbe(pParse);\r\n      pIdx = pTab->pIndex;\r\n      if( pIdx ){\r\n        int i = 0; \r\n        sqlite3VdbeSetNumCols(v, 3);\r\n        pParse->nMem = 3;\r\n        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"seq\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"name\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 2, COLNAME_NAME, \"unique\", SQLITE_STATIC);\r\n        while(pIdx){\r\n          sqlite3VdbeAddOp2(v, OP_Integer, i, 1);\r\n          sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0);\r\n          sqlite3VdbeAddOp2(v, OP_Integer, pIdx->onError!=OE_None, 3);\r\n          sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);\r\n          ++i;\r\n          pIdx = pIdx->pNext;\r\n        }\r\n      }\r\n    }\r\n  }else\r\n\r\n  if( sqlite3StrICmp(zLeft, \"database_list\")==0 ){\r\n    int i;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    sqlite3VdbeSetNumCols(v, 3);\r\n    pParse->nMem = 3;\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"seq\", SQLITE_STATIC);\r\n    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"name\", SQLITE_STATIC);\r\n    sqlite3VdbeSetColName(v, 2, COLNAME_NAME, \"file\", SQLITE_STATIC);\r\n    for(i=0; i<db->nDb; i++){\r\n      if( db->aDb[i].pBt==0 ) continue;\r\n      assert( db->aDb[i].zName!=0 );\r\n      sqlite3VdbeAddOp2(v, OP_Integer, i, 1);\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, db->aDb[i].zName, 0);\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,\r\n           sqlite3BtreeGetFilename(db->aDb[i].pBt), 0);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);\r\n    }\r\n  }else\r\n\r\n  if( sqlite3StrICmp(zLeft, \"collation_list\")==0 ){\r\n    int i = 0;\r\n    HashElem *p;\r\n    sqlite3VdbeSetNumCols(v, 2);\r\n    pParse->nMem = 2;\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"seq\", SQLITE_STATIC);\r\n    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"name\", SQLITE_STATIC);\r\n    for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){\r\n      CollSeq *pColl = (CollSeq *)sqliteHashData(p);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, i++, 1);\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pColl->zName, 0);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);\r\n    }\r\n  }else\r\n#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */\r\n\r\n#ifndef SQLITE_OMIT_FOREIGN_KEY\r\n  if( sqlite3StrICmp(zLeft, \"foreign_key_list\")==0 && zRight ){\r\n    FKey *pFK;\r\n    Table *pTab;\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    pTab = sqlite3FindTable(db, zRight, zDb);\r\n    if( pTab ){\r\n      v = sqlite3GetVdbe(pParse);\r\n      pFK = pTab->pFKey;\r\n      if( pFK ){\r\n        int i = 0; \r\n        sqlite3VdbeSetNumCols(v, 8);\r\n        pParse->nMem = 8;\r\n        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"id\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"seq\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 2, COLNAME_NAME, \"table\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 3, COLNAME_NAME, \"from\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 4, COLNAME_NAME, \"to\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 5, COLNAME_NAME, \"on_update\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 6, COLNAME_NAME, \"on_delete\", SQLITE_STATIC);\r\n        sqlite3VdbeSetColName(v, 7, COLNAME_NAME, \"match\", SQLITE_STATIC);\r\n        while(pFK){\r\n          int j;\r\n          for(j=0; j<pFK->nCol; j++){\r\n            char *zCol = pFK->aCol[j].zCol;\r\n            char *zOnDelete = (char *)actionName(pFK->aAction[0]);\r\n            char *zOnUpdate = (char *)actionName(pFK->aAction[1]);\r\n            sqlite3VdbeAddOp2(v, OP_Integer, i, 1);\r\n            sqlite3VdbeAddOp2(v, OP_Integer, j, 2);\r\n            sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pFK->zTo, 0);\r\n            sqlite3VdbeAddOp4(v, OP_String8, 0, 4, 0,\r\n                              pTab->aCol[pFK->aCol[j].iFrom].zName, 0);\r\n            sqlite3VdbeAddOp4(v, zCol ? OP_String8 : OP_Null, 0, 5, 0, zCol, 0);\r\n            sqlite3VdbeAddOp4(v, OP_String8, 0, 6, 0, zOnUpdate, 0);\r\n            sqlite3VdbeAddOp4(v, OP_String8, 0, 7, 0, zOnDelete, 0);\r\n            sqlite3VdbeAddOp4(v, OP_String8, 0, 8, 0, \"NONE\", 0);\r\n            sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8);\r\n          }\r\n          ++i;\r\n          pFK = pFK->pNextFrom;\r\n        }\r\n      }\r\n    }\r\n  }else\r\n#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */\r\n\r\n#ifndef NDEBUG\r\n  if( sqlite3StrICmp(zLeft, \"parser_trace\")==0 ){\r\n    if( zRight ){\r\n      if( sqlite3GetBoolean(zRight, 0) ){\r\n        sqlite3ParserTrace(stderr, \"parser: \");\r\n      }else{\r\n        sqlite3ParserTrace(0, 0);\r\n      }\r\n    }\r\n  }else\r\n#endif\r\n\r\n  /* Reinstall the LIKE and GLOB functions.  The variant of LIKE\r\n  ** used will be case sensitive or not depending on the RHS.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"case_sensitive_like\")==0 ){\r\n    if( zRight ){\r\n      sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));\r\n    }\r\n  }else\r\n\r\n#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX\r\n# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\r\n  /* Pragma \"quick_check\" is an experimental reduced version of \r\n  ** integrity_check designed to detect most database corruption\r\n  ** without most of the overhead of a full integrity-check.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"integrity_check\")==0\r\n   || sqlite3StrICmp(zLeft, \"quick_check\")==0 \r\n  ){\r\n    int i, j, addr, mxErr;\r\n\r\n    /* Code that appears at the end of the integrity check.  If no error\r\n    ** messages have been generated, output OK.  Otherwise output the\r\n    ** error message\r\n    */\r\n    static const VdbeOpList endCode[] = {\r\n      { OP_AddImm,      1, 0,        0},    /* 0 */\r\n      { OP_IfNeg,       1, 0,        0},    /* 1 */\r\n      { OP_String8,     0, 3,        0},    /* 2 */\r\n      { OP_ResultRow,   3, 1,        0},\r\n    };\r\n\r\n    int isQuick = (sqlite3Tolower(zLeft[0])=='q');\r\n\r\n    /* Initialize the VDBE program */\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    pParse->nMem = 6;\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"integrity_check\", SQLITE_STATIC);\r\n\r\n    /* Set the maximum error count */\r\n    mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;\r\n    if( zRight ){\r\n      sqlite3GetInt32(zRight, &mxErr);\r\n      if( mxErr<=0 ){\r\n        mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;\r\n      }\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1);  /* reg[1] holds errors left */\r\n\r\n    /* Do an integrity check on each database file */\r\n    for(i=0; i<db->nDb; i++){\r\n      HashElem *x;\r\n      Hash *pTbls;\r\n      int cnt = 0;\r\n\r\n      if( OMIT_TEMPDB && i==1 ) continue;\r\n\r\n      sqlite3CodeVerifySchema(pParse, i);\r\n      addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Halt if out of errors */\r\n      sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);\r\n      sqlite3VdbeJumpHere(v, addr);\r\n\r\n      /* Do an integrity check of the B-Tree\r\n      **\r\n      ** Begin by filling registers 2, 3, ... with the root pages numbers\r\n      ** for all tables and indices in the database.\r\n      */\r\n      assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n      pTbls = &db->aDb[i].pSchema->tblHash;\r\n      for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){\r\n        Table *pTab = sqliteHashData(x);\r\n        Index *pIdx;\r\n        sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 2+cnt);\r\n        cnt++;\r\n        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n          sqlite3VdbeAddOp2(v, OP_Integer, pIdx->tnum, 2+cnt);\r\n          cnt++;\r\n        }\r\n      }\r\n\r\n      /* Make sure sufficient number of registers have been allocated */\r\n      if( pParse->nMem < cnt+4 ){\r\n        pParse->nMem = cnt+4;\r\n      }\r\n\r\n      /* Do the b-tree integrity checks */\r\n      sqlite3VdbeAddOp3(v, OP_IntegrityCk, 2, cnt, 1);\r\n      sqlite3VdbeChangeP5(v, (u8)i);\r\n      addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2);\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,\r\n         sqlite3MPrintf(db, \"*** in database %s ***\\n\", db->aDb[i].zName),\r\n         P4_DYNAMIC);\r\n      sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);\r\n      sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1);\r\n      sqlite3VdbeJumpHere(v, addr);\r\n\r\n      /* Make sure all the indices are constructed correctly.\r\n      */\r\n      for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){\r\n        Table *pTab = sqliteHashData(x);\r\n        Index *pIdx;\r\n        int loopTop;\r\n\r\n        if( pTab->pIndex==0 ) continue;\r\n        addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1);  /* Stop if out of errors */\r\n        sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);\r\n        sqlite3VdbeJumpHere(v, addr);\r\n        sqlite3OpenTableAndIndices(pParse, pTab, 1, OP_OpenRead);\r\n        sqlite3VdbeAddOp2(v, OP_Integer, 0, 2);  /* reg(2) will count entries */\r\n        loopTop = sqlite3VdbeAddOp2(v, OP_Rewind, 1, 0);\r\n        sqlite3VdbeAddOp2(v, OP_AddImm, 2, 1);   /* increment entry count */\r\n        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\r\n          int jmp2;\r\n          int r1;\r\n          static const VdbeOpList idxErr[] = {\r\n            { OP_AddImm,      1, -1,  0},\r\n            { OP_String8,     0,  3,  0},    /* 1 */\r\n            { OP_Rowid,       1,  4,  0},\r\n            { OP_String8,     0,  5,  0},    /* 3 */\r\n            { OP_String8,     0,  6,  0},    /* 4 */\r\n            { OP_Concat,      4,  3,  3},\r\n            { OP_Concat,      5,  3,  3},\r\n            { OP_Concat,      6,  3,  3},\r\n            { OP_ResultRow,   3,  1,  0},\r\n            { OP_IfPos,       1,  0,  0},    /* 9 */\r\n            { OP_Halt,        0,  0,  0},\r\n          };\r\n          r1 = sqlite3GenerateIndexKey(pParse, pIdx, 1, 3, 0);\r\n          jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, j+2, 0, r1, pIdx->nColumn+1);\r\n          addr = sqlite3VdbeAddOpList(v, ArraySize(idxErr), idxErr);\r\n          sqlite3VdbeChangeP4(v, addr+1, \"rowid \", P4_STATIC);\r\n          sqlite3VdbeChangeP4(v, addr+3, \" missing from index \", P4_STATIC);\r\n          sqlite3VdbeChangeP4(v, addr+4, pIdx->zName, P4_TRANSIENT);\r\n          sqlite3VdbeJumpHere(v, addr+9);\r\n          sqlite3VdbeJumpHere(v, jmp2);\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_Next, 1, loopTop+1);\r\n        sqlite3VdbeJumpHere(v, loopTop);\r\n        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\r\n          static const VdbeOpList cntIdx[] = {\r\n             { OP_Integer,      0,  3,  0},\r\n             { OP_Rewind,       0,  0,  0},  /* 1 */\r\n             { OP_AddImm,       3,  1,  0},\r\n             { OP_Next,         0,  0,  0},  /* 3 */\r\n             { OP_Eq,           2,  0,  3},  /* 4 */\r\n             { OP_AddImm,       1, -1,  0},\r\n             { OP_String8,      0,  2,  0},  /* 6 */\r\n             { OP_String8,      0,  3,  0},  /* 7 */\r\n             { OP_Concat,       3,  2,  2},\r\n             { OP_ResultRow,    2,  1,  0},\r\n          };\r\n          addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1);\r\n          sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);\r\n          sqlite3VdbeJumpHere(v, addr);\r\n          addr = sqlite3VdbeAddOpList(v, ArraySize(cntIdx), cntIdx);\r\n          sqlite3VdbeChangeP1(v, addr+1, j+2);\r\n          sqlite3VdbeChangeP2(v, addr+1, addr+4);\r\n          sqlite3VdbeChangeP1(v, addr+3, j+2);\r\n          sqlite3VdbeChangeP2(v, addr+3, addr+2);\r\n          sqlite3VdbeJumpHere(v, addr+4);\r\n          sqlite3VdbeChangeP4(v, addr+6, \r\n                     \"wrong # of entries in index \", P4_STATIC);\r\n          sqlite3VdbeChangeP4(v, addr+7, pIdx->zName, P4_TRANSIENT);\r\n        }\r\n      } \r\n    }\r\n    addr = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode);\r\n    sqlite3VdbeChangeP2(v, addr, -mxErr);\r\n    sqlite3VdbeJumpHere(v, addr+1);\r\n    sqlite3VdbeChangeP4(v, addr+2, \"ok\", P4_STATIC);\r\n  }else\r\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n  /*\r\n  **   PRAGMA encoding\r\n  **   PRAGMA encoding = \"utf-8\"|\"utf-16\"|\"utf-16le\"|\"utf-16be\"\r\n  **\r\n  ** In its first form, this pragma returns the encoding of the main\r\n  ** database. If the database is not initialized, it is initialized now.\r\n  **\r\n  ** The second form of this pragma is a no-op if the main database file\r\n  ** has not already been initialized. In this case it sets the default\r\n  ** encoding that will be used for the main database file if a new file\r\n  ** is created. If an existing main database file is opened, then the\r\n  ** default text encoding for the existing database is used.\r\n  ** \r\n  ** In all cases new databases created using the ATTACH command are\r\n  ** created to use the same default text encoding as the main database. If\r\n  ** the main database has not been initialized and/or created when ATTACH\r\n  ** is executed, this is done before the ATTACH operation.\r\n  **\r\n  ** In the second form this pragma sets the text encoding to be used in\r\n  ** new database files created using this database handle. It is only\r\n  ** useful if invoked immediately after the main database i\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"encoding\")==0 ){\r\n    static const struct EncName {\r\n      char *zName;\r\n      u8 enc;\r\n    } encnames[] = {\r\n      { \"UTF8\",     SQLITE_UTF8        },\r\n      { \"UTF-8\",    SQLITE_UTF8        },  /* Must be element [1] */\r\n      { \"UTF-16le\", SQLITE_UTF16LE     },  /* Must be element [2] */\r\n      { \"UTF-16be\", SQLITE_UTF16BE     },  /* Must be element [3] */\r\n      { \"UTF16le\",  SQLITE_UTF16LE     },\r\n      { \"UTF16be\",  SQLITE_UTF16BE     },\r\n      { \"UTF-16\",   0                  }, /* SQLITE_UTF16NATIVE */\r\n      { \"UTF16\",    0                  }, /* SQLITE_UTF16NATIVE */\r\n      { 0, 0 }\r\n    };\r\n    const struct EncName *pEnc;\r\n    if( !zRight ){    /* \"PRAGMA encoding\" */\r\n      if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n      sqlite3VdbeSetNumCols(v, 1);\r\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"encoding\", SQLITE_STATIC);\r\n      sqlite3VdbeAddOp2(v, OP_String8, 0, 1);\r\n      assert( encnames[SQLITE_UTF8].enc==SQLITE_UTF8 );\r\n      assert( encnames[SQLITE_UTF16LE].enc==SQLITE_UTF16LE );\r\n      assert( encnames[SQLITE_UTF16BE].enc==SQLITE_UTF16BE );\r\n      sqlite3VdbeChangeP4(v, -1, encnames[ENC(pParse->db)].zName, P4_STATIC);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\r\n    }else{                        /* \"PRAGMA encoding = XXX\" */\r\n      /* Only change the value of sqlite.enc if the database handle is not\r\n      ** initialized. If the main database exists, the new sqlite.enc value\r\n      ** will be overwritten when the schema is next loaded. If it does not\r\n      ** already exists, it will be created to use the new encoding value.\r\n      */\r\n      if( \r\n        !(DbHasProperty(db, 0, DB_SchemaLoaded)) || \r\n        DbHasProperty(db, 0, DB_Empty) \r\n      ){\r\n        for(pEnc=&encnames[0]; pEnc->zName; pEnc++){\r\n          if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){\r\n            ENC(pParse->db) = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE;\r\n            break;\r\n          }\r\n        }\r\n        if( !pEnc->zName ){\r\n          sqlite3ErrorMsg(pParse, \"unsupported encoding: %s\", zRight);\r\n        }\r\n      }\r\n    }\r\n  }else\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n#ifndef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS\r\n  /*\r\n  **   PRAGMA [database.]schema_version\r\n  **   PRAGMA [database.]schema_version = <integer>\r\n  **\r\n  **   PRAGMA [database.]user_version\r\n  **   PRAGMA [database.]user_version = <integer>\r\n  **\r\n  ** The pragma's schema_version and user_version are used to set or get\r\n  ** the value of the schema-version and user-version, respectively. Both\r\n  ** the schema-version and the user-version are 32-bit signed integers\r\n  ** stored in the database header.\r\n  **\r\n  ** The schema-cookie is usually only manipulated internally by SQLite. It\r\n  ** is incremented by SQLite whenever the database schema is modified (by\r\n  ** creating or dropping a table or index). The schema version is used by\r\n  ** SQLite each time a query is executed to ensure that the internal cache\r\n  ** of the schema used when compiling the SQL query matches the schema of\r\n  ** the database against which the compiled query is actually executed.\r\n  ** Subverting this mechanism by using \"PRAGMA schema_version\" to modify\r\n  ** the schema-version is potentially dangerous and may lead to program\r\n  ** crashes or database corruption. Use with caution!\r\n  **\r\n  ** The user-version is not used internally by SQLite. It may be used by\r\n  ** applications for any purpose.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"schema_version\")==0 \r\n   || sqlite3StrICmp(zLeft, \"user_version\")==0 \r\n   || sqlite3StrICmp(zLeft, \"freelist_count\")==0 \r\n  ){\r\n    int iCookie;   /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */\r\n    sqlite3VdbeUsesBtree(v, iDb);\r\n    switch( zLeft[0] ){\r\n      case 'f': case 'F':\r\n        iCookie = BTREE_FREE_PAGE_COUNT;\r\n        break;\r\n      case 's': case 'S':\r\n        iCookie = BTREE_SCHEMA_VERSION;\r\n        break;\r\n      default:\r\n        iCookie = BTREE_USER_VERSION;\r\n        break;\r\n    }\r\n\r\n    if( zRight && iCookie!=BTREE_FREE_PAGE_COUNT ){\r\n      /* Write the specified cookie value */\r\n      static const VdbeOpList setCookie[] = {\r\n        { OP_Transaction,    0,  1,  0},    /* 0 */\r\n        { OP_Integer,        0,  1,  0},    /* 1 */\r\n        { OP_SetCookie,      0,  0,  1},    /* 2 */\r\n      };\r\n      int addr = sqlite3VdbeAddOpList(v, ArraySize(setCookie), setCookie);\r\n      sqlite3VdbeChangeP1(v, addr, iDb);\r\n      sqlite3VdbeChangeP1(v, addr+1, sqlite3Atoi(zRight));\r\n      sqlite3VdbeChangeP1(v, addr+2, iDb);\r\n      sqlite3VdbeChangeP2(v, addr+2, iCookie);\r\n    }else{\r\n      /* Read the specified cookie value */\r\n      static const VdbeOpList readCookie[] = {\r\n        { OP_Transaction,     0,  0,  0},    /* 0 */\r\n        { OP_ReadCookie,      0,  1,  0},    /* 1 */\r\n        { OP_ResultRow,       1,  1,  0}\r\n      };\r\n      int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie);\r\n      sqlite3VdbeChangeP1(v, addr, iDb);\r\n      sqlite3VdbeChangeP1(v, addr+1, iDb);\r\n      sqlite3VdbeChangeP3(v, addr+1, iCookie);\r\n      sqlite3VdbeSetNumCols(v, 1);\r\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);\r\n    }\r\n  }else\r\n#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */\r\n\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\n  /*\r\n  **   PRAGMA compile_options\r\n  **\r\n  ** Return the names of all compile-time options used in this build,\r\n  ** one option per row.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"compile_options\")==0 ){\r\n    int i = 0;\r\n    const char *zOpt;\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    pParse->nMem = 1;\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"compile_option\", SQLITE_STATIC);\r\n    while( (zOpt = sqlite3_compileoption_get(i++))!=0 ){\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, zOpt, 0);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\r\n    }\r\n  }else\r\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n  /*\r\n  **   PRAGMA [database.]wal_checkpoint = passive|full|restart\r\n  **\r\n  ** Checkpoint the database.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"wal_checkpoint\")==0 ){\r\n    int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);\r\n    int eMode = SQLITE_CHECKPOINT_PASSIVE;\r\n    if( zRight ){\r\n      if( sqlite3StrICmp(zRight, \"full\")==0 ){\r\n        eMode = SQLITE_CHECKPOINT_FULL;\r\n      }else if( sqlite3StrICmp(zRight, \"restart\")==0 ){\r\n        eMode = SQLITE_CHECKPOINT_RESTART;\r\n      }\r\n    }\r\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\r\n    sqlite3VdbeSetNumCols(v, 3);\r\n    pParse->nMem = 3;\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"busy\", SQLITE_STATIC);\r\n    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"log\", SQLITE_STATIC);\r\n    sqlite3VdbeSetColName(v, 2, COLNAME_NAME, \"checkpointed\", SQLITE_STATIC);\r\n\r\n    sqlite3VdbeAddOp3(v, OP_Checkpoint, iBt, eMode, 1);\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);\r\n  }else\r\n\r\n  /*\r\n  **   PRAGMA wal_autocheckpoint\r\n  **   PRAGMA wal_autocheckpoint = N\r\n  **\r\n  ** Configure a database connection to automatically checkpoint a database\r\n  ** after accumulating N frames in the log. Or query for the current value\r\n  ** of N.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"wal_autocheckpoint\")==0 ){\r\n    if( zRight ){\r\n      sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight));\r\n    }\r\n    returnSingleInt(pParse, \"wal_autocheckpoint\", \r\n       db->xWalCallback==sqlite3WalDefaultHook ? \r\n           SQLITE_PTR_TO_INT(db->pWalArg) : 0);\r\n  }else\r\n#endif\r\n\r\n  /*\r\n  **  PRAGMA shrink_memory\r\n  **\r\n  ** This pragma attempts to free as much memory as possible from the\r\n  ** current database connection.\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"shrink_memory\")==0 ){\r\n    sqlite3_db_release_memory(db);\r\n  }else\r\n\r\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\r\n  /*\r\n  ** Report the current state of file logs for all databases\r\n  */\r\n  if( sqlite3StrICmp(zLeft, \"lock_status\")==0 ){\r\n    static const char *const azLockName[] = {\r\n      \"unlocked\", \"shared\", \"reserved\", \"pending\", \"exclusive\"\r\n    };\r\n    int i;\r\n    sqlite3VdbeSetNumCols(v, 2);\r\n    pParse->nMem = 2;\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"database\", SQLITE_STATIC);\r\n    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, \"status\", SQLITE_STATIC);\r\n    for(i=0; i<db->nDb; i++){\r\n      Btree *pBt;\r\n      Pager *pPager;\r\n      const char *zState = \"unknown\";\r\n      int j;\r\n      if( db->aDb[i].zName==0 ) continue;\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, db->aDb[i].zName, P4_STATIC);\r\n      pBt = db->aDb[i].pBt;\r\n      if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){\r\n        zState = \"closed\";\r\n      }else if( sqlite3_file_control(db, i ? db->aDb[i].zName : 0, \r\n                                     SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){\r\n         zState = azLockName[j];\r\n      }\r\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, zState, P4_STATIC);\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);\r\n    }\r\n\r\n  }else\r\n#endif\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n  if( sqlite3StrICmp(zLeft, \"key\")==0 && zRight ){\r\n    sqlite3_key(db, zRight, sqlite3Strlen30(zRight));\r\n  }else\r\n  if( sqlite3StrICmp(zLeft, \"rekey\")==0 && zRight ){\r\n    sqlite3_rekey(db, zRight, sqlite3Strlen30(zRight));\r\n  }else\r\n  if( zRight && (sqlite3StrICmp(zLeft, \"hexkey\")==0 ||\r\n                 sqlite3StrICmp(zLeft, \"hexrekey\")==0) ){\r\n    int i, h1, h2;\r\n    char zKey[40];\r\n    for(i=0; (h1 = zRight[i])!=0 && (h2 = zRight[i+1])!=0; i+=2){\r\n      h1 += 9*(1&(h1>>6));\r\n      h2 += 9*(1&(h2>>6));\r\n      zKey[i/2] = (h2 & 0x0f) | ((h1 & 0xf)<<4);\r\n    }\r\n    if( (zLeft[3] & 0xf)==0xb ){\r\n      sqlite3_key(db, zKey, i/2);\r\n    }else{\r\n      sqlite3_rekey(db, zKey, i/2);\r\n    }\r\n  }else\r\n#endif\r\n#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)\r\n  if( sqlite3StrICmp(zLeft, \"activate_extensions\")==0 ){\r\n#ifdef SQLITE_HAS_CODEC\r\n    if( sqlite3StrNICmp(zRight, \"see-\", 4)==0 ){\r\n      sqlite3_activate_see(&zRight[4]);\r\n    }\r\n#endif\r\n#ifdef SQLITE_ENABLE_CEROD\r\n    if( sqlite3StrNICmp(zRight, \"cerod-\", 6)==0 ){\r\n      sqlite3_activate_cerod(&zRight[6]);\r\n    }\r\n#endif\r\n  }else\r\n#endif\r\n\r\n \r\n  {/* Empty ELSE clause */}\r\n\r\n  /*\r\n  ** Reset the safety level, in case the fullfsync flag or synchronous\r\n  ** setting changed.\r\n  */\r\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\r\n  if( db->autoCommit ){\r\n    sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level,\r\n               (db->flags&SQLITE_FullFSync)!=0,\r\n               (db->flags&SQLITE_CkptFullFSync)!=0);\r\n  }\r\n#endif\r\npragma_out:\r\n  sqlite3DbFree(db, zLeft);\r\n  sqlite3DbFree(db, zRight);\r\n}\r\n\r\n#endif /* SQLITE_OMIT_PRAGMA */\r\n\r\n/************** End of pragma.c **********************************************/\r\n/************** Begin file prepare.c *****************************************/\r\n/*\r\n** 2005 May 25\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the implementation of the sqlite3_prepare()\r\n** interface, and routines that contribute to loading the database schema\r\n** from disk.\r\n*/\r\n\r\n/*\r\n** Fill the InitData structure with an error message that indicates\r\n** that the database is corrupt.\r\n*/\r\nstatic void corruptSchema(\r\n  InitData *pData,     /* Initialization context */\r\n  const char *zObj,    /* Object being parsed at the point of error */\r\n  const char *zExtra   /* Error information */\r\n){\r\n  sqlite3 *db = pData->db;\r\n  if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){\r\n    if( zObj==0 ) zObj = \"?\";\r\n    sqlite3SetString(pData->pzErrMsg, db,\r\n      \"malformed database schema (%s)\", zObj);\r\n    if( zExtra ){\r\n      *pData->pzErrMsg = sqlite3MAppendf(db, *pData->pzErrMsg, \r\n                                 \"%s - %s\", *pData->pzErrMsg, zExtra);\r\n    }\r\n  }\r\n  pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;\r\n}\r\n\r\n/*\r\n** This is the callback routine for the code that initializes the\r\n** database.  See sqlite3Init() below for additional information.\r\n** This routine is also called from the OP_ParseSchema opcode of the VDBE.\r\n**\r\n** Each callback contains the following information:\r\n**\r\n**     argv[0] = name of thing being created\r\n**     argv[1] = root page number for table or index. 0 for trigger or view.\r\n**     argv[2] = SQL text for the CREATE statement.\r\n**\r\n*/\r\nSQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){\r\n  InitData *pData = (InitData*)pInit;\r\n  sqlite3 *db = pData->db;\r\n  int iDb = pData->iDb;\r\n\r\n  assert( argc==3 );\r\n  UNUSED_PARAMETER2(NotUsed, argc);\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  DbClearProperty(db, iDb, DB_Empty);\r\n  if( db->mallocFailed ){\r\n    corruptSchema(pData, argv[0], 0);\r\n    return 1;\r\n  }\r\n\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */\r\n  if( argv[1]==0 ){\r\n    corruptSchema(pData, argv[0], 0);\r\n  }else if( argv[2] && argv[2][0] ){\r\n    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.\r\n    ** But because db->init.busy is set to 1, no VDBE code is generated\r\n    ** or executed.  All the parser does is build the internal data\r\n    ** structures that describe the table, index, or view.\r\n    */\r\n    int rc;\r\n    sqlite3_stmt *pStmt;\r\n    TESTONLY(int rcp);            /* Return code from sqlite3_prepare() */\r\n\r\n    assert( db->init.busy );\r\n    db->init.iDb = iDb;\r\n    db->init.newTnum = sqlite3Atoi(argv[1]);\r\n    db->init.orphanTrigger = 0;\r\n    TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0);\r\n    rc = db->errCode;\r\n    assert( (rc&0xFF)==(rcp&0xFF) );\r\n    db->init.iDb = 0;\r\n    if( SQLITE_OK!=rc ){\r\n      if( db->init.orphanTrigger ){\r\n        assert( iDb==1 );\r\n      }else{\r\n        pData->rc = rc;\r\n        if( rc==SQLITE_NOMEM ){\r\n          db->mallocFailed = 1;\r\n        }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){\r\n          corruptSchema(pData, argv[0], sqlite3_errmsg(db));\r\n        }\r\n      }\r\n    }\r\n    sqlite3_finalize(pStmt);\r\n  }else if( argv[0]==0 ){\r\n    corruptSchema(pData, 0, 0);\r\n  }else{\r\n    /* If the SQL column is blank it means this is an index that\r\n    ** was created to be the PRIMARY KEY or to fulfill a UNIQUE\r\n    ** constraint for a CREATE TABLE.  The index should have already\r\n    ** been created when we processed the CREATE TABLE.  All we have\r\n    ** to do here is record the root page number for that index.\r\n    */\r\n    Index *pIndex;\r\n    pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zName);\r\n    if( pIndex==0 ){\r\n      /* This can occur if there exists an index on a TEMP table which\r\n      ** has the same name as another index on a permanent index.  Since\r\n      ** the permanent table is hidden by the TEMP table, we can also\r\n      ** safely ignore the index on the permanent table.\r\n      */\r\n      /* Do Nothing */;\r\n    }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){\r\n      corruptSchema(pData, argv[0], \"invalid rootpage\");\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Attempt to read the database schema and initialize internal\r\n** data structures for a single database file.  The index of the\r\n** database file is given by iDb.  iDb==0 is used for the main\r\n** database.  iDb==1 should never be used.  iDb>=2 is used for\r\n** auxiliary databases.  Return one of the SQLITE_ error codes to\r\n** indicate success or failure.\r\n*/\r\nstatic int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){\r\n  int rc;\r\n  int i;\r\n  int size;\r\n  Table *pTab;\r\n  Db *pDb;\r\n  char const *azArg[4];\r\n  int meta[5];\r\n  InitData initData;\r\n  char const *zMasterSchema;\r\n  char const *zMasterName;\r\n  int openedTransaction = 0;\r\n\r\n  /*\r\n  ** The master database table has a structure like this\r\n  */\r\n  static const char master_schema[] = \r\n     \"CREATE TABLE sqlite_master(\\n\"\r\n     \"  type text,\\n\"\r\n     \"  name text,\\n\"\r\n     \"  tbl_name text,\\n\"\r\n     \"  rootpage integer,\\n\"\r\n     \"  sql text\\n\"\r\n     \")\"\r\n  ;\r\n#ifndef SQLITE_OMIT_TEMPDB\r\n  static const char temp_master_schema[] = \r\n     \"CREATE TEMP TABLE sqlite_temp_master(\\n\"\r\n     \"  type text,\\n\"\r\n     \"  name text,\\n\"\r\n     \"  tbl_name text,\\n\"\r\n     \"  rootpage integer,\\n\"\r\n     \"  sql text\\n\"\r\n     \")\"\r\n  ;\r\n#else\r\n  #define temp_master_schema 0\r\n#endif\r\n\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  assert( db->aDb[iDb].pSchema );\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );\r\n\r\n  /* zMasterSchema and zInitScript are set to point at the master schema\r\n  ** and initialisation script appropriate for the database being\r\n  ** initialised. zMasterName is the name of the master table.\r\n  */\r\n  if( !OMIT_TEMPDB && iDb==1 ){\r\n    zMasterSchema = temp_master_schema;\r\n  }else{\r\n    zMasterSchema = master_schema;\r\n  }\r\n  zMasterName = SCHEMA_TABLE(iDb);\r\n\r\n  /* Construct the schema tables.  */\r\n  azArg[0] = zMasterName;\r\n  azArg[1] = \"1\";\r\n  azArg[2] = zMasterSchema;\r\n  azArg[3] = 0;\r\n  initData.db = db;\r\n  initData.iDb = iDb;\r\n  initData.rc = SQLITE_OK;\r\n  initData.pzErrMsg = pzErrMsg;\r\n  sqlite3InitCallback(&initData, 3, (char **)azArg, 0);\r\n  if( initData.rc ){\r\n    rc = initData.rc;\r\n    goto error_out;\r\n  }\r\n  pTab = sqlite3FindTable(db, zMasterName, db->aDb[iDb].zName);\r\n  if( ALWAYS(pTab) ){\r\n    pTab->tabFlags |= TF_Readonly;\r\n  }\r\n\r\n  /* Create a cursor to hold the database open\r\n  */\r\n  pDb = &db->aDb[iDb];\r\n  if( pDb->pBt==0 ){\r\n    if( !OMIT_TEMPDB && ALWAYS(iDb==1) ){\r\n      DbSetProperty(db, 1, DB_SchemaLoaded);\r\n    }\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* If there is not already a read-only (or read-write) transaction opened\r\n  ** on the b-tree database, open one now. If a transaction is opened, it \r\n  ** will be closed before this function returns.  */\r\n  sqlite3BtreeEnter(pDb->pBt);\r\n  if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){\r\n    rc = sqlite3BtreeBeginTrans(pDb->pBt, 0);\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3SetString(pzErrMsg, db, \"%s\", sqlite3ErrStr(rc));\r\n      goto initone_error_out;\r\n    }\r\n    openedTransaction = 1;\r\n  }\r\n\r\n  /* Get the database meta information.\r\n  **\r\n  ** Meta values are as follows:\r\n  **    meta[0]   Schema cookie.  Changes with each schema change.\r\n  **    meta[1]   File format of schema layer.\r\n  **    meta[2]   Size of the page cache.\r\n  **    meta[3]   Largest rootpage (auto/incr_vacuum mode)\r\n  **    meta[4]   Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE\r\n  **    meta[5]   User version\r\n  **    meta[6]   Incremental vacuum mode\r\n  **    meta[7]   unused\r\n  **    meta[8]   unused\r\n  **    meta[9]   unused\r\n  **\r\n  ** Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to\r\n  ** the possible values of meta[4].\r\n  */\r\n  for(i=0; i<ArraySize(meta); i++){\r\n    sqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]);\r\n  }\r\n  pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];\r\n\r\n  /* If opening a non-empty database, check the text encoding. For the\r\n  ** main database, set sqlite3.enc to the encoding of the main database.\r\n  ** For an attached db, it is an error if the encoding is not the same\r\n  ** as sqlite3.enc.\r\n  */\r\n  if( meta[BTREE_TEXT_ENCODING-1] ){  /* text encoding */\r\n    if( iDb==0 ){\r\n      u8 encoding;\r\n      /* If opening the main database, set ENC(db). */\r\n      encoding = (u8)meta[BTREE_TEXT_ENCODING-1] & 3;\r\n      if( encoding==0 ) encoding = SQLITE_UTF8;\r\n      ENC(db) = encoding;\r\n      db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, \"BINARY\", 0);\r\n    }else{\r\n      /* If opening an attached database, the encoding much match ENC(db) */\r\n      if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){\r\n        sqlite3SetString(pzErrMsg, db, \"attached databases must use the same\"\r\n            \" text encoding as main database\");\r\n        rc = SQLITE_ERROR;\r\n        goto initone_error_out;\r\n      }\r\n    }\r\n  }else{\r\n    DbSetProperty(db, iDb, DB_Empty);\r\n  }\r\n  pDb->pSchema->enc = ENC(db);\r\n\r\n  if( pDb->pSchema->cache_size==0 ){\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n    size = sqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]);\r\n    if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }\r\n    pDb->pSchema->cache_size = size;\r\n#else\r\n    pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;\r\n#endif\r\n    sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);\r\n  }\r\n\r\n  /*\r\n  ** file_format==1    Version 3.0.0.\r\n  ** file_format==2    Version 3.1.3.  // ALTER TABLE ADD COLUMN\r\n  ** file_format==3    Version 3.1.4.  // ditto but with non-NULL defaults\r\n  ** file_format==4    Version 3.3.0.  // DESC indices.  Boolean constants\r\n  */\r\n  pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];\r\n  if( pDb->pSchema->file_format==0 ){\r\n    pDb->pSchema->file_format = 1;\r\n  }\r\n  if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){\r\n    sqlite3SetString(pzErrMsg, db, \"unsupported file format\");\r\n    rc = SQLITE_ERROR;\r\n    goto initone_error_out;\r\n  }\r\n\r\n  /* Ticket #2804:  When we open a database in the newer file format,\r\n  ** clear the legacy_file_format pragma flag so that a VACUUM will\r\n  ** not downgrade the database and thus invalidate any descending\r\n  ** indices that the user might have created.\r\n  */\r\n  if( iDb==0 && meta[BTREE_FILE_FORMAT-1]>=4 ){\r\n    db->flags &= ~SQLITE_LegacyFileFmt;\r\n  }\r\n\r\n  /* Read the schema information out of the schema tables\r\n  */\r\n  assert( db->init.busy );\r\n  {\r\n    char *zSql;\r\n    zSql = sqlite3MPrintf(db, \r\n        \"SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid\",\r\n        db->aDb[iDb].zName, zMasterName);\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n    {\r\n      int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);\r\n      xAuth = db->xAuth;\r\n      db->xAuth = 0;\r\n#endif\r\n      rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n      db->xAuth = xAuth;\r\n    }\r\n#endif\r\n    if( rc==SQLITE_OK ) rc = initData.rc;\r\n    sqlite3DbFree(db, zSql);\r\n#ifndef SQLITE_OMIT_ANALYZE\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3AnalysisLoad(db, iDb);\r\n    }\r\n#endif\r\n  }\r\n  if( db->mallocFailed ){\r\n    rc = SQLITE_NOMEM;\r\n    sqlite3ResetInternalSchema(db, -1);\r\n  }\r\n  if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){\r\n    /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider\r\n    ** the schema loaded, even if errors occurred. In this situation the \r\n    ** current sqlite3_prepare() operation will fail, but the following one\r\n    ** will attempt to compile the supplied statement against whatever subset\r\n    ** of the schema was loaded before the error occurred. The primary\r\n    ** purpose of this is to allow access to the sqlite_master table\r\n    ** even when its contents have been corrupted.\r\n    */\r\n    DbSetProperty(db, iDb, DB_SchemaLoaded);\r\n    rc = SQLITE_OK;\r\n  }\r\n\r\n  /* Jump here for an error that occurs after successfully allocating\r\n  ** curMain and calling sqlite3BtreeEnter(). For an error that occurs\r\n  ** before that point, jump to error_out.\r\n  */\r\ninitone_error_out:\r\n  if( openedTransaction ){\r\n    sqlite3BtreeCommit(pDb->pBt);\r\n  }\r\n  sqlite3BtreeLeave(pDb->pBt);\r\n\r\nerror_out:\r\n  if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){\r\n    db->mallocFailed = 1;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Initialize all database files - the main database file, the file\r\n** used to store temporary tables, and any additional database files\r\n** created using ATTACH statements.  Return a success code.  If an\r\n** error occurs, write an error message into *pzErrMsg.\r\n**\r\n** After a database is initialized, the DB_SchemaLoaded bit is set\r\n** bit is set in the flags field of the Db structure. If the database\r\n** file was of zero-length, then the DB_Empty flag is also set.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Init(sqlite3 *db, char **pzErrMsg){\r\n  int i, rc;\r\n  int commit_internal = !(db->flags&SQLITE_InternChanges);\r\n  \r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  rc = SQLITE_OK;\r\n  db->init.busy = 1;\r\n  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\r\n    if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue;\r\n    rc = sqlite3InitOne(db, i, pzErrMsg);\r\n    if( rc ){\r\n      sqlite3ResetInternalSchema(db, i);\r\n    }\r\n  }\r\n\r\n  /* Once all the other databases have been initialised, load the schema\r\n  ** for the TEMP database. This is loaded last, as the TEMP database\r\n  ** schema may contain references to objects in other databases.\r\n  */\r\n#ifndef SQLITE_OMIT_TEMPDB\r\n  if( rc==SQLITE_OK && ALWAYS(db->nDb>1)\r\n                    && !DbHasProperty(db, 1, DB_SchemaLoaded) ){\r\n    rc = sqlite3InitOne(db, 1, pzErrMsg);\r\n    if( rc ){\r\n      sqlite3ResetInternalSchema(db, 1);\r\n    }\r\n  }\r\n#endif\r\n\r\n  db->init.busy = 0;\r\n  if( rc==SQLITE_OK && commit_internal ){\r\n    sqlite3CommitInternalChanges(db);\r\n  }\r\n\r\n  return rc; \r\n}\r\n\r\n/*\r\n** This routine is a no-op if the database schema is already initialised.\r\n** Otherwise, the schema is loaded. An error code is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse){\r\n  int rc = SQLITE_OK;\r\n  sqlite3 *db = pParse->db;\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  if( !db->init.busy ){\r\n    rc = sqlite3Init(db, &pParse->zErrMsg);\r\n  }\r\n  if( rc!=SQLITE_OK ){\r\n    pParse->rc = rc;\r\n    pParse->nErr++;\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Check schema cookies in all databases.  If any cookie is out\r\n** of date set pParse->rc to SQLITE_SCHEMA.  If all schema cookies\r\n** make no changes to pParse->rc.\r\n*/\r\nstatic void schemaIsValid(Parse *pParse){\r\n  sqlite3 *db = pParse->db;\r\n  int iDb;\r\n  int rc;\r\n  int cookie;\r\n\r\n  assert( pParse->checkSchema );\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  for(iDb=0; iDb<db->nDb; iDb++){\r\n    int openedTransaction = 0;         /* True if a transaction is opened */\r\n    Btree *pBt = db->aDb[iDb].pBt;     /* Btree database to read cookie from */\r\n    if( pBt==0 ) continue;\r\n\r\n    /* If there is not already a read-only (or read-write) transaction opened\r\n    ** on the b-tree database, open one now. If a transaction is opened, it \r\n    ** will be closed immediately after reading the meta-value. */\r\n    if( !sqlite3BtreeIsInReadTrans(pBt) ){\r\n      rc = sqlite3BtreeBeginTrans(pBt, 0);\r\n      if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){\r\n        db->mallocFailed = 1;\r\n      }\r\n      if( rc!=SQLITE_OK ) return;\r\n      openedTransaction = 1;\r\n    }\r\n\r\n    /* Read the schema cookie from the database. If it does not match the \r\n    ** value stored as part of the in-memory schema representation,\r\n    ** set Parse.rc to SQLITE_SCHEMA. */\r\n    sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie);\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){\r\n      sqlite3ResetInternalSchema(db, iDb);\r\n      pParse->rc = SQLITE_SCHEMA;\r\n    }\r\n\r\n    /* Close the transaction, if one was opened. */\r\n    if( openedTransaction ){\r\n      sqlite3BtreeCommit(pBt);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Convert a schema pointer into the iDb index that indicates\r\n** which database file in db->aDb[] the schema refers to.\r\n**\r\n** If the same database is attached more than once, the first\r\n** attached database is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){\r\n  int i = -1000000;\r\n\r\n  /* If pSchema is NULL, then return -1000000. This happens when code in \r\n  ** expr.c is trying to resolve a reference to a transient table (i.e. one\r\n  ** created by a sub-select). In this case the return value of this \r\n  ** function should never be used.\r\n  **\r\n  ** We return -1000000 instead of the more usual -1 simply because using\r\n  ** -1000000 as the incorrect index into db->aDb[] is much \r\n  ** more likely to cause a segfault than -1 (of course there are assert()\r\n  ** statements too, but it never hurts to play the odds).\r\n  */\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  if( pSchema ){\r\n    for(i=0; ALWAYS(i<db->nDb); i++){\r\n      if( db->aDb[i].pSchema==pSchema ){\r\n        break;\r\n      }\r\n    }\r\n    assert( i>=0 && i<db->nDb );\r\n  }\r\n  return i;\r\n}\r\n\r\n/*\r\n** Compile the UTF-8 encoded SQL statement zSql into a statement handle.\r\n*/\r\nstatic int sqlite3Prepare(\r\n  sqlite3 *db,              /* Database handle. */\r\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */\r\n  Vdbe *pReprepare,         /* VM being reprepared */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const char **pzTail       /* OUT: End of parsed string */\r\n){\r\n  Parse *pParse;            /* Parsing context */\r\n  char *zErrMsg = 0;        /* Error message */\r\n  int rc = SQLITE_OK;       /* Result code */\r\n  int i;                    /* Loop counter */\r\n\r\n  /* Allocate the parsing context */\r\n  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));\r\n  if( pParse==0 ){\r\n    rc = SQLITE_NOMEM;\r\n    goto end_prepare;\r\n  }\r\n  pParse->pReprepare = pReprepare;\r\n  assert( ppStmt && *ppStmt==0 );\r\n  assert( !db->mallocFailed );\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n\r\n  /* Check to verify that it is possible to get a read lock on all\r\n  ** database schemas.  The inability to get a read lock indicates that\r\n  ** some other database connection is holding a write-lock, which in\r\n  ** turn means that the other connection has made uncommitted changes\r\n  ** to the schema.\r\n  **\r\n  ** Were we to proceed and prepare the statement against the uncommitted\r\n  ** schema changes and if those schema changes are subsequently rolled\r\n  ** back and different changes are made in their place, then when this\r\n  ** prepared statement goes to run the schema cookie would fail to detect\r\n  ** the schema change.  Disaster would follow.\r\n  **\r\n  ** This thread is currently holding mutexes on all Btrees (because\r\n  ** of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it\r\n  ** is not possible for another thread to start a new schema change\r\n  ** while this routine is running.  Hence, we do not need to hold \r\n  ** locks on the schema, we just need to make sure nobody else is \r\n  ** holding them.\r\n  **\r\n  ** Note that setting READ_UNCOMMITTED overrides most lock detection,\r\n  ** but it does *not* override schema lock detection, so this all still\r\n  ** works even if READ_UNCOMMITTED is set.\r\n  */\r\n  for(i=0; i<db->nDb; i++) {\r\n    Btree *pBt = db->aDb[i].pBt;\r\n    if( pBt ){\r\n      assert( sqlite3BtreeHoldsMutex(pBt) );\r\n      rc = sqlite3BtreeSchemaLocked(pBt);\r\n      if( rc ){\r\n        const char *zDb = db->aDb[i].zName;\r\n        sqlite3Error(db, rc, \"database schema is locked: %s\", zDb);\r\n        testcase( db->flags & SQLITE_ReadUncommitted );\r\n        goto end_prepare;\r\n      }\r\n    }\r\n  }\r\n\r\n  sqlite3VtabUnlockList(db);\r\n\r\n  pParse->db = db;\r\n  pParse->nQueryLoop = (double)1;\r\n  if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){\r\n    char *zSqlCopy;\r\n    int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];\r\n    testcase( nBytes==mxLen );\r\n    testcase( nBytes==mxLen+1 );\r\n    if( nBytes>mxLen ){\r\n      sqlite3Error(db, SQLITE_TOOBIG, \"statement too long\");\r\n      rc = sqlite3ApiExit(db, SQLITE_TOOBIG);\r\n      goto end_prepare;\r\n    }\r\n    zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);\r\n    if( zSqlCopy ){\r\n      sqlite3RunParser(pParse, zSqlCopy, &zErrMsg);\r\n      sqlite3DbFree(db, zSqlCopy);\r\n      pParse->zTail = &zSql[pParse->zTail-zSqlCopy];\r\n    }else{\r\n      pParse->zTail = &zSql[nBytes];\r\n    }\r\n  }else{\r\n    sqlite3RunParser(pParse, zSql, &zErrMsg);\r\n  }\r\n  assert( 1==(int)pParse->nQueryLoop );\r\n\r\n  if( db->mallocFailed ){\r\n    pParse->rc = SQLITE_NOMEM;\r\n  }\r\n  if( pParse->rc==SQLITE_DONE ) pParse->rc = SQLITE_OK;\r\n  if( pParse->checkSchema ){\r\n    schemaIsValid(pParse);\r\n  }\r\n  if( db->mallocFailed ){\r\n    pParse->rc = SQLITE_NOMEM;\r\n  }\r\n  if( pzTail ){\r\n    *pzTail = pParse->zTail;\r\n  }\r\n  rc = pParse->rc;\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  if( rc==SQLITE_OK && pParse->pVdbe && pParse->explain ){\r\n    static const char * const azColName[] = {\r\n       \"addr\", \"opcode\", \"p1\", \"p2\", \"p3\", \"p4\", \"p5\", \"comment\",\r\n       \"selectid\", \"order\", \"from\", \"detail\"\r\n    };\r\n    int iFirst, mx;\r\n    if( pParse->explain==2 ){\r\n      sqlite3VdbeSetNumCols(pParse->pVdbe, 4);\r\n      iFirst = 8;\r\n      mx = 12;\r\n    }else{\r\n      sqlite3VdbeSetNumCols(pParse->pVdbe, 8);\r\n      iFirst = 0;\r\n      mx = 8;\r\n    }\r\n    for(i=iFirst; i<mx; i++){\r\n      sqlite3VdbeSetColName(pParse->pVdbe, i-iFirst, COLNAME_NAME,\r\n                            azColName[i], SQLITE_STATIC);\r\n    }\r\n  }\r\n#endif\r\n\r\n  assert( db->init.busy==0 || saveSqlFlag==0 );\r\n  if( db->init.busy==0 ){\r\n    Vdbe *pVdbe = pParse->pVdbe;\r\n    sqlite3VdbeSetSql(pVdbe, zSql, (int)(pParse->zTail-zSql), saveSqlFlag);\r\n  }\r\n  if( pParse->pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){\r\n    sqlite3VdbeFinalize(pParse->pVdbe);\r\n    assert(!(*ppStmt));\r\n  }else{\r\n    *ppStmt = (sqlite3_stmt*)pParse->pVdbe;\r\n  }\r\n\r\n  if( zErrMsg ){\r\n    sqlite3Error(db, rc, \"%s\", zErrMsg);\r\n    sqlite3DbFree(db, zErrMsg);\r\n  }else{\r\n    sqlite3Error(db, rc, 0);\r\n  }\r\n\r\n  /* Delete any TriggerPrg structures allocated while parsing this statement. */\r\n  while( pParse->pTriggerPrg ){\r\n    TriggerPrg *pT = pParse->pTriggerPrg;\r\n    pParse->pTriggerPrg = pT->pNext;\r\n    sqlite3DbFree(db, pT);\r\n  }\r\n\r\nend_prepare:\r\n\r\n  sqlite3StackFree(db, pParse);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  assert( (rc&db->errMask)==rc );\r\n  return rc;\r\n}\r\nstatic int sqlite3LockAndPrepare(\r\n  sqlite3 *db,              /* Database handle. */\r\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */\r\n  Vdbe *pOld,               /* VM being reprepared */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const char **pzTail       /* OUT: End of parsed string */\r\n){\r\n  int rc;\r\n  assert( ppStmt!=0 );\r\n  *ppStmt = 0;\r\n  if( !sqlite3SafetyCheckOk(db) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  sqlite3_mutex_enter(db->mutex);\r\n  sqlite3BtreeEnterAll(db);\r\n  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);\r\n  if( rc==SQLITE_SCHEMA ){\r\n    sqlite3_finalize(*ppStmt);\r\n    rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);\r\n  }\r\n  sqlite3BtreeLeaveAll(db);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Rerun the compilation of a statement after a schema change.\r\n**\r\n** If the statement is successfully recompiled, return SQLITE_OK. Otherwise,\r\n** if the statement cannot be recompiled because another connection has\r\n** locked the sqlite3_master table, return SQLITE_LOCKED. If any other error\r\n** occurs, return SQLITE_SCHEMA.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){\r\n  int rc;\r\n  sqlite3_stmt *pNew;\r\n  const char *zSql;\r\n  sqlite3 *db;\r\n\r\n  assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );\r\n  zSql = sqlite3_sql((sqlite3_stmt *)p);\r\n  assert( zSql!=0 );  /* Reprepare only called for prepare_v2() statements */\r\n  db = sqlite3VdbeDb(p);\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);\r\n  if( rc ){\r\n    if( rc==SQLITE_NOMEM ){\r\n      db->mallocFailed = 1;\r\n    }\r\n    assert( pNew==0 );\r\n    return rc;\r\n  }else{\r\n    assert( pNew!=0 );\r\n  }\r\n  sqlite3VdbeSwap((Vdbe*)pNew, p);\r\n  sqlite3TransferBindings(pNew, (sqlite3_stmt*)p);\r\n  sqlite3VdbeResetStepResult((Vdbe*)pNew);\r\n  sqlite3VdbeFinalize((Vdbe*)pNew);\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Two versions of the official API.  Legacy and new use.  In the legacy\r\n** version, the original SQL text is not saved in the prepared statement\r\n** and so if a schema change occurs, SQLITE_SCHEMA is returned by\r\n** sqlite3_step().  In the new version, the original SQL text is retained\r\n** and the statement is automatically recompiled if an schema change\r\n** occurs.\r\n*/\r\nSQLITE_API int sqlite3_prepare(\r\n  sqlite3 *db,              /* Database handle. */\r\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const char **pzTail       /* OUT: End of parsed string */\r\n){\r\n  int rc;\r\n  rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);\r\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\r\n  return rc;\r\n}\r\nSQLITE_API int sqlite3_prepare_v2(\r\n  sqlite3 *db,              /* Database handle. */\r\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const char **pzTail       /* OUT: End of parsed string */\r\n){\r\n  int rc;\r\n  rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail);\r\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\r\n  return rc;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** Compile the UTF-16 encoded SQL statement zSql into a statement handle.\r\n*/\r\nstatic int sqlite3Prepare16(\r\n  sqlite3 *db,              /* Database handle. */ \r\n  const void *zSql,         /* UTF-16 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  int saveSqlFlag,          /* True to save SQL text into the sqlite3_stmt */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const void **pzTail       /* OUT: End of parsed string */\r\n){\r\n  /* This function currently works by first transforming the UTF-16\r\n  ** encoded string to UTF-8, then invoking sqlite3_prepare(). The\r\n  ** tricky bit is figuring out the pointer to return in *pzTail.\r\n  */\r\n  char *zSql8;\r\n  const char *zTail8 = 0;\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( ppStmt );\r\n  *ppStmt = 0;\r\n  if( !sqlite3SafetyCheckOk(db) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  sqlite3_mutex_enter(db->mutex);\r\n  zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);\r\n  if( zSql8 ){\r\n    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);\r\n  }\r\n\r\n  if( zTail8 && pzTail ){\r\n    /* If sqlite3_prepare returns a tail pointer, we calculate the\r\n    ** equivalent pointer into the UTF-16 string by counting the unicode\r\n    ** characters between zSql8 and zTail8, and then returning a pointer\r\n    ** the same number of characters into the UTF-16 string.\r\n    */\r\n    int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));\r\n    *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);\r\n  }\r\n  sqlite3DbFree(db, zSql8); \r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Two versions of the official API.  Legacy and new use.  In the legacy\r\n** version, the original SQL text is not saved in the prepared statement\r\n** and so if a schema change occurs, SQLITE_SCHEMA is returned by\r\n** sqlite3_step().  In the new version, the original SQL text is retained\r\n** and the statement is automatically recompiled if an schema change\r\n** occurs.\r\n*/\r\nSQLITE_API int sqlite3_prepare16(\r\n  sqlite3 *db,              /* Database handle. */ \r\n  const void *zSql,         /* UTF-16 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const void **pzTail       /* OUT: End of parsed string */\r\n){\r\n  int rc;\r\n  rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail);\r\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\r\n  return rc;\r\n}\r\nSQLITE_API int sqlite3_prepare16_v2(\r\n  sqlite3 *db,              /* Database handle. */ \r\n  const void *zSql,         /* UTF-16 encoded SQL statement. */\r\n  int nBytes,               /* Length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\r\n  const void **pzTail       /* OUT: End of parsed string */\r\n){\r\n  int rc;\r\n  rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail);\r\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\r\n  return rc;\r\n}\r\n\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/************** End of prepare.c *********************************************/\r\n/************** Begin file select.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains C code routines that are called by the parser\r\n** to handle SELECT statements in SQLite.\r\n*/\r\n\r\n\r\n/*\r\n** Delete all the content of a Select structure but do not deallocate\r\n** the select structure itself.\r\n*/\r\nstatic void clearSelect(sqlite3 *db, Select *p){\r\n  sqlite3ExprListDelete(db, p->pEList);\r\n  sqlite3SrcListDelete(db, p->pSrc);\r\n  sqlite3ExprDelete(db, p->pWhere);\r\n  sqlite3ExprListDelete(db, p->pGroupBy);\r\n  sqlite3ExprDelete(db, p->pHaving);\r\n  sqlite3ExprListDelete(db, p->pOrderBy);\r\n  sqlite3SelectDelete(db, p->pPrior);\r\n  sqlite3ExprDelete(db, p->pLimit);\r\n  sqlite3ExprDelete(db, p->pOffset);\r\n}\r\n\r\n/*\r\n** Initialize a SelectDest structure.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){\r\n  pDest->eDest = (u8)eDest;\r\n  pDest->iParm = iParm;\r\n  pDest->affinity = 0;\r\n  pDest->iMem = 0;\r\n  pDest->nMem = 0;\r\n}\r\n\r\n\r\n/*\r\n** Allocate a new Select structure and return a pointer to that\r\n** structure.\r\n*/\r\nSQLITE_PRIVATE Select *sqlite3SelectNew(\r\n  Parse *pParse,        /* Parsing context */\r\n  ExprList *pEList,     /* which columns to include in the result */\r\n  SrcList *pSrc,        /* the FROM clause -- which tables to scan */\r\n  Expr *pWhere,         /* the WHERE clause */\r\n  ExprList *pGroupBy,   /* the GROUP BY clause */\r\n  Expr *pHaving,        /* the HAVING clause */\r\n  ExprList *pOrderBy,   /* the ORDER BY clause */\r\n  int isDistinct,       /* true if the DISTINCT keyword is present */\r\n  Expr *pLimit,         /* LIMIT value.  NULL means not used */\r\n  Expr *pOffset         /* OFFSET value.  NULL means no offset */\r\n){\r\n  Select *pNew;\r\n  Select standin;\r\n  sqlite3 *db = pParse->db;\r\n  pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );\r\n  assert( db->mallocFailed || !pOffset || pLimit ); /* OFFSET implies LIMIT */\r\n  if( pNew==0 ){\r\n    assert( db->mallocFailed );\r\n    pNew = &standin;\r\n    memset(pNew, 0, sizeof(*pNew));\r\n  }\r\n  if( pEList==0 ){\r\n    pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ALL,0));\r\n  }\r\n  pNew->pEList = pEList;\r\n  if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));\r\n  pNew->pSrc = pSrc;\r\n  pNew->pWhere = pWhere;\r\n  pNew->pGroupBy = pGroupBy;\r\n  pNew->pHaving = pHaving;\r\n  pNew->pOrderBy = pOrderBy;\r\n  pNew->selFlags = isDistinct ? SF_Distinct : 0;\r\n  pNew->op = TK_SELECT;\r\n  pNew->pLimit = pLimit;\r\n  pNew->pOffset = pOffset;\r\n  assert( pOffset==0 || pLimit!=0 );\r\n  pNew->addrOpenEphm[0] = -1;\r\n  pNew->addrOpenEphm[1] = -1;\r\n  pNew->addrOpenEphm[2] = -1;\r\n  if( db->mallocFailed ) {\r\n    clearSelect(db, pNew);\r\n    if( pNew!=&standin ) sqlite3DbFree(db, pNew);\r\n    pNew = 0;\r\n  }else{\r\n    assert( pNew->pSrc!=0 || pParse->nErr>0 );\r\n  }\r\n  assert( pNew!=&standin );\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Delete the given Select structure and all of its substructures.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SelectDelete(sqlite3 *db, Select *p){\r\n  if( p ){\r\n    clearSelect(db, p);\r\n    sqlite3DbFree(db, p);\r\n  }\r\n}\r\n\r\n/*\r\n** Given 1 to 3 identifiers preceeding the JOIN keyword, determine the\r\n** type of join.  Return an integer constant that expresses that type\r\n** in terms of the following bit values:\r\n**\r\n**     JT_INNER\r\n**     JT_CROSS\r\n**     JT_OUTER\r\n**     JT_NATURAL\r\n**     JT_LEFT\r\n**     JT_RIGHT\r\n**\r\n** A full outer join is the combination of JT_LEFT and JT_RIGHT.\r\n**\r\n** If an illegal or unsupported join type is seen, then still return\r\n** a join type, but put an error in the pParse structure.\r\n*/\r\nSQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){\r\n  int jointype = 0;\r\n  Token *apAll[3];\r\n  Token *p;\r\n                             /*   0123456789 123456789 123456789 123 */\r\n  static const char zKeyText[] = \"naturaleftouterightfullinnercross\";\r\n  static const struct {\r\n    u8 i;        /* Beginning of keyword text in zKeyText[] */\r\n    u8 nChar;    /* Length of the keyword in characters */\r\n    u8 code;     /* Join type mask */\r\n  } aKeyword[] = {\r\n    /* natural */ { 0,  7, JT_NATURAL                },\r\n    /* left    */ { 6,  4, JT_LEFT|JT_OUTER          },\r\n    /* outer   */ { 10, 5, JT_OUTER                  },\r\n    /* right   */ { 14, 5, JT_RIGHT|JT_OUTER         },\r\n    /* full    */ { 19, 4, JT_LEFT|JT_RIGHT|JT_OUTER },\r\n    /* inner   */ { 23, 5, JT_INNER                  },\r\n    /* cross   */ { 28, 5, JT_INNER|JT_CROSS         },\r\n  };\r\n  int i, j;\r\n  apAll[0] = pA;\r\n  apAll[1] = pB;\r\n  apAll[2] = pC;\r\n  for(i=0; i<3 && apAll[i]; i++){\r\n    p = apAll[i];\r\n    for(j=0; j<ArraySize(aKeyword); j++){\r\n      if( p->n==aKeyword[j].nChar \r\n          && sqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){\r\n        jointype |= aKeyword[j].code;\r\n        break;\r\n      }\r\n    }\r\n    testcase( j==0 || j==1 || j==2 || j==3 || j==4 || j==5 || j==6 );\r\n    if( j>=ArraySize(aKeyword) ){\r\n      jointype |= JT_ERROR;\r\n      break;\r\n    }\r\n  }\r\n  if(\r\n     (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||\r\n     (jointype & JT_ERROR)!=0\r\n  ){\r\n    const char *zSp = \" \";\r\n    assert( pB!=0 );\r\n    if( pC==0 ){ zSp++; }\r\n    sqlite3ErrorMsg(pParse, \"unknown or unsupported join type: \"\r\n       \"%T %T%s%T\", pA, pB, zSp, pC);\r\n    jointype = JT_INNER;\r\n  }else if( (jointype & JT_OUTER)!=0 \r\n         && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){\r\n    sqlite3ErrorMsg(pParse, \r\n      \"RIGHT and FULL OUTER JOINs are not currently supported\");\r\n    jointype = JT_INNER;\r\n  }\r\n  return jointype;\r\n}\r\n\r\n/*\r\n** Return the index of a column in a table.  Return -1 if the column\r\n** is not contained in the table.\r\n*/\r\nstatic int columnIndex(Table *pTab, const char *zCol){\r\n  int i;\r\n  for(i=0; i<pTab->nCol; i++){\r\n    if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;\r\n  }\r\n  return -1;\r\n}\r\n\r\n/*\r\n** Search the first N tables in pSrc, from left to right, looking for a\r\n** table that has a column named zCol.  \r\n**\r\n** When found, set *piTab and *piCol to the table index and column index\r\n** of the matching column and return TRUE.\r\n**\r\n** If not found, return FALSE.\r\n*/\r\nstatic int tableAndColumnIndex(\r\n  SrcList *pSrc,       /* Array of tables to search */\r\n  int N,               /* Number of tables in pSrc->a[] to search */\r\n  const char *zCol,    /* Name of the column we are looking for */\r\n  int *piTab,          /* Write index of pSrc->a[] here */\r\n  int *piCol           /* Write index of pSrc->a[*piTab].pTab->aCol[] here */\r\n){\r\n  int i;               /* For looping over tables in pSrc */\r\n  int iCol;            /* Index of column matching zCol */\r\n\r\n  assert( (piTab==0)==(piCol==0) );  /* Both or neither are NULL */\r\n  for(i=0; i<N; i++){\r\n    iCol = columnIndex(pSrc->a[i].pTab, zCol);\r\n    if( iCol>=0 ){\r\n      if( piTab ){\r\n        *piTab = i;\r\n        *piCol = iCol;\r\n      }\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** This function is used to add terms implied by JOIN syntax to the\r\n** WHERE clause expression of a SELECT statement. The new term, which\r\n** is ANDed with the existing WHERE clause, is of the form:\r\n**\r\n**    (tab1.col1 = tab2.col2)\r\n**\r\n** where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the \r\n** (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is\r\n** column iColRight of tab2.\r\n*/\r\nstatic void addWhereTerm(\r\n  Parse *pParse,                  /* Parsing context */\r\n  SrcList *pSrc,                  /* List of tables in FROM clause */\r\n  int iLeft,                      /* Index of first table to join in pSrc */\r\n  int iColLeft,                   /* Index of column in first table */\r\n  int iRight,                     /* Index of second table in pSrc */\r\n  int iColRight,                  /* Index of column in second table */\r\n  int isOuterJoin,                /* True if this is an OUTER join */\r\n  Expr **ppWhere                  /* IN/OUT: The WHERE clause to add to */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n  Expr *pE1;\r\n  Expr *pE2;\r\n  Expr *pEq;\r\n\r\n  assert( iLeft<iRight );\r\n  assert( pSrc->nSrc>iRight );\r\n  assert( pSrc->a[iLeft].pTab );\r\n  assert( pSrc->a[iRight].pTab );\r\n\r\n  pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft);\r\n  pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight);\r\n\r\n  pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2, 0);\r\n  if( pEq && isOuterJoin ){\r\n    ExprSetProperty(pEq, EP_FromJoin);\r\n    assert( !ExprHasAnyProperty(pEq, EP_TokenOnly|EP_Reduced) );\r\n    ExprSetIrreducible(pEq);\r\n    pEq->iRightJoinTable = (i16)pE2->iTable;\r\n  }\r\n  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);\r\n}\r\n\r\n/*\r\n** Set the EP_FromJoin property on all terms of the given expression.\r\n** And set the Expr.iRightJoinTable to iTable for every term in the\r\n** expression.\r\n**\r\n** The EP_FromJoin property is used on terms of an expression to tell\r\n** the LEFT OUTER JOIN processing logic that this term is part of the\r\n** join restriction specified in the ON or USING clause and not a part\r\n** of the more general WHERE clause.  These terms are moved over to the\r\n** WHERE clause during join processing but we need to remember that they\r\n** originated in the ON or USING clause.\r\n**\r\n** The Expr.iRightJoinTable tells the WHERE clause processing that the\r\n** expression depends on table iRightJoinTable even if that table is not\r\n** explicitly mentioned in the expression.  That information is needed\r\n** for cases like this:\r\n**\r\n**    SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5\r\n**\r\n** The where clause needs to defer the handling of the t1.x=5\r\n** term until after the t2 loop of the join.  In that way, a\r\n** NULL t2 row will be inserted whenever t1.x!=5.  If we do not\r\n** defer the handling of t1.x=5, it will be processed immediately\r\n** after the t1 loop and rows with t1.x!=5 will never appear in\r\n** the output, which is incorrect.\r\n*/\r\nstatic void setJoinExpr(Expr *p, int iTable){\r\n  while( p ){\r\n    ExprSetProperty(p, EP_FromJoin);\r\n    assert( !ExprHasAnyProperty(p, EP_TokenOnly|EP_Reduced) );\r\n    ExprSetIrreducible(p);\r\n    p->iRightJoinTable = (i16)iTable;\r\n    setJoinExpr(p->pLeft, iTable);\r\n    p = p->pRight;\r\n  } \r\n}\r\n\r\n/*\r\n** This routine processes the join information for a SELECT statement.\r\n** ON and USING clauses are converted into extra terms of the WHERE clause.\r\n** NATURAL joins also create extra WHERE clause terms.\r\n**\r\n** The terms of a FROM clause are contained in the Select.pSrc structure.\r\n** The left most table is the first entry in Select.pSrc.  The right-most\r\n** table is the last entry.  The join operator is held in the entry to\r\n** the left.  Thus entry 0 contains the join operator for the join between\r\n** entries 0 and 1.  Any ON or USING clauses associated with the join are\r\n** also attached to the left entry.\r\n**\r\n** This routine returns the number of errors encountered.\r\n*/\r\nstatic int sqliteProcessJoin(Parse *pParse, Select *p){\r\n  SrcList *pSrc;                  /* All tables in the FROM clause */\r\n  int i, j;                       /* Loop counters */\r\n  struct SrcList_item *pLeft;     /* Left table being joined */\r\n  struct SrcList_item *pRight;    /* Right table being joined */\r\n\r\n  pSrc = p->pSrc;\r\n  pLeft = &pSrc->a[0];\r\n  pRight = &pLeft[1];\r\n  for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){\r\n    Table *pLeftTab = pLeft->pTab;\r\n    Table *pRightTab = pRight->pTab;\r\n    int isOuter;\r\n\r\n    if( NEVER(pLeftTab==0 || pRightTab==0) ) continue;\r\n    isOuter = (pRight->jointype & JT_OUTER)!=0;\r\n\r\n    /* When the NATURAL keyword is present, add WHERE clause terms for\r\n    ** every column that the two tables have in common.\r\n    */\r\n    if( pRight->jointype & JT_NATURAL ){\r\n      if( pRight->pOn || pRight->pUsing ){\r\n        sqlite3ErrorMsg(pParse, \"a NATURAL join may not have \"\r\n           \"an ON or USING clause\", 0);\r\n        return 1;\r\n      }\r\n      for(j=0; j<pRightTab->nCol; j++){\r\n        char *zName;   /* Name of column in the right table */\r\n        int iLeft;     /* Matching left table */\r\n        int iLeftCol;  /* Matching column in the left table */\r\n\r\n        zName = pRightTab->aCol[j].zName;\r\n        if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol) ){\r\n          addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, j,\r\n                       isOuter, &p->pWhere);\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Disallow both ON and USING clauses in the same join\r\n    */\r\n    if( pRight->pOn && pRight->pUsing ){\r\n      sqlite3ErrorMsg(pParse, \"cannot have both ON and USING \"\r\n        \"clauses in the same join\");\r\n      return 1;\r\n    }\r\n\r\n    /* Add the ON clause to the end of the WHERE clause, connected by\r\n    ** an AND operator.\r\n    */\r\n    if( pRight->pOn ){\r\n      if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);\r\n      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);\r\n      pRight->pOn = 0;\r\n    }\r\n\r\n    /* Create extra terms on the WHERE clause for each column named\r\n    ** in the USING clause.  Example: If the two tables to be joined are \r\n    ** A and B and the USING clause names X, Y, and Z, then add this\r\n    ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z\r\n    ** Report an error if any column mentioned in the USING clause is\r\n    ** not contained in both tables to be joined.\r\n    */\r\n    if( pRight->pUsing ){\r\n      IdList *pList = pRight->pUsing;\r\n      for(j=0; j<pList->nId; j++){\r\n        char *zName;     /* Name of the term in the USING clause */\r\n        int iLeft;       /* Table on the left with matching column name */\r\n        int iLeftCol;    /* Column number of matching column on the left */\r\n        int iRightCol;   /* Column number of matching column on the right */\r\n\r\n        zName = pList->a[j].zName;\r\n        iRightCol = columnIndex(pRightTab, zName);\r\n        if( iRightCol<0\r\n         || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol)\r\n        ){\r\n          sqlite3ErrorMsg(pParse, \"cannot join using column %s - column \"\r\n            \"not present in both tables\", zName);\r\n          return 1;\r\n        }\r\n        addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, iRightCol,\r\n                     isOuter, &p->pWhere);\r\n      }\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Insert code into \"v\" that will push the record on the top of the\r\n** stack into the sorter.\r\n*/\r\nstatic void pushOntoSorter(\r\n  Parse *pParse,         /* Parser context */\r\n  ExprList *pOrderBy,    /* The ORDER BY clause */\r\n  Select *pSelect,       /* The whole SELECT statement */\r\n  int regData            /* Register holding data to be sorted */\r\n){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int nExpr = pOrderBy->nExpr;\r\n  int regBase = sqlite3GetTempRange(pParse, nExpr+2);\r\n  int regRecord = sqlite3GetTempReg(pParse);\r\n  int op;\r\n  sqlite3ExprCacheClear(pParse);\r\n  sqlite3ExprCodeExprList(pParse, pOrderBy, regBase, 0);\r\n  sqlite3VdbeAddOp2(v, OP_Sequence, pOrderBy->iECursor, regBase+nExpr);\r\n  sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+1, 1);\r\n  sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nExpr + 2, regRecord);\r\n  if( pSelect->selFlags & SF_UseSorter ){\r\n    op = OP_SorterInsert;\r\n  }else{\r\n    op = OP_IdxInsert;\r\n  }\r\n  sqlite3VdbeAddOp2(v, op, pOrderBy->iECursor, regRecord);\r\n  sqlite3ReleaseTempReg(pParse, regRecord);\r\n  sqlite3ReleaseTempRange(pParse, regBase, nExpr+2);\r\n  if( pSelect->iLimit ){\r\n    int addr1, addr2;\r\n    int iLimit;\r\n    if( pSelect->iOffset ){\r\n      iLimit = pSelect->iOffset+1;\r\n    }else{\r\n      iLimit = pSelect->iLimit;\r\n    }\r\n    addr1 = sqlite3VdbeAddOp1(v, OP_IfZero, iLimit);\r\n    sqlite3VdbeAddOp2(v, OP_AddImm, iLimit, -1);\r\n    addr2 = sqlite3VdbeAddOp0(v, OP_Goto);\r\n    sqlite3VdbeJumpHere(v, addr1);\r\n    sqlite3VdbeAddOp1(v, OP_Last, pOrderBy->iECursor);\r\n    sqlite3VdbeAddOp1(v, OP_Delete, pOrderBy->iECursor);\r\n    sqlite3VdbeJumpHere(v, addr2);\r\n  }\r\n}\r\n\r\n/*\r\n** Add code to implement the OFFSET\r\n*/\r\nstatic void codeOffset(\r\n  Vdbe *v,          /* Generate code into this VM */\r\n  Select *p,        /* The SELECT statement being coded */\r\n  int iContinue     /* Jump here to skip the current record */\r\n){\r\n  if( p->iOffset && iContinue!=0 ){\r\n    int addr;\r\n    sqlite3VdbeAddOp2(v, OP_AddImm, p->iOffset, -1);\r\n    addr = sqlite3VdbeAddOp1(v, OP_IfNeg, p->iOffset);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, iContinue);\r\n    VdbeComment((v, \"skip OFFSET records\"));\r\n    sqlite3VdbeJumpHere(v, addr);\r\n  }\r\n}\r\n\r\n/*\r\n** Add code that will check to make sure the N registers starting at iMem\r\n** form a distinct entry.  iTab is a sorting index that holds previously\r\n** seen combinations of the N values.  A new entry is made in iTab\r\n** if the current N values are new.\r\n**\r\n** A jump to addrRepeat is made and the N+1 values are popped from the\r\n** stack if the top N elements are not distinct.\r\n*/\r\nstatic void codeDistinct(\r\n  Parse *pParse,     /* Parsing and code generating context */\r\n  int iTab,          /* A sorting index used to test for distinctness */\r\n  int addrRepeat,    /* Jump to here if not distinct */\r\n  int N,             /* Number of elements */\r\n  int iMem           /* First element */\r\n){\r\n  Vdbe *v;\r\n  int r1;\r\n\r\n  v = pParse->pVdbe;\r\n  r1 = sqlite3GetTempReg(pParse);\r\n  sqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N);\r\n  sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1);\r\n  sqlite3VdbeAddOp2(v, OP_IdxInsert, iTab, r1);\r\n  sqlite3ReleaseTempReg(pParse, r1);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n/*\r\n** Generate an error message when a SELECT is used within a subexpression\r\n** (example:  \"a IN (SELECT * FROM table)\") but it has more than 1 result\r\n** column.  We do this in a subroutine because the error used to occur\r\n** in multiple places.  (The error only occurs in one place now, but we\r\n** retain the subroutine to minimize code disruption.)\r\n*/\r\nstatic int checkForMultiColumnSelectError(\r\n  Parse *pParse,       /* Parse context. */\r\n  SelectDest *pDest,   /* Destination of SELECT results */\r\n  int nExpr            /* Number of result columns returned by SELECT */\r\n){\r\n  int eDest = pDest->eDest;\r\n  if( nExpr>1 && (eDest==SRT_Mem || eDest==SRT_Set) ){\r\n    sqlite3ErrorMsg(pParse, \"only a single result allowed for \"\r\n       \"a SELECT that is part of an expression\");\r\n    return 1;\r\n  }else{\r\n    return 0;\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n** This routine generates the code for the inside of the inner loop\r\n** of a SELECT.\r\n**\r\n** If srcTab and nColumn are both zero, then the pEList expressions\r\n** are evaluated in order to get the data for this row.  If nColumn>0\r\n** then data is pulled from srcTab and pEList is used only to get the\r\n** datatypes for each column.\r\n*/\r\nstatic void selectInnerLoop(\r\n  Parse *pParse,          /* The parser context */\r\n  Select *p,              /* The complete select statement being coded */\r\n  ExprList *pEList,       /* List of values being extracted */\r\n  int srcTab,             /* Pull data from this table */\r\n  int nColumn,            /* Number of columns in the source table */\r\n  ExprList *pOrderBy,     /* If not NULL, sort results using this key */\r\n  int distinct,           /* If >=0, make sure results are distinct */\r\n  SelectDest *pDest,      /* How to dispose of the results */\r\n  int iContinue,          /* Jump here to continue with next row */\r\n  int iBreak              /* Jump here to break out of the inner loop */\r\n){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  int hasDistinct;        /* True if the DISTINCT keyword is present */\r\n  int regResult;              /* Start of memory holding result set */\r\n  int eDest = pDest->eDest;   /* How to dispose of results */\r\n  int iParm = pDest->iParm;   /* First argument to disposal method */\r\n  int nResultCol;             /* Number of result columns */\r\n\r\n  assert( v );\r\n  if( NEVER(v==0) ) return;\r\n  assert( pEList!=0 );\r\n  hasDistinct = distinct>=0;\r\n  if( pOrderBy==0 && !hasDistinct ){\r\n    codeOffset(v, p, iContinue);\r\n  }\r\n\r\n  /* Pull the requested columns.\r\n  */\r\n  if( nColumn>0 ){\r\n    nResultCol = nColumn;\r\n  }else{\r\n    nResultCol = pEList->nExpr;\r\n  }\r\n  if( pDest->iMem==0 ){\r\n    pDest->iMem = pParse->nMem+1;\r\n    pDest->nMem = nResultCol;\r\n    pParse->nMem += nResultCol;\r\n  }else{ \r\n    assert( pDest->nMem==nResultCol );\r\n  }\r\n  regResult = pDest->iMem;\r\n  if( nColumn>0 ){\r\n    for(i=0; i<nColumn; i++){\r\n      sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);\r\n    }\r\n  }else if( eDest!=SRT_Exists ){\r\n    /* If the destination is an EXISTS(...) expression, the actual\r\n    ** values returned by the SELECT are not required.\r\n    */\r\n    sqlite3ExprCacheClear(pParse);\r\n    sqlite3ExprCodeExprList(pParse, pEList, regResult, eDest==SRT_Output);\r\n  }\r\n  nColumn = nResultCol;\r\n\r\n  /* If the DISTINCT keyword was present on the SELECT statement\r\n  ** and this row has been seen before, then do not make this row\r\n  ** part of the result.\r\n  */\r\n  if( hasDistinct ){\r\n    assert( pEList!=0 );\r\n    assert( pEList->nExpr==nColumn );\r\n    codeDistinct(pParse, distinct, iContinue, nColumn, regResult);\r\n    if( pOrderBy==0 ){\r\n      codeOffset(v, p, iContinue);\r\n    }\r\n  }\r\n\r\n  switch( eDest ){\r\n    /* In this mode, write each query result to the key of the temporary\r\n    ** table iParm.\r\n    */\r\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\r\n    case SRT_Union: {\r\n      int r1;\r\n      r1 = sqlite3GetTempReg(pParse);\r\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nColumn, r1);\r\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);\r\n      sqlite3ReleaseTempReg(pParse, r1);\r\n      break;\r\n    }\r\n\r\n    /* Construct a record from the query result, but instead of\r\n    ** saving that record, use it as a key to delete elements from\r\n    ** the temporary table iParm.\r\n    */\r\n    case SRT_Except: {\r\n      sqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nColumn);\r\n      break;\r\n    }\r\n#endif\r\n\r\n    /* Store the result as data using a unique key.\r\n    */\r\n    case SRT_Table:\r\n    case SRT_EphemTab: {\r\n      int r1 = sqlite3GetTempReg(pParse);\r\n      testcase( eDest==SRT_Table );\r\n      testcase( eDest==SRT_EphemTab );\r\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nColumn, r1);\r\n      if( pOrderBy ){\r\n        pushOntoSorter(pParse, pOrderBy, p, r1);\r\n      }else{\r\n        int r2 = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2);\r\n        sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2);\r\n        sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n        sqlite3ReleaseTempReg(pParse, r2);\r\n      }\r\n      sqlite3ReleaseTempReg(pParse, r1);\r\n      break;\r\n    }\r\n\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    /* If we are creating a set for an \"expr IN (SELECT ...)\" construct,\r\n    ** then there should be a single item on the stack.  Write this\r\n    ** item into the set table with bogus data.\r\n    */\r\n    case SRT_Set: {\r\n      assert( nColumn==1 );\r\n      p->affinity = sqlite3CompareAffinity(pEList->a[0].pExpr, pDest->affinity);\r\n      if( pOrderBy ){\r\n        /* At first glance you would think we could optimize out the\r\n        ** ORDER BY in this case since the order of entries in the set\r\n        ** does not matter.  But there might be a LIMIT clause, in which\r\n        ** case the order does matter */\r\n        pushOntoSorter(pParse, pOrderBy, p, regResult);\r\n      }else{\r\n        int r1 = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, 1, r1, &p->affinity, 1);\r\n        sqlite3ExprCacheAffinityChange(pParse, regResult, 1);\r\n        sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);\r\n        sqlite3ReleaseTempReg(pParse, r1);\r\n      }\r\n      break;\r\n    }\r\n\r\n    /* If any row exist in the result set, record that fact and abort.\r\n    */\r\n    case SRT_Exists: {\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, iParm);\r\n      /* The LIMIT clause will terminate the loop for us */\r\n      break;\r\n    }\r\n\r\n    /* If this is a scalar select that is part of an expression, then\r\n    ** store the results in the appropriate memory cell and break out\r\n    ** of the scan loop.\r\n    */\r\n    case SRT_Mem: {\r\n      assert( nColumn==1 );\r\n      if( pOrderBy ){\r\n        pushOntoSorter(pParse, pOrderBy, p, regResult);\r\n      }else{\r\n        sqlite3ExprCodeMove(pParse, regResult, iParm, 1);\r\n        /* The LIMIT clause will jump out of the loop for us */\r\n      }\r\n      break;\r\n    }\r\n#endif /* #ifndef SQLITE_OMIT_SUBQUERY */\r\n\r\n    /* Send the data to the callback function or to a subroutine.  In the\r\n    ** case of a subroutine, the subroutine itself is responsible for\r\n    ** popping the data from the stack.\r\n    */\r\n    case SRT_Coroutine:\r\n    case SRT_Output: {\r\n      testcase( eDest==SRT_Coroutine );\r\n      testcase( eDest==SRT_Output );\r\n      if( pOrderBy ){\r\n        int r1 = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nColumn, r1);\r\n        pushOntoSorter(pParse, pOrderBy, p, r1);\r\n        sqlite3ReleaseTempReg(pParse, r1);\r\n      }else if( eDest==SRT_Coroutine ){\r\n        sqlite3VdbeAddOp1(v, OP_Yield, pDest->iParm);\r\n      }else{\r\n        sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nColumn);\r\n        sqlite3ExprCacheAffinityChange(pParse, regResult, nColumn);\r\n      }\r\n      break;\r\n    }\r\n\r\n#if !defined(SQLITE_OMIT_TRIGGER)\r\n    /* Discard the results.  This is used for SELECT statements inside\r\n    ** the body of a TRIGGER.  The purpose of such selects is to call\r\n    ** user-defined functions that have side effects.  We do not care\r\n    ** about the actual results of the select.\r\n    */\r\n    default: {\r\n      assert( eDest==SRT_Discard );\r\n      break;\r\n    }\r\n#endif\r\n  }\r\n\r\n  /* Jump to the end of the loop if the LIMIT is reached.  Except, if\r\n  ** there is a sorter, in which case the sorter has already limited\r\n  ** the output for us.\r\n  */\r\n  if( pOrderBy==0 && p->iLimit ){\r\n    sqlite3VdbeAddOp3(v, OP_IfZero, p->iLimit, iBreak, -1);\r\n  }\r\n}\r\n\r\n/*\r\n** Given an expression list, generate a KeyInfo structure that records\r\n** the collating sequence for each expression in that expression list.\r\n**\r\n** If the ExprList is an ORDER BY or GROUP BY clause then the resulting\r\n** KeyInfo structure is appropriate for initializing a virtual index to\r\n** implement that clause.  If the ExprList is the result set of a SELECT\r\n** then the KeyInfo structure is appropriate for initializing a virtual\r\n** index to implement a DISTINCT test.\r\n**\r\n** Space to hold the KeyInfo structure is obtain from malloc.  The calling\r\n** function is responsible for seeing that this structure is eventually\r\n** freed.  Add the KeyInfo structure to the P4 field of an opcode using\r\n** P4_KEYINFO_HANDOFF is the usual way of dealing with this.\r\n*/\r\nstatic KeyInfo *keyInfoFromExprList(Parse *pParse, ExprList *pList){\r\n  sqlite3 *db = pParse->db;\r\n  int nExpr;\r\n  KeyInfo *pInfo;\r\n  struct ExprList_item *pItem;\r\n  int i;\r\n\r\n  nExpr = pList->nExpr;\r\n  pInfo = sqlite3DbMallocZero(db, sizeof(*pInfo) + nExpr*(sizeof(CollSeq*)+1) );\r\n  if( pInfo ){\r\n    pInfo->aSortOrder = (u8*)&pInfo->aColl[nExpr];\r\n    pInfo->nField = (u16)nExpr;\r\n    pInfo->enc = ENC(db);\r\n    pInfo->db = db;\r\n    for(i=0, pItem=pList->a; i<nExpr; i++, pItem++){\r\n      CollSeq *pColl;\r\n      pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);\r\n      if( !pColl ){\r\n        pColl = db->pDfltColl;\r\n      }\r\n      pInfo->aColl[i] = pColl;\r\n      pInfo->aSortOrder[i] = pItem->sortOrder;\r\n    }\r\n  }\r\n  return pInfo;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\r\n/*\r\n** Name of the connection operator, used for error messages.\r\n*/\r\nstatic const char *selectOpName(int id){\r\n  char *z;\r\n  switch( id ){\r\n    case TK_ALL:       z = \"UNION ALL\";   break;\r\n    case TK_INTERSECT: z = \"INTERSECT\";   break;\r\n    case TK_EXCEPT:    z = \"EXCEPT\";      break;\r\n    default:           z = \"UNION\";       break;\r\n  }\r\n  return z;\r\n}\r\n#endif /* SQLITE_OMIT_COMPOUND_SELECT */\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n/*\r\n** Unless an \"EXPLAIN QUERY PLAN\" command is being processed, this function\r\n** is a no-op. Otherwise, it adds a single row of output to the EQP result,\r\n** where the caption is of the form:\r\n**\r\n**   \"USE TEMP B-TREE FOR xxx\"\r\n**\r\n** where xxx is one of \"DISTINCT\", \"ORDER BY\" or \"GROUP BY\". Exactly which\r\n** is determined by the zUsage argument.\r\n*/\r\nstatic void explainTempTable(Parse *pParse, const char *zUsage){\r\n  if( pParse->explain==2 ){\r\n    Vdbe *v = pParse->pVdbe;\r\n    char *zMsg = sqlite3MPrintf(pParse->db, \"USE TEMP B-TREE FOR %s\", zUsage);\r\n    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);\r\n  }\r\n}\r\n\r\n/*\r\n** Assign expression b to lvalue a. A second, no-op, version of this macro\r\n** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code\r\n** in sqlite3Select() to assign values to structure member variables that\r\n** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the\r\n** code with #ifndef directives.\r\n*/\r\n# define explainSetInteger(a, b) a = b\r\n\r\n#else\r\n/* No-op versions of the explainXXX() functions and macros. */\r\n# define explainTempTable(y,z)\r\n# define explainSetInteger(y,z)\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT)\r\n/*\r\n** Unless an \"EXPLAIN QUERY PLAN\" command is being processed, this function\r\n** is a no-op. Otherwise, it adds a single row of output to the EQP result,\r\n** where the caption is of one of the two forms:\r\n**\r\n**   \"COMPOSITE SUBQUERIES iSub1 and iSub2 (op)\"\r\n**   \"COMPOSITE SUBQUERIES iSub1 and iSub2 USING TEMP B-TREE (op)\"\r\n**\r\n** where iSub1 and iSub2 are the integers passed as the corresponding\r\n** function parameters, and op is the text representation of the parameter\r\n** of the same name. The parameter \"op\" must be one of TK_UNION, TK_EXCEPT,\r\n** TK_INTERSECT or TK_ALL. The first form is used if argument bUseTmp is \r\n** false, or the second form if it is true.\r\n*/\r\nstatic void explainComposite(\r\n  Parse *pParse,                  /* Parse context */\r\n  int op,                         /* One of TK_UNION, TK_EXCEPT etc. */\r\n  int iSub1,                      /* Subquery id 1 */\r\n  int iSub2,                      /* Subquery id 2 */\r\n  int bUseTmp                     /* True if a temp table was used */\r\n){\r\n  assert( op==TK_UNION || op==TK_EXCEPT || op==TK_INTERSECT || op==TK_ALL );\r\n  if( pParse->explain==2 ){\r\n    Vdbe *v = pParse->pVdbe;\r\n    char *zMsg = sqlite3MPrintf(\r\n        pParse->db, \"COMPOUND SUBQUERIES %d AND %d %s(%s)\", iSub1, iSub2,\r\n        bUseTmp?\"USING TEMP B-TREE \":\"\", selectOpName(op)\r\n    );\r\n    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);\r\n  }\r\n}\r\n#else\r\n/* No-op versions of the explainXXX() functions and macros. */\r\n# define explainComposite(v,w,x,y,z)\r\n#endif\r\n\r\n/*\r\n** If the inner loop was generated using a non-null pOrderBy argument,\r\n** then the results were placed in a sorter.  After the loop is terminated\r\n** we need to run the sorter and output the results.  The following\r\n** routine generates the code needed to do that.\r\n*/\r\nstatic void generateSortTail(\r\n  Parse *pParse,    /* Parsing context */\r\n  Select *p,        /* The SELECT statement */\r\n  Vdbe *v,          /* Generate code into this VDBE */\r\n  int nColumn,      /* Number of columns of data */\r\n  SelectDest *pDest /* Write the sorted results here */\r\n){\r\n  int addrBreak = sqlite3VdbeMakeLabel(v);     /* Jump here to exit loop */\r\n  int addrContinue = sqlite3VdbeMakeLabel(v);  /* Jump here for next cycle */\r\n  int addr;\r\n  int iTab;\r\n  int pseudoTab = 0;\r\n  ExprList *pOrderBy = p->pOrderBy;\r\n\r\n  int eDest = pDest->eDest;\r\n  int iParm = pDest->iParm;\r\n\r\n  int regRow;\r\n  int regRowid;\r\n\r\n  iTab = pOrderBy->iECursor;\r\n  regRow = sqlite3GetTempReg(pParse);\r\n  if( eDest==SRT_Output || eDest==SRT_Coroutine ){\r\n    pseudoTab = pParse->nTab++;\r\n    sqlite3VdbeAddOp3(v, OP_OpenPseudo, pseudoTab, regRow, nColumn);\r\n    regRowid = 0;\r\n  }else{\r\n    regRowid = sqlite3GetTempReg(pParse);\r\n  }\r\n  if( p->selFlags & SF_UseSorter ){\r\n    int regSortOut = ++pParse->nMem;\r\n    int ptab2 = pParse->nTab++;\r\n    sqlite3VdbeAddOp3(v, OP_OpenPseudo, ptab2, regSortOut, pOrderBy->nExpr+2);\r\n    addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);\r\n    codeOffset(v, p, addrContinue);\r\n    sqlite3VdbeAddOp2(v, OP_SorterData, iTab, regSortOut);\r\n    sqlite3VdbeAddOp3(v, OP_Column, ptab2, pOrderBy->nExpr+1, regRow);\r\n    sqlite3VdbeChangeP5(v, OPFLAG_CLEARCACHE);\r\n  }else{\r\n    addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak);\r\n    codeOffset(v, p, addrContinue);\r\n    sqlite3VdbeAddOp3(v, OP_Column, iTab, pOrderBy->nExpr+1, regRow);\r\n  }\r\n  switch( eDest ){\r\n    case SRT_Table:\r\n    case SRT_EphemTab: {\r\n      testcase( eDest==SRT_Table );\r\n      testcase( eDest==SRT_EphemTab );\r\n      sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);\r\n      sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);\r\n      sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case SRT_Set: {\r\n      assert( nColumn==1 );\r\n      sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, 1, regRowid, &p->affinity, 1);\r\n      sqlite3ExprCacheAffinityChange(pParse, regRow, 1);\r\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, regRowid);\r\n      break;\r\n    }\r\n    case SRT_Mem: {\r\n      assert( nColumn==1 );\r\n      sqlite3ExprCodeMove(pParse, regRow, iParm, 1);\r\n      /* The LIMIT clause will terminate the loop for us */\r\n      break;\r\n    }\r\n#endif\r\n    default: {\r\n      int i;\r\n      assert( eDest==SRT_Output || eDest==SRT_Coroutine ); \r\n      testcase( eDest==SRT_Output );\r\n      testcase( eDest==SRT_Coroutine );\r\n      for(i=0; i<nColumn; i++){\r\n        assert( regRow!=pDest->iMem+i );\r\n        sqlite3VdbeAddOp3(v, OP_Column, pseudoTab, i, pDest->iMem+i);\r\n        if( i==0 ){\r\n          sqlite3VdbeChangeP5(v, OPFLAG_CLEARCACHE);\r\n        }\r\n      }\r\n      if( eDest==SRT_Output ){\r\n        sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iMem, nColumn);\r\n        sqlite3ExprCacheAffinityChange(pParse, pDest->iMem, nColumn);\r\n      }else{\r\n        sqlite3VdbeAddOp1(v, OP_Yield, pDest->iParm);\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, regRow);\r\n  sqlite3ReleaseTempReg(pParse, regRowid);\r\n\r\n  /* The bottom of the loop\r\n  */\r\n  sqlite3VdbeResolveLabel(v, addrContinue);\r\n  if( p->selFlags & SF_UseSorter ){\r\n    sqlite3VdbeAddOp2(v, OP_SorterNext, iTab, addr);\r\n  }else{\r\n    sqlite3VdbeAddOp2(v, OP_Next, iTab, addr);\r\n  }\r\n  sqlite3VdbeResolveLabel(v, addrBreak);\r\n  if( eDest==SRT_Output || eDest==SRT_Coroutine ){\r\n    sqlite3VdbeAddOp2(v, OP_Close, pseudoTab, 0);\r\n  }\r\n}\r\n\r\n/*\r\n** Return a pointer to a string containing the 'declaration type' of the\r\n** expression pExpr. The string may be treated as static by the caller.\r\n**\r\n** The declaration type is the exact datatype definition extracted from the\r\n** original CREATE TABLE statement if the expression is a column. The\r\n** declaration type for a ROWID field is INTEGER. Exactly when an expression\r\n** is considered a column can be complex in the presence of subqueries. The\r\n** result-set expression in all of the following SELECT statements is \r\n** considered a column by this function.\r\n**\r\n**   SELECT col FROM tbl;\r\n**   SELECT (SELECT col FROM tbl;\r\n**   SELECT (SELECT col FROM tbl);\r\n**   SELECT abc FROM (SELECT col AS abc FROM tbl);\r\n** \r\n** The declaration type for any expression other than a column is NULL.\r\n*/\r\nstatic const char *columnType(\r\n  NameContext *pNC, \r\n  Expr *pExpr,\r\n  const char **pzOriginDb,\r\n  const char **pzOriginTab,\r\n  const char **pzOriginCol\r\n){\r\n  char const *zType = 0;\r\n  char const *zOriginDb = 0;\r\n  char const *zOriginTab = 0;\r\n  char const *zOriginCol = 0;\r\n  int j;\r\n  if( NEVER(pExpr==0) || pNC->pSrcList==0 ) return 0;\r\n\r\n  switch( pExpr->op ){\r\n    case TK_AGG_COLUMN:\r\n    case TK_COLUMN: {\r\n      /* The expression is a column. Locate the table the column is being\r\n      ** extracted from in NameContext.pSrcList. This table may be real\r\n      ** database table or a subquery.\r\n      */\r\n      Table *pTab = 0;            /* Table structure column is extracted from */\r\n      Select *pS = 0;             /* Select the column is extracted from */\r\n      int iCol = pExpr->iColumn;  /* Index of column in pTab */\r\n      testcase( pExpr->op==TK_AGG_COLUMN );\r\n      testcase( pExpr->op==TK_COLUMN );\r\n      while( pNC && !pTab ){\r\n        SrcList *pTabList = pNC->pSrcList;\r\n        for(j=0;j<pTabList->nSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++);\r\n        if( j<pTabList->nSrc ){\r\n          pTab = pTabList->a[j].pTab;\r\n          pS = pTabList->a[j].pSelect;\r\n        }else{\r\n          pNC = pNC->pNext;\r\n        }\r\n      }\r\n\r\n      if( pTab==0 ){\r\n        /* At one time, code such as \"SELECT new.x\" within a trigger would\r\n        ** cause this condition to run.  Since then, we have restructured how\r\n        ** trigger code is generated and so this condition is no longer \r\n        ** possible. However, it can still be true for statements like\r\n        ** the following:\r\n        **\r\n        **   CREATE TABLE t1(col INTEGER);\r\n        **   SELECT (SELECT t1.col) FROM FROM t1;\r\n        **\r\n        ** when columnType() is called on the expression \"t1.col\" in the \r\n        ** sub-select. In this case, set the column type to NULL, even\r\n        ** though it should really be \"INTEGER\".\r\n        **\r\n        ** This is not a problem, as the column type of \"t1.col\" is never\r\n        ** used. When columnType() is called on the expression \r\n        ** \"(SELECT t1.col)\", the correct type is returned (see the TK_SELECT\r\n        ** branch below.  */\r\n        break;\r\n      }\r\n\r\n      assert( pTab && pExpr->pTab==pTab );\r\n      if( pS ){\r\n        /* The \"table\" is actually a sub-select or a view in the FROM clause\r\n        ** of the SELECT statement. Return the declaration type and origin\r\n        ** data for the result-set column of the sub-select.\r\n        */\r\n        if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){\r\n          /* If iCol is less than zero, then the expression requests the\r\n          ** rowid of the sub-select or view. This expression is legal (see \r\n          ** test case misc2.2.2) - it always evaluates to NULL.\r\n          */\r\n          NameContext sNC;\r\n          Expr *p = pS->pEList->a[iCol].pExpr;\r\n          sNC.pSrcList = pS->pSrc;\r\n          sNC.pNext = pNC;\r\n          sNC.pParse = pNC->pParse;\r\n          zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol); \r\n        }\r\n      }else if( ALWAYS(pTab->pSchema) ){\r\n        /* A real table */\r\n        assert( !pS );\r\n        if( iCol<0 ) iCol = pTab->iPKey;\r\n        assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );\r\n        if( iCol<0 ){\r\n          zType = \"INTEGER\";\r\n          zOriginCol = \"rowid\";\r\n        }else{\r\n          zType = pTab->aCol[iCol].zType;\r\n          zOriginCol = pTab->aCol[iCol].zName;\r\n        }\r\n        zOriginTab = pTab->zName;\r\n        if( pNC->pParse ){\r\n          int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);\r\n          zOriginDb = pNC->pParse->db->aDb[iDb].zName;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    case TK_SELECT: {\r\n      /* The expression is a sub-select. Return the declaration type and\r\n      ** origin info for the single column in the result set of the SELECT\r\n      ** statement.\r\n      */\r\n      NameContext sNC;\r\n      Select *pS = pExpr->x.pSelect;\r\n      Expr *p = pS->pEList->a[0].pExpr;\r\n      assert( ExprHasProperty(pExpr, EP_xIsSelect) );\r\n      sNC.pSrcList = pS->pSrc;\r\n      sNC.pNext = pNC;\r\n      sNC.pParse = pNC->pParse;\r\n      zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol); \r\n      break;\r\n    }\r\n#endif\r\n  }\r\n  \r\n  if( pzOriginDb ){\r\n    assert( pzOriginTab && pzOriginCol );\r\n    *pzOriginDb = zOriginDb;\r\n    *pzOriginTab = zOriginTab;\r\n    *pzOriginCol = zOriginCol;\r\n  }\r\n  return zType;\r\n}\r\n\r\n/*\r\n** Generate code that will tell the VDBE the declaration types of columns\r\n** in the result set.\r\n*/\r\nstatic void generateColumnTypes(\r\n  Parse *pParse,      /* Parser context */\r\n  SrcList *pTabList,  /* List of tables */\r\n  ExprList *pEList    /* Expressions defining the result set */\r\n){\r\n#ifndef SQLITE_OMIT_DECLTYPE\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  NameContext sNC;\r\n  sNC.pSrcList = pTabList;\r\n  sNC.pParse = pParse;\r\n  for(i=0; i<pEList->nExpr; i++){\r\n    Expr *p = pEList->a[i].pExpr;\r\n    const char *zType;\r\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\r\n    const char *zOrigDb = 0;\r\n    const char *zOrigTab = 0;\r\n    const char *zOrigCol = 0;\r\n    zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol);\r\n\r\n    /* The vdbe must make its own copy of the column-type and other \r\n    ** column specific strings, in case the schema is reset before this\r\n    ** virtual machine is deleted.\r\n    */\r\n    sqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, SQLITE_TRANSIENT);\r\n    sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, SQLITE_TRANSIENT);\r\n    sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, SQLITE_TRANSIENT);\r\n#else\r\n    zType = columnType(&sNC, p, 0, 0, 0);\r\n#endif\r\n    sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT);\r\n  }\r\n#endif /* SQLITE_OMIT_DECLTYPE */\r\n}\r\n\r\n/*\r\n** Generate code that will tell the VDBE the names of columns\r\n** in the result set.  This information is used to provide the\r\n** azCol[] values in the callback.\r\n*/\r\nstatic void generateColumnNames(\r\n  Parse *pParse,      /* Parser context */\r\n  SrcList *pTabList,  /* List of tables */\r\n  ExprList *pEList    /* Expressions defining the result set */\r\n){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i, j;\r\n  sqlite3 *db = pParse->db;\r\n  int fullNames, shortNames;\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  /* If this is an EXPLAIN, skip this step */\r\n  if( pParse->explain ){\r\n    return;\r\n  }\r\n#endif\r\n\r\n  if( pParse->colNamesSet || NEVER(v==0) || db->mallocFailed ) return;\r\n  pParse->colNamesSet = 1;\r\n  fullNames = (db->flags & SQLITE_FullColNames)!=0;\r\n  shortNames = (db->flags & SQLITE_ShortColNames)!=0;\r\n  sqlite3VdbeSetNumCols(v, pEList->nExpr);\r\n  for(i=0; i<pEList->nExpr; i++){\r\n    Expr *p;\r\n    p = pEList->a[i].pExpr;\r\n    if( NEVER(p==0) ) continue;\r\n    if( pEList->a[i].zName ){\r\n      char *zName = pEList->a[i].zName;\r\n      sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);\r\n    }else if( (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN) && pTabList ){\r\n      Table *pTab;\r\n      char *zCol;\r\n      int iCol = p->iColumn;\r\n      for(j=0; ALWAYS(j<pTabList->nSrc); j++){\r\n        if( pTabList->a[j].iCursor==p->iTable ) break;\r\n      }\r\n      assert( j<pTabList->nSrc );\r\n      pTab = pTabList->a[j].pTab;\r\n      if( iCol<0 ) iCol = pTab->iPKey;\r\n      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );\r\n      if( iCol<0 ){\r\n        zCol = \"rowid\";\r\n      }else{\r\n        zCol = pTab->aCol[iCol].zName;\r\n      }\r\n      if( !shortNames && !fullNames ){\r\n        sqlite3VdbeSetColName(v, i, COLNAME_NAME, \r\n            sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);\r\n      }else if( fullNames ){\r\n        char *zName = 0;\r\n        zName = sqlite3MPrintf(db, \"%s.%s\", pTab->zName, zCol);\r\n        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);\r\n      }else{\r\n        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);\r\n      }\r\n    }else{\r\n      sqlite3VdbeSetColName(v, i, COLNAME_NAME, \r\n          sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);\r\n    }\r\n  }\r\n  generateColumnTypes(pParse, pTabList, pEList);\r\n}\r\n\r\n/*\r\n** Given a an expression list (which is really the list of expressions\r\n** that form the result set of a SELECT statement) compute appropriate\r\n** column names for a table that would hold the expression list.\r\n**\r\n** All column names will be unique.\r\n**\r\n** Only the column names are computed.  Column.zType, Column.zColl,\r\n** and other fields of Column are zeroed.\r\n**\r\n** Return SQLITE_OK on success.  If a memory allocation error occurs,\r\n** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM.\r\n*/\r\nstatic int selectColumnsFromExprList(\r\n  Parse *pParse,          /* Parsing context */\r\n  ExprList *pEList,       /* Expr list from which to derive column names */\r\n  int *pnCol,             /* Write the number of columns here */\r\n  Column **paCol          /* Write the new column list here */\r\n){\r\n  sqlite3 *db = pParse->db;   /* Database connection */\r\n  int i, j;                   /* Loop counters */\r\n  int cnt;                    /* Index added to make the name unique */\r\n  Column *aCol, *pCol;        /* For looping over result columns */\r\n  int nCol;                   /* Number of columns in the result set */\r\n  Expr *p;                    /* Expression for a single result column */\r\n  char *zName;                /* Column name */\r\n  int nName;                  /* Size of name in zName[] */\r\n\r\n  *pnCol = nCol = pEList ? pEList->nExpr : 0;\r\n  aCol = *paCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol);\r\n  if( aCol==0 ) return SQLITE_NOMEM;\r\n  for(i=0, pCol=aCol; i<nCol; i++, pCol++){\r\n    /* Get an appropriate name for the column\r\n    */\r\n    p = pEList->a[i].pExpr;\r\n    assert( p->pRight==0 || ExprHasProperty(p->pRight, EP_IntValue)\r\n               || p->pRight->u.zToken==0 || p->pRight->u.zToken[0]!=0 );\r\n    if( (zName = pEList->a[i].zName)!=0 ){\r\n      /* If the column contains an \"AS <name>\" phrase, use <name> as the name */\r\n      zName = sqlite3DbStrDup(db, zName);\r\n    }else{\r\n      Expr *pColExpr = p;  /* The expression that is the result column name */\r\n      Table *pTab;         /* Table associated with this expression */\r\n      while( pColExpr->op==TK_DOT ){\r\n        pColExpr = pColExpr->pRight;\r\n        assert( pColExpr!=0 );\r\n      }\r\n      if( pColExpr->op==TK_COLUMN && ALWAYS(pColExpr->pTab!=0) ){\r\n        /* For columns use the column name name */\r\n        int iCol = pColExpr->iColumn;\r\n        pTab = pColExpr->pTab;\r\n        if( iCol<0 ) iCol = pTab->iPKey;\r\n        zName = sqlite3MPrintf(db, \"%s\",\r\n                 iCol>=0 ? pTab->aCol[iCol].zName : \"rowid\");\r\n      }else if( pColExpr->op==TK_ID ){\r\n        assert( !ExprHasProperty(pColExpr, EP_IntValue) );\r\n        zName = sqlite3MPrintf(db, \"%s\", pColExpr->u.zToken);\r\n      }else{\r\n        /* Use the original text of the column expression as its name */\r\n        zName = sqlite3MPrintf(db, \"%s\", pEList->a[i].zSpan);\r\n      }\r\n    }\r\n    if( db->mallocFailed ){\r\n      sqlite3DbFree(db, zName);\r\n      break;\r\n    }\r\n\r\n    /* Make sure the column name is unique.  If the name is not unique,\r\n    ** append a integer to the name so that it becomes unique.\r\n    */\r\n    nName = sqlite3Strlen30(zName);\r\n    for(j=cnt=0; j<i; j++){\r\n      if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){\r\n        char *zNewName;\r\n        zName[nName] = 0;\r\n        zNewName = sqlite3MPrintf(db, \"%s:%d\", zName, ++cnt);\r\n        sqlite3DbFree(db, zName);\r\n        zName = zNewName;\r\n        j = -1;\r\n        if( zName==0 ) break;\r\n      }\r\n    }\r\n    pCol->zName = zName;\r\n  }\r\n  if( db->mallocFailed ){\r\n    for(j=0; j<i; j++){\r\n      sqlite3DbFree(db, aCol[j].zName);\r\n    }\r\n    sqlite3DbFree(db, aCol);\r\n    *paCol = 0;\r\n    *pnCol = 0;\r\n    return SQLITE_NOMEM;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Add type and collation information to a column list based on\r\n** a SELECT statement.\r\n** \r\n** The column list presumably came from selectColumnNamesFromExprList().\r\n** The column list has only names, not types or collations.  This\r\n** routine goes through and adds the types and collations.\r\n**\r\n** This routine requires that all identifiers in the SELECT\r\n** statement be resolved.\r\n*/\r\nstatic void selectAddColumnTypeAndCollation(\r\n  Parse *pParse,        /* Parsing contexts */\r\n  int nCol,             /* Number of columns */\r\n  Column *aCol,         /* List of columns */\r\n  Select *pSelect       /* SELECT used to determine types and collations */\r\n){\r\n  sqlite3 *db = pParse->db;\r\n  NameContext sNC;\r\n  Column *pCol;\r\n  CollSeq *pColl;\r\n  int i;\r\n  Expr *p;\r\n  struct ExprList_item *a;\r\n\r\n  assert( pSelect!=0 );\r\n  assert( (pSelect->selFlags & SF_Resolved)!=0 );\r\n  assert( nCol==pSelect->pEList->nExpr || db->mallocFailed );\r\n  if( db->mallocFailed ) return;\r\n  memset(&sNC, 0, sizeof(sNC));\r\n  sNC.pSrcList = pSelect->pSrc;\r\n  a = pSelect->pEList->a;\r\n  for(i=0, pCol=aCol; i<nCol; i++, pCol++){\r\n    p = a[i].pExpr;\r\n    pCol->zType = sqlite3DbStrDup(db, columnType(&sNC, p, 0, 0, 0));\r\n    pCol->affinity = sqlite3ExprAffinity(p);\r\n    if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_NONE;\r\n    pColl = sqlite3ExprCollSeq(pParse, p);\r\n    if( pColl ){\r\n      pCol->zColl = sqlite3DbStrDup(db, pColl->zName);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Given a SELECT statement, generate a Table structure that describes\r\n** the result set of that SELECT.\r\n*/\r\nSQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){\r\n  Table *pTab;\r\n  sqlite3 *db = pParse->db;\r\n  int savedFlags;\r\n\r\n  savedFlags = db->flags;\r\n  db->flags &= ~SQLITE_FullColNames;\r\n  db->flags |= SQLITE_ShortColNames;\r\n  sqlite3SelectPrep(pParse, pSelect, 0);\r\n  if( pParse->nErr ) return 0;\r\n  while( pSelect->pPrior ) pSelect = pSelect->pPrior;\r\n  db->flags = savedFlags;\r\n  pTab = sqlite3DbMallocZero(db, sizeof(Table) );\r\n  if( pTab==0 ){\r\n    return 0;\r\n  }\r\n  /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside\r\n  ** is disabled */\r\n  assert( db->lookaside.bEnabled==0 );\r\n  pTab->nRef = 1;\r\n  pTab->zName = 0;\r\n  pTab->nRowEst = 1000000;\r\n  selectColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);\r\n  selectAddColumnTypeAndCollation(pParse, pTab->nCol, pTab->aCol, pSelect);\r\n  pTab->iPKey = -1;\r\n  if( db->mallocFailed ){\r\n    sqlite3DeleteTable(db, pTab);\r\n    return 0;\r\n  }\r\n  return pTab;\r\n}\r\n\r\n/*\r\n** Get a VDBE for the given parser context.  Create a new one if necessary.\r\n** If an error occurs, return NULL and leave a message in pParse.\r\n*/\r\nSQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){\r\n  Vdbe *v = pParse->pVdbe;\r\n  if( v==0 ){\r\n    v = pParse->pVdbe = sqlite3VdbeCreate(pParse->db);\r\n#ifndef SQLITE_OMIT_TRACE\r\n    if( v ){\r\n      sqlite3VdbeAddOp0(v, OP_Trace);\r\n    }\r\n#endif\r\n  }\r\n  return v;\r\n}\r\n\r\n\r\n/*\r\n** Compute the iLimit and iOffset fields of the SELECT based on the\r\n** pLimit and pOffset expressions.  pLimit and pOffset hold the expressions\r\n** that appear in the original SQL statement after the LIMIT and OFFSET\r\n** keywords.  Or NULL if those keywords are omitted. iLimit and iOffset \r\n** are the integer memory register numbers for counters used to compute \r\n** the limit and offset.  If there is no limit and/or offset, then \r\n** iLimit and iOffset are negative.\r\n**\r\n** This routine changes the values of iLimit and iOffset only if\r\n** a limit or offset is defined by pLimit and pOffset.  iLimit and\r\n** iOffset should have been preset to appropriate default values\r\n** (usually but not always -1) prior to calling this routine.\r\n** Only if pLimit!=0 or pOffset!=0 do the limit registers get\r\n** redefined.  The UNION ALL operator uses this property to force\r\n** the reuse of the same limit and offset registers across multiple\r\n** SELECT statements.\r\n*/\r\nstatic void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){\r\n  Vdbe *v = 0;\r\n  int iLimit = 0;\r\n  int iOffset;\r\n  int addr1, n;\r\n  if( p->iLimit ) return;\r\n\r\n  /* \r\n  ** \"LIMIT -1\" always shows all rows.  There is some\r\n  ** contraversy about what the correct behavior should be.\r\n  ** The current implementation interprets \"LIMIT 0\" to mean\r\n  ** no rows.\r\n  */\r\n  sqlite3ExprCacheClear(pParse);\r\n  assert( p->pOffset==0 || p->pLimit!=0 );\r\n  if( p->pLimit ){\r\n    p->iLimit = iLimit = ++pParse->nMem;\r\n    v = sqlite3GetVdbe(pParse);\r\n    if( NEVER(v==0) ) return;  /* VDBE should have already been allocated */\r\n    if( sqlite3ExprIsInteger(p->pLimit, &n) ){\r\n      sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);\r\n      VdbeComment((v, \"LIMIT counter\"));\r\n      if( n==0 ){\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak);\r\n      }else{\r\n        if( p->nSelectRow > (double)n ) p->nSelectRow = (double)n;\r\n      }\r\n    }else{\r\n      sqlite3ExprCode(pParse, p->pLimit, iLimit);\r\n      sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit);\r\n      VdbeComment((v, \"LIMIT counter\"));\r\n      sqlite3VdbeAddOp2(v, OP_IfZero, iLimit, iBreak);\r\n    }\r\n    if( p->pOffset ){\r\n      p->iOffset = iOffset = ++pParse->nMem;\r\n      pParse->nMem++;   /* Allocate an extra register for limit+offset */\r\n      sqlite3ExprCode(pParse, p->pOffset, iOffset);\r\n      sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset);\r\n      VdbeComment((v, \"OFFSET counter\"));\r\n      addr1 = sqlite3VdbeAddOp1(v, OP_IfPos, iOffset);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, iOffset);\r\n      sqlite3VdbeJumpHere(v, addr1);\r\n      sqlite3VdbeAddOp3(v, OP_Add, iLimit, iOffset, iOffset+1);\r\n      VdbeComment((v, \"LIMIT+OFFSET\"));\r\n      addr1 = sqlite3VdbeAddOp1(v, OP_IfPos, iLimit);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, -1, iOffset+1);\r\n      sqlite3VdbeJumpHere(v, addr1);\r\n    }\r\n  }\r\n}\r\n\r\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\r\n/*\r\n** Return the appropriate collating sequence for the iCol-th column of\r\n** the result set for the compound-select statement \"p\".  Return NULL if\r\n** the column has no default collating sequence.\r\n**\r\n** The collating sequence for the compound select is taken from the\r\n** left-most term of the select that has a collating sequence.\r\n*/\r\nstatic CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){\r\n  CollSeq *pRet;\r\n  if( p->pPrior ){\r\n    pRet = multiSelectCollSeq(pParse, p->pPrior, iCol);\r\n  }else{\r\n    pRet = 0;\r\n  }\r\n  assert( iCol>=0 );\r\n  if( pRet==0 && iCol<p->pEList->nExpr ){\r\n    pRet = sqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr);\r\n  }\r\n  return pRet;\r\n}\r\n#endif /* SQLITE_OMIT_COMPOUND_SELECT */\r\n\r\n/* Forward reference */\r\nstatic int multiSelectOrderBy(\r\n  Parse *pParse,        /* Parsing context */\r\n  Select *p,            /* The right-most of SELECTs to be coded */\r\n  SelectDest *pDest     /* What to do with query results */\r\n);\r\n\r\n\r\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\r\n/*\r\n** This routine is called to process a compound query form from\r\n** two or more separate queries using UNION, UNION ALL, EXCEPT, or\r\n** INTERSECT\r\n**\r\n** \"p\" points to the right-most of the two queries.  the query on the\r\n** left is p->pPrior.  The left query could also be a compound query\r\n** in which case this routine will be called recursively. \r\n**\r\n** The results of the total query are to be written into a destination\r\n** of type eDest with parameter iParm.\r\n**\r\n** Example 1:  Consider a three-way compound SQL statement.\r\n**\r\n**     SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3\r\n**\r\n** This statement is parsed up as follows:\r\n**\r\n**     SELECT c FROM t3\r\n**      |\r\n**      `----->  SELECT b FROM t2\r\n**                |\r\n**                `------>  SELECT a FROM t1\r\n**\r\n** The arrows in the diagram above represent the Select.pPrior pointer.\r\n** So if this routine is called with p equal to the t3 query, then\r\n** pPrior will be the t2 query.  p->op will be TK_UNION in this case.\r\n**\r\n** Notice that because of the way SQLite parses compound SELECTs, the\r\n** individual selects always group from left to right.\r\n*/\r\nstatic int multiSelect(\r\n  Parse *pParse,        /* Parsing context */\r\n  Select *p,            /* The right-most of SELECTs to be coded */\r\n  SelectDest *pDest     /* What to do with query results */\r\n){\r\n  int rc = SQLITE_OK;   /* Success code from a subroutine */\r\n  Select *pPrior;       /* Another SELECT immediately to our left */\r\n  Vdbe *v;              /* Generate code to this VDBE */\r\n  SelectDest dest;      /* Alternative data destination */\r\n  Select *pDelete = 0;  /* Chain of simple selects to delete */\r\n  sqlite3 *db;          /* Database connection */\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  int iSub1;            /* EQP id of left-hand query */\r\n  int iSub2;            /* EQP id of right-hand query */\r\n#endif\r\n\r\n  /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only\r\n  ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.\r\n  */\r\n  assert( p && p->pPrior );  /* Calling function guarantees this much */\r\n  db = pParse->db;\r\n  pPrior = p->pPrior;\r\n  assert( pPrior->pRightmost!=pPrior );\r\n  assert( pPrior->pRightmost==p->pRightmost );\r\n  dest = *pDest;\r\n  if( pPrior->pOrderBy ){\r\n    sqlite3ErrorMsg(pParse,\"ORDER BY clause should come after %s not before\",\r\n      selectOpName(p->op));\r\n    rc = 1;\r\n    goto multi_select_end;\r\n  }\r\n  if( pPrior->pLimit ){\r\n    sqlite3ErrorMsg(pParse,\"LIMIT clause should come after %s not before\",\r\n      selectOpName(p->op));\r\n    rc = 1;\r\n    goto multi_select_end;\r\n  }\r\n\r\n  v = sqlite3GetVdbe(pParse);\r\n  assert( v!=0 );  /* The VDBE already created by calling function */\r\n\r\n  /* Create the destination temporary table if necessary\r\n  */\r\n  if( dest.eDest==SRT_EphemTab ){\r\n    assert( p->pEList );\r\n    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iParm, p->pEList->nExpr);\r\n    sqlite3VdbeChangeP5(v, BTREE_UNORDERED);\r\n    dest.eDest = SRT_Table;\r\n  }\r\n\r\n  /* Make sure all SELECTs in the statement have the same number of elements\r\n  ** in their result sets.\r\n  */\r\n  assert( p->pEList && pPrior->pEList );\r\n  if( p->pEList->nExpr!=pPrior->pEList->nExpr ){\r\n    if( p->selFlags & SF_Values ){\r\n      sqlite3ErrorMsg(pParse, \"all VALUES must have the same number of terms\");\r\n    }else{\r\n      sqlite3ErrorMsg(pParse, \"SELECTs to the left and right of %s\"\r\n        \" do not have the same number of result columns\", selectOpName(p->op));\r\n    }\r\n    rc = 1;\r\n    goto multi_select_end;\r\n  }\r\n\r\n  /* Compound SELECTs that have an ORDER BY clause are handled separately.\r\n  */\r\n  if( p->pOrderBy ){\r\n    return multiSelectOrderBy(pParse, p, pDest);\r\n  }\r\n\r\n  /* Generate code for the left and right SELECT statements.\r\n  */\r\n  switch( p->op ){\r\n    case TK_ALL: {\r\n      int addr = 0;\r\n      int nLimit;\r\n      assert( !pPrior->pLimit );\r\n      pPrior->pLimit = p->pLimit;\r\n      pPrior->pOffset = p->pOffset;\r\n      explainSetInteger(iSub1, pParse->iNextSelectId);\r\n      rc = sqlite3Select(pParse, pPrior, &dest);\r\n      p->pLimit = 0;\r\n      p->pOffset = 0;\r\n      if( rc ){\r\n        goto multi_select_end;\r\n      }\r\n      p->pPrior = 0;\r\n      p->iLimit = pPrior->iLimit;\r\n      p->iOffset = pPrior->iOffset;\r\n      if( p->iLimit ){\r\n        addr = sqlite3VdbeAddOp1(v, OP_IfZero, p->iLimit);\r\n        VdbeComment((v, \"Jump ahead if LIMIT reached\"));\r\n      }\r\n      explainSetInteger(iSub2, pParse->iNextSelectId);\r\n      rc = sqlite3Select(pParse, p, &dest);\r\n      testcase( rc!=SQLITE_OK );\r\n      pDelete = p->pPrior;\r\n      p->pPrior = pPrior;\r\n      p->nSelectRow += pPrior->nSelectRow;\r\n      if( pPrior->pLimit\r\n       && sqlite3ExprIsInteger(pPrior->pLimit, &nLimit)\r\n       && p->nSelectRow > (double)nLimit \r\n      ){\r\n        p->nSelectRow = (double)nLimit;\r\n      }\r\n      if( addr ){\r\n        sqlite3VdbeJumpHere(v, addr);\r\n      }\r\n      break;\r\n    }\r\n    case TK_EXCEPT:\r\n    case TK_UNION: {\r\n      int unionTab;    /* Cursor number of the temporary table holding result */\r\n      u8 op = 0;       /* One of the SRT_ operations to apply to self */\r\n      int priorOp;     /* The SRT_ operation to apply to prior selects */\r\n      Expr *pLimit, *pOffset; /* Saved values of p->nLimit and p->nOffset */\r\n      int addr;\r\n      SelectDest uniondest;\r\n\r\n      testcase( p->op==TK_EXCEPT );\r\n      testcase( p->op==TK_UNION );\r\n      priorOp = SRT_Union;\r\n      if( dest.eDest==priorOp && ALWAYS(!p->pLimit &&!p->pOffset) ){\r\n        /* We can reuse a temporary table generated by a SELECT to our\r\n        ** right.\r\n        */\r\n        assert( p->pRightmost!=p );  /* Can only happen for leftward elements\r\n                                     ** of a 3-way or more compound */\r\n        assert( p->pLimit==0 );      /* Not allowed on leftward elements */\r\n        assert( p->pOffset==0 );     /* Not allowed on leftward elements */\r\n        unionTab = dest.iParm;\r\n      }else{\r\n        /* We will need to create our own temporary table to hold the\r\n        ** intermediate results.\r\n        */\r\n        unionTab = pParse->nTab++;\r\n        assert( p->pOrderBy==0 );\r\n        addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);\r\n        assert( p->addrOpenEphm[0] == -1 );\r\n        p->addrOpenEphm[0] = addr;\r\n        p->pRightmost->selFlags |= SF_UsesEphemeral;\r\n        assert( p->pEList );\r\n      }\r\n\r\n      /* Code the SELECT statements to our left\r\n      */\r\n      assert( !pPrior->pOrderBy );\r\n      sqlite3SelectDestInit(&uniondest, priorOp, unionTab);\r\n      explainSetInteger(iSub1, pParse->iNextSelectId);\r\n      rc = sqlite3Select(pParse, pPrior, &uniondest);\r\n      if( rc ){\r\n        goto multi_select_end;\r\n      }\r\n\r\n      /* Code the current SELECT statement\r\n      */\r\n      if( p->op==TK_EXCEPT ){\r\n        op = SRT_Except;\r\n      }else{\r\n        assert( p->op==TK_UNION );\r\n        op = SRT_Union;\r\n      }\r\n      p->pPrior = 0;\r\n      pLimit = p->pLimit;\r\n      p->pLimit = 0;\r\n      pOffset = p->pOffset;\r\n      p->pOffset = 0;\r\n      uniondest.eDest = op;\r\n      explainSetInteger(iSub2, pParse->iNextSelectId);\r\n      rc = sqlite3Select(pParse, p, &uniondest);\r\n      testcase( rc!=SQLITE_OK );\r\n      /* Query flattening in sqlite3Select() might refill p->pOrderBy.\r\n      ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */\r\n      sqlite3ExprListDelete(db, p->pOrderBy);\r\n      pDelete = p->pPrior;\r\n      p->pPrior = pPrior;\r\n      p->pOrderBy = 0;\r\n      if( p->op==TK_UNION ) p->nSelectRow += pPrior->nSelectRow;\r\n      sqlite3ExprDelete(db, p->pLimit);\r\n      p->pLimit = pLimit;\r\n      p->pOffset = pOffset;\r\n      p->iLimit = 0;\r\n      p->iOffset = 0;\r\n\r\n      /* Convert the data in the temporary table into whatever form\r\n      ** it is that we currently need.\r\n      */\r\n      assert( unionTab==dest.iParm || dest.eDest!=priorOp );\r\n      if( dest.eDest!=priorOp ){\r\n        int iCont, iBreak, iStart;\r\n        assert( p->pEList );\r\n        if( dest.eDest==SRT_Output ){\r\n          Select *pFirst = p;\r\n          while( pFirst->pPrior ) pFirst = pFirst->pPrior;\r\n          generateColumnNames(pParse, 0, pFirst->pEList);\r\n        }\r\n        iBreak = sqlite3VdbeMakeLabel(v);\r\n        iCont = sqlite3VdbeMakeLabel(v);\r\n        computeLimitRegisters(pParse, p, iBreak);\r\n        sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak);\r\n        iStart = sqlite3VdbeCurrentAddr(v);\r\n        selectInnerLoop(pParse, p, p->pEList, unionTab, p->pEList->nExpr,\r\n                        0, -1, &dest, iCont, iBreak);\r\n        sqlite3VdbeResolveLabel(v, iCont);\r\n        sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart);\r\n        sqlite3VdbeResolveLabel(v, iBreak);\r\n        sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);\r\n      }\r\n      break;\r\n    }\r\n    default: assert( p->op==TK_INTERSECT ); {\r\n      int tab1, tab2;\r\n      int iCont, iBreak, iStart;\r\n      Expr *pLimit, *pOffset;\r\n      int addr;\r\n      SelectDest intersectdest;\r\n      int r1;\r\n\r\n      /* INTERSECT is different from the others since it requires\r\n      ** two temporary tables.  Hence it has its own case.  Begin\r\n      ** by allocating the tables we will need.\r\n      */\r\n      tab1 = pParse->nTab++;\r\n      tab2 = pParse->nTab++;\r\n      assert( p->pOrderBy==0 );\r\n\r\n      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);\r\n      assert( p->addrOpenEphm[0] == -1 );\r\n      p->addrOpenEphm[0] = addr;\r\n      p->pRightmost->selFlags |= SF_UsesEphemeral;\r\n      assert( p->pEList );\r\n\r\n      /* Code the SELECTs to our left into temporary table \"tab1\".\r\n      */\r\n      sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);\r\n      explainSetInteger(iSub1, pParse->iNextSelectId);\r\n      rc = sqlite3Select(pParse, pPrior, &intersectdest);\r\n      if( rc ){\r\n        goto multi_select_end;\r\n      }\r\n\r\n      /* Code the current SELECT into temporary table \"tab2\"\r\n      */\r\n      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);\r\n      assert( p->addrOpenEphm[1] == -1 );\r\n      p->addrOpenEphm[1] = addr;\r\n      p->pPrior = 0;\r\n      pLimit = p->pLimit;\r\n      p->pLimit = 0;\r\n      pOffset = p->pOffset;\r\n      p->pOffset = 0;\r\n      intersectdest.iParm = tab2;\r\n      explainSetInteger(iSub2, pParse->iNextSelectId);\r\n      rc = sqlite3Select(pParse, p, &intersectdest);\r\n      testcase( rc!=SQLITE_OK );\r\n      pDelete = p->pPrior;\r\n      p->pPrior = pPrior;\r\n      if( p->nSelectRow>pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow;\r\n      sqlite3ExprDelete(db, p->pLimit);\r\n      p->pLimit = pLimit;\r\n      p->pOffset = pOffset;\r\n\r\n      /* Generate code to take the intersection of the two temporary\r\n      ** tables.\r\n      */\r\n      assert( p->pEList );\r\n      if( dest.eDest==SRT_Output ){\r\n        Select *pFirst = p;\r\n        while( pFirst->pPrior ) pFirst = pFirst->pPrior;\r\n        generateColumnNames(pParse, 0, pFirst->pEList);\r\n      }\r\n      iBreak = sqlite3VdbeMakeLabel(v);\r\n      iCont = sqlite3VdbeMakeLabel(v);\r\n      computeLimitRegisters(pParse, p, iBreak);\r\n      sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak);\r\n      r1 = sqlite3GetTempReg(pParse);\r\n      iStart = sqlite3VdbeAddOp2(v, OP_RowKey, tab1, r1);\r\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0);\r\n      sqlite3ReleaseTempReg(pParse, r1);\r\n      selectInnerLoop(pParse, p, p->pEList, tab1, p->pEList->nExpr,\r\n                      0, -1, &dest, iCont, iBreak);\r\n      sqlite3VdbeResolveLabel(v, iCont);\r\n      sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart);\r\n      sqlite3VdbeResolveLabel(v, iBreak);\r\n      sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);\r\n      sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);\r\n      break;\r\n    }\r\n  }\r\n\r\n  explainComposite(pParse, p->op, iSub1, iSub2, p->op!=TK_ALL);\r\n\r\n  /* Compute collating sequences used by \r\n  ** temporary tables needed to implement the compound select.\r\n  ** Attach the KeyInfo structure to all temporary tables.\r\n  **\r\n  ** This section is run by the right-most SELECT statement only.\r\n  ** SELECT statements to the left always skip this part.  The right-most\r\n  ** SELECT might also skip this part if it has no ORDER BY clause and\r\n  ** no temp tables are required.\r\n  */\r\n  if( p->selFlags & SF_UsesEphemeral ){\r\n    int i;                        /* Loop counter */\r\n    KeyInfo *pKeyInfo;            /* Collating sequence for the result set */\r\n    Select *pLoop;                /* For looping through SELECT statements */\r\n    CollSeq **apColl;             /* For looping through pKeyInfo->aColl[] */\r\n    int nCol;                     /* Number of columns in result set */\r\n\r\n    assert( p->pRightmost==p );\r\n    nCol = p->pEList->nExpr;\r\n    pKeyInfo = sqlite3DbMallocZero(db,\r\n                       sizeof(*pKeyInfo)+nCol*(sizeof(CollSeq*) + 1));\r\n    if( !pKeyInfo ){\r\n      rc = SQLITE_NOMEM;\r\n      goto multi_select_end;\r\n    }\r\n\r\n    pKeyInfo->enc = ENC(db);\r\n    pKeyInfo->nField = (u16)nCol;\r\n\r\n    for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){\r\n      *apColl = multiSelectCollSeq(pParse, p, i);\r\n      if( 0==*apColl ){\r\n        *apColl = db->pDfltColl;\r\n      }\r\n    }\r\n\r\n    for(pLoop=p; pLoop; pLoop=pLoop->pPrior){\r\n      for(i=0; i<2; i++){\r\n        int addr = pLoop->addrOpenEphm[i];\r\n        if( addr<0 ){\r\n          /* If [0] is unused then [1] is also unused.  So we can\r\n          ** always safely abort as soon as the first unused slot is found */\r\n          assert( pLoop->addrOpenEphm[1]<0 );\r\n          break;\r\n        }\r\n        sqlite3VdbeChangeP2(v, addr, nCol);\r\n        sqlite3VdbeChangeP4(v, addr, (char*)pKeyInfo, P4_KEYINFO);\r\n        pLoop->addrOpenEphm[i] = -1;\r\n      }\r\n    }\r\n    sqlite3DbFree(db, pKeyInfo);\r\n  }\r\n\r\nmulti_select_end:\r\n  pDest->iMem = dest.iMem;\r\n  pDest->nMem = dest.nMem;\r\n  sqlite3SelectDelete(db, pDelete);\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_COMPOUND_SELECT */\r\n\r\n/*\r\n** Code an output subroutine for a coroutine implementation of a\r\n** SELECT statment.\r\n**\r\n** The data to be output is contained in pIn->iMem.  There are\r\n** pIn->nMem columns to be output.  pDest is where the output should\r\n** be sent.\r\n**\r\n** regReturn is the number of the register holding the subroutine\r\n** return address.\r\n**\r\n** If regPrev>0 then it is the first register in a vector that\r\n** records the previous output.  mem[regPrev] is a flag that is false\r\n** if there has been no previous output.  If regPrev>0 then code is\r\n** generated to suppress duplicates.  pKeyInfo is used for comparing\r\n** keys.\r\n**\r\n** If the LIMIT found in p->iLimit is reached, jump immediately to\r\n** iBreak.\r\n*/\r\nstatic int generateOutputSubroutine(\r\n  Parse *pParse,          /* Parsing context */\r\n  Select *p,              /* The SELECT statement */\r\n  SelectDest *pIn,        /* Coroutine supplying data */\r\n  SelectDest *pDest,      /* Where to send the data */\r\n  int regReturn,          /* The return address register */\r\n  int regPrev,            /* Previous result register.  No uniqueness if 0 */\r\n  KeyInfo *pKeyInfo,      /* For comparing with previous entry */\r\n  int p4type,             /* The p4 type for pKeyInfo */\r\n  int iBreak              /* Jump here if we hit the LIMIT */\r\n){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int iContinue;\r\n  int addr;\r\n\r\n  addr = sqlite3VdbeCurrentAddr(v);\r\n  iContinue = sqlite3VdbeMakeLabel(v);\r\n\r\n  /* Suppress duplicates for UNION, EXCEPT, and INTERSECT \r\n  */\r\n  if( regPrev ){\r\n    int j1, j2;\r\n    j1 = sqlite3VdbeAddOp1(v, OP_IfNot, regPrev);\r\n    j2 = sqlite3VdbeAddOp4(v, OP_Compare, pIn->iMem, regPrev+1, pIn->nMem,\r\n                              (char*)pKeyInfo, p4type);\r\n    sqlite3VdbeAddOp3(v, OP_Jump, j2+2, iContinue, j2+2);\r\n    sqlite3VdbeJumpHere(v, j1);\r\n    sqlite3ExprCodeCopy(pParse, pIn->iMem, regPrev+1, pIn->nMem);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 1, regPrev);\r\n  }\r\n  if( pParse->db->mallocFailed ) return 0;\r\n\r\n  /* Suppress the the first OFFSET entries if there is an OFFSET clause\r\n  */\r\n  codeOffset(v, p, iContinue);\r\n\r\n  switch( pDest->eDest ){\r\n    /* Store the result as data using a unique key.\r\n    */\r\n    case SRT_Table:\r\n    case SRT_EphemTab: {\r\n      int r1 = sqlite3GetTempReg(pParse);\r\n      int r2 = sqlite3GetTempReg(pParse);\r\n      testcase( pDest->eDest==SRT_Table );\r\n      testcase( pDest->eDest==SRT_EphemTab );\r\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iMem, pIn->nMem, r1);\r\n      sqlite3VdbeAddOp2(v, OP_NewRowid, pDest->iParm, r2);\r\n      sqlite3VdbeAddOp3(v, OP_Insert, pDest->iParm, r1, r2);\r\n      sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\r\n      sqlite3ReleaseTempReg(pParse, r2);\r\n      sqlite3ReleaseTempReg(pParse, r1);\r\n      break;\r\n    }\r\n\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n    /* If we are creating a set for an \"expr IN (SELECT ...)\" construct,\r\n    ** then there should be a single item on the stack.  Write this\r\n    ** item into the set table with bogus data.\r\n    */\r\n    case SRT_Set: {\r\n      int r1;\r\n      assert( pIn->nMem==1 );\r\n      p->affinity = \r\n         sqlite3CompareAffinity(p->pEList->a[0].pExpr, pDest->affinity);\r\n      r1 = sqlite3GetTempReg(pParse);\r\n      sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iMem, 1, r1, &p->affinity, 1);\r\n      sqlite3ExprCacheAffinityChange(pParse, pIn->iMem, 1);\r\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, pDest->iParm, r1);\r\n      sqlite3ReleaseTempReg(pParse, r1);\r\n      break;\r\n    }\r\n\r\n#if 0  /* Never occurs on an ORDER BY query */\r\n    /* If any row exist in the result set, record that fact and abort.\r\n    */\r\n    case SRT_Exists: {\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, pDest->iParm);\r\n      /* The LIMIT clause will terminate the loop for us */\r\n      break;\r\n    }\r\n#endif\r\n\r\n    /* If this is a scalar select that is part of an expression, then\r\n    ** store the results in the appropriate memory cell and break out\r\n    ** of the scan loop.\r\n    */\r\n    case SRT_Mem: {\r\n      assert( pIn->nMem==1 );\r\n      sqlite3ExprCodeMove(pParse, pIn->iMem, pDest->iParm, 1);\r\n      /* The LIMIT clause will jump out of the loop for us */\r\n      break;\r\n    }\r\n#endif /* #ifndef SQLITE_OMIT_SUBQUERY */\r\n\r\n    /* The results are stored in a sequence of registers\r\n    ** starting at pDest->iMem.  Then the co-routine yields.\r\n    */\r\n    case SRT_Coroutine: {\r\n      if( pDest->iMem==0 ){\r\n        pDest->iMem = sqlite3GetTempRange(pParse, pIn->nMem);\r\n        pDest->nMem = pIn->nMem;\r\n      }\r\n      sqlite3ExprCodeMove(pParse, pIn->iMem, pDest->iMem, pDest->nMem);\r\n      sqlite3VdbeAddOp1(v, OP_Yield, pDest->iParm);\r\n      break;\r\n    }\r\n\r\n    /* If none of the above, then the result destination must be\r\n    ** SRT_Output.  This routine is never called with any other\r\n    ** destination other than the ones handled above or SRT_Output.\r\n    **\r\n    ** For SRT_Output, results are stored in a sequence of registers.  \r\n    ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to\r\n    ** return the next row of result.\r\n    */\r\n    default: {\r\n      assert( pDest->eDest==SRT_Output );\r\n      sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iMem, pIn->nMem);\r\n      sqlite3ExprCacheAffinityChange(pParse, pIn->iMem, pIn->nMem);\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* Jump to the end of the loop if the LIMIT is reached.\r\n  */\r\n  if( p->iLimit ){\r\n    sqlite3VdbeAddOp3(v, OP_IfZero, p->iLimit, iBreak, -1);\r\n  }\r\n\r\n  /* Generate the subroutine return\r\n  */\r\n  sqlite3VdbeResolveLabel(v, iContinue);\r\n  sqlite3VdbeAddOp1(v, OP_Return, regReturn);\r\n\r\n  return addr;\r\n}\r\n\r\n/*\r\n** Alternative compound select code generator for cases when there\r\n** is an ORDER BY clause.\r\n**\r\n** We assume a query of the following form:\r\n**\r\n**      <selectA>  <operator>  <selectB>  ORDER BY <orderbylist>\r\n**\r\n** <operator> is one of UNION ALL, UNION, EXCEPT, or INTERSECT.  The idea\r\n** is to code both <selectA> and <selectB> with the ORDER BY clause as\r\n** co-routines.  Then run the co-routines in parallel and merge the results\r\n** into the output.  In addition to the two coroutines (called selectA and\r\n** selectB) there are 7 subroutines:\r\n**\r\n**    outA:    Move the output of the selectA coroutine into the output\r\n**             of the compound query.\r\n**\r\n**    outB:    Move the output of the selectB coroutine into the output\r\n**             of the compound query.  (Only generated for UNION and\r\n**             UNION ALL.  EXCEPT and INSERTSECT never output a row that\r\n**             appears only in B.)\r\n**\r\n**    AltB:    Called when there is data from both coroutines and A<B.\r\n**\r\n**    AeqB:    Called when there is data from both coroutines and A==B.\r\n**\r\n**    AgtB:    Called when there is data from both coroutines and A>B.\r\n**\r\n**    EofA:    Called when data is exhausted from selectA.\r\n**\r\n**    EofB:    Called when data is exhausted from selectB.\r\n**\r\n** The implementation of the latter five subroutines depend on which \r\n** <operator> is used:\r\n**\r\n**\r\n**             UNION ALL         UNION            EXCEPT          INTERSECT\r\n**          -------------  -----------------  --------------  -----------------\r\n**   AltB:   outA, nextA      outA, nextA       outA, nextA         nextA\r\n**\r\n**   AeqB:   outA, nextA         nextA             nextA         outA, nextA\r\n**\r\n**   AgtB:   outB, nextB      outB, nextB          nextB            nextB\r\n**\r\n**   EofA:   outB, nextB      outB, nextB          halt             halt\r\n**\r\n**   EofB:   outA, nextA      outA, nextA       outA, nextA         halt\r\n**\r\n** In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA\r\n** causes an immediate jump to EofA and an EOF on B following nextB causes\r\n** an immediate jump to EofB.  Within EofA and EofB, and EOF on entry or\r\n** following nextX causes a jump to the end of the select processing.\r\n**\r\n** Duplicate removal in the UNION, EXCEPT, and INTERSECT cases is handled\r\n** within the output subroutine.  The regPrev register set holds the previously\r\n** output value.  A comparison is made against this value and the output\r\n** is skipped if the next results would be the same as the previous.\r\n**\r\n** The implementation plan is to implement the two coroutines and seven\r\n** subroutines first, then put the control logic at the bottom.  Like this:\r\n**\r\n**          goto Init\r\n**     coA: coroutine for left query (A)\r\n**     coB: coroutine for right query (B)\r\n**    outA: output one row of A\r\n**    outB: output one row of B (UNION and UNION ALL only)\r\n**    EofA: ...\r\n**    EofB: ...\r\n**    AltB: ...\r\n**    AeqB: ...\r\n**    AgtB: ...\r\n**    Init: initialize coroutine registers\r\n**          yield coA\r\n**          if eof(A) goto EofA\r\n**          yield coB\r\n**          if eof(B) goto EofB\r\n**    Cmpr: Compare A, B\r\n**          Jump AltB, AeqB, AgtB\r\n**     End: ...\r\n**\r\n** We call AltB, AeqB, AgtB, EofA, and EofB \"subroutines\" but they are not\r\n** actually called using Gosub and they do not Return.  EofA and EofB loop\r\n** until all data is exhausted then jump to the \"end\" labe.  AltB, AeqB,\r\n** and AgtB jump to either L2 or to one of EofA or EofB.\r\n*/\r\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\r\nstatic int multiSelectOrderBy(\r\n  Parse *pParse,        /* Parsing context */\r\n  Select *p,            /* The right-most of SELECTs to be coded */\r\n  SelectDest *pDest     /* What to do with query results */\r\n){\r\n  int i, j;             /* Loop counters */\r\n  Select *pPrior;       /* Another SELECT immediately to our left */\r\n  Vdbe *v;              /* Generate code to this VDBE */\r\n  SelectDest destA;     /* Destination for coroutine A */\r\n  SelectDest destB;     /* Destination for coroutine B */\r\n  int regAddrA;         /* Address register for select-A coroutine */\r\n  int regEofA;          /* Flag to indicate when select-A is complete */\r\n  int regAddrB;         /* Address register for select-B coroutine */\r\n  int regEofB;          /* Flag to indicate when select-B is complete */\r\n  int addrSelectA;      /* Address of the select-A coroutine */\r\n  int addrSelectB;      /* Address of the select-B coroutine */\r\n  int regOutA;          /* Address register for the output-A subroutine */\r\n  int regOutB;          /* Address register for the output-B subroutine */\r\n  int addrOutA;         /* Address of the output-A subroutine */\r\n  int addrOutB = 0;     /* Address of the output-B subroutine */\r\n  int addrEofA;         /* Address of the select-A-exhausted subroutine */\r\n  int addrEofB;         /* Address of the select-B-exhausted subroutine */\r\n  int addrAltB;         /* Address of the A<B subroutine */\r\n  int addrAeqB;         /* Address of the A==B subroutine */\r\n  int addrAgtB;         /* Address of the A>B subroutine */\r\n  int regLimitA;        /* Limit register for select-A */\r\n  int regLimitB;        /* Limit register for select-A */\r\n  int regPrev;          /* A range of registers to hold previous output */\r\n  int savedLimit;       /* Saved value of p->iLimit */\r\n  int savedOffset;      /* Saved value of p->iOffset */\r\n  int labelCmpr;        /* Label for the start of the merge algorithm */\r\n  int labelEnd;         /* Label for the end of the overall SELECT stmt */\r\n  int j1;               /* Jump instructions that get retargetted */\r\n  int op;               /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */\r\n  KeyInfo *pKeyDup = 0; /* Comparison information for duplicate removal */\r\n  KeyInfo *pKeyMerge;   /* Comparison information for merging rows */\r\n  sqlite3 *db;          /* Database connection */\r\n  ExprList *pOrderBy;   /* The ORDER BY clause */\r\n  int nOrderBy;         /* Number of terms in the ORDER BY clause */\r\n  int *aPermute;        /* Mapping from ORDER BY terms to result set columns */\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  int iSub1;            /* EQP id of left-hand query */\r\n  int iSub2;            /* EQP id of right-hand query */\r\n#endif\r\n\r\n  assert( p->pOrderBy!=0 );\r\n  assert( pKeyDup==0 ); /* \"Managed\" code needs this.  Ticket #3382. */\r\n  db = pParse->db;\r\n  v = pParse->pVdbe;\r\n  assert( v!=0 );       /* Already thrown the error if VDBE alloc failed */\r\n  labelEnd = sqlite3VdbeMakeLabel(v);\r\n  labelCmpr = sqlite3VdbeMakeLabel(v);\r\n\r\n\r\n  /* Patch up the ORDER BY clause\r\n  */\r\n  op = p->op;  \r\n  pPrior = p->pPrior;\r\n  assert( pPrior->pOrderBy==0 );\r\n  pOrderBy = p->pOrderBy;\r\n  assert( pOrderBy );\r\n  nOrderBy = pOrderBy->nExpr;\r\n\r\n  /* For operators other than UNION ALL we have to make sure that\r\n  ** the ORDER BY clause covers every term of the result set.  Add\r\n  ** terms to the ORDER BY clause as necessary.\r\n  */\r\n  if( op!=TK_ALL ){\r\n    for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){\r\n      struct ExprList_item *pItem;\r\n      for(j=0, pItem=pOrderBy->a; j<nOrderBy; j++, pItem++){\r\n        assert( pItem->iOrderByCol>0 );\r\n        if( pItem->iOrderByCol==i ) break;\r\n      }\r\n      if( j==nOrderBy ){\r\n        Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);\r\n        if( pNew==0 ) return SQLITE_NOMEM;\r\n        pNew->flags |= EP_IntValue;\r\n        pNew->u.iValue = i;\r\n        pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);\r\n        if( pOrderBy ) pOrderBy->a[nOrderBy++].iOrderByCol = (u16)i;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Compute the comparison permutation and keyinfo that is used with\r\n  ** the permutation used to determine if the next\r\n  ** row of results comes from selectA or selectB.  Also add explicit\r\n  ** collations to the ORDER BY clause terms so that when the subqueries\r\n  ** to the right and the left are evaluated, they use the correct\r\n  ** collation.\r\n  */\r\n  aPermute = sqlite3DbMallocRaw(db, sizeof(int)*nOrderBy);\r\n  if( aPermute ){\r\n    struct ExprList_item *pItem;\r\n    for(i=0, pItem=pOrderBy->a; i<nOrderBy; i++, pItem++){\r\n      assert( pItem->iOrderByCol>0  && pItem->iOrderByCol<=p->pEList->nExpr );\r\n      aPermute[i] = pItem->iOrderByCol - 1;\r\n    }\r\n    pKeyMerge =\r\n      sqlite3DbMallocRaw(db, sizeof(*pKeyMerge)+nOrderBy*(sizeof(CollSeq*)+1));\r\n    if( pKeyMerge ){\r\n      pKeyMerge->aSortOrder = (u8*)&pKeyMerge->aColl[nOrderBy];\r\n      pKeyMerge->nField = (u16)nOrderBy;\r\n      pKeyMerge->enc = ENC(db);\r\n      for(i=0; i<nOrderBy; i++){\r\n        CollSeq *pColl;\r\n        Expr *pTerm = pOrderBy->a[i].pExpr;\r\n        if( pTerm->flags & EP_ExpCollate ){\r\n          pColl = pTerm->pColl;\r\n        }else{\r\n          pColl = multiSelectCollSeq(pParse, p, aPermute[i]);\r\n          pTerm->flags |= EP_ExpCollate;\r\n          pTerm->pColl = pColl;\r\n        }\r\n        pKeyMerge->aColl[i] = pColl;\r\n        pKeyMerge->aSortOrder[i] = pOrderBy->a[i].sortOrder;\r\n      }\r\n    }\r\n  }else{\r\n    pKeyMerge = 0;\r\n  }\r\n\r\n  /* Reattach the ORDER BY clause to the query.\r\n  */\r\n  p->pOrderBy = pOrderBy;\r\n  pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);\r\n\r\n  /* Allocate a range of temporary registers and the KeyInfo needed\r\n  ** for the logic that removes duplicate result rows when the\r\n  ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL).\r\n  */\r\n  if( op==TK_ALL ){\r\n    regPrev = 0;\r\n  }else{\r\n    int nExpr = p->pEList->nExpr;\r\n    assert( nOrderBy>=nExpr || db->mallocFailed );\r\n    regPrev = sqlite3GetTempRange(pParse, nExpr+1);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev);\r\n    pKeyDup = sqlite3DbMallocZero(db,\r\n                  sizeof(*pKeyDup) + nExpr*(sizeof(CollSeq*)+1) );\r\n    if( pKeyDup ){\r\n      pKeyDup->aSortOrder = (u8*)&pKeyDup->aColl[nExpr];\r\n      pKeyDup->nField = (u16)nExpr;\r\n      pKeyDup->enc = ENC(db);\r\n      for(i=0; i<nExpr; i++){\r\n        pKeyDup->aColl[i] = multiSelectCollSeq(pParse, p, i);\r\n        pKeyDup->aSortOrder[i] = 0;\r\n      }\r\n    }\r\n  }\r\n \r\n  /* Separate the left and the right query from one another\r\n  */\r\n  p->pPrior = 0;\r\n  sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, \"ORDER\");\r\n  if( pPrior->pPrior==0 ){\r\n    sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, \"ORDER\");\r\n  }\r\n\r\n  /* Compute the limit registers */\r\n  computeLimitRegisters(pParse, p, labelEnd);\r\n  if( p->iLimit && op==TK_ALL ){\r\n    regLimitA = ++pParse->nMem;\r\n    regLimitB = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit,\r\n                                  regLimitA);\r\n    sqlite3VdbeAddOp2(v, OP_Copy, regLimitA, regLimitB);\r\n  }else{\r\n    regLimitA = regLimitB = 0;\r\n  }\r\n  sqlite3ExprDelete(db, p->pLimit);\r\n  p->pLimit = 0;\r\n  sqlite3ExprDelete(db, p->pOffset);\r\n  p->pOffset = 0;\r\n\r\n  regAddrA = ++pParse->nMem;\r\n  regEofA = ++pParse->nMem;\r\n  regAddrB = ++pParse->nMem;\r\n  regEofB = ++pParse->nMem;\r\n  regOutA = ++pParse->nMem;\r\n  regOutB = ++pParse->nMem;\r\n  sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA);\r\n  sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB);\r\n\r\n  /* Jump past the various subroutines and coroutines to the main\r\n  ** merge loop\r\n  */\r\n  j1 = sqlite3VdbeAddOp0(v, OP_Goto);\r\n  addrSelectA = sqlite3VdbeCurrentAddr(v);\r\n\r\n\r\n  /* Generate a coroutine to evaluate the SELECT statement to the\r\n  ** left of the compound operator - the \"A\" select.\r\n  */\r\n  VdbeNoopComment((v, \"Begin coroutine for left SELECT\"));\r\n  pPrior->iLimit = regLimitA;\r\n  explainSetInteger(iSub1, pParse->iNextSelectId);\r\n  sqlite3Select(pParse, pPrior, &destA);\r\n  sqlite3VdbeAddOp2(v, OP_Integer, 1, regEofA);\r\n  sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);\r\n  VdbeNoopComment((v, \"End coroutine for left SELECT\"));\r\n\r\n  /* Generate a coroutine to evaluate the SELECT statement on \r\n  ** the right - the \"B\" select\r\n  */\r\n  addrSelectB = sqlite3VdbeCurrentAddr(v);\r\n  VdbeNoopComment((v, \"Begin coroutine for right SELECT\"));\r\n  savedLimit = p->iLimit;\r\n  savedOffset = p->iOffset;\r\n  p->iLimit = regLimitB;\r\n  p->iOffset = 0;  \r\n  explainSetInteger(iSub2, pParse->iNextSelectId);\r\n  sqlite3Select(pParse, p, &destB);\r\n  p->iLimit = savedLimit;\r\n  p->iOffset = savedOffset;\r\n  sqlite3VdbeAddOp2(v, OP_Integer, 1, regEofB);\r\n  sqlite3VdbeAddOp1(v, OP_Yield, regAddrB);\r\n  VdbeNoopComment((v, \"End coroutine for right SELECT\"));\r\n\r\n  /* Generate a subroutine that outputs the current row of the A\r\n  ** select as the next output row of the compound select.\r\n  */\r\n  VdbeNoopComment((v, \"Output routine for A\"));\r\n  addrOutA = generateOutputSubroutine(pParse,\r\n                 p, &destA, pDest, regOutA,\r\n                 regPrev, pKeyDup, P4_KEYINFO_HANDOFF, labelEnd);\r\n  \r\n  /* Generate a subroutine that outputs the current row of the B\r\n  ** select as the next output row of the compound select.\r\n  */\r\n  if( op==TK_ALL || op==TK_UNION ){\r\n    VdbeNoopComment((v, \"Output routine for B\"));\r\n    addrOutB = generateOutputSubroutine(pParse,\r\n                 p, &destB, pDest, regOutB,\r\n                 regPrev, pKeyDup, P4_KEYINFO_STATIC, labelEnd);\r\n  }\r\n\r\n  /* Generate a subroutine to run when the results from select A\r\n  ** are exhausted and only data in select B remains.\r\n  */\r\n  VdbeNoopComment((v, \"eof-A subroutine\"));\r\n  if( op==TK_EXCEPT || op==TK_INTERSECT ){\r\n    addrEofA = sqlite3VdbeAddOp2(v, OP_Goto, 0, labelEnd);\r\n  }else{  \r\n    addrEofA = sqlite3VdbeAddOp2(v, OP_If, regEofB, labelEnd);\r\n    sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB);\r\n    sqlite3VdbeAddOp1(v, OP_Yield, regAddrB);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEofA);\r\n    p->nSelectRow += pPrior->nSelectRow;\r\n  }\r\n\r\n  /* Generate a subroutine to run when the results from select B\r\n  ** are exhausted and only data in select A remains.\r\n  */\r\n  if( op==TK_INTERSECT ){\r\n    addrEofB = addrEofA;\r\n    if( p->nSelectRow > pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow;\r\n  }else{  \r\n    VdbeNoopComment((v, \"eof-B subroutine\"));\r\n    addrEofB = sqlite3VdbeAddOp2(v, OP_If, regEofA, labelEnd);\r\n    sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA);\r\n    sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEofB);\r\n  }\r\n\r\n  /* Generate code to handle the case of A<B\r\n  */\r\n  VdbeNoopComment((v, \"A-lt-B subroutine\"));\r\n  addrAltB = sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA);\r\n  sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);\r\n  sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA);\r\n  sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr);\r\n\r\n  /* Generate code to handle the case of A==B\r\n  */\r\n  if( op==TK_ALL ){\r\n    addrAeqB = addrAltB;\r\n  }else if( op==TK_INTERSECT ){\r\n    addrAeqB = addrAltB;\r\n    addrAltB++;\r\n  }else{\r\n    VdbeNoopComment((v, \"A-eq-B subroutine\"));\r\n    addrAeqB =\r\n    sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);\r\n    sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA);\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr);\r\n  }\r\n\r\n  /* Generate code to handle the case of A>B\r\n  */\r\n  VdbeNoopComment((v, \"A-gt-B subroutine\"));\r\n  addrAgtB = sqlite3VdbeCurrentAddr(v);\r\n  if( op==TK_ALL || op==TK_UNION ){\r\n    sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB);\r\n  }\r\n  sqlite3VdbeAddOp1(v, OP_Yield, regAddrB);\r\n  sqlite3VdbeAddOp2(v, OP_If, regEofB, addrEofB);\r\n  sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr);\r\n\r\n  /* This code runs once to initialize everything.\r\n  */\r\n  sqlite3VdbeJumpHere(v, j1);\r\n  sqlite3VdbeAddOp2(v, OP_Integer, 0, regEofA);\r\n  sqlite3VdbeAddOp2(v, OP_Integer, 0, regEofB);\r\n  sqlite3VdbeAddOp2(v, OP_Gosub, regAddrA, addrSelectA);\r\n  sqlite3VdbeAddOp2(v, OP_Gosub, regAddrB, addrSelectB);\r\n  sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA);\r\n  sqlite3VdbeAddOp2(v, OP_If, regEofB, addrEofB);\r\n\r\n  /* Implement the main merge loop\r\n  */\r\n  sqlite3VdbeResolveLabel(v, labelCmpr);\r\n  sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY);\r\n  sqlite3VdbeAddOp4(v, OP_Compare, destA.iMem, destB.iMem, nOrderBy,\r\n                         (char*)pKeyMerge, P4_KEYINFO_HANDOFF);\r\n  sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB);\r\n\r\n  /* Release temporary registers\r\n  */\r\n  if( regPrev ){\r\n    sqlite3ReleaseTempRange(pParse, regPrev, nOrderBy+1);\r\n  }\r\n\r\n  /* Jump to the this point in order to terminate the query.\r\n  */\r\n  sqlite3VdbeResolveLabel(v, labelEnd);\r\n\r\n  /* Set the number of output columns\r\n  */\r\n  if( pDest->eDest==SRT_Output ){\r\n    Select *pFirst = pPrior;\r\n    while( pFirst->pPrior ) pFirst = pFirst->pPrior;\r\n    generateColumnNames(pParse, 0, pFirst->pEList);\r\n  }\r\n\r\n  /* Reassembly the compound query so that it will be freed correctly\r\n  ** by the calling function */\r\n  if( p->pPrior ){\r\n    sqlite3SelectDelete(db, p->pPrior);\r\n  }\r\n  p->pPrior = pPrior;\r\n\r\n  /*** TBD:  Insert subroutine calls to close cursors on incomplete\r\n  **** subqueries ****/\r\n  explainComposite(pParse, p->op, iSub1, iSub2, 0);\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\r\n/* Forward Declarations */\r\nstatic void substExprList(sqlite3*, ExprList*, int, ExprList*);\r\nstatic void substSelect(sqlite3*, Select *, int, ExprList *);\r\n\r\n/*\r\n** Scan through the expression pExpr.  Replace every reference to\r\n** a column in table number iTable with a copy of the iColumn-th\r\n** entry in pEList.  (But leave references to the ROWID column \r\n** unchanged.)\r\n**\r\n** This routine is part of the flattening procedure.  A subquery\r\n** whose result set is defined by pEList appears as entry in the\r\n** FROM clause of a SELECT such that the VDBE cursor assigned to that\r\n** FORM clause entry is iTable.  This routine make the necessary \r\n** changes to pExpr so that it refers directly to the source table\r\n** of the subquery rather the result set of the subquery.\r\n*/\r\nstatic Expr *substExpr(\r\n  sqlite3 *db,        /* Report malloc errors to this connection */\r\n  Expr *pExpr,        /* Expr in which substitution occurs */\r\n  int iTable,         /* Table to be substituted */\r\n  ExprList *pEList    /* Substitute expressions */\r\n){\r\n  if( pExpr==0 ) return 0;\r\n  if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){\r\n    if( pExpr->iColumn<0 ){\r\n      pExpr->op = TK_NULL;\r\n    }else{\r\n      Expr *pNew;\r\n      assert( pEList!=0 && pExpr->iColumn<pEList->nExpr );\r\n      assert( pExpr->pLeft==0 && pExpr->pRight==0 );\r\n      pNew = sqlite3ExprDup(db, pEList->a[pExpr->iColumn].pExpr, 0);\r\n      if( pNew && pExpr->pColl ){\r\n        pNew->pColl = pExpr->pColl;\r\n      }\r\n      sqlite3ExprDelete(db, pExpr);\r\n      pExpr = pNew;\r\n    }\r\n  }else{\r\n    pExpr->pLeft = substExpr(db, pExpr->pLeft, iTable, pEList);\r\n    pExpr->pRight = substExpr(db, pExpr->pRight, iTable, pEList);\r\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n      substSelect(db, pExpr->x.pSelect, iTable, pEList);\r\n    }else{\r\n      substExprList(db, pExpr->x.pList, iTable, pEList);\r\n    }\r\n  }\r\n  return pExpr;\r\n}\r\nstatic void substExprList(\r\n  sqlite3 *db,         /* Report malloc errors here */\r\n  ExprList *pList,     /* List to scan and in which to make substitutes */\r\n  int iTable,          /* Table to be substituted */\r\n  ExprList *pEList     /* Substitute values */\r\n){\r\n  int i;\r\n  if( pList==0 ) return;\r\n  for(i=0; i<pList->nExpr; i++){\r\n    pList->a[i].pExpr = substExpr(db, pList->a[i].pExpr, iTable, pEList);\r\n  }\r\n}\r\nstatic void substSelect(\r\n  sqlite3 *db,         /* Report malloc errors here */\r\n  Select *p,           /* SELECT statement in which to make substitutions */\r\n  int iTable,          /* Table to be replaced */\r\n  ExprList *pEList     /* Substitute values */\r\n){\r\n  SrcList *pSrc;\r\n  struct SrcList_item *pItem;\r\n  int i;\r\n  if( !p ) return;\r\n  substExprList(db, p->pEList, iTable, pEList);\r\n  substExprList(db, p->pGroupBy, iTable, pEList);\r\n  substExprList(db, p->pOrderBy, iTable, pEList);\r\n  p->pHaving = substExpr(db, p->pHaving, iTable, pEList);\r\n  p->pWhere = substExpr(db, p->pWhere, iTable, pEList);\r\n  substSelect(db, p->pPrior, iTable, pEList);\r\n  pSrc = p->pSrc;\r\n  assert( pSrc );  /* Even for (SELECT 1) we have: pSrc!=0 but pSrc->nSrc==0 */\r\n  if( ALWAYS(pSrc) ){\r\n    for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){\r\n      substSelect(db, pItem->pSelect, iTable, pEList);\r\n    }\r\n  }\r\n}\r\n#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */\r\n\r\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\r\n/*\r\n** This routine attempts to flatten subqueries as a performance optimization.\r\n** This routine returns 1 if it makes changes and 0 if no flattening occurs.\r\n**\r\n** To understand the concept of flattening, consider the following\r\n** query:\r\n**\r\n**     SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5\r\n**\r\n** The default way of implementing this query is to execute the\r\n** subquery first and store the results in a temporary table, then\r\n** run the outer query on that temporary table.  This requires two\r\n** passes over the data.  Furthermore, because the temporary table\r\n** has no indices, the WHERE clause on the outer query cannot be\r\n** optimized.\r\n**\r\n** This routine attempts to rewrite queries such as the above into\r\n** a single flat select, like this:\r\n**\r\n**     SELECT x+y AS a FROM t1 WHERE z<100 AND a>5\r\n**\r\n** The code generated for this simpification gives the same result\r\n** but only has to scan the data once.  And because indices might \r\n** exist on the table t1, a complete scan of the data might be\r\n** avoided.\r\n**\r\n** Flattening is only attempted if all of the following are true:\r\n**\r\n**   (1)  The subquery and the outer query do not both use aggregates.\r\n**\r\n**   (2)  The subquery is not an aggregate or the outer query is not a join.\r\n**\r\n**   (3)  The subquery is not the right operand of a left outer join\r\n**        (Originally ticket #306.  Strengthened by ticket #3300)\r\n**\r\n**   (4)  The subquery is not DISTINCT.\r\n**\r\n**  (**)  At one point restrictions (4) and (5) defined a subset of DISTINCT\r\n**        sub-queries that were excluded from this optimization. Restriction \r\n**        (4) has since been expanded to exclude all DISTINCT subqueries.\r\n**\r\n**   (6)  The subquery does not use aggregates or the outer query is not\r\n**        DISTINCT.\r\n**\r\n**   (7)  The subquery has a FROM clause.  TODO:  For subqueries without\r\n**        A FROM clause, consider adding a FROM close with the special\r\n**        table sqlite_once that consists of a single row containing a\r\n**        single NULL.\r\n**\r\n**   (8)  The subquery does not use LIMIT or the outer query is not a join.\r\n**\r\n**   (9)  The subquery does not use LIMIT or the outer query does not use\r\n**        aggregates.\r\n**\r\n**  (10)  The subquery does not use aggregates or the outer query does not\r\n**        use LIMIT.\r\n**\r\n**  (11)  The subquery and the outer query do not both have ORDER BY clauses.\r\n**\r\n**  (**)  Not implemented.  Subsumed into restriction (3).  Was previously\r\n**        a separate restriction deriving from ticket #350.\r\n**\r\n**  (13)  The subquery and outer query do not both use LIMIT.\r\n**\r\n**  (14)  The subquery does not use OFFSET.\r\n**\r\n**  (15)  The outer query is not part of a compound select or the\r\n**        subquery does not have a LIMIT clause.\r\n**        (See ticket #2339 and ticket [02a8e81d44]).\r\n**\r\n**  (16)  The outer query is not an aggregate or the subquery does\r\n**        not contain ORDER BY.  (Ticket #2942)  This used to not matter\r\n**        until we introduced the group_concat() function.  \r\n**\r\n**  (17)  The sub-query is not a compound select, or it is a UNION ALL \r\n**        compound clause made up entirely of non-aggregate queries, and \r\n**        the parent query:\r\n**\r\n**          * is not itself part of a compound select,\r\n**          * is not an aggregate or DISTINCT query, and\r\n**          * is not a join\r\n**\r\n**        The parent and sub-query may contain WHERE clauses. Subject to\r\n**        rules (11), (13) and (14), they may also contain ORDER BY,\r\n**        LIMIT and OFFSET clauses.  The subquery cannot use any compound\r\n**        operator other than UNION ALL because all the other compound\r\n**        operators have an implied DISTINCT which is disallowed by\r\n**        restriction (4).\r\n**\r\n**  (18)  If the sub-query is a compound select, then all terms of the\r\n**        ORDER by clause of the parent must be simple references to \r\n**        columns of the sub-query.\r\n**\r\n**  (19)  The subquery does not use LIMIT or the outer query does not\r\n**        have a WHERE clause.\r\n**\r\n**  (20)  If the sub-query is a compound select, then it must not use\r\n**        an ORDER BY clause.  Ticket #3773.  We could relax this constraint\r\n**        somewhat by saying that the terms of the ORDER BY clause must\r\n**        appear as unmodified result columns in the outer query.  But we\r\n**        have other optimizations in mind to deal with that case.\r\n**\r\n**  (21)  The subquery does not use LIMIT or the outer query is not\r\n**        DISTINCT.  (See ticket [752e1646fc]).\r\n**\r\n** In this routine, the \"p\" parameter is a pointer to the outer query.\r\n** The subquery is p->pSrc->a[iFrom].  isAgg is true if the outer query\r\n** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates.\r\n**\r\n** If flattening is not attempted, this routine is a no-op and returns 0.\r\n** If flattening is attempted this routine returns 1.\r\n**\r\n** All of the expression analysis must occur on both the outer query and\r\n** the subquery before this routine runs.\r\n*/\r\nstatic int flattenSubquery(\r\n  Parse *pParse,       /* Parsing context */\r\n  Select *p,           /* The parent or outer SELECT statement */\r\n  int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */\r\n  int isAgg,           /* True if outer SELECT uses aggregate functions */\r\n  int subqueryIsAgg    /* True if the subquery uses aggregate functions */\r\n){\r\n  const char *zSavedAuthContext = pParse->zAuthContext;\r\n  Select *pParent;\r\n  Select *pSub;       /* The inner query or \"subquery\" */\r\n  Select *pSub1;      /* Pointer to the rightmost select in sub-query */\r\n  SrcList *pSrc;      /* The FROM clause of the outer query */\r\n  SrcList *pSubSrc;   /* The FROM clause of the subquery */\r\n  ExprList *pList;    /* The result set of the outer query */\r\n  int iParent;        /* VDBE cursor number of the pSub result set temp table */\r\n  int i;              /* Loop counter */\r\n  Expr *pWhere;                    /* The WHERE clause */\r\n  struct SrcList_item *pSubitem;   /* The subquery */\r\n  sqlite3 *db = pParse->db;\r\n\r\n  /* Check to see if flattening is permitted.  Return 0 if not.\r\n  */\r\n  assert( p!=0 );\r\n  assert( p->pPrior==0 );  /* Unable to flatten compound queries */\r\n  if( db->flags & SQLITE_QueryFlattener ) return 0;\r\n  pSrc = p->pSrc;\r\n  assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );\r\n  pSubitem = &pSrc->a[iFrom];\r\n  iParent = pSubitem->iCursor;\r\n  pSub = pSubitem->pSelect;\r\n  assert( pSub!=0 );\r\n  if( isAgg && subqueryIsAgg ) return 0;                 /* Restriction (1)  */\r\n  if( subqueryIsAgg && pSrc->nSrc>1 ) return 0;          /* Restriction (2)  */\r\n  pSubSrc = pSub->pSrc;\r\n  assert( pSubSrc );\r\n  /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,\r\n  ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET\r\n  ** because they could be computed at compile-time.  But when LIMIT and OFFSET\r\n  ** became arbitrary expressions, we were forced to add restrictions (13)\r\n  ** and (14). */\r\n  if( pSub->pLimit && p->pLimit ) return 0;              /* Restriction (13) */\r\n  if( pSub->pOffset ) return 0;                          /* Restriction (14) */\r\n  if( p->pRightmost && pSub->pLimit ){\r\n    return 0;                                            /* Restriction (15) */\r\n  }\r\n  if( pSubSrc->nSrc==0 ) return 0;                       /* Restriction (7)  */\r\n  if( pSub->selFlags & SF_Distinct ) return 0;           /* Restriction (5)  */\r\n  if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){\r\n     return 0;         /* Restrictions (8)(9) */\r\n  }\r\n  if( (p->selFlags & SF_Distinct)!=0 && subqueryIsAgg ){\r\n     return 0;         /* Restriction (6)  */\r\n  }\r\n  if( p->pOrderBy && pSub->pOrderBy ){\r\n     return 0;                                           /* Restriction (11) */\r\n  }\r\n  if( isAgg && pSub->pOrderBy ) return 0;                /* Restriction (16) */\r\n  if( pSub->pLimit && p->pWhere ) return 0;              /* Restriction (19) */\r\n  if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){\r\n     return 0;         /* Restriction (21) */\r\n  }\r\n\r\n  /* OBSOLETE COMMENT 1:\r\n  ** Restriction 3:  If the subquery is a join, make sure the subquery is \r\n  ** not used as the right operand of an outer join.  Examples of why this\r\n  ** is not allowed:\r\n  **\r\n  **         t1 LEFT OUTER JOIN (t2 JOIN t3)\r\n  **\r\n  ** If we flatten the above, we would get\r\n  **\r\n  **         (t1 LEFT OUTER JOIN t2) JOIN t3\r\n  **\r\n  ** which is not at all the same thing.\r\n  **\r\n  ** OBSOLETE COMMENT 2:\r\n  ** Restriction 12:  If the subquery is the right operand of a left outer\r\n  ** join, make sure the subquery has no WHERE clause.\r\n  ** An examples of why this is not allowed:\r\n  **\r\n  **         t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)\r\n  **\r\n  ** If we flatten the above, we would get\r\n  **\r\n  **         (t1 LEFT OUTER JOIN t2) WHERE t2.x>0\r\n  **\r\n  ** But the t2.x>0 test will always fail on a NULL row of t2, which\r\n  ** effectively converts the OUTER JOIN into an INNER JOIN.\r\n  **\r\n  ** THIS OVERRIDES OBSOLETE COMMENTS 1 AND 2 ABOVE:\r\n  ** Ticket #3300 shows that flattening the right term of a LEFT JOIN\r\n  ** is fraught with danger.  Best to avoid the whole thing.  If the\r\n  ** subquery is the right term of a LEFT JOIN, then do not flatten.\r\n  */\r\n  if( (pSubitem->jointype & JT_OUTER)!=0 ){\r\n    return 0;\r\n  }\r\n\r\n  /* Restriction 17: If the sub-query is a compound SELECT, then it must\r\n  ** use only the UNION ALL operator. And none of the simple select queries\r\n  ** that make up the compound SELECT are allowed to be aggregate or distinct\r\n  ** queries.\r\n  */\r\n  if( pSub->pPrior ){\r\n    if( pSub->pOrderBy ){\r\n      return 0;  /* Restriction 20 */\r\n    }\r\n    if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){\r\n      return 0;\r\n    }\r\n    for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){\r\n      testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\r\n      testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\r\n      assert( pSub->pSrc!=0 );\r\n      if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0\r\n       || (pSub1->pPrior && pSub1->op!=TK_ALL) \r\n       || pSub1->pSrc->nSrc<1\r\n      ){\r\n        return 0;\r\n      }\r\n      testcase( pSub1->pSrc->nSrc>1 );\r\n    }\r\n\r\n    /* Restriction 18. */\r\n    if( p->pOrderBy ){\r\n      int ii;\r\n      for(ii=0; ii<p->pOrderBy->nExpr; ii++){\r\n        if( p->pOrderBy->a[ii].iOrderByCol==0 ) return 0;\r\n      }\r\n    }\r\n  }\r\n\r\n  /***** If we reach this point, flattening is permitted. *****/\r\n\r\n  /* Authorize the subquery */\r\n  pParse->zAuthContext = pSubitem->zName;\r\n  sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);\r\n  pParse->zAuthContext = zSavedAuthContext;\r\n\r\n  /* If the sub-query is a compound SELECT statement, then (by restrictions\r\n  ** 17 and 18 above) it must be a UNION ALL and the parent query must \r\n  ** be of the form:\r\n  **\r\n  **     SELECT <expr-list> FROM (<sub-query>) <where-clause> \r\n  **\r\n  ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block\r\n  ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or \r\n  ** OFFSET clauses and joins them to the left-hand-side of the original\r\n  ** using UNION ALL operators. In this case N is the number of simple\r\n  ** select statements in the compound sub-query.\r\n  **\r\n  ** Example:\r\n  **\r\n  **     SELECT a+1 FROM (\r\n  **        SELECT x FROM tab\r\n  **        UNION ALL\r\n  **        SELECT y FROM tab\r\n  **        UNION ALL\r\n  **        SELECT abs(z*2) FROM tab2\r\n  **     ) WHERE a!=5 ORDER BY 1\r\n  **\r\n  ** Transformed into:\r\n  **\r\n  **     SELECT x+1 FROM tab WHERE x+1!=5\r\n  **     UNION ALL\r\n  **     SELECT y+1 FROM tab WHERE y+1!=5\r\n  **     UNION ALL\r\n  **     SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5\r\n  **     ORDER BY 1\r\n  **\r\n  ** We call this the \"compound-subquery flattening\".\r\n  */\r\n  for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){\r\n    Select *pNew;\r\n    ExprList *pOrderBy = p->pOrderBy;\r\n    Expr *pLimit = p->pLimit;\r\n    Select *pPrior = p->pPrior;\r\n    p->pOrderBy = 0;\r\n    p->pSrc = 0;\r\n    p->pPrior = 0;\r\n    p->pLimit = 0;\r\n    pNew = sqlite3SelectDup(db, p, 0);\r\n    p->pLimit = pLimit;\r\n    p->pOrderBy = pOrderBy;\r\n    p->pSrc = pSrc;\r\n    p->op = TK_ALL;\r\n    p->pRightmost = 0;\r\n    if( pNew==0 ){\r\n      pNew = pPrior;\r\n    }else{\r\n      pNew->pPrior = pPrior;\r\n      pNew->pRightmost = 0;\r\n    }\r\n    p->pPrior = pNew;\r\n    if( db->mallocFailed ) return 1;\r\n  }\r\n\r\n  /* Begin flattening the iFrom-th entry of the FROM clause \r\n  ** in the outer query.\r\n  */\r\n  pSub = pSub1 = pSubitem->pSelect;\r\n\r\n  /* Delete the transient table structure associated with the\r\n  ** subquery\r\n  */\r\n  sqlite3DbFree(db, pSubitem->zDatabase);\r\n  sqlite3DbFree(db, pSubitem->zName);\r\n  sqlite3DbFree(db, pSubitem->zAlias);\r\n  pSubitem->zDatabase = 0;\r\n  pSubitem->zName = 0;\r\n  pSubitem->zAlias = 0;\r\n  pSubitem->pSelect = 0;\r\n\r\n  /* Defer deleting the Table object associated with the\r\n  ** subquery until code generation is\r\n  ** complete, since there may still exist Expr.pTab entries that\r\n  ** refer to the subquery even after flattening.  Ticket #3346.\r\n  **\r\n  ** pSubitem->pTab is always non-NULL by test restrictions and tests above.\r\n  */\r\n  if( ALWAYS(pSubitem->pTab!=0) ){\r\n    Table *pTabToDel = pSubitem->pTab;\r\n    if( pTabToDel->nRef==1 ){\r\n      Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n      pTabToDel->pNextZombie = pToplevel->pZombieTab;\r\n      pToplevel->pZombieTab = pTabToDel;\r\n    }else{\r\n      pTabToDel->nRef--;\r\n    }\r\n    pSubitem->pTab = 0;\r\n  }\r\n\r\n  /* The following loop runs once for each term in a compound-subquery\r\n  ** flattening (as described above).  If we are doing a different kind\r\n  ** of flattening - a flattening other than a compound-subquery flattening -\r\n  ** then this loop only runs once.\r\n  **\r\n  ** This loop moves all of the FROM elements of the subquery into the\r\n  ** the FROM clause of the outer query.  Before doing this, remember\r\n  ** the cursor number for the original outer query FROM element in\r\n  ** iParent.  The iParent cursor will never be used.  Subsequent code\r\n  ** will scan expressions looking for iParent references and replace\r\n  ** those references with expressions that resolve to the subquery FROM\r\n  ** elements we are now copying in.\r\n  */\r\n  for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){\r\n    int nSubSrc;\r\n    u8 jointype = 0;\r\n    pSubSrc = pSub->pSrc;     /* FROM clause of subquery */\r\n    nSubSrc = pSubSrc->nSrc;  /* Number of terms in subquery FROM clause */\r\n    pSrc = pParent->pSrc;     /* FROM clause of the outer query */\r\n\r\n    if( pSrc ){\r\n      assert( pParent==p );  /* First time through the loop */\r\n      jointype = pSubitem->jointype;\r\n    }else{\r\n      assert( pParent!=p );  /* 2nd and subsequent times through the loop */\r\n      pSrc = pParent->pSrc = sqlite3SrcListAppend(db, 0, 0, 0);\r\n      if( pSrc==0 ){\r\n        assert( db->mallocFailed );\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* The subquery uses a single slot of the FROM clause of the outer\r\n    ** query.  If the subquery has more than one element in its FROM clause,\r\n    ** then expand the outer query to make space for it to hold all elements\r\n    ** of the subquery.\r\n    **\r\n    ** Example:\r\n    **\r\n    **    SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;\r\n    **\r\n    ** The outer query has 3 slots in its FROM clause.  One slot of the\r\n    ** outer query (the middle slot) is used by the subquery.  The next\r\n    ** block of code will expand the out query to 4 slots.  The middle\r\n    ** slot is expanded to two slots in order to make space for the\r\n    ** two elements in the FROM clause of the subquery.\r\n    */\r\n    if( nSubSrc>1 ){\r\n      pParent->pSrc = pSrc = sqlite3SrcListEnlarge(db, pSrc, nSubSrc-1,iFrom+1);\r\n      if( db->mallocFailed ){\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* Transfer the FROM clause terms from the subquery into the\r\n    ** outer query.\r\n    */\r\n    for(i=0; i<nSubSrc; i++){\r\n      sqlite3IdListDelete(db, pSrc->a[i+iFrom].pUsing);\r\n      pSrc->a[i+iFrom] = pSubSrc->a[i];\r\n      memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));\r\n    }\r\n    pSrc->a[iFrom].jointype = jointype;\r\n  \r\n    /* Now begin substituting subquery result set expressions for \r\n    ** references to the iParent in the outer query.\r\n    ** \r\n    ** Example:\r\n    **\r\n    **   SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;\r\n    **   \\                     \\_____________ subquery __________/          /\r\n    **    \\_____________________ outer query ______________________________/\r\n    **\r\n    ** We look at every expression in the outer query and every place we see\r\n    ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\".\r\n    */\r\n    pList = pParent->pEList;\r\n    for(i=0; i<pList->nExpr; i++){\r\n      if( pList->a[i].zName==0 ){\r\n        const char *zSpan = pList->a[i].zSpan;\r\n        if( ALWAYS(zSpan) ){\r\n          pList->a[i].zName = sqlite3DbStrDup(db, zSpan);\r\n        }\r\n      }\r\n    }\r\n    substExprList(db, pParent->pEList, iParent, pSub->pEList);\r\n    if( isAgg ){\r\n      substExprList(db, pParent->pGroupBy, iParent, pSub->pEList);\r\n      pParent->pHaving = substExpr(db, pParent->pHaving, iParent, pSub->pEList);\r\n    }\r\n    if( pSub->pOrderBy ){\r\n      assert( pParent->pOrderBy==0 );\r\n      pParent->pOrderBy = pSub->pOrderBy;\r\n      pSub->pOrderBy = 0;\r\n    }else if( pParent->pOrderBy ){\r\n      substExprList(db, pParent->pOrderBy, iParent, pSub->pEList);\r\n    }\r\n    if( pSub->pWhere ){\r\n      pWhere = sqlite3ExprDup(db, pSub->pWhere, 0);\r\n    }else{\r\n      pWhere = 0;\r\n    }\r\n    if( subqueryIsAgg ){\r\n      assert( pParent->pHaving==0 );\r\n      pParent->pHaving = pParent->pWhere;\r\n      pParent->pWhere = pWhere;\r\n      pParent->pHaving = substExpr(db, pParent->pHaving, iParent, pSub->pEList);\r\n      pParent->pHaving = sqlite3ExprAnd(db, pParent->pHaving, \r\n                                  sqlite3ExprDup(db, pSub->pHaving, 0));\r\n      assert( pParent->pGroupBy==0 );\r\n      pParent->pGroupBy = sqlite3ExprListDup(db, pSub->pGroupBy, 0);\r\n    }else{\r\n      pParent->pWhere = substExpr(db, pParent->pWhere, iParent, pSub->pEList);\r\n      pParent->pWhere = sqlite3ExprAnd(db, pParent->pWhere, pWhere);\r\n    }\r\n  \r\n    /* The flattened query is distinct if either the inner or the\r\n    ** outer query is distinct. \r\n    */\r\n    pParent->selFlags |= pSub->selFlags & SF_Distinct;\r\n  \r\n    /*\r\n    ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;\r\n    **\r\n    ** One is tempted to try to add a and b to combine the limits.  But this\r\n    ** does not work if either limit is negative.\r\n    */\r\n    if( pSub->pLimit ){\r\n      pParent->pLimit = pSub->pLimit;\r\n      pSub->pLimit = 0;\r\n    }\r\n  }\r\n\r\n  /* Finially, delete what is left of the subquery and return\r\n  ** success.\r\n  */\r\n  sqlite3SelectDelete(db, pSub1);\r\n\r\n  return 1;\r\n}\r\n#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */\r\n\r\n/*\r\n** Analyze the SELECT statement passed as an argument to see if it\r\n** is a min() or max() query. Return WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX if \r\n** it is, or 0 otherwise. At present, a query is considered to be\r\n** a min()/max() query if:\r\n**\r\n**   1. There is a single object in the FROM clause.\r\n**\r\n**   2. There is a single expression in the result set, and it is\r\n**      either min(x) or max(x), where x is a column reference.\r\n*/\r\nstatic u8 minMaxQuery(Select *p){\r\n  Expr *pExpr;\r\n  ExprList *pEList = p->pEList;\r\n\r\n  if( pEList->nExpr!=1 ) return WHERE_ORDERBY_NORMAL;\r\n  pExpr = pEList->a[0].pExpr;\r\n  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;\r\n  if( NEVER(ExprHasProperty(pExpr, EP_xIsSelect)) ) return 0;\r\n  pEList = pExpr->x.pList;\r\n  if( pEList==0 || pEList->nExpr!=1 ) return 0;\r\n  if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL;\r\n  assert( !ExprHasProperty(pExpr, EP_IntValue) );\r\n  if( sqlite3StrICmp(pExpr->u.zToken,\"min\")==0 ){\r\n    return WHERE_ORDERBY_MIN;\r\n  }else if( sqlite3StrICmp(pExpr->u.zToken,\"max\")==0 ){\r\n    return WHERE_ORDERBY_MAX;\r\n  }\r\n  return WHERE_ORDERBY_NORMAL;\r\n}\r\n\r\n/*\r\n** The select statement passed as the first argument is an aggregate query.\r\n** The second argment is the associated aggregate-info object. This \r\n** function tests if the SELECT is of the form:\r\n**\r\n**   SELECT count(*) FROM <tbl>\r\n**\r\n** where table is a database table, not a sub-select or view. If the query\r\n** does match this pattern, then a pointer to the Table object representing\r\n** <tbl> is returned. Otherwise, 0 is returned.\r\n*/\r\nstatic Table *isSimpleCount(Select *p, AggInfo *pAggInfo){\r\n  Table *pTab;\r\n  Expr *pExpr;\r\n\r\n  assert( !p->pGroupBy );\r\n\r\n  if( p->pWhere || p->pEList->nExpr!=1 \r\n   || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect\r\n  ){\r\n    return 0;\r\n  }\r\n  pTab = p->pSrc->a[0].pTab;\r\n  pExpr = p->pEList->a[0].pExpr;\r\n  assert( pTab && !pTab->pSelect && pExpr );\r\n\r\n  if( IsVirtual(pTab) ) return 0;\r\n  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;\r\n  if( (pAggInfo->aFunc[0].pFunc->flags&SQLITE_FUNC_COUNT)==0 ) return 0;\r\n  if( pExpr->flags&EP_Distinct ) return 0;\r\n\r\n  return pTab;\r\n}\r\n\r\n/*\r\n** If the source-list item passed as an argument was augmented with an\r\n** INDEXED BY clause, then try to locate the specified index. If there\r\n** was such a clause and the named index cannot be found, return \r\n** SQLITE_ERROR and leave an error in pParse. Otherwise, populate \r\n** pFrom->pIndex and return SQLITE_OK.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){\r\n  if( pFrom->pTab && pFrom->zIndex ){\r\n    Table *pTab = pFrom->pTab;\r\n    char *zIndex = pFrom->zIndex;\r\n    Index *pIdx;\r\n    for(pIdx=pTab->pIndex; \r\n        pIdx && sqlite3StrICmp(pIdx->zName, zIndex); \r\n        pIdx=pIdx->pNext\r\n    );\r\n    if( !pIdx ){\r\n      sqlite3ErrorMsg(pParse, \"no such index: %s\", zIndex, 0);\r\n      pParse->checkSchema = 1;\r\n      return SQLITE_ERROR;\r\n    }\r\n    pFrom->pIndex = pIdx;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This routine is a Walker callback for \"expanding\" a SELECT statement.\r\n** \"Expanding\" means to do the following:\r\n**\r\n**    (1)  Make sure VDBE cursor numbers have been assigned to every\r\n**         element of the FROM clause.\r\n**\r\n**    (2)  Fill in the pTabList->a[].pTab fields in the SrcList that \r\n**         defines FROM clause.  When views appear in the FROM clause,\r\n**         fill pTabList->a[].pSelect with a copy of the SELECT statement\r\n**         that implements the view.  A copy is made of the view's SELECT\r\n**         statement so that we can freely modify or delete that statement\r\n**         without worrying about messing up the presistent representation\r\n**         of the view.\r\n**\r\n**    (3)  Add terms to the WHERE clause to accomodate the NATURAL keyword\r\n**         on joins and the ON and USING clause of joins.\r\n**\r\n**    (4)  Scan the list of columns in the result set (pEList) looking\r\n**         for instances of the \"*\" operator or the TABLE.* operator.\r\n**         If found, expand each \"*\" to be every column in every table\r\n**         and TABLE.* to be every column in TABLE.\r\n**\r\n*/\r\nstatic int selectExpander(Walker *pWalker, Select *p){\r\n  Parse *pParse = pWalker->pParse;\r\n  int i, j, k;\r\n  SrcList *pTabList;\r\n  ExprList *pEList;\r\n  struct SrcList_item *pFrom;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  if( db->mallocFailed  ){\r\n    return WRC_Abort;\r\n  }\r\n  if( NEVER(p->pSrc==0) || (p->selFlags & SF_Expanded)!=0 ){\r\n    return WRC_Prune;\r\n  }\r\n  p->selFlags |= SF_Expanded;\r\n  pTabList = p->pSrc;\r\n  pEList = p->pEList;\r\n\r\n  /* Make sure cursor numbers have been assigned to all entries in\r\n  ** the FROM clause of the SELECT statement.\r\n  */\r\n  sqlite3SrcListAssignCursors(pParse, pTabList);\r\n\r\n  /* Look up every table named in the FROM clause of the select.  If\r\n  ** an entry of the FROM clause is a subquery instead of a table or view,\r\n  ** then create a transient table structure to describe the subquery.\r\n  */\r\n  for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){\r\n    Table *pTab;\r\n    if( pFrom->pTab!=0 ){\r\n      /* This statement has already been prepared.  There is no need\r\n      ** to go further. */\r\n      assert( i==0 );\r\n      return WRC_Prune;\r\n    }\r\n    if( pFrom->zName==0 ){\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n      Select *pSel = pFrom->pSelect;\r\n      /* A sub-query in the FROM clause of a SELECT */\r\n      assert( pSel!=0 );\r\n      assert( pFrom->pTab==0 );\r\n      sqlite3WalkSelect(pWalker, pSel);\r\n      pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));\r\n      if( pTab==0 ) return WRC_Abort;\r\n      pTab->nRef = 1;\r\n      pTab->zName = sqlite3MPrintf(db, \"sqlite_subquery_%p_\", (void*)pTab);\r\n      while( pSel->pPrior ){ pSel = pSel->pPrior; }\r\n      selectColumnsFromExprList(pParse, pSel->pEList, &pTab->nCol, &pTab->aCol);\r\n      pTab->iPKey = -1;\r\n      pTab->nRowEst = 1000000;\r\n      pTab->tabFlags |= TF_Ephemeral;\r\n#endif\r\n    }else{\r\n      /* An ordinary table or view name in the FROM clause */\r\n      assert( pFrom->pTab==0 );\r\n      pFrom->pTab = pTab = \r\n        sqlite3LocateTable(pParse,0,pFrom->zName,pFrom->zDatabase);\r\n      if( pTab==0 ) return WRC_Abort;\r\n      pTab->nRef++;\r\n#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)\r\n      if( pTab->pSelect || IsVirtual(pTab) ){\r\n        /* We reach here if the named table is a really a view */\r\n        if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;\r\n        assert( pFrom->pSelect==0 );\r\n        pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);\r\n        sqlite3WalkSelect(pWalker, pFrom->pSelect);\r\n      }\r\n#endif\r\n    }\r\n\r\n    /* Locate the index named by the INDEXED BY clause, if any. */\r\n    if( sqlite3IndexedByLookup(pParse, pFrom) ){\r\n      return WRC_Abort;\r\n    }\r\n  }\r\n\r\n  /* Process NATURAL keywords, and ON and USING clauses of joins.\r\n  */\r\n  if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){\r\n    return WRC_Abort;\r\n  }\r\n\r\n  /* For every \"*\" that occurs in the column list, insert the names of\r\n  ** all columns in all tables.  And for every TABLE.* insert the names\r\n  ** of all columns in TABLE.  The parser inserted a special expression\r\n  ** with the TK_ALL operator for each \"*\" that it found in the column list.\r\n  ** The following code just has to locate the TK_ALL expressions and expand\r\n  ** each one to the list of all columns in all tables.\r\n  **\r\n  ** The first loop just checks to see if there are any \"*\" operators\r\n  ** that need expanding.\r\n  */\r\n  for(k=0; k<pEList->nExpr; k++){\r\n    Expr *pE = pEList->a[k].pExpr;\r\n    if( pE->op==TK_ALL ) break;\r\n    assert( pE->op!=TK_DOT || pE->pRight!=0 );\r\n    assert( pE->op!=TK_DOT || (pE->pLeft!=0 && pE->pLeft->op==TK_ID) );\r\n    if( pE->op==TK_DOT && pE->pRight->op==TK_ALL ) break;\r\n  }\r\n  if( k<pEList->nExpr ){\r\n    /*\r\n    ** If we get here it means the result set contains one or more \"*\"\r\n    ** operators that need to be expanded.  Loop through each expression\r\n    ** in the result set and expand them one by one.\r\n    */\r\n    struct ExprList_item *a = pEList->a;\r\n    ExprList *pNew = 0;\r\n    int flags = pParse->db->flags;\r\n    int longNames = (flags & SQLITE_FullColNames)!=0\r\n                      && (flags & SQLITE_ShortColNames)==0;\r\n\r\n    for(k=0; k<pEList->nExpr; k++){\r\n      Expr *pE = a[k].pExpr;\r\n      assert( pE->op!=TK_DOT || pE->pRight!=0 );\r\n      if( pE->op!=TK_ALL && (pE->op!=TK_DOT || pE->pRight->op!=TK_ALL) ){\r\n        /* This particular expression does not need to be expanded.\r\n        */\r\n        pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr);\r\n        if( pNew ){\r\n          pNew->a[pNew->nExpr-1].zName = a[k].zName;\r\n          pNew->a[pNew->nExpr-1].zSpan = a[k].zSpan;\r\n          a[k].zName = 0;\r\n          a[k].zSpan = 0;\r\n        }\r\n        a[k].pExpr = 0;\r\n      }else{\r\n        /* This expression is a \"*\" or a \"TABLE.*\" and needs to be\r\n        ** expanded. */\r\n        int tableSeen = 0;      /* Set to 1 when TABLE matches */\r\n        char *zTName;            /* text of name of TABLE */\r\n        if( pE->op==TK_DOT ){\r\n          assert( pE->pLeft!=0 );\r\n          assert( !ExprHasProperty(pE->pLeft, EP_IntValue) );\r\n          zTName = pE->pLeft->u.zToken;\r\n        }else{\r\n          zTName = 0;\r\n        }\r\n        for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){\r\n          Table *pTab = pFrom->pTab;\r\n          char *zTabName = pFrom->zAlias;\r\n          if( zTabName==0 ){\r\n            zTabName = pTab->zName;\r\n          }\r\n          if( db->mallocFailed ) break;\r\n          if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){\r\n            continue;\r\n          }\r\n          tableSeen = 1;\r\n          for(j=0; j<pTab->nCol; j++){\r\n            Expr *pExpr, *pRight;\r\n            char *zName = pTab->aCol[j].zName;\r\n            char *zColname;  /* The computed column name */\r\n            char *zToFree;   /* Malloced string that needs to be freed */\r\n            Token sColname;  /* Computed column name as a token */\r\n\r\n            /* If a column is marked as 'hidden' (currently only possible\r\n            ** for virtual tables), do not include it in the expanded\r\n            ** result-set list.\r\n            */\r\n            if( IsHiddenColumn(&pTab->aCol[j]) ){\r\n              assert(IsVirtual(pTab));\r\n              continue;\r\n            }\r\n\r\n            if( i>0 && zTName==0 ){\r\n              if( (pFrom->jointype & JT_NATURAL)!=0\r\n                && tableAndColumnIndex(pTabList, i, zName, 0, 0)\r\n              ){\r\n                /* In a NATURAL join, omit the join columns from the \r\n                ** table to the right of the join */\r\n                continue;\r\n              }\r\n              if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){\r\n                /* In a join with a USING clause, omit columns in the\r\n                ** using clause from the table on the right. */\r\n                continue;\r\n              }\r\n            }\r\n            pRight = sqlite3Expr(db, TK_ID, zName);\r\n            zColname = zName;\r\n            zToFree = 0;\r\n            if( longNames || pTabList->nSrc>1 ){\r\n              Expr *pLeft;\r\n              pLeft = sqlite3Expr(db, TK_ID, zTabName);\r\n              pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);\r\n              if( longNames ){\r\n                zColname = sqlite3MPrintf(db, \"%s.%s\", zTabName, zName);\r\n                zToFree = zColname;\r\n              }\r\n            }else{\r\n              pExpr = pRight;\r\n            }\r\n            pNew = sqlite3ExprListAppend(pParse, pNew, pExpr);\r\n            sColname.z = zColname;\r\n            sColname.n = sqlite3Strlen30(zColname);\r\n            sqlite3ExprListSetName(pParse, pNew, &sColname, 0);\r\n            sqlite3DbFree(db, zToFree);\r\n          }\r\n        }\r\n        if( !tableSeen ){\r\n          if( zTName ){\r\n            sqlite3ErrorMsg(pParse, \"no such table: %s\", zTName);\r\n          }else{\r\n            sqlite3ErrorMsg(pParse, \"no tables specified\");\r\n          }\r\n        }\r\n      }\r\n    }\r\n    sqlite3ExprListDelete(db, pEList);\r\n    p->pEList = pNew;\r\n  }\r\n#if SQLITE_MAX_COLUMN\r\n  if( p->pEList && p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){\r\n    sqlite3ErrorMsg(pParse, \"too many columns in result set\");\r\n  }\r\n#endif\r\n  return WRC_Continue;\r\n}\r\n\r\n/*\r\n** No-op routine for the parse-tree walker.\r\n**\r\n** When this routine is the Walker.xExprCallback then expression trees\r\n** are walked without any actions being taken at each node.  Presumably,\r\n** when this routine is used for Walker.xExprCallback then \r\n** Walker.xSelectCallback is set to do something useful for every \r\n** subquery in the parser tree.\r\n*/\r\nstatic int exprWalkNoop(Walker *NotUsed, Expr *NotUsed2){\r\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\r\n  return WRC_Continue;\r\n}\r\n\r\n/*\r\n** This routine \"expands\" a SELECT statement and all of its subqueries.\r\n** For additional information on what it means to \"expand\" a SELECT\r\n** statement, see the comment on the selectExpand worker callback above.\r\n**\r\n** Expanding a SELECT statement is the first step in processing a\r\n** SELECT statement.  The SELECT statement must be expanded before\r\n** name resolution is performed.\r\n**\r\n** If anything goes wrong, an error message is written into pParse.\r\n** The calling function can detect the problem by looking at pParse->nErr\r\n** and/or pParse->db->mallocFailed.\r\n*/\r\nstatic void sqlite3SelectExpand(Parse *pParse, Select *pSelect){\r\n  Walker w;\r\n  w.xSelectCallback = selectExpander;\r\n  w.xExprCallback = exprWalkNoop;\r\n  w.pParse = pParse;\r\n  sqlite3WalkSelect(&w, pSelect);\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n/*\r\n** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()\r\n** interface.\r\n**\r\n** For each FROM-clause subquery, add Column.zType and Column.zColl\r\n** information to the Table structure that represents the result set\r\n** of that subquery.\r\n**\r\n** The Table structure that represents the result set was constructed\r\n** by selectExpander() but the type and collation information was omitted\r\n** at that point because identifiers had not yet been resolved.  This\r\n** routine is called after identifier resolution.\r\n*/\r\nstatic int selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){\r\n  Parse *pParse;\r\n  int i;\r\n  SrcList *pTabList;\r\n  struct SrcList_item *pFrom;\r\n\r\n  assert( p->selFlags & SF_Resolved );\r\n  if( (p->selFlags & SF_HasTypeInfo)==0 ){\r\n    p->selFlags |= SF_HasTypeInfo;\r\n    pParse = pWalker->pParse;\r\n    pTabList = p->pSrc;\r\n    for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){\r\n      Table *pTab = pFrom->pTab;\r\n      if( ALWAYS(pTab!=0) && (pTab->tabFlags & TF_Ephemeral)!=0 ){\r\n        /* A sub-query in the FROM clause of a SELECT */\r\n        Select *pSel = pFrom->pSelect;\r\n        assert( pSel );\r\n        while( pSel->pPrior ) pSel = pSel->pPrior;\r\n        selectAddColumnTypeAndCollation(pParse, pTab->nCol, pTab->aCol, pSel);\r\n      }\r\n    }\r\n  }\r\n  return WRC_Continue;\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** This routine adds datatype and collating sequence information to\r\n** the Table structures of all FROM-clause subqueries in a\r\n** SELECT statement.\r\n**\r\n** Use this routine after name resolution.\r\n*/\r\nstatic void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n  Walker w;\r\n  w.xSelectCallback = selectAddSubqueryTypeInfo;\r\n  w.xExprCallback = exprWalkNoop;\r\n  w.pParse = pParse;\r\n  sqlite3WalkSelect(&w, pSelect);\r\n#endif\r\n}\r\n\r\n\r\n/*\r\n** This routine sets of a SELECT statement for processing.  The\r\n** following is accomplished:\r\n**\r\n**     *  VDBE Cursor numbers are assigned to all FROM-clause terms.\r\n**     *  Ephemeral Table objects are created for all FROM-clause subqueries.\r\n**     *  ON and USING clauses are shifted into WHERE statements\r\n**     *  Wildcards \"*\" and \"TABLE.*\" in result sets are expanded.\r\n**     *  Identifiers in expression are matched to tables.\r\n**\r\n** This routine acts recursively on all subqueries within the SELECT.\r\n*/\r\nSQLITE_PRIVATE void sqlite3SelectPrep(\r\n  Parse *pParse,         /* The parser context */\r\n  Select *p,             /* The SELECT statement being coded. */\r\n  NameContext *pOuterNC  /* Name context for container */\r\n){\r\n  sqlite3 *db;\r\n  if( NEVER(p==0) ) return;\r\n  db = pParse->db;\r\n  if( p->selFlags & SF_HasTypeInfo ) return;\r\n  sqlite3SelectExpand(pParse, p);\r\n  if( pParse->nErr || db->mallocFailed ) return;\r\n  sqlite3ResolveSelectNames(pParse, p, pOuterNC);\r\n  if( pParse->nErr || db->mallocFailed ) return;\r\n  sqlite3SelectAddTypeInfo(pParse, p);\r\n}\r\n\r\n/*\r\n** Reset the aggregate accumulator.\r\n**\r\n** The aggregate accumulator is a set of memory cells that hold\r\n** intermediate results while calculating an aggregate.  This\r\n** routine simply stores NULLs in all of those memory cells.\r\n*/\r\nstatic void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  struct AggInfo_func *pFunc;\r\n  if( pAggInfo->nFunc+pAggInfo->nColumn==0 ){\r\n    return;\r\n  }\r\n  for(i=0; i<pAggInfo->nColumn; i++){\r\n    sqlite3VdbeAddOp2(v, OP_Null, 0, pAggInfo->aCol[i].iMem);\r\n  }\r\n  for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){\r\n    sqlite3VdbeAddOp2(v, OP_Null, 0, pFunc->iMem);\r\n    if( pFunc->iDistinct>=0 ){\r\n      Expr *pE = pFunc->pExpr;\r\n      assert( !ExprHasProperty(pE, EP_xIsSelect) );\r\n      if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){\r\n        sqlite3ErrorMsg(pParse, \"DISTINCT aggregates must have exactly one \"\r\n           \"argument\");\r\n        pFunc->iDistinct = -1;\r\n      }else{\r\n        KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->x.pList);\r\n        sqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0,\r\n                          (char*)pKeyInfo, P4_KEYINFO_HANDOFF);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Invoke the OP_AggFinalize opcode for every aggregate function\r\n** in the AggInfo structure.\r\n*/\r\nstatic void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  struct AggInfo_func *pF;\r\n  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){\r\n    ExprList *pList = pF->pExpr->x.pList;\r\n    assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) );\r\n    sqlite3VdbeAddOp4(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0, 0,\r\n                      (void*)pF->pFunc, P4_FUNCDEF);\r\n  }\r\n}\r\n\r\n/*\r\n** Update the accumulator memory cells for an aggregate based on\r\n** the current cursor position.\r\n*/\r\nstatic void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  int regHit = 0;\r\n  int addrHitTest = 0;\r\n  struct AggInfo_func *pF;\r\n  struct AggInfo_col *pC;\r\n\r\n  pAggInfo->directMode = 1;\r\n  sqlite3ExprCacheClear(pParse);\r\n  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){\r\n    int nArg;\r\n    int addrNext = 0;\r\n    int regAgg;\r\n    ExprList *pList = pF->pExpr->x.pList;\r\n    assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) );\r\n    if( pList ){\r\n      nArg = pList->nExpr;\r\n      regAgg = sqlite3GetTempRange(pParse, nArg);\r\n      sqlite3ExprCodeExprList(pParse, pList, regAgg, 1);\r\n    }else{\r\n      nArg = 0;\r\n      regAgg = 0;\r\n    }\r\n    if( pF->iDistinct>=0 ){\r\n      addrNext = sqlite3VdbeMakeLabel(v);\r\n      assert( nArg==1 );\r\n      codeDistinct(pParse, pF->iDistinct, addrNext, 1, regAgg);\r\n    }\r\n    if( pF->pFunc->flags & SQLITE_FUNC_NEEDCOLL ){\r\n      CollSeq *pColl = 0;\r\n      struct ExprList_item *pItem;\r\n      int j;\r\n      assert( pList!=0 );  /* pList!=0 if pF->pFunc has NEEDCOLL */\r\n      for(j=0, pItem=pList->a; !pColl && j<nArg; j++, pItem++){\r\n        pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);\r\n      }\r\n      if( !pColl ){\r\n        pColl = pParse->db->pDfltColl;\r\n      }\r\n      if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;\r\n      sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);\r\n    }\r\n    sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem,\r\n                      (void*)pF->pFunc, P4_FUNCDEF);\r\n    sqlite3VdbeChangeP5(v, (u8)nArg);\r\n    sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);\r\n    sqlite3ReleaseTempRange(pParse, regAgg, nArg);\r\n    if( addrNext ){\r\n      sqlite3VdbeResolveLabel(v, addrNext);\r\n      sqlite3ExprCacheClear(pParse);\r\n    }\r\n  }\r\n\r\n  /* Before populating the accumulator registers, clear the column cache.\r\n  ** Otherwise, if any of the required column values are already present \r\n  ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value\r\n  ** to pC->iMem. But by the time the value is used, the original register\r\n  ** may have been used, invalidating the underlying buffer holding the\r\n  ** text or blob value. See ticket [883034dcb5].\r\n  **\r\n  ** Another solution would be to change the OP_SCopy used to copy cached\r\n  ** values to an OP_Copy.\r\n  */\r\n  if( regHit ){\r\n    addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit);\r\n  }\r\n  sqlite3ExprCacheClear(pParse);\r\n  for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){\r\n    sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);\r\n  }\r\n  pAggInfo->directMode = 0;\r\n  sqlite3ExprCacheClear(pParse);\r\n  if( addrHitTest ){\r\n    sqlite3VdbeJumpHere(v, addrHitTest);\r\n  }\r\n}\r\n\r\n/*\r\n** Add a single OP_Explain instruction to the VDBE to explain a simple\r\n** count(*) query (\"SELECT count(*) FROM pTab\").\r\n*/\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\nstatic void explainSimpleCount(\r\n  Parse *pParse,                  /* Parse context */\r\n  Table *pTab,                    /* Table being queried */\r\n  Index *pIdx                     /* Index used to optimize scan, or NULL */\r\n){\r\n  if( pParse->explain==2 ){\r\n    char *zEqp = sqlite3MPrintf(pParse->db, \"SCAN TABLE %s %s%s(~%d rows)\",\r\n        pTab->zName, \r\n        pIdx ? \"USING COVERING INDEX \" : \"\",\r\n        pIdx ? pIdx->zName : \"\",\r\n        pTab->nRowEst\r\n    );\r\n    sqlite3VdbeAddOp4(\r\n        pParse->pVdbe, OP_Explain, pParse->iSelectId, 0, 0, zEqp, P4_DYNAMIC\r\n    );\r\n  }\r\n}\r\n#else\r\n# define explainSimpleCount(a,b,c)\r\n#endif\r\n\r\n/*\r\n** Generate code for the SELECT statement given in the p argument.  \r\n**\r\n** The results are distributed in various ways depending on the\r\n** contents of the SelectDest structure pointed to by argument pDest\r\n** as follows:\r\n**\r\n**     pDest->eDest    Result\r\n**     ------------    -------------------------------------------\r\n**     SRT_Output      Generate a row of output (using the OP_ResultRow\r\n**                     opcode) for each row in the result set.\r\n**\r\n**     SRT_Mem         Only valid if the result is a single column.\r\n**                     Store the first column of the first result row\r\n**                     in register pDest->iParm then abandon the rest\r\n**                     of the query.  This destination implies \"LIMIT 1\".\r\n**\r\n**     SRT_Set         The result must be a single column.  Store each\r\n**                     row of result as the key in table pDest->iParm. \r\n**                     Apply the affinity pDest->affinity before storing\r\n**                     results.  Used to implement \"IN (SELECT ...)\".\r\n**\r\n**     SRT_Union       Store results as a key in a temporary table pDest->iParm.\r\n**\r\n**     SRT_Except      Remove results from the temporary table pDest->iParm.\r\n**\r\n**     SRT_Table       Store results in temporary table pDest->iParm.\r\n**                     This is like SRT_EphemTab except that the table\r\n**                     is assumed to already be open.\r\n**\r\n**     SRT_EphemTab    Create an temporary table pDest->iParm and store\r\n**                     the result there. The cursor is left open after\r\n**                     returning.  This is like SRT_Table except that\r\n**                     this destination uses OP_OpenEphemeral to create\r\n**                     the table first.\r\n**\r\n**     SRT_Coroutine   Generate a co-routine that returns a new row of\r\n**                     results each time it is invoked.  The entry point\r\n**                     of the co-routine is stored in register pDest->iParm.\r\n**\r\n**     SRT_Exists      Store a 1 in memory cell pDest->iParm if the result\r\n**                     set is not empty.\r\n**\r\n**     SRT_Discard     Throw the results away.  This is used by SELECT\r\n**                     statements within triggers whose only purpose is\r\n**                     the side-effects of functions.\r\n**\r\n** This routine returns the number of errors.  If any errors are\r\n** encountered, then an appropriate error message is left in\r\n** pParse->zErrMsg.\r\n**\r\n** This routine does NOT free the Select structure passed in.  The\r\n** calling function needs to do that.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Select(\r\n  Parse *pParse,         /* The parser context */\r\n  Select *p,             /* The SELECT statement being coded. */\r\n  SelectDest *pDest      /* What to do with the query results */\r\n){\r\n  int i, j;              /* Loop counters */\r\n  WhereInfo *pWInfo;     /* Return from sqlite3WhereBegin() */\r\n  Vdbe *v;               /* The virtual machine under construction */\r\n  int isAgg;             /* True for select lists like \"count(*)\" */\r\n  ExprList *pEList;      /* List of columns to extract. */\r\n  SrcList *pTabList;     /* List of tables to select from */\r\n  Expr *pWhere;          /* The WHERE clause.  May be NULL */\r\n  ExprList *pOrderBy;    /* The ORDER BY clause.  May be NULL */\r\n  ExprList *pGroupBy;    /* The GROUP BY clause.  May be NULL */\r\n  Expr *pHaving;         /* The HAVING clause.  May be NULL */\r\n  int isDistinct;        /* True if the DISTINCT keyword is present */\r\n  int distinct;          /* Table to use for the distinct set */\r\n  int rc = 1;            /* Value to return from this function */\r\n  int addrSortIndex;     /* Address of an OP_OpenEphemeral instruction */\r\n  int addrDistinctIndex; /* Address of an OP_OpenEphemeral instruction */\r\n  AggInfo sAggInfo;      /* Information used by aggregate queries */\r\n  int iEnd;              /* Address of the end of the query */\r\n  sqlite3 *db;           /* The database connection */\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n  int iRestoreSelectId = pParse->iSelectId;\r\n  pParse->iSelectId = pParse->iNextSelectId++;\r\n#endif\r\n\r\n  db = pParse->db;\r\n  if( p==0 || db->mallocFailed || pParse->nErr ){\r\n    return 1;\r\n  }\r\n  if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;\r\n  memset(&sAggInfo, 0, sizeof(sAggInfo));\r\n\r\n  if( IgnorableOrderby(pDest) ){\r\n    assert(pDest->eDest==SRT_Exists || pDest->eDest==SRT_Union || \r\n           pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard);\r\n    /* If ORDER BY makes no difference in the output then neither does\r\n    ** DISTINCT so it can be removed too. */\r\n    sqlite3ExprListDelete(db, p->pOrderBy);\r\n    p->pOrderBy = 0;\r\n    p->selFlags &= ~SF_Distinct;\r\n  }\r\n  sqlite3SelectPrep(pParse, p, 0);\r\n  pOrderBy = p->pOrderBy;\r\n  pTabList = p->pSrc;\r\n  pEList = p->pEList;\r\n  if( pParse->nErr || db->mallocFailed ){\r\n    goto select_end;\r\n  }\r\n  isAgg = (p->selFlags & SF_Aggregate)!=0;\r\n  assert( pEList!=0 );\r\n\r\n  /* Begin generating code.\r\n  */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ) goto select_end;\r\n\r\n  /* If writing to memory or generating a set\r\n  ** only a single column may be output.\r\n  */\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n  if( checkForMultiColumnSelectError(pParse, pDest, pEList->nExpr) ){\r\n    goto select_end;\r\n  }\r\n#endif\r\n\r\n  /* Generate code for all sub-queries in the FROM clause\r\n  */\r\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\r\n  for(i=0; !p->pPrior && i<pTabList->nSrc; i++){\r\n    struct SrcList_item *pItem = &pTabList->a[i];\r\n    SelectDest dest;\r\n    Select *pSub = pItem->pSelect;\r\n    int isAggSub;\r\n\r\n    if( pSub==0 ) continue;\r\n    if( pItem->addrFillSub ){\r\n      sqlite3VdbeAddOp2(v, OP_Gosub, pItem->regReturn, pItem->addrFillSub);\r\n      continue;\r\n    }\r\n\r\n    /* Increment Parse.nHeight by the height of the largest expression\r\n    ** tree refered to by this, the parent select. The child select\r\n    ** may contain expression trees of at most\r\n    ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit\r\n    ** more conservative than necessary, but much easier than enforcing\r\n    ** an exact limit.\r\n    */\r\n    pParse->nHeight += sqlite3SelectExprHeight(p);\r\n\r\n    isAggSub = (pSub->selFlags & SF_Aggregate)!=0;\r\n    if( flattenSubquery(pParse, p, i, isAgg, isAggSub) ){\r\n      /* This subquery can be absorbed into its parent. */\r\n      if( isAggSub ){\r\n        isAgg = 1;\r\n        p->selFlags |= SF_Aggregate;\r\n      }\r\n      i = -1;\r\n    }else{\r\n      /* Generate a subroutine that will fill an ephemeral table with\r\n      ** the content of this subquery.  pItem->addrFillSub will point\r\n      ** to the address of the generated subroutine.  pItem->regReturn\r\n      ** is a register allocated to hold the subroutine return address\r\n      */\r\n      int topAddr;\r\n      int onceAddr = 0;\r\n      int retAddr;\r\n      assert( pItem->addrFillSub==0 );\r\n      pItem->regReturn = ++pParse->nMem;\r\n      topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn);\r\n      pItem->addrFillSub = topAddr+1;\r\n      VdbeNoopComment((v, \"materialize %s\", pItem->pTab->zName));\r\n      if( pItem->isCorrelated==0 ){\r\n        /* If the subquery is no correlated and if we are not inside of\r\n        ** a trigger, then we only need to compute the value of the subquery\r\n        ** once. */\r\n        onceAddr = sqlite3CodeOnce(pParse);\r\n      }\r\n      sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);\r\n      explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);\r\n      sqlite3Select(pParse, pSub, &dest);\r\n      pItem->pTab->nRowEst = (unsigned)pSub->nSelectRow;\r\n      if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);\r\n      retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);\r\n      VdbeComment((v, \"end %s\", pItem->pTab->zName));\r\n      sqlite3VdbeChangeP1(v, topAddr, retAddr);\r\n      sqlite3ClearTempRegCache(pParse);\r\n    }\r\n    if( /*pParse->nErr ||*/ db->mallocFailed ){\r\n      goto select_end;\r\n    }\r\n    pParse->nHeight -= sqlite3SelectExprHeight(p);\r\n    pTabList = p->pSrc;\r\n    if( !IgnorableOrderby(pDest) ){\r\n      pOrderBy = p->pOrderBy;\r\n    }\r\n  }\r\n  pEList = p->pEList;\r\n#endif\r\n  pWhere = p->pWhere;\r\n  pGroupBy = p->pGroupBy;\r\n  pHaving = p->pHaving;\r\n  isDistinct = (p->selFlags & SF_Distinct)!=0;\r\n\r\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\r\n  /* If there is are a sequence of queries, do the earlier ones first.\r\n  */\r\n  if( p->pPrior ){\r\n    if( p->pRightmost==0 ){\r\n      Select *pLoop, *pRight = 0;\r\n      int cnt = 0;\r\n      int mxSelect;\r\n      for(pLoop=p; pLoop; pLoop=pLoop->pPrior, cnt++){\r\n        pLoop->pRightmost = p;\r\n        pLoop->pNext = pRight;\r\n        pRight = pLoop;\r\n      }\r\n      mxSelect = db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT];\r\n      if( mxSelect && cnt>mxSelect ){\r\n        sqlite3ErrorMsg(pParse, \"too many terms in compound SELECT\");\r\n        goto select_end;\r\n      }\r\n    }\r\n    rc = multiSelect(pParse, p, pDest);\r\n    explainSetInteger(pParse->iSelectId, iRestoreSelectId);\r\n    return rc;\r\n  }\r\n#endif\r\n\r\n  /* If there is both a GROUP BY and an ORDER BY clause and they are\r\n  ** identical, then disable the ORDER BY clause since the GROUP BY\r\n  ** will cause elements to come out in the correct order.  This is\r\n  ** an optimization - the correct answer should result regardless.\r\n  ** Use the SQLITE_GroupByOrder flag with SQLITE_TESTCTRL_OPTIMIZER\r\n  ** to disable this optimization for testing purposes.\r\n  */\r\n  if( sqlite3ExprListCompare(p->pGroupBy, pOrderBy)==0\r\n         && (db->flags & SQLITE_GroupByOrder)==0 ){\r\n    pOrderBy = 0;\r\n  }\r\n\r\n  /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and \r\n  ** if the select-list is the same as the ORDER BY list, then this query\r\n  ** can be rewritten as a GROUP BY. In other words, this:\r\n  **\r\n  **     SELECT DISTINCT xyz FROM ... ORDER BY xyz\r\n  **\r\n  ** is transformed to:\r\n  **\r\n  **     SELECT xyz FROM ... GROUP BY xyz\r\n  **\r\n  ** The second form is preferred as a single index (or temp-table) may be \r\n  ** used for both the ORDER BY and DISTINCT processing. As originally \r\n  ** written the query must use a temp-table for at least one of the ORDER \r\n  ** BY and DISTINCT, and an index or separate temp-table for the other.\r\n  */\r\n  if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct \r\n   && sqlite3ExprListCompare(pOrderBy, p->pEList)==0\r\n  ){\r\n    p->selFlags &= ~SF_Distinct;\r\n    p->pGroupBy = sqlite3ExprListDup(db, p->pEList, 0);\r\n    pGroupBy = p->pGroupBy;\r\n    pOrderBy = 0;\r\n  }\r\n\r\n  /* If there is an ORDER BY clause, then this sorting\r\n  ** index might end up being unused if the data can be \r\n  ** extracted in pre-sorted order.  If that is the case, then the\r\n  ** OP_OpenEphemeral instruction will be changed to an OP_Noop once\r\n  ** we figure out that the sorting index is not needed.  The addrSortIndex\r\n  ** variable is used to facilitate that change.\r\n  */\r\n  if( pOrderBy ){\r\n    KeyInfo *pKeyInfo;\r\n    pKeyInfo = keyInfoFromExprList(pParse, pOrderBy);\r\n    pOrderBy->iECursor = pParse->nTab++;\r\n    p->addrOpenEphm[2] = addrSortIndex =\r\n      sqlite3VdbeAddOp4(v, OP_OpenEphemeral,\r\n                           pOrderBy->iECursor, pOrderBy->nExpr+2, 0,\r\n                           (char*)pKeyInfo, P4_KEYINFO_HANDOFF);\r\n  }else{\r\n    addrSortIndex = -1;\r\n  }\r\n\r\n  /* If the output is destined for a temporary table, open that table.\r\n  */\r\n  if( pDest->eDest==SRT_EphemTab ){\r\n    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iParm, pEList->nExpr);\r\n  }\r\n\r\n  /* Set the limiter.\r\n  */\r\n  iEnd = sqlite3VdbeMakeLabel(v);\r\n  p->nSelectRow = (double)LARGEST_INT64;\r\n  computeLimitRegisters(pParse, p, iEnd);\r\n  if( p->iLimit==0 && addrSortIndex>=0 ){\r\n    sqlite3VdbeGetOp(v, addrSortIndex)->opcode = OP_SorterOpen;\r\n    p->selFlags |= SF_UseSorter;\r\n  }\r\n\r\n  /* Open a virtual index to use for the distinct set.\r\n  */\r\n  if( p->selFlags & SF_Distinct ){\r\n    KeyInfo *pKeyInfo;\r\n    distinct = pParse->nTab++;\r\n    pKeyInfo = keyInfoFromExprList(pParse, p->pEList);\r\n    addrDistinctIndex = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, distinct, 0, 0,\r\n        (char*)pKeyInfo, P4_KEYINFO_HANDOFF);\r\n    sqlite3VdbeChangeP5(v, BTREE_UNORDERED);\r\n  }else{\r\n    distinct = addrDistinctIndex = -1;\r\n  }\r\n\r\n  /* Aggregate and non-aggregate queries are handled differently */\r\n  if( !isAgg && pGroupBy==0 ){\r\n    ExprList *pDist = (isDistinct ? p->pEList : 0);\r\n\r\n    /* Begin the database scan. */\r\n    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pOrderBy, pDist, 0);\r\n    if( pWInfo==0 ) goto select_end;\r\n    if( pWInfo->nRowOut < p->nSelectRow ) p->nSelectRow = pWInfo->nRowOut;\r\n\r\n    /* If sorting index that was created by a prior OP_OpenEphemeral \r\n    ** instruction ended up not being needed, then change the OP_OpenEphemeral\r\n    ** into an OP_Noop.\r\n    */\r\n    if( addrSortIndex>=0 && pOrderBy==0 ){\r\n      sqlite3VdbeChangeToNoop(v, addrSortIndex);\r\n      p->addrOpenEphm[2] = -1;\r\n    }\r\n\r\n    if( pWInfo->eDistinct ){\r\n      VdbeOp *pOp;                /* No longer required OpenEphemeral instr. */\r\n     \r\n      assert( addrDistinctIndex>=0 );\r\n      pOp = sqlite3VdbeGetOp(v, addrDistinctIndex);\r\n\r\n      assert( isDistinct );\r\n      assert( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED \r\n           || pWInfo->eDistinct==WHERE_DISTINCT_UNIQUE \r\n      );\r\n      distinct = -1;\r\n      if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED ){\r\n        int iJump;\r\n        int iExpr;\r\n        int iFlag = ++pParse->nMem;\r\n        int iBase = pParse->nMem+1;\r\n        int iBase2 = iBase + pEList->nExpr;\r\n        pParse->nMem += (pEList->nExpr*2);\r\n\r\n        /* Change the OP_OpenEphemeral coded earlier to an OP_Integer. The\r\n        ** OP_Integer initializes the \"first row\" flag.  */\r\n        pOp->opcode = OP_Integer;\r\n        pOp->p1 = 1;\r\n        pOp->p2 = iFlag;\r\n\r\n        sqlite3ExprCodeExprList(pParse, pEList, iBase, 1);\r\n        iJump = sqlite3VdbeCurrentAddr(v) + 1 + pEList->nExpr + 1 + 1;\r\n        sqlite3VdbeAddOp2(v, OP_If, iFlag, iJump-1);\r\n        for(iExpr=0; iExpr<pEList->nExpr; iExpr++){\r\n          CollSeq *pColl = sqlite3ExprCollSeq(pParse, pEList->a[iExpr].pExpr);\r\n          sqlite3VdbeAddOp3(v, OP_Ne, iBase+iExpr, iJump, iBase2+iExpr);\r\n          sqlite3VdbeChangeP4(v, -1, (const char *)pColl, P4_COLLSEQ);\r\n          sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, pWInfo->iContinue);\r\n\r\n        sqlite3VdbeAddOp2(v, OP_Integer, 0, iFlag);\r\n        assert( sqlite3VdbeCurrentAddr(v)==iJump );\r\n        sqlite3VdbeAddOp3(v, OP_Move, iBase, iBase2, pEList->nExpr);\r\n      }else{\r\n        pOp->opcode = OP_Noop;\r\n      }\r\n    }\r\n\r\n    /* Use the standard inner loop. */\r\n    selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, pDest,\r\n                    pWInfo->iContinue, pWInfo->iBreak);\r\n\r\n    /* End the database scan loop.\r\n    */\r\n    sqlite3WhereEnd(pWInfo);\r\n  }else{\r\n    /* This is the processing for aggregate queries */\r\n    NameContext sNC;    /* Name context for processing aggregate information */\r\n    int iAMem;          /* First Mem address for storing current GROUP BY */\r\n    int iBMem;          /* First Mem address for previous GROUP BY */\r\n    int iUseFlag;       /* Mem address holding flag indicating that at least\r\n                        ** one row of the input to the aggregator has been\r\n                        ** processed */\r\n    int iAbortFlag;     /* Mem address which causes query abort if positive */\r\n    int groupBySort;    /* Rows come from source in GROUP BY order */\r\n    int addrEnd;        /* End of processing for this SELECT */\r\n    int sortPTab = 0;   /* Pseudotable used to decode sorting results */\r\n    int sortOut = 0;    /* Output register from the sorter */\r\n\r\n    /* Remove any and all aliases between the result set and the\r\n    ** GROUP BY clause.\r\n    */\r\n    if( pGroupBy ){\r\n      int k;                        /* Loop counter */\r\n      struct ExprList_item *pItem;  /* For looping over expression in a list */\r\n\r\n      for(k=p->pEList->nExpr, pItem=p->pEList->a; k>0; k--, pItem++){\r\n        pItem->iAlias = 0;\r\n      }\r\n      for(k=pGroupBy->nExpr, pItem=pGroupBy->a; k>0; k--, pItem++){\r\n        pItem->iAlias = 0;\r\n      }\r\n      if( p->nSelectRow>(double)100 ) p->nSelectRow = (double)100;\r\n    }else{\r\n      p->nSelectRow = (double)1;\r\n    }\r\n\r\n \r\n    /* Create a label to jump to when we want to abort the query */\r\n    addrEnd = sqlite3VdbeMakeLabel(v);\r\n\r\n    /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in\r\n    ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the\r\n    ** SELECT statement.\r\n    */\r\n    memset(&sNC, 0, sizeof(sNC));\r\n    sNC.pParse = pParse;\r\n    sNC.pSrcList = pTabList;\r\n    sNC.pAggInfo = &sAggInfo;\r\n    sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0;\r\n    sAggInfo.pGroupBy = pGroupBy;\r\n    sqlite3ExprAnalyzeAggList(&sNC, pEList);\r\n    sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);\r\n    if( pHaving ){\r\n      sqlite3ExprAnalyzeAggregates(&sNC, pHaving);\r\n    }\r\n    sAggInfo.nAccumulator = sAggInfo.nColumn;\r\n    for(i=0; i<sAggInfo.nFunc; i++){\r\n      assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );\r\n      sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);\r\n    }\r\n    if( db->mallocFailed ) goto select_end;\r\n\r\n    /* Processing for aggregates with GROUP BY is very different and\r\n    ** much more complex than aggregates without a GROUP BY.\r\n    */\r\n    if( pGroupBy ){\r\n      KeyInfo *pKeyInfo;  /* Keying information for the group by clause */\r\n      int j1;             /* A-vs-B comparision jump */\r\n      int addrOutputRow;  /* Start of subroutine that outputs a result row */\r\n      int regOutputRow;   /* Return address register for output subroutine */\r\n      int addrSetAbort;   /* Set the abort flag and return */\r\n      int addrTopOfLoop;  /* Top of the input loop */\r\n      int addrSortingIdx; /* The OP_OpenEphemeral for the sorting index */\r\n      int addrReset;      /* Subroutine for resetting the accumulator */\r\n      int regReset;       /* Return address register for reset subroutine */\r\n\r\n      /* If there is a GROUP BY clause we might need a sorting index to\r\n      ** implement it.  Allocate that sorting index now.  If it turns out\r\n      ** that we do not need it after all, the OP_SorterOpen instruction\r\n      ** will be converted into a Noop.  \r\n      */\r\n      sAggInfo.sortingIdx = pParse->nTab++;\r\n      pKeyInfo = keyInfoFromExprList(pParse, pGroupBy);\r\n      addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen, \r\n          sAggInfo.sortingIdx, sAggInfo.nSortingColumn, \r\n          0, (char*)pKeyInfo, P4_KEYINFO_HANDOFF);\r\n\r\n      /* Initialize memory locations used by GROUP BY aggregate processing\r\n      */\r\n      iUseFlag = ++pParse->nMem;\r\n      iAbortFlag = ++pParse->nMem;\r\n      regOutputRow = ++pParse->nMem;\r\n      addrOutputRow = sqlite3VdbeMakeLabel(v);\r\n      regReset = ++pParse->nMem;\r\n      addrReset = sqlite3VdbeMakeLabel(v);\r\n      iAMem = pParse->nMem + 1;\r\n      pParse->nMem += pGroupBy->nExpr;\r\n      iBMem = pParse->nMem + 1;\r\n      pParse->nMem += pGroupBy->nExpr;\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag);\r\n      VdbeComment((v, \"clear abort flag\"));\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, iUseFlag);\r\n      VdbeComment((v, \"indicate accumulator empty\"));\r\n      sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1);\r\n\r\n      /* Begin a loop that will extract all source rows in GROUP BY order.\r\n      ** This might involve two separate loops with an OP_Sort in between, or\r\n      ** it might be a single loop that uses an index to extract information\r\n      ** in the right order to begin with.\r\n      */\r\n      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);\r\n      pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pGroupBy, 0, 0);\r\n      if( pWInfo==0 ) goto select_end;\r\n      if( pGroupBy==0 ){\r\n        /* The optimizer is able to deliver rows in group by order so\r\n        ** we do not have to sort.  The OP_OpenEphemeral table will be\r\n        ** cancelled later because we still need to use the pKeyInfo\r\n        */\r\n        pGroupBy = p->pGroupBy;\r\n        groupBySort = 0;\r\n      }else{\r\n        /* Rows are coming out in undetermined order.  We have to push\r\n        ** each row into a sorting index, terminate the first loop,\r\n        ** then loop over the sorting index in order to get the output\r\n        ** in sorted order\r\n        */\r\n        int regBase;\r\n        int regRecord;\r\n        int nCol;\r\n        int nGroupBy;\r\n\r\n        explainTempTable(pParse, \r\n            isDistinct && !(p->selFlags&SF_Distinct)?\"DISTINCT\":\"GROUP BY\");\r\n\r\n        groupBySort = 1;\r\n        nGroupBy = pGroupBy->nExpr;\r\n        nCol = nGroupBy + 1;\r\n        j = nGroupBy+1;\r\n        for(i=0; i<sAggInfo.nColumn; i++){\r\n          if( sAggInfo.aCol[i].iSorterColumn>=j ){\r\n            nCol++;\r\n            j++;\r\n          }\r\n        }\r\n        regBase = sqlite3GetTempRange(pParse, nCol);\r\n        sqlite3ExprCacheClear(pParse);\r\n        sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0);\r\n        sqlite3VdbeAddOp2(v, OP_Sequence, sAggInfo.sortingIdx,regBase+nGroupBy);\r\n        j = nGroupBy+1;\r\n        for(i=0; i<sAggInfo.nColumn; i++){\r\n          struct AggInfo_col *pCol = &sAggInfo.aCol[i];\r\n          if( pCol->iSorterColumn>=j ){\r\n            int r1 = j + regBase;\r\n            int r2;\r\n\r\n            r2 = sqlite3ExprCodeGetColumn(pParse, \r\n                               pCol->pTab, pCol->iColumn, pCol->iTable, r1);\r\n            if( r1!=r2 ){\r\n              sqlite3VdbeAddOp2(v, OP_SCopy, r2, r1);\r\n            }\r\n            j++;\r\n          }\r\n        }\r\n        regRecord = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);\r\n        sqlite3VdbeAddOp2(v, OP_SorterInsert, sAggInfo.sortingIdx, regRecord);\r\n        sqlite3ReleaseTempReg(pParse, regRecord);\r\n        sqlite3ReleaseTempRange(pParse, regBase, nCol);\r\n        sqlite3WhereEnd(pWInfo);\r\n        sAggInfo.sortingIdxPTab = sortPTab = pParse->nTab++;\r\n        sortOut = sqlite3GetTempReg(pParse);\r\n        sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);\r\n        sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd);\r\n        VdbeComment((v, \"GROUP BY sort\"));\r\n        sAggInfo.useSortingIdx = 1;\r\n        sqlite3ExprCacheClear(pParse);\r\n      }\r\n\r\n      /* Evaluate the current GROUP BY terms and store in b0, b1, b2...\r\n      ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)\r\n      ** Then compare the current GROUP BY terms against the GROUP BY terms\r\n      ** from the previous row currently stored in a0, a1, a2...\r\n      */\r\n      addrTopOfLoop = sqlite3VdbeCurrentAddr(v);\r\n      sqlite3ExprCacheClear(pParse);\r\n      if( groupBySort ){\r\n        sqlite3VdbeAddOp2(v, OP_SorterData, sAggInfo.sortingIdx, sortOut);\r\n      }\r\n      for(j=0; j<pGroupBy->nExpr; j++){\r\n        if( groupBySort ){\r\n          sqlite3VdbeAddOp3(v, OP_Column, sortPTab, j, iBMem+j);\r\n          if( j==0 ) sqlite3VdbeChangeP5(v, OPFLAG_CLEARCACHE);\r\n        }else{\r\n          sAggInfo.directMode = 1;\r\n          sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr, iBMem+j);\r\n        }\r\n      }\r\n      sqlite3VdbeAddOp4(v, OP_Compare, iAMem, iBMem, pGroupBy->nExpr,\r\n                          (char*)pKeyInfo, P4_KEYINFO);\r\n      j1 = sqlite3VdbeCurrentAddr(v);\r\n      sqlite3VdbeAddOp3(v, OP_Jump, j1+1, 0, j1+1);\r\n\r\n      /* Generate code that runs whenever the GROUP BY changes.\r\n      ** Changes in the GROUP BY are detected by the previous code\r\n      ** block.  If there were no changes, this block is skipped.\r\n      **\r\n      ** This code copies current group by terms in b0,b1,b2,...\r\n      ** over to a0,a1,a2.  It then calls the output subroutine\r\n      ** and resets the aggregate accumulator registers in preparation\r\n      ** for the next GROUP BY batch.\r\n      */\r\n      sqlite3ExprCodeMove(pParse, iBMem, iAMem, pGroupBy->nExpr);\r\n      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);\r\n      VdbeComment((v, \"output one row\"));\r\n      sqlite3VdbeAddOp2(v, OP_IfPos, iAbortFlag, addrEnd);\r\n      VdbeComment((v, \"check abort flag\"));\r\n      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);\r\n      VdbeComment((v, \"reset accumulator\"));\r\n\r\n      /* Update the aggregate accumulators based on the content of\r\n      ** the current row\r\n      */\r\n      sqlite3VdbeJumpHere(v, j1);\r\n      updateAccumulator(pParse, &sAggInfo);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, iUseFlag);\r\n      VdbeComment((v, \"indicate data in accumulator\"));\r\n\r\n      /* End of the loop\r\n      */\r\n      if( groupBySort ){\r\n        sqlite3VdbeAddOp2(v, OP_SorterNext, sAggInfo.sortingIdx, addrTopOfLoop);\r\n      }else{\r\n        sqlite3WhereEnd(pWInfo);\r\n        sqlite3VdbeChangeToNoop(v, addrSortingIdx);\r\n      }\r\n\r\n      /* Output the final row of result\r\n      */\r\n      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);\r\n      VdbeComment((v, \"output final row\"));\r\n\r\n      /* Jump over the subroutines\r\n      */\r\n      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEnd);\r\n\r\n      /* Generate a subroutine that outputs a single row of the result\r\n      ** set.  This subroutine first looks at the iUseFlag.  If iUseFlag\r\n      ** is less than or equal to zero, the subroutine is a no-op.  If\r\n      ** the processing calls for the query to abort, this subroutine\r\n      ** increments the iAbortFlag memory location before returning in\r\n      ** order to signal the caller to abort.\r\n      */\r\n      addrSetAbort = sqlite3VdbeCurrentAddr(v);\r\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, iAbortFlag);\r\n      VdbeComment((v, \"set abort flag\"));\r\n      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);\r\n      sqlite3VdbeResolveLabel(v, addrOutputRow);\r\n      addrOutputRow = sqlite3VdbeCurrentAddr(v);\r\n      sqlite3VdbeAddOp2(v, OP_IfPos, iUseFlag, addrOutputRow+2);\r\n      VdbeComment((v, \"Groupby result generator entry point\"));\r\n      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);\r\n      finalizeAggFunctions(pParse, &sAggInfo);\r\n      sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);\r\n      selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy,\r\n                      distinct, pDest,\r\n                      addrOutputRow+1, addrSetAbort);\r\n      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);\r\n      VdbeComment((v, \"end groupby result generator\"));\r\n\r\n      /* Generate a subroutine that will reset the group-by accumulator\r\n      */\r\n      sqlite3VdbeResolveLabel(v, addrReset);\r\n      resetAccumulator(pParse, &sAggInfo);\r\n      sqlite3VdbeAddOp1(v, OP_Return, regReset);\r\n     \r\n    } /* endif pGroupBy.  Begin aggregate queries without GROUP BY: */\r\n    else {\r\n      ExprList *pDel = 0;\r\n#ifndef SQLITE_OMIT_BTREECOUNT\r\n      Table *pTab;\r\n      if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){\r\n        /* If isSimpleCount() returns a pointer to a Table structure, then\r\n        ** the SQL statement is of the form:\r\n        **\r\n        **   SELECT count(*) FROM <tbl>\r\n        **\r\n        ** where the Table structure returned represents table <tbl>.\r\n        **\r\n        ** This statement is so common that it is optimized specially. The\r\n        ** OP_Count instruction is executed either on the intkey table that\r\n        ** contains the data for table <tbl> or on one of its indexes. It\r\n        ** is better to execute the op on an index, as indexes are almost\r\n        ** always spread across less pages than their corresponding tables.\r\n        */\r\n        const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n        const int iCsr = pParse->nTab++;     /* Cursor to scan b-tree */\r\n        Index *pIdx;                         /* Iterator variable */\r\n        KeyInfo *pKeyInfo = 0;               /* Keyinfo for scanned index */\r\n        Index *pBest = 0;                    /* Best index found so far */\r\n        int iRoot = pTab->tnum;              /* Root page of scanned b-tree */\r\n\r\n        sqlite3CodeVerifySchema(pParse, iDb);\r\n        sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\r\n\r\n        /* Search for the index that has the least amount of columns. If\r\n        ** there is such an index, and it has less columns than the table\r\n        ** does, then we can assume that it consumes less space on disk and\r\n        ** will therefore be cheaper to scan to determine the query result.\r\n        ** In this case set iRoot to the root page number of the index b-tree\r\n        ** and pKeyInfo to the KeyInfo structure required to navigate the\r\n        ** index.\r\n        **\r\n        ** (2011-04-15) Do not do a full scan of an unordered index.\r\n        **\r\n        ** In practice the KeyInfo structure will not be used. It is only \r\n        ** passed to keep OP_OpenRead happy.\r\n        */\r\n        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n          if( pIdx->bUnordered==0 && (!pBest || pIdx->nColumn<pBest->nColumn) ){\r\n            pBest = pIdx;\r\n          }\r\n        }\r\n        if( pBest && pBest->nColumn<pTab->nCol ){\r\n          iRoot = pBest->tnum;\r\n          pKeyInfo = sqlite3IndexKeyinfo(pParse, pBest);\r\n        }\r\n\r\n        /* Open a read-only cursor, execute the OP_Count, close the cursor. */\r\n        sqlite3VdbeAddOp3(v, OP_OpenRead, iCsr, iRoot, iDb);\r\n        if( pKeyInfo ){\r\n          sqlite3VdbeChangeP4(v, -1, (char *)pKeyInfo, P4_KEYINFO_HANDOFF);\r\n        }\r\n        sqlite3VdbeAddOp2(v, OP_Count, iCsr, sAggInfo.aFunc[0].iMem);\r\n        sqlite3VdbeAddOp1(v, OP_Close, iCsr);\r\n        explainSimpleCount(pParse, pTab, pBest);\r\n      }else\r\n#endif /* SQLITE_OMIT_BTREECOUNT */\r\n      {\r\n        /* Check if the query is of one of the following forms:\r\n        **\r\n        **   SELECT min(x) FROM ...\r\n        **   SELECT max(x) FROM ...\r\n        **\r\n        ** If it is, then ask the code in where.c to attempt to sort results\r\n        ** as if there was an \"ORDER ON x\" or \"ORDER ON x DESC\" clause. \r\n        ** If where.c is able to produce results sorted in this order, then\r\n        ** add vdbe code to break out of the processing loop after the \r\n        ** first iteration (since the first iteration of the loop is \r\n        ** guaranteed to operate on the row with the minimum or maximum \r\n        ** value of x, the only row required).\r\n        **\r\n        ** A special flag must be passed to sqlite3WhereBegin() to slightly\r\n        ** modify behaviour as follows:\r\n        **\r\n        **   + If the query is a \"SELECT min(x)\", then the loop coded by\r\n        **     where.c should not iterate over any values with a NULL value\r\n        **     for x.\r\n        **\r\n        **   + The optimizer code in where.c (the thing that decides which\r\n        **     index or indices to use) should place a different priority on \r\n        **     satisfying the 'ORDER BY' clause than it does in other cases.\r\n        **     Refer to code and comments in where.c for details.\r\n        */\r\n        ExprList *pMinMax = 0;\r\n        u8 flag = minMaxQuery(p);\r\n        if( flag ){\r\n          assert( !ExprHasProperty(p->pEList->a[0].pExpr, EP_xIsSelect) );\r\n          pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->x.pList,0);\r\n          pDel = pMinMax;\r\n          if( pMinMax && !db->mallocFailed ){\r\n            pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0;\r\n            pMinMax->a[0].pExpr->op = TK_COLUMN;\r\n          }\r\n        }\r\n  \r\n        /* This case runs if the aggregate has no GROUP BY clause.  The\r\n        ** processing is much simpler since there is only a single row\r\n        ** of output.\r\n        */\r\n        resetAccumulator(pParse, &sAggInfo);\r\n        pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pMinMax, 0, flag);\r\n        if( pWInfo==0 ){\r\n          sqlite3ExprListDelete(db, pDel);\r\n          goto select_end;\r\n        }\r\n        updateAccumulator(pParse, &sAggInfo);\r\n        if( !pMinMax && flag ){\r\n          sqlite3VdbeAddOp2(v, OP_Goto, 0, pWInfo->iBreak);\r\n          VdbeComment((v, \"%s() by index\",\r\n                (flag==WHERE_ORDERBY_MIN?\"min\":\"max\")));\r\n        }\r\n        sqlite3WhereEnd(pWInfo);\r\n        finalizeAggFunctions(pParse, &sAggInfo);\r\n      }\r\n\r\n      pOrderBy = 0;\r\n      sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);\r\n      selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1, \r\n                      pDest, addrEnd, addrEnd);\r\n      sqlite3ExprListDelete(db, pDel);\r\n    }\r\n    sqlite3VdbeResolveLabel(v, addrEnd);\r\n    \r\n  } /* endif aggregate query */\r\n\r\n  if( distinct>=0 ){\r\n    explainTempTable(pParse, \"DISTINCT\");\r\n  }\r\n\r\n  /* If there is an ORDER BY clause, then we need to sort the results\r\n  ** and send them to the callback one by one.\r\n  */\r\n  if( pOrderBy ){\r\n    explainTempTable(pParse, \"ORDER BY\");\r\n    generateSortTail(pParse, p, v, pEList->nExpr, pDest);\r\n  }\r\n\r\n  /* Jump here to skip this query\r\n  */\r\n  sqlite3VdbeResolveLabel(v, iEnd);\r\n\r\n  /* The SELECT was successfully coded.   Set the return code to 0\r\n  ** to indicate no errors.\r\n  */\r\n  rc = 0;\r\n\r\n  /* Control jumps to here if an error is encountered above, or upon\r\n  ** successful coding of the SELECT.\r\n  */\r\nselect_end:\r\n  explainSetInteger(pParse->iSelectId, iRestoreSelectId);\r\n\r\n  /* Identify column names if results of the SELECT are to be output.\r\n  */\r\n  if( rc==SQLITE_OK && pDest->eDest==SRT_Output ){\r\n    generateColumnNames(pParse, pTabList, pEList);\r\n  }\r\n\r\n  sqlite3DbFree(db, sAggInfo.aCol);\r\n  sqlite3DbFree(db, sAggInfo.aFunc);\r\n  return rc;\r\n}\r\n\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\n/*\r\n** Generate a human-readable description of a the Select object.\r\n*/\r\nstatic void explainOneSelect(Vdbe *pVdbe, Select *p){\r\n  sqlite3ExplainPrintf(pVdbe, \"SELECT \");\r\n  if( p->selFlags & (SF_Distinct|SF_Aggregate) ){\r\n    if( p->selFlags & SF_Distinct ){\r\n      sqlite3ExplainPrintf(pVdbe, \"DISTINCT \");\r\n    }\r\n    if( p->selFlags & SF_Aggregate ){\r\n      sqlite3ExplainPrintf(pVdbe, \"agg_flag \");\r\n    }\r\n    sqlite3ExplainNL(pVdbe);\r\n    sqlite3ExplainPrintf(pVdbe, \"   \");\r\n  }\r\n  sqlite3ExplainExprList(pVdbe, p->pEList);\r\n  sqlite3ExplainNL(pVdbe);\r\n  if( p->pSrc && p->pSrc->nSrc ){\r\n    int i;\r\n    sqlite3ExplainPrintf(pVdbe, \"FROM \");\r\n    sqlite3ExplainPush(pVdbe);\r\n    for(i=0; i<p->pSrc->nSrc; i++){\r\n      struct SrcList_item *pItem = &p->pSrc->a[i];\r\n      sqlite3ExplainPrintf(pVdbe, \"{%d,*} = \", pItem->iCursor);\r\n      if( pItem->pSelect ){\r\n        sqlite3ExplainSelect(pVdbe, pItem->pSelect);\r\n        if( pItem->pTab ){\r\n          sqlite3ExplainPrintf(pVdbe, \" (tabname=%s)\", pItem->pTab->zName);\r\n        }\r\n      }else if( pItem->zName ){\r\n        sqlite3ExplainPrintf(pVdbe, \"%s\", pItem->zName);\r\n      }\r\n      if( pItem->zAlias ){\r\n        sqlite3ExplainPrintf(pVdbe, \" (AS %s)\", pItem->zAlias);\r\n      }\r\n      if( pItem->jointype & JT_LEFT ){\r\n        sqlite3ExplainPrintf(pVdbe, \" LEFT-JOIN\");\r\n      }\r\n      sqlite3ExplainNL(pVdbe);\r\n    }\r\n    sqlite3ExplainPop(pVdbe);\r\n  }\r\n  if( p->pWhere ){\r\n    sqlite3ExplainPrintf(pVdbe, \"WHERE \");\r\n    sqlite3ExplainExpr(pVdbe, p->pWhere);\r\n    sqlite3ExplainNL(pVdbe);\r\n  }\r\n  if( p->pGroupBy ){\r\n    sqlite3ExplainPrintf(pVdbe, \"GROUPBY \");\r\n    sqlite3ExplainExprList(pVdbe, p->pGroupBy);\r\n    sqlite3ExplainNL(pVdbe);\r\n  }\r\n  if( p->pHaving ){\r\n    sqlite3ExplainPrintf(pVdbe, \"HAVING \");\r\n    sqlite3ExplainExpr(pVdbe, p->pHaving);\r\n    sqlite3ExplainNL(pVdbe);\r\n  }\r\n  if( p->pOrderBy ){\r\n    sqlite3ExplainPrintf(pVdbe, \"ORDERBY \");\r\n    sqlite3ExplainExprList(pVdbe, p->pOrderBy);\r\n    sqlite3ExplainNL(pVdbe);\r\n  }\r\n  if( p->pLimit ){\r\n    sqlite3ExplainPrintf(pVdbe, \"LIMIT \");\r\n    sqlite3ExplainExpr(pVdbe, p->pLimit);\r\n    sqlite3ExplainNL(pVdbe);\r\n  }\r\n  if( p->pOffset ){\r\n    sqlite3ExplainPrintf(pVdbe, \"OFFSET \");\r\n    sqlite3ExplainExpr(pVdbe, p->pOffset);\r\n    sqlite3ExplainNL(pVdbe);\r\n  }\r\n}\r\nSQLITE_PRIVATE void sqlite3ExplainSelect(Vdbe *pVdbe, Select *p){\r\n  if( p==0 ){\r\n    sqlite3ExplainPrintf(pVdbe, \"(null-select)\");\r\n    return;\r\n  }\r\n  while( p->pPrior ) p = p->pPrior;\r\n  sqlite3ExplainPush(pVdbe);\r\n  while( p ){\r\n    explainOneSelect(pVdbe, p);\r\n    p = p->pNext;\r\n    if( p==0 ) break;\r\n    sqlite3ExplainNL(pVdbe);\r\n    sqlite3ExplainPrintf(pVdbe, \"%s\\n\", selectOpName(p->op));\r\n  }\r\n  sqlite3ExplainPrintf(pVdbe, \"END\");\r\n  sqlite3ExplainPop(pVdbe);\r\n}\r\n\r\n/* End of the structure debug printing code\r\n*****************************************************************************/\r\n#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */\r\n\r\n/************** End of select.c **********************************************/\r\n/************** Begin file table.c *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the sqlite3_get_table() and sqlite3_free_table()\r\n** interface routines.  These are just wrappers around the main\r\n** interface routine of sqlite3_exec().\r\n**\r\n** These routines are in a separate files so that they will not be linked\r\n** if they are not used.\r\n*/\r\n/* #include <stdlib.h> */\r\n/* #include <string.h> */\r\n\r\n#ifndef SQLITE_OMIT_GET_TABLE\r\n\r\n/*\r\n** This structure is used to pass data from sqlite3_get_table() through\r\n** to the callback function is uses to build the result.\r\n*/\r\ntypedef struct TabResult {\r\n  char **azResult;   /* Accumulated output */\r\n  char *zErrMsg;     /* Error message text, if an error occurs */\r\n  int nAlloc;        /* Slots allocated for azResult[] */\r\n  int nRow;          /* Number of rows in the result */\r\n  int nColumn;       /* Number of columns in the result */\r\n  int nData;         /* Slots used in azResult[].  (nRow+1)*nColumn */\r\n  int rc;            /* Return code from sqlite3_exec() */\r\n} TabResult;\r\n\r\n/*\r\n** This routine is called once for each row in the result table.  Its job\r\n** is to fill in the TabResult structure appropriately, allocating new\r\n** memory as necessary.\r\n*/\r\nstatic int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){\r\n  TabResult *p = (TabResult*)pArg;  /* Result accumulator */\r\n  int need;                         /* Slots needed in p->azResult[] */\r\n  int i;                            /* Loop counter */\r\n  char *z;                          /* A single column of result */\r\n\r\n  /* Make sure there is enough space in p->azResult to hold everything\r\n  ** we need to remember from this invocation of the callback.\r\n  */\r\n  if( p->nRow==0 && argv!=0 ){\r\n    need = nCol*2;\r\n  }else{\r\n    need = nCol;\r\n  }\r\n  if( p->nData + need > p->nAlloc ){\r\n    char **azNew;\r\n    p->nAlloc = p->nAlloc*2 + need;\r\n    azNew = sqlite3_realloc( p->azResult, sizeof(char*)*p->nAlloc );\r\n    if( azNew==0 ) goto malloc_failed;\r\n    p->azResult = azNew;\r\n  }\r\n\r\n  /* If this is the first row, then generate an extra row containing\r\n  ** the names of all columns.\r\n  */\r\n  if( p->nRow==0 ){\r\n    p->nColumn = nCol;\r\n    for(i=0; i<nCol; i++){\r\n      z = sqlite3_mprintf(\"%s\", colv[i]);\r\n      if( z==0 ) goto malloc_failed;\r\n      p->azResult[p->nData++] = z;\r\n    }\r\n  }else if( p->nColumn!=nCol ){\r\n    sqlite3_free(p->zErrMsg);\r\n    p->zErrMsg = sqlite3_mprintf(\r\n       \"sqlite3_get_table() called with two or more incompatible queries\"\r\n    );\r\n    p->rc = SQLITE_ERROR;\r\n    return 1;\r\n  }\r\n\r\n  /* Copy over the row data\r\n  */\r\n  if( argv!=0 ){\r\n    for(i=0; i<nCol; i++){\r\n      if( argv[i]==0 ){\r\n        z = 0;\r\n      }else{\r\n        int n = sqlite3Strlen30(argv[i])+1;\r\n        z = sqlite3_malloc( n );\r\n        if( z==0 ) goto malloc_failed;\r\n        memcpy(z, argv[i], n);\r\n      }\r\n      p->azResult[p->nData++] = z;\r\n    }\r\n    p->nRow++;\r\n  }\r\n  return 0;\r\n\r\nmalloc_failed:\r\n  p->rc = SQLITE_NOMEM;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Query the database.  But instead of invoking a callback for each row,\r\n** malloc() for space to hold the result and return the entire results\r\n** at the conclusion of the call.\r\n**\r\n** The result that is written to ***pazResult is held in memory obtained\r\n** from malloc().  But the caller cannot free this memory directly.  \r\n** Instead, the entire table should be passed to sqlite3_free_table() when\r\n** the calling procedure is finished using it.\r\n*/\r\nSQLITE_API int sqlite3_get_table(\r\n  sqlite3 *db,                /* The database on which the SQL executes */\r\n  const char *zSql,           /* The SQL to be executed */\r\n  char ***pazResult,          /* Write the result table here */\r\n  int *pnRow,                 /* Write the number of rows in the result here */\r\n  int *pnColumn,              /* Write the number of columns of result here */\r\n  char **pzErrMsg             /* Write error messages here */\r\n){\r\n  int rc;\r\n  TabResult res;\r\n\r\n  *pazResult = 0;\r\n  if( pnColumn ) *pnColumn = 0;\r\n  if( pnRow ) *pnRow = 0;\r\n  if( pzErrMsg ) *pzErrMsg = 0;\r\n  res.zErrMsg = 0;\r\n  res.nRow = 0;\r\n  res.nColumn = 0;\r\n  res.nData = 1;\r\n  res.nAlloc = 20;\r\n  res.rc = SQLITE_OK;\r\n  res.azResult = sqlite3_malloc(sizeof(char*)*res.nAlloc );\r\n  if( res.azResult==0 ){\r\n     db->errCode = SQLITE_NOMEM;\r\n     return SQLITE_NOMEM;\r\n  }\r\n  res.azResult[0] = 0;\r\n  rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);\r\n  assert( sizeof(res.azResult[0])>= sizeof(res.nData) );\r\n  res.azResult[0] = SQLITE_INT_TO_PTR(res.nData);\r\n  if( (rc&0xff)==SQLITE_ABORT ){\r\n    sqlite3_free_table(&res.azResult[1]);\r\n    if( res.zErrMsg ){\r\n      if( pzErrMsg ){\r\n        sqlite3_free(*pzErrMsg);\r\n        *pzErrMsg = sqlite3_mprintf(\"%s\",res.zErrMsg);\r\n      }\r\n      sqlite3_free(res.zErrMsg);\r\n    }\r\n    db->errCode = res.rc;  /* Assume 32-bit assignment is atomic */\r\n    return res.rc;\r\n  }\r\n  sqlite3_free(res.zErrMsg);\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3_free_table(&res.azResult[1]);\r\n    return rc;\r\n  }\r\n  if( res.nAlloc>res.nData ){\r\n    char **azNew;\r\n    azNew = sqlite3_realloc( res.azResult, sizeof(char*)*res.nData );\r\n    if( azNew==0 ){\r\n      sqlite3_free_table(&res.azResult[1]);\r\n      db->errCode = SQLITE_NOMEM;\r\n      return SQLITE_NOMEM;\r\n    }\r\n    res.azResult = azNew;\r\n  }\r\n  *pazResult = &res.azResult[1];\r\n  if( pnColumn ) *pnColumn = res.nColumn;\r\n  if( pnRow ) *pnRow = res.nRow;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This routine frees the space the sqlite3_get_table() malloced.\r\n*/\r\nSQLITE_API void sqlite3_free_table(\r\n  char **azResult            /* Result returned from from sqlite3_get_table() */\r\n){\r\n  if( azResult ){\r\n    int i, n;\r\n    azResult--;\r\n    assert( azResult!=0 );\r\n    n = SQLITE_PTR_TO_INT(azResult[0]);\r\n    for(i=1; i<n; i++){ if( azResult[i] ) sqlite3_free(azResult[i]); }\r\n    sqlite3_free(azResult);\r\n  }\r\n}\r\n\r\n#endif /* SQLITE_OMIT_GET_TABLE */\r\n\r\n/************** End of table.c ***********************************************/\r\n/************** Begin file trigger.c *****************************************/\r\n/*\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains the implementation for TRIGGERs\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n/*\r\n** Delete a linked list of TriggerStep structures.\r\n*/\r\nSQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3 *db, TriggerStep *pTriggerStep){\r\n  while( pTriggerStep ){\r\n    TriggerStep * pTmp = pTriggerStep;\r\n    pTriggerStep = pTriggerStep->pNext;\r\n\r\n    sqlite3ExprDelete(db, pTmp->pWhere);\r\n    sqlite3ExprListDelete(db, pTmp->pExprList);\r\n    sqlite3SelectDelete(db, pTmp->pSelect);\r\n    sqlite3IdListDelete(db, pTmp->pIdList);\r\n\r\n    sqlite3DbFree(db, pTmp);\r\n  }\r\n}\r\n\r\n/*\r\n** Given table pTab, return a list of all the triggers attached to \r\n** the table. The list is connected by Trigger.pNext pointers.\r\n**\r\n** All of the triggers on pTab that are in the same database as pTab\r\n** are already attached to pTab->pTrigger.  But there might be additional\r\n** triggers on pTab in the TEMP schema.  This routine prepends all\r\n** TEMP triggers on pTab to the beginning of the pTab->pTrigger list\r\n** and returns the combined list.\r\n**\r\n** To state it another way:  This routine returns a list of all triggers\r\n** that fire off of pTab.  The list will include any TEMP triggers on\r\n** pTab as well as the triggers lised in pTab->pTrigger.\r\n*/\r\nSQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){\r\n  Schema * const pTmpSchema = pParse->db->aDb[1].pSchema;\r\n  Trigger *pList = 0;                  /* List of triggers to return */\r\n\r\n  if( pParse->disableTriggers ){\r\n    return 0;\r\n  }\r\n\r\n  if( pTmpSchema!=pTab->pSchema ){\r\n    HashElem *p;\r\n    assert( sqlite3SchemaMutexHeld(pParse->db, 0, pTmpSchema) );\r\n    for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){\r\n      Trigger *pTrig = (Trigger *)sqliteHashData(p);\r\n      if( pTrig->pTabSchema==pTab->pSchema\r\n       && 0==sqlite3StrICmp(pTrig->table, pTab->zName) \r\n      ){\r\n        pTrig->pNext = (pList ? pList : pTab->pTrigger);\r\n        pList = pTrig;\r\n      }\r\n    }\r\n  }\r\n\r\n  return (pList ? pList : pTab->pTrigger);\r\n}\r\n\r\n/*\r\n** This is called by the parser when it sees a CREATE TRIGGER statement\r\n** up to the point of the BEGIN before the trigger actions.  A Trigger\r\n** structure is generated based on the information available and stored\r\n** in pParse->pNewTrigger.  After the trigger actions have been parsed, the\r\n** sqlite3FinishTrigger() function is called to complete the trigger\r\n** construction process.\r\n*/\r\nSQLITE_PRIVATE void sqlite3BeginTrigger(\r\n  Parse *pParse,      /* The parse context of the CREATE TRIGGER statement */\r\n  Token *pName1,      /* The name of the trigger */\r\n  Token *pName2,      /* The name of the trigger */\r\n  int tr_tm,          /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */\r\n  int op,             /* One of TK_INSERT, TK_UPDATE, TK_DELETE */\r\n  IdList *pColumns,   /* column list if this is an UPDATE OF trigger */\r\n  SrcList *pTableName,/* The name of the table/view the trigger applies to */\r\n  Expr *pWhen,        /* WHEN clause */\r\n  int isTemp,         /* True if the TEMPORARY keyword is present */\r\n  int noErr           /* Suppress errors if the trigger already exists */\r\n){\r\n  Trigger *pTrigger = 0;  /* The new trigger */\r\n  Table *pTab;            /* Table that the trigger fires off of */\r\n  char *zName = 0;        /* Name of the trigger */\r\n  sqlite3 *db = pParse->db;  /* The database connection */\r\n  int iDb;                /* The database to store the trigger in */\r\n  Token *pName;           /* The unqualified db name */\r\n  DbFixer sFix;           /* State vector for the DB fixer */\r\n  int iTabDb;             /* Index of the database holding pTab */\r\n\r\n  assert( pName1!=0 );   /* pName1->z might be NULL, but not pName1 itself */\r\n  assert( pName2!=0 );\r\n  assert( op==TK_INSERT || op==TK_UPDATE || op==TK_DELETE );\r\n  assert( op>0 && op<0xff );\r\n  if( isTemp ){\r\n    /* If TEMP was specified, then the trigger name may not be qualified. */\r\n    if( pName2->n>0 ){\r\n      sqlite3ErrorMsg(pParse, \"temporary trigger may not have qualified name\");\r\n      goto trigger_cleanup;\r\n    }\r\n    iDb = 1;\r\n    pName = pName1;\r\n  }else{\r\n    /* Figure out the db that the the trigger will be created in */\r\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);\r\n    if( iDb<0 ){\r\n      goto trigger_cleanup;\r\n    }\r\n  }\r\n  if( !pTableName || db->mallocFailed ){\r\n    goto trigger_cleanup;\r\n  }\r\n\r\n  /* A long-standing parser bug is that this syntax was allowed:\r\n  **\r\n  **    CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....\r\n  **                                                 ^^^^^^^^\r\n  **\r\n  ** To maintain backwards compatibility, ignore the database\r\n  ** name on pTableName if we are reparsing our of SQLITE_MASTER.\r\n  */\r\n  if( db->init.busy && iDb!=1 ){\r\n    sqlite3DbFree(db, pTableName->a[0].zDatabase);\r\n    pTableName->a[0].zDatabase = 0;\r\n  }\r\n\r\n  /* If the trigger name was unqualified, and the table is a temp table,\r\n  ** then set iDb to 1 to create the trigger in the temporary database.\r\n  ** If sqlite3SrcListLookup() returns 0, indicating the table does not\r\n  ** exist, the error is caught by the block below.\r\n  */\r\n  pTab = sqlite3SrcListLookup(pParse, pTableName);\r\n  if( db->init.busy==0 && pName2->n==0 && pTab\r\n        && pTab->pSchema==db->aDb[1].pSchema ){\r\n    iDb = 1;\r\n  }\r\n\r\n  /* Ensure the table name matches database name and that the table exists */\r\n  if( db->mallocFailed ) goto trigger_cleanup;\r\n  assert( pTableName->nSrc==1 );\r\n  if( sqlite3FixInit(&sFix, pParse, iDb, \"trigger\", pName) && \r\n      sqlite3FixSrcList(&sFix, pTableName) ){\r\n    goto trigger_cleanup;\r\n  }\r\n  pTab = sqlite3SrcListLookup(pParse, pTableName);\r\n  if( !pTab ){\r\n    /* The table does not exist. */\r\n    if( db->init.iDb==1 ){\r\n      /* Ticket #3810.\r\n      ** Normally, whenever a table is dropped, all associated triggers are\r\n      ** dropped too.  But if a TEMP trigger is created on a non-TEMP table\r\n      ** and the table is dropped by a different database connection, the\r\n      ** trigger is not visible to the database connection that does the\r\n      ** drop so the trigger cannot be dropped.  This results in an\r\n      ** \"orphaned trigger\" - a trigger whose associated table is missing.\r\n      */\r\n      db->init.orphanTrigger = 1;\r\n    }\r\n    goto trigger_cleanup;\r\n  }\r\n  if( IsVirtual(pTab) ){\r\n    sqlite3ErrorMsg(pParse, \"cannot create triggers on virtual tables\");\r\n    goto trigger_cleanup;\r\n  }\r\n\r\n  /* Check that the trigger name is not reserved and that no trigger of the\r\n  ** specified name exists */\r\n  zName = sqlite3NameFromToken(db, pName);\r\n  if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){\r\n    goto trigger_cleanup;\r\n  }\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),\r\n                      zName, sqlite3Strlen30(zName)) ){\r\n    if( !noErr ){\r\n      sqlite3ErrorMsg(pParse, \"trigger %T already exists\", pName);\r\n    }else{\r\n      assert( !db->init.busy );\r\n      sqlite3CodeVerifySchema(pParse, iDb);\r\n    }\r\n    goto trigger_cleanup;\r\n  }\r\n\r\n  /* Do not create a trigger on a system table */\r\n  if( sqlite3StrNICmp(pTab->zName, \"sqlite_\", 7)==0 ){\r\n    sqlite3ErrorMsg(pParse, \"cannot create trigger on system table\");\r\n    pParse->nErr++;\r\n    goto trigger_cleanup;\r\n  }\r\n\r\n  /* INSTEAD of triggers are only for views and views only support INSTEAD\r\n  ** of triggers.\r\n  */\r\n  if( pTab->pSelect && tr_tm!=TK_INSTEAD ){\r\n    sqlite3ErrorMsg(pParse, \"cannot create %s trigger on view: %S\", \r\n        (tr_tm == TK_BEFORE)?\"BEFORE\":\"AFTER\", pTableName, 0);\r\n    goto trigger_cleanup;\r\n  }\r\n  if( !pTab->pSelect && tr_tm==TK_INSTEAD ){\r\n    sqlite3ErrorMsg(pParse, \"cannot create INSTEAD OF\"\r\n        \" trigger on table: %S\", pTableName, 0);\r\n    goto trigger_cleanup;\r\n  }\r\n  iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  {\r\n    int code = SQLITE_CREATE_TRIGGER;\r\n    const char *zDb = db->aDb[iTabDb].zName;\r\n    const char *zDbTrig = isTemp ? db->aDb[1].zName : zDb;\r\n    if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;\r\n    if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){\r\n      goto trigger_cleanup;\r\n    }\r\n    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){\r\n      goto trigger_cleanup;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* INSTEAD OF triggers can only appear on views and BEFORE triggers\r\n  ** cannot appear on views.  So we might as well translate every\r\n  ** INSTEAD OF trigger into a BEFORE trigger.  It simplifies code\r\n  ** elsewhere.\r\n  */\r\n  if (tr_tm == TK_INSTEAD){\r\n    tr_tm = TK_BEFORE;\r\n  }\r\n\r\n  /* Build the Trigger object */\r\n  pTrigger = (Trigger*)sqlite3DbMallocZero(db, sizeof(Trigger));\r\n  if( pTrigger==0 ) goto trigger_cleanup;\r\n  pTrigger->zName = zName;\r\n  zName = 0;\r\n  pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName);\r\n  pTrigger->pSchema = db->aDb[iDb].pSchema;\r\n  pTrigger->pTabSchema = pTab->pSchema;\r\n  pTrigger->op = (u8)op;\r\n  pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER;\r\n  pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE);\r\n  pTrigger->pColumns = sqlite3IdListDup(db, pColumns);\r\n  assert( pParse->pNewTrigger==0 );\r\n  pParse->pNewTrigger = pTrigger;\r\n\r\ntrigger_cleanup:\r\n  sqlite3DbFree(db, zName);\r\n  sqlite3SrcListDelete(db, pTableName);\r\n  sqlite3IdListDelete(db, pColumns);\r\n  sqlite3ExprDelete(db, pWhen);\r\n  if( !pParse->pNewTrigger ){\r\n    sqlite3DeleteTrigger(db, pTrigger);\r\n  }else{\r\n    assert( pParse->pNewTrigger==pTrigger );\r\n  }\r\n}\r\n\r\n/*\r\n** This routine is called after all of the trigger actions have been parsed\r\n** in order to complete the process of building the trigger.\r\n*/\r\nSQLITE_PRIVATE void sqlite3FinishTrigger(\r\n  Parse *pParse,          /* Parser context */\r\n  TriggerStep *pStepList, /* The triggered program */\r\n  Token *pAll             /* Token that describes the complete CREATE TRIGGER */\r\n){\r\n  Trigger *pTrig = pParse->pNewTrigger;   /* Trigger being finished */\r\n  char *zName;                            /* Name of trigger */\r\n  sqlite3 *db = pParse->db;               /* The database */\r\n  DbFixer sFix;                           /* Fixer object */\r\n  int iDb;                                /* Database containing the trigger */\r\n  Token nameToken;                        /* Trigger name for error reporting */\r\n\r\n  pParse->pNewTrigger = 0;\r\n  if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup;\r\n  zName = pTrig->zName;\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);\r\n  pTrig->step_list = pStepList;\r\n  while( pStepList ){\r\n    pStepList->pTrig = pTrig;\r\n    pStepList = pStepList->pNext;\r\n  }\r\n  nameToken.z = pTrig->zName;\r\n  nameToken.n = sqlite3Strlen30(nameToken.z);\r\n  if( sqlite3FixInit(&sFix, pParse, iDb, \"trigger\", &nameToken) \r\n          && sqlite3FixTriggerStep(&sFix, pTrig->step_list) ){\r\n    goto triggerfinish_cleanup;\r\n  }\r\n\r\n  /* if we are not initializing,\r\n  ** build the sqlite_master entry\r\n  */\r\n  if( !db->init.busy ){\r\n    Vdbe *v;\r\n    char *z;\r\n\r\n    /* Make an entry in the sqlite_master table */\r\n    v = sqlite3GetVdbe(pParse);\r\n    if( v==0 ) goto triggerfinish_cleanup;\r\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n    z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n);\r\n    sqlite3NestedParse(pParse,\r\n       \"INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\",\r\n       db->aDb[iDb].zName, SCHEMA_TABLE(iDb), zName,\r\n       pTrig->table, z);\r\n    sqlite3DbFree(db, z);\r\n    sqlite3ChangeCookie(pParse, iDb);\r\n    sqlite3VdbeAddParseSchemaOp(v, iDb,\r\n        sqlite3MPrintf(db, \"type='trigger' AND name='%q'\", zName));\r\n  }\r\n\r\n  if( db->init.busy ){\r\n    Trigger *pLink = pTrig;\r\n    Hash *pHash = &db->aDb[iDb].pSchema->trigHash;\r\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n    pTrig = sqlite3HashInsert(pHash, zName, sqlite3Strlen30(zName), pTrig);\r\n    if( pTrig ){\r\n      db->mallocFailed = 1;\r\n    }else if( pLink->pSchema==pLink->pTabSchema ){\r\n      Table *pTab;\r\n      int n = sqlite3Strlen30(pLink->table);\r\n      pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table, n);\r\n      assert( pTab!=0 );\r\n      pLink->pNext = pTab->pTrigger;\r\n      pTab->pTrigger = pLink;\r\n    }\r\n  }\r\n\r\ntriggerfinish_cleanup:\r\n  sqlite3DeleteTrigger(db, pTrig);\r\n  assert( !pParse->pNewTrigger );\r\n  sqlite3DeleteTriggerStep(db, pStepList);\r\n}\r\n\r\n/*\r\n** Turn a SELECT statement (that the pSelect parameter points to) into\r\n** a trigger step.  Return a pointer to a TriggerStep structure.\r\n**\r\n** The parser calls this routine when it finds a SELECT statement in\r\n** body of a TRIGGER.  \r\n*/\r\nSQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3 *db, Select *pSelect){\r\n  TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));\r\n  if( pTriggerStep==0 ) {\r\n    sqlite3SelectDelete(db, pSelect);\r\n    return 0;\r\n  }\r\n  pTriggerStep->op = TK_SELECT;\r\n  pTriggerStep->pSelect = pSelect;\r\n  pTriggerStep->orconf = OE_Default;\r\n  return pTriggerStep;\r\n}\r\n\r\n/*\r\n** Allocate space to hold a new trigger step.  The allocated space\r\n** holds both the TriggerStep object and the TriggerStep.target.z string.\r\n**\r\n** If an OOM error occurs, NULL is returned and db->mallocFailed is set.\r\n*/\r\nstatic TriggerStep *triggerStepAllocate(\r\n  sqlite3 *db,                /* Database connection */\r\n  u8 op,                      /* Trigger opcode */\r\n  Token *pName                /* The target name */\r\n){\r\n  TriggerStep *pTriggerStep;\r\n\r\n  pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n);\r\n  if( pTriggerStep ){\r\n    char *z = (char*)&pTriggerStep[1];\r\n    memcpy(z, pName->z, pName->n);\r\n    pTriggerStep->target.z = z;\r\n    pTriggerStep->target.n = pName->n;\r\n    pTriggerStep->op = op;\r\n  }\r\n  return pTriggerStep;\r\n}\r\n\r\n/*\r\n** Build a trigger step out of an INSERT statement.  Return a pointer\r\n** to the new trigger step.\r\n**\r\n** The parser calls this routine when it sees an INSERT inside the\r\n** body of a trigger.\r\n*/\r\nSQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(\r\n  sqlite3 *db,        /* The database connection */\r\n  Token *pTableName,  /* Name of the table into which we insert */\r\n  IdList *pColumn,    /* List of columns in pTableName to insert into */\r\n  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */\r\n  Select *pSelect,    /* A SELECT statement that supplies values */\r\n  u8 orconf           /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */\r\n){\r\n  TriggerStep *pTriggerStep;\r\n\r\n  assert(pEList == 0 || pSelect == 0);\r\n  assert(pEList != 0 || pSelect != 0 || db->mallocFailed);\r\n\r\n  pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName);\r\n  if( pTriggerStep ){\r\n    pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);\r\n    pTriggerStep->pIdList = pColumn;\r\n    pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);\r\n    pTriggerStep->orconf = orconf;\r\n  }else{\r\n    sqlite3IdListDelete(db, pColumn);\r\n  }\r\n  sqlite3ExprListDelete(db, pEList);\r\n  sqlite3SelectDelete(db, pSelect);\r\n\r\n  return pTriggerStep;\r\n}\r\n\r\n/*\r\n** Construct a trigger step that implements an UPDATE statement and return\r\n** a pointer to that trigger step.  The parser calls this routine when it\r\n** sees an UPDATE statement inside the body of a CREATE TRIGGER.\r\n*/\r\nSQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(\r\n  sqlite3 *db,         /* The database connection */\r\n  Token *pTableName,   /* Name of the table to be updated */\r\n  ExprList *pEList,    /* The SET clause: list of column and new values */\r\n  Expr *pWhere,        /* The WHERE clause */\r\n  u8 orconf            /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */\r\n){\r\n  TriggerStep *pTriggerStep;\r\n\r\n  pTriggerStep = triggerStepAllocate(db, TK_UPDATE, pTableName);\r\n  if( pTriggerStep ){\r\n    pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);\r\n    pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);\r\n    pTriggerStep->orconf = orconf;\r\n  }\r\n  sqlite3ExprListDelete(db, pEList);\r\n  sqlite3ExprDelete(db, pWhere);\r\n  return pTriggerStep;\r\n}\r\n\r\n/*\r\n** Construct a trigger step that implements a DELETE statement and return\r\n** a pointer to that trigger step.  The parser calls this routine when it\r\n** sees a DELETE statement inside the body of a CREATE TRIGGER.\r\n*/\r\nSQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(\r\n  sqlite3 *db,            /* Database connection */\r\n  Token *pTableName,      /* The table from which rows are deleted */\r\n  Expr *pWhere            /* The WHERE clause */\r\n){\r\n  TriggerStep *pTriggerStep;\r\n\r\n  pTriggerStep = triggerStepAllocate(db, TK_DELETE, pTableName);\r\n  if( pTriggerStep ){\r\n    pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);\r\n    pTriggerStep->orconf = OE_Default;\r\n  }\r\n  sqlite3ExprDelete(db, pWhere);\r\n  return pTriggerStep;\r\n}\r\n\r\n/* \r\n** Recursively delete a Trigger structure\r\n*/\r\nSQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3 *db, Trigger *pTrigger){\r\n  if( pTrigger==0 ) return;\r\n  sqlite3DeleteTriggerStep(db, pTrigger->step_list);\r\n  sqlite3DbFree(db, pTrigger->zName);\r\n  sqlite3DbFree(db, pTrigger->table);\r\n  sqlite3ExprDelete(db, pTrigger->pWhen);\r\n  sqlite3IdListDelete(db, pTrigger->pColumns);\r\n  sqlite3DbFree(db, pTrigger);\r\n}\r\n\r\n/*\r\n** This function is called to drop a trigger from the database schema. \r\n**\r\n** This may be called directly from the parser and therefore identifies\r\n** the trigger by name.  The sqlite3DropTriggerPtr() routine does the\r\n** same job as this routine except it takes a pointer to the trigger\r\n** instead of the trigger name.\r\n**/\r\nSQLITE_PRIVATE void sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){\r\n  Trigger *pTrigger = 0;\r\n  int i;\r\n  const char *zDb;\r\n  const char *zName;\r\n  int nName;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  if( db->mallocFailed ) goto drop_trigger_cleanup;\r\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\r\n    goto drop_trigger_cleanup;\r\n  }\r\n\r\n  assert( pName->nSrc==1 );\r\n  zDb = pName->a[0].zDatabase;\r\n  zName = pName->a[0].zName;\r\n  nName = sqlite3Strlen30(zName);\r\n  assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) );\r\n  for(i=OMIT_TEMPDB; i<db->nDb; i++){\r\n    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */\r\n    if( zDb && sqlite3StrICmp(db->aDb[j].zName, zDb) ) continue;\r\n    assert( sqlite3SchemaMutexHeld(db, j, 0) );\r\n    pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName, nName);\r\n    if( pTrigger ) break;\r\n  }\r\n  if( !pTrigger ){\r\n    if( !noErr ){\r\n      sqlite3ErrorMsg(pParse, \"no such trigger: %S\", pName, 0);\r\n    }else{\r\n      sqlite3CodeVerifyNamedSchema(pParse, zDb);\r\n    }\r\n    pParse->checkSchema = 1;\r\n    goto drop_trigger_cleanup;\r\n  }\r\n  sqlite3DropTriggerPtr(pParse, pTrigger);\r\n\r\ndrop_trigger_cleanup:\r\n  sqlite3SrcListDelete(db, pName);\r\n}\r\n\r\n/*\r\n** Return a pointer to the Table structure for the table that a trigger\r\n** is set on.\r\n*/\r\nstatic Table *tableOfTrigger(Trigger *pTrigger){\r\n  int n = sqlite3Strlen30(pTrigger->table);\r\n  return sqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table, n);\r\n}\r\n\r\n\r\n/*\r\n** Drop a trigger given a pointer to that trigger. \r\n*/\r\nSQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){\r\n  Table   *pTable;\r\n  Vdbe *v;\r\n  sqlite3 *db = pParse->db;\r\n  int iDb;\r\n\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);\r\n  assert( iDb>=0 && iDb<db->nDb );\r\n  pTable = tableOfTrigger(pTrigger);\r\n  assert( pTable );\r\n  assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  {\r\n    int code = SQLITE_DROP_TRIGGER;\r\n    const char *zDb = db->aDb[iDb].zName;\r\n    const char *zTab = SCHEMA_TABLE(iDb);\r\n    if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER;\r\n    if( sqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) ||\r\n      sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){\r\n      return;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Generate code to destroy the database record of the trigger.\r\n  */\r\n  assert( pTable!=0 );\r\n  if( (v = sqlite3GetVdbe(pParse))!=0 ){\r\n    int base;\r\n    static const VdbeOpList dropTrigger[] = {\r\n      { OP_Rewind,     0, ADDR(9),  0},\r\n      { OP_String8,    0, 1,        0}, /* 1 */\r\n      { OP_Column,     0, 1,        2},\r\n      { OP_Ne,         2, ADDR(8),  1},\r\n      { OP_String8,    0, 1,        0}, /* 4: \"trigger\" */\r\n      { OP_Column,     0, 0,        2},\r\n      { OP_Ne,         2, ADDR(8),  1},\r\n      { OP_Delete,     0, 0,        0},\r\n      { OP_Next,       0, ADDR(1),  0}, /* 8 */\r\n    };\r\n\r\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\r\n    sqlite3OpenMasterTable(pParse, iDb);\r\n    base = sqlite3VdbeAddOpList(v,  ArraySize(dropTrigger), dropTrigger);\r\n    sqlite3VdbeChangeP4(v, base+1, pTrigger->zName, P4_TRANSIENT);\r\n    sqlite3VdbeChangeP4(v, base+4, \"trigger\", P4_STATIC);\r\n    sqlite3ChangeCookie(pParse, iDb);\r\n    sqlite3VdbeAddOp2(v, OP_Close, 0, 0);\r\n    sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0);\r\n    if( pParse->nMem<3 ){\r\n      pParse->nMem = 3;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Remove a trigger from the hash tables of the sqlite* pointer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){\r\n  Trigger *pTrigger;\r\n  Hash *pHash;\r\n\r\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\r\n  pHash = &(db->aDb[iDb].pSchema->trigHash);\r\n  pTrigger = sqlite3HashInsert(pHash, zName, sqlite3Strlen30(zName), 0);\r\n  if( ALWAYS(pTrigger) ){\r\n    if( pTrigger->pSchema==pTrigger->pTabSchema ){\r\n      Table *pTab = tableOfTrigger(pTrigger);\r\n      Trigger **pp;\r\n      for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));\r\n      *pp = (*pp)->pNext;\r\n    }\r\n    sqlite3DeleteTrigger(db, pTrigger);\r\n    db->flags |= SQLITE_InternChanges;\r\n  }\r\n}\r\n\r\n/*\r\n** pEList is the SET clause of an UPDATE statement.  Each entry\r\n** in pEList is of the format <id>=<expr>.  If any of the entries\r\n** in pEList have an <id> which matches an identifier in pIdList,\r\n** then return TRUE.  If pIdList==NULL, then it is considered a\r\n** wildcard that matches anything.  Likewise if pEList==NULL then\r\n** it matches anything so always return true.  Return false only\r\n** if there is no match.\r\n*/\r\nstatic int checkColumnOverlap(IdList *pIdList, ExprList *pEList){\r\n  int e;\r\n  if( pIdList==0 || NEVER(pEList==0) ) return 1;\r\n  for(e=0; e<pEList->nExpr; e++){\r\n    if( sqlite3IdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1;\r\n  }\r\n  return 0; \r\n}\r\n\r\n/*\r\n** Return a list of all triggers on table pTab if there exists at least\r\n** one trigger that must be fired when an operation of type 'op' is \r\n** performed on the table, and, if that operation is an UPDATE, if at\r\n** least one of the columns in pChanges is being modified.\r\n*/\r\nSQLITE_PRIVATE Trigger *sqlite3TriggersExist(\r\n  Parse *pParse,          /* Parse context */\r\n  Table *pTab,            /* The table the contains the triggers */\r\n  int op,                 /* one of TK_DELETE, TK_INSERT, TK_UPDATE */\r\n  ExprList *pChanges,     /* Columns that change in an UPDATE statement */\r\n  int *pMask              /* OUT: Mask of TRIGGER_BEFORE|TRIGGER_AFTER */\r\n){\r\n  int mask = 0;\r\n  Trigger *pList = 0;\r\n  Trigger *p;\r\n\r\n  if( (pParse->db->flags & SQLITE_EnableTrigger)!=0 ){\r\n    pList = sqlite3TriggerList(pParse, pTab);\r\n  }\r\n  assert( pList==0 || IsVirtual(pTab)==0 );\r\n  for(p=pList; p; p=p->pNext){\r\n    if( p->op==op && checkColumnOverlap(p->pColumns, pChanges) ){\r\n      mask |= p->tr_tm;\r\n    }\r\n  }\r\n  if( pMask ){\r\n    *pMask = mask;\r\n  }\r\n  return (mask ? pList : 0);\r\n}\r\n\r\n/*\r\n** Convert the pStep->target token into a SrcList and return a pointer\r\n** to that SrcList.\r\n**\r\n** This routine adds a specific database name, if needed, to the target when\r\n** forming the SrcList.  This prevents a trigger in one database from\r\n** referring to a target in another database.  An exception is when the\r\n** trigger is in TEMP in which case it can refer to any other database it\r\n** wants.\r\n*/\r\nstatic SrcList *targetSrcList(\r\n  Parse *pParse,       /* The parsing context */\r\n  TriggerStep *pStep   /* The trigger containing the target token */\r\n){\r\n  int iDb;             /* Index of the database to use */\r\n  SrcList *pSrc;       /* SrcList to be returned */\r\n\r\n  pSrc = sqlite3SrcListAppend(pParse->db, 0, &pStep->target, 0);\r\n  if( pSrc ){\r\n    assert( pSrc->nSrc>0 );\r\n    assert( pSrc->a!=0 );\r\n    iDb = sqlite3SchemaToIndex(pParse->db, pStep->pTrig->pSchema);\r\n    if( iDb==0 || iDb>=2 ){\r\n      sqlite3 *db = pParse->db;\r\n      assert( iDb<pParse->db->nDb );\r\n      pSrc->a[pSrc->nSrc-1].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zName);\r\n    }\r\n  }\r\n  return pSrc;\r\n}\r\n\r\n/*\r\n** Generate VDBE code for the statements inside the body of a single \r\n** trigger.\r\n*/\r\nstatic int codeTriggerProgram(\r\n  Parse *pParse,            /* The parser context */\r\n  TriggerStep *pStepList,   /* List of statements inside the trigger body */\r\n  int orconf                /* Conflict algorithm. (OE_Abort, etc) */  \r\n){\r\n  TriggerStep *pStep;\r\n  Vdbe *v = pParse->pVdbe;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  assert( pParse->pTriggerTab && pParse->pToplevel );\r\n  assert( pStepList );\r\n  assert( v!=0 );\r\n  for(pStep=pStepList; pStep; pStep=pStep->pNext){\r\n    /* Figure out the ON CONFLICT policy that will be used for this step\r\n    ** of the trigger program. If the statement that caused this trigger\r\n    ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use\r\n    ** the ON CONFLICT policy that was specified as part of the trigger\r\n    ** step statement. Example:\r\n    **\r\n    **   CREATE TRIGGER AFTER INSERT ON t1 BEGIN;\r\n    **     INSERT OR REPLACE INTO t2 VALUES(new.a, new.b);\r\n    **   END;\r\n    **\r\n    **   INSERT INTO t1 ... ;            -- insert into t2 uses REPLACE policy\r\n    **   INSERT OR IGNORE INTO t1 ... ;  -- insert into t2 uses IGNORE policy\r\n    */\r\n    pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:(u8)orconf;\r\n\r\n    switch( pStep->op ){\r\n      case TK_UPDATE: {\r\n        sqlite3Update(pParse, \r\n          targetSrcList(pParse, pStep),\r\n          sqlite3ExprListDup(db, pStep->pExprList, 0), \r\n          sqlite3ExprDup(db, pStep->pWhere, 0), \r\n          pParse->eOrconf\r\n        );\r\n        break;\r\n      }\r\n      case TK_INSERT: {\r\n        sqlite3Insert(pParse, \r\n          targetSrcList(pParse, pStep),\r\n          sqlite3ExprListDup(db, pStep->pExprList, 0), \r\n          sqlite3SelectDup(db, pStep->pSelect, 0), \r\n          sqlite3IdListDup(db, pStep->pIdList), \r\n          pParse->eOrconf\r\n        );\r\n        break;\r\n      }\r\n      case TK_DELETE: {\r\n        sqlite3DeleteFrom(pParse, \r\n          targetSrcList(pParse, pStep),\r\n          sqlite3ExprDup(db, pStep->pWhere, 0)\r\n        );\r\n        break;\r\n      }\r\n      default: assert( pStep->op==TK_SELECT ); {\r\n        SelectDest sDest;\r\n        Select *pSelect = sqlite3SelectDup(db, pStep->pSelect, 0);\r\n        sqlite3SelectDestInit(&sDest, SRT_Discard, 0);\r\n        sqlite3Select(pParse, pSelect, &sDest);\r\n        sqlite3SelectDelete(db, pSelect);\r\n        break;\r\n      }\r\n    } \r\n    if( pStep->op!=TK_SELECT ){\r\n      sqlite3VdbeAddOp0(v, OP_ResetCount);\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n#ifdef SQLITE_DEBUG\r\n/*\r\n** This function is used to add VdbeComment() annotations to a VDBE\r\n** program. It is not used in production code, only for debugging.\r\n*/\r\nstatic const char *onErrorText(int onError){\r\n  switch( onError ){\r\n    case OE_Abort:    return \"abort\";\r\n    case OE_Rollback: return \"rollback\";\r\n    case OE_Fail:     return \"fail\";\r\n    case OE_Replace:  return \"replace\";\r\n    case OE_Ignore:   return \"ignore\";\r\n    case OE_Default:  return \"default\";\r\n  }\r\n  return \"n/a\";\r\n}\r\n#endif\r\n\r\n/*\r\n** Parse context structure pFrom has just been used to create a sub-vdbe\r\n** (trigger program). If an error has occurred, transfer error information\r\n** from pFrom to pTo.\r\n*/\r\nstatic void transferParseError(Parse *pTo, Parse *pFrom){\r\n  assert( pFrom->zErrMsg==0 || pFrom->nErr );\r\n  assert( pTo->zErrMsg==0 || pTo->nErr );\r\n  if( pTo->nErr==0 ){\r\n    pTo->zErrMsg = pFrom->zErrMsg;\r\n    pTo->nErr = pFrom->nErr;\r\n  }else{\r\n    sqlite3DbFree(pFrom->db, pFrom->zErrMsg);\r\n  }\r\n}\r\n\r\n/*\r\n** Create and populate a new TriggerPrg object with a sub-program \r\n** implementing trigger pTrigger with ON CONFLICT policy orconf.\r\n*/\r\nstatic TriggerPrg *codeRowTrigger(\r\n  Parse *pParse,       /* Current parse context */\r\n  Trigger *pTrigger,   /* Trigger to code */\r\n  Table *pTab,         /* The table pTrigger is attached to */\r\n  int orconf           /* ON CONFLICT policy to code trigger program with */\r\n){\r\n  Parse *pTop = sqlite3ParseToplevel(pParse);\r\n  sqlite3 *db = pParse->db;   /* Database handle */\r\n  TriggerPrg *pPrg;           /* Value to return */\r\n  Expr *pWhen = 0;            /* Duplicate of trigger WHEN expression */\r\n  Vdbe *v;                    /* Temporary VM */\r\n  NameContext sNC;            /* Name context for sub-vdbe */\r\n  SubProgram *pProgram = 0;   /* Sub-vdbe for trigger program */\r\n  Parse *pSubParse;           /* Parse context for sub-vdbe */\r\n  int iEndTrigger = 0;        /* Label to jump to if WHEN is false */\r\n\r\n  assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );\r\n  assert( pTop->pVdbe );\r\n\r\n  /* Allocate the TriggerPrg and SubProgram objects. To ensure that they\r\n  ** are freed if an error occurs, link them into the Parse.pTriggerPrg \r\n  ** list of the top-level Parse object sooner rather than later.  */\r\n  pPrg = sqlite3DbMallocZero(db, sizeof(TriggerPrg));\r\n  if( !pPrg ) return 0;\r\n  pPrg->pNext = pTop->pTriggerPrg;\r\n  pTop->pTriggerPrg = pPrg;\r\n  pPrg->pProgram = pProgram = sqlite3DbMallocZero(db, sizeof(SubProgram));\r\n  if( !pProgram ) return 0;\r\n  sqlite3VdbeLinkSubProgram(pTop->pVdbe, pProgram);\r\n  pPrg->pTrigger = pTrigger;\r\n  pPrg->orconf = orconf;\r\n  pPrg->aColmask[0] = 0xffffffff;\r\n  pPrg->aColmask[1] = 0xffffffff;\r\n\r\n  /* Allocate and populate a new Parse context to use for coding the \r\n  ** trigger sub-program.  */\r\n  pSubParse = sqlite3StackAllocZero(db, sizeof(Parse));\r\n  if( !pSubParse ) return 0;\r\n  memset(&sNC, 0, sizeof(sNC));\r\n  sNC.pParse = pSubParse;\r\n  pSubParse->db = db;\r\n  pSubParse->pTriggerTab = pTab;\r\n  pSubParse->pToplevel = pTop;\r\n  pSubParse->zAuthContext = pTrigger->zName;\r\n  pSubParse->eTriggerOp = pTrigger->op;\r\n  pSubParse->nQueryLoop = pParse->nQueryLoop;\r\n\r\n  v = sqlite3GetVdbe(pSubParse);\r\n  if( v ){\r\n    VdbeComment((v, \"Start: %s.%s (%s %s%s%s ON %s)\", \r\n      pTrigger->zName, onErrorText(orconf),\r\n      (pTrigger->tr_tm==TRIGGER_BEFORE ? \"BEFORE\" : \"AFTER\"),\r\n        (pTrigger->op==TK_UPDATE ? \"UPDATE\" : \"\"),\r\n        (pTrigger->op==TK_INSERT ? \"INSERT\" : \"\"),\r\n        (pTrigger->op==TK_DELETE ? \"DELETE\" : \"\"),\r\n      pTab->zName\r\n    ));\r\n#ifndef SQLITE_OMIT_TRACE\r\n    sqlite3VdbeChangeP4(v, -1, \r\n      sqlite3MPrintf(db, \"-- TRIGGER %s\", pTrigger->zName), P4_DYNAMIC\r\n    );\r\n#endif\r\n\r\n    /* If one was specified, code the WHEN clause. If it evaluates to false\r\n    ** (or NULL) the sub-vdbe is immediately halted by jumping to the \r\n    ** OP_Halt inserted at the end of the program.  */\r\n    if( pTrigger->pWhen ){\r\n      pWhen = sqlite3ExprDup(db, pTrigger->pWhen, 0);\r\n      if( SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) \r\n       && db->mallocFailed==0 \r\n      ){\r\n        iEndTrigger = sqlite3VdbeMakeLabel(v);\r\n        sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL);\r\n      }\r\n      sqlite3ExprDelete(db, pWhen);\r\n    }\r\n\r\n    /* Code the trigger program into the sub-vdbe. */\r\n    codeTriggerProgram(pSubParse, pTrigger->step_list, orconf);\r\n\r\n    /* Insert an OP_Halt at the end of the sub-program. */\r\n    if( iEndTrigger ){\r\n      sqlite3VdbeResolveLabel(v, iEndTrigger);\r\n    }\r\n    sqlite3VdbeAddOp0(v, OP_Halt);\r\n    VdbeComment((v, \"End: %s.%s\", pTrigger->zName, onErrorText(orconf)));\r\n\r\n    transferParseError(pParse, pSubParse);\r\n    if( db->mallocFailed==0 ){\r\n      pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);\r\n    }\r\n    pProgram->nMem = pSubParse->nMem;\r\n    pProgram->nCsr = pSubParse->nTab;\r\n    pProgram->nOnce = pSubParse->nOnce;\r\n    pProgram->token = (void *)pTrigger;\r\n    pPrg->aColmask[0] = pSubParse->oldmask;\r\n    pPrg->aColmask[1] = pSubParse->newmask;\r\n    sqlite3VdbeDelete(v);\r\n  }\r\n\r\n  assert( !pSubParse->pAinc       && !pSubParse->pZombieTab );\r\n  assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg );\r\n  sqlite3StackFree(db, pSubParse);\r\n\r\n  return pPrg;\r\n}\r\n    \r\n/*\r\n** Return a pointer to a TriggerPrg object containing the sub-program for\r\n** trigger pTrigger with default ON CONFLICT algorithm orconf. If no such\r\n** TriggerPrg object exists, a new object is allocated and populated before\r\n** being returned.\r\n*/\r\nstatic TriggerPrg *getRowTrigger(\r\n  Parse *pParse,       /* Current parse context */\r\n  Trigger *pTrigger,   /* Trigger to code */\r\n  Table *pTab,         /* The table trigger pTrigger is attached to */\r\n  int orconf           /* ON CONFLICT algorithm. */\r\n){\r\n  Parse *pRoot = sqlite3ParseToplevel(pParse);\r\n  TriggerPrg *pPrg;\r\n\r\n  assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );\r\n\r\n  /* It may be that this trigger has already been coded (or is in the\r\n  ** process of being coded). If this is the case, then an entry with\r\n  ** a matching TriggerPrg.pTrigger field will be present somewhere\r\n  ** in the Parse.pTriggerPrg list. Search for such an entry.  */\r\n  for(pPrg=pRoot->pTriggerPrg; \r\n      pPrg && (pPrg->pTrigger!=pTrigger || pPrg->orconf!=orconf); \r\n      pPrg=pPrg->pNext\r\n  );\r\n\r\n  /* If an existing TriggerPrg could not be located, create a new one. */\r\n  if( !pPrg ){\r\n    pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf);\r\n  }\r\n\r\n  return pPrg;\r\n}\r\n\r\n/*\r\n** Generate code for the trigger program associated with trigger p on \r\n** table pTab. The reg, orconf and ignoreJump parameters passed to this\r\n** function are the same as those described in the header function for\r\n** sqlite3CodeRowTrigger()\r\n*/\r\nSQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(\r\n  Parse *pParse,       /* Parse context */\r\n  Trigger *p,          /* Trigger to code */\r\n  Table *pTab,         /* The table to code triggers from */\r\n  int reg,             /* Reg array containing OLD.* and NEW.* values */\r\n  int orconf,          /* ON CONFLICT policy */\r\n  int ignoreJump       /* Instruction to jump to for RAISE(IGNORE) */\r\n){\r\n  Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */\r\n  TriggerPrg *pPrg;\r\n  pPrg = getRowTrigger(pParse, p, pTab, orconf);\r\n  assert( pPrg || pParse->nErr || pParse->db->mallocFailed );\r\n\r\n  /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program \r\n  ** is a pointer to the sub-vdbe containing the trigger program.  */\r\n  if( pPrg ){\r\n    int bRecursive = (p->zName && 0==(pParse->db->flags&SQLITE_RecTriggers));\r\n\r\n    sqlite3VdbeAddOp3(v, OP_Program, reg, ignoreJump, ++pParse->nMem);\r\n    sqlite3VdbeChangeP4(v, -1, (const char *)pPrg->pProgram, P4_SUBPROGRAM);\r\n    VdbeComment(\r\n        (v, \"Call: %s.%s\", (p->zName?p->zName:\"fkey\"), onErrorText(orconf)));\r\n\r\n    /* Set the P5 operand of the OP_Program instruction to non-zero if\r\n    ** recursive invocation of this trigger program is disallowed. Recursive\r\n    ** invocation is disallowed if (a) the sub-program is really a trigger,\r\n    ** not a foreign key action, and (b) the flag to enable recursive triggers\r\n    ** is clear.  */\r\n    sqlite3VdbeChangeP5(v, (u8)bRecursive);\r\n  }\r\n}\r\n\r\n/*\r\n** This is called to code the required FOR EACH ROW triggers for an operation\r\n** on table pTab. The operation to code triggers for (INSERT, UPDATE or DELETE)\r\n** is given by the op paramater. The tr_tm parameter determines whether the\r\n** BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then\r\n** parameter pChanges is passed the list of columns being modified.\r\n**\r\n** If there are no triggers that fire at the specified time for the specified\r\n** operation on pTab, this function is a no-op.\r\n**\r\n** The reg argument is the address of the first in an array of registers \r\n** that contain the values substituted for the new.* and old.* references\r\n** in the trigger program. If N is the number of columns in table pTab\r\n** (a copy of pTab->nCol), then registers are populated as follows:\r\n**\r\n**   Register       Contains\r\n**   ------------------------------------------------------\r\n**   reg+0          OLD.rowid\r\n**   reg+1          OLD.* value of left-most column of pTab\r\n**   ...            ...\r\n**   reg+N          OLD.* value of right-most column of pTab\r\n**   reg+N+1        NEW.rowid\r\n**   reg+N+2        OLD.* value of left-most column of pTab\r\n**   ...            ...\r\n**   reg+N+N+1      NEW.* value of right-most column of pTab\r\n**\r\n** For ON DELETE triggers, the registers containing the NEW.* values will\r\n** never be accessed by the trigger program, so they are not allocated or \r\n** populated by the caller (there is no data to populate them with anyway). \r\n** Similarly, for ON INSERT triggers the values stored in the OLD.* registers\r\n** are never accessed, and so are not allocated by the caller. So, for an\r\n** ON INSERT trigger, the value passed to this function as parameter reg\r\n** is not a readable register, although registers (reg+N) through \r\n** (reg+N+N+1) are.\r\n**\r\n** Parameter orconf is the default conflict resolution algorithm for the\r\n** trigger program to use (REPLACE, IGNORE etc.). Parameter ignoreJump\r\n** is the instruction that control should jump to if a trigger program\r\n** raises an IGNORE exception.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CodeRowTrigger(\r\n  Parse *pParse,       /* Parse context */\r\n  Trigger *pTrigger,   /* List of triggers on table pTab */\r\n  int op,              /* One of TK_UPDATE, TK_INSERT, TK_DELETE */\r\n  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */\r\n  int tr_tm,           /* One of TRIGGER_BEFORE, TRIGGER_AFTER */\r\n  Table *pTab,         /* The table to code triggers from */\r\n  int reg,             /* The first in an array of registers (see above) */\r\n  int orconf,          /* ON CONFLICT policy */\r\n  int ignoreJump       /* Instruction to jump to for RAISE(IGNORE) */\r\n){\r\n  Trigger *p;          /* Used to iterate through pTrigger list */\r\n\r\n  assert( op==TK_UPDATE || op==TK_INSERT || op==TK_DELETE );\r\n  assert( tr_tm==TRIGGER_BEFORE || tr_tm==TRIGGER_AFTER );\r\n  assert( (op==TK_UPDATE)==(pChanges!=0) );\r\n\r\n  for(p=pTrigger; p; p=p->pNext){\r\n\r\n    /* Sanity checking:  The schema for the trigger and for the table are\r\n    ** always defined.  The trigger must be in the same schema as the table\r\n    ** or else it must be a TEMP trigger. */\r\n    assert( p->pSchema!=0 );\r\n    assert( p->pTabSchema!=0 );\r\n    assert( p->pSchema==p->pTabSchema \r\n         || p->pSchema==pParse->db->aDb[1].pSchema );\r\n\r\n    /* Determine whether we should code this trigger */\r\n    if( p->op==op \r\n     && p->tr_tm==tr_tm \r\n     && checkColumnOverlap(p->pColumns, pChanges)\r\n    ){\r\n      sqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Triggers may access values stored in the old.* or new.* pseudo-table. \r\n** This function returns a 32-bit bitmask indicating which columns of the \r\n** old.* or new.* tables actually are used by triggers. This information \r\n** may be used by the caller, for example, to avoid having to load the entire\r\n** old.* record into memory when executing an UPDATE or DELETE command.\r\n**\r\n** Bit 0 of the returned mask is set if the left-most column of the\r\n** table may be accessed using an [old|new].<col> reference. Bit 1 is set if\r\n** the second leftmost column value is required, and so on. If there\r\n** are more than 32 columns in the table, and at least one of the columns\r\n** with an index greater than 32 may be accessed, 0xffffffff is returned.\r\n**\r\n** It is not possible to determine if the old.rowid or new.rowid column is \r\n** accessed by triggers. The caller must always assume that it is.\r\n**\r\n** Parameter isNew must be either 1 or 0. If it is 0, then the mask returned\r\n** applies to the old.* table. If 1, the new.* table.\r\n**\r\n** Parameter tr_tm must be a mask with one or both of the TRIGGER_BEFORE\r\n** and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only\r\n** included in the returned mask if the TRIGGER_BEFORE bit is set in the\r\n** tr_tm parameter. Similarly, values accessed by AFTER triggers are only\r\n** included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm.\r\n*/\r\nSQLITE_PRIVATE u32 sqlite3TriggerColmask(\r\n  Parse *pParse,       /* Parse context */\r\n  Trigger *pTrigger,   /* List of triggers on table pTab */\r\n  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */\r\n  int isNew,           /* 1 for new.* ref mask, 0 for old.* ref mask */\r\n  int tr_tm,           /* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */\r\n  Table *pTab,         /* The table to code triggers from */\r\n  int orconf           /* Default ON CONFLICT policy for trigger steps */\r\n){\r\n  const int op = pChanges ? TK_UPDATE : TK_DELETE;\r\n  u32 mask = 0;\r\n  Trigger *p;\r\n\r\n  assert( isNew==1 || isNew==0 );\r\n  for(p=pTrigger; p; p=p->pNext){\r\n    if( p->op==op && (tr_tm&p->tr_tm)\r\n     && checkColumnOverlap(p->pColumns,pChanges)\r\n    ){\r\n      TriggerPrg *pPrg;\r\n      pPrg = getRowTrigger(pParse, p, pTab, orconf);\r\n      if( pPrg ){\r\n        mask |= pPrg->aColmask[isNew];\r\n      }\r\n    }\r\n  }\r\n\r\n  return mask;\r\n}\r\n\r\n#endif /* !defined(SQLITE_OMIT_TRIGGER) */\r\n\r\n/************** End of trigger.c *********************************************/\r\n/************** Begin file update.c ******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains C code routines that are called by the parser\r\n** to handle UPDATE statements.\r\n*/\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/* Forward declaration */\r\nstatic void updateVirtualTable(\r\n  Parse *pParse,       /* The parsing context */\r\n  SrcList *pSrc,       /* The virtual table to be modified */\r\n  Table *pTab,         /* The virtual table */\r\n  ExprList *pChanges,  /* The columns to change in the UPDATE statement */\r\n  Expr *pRowidExpr,    /* Expression used to recompute the rowid */\r\n  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */\r\n  Expr *pWhere,        /* WHERE clause of the UPDATE statement */\r\n  int onError          /* ON CONFLICT strategy */\r\n);\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n/*\r\n** The most recently coded instruction was an OP_Column to retrieve the\r\n** i-th column of table pTab. This routine sets the P4 parameter of the \r\n** OP_Column to the default value, if any.\r\n**\r\n** The default value of a column is specified by a DEFAULT clause in the \r\n** column definition. This was either supplied by the user when the table\r\n** was created, or added later to the table definition by an ALTER TABLE\r\n** command. If the latter, then the row-records in the table btree on disk\r\n** may not contain a value for the column and the default value, taken\r\n** from the P4 parameter of the OP_Column instruction, is returned instead.\r\n** If the former, then all row-records are guaranteed to include a value\r\n** for the column and the P4 value is not required.\r\n**\r\n** Column definitions created by an ALTER TABLE command may only have \r\n** literal default values specified: a number, null or a string. (If a more\r\n** complicated default expression value was provided, it is evaluated \r\n** when the ALTER TABLE is executed and one of the literal values written\r\n** into the sqlite_master table.)\r\n**\r\n** Therefore, the P4 parameter is only required if the default value for\r\n** the column is a literal number, string or null. The sqlite3ValueFromExpr()\r\n** function is capable of transforming these types of expressions into\r\n** sqlite3_value objects.\r\n**\r\n** If parameter iReg is not negative, code an OP_RealAffinity instruction\r\n** on register iReg. This is used when an equivalent integer value is \r\n** stored in place of an 8-byte floating point value in order to save \r\n** space.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){\r\n  assert( pTab!=0 );\r\n  if( !pTab->pSelect ){\r\n    sqlite3_value *pValue;\r\n    u8 enc = ENC(sqlite3VdbeDb(v));\r\n    Column *pCol = &pTab->aCol[i];\r\n    VdbeComment((v, \"%s.%s\", pTab->zName, pCol->zName));\r\n    assert( i<pTab->nCol );\r\n    sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, \r\n                         pCol->affinity, &pValue);\r\n    if( pValue ){\r\n      sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM);\r\n    }\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n    if( iReg>=0 && pTab->aCol[i].affinity==SQLITE_AFF_REAL ){\r\n      sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);\r\n    }\r\n#endif\r\n  }\r\n}\r\n\r\n/*\r\n** Process an UPDATE statement.\r\n**\r\n**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;\r\n**          \\_______/ \\________/     \\______/       \\________________/\r\n*            onError   pTabList      pChanges             pWhere\r\n*/\r\nSQLITE_PRIVATE void sqlite3Update(\r\n  Parse *pParse,         /* The parser context */\r\n  SrcList *pTabList,     /* The table in which we should change things */\r\n  ExprList *pChanges,    /* Things to be changed */\r\n  Expr *pWhere,          /* The WHERE clause.  May be null */\r\n  int onError            /* How to handle constraint errors */\r\n){\r\n  int i, j;              /* Loop counters */\r\n  Table *pTab;           /* The table to be updated */\r\n  int addr = 0;          /* VDBE instruction address of the start of the loop */\r\n  WhereInfo *pWInfo;     /* Information about the WHERE clause */\r\n  Vdbe *v;               /* The virtual database engine */\r\n  Index *pIdx;           /* For looping over indices */\r\n  int nIdx;              /* Number of indices that need updating */\r\n  int iCur;              /* VDBE Cursor number of pTab */\r\n  sqlite3 *db;           /* The database structure */\r\n  int *aRegIdx = 0;      /* One register assigned to each index to be updated */\r\n  int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the\r\n                         ** an expression for the i-th column of the table.\r\n                         ** aXRef[i]==-1 if the i-th column is not changed. */\r\n  int chngRowid;         /* True if the record number is being changed */\r\n  Expr *pRowidExpr = 0;  /* Expression defining the new record number */\r\n  int openAll = 0;       /* True if all indices need to be opened */\r\n  AuthContext sContext;  /* The authorization context */\r\n  NameContext sNC;       /* The name-context to resolve expressions in */\r\n  int iDb;               /* Database containing the table being updated */\r\n  int okOnePass;         /* True for one-pass algorithm without the FIFO */\r\n  int hasFK;             /* True if foreign key processing is required */\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  int isView;            /* True when updating a view (INSTEAD OF trigger) */\r\n  Trigger *pTrigger;     /* List of triggers on pTab, if required */\r\n  int tmask;             /* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */\r\n#endif\r\n  int newmask;           /* Mask of NEW.* columns accessed by BEFORE triggers */\r\n\r\n  /* Register Allocations */\r\n  int regRowCount = 0;   /* A count of rows changed */\r\n  int regOldRowid;       /* The old rowid */\r\n  int regNewRowid;       /* The new rowid */\r\n  int regNew;            /* Content of the NEW.* table in triggers */\r\n  int regOld = 0;        /* Content of OLD.* table in triggers */\r\n  int regRowSet = 0;     /* Rowset of rows to be updated */\r\n\r\n  memset(&sContext, 0, sizeof(sContext));\r\n  db = pParse->db;\r\n  if( pParse->nErr || db->mallocFailed ){\r\n    goto update_cleanup;\r\n  }\r\n  assert( pTabList->nSrc==1 );\r\n\r\n  /* Locate the table which we want to update. \r\n  */\r\n  pTab = sqlite3SrcListLookup(pParse, pTabList);\r\n  if( pTab==0 ) goto update_cleanup;\r\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\r\n\r\n  /* Figure out if we have any triggers and if the table being\r\n  ** updated is a view.\r\n  */\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask);\r\n  isView = pTab->pSelect!=0;\r\n  assert( pTrigger || tmask==0 );\r\n#else\r\n# define pTrigger 0\r\n# define isView 0\r\n# define tmask 0\r\n#endif\r\n#ifdef SQLITE_OMIT_VIEW\r\n# undef isView\r\n# define isView 0\r\n#endif\r\n\r\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\r\n    goto update_cleanup;\r\n  }\r\n  if( sqlite3IsReadOnly(pParse, pTab, tmask) ){\r\n    goto update_cleanup;\r\n  }\r\n  aXRef = sqlite3DbMallocRaw(db, sizeof(int) * pTab->nCol );\r\n  if( aXRef==0 ) goto update_cleanup;\r\n  for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;\r\n\r\n  /* Allocate a cursors for the main database table and for all indices.\r\n  ** The index cursors might not be used, but if they are used they\r\n  ** need to occur right after the database cursor.  So go ahead and\r\n  ** allocate enough space, just in case.\r\n  */\r\n  pTabList->a[0].iCursor = iCur = pParse->nTab++;\r\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n    pParse->nTab++;\r\n  }\r\n\r\n  /* Initialize the name-context */\r\n  memset(&sNC, 0, sizeof(sNC));\r\n  sNC.pParse = pParse;\r\n  sNC.pSrcList = pTabList;\r\n\r\n  /* Resolve the column names in all the expressions of the\r\n  ** of the UPDATE statement.  Also find the column index\r\n  ** for each column to be updated in the pChanges array.  For each\r\n  ** column to be updated, make sure we have authorization to change\r\n  ** that column.\r\n  */\r\n  chngRowid = 0;\r\n  for(i=0; i<pChanges->nExpr; i++){\r\n    if( sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){\r\n      goto update_cleanup;\r\n    }\r\n    for(j=0; j<pTab->nCol; j++){\r\n      if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){\r\n        if( j==pTab->iPKey ){\r\n          chngRowid = 1;\r\n          pRowidExpr = pChanges->a[i].pExpr;\r\n        }\r\n        aXRef[j] = i;\r\n        break;\r\n      }\r\n    }\r\n    if( j>=pTab->nCol ){\r\n      if( sqlite3IsRowid(pChanges->a[i].zName) ){\r\n        chngRowid = 1;\r\n        pRowidExpr = pChanges->a[i].pExpr;\r\n      }else{\r\n        sqlite3ErrorMsg(pParse, \"no such column: %s\", pChanges->a[i].zName);\r\n        pParse->checkSchema = 1;\r\n        goto update_cleanup;\r\n      }\r\n    }\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n    {\r\n      int rc;\r\n      rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,\r\n                           pTab->aCol[j].zName, db->aDb[iDb].zName);\r\n      if( rc==SQLITE_DENY ){\r\n        goto update_cleanup;\r\n      }else if( rc==SQLITE_IGNORE ){\r\n        aXRef[j] = -1;\r\n      }\r\n    }\r\n#endif\r\n  }\r\n\r\n  hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngRowid);\r\n\r\n  /* Allocate memory for the array aRegIdx[].  There is one entry in the\r\n  ** array for each index associated with table being updated.  Fill in\r\n  ** the value with a register number for indices that are to be used\r\n  ** and with zero for unused indices.\r\n  */\r\n  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}\r\n  if( nIdx>0 ){\r\n    aRegIdx = sqlite3DbMallocRaw(db, sizeof(Index*) * nIdx );\r\n    if( aRegIdx==0 ) goto update_cleanup;\r\n  }\r\n  for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\r\n    int reg;\r\n    if( hasFK || chngRowid ){\r\n      reg = ++pParse->nMem;\r\n    }else{\r\n      reg = 0;\r\n      for(i=0; i<pIdx->nColumn; i++){\r\n        if( aXRef[pIdx->aiColumn[i]]>=0 ){\r\n          reg = ++pParse->nMem;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n    aRegIdx[j] = reg;\r\n  }\r\n\r\n  /* Begin generating code. */\r\n  v = sqlite3GetVdbe(pParse);\r\n  if( v==0 ) goto update_cleanup;\r\n  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);\r\n  sqlite3BeginWriteOperation(pParse, 1, iDb);\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  /* Virtual tables must be handled separately */\r\n  if( IsVirtual(pTab) ){\r\n    updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef,\r\n                       pWhere, onError);\r\n    pWhere = 0;\r\n    pTabList = 0;\r\n    goto update_cleanup;\r\n  }\r\n#endif\r\n\r\n  /* Allocate required registers. */\r\n  regRowSet = ++pParse->nMem;\r\n  regOldRowid = regNewRowid = ++pParse->nMem;\r\n  if( pTrigger || hasFK ){\r\n    regOld = pParse->nMem + 1;\r\n    pParse->nMem += pTab->nCol;\r\n  }\r\n  if( chngRowid || pTrigger || hasFK ){\r\n    regNewRowid = ++pParse->nMem;\r\n  }\r\n  regNew = pParse->nMem + 1;\r\n  pParse->nMem += pTab->nCol;\r\n\r\n  /* Start the view context. */\r\n  if( isView ){\r\n    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);\r\n  }\r\n\r\n  /* If we are trying to update a view, realize that view into\r\n  ** a ephemeral table.\r\n  */\r\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\r\n  if( isView ){\r\n    sqlite3MaterializeView(pParse, pTab, pWhere, iCur);\r\n  }\r\n#endif\r\n\r\n  /* Resolve the column names in all the expressions in the\r\n  ** WHERE clause.\r\n  */\r\n  if( sqlite3ResolveExprNames(&sNC, pWhere) ){\r\n    goto update_cleanup;\r\n  }\r\n\r\n  /* Begin the database scan\r\n  */\r\n  sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid);\r\n  pWInfo = sqlite3WhereBegin(\r\n      pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED\r\n  );\r\n  if( pWInfo==0 ) goto update_cleanup;\r\n  okOnePass = pWInfo->okOnePass;\r\n\r\n  /* Remember the rowid of every item to be updated.\r\n  */\r\n  sqlite3VdbeAddOp2(v, OP_Rowid, iCur, regOldRowid);\r\n  if( !okOnePass ){\r\n    sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid);\r\n  }\r\n\r\n  /* End the database scan loop.\r\n  */\r\n  sqlite3WhereEnd(pWInfo);\r\n\r\n  /* Initialize the count of updated rows\r\n  */\r\n  if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab ){\r\n    regRowCount = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);\r\n  }\r\n\r\n  if( !isView ){\r\n    /* \r\n    ** Open every index that needs updating.  Note that if any\r\n    ** index could potentially invoke a REPLACE conflict resolution \r\n    ** action, then we need to open all indices because we might need\r\n    ** to be deleting some records.\r\n    */\r\n    if( !okOnePass ) sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenWrite); \r\n    if( onError==OE_Replace ){\r\n      openAll = 1;\r\n    }else{\r\n      openAll = 0;\r\n      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n        if( pIdx->onError==OE_Replace ){\r\n          openAll = 1;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n    for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){\r\n      assert( aRegIdx );\r\n      if( openAll || aRegIdx[i]>0 ){\r\n        KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);\r\n        sqlite3VdbeAddOp4(v, OP_OpenWrite, iCur+i+1, pIdx->tnum, iDb,\r\n                       (char*)pKey, P4_KEYINFO_HANDOFF);\r\n        assert( pParse->nTab>iCur+i+1 );\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Top of the update loop */\r\n  if( okOnePass ){\r\n    int a1 = sqlite3VdbeAddOp1(v, OP_NotNull, regOldRowid);\r\n    addr = sqlite3VdbeAddOp0(v, OP_Goto);\r\n    sqlite3VdbeJumpHere(v, a1);\r\n  }else{\r\n    addr = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet, 0, regOldRowid);\r\n  }\r\n\r\n  /* Make cursor iCur point to the record that is being updated. If\r\n  ** this record does not exist for some reason (deleted by a trigger,\r\n  ** for example, then jump to the next iteration of the RowSet loop.  */\r\n  sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addr, regOldRowid);\r\n\r\n  /* If the record number will change, set register regNewRowid to\r\n  ** contain the new value. If the record number is not being modified,\r\n  ** then regNewRowid is the same register as regOldRowid, which is\r\n  ** already populated.  */\r\n  assert( chngRowid || pTrigger || hasFK || regOldRowid==regNewRowid );\r\n  if( chngRowid ){\r\n    sqlite3ExprCode(pParse, pRowidExpr, regNewRowid);\r\n    sqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid);\r\n  }\r\n\r\n  /* If there are triggers on this table, populate an array of registers \r\n  ** with the required old.* column data.  */\r\n  if( hasFK || pTrigger ){\r\n    u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0);\r\n    oldmask |= sqlite3TriggerColmask(pParse, \r\n        pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError\r\n    );\r\n    for(i=0; i<pTab->nCol; i++){\r\n      if( aXRef[i]<0 || oldmask==0xffffffff || (i<32 && (oldmask & (1<<i))) ){\r\n        sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOld+i);\r\n      }else{\r\n        sqlite3VdbeAddOp2(v, OP_Null, 0, regOld+i);\r\n      }\r\n    }\r\n    if( chngRowid==0 ){\r\n      sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid);\r\n    }\r\n  }\r\n\r\n  /* Populate the array of registers beginning at regNew with the new\r\n  ** row data. This array is used to check constaints, create the new\r\n  ** table and index records, and as the values for any new.* references\r\n  ** made by triggers.\r\n  **\r\n  ** If there are one or more BEFORE triggers, then do not populate the\r\n  ** registers associated with columns that are (a) not modified by\r\n  ** this UPDATE statement and (b) not accessed by new.* references. The\r\n  ** values for registers not modified by the UPDATE must be reloaded from \r\n  ** the database after the BEFORE triggers are fired anyway (as the trigger \r\n  ** may have modified them). So not loading those that are not going to\r\n  ** be used eliminates some redundant opcodes.\r\n  */\r\n  newmask = sqlite3TriggerColmask(\r\n      pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError\r\n  );\r\n  sqlite3VdbeAddOp3(v, OP_Null, 0, regNew, regNew+pTab->nCol-1);\r\n  for(i=0; i<pTab->nCol; i++){\r\n    if( i==pTab->iPKey ){\r\n      /*sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);*/\r\n    }else{\r\n      j = aXRef[i];\r\n      if( j>=0 ){\r\n        sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i);\r\n      }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask&(1<<i)) ){\r\n        /* This branch loads the value of a column that will not be changed \r\n        ** into a register. This is done if there are no BEFORE triggers, or\r\n        ** if there are one or more BEFORE triggers that use this value via\r\n        ** a new.* reference in a trigger program.\r\n        */\r\n        testcase( i==31 );\r\n        testcase( i==32 );\r\n        sqlite3VdbeAddOp3(v, OP_Column, iCur, i, regNew+i);\r\n        sqlite3ColumnDefault(v, pTab, i, regNew+i);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Fire any BEFORE UPDATE triggers. This happens before constraints are\r\n  ** verified. One could argue that this is wrong.\r\n  */\r\n  if( tmask&TRIGGER_BEFORE ){\r\n    sqlite3VdbeAddOp2(v, OP_Affinity, regNew, pTab->nCol);\r\n    sqlite3TableAffinityStr(v, pTab);\r\n    sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, \r\n        TRIGGER_BEFORE, pTab, regOldRowid, onError, addr);\r\n\r\n    /* The row-trigger may have deleted the row being updated. In this\r\n    ** case, jump to the next row. No updates or AFTER triggers are \r\n    ** required. This behaviour - what happens when the row being updated\r\n    ** is deleted or renamed by a BEFORE trigger - is left undefined in the\r\n    ** documentation.\r\n    */\r\n    sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addr, regOldRowid);\r\n\r\n    /* If it did not delete it, the row-trigger may still have modified \r\n    ** some of the columns of the row being updated. Load the values for \r\n    ** all columns not modified by the update statement into their \r\n    ** registers in case this has happened.\r\n    */\r\n    for(i=0; i<pTab->nCol; i++){\r\n      if( aXRef[i]<0 && i!=pTab->iPKey ){\r\n        sqlite3VdbeAddOp3(v, OP_Column, iCur, i, regNew+i);\r\n        sqlite3ColumnDefault(v, pTab, i, regNew+i);\r\n      }\r\n    }\r\n  }\r\n\r\n  if( !isView ){\r\n    int j1;                       /* Address of jump instruction */\r\n\r\n    /* Do constraint checks. */\r\n    sqlite3GenerateConstraintChecks(pParse, pTab, iCur, regNewRowid,\r\n        aRegIdx, (chngRowid?regOldRowid:0), 1, onError, addr, 0);\r\n\r\n    /* Do FK constraint checks. */\r\n    if( hasFK ){\r\n      sqlite3FkCheck(pParse, pTab, regOldRowid, 0);\r\n    }\r\n\r\n    /* Delete the index entries associated with the current record.  */\r\n    j1 = sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regOldRowid);\r\n    sqlite3GenerateRowIndexDelete(pParse, pTab, iCur, aRegIdx);\r\n  \r\n    /* If changing the record number, delete the old record.  */\r\n    if( hasFK || chngRowid ){\r\n      sqlite3VdbeAddOp2(v, OP_Delete, iCur, 0);\r\n    }\r\n    sqlite3VdbeJumpHere(v, j1);\r\n\r\n    if( hasFK ){\r\n      sqlite3FkCheck(pParse, pTab, 0, regNewRowid);\r\n    }\r\n  \r\n    /* Insert the new index entries and the new record. */\r\n    sqlite3CompleteInsertion(pParse, pTab, iCur, regNewRowid, aRegIdx, 1, 0, 0);\r\n\r\n    /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to\r\n    ** handle rows (possibly in other tables) that refer via a foreign key\r\n    ** to the row just updated. */ \r\n    if( hasFK ){\r\n      sqlite3FkActions(pParse, pTab, pChanges, regOldRowid);\r\n    }\r\n  }\r\n\r\n  /* Increment the row counter \r\n  */\r\n  if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab){\r\n    sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);\r\n  }\r\n\r\n  sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, \r\n      TRIGGER_AFTER, pTab, regOldRowid, onError, addr);\r\n\r\n  /* Repeat the above with the next record to be updated, until\r\n  ** all record selected by the WHERE clause have been updated.\r\n  */\r\n  sqlite3VdbeAddOp2(v, OP_Goto, 0, addr);\r\n  sqlite3VdbeJumpHere(v, addr);\r\n\r\n  /* Close all tables */\r\n  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){\r\n    assert( aRegIdx );\r\n    if( openAll || aRegIdx[i]>0 ){\r\n      sqlite3VdbeAddOp2(v, OP_Close, iCur+i+1, 0);\r\n    }\r\n  }\r\n  sqlite3VdbeAddOp2(v, OP_Close, iCur, 0);\r\n\r\n  /* Update the sqlite_sequence table by storing the content of the\r\n  ** maximum rowid counter values recorded while inserting into\r\n  ** autoincrement tables.\r\n  */\r\n  if( pParse->nested==0 && pParse->pTriggerTab==0 ){\r\n    sqlite3AutoincrementEnd(pParse);\r\n  }\r\n\r\n  /*\r\n  ** Return the number of rows that were changed. If this routine is \r\n  ** generating code because of a call to sqlite3NestedParse(), do not\r\n  ** invoke the callback function.\r\n  */\r\n  if( (db->flags&SQLITE_CountRows) && !pParse->pTriggerTab && !pParse->nested ){\r\n    sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);\r\n    sqlite3VdbeSetNumCols(v, 1);\r\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"rows updated\", SQLITE_STATIC);\r\n  }\r\n\r\nupdate_cleanup:\r\n  sqlite3AuthContextPop(&sContext);\r\n  sqlite3DbFree(db, aRegIdx);\r\n  sqlite3DbFree(db, aXRef);\r\n  sqlite3SrcListDelete(db, pTabList);\r\n  sqlite3ExprListDelete(db, pChanges);\r\n  sqlite3ExprDelete(db, pWhere);\r\n  return;\r\n}\r\n/* Make sure \"isView\" and other macros defined above are undefined. Otherwise\r\n** thely may interfere with compilation of other functions in this file\r\n** (or in another file, if this file becomes part of the amalgamation).  */\r\n#ifdef isView\r\n #undef isView\r\n#endif\r\n#ifdef pTrigger\r\n #undef pTrigger\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/*\r\n** Generate code for an UPDATE of a virtual table.\r\n**\r\n** The strategy is that we create an ephemerial table that contains\r\n** for each row to be changed:\r\n**\r\n**   (A)  The original rowid of that row.\r\n**   (B)  The revised rowid for the row. (note1)\r\n**   (C)  The content of every column in the row.\r\n**\r\n** Then we loop over this ephemeral table and for each row in\r\n** the ephermeral table call VUpdate.\r\n**\r\n** When finished, drop the ephemeral table.\r\n**\r\n** (note1) Actually, if we know in advance that (A) is always the same\r\n** as (B) we only store (A), then duplicate (A) when pulling\r\n** it out of the ephemeral table before calling VUpdate.\r\n*/\r\nstatic void updateVirtualTable(\r\n  Parse *pParse,       /* The parsing context */\r\n  SrcList *pSrc,       /* The virtual table to be modified */\r\n  Table *pTab,         /* The virtual table */\r\n  ExprList *pChanges,  /* The columns to change in the UPDATE statement */\r\n  Expr *pRowid,        /* Expression used to recompute the rowid */\r\n  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */\r\n  Expr *pWhere,        /* WHERE clause of the UPDATE statement */\r\n  int onError          /* ON CONFLICT strategy */\r\n){\r\n  Vdbe *v = pParse->pVdbe;  /* Virtual machine under construction */\r\n  ExprList *pEList = 0;     /* The result set of the SELECT statement */\r\n  Select *pSelect = 0;      /* The SELECT statement */\r\n  Expr *pExpr;              /* Temporary expression */\r\n  int ephemTab;             /* Table holding the result of the SELECT */\r\n  int i;                    /* Loop counter */\r\n  int addr;                 /* Address of top of loop */\r\n  int iReg;                 /* First register in set passed to OP_VUpdate */\r\n  sqlite3 *db = pParse->db; /* Database connection */\r\n  const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);\r\n  SelectDest dest;\r\n\r\n  /* Construct the SELECT statement that will find the new values for\r\n  ** all updated rows. \r\n  */\r\n  pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, \"_rowid_\"));\r\n  if( pRowid ){\r\n    pEList = sqlite3ExprListAppend(pParse, pEList,\r\n                                   sqlite3ExprDup(db, pRowid, 0));\r\n  }\r\n  assert( pTab->iPKey<0 );\r\n  for(i=0; i<pTab->nCol; i++){\r\n    if( aXRef[i]>=0 ){\r\n      pExpr = sqlite3ExprDup(db, pChanges->a[aXRef[i]].pExpr, 0);\r\n    }else{\r\n      pExpr = sqlite3Expr(db, TK_ID, pTab->aCol[i].zName);\r\n    }\r\n    pEList = sqlite3ExprListAppend(pParse, pEList, pExpr);\r\n  }\r\n  pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0);\r\n  \r\n  /* Create the ephemeral table into which the update results will\r\n  ** be stored.\r\n  */\r\n  assert( v );\r\n  ephemTab = pParse->nTab++;\r\n  sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, pTab->nCol+1+(pRowid!=0));\r\n  sqlite3VdbeChangeP5(v, BTREE_UNORDERED);\r\n\r\n  /* fill the ephemeral table \r\n  */\r\n  sqlite3SelectDestInit(&dest, SRT_Table, ephemTab);\r\n  sqlite3Select(pParse, pSelect, &dest);\r\n\r\n  /* Generate code to scan the ephemeral table and call VUpdate. */\r\n  iReg = ++pParse->nMem;\r\n  pParse->nMem += pTab->nCol+1;\r\n  addr = sqlite3VdbeAddOp2(v, OP_Rewind, ephemTab, 0);\r\n  sqlite3VdbeAddOp3(v, OP_Column,  ephemTab, 0, iReg);\r\n  sqlite3VdbeAddOp3(v, OP_Column, ephemTab, (pRowid?1:0), iReg+1);\r\n  for(i=0; i<pTab->nCol; i++){\r\n    sqlite3VdbeAddOp3(v, OP_Column, ephemTab, i+1+(pRowid!=0), iReg+2+i);\r\n  }\r\n  sqlite3VtabMakeWritable(pParse, pTab);\r\n  sqlite3VdbeAddOp4(v, OP_VUpdate, 0, pTab->nCol+2, iReg, pVTab, P4_VTAB);\r\n  sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);\r\n  sqlite3MayAbort(pParse);\r\n  sqlite3VdbeAddOp2(v, OP_Next, ephemTab, addr+1);\r\n  sqlite3VdbeJumpHere(v, addr);\r\n  sqlite3VdbeAddOp2(v, OP_Close, ephemTab, 0);\r\n\r\n  /* Cleanup */\r\n  sqlite3SelectDelete(db, pSelect);  \r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n/************** End of update.c **********************************************/\r\n/************** Begin file vacuum.c ******************************************/\r\n/*\r\n** 2003 April 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used to implement the VACUUM command.\r\n**\r\n** Most of the code in this file may be omitted by defining the\r\n** SQLITE_OMIT_VACUUM macro.\r\n*/\r\n\r\n#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)\r\n/*\r\n** Finalize a prepared statement.  If there was an error, store the\r\n** text of the error message in *pzErrMsg.  Return the result code.\r\n*/\r\nstatic int vacuumFinalize(sqlite3 *db, sqlite3_stmt *pStmt, char **pzErrMsg){\r\n  int rc;\r\n  rc = sqlite3VdbeFinalize((Vdbe*)pStmt);\r\n  if( rc ){\r\n    sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Execute zSql on database db. Return an error code.\r\n*/\r\nstatic int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){\r\n  sqlite3_stmt *pStmt;\r\n  VVA_ONLY( int rc; )\r\n  if( !zSql ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){\r\n    sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));\r\n    return sqlite3_errcode(db);\r\n  }\r\n  VVA_ONLY( rc = ) sqlite3_step(pStmt);\r\n  assert( rc!=SQLITE_ROW || (db->flags&SQLITE_CountRows) );\r\n  return vacuumFinalize(db, pStmt, pzErrMsg);\r\n}\r\n\r\n/*\r\n** Execute zSql on database db. The statement returns exactly\r\n** one column. Execute this as SQL on the same database.\r\n*/\r\nstatic int execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){\r\n  sqlite3_stmt *pStmt;\r\n  int rc;\r\n\r\n  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  while( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n    rc = execSql(db, pzErrMsg, (char*)sqlite3_column_text(pStmt, 0));\r\n    if( rc!=SQLITE_OK ){\r\n      vacuumFinalize(db, pStmt, pzErrMsg);\r\n      return rc;\r\n    }\r\n  }\r\n\r\n  return vacuumFinalize(db, pStmt, pzErrMsg);\r\n}\r\n\r\n/*\r\n** The non-standard VACUUM command is used to clean up the database,\r\n** collapse free space, etc.  It is modelled after the VACUUM command\r\n** in PostgreSQL.\r\n**\r\n** In version 1.0.x of SQLite, the VACUUM command would call\r\n** gdbm_reorganize() on all the database tables.  But beginning\r\n** with 2.0.0, SQLite no longer uses GDBM so this command has\r\n** become a no-op.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse){\r\n  Vdbe *v = sqlite3GetVdbe(pParse);\r\n  if( v ){\r\n    sqlite3VdbeAddOp2(v, OP_Vacuum, 0, 0);\r\n  }\r\n  return;\r\n}\r\n\r\n/*\r\n** This routine implements the OP_Vacuum opcode of the VDBE.\r\n*/\r\nSQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){\r\n  int rc = SQLITE_OK;     /* Return code from service routines */\r\n  Btree *pMain;           /* The database being vacuumed */\r\n  Btree *pTemp;           /* The temporary database we vacuum into */\r\n  char *zSql = 0;         /* SQL statements */\r\n  int saved_flags;        /* Saved value of the db->flags */\r\n  int saved_nChange;      /* Saved value of db->nChange */\r\n  int saved_nTotalChange; /* Saved value of db->nTotalChange */\r\n  void (*saved_xTrace)(void*,const char*);  /* Saved db->xTrace */\r\n  Db *pDb = 0;            /* Database to detach at end of vacuum */\r\n  int isMemDb;            /* True if vacuuming a :memory: database */\r\n  int nRes;               /* Bytes of reserved space at the end of each page */\r\n  int nDb;                /* Number of attached databases */\r\n\r\n  if( !db->autoCommit ){\r\n    sqlite3SetString(pzErrMsg, db, \"cannot VACUUM from within a transaction\");\r\n    return SQLITE_ERROR;\r\n  }\r\n  if( db->activeVdbeCnt>1 ){\r\n    sqlite3SetString(pzErrMsg, db,\"cannot VACUUM - SQL statements in progress\");\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  /* Save the current value of the database flags so that it can be \r\n  ** restored before returning. Then set the writable-schema flag, and\r\n  ** disable CHECK and foreign key constraints.  */\r\n  saved_flags = db->flags;\r\n  saved_nChange = db->nChange;\r\n  saved_nTotalChange = db->nTotalChange;\r\n  saved_xTrace = db->xTrace;\r\n  db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin;\r\n  db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder);\r\n  db->xTrace = 0;\r\n\r\n  pMain = db->aDb[0].pBt;\r\n  isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain));\r\n\r\n  /* Attach the temporary database as 'vacuum_db'. The synchronous pragma\r\n  ** can be set to 'off' for this file, as it is not recovered if a crash\r\n  ** occurs anyway. The integrity of the database is maintained by a\r\n  ** (possibly synchronous) transaction opened on the main database before\r\n  ** sqlite3BtreeCopyFile() is called.\r\n  **\r\n  ** An optimisation would be to use a non-journaled pager.\r\n  ** (Later:) I tried setting \"PRAGMA vacuum_db.journal_mode=OFF\" but\r\n  ** that actually made the VACUUM run slower.  Very little journalling\r\n  ** actually occurs when doing a vacuum since the vacuum_db is initially\r\n  ** empty.  Only the journal header is written.  Apparently it takes more\r\n  ** time to parse and run the PRAGMA to turn journalling off than it does\r\n  ** to write the journal header file.\r\n  */\r\n  nDb = db->nDb;\r\n  if( sqlite3TempInMemory(db) ){\r\n    zSql = \"ATTACH ':memory:' AS vacuum_db;\";\r\n  }else{\r\n    zSql = \"ATTACH '' AS vacuum_db;\";\r\n  }\r\n  rc = execSql(db, pzErrMsg, zSql);\r\n  if( db->nDb>nDb ){\r\n    pDb = &db->aDb[db->nDb-1];\r\n    assert( strcmp(pDb->zName,\"vacuum_db\")==0 );\r\n  }\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n  pTemp = db->aDb[db->nDb-1].pBt;\r\n\r\n  /* The call to execSql() to attach the temp database has left the file\r\n  ** locked (as there was more than one active statement when the transaction\r\n  ** to read the schema was concluded. Unlock it here so that this doesn't\r\n  ** cause problems for the call to BtreeSetPageSize() below.  */\r\n  sqlite3BtreeCommit(pTemp);\r\n\r\n  nRes = sqlite3BtreeGetReserve(pMain);\r\n\r\n  /* A VACUUM cannot change the pagesize of an encrypted database. */\r\n#ifdef SQLITE_HAS_CODEC\r\n  if( db->nextPagesize ){\r\n    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);\r\n    int nKey;\r\n    char *zKey;\r\n    sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);\r\n    if( nKey ) db->nextPagesize = 0;\r\n  }\r\n#endif\r\n\r\n  rc = execSql(db, pzErrMsg, \"PRAGMA vacuum_db.synchronous=OFF\");\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n\r\n  /* Begin a transaction and take an exclusive lock on the main database\r\n  ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,\r\n  ** to ensure that we do not try to change the page-size on a WAL database.\r\n  */\r\n  rc = execSql(db, pzErrMsg, \"BEGIN;\");\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n  rc = sqlite3BtreeBeginTrans(pMain, 2);\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n\r\n  /* Do not attempt to change the page size for a WAL database */\r\n  if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))\r\n                                               ==PAGER_JOURNALMODE_WAL ){\r\n    db->nextPagesize = 0;\r\n  }\r\n\r\n  if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)\r\n   || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))\r\n   || NEVER(db->mallocFailed)\r\n  ){\r\n    rc = SQLITE_NOMEM;\r\n    goto end_of_vacuum;\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n  sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac :\r\n                                           sqlite3BtreeGetAutoVacuum(pMain));\r\n#endif\r\n\r\n  /* Query the schema of the main database. Create a mirror schema\r\n  ** in the temporary database.\r\n  */\r\n  rc = execExecSql(db, pzErrMsg,\r\n      \"SELECT 'CREATE TABLE vacuum_db.' || substr(sql,14) \"\r\n      \"  FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'\"\r\n      \"   AND rootpage>0\"\r\n  );\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n  rc = execExecSql(db, pzErrMsg,\r\n      \"SELECT 'CREATE INDEX vacuum_db.' || substr(sql,14)\"\r\n      \"  FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' \");\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n  rc = execExecSql(db, pzErrMsg,\r\n      \"SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21) \"\r\n      \"  FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'\");\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n\r\n  /* Loop through the tables in the main database. For each, do\r\n  ** an \"INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;\" to copy\r\n  ** the contents to the temporary database.\r\n  */\r\n  rc = execExecSql(db, pzErrMsg,\r\n      \"SELECT 'INSERT INTO vacuum_db.' || quote(name) \"\r\n      \"|| ' SELECT * FROM main.' || quote(name) || ';'\"\r\n      \"FROM main.sqlite_master \"\r\n      \"WHERE type = 'table' AND name!='sqlite_sequence' \"\r\n      \"  AND rootpage>0\"\r\n  );\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n\r\n  /* Copy over the sequence table\r\n  */\r\n  rc = execExecSql(db, pzErrMsg,\r\n      \"SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' \"\r\n      \"FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' \"\r\n  );\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n  rc = execExecSql(db, pzErrMsg,\r\n      \"SELECT 'INSERT INTO vacuum_db.' || quote(name) \"\r\n      \"|| ' SELECT * FROM main.' || quote(name) || ';' \"\r\n      \"FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';\"\r\n  );\r\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n\r\n\r\n  /* Copy the triggers, views, and virtual tables from the main database\r\n  ** over to the temporary database.  None of these objects has any\r\n  ** associated storage, so all we have to do is copy their entries\r\n  ** from the SQLITE_MASTER table.\r\n  */\r\n  rc = execSql(db, pzErrMsg,\r\n      \"INSERT INTO vacuum_db.sqlite_master \"\r\n      \"  SELECT type, name, tbl_name, rootpage, sql\"\r\n      \"    FROM main.sqlite_master\"\r\n      \"   WHERE type='view' OR type='trigger'\"\r\n      \"      OR (type='table' AND rootpage=0)\"\r\n  );\r\n  if( rc ) goto end_of_vacuum;\r\n\r\n  /* At this point, there is a write transaction open on both the \r\n  ** vacuum database and the main database. Assuming no error occurs,\r\n  ** both transactions are closed by this block - the main database\r\n  ** transaction by sqlite3BtreeCopyFile() and the other by an explicit\r\n  ** call to sqlite3BtreeCommit().\r\n  */\r\n  {\r\n    u32 meta;\r\n    int i;\r\n\r\n    /* This array determines which meta meta values are preserved in the\r\n    ** vacuum.  Even entries are the meta value number and odd entries\r\n    ** are an increment to apply to the meta value after the vacuum.\r\n    ** The increment is used to increase the schema cookie so that other\r\n    ** connections to the same database will know to reread the schema.\r\n    */\r\n    static const unsigned char aCopy[] = {\r\n       BTREE_SCHEMA_VERSION,     1,  /* Add one to the old schema cookie */\r\n       BTREE_DEFAULT_CACHE_SIZE, 0,  /* Preserve the default page cache size */\r\n       BTREE_TEXT_ENCODING,      0,  /* Preserve the text encoding */\r\n       BTREE_USER_VERSION,       0,  /* Preserve the user version */\r\n    };\r\n\r\n    assert( 1==sqlite3BtreeIsInTrans(pTemp) );\r\n    assert( 1==sqlite3BtreeIsInTrans(pMain) );\r\n\r\n    /* Copy Btree meta values */\r\n    for(i=0; i<ArraySize(aCopy); i+=2){\r\n      /* GetMeta() and UpdateMeta() cannot fail in this context because\r\n      ** we already have page 1 loaded into cache and marked dirty. */\r\n      sqlite3BtreeGetMeta(pMain, aCopy[i], &meta);\r\n      rc = sqlite3BtreeUpdateMeta(pTemp, aCopy[i], meta+aCopy[i+1]);\r\n      if( NEVER(rc!=SQLITE_OK) ) goto end_of_vacuum;\r\n    }\r\n\r\n    rc = sqlite3BtreeCopyFile(pMain, pTemp);\r\n    if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n    rc = sqlite3BtreeCommit(pTemp);\r\n    if( rc!=SQLITE_OK ) goto end_of_vacuum;\r\n#ifndef SQLITE_OMIT_AUTOVACUUM\r\n    sqlite3BtreeSetAutoVacuum(pMain, sqlite3BtreeGetAutoVacuum(pTemp));\r\n#endif\r\n  }\r\n\r\n  assert( rc==SQLITE_OK );\r\n  rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes,1);\r\n\r\nend_of_vacuum:\r\n  /* Restore the original value of db->flags */\r\n  db->flags = saved_flags;\r\n  db->nChange = saved_nChange;\r\n  db->nTotalChange = saved_nTotalChange;\r\n  db->xTrace = saved_xTrace;\r\n  sqlite3BtreeSetPageSize(pMain, -1, -1, 1);\r\n\r\n  /* Currently there is an SQL level transaction open on the vacuum\r\n  ** database. No locks are held on any other files (since the main file\r\n  ** was committed at the btree level). So it safe to end the transaction\r\n  ** by manually setting the autoCommit flag to true and detaching the\r\n  ** vacuum database. The vacuum_db journal file is deleted when the pager\r\n  ** is closed by the DETACH.\r\n  */\r\n  db->autoCommit = 1;\r\n\r\n  if( pDb ){\r\n    sqlite3BtreeClose(pDb->pBt);\r\n    pDb->pBt = 0;\r\n    pDb->pSchema = 0;\r\n  }\r\n\r\n  /* This both clears the schemas and reduces the size of the db->aDb[]\r\n  ** array. */ \r\n  sqlite3ResetInternalSchema(db, -1);\r\n\r\n  return rc;\r\n}\r\n\r\n#endif  /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */\r\n\r\n/************** End of vacuum.c **********************************************/\r\n/************** Begin file vtab.c ********************************************/\r\n/*\r\n** 2006 June 10\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code used to help implement virtual tables.\r\n*/\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n\r\n/*\r\n** Before a virtual table xCreate() or xConnect() method is invoked, the\r\n** sqlite3.pVtabCtx member variable is set to point to an instance of\r\n** this struct allocated on the stack. It is used by the implementation of \r\n** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which\r\n** are invoked only from within xCreate and xConnect methods.\r\n*/\r\nstruct VtabCtx {\r\n  Table *pTab;\r\n  VTable *pVTable;\r\n};\r\n\r\n/*\r\n** The actual function that does the work of creating a new module.\r\n** This function implements the sqlite3_create_module() and\r\n** sqlite3_create_module_v2() interfaces.\r\n*/\r\nstatic int createModule(\r\n  sqlite3 *db,                    /* Database in which module is registered */\r\n  const char *zName,              /* Name assigned to this module */\r\n  const sqlite3_module *pModule,  /* The definition of the module */\r\n  void *pAux,                     /* Context pointer for xCreate/xConnect */\r\n  void (*xDestroy)(void *)        /* Module destructor function */\r\n){\r\n  int rc, nName;\r\n  Module *pMod;\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n  nName = sqlite3Strlen30(zName);\r\n  pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);\r\n  if( pMod ){\r\n    Module *pDel;\r\n    char *zCopy = (char *)(&pMod[1]);\r\n    memcpy(zCopy, zName, nName+1);\r\n    pMod->zName = zCopy;\r\n    pMod->pModule = pModule;\r\n    pMod->pAux = pAux;\r\n    pMod->xDestroy = xDestroy;\r\n    pDel = (Module *)sqlite3HashInsert(&db->aModule, zCopy, nName, (void*)pMod);\r\n    if( pDel && pDel->xDestroy ){\r\n      sqlite3ResetInternalSchema(db, -1);\r\n      pDel->xDestroy(pDel->pAux);\r\n    }\r\n    sqlite3DbFree(db, pDel);\r\n    if( pDel==pMod ){\r\n      db->mallocFailed = 1;\r\n    }\r\n  }else if( xDestroy ){\r\n    xDestroy(pAux);\r\n  }\r\n  rc = sqlite3ApiExit(db, SQLITE_OK);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** External API function used to create a new virtual-table module.\r\n*/\r\nSQLITE_API int sqlite3_create_module(\r\n  sqlite3 *db,                    /* Database in which module is registered */\r\n  const char *zName,              /* Name assigned to this module */\r\n  const sqlite3_module *pModule,  /* The definition of the module */\r\n  void *pAux                      /* Context pointer for xCreate/xConnect */\r\n){\r\n  return createModule(db, zName, pModule, pAux, 0);\r\n}\r\n\r\n/*\r\n** External API function used to create a new virtual-table module.\r\n*/\r\nSQLITE_API int sqlite3_create_module_v2(\r\n  sqlite3 *db,                    /* Database in which module is registered */\r\n  const char *zName,              /* Name assigned to this module */\r\n  const sqlite3_module *pModule,  /* The definition of the module */\r\n  void *pAux,                     /* Context pointer for xCreate/xConnect */\r\n  void (*xDestroy)(void *)        /* Module destructor function */\r\n){\r\n  return createModule(db, zName, pModule, pAux, xDestroy);\r\n}\r\n\r\n/*\r\n** Lock the virtual table so that it cannot be disconnected.\r\n** Locks nest.  Every lock should have a corresponding unlock.\r\n** If an unlock is omitted, resources leaks will occur.  \r\n**\r\n** If a disconnect is attempted while a virtual table is locked,\r\n** the disconnect is deferred until all locks have been removed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabLock(VTable *pVTab){\r\n  pVTab->nRef++;\r\n}\r\n\r\n\r\n/*\r\n** pTab is a pointer to a Table structure representing a virtual-table.\r\n** Return a pointer to the VTable object used by connection db to access \r\n** this virtual-table, if one has been created, or NULL otherwise.\r\n*/\r\nSQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){\r\n  VTable *pVtab;\r\n  assert( IsVirtual(pTab) );\r\n  for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);\r\n  return pVtab;\r\n}\r\n\r\n/*\r\n** Decrement the ref-count on a virtual table object. When the ref-count\r\n** reaches zero, call the xDisconnect() method to delete the object.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){\r\n  sqlite3 *db = pVTab->db;\r\n\r\n  assert( db );\r\n  assert( pVTab->nRef>0 );\r\n  assert( sqlite3SafetyCheckOk(db) );\r\n\r\n  pVTab->nRef--;\r\n  if( pVTab->nRef==0 ){\r\n    sqlite3_vtab *p = pVTab->pVtab;\r\n    if( p ){\r\n      p->pModule->xDisconnect(p);\r\n    }\r\n    sqlite3DbFree(db, pVTab);\r\n  }\r\n}\r\n\r\n/*\r\n** Table p is a virtual table. This function moves all elements in the\r\n** p->pVTable list to the sqlite3.pDisconnect lists of their associated\r\n** database connections to be disconnected at the next opportunity. \r\n** Except, if argument db is not NULL, then the entry associated with\r\n** connection db is left in the p->pVTable list.\r\n*/\r\nstatic VTable *vtabDisconnectAll(sqlite3 *db, Table *p){\r\n  VTable *pRet = 0;\r\n  VTable *pVTable = p->pVTable;\r\n  p->pVTable = 0;\r\n\r\n  /* Assert that the mutex (if any) associated with the BtShared database \r\n  ** that contains table p is held by the caller. See header comments \r\n  ** above function sqlite3VtabUnlockList() for an explanation of why\r\n  ** this makes it safe to access the sqlite3.pDisconnect list of any\r\n  ** database connection that may have an entry in the p->pVTable list.\r\n  */\r\n  assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );\r\n\r\n  while( pVTable ){\r\n    sqlite3 *db2 = pVTable->db;\r\n    VTable *pNext = pVTable->pNext;\r\n    assert( db2 );\r\n    if( db2==db ){\r\n      pRet = pVTable;\r\n      p->pVTable = pRet;\r\n      pRet->pNext = 0;\r\n    }else{\r\n      pVTable->pNext = db2->pDisconnect;\r\n      db2->pDisconnect = pVTable;\r\n    }\r\n    pVTable = pNext;\r\n  }\r\n\r\n  assert( !db || pRet );\r\n  return pRet;\r\n}\r\n\r\n\r\n/*\r\n** Disconnect all the virtual table objects in the sqlite3.pDisconnect list.\r\n**\r\n** This function may only be called when the mutexes associated with all\r\n** shared b-tree databases opened using connection db are held by the \r\n** caller. This is done to protect the sqlite3.pDisconnect list. The\r\n** sqlite3.pDisconnect list is accessed only as follows:\r\n**\r\n**   1) By this function. In this case, all BtShared mutexes and the mutex\r\n**      associated with the database handle itself must be held.\r\n**\r\n**   2) By function vtabDisconnectAll(), when it adds a VTable entry to\r\n**      the sqlite3.pDisconnect list. In this case either the BtShared mutex\r\n**      associated with the database the virtual table is stored in is held\r\n**      or, if the virtual table is stored in a non-sharable database, then\r\n**      the database handle mutex is held.\r\n**\r\n** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously \r\n** by multiple threads. It is thread-safe.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){\r\n  VTable *p = db->pDisconnect;\r\n  db->pDisconnect = 0;\r\n\r\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n\r\n  if( p ){\r\n    sqlite3ExpirePreparedStatements(db);\r\n    do {\r\n      VTable *pNext = p->pNext;\r\n      sqlite3VtabUnlock(p);\r\n      p = pNext;\r\n    }while( p );\r\n  }\r\n}\r\n\r\n/*\r\n** Clear any and all virtual-table information from the Table record.\r\n** This routine is called, for example, just before deleting the Table\r\n** record.\r\n**\r\n** Since it is a virtual-table, the Table structure contains a pointer\r\n** to the head of a linked list of VTable structures. Each VTable \r\n** structure is associated with a single sqlite3* user of the schema.\r\n** The reference count of the VTable structure associated with database \r\n** connection db is decremented immediately (which may lead to the \r\n** structure being xDisconnected and free). Any other VTable structures\r\n** in the list are moved to the sqlite3.pDisconnect list of the associated \r\n** database connection.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table *p){\r\n  if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p);\r\n  if( p->azModuleArg ){\r\n    int i;\r\n    for(i=0; i<p->nModuleArg; i++){\r\n      sqlite3DbFree(db, p->azModuleArg[i]);\r\n    }\r\n    sqlite3DbFree(db, p->azModuleArg);\r\n  }\r\n}\r\n\r\n/*\r\n** Add a new module argument to pTable->azModuleArg[].\r\n** The string is not copied - the pointer is stored.  The\r\n** string will be freed automatically when the table is\r\n** deleted.\r\n*/\r\nstatic void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){\r\n  int i = pTable->nModuleArg++;\r\n  int nBytes = sizeof(char *)*(1+pTable->nModuleArg);\r\n  char **azModuleArg;\r\n  azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);\r\n  if( azModuleArg==0 ){\r\n    int j;\r\n    for(j=0; j<i; j++){\r\n      sqlite3DbFree(db, pTable->azModuleArg[j]);\r\n    }\r\n    sqlite3DbFree(db, zArg);\r\n    sqlite3DbFree(db, pTable->azModuleArg);\r\n    pTable->nModuleArg = 0;\r\n  }else{\r\n    azModuleArg[i] = zArg;\r\n    azModuleArg[i+1] = 0;\r\n  }\r\n  pTable->azModuleArg = azModuleArg;\r\n}\r\n\r\n/*\r\n** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE\r\n** statement.  The module name has been parsed, but the optional list\r\n** of parameters that follow the module name are still pending.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabBeginParse(\r\n  Parse *pParse,        /* Parsing context */\r\n  Token *pName1,        /* Name of new table, or database name */\r\n  Token *pName2,        /* Name of new table or NULL */\r\n  Token *pModuleName,   /* Name of the module for the virtual table */\r\n  int ifNotExists       /* No error if the table already exists */\r\n){\r\n  int iDb;              /* The database the table is being created in */\r\n  Table *pTable;        /* The new virtual table */\r\n  sqlite3 *db;          /* Database connection */\r\n\r\n  sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists);\r\n  pTable = pParse->pNewTable;\r\n  if( pTable==0 ) return;\r\n  assert( 0==pTable->pIndex );\r\n\r\n  db = pParse->db;\r\n  iDb = sqlite3SchemaToIndex(db, pTable->pSchema);\r\n  assert( iDb>=0 );\r\n\r\n  pTable->tabFlags |= TF_Virtual;\r\n  pTable->nModuleArg = 0;\r\n  addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));\r\n  addModuleArgument(db, pTable, sqlite3DbStrDup(db, db->aDb[iDb].zName));\r\n  addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));\r\n  pParse->sNameToken.n = (int)(&pModuleName->z[pModuleName->n] - pName1->z);\r\n\r\n#ifndef SQLITE_OMIT_AUTHORIZATION\r\n  /* Creating a virtual table invokes the authorization callback twice.\r\n  ** The first invocation, to obtain permission to INSERT a row into the\r\n  ** sqlite_master table, has already been made by sqlite3StartTable().\r\n  ** The second call, to obtain permission to create the table, is made now.\r\n  */\r\n  if( pTable->azModuleArg ){\r\n    sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, \r\n            pTable->azModuleArg[0], pParse->db->aDb[iDb].zName);\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n** This routine takes the module argument that has been accumulating\r\n** in pParse->zArg[] and appends it to the list of arguments on the\r\n** virtual table currently under construction in pParse->pTable.\r\n*/\r\nstatic void addArgumentToVtab(Parse *pParse){\r\n  if( pParse->sArg.z && pParse->pNewTable ){\r\n    const char *z = (const char*)pParse->sArg.z;\r\n    int n = pParse->sArg.n;\r\n    sqlite3 *db = pParse->db;\r\n    addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n));\r\n  }\r\n}\r\n\r\n/*\r\n** The parser calls this routine after the CREATE VIRTUAL TABLE statement\r\n** has been completely parsed.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){\r\n  Table *pTab = pParse->pNewTable;  /* The table being constructed */\r\n  sqlite3 *db = pParse->db;         /* The database connection */\r\n\r\n  if( pTab==0 ) return;\r\n  addArgumentToVtab(pParse);\r\n  pParse->sArg.z = 0;\r\n  if( pTab->nModuleArg<1 ) return;\r\n  \r\n  /* If the CREATE VIRTUAL TABLE statement is being entered for the\r\n  ** first time (in other words if the virtual table is actually being\r\n  ** created now instead of just being read out of sqlite_master) then\r\n  ** do additional initialization work and store the statement text\r\n  ** in the sqlite_master table.\r\n  */\r\n  if( !db->init.busy ){\r\n    char *zStmt;\r\n    char *zWhere;\r\n    int iDb;\r\n    Vdbe *v;\r\n\r\n    /* Compute the complete text of the CREATE VIRTUAL TABLE statement */\r\n    if( pEnd ){\r\n      pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n;\r\n    }\r\n    zStmt = sqlite3MPrintf(db, \"CREATE VIRTUAL TABLE %T\", &pParse->sNameToken);\r\n\r\n    /* A slot for the record has already been allocated in the \r\n    ** SQLITE_MASTER table.  We just need to update that slot with all\r\n    ** the information we've collected.  \r\n    **\r\n    ** The VM register number pParse->regRowid holds the rowid of an\r\n    ** entry in the sqlite_master table tht was created for this vtab\r\n    ** by sqlite3StartTable().\r\n    */\r\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n    sqlite3NestedParse(pParse,\r\n      \"UPDATE %Q.%s \"\r\n         \"SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q \"\r\n       \"WHERE rowid=#%d\",\r\n      db->aDb[iDb].zName, SCHEMA_TABLE(iDb),\r\n      pTab->zName,\r\n      pTab->zName,\r\n      zStmt,\r\n      pParse->regRowid\r\n    );\r\n    sqlite3DbFree(db, zStmt);\r\n    v = sqlite3GetVdbe(pParse);\r\n    sqlite3ChangeCookie(pParse, iDb);\r\n\r\n    sqlite3VdbeAddOp2(v, OP_Expire, 0, 0);\r\n    zWhere = sqlite3MPrintf(db, \"name='%q' AND type='table'\", pTab->zName);\r\n    sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);\r\n    sqlite3VdbeAddOp4(v, OP_VCreate, iDb, 0, 0, \r\n                         pTab->zName, sqlite3Strlen30(pTab->zName) + 1);\r\n  }\r\n\r\n  /* If we are rereading the sqlite_master table create the in-memory\r\n  ** record of the table. The xConnect() method is not called until\r\n  ** the first time the virtual table is used in an SQL statement. This\r\n  ** allows a schema that contains virtual tables to be loaded before\r\n  ** the required virtual table implementations are registered.  */\r\n  else {\r\n    Table *pOld;\r\n    Schema *pSchema = pTab->pSchema;\r\n    const char *zName = pTab->zName;\r\n    int nName = sqlite3Strlen30(zName);\r\n    assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );\r\n    pOld = sqlite3HashInsert(&pSchema->tblHash, zName, nName, pTab);\r\n    if( pOld ){\r\n      db->mallocFailed = 1;\r\n      assert( pTab==pOld );  /* Malloc must have failed inside HashInsert() */\r\n      return;\r\n    }\r\n    pParse->pNewTable = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** The parser calls this routine when it sees the first token\r\n** of an argument to the module name in a CREATE VIRTUAL TABLE statement.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabArgInit(Parse *pParse){\r\n  addArgumentToVtab(pParse);\r\n  pParse->sArg.z = 0;\r\n  pParse->sArg.n = 0;\r\n}\r\n\r\n/*\r\n** The parser calls this routine for each token after the first token\r\n** in an argument to the module name in a CREATE VIRTUAL TABLE statement.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabArgExtend(Parse *pParse, Token *p){\r\n  Token *pArg = &pParse->sArg;\r\n  if( pArg->z==0 ){\r\n    pArg->z = p->z;\r\n    pArg->n = p->n;\r\n  }else{\r\n    assert(pArg->z < p->z);\r\n    pArg->n = (int)(&p->z[p->n] - pArg->z);\r\n  }\r\n}\r\n\r\n/*\r\n** Invoke a virtual table constructor (either xCreate or xConnect). The\r\n** pointer to the function to invoke is passed as the fourth parameter\r\n** to this procedure.\r\n*/\r\nstatic int vtabCallConstructor(\r\n  sqlite3 *db, \r\n  Table *pTab,\r\n  Module *pMod,\r\n  int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**),\r\n  char **pzErr\r\n){\r\n  VtabCtx sCtx;\r\n  VTable *pVTable;\r\n  int rc;\r\n  const char *const*azArg = (const char *const*)pTab->azModuleArg;\r\n  int nArg = pTab->nModuleArg;\r\n  char *zErr = 0;\r\n  char *zModuleName = sqlite3MPrintf(db, \"%s\", pTab->zName);\r\n\r\n  if( !zModuleName ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  pVTable = sqlite3DbMallocZero(db, sizeof(VTable));\r\n  if( !pVTable ){\r\n    sqlite3DbFree(db, zModuleName);\r\n    return SQLITE_NOMEM;\r\n  }\r\n  pVTable->db = db;\r\n  pVTable->pMod = pMod;\r\n\r\n  /* Invoke the virtual table constructor */\r\n  assert( &db->pVtabCtx );\r\n  assert( xConstruct );\r\n  sCtx.pTab = pTab;\r\n  sCtx.pVTable = pVTable;\r\n  db->pVtabCtx = &sCtx;\r\n  rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);\r\n  db->pVtabCtx = 0;\r\n  if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;\r\n\r\n  if( SQLITE_OK!=rc ){\r\n    if( zErr==0 ){\r\n      *pzErr = sqlite3MPrintf(db, \"vtable constructor failed: %s\", zModuleName);\r\n    }else {\r\n      *pzErr = sqlite3MPrintf(db, \"%s\", zErr);\r\n      sqlite3_free(zErr);\r\n    }\r\n    sqlite3DbFree(db, pVTable);\r\n  }else if( ALWAYS(pVTable->pVtab) ){\r\n    /* Justification of ALWAYS():  A correct vtab constructor must allocate\r\n    ** the sqlite3_vtab object if successful.  */\r\n    pVTable->pVtab->pModule = pMod->pModule;\r\n    pVTable->nRef = 1;\r\n    if( sCtx.pTab ){\r\n      const char *zFormat = \"vtable constructor did not declare schema: %s\";\r\n      *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);\r\n      sqlite3VtabUnlock(pVTable);\r\n      rc = SQLITE_ERROR;\r\n    }else{\r\n      int iCol;\r\n      /* If everything went according to plan, link the new VTable structure\r\n      ** into the linked list headed by pTab->pVTable. Then loop through the \r\n      ** columns of the table to see if any of them contain the token \"hidden\".\r\n      ** If so, set the Column.isHidden flag and remove the token from\r\n      ** the type string.  */\r\n      pVTable->pNext = pTab->pVTable;\r\n      pTab->pVTable = pVTable;\r\n\r\n      for(iCol=0; iCol<pTab->nCol; iCol++){\r\n        char *zType = pTab->aCol[iCol].zType;\r\n        int nType;\r\n        int i = 0;\r\n        if( !zType ) continue;\r\n        nType = sqlite3Strlen30(zType);\r\n        if( sqlite3StrNICmp(\"hidden\", zType, 6)||(zType[6] && zType[6]!=' ') ){\r\n          for(i=0; i<nType; i++){\r\n            if( (0==sqlite3StrNICmp(\" hidden\", &zType[i], 7))\r\n             && (zType[i+7]=='\\0' || zType[i+7]==' ')\r\n            ){\r\n              i++;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n        if( i<nType ){\r\n          int j;\r\n          int nDel = 6 + (zType[i+6] ? 1 : 0);\r\n          for(j=i; (j+nDel)<=nType; j++){\r\n            zType[j] = zType[j+nDel];\r\n          }\r\n          if( zType[i]=='\\0' && i>0 ){\r\n            assert(zType[i-1]==' ');\r\n            zType[i-1] = '\\0';\r\n          }\r\n          pTab->aCol[iCol].isHidden = 1;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  sqlite3DbFree(db, zModuleName);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is invoked by the parser to call the xConnect() method\r\n** of the virtual table pTab. If an error occurs, an error code is returned \r\n** and an error left in pParse.\r\n**\r\n** This call is a no-op if table pTab is not a virtual table.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){\r\n  sqlite3 *db = pParse->db;\r\n  const char *zMod;\r\n  Module *pMod;\r\n  int rc;\r\n\r\n  assert( pTab );\r\n  if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Locate the required virtual table module */\r\n  zMod = pTab->azModuleArg[0];\r\n  pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod));\r\n\r\n  if( !pMod ){\r\n    const char *zModule = pTab->azModuleArg[0];\r\n    sqlite3ErrorMsg(pParse, \"no such module: %s\", zModule);\r\n    rc = SQLITE_ERROR;\r\n  }else{\r\n    char *zErr = 0;\r\n    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);\r\n    if( rc!=SQLITE_OK ){\r\n      sqlite3ErrorMsg(pParse, \"%s\", zErr);\r\n    }\r\n    sqlite3DbFree(db, zErr);\r\n  }\r\n\r\n  return rc;\r\n}\r\n/*\r\n** Grow the db->aVTrans[] array so that there is room for at least one\r\n** more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise.\r\n*/\r\nstatic int growVTrans(sqlite3 *db){\r\n  const int ARRAY_INCR = 5;\r\n\r\n  /* Grow the sqlite3.aVTrans array if required */\r\n  if( (db->nVTrans%ARRAY_INCR)==0 ){\r\n    VTable **aVTrans;\r\n    int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR);\r\n    aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes);\r\n    if( !aVTrans ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR);\r\n    db->aVTrans = aVTrans;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should\r\n** have already been reserved using growVTrans().\r\n*/\r\nstatic void addToVTrans(sqlite3 *db, VTable *pVTab){\r\n  /* Add pVtab to the end of sqlite3.aVTrans */\r\n  db->aVTrans[db->nVTrans++] = pVTab;\r\n  sqlite3VtabLock(pVTab);\r\n}\r\n\r\n/*\r\n** This function is invoked by the vdbe to call the xCreate method\r\n** of the virtual table named zTab in database iDb. \r\n**\r\n** If an error occurs, *pzErr is set to point an an English language\r\n** description of the error and an SQLITE_XXX error code is returned.\r\n** In this case the caller must call sqlite3DbFree(db, ) on *pzErr.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){\r\n  int rc = SQLITE_OK;\r\n  Table *pTab;\r\n  Module *pMod;\r\n  const char *zMod;\r\n\r\n  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);\r\n  assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );\r\n\r\n  /* Locate the required virtual table module */\r\n  zMod = pTab->azModuleArg[0];\r\n  pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod));\r\n\r\n  /* If the module has been registered and includes a Create method, \r\n  ** invoke it now. If the module has not been registered, return an \r\n  ** error. Otherwise, do nothing.\r\n  */\r\n  if( !pMod ){\r\n    *pzErr = sqlite3MPrintf(db, \"no such module: %s\", zMod);\r\n    rc = SQLITE_ERROR;\r\n  }else{\r\n    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr);\r\n  }\r\n\r\n  /* Justification of ALWAYS():  The xConstructor method is required to\r\n  ** create a valid sqlite3_vtab if it returns SQLITE_OK. */\r\n  if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){\r\n    rc = growVTrans(db);\r\n    if( rc==SQLITE_OK ){\r\n      addToVTrans(db, sqlite3GetVTable(db, pTab));\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is used to set the schema of a virtual table.  It is only\r\n** valid to call this function from within the xCreate() or xConnect() of a\r\n** virtual table module.\r\n*/\r\nSQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){\r\n  Parse *pParse;\r\n\r\n  int rc = SQLITE_OK;\r\n  Table *pTab;\r\n  char *zErr = 0;\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( !db->pVtabCtx || !(pTab = db->pVtabCtx->pTab) ){\r\n    sqlite3Error(db, SQLITE_MISUSE, 0);\r\n    sqlite3_mutex_leave(db->mutex);\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  assert( (pTab->tabFlags & TF_Virtual)!=0 );\r\n\r\n  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));\r\n  if( pParse==0 ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    pParse->declareVtab = 1;\r\n    pParse->db = db;\r\n    pParse->nQueryLoop = 1;\r\n  \r\n    if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr) \r\n     && pParse->pNewTable\r\n     && !db->mallocFailed\r\n     && !pParse->pNewTable->pSelect\r\n     && (pParse->pNewTable->tabFlags & TF_Virtual)==0\r\n    ){\r\n      if( !pTab->aCol ){\r\n        pTab->aCol = pParse->pNewTable->aCol;\r\n        pTab->nCol = pParse->pNewTable->nCol;\r\n        pParse->pNewTable->nCol = 0;\r\n        pParse->pNewTable->aCol = 0;\r\n      }\r\n      db->pVtabCtx->pTab = 0;\r\n    }else{\r\n      sqlite3Error(db, SQLITE_ERROR, (zErr ? \"%s\" : 0), zErr);\r\n      sqlite3DbFree(db, zErr);\r\n      rc = SQLITE_ERROR;\r\n    }\r\n    pParse->declareVtab = 0;\r\n  \r\n    if( pParse->pVdbe ){\r\n      sqlite3VdbeFinalize(pParse->pVdbe);\r\n    }\r\n    sqlite3DeleteTable(db, pParse->pNewTable);\r\n    sqlite3StackFree(db, pParse);\r\n  }\r\n\r\n  assert( (rc&0xff)==rc );\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is invoked by the vdbe to call the xDestroy method\r\n** of the virtual table named zTab in database iDb. This occurs\r\n** when a DROP TABLE is mentioned.\r\n**\r\n** This call is a no-op if zTab is not a virtual table.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){\r\n  int rc = SQLITE_OK;\r\n  Table *pTab;\r\n\r\n  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);\r\n  if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){\r\n    VTable *p = vtabDisconnectAll(db, pTab);\r\n\r\n    assert( rc==SQLITE_OK );\r\n    rc = p->pMod->pModule->xDestroy(p->pVtab);\r\n\r\n    /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */\r\n    if( rc==SQLITE_OK ){\r\n      assert( pTab->pVTable==p && p->pNext==0 );\r\n      p->pVtab = 0;\r\n      pTab->pVTable = 0;\r\n      sqlite3VtabUnlock(p);\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function invokes either the xRollback or xCommit method\r\n** of each of the virtual tables in the sqlite3.aVTrans array. The method\r\n** called is identified by the second argument, \"offset\", which is\r\n** the offset of the method to call in the sqlite3_module structure.\r\n**\r\n** The array is cleared after invoking the callbacks. \r\n*/\r\nstatic void callFinaliser(sqlite3 *db, int offset){\r\n  int i;\r\n  if( db->aVTrans ){\r\n    for(i=0; i<db->nVTrans; i++){\r\n      VTable *pVTab = db->aVTrans[i];\r\n      sqlite3_vtab *p = pVTab->pVtab;\r\n      if( p ){\r\n        int (*x)(sqlite3_vtab *);\r\n        x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset);\r\n        if( x ) x(p);\r\n      }\r\n      pVTab->iSavepoint = 0;\r\n      sqlite3VtabUnlock(pVTab);\r\n    }\r\n    sqlite3DbFree(db, db->aVTrans);\r\n    db->nVTrans = 0;\r\n    db->aVTrans = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Invoke the xSync method of all virtual tables in the sqlite3.aVTrans\r\n** array. Return the error code for the first error that occurs, or\r\n** SQLITE_OK if all xSync operations are successful.\r\n**\r\n** Set *pzErrmsg to point to a buffer that should be released using \r\n** sqlite3DbFree() containing an error message, if one is available.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, char **pzErrmsg){\r\n  int i;\r\n  int rc = SQLITE_OK;\r\n  VTable **aVTrans = db->aVTrans;\r\n\r\n  db->aVTrans = 0;\r\n  for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){\r\n    int (*x)(sqlite3_vtab *);\r\n    sqlite3_vtab *pVtab = aVTrans[i]->pVtab;\r\n    if( pVtab && (x = pVtab->pModule->xSync)!=0 ){\r\n      rc = x(pVtab);\r\n      sqlite3DbFree(db, *pzErrmsg);\r\n      *pzErrmsg = sqlite3DbStrDup(db, pVtab->zErrMsg);\r\n      sqlite3_free(pVtab->zErrMsg);\r\n    }\r\n  }\r\n  db->aVTrans = aVTrans;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Invoke the xRollback method of all virtual tables in the \r\n** sqlite3.aVTrans array. Then clear the array itself.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db){\r\n  callFinaliser(db, offsetof(sqlite3_module,xRollback));\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Invoke the xCommit method of all virtual tables in the \r\n** sqlite3.aVTrans array. Then clear the array itself.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db){\r\n  callFinaliser(db, offsetof(sqlite3_module,xCommit));\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** If the virtual table pVtab supports the transaction interface\r\n** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is\r\n** not currently open, invoke the xBegin method now.\r\n**\r\n** If the xBegin call is successful, place the sqlite3_vtab pointer\r\n** in the sqlite3.aVTrans array.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){\r\n  int rc = SQLITE_OK;\r\n  const sqlite3_module *pModule;\r\n\r\n  /* Special case: If db->aVTrans is NULL and db->nVTrans is greater\r\n  ** than zero, then this function is being called from within a\r\n  ** virtual module xSync() callback. It is illegal to write to \r\n  ** virtual module tables in this case, so return SQLITE_LOCKED.\r\n  */\r\n  if( sqlite3VtabInSync(db) ){\r\n    return SQLITE_LOCKED;\r\n  }\r\n  if( !pVTab ){\r\n    return SQLITE_OK;\r\n  } \r\n  pModule = pVTab->pVtab->pModule;\r\n\r\n  if( pModule->xBegin ){\r\n    int i;\r\n\r\n    /* If pVtab is already in the aVTrans array, return early */\r\n    for(i=0; i<db->nVTrans; i++){\r\n      if( db->aVTrans[i]==pVTab ){\r\n        return SQLITE_OK;\r\n      }\r\n    }\r\n\r\n    /* Invoke the xBegin method. If successful, add the vtab to the \r\n    ** sqlite3.aVTrans[] array. */\r\n    rc = growVTrans(db);\r\n    if( rc==SQLITE_OK ){\r\n      rc = pModule->xBegin(pVTab->pVtab);\r\n      if( rc==SQLITE_OK ){\r\n        addToVTrans(db, pVTab);\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Invoke either the xSavepoint, xRollbackTo or xRelease method of all\r\n** virtual tables that currently have an open transaction. Pass iSavepoint\r\n** as the second argument to the virtual table method invoked.\r\n**\r\n** If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is\r\n** SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is \r\n** SAVEPOINT_RELEASE, then the xRelease method of each virtual table with\r\n** an open transaction is invoked.\r\n**\r\n** If any virtual table method returns an error code other than SQLITE_OK, \r\n** processing is abandoned and the error returned to the caller of this\r\n** function immediately. If all calls to virtual table methods are successful,\r\n** SQLITE_OK is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( op==SAVEPOINT_RELEASE||op==SAVEPOINT_ROLLBACK||op==SAVEPOINT_BEGIN );\r\n  assert( iSavepoint>=0 );\r\n  if( db->aVTrans ){\r\n    int i;\r\n    for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){\r\n      VTable *pVTab = db->aVTrans[i];\r\n      const sqlite3_module *pMod = pVTab->pMod->pModule;\r\n      if( pVTab->pVtab && pMod->iVersion>=2 ){\r\n        int (*xMethod)(sqlite3_vtab *, int);\r\n        switch( op ){\r\n          case SAVEPOINT_BEGIN:\r\n            xMethod = pMod->xSavepoint;\r\n            pVTab->iSavepoint = iSavepoint+1;\r\n            break;\r\n          case SAVEPOINT_ROLLBACK:\r\n            xMethod = pMod->xRollbackTo;\r\n            break;\r\n          default:\r\n            xMethod = pMod->xRelease;\r\n            break;\r\n        }\r\n        if( xMethod && pVTab->iSavepoint>iSavepoint ){\r\n          rc = xMethod(pVTab->pVtab, iSavepoint);\r\n        }\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The first parameter (pDef) is a function implementation.  The\r\n** second parameter (pExpr) is the first argument to this function.\r\n** If pExpr is a column in a virtual table, then let the virtual\r\n** table implementation have an opportunity to overload the function.\r\n**\r\n** This routine is used to allow virtual table implementations to\r\n** overload MATCH, LIKE, GLOB, and REGEXP operators.\r\n**\r\n** Return either the pDef argument (indicating no change) or a \r\n** new FuncDef structure that is marked as ephemeral using the\r\n** SQLITE_FUNC_EPHEM flag.\r\n*/\r\nSQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(\r\n  sqlite3 *db,    /* Database connection for reporting malloc problems */\r\n  FuncDef *pDef,  /* Function to possibly overload */\r\n  int nArg,       /* Number of arguments to the function */\r\n  Expr *pExpr     /* First argument to the function */\r\n){\r\n  Table *pTab;\r\n  sqlite3_vtab *pVtab;\r\n  sqlite3_module *pMod;\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**) = 0;\r\n  void *pArg = 0;\r\n  FuncDef *pNew;\r\n  int rc = 0;\r\n  char *zLowerName;\r\n  unsigned char *z;\r\n\r\n\r\n  /* Check to see the left operand is a column in a virtual table */\r\n  if( NEVER(pExpr==0) ) return pDef;\r\n  if( pExpr->op!=TK_COLUMN ) return pDef;\r\n  pTab = pExpr->pTab;\r\n  if( NEVER(pTab==0) ) return pDef;\r\n  if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;\r\n  pVtab = sqlite3GetVTable(db, pTab)->pVtab;\r\n  assert( pVtab!=0 );\r\n  assert( pVtab->pModule!=0 );\r\n  pMod = (sqlite3_module *)pVtab->pModule;\r\n  if( pMod->xFindFunction==0 ) return pDef;\r\n \r\n  /* Call the xFindFunction method on the virtual table implementation\r\n  ** to see if the implementation wants to overload this function \r\n  */\r\n  zLowerName = sqlite3DbStrDup(db, pDef->zName);\r\n  if( zLowerName ){\r\n    for(z=(unsigned char*)zLowerName; *z; z++){\r\n      *z = sqlite3UpperToLower[*z];\r\n    }\r\n    rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xFunc, &pArg);\r\n    sqlite3DbFree(db, zLowerName);\r\n  }\r\n  if( rc==0 ){\r\n    return pDef;\r\n  }\r\n\r\n  /* Create a new ephemeral function definition for the overloaded\r\n  ** function */\r\n  pNew = sqlite3DbMallocZero(db, sizeof(*pNew)\r\n                             + sqlite3Strlen30(pDef->zName) + 1);\r\n  if( pNew==0 ){\r\n    return pDef;\r\n  }\r\n  *pNew = *pDef;\r\n  pNew->zName = (char *)&pNew[1];\r\n  memcpy(pNew->zName, pDef->zName, sqlite3Strlen30(pDef->zName)+1);\r\n  pNew->xFunc = xFunc;\r\n  pNew->pUserData = pArg;\r\n  pNew->flags |= SQLITE_FUNC_EPHEM;\r\n  return pNew;\r\n}\r\n\r\n/*\r\n** Make sure virtual table pTab is contained in the pParse->apVirtualLock[]\r\n** array so that an OP_VBegin will get generated for it.  Add pTab to the\r\n** array if it is missing.  If pTab is already in the array, this routine\r\n** is a no-op.\r\n*/\r\nSQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){\r\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\r\n  int i, n;\r\n  Table **apVtabLock;\r\n\r\n  assert( IsVirtual(pTab) );\r\n  for(i=0; i<pToplevel->nVtabLock; i++){\r\n    if( pTab==pToplevel->apVtabLock[i] ) return;\r\n  }\r\n  n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]);\r\n  apVtabLock = sqlite3_realloc(pToplevel->apVtabLock, n);\r\n  if( apVtabLock ){\r\n    pToplevel->apVtabLock = apVtabLock;\r\n    pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab;\r\n  }else{\r\n    pToplevel->db->mallocFailed = 1;\r\n  }\r\n}\r\n\r\n/*\r\n** Return the ON CONFLICT resolution mode in effect for the virtual\r\n** table update operation currently in progress.\r\n**\r\n** The results of this routine are undefined unless it is called from\r\n** within an xUpdate method.\r\n*/\r\nSQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){\r\n  static const unsigned char aMap[] = { \r\n    SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE \r\n  };\r\n  assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 );\r\n  assert( OE_Ignore==4 && OE_Replace==5 );\r\n  assert( db->vtabOnConflict>=1 && db->vtabOnConflict<=5 );\r\n  return (int)aMap[db->vtabOnConflict-1];\r\n}\r\n\r\n/*\r\n** Call from within the xCreate() or xConnect() methods to provide \r\n** the SQLite core with additional information about the behavior\r\n** of the virtual table being implemented.\r\n*/\r\nSQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){\r\n  va_list ap;\r\n  int rc = SQLITE_OK;\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n\r\n  va_start(ap, op);\r\n  switch( op ){\r\n    case SQLITE_VTAB_CONSTRAINT_SUPPORT: {\r\n      VtabCtx *p = db->pVtabCtx;\r\n      if( !p ){\r\n        rc = SQLITE_MISUSE_BKPT;\r\n      }else{\r\n        assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 );\r\n        p->pVTable->bConstraint = (u8)va_arg(ap, int);\r\n      }\r\n      break;\r\n    }\r\n    default:\r\n      rc = SQLITE_MISUSE_BKPT;\r\n      break;\r\n  }\r\n  va_end(ap);\r\n\r\n  if( rc!=SQLITE_OK ) sqlite3Error(db, rc, 0);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n/************** End of vtab.c ************************************************/\r\n/************** Begin file where.c *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This module contains C code that generates VDBE code used to process\r\n** the WHERE clause of SQL statements.  This module is responsible for\r\n** generating the code that loops through a table looking for applicable\r\n** rows.  Indices are selected and used to speed the search when doing\r\n** so is applicable.  Because this module is responsible for selecting\r\n** indices, you might also think of this module as the \"query optimizer\".\r\n*/\r\n\r\n\r\n/*\r\n** Trace output macros\r\n*/\r\n#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)\r\nSQLITE_PRIVATE int sqlite3WhereTrace = 0;\r\n#endif\r\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\r\n# define WHERETRACE(X)  if(sqlite3WhereTrace) sqlite3DebugPrintf X\r\n#else\r\n# define WHERETRACE(X)\r\n#endif\r\n\r\n/* Forward reference\r\n*/\r\ntypedef struct WhereClause WhereClause;\r\ntypedef struct WhereMaskSet WhereMaskSet;\r\ntypedef struct WhereOrInfo WhereOrInfo;\r\ntypedef struct WhereAndInfo WhereAndInfo;\r\ntypedef struct WhereCost WhereCost;\r\n\r\n/*\r\n** The query generator uses an array of instances of this structure to\r\n** help it analyze the subexpressions of the WHERE clause.  Each WHERE\r\n** clause subexpression is separated from the others by AND operators,\r\n** usually, or sometimes subexpressions separated by OR.\r\n**\r\n** All WhereTerms are collected into a single WhereClause structure.  \r\n** The following identity holds:\r\n**\r\n**        WhereTerm.pWC->a[WhereTerm.idx] == WhereTerm\r\n**\r\n** When a term is of the form:\r\n**\r\n**              X <op> <expr>\r\n**\r\n** where X is a column name and <op> is one of certain operators,\r\n** then WhereTerm.leftCursor and WhereTerm.u.leftColumn record the\r\n** cursor number and column number for X.  WhereTerm.eOperator records\r\n** the <op> using a bitmask encoding defined by WO_xxx below.  The\r\n** use of a bitmask encoding for the operator allows us to search\r\n** quickly for terms that match any of several different operators.\r\n**\r\n** A WhereTerm might also be two or more subterms connected by OR:\r\n**\r\n**         (t1.X <op> <expr>) OR (t1.Y <op> <expr>) OR ....\r\n**\r\n** In this second case, wtFlag as the TERM_ORINFO set and eOperator==WO_OR\r\n** and the WhereTerm.u.pOrInfo field points to auxiliary information that\r\n** is collected about the\r\n**\r\n** If a term in the WHERE clause does not match either of the two previous\r\n** categories, then eOperator==0.  The WhereTerm.pExpr field is still set\r\n** to the original subexpression content and wtFlags is set up appropriately\r\n** but no other fields in the WhereTerm object are meaningful.\r\n**\r\n** When eOperator!=0, prereqRight and prereqAll record sets of cursor numbers,\r\n** but they do so indirectly.  A single WhereMaskSet structure translates\r\n** cursor number into bits and the translated bit is stored in the prereq\r\n** fields.  The translation is used in order to maximize the number of\r\n** bits that will fit in a Bitmask.  The VDBE cursor numbers might be\r\n** spread out over the non-negative integers.  For example, the cursor\r\n** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45.  The WhereMaskSet\r\n** translates these sparse cursor numbers into consecutive integers\r\n** beginning with 0 in order to make the best possible use of the available\r\n** bits in the Bitmask.  So, in the example above, the cursor numbers\r\n** would be mapped into integers 0 through 7.\r\n**\r\n** The number of terms in a join is limited by the number of bits\r\n** in prereqRight and prereqAll.  The default is 64 bits, hence SQLite\r\n** is only able to process joins with 64 or fewer tables.\r\n*/\r\ntypedef struct WhereTerm WhereTerm;\r\nstruct WhereTerm {\r\n  Expr *pExpr;            /* Pointer to the subexpression that is this term */\r\n  int iParent;            /* Disable pWC->a[iParent] when this term disabled */\r\n  int leftCursor;         /* Cursor number of X in \"X <op> <expr>\" */\r\n  union {\r\n    int leftColumn;         /* Column number of X in \"X <op> <expr>\" */\r\n    WhereOrInfo *pOrInfo;   /* Extra information if eOperator==WO_OR */\r\n    WhereAndInfo *pAndInfo; /* Extra information if eOperator==WO_AND */\r\n  } u;\r\n  u16 eOperator;          /* A WO_xx value describing <op> */\r\n  u8 wtFlags;             /* TERM_xxx bit flags.  See below */\r\n  u8 nChild;              /* Number of children that must disable us */\r\n  WhereClause *pWC;       /* The clause this term is part of */\r\n  Bitmask prereqRight;    /* Bitmask of tables used by pExpr->pRight */\r\n  Bitmask prereqAll;      /* Bitmask of tables referenced by pExpr */\r\n};\r\n\r\n/*\r\n** Allowed values of WhereTerm.wtFlags\r\n*/\r\n#define TERM_DYNAMIC    0x01   /* Need to call sqlite3ExprDelete(db, pExpr) */\r\n#define TERM_VIRTUAL    0x02   /* Added by the optimizer.  Do not code */\r\n#define TERM_CODED      0x04   /* This term is already coded */\r\n#define TERM_COPIED     0x08   /* Has a child */\r\n#define TERM_ORINFO     0x10   /* Need to free the WhereTerm.u.pOrInfo object */\r\n#define TERM_ANDINFO    0x20   /* Need to free the WhereTerm.u.pAndInfo obj */\r\n#define TERM_OR_OK      0x40   /* Used during OR-clause processing */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n#  define TERM_VNULL    0x80   /* Manufactured x>NULL or x<=NULL term */\r\n#else\r\n#  define TERM_VNULL    0x00   /* Disabled if not using stat3 */\r\n#endif\r\n\r\n/*\r\n** An instance of the following structure holds all information about a\r\n** WHERE clause.  Mostly this is a container for one or more WhereTerms.\r\n**\r\n** Explanation of pOuter:  For a WHERE clause of the form\r\n**\r\n**           a AND ((b AND c) OR (d AND e)) AND f\r\n**\r\n** There are separate WhereClause objects for the whole clause and for\r\n** the subclauses \"(b AND c)\" and \"(d AND e)\".  The pOuter field of the\r\n** subclauses points to the WhereClause object for the whole clause.\r\n*/\r\nstruct WhereClause {\r\n  Parse *pParse;           /* The parser context */\r\n  WhereMaskSet *pMaskSet;  /* Mapping of table cursor numbers to bitmasks */\r\n  Bitmask vmask;           /* Bitmask identifying virtual table cursors */\r\n  WhereClause *pOuter;     /* Outer conjunction */\r\n  u8 op;                   /* Split operator.  TK_AND or TK_OR */\r\n  u16 wctrlFlags;          /* Might include WHERE_AND_ONLY */\r\n  int nTerm;               /* Number of terms */\r\n  int nSlot;               /* Number of entries in a[] */\r\n  WhereTerm *a;            /* Each a[] describes a term of the WHERE cluase */\r\n#if defined(SQLITE_SMALL_STACK)\r\n  WhereTerm aStatic[1];    /* Initial static space for a[] */\r\n#else\r\n  WhereTerm aStatic[8];    /* Initial static space for a[] */\r\n#endif\r\n};\r\n\r\n/*\r\n** A WhereTerm with eOperator==WO_OR has its u.pOrInfo pointer set to\r\n** a dynamically allocated instance of the following structure.\r\n*/\r\nstruct WhereOrInfo {\r\n  WhereClause wc;          /* Decomposition into subterms */\r\n  Bitmask indexable;       /* Bitmask of all indexable tables in the clause */\r\n};\r\n\r\n/*\r\n** A WhereTerm with eOperator==WO_AND has its u.pAndInfo pointer set to\r\n** a dynamically allocated instance of the following structure.\r\n*/\r\nstruct WhereAndInfo {\r\n  WhereClause wc;          /* The subexpression broken out */\r\n};\r\n\r\n/*\r\n** An instance of the following structure keeps track of a mapping\r\n** between VDBE cursor numbers and bits of the bitmasks in WhereTerm.\r\n**\r\n** The VDBE cursor numbers are small integers contained in \r\n** SrcList_item.iCursor and Expr.iTable fields.  For any given WHERE \r\n** clause, the cursor numbers might not begin with 0 and they might\r\n** contain gaps in the numbering sequence.  But we want to make maximum\r\n** use of the bits in our bitmasks.  This structure provides a mapping\r\n** from the sparse cursor numbers into consecutive integers beginning\r\n** with 0.\r\n**\r\n** If WhereMaskSet.ix[A]==B it means that The A-th bit of a Bitmask\r\n** corresponds VDBE cursor number B.  The A-th bit of a bitmask is 1<<A.\r\n**\r\n** For example, if the WHERE clause expression used these VDBE\r\n** cursors:  4, 5, 8, 29, 57, 73.  Then the  WhereMaskSet structure\r\n** would map those cursor numbers into bits 0 through 5.\r\n**\r\n** Note that the mapping is not necessarily ordered.  In the example\r\n** above, the mapping might go like this:  4->3, 5->1, 8->2, 29->0,\r\n** 57->5, 73->4.  Or one of 719 other combinations might be used. It\r\n** does not really matter.  What is important is that sparse cursor\r\n** numbers all get mapped into bit numbers that begin with 0 and contain\r\n** no gaps.\r\n*/\r\nstruct WhereMaskSet {\r\n  int n;                        /* Number of assigned cursor values */\r\n  int ix[BMS];                  /* Cursor assigned to each bit */\r\n};\r\n\r\n/*\r\n** A WhereCost object records a lookup strategy and the estimated\r\n** cost of pursuing that strategy.\r\n*/\r\nstruct WhereCost {\r\n  WherePlan plan;    /* The lookup strategy */\r\n  double rCost;      /* Overall cost of pursuing this search strategy */\r\n  Bitmask used;      /* Bitmask of cursors used by this plan */\r\n};\r\n\r\n/*\r\n** Bitmasks for the operators that indices are able to exploit.  An\r\n** OR-ed combination of these values can be used when searching for\r\n** terms in the where clause.\r\n*/\r\n#define WO_IN     0x001\r\n#define WO_EQ     0x002\r\n#define WO_LT     (WO_EQ<<(TK_LT-TK_EQ))\r\n#define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))\r\n#define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))\r\n#define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))\r\n#define WO_MATCH  0x040\r\n#define WO_ISNULL 0x080\r\n#define WO_OR     0x100       /* Two or more OR-connected terms */\r\n#define WO_AND    0x200       /* Two or more AND-connected terms */\r\n#define WO_NOOP   0x800       /* This term does not restrict search space */\r\n\r\n#define WO_ALL    0xfff       /* Mask of all possible WO_* values */\r\n#define WO_SINGLE 0x0ff       /* Mask of all non-compound WO_* values */\r\n\r\n/*\r\n** Value for wsFlags returned by bestIndex() and stored in\r\n** WhereLevel.wsFlags.  These flags determine which search\r\n** strategies are appropriate.\r\n**\r\n** The least significant 12 bits is reserved as a mask for WO_ values above.\r\n** The WhereLevel.wsFlags field is usually set to WO_IN|WO_EQ|WO_ISNULL.\r\n** But if the table is the right table of a left join, WhereLevel.wsFlags\r\n** is set to WO_IN|WO_EQ.  The WhereLevel.wsFlags field can then be used as\r\n** the \"op\" parameter to findTerm when we are resolving equality constraints.\r\n** ISNULL constraints will then not be used on the right table of a left\r\n** join.  Tickets #2177 and #2189.\r\n*/\r\n#define WHERE_ROWID_EQ     0x00001000  /* rowid=EXPR or rowid IN (...) */\r\n#define WHERE_ROWID_RANGE  0x00002000  /* rowid<EXPR and/or rowid>EXPR */\r\n#define WHERE_COLUMN_EQ    0x00010000  /* x=EXPR or x IN (...) or x IS NULL */\r\n#define WHERE_COLUMN_RANGE 0x00020000  /* x<EXPR and/or x>EXPR */\r\n#define WHERE_COLUMN_IN    0x00040000  /* x IN (...) */\r\n#define WHERE_COLUMN_NULL  0x00080000  /* x IS NULL */\r\n#define WHERE_INDEXED      0x000f0000  /* Anything that uses an index */\r\n#define WHERE_NOT_FULLSCAN 0x100f3000  /* Does not do a full table scan */\r\n#define WHERE_IN_ABLE      0x000f1000  /* Able to support an IN operator */\r\n#define WHERE_TOP_LIMIT    0x00100000  /* x<EXPR or x<=EXPR constraint */\r\n#define WHERE_BTM_LIMIT    0x00200000  /* x>EXPR or x>=EXPR constraint */\r\n#define WHERE_BOTH_LIMIT   0x00300000  /* Both x>EXPR and x<EXPR */\r\n#define WHERE_IDX_ONLY     0x00800000  /* Use index only - omit table */\r\n#define WHERE_ORDERBY      0x01000000  /* Output will appear in correct order */\r\n#define WHERE_REVERSE      0x02000000  /* Scan in reverse order */\r\n#define WHERE_UNIQUE       0x04000000  /* Selects no more than one row */\r\n#define WHERE_VIRTUALTABLE 0x08000000  /* Use virtual-table processing */\r\n#define WHERE_MULTI_OR     0x10000000  /* OR using multiple indices */\r\n#define WHERE_TEMP_INDEX   0x20000000  /* Uses an ephemeral index */\r\n#define WHERE_DISTINCT     0x40000000  /* Correct order for DISTINCT */\r\n\r\n/*\r\n** Initialize a preallocated WhereClause structure.\r\n*/\r\nstatic void whereClauseInit(\r\n  WhereClause *pWC,        /* The WhereClause to be initialized */\r\n  Parse *pParse,           /* The parsing context */\r\n  WhereMaskSet *pMaskSet,  /* Mapping from table cursor numbers to bitmasks */\r\n  u16 wctrlFlags           /* Might include WHERE_AND_ONLY */\r\n){\r\n  pWC->pParse = pParse;\r\n  pWC->pMaskSet = pMaskSet;\r\n  pWC->pOuter = 0;\r\n  pWC->nTerm = 0;\r\n  pWC->nSlot = ArraySize(pWC->aStatic);\r\n  pWC->a = pWC->aStatic;\r\n  pWC->vmask = 0;\r\n  pWC->wctrlFlags = wctrlFlags;\r\n}\r\n\r\n/* Forward reference */\r\nstatic void whereClauseClear(WhereClause*);\r\n\r\n/*\r\n** Deallocate all memory associated with a WhereOrInfo object.\r\n*/\r\nstatic void whereOrInfoDelete(sqlite3 *db, WhereOrInfo *p){\r\n  whereClauseClear(&p->wc);\r\n  sqlite3DbFree(db, p);\r\n}\r\n\r\n/*\r\n** Deallocate all memory associated with a WhereAndInfo object.\r\n*/\r\nstatic void whereAndInfoDelete(sqlite3 *db, WhereAndInfo *p){\r\n  whereClauseClear(&p->wc);\r\n  sqlite3DbFree(db, p);\r\n}\r\n\r\n/*\r\n** Deallocate a WhereClause structure.  The WhereClause structure\r\n** itself is not freed.  This routine is the inverse of whereClauseInit().\r\n*/\r\nstatic void whereClauseClear(WhereClause *pWC){\r\n  int i;\r\n  WhereTerm *a;\r\n  sqlite3 *db = pWC->pParse->db;\r\n  for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){\r\n    if( a->wtFlags & TERM_DYNAMIC ){\r\n      sqlite3ExprDelete(db, a->pExpr);\r\n    }\r\n    if( a->wtFlags & TERM_ORINFO ){\r\n      whereOrInfoDelete(db, a->u.pOrInfo);\r\n    }else if( a->wtFlags & TERM_ANDINFO ){\r\n      whereAndInfoDelete(db, a->u.pAndInfo);\r\n    }\r\n  }\r\n  if( pWC->a!=pWC->aStatic ){\r\n    sqlite3DbFree(db, pWC->a);\r\n  }\r\n}\r\n\r\n/*\r\n** Add a single new WhereTerm entry to the WhereClause object pWC.\r\n** The new WhereTerm object is constructed from Expr p and with wtFlags.\r\n** The index in pWC->a[] of the new WhereTerm is returned on success.\r\n** 0 is returned if the new WhereTerm could not be added due to a memory\r\n** allocation error.  The memory allocation failure will be recorded in\r\n** the db->mallocFailed flag so that higher-level functions can detect it.\r\n**\r\n** This routine will increase the size of the pWC->a[] array as necessary.\r\n**\r\n** If the wtFlags argument includes TERM_DYNAMIC, then responsibility\r\n** for freeing the expression p is assumed by the WhereClause object pWC.\r\n** This is true even if this routine fails to allocate a new WhereTerm.\r\n**\r\n** WARNING:  This routine might reallocate the space used to store\r\n** WhereTerms.  All pointers to WhereTerms should be invalidated after\r\n** calling this routine.  Such pointers may be reinitialized by referencing\r\n** the pWC->a[] array.\r\n*/\r\nstatic int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){\r\n  WhereTerm *pTerm;\r\n  int idx;\r\n  testcase( wtFlags & TERM_VIRTUAL );  /* EV: R-00211-15100 */\r\n  if( pWC->nTerm>=pWC->nSlot ){\r\n    WhereTerm *pOld = pWC->a;\r\n    sqlite3 *db = pWC->pParse->db;\r\n    pWC->a = sqlite3DbMallocRaw(db, sizeof(pWC->a[0])*pWC->nSlot*2 );\r\n    if( pWC->a==0 ){\r\n      if( wtFlags & TERM_DYNAMIC ){\r\n        sqlite3ExprDelete(db, p);\r\n      }\r\n      pWC->a = pOld;\r\n      return 0;\r\n    }\r\n    memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);\r\n    if( pOld!=pWC->aStatic ){\r\n      sqlite3DbFree(db, pOld);\r\n    }\r\n    pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);\r\n  }\r\n  pTerm = &pWC->a[idx = pWC->nTerm++];\r\n  pTerm->pExpr = p;\r\n  pTerm->wtFlags = wtFlags;\r\n  pTerm->pWC = pWC;\r\n  pTerm->iParent = -1;\r\n  return idx;\r\n}\r\n\r\n/*\r\n** This routine identifies subexpressions in the WHERE clause where\r\n** each subexpression is separated by the AND operator or some other\r\n** operator specified in the op parameter.  The WhereClause structure\r\n** is filled with pointers to subexpressions.  For example:\r\n**\r\n**    WHERE  a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22)\r\n**           \\________/     \\_______________/     \\________________/\r\n**            slot[0]            slot[1]               slot[2]\r\n**\r\n** The original WHERE clause in pExpr is unaltered.  All this routine\r\n** does is make slot[] entries point to substructure within pExpr.\r\n**\r\n** In the previous sentence and in the diagram, \"slot[]\" refers to\r\n** the WhereClause.a[] array.  The slot[] array grows as needed to contain\r\n** all terms of the WHERE clause.\r\n*/\r\nstatic void whereSplit(WhereClause *pWC, Expr *pExpr, int op){\r\n  pWC->op = (u8)op;\r\n  if( pExpr==0 ) return;\r\n  if( pExpr->op!=op ){\r\n    whereClauseInsert(pWC, pExpr, 0);\r\n  }else{\r\n    whereSplit(pWC, pExpr->pLeft, op);\r\n    whereSplit(pWC, pExpr->pRight, op);\r\n  }\r\n}\r\n\r\n/*\r\n** Initialize an expression mask set (a WhereMaskSet object)\r\n*/\r\n#define initMaskSet(P)  memset(P, 0, sizeof(*P))\r\n\r\n/*\r\n** Return the bitmask for the given cursor number.  Return 0 if\r\n** iCursor is not in the set.\r\n*/\r\nstatic Bitmask getMask(WhereMaskSet *pMaskSet, int iCursor){\r\n  int i;\r\n  assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 );\r\n  for(i=0; i<pMaskSet->n; i++){\r\n    if( pMaskSet->ix[i]==iCursor ){\r\n      return ((Bitmask)1)<<i;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Create a new mask for cursor iCursor.\r\n**\r\n** There is one cursor per table in the FROM clause.  The number of\r\n** tables in the FROM clause is limited by a test early in the\r\n** sqlite3WhereBegin() routine.  So we know that the pMaskSet->ix[]\r\n** array will never overflow.\r\n*/\r\nstatic void createMask(WhereMaskSet *pMaskSet, int iCursor){\r\n  assert( pMaskSet->n < ArraySize(pMaskSet->ix) );\r\n  pMaskSet->ix[pMaskSet->n++] = iCursor;\r\n}\r\n\r\n/*\r\n** This routine walks (recursively) an expression tree and generates\r\n** a bitmask indicating which tables are used in that expression\r\n** tree.\r\n**\r\n** In order for this routine to work, the calling function must have\r\n** previously invoked sqlite3ResolveExprNames() on the expression.  See\r\n** the header comment on that routine for additional information.\r\n** The sqlite3ResolveExprNames() routines looks for column names and\r\n** sets their opcodes to TK_COLUMN and their Expr.iTable fields to\r\n** the VDBE cursor number of the table.  This routine just has to\r\n** translate the cursor numbers into bitmask values and OR all\r\n** the bitmasks together.\r\n*/\r\nstatic Bitmask exprListTableUsage(WhereMaskSet*, ExprList*);\r\nstatic Bitmask exprSelectTableUsage(WhereMaskSet*, Select*);\r\nstatic Bitmask exprTableUsage(WhereMaskSet *pMaskSet, Expr *p){\r\n  Bitmask mask = 0;\r\n  if( p==0 ) return 0;\r\n  if( p->op==TK_COLUMN ){\r\n    mask = getMask(pMaskSet, p->iTable);\r\n    return mask;\r\n  }\r\n  mask = exprTableUsage(pMaskSet, p->pRight);\r\n  mask |= exprTableUsage(pMaskSet, p->pLeft);\r\n  if( ExprHasProperty(p, EP_xIsSelect) ){\r\n    mask |= exprSelectTableUsage(pMaskSet, p->x.pSelect);\r\n  }else{\r\n    mask |= exprListTableUsage(pMaskSet, p->x.pList);\r\n  }\r\n  return mask;\r\n}\r\nstatic Bitmask exprListTableUsage(WhereMaskSet *pMaskSet, ExprList *pList){\r\n  int i;\r\n  Bitmask mask = 0;\r\n  if( pList ){\r\n    for(i=0; i<pList->nExpr; i++){\r\n      mask |= exprTableUsage(pMaskSet, pList->a[i].pExpr);\r\n    }\r\n  }\r\n  return mask;\r\n}\r\nstatic Bitmask exprSelectTableUsage(WhereMaskSet *pMaskSet, Select *pS){\r\n  Bitmask mask = 0;\r\n  while( pS ){\r\n    SrcList *pSrc = pS->pSrc;\r\n    mask |= exprListTableUsage(pMaskSet, pS->pEList);\r\n    mask |= exprListTableUsage(pMaskSet, pS->pGroupBy);\r\n    mask |= exprListTableUsage(pMaskSet, pS->pOrderBy);\r\n    mask |= exprTableUsage(pMaskSet, pS->pWhere);\r\n    mask |= exprTableUsage(pMaskSet, pS->pHaving);\r\n    if( ALWAYS(pSrc!=0) ){\r\n      int i;\r\n      for(i=0; i<pSrc->nSrc; i++){\r\n        mask |= exprSelectTableUsage(pMaskSet, pSrc->a[i].pSelect);\r\n        mask |= exprTableUsage(pMaskSet, pSrc->a[i].pOn);\r\n      }\r\n    }\r\n    pS = pS->pPrior;\r\n  }\r\n  return mask;\r\n}\r\n\r\n/*\r\n** Return TRUE if the given operator is one of the operators that is\r\n** allowed for an indexable WHERE clause term.  The allowed operators are\r\n** \"=\", \"<\", \">\", \"<=\", \">=\", and \"IN\".\r\n**\r\n** IMPLEMENTATION-OF: R-59926-26393 To be usable by an index a term must be\r\n** of one of the following forms: column = expression column > expression\r\n** column >= expression column < expression column <= expression\r\n** expression = column expression > column expression >= column\r\n** expression < column expression <= column column IN\r\n** (expression-list) column IN (subquery) column IS NULL\r\n*/\r\nstatic int allowedOp(int op){\r\n  assert( TK_GT>TK_EQ && TK_GT<TK_GE );\r\n  assert( TK_LT>TK_EQ && TK_LT<TK_GE );\r\n  assert( TK_LE>TK_EQ && TK_LE<TK_GE );\r\n  assert( TK_GE==TK_EQ+4 );\r\n  return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL;\r\n}\r\n\r\n/*\r\n** Swap two objects of type TYPE.\r\n*/\r\n#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}\r\n\r\n/*\r\n** Commute a comparison operator.  Expressions of the form \"X op Y\"\r\n** are converted into \"Y op X\".\r\n**\r\n** If a collation sequence is associated with either the left or right\r\n** side of the comparison, it remains associated with the same side after\r\n** the commutation. So \"Y collate NOCASE op X\" becomes \r\n** \"X collate NOCASE op Y\". This is because any collation sequence on\r\n** the left hand side of a comparison overrides any collation sequence \r\n** attached to the right. For the same reason the EP_ExpCollate flag\r\n** is not commuted.\r\n*/\r\nstatic void exprCommute(Parse *pParse, Expr *pExpr){\r\n  u16 expRight = (pExpr->pRight->flags & EP_ExpCollate);\r\n  u16 expLeft = (pExpr->pLeft->flags & EP_ExpCollate);\r\n  assert( allowedOp(pExpr->op) && pExpr->op!=TK_IN );\r\n  pExpr->pRight->pColl = sqlite3ExprCollSeq(pParse, pExpr->pRight);\r\n  pExpr->pLeft->pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft);\r\n  SWAP(CollSeq*,pExpr->pRight->pColl,pExpr->pLeft->pColl);\r\n  pExpr->pRight->flags = (pExpr->pRight->flags & ~EP_ExpCollate) | expLeft;\r\n  pExpr->pLeft->flags = (pExpr->pLeft->flags & ~EP_ExpCollate) | expRight;\r\n  SWAP(Expr*,pExpr->pRight,pExpr->pLeft);\r\n  if( pExpr->op>=TK_GT ){\r\n    assert( TK_LT==TK_GT+2 );\r\n    assert( TK_GE==TK_LE+2 );\r\n    assert( TK_GT>TK_EQ );\r\n    assert( TK_GT<TK_LE );\r\n    assert( pExpr->op>=TK_GT && pExpr->op<=TK_GE );\r\n    pExpr->op = ((pExpr->op-TK_GT)^2)+TK_GT;\r\n  }\r\n}\r\n\r\n/*\r\n** Translate from TK_xx operator to WO_xx bitmask.\r\n*/\r\nstatic u16 operatorMask(int op){\r\n  u16 c;\r\n  assert( allowedOp(op) );\r\n  if( op==TK_IN ){\r\n    c = WO_IN;\r\n  }else if( op==TK_ISNULL ){\r\n    c = WO_ISNULL;\r\n  }else{\r\n    assert( (WO_EQ<<(op-TK_EQ)) < 0x7fff );\r\n    c = (u16)(WO_EQ<<(op-TK_EQ));\r\n  }\r\n  assert( op!=TK_ISNULL || c==WO_ISNULL );\r\n  assert( op!=TK_IN || c==WO_IN );\r\n  assert( op!=TK_EQ || c==WO_EQ );\r\n  assert( op!=TK_LT || c==WO_LT );\r\n  assert( op!=TK_LE || c==WO_LE );\r\n  assert( op!=TK_GT || c==WO_GT );\r\n  assert( op!=TK_GE || c==WO_GE );\r\n  return c;\r\n}\r\n\r\n/*\r\n** Search for a term in the WHERE clause that is of the form \"X <op> <expr>\"\r\n** where X is a reference to the iColumn of table iCur and <op> is one of\r\n** the WO_xx operator codes specified by the op parameter.\r\n** Return a pointer to the term.  Return 0 if not found.\r\n*/\r\nstatic WhereTerm *findTerm(\r\n  WhereClause *pWC,     /* The WHERE clause to be searched */\r\n  int iCur,             /* Cursor number of LHS */\r\n  int iColumn,          /* Column number of LHS */\r\n  Bitmask notReady,     /* RHS must not overlap with this mask */\r\n  u32 op,               /* Mask of WO_xx values describing operator */\r\n  Index *pIdx           /* Must be compatible with this index, if not NULL */\r\n){\r\n  WhereTerm *pTerm;\r\n  int k;\r\n  assert( iCur>=0 );\r\n  op &= WO_ALL;\r\n  for(; pWC; pWC=pWC->pOuter){\r\n    for(pTerm=pWC->a, k=pWC->nTerm; k; k--, pTerm++){\r\n      if( pTerm->leftCursor==iCur\r\n         && (pTerm->prereqRight & notReady)==0\r\n         && pTerm->u.leftColumn==iColumn\r\n         && (pTerm->eOperator & op)!=0\r\n      ){\r\n        if( iColumn>=0 && pIdx && pTerm->eOperator!=WO_ISNULL ){\r\n          Expr *pX = pTerm->pExpr;\r\n          CollSeq *pColl;\r\n          char idxaff;\r\n          int j;\r\n          Parse *pParse = pWC->pParse;\r\n  \r\n          idxaff = pIdx->pTable->aCol[iColumn].affinity;\r\n          if( !sqlite3IndexAffinityOk(pX, idxaff) ) continue;\r\n  \r\n          /* Figure out the collation sequence required from an index for\r\n          ** it to be useful for optimising expression pX. Store this\r\n          ** value in variable pColl.\r\n          */\r\n          assert(pX->pLeft);\r\n          pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);\r\n          assert(pColl || pParse->nErr);\r\n  \r\n          for(j=0; pIdx->aiColumn[j]!=iColumn; j++){\r\n            if( NEVER(j>=pIdx->nColumn) ) return 0;\r\n          }\r\n          if( pColl && sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ) continue;\r\n        }\r\n        return pTerm;\r\n      }\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* Forward reference */\r\nstatic void exprAnalyze(SrcList*, WhereClause*, int);\r\n\r\n/*\r\n** Call exprAnalyze on all terms in a WHERE clause.  \r\n**\r\n**\r\n*/\r\nstatic void exprAnalyzeAll(\r\n  SrcList *pTabList,       /* the FROM clause */\r\n  WhereClause *pWC         /* the WHERE clause to be analyzed */\r\n){\r\n  int i;\r\n  for(i=pWC->nTerm-1; i>=0; i--){\r\n    exprAnalyze(pTabList, pWC, i);\r\n  }\r\n}\r\n\r\n#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION\r\n/*\r\n** Check to see if the given expression is a LIKE or GLOB operator that\r\n** can be optimized using inequality constraints.  Return TRUE if it is\r\n** so and false if not.\r\n**\r\n** In order for the operator to be optimizible, the RHS must be a string\r\n** literal that does not begin with a wildcard.  \r\n*/\r\nstatic int isLikeOrGlob(\r\n  Parse *pParse,    /* Parsing and code generating context */\r\n  Expr *pExpr,      /* Test this expression */\r\n  Expr **ppPrefix,  /* Pointer to TK_STRING expression with pattern prefix */\r\n  int *pisComplete, /* True if the only wildcard is % in the last character */\r\n  int *pnoCase      /* True if uppercase is equivalent to lowercase */\r\n){\r\n  const char *z = 0;         /* String on RHS of LIKE operator */\r\n  Expr *pRight, *pLeft;      /* Right and left size of LIKE operator */\r\n  ExprList *pList;           /* List of operands to the LIKE operator */\r\n  int c;                     /* One character in z[] */\r\n  int cnt;                   /* Number of non-wildcard prefix characters */\r\n  char wc[3];                /* Wildcard characters */\r\n  sqlite3 *db = pParse->db;  /* Database connection */\r\n  sqlite3_value *pVal = 0;\r\n  int op;                    /* Opcode of pRight */\r\n\r\n  if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){\r\n    return 0;\r\n  }\r\n#ifdef SQLITE_EBCDIC\r\n  if( *pnoCase ) return 0;\r\n#endif\r\n  pList = pExpr->x.pList;\r\n  pLeft = pList->a[1].pExpr;\r\n  if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT ){\r\n    /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must\r\n    ** be the name of an indexed column with TEXT affinity. */\r\n    return 0;\r\n  }\r\n  assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */\r\n\r\n  pRight = pList->a[0].pExpr;\r\n  op = pRight->op;\r\n  if( op==TK_REGISTER ){\r\n    op = pRight->op2;\r\n  }\r\n  if( op==TK_VARIABLE ){\r\n    Vdbe *pReprepare = pParse->pReprepare;\r\n    int iCol = pRight->iColumn;\r\n    pVal = sqlite3VdbeGetValue(pReprepare, iCol, SQLITE_AFF_NONE);\r\n    if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){\r\n      z = (char *)sqlite3_value_text(pVal);\r\n    }\r\n    sqlite3VdbeSetVarmask(pParse->pVdbe, iCol);\r\n    assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );\r\n  }else if( op==TK_STRING ){\r\n    z = pRight->u.zToken;\r\n  }\r\n  if( z ){\r\n    cnt = 0;\r\n    while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){\r\n      cnt++;\r\n    }\r\n    if( cnt!=0 && 255!=(u8)z[cnt-1] ){\r\n      Expr *pPrefix;\r\n      *pisComplete = c==wc[0] && z[cnt+1]==0;\r\n      pPrefix = sqlite3Expr(db, TK_STRING, z);\r\n      if( pPrefix ) pPrefix->u.zToken[cnt] = 0;\r\n      *ppPrefix = pPrefix;\r\n      if( op==TK_VARIABLE ){\r\n        Vdbe *v = pParse->pVdbe;\r\n        sqlite3VdbeSetVarmask(v, pRight->iColumn);\r\n        if( *pisComplete && pRight->u.zToken[1] ){\r\n          /* If the rhs of the LIKE expression is a variable, and the current\r\n          ** value of the variable means there is no need to invoke the LIKE\r\n          ** function, then no OP_Variable will be added to the program.\r\n          ** This causes problems for the sqlite3_bind_parameter_name()\r\n          ** API. To workaround them, add a dummy OP_Variable here.\r\n          */ \r\n          int r1 = sqlite3GetTempReg(pParse);\r\n          sqlite3ExprCodeTarget(pParse, pRight, r1);\r\n          sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);\r\n          sqlite3ReleaseTempReg(pParse, r1);\r\n        }\r\n      }\r\n    }else{\r\n      z = 0;\r\n    }\r\n  }\r\n\r\n  sqlite3ValueFree(pVal);\r\n  return (z!=0);\r\n}\r\n#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */\r\n\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/*\r\n** Check to see if the given expression is of the form\r\n**\r\n**         column MATCH expr\r\n**\r\n** If it is then return TRUE.  If not, return FALSE.\r\n*/\r\nstatic int isMatchOfColumn(\r\n  Expr *pExpr      /* Test this expression */\r\n){\r\n  ExprList *pList;\r\n\r\n  if( pExpr->op!=TK_FUNCTION ){\r\n    return 0;\r\n  }\r\n  if( sqlite3StrICmp(pExpr->u.zToken,\"match\")!=0 ){\r\n    return 0;\r\n  }\r\n  pList = pExpr->x.pList;\r\n  if( pList->nExpr!=2 ){\r\n    return 0;\r\n  }\r\n  if( pList->a[1].pExpr->op != TK_COLUMN ){\r\n    return 0;\r\n  }\r\n  return 1;\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n/*\r\n** If the pBase expression originated in the ON or USING clause of\r\n** a join, then transfer the appropriate markings over to derived.\r\n*/\r\nstatic void transferJoinMarkings(Expr *pDerived, Expr *pBase){\r\n  pDerived->flags |= pBase->flags & EP_FromJoin;\r\n  pDerived->iRightJoinTable = pBase->iRightJoinTable;\r\n}\r\n\r\n#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)\r\n/*\r\n** Analyze a term that consists of two or more OR-connected\r\n** subterms.  So in:\r\n**\r\n**     ... WHERE  (a=5) AND (b=7 OR c=9 OR d=13) AND (d=13)\r\n**                          ^^^^^^^^^^^^^^^^^^^^\r\n**\r\n** This routine analyzes terms such as the middle term in the above example.\r\n** A WhereOrTerm object is computed and attached to the term under\r\n** analysis, regardless of the outcome of the analysis.  Hence:\r\n**\r\n**     WhereTerm.wtFlags   |=  TERM_ORINFO\r\n**     WhereTerm.u.pOrInfo  =  a dynamically allocated WhereOrTerm object\r\n**\r\n** The term being analyzed must have two or more of OR-connected subterms.\r\n** A single subterm might be a set of AND-connected sub-subterms.\r\n** Examples of terms under analysis:\r\n**\r\n**     (A)     t1.x=t2.y OR t1.x=t2.z OR t1.y=15 OR t1.z=t3.a+5\r\n**     (B)     x=expr1 OR expr2=x OR x=expr3\r\n**     (C)     t1.x=t2.y OR (t1.x=t2.z AND t1.y=15)\r\n**     (D)     x=expr1 OR (y>11 AND y<22 AND z LIKE '*hello*')\r\n**     (E)     (p.a=1 AND q.b=2 AND r.c=3) OR (p.x=4 AND q.y=5 AND r.z=6)\r\n**\r\n** CASE 1:\r\n**\r\n** If all subterms are of the form T.C=expr for some single column of C\r\n** a single table T (as shown in example B above) then create a new virtual\r\n** term that is an equivalent IN expression.  In other words, if the term\r\n** being analyzed is:\r\n**\r\n**      x = expr1  OR  expr2 = x  OR  x = expr3\r\n**\r\n** then create a new virtual term like this:\r\n**\r\n**      x IN (expr1,expr2,expr3)\r\n**\r\n** CASE 2:\r\n**\r\n** If all subterms are indexable by a single table T, then set\r\n**\r\n**     WhereTerm.eOperator              =  WO_OR\r\n**     WhereTerm.u.pOrInfo->indexable  |=  the cursor number for table T\r\n**\r\n** A subterm is \"indexable\" if it is of the form\r\n** \"T.C <op> <expr>\" where C is any column of table T and \r\n** <op> is one of \"=\", \"<\", \"<=\", \">\", \">=\", \"IS NULL\", or \"IN\".\r\n** A subterm is also indexable if it is an AND of two or more\r\n** subsubterms at least one of which is indexable.  Indexable AND \r\n** subterms have their eOperator set to WO_AND and they have\r\n** u.pAndInfo set to a dynamically allocated WhereAndTerm object.\r\n**\r\n** From another point of view, \"indexable\" means that the subterm could\r\n** potentially be used with an index if an appropriate index exists.\r\n** This analysis does not consider whether or not the index exists; that\r\n** is something the bestIndex() routine will determine.  This analysis\r\n** only looks at whether subterms appropriate for indexing exist.\r\n**\r\n** All examples A through E above all satisfy case 2.  But if a term\r\n** also statisfies case 1 (such as B) we know that the optimizer will\r\n** always prefer case 1, so in that case we pretend that case 2 is not\r\n** satisfied.\r\n**\r\n** It might be the case that multiple tables are indexable.  For example,\r\n** (E) above is indexable on tables P, Q, and R.\r\n**\r\n** Terms that satisfy case 2 are candidates for lookup by using\r\n** separate indices to find rowids for each subterm and composing\r\n** the union of all rowids using a RowSet object.  This is similar\r\n** to \"bitmap indices\" in other database engines.\r\n**\r\n** OTHERWISE:\r\n**\r\n** If neither case 1 nor case 2 apply, then leave the eOperator set to\r\n** zero.  This term is not useful for search.\r\n*/\r\nstatic void exprAnalyzeOrTerm(\r\n  SrcList *pSrc,            /* the FROM clause */\r\n  WhereClause *pWC,         /* the complete WHERE clause */\r\n  int idxTerm               /* Index of the OR-term to be analyzed */\r\n){\r\n  Parse *pParse = pWC->pParse;            /* Parser context */\r\n  sqlite3 *db = pParse->db;               /* Database connection */\r\n  WhereTerm *pTerm = &pWC->a[idxTerm];    /* The term to be analyzed */\r\n  Expr *pExpr = pTerm->pExpr;             /* The expression of the term */\r\n  WhereMaskSet *pMaskSet = pWC->pMaskSet; /* Table use masks */\r\n  int i;                                  /* Loop counters */\r\n  WhereClause *pOrWc;       /* Breakup of pTerm into subterms */\r\n  WhereTerm *pOrTerm;       /* A Sub-term within the pOrWc */\r\n  WhereOrInfo *pOrInfo;     /* Additional information associated with pTerm */\r\n  Bitmask chngToIN;         /* Tables that might satisfy case 1 */\r\n  Bitmask indexable;        /* Tables that are indexable, satisfying case 2 */\r\n\r\n  /*\r\n  ** Break the OR clause into its separate subterms.  The subterms are\r\n  ** stored in a WhereClause structure containing within the WhereOrInfo\r\n  ** object that is attached to the original OR clause term.\r\n  */\r\n  assert( (pTerm->wtFlags & (TERM_DYNAMIC|TERM_ORINFO|TERM_ANDINFO))==0 );\r\n  assert( pExpr->op==TK_OR );\r\n  pTerm->u.pOrInfo = pOrInfo = sqlite3DbMallocZero(db, sizeof(*pOrInfo));\r\n  if( pOrInfo==0 ) return;\r\n  pTerm->wtFlags |= TERM_ORINFO;\r\n  pOrWc = &pOrInfo->wc;\r\n  whereClauseInit(pOrWc, pWC->pParse, pMaskSet, pWC->wctrlFlags);\r\n  whereSplit(pOrWc, pExpr, TK_OR);\r\n  exprAnalyzeAll(pSrc, pOrWc);\r\n  if( db->mallocFailed ) return;\r\n  assert( pOrWc->nTerm>=2 );\r\n\r\n  /*\r\n  ** Compute the set of tables that might satisfy cases 1 or 2.\r\n  */\r\n  indexable = ~(Bitmask)0;\r\n  chngToIN = ~(pWC->vmask);\r\n  for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0 && indexable; i--, pOrTerm++){\r\n    if( (pOrTerm->eOperator & WO_SINGLE)==0 ){\r\n      WhereAndInfo *pAndInfo;\r\n      assert( pOrTerm->eOperator==0 );\r\n      assert( (pOrTerm->wtFlags & (TERM_ANDINFO|TERM_ORINFO))==0 );\r\n      chngToIN = 0;\r\n      pAndInfo = sqlite3DbMallocRaw(db, sizeof(*pAndInfo));\r\n      if( pAndInfo ){\r\n        WhereClause *pAndWC;\r\n        WhereTerm *pAndTerm;\r\n        int j;\r\n        Bitmask b = 0;\r\n        pOrTerm->u.pAndInfo = pAndInfo;\r\n        pOrTerm->wtFlags |= TERM_ANDINFO;\r\n        pOrTerm->eOperator = WO_AND;\r\n        pAndWC = &pAndInfo->wc;\r\n        whereClauseInit(pAndWC, pWC->pParse, pMaskSet, pWC->wctrlFlags);\r\n        whereSplit(pAndWC, pOrTerm->pExpr, TK_AND);\r\n        exprAnalyzeAll(pSrc, pAndWC);\r\n        pAndWC->pOuter = pWC;\r\n        testcase( db->mallocFailed );\r\n        if( !db->mallocFailed ){\r\n          for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){\r\n            assert( pAndTerm->pExpr );\r\n            if( allowedOp(pAndTerm->pExpr->op) ){\r\n              b |= getMask(pMaskSet, pAndTerm->leftCursor);\r\n            }\r\n          }\r\n        }\r\n        indexable &= b;\r\n      }\r\n    }else if( pOrTerm->wtFlags & TERM_COPIED ){\r\n      /* Skip this term for now.  We revisit it when we process the\r\n      ** corresponding TERM_VIRTUAL term */\r\n    }else{\r\n      Bitmask b;\r\n      b = getMask(pMaskSet, pOrTerm->leftCursor);\r\n      if( pOrTerm->wtFlags & TERM_VIRTUAL ){\r\n        WhereTerm *pOther = &pOrWc->a[pOrTerm->iParent];\r\n        b |= getMask(pMaskSet, pOther->leftCursor);\r\n      }\r\n      indexable &= b;\r\n      if( pOrTerm->eOperator!=WO_EQ ){\r\n        chngToIN = 0;\r\n      }else{\r\n        chngToIN &= b;\r\n      }\r\n    }\r\n  }\r\n\r\n  /*\r\n  ** Record the set of tables that satisfy case 2.  The set might be\r\n  ** empty.\r\n  */\r\n  pOrInfo->indexable = indexable;\r\n  pTerm->eOperator = indexable==0 ? 0 : WO_OR;\r\n\r\n  /*\r\n  ** chngToIN holds a set of tables that *might* satisfy case 1.  But\r\n  ** we have to do some additional checking to see if case 1 really\r\n  ** is satisfied.\r\n  **\r\n  ** chngToIN will hold either 0, 1, or 2 bits.  The 0-bit case means\r\n  ** that there is no possibility of transforming the OR clause into an\r\n  ** IN operator because one or more terms in the OR clause contain\r\n  ** something other than == on a column in the single table.  The 1-bit\r\n  ** case means that every term of the OR clause is of the form\r\n  ** \"table.column=expr\" for some single table.  The one bit that is set\r\n  ** will correspond to the common table.  We still need to check to make\r\n  ** sure the same column is used on all terms.  The 2-bit case is when\r\n  ** the all terms are of the form \"table1.column=table2.column\".  It\r\n  ** might be possible to form an IN operator with either table1.column\r\n  ** or table2.column as the LHS if either is common to every term of\r\n  ** the OR clause.\r\n  **\r\n  ** Note that terms of the form \"table.column1=table.column2\" (the\r\n  ** same table on both sizes of the ==) cannot be optimized.\r\n  */\r\n  if( chngToIN ){\r\n    int okToChngToIN = 0;     /* True if the conversion to IN is valid */\r\n    int iColumn = -1;         /* Column index on lhs of IN operator */\r\n    int iCursor = -1;         /* Table cursor common to all terms */\r\n    int j = 0;                /* Loop counter */\r\n\r\n    /* Search for a table and column that appears on one side or the\r\n    ** other of the == operator in every subterm.  That table and column\r\n    ** will be recorded in iCursor and iColumn.  There might not be any\r\n    ** such table and column.  Set okToChngToIN if an appropriate table\r\n    ** and column is found but leave okToChngToIN false if not found.\r\n    */\r\n    for(j=0; j<2 && !okToChngToIN; j++){\r\n      pOrTerm = pOrWc->a;\r\n      for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){\r\n        assert( pOrTerm->eOperator==WO_EQ );\r\n        pOrTerm->wtFlags &= ~TERM_OR_OK;\r\n        if( pOrTerm->leftCursor==iCursor ){\r\n          /* This is the 2-bit case and we are on the second iteration and\r\n          ** current term is from the first iteration.  So skip this term. */\r\n          assert( j==1 );\r\n          continue;\r\n        }\r\n        if( (chngToIN & getMask(pMaskSet, pOrTerm->leftCursor))==0 ){\r\n          /* This term must be of the form t1.a==t2.b where t2 is in the\r\n          ** chngToIN set but t1 is not.  This term will be either preceeded\r\n          ** or follwed by an inverted copy (t2.b==t1.a).  Skip this term \r\n          ** and use its inversion. */\r\n          testcase( pOrTerm->wtFlags & TERM_COPIED );\r\n          testcase( pOrTerm->wtFlags & TERM_VIRTUAL );\r\n          assert( pOrTerm->wtFlags & (TERM_COPIED|TERM_VIRTUAL) );\r\n          continue;\r\n        }\r\n        iColumn = pOrTerm->u.leftColumn;\r\n        iCursor = pOrTerm->leftCursor;\r\n        break;\r\n      }\r\n      if( i<0 ){\r\n        /* No candidate table+column was found.  This can only occur\r\n        ** on the second iteration */\r\n        assert( j==1 );\r\n        assert( (chngToIN&(chngToIN-1))==0 );\r\n        assert( chngToIN==getMask(pMaskSet, iCursor) );\r\n        break;\r\n      }\r\n      testcase( j==1 );\r\n\r\n      /* We have found a candidate table and column.  Check to see if that\r\n      ** table and column is common to every term in the OR clause */\r\n      okToChngToIN = 1;\r\n      for(; i>=0 && okToChngToIN; i--, pOrTerm++){\r\n        assert( pOrTerm->eOperator==WO_EQ );\r\n        if( pOrTerm->leftCursor!=iCursor ){\r\n          pOrTerm->wtFlags &= ~TERM_OR_OK;\r\n        }else if( pOrTerm->u.leftColumn!=iColumn ){\r\n          okToChngToIN = 0;\r\n        }else{\r\n          int affLeft, affRight;\r\n          /* If the right-hand side is also a column, then the affinities\r\n          ** of both right and left sides must be such that no type\r\n          ** conversions are required on the right.  (Ticket #2249)\r\n          */\r\n          affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);\r\n          affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft);\r\n          if( affRight!=0 && affRight!=affLeft ){\r\n            okToChngToIN = 0;\r\n          }else{\r\n            pOrTerm->wtFlags |= TERM_OR_OK;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    /* At this point, okToChngToIN is true if original pTerm satisfies\r\n    ** case 1.  In that case, construct a new virtual term that is \r\n    ** pTerm converted into an IN operator.\r\n    **\r\n    ** EV: R-00211-15100\r\n    */\r\n    if( okToChngToIN ){\r\n      Expr *pDup;            /* A transient duplicate expression */\r\n      ExprList *pList = 0;   /* The RHS of the IN operator */\r\n      Expr *pLeft = 0;       /* The LHS of the IN operator */\r\n      Expr *pNew;            /* The complete IN operator */\r\n\r\n      for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){\r\n        if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;\r\n        assert( pOrTerm->eOperator==WO_EQ );\r\n        assert( pOrTerm->leftCursor==iCursor );\r\n        assert( pOrTerm->u.leftColumn==iColumn );\r\n        pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);\r\n        pList = sqlite3ExprListAppend(pWC->pParse, pList, pDup);\r\n        pLeft = pOrTerm->pExpr->pLeft;\r\n      }\r\n      assert( pLeft!=0 );\r\n      pDup = sqlite3ExprDup(db, pLeft, 0);\r\n      pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0, 0);\r\n      if( pNew ){\r\n        int idxNew;\r\n        transferJoinMarkings(pNew, pExpr);\r\n        assert( !ExprHasProperty(pNew, EP_xIsSelect) );\r\n        pNew->x.pList = pList;\r\n        idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);\r\n        testcase( idxNew==0 );\r\n        exprAnalyze(pSrc, pWC, idxNew);\r\n        pTerm = &pWC->a[idxTerm];\r\n        pWC->a[idxNew].iParent = idxTerm;\r\n        pTerm->nChild = 1;\r\n      }else{\r\n        sqlite3ExprListDelete(db, pList);\r\n      }\r\n      pTerm->eOperator = WO_NOOP;  /* case 1 trumps case 2 */\r\n    }\r\n  }\r\n}\r\n#endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */\r\n\r\n\r\n/*\r\n** The input to this routine is an WhereTerm structure with only the\r\n** \"pExpr\" field filled in.  The job of this routine is to analyze the\r\n** subexpression and populate all the other fields of the WhereTerm\r\n** structure.\r\n**\r\n** If the expression is of the form \"<expr> <op> X\" it gets commuted\r\n** to the standard form of \"X <op> <expr>\".\r\n**\r\n** If the expression is of the form \"X <op> Y\" where both X and Y are\r\n** columns, then the original expression is unchanged and a new virtual\r\n** term of the form \"Y <op> X\" is added to the WHERE clause and\r\n** analyzed separately.  The original term is marked with TERM_COPIED\r\n** and the new term is marked with TERM_DYNAMIC (because it's pExpr\r\n** needs to be freed with the WhereClause) and TERM_VIRTUAL (because it\r\n** is a commuted copy of a prior term.)  The original term has nChild=1\r\n** and the copy has idxParent set to the index of the original term.\r\n*/\r\nstatic void exprAnalyze(\r\n  SrcList *pSrc,            /* the FROM clause */\r\n  WhereClause *pWC,         /* the WHERE clause */\r\n  int idxTerm               /* Index of the term to be analyzed */\r\n){\r\n  WhereTerm *pTerm;                /* The term to be analyzed */\r\n  WhereMaskSet *pMaskSet;          /* Set of table index masks */\r\n  Expr *pExpr;                     /* The expression to be analyzed */\r\n  Bitmask prereqLeft;              /* Prerequesites of the pExpr->pLeft */\r\n  Bitmask prereqAll;               /* Prerequesites of pExpr */\r\n  Bitmask extraRight = 0;          /* Extra dependencies on LEFT JOIN */\r\n  Expr *pStr1 = 0;                 /* RHS of LIKE/GLOB operator */\r\n  int isComplete = 0;              /* RHS of LIKE/GLOB ends with wildcard */\r\n  int noCase = 0;                  /* LIKE/GLOB distinguishes case */\r\n  int op;                          /* Top-level operator.  pExpr->op */\r\n  Parse *pParse = pWC->pParse;     /* Parsing context */\r\n  sqlite3 *db = pParse->db;        /* Database connection */\r\n\r\n  if( db->mallocFailed ){\r\n    return;\r\n  }\r\n  pTerm = &pWC->a[idxTerm];\r\n  pMaskSet = pWC->pMaskSet;\r\n  pExpr = pTerm->pExpr;\r\n  prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft);\r\n  op = pExpr->op;\r\n  if( op==TK_IN ){\r\n    assert( pExpr->pRight==0 );\r\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n      pTerm->prereqRight = exprSelectTableUsage(pMaskSet, pExpr->x.pSelect);\r\n    }else{\r\n      pTerm->prereqRight = exprListTableUsage(pMaskSet, pExpr->x.pList);\r\n    }\r\n  }else if( op==TK_ISNULL ){\r\n    pTerm->prereqRight = 0;\r\n  }else{\r\n    pTerm->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight);\r\n  }\r\n  prereqAll = exprTableUsage(pMaskSet, pExpr);\r\n  if( ExprHasProperty(pExpr, EP_FromJoin) ){\r\n    Bitmask x = getMask(pMaskSet, pExpr->iRightJoinTable);\r\n    prereqAll |= x;\r\n    extraRight = x-1;  /* ON clause terms may not be used with an index\r\n                       ** on left table of a LEFT JOIN.  Ticket #3015 */\r\n  }\r\n  pTerm->prereqAll = prereqAll;\r\n  pTerm->leftCursor = -1;\r\n  pTerm->iParent = -1;\r\n  pTerm->eOperator = 0;\r\n  if( allowedOp(op) && (pTerm->prereqRight & prereqLeft)==0 ){\r\n    Expr *pLeft = pExpr->pLeft;\r\n    Expr *pRight = pExpr->pRight;\r\n    if( pLeft->op==TK_COLUMN ){\r\n      pTerm->leftCursor = pLeft->iTable;\r\n      pTerm->u.leftColumn = pLeft->iColumn;\r\n      pTerm->eOperator = operatorMask(op);\r\n    }\r\n    if( pRight && pRight->op==TK_COLUMN ){\r\n      WhereTerm *pNew;\r\n      Expr *pDup;\r\n      if( pTerm->leftCursor>=0 ){\r\n        int idxNew;\r\n        pDup = sqlite3ExprDup(db, pExpr, 0);\r\n        if( db->mallocFailed ){\r\n          sqlite3ExprDelete(db, pDup);\r\n          return;\r\n        }\r\n        idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);\r\n        if( idxNew==0 ) return;\r\n        pNew = &pWC->a[idxNew];\r\n        pNew->iParent = idxTerm;\r\n        pTerm = &pWC->a[idxTerm];\r\n        pTerm->nChild = 1;\r\n        pTerm->wtFlags |= TERM_COPIED;\r\n      }else{\r\n        pDup = pExpr;\r\n        pNew = pTerm;\r\n      }\r\n      exprCommute(pParse, pDup);\r\n      pLeft = pDup->pLeft;\r\n      pNew->leftCursor = pLeft->iTable;\r\n      pNew->u.leftColumn = pLeft->iColumn;\r\n      testcase( (prereqLeft | extraRight) != prereqLeft );\r\n      pNew->prereqRight = prereqLeft | extraRight;\r\n      pNew->prereqAll = prereqAll;\r\n      pNew->eOperator = operatorMask(pDup->op);\r\n    }\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_BETWEEN_OPTIMIZATION\r\n  /* If a term is the BETWEEN operator, create two new virtual terms\r\n  ** that define the range that the BETWEEN implements.  For example:\r\n  **\r\n  **      a BETWEEN b AND c\r\n  **\r\n  ** is converted into:\r\n  **\r\n  **      (a BETWEEN b AND c) AND (a>=b) AND (a<=c)\r\n  **\r\n  ** The two new terms are added onto the end of the WhereClause object.\r\n  ** The new terms are \"dynamic\" and are children of the original BETWEEN\r\n  ** term.  That means that if the BETWEEN term is coded, the children are\r\n  ** skipped.  Or, if the children are satisfied by an index, the original\r\n  ** BETWEEN term is skipped.\r\n  */\r\n  else if( pExpr->op==TK_BETWEEN && pWC->op==TK_AND ){\r\n    ExprList *pList = pExpr->x.pList;\r\n    int i;\r\n    static const u8 ops[] = {TK_GE, TK_LE};\r\n    assert( pList!=0 );\r\n    assert( pList->nExpr==2 );\r\n    for(i=0; i<2; i++){\r\n      Expr *pNewExpr;\r\n      int idxNew;\r\n      pNewExpr = sqlite3PExpr(pParse, ops[i], \r\n                             sqlite3ExprDup(db, pExpr->pLeft, 0),\r\n                             sqlite3ExprDup(db, pList->a[i].pExpr, 0), 0);\r\n      idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);\r\n      testcase( idxNew==0 );\r\n      exprAnalyze(pSrc, pWC, idxNew);\r\n      pTerm = &pWC->a[idxTerm];\r\n      pWC->a[idxNew].iParent = idxTerm;\r\n    }\r\n    pTerm->nChild = 2;\r\n  }\r\n#endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */\r\n\r\n#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)\r\n  /* Analyze a term that is composed of two or more subterms connected by\r\n  ** an OR operator.\r\n  */\r\n  else if( pExpr->op==TK_OR ){\r\n    assert( pWC->op==TK_AND );\r\n    exprAnalyzeOrTerm(pSrc, pWC, idxTerm);\r\n    pTerm = &pWC->a[idxTerm];\r\n  }\r\n#endif /* SQLITE_OMIT_OR_OPTIMIZATION */\r\n\r\n#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION\r\n  /* Add constraints to reduce the search space on a LIKE or GLOB\r\n  ** operator.\r\n  **\r\n  ** A like pattern of the form \"x LIKE 'abc%'\" is changed into constraints\r\n  **\r\n  **          x>='abc' AND x<'abd' AND x LIKE 'abc%'\r\n  **\r\n  ** The last character of the prefix \"abc\" is incremented to form the\r\n  ** termination condition \"abd\".\r\n  */\r\n  if( pWC->op==TK_AND \r\n   && isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase)\r\n  ){\r\n    Expr *pLeft;       /* LHS of LIKE/GLOB operator */\r\n    Expr *pStr2;       /* Copy of pStr1 - RHS of LIKE/GLOB operator */\r\n    Expr *pNewExpr1;\r\n    Expr *pNewExpr2;\r\n    int idxNew1;\r\n    int idxNew2;\r\n    CollSeq *pColl;    /* Collating sequence to use */\r\n\r\n    pLeft = pExpr->x.pList->a[1].pExpr;\r\n    pStr2 = sqlite3ExprDup(db, pStr1, 0);\r\n    if( !db->mallocFailed ){\r\n      u8 c, *pC;       /* Last character before the first wildcard */\r\n      pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];\r\n      c = *pC;\r\n      if( noCase ){\r\n        /* The point is to increment the last character before the first\r\n        ** wildcard.  But if we increment '@', that will push it into the\r\n        ** alphabetic range where case conversions will mess up the \r\n        ** inequality.  To avoid this, make sure to also run the full\r\n        ** LIKE on all candidate expressions by clearing the isComplete flag\r\n        */\r\n        if( c=='A'-1 ) isComplete = 0;   /* EV: R-64339-08207 */\r\n\r\n\r\n        c = sqlite3UpperToLower[c];\r\n      }\r\n      *pC = c + 1;\r\n    }\r\n    pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, noCase ? \"NOCASE\" : \"BINARY\",0);\r\n    pNewExpr1 = sqlite3PExpr(pParse, TK_GE, \r\n                     sqlite3ExprSetColl(sqlite3ExprDup(db,pLeft,0), pColl),\r\n                     pStr1, 0);\r\n    idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC);\r\n    testcase( idxNew1==0 );\r\n    exprAnalyze(pSrc, pWC, idxNew1);\r\n    pNewExpr2 = sqlite3PExpr(pParse, TK_LT,\r\n                     sqlite3ExprSetColl(sqlite3ExprDup(db,pLeft,0), pColl),\r\n                     pStr2, 0);\r\n    idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC);\r\n    testcase( idxNew2==0 );\r\n    exprAnalyze(pSrc, pWC, idxNew2);\r\n    pTerm = &pWC->a[idxTerm];\r\n    if( isComplete ){\r\n      pWC->a[idxNew1].iParent = idxTerm;\r\n      pWC->a[idxNew2].iParent = idxTerm;\r\n      pTerm->nChild = 2;\r\n    }\r\n  }\r\n#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  /* Add a WO_MATCH auxiliary term to the constraint set if the\r\n  ** current expression is of the form:  column MATCH expr.\r\n  ** This information is used by the xBestIndex methods of\r\n  ** virtual tables.  The native query optimizer does not attempt\r\n  ** to do anything with MATCH functions.\r\n  */\r\n  if( isMatchOfColumn(pExpr) ){\r\n    int idxNew;\r\n    Expr *pRight, *pLeft;\r\n    WhereTerm *pNewTerm;\r\n    Bitmask prereqColumn, prereqExpr;\r\n\r\n    pRight = pExpr->x.pList->a[0].pExpr;\r\n    pLeft = pExpr->x.pList->a[1].pExpr;\r\n    prereqExpr = exprTableUsage(pMaskSet, pRight);\r\n    prereqColumn = exprTableUsage(pMaskSet, pLeft);\r\n    if( (prereqExpr & prereqColumn)==0 ){\r\n      Expr *pNewExpr;\r\n      pNewExpr = sqlite3PExpr(pParse, TK_MATCH, \r\n                              0, sqlite3ExprDup(db, pRight, 0), 0);\r\n      idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);\r\n      testcase( idxNew==0 );\r\n      pNewTerm = &pWC->a[idxNew];\r\n      pNewTerm->prereqRight = prereqExpr;\r\n      pNewTerm->leftCursor = pLeft->iTable;\r\n      pNewTerm->u.leftColumn = pLeft->iColumn;\r\n      pNewTerm->eOperator = WO_MATCH;\r\n      pNewTerm->iParent = idxTerm;\r\n      pTerm = &pWC->a[idxTerm];\r\n      pTerm->nChild = 1;\r\n      pTerm->wtFlags |= TERM_COPIED;\r\n      pNewTerm->prereqAll = pTerm->prereqAll;\r\n    }\r\n  }\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n  /* When sqlite_stat3 histogram data is available an operator of the\r\n  ** form \"x IS NOT NULL\" can sometimes be evaluated more efficiently\r\n  ** as \"x>NULL\" if x is not an INTEGER PRIMARY KEY.  So construct a\r\n  ** virtual term of that form.\r\n  **\r\n  ** Note that the virtual term must be tagged with TERM_VNULL.  This\r\n  ** TERM_VNULL tag will suppress the not-null check at the beginning\r\n  ** of the loop.  Without the TERM_VNULL flag, the not-null check at\r\n  ** the start of the loop will prevent any results from being returned.\r\n  */\r\n  if( pExpr->op==TK_NOTNULL\r\n   && pExpr->pLeft->op==TK_COLUMN\r\n   && pExpr->pLeft->iColumn>=0\r\n  ){\r\n    Expr *pNewExpr;\r\n    Expr *pLeft = pExpr->pLeft;\r\n    int idxNew;\r\n    WhereTerm *pNewTerm;\r\n\r\n    pNewExpr = sqlite3PExpr(pParse, TK_GT,\r\n                            sqlite3ExprDup(db, pLeft, 0),\r\n                            sqlite3PExpr(pParse, TK_NULL, 0, 0, 0), 0);\r\n\r\n    idxNew = whereClauseInsert(pWC, pNewExpr,\r\n                              TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL);\r\n    if( idxNew ){\r\n      pNewTerm = &pWC->a[idxNew];\r\n      pNewTerm->prereqRight = 0;\r\n      pNewTerm->leftCursor = pLeft->iTable;\r\n      pNewTerm->u.leftColumn = pLeft->iColumn;\r\n      pNewTerm->eOperator = WO_GT;\r\n      pNewTerm->iParent = idxTerm;\r\n      pTerm = &pWC->a[idxTerm];\r\n      pTerm->nChild = 1;\r\n      pTerm->wtFlags |= TERM_COPIED;\r\n      pNewTerm->prereqAll = pTerm->prereqAll;\r\n    }\r\n  }\r\n#endif /* SQLITE_ENABLE_STAT */\r\n\r\n  /* Prevent ON clause terms of a LEFT JOIN from being used to drive\r\n  ** an index for tables to the left of the join.\r\n  */\r\n  pTerm->prereqRight |= extraRight;\r\n}\r\n\r\n/*\r\n** Return TRUE if any of the expressions in pList->a[iFirst...] contain\r\n** a reference to any table other than the iBase table.\r\n*/\r\nstatic int referencesOtherTables(\r\n  ExprList *pList,          /* Search expressions in ths list */\r\n  WhereMaskSet *pMaskSet,   /* Mapping from tables to bitmaps */\r\n  int iFirst,               /* Be searching with the iFirst-th expression */\r\n  int iBase                 /* Ignore references to this table */\r\n){\r\n  Bitmask allowed = ~getMask(pMaskSet, iBase);\r\n  while( iFirst<pList->nExpr ){\r\n    if( (exprTableUsage(pMaskSet, pList->a[iFirst++].pExpr)&allowed)!=0 ){\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** This function searches the expression list passed as the second argument\r\n** for an expression of type TK_COLUMN that refers to the same column and\r\n** uses the same collation sequence as the iCol'th column of index pIdx.\r\n** Argument iBase is the cursor number used for the table that pIdx refers\r\n** to.\r\n**\r\n** If such an expression is found, its index in pList->a[] is returned. If\r\n** no expression is found, -1 is returned.\r\n*/\r\nstatic int findIndexCol(\r\n  Parse *pParse,                  /* Parse context */\r\n  ExprList *pList,                /* Expression list to search */\r\n  int iBase,                      /* Cursor for table associated with pIdx */\r\n  Index *pIdx,                    /* Index to match column of */\r\n  int iCol                        /* Column of index to match */\r\n){\r\n  int i;\r\n  const char *zColl = pIdx->azColl[iCol];\r\n\r\n  for(i=0; i<pList->nExpr; i++){\r\n    Expr *p = pList->a[i].pExpr;\r\n    if( p->op==TK_COLUMN\r\n     && p->iColumn==pIdx->aiColumn[iCol]\r\n     && p->iTable==iBase\r\n    ){\r\n      CollSeq *pColl = sqlite3ExprCollSeq(pParse, p);\r\n      if( ALWAYS(pColl) && 0==sqlite3StrICmp(pColl->zName, zColl) ){\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n\r\n  return -1;\r\n}\r\n\r\n/*\r\n** This routine determines if pIdx can be used to assist in processing a\r\n** DISTINCT qualifier. In other words, it tests whether or not using this\r\n** index for the outer loop guarantees that rows with equal values for\r\n** all expressions in the pDistinct list are delivered grouped together.\r\n**\r\n** For example, the query \r\n**\r\n**   SELECT DISTINCT a, b, c FROM tbl WHERE a = ?\r\n**\r\n** can benefit from any index on columns \"b\" and \"c\".\r\n*/\r\nstatic int isDistinctIndex(\r\n  Parse *pParse,                  /* Parsing context */\r\n  WhereClause *pWC,               /* The WHERE clause */\r\n  Index *pIdx,                    /* The index being considered */\r\n  int base,                       /* Cursor number for the table pIdx is on */\r\n  ExprList *pDistinct,            /* The DISTINCT expressions */\r\n  int nEqCol                      /* Number of index columns with == */\r\n){\r\n  Bitmask mask = 0;               /* Mask of unaccounted for pDistinct exprs */\r\n  int i;                          /* Iterator variable */\r\n\r\n  if( pIdx->zName==0 || pDistinct==0 || pDistinct->nExpr>=BMS ) return 0;\r\n  testcase( pDistinct->nExpr==BMS-1 );\r\n\r\n  /* Loop through all the expressions in the distinct list. If any of them\r\n  ** are not simple column references, return early. Otherwise, test if the\r\n  ** WHERE clause contains a \"col=X\" clause. If it does, the expression\r\n  ** can be ignored. If it does not, and the column does not belong to the\r\n  ** same table as index pIdx, return early. Finally, if there is no\r\n  ** matching \"col=X\" expression and the column is on the same table as pIdx,\r\n  ** set the corresponding bit in variable mask.\r\n  */\r\n  for(i=0; i<pDistinct->nExpr; i++){\r\n    WhereTerm *pTerm;\r\n    Expr *p = pDistinct->a[i].pExpr;\r\n    if( p->op!=TK_COLUMN ) return 0;\r\n    pTerm = findTerm(pWC, p->iTable, p->iColumn, ~(Bitmask)0, WO_EQ, 0);\r\n    if( pTerm ){\r\n      Expr *pX = pTerm->pExpr;\r\n      CollSeq *p1 = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);\r\n      CollSeq *p2 = sqlite3ExprCollSeq(pParse, p);\r\n      if( p1==p2 ) continue;\r\n    }\r\n    if( p->iTable!=base ) return 0;\r\n    mask |= (((Bitmask)1) << i);\r\n  }\r\n\r\n  for(i=nEqCol; mask && i<pIdx->nColumn; i++){\r\n    int iExpr = findIndexCol(pParse, pDistinct, base, pIdx, i);\r\n    if( iExpr<0 ) break;\r\n    mask &= ~(((Bitmask)1) << iExpr);\r\n  }\r\n\r\n  return (mask==0);\r\n}\r\n\r\n\r\n/*\r\n** Return true if the DISTINCT expression-list passed as the third argument\r\n** is redundant. A DISTINCT list is redundant if the database contains a\r\n** UNIQUE index that guarantees that the result of the query will be distinct\r\n** anyway.\r\n*/\r\nstatic int isDistinctRedundant(\r\n  Parse *pParse,\r\n  SrcList *pTabList,\r\n  WhereClause *pWC,\r\n  ExprList *pDistinct\r\n){\r\n  Table *pTab;\r\n  Index *pIdx;\r\n  int i;                          \r\n  int iBase;\r\n\r\n  /* If there is more than one table or sub-select in the FROM clause of\r\n  ** this query, then it will not be possible to show that the DISTINCT \r\n  ** clause is redundant. */\r\n  if( pTabList->nSrc!=1 ) return 0;\r\n  iBase = pTabList->a[0].iCursor;\r\n  pTab = pTabList->a[0].pTab;\r\n\r\n  /* If any of the expressions is an IPK column on table iBase, then return \r\n  ** true. Note: The (p->iTable==iBase) part of this test may be false if the\r\n  ** current SELECT is a correlated sub-query.\r\n  */\r\n  for(i=0; i<pDistinct->nExpr; i++){\r\n    Expr *p = pDistinct->a[i].pExpr;\r\n    if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1;\r\n  }\r\n\r\n  /* Loop through all indices on the table, checking each to see if it makes\r\n  ** the DISTINCT qualifier redundant. It does so if:\r\n  **\r\n  **   1. The index is itself UNIQUE, and\r\n  **\r\n  **   2. All of the columns in the index are either part of the pDistinct\r\n  **      list, or else the WHERE clause contains a term of the form \"col=X\",\r\n  **      where X is a constant value. The collation sequences of the\r\n  **      comparison and select-list expressions must match those of the index.\r\n  */\r\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\r\n    if( pIdx->onError==OE_None ) continue;\r\n    for(i=0; i<pIdx->nColumn; i++){\r\n      int iCol = pIdx->aiColumn[i];\r\n      if( 0==findTerm(pWC, iBase, iCol, ~(Bitmask)0, WO_EQ, pIdx) \r\n       && 0>findIndexCol(pParse, pDistinct, iBase, pIdx, i)\r\n      ){\r\n        break;\r\n      }\r\n    }\r\n    if( i==pIdx->nColumn ){\r\n      /* This index implies that the DISTINCT qualifier is redundant. */\r\n      return 1;\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n/*\r\n** This routine decides if pIdx can be used to satisfy the ORDER BY\r\n** clause.  If it can, it returns 1.  If pIdx cannot satisfy the\r\n** ORDER BY clause, this routine returns 0.\r\n**\r\n** pOrderBy is an ORDER BY clause from a SELECT statement.  pTab is the\r\n** left-most table in the FROM clause of that same SELECT statement and\r\n** the table has a cursor number of \"base\".  pIdx is an index on pTab.\r\n**\r\n** nEqCol is the number of columns of pIdx that are used as equality\r\n** constraints.  Any of these columns may be missing from the ORDER BY\r\n** clause and the match can still be a success.\r\n**\r\n** All terms of the ORDER BY that match against the index must be either\r\n** ASC or DESC.  (Terms of the ORDER BY clause past the end of a UNIQUE\r\n** index do not need to satisfy this constraint.)  The *pbRev value is\r\n** set to 1 if the ORDER BY clause is all DESC and it is set to 0 if\r\n** the ORDER BY clause is all ASC.\r\n*/\r\nstatic int isSortingIndex(\r\n  Parse *pParse,          /* Parsing context */\r\n  WhereMaskSet *pMaskSet, /* Mapping from table cursor numbers to bitmaps */\r\n  Index *pIdx,            /* The index we are testing */\r\n  int base,               /* Cursor number for the table to be sorted */\r\n  ExprList *pOrderBy,     /* The ORDER BY clause */\r\n  int nEqCol,             /* Number of index columns with == constraints */\r\n  int wsFlags,            /* Index usages flags */\r\n  int *pbRev              /* Set to 1 if ORDER BY is DESC */\r\n){\r\n  int i, j;                       /* Loop counters */\r\n  int sortOrder = 0;              /* XOR of index and ORDER BY sort direction */\r\n  int nTerm;                      /* Number of ORDER BY terms */\r\n  struct ExprList_item *pTerm;    /* A term of the ORDER BY clause */\r\n  sqlite3 *db = pParse->db;\r\n\r\n  if( !pOrderBy ) return 0;\r\n  if( wsFlags & WHERE_COLUMN_IN ) return 0;\r\n  if( pIdx->bUnordered ) return 0;\r\n\r\n  nTerm = pOrderBy->nExpr;\r\n  assert( nTerm>0 );\r\n\r\n  /* Argument pIdx must either point to a 'real' named index structure, \r\n  ** or an index structure allocated on the stack by bestBtreeIndex() to\r\n  ** represent the rowid index that is part of every table.  */\r\n  assert( pIdx->zName || (pIdx->nColumn==1 && pIdx->aiColumn[0]==-1) );\r\n\r\n  /* Match terms of the ORDER BY clause against columns of\r\n  ** the index.\r\n  **\r\n  ** Note that indices have pIdx->nColumn regular columns plus\r\n  ** one additional column containing the rowid.  The rowid column\r\n  ** of the index is also allowed to match against the ORDER BY\r\n  ** clause.\r\n  */\r\n  for(i=j=0, pTerm=pOrderBy->a; j<nTerm && i<=pIdx->nColumn; i++){\r\n    Expr *pExpr;       /* The expression of the ORDER BY pTerm */\r\n    CollSeq *pColl;    /* The collating sequence of pExpr */\r\n    int termSortOrder; /* Sort order for this term */\r\n    int iColumn;       /* The i-th column of the index.  -1 for rowid */\r\n    int iSortOrder;    /* 1 for DESC, 0 for ASC on the i-th index term */\r\n    const char *zColl; /* Name of the collating sequence for i-th index term */\r\n\r\n    pExpr = pTerm->pExpr;\r\n    if( pExpr->op!=TK_COLUMN || pExpr->iTable!=base ){\r\n      /* Can not use an index sort on anything that is not a column in the\r\n      ** left-most table of the FROM clause */\r\n      break;\r\n    }\r\n    pColl = sqlite3ExprCollSeq(pParse, pExpr);\r\n    if( !pColl ){\r\n      pColl = db->pDfltColl;\r\n    }\r\n    if( pIdx->zName && i<pIdx->nColumn ){\r\n      iColumn = pIdx->aiColumn[i];\r\n      if( iColumn==pIdx->pTable->iPKey ){\r\n        iColumn = -1;\r\n      }\r\n      iSortOrder = pIdx->aSortOrder[i];\r\n      zColl = pIdx->azColl[i];\r\n    }else{\r\n      iColumn = -1;\r\n      iSortOrder = 0;\r\n      zColl = pColl->zName;\r\n    }\r\n    if( pExpr->iColumn!=iColumn || sqlite3StrICmp(pColl->zName, zColl) ){\r\n      /* Term j of the ORDER BY clause does not match column i of the index */\r\n      if( i<nEqCol ){\r\n        /* If an index column that is constrained by == fails to match an\r\n        ** ORDER BY term, that is OK.  Just ignore that column of the index\r\n        */\r\n        continue;\r\n      }else if( i==pIdx->nColumn ){\r\n        /* Index column i is the rowid.  All other terms match. */\r\n        break;\r\n      }else{\r\n        /* If an index column fails to match and is not constrained by ==\r\n        ** then the index cannot satisfy the ORDER BY constraint.\r\n        */\r\n        return 0;\r\n      }\r\n    }\r\n    assert( pIdx->aSortOrder!=0 || iColumn==-1 );\r\n    assert( pTerm->sortOrder==0 || pTerm->sortOrder==1 );\r\n    assert( iSortOrder==0 || iSortOrder==1 );\r\n    termSortOrder = iSortOrder ^ pTerm->sortOrder;\r\n    if( i>nEqCol ){\r\n      if( termSortOrder!=sortOrder ){\r\n        /* Indices can only be used if all ORDER BY terms past the\r\n        ** equality constraints are all either DESC or ASC. */\r\n        return 0;\r\n      }\r\n    }else{\r\n      sortOrder = termSortOrder;\r\n    }\r\n    j++;\r\n    pTerm++;\r\n    if( iColumn<0 && !referencesOtherTables(pOrderBy, pMaskSet, j, base) ){\r\n      /* If the indexed column is the primary key and everything matches\r\n      ** so far and none of the ORDER BY terms to the right reference other\r\n      ** tables in the join, then we are assured that the index can be used \r\n      ** to sort because the primary key is unique and so none of the other\r\n      ** columns will make any difference\r\n      */\r\n      j = nTerm;\r\n    }\r\n  }\r\n\r\n  *pbRev = sortOrder!=0;\r\n  if( j>=nTerm ){\r\n    /* All terms of the ORDER BY clause are covered by this index so\r\n    ** this index can be used for sorting. */\r\n    return 1;\r\n  }\r\n  if( pIdx->onError!=OE_None && i==pIdx->nColumn\r\n      && (wsFlags & WHERE_COLUMN_NULL)==0\r\n      && !referencesOtherTables(pOrderBy, pMaskSet, j, base) ){\r\n    /* All terms of this index match some prefix of the ORDER BY clause\r\n    ** and the index is UNIQUE and no terms on the tail of the ORDER BY\r\n    ** clause reference other tables in a join.  If this is all true then\r\n    ** the order by clause is superfluous.  Not that if the matching\r\n    ** condition is IS NULL then the result is not necessarily unique\r\n    ** even on a UNIQUE index, so disallow those cases. */\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Prepare a crude estimate of the logarithm of the input value.\r\n** The results need not be exact.  This is only used for estimating\r\n** the total cost of performing operations with O(logN) or O(NlogN)\r\n** complexity.  Because N is just a guess, it is no great tragedy if\r\n** logN is a little off.\r\n*/\r\nstatic double estLog(double N){\r\n  double logN = 1;\r\n  double x = 10;\r\n  while( N>x ){\r\n    logN += 1;\r\n    x *= 10;\r\n  }\r\n  return logN;\r\n}\r\n\r\n/*\r\n** Two routines for printing the content of an sqlite3_index_info\r\n** structure.  Used for testing and debugging only.  If neither\r\n** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines\r\n** are no-ops.\r\n*/\r\n#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_DEBUG)\r\nstatic void TRACE_IDX_INPUTS(sqlite3_index_info *p){\r\n  int i;\r\n  if( !sqlite3WhereTrace ) return;\r\n  for(i=0; i<p->nConstraint; i++){\r\n    sqlite3DebugPrintf(\"  constraint[%d]: col=%d termid=%d op=%d usabled=%d\\n\",\r\n       i,\r\n       p->aConstraint[i].iColumn,\r\n       p->aConstraint[i].iTermOffset,\r\n       p->aConstraint[i].op,\r\n       p->aConstraint[i].usable);\r\n  }\r\n  for(i=0; i<p->nOrderBy; i++){\r\n    sqlite3DebugPrintf(\"  orderby[%d]: col=%d desc=%d\\n\",\r\n       i,\r\n       p->aOrderBy[i].iColumn,\r\n       p->aOrderBy[i].desc);\r\n  }\r\n}\r\nstatic void TRACE_IDX_OUTPUTS(sqlite3_index_info *p){\r\n  int i;\r\n  if( !sqlite3WhereTrace ) return;\r\n  for(i=0; i<p->nConstraint; i++){\r\n    sqlite3DebugPrintf(\"  usage[%d]: argvIdx=%d omit=%d\\n\",\r\n       i,\r\n       p->aConstraintUsage[i].argvIndex,\r\n       p->aConstraintUsage[i].omit);\r\n  }\r\n  sqlite3DebugPrintf(\"  idxNum=%d\\n\", p->idxNum);\r\n  sqlite3DebugPrintf(\"  idxStr=%s\\n\", p->idxStr);\r\n  sqlite3DebugPrintf(\"  orderByConsumed=%d\\n\", p->orderByConsumed);\r\n  sqlite3DebugPrintf(\"  estimatedCost=%g\\n\", p->estimatedCost);\r\n}\r\n#else\r\n#define TRACE_IDX_INPUTS(A)\r\n#define TRACE_IDX_OUTPUTS(A)\r\n#endif\r\n\r\n/* \r\n** Required because bestIndex() is called by bestOrClauseIndex() \r\n*/\r\nstatic void bestIndex(\r\n    Parse*, WhereClause*, struct SrcList_item*,\r\n    Bitmask, Bitmask, ExprList*, WhereCost*);\r\n\r\n/*\r\n** This routine attempts to find an scanning strategy that can be used \r\n** to optimize an 'OR' expression that is part of a WHERE clause. \r\n**\r\n** The table associated with FROM clause term pSrc may be either a\r\n** regular B-Tree table or a virtual table.\r\n*/\r\nstatic void bestOrClauseIndex(\r\n  Parse *pParse,              /* The parsing context */\r\n  WhereClause *pWC,           /* The WHERE clause */\r\n  struct SrcList_item *pSrc,  /* The FROM clause term to search */\r\n  Bitmask notReady,           /* Mask of cursors not available for indexing */\r\n  Bitmask notValid,           /* Cursors not available for any purpose */\r\n  ExprList *pOrderBy,         /* The ORDER BY clause */\r\n  WhereCost *pCost            /* Lowest cost query plan */\r\n){\r\n#ifndef SQLITE_OMIT_OR_OPTIMIZATION\r\n  const int iCur = pSrc->iCursor;   /* The cursor of the table to be accessed */\r\n  const Bitmask maskSrc = getMask(pWC->pMaskSet, iCur);  /* Bitmask for pSrc */\r\n  WhereTerm * const pWCEnd = &pWC->a[pWC->nTerm];        /* End of pWC->a[] */\r\n  WhereTerm *pTerm;                 /* A single term of the WHERE clause */\r\n\r\n  /* The OR-clause optimization is disallowed if the INDEXED BY or\r\n  ** NOT INDEXED clauses are used or if the WHERE_AND_ONLY bit is set. */\r\n  if( pSrc->notIndexed || pSrc->pIndex!=0 ){\r\n    return;\r\n  }\r\n  if( pWC->wctrlFlags & WHERE_AND_ONLY ){\r\n    return;\r\n  }\r\n\r\n  /* Search the WHERE clause terms for a usable WO_OR term. */\r\n  for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){\r\n    if( pTerm->eOperator==WO_OR \r\n     && ((pTerm->prereqAll & ~maskSrc) & notReady)==0\r\n     && (pTerm->u.pOrInfo->indexable & maskSrc)!=0 \r\n    ){\r\n      WhereClause * const pOrWC = &pTerm->u.pOrInfo->wc;\r\n      WhereTerm * const pOrWCEnd = &pOrWC->a[pOrWC->nTerm];\r\n      WhereTerm *pOrTerm;\r\n      int flags = WHERE_MULTI_OR;\r\n      double rTotal = 0;\r\n      double nRow = 0;\r\n      Bitmask used = 0;\r\n\r\n      for(pOrTerm=pOrWC->a; pOrTerm<pOrWCEnd; pOrTerm++){\r\n        WhereCost sTermCost;\r\n        WHERETRACE((\"... Multi-index OR testing for term %d of %d....\\n\", \r\n          (pOrTerm - pOrWC->a), (pTerm - pWC->a)\r\n        ));\r\n        if( pOrTerm->eOperator==WO_AND ){\r\n          WhereClause *pAndWC = &pOrTerm->u.pAndInfo->wc;\r\n          bestIndex(pParse, pAndWC, pSrc, notReady, notValid, 0, &sTermCost);\r\n        }else if( pOrTerm->leftCursor==iCur ){\r\n          WhereClause tempWC;\r\n          tempWC.pParse = pWC->pParse;\r\n          tempWC.pMaskSet = pWC->pMaskSet;\r\n          tempWC.pOuter = pWC;\r\n          tempWC.op = TK_AND;\r\n          tempWC.a = pOrTerm;\r\n          tempWC.wctrlFlags = 0;\r\n          tempWC.nTerm = 1;\r\n          bestIndex(pParse, &tempWC, pSrc, notReady, notValid, 0, &sTermCost);\r\n        }else{\r\n          continue;\r\n        }\r\n        rTotal += sTermCost.rCost;\r\n        nRow += sTermCost.plan.nRow;\r\n        used |= sTermCost.used;\r\n        if( rTotal>=pCost->rCost ) break;\r\n      }\r\n\r\n      /* If there is an ORDER BY clause, increase the scan cost to account \r\n      ** for the cost of the sort. */\r\n      if( pOrderBy!=0 ){\r\n        WHERETRACE((\"... sorting increases OR cost %.9g to %.9g\\n\",\r\n                    rTotal, rTotal+nRow*estLog(nRow)));\r\n        rTotal += nRow*estLog(nRow);\r\n      }\r\n\r\n      /* If the cost of scanning using this OR term for optimization is\r\n      ** less than the current cost stored in pCost, replace the contents\r\n      ** of pCost. */\r\n      WHERETRACE((\"... multi-index OR cost=%.9g nrow=%.9g\\n\", rTotal, nRow));\r\n      if( rTotal<pCost->rCost ){\r\n        pCost->rCost = rTotal;\r\n        pCost->used = used;\r\n        pCost->plan.nRow = nRow;\r\n        pCost->plan.wsFlags = flags;\r\n        pCost->plan.u.pTerm = pTerm;\r\n      }\r\n    }\r\n  }\r\n#endif /* SQLITE_OMIT_OR_OPTIMIZATION */\r\n}\r\n\r\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\r\n/*\r\n** Return TRUE if the WHERE clause term pTerm is of a form where it\r\n** could be used with an index to access pSrc, assuming an appropriate\r\n** index existed.\r\n*/\r\nstatic int termCanDriveIndex(\r\n  WhereTerm *pTerm,              /* WHERE clause term to check */\r\n  struct SrcList_item *pSrc,     /* Table we are trying to access */\r\n  Bitmask notReady               /* Tables in outer loops of the join */\r\n){\r\n  char aff;\r\n  if( pTerm->leftCursor!=pSrc->iCursor ) return 0;\r\n  if( pTerm->eOperator!=WO_EQ ) return 0;\r\n  if( (pTerm->prereqRight & notReady)!=0 ) return 0;\r\n  aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;\r\n  if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0;\r\n  return 1;\r\n}\r\n#endif\r\n\r\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\r\n/*\r\n** If the query plan for pSrc specified in pCost is a full table scan\r\n** and indexing is allows (if there is no NOT INDEXED clause) and it\r\n** possible to construct a transient index that would perform better\r\n** than a full table scan even when the cost of constructing the index\r\n** is taken into account, then alter the query plan to use the\r\n** transient index.\r\n*/\r\nstatic void bestAutomaticIndex(\r\n  Parse *pParse,              /* The parsing context */\r\n  WhereClause *pWC,           /* The WHERE clause */\r\n  struct SrcList_item *pSrc,  /* The FROM clause term to search */\r\n  Bitmask notReady,           /* Mask of cursors that are not available */\r\n  WhereCost *pCost            /* Lowest cost query plan */\r\n){\r\n  double nTableRow;           /* Rows in the input table */\r\n  double logN;                /* log(nTableRow) */\r\n  double costTempIdx;         /* per-query cost of the transient index */\r\n  WhereTerm *pTerm;           /* A single term of the WHERE clause */\r\n  WhereTerm *pWCEnd;          /* End of pWC->a[] */\r\n  Table *pTable;              /* Table tht might be indexed */\r\n\r\n  if( pParse->nQueryLoop<=(double)1 ){\r\n    /* There is no point in building an automatic index for a single scan */\r\n    return;\r\n  }\r\n  if( (pParse->db->flags & SQLITE_AutoIndex)==0 ){\r\n    /* Automatic indices are disabled at run-time */\r\n    return;\r\n  }\r\n  if( (pCost->plan.wsFlags & WHERE_NOT_FULLSCAN)!=0 ){\r\n    /* We already have some kind of index in use for this query. */\r\n    return;\r\n  }\r\n  if( pSrc->notIndexed ){\r\n    /* The NOT INDEXED clause appears in the SQL. */\r\n    return;\r\n  }\r\n  if( pSrc->isCorrelated ){\r\n    /* The source is a correlated sub-query. No point in indexing it. */\r\n    return;\r\n  }\r\n\r\n  assert( pParse->nQueryLoop >= (double)1 );\r\n  pTable = pSrc->pTab;\r\n  nTableRow = pTable->nRowEst;\r\n  logN = estLog(nTableRow);\r\n  costTempIdx = 2*logN*(nTableRow/pParse->nQueryLoop + 1);\r\n  if( costTempIdx>=pCost->rCost ){\r\n    /* The cost of creating the transient table would be greater than\r\n    ** doing the full table scan */\r\n    return;\r\n  }\r\n\r\n  /* Search for any equality comparison term */\r\n  pWCEnd = &pWC->a[pWC->nTerm];\r\n  for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){\r\n    if( termCanDriveIndex(pTerm, pSrc, notReady) ){\r\n      WHERETRACE((\"auto-index reduces cost from %.1f to %.1f\\n\",\r\n                    pCost->rCost, costTempIdx));\r\n      pCost->rCost = costTempIdx;\r\n      pCost->plan.nRow = logN + 1;\r\n      pCost->plan.wsFlags = WHERE_TEMP_INDEX;\r\n      pCost->used = pTerm->prereqRight;\r\n      break;\r\n    }\r\n  }\r\n}\r\n#else\r\n# define bestAutomaticIndex(A,B,C,D,E)  /* no-op */\r\n#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */\r\n\r\n\r\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\r\n/*\r\n** Generate code to construct the Index object for an automatic index\r\n** and to set up the WhereLevel object pLevel so that the code generator\r\n** makes use of the automatic index.\r\n*/\r\nstatic void constructAutomaticIndex(\r\n  Parse *pParse,              /* The parsing context */\r\n  WhereClause *pWC,           /* The WHERE clause */\r\n  struct SrcList_item *pSrc,  /* The FROM clause term to get the next index */\r\n  Bitmask notReady,           /* Mask of cursors that are not available */\r\n  WhereLevel *pLevel          /* Write new index here */\r\n){\r\n  int nColumn;                /* Number of columns in the constructed index */\r\n  WhereTerm *pTerm;           /* A single term of the WHERE clause */\r\n  WhereTerm *pWCEnd;          /* End of pWC->a[] */\r\n  int nByte;                  /* Byte of memory needed for pIdx */\r\n  Index *pIdx;                /* Object describing the transient index */\r\n  Vdbe *v;                    /* Prepared statement under construction */\r\n  int addrInit;               /* Address of the initialization bypass jump */\r\n  Table *pTable;              /* The table being indexed */\r\n  KeyInfo *pKeyinfo;          /* Key information for the index */   \r\n  int addrTop;                /* Top of the index fill loop */\r\n  int regRecord;              /* Register holding an index record */\r\n  int n;                      /* Column counter */\r\n  int i;                      /* Loop counter */\r\n  int mxBitCol;               /* Maximum column in pSrc->colUsed */\r\n  CollSeq *pColl;             /* Collating sequence to on a column */\r\n  Bitmask idxCols;            /* Bitmap of columns used for indexing */\r\n  Bitmask extraCols;          /* Bitmap of additional columns */\r\n\r\n  /* Generate code to skip over the creation and initialization of the\r\n  ** transient index on 2nd and subsequent iterations of the loop. */\r\n  v = pParse->pVdbe;\r\n  assert( v!=0 );\r\n  addrInit = sqlite3CodeOnce(pParse);\r\n\r\n  /* Count the number of columns that will be added to the index\r\n  ** and used to match WHERE clause constraints */\r\n  nColumn = 0;\r\n  pTable = pSrc->pTab;\r\n  pWCEnd = &pWC->a[pWC->nTerm];\r\n  idxCols = 0;\r\n  for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){\r\n    if( termCanDriveIndex(pTerm, pSrc, notReady) ){\r\n      int iCol = pTerm->u.leftColumn;\r\n      Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;\r\n      testcase( iCol==BMS );\r\n      testcase( iCol==BMS-1 );\r\n      if( (idxCols & cMask)==0 ){\r\n        nColumn++;\r\n        idxCols |= cMask;\r\n      }\r\n    }\r\n  }\r\n  assert( nColumn>0 );\r\n  pLevel->plan.nEq = nColumn;\r\n\r\n  /* Count the number of additional columns needed to create a\r\n  ** covering index.  A \"covering index\" is an index that contains all\r\n  ** columns that are needed by the query.  With a covering index, the\r\n  ** original table never needs to be accessed.  Automatic indices must\r\n  ** be a covering index because the index will not be updated if the\r\n  ** original table changes and the index and table cannot both be used\r\n  ** if they go out of sync.\r\n  */\r\n  extraCols = pSrc->colUsed & (~idxCols | (((Bitmask)1)<<(BMS-1)));\r\n  mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol;\r\n  testcase( pTable->nCol==BMS-1 );\r\n  testcase( pTable->nCol==BMS-2 );\r\n  for(i=0; i<mxBitCol; i++){\r\n    if( extraCols & (((Bitmask)1)<<i) ) nColumn++;\r\n  }\r\n  if( pSrc->colUsed & (((Bitmask)1)<<(BMS-1)) ){\r\n    nColumn += pTable->nCol - BMS + 1;\r\n  }\r\n  pLevel->plan.wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WO_EQ;\r\n\r\n  /* Construct the Index object to describe this index */\r\n  nByte = sizeof(Index);\r\n  nByte += nColumn*sizeof(int);     /* Index.aiColumn */\r\n  nByte += nColumn*sizeof(char*);   /* Index.azColl */\r\n  nByte += nColumn;                 /* Index.aSortOrder */\r\n  pIdx = sqlite3DbMallocZero(pParse->db, nByte);\r\n  if( pIdx==0 ) return;\r\n  pLevel->plan.u.pIdx = pIdx;\r\n  pIdx->azColl = (char**)&pIdx[1];\r\n  pIdx->aiColumn = (int*)&pIdx->azColl[nColumn];\r\n  pIdx->aSortOrder = (u8*)&pIdx->aiColumn[nColumn];\r\n  pIdx->zName = \"auto-index\";\r\n  pIdx->nColumn = nColumn;\r\n  pIdx->pTable = pTable;\r\n  n = 0;\r\n  idxCols = 0;\r\n  for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){\r\n    if( termCanDriveIndex(pTerm, pSrc, notReady) ){\r\n      int iCol = pTerm->u.leftColumn;\r\n      Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;\r\n      if( (idxCols & cMask)==0 ){\r\n        Expr *pX = pTerm->pExpr;\r\n        idxCols |= cMask;\r\n        pIdx->aiColumn[n] = pTerm->u.leftColumn;\r\n        pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);\r\n        pIdx->azColl[n] = ALWAYS(pColl) ? pColl->zName : \"BINARY\";\r\n        n++;\r\n      }\r\n    }\r\n  }\r\n  assert( (u32)n==pLevel->plan.nEq );\r\n\r\n  /* Add additional columns needed to make the automatic index into\r\n  ** a covering index */\r\n  for(i=0; i<mxBitCol; i++){\r\n    if( extraCols & (((Bitmask)1)<<i) ){\r\n      pIdx->aiColumn[n] = i;\r\n      pIdx->azColl[n] = \"BINARY\";\r\n      n++;\r\n    }\r\n  }\r\n  if( pSrc->colUsed & (((Bitmask)1)<<(BMS-1)) ){\r\n    for(i=BMS-1; i<pTable->nCol; i++){\r\n      pIdx->aiColumn[n] = i;\r\n      pIdx->azColl[n] = \"BINARY\";\r\n      n++;\r\n    }\r\n  }\r\n  assert( n==nColumn );\r\n\r\n  /* Create the automatic index */\r\n  pKeyinfo = sqlite3IndexKeyinfo(pParse, pIdx);\r\n  assert( pLevel->iIdxCur>=0 );\r\n  sqlite3VdbeAddOp4(v, OP_OpenAutoindex, pLevel->iIdxCur, nColumn+1, 0,\r\n                    (char*)pKeyinfo, P4_KEYINFO_HANDOFF);\r\n  VdbeComment((v, \"for %s\", pTable->zName));\r\n\r\n  /* Fill the automatic index with content */\r\n  addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur);\r\n  regRecord = sqlite3GetTempReg(pParse);\r\n  sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 1);\r\n  sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);\r\n  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\r\n  sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);\r\n  sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);\r\n  sqlite3VdbeJumpHere(v, addrTop);\r\n  sqlite3ReleaseTempReg(pParse, regRecord);\r\n  \r\n  /* Jump here when skipping the initialization */\r\n  sqlite3VdbeJumpHere(v, addrInit);\r\n}\r\n#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n/*\r\n** Allocate and populate an sqlite3_index_info structure. It is the \r\n** responsibility of the caller to eventually release the structure\r\n** by passing the pointer returned by this function to sqlite3_free().\r\n*/\r\nstatic sqlite3_index_info *allocateIndexInfo(\r\n  Parse *pParse, \r\n  WhereClause *pWC,\r\n  struct SrcList_item *pSrc,\r\n  ExprList *pOrderBy\r\n){\r\n  int i, j;\r\n  int nTerm;\r\n  struct sqlite3_index_constraint *pIdxCons;\r\n  struct sqlite3_index_orderby *pIdxOrderBy;\r\n  struct sqlite3_index_constraint_usage *pUsage;\r\n  WhereTerm *pTerm;\r\n  int nOrderBy;\r\n  sqlite3_index_info *pIdxInfo;\r\n\r\n  WHERETRACE((\"Recomputing index info for %s...\\n\", pSrc->pTab->zName));\r\n\r\n  /* Count the number of possible WHERE clause constraints referring\r\n  ** to this virtual table */\r\n  for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){\r\n    if( pTerm->leftCursor != pSrc->iCursor ) continue;\r\n    assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );\r\n    testcase( pTerm->eOperator==WO_IN );\r\n    testcase( pTerm->eOperator==WO_ISNULL );\r\n    if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;\r\n    if( pTerm->wtFlags & TERM_VNULL ) continue;\r\n    nTerm++;\r\n  }\r\n\r\n  /* If the ORDER BY clause contains only columns in the current \r\n  ** virtual table then allocate space for the aOrderBy part of\r\n  ** the sqlite3_index_info structure.\r\n  */\r\n  nOrderBy = 0;\r\n  if( pOrderBy ){\r\n    for(i=0; i<pOrderBy->nExpr; i++){\r\n      Expr *pExpr = pOrderBy->a[i].pExpr;\r\n      if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;\r\n    }\r\n    if( i==pOrderBy->nExpr ){\r\n      nOrderBy = pOrderBy->nExpr;\r\n    }\r\n  }\r\n\r\n  /* Allocate the sqlite3_index_info structure\r\n  */\r\n  pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo)\r\n                           + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm\r\n                           + sizeof(*pIdxOrderBy)*nOrderBy );\r\n  if( pIdxInfo==0 ){\r\n    sqlite3ErrorMsg(pParse, \"out of memory\");\r\n    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\r\n    return 0;\r\n  }\r\n\r\n  /* Initialize the structure.  The sqlite3_index_info structure contains\r\n  ** many fields that are declared \"const\" to prevent xBestIndex from\r\n  ** changing them.  We have to do some funky casting in order to\r\n  ** initialize those fields.\r\n  */\r\n  pIdxCons = (struct sqlite3_index_constraint*)&pIdxInfo[1];\r\n  pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm];\r\n  pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy];\r\n  *(int*)&pIdxInfo->nConstraint = nTerm;\r\n  *(int*)&pIdxInfo->nOrderBy = nOrderBy;\r\n  *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint = pIdxCons;\r\n  *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy;\r\n  *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage =\r\n                                                                   pUsage;\r\n\r\n  for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){\r\n    if( pTerm->leftCursor != pSrc->iCursor ) continue;\r\n    assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );\r\n    testcase( pTerm->eOperator==WO_IN );\r\n    testcase( pTerm->eOperator==WO_ISNULL );\r\n    if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;\r\n    if( pTerm->wtFlags & TERM_VNULL ) continue;\r\n    pIdxCons[j].iColumn = pTerm->u.leftColumn;\r\n    pIdxCons[j].iTermOffset = i;\r\n    pIdxCons[j].op = (u8)pTerm->eOperator;\r\n    /* The direct assignment in the previous line is possible only because\r\n    ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical.  The\r\n    ** following asserts verify this fact. */\r\n    assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );\r\n    assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );\r\n    assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );\r\n    assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );\r\n    assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE );\r\n    assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH );\r\n    assert( pTerm->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) );\r\n    j++;\r\n  }\r\n  for(i=0; i<nOrderBy; i++){\r\n    Expr *pExpr = pOrderBy->a[i].pExpr;\r\n    pIdxOrderBy[i].iColumn = pExpr->iColumn;\r\n    pIdxOrderBy[i].desc = pOrderBy->a[i].sortOrder;\r\n  }\r\n\r\n  return pIdxInfo;\r\n}\r\n\r\n/*\r\n** The table object reference passed as the second argument to this function\r\n** must represent a virtual table. This function invokes the xBestIndex()\r\n** method of the virtual table with the sqlite3_index_info pointer passed\r\n** as the argument.\r\n**\r\n** If an error occurs, pParse is populated with an error message and a\r\n** non-zero value is returned. Otherwise, 0 is returned and the output\r\n** part of the sqlite3_index_info structure is left populated.\r\n**\r\n** Whether or not an error is returned, it is the responsibility of the\r\n** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates\r\n** that this is required.\r\n*/\r\nstatic int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){\r\n  sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;\r\n  int i;\r\n  int rc;\r\n\r\n  WHERETRACE((\"xBestIndex for %s\\n\", pTab->zName));\r\n  TRACE_IDX_INPUTS(p);\r\n  rc = pVtab->pModule->xBestIndex(pVtab, p);\r\n  TRACE_IDX_OUTPUTS(p);\r\n\r\n  if( rc!=SQLITE_OK ){\r\n    if( rc==SQLITE_NOMEM ){\r\n      pParse->db->mallocFailed = 1;\r\n    }else if( !pVtab->zErrMsg ){\r\n      sqlite3ErrorMsg(pParse, \"%s\", sqlite3ErrStr(rc));\r\n    }else{\r\n      sqlite3ErrorMsg(pParse, \"%s\", pVtab->zErrMsg);\r\n    }\r\n  }\r\n  sqlite3_free(pVtab->zErrMsg);\r\n  pVtab->zErrMsg = 0;\r\n\r\n  for(i=0; i<p->nConstraint; i++){\r\n    if( !p->aConstraint[i].usable && p->aConstraintUsage[i].argvIndex>0 ){\r\n      sqlite3ErrorMsg(pParse, \r\n          \"table %s: xBestIndex returned an invalid plan\", pTab->zName);\r\n    }\r\n  }\r\n\r\n  return pParse->nErr;\r\n}\r\n\r\n\r\n/*\r\n** Compute the best index for a virtual table.\r\n**\r\n** The best index is computed by the xBestIndex method of the virtual\r\n** table module.  This routine is really just a wrapper that sets up\r\n** the sqlite3_index_info structure that is used to communicate with\r\n** xBestIndex.\r\n**\r\n** In a join, this routine might be called multiple times for the\r\n** same virtual table.  The sqlite3_index_info structure is created\r\n** and initialized on the first invocation and reused on all subsequent\r\n** invocations.  The sqlite3_index_info structure is also used when\r\n** code is generated to access the virtual table.  The whereInfoDelete() \r\n** routine takes care of freeing the sqlite3_index_info structure after\r\n** everybody has finished with it.\r\n*/\r\nstatic void bestVirtualIndex(\r\n  Parse *pParse,                  /* The parsing context */\r\n  WhereClause *pWC,               /* The WHERE clause */\r\n  struct SrcList_item *pSrc,      /* The FROM clause term to search */\r\n  Bitmask notReady,               /* Mask of cursors not available for index */\r\n  Bitmask notValid,               /* Cursors not valid for any purpose */\r\n  ExprList *pOrderBy,             /* The order by clause */\r\n  WhereCost *pCost,               /* Lowest cost query plan */\r\n  sqlite3_index_info **ppIdxInfo  /* Index information passed to xBestIndex */\r\n){\r\n  Table *pTab = pSrc->pTab;\r\n  sqlite3_index_info *pIdxInfo;\r\n  struct sqlite3_index_constraint *pIdxCons;\r\n  struct sqlite3_index_constraint_usage *pUsage;\r\n  WhereTerm *pTerm;\r\n  int i, j;\r\n  int nOrderBy;\r\n  double rCost;\r\n\r\n  /* Make sure wsFlags is initialized to some sane value. Otherwise, if the \r\n  ** malloc in allocateIndexInfo() fails and this function returns leaving\r\n  ** wsFlags in an uninitialized state, the caller may behave unpredictably.\r\n  */\r\n  memset(pCost, 0, sizeof(*pCost));\r\n  pCost->plan.wsFlags = WHERE_VIRTUALTABLE;\r\n\r\n  /* If the sqlite3_index_info structure has not been previously\r\n  ** allocated and initialized, then allocate and initialize it now.\r\n  */\r\n  pIdxInfo = *ppIdxInfo;\r\n  if( pIdxInfo==0 ){\r\n    *ppIdxInfo = pIdxInfo = allocateIndexInfo(pParse, pWC, pSrc, pOrderBy);\r\n  }\r\n  if( pIdxInfo==0 ){\r\n    return;\r\n  }\r\n\r\n  /* At this point, the sqlite3_index_info structure that pIdxInfo points\r\n  ** to will have been initialized, either during the current invocation or\r\n  ** during some prior invocation.  Now we just have to customize the\r\n  ** details of pIdxInfo for the current invocation and pass it to\r\n  ** xBestIndex.\r\n  */\r\n\r\n  /* The module name must be defined. Also, by this point there must\r\n  ** be a pointer to an sqlite3_vtab structure. Otherwise\r\n  ** sqlite3ViewGetColumnNames() would have picked up the error. \r\n  */\r\n  assert( pTab->azModuleArg && pTab->azModuleArg[0] );\r\n  assert( sqlite3GetVTable(pParse->db, pTab) );\r\n\r\n  /* Set the aConstraint[].usable fields and initialize all \r\n  ** output variables to zero.\r\n  **\r\n  ** aConstraint[].usable is true for constraints where the right-hand\r\n  ** side contains only references to tables to the left of the current\r\n  ** table.  In other words, if the constraint is of the form:\r\n  **\r\n  **           column = expr\r\n  **\r\n  ** and we are evaluating a join, then the constraint on column is \r\n  ** only valid if all tables referenced in expr occur to the left\r\n  ** of the table containing column.\r\n  **\r\n  ** The aConstraints[] array contains entries for all constraints\r\n  ** on the current table.  That way we only have to compute it once\r\n  ** even though we might try to pick the best index multiple times.\r\n  ** For each attempt at picking an index, the order of tables in the\r\n  ** join might be different so we have to recompute the usable flag\r\n  ** each time.\r\n  */\r\n  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;\r\n  pUsage = pIdxInfo->aConstraintUsage;\r\n  for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){\r\n    j = pIdxCons->iTermOffset;\r\n    pTerm = &pWC->a[j];\r\n    pIdxCons->usable = (pTerm->prereqRight&notReady) ? 0 : 1;\r\n  }\r\n  memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint);\r\n  if( pIdxInfo->needToFreeIdxStr ){\r\n    sqlite3_free(pIdxInfo->idxStr);\r\n  }\r\n  pIdxInfo->idxStr = 0;\r\n  pIdxInfo->idxNum = 0;\r\n  pIdxInfo->needToFreeIdxStr = 0;\r\n  pIdxInfo->orderByConsumed = 0;\r\n  /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */\r\n  pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2);\r\n  nOrderBy = pIdxInfo->nOrderBy;\r\n  if( !pOrderBy ){\r\n    pIdxInfo->nOrderBy = 0;\r\n  }\r\n\r\n  if( vtabBestIndex(pParse, pTab, pIdxInfo) ){\r\n    return;\r\n  }\r\n\r\n  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;\r\n  for(i=0; i<pIdxInfo->nConstraint; i++){\r\n    if( pUsage[i].argvIndex>0 ){\r\n      pCost->used |= pWC->a[pIdxCons[i].iTermOffset].prereqRight;\r\n    }\r\n  }\r\n\r\n  /* If there is an ORDER BY clause, and the selected virtual table index\r\n  ** does not satisfy it, increase the cost of the scan accordingly. This\r\n  ** matches the processing for non-virtual tables in bestBtreeIndex().\r\n  */\r\n  rCost = pIdxInfo->estimatedCost;\r\n  if( pOrderBy && pIdxInfo->orderByConsumed==0 ){\r\n    rCost += estLog(rCost)*rCost;\r\n  }\r\n\r\n  /* The cost is not allowed to be larger than SQLITE_BIG_DBL (the\r\n  ** inital value of lowestCost in this loop. If it is, then the\r\n  ** (cost<lowestCost) test below will never be true.\r\n  ** \r\n  ** Use \"(double)2\" instead of \"2.0\" in case OMIT_FLOATING_POINT \r\n  ** is defined.\r\n  */\r\n  if( (SQLITE_BIG_DBL/((double)2))<rCost ){\r\n    pCost->rCost = (SQLITE_BIG_DBL/((double)2));\r\n  }else{\r\n    pCost->rCost = rCost;\r\n  }\r\n  pCost->plan.u.pVtabIdx = pIdxInfo;\r\n  if( pIdxInfo->orderByConsumed ){\r\n    pCost->plan.wsFlags |= WHERE_ORDERBY;\r\n  }\r\n  pCost->plan.nEq = 0;\r\n  pIdxInfo->nOrderBy = nOrderBy;\r\n\r\n  /* Try to find a more efficient access pattern by using multiple indexes\r\n  ** to optimize an OR expression within the WHERE clause. \r\n  */\r\n  bestOrClauseIndex(pParse, pWC, pSrc, notReady, notValid, pOrderBy, pCost);\r\n}\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n/*\r\n** Estimate the location of a particular key among all keys in an\r\n** index.  Store the results in aStat as follows:\r\n**\r\n**    aStat[0]      Est. number of rows less than pVal\r\n**    aStat[1]      Est. number of rows equal to pVal\r\n**\r\n** Return SQLITE_OK on success.\r\n*/\r\nstatic int whereKeyStats(\r\n  Parse *pParse,              /* Database connection */\r\n  Index *pIdx,                /* Index to consider domain of */\r\n  sqlite3_value *pVal,        /* Value to consider */\r\n  int roundUp,                /* Round up if true.  Round down if false */\r\n  tRowcnt *aStat              /* OUT: stats written here */\r\n){\r\n  tRowcnt n;\r\n  IndexSample *aSample;\r\n  int i, eType;\r\n  int isEq = 0;\r\n  i64 v;\r\n  double r, rS;\r\n\r\n  assert( roundUp==0 || roundUp==1 );\r\n  assert( pIdx->nSample>0 );\r\n  if( pVal==0 ) return SQLITE_ERROR;\r\n  n = pIdx->aiRowEst[0];\r\n  aSample = pIdx->aSample;\r\n  eType = sqlite3_value_type(pVal);\r\n\r\n  if( eType==SQLITE_INTEGER ){\r\n    v = sqlite3_value_int64(pVal);\r\n    r = (i64)v;\r\n    for(i=0; i<pIdx->nSample; i++){\r\n      if( aSample[i].eType==SQLITE_NULL ) continue;\r\n      if( aSample[i].eType>=SQLITE_TEXT ) break;\r\n      if( aSample[i].eType==SQLITE_INTEGER ){\r\n        if( aSample[i].u.i>=v ){\r\n          isEq = aSample[i].u.i==v;\r\n          break;\r\n        }\r\n      }else{\r\n        assert( aSample[i].eType==SQLITE_FLOAT );\r\n        if( aSample[i].u.r>=r ){\r\n          isEq = aSample[i].u.r==r;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }else if( eType==SQLITE_FLOAT ){\r\n    r = sqlite3_value_double(pVal);\r\n    for(i=0; i<pIdx->nSample; i++){\r\n      if( aSample[i].eType==SQLITE_NULL ) continue;\r\n      if( aSample[i].eType>=SQLITE_TEXT ) break;\r\n      if( aSample[i].eType==SQLITE_FLOAT ){\r\n        rS = aSample[i].u.r;\r\n      }else{\r\n        rS = aSample[i].u.i;\r\n      }\r\n      if( rS>=r ){\r\n        isEq = rS==r;\r\n        break;\r\n      }\r\n    }\r\n  }else if( eType==SQLITE_NULL ){\r\n    i = 0;\r\n    if( aSample[0].eType==SQLITE_NULL ) isEq = 1;\r\n  }else{\r\n    assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB );\r\n    for(i=0; i<pIdx->nSample; i++){\r\n      if( aSample[i].eType==SQLITE_TEXT || aSample[i].eType==SQLITE_BLOB ){\r\n        break;\r\n      }\r\n    }\r\n    if( i<pIdx->nSample ){      \r\n      sqlite3 *db = pParse->db;\r\n      CollSeq *pColl;\r\n      const u8 *z;\r\n      if( eType==SQLITE_BLOB ){\r\n        z = (const u8 *)sqlite3_value_blob(pVal);\r\n        pColl = db->pDfltColl;\r\n        assert( pColl->enc==SQLITE_UTF8 );\r\n      }else{\r\n        pColl = sqlite3GetCollSeq(db, SQLITE_UTF8, 0, *pIdx->azColl);\r\n        if( pColl==0 ){\r\n          sqlite3ErrorMsg(pParse, \"no such collation sequence: %s\",\r\n                          *pIdx->azColl);\r\n          return SQLITE_ERROR;\r\n        }\r\n        z = (const u8 *)sqlite3ValueText(pVal, pColl->enc);\r\n        if( !z ){\r\n          return SQLITE_NOMEM;\r\n        }\r\n        assert( z && pColl && pColl->xCmp );\r\n      }\r\n      n = sqlite3ValueBytes(pVal, pColl->enc);\r\n  \r\n      for(; i<pIdx->nSample; i++){\r\n        int c;\r\n        int eSampletype = aSample[i].eType;\r\n        if( eSampletype<eType ) continue;\r\n        if( eSampletype!=eType ) break;\r\n#ifndef SQLITE_OMIT_UTF16\r\n        if( pColl->enc!=SQLITE_UTF8 ){\r\n          int nSample;\r\n          char *zSample = sqlite3Utf8to16(\r\n              db, pColl->enc, aSample[i].u.z, aSample[i].nByte, &nSample\r\n          );\r\n          if( !zSample ){\r\n            assert( db->mallocFailed );\r\n            return SQLITE_NOMEM;\r\n          }\r\n          c = pColl->xCmp(pColl->pUser, nSample, zSample, n, z);\r\n          sqlite3DbFree(db, zSample);\r\n        }else\r\n#endif\r\n        {\r\n          c = pColl->xCmp(pColl->pUser, aSample[i].nByte, aSample[i].u.z, n, z);\r\n        }\r\n        if( c>=0 ){\r\n          if( c==0 ) isEq = 1;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  /* At this point, aSample[i] is the first sample that is greater than\r\n  ** or equal to pVal.  Or if i==pIdx->nSample, then all samples are less\r\n  ** than pVal.  If aSample[i]==pVal, then isEq==1.\r\n  */\r\n  if( isEq ){\r\n    assert( i<pIdx->nSample );\r\n    aStat[0] = aSample[i].nLt;\r\n    aStat[1] = aSample[i].nEq;\r\n  }else{\r\n    tRowcnt iLower, iUpper, iGap;\r\n    if( i==0 ){\r\n      iLower = 0;\r\n      iUpper = aSample[0].nLt;\r\n    }else{\r\n      iUpper = i>=pIdx->nSample ? n : aSample[i].nLt;\r\n      iLower = aSample[i-1].nEq + aSample[i-1].nLt;\r\n    }\r\n    aStat[1] = pIdx->avgEq;\r\n    if( iLower>=iUpper ){\r\n      iGap = 0;\r\n    }else{\r\n      iGap = iUpper - iLower;\r\n    }\r\n    if( roundUp ){\r\n      iGap = (iGap*2)/3;\r\n    }else{\r\n      iGap = iGap/3;\r\n    }\r\n    aStat[0] = iLower + iGap;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n#endif /* SQLITE_ENABLE_STAT3 */\r\n\r\n/*\r\n** If expression pExpr represents a literal value, set *pp to point to\r\n** an sqlite3_value structure containing the same value, with affinity\r\n** aff applied to it, before returning. It is the responsibility of the \r\n** caller to eventually release this structure by passing it to \r\n** sqlite3ValueFree().\r\n**\r\n** If the current parse is a recompile (sqlite3Reprepare()) and pExpr\r\n** is an SQL variable that currently has a non-NULL value bound to it,\r\n** create an sqlite3_value structure containing this value, again with\r\n** affinity aff applied to it, instead.\r\n**\r\n** If neither of the above apply, set *pp to NULL.\r\n**\r\n** If an error occurs, return an error code. Otherwise, SQLITE_OK.\r\n*/\r\n#ifdef SQLITE_ENABLE_STAT3\r\nstatic int valueFromExpr(\r\n  Parse *pParse, \r\n  Expr *pExpr, \r\n  u8 aff, \r\n  sqlite3_value **pp\r\n){\r\n  if( pExpr->op==TK_VARIABLE\r\n   || (pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)\r\n  ){\r\n    int iVar = pExpr->iColumn;\r\n    sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);\r\n    *pp = sqlite3VdbeGetValue(pParse->pReprepare, iVar, aff);\r\n    return SQLITE_OK;\r\n  }\r\n  return sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, aff, pp);\r\n}\r\n#endif\r\n\r\n/*\r\n** This function is used to estimate the number of rows that will be visited\r\n** by scanning an index for a range of values. The range may have an upper\r\n** bound, a lower bound, or both. The WHERE clause terms that set the upper\r\n** and lower bounds are represented by pLower and pUpper respectively. For\r\n** example, assuming that index p is on t1(a):\r\n**\r\n**   ... FROM t1 WHERE a > ? AND a < ? ...\r\n**                    |_____|   |_____|\r\n**                       |         |\r\n**                     pLower    pUpper\r\n**\r\n** If either of the upper or lower bound is not present, then NULL is passed in\r\n** place of the corresponding WhereTerm.\r\n**\r\n** The nEq parameter is passed the index of the index column subject to the\r\n** range constraint. Or, equivalently, the number of equality constraints\r\n** optimized by the proposed index scan. For example, assuming index p is\r\n** on t1(a, b), and the SQL query is:\r\n**\r\n**   ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...\r\n**\r\n** then nEq should be passed the value 1 (as the range restricted column,\r\n** b, is the second left-most column of the index). Or, if the query is:\r\n**\r\n**   ... FROM t1 WHERE a > ? AND a < ? ...\r\n**\r\n** then nEq should be passed 0.\r\n**\r\n** The returned value is an integer divisor to reduce the estimated\r\n** search space.  A return value of 1 means that range constraints are\r\n** no help at all.  A return value of 2 means range constraints are\r\n** expected to reduce the search space by half.  And so forth...\r\n**\r\n** In the absence of sqlite_stat3 ANALYZE data, each range inequality\r\n** reduces the search space by a factor of 4.  Hence a single constraint (x>?)\r\n** results in a return of 4 and a range constraint (x>? AND x<?) results\r\n** in a return of 16.\r\n*/\r\nstatic int whereRangeScanEst(\r\n  Parse *pParse,       /* Parsing & code generating context */\r\n  Index *p,            /* The index containing the range-compared column; \"x\" */\r\n  int nEq,             /* index into p->aCol[] of the range-compared column */\r\n  WhereTerm *pLower,   /* Lower bound on the range. ex: \"x>123\" Might be NULL */\r\n  WhereTerm *pUpper,   /* Upper bound on the range. ex: \"x<455\" Might be NULL */\r\n  double *pRangeDiv   /* OUT: Reduce search space by this divisor */\r\n){\r\n  int rc = SQLITE_OK;\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n\r\n  if( nEq==0 && p->nSample ){\r\n    sqlite3_value *pRangeVal;\r\n    tRowcnt iLower = 0;\r\n    tRowcnt iUpper = p->aiRowEst[0];\r\n    tRowcnt a[2];\r\n    u8 aff = p->pTable->aCol[p->aiColumn[0]].affinity;\r\n\r\n    if( pLower ){\r\n      Expr *pExpr = pLower->pExpr->pRight;\r\n      rc = valueFromExpr(pParse, pExpr, aff, &pRangeVal);\r\n      assert( pLower->eOperator==WO_GT || pLower->eOperator==WO_GE );\r\n      if( rc==SQLITE_OK\r\n       && whereKeyStats(pParse, p, pRangeVal, 0, a)==SQLITE_OK\r\n      ){\r\n        iLower = a[0];\r\n        if( pLower->eOperator==WO_GT ) iLower += a[1];\r\n      }\r\n      sqlite3ValueFree(pRangeVal);\r\n    }\r\n    if( rc==SQLITE_OK && pUpper ){\r\n      Expr *pExpr = pUpper->pExpr->pRight;\r\n      rc = valueFromExpr(pParse, pExpr, aff, &pRangeVal);\r\n      assert( pUpper->eOperator==WO_LT || pUpper->eOperator==WO_LE );\r\n      if( rc==SQLITE_OK\r\n       && whereKeyStats(pParse, p, pRangeVal, 1, a)==SQLITE_OK\r\n      ){\r\n        iUpper = a[0];\r\n        if( pUpper->eOperator==WO_LE ) iUpper += a[1];\r\n      }\r\n      sqlite3ValueFree(pRangeVal);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      if( iUpper<=iLower ){\r\n        *pRangeDiv = (double)p->aiRowEst[0];\r\n      }else{\r\n        *pRangeDiv = (double)p->aiRowEst[0]/(double)(iUpper - iLower);\r\n      }\r\n      WHERETRACE((\"range scan regions: %u..%u  div=%g\\n\",\r\n                  (u32)iLower, (u32)iUpper, *pRangeDiv));\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n#else\r\n  UNUSED_PARAMETER(pParse);\r\n  UNUSED_PARAMETER(p);\r\n  UNUSED_PARAMETER(nEq);\r\n#endif\r\n  assert( pLower || pUpper );\r\n  *pRangeDiv = (double)1;\r\n  if( pLower && (pLower->wtFlags & TERM_VNULL)==0 ) *pRangeDiv *= (double)4;\r\n  if( pUpper ) *pRangeDiv *= (double)4;\r\n  return rc;\r\n}\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n/*\r\n** Estimate the number of rows that will be returned based on\r\n** an equality constraint x=VALUE and where that VALUE occurs in\r\n** the histogram data.  This only works when x is the left-most\r\n** column of an index and sqlite_stat3 histogram data is available\r\n** for that index.  When pExpr==NULL that means the constraint is\r\n** \"x IS NULL\" instead of \"x=VALUE\".\r\n**\r\n** Write the estimated row count into *pnRow and return SQLITE_OK. \r\n** If unable to make an estimate, leave *pnRow unchanged and return\r\n** non-zero.\r\n**\r\n** This routine can fail if it is unable to load a collating sequence\r\n** required for string comparison, or if unable to allocate memory\r\n** for a UTF conversion required for comparison.  The error is stored\r\n** in the pParse structure.\r\n*/\r\nstatic int whereEqualScanEst(\r\n  Parse *pParse,       /* Parsing & code generating context */\r\n  Index *p,            /* The index whose left-most column is pTerm */\r\n  Expr *pExpr,         /* Expression for VALUE in the x=VALUE constraint */\r\n  double *pnRow        /* Write the revised row estimate here */\r\n){\r\n  sqlite3_value *pRhs = 0;  /* VALUE on right-hand side of pTerm */\r\n  u8 aff;                   /* Column affinity */\r\n  int rc;                   /* Subfunction return code */\r\n  tRowcnt a[2];             /* Statistics */\r\n\r\n  assert( p->aSample!=0 );\r\n  assert( p->nSample>0 );\r\n  aff = p->pTable->aCol[p->aiColumn[0]].affinity;\r\n  if( pExpr ){\r\n    rc = valueFromExpr(pParse, pExpr, aff, &pRhs);\r\n    if( rc ) goto whereEqualScanEst_cancel;\r\n  }else{\r\n    pRhs = sqlite3ValueNew(pParse->db);\r\n  }\r\n  if( pRhs==0 ) return SQLITE_NOTFOUND;\r\n  rc = whereKeyStats(pParse, p, pRhs, 0, a);\r\n  if( rc==SQLITE_OK ){\r\n    WHERETRACE((\"equality scan regions: %d\\n\", (int)a[1]));\r\n    *pnRow = a[1];\r\n  }\r\nwhereEqualScanEst_cancel:\r\n  sqlite3ValueFree(pRhs);\r\n  return rc;\r\n}\r\n#endif /* defined(SQLITE_ENABLE_STAT3) */\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n/*\r\n** Estimate the number of rows that will be returned based on\r\n** an IN constraint where the right-hand side of the IN operator\r\n** is a list of values.  Example:\r\n**\r\n**        WHERE x IN (1,2,3,4)\r\n**\r\n** Write the estimated row count into *pnRow and return SQLITE_OK. \r\n** If unable to make an estimate, leave *pnRow unchanged and return\r\n** non-zero.\r\n**\r\n** This routine can fail if it is unable to load a collating sequence\r\n** required for string comparison, or if unable to allocate memory\r\n** for a UTF conversion required for comparison.  The error is stored\r\n** in the pParse structure.\r\n*/\r\nstatic int whereInScanEst(\r\n  Parse *pParse,       /* Parsing & code generating context */\r\n  Index *p,            /* The index whose left-most column is pTerm */\r\n  ExprList *pList,     /* The value list on the RHS of \"x IN (v1,v2,v3,...)\" */\r\n  double *pnRow        /* Write the revised row estimate here */\r\n){\r\n  int rc = SQLITE_OK;         /* Subfunction return code */\r\n  double nEst;                /* Number of rows for a single term */\r\n  double nRowEst = (double)0; /* New estimate of the number of rows */\r\n  int i;                      /* Loop counter */\r\n\r\n  assert( p->aSample!=0 );\r\n  for(i=0; rc==SQLITE_OK && i<pList->nExpr; i++){\r\n    nEst = p->aiRowEst[0];\r\n    rc = whereEqualScanEst(pParse, p, pList->a[i].pExpr, &nEst);\r\n    nRowEst += nEst;\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    if( nRowEst > p->aiRowEst[0] ) nRowEst = p->aiRowEst[0];\r\n    *pnRow = nRowEst;\r\n    WHERETRACE((\"IN row estimate: est=%g\\n\", nRowEst));\r\n  }\r\n  return rc;\r\n}\r\n#endif /* defined(SQLITE_ENABLE_STAT3) */\r\n\r\n\r\n/*\r\n** Find the best query plan for accessing a particular table.  Write the\r\n** best query plan and its cost into the WhereCost object supplied as the\r\n** last parameter.\r\n**\r\n** The lowest cost plan wins.  The cost is an estimate of the amount of\r\n** CPU and disk I/O needed to process the requested result.\r\n** Factors that influence cost include:\r\n**\r\n**    *  The estimated number of rows that will be retrieved.  (The\r\n**       fewer the better.)\r\n**\r\n**    *  Whether or not sorting must occur.\r\n**\r\n**    *  Whether or not there must be separate lookups in the\r\n**       index and in the main table.\r\n**\r\n** If there was an INDEXED BY clause (pSrc->pIndex) attached to the table in\r\n** the SQL statement, then this function only considers plans using the \r\n** named index. If no such plan is found, then the returned cost is\r\n** SQLITE_BIG_DBL. If a plan is found that uses the named index, \r\n** then the cost is calculated in the usual way.\r\n**\r\n** If a NOT INDEXED clause (pSrc->notIndexed!=0) was attached to the table \r\n** in the SELECT statement, then no indexes are considered. However, the \r\n** selected plan may still take advantage of the built-in rowid primary key\r\n** index.\r\n*/\r\nstatic void bestBtreeIndex(\r\n  Parse *pParse,              /* The parsing context */\r\n  WhereClause *pWC,           /* The WHERE clause */\r\n  struct SrcList_item *pSrc,  /* The FROM clause term to search */\r\n  Bitmask notReady,           /* Mask of cursors not available for indexing */\r\n  Bitmask notValid,           /* Cursors not available for any purpose */\r\n  ExprList *pOrderBy,         /* The ORDER BY clause */\r\n  ExprList *pDistinct,        /* The select-list if query is DISTINCT */\r\n  WhereCost *pCost            /* Lowest cost query plan */\r\n){\r\n  int iCur = pSrc->iCursor;   /* The cursor of the table to be accessed */\r\n  Index *pProbe;              /* An index we are evaluating */\r\n  Index *pIdx;                /* Copy of pProbe, or zero for IPK index */\r\n  int eqTermMask;             /* Current mask of valid equality operators */\r\n  int idxEqTermMask;          /* Index mask of valid equality operators */\r\n  Index sPk;                  /* A fake index object for the primary key */\r\n  tRowcnt aiRowEstPk[2];      /* The aiRowEst[] value for the sPk index */\r\n  int aiColumnPk = -1;        /* The aColumn[] value for the sPk index */\r\n  int wsFlagMask;             /* Allowed flags in pCost->plan.wsFlag */\r\n\r\n  /* Initialize the cost to a worst-case value */\r\n  memset(pCost, 0, sizeof(*pCost));\r\n  pCost->rCost = SQLITE_BIG_DBL;\r\n\r\n  /* If the pSrc table is the right table of a LEFT JOIN then we may not\r\n  ** use an index to satisfy IS NULL constraints on that table.  This is\r\n  ** because columns might end up being NULL if the table does not match -\r\n  ** a circumstance which the index cannot help us discover.  Ticket #2177.\r\n  */\r\n  if( pSrc->jointype & JT_LEFT ){\r\n    idxEqTermMask = WO_EQ|WO_IN;\r\n  }else{\r\n    idxEqTermMask = WO_EQ|WO_IN|WO_ISNULL;\r\n  }\r\n\r\n  if( pSrc->pIndex ){\r\n    /* An INDEXED BY clause specifies a particular index to use */\r\n    pIdx = pProbe = pSrc->pIndex;\r\n    wsFlagMask = ~(WHERE_ROWID_EQ|WHERE_ROWID_RANGE);\r\n    eqTermMask = idxEqTermMask;\r\n  }else{\r\n    /* There is no INDEXED BY clause.  Create a fake Index object in local\r\n    ** variable sPk to represent the rowid primary key index.  Make this\r\n    ** fake index the first in a chain of Index objects with all of the real\r\n    ** indices to follow */\r\n    Index *pFirst;                  /* First of real indices on the table */\r\n    memset(&sPk, 0, sizeof(Index));\r\n    sPk.nColumn = 1;\r\n    sPk.aiColumn = &aiColumnPk;\r\n    sPk.aiRowEst = aiRowEstPk;\r\n    sPk.onError = OE_Replace;\r\n    sPk.pTable = pSrc->pTab;\r\n    aiRowEstPk[0] = pSrc->pTab->nRowEst;\r\n    aiRowEstPk[1] = 1;\r\n    pFirst = pSrc->pTab->pIndex;\r\n    if( pSrc->notIndexed==0 ){\r\n      /* The real indices of the table are only considered if the\r\n      ** NOT INDEXED qualifier is omitted from the FROM clause */\r\n      sPk.pNext = pFirst;\r\n    }\r\n    pProbe = &sPk;\r\n    wsFlagMask = ~(\r\n        WHERE_COLUMN_IN|WHERE_COLUMN_EQ|WHERE_COLUMN_NULL|WHERE_COLUMN_RANGE\r\n    );\r\n    eqTermMask = WO_EQ|WO_IN;\r\n    pIdx = 0;\r\n  }\r\n\r\n  /* Loop over all indices looking for the best one to use\r\n  */\r\n  for(; pProbe; pIdx=pProbe=pProbe->pNext){\r\n    const tRowcnt * const aiRowEst = pProbe->aiRowEst;\r\n    double cost;                /* Cost of using pProbe */\r\n    double nRow;                /* Estimated number of rows in result set */\r\n    double log10N = (double)1;  /* base-10 logarithm of nRow (inexact) */\r\n    int rev;                    /* True to scan in reverse order */\r\n    int wsFlags = 0;\r\n    Bitmask used = 0;\r\n\r\n    /* The following variables are populated based on the properties of\r\n    ** index being evaluated. They are then used to determine the expected\r\n    ** cost and number of rows returned.\r\n    **\r\n    **  nEq: \r\n    **    Number of equality terms that can be implemented using the index.\r\n    **    In other words, the number of initial fields in the index that\r\n    **    are used in == or IN or NOT NULL constraints of the WHERE clause.\r\n    **\r\n    **  nInMul:  \r\n    **    The \"in-multiplier\". This is an estimate of how many seek operations \r\n    **    SQLite must perform on the index in question. For example, if the \r\n    **    WHERE clause is:\r\n    **\r\n    **      WHERE a IN (1, 2, 3) AND b IN (4, 5, 6)\r\n    **\r\n    **    SQLite must perform 9 lookups on an index on (a, b), so nInMul is \r\n    **    set to 9. Given the same schema and either of the following WHERE \r\n    **    clauses:\r\n    **\r\n    **      WHERE a =  1\r\n    **      WHERE a >= 2\r\n    **\r\n    **    nInMul is set to 1.\r\n    **\r\n    **    If there exists a WHERE term of the form \"x IN (SELECT ...)\", then \r\n    **    the sub-select is assumed to return 25 rows for the purposes of \r\n    **    determining nInMul.\r\n    **\r\n    **  bInEst:  \r\n    **    Set to true if there was at least one \"x IN (SELECT ...)\" term used \r\n    **    in determining the value of nInMul.  Note that the RHS of the\r\n    **    IN operator must be a SELECT, not a value list, for this variable\r\n    **    to be true.\r\n    **\r\n    **  rangeDiv:\r\n    **    An estimate of a divisor by which to reduce the search space due\r\n    **    to inequality constraints.  In the absence of sqlite_stat3 ANALYZE\r\n    **    data, a single inequality reduces the search space to 1/4rd its\r\n    **    original size (rangeDiv==4).  Two inequalities reduce the search\r\n    **    space to 1/16th of its original size (rangeDiv==16).\r\n    **\r\n    **  bSort:   \r\n    **    Boolean. True if there is an ORDER BY clause that will require an \r\n    **    external sort (i.e. scanning the index being evaluated will not \r\n    **    correctly order records).\r\n    **\r\n    **  bLookup: \r\n    **    Boolean. True if a table lookup is required for each index entry\r\n    **    visited.  In other words, true if this is not a covering index.\r\n    **    This is always false for the rowid primary key index of a table.\r\n    **    For other indexes, it is true unless all the columns of the table\r\n    **    used by the SELECT statement are present in the index (such an\r\n    **    index is sometimes described as a covering index).\r\n    **    For example, given the index on (a, b), the second of the following \r\n    **    two queries requires table b-tree lookups in order to find the value\r\n    **    of column c, but the first does not because columns a and b are\r\n    **    both available in the index.\r\n    **\r\n    **             SELECT a, b    FROM tbl WHERE a = 1;\r\n    **             SELECT a, b, c FROM tbl WHERE a = 1;\r\n    */\r\n    int nEq;                      /* Number of == or IN terms matching index */\r\n    int bInEst = 0;               /* True if \"x IN (SELECT...)\" seen */\r\n    int nInMul = 1;               /* Number of distinct equalities to lookup */\r\n    double rangeDiv = (double)1;  /* Estimated reduction in search space */\r\n    int nBound = 0;               /* Number of range constraints seen */\r\n    int bSort = !!pOrderBy;       /* True if external sort required */\r\n    int bDist = !!pDistinct;      /* True if index cannot help with DISTINCT */\r\n    int bLookup = 0;              /* True if not a covering index */\r\n    WhereTerm *pTerm;             /* A single term of the WHERE clause */\r\n#ifdef SQLITE_ENABLE_STAT3\r\n    WhereTerm *pFirstTerm = 0;    /* First term matching the index */\r\n#endif\r\n\r\n    /* Determine the values of nEq and nInMul */\r\n    for(nEq=0; nEq<pProbe->nColumn; nEq++){\r\n      int j = pProbe->aiColumn[nEq];\r\n      pTerm = findTerm(pWC, iCur, j, notReady, eqTermMask, pIdx);\r\n      if( pTerm==0 ) break;\r\n      wsFlags |= (WHERE_COLUMN_EQ|WHERE_ROWID_EQ);\r\n      testcase( pTerm->pWC!=pWC );\r\n      if( pTerm->eOperator & WO_IN ){\r\n        Expr *pExpr = pTerm->pExpr;\r\n        wsFlags |= WHERE_COLUMN_IN;\r\n        if( ExprHasProperty(pExpr, EP_xIsSelect) ){\r\n          /* \"x IN (SELECT ...)\":  Assume the SELECT returns 25 rows */\r\n          nInMul *= 25;\r\n          bInEst = 1;\r\n        }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){\r\n          /* \"x IN (value, value, ...)\" */\r\n          nInMul *= pExpr->x.pList->nExpr;\r\n        }\r\n      }else if( pTerm->eOperator & WO_ISNULL ){\r\n        wsFlags |= WHERE_COLUMN_NULL;\r\n      }\r\n#ifdef SQLITE_ENABLE_STAT3\r\n      if( nEq==0 && pProbe->aSample ) pFirstTerm = pTerm;\r\n#endif\r\n      used |= pTerm->prereqRight;\r\n    }\r\n \r\n    /* If the index being considered is UNIQUE, and there is an equality \r\n    ** constraint for all columns in the index, then this search will find\r\n    ** at most a single row. In this case set the WHERE_UNIQUE flag to \r\n    ** indicate this to the caller.\r\n    **\r\n    ** Otherwise, if the search may find more than one row, test to see if\r\n    ** there is a range constraint on indexed column (nEq+1) that can be \r\n    ** optimized using the index. \r\n    */\r\n    if( nEq==pProbe->nColumn && pProbe->onError!=OE_None ){\r\n      testcase( wsFlags & WHERE_COLUMN_IN );\r\n      testcase( wsFlags & WHERE_COLUMN_NULL );\r\n      if( (wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_NULL))==0 ){\r\n        wsFlags |= WHERE_UNIQUE;\r\n      }\r\n    }else if( pProbe->bUnordered==0 ){\r\n      int j = (nEq==pProbe->nColumn ? -1 : pProbe->aiColumn[nEq]);\r\n      if( findTerm(pWC, iCur, j, notReady, WO_LT|WO_LE|WO_GT|WO_GE, pIdx) ){\r\n        WhereTerm *pTop = findTerm(pWC, iCur, j, notReady, WO_LT|WO_LE, pIdx);\r\n        WhereTerm *pBtm = findTerm(pWC, iCur, j, notReady, WO_GT|WO_GE, pIdx);\r\n        whereRangeScanEst(pParse, pProbe, nEq, pBtm, pTop, &rangeDiv);\r\n        if( pTop ){\r\n          nBound = 1;\r\n          wsFlags |= WHERE_TOP_LIMIT;\r\n          used |= pTop->prereqRight;\r\n          testcase( pTop->pWC!=pWC );\r\n        }\r\n        if( pBtm ){\r\n          nBound++;\r\n          wsFlags |= WHERE_BTM_LIMIT;\r\n          used |= pBtm->prereqRight;\r\n          testcase( pBtm->pWC!=pWC );\r\n        }\r\n        wsFlags |= (WHERE_COLUMN_RANGE|WHERE_ROWID_RANGE);\r\n      }\r\n    }\r\n\r\n    /* If there is an ORDER BY clause and the index being considered will\r\n    ** naturally scan rows in the required order, set the appropriate flags\r\n    ** in wsFlags. Otherwise, if there is an ORDER BY clause but the index\r\n    ** will scan rows in a different order, set the bSort variable.  */\r\n    if( isSortingIndex(\r\n          pParse, pWC->pMaskSet, pProbe, iCur, pOrderBy, nEq, wsFlags, &rev)\r\n    ){\r\n      bSort = 0;\r\n      wsFlags |= WHERE_ROWID_RANGE|WHERE_COLUMN_RANGE|WHERE_ORDERBY;\r\n      wsFlags |= (rev ? WHERE_REVERSE : 0);\r\n    }\r\n\r\n    /* If there is a DISTINCT qualifier and this index will scan rows in\r\n    ** order of the DISTINCT expressions, clear bDist and set the appropriate\r\n    ** flags in wsFlags. */\r\n    if( isDistinctIndex(pParse, pWC, pProbe, iCur, pDistinct, nEq)\r\n     && (wsFlags & WHERE_COLUMN_IN)==0\r\n    ){\r\n      bDist = 0;\r\n      wsFlags |= WHERE_ROWID_RANGE|WHERE_COLUMN_RANGE|WHERE_DISTINCT;\r\n    }\r\n\r\n    /* If currently calculating the cost of using an index (not the IPK\r\n    ** index), determine if all required column data may be obtained without \r\n    ** using the main table (i.e. if the index is a covering\r\n    ** index for this query). If it is, set the WHERE_IDX_ONLY flag in\r\n    ** wsFlags. Otherwise, set the bLookup variable to true.  */\r\n    if( pIdx && wsFlags ){\r\n      Bitmask m = pSrc->colUsed;\r\n      int j;\r\n      for(j=0; j<pIdx->nColumn; j++){\r\n        int x = pIdx->aiColumn[j];\r\n        if( x<BMS-1 ){\r\n          m &= ~(((Bitmask)1)<<x);\r\n        }\r\n      }\r\n      if( m==0 ){\r\n        wsFlags |= WHERE_IDX_ONLY;\r\n      }else{\r\n        bLookup = 1;\r\n      }\r\n    }\r\n\r\n    /*\r\n    ** Estimate the number of rows of output.  For an \"x IN (SELECT...)\"\r\n    ** constraint, do not let the estimate exceed half the rows in the table.\r\n    */\r\n    nRow = (double)(aiRowEst[nEq] * nInMul);\r\n    if( bInEst && nRow*2>aiRowEst[0] ){\r\n      nRow = aiRowEst[0]/2;\r\n      nInMul = (int)(nRow / aiRowEst[nEq]);\r\n    }\r\n\r\n#ifdef SQLITE_ENABLE_STAT3\r\n    /* If the constraint is of the form x=VALUE or x IN (E1,E2,...)\r\n    ** and we do not think that values of x are unique and if histogram\r\n    ** data is available for column x, then it might be possible\r\n    ** to get a better estimate on the number of rows based on\r\n    ** VALUE and how common that value is according to the histogram.\r\n    */\r\n    if( nRow>(double)1 && nEq==1 && pFirstTerm!=0 && aiRowEst[1]>1 ){\r\n      assert( (pFirstTerm->eOperator & (WO_EQ|WO_ISNULL|WO_IN))!=0 );\r\n      if( pFirstTerm->eOperator & (WO_EQ|WO_ISNULL) ){\r\n        testcase( pFirstTerm->eOperator==WO_EQ );\r\n        testcase( pFirstTerm->eOperator==WO_ISNULL );\r\n        whereEqualScanEst(pParse, pProbe, pFirstTerm->pExpr->pRight, &nRow);\r\n      }else if( bInEst==0 ){\r\n        assert( pFirstTerm->eOperator==WO_IN );\r\n        whereInScanEst(pParse, pProbe, pFirstTerm->pExpr->x.pList, &nRow);\r\n      }\r\n    }\r\n#endif /* SQLITE_ENABLE_STAT3 */\r\n\r\n    /* Adjust the number of output rows and downward to reflect rows\r\n    ** that are excluded by range constraints.\r\n    */\r\n    nRow = nRow/rangeDiv;\r\n    if( nRow<1 ) nRow = 1;\r\n\r\n    /* Experiments run on real SQLite databases show that the time needed\r\n    ** to do a binary search to locate a row in a table or index is roughly\r\n    ** log10(N) times the time to move from one row to the next row within\r\n    ** a table or index.  The actual times can vary, with the size of\r\n    ** records being an important factor.  Both moves and searches are\r\n    ** slower with larger records, presumably because fewer records fit\r\n    ** on one page and hence more pages have to be fetched.\r\n    **\r\n    ** The ANALYZE command and the sqlite_stat1 and sqlite_stat3 tables do\r\n    ** not give us data on the relative sizes of table and index records.\r\n    ** So this computation assumes table records are about twice as big\r\n    ** as index records\r\n    */\r\n    if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){\r\n      /* The cost of a full table scan is a number of move operations equal\r\n      ** to the number of rows in the table.\r\n      **\r\n      ** We add an additional 4x penalty to full table scans.  This causes\r\n      ** the cost function to err on the side of choosing an index over\r\n      ** choosing a full scan.  This 4x full-scan penalty is an arguable\r\n      ** decision and one which we expect to revisit in the future.  But\r\n      ** it seems to be working well enough at the moment.\r\n      */\r\n      cost = aiRowEst[0]*4;\r\n    }else{\r\n      log10N = estLog(aiRowEst[0]);\r\n      cost = nRow;\r\n      if( pIdx ){\r\n        if( bLookup ){\r\n          /* For an index lookup followed by a table lookup:\r\n          **    nInMul index searches to find the start of each index range\r\n          **  + nRow steps through the index\r\n          **  + nRow table searches to lookup the table entry using the rowid\r\n          */\r\n          cost += (nInMul + nRow)*log10N;\r\n        }else{\r\n          /* For a covering index:\r\n          **     nInMul index searches to find the initial entry \r\n          **   + nRow steps through the index\r\n          */\r\n          cost += nInMul*log10N;\r\n        }\r\n      }else{\r\n        /* For a rowid primary key lookup:\r\n        **    nInMult table searches to find the initial entry for each range\r\n        **  + nRow steps through the table\r\n        */\r\n        cost += nInMul*log10N;\r\n      }\r\n    }\r\n\r\n    /* Add in the estimated cost of sorting the result.  Actual experimental\r\n    ** measurements of sorting performance in SQLite show that sorting time\r\n    ** adds C*N*log10(N) to the cost, where N is the number of rows to be \r\n    ** sorted and C is a factor between 1.95 and 4.3.  We will split the\r\n    ** difference and select C of 3.0.\r\n    */\r\n    if( bSort ){\r\n      cost += nRow*estLog(nRow)*3;\r\n    }\r\n    if( bDist ){\r\n      cost += nRow*estLog(nRow)*3;\r\n    }\r\n\r\n    /**** Cost of using this index has now been computed ****/\r\n\r\n    /* If there are additional constraints on this table that cannot\r\n    ** be used with the current index, but which might lower the number\r\n    ** of output rows, adjust the nRow value accordingly.  This only \r\n    ** matters if the current index is the least costly, so do not bother\r\n    ** with this step if we already know this index will not be chosen.\r\n    ** Also, never reduce the output row count below 2 using this step.\r\n    **\r\n    ** It is critical that the notValid mask be used here instead of\r\n    ** the notReady mask.  When computing an \"optimal\" index, the notReady\r\n    ** mask will only have one bit set - the bit for the current table.\r\n    ** The notValid mask, on the other hand, always has all bits set for\r\n    ** tables that are not in outer loops.  If notReady is used here instead\r\n    ** of notValid, then a optimal index that depends on inner joins loops\r\n    ** might be selected even when there exists an optimal index that has\r\n    ** no such dependency.\r\n    */\r\n    if( nRow>2 && cost<=pCost->rCost ){\r\n      int k;                       /* Loop counter */\r\n      int nSkipEq = nEq;           /* Number of == constraints to skip */\r\n      int nSkipRange = nBound;     /* Number of < constraints to skip */\r\n      Bitmask thisTab;             /* Bitmap for pSrc */\r\n\r\n      thisTab = getMask(pWC->pMaskSet, iCur);\r\n      for(pTerm=pWC->a, k=pWC->nTerm; nRow>2 && k; k--, pTerm++){\r\n        if( pTerm->wtFlags & TERM_VIRTUAL ) continue;\r\n        if( (pTerm->prereqAll & notValid)!=thisTab ) continue;\r\n        if( pTerm->eOperator & (WO_EQ|WO_IN|WO_ISNULL) ){\r\n          if( nSkipEq ){\r\n            /* Ignore the first nEq equality matches since the index\r\n            ** has already accounted for these */\r\n            nSkipEq--;\r\n          }else{\r\n            /* Assume each additional equality match reduces the result\r\n            ** set size by a factor of 10 */\r\n            nRow /= 10;\r\n          }\r\n        }else if( pTerm->eOperator & (WO_LT|WO_LE|WO_GT|WO_GE) ){\r\n          if( nSkipRange ){\r\n            /* Ignore the first nSkipRange range constraints since the index\r\n            ** has already accounted for these */\r\n            nSkipRange--;\r\n          }else{\r\n            /* Assume each additional range constraint reduces the result\r\n            ** set size by a factor of 3.  Indexed range constraints reduce\r\n            ** the search space by a larger factor: 4.  We make indexed range\r\n            ** more selective intentionally because of the subjective \r\n            ** observation that indexed range constraints really are more\r\n            ** selective in practice, on average. */\r\n            nRow /= 3;\r\n          }\r\n        }else if( pTerm->eOperator!=WO_NOOP ){\r\n          /* Any other expression lowers the output row count by half */\r\n          nRow /= 2;\r\n        }\r\n      }\r\n      if( nRow<2 ) nRow = 2;\r\n    }\r\n\r\n\r\n    WHERETRACE((\r\n      \"%s(%s): nEq=%d nInMul=%d rangeDiv=%d bSort=%d bLookup=%d wsFlags=0x%x\\n\"\r\n      \"         notReady=0x%llx log10N=%.1f nRow=%.1f cost=%.1f used=0x%llx\\n\",\r\n      pSrc->pTab->zName, (pIdx ? pIdx->zName : \"ipk\"), \r\n      nEq, nInMul, (int)rangeDiv, bSort, bLookup, wsFlags,\r\n      notReady, log10N, nRow, cost, used\r\n    ));\r\n\r\n    /* If this index is the best we have seen so far, then record this\r\n    ** index and its cost in the pCost structure.\r\n    */\r\n    if( (!pIdx || wsFlags)\r\n     && (cost<pCost->rCost || (cost<=pCost->rCost && nRow<pCost->plan.nRow))\r\n    ){\r\n      pCost->rCost = cost;\r\n      pCost->used = used;\r\n      pCost->plan.nRow = nRow;\r\n      pCost->plan.wsFlags = (wsFlags&wsFlagMask);\r\n      pCost->plan.nEq = nEq;\r\n      pCost->plan.u.pIdx = pIdx;\r\n    }\r\n\r\n    /* If there was an INDEXED BY clause, then only that one index is\r\n    ** considered. */\r\n    if( pSrc->pIndex ) break;\r\n\r\n    /* Reset masks for the next index in the loop */\r\n    wsFlagMask = ~(WHERE_ROWID_EQ|WHERE_ROWID_RANGE);\r\n    eqTermMask = idxEqTermMask;\r\n  }\r\n\r\n  /* If there is no ORDER BY clause and the SQLITE_ReverseOrder flag\r\n  ** is set, then reverse the order that the index will be scanned\r\n  ** in. This is used for application testing, to help find cases\r\n  ** where application behaviour depends on the (undefined) order that\r\n  ** SQLite outputs rows in in the absence of an ORDER BY clause.  */\r\n  if( !pOrderBy && pParse->db->flags & SQLITE_ReverseOrder ){\r\n    pCost->plan.wsFlags |= WHERE_REVERSE;\r\n  }\r\n\r\n  assert( pOrderBy || (pCost->plan.wsFlags&WHERE_ORDERBY)==0 );\r\n  assert( pCost->plan.u.pIdx==0 || (pCost->plan.wsFlags&WHERE_ROWID_EQ)==0 );\r\n  assert( pSrc->pIndex==0 \r\n       || pCost->plan.u.pIdx==0 \r\n       || pCost->plan.u.pIdx==pSrc->pIndex \r\n  );\r\n\r\n  WHERETRACE((\"best index is: %s\\n\", \r\n    ((pCost->plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ? \"none\" : \r\n         pCost->plan.u.pIdx ? pCost->plan.u.pIdx->zName : \"ipk\")\r\n  ));\r\n  \r\n  bestOrClauseIndex(pParse, pWC, pSrc, notReady, notValid, pOrderBy, pCost);\r\n  bestAutomaticIndex(pParse, pWC, pSrc, notReady, pCost);\r\n  pCost->plan.wsFlags |= eqTermMask;\r\n}\r\n\r\n/*\r\n** Find the query plan for accessing table pSrc->pTab. Write the\r\n** best query plan and its cost into the WhereCost object supplied \r\n** as the last parameter. This function may calculate the cost of\r\n** both real and virtual table scans.\r\n*/\r\nstatic void bestIndex(\r\n  Parse *pParse,              /* The parsing context */\r\n  WhereClause *pWC,           /* The WHERE clause */\r\n  struct SrcList_item *pSrc,  /* The FROM clause term to search */\r\n  Bitmask notReady,           /* Mask of cursors not available for indexing */\r\n  Bitmask notValid,           /* Cursors not available for any purpose */\r\n  ExprList *pOrderBy,         /* The ORDER BY clause */\r\n  WhereCost *pCost            /* Lowest cost query plan */\r\n){\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if( IsVirtual(pSrc->pTab) ){\r\n    sqlite3_index_info *p = 0;\r\n    bestVirtualIndex(pParse, pWC, pSrc, notReady, notValid, pOrderBy, pCost,&p);\r\n    if( p->needToFreeIdxStr ){\r\n      sqlite3_free(p->idxStr);\r\n    }\r\n    sqlite3DbFree(pParse->db, p);\r\n  }else\r\n#endif\r\n  {\r\n    bestBtreeIndex(pParse, pWC, pSrc, notReady, notValid, pOrderBy, 0, pCost);\r\n  }\r\n}\r\n\r\n/*\r\n** Disable a term in the WHERE clause.  Except, do not disable the term\r\n** if it controls a LEFT OUTER JOIN and it did not originate in the ON\r\n** or USING clause of that join.\r\n**\r\n** Consider the term t2.z='ok' in the following queries:\r\n**\r\n**   (1)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'\r\n**   (2)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'\r\n**   (3)  SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'\r\n**\r\n** The t2.z='ok' is disabled in the in (2) because it originates\r\n** in the ON clause.  The term is disabled in (3) because it is not part\r\n** of a LEFT OUTER JOIN.  In (1), the term is not disabled.\r\n**\r\n** IMPLEMENTATION-OF: R-24597-58655 No tests are done for terms that are\r\n** completely satisfied by indices.\r\n**\r\n** Disabling a term causes that term to not be tested in the inner loop\r\n** of the join.  Disabling is an optimization.  When terms are satisfied\r\n** by indices, we disable them to prevent redundant tests in the inner\r\n** loop.  We would get the correct results if nothing were ever disabled,\r\n** but joins might run a little slower.  The trick is to disable as much\r\n** as we can without disabling too much.  If we disabled in (1), we'd get\r\n** the wrong answer.  See ticket #813.\r\n*/\r\nstatic void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){\r\n  if( pTerm\r\n      && (pTerm->wtFlags & TERM_CODED)==0\r\n      && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))\r\n  ){\r\n    pTerm->wtFlags |= TERM_CODED;\r\n    if( pTerm->iParent>=0 ){\r\n      WhereTerm *pOther = &pTerm->pWC->a[pTerm->iParent];\r\n      if( (--pOther->nChild)==0 ){\r\n        disableTerm(pLevel, pOther);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Code an OP_Affinity opcode to apply the column affinity string zAff\r\n** to the n registers starting at base. \r\n**\r\n** As an optimization, SQLITE_AFF_NONE entries (which are no-ops) at the\r\n** beginning and end of zAff are ignored.  If all entries in zAff are\r\n** SQLITE_AFF_NONE, then no code gets generated.\r\n**\r\n** This routine makes its own copy of zAff so that the caller is free\r\n** to modify zAff after this routine returns.\r\n*/\r\nstatic void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){\r\n  Vdbe *v = pParse->pVdbe;\r\n  if( zAff==0 ){\r\n    assert( pParse->db->mallocFailed );\r\n    return;\r\n  }\r\n  assert( v!=0 );\r\n\r\n  /* Adjust base and n to skip over SQLITE_AFF_NONE entries at the beginning\r\n  ** and end of the affinity string.\r\n  */\r\n  while( n>0 && zAff[0]==SQLITE_AFF_NONE ){\r\n    n--;\r\n    base++;\r\n    zAff++;\r\n  }\r\n  while( n>1 && zAff[n-1]==SQLITE_AFF_NONE ){\r\n    n--;\r\n  }\r\n\r\n  /* Code the OP_Affinity opcode if there is anything left to do. */\r\n  if( n>0 ){\r\n    sqlite3VdbeAddOp2(v, OP_Affinity, base, n);\r\n    sqlite3VdbeChangeP4(v, -1, zAff, n);\r\n    sqlite3ExprCacheAffinityChange(pParse, base, n);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** Generate code for a single equality term of the WHERE clause.  An equality\r\n** term can be either X=expr or X IN (...).   pTerm is the term to be \r\n** coded.\r\n**\r\n** The current value for the constraint is left in register iReg.\r\n**\r\n** For a constraint of the form X=expr, the expression is evaluated and its\r\n** result is left on the stack.  For constraints of the form X IN (...)\r\n** this routine sets up a loop that will iterate over all values of X.\r\n*/\r\nstatic int codeEqualityTerm(\r\n  Parse *pParse,      /* The parsing context */\r\n  WhereTerm *pTerm,   /* The term of the WHERE clause to be coded */\r\n  WhereLevel *pLevel, /* When level of the FROM clause we are working on */\r\n  int iTarget         /* Attempt to leave results in this register */\r\n){\r\n  Expr *pX = pTerm->pExpr;\r\n  Vdbe *v = pParse->pVdbe;\r\n  int iReg;                  /* Register holding results */\r\n\r\n  assert( iTarget>0 );\r\n  if( pX->op==TK_EQ ){\r\n    iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);\r\n  }else if( pX->op==TK_ISNULL ){\r\n    iReg = iTarget;\r\n    sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);\r\n#ifndef SQLITE_OMIT_SUBQUERY\r\n  }else{\r\n    int eType;\r\n    int iTab;\r\n    struct InLoop *pIn;\r\n\r\n    assert( pX->op==TK_IN );\r\n    iReg = iTarget;\r\n    eType = sqlite3FindInIndex(pParse, pX, 0);\r\n    iTab = pX->iTable;\r\n    sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0);\r\n    assert( pLevel->plan.wsFlags & WHERE_IN_ABLE );\r\n    if( pLevel->u.in.nIn==0 ){\r\n      pLevel->addrNxt = sqlite3VdbeMakeLabel(v);\r\n    }\r\n    pLevel->u.in.nIn++;\r\n    pLevel->u.in.aInLoop =\r\n       sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,\r\n                              sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);\r\n    pIn = pLevel->u.in.aInLoop;\r\n    if( pIn ){\r\n      pIn += pLevel->u.in.nIn - 1;\r\n      pIn->iCur = iTab;\r\n      if( eType==IN_INDEX_ROWID ){\r\n        pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);\r\n      }else{\r\n        pIn->addrInTop = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg);\r\n      }\r\n      sqlite3VdbeAddOp1(v, OP_IsNull, iReg);\r\n    }else{\r\n      pLevel->u.in.nIn = 0;\r\n    }\r\n#endif\r\n  }\r\n  disableTerm(pLevel, pTerm);\r\n  return iReg;\r\n}\r\n\r\n/*\r\n** Generate code that will evaluate all == and IN constraints for an\r\n** index.\r\n**\r\n** For example, consider table t1(a,b,c,d,e,f) with index i1(a,b,c).\r\n** Suppose the WHERE clause is this:  a==5 AND b IN (1,2,3) AND c>5 AND c<10\r\n** The index has as many as three equality constraints, but in this\r\n** example, the third \"c\" value is an inequality.  So only two \r\n** constraints are coded.  This routine will generate code to evaluate\r\n** a==5 and b IN (1,2,3).  The current values for a and b will be stored\r\n** in consecutive registers and the index of the first register is returned.\r\n**\r\n** In the example above nEq==2.  But this subroutine works for any value\r\n** of nEq including 0.  If nEq==0, this routine is nearly a no-op.\r\n** The only thing it does is allocate the pLevel->iMem memory cell and\r\n** compute the affinity string.\r\n**\r\n** This routine always allocates at least one memory cell and returns\r\n** the index of that memory cell. The code that\r\n** calls this routine will use that memory cell to store the termination\r\n** key value of the loop.  If one or more IN operators appear, then\r\n** this routine allocates an additional nEq memory cells for internal\r\n** use.\r\n**\r\n** Before returning, *pzAff is set to point to a buffer containing a\r\n** copy of the column affinity string of the index allocated using\r\n** sqlite3DbMalloc(). Except, entries in the copy of the string associated\r\n** with equality constraints that use NONE affinity are set to\r\n** SQLITE_AFF_NONE. This is to deal with SQL such as the following:\r\n**\r\n**   CREATE TABLE t1(a TEXT PRIMARY KEY, b);\r\n**   SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b;\r\n**\r\n** In the example above, the index on t1(a) has TEXT affinity. But since\r\n** the right hand side of the equality constraint (t2.b) has NONE affinity,\r\n** no conversion should be attempted before using a t2.b value as part of\r\n** a key to search the index. Hence the first byte in the returned affinity\r\n** string in this example would be set to SQLITE_AFF_NONE.\r\n*/\r\nstatic int codeAllEqualityTerms(\r\n  Parse *pParse,        /* Parsing context */\r\n  WhereLevel *pLevel,   /* Which nested loop of the FROM we are coding */\r\n  WhereClause *pWC,     /* The WHERE clause */\r\n  Bitmask notReady,     /* Which parts of FROM have not yet been coded */\r\n  int nExtraReg,        /* Number of extra registers to allocate */\r\n  char **pzAff          /* OUT: Set to point to affinity string */\r\n){\r\n  int nEq = pLevel->plan.nEq;   /* The number of == or IN constraints to code */\r\n  Vdbe *v = pParse->pVdbe;      /* The vm under construction */\r\n  Index *pIdx;                  /* The index being used for this loop */\r\n  int iCur = pLevel->iTabCur;   /* The cursor of the table */\r\n  WhereTerm *pTerm;             /* A single constraint term */\r\n  int j;                        /* Loop counter */\r\n  int regBase;                  /* Base register */\r\n  int nReg;                     /* Number of registers to allocate */\r\n  char *zAff;                   /* Affinity string to return */\r\n\r\n  /* This module is only called on query plans that use an index. */\r\n  assert( pLevel->plan.wsFlags & WHERE_INDEXED );\r\n  pIdx = pLevel->plan.u.pIdx;\r\n\r\n  /* Figure out how many memory cells we will need then allocate them.\r\n  */\r\n  regBase = pParse->nMem + 1;\r\n  nReg = pLevel->plan.nEq + nExtraReg;\r\n  pParse->nMem += nReg;\r\n\r\n  zAff = sqlite3DbStrDup(pParse->db, sqlite3IndexAffinityStr(v, pIdx));\r\n  if( !zAff ){\r\n    pParse->db->mallocFailed = 1;\r\n  }\r\n\r\n  /* Evaluate the equality constraints\r\n  */\r\n  assert( pIdx->nColumn>=nEq );\r\n  for(j=0; j<nEq; j++){\r\n    int r1;\r\n    int k = pIdx->aiColumn[j];\r\n    pTerm = findTerm(pWC, iCur, k, notReady, pLevel->plan.wsFlags, pIdx);\r\n    if( NEVER(pTerm==0) ) break;\r\n    /* The following true for indices with redundant columns. \r\n    ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */\r\n    testcase( (pTerm->wtFlags & TERM_CODED)!=0 );\r\n    testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */\r\n    r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);\r\n    if( r1!=regBase+j ){\r\n      if( nReg==1 ){\r\n        sqlite3ReleaseTempReg(pParse, regBase);\r\n        regBase = r1;\r\n      }else{\r\n        sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);\r\n      }\r\n    }\r\n    testcase( pTerm->eOperator & WO_ISNULL );\r\n    testcase( pTerm->eOperator & WO_IN );\r\n    if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){\r\n      Expr *pRight = pTerm->pExpr->pRight;\r\n      sqlite3ExprCodeIsNullJump(v, pRight, regBase+j, pLevel->addrBrk);\r\n      if( zAff ){\r\n        if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_NONE ){\r\n          zAff[j] = SQLITE_AFF_NONE;\r\n        }\r\n        if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){\r\n          zAff[j] = SQLITE_AFF_NONE;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  *pzAff = zAff;\r\n  return regBase;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n/*\r\n** This routine is a helper for explainIndexRange() below\r\n**\r\n** pStr holds the text of an expression that we are building up one term\r\n** at a time.  This routine adds a new term to the end of the expression.\r\n** Terms are separated by AND so add the \"AND\" text for second and subsequent\r\n** terms only.\r\n*/\r\nstatic void explainAppendTerm(\r\n  StrAccum *pStr,             /* The text expression being built */\r\n  int iTerm,                  /* Index of this term.  First is zero */\r\n  const char *zColumn,        /* Name of the column */\r\n  const char *zOp             /* Name of the operator */\r\n){\r\n  if( iTerm ) sqlite3StrAccumAppend(pStr, \" AND \", 5);\r\n  sqlite3StrAccumAppend(pStr, zColumn, -1);\r\n  sqlite3StrAccumAppend(pStr, zOp, 1);\r\n  sqlite3StrAccumAppend(pStr, \"?\", 1);\r\n}\r\n\r\n/*\r\n** Argument pLevel describes a strategy for scanning table pTab. This \r\n** function returns a pointer to a string buffer containing a description\r\n** of the subset of table rows scanned by the strategy in the form of an\r\n** SQL expression. Or, if all rows are scanned, NULL is returned.\r\n**\r\n** For example, if the query:\r\n**\r\n**   SELECT * FROM t1 WHERE a=1 AND b>2;\r\n**\r\n** is run and there is an index on (a, b), then this function returns a\r\n** string similar to:\r\n**\r\n**   \"a=? AND b>?\"\r\n**\r\n** The returned pointer points to memory obtained from sqlite3DbMalloc().\r\n** It is the responsibility of the caller to free the buffer when it is\r\n** no longer required.\r\n*/\r\nstatic char *explainIndexRange(sqlite3 *db, WhereLevel *pLevel, Table *pTab){\r\n  WherePlan *pPlan = &pLevel->plan;\r\n  Index *pIndex = pPlan->u.pIdx;\r\n  int nEq = pPlan->nEq;\r\n  int i, j;\r\n  Column *aCol = pTab->aCol;\r\n  int *aiColumn = pIndex->aiColumn;\r\n  StrAccum txt;\r\n\r\n  if( nEq==0 && (pPlan->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ){\r\n    return 0;\r\n  }\r\n  sqlite3StrAccumInit(&txt, 0, 0, SQLITE_MAX_LENGTH);\r\n  txt.db = db;\r\n  sqlite3StrAccumAppend(&txt, \" (\", 2);\r\n  for(i=0; i<nEq; i++){\r\n    explainAppendTerm(&txt, i, aCol[aiColumn[i]].zName, \"=\");\r\n  }\r\n\r\n  j = i;\r\n  if( pPlan->wsFlags&WHERE_BTM_LIMIT ){\r\n    char *z = (j==pIndex->nColumn ) ? \"rowid\" : aCol[aiColumn[j]].zName;\r\n    explainAppendTerm(&txt, i++, z, \">\");\r\n  }\r\n  if( pPlan->wsFlags&WHERE_TOP_LIMIT ){\r\n    char *z = (j==pIndex->nColumn ) ? \"rowid\" : aCol[aiColumn[j]].zName;\r\n    explainAppendTerm(&txt, i, z, \"<\");\r\n  }\r\n  sqlite3StrAccumAppend(&txt, \")\", 1);\r\n  return sqlite3StrAccumFinish(&txt);\r\n}\r\n\r\n/*\r\n** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN\r\n** command. If the query being compiled is an EXPLAIN QUERY PLAN, a single\r\n** record is added to the output to describe the table scan strategy in \r\n** pLevel.\r\n*/\r\nstatic void explainOneScan(\r\n  Parse *pParse,                  /* Parse context */\r\n  SrcList *pTabList,              /* Table list this loop refers to */\r\n  WhereLevel *pLevel,             /* Scan to write OP_Explain opcode for */\r\n  int iLevel,                     /* Value for \"level\" column of output */\r\n  int iFrom,                      /* Value for \"from\" column of output */\r\n  u16 wctrlFlags                  /* Flags passed to sqlite3WhereBegin() */\r\n){\r\n  if( pParse->explain==2 ){\r\n    u32 flags = pLevel->plan.wsFlags;\r\n    struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];\r\n    Vdbe *v = pParse->pVdbe;      /* VM being constructed */\r\n    sqlite3 *db = pParse->db;     /* Database handle */\r\n    char *zMsg;                   /* Text to add to EQP output */\r\n    sqlite3_int64 nRow;           /* Expected number of rows visited by scan */\r\n    int iId = pParse->iSelectId;  /* Select id (left-most output column) */\r\n    int isSearch;                 /* True for a SEARCH. False for SCAN. */\r\n\r\n    if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return;\r\n\r\n    isSearch = (pLevel->plan.nEq>0)\r\n             || (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0\r\n             || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));\r\n\r\n    zMsg = sqlite3MPrintf(db, \"%s\", isSearch?\"SEARCH\":\"SCAN\");\r\n    if( pItem->pSelect ){\r\n      zMsg = sqlite3MAppendf(db, zMsg, \"%s SUBQUERY %d\", zMsg,pItem->iSelectId);\r\n    }else{\r\n      zMsg = sqlite3MAppendf(db, zMsg, \"%s TABLE %s\", zMsg, pItem->zName);\r\n    }\r\n\r\n    if( pItem->zAlias ){\r\n      zMsg = sqlite3MAppendf(db, zMsg, \"%s AS %s\", zMsg, pItem->zAlias);\r\n    }\r\n    if( (flags & WHERE_INDEXED)!=0 ){\r\n      char *zWhere = explainIndexRange(db, pLevel, pItem->pTab);\r\n      zMsg = sqlite3MAppendf(db, zMsg, \"%s USING %s%sINDEX%s%s%s\", zMsg, \r\n          ((flags & WHERE_TEMP_INDEX)?\"AUTOMATIC \":\"\"),\r\n          ((flags & WHERE_IDX_ONLY)?\"COVERING \":\"\"),\r\n          ((flags & WHERE_TEMP_INDEX)?\"\":\" \"),\r\n          ((flags & WHERE_TEMP_INDEX)?\"\": pLevel->plan.u.pIdx->zName),\r\n          zWhere\r\n      );\r\n      sqlite3DbFree(db, zWhere);\r\n    }else if( flags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){\r\n      zMsg = sqlite3MAppendf(db, zMsg, \"%s USING INTEGER PRIMARY KEY\", zMsg);\r\n\r\n      if( flags&WHERE_ROWID_EQ ){\r\n        zMsg = sqlite3MAppendf(db, zMsg, \"%s (rowid=?)\", zMsg);\r\n      }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){\r\n        zMsg = sqlite3MAppendf(db, zMsg, \"%s (rowid>? AND rowid<?)\", zMsg);\r\n      }else if( flags&WHERE_BTM_LIMIT ){\r\n        zMsg = sqlite3MAppendf(db, zMsg, \"%s (rowid>?)\", zMsg);\r\n      }else if( flags&WHERE_TOP_LIMIT ){\r\n        zMsg = sqlite3MAppendf(db, zMsg, \"%s (rowid<?)\", zMsg);\r\n      }\r\n    }\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    else if( (flags & WHERE_VIRTUALTABLE)!=0 ){\r\n      sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;\r\n      zMsg = sqlite3MAppendf(db, zMsg, \"%s VIRTUAL TABLE INDEX %d:%s\", zMsg,\r\n                  pVtabIdx->idxNum, pVtabIdx->idxStr);\r\n    }\r\n#endif\r\n    if( wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX) ){\r\n      testcase( wctrlFlags & WHERE_ORDERBY_MIN );\r\n      nRow = 1;\r\n    }else{\r\n      nRow = (sqlite3_int64)pLevel->plan.nRow;\r\n    }\r\n    zMsg = sqlite3MAppendf(db, zMsg, \"%s (~%lld rows)\", zMsg, nRow);\r\n    sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg, P4_DYNAMIC);\r\n  }\r\n}\r\n#else\r\n# define explainOneScan(u,v,w,x,y,z)\r\n#endif /* SQLITE_OMIT_EXPLAIN */\r\n\r\n\r\n/*\r\n** Generate code for the start of the iLevel-th loop in the WHERE clause\r\n** implementation described by pWInfo.\r\n*/\r\nstatic Bitmask codeOneLoopStart(\r\n  WhereInfo *pWInfo,   /* Complete information about the WHERE clause */\r\n  int iLevel,          /* Which level of pWInfo->a[] should be coded */\r\n  u16 wctrlFlags,      /* One of the WHERE_* flags defined in sqliteInt.h */\r\n  Bitmask notReady     /* Which tables are currently available */\r\n){\r\n  int j, k;            /* Loop counters */\r\n  int iCur;            /* The VDBE cursor for the table */\r\n  int addrNxt;         /* Where to jump to continue with the next IN case */\r\n  int omitTable;       /* True if we use the index only */\r\n  int bRev;            /* True if we need to scan in reverse order */\r\n  WhereLevel *pLevel;  /* The where level to be coded */\r\n  WhereClause *pWC;    /* Decomposition of the entire WHERE clause */\r\n  WhereTerm *pTerm;               /* A WHERE clause term */\r\n  Parse *pParse;                  /* Parsing context */\r\n  Vdbe *v;                        /* The prepared stmt under constructions */\r\n  struct SrcList_item *pTabItem;  /* FROM clause term being coded */\r\n  int addrBrk;                    /* Jump here to break out of the loop */\r\n  int addrCont;                   /* Jump here to continue with next cycle */\r\n  int iRowidReg = 0;        /* Rowid is stored in this register, if not zero */\r\n  int iReleaseReg = 0;      /* Temp register to free before returning */\r\n\r\n  pParse = pWInfo->pParse;\r\n  v = pParse->pVdbe;\r\n  pWC = pWInfo->pWC;\r\n  pLevel = &pWInfo->a[iLevel];\r\n  pTabItem = &pWInfo->pTabList->a[pLevel->iFrom];\r\n  iCur = pTabItem->iCursor;\r\n  bRev = (pLevel->plan.wsFlags & WHERE_REVERSE)!=0;\r\n  omitTable = (pLevel->plan.wsFlags & WHERE_IDX_ONLY)!=0 \r\n           && (wctrlFlags & WHERE_FORCE_TABLE)==0;\r\n\r\n  /* Create labels for the \"break\" and \"continue\" instructions\r\n  ** for the current loop.  Jump to addrBrk to break out of a loop.\r\n  ** Jump to cont to go immediately to the next iteration of the\r\n  ** loop.\r\n  **\r\n  ** When there is an IN operator, we also have a \"addrNxt\" label that\r\n  ** means to continue with the next IN value combination.  When\r\n  ** there are no IN operators in the constraints, the \"addrNxt\" label\r\n  ** is the same as \"addrBrk\".\r\n  */\r\n  addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v);\r\n  addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v);\r\n\r\n  /* If this is the right table of a LEFT OUTER JOIN, allocate and\r\n  ** initialize a memory cell that records if this table matches any\r\n  ** row of the left table of the join.\r\n  */\r\n  if( pLevel->iFrom>0 && (pTabItem[0].jointype & JT_LEFT)!=0 ){\r\n    pLevel->iLeftJoin = ++pParse->nMem;\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);\r\n    VdbeComment((v, \"init LEFT JOIN no-match flag\"));\r\n  }\r\n\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  if(  (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){\r\n    /* Case 0:  The table is a virtual-table.  Use the VFilter and VNext\r\n    **          to access the data.\r\n    */\r\n    int iReg;   /* P3 Value for OP_VFilter */\r\n    sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;\r\n    int nConstraint = pVtabIdx->nConstraint;\r\n    struct sqlite3_index_constraint_usage *aUsage =\r\n                                                pVtabIdx->aConstraintUsage;\r\n    const struct sqlite3_index_constraint *aConstraint =\r\n                                                pVtabIdx->aConstraint;\r\n\r\n    sqlite3ExprCachePush(pParse);\r\n    iReg = sqlite3GetTempRange(pParse, nConstraint+2);\r\n    for(j=1; j<=nConstraint; j++){\r\n      for(k=0; k<nConstraint; k++){\r\n        if( aUsage[k].argvIndex==j ){\r\n          int iTerm = aConstraint[k].iTermOffset;\r\n          sqlite3ExprCode(pParse, pWC->a[iTerm].pExpr->pRight, iReg+j+1);\r\n          break;\r\n        }\r\n      }\r\n      if( k==nConstraint ) break;\r\n    }\r\n    sqlite3VdbeAddOp2(v, OP_Integer, pVtabIdx->idxNum, iReg);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1);\r\n    sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrBrk, iReg, pVtabIdx->idxStr,\r\n                      pVtabIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC);\r\n    pVtabIdx->needToFreeIdxStr = 0;\r\n    for(j=0; j<nConstraint; j++){\r\n      if( aUsage[j].omit ){\r\n        int iTerm = aConstraint[j].iTermOffset;\r\n        disableTerm(pLevel, &pWC->a[iTerm]);\r\n      }\r\n    }\r\n    pLevel->op = OP_VNext;\r\n    pLevel->p1 = iCur;\r\n    pLevel->p2 = sqlite3VdbeCurrentAddr(v);\r\n    sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);\r\n    sqlite3ExprCachePop(pParse, 1);\r\n  }else\r\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\r\n\r\n  if( pLevel->plan.wsFlags & WHERE_ROWID_EQ ){\r\n    /* Case 1:  We can directly reference a single row using an\r\n    **          equality comparison against the ROWID field.  Or\r\n    **          we reference multiple rows using a \"rowid IN (...)\"\r\n    **          construct.\r\n    */\r\n    iReleaseReg = sqlite3GetTempReg(pParse);\r\n    pTerm = findTerm(pWC, iCur, -1, notReady, WO_EQ|WO_IN, 0);\r\n    assert( pTerm!=0 );\r\n    assert( pTerm->pExpr!=0 );\r\n    assert( pTerm->leftCursor==iCur );\r\n    assert( omitTable==0 );\r\n    testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */\r\n    iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg);\r\n    addrNxt = pLevel->addrNxt;\r\n    sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt);\r\n    sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg);\r\n    sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);\r\n    VdbeComment((v, \"pk\"));\r\n    pLevel->op = OP_Noop;\r\n  }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){\r\n    /* Case 2:  We have an inequality comparison against the ROWID field.\r\n    */\r\n    int testOp = OP_Noop;\r\n    int start;\r\n    int memEndValue = 0;\r\n    WhereTerm *pStart, *pEnd;\r\n\r\n    assert( omitTable==0 );\r\n    pStart = findTerm(pWC, iCur, -1, notReady, WO_GT|WO_GE, 0);\r\n    pEnd = findTerm(pWC, iCur, -1, notReady, WO_LT|WO_LE, 0);\r\n    if( bRev ){\r\n      pTerm = pStart;\r\n      pStart = pEnd;\r\n      pEnd = pTerm;\r\n    }\r\n    if( pStart ){\r\n      Expr *pX;             /* The expression that defines the start bound */\r\n      int r1, rTemp;        /* Registers for holding the start boundary */\r\n\r\n      /* The following constant maps TK_xx codes into corresponding \r\n      ** seek opcodes.  It depends on a particular ordering of TK_xx\r\n      */\r\n      const u8 aMoveOp[] = {\r\n           /* TK_GT */  OP_SeekGt,\r\n           /* TK_LE */  OP_SeekLe,\r\n           /* TK_LT */  OP_SeekLt,\r\n           /* TK_GE */  OP_SeekGe\r\n      };\r\n      assert( TK_LE==TK_GT+1 );      /* Make sure the ordering.. */\r\n      assert( TK_LT==TK_GT+2 );      /*  ... of the TK_xx values... */\r\n      assert( TK_GE==TK_GT+3 );      /*  ... is correcct. */\r\n\r\n      testcase( pStart->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */\r\n      pX = pStart->pExpr;\r\n      assert( pX!=0 );\r\n      assert( pStart->leftCursor==iCur );\r\n      r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp);\r\n      sqlite3VdbeAddOp3(v, aMoveOp[pX->op-TK_GT], iCur, addrBrk, r1);\r\n      VdbeComment((v, \"pk\"));\r\n      sqlite3ExprCacheAffinityChange(pParse, r1, 1);\r\n      sqlite3ReleaseTempReg(pParse, rTemp);\r\n      disableTerm(pLevel, pStart);\r\n    }else{\r\n      sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk);\r\n    }\r\n    if( pEnd ){\r\n      Expr *pX;\r\n      pX = pEnd->pExpr;\r\n      assert( pX!=0 );\r\n      assert( pEnd->leftCursor==iCur );\r\n      testcase( pEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */\r\n      memEndValue = ++pParse->nMem;\r\n      sqlite3ExprCode(pParse, pX->pRight, memEndValue);\r\n      if( pX->op==TK_LT || pX->op==TK_GT ){\r\n        testOp = bRev ? OP_Le : OP_Ge;\r\n      }else{\r\n        testOp = bRev ? OP_Lt : OP_Gt;\r\n      }\r\n      disableTerm(pLevel, pEnd);\r\n    }\r\n    start = sqlite3VdbeCurrentAddr(v);\r\n    pLevel->op = bRev ? OP_Prev : OP_Next;\r\n    pLevel->p1 = iCur;\r\n    pLevel->p2 = start;\r\n    if( pStart==0 && pEnd==0 ){\r\n      pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;\r\n    }else{\r\n      assert( pLevel->p5==0 );\r\n    }\r\n    if( testOp!=OP_Noop ){\r\n      iRowidReg = iReleaseReg = sqlite3GetTempReg(pParse);\r\n      sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg);\r\n      sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);\r\n      sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg);\r\n      sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL);\r\n    }\r\n  }else if( pLevel->plan.wsFlags & (WHERE_COLUMN_RANGE|WHERE_COLUMN_EQ) ){\r\n    /* Case 3: A scan using an index.\r\n    **\r\n    **         The WHERE clause may contain zero or more equality \r\n    **         terms (\"==\" or \"IN\" operators) that refer to the N\r\n    **         left-most columns of the index. It may also contain\r\n    **         inequality constraints (>, <, >= or <=) on the indexed\r\n    **         column that immediately follows the N equalities. Only \r\n    **         the right-most column can be an inequality - the rest must\r\n    **         use the \"==\" and \"IN\" operators. For example, if the \r\n    **         index is on (x,y,z), then the following clauses are all \r\n    **         optimized:\r\n    **\r\n    **            x=5\r\n    **            x=5 AND y=10\r\n    **            x=5 AND y<10\r\n    **            x=5 AND y>5 AND y<10\r\n    **            x=5 AND y=5 AND z<=10\r\n    **\r\n    **         The z<10 term of the following cannot be used, only\r\n    **         the x=5 term:\r\n    **\r\n    **            x=5 AND z<10\r\n    **\r\n    **         N may be zero if there are inequality constraints.\r\n    **         If there are no inequality constraints, then N is at\r\n    **         least one.\r\n    **\r\n    **         This case is also used when there are no WHERE clause\r\n    **         constraints but an index is selected anyway, in order\r\n    **         to force the output order to conform to an ORDER BY.\r\n    */  \r\n    static const u8 aStartOp[] = {\r\n      0,\r\n      0,\r\n      OP_Rewind,           /* 2: (!start_constraints && startEq &&  !bRev) */\r\n      OP_Last,             /* 3: (!start_constraints && startEq &&   bRev) */\r\n      OP_SeekGt,           /* 4: (start_constraints  && !startEq && !bRev) */\r\n      OP_SeekLt,           /* 5: (start_constraints  && !startEq &&  bRev) */\r\n      OP_SeekGe,           /* 6: (start_constraints  &&  startEq && !bRev) */\r\n      OP_SeekLe            /* 7: (start_constraints  &&  startEq &&  bRev) */\r\n    };\r\n    static const u8 aEndOp[] = {\r\n      OP_Noop,             /* 0: (!end_constraints) */\r\n      OP_IdxGE,            /* 1: (end_constraints && !bRev) */\r\n      OP_IdxLT             /* 2: (end_constraints && bRev) */\r\n    };\r\n    int nEq = pLevel->plan.nEq;  /* Number of == or IN terms */\r\n    int isMinQuery = 0;          /* If this is an optimized SELECT min(x).. */\r\n    int regBase;                 /* Base register holding constraint values */\r\n    int r1;                      /* Temp register */\r\n    WhereTerm *pRangeStart = 0;  /* Inequality constraint at range start */\r\n    WhereTerm *pRangeEnd = 0;    /* Inequality constraint at range end */\r\n    int startEq;                 /* True if range start uses ==, >= or <= */\r\n    int endEq;                   /* True if range end uses ==, >= or <= */\r\n    int start_constraints;       /* Start of range is constrained */\r\n    int nConstraint;             /* Number of constraint terms */\r\n    Index *pIdx;                 /* The index we will be using */\r\n    int iIdxCur;                 /* The VDBE cursor for the index */\r\n    int nExtraReg = 0;           /* Number of extra registers needed */\r\n    int op;                      /* Instruction opcode */\r\n    char *zStartAff;             /* Affinity for start of range constraint */\r\n    char *zEndAff;               /* Affinity for end of range constraint */\r\n\r\n    pIdx = pLevel->plan.u.pIdx;\r\n    iIdxCur = pLevel->iIdxCur;\r\n    k = (nEq==pIdx->nColumn ? -1 : pIdx->aiColumn[nEq]);\r\n\r\n    /* If this loop satisfies a sort order (pOrderBy) request that \r\n    ** was passed to this function to implement a \"SELECT min(x) ...\" \r\n    ** query, then the caller will only allow the loop to run for\r\n    ** a single iteration. This means that the first row returned\r\n    ** should not have a NULL value stored in 'x'. If column 'x' is\r\n    ** the first one after the nEq equality constraints in the index,\r\n    ** this requires some special handling.\r\n    */\r\n    if( (wctrlFlags&WHERE_ORDERBY_MIN)!=0\r\n     && (pLevel->plan.wsFlags&WHERE_ORDERBY)\r\n     && (pIdx->nColumn>nEq)\r\n    ){\r\n      /* assert( pOrderBy->nExpr==1 ); */\r\n      /* assert( pOrderBy->a[0].pExpr->iColumn==pIdx->aiColumn[nEq] ); */\r\n      isMinQuery = 1;\r\n      nExtraReg = 1;\r\n    }\r\n\r\n    /* Find any inequality constraint terms for the start and end \r\n    ** of the range. \r\n    */\r\n    if( pLevel->plan.wsFlags & WHERE_TOP_LIMIT ){\r\n      pRangeEnd = findTerm(pWC, iCur, k, notReady, (WO_LT|WO_LE), pIdx);\r\n      nExtraReg = 1;\r\n    }\r\n    if( pLevel->plan.wsFlags & WHERE_BTM_LIMIT ){\r\n      pRangeStart = findTerm(pWC, iCur, k, notReady, (WO_GT|WO_GE), pIdx);\r\n      nExtraReg = 1;\r\n    }\r\n\r\n    /* Generate code to evaluate all constraint terms using == or IN\r\n    ** and store the values of those terms in an array of registers\r\n    ** starting at regBase.\r\n    */\r\n    regBase = codeAllEqualityTerms(\r\n        pParse, pLevel, pWC, notReady, nExtraReg, &zStartAff\r\n    );\r\n    zEndAff = sqlite3DbStrDup(pParse->db, zStartAff);\r\n    addrNxt = pLevel->addrNxt;\r\n\r\n    /* If we are doing a reverse order scan on an ascending index, or\r\n    ** a forward order scan on a descending index, interchange the \r\n    ** start and end terms (pRangeStart and pRangeEnd).\r\n    */\r\n    if( (nEq<pIdx->nColumn && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC))\r\n     || (bRev && pIdx->nColumn==nEq)\r\n    ){\r\n      SWAP(WhereTerm *, pRangeEnd, pRangeStart);\r\n    }\r\n\r\n    testcase( pRangeStart && pRangeStart->eOperator & WO_LE );\r\n    testcase( pRangeStart && pRangeStart->eOperator & WO_GE );\r\n    testcase( pRangeEnd && pRangeEnd->eOperator & WO_LE );\r\n    testcase( pRangeEnd && pRangeEnd->eOperator & WO_GE );\r\n    startEq = !pRangeStart || pRangeStart->eOperator & (WO_LE|WO_GE);\r\n    endEq =   !pRangeEnd || pRangeEnd->eOperator & (WO_LE|WO_GE);\r\n    start_constraints = pRangeStart || nEq>0;\r\n\r\n    /* Seek the index cursor to the start of the range. */\r\n    nConstraint = nEq;\r\n    if( pRangeStart ){\r\n      Expr *pRight = pRangeStart->pExpr->pRight;\r\n      sqlite3ExprCode(pParse, pRight, regBase+nEq);\r\n      if( (pRangeStart->wtFlags & TERM_VNULL)==0 ){\r\n        sqlite3ExprCodeIsNullJump(v, pRight, regBase+nEq, addrNxt);\r\n      }\r\n      if( zStartAff ){\r\n        if( sqlite3CompareAffinity(pRight, zStartAff[nEq])==SQLITE_AFF_NONE){\r\n          /* Since the comparison is to be performed with no conversions\r\n          ** applied to the operands, set the affinity to apply to pRight to \r\n          ** SQLITE_AFF_NONE.  */\r\n          zStartAff[nEq] = SQLITE_AFF_NONE;\r\n        }\r\n        if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){\r\n          zStartAff[nEq] = SQLITE_AFF_NONE;\r\n        }\r\n      }  \r\n      nConstraint++;\r\n      testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */\r\n    }else if( isMinQuery ){\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);\r\n      nConstraint++;\r\n      startEq = 0;\r\n      start_constraints = 1;\r\n    }\r\n    codeApplyAffinity(pParse, regBase, nConstraint, zStartAff);\r\n    op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];\r\n    assert( op!=0 );\r\n    testcase( op==OP_Rewind );\r\n    testcase( op==OP_Last );\r\n    testcase( op==OP_SeekGt );\r\n    testcase( op==OP_SeekGe );\r\n    testcase( op==OP_SeekLe );\r\n    testcase( op==OP_SeekLt );\r\n    sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);\r\n\r\n    /* Load the value for the inequality constraint at the end of the\r\n    ** range (if any).\r\n    */\r\n    nConstraint = nEq;\r\n    if( pRangeEnd ){\r\n      Expr *pRight = pRangeEnd->pExpr->pRight;\r\n      sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);\r\n      sqlite3ExprCode(pParse, pRight, regBase+nEq);\r\n      if( (pRangeEnd->wtFlags & TERM_VNULL)==0 ){\r\n        sqlite3ExprCodeIsNullJump(v, pRight, regBase+nEq, addrNxt);\r\n      }\r\n      if( zEndAff ){\r\n        if( sqlite3CompareAffinity(pRight, zEndAff[nEq])==SQLITE_AFF_NONE){\r\n          /* Since the comparison is to be performed with no conversions\r\n          ** applied to the operands, set the affinity to apply to pRight to \r\n          ** SQLITE_AFF_NONE.  */\r\n          zEndAff[nEq] = SQLITE_AFF_NONE;\r\n        }\r\n        if( sqlite3ExprNeedsNoAffinityChange(pRight, zEndAff[nEq]) ){\r\n          zEndAff[nEq] = SQLITE_AFF_NONE;\r\n        }\r\n      }  \r\n      codeApplyAffinity(pParse, regBase, nEq+1, zEndAff);\r\n      nConstraint++;\r\n      testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */\r\n    }\r\n    sqlite3DbFree(pParse->db, zStartAff);\r\n    sqlite3DbFree(pParse->db, zEndAff);\r\n\r\n    /* Top of the loop body */\r\n    pLevel->p2 = sqlite3VdbeCurrentAddr(v);\r\n\r\n    /* Check if the index cursor is past the end of the range. */\r\n    op = aEndOp[(pRangeEnd || nEq) * (1 + bRev)];\r\n    testcase( op==OP_Noop );\r\n    testcase( op==OP_IdxGE );\r\n    testcase( op==OP_IdxLT );\r\n    if( op!=OP_Noop ){\r\n      sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);\r\n      sqlite3VdbeChangeP5(v, endEq!=bRev ?1:0);\r\n    }\r\n\r\n    /* If there are inequality constraints, check that the value\r\n    ** of the table column that the inequality contrains is not NULL.\r\n    ** If it is, jump to the next iteration of the loop.\r\n    */\r\n    r1 = sqlite3GetTempReg(pParse);\r\n    testcase( pLevel->plan.wsFlags & WHERE_BTM_LIMIT );\r\n    testcase( pLevel->plan.wsFlags & WHERE_TOP_LIMIT );\r\n    if( (pLevel->plan.wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 ){\r\n      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1);\r\n      sqlite3VdbeAddOp2(v, OP_IsNull, r1, addrCont);\r\n    }\r\n    sqlite3ReleaseTempReg(pParse, r1);\r\n\r\n    /* Seek the table cursor, if required */\r\n    disableTerm(pLevel, pRangeStart);\r\n    disableTerm(pLevel, pRangeEnd);\r\n    if( !omitTable ){\r\n      iRowidReg = iReleaseReg = sqlite3GetTempReg(pParse);\r\n      sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);\r\n      sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);\r\n      sqlite3VdbeAddOp2(v, OP_Seek, iCur, iRowidReg);  /* Deferred seek */\r\n    }\r\n\r\n    /* Record the instruction used to terminate the loop. Disable \r\n    ** WHERE clause terms made redundant by the index range scan.\r\n    */\r\n    if( pLevel->plan.wsFlags & WHERE_UNIQUE ){\r\n      pLevel->op = OP_Noop;\r\n    }else if( bRev ){\r\n      pLevel->op = OP_Prev;\r\n    }else{\r\n      pLevel->op = OP_Next;\r\n    }\r\n    pLevel->p1 = iIdxCur;\r\n  }else\r\n\r\n#ifndef SQLITE_OMIT_OR_OPTIMIZATION\r\n  if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){\r\n    /* Case 4:  Two or more separately indexed terms connected by OR\r\n    **\r\n    ** Example:\r\n    **\r\n    **   CREATE TABLE t1(a,b,c,d);\r\n    **   CREATE INDEX i1 ON t1(a);\r\n    **   CREATE INDEX i2 ON t1(b);\r\n    **   CREATE INDEX i3 ON t1(c);\r\n    **\r\n    **   SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13)\r\n    **\r\n    ** In the example, there are three indexed terms connected by OR.\r\n    ** The top of the loop looks like this:\r\n    **\r\n    **          Null       1                # Zero the rowset in reg 1\r\n    **\r\n    ** Then, for each indexed term, the following. The arguments to\r\n    ** RowSetTest are such that the rowid of the current row is inserted\r\n    ** into the RowSet. If it is already present, control skips the\r\n    ** Gosub opcode and jumps straight to the code generated by WhereEnd().\r\n    **\r\n    **        sqlite3WhereBegin(<term>)\r\n    **          RowSetTest                  # Insert rowid into rowset\r\n    **          Gosub      2 A\r\n    **        sqlite3WhereEnd()\r\n    **\r\n    ** Following the above, code to terminate the loop. Label A, the target\r\n    ** of the Gosub above, jumps to the instruction right after the Goto.\r\n    **\r\n    **          Null       1                # Zero the rowset in reg 1\r\n    **          Goto       B                # The loop is finished.\r\n    **\r\n    **       A: <loop body>                 # Return data, whatever.\r\n    **\r\n    **          Return     2                # Jump back to the Gosub\r\n    **\r\n    **       B: <after the loop>\r\n    **\r\n    */\r\n    WhereClause *pOrWc;    /* The OR-clause broken out into subterms */\r\n    SrcList *pOrTab;       /* Shortened table list or OR-clause generation */\r\n\r\n    int regReturn = ++pParse->nMem;           /* Register used with OP_Gosub */\r\n    int regRowset = 0;                        /* Register for RowSet object */\r\n    int regRowid = 0;                         /* Register holding rowid */\r\n    int iLoopBody = sqlite3VdbeMakeLabel(v);  /* Start of loop body */\r\n    int iRetInit;                             /* Address of regReturn init */\r\n    int untestedTerms = 0;             /* Some terms not completely tested */\r\n    int ii;                            /* Loop counter */\r\n    Expr *pAndExpr = 0;                /* An \".. AND (...)\" expression */\r\n   \r\n    pTerm = pLevel->plan.u.pTerm;\r\n    assert( pTerm!=0 );\r\n    assert( pTerm->eOperator==WO_OR );\r\n    assert( (pTerm->wtFlags & TERM_ORINFO)!=0 );\r\n    pOrWc = &pTerm->u.pOrInfo->wc;\r\n    pLevel->op = OP_Return;\r\n    pLevel->p1 = regReturn;\r\n\r\n    /* Set up a new SrcList ni pOrTab containing the table being scanned\r\n    ** by this loop in the a[0] slot and all notReady tables in a[1..] slots.\r\n    ** This becomes the SrcList in the recursive call to sqlite3WhereBegin().\r\n    */\r\n    if( pWInfo->nLevel>1 ){\r\n      int nNotReady;                 /* The number of notReady tables */\r\n      struct SrcList_item *origSrc;     /* Original list of tables */\r\n      nNotReady = pWInfo->nLevel - iLevel - 1;\r\n      pOrTab = sqlite3StackAllocRaw(pParse->db,\r\n                            sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));\r\n      if( pOrTab==0 ) return notReady;\r\n      pOrTab->nAlloc = (i16)(nNotReady + 1);\r\n      pOrTab->nSrc = pOrTab->nAlloc;\r\n      memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem));\r\n      origSrc = pWInfo->pTabList->a;\r\n      for(k=1; k<=nNotReady; k++){\r\n        memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k]));\r\n      }\r\n    }else{\r\n      pOrTab = pWInfo->pTabList;\r\n    }\r\n\r\n    /* Initialize the rowset register to contain NULL. An SQL NULL is \r\n    ** equivalent to an empty rowset.\r\n    **\r\n    ** Also initialize regReturn to contain the address of the instruction \r\n    ** immediately following the OP_Return at the bottom of the loop. This\r\n    ** is required in a few obscure LEFT JOIN cases where control jumps\r\n    ** over the top of the loop into the body of it. In this case the \r\n    ** correct response for the end-of-loop code (the OP_Return) is to \r\n    ** fall through to the next instruction, just as an OP_Next does if\r\n    ** called on an uninitialized cursor.\r\n    */\r\n    if( (wctrlFlags & WHERE_DUPLICATES_OK)==0 ){\r\n      regRowset = ++pParse->nMem;\r\n      regRowid = ++pParse->nMem;\r\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regRowset);\r\n    }\r\n    iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn);\r\n\r\n    /* If the original WHERE clause is z of the form:  (x1 OR x2 OR ...) AND y\r\n    ** Then for every term xN, evaluate as the subexpression: xN AND z\r\n    ** That way, terms in y that are factored into the disjunction will\r\n    ** be picked up by the recursive calls to sqlite3WhereBegin() below.\r\n    **\r\n    ** Actually, each subexpression is converted to \"xN AND w\" where w is\r\n    ** the \"interesting\" terms of z - terms that did not originate in the\r\n    ** ON or USING clause of a LEFT JOIN, and terms that are usable as \r\n    ** indices.\r\n    */\r\n    if( pWC->nTerm>1 ){\r\n      int iTerm;\r\n      for(iTerm=0; iTerm<pWC->nTerm; iTerm++){\r\n        Expr *pExpr = pWC->a[iTerm].pExpr;\r\n        if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;\r\n        if( pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_ORINFO) ) continue;\r\n        if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;\r\n        pExpr = sqlite3ExprDup(pParse->db, pExpr, 0);\r\n        pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr);\r\n      }\r\n      if( pAndExpr ){\r\n        pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0);\r\n      }\r\n    }\r\n\r\n    for(ii=0; ii<pOrWc->nTerm; ii++){\r\n      WhereTerm *pOrTerm = &pOrWc->a[ii];\r\n      if( pOrTerm->leftCursor==iCur || pOrTerm->eOperator==WO_AND ){\r\n        WhereInfo *pSubWInfo;          /* Info for single OR-term scan */\r\n        Expr *pOrExpr = pOrTerm->pExpr;\r\n        if( pAndExpr ){\r\n          pAndExpr->pLeft = pOrExpr;\r\n          pOrExpr = pAndExpr;\r\n        }\r\n        /* Loop through table entries that match term pOrTerm. */\r\n        pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,\r\n                        WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY |\r\n                        WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY);\r\n        if( pSubWInfo ){\r\n          explainOneScan(\r\n              pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0\r\n          );\r\n          if( (wctrlFlags & WHERE_DUPLICATES_OK)==0 ){\r\n            int iSet = ((ii==pOrWc->nTerm-1)?-1:ii);\r\n            int r;\r\n            r = sqlite3ExprCodeGetColumn(pParse, pTabItem->pTab, -1, iCur, \r\n                                         regRowid);\r\n            sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset,\r\n                                 sqlite3VdbeCurrentAddr(v)+2, r, iSet);\r\n          }\r\n          sqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody);\r\n\r\n          /* The pSubWInfo->untestedTerms flag means that this OR term\r\n          ** contained one or more AND term from a notReady table.  The\r\n          ** terms from the notReady table could not be tested and will\r\n          ** need to be tested later.\r\n          */\r\n          if( pSubWInfo->untestedTerms ) untestedTerms = 1;\r\n\r\n          /* Finish the loop through table entries that match term pOrTerm. */\r\n          sqlite3WhereEnd(pSubWInfo);\r\n        }\r\n      }\r\n    }\r\n    if( pAndExpr ){\r\n      pAndExpr->pLeft = 0;\r\n      sqlite3ExprDelete(pParse->db, pAndExpr);\r\n    }\r\n    sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v));\r\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk);\r\n    sqlite3VdbeResolveLabel(v, iLoopBody);\r\n\r\n    if( pWInfo->nLevel>1 ) sqlite3StackFree(pParse->db, pOrTab);\r\n    if( !untestedTerms ) disableTerm(pLevel, pTerm);\r\n  }else\r\n#endif /* SQLITE_OMIT_OR_OPTIMIZATION */\r\n\r\n  {\r\n    /* Case 5:  There is no usable index.  We must do a complete\r\n    **          scan of the entire table.\r\n    */\r\n    static const u8 aStep[] = { OP_Next, OP_Prev };\r\n    static const u8 aStart[] = { OP_Rewind, OP_Last };\r\n    assert( bRev==0 || bRev==1 );\r\n    assert( omitTable==0 );\r\n    pLevel->op = aStep[bRev];\r\n    pLevel->p1 = iCur;\r\n    pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);\r\n    pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;\r\n  }\r\n  notReady &= ~getMask(pWC->pMaskSet, iCur);\r\n\r\n  /* Insert code to test every subexpression that can be completely\r\n  ** computed using the current set of tables.\r\n  **\r\n  ** IMPLEMENTATION-OF: R-49525-50935 Terms that cannot be satisfied through\r\n  ** the use of indices become tests that are evaluated against each row of\r\n  ** the relevant input tables.\r\n  */\r\n  for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){\r\n    Expr *pE;\r\n    testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* IMP: R-30575-11662 */\r\n    testcase( pTerm->wtFlags & TERM_CODED );\r\n    if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;\r\n    if( (pTerm->prereqAll & notReady)!=0 ){\r\n      testcase( pWInfo->untestedTerms==0\r\n               && (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 );\r\n      pWInfo->untestedTerms = 1;\r\n      continue;\r\n    }\r\n    pE = pTerm->pExpr;\r\n    assert( pE!=0 );\r\n    if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){\r\n      continue;\r\n    }\r\n    sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);\r\n    pTerm->wtFlags |= TERM_CODED;\r\n  }\r\n\r\n  /* For a LEFT OUTER JOIN, generate code that will record the fact that\r\n  ** at least one row of the right table has matched the left table.  \r\n  */\r\n  if( pLevel->iLeftJoin ){\r\n    pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);\r\n    sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);\r\n    VdbeComment((v, \"record LEFT JOIN hit\"));\r\n    sqlite3ExprCacheClear(pParse);\r\n    for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){\r\n      testcase( pTerm->wtFlags & TERM_VIRTUAL );  /* IMP: R-30575-11662 */\r\n      testcase( pTerm->wtFlags & TERM_CODED );\r\n      if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;\r\n      if( (pTerm->prereqAll & notReady)!=0 ){\r\n        assert( pWInfo->untestedTerms );\r\n        continue;\r\n      }\r\n      assert( pTerm->pExpr );\r\n      sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);\r\n      pTerm->wtFlags |= TERM_CODED;\r\n    }\r\n  }\r\n  sqlite3ReleaseTempReg(pParse, iReleaseReg);\r\n\r\n  return notReady;\r\n}\r\n\r\n#if defined(SQLITE_TEST)\r\n/*\r\n** The following variable holds a text description of query plan generated\r\n** by the most recent call to sqlite3WhereBegin().  Each call to WhereBegin\r\n** overwrites the previous.  This information is used for testing and\r\n** analysis only.\r\n*/\r\nSQLITE_API char sqlite3_query_plan[BMS*2*40];  /* Text of the join */\r\nstatic int nQPlan = 0;              /* Next free slow in _query_plan[] */\r\n\r\n#endif /* SQLITE_TEST */\r\n\r\n\r\n/*\r\n** Free a WhereInfo structure\r\n*/\r\nstatic void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){\r\n  if( ALWAYS(pWInfo) ){\r\n    int i;\r\n    for(i=0; i<pWInfo->nLevel; i++){\r\n      sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;\r\n      if( pInfo ){\r\n        /* assert( pInfo->needToFreeIdxStr==0 || db->mallocFailed ); */\r\n        if( pInfo->needToFreeIdxStr ){\r\n          sqlite3_free(pInfo->idxStr);\r\n        }\r\n        sqlite3DbFree(db, pInfo);\r\n      }\r\n      if( pWInfo->a[i].plan.wsFlags & WHERE_TEMP_INDEX ){\r\n        Index *pIdx = pWInfo->a[i].plan.u.pIdx;\r\n        if( pIdx ){\r\n          sqlite3DbFree(db, pIdx->zColAff);\r\n          sqlite3DbFree(db, pIdx);\r\n        }\r\n      }\r\n    }\r\n    whereClauseClear(pWInfo->pWC);\r\n    sqlite3DbFree(db, pWInfo);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** Generate the beginning of the loop used for WHERE clause processing.\r\n** The return value is a pointer to an opaque structure that contains\r\n** information needed to terminate the loop.  Later, the calling routine\r\n** should invoke sqlite3WhereEnd() with the return value of this function\r\n** in order to complete the WHERE clause processing.\r\n**\r\n** If an error occurs, this routine returns NULL.\r\n**\r\n** The basic idea is to do a nested loop, one loop for each table in\r\n** the FROM clause of a select.  (INSERT and UPDATE statements are the\r\n** same as a SELECT with only a single table in the FROM clause.)  For\r\n** example, if the SQL is this:\r\n**\r\n**       SELECT * FROM t1, t2, t3 WHERE ...;\r\n**\r\n** Then the code generated is conceptually like the following:\r\n**\r\n**      foreach row1 in t1 do       \\    Code generated\r\n**        foreach row2 in t2 do      |-- by sqlite3WhereBegin()\r\n**          foreach row3 in t3 do   /\r\n**            ...\r\n**          end                     \\    Code generated\r\n**        end                        |-- by sqlite3WhereEnd()\r\n**      end                         /\r\n**\r\n** Note that the loops might not be nested in the order in which they\r\n** appear in the FROM clause if a different order is better able to make\r\n** use of indices.  Note also that when the IN operator appears in\r\n** the WHERE clause, it might result in additional nested loops for\r\n** scanning through all values on the right-hand side of the IN.\r\n**\r\n** There are Btree cursors associated with each table.  t1 uses cursor\r\n** number pTabList->a[0].iCursor.  t2 uses the cursor pTabList->a[1].iCursor.\r\n** And so forth.  This routine generates code to open those VDBE cursors\r\n** and sqlite3WhereEnd() generates the code to close them.\r\n**\r\n** The code that sqlite3WhereBegin() generates leaves the cursors named\r\n** in pTabList pointing at their appropriate entries.  The [...] code\r\n** can use OP_Column and OP_Rowid opcodes on these cursors to extract\r\n** data from the various tables of the loop.\r\n**\r\n** If the WHERE clause is empty, the foreach loops must each scan their\r\n** entire tables.  Thus a three-way join is an O(N^3) operation.  But if\r\n** the tables have indices and there are terms in the WHERE clause that\r\n** refer to those indices, a complete table scan can be avoided and the\r\n** code will run much faster.  Most of the work of this routine is checking\r\n** to see if there are indices that can be used to speed up the loop.\r\n**\r\n** Terms of the WHERE clause are also used to limit which rows actually\r\n** make it to the \"...\" in the middle of the loop.  After each \"foreach\",\r\n** terms of the WHERE clause that use only terms in that loop and outer\r\n** loops are evaluated and if false a jump is made around all subsequent\r\n** inner loops (or around the \"...\" if the test occurs within the inner-\r\n** most loop)\r\n**\r\n** OUTER JOINS\r\n**\r\n** An outer join of tables t1 and t2 is conceptally coded as follows:\r\n**\r\n**    foreach row1 in t1 do\r\n**      flag = 0\r\n**      foreach row2 in t2 do\r\n**        start:\r\n**          ...\r\n**          flag = 1\r\n**      end\r\n**      if flag==0 then\r\n**        move the row2 cursor to a null row\r\n**        goto start\r\n**      fi\r\n**    end\r\n**\r\n** ORDER BY CLAUSE PROCESSING\r\n**\r\n** *ppOrderBy is a pointer to the ORDER BY clause of a SELECT statement,\r\n** if there is one.  If there is no ORDER BY clause or if this routine\r\n** is called from an UPDATE or DELETE statement, then ppOrderBy is NULL.\r\n**\r\n** If an index can be used so that the natural output order of the table\r\n** scan is correct for the ORDER BY clause, then that index is used and\r\n** *ppOrderBy is set to NULL.  This is an optimization that prevents an\r\n** unnecessary sort of the result set if an index appropriate for the\r\n** ORDER BY clause already exists.\r\n**\r\n** If the where clause loops cannot be arranged to provide the correct\r\n** output order, then the *ppOrderBy is unchanged.\r\n*/\r\nSQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(\r\n  Parse *pParse,        /* The parser context */\r\n  SrcList *pTabList,    /* A list of all tables to be scanned */\r\n  Expr *pWhere,         /* The WHERE clause */\r\n  ExprList **ppOrderBy, /* An ORDER BY clause, or NULL */\r\n  ExprList *pDistinct,  /* The select-list for DISTINCT queries - or NULL */\r\n  u16 wctrlFlags        /* One of the WHERE_* flags defined in sqliteInt.h */\r\n){\r\n  int i;                     /* Loop counter */\r\n  int nByteWInfo;            /* Num. bytes allocated for WhereInfo struct */\r\n  int nTabList;              /* Number of elements in pTabList */\r\n  WhereInfo *pWInfo;         /* Will become the return value of this function */\r\n  Vdbe *v = pParse->pVdbe;   /* The virtual database engine */\r\n  Bitmask notReady;          /* Cursors that are not yet positioned */\r\n  WhereMaskSet *pMaskSet;    /* The expression mask set */\r\n  WhereClause *pWC;               /* Decomposition of the WHERE clause */\r\n  struct SrcList_item *pTabItem;  /* A single entry from pTabList */\r\n  WhereLevel *pLevel;             /* A single level in the pWInfo list */\r\n  int iFrom;                      /* First unused FROM clause element */\r\n  int andFlags;              /* AND-ed combination of all pWC->a[].wtFlags */\r\n  sqlite3 *db;               /* Database connection */\r\n\r\n  /* The number of tables in the FROM clause is limited by the number of\r\n  ** bits in a Bitmask \r\n  */\r\n  testcase( pTabList->nSrc==BMS );\r\n  if( pTabList->nSrc>BMS ){\r\n    sqlite3ErrorMsg(pParse, \"at most %d tables in a join\", BMS);\r\n    return 0;\r\n  }\r\n\r\n  /* This function normally generates a nested loop for all tables in \r\n  ** pTabList.  But if the WHERE_ONETABLE_ONLY flag is set, then we should\r\n  ** only generate code for the first table in pTabList and assume that\r\n  ** any cursors associated with subsequent tables are uninitialized.\r\n  */\r\n  nTabList = (wctrlFlags & WHERE_ONETABLE_ONLY) ? 1 : pTabList->nSrc;\r\n\r\n  /* Allocate and initialize the WhereInfo structure that will become the\r\n  ** return value. A single allocation is used to store the WhereInfo\r\n  ** struct, the contents of WhereInfo.a[], the WhereClause structure\r\n  ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte\r\n  ** field (type Bitmask) it must be aligned on an 8-byte boundary on\r\n  ** some architectures. Hence the ROUND8() below.\r\n  */\r\n  db = pParse->db;\r\n  nByteWInfo = ROUND8(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel));\r\n  pWInfo = sqlite3DbMallocZero(db, \r\n      nByteWInfo + \r\n      sizeof(WhereClause) +\r\n      sizeof(WhereMaskSet)\r\n  );\r\n  if( db->mallocFailed ){\r\n    sqlite3DbFree(db, pWInfo);\r\n    pWInfo = 0;\r\n    goto whereBeginError;\r\n  }\r\n  pWInfo->nLevel = nTabList;\r\n  pWInfo->pParse = pParse;\r\n  pWInfo->pTabList = pTabList;\r\n  pWInfo->iBreak = sqlite3VdbeMakeLabel(v);\r\n  pWInfo->pWC = pWC = (WhereClause *)&((u8 *)pWInfo)[nByteWInfo];\r\n  pWInfo->wctrlFlags = wctrlFlags;\r\n  pWInfo->savedNQueryLoop = pParse->nQueryLoop;\r\n  pMaskSet = (WhereMaskSet*)&pWC[1];\r\n\r\n  /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via\r\n  ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */\r\n  if( db->flags & SQLITE_DistinctOpt ) pDistinct = 0;\r\n\r\n  /* Split the WHERE clause into separate subexpressions where each\r\n  ** subexpression is separated by an AND operator.\r\n  */\r\n  initMaskSet(pMaskSet);\r\n  whereClauseInit(pWC, pParse, pMaskSet, wctrlFlags);\r\n  sqlite3ExprCodeConstants(pParse, pWhere);\r\n  whereSplit(pWC, pWhere, TK_AND);   /* IMP: R-15842-53296 */\r\n    \r\n  /* Special case: a WHERE clause that is constant.  Evaluate the\r\n  ** expression and either jump over all of the code or fall thru.\r\n  */\r\n  if( pWhere && (nTabList==0 || sqlite3ExprIsConstantNotJoin(pWhere)) ){\r\n    sqlite3ExprIfFalse(pParse, pWhere, pWInfo->iBreak, SQLITE_JUMPIFNULL);\r\n    pWhere = 0;\r\n  }\r\n\r\n  /* Assign a bit from the bitmask to every term in the FROM clause.\r\n  **\r\n  ** When assigning bitmask values to FROM clause cursors, it must be\r\n  ** the case that if X is the bitmask for the N-th FROM clause term then\r\n  ** the bitmask for all FROM clause terms to the left of the N-th term\r\n  ** is (X-1).   An expression from the ON clause of a LEFT JOIN can use\r\n  ** its Expr.iRightJoinTable value to find the bitmask of the right table\r\n  ** of the join.  Subtracting one from the right table bitmask gives a\r\n  ** bitmask for all tables to the left of the join.  Knowing the bitmask\r\n  ** for all tables to the left of a left join is important.  Ticket #3015.\r\n  **\r\n  ** Configure the WhereClause.vmask variable so that bits that correspond\r\n  ** to virtual table cursors are set. This is used to selectively disable \r\n  ** the OR-to-IN transformation in exprAnalyzeOrTerm(). It is not helpful \r\n  ** with virtual tables.\r\n  **\r\n  ** Note that bitmasks are created for all pTabList->nSrc tables in\r\n  ** pTabList, not just the first nTabList tables.  nTabList is normally\r\n  ** equal to pTabList->nSrc but might be shortened to 1 if the\r\n  ** WHERE_ONETABLE_ONLY flag is set.\r\n  */\r\n  assert( pWC->vmask==0 && pMaskSet->n==0 );\r\n  for(i=0; i<pTabList->nSrc; i++){\r\n    createMask(pMaskSet, pTabList->a[i].iCursor);\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    if( ALWAYS(pTabList->a[i].pTab) && IsVirtual(pTabList->a[i].pTab) ){\r\n      pWC->vmask |= ((Bitmask)1 << i);\r\n    }\r\n#endif\r\n  }\r\n#ifndef NDEBUG\r\n  {\r\n    Bitmask toTheLeft = 0;\r\n    for(i=0; i<pTabList->nSrc; i++){\r\n      Bitmask m = getMask(pMaskSet, pTabList->a[i].iCursor);\r\n      assert( (m-1)==toTheLeft );\r\n      toTheLeft |= m;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* Analyze all of the subexpressions.  Note that exprAnalyze() might\r\n  ** add new virtual terms onto the end of the WHERE clause.  We do not\r\n  ** want to analyze these virtual terms, so start analyzing at the end\r\n  ** and work forward so that the added virtual terms are never processed.\r\n  */\r\n  exprAnalyzeAll(pTabList, pWC);\r\n  if( db->mallocFailed ){\r\n    goto whereBeginError;\r\n  }\r\n\r\n  /* Check if the DISTINCT qualifier, if there is one, is redundant. \r\n  ** If it is, then set pDistinct to NULL and WhereInfo.eDistinct to\r\n  ** WHERE_DISTINCT_UNIQUE to tell the caller to ignore the DISTINCT.\r\n  */\r\n  if( pDistinct && isDistinctRedundant(pParse, pTabList, pWC, pDistinct) ){\r\n    pDistinct = 0;\r\n    pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;\r\n  }\r\n\r\n  /* Chose the best index to use for each table in the FROM clause.\r\n  **\r\n  ** This loop fills in the following fields:\r\n  **\r\n  **   pWInfo->a[].pIdx      The index to use for this level of the loop.\r\n  **   pWInfo->a[].wsFlags   WHERE_xxx flags associated with pIdx\r\n  **   pWInfo->a[].nEq       The number of == and IN constraints\r\n  **   pWInfo->a[].iFrom     Which term of the FROM clause is being coded\r\n  **   pWInfo->a[].iTabCur   The VDBE cursor for the database table\r\n  **   pWInfo->a[].iIdxCur   The VDBE cursor for the index\r\n  **   pWInfo->a[].pTerm     When wsFlags==WO_OR, the OR-clause term\r\n  **\r\n  ** This loop also figures out the nesting order of tables in the FROM\r\n  ** clause.\r\n  */\r\n  notReady = ~(Bitmask)0;\r\n  andFlags = ~0;\r\n  WHERETRACE((\"*** Optimizer Start ***\\n\"));\r\n  for(i=iFrom=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){\r\n    WhereCost bestPlan;         /* Most efficient plan seen so far */\r\n    Index *pIdx;                /* Index for FROM table at pTabItem */\r\n    int j;                      /* For looping over FROM tables */\r\n    int bestJ = -1;             /* The value of j */\r\n    Bitmask m;                  /* Bitmask value for j or bestJ */\r\n    int isOptimal;              /* Iterator for optimal/non-optimal search */\r\n    int nUnconstrained;         /* Number tables without INDEXED BY */\r\n    Bitmask notIndexed;         /* Mask of tables that cannot use an index */\r\n\r\n    memset(&bestPlan, 0, sizeof(bestPlan));\r\n    bestPlan.rCost = SQLITE_BIG_DBL;\r\n    WHERETRACE((\"*** Begin search for loop %d ***\\n\", i));\r\n\r\n    /* Loop through the remaining entries in the FROM clause to find the\r\n    ** next nested loop. The loop tests all FROM clause entries\r\n    ** either once or twice. \r\n    **\r\n    ** The first test is always performed if there are two or more entries\r\n    ** remaining and never performed if there is only one FROM clause entry\r\n    ** to choose from.  The first test looks for an \"optimal\" scan.  In\r\n    ** this context an optimal scan is one that uses the same strategy\r\n    ** for the given FROM clause entry as would be selected if the entry\r\n    ** were used as the innermost nested loop.  In other words, a table\r\n    ** is chosen such that the cost of running that table cannot be reduced\r\n    ** by waiting for other tables to run first.  This \"optimal\" test works\r\n    ** by first assuming that the FROM clause is on the inner loop and finding\r\n    ** its query plan, then checking to see if that query plan uses any\r\n    ** other FROM clause terms that are notReady.  If no notReady terms are\r\n    ** used then the \"optimal\" query plan works.\r\n    **\r\n    ** Note that the WhereCost.nRow parameter for an optimal scan might\r\n    ** not be as small as it would be if the table really were the innermost\r\n    ** join.  The nRow value can be reduced by WHERE clause constraints\r\n    ** that do not use indices.  But this nRow reduction only happens if the\r\n    ** table really is the innermost join.  \r\n    **\r\n    ** The second loop iteration is only performed if no optimal scan\r\n    ** strategies were found by the first iteration. This second iteration\r\n    ** is used to search for the lowest cost scan overall.\r\n    **\r\n    ** Previous versions of SQLite performed only the second iteration -\r\n    ** the next outermost loop was always that with the lowest overall\r\n    ** cost. However, this meant that SQLite could select the wrong plan\r\n    ** for scripts such as the following:\r\n    **   \r\n    **   CREATE TABLE t1(a, b); \r\n    **   CREATE TABLE t2(c, d);\r\n    **   SELECT * FROM t2, t1 WHERE t2.rowid = t1.a;\r\n    **\r\n    ** The best strategy is to iterate through table t1 first. However it\r\n    ** is not possible to determine this with a simple greedy algorithm.\r\n    ** Since the cost of a linear scan through table t2 is the same \r\n    ** as the cost of a linear scan through table t1, a simple greedy \r\n    ** algorithm may choose to use t2 for the outer loop, which is a much\r\n    ** costlier approach.\r\n    */\r\n    nUnconstrained = 0;\r\n    notIndexed = 0;\r\n    for(isOptimal=(iFrom<nTabList-1); isOptimal>=0 && bestJ<0; isOptimal--){\r\n      Bitmask mask;             /* Mask of tables not yet ready */\r\n      for(j=iFrom, pTabItem=&pTabList->a[j]; j<nTabList; j++, pTabItem++){\r\n        int doNotReorder;    /* True if this table should not be reordered */\r\n        WhereCost sCost;     /* Cost information from best[Virtual]Index() */\r\n        ExprList *pOrderBy;  /* ORDER BY clause for index to optimize */\r\n        ExprList *pDist;     /* DISTINCT clause for index to optimize */\r\n  \r\n        doNotReorder =  (pTabItem->jointype & (JT_LEFT|JT_CROSS))!=0;\r\n        if( j!=iFrom && doNotReorder ) break;\r\n        m = getMask(pMaskSet, pTabItem->iCursor);\r\n        if( (m & notReady)==0 ){\r\n          if( j==iFrom ) iFrom++;\r\n          continue;\r\n        }\r\n        mask = (isOptimal ? m : notReady);\r\n        pOrderBy = ((i==0 && ppOrderBy )?*ppOrderBy:0);\r\n        pDist = (i==0 ? pDistinct : 0);\r\n        if( pTabItem->pIndex==0 ) nUnconstrained++;\r\n  \r\n        WHERETRACE((\"=== trying table %d with isOptimal=%d ===\\n\",\r\n                    j, isOptimal));\r\n        assert( pTabItem->pTab );\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n        if( IsVirtual(pTabItem->pTab) ){\r\n          sqlite3_index_info **pp = &pWInfo->a[j].pIdxInfo;\r\n          bestVirtualIndex(pParse, pWC, pTabItem, mask, notReady, pOrderBy,\r\n                           &sCost, pp);\r\n        }else \r\n#endif\r\n        {\r\n          bestBtreeIndex(pParse, pWC, pTabItem, mask, notReady, pOrderBy,\r\n              pDist, &sCost);\r\n        }\r\n        assert( isOptimal || (sCost.used&notReady)==0 );\r\n\r\n        /* If an INDEXED BY clause is present, then the plan must use that\r\n        ** index if it uses any index at all */\r\n        assert( pTabItem->pIndex==0 \r\n                  || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0\r\n                  || sCost.plan.u.pIdx==pTabItem->pIndex );\r\n\r\n        if( isOptimal && (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ){\r\n          notIndexed |= m;\r\n        }\r\n\r\n        /* Conditions under which this table becomes the best so far:\r\n        **\r\n        **   (1) The table must not depend on other tables that have not\r\n        **       yet run.\r\n        **\r\n        **   (2) A full-table-scan plan cannot supercede indexed plan unless\r\n        **       the full-table-scan is an \"optimal\" plan as defined above.\r\n        **\r\n        **   (3) All tables have an INDEXED BY clause or this table lacks an\r\n        **       INDEXED BY clause or this table uses the specific\r\n        **       index specified by its INDEXED BY clause.  This rule ensures\r\n        **       that a best-so-far is always selected even if an impossible\r\n        **       combination of INDEXED BY clauses are given.  The error\r\n        **       will be detected and relayed back to the application later.\r\n        **       The NEVER() comes about because rule (2) above prevents\r\n        **       An indexable full-table-scan from reaching rule (3).\r\n        **\r\n        **   (4) The plan cost must be lower than prior plans or else the\r\n        **       cost must be the same and the number of rows must be lower.\r\n        */\r\n        if( (sCost.used&notReady)==0                       /* (1) */\r\n            && (bestJ<0 || (notIndexed&m)!=0               /* (2) */\r\n                || (bestPlan.plan.wsFlags & WHERE_NOT_FULLSCAN)==0\r\n                || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0)\r\n            && (nUnconstrained==0 || pTabItem->pIndex==0   /* (3) */\r\n                || NEVER((sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0))\r\n            && (bestJ<0 || sCost.rCost<bestPlan.rCost      /* (4) */\r\n                || (sCost.rCost<=bestPlan.rCost \r\n                 && sCost.plan.nRow<bestPlan.plan.nRow))\r\n        ){\r\n          WHERETRACE((\"=== table %d is best so far\"\r\n                      \" with cost=%g and nRow=%g\\n\",\r\n                      j, sCost.rCost, sCost.plan.nRow));\r\n          bestPlan = sCost;\r\n          bestJ = j;\r\n        }\r\n        if( doNotReorder ) break;\r\n      }\r\n    }\r\n    assert( bestJ>=0 );\r\n    assert( notReady & getMask(pMaskSet, pTabList->a[bestJ].iCursor) );\r\n    WHERETRACE((\"*** Optimizer selects table %d for loop %d\"\r\n                \" with cost=%g and nRow=%g\\n\",\r\n                bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow));\r\n    /* The ALWAYS() that follows was added to hush up clang scan-build */\r\n    if( (bestPlan.plan.wsFlags & WHERE_ORDERBY)!=0 && ALWAYS(ppOrderBy) ){\r\n      *ppOrderBy = 0;\r\n    }\r\n    if( (bestPlan.plan.wsFlags & WHERE_DISTINCT)!=0 ){\r\n      assert( pWInfo->eDistinct==0 );\r\n      pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;\r\n    }\r\n    andFlags &= bestPlan.plan.wsFlags;\r\n    pLevel->plan = bestPlan.plan;\r\n    testcase( bestPlan.plan.wsFlags & WHERE_INDEXED );\r\n    testcase( bestPlan.plan.wsFlags & WHERE_TEMP_INDEX );\r\n    if( bestPlan.plan.wsFlags & (WHERE_INDEXED|WHERE_TEMP_INDEX) ){\r\n      pLevel->iIdxCur = pParse->nTab++;\r\n    }else{\r\n      pLevel->iIdxCur = -1;\r\n    }\r\n    notReady &= ~getMask(pMaskSet, pTabList->a[bestJ].iCursor);\r\n    pLevel->iFrom = (u8)bestJ;\r\n    if( bestPlan.plan.nRow>=(double)1 ){\r\n      pParse->nQueryLoop *= bestPlan.plan.nRow;\r\n    }\r\n\r\n    /* Check that if the table scanned by this loop iteration had an\r\n    ** INDEXED BY clause attached to it, that the named index is being\r\n    ** used for the scan. If not, then query compilation has failed.\r\n    ** Return an error.\r\n    */\r\n    pIdx = pTabList->a[bestJ].pIndex;\r\n    if( pIdx ){\r\n      if( (bestPlan.plan.wsFlags & WHERE_INDEXED)==0 ){\r\n        sqlite3ErrorMsg(pParse, \"cannot use index: %s\", pIdx->zName);\r\n        goto whereBeginError;\r\n      }else{\r\n        /* If an INDEXED BY clause is used, the bestIndex() function is\r\n        ** guaranteed to find the index specified in the INDEXED BY clause\r\n        ** if it find an index at all. */\r\n        assert( bestPlan.plan.u.pIdx==pIdx );\r\n      }\r\n    }\r\n  }\r\n  WHERETRACE((\"*** Optimizer Finished ***\\n\"));\r\n  if( pParse->nErr || db->mallocFailed ){\r\n    goto whereBeginError;\r\n  }\r\n\r\n  /* If the total query only selects a single row, then the ORDER BY\r\n  ** clause is irrelevant.\r\n  */\r\n  if( (andFlags & WHERE_UNIQUE)!=0 && ppOrderBy ){\r\n    *ppOrderBy = 0;\r\n  }\r\n\r\n  /* If the caller is an UPDATE or DELETE statement that is requesting\r\n  ** to use a one-pass algorithm, determine if this is appropriate.\r\n  ** The one-pass algorithm only works if the WHERE clause constraints\r\n  ** the statement to update a single row.\r\n  */\r\n  assert( (wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || pWInfo->nLevel==1 );\r\n  if( (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 && (andFlags & WHERE_UNIQUE)!=0 ){\r\n    pWInfo->okOnePass = 1;\r\n    pWInfo->a[0].plan.wsFlags &= ~WHERE_IDX_ONLY;\r\n  }\r\n\r\n  /* Open all tables in the pTabList and any indices selected for\r\n  ** searching those tables.\r\n  */\r\n  sqlite3CodeVerifySchema(pParse, -1); /* Insert the cookie verifier Goto */\r\n  notReady = ~(Bitmask)0;\r\n  pWInfo->nRowOut = (double)1;\r\n  for(i=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){\r\n    Table *pTab;     /* Table to open */\r\n    int iDb;         /* Index of database containing table/index */\r\n\r\n    pTabItem = &pTabList->a[pLevel->iFrom];\r\n    pTab = pTabItem->pTab;\r\n    pLevel->iTabCur = pTabItem->iCursor;\r\n    pWInfo->nRowOut *= pLevel->plan.nRow;\r\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\r\n    if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){\r\n      /* Do nothing */\r\n    }else\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n    if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){\r\n      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);\r\n      int iCur = pTabItem->iCursor;\r\n      sqlite3VdbeAddOp4(v, OP_VOpen, iCur, 0, 0, pVTab, P4_VTAB);\r\n    }else\r\n#endif\r\n    if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0\r\n         && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 ){\r\n      int op = pWInfo->okOnePass ? OP_OpenWrite : OP_OpenRead;\r\n      sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op);\r\n      testcase( pTab->nCol==BMS-1 );\r\n      testcase( pTab->nCol==BMS );\r\n      if( !pWInfo->okOnePass && pTab->nCol<BMS ){\r\n        Bitmask b = pTabItem->colUsed;\r\n        int n = 0;\r\n        for(; b; b=b>>1, n++){}\r\n        sqlite3VdbeChangeP4(v, sqlite3VdbeCurrentAddr(v)-1, \r\n                            SQLITE_INT_TO_PTR(n), P4_INT32);\r\n        assert( n<=pTab->nCol );\r\n      }\r\n    }else{\r\n      sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\r\n    }\r\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\r\n    if( (pLevel->plan.wsFlags & WHERE_TEMP_INDEX)!=0 ){\r\n      constructAutomaticIndex(pParse, pWC, pTabItem, notReady, pLevel);\r\n    }else\r\n#endif\r\n    if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){\r\n      Index *pIx = pLevel->plan.u.pIdx;\r\n      KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIx);\r\n      int iIdxCur = pLevel->iIdxCur;\r\n      assert( pIx->pSchema==pTab->pSchema );\r\n      assert( iIdxCur>=0 );\r\n      sqlite3VdbeAddOp4(v, OP_OpenRead, iIdxCur, pIx->tnum, iDb,\r\n                        (char*)pKey, P4_KEYINFO_HANDOFF);\r\n      VdbeComment((v, \"%s\", pIx->zName));\r\n    }\r\n    sqlite3CodeVerifySchema(pParse, iDb);\r\n    notReady &= ~getMask(pWC->pMaskSet, pTabItem->iCursor);\r\n  }\r\n  pWInfo->iTop = sqlite3VdbeCurrentAddr(v);\r\n  if( db->mallocFailed ) goto whereBeginError;\r\n\r\n  /* Generate the code to do the search.  Each iteration of the for\r\n  ** loop below generates code for a single nested loop of the VM\r\n  ** program.\r\n  */\r\n  notReady = ~(Bitmask)0;\r\n  for(i=0; i<nTabList; i++){\r\n    pLevel = &pWInfo->a[i];\r\n    explainOneScan(pParse, pTabList, pLevel, i, pLevel->iFrom, wctrlFlags);\r\n    notReady = codeOneLoopStart(pWInfo, i, wctrlFlags, notReady);\r\n    pWInfo->iContinue = pLevel->addrCont;\r\n  }\r\n\r\n#ifdef SQLITE_TEST  /* For testing and debugging use only */\r\n  /* Record in the query plan information about the current table\r\n  ** and the index used to access it (if any).  If the table itself\r\n  ** is not used, its name is just '{}'.  If no index is used\r\n  ** the index is listed as \"{}\".  If the primary key is used the\r\n  ** index name is '*'.\r\n  */\r\n  for(i=0; i<nTabList; i++){\r\n    char *z;\r\n    int n;\r\n    pLevel = &pWInfo->a[i];\r\n    pTabItem = &pTabList->a[pLevel->iFrom];\r\n    z = pTabItem->zAlias;\r\n    if( z==0 ) z = pTabItem->pTab->zName;\r\n    n = sqlite3Strlen30(z);\r\n    if( n+nQPlan < sizeof(sqlite3_query_plan)-10 ){\r\n      if( pLevel->plan.wsFlags & WHERE_IDX_ONLY ){\r\n        memcpy(&sqlite3_query_plan[nQPlan], \"{}\", 2);\r\n        nQPlan += 2;\r\n      }else{\r\n        memcpy(&sqlite3_query_plan[nQPlan], z, n);\r\n        nQPlan += n;\r\n      }\r\n      sqlite3_query_plan[nQPlan++] = ' ';\r\n    }\r\n    testcase( pLevel->plan.wsFlags & WHERE_ROWID_EQ );\r\n    testcase( pLevel->plan.wsFlags & WHERE_ROWID_RANGE );\r\n    if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){\r\n      memcpy(&sqlite3_query_plan[nQPlan], \"* \", 2);\r\n      nQPlan += 2;\r\n    }else if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){\r\n      n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName);\r\n      if( n+nQPlan < sizeof(sqlite3_query_plan)-2 ){\r\n        memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n);\r\n        nQPlan += n;\r\n        sqlite3_query_plan[nQPlan++] = ' ';\r\n      }\r\n    }else{\r\n      memcpy(&sqlite3_query_plan[nQPlan], \"{} \", 3);\r\n      nQPlan += 3;\r\n    }\r\n  }\r\n  while( nQPlan>0 && sqlite3_query_plan[nQPlan-1]==' ' ){\r\n    sqlite3_query_plan[--nQPlan] = 0;\r\n  }\r\n  sqlite3_query_plan[nQPlan] = 0;\r\n  nQPlan = 0;\r\n#endif /* SQLITE_TEST // Testing and debugging use only */\r\n\r\n  /* Record the continuation address in the WhereInfo structure.  Then\r\n  ** clean up and return.\r\n  */\r\n  return pWInfo;\r\n\r\n  /* Jump here if malloc fails */\r\nwhereBeginError:\r\n  if( pWInfo ){\r\n    pParse->nQueryLoop = pWInfo->savedNQueryLoop;\r\n    whereInfoFree(db, pWInfo);\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Generate the end of the WHERE loop.  See comments on \r\n** sqlite3WhereBegin() for additional information.\r\n*/\r\nSQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){\r\n  Parse *pParse = pWInfo->pParse;\r\n  Vdbe *v = pParse->pVdbe;\r\n  int i;\r\n  WhereLevel *pLevel;\r\n  SrcList *pTabList = pWInfo->pTabList;\r\n  sqlite3 *db = pParse->db;\r\n\r\n  /* Generate loop termination code.\r\n  */\r\n  sqlite3ExprCacheClear(pParse);\r\n  for(i=pWInfo->nLevel-1; i>=0; i--){\r\n    pLevel = &pWInfo->a[i];\r\n    sqlite3VdbeResolveLabel(v, pLevel->addrCont);\r\n    if( pLevel->op!=OP_Noop ){\r\n      sqlite3VdbeAddOp2(v, pLevel->op, pLevel->p1, pLevel->p2);\r\n      sqlite3VdbeChangeP5(v, pLevel->p5);\r\n    }\r\n    if( pLevel->plan.wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){\r\n      struct InLoop *pIn;\r\n      int j;\r\n      sqlite3VdbeResolveLabel(v, pLevel->addrNxt);\r\n      for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){\r\n        sqlite3VdbeJumpHere(v, pIn->addrInTop+1);\r\n        sqlite3VdbeAddOp2(v, OP_Next, pIn->iCur, pIn->addrInTop);\r\n        sqlite3VdbeJumpHere(v, pIn->addrInTop-1);\r\n      }\r\n      sqlite3DbFree(db, pLevel->u.in.aInLoop);\r\n    }\r\n    sqlite3VdbeResolveLabel(v, pLevel->addrBrk);\r\n    if( pLevel->iLeftJoin ){\r\n      int addr;\r\n      addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin);\r\n      assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0\r\n           || (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 );\r\n      if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 ){\r\n        sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor);\r\n      }\r\n      if( pLevel->iIdxCur>=0 ){\r\n        sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);\r\n      }\r\n      if( pLevel->op==OP_Return ){\r\n        sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);\r\n      }else{\r\n        sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrFirst);\r\n      }\r\n      sqlite3VdbeJumpHere(v, addr);\r\n    }\r\n  }\r\n\r\n  /* The \"break\" point is here, just past the end of the outer loop.\r\n  ** Set it.\r\n  */\r\n  sqlite3VdbeResolveLabel(v, pWInfo->iBreak);\r\n\r\n  /* Close all of the cursors that were opened by sqlite3WhereBegin.\r\n  */\r\n  assert( pWInfo->nLevel==1 || pWInfo->nLevel==pTabList->nSrc );\r\n  for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){\r\n    struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];\r\n    Table *pTab = pTabItem->pTab;\r\n    assert( pTab!=0 );\r\n    if( (pTab->tabFlags & TF_Ephemeral)==0\r\n     && pTab->pSelect==0\r\n     && (pWInfo->wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0\r\n    ){\r\n      int ws = pLevel->plan.wsFlags;\r\n      if( !pWInfo->okOnePass && (ws & WHERE_IDX_ONLY)==0 ){\r\n        sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);\r\n      }\r\n      if( (ws & WHERE_INDEXED)!=0 && (ws & WHERE_TEMP_INDEX)==0 ){\r\n        sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);\r\n      }\r\n    }\r\n\r\n    /* If this scan uses an index, make code substitutions to read data\r\n    ** from the index in preference to the table. Sometimes, this means\r\n    ** the table need never be read from. This is a performance boost,\r\n    ** as the vdbe level waits until the table is read before actually\r\n    ** seeking the table cursor to the record corresponding to the current\r\n    ** position in the index.\r\n    ** \r\n    ** Calls to the code generator in between sqlite3WhereBegin and\r\n    ** sqlite3WhereEnd will have created code that references the table\r\n    ** directly.  This loop scans all that code looking for opcodes\r\n    ** that reference the table and converts them into opcodes that\r\n    ** reference the index.\r\n    */\r\n    if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 && !db->mallocFailed){\r\n      int k, j, last;\r\n      VdbeOp *pOp;\r\n      Index *pIdx = pLevel->plan.u.pIdx;\r\n\r\n      assert( pIdx!=0 );\r\n      pOp = sqlite3VdbeGetOp(v, pWInfo->iTop);\r\n      last = sqlite3VdbeCurrentAddr(v);\r\n      for(k=pWInfo->iTop; k<last; k++, pOp++){\r\n        if( pOp->p1!=pLevel->iTabCur ) continue;\r\n        if( pOp->opcode==OP_Column ){\r\n          for(j=0; j<pIdx->nColumn; j++){\r\n            if( pOp->p2==pIdx->aiColumn[j] ){\r\n              pOp->p2 = j;\r\n              pOp->p1 = pLevel->iIdxCur;\r\n              break;\r\n            }\r\n          }\r\n          assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0\r\n               || j<pIdx->nColumn );\r\n        }else if( pOp->opcode==OP_Rowid ){\r\n          pOp->p1 = pLevel->iIdxCur;\r\n          pOp->opcode = OP_IdxRowid;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Final cleanup\r\n  */\r\n  pParse->nQueryLoop = pWInfo->savedNQueryLoop;\r\n  whereInfoFree(db, pWInfo);\r\n  return;\r\n}\r\n\r\n/************** End of where.c ***********************************************/\r\n/************** Begin file parse.c *******************************************/\r\n/* Driver template for the LEMON parser generator.\r\n** The author disclaims copyright to this source code.\r\n**\r\n** This version of \"lempar.c\" is modified, slightly, for use by SQLite.\r\n** The only modifications are the addition of a couple of NEVER()\r\n** macros to disable tests that are needed in the case of a general\r\n** LALR(1) grammar but which are always false in the\r\n** specific grammar used by SQLite.\r\n*/\r\n/* First off, code is included that follows the \"include\" declaration\r\n** in the input grammar file. */\r\n/* #include <stdio.h> */\r\n\r\n\r\n/*\r\n** Disable all error recovery processing in the parser push-down\r\n** automaton.\r\n*/\r\n#define YYNOERRORRECOVERY 1\r\n\r\n/*\r\n** Make yytestcase() the same as testcase()\r\n*/\r\n#define yytestcase(X) testcase(X)\r\n\r\n/*\r\n** An instance of this structure holds information about the\r\n** LIMIT clause of a SELECT statement.\r\n*/\r\nstruct LimitVal {\r\n  Expr *pLimit;    /* The LIMIT expression.  NULL if there is no limit */\r\n  Expr *pOffset;   /* The OFFSET expression.  NULL if there is none */\r\n};\r\n\r\n/*\r\n** An instance of this structure is used to store the LIKE,\r\n** GLOB, NOT LIKE, and NOT GLOB operators.\r\n*/\r\nstruct LikeOp {\r\n  Token eOperator;  /* \"like\" or \"glob\" or \"regexp\" */\r\n  int not;         /* True if the NOT keyword is present */\r\n};\r\n\r\n/*\r\n** An instance of the following structure describes the event of a\r\n** TRIGGER.  \"a\" is the event type, one of TK_UPDATE, TK_INSERT,\r\n** TK_DELETE, or TK_INSTEAD.  If the event is of the form\r\n**\r\n**      UPDATE ON (a,b,c)\r\n**\r\n** Then the \"b\" IdList records the list \"a,b,c\".\r\n*/\r\nstruct TrigEvent { int a; IdList * b; };\r\n\r\n/*\r\n** An instance of this structure holds the ATTACH key and the key type.\r\n*/\r\nstruct AttachKey { int type;  Token key; };\r\n\r\n/*\r\n** One or more VALUES claues\r\n*/\r\nstruct ValueList {\r\n  ExprList *pList;\r\n  Select *pSelect;\r\n};\r\n\r\n\r\n  /* This is a utility routine used to set the ExprSpan.zStart and\r\n  ** ExprSpan.zEnd values of pOut so that the span covers the complete\r\n  ** range of text beginning with pStart and going to the end of pEnd.\r\n  */\r\n  static void spanSet(ExprSpan *pOut, Token *pStart, Token *pEnd){\r\n    pOut->zStart = pStart->z;\r\n    pOut->zEnd = &pEnd->z[pEnd->n];\r\n  }\r\n\r\n  /* Construct a new Expr object from a single identifier.  Use the\r\n  ** new Expr to populate pOut.  Set the span of pOut to be the identifier\r\n  ** that created the expression.\r\n  */\r\n  static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token *pValue){\r\n    pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, pValue);\r\n    pOut->zStart = pValue->z;\r\n    pOut->zEnd = &pValue->z[pValue->n];\r\n  }\r\n\r\n  /* This routine constructs a binary expression node out of two ExprSpan\r\n  ** objects and uses the result to populate a new ExprSpan object.\r\n  */\r\n  static void spanBinaryExpr(\r\n    ExprSpan *pOut,     /* Write the result here */\r\n    Parse *pParse,      /* The parsing context.  Errors accumulate here */\r\n    int op,             /* The binary operation */\r\n    ExprSpan *pLeft,    /* The left operand */\r\n    ExprSpan *pRight    /* The right operand */\r\n  ){\r\n    pOut->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);\r\n    pOut->zStart = pLeft->zStart;\r\n    pOut->zEnd = pRight->zEnd;\r\n  }\r\n\r\n  /* Construct an expression node for a unary postfix operator\r\n  */\r\n  static void spanUnaryPostfix(\r\n    ExprSpan *pOut,        /* Write the new expression node here */\r\n    Parse *pParse,         /* Parsing context to record errors */\r\n    int op,                /* The operator */\r\n    ExprSpan *pOperand,    /* The operand */\r\n    Token *pPostOp         /* The operand token for setting the span */\r\n  ){\r\n    pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);\r\n    pOut->zStart = pOperand->zStart;\r\n    pOut->zEnd = &pPostOp->z[pPostOp->n];\r\n  }                           \r\n\r\n  /* A routine to convert a binary TK_IS or TK_ISNOT expression into a\r\n  ** unary TK_ISNULL or TK_NOTNULL expression. */\r\n  static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){\r\n    sqlite3 *db = pParse->db;\r\n    if( db->mallocFailed==0 && pY->op==TK_NULL ){\r\n      pA->op = (u8)op;\r\n      sqlite3ExprDelete(db, pA->pRight);\r\n      pA->pRight = 0;\r\n    }\r\n  }\r\n\r\n  /* Construct an expression node for a unary prefix operator\r\n  */\r\n  static void spanUnaryPrefix(\r\n    ExprSpan *pOut,        /* Write the new expression node here */\r\n    Parse *pParse,         /* Parsing context to record errors */\r\n    int op,                /* The operator */\r\n    ExprSpan *pOperand,    /* The operand */\r\n    Token *pPreOp         /* The operand token for setting the span */\r\n  ){\r\n    pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);\r\n    pOut->zStart = pPreOp->z;\r\n    pOut->zEnd = pOperand->zEnd;\r\n  }\r\n/* Next is all token values, in a form suitable for use by makeheaders.\r\n** This section will be null unless lemon is run with the -m switch.\r\n*/\r\n/* \r\n** These constants (all generated automatically by the parser generator)\r\n** specify the various kinds of tokens (terminals) that the parser\r\n** understands. \r\n**\r\n** Each symbol here is a terminal symbol in the grammar.\r\n*/\r\n/* Make sure the INTERFACE macro is defined.\r\n*/\r\n#ifndef INTERFACE\r\n# define INTERFACE 1\r\n#endif\r\n/* The next thing included is series of defines which control\r\n** various aspects of the generated parser.\r\n**    YYCODETYPE         is the data type used for storing terminal\r\n**                       and nonterminal numbers.  \"unsigned char\" is\r\n**                       used if there are fewer than 250 terminals\r\n**                       and nonterminals.  \"int\" is used otherwise.\r\n**    YYNOCODE           is a number of type YYCODETYPE which corresponds\r\n**                       to no legal terminal or nonterminal number.  This\r\n**                       number is used to fill in empty slots of the hash \r\n**                       table.\r\n**    YYFALLBACK         If defined, this indicates that one or more tokens\r\n**                       have fall-back values which should be used if the\r\n**                       original value of the token will not parse.\r\n**    YYACTIONTYPE       is the data type used for storing terminal\r\n**                       and nonterminal numbers.  \"unsigned char\" is\r\n**                       used if there are fewer than 250 rules and\r\n**                       states combined.  \"int\" is used otherwise.\r\n**    sqlite3ParserTOKENTYPE     is the data type used for minor tokens given \r\n**                       directly to the parser from the tokenizer.\r\n**    YYMINORTYPE        is the data type used for all minor tokens.\r\n**                       This is typically a union of many types, one of\r\n**                       which is sqlite3ParserTOKENTYPE.  The entry in the union\r\n**                       for base tokens is called \"yy0\".\r\n**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If\r\n**                       zero the stack is dynamically sized using realloc()\r\n**    sqlite3ParserARG_SDECL     A static variable declaration for the %extra_argument\r\n**    sqlite3ParserARG_PDECL     A parameter declaration for the %extra_argument\r\n**    sqlite3ParserARG_STORE     Code to store %extra_argument into yypParser\r\n**    sqlite3ParserARG_FETCH     Code to extract %extra_argument from yypParser\r\n**    YYNSTATE           the combined number of states.\r\n**    YYNRULE            the number of rules in the grammar\r\n**    YYERRORSYMBOL      is the code number of the error symbol.  If not\r\n**                       defined, then do no error processing.\r\n*/\r\n#define YYCODETYPE unsigned char\r\n#define YYNOCODE 251\r\n#define YYACTIONTYPE unsigned short int\r\n#define YYWILDCARD 67\r\n#define sqlite3ParserTOKENTYPE Token\r\ntypedef union {\r\n  int yyinit;\r\n  sqlite3ParserTOKENTYPE yy0;\r\n  struct LimitVal yy64;\r\n  Expr* yy122;\r\n  Select* yy159;\r\n  IdList* yy180;\r\n  struct {int value; int mask;} yy207;\r\n  u8 yy258;\r\n  struct LikeOp yy318;\r\n  TriggerStep* yy327;\r\n  ExprSpan yy342;\r\n  SrcList* yy347;\r\n  int yy392;\r\n  struct TrigEvent yy410;\r\n  ExprList* yy442;\r\n  struct ValueList yy487;\r\n} YYMINORTYPE;\r\n#ifndef YYSTACKDEPTH\r\n#define YYSTACKDEPTH 100\r\n#endif\r\n#define sqlite3ParserARG_SDECL Parse *pParse;\r\n#define sqlite3ParserARG_PDECL ,Parse *pParse\r\n#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse\r\n#define sqlite3ParserARG_STORE yypParser->pParse = pParse\r\n#define YYNSTATE 629\r\n#define YYNRULE 327\r\n#define YYFALLBACK 1\r\n#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)\r\n#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)\r\n#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)\r\n\r\n/* The yyzerominor constant is used to initialize instances of\r\n** YYMINORTYPE objects to zero. */\r\nstatic const YYMINORTYPE yyzerominor = { 0 };\r\n\r\n/* Define the yytestcase() macro to be a no-op if is not already defined\r\n** otherwise.\r\n**\r\n** Applications can choose to define yytestcase() in the %include section\r\n** to a macro that can assist in verifying code coverage.  For production\r\n** code the yytestcase() macro should be turned off.  But it is useful\r\n** for testing.\r\n*/\r\n#ifndef yytestcase\r\n# define yytestcase(X)\r\n#endif\r\n\r\n\r\n/* Next are the tables used to determine what action to take based on the\r\n** current state and lookahead token.  These tables are used to implement\r\n** functions that take a state number and lookahead value and return an\r\n** action integer.  \r\n**\r\n** Suppose the action integer is N.  Then the action is determined as\r\n** follows\r\n**\r\n**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead\r\n**                                      token onto the stack and goto state N.\r\n**\r\n**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.\r\n**\r\n**   N == YYNSTATE+YYNRULE              A syntax error has occurred.\r\n**\r\n**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.\r\n**\r\n**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused\r\n**                                      slots in the yy_action[] table.\r\n**\r\n** The action table is constructed as a single large table named yy_action[].\r\n** Given state S and lookahead X, the action is computed as\r\n**\r\n**      yy_action[ yy_shift_ofst[S] + X ]\r\n**\r\n** If the index value yy_shift_ofst[S]+X is out of range or if the value\r\n** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]\r\n** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table\r\n** and that yy_default[S] should be used instead.  \r\n**\r\n** The formula above is for computing the action when the lookahead is\r\n** a terminal symbol.  If the lookahead is a non-terminal (as occurs after\r\n** a reduce action) then the yy_reduce_ofst[] array is used in place of\r\n** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of\r\n** YY_SHIFT_USE_DFLT.\r\n**\r\n** The following are the tables generated in this section:\r\n**\r\n**  yy_action[]        A single table containing all actions.\r\n**  yy_lookahead[]     A table containing the lookahead for each entry in\r\n**                     yy_action.  Used to detect hash collisions.\r\n**  yy_shift_ofst[]    For each state, the offset into yy_action for\r\n**                     shifting terminals.\r\n**  yy_reduce_ofst[]   For each state, the offset into yy_action for\r\n**                     shifting non-terminals after a reduce.\r\n**  yy_default[]       Default action for each state.\r\n*/\r\n#define YY_ACTTAB_COUNT (1580)\r\nstatic const YYACTIONTYPE yy_action[] = {\r\n /*     0 */   310,  328,  574,  573,   15,  172,  187,  596,   56,   56,\r\n /*    10 */    56,   56,   49,   54,   54,   54,   54,   53,   53,   52,\r\n /*    20 */    52,   52,   51,  234,  622,  621,  626,  622,  621,  299,\r\n /*    30 */   589,  583,   56,   56,   56,   56,  236,   54,   54,   54,\r\n /*    40 */    54,   53,   53,   52,   52,   52,   51,  234,  351,   57,\r\n /*    50 */    58,   48,  581,  580,  582,  582,   55,   55,   56,   56,\r\n /*    60 */    56,   56,  570,   54,   54,   54,   54,   53,   53,   52,\r\n /*    70 */    52,   52,   51,  234,  310,  596,  326,  607,  233,  232,\r\n /*    80 */    33,   54,   54,   54,   54,   53,   53,   52,   52,   52,\r\n /*    90 */    51,  234,  619,  618,  326,  619,  618,  166,  605,  492,\r\n /*   100 */   381,  378,  377,  235,  589,  583,  554,  495,    1,   59,\r\n /*   110 */    19,  376,  622,  621,   53,   53,   52,   52,   52,   51,\r\n /*   120 */   234,  571,  571,   57,   58,   48,  581,  580,  582,  582,\r\n /*   130 */    55,   55,   56,   56,   56,   56,  215,   54,   54,   54,\r\n /*   140 */    54,   53,   53,   52,   52,   52,   51,  234,  310,  224,\r\n /*   150 */    50,   47,  147,  177,  139,  281,  384,  276,  383,  169,\r\n /*   160 */   408,  553,  578,  578,  622,  621,  272,  224,  439,  550,\r\n /*   170 */   552,  410,  139,  281,  384,  276,  383,  169,  589,  583,\r\n /*   180 */   619,  618,  280,  620,  272,  195,  413,  309,  440,  441,\r\n /*   190 */   567,  491,  214,  279,  560,  600,   92,   57,   58,   48,\r\n /*   200 */   581,  580,  582,  582,   55,   55,   56,   56,   56,   56,\r\n /*   210 */   559,   54,   54,   54,   54,   53,   53,   52,   52,   52,\r\n /*   220 */    51,  234,  310,  464,  233,  232,  558,  133,  519,   50,\r\n /*   230 */    47,  147,  619,  618,  565,  436,  397,  515,  514,  518,\r\n /*   240 */   410,  387,  438,  389,  437,  622,  621,  442,  570,  433,\r\n /*   250 */   203,  390,  589,  583,    6,  413,  166,  670,  250,  381,\r\n /*   260 */   378,  377,  525,  190,  600,   92,  594,  571,  571,  465,\r\n /*   270 */   376,   57,   58,   48,  581,  580,  582,  582,   55,   55,\r\n /*   280 */    56,   56,   56,   56,  599,   54,   54,   54,   54,   53,\r\n /*   290 */    53,   52,   52,   52,   51,  234,  310,  592,  592,  592,\r\n /*   300 */   490,  182,  247,  548,  249,  397,  273,  410,    7,  439,\r\n /*   310 */   398,  606,   67,  619,  618,  620,  472,  256,  347,  255,\r\n /*   320 */   473,  620,  413,  576,  620,   65,  589,  583,  236,  440,\r\n /*   330 */   336,  600,   92,   68,  364,  192,  481,  622,  621,  547,\r\n /*   340 */   622,  621,  560,  323,  207,   57,   58,   48,  581,  580,\r\n /*   350 */   582,  582,   55,   55,   56,   56,   56,   56,  559,   54,\r\n /*   360 */    54,   54,   54,   53,   53,   52,   52,   52,   51,  234,\r\n /*   370 */   310,  410,  397,  146,  558,  531,  401,  348,  599,  166,\r\n /*   380 */   248,  204,  381,  378,  377,  541,  413,  171,  337,  570,\r\n /*   390 */   622,  621,   40,  376,   38,  600,   74,  465,  548,  490,\r\n /*   400 */   589,  583,  532,  350,  579,  619,  618,  297,  619,  618,\r\n /*   410 */   480,   67,  470,   39,  620,  599,  406,  574,  573,   57,\r\n /*   420 */    58,   48,  581,  580,  582,  582,   55,   55,   56,   56,\r\n /*   430 */    56,   56,  577,   54,   54,   54,   54,   53,   53,   52,\r\n /*   440 */    52,   52,   51,  234,  310,  256,  347,  255,  530,   52,\r\n /*   450 */    52,   52,   51,  234,  345,  564,  236,  386,  619,  618,\r\n /*   460 */   957,  185,  418,    2,  408,  410,  578,  578,  198,  197,\r\n /*   470 */   196,  499,  183,  167,  589,  583,  671,  570,  505,  506,\r\n /*   480 */   413,  267,  601,  672,  546,  208,  602,   36,  601,  600,\r\n /*   490 */    91,  468,  602,   57,   58,   48,  581,  580,  582,  582,\r\n /*   500 */    55,   55,   56,   56,   56,   56,  202,   54,   54,   54,\r\n /*   510 */    54,   53,   53,   52,   52,   52,   51,  234,  310,  599,\r\n /*   520 */   157,  408,  527,  578,  578,  263,  490,  265,  410,  873,\r\n /*   530 */   410,  474,  474,  366,  373,  410,  504,  428,   67,  290,\r\n /*   540 */   599,  620,  352,  413,  408,  413,  578,  578,  589,  583,\r\n /*   550 */   413,  382,  600,   92,  600,   16,  543,   62,  503,  600,\r\n /*   560 */    92,  408,  346,  578,  578,  168,   45,   57,   58,   48,\r\n /*   570 */   581,  580,  582,  582,   55,   55,   56,   56,   56,   56,\r\n /*   580 */   200,   54,   54,   54,   54,   53,   53,   52,   52,   52,\r\n /*   590 */    51,  234,  310,  393,  395,  534,  510,  617,  616,  615,\r\n /*   600 */   318,  314,  172,   66,  596,  410,  338,  596,  324,  571,\r\n /*   610 */   571,   50,   47,  147,  599,  629,  627,  330,  539,  315,\r\n /*   620 */   413,   30,  589,  583,  272,  236,  199,  144,  176,  600,\r\n /*   630 */    73,  420,  947,  620,  947,  420,  946,  351,  946,  175,\r\n /*   640 */   596,   57,   58,   48,  581,  580,  582,  582,   55,   55,\r\n /*   650 */    56,   56,   56,   56,  410,   54,   54,   54,   54,   53,\r\n /*   660 */    53,   52,   52,   52,   51,  234,  310,  261,  410,  413,\r\n /*   670 */   269,  208,  596,  363,  410,  596,  424,  360,  600,   69,\r\n /*   680 */   424,  327,  620,  413,   50,   47,  147,  410,  358,  413,\r\n /*   690 */   575,  553,  600,   94,  483,  509,  589,  583,  600,   97,\r\n /*   700 */   552,  484,  413,  620,  188,  599,  551,  563,  596,  566,\r\n /*   710 */   334,  600,   95,  205,  201,   57,   58,   48,  581,  580,\r\n /*   720 */   582,  582,   55,   55,   56,   56,   56,   56,  352,   54,\r\n /*   730 */    54,   54,   54,   53,   53,   52,   52,   52,   51,  234,\r\n /*   740 */   310,  410,  261,  410,  167,   22,  356,  599,  359,  623,\r\n /*   750 */    50,   47,  147,  548,  357,  562,  413,  620,  413,  332,\r\n /*   760 */   523,  270,  410,  167,  620,  600,  104,  600,  103,  603,\r\n /*   770 */   589,  583,  339,  539,  304,  423,  222,  413,  174,  304,\r\n /*   780 */   422,  561,  567,  405,  214,  260,  600,  106,  620,   57,\r\n /*   790 */    58,   48,  581,  580,  582,  582,   55,   55,   56,   56,\r\n /*   800 */    56,   56,  410,   54,   54,   54,   54,   53,   53,   52,\r\n /*   810 */    52,   52,   51,  234,  310,  410,  557,  413,  410,  421,\r\n /*   820 */   273,   35,  512,  146,  421,   12,  600,  107,  213,  144,\r\n /*   830 */   413,  410,   32,  413,  410,  620,  365,  353,  358,  600,\r\n /*   840 */   134,   11,  600,  135,  589,  583,  413,   21,  548,  413,\r\n /*   850 */   316,  148,  620,  620,  170,  600,   98,  223,  600,  102,\r\n /*   860 */   374,  168,  167,   57,   58,   48,  581,  580,  582,  582,\r\n /*   870 */    55,   55,   56,   56,   56,   56,  410,   54,   54,   54,\r\n /*   880 */    54,   53,   53,   52,   52,   52,   51,  234,  310,  410,\r\n /*   890 */   273,  413,  410,  273,  212,  469,  410,  167,  628,    2,\r\n /*   900 */   600,  101,  545,  221,  413,  620,  130,  413,  620,  410,\r\n /*   910 */   539,  413,  537,  600,   93,  315,  600,  100,  589,  583,\r\n /*   920 */   600,   77,  425,  305,  413,  620,  254,  322,  599,  458,\r\n /*   930 */   320,  171,  543,  600,   96,  521,  520,   57,   58,   48,\r\n /*   940 */   581,  580,  582,  582,   55,   55,   56,   56,   56,   56,\r\n /*   950 */   410,   54,   54,   54,   54,   53,   53,   52,   52,   52,\r\n /*   960 */    51,  234,  310,  410,  273,  413,  410,  457,  358,   35,\r\n /*   970 */   426,  230,  306,  319,  600,  138,  467,  520,  413,  620,\r\n /*   980 */   143,  413,  410,  620,  410,  353,  529,  600,  137,  142,\r\n /*   990 */   600,  136,  589,  583,  604,  261,  528,  413,  229,  413,\r\n /*  1000 */   620,  321,  495,   28,  543,  543,  600,   76,  600,   90,\r\n /*  1010 */   620,   57,   46,   48,  581,  580,  582,  582,   55,   55,\r\n /*  1020 */    56,   56,   56,   56,  410,   54,   54,   54,   54,   53,\r\n /*  1030 */    53,   52,   52,   52,   51,  234,  310,  261,  451,  413,\r\n /*  1040 */   410,  211,  611,  285,  283,  610,  609,  502,  600,   89,\r\n /*  1050 */   380,  217,  620,  128,  140,  413,  220,  620,  410,  409,\r\n /*  1060 */   620,  620,  588,  587,  600,   75,  589,  583,  271,  620,\r\n /*  1070 */    51,  234,  127,  413,  620,  599,  627,  330,   27,  375,\r\n /*  1080 */   449,  279,  600,   88,  585,  584,   58,   48,  581,  580,\r\n /*  1090 */   582,  582,   55,   55,   56,   56,   56,   56,  410,   54,\r\n /*  1100 */    54,   54,   54,   53,   53,   52,   52,   52,   51,  234,\r\n /*  1110 */   310,  586,  410,  413,  410,  261,  593,  165,  399,  556,\r\n /*  1120 */   126,  371,  600,   87,  478,  186,  123,  413,  367,  413,\r\n /*  1130 */   620,  620,  410,  620,  620,  410,  600,   99,  600,   86,\r\n /*  1140 */   589,  583,  475,  122,  258,  171,  471,  413,  160,  121,\r\n /*  1150 */   413,   14,  159,  463,   25,   24,  600,   17,  448,  600,\r\n /*  1160 */    85,   48,  581,  580,  582,  582,   55,   55,   56,   56,\r\n /*  1170 */    56,   56,  158,   54,   54,   54,   54,   53,   53,   52,\r\n /*  1180 */    52,   52,   51,  234,   44,  404,  261,    3,  544,  261,\r\n /*  1190 */   540,  414,  621,  460,  119,  118,  538,  275,   10,  349,\r\n /*  1200 */     4,  620,  407,  620,  620,  620,  116,   44,  404,  410,\r\n /*  1210 */     3,  620,  620,  410,  414,  621,  456,  454,  252,  450,\r\n /*  1220 */   508,  402,  111,  109,  413,  407,  155,  444,  413,  447,\r\n /*  1230 */   435,  565,  219,  600,   84,  620,  108,  600,   83,   64,\r\n /*  1240 */   434,  417,  625,  150,  402,  333,  410,  237,  238,  124,\r\n /*  1250 */   274,   41,   42,  533,  565,  206,  189,  261,   43,  412,\r\n /*  1260 */   411,  413,  261,  594,  488,  620,  329,  149,  419,  268,\r\n /*  1270 */   600,   72,  620,  266,   41,   42,  181,  620,  410,  620,\r\n /*  1280 */   105,   43,  412,  411,  620,  624,  594,  614,  620,  599,\r\n /*  1290 */   228,  125,  313,  413,  592,  592,  592,  591,  590,   13,\r\n /*  1300 */   218,  410,  600,   71,  236,  244,   44,  404,  264,    3,\r\n /*  1310 */   312,  613,  340,  414,  621,  180,  413,  592,  592,  592,\r\n /*  1320 */   591,  590,   13,  620,  407,  600,   82,  410,  416,   34,\r\n /*  1330 */   404,  410,    3,  410,  262,  410,  414,  621,  612,  331,\r\n /*  1340 */   178,  415,  413,  402,    8,  236,  413,  407,  413,  620,\r\n /*  1350 */   413,  600,   81,  565,  257,  600,   80,  600,   70,  600,\r\n /*  1360 */    18,  598,  361,  462,  461,   30,  402,  294,   31,  620,\r\n /*  1370 */   293,  354,  251,   41,   42,  410,  565,  620,  620,  620,\r\n /*  1380 */    43,  412,  411,  453,  396,  594,  620,  620,  394,   61,\r\n /*  1390 */   413,  292,  443,  622,  621,  243,   41,   42,  620,  600,\r\n /*  1400 */    79,  597,  291,   43,  412,  411,   60,  620,  594,  240,\r\n /*  1410 */   620,  410,  231,   37,  555,  173,  592,  592,  592,  591,\r\n /*  1420 */   590,   13,  216,  239,  620,  184,  413,  302,  301,  300,\r\n /*  1430 */   179,  298,  388,  565,  452,  600,   78,  286,  620,  592,\r\n /*  1440 */   592,  592,  591,  590,   13,  429,   29,  413,  151,  289,\r\n /*  1450 */   242,  145,  392,  194,  193,  288,  600,    9,  542,  241,\r\n /*  1460 */   620,  525,  391,  284,  620,  594,  620,  620,  522,  536,\r\n /*  1470 */   620,  535,  153,  385,  465,  516,  282,  325,  154,  517,\r\n /*  1480 */   277,  152,  512,  511,  513,  129,  226,  308,  487,  486,\r\n /*  1490 */   485,  164,  372,  493,  307,  227,  592,  592,  592,  225,\r\n /*  1500 */   479,  163,  368,  370,  162,  476,  210,  477,   26,  259,\r\n /*  1510 */   161,  466,  362,  141,  132,  120,  117,  455,  156,  115,\r\n /*  1520 */   344,  343,  256,  342,  245,  114,  113,  446,  311,  112,\r\n /*  1530 */    23,  317,  432,  236,  131,  431,  110,  430,   20,  427,\r\n /*  1540 */   608,  595,  295,   63,  379,  287,  509,  191,  278,  403,\r\n /*  1550 */   572,  569,  497,  498,  496,  494,  335,  459,  445,  303,\r\n /*  1560 */   296,  246,  341,  355,    5,  568,  369,  507,  253,  549,\r\n /*  1570 */   526,  209,  400,  501,  500,  524,  234,  958,  489,  482,\r\n};\r\nstatic const YYCODETYPE yy_lookahead[] = {\r\n /*     0 */    19,  169,  170,  171,   22,   24,   24,   26,   77,   78,\r\n /*    10 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,\r\n /*    20 */    89,   90,   91,   92,   26,   27,    1,   26,   27,   15,\r\n /*    30 */    49,   50,   77,   78,   79,   80,  116,   82,   83,   84,\r\n /*    40 */    85,   86,   87,   88,   89,   90,   91,   92,  128,   68,\r\n /*    50 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,\r\n /*    60 */    79,   80,  230,   82,   83,   84,   85,   86,   87,   88,\r\n /*    70 */    89,   90,   91,   92,   19,   94,   19,   23,   86,   87,\r\n /*    80 */    25,   82,   83,   84,   85,   86,   87,   88,   89,   90,\r\n /*    90 */    91,   92,   94,   95,   19,   94,   95,   96,  172,  173,\r\n /*   100 */    99,  100,  101,  197,   49,   50,  177,  181,   22,   54,\r\n /*   110 */   204,  110,   26,   27,   86,   87,   88,   89,   90,   91,\r\n /*   120 */    92,  129,  130,   68,   69,   70,   71,   72,   73,   74,\r\n /*   130 */    75,   76,   77,   78,   79,   80,   22,   82,   83,   84,\r\n /*   140 */    85,   86,   87,   88,   89,   90,   91,   92,   19,   92,\r\n /*   150 */   221,  222,  223,   96,   97,   98,   99,  100,  101,  102,\r\n /*   160 */   112,   32,  114,  115,   26,   27,  109,   92,  150,   25,\r\n /*   170 */    41,  150,   97,   98,   99,  100,  101,  102,   49,   50,\r\n /*   180 */    94,   95,   98,  165,  109,   25,  165,  163,  170,  171,\r\n /*   190 */   166,  167,  168,  109,   12,  174,  175,   68,   69,   70,\r\n /*   200 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,\r\n /*   210 */    28,   82,   83,   84,   85,   86,   87,   88,   89,   90,\r\n /*   220 */    91,   92,   19,   11,   86,   87,   44,   24,   46,  221,\r\n /*   230 */   222,  223,   94,   95,   66,   97,  215,    7,    8,   57,\r\n /*   240 */   150,  220,  104,   19,  106,   26,   27,  229,  230,  241,\r\n /*   250 */   160,   27,   49,   50,   22,  165,   96,  118,   16,   99,\r\n /*   260 */   100,  101,   94,  119,  174,  175,   98,  129,  130,   57,\r\n /*   270 */   110,   68,   69,   70,   71,   72,   73,   74,   75,   76,\r\n /*   280 */    77,   78,   79,   80,  194,   82,   83,   84,   85,   86,\r\n /*   290 */    87,   88,   89,   90,   91,   92,   19,  129,  130,  131,\r\n /*   300 */   150,   23,   60,   25,   62,  215,  150,  150,   76,  150,\r\n /*   310 */   220,  161,  162,   94,   95,  165,   30,  105,  106,  107,\r\n /*   320 */    34,  165,  165,   23,  165,   25,   49,   50,  116,  170,\r\n /*   330 */   171,  174,  175,   22,   48,  185,  186,   26,   27,  120,\r\n /*   340 */    26,   27,   12,  187,  160,   68,   69,   70,   71,   72,\r\n /*   350 */    73,   74,   75,   76,   77,   78,   79,   80,   28,   82,\r\n /*   360 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,\r\n /*   370 */    19,  150,  215,   95,   44,   23,   46,  220,  194,   96,\r\n /*   380 */   138,  160,   99,  100,  101,   23,  165,   25,  229,  230,\r\n /*   390 */    26,   27,  135,  110,  137,  174,  175,   57,  120,  150,\r\n /*   400 */    49,   50,   88,  219,  113,   94,   95,  158,   94,   95,\r\n /*   410 */   161,  162,   21,  136,  165,  194,  169,  170,  171,   68,\r\n /*   420 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,\r\n /*   430 */    79,   80,   23,   82,   83,   84,   85,   86,   87,   88,\r\n /*   440 */    89,   90,   91,   92,   19,  105,  106,  107,   23,   88,\r\n /*   450 */    89,   90,   91,   92,   63,   23,  116,   88,   94,   95,\r\n /*   460 */   142,  143,  144,  145,  112,  150,  114,  115,  105,  106,\r\n /*   470 */   107,   23,   23,   25,   49,   50,  118,  230,   97,   98,\r\n /*   480 */   165,   16,  113,  118,  120,  160,  117,  136,  113,  174,\r\n /*   490 */   175,  100,  117,   68,   69,   70,   71,   72,   73,   74,\r\n /*   500 */    75,   76,   77,   78,   79,   80,  160,   82,   83,   84,\r\n /*   510 */    85,   86,   87,   88,   89,   90,   91,   92,   19,  194,\r\n /*   520 */    25,  112,   23,  114,  115,   60,  150,   62,  150,  138,\r\n /*   530 */   150,  105,  106,  107,   19,  150,   36,  161,  162,  224,\r\n /*   540 */   194,  165,  217,  165,  112,  165,  114,  115,   49,   50,\r\n /*   550 */   165,   51,  174,  175,  174,  175,  166,  232,   58,  174,\r\n /*   560 */   175,  112,  237,  114,  115,   50,   22,   68,   69,   70,\r\n /*   570 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,\r\n /*   580 */   160,   82,   83,   84,   85,   86,   87,   88,   89,   90,\r\n /*   590 */    91,   92,   19,  215,  214,  205,   23,    7,    8,    9,\r\n /*   600 */   215,  155,   24,   22,   26,  150,   97,   26,  108,  129,\r\n /*   610 */   130,  221,  222,  223,  194,    0,    1,    2,  150,  104,\r\n /*   620 */   165,  126,   49,   50,  109,  116,  206,  207,  118,  174,\r\n /*   630 */   175,   22,   23,  165,   25,   22,   23,  128,   25,  118,\r\n /*   640 */    26,   68,   69,   70,   71,   72,   73,   74,   75,   76,\r\n /*   650 */    77,   78,   79,   80,  150,   82,   83,   84,   85,   86,\r\n /*   660 */    87,   88,   89,   90,   91,   92,   19,  150,  150,  165,\r\n /*   670 */    23,  160,   94,  227,  150,   94,   67,  231,  174,  175,\r\n /*   680 */    67,  213,  165,  165,  221,  222,  223,  150,  150,  165,\r\n /*   690 */    23,   32,  174,  175,  181,  182,   49,   50,  174,  175,\r\n /*   700 */    41,  188,  165,  165,   22,  194,  177,   11,   94,   23,\r\n /*   710 */   193,  174,  175,  160,   22,   68,   69,   70,   71,   72,\r\n /*   720 */    73,   74,   75,   76,   77,   78,   79,   80,  217,   82,\r\n /*   730 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,\r\n /*   740 */    19,  150,  150,  150,   25,   24,   19,  194,  237,  150,\r\n /*   750 */   221,  222,  223,   25,   27,   23,  165,  165,  165,  242,\r\n /*   760 */   165,   23,  150,   25,  165,  174,  175,  174,  175,  174,\r\n /*   770 */    49,   50,  219,  150,   22,   23,  238,  165,   25,   22,\r\n /*   780 */    23,   23,  166,  167,  168,  193,  174,  175,  165,   68,\r\n /*   790 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,\r\n /*   800 */    79,   80,  150,   82,   83,   84,   85,   86,   87,   88,\r\n /*   810 */    89,   90,   91,   92,   19,  150,   23,  165,  150,   67,\r\n /*   820 */   150,   25,  103,   95,   67,   35,  174,  175,  206,  207,\r\n /*   830 */   165,  150,   25,  165,  150,  165,  213,  150,  150,  174,\r\n /*   840 */   175,   35,  174,  175,   49,   50,  165,   52,  120,  165,\r\n /*   850 */   245,  246,  165,  165,   35,  174,  175,  187,  174,  175,\r\n /*   860 */    23,   50,   25,   68,   69,   70,   71,   72,   73,   74,\r\n /*   870 */    75,   76,   77,   78,   79,   80,  150,   82,   83,   84,\r\n /*   880 */    85,   86,   87,   88,   89,   90,   91,   92,   19,  150,\r\n /*   890 */   150,  165,  150,  150,  160,   23,  150,   25,  144,  145,\r\n /*   900 */   174,  175,  120,  216,  165,  165,   22,  165,  165,  150,\r\n /*   910 */   150,  165,   27,  174,  175,  104,  174,  175,   49,   50,\r\n /*   920 */   174,  175,  247,  248,  165,  165,  238,  187,  194,   23,\r\n /*   930 */   187,   25,  166,  174,  175,  190,  191,   68,   69,   70,\r\n /*   940 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,\r\n /*   950 */   150,   82,   83,   84,   85,   86,   87,   88,   89,   90,\r\n /*   960 */    91,   92,   19,  150,  150,  165,  150,   23,  150,   25,\r\n /*   970 */    23,  205,   25,  213,  174,  175,  190,  191,  165,  165,\r\n /*   980 */   118,  165,  150,  165,  150,  150,   23,  174,  175,   39,\r\n /*   990 */   174,  175,   49,   50,  173,  150,   23,  165,   52,  165,\r\n /*  1000 */   165,  187,  181,   22,  166,  166,  174,  175,  174,  175,\r\n /*  1010 */   165,   68,   69,   70,   71,   72,   73,   74,   75,   76,\r\n /*  1020 */    77,   78,   79,   80,  150,   82,   83,   84,   85,   86,\r\n /*  1030 */    87,   88,   89,   90,   91,   92,   19,  150,  193,  165,\r\n /*  1040 */   150,  160,  150,  205,  205,  150,  150,   29,  174,  175,\r\n /*  1050 */    52,  216,  165,   22,  150,  165,  238,  165,  150,  150,\r\n /*  1060 */   165,  165,   49,   50,  174,  175,   49,   50,   23,  165,\r\n /*  1070 */    91,   92,   22,  165,  165,  194,    1,    2,   22,   52,\r\n /*  1080 */   193,  109,  174,  175,   71,   72,   69,   70,   71,   72,\r\n /*  1090 */    73,   74,   75,   76,   77,   78,   79,   80,  150,   82,\r\n /*  1100 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,\r\n /*  1110 */    19,   98,  150,  165,  150,  150,  150,  102,  150,  150,\r\n /*  1120 */    22,   19,  174,  175,   20,   24,  104,  165,   43,  165,\r\n /*  1130 */   165,  165,  150,  165,  165,  150,  174,  175,  174,  175,\r\n /*  1140 */    49,   50,   59,   53,  138,   25,   53,  165,  104,   22,\r\n /*  1150 */   165,    5,  118,    1,   76,   76,  174,  175,  193,  174,\r\n /*  1160 */   175,   70,   71,   72,   73,   74,   75,   76,   77,   78,\r\n /*  1170 */    79,   80,   35,   82,   83,   84,   85,   86,   87,   88,\r\n /*  1180 */    89,   90,   91,   92,   19,   20,  150,   22,  150,  150,\r\n /*  1190 */   150,   26,   27,   27,  108,  127,  150,  150,   22,   25,\r\n /*  1200 */    22,  165,   37,  165,  165,  165,  119,   19,   20,  150,\r\n /*  1210 */    22,  165,  165,  150,   26,   27,   23,    1,   16,   20,\r\n /*  1220 */   150,   56,  119,  108,  165,   37,  121,  128,  165,  193,\r\n /*  1230 */    23,   66,  193,  174,  175,  165,  127,  174,  175,   16,\r\n /*  1240 */    23,  146,  147,   15,   56,   65,  150,  152,  140,  154,\r\n /*  1250 */   150,   86,   87,   88,   66,  160,   22,  150,   93,   94,\r\n /*  1260 */    95,  165,  150,   98,  150,  165,    3,  246,    4,  150,\r\n /*  1270 */   174,  175,  165,  150,   86,   87,    6,  165,  150,  165,\r\n /*  1280 */   164,   93,   94,   95,  165,  149,   98,  149,  165,  194,\r\n /*  1290 */   180,  180,  249,  165,  129,  130,  131,  132,  133,  134,\r\n /*  1300 */   193,  150,  174,  175,  116,  193,   19,   20,  150,   22,\r\n /*  1310 */   249,  149,  217,   26,   27,  151,  165,  129,  130,  131,\r\n /*  1320 */   132,  133,  134,  165,   37,  174,  175,  150,  149,   19,\r\n /*  1330 */    20,  150,   22,  150,  150,  150,   26,   27,   13,  244,\r\n /*  1340 */   151,  159,  165,   56,   25,  116,  165,   37,  165,  165,\r\n /*  1350 */   165,  174,  175,   66,  150,  174,  175,  174,  175,  174,\r\n /*  1360 */   175,  194,  150,  150,  150,  126,   56,  199,  124,  165,\r\n /*  1370 */   200,  150,  150,   86,   87,  150,   66,  165,  165,  165,\r\n /*  1380 */    93,   94,   95,  150,  122,   98,  165,  165,  123,   22,\r\n /*  1390 */   165,  201,  150,   26,   27,  150,   86,   87,  165,  174,\r\n /*  1400 */   175,  203,  202,   93,   94,   95,  125,  165,   98,  150,\r\n /*  1410 */   165,  150,  225,  135,  157,  118,  129,  130,  131,  132,\r\n /*  1420 */   133,  134,    5,  150,  165,  157,  165,   10,   11,   12,\r\n /*  1430 */    13,   14,  150,   66,   17,  174,  175,  210,  165,  129,\r\n /*  1440 */   130,  131,  132,  133,  134,  150,  104,  165,   31,  150,\r\n /*  1450 */    33,  150,  150,   86,   87,  150,  174,  175,  211,   42,\r\n /*  1460 */   165,   94,  121,  210,  165,   98,  165,  165,  176,  211,\r\n /*  1470 */   165,  211,   55,  104,   57,  184,  210,   47,   61,  176,\r\n /*  1480 */   176,   64,  103,  176,  178,   22,   92,  179,  176,  176,\r\n /*  1490 */   176,  156,   18,  184,  179,  228,  129,  130,  131,  228,\r\n /*  1500 */   157,  156,   45,  157,  156,  236,  157,  157,  135,  235,\r\n /*  1510 */   156,  189,  157,   68,  218,  189,   22,  199,  156,  192,\r\n /*  1520 */   157,   18,  105,  106,  107,  192,  192,  199,  111,  192,\r\n /*  1530 */   240,  157,   40,  116,  218,  157,  189,  157,  240,   38,\r\n /*  1540 */   153,  166,  198,  243,  178,  209,  182,  196,  177,  226,\r\n /*  1550 */   230,  230,  166,  177,  177,  166,  139,  199,  199,  148,\r\n /*  1560 */   195,  209,  209,  239,  196,  166,  234,  183,  239,  208,\r\n /*  1570 */   174,  233,  191,  183,  183,  174,   92,  250,  186,  186,\r\n};\r\n#define YY_SHIFT_USE_DFLT (-81)\r\n#define YY_SHIFT_COUNT (417)\r\n#define YY_SHIFT_MIN   (-80)\r\n#define YY_SHIFT_MAX   (1503)\r\nstatic const short yy_shift_ofst[] = {\r\n /*     0 */  1075, 1188, 1417, 1188, 1287, 1287,  138,  138,    1,  -19,\r\n /*    10 */  1287, 1287, 1287, 1287,  340,   -2,  129,  129,  795, 1165,\r\n /*    20 */  1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,\r\n /*    30 */  1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,\r\n /*    40 */  1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1310, 1287,\r\n /*    50 */  1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,\r\n /*    60 */  1287, 1287,  212,   -2,   -2,   -8,   -8,  614, 1229,   55,\r\n /*    70 */   721,  647,  573,  499,  425,  351,  277,  203,  869,  869,\r\n /*    80 */   869,  869,  869,  869,  869,  869,  869,  869,  869,  869,\r\n /*    90 */   869,  869,  869,  943,  869, 1017, 1091, 1091,  -69,  -45,\r\n /*   100 */   -45,  -45,  -45,  -45,   -1,   57,   28,  361,   -2,   -2,\r\n /*   110 */    -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,\r\n /*   120 */    -2,   -2,   -2,   -2,  391,  515,   -2,   -2,   -2,   -2,\r\n /*   130 */    -2,  509,  -80,  614,  979, 1484,  -81,  -81,  -81, 1367,\r\n /*   140 */    75,  182,  182,  314,  311,  364,  219,   86,  613,  609,\r\n /*   150 */    -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,\r\n /*   160 */    -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,\r\n /*   170 */    -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,\r\n /*   180 */    -2,   -2,  578,  578,  578,  615, 1229, 1229, 1229,  -81,\r\n /*   190 */   -81,  -81,  160,  168,  168,  283,  500,  500,  500,  278,\r\n /*   200 */   449,  330,  432,  409,  352,   48,   48,   48,   48,  426,\r\n /*   210 */   286,   48,   48,  728,  581,  369,  590,  495,  224,  224,\r\n /*   220 */   727,  495,  727,  719,  614,  659,  614,  659,  811,  659,\r\n /*   230 */   224,  257,  480,  480,  614,  144,  375,  -18, 1501, 1297,\r\n /*   240 */  1297, 1492, 1492, 1297, 1494, 1445, 1239, 1503, 1503, 1503,\r\n /*   250 */  1503, 1297, 1474, 1239, 1494, 1445, 1445, 1297, 1474, 1373,\r\n /*   260 */  1457, 1297, 1297, 1474, 1297, 1474, 1297, 1474, 1463, 1369,\r\n /*   270 */  1369, 1369, 1430, 1394, 1394, 1463, 1369, 1379, 1369, 1430,\r\n /*   280 */  1369, 1369, 1341, 1342, 1341, 1342, 1341, 1342, 1297, 1297,\r\n /*   290 */  1278, 1281, 1262, 1244, 1265, 1239, 1229, 1319, 1325, 1325,\r\n /*   300 */  1270, 1270, 1270, 1270,  -81,  -81,  -81,  -81,  -81,  -81,\r\n /*   310 */  1013,  242,  757,  752,  465,  363,  947,  232,  944,  906,\r\n /*   320 */   872,  837,  738,  448,  381,  230,   84,  362,  300, 1264,\r\n /*   330 */  1263, 1234, 1108, 1228, 1180, 1223, 1217, 1207, 1099, 1174,\r\n /*   340 */  1109, 1115, 1103, 1199, 1105, 1202, 1216, 1087, 1193, 1178,\r\n /*   350 */  1174, 1176, 1068, 1079, 1078, 1086, 1166, 1137, 1034, 1152,\r\n /*   360 */  1146, 1127, 1044, 1006, 1093, 1120, 1090, 1083, 1085, 1022,\r\n /*   370 */  1101, 1104, 1102,  972, 1015, 1098, 1027, 1056, 1050, 1045,\r\n /*   380 */  1031,  998, 1018,  981,  946,  950,  973,  963,  862,  885,\r\n /*   390 */   819,  884,  782,  796,  806,  807,  790,  796,  793,  758,\r\n /*   400 */   753,  732,  692,  696,  682,  686,  667,  544,  291,  521,\r\n /*   410 */   510,  365,  358,  139,  114,   54,   14,   25,\r\n};\r\n#define YY_REDUCE_USE_DFLT (-169)\r\n#define YY_REDUCE_COUNT (309)\r\n#define YY_REDUCE_MIN   (-168)\r\n#define YY_REDUCE_MAX   (1411)\r\nstatic const short yy_reduce_ofst[] = {\r\n /*     0 */   318,   90, 1095,  221,  157,   21,  159,   18,  150,  390,\r\n /*    10 */   385,  378,  380,  315,  325,  249,  529,  -71,    8, 1282,\r\n /*    20 */  1261, 1225, 1185, 1183, 1181, 1177, 1151, 1128, 1096, 1063,\r\n /*    30 */  1059,  985,  982,  964,  962,  948,  908,  890,  874,  834,\r\n /*    40 */   832,  816,  813,  800,  759,  746,  742,  739,  726,  684,\r\n /*    50 */   681,  668,  665,  652,  612,  593,  591,  537,  524,  518,\r\n /*    60 */   504,  455,  511,  376,  517,  247, -168,   24,  420,  463,\r\n /*    70 */   463,  463,  463,  463,  463,  463,  463,  463,  463,  463,\r\n /*    80 */   463,  463,  463,  463,  463,  463,  463,  463,  463,  463,\r\n /*    90 */   463,  463,  463,  463,  463,  463,  463,  463,  463,  463,\r\n /*   100 */   463,  463,  463,  463,  463,  -74,  463,  463, 1112,  835,\r\n /*   110 */  1107, 1039, 1036,  965,  887,  845,  818,  760,  688,  687,\r\n /*   120 */   538,  743,  623,  592,  446,  513,  814,  740,  670,  156,\r\n /*   130 */   468,  553,  184,  616,  463,  463,  463,  463,  463,  595,\r\n /*   140 */   821,  786,  745,  909, 1305, 1302, 1301, 1299,  675,  675,\r\n /*   150 */  1295, 1273, 1259, 1245, 1242, 1233, 1222, 1221, 1214, 1213,\r\n /*   160 */  1212, 1204, 1184, 1158, 1123, 1119, 1114, 1100, 1070, 1047,\r\n /*   170 */  1046, 1040, 1038,  969,  968,  966,  909,  904,  896,  895,\r\n /*   180 */   892,  599,  839,  838,  766,  754,  881,  734,  346,  605,\r\n /*   190 */   622,  -94, 1393, 1401, 1396, 1392, 1391, 1390, 1384, 1361,\r\n /*   200 */  1365, 1381, 1365, 1365, 1365, 1365, 1365, 1365, 1365, 1332,\r\n /*   210 */  1338, 1365, 1365, 1361, 1399, 1368, 1411, 1359, 1353, 1352,\r\n /*   220 */  1329, 1358, 1324, 1366, 1389, 1377, 1386, 1376, 1364, 1371,\r\n /*   230 */  1336, 1323, 1321, 1320, 1375, 1344, 1351, 1387, 1300, 1380,\r\n /*   240 */  1378, 1298, 1290, 1374, 1316, 1347, 1328, 1337, 1334, 1333,\r\n /*   250 */  1327, 1363, 1362, 1318, 1296, 1326, 1322, 1355, 1354, 1269,\r\n /*   260 */  1274, 1350, 1349, 1348, 1346, 1345, 1343, 1335, 1315, 1314,\r\n /*   270 */  1313, 1312, 1309, 1271, 1267, 1308, 1307, 1306, 1304, 1291,\r\n /*   280 */  1303, 1292, 1260, 1266, 1258, 1253, 1247, 1227, 1268, 1257,\r\n /*   290 */  1187, 1198, 1200, 1190, 1170, 1168, 1167, 1182, 1189, 1164,\r\n /*   300 */  1179, 1162, 1138, 1136, 1061, 1043, 1021, 1111, 1110, 1116,\r\n};\r\nstatic const YYACTIONTYPE yy_default[] = {\r\n /*     0 */   634,  868,  956,  956,  868,  868,  956,  956,  956,  758,\r\n /*    10 */   956,  956,  956,  866,  956,  956,  786,  786,  930,  956,\r\n /*    20 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*    30 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*    40 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*    50 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*    60 */   956,  956,  956,  956,  956,  956,  956,  673,  762,  792,\r\n /*    70 */   956,  956,  956,  956,  956,  956,  956,  956,  929,  931,\r\n /*    80 */   800,  799,  909,  773,  797,  790,  794,  869,  862,  863,\r\n /*    90 */   861,  865,  870,  956,  793,  829,  846,  828,  840,  845,\r\n /*   100 */   852,  844,  841,  831,  830,  665,  832,  833,  956,  956,\r\n /*   110 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   120 */   956,  956,  956,  956,  660,  727,  956,  956,  956,  956,\r\n /*   130 */   956,  956,  956,  956,  834,  835,  849,  848,  847,  956,\r\n /*   140 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   150 */   956,  936,  934,  956,  881,  956,  956,  956,  956,  956,\r\n /*   160 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   170 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   180 */   956,  640,  758,  758,  758,  634,  956,  956,  956,  948,\r\n /*   190 */   762,  752,  718,  956,  956,  956,  956,  956,  956,  956,\r\n /*   200 */   956,  956,  956,  956,  956,  802,  741,  919,  921,  956,\r\n /*   210 */   902,  739,  662,  760,  675,  750,  642,  796,  775,  775,\r\n /*   220 */   914,  796,  914,  699,  956,  786,  956,  786,  696,  786,\r\n /*   230 */   775,  864,  956,  956,  956,  759,  750,  956,  941,  766,\r\n /*   240 */   766,  933,  933,  766,  808,  731,  796,  738,  738,  738,\r\n /*   250 */   738,  766,  657,  796,  808,  731,  731,  766,  657,  908,\r\n /*   260 */   906,  766,  766,  657,  766,  657,  766,  657,  874,  729,\r\n /*   270 */   729,  729,  714,  878,  878,  874,  729,  699,  729,  714,\r\n /*   280 */   729,  729,  779,  774,  779,  774,  779,  774,  766,  766,\r\n /*   290 */   956,  791,  780,  789,  787,  796,  956,  717,  650,  650,\r\n /*   300 */   639,  639,  639,  639,  953,  953,  948,  701,  701,  683,\r\n /*   310 */   956,  956,  956,  956,  956,  956,  956,  883,  956,  956,\r\n /*   320 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   330 */   635,  943,  956,  956,  940,  956,  956,  956,  956,  801,\r\n /*   340 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   350 */   918,  956,  956,  956,  956,  956,  956,  956,  912,  956,\r\n /*   360 */   956,  956,  956,  956,  956,  905,  904,  956,  956,  956,\r\n /*   370 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   380 */   956,  956,  956,  956,  956,  956,  956,  956,  956,  956,\r\n /*   390 */   956,  956,  956,  788,  956,  781,  956,  867,  956,  956,\r\n /*   400 */   956,  956,  956,  956,  956,  956,  956,  956,  744,  817,\r\n /*   410 */   956,  816,  820,  815,  667,  956,  648,  956,  631,  636,\r\n /*   420 */   952,  955,  954,  951,  950,  949,  944,  942,  939,  938,\r\n /*   430 */   937,  935,  932,  928,  887,  885,  892,  891,  890,  889,\r\n /*   440 */   888,  886,  884,  882,  803,  798,  795,  927,  880,  740,\r\n /*   450 */   737,  736,  656,  945,  911,  920,  807,  806,  809,  917,\r\n /*   460 */   916,  915,  913,  910,  897,  805,  804,  732,  872,  871,\r\n /*   470 */   659,  901,  900,  899,  903,  907,  898,  768,  658,  655,\r\n /*   480 */   664,  721,  720,  728,  726,  725,  724,  723,  722,  719,\r\n /*   490 */   666,  674,  685,  713,  698,  697,  877,  879,  876,  875,\r\n /*   500 */   706,  705,  711,  710,  709,  708,  707,  704,  703,  702,\r\n /*   510 */   695,  694,  700,  693,  716,  715,  712,  692,  735,  734,\r\n /*   520 */   733,  730,  691,  690,  689,  820,  688,  687,  826,  825,\r\n /*   530 */   813,  856,  755,  754,  753,  765,  764,  777,  776,  811,\r\n /*   540 */   810,  778,  763,  757,  756,  772,  771,  770,  769,  761,\r\n /*   550 */   751,  783,  785,  784,  782,  858,  767,  855,  926,  925,\r\n /*   560 */   924,  923,  922,  860,  859,  827,  824,  678,  679,  895,\r\n /*   570 */   894,  896,  893,  681,  680,  677,  676,  857,  746,  745,\r\n /*   580 */   853,  850,  842,  838,  854,  851,  843,  839,  837,  836,\r\n /*   590 */   822,  821,  819,  818,  814,  823,  669,  747,  743,  742,\r\n /*   600 */   812,  749,  748,  686,  684,  682,  663,  661,  654,  652,\r\n /*   610 */   651,  653,  649,  647,  646,  645,  644,  643,  672,  671,\r\n /*   620 */   670,  668,  667,  641,  638,  637,  633,  632,  630,\r\n};\r\n\r\n/* The next table maps tokens into fallback tokens.  If a construct\r\n** like the following:\r\n** \r\n**      %fallback ID X Y Z.\r\n**\r\n** appears in the grammar, then ID becomes a fallback token for X, Y,\r\n** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser\r\n** but it does not parse, the type of the token is changed to ID and\r\n** the parse is retried before an error is thrown.\r\n*/\r\n#ifdef YYFALLBACK\r\nstatic const YYCODETYPE yyFallback[] = {\r\n    0,  /*          $ => nothing */\r\n    0,  /*       SEMI => nothing */\r\n   26,  /*    EXPLAIN => ID */\r\n   26,  /*      QUERY => ID */\r\n   26,  /*       PLAN => ID */\r\n   26,  /*      BEGIN => ID */\r\n    0,  /* TRANSACTION => nothing */\r\n   26,  /*   DEFERRED => ID */\r\n   26,  /*  IMMEDIATE => ID */\r\n   26,  /*  EXCLUSIVE => ID */\r\n    0,  /*     COMMIT => nothing */\r\n   26,  /*        END => ID */\r\n   26,  /*   ROLLBACK => ID */\r\n   26,  /*  SAVEPOINT => ID */\r\n   26,  /*    RELEASE => ID */\r\n    0,  /*         TO => nothing */\r\n    0,  /*      TABLE => nothing */\r\n    0,  /*     CREATE => nothing */\r\n   26,  /*         IF => ID */\r\n    0,  /*        NOT => nothing */\r\n    0,  /*     EXISTS => nothing */\r\n   26,  /*       TEMP => ID */\r\n    0,  /*         LP => nothing */\r\n    0,  /*         RP => nothing */\r\n    0,  /*         AS => nothing */\r\n    0,  /*      COMMA => nothing */\r\n    0,  /*         ID => nothing */\r\n    0,  /*    INDEXED => nothing */\r\n   26,  /*      ABORT => ID */\r\n   26,  /*     ACTION => ID */\r\n   26,  /*      AFTER => ID */\r\n   26,  /*    ANALYZE => ID */\r\n   26,  /*        ASC => ID */\r\n   26,  /*     ATTACH => ID */\r\n   26,  /*     BEFORE => ID */\r\n   26,  /*         BY => ID */\r\n   26,  /*    CASCADE => ID */\r\n   26,  /*       CAST => ID */\r\n   26,  /*   COLUMNKW => ID */\r\n   26,  /*   CONFLICT => ID */\r\n   26,  /*   DATABASE => ID */\r\n   26,  /*       DESC => ID */\r\n   26,  /*     DETACH => ID */\r\n   26,  /*       EACH => ID */\r\n   26,  /*       FAIL => ID */\r\n   26,  /*        FOR => ID */\r\n   26,  /*     IGNORE => ID */\r\n   26,  /*  INITIALLY => ID */\r\n   26,  /*    INSTEAD => ID */\r\n   26,  /*    LIKE_KW => ID */\r\n   26,  /*      MATCH => ID */\r\n   26,  /*         NO => ID */\r\n   26,  /*        KEY => ID */\r\n   26,  /*         OF => ID */\r\n   26,  /*     OFFSET => ID */\r\n   26,  /*     PRAGMA => ID */\r\n   26,  /*      RAISE => ID */\r\n   26,  /*    REPLACE => ID */\r\n   26,  /*   RESTRICT => ID */\r\n   26,  /*        ROW => ID */\r\n   26,  /*    TRIGGER => ID */\r\n   26,  /*     VACUUM => ID */\r\n   26,  /*       VIEW => ID */\r\n   26,  /*    VIRTUAL => ID */\r\n   26,  /*    REINDEX => ID */\r\n   26,  /*     RENAME => ID */\r\n   26,  /*   CTIME_KW => ID */\r\n};\r\n#endif /* YYFALLBACK */\r\n\r\n/* The following structure represents a single element of the\r\n** parser's stack.  Information stored includes:\r\n**\r\n**   +  The state number for the parser at this level of the stack.\r\n**\r\n**   +  The value of the token stored at this level of the stack.\r\n**      (In other words, the \"major\" token.)\r\n**\r\n**   +  The semantic value stored at this level of the stack.  This is\r\n**      the information used by the action routines in the grammar.\r\n**      It is sometimes called the \"minor\" token.\r\n*/\r\nstruct yyStackEntry {\r\n  YYACTIONTYPE stateno;  /* The state-number */\r\n  YYCODETYPE major;      /* The major token value.  This is the code\r\n                         ** number for the token at this stack level */\r\n  YYMINORTYPE minor;     /* The user-supplied minor token value.  This\r\n                         ** is the value of the token  */\r\n};\r\ntypedef struct yyStackEntry yyStackEntry;\r\n\r\n/* The state of the parser is completely contained in an instance of\r\n** the following structure */\r\nstruct yyParser {\r\n  int yyidx;                    /* Index of top element in stack */\r\n#ifdef YYTRACKMAXSTACKDEPTH\r\n  int yyidxMax;                 /* Maximum value of yyidx */\r\n#endif\r\n  int yyerrcnt;                 /* Shifts left before out of the error */\r\n  sqlite3ParserARG_SDECL                /* A place to hold %extra_argument */\r\n#if YYSTACKDEPTH<=0\r\n  int yystksz;                  /* Current side of the stack */\r\n  yyStackEntry *yystack;        /* The parser's stack */\r\n#else\r\n  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */\r\n#endif\r\n};\r\ntypedef struct yyParser yyParser;\r\n\r\n#ifndef NDEBUG\r\n/* #include <stdio.h> */\r\nstatic FILE *yyTraceFILE = 0;\r\nstatic char *yyTracePrompt = 0;\r\n#endif /* NDEBUG */\r\n\r\n#ifndef NDEBUG\r\n/* \r\n** Turn parser tracing on by giving a stream to which to write the trace\r\n** and a prompt to preface each trace message.  Tracing is turned off\r\n** by making either argument NULL \r\n**\r\n** Inputs:\r\n** <ul>\r\n** <li> A FILE* to which trace output should be written.\r\n**      If NULL, then tracing is turned off.\r\n** <li> A prefix string written at the beginning of every\r\n**      line of trace output.  If NULL, then tracing is\r\n**      turned off.\r\n** </ul>\r\n**\r\n** Outputs:\r\n** None.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){\r\n  yyTraceFILE = TraceFILE;\r\n  yyTracePrompt = zTracePrompt;\r\n  if( yyTraceFILE==0 ) yyTracePrompt = 0;\r\n  else if( yyTracePrompt==0 ) yyTraceFILE = 0;\r\n}\r\n#endif /* NDEBUG */\r\n\r\n#ifndef NDEBUG\r\n/* For tracing shifts, the names of all terminals and nonterminals\r\n** are required.  The following table supplies these names */\r\nstatic const char *const yyTokenName[] = { \r\n  \"$\",             \"SEMI\",          \"EXPLAIN\",       \"QUERY\",       \r\n  \"PLAN\",          \"BEGIN\",         \"TRANSACTION\",   \"DEFERRED\",    \r\n  \"IMMEDIATE\",     \"EXCLUSIVE\",     \"COMMIT\",        \"END\",         \r\n  \"ROLLBACK\",      \"SAVEPOINT\",     \"RELEASE\",       \"TO\",          \r\n  \"TABLE\",         \"CREATE\",        \"IF\",            \"NOT\",         \r\n  \"EXISTS\",        \"TEMP\",          \"LP\",            \"RP\",          \r\n  \"AS\",            \"COMMA\",         \"ID\",            \"INDEXED\",     \r\n  \"ABORT\",         \"ACTION\",        \"AFTER\",         \"ANALYZE\",     \r\n  \"ASC\",           \"ATTACH\",        \"BEFORE\",        \"BY\",          \r\n  \"CASCADE\",       \"CAST\",          \"COLUMNKW\",      \"CONFLICT\",    \r\n  \"DATABASE\",      \"DESC\",          \"DETACH\",        \"EACH\",        \r\n  \"FAIL\",          \"FOR\",           \"IGNORE\",        \"INITIALLY\",   \r\n  \"INSTEAD\",       \"LIKE_KW\",       \"MATCH\",         \"NO\",          \r\n  \"KEY\",           \"OF\",            \"OFFSET\",        \"PRAGMA\",      \r\n  \"RAISE\",         \"REPLACE\",       \"RESTRICT\",      \"ROW\",         \r\n  \"TRIGGER\",       \"VACUUM\",        \"VIEW\",          \"VIRTUAL\",     \r\n  \"REINDEX\",       \"RENAME\",        \"CTIME_KW\",      \"ANY\",         \r\n  \"OR\",            \"AND\",           \"IS\",            \"BETWEEN\",     \r\n  \"IN\",            \"ISNULL\",        \"NOTNULL\",       \"NE\",          \r\n  \"EQ\",            \"GT\",            \"LE\",            \"LT\",          \r\n  \"GE\",            \"ESCAPE\",        \"BITAND\",        \"BITOR\",       \r\n  \"LSHIFT\",        \"RSHIFT\",        \"PLUS\",          \"MINUS\",       \r\n  \"STAR\",          \"SLASH\",         \"REM\",           \"CONCAT\",      \r\n  \"COLLATE\",       \"BITNOT\",        \"STRING\",        \"JOIN_KW\",     \r\n  \"CONSTRAINT\",    \"DEFAULT\",       \"NULL\",          \"PRIMARY\",     \r\n  \"UNIQUE\",        \"CHECK\",         \"REFERENCES\",    \"AUTOINCR\",    \r\n  \"ON\",            \"INSERT\",        \"DELETE\",        \"UPDATE\",      \r\n  \"SET\",           \"DEFERRABLE\",    \"FOREIGN\",       \"DROP\",        \r\n  \"UNION\",         \"ALL\",           \"EXCEPT\",        \"INTERSECT\",   \r\n  \"SELECT\",        \"DISTINCT\",      \"DOT\",           \"FROM\",        \r\n  \"JOIN\",          \"USING\",         \"ORDER\",         \"GROUP\",       \r\n  \"HAVING\",        \"LIMIT\",         \"WHERE\",         \"INTO\",        \r\n  \"VALUES\",        \"INTEGER\",       \"FLOAT\",         \"BLOB\",        \r\n  \"REGISTER\",      \"VARIABLE\",      \"CASE\",          \"WHEN\",        \r\n  \"THEN\",          \"ELSE\",          \"INDEX\",         \"ALTER\",       \r\n  \"ADD\",           \"error\",         \"input\",         \"cmdlist\",     \r\n  \"ecmd\",          \"explain\",       \"cmdx\",          \"cmd\",         \r\n  \"transtype\",     \"trans_opt\",     \"nm\",            \"savepoint_opt\",\r\n  \"create_table\",  \"create_table_args\",  \"createkw\",      \"temp\",        \r\n  \"ifnotexists\",   \"dbnm\",          \"columnlist\",    \"conslist_opt\",\r\n  \"select\",        \"column\",        \"columnid\",      \"type\",        \r\n  \"carglist\",      \"id\",            \"ids\",           \"typetoken\",   \r\n  \"typename\",      \"signed\",        \"plus_num\",      \"minus_num\",   \r\n  \"carg\",          \"ccons\",         \"term\",          \"expr\",        \r\n  \"onconf\",        \"sortorder\",     \"autoinc\",       \"idxlist_opt\", \r\n  \"refargs\",       \"defer_subclause\",  \"refarg\",        \"refact\",      \r\n  \"init_deferred_pred_opt\",  \"conslist\",      \"tcons\",         \"idxlist\",     \r\n  \"defer_subclause_opt\",  \"orconf\",        \"resolvetype\",   \"raisetype\",   \r\n  \"ifexists\",      \"fullname\",      \"oneselect\",     \"multiselect_op\",\r\n  \"distinct\",      \"selcollist\",    \"from\",          \"where_opt\",   \r\n  \"groupby_opt\",   \"having_opt\",    \"orderby_opt\",   \"limit_opt\",   \r\n  \"sclp\",          \"as\",            \"seltablist\",    \"stl_prefix\",  \r\n  \"joinop\",        \"indexed_opt\",   \"on_opt\",        \"using_opt\",   \r\n  \"joinop2\",       \"inscollist\",    \"sortlist\",      \"nexprlist\",   \r\n  \"setlist\",       \"insert_cmd\",    \"inscollist_opt\",  \"valuelist\",   \r\n  \"exprlist\",      \"likeop\",        \"between_op\",    \"in_op\",       \r\n  \"case_operand\",  \"case_exprlist\",  \"case_else\",     \"uniqueflag\",  \r\n  \"collate\",       \"nmnum\",         \"number\",        \"trigger_decl\",\r\n  \"trigger_cmd_list\",  \"trigger_time\",  \"trigger_event\",  \"foreach_clause\",\r\n  \"when_clause\",   \"trigger_cmd\",   \"trnm\",          \"tridxby\",     \r\n  \"database_kw_opt\",  \"key_opt\",       \"add_column_fullname\",  \"kwcolumn_opt\",\r\n  \"create_vtab\",   \"vtabarglist\",   \"vtabarg\",       \"vtabargtoken\",\r\n  \"lp\",            \"anylist\",     \r\n};\r\n#endif /* NDEBUG */\r\n\r\n#ifndef NDEBUG\r\n/* For tracing reduce actions, the names of all rules are required.\r\n*/\r\nstatic const char *const yyRuleName[] = {\r\n /*   0 */ \"input ::= cmdlist\",\r\n /*   1 */ \"cmdlist ::= cmdlist ecmd\",\r\n /*   2 */ \"cmdlist ::= ecmd\",\r\n /*   3 */ \"ecmd ::= SEMI\",\r\n /*   4 */ \"ecmd ::= explain cmdx SEMI\",\r\n /*   5 */ \"explain ::=\",\r\n /*   6 */ \"explain ::= EXPLAIN\",\r\n /*   7 */ \"explain ::= EXPLAIN QUERY PLAN\",\r\n /*   8 */ \"cmdx ::= cmd\",\r\n /*   9 */ \"cmd ::= BEGIN transtype trans_opt\",\r\n /*  10 */ \"trans_opt ::=\",\r\n /*  11 */ \"trans_opt ::= TRANSACTION\",\r\n /*  12 */ \"trans_opt ::= TRANSACTION nm\",\r\n /*  13 */ \"transtype ::=\",\r\n /*  14 */ \"transtype ::= DEFERRED\",\r\n /*  15 */ \"transtype ::= IMMEDIATE\",\r\n /*  16 */ \"transtype ::= EXCLUSIVE\",\r\n /*  17 */ \"cmd ::= COMMIT trans_opt\",\r\n /*  18 */ \"cmd ::= END trans_opt\",\r\n /*  19 */ \"cmd ::= ROLLBACK trans_opt\",\r\n /*  20 */ \"savepoint_opt ::= SAVEPOINT\",\r\n /*  21 */ \"savepoint_opt ::=\",\r\n /*  22 */ \"cmd ::= SAVEPOINT nm\",\r\n /*  23 */ \"cmd ::= RELEASE savepoint_opt nm\",\r\n /*  24 */ \"cmd ::= ROLLBACK trans_opt TO savepoint_opt nm\",\r\n /*  25 */ \"cmd ::= create_table create_table_args\",\r\n /*  26 */ \"create_table ::= createkw temp TABLE ifnotexists nm dbnm\",\r\n /*  27 */ \"createkw ::= CREATE\",\r\n /*  28 */ \"ifnotexists ::=\",\r\n /*  29 */ \"ifnotexists ::= IF NOT EXISTS\",\r\n /*  30 */ \"temp ::= TEMP\",\r\n /*  31 */ \"temp ::=\",\r\n /*  32 */ \"create_table_args ::= LP columnlist conslist_opt RP\",\r\n /*  33 */ \"create_table_args ::= AS select\",\r\n /*  34 */ \"columnlist ::= columnlist COMMA column\",\r\n /*  35 */ \"columnlist ::= column\",\r\n /*  36 */ \"column ::= columnid type carglist\",\r\n /*  37 */ \"columnid ::= nm\",\r\n /*  38 */ \"id ::= ID\",\r\n /*  39 */ \"id ::= INDEXED\",\r\n /*  40 */ \"ids ::= ID|STRING\",\r\n /*  41 */ \"nm ::= id\",\r\n /*  42 */ \"nm ::= STRING\",\r\n /*  43 */ \"nm ::= JOIN_KW\",\r\n /*  44 */ \"type ::=\",\r\n /*  45 */ \"type ::= typetoken\",\r\n /*  46 */ \"typetoken ::= typename\",\r\n /*  47 */ \"typetoken ::= typename LP signed RP\",\r\n /*  48 */ \"typetoken ::= typename LP signed COMMA signed RP\",\r\n /*  49 */ \"typename ::= ids\",\r\n /*  50 */ \"typename ::= typename ids\",\r\n /*  51 */ \"signed ::= plus_num\",\r\n /*  52 */ \"signed ::= minus_num\",\r\n /*  53 */ \"carglist ::= carglist carg\",\r\n /*  54 */ \"carglist ::=\",\r\n /*  55 */ \"carg ::= CONSTRAINT nm ccons\",\r\n /*  56 */ \"carg ::= ccons\",\r\n /*  57 */ \"ccons ::= DEFAULT term\",\r\n /*  58 */ \"ccons ::= DEFAULT LP expr RP\",\r\n /*  59 */ \"ccons ::= DEFAULT PLUS term\",\r\n /*  60 */ \"ccons ::= DEFAULT MINUS term\",\r\n /*  61 */ \"ccons ::= DEFAULT id\",\r\n /*  62 */ \"ccons ::= NULL onconf\",\r\n /*  63 */ \"ccons ::= NOT NULL onconf\",\r\n /*  64 */ \"ccons ::= PRIMARY KEY sortorder onconf autoinc\",\r\n /*  65 */ \"ccons ::= UNIQUE onconf\",\r\n /*  66 */ \"ccons ::= CHECK LP expr RP\",\r\n /*  67 */ \"ccons ::= REFERENCES nm idxlist_opt refargs\",\r\n /*  68 */ \"ccons ::= defer_subclause\",\r\n /*  69 */ \"ccons ::= COLLATE ids\",\r\n /*  70 */ \"autoinc ::=\",\r\n /*  71 */ \"autoinc ::= AUTOINCR\",\r\n /*  72 */ \"refargs ::=\",\r\n /*  73 */ \"refargs ::= refargs refarg\",\r\n /*  74 */ \"refarg ::= MATCH nm\",\r\n /*  75 */ \"refarg ::= ON INSERT refact\",\r\n /*  76 */ \"refarg ::= ON DELETE refact\",\r\n /*  77 */ \"refarg ::= ON UPDATE refact\",\r\n /*  78 */ \"refact ::= SET NULL\",\r\n /*  79 */ \"refact ::= SET DEFAULT\",\r\n /*  80 */ \"refact ::= CASCADE\",\r\n /*  81 */ \"refact ::= RESTRICT\",\r\n /*  82 */ \"refact ::= NO ACTION\",\r\n /*  83 */ \"defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt\",\r\n /*  84 */ \"defer_subclause ::= DEFERRABLE init_deferred_pred_opt\",\r\n /*  85 */ \"init_deferred_pred_opt ::=\",\r\n /*  86 */ \"init_deferred_pred_opt ::= INITIALLY DEFERRED\",\r\n /*  87 */ \"init_deferred_pred_opt ::= INITIALLY IMMEDIATE\",\r\n /*  88 */ \"conslist_opt ::=\",\r\n /*  89 */ \"conslist_opt ::= COMMA conslist\",\r\n /*  90 */ \"conslist ::= conslist COMMA tcons\",\r\n /*  91 */ \"conslist ::= conslist tcons\",\r\n /*  92 */ \"conslist ::= tcons\",\r\n /*  93 */ \"tcons ::= CONSTRAINT nm\",\r\n /*  94 */ \"tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf\",\r\n /*  95 */ \"tcons ::= UNIQUE LP idxlist RP onconf\",\r\n /*  96 */ \"tcons ::= CHECK LP expr RP onconf\",\r\n /*  97 */ \"tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt\",\r\n /*  98 */ \"defer_subclause_opt ::=\",\r\n /*  99 */ \"defer_subclause_opt ::= defer_subclause\",\r\n /* 100 */ \"onconf ::=\",\r\n /* 101 */ \"onconf ::= ON CONFLICT resolvetype\",\r\n /* 102 */ \"orconf ::=\",\r\n /* 103 */ \"orconf ::= OR resolvetype\",\r\n /* 104 */ \"resolvetype ::= raisetype\",\r\n /* 105 */ \"resolvetype ::= IGNORE\",\r\n /* 106 */ \"resolvetype ::= REPLACE\",\r\n /* 107 */ \"cmd ::= DROP TABLE ifexists fullname\",\r\n /* 108 */ \"ifexists ::= IF EXISTS\",\r\n /* 109 */ \"ifexists ::=\",\r\n /* 110 */ \"cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select\",\r\n /* 111 */ \"cmd ::= DROP VIEW ifexists fullname\",\r\n /* 112 */ \"cmd ::= select\",\r\n /* 113 */ \"select ::= oneselect\",\r\n /* 114 */ \"select ::= select multiselect_op oneselect\",\r\n /* 115 */ \"multiselect_op ::= UNION\",\r\n /* 116 */ \"multiselect_op ::= UNION ALL\",\r\n /* 117 */ \"multiselect_op ::= EXCEPT|INTERSECT\",\r\n /* 118 */ \"oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt\",\r\n /* 119 */ \"distinct ::= DISTINCT\",\r\n /* 120 */ \"distinct ::= ALL\",\r\n /* 121 */ \"distinct ::=\",\r\n /* 122 */ \"sclp ::= selcollist COMMA\",\r\n /* 123 */ \"sclp ::=\",\r\n /* 124 */ \"selcollist ::= sclp expr as\",\r\n /* 125 */ \"selcollist ::= sclp STAR\",\r\n /* 126 */ \"selcollist ::= sclp nm DOT STAR\",\r\n /* 127 */ \"as ::= AS nm\",\r\n /* 128 */ \"as ::= ids\",\r\n /* 129 */ \"as ::=\",\r\n /* 130 */ \"from ::=\",\r\n /* 131 */ \"from ::= FROM seltablist\",\r\n /* 132 */ \"stl_prefix ::= seltablist joinop\",\r\n /* 133 */ \"stl_prefix ::=\",\r\n /* 134 */ \"seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt\",\r\n /* 135 */ \"seltablist ::= stl_prefix LP select RP as on_opt using_opt\",\r\n /* 136 */ \"seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt\",\r\n /* 137 */ \"dbnm ::=\",\r\n /* 138 */ \"dbnm ::= DOT nm\",\r\n /* 139 */ \"fullname ::= nm dbnm\",\r\n /* 140 */ \"joinop ::= COMMA|JOIN\",\r\n /* 141 */ \"joinop ::= JOIN_KW JOIN\",\r\n /* 142 */ \"joinop ::= JOIN_KW nm JOIN\",\r\n /* 143 */ \"joinop ::= JOIN_KW nm nm JOIN\",\r\n /* 144 */ \"on_opt ::= ON expr\",\r\n /* 145 */ \"on_opt ::=\",\r\n /* 146 */ \"indexed_opt ::=\",\r\n /* 147 */ \"indexed_opt ::= INDEXED BY nm\",\r\n /* 148 */ \"indexed_opt ::= NOT INDEXED\",\r\n /* 149 */ \"using_opt ::= USING LP inscollist RP\",\r\n /* 150 */ \"using_opt ::=\",\r\n /* 151 */ \"orderby_opt ::=\",\r\n /* 152 */ \"orderby_opt ::= ORDER BY sortlist\",\r\n /* 153 */ \"sortlist ::= sortlist COMMA expr sortorder\",\r\n /* 154 */ \"sortlist ::= expr sortorder\",\r\n /* 155 */ \"sortorder ::= ASC\",\r\n /* 156 */ \"sortorder ::= DESC\",\r\n /* 157 */ \"sortorder ::=\",\r\n /* 158 */ \"groupby_opt ::=\",\r\n /* 159 */ \"groupby_opt ::= GROUP BY nexprlist\",\r\n /* 160 */ \"having_opt ::=\",\r\n /* 161 */ \"having_opt ::= HAVING expr\",\r\n /* 162 */ \"limit_opt ::=\",\r\n /* 163 */ \"limit_opt ::= LIMIT expr\",\r\n /* 164 */ \"limit_opt ::= LIMIT expr OFFSET expr\",\r\n /* 165 */ \"limit_opt ::= LIMIT expr COMMA expr\",\r\n /* 166 */ \"cmd ::= DELETE FROM fullname indexed_opt where_opt\",\r\n /* 167 */ \"where_opt ::=\",\r\n /* 168 */ \"where_opt ::= WHERE expr\",\r\n /* 169 */ \"cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt\",\r\n /* 170 */ \"setlist ::= setlist COMMA nm EQ expr\",\r\n /* 171 */ \"setlist ::= nm EQ expr\",\r\n /* 172 */ \"cmd ::= insert_cmd INTO fullname inscollist_opt valuelist\",\r\n /* 173 */ \"cmd ::= insert_cmd INTO fullname inscollist_opt select\",\r\n /* 174 */ \"cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES\",\r\n /* 175 */ \"insert_cmd ::= INSERT orconf\",\r\n /* 176 */ \"insert_cmd ::= REPLACE\",\r\n /* 177 */ \"valuelist ::= VALUES LP nexprlist RP\",\r\n /* 178 */ \"valuelist ::= valuelist COMMA LP exprlist RP\",\r\n /* 179 */ \"inscollist_opt ::=\",\r\n /* 180 */ \"inscollist_opt ::= LP inscollist RP\",\r\n /* 181 */ \"inscollist ::= inscollist COMMA nm\",\r\n /* 182 */ \"inscollist ::= nm\",\r\n /* 183 */ \"expr ::= term\",\r\n /* 184 */ \"expr ::= LP expr RP\",\r\n /* 185 */ \"term ::= NULL\",\r\n /* 186 */ \"expr ::= id\",\r\n /* 187 */ \"expr ::= JOIN_KW\",\r\n /* 188 */ \"expr ::= nm DOT nm\",\r\n /* 189 */ \"expr ::= nm DOT nm DOT nm\",\r\n /* 190 */ \"term ::= INTEGER|FLOAT|BLOB\",\r\n /* 191 */ \"term ::= STRING\",\r\n /* 192 */ \"expr ::= REGISTER\",\r\n /* 193 */ \"expr ::= VARIABLE\",\r\n /* 194 */ \"expr ::= expr COLLATE ids\",\r\n /* 195 */ \"expr ::= CAST LP expr AS typetoken RP\",\r\n /* 196 */ \"expr ::= ID LP distinct exprlist RP\",\r\n /* 197 */ \"expr ::= ID LP STAR RP\",\r\n /* 198 */ \"term ::= CTIME_KW\",\r\n /* 199 */ \"expr ::= expr AND expr\",\r\n /* 200 */ \"expr ::= expr OR expr\",\r\n /* 201 */ \"expr ::= expr LT|GT|GE|LE expr\",\r\n /* 202 */ \"expr ::= expr EQ|NE expr\",\r\n /* 203 */ \"expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr\",\r\n /* 204 */ \"expr ::= expr PLUS|MINUS expr\",\r\n /* 205 */ \"expr ::= expr STAR|SLASH|REM expr\",\r\n /* 206 */ \"expr ::= expr CONCAT expr\",\r\n /* 207 */ \"likeop ::= LIKE_KW\",\r\n /* 208 */ \"likeop ::= NOT LIKE_KW\",\r\n /* 209 */ \"likeop ::= MATCH\",\r\n /* 210 */ \"likeop ::= NOT MATCH\",\r\n /* 211 */ \"expr ::= expr likeop expr\",\r\n /* 212 */ \"expr ::= expr likeop expr ESCAPE expr\",\r\n /* 213 */ \"expr ::= expr ISNULL|NOTNULL\",\r\n /* 214 */ \"expr ::= expr NOT NULL\",\r\n /* 215 */ \"expr ::= expr IS expr\",\r\n /* 216 */ \"expr ::= expr IS NOT expr\",\r\n /* 217 */ \"expr ::= NOT expr\",\r\n /* 218 */ \"expr ::= BITNOT expr\",\r\n /* 219 */ \"expr ::= MINUS expr\",\r\n /* 220 */ \"expr ::= PLUS expr\",\r\n /* 221 */ \"between_op ::= BETWEEN\",\r\n /* 222 */ \"between_op ::= NOT BETWEEN\",\r\n /* 223 */ \"expr ::= expr between_op expr AND expr\",\r\n /* 224 */ \"in_op ::= IN\",\r\n /* 225 */ \"in_op ::= NOT IN\",\r\n /* 226 */ \"expr ::= expr in_op LP exprlist RP\",\r\n /* 227 */ \"expr ::= LP select RP\",\r\n /* 228 */ \"expr ::= expr in_op LP select RP\",\r\n /* 229 */ \"expr ::= expr in_op nm dbnm\",\r\n /* 230 */ \"expr ::= EXISTS LP select RP\",\r\n /* 231 */ \"expr ::= CASE case_operand case_exprlist case_else END\",\r\n /* 232 */ \"case_exprlist ::= case_exprlist WHEN expr THEN expr\",\r\n /* 233 */ \"case_exprlist ::= WHEN expr THEN expr\",\r\n /* 234 */ \"case_else ::= ELSE expr\",\r\n /* 235 */ \"case_else ::=\",\r\n /* 236 */ \"case_operand ::= expr\",\r\n /* 237 */ \"case_operand ::=\",\r\n /* 238 */ \"exprlist ::= nexprlist\",\r\n /* 239 */ \"exprlist ::=\",\r\n /* 240 */ \"nexprlist ::= nexprlist COMMA expr\",\r\n /* 241 */ \"nexprlist ::= expr\",\r\n /* 242 */ \"cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP\",\r\n /* 243 */ \"uniqueflag ::= UNIQUE\",\r\n /* 244 */ \"uniqueflag ::=\",\r\n /* 245 */ \"idxlist_opt ::=\",\r\n /* 246 */ \"idxlist_opt ::= LP idxlist RP\",\r\n /* 247 */ \"idxlist ::= idxlist COMMA nm collate sortorder\",\r\n /* 248 */ \"idxlist ::= nm collate sortorder\",\r\n /* 249 */ \"collate ::=\",\r\n /* 250 */ \"collate ::= COLLATE ids\",\r\n /* 251 */ \"cmd ::= DROP INDEX ifexists fullname\",\r\n /* 252 */ \"cmd ::= VACUUM\",\r\n /* 253 */ \"cmd ::= VACUUM nm\",\r\n /* 254 */ \"cmd ::= PRAGMA nm dbnm\",\r\n /* 255 */ \"cmd ::= PRAGMA nm dbnm EQ nmnum\",\r\n /* 256 */ \"cmd ::= PRAGMA nm dbnm LP nmnum RP\",\r\n /* 257 */ \"cmd ::= PRAGMA nm dbnm EQ minus_num\",\r\n /* 258 */ \"cmd ::= PRAGMA nm dbnm LP minus_num RP\",\r\n /* 259 */ \"nmnum ::= plus_num\",\r\n /* 260 */ \"nmnum ::= nm\",\r\n /* 261 */ \"nmnum ::= ON\",\r\n /* 262 */ \"nmnum ::= DELETE\",\r\n /* 263 */ \"nmnum ::= DEFAULT\",\r\n /* 264 */ \"plus_num ::= PLUS number\",\r\n /* 265 */ \"plus_num ::= number\",\r\n /* 266 */ \"minus_num ::= MINUS number\",\r\n /* 267 */ \"number ::= INTEGER|FLOAT\",\r\n /* 268 */ \"cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END\",\r\n /* 269 */ \"trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause\",\r\n /* 270 */ \"trigger_time ::= BEFORE\",\r\n /* 271 */ \"trigger_time ::= AFTER\",\r\n /* 272 */ \"trigger_time ::= INSTEAD OF\",\r\n /* 273 */ \"trigger_time ::=\",\r\n /* 274 */ \"trigger_event ::= DELETE|INSERT\",\r\n /* 275 */ \"trigger_event ::= UPDATE\",\r\n /* 276 */ \"trigger_event ::= UPDATE OF inscollist\",\r\n /* 277 */ \"foreach_clause ::=\",\r\n /* 278 */ \"foreach_clause ::= FOR EACH ROW\",\r\n /* 279 */ \"when_clause ::=\",\r\n /* 280 */ \"when_clause ::= WHEN expr\",\r\n /* 281 */ \"trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI\",\r\n /* 282 */ \"trigger_cmd_list ::= trigger_cmd SEMI\",\r\n /* 283 */ \"trnm ::= nm\",\r\n /* 284 */ \"trnm ::= nm DOT nm\",\r\n /* 285 */ \"tridxby ::=\",\r\n /* 286 */ \"tridxby ::= INDEXED BY nm\",\r\n /* 287 */ \"tridxby ::= NOT INDEXED\",\r\n /* 288 */ \"trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt\",\r\n /* 289 */ \"trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist\",\r\n /* 290 */ \"trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select\",\r\n /* 291 */ \"trigger_cmd ::= DELETE FROM trnm tridxby where_opt\",\r\n /* 292 */ \"trigger_cmd ::= select\",\r\n /* 293 */ \"expr ::= RAISE LP IGNORE RP\",\r\n /* 294 */ \"expr ::= RAISE LP raisetype COMMA nm RP\",\r\n /* 295 */ \"raisetype ::= ROLLBACK\",\r\n /* 296 */ \"raisetype ::= ABORT\",\r\n /* 297 */ \"raisetype ::= FAIL\",\r\n /* 298 */ \"cmd ::= DROP TRIGGER ifexists fullname\",\r\n /* 299 */ \"cmd ::= ATTACH database_kw_opt expr AS expr key_opt\",\r\n /* 300 */ \"cmd ::= DETACH database_kw_opt expr\",\r\n /* 301 */ \"key_opt ::=\",\r\n /* 302 */ \"key_opt ::= KEY expr\",\r\n /* 303 */ \"database_kw_opt ::= DATABASE\",\r\n /* 304 */ \"database_kw_opt ::=\",\r\n /* 305 */ \"cmd ::= REINDEX\",\r\n /* 306 */ \"cmd ::= REINDEX nm dbnm\",\r\n /* 307 */ \"cmd ::= ANALYZE\",\r\n /* 308 */ \"cmd ::= ANALYZE nm dbnm\",\r\n /* 309 */ \"cmd ::= ALTER TABLE fullname RENAME TO nm\",\r\n /* 310 */ \"cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column\",\r\n /* 311 */ \"add_column_fullname ::= fullname\",\r\n /* 312 */ \"kwcolumn_opt ::=\",\r\n /* 313 */ \"kwcolumn_opt ::= COLUMNKW\",\r\n /* 314 */ \"cmd ::= create_vtab\",\r\n /* 315 */ \"cmd ::= create_vtab LP vtabarglist RP\",\r\n /* 316 */ \"create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm\",\r\n /* 317 */ \"vtabarglist ::= vtabarg\",\r\n /* 318 */ \"vtabarglist ::= vtabarglist COMMA vtabarg\",\r\n /* 319 */ \"vtabarg ::=\",\r\n /* 320 */ \"vtabarg ::= vtabarg vtabargtoken\",\r\n /* 321 */ \"vtabargtoken ::= ANY\",\r\n /* 322 */ \"vtabargtoken ::= lp anylist RP\",\r\n /* 323 */ \"lp ::= LP\",\r\n /* 324 */ \"anylist ::=\",\r\n /* 325 */ \"anylist ::= anylist LP anylist RP\",\r\n /* 326 */ \"anylist ::= anylist ANY\",\r\n};\r\n#endif /* NDEBUG */\r\n\r\n\r\n#if YYSTACKDEPTH<=0\r\n/*\r\n** Try to increase the size of the parser stack.\r\n*/\r\nstatic void yyGrowStack(yyParser *p){\r\n  int newSize;\r\n  yyStackEntry *pNew;\r\n\r\n  newSize = p->yystksz*2 + 100;\r\n  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));\r\n  if( pNew ){\r\n    p->yystack = pNew;\r\n    p->yystksz = newSize;\r\n#ifndef NDEBUG\r\n    if( yyTraceFILE ){\r\n      fprintf(yyTraceFILE,\"%sStack grows to %d entries!\\n\",\r\n              yyTracePrompt, p->yystksz);\r\n    }\r\n#endif\r\n  }\r\n}\r\n#endif\r\n\r\n/* \r\n** This function allocates a new parser.\r\n** The only argument is a pointer to a function which works like\r\n** malloc.\r\n**\r\n** Inputs:\r\n** A pointer to the function used to allocate memory.\r\n**\r\n** Outputs:\r\n** A pointer to a parser.  This pointer is used in subsequent calls\r\n** to sqlite3Parser and sqlite3ParserFree.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(size_t)){\r\n  yyParser *pParser;\r\n  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );\r\n  if( pParser ){\r\n    pParser->yyidx = -1;\r\n#ifdef YYTRACKMAXSTACKDEPTH\r\n    pParser->yyidxMax = 0;\r\n#endif\r\n#if YYSTACKDEPTH<=0\r\n    pParser->yystack = NULL;\r\n    pParser->yystksz = 0;\r\n    yyGrowStack(pParser);\r\n#endif\r\n  }\r\n  return pParser;\r\n}\r\n\r\n/* The following function deletes the value associated with a\r\n** symbol.  The symbol can be either a terminal or nonterminal.\r\n** \"yymajor\" is the symbol code, and \"yypminor\" is a pointer to\r\n** the value.\r\n*/\r\nstatic void yy_destructor(\r\n  yyParser *yypParser,    /* The parser */\r\n  YYCODETYPE yymajor,     /* Type code for object to destroy */\r\n  YYMINORTYPE *yypminor   /* The object to be destroyed */\r\n){\r\n  sqlite3ParserARG_FETCH;\r\n  switch( yymajor ){\r\n    /* Here is inserted the actions which take place when a\r\n    ** terminal or non-terminal is destroyed.  This can happen\r\n    ** when the symbol is popped from the stack during a\r\n    ** reduce or during error processing or when a parser is \r\n    ** being destroyed before it is finished parsing.\r\n    **\r\n    ** Note: during a reduce, the only symbols destroyed are those\r\n    ** which appear on the RHS of the rule, but which are not used\r\n    ** inside the C code.\r\n    */\r\n    case 160: /* select */\r\n    case 194: /* oneselect */\r\n{\r\nsqlite3SelectDelete(pParse->db, (yypminor->yy159));\r\n}\r\n      break;\r\n    case 174: /* term */\r\n    case 175: /* expr */\r\n{\r\nsqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr);\r\n}\r\n      break;\r\n    case 179: /* idxlist_opt */\r\n    case 187: /* idxlist */\r\n    case 197: /* selcollist */\r\n    case 200: /* groupby_opt */\r\n    case 202: /* orderby_opt */\r\n    case 204: /* sclp */\r\n    case 214: /* sortlist */\r\n    case 215: /* nexprlist */\r\n    case 216: /* setlist */\r\n    case 220: /* exprlist */\r\n    case 225: /* case_exprlist */\r\n{\r\nsqlite3ExprListDelete(pParse->db, (yypminor->yy442));\r\n}\r\n      break;\r\n    case 193: /* fullname */\r\n    case 198: /* from */\r\n    case 206: /* seltablist */\r\n    case 207: /* stl_prefix */\r\n{\r\nsqlite3SrcListDelete(pParse->db, (yypminor->yy347));\r\n}\r\n      break;\r\n    case 199: /* where_opt */\r\n    case 201: /* having_opt */\r\n    case 210: /* on_opt */\r\n    case 224: /* case_operand */\r\n    case 226: /* case_else */\r\n    case 236: /* when_clause */\r\n    case 241: /* key_opt */\r\n{\r\nsqlite3ExprDelete(pParse->db, (yypminor->yy122));\r\n}\r\n      break;\r\n    case 211: /* using_opt */\r\n    case 213: /* inscollist */\r\n    case 218: /* inscollist_opt */\r\n{\r\nsqlite3IdListDelete(pParse->db, (yypminor->yy180));\r\n}\r\n      break;\r\n    case 219: /* valuelist */\r\n{\r\n\r\n  sqlite3ExprListDelete(pParse->db, (yypminor->yy487).pList);\r\n  sqlite3SelectDelete(pParse->db, (yypminor->yy487).pSelect);\r\n\r\n}\r\n      break;\r\n    case 232: /* trigger_cmd_list */\r\n    case 237: /* trigger_cmd */\r\n{\r\nsqlite3DeleteTriggerStep(pParse->db, (yypminor->yy327));\r\n}\r\n      break;\r\n    case 234: /* trigger_event */\r\n{\r\nsqlite3IdListDelete(pParse->db, (yypminor->yy410).b);\r\n}\r\n      break;\r\n    default:  break;   /* If no destructor action specified: do nothing */\r\n  }\r\n}\r\n\r\n/*\r\n** Pop the parser's stack once.\r\n**\r\n** If there is a destructor routine associated with the token which\r\n** is popped from the stack, then call it.\r\n**\r\n** Return the major token number for the symbol popped.\r\n*/\r\nstatic int yy_pop_parser_stack(yyParser *pParser){\r\n  YYCODETYPE yymajor;\r\n  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];\r\n\r\n  /* There is no mechanism by which the parser stack can be popped below\r\n  ** empty in SQLite.  */\r\n  if( NEVER(pParser->yyidx<0) ) return 0;\r\n#ifndef NDEBUG\r\n  if( yyTraceFILE && pParser->yyidx>=0 ){\r\n    fprintf(yyTraceFILE,\"%sPopping %s\\n\",\r\n      yyTracePrompt,\r\n      yyTokenName[yytos->major]);\r\n  }\r\n#endif\r\n  yymajor = yytos->major;\r\n  yy_destructor(pParser, yymajor, &yytos->minor);\r\n  pParser->yyidx--;\r\n  return yymajor;\r\n}\r\n\r\n/* \r\n** Deallocate and destroy a parser.  Destructors are all called for\r\n** all stack elements before shutting the parser down.\r\n**\r\n** Inputs:\r\n** <ul>\r\n** <li>  A pointer to the parser.  This should be a pointer\r\n**       obtained from sqlite3ParserAlloc.\r\n** <li>  A pointer to a function used to reclaim memory obtained\r\n**       from malloc.\r\n** </ul>\r\n*/\r\nSQLITE_PRIVATE void sqlite3ParserFree(\r\n  void *p,                    /* The parser to be deleted */\r\n  void (*freeProc)(void*)     /* Function used to reclaim memory */\r\n){\r\n  yyParser *pParser = (yyParser*)p;\r\n  /* In SQLite, we never try to destroy a parser that was not successfully\r\n  ** created in the first place. */\r\n  if( NEVER(pParser==0) ) return;\r\n  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);\r\n#if YYSTACKDEPTH<=0\r\n  free(pParser->yystack);\r\n#endif\r\n  (*freeProc)((void*)pParser);\r\n}\r\n\r\n/*\r\n** Return the peak depth of the stack for a parser.\r\n*/\r\n#ifdef YYTRACKMAXSTACKDEPTH\r\nSQLITE_PRIVATE int sqlite3ParserStackPeak(void *p){\r\n  yyParser *pParser = (yyParser*)p;\r\n  return pParser->yyidxMax;\r\n}\r\n#endif\r\n\r\n/*\r\n** Find the appropriate action for a parser given the terminal\r\n** look-ahead token iLookAhead.\r\n**\r\n** If the look-ahead token is YYNOCODE, then check to see if the action is\r\n** independent of the look-ahead.  If it is, return the action, otherwise\r\n** return YY_NO_ACTION.\r\n*/\r\nstatic int yy_find_shift_action(\r\n  yyParser *pParser,        /* The parser */\r\n  YYCODETYPE iLookAhead     /* The look-ahead token */\r\n){\r\n  int i;\r\n  int stateno = pParser->yystack[pParser->yyidx].stateno;\r\n \r\n  if( stateno>YY_SHIFT_COUNT\r\n   || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){\r\n    return yy_default[stateno];\r\n  }\r\n  assert( iLookAhead!=YYNOCODE );\r\n  i += iLookAhead;\r\n  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){\r\n    if( iLookAhead>0 ){\r\n#ifdef YYFALLBACK\r\n      YYCODETYPE iFallback;            /* Fallback token */\r\n      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])\r\n             && (iFallback = yyFallback[iLookAhead])!=0 ){\r\n#ifndef NDEBUG\r\n        if( yyTraceFILE ){\r\n          fprintf(yyTraceFILE, \"%sFALLBACK %s => %s\\n\",\r\n             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);\r\n        }\r\n#endif\r\n        return yy_find_shift_action(pParser, iFallback);\r\n      }\r\n#endif\r\n#ifdef YYWILDCARD\r\n      {\r\n        int j = i - iLookAhead + YYWILDCARD;\r\n        if( \r\n#if YY_SHIFT_MIN+YYWILDCARD<0\r\n          j>=0 &&\r\n#endif\r\n#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT\r\n          j<YY_ACTTAB_COUNT &&\r\n#endif\r\n          yy_lookahead[j]==YYWILDCARD\r\n        ){\r\n#ifndef NDEBUG\r\n          if( yyTraceFILE ){\r\n            fprintf(yyTraceFILE, \"%sWILDCARD %s => %s\\n\",\r\n               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);\r\n          }\r\n#endif /* NDEBUG */\r\n          return yy_action[j];\r\n        }\r\n      }\r\n#endif /* YYWILDCARD */\r\n    }\r\n    return yy_default[stateno];\r\n  }else{\r\n    return yy_action[i];\r\n  }\r\n}\r\n\r\n/*\r\n** Find the appropriate action for a parser given the non-terminal\r\n** look-ahead token iLookAhead.\r\n**\r\n** If the look-ahead token is YYNOCODE, then check to see if the action is\r\n** independent of the look-ahead.  If it is, return the action, otherwise\r\n** return YY_NO_ACTION.\r\n*/\r\nstatic int yy_find_reduce_action(\r\n  int stateno,              /* Current state number */\r\n  YYCODETYPE iLookAhead     /* The look-ahead token */\r\n){\r\n  int i;\r\n#ifdef YYERRORSYMBOL\r\n  if( stateno>YY_REDUCE_COUNT ){\r\n    return yy_default[stateno];\r\n  }\r\n#else\r\n  assert( stateno<=YY_REDUCE_COUNT );\r\n#endif\r\n  i = yy_reduce_ofst[stateno];\r\n  assert( i!=YY_REDUCE_USE_DFLT );\r\n  assert( iLookAhead!=YYNOCODE );\r\n  i += iLookAhead;\r\n#ifdef YYERRORSYMBOL\r\n  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){\r\n    return yy_default[stateno];\r\n  }\r\n#else\r\n  assert( i>=0 && i<YY_ACTTAB_COUNT );\r\n  assert( yy_lookahead[i]==iLookAhead );\r\n#endif\r\n  return yy_action[i];\r\n}\r\n\r\n/*\r\n** The following routine is called if the stack overflows.\r\n*/\r\nstatic void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){\r\n   sqlite3ParserARG_FETCH;\r\n   yypParser->yyidx--;\r\n#ifndef NDEBUG\r\n   if( yyTraceFILE ){\r\n     fprintf(yyTraceFILE,\"%sStack Overflow!\\n\",yyTracePrompt);\r\n   }\r\n#endif\r\n   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);\r\n   /* Here code is inserted which will execute if the parser\r\n   ** stack every overflows */\r\n\r\n  UNUSED_PARAMETER(yypMinor); /* Silence some compiler warnings */\r\n  sqlite3ErrorMsg(pParse, \"parser stack overflow\");\r\n   sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */\r\n}\r\n\r\n/*\r\n** Perform a shift action.\r\n*/\r\nstatic void yy_shift(\r\n  yyParser *yypParser,          /* The parser to be shifted */\r\n  int yyNewState,               /* The new state to shift in */\r\n  int yyMajor,                  /* The major token to shift in */\r\n  YYMINORTYPE *yypMinor         /* Pointer to the minor token to shift in */\r\n){\r\n  yyStackEntry *yytos;\r\n  yypParser->yyidx++;\r\n#ifdef YYTRACKMAXSTACKDEPTH\r\n  if( yypParser->yyidx>yypParser->yyidxMax ){\r\n    yypParser->yyidxMax = yypParser->yyidx;\r\n  }\r\n#endif\r\n#if YYSTACKDEPTH>0 \r\n  if( yypParser->yyidx>=YYSTACKDEPTH ){\r\n    yyStackOverflow(yypParser, yypMinor);\r\n    return;\r\n  }\r\n#else\r\n  if( yypParser->yyidx>=yypParser->yystksz ){\r\n    yyGrowStack(yypParser);\r\n    if( yypParser->yyidx>=yypParser->yystksz ){\r\n      yyStackOverflow(yypParser, yypMinor);\r\n      return;\r\n    }\r\n  }\r\n#endif\r\n  yytos = &yypParser->yystack[yypParser->yyidx];\r\n  yytos->stateno = (YYACTIONTYPE)yyNewState;\r\n  yytos->major = (YYCODETYPE)yyMajor;\r\n  yytos->minor = *yypMinor;\r\n#ifndef NDEBUG\r\n  if( yyTraceFILE && yypParser->yyidx>0 ){\r\n    int i;\r\n    fprintf(yyTraceFILE,\"%sShift %d\\n\",yyTracePrompt,yyNewState);\r\n    fprintf(yyTraceFILE,\"%sStack:\",yyTracePrompt);\r\n    for(i=1; i<=yypParser->yyidx; i++)\r\n      fprintf(yyTraceFILE,\" %s\",yyTokenName[yypParser->yystack[i].major]);\r\n    fprintf(yyTraceFILE,\"\\n\");\r\n  }\r\n#endif\r\n}\r\n\r\n/* The following table contains information about every rule that\r\n** is used during the reduce.\r\n*/\r\nstatic const struct {\r\n  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */\r\n  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */\r\n} yyRuleInfo[] = {\r\n  { 142, 1 },\r\n  { 143, 2 },\r\n  { 143, 1 },\r\n  { 144, 1 },\r\n  { 144, 3 },\r\n  { 145, 0 },\r\n  { 145, 1 },\r\n  { 145, 3 },\r\n  { 146, 1 },\r\n  { 147, 3 },\r\n  { 149, 0 },\r\n  { 149, 1 },\r\n  { 149, 2 },\r\n  { 148, 0 },\r\n  { 148, 1 },\r\n  { 148, 1 },\r\n  { 148, 1 },\r\n  { 147, 2 },\r\n  { 147, 2 },\r\n  { 147, 2 },\r\n  { 151, 1 },\r\n  { 151, 0 },\r\n  { 147, 2 },\r\n  { 147, 3 },\r\n  { 147, 5 },\r\n  { 147, 2 },\r\n  { 152, 6 },\r\n  { 154, 1 },\r\n  { 156, 0 },\r\n  { 156, 3 },\r\n  { 155, 1 },\r\n  { 155, 0 },\r\n  { 153, 4 },\r\n  { 153, 2 },\r\n  { 158, 3 },\r\n  { 158, 1 },\r\n  { 161, 3 },\r\n  { 162, 1 },\r\n  { 165, 1 },\r\n  { 165, 1 },\r\n  { 166, 1 },\r\n  { 150, 1 },\r\n  { 150, 1 },\r\n  { 150, 1 },\r\n  { 163, 0 },\r\n  { 163, 1 },\r\n  { 167, 1 },\r\n  { 167, 4 },\r\n  { 167, 6 },\r\n  { 168, 1 },\r\n  { 168, 2 },\r\n  { 169, 1 },\r\n  { 169, 1 },\r\n  { 164, 2 },\r\n  { 164, 0 },\r\n  { 172, 3 },\r\n  { 172, 1 },\r\n  { 173, 2 },\r\n  { 173, 4 },\r\n  { 173, 3 },\r\n  { 173, 3 },\r\n  { 173, 2 },\r\n  { 173, 2 },\r\n  { 173, 3 },\r\n  { 173, 5 },\r\n  { 173, 2 },\r\n  { 173, 4 },\r\n  { 173, 4 },\r\n  { 173, 1 },\r\n  { 173, 2 },\r\n  { 178, 0 },\r\n  { 178, 1 },\r\n  { 180, 0 },\r\n  { 180, 2 },\r\n  { 182, 2 },\r\n  { 182, 3 },\r\n  { 182, 3 },\r\n  { 182, 3 },\r\n  { 183, 2 },\r\n  { 183, 2 },\r\n  { 183, 1 },\r\n  { 183, 1 },\r\n  { 183, 2 },\r\n  { 181, 3 },\r\n  { 181, 2 },\r\n  { 184, 0 },\r\n  { 184, 2 },\r\n  { 184, 2 },\r\n  { 159, 0 },\r\n  { 159, 2 },\r\n  { 185, 3 },\r\n  { 185, 2 },\r\n  { 185, 1 },\r\n  { 186, 2 },\r\n  { 186, 7 },\r\n  { 186, 5 },\r\n  { 186, 5 },\r\n  { 186, 10 },\r\n  { 188, 0 },\r\n  { 188, 1 },\r\n  { 176, 0 },\r\n  { 176, 3 },\r\n  { 189, 0 },\r\n  { 189, 2 },\r\n  { 190, 1 },\r\n  { 190, 1 },\r\n  { 190, 1 },\r\n  { 147, 4 },\r\n  { 192, 2 },\r\n  { 192, 0 },\r\n  { 147, 8 },\r\n  { 147, 4 },\r\n  { 147, 1 },\r\n  { 160, 1 },\r\n  { 160, 3 },\r\n  { 195, 1 },\r\n  { 195, 2 },\r\n  { 195, 1 },\r\n  { 194, 9 },\r\n  { 196, 1 },\r\n  { 196, 1 },\r\n  { 196, 0 },\r\n  { 204, 2 },\r\n  { 204, 0 },\r\n  { 197, 3 },\r\n  { 197, 2 },\r\n  { 197, 4 },\r\n  { 205, 2 },\r\n  { 205, 1 },\r\n  { 205, 0 },\r\n  { 198, 0 },\r\n  { 198, 2 },\r\n  { 207, 2 },\r\n  { 207, 0 },\r\n  { 206, 7 },\r\n  { 206, 7 },\r\n  { 206, 7 },\r\n  { 157, 0 },\r\n  { 157, 2 },\r\n  { 193, 2 },\r\n  { 208, 1 },\r\n  { 208, 2 },\r\n  { 208, 3 },\r\n  { 208, 4 },\r\n  { 210, 2 },\r\n  { 210, 0 },\r\n  { 209, 0 },\r\n  { 209, 3 },\r\n  { 209, 2 },\r\n  { 211, 4 },\r\n  { 211, 0 },\r\n  { 202, 0 },\r\n  { 202, 3 },\r\n  { 214, 4 },\r\n  { 214, 2 },\r\n  { 177, 1 },\r\n  { 177, 1 },\r\n  { 177, 0 },\r\n  { 200, 0 },\r\n  { 200, 3 },\r\n  { 201, 0 },\r\n  { 201, 2 },\r\n  { 203, 0 },\r\n  { 203, 2 },\r\n  { 203, 4 },\r\n  { 203, 4 },\r\n  { 147, 5 },\r\n  { 199, 0 },\r\n  { 199, 2 },\r\n  { 147, 7 },\r\n  { 216, 5 },\r\n  { 216, 3 },\r\n  { 147, 5 },\r\n  { 147, 5 },\r\n  { 147, 6 },\r\n  { 217, 2 },\r\n  { 217, 1 },\r\n  { 219, 4 },\r\n  { 219, 5 },\r\n  { 218, 0 },\r\n  { 218, 3 },\r\n  { 213, 3 },\r\n  { 213, 1 },\r\n  { 175, 1 },\r\n  { 175, 3 },\r\n  { 174, 1 },\r\n  { 175, 1 },\r\n  { 175, 1 },\r\n  { 175, 3 },\r\n  { 175, 5 },\r\n  { 174, 1 },\r\n  { 174, 1 },\r\n  { 175, 1 },\r\n  { 175, 1 },\r\n  { 175, 3 },\r\n  { 175, 6 },\r\n  { 175, 5 },\r\n  { 175, 4 },\r\n  { 174, 1 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 221, 1 },\r\n  { 221, 2 },\r\n  { 221, 1 },\r\n  { 221, 2 },\r\n  { 175, 3 },\r\n  { 175, 5 },\r\n  { 175, 2 },\r\n  { 175, 3 },\r\n  { 175, 3 },\r\n  { 175, 4 },\r\n  { 175, 2 },\r\n  { 175, 2 },\r\n  { 175, 2 },\r\n  { 175, 2 },\r\n  { 222, 1 },\r\n  { 222, 2 },\r\n  { 175, 5 },\r\n  { 223, 1 },\r\n  { 223, 2 },\r\n  { 175, 5 },\r\n  { 175, 3 },\r\n  { 175, 5 },\r\n  { 175, 4 },\r\n  { 175, 4 },\r\n  { 175, 5 },\r\n  { 225, 5 },\r\n  { 225, 4 },\r\n  { 226, 2 },\r\n  { 226, 0 },\r\n  { 224, 1 },\r\n  { 224, 0 },\r\n  { 220, 1 },\r\n  { 220, 0 },\r\n  { 215, 3 },\r\n  { 215, 1 },\r\n  { 147, 11 },\r\n  { 227, 1 },\r\n  { 227, 0 },\r\n  { 179, 0 },\r\n  { 179, 3 },\r\n  { 187, 5 },\r\n  { 187, 3 },\r\n  { 228, 0 },\r\n  { 228, 2 },\r\n  { 147, 4 },\r\n  { 147, 1 },\r\n  { 147, 2 },\r\n  { 147, 3 },\r\n  { 147, 5 },\r\n  { 147, 6 },\r\n  { 147, 5 },\r\n  { 147, 6 },\r\n  { 229, 1 },\r\n  { 229, 1 },\r\n  { 229, 1 },\r\n  { 229, 1 },\r\n  { 229, 1 },\r\n  { 170, 2 },\r\n  { 170, 1 },\r\n  { 171, 2 },\r\n  { 230, 1 },\r\n  { 147, 5 },\r\n  { 231, 11 },\r\n  { 233, 1 },\r\n  { 233, 1 },\r\n  { 233, 2 },\r\n  { 233, 0 },\r\n  { 234, 1 },\r\n  { 234, 1 },\r\n  { 234, 3 },\r\n  { 235, 0 },\r\n  { 235, 3 },\r\n  { 236, 0 },\r\n  { 236, 2 },\r\n  { 232, 3 },\r\n  { 232, 2 },\r\n  { 238, 1 },\r\n  { 238, 3 },\r\n  { 239, 0 },\r\n  { 239, 3 },\r\n  { 239, 2 },\r\n  { 237, 7 },\r\n  { 237, 5 },\r\n  { 237, 5 },\r\n  { 237, 5 },\r\n  { 237, 1 },\r\n  { 175, 4 },\r\n  { 175, 6 },\r\n  { 191, 1 },\r\n  { 191, 1 },\r\n  { 191, 1 },\r\n  { 147, 4 },\r\n  { 147, 6 },\r\n  { 147, 3 },\r\n  { 241, 0 },\r\n  { 241, 2 },\r\n  { 240, 1 },\r\n  { 240, 0 },\r\n  { 147, 1 },\r\n  { 147, 3 },\r\n  { 147, 1 },\r\n  { 147, 3 },\r\n  { 147, 6 },\r\n  { 147, 6 },\r\n  { 242, 1 },\r\n  { 243, 0 },\r\n  { 243, 1 },\r\n  { 147, 1 },\r\n  { 147, 4 },\r\n  { 244, 8 },\r\n  { 245, 1 },\r\n  { 245, 3 },\r\n  { 246, 0 },\r\n  { 246, 2 },\r\n  { 247, 1 },\r\n  { 247, 3 },\r\n  { 248, 1 },\r\n  { 249, 0 },\r\n  { 249, 4 },\r\n  { 249, 2 },\r\n};\r\n\r\nstatic void yy_accept(yyParser*);  /* Forward Declaration */\r\n\r\n/*\r\n** Perform a reduce action and the shift that must immediately\r\n** follow the reduce.\r\n*/\r\nstatic void yy_reduce(\r\n  yyParser *yypParser,         /* The parser */\r\n  int yyruleno                 /* Number of the rule by which to reduce */\r\n){\r\n  int yygoto;                     /* The next state */\r\n  int yyact;                      /* The next action */\r\n  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */\r\n  yyStackEntry *yymsp;            /* The top of the parser's stack */\r\n  int yysize;                     /* Amount to pop the stack */\r\n  sqlite3ParserARG_FETCH;\r\n  yymsp = &yypParser->yystack[yypParser->yyidx];\r\n#ifndef NDEBUG\r\n  if( yyTraceFILE && yyruleno>=0 \r\n        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){\r\n    fprintf(yyTraceFILE, \"%sReduce [%s].\\n\", yyTracePrompt,\r\n      yyRuleName[yyruleno]);\r\n  }\r\n#endif /* NDEBUG */\r\n\r\n  /* Silence complaints from purify about yygotominor being uninitialized\r\n  ** in some cases when it is copied into the stack after the following\r\n  ** switch.  yygotominor is uninitialized when a rule reduces that does\r\n  ** not set the value of its left-hand side nonterminal.  Leaving the\r\n  ** value of the nonterminal uninitialized is utterly harmless as long\r\n  ** as the value is never used.  So really the only thing this code\r\n  ** accomplishes is to quieten purify.  \r\n  **\r\n  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that\r\n  ** without this code, their parser segfaults.  I'm not sure what there\r\n  ** parser is doing to make this happen.  This is the second bug report\r\n  ** from wireshark this week.  Clearly they are stressing Lemon in ways\r\n  ** that it has not been previously stressed...  (SQLite ticket #2172)\r\n  */\r\n  /*memset(&yygotominor, 0, sizeof(yygotominor));*/\r\n  yygotominor = yyzerominor;\r\n\r\n\r\n  switch( yyruleno ){\r\n  /* Beginning here are the reduction cases.  A typical example\r\n  ** follows:\r\n  **   case 0:\r\n  **  #line <lineno> <grammarfile>\r\n  **     { ... }           // User supplied code\r\n  **  #line <lineno> <thisfile>\r\n  **     break;\r\n  */\r\n      case 5: /* explain ::= */\r\n{ sqlite3BeginParse(pParse, 0); }\r\n        break;\r\n      case 6: /* explain ::= EXPLAIN */\r\n{ sqlite3BeginParse(pParse, 1); }\r\n        break;\r\n      case 7: /* explain ::= EXPLAIN QUERY PLAN */\r\n{ sqlite3BeginParse(pParse, 2); }\r\n        break;\r\n      case 8: /* cmdx ::= cmd */\r\n{ sqlite3FinishCoding(pParse); }\r\n        break;\r\n      case 9: /* cmd ::= BEGIN transtype trans_opt */\r\n{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy392);}\r\n        break;\r\n      case 13: /* transtype ::= */\r\n{yygotominor.yy392 = TK_DEFERRED;}\r\n        break;\r\n      case 14: /* transtype ::= DEFERRED */\r\n      case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);\r\n      case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);\r\n      case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);\r\n      case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);\r\n{yygotominor.yy392 = yymsp[0].major;}\r\n        break;\r\n      case 17: /* cmd ::= COMMIT trans_opt */\r\n      case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);\r\n{sqlite3CommitTransaction(pParse);}\r\n        break;\r\n      case 19: /* cmd ::= ROLLBACK trans_opt */\r\n{sqlite3RollbackTransaction(pParse);}\r\n        break;\r\n      case 22: /* cmd ::= SAVEPOINT nm */\r\n{\r\n  sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 23: /* cmd ::= RELEASE savepoint_opt nm */\r\n{\r\n  sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */\r\n{\r\n  sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */\r\n{\r\n   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy392,0,0,yymsp[-2].minor.yy392);\r\n}\r\n        break;\r\n      case 27: /* createkw ::= CREATE */\r\n{\r\n  pParse->db->lookaside.bEnabled = 0;\r\n  yygotominor.yy0 = yymsp[0].minor.yy0;\r\n}\r\n        break;\r\n      case 28: /* ifnotexists ::= */\r\n      case 31: /* temp ::= */ yytestcase(yyruleno==31);\r\n      case 70: /* autoinc ::= */ yytestcase(yyruleno==70);\r\n      case 83: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==83);\r\n      case 85: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==85);\r\n      case 87: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==87);\r\n      case 98: /* defer_subclause_opt ::= */ yytestcase(yyruleno==98);\r\n      case 109: /* ifexists ::= */ yytestcase(yyruleno==109);\r\n      case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);\r\n      case 121: /* distinct ::= */ yytestcase(yyruleno==121);\r\n      case 221: /* between_op ::= BETWEEN */ yytestcase(yyruleno==221);\r\n      case 224: /* in_op ::= IN */ yytestcase(yyruleno==224);\r\n{yygotominor.yy392 = 0;}\r\n        break;\r\n      case 29: /* ifnotexists ::= IF NOT EXISTS */\r\n      case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);\r\n      case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);\r\n      case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);\r\n      case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);\r\n      case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);\r\n      case 222: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==222);\r\n      case 225: /* in_op ::= NOT IN */ yytestcase(yyruleno==225);\r\n{yygotominor.yy392 = 1;}\r\n        break;\r\n      case 32: /* create_table_args ::= LP columnlist conslist_opt RP */\r\n{\r\n  sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);\r\n}\r\n        break;\r\n      case 33: /* create_table_args ::= AS select */\r\n{\r\n  sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy159);\r\n  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159);\r\n}\r\n        break;\r\n      case 36: /* column ::= columnid type carglist */\r\n{\r\n  yygotominor.yy0.z = yymsp[-2].minor.yy0.z;\r\n  yygotominor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n;\r\n}\r\n        break;\r\n      case 37: /* columnid ::= nm */\r\n{\r\n  sqlite3AddColumn(pParse,&yymsp[0].minor.yy0);\r\n  yygotominor.yy0 = yymsp[0].minor.yy0;\r\n}\r\n        break;\r\n      case 38: /* id ::= ID */\r\n      case 39: /* id ::= INDEXED */ yytestcase(yyruleno==39);\r\n      case 40: /* ids ::= ID|STRING */ yytestcase(yyruleno==40);\r\n      case 41: /* nm ::= id */ yytestcase(yyruleno==41);\r\n      case 42: /* nm ::= STRING */ yytestcase(yyruleno==42);\r\n      case 43: /* nm ::= JOIN_KW */ yytestcase(yyruleno==43);\r\n      case 46: /* typetoken ::= typename */ yytestcase(yyruleno==46);\r\n      case 49: /* typename ::= ids */ yytestcase(yyruleno==49);\r\n      case 127: /* as ::= AS nm */ yytestcase(yyruleno==127);\r\n      case 128: /* as ::= ids */ yytestcase(yyruleno==128);\r\n      case 138: /* dbnm ::= DOT nm */ yytestcase(yyruleno==138);\r\n      case 147: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==147);\r\n      case 250: /* collate ::= COLLATE ids */ yytestcase(yyruleno==250);\r\n      case 259: /* nmnum ::= plus_num */ yytestcase(yyruleno==259);\r\n      case 260: /* nmnum ::= nm */ yytestcase(yyruleno==260);\r\n      case 261: /* nmnum ::= ON */ yytestcase(yyruleno==261);\r\n      case 262: /* nmnum ::= DELETE */ yytestcase(yyruleno==262);\r\n      case 263: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==263);\r\n      case 264: /* plus_num ::= PLUS number */ yytestcase(yyruleno==264);\r\n      case 265: /* plus_num ::= number */ yytestcase(yyruleno==265);\r\n      case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);\r\n      case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);\r\n      case 283: /* trnm ::= nm */ yytestcase(yyruleno==283);\r\n{yygotominor.yy0 = yymsp[0].minor.yy0;}\r\n        break;\r\n      case 45: /* type ::= typetoken */\r\n{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 47: /* typetoken ::= typename LP signed RP */\r\n{\r\n  yygotominor.yy0.z = yymsp[-3].minor.yy0.z;\r\n  yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);\r\n}\r\n        break;\r\n      case 48: /* typetoken ::= typename LP signed COMMA signed RP */\r\n{\r\n  yygotominor.yy0.z = yymsp[-5].minor.yy0.z;\r\n  yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);\r\n}\r\n        break;\r\n      case 50: /* typename ::= typename ids */\r\n{yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}\r\n        break;\r\n      case 57: /* ccons ::= DEFAULT term */\r\n      case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);\r\n{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);}\r\n        break;\r\n      case 58: /* ccons ::= DEFAULT LP expr RP */\r\n{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);}\r\n        break;\r\n      case 60: /* ccons ::= DEFAULT MINUS term */\r\n{\r\n  ExprSpan v;\r\n  v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy342.pExpr, 0, 0);\r\n  v.zStart = yymsp[-1].minor.yy0.z;\r\n  v.zEnd = yymsp[0].minor.yy342.zEnd;\r\n  sqlite3AddDefaultValue(pParse,&v);\r\n}\r\n        break;\r\n      case 61: /* ccons ::= DEFAULT id */\r\n{\r\n  ExprSpan v;\r\n  spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);\r\n  sqlite3AddDefaultValue(pParse,&v);\r\n}\r\n        break;\r\n      case 63: /* ccons ::= NOT NULL onconf */\r\n{sqlite3AddNotNull(pParse, yymsp[0].minor.yy392);}\r\n        break;\r\n      case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */\r\n{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy392,yymsp[0].minor.yy392,yymsp[-2].minor.yy392);}\r\n        break;\r\n      case 65: /* ccons ::= UNIQUE onconf */\r\n{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy392,0,0,0,0);}\r\n        break;\r\n      case 66: /* ccons ::= CHECK LP expr RP */\r\n{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy342.pExpr);}\r\n        break;\r\n      case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */\r\n{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy392);}\r\n        break;\r\n      case 68: /* ccons ::= defer_subclause */\r\n{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy392);}\r\n        break;\r\n      case 69: /* ccons ::= COLLATE ids */\r\n{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}\r\n        break;\r\n      case 72: /* refargs ::= */\r\n{ yygotominor.yy392 = OE_None*0x0101; /* EV: R-19803-45884 */}\r\n        break;\r\n      case 73: /* refargs ::= refargs refarg */\r\n{ yygotominor.yy392 = (yymsp[-1].minor.yy392 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; }\r\n        break;\r\n      case 74: /* refarg ::= MATCH nm */\r\n      case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);\r\n{ yygotominor.yy207.value = 0;     yygotominor.yy207.mask = 0x000000; }\r\n        break;\r\n      case 76: /* refarg ::= ON DELETE refact */\r\n{ yygotominor.yy207.value = yymsp[0].minor.yy392;     yygotominor.yy207.mask = 0x0000ff; }\r\n        break;\r\n      case 77: /* refarg ::= ON UPDATE refact */\r\n{ yygotominor.yy207.value = yymsp[0].minor.yy392<<8;  yygotominor.yy207.mask = 0x00ff00; }\r\n        break;\r\n      case 78: /* refact ::= SET NULL */\r\n{ yygotominor.yy392 = OE_SetNull;  /* EV: R-33326-45252 */}\r\n        break;\r\n      case 79: /* refact ::= SET DEFAULT */\r\n{ yygotominor.yy392 = OE_SetDflt;  /* EV: R-33326-45252 */}\r\n        break;\r\n      case 80: /* refact ::= CASCADE */\r\n{ yygotominor.yy392 = OE_Cascade;  /* EV: R-33326-45252 */}\r\n        break;\r\n      case 81: /* refact ::= RESTRICT */\r\n{ yygotominor.yy392 = OE_Restrict; /* EV: R-33326-45252 */}\r\n        break;\r\n      case 82: /* refact ::= NO ACTION */\r\n{ yygotominor.yy392 = OE_None;     /* EV: R-33326-45252 */}\r\n        break;\r\n      case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */\r\n      case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);\r\n      case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);\r\n      case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);\r\n{yygotominor.yy392 = yymsp[0].minor.yy392;}\r\n        break;\r\n      case 88: /* conslist_opt ::= */\r\n{yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}\r\n        break;\r\n      case 89: /* conslist_opt ::= COMMA conslist */\r\n{yygotominor.yy0 = yymsp[-1].minor.yy0;}\r\n        break;\r\n      case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */\r\n{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2].minor.yy392,0);}\r\n        break;\r\n      case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */\r\n{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0,0,0);}\r\n        break;\r\n      case 96: /* tcons ::= CHECK LP expr RP onconf */\r\n{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);}\r\n        break;\r\n      case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */\r\n{\r\n    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy392);\r\n    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392);\r\n}\r\n        break;\r\n      case 100: /* onconf ::= */\r\n{yygotominor.yy392 = OE_Default;}\r\n        break;\r\n      case 102: /* orconf ::= */\r\n{yygotominor.yy258 = OE_Default;}\r\n        break;\r\n      case 103: /* orconf ::= OR resolvetype */\r\n{yygotominor.yy258 = (u8)yymsp[0].minor.yy392;}\r\n        break;\r\n      case 105: /* resolvetype ::= IGNORE */\r\n{yygotominor.yy392 = OE_Ignore;}\r\n        break;\r\n      case 106: /* resolvetype ::= REPLACE */\r\n{yygotominor.yy392 = OE_Replace;}\r\n        break;\r\n      case 107: /* cmd ::= DROP TABLE ifexists fullname */\r\n{\r\n  sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392);\r\n}\r\n        break;\r\n      case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */\r\n{\r\n  sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy159, yymsp[-6].minor.yy392, yymsp[-4].minor.yy392);\r\n}\r\n        break;\r\n      case 111: /* cmd ::= DROP VIEW ifexists fullname */\r\n{\r\n  sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392);\r\n}\r\n        break;\r\n      case 112: /* cmd ::= select */\r\n{\r\n  SelectDest dest = {SRT_Output, 0, 0, 0, 0};\r\n  sqlite3Select(pParse, yymsp[0].minor.yy159, &dest);\r\n  sqlite3ExplainBegin(pParse->pVdbe);\r\n  sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy159);\r\n  sqlite3ExplainFinish(pParse->pVdbe);\r\n  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159);\r\n}\r\n        break;\r\n      case 113: /* select ::= oneselect */\r\n{yygotominor.yy159 = yymsp[0].minor.yy159;}\r\n        break;\r\n      case 114: /* select ::= select multiselect_op oneselect */\r\n{\r\n  if( yymsp[0].minor.yy159 ){\r\n    yymsp[0].minor.yy159->op = (u8)yymsp[-1].minor.yy392;\r\n    yymsp[0].minor.yy159->pPrior = yymsp[-2].minor.yy159;\r\n  }else{\r\n    sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy159);\r\n  }\r\n  yygotominor.yy159 = yymsp[0].minor.yy159;\r\n}\r\n        break;\r\n      case 116: /* multiselect_op ::= UNION ALL */\r\n{yygotominor.yy392 = TK_ALL;}\r\n        break;\r\n      case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */\r\n{\r\n  yygotominor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy347,yymsp[-4].minor.yy122,yymsp[-3].minor.yy442,yymsp[-2].minor.yy122,yymsp[-1].minor.yy442,yymsp[-7].minor.yy392,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset);\r\n}\r\n        break;\r\n      case 122: /* sclp ::= selcollist COMMA */\r\n      case 246: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==246);\r\n{yygotominor.yy442 = yymsp[-1].minor.yy442;}\r\n        break;\r\n      case 123: /* sclp ::= */\r\n      case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);\r\n      case 158: /* groupby_opt ::= */ yytestcase(yyruleno==158);\r\n      case 239: /* exprlist ::= */ yytestcase(yyruleno==239);\r\n      case 245: /* idxlist_opt ::= */ yytestcase(yyruleno==245);\r\n{yygotominor.yy442 = 0;}\r\n        break;\r\n      case 124: /* selcollist ::= sclp expr as */\r\n{\r\n   yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yymsp[-1].minor.yy342.pExpr);\r\n   if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[0].minor.yy0, 1);\r\n   sqlite3ExprListSetSpan(pParse,yygotominor.yy442,&yymsp[-1].minor.yy342);\r\n}\r\n        break;\r\n      case 125: /* selcollist ::= sclp STAR */\r\n{\r\n  Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p);\r\n}\r\n        break;\r\n      case 126: /* selcollist ::= sclp nm DOT STAR */\r\n{\r\n  Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);\r\n  Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);\r\n  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot);\r\n}\r\n        break;\r\n      case 129: /* as ::= */\r\n{yygotominor.yy0.n = 0;}\r\n        break;\r\n      case 130: /* from ::= */\r\n{yygotominor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy347));}\r\n        break;\r\n      case 131: /* from ::= FROM seltablist */\r\n{\r\n  yygotominor.yy347 = yymsp[0].minor.yy347;\r\n  sqlite3SrcListShiftJoinType(yygotominor.yy347);\r\n}\r\n        break;\r\n      case 132: /* stl_prefix ::= seltablist joinop */\r\n{\r\n   yygotominor.yy347 = yymsp[-1].minor.yy347;\r\n   if( ALWAYS(yygotominor.yy347 && yygotominor.yy347->nSrc>0) ) yygotominor.yy347->a[yygotominor.yy347->nSrc-1].jointype = (u8)yymsp[0].minor.yy392;\r\n}\r\n        break;\r\n      case 133: /* stl_prefix ::= */\r\n{yygotominor.yy347 = 0;}\r\n        break;\r\n      case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */\r\n{\r\n  yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);\r\n  sqlite3SrcListIndexedBy(pParse, yygotominor.yy347, &yymsp[-2].minor.yy0);\r\n}\r\n        break;\r\n      case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */\r\n{\r\n    yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy159,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);\r\n  }\r\n        break;\r\n      case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */\r\n{\r\n    if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){\r\n      yygotominor.yy347 = yymsp[-4].minor.yy347;\r\n    }else{\r\n      Select *pSubquery;\r\n      sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347);\r\n      pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,0,0,0);\r\n      yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);\r\n    }\r\n  }\r\n        break;\r\n      case 137: /* dbnm ::= */\r\n      case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);\r\n{yygotominor.yy0.z=0; yygotominor.yy0.n=0;}\r\n        break;\r\n      case 139: /* fullname ::= nm dbnm */\r\n{yygotominor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 140: /* joinop ::= COMMA|JOIN */\r\n{ yygotominor.yy392 = JT_INNER; }\r\n        break;\r\n      case 141: /* joinop ::= JOIN_KW JOIN */\r\n{ yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }\r\n        break;\r\n      case 142: /* joinop ::= JOIN_KW nm JOIN */\r\n{ yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }\r\n        break;\r\n      case 143: /* joinop ::= JOIN_KW nm nm JOIN */\r\n{ yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }\r\n        break;\r\n      case 144: /* on_opt ::= ON expr */\r\n      case 161: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==161);\r\n      case 168: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==168);\r\n      case 234: /* case_else ::= ELSE expr */ yytestcase(yyruleno==234);\r\n      case 236: /* case_operand ::= expr */ yytestcase(yyruleno==236);\r\n{yygotominor.yy122 = yymsp[0].minor.yy342.pExpr;}\r\n        break;\r\n      case 145: /* on_opt ::= */\r\n      case 160: /* having_opt ::= */ yytestcase(yyruleno==160);\r\n      case 167: /* where_opt ::= */ yytestcase(yyruleno==167);\r\n      case 235: /* case_else ::= */ yytestcase(yyruleno==235);\r\n      case 237: /* case_operand ::= */ yytestcase(yyruleno==237);\r\n{yygotominor.yy122 = 0;}\r\n        break;\r\n      case 148: /* indexed_opt ::= NOT INDEXED */\r\n{yygotominor.yy0.z=0; yygotominor.yy0.n=1;}\r\n        break;\r\n      case 149: /* using_opt ::= USING LP inscollist RP */\r\n      case 180: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==180);\r\n{yygotominor.yy180 = yymsp[-1].minor.yy180;}\r\n        break;\r\n      case 150: /* using_opt ::= */\r\n      case 179: /* inscollist_opt ::= */ yytestcase(yyruleno==179);\r\n{yygotominor.yy180 = 0;}\r\n        break;\r\n      case 152: /* orderby_opt ::= ORDER BY sortlist */\r\n      case 159: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==159);\r\n      case 238: /* exprlist ::= nexprlist */ yytestcase(yyruleno==238);\r\n{yygotominor.yy442 = yymsp[0].minor.yy442;}\r\n        break;\r\n      case 153: /* sortlist ::= sortlist COMMA expr sortorder */\r\n{\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy342.pExpr);\r\n  if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;\r\n}\r\n        break;\r\n      case 154: /* sortlist ::= expr sortorder */\r\n{\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr);\r\n  if( yygotominor.yy442 && ALWAYS(yygotominor.yy442->a) ) yygotominor.yy442->a[0].sortOrder = (u8)yymsp[0].minor.yy392;\r\n}\r\n        break;\r\n      case 155: /* sortorder ::= ASC */\r\n      case 157: /* sortorder ::= */ yytestcase(yyruleno==157);\r\n{yygotominor.yy392 = SQLITE_SO_ASC;}\r\n        break;\r\n      case 156: /* sortorder ::= DESC */\r\n{yygotominor.yy392 = SQLITE_SO_DESC;}\r\n        break;\r\n      case 162: /* limit_opt ::= */\r\n{yygotominor.yy64.pLimit = 0; yygotominor.yy64.pOffset = 0;}\r\n        break;\r\n      case 163: /* limit_opt ::= LIMIT expr */\r\n{yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yygotominor.yy64.pOffset = 0;}\r\n        break;\r\n      case 164: /* limit_opt ::= LIMIT expr OFFSET expr */\r\n{yygotominor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pOffset = yymsp[0].minor.yy342.pExpr;}\r\n        break;\r\n      case 165: /* limit_opt ::= LIMIT expr COMMA expr */\r\n{yygotominor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr;}\r\n        break;\r\n      case 166: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */\r\n{\r\n  sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0);\r\n  sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122);\r\n}\r\n        break;\r\n      case 169: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */\r\n{\r\n  sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0);\r\n  sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,\"set list\"); \r\n  sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].minor.yy122,yymsp[-5].minor.yy258);\r\n}\r\n        break;\r\n      case 170: /* setlist ::= setlist COMMA nm EQ expr */\r\n{\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr);\r\n  sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);\r\n}\r\n        break;\r\n      case 171: /* setlist ::= nm EQ expr */\r\n{\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExpr);\r\n  sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);\r\n}\r\n        break;\r\n      case 172: /* cmd ::= insert_cmd INTO fullname inscollist_opt valuelist */\r\n{sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy487.pList, yymsp[0].minor.yy487.pSelect, yymsp[-1].minor.yy180, yymsp[-4].minor.yy258);}\r\n        break;\r\n      case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */\r\n{sqlite3Insert(pParse, yymsp[-2].minor.yy347, 0, yymsp[0].minor.yy159, yymsp[-1].minor.yy180, yymsp[-4].minor.yy258);}\r\n        break;\r\n      case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */\r\n{sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, 0, yymsp[-2].minor.yy180, yymsp[-5].minor.yy258);}\r\n        break;\r\n      case 175: /* insert_cmd ::= INSERT orconf */\r\n{yygotominor.yy258 = yymsp[0].minor.yy258;}\r\n        break;\r\n      case 176: /* insert_cmd ::= REPLACE */\r\n{yygotominor.yy258 = OE_Replace;}\r\n        break;\r\n      case 177: /* valuelist ::= VALUES LP nexprlist RP */\r\n{\r\n  yygotominor.yy487.pList = yymsp[-1].minor.yy442;\r\n  yygotominor.yy487.pSelect = 0;\r\n}\r\n        break;\r\n      case 178: /* valuelist ::= valuelist COMMA LP exprlist RP */\r\n{\r\n  Select *pRight = sqlite3SelectNew(pParse, yymsp[-1].minor.yy442, 0, 0, 0, 0, 0, 0, 0, 0);\r\n  if( yymsp[-4].minor.yy487.pList ){\r\n    yymsp[-4].minor.yy487.pSelect = sqlite3SelectNew(pParse, yymsp[-4].minor.yy487.pList, 0, 0, 0, 0, 0, 0, 0, 0);\r\n    yymsp[-4].minor.yy487.pList = 0;\r\n  }\r\n  yygotominor.yy487.pList = 0;\r\n  if( yymsp[-4].minor.yy487.pSelect==0 || pRight==0 ){\r\n    sqlite3SelectDelete(pParse->db, pRight);\r\n    sqlite3SelectDelete(pParse->db, yymsp[-4].minor.yy487.pSelect);\r\n    yygotominor.yy487.pSelect = 0;\r\n  }else{\r\n    pRight->op = TK_ALL;\r\n    pRight->pPrior = yymsp[-4].minor.yy487.pSelect;\r\n    pRight->selFlags |= SF_Values;\r\n    pRight->pPrior->selFlags |= SF_Values;\r\n    yygotominor.yy487.pSelect = pRight;\r\n  }\r\n}\r\n        break;\r\n      case 181: /* inscollist ::= inscollist COMMA nm */\r\n{yygotominor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 182: /* inscollist ::= nm */\r\n{yygotominor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 183: /* expr ::= term */\r\n{yygotominor.yy342 = yymsp[0].minor.yy342;}\r\n        break;\r\n      case 184: /* expr ::= LP expr RP */\r\n{yygotominor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr; spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 185: /* term ::= NULL */\r\n      case 190: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==190);\r\n      case 191: /* term ::= STRING */ yytestcase(yyruleno==191);\r\n{spanExpr(&yygotominor.yy342, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}\r\n        break;\r\n      case 186: /* expr ::= id */\r\n      case 187: /* expr ::= JOIN_KW */ yytestcase(yyruleno==187);\r\n{spanExpr(&yygotominor.yy342, pParse, TK_ID, &yymsp[0].minor.yy0);}\r\n        break;\r\n      case 188: /* expr ::= nm DOT nm */\r\n{\r\n  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);\r\n  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);\r\n  spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 189: /* expr ::= nm DOT nm DOT nm */\r\n{\r\n  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);\r\n  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);\r\n  Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);\r\n  Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);\r\n  spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 192: /* expr ::= REGISTER */\r\n{\r\n  /* When doing a nested parse, one can include terms in an expression\r\n  ** that look like this:   #1 #2 ...  These terms refer to registers\r\n  ** in the virtual machine.  #N is the N-th register. */\r\n  if( pParse->nested==0 ){\r\n    sqlite3ErrorMsg(pParse, \"near \\\"%T\\\": syntax error\", &yymsp[0].minor.yy0);\r\n    yygotominor.yy342.pExpr = 0;\r\n  }else{\r\n    yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);\r\n    if( yygotominor.yy342.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy342.pExpr->iTable);\r\n  }\r\n  spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 193: /* expr ::= VARIABLE */\r\n{\r\n  spanExpr(&yygotominor.yy342, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);\r\n  sqlite3ExprAssignVarNumber(pParse, yygotominor.yy342.pExpr);\r\n  spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 194: /* expr ::= expr COLLATE ids */\r\n{\r\n  yygotominor.yy342.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy342.pExpr, &yymsp[0].minor.yy0);\r\n  yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart;\r\n  yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n}\r\n        break;\r\n      case 195: /* expr ::= CAST LP expr AS typetoken RP */\r\n{\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342.pExpr, 0, &yymsp[-1].minor.yy0);\r\n  spanSet(&yygotominor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 196: /* expr ::= ID LP distinct exprlist RP */\r\n{\r\n  if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){\r\n    sqlite3ErrorMsg(pParse, \"too many arguments on function %T\", &yymsp[-4].minor.yy0);\r\n  }\r\n  yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0);\r\n  spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);\r\n  if( yymsp[-2].minor.yy392 && yygotominor.yy342.pExpr ){\r\n    yygotominor.yy342.pExpr->flags |= EP_Distinct;\r\n  }\r\n}\r\n        break;\r\n      case 197: /* expr ::= ID LP STAR RP */\r\n{\r\n  yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);\r\n  spanSet(&yygotominor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 198: /* term ::= CTIME_KW */\r\n{\r\n  /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are\r\n  ** treated as functions that return constants */\r\n  yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);\r\n  if( yygotominor.yy342.pExpr ){\r\n    yygotominor.yy342.pExpr->op = TK_CONST_FUNC;  \r\n  }\r\n  spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 199: /* expr ::= expr AND expr */\r\n      case 200: /* expr ::= expr OR expr */ yytestcase(yyruleno==200);\r\n      case 201: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==201);\r\n      case 202: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==202);\r\n      case 203: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==203);\r\n      case 204: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==204);\r\n      case 205: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==205);\r\n      case 206: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==206);\r\n{spanBinaryExpr(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);}\r\n        break;\r\n      case 207: /* likeop ::= LIKE_KW */\r\n      case 209: /* likeop ::= MATCH */ yytestcase(yyruleno==209);\r\n{yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 0;}\r\n        break;\r\n      case 208: /* likeop ::= NOT LIKE_KW */\r\n      case 210: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==210);\r\n{yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 1;}\r\n        break;\r\n      case 211: /* expr ::= expr likeop expr */\r\n{\r\n  ExprList *pList;\r\n  pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr);\r\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr);\r\n  yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy318.eOperator);\r\n  if( yymsp[-1].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);\r\n  yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart;\r\n  yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;\r\n  if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc;\r\n}\r\n        break;\r\n      case 212: /* expr ::= expr likeop expr ESCAPE expr */\r\n{\r\n  ExprList *pList;\r\n  pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);\r\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr);\r\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr);\r\n  yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy318.eOperator);\r\n  if( yymsp[-3].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);\r\n  yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;\r\n  yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;\r\n  if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc;\r\n}\r\n        break;\r\n      case 213: /* expr ::= expr ISNULL|NOTNULL */\r\n{spanUnaryPostfix(&yygotominor.yy342,pParse,yymsp[0].major,&yymsp[-1].minor.yy342,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 214: /* expr ::= expr NOT NULL */\r\n{spanUnaryPostfix(&yygotominor.yy342,pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 215: /* expr ::= expr IS expr */\r\n{\r\n  spanBinaryExpr(&yygotominor.yy342,pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);\r\n  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExpr, TK_ISNULL);\r\n}\r\n        break;\r\n      case 216: /* expr ::= expr IS NOT expr */\r\n{\r\n  spanBinaryExpr(&yygotominor.yy342,pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yymsp[0].minor.yy342);\r\n  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExpr, TK_NOTNULL);\r\n}\r\n        break;\r\n      case 217: /* expr ::= NOT expr */\r\n      case 218: /* expr ::= BITNOT expr */ yytestcase(yyruleno==218);\r\n{spanUnaryPrefix(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}\r\n        break;\r\n      case 219: /* expr ::= MINUS expr */\r\n{spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}\r\n        break;\r\n      case 220: /* expr ::= PLUS expr */\r\n{spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}\r\n        break;\r\n      case 223: /* expr ::= expr between_op expr AND expr */\r\n{\r\n  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);\r\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr);\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy342.pExpr, 0, 0);\r\n  if( yygotominor.yy342.pExpr ){\r\n    yygotominor.yy342.pExpr->x.pList = pList;\r\n  }else{\r\n    sqlite3ExprListDelete(pParse->db, pList);\r\n  } \r\n  if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);\r\n  yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;\r\n  yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;\r\n}\r\n        break;\r\n      case 226: /* expr ::= expr in_op LP exprlist RP */\r\n{\r\n    if( yymsp[-1].minor.yy442==0 ){\r\n      /* Expressions of the form\r\n      **\r\n      **      expr1 IN ()\r\n      **      expr1 NOT IN ()\r\n      **\r\n      ** simplify to constants 0 (false) and 1 (true), respectively,\r\n      ** regardless of the value of expr1.\r\n      */\r\n      yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy392]);\r\n      sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy342.pExpr);\r\n    }else{\r\n      yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0);\r\n      if( yygotominor.yy342.pExpr ){\r\n        yygotominor.yy342.pExpr->x.pList = yymsp[-1].minor.yy442;\r\n        sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);\r\n      }else{\r\n        sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442);\r\n      }\r\n      if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);\r\n    }\r\n    yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;\r\n    yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n  }\r\n        break;\r\n      case 227: /* expr ::= LP select RP */\r\n{\r\n    yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);\r\n    if( yygotominor.yy342.pExpr ){\r\n      yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159;\r\n      ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);\r\n      sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);\r\n    }else{\r\n      sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);\r\n    }\r\n    yygotominor.yy342.zStart = yymsp[-2].minor.yy0.z;\r\n    yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n  }\r\n        break;\r\n      case 228: /* expr ::= expr in_op LP select RP */\r\n{\r\n    yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0);\r\n    if( yygotominor.yy342.pExpr ){\r\n      yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159;\r\n      ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);\r\n      sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);\r\n    }else{\r\n      sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);\r\n    }\r\n    if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);\r\n    yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;\r\n    yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n  }\r\n        break;\r\n      case 229: /* expr ::= expr in_op nm dbnm */\r\n{\r\n    SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);\r\n    yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342.pExpr, 0, 0);\r\n    if( yygotominor.yy342.pExpr ){\r\n      yygotominor.yy342.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);\r\n      ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);\r\n      sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);\r\n    }else{\r\n      sqlite3SrcListDelete(pParse->db, pSrc);\r\n    }\r\n    if( yymsp[-2].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);\r\n    yygotominor.yy342.zStart = yymsp[-3].minor.yy342.zStart;\r\n    yygotominor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];\r\n  }\r\n        break;\r\n      case 230: /* expr ::= EXISTS LP select RP */\r\n{\r\n    Expr *p = yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);\r\n    if( p ){\r\n      p->x.pSelect = yymsp[-1].minor.yy159;\r\n      ExprSetProperty(p, EP_xIsSelect);\r\n      sqlite3ExprSetHeight(pParse, p);\r\n    }else{\r\n      sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);\r\n    }\r\n    yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z;\r\n    yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n  }\r\n        break;\r\n      case 231: /* expr ::= CASE case_operand case_exprlist case_else END */\r\n{\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, yymsp[-1].minor.yy122, 0);\r\n  if( yygotominor.yy342.pExpr ){\r\n    yygotominor.yy342.pExpr->x.pList = yymsp[-2].minor.yy442;\r\n    sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);\r\n  }else{\r\n    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442);\r\n  }\r\n  yygotominor.yy342.zStart = yymsp[-4].minor.yy0.z;\r\n  yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n}\r\n        break;\r\n      case 232: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */\r\n{\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy342.pExpr);\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].minor.yy342.pExpr);\r\n}\r\n        break;\r\n      case 233: /* case_exprlist ::= WHEN expr THEN expr */\r\n{\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].minor.yy342.pExpr);\r\n}\r\n        break;\r\n      case 240: /* nexprlist ::= nexprlist COMMA expr */\r\n{yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy342.pExpr);}\r\n        break;\r\n      case 241: /* nexprlist ::= expr */\r\n{yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr);}\r\n        break;\r\n      case 242: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */\r\n{\r\n  sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, \r\n                     sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy442, yymsp[-9].minor.yy392,\r\n                      &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy392);\r\n}\r\n        break;\r\n      case 243: /* uniqueflag ::= UNIQUE */\r\n      case 296: /* raisetype ::= ABORT */ yytestcase(yyruleno==296);\r\n{yygotominor.yy392 = OE_Abort;}\r\n        break;\r\n      case 244: /* uniqueflag ::= */\r\n{yygotominor.yy392 = OE_None;}\r\n        break;\r\n      case 247: /* idxlist ::= idxlist COMMA nm collate sortorder */\r\n{\r\n  Expr *p = 0;\r\n  if( yymsp[-1].minor.yy0.n>0 ){\r\n    p = sqlite3Expr(pParse->db, TK_COLUMN, 0);\r\n    sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);\r\n  }\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, p);\r\n  sqlite3ExprListSetName(pParse,yygotominor.yy442,&yymsp[-2].minor.yy0,1);\r\n  sqlite3ExprListCheckLength(pParse, yygotominor.yy442, \"index\");\r\n  if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;\r\n}\r\n        break;\r\n      case 248: /* idxlist ::= nm collate sortorder */\r\n{\r\n  Expr *p = 0;\r\n  if( yymsp[-1].minor.yy0.n>0 ){\r\n    p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);\r\n    sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);\r\n  }\r\n  yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, p);\r\n  sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);\r\n  sqlite3ExprListCheckLength(pParse, yygotominor.yy442, \"index\");\r\n  if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;\r\n}\r\n        break;\r\n      case 249: /* collate ::= */\r\n{yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}\r\n        break;\r\n      case 251: /* cmd ::= DROP INDEX ifexists fullname */\r\n{sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);}\r\n        break;\r\n      case 252: /* cmd ::= VACUUM */\r\n      case 253: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==253);\r\n{sqlite3Vacuum(pParse);}\r\n        break;\r\n      case 254: /* cmd ::= PRAGMA nm dbnm */\r\n{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}\r\n        break;\r\n      case 255: /* cmd ::= PRAGMA nm dbnm EQ nmnum */\r\n{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}\r\n        break;\r\n      case 256: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */\r\n{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}\r\n        break;\r\n      case 257: /* cmd ::= PRAGMA nm dbnm EQ minus_num */\r\n{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}\r\n        break;\r\n      case 258: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */\r\n{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}\r\n        break;\r\n      case 268: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */\r\n{\r\n  Token all;\r\n  all.z = yymsp[-3].minor.yy0.z;\r\n  all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;\r\n  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all);\r\n}\r\n        break;\r\n      case 269: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */\r\n{\r\n  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy392, yymsp[-4].minor.yy410.a, yymsp[-4].minor.yy410.b, yymsp[-2].minor.yy347, yymsp[0].minor.yy122, yymsp[-10].minor.yy392, yymsp[-8].minor.yy392);\r\n  yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);\r\n}\r\n        break;\r\n      case 270: /* trigger_time ::= BEFORE */\r\n      case 273: /* trigger_time ::= */ yytestcase(yyruleno==273);\r\n{ yygotominor.yy392 = TK_BEFORE; }\r\n        break;\r\n      case 271: /* trigger_time ::= AFTER */\r\n{ yygotominor.yy392 = TK_AFTER;  }\r\n        break;\r\n      case 272: /* trigger_time ::= INSTEAD OF */\r\n{ yygotominor.yy392 = TK_INSTEAD;}\r\n        break;\r\n      case 274: /* trigger_event ::= DELETE|INSERT */\r\n      case 275: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==275);\r\n{yygotominor.yy410.a = yymsp[0].major; yygotominor.yy410.b = 0;}\r\n        break;\r\n      case 276: /* trigger_event ::= UPDATE OF inscollist */\r\n{yygotominor.yy410.a = TK_UPDATE; yygotominor.yy410.b = yymsp[0].minor.yy180;}\r\n        break;\r\n      case 279: /* when_clause ::= */\r\n      case 301: /* key_opt ::= */ yytestcase(yyruleno==301);\r\n{ yygotominor.yy122 = 0; }\r\n        break;\r\n      case 280: /* when_clause ::= WHEN expr */\r\n      case 302: /* key_opt ::= KEY expr */ yytestcase(yyruleno==302);\r\n{ yygotominor.yy122 = yymsp[0].minor.yy342.pExpr; }\r\n        break;\r\n      case 281: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */\r\n{\r\n  assert( yymsp[-2].minor.yy327!=0 );\r\n  yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327;\r\n  yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327;\r\n  yygotominor.yy327 = yymsp[-2].minor.yy327;\r\n}\r\n        break;\r\n      case 282: /* trigger_cmd_list ::= trigger_cmd SEMI */\r\n{ \r\n  assert( yymsp[-1].minor.yy327!=0 );\r\n  yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327;\r\n  yygotominor.yy327 = yymsp[-1].minor.yy327;\r\n}\r\n        break;\r\n      case 284: /* trnm ::= nm DOT nm */\r\n{\r\n  yygotominor.yy0 = yymsp[0].minor.yy0;\r\n  sqlite3ErrorMsg(pParse, \r\n        \"qualified table names are not allowed on INSERT, UPDATE, and DELETE \"\r\n        \"statements within triggers\");\r\n}\r\n        break;\r\n      case 286: /* tridxby ::= INDEXED BY nm */\r\n{\r\n  sqlite3ErrorMsg(pParse,\r\n        \"the INDEXED BY clause is not allowed on UPDATE or DELETE statements \"\r\n        \"within triggers\");\r\n}\r\n        break;\r\n      case 287: /* tridxby ::= NOT INDEXED */\r\n{\r\n  sqlite3ErrorMsg(pParse,\r\n        \"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements \"\r\n        \"within triggers\");\r\n}\r\n        break;\r\n      case 288: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */\r\n{ yygotominor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy442, yymsp[0].minor.yy122, yymsp[-5].minor.yy258); }\r\n        break;\r\n      case 289: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist */\r\n{yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, yymsp[0].minor.yy487.pList, yymsp[0].minor.yy487.pSelect, yymsp[-4].minor.yy258);}\r\n        break;\r\n      case 290: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */\r\n{yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, 0, yymsp[0].minor.yy159, yymsp[-4].minor.yy258);}\r\n        break;\r\n      case 291: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */\r\n{yygotominor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy122);}\r\n        break;\r\n      case 292: /* trigger_cmd ::= select */\r\n{yygotominor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); }\r\n        break;\r\n      case 293: /* expr ::= RAISE LP IGNORE RP */\r\n{\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); \r\n  if( yygotominor.yy342.pExpr ){\r\n    yygotominor.yy342.pExpr->affinity = OE_Ignore;\r\n  }\r\n  yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z;\r\n  yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n}\r\n        break;\r\n      case 294: /* expr ::= RAISE LP raisetype COMMA nm RP */\r\n{\r\n  yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); \r\n  if( yygotominor.yy342.pExpr ) {\r\n    yygotominor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392;\r\n  }\r\n  yygotominor.yy342.zStart = yymsp[-5].minor.yy0.z;\r\n  yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\r\n}\r\n        break;\r\n      case 295: /* raisetype ::= ROLLBACK */\r\n{yygotominor.yy392 = OE_Rollback;}\r\n        break;\r\n      case 297: /* raisetype ::= FAIL */\r\n{yygotominor.yy392 = OE_Fail;}\r\n        break;\r\n      case 298: /* cmd ::= DROP TRIGGER ifexists fullname */\r\n{\r\n  sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392);\r\n}\r\n        break;\r\n      case 299: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */\r\n{\r\n  sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr, yymsp[0].minor.yy122);\r\n}\r\n        break;\r\n      case 300: /* cmd ::= DETACH database_kw_opt expr */\r\n{\r\n  sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr);\r\n}\r\n        break;\r\n      case 305: /* cmd ::= REINDEX */\r\n{sqlite3Reindex(pParse, 0, 0);}\r\n        break;\r\n      case 306: /* cmd ::= REINDEX nm dbnm */\r\n{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}\r\n        break;\r\n      case 307: /* cmd ::= ANALYZE */\r\n{sqlite3Analyze(pParse, 0, 0);}\r\n        break;\r\n      case 308: /* cmd ::= ANALYZE nm dbnm */\r\n{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}\r\n        break;\r\n      case 309: /* cmd ::= ALTER TABLE fullname RENAME TO nm */\r\n{\r\n  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 310: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */\r\n{\r\n  sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);\r\n}\r\n        break;\r\n      case 311: /* add_column_fullname ::= fullname */\r\n{\r\n  pParse->db->lookaside.bEnabled = 0;\r\n  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347);\r\n}\r\n        break;\r\n      case 314: /* cmd ::= create_vtab */\r\n{sqlite3VtabFinishParse(pParse,0);}\r\n        break;\r\n      case 315: /* cmd ::= create_vtab LP vtabarglist RP */\r\n{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}\r\n        break;\r\n      case 316: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */\r\n{\r\n    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy392);\r\n}\r\n        break;\r\n      case 319: /* vtabarg ::= */\r\n{sqlite3VtabArgInit(pParse);}\r\n        break;\r\n      case 321: /* vtabargtoken ::= ANY */\r\n      case 322: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==322);\r\n      case 323: /* lp ::= LP */ yytestcase(yyruleno==323);\r\n{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}\r\n        break;\r\n      default:\r\n      /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);\r\n      /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);\r\n      /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2);\r\n      /* (3) ecmd ::= SEMI */ yytestcase(yyruleno==3);\r\n      /* (4) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==4);\r\n      /* (10) trans_opt ::= */ yytestcase(yyruleno==10);\r\n      /* (11) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==11);\r\n      /* (12) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==12);\r\n      /* (20) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==20);\r\n      /* (21) savepoint_opt ::= */ yytestcase(yyruleno==21);\r\n      /* (25) cmd ::= create_table create_table_args */ yytestcase(yyruleno==25);\r\n      /* (34) columnlist ::= columnlist COMMA column */ yytestcase(yyruleno==34);\r\n      /* (35) columnlist ::= column */ yytestcase(yyruleno==35);\r\n      /* (44) type ::= */ yytestcase(yyruleno==44);\r\n      /* (51) signed ::= plus_num */ yytestcase(yyruleno==51);\r\n      /* (52) signed ::= minus_num */ yytestcase(yyruleno==52);\r\n      /* (53) carglist ::= carglist carg */ yytestcase(yyruleno==53);\r\n      /* (54) carglist ::= */ yytestcase(yyruleno==54);\r\n      /* (55) carg ::= CONSTRAINT nm ccons */ yytestcase(yyruleno==55);\r\n      /* (56) carg ::= ccons */ yytestcase(yyruleno==56);\r\n      /* (62) ccons ::= NULL onconf */ yytestcase(yyruleno==62);\r\n      /* (90) conslist ::= conslist COMMA tcons */ yytestcase(yyruleno==90);\r\n      /* (91) conslist ::= conslist tcons */ yytestcase(yyruleno==91);\r\n      /* (92) conslist ::= tcons */ yytestcase(yyruleno==92);\r\n      /* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93);\r\n      /* (277) foreach_clause ::= */ yytestcase(yyruleno==277);\r\n      /* (278) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==278);\r\n      /* (285) tridxby ::= */ yytestcase(yyruleno==285);\r\n      /* (303) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==303);\r\n      /* (304) database_kw_opt ::= */ yytestcase(yyruleno==304);\r\n      /* (312) kwcolumn_opt ::= */ yytestcase(yyruleno==312);\r\n      /* (313) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==313);\r\n      /* (317) vtabarglist ::= vtabarg */ yytestcase(yyruleno==317);\r\n      /* (318) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==318);\r\n      /* (320) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==320);\r\n      /* (324) anylist ::= */ yytestcase(yyruleno==324);\r\n      /* (325) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==325);\r\n      /* (326) anylist ::= anylist ANY */ yytestcase(yyruleno==326);\r\n        break;\r\n  };\r\n  yygoto = yyRuleInfo[yyruleno].lhs;\r\n  yysize = yyRuleInfo[yyruleno].nrhs;\r\n  yypParser->yyidx -= yysize;\r\n  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);\r\n  if( yyact < YYNSTATE ){\r\n#ifdef NDEBUG\r\n    /* If we are not debugging and the reduce action popped at least\r\n    ** one element off the stack, then we can push the new element back\r\n    ** onto the stack here, and skip the stack overflow test in yy_shift().\r\n    ** That gives a significant speed improvement. */\r\n    if( yysize ){\r\n      yypParser->yyidx++;\r\n      yymsp -= yysize-1;\r\n      yymsp->stateno = (YYACTIONTYPE)yyact;\r\n      yymsp->major = (YYCODETYPE)yygoto;\r\n      yymsp->minor = yygotominor;\r\n    }else\r\n#endif\r\n    {\r\n      yy_shift(yypParser,yyact,yygoto,&yygotominor);\r\n    }\r\n  }else{\r\n    assert( yyact == YYNSTATE + YYNRULE + 1 );\r\n    yy_accept(yypParser);\r\n  }\r\n}\r\n\r\n/*\r\n** The following code executes when the parse fails\r\n*/\r\n#ifndef YYNOERRORRECOVERY\r\nstatic void yy_parse_failed(\r\n  yyParser *yypParser           /* The parser */\r\n){\r\n  sqlite3ParserARG_FETCH;\r\n#ifndef NDEBUG\r\n  if( yyTraceFILE ){\r\n    fprintf(yyTraceFILE,\"%sFail!\\n\",yyTracePrompt);\r\n  }\r\n#endif\r\n  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);\r\n  /* Here code is inserted which will be executed whenever the\r\n  ** parser fails */\r\n  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\r\n}\r\n#endif /* YYNOERRORRECOVERY */\r\n\r\n/*\r\n** The following code executes when a syntax error first occurs.\r\n*/\r\nstatic void yy_syntax_error(\r\n  yyParser *yypParser,           /* The parser */\r\n  int yymajor,                   /* The major type of the error token */\r\n  YYMINORTYPE yyminor            /* The minor type of the error token */\r\n){\r\n  sqlite3ParserARG_FETCH;\r\n#define TOKEN (yyminor.yy0)\r\n\r\n  UNUSED_PARAMETER(yymajor);  /* Silence some compiler warnings */\r\n  assert( TOKEN.z[0] );  /* The tokenizer always gives us a token */\r\n  sqlite3ErrorMsg(pParse, \"near \\\"%T\\\": syntax error\", &TOKEN);\r\n  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\r\n}\r\n\r\n/*\r\n** The following is executed when the parser accepts\r\n*/\r\nstatic void yy_accept(\r\n  yyParser *yypParser           /* The parser */\r\n){\r\n  sqlite3ParserARG_FETCH;\r\n#ifndef NDEBUG\r\n  if( yyTraceFILE ){\r\n    fprintf(yyTraceFILE,\"%sAccept!\\n\",yyTracePrompt);\r\n  }\r\n#endif\r\n  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);\r\n  /* Here code is inserted which will be executed whenever the\r\n  ** parser accepts */\r\n  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\r\n}\r\n\r\n/* The main parser program.\r\n** The first argument is a pointer to a structure obtained from\r\n** \"sqlite3ParserAlloc\" which describes the current state of the parser.\r\n** The second argument is the major token number.  The third is\r\n** the minor token.  The fourth optional argument is whatever the\r\n** user wants (and specified in the grammar) and is available for\r\n** use by the action routines.\r\n**\r\n** Inputs:\r\n** <ul>\r\n** <li> A pointer to the parser (an opaque structure.)\r\n** <li> The major token number.\r\n** <li> The minor token number.\r\n** <li> An option argument of a grammar-specified type.\r\n** </ul>\r\n**\r\n** Outputs:\r\n** None.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Parser(\r\n  void *yyp,                   /* The parser */\r\n  int yymajor,                 /* The major token code number */\r\n  sqlite3ParserTOKENTYPE yyminor       /* The value for the token */\r\n  sqlite3ParserARG_PDECL               /* Optional %extra_argument parameter */\r\n){\r\n  YYMINORTYPE yyminorunion;\r\n  int yyact;            /* The parser action. */\r\n#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)\r\n  int yyendofinput;     /* True if we are at the end of input */\r\n#endif\r\n#ifdef YYERRORSYMBOL\r\n  int yyerrorhit = 0;   /* True if yymajor has invoked an error */\r\n#endif\r\n  yyParser *yypParser;  /* The parser */\r\n\r\n  /* (re)initialize the parser, if necessary */\r\n  yypParser = (yyParser*)yyp;\r\n  if( yypParser->yyidx<0 ){\r\n#if YYSTACKDEPTH<=0\r\n    if( yypParser->yystksz <=0 ){\r\n      /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/\r\n      yyminorunion = yyzerominor;\r\n      yyStackOverflow(yypParser, &yyminorunion);\r\n      return;\r\n    }\r\n#endif\r\n    yypParser->yyidx = 0;\r\n    yypParser->yyerrcnt = -1;\r\n    yypParser->yystack[0].stateno = 0;\r\n    yypParser->yystack[0].major = 0;\r\n  }\r\n  yyminorunion.yy0 = yyminor;\r\n#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)\r\n  yyendofinput = (yymajor==0);\r\n#endif\r\n  sqlite3ParserARG_STORE;\r\n\r\n#ifndef NDEBUG\r\n  if( yyTraceFILE ){\r\n    fprintf(yyTraceFILE,\"%sInput %s\\n\",yyTracePrompt,yyTokenName[yymajor]);\r\n  }\r\n#endif\r\n\r\n  do{\r\n    yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);\r\n    if( yyact<YYNSTATE ){\r\n      yy_shift(yypParser,yyact,yymajor,&yyminorunion);\r\n      yypParser->yyerrcnt--;\r\n      yymajor = YYNOCODE;\r\n    }else if( yyact < YYNSTATE + YYNRULE ){\r\n      yy_reduce(yypParser,yyact-YYNSTATE);\r\n    }else{\r\n      assert( yyact == YY_ERROR_ACTION );\r\n#ifdef YYERRORSYMBOL\r\n      int yymx;\r\n#endif\r\n#ifndef NDEBUG\r\n      if( yyTraceFILE ){\r\n        fprintf(yyTraceFILE,\"%sSyntax Error!\\n\",yyTracePrompt);\r\n      }\r\n#endif\r\n#ifdef YYERRORSYMBOL\r\n      /* A syntax error has occurred.\r\n      ** The response to an error depends upon whether or not the\r\n      ** grammar defines an error token \"ERROR\".  \r\n      **\r\n      ** This is what we do if the grammar does define ERROR:\r\n      **\r\n      **  * Call the %syntax_error function.\r\n      **\r\n      **  * Begin popping the stack until we enter a state where\r\n      **    it is legal to shift the error symbol, then shift\r\n      **    the error symbol.\r\n      **\r\n      **  * Set the error count to three.\r\n      **\r\n      **  * Begin accepting and shifting new tokens.  No new error\r\n      **    processing will occur until three tokens have been\r\n      **    shifted successfully.\r\n      **\r\n      */\r\n      if( yypParser->yyerrcnt<0 ){\r\n        yy_syntax_error(yypParser,yymajor,yyminorunion);\r\n      }\r\n      yymx = yypParser->yystack[yypParser->yyidx].major;\r\n      if( yymx==YYERRORSYMBOL || yyerrorhit ){\r\n#ifndef NDEBUG\r\n        if( yyTraceFILE ){\r\n          fprintf(yyTraceFILE,\"%sDiscard input token %s\\n\",\r\n             yyTracePrompt,yyTokenName[yymajor]);\r\n        }\r\n#endif\r\n        yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);\r\n        yymajor = YYNOCODE;\r\n      }else{\r\n         while(\r\n          yypParser->yyidx >= 0 &&\r\n          yymx != YYERRORSYMBOL &&\r\n          (yyact = yy_find_reduce_action(\r\n                        yypParser->yystack[yypParser->yyidx].stateno,\r\n                        YYERRORSYMBOL)) >= YYNSTATE\r\n        ){\r\n          yy_pop_parser_stack(yypParser);\r\n        }\r\n        if( yypParser->yyidx < 0 || yymajor==0 ){\r\n          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);\r\n          yy_parse_failed(yypParser);\r\n          yymajor = YYNOCODE;\r\n        }else if( yymx!=YYERRORSYMBOL ){\r\n          YYMINORTYPE u2;\r\n          u2.YYERRSYMDT = 0;\r\n          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);\r\n        }\r\n      }\r\n      yypParser->yyerrcnt = 3;\r\n      yyerrorhit = 1;\r\n#elif defined(YYNOERRORRECOVERY)\r\n      /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to\r\n      ** do any kind of error recovery.  Instead, simply invoke the syntax\r\n      ** error routine and continue going as if nothing had happened.\r\n      **\r\n      ** Applications can set this macro (for example inside %include) if\r\n      ** they intend to abandon the parse upon the first syntax error seen.\r\n      */\r\n      yy_syntax_error(yypParser,yymajor,yyminorunion);\r\n      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);\r\n      yymajor = YYNOCODE;\r\n      \r\n#else  /* YYERRORSYMBOL is not defined */\r\n      /* This is what we do if the grammar does not define ERROR:\r\n      **\r\n      **  * Report an error message, and throw away the input token.\r\n      **\r\n      **  * If the input token is $, then fail the parse.\r\n      **\r\n      ** As before, subsequent error messages are suppressed until\r\n      ** three input tokens have been successfully shifted.\r\n      */\r\n      if( yypParser->yyerrcnt<=0 ){\r\n        yy_syntax_error(yypParser,yymajor,yyminorunion);\r\n      }\r\n      yypParser->yyerrcnt = 3;\r\n      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);\r\n      if( yyendofinput ){\r\n        yy_parse_failed(yypParser);\r\n      }\r\n      yymajor = YYNOCODE;\r\n#endif\r\n    }\r\n  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );\r\n  return;\r\n}\r\n\r\n/************** End of parse.c ***********************************************/\r\n/************** Begin file tokenize.c ****************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** An tokenizer for SQL\r\n**\r\n** This file contains C code that splits an SQL input string up into\r\n** individual tokens and sends those tokens one-by-one over to the\r\n** parser for analysis.\r\n*/\r\n/* #include <stdlib.h> */\r\n\r\n/*\r\n** The charMap() macro maps alphabetic characters into their\r\n** lower-case ASCII equivalent.  On ASCII machines, this is just\r\n** an upper-to-lower case map.  On EBCDIC machines we also need\r\n** to adjust the encoding.  Only alphabetic characters and underscores\r\n** need to be translated.\r\n*/\r\n#ifdef SQLITE_ASCII\r\n# define charMap(X) sqlite3UpperToLower[(unsigned char)X]\r\n#endif\r\n#ifdef SQLITE_EBCDIC\r\n# define charMap(X) ebcdicToAscii[(unsigned char)X]\r\nconst unsigned char ebcdicToAscii[] = {\r\n/* 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 0x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 1x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 2x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 3x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 4x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 5x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 95,  0,  0,  /* 6x */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 7x */\r\n   0, 97, 98, 99,100,101,102,103,104,105,  0,  0,  0,  0,  0,  0,  /* 8x */\r\n   0,106,107,108,109,110,111,112,113,114,  0,  0,  0,  0,  0,  0,  /* 9x */\r\n   0,  0,115,116,117,118,119,120,121,122,  0,  0,  0,  0,  0,  0,  /* Ax */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* Bx */\r\n   0, 97, 98, 99,100,101,102,103,104,105,  0,  0,  0,  0,  0,  0,  /* Cx */\r\n   0,106,107,108,109,110,111,112,113,114,  0,  0,  0,  0,  0,  0,  /* Dx */\r\n   0,  0,115,116,117,118,119,120,121,122,  0,  0,  0,  0,  0,  0,  /* Ex */\r\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* Fx */\r\n};\r\n#endif\r\n\r\n/*\r\n** The sqlite3KeywordCode function looks up an identifier to determine if\r\n** it is a keyword.  If it is a keyword, the token code of that keyword is \r\n** returned.  If the input is not a keyword, TK_ID is returned.\r\n**\r\n** The implementation of this routine was generated by a program,\r\n** mkkeywordhash.h, located in the tool subdirectory of the distribution.\r\n** The output of the mkkeywordhash.c program is written into a file\r\n** named keywordhash.h and then included into this source file by\r\n** the #include below.\r\n*/\r\n/************** Include keywordhash.h in the middle of tokenize.c ************/\r\n/************** Begin file keywordhash.h *************************************/\r\n/***** This file contains automatically generated code ******\r\n**\r\n** The code in this file has been automatically generated by\r\n**\r\n**   sqlite/tool/mkkeywordhash.c\r\n**\r\n** The code in this file implements a function that determines whether\r\n** or not a given identifier is really an SQL keyword.  The same thing\r\n** might be implemented more directly using a hand-written hash table.\r\n** But by using this automatically generated code, the size of the code\r\n** is substantially reduced.  This is important for embedded applications\r\n** on platforms with limited memory.\r\n*/\r\n/* Hash score: 175 */\r\nstatic int keywordCode(const char *z, int n){\r\n  /* zText[] encodes 811 bytes of keywords in 541 bytes */\r\n  /*   REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT       */\r\n  /*   ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE         */\r\n  /*   XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY         */\r\n  /*   UNIQUERYATTACHAVINGROUPDATEBEGINNERELEASEBETWEENOTNULLIKE          */\r\n  /*   CASCADELETECASECOLLATECREATECURRENT_DATEDETACHIMMEDIATEJOIN        */\r\n  /*   SERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHENWHERENAME         */\r\n  /*   AFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSS     */\r\n  /*   CURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAILFROMFULLGLOBYIF      */\r\n  /*   ISNULLORDERESTRICTOUTERIGHTROLLBACKROWUNIONUSINGVACUUMVIEW         */\r\n  /*   INITIALLY                                                          */\r\n  static const char zText[540] = {\r\n    'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',\r\n    'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',\r\n    'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',\r\n    'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',\r\n    'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',\r\n    'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',\r\n    'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',\r\n    'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',\r\n    'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',\r\n    'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',\r\n    'U','E','R','Y','A','T','T','A','C','H','A','V','I','N','G','R','O','U',\r\n    'P','D','A','T','E','B','E','G','I','N','N','E','R','E','L','E','A','S',\r\n    'E','B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C',\r\n    'A','S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L',\r\n    'A','T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D',\r\n    'A','T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E',\r\n    'J','O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A',\r\n    'L','Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U',\r\n    'E','S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W',\r\n    'H','E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C',\r\n    'E','A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R',\r\n    'E','M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M',\r\n    'M','I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U',\r\n    'R','R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M',\r\n    'A','R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T',\r\n    'D','R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L',\r\n    'O','B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S',\r\n    'T','R','I','C','T','O','U','T','E','R','I','G','H','T','R','O','L','L',\r\n    'B','A','C','K','R','O','W','U','N','I','O','N','U','S','I','N','G','V',\r\n    'A','C','U','U','M','V','I','E','W','I','N','I','T','I','A','L','L','Y',\r\n  };\r\n  static const unsigned char aHash[127] = {\r\n      72, 101, 114,  70,   0,  45,   0,   0,  78,   0,  73,   0,   0,\r\n      42,  12,  74,  15,   0, 113,  81,  50, 108,   0,  19,   0,   0,\r\n     118,   0, 116, 111,   0,  22,  89,   0,   9,   0,   0,  66,  67,\r\n       0,  65,   6,   0,  48,  86,  98,   0, 115,  97,   0,   0,  44,\r\n       0,  99,  24,   0,  17,   0, 119,  49,  23,   0,   5, 106,  25,\r\n      92,   0,   0, 121, 102,  56, 120,  53,  28,  51,   0,  87,   0,\r\n      96,  26,   0,  95,   0,   0,   0,  91,  88,  93,  84, 105,  14,\r\n      39, 104,   0,  77,   0,  18,  85, 107,  32,   0, 117,  76, 109,\r\n      58,  46,  80,   0,   0,  90,  40,   0, 112,   0,  36,   0,   0,\r\n      29,   0,  82,  59,  60,   0,  20,  57,   0,  52,\r\n  };\r\n  static const unsigned char aNext[121] = {\r\n       0,   0,   0,   0,   4,   0,   0,   0,   0,   0,   0,   0,   0,\r\n       0,   2,   0,   0,   0,   0,   0,   0,  13,   0,   0,   0,   0,\r\n       0,   7,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n       0,   0,   0,   0,  33,   0,  21,   0,   0,   0,  43,   3,  47,\r\n       0,   0,   0,   0,  30,   0,  54,   0,  38,   0,   0,   0,   1,\r\n      62,   0,   0,  63,   0,  41,   0,   0,   0,   0,   0,   0,   0,\r\n      61,   0,   0,   0,   0,  31,  55,  16,  34,  10,   0,   0,   0,\r\n       0,   0,   0,   0,  11,  68,  75,   0,   8,   0, 100,  94,   0,\r\n     103,   0,  83,   0,  71,   0,   0, 110,  27,  37,  69,  79,   0,\r\n      35,  64,   0,   0,\r\n  };\r\n  static const unsigned char aLen[121] = {\r\n       7,   7,   5,   4,   6,   4,   5,   3,   6,   7,   3,   6,   6,\r\n       7,   7,   3,   8,   2,   6,   5,   4,   4,   3,  10,   4,   6,\r\n      11,   6,   2,   7,   5,   5,   9,   6,   9,   9,   7,  10,  10,\r\n       4,   6,   2,   3,   9,   4,   2,   6,   5,   6,   6,   5,   6,\r\n       5,   5,   7,   7,   7,   3,   2,   4,   4,   7,   3,   6,   4,\r\n       7,   6,  12,   6,   9,   4,   6,   5,   4,   7,   6,   5,   6,\r\n       7,   5,   4,   5,   6,   5,   7,   3,   7,  13,   2,   2,   4,\r\n       6,   6,   8,   5,  17,  12,   7,   8,   8,   2,   4,   4,   4,\r\n       4,   4,   2,   2,   6,   5,   8,   5,   5,   8,   3,   5,   5,\r\n       6,   4,   9,   3,\r\n  };\r\n  static const unsigned short int aOffset[121] = {\r\n       0,   2,   2,   8,   9,  14,  16,  20,  23,  25,  25,  29,  33,\r\n      36,  41,  46,  48,  53,  54,  59,  62,  65,  67,  69,  78,  81,\r\n      86,  91,  95,  96, 101, 105, 109, 117, 122, 128, 136, 142, 152,\r\n     159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 189, 194, 197,\r\n     203, 206, 210, 217, 223, 223, 223, 226, 229, 233, 234, 238, 244,\r\n     248, 255, 261, 273, 279, 288, 290, 296, 301, 303, 310, 315, 320,\r\n     326, 332, 337, 341, 344, 350, 354, 361, 363, 370, 372, 374, 383,\r\n     387, 393, 399, 407, 412, 412, 428, 435, 442, 443, 450, 454, 458,\r\n     462, 466, 469, 471, 473, 479, 483, 491, 495, 500, 508, 511, 516,\r\n     521, 527, 531, 536,\r\n  };\r\n  static const unsigned char aCode[121] = {\r\n    TK_REINDEX,    TK_INDEXED,    TK_INDEX,      TK_DESC,       TK_ESCAPE,     \r\n    TK_EACH,       TK_CHECK,      TK_KEY,        TK_BEFORE,     TK_FOREIGN,    \r\n    TK_FOR,        TK_IGNORE,     TK_LIKE_KW,    TK_EXPLAIN,    TK_INSTEAD,    \r\n    TK_ADD,        TK_DATABASE,   TK_AS,         TK_SELECT,     TK_TABLE,      \r\n    TK_JOIN_KW,    TK_THEN,       TK_END,        TK_DEFERRABLE, TK_ELSE,       \r\n    TK_EXCEPT,     TK_TRANSACTION,TK_ACTION,     TK_ON,         TK_JOIN_KW,    \r\n    TK_ALTER,      TK_RAISE,      TK_EXCLUSIVE,  TK_EXISTS,     TK_SAVEPOINT,  \r\n    TK_INTERSECT,  TK_TRIGGER,    TK_REFERENCES, TK_CONSTRAINT, TK_INTO,       \r\n    TK_OFFSET,     TK_OF,         TK_SET,        TK_TEMP,       TK_TEMP,       \r\n    TK_OR,         TK_UNIQUE,     TK_QUERY,      TK_ATTACH,     TK_HAVING,     \r\n    TK_GROUP,      TK_UPDATE,     TK_BEGIN,      TK_JOIN_KW,    TK_RELEASE,    \r\n    TK_BETWEEN,    TK_NOTNULL,    TK_NOT,        TK_NO,         TK_NULL,       \r\n    TK_LIKE_KW,    TK_CASCADE,    TK_ASC,        TK_DELETE,     TK_CASE,       \r\n    TK_COLLATE,    TK_CREATE,     TK_CTIME_KW,   TK_DETACH,     TK_IMMEDIATE,  \r\n    TK_JOIN,       TK_INSERT,     TK_MATCH,      TK_PLAN,       TK_ANALYZE,    \r\n    TK_PRAGMA,     TK_ABORT,      TK_VALUES,     TK_VIRTUAL,    TK_LIMIT,      \r\n    TK_WHEN,       TK_WHERE,      TK_RENAME,     TK_AFTER,      TK_REPLACE,    \r\n    TK_AND,        TK_DEFAULT,    TK_AUTOINCR,   TK_TO,         TK_IN,         \r\n    TK_CAST,       TK_COLUMNKW,   TK_COMMIT,     TK_CONFLICT,   TK_JOIN_KW,    \r\n    TK_CTIME_KW,   TK_CTIME_KW,   TK_PRIMARY,    TK_DEFERRED,   TK_DISTINCT,   \r\n    TK_IS,         TK_DROP,       TK_FAIL,       TK_FROM,       TK_JOIN_KW,    \r\n    TK_LIKE_KW,    TK_BY,         TK_IF,         TK_ISNULL,     TK_ORDER,      \r\n    TK_RESTRICT,   TK_JOIN_KW,    TK_JOIN_KW,    TK_ROLLBACK,   TK_ROW,        \r\n    TK_UNION,      TK_USING,      TK_VACUUM,     TK_VIEW,       TK_INITIALLY,  \r\n    TK_ALL,        \r\n  };\r\n  int h, i;\r\n  if( n<2 ) return TK_ID;\r\n  h = ((charMap(z[0])*4) ^\r\n      (charMap(z[n-1])*3) ^\r\n      n) % 127;\r\n  for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){\r\n    if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){\r\n      testcase( i==0 ); /* REINDEX */\r\n      testcase( i==1 ); /* INDEXED */\r\n      testcase( i==2 ); /* INDEX */\r\n      testcase( i==3 ); /* DESC */\r\n      testcase( i==4 ); /* ESCAPE */\r\n      testcase( i==5 ); /* EACH */\r\n      testcase( i==6 ); /* CHECK */\r\n      testcase( i==7 ); /* KEY */\r\n      testcase( i==8 ); /* BEFORE */\r\n      testcase( i==9 ); /* FOREIGN */\r\n      testcase( i==10 ); /* FOR */\r\n      testcase( i==11 ); /* IGNORE */\r\n      testcase( i==12 ); /* REGEXP */\r\n      testcase( i==13 ); /* EXPLAIN */\r\n      testcase( i==14 ); /* INSTEAD */\r\n      testcase( i==15 ); /* ADD */\r\n      testcase( i==16 ); /* DATABASE */\r\n      testcase( i==17 ); /* AS */\r\n      testcase( i==18 ); /* SELECT */\r\n      testcase( i==19 ); /* TABLE */\r\n      testcase( i==20 ); /* LEFT */\r\n      testcase( i==21 ); /* THEN */\r\n      testcase( i==22 ); /* END */\r\n      testcase( i==23 ); /* DEFERRABLE */\r\n      testcase( i==24 ); /* ELSE */\r\n      testcase( i==25 ); /* EXCEPT */\r\n      testcase( i==26 ); /* TRANSACTION */\r\n      testcase( i==27 ); /* ACTION */\r\n      testcase( i==28 ); /* ON */\r\n      testcase( i==29 ); /* NATURAL */\r\n      testcase( i==30 ); /* ALTER */\r\n      testcase( i==31 ); /* RAISE */\r\n      testcase( i==32 ); /* EXCLUSIVE */\r\n      testcase( i==33 ); /* EXISTS */\r\n      testcase( i==34 ); /* SAVEPOINT */\r\n      testcase( i==35 ); /* INTERSECT */\r\n      testcase( i==36 ); /* TRIGGER */\r\n      testcase( i==37 ); /* REFERENCES */\r\n      testcase( i==38 ); /* CONSTRAINT */\r\n      testcase( i==39 ); /* INTO */\r\n      testcase( i==40 ); /* OFFSET */\r\n      testcase( i==41 ); /* OF */\r\n      testcase( i==42 ); /* SET */\r\n      testcase( i==43 ); /* TEMPORARY */\r\n      testcase( i==44 ); /* TEMP */\r\n      testcase( i==45 ); /* OR */\r\n      testcase( i==46 ); /* UNIQUE */\r\n      testcase( i==47 ); /* QUERY */\r\n      testcase( i==48 ); /* ATTACH */\r\n      testcase( i==49 ); /* HAVING */\r\n      testcase( i==50 ); /* GROUP */\r\n      testcase( i==51 ); /* UPDATE */\r\n      testcase( i==52 ); /* BEGIN */\r\n      testcase( i==53 ); /* INNER */\r\n      testcase( i==54 ); /* RELEASE */\r\n      testcase( i==55 ); /* BETWEEN */\r\n      testcase( i==56 ); /* NOTNULL */\r\n      testcase( i==57 ); /* NOT */\r\n      testcase( i==58 ); /* NO */\r\n      testcase( i==59 ); /* NULL */\r\n      testcase( i==60 ); /* LIKE */\r\n      testcase( i==61 ); /* CASCADE */\r\n      testcase( i==62 ); /* ASC */\r\n      testcase( i==63 ); /* DELETE */\r\n      testcase( i==64 ); /* CASE */\r\n      testcase( i==65 ); /* COLLATE */\r\n      testcase( i==66 ); /* CREATE */\r\n      testcase( i==67 ); /* CURRENT_DATE */\r\n      testcase( i==68 ); /* DETACH */\r\n      testcase( i==69 ); /* IMMEDIATE */\r\n      testcase( i==70 ); /* JOIN */\r\n      testcase( i==71 ); /* INSERT */\r\n      testcase( i==72 ); /* MATCH */\r\n      testcase( i==73 ); /* PLAN */\r\n      testcase( i==74 ); /* ANALYZE */\r\n      testcase( i==75 ); /* PRAGMA */\r\n      testcase( i==76 ); /* ABORT */\r\n      testcase( i==77 ); /* VALUES */\r\n      testcase( i==78 ); /* VIRTUAL */\r\n      testcase( i==79 ); /* LIMIT */\r\n      testcase( i==80 ); /* WHEN */\r\n      testcase( i==81 ); /* WHERE */\r\n      testcase( i==82 ); /* RENAME */\r\n      testcase( i==83 ); /* AFTER */\r\n      testcase( i==84 ); /* REPLACE */\r\n      testcase( i==85 ); /* AND */\r\n      testcase( i==86 ); /* DEFAULT */\r\n      testcase( i==87 ); /* AUTOINCREMENT */\r\n      testcase( i==88 ); /* TO */\r\n      testcase( i==89 ); /* IN */\r\n      testcase( i==90 ); /* CAST */\r\n      testcase( i==91 ); /* COLUMN */\r\n      testcase( i==92 ); /* COMMIT */\r\n      testcase( i==93 ); /* CONFLICT */\r\n      testcase( i==94 ); /* CROSS */\r\n      testcase( i==95 ); /* CURRENT_TIMESTAMP */\r\n      testcase( i==96 ); /* CURRENT_TIME */\r\n      testcase( i==97 ); /* PRIMARY */\r\n      testcase( i==98 ); /* DEFERRED */\r\n      testcase( i==99 ); /* DISTINCT */\r\n      testcase( i==100 ); /* IS */\r\n      testcase( i==101 ); /* DROP */\r\n      testcase( i==102 ); /* FAIL */\r\n      testcase( i==103 ); /* FROM */\r\n      testcase( i==104 ); /* FULL */\r\n      testcase( i==105 ); /* GLOB */\r\n      testcase( i==106 ); /* BY */\r\n      testcase( i==107 ); /* IF */\r\n      testcase( i==108 ); /* ISNULL */\r\n      testcase( i==109 ); /* ORDER */\r\n      testcase( i==110 ); /* RESTRICT */\r\n      testcase( i==111 ); /* OUTER */\r\n      testcase( i==112 ); /* RIGHT */\r\n      testcase( i==113 ); /* ROLLBACK */\r\n      testcase( i==114 ); /* ROW */\r\n      testcase( i==115 ); /* UNION */\r\n      testcase( i==116 ); /* USING */\r\n      testcase( i==117 ); /* VACUUM */\r\n      testcase( i==118 ); /* VIEW */\r\n      testcase( i==119 ); /* INITIALLY */\r\n      testcase( i==120 ); /* ALL */\r\n      return aCode[i];\r\n    }\r\n  }\r\n  return TK_ID;\r\n}\r\nSQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){\r\n  return keywordCode((char*)z, n);\r\n}\r\n#define SQLITE_N_KEYWORD 121\r\n\r\n/************** End of keywordhash.h *****************************************/\r\n/************** Continuing where we left off in tokenize.c *******************/\r\n\r\n\r\n/*\r\n** If X is a character that can be used in an identifier then\r\n** IdChar(X) will be true.  Otherwise it is false.\r\n**\r\n** For ASCII, any character with the high-order bit set is\r\n** allowed in an identifier.  For 7-bit characters, \r\n** sqlite3IsIdChar[X] must be 1.\r\n**\r\n** For EBCDIC, the rules are more complex but have the same\r\n** end result.\r\n**\r\n** Ticket #1066.  the SQL standard does not allow '$' in the\r\n** middle of identfiers.  But many SQL implementations do. \r\n** SQLite will allow '$' in identifiers for compatibility.\r\n** But the feature is undocumented.\r\n*/\r\n#ifdef SQLITE_ASCII\r\n#define IdChar(C)  ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0)\r\n#endif\r\n#ifdef SQLITE_EBCDIC\r\nSQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[] = {\r\n/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */\r\n    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 4x */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,  /* 5x */\r\n    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0,  /* 6x */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,  /* 7x */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0,  /* 8x */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0,  /* 9x */\r\n    1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,  /* Ax */\r\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* Bx */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Cx */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Dx */\r\n    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Ex */\r\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,  /* Fx */\r\n};\r\n#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))\r\n#endif\r\n\r\n\r\n/*\r\n** Return the length of the token that begins at z[0]. \r\n** Store the token type in *tokenType before returning.\r\n*/\r\nSQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){\r\n  int i, c;\r\n  switch( *z ){\r\n    case ' ': case '\\t': case '\\n': case '\\f': case '\\r': {\r\n      testcase( z[0]==' ' );\r\n      testcase( z[0]=='\\t' );\r\n      testcase( z[0]=='\\n' );\r\n      testcase( z[0]=='\\f' );\r\n      testcase( z[0]=='\\r' );\r\n      for(i=1; sqlite3Isspace(z[i]); i++){}\r\n      *tokenType = TK_SPACE;\r\n      return i;\r\n    }\r\n    case '-': {\r\n      if( z[1]=='-' ){\r\n        /* IMP: R-50417-27976 -- syntax diagram for comments */\r\n        for(i=2; (c=z[i])!=0 && c!='\\n'; i++){}\r\n        *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */\r\n        return i;\r\n      }\r\n      *tokenType = TK_MINUS;\r\n      return 1;\r\n    }\r\n    case '(': {\r\n      *tokenType = TK_LP;\r\n      return 1;\r\n    }\r\n    case ')': {\r\n      *tokenType = TK_RP;\r\n      return 1;\r\n    }\r\n    case ';': {\r\n      *tokenType = TK_SEMI;\r\n      return 1;\r\n    }\r\n    case '+': {\r\n      *tokenType = TK_PLUS;\r\n      return 1;\r\n    }\r\n    case '*': {\r\n      *tokenType = TK_STAR;\r\n      return 1;\r\n    }\r\n    case '/': {\r\n      if( z[1]!='*' || z[2]==0 ){\r\n        *tokenType = TK_SLASH;\r\n        return 1;\r\n      }\r\n      /* IMP: R-50417-27976 -- syntax diagram for comments */\r\n      for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}\r\n      if( c ) i++;\r\n      *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */\r\n      return i;\r\n    }\r\n    case '%': {\r\n      *tokenType = TK_REM;\r\n      return 1;\r\n    }\r\n    case '=': {\r\n      *tokenType = TK_EQ;\r\n      return 1 + (z[1]=='=');\r\n    }\r\n    case '<': {\r\n      if( (c=z[1])=='=' ){\r\n        *tokenType = TK_LE;\r\n        return 2;\r\n      }else if( c=='>' ){\r\n        *tokenType = TK_NE;\r\n        return 2;\r\n      }else if( c=='<' ){\r\n        *tokenType = TK_LSHIFT;\r\n        return 2;\r\n      }else{\r\n        *tokenType = TK_LT;\r\n        return 1;\r\n      }\r\n    }\r\n    case '>': {\r\n      if( (c=z[1])=='=' ){\r\n        *tokenType = TK_GE;\r\n        return 2;\r\n      }else if( c=='>' ){\r\n        *tokenType = TK_RSHIFT;\r\n        return 2;\r\n      }else{\r\n        *tokenType = TK_GT;\r\n        return 1;\r\n      }\r\n    }\r\n    case '!': {\r\n      if( z[1]!='=' ){\r\n        *tokenType = TK_ILLEGAL;\r\n        return 2;\r\n      }else{\r\n        *tokenType = TK_NE;\r\n        return 2;\r\n      }\r\n    }\r\n    case '|': {\r\n      if( z[1]!='|' ){\r\n        *tokenType = TK_BITOR;\r\n        return 1;\r\n      }else{\r\n        *tokenType = TK_CONCAT;\r\n        return 2;\r\n      }\r\n    }\r\n    case ',': {\r\n      *tokenType = TK_COMMA;\r\n      return 1;\r\n    }\r\n    case '&': {\r\n      *tokenType = TK_BITAND;\r\n      return 1;\r\n    }\r\n    case '~': {\r\n      *tokenType = TK_BITNOT;\r\n      return 1;\r\n    }\r\n    case '`':\r\n    case '\\'':\r\n    case '\"': {\r\n      int delim = z[0];\r\n      testcase( delim=='`' );\r\n      testcase( delim=='\\'' );\r\n      testcase( delim=='\"' );\r\n      for(i=1; (c=z[i])!=0; i++){\r\n        if( c==delim ){\r\n          if( z[i+1]==delim ){\r\n            i++;\r\n          }else{\r\n            break;\r\n          }\r\n        }\r\n      }\r\n      if( c=='\\'' ){\r\n        *tokenType = TK_STRING;\r\n        return i+1;\r\n      }else if( c!=0 ){\r\n        *tokenType = TK_ID;\r\n        return i+1;\r\n      }else{\r\n        *tokenType = TK_ILLEGAL;\r\n        return i;\r\n      }\r\n    }\r\n    case '.': {\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n      if( !sqlite3Isdigit(z[1]) )\r\n#endif\r\n      {\r\n        *tokenType = TK_DOT;\r\n        return 1;\r\n      }\r\n      /* If the next character is a digit, this is a floating point\r\n      ** number that begins with \".\".  Fall thru into the next case */\r\n    }\r\n    case '0': case '1': case '2': case '3': case '4':\r\n    case '5': case '6': case '7': case '8': case '9': {\r\n      testcase( z[0]=='0' );  testcase( z[0]=='1' );  testcase( z[0]=='2' );\r\n      testcase( z[0]=='3' );  testcase( z[0]=='4' );  testcase( z[0]=='5' );\r\n      testcase( z[0]=='6' );  testcase( z[0]=='7' );  testcase( z[0]=='8' );\r\n      testcase( z[0]=='9' );\r\n      *tokenType = TK_INTEGER;\r\n      for(i=0; sqlite3Isdigit(z[i]); i++){}\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n      if( z[i]=='.' ){\r\n        i++;\r\n        while( sqlite3Isdigit(z[i]) ){ i++; }\r\n        *tokenType = TK_FLOAT;\r\n      }\r\n      if( (z[i]=='e' || z[i]=='E') &&\r\n           ( sqlite3Isdigit(z[i+1]) \r\n            || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))\r\n           )\r\n      ){\r\n        i += 2;\r\n        while( sqlite3Isdigit(z[i]) ){ i++; }\r\n        *tokenType = TK_FLOAT;\r\n      }\r\n#endif\r\n      while( IdChar(z[i]) ){\r\n        *tokenType = TK_ILLEGAL;\r\n        i++;\r\n      }\r\n      return i;\r\n    }\r\n    case '[': {\r\n      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}\r\n      *tokenType = c==']' ? TK_ID : TK_ILLEGAL;\r\n      return i;\r\n    }\r\n    case '?': {\r\n      *tokenType = TK_VARIABLE;\r\n      for(i=1; sqlite3Isdigit(z[i]); i++){}\r\n      return i;\r\n    }\r\n    case '#': {\r\n      for(i=1; sqlite3Isdigit(z[i]); i++){}\r\n      if( i>1 ){\r\n        /* Parameters of the form #NNN (where NNN is a number) are used\r\n        ** internally by sqlite3NestedParse.  */\r\n        *tokenType = TK_REGISTER;\r\n        return i;\r\n      }\r\n      /* Fall through into the next case if the '#' is not followed by\r\n      ** a digit. Try to match #AAAA where AAAA is a parameter name. */\r\n    }\r\n#ifndef SQLITE_OMIT_TCL_VARIABLE\r\n    case '$':\r\n#endif\r\n    case '@':  /* For compatibility with MS SQL Server */\r\n    case ':': {\r\n      int n = 0;\r\n      testcase( z[0]=='$' );  testcase( z[0]=='@' );  testcase( z[0]==':' );\r\n      *tokenType = TK_VARIABLE;\r\n      for(i=1; (c=z[i])!=0; i++){\r\n        if( IdChar(c) ){\r\n          n++;\r\n#ifndef SQLITE_OMIT_TCL_VARIABLE\r\n        }else if( c=='(' && n>0 ){\r\n          do{\r\n            i++;\r\n          }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' );\r\n          if( c==')' ){\r\n            i++;\r\n          }else{\r\n            *tokenType = TK_ILLEGAL;\r\n          }\r\n          break;\r\n        }else if( c==':' && z[i+1]==':' ){\r\n          i++;\r\n#endif\r\n        }else{\r\n          break;\r\n        }\r\n      }\r\n      if( n==0 ) *tokenType = TK_ILLEGAL;\r\n      return i;\r\n    }\r\n#ifndef SQLITE_OMIT_BLOB_LITERAL\r\n    case 'x': case 'X': {\r\n      testcase( z[0]=='x' ); testcase( z[0]=='X' );\r\n      if( z[1]=='\\'' ){\r\n        *tokenType = TK_BLOB;\r\n        for(i=2; sqlite3Isxdigit(z[i]); i++){}\r\n        if( z[i]!='\\'' || i%2 ){\r\n          *tokenType = TK_ILLEGAL;\r\n          while( z[i] && z[i]!='\\'' ){ i++; }\r\n        }\r\n        if( z[i] ) i++;\r\n        return i;\r\n      }\r\n      /* Otherwise fall through to the next case */\r\n    }\r\n#endif\r\n    default: {\r\n      if( !IdChar(*z) ){\r\n        break;\r\n      }\r\n      for(i=1; IdChar(z[i]); i++){}\r\n      *tokenType = keywordCode((char*)z, i);\r\n      return i;\r\n    }\r\n  }\r\n  *tokenType = TK_ILLEGAL;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Run the parser on the given SQL string.  The parser structure is\r\n** passed in.  An SQLITE_ status code is returned.  If an error occurs\r\n** then an and attempt is made to write an error message into \r\n** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that\r\n** error message.\r\n*/\r\nSQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){\r\n  int nErr = 0;                   /* Number of errors encountered */\r\n  int i;                          /* Loop counter */\r\n  void *pEngine;                  /* The LEMON-generated LALR(1) parser */\r\n  int tokenType;                  /* type of the next token */\r\n  int lastTokenParsed = -1;       /* type of the previous token */\r\n  u8 enableLookaside;             /* Saved value of db->lookaside.bEnabled */\r\n  sqlite3 *db = pParse->db;       /* The database connection */\r\n  int mxSqlLen;                   /* Max length of an SQL string */\r\n\r\n\r\n  mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];\r\n  if( db->activeVdbeCnt==0 ){\r\n    db->u1.isInterrupted = 0;\r\n  }\r\n  pParse->rc = SQLITE_OK;\r\n  pParse->zTail = zSql;\r\n  i = 0;\r\n  assert( pzErrMsg!=0 );\r\n  pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3Malloc);\r\n  if( pEngine==0 ){\r\n    db->mallocFailed = 1;\r\n    return SQLITE_NOMEM;\r\n  }\r\n  assert( pParse->pNewTable==0 );\r\n  assert( pParse->pNewTrigger==0 );\r\n  assert( pParse->nVar==0 );\r\n  assert( pParse->nzVar==0 );\r\n  assert( pParse->azVar==0 );\r\n  enableLookaside = db->lookaside.bEnabled;\r\n  if( db->lookaside.pStart ) db->lookaside.bEnabled = 1;\r\n  while( !db->mallocFailed && zSql[i]!=0 ){\r\n    assert( i>=0 );\r\n    pParse->sLastToken.z = &zSql[i];\r\n    pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType);\r\n    i += pParse->sLastToken.n;\r\n    if( i>mxSqlLen ){\r\n      pParse->rc = SQLITE_TOOBIG;\r\n      break;\r\n    }\r\n    switch( tokenType ){\r\n      case TK_SPACE: {\r\n        if( db->u1.isInterrupted ){\r\n          sqlite3ErrorMsg(pParse, \"interrupt\");\r\n          pParse->rc = SQLITE_INTERRUPT;\r\n          goto abort_parse;\r\n        }\r\n        break;\r\n      }\r\n      case TK_ILLEGAL: {\r\n        sqlite3DbFree(db, *pzErrMsg);\r\n        *pzErrMsg = sqlite3MPrintf(db, \"unrecognized token: \\\"%T\\\"\",\r\n                        &pParse->sLastToken);\r\n        nErr++;\r\n        goto abort_parse;\r\n      }\r\n      case TK_SEMI: {\r\n        pParse->zTail = &zSql[i];\r\n        /* Fall thru into the default case */\r\n      }\r\n      default: {\r\n        sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);\r\n        lastTokenParsed = tokenType;\r\n        if( pParse->rc!=SQLITE_OK ){\r\n          goto abort_parse;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n  }\r\nabort_parse:\r\n  if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){\r\n    if( lastTokenParsed!=TK_SEMI ){\r\n      sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);\r\n      pParse->zTail = &zSql[i];\r\n    }\r\n    sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);\r\n  }\r\n#ifdef YYTRACKMAXSTACKDEPTH\r\n  sqlite3StatusSet(SQLITE_STATUS_PARSER_STACK,\r\n      sqlite3ParserStackPeak(pEngine)\r\n  );\r\n#endif /* YYDEBUG */\r\n  sqlite3ParserFree(pEngine, sqlite3_free);\r\n  db->lookaside.bEnabled = enableLookaside;\r\n  if( db->mallocFailed ){\r\n    pParse->rc = SQLITE_NOMEM;\r\n  }\r\n  if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){\r\n    sqlite3SetString(&pParse->zErrMsg, db, \"%s\", sqlite3ErrStr(pParse->rc));\r\n  }\r\n  assert( pzErrMsg!=0 );\r\n  if( pParse->zErrMsg ){\r\n    *pzErrMsg = pParse->zErrMsg;\r\n    sqlite3_log(pParse->rc, \"%s\", *pzErrMsg);\r\n    pParse->zErrMsg = 0;\r\n    nErr++;\r\n  }\r\n  if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){\r\n    sqlite3VdbeDelete(pParse->pVdbe);\r\n    pParse->pVdbe = 0;\r\n  }\r\n#ifndef SQLITE_OMIT_SHARED_CACHE\r\n  if( pParse->nested==0 ){\r\n    sqlite3DbFree(db, pParse->aTableLock);\r\n    pParse->aTableLock = 0;\r\n    pParse->nTableLock = 0;\r\n  }\r\n#endif\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  sqlite3_free(pParse->apVtabLock);\r\n#endif\r\n\r\n  if( !IN_DECLARE_VTAB ){\r\n    /* If the pParse->declareVtab flag is set, do not delete any table \r\n    ** structure built up in pParse->pNewTable. The calling code (see vtab.c)\r\n    ** will take responsibility for freeing the Table structure.\r\n    */\r\n    sqlite3DeleteTable(db, pParse->pNewTable);\r\n  }\r\n\r\n  sqlite3DeleteTrigger(db, pParse->pNewTrigger);\r\n  for(i=pParse->nzVar-1; i>=0; i--) sqlite3DbFree(db, pParse->azVar[i]);\r\n  sqlite3DbFree(db, pParse->azVar);\r\n  sqlite3DbFree(db, pParse->aAlias);\r\n  while( pParse->pAinc ){\r\n    AutoincInfo *p = pParse->pAinc;\r\n    pParse->pAinc = p->pNext;\r\n    sqlite3DbFree(db, p);\r\n  }\r\n  while( pParse->pZombieTab ){\r\n    Table *p = pParse->pZombieTab;\r\n    pParse->pZombieTab = p->pNextZombie;\r\n    sqlite3DeleteTable(db, p);\r\n  }\r\n  if( nErr>0 && pParse->rc==SQLITE_OK ){\r\n    pParse->rc = SQLITE_ERROR;\r\n  }\r\n  return nErr;\r\n}\r\n\r\n/************** End of tokenize.c ********************************************/\r\n/************** Begin file complete.c ****************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** An tokenizer for SQL\r\n**\r\n** This file contains C code that implements the sqlite3_complete() API.\r\n** This code used to be part of the tokenizer.c source file.  But by\r\n** separating it out, the code will be automatically omitted from\r\n** static links that do not use it.\r\n*/\r\n#ifndef SQLITE_OMIT_COMPLETE\r\n\r\n/*\r\n** This is defined in tokenize.c.  We just have to import the definition.\r\n*/\r\n#ifndef SQLITE_AMALGAMATION\r\n#ifdef SQLITE_ASCII\r\n#define IdChar(C)  ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0)\r\n#endif\r\n#ifdef SQLITE_EBCDIC\r\nSQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[];\r\n#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))\r\n#endif\r\n#endif /* SQLITE_AMALGAMATION */\r\n\r\n\r\n/*\r\n** Token types used by the sqlite3_complete() routine.  See the header\r\n** comments on that procedure for additional information.\r\n*/\r\n#define tkSEMI    0\r\n#define tkWS      1\r\n#define tkOTHER   2\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n#define tkEXPLAIN 3\r\n#define tkCREATE  4\r\n#define tkTEMP    5\r\n#define tkTRIGGER 6\r\n#define tkEND     7\r\n#endif\r\n\r\n/*\r\n** Return TRUE if the given SQL string ends in a semicolon.\r\n**\r\n** Special handling is require for CREATE TRIGGER statements.\r\n** Whenever the CREATE TRIGGER keywords are seen, the statement\r\n** must end with \";END;\".\r\n**\r\n** This implementation uses a state machine with 8 states:\r\n**\r\n**   (0) INVALID   We have not yet seen a non-whitespace character.\r\n**\r\n**   (1) START     At the beginning or end of an SQL statement.  This routine\r\n**                 returns 1 if it ends in the START state and 0 if it ends\r\n**                 in any other state.\r\n**\r\n**   (2) NORMAL    We are in the middle of statement which ends with a single\r\n**                 semicolon.\r\n**\r\n**   (3) EXPLAIN   The keyword EXPLAIN has been seen at the beginning of \r\n**                 a statement.\r\n**\r\n**   (4) CREATE    The keyword CREATE has been seen at the beginning of a\r\n**                 statement, possibly preceeded by EXPLAIN and/or followed by\r\n**                 TEMP or TEMPORARY\r\n**\r\n**   (5) TRIGGER   We are in the middle of a trigger definition that must be\r\n**                 ended by a semicolon, the keyword END, and another semicolon.\r\n**\r\n**   (6) SEMI      We've seen the first semicolon in the \";END;\" that occurs at\r\n**                 the end of a trigger definition.\r\n**\r\n**   (7) END       We've seen the \";END\" of the \";END;\" that occurs at the end\r\n**                 of a trigger difinition.\r\n**\r\n** Transitions between states above are determined by tokens extracted\r\n** from the input.  The following tokens are significant:\r\n**\r\n**   (0) tkSEMI      A semicolon.\r\n**   (1) tkWS        Whitespace.\r\n**   (2) tkOTHER     Any other SQL token.\r\n**   (3) tkEXPLAIN   The \"explain\" keyword.\r\n**   (4) tkCREATE    The \"create\" keyword.\r\n**   (5) tkTEMP      The \"temp\" or \"temporary\" keyword.\r\n**   (6) tkTRIGGER   The \"trigger\" keyword.\r\n**   (7) tkEND       The \"end\" keyword.\r\n**\r\n** Whitespace never causes a state transition and is always ignored.\r\n** This means that a SQL string of all whitespace is invalid.\r\n**\r\n** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed\r\n** to recognize the end of a trigger can be omitted.  All we have to do\r\n** is look for a semicolon that is not part of an string or comment.\r\n*/\r\nSQLITE_API int sqlite3_complete(const char *zSql){\r\n  u8 state = 0;   /* Current state, using numbers defined in header comment */\r\n  u8 token;       /* Value of the next token */\r\n\r\n#ifndef SQLITE_OMIT_TRIGGER\r\n  /* A complex statement machine used to detect the end of a CREATE TRIGGER\r\n  ** statement.  This is the normal case.\r\n  */\r\n  static const u8 trans[8][8] = {\r\n                     /* Token:                                                */\r\n     /* State:       **  SEMI  WS  OTHER  EXPLAIN  CREATE  TEMP  TRIGGER  END */\r\n     /* 0 INVALID: */ {    1,  0,     2,       3,      4,    2,       2,   2, },\r\n     /* 1   START: */ {    1,  1,     2,       3,      4,    2,       2,   2, },\r\n     /* 2  NORMAL: */ {    1,  2,     2,       2,      2,    2,       2,   2, },\r\n     /* 3 EXPLAIN: */ {    1,  3,     3,       2,      4,    2,       2,   2, },\r\n     /* 4  CREATE: */ {    1,  4,     2,       2,      2,    4,       5,   2, },\r\n     /* 5 TRIGGER: */ {    6,  5,     5,       5,      5,    5,       5,   5, },\r\n     /* 6    SEMI: */ {    6,  6,     5,       5,      5,    5,       5,   7, },\r\n     /* 7     END: */ {    1,  7,     5,       5,      5,    5,       5,   5, },\r\n  };\r\n#else\r\n  /* If triggers are not supported by this compile then the statement machine\r\n  ** used to detect the end of a statement is much simplier\r\n  */\r\n  static const u8 trans[3][3] = {\r\n                     /* Token:           */\r\n     /* State:       **  SEMI  WS  OTHER */\r\n     /* 0 INVALID: */ {    1,  0,     2, },\r\n     /* 1   START: */ {    1,  1,     2, },\r\n     /* 2  NORMAL: */ {    1,  2,     2, },\r\n  };\r\n#endif /* SQLITE_OMIT_TRIGGER */\r\n\r\n  while( *zSql ){\r\n    switch( *zSql ){\r\n      case ';': {  /* A semicolon */\r\n        token = tkSEMI;\r\n        break;\r\n      }\r\n      case ' ':\r\n      case '\\r':\r\n      case '\\t':\r\n      case '\\n':\r\n      case '\\f': {  /* White space is ignored */\r\n        token = tkWS;\r\n        break;\r\n      }\r\n      case '/': {   /* C-style comments */\r\n        if( zSql[1]!='*' ){\r\n          token = tkOTHER;\r\n          break;\r\n        }\r\n        zSql += 2;\r\n        while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }\r\n        if( zSql[0]==0 ) return 0;\r\n        zSql++;\r\n        token = tkWS;\r\n        break;\r\n      }\r\n      case '-': {   /* SQL-style comments from \"--\" to end of line */\r\n        if( zSql[1]!='-' ){\r\n          token = tkOTHER;\r\n          break;\r\n        }\r\n        while( *zSql && *zSql!='\\n' ){ zSql++; }\r\n        if( *zSql==0 ) return state==1;\r\n        token = tkWS;\r\n        break;\r\n      }\r\n      case '[': {   /* Microsoft-style identifiers in [...] */\r\n        zSql++;\r\n        while( *zSql && *zSql!=']' ){ zSql++; }\r\n        if( *zSql==0 ) return 0;\r\n        token = tkOTHER;\r\n        break;\r\n      }\r\n      case '`':     /* Grave-accent quoted symbols used by MySQL */\r\n      case '\"':     /* single- and double-quoted strings */\r\n      case '\\'': {\r\n        int c = *zSql;\r\n        zSql++;\r\n        while( *zSql && *zSql!=c ){ zSql++; }\r\n        if( *zSql==0 ) return 0;\r\n        token = tkOTHER;\r\n        break;\r\n      }\r\n      default: {\r\n#ifdef SQLITE_EBCDIC\r\n        unsigned char c;\r\n#endif\r\n        if( IdChar((u8)*zSql) ){\r\n          /* Keywords and unquoted identifiers */\r\n          int nId;\r\n          for(nId=1; IdChar(zSql[nId]); nId++){}\r\n#ifdef SQLITE_OMIT_TRIGGER\r\n          token = tkOTHER;\r\n#else\r\n          switch( *zSql ){\r\n            case 'c': case 'C': {\r\n              if( nId==6 && sqlite3StrNICmp(zSql, \"create\", 6)==0 ){\r\n                token = tkCREATE;\r\n              }else{\r\n                token = tkOTHER;\r\n              }\r\n              break;\r\n            }\r\n            case 't': case 'T': {\r\n              if( nId==7 && sqlite3StrNICmp(zSql, \"trigger\", 7)==0 ){\r\n                token = tkTRIGGER;\r\n              }else if( nId==4 && sqlite3StrNICmp(zSql, \"temp\", 4)==0 ){\r\n                token = tkTEMP;\r\n              }else if( nId==9 && sqlite3StrNICmp(zSql, \"temporary\", 9)==0 ){\r\n                token = tkTEMP;\r\n              }else{\r\n                token = tkOTHER;\r\n              }\r\n              break;\r\n            }\r\n            case 'e':  case 'E': {\r\n              if( nId==3 && sqlite3StrNICmp(zSql, \"end\", 3)==0 ){\r\n                token = tkEND;\r\n              }else\r\n#ifndef SQLITE_OMIT_EXPLAIN\r\n              if( nId==7 && sqlite3StrNICmp(zSql, \"explain\", 7)==0 ){\r\n                token = tkEXPLAIN;\r\n              }else\r\n#endif\r\n              {\r\n                token = tkOTHER;\r\n              }\r\n              break;\r\n            }\r\n            default: {\r\n              token = tkOTHER;\r\n              break;\r\n            }\r\n          }\r\n#endif /* SQLITE_OMIT_TRIGGER */\r\n          zSql += nId-1;\r\n        }else{\r\n          /* Operators and special symbols */\r\n          token = tkOTHER;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n    state = trans[state][token];\r\n    zSql++;\r\n  }\r\n  return state==1;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** This routine is the same as the sqlite3_complete() routine described\r\n** above, except that the parameter is required to be UTF-16 encoded, not\r\n** UTF-8.\r\n*/\r\nSQLITE_API int sqlite3_complete16(const void *zSql){\r\n  sqlite3_value *pVal;\r\n  char const *zSql8;\r\n  int rc = SQLITE_NOMEM;\r\n\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  rc = sqlite3_initialize();\r\n  if( rc ) return rc;\r\n#endif\r\n  pVal = sqlite3ValueNew(0);\r\n  sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC);\r\n  zSql8 = sqlite3ValueText(pVal, SQLITE_UTF8);\r\n  if( zSql8 ){\r\n    rc = sqlite3_complete(zSql8);\r\n  }else{\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n  sqlite3ValueFree(pVal);\r\n  return sqlite3ApiExit(0, rc);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n#endif /* SQLITE_OMIT_COMPLETE */\r\n\r\n/************** End of complete.c ********************************************/\r\n/************** Begin file main.c ********************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** Main file for the SQLite library.  The routines in this file\r\n** implement the programmer interface to the library.  Routines in\r\n** other files are for internal use by SQLite and should not be\r\n** accessed by users of the library.\r\n*/\r\n\r\n#ifdef SQLITE_ENABLE_FTS3\r\n/************** Include fts3.h in the middle of main.c ***********************/\r\n/************** Begin file fts3.h ********************************************/\r\n/*\r\n** 2006 Oct 10\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This header file is used by programs that want to link against the\r\n** FTS3 library.  All it does is declare the sqlite3Fts3Init() interface.\r\n*/\r\n\r\n#if 0\r\nextern \"C\" {\r\n#endif  /* __cplusplus */\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db);\r\n\r\n#if 0\r\n}  /* extern \"C\" */\r\n#endif  /* __cplusplus */\r\n\r\n/************** End of fts3.h ************************************************/\r\n/************** Continuing where we left off in main.c ***********************/\r\n#endif\r\n#ifdef SQLITE_ENABLE_RTREE\r\n/************** Include rtree.h in the middle of main.c **********************/\r\n/************** Begin file rtree.h *******************************************/\r\n/*\r\n** 2008 May 26\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This header file is used by programs that want to link against the\r\n** RTREE library.  All it does is declare the sqlite3RtreeInit() interface.\r\n*/\r\n\r\n#if 0\r\nextern \"C\" {\r\n#endif  /* __cplusplus */\r\n\r\nSQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db);\r\n\r\n#if 0\r\n}  /* extern \"C\" */\r\n#endif  /* __cplusplus */\r\n\r\n/************** End of rtree.h ***********************************************/\r\n/************** Continuing where we left off in main.c ***********************/\r\n#endif\r\n#ifdef SQLITE_ENABLE_ICU\r\n/************** Include sqliteicu.h in the middle of main.c ******************/\r\n/************** Begin file sqliteicu.h ***************************************/\r\n/*\r\n** 2008 May 26\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This header file is used by programs that want to link against the\r\n** ICU extension.  All it does is declare the sqlite3IcuInit() interface.\r\n*/\r\n\r\n#if 0\r\nextern \"C\" {\r\n#endif  /* __cplusplus */\r\n\r\nSQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db);\r\n\r\n#if 0\r\n}  /* extern \"C\" */\r\n#endif  /* __cplusplus */\r\n\r\n\r\n/************** End of sqliteicu.h *******************************************/\r\n/************** Continuing where we left off in main.c ***********************/\r\n#endif\r\n\r\n#ifndef SQLITE_AMALGAMATION\r\n/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant\r\n** contains the text of SQLITE_VERSION macro. \r\n*/\r\nSQLITE_API const char sqlite3_version[] = SQLITE_VERSION;\r\n#endif\r\n\r\n/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns\r\n** a pointer to the to the sqlite3_version[] string constant. \r\n*/\r\nSQLITE_API const char *sqlite3_libversion(void){ return sqlite3_version; }\r\n\r\n/* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a\r\n** pointer to a string constant whose value is the same as the\r\n** SQLITE_SOURCE_ID C preprocessor macro. \r\n*/\r\nSQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }\r\n\r\n/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function\r\n** returns an integer equal to SQLITE_VERSION_NUMBER.\r\n*/\r\nSQLITE_API int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }\r\n\r\n/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns\r\n** zero if and only if SQLite was compiled with mutexing code omitted due to\r\n** the SQLITE_THREADSAFE compile-time option being set to 0.\r\n*/\r\nSQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }\r\n\r\n#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)\r\n/*\r\n** If the following function pointer is not NULL and if\r\n** SQLITE_ENABLE_IOTRACE is enabled, then messages describing\r\n** I/O active are written using this function.  These messages\r\n** are intended for debugging activity only.\r\n*/\r\nSQLITE_PRIVATE void (*sqlite3IoTrace)(const char*, ...) = 0;\r\n#endif\r\n\r\n/*\r\n** If the following global variable points to a string which is the\r\n** name of a directory, then that directory will be used to store\r\n** temporary files.\r\n**\r\n** See also the \"PRAGMA temp_store_directory\" SQL command.\r\n*/\r\nSQLITE_API char *sqlite3_temp_directory = 0;\r\n\r\n/*\r\n** Initialize SQLite.  \r\n**\r\n** This routine must be called to initialize the memory allocation,\r\n** VFS, and mutex subsystems prior to doing any serious work with\r\n** SQLite.  But as long as you do not compile with SQLITE_OMIT_AUTOINIT\r\n** this routine will be called automatically by key routines such as\r\n** sqlite3_open().  \r\n**\r\n** This routine is a no-op except on its very first call for the process,\r\n** or for the first call after a call to sqlite3_shutdown.\r\n**\r\n** The first thread to call this routine runs the initialization to\r\n** completion.  If subsequent threads call this routine before the first\r\n** thread has finished the initialization process, then the subsequent\r\n** threads must block until the first thread finishes with the initialization.\r\n**\r\n** The first thread might call this routine recursively.  Recursive\r\n** calls to this routine should not block, of course.  Otherwise the\r\n** initialization process would never complete.\r\n**\r\n** Let X be the first thread to enter this routine.  Let Y be some other\r\n** thread.  Then while the initial invocation of this routine by X is\r\n** incomplete, it is required that:\r\n**\r\n**    *  Calls to this routine from Y must block until the outer-most\r\n**       call by X completes.\r\n**\r\n**    *  Recursive calls to this routine from thread X return immediately\r\n**       without blocking.\r\n*/\r\nSQLITE_API int sqlite3_initialize(void){\r\n  MUTEX_LOGIC( sqlite3_mutex *pMaster; )       /* The main static mutex */\r\n  int rc;                                      /* Result code */\r\n\r\n#ifdef SQLITE_OMIT_WSD\r\n  rc = sqlite3_wsd_init(4096, 24);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n#endif\r\n\r\n  /* If SQLite is already completely initialized, then this call\r\n  ** to sqlite3_initialize() should be a no-op.  But the initialization\r\n  ** must be complete.  So isInit must not be set until the very end\r\n  ** of this routine.\r\n  */\r\n  if( sqlite3GlobalConfig.isInit ) return SQLITE_OK;\r\n\r\n  /* Make sure the mutex subsystem is initialized.  If unable to \r\n  ** initialize the mutex subsystem, return early with the error.\r\n  ** If the system is so sick that we are unable to allocate a mutex,\r\n  ** there is not much SQLite is going to be able to do.\r\n  **\r\n  ** The mutex subsystem must take care of serializing its own\r\n  ** initialization.\r\n  */\r\n  rc = sqlite3MutexInit();\r\n  if( rc ) return rc;\r\n\r\n  /* Initialize the malloc() system and the recursive pInitMutex mutex.\r\n  ** This operation is protected by the STATIC_MASTER mutex.  Note that\r\n  ** MutexAlloc() is called for a static mutex prior to initializing the\r\n  ** malloc subsystem - this implies that the allocation of a static\r\n  ** mutex must not require support from the malloc subsystem.\r\n  */\r\n  MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )\r\n  sqlite3_mutex_enter(pMaster);\r\n  sqlite3GlobalConfig.isMutexInit = 1;\r\n  if( !sqlite3GlobalConfig.isMallocInit ){\r\n    rc = sqlite3MallocInit();\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3GlobalConfig.isMallocInit = 1;\r\n    if( !sqlite3GlobalConfig.pInitMutex ){\r\n      sqlite3GlobalConfig.pInitMutex =\r\n           sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);\r\n      if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){\r\n        rc = SQLITE_NOMEM;\r\n      }\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3GlobalConfig.nRefInitMutex++;\r\n  }\r\n  sqlite3_mutex_leave(pMaster);\r\n\r\n  /* If rc is not SQLITE_OK at this point, then either the malloc\r\n  ** subsystem could not be initialized or the system failed to allocate\r\n  ** the pInitMutex mutex. Return an error in either case.  */\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  /* Do the rest of the initialization under the recursive mutex so\r\n  ** that we will be able to handle recursive calls into\r\n  ** sqlite3_initialize().  The recursive calls normally come through\r\n  ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other\r\n  ** recursive calls might also be possible.\r\n  **\r\n  ** IMPLEMENTATION-OF: R-00140-37445 SQLite automatically serializes calls\r\n  ** to the xInit method, so the xInit method need not be threadsafe.\r\n  **\r\n  ** The following mutex is what serializes access to the appdef pcache xInit\r\n  ** methods.  The sqlite3_pcache_methods.xInit() all is embedded in the\r\n  ** call to sqlite3PcacheInitialize().\r\n  */\r\n  sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex);\r\n  if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){\r\n    FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);\r\n    sqlite3GlobalConfig.inProgress = 1;\r\n    memset(pHash, 0, sizeof(sqlite3GlobalFunctions));\r\n    sqlite3RegisterGlobalFunctions();\r\n    if( sqlite3GlobalConfig.isPCacheInit==0 ){\r\n      rc = sqlite3PcacheInitialize();\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3GlobalConfig.isPCacheInit = 1;\r\n      rc = sqlite3OsInit();\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, \r\n          sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage);\r\n      sqlite3GlobalConfig.isInit = 1;\r\n    }\r\n    sqlite3GlobalConfig.inProgress = 0;\r\n  }\r\n  sqlite3_mutex_leave(sqlite3GlobalConfig.pInitMutex);\r\n\r\n  /* Go back under the static mutex and clean up the recursive\r\n  ** mutex to prevent a resource leak.\r\n  */\r\n  sqlite3_mutex_enter(pMaster);\r\n  sqlite3GlobalConfig.nRefInitMutex--;\r\n  if( sqlite3GlobalConfig.nRefInitMutex<=0 ){\r\n    assert( sqlite3GlobalConfig.nRefInitMutex==0 );\r\n    sqlite3_mutex_free(sqlite3GlobalConfig.pInitMutex);\r\n    sqlite3GlobalConfig.pInitMutex = 0;\r\n  }\r\n  sqlite3_mutex_leave(pMaster);\r\n\r\n  /* The following is just a sanity check to make sure SQLite has\r\n  ** been compiled correctly.  It is important to run this code, but\r\n  ** we don't want to run it too often and soak up CPU cycles for no\r\n  ** reason.  So we run it once during initialization.\r\n  */\r\n#ifndef NDEBUG\r\n#ifndef SQLITE_OMIT_FLOATING_POINT\r\n  /* This section of code's only \"output\" is via assert() statements. */\r\n  if ( rc==SQLITE_OK ){\r\n    u64 x = (((u64)1)<<63)-1;\r\n    double y;\r\n    assert(sizeof(x)==8);\r\n    assert(sizeof(x)==sizeof(y));\r\n    memcpy(&y, &x, 8);\r\n    assert( sqlite3IsNaN(y) );\r\n  }\r\n#endif\r\n#endif\r\n\r\n  /* Do extra initialization steps requested by the SQLITE_EXTRA_INIT\r\n  ** compile-time option.\r\n  */\r\n#ifdef SQLITE_EXTRA_INIT\r\n  if( rc==SQLITE_OK && sqlite3GlobalConfig.isInit ){\r\n    int SQLITE_EXTRA_INIT(const char*);\r\n    rc = SQLITE_EXTRA_INIT(0);\r\n  }\r\n#endif\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Undo the effects of sqlite3_initialize().  Must not be called while\r\n** there are outstanding database connections or memory allocations or\r\n** while any part of SQLite is otherwise in use in any thread.  This\r\n** routine is not threadsafe.  But it is safe to invoke this routine\r\n** on when SQLite is already shut down.  If SQLite is already shut down\r\n** when this routine is invoked, then this routine is a harmless no-op.\r\n*/\r\nSQLITE_API int sqlite3_shutdown(void){\r\n  if( sqlite3GlobalConfig.isInit ){\r\n#ifdef SQLITE_EXTRA_SHUTDOWN\r\n    void SQLITE_EXTRA_SHUTDOWN(void);\r\n    SQLITE_EXTRA_SHUTDOWN();\r\n#endif\r\n    sqlite3_os_end();\r\n    sqlite3_reset_auto_extension();\r\n    sqlite3GlobalConfig.isInit = 0;\r\n  }\r\n  if( sqlite3GlobalConfig.isPCacheInit ){\r\n    sqlite3PcacheShutdown();\r\n    sqlite3GlobalConfig.isPCacheInit = 0;\r\n  }\r\n  if( sqlite3GlobalConfig.isMallocInit ){\r\n    sqlite3MallocEnd();\r\n    sqlite3GlobalConfig.isMallocInit = 0;\r\n  }\r\n  if( sqlite3GlobalConfig.isMutexInit ){\r\n    sqlite3MutexEnd();\r\n    sqlite3GlobalConfig.isMutexInit = 0;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This API allows applications to modify the global configuration of\r\n** the SQLite library at run-time.\r\n**\r\n** This routine should only be called when there are no outstanding\r\n** database connections or memory allocations.  This routine is not\r\n** threadsafe.  Failure to heed these warnings can lead to unpredictable\r\n** behavior.\r\n*/\r\nSQLITE_API int sqlite3_config(int op, ...){\r\n  va_list ap;\r\n  int rc = SQLITE_OK;\r\n\r\n  /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while\r\n  ** the SQLite library is in use. */\r\n  if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;\r\n\r\n  va_start(ap, op);\r\n  switch( op ){\r\n\r\n    /* Mutex configuration options are only available in a threadsafe\r\n    ** compile. \r\n    */\r\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0\r\n    case SQLITE_CONFIG_SINGLETHREAD: {\r\n      /* Disable all mutexing */\r\n      sqlite3GlobalConfig.bCoreMutex = 0;\r\n      sqlite3GlobalConfig.bFullMutex = 0;\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_MULTITHREAD: {\r\n      /* Disable mutexing of database connections */\r\n      /* Enable mutexing of core data structures */\r\n      sqlite3GlobalConfig.bCoreMutex = 1;\r\n      sqlite3GlobalConfig.bFullMutex = 0;\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_SERIALIZED: {\r\n      /* Enable all mutexing */\r\n      sqlite3GlobalConfig.bCoreMutex = 1;\r\n      sqlite3GlobalConfig.bFullMutex = 1;\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_MUTEX: {\r\n      /* Specify an alternative mutex implementation */\r\n      sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_GETMUTEX: {\r\n      /* Retrieve the current mutex implementation */\r\n      *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;\r\n      break;\r\n    }\r\n#endif\r\n\r\n\r\n    case SQLITE_CONFIG_MALLOC: {\r\n      /* Specify an alternative malloc implementation */\r\n      sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_GETMALLOC: {\r\n      /* Retrieve the current malloc() implementation */\r\n      if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();\r\n      *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_MEMSTATUS: {\r\n      /* Enable or disable the malloc status collection */\r\n      sqlite3GlobalConfig.bMemstat = va_arg(ap, int);\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_SCRATCH: {\r\n      /* Designate a buffer for scratch memory space */\r\n      sqlite3GlobalConfig.pScratch = va_arg(ap, void*);\r\n      sqlite3GlobalConfig.szScratch = va_arg(ap, int);\r\n      sqlite3GlobalConfig.nScratch = va_arg(ap, int);\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_PAGECACHE: {\r\n      /* Designate a buffer for page cache memory space */\r\n      sqlite3GlobalConfig.pPage = va_arg(ap, void*);\r\n      sqlite3GlobalConfig.szPage = va_arg(ap, int);\r\n      sqlite3GlobalConfig.nPage = va_arg(ap, int);\r\n      break;\r\n    }\r\n\r\n    case SQLITE_CONFIG_PCACHE: {\r\n      /* no-op */\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_GETPCACHE: {\r\n      /* now an error */\r\n      rc = SQLITE_ERROR;\r\n      break;\r\n    }\r\n\r\n    case SQLITE_CONFIG_PCACHE2: {\r\n      /* Specify an alternative page cache implementation */\r\n      sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);\r\n      break;\r\n    }\r\n    case SQLITE_CONFIG_GETPCACHE2: {\r\n      if( sqlite3GlobalConfig.pcache2.xInit==0 ){\r\n        sqlite3PCacheSetDefault();\r\n      }\r\n      *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;\r\n      break;\r\n    }\r\n\r\n#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)\r\n    case SQLITE_CONFIG_HEAP: {\r\n      /* Designate a buffer for heap memory space */\r\n      sqlite3GlobalConfig.pHeap = va_arg(ap, void*);\r\n      sqlite3GlobalConfig.nHeap = va_arg(ap, int);\r\n      sqlite3GlobalConfig.mnReq = va_arg(ap, int);\r\n\r\n      if( sqlite3GlobalConfig.mnReq<1 ){\r\n        sqlite3GlobalConfig.mnReq = 1;\r\n      }else if( sqlite3GlobalConfig.mnReq>(1<<12) ){\r\n        /* cap min request size at 2^12 */\r\n        sqlite3GlobalConfig.mnReq = (1<<12);\r\n      }\r\n\r\n      if( sqlite3GlobalConfig.pHeap==0 ){\r\n        /* If the heap pointer is NULL, then restore the malloc implementation\r\n        ** back to NULL pointers too.  This will cause the malloc to go\r\n        ** back to its default implementation when sqlite3_initialize() is\r\n        ** run.\r\n        */\r\n        memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));\r\n      }else{\r\n        /* The heap pointer is not NULL, then install one of the\r\n        ** mem5.c/mem3.c methods. If neither ENABLE_MEMSYS3 nor\r\n        ** ENABLE_MEMSYS5 is defined, return an error.\r\n        */\r\n#ifdef SQLITE_ENABLE_MEMSYS3\r\n        sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();\r\n#endif\r\n#ifdef SQLITE_ENABLE_MEMSYS5\r\n        sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();\r\n#endif\r\n      }\r\n      break;\r\n    }\r\n#endif\r\n\r\n    case SQLITE_CONFIG_LOOKASIDE: {\r\n      sqlite3GlobalConfig.szLookaside = va_arg(ap, int);\r\n      sqlite3GlobalConfig.nLookaside = va_arg(ap, int);\r\n      break;\r\n    }\r\n    \r\n    /* Record a pointer to the logger funcction and its first argument.\r\n    ** The default is NULL.  Logging is disabled if the function pointer is\r\n    ** NULL.\r\n    */\r\n    case SQLITE_CONFIG_LOG: {\r\n      /* MSVC is picky about pulling func ptrs from va lists.\r\n      ** http://support.microsoft.com/kb/47961\r\n      ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));\r\n      */\r\n      typedef void(*LOGFUNC_t)(void*,int,const char*);\r\n      sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);\r\n      sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);\r\n      break;\r\n    }\r\n\r\n    case SQLITE_CONFIG_URI: {\r\n      sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);\r\n      break;\r\n    }\r\n\r\n    default: {\r\n      rc = SQLITE_ERROR;\r\n      break;\r\n    }\r\n  }\r\n  va_end(ap);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set up the lookaside buffers for a database connection.\r\n** Return SQLITE_OK on success.  \r\n** If lookaside is already active, return SQLITE_BUSY.\r\n**\r\n** The sz parameter is the number of bytes in each lookaside slot.\r\n** The cnt parameter is the number of slots.  If pStart is NULL the\r\n** space for the lookaside memory is obtained from sqlite3_malloc().\r\n** If pStart is not NULL then it is sz*cnt bytes of memory to use for\r\n** the lookaside memory.\r\n*/\r\nstatic int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){\r\n  void *pStart;\r\n  if( db->lookaside.nOut ){\r\n    return SQLITE_BUSY;\r\n  }\r\n  /* Free any existing lookaside buffer for this handle before\r\n  ** allocating a new one so we don't have to have space for \r\n  ** both at the same time.\r\n  */\r\n  if( db->lookaside.bMalloced ){\r\n    sqlite3_free(db->lookaside.pStart);\r\n  }\r\n  /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger\r\n  ** than a pointer to be useful.\r\n  */\r\n  sz = ROUNDDOWN8(sz);  /* IMP: R-33038-09382 */\r\n  if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0;\r\n  if( cnt<0 ) cnt = 0;\r\n  if( sz==0 || cnt==0 ){\r\n    sz = 0;\r\n    pStart = 0;\r\n  }else if( pBuf==0 ){\r\n    sqlite3BeginBenignMalloc();\r\n    pStart = sqlite3Malloc( sz*cnt );  /* IMP: R-61949-35727 */\r\n    sqlite3EndBenignMalloc();\r\n    if( pStart ) cnt = sqlite3MallocSize(pStart)/sz;\r\n  }else{\r\n    pStart = pBuf;\r\n  }\r\n  db->lookaside.pStart = pStart;\r\n  db->lookaside.pFree = 0;\r\n  db->lookaside.sz = (u16)sz;\r\n  if( pStart ){\r\n    int i;\r\n    LookasideSlot *p;\r\n    assert( sz > (int)sizeof(LookasideSlot*) );\r\n    p = (LookasideSlot*)pStart;\r\n    for(i=cnt-1; i>=0; i--){\r\n      p->pNext = db->lookaside.pFree;\r\n      db->lookaside.pFree = p;\r\n      p = (LookasideSlot*)&((u8*)p)[sz];\r\n    }\r\n    db->lookaside.pEnd = p;\r\n    db->lookaside.bEnabled = 1;\r\n    db->lookaside.bMalloced = pBuf==0 ?1:0;\r\n  }else{\r\n    db->lookaside.pEnd = 0;\r\n    db->lookaside.bEnabled = 0;\r\n    db->lookaside.bMalloced = 0;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Return the mutex associated with a database connection.\r\n*/\r\nSQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){\r\n  return db->mutex;\r\n}\r\n\r\n/*\r\n** Free up as much memory as we can from the given database\r\n** connection.\r\n*/\r\nSQLITE_API int sqlite3_db_release_memory(sqlite3 *db){\r\n  int i;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  sqlite3BtreeEnterAll(db);\r\n  for(i=0; i<db->nDb; i++){\r\n    Btree *pBt = db->aDb[i].pBt;\r\n    if( pBt ){\r\n      Pager *pPager = sqlite3BtreePager(pBt);\r\n      sqlite3PagerShrink(pPager);\r\n    }\r\n  }\r\n  sqlite3BtreeLeaveAll(db);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Configuration settings for an individual database connection\r\n*/\r\nSQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){\r\n  va_list ap;\r\n  int rc;\r\n  va_start(ap, op);\r\n  switch( op ){\r\n    case SQLITE_DBCONFIG_LOOKASIDE: {\r\n      void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */\r\n      int sz = va_arg(ap, int);       /* IMP: R-47871-25994 */\r\n      int cnt = va_arg(ap, int);      /* IMP: R-04460-53386 */\r\n      rc = setupLookaside(db, pBuf, sz, cnt);\r\n      break;\r\n    }\r\n    default: {\r\n      static const struct {\r\n        int op;      /* The opcode */\r\n        u32 mask;    /* Mask of the bit in sqlite3.flags to set/clear */\r\n      } aFlagOp[] = {\r\n        { SQLITE_DBCONFIG_ENABLE_FKEY,    SQLITE_ForeignKeys    },\r\n        { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger  },\r\n      };\r\n      unsigned int i;\r\n      rc = SQLITE_ERROR; /* IMP: R-42790-23372 */\r\n      for(i=0; i<ArraySize(aFlagOp); i++){\r\n        if( aFlagOp[i].op==op ){\r\n          int onoff = va_arg(ap, int);\r\n          int *pRes = va_arg(ap, int*);\r\n          int oldFlags = db->flags;\r\n          if( onoff>0 ){\r\n            db->flags |= aFlagOp[i].mask;\r\n          }else if( onoff==0 ){\r\n            db->flags &= ~aFlagOp[i].mask;\r\n          }\r\n          if( oldFlags!=db->flags ){\r\n            sqlite3ExpirePreparedStatements(db);\r\n          }\r\n          if( pRes ){\r\n            *pRes = (db->flags & aFlagOp[i].mask)!=0;\r\n          }\r\n          rc = SQLITE_OK;\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  va_end(ap);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Return true if the buffer z[0..n-1] contains all spaces.\r\n*/\r\nstatic int allSpaces(const char *z, int n){\r\n  while( n>0 && z[n-1]==' ' ){ n--; }\r\n  return n==0;\r\n}\r\n\r\n/*\r\n** This is the default collating function named \"BINARY\" which is always\r\n** available.\r\n**\r\n** If the padFlag argument is not NULL then space padding at the end\r\n** of strings is ignored.  This implements the RTRIM collation.\r\n*/\r\nstatic int binCollFunc(\r\n  void *padFlag,\r\n  int nKey1, const void *pKey1,\r\n  int nKey2, const void *pKey2\r\n){\r\n  int rc, n;\r\n  n = nKey1<nKey2 ? nKey1 : nKey2;\r\n  rc = memcmp(pKey1, pKey2, n);\r\n  if( rc==0 ){\r\n    if( padFlag\r\n     && allSpaces(((char*)pKey1)+n, nKey1-n)\r\n     && allSpaces(((char*)pKey2)+n, nKey2-n)\r\n    ){\r\n      /* Leave rc unchanged at 0 */\r\n    }else{\r\n      rc = nKey1 - nKey2;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Another built-in collating sequence: NOCASE. \r\n**\r\n** This collating sequence is intended to be used for \"case independant\r\n** comparison\". SQLite's knowledge of upper and lower case equivalents\r\n** extends only to the 26 characters used in the English language.\r\n**\r\n** At the moment there is only a UTF-8 implementation.\r\n*/\r\nstatic int nocaseCollatingFunc(\r\n  void *NotUsed,\r\n  int nKey1, const void *pKey1,\r\n  int nKey2, const void *pKey2\r\n){\r\n  int r = sqlite3StrNICmp(\r\n      (const char *)pKey1, (const char *)pKey2, (nKey1<nKey2)?nKey1:nKey2);\r\n  UNUSED_PARAMETER(NotUsed);\r\n  if( 0==r ){\r\n    r = nKey1-nKey2;\r\n  }\r\n  return r;\r\n}\r\n\r\n/*\r\n** Return the ROWID of the most recent insert\r\n*/\r\nSQLITE_API sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){\r\n  return db->lastRowid;\r\n}\r\n\r\n/*\r\n** Return the number of changes in the most recent call to sqlite3_exec().\r\n*/\r\nSQLITE_API int sqlite3_changes(sqlite3 *db){\r\n  return db->nChange;\r\n}\r\n\r\n/*\r\n** Return the number of changes since the database handle was opened.\r\n*/\r\nSQLITE_API int sqlite3_total_changes(sqlite3 *db){\r\n  return db->nTotalChange;\r\n}\r\n\r\n/*\r\n** Close all open savepoints. This function only manipulates fields of the\r\n** database handle object, it does not close any savepoints that may be open\r\n** at the b-tree/pager level.\r\n*/\r\nSQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *db){\r\n  while( db->pSavepoint ){\r\n    Savepoint *pTmp = db->pSavepoint;\r\n    db->pSavepoint = pTmp->pNext;\r\n    sqlite3DbFree(db, pTmp);\r\n  }\r\n  db->nSavepoint = 0;\r\n  db->nStatement = 0;\r\n  db->isTransactionSavepoint = 0;\r\n}\r\n\r\n/*\r\n** Invoke the destructor function associated with FuncDef p, if any. Except,\r\n** if this is not the last copy of the function, do not invoke it. Multiple\r\n** copies of a single function are created when create_function() is called\r\n** with SQLITE_ANY as the encoding.\r\n*/\r\nstatic void functionDestroy(sqlite3 *db, FuncDef *p){\r\n  FuncDestructor *pDestructor = p->pDestructor;\r\n  if( pDestructor ){\r\n    pDestructor->nRef--;\r\n    if( pDestructor->nRef==0 ){\r\n      pDestructor->xDestroy(pDestructor->pUserData);\r\n      sqlite3DbFree(db, pDestructor);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Close an existing SQLite database\r\n*/\r\nSQLITE_API int sqlite3_close(sqlite3 *db){\r\n  HashElem *i;                    /* Hash table iterator */\r\n  int j;\r\n\r\n  if( !db ){\r\n    return SQLITE_OK;\r\n  }\r\n  if( !sqlite3SafetyCheckSickOrOk(db) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  sqlite3_mutex_enter(db->mutex);\r\n\r\n  /* Force xDestroy calls on all virtual tables */\r\n  sqlite3ResetInternalSchema(db, -1);\r\n\r\n  /* If a transaction is open, the ResetInternalSchema() call above\r\n  ** will not have called the xDisconnect() method on any virtual\r\n  ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback()\r\n  ** call will do so. We need to do this before the check for active\r\n  ** SQL statements below, as the v-table implementation may be storing\r\n  ** some prepared statements internally.\r\n  */\r\n  sqlite3VtabRollback(db);\r\n\r\n  /* If there are any outstanding VMs, return SQLITE_BUSY. */\r\n  if( db->pVdbe ){\r\n    sqlite3Error(db, SQLITE_BUSY, \r\n        \"unable to close due to unfinalised statements\");\r\n    sqlite3_mutex_leave(db->mutex);\r\n    return SQLITE_BUSY;\r\n  }\r\n  assert( sqlite3SafetyCheckSickOrOk(db) );\r\n\r\n  for(j=0; j<db->nDb; j++){\r\n    Btree *pBt = db->aDb[j].pBt;\r\n    if( pBt && sqlite3BtreeIsInBackup(pBt) ){\r\n      sqlite3Error(db, SQLITE_BUSY, \r\n          \"unable to close due to unfinished backup operation\");\r\n      sqlite3_mutex_leave(db->mutex);\r\n      return SQLITE_BUSY;\r\n    }\r\n  }\r\n\r\n  /* Free any outstanding Savepoint structures. */\r\n  sqlite3CloseSavepoints(db);\r\n\r\n  for(j=0; j<db->nDb; j++){\r\n    struct Db *pDb = &db->aDb[j];\r\n    if( pDb->pBt ){\r\n      sqlite3BtreeClose(pDb->pBt);\r\n      pDb->pBt = 0;\r\n      if( j!=1 ){\r\n        pDb->pSchema = 0;\r\n      }\r\n    }\r\n  }\r\n  sqlite3ResetInternalSchema(db, -1);\r\n\r\n  /* Tell the code in notify.c that the connection no longer holds any\r\n  ** locks and does not require any further unlock-notify callbacks.\r\n  */\r\n  sqlite3ConnectionClosed(db);\r\n\r\n  assert( db->nDb<=2 );\r\n  assert( db->aDb==db->aDbStatic );\r\n  for(j=0; j<ArraySize(db->aFunc.a); j++){\r\n    FuncDef *pNext, *pHash, *p;\r\n    for(p=db->aFunc.a[j]; p; p=pHash){\r\n      pHash = p->pHash;\r\n      while( p ){\r\n        functionDestroy(db, p);\r\n        pNext = p->pNext;\r\n        sqlite3DbFree(db, p);\r\n        p = pNext;\r\n      }\r\n    }\r\n  }\r\n  for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){\r\n    CollSeq *pColl = (CollSeq *)sqliteHashData(i);\r\n    /* Invoke any destructors registered for collation sequence user data. */\r\n    for(j=0; j<3; j++){\r\n      if( pColl[j].xDel ){\r\n        pColl[j].xDel(pColl[j].pUser);\r\n      }\r\n    }\r\n    sqlite3DbFree(db, pColl);\r\n  }\r\n  sqlite3HashClear(&db->aCollSeq);\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  for(i=sqliteHashFirst(&db->aModule); i; i=sqliteHashNext(i)){\r\n    Module *pMod = (Module *)sqliteHashData(i);\r\n    if( pMod->xDestroy ){\r\n      pMod->xDestroy(pMod->pAux);\r\n    }\r\n    sqlite3DbFree(db, pMod);\r\n  }\r\n  sqlite3HashClear(&db->aModule);\r\n#endif\r\n\r\n  sqlite3Error(db, SQLITE_OK, 0); /* Deallocates any cached error strings. */\r\n  if( db->pErr ){\r\n    sqlite3ValueFree(db->pErr);\r\n  }\r\n  sqlite3CloseExtensions(db);\r\n\r\n  db->magic = SQLITE_MAGIC_ERROR;\r\n\r\n  /* The temp-database schema is allocated differently from the other schema\r\n  ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()).\r\n  ** So it needs to be freed here. Todo: Why not roll the temp schema into\r\n  ** the same sqliteMalloc() as the one that allocates the database \r\n  ** structure?\r\n  */\r\n  sqlite3DbFree(db, db->aDb[1].pSchema);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  db->magic = SQLITE_MAGIC_CLOSED;\r\n  sqlite3_mutex_free(db->mutex);\r\n  assert( db->lookaside.nOut==0 );  /* Fails on a lookaside memory leak */\r\n  if( db->lookaside.bMalloced ){\r\n    sqlite3_free(db->lookaside.pStart);\r\n  }\r\n  sqlite3_free(db);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Rollback all database files.  If tripCode is not SQLITE_OK, then\r\n** any open cursors are invalidated (\"tripped\" - as in \"tripping a circuit\r\n** breaker\") and made to return tripCode if there are any further\r\n** attempts to use that cursor.\r\n*/\r\nSQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){\r\n  int i;\r\n  int inTrans = 0;\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  sqlite3BeginBenignMalloc();\r\n  for(i=0; i<db->nDb; i++){\r\n    Btree *p = db->aDb[i].pBt;\r\n    if( p ){\r\n      if( sqlite3BtreeIsInTrans(p) ){\r\n        inTrans = 1;\r\n      }\r\n      sqlite3BtreeRollback(p, tripCode);\r\n      db->aDb[i].inTrans = 0;\r\n    }\r\n  }\r\n  sqlite3VtabRollback(db);\r\n  sqlite3EndBenignMalloc();\r\n\r\n  if( db->flags&SQLITE_InternChanges ){\r\n    sqlite3ExpirePreparedStatements(db);\r\n    sqlite3ResetInternalSchema(db, -1);\r\n  }\r\n\r\n  /* Any deferred constraint violations have now been resolved. */\r\n  db->nDeferredCons = 0;\r\n\r\n  /* If one has been configured, invoke the rollback-hook callback */\r\n  if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){\r\n    db->xRollbackCallback(db->pRollbackArg);\r\n  }\r\n}\r\n\r\n/*\r\n** Return a static string that describes the kind of error specified in the\r\n** argument.\r\n*/\r\nSQLITE_PRIVATE const char *sqlite3ErrStr(int rc){\r\n  static const char* const aMsg[] = {\r\n    /* SQLITE_OK          */ \"not an error\",\r\n    /* SQLITE_ERROR       */ \"SQL logic error or missing database\",\r\n    /* SQLITE_INTERNAL    */ 0,\r\n    /* SQLITE_PERM        */ \"access permission denied\",\r\n    /* SQLITE_ABORT       */ \"callback requested query abort\",\r\n    /* SQLITE_BUSY        */ \"database is locked\",\r\n    /* SQLITE_LOCKED      */ \"database table is locked\",\r\n    /* SQLITE_NOMEM       */ \"out of memory\",\r\n    /* SQLITE_READONLY    */ \"attempt to write a readonly database\",\r\n    /* SQLITE_INTERRUPT   */ \"interrupted\",\r\n    /* SQLITE_IOERR       */ \"disk I/O error\",\r\n    /* SQLITE_CORRUPT     */ \"database disk image is malformed\",\r\n    /* SQLITE_NOTFOUND    */ \"unknown operation\",\r\n    /* SQLITE_FULL        */ \"database or disk is full\",\r\n    /* SQLITE_CANTOPEN    */ \"unable to open database file\",\r\n    /* SQLITE_PROTOCOL    */ \"locking protocol\",\r\n    /* SQLITE_EMPTY       */ \"table contains no data\",\r\n    /* SQLITE_SCHEMA      */ \"database schema has changed\",\r\n    /* SQLITE_TOOBIG      */ \"string or blob too big\",\r\n    /* SQLITE_CONSTRAINT  */ \"constraint failed\",\r\n    /* SQLITE_MISMATCH    */ \"datatype mismatch\",\r\n    /* SQLITE_MISUSE      */ \"library routine called out of sequence\",\r\n    /* SQLITE_NOLFS       */ \"large file support is disabled\",\r\n    /* SQLITE_AUTH        */ \"authorization denied\",\r\n    /* SQLITE_FORMAT      */ \"auxiliary database format error\",\r\n    /* SQLITE_RANGE       */ \"bind or column index out of range\",\r\n    /* SQLITE_NOTADB      */ \"file is encrypted or is not a database\",\r\n  };\r\n  const char *zErr = \"unknown error\";\r\n  switch( rc ){\r\n    case SQLITE_ABORT_ROLLBACK: {\r\n      zErr = \"abort due to ROLLBACK\";\r\n      break;\r\n    }\r\n    default: {\r\n      rc &= 0xff;\r\n      if( ALWAYS(rc>=0) && rc<ArraySize(aMsg) && aMsg[rc]!=0 ){\r\n        zErr = aMsg[rc];\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  return zErr;\r\n}\r\n\r\n/*\r\n** This routine implements a busy callback that sleeps and tries\r\n** again until a timeout value is reached.  The timeout value is\r\n** an integer number of milliseconds passed in as the first\r\n** argument.\r\n*/\r\nstatic int sqliteDefaultBusyCallback(\r\n void *ptr,               /* Database connection */\r\n int count                /* Number of times table has been busy */\r\n){\r\n#if SQLITE_OS_WIN || (defined(HAVE_USLEEP) && HAVE_USLEEP)\r\n  static const u8 delays[] =\r\n     { 1, 2, 5, 10, 15, 20, 25, 25,  25,  50,  50, 100 };\r\n  static const u8 totals[] =\r\n     { 0, 1, 3,  8, 18, 33, 53, 78, 103, 128, 178, 228 };\r\n# define NDELAY ArraySize(delays)\r\n  sqlite3 *db = (sqlite3 *)ptr;\r\n  int timeout = db->busyTimeout;\r\n  int delay, prior;\r\n\r\n  assert( count>=0 );\r\n  if( count < NDELAY ){\r\n    delay = delays[count];\r\n    prior = totals[count];\r\n  }else{\r\n    delay = delays[NDELAY-1];\r\n    prior = totals[NDELAY-1] + delay*(count-(NDELAY-1));\r\n  }\r\n  if( prior + delay > timeout ){\r\n    delay = timeout - prior;\r\n    if( delay<=0 ) return 0;\r\n  }\r\n  sqlite3OsSleep(db->pVfs, delay*1000);\r\n  return 1;\r\n#else\r\n  sqlite3 *db = (sqlite3 *)ptr;\r\n  int timeout = ((sqlite3 *)ptr)->busyTimeout;\r\n  if( (count+1)*1000 > timeout ){\r\n    return 0;\r\n  }\r\n  sqlite3OsSleep(db->pVfs, 1000000);\r\n  return 1;\r\n#endif\r\n}\r\n\r\n/*\r\n** Invoke the given busy handler.\r\n**\r\n** This routine is called when an operation failed with a lock.\r\n** If this routine returns non-zero, the lock is retried.  If it\r\n** returns 0, the operation aborts with an SQLITE_BUSY error.\r\n*/\r\nSQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler *p){\r\n  int rc;\r\n  if( NEVER(p==0) || p->xFunc==0 || p->nBusy<0 ) return 0;\r\n  rc = p->xFunc(p->pArg, p->nBusy);\r\n  if( rc==0 ){\r\n    p->nBusy = -1;\r\n  }else{\r\n    p->nBusy++;\r\n  }\r\n  return rc; \r\n}\r\n\r\n/*\r\n** This routine sets the busy callback for an Sqlite database to the\r\n** given callback function with the given argument.\r\n*/\r\nSQLITE_API int sqlite3_busy_handler(\r\n  sqlite3 *db,\r\n  int (*xBusy)(void*,int),\r\n  void *pArg\r\n){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  db->busyHandler.xFunc = xBusy;\r\n  db->busyHandler.pArg = pArg;\r\n  db->busyHandler.nBusy = 0;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\r\n/*\r\n** This routine sets the progress callback for an Sqlite database to the\r\n** given callback function with the given argument. The progress callback will\r\n** be invoked every nOps opcodes.\r\n*/\r\nSQLITE_API void sqlite3_progress_handler(\r\n  sqlite3 *db, \r\n  int nOps,\r\n  int (*xProgress)(void*), \r\n  void *pArg\r\n){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( nOps>0 ){\r\n    db->xProgress = xProgress;\r\n    db->nProgressOps = nOps;\r\n    db->pProgressArg = pArg;\r\n  }else{\r\n    db->xProgress = 0;\r\n    db->nProgressOps = 0;\r\n    db->pProgressArg = 0;\r\n  }\r\n  sqlite3_mutex_leave(db->mutex);\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** This routine installs a default busy handler that waits for the\r\n** specified number of milliseconds before returning 0.\r\n*/\r\nSQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){\r\n  if( ms>0 ){\r\n    db->busyTimeout = ms;\r\n    sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);\r\n  }else{\r\n    sqlite3_busy_handler(db, 0, 0);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Cause any pending operation to stop at its earliest opportunity.\r\n*/\r\nSQLITE_API void sqlite3_interrupt(sqlite3 *db){\r\n  db->u1.isInterrupted = 1;\r\n}\r\n\r\n\r\n/*\r\n** This function is exactly the same as sqlite3_create_function(), except\r\n** that it is designed to be called by internal code. The difference is\r\n** that if a malloc() fails in sqlite3_create_function(), an error code\r\n** is returned and the mallocFailed flag cleared. \r\n*/\r\nSQLITE_PRIVATE int sqlite3CreateFunc(\r\n  sqlite3 *db,\r\n  const char *zFunctionName,\r\n  int nArg,\r\n  int enc,\r\n  void *pUserData,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*xFinal)(sqlite3_context*),\r\n  FuncDestructor *pDestructor\r\n){\r\n  FuncDef *p;\r\n  int nName;\r\n\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  if( zFunctionName==0 ||\r\n      (xFunc && (xFinal || xStep)) || \r\n      (!xFunc && (xFinal && !xStep)) ||\r\n      (!xFunc && (!xFinal && xStep)) ||\r\n      (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) ||\r\n      (255<(nName = sqlite3Strlen30( zFunctionName))) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  \r\n#ifndef SQLITE_OMIT_UTF16\r\n  /* If SQLITE_UTF16 is specified as the encoding type, transform this\r\n  ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the\r\n  ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.\r\n  **\r\n  ** If SQLITE_ANY is specified, add three versions of the function\r\n  ** to the hash table.\r\n  */\r\n  if( enc==SQLITE_UTF16 ){\r\n    enc = SQLITE_UTF16NATIVE;\r\n  }else if( enc==SQLITE_ANY ){\r\n    int rc;\r\n    rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8,\r\n         pUserData, xFunc, xStep, xFinal, pDestructor);\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE,\r\n          pUserData, xFunc, xStep, xFinal, pDestructor);\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    enc = SQLITE_UTF16BE;\r\n  }\r\n#else\r\n  enc = SQLITE_UTF8;\r\n#endif\r\n  \r\n  /* Check if an existing function is being overridden or deleted. If so,\r\n  ** and there are active VMs, then return SQLITE_BUSY. If a function\r\n  ** is being overridden/deleted but there are no active VMs, allow the\r\n  ** operation to continue but invalidate all precompiled statements.\r\n  */\r\n  p = sqlite3FindFunction(db, zFunctionName, nName, nArg, (u8)enc, 0);\r\n  if( p && p->iPrefEnc==enc && p->nArg==nArg ){\r\n    if( db->activeVdbeCnt ){\r\n      sqlite3Error(db, SQLITE_BUSY, \r\n        \"unable to delete/modify user-function due to active statements\");\r\n      assert( !db->mallocFailed );\r\n      return SQLITE_BUSY;\r\n    }else{\r\n      sqlite3ExpirePreparedStatements(db);\r\n    }\r\n  }\r\n\r\n  p = sqlite3FindFunction(db, zFunctionName, nName, nArg, (u8)enc, 1);\r\n  assert(p || db->mallocFailed);\r\n  if( !p ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  /* If an older version of the function with a configured destructor is\r\n  ** being replaced invoke the destructor function here. */\r\n  functionDestroy(db, p);\r\n\r\n  if( pDestructor ){\r\n    pDestructor->nRef++;\r\n  }\r\n  p->pDestructor = pDestructor;\r\n  p->flags = 0;\r\n  p->xFunc = xFunc;\r\n  p->xStep = xStep;\r\n  p->xFinalize = xFinal;\r\n  p->pUserData = pUserData;\r\n  p->nArg = (u16)nArg;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Create new user functions.\r\n*/\r\nSQLITE_API int sqlite3_create_function(\r\n  sqlite3 *db,\r\n  const char *zFunc,\r\n  int nArg,\r\n  int enc,\r\n  void *p,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*xFinal)(sqlite3_context*)\r\n){\r\n  return sqlite3_create_function_v2(db, zFunc, nArg, enc, p, xFunc, xStep,\r\n                                    xFinal, 0);\r\n}\r\n\r\nSQLITE_API int sqlite3_create_function_v2(\r\n  sqlite3 *db,\r\n  const char *zFunc,\r\n  int nArg,\r\n  int enc,\r\n  void *p,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value **),\r\n  void (*xFinal)(sqlite3_context*),\r\n  void (*xDestroy)(void *)\r\n){\r\n  int rc = SQLITE_ERROR;\r\n  FuncDestructor *pArg = 0;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( xDestroy ){\r\n    pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor));\r\n    if( !pArg ){\r\n      xDestroy(p);\r\n      goto out;\r\n    }\r\n    pArg->xDestroy = xDestroy;\r\n    pArg->pUserData = p;\r\n  }\r\n  rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p, xFunc, xStep, xFinal, pArg);\r\n  if( pArg && pArg->nRef==0 ){\r\n    assert( rc!=SQLITE_OK );\r\n    xDestroy(p);\r\n    sqlite3DbFree(db, pArg);\r\n  }\r\n\r\n out:\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\nSQLITE_API int sqlite3_create_function16(\r\n  sqlite3 *db,\r\n  const void *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *p,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*)\r\n){\r\n  int rc;\r\n  char *zFunc8;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  assert( !db->mallocFailed );\r\n  zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);\r\n  rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal,0);\r\n  sqlite3DbFree(db, zFunc8);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** Declare that a function has been overloaded by a virtual table.\r\n**\r\n** If the function already exists as a regular global function, then\r\n** this routine is a no-op.  If the function does not exist, then create\r\n** a new one that always throws a run-time error.  \r\n**\r\n** When virtual tables intend to provide an overloaded function, they\r\n** should call this routine to make sure the global function exists.\r\n** A global function must exist in order for name resolution to work\r\n** properly.\r\n*/\r\nSQLITE_API int sqlite3_overload_function(\r\n  sqlite3 *db,\r\n  const char *zName,\r\n  int nArg\r\n){\r\n  int nName = sqlite3Strlen30(zName);\r\n  int rc = SQLITE_OK;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){\r\n    rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,\r\n                           0, sqlite3InvalidFunction, 0, 0, 0);\r\n  }\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_TRACE\r\n/*\r\n** Register a trace function.  The pArg from the previously registered trace\r\n** is returned.  \r\n**\r\n** A NULL trace function means that no tracing is executes.  A non-NULL\r\n** trace is a pointer to a function that is invoked at the start of each\r\n** SQL statement.\r\n*/\r\nSQLITE_API void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){\r\n  void *pOld;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pOld = db->pTraceArg;\r\n  db->xTrace = xTrace;\r\n  db->pTraceArg = pArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return pOld;\r\n}\r\n/*\r\n** Register a profile function.  The pArg from the previously registered \r\n** profile function is returned.  \r\n**\r\n** A NULL profile function means that no profiling is executes.  A non-NULL\r\n** profile is a pointer to a function that is invoked at the conclusion of\r\n** each SQL statement that is run.\r\n*/\r\nSQLITE_API void *sqlite3_profile(\r\n  sqlite3 *db,\r\n  void (*xProfile)(void*,const char*,sqlite_uint64),\r\n  void *pArg\r\n){\r\n  void *pOld;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pOld = db->pProfileArg;\r\n  db->xProfile = xProfile;\r\n  db->pProfileArg = pArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return pOld;\r\n}\r\n#endif /* SQLITE_OMIT_TRACE */\r\n\r\n/*\r\n** Register a function to be invoked when a transaction commits.\r\n** If the invoked function returns non-zero, then the commit becomes a\r\n** rollback.\r\n*/\r\nSQLITE_API void *sqlite3_commit_hook(\r\n  sqlite3 *db,              /* Attach the hook to this database */\r\n  int (*xCallback)(void*),  /* Function to invoke on each commit */\r\n  void *pArg                /* Argument to the function */\r\n){\r\n  void *pOld;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pOld = db->pCommitArg;\r\n  db->xCommitCallback = xCallback;\r\n  db->pCommitArg = pArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return pOld;\r\n}\r\n\r\n/*\r\n** Register a callback to be invoked each time a row is updated,\r\n** inserted or deleted using this database connection.\r\n*/\r\nSQLITE_API void *sqlite3_update_hook(\r\n  sqlite3 *db,              /* Attach the hook to this database */\r\n  void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),\r\n  void *pArg                /* Argument to the function */\r\n){\r\n  void *pRet;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pRet = db->pUpdateArg;\r\n  db->xUpdateCallback = xCallback;\r\n  db->pUpdateArg = pArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return pRet;\r\n}\r\n\r\n/*\r\n** Register a callback to be invoked each time a transaction is rolled\r\n** back by this database connection.\r\n*/\r\nSQLITE_API void *sqlite3_rollback_hook(\r\n  sqlite3 *db,              /* Attach the hook to this database */\r\n  void (*xCallback)(void*), /* Callback function */\r\n  void *pArg                /* Argument to the function */\r\n){\r\n  void *pRet;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pRet = db->pRollbackArg;\r\n  db->xRollbackCallback = xCallback;\r\n  db->pRollbackArg = pArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return pRet;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/*\r\n** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint().\r\n** Invoke sqlite3_wal_checkpoint if the number of frames in the log file\r\n** is greater than sqlite3.pWalArg cast to an integer (the value configured by\r\n** wal_autocheckpoint()).\r\n*/ \r\nSQLITE_PRIVATE int sqlite3WalDefaultHook(\r\n  void *pClientData,     /* Argument */\r\n  sqlite3 *db,           /* Connection */\r\n  const char *zDb,       /* Database */\r\n  int nFrame             /* Size of WAL */\r\n){\r\n  if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){\r\n    sqlite3BeginBenignMalloc();\r\n    sqlite3_wal_checkpoint(db, zDb);\r\n    sqlite3EndBenignMalloc();\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n#endif /* SQLITE_OMIT_WAL */\r\n\r\n/*\r\n** Configure an sqlite3_wal_hook() callback to automatically checkpoint\r\n** a database after committing a transaction if there are nFrame or\r\n** more frames in the log file. Passing zero or a negative value as the\r\n** nFrame parameter disables automatic checkpoints entirely.\r\n**\r\n** The callback registered by this function replaces any existing callback\r\n** registered using sqlite3_wal_hook(). Likewise, registering a callback\r\n** using sqlite3_wal_hook() disables the automatic checkpoint mechanism\r\n** configured by this function.\r\n*/\r\nSQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){\r\n#ifdef SQLITE_OMIT_WAL\r\n  UNUSED_PARAMETER(db);\r\n  UNUSED_PARAMETER(nFrame);\r\n#else\r\n  if( nFrame>0 ){\r\n    sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));\r\n  }else{\r\n    sqlite3_wal_hook(db, 0, 0);\r\n  }\r\n#endif\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Register a callback to be invoked each time a transaction is written\r\n** into the write-ahead-log by this database connection.\r\n*/\r\nSQLITE_API void *sqlite3_wal_hook(\r\n  sqlite3 *db,                    /* Attach the hook to this db handle */\r\n  int(*xCallback)(void *, sqlite3*, const char*, int),\r\n  void *pArg                      /* First argument passed to xCallback() */\r\n){\r\n#ifndef SQLITE_OMIT_WAL\r\n  void *pRet;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pRet = db->pWalArg;\r\n  db->xWalCallback = xCallback;\r\n  db->pWalArg = pArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return pRet;\r\n#else\r\n  return 0;\r\n#endif\r\n}\r\n\r\n/*\r\n** Checkpoint database zDb.\r\n*/\r\nSQLITE_API int sqlite3_wal_checkpoint_v2(\r\n  sqlite3 *db,                    /* Database handle */\r\n  const char *zDb,                /* Name of attached database (or NULL) */\r\n  int eMode,                      /* SQLITE_CHECKPOINT_* value */\r\n  int *pnLog,                     /* OUT: Size of WAL log in frames */\r\n  int *pnCkpt                     /* OUT: Total number of frames checkpointed */\r\n){\r\n#ifdef SQLITE_OMIT_WAL\r\n  return SQLITE_OK;\r\n#else\r\n  int rc;                         /* Return code */\r\n  int iDb = SQLITE_MAX_ATTACHED;  /* sqlite3.aDb[] index of db to checkpoint */\r\n\r\n  /* Initialize the output variables to -1 in case an error occurs. */\r\n  if( pnLog ) *pnLog = -1;\r\n  if( pnCkpt ) *pnCkpt = -1;\r\n\r\n  assert( SQLITE_CHECKPOINT_FULL>SQLITE_CHECKPOINT_PASSIVE );\r\n  assert( SQLITE_CHECKPOINT_FULL<SQLITE_CHECKPOINT_RESTART );\r\n  assert( SQLITE_CHECKPOINT_PASSIVE+2==SQLITE_CHECKPOINT_RESTART );\r\n  if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_RESTART ){\r\n    return SQLITE_MISUSE;\r\n  }\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( zDb && zDb[0] ){\r\n    iDb = sqlite3FindDbName(db, zDb);\r\n  }\r\n  if( iDb<0 ){\r\n    rc = SQLITE_ERROR;\r\n    sqlite3Error(db, SQLITE_ERROR, \"unknown database: %s\", zDb);\r\n  }else{\r\n    rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);\r\n    sqlite3Error(db, rc, 0);\r\n  }\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n#endif\r\n}\r\n\r\n\r\n/*\r\n** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points\r\n** to contains a zero-length string, all attached databases are \r\n** checkpointed.\r\n*/\r\nSQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){\r\n  return sqlite3_wal_checkpoint_v2(db, zDb, SQLITE_CHECKPOINT_PASSIVE, 0, 0);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_WAL\r\n/*\r\n** Run a checkpoint on database iDb. This is a no-op if database iDb is\r\n** not currently open in WAL mode.\r\n**\r\n** If a transaction is open on the database being checkpointed, this \r\n** function returns SQLITE_LOCKED and a checkpoint is not attempted. If \r\n** an error occurs while running the checkpoint, an SQLite error code is \r\n** returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK.\r\n**\r\n** The mutex on database handle db should be held by the caller. The mutex\r\n** associated with the specific b-tree being checkpointed is taken by\r\n** this function while the checkpoint is running.\r\n**\r\n** If iDb is passed SQLITE_MAX_ATTACHED, then all attached databases are\r\n** checkpointed. If an error is encountered it is returned immediately -\r\n** no attempt is made to checkpoint any remaining databases.\r\n**\r\n** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  int i;                          /* Used to iterate through attached dbs */\r\n  int bBusy = 0;                  /* True if SQLITE_BUSY has been encountered */\r\n\r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n  assert( !pnLog || *pnLog==-1 );\r\n  assert( !pnCkpt || *pnCkpt==-1 );\r\n\r\n  for(i=0; i<db->nDb && rc==SQLITE_OK; i++){\r\n    if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){\r\n      rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt);\r\n      pnLog = 0;\r\n      pnCkpt = 0;\r\n      if( rc==SQLITE_BUSY ){\r\n        bBusy = 1;\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n  }\r\n\r\n  return (rc==SQLITE_OK && bBusy) ? SQLITE_BUSY : rc;\r\n}\r\n#endif /* SQLITE_OMIT_WAL */\r\n\r\n/*\r\n** This function returns true if main-memory should be used instead of\r\n** a temporary file for transient pager files and statement journals.\r\n** The value returned depends on the value of db->temp_store (runtime\r\n** parameter) and the compile time value of SQLITE_TEMP_STORE. The\r\n** following table describes the relationship between these two values\r\n** and this functions return value.\r\n**\r\n**   SQLITE_TEMP_STORE     db->temp_store     Location of temporary database\r\n**   -----------------     --------------     ------------------------------\r\n**   0                     any                file      (return 0)\r\n**   1                     1                  file      (return 0)\r\n**   1                     2                  memory    (return 1)\r\n**   1                     0                  file      (return 0)\r\n**   2                     1                  file      (return 0)\r\n**   2                     2                  memory    (return 1)\r\n**   2                     0                  memory    (return 1)\r\n**   3                     any                memory    (return 1)\r\n*/\r\nSQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3 *db){\r\n#if SQLITE_TEMP_STORE==1\r\n  return ( db->temp_store==2 );\r\n#endif\r\n#if SQLITE_TEMP_STORE==2\r\n  return ( db->temp_store!=1 );\r\n#endif\r\n#if SQLITE_TEMP_STORE==3\r\n  return 1;\r\n#endif\r\n#if SQLITE_TEMP_STORE<1 || SQLITE_TEMP_STORE>3\r\n  return 0;\r\n#endif\r\n}\r\n\r\n/*\r\n** Return UTF-8 encoded English language explanation of the most recent\r\n** error.\r\n*/\r\nSQLITE_API const char *sqlite3_errmsg(sqlite3 *db){\r\n  const char *z;\r\n  if( !db ){\r\n    return sqlite3ErrStr(SQLITE_NOMEM);\r\n  }\r\n  if( !sqlite3SafetyCheckSickOrOk(db) ){\r\n    return sqlite3ErrStr(SQLITE_MISUSE_BKPT);\r\n  }\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( db->mallocFailed ){\r\n    z = sqlite3ErrStr(SQLITE_NOMEM);\r\n  }else{\r\n    z = (char*)sqlite3_value_text(db->pErr);\r\n    assert( !db->mallocFailed );\r\n    if( z==0 ){\r\n      z = sqlite3ErrStr(db->errCode);\r\n    }\r\n  }\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return z;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** Return UTF-16 encoded English language explanation of the most recent\r\n** error.\r\n*/\r\nSQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){\r\n  static const u16 outOfMem[] = {\r\n    'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0\r\n  };\r\n  static const u16 misuse[] = {\r\n    'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ', \r\n    'r', 'o', 'u', 't', 'i', 'n', 'e', ' ', \r\n    'c', 'a', 'l', 'l', 'e', 'd', ' ', \r\n    'o', 'u', 't', ' ', \r\n    'o', 'f', ' ', \r\n    's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0\r\n  };\r\n\r\n  const void *z;\r\n  if( !db ){\r\n    return (void *)outOfMem;\r\n  }\r\n  if( !sqlite3SafetyCheckSickOrOk(db) ){\r\n    return (void *)misuse;\r\n  }\r\n  sqlite3_mutex_enter(db->mutex);\r\n  if( db->mallocFailed ){\r\n    z = (void *)outOfMem;\r\n  }else{\r\n    z = sqlite3_value_text16(db->pErr);\r\n    if( z==0 ){\r\n      sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode),\r\n           SQLITE_UTF8, SQLITE_STATIC);\r\n      z = sqlite3_value_text16(db->pErr);\r\n    }\r\n    /* A malloc() may have failed within the call to sqlite3_value_text16()\r\n    ** above. If this is the case, then the db->mallocFailed flag needs to\r\n    ** be cleared before returning. Do this directly, instead of via\r\n    ** sqlite3ApiExit(), to avoid setting the database handle error message.\r\n    */\r\n    db->mallocFailed = 0;\r\n  }\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return z;\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/*\r\n** Return the most recent error code generated by an SQLite routine. If NULL is\r\n** passed to this function, we assume a malloc() failed during sqlite3_open().\r\n*/\r\nSQLITE_API int sqlite3_errcode(sqlite3 *db){\r\n  if( db && !sqlite3SafetyCheckSickOrOk(db) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  if( !db || db->mallocFailed ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  return db->errCode & db->errMask;\r\n}\r\nSQLITE_API int sqlite3_extended_errcode(sqlite3 *db){\r\n  if( db && !sqlite3SafetyCheckSickOrOk(db) ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n  if( !db || db->mallocFailed ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  return db->errCode;\r\n}\r\n\r\n/*\r\n** Create a new collating function for database \"db\".  The name is zName\r\n** and the encoding is enc.\r\n*/\r\nstatic int createCollation(\r\n  sqlite3* db,\r\n  const char *zName, \r\n  u8 enc,\r\n  void* pCtx,\r\n  int(*xCompare)(void*,int,const void*,int,const void*),\r\n  void(*xDel)(void*)\r\n){\r\n  CollSeq *pColl;\r\n  int enc2;\r\n  int nName = sqlite3Strlen30(zName);\r\n  \r\n  assert( sqlite3_mutex_held(db->mutex) );\r\n\r\n  /* If SQLITE_UTF16 is specified as the encoding type, transform this\r\n  ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the\r\n  ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.\r\n  */\r\n  enc2 = enc;\r\n  testcase( enc2==SQLITE_UTF16 );\r\n  testcase( enc2==SQLITE_UTF16_ALIGNED );\r\n  if( enc2==SQLITE_UTF16 || enc2==SQLITE_UTF16_ALIGNED ){\r\n    enc2 = SQLITE_UTF16NATIVE;\r\n  }\r\n  if( enc2<SQLITE_UTF8 || enc2>SQLITE_UTF16BE ){\r\n    return SQLITE_MISUSE_BKPT;\r\n  }\r\n\r\n  /* Check if this call is removing or replacing an existing collation \r\n  ** sequence. If so, and there are active VMs, return busy. If there\r\n  ** are no active VMs, invalidate any pre-compiled statements.\r\n  */\r\n  pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 0);\r\n  if( pColl && pColl->xCmp ){\r\n    if( db->activeVdbeCnt ){\r\n      sqlite3Error(db, SQLITE_BUSY, \r\n        \"unable to delete/modify collation sequence due to active statements\");\r\n      return SQLITE_BUSY;\r\n    }\r\n    sqlite3ExpirePreparedStatements(db);\r\n\r\n    /* If collation sequence pColl was created directly by a call to\r\n    ** sqlite3_create_collation, and not generated by synthCollSeq(),\r\n    ** then any copies made by synthCollSeq() need to be invalidated.\r\n    ** Also, collation destructor - CollSeq.xDel() - function may need\r\n    ** to be called.\r\n    */ \r\n    if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){\r\n      CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName, nName);\r\n      int j;\r\n      for(j=0; j<3; j++){\r\n        CollSeq *p = &aColl[j];\r\n        if( p->enc==pColl->enc ){\r\n          if( p->xDel ){\r\n            p->xDel(p->pUser);\r\n          }\r\n          p->xCmp = 0;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);\r\n  if( pColl==0 ) return SQLITE_NOMEM;\r\n  pColl->xCmp = xCompare;\r\n  pColl->pUser = pCtx;\r\n  pColl->xDel = xDel;\r\n  pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED));\r\n  sqlite3Error(db, SQLITE_OK, 0);\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** This array defines hard upper bounds on limit values.  The\r\n** initializer must be kept in sync with the SQLITE_LIMIT_*\r\n** #defines in sqlite3.h.\r\n*/\r\nstatic const int aHardLimit[] = {\r\n  SQLITE_MAX_LENGTH,\r\n  SQLITE_MAX_SQL_LENGTH,\r\n  SQLITE_MAX_COLUMN,\r\n  SQLITE_MAX_EXPR_DEPTH,\r\n  SQLITE_MAX_COMPOUND_SELECT,\r\n  SQLITE_MAX_VDBE_OP,\r\n  SQLITE_MAX_FUNCTION_ARG,\r\n  SQLITE_MAX_ATTACHED,\r\n  SQLITE_MAX_LIKE_PATTERN_LENGTH,\r\n  SQLITE_MAX_VARIABLE_NUMBER,\r\n  SQLITE_MAX_TRIGGER_DEPTH,\r\n};\r\n\r\n/*\r\n** Make sure the hard limits are set to reasonable values\r\n*/\r\n#if SQLITE_MAX_LENGTH<100\r\n# error SQLITE_MAX_LENGTH must be at least 100\r\n#endif\r\n#if SQLITE_MAX_SQL_LENGTH<100\r\n# error SQLITE_MAX_SQL_LENGTH must be at least 100\r\n#endif\r\n#if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH\r\n# error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH\r\n#endif\r\n#if SQLITE_MAX_COMPOUND_SELECT<2\r\n# error SQLITE_MAX_COMPOUND_SELECT must be at least 2\r\n#endif\r\n#if SQLITE_MAX_VDBE_OP<40\r\n# error SQLITE_MAX_VDBE_OP must be at least 40\r\n#endif\r\n#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>1000\r\n# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 1000\r\n#endif\r\n#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>62\r\n# error SQLITE_MAX_ATTACHED must be between 0 and 62\r\n#endif\r\n#if SQLITE_MAX_LIKE_PATTERN_LENGTH<1\r\n# error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1\r\n#endif\r\n#if SQLITE_MAX_COLUMN>32767\r\n# error SQLITE_MAX_COLUMN must not exceed 32767\r\n#endif\r\n#if SQLITE_MAX_TRIGGER_DEPTH<1\r\n# error SQLITE_MAX_TRIGGER_DEPTH must be at least 1\r\n#endif\r\n\r\n\r\n/*\r\n** Change the value of a limit.  Report the old value.\r\n** If an invalid limit index is supplied, report -1.\r\n** Make no changes but still report the old value if the\r\n** new limit is negative.\r\n**\r\n** A new lower limit does not shrink existing constructs.\r\n** It merely prevents new constructs that exceed the limit\r\n** from forming.\r\n*/\r\nSQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){\r\n  int oldLimit;\r\n\r\n\r\n  /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME\r\n  ** there is a hard upper bound set at compile-time by a C preprocessor\r\n  ** macro called SQLITE_MAX_NAME. (The \"_LIMIT_\" in the name is changed to\r\n  ** \"_MAX_\".)\r\n  */\r\n  assert( aHardLimit[SQLITE_LIMIT_LENGTH]==SQLITE_MAX_LENGTH );\r\n  assert( aHardLimit[SQLITE_LIMIT_SQL_LENGTH]==SQLITE_MAX_SQL_LENGTH );\r\n  assert( aHardLimit[SQLITE_LIMIT_COLUMN]==SQLITE_MAX_COLUMN );\r\n  assert( aHardLimit[SQLITE_LIMIT_EXPR_DEPTH]==SQLITE_MAX_EXPR_DEPTH );\r\n  assert( aHardLimit[SQLITE_LIMIT_COMPOUND_SELECT]==SQLITE_MAX_COMPOUND_SELECT);\r\n  assert( aHardLimit[SQLITE_LIMIT_VDBE_OP]==SQLITE_MAX_VDBE_OP );\r\n  assert( aHardLimit[SQLITE_LIMIT_FUNCTION_ARG]==SQLITE_MAX_FUNCTION_ARG );\r\n  assert( aHardLimit[SQLITE_LIMIT_ATTACHED]==SQLITE_MAX_ATTACHED );\r\n  assert( aHardLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]==\r\n                                               SQLITE_MAX_LIKE_PATTERN_LENGTH );\r\n  assert( aHardLimit[SQLITE_LIMIT_VARIABLE_NUMBER]==SQLITE_MAX_VARIABLE_NUMBER);\r\n  assert( aHardLimit[SQLITE_LIMIT_TRIGGER_DEPTH]==SQLITE_MAX_TRIGGER_DEPTH );\r\n  assert( SQLITE_LIMIT_TRIGGER_DEPTH==(SQLITE_N_LIMIT-1) );\r\n\r\n\r\n  if( limitId<0 || limitId>=SQLITE_N_LIMIT ){\r\n    return -1;\r\n  }\r\n  oldLimit = db->aLimit[limitId];\r\n  if( newLimit>=0 ){                   /* IMP: R-52476-28732 */\r\n    if( newLimit>aHardLimit[limitId] ){\r\n      newLimit = aHardLimit[limitId];  /* IMP: R-51463-25634 */\r\n    }\r\n    db->aLimit[limitId] = newLimit;\r\n  }\r\n  return oldLimit;                     /* IMP: R-53341-35419 */\r\n}\r\n\r\n/*\r\n** This function is used to parse both URIs and non-URI filenames passed by the\r\n** user to API functions sqlite3_open() or sqlite3_open_v2(), and for database\r\n** URIs specified as part of ATTACH statements.\r\n**\r\n** The first argument to this function is the name of the VFS to use (or\r\n** a NULL to signify the default VFS) if the URI does not contain a \"vfs=xxx\"\r\n** query parameter. The second argument contains the URI (or non-URI filename)\r\n** itself. When this function is called the *pFlags variable should contain\r\n** the default flags to open the database handle with. The value stored in\r\n** *pFlags may be updated before returning if the URI filename contains \r\n** \"cache=xxx\" or \"mode=xxx\" query parameters.\r\n**\r\n** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to\r\n** the VFS that should be used to open the database file. *pzFile is set to\r\n** point to a buffer containing the name of the file to open. It is the \r\n** responsibility of the caller to eventually call sqlite3_free() to release\r\n** this buffer.\r\n**\r\n** If an error occurs, then an SQLite error code is returned and *pzErrMsg\r\n** may be set to point to a buffer containing an English language error \r\n** message. It is the responsibility of the caller to eventually release\r\n** this buffer by calling sqlite3_free().\r\n*/\r\nSQLITE_PRIVATE int sqlite3ParseUri(\r\n  const char *zDefaultVfs,        /* VFS to use if no \"vfs=xxx\" query option */\r\n  const char *zUri,               /* Nul-terminated URI to parse */\r\n  unsigned int *pFlags,           /* IN/OUT: SQLITE_OPEN_XXX flags */\r\n  sqlite3_vfs **ppVfs,            /* OUT: VFS to use */ \r\n  char **pzFile,                  /* OUT: Filename component of URI */\r\n  char **pzErrMsg                 /* OUT: Error message (if rc!=SQLITE_OK) */\r\n){\r\n  int rc = SQLITE_OK;\r\n  unsigned int flags = *pFlags;\r\n  const char *zVfs = zDefaultVfs;\r\n  char *zFile;\r\n  char c;\r\n  int nUri = sqlite3Strlen30(zUri);\r\n\r\n  assert( *pzErrMsg==0 );\r\n\r\n  if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri) \r\n   && nUri>=5 && memcmp(zUri, \"file:\", 5)==0 \r\n  ){\r\n    char *zOpt;\r\n    int eState;                   /* Parser state when parsing URI */\r\n    int iIn;                      /* Input character index */\r\n    int iOut = 0;                 /* Output character index */\r\n    int nByte = nUri+2;           /* Bytes of space to allocate */\r\n\r\n    /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen \r\n    ** method that there may be extra parameters following the file-name.  */\r\n    flags |= SQLITE_OPEN_URI;\r\n\r\n    for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');\r\n    zFile = sqlite3_malloc(nByte);\r\n    if( !zFile ) return SQLITE_NOMEM;\r\n\r\n    /* Discard the scheme and authority segments of the URI. */\r\n    if( zUri[5]=='/' && zUri[6]=='/' ){\r\n      iIn = 7;\r\n      while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;\r\n\r\n      if( iIn!=7 && (iIn!=16 || memcmp(\"localhost\", &zUri[7], 9)) ){\r\n        *pzErrMsg = sqlite3_mprintf(\"invalid uri authority: %.*s\", \r\n            iIn-7, &zUri[7]);\r\n        rc = SQLITE_ERROR;\r\n        goto parse_uri_out;\r\n      }\r\n    }else{\r\n      iIn = 5;\r\n    }\r\n\r\n    /* Copy the filename and any query parameters into the zFile buffer. \r\n    ** Decode %HH escape codes along the way. \r\n    **\r\n    ** Within this loop, variable eState may be set to 0, 1 or 2, depending\r\n    ** on the parsing context. As follows:\r\n    **\r\n    **   0: Parsing file-name.\r\n    **   1: Parsing name section of a name=value query parameter.\r\n    **   2: Parsing value section of a name=value query parameter.\r\n    */\r\n    eState = 0;\r\n    while( (c = zUri[iIn])!=0 && c!='#' ){\r\n      iIn++;\r\n      if( c=='%' \r\n       && sqlite3Isxdigit(zUri[iIn]) \r\n       && sqlite3Isxdigit(zUri[iIn+1]) \r\n      ){\r\n        int octet = (sqlite3HexToInt(zUri[iIn++]) << 4);\r\n        octet += sqlite3HexToInt(zUri[iIn++]);\r\n\r\n        assert( octet>=0 && octet<256 );\r\n        if( octet==0 ){\r\n          /* This branch is taken when \"%00\" appears within the URI. In this\r\n          ** case we ignore all text in the remainder of the path, name or\r\n          ** value currently being parsed. So ignore the current character\r\n          ** and skip to the next \"?\", \"=\" or \"&\", as appropriate. */\r\n          while( (c = zUri[iIn])!=0 && c!='#' \r\n              && (eState!=0 || c!='?')\r\n              && (eState!=1 || (c!='=' && c!='&'))\r\n              && (eState!=2 || c!='&')\r\n          ){\r\n            iIn++;\r\n          }\r\n          continue;\r\n        }\r\n        c = octet;\r\n      }else if( eState==1 && (c=='&' || c=='=') ){\r\n        if( zFile[iOut-1]==0 ){\r\n          /* An empty option name. Ignore this option altogether. */\r\n          while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++;\r\n          continue;\r\n        }\r\n        if( c=='&' ){\r\n          zFile[iOut++] = '\\0';\r\n        }else{\r\n          eState = 2;\r\n        }\r\n        c = 0;\r\n      }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){\r\n        c = 0;\r\n        eState = 1;\r\n      }\r\n      zFile[iOut++] = c;\r\n    }\r\n    if( eState==1 ) zFile[iOut++] = '\\0';\r\n    zFile[iOut++] = '\\0';\r\n    zFile[iOut++] = '\\0';\r\n\r\n    /* Check if there were any options specified that should be interpreted \r\n    ** here. Options that are interpreted here include \"vfs\" and those that\r\n    ** correspond to flags that may be passed to the sqlite3_open_v2()\r\n    ** method. */\r\n    zOpt = &zFile[sqlite3Strlen30(zFile)+1];\r\n    while( zOpt[0] ){\r\n      int nOpt = sqlite3Strlen30(zOpt);\r\n      char *zVal = &zOpt[nOpt+1];\r\n      int nVal = sqlite3Strlen30(zVal);\r\n\r\n      if( nOpt==3 && memcmp(\"vfs\", zOpt, 3)==0 ){\r\n        zVfs = zVal;\r\n      }else{\r\n        struct OpenMode {\r\n          const char *z;\r\n          int mode;\r\n        } *aMode = 0;\r\n        char *zModeType = 0;\r\n        int mask = 0;\r\n        int limit = 0;\r\n\r\n        if( nOpt==5 && memcmp(\"cache\", zOpt, 5)==0 ){\r\n          static struct OpenMode aCacheMode[] = {\r\n            { \"shared\",  SQLITE_OPEN_SHAREDCACHE },\r\n            { \"private\", SQLITE_OPEN_PRIVATECACHE },\r\n            { 0, 0 }\r\n          };\r\n\r\n          mask = SQLITE_OPEN_SHAREDCACHE|SQLITE_OPEN_PRIVATECACHE;\r\n          aMode = aCacheMode;\r\n          limit = mask;\r\n          zModeType = \"cache\";\r\n        }\r\n        if( nOpt==4 && memcmp(\"mode\", zOpt, 4)==0 ){\r\n          static struct OpenMode aOpenMode[] = {\r\n            { \"ro\",  SQLITE_OPEN_READONLY },\r\n            { \"rw\",  SQLITE_OPEN_READWRITE }, \r\n            { \"rwc\", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE },\r\n            { 0, 0 }\r\n          };\r\n\r\n          mask = SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;\r\n          aMode = aOpenMode;\r\n          limit = mask & flags;\r\n          zModeType = \"access\";\r\n        }\r\n\r\n        if( aMode ){\r\n          int i;\r\n          int mode = 0;\r\n          for(i=0; aMode[i].z; i++){\r\n            const char *z = aMode[i].z;\r\n            if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){\r\n              mode = aMode[i].mode;\r\n              break;\r\n            }\r\n          }\r\n          if( mode==0 ){\r\n            *pzErrMsg = sqlite3_mprintf(\"no such %s mode: %s\", zModeType, zVal);\r\n            rc = SQLITE_ERROR;\r\n            goto parse_uri_out;\r\n          }\r\n          if( mode>limit ){\r\n            *pzErrMsg = sqlite3_mprintf(\"%s mode not allowed: %s\",\r\n                                        zModeType, zVal);\r\n            rc = SQLITE_PERM;\r\n            goto parse_uri_out;\r\n          }\r\n          flags = (flags & ~mask) | mode;\r\n        }\r\n      }\r\n\r\n      zOpt = &zVal[nVal+1];\r\n    }\r\n\r\n  }else{\r\n    zFile = sqlite3_malloc(nUri+2);\r\n    if( !zFile ) return SQLITE_NOMEM;\r\n    memcpy(zFile, zUri, nUri);\r\n    zFile[nUri] = '\\0';\r\n    zFile[nUri+1] = '\\0';\r\n  }\r\n\r\n  *ppVfs = sqlite3_vfs_find(zVfs);\r\n  if( *ppVfs==0 ){\r\n    *pzErrMsg = sqlite3_mprintf(\"no such vfs: %s\", zVfs);\r\n    rc = SQLITE_ERROR;\r\n  }\r\n parse_uri_out:\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3_free(zFile);\r\n    zFile = 0;\r\n  }\r\n  *pFlags = flags;\r\n  *pzFile = zFile;\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This routine does the work of opening a database on behalf of\r\n** sqlite3_open() and sqlite3_open16(). The database filename \"zFilename\"  \r\n** is UTF-8 encoded.\r\n*/\r\nstatic int openDatabase(\r\n  const char *zFilename, /* Database filename UTF-8 encoded */\r\n  sqlite3 **ppDb,        /* OUT: Returned database handle */\r\n  unsigned int flags,    /* Operational flags */\r\n  const char *zVfs       /* Name of the VFS to use */\r\n){\r\n  sqlite3 *db;                    /* Store allocated handle here */\r\n  int rc;                         /* Return code */\r\n  int isThreadsafe;               /* True for threadsafe connections */\r\n  char *zOpen = 0;                /* Filename argument to pass to BtreeOpen() */\r\n  char *zErrMsg = 0;              /* Error message from sqlite3ParseUri() */\r\n\r\n  *ppDb = 0;\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  rc = sqlite3_initialize();\r\n  if( rc ) return rc;\r\n#endif\r\n\r\n  /* Only allow sensible combinations of bits in the flags argument.  \r\n  ** Throw an error if any non-sense combination is used.  If we\r\n  ** do not block illegal combinations here, it could trigger\r\n  ** assert() statements in deeper layers.  Sensible combinations\r\n  ** are:\r\n  **\r\n  **  1:  SQLITE_OPEN_READONLY\r\n  **  2:  SQLITE_OPEN_READWRITE\r\n  **  6:  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE\r\n  */\r\n  assert( SQLITE_OPEN_READONLY  == 0x01 );\r\n  assert( SQLITE_OPEN_READWRITE == 0x02 );\r\n  assert( SQLITE_OPEN_CREATE    == 0x04 );\r\n  testcase( (1<<(flags&7))==0x02 ); /* READONLY */\r\n  testcase( (1<<(flags&7))==0x04 ); /* READWRITE */\r\n  testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */\r\n  if( ((1<<(flags&7)) & 0x46)==0 ) return SQLITE_MISUSE_BKPT;\r\n\r\n  if( sqlite3GlobalConfig.bCoreMutex==0 ){\r\n    isThreadsafe = 0;\r\n  }else if( flags & SQLITE_OPEN_NOMUTEX ){\r\n    isThreadsafe = 0;\r\n  }else if( flags & SQLITE_OPEN_FULLMUTEX ){\r\n    isThreadsafe = 1;\r\n  }else{\r\n    isThreadsafe = sqlite3GlobalConfig.bFullMutex;\r\n  }\r\n  if( flags & SQLITE_OPEN_PRIVATECACHE ){\r\n    flags &= ~SQLITE_OPEN_SHAREDCACHE;\r\n  }else if( sqlite3GlobalConfig.sharedCacheEnabled ){\r\n    flags |= SQLITE_OPEN_SHAREDCACHE;\r\n  }\r\n\r\n  /* Remove harmful bits from the flags parameter\r\n  **\r\n  ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were\r\n  ** dealt with in the previous code block.  Besides these, the only\r\n  ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY,\r\n  ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE,\r\n  ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits.  Silently mask\r\n  ** off all other flags.\r\n  */\r\n  flags &=  ~( SQLITE_OPEN_DELETEONCLOSE |\r\n               SQLITE_OPEN_EXCLUSIVE |\r\n               SQLITE_OPEN_MAIN_DB |\r\n               SQLITE_OPEN_TEMP_DB | \r\n               SQLITE_OPEN_TRANSIENT_DB | \r\n               SQLITE_OPEN_MAIN_JOURNAL | \r\n               SQLITE_OPEN_TEMP_JOURNAL | \r\n               SQLITE_OPEN_SUBJOURNAL | \r\n               SQLITE_OPEN_MASTER_JOURNAL |\r\n               SQLITE_OPEN_NOMUTEX |\r\n               SQLITE_OPEN_FULLMUTEX |\r\n               SQLITE_OPEN_WAL\r\n             );\r\n\r\n  /* Allocate the sqlite data structure */\r\n  db = sqlite3MallocZero( sizeof(sqlite3) );\r\n  if( db==0 ) goto opendb_out;\r\n  if( isThreadsafe ){\r\n    db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);\r\n    if( db->mutex==0 ){\r\n      sqlite3_free(db);\r\n      db = 0;\r\n      goto opendb_out;\r\n    }\r\n  }\r\n  sqlite3_mutex_enter(db->mutex);\r\n  db->errMask = 0xff;\r\n  db->nDb = 2;\r\n  db->magic = SQLITE_MAGIC_BUSY;\r\n  db->aDb = db->aDbStatic;\r\n\r\n  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );\r\n  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));\r\n  db->autoCommit = 1;\r\n  db->nextAutovac = -1;\r\n  db->nextPagesize = 0;\r\n  db->flags |= SQLITE_ShortColNames | SQLITE_AutoIndex | SQLITE_EnableTrigger\r\n#if SQLITE_DEFAULT_FILE_FORMAT<4\r\n                 | SQLITE_LegacyFileFmt\r\n#endif\r\n#ifdef SQLITE_ENABLE_LOAD_EXTENSION\r\n                 | SQLITE_LoadExtension\r\n#endif\r\n#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS\r\n                 | SQLITE_RecTriggers\r\n#endif\r\n#if defined(SQLITE_DEFAULT_FOREIGN_KEYS) && SQLITE_DEFAULT_FOREIGN_KEYS\r\n                 | SQLITE_ForeignKeys\r\n#endif\r\n      ;\r\n  sqlite3HashInit(&db->aCollSeq);\r\n#ifndef SQLITE_OMIT_VIRTUALTABLE\r\n  sqlite3HashInit(&db->aModule);\r\n#endif\r\n\r\n  /* Add the default collation sequence BINARY. BINARY works for both UTF-8\r\n  ** and UTF-16, so add a version for each to avoid any unnecessary\r\n  ** conversions. The only error that can occur here is a malloc() failure.\r\n  */\r\n  createCollation(db, \"BINARY\", SQLITE_UTF8, 0, binCollFunc, 0);\r\n  createCollation(db, \"BINARY\", SQLITE_UTF16BE, 0, binCollFunc, 0);\r\n  createCollation(db, \"BINARY\", SQLITE_UTF16LE, 0, binCollFunc, 0);\r\n  createCollation(db, \"RTRIM\", SQLITE_UTF8, (void*)1, binCollFunc, 0);\r\n  if( db->mallocFailed ){\r\n    goto opendb_out;\r\n  }\r\n  db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, \"BINARY\", 0);\r\n  assert( db->pDfltColl!=0 );\r\n\r\n  /* Also add a UTF-8 case-insensitive collation sequence. */\r\n  createCollation(db, \"NOCASE\", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);\r\n\r\n  /* Parse the filename/URI argument. */\r\n  db->openFlags = flags;\r\n  rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);\r\n  if( rc!=SQLITE_OK ){\r\n    if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;\r\n    sqlite3Error(db, rc, zErrMsg ? \"%s\" : 0, zErrMsg);\r\n    sqlite3_free(zErrMsg);\r\n    goto opendb_out;\r\n  }\r\n\r\n  /* Open the backend database driver */\r\n  rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0,\r\n                        flags | SQLITE_OPEN_MAIN_DB);\r\n  if( rc!=SQLITE_OK ){\r\n    if( rc==SQLITE_IOERR_NOMEM ){\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n    sqlite3Error(db, rc, 0);\r\n    goto opendb_out;\r\n  }\r\n  db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);\r\n  db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);\r\n\r\n\r\n  /* The default safety_level for the main database is 'full'; for the temp\r\n  ** database it is 'NONE'. This matches the pager layer defaults.  \r\n  */\r\n  db->aDb[0].zName = \"main\";\r\n  db->aDb[0].safety_level = 3;\r\n  db->aDb[1].zName = \"temp\";\r\n  db->aDb[1].safety_level = 1;\r\n\r\n  db->magic = SQLITE_MAGIC_OPEN;\r\n  if( db->mallocFailed ){\r\n    goto opendb_out;\r\n  }\r\n\r\n  /* Register all built-in functions, but do not attempt to read the\r\n  ** database schema yet. This is delayed until the first time the database\r\n  ** is accessed.\r\n  */\r\n  sqlite3Error(db, SQLITE_OK, 0);\r\n  sqlite3RegisterBuiltinFunctions(db);\r\n\r\n  /* Load automatic extensions - extensions that have been registered\r\n  ** using the sqlite3_automatic_extension() API.\r\n  */\r\n  rc = sqlite3_errcode(db);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3AutoLoadExtensions(db);\r\n    rc = sqlite3_errcode(db);\r\n    if( rc!=SQLITE_OK ){\r\n      goto opendb_out;\r\n    }\r\n  }\r\n\r\n#ifdef SQLITE_ENABLE_FTS1\r\n  if( !db->mallocFailed ){\r\n    extern int sqlite3Fts1Init(sqlite3*);\r\n    rc = sqlite3Fts1Init(db);\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_FTS2\r\n  if( !db->mallocFailed && rc==SQLITE_OK ){\r\n    extern int sqlite3Fts2Init(sqlite3*);\r\n    rc = sqlite3Fts2Init(db);\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_FTS3\r\n  if( !db->mallocFailed && rc==SQLITE_OK ){\r\n    rc = sqlite3Fts3Init(db);\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_ICU\r\n  if( !db->mallocFailed && rc==SQLITE_OK ){\r\n    rc = sqlite3IcuInit(db);\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_RTREE\r\n  if( !db->mallocFailed && rc==SQLITE_OK){\r\n    rc = sqlite3RtreeInit(db);\r\n  }\r\n#endif\r\n\r\n  sqlite3Error(db, rc, 0);\r\n\r\n  /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking\r\n  ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking\r\n  ** mode.  Doing nothing at all also makes NORMAL the default.\r\n  */\r\n#ifdef SQLITE_DEFAULT_LOCKING_MODE\r\n  db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;\r\n  sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),\r\n                          SQLITE_DEFAULT_LOCKING_MODE);\r\n#endif\r\n\r\n  /* Enable the lookaside-malloc subsystem */\r\n  setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,\r\n                        sqlite3GlobalConfig.nLookaside);\r\n\r\n  sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);\r\n\r\nopendb_out:\r\n  sqlite3_free(zOpen);\r\n  if( db ){\r\n    assert( db->mutex!=0 || isThreadsafe==0 || sqlite3GlobalConfig.bFullMutex==0 );\r\n    sqlite3_mutex_leave(db->mutex);\r\n  }\r\n  rc = sqlite3_errcode(db);\r\n  assert( db!=0 || rc==SQLITE_NOMEM );\r\n  if( rc==SQLITE_NOMEM ){\r\n    sqlite3_close(db);\r\n    db = 0;\r\n  }else if( rc!=SQLITE_OK ){\r\n    db->magic = SQLITE_MAGIC_SICK;\r\n  }\r\n  *ppDb = db;\r\n  return sqlite3ApiExit(0, rc);\r\n}\r\n\r\n/*\r\n** Open a new database handle.\r\n*/\r\nSQLITE_API int sqlite3_open(\r\n  const char *zFilename, \r\n  sqlite3 **ppDb \r\n){\r\n  return openDatabase(zFilename, ppDb,\r\n                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);\r\n}\r\nSQLITE_API int sqlite3_open_v2(\r\n  const char *filename,   /* Database filename (UTF-8) */\r\n  sqlite3 **ppDb,         /* OUT: SQLite db handle */\r\n  int flags,              /* Flags */\r\n  const char *zVfs        /* Name of VFS module to use */\r\n){\r\n  return openDatabase(filename, ppDb, (unsigned int)flags, zVfs);\r\n}\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** Open a new database handle.\r\n*/\r\nSQLITE_API int sqlite3_open16(\r\n  const void *zFilename, \r\n  sqlite3 **ppDb\r\n){\r\n  char const *zFilename8;   /* zFilename encoded in UTF-8 instead of UTF-16 */\r\n  sqlite3_value *pVal;\r\n  int rc;\r\n\r\n  assert( zFilename );\r\n  assert( ppDb );\r\n  *ppDb = 0;\r\n#ifndef SQLITE_OMIT_AUTOINIT\r\n  rc = sqlite3_initialize();\r\n  if( rc ) return rc;\r\n#endif\r\n  pVal = sqlite3ValueNew(0);\r\n  sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);\r\n  zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);\r\n  if( zFilename8 ){\r\n    rc = openDatabase(zFilename8, ppDb,\r\n                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);\r\n    assert( *ppDb || rc==SQLITE_NOMEM );\r\n    if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){\r\n      ENC(*ppDb) = SQLITE_UTF16NATIVE;\r\n    }\r\n  }else{\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n  sqlite3ValueFree(pVal);\r\n\r\n  return sqlite3ApiExit(0, rc);\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/*\r\n** Register a new collation sequence with the database handle db.\r\n*/\r\nSQLITE_API int sqlite3_create_collation(\r\n  sqlite3* db, \r\n  const char *zName, \r\n  int enc, \r\n  void* pCtx,\r\n  int(*xCompare)(void*,int,const void*,int,const void*)\r\n){\r\n  int rc;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  assert( !db->mallocFailed );\r\n  rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, 0);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Register a new collation sequence with the database handle db.\r\n*/\r\nSQLITE_API int sqlite3_create_collation_v2(\r\n  sqlite3* db, \r\n  const char *zName, \r\n  int enc, \r\n  void* pCtx,\r\n  int(*xCompare)(void*,int,const void*,int,const void*),\r\n  void(*xDel)(void*)\r\n){\r\n  int rc;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  assert( !db->mallocFailed );\r\n  rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** Register a new collation sequence with the database handle db.\r\n*/\r\nSQLITE_API int sqlite3_create_collation16(\r\n  sqlite3* db, \r\n  const void *zName,\r\n  int enc, \r\n  void* pCtx,\r\n  int(*xCompare)(void*,int,const void*,int,const void*)\r\n){\r\n  int rc = SQLITE_OK;\r\n  char *zName8;\r\n  sqlite3_mutex_enter(db->mutex);\r\n  assert( !db->mallocFailed );\r\n  zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);\r\n  if( zName8 ){\r\n    rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);\r\n    sqlite3DbFree(db, zName8);\r\n  }\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n/*\r\n** Register a collation sequence factory callback with the database handle\r\n** db. Replace any previously installed collation sequence factory.\r\n*/\r\nSQLITE_API int sqlite3_collation_needed(\r\n  sqlite3 *db, \r\n  void *pCollNeededArg, \r\n  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)\r\n){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  db->xCollNeeded = xCollNeeded;\r\n  db->xCollNeeded16 = 0;\r\n  db->pCollNeededArg = pCollNeededArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#ifndef SQLITE_OMIT_UTF16\r\n/*\r\n** Register a collation sequence factory callback with the database handle\r\n** db. Replace any previously installed collation sequence factory.\r\n*/\r\nSQLITE_API int sqlite3_collation_needed16(\r\n  sqlite3 *db, \r\n  void *pCollNeededArg, \r\n  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)\r\n){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  db->xCollNeeded = 0;\r\n  db->xCollNeeded16 = xCollNeeded16;\r\n  db->pCollNeededArg = pCollNeededArg;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n#endif /* SQLITE_OMIT_UTF16 */\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n/*\r\n** This function is now an anachronism. It used to be used to recover from a\r\n** malloc() failure, but SQLite now does this automatically.\r\n*/\r\nSQLITE_API int sqlite3_global_recover(void){\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n/*\r\n** Test to see whether or not the database connection is in autocommit\r\n** mode.  Return TRUE if it is and FALSE if not.  Autocommit mode is on\r\n** by default.  Autocommit is disabled by a BEGIN statement and reenabled\r\n** by the next COMMIT or ROLLBACK.\r\n**\r\n******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******\r\n*/\r\nSQLITE_API int sqlite3_get_autocommit(sqlite3 *db){\r\n  return db->autoCommit;\r\n}\r\n\r\n/*\r\n** The following routines are subtitutes for constants SQLITE_CORRUPT,\r\n** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_IOERR and possibly other error\r\n** constants.  They server two purposes:\r\n**\r\n**   1.  Serve as a convenient place to set a breakpoint in a debugger\r\n**       to detect when version error conditions occurs.\r\n**\r\n**   2.  Invoke sqlite3_log() to provide the source code location where\r\n**       a low-level error is first detected.\r\n*/\r\nSQLITE_PRIVATE int sqlite3CorruptError(int lineno){\r\n  testcase( sqlite3GlobalConfig.xLog!=0 );\r\n  sqlite3_log(SQLITE_CORRUPT,\r\n              \"database corruption at line %d of [%.10s]\",\r\n              lineno, 20+sqlite3_sourceid());\r\n  return SQLITE_CORRUPT;\r\n}\r\nSQLITE_PRIVATE int sqlite3MisuseError(int lineno){\r\n  testcase( sqlite3GlobalConfig.xLog!=0 );\r\n  sqlite3_log(SQLITE_MISUSE, \r\n              \"misuse at line %d of [%.10s]\",\r\n              lineno, 20+sqlite3_sourceid());\r\n  return SQLITE_MISUSE;\r\n}\r\nSQLITE_PRIVATE int sqlite3CantopenError(int lineno){\r\n  testcase( sqlite3GlobalConfig.xLog!=0 );\r\n  sqlite3_log(SQLITE_CANTOPEN, \r\n              \"cannot open file at line %d of [%.10s]\",\r\n              lineno, 20+sqlite3_sourceid());\r\n  return SQLITE_CANTOPEN;\r\n}\r\n\r\n\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n/*\r\n** This is a convenience routine that makes sure that all thread-specific\r\n** data for this thread has been deallocated.\r\n**\r\n** SQLite no longer uses thread-specific data so this routine is now a\r\n** no-op.  It is retained for historical compatibility.\r\n*/\r\nSQLITE_API void sqlite3_thread_cleanup(void){\r\n}\r\n#endif\r\n\r\n/*\r\n** Return meta information about a specific column of a database table.\r\n** See comment in sqlite3.h (sqlite.h.in) for details.\r\n*/\r\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\r\nSQLITE_API int sqlite3_table_column_metadata(\r\n  sqlite3 *db,                /* Connection handle */\r\n  const char *zDbName,        /* Database name or NULL */\r\n  const char *zTableName,     /* Table name */\r\n  const char *zColumnName,    /* Column name */\r\n  char const **pzDataType,    /* OUTPUT: Declared data type */\r\n  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */\r\n  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */\r\n  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */\r\n  int *pAutoinc               /* OUTPUT: True if column is auto-increment */\r\n){\r\n  int rc;\r\n  char *zErrMsg = 0;\r\n  Table *pTab = 0;\r\n  Column *pCol = 0;\r\n  int iCol;\r\n\r\n  char const *zDataType = 0;\r\n  char const *zCollSeq = 0;\r\n  int notnull = 0;\r\n  int primarykey = 0;\r\n  int autoinc = 0;\r\n\r\n  /* Ensure the database schema has been loaded */\r\n  sqlite3_mutex_enter(db->mutex);\r\n  sqlite3BtreeEnterAll(db);\r\n  rc = sqlite3Init(db, &zErrMsg);\r\n  if( SQLITE_OK!=rc ){\r\n    goto error_out;\r\n  }\r\n\r\n  /* Locate the table in question */\r\n  pTab = sqlite3FindTable(db, zTableName, zDbName);\r\n  if( !pTab || pTab->pSelect ){\r\n    pTab = 0;\r\n    goto error_out;\r\n  }\r\n\r\n  /* Find the column for which info is requested */\r\n  if( sqlite3IsRowid(zColumnName) ){\r\n    iCol = pTab->iPKey;\r\n    if( iCol>=0 ){\r\n      pCol = &pTab->aCol[iCol];\r\n    }\r\n  }else{\r\n    for(iCol=0; iCol<pTab->nCol; iCol++){\r\n      pCol = &pTab->aCol[iCol];\r\n      if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){\r\n        break;\r\n      }\r\n    }\r\n    if( iCol==pTab->nCol ){\r\n      pTab = 0;\r\n      goto error_out;\r\n    }\r\n  }\r\n\r\n  /* The following block stores the meta information that will be returned\r\n  ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey\r\n  ** and autoinc. At this point there are two possibilities:\r\n  ** \r\n  **     1. The specified column name was rowid\", \"oid\" or \"_rowid_\" \r\n  **        and there is no explicitly declared IPK column. \r\n  **\r\n  **     2. The table is not a view and the column name identified an \r\n  **        explicitly declared column. Copy meta information from *pCol.\r\n  */ \r\n  if( pCol ){\r\n    zDataType = pCol->zType;\r\n    zCollSeq = pCol->zColl;\r\n    notnull = pCol->notNull!=0;\r\n    primarykey  = pCol->isPrimKey!=0;\r\n    autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;\r\n  }else{\r\n    zDataType = \"INTEGER\";\r\n    primarykey = 1;\r\n  }\r\n  if( !zCollSeq ){\r\n    zCollSeq = \"BINARY\";\r\n  }\r\n\r\nerror_out:\r\n  sqlite3BtreeLeaveAll(db);\r\n\r\n  /* Whether the function call succeeded or failed, set the output parameters\r\n  ** to whatever their local counterparts contain. If an error did occur,\r\n  ** this has the effect of zeroing all output parameters.\r\n  */\r\n  if( pzDataType ) *pzDataType = zDataType;\r\n  if( pzCollSeq ) *pzCollSeq = zCollSeq;\r\n  if( pNotNull ) *pNotNull = notnull;\r\n  if( pPrimaryKey ) *pPrimaryKey = primarykey;\r\n  if( pAutoinc ) *pAutoinc = autoinc;\r\n\r\n  if( SQLITE_OK==rc && !pTab ){\r\n    sqlite3DbFree(db, zErrMsg);\r\n    zErrMsg = sqlite3MPrintf(db, \"no such table column: %s.%s\", zTableName,\r\n        zColumnName);\r\n    rc = SQLITE_ERROR;\r\n  }\r\n  sqlite3Error(db, rc, (zErrMsg?\"%s\":0), zErrMsg);\r\n  sqlite3DbFree(db, zErrMsg);\r\n  rc = sqlite3ApiExit(db, rc);\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n#endif\r\n\r\n/*\r\n** Sleep for a little while.  Return the amount of time slept.\r\n*/\r\nSQLITE_API int sqlite3_sleep(int ms){\r\n  sqlite3_vfs *pVfs;\r\n  int rc;\r\n  pVfs = sqlite3_vfs_find(0);\r\n  if( pVfs==0 ) return 0;\r\n\r\n  /* This function works in milliseconds, but the underlying OsSleep() \r\n  ** API uses microseconds. Hence the 1000's.\r\n  */\r\n  rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Enable or disable the extended result codes.\r\n*/\r\nSQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){\r\n  sqlite3_mutex_enter(db->mutex);\r\n  db->errMask = onoff ? 0xffffffff : 0xff;\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Invoke the xFileControl method on a particular database.\r\n*/\r\nSQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){\r\n  int rc = SQLITE_ERROR;\r\n  Btree *pBtree;\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n  pBtree = sqlite3DbNameToBtree(db, zDbName);\r\n  if( pBtree ){\r\n    Pager *pPager;\r\n    sqlite3_file *fd;\r\n    sqlite3BtreeEnter(pBtree);\r\n    pPager = sqlite3BtreePager(pBtree);\r\n    assert( pPager!=0 );\r\n    fd = sqlite3PagerFile(pPager);\r\n    assert( fd!=0 );\r\n    if( op==SQLITE_FCNTL_FILE_POINTER ){\r\n      *(sqlite3_file**)pArg = fd;\r\n      rc = SQLITE_OK;\r\n    }else if( fd->pMethods ){\r\n      rc = sqlite3OsFileControl(fd, op, pArg);\r\n    }else{\r\n      rc = SQLITE_NOTFOUND;\r\n    }\r\n    sqlite3BtreeLeave(pBtree);\r\n  }\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;   \r\n}\r\n\r\n/*\r\n** Interface to the testing logic.\r\n*/\r\nSQLITE_API int sqlite3_test_control(int op, ...){\r\n  int rc = 0;\r\n#ifndef SQLITE_OMIT_BUILTIN_TEST\r\n  va_list ap;\r\n  va_start(ap, op);\r\n  switch( op ){\r\n\r\n    /*\r\n    ** Save the current state of the PRNG.\r\n    */\r\n    case SQLITE_TESTCTRL_PRNG_SAVE: {\r\n      sqlite3PrngSaveState();\r\n      break;\r\n    }\r\n\r\n    /*\r\n    ** Restore the state of the PRNG to the last state saved using\r\n    ** PRNG_SAVE.  If PRNG_SAVE has never before been called, then\r\n    ** this verb acts like PRNG_RESET.\r\n    */\r\n    case SQLITE_TESTCTRL_PRNG_RESTORE: {\r\n      sqlite3PrngRestoreState();\r\n      break;\r\n    }\r\n\r\n    /*\r\n    ** Reset the PRNG back to its uninitialized state.  The next call\r\n    ** to sqlite3_randomness() will reseed the PRNG using a single call\r\n    ** to the xRandomness method of the default VFS.\r\n    */\r\n    case SQLITE_TESTCTRL_PRNG_RESET: {\r\n      sqlite3PrngResetState();\r\n      break;\r\n    }\r\n\r\n    /*\r\n    **  sqlite3_test_control(BITVEC_TEST, size, program)\r\n    **\r\n    ** Run a test against a Bitvec object of size.  The program argument\r\n    ** is an array of integers that defines the test.  Return -1 on a\r\n    ** memory allocation error, 0 on success, or non-zero for an error.\r\n    ** See the sqlite3BitvecBuiltinTest() for additional information.\r\n    */\r\n    case SQLITE_TESTCTRL_BITVEC_TEST: {\r\n      int sz = va_arg(ap, int);\r\n      int *aProg = va_arg(ap, int*);\r\n      rc = sqlite3BitvecBuiltinTest(sz, aProg);\r\n      break;\r\n    }\r\n\r\n    /*\r\n    **  sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd)\r\n    **\r\n    ** Register hooks to call to indicate which malloc() failures \r\n    ** are benign.\r\n    */\r\n    case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: {\r\n      typedef void (*void_function)(void);\r\n      void_function xBenignBegin;\r\n      void_function xBenignEnd;\r\n      xBenignBegin = va_arg(ap, void_function);\r\n      xBenignEnd = va_arg(ap, void_function);\r\n      sqlite3BenignMallocHooks(xBenignBegin, xBenignEnd);\r\n      break;\r\n    }\r\n\r\n    /*\r\n    **  sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X)\r\n    **\r\n    ** Set the PENDING byte to the value in the argument, if X>0.\r\n    ** Make no changes if X==0.  Return the value of the pending byte\r\n    ** as it existing before this routine was called.\r\n    **\r\n    ** IMPORTANT:  Changing the PENDING byte from 0x40000000 results in\r\n    ** an incompatible database file format.  Changing the PENDING byte\r\n    ** while any database connection is open results in undefined and\r\n    ** dileterious behavior.\r\n    */\r\n    case SQLITE_TESTCTRL_PENDING_BYTE: {\r\n      rc = PENDING_BYTE;\r\n#ifndef SQLITE_OMIT_WSD\r\n      {\r\n        unsigned int newVal = va_arg(ap, unsigned int);\r\n        if( newVal ) sqlite3PendingByte = newVal;\r\n      }\r\n#endif\r\n      break;\r\n    }\r\n\r\n    /*\r\n    **  sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X)\r\n    **\r\n    ** This action provides a run-time test to see whether or not\r\n    ** assert() was enabled at compile-time.  If X is true and assert()\r\n    ** is enabled, then the return value is true.  If X is true and\r\n    ** assert() is disabled, then the return value is zero.  If X is\r\n    ** false and assert() is enabled, then the assertion fires and the\r\n    ** process aborts.  If X is false and assert() is disabled, then the\r\n    ** return value is zero.\r\n    */\r\n    case SQLITE_TESTCTRL_ASSERT: {\r\n      volatile int x = 0;\r\n      assert( (x = va_arg(ap,int))!=0 );\r\n      rc = x;\r\n      break;\r\n    }\r\n\r\n\r\n    /*\r\n    **  sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X)\r\n    **\r\n    ** This action provides a run-time test to see how the ALWAYS and\r\n    ** NEVER macros were defined at compile-time.\r\n    **\r\n    ** The return value is ALWAYS(X).  \r\n    **\r\n    ** The recommended test is X==2.  If the return value is 2, that means\r\n    ** ALWAYS() and NEVER() are both no-op pass-through macros, which is the\r\n    ** default setting.  If the return value is 1, then ALWAYS() is either\r\n    ** hard-coded to true or else it asserts if its argument is false.\r\n    ** The first behavior (hard-coded to true) is the case if\r\n    ** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second\r\n    ** behavior (assert if the argument to ALWAYS() is false) is the case if\r\n    ** SQLITE_TESTCTRL_ASSERT shows that assert() is enabled.\r\n    **\r\n    ** The run-time test procedure might look something like this:\r\n    **\r\n    **    if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){\r\n    **      // ALWAYS() and NEVER() are no-op pass-through macros\r\n    **    }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){\r\n    **      // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false.\r\n    **    }else{\r\n    **      // ALWAYS(x) is a constant 1.  NEVER(x) is a constant 0.\r\n    **    }\r\n    */\r\n    case SQLITE_TESTCTRL_ALWAYS: {\r\n      int x = va_arg(ap,int);\r\n      rc = ALWAYS(x);\r\n      break;\r\n    }\r\n\r\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_RESERVE, sqlite3 *db, int N)\r\n    **\r\n    ** Set the nReserve size to N for the main database on the database\r\n    ** connection db.\r\n    */\r\n    case SQLITE_TESTCTRL_RESERVE: {\r\n      sqlite3 *db = va_arg(ap, sqlite3*);\r\n      int x = va_arg(ap,int);\r\n      sqlite3_mutex_enter(db->mutex);\r\n      sqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0);\r\n      sqlite3_mutex_leave(db->mutex);\r\n      break;\r\n    }\r\n\r\n    /*  sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N)\r\n    **\r\n    ** Enable or disable various optimizations for testing purposes.  The \r\n    ** argument N is a bitmask of optimizations to be disabled.  For normal\r\n    ** operation N should be 0.  The idea is that a test program (like the\r\n    ** SQL Logic Test or SLT test module) can run the same SQL multiple times\r\n    ** with various optimizations disabled to verify that the same answer\r\n    ** is obtained in every case.\r\n    */\r\n    case SQLITE_TESTCTRL_OPTIMIZATIONS: {\r\n      sqlite3 *db = va_arg(ap, sqlite3*);\r\n      int x = va_arg(ap,int);\r\n      db->flags = (x & SQLITE_OptMask) | (db->flags & ~SQLITE_OptMask);\r\n      break;\r\n    }\r\n\r\n#ifdef SQLITE_N_KEYWORD\r\n    /* sqlite3_test_control(SQLITE_TESTCTRL_ISKEYWORD, const char *zWord)\r\n    **\r\n    ** If zWord is a keyword recognized by the parser, then return the\r\n    ** number of keywords.  Or if zWord is not a keyword, return 0.\r\n    ** \r\n    ** This test feature is only available in the amalgamation since\r\n    ** the SQLITE_N_KEYWORD macro is not defined in this file if SQLite\r\n    ** is built using separate source files.\r\n    */\r\n    case SQLITE_TESTCTRL_ISKEYWORD: {\r\n      const char *zWord = va_arg(ap, const char*);\r\n      int n = sqlite3Strlen30(zWord);\r\n      rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0;\r\n      break;\r\n    }\r\n#endif \r\n\r\n    /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);\r\n    **\r\n    ** Pass pFree into sqlite3ScratchFree(). \r\n    ** If sz>0 then allocate a scratch buffer into pNew.  \r\n    */\r\n    case SQLITE_TESTCTRL_SCRATCHMALLOC: {\r\n      void *pFree, **ppNew;\r\n      int sz;\r\n      sz = va_arg(ap, int);\r\n      ppNew = va_arg(ap, void**);\r\n      pFree = va_arg(ap, void*);\r\n      if( sz ) *ppNew = sqlite3ScratchMalloc(sz);\r\n      sqlite3ScratchFree(pFree);\r\n      break;\r\n    }\r\n\r\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);\r\n    **\r\n    ** If parameter onoff is non-zero, configure the wrappers so that all\r\n    ** subsequent calls to localtime() and variants fail. If onoff is zero,\r\n    ** undo this setting.\r\n    */\r\n    case SQLITE_TESTCTRL_LOCALTIME_FAULT: {\r\n      sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int);\r\n      break;\r\n    }\r\n\r\n#if defined(SQLITE_ENABLE_TREE_EXPLAIN)\r\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT,\r\n    **                        sqlite3_stmt*,const char**);\r\n    **\r\n    ** If compiled with SQLITE_ENABLE_TREE_EXPLAIN, each sqlite3_stmt holds\r\n    ** a string that describes the optimized parse tree.  This test-control\r\n    ** returns a pointer to that string.\r\n    */\r\n    case SQLITE_TESTCTRL_EXPLAIN_STMT: {\r\n      sqlite3_stmt *pStmt = va_arg(ap, sqlite3_stmt*);\r\n      const char **pzRet = va_arg(ap, const char**);\r\n      *pzRet = sqlite3VdbeExplanation((Vdbe*)pStmt);\r\n      break;\r\n    }\r\n#endif\r\n\r\n  }\r\n  va_end(ap);\r\n#endif /* SQLITE_OMIT_BUILTIN_TEST */\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This is a utility routine, useful to VFS implementations, that checks\r\n** to see if a database file was a URI that contained a specific query \r\n** parameter, and if so obtains the value of the query parameter.\r\n**\r\n** The zFilename argument is the filename pointer passed into the xOpen()\r\n** method of a VFS implementation.  The zParam argument is the name of the\r\n** query parameter we seek.  This routine returns the value of the zParam\r\n** parameter if it exists.  If the parameter does not exist, this routine\r\n** returns a NULL pointer.\r\n*/\r\nSQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){\r\n  if( zFilename==0 ) return 0;\r\n  zFilename += sqlite3Strlen30(zFilename) + 1;\r\n  while( zFilename[0] ){\r\n    int x = strcmp(zFilename, zParam);\r\n    zFilename += sqlite3Strlen30(zFilename) + 1;\r\n    if( x==0 ) return zFilename;\r\n    zFilename += sqlite3Strlen30(zFilename) + 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return a boolean value for a query parameter.\r\n*/\r\nSQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){\r\n  const char *z = sqlite3_uri_parameter(zFilename, zParam);\r\n  bDflt = bDflt!=0;\r\n  return z ? sqlite3GetBoolean(z, bDflt) : bDflt;\r\n}\r\n\r\n/*\r\n** Return a 64-bit integer value for a query parameter.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_uri_int64(\r\n  const char *zFilename,    /* Filename as passed to xOpen */\r\n  const char *zParam,       /* URI parameter sought */\r\n  sqlite3_int64 bDflt       /* return if parameter is missing */\r\n){\r\n  const char *z = sqlite3_uri_parameter(zFilename, zParam);\r\n  sqlite3_int64 v;\r\n  if( z && sqlite3Atoi64(z, &v, sqlite3Strlen30(z), SQLITE_UTF8)==SQLITE_OK ){\r\n    bDflt = v;\r\n  }\r\n  return bDflt;\r\n}\r\n\r\n/*\r\n** Return the Btree pointer identified by zDbName.  Return NULL if not found.\r\n*/\r\nSQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){\r\n  int i;\r\n  for(i=0; i<db->nDb; i++){\r\n    if( db->aDb[i].pBt\r\n     && (zDbName==0 || sqlite3StrICmp(zDbName, db->aDb[i].zName)==0)\r\n    ){\r\n      return db->aDb[i].pBt;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Return the filename of the database associated with a database\r\n** connection.\r\n*/\r\nSQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){\r\n  Btree *pBt = sqlite3DbNameToBtree(db, zDbName);\r\n  return pBt ? sqlite3BtreeGetFilename(pBt) : 0;\r\n}\r\n\r\n/*\r\n** Return 1 if database is read-only or 0 if read/write.  Return -1 if\r\n** no such database exists.\r\n*/\r\nSQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){\r\n  Btree *pBt = sqlite3DbNameToBtree(db, zDbName);\r\n  return pBt ? sqlite3PagerIsreadonly(sqlite3BtreePager(pBt)) : -1;\r\n}\r\n\r\n/************** End of main.c ************************************************/\r\n/************** Begin file notify.c ******************************************/\r\n/*\r\n** 2009 March 3\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n**\r\n** This file contains the implementation of the sqlite3_unlock_notify()\r\n** API method and its associated functionality.\r\n*/\r\n\r\n/* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */\r\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\r\n\r\n/*\r\n** Public interfaces:\r\n**\r\n**   sqlite3ConnectionBlocked()\r\n**   sqlite3ConnectionUnlocked()\r\n**   sqlite3ConnectionClosed()\r\n**   sqlite3_unlock_notify()\r\n*/\r\n\r\n#define assertMutexHeld() \\\r\n  assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) )\r\n\r\n/*\r\n** Head of a linked list of all sqlite3 objects created by this process\r\n** for which either sqlite3.pBlockingConnection or sqlite3.pUnlockConnection\r\n** is not NULL. This variable may only accessed while the STATIC_MASTER\r\n** mutex is held.\r\n*/\r\nstatic sqlite3 *SQLITE_WSD sqlite3BlockedList = 0;\r\n\r\n#ifndef NDEBUG\r\n/*\r\n** This function is a complex assert() that verifies the following \r\n** properties of the blocked connections list:\r\n**\r\n**   1) Each entry in the list has a non-NULL value for either \r\n**      pUnlockConnection or pBlockingConnection, or both.\r\n**\r\n**   2) All entries in the list that share a common value for \r\n**      xUnlockNotify are grouped together.\r\n**\r\n**   3) If the argument db is not NULL, then none of the entries in the\r\n**      blocked connections list have pUnlockConnection or pBlockingConnection\r\n**      set to db. This is used when closing connection db.\r\n*/\r\nstatic void checkListProperties(sqlite3 *db){\r\n  sqlite3 *p;\r\n  for(p=sqlite3BlockedList; p; p=p->pNextBlocked){\r\n    int seen = 0;\r\n    sqlite3 *p2;\r\n\r\n    /* Verify property (1) */\r\n    assert( p->pUnlockConnection || p->pBlockingConnection );\r\n\r\n    /* Verify property (2) */\r\n    for(p2=sqlite3BlockedList; p2!=p; p2=p2->pNextBlocked){\r\n      if( p2->xUnlockNotify==p->xUnlockNotify ) seen = 1;\r\n      assert( p2->xUnlockNotify==p->xUnlockNotify || !seen );\r\n      assert( db==0 || p->pUnlockConnection!=db );\r\n      assert( db==0 || p->pBlockingConnection!=db );\r\n    }\r\n  }\r\n}\r\n#else\r\n# define checkListProperties(x)\r\n#endif\r\n\r\n/*\r\n** Remove connection db from the blocked connections list. If connection\r\n** db is not currently a part of the list, this function is a no-op.\r\n*/\r\nstatic void removeFromBlockedList(sqlite3 *db){\r\n  sqlite3 **pp;\r\n  assertMutexHeld();\r\n  for(pp=&sqlite3BlockedList; *pp; pp = &(*pp)->pNextBlocked){\r\n    if( *pp==db ){\r\n      *pp = (*pp)->pNextBlocked;\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Add connection db to the blocked connections list. It is assumed\r\n** that it is not already a part of the list.\r\n*/\r\nstatic void addToBlockedList(sqlite3 *db){\r\n  sqlite3 **pp;\r\n  assertMutexHeld();\r\n  for(\r\n    pp=&sqlite3BlockedList; \r\n    *pp && (*pp)->xUnlockNotify!=db->xUnlockNotify; \r\n    pp=&(*pp)->pNextBlocked\r\n  );\r\n  db->pNextBlocked = *pp;\r\n  *pp = db;\r\n}\r\n\r\n/*\r\n** Obtain the STATIC_MASTER mutex.\r\n*/\r\nstatic void enterMutex(void){\r\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n  checkListProperties(0);\r\n}\r\n\r\n/*\r\n** Release the STATIC_MASTER mutex.\r\n*/\r\nstatic void leaveMutex(void){\r\n  assertMutexHeld();\r\n  checkListProperties(0);\r\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\r\n}\r\n\r\n/*\r\n** Register an unlock-notify callback.\r\n**\r\n** This is called after connection \"db\" has attempted some operation\r\n** but has received an SQLITE_LOCKED error because another connection\r\n** (call it pOther) in the same process was busy using the same shared\r\n** cache.  pOther is found by looking at db->pBlockingConnection.\r\n**\r\n** If there is no blocking connection, the callback is invoked immediately,\r\n** before this routine returns.\r\n**\r\n** If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate\r\n** a deadlock.\r\n**\r\n** Otherwise, make arrangements to invoke xNotify when pOther drops\r\n** its locks.\r\n**\r\n** Each call to this routine overrides any prior callbacks registered\r\n** on the same \"db\".  If xNotify==0 then any prior callbacks are immediately\r\n** cancelled.\r\n*/\r\nSQLITE_API int sqlite3_unlock_notify(\r\n  sqlite3 *db,\r\n  void (*xNotify)(void **, int),\r\n  void *pArg\r\n){\r\n  int rc = SQLITE_OK;\r\n\r\n  sqlite3_mutex_enter(db->mutex);\r\n  enterMutex();\r\n\r\n  if( xNotify==0 ){\r\n    removeFromBlockedList(db);\r\n    db->pBlockingConnection = 0;\r\n    db->pUnlockConnection = 0;\r\n    db->xUnlockNotify = 0;\r\n    db->pUnlockArg = 0;\r\n  }else if( 0==db->pBlockingConnection ){\r\n    /* The blocking transaction has been concluded. Or there never was a \r\n    ** blocking transaction. In either case, invoke the notify callback\r\n    ** immediately. \r\n    */\r\n    xNotify(&pArg, 1);\r\n  }else{\r\n    sqlite3 *p;\r\n\r\n    for(p=db->pBlockingConnection; p && p!=db; p=p->pUnlockConnection){}\r\n    if( p ){\r\n      rc = SQLITE_LOCKED;              /* Deadlock detected. */\r\n    }else{\r\n      db->pUnlockConnection = db->pBlockingConnection;\r\n      db->xUnlockNotify = xNotify;\r\n      db->pUnlockArg = pArg;\r\n      removeFromBlockedList(db);\r\n      addToBlockedList(db);\r\n    }\r\n  }\r\n\r\n  leaveMutex();\r\n  assert( !db->mallocFailed );\r\n  sqlite3Error(db, rc, (rc?\"database is deadlocked\":0));\r\n  sqlite3_mutex_leave(db->mutex);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called while stepping or preparing a statement \r\n** associated with connection db. The operation will return SQLITE_LOCKED\r\n** to the user because it requires a lock that will not be available\r\n** until connection pBlocker concludes its current transaction.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){\r\n  enterMutex();\r\n  if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){\r\n    addToBlockedList(db);\r\n  }\r\n  db->pBlockingConnection = pBlocker;\r\n  leaveMutex();\r\n}\r\n\r\n/*\r\n** This function is called when\r\n** the transaction opened by database db has just finished. Locks held \r\n** by database connection db have been released.\r\n**\r\n** This function loops through each entry in the blocked connections\r\n** list and does the following:\r\n**\r\n**   1) If the sqlite3.pBlockingConnection member of a list entry is\r\n**      set to db, then set pBlockingConnection=0.\r\n**\r\n**   2) If the sqlite3.pUnlockConnection member of a list entry is\r\n**      set to db, then invoke the configured unlock-notify callback and\r\n**      set pUnlockConnection=0.\r\n**\r\n**   3) If the two steps above mean that pBlockingConnection==0 and\r\n**      pUnlockConnection==0, remove the entry from the blocked connections\r\n**      list.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){\r\n  void (*xUnlockNotify)(void **, int) = 0; /* Unlock-notify cb to invoke */\r\n  int nArg = 0;                            /* Number of entries in aArg[] */\r\n  sqlite3 **pp;                            /* Iterator variable */\r\n  void **aArg;               /* Arguments to the unlock callback */\r\n  void **aDyn = 0;           /* Dynamically allocated space for aArg[] */\r\n  void *aStatic[16];         /* Starter space for aArg[].  No malloc required */\r\n\r\n  aArg = aStatic;\r\n  enterMutex();         /* Enter STATIC_MASTER mutex */\r\n\r\n  /* This loop runs once for each entry in the blocked-connections list. */\r\n  for(pp=&sqlite3BlockedList; *pp; /* no-op */ ){\r\n    sqlite3 *p = *pp;\r\n\r\n    /* Step 1. */\r\n    if( p->pBlockingConnection==db ){\r\n      p->pBlockingConnection = 0;\r\n    }\r\n\r\n    /* Step 2. */\r\n    if( p->pUnlockConnection==db ){\r\n      assert( p->xUnlockNotify );\r\n      if( p->xUnlockNotify!=xUnlockNotify && nArg!=0 ){\r\n        xUnlockNotify(aArg, nArg);\r\n        nArg = 0;\r\n      }\r\n\r\n      sqlite3BeginBenignMalloc();\r\n      assert( aArg==aDyn || (aDyn==0 && aArg==aStatic) );\r\n      assert( nArg<=(int)ArraySize(aStatic) || aArg==aDyn );\r\n      if( (!aDyn && nArg==(int)ArraySize(aStatic))\r\n       || (aDyn && nArg==(int)(sqlite3MallocSize(aDyn)/sizeof(void*)))\r\n      ){\r\n        /* The aArg[] array needs to grow. */\r\n        void **pNew = (void **)sqlite3Malloc(nArg*sizeof(void *)*2);\r\n        if( pNew ){\r\n          memcpy(pNew, aArg, nArg*sizeof(void *));\r\n          sqlite3_free(aDyn);\r\n          aDyn = aArg = pNew;\r\n        }else{\r\n          /* This occurs when the array of context pointers that need to\r\n          ** be passed to the unlock-notify callback is larger than the\r\n          ** aStatic[] array allocated on the stack and the attempt to \r\n          ** allocate a larger array from the heap has failed.\r\n          **\r\n          ** This is a difficult situation to handle. Returning an error\r\n          ** code to the caller is insufficient, as even if an error code\r\n          ** is returned the transaction on connection db will still be\r\n          ** closed and the unlock-notify callbacks on blocked connections\r\n          ** will go unissued. This might cause the application to wait\r\n          ** indefinitely for an unlock-notify callback that will never \r\n          ** arrive.\r\n          **\r\n          ** Instead, invoke the unlock-notify callback with the context\r\n          ** array already accumulated. We can then clear the array and\r\n          ** begin accumulating any further context pointers without \r\n          ** requiring any dynamic allocation. This is sub-optimal because\r\n          ** it means that instead of one callback with a large array of\r\n          ** context pointers the application will receive two or more\r\n          ** callbacks with smaller arrays of context pointers, which will\r\n          ** reduce the applications ability to prioritize multiple \r\n          ** connections. But it is the best that can be done under the\r\n          ** circumstances.\r\n          */\r\n          xUnlockNotify(aArg, nArg);\r\n          nArg = 0;\r\n        }\r\n      }\r\n      sqlite3EndBenignMalloc();\r\n\r\n      aArg[nArg++] = p->pUnlockArg;\r\n      xUnlockNotify = p->xUnlockNotify;\r\n      p->pUnlockConnection = 0;\r\n      p->xUnlockNotify = 0;\r\n      p->pUnlockArg = 0;\r\n    }\r\n\r\n    /* Step 3. */\r\n    if( p->pBlockingConnection==0 && p->pUnlockConnection==0 ){\r\n      /* Remove connection p from the blocked connections list. */\r\n      *pp = p->pNextBlocked;\r\n      p->pNextBlocked = 0;\r\n    }else{\r\n      pp = &p->pNextBlocked;\r\n    }\r\n  }\r\n\r\n  if( nArg!=0 ){\r\n    xUnlockNotify(aArg, nArg);\r\n  }\r\n  sqlite3_free(aDyn);\r\n  leaveMutex();         /* Leave STATIC_MASTER mutex */\r\n}\r\n\r\n/*\r\n** This is called when the database connection passed as an argument is \r\n** being closed. The connection is removed from the blocked list.\r\n*/\r\nSQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db){\r\n  sqlite3ConnectionUnlocked(db);\r\n  enterMutex();\r\n  removeFromBlockedList(db);\r\n  checkListProperties(db);\r\n  leaveMutex();\r\n}\r\n#endif\r\n\r\n/************** End of notify.c **********************************************/\r\n/************** Begin file fts3.c ********************************************/\r\n/*\r\n** 2006 Oct 10\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This is an SQLite module implementing full-text search.\r\n*/\r\n\r\n/*\r\n** The code in this file is only compiled if:\r\n**\r\n**     * The FTS3 module is being built as an extension\r\n**       (in which case SQLITE_CORE is not defined), or\r\n**\r\n**     * The FTS3 module is being built into the core of\r\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\r\n*/\r\n\r\n/* The full-text index is stored in a series of b+tree (-like)\r\n** structures called segments which map terms to doclists.  The\r\n** structures are like b+trees in layout, but are constructed from the\r\n** bottom up in optimal fashion and are not updatable.  Since trees\r\n** are built from the bottom up, things will be described from the\r\n** bottom up.\r\n**\r\n**\r\n**** Varints ****\r\n** The basic unit of encoding is a variable-length integer called a\r\n** varint.  We encode variable-length integers in little-endian order\r\n** using seven bits * per byte as follows:\r\n**\r\n** KEY:\r\n**         A = 0xxxxxxx    7 bits of data and one flag bit\r\n**         B = 1xxxxxxx    7 bits of data and one flag bit\r\n**\r\n**  7 bits - A\r\n** 14 bits - BA\r\n** 21 bits - BBA\r\n** and so on.\r\n**\r\n** This is similar in concept to how sqlite encodes \"varints\" but\r\n** the encoding is not the same.  SQLite varints are big-endian\r\n** are are limited to 9 bytes in length whereas FTS3 varints are\r\n** little-endian and can be up to 10 bytes in length (in theory).\r\n**\r\n** Example encodings:\r\n**\r\n**     1:    0x01\r\n**   127:    0x7f\r\n**   128:    0x81 0x00\r\n**\r\n**\r\n**** Document lists ****\r\n** A doclist (document list) holds a docid-sorted list of hits for a\r\n** given term.  Doclists hold docids and associated token positions.\r\n** A docid is the unique integer identifier for a single document.\r\n** A position is the index of a word within the document.  The first \r\n** word of the document has a position of 0.\r\n**\r\n** FTS3 used to optionally store character offsets using a compile-time\r\n** option.  But that functionality is no longer supported.\r\n**\r\n** A doclist is stored like this:\r\n**\r\n** array {\r\n**   varint docid;\r\n**   array {                (position list for column 0)\r\n**     varint position;     (2 more than the delta from previous position)\r\n**   }\r\n**   array {\r\n**     varint POS_COLUMN;   (marks start of position list for new column)\r\n**     varint column;       (index of new column)\r\n**     array {\r\n**       varint position;   (2 more than the delta from previous position)\r\n**     }\r\n**   }\r\n**   varint POS_END;        (marks end of positions for this document.\r\n** }\r\n**\r\n** Here, array { X } means zero or more occurrences of X, adjacent in\r\n** memory.  A \"position\" is an index of a token in the token stream\r\n** generated by the tokenizer. Note that POS_END and POS_COLUMN occur \r\n** in the same logical place as the position element, and act as sentinals\r\n** ending a position list array.  POS_END is 0.  POS_COLUMN is 1.\r\n** The positions numbers are not stored literally but rather as two more\r\n** than the difference from the prior position, or the just the position plus\r\n** 2 for the first position.  Example:\r\n**\r\n**   label:       A B C D E  F  G H   I  J K\r\n**   value:     123 5 9 1 1 14 35 0 234 72 0\r\n**\r\n** The 123 value is the first docid.  For column zero in this document\r\n** there are two matches at positions 3 and 10 (5-2 and 9-2+3).  The 1\r\n** at D signals the start of a new column; the 1 at E indicates that the\r\n** new column is column number 1.  There are two positions at 12 and 45\r\n** (14-2 and 35-2+12).  The 0 at H indicate the end-of-document.  The\r\n** 234 at I is the next docid.  It has one position 72 (72-2) and then\r\n** terminates with the 0 at K.\r\n**\r\n** A \"position-list\" is the list of positions for multiple columns for\r\n** a single docid.  A \"column-list\" is the set of positions for a single\r\n** column.  Hence, a position-list consists of one or more column-lists,\r\n** a document record consists of a docid followed by a position-list and\r\n** a doclist consists of one or more document records.\r\n**\r\n** A bare doclist omits the position information, becoming an \r\n** array of varint-encoded docids.\r\n**\r\n**** Segment leaf nodes ****\r\n** Segment leaf nodes store terms and doclists, ordered by term.  Leaf\r\n** nodes are written using LeafWriter, and read using LeafReader (to\r\n** iterate through a single leaf node's data) and LeavesReader (to\r\n** iterate through a segment's entire leaf layer).  Leaf nodes have\r\n** the format:\r\n**\r\n** varint iHeight;             (height from leaf level, always 0)\r\n** varint nTerm;               (length of first term)\r\n** char pTerm[nTerm];          (content of first term)\r\n** varint nDoclist;            (length of term's associated doclist)\r\n** char pDoclist[nDoclist];    (content of doclist)\r\n** array {\r\n**                             (further terms are delta-encoded)\r\n**   varint nPrefix;           (length of prefix shared with previous term)\r\n**   varint nSuffix;           (length of unshared suffix)\r\n**   char pTermSuffix[nSuffix];(unshared suffix of next term)\r\n**   varint nDoclist;          (length of term's associated doclist)\r\n**   char pDoclist[nDoclist];  (content of doclist)\r\n** }\r\n**\r\n** Here, array { X } means zero or more occurrences of X, adjacent in\r\n** memory.\r\n**\r\n** Leaf nodes are broken into blocks which are stored contiguously in\r\n** the %_segments table in sorted order.  This means that when the end\r\n** of a node is reached, the next term is in the node with the next\r\n** greater node id.\r\n**\r\n** New data is spilled to a new leaf node when the current node\r\n** exceeds LEAF_MAX bytes (default 2048).  New data which itself is\r\n** larger than STANDALONE_MIN (default 1024) is placed in a standalone\r\n** node (a leaf node with a single term and doclist).  The goal of\r\n** these settings is to pack together groups of small doclists while\r\n** making it efficient to directly access large doclists.  The\r\n** assumption is that large doclists represent terms which are more\r\n** likely to be query targets.\r\n**\r\n** TODO(shess) It may be useful for blocking decisions to be more\r\n** dynamic.  For instance, it may make more sense to have a 2.5k leaf\r\n** node rather than splitting into 2k and .5k nodes.  My intuition is\r\n** that this might extend through 2x or 4x the pagesize.\r\n**\r\n**\r\n**** Segment interior nodes ****\r\n** Segment interior nodes store blockids for subtree nodes and terms\r\n** to describe what data is stored by the each subtree.  Interior\r\n** nodes are written using InteriorWriter, and read using\r\n** InteriorReader.  InteriorWriters are created as needed when\r\n** SegmentWriter creates new leaf nodes, or when an interior node\r\n** itself grows too big and must be split.  The format of interior\r\n** nodes:\r\n**\r\n** varint iHeight;           (height from leaf level, always >0)\r\n** varint iBlockid;          (block id of node's leftmost subtree)\r\n** optional {\r\n**   varint nTerm;           (length of first term)\r\n**   char pTerm[nTerm];      (content of first term)\r\n**   array {\r\n**                                (further terms are delta-encoded)\r\n**     varint nPrefix;            (length of shared prefix with previous term)\r\n**     varint nSuffix;            (length of unshared suffix)\r\n**     char pTermSuffix[nSuffix]; (unshared suffix of next term)\r\n**   }\r\n** }\r\n**\r\n** Here, optional { X } means an optional element, while array { X }\r\n** means zero or more occurrences of X, adjacent in memory.\r\n**\r\n** An interior node encodes n terms separating n+1 subtrees.  The\r\n** subtree blocks are contiguous, so only the first subtree's blockid\r\n** is encoded.  The subtree at iBlockid will contain all terms less\r\n** than the first term encoded (or all terms if no term is encoded).\r\n** Otherwise, for terms greater than or equal to pTerm[i] but less\r\n** than pTerm[i+1], the subtree for that term will be rooted at\r\n** iBlockid+i.  Interior nodes only store enough term data to\r\n** distinguish adjacent children (if the rightmost term of the left\r\n** child is \"something\", and the leftmost term of the right child is\r\n** \"wicked\", only \"w\" is stored).\r\n**\r\n** New data is spilled to a new interior node at the same height when\r\n** the current node exceeds INTERIOR_MAX bytes (default 2048).\r\n** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing\r\n** interior nodes and making the tree too skinny.  The interior nodes\r\n** at a given height are naturally tracked by interior nodes at\r\n** height+1, and so on.\r\n**\r\n**\r\n**** Segment directory ****\r\n** The segment directory in table %_segdir stores meta-information for\r\n** merging and deleting segments, and also the root node of the\r\n** segment's tree.\r\n**\r\n** The root node is the top node of the segment's tree after encoding\r\n** the entire segment, restricted to ROOT_MAX bytes (default 1024).\r\n** This could be either a leaf node or an interior node.  If the top\r\n** node requires more than ROOT_MAX bytes, it is flushed to %_segments\r\n** and a new root interior node is generated (which should always fit\r\n** within ROOT_MAX because it only needs space for 2 varints, the\r\n** height and the blockid of the previous root).\r\n**\r\n** The meta-information in the segment directory is:\r\n**   level               - segment level (see below)\r\n**   idx                 - index within level\r\n**                       - (level,idx uniquely identify a segment)\r\n**   start_block         - first leaf node\r\n**   leaves_end_block    - last leaf node\r\n**   end_block           - last block (including interior nodes)\r\n**   root                - contents of root node\r\n**\r\n** If the root node is a leaf node, then start_block,\r\n** leaves_end_block, and end_block are all 0.\r\n**\r\n**\r\n**** Segment merging ****\r\n** To amortize update costs, segments are grouped into levels and\r\n** merged in batches.  Each increase in level represents exponentially\r\n** more documents.\r\n**\r\n** New documents (actually, document updates) are tokenized and\r\n** written individually (using LeafWriter) to a level 0 segment, with\r\n** incrementing idx.  When idx reaches MERGE_COUNT (default 16), all\r\n** level 0 segments are merged into a single level 1 segment.  Level 1\r\n** is populated like level 0, and eventually MERGE_COUNT level 1\r\n** segments are merged to a single level 2 segment (representing\r\n** MERGE_COUNT^2 updates), and so on.\r\n**\r\n** A segment merge traverses all segments at a given level in\r\n** parallel, performing a straightforward sorted merge.  Since segment\r\n** leaf nodes are written in to the %_segments table in order, this\r\n** merge traverses the underlying sqlite disk structures efficiently.\r\n** After the merge, all segment blocks from the merged level are\r\n** deleted.\r\n**\r\n** MERGE_COUNT controls how often we merge segments.  16 seems to be\r\n** somewhat of a sweet spot for insertion performance.  32 and 64 show\r\n** very similar performance numbers to 16 on insertion, though they're\r\n** a tiny bit slower (perhaps due to more overhead in merge-time\r\n** sorting).  8 is about 20% slower than 16, 4 about 50% slower than\r\n** 16, 2 about 66% slower than 16.\r\n**\r\n** At query time, high MERGE_COUNT increases the number of segments\r\n** which need to be scanned and merged.  For instance, with 100k docs\r\n** inserted:\r\n**\r\n**    MERGE_COUNT   segments\r\n**       16           25\r\n**        8           12\r\n**        4           10\r\n**        2            6\r\n**\r\n** This appears to have only a moderate impact on queries for very\r\n** frequent terms (which are somewhat dominated by segment merge\r\n** costs), and infrequent and non-existent terms still seem to be fast\r\n** even with many segments.\r\n**\r\n** TODO(shess) That said, it would be nice to have a better query-side\r\n** argument for MERGE_COUNT of 16.  Also, it is possible/likely that\r\n** optimizations to things like doclist merging will swing the sweet\r\n** spot around.\r\n**\r\n**\r\n**\r\n**** Handling of deletions and updates ****\r\n** Since we're using a segmented structure, with no docid-oriented\r\n** index into the term index, we clearly cannot simply update the term\r\n** index when a document is deleted or updated.  For deletions, we\r\n** write an empty doclist (varint(docid) varint(POS_END)), for updates\r\n** we simply write the new doclist.  Segment merges overwrite older\r\n** data for a particular docid with newer data, so deletes or updates\r\n** will eventually overtake the earlier data and knock it out.  The\r\n** query logic likewise merges doclists so that newer data knocks out\r\n** older data.\r\n*/\r\n\r\n/************** Include fts3Int.h in the middle of fts3.c ********************/\r\n/************** Begin file fts3Int.h *****************************************/\r\n/*\r\n** 2009 Nov 12\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n*/\r\n#ifndef _FTSINT_H\r\n#define _FTSINT_H\r\n\r\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \r\n# define NDEBUG 1\r\n#endif\r\n\r\n/*\r\n** FTS4 is really an extension for FTS3.  It is enabled using the\r\n** SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also all\r\n** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.\r\n*/\r\n#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)\r\n# define SQLITE_ENABLE_FTS3\r\n#endif\r\n\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* If not building as part of the core, include sqlite3ext.h. */\r\n#ifndef SQLITE_CORE\r\nSQLITE_API extern const sqlite3_api_routines *sqlite3_api;\r\n#endif\r\n\r\n/************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/\r\n/************** Begin file fts3_tokenizer.h **********************************/\r\n/*\r\n** 2006 July 10\r\n**\r\n** The author disclaims copyright to this source code.\r\n**\r\n*************************************************************************\r\n** Defines the interface to tokenizers used by fulltext-search.  There\r\n** are three basic components:\r\n**\r\n** sqlite3_tokenizer_module is a singleton defining the tokenizer\r\n** interface functions.  This is essentially the class structure for\r\n** tokenizers.\r\n**\r\n** sqlite3_tokenizer is used to define a particular tokenizer, perhaps\r\n** including customization information defined at creation time.\r\n**\r\n** sqlite3_tokenizer_cursor is generated by a tokenizer to generate\r\n** tokens from a particular input.\r\n*/\r\n#ifndef _FTS3_TOKENIZER_H_\r\n#define _FTS3_TOKENIZER_H_\r\n\r\n/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.\r\n** If tokenizers are to be allowed to call sqlite3_*() functions, then\r\n** we will need a way to register the API consistently.\r\n*/\r\n\r\n/*\r\n** Structures used by the tokenizer interface. When a new tokenizer\r\n** implementation is registered, the caller provides a pointer to\r\n** an sqlite3_tokenizer_module containing pointers to the callback\r\n** functions that make up an implementation.\r\n**\r\n** When an fts3 table is created, it passes any arguments passed to\r\n** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the\r\n** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer\r\n** implementation. The xCreate() function in turn returns an \r\n** sqlite3_tokenizer structure representing the specific tokenizer to\r\n** be used for the fts3 table (customized by the tokenizer clause arguments).\r\n**\r\n** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen()\r\n** method is called. It returns an sqlite3_tokenizer_cursor object\r\n** that may be used to tokenize a specific input buffer based on\r\n** the tokenization rules supplied by a specific sqlite3_tokenizer\r\n** object.\r\n*/\r\ntypedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module;\r\ntypedef struct sqlite3_tokenizer sqlite3_tokenizer;\r\ntypedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor;\r\n\r\nstruct sqlite3_tokenizer_module {\r\n\r\n  /*\r\n  ** Structure version. Should always be set to 0 or 1.\r\n  */\r\n  int iVersion;\r\n\r\n  /*\r\n  ** Create a new tokenizer. The values in the argv[] array are the\r\n  ** arguments passed to the \"tokenizer\" clause of the CREATE VIRTUAL\r\n  ** TABLE statement that created the fts3 table. For example, if\r\n  ** the following SQL is executed:\r\n  **\r\n  **   CREATE .. USING fts3( ... , tokenizer <tokenizer-name> arg1 arg2)\r\n  **\r\n  ** then argc is set to 2, and the argv[] array contains pointers\r\n  ** to the strings \"arg1\" and \"arg2\".\r\n  **\r\n  ** This method should return either SQLITE_OK (0), or an SQLite error \r\n  ** code. If SQLITE_OK is returned, then *ppTokenizer should be set\r\n  ** to point at the newly created tokenizer structure. The generic\r\n  ** sqlite3_tokenizer.pModule variable should not be initialised by\r\n  ** this callback. The caller will do so.\r\n  */\r\n  int (*xCreate)(\r\n    int argc,                           /* Size of argv array */\r\n    const char *const*argv,             /* Tokenizer argument strings */\r\n    sqlite3_tokenizer **ppTokenizer     /* OUT: Created tokenizer */\r\n  );\r\n\r\n  /*\r\n  ** Destroy an existing tokenizer. The fts3 module calls this method\r\n  ** exactly once for each successful call to xCreate().\r\n  */\r\n  int (*xDestroy)(sqlite3_tokenizer *pTokenizer);\r\n\r\n  /*\r\n  ** Create a tokenizer cursor to tokenize an input buffer. The caller\r\n  ** is responsible for ensuring that the input buffer remains valid\r\n  ** until the cursor is closed (using the xClose() method). \r\n  */\r\n  int (*xOpen)(\r\n    sqlite3_tokenizer *pTokenizer,       /* Tokenizer object */\r\n    const char *pInput, int nBytes,      /* Input buffer */\r\n    sqlite3_tokenizer_cursor **ppCursor  /* OUT: Created tokenizer cursor */\r\n  );\r\n\r\n  /*\r\n  ** Destroy an existing tokenizer cursor. The fts3 module calls this \r\n  ** method exactly once for each successful call to xOpen().\r\n  */\r\n  int (*xClose)(sqlite3_tokenizer_cursor *pCursor);\r\n\r\n  /*\r\n  ** Retrieve the next token from the tokenizer cursor pCursor. This\r\n  ** method should either return SQLITE_OK and set the values of the\r\n  ** \"OUT\" variables identified below, or SQLITE_DONE to indicate that\r\n  ** the end of the buffer has been reached, or an SQLite error code.\r\n  **\r\n  ** *ppToken should be set to point at a buffer containing the \r\n  ** normalized version of the token (i.e. after any case-folding and/or\r\n  ** stemming has been performed). *pnBytes should be set to the length\r\n  ** of this buffer in bytes. The input text that generated the token is\r\n  ** identified by the byte offsets returned in *piStartOffset and\r\n  ** *piEndOffset. *piStartOffset should be set to the index of the first\r\n  ** byte of the token in the input buffer. *piEndOffset should be set\r\n  ** to the index of the first byte just past the end of the token in\r\n  ** the input buffer.\r\n  **\r\n  ** The buffer *ppToken is set to point at is managed by the tokenizer\r\n  ** implementation. It is only required to be valid until the next call\r\n  ** to xNext() or xClose(). \r\n  */\r\n  /* TODO(shess) current implementation requires pInput to be\r\n  ** nul-terminated.  This should either be fixed, or pInput/nBytes\r\n  ** should be converted to zInput.\r\n  */\r\n  int (*xNext)(\r\n    sqlite3_tokenizer_cursor *pCursor,   /* Tokenizer cursor */\r\n    const char **ppToken, int *pnBytes,  /* OUT: Normalized text for token */\r\n    int *piStartOffset,  /* OUT: Byte offset of token in input buffer */\r\n    int *piEndOffset,    /* OUT: Byte offset of end of token in input buffer */\r\n    int *piPosition      /* OUT: Number of tokens returned before this one */\r\n  );\r\n\r\n  /***********************************************************************\r\n  ** Methods below this point are only available if iVersion>=1.\r\n  */\r\n\r\n  /* \r\n  ** Configure the language id of a tokenizer cursor.\r\n  */\r\n  int (*xLanguageid)(sqlite3_tokenizer_cursor *pCsr, int iLangid);\r\n};\r\n\r\nstruct sqlite3_tokenizer {\r\n  const sqlite3_tokenizer_module *pModule;  /* The module for this tokenizer */\r\n  /* Tokenizer implementations will typically add additional fields */\r\n};\r\n\r\nstruct sqlite3_tokenizer_cursor {\r\n  sqlite3_tokenizer *pTokenizer;       /* Tokenizer for this cursor. */\r\n  /* Tokenizer implementations will typically add additional fields */\r\n};\r\n\r\nint fts3_global_term_cnt(int iTerm, int iCol);\r\nint fts3_term_cnt(int iTerm, int iCol);\r\n\r\n\r\n#endif /* _FTS3_TOKENIZER_H_ */\r\n\r\n/************** End of fts3_tokenizer.h **************************************/\r\n/************** Continuing where we left off in fts3Int.h ********************/\r\n/************** Include fts3_hash.h in the middle of fts3Int.h ***************/\r\n/************** Begin file fts3_hash.h ***************************************/\r\n/*\r\n** 2001 September 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This is the header file for the generic hash-table implemenation\r\n** used in SQLite.  We've modified it slightly to serve as a standalone\r\n** hash table implementation for the full-text indexing module.\r\n**\r\n*/\r\n#ifndef _FTS3_HASH_H_\r\n#define _FTS3_HASH_H_\r\n\r\n/* Forward declarations of structures. */\r\ntypedef struct Fts3Hash Fts3Hash;\r\ntypedef struct Fts3HashElem Fts3HashElem;\r\n\r\n/* A complete hash table is an instance of the following structure.\r\n** The internals of this structure are intended to be opaque -- client\r\n** code should not attempt to access or modify the fields of this structure\r\n** directly.  Change this structure only by using the routines below.\r\n** However, many of the \"procedures\" and \"functions\" for modifying and\r\n** accessing this structure are really macros, so we can't really make\r\n** this structure opaque.\r\n*/\r\nstruct Fts3Hash {\r\n  char keyClass;          /* HASH_INT, _POINTER, _STRING, _BINARY */\r\n  char copyKey;           /* True if copy of key made on insert */\r\n  int count;              /* Number of entries in this table */\r\n  Fts3HashElem *first;    /* The first element of the array */\r\n  int htsize;             /* Number of buckets in the hash table */\r\n  struct _fts3ht {        /* the hash table */\r\n    int count;               /* Number of entries with this hash */\r\n    Fts3HashElem *chain;     /* Pointer to first entry with this hash */\r\n  } *ht;\r\n};\r\n\r\n/* Each element in the hash table is an instance of the following \r\n** structure.  All elements are stored on a single doubly-linked list.\r\n**\r\n** Again, this structure is intended to be opaque, but it can't really\r\n** be opaque because it is used by macros.\r\n*/\r\nstruct Fts3HashElem {\r\n  Fts3HashElem *next, *prev; /* Next and previous elements in the table */\r\n  void *data;                /* Data associated with this element */\r\n  void *pKey; int nKey;      /* Key associated with this element */\r\n};\r\n\r\n/*\r\n** There are 2 different modes of operation for a hash table:\r\n**\r\n**   FTS3_HASH_STRING        pKey points to a string that is nKey bytes long\r\n**                           (including the null-terminator, if any).  Case\r\n**                           is respected in comparisons.\r\n**\r\n**   FTS3_HASH_BINARY        pKey points to binary data nKey bytes long. \r\n**                           memcmp() is used to compare keys.\r\n**\r\n** A copy of the key is made if the copyKey parameter to fts3HashInit is 1.  \r\n*/\r\n#define FTS3_HASH_STRING    1\r\n#define FTS3_HASH_BINARY    2\r\n\r\n/*\r\n** Access routines.  To delete, insert a NULL pointer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey);\r\nSQLITE_PRIVATE void *sqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData);\r\nSQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey);\r\nSQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash*);\r\nSQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const void *, int);\r\n\r\n/*\r\n** Shorthand for the functions above\r\n*/\r\n#define fts3HashInit     sqlite3Fts3HashInit\r\n#define fts3HashInsert   sqlite3Fts3HashInsert\r\n#define fts3HashFind     sqlite3Fts3HashFind\r\n#define fts3HashClear    sqlite3Fts3HashClear\r\n#define fts3HashFindElem sqlite3Fts3HashFindElem\r\n\r\n/*\r\n** Macros for looping over all elements of a hash table.  The idiom is\r\n** like this:\r\n**\r\n**   Fts3Hash h;\r\n**   Fts3HashElem *p;\r\n**   ...\r\n**   for(p=fts3HashFirst(&h); p; p=fts3HashNext(p)){\r\n**     SomeStructure *pData = fts3HashData(p);\r\n**     // do something with pData\r\n**   }\r\n*/\r\n#define fts3HashFirst(H)  ((H)->first)\r\n#define fts3HashNext(E)   ((E)->next)\r\n#define fts3HashData(E)   ((E)->data)\r\n#define fts3HashKey(E)    ((E)->pKey)\r\n#define fts3HashKeysize(E) ((E)->nKey)\r\n\r\n/*\r\n** Number of entries in a hash table\r\n*/\r\n#define fts3HashCount(H)  ((H)->count)\r\n\r\n#endif /* _FTS3_HASH_H_ */\r\n\r\n/************** End of fts3_hash.h *******************************************/\r\n/************** Continuing where we left off in fts3Int.h ********************/\r\n\r\n/*\r\n** This constant controls how often segments are merged. Once there are\r\n** FTS3_MERGE_COUNT segments of level N, they are merged into a single\r\n** segment of level N+1.\r\n*/\r\n#define FTS3_MERGE_COUNT 16\r\n\r\n/*\r\n** This is the maximum amount of data (in bytes) to store in the \r\n** Fts3Table.pendingTerms hash table. Normally, the hash table is\r\n** populated as documents are inserted/updated/deleted in a transaction\r\n** and used to create a new segment when the transaction is committed.\r\n** However if this limit is reached midway through a transaction, a new \r\n** segment is created and the hash table cleared immediately.\r\n*/\r\n#define FTS3_MAX_PENDING_DATA (1*1024*1024)\r\n\r\n/*\r\n** Macro to return the number of elements in an array. SQLite has a\r\n** similar macro called ArraySize(). Use a different name to avoid\r\n** a collision when building an amalgamation with built-in FTS3.\r\n*/\r\n#define SizeofArray(X) ((int)(sizeof(X)/sizeof(X[0])))\r\n\r\n\r\n#ifndef MIN\r\n# define MIN(x,y) ((x)<(y)?(x):(y))\r\n#endif\r\n\r\n/*\r\n** Maximum length of a varint encoded integer. The varint format is different\r\n** from that used by SQLite, so the maximum length is 10, not 9.\r\n*/\r\n#define FTS3_VARINT_MAX 10\r\n\r\n/*\r\n** FTS4 virtual tables may maintain multiple indexes - one index of all terms\r\n** in the document set and zero or more prefix indexes. All indexes are stored\r\n** as one or more b+-trees in the %_segments and %_segdir tables. \r\n**\r\n** It is possible to determine which index a b+-tree belongs to based on the\r\n** value stored in the \"%_segdir.level\" column. Given this value L, the index\r\n** that the b+-tree belongs to is (L<<10). In other words, all b+-trees with\r\n** level values between 0 and 1023 (inclusive) belong to index 0, all levels\r\n** between 1024 and 2047 to index 1, and so on.\r\n**\r\n** It is considered impossible for an index to use more than 1024 levels. In \r\n** theory though this may happen, but only after at least \r\n** (FTS3_MERGE_COUNT^1024) separate flushes of the pending-terms tables.\r\n*/\r\n#define FTS3_SEGDIR_MAXLEVEL      1024\r\n#define FTS3_SEGDIR_MAXLEVEL_STR \"1024\"\r\n\r\n/*\r\n** The testcase() macro is only used by the amalgamation.  If undefined,\r\n** make it a no-op.\r\n*/\r\n#ifndef testcase\r\n# define testcase(X)\r\n#endif\r\n\r\n/*\r\n** Terminator values for position-lists and column-lists.\r\n*/\r\n#define POS_COLUMN  (1)     /* Column-list terminator */\r\n#define POS_END     (0)     /* Position-list terminator */ \r\n\r\n/*\r\n** This section provides definitions to allow the\r\n** FTS3 extension to be compiled outside of the \r\n** amalgamation.\r\n*/\r\n#ifndef SQLITE_AMALGAMATION\r\n/*\r\n** Macros indicating that conditional expressions are always true or\r\n** false.\r\n*/\r\n#ifdef SQLITE_COVERAGE_TEST\r\n# define ALWAYS(x) (1)\r\n# define NEVER(X)  (0)\r\n#else\r\n# define ALWAYS(x) (x)\r\n# define NEVER(X)  (x)\r\n#endif\r\n\r\n/*\r\n** Internal types used by SQLite.\r\n*/\r\ntypedef unsigned char u8;         /* 1-byte (or larger) unsigned integer */\r\ntypedef short int i16;            /* 2-byte (or larger) signed integer */\r\ntypedef unsigned int u32;         /* 4-byte unsigned integer */\r\ntypedef sqlite3_uint64 u64;       /* 8-byte unsigned integer */\r\n\r\n/*\r\n** Macro used to suppress compiler warnings for unused parameters.\r\n*/\r\n#define UNUSED_PARAMETER(x) (void)(x)\r\n\r\n/*\r\n** Activate assert() only if SQLITE_TEST is enabled.\r\n*/\r\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \r\n# define NDEBUG 1\r\n#endif\r\n\r\n/*\r\n** The TESTONLY macro is used to enclose variable declarations or\r\n** other bits of code that are needed to support the arguments\r\n** within testcase() and assert() macros.\r\n*/\r\n#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)\r\n# define TESTONLY(X)  X\r\n#else\r\n# define TESTONLY(X)\r\n#endif\r\n\r\n#endif /* SQLITE_AMALGAMATION */\r\n\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE int sqlite3Fts3Corrupt(void);\r\n# define FTS_CORRUPT_VTAB sqlite3Fts3Corrupt()\r\n#else\r\n# define FTS_CORRUPT_VTAB SQLITE_CORRUPT_VTAB\r\n#endif\r\n\r\ntypedef struct Fts3Table Fts3Table;\r\ntypedef struct Fts3Cursor Fts3Cursor;\r\ntypedef struct Fts3Expr Fts3Expr;\r\ntypedef struct Fts3Phrase Fts3Phrase;\r\ntypedef struct Fts3PhraseToken Fts3PhraseToken;\r\n\r\ntypedef struct Fts3Doclist Fts3Doclist;\r\ntypedef struct Fts3SegFilter Fts3SegFilter;\r\ntypedef struct Fts3DeferredToken Fts3DeferredToken;\r\ntypedef struct Fts3SegReader Fts3SegReader;\r\ntypedef struct Fts3MultiSegReader Fts3MultiSegReader;\r\n\r\n/*\r\n** A connection to a fulltext index is an instance of the following\r\n** structure. The xCreate and xConnect methods create an instance\r\n** of this structure and xDestroy and xDisconnect free that instance.\r\n** All other methods receive a pointer to the structure as one of their\r\n** arguments.\r\n*/\r\nstruct Fts3Table {\r\n  sqlite3_vtab base;              /* Base class used by SQLite core */\r\n  sqlite3 *db;                    /* The database connection */\r\n  const char *zDb;                /* logical database name */\r\n  const char *zName;              /* virtual table name */\r\n  int nColumn;                    /* number of named columns in virtual table */\r\n  char **azColumn;                /* column names.  malloced */\r\n  sqlite3_tokenizer *pTokenizer;  /* tokenizer for inserts and queries */\r\n  char *zContentTbl;              /* content=xxx option, or NULL */\r\n  char *zLanguageid;              /* languageid=xxx option, or NULL */\r\n\r\n  /* Precompiled statements used by the implementation. Each of these \r\n  ** statements is run and reset within a single virtual table API call. \r\n  */\r\n  sqlite3_stmt *aStmt[28];\r\n\r\n  char *zReadExprlist;\r\n  char *zWriteExprlist;\r\n\r\n  int nNodeSize;                  /* Soft limit for node size */\r\n  u8 bHasStat;                    /* True if %_stat table exists */\r\n  u8 bHasDocsize;                 /* True if %_docsize table exists */\r\n  u8 bDescIdx;                    /* True if doclists are in reverse order */\r\n  int nPgsz;                      /* Page size for host database */\r\n  char *zSegmentsTbl;             /* Name of %_segments table */\r\n  sqlite3_blob *pSegments;        /* Blob handle open on %_segments table */\r\n\r\n  /* TODO: Fix the first paragraph of this comment.\r\n  **\r\n  ** The following array of hash tables is used to buffer pending index \r\n  ** updates during transactions. Variable nPendingData estimates the memory \r\n  ** size of the pending data, including hash table overhead, not including\r\n  ** malloc overhead.  When nPendingData exceeds nMaxPendingData, the buffer \r\n  ** is flushed automatically. Variable iPrevDocid is the docid of the most \r\n  ** recently inserted record.\r\n  **\r\n  ** A single FTS4 table may have multiple full-text indexes. For each index\r\n  ** there is an entry in the aIndex[] array. Index 0 is an index of all the\r\n  ** terms that appear in the document set. Each subsequent index in aIndex[]\r\n  ** is an index of prefixes of a specific length.\r\n  */\r\n  int nIndex;                     /* Size of aIndex[] */\r\n  struct Fts3Index {\r\n    int nPrefix;                  /* Prefix length (0 for main terms index) */\r\n    Fts3Hash hPending;            /* Pending terms table for this index */\r\n  } *aIndex;\r\n  int nMaxPendingData;            /* Max pending data before flush to disk */\r\n  int nPendingData;               /* Current bytes of pending data */\r\n  sqlite_int64 iPrevDocid;        /* Docid of most recently inserted document */\r\n  int iPrevLangid;                /* Langid of recently inserted document */\r\n\r\n#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)\r\n  /* State variables used for validating that the transaction control\r\n  ** methods of the virtual table are called at appropriate times.  These\r\n  ** values do not contribute to FTS functionality; they are used for\r\n  ** verifying the operation of the SQLite core.\r\n  */\r\n  int inTransaction;     /* True after xBegin but before xCommit/xRollback */\r\n  int mxSavepoint;       /* Largest valid xSavepoint integer */\r\n#endif\r\n};\r\n\r\n/*\r\n** When the core wants to read from the virtual table, it creates a\r\n** virtual table cursor (an instance of the following structure) using\r\n** the xOpen method. Cursors are destroyed using the xClose method.\r\n*/\r\nstruct Fts3Cursor {\r\n  sqlite3_vtab_cursor base;       /* Base class used by SQLite core */\r\n  i16 eSearch;                    /* Search strategy (see below) */\r\n  u8 isEof;                       /* True if at End Of Results */\r\n  u8 isRequireSeek;               /* True if must seek pStmt to %_content row */\r\n  sqlite3_stmt *pStmt;            /* Prepared statement in use by the cursor */\r\n  Fts3Expr *pExpr;                /* Parsed MATCH query string */\r\n  int iLangid;                    /* Language being queried for */\r\n  int nPhrase;                    /* Number of matchable phrases in query */\r\n  Fts3DeferredToken *pDeferred;   /* Deferred search tokens, if any */\r\n  sqlite3_int64 iPrevId;          /* Previous id read from aDoclist */\r\n  char *pNextId;                  /* Pointer into the body of aDoclist */\r\n  char *aDoclist;                 /* List of docids for full-text queries */\r\n  int nDoclist;                   /* Size of buffer at aDoclist */\r\n  u8 bDesc;                       /* True to sort in descending order */\r\n  int eEvalmode;                  /* An FTS3_EVAL_XX constant */\r\n  int nRowAvg;                    /* Average size of database rows, in pages */\r\n  sqlite3_int64 nDoc;             /* Documents in table */\r\n\r\n  int isMatchinfoNeeded;          /* True when aMatchinfo[] needs filling in */\r\n  u32 *aMatchinfo;                /* Information about most recent match */\r\n  int nMatchinfo;                 /* Number of elements in aMatchinfo[] */\r\n  char *zMatchinfo;               /* Matchinfo specification */\r\n};\r\n\r\n#define FTS3_EVAL_FILTER    0\r\n#define FTS3_EVAL_NEXT      1\r\n#define FTS3_EVAL_MATCHINFO 2\r\n\r\n/*\r\n** The Fts3Cursor.eSearch member is always set to one of the following.\r\n** Actualy, Fts3Cursor.eSearch can be greater than or equal to\r\n** FTS3_FULLTEXT_SEARCH.  If so, then Fts3Cursor.eSearch - 2 is the index\r\n** of the column to be searched.  For example, in\r\n**\r\n**     CREATE VIRTUAL TABLE ex1 USING fts3(a,b,c,d);\r\n**     SELECT docid FROM ex1 WHERE b MATCH 'one two three';\r\n** \r\n** Because the LHS of the MATCH operator is 2nd column \"b\",\r\n** Fts3Cursor.eSearch will be set to FTS3_FULLTEXT_SEARCH+1.  (+0 for a,\r\n** +1 for b, +2 for c, +3 for d.)  If the LHS of MATCH were \"ex1\" \r\n** indicating that all columns should be searched,\r\n** then eSearch would be set to FTS3_FULLTEXT_SEARCH+4.\r\n*/\r\n#define FTS3_FULLSCAN_SEARCH 0    /* Linear scan of %_content table */\r\n#define FTS3_DOCID_SEARCH    1    /* Lookup by rowid on %_content table */\r\n#define FTS3_FULLTEXT_SEARCH 2    /* Full-text index search */\r\n\r\n\r\nstruct Fts3Doclist {\r\n  char *aAll;                    /* Array containing doclist (or NULL) */\r\n  int nAll;                      /* Size of a[] in bytes */\r\n  char *pNextDocid;              /* Pointer to next docid */\r\n\r\n  sqlite3_int64 iDocid;          /* Current docid (if pList!=0) */\r\n  int bFreeList;                 /* True if pList should be sqlite3_free()d */\r\n  char *pList;                   /* Pointer to position list following iDocid */\r\n  int nList;                     /* Length of position list */\r\n};\r\n\r\n/*\r\n** A \"phrase\" is a sequence of one or more tokens that must match in\r\n** sequence.  A single token is the base case and the most common case.\r\n** For a sequence of tokens contained in double-quotes (i.e. \"one two three\")\r\n** nToken will be the number of tokens in the string.\r\n*/\r\nstruct Fts3PhraseToken {\r\n  char *z;                        /* Text of the token */\r\n  int n;                          /* Number of bytes in buffer z */\r\n  int isPrefix;                   /* True if token ends with a \"*\" character */\r\n  int bFirst;                     /* True if token must appear at position 0 */\r\n\r\n  /* Variables above this point are populated when the expression is\r\n  ** parsed (by code in fts3_expr.c). Below this point the variables are\r\n  ** used when evaluating the expression. */\r\n  Fts3DeferredToken *pDeferred;   /* Deferred token object for this token */\r\n  Fts3MultiSegReader *pSegcsr;    /* Segment-reader for this token */\r\n};\r\n\r\nstruct Fts3Phrase {\r\n  /* Cache of doclist for this phrase. */\r\n  Fts3Doclist doclist;\r\n  int bIncr;                 /* True if doclist is loaded incrementally */\r\n  int iDoclistToken;\r\n\r\n  /* Variables below this point are populated by fts3_expr.c when parsing \r\n  ** a MATCH expression. Everything above is part of the evaluation phase. \r\n  */\r\n  int nToken;                /* Number of tokens in the phrase */\r\n  int iColumn;               /* Index of column this phrase must match */\r\n  Fts3PhraseToken aToken[1]; /* One entry for each token in the phrase */\r\n};\r\n\r\n/*\r\n** A tree of these objects forms the RHS of a MATCH operator.\r\n**\r\n** If Fts3Expr.eType is FTSQUERY_PHRASE and isLoaded is true, then aDoclist \r\n** points to a malloced buffer, size nDoclist bytes, containing the results \r\n** of this phrase query in FTS3 doclist format. As usual, the initial \r\n** \"Length\" field found in doclists stored on disk is omitted from this \r\n** buffer.\r\n**\r\n** Variable aMI is used only for FTSQUERY_NEAR nodes to store the global\r\n** matchinfo data. If it is not NULL, it points to an array of size nCol*3,\r\n** where nCol is the number of columns in the queried FTS table. The array\r\n** is populated as follows:\r\n**\r\n**   aMI[iCol*3 + 0] = Undefined\r\n**   aMI[iCol*3 + 1] = Number of occurrences\r\n**   aMI[iCol*3 + 2] = Number of rows containing at least one instance\r\n**\r\n** The aMI array is allocated using sqlite3_malloc(). It should be freed \r\n** when the expression node is.\r\n*/\r\nstruct Fts3Expr {\r\n  int eType;                 /* One of the FTSQUERY_XXX values defined below */\r\n  int nNear;                 /* Valid if eType==FTSQUERY_NEAR */\r\n  Fts3Expr *pParent;         /* pParent->pLeft==this or pParent->pRight==this */\r\n  Fts3Expr *pLeft;           /* Left operand */\r\n  Fts3Expr *pRight;          /* Right operand */\r\n  Fts3Phrase *pPhrase;       /* Valid if eType==FTSQUERY_PHRASE */\r\n\r\n  /* The following are used by the fts3_eval.c module. */\r\n  sqlite3_int64 iDocid;      /* Current docid */\r\n  u8 bEof;                   /* True this expression is at EOF already */\r\n  u8 bStart;                 /* True if iDocid is valid */\r\n  u8 bDeferred;              /* True if this expression is entirely deferred */\r\n\r\n  u32 *aMI;\r\n};\r\n\r\n/*\r\n** Candidate values for Fts3Query.eType. Note that the order of the first\r\n** four values is in order of precedence when parsing expressions. For \r\n** example, the following:\r\n**\r\n**   \"a OR b AND c NOT d NEAR e\"\r\n**\r\n** is equivalent to:\r\n**\r\n**   \"a OR (b AND (c NOT (d NEAR e)))\"\r\n*/\r\n#define FTSQUERY_NEAR   1\r\n#define FTSQUERY_NOT    2\r\n#define FTSQUERY_AND    3\r\n#define FTSQUERY_OR     4\r\n#define FTSQUERY_PHRASE 5\r\n\r\n\r\n/* fts3_write.c */\r\nSQLITE_PRIVATE int sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*);\r\nSQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *);\r\nSQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *);\r\nSQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *);\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, int, sqlite3_int64,\r\n  sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**);\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderPending(\r\n  Fts3Table*,int,const char*,int,int,Fts3SegReader**);\r\nSQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *);\r\nSQLITE_PRIVATE int sqlite3Fts3AllSegdirs(Fts3Table*, int, int, int, sqlite3_stmt **);\r\nSQLITE_PRIVATE int sqlite3Fts3ReadLock(Fts3Table *);\r\nSQLITE_PRIVATE int sqlite3Fts3ReadBlock(Fts3Table*, sqlite3_int64, char **, int*, int*);\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SelectDoctotal(Fts3Table *, sqlite3_stmt **);\r\nSQLITE_PRIVATE int sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_stmt **);\r\n\r\nSQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *);\r\nSQLITE_PRIVATE int sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int);\r\nSQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *);\r\nSQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *);\r\nSQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *);\r\n\r\n/* Special values interpreted by sqlite3SegReaderCursor() */\r\n#define FTS3_SEGCURSOR_PENDING        -1\r\n#define FTS3_SEGCURSOR_ALL            -2\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Fts3SegFilter*);\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *);\r\nSQLITE_PRIVATE void sqlite3Fts3SegReaderFinish(Fts3MultiSegReader *);\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderCursor(Fts3Table *, \r\n    int, int, int, const char *, int, int, int, Fts3MultiSegReader *);\r\n\r\n/* Flags allowed as part of the 4th argument to SegmentReaderIterate() */\r\n#define FTS3_SEGMENT_REQUIRE_POS   0x00000001\r\n#define FTS3_SEGMENT_IGNORE_EMPTY  0x00000002\r\n#define FTS3_SEGMENT_COLUMN_FILTER 0x00000004\r\n#define FTS3_SEGMENT_PREFIX        0x00000008\r\n#define FTS3_SEGMENT_SCAN          0x00000010\r\n#define FTS3_SEGMENT_FIRST         0x00000020\r\n\r\n/* Type passed as 4th argument to SegmentReaderIterate() */\r\nstruct Fts3SegFilter {\r\n  const char *zTerm;\r\n  int nTerm;\r\n  int iCol;\r\n  int flags;\r\n};\r\n\r\nstruct Fts3MultiSegReader {\r\n  /* Used internally by sqlite3Fts3SegReaderXXX() calls */\r\n  Fts3SegReader **apSegment;      /* Array of Fts3SegReader objects */\r\n  int nSegment;                   /* Size of apSegment array */\r\n  int nAdvance;                   /* How many seg-readers to advance */\r\n  Fts3SegFilter *pFilter;         /* Pointer to filter object */\r\n  char *aBuffer;                  /* Buffer to merge doclists in */\r\n  int nBuffer;                    /* Allocated size of aBuffer[] in bytes */\r\n\r\n  int iColFilter;                 /* If >=0, filter for this column */\r\n  int bRestart;\r\n\r\n  /* Used by fts3.c only. */\r\n  int nCost;                      /* Cost of running iterator */\r\n  int bLookup;                    /* True if a lookup of a single entry. */\r\n\r\n  /* Output values. Valid only after Fts3SegReaderStep() returns SQLITE_ROW. */\r\n  char *zTerm;                    /* Pointer to term buffer */\r\n  int nTerm;                      /* Size of zTerm in bytes */\r\n  char *aDoclist;                 /* Pointer to doclist buffer */\r\n  int nDoclist;                   /* Size of aDoclist[] in bytes */\r\n};\r\n\r\n/* fts3.c */\r\nSQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64);\r\nSQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *);\r\nSQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *, int *);\r\nSQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64);\r\nSQLITE_PRIVATE void sqlite3Fts3Dequote(char *);\r\nSQLITE_PRIVATE void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,int*,u8*);\r\nSQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *);\r\nSQLITE_PRIVATE int sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *);\r\n\r\n/* fts3_tokenizer.c */\r\nSQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *, int *);\r\nSQLITE_PRIVATE int sqlite3Fts3InitHashTable(sqlite3 *, Fts3Hash *, const char *);\r\nSQLITE_PRIVATE int sqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, \r\n    sqlite3_tokenizer **, char **\r\n);\r\nSQLITE_PRIVATE int sqlite3Fts3IsIdChar(char);\r\n\r\n/* fts3_snippet.c */\r\nSQLITE_PRIVATE void sqlite3Fts3Offsets(sqlite3_context*, Fts3Cursor*);\r\nSQLITE_PRIVATE void sqlite3Fts3Snippet(sqlite3_context *, Fts3Cursor *, const char *,\r\n  const char *, const char *, int, int\r\n);\r\nSQLITE_PRIVATE void sqlite3Fts3Matchinfo(sqlite3_context *, Fts3Cursor *, const char *);\r\n\r\n/* fts3_expr.c */\r\nSQLITE_PRIVATE int sqlite3Fts3ExprParse(sqlite3_tokenizer *, int,\r\n  char **, int, int, int, const char *, int, Fts3Expr **\r\n);\r\nSQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *);\r\n#ifdef SQLITE_TEST\r\nSQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db);\r\nSQLITE_PRIVATE int sqlite3Fts3InitTerm(sqlite3 *db);\r\n#endif\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3OpenTokenizer(sqlite3_tokenizer *, int, const char *, int,\r\n  sqlite3_tokenizer_cursor **\r\n);\r\n\r\n/* fts3_aux.c */\r\nSQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db);\r\n\r\nSQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *);\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3MsrIncrStart(\r\n    Fts3Table*, Fts3MultiSegReader*, int, const char*, int);\r\nSQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(\r\n    Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *);\r\nSQLITE_PRIVATE char *sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol); \r\nSQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);\r\nSQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *);\r\n\r\n#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */\r\n#endif /* _FTSINT_H */\r\n\r\n/************** End of fts3Int.h *********************************************/\r\n/************** Continuing where we left off in fts3.c ***********************/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)\r\n# define SQLITE_CORE 1\r\n#endif\r\n\r\n/* #include <assert.h> */\r\n/* #include <stdlib.h> */\r\n/* #include <stddef.h> */\r\n/* #include <stdio.h> */\r\n/* #include <string.h> */\r\n/* #include <stdarg.h> */\r\n\r\n#ifndef SQLITE_CORE \r\n  SQLITE_EXTENSION_INIT1\r\n#endif\r\n\r\nstatic int fts3EvalNext(Fts3Cursor *pCsr);\r\nstatic int fts3EvalStart(Fts3Cursor *pCsr);\r\nstatic int fts3TermSegReaderCursor(\r\n    Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **);\r\n\r\n/* \r\n** Write a 64-bit variable-length integer to memory starting at p[0].\r\n** The length of data written will be between 1 and FTS3_VARINT_MAX bytes.\r\n** The number of bytes written is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3PutVarint(char *p, sqlite_int64 v){\r\n  unsigned char *q = (unsigned char *) p;\r\n  sqlite_uint64 vu = v;\r\n  do{\r\n    *q++ = (unsigned char) ((vu & 0x7f) | 0x80);\r\n    vu >>= 7;\r\n  }while( vu!=0 );\r\n  q[-1] &= 0x7f;  /* turn off high bit in final byte */\r\n  assert( q - (unsigned char *)p <= FTS3_VARINT_MAX );\r\n  return (int) (q - (unsigned char *)p);\r\n}\r\n\r\n/* \r\n** Read a 64-bit variable-length integer from memory starting at p[0].\r\n** Return the number of bytes read, or 0 on error.\r\n** The value is stored in *v.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *p, sqlite_int64 *v){\r\n  const unsigned char *q = (const unsigned char *) p;\r\n  sqlite_uint64 x = 0, y = 1;\r\n  while( (*q&0x80)==0x80 && q-(unsigned char *)p<FTS3_VARINT_MAX ){\r\n    x += y * (*q++ & 0x7f);\r\n    y <<= 7;\r\n  }\r\n  x += y * (*q++);\r\n  *v = (sqlite_int64) x;\r\n  return (int) (q - (unsigned char *)p);\r\n}\r\n\r\n/*\r\n** Similar to sqlite3Fts3GetVarint(), except that the output is truncated to a\r\n** 32-bit integer before it is returned.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *p, int *pi){\r\n sqlite_int64 i;\r\n int ret = sqlite3Fts3GetVarint(p, &i);\r\n *pi = (int) i;\r\n return ret;\r\n}\r\n\r\n/*\r\n** Return the number of bytes required to encode v as a varint\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64 v){\r\n  int i = 0;\r\n  do{\r\n    i++;\r\n    v >>= 7;\r\n  }while( v!=0 );\r\n  return i;\r\n}\r\n\r\n/*\r\n** Convert an SQL-style quoted string into a normal string by removing\r\n** the quote characters.  The conversion is done in-place.  If the\r\n** input does not begin with a quote character, then this routine\r\n** is a no-op.\r\n**\r\n** Examples:\r\n**\r\n**     \"abc\"   becomes   abc\r\n**     'xyz'   becomes   xyz\r\n**     [pqr]   becomes   pqr\r\n**     `mno`   becomes   mno\r\n**\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3Dequote(char *z){\r\n  char quote;                     /* Quote character (if any ) */\r\n\r\n  quote = z[0];\r\n  if( quote=='[' || quote=='\\'' || quote=='\"' || quote=='`' ){\r\n    int iIn = 1;                  /* Index of next byte to read from input */\r\n    int iOut = 0;                 /* Index of next byte to write to output */\r\n\r\n    /* If the first byte was a '[', then the close-quote character is a ']' */\r\n    if( quote=='[' ) quote = ']';  \r\n\r\n    while( ALWAYS(z[iIn]) ){\r\n      if( z[iIn]==quote ){\r\n        if( z[iIn+1]!=quote ) break;\r\n        z[iOut++] = quote;\r\n        iIn += 2;\r\n      }else{\r\n        z[iOut++] = z[iIn++];\r\n      }\r\n    }\r\n    z[iOut] = '\\0';\r\n  }\r\n}\r\n\r\n/*\r\n** Read a single varint from the doclist at *pp and advance *pp to point\r\n** to the first byte past the end of the varint.  Add the value of the varint\r\n** to *pVal.\r\n*/\r\nstatic void fts3GetDeltaVarint(char **pp, sqlite3_int64 *pVal){\r\n  sqlite3_int64 iVal;\r\n  *pp += sqlite3Fts3GetVarint(*pp, &iVal);\r\n  *pVal += iVal;\r\n}\r\n\r\n/*\r\n** When this function is called, *pp points to the first byte following a\r\n** varint that is part of a doclist (or position-list, or any other list\r\n** of varints). This function moves *pp to point to the start of that varint,\r\n** and sets *pVal by the varint value.\r\n**\r\n** Argument pStart points to the first byte of the doclist that the\r\n** varint is part of.\r\n*/\r\nstatic void fts3GetReverseVarint(\r\n  char **pp, \r\n  char *pStart, \r\n  sqlite3_int64 *pVal\r\n){\r\n  sqlite3_int64 iVal;\r\n  char *p;\r\n\r\n  /* Pointer p now points at the first byte past the varint we are \r\n  ** interested in. So, unless the doclist is corrupt, the 0x80 bit is\r\n  ** clear on character p[-1]. */\r\n  for(p = (*pp)-2; p>=pStart && *p&0x80; p--);\r\n  p++;\r\n  *pp = p;\r\n\r\n  sqlite3Fts3GetVarint(p, &iVal);\r\n  *pVal = iVal;\r\n}\r\n\r\n/*\r\n** The xDisconnect() virtual table method.\r\n*/\r\nstatic int fts3DisconnectMethod(sqlite3_vtab *pVtab){\r\n  Fts3Table *p = (Fts3Table *)pVtab;\r\n  int i;\r\n\r\n  assert( p->nPendingData==0 );\r\n  assert( p->pSegments==0 );\r\n\r\n  /* Free any prepared statements held */\r\n  for(i=0; i<SizeofArray(p->aStmt); i++){\r\n    sqlite3_finalize(p->aStmt[i]);\r\n  }\r\n  sqlite3_free(p->zSegmentsTbl);\r\n  sqlite3_free(p->zReadExprlist);\r\n  sqlite3_free(p->zWriteExprlist);\r\n  sqlite3_free(p->zContentTbl);\r\n  sqlite3_free(p->zLanguageid);\r\n\r\n  /* Invoke the tokenizer destructor to free the tokenizer. */\r\n  p->pTokenizer->pModule->xDestroy(p->pTokenizer);\r\n\r\n  sqlite3_free(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Construct one or more SQL statements from the format string given\r\n** and then evaluate those statements. The success code is written\r\n** into *pRc.\r\n**\r\n** If *pRc is initially non-zero then this routine is a no-op.\r\n*/\r\nstatic void fts3DbExec(\r\n  int *pRc,              /* Success code */\r\n  sqlite3 *db,           /* Database in which to run SQL */\r\n  const char *zFormat,   /* Format string for SQL */\r\n  ...                    /* Arguments to the format string */\r\n){\r\n  va_list ap;\r\n  char *zSql;\r\n  if( *pRc ) return;\r\n  va_start(ap, zFormat);\r\n  zSql = sqlite3_vmprintf(zFormat, ap);\r\n  va_end(ap);\r\n  if( zSql==0 ){\r\n    *pRc = SQLITE_NOMEM;\r\n  }else{\r\n    *pRc = sqlite3_exec(db, zSql, 0, 0, 0);\r\n    sqlite3_free(zSql);\r\n  }\r\n}\r\n\r\n/*\r\n** The xDestroy() virtual table method.\r\n*/\r\nstatic int fts3DestroyMethod(sqlite3_vtab *pVtab){\r\n  Fts3Table *p = (Fts3Table *)pVtab;\r\n  int rc = SQLITE_OK;              /* Return code */\r\n  const char *zDb = p->zDb;        /* Name of database (e.g. \"main\", \"temp\") */\r\n  sqlite3 *db = p->db;             /* Database handle */\r\n\r\n  /* Drop the shadow tables */\r\n  if( p->zContentTbl==0 ){\r\n    fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_content'\", zDb, p->zName);\r\n  }\r\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_segments'\", zDb,p->zName);\r\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_segdir'\", zDb, p->zName);\r\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_docsize'\", zDb, p->zName);\r\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_stat'\", zDb, p->zName);\r\n\r\n  /* If everything has worked, invoke fts3DisconnectMethod() to free the\r\n  ** memory associated with the Fts3Table structure and return SQLITE_OK.\r\n  ** Otherwise, return an SQLite error code.\r\n  */\r\n  return (rc==SQLITE_OK ? fts3DisconnectMethod(pVtab) : rc);\r\n}\r\n\r\n\r\n/*\r\n** Invoke sqlite3_declare_vtab() to declare the schema for the FTS3 table\r\n** passed as the first argument. This is done as part of the xConnect()\r\n** and xCreate() methods.\r\n**\r\n** If *pRc is non-zero when this function is called, it is a no-op. \r\n** Otherwise, if an error occurs, an SQLite error code is stored in *pRc\r\n** before returning.\r\n*/\r\nstatic void fts3DeclareVtab(int *pRc, Fts3Table *p){\r\n  if( *pRc==SQLITE_OK ){\r\n    int i;                        /* Iterator variable */\r\n    int rc;                       /* Return code */\r\n    char *zSql;                   /* SQL statement passed to declare_vtab() */\r\n    char *zCols;                  /* List of user defined columns */\r\n    const char *zLanguageid;\r\n\r\n    zLanguageid = (p->zLanguageid ? p->zLanguageid : \"__langid\");\r\n    sqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1);\r\n\r\n    /* Create a list of user columns for the virtual table */\r\n    zCols = sqlite3_mprintf(\"%Q, \", p->azColumn[0]);\r\n    for(i=1; zCols && i<p->nColumn; i++){\r\n      zCols = sqlite3_mprintf(\"%z%Q, \", zCols, p->azColumn[i]);\r\n    }\r\n\r\n    /* Create the whole \"CREATE TABLE\" statement to pass to SQLite */\r\n    zSql = sqlite3_mprintf(\r\n        \"CREATE TABLE x(%s %Q HIDDEN, docid HIDDEN, %Q HIDDEN)\", \r\n        zCols, p->zName, zLanguageid\r\n    );\r\n    if( !zCols || !zSql ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      rc = sqlite3_declare_vtab(p->db, zSql);\r\n    }\r\n\r\n    sqlite3_free(zSql);\r\n    sqlite3_free(zCols);\r\n    *pRc = rc;\r\n  }\r\n}\r\n\r\n/*\r\n** Create the backing store tables (%_content, %_segments and %_segdir)\r\n** required by the FTS3 table passed as the only argument. This is done\r\n** as part of the vtab xCreate() method.\r\n**\r\n** If the p->bHasDocsize boolean is true (indicating that this is an\r\n** FTS4 table, not an FTS3 table) then also create the %_docsize and\r\n** %_stat tables required by FTS4.\r\n*/\r\nstatic int fts3CreateTables(Fts3Table *p){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  int i;                          /* Iterator variable */\r\n  sqlite3 *db = p->db;            /* The database connection */\r\n\r\n  if( p->zContentTbl==0 ){\r\n    const char *zLanguageid = p->zLanguageid;\r\n    char *zContentCols;           /* Columns of %_content table */\r\n\r\n    /* Create a list of user columns for the content table */\r\n    zContentCols = sqlite3_mprintf(\"docid INTEGER PRIMARY KEY\");\r\n    for(i=0; zContentCols && i<p->nColumn; i++){\r\n      char *z = p->azColumn[i];\r\n      zContentCols = sqlite3_mprintf(\"%z, 'c%d%q'\", zContentCols, i, z);\r\n    }\r\n    if( zLanguageid && zContentCols ){\r\n      zContentCols = sqlite3_mprintf(\"%z, langid\", zContentCols, zLanguageid);\r\n    }\r\n    if( zContentCols==0 ) rc = SQLITE_NOMEM;\r\n  \r\n    /* Create the content table */\r\n    fts3DbExec(&rc, db, \r\n       \"CREATE TABLE %Q.'%q_content'(%s)\",\r\n       p->zDb, p->zName, zContentCols\r\n    );\r\n    sqlite3_free(zContentCols);\r\n  }\r\n\r\n  /* Create other tables */\r\n  fts3DbExec(&rc, db, \r\n      \"CREATE TABLE %Q.'%q_segments'(blockid INTEGER PRIMARY KEY, block BLOB);\",\r\n      p->zDb, p->zName\r\n  );\r\n  fts3DbExec(&rc, db, \r\n      \"CREATE TABLE %Q.'%q_segdir'(\"\r\n        \"level INTEGER,\"\r\n        \"idx INTEGER,\"\r\n        \"start_block INTEGER,\"\r\n        \"leaves_end_block INTEGER,\"\r\n        \"end_block INTEGER,\"\r\n        \"root BLOB,\"\r\n        \"PRIMARY KEY(level, idx)\"\r\n      \");\",\r\n      p->zDb, p->zName\r\n  );\r\n  if( p->bHasDocsize ){\r\n    fts3DbExec(&rc, db, \r\n        \"CREATE TABLE %Q.'%q_docsize'(docid INTEGER PRIMARY KEY, size BLOB);\",\r\n        p->zDb, p->zName\r\n    );\r\n  }\r\n  if( p->bHasStat ){\r\n    fts3DbExec(&rc, db, \r\n        \"CREATE TABLE %Q.'%q_stat'(id INTEGER PRIMARY KEY, value BLOB);\",\r\n        p->zDb, p->zName\r\n    );\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Store the current database page-size in bytes in p->nPgsz.\r\n**\r\n** If *pRc is non-zero when this function is called, it is a no-op. \r\n** Otherwise, if an error occurs, an SQLite error code is stored in *pRc\r\n** before returning.\r\n*/\r\nstatic void fts3DatabasePageSize(int *pRc, Fts3Table *p){\r\n  if( *pRc==SQLITE_OK ){\r\n    int rc;                       /* Return code */\r\n    char *zSql;                   /* SQL text \"PRAGMA %Q.page_size\" */\r\n    sqlite3_stmt *pStmt;          /* Compiled \"PRAGMA %Q.page_size\" statement */\r\n  \r\n    zSql = sqlite3_mprintf(\"PRAGMA %Q.page_size\", p->zDb);\r\n    if( !zSql ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);\r\n      if( rc==SQLITE_OK ){\r\n        sqlite3_step(pStmt);\r\n        p->nPgsz = sqlite3_column_int(pStmt, 0);\r\n        rc = sqlite3_finalize(pStmt);\r\n      }else if( rc==SQLITE_AUTH ){\r\n        p->nPgsz = 1024;\r\n        rc = SQLITE_OK;\r\n      }\r\n    }\r\n    assert( p->nPgsz>0 || rc!=SQLITE_OK );\r\n    sqlite3_free(zSql);\r\n    *pRc = rc;\r\n  }\r\n}\r\n\r\n/*\r\n** \"Special\" FTS4 arguments are column specifications of the following form:\r\n**\r\n**   <key> = <value>\r\n**\r\n** There may not be whitespace surrounding the \"=\" character. The <value> \r\n** term may be quoted, but the <key> may not.\r\n*/\r\nstatic int fts3IsSpecialColumn(\r\n  const char *z, \r\n  int *pnKey,\r\n  char **pzValue\r\n){\r\n  char *zValue;\r\n  const char *zCsr = z;\r\n\r\n  while( *zCsr!='=' ){\r\n    if( *zCsr=='\\0' ) return 0;\r\n    zCsr++;\r\n  }\r\n\r\n  *pnKey = (int)(zCsr-z);\r\n  zValue = sqlite3_mprintf(\"%s\", &zCsr[1]);\r\n  if( zValue ){\r\n    sqlite3Fts3Dequote(zValue);\r\n  }\r\n  *pzValue = zValue;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Append the output of a printf() style formatting to an existing string.\r\n*/\r\nstatic void fts3Appendf(\r\n  int *pRc,                       /* IN/OUT: Error code */\r\n  char **pz,                      /* IN/OUT: Pointer to string buffer */\r\n  const char *zFormat,            /* Printf format string to append */\r\n  ...                             /* Arguments for printf format string */\r\n){\r\n  if( *pRc==SQLITE_OK ){\r\n    va_list ap;\r\n    char *z;\r\n    va_start(ap, zFormat);\r\n    z = sqlite3_vmprintf(zFormat, ap);\r\n    va_end(ap);\r\n    if( z && *pz ){\r\n      char *z2 = sqlite3_mprintf(\"%s%s\", *pz, z);\r\n      sqlite3_free(z);\r\n      z = z2;\r\n    }\r\n    if( z==0 ) *pRc = SQLITE_NOMEM;\r\n    sqlite3_free(*pz);\r\n    *pz = z;\r\n  }\r\n}\r\n\r\n/*\r\n** Return a copy of input string zInput enclosed in double-quotes (\") and\r\n** with all double quote characters escaped. For example:\r\n**\r\n**     fts3QuoteId(\"un \\\"zip\\\"\")   ->    \"un \\\"\\\"zip\\\"\\\"\"\r\n**\r\n** The pointer returned points to memory obtained from sqlite3_malloc(). It\r\n** is the callers responsibility to call sqlite3_free() to release this\r\n** memory.\r\n*/\r\nstatic char *fts3QuoteId(char const *zInput){\r\n  int nRet;\r\n  char *zRet;\r\n  nRet = 2 + (int)strlen(zInput)*2 + 1;\r\n  zRet = sqlite3_malloc(nRet);\r\n  if( zRet ){\r\n    int i;\r\n    char *z = zRet;\r\n    *(z++) = '\"';\r\n    for(i=0; zInput[i]; i++){\r\n      if( zInput[i]=='\"' ) *(z++) = '\"';\r\n      *(z++) = zInput[i];\r\n    }\r\n    *(z++) = '\"';\r\n    *(z++) = '\\0';\r\n  }\r\n  return zRet;\r\n}\r\n\r\n/*\r\n** Return a list of comma separated SQL expressions and a FROM clause that \r\n** could be used in a SELECT statement such as the following:\r\n**\r\n**     SELECT <list of expressions> FROM %_content AS x ...\r\n**\r\n** to return the docid, followed by each column of text data in order\r\n** from left to write. If parameter zFunc is not NULL, then instead of\r\n** being returned directly each column of text data is passed to an SQL\r\n** function named zFunc first. For example, if zFunc is \"unzip\" and the\r\n** table has the three user-defined columns \"a\", \"b\", and \"c\", the following\r\n** string is returned:\r\n**\r\n**     \"docid, unzip(x.'a'), unzip(x.'b'), unzip(x.'c') FROM %_content AS x\"\r\n**\r\n** The pointer returned points to a buffer allocated by sqlite3_malloc(). It\r\n** is the responsibility of the caller to eventually free it.\r\n**\r\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and\r\n** a NULL pointer is returned). Otherwise, if an OOM error is encountered\r\n** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If\r\n** no error occurs, *pRc is left unmodified.\r\n*/\r\nstatic char *fts3ReadExprList(Fts3Table *p, const char *zFunc, int *pRc){\r\n  char *zRet = 0;\r\n  char *zFree = 0;\r\n  char *zFunction;\r\n  int i;\r\n\r\n  if( p->zContentTbl==0 ){\r\n    if( !zFunc ){\r\n      zFunction = \"\";\r\n    }else{\r\n      zFree = zFunction = fts3QuoteId(zFunc);\r\n    }\r\n    fts3Appendf(pRc, &zRet, \"docid\");\r\n    for(i=0; i<p->nColumn; i++){\r\n      fts3Appendf(pRc, &zRet, \",%s(x.'c%d%q')\", zFunction, i, p->azColumn[i]);\r\n    }\r\n    if( p->zLanguageid ){\r\n      fts3Appendf(pRc, &zRet, \", x.%Q\", \"langid\");\r\n    }\r\n    sqlite3_free(zFree);\r\n  }else{\r\n    fts3Appendf(pRc, &zRet, \"rowid\");\r\n    for(i=0; i<p->nColumn; i++){\r\n      fts3Appendf(pRc, &zRet, \", x.'%q'\", p->azColumn[i]);\r\n    }\r\n    if( p->zLanguageid ){\r\n      fts3Appendf(pRc, &zRet, \", x.%Q\", p->zLanguageid);\r\n    }\r\n  }\r\n  fts3Appendf(pRc, &zRet, \" FROM '%q'.'%q%s' AS x\", \r\n      p->zDb,\r\n      (p->zContentTbl ? p->zContentTbl : p->zName),\r\n      (p->zContentTbl ? \"\" : \"_content\")\r\n  );\r\n  return zRet;\r\n}\r\n\r\n/*\r\n** Return a list of N comma separated question marks, where N is the number\r\n** of columns in the %_content table (one for the docid plus one for each\r\n** user-defined text column).\r\n**\r\n** If argument zFunc is not NULL, then all but the first question mark\r\n** is preceded by zFunc and an open bracket, and followed by a closed\r\n** bracket. For example, if zFunc is \"zip\" and the FTS3 table has three \r\n** user-defined text columns, the following string is returned:\r\n**\r\n**     \"?, zip(?), zip(?), zip(?)\"\r\n**\r\n** The pointer returned points to a buffer allocated by sqlite3_malloc(). It\r\n** is the responsibility of the caller to eventually free it.\r\n**\r\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and\r\n** a NULL pointer is returned). Otherwise, if an OOM error is encountered\r\n** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If\r\n** no error occurs, *pRc is left unmodified.\r\n*/\r\nstatic char *fts3WriteExprList(Fts3Table *p, const char *zFunc, int *pRc){\r\n  char *zRet = 0;\r\n  char *zFree = 0;\r\n  char *zFunction;\r\n  int i;\r\n\r\n  if( !zFunc ){\r\n    zFunction = \"\";\r\n  }else{\r\n    zFree = zFunction = fts3QuoteId(zFunc);\r\n  }\r\n  fts3Appendf(pRc, &zRet, \"?\");\r\n  for(i=0; i<p->nColumn; i++){\r\n    fts3Appendf(pRc, &zRet, \",%s(?)\", zFunction);\r\n  }\r\n  if( p->zLanguageid ){\r\n    fts3Appendf(pRc, &zRet, \", ?\");\r\n  }\r\n  sqlite3_free(zFree);\r\n  return zRet;\r\n}\r\n\r\n/*\r\n** This function interprets the string at (*pp) as a non-negative integer\r\n** value. It reads the integer and sets *pnOut to the value read, then \r\n** sets *pp to point to the byte immediately following the last byte of\r\n** the integer value.\r\n**\r\n** Only decimal digits ('0'..'9') may be part of an integer value. \r\n**\r\n** If *pp does not being with a decimal digit SQLITE_ERROR is returned and\r\n** the output value undefined. Otherwise SQLITE_OK is returned.\r\n**\r\n** This function is used when parsing the \"prefix=\" FTS4 parameter.\r\n*/\r\nstatic int fts3GobbleInt(const char **pp, int *pnOut){\r\n  const char *p;                  /* Iterator pointer */\r\n  int nInt = 0;                   /* Output value */\r\n\r\n  for(p=*pp; p[0]>='0' && p[0]<='9'; p++){\r\n    nInt = nInt * 10 + (p[0] - '0');\r\n  }\r\n  if( p==*pp ) return SQLITE_ERROR;\r\n  *pnOut = nInt;\r\n  *pp = p;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is called to allocate an array of Fts3Index structures\r\n** representing the indexes maintained by the current FTS table. FTS tables\r\n** always maintain the main \"terms\" index, but may also maintain one or\r\n** more \"prefix\" indexes, depending on the value of the \"prefix=\" parameter\r\n** (if any) specified as part of the CREATE VIRTUAL TABLE statement.\r\n**\r\n** Argument zParam is passed the value of the \"prefix=\" option if one was\r\n** specified, or NULL otherwise.\r\n**\r\n** If no error occurs, SQLITE_OK is returned and *apIndex set to point to\r\n** the allocated array. *pnIndex is set to the number of elements in the\r\n** array. If an error does occur, an SQLite error code is returned.\r\n**\r\n** Regardless of whether or not an error is returned, it is the responsibility\r\n** of the caller to call sqlite3_free() on the output array to free it.\r\n*/\r\nstatic int fts3PrefixParameter(\r\n  const char *zParam,             /* ABC in prefix=ABC parameter to parse */\r\n  int *pnIndex,                   /* OUT: size of *apIndex[] array */\r\n  struct Fts3Index **apIndex      /* OUT: Array of indexes for this table */\r\n){\r\n  struct Fts3Index *aIndex;       /* Allocated array */\r\n  int nIndex = 1;                 /* Number of entries in array */\r\n\r\n  if( zParam && zParam[0] ){\r\n    const char *p;\r\n    nIndex++;\r\n    for(p=zParam; *p; p++){\r\n      if( *p==',' ) nIndex++;\r\n    }\r\n  }\r\n\r\n  aIndex = sqlite3_malloc(sizeof(struct Fts3Index) * nIndex);\r\n  *apIndex = aIndex;\r\n  *pnIndex = nIndex;\r\n  if( !aIndex ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  memset(aIndex, 0, sizeof(struct Fts3Index) * nIndex);\r\n  if( zParam ){\r\n    const char *p = zParam;\r\n    int i;\r\n    for(i=1; i<nIndex; i++){\r\n      int nPrefix;\r\n      if( fts3GobbleInt(&p, &nPrefix) ) return SQLITE_ERROR;\r\n      aIndex[i].nPrefix = nPrefix;\r\n      p++;\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is called when initializing an FTS4 table that uses the\r\n** content=xxx option. It determines the number of and names of the columns\r\n** of the new FTS4 table.\r\n**\r\n** The third argument passed to this function is the value passed to the\r\n** config=xxx option (i.e. \"xxx\"). This function queries the database for\r\n** a table of that name. If found, the output variables are populated\r\n** as follows:\r\n**\r\n**   *pnCol:   Set to the number of columns table xxx has,\r\n**\r\n**   *pnStr:   Set to the total amount of space required to store a copy\r\n**             of each columns name, including the nul-terminator.\r\n**\r\n**   *pazCol:  Set to point to an array of *pnCol strings. Each string is\r\n**             the name of the corresponding column in table xxx. The array\r\n**             and its contents are allocated using a single allocation. It\r\n**             is the responsibility of the caller to free this allocation\r\n**             by eventually passing the *pazCol value to sqlite3_free().\r\n**\r\n** If the table cannot be found, an error code is returned and the output\r\n** variables are undefined. Or, if an OOM is encountered, SQLITE_NOMEM is\r\n** returned (and the output variables are undefined).\r\n*/\r\nstatic int fts3ContentColumns(\r\n  sqlite3 *db,                    /* Database handle */\r\n  const char *zDb,                /* Name of db (i.e. \"main\", \"temp\" etc.) */\r\n  const char *zTbl,               /* Name of content table */\r\n  const char ***pazCol,           /* OUT: Malloc'd array of column names */\r\n  int *pnCol,                     /* OUT: Size of array *pazCol */\r\n  int *pnStr                      /* OUT: Bytes of string content */\r\n){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  char *zSql;                     /* \"SELECT *\" statement on zTbl */  \r\n  sqlite3_stmt *pStmt = 0;        /* Compiled version of zSql */\r\n\r\n  zSql = sqlite3_mprintf(\"SELECT * FROM %Q.%Q\", zDb, zTbl);\r\n  if( !zSql ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\r\n  }\r\n  sqlite3_free(zSql);\r\n\r\n  if( rc==SQLITE_OK ){\r\n    const char **azCol;           /* Output array */\r\n    int nStr = 0;                 /* Size of all column names (incl. 0x00) */\r\n    int nCol;                     /* Number of table columns */\r\n    int i;                        /* Used to iterate through columns */\r\n\r\n    /* Loop through the returned columns. Set nStr to the number of bytes of\r\n    ** space required to store a copy of each column name, including the\r\n    ** nul-terminator byte.  */\r\n    nCol = sqlite3_column_count(pStmt);\r\n    for(i=0; i<nCol; i++){\r\n      const char *zCol = sqlite3_column_name(pStmt, i);\r\n      nStr += (int)strlen(zCol) + 1;\r\n    }\r\n\r\n    /* Allocate and populate the array to return. */\r\n    azCol = (const char **)sqlite3_malloc(sizeof(char *) * nCol + nStr);\r\n    if( azCol==0 ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      char *p = (char *)&azCol[nCol];\r\n      for(i=0; i<nCol; i++){\r\n        const char *zCol = sqlite3_column_name(pStmt, i);\r\n        int n = (int)strlen(zCol)+1;\r\n        memcpy(p, zCol, n);\r\n        azCol[i] = p;\r\n        p += n;\r\n      }\r\n    }\r\n    sqlite3_finalize(pStmt);\r\n\r\n    /* Set the output variables. */\r\n    *pnCol = nCol;\r\n    *pnStr = nStr;\r\n    *pazCol = azCol;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is the implementation of both the xConnect and xCreate\r\n** methods of the FTS3 virtual table.\r\n**\r\n** The argv[] array contains the following:\r\n**\r\n**   argv[0]   -> module name  (\"fts3\" or \"fts4\")\r\n**   argv[1]   -> database name\r\n**   argv[2]   -> table name\r\n**   argv[...] -> \"column name\" and other module argument fields.\r\n*/\r\nstatic int fts3InitVtab(\r\n  int isCreate,                   /* True for xCreate, false for xConnect */\r\n  sqlite3 *db,                    /* The SQLite database connection */\r\n  void *pAux,                     /* Hash table containing tokenizers */\r\n  int argc,                       /* Number of elements in argv array */\r\n  const char * const *argv,       /* xCreate/xConnect argument array */\r\n  sqlite3_vtab **ppVTab,          /* Write the resulting vtab structure here */\r\n  char **pzErr                    /* Write any error message here */\r\n){\r\n  Fts3Hash *pHash = (Fts3Hash *)pAux;\r\n  Fts3Table *p = 0;               /* Pointer to allocated vtab */\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  int i;                          /* Iterator variable */\r\n  int nByte;                      /* Size of allocation used for *p */\r\n  int iCol;                       /* Column index */\r\n  int nString = 0;                /* Bytes required to hold all column names */\r\n  int nCol = 0;                   /* Number of columns in the FTS table */\r\n  char *zCsr;                     /* Space for holding column names */\r\n  int nDb;                        /* Bytes required to hold database name */\r\n  int nName;                      /* Bytes required to hold table name */\r\n  int isFts4 = (argv[0][3]=='4'); /* True for FTS4, false for FTS3 */\r\n  const char **aCol;              /* Array of column names */\r\n  sqlite3_tokenizer *pTokenizer = 0;        /* Tokenizer for this table */\r\n\r\n  int nIndex;                     /* Size of aIndex[] array */\r\n  struct Fts3Index *aIndex = 0;   /* Array of indexes for this table */\r\n\r\n  /* The results of parsing supported FTS4 key=value options: */\r\n  int bNoDocsize = 0;             /* True to omit %_docsize table */\r\n  int bDescIdx = 0;               /* True to store descending indexes */\r\n  char *zPrefix = 0;              /* Prefix parameter value (or NULL) */\r\n  char *zCompress = 0;            /* compress=? parameter (or NULL) */\r\n  char *zUncompress = 0;          /* uncompress=? parameter (or NULL) */\r\n  char *zContent = 0;             /* content=? parameter (or NULL) */\r\n  char *zLanguageid = 0;          /* languageid=? parameter (or NULL) */\r\n\r\n  assert( strlen(argv[0])==4 );\r\n  assert( (sqlite3_strnicmp(argv[0], \"fts4\", 4)==0 && isFts4)\r\n       || (sqlite3_strnicmp(argv[0], \"fts3\", 4)==0 && !isFts4)\r\n  );\r\n\r\n  nDb = (int)strlen(argv[1]) + 1;\r\n  nName = (int)strlen(argv[2]) + 1;\r\n\r\n  aCol = (const char **)sqlite3_malloc(sizeof(const char *) * (argc-2) );\r\n  if( !aCol ) return SQLITE_NOMEM;\r\n  memset((void *)aCol, 0, sizeof(const char *) * (argc-2));\r\n\r\n  /* Loop through all of the arguments passed by the user to the FTS3/4\r\n  ** module (i.e. all the column names and special arguments). This loop\r\n  ** does the following:\r\n  **\r\n  **   + Figures out the number of columns the FTSX table will have, and\r\n  **     the number of bytes of space that must be allocated to store copies\r\n  **     of the column names.\r\n  **\r\n  **   + If there is a tokenizer specification included in the arguments,\r\n  **     initializes the tokenizer pTokenizer.\r\n  */\r\n  for(i=3; rc==SQLITE_OK && i<argc; i++){\r\n    char const *z = argv[i];\r\n    int nKey;\r\n    char *zVal;\r\n\r\n    /* Check if this is a tokenizer specification */\r\n    if( !pTokenizer \r\n     && strlen(z)>8\r\n     && 0==sqlite3_strnicmp(z, \"tokenize\", 8) \r\n     && 0==sqlite3Fts3IsIdChar(z[8])\r\n    ){\r\n      rc = sqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr);\r\n    }\r\n\r\n    /* Check if it is an FTS4 special argument. */\r\n    else if( isFts4 && fts3IsSpecialColumn(z, &nKey, &zVal) ){\r\n      struct Fts4Option {\r\n        const char *zOpt;\r\n        int nOpt;\r\n      } aFts4Opt[] = {\r\n        { \"matchinfo\",   9 },     /* 0 -> MATCHINFO */\r\n        { \"prefix\",      6 },     /* 1 -> PREFIX */\r\n        { \"compress\",    8 },     /* 2 -> COMPRESS */\r\n        { \"uncompress\", 10 },     /* 3 -> UNCOMPRESS */\r\n        { \"order\",       5 },     /* 4 -> ORDER */\r\n        { \"content\",     7 },     /* 5 -> CONTENT */\r\n        { \"languageid\", 10 }      /* 6 -> LANGUAGEID */\r\n      };\r\n\r\n      int iOpt;\r\n      if( !zVal ){\r\n        rc = SQLITE_NOMEM;\r\n      }else{\r\n        for(iOpt=0; iOpt<SizeofArray(aFts4Opt); iOpt++){\r\n          struct Fts4Option *pOp = &aFts4Opt[iOpt];\r\n          if( nKey==pOp->nOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){\r\n            break;\r\n          }\r\n        }\r\n        if( iOpt==SizeofArray(aFts4Opt) ){\r\n          *pzErr = sqlite3_mprintf(\"unrecognized parameter: %s\", z);\r\n          rc = SQLITE_ERROR;\r\n        }else{\r\n          switch( iOpt ){\r\n            case 0:               /* MATCHINFO */\r\n              if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, \"fts3\", 4) ){\r\n                *pzErr = sqlite3_mprintf(\"unrecognized matchinfo: %s\", zVal);\r\n                rc = SQLITE_ERROR;\r\n              }\r\n              bNoDocsize = 1;\r\n              break;\r\n\r\n            case 1:               /* PREFIX */\r\n              sqlite3_free(zPrefix);\r\n              zPrefix = zVal;\r\n              zVal = 0;\r\n              break;\r\n\r\n            case 2:               /* COMPRESS */\r\n              sqlite3_free(zCompress);\r\n              zCompress = zVal;\r\n              zVal = 0;\r\n              break;\r\n\r\n            case 3:               /* UNCOMPRESS */\r\n              sqlite3_free(zUncompress);\r\n              zUncompress = zVal;\r\n              zVal = 0;\r\n              break;\r\n\r\n            case 4:               /* ORDER */\r\n              if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, \"asc\", 3)) \r\n               && (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, \"desc\", 4)) \r\n              ){\r\n                *pzErr = sqlite3_mprintf(\"unrecognized order: %s\", zVal);\r\n                rc = SQLITE_ERROR;\r\n              }\r\n              bDescIdx = (zVal[0]=='d' || zVal[0]=='D');\r\n              break;\r\n\r\n            case 5:              /* CONTENT */\r\n              sqlite3_free(zContent);\r\n              zContent = zVal;\r\n              zVal = 0;\r\n              break;\r\n\r\n            case 6:              /* LANGUAGEID */\r\n              assert( iOpt==6 );\r\n              sqlite3_free(zLanguageid);\r\n              zLanguageid = zVal;\r\n              zVal = 0;\r\n              break;\r\n          }\r\n        }\r\n        sqlite3_free(zVal);\r\n      }\r\n    }\r\n\r\n    /* Otherwise, the argument is a column name. */\r\n    else {\r\n      nString += (int)(strlen(z) + 1);\r\n      aCol[nCol++] = z;\r\n    }\r\n  }\r\n\r\n  /* If a content=xxx option was specified, the following:\r\n  **\r\n  **   1. Ignore any compress= and uncompress= options.\r\n  **\r\n  **   2. If no column names were specified as part of the CREATE VIRTUAL\r\n  **      TABLE statement, use all columns from the content table.\r\n  */\r\n  if( rc==SQLITE_OK && zContent ){\r\n    sqlite3_free(zCompress); \r\n    sqlite3_free(zUncompress); \r\n    zCompress = 0;\r\n    zUncompress = 0;\r\n    if( nCol==0 ){\r\n      sqlite3_free((void*)aCol); \r\n      aCol = 0;\r\n      rc = fts3ContentColumns(db, argv[1], zContent, &aCol, &nCol, &nString);\r\n\r\n      /* If a languageid= option was specified, remove the language id\r\n      ** column from the aCol[] array. */ \r\n      if( rc==SQLITE_OK && zLanguageid ){\r\n        int j;\r\n        for(j=0; j<nCol; j++){\r\n          if( sqlite3_stricmp(zLanguageid, aCol[j])==0 ){\r\n            int k;\r\n            for(k=j; k<nCol; k++) aCol[k] = aCol[k+1];\r\n            nCol--;\r\n            break;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n  if( rc!=SQLITE_OK ) goto fts3_init_out;\r\n\r\n  if( nCol==0 ){\r\n    assert( nString==0 );\r\n    aCol[0] = \"content\";\r\n    nString = 8;\r\n    nCol = 1;\r\n  }\r\n\r\n  if( pTokenizer==0 ){\r\n    rc = sqlite3Fts3InitTokenizer(pHash, \"simple\", &pTokenizer, pzErr);\r\n    if( rc!=SQLITE_OK ) goto fts3_init_out;\r\n  }\r\n  assert( pTokenizer );\r\n\r\n  rc = fts3PrefixParameter(zPrefix, &nIndex, &aIndex);\r\n  if( rc==SQLITE_ERROR ){\r\n    assert( zPrefix );\r\n    *pzErr = sqlite3_mprintf(\"error parsing prefix parameter: %s\", zPrefix);\r\n  }\r\n  if( rc!=SQLITE_OK ) goto fts3_init_out;\r\n\r\n  /* Allocate and populate the Fts3Table structure. */\r\n  nByte = sizeof(Fts3Table) +                  /* Fts3Table */\r\n          nCol * sizeof(char *) +              /* azColumn */\r\n          nIndex * sizeof(struct Fts3Index) +  /* aIndex */\r\n          nName +                              /* zName */\r\n          nDb +                                /* zDb */\r\n          nString;                             /* Space for azColumn strings */\r\n  p = (Fts3Table*)sqlite3_malloc(nByte);\r\n  if( p==0 ){\r\n    rc = SQLITE_NOMEM;\r\n    goto fts3_init_out;\r\n  }\r\n  memset(p, 0, nByte);\r\n  p->db = db;\r\n  p->nColumn = nCol;\r\n  p->nPendingData = 0;\r\n  p->azColumn = (char **)&p[1];\r\n  p->pTokenizer = pTokenizer;\r\n  p->nMaxPendingData = FTS3_MAX_PENDING_DATA;\r\n  p->bHasDocsize = (isFts4 && bNoDocsize==0);\r\n  p->bHasStat = isFts4;\r\n  p->bDescIdx = bDescIdx;\r\n  p->zContentTbl = zContent;\r\n  p->zLanguageid = zLanguageid;\r\n  zContent = 0;\r\n  zLanguageid = 0;\r\n  TESTONLY( p->inTransaction = -1 );\r\n  TESTONLY( p->mxSavepoint = -1 );\r\n\r\n  p->aIndex = (struct Fts3Index *)&p->azColumn[nCol];\r\n  memcpy(p->aIndex, aIndex, sizeof(struct Fts3Index) * nIndex);\r\n  p->nIndex = nIndex;\r\n  for(i=0; i<nIndex; i++){\r\n    fts3HashInit(&p->aIndex[i].hPending, FTS3_HASH_STRING, 1);\r\n  }\r\n\r\n  /* Fill in the zName and zDb fields of the vtab structure. */\r\n  zCsr = (char *)&p->aIndex[nIndex];\r\n  p->zName = zCsr;\r\n  memcpy(zCsr, argv[2], nName);\r\n  zCsr += nName;\r\n  p->zDb = zCsr;\r\n  memcpy(zCsr, argv[1], nDb);\r\n  zCsr += nDb;\r\n\r\n  /* Fill in the azColumn array */\r\n  for(iCol=0; iCol<nCol; iCol++){\r\n    char *z; \r\n    int n = 0;\r\n    z = (char *)sqlite3Fts3NextToken(aCol[iCol], &n);\r\n    memcpy(zCsr, z, n);\r\n    zCsr[n] = '\\0';\r\n    sqlite3Fts3Dequote(zCsr);\r\n    p->azColumn[iCol] = zCsr;\r\n    zCsr += n+1;\r\n    assert( zCsr <= &((char *)p)[nByte] );\r\n  }\r\n\r\n  if( (zCompress==0)!=(zUncompress==0) ){\r\n    char const *zMiss = (zCompress==0 ? \"compress\" : \"uncompress\");\r\n    rc = SQLITE_ERROR;\r\n    *pzErr = sqlite3_mprintf(\"missing %s parameter in fts4 constructor\", zMiss);\r\n  }\r\n  p->zReadExprlist = fts3ReadExprList(p, zUncompress, &rc);\r\n  p->zWriteExprlist = fts3WriteExprList(p, zCompress, &rc);\r\n  if( rc!=SQLITE_OK ) goto fts3_init_out;\r\n\r\n  /* If this is an xCreate call, create the underlying tables in the \r\n  ** database. TODO: For xConnect(), it could verify that said tables exist.\r\n  */\r\n  if( isCreate ){\r\n    rc = fts3CreateTables(p);\r\n  }\r\n\r\n  /* Figure out the page-size for the database. This is required in order to\r\n  ** estimate the cost of loading large doclists from the database.  */\r\n  fts3DatabasePageSize(&rc, p);\r\n  p->nNodeSize = p->nPgsz-35;\r\n\r\n  /* Declare the table schema to SQLite. */\r\n  fts3DeclareVtab(&rc, p);\r\n\r\nfts3_init_out:\r\n  sqlite3_free(zPrefix);\r\n  sqlite3_free(aIndex);\r\n  sqlite3_free(zCompress);\r\n  sqlite3_free(zUncompress);\r\n  sqlite3_free(zContent);\r\n  sqlite3_free(zLanguageid);\r\n  sqlite3_free((void *)aCol);\r\n  if( rc!=SQLITE_OK ){\r\n    if( p ){\r\n      fts3DisconnectMethod((sqlite3_vtab *)p);\r\n    }else if( pTokenizer ){\r\n      pTokenizer->pModule->xDestroy(pTokenizer);\r\n    }\r\n  }else{\r\n    assert( p->pSegments==0 );\r\n    *ppVTab = &p->base;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The xConnect() and xCreate() methods for the virtual table. All the\r\n** work is done in function fts3InitVtab().\r\n*/\r\nstatic int fts3ConnectMethod(\r\n  sqlite3 *db,                    /* Database connection */\r\n  void *pAux,                     /* Pointer to tokenizer hash table */\r\n  int argc,                       /* Number of elements in argv array */\r\n  const char * const *argv,       /* xCreate/xConnect argument array */\r\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\r\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\r\n){\r\n  return fts3InitVtab(0, db, pAux, argc, argv, ppVtab, pzErr);\r\n}\r\nstatic int fts3CreateMethod(\r\n  sqlite3 *db,                    /* Database connection */\r\n  void *pAux,                     /* Pointer to tokenizer hash table */\r\n  int argc,                       /* Number of elements in argv array */\r\n  const char * const *argv,       /* xCreate/xConnect argument array */\r\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\r\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\r\n){\r\n  return fts3InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr);\r\n}\r\n\r\n/* \r\n** Implementation of the xBestIndex method for FTS3 tables. There\r\n** are three possible strategies, in order of preference:\r\n**\r\n**   1. Direct lookup by rowid or docid. \r\n**   2. Full-text search using a MATCH operator on a non-docid column.\r\n**   3. Linear scan of %_content table.\r\n*/\r\nstatic int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){\r\n  Fts3Table *p = (Fts3Table *)pVTab;\r\n  int i;                          /* Iterator variable */\r\n  int iCons = -1;                 /* Index of constraint to use */\r\n  int iLangidCons = -1;           /* Index of langid=x constraint, if present */\r\n\r\n  /* By default use a full table scan. This is an expensive option,\r\n  ** so search through the constraints to see if a more efficient \r\n  ** strategy is possible.\r\n  */\r\n  pInfo->idxNum = FTS3_FULLSCAN_SEARCH;\r\n  pInfo->estimatedCost = 500000;\r\n  for(i=0; i<pInfo->nConstraint; i++){\r\n    struct sqlite3_index_constraint *pCons = &pInfo->aConstraint[i];\r\n    if( pCons->usable==0 ) continue;\r\n\r\n    /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */\r\n    if( iCons<0 \r\n     && pCons->op==SQLITE_INDEX_CONSTRAINT_EQ \r\n     && (pCons->iColumn<0 || pCons->iColumn==p->nColumn+1 )\r\n    ){\r\n      pInfo->idxNum = FTS3_DOCID_SEARCH;\r\n      pInfo->estimatedCost = 1.0;\r\n      iCons = i;\r\n    }\r\n\r\n    /* A MATCH constraint. Use a full-text search.\r\n    **\r\n    ** If there is more than one MATCH constraint available, use the first\r\n    ** one encountered. If there is both a MATCH constraint and a direct\r\n    ** rowid/docid lookup, prefer the MATCH strategy. This is done even \r\n    ** though the rowid/docid lookup is faster than a MATCH query, selecting\r\n    ** it would lead to an \"unable to use function MATCH in the requested \r\n    ** context\" error.\r\n    */\r\n    if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH \r\n     && pCons->iColumn>=0 && pCons->iColumn<=p->nColumn\r\n    ){\r\n      pInfo->idxNum = FTS3_FULLTEXT_SEARCH + pCons->iColumn;\r\n      pInfo->estimatedCost = 2.0;\r\n      iCons = i;\r\n    }\r\n\r\n    /* Equality constraint on the langid column */\r\n    if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ \r\n     && pCons->iColumn==p->nColumn + 2\r\n    ){\r\n      iLangidCons = i;\r\n    }\r\n  }\r\n\r\n  if( iCons>=0 ){\r\n    pInfo->aConstraintUsage[iCons].argvIndex = 1;\r\n    pInfo->aConstraintUsage[iCons].omit = 1;\r\n  } \r\n  if( iLangidCons>=0 ){\r\n    pInfo->aConstraintUsage[iLangidCons].argvIndex = 2;\r\n  } \r\n\r\n  /* Regardless of the strategy selected, FTS can deliver rows in rowid (or\r\n  ** docid) order. Both ascending and descending are possible. \r\n  */\r\n  if( pInfo->nOrderBy==1 ){\r\n    struct sqlite3_index_orderby *pOrder = &pInfo->aOrderBy[0];\r\n    if( pOrder->iColumn<0 || pOrder->iColumn==p->nColumn+1 ){\r\n      if( pOrder->desc ){\r\n        pInfo->idxStr = \"DESC\";\r\n      }else{\r\n        pInfo->idxStr = \"ASC\";\r\n      }\r\n      pInfo->orderByConsumed = 1;\r\n    }\r\n  }\r\n\r\n  assert( p->pSegments==0 );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Implementation of xOpen method.\r\n*/\r\nstatic int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){\r\n  sqlite3_vtab_cursor *pCsr;               /* Allocated cursor */\r\n\r\n  UNUSED_PARAMETER(pVTab);\r\n\r\n  /* Allocate a buffer large enough for an Fts3Cursor structure. If the\r\n  ** allocation succeeds, zero it and return SQLITE_OK. Otherwise, \r\n  ** if the allocation fails, return SQLITE_NOMEM.\r\n  */\r\n  *ppCsr = pCsr = (sqlite3_vtab_cursor *)sqlite3_malloc(sizeof(Fts3Cursor));\r\n  if( !pCsr ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pCsr, 0, sizeof(Fts3Cursor));\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close the cursor.  For additional information see the documentation\r\n** on the xClose method of the virtual table interface.\r\n*/\r\nstatic int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){\r\n  Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;\r\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\r\n  sqlite3_finalize(pCsr->pStmt);\r\n  sqlite3Fts3ExprFree(pCsr->pExpr);\r\n  sqlite3Fts3FreeDeferredTokens(pCsr);\r\n  sqlite3_free(pCsr->aDoclist);\r\n  sqlite3_free(pCsr->aMatchinfo);\r\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\r\n  sqlite3_free(pCsr);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** If pCsr->pStmt has not been prepared (i.e. if pCsr->pStmt==0), then\r\n** compose and prepare an SQL statement of the form:\r\n**\r\n**    \"SELECT <columns> FROM %_content WHERE rowid = ?\"\r\n**\r\n** (or the equivalent for a content=xxx table) and set pCsr->pStmt to\r\n** it. If an error occurs, return an SQLite error code.\r\n**\r\n** Otherwise, set *ppStmt to point to pCsr->pStmt and return SQLITE_OK.\r\n*/\r\nstatic int fts3CursorSeekStmt(Fts3Cursor *pCsr, sqlite3_stmt **ppStmt){\r\n  int rc = SQLITE_OK;\r\n  if( pCsr->pStmt==0 ){\r\n    Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;\r\n    char *zSql;\r\n    zSql = sqlite3_mprintf(\"SELECT %s WHERE rowid = ?\", p->zReadExprlist);\r\n    if( !zSql ) return SQLITE_NOMEM;\r\n    rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);\r\n    sqlite3_free(zSql);\r\n  }\r\n  *ppStmt = pCsr->pStmt;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Position the pCsr->pStmt statement so that it is on the row\r\n** of the %_content table that contains the last match.  Return\r\n** SQLITE_OK on success.  \r\n*/\r\nstatic int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){\r\n  int rc = SQLITE_OK;\r\n  if( pCsr->isRequireSeek ){\r\n    sqlite3_stmt *pStmt = 0;\r\n\r\n    rc = fts3CursorSeekStmt(pCsr, &pStmt);\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId);\r\n      pCsr->isRequireSeek = 0;\r\n      if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){\r\n        return SQLITE_OK;\r\n      }else{\r\n        rc = sqlite3_reset(pCsr->pStmt);\r\n        if( rc==SQLITE_OK && ((Fts3Table *)pCsr->base.pVtab)->zContentTbl==0 ){\r\n          /* If no row was found and no error has occured, then the %_content\r\n          ** table is missing a row that is present in the full-text index.\r\n          ** The data structures are corrupt.  */\r\n          rc = FTS_CORRUPT_VTAB;\r\n          pCsr->isEof = 1;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  if( rc!=SQLITE_OK && pContext ){\r\n    sqlite3_result_error_code(pContext, rc);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is used to process a single interior node when searching\r\n** a b-tree for a term or term prefix. The node data is passed to this \r\n** function via the zNode/nNode parameters. The term to search for is\r\n** passed in zTerm/nTerm.\r\n**\r\n** If piFirst is not NULL, then this function sets *piFirst to the blockid\r\n** of the child node that heads the sub-tree that may contain the term.\r\n**\r\n** If piLast is not NULL, then *piLast is set to the right-most child node\r\n** that heads a sub-tree that may contain a term for which zTerm/nTerm is\r\n** a prefix.\r\n**\r\n** If an OOM error occurs, SQLITE_NOMEM is returned. Otherwise, SQLITE_OK.\r\n*/\r\nstatic int fts3ScanInteriorNode(\r\n  const char *zTerm,              /* Term to select leaves for */\r\n  int nTerm,                      /* Size of term zTerm in bytes */\r\n  const char *zNode,              /* Buffer containing segment interior node */\r\n  int nNode,                      /* Size of buffer at zNode */\r\n  sqlite3_int64 *piFirst,         /* OUT: Selected child node */\r\n  sqlite3_int64 *piLast           /* OUT: Selected child node */\r\n){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  const char *zCsr = zNode;       /* Cursor to iterate through node */\r\n  const char *zEnd = &zCsr[nNode];/* End of interior node buffer */\r\n  char *zBuffer = 0;              /* Buffer to load terms into */\r\n  int nAlloc = 0;                 /* Size of allocated buffer */\r\n  int isFirstTerm = 1;            /* True when processing first term on page */\r\n  sqlite3_int64 iChild;           /* Block id of child node to descend to */\r\n\r\n  /* Skip over the 'height' varint that occurs at the start of every \r\n  ** interior node. Then load the blockid of the left-child of the b-tree\r\n  ** node into variable iChild.  \r\n  **\r\n  ** Even if the data structure on disk is corrupted, this (reading two\r\n  ** varints from the buffer) does not risk an overread. If zNode is a\r\n  ** root node, then the buffer comes from a SELECT statement. SQLite does\r\n  ** not make this guarantee explicitly, but in practice there are always\r\n  ** either more than 20 bytes of allocated space following the nNode bytes of\r\n  ** contents, or two zero bytes. Or, if the node is read from the %_segments\r\n  ** table, then there are always 20 bytes of zeroed padding following the\r\n  ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details).\r\n  */\r\n  zCsr += sqlite3Fts3GetVarint(zCsr, &iChild);\r\n  zCsr += sqlite3Fts3GetVarint(zCsr, &iChild);\r\n  if( zCsr>zEnd ){\r\n    return FTS_CORRUPT_VTAB;\r\n  }\r\n  \r\n  while( zCsr<zEnd && (piFirst || piLast) ){\r\n    int cmp;                      /* memcmp() result */\r\n    int nSuffix;                  /* Size of term suffix */\r\n    int nPrefix = 0;              /* Size of term prefix */\r\n    int nBuffer;                  /* Total term size */\r\n  \r\n    /* Load the next term on the node into zBuffer. Use realloc() to expand\r\n    ** the size of zBuffer if required.  */\r\n    if( !isFirstTerm ){\r\n      zCsr += sqlite3Fts3GetVarint32(zCsr, &nPrefix);\r\n    }\r\n    isFirstTerm = 0;\r\n    zCsr += sqlite3Fts3GetVarint32(zCsr, &nSuffix);\r\n    \r\n    if( nPrefix<0 || nSuffix<0 || &zCsr[nSuffix]>zEnd ){\r\n      rc = FTS_CORRUPT_VTAB;\r\n      goto finish_scan;\r\n    }\r\n    if( nPrefix+nSuffix>nAlloc ){\r\n      char *zNew;\r\n      nAlloc = (nPrefix+nSuffix) * 2;\r\n      zNew = (char *)sqlite3_realloc(zBuffer, nAlloc);\r\n      if( !zNew ){\r\n        rc = SQLITE_NOMEM;\r\n        goto finish_scan;\r\n      }\r\n      zBuffer = zNew;\r\n    }\r\n    assert( zBuffer );\r\n    memcpy(&zBuffer[nPrefix], zCsr, nSuffix);\r\n    nBuffer = nPrefix + nSuffix;\r\n    zCsr += nSuffix;\r\n\r\n    /* Compare the term we are searching for with the term just loaded from\r\n    ** the interior node. If the specified term is greater than or equal\r\n    ** to the term from the interior node, then all terms on the sub-tree \r\n    ** headed by node iChild are smaller than zTerm. No need to search \r\n    ** iChild.\r\n    **\r\n    ** If the interior node term is larger than the specified term, then\r\n    ** the tree headed by iChild may contain the specified term.\r\n    */\r\n    cmp = memcmp(zTerm, zBuffer, (nBuffer>nTerm ? nTerm : nBuffer));\r\n    if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){\r\n      *piFirst = iChild;\r\n      piFirst = 0;\r\n    }\r\n\r\n    if( piLast && cmp<0 ){\r\n      *piLast = iChild;\r\n      piLast = 0;\r\n    }\r\n\r\n    iChild++;\r\n  };\r\n\r\n  if( piFirst ) *piFirst = iChild;\r\n  if( piLast ) *piLast = iChild;\r\n\r\n finish_scan:\r\n  sqlite3_free(zBuffer);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** The buffer pointed to by argument zNode (size nNode bytes) contains an\r\n** interior node of a b-tree segment. The zTerm buffer (size nTerm bytes)\r\n** contains a term. This function searches the sub-tree headed by the zNode\r\n** node for the range of leaf nodes that may contain the specified term\r\n** or terms for which the specified term is a prefix.\r\n**\r\n** If piLeaf is not NULL, then *piLeaf is set to the blockid of the \r\n** left-most leaf node in the tree that may contain the specified term.\r\n** If piLeaf2 is not NULL, then *piLeaf2 is set to the blockid of the\r\n** right-most leaf node that may contain a term for which the specified\r\n** term is a prefix.\r\n**\r\n** It is possible that the range of returned leaf nodes does not contain \r\n** the specified term or any terms for which it is a prefix. However, if the \r\n** segment does contain any such terms, they are stored within the identified\r\n** range. Because this function only inspects interior segment nodes (and\r\n** never loads leaf nodes into memory), it is not possible to be sure.\r\n**\r\n** If an error occurs, an error code other than SQLITE_OK is returned.\r\n*/ \r\nstatic int fts3SelectLeaf(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  const char *zTerm,              /* Term to select leaves for */\r\n  int nTerm,                      /* Size of term zTerm in bytes */\r\n  const char *zNode,              /* Buffer containing segment interior node */\r\n  int nNode,                      /* Size of buffer at zNode */\r\n  sqlite3_int64 *piLeaf,          /* Selected leaf node */\r\n  sqlite3_int64 *piLeaf2          /* Selected leaf node */\r\n){\r\n  int rc;                         /* Return code */\r\n  int iHeight;                    /* Height of this node in tree */\r\n\r\n  assert( piLeaf || piLeaf2 );\r\n\r\n  sqlite3Fts3GetVarint32(zNode, &iHeight);\r\n  rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);\r\n  assert( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) );\r\n\r\n  if( rc==SQLITE_OK && iHeight>1 ){\r\n    char *zBlob = 0;              /* Blob read from %_segments table */\r\n    int nBlob;                    /* Size of zBlob in bytes */\r\n\r\n    if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){\r\n      rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0);\r\n      if( rc==SQLITE_OK ){\r\n        rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, 0);\r\n      }\r\n      sqlite3_free(zBlob);\r\n      piLeaf = 0;\r\n      zBlob = 0;\r\n    }\r\n\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, piLeaf2);\r\n    }\r\n    sqlite3_free(zBlob);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is used to create delta-encoded serialized lists of FTS3 \r\n** varints. Each call to this function appends a single varint to a list.\r\n*/\r\nstatic void fts3PutDeltaVarint(\r\n  char **pp,                      /* IN/OUT: Output pointer */\r\n  sqlite3_int64 *piPrev,          /* IN/OUT: Previous value written to list */\r\n  sqlite3_int64 iVal              /* Write this value to the list */\r\n){\r\n  assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) );\r\n  *pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev);\r\n  *piPrev = iVal;\r\n}\r\n\r\n/*\r\n** When this function is called, *ppPoslist is assumed to point to the \r\n** start of a position-list. After it returns, *ppPoslist points to the\r\n** first byte after the position-list.\r\n**\r\n** A position list is list of positions (delta encoded) and columns for \r\n** a single document record of a doclist.  So, in other words, this\r\n** routine advances *ppPoslist so that it points to the next docid in\r\n** the doclist, or to the first byte past the end of the doclist.\r\n**\r\n** If pp is not NULL, then the contents of the position list are copied\r\n** to *pp. *pp is set to point to the first byte past the last byte copied\r\n** before this function returns.\r\n*/\r\nstatic void fts3PoslistCopy(char **pp, char **ppPoslist){\r\n  char *pEnd = *ppPoslist;\r\n  char c = 0;\r\n\r\n  /* The end of a position list is marked by a zero encoded as an FTS3 \r\n  ** varint. A single POS_END (0) byte. Except, if the 0 byte is preceded by\r\n  ** a byte with the 0x80 bit set, then it is not a varint 0, but the tail\r\n  ** of some other, multi-byte, value.\r\n  **\r\n  ** The following while-loop moves pEnd to point to the first byte that is not \r\n  ** immediately preceded by a byte with the 0x80 bit set. Then increments\r\n  ** pEnd once more so that it points to the byte immediately following the\r\n  ** last byte in the position-list.\r\n  */\r\n  while( *pEnd | c ){\r\n    c = *pEnd++ & 0x80;\r\n    testcase( c!=0 && (*pEnd)==0 );\r\n  }\r\n  pEnd++;  /* Advance past the POS_END terminator byte */\r\n\r\n  if( pp ){\r\n    int n = (int)(pEnd - *ppPoslist);\r\n    char *p = *pp;\r\n    memcpy(p, *ppPoslist, n);\r\n    p += n;\r\n    *pp = p;\r\n  }\r\n  *ppPoslist = pEnd;\r\n}\r\n\r\n/*\r\n** When this function is called, *ppPoslist is assumed to point to the \r\n** start of a column-list. After it returns, *ppPoslist points to the\r\n** to the terminator (POS_COLUMN or POS_END) byte of the column-list.\r\n**\r\n** A column-list is list of delta-encoded positions for a single column\r\n** within a single document within a doclist.\r\n**\r\n** The column-list is terminated either by a POS_COLUMN varint (1) or\r\n** a POS_END varint (0).  This routine leaves *ppPoslist pointing to\r\n** the POS_COLUMN or POS_END that terminates the column-list.\r\n**\r\n** If pp is not NULL, then the contents of the column-list are copied\r\n** to *pp. *pp is set to point to the first byte past the last byte copied\r\n** before this function returns.  The POS_COLUMN or POS_END terminator\r\n** is not copied into *pp.\r\n*/\r\nstatic void fts3ColumnlistCopy(char **pp, char **ppPoslist){\r\n  char *pEnd = *ppPoslist;\r\n  char c = 0;\r\n\r\n  /* A column-list is terminated by either a 0x01 or 0x00 byte that is\r\n  ** not part of a multi-byte varint.\r\n  */\r\n  while( 0xFE & (*pEnd | c) ){\r\n    c = *pEnd++ & 0x80;\r\n    testcase( c!=0 && ((*pEnd)&0xfe)==0 );\r\n  }\r\n  if( pp ){\r\n    int n = (int)(pEnd - *ppPoslist);\r\n    char *p = *pp;\r\n    memcpy(p, *ppPoslist, n);\r\n    p += n;\r\n    *pp = p;\r\n  }\r\n  *ppPoslist = pEnd;\r\n}\r\n\r\n/*\r\n** Value used to signify the end of an position-list. This is safe because\r\n** it is not possible to have a document with 2^31 terms.\r\n*/\r\n#define POSITION_LIST_END 0x7fffffff\r\n\r\n/*\r\n** This function is used to help parse position-lists. When this function is\r\n** called, *pp may point to the start of the next varint in the position-list\r\n** being parsed, or it may point to 1 byte past the end of the position-list\r\n** (in which case **pp will be a terminator bytes POS_END (0) or\r\n** (1)).\r\n**\r\n** If *pp points past the end of the current position-list, set *pi to \r\n** POSITION_LIST_END and return. Otherwise, read the next varint from *pp,\r\n** increment the current value of *pi by the value read, and set *pp to\r\n** point to the next value before returning.\r\n**\r\n** Before calling this routine *pi must be initialized to the value of\r\n** the previous position, or zero if we are reading the first position\r\n** in the position-list.  Because positions are delta-encoded, the value\r\n** of the previous position is needed in order to compute the value of\r\n** the next position.\r\n*/\r\nstatic void fts3ReadNextPos(\r\n  char **pp,                    /* IN/OUT: Pointer into position-list buffer */\r\n  sqlite3_int64 *pi             /* IN/OUT: Value read from position-list */\r\n){\r\n  if( (**pp)&0xFE ){\r\n    fts3GetDeltaVarint(pp, pi);\r\n    *pi -= 2;\r\n  }else{\r\n    *pi = POSITION_LIST_END;\r\n  }\r\n}\r\n\r\n/*\r\n** If parameter iCol is not 0, write an POS_COLUMN (1) byte followed by\r\n** the value of iCol encoded as a varint to *pp.   This will start a new\r\n** column list.\r\n**\r\n** Set *pp to point to the byte just after the last byte written before \r\n** returning (do not modify it if iCol==0). Return the total number of bytes\r\n** written (0 if iCol==0).\r\n*/\r\nstatic int fts3PutColNumber(char **pp, int iCol){\r\n  int n = 0;                      /* Number of bytes written */\r\n  if( iCol ){\r\n    char *p = *pp;                /* Output pointer */\r\n    n = 1 + sqlite3Fts3PutVarint(&p[1], iCol);\r\n    *p = 0x01;\r\n    *pp = &p[n];\r\n  }\r\n  return n;\r\n}\r\n\r\n/*\r\n** Compute the union of two position lists.  The output written\r\n** into *pp contains all positions of both *pp1 and *pp2 in sorted\r\n** order and with any duplicates removed.  All pointers are\r\n** updated appropriately.   The caller is responsible for insuring\r\n** that there is enough space in *pp to hold the complete output.\r\n*/\r\nstatic void fts3PoslistMerge(\r\n  char **pp,                      /* Output buffer */\r\n  char **pp1,                     /* Left input list */\r\n  char **pp2                      /* Right input list */\r\n){\r\n  char *p = *pp;\r\n  char *p1 = *pp1;\r\n  char *p2 = *pp2;\r\n\r\n  while( *p1 || *p2 ){\r\n    int iCol1;         /* The current column index in pp1 */\r\n    int iCol2;         /* The current column index in pp2 */\r\n\r\n    if( *p1==POS_COLUMN ) sqlite3Fts3GetVarint32(&p1[1], &iCol1);\r\n    else if( *p1==POS_END ) iCol1 = POSITION_LIST_END;\r\n    else iCol1 = 0;\r\n\r\n    if( *p2==POS_COLUMN ) sqlite3Fts3GetVarint32(&p2[1], &iCol2);\r\n    else if( *p2==POS_END ) iCol2 = POSITION_LIST_END;\r\n    else iCol2 = 0;\r\n\r\n    if( iCol1==iCol2 ){\r\n      sqlite3_int64 i1 = 0;       /* Last position from pp1 */\r\n      sqlite3_int64 i2 = 0;       /* Last position from pp2 */\r\n      sqlite3_int64 iPrev = 0;\r\n      int n = fts3PutColNumber(&p, iCol1);\r\n      p1 += n;\r\n      p2 += n;\r\n\r\n      /* At this point, both p1 and p2 point to the start of column-lists\r\n      ** for the same column (the column with index iCol1 and iCol2).\r\n      ** A column-list is a list of non-negative delta-encoded varints, each \r\n      ** incremented by 2 before being stored. Each list is terminated by a\r\n      ** POS_END (0) or POS_COLUMN (1). The following block merges the two lists\r\n      ** and writes the results to buffer p. p is left pointing to the byte\r\n      ** after the list written. No terminator (POS_END or POS_COLUMN) is\r\n      ** written to the output.\r\n      */\r\n      fts3GetDeltaVarint(&p1, &i1);\r\n      fts3GetDeltaVarint(&p2, &i2);\r\n      do {\r\n        fts3PutDeltaVarint(&p, &iPrev, (i1<i2) ? i1 : i2); \r\n        iPrev -= 2;\r\n        if( i1==i2 ){\r\n          fts3ReadNextPos(&p1, &i1);\r\n          fts3ReadNextPos(&p2, &i2);\r\n        }else if( i1<i2 ){\r\n          fts3ReadNextPos(&p1, &i1);\r\n        }else{\r\n          fts3ReadNextPos(&p2, &i2);\r\n        }\r\n      }while( i1!=POSITION_LIST_END || i2!=POSITION_LIST_END );\r\n    }else if( iCol1<iCol2 ){\r\n      p1 += fts3PutColNumber(&p, iCol1);\r\n      fts3ColumnlistCopy(&p, &p1);\r\n    }else{\r\n      p2 += fts3PutColNumber(&p, iCol2);\r\n      fts3ColumnlistCopy(&p, &p2);\r\n    }\r\n  }\r\n\r\n  *p++ = POS_END;\r\n  *pp = p;\r\n  *pp1 = p1 + 1;\r\n  *pp2 = p2 + 1;\r\n}\r\n\r\n/*\r\n** This function is used to merge two position lists into one. When it is\r\n** called, *pp1 and *pp2 must both point to position lists. A position-list is\r\n** the part of a doclist that follows each document id. For example, if a row\r\n** contains:\r\n**\r\n**     'a b c'|'x y z'|'a b b a'\r\n**\r\n** Then the position list for this row for token 'b' would consist of:\r\n**\r\n**     0x02 0x01 0x02 0x03 0x03 0x00\r\n**\r\n** When this function returns, both *pp1 and *pp2 are left pointing to the\r\n** byte following the 0x00 terminator of their respective position lists.\r\n**\r\n** If isSaveLeft is 0, an entry is added to the output position list for \r\n** each position in *pp2 for which there exists one or more positions in\r\n** *pp1 so that (pos(*pp2)>pos(*pp1) && pos(*pp2)-pos(*pp1)<=nToken). i.e.\r\n** when the *pp1 token appears before the *pp2 token, but not more than nToken\r\n** slots before it.\r\n**\r\n** e.g. nToken==1 searches for adjacent positions.\r\n*/\r\nstatic int fts3PoslistPhraseMerge(\r\n  char **pp,                      /* IN/OUT: Preallocated output buffer */\r\n  int nToken,                     /* Maximum difference in token positions */\r\n  int isSaveLeft,                 /* Save the left position */\r\n  int isExact,                    /* If *pp1 is exactly nTokens before *pp2 */\r\n  char **pp1,                     /* IN/OUT: Left input list */\r\n  char **pp2                      /* IN/OUT: Right input list */\r\n){\r\n  char *p = *pp;\r\n  char *p1 = *pp1;\r\n  char *p2 = *pp2;\r\n  int iCol1 = 0;\r\n  int iCol2 = 0;\r\n\r\n  /* Never set both isSaveLeft and isExact for the same invocation. */\r\n  assert( isSaveLeft==0 || isExact==0 );\r\n\r\n  assert( p!=0 && *p1!=0 && *p2!=0 );\r\n  if( *p1==POS_COLUMN ){ \r\n    p1++;\r\n    p1 += sqlite3Fts3GetVarint32(p1, &iCol1);\r\n  }\r\n  if( *p2==POS_COLUMN ){ \r\n    p2++;\r\n    p2 += sqlite3Fts3GetVarint32(p2, &iCol2);\r\n  }\r\n\r\n  while( 1 ){\r\n    if( iCol1==iCol2 ){\r\n      char *pSave = p;\r\n      sqlite3_int64 iPrev = 0;\r\n      sqlite3_int64 iPos1 = 0;\r\n      sqlite3_int64 iPos2 = 0;\r\n\r\n      if( iCol1 ){\r\n        *p++ = POS_COLUMN;\r\n        p += sqlite3Fts3PutVarint(p, iCol1);\r\n      }\r\n\r\n      assert( *p1!=POS_END && *p1!=POS_COLUMN );\r\n      assert( *p2!=POS_END && *p2!=POS_COLUMN );\r\n      fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2;\r\n      fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2;\r\n\r\n      while( 1 ){\r\n        if( iPos2==iPos1+nToken \r\n         || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken) \r\n        ){\r\n          sqlite3_int64 iSave;\r\n          iSave = isSaveLeft ? iPos1 : iPos2;\r\n          fts3PutDeltaVarint(&p, &iPrev, iSave+2); iPrev -= 2;\r\n          pSave = 0;\r\n          assert( p );\r\n        }\r\n        if( (!isSaveLeft && iPos2<=(iPos1+nToken)) || iPos2<=iPos1 ){\r\n          if( (*p2&0xFE)==0 ) break;\r\n          fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2;\r\n        }else{\r\n          if( (*p1&0xFE)==0 ) break;\r\n          fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2;\r\n        }\r\n      }\r\n\r\n      if( pSave ){\r\n        assert( pp && p );\r\n        p = pSave;\r\n      }\r\n\r\n      fts3ColumnlistCopy(0, &p1);\r\n      fts3ColumnlistCopy(0, &p2);\r\n      assert( (*p1&0xFE)==0 && (*p2&0xFE)==0 );\r\n      if( 0==*p1 || 0==*p2 ) break;\r\n\r\n      p1++;\r\n      p1 += sqlite3Fts3GetVarint32(p1, &iCol1);\r\n      p2++;\r\n      p2 += sqlite3Fts3GetVarint32(p2, &iCol2);\r\n    }\r\n\r\n    /* Advance pointer p1 or p2 (whichever corresponds to the smaller of\r\n    ** iCol1 and iCol2) so that it points to either the 0x00 that marks the\r\n    ** end of the position list, or the 0x01 that precedes the next \r\n    ** column-number in the position list. \r\n    */\r\n    else if( iCol1<iCol2 ){\r\n      fts3ColumnlistCopy(0, &p1);\r\n      if( 0==*p1 ) break;\r\n      p1++;\r\n      p1 += sqlite3Fts3GetVarint32(p1, &iCol1);\r\n    }else{\r\n      fts3ColumnlistCopy(0, &p2);\r\n      if( 0==*p2 ) break;\r\n      p2++;\r\n      p2 += sqlite3Fts3GetVarint32(p2, &iCol2);\r\n    }\r\n  }\r\n\r\n  fts3PoslistCopy(0, &p2);\r\n  fts3PoslistCopy(0, &p1);\r\n  *pp1 = p1;\r\n  *pp2 = p2;\r\n  if( *pp==p ){\r\n    return 0;\r\n  }\r\n  *p++ = 0x00;\r\n  *pp = p;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Merge two position-lists as required by the NEAR operator. The argument\r\n** position lists correspond to the left and right phrases of an expression \r\n** like:\r\n**\r\n**     \"phrase 1\" NEAR \"phrase number 2\"\r\n**\r\n** Position list *pp1 corresponds to the left-hand side of the NEAR \r\n** expression and *pp2 to the right. As usual, the indexes in the position \r\n** lists are the offsets of the last token in each phrase (tokens \"1\" and \"2\" \r\n** in the example above).\r\n**\r\n** The output position list - written to *pp - is a copy of *pp2 with those\r\n** entries that are not sufficiently NEAR entries in *pp1 removed.\r\n*/\r\nstatic int fts3PoslistNearMerge(\r\n  char **pp,                      /* Output buffer */\r\n  char *aTmp,                     /* Temporary buffer space */\r\n  int nRight,                     /* Maximum difference in token positions */\r\n  int nLeft,                      /* Maximum difference in token positions */\r\n  char **pp1,                     /* IN/OUT: Left input list */\r\n  char **pp2                      /* IN/OUT: Right input list */\r\n){\r\n  char *p1 = *pp1;\r\n  char *p2 = *pp2;\r\n\r\n  char *pTmp1 = aTmp;\r\n  char *pTmp2;\r\n  char *aTmp2;\r\n  int res = 1;\r\n\r\n  fts3PoslistPhraseMerge(&pTmp1, nRight, 0, 0, pp1, pp2);\r\n  aTmp2 = pTmp2 = pTmp1;\r\n  *pp1 = p1;\r\n  *pp2 = p2;\r\n  fts3PoslistPhraseMerge(&pTmp2, nLeft, 1, 0, pp2, pp1);\r\n  if( pTmp1!=aTmp && pTmp2!=aTmp2 ){\r\n    fts3PoslistMerge(pp, &aTmp, &aTmp2);\r\n  }else if( pTmp1!=aTmp ){\r\n    fts3PoslistCopy(pp, &aTmp);\r\n  }else if( pTmp2!=aTmp2 ){\r\n    fts3PoslistCopy(pp, &aTmp2);\r\n  }else{\r\n    res = 0;\r\n  }\r\n\r\n  return res;\r\n}\r\n\r\n/* \r\n** An instance of this function is used to merge together the (potentially\r\n** large number of) doclists for each term that matches a prefix query.\r\n** See function fts3TermSelectMerge() for details.\r\n*/\r\ntypedef struct TermSelect TermSelect;\r\nstruct TermSelect {\r\n  char *aaOutput[16];             /* Malloc'd output buffers */\r\n  int anOutput[16];               /* Size each output buffer in bytes */\r\n};\r\n\r\n/*\r\n** This function is used to read a single varint from a buffer. Parameter\r\n** pEnd points 1 byte past the end of the buffer. When this function is\r\n** called, if *pp points to pEnd or greater, then the end of the buffer\r\n** has been reached. In this case *pp is set to 0 and the function returns.\r\n**\r\n** If *pp does not point to or past pEnd, then a single varint is read\r\n** from *pp. *pp is then set to point 1 byte past the end of the read varint.\r\n**\r\n** If bDescIdx is false, the value read is added to *pVal before returning.\r\n** If it is true, the value read is subtracted from *pVal before this \r\n** function returns.\r\n*/\r\nstatic void fts3GetDeltaVarint3(\r\n  char **pp,                      /* IN/OUT: Point to read varint from */\r\n  char *pEnd,                     /* End of buffer */\r\n  int bDescIdx,                   /* True if docids are descending */\r\n  sqlite3_int64 *pVal             /* IN/OUT: Integer value */\r\n){\r\n  if( *pp>=pEnd ){\r\n    *pp = 0;\r\n  }else{\r\n    sqlite3_int64 iVal;\r\n    *pp += sqlite3Fts3GetVarint(*pp, &iVal);\r\n    if( bDescIdx ){\r\n      *pVal -= iVal;\r\n    }else{\r\n      *pVal += iVal;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** This function is used to write a single varint to a buffer. The varint\r\n** is written to *pp. Before returning, *pp is set to point 1 byte past the\r\n** end of the value written.\r\n**\r\n** If *pbFirst is zero when this function is called, the value written to\r\n** the buffer is that of parameter iVal. \r\n**\r\n** If *pbFirst is non-zero when this function is called, then the value \r\n** written is either (iVal-*piPrev) (if bDescIdx is zero) or (*piPrev-iVal)\r\n** (if bDescIdx is non-zero).\r\n**\r\n** Before returning, this function always sets *pbFirst to 1 and *piPrev\r\n** to the value of parameter iVal.\r\n*/\r\nstatic void fts3PutDeltaVarint3(\r\n  char **pp,                      /* IN/OUT: Output pointer */\r\n  int bDescIdx,                   /* True for descending docids */\r\n  sqlite3_int64 *piPrev,          /* IN/OUT: Previous value written to list */\r\n  int *pbFirst,                   /* IN/OUT: True after first int written */\r\n  sqlite3_int64 iVal              /* Write this value to the list */\r\n){\r\n  sqlite3_int64 iWrite;\r\n  if( bDescIdx==0 || *pbFirst==0 ){\r\n    iWrite = iVal - *piPrev;\r\n  }else{\r\n    iWrite = *piPrev - iVal;\r\n  }\r\n  assert( *pbFirst || *piPrev==0 );\r\n  assert( *pbFirst==0 || iWrite>0 );\r\n  *pp += sqlite3Fts3PutVarint(*pp, iWrite);\r\n  *piPrev = iVal;\r\n  *pbFirst = 1;\r\n}\r\n\r\n\r\n/*\r\n** This macro is used by various functions that merge doclists. The two\r\n** arguments are 64-bit docid values. If the value of the stack variable\r\n** bDescDoclist is 0 when this macro is invoked, then it returns (i1-i2). \r\n** Otherwise, (i2-i1).\r\n**\r\n** Using this makes it easier to write code that can merge doclists that are\r\n** sorted in either ascending or descending order.\r\n*/\r\n#define DOCID_CMP(i1, i2) ((bDescDoclist?-1:1) * (i1-i2))\r\n\r\n/*\r\n** This function does an \"OR\" merge of two doclists (output contains all\r\n** positions contained in either argument doclist). If the docids in the \r\n** input doclists are sorted in ascending order, parameter bDescDoclist\r\n** should be false. If they are sorted in ascending order, it should be\r\n** passed a non-zero value.\r\n**\r\n** If no error occurs, *paOut is set to point at an sqlite3_malloc'd buffer\r\n** containing the output doclist and SQLITE_OK is returned. In this case\r\n** *pnOut is set to the number of bytes in the output doclist.\r\n**\r\n** If an error occurs, an SQLite error code is returned. The output values\r\n** are undefined in this case.\r\n*/\r\nstatic int fts3DoclistOrMerge(\r\n  int bDescDoclist,               /* True if arguments are desc */\r\n  char *a1, int n1,               /* First doclist */\r\n  char *a2, int n2,               /* Second doclist */\r\n  char **paOut, int *pnOut        /* OUT: Malloc'd doclist */\r\n){\r\n  sqlite3_int64 i1 = 0;\r\n  sqlite3_int64 i2 = 0;\r\n  sqlite3_int64 iPrev = 0;\r\n  char *pEnd1 = &a1[n1];\r\n  char *pEnd2 = &a2[n2];\r\n  char *p1 = a1;\r\n  char *p2 = a2;\r\n  char *p;\r\n  char *aOut;\r\n  int bFirstOut = 0;\r\n\r\n  *paOut = 0;\r\n  *pnOut = 0;\r\n\r\n  /* Allocate space for the output. Both the input and output doclists\r\n  ** are delta encoded. If they are in ascending order (bDescDoclist==0),\r\n  ** then the first docid in each list is simply encoded as a varint. For\r\n  ** each subsequent docid, the varint stored is the difference between the\r\n  ** current and previous docid (a positive number - since the list is in\r\n  ** ascending order).\r\n  **\r\n  ** The first docid written to the output is therefore encoded using the \r\n  ** same number of bytes as it is in whichever of the input lists it is\r\n  ** read from. And each subsequent docid read from the same input list \r\n  ** consumes either the same or less bytes as it did in the input (since\r\n  ** the difference between it and the previous value in the output must\r\n  ** be a positive value less than or equal to the delta value read from \r\n  ** the input list). The same argument applies to all but the first docid\r\n  ** read from the 'other' list. And to the contents of all position lists\r\n  ** that will be copied and merged from the input to the output.\r\n  **\r\n  ** However, if the first docid copied to the output is a negative number,\r\n  ** then the encoding of the first docid from the 'other' input list may\r\n  ** be larger in the output than it was in the input (since the delta value\r\n  ** may be a larger positive integer than the actual docid).\r\n  **\r\n  ** The space required to store the output is therefore the sum of the\r\n  ** sizes of the two inputs, plus enough space for exactly one of the input\r\n  ** docids to grow. \r\n  **\r\n  ** A symetric argument may be made if the doclists are in descending \r\n  ** order.\r\n  */\r\n  aOut = sqlite3_malloc(n1+n2+FTS3_VARINT_MAX-1);\r\n  if( !aOut ) return SQLITE_NOMEM;\r\n\r\n  p = aOut;\r\n  fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);\r\n  fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);\r\n  while( p1 || p2 ){\r\n    sqlite3_int64 iDiff = DOCID_CMP(i1, i2);\r\n\r\n    if( p2 && p1 && iDiff==0 ){\r\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1);\r\n      fts3PoslistMerge(&p, &p1, &p2);\r\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\r\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\r\n    }else if( !p2 || (p1 && iDiff<0) ){\r\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1);\r\n      fts3PoslistCopy(&p, &p1);\r\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\r\n    }else{\r\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i2);\r\n      fts3PoslistCopy(&p, &p2);\r\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\r\n    }\r\n  }\r\n\r\n  *paOut = aOut;\r\n  *pnOut = (int)(p-aOut);\r\n  assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function does a \"phrase\" merge of two doclists. In a phrase merge,\r\n** the output contains a copy of each position from the right-hand input\r\n** doclist for which there is a position in the left-hand input doclist\r\n** exactly nDist tokens before it.\r\n**\r\n** If the docids in the input doclists are sorted in ascending order,\r\n** parameter bDescDoclist should be false. If they are sorted in ascending \r\n** order, it should be passed a non-zero value.\r\n**\r\n** The right-hand input doclist is overwritten by this function.\r\n*/\r\nstatic void fts3DoclistPhraseMerge(\r\n  int bDescDoclist,               /* True if arguments are desc */\r\n  int nDist,                      /* Distance from left to right (1=adjacent) */\r\n  char *aLeft, int nLeft,         /* Left doclist */\r\n  char *aRight, int *pnRight      /* IN/OUT: Right/output doclist */\r\n){\r\n  sqlite3_int64 i1 = 0;\r\n  sqlite3_int64 i2 = 0;\r\n  sqlite3_int64 iPrev = 0;\r\n  char *pEnd1 = &aLeft[nLeft];\r\n  char *pEnd2 = &aRight[*pnRight];\r\n  char *p1 = aLeft;\r\n  char *p2 = aRight;\r\n  char *p;\r\n  int bFirstOut = 0;\r\n  char *aOut = aRight;\r\n\r\n  assert( nDist>0 );\r\n\r\n  p = aOut;\r\n  fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);\r\n  fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);\r\n\r\n  while( p1 && p2 ){\r\n    sqlite3_int64 iDiff = DOCID_CMP(i1, i2);\r\n    if( iDiff==0 ){\r\n      char *pSave = p;\r\n      sqlite3_int64 iPrevSave = iPrev;\r\n      int bFirstOutSave = bFirstOut;\r\n\r\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1);\r\n      if( 0==fts3PoslistPhraseMerge(&p, nDist, 0, 1, &p1, &p2) ){\r\n        p = pSave;\r\n        iPrev = iPrevSave;\r\n        bFirstOut = bFirstOutSave;\r\n      }\r\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\r\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\r\n    }else if( iDiff<0 ){\r\n      fts3PoslistCopy(0, &p1);\r\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\r\n    }else{\r\n      fts3PoslistCopy(0, &p2);\r\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\r\n    }\r\n  }\r\n\r\n  *pnRight = (int)(p - aOut);\r\n}\r\n\r\n/*\r\n** Argument pList points to a position list nList bytes in size. This\r\n** function checks to see if the position list contains any entries for\r\n** a token in position 0 (of any column). If so, it writes argument iDelta\r\n** to the output buffer pOut, followed by a position list consisting only\r\n** of the entries from pList at position 0, and terminated by an 0x00 byte.\r\n** The value returned is the number of bytes written to pOut (if any).\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3FirstFilter(\r\n  sqlite3_int64 iDelta,           /* Varint that may be written to pOut */\r\n  char *pList,                    /* Position list (no 0x00 term) */\r\n  int nList,                      /* Size of pList in bytes */\r\n  char *pOut                      /* Write output here */\r\n){\r\n  int nOut = 0;\r\n  int bWritten = 0;               /* True once iDelta has been written */\r\n  char *p = pList;\r\n  char *pEnd = &pList[nList];\r\n\r\n  if( *p!=0x01 ){\r\n    if( *p==0x02 ){\r\n      nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta);\r\n      pOut[nOut++] = 0x02;\r\n      bWritten = 1;\r\n    }\r\n    fts3ColumnlistCopy(0, &p);\r\n  }\r\n\r\n  while( p<pEnd && *p==0x01 ){\r\n    sqlite3_int64 iCol;\r\n    p++;\r\n    p += sqlite3Fts3GetVarint(p, &iCol);\r\n    if( *p==0x02 ){\r\n      if( bWritten==0 ){\r\n        nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta);\r\n        bWritten = 1;\r\n      }\r\n      pOut[nOut++] = 0x01;\r\n      nOut += sqlite3Fts3PutVarint(&pOut[nOut], iCol);\r\n      pOut[nOut++] = 0x02;\r\n    }\r\n    fts3ColumnlistCopy(0, &p);\r\n  }\r\n  if( bWritten ){\r\n    pOut[nOut++] = 0x00;\r\n  }\r\n\r\n  return nOut;\r\n}\r\n\r\n\r\n/*\r\n** Merge all doclists in the TermSelect.aaOutput[] array into a single\r\n** doclist stored in TermSelect.aaOutput[0]. If successful, delete all\r\n** other doclists (except the aaOutput[0] one) and return SQLITE_OK.\r\n**\r\n** If an OOM error occurs, return SQLITE_NOMEM. In this case it is\r\n** the responsibility of the caller to free any doclists left in the\r\n** TermSelect.aaOutput[] array.\r\n*/\r\nstatic int fts3TermSelectFinishMerge(Fts3Table *p, TermSelect *pTS){\r\n  char *aOut = 0;\r\n  int nOut = 0;\r\n  int i;\r\n\r\n  /* Loop through the doclists in the aaOutput[] array. Merge them all\r\n  ** into a single doclist.\r\n  */\r\n  for(i=0; i<SizeofArray(pTS->aaOutput); i++){\r\n    if( pTS->aaOutput[i] ){\r\n      if( !aOut ){\r\n        aOut = pTS->aaOutput[i];\r\n        nOut = pTS->anOutput[i];\r\n        pTS->aaOutput[i] = 0;\r\n      }else{\r\n        int nNew;\r\n        char *aNew;\r\n\r\n        int rc = fts3DoclistOrMerge(p->bDescIdx, \r\n            pTS->aaOutput[i], pTS->anOutput[i], aOut, nOut, &aNew, &nNew\r\n        );\r\n        if( rc!=SQLITE_OK ){\r\n          sqlite3_free(aOut);\r\n          return rc;\r\n        }\r\n\r\n        sqlite3_free(pTS->aaOutput[i]);\r\n        sqlite3_free(aOut);\r\n        pTS->aaOutput[i] = 0;\r\n        aOut = aNew;\r\n        nOut = nNew;\r\n      }\r\n    }\r\n  }\r\n\r\n  pTS->aaOutput[0] = aOut;\r\n  pTS->anOutput[0] = nOut;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Merge the doclist aDoclist/nDoclist into the TermSelect object passed\r\n** as the first argument. The merge is an \"OR\" merge (see function\r\n** fts3DoclistOrMerge() for details).\r\n**\r\n** This function is called with the doclist for each term that matches\r\n** a queried prefix. It merges all these doclists into one, the doclist\r\n** for the specified prefix. Since there can be a very large number of\r\n** doclists to merge, the merging is done pair-wise using the TermSelect\r\n** object.\r\n**\r\n** This function returns SQLITE_OK if the merge is successful, or an\r\n** SQLite error code (SQLITE_NOMEM) if an error occurs.\r\n*/\r\nstatic int fts3TermSelectMerge(\r\n  Fts3Table *p,                   /* FTS table handle */\r\n  TermSelect *pTS,                /* TermSelect object to merge into */\r\n  char *aDoclist,                 /* Pointer to doclist */\r\n  int nDoclist                    /* Size of aDoclist in bytes */\r\n){\r\n  if( pTS->aaOutput[0]==0 ){\r\n    /* If this is the first term selected, copy the doclist to the output\r\n    ** buffer using memcpy(). */\r\n    pTS->aaOutput[0] = sqlite3_malloc(nDoclist);\r\n    pTS->anOutput[0] = nDoclist;\r\n    if( pTS->aaOutput[0] ){\r\n      memcpy(pTS->aaOutput[0], aDoclist, nDoclist);\r\n    }else{\r\n      return SQLITE_NOMEM;\r\n    }\r\n  }else{\r\n    char *aMerge = aDoclist;\r\n    int nMerge = nDoclist;\r\n    int iOut;\r\n\r\n    for(iOut=0; iOut<SizeofArray(pTS->aaOutput); iOut++){\r\n      if( pTS->aaOutput[iOut]==0 ){\r\n        assert( iOut>0 );\r\n        pTS->aaOutput[iOut] = aMerge;\r\n        pTS->anOutput[iOut] = nMerge;\r\n        break;\r\n      }else{\r\n        char *aNew;\r\n        int nNew;\r\n\r\n        int rc = fts3DoclistOrMerge(p->bDescIdx, aMerge, nMerge, \r\n            pTS->aaOutput[iOut], pTS->anOutput[iOut], &aNew, &nNew\r\n        );\r\n        if( rc!=SQLITE_OK ){\r\n          if( aMerge!=aDoclist ) sqlite3_free(aMerge);\r\n          return rc;\r\n        }\r\n\r\n        if( aMerge!=aDoclist ) sqlite3_free(aMerge);\r\n        sqlite3_free(pTS->aaOutput[iOut]);\r\n        pTS->aaOutput[iOut] = 0;\r\n  \r\n        aMerge = aNew;\r\n        nMerge = nNew;\r\n        if( (iOut+1)==SizeofArray(pTS->aaOutput) ){\r\n          pTS->aaOutput[iOut] = aMerge;\r\n          pTS->anOutput[iOut] = nMerge;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Append SegReader object pNew to the end of the pCsr->apSegment[] array.\r\n*/\r\nstatic int fts3SegReaderCursorAppend(\r\n  Fts3MultiSegReader *pCsr, \r\n  Fts3SegReader *pNew\r\n){\r\n  if( (pCsr->nSegment%16)==0 ){\r\n    Fts3SegReader **apNew;\r\n    int nByte = (pCsr->nSegment + 16)*sizeof(Fts3SegReader*);\r\n    apNew = (Fts3SegReader **)sqlite3_realloc(pCsr->apSegment, nByte);\r\n    if( !apNew ){\r\n      sqlite3Fts3SegReaderFree(pNew);\r\n      return SQLITE_NOMEM;\r\n    }\r\n    pCsr->apSegment = apNew;\r\n  }\r\n  pCsr->apSegment[pCsr->nSegment++] = pNew;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Add seg-reader objects to the Fts3MultiSegReader object passed as the\r\n** 8th argument.\r\n**\r\n** This function returns SQLITE_OK if successful, or an SQLite error code\r\n** otherwise.\r\n*/\r\nstatic int fts3SegReaderCursor(\r\n  Fts3Table *p,                   /* FTS3 table handle */\r\n  int iLangid,                    /* Language id */\r\n  int iIndex,                     /* Index to search (from 0 to p->nIndex-1) */\r\n  int iLevel,                     /* Level of segments to scan */\r\n  const char *zTerm,              /* Term to query for */\r\n  int nTerm,                      /* Size of zTerm in bytes */\r\n  int isPrefix,                   /* True for a prefix search */\r\n  int isScan,                     /* True to scan from zTerm to EOF */\r\n  Fts3MultiSegReader *pCsr        /* Cursor object to populate */\r\n){\r\n  int rc = SQLITE_OK;             /* Error code */\r\n  sqlite3_stmt *pStmt = 0;        /* Statement to iterate through segments */\r\n  int rc2;                        /* Result of sqlite3_reset() */\r\n\r\n  /* If iLevel is less than 0 and this is not a scan, include a seg-reader \r\n  ** for the pending-terms. If this is a scan, then this call must be being\r\n  ** made by an fts4aux module, not an FTS table. In this case calling\r\n  ** Fts3SegReaderPending might segfault, as the data structures used by \r\n  ** fts4aux are not completely populated. So it's easiest to filter these\r\n  ** calls out here.  */\r\n  if( iLevel<0 && p->aIndex ){\r\n    Fts3SegReader *pSeg = 0;\r\n    rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix, &pSeg);\r\n    if( rc==SQLITE_OK && pSeg ){\r\n      rc = fts3SegReaderCursorAppend(pCsr, pSeg);\r\n    }\r\n  }\r\n\r\n  if( iLevel!=FTS3_SEGCURSOR_PENDING ){\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3Fts3AllSegdirs(p, iLangid, iIndex, iLevel, &pStmt);\r\n    }\r\n\r\n    while( rc==SQLITE_OK && SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){\r\n      Fts3SegReader *pSeg = 0;\r\n\r\n      /* Read the values returned by the SELECT into local variables. */\r\n      sqlite3_int64 iStartBlock = sqlite3_column_int64(pStmt, 1);\r\n      sqlite3_int64 iLeavesEndBlock = sqlite3_column_int64(pStmt, 2);\r\n      sqlite3_int64 iEndBlock = sqlite3_column_int64(pStmt, 3);\r\n      int nRoot = sqlite3_column_bytes(pStmt, 4);\r\n      char const *zRoot = sqlite3_column_blob(pStmt, 4);\r\n\r\n      /* If zTerm is not NULL, and this segment is not stored entirely on its\r\n      ** root node, the range of leaves scanned can be reduced. Do this. */\r\n      if( iStartBlock && zTerm ){\r\n        sqlite3_int64 *pi = (isPrefix ? &iLeavesEndBlock : 0);\r\n        rc = fts3SelectLeaf(p, zTerm, nTerm, zRoot, nRoot, &iStartBlock, pi);\r\n        if( rc!=SQLITE_OK ) goto finished;\r\n        if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;\r\n      }\r\n \r\n      rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1, \r\n          (isPrefix==0 && isScan==0),\r\n          iStartBlock, iLeavesEndBlock, \r\n          iEndBlock, zRoot, nRoot, &pSeg\r\n      );\r\n      if( rc!=SQLITE_OK ) goto finished;\r\n      rc = fts3SegReaderCursorAppend(pCsr, pSeg);\r\n    }\r\n  }\r\n\r\n finished:\r\n  rc2 = sqlite3_reset(pStmt);\r\n  if( rc==SQLITE_DONE ) rc = rc2;\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set up a cursor object for iterating through a full-text index or a \r\n** single level therein.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderCursor(\r\n  Fts3Table *p,                   /* FTS3 table handle */\r\n  int iLangid,\r\n  int iIndex,                     /* Index to search (from 0 to p->nIndex-1) */\r\n  int iLevel,                     /* Level of segments to scan */\r\n  const char *zTerm,              /* Term to query for */\r\n  int nTerm,                      /* Size of zTerm in bytes */\r\n  int isPrefix,                   /* True for a prefix search */\r\n  int isScan,                     /* True to scan from zTerm to EOF */\r\n  Fts3MultiSegReader *pCsr       /* Cursor object to populate */\r\n){\r\n  assert( iIndex>=0 && iIndex<p->nIndex );\r\n  assert( iLevel==FTS3_SEGCURSOR_ALL\r\n      ||  iLevel==FTS3_SEGCURSOR_PENDING \r\n      ||  iLevel>=0\r\n  );\r\n  assert( iLevel<FTS3_SEGDIR_MAXLEVEL );\r\n  assert( FTS3_SEGCURSOR_ALL<0 && FTS3_SEGCURSOR_PENDING<0 );\r\n  assert( isPrefix==0 || isScan==0 );\r\n\r\n  /* \"isScan\" is only set to true by the ft4aux module, an ordinary\r\n  ** full-text tables. */\r\n  assert( isScan==0 || p->aIndex==0 );\r\n\r\n  memset(pCsr, 0, sizeof(Fts3MultiSegReader));\r\n\r\n  return fts3SegReaderCursor(\r\n      p, iLangid, iIndex, iLevel, zTerm, nTerm, isPrefix, isScan, pCsr\r\n  );\r\n}\r\n\r\n/*\r\n** In addition to its current configuration, have the Fts3MultiSegReader\r\n** passed as the 4th argument also scan the doclist for term zTerm/nTerm.\r\n**\r\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\r\n*/\r\nstatic int fts3SegReaderCursorAddZero(\r\n  Fts3Table *p,                   /* FTS virtual table handle */\r\n  int iLangid,\r\n  const char *zTerm,              /* Term to scan doclist of */\r\n  int nTerm,                      /* Number of bytes in zTerm */\r\n  Fts3MultiSegReader *pCsr        /* Fts3MultiSegReader to modify */\r\n){\r\n  return fts3SegReaderCursor(p, \r\n      iLangid, 0, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 0, 0,pCsr\r\n  );\r\n}\r\n\r\n/*\r\n** Open an Fts3MultiSegReader to scan the doclist for term zTerm/nTerm. Or,\r\n** if isPrefix is true, to scan the doclist for all terms for which \r\n** zTerm/nTerm is a prefix. If successful, return SQLITE_OK and write\r\n** a pointer to the new Fts3MultiSegReader to *ppSegcsr. Otherwise, return\r\n** an SQLite error code.\r\n**\r\n** It is the responsibility of the caller to free this object by eventually\r\n** passing it to fts3SegReaderCursorFree() \r\n**\r\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\r\n** Output parameter *ppSegcsr is set to 0 if an error occurs.\r\n*/\r\nstatic int fts3TermSegReaderCursor(\r\n  Fts3Cursor *pCsr,               /* Virtual table cursor handle */\r\n  const char *zTerm,              /* Term to query for */\r\n  int nTerm,                      /* Size of zTerm in bytes */\r\n  int isPrefix,                   /* True for a prefix search */\r\n  Fts3MultiSegReader **ppSegcsr   /* OUT: Allocated seg-reader cursor */\r\n){\r\n  Fts3MultiSegReader *pSegcsr;    /* Object to allocate and return */\r\n  int rc = SQLITE_NOMEM;          /* Return code */\r\n\r\n  pSegcsr = sqlite3_malloc(sizeof(Fts3MultiSegReader));\r\n  if( pSegcsr ){\r\n    int i;\r\n    int bFound = 0;               /* True once an index has been found */\r\n    Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;\r\n\r\n    if( isPrefix ){\r\n      for(i=1; bFound==0 && i<p->nIndex; i++){\r\n        if( p->aIndex[i].nPrefix==nTerm ){\r\n          bFound = 1;\r\n          rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, \r\n              i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 0, 0, pSegcsr\r\n          );\r\n          pSegcsr->bLookup = 1;\r\n        }\r\n      }\r\n\r\n      for(i=1; bFound==0 && i<p->nIndex; i++){\r\n        if( p->aIndex[i].nPrefix==nTerm+1 ){\r\n          bFound = 1;\r\n          rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, \r\n              i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 1, 0, pSegcsr\r\n          );\r\n          if( rc==SQLITE_OK ){\r\n            rc = fts3SegReaderCursorAddZero(\r\n                p, pCsr->iLangid, zTerm, nTerm, pSegcsr\r\n            );\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    if( bFound==0 ){\r\n      rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, \r\n          0, FTS3_SEGCURSOR_ALL, zTerm, nTerm, isPrefix, 0, pSegcsr\r\n      );\r\n      pSegcsr->bLookup = !isPrefix;\r\n    }\r\n  }\r\n\r\n  *ppSegcsr = pSegcsr;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Free an Fts3MultiSegReader allocated by fts3TermSegReaderCursor().\r\n*/\r\nstatic void fts3SegReaderCursorFree(Fts3MultiSegReader *pSegcsr){\r\n  sqlite3Fts3SegReaderFinish(pSegcsr);\r\n  sqlite3_free(pSegcsr);\r\n}\r\n\r\n/*\r\n** This function retreives the doclist for the specified term (or term\r\n** prefix) from the database.\r\n*/\r\nstatic int fts3TermSelect(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  Fts3PhraseToken *pTok,          /* Token to query for */\r\n  int iColumn,                    /* Column to query (or -ve for all columns) */\r\n  int *pnOut,                     /* OUT: Size of buffer at *ppOut */\r\n  char **ppOut                    /* OUT: Malloced result buffer */\r\n){\r\n  int rc;                         /* Return code */\r\n  Fts3MultiSegReader *pSegcsr;    /* Seg-reader cursor for this term */\r\n  TermSelect tsc;                 /* Object for pair-wise doclist merging */\r\n  Fts3SegFilter filter;           /* Segment term filter configuration */\r\n\r\n  pSegcsr = pTok->pSegcsr;\r\n  memset(&tsc, 0, sizeof(TermSelect));\r\n\r\n  filter.flags = FTS3_SEGMENT_IGNORE_EMPTY | FTS3_SEGMENT_REQUIRE_POS\r\n        | (pTok->isPrefix ? FTS3_SEGMENT_PREFIX : 0)\r\n        | (pTok->bFirst ? FTS3_SEGMENT_FIRST : 0)\r\n        | (iColumn<p->nColumn ? FTS3_SEGMENT_COLUMN_FILTER : 0);\r\n  filter.iCol = iColumn;\r\n  filter.zTerm = pTok->z;\r\n  filter.nTerm = pTok->n;\r\n\r\n  rc = sqlite3Fts3SegReaderStart(p, pSegcsr, &filter);\r\n  while( SQLITE_OK==rc\r\n      && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pSegcsr)) \r\n  ){\r\n    rc = fts3TermSelectMerge(p, &tsc, pSegcsr->aDoclist, pSegcsr->nDoclist);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    rc = fts3TermSelectFinishMerge(p, &tsc);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    *ppOut = tsc.aaOutput[0];\r\n    *pnOut = tsc.anOutput[0];\r\n  }else{\r\n    int i;\r\n    for(i=0; i<SizeofArray(tsc.aaOutput); i++){\r\n      sqlite3_free(tsc.aaOutput[i]);\r\n    }\r\n  }\r\n\r\n  fts3SegReaderCursorFree(pSegcsr);\r\n  pTok->pSegcsr = 0;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function counts the total number of docids in the doclist stored\r\n** in buffer aList[], size nList bytes.\r\n**\r\n** If the isPoslist argument is true, then it is assumed that the doclist\r\n** contains a position-list following each docid. Otherwise, it is assumed\r\n** that the doclist is simply a list of docids stored as delta encoded \r\n** varints.\r\n*/\r\nstatic int fts3DoclistCountDocids(char *aList, int nList){\r\n  int nDoc = 0;                   /* Return value */\r\n  if( aList ){\r\n    char *aEnd = &aList[nList];   /* Pointer to one byte after EOF */\r\n    char *p = aList;              /* Cursor */\r\n    while( p<aEnd ){\r\n      nDoc++;\r\n      while( (*p++)&0x80 );     /* Skip docid varint */\r\n      fts3PoslistCopy(0, &p);   /* Skip over position list */\r\n    }\r\n  }\r\n\r\n  return nDoc;\r\n}\r\n\r\n/*\r\n** Advance the cursor to the next row in the %_content table that\r\n** matches the search criteria.  For a MATCH search, this will be\r\n** the next row that matches. For a full-table scan, this will be\r\n** simply the next row in the %_content table.  For a docid lookup,\r\n** this routine simply sets the EOF flag.\r\n**\r\n** Return SQLITE_OK if nothing goes wrong.  SQLITE_OK is returned\r\n** even if we reach end-of-file.  The fts3EofMethod() will be called\r\n** subsequently to determine whether or not an EOF was hit.\r\n*/\r\nstatic int fts3NextMethod(sqlite3_vtab_cursor *pCursor){\r\n  int rc;\r\n  Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;\r\n  if( pCsr->eSearch==FTS3_DOCID_SEARCH || pCsr->eSearch==FTS3_FULLSCAN_SEARCH ){\r\n    if( SQLITE_ROW!=sqlite3_step(pCsr->pStmt) ){\r\n      pCsr->isEof = 1;\r\n      rc = sqlite3_reset(pCsr->pStmt);\r\n    }else{\r\n      pCsr->iPrevId = sqlite3_column_int64(pCsr->pStmt, 0);\r\n      rc = SQLITE_OK;\r\n    }\r\n  }else{\r\n    rc = fts3EvalNext((Fts3Cursor *)pCursor);\r\n  }\r\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This is the xFilter interface for the virtual table.  See\r\n** the virtual table xFilter method documentation for additional\r\n** information.\r\n**\r\n** If idxNum==FTS3_FULLSCAN_SEARCH then do a full table scan against\r\n** the %_content table.\r\n**\r\n** If idxNum==FTS3_DOCID_SEARCH then do a docid lookup for a single entry\r\n** in the %_content table.\r\n**\r\n** If idxNum>=FTS3_FULLTEXT_SEARCH then use the full text index.  The\r\n** column on the left-hand side of the MATCH operator is column\r\n** number idxNum-FTS3_FULLTEXT_SEARCH, 0 indexed.  argv[0] is the right-hand\r\n** side of the MATCH operator.\r\n*/\r\nstatic int fts3FilterMethod(\r\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\r\n  int idxNum,                     /* Strategy index */\r\n  const char *idxStr,             /* Unused */\r\n  int nVal,                       /* Number of elements in apVal */\r\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\r\n){\r\n  int rc;\r\n  char *zSql;                     /* SQL statement used to access %_content */\r\n  Fts3Table *p = (Fts3Table *)pCursor->pVtab;\r\n  Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;\r\n\r\n  UNUSED_PARAMETER(idxStr);\r\n  UNUSED_PARAMETER(nVal);\r\n\r\n  assert( idxNum>=0 && idxNum<=(FTS3_FULLTEXT_SEARCH+p->nColumn) );\r\n  assert( nVal==0 || nVal==1 || nVal==2 );\r\n  assert( (nVal==0)==(idxNum==FTS3_FULLSCAN_SEARCH) );\r\n  assert( p->pSegments==0 );\r\n\r\n  /* In case the cursor has been used before, clear it now. */\r\n  sqlite3_finalize(pCsr->pStmt);\r\n  sqlite3_free(pCsr->aDoclist);\r\n  sqlite3Fts3ExprFree(pCsr->pExpr);\r\n  memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));\r\n\r\n  if( idxStr ){\r\n    pCsr->bDesc = (idxStr[0]=='D');\r\n  }else{\r\n    pCsr->bDesc = p->bDescIdx;\r\n  }\r\n  pCsr->eSearch = (i16)idxNum;\r\n\r\n  if( idxNum!=FTS3_DOCID_SEARCH && idxNum!=FTS3_FULLSCAN_SEARCH ){\r\n    int iCol = idxNum-FTS3_FULLTEXT_SEARCH;\r\n    const char *zQuery = (const char *)sqlite3_value_text(apVal[0]);\r\n\r\n    if( zQuery==0 && sqlite3_value_type(apVal[0])!=SQLITE_NULL ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n\r\n    pCsr->iLangid = 0;\r\n    if( nVal==2 ) pCsr->iLangid = sqlite3_value_int(apVal[1]);\r\n\r\n    rc = sqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid,\r\n        p->azColumn, p->bHasStat, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr\r\n    );\r\n    if( rc!=SQLITE_OK ){\r\n      if( rc==SQLITE_ERROR ){\r\n        static const char *zErr = \"malformed MATCH expression: [%s]\";\r\n        p->base.zErrMsg = sqlite3_mprintf(zErr, zQuery);\r\n      }\r\n      return rc;\r\n    }\r\n\r\n    rc = sqlite3Fts3ReadLock(p);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n\r\n    rc = fts3EvalStart(pCsr);\r\n\r\n    sqlite3Fts3SegmentsClose(p);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n    pCsr->pNextId = pCsr->aDoclist;\r\n    pCsr->iPrevId = 0;\r\n  }\r\n\r\n  /* Compile a SELECT statement for this cursor. For a full-table-scan, the\r\n  ** statement loops through all rows of the %_content table. For a\r\n  ** full-text query or docid lookup, the statement retrieves a single\r\n  ** row by docid.\r\n  */\r\n  if( idxNum==FTS3_FULLSCAN_SEARCH ){\r\n    zSql = sqlite3_mprintf(\r\n        \"SELECT %s ORDER BY rowid %s\",\r\n        p->zReadExprlist, (pCsr->bDesc ? \"DESC\" : \"ASC\")\r\n    );\r\n    if( zSql ){\r\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);\r\n      sqlite3_free(zSql);\r\n    }else{\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n  }else if( idxNum==FTS3_DOCID_SEARCH ){\r\n    rc = fts3CursorSeekStmt(pCsr, &pCsr->pStmt);\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3_bind_value(pCsr->pStmt, 1, apVal[0]);\r\n    }\r\n  }\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  return fts3NextMethod(pCursor);\r\n}\r\n\r\n/* \r\n** This is the xEof method of the virtual table. SQLite calls this \r\n** routine to find out if it has reached the end of a result set.\r\n*/\r\nstatic int fts3EofMethod(sqlite3_vtab_cursor *pCursor){\r\n  return ((Fts3Cursor *)pCursor)->isEof;\r\n}\r\n\r\n/* \r\n** This is the xRowid method. The SQLite core calls this routine to\r\n** retrieve the rowid for the current row of the result set. fts3\r\n** exposes %_content.docid as the rowid for the virtual table. The\r\n** rowid should be written to *pRowid.\r\n*/\r\nstatic int fts3RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){\r\n  Fts3Cursor *pCsr = (Fts3Cursor *) pCursor;\r\n  *pRowid = pCsr->iPrevId;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n** This is the xColumn method, called by SQLite to request a value from\r\n** the row that the supplied cursor currently points to.\r\n**\r\n** If:\r\n**\r\n**   (iCol <  p->nColumn)   -> The value of the iCol'th user column.\r\n**   (iCol == p->nColumn)   -> Magic column with the same name as the table.\r\n**   (iCol == p->nColumn+1) -> Docid column\r\n**   (iCol == p->nColumn+2) -> Langid column\r\n*/\r\nstatic int fts3ColumnMethod(\r\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\r\n  sqlite3_context *pCtx,          /* Context for sqlite3_result_xxx() calls */\r\n  int iCol                        /* Index of column to read value from */\r\n){\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n  Fts3Cursor *pCsr = (Fts3Cursor *) pCursor;\r\n  Fts3Table *p = (Fts3Table *)pCursor->pVtab;\r\n\r\n  /* The column value supplied by SQLite must be in range. */\r\n  assert( iCol>=0 && iCol<=p->nColumn+2 );\r\n\r\n  if( iCol==p->nColumn+1 ){\r\n    /* This call is a request for the \"docid\" column. Since \"docid\" is an \r\n    ** alias for \"rowid\", use the xRowid() method to obtain the value.\r\n    */\r\n    sqlite3_result_int64(pCtx, pCsr->iPrevId);\r\n  }else if( iCol==p->nColumn ){\r\n    /* The extra column whose name is the same as the table.\r\n    ** Return a blob which is a pointer to the cursor.  */\r\n    sqlite3_result_blob(pCtx, &pCsr, sizeof(pCsr), SQLITE_TRANSIENT);\r\n  }else if( iCol==p->nColumn+2 && pCsr->pExpr ){\r\n    sqlite3_result_int64(pCtx, pCsr->iLangid);\r\n  }else{\r\n    /* The requested column is either a user column (one that contains \r\n    ** indexed data), or the language-id column.  */\r\n    rc = fts3CursorSeek(0, pCsr);\r\n\r\n    if( rc==SQLITE_OK ){\r\n      if( iCol==p->nColumn+2 ){\r\n        int iLangid = 0;\r\n        if( p->zLanguageid ){\r\n          iLangid = sqlite3_column_int(pCsr->pStmt, p->nColumn+1);\r\n        }\r\n        sqlite3_result_int(pCtx, iLangid);\r\n      }else if( sqlite3_data_count(pCsr->pStmt)>(iCol+1) ){\r\n        sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1));\r\n      }\r\n    }\r\n  }\r\n\r\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\r\n  return rc;\r\n}\r\n\r\n/* \r\n** This function is the implementation of the xUpdate callback used by \r\n** FTS3 virtual tables. It is invoked by SQLite each time a row is to be\r\n** inserted, updated or deleted.\r\n*/\r\nstatic int fts3UpdateMethod(\r\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\r\n  int nArg,                       /* Size of argument array */\r\n  sqlite3_value **apVal,          /* Array of arguments */\r\n  sqlite_int64 *pRowid            /* OUT: The affected (or effected) rowid */\r\n){\r\n  return sqlite3Fts3UpdateMethod(pVtab, nArg, apVal, pRowid);\r\n}\r\n\r\n/*\r\n** Implementation of xSync() method. Flush the contents of the pending-terms\r\n** hash-table to the database.\r\n*/\r\nstatic int fts3SyncMethod(sqlite3_vtab *pVtab){\r\n  int rc = sqlite3Fts3PendingTermsFlush((Fts3Table *)pVtab);\r\n  sqlite3Fts3SegmentsClose((Fts3Table *)pVtab);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Implementation of xBegin() method. This is a no-op.\r\n*/\r\nstatic int fts3BeginMethod(sqlite3_vtab *pVtab){\r\n  TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );\r\n  UNUSED_PARAMETER(pVtab);\r\n  assert( p->pSegments==0 );\r\n  assert( p->nPendingData==0 );\r\n  assert( p->inTransaction!=1 );\r\n  TESTONLY( p->inTransaction = 1 );\r\n  TESTONLY( p->mxSavepoint = -1; );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Implementation of xCommit() method. This is a no-op. The contents of\r\n** the pending-terms hash-table have already been flushed into the database\r\n** by fts3SyncMethod().\r\n*/\r\nstatic int fts3CommitMethod(sqlite3_vtab *pVtab){\r\n  TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );\r\n  UNUSED_PARAMETER(pVtab);\r\n  assert( p->nPendingData==0 );\r\n  assert( p->inTransaction!=0 );\r\n  assert( p->pSegments==0 );\r\n  TESTONLY( p->inTransaction = 0 );\r\n  TESTONLY( p->mxSavepoint = -1; );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Implementation of xRollback(). Discard the contents of the pending-terms\r\n** hash-table. Any changes made to the database are reverted by SQLite.\r\n*/\r\nstatic int fts3RollbackMethod(sqlite3_vtab *pVtab){\r\n  Fts3Table *p = (Fts3Table*)pVtab;\r\n  sqlite3Fts3PendingTermsClear(p);\r\n  assert( p->inTransaction!=0 );\r\n  TESTONLY( p->inTransaction = 0 );\r\n  TESTONLY( p->mxSavepoint = -1; );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** When called, *ppPoslist must point to the byte immediately following the\r\n** end of a position-list. i.e. ( (*ppPoslist)[-1]==POS_END ). This function\r\n** moves *ppPoslist so that it instead points to the first byte of the\r\n** same position list.\r\n*/\r\nstatic void fts3ReversePoslist(char *pStart, char **ppPoslist){\r\n  char *p = &(*ppPoslist)[-2];\r\n  char c = 0;\r\n\r\n  while( p>pStart && (c=*p--)==0 );\r\n  while( p>pStart && (*p & 0x80) | c ){ \r\n    c = *p--; \r\n  }\r\n  if( p>pStart ){ p = &p[2]; }\r\n  while( *p++&0x80 );\r\n  *ppPoslist = p;\r\n}\r\n\r\n/*\r\n** Helper function used by the implementation of the overloaded snippet(),\r\n** offsets() and optimize() SQL functions.\r\n**\r\n** If the value passed as the third argument is a blob of size\r\n** sizeof(Fts3Cursor*), then the blob contents are copied to the \r\n** output variable *ppCsr and SQLITE_OK is returned. Otherwise, an error\r\n** message is written to context pContext and SQLITE_ERROR returned. The\r\n** string passed via zFunc is used as part of the error message.\r\n*/\r\nstatic int fts3FunctionArg(\r\n  sqlite3_context *pContext,      /* SQL function call context */\r\n  const char *zFunc,              /* Function name */\r\n  sqlite3_value *pVal,            /* argv[0] passed to function */\r\n  Fts3Cursor **ppCsr              /* OUT: Store cursor handle here */\r\n){\r\n  Fts3Cursor *pRet;\r\n  if( sqlite3_value_type(pVal)!=SQLITE_BLOB \r\n   || sqlite3_value_bytes(pVal)!=sizeof(Fts3Cursor *)\r\n  ){\r\n    char *zErr = sqlite3_mprintf(\"illegal first argument to %s\", zFunc);\r\n    sqlite3_result_error(pContext, zErr, -1);\r\n    sqlite3_free(zErr);\r\n    return SQLITE_ERROR;\r\n  }\r\n  memcpy(&pRet, sqlite3_value_blob(pVal), sizeof(Fts3Cursor *));\r\n  *ppCsr = pRet;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Implementation of the snippet() function for FTS3\r\n*/\r\nstatic void fts3SnippetFunc(\r\n  sqlite3_context *pContext,      /* SQLite function call context */\r\n  int nVal,                       /* Size of apVal[] array */\r\n  sqlite3_value **apVal           /* Array of arguments */\r\n){\r\n  Fts3Cursor *pCsr;               /* Cursor handle passed through apVal[0] */\r\n  const char *zStart = \"<b>\";\r\n  const char *zEnd = \"</b>\";\r\n  const char *zEllipsis = \"<b>...</b>\";\r\n  int iCol = -1;\r\n  int nToken = 15;                /* Default number of tokens in snippet */\r\n\r\n  /* There must be at least one argument passed to this function (otherwise\r\n  ** the non-overloaded version would have been called instead of this one).\r\n  */\r\n  assert( nVal>=1 );\r\n\r\n  if( nVal>6 ){\r\n    sqlite3_result_error(pContext, \r\n        \"wrong number of arguments to function snippet()\", -1);\r\n    return;\r\n  }\r\n  if( fts3FunctionArg(pContext, \"snippet\", apVal[0], &pCsr) ) return;\r\n\r\n  switch( nVal ){\r\n    case 6: nToken = sqlite3_value_int(apVal[5]);\r\n    case 5: iCol = sqlite3_value_int(apVal[4]);\r\n    case 4: zEllipsis = (const char*)sqlite3_value_text(apVal[3]);\r\n    case 3: zEnd = (const char*)sqlite3_value_text(apVal[2]);\r\n    case 2: zStart = (const char*)sqlite3_value_text(apVal[1]);\r\n  }\r\n  if( !zEllipsis || !zEnd || !zStart ){\r\n    sqlite3_result_error_nomem(pContext);\r\n  }else if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){\r\n    sqlite3Fts3Snippet(pContext, pCsr, zStart, zEnd, zEllipsis, iCol, nToken);\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the offsets() function for FTS3\r\n*/\r\nstatic void fts3OffsetsFunc(\r\n  sqlite3_context *pContext,      /* SQLite function call context */\r\n  int nVal,                       /* Size of argument array */\r\n  sqlite3_value **apVal           /* Array of arguments */\r\n){\r\n  Fts3Cursor *pCsr;               /* Cursor handle passed through apVal[0] */\r\n\r\n  UNUSED_PARAMETER(nVal);\r\n\r\n  assert( nVal==1 );\r\n  if( fts3FunctionArg(pContext, \"offsets\", apVal[0], &pCsr) ) return;\r\n  assert( pCsr );\r\n  if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){\r\n    sqlite3Fts3Offsets(pContext, pCsr);\r\n  }\r\n}\r\n\r\n/* \r\n** Implementation of the special optimize() function for FTS3. This \r\n** function merges all segments in the database to a single segment.\r\n** Example usage is:\r\n**\r\n**   SELECT optimize(t) FROM t LIMIT 1;\r\n**\r\n** where 't' is the name of an FTS3 table.\r\n*/\r\nstatic void fts3OptimizeFunc(\r\n  sqlite3_context *pContext,      /* SQLite function call context */\r\n  int nVal,                       /* Size of argument array */\r\n  sqlite3_value **apVal           /* Array of arguments */\r\n){\r\n  int rc;                         /* Return code */\r\n  Fts3Table *p;                   /* Virtual table handle */\r\n  Fts3Cursor *pCursor;            /* Cursor handle passed through apVal[0] */\r\n\r\n  UNUSED_PARAMETER(nVal);\r\n\r\n  assert( nVal==1 );\r\n  if( fts3FunctionArg(pContext, \"optimize\", apVal[0], &pCursor) ) return;\r\n  p = (Fts3Table *)pCursor->base.pVtab;\r\n  assert( p );\r\n\r\n  rc = sqlite3Fts3Optimize(p);\r\n\r\n  switch( rc ){\r\n    case SQLITE_OK:\r\n      sqlite3_result_text(pContext, \"Index optimized\", -1, SQLITE_STATIC);\r\n      break;\r\n    case SQLITE_DONE:\r\n      sqlite3_result_text(pContext, \"Index already optimal\", -1, SQLITE_STATIC);\r\n      break;\r\n    default:\r\n      sqlite3_result_error_code(pContext, rc);\r\n      break;\r\n  }\r\n}\r\n\r\n/*\r\n** Implementation of the matchinfo() function for FTS3\r\n*/\r\nstatic void fts3MatchinfoFunc(\r\n  sqlite3_context *pContext,      /* SQLite function call context */\r\n  int nVal,                       /* Size of argument array */\r\n  sqlite3_value **apVal           /* Array of arguments */\r\n){\r\n  Fts3Cursor *pCsr;               /* Cursor handle passed through apVal[0] */\r\n  assert( nVal==1 || nVal==2 );\r\n  if( SQLITE_OK==fts3FunctionArg(pContext, \"matchinfo\", apVal[0], &pCsr) ){\r\n    const char *zArg = 0;\r\n    if( nVal>1 ){\r\n      zArg = (const char *)sqlite3_value_text(apVal[1]);\r\n    }\r\n    sqlite3Fts3Matchinfo(pContext, pCsr, zArg);\r\n  }\r\n}\r\n\r\n/*\r\n** This routine implements the xFindFunction method for the FTS3\r\n** virtual table.\r\n*/\r\nstatic int fts3FindFunctionMethod(\r\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\r\n  int nArg,                       /* Number of SQL function arguments */\r\n  const char *zName,              /* Name of SQL function */\r\n  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */\r\n  void **ppArg                    /* Unused */\r\n){\r\n  struct Overloaded {\r\n    const char *zName;\r\n    void (*xFunc)(sqlite3_context*,int,sqlite3_value**);\r\n  } aOverload[] = {\r\n    { \"snippet\", fts3SnippetFunc },\r\n    { \"offsets\", fts3OffsetsFunc },\r\n    { \"optimize\", fts3OptimizeFunc },\r\n    { \"matchinfo\", fts3MatchinfoFunc },\r\n  };\r\n  int i;                          /* Iterator variable */\r\n\r\n  UNUSED_PARAMETER(pVtab);\r\n  UNUSED_PARAMETER(nArg);\r\n  UNUSED_PARAMETER(ppArg);\r\n\r\n  for(i=0; i<SizeofArray(aOverload); i++){\r\n    if( strcmp(zName, aOverload[i].zName)==0 ){\r\n      *pxFunc = aOverload[i].xFunc;\r\n      return 1;\r\n    }\r\n  }\r\n\r\n  /* No function of the specified name was found. Return 0. */\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Implementation of FTS3 xRename method. Rename an fts3 table.\r\n*/\r\nstatic int fts3RenameMethod(\r\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\r\n  const char *zName               /* New name of table */\r\n){\r\n  Fts3Table *p = (Fts3Table *)pVtab;\r\n  sqlite3 *db = p->db;            /* Database connection */\r\n  int rc;                         /* Return Code */\r\n\r\n  /* As it happens, the pending terms table is always empty here. This is\r\n  ** because an \"ALTER TABLE RENAME TABLE\" statement inside a transaction \r\n  ** always opens a savepoint transaction. And the xSavepoint() method \r\n  ** flushes the pending terms table. But leave the (no-op) call to\r\n  ** PendingTermsFlush() in in case that changes.\r\n  */\r\n  assert( p->nPendingData==0 );\r\n  rc = sqlite3Fts3PendingTermsFlush(p);\r\n\r\n  if( p->zContentTbl==0 ){\r\n    fts3DbExec(&rc, db,\r\n      \"ALTER TABLE %Q.'%q_content'  RENAME TO '%q_content';\",\r\n      p->zDb, p->zName, zName\r\n    );\r\n  }\r\n\r\n  if( p->bHasDocsize ){\r\n    fts3DbExec(&rc, db,\r\n      \"ALTER TABLE %Q.'%q_docsize'  RENAME TO '%q_docsize';\",\r\n      p->zDb, p->zName, zName\r\n    );\r\n  }\r\n  if( p->bHasStat ){\r\n    fts3DbExec(&rc, db,\r\n      \"ALTER TABLE %Q.'%q_stat'  RENAME TO '%q_stat';\",\r\n      p->zDb, p->zName, zName\r\n    );\r\n  }\r\n  fts3DbExec(&rc, db,\r\n    \"ALTER TABLE %Q.'%q_segments' RENAME TO '%q_segments';\",\r\n    p->zDb, p->zName, zName\r\n  );\r\n  fts3DbExec(&rc, db,\r\n    \"ALTER TABLE %Q.'%q_segdir'   RENAME TO '%q_segdir';\",\r\n    p->zDb, p->zName, zName\r\n  );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The xSavepoint() method.\r\n**\r\n** Flush the contents of the pending-terms table to disk.\r\n*/\r\nstatic int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){\r\n  UNUSED_PARAMETER(iSavepoint);\r\n  assert( ((Fts3Table *)pVtab)->inTransaction );\r\n  assert( ((Fts3Table *)pVtab)->mxSavepoint < iSavepoint );\r\n  TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint );\r\n  return fts3SyncMethod(pVtab);\r\n}\r\n\r\n/*\r\n** The xRelease() method.\r\n**\r\n** This is a no-op.\r\n*/\r\nstatic int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){\r\n  TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );\r\n  UNUSED_PARAMETER(iSavepoint);\r\n  UNUSED_PARAMETER(pVtab);\r\n  assert( p->inTransaction );\r\n  assert( p->mxSavepoint >= iSavepoint );\r\n  TESTONLY( p->mxSavepoint = iSavepoint-1 );\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The xRollbackTo() method.\r\n**\r\n** Discard the contents of the pending terms table.\r\n*/\r\nstatic int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){\r\n  Fts3Table *p = (Fts3Table*)pVtab;\r\n  UNUSED_PARAMETER(iSavepoint);\r\n  assert( p->inTransaction );\r\n  assert( p->mxSavepoint >= iSavepoint );\r\n  TESTONLY( p->mxSavepoint = iSavepoint );\r\n  sqlite3Fts3PendingTermsClear(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\nstatic const sqlite3_module fts3Module = {\r\n  /* iVersion      */ 2,\r\n  /* xCreate       */ fts3CreateMethod,\r\n  /* xConnect      */ fts3ConnectMethod,\r\n  /* xBestIndex    */ fts3BestIndexMethod,\r\n  /* xDisconnect   */ fts3DisconnectMethod,\r\n  /* xDestroy      */ fts3DestroyMethod,\r\n  /* xOpen         */ fts3OpenMethod,\r\n  /* xClose        */ fts3CloseMethod,\r\n  /* xFilter       */ fts3FilterMethod,\r\n  /* xNext         */ fts3NextMethod,\r\n  /* xEof          */ fts3EofMethod,\r\n  /* xColumn       */ fts3ColumnMethod,\r\n  /* xRowid        */ fts3RowidMethod,\r\n  /* xUpdate       */ fts3UpdateMethod,\r\n  /* xBegin        */ fts3BeginMethod,\r\n  /* xSync         */ fts3SyncMethod,\r\n  /* xCommit       */ fts3CommitMethod,\r\n  /* xRollback     */ fts3RollbackMethod,\r\n  /* xFindFunction */ fts3FindFunctionMethod,\r\n  /* xRename */       fts3RenameMethod,\r\n  /* xSavepoint    */ fts3SavepointMethod,\r\n  /* xRelease      */ fts3ReleaseMethod,\r\n  /* xRollbackTo   */ fts3RollbackToMethod,\r\n};\r\n\r\n/*\r\n** This function is registered as the module destructor (called when an\r\n** FTS3 enabled database connection is closed). It frees the memory\r\n** allocated for the tokenizer hash table.\r\n*/\r\nstatic void hashDestroy(void *p){\r\n  Fts3Hash *pHash = (Fts3Hash *)p;\r\n  sqlite3Fts3HashClear(pHash);\r\n  sqlite3_free(pHash);\r\n}\r\n\r\n/*\r\n** The fts3 built-in tokenizers - \"simple\", \"porter\" and \"icu\"- are \r\n** implemented in files fts3_tokenizer1.c, fts3_porter.c and fts3_icu.c\r\n** respectively. The following three forward declarations are for functions\r\n** declared in these files used to retrieve the respective implementations.\r\n**\r\n** Calling sqlite3Fts3SimpleTokenizerModule() sets the value pointed\r\n** to by the argument to point to the \"simple\" tokenizer implementation.\r\n** And so on.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);\r\nSQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);\r\n#ifdef SQLITE_ENABLE_ICU\r\nSQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const**ppModule);\r\n#endif\r\n\r\n/*\r\n** Initialise the fts3 extension. If this extension is built as part\r\n** of the sqlite library, then this function is called directly by\r\n** SQLite. If fts3 is built as a dynamically loadable extension, this\r\n** function is called by the sqlite3_extension_init() entry point.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){\r\n  int rc = SQLITE_OK;\r\n  Fts3Hash *pHash = 0;\r\n  const sqlite3_tokenizer_module *pSimple = 0;\r\n  const sqlite3_tokenizer_module *pPorter = 0;\r\n\r\n#ifdef SQLITE_ENABLE_ICU\r\n  const sqlite3_tokenizer_module *pIcu = 0;\r\n  sqlite3Fts3IcuTokenizerModule(&pIcu);\r\n#endif\r\n\r\n#ifdef SQLITE_TEST\r\n  rc = sqlite3Fts3InitTerm(db);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n#endif\r\n\r\n  rc = sqlite3Fts3InitAux(db);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  sqlite3Fts3SimpleTokenizerModule(&pSimple);\r\n  sqlite3Fts3PorterTokenizerModule(&pPorter);\r\n\r\n  /* Allocate and initialise the hash-table used to store tokenizers. */\r\n  pHash = sqlite3_malloc(sizeof(Fts3Hash));\r\n  if( !pHash ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);\r\n  }\r\n\r\n  /* Load the built-in tokenizers into the hash table */\r\n  if( rc==SQLITE_OK ){\r\n    if( sqlite3Fts3HashInsert(pHash, \"simple\", 7, (void *)pSimple)\r\n     || sqlite3Fts3HashInsert(pHash, \"porter\", 7, (void *)pPorter) \r\n#ifdef SQLITE_ENABLE_ICU\r\n     || (pIcu && sqlite3Fts3HashInsert(pHash, \"icu\", 4, (void *)pIcu))\r\n#endif\r\n    ){\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n  }\r\n\r\n#ifdef SQLITE_TEST\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3Fts3ExprInitTestInterface(db);\r\n  }\r\n#endif\r\n\r\n  /* Create the virtual table wrapper around the hash-table and overload \r\n  ** the two scalar functions. If this is successful, register the\r\n  ** module with sqlite.\r\n  */\r\n  if( SQLITE_OK==rc \r\n   && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, \"fts3_tokenizer\"))\r\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"snippet\", -1))\r\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"offsets\", 1))\r\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"matchinfo\", 1))\r\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"matchinfo\", 2))\r\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"optimize\", 1))\r\n  ){\r\n    rc = sqlite3_create_module_v2(\r\n        db, \"fts3\", &fts3Module, (void *)pHash, hashDestroy\r\n    );\r\n    if( rc==SQLITE_OK ){\r\n      rc = sqlite3_create_module_v2(\r\n          db, \"fts4\", &fts3Module, (void *)pHash, 0\r\n      );\r\n    }\r\n    return rc;\r\n  }\r\n\r\n  /* An error has occurred. Delete the hash table and return the error code. */\r\n  assert( rc!=SQLITE_OK );\r\n  if( pHash ){\r\n    sqlite3Fts3HashClear(pHash);\r\n    sqlite3_free(pHash);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Allocate an Fts3MultiSegReader for each token in the expression headed\r\n** by pExpr. \r\n**\r\n** An Fts3SegReader object is a cursor that can seek or scan a range of\r\n** entries within a single segment b-tree. An Fts3MultiSegReader uses multiple\r\n** Fts3SegReader objects internally to provide an interface to seek or scan\r\n** within the union of all segments of a b-tree. Hence the name.\r\n**\r\n** If the allocated Fts3MultiSegReader just seeks to a single entry in a\r\n** segment b-tree (if the term is not a prefix or it is a prefix for which\r\n** there exists prefix b-tree of the right length) then it may be traversed\r\n** and merged incrementally. Otherwise, it has to be merged into an in-memory \r\n** doclist and then traversed.\r\n*/\r\nstatic void fts3EvalAllocateReaders(\r\n  Fts3Cursor *pCsr,               /* FTS cursor handle */\r\n  Fts3Expr *pExpr,                /* Allocate readers for this expression */\r\n  int *pnToken,                   /* OUT: Total number of tokens in phrase. */\r\n  int *pnOr,                      /* OUT: Total number of OR nodes in expr. */\r\n  int *pRc                        /* IN/OUT: Error code */\r\n){\r\n  if( pExpr && SQLITE_OK==*pRc ){\r\n    if( pExpr->eType==FTSQUERY_PHRASE ){\r\n      int i;\r\n      int nToken = pExpr->pPhrase->nToken;\r\n      *pnToken += nToken;\r\n      for(i=0; i<nToken; i++){\r\n        Fts3PhraseToken *pToken = &pExpr->pPhrase->aToken[i];\r\n        int rc = fts3TermSegReaderCursor(pCsr, \r\n            pToken->z, pToken->n, pToken->isPrefix, &pToken->pSegcsr\r\n        );\r\n        if( rc!=SQLITE_OK ){\r\n          *pRc = rc;\r\n          return;\r\n        }\r\n      }\r\n      assert( pExpr->pPhrase->iDoclistToken==0 );\r\n      pExpr->pPhrase->iDoclistToken = -1;\r\n    }else{\r\n      *pnOr += (pExpr->eType==FTSQUERY_OR);\r\n      fts3EvalAllocateReaders(pCsr, pExpr->pLeft, pnToken, pnOr, pRc);\r\n      fts3EvalAllocateReaders(pCsr, pExpr->pRight, pnToken, pnOr, pRc);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Arguments pList/nList contain the doclist for token iToken of phrase p.\r\n** It is merged into the main doclist stored in p->doclist.aAll/nAll.\r\n**\r\n** This function assumes that pList points to a buffer allocated using\r\n** sqlite3_malloc(). This function takes responsibility for eventually\r\n** freeing the buffer.\r\n*/\r\nstatic void fts3EvalPhraseMergeToken(\r\n  Fts3Table *pTab,                /* FTS Table pointer */\r\n  Fts3Phrase *p,                  /* Phrase to merge pList/nList into */\r\n  int iToken,                     /* Token pList/nList corresponds to */\r\n  char *pList,                    /* Pointer to doclist */\r\n  int nList                       /* Number of bytes in pList */\r\n){\r\n  assert( iToken!=p->iDoclistToken );\r\n\r\n  if( pList==0 ){\r\n    sqlite3_free(p->doclist.aAll);\r\n    p->doclist.aAll = 0;\r\n    p->doclist.nAll = 0;\r\n  }\r\n\r\n  else if( p->iDoclistToken<0 ){\r\n    p->doclist.aAll = pList;\r\n    p->doclist.nAll = nList;\r\n  }\r\n\r\n  else if( p->doclist.aAll==0 ){\r\n    sqlite3_free(pList);\r\n  }\r\n\r\n  else {\r\n    char *pLeft;\r\n    char *pRight;\r\n    int nLeft;\r\n    int nRight;\r\n    int nDiff;\r\n\r\n    if( p->iDoclistToken<iToken ){\r\n      pLeft = p->doclist.aAll;\r\n      nLeft = p->doclist.nAll;\r\n      pRight = pList;\r\n      nRight = nList;\r\n      nDiff = iToken - p->iDoclistToken;\r\n    }else{\r\n      pRight = p->doclist.aAll;\r\n      nRight = p->doclist.nAll;\r\n      pLeft = pList;\r\n      nLeft = nList;\r\n      nDiff = p->iDoclistToken - iToken;\r\n    }\r\n\r\n    fts3DoclistPhraseMerge(pTab->bDescIdx, nDiff, pLeft, nLeft, pRight,&nRight);\r\n    sqlite3_free(pLeft);\r\n    p->doclist.aAll = pRight;\r\n    p->doclist.nAll = nRight;\r\n  }\r\n\r\n  if( iToken>p->iDoclistToken ) p->iDoclistToken = iToken;\r\n}\r\n\r\n/*\r\n** Load the doclist for phrase p into p->doclist.aAll/nAll. The loaded doclist\r\n** does not take deferred tokens into account.\r\n**\r\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\r\n*/\r\nstatic int fts3EvalPhraseLoad(\r\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\r\n  Fts3Phrase *p                   /* Phrase object */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int iToken;\r\n  int rc = SQLITE_OK;\r\n\r\n  for(iToken=0; rc==SQLITE_OK && iToken<p->nToken; iToken++){\r\n    Fts3PhraseToken *pToken = &p->aToken[iToken];\r\n    assert( pToken->pDeferred==0 || pToken->pSegcsr==0 );\r\n\r\n    if( pToken->pSegcsr ){\r\n      int nThis = 0;\r\n      char *pThis = 0;\r\n      rc = fts3TermSelect(pTab, pToken, p->iColumn, &nThis, &pThis);\r\n      if( rc==SQLITE_OK ){\r\n        fts3EvalPhraseMergeToken(pTab, p, iToken, pThis, nThis);\r\n      }\r\n    }\r\n    assert( pToken->pSegcsr==0 );\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called on each phrase after the position lists for\r\n** any deferred tokens have been loaded into memory. It updates the phrases\r\n** current position list to include only those positions that are really\r\n** instances of the phrase (after considering deferred tokens). If this\r\n** means that the phrase does not appear in the current row, doclist.pList\r\n** and doclist.nList are both zeroed.\r\n**\r\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\r\n*/\r\nstatic int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){\r\n  int iToken;                     /* Used to iterate through phrase tokens */\r\n  char *aPoslist = 0;             /* Position list for deferred tokens */\r\n  int nPoslist = 0;               /* Number of bytes in aPoslist */\r\n  int iPrev = -1;                 /* Token number of previous deferred token */\r\n\r\n  assert( pPhrase->doclist.bFreeList==0 );\r\n\r\n  for(iToken=0; iToken<pPhrase->nToken; iToken++){\r\n    Fts3PhraseToken *pToken = &pPhrase->aToken[iToken];\r\n    Fts3DeferredToken *pDeferred = pToken->pDeferred;\r\n\r\n    if( pDeferred ){\r\n      char *pList;\r\n      int nList;\r\n      int rc = sqlite3Fts3DeferredTokenList(pDeferred, &pList, &nList);\r\n      if( rc!=SQLITE_OK ) return rc;\r\n\r\n      if( pList==0 ){\r\n        sqlite3_free(aPoslist);\r\n        pPhrase->doclist.pList = 0;\r\n        pPhrase->doclist.nList = 0;\r\n        return SQLITE_OK;\r\n\r\n      }else if( aPoslist==0 ){\r\n        aPoslist = pList;\r\n        nPoslist = nList;\r\n\r\n      }else{\r\n        char *aOut = pList;\r\n        char *p1 = aPoslist;\r\n        char *p2 = aOut;\r\n\r\n        assert( iPrev>=0 );\r\n        fts3PoslistPhraseMerge(&aOut, iToken-iPrev, 0, 1, &p1, &p2);\r\n        sqlite3_free(aPoslist);\r\n        aPoslist = pList;\r\n        nPoslist = (int)(aOut - aPoslist);\r\n        if( nPoslist==0 ){\r\n          sqlite3_free(aPoslist);\r\n          pPhrase->doclist.pList = 0;\r\n          pPhrase->doclist.nList = 0;\r\n          return SQLITE_OK;\r\n        }\r\n      }\r\n      iPrev = iToken;\r\n    }\r\n  }\r\n\r\n  if( iPrev>=0 ){\r\n    int nMaxUndeferred = pPhrase->iDoclistToken;\r\n    if( nMaxUndeferred<0 ){\r\n      pPhrase->doclist.pList = aPoslist;\r\n      pPhrase->doclist.nList = nPoslist;\r\n      pPhrase->doclist.iDocid = pCsr->iPrevId;\r\n      pPhrase->doclist.bFreeList = 1;\r\n    }else{\r\n      int nDistance;\r\n      char *p1;\r\n      char *p2;\r\n      char *aOut;\r\n\r\n      if( nMaxUndeferred>iPrev ){\r\n        p1 = aPoslist;\r\n        p2 = pPhrase->doclist.pList;\r\n        nDistance = nMaxUndeferred - iPrev;\r\n      }else{\r\n        p1 = pPhrase->doclist.pList;\r\n        p2 = aPoslist;\r\n        nDistance = iPrev - nMaxUndeferred;\r\n      }\r\n\r\n      aOut = (char *)sqlite3_malloc(nPoslist+8);\r\n      if( !aOut ){\r\n        sqlite3_free(aPoslist);\r\n        return SQLITE_NOMEM;\r\n      }\r\n      \r\n      pPhrase->doclist.pList = aOut;\r\n      if( fts3PoslistPhraseMerge(&aOut, nDistance, 0, 1, &p1, &p2) ){\r\n        pPhrase->doclist.bFreeList = 1;\r\n        pPhrase->doclist.nList = (int)(aOut - pPhrase->doclist.pList);\r\n      }else{\r\n        sqlite3_free(aOut);\r\n        pPhrase->doclist.pList = 0;\r\n        pPhrase->doclist.nList = 0;\r\n      }\r\n      sqlite3_free(aPoslist);\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is called for each Fts3Phrase in a full-text query \r\n** expression to initialize the mechanism for returning rows. Once this\r\n** function has been called successfully on an Fts3Phrase, it may be\r\n** used with fts3EvalPhraseNext() to iterate through the matching docids.\r\n**\r\n** If parameter bOptOk is true, then the phrase may (or may not) use the\r\n** incremental loading strategy. Otherwise, the entire doclist is loaded into\r\n** memory within this call.\r\n**\r\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\r\n*/\r\nstatic int fts3EvalPhraseStart(Fts3Cursor *pCsr, int bOptOk, Fts3Phrase *p){\r\n  int rc;                         /* Error code */\r\n  Fts3PhraseToken *pFirst = &p->aToken[0];\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n\r\n  if( pCsr->bDesc==pTab->bDescIdx \r\n   && bOptOk==1 \r\n   && p->nToken==1 \r\n   && pFirst->pSegcsr \r\n   && pFirst->pSegcsr->bLookup \r\n   && pFirst->bFirst==0\r\n  ){\r\n    /* Use the incremental approach. */\r\n    int iCol = (p->iColumn >= pTab->nColumn ? -1 : p->iColumn);\r\n    rc = sqlite3Fts3MsrIncrStart(\r\n        pTab, pFirst->pSegcsr, iCol, pFirst->z, pFirst->n);\r\n    p->bIncr = 1;\r\n\r\n  }else{\r\n    /* Load the full doclist for the phrase into memory. */\r\n    rc = fts3EvalPhraseLoad(pCsr, p);\r\n    p->bIncr = 0;\r\n  }\r\n\r\n  assert( rc!=SQLITE_OK || p->nToken<1 || p->aToken[0].pSegcsr==0 || p->bIncr );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is used to iterate backwards (from the end to start) \r\n** through doclists. It is used by this module to iterate through phrase\r\n** doclists in reverse and by the fts3_write.c module to iterate through\r\n** pending-terms lists when writing to databases with \"order=desc\".\r\n**\r\n** The doclist may be sorted in ascending (parameter bDescIdx==0) or \r\n** descending (parameter bDescIdx==1) order of docid. Regardless, this\r\n** function iterates from the end of the doclist to the beginning.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3DoclistPrev(\r\n  int bDescIdx,                   /* True if the doclist is desc */\r\n  char *aDoclist,                 /* Pointer to entire doclist */\r\n  int nDoclist,                   /* Length of aDoclist in bytes */\r\n  char **ppIter,                  /* IN/OUT: Iterator pointer */\r\n  sqlite3_int64 *piDocid,         /* IN/OUT: Docid pointer */\r\n  int *pnList,                    /* IN/OUT: List length pointer */\r\n  u8 *pbEof                       /* OUT: End-of-file flag */\r\n){\r\n  char *p = *ppIter;\r\n\r\n  assert( nDoclist>0 );\r\n  assert( *pbEof==0 );\r\n  assert( p || *piDocid==0 );\r\n  assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) );\r\n\r\n  if( p==0 ){\r\n    sqlite3_int64 iDocid = 0;\r\n    char *pNext = 0;\r\n    char *pDocid = aDoclist;\r\n    char *pEnd = &aDoclist[nDoclist];\r\n    int iMul = 1;\r\n\r\n    while( pDocid<pEnd ){\r\n      sqlite3_int64 iDelta;\r\n      pDocid += sqlite3Fts3GetVarint(pDocid, &iDelta);\r\n      iDocid += (iMul * iDelta);\r\n      pNext = pDocid;\r\n      fts3PoslistCopy(0, &pDocid);\r\n      while( pDocid<pEnd && *pDocid==0 ) pDocid++;\r\n      iMul = (bDescIdx ? -1 : 1);\r\n    }\r\n\r\n    *pnList = (int)(pEnd - pNext);\r\n    *ppIter = pNext;\r\n    *piDocid = iDocid;\r\n  }else{\r\n    int iMul = (bDescIdx ? -1 : 1);\r\n    sqlite3_int64 iDelta;\r\n    fts3GetReverseVarint(&p, aDoclist, &iDelta);\r\n    *piDocid -= (iMul * iDelta);\r\n\r\n    if( p==aDoclist ){\r\n      *pbEof = 1;\r\n    }else{\r\n      char *pSave = p;\r\n      fts3ReversePoslist(aDoclist, &p);\r\n      *pnList = (int)(pSave - p);\r\n    }\r\n    *ppIter = p;\r\n  }\r\n}\r\n\r\n/*\r\n** Attempt to move the phrase iterator to point to the next matching docid. \r\n** If an error occurs, return an SQLite error code. Otherwise, return \r\n** SQLITE_OK.\r\n**\r\n** If there is no \"next\" entry and no error occurs, then *pbEof is set to\r\n** 1 before returning. Otherwise, if no error occurs and the iterator is\r\n** successfully advanced, *pbEof is set to 0.\r\n*/\r\nstatic int fts3EvalPhraseNext(\r\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\r\n  Fts3Phrase *p,                  /* Phrase object to advance to next docid */\r\n  u8 *pbEof                       /* OUT: Set to 1 if EOF */\r\n){\r\n  int rc = SQLITE_OK;\r\n  Fts3Doclist *pDL = &p->doclist;\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n\r\n  if( p->bIncr ){\r\n    assert( p->nToken==1 );\r\n    assert( pDL->pNextDocid==0 );\r\n    rc = sqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr, \r\n        &pDL->iDocid, &pDL->pList, &pDL->nList\r\n    );\r\n    if( rc==SQLITE_OK && !pDL->pList ){\r\n      *pbEof = 1;\r\n    }\r\n  }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){\r\n    sqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll, \r\n        &pDL->pNextDocid, &pDL->iDocid, &pDL->nList, pbEof\r\n    );\r\n    pDL->pList = pDL->pNextDocid;\r\n  }else{\r\n    char *pIter;                            /* Used to iterate through aAll */\r\n    char *pEnd = &pDL->aAll[pDL->nAll];     /* 1 byte past end of aAll */\r\n    if( pDL->pNextDocid ){\r\n      pIter = pDL->pNextDocid;\r\n    }else{\r\n      pIter = pDL->aAll;\r\n    }\r\n\r\n    if( pIter>=pEnd ){\r\n      /* We have already reached the end of this doclist. EOF. */\r\n      *pbEof = 1;\r\n    }else{\r\n      sqlite3_int64 iDelta;\r\n      pIter += sqlite3Fts3GetVarint(pIter, &iDelta);\r\n      if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){\r\n        pDL->iDocid += iDelta;\r\n      }else{\r\n        pDL->iDocid -= iDelta;\r\n      }\r\n      pDL->pList = pIter;\r\n      fts3PoslistCopy(0, &pIter);\r\n      pDL->nList = (int)(pIter - pDL->pList);\r\n\r\n      /* pIter now points just past the 0x00 that terminates the position-\r\n      ** list for document pDL->iDocid. However, if this position-list was\r\n      ** edited in place by fts3EvalNearTrim(), then pIter may not actually\r\n      ** point to the start of the next docid value. The following line deals\r\n      ** with this case by advancing pIter past the zero-padding added by\r\n      ** fts3EvalNearTrim().  */\r\n      while( pIter<pEnd && *pIter==0 ) pIter++;\r\n\r\n      pDL->pNextDocid = pIter;\r\n      assert( pIter>=&pDL->aAll[pDL->nAll] || *pIter );\r\n      *pbEof = 0;\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n**\r\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\r\n** Otherwise, fts3EvalPhraseStart() is called on all phrases within the\r\n** expression. Also the Fts3Expr.bDeferred variable is set to true for any\r\n** expressions for which all descendent tokens are deferred.\r\n**\r\n** If parameter bOptOk is zero, then it is guaranteed that the\r\n** Fts3Phrase.doclist.aAll/nAll variables contain the entire doclist for\r\n** each phrase in the expression (subject to deferred token processing).\r\n** Or, if bOptOk is non-zero, then one or more tokens within the expression\r\n** may be loaded incrementally, meaning doclist.aAll/nAll is not available.\r\n**\r\n** If an error occurs within this function, *pRc is set to an SQLite error\r\n** code before returning.\r\n*/\r\nstatic void fts3EvalStartReaders(\r\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\r\n  Fts3Expr *pExpr,                /* Expression to initialize phrases in */\r\n  int bOptOk,                     /* True to enable incremental loading */\r\n  int *pRc                        /* IN/OUT: Error code */\r\n){\r\n  if( pExpr && SQLITE_OK==*pRc ){\r\n    if( pExpr->eType==FTSQUERY_PHRASE ){\r\n      int i;\r\n      int nToken = pExpr->pPhrase->nToken;\r\n      for(i=0; i<nToken; i++){\r\n        if( pExpr->pPhrase->aToken[i].pDeferred==0 ) break;\r\n      }\r\n      pExpr->bDeferred = (i==nToken);\r\n      *pRc = fts3EvalPhraseStart(pCsr, bOptOk, pExpr->pPhrase);\r\n    }else{\r\n      fts3EvalStartReaders(pCsr, pExpr->pLeft, bOptOk, pRc);\r\n      fts3EvalStartReaders(pCsr, pExpr->pRight, bOptOk, pRc);\r\n      pExpr->bDeferred = (pExpr->pLeft->bDeferred && pExpr->pRight->bDeferred);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** An array of the following structures is assembled as part of the process\r\n** of selecting tokens to defer before the query starts executing (as part\r\n** of the xFilter() method). There is one element in the array for each\r\n** token in the FTS expression.\r\n**\r\n** Tokens are divided into AND/NEAR clusters. All tokens in a cluster belong\r\n** to phrases that are connected only by AND and NEAR operators (not OR or\r\n** NOT). When determining tokens to defer, each AND/NEAR cluster is considered\r\n** separately. The root of a tokens AND/NEAR cluster is stored in \r\n** Fts3TokenAndCost.pRoot.\r\n*/\r\ntypedef struct Fts3TokenAndCost Fts3TokenAndCost;\r\nstruct Fts3TokenAndCost {\r\n  Fts3Phrase *pPhrase;            /* The phrase the token belongs to */\r\n  int iToken;                     /* Position of token in phrase */\r\n  Fts3PhraseToken *pToken;        /* The token itself */\r\n  Fts3Expr *pRoot;                /* Root of NEAR/AND cluster */\r\n  int nOvfl;                      /* Number of overflow pages to load doclist */\r\n  int iCol;                       /* The column the token must match */\r\n};\r\n\r\n/*\r\n** This function is used to populate an allocated Fts3TokenAndCost array.\r\n**\r\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\r\n** Otherwise, if an error occurs during execution, *pRc is set to an\r\n** SQLite error code.\r\n*/\r\nstatic void fts3EvalTokenCosts(\r\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\r\n  Fts3Expr *pRoot,                /* Root of current AND/NEAR cluster */\r\n  Fts3Expr *pExpr,                /* Expression to consider */\r\n  Fts3TokenAndCost **ppTC,        /* Write new entries to *(*ppTC)++ */\r\n  Fts3Expr ***ppOr,               /* Write new OR root to *(*ppOr)++ */\r\n  int *pRc                        /* IN/OUT: Error code */\r\n){\r\n  if( *pRc==SQLITE_OK ){\r\n    if( pExpr->eType==FTSQUERY_PHRASE ){\r\n      Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n      int i;\r\n      for(i=0; *pRc==SQLITE_OK && i<pPhrase->nToken; i++){\r\n        Fts3TokenAndCost *pTC = (*ppTC)++;\r\n        pTC->pPhrase = pPhrase;\r\n        pTC->iToken = i;\r\n        pTC->pRoot = pRoot;\r\n        pTC->pToken = &pPhrase->aToken[i];\r\n        pTC->iCol = pPhrase->iColumn;\r\n        *pRc = sqlite3Fts3MsrOvfl(pCsr, pTC->pToken->pSegcsr, &pTC->nOvfl);\r\n      }\r\n    }else if( pExpr->eType!=FTSQUERY_NOT ){\r\n      assert( pExpr->eType==FTSQUERY_OR\r\n           || pExpr->eType==FTSQUERY_AND\r\n           || pExpr->eType==FTSQUERY_NEAR\r\n      );\r\n      assert( pExpr->pLeft && pExpr->pRight );\r\n      if( pExpr->eType==FTSQUERY_OR ){\r\n        pRoot = pExpr->pLeft;\r\n        **ppOr = pRoot;\r\n        (*ppOr)++;\r\n      }\r\n      fts3EvalTokenCosts(pCsr, pRoot, pExpr->pLeft, ppTC, ppOr, pRc);\r\n      if( pExpr->eType==FTSQUERY_OR ){\r\n        pRoot = pExpr->pRight;\r\n        **ppOr = pRoot;\r\n        (*ppOr)++;\r\n      }\r\n      fts3EvalTokenCosts(pCsr, pRoot, pExpr->pRight, ppTC, ppOr, pRc);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Determine the average document (row) size in pages. If successful,\r\n** write this value to *pnPage and return SQLITE_OK. Otherwise, return\r\n** an SQLite error code.\r\n**\r\n** The average document size in pages is calculated by first calculating \r\n** determining the average size in bytes, B. If B is less than the amount\r\n** of data that will fit on a single leaf page of an intkey table in\r\n** this database, then the average docsize is 1. Otherwise, it is 1 plus\r\n** the number of overflow pages consumed by a record B bytes in size.\r\n*/\r\nstatic int fts3EvalAverageDocsize(Fts3Cursor *pCsr, int *pnPage){\r\n  if( pCsr->nRowAvg==0 ){\r\n    /* The average document size, which is required to calculate the cost\r\n    ** of each doclist, has not yet been determined. Read the required \r\n    ** data from the %_stat table to calculate it.\r\n    **\r\n    ** Entry 0 of the %_stat table is a blob containing (nCol+1) FTS3 \r\n    ** varints, where nCol is the number of columns in the FTS3 table.\r\n    ** The first varint is the number of documents currently stored in\r\n    ** the table. The following nCol varints contain the total amount of\r\n    ** data stored in all rows of each column of the table, from left\r\n    ** to right.\r\n    */\r\n    int rc;\r\n    Fts3Table *p = (Fts3Table*)pCsr->base.pVtab;\r\n    sqlite3_stmt *pStmt;\r\n    sqlite3_int64 nDoc = 0;\r\n    sqlite3_int64 nByte = 0;\r\n    const char *pEnd;\r\n    const char *a;\r\n\r\n    rc = sqlite3Fts3SelectDoctotal(p, &pStmt);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n    a = sqlite3_column_blob(pStmt, 0);\r\n    assert( a );\r\n\r\n    pEnd = &a[sqlite3_column_bytes(pStmt, 0)];\r\n    a += sqlite3Fts3GetVarint(a, &nDoc);\r\n    while( a<pEnd ){\r\n      a += sqlite3Fts3GetVarint(a, &nByte);\r\n    }\r\n    if( nDoc==0 || nByte==0 ){\r\n      sqlite3_reset(pStmt);\r\n      return FTS_CORRUPT_VTAB;\r\n    }\r\n\r\n    pCsr->nDoc = nDoc;\r\n    pCsr->nRowAvg = (int)(((nByte / nDoc) + p->nPgsz) / p->nPgsz);\r\n    assert( pCsr->nRowAvg>0 ); \r\n    rc = sqlite3_reset(pStmt);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n\r\n  *pnPage = pCsr->nRowAvg;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is called to select the tokens (if any) that will be \r\n** deferred. The array aTC[] has already been populated when this is\r\n** called.\r\n**\r\n** This function is called once for each AND/NEAR cluster in the \r\n** expression. Each invocation determines which tokens to defer within\r\n** the cluster with root node pRoot. See comments above the definition\r\n** of struct Fts3TokenAndCost for more details.\r\n**\r\n** If no error occurs, SQLITE_OK is returned and sqlite3Fts3DeferToken()\r\n** called on each token to defer. Otherwise, an SQLite error code is\r\n** returned.\r\n*/\r\nstatic int fts3EvalSelectDeferred(\r\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\r\n  Fts3Expr *pRoot,                /* Consider tokens with this root node */\r\n  Fts3TokenAndCost *aTC,          /* Array of expression tokens and costs */\r\n  int nTC                         /* Number of entries in aTC[] */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int nDocSize = 0;               /* Number of pages per doc loaded */\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  int ii;                         /* Iterator variable for various purposes */\r\n  int nOvfl = 0;                  /* Total overflow pages used by doclists */\r\n  int nToken = 0;                 /* Total number of tokens in cluster */\r\n\r\n  int nMinEst = 0;                /* The minimum count for any phrase so far. */\r\n  int nLoad4 = 1;                 /* (Phrases that will be loaded)^4. */\r\n\r\n  /* Tokens are never deferred for FTS tables created using the content=xxx\r\n  ** option. The reason being that it is not guaranteed that the content\r\n  ** table actually contains the same data as the index. To prevent this from\r\n  ** causing any problems, the deferred token optimization is completely\r\n  ** disabled for content=xxx tables. */\r\n  if( pTab->zContentTbl ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Count the tokens in this AND/NEAR cluster. If none of the doclists\r\n  ** associated with the tokens spill onto overflow pages, or if there is\r\n  ** only 1 token, exit early. No tokens to defer in this case. */\r\n  for(ii=0; ii<nTC; ii++){\r\n    if( aTC[ii].pRoot==pRoot ){\r\n      nOvfl += aTC[ii].nOvfl;\r\n      nToken++;\r\n    }\r\n  }\r\n  if( nOvfl==0 || nToken<2 ) return SQLITE_OK;\r\n\r\n  /* Obtain the average docsize (in pages). */\r\n  rc = fts3EvalAverageDocsize(pCsr, &nDocSize);\r\n  assert( rc!=SQLITE_OK || nDocSize>0 );\r\n\r\n\r\n  /* Iterate through all tokens in this AND/NEAR cluster, in ascending order \r\n  ** of the number of overflow pages that will be loaded by the pager layer \r\n  ** to retrieve the entire doclist for the token from the full-text index.\r\n  ** Load the doclists for tokens that are either:\r\n  **\r\n  **   a. The cheapest token in the entire query (i.e. the one visited by the\r\n  **      first iteration of this loop), or\r\n  **\r\n  **   b. Part of a multi-token phrase.\r\n  **\r\n  ** After each token doclist is loaded, merge it with the others from the\r\n  ** same phrase and count the number of documents that the merged doclist\r\n  ** contains. Set variable \"nMinEst\" to the smallest number of documents in \r\n  ** any phrase doclist for which 1 or more token doclists have been loaded.\r\n  ** Let nOther be the number of other phrases for which it is certain that\r\n  ** one or more tokens will not be deferred.\r\n  **\r\n  ** Then, for each token, defer it if loading the doclist would result in\r\n  ** loading N or more overflow pages into memory, where N is computed as:\r\n  **\r\n  **    (nMinEst + 4^nOther - 1) / (4^nOther)\r\n  */\r\n  for(ii=0; ii<nToken && rc==SQLITE_OK; ii++){\r\n    int iTC;                      /* Used to iterate through aTC[] array. */\r\n    Fts3TokenAndCost *pTC = 0;    /* Set to cheapest remaining token. */\r\n\r\n    /* Set pTC to point to the cheapest remaining token. */\r\n    for(iTC=0; iTC<nTC; iTC++){\r\n      if( aTC[iTC].pToken && aTC[iTC].pRoot==pRoot \r\n       && (!pTC || aTC[iTC].nOvfl<pTC->nOvfl) \r\n      ){\r\n        pTC = &aTC[iTC];\r\n      }\r\n    }\r\n    assert( pTC );\r\n\r\n    if( ii && pTC->nOvfl>=((nMinEst+(nLoad4/4)-1)/(nLoad4/4))*nDocSize ){\r\n      /* The number of overflow pages to load for this (and therefore all\r\n      ** subsequent) tokens is greater than the estimated number of pages \r\n      ** that will be loaded if all subsequent tokens are deferred.\r\n      */\r\n      Fts3PhraseToken *pToken = pTC->pToken;\r\n      rc = sqlite3Fts3DeferToken(pCsr, pToken, pTC->iCol);\r\n      fts3SegReaderCursorFree(pToken->pSegcsr);\r\n      pToken->pSegcsr = 0;\r\n    }else{\r\n      /* Set nLoad4 to the value of (4^nOther) for the next iteration of the\r\n      ** for-loop. Except, limit the value to 2^24 to prevent it from \r\n      ** overflowing the 32-bit integer it is stored in. */\r\n      if( ii<12 ) nLoad4 = nLoad4*4;\r\n\r\n      if( ii==0 || pTC->pPhrase->nToken>1 ){\r\n        /* Either this is the cheapest token in the entire query, or it is\r\n        ** part of a multi-token phrase. Either way, the entire doclist will\r\n        ** (eventually) be loaded into memory. It may as well be now. */\r\n        Fts3PhraseToken *pToken = pTC->pToken;\r\n        int nList = 0;\r\n        char *pList = 0;\r\n        rc = fts3TermSelect(pTab, pToken, pTC->iCol, &nList, &pList);\r\n        assert( rc==SQLITE_OK || pList==0 );\r\n        if( rc==SQLITE_OK ){\r\n          int nCount;\r\n          fts3EvalPhraseMergeToken(pTab, pTC->pPhrase, pTC->iToken,pList,nList);\r\n          nCount = fts3DoclistCountDocids(\r\n              pTC->pPhrase->doclist.aAll, pTC->pPhrase->doclist.nAll\r\n          );\r\n          if( ii==0 || nCount<nMinEst ) nMinEst = nCount;\r\n        }\r\n      }\r\n    }\r\n    pTC->pToken = 0;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called from within the xFilter method. It initializes\r\n** the full-text query currently stored in pCsr->pExpr. To iterate through\r\n** the results of a query, the caller does:\r\n**\r\n**    fts3EvalStart(pCsr);\r\n**    while( 1 ){\r\n**      fts3EvalNext(pCsr);\r\n**      if( pCsr->bEof ) break;\r\n**      ... return row pCsr->iPrevId to the caller ...\r\n**    }\r\n*/\r\nstatic int fts3EvalStart(Fts3Cursor *pCsr){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int rc = SQLITE_OK;\r\n  int nToken = 0;\r\n  int nOr = 0;\r\n\r\n  /* Allocate a MultiSegReader for each token in the expression. */\r\n  fts3EvalAllocateReaders(pCsr, pCsr->pExpr, &nToken, &nOr, &rc);\r\n\r\n  /* Determine which, if any, tokens in the expression should be deferred. */\r\n  if( rc==SQLITE_OK && nToken>1 && pTab->bHasStat ){\r\n    Fts3TokenAndCost *aTC;\r\n    Fts3Expr **apOr;\r\n    aTC = (Fts3TokenAndCost *)sqlite3_malloc(\r\n        sizeof(Fts3TokenAndCost) * nToken\r\n      + sizeof(Fts3Expr *) * nOr * 2\r\n    );\r\n    apOr = (Fts3Expr **)&aTC[nToken];\r\n\r\n    if( !aTC ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      int ii;\r\n      Fts3TokenAndCost *pTC = aTC;\r\n      Fts3Expr **ppOr = apOr;\r\n\r\n      fts3EvalTokenCosts(pCsr, 0, pCsr->pExpr, &pTC, &ppOr, &rc);\r\n      nToken = (int)(pTC-aTC);\r\n      nOr = (int)(ppOr-apOr);\r\n\r\n      if( rc==SQLITE_OK ){\r\n        rc = fts3EvalSelectDeferred(pCsr, 0, aTC, nToken);\r\n        for(ii=0; rc==SQLITE_OK && ii<nOr; ii++){\r\n          rc = fts3EvalSelectDeferred(pCsr, apOr[ii], aTC, nToken);\r\n        }\r\n      }\r\n\r\n      sqlite3_free(aTC);\r\n    }\r\n  }\r\n\r\n  fts3EvalStartReaders(pCsr, pCsr->pExpr, 1, &rc);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Invalidate the current position list for phrase pPhrase.\r\n*/\r\nstatic void fts3EvalInvalidatePoslist(Fts3Phrase *pPhrase){\r\n  if( pPhrase->doclist.bFreeList ){\r\n    sqlite3_free(pPhrase->doclist.pList);\r\n  }\r\n  pPhrase->doclist.pList = 0;\r\n  pPhrase->doclist.nList = 0;\r\n  pPhrase->doclist.bFreeList = 0;\r\n}\r\n\r\n/*\r\n** This function is called to edit the position list associated with\r\n** the phrase object passed as the fifth argument according to a NEAR\r\n** condition. For example:\r\n**\r\n**     abc NEAR/5 \"def ghi\"\r\n**\r\n** Parameter nNear is passed the NEAR distance of the expression (5 in\r\n** the example above). When this function is called, *paPoslist points to\r\n** the position list, and *pnToken is the number of phrase tokens in, the\r\n** phrase on the other side of the NEAR operator to pPhrase. For example,\r\n** if pPhrase refers to the \"def ghi\" phrase, then *paPoslist points to\r\n** the position list associated with phrase \"abc\".\r\n**\r\n** All positions in the pPhrase position list that are not sufficiently\r\n** close to a position in the *paPoslist position list are removed. If this\r\n** leaves 0 positions, zero is returned. Otherwise, non-zero.\r\n**\r\n** Before returning, *paPoslist is set to point to the position lsit \r\n** associated with pPhrase. And *pnToken is set to the number of tokens in\r\n** pPhrase.\r\n*/\r\nstatic int fts3EvalNearTrim(\r\n  int nNear,                      /* NEAR distance. As in \"NEAR/nNear\". */\r\n  char *aTmp,                     /* Temporary space to use */\r\n  char **paPoslist,               /* IN/OUT: Position list */\r\n  int *pnToken,                   /* IN/OUT: Tokens in phrase of *paPoslist */\r\n  Fts3Phrase *pPhrase             /* The phrase object to trim the doclist of */\r\n){\r\n  int nParam1 = nNear + pPhrase->nToken;\r\n  int nParam2 = nNear + *pnToken;\r\n  int nNew;\r\n  char *p2; \r\n  char *pOut; \r\n  int res;\r\n\r\n  assert( pPhrase->doclist.pList );\r\n\r\n  p2 = pOut = pPhrase->doclist.pList;\r\n  res = fts3PoslistNearMerge(\r\n    &pOut, aTmp, nParam1, nParam2, paPoslist, &p2\r\n  );\r\n  if( res ){\r\n    nNew = (int)(pOut - pPhrase->doclist.pList) - 1;\r\n    assert( pPhrase->doclist.pList[nNew]=='\\0' );\r\n    assert( nNew<=pPhrase->doclist.nList && nNew>0 );\r\n    memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew);\r\n    pPhrase->doclist.nList = nNew;\r\n    *paPoslist = pPhrase->doclist.pList;\r\n    *pnToken = pPhrase->nToken;\r\n  }\r\n\r\n  return res;\r\n}\r\n\r\n/*\r\n** This function is a no-op if *pRc is other than SQLITE_OK when it is called.\r\n** Otherwise, it advances the expression passed as the second argument to\r\n** point to the next matching row in the database. Expressions iterate through\r\n** matching rows in docid order. Ascending order if Fts3Cursor.bDesc is zero,\r\n** or descending if it is non-zero.\r\n**\r\n** If an error occurs, *pRc is set to an SQLite error code. Otherwise, if\r\n** successful, the following variables in pExpr are set:\r\n**\r\n**   Fts3Expr.bEof                (non-zero if EOF - there is no next row)\r\n**   Fts3Expr.iDocid              (valid if bEof==0. The docid of the next row)\r\n**\r\n** If the expression is of type FTSQUERY_PHRASE, and the expression is not\r\n** at EOF, then the following variables are populated with the position list\r\n** for the phrase for the visited row:\r\n**\r\n**   FTs3Expr.pPhrase->doclist.nList        (length of pList in bytes)\r\n**   FTs3Expr.pPhrase->doclist.pList        (pointer to position list)\r\n**\r\n** It says above that this function advances the expression to the next\r\n** matching row. This is usually true, but there are the following exceptions:\r\n**\r\n**   1. Deferred tokens are not taken into account. If a phrase consists\r\n**      entirely of deferred tokens, it is assumed to match every row in\r\n**      the db. In this case the position-list is not populated at all. \r\n**\r\n**      Or, if a phrase contains one or more deferred tokens and one or\r\n**      more non-deferred tokens, then the expression is advanced to the \r\n**      next possible match, considering only non-deferred tokens. In other\r\n**      words, if the phrase is \"A B C\", and \"B\" is deferred, the expression\r\n**      is advanced to the next row that contains an instance of \"A * C\", \r\n**      where \"*\" may match any single token. The position list in this case\r\n**      is populated as for \"A * C\" before returning.\r\n**\r\n**   2. NEAR is treated as AND. If the expression is \"x NEAR y\", it is \r\n**      advanced to point to the next row that matches \"x AND y\".\r\n** \r\n** See fts3EvalTestDeferredAndNear() for details on testing if a row is\r\n** really a match, taking into account deferred tokens and NEAR operators.\r\n*/\r\nstatic void fts3EvalNextRow(\r\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\r\n  Fts3Expr *pExpr,                /* Expr. to advance to next matching row */\r\n  int *pRc                        /* IN/OUT: Error code */\r\n){\r\n  if( *pRc==SQLITE_OK ){\r\n    int bDescDoclist = pCsr->bDesc;         /* Used by DOCID_CMP() macro */\r\n    assert( pExpr->bEof==0 );\r\n    pExpr->bStart = 1;\r\n\r\n    switch( pExpr->eType ){\r\n      case FTSQUERY_NEAR:\r\n      case FTSQUERY_AND: {\r\n        Fts3Expr *pLeft = pExpr->pLeft;\r\n        Fts3Expr *pRight = pExpr->pRight;\r\n        assert( !pLeft->bDeferred || !pRight->bDeferred );\r\n\r\n        if( pLeft->bDeferred ){\r\n          /* LHS is entirely deferred. So we assume it matches every row.\r\n          ** Advance the RHS iterator to find the next row visited. */\r\n          fts3EvalNextRow(pCsr, pRight, pRc);\r\n          pExpr->iDocid = pRight->iDocid;\r\n          pExpr->bEof = pRight->bEof;\r\n        }else if( pRight->bDeferred ){\r\n          /* RHS is entirely deferred. So we assume it matches every row.\r\n          ** Advance the LHS iterator to find the next row visited. */\r\n          fts3EvalNextRow(pCsr, pLeft, pRc);\r\n          pExpr->iDocid = pLeft->iDocid;\r\n          pExpr->bEof = pLeft->bEof;\r\n        }else{\r\n          /* Neither the RHS or LHS are deferred. */\r\n          fts3EvalNextRow(pCsr, pLeft, pRc);\r\n          fts3EvalNextRow(pCsr, pRight, pRc);\r\n          while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){\r\n            sqlite3_int64 iDiff = DOCID_CMP(pLeft->iDocid, pRight->iDocid);\r\n            if( iDiff==0 ) break;\r\n            if( iDiff<0 ){\r\n              fts3EvalNextRow(pCsr, pLeft, pRc);\r\n            }else{\r\n              fts3EvalNextRow(pCsr, pRight, pRc);\r\n            }\r\n          }\r\n          pExpr->iDocid = pLeft->iDocid;\r\n          pExpr->bEof = (pLeft->bEof || pRight->bEof);\r\n        }\r\n        break;\r\n      }\r\n  \r\n      case FTSQUERY_OR: {\r\n        Fts3Expr *pLeft = pExpr->pLeft;\r\n        Fts3Expr *pRight = pExpr->pRight;\r\n        sqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid);\r\n\r\n        assert( pLeft->bStart || pLeft->iDocid==pRight->iDocid );\r\n        assert( pRight->bStart || pLeft->iDocid==pRight->iDocid );\r\n\r\n        if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){\r\n          fts3EvalNextRow(pCsr, pLeft, pRc);\r\n        }else if( pLeft->bEof || (pRight->bEof==0 && iCmp>0) ){\r\n          fts3EvalNextRow(pCsr, pRight, pRc);\r\n        }else{\r\n          fts3EvalNextRow(pCsr, pLeft, pRc);\r\n          fts3EvalNextRow(pCsr, pRight, pRc);\r\n        }\r\n\r\n        pExpr->bEof = (pLeft->bEof && pRight->bEof);\r\n        iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid);\r\n        if( pRight->bEof || (pLeft->bEof==0 &&  iCmp<0) ){\r\n          pExpr->iDocid = pLeft->iDocid;\r\n        }else{\r\n          pExpr->iDocid = pRight->iDocid;\r\n        }\r\n\r\n        break;\r\n      }\r\n\r\n      case FTSQUERY_NOT: {\r\n        Fts3Expr *pLeft = pExpr->pLeft;\r\n        Fts3Expr *pRight = pExpr->pRight;\r\n\r\n        if( pRight->bStart==0 ){\r\n          fts3EvalNextRow(pCsr, pRight, pRc);\r\n          assert( *pRc!=SQLITE_OK || pRight->bStart );\r\n        }\r\n\r\n        fts3EvalNextRow(pCsr, pLeft, pRc);\r\n        if( pLeft->bEof==0 ){\r\n          while( !*pRc \r\n              && !pRight->bEof \r\n              && DOCID_CMP(pLeft->iDocid, pRight->iDocid)>0 \r\n          ){\r\n            fts3EvalNextRow(pCsr, pRight, pRc);\r\n          }\r\n        }\r\n        pExpr->iDocid = pLeft->iDocid;\r\n        pExpr->bEof = pLeft->bEof;\r\n        break;\r\n      }\r\n\r\n      default: {\r\n        Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n        fts3EvalInvalidatePoslist(pPhrase);\r\n        *pRc = fts3EvalPhraseNext(pCsr, pPhrase, &pExpr->bEof);\r\n        pExpr->iDocid = pPhrase->doclist.iDocid;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** If *pRc is not SQLITE_OK, or if pExpr is not the root node of a NEAR\r\n** cluster, then this function returns 1 immediately.\r\n**\r\n** Otherwise, it checks if the current row really does match the NEAR \r\n** expression, using the data currently stored in the position lists \r\n** (Fts3Expr->pPhrase.doclist.pList/nList) for each phrase in the expression. \r\n**\r\n** If the current row is a match, the position list associated with each\r\n** phrase in the NEAR expression is edited in place to contain only those\r\n** phrase instances sufficiently close to their peers to satisfy all NEAR\r\n** constraints. In this case it returns 1. If the NEAR expression does not \r\n** match the current row, 0 is returned. The position lists may or may not\r\n** be edited if 0 is returned.\r\n*/\r\nstatic int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){\r\n  int res = 1;\r\n\r\n  /* The following block runs if pExpr is the root of a NEAR query.\r\n  ** For example, the query:\r\n  **\r\n  **         \"w\" NEAR \"x\" NEAR \"y\" NEAR \"z\"\r\n  **\r\n  ** which is represented in tree form as:\r\n  **\r\n  **                               |\r\n  **                          +--NEAR--+      <-- root of NEAR query\r\n  **                          |        |\r\n  **                     +--NEAR--+   \"z\"\r\n  **                     |        |\r\n  **                +--NEAR--+   \"y\"\r\n  **                |        |\r\n  **               \"w\"      \"x\"\r\n  **\r\n  ** The right-hand child of a NEAR node is always a phrase. The \r\n  ** left-hand child may be either a phrase or a NEAR node. There are\r\n  ** no exceptions to this - it's the way the parser in fts3_expr.c works.\r\n  */\r\n  if( *pRc==SQLITE_OK \r\n   && pExpr->eType==FTSQUERY_NEAR \r\n   && pExpr->bEof==0\r\n   && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)\r\n  ){\r\n    Fts3Expr *p; \r\n    int nTmp = 0;                 /* Bytes of temp space */\r\n    char *aTmp;                   /* Temp space for PoslistNearMerge() */\r\n\r\n    /* Allocate temporary working space. */\r\n    for(p=pExpr; p->pLeft; p=p->pLeft){\r\n      nTmp += p->pRight->pPhrase->doclist.nList;\r\n    }\r\n    nTmp += p->pPhrase->doclist.nList;\r\n    aTmp = sqlite3_malloc(nTmp*2);\r\n    if( !aTmp ){\r\n      *pRc = SQLITE_NOMEM;\r\n      res = 0;\r\n    }else{\r\n      char *aPoslist = p->pPhrase->doclist.pList;\r\n      int nToken = p->pPhrase->nToken;\r\n\r\n      for(p=p->pParent;res && p && p->eType==FTSQUERY_NEAR; p=p->pParent){\r\n        Fts3Phrase *pPhrase = p->pRight->pPhrase;\r\n        int nNear = p->nNear;\r\n        res = fts3EvalNearTrim(nNear, aTmp, &aPoslist, &nToken, pPhrase);\r\n      }\r\n  \r\n      aPoslist = pExpr->pRight->pPhrase->doclist.pList;\r\n      nToken = pExpr->pRight->pPhrase->nToken;\r\n      for(p=pExpr->pLeft; p && res; p=p->pLeft){\r\n        int nNear;\r\n        Fts3Phrase *pPhrase;\r\n        assert( p->pParent && p->pParent->pLeft==p );\r\n        nNear = p->pParent->nNear;\r\n        pPhrase = (\r\n            p->eType==FTSQUERY_NEAR ? p->pRight->pPhrase : p->pPhrase\r\n        );\r\n        res = fts3EvalNearTrim(nNear, aTmp, &aPoslist, &nToken, pPhrase);\r\n      }\r\n    }\r\n\r\n    sqlite3_free(aTmp);\r\n  }\r\n\r\n  return res;\r\n}\r\n\r\n/*\r\n** This function is a helper function for fts3EvalTestDeferredAndNear().\r\n** Assuming no error occurs or has occurred, It returns non-zero if the\r\n** expression passed as the second argument matches the row that pCsr \r\n** currently points to, or zero if it does not.\r\n**\r\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\r\n** If an error occurs during execution of this function, *pRc is set to \r\n** the appropriate SQLite error code. In this case the returned value is \r\n** undefined.\r\n*/\r\nstatic int fts3EvalTestExpr(\r\n  Fts3Cursor *pCsr,               /* FTS cursor handle */\r\n  Fts3Expr *pExpr,                /* Expr to test. May or may not be root. */\r\n  int *pRc                        /* IN/OUT: Error code */\r\n){\r\n  int bHit = 1;                   /* Return value */\r\n  if( *pRc==SQLITE_OK ){\r\n    switch( pExpr->eType ){\r\n      case FTSQUERY_NEAR:\r\n      case FTSQUERY_AND:\r\n        bHit = (\r\n            fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc)\r\n         && fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)\r\n         && fts3EvalNearTest(pExpr, pRc)\r\n        );\r\n\r\n        /* If the NEAR expression does not match any rows, zero the doclist for \r\n        ** all phrases involved in the NEAR. This is because the snippet(),\r\n        ** offsets() and matchinfo() functions are not supposed to recognize \r\n        ** any instances of phrases that are part of unmatched NEAR queries. \r\n        ** For example if this expression:\r\n        **\r\n        **    ... MATCH 'a OR (b NEAR c)'\r\n        **\r\n        ** is matched against a row containing:\r\n        **\r\n        **        'a b d e'\r\n        **\r\n        ** then any snippet() should ony highlight the \"a\" term, not the \"b\"\r\n        ** (as \"b\" is part of a non-matching NEAR clause).\r\n        */\r\n        if( bHit==0 \r\n         && pExpr->eType==FTSQUERY_NEAR \r\n         && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)\r\n        ){\r\n          Fts3Expr *p;\r\n          for(p=pExpr; p->pPhrase==0; p=p->pLeft){\r\n            if( p->pRight->iDocid==pCsr->iPrevId ){\r\n              fts3EvalInvalidatePoslist(p->pRight->pPhrase);\r\n            }\r\n          }\r\n          if( p->iDocid==pCsr->iPrevId ){\r\n            fts3EvalInvalidatePoslist(p->pPhrase);\r\n          }\r\n        }\r\n\r\n        break;\r\n\r\n      case FTSQUERY_OR: {\r\n        int bHit1 = fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc);\r\n        int bHit2 = fts3EvalTestExpr(pCsr, pExpr->pRight, pRc);\r\n        bHit = bHit1 || bHit2;\r\n        break;\r\n      }\r\n\r\n      case FTSQUERY_NOT:\r\n        bHit = (\r\n            fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc)\r\n         && !fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)\r\n        );\r\n        break;\r\n\r\n      default: {\r\n        if( pCsr->pDeferred \r\n         && (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred)\r\n        ){\r\n          Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n          assert( pExpr->bDeferred || pPhrase->doclist.bFreeList==0 );\r\n          if( pExpr->bDeferred ){\r\n            fts3EvalInvalidatePoslist(pPhrase);\r\n          }\r\n          *pRc = fts3EvalDeferredPhrase(pCsr, pPhrase);\r\n          bHit = (pPhrase->doclist.pList!=0);\r\n          pExpr->iDocid = pCsr->iPrevId;\r\n        }else{\r\n          bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId);\r\n        }\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  return bHit;\r\n}\r\n\r\n/*\r\n** This function is called as the second part of each xNext operation when\r\n** iterating through the results of a full-text query. At this point the\r\n** cursor points to a row that matches the query expression, with the\r\n** following caveats:\r\n**\r\n**   * Up until this point, \"NEAR\" operators in the expression have been\r\n**     treated as \"AND\".\r\n**\r\n**   * Deferred tokens have not yet been considered.\r\n**\r\n** If *pRc is not SQLITE_OK when this function is called, it immediately\r\n** returns 0. Otherwise, it tests whether or not after considering NEAR\r\n** operators and deferred tokens the current row is still a match for the\r\n** expression. It returns 1 if both of the following are true:\r\n**\r\n**   1. *pRc is SQLITE_OK when this function returns, and\r\n**\r\n**   2. After scanning the current FTS table row for the deferred tokens,\r\n**      it is determined that the row does *not* match the query.\r\n**\r\n** Or, if no error occurs and it seems the current row does match the FTS\r\n** query, return 0.\r\n*/\r\nstatic int fts3EvalTestDeferredAndNear(Fts3Cursor *pCsr, int *pRc){\r\n  int rc = *pRc;\r\n  int bMiss = 0;\r\n  if( rc==SQLITE_OK ){\r\n\r\n    /* If there are one or more deferred tokens, load the current row into\r\n    ** memory and scan it to determine the position list for each deferred\r\n    ** token. Then, see if this row is really a match, considering deferred\r\n    ** tokens and NEAR operators (neither of which were taken into account\r\n    ** earlier, by fts3EvalNextRow()). \r\n    */\r\n    if( pCsr->pDeferred ){\r\n      rc = fts3CursorSeek(0, pCsr);\r\n      if( rc==SQLITE_OK ){\r\n        rc = sqlite3Fts3CacheDeferredDoclists(pCsr);\r\n      }\r\n    }\r\n    bMiss = (0==fts3EvalTestExpr(pCsr, pCsr->pExpr, &rc));\r\n\r\n    /* Free the position-lists accumulated for each deferred token above. */\r\n    sqlite3Fts3FreeDeferredDoclists(pCsr);\r\n    *pRc = rc;\r\n  }\r\n  return (rc==SQLITE_OK && bMiss);\r\n}\r\n\r\n/*\r\n** Advance to the next document that matches the FTS expression in\r\n** Fts3Cursor.pExpr.\r\n*/\r\nstatic int fts3EvalNext(Fts3Cursor *pCsr){\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n  Fts3Expr *pExpr = pCsr->pExpr;\r\n  assert( pCsr->isEof==0 );\r\n  if( pExpr==0 ){\r\n    pCsr->isEof = 1;\r\n  }else{\r\n    do {\r\n      if( pCsr->isRequireSeek==0 ){\r\n        sqlite3_reset(pCsr->pStmt);\r\n      }\r\n      assert( sqlite3_data_count(pCsr->pStmt)==0 );\r\n      fts3EvalNextRow(pCsr, pExpr, &rc);\r\n      pCsr->isEof = pExpr->bEof;\r\n      pCsr->isRequireSeek = 1;\r\n      pCsr->isMatchinfoNeeded = 1;\r\n      pCsr->iPrevId = pExpr->iDocid;\r\n    }while( pCsr->isEof==0 && fts3EvalTestDeferredAndNear(pCsr, &rc) );\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Restart interation for expression pExpr so that the next call to\r\n** fts3EvalNext() visits the first row. Do not allow incremental \r\n** loading or merging of phrase doclists for this iteration.\r\n**\r\n** If *pRc is other than SQLITE_OK when this function is called, it is\r\n** a no-op. If an error occurs within this function, *pRc is set to an\r\n** SQLite error code before returning.\r\n*/\r\nstatic void fts3EvalRestart(\r\n  Fts3Cursor *pCsr,\r\n  Fts3Expr *pExpr,\r\n  int *pRc\r\n){\r\n  if( pExpr && *pRc==SQLITE_OK ){\r\n    Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n\r\n    if( pPhrase ){\r\n      fts3EvalInvalidatePoslist(pPhrase);\r\n      if( pPhrase->bIncr ){\r\n        assert( pPhrase->nToken==1 );\r\n        assert( pPhrase->aToken[0].pSegcsr );\r\n        sqlite3Fts3MsrIncrRestart(pPhrase->aToken[0].pSegcsr);\r\n        *pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase);\r\n      }\r\n\r\n      pPhrase->doclist.pNextDocid = 0;\r\n      pPhrase->doclist.iDocid = 0;\r\n    }\r\n\r\n    pExpr->iDocid = 0;\r\n    pExpr->bEof = 0;\r\n    pExpr->bStart = 0;\r\n\r\n    fts3EvalRestart(pCsr, pExpr->pLeft, pRc);\r\n    fts3EvalRestart(pCsr, pExpr->pRight, pRc);\r\n  }\r\n}\r\n\r\n/*\r\n** After allocating the Fts3Expr.aMI[] array for each phrase in the \r\n** expression rooted at pExpr, the cursor iterates through all rows matched\r\n** by pExpr, calling this function for each row. This function increments\r\n** the values in Fts3Expr.aMI[] according to the position-list currently\r\n** found in Fts3Expr.pPhrase->doclist.pList for each of the phrase \r\n** expression nodes.\r\n*/\r\nstatic void fts3EvalUpdateCounts(Fts3Expr *pExpr){\r\n  if( pExpr ){\r\n    Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n    if( pPhrase && pPhrase->doclist.pList ){\r\n      int iCol = 0;\r\n      char *p = pPhrase->doclist.pList;\r\n\r\n      assert( *p );\r\n      while( 1 ){\r\n        u8 c = 0;\r\n        int iCnt = 0;\r\n        while( 0xFE & (*p | c) ){\r\n          if( (c&0x80)==0 ) iCnt++;\r\n          c = *p++ & 0x80;\r\n        }\r\n\r\n        /* aMI[iCol*3 + 1] = Number of occurrences\r\n        ** aMI[iCol*3 + 2] = Number of rows containing at least one instance\r\n        */\r\n        pExpr->aMI[iCol*3 + 1] += iCnt;\r\n        pExpr->aMI[iCol*3 + 2] += (iCnt>0);\r\n        if( *p==0x00 ) break;\r\n        p++;\r\n        p += sqlite3Fts3GetVarint32(p, &iCol);\r\n      }\r\n    }\r\n\r\n    fts3EvalUpdateCounts(pExpr->pLeft);\r\n    fts3EvalUpdateCounts(pExpr->pRight);\r\n  }\r\n}\r\n\r\n/*\r\n** Expression pExpr must be of type FTSQUERY_PHRASE.\r\n**\r\n** If it is not already allocated and populated, this function allocates and\r\n** populates the Fts3Expr.aMI[] array for expression pExpr. If pExpr is part\r\n** of a NEAR expression, then it also allocates and populates the same array\r\n** for all other phrases that are part of the NEAR expression.\r\n**\r\n** SQLITE_OK is returned if the aMI[] array is successfully allocated and\r\n** populated. Otherwise, if an error occurs, an SQLite error code is returned.\r\n*/\r\nstatic int fts3EvalGatherStats(\r\n  Fts3Cursor *pCsr,               /* Cursor object */\r\n  Fts3Expr *pExpr                 /* FTSQUERY_PHRASE expression */\r\n){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n\r\n  assert( pExpr->eType==FTSQUERY_PHRASE );\r\n  if( pExpr->aMI==0 ){\r\n    Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n    Fts3Expr *pRoot;                /* Root of NEAR expression */\r\n    Fts3Expr *p;                    /* Iterator used for several purposes */\r\n\r\n    sqlite3_int64 iPrevId = pCsr->iPrevId;\r\n    sqlite3_int64 iDocid;\r\n    u8 bEof;\r\n\r\n    /* Find the root of the NEAR expression */\r\n    pRoot = pExpr;\r\n    while( pRoot->pParent && pRoot->pParent->eType==FTSQUERY_NEAR ){\r\n      pRoot = pRoot->pParent;\r\n    }\r\n    iDocid = pRoot->iDocid;\r\n    bEof = pRoot->bEof;\r\n    assert( pRoot->bStart );\r\n\r\n    /* Allocate space for the aMSI[] array of each FTSQUERY_PHRASE node */\r\n    for(p=pRoot; p; p=p->pLeft){\r\n      Fts3Expr *pE = (p->eType==FTSQUERY_PHRASE?p:p->pRight);\r\n      assert( pE->aMI==0 );\r\n      pE->aMI = (u32 *)sqlite3_malloc(pTab->nColumn * 3 * sizeof(u32));\r\n      if( !pE->aMI ) return SQLITE_NOMEM;\r\n      memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32));\r\n    }\r\n\r\n    fts3EvalRestart(pCsr, pRoot, &rc);\r\n\r\n    while( pCsr->isEof==0 && rc==SQLITE_OK ){\r\n\r\n      do {\r\n        /* Ensure the %_content statement is reset. */\r\n        if( pCsr->isRequireSeek==0 ) sqlite3_reset(pCsr->pStmt);\r\n        assert( sqlite3_data_count(pCsr->pStmt)==0 );\r\n\r\n        /* Advance to the next document */\r\n        fts3EvalNextRow(pCsr, pRoot, &rc);\r\n        pCsr->isEof = pRoot->bEof;\r\n        pCsr->isRequireSeek = 1;\r\n        pCsr->isMatchinfoNeeded = 1;\r\n        pCsr->iPrevId = pRoot->iDocid;\r\n      }while( pCsr->isEof==0 \r\n           && pRoot->eType==FTSQUERY_NEAR \r\n           && fts3EvalTestDeferredAndNear(pCsr, &rc) \r\n      );\r\n\r\n      if( rc==SQLITE_OK && pCsr->isEof==0 ){\r\n        fts3EvalUpdateCounts(pRoot);\r\n      }\r\n    }\r\n\r\n    pCsr->isEof = 0;\r\n    pCsr->iPrevId = iPrevId;\r\n\r\n    if( bEof ){\r\n      pRoot->bEof = bEof;\r\n    }else{\r\n      /* Caution: pRoot may iterate through docids in ascending or descending\r\n      ** order. For this reason, even though it seems more defensive, the \r\n      ** do loop can not be written:\r\n      **\r\n      **   do {...} while( pRoot->iDocid<iDocid && rc==SQLITE_OK );\r\n      */\r\n      fts3EvalRestart(pCsr, pRoot, &rc);\r\n      do {\r\n        fts3EvalNextRow(pCsr, pRoot, &rc);\r\n        assert( pRoot->bEof==0 );\r\n      }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK );\r\n      fts3EvalTestDeferredAndNear(pCsr, &rc);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is used by the matchinfo() module to query a phrase \r\n** expression node for the following information:\r\n**\r\n**   1. The total number of occurrences of the phrase in each column of \r\n**      the FTS table (considering all rows), and\r\n**\r\n**   2. For each column, the number of rows in the table for which the\r\n**      column contains at least one instance of the phrase.\r\n**\r\n** If no error occurs, SQLITE_OK is returned and the values for each column\r\n** written into the array aiOut as follows:\r\n**\r\n**   aiOut[iCol*3 + 1] = Number of occurrences\r\n**   aiOut[iCol*3 + 2] = Number of rows containing at least one instance\r\n**\r\n** Caveats:\r\n**\r\n**   * If a phrase consists entirely of deferred tokens, then all output \r\n**     values are set to the number of documents in the table. In other\r\n**     words we assume that very common tokens occur exactly once in each \r\n**     column of each row of the table.\r\n**\r\n**   * If a phrase contains some deferred tokens (and some non-deferred \r\n**     tokens), count the potential occurrence identified by considering\r\n**     the non-deferred tokens instead of actual phrase occurrences.\r\n**\r\n**   * If the phrase is part of a NEAR expression, then only phrase instances\r\n**     that meet the NEAR constraint are included in the counts.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(\r\n  Fts3Cursor *pCsr,               /* FTS cursor handle */\r\n  Fts3Expr *pExpr,                /* Phrase expression */\r\n  u32 *aiOut                      /* Array to write results into (see above) */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int rc = SQLITE_OK;\r\n  int iCol;\r\n\r\n  if( pExpr->bDeferred && pExpr->pParent->eType!=FTSQUERY_NEAR ){\r\n    assert( pCsr->nDoc>0 );\r\n    for(iCol=0; iCol<pTab->nColumn; iCol++){\r\n      aiOut[iCol*3 + 1] = (u32)pCsr->nDoc;\r\n      aiOut[iCol*3 + 2] = (u32)pCsr->nDoc;\r\n    }\r\n  }else{\r\n    rc = fts3EvalGatherStats(pCsr, pExpr);\r\n    if( rc==SQLITE_OK ){\r\n      assert( pExpr->aMI );\r\n      for(iCol=0; iCol<pTab->nColumn; iCol++){\r\n        aiOut[iCol*3 + 1] = pExpr->aMI[iCol*3 + 1];\r\n        aiOut[iCol*3 + 2] = pExpr->aMI[iCol*3 + 2];\r\n      }\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The expression pExpr passed as the second argument to this function\r\n** must be of type FTSQUERY_PHRASE. \r\n**\r\n** The returned value is either NULL or a pointer to a buffer containing\r\n** a position-list indicating the occurrences of the phrase in column iCol\r\n** of the current row. \r\n**\r\n** More specifically, the returned buffer contains 1 varint for each \r\n** occurence of the phrase in the column, stored using the normal (delta+2) \r\n** compression and is terminated by either an 0x01 or 0x00 byte. For example,\r\n** if the requested column contains \"a b X c d X X\" and the position-list\r\n** for 'X' is requested, the buffer returned may contain:\r\n**\r\n**     0x04 0x05 0x03 0x01   or   0x04 0x05 0x03 0x00\r\n**\r\n** This function works regardless of whether or not the phrase is deferred,\r\n** incremental, or neither.\r\n*/\r\nSQLITE_PRIVATE char *sqlite3Fts3EvalPhrasePoslist(\r\n  Fts3Cursor *pCsr,               /* FTS3 cursor object */\r\n  Fts3Expr *pExpr,                /* Phrase to return doclist for */\r\n  int iCol                        /* Column to return position list for */\r\n){\r\n  Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  char *pIter = pPhrase->doclist.pList;\r\n  int iThis;\r\n\r\n  assert( iCol>=0 && iCol<pTab->nColumn );\r\n  if( !pIter \r\n   || pExpr->bEof \r\n   || pExpr->iDocid!=pCsr->iPrevId\r\n   || (pPhrase->iColumn<pTab->nColumn && pPhrase->iColumn!=iCol) \r\n  ){\r\n    return 0;\r\n  }\r\n\r\n  assert( pPhrase->doclist.nList>0 );\r\n  if( *pIter==0x01 ){\r\n    pIter++;\r\n    pIter += sqlite3Fts3GetVarint32(pIter, &iThis);\r\n  }else{\r\n    iThis = 0;\r\n  }\r\n  while( iThis<iCol ){\r\n    fts3ColumnlistCopy(0, &pIter);\r\n    if( *pIter==0x00 ) return 0;\r\n    pIter++;\r\n    pIter += sqlite3Fts3GetVarint32(pIter, &iThis);\r\n  }\r\n\r\n  return ((iCol==iThis)?pIter:0);\r\n}\r\n\r\n/*\r\n** Free all components of the Fts3Phrase structure that were allocated by\r\n** the eval module. Specifically, this means to free:\r\n**\r\n**   * the contents of pPhrase->doclist, and\r\n**   * any Fts3MultiSegReader objects held by phrase tokens.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *pPhrase){\r\n  if( pPhrase ){\r\n    int i;\r\n    sqlite3_free(pPhrase->doclist.aAll);\r\n    fts3EvalInvalidatePoslist(pPhrase);\r\n    memset(&pPhrase->doclist, 0, sizeof(Fts3Doclist));\r\n    for(i=0; i<pPhrase->nToken; i++){\r\n      fts3SegReaderCursorFree(pPhrase->aToken[i].pSegcsr);\r\n      pPhrase->aToken[i].pSegcsr = 0;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Return SQLITE_CORRUPT_VTAB.\r\n*/\r\n#ifdef SQLITE_DEBUG\r\nSQLITE_PRIVATE int sqlite3Fts3Corrupt(){\r\n  return SQLITE_CORRUPT_VTAB;\r\n}\r\n#endif\r\n\r\n#if !SQLITE_CORE\r\n/*\r\n** Initialize API pointer table, if required.\r\n*/\r\nSQLITE_API int sqlite3_extension_init(\r\n  sqlite3 *db, \r\n  char **pzErrMsg,\r\n  const sqlite3_api_routines *pApi\r\n){\r\n  SQLITE_EXTENSION_INIT2(pApi)\r\n  return sqlite3Fts3Init(db);\r\n}\r\n#endif\r\n\r\n#endif\r\n\r\n/************** End of fts3.c ************************************************/\r\n/************** Begin file fts3_aux.c ****************************************/\r\n/*\r\n** 2011 Jan 27\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <string.h> */\r\n/* #include <assert.h> */\r\n\r\ntypedef struct Fts3auxTable Fts3auxTable;\r\ntypedef struct Fts3auxCursor Fts3auxCursor;\r\n\r\nstruct Fts3auxTable {\r\n  sqlite3_vtab base;              /* Base class used by SQLite core */\r\n  Fts3Table *pFts3Tab;\r\n};\r\n\r\nstruct Fts3auxCursor {\r\n  sqlite3_vtab_cursor base;       /* Base class used by SQLite core */\r\n  Fts3MultiSegReader csr;        /* Must be right after \"base\" */\r\n  Fts3SegFilter filter;\r\n  char *zStop;\r\n  int nStop;                      /* Byte-length of string zStop */\r\n  int isEof;                      /* True if cursor is at EOF */\r\n  sqlite3_int64 iRowid;           /* Current rowid */\r\n\r\n  int iCol;                       /* Current value of 'col' column */\r\n  int nStat;                      /* Size of aStat[] array */\r\n  struct Fts3auxColstats {\r\n    sqlite3_int64 nDoc;           /* 'documents' values for current csr row */\r\n    sqlite3_int64 nOcc;           /* 'occurrences' values for current csr row */\r\n  } *aStat;\r\n};\r\n\r\n/*\r\n** Schema of the terms table.\r\n*/\r\n#define FTS3_TERMS_SCHEMA \"CREATE TABLE x(term, col, documents, occurrences)\"\r\n\r\n/*\r\n** This function does all the work for both the xConnect and xCreate methods.\r\n** These tables have no persistent representation of their own, so xConnect\r\n** and xCreate are identical operations.\r\n*/\r\nstatic int fts3auxConnectMethod(\r\n  sqlite3 *db,                    /* Database connection */\r\n  void *pUnused,                  /* Unused */\r\n  int argc,                       /* Number of elements in argv array */\r\n  const char * const *argv,       /* xCreate/xConnect argument array */\r\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\r\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\r\n){\r\n  char const *zDb;                /* Name of database (e.g. \"main\") */\r\n  char const *zFts3;              /* Name of fts3 table */\r\n  int nDb;                        /* Result of strlen(zDb) */\r\n  int nFts3;                      /* Result of strlen(zFts3) */\r\n  int nByte;                      /* Bytes of space to allocate here */\r\n  int rc;                         /* value returned by declare_vtab() */\r\n  Fts3auxTable *p;                /* Virtual table object to return */\r\n\r\n  UNUSED_PARAMETER(pUnused);\r\n\r\n  /* The user should specify a single argument - the name of an fts3 table. */\r\n  if( argc!=4 ){\r\n    *pzErr = sqlite3_mprintf(\r\n        \"wrong number of arguments to fts4aux constructor\"\r\n    );\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  zDb = argv[1]; \r\n  nDb = (int)strlen(zDb);\r\n  zFts3 = argv[3];\r\n  nFts3 = (int)strlen(zFts3);\r\n\r\n  rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;\r\n  p = (Fts3auxTable *)sqlite3_malloc(nByte);\r\n  if( !p ) return SQLITE_NOMEM;\r\n  memset(p, 0, nByte);\r\n\r\n  p->pFts3Tab = (Fts3Table *)&p[1];\r\n  p->pFts3Tab->zDb = (char *)&p->pFts3Tab[1];\r\n  p->pFts3Tab->zName = &p->pFts3Tab->zDb[nDb+1];\r\n  p->pFts3Tab->db = db;\r\n  p->pFts3Tab->nIndex = 1;\r\n\r\n  memcpy((char *)p->pFts3Tab->zDb, zDb, nDb);\r\n  memcpy((char *)p->pFts3Tab->zName, zFts3, nFts3);\r\n  sqlite3Fts3Dequote((char *)p->pFts3Tab->zName);\r\n\r\n  *ppVtab = (sqlite3_vtab *)p;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function does the work for both the xDisconnect and xDestroy methods.\r\n** These tables have no persistent representation of their own, so xDisconnect\r\n** and xDestroy are identical operations.\r\n*/\r\nstatic int fts3auxDisconnectMethod(sqlite3_vtab *pVtab){\r\n  Fts3auxTable *p = (Fts3auxTable *)pVtab;\r\n  Fts3Table *pFts3 = p->pFts3Tab;\r\n  int i;\r\n\r\n  /* Free any prepared statements held */\r\n  for(i=0; i<SizeofArray(pFts3->aStmt); i++){\r\n    sqlite3_finalize(pFts3->aStmt[i]);\r\n  }\r\n  sqlite3_free(pFts3->zSegmentsTbl);\r\n  sqlite3_free(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\n#define FTS4AUX_EQ_CONSTRAINT 1\r\n#define FTS4AUX_GE_CONSTRAINT 2\r\n#define FTS4AUX_LE_CONSTRAINT 4\r\n\r\n/*\r\n** xBestIndex - Analyze a WHERE and ORDER BY clause.\r\n*/\r\nstatic int fts3auxBestIndexMethod(\r\n  sqlite3_vtab *pVTab, \r\n  sqlite3_index_info *pInfo\r\n){\r\n  int i;\r\n  int iEq = -1;\r\n  int iGe = -1;\r\n  int iLe = -1;\r\n\r\n  UNUSED_PARAMETER(pVTab);\r\n\r\n  /* This vtab delivers always results in \"ORDER BY term ASC\" order. */\r\n  if( pInfo->nOrderBy==1 \r\n   && pInfo->aOrderBy[0].iColumn==0 \r\n   && pInfo->aOrderBy[0].desc==0\r\n  ){\r\n    pInfo->orderByConsumed = 1;\r\n  }\r\n\r\n  /* Search for equality and range constraints on the \"term\" column. */\r\n  for(i=0; i<pInfo->nConstraint; i++){\r\n    if( pInfo->aConstraint[i].usable && pInfo->aConstraint[i].iColumn==0 ){\r\n      int op = pInfo->aConstraint[i].op;\r\n      if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;\r\n      if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;\r\n      if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;\r\n      if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;\r\n      if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;\r\n    }\r\n  }\r\n\r\n  if( iEq>=0 ){\r\n    pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT;\r\n    pInfo->aConstraintUsage[iEq].argvIndex = 1;\r\n    pInfo->estimatedCost = 5;\r\n  }else{\r\n    pInfo->idxNum = 0;\r\n    pInfo->estimatedCost = 20000;\r\n    if( iGe>=0 ){\r\n      pInfo->idxNum += FTS4AUX_GE_CONSTRAINT;\r\n      pInfo->aConstraintUsage[iGe].argvIndex = 1;\r\n      pInfo->estimatedCost /= 2;\r\n    }\r\n    if( iLe>=0 ){\r\n      pInfo->idxNum += FTS4AUX_LE_CONSTRAINT;\r\n      pInfo->aConstraintUsage[iLe].argvIndex = 1 + (iGe>=0);\r\n      pInfo->estimatedCost /= 2;\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** xOpen - Open a cursor.\r\n*/\r\nstatic int fts3auxOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){\r\n  Fts3auxCursor *pCsr;            /* Pointer to cursor object to return */\r\n\r\n  UNUSED_PARAMETER(pVTab);\r\n\r\n  pCsr = (Fts3auxCursor *)sqlite3_malloc(sizeof(Fts3auxCursor));\r\n  if( !pCsr ) return SQLITE_NOMEM;\r\n  memset(pCsr, 0, sizeof(Fts3auxCursor));\r\n\r\n  *ppCsr = (sqlite3_vtab_cursor *)pCsr;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** xClose - Close a cursor.\r\n*/\r\nstatic int fts3auxCloseMethod(sqlite3_vtab_cursor *pCursor){\r\n  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;\r\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\r\n\r\n  sqlite3Fts3SegmentsClose(pFts3);\r\n  sqlite3Fts3SegReaderFinish(&pCsr->csr);\r\n  sqlite3_free((void *)pCsr->filter.zTerm);\r\n  sqlite3_free(pCsr->zStop);\r\n  sqlite3_free(pCsr->aStat);\r\n  sqlite3_free(pCsr);\r\n  return SQLITE_OK;\r\n}\r\n\r\nstatic int fts3auxGrowStatArray(Fts3auxCursor *pCsr, int nSize){\r\n  if( nSize>pCsr->nStat ){\r\n    struct Fts3auxColstats *aNew;\r\n    aNew = (struct Fts3auxColstats *)sqlite3_realloc(pCsr->aStat, \r\n        sizeof(struct Fts3auxColstats) * nSize\r\n    );\r\n    if( aNew==0 ) return SQLITE_NOMEM;\r\n    memset(&aNew[pCsr->nStat], 0, \r\n        sizeof(struct Fts3auxColstats) * (nSize - pCsr->nStat)\r\n    );\r\n    pCsr->aStat = aNew;\r\n    pCsr->nStat = nSize;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** xNext - Advance the cursor to the next row, if any.\r\n*/\r\nstatic int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){\r\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\r\n  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;\r\n  int rc;\r\n\r\n  /* Increment our pretend rowid value. */\r\n  pCsr->iRowid++;\r\n\r\n  for(pCsr->iCol++; pCsr->iCol<pCsr->nStat; pCsr->iCol++){\r\n    if( pCsr->aStat[pCsr->iCol].nDoc>0 ) return SQLITE_OK;\r\n  }\r\n\r\n  rc = sqlite3Fts3SegReaderStep(pFts3, &pCsr->csr);\r\n  if( rc==SQLITE_ROW ){\r\n    int i = 0;\r\n    int nDoclist = pCsr->csr.nDoclist;\r\n    char *aDoclist = pCsr->csr.aDoclist;\r\n    int iCol;\r\n\r\n    int eState = 0;\r\n\r\n    if( pCsr->zStop ){\r\n      int n = (pCsr->nStop<pCsr->csr.nTerm) ? pCsr->nStop : pCsr->csr.nTerm;\r\n      int mc = memcmp(pCsr->zStop, pCsr->csr.zTerm, n);\r\n      if( mc<0 || (mc==0 && pCsr->csr.nTerm>pCsr->nStop) ){\r\n        pCsr->isEof = 1;\r\n        return SQLITE_OK;\r\n      }\r\n    }\r\n\r\n    if( fts3auxGrowStatArray(pCsr, 2) ) return SQLITE_NOMEM;\r\n    memset(pCsr->aStat, 0, sizeof(struct Fts3auxColstats) * pCsr->nStat);\r\n    iCol = 0;\r\n\r\n    while( i<nDoclist ){\r\n      sqlite3_int64 v = 0;\r\n\r\n      i += sqlite3Fts3GetVarint(&aDoclist[i], &v);\r\n      switch( eState ){\r\n        /* State 0. In this state the integer just read was a docid. */\r\n        case 0:\r\n          pCsr->aStat[0].nDoc++;\r\n          eState = 1;\r\n          iCol = 0;\r\n          break;\r\n\r\n        /* State 1. In this state we are expecting either a 1, indicating\r\n        ** that the following integer will be a column number, or the\r\n        ** start of a position list for column 0.  \r\n        ** \r\n        ** The only difference between state 1 and state 2 is that if the\r\n        ** integer encountered in state 1 is not 0 or 1, then we need to\r\n        ** increment the column 0 \"nDoc\" count for this term.\r\n        */\r\n        case 1:\r\n          assert( iCol==0 );\r\n          if( v>1 ){\r\n            pCsr->aStat[1].nDoc++;\r\n          }\r\n          eState = 2;\r\n          /* fall through */\r\n\r\n        case 2:\r\n          if( v==0 ){       /* 0x00. Next integer will be a docid. */\r\n            eState = 0;\r\n          }else if( v==1 ){ /* 0x01. Next integer will be a column number. */\r\n            eState = 3;\r\n          }else{            /* 2 or greater. A position. */\r\n            pCsr->aStat[iCol+1].nOcc++;\r\n            pCsr->aStat[0].nOcc++;\r\n          }\r\n          break;\r\n\r\n        /* State 3. The integer just read is a column number. */\r\n        default: assert( eState==3 );\r\n          iCol = (int)v;\r\n          if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM;\r\n          pCsr->aStat[iCol+1].nDoc++;\r\n          eState = 2;\r\n          break;\r\n      }\r\n    }\r\n\r\n    pCsr->iCol = 0;\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    pCsr->isEof = 1;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** xFilter - Initialize a cursor to point at the start of its data.\r\n*/\r\nstatic int fts3auxFilterMethod(\r\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\r\n  int idxNum,                     /* Strategy index */\r\n  const char *idxStr,             /* Unused */\r\n  int nVal,                       /* Number of elements in apVal */\r\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\r\n){\r\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\r\n  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;\r\n  int rc;\r\n  int isScan;\r\n\r\n  UNUSED_PARAMETER(nVal);\r\n  UNUSED_PARAMETER(idxStr);\r\n\r\n  assert( idxStr==0 );\r\n  assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0\r\n       || idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT\r\n       || idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)\r\n  );\r\n  isScan = (idxNum!=FTS4AUX_EQ_CONSTRAINT);\r\n\r\n  /* In case this cursor is being reused, close and zero it. */\r\n  testcase(pCsr->filter.zTerm);\r\n  sqlite3Fts3SegReaderFinish(&pCsr->csr);\r\n  sqlite3_free((void *)pCsr->filter.zTerm);\r\n  sqlite3_free(pCsr->aStat);\r\n  memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr);\r\n\r\n  pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;\r\n  if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;\r\n\r\n  if( idxNum&(FTS4AUX_EQ_CONSTRAINT|FTS4AUX_GE_CONSTRAINT) ){\r\n    const unsigned char *zStr = sqlite3_value_text(apVal[0]);\r\n    if( zStr ){\r\n      pCsr->filter.zTerm = sqlite3_mprintf(\"%s\", zStr);\r\n      pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);\r\n      if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;\r\n    }\r\n  }\r\n  if( idxNum&FTS4AUX_LE_CONSTRAINT ){\r\n    int iIdx = (idxNum&FTS4AUX_GE_CONSTRAINT) ? 1 : 0;\r\n    pCsr->zStop = sqlite3_mprintf(\"%s\", sqlite3_value_text(apVal[iIdx]));\r\n    pCsr->nStop = sqlite3_value_bytes(apVal[iIdx]);\r\n    if( pCsr->zStop==0 ) return SQLITE_NOMEM;\r\n  }\r\n\r\n  rc = sqlite3Fts3SegReaderCursor(pFts3, 0, 0, FTS3_SEGCURSOR_ALL,\r\n      pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr\r\n  );\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ) rc = fts3auxNextMethod(pCursor);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** xEof - Return true if the cursor is at EOF, or false otherwise.\r\n*/\r\nstatic int fts3auxEofMethod(sqlite3_vtab_cursor *pCursor){\r\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\r\n  return pCsr->isEof;\r\n}\r\n\r\n/*\r\n** xColumn - Return a column value.\r\n*/\r\nstatic int fts3auxColumnMethod(\r\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\r\n  sqlite3_context *pContext,      /* Context for sqlite3_result_xxx() calls */\r\n  int iCol                        /* Index of column to read value from */\r\n){\r\n  Fts3auxCursor *p = (Fts3auxCursor *)pCursor;\r\n\r\n  assert( p->isEof==0 );\r\n  if( iCol==0 ){        /* Column \"term\" */\r\n    sqlite3_result_text(pContext, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);\r\n  }else if( iCol==1 ){  /* Column \"col\" */\r\n    if( p->iCol ){\r\n      sqlite3_result_int(pContext, p->iCol-1);\r\n    }else{\r\n      sqlite3_result_text(pContext, \"*\", -1, SQLITE_STATIC);\r\n    }\r\n  }else if( iCol==2 ){  /* Column \"documents\" */\r\n    sqlite3_result_int64(pContext, p->aStat[p->iCol].nDoc);\r\n  }else{                /* Column \"occurrences\" */\r\n    sqlite3_result_int64(pContext, p->aStat[p->iCol].nOcc);\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** xRowid - Return the current rowid for the cursor.\r\n*/\r\nstatic int fts3auxRowidMethod(\r\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\r\n  sqlite_int64 *pRowid            /* OUT: Rowid value */\r\n){\r\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\r\n  *pRowid = pCsr->iRowid;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Register the fts3aux module with database connection db. Return SQLITE_OK\r\n** if successful or an error code if sqlite3_create_module() fails.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){\r\n  static const sqlite3_module fts3aux_module = {\r\n     0,                           /* iVersion      */\r\n     fts3auxConnectMethod,        /* xCreate       */\r\n     fts3auxConnectMethod,        /* xConnect      */\r\n     fts3auxBestIndexMethod,      /* xBestIndex    */\r\n     fts3auxDisconnectMethod,     /* xDisconnect   */\r\n     fts3auxDisconnectMethod,     /* xDestroy      */\r\n     fts3auxOpenMethod,           /* xOpen         */\r\n     fts3auxCloseMethod,          /* xClose        */\r\n     fts3auxFilterMethod,         /* xFilter       */\r\n     fts3auxNextMethod,           /* xNext         */\r\n     fts3auxEofMethod,            /* xEof          */\r\n     fts3auxColumnMethod,         /* xColumn       */\r\n     fts3auxRowidMethod,          /* xRowid        */\r\n     0,                           /* xUpdate       */\r\n     0,                           /* xBegin        */\r\n     0,                           /* xSync         */\r\n     0,                           /* xCommit       */\r\n     0,                           /* xRollback     */\r\n     0,                           /* xFindFunction */\r\n     0,                           /* xRename       */\r\n     0,                           /* xSavepoint    */\r\n     0,                           /* xRelease      */\r\n     0                            /* xRollbackTo   */\r\n  };\r\n  int rc;                         /* Return code */\r\n\r\n  rc = sqlite3_create_module(db, \"fts4aux\", &fts3aux_module, 0);\r\n  return rc;\r\n}\r\n\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_aux.c ********************************************/\r\n/************** Begin file fts3_expr.c ***************************************/\r\n/*\r\n** 2008 Nov 28\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This module contains code that implements a parser for fts3 query strings\r\n** (the right-hand argument to the MATCH operator). Because the supported \r\n** syntax is relatively simple, the whole tokenizer/parser system is\r\n** hand-coded. \r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/*\r\n** By default, this module parses the legacy syntax that has been \r\n** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS\r\n** is defined, then it uses the new syntax. The differences between\r\n** the new and the old syntaxes are:\r\n**\r\n**  a) The new syntax supports parenthesis. The old does not.\r\n**\r\n**  b) The new syntax supports the AND and NOT operators. The old does not.\r\n**\r\n**  c) The old syntax supports the \"-\" token qualifier. This is not \r\n**     supported by the new syntax (it is replaced by the NOT operator).\r\n**\r\n**  d) When using the old syntax, the OR operator has a greater precedence\r\n**     than an implicit AND. When using the new, both implicity and explicit\r\n**     AND operators have a higher precedence than OR.\r\n**\r\n** If compiled with SQLITE_TEST defined, then this module exports the\r\n** symbol \"int sqlite3_fts3_enable_parentheses\". Setting this variable\r\n** to zero causes the module to use the old syntax. If it is set to \r\n** non-zero the new syntax is activated. This is so both syntaxes can\r\n** be tested using a single build of testfixture.\r\n**\r\n** The following describes the syntax supported by the fts3 MATCH\r\n** operator in a similar format to that used by the lemon parser\r\n** generator. This module does not use actually lemon, it uses a\r\n** custom parser.\r\n**\r\n**   query ::= andexpr (OR andexpr)*.\r\n**\r\n**   andexpr ::= notexpr (AND? notexpr)*.\r\n**\r\n**   notexpr ::= nearexpr (NOT nearexpr|-TOKEN)*.\r\n**   notexpr ::= LP query RP.\r\n**\r\n**   nearexpr ::= phrase (NEAR distance_opt nearexpr)*.\r\n**\r\n**   distance_opt ::= .\r\n**   distance_opt ::= / INTEGER.\r\n**\r\n**   phrase ::= TOKEN.\r\n**   phrase ::= COLUMN:TOKEN.\r\n**   phrase ::= \"TOKEN TOKEN TOKEN...\".\r\n*/\r\n\r\n#ifdef SQLITE_TEST\r\nSQLITE_API int sqlite3_fts3_enable_parentheses = 0;\r\n#else\r\n# ifdef SQLITE_ENABLE_FTS3_PARENTHESIS \r\n#  define sqlite3_fts3_enable_parentheses 1\r\n# else\r\n#  define sqlite3_fts3_enable_parentheses 0\r\n# endif\r\n#endif\r\n\r\n/*\r\n** Default span for NEAR operators.\r\n*/\r\n#define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10\r\n\r\n/* #include <string.h> */\r\n/* #include <assert.h> */\r\n\r\n/*\r\n** isNot:\r\n**   This variable is used by function getNextNode(). When getNextNode() is\r\n**   called, it sets ParseContext.isNot to true if the 'next node' is a \r\n**   FTSQUERY_PHRASE with a unary \"-\" attached to it. i.e. \"mysql\" in the\r\n**   FTS3 query \"sqlite -mysql\". Otherwise, ParseContext.isNot is set to\r\n**   zero.\r\n*/\r\ntypedef struct ParseContext ParseContext;\r\nstruct ParseContext {\r\n  sqlite3_tokenizer *pTokenizer;      /* Tokenizer module */\r\n  int iLangid;                        /* Language id used with tokenizer */\r\n  const char **azCol;                 /* Array of column names for fts3 table */\r\n  int bFts4;                          /* True to allow FTS4-only syntax */\r\n  int nCol;                           /* Number of entries in azCol[] */\r\n  int iDefaultCol;                    /* Default column to query */\r\n  int isNot;                          /* True if getNextNode() sees a unary - */\r\n  sqlite3_context *pCtx;              /* Write error message here */\r\n  int nNest;                          /* Number of nested brackets */\r\n};\r\n\r\n/*\r\n** This function is equivalent to the standard isspace() function. \r\n**\r\n** The standard isspace() can be awkward to use safely, because although it\r\n** is defined to accept an argument of type int, its behaviour when passed\r\n** an integer that falls outside of the range of the unsigned char type\r\n** is undefined (and sometimes, \"undefined\" means segfault). This wrapper\r\n** is defined to accept an argument of type char, and always returns 0 for\r\n** any values that fall outside of the range of the unsigned char type (i.e.\r\n** negative values).\r\n*/\r\nstatic int fts3isspace(char c){\r\n  return c==' ' || c=='\\t' || c=='\\n' || c=='\\r' || c=='\\v' || c=='\\f';\r\n}\r\n\r\n/*\r\n** Allocate nByte bytes of memory using sqlite3_malloc(). If successful,\r\n** zero the memory before returning a pointer to it. If unsuccessful, \r\n** return NULL.\r\n*/\r\nstatic void *fts3MallocZero(int nByte){\r\n  void *pRet = sqlite3_malloc(nByte);\r\n  if( pRet ) memset(pRet, 0, nByte);\r\n  return pRet;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3OpenTokenizer(\r\n  sqlite3_tokenizer *pTokenizer,\r\n  int iLangid,\r\n  const char *z,\r\n  int n,\r\n  sqlite3_tokenizer_cursor **ppCsr\r\n){\r\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\r\n  sqlite3_tokenizer_cursor *pCsr = 0;\r\n  int rc;\r\n\r\n  rc = pModule->xOpen(pTokenizer, z, n, &pCsr);\r\n  assert( rc==SQLITE_OK || pCsr==0 );\r\n  if( rc==SQLITE_OK ){\r\n    pCsr->pTokenizer = pTokenizer;\r\n    if( pModule->iVersion>=1 ){\r\n      rc = pModule->xLanguageid(pCsr, iLangid);\r\n      if( rc!=SQLITE_OK ){\r\n        pModule->xClose(pCsr);\r\n        pCsr = 0;\r\n      }\r\n    }\r\n  }\r\n  *ppCsr = pCsr;\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Extract the next token from buffer z (length n) using the tokenizer\r\n** and other information (column names etc.) in pParse. Create an Fts3Expr\r\n** structure of type FTSQUERY_PHRASE containing a phrase consisting of this\r\n** single token and set *ppExpr to point to it. If the end of the buffer is\r\n** reached before a token is found, set *ppExpr to zero. It is the\r\n** responsibility of the caller to eventually deallocate the allocated \r\n** Fts3Expr structure (if any) by passing it to sqlite3_free().\r\n**\r\n** Return SQLITE_OK if successful, or SQLITE_NOMEM if a memory allocation\r\n** fails.\r\n*/\r\nstatic int getNextToken(\r\n  ParseContext *pParse,                   /* fts3 query parse context */\r\n  int iCol,                               /* Value for Fts3Phrase.iColumn */\r\n  const char *z, int n,                   /* Input string */\r\n  Fts3Expr **ppExpr,                      /* OUT: expression */\r\n  int *pnConsumed                         /* OUT: Number of bytes consumed */\r\n){\r\n  sqlite3_tokenizer *pTokenizer = pParse->pTokenizer;\r\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\r\n  int rc;\r\n  sqlite3_tokenizer_cursor *pCursor;\r\n  Fts3Expr *pRet = 0;\r\n  int nConsumed = 0;\r\n\r\n  rc = sqlite3Fts3OpenTokenizer(pTokenizer, pParse->iLangid, z, n, &pCursor);\r\n  if( rc==SQLITE_OK ){\r\n    const char *zToken;\r\n    int nToken, iStart, iEnd, iPosition;\r\n    int nByte;                               /* total space to allocate */\r\n\r\n    rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition);\r\n    if( rc==SQLITE_OK ){\r\n      nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase) + nToken;\r\n      pRet = (Fts3Expr *)fts3MallocZero(nByte);\r\n      if( !pRet ){\r\n        rc = SQLITE_NOMEM;\r\n      }else{\r\n        pRet->eType = FTSQUERY_PHRASE;\r\n        pRet->pPhrase = (Fts3Phrase *)&pRet[1];\r\n        pRet->pPhrase->nToken = 1;\r\n        pRet->pPhrase->iColumn = iCol;\r\n        pRet->pPhrase->aToken[0].n = nToken;\r\n        pRet->pPhrase->aToken[0].z = (char *)&pRet->pPhrase[1];\r\n        memcpy(pRet->pPhrase->aToken[0].z, zToken, nToken);\r\n\r\n        if( iEnd<n && z[iEnd]=='*' ){\r\n          pRet->pPhrase->aToken[0].isPrefix = 1;\r\n          iEnd++;\r\n        }\r\n\r\n        while( 1 ){\r\n          if( !sqlite3_fts3_enable_parentheses \r\n           && iStart>0 && z[iStart-1]=='-' \r\n          ){\r\n            pParse->isNot = 1;\r\n            iStart--;\r\n          }else if( pParse->bFts4 && iStart>0 && z[iStart-1]=='^' ){\r\n            pRet->pPhrase->aToken[0].bFirst = 1;\r\n            iStart--;\r\n          }else{\r\n            break;\r\n          }\r\n        }\r\n\r\n      }\r\n      nConsumed = iEnd;\r\n    }\r\n\r\n    pModule->xClose(pCursor);\r\n  }\r\n  \r\n  *pnConsumed = nConsumed;\r\n  *ppExpr = pRet;\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Enlarge a memory allocation.  If an out-of-memory allocation occurs,\r\n** then free the old allocation.\r\n*/\r\nstatic void *fts3ReallocOrFree(void *pOrig, int nNew){\r\n  void *pRet = sqlite3_realloc(pOrig, nNew);\r\n  if( !pRet ){\r\n    sqlite3_free(pOrig);\r\n  }\r\n  return pRet;\r\n}\r\n\r\n/*\r\n** Buffer zInput, length nInput, contains the contents of a quoted string\r\n** that appeared as part of an fts3 query expression. Neither quote character\r\n** is included in the buffer. This function attempts to tokenize the entire\r\n** input buffer and create an Fts3Expr structure of type FTSQUERY_PHRASE \r\n** containing the results.\r\n**\r\n** If successful, SQLITE_OK is returned and *ppExpr set to point at the\r\n** allocated Fts3Expr structure. Otherwise, either SQLITE_NOMEM (out of memory\r\n** error) or SQLITE_ERROR (tokenization error) is returned and *ppExpr set\r\n** to 0.\r\n*/\r\nstatic int getNextString(\r\n  ParseContext *pParse,                   /* fts3 query parse context */\r\n  const char *zInput, int nInput,         /* Input string */\r\n  Fts3Expr **ppExpr                       /* OUT: expression */\r\n){\r\n  sqlite3_tokenizer *pTokenizer = pParse->pTokenizer;\r\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\r\n  int rc;\r\n  Fts3Expr *p = 0;\r\n  sqlite3_tokenizer_cursor *pCursor = 0;\r\n  char *zTemp = 0;\r\n  int nTemp = 0;\r\n\r\n  const int nSpace = sizeof(Fts3Expr) + sizeof(Fts3Phrase);\r\n  int nToken = 0;\r\n\r\n  /* The final Fts3Expr data structure, including the Fts3Phrase,\r\n  ** Fts3PhraseToken structures token buffers are all stored as a single \r\n  ** allocation so that the expression can be freed with a single call to\r\n  ** sqlite3_free(). Setting this up requires a two pass approach.\r\n  **\r\n  ** The first pass, in the block below, uses a tokenizer cursor to iterate\r\n  ** through the tokens in the expression. This pass uses fts3ReallocOrFree()\r\n  ** to assemble data in two dynamic buffers:\r\n  **\r\n  **   Buffer p: Points to the Fts3Expr structure, followed by the Fts3Phrase\r\n  **             structure, followed by the array of Fts3PhraseToken \r\n  **             structures. This pass only populates the Fts3PhraseToken array.\r\n  **\r\n  **   Buffer zTemp: Contains copies of all tokens.\r\n  **\r\n  ** The second pass, in the block that begins \"if( rc==SQLITE_DONE )\" below,\r\n  ** appends buffer zTemp to buffer p, and fills in the Fts3Expr and Fts3Phrase\r\n  ** structures.\r\n  */\r\n  rc = sqlite3Fts3OpenTokenizer(\r\n      pTokenizer, pParse->iLangid, zInput, nInput, &pCursor);\r\n  if( rc==SQLITE_OK ){\r\n    int ii;\r\n    for(ii=0; rc==SQLITE_OK; ii++){\r\n      const char *zByte;\r\n      int nByte, iBegin, iEnd, iPos;\r\n      rc = pModule->xNext(pCursor, &zByte, &nByte, &iBegin, &iEnd, &iPos);\r\n      if( rc==SQLITE_OK ){\r\n        Fts3PhraseToken *pToken;\r\n\r\n        p = fts3ReallocOrFree(p, nSpace + ii*sizeof(Fts3PhraseToken));\r\n        if( !p ) goto no_mem;\r\n\r\n        zTemp = fts3ReallocOrFree(zTemp, nTemp + nByte);\r\n        if( !zTemp ) goto no_mem;\r\n\r\n        assert( nToken==ii );\r\n        pToken = &((Fts3Phrase *)(&p[1]))->aToken[ii];\r\n        memset(pToken, 0, sizeof(Fts3PhraseToken));\r\n\r\n        memcpy(&zTemp[nTemp], zByte, nByte);\r\n        nTemp += nByte;\r\n\r\n        pToken->n = nByte;\r\n        pToken->isPrefix = (iEnd<nInput && zInput[iEnd]=='*');\r\n        pToken->bFirst = (iBegin>0 && zInput[iBegin-1]=='^');\r\n        nToken = ii+1;\r\n      }\r\n    }\r\n\r\n    pModule->xClose(pCursor);\r\n    pCursor = 0;\r\n  }\r\n\r\n  if( rc==SQLITE_DONE ){\r\n    int jj;\r\n    char *zBuf = 0;\r\n\r\n    p = fts3ReallocOrFree(p, nSpace + nToken*sizeof(Fts3PhraseToken) + nTemp);\r\n    if( !p ) goto no_mem;\r\n    memset(p, 0, (char *)&(((Fts3Phrase *)&p[1])->aToken[0])-(char *)p);\r\n    p->eType = FTSQUERY_PHRASE;\r\n    p->pPhrase = (Fts3Phrase *)&p[1];\r\n    p->pPhrase->iColumn = pParse->iDefaultCol;\r\n    p->pPhrase->nToken = nToken;\r\n\r\n    zBuf = (char *)&p->pPhrase->aToken[nToken];\r\n    if( zTemp ){\r\n      memcpy(zBuf, zTemp, nTemp);\r\n      sqlite3_free(zTemp);\r\n    }else{\r\n      assert( nTemp==0 );\r\n    }\r\n\r\n    for(jj=0; jj<p->pPhrase->nToken; jj++){\r\n      p->pPhrase->aToken[jj].z = zBuf;\r\n      zBuf += p->pPhrase->aToken[jj].n;\r\n    }\r\n    rc = SQLITE_OK;\r\n  }\r\n\r\n  *ppExpr = p;\r\n  return rc;\r\nno_mem:\r\n\r\n  if( pCursor ){\r\n    pModule->xClose(pCursor);\r\n  }\r\n  sqlite3_free(zTemp);\r\n  sqlite3_free(p);\r\n  *ppExpr = 0;\r\n  return SQLITE_NOMEM;\r\n}\r\n\r\n/*\r\n** Function getNextNode(), which is called by fts3ExprParse(), may itself\r\n** call fts3ExprParse(). So this forward declaration is required.\r\n*/\r\nstatic int fts3ExprParse(ParseContext *, const char *, int, Fts3Expr **, int *);\r\n\r\n/*\r\n** The output variable *ppExpr is populated with an allocated Fts3Expr \r\n** structure, or set to 0 if the end of the input buffer is reached.\r\n**\r\n** Returns an SQLite error code. SQLITE_OK if everything works, SQLITE_NOMEM\r\n** if a malloc failure occurs, or SQLITE_ERROR if a parse error is encountered.\r\n** If SQLITE_ERROR is returned, pContext is populated with an error message.\r\n*/\r\nstatic int getNextNode(\r\n  ParseContext *pParse,                   /* fts3 query parse context */\r\n  const char *z, int n,                   /* Input string */\r\n  Fts3Expr **ppExpr,                      /* OUT: expression */\r\n  int *pnConsumed                         /* OUT: Number of bytes consumed */\r\n){\r\n  static const struct Fts3Keyword {\r\n    char *z;                              /* Keyword text */\r\n    unsigned char n;                      /* Length of the keyword */\r\n    unsigned char parenOnly;              /* Only valid in paren mode */\r\n    unsigned char eType;                  /* Keyword code */\r\n  } aKeyword[] = {\r\n    { \"OR\" ,  2, 0, FTSQUERY_OR   },\r\n    { \"AND\",  3, 1, FTSQUERY_AND  },\r\n    { \"NOT\",  3, 1, FTSQUERY_NOT  },\r\n    { \"NEAR\", 4, 0, FTSQUERY_NEAR }\r\n  };\r\n  int ii;\r\n  int iCol;\r\n  int iColLen;\r\n  int rc;\r\n  Fts3Expr *pRet = 0;\r\n\r\n  const char *zInput = z;\r\n  int nInput = n;\r\n\r\n  pParse->isNot = 0;\r\n\r\n  /* Skip over any whitespace before checking for a keyword, an open or\r\n  ** close bracket, or a quoted string. \r\n  */\r\n  while( nInput>0 && fts3isspace(*zInput) ){\r\n    nInput--;\r\n    zInput++;\r\n  }\r\n  if( nInput==0 ){\r\n    return SQLITE_DONE;\r\n  }\r\n\r\n  /* See if we are dealing with a keyword. */\r\n  for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){\r\n    const struct Fts3Keyword *pKey = &aKeyword[ii];\r\n\r\n    if( (pKey->parenOnly & ~sqlite3_fts3_enable_parentheses)!=0 ){\r\n      continue;\r\n    }\r\n\r\n    if( nInput>=pKey->n && 0==memcmp(zInput, pKey->z, pKey->n) ){\r\n      int nNear = SQLITE_FTS3_DEFAULT_NEAR_PARAM;\r\n      int nKey = pKey->n;\r\n      char cNext;\r\n\r\n      /* If this is a \"NEAR\" keyword, check for an explicit nearness. */\r\n      if( pKey->eType==FTSQUERY_NEAR ){\r\n        assert( nKey==4 );\r\n        if( zInput[4]=='/' && zInput[5]>='0' && zInput[5]<='9' ){\r\n          nNear = 0;\r\n          for(nKey=5; zInput[nKey]>='0' && zInput[nKey]<='9'; nKey++){\r\n            nNear = nNear * 10 + (zInput[nKey] - '0');\r\n          }\r\n        }\r\n      }\r\n\r\n      /* At this point this is probably a keyword. But for that to be true,\r\n      ** the next byte must contain either whitespace, an open or close\r\n      ** parenthesis, a quote character, or EOF. \r\n      */\r\n      cNext = zInput[nKey];\r\n      if( fts3isspace(cNext) \r\n       || cNext=='\"' || cNext=='(' || cNext==')' || cNext==0\r\n      ){\r\n        pRet = (Fts3Expr *)fts3MallocZero(sizeof(Fts3Expr));\r\n        if( !pRet ){\r\n          return SQLITE_NOMEM;\r\n        }\r\n        pRet->eType = pKey->eType;\r\n        pRet->nNear = nNear;\r\n        *ppExpr = pRet;\r\n        *pnConsumed = (int)((zInput - z) + nKey);\r\n        return SQLITE_OK;\r\n      }\r\n\r\n      /* Turns out that wasn't a keyword after all. This happens if the\r\n      ** user has supplied a token such as \"ORacle\". Continue.\r\n      */\r\n    }\r\n  }\r\n\r\n  /* Check for an open bracket. */\r\n  if( sqlite3_fts3_enable_parentheses ){\r\n    if( *zInput=='(' ){\r\n      int nConsumed;\r\n      pParse->nNest++;\r\n      rc = fts3ExprParse(pParse, &zInput[1], nInput-1, ppExpr, &nConsumed);\r\n      if( rc==SQLITE_OK && !*ppExpr ){\r\n        rc = SQLITE_DONE;\r\n      }\r\n      *pnConsumed = (int)((zInput - z) + 1 + nConsumed);\r\n      return rc;\r\n    }\r\n  \r\n    /* Check for a close bracket. */\r\n    if( *zInput==')' ){\r\n      pParse->nNest--;\r\n      *pnConsumed = (int)((zInput - z) + 1);\r\n      return SQLITE_DONE;\r\n    }\r\n  }\r\n\r\n  /* See if we are dealing with a quoted phrase. If this is the case, then\r\n  ** search for the closing quote and pass the whole string to getNextString()\r\n  ** for processing. This is easy to do, as fts3 has no syntax for escaping\r\n  ** a quote character embedded in a string.\r\n  */\r\n  if( *zInput=='\"' ){\r\n    for(ii=1; ii<nInput && zInput[ii]!='\"'; ii++);\r\n    *pnConsumed = (int)((zInput - z) + ii + 1);\r\n    if( ii==nInput ){\r\n      return SQLITE_ERROR;\r\n    }\r\n    return getNextString(pParse, &zInput[1], ii-1, ppExpr);\r\n  }\r\n\r\n\r\n  /* If control flows to this point, this must be a regular token, or \r\n  ** the end of the input. Read a regular token using the sqlite3_tokenizer\r\n  ** interface. Before doing so, figure out if there is an explicit\r\n  ** column specifier for the token. \r\n  **\r\n  ** TODO: Strangely, it is not possible to associate a column specifier\r\n  ** with a quoted phrase, only with a single token. Not sure if this was\r\n  ** an implementation artifact or an intentional decision when fts3 was\r\n  ** first implemented. Whichever it was, this module duplicates the \r\n  ** limitation.\r\n  */\r\n  iCol = pParse->iDefaultCol;\r\n  iColLen = 0;\r\n  for(ii=0; ii<pParse->nCol; ii++){\r\n    const char *zStr = pParse->azCol[ii];\r\n    int nStr = (int)strlen(zStr);\r\n    if( nInput>nStr && zInput[nStr]==':' \r\n     && sqlite3_strnicmp(zStr, zInput, nStr)==0 \r\n    ){\r\n      iCol = ii;\r\n      iColLen = (int)((zInput - z) + nStr + 1);\r\n      break;\r\n    }\r\n  }\r\n  rc = getNextToken(pParse, iCol, &z[iColLen], n-iColLen, ppExpr, pnConsumed);\r\n  *pnConsumed += iColLen;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The argument is an Fts3Expr structure for a binary operator (any type\r\n** except an FTSQUERY_PHRASE). Return an integer value representing the\r\n** precedence of the operator. Lower values have a higher precedence (i.e.\r\n** group more tightly). For example, in the C language, the == operator\r\n** groups more tightly than ||, and would therefore have a higher precedence.\r\n**\r\n** When using the new fts3 query syntax (when SQLITE_ENABLE_FTS3_PARENTHESIS\r\n** is defined), the order of the operators in precedence from highest to\r\n** lowest is:\r\n**\r\n**   NEAR\r\n**   NOT\r\n**   AND (including implicit ANDs)\r\n**   OR\r\n**\r\n** Note that when using the old query syntax, the OR operator has a higher\r\n** precedence than the AND operator.\r\n*/\r\nstatic int opPrecedence(Fts3Expr *p){\r\n  assert( p->eType!=FTSQUERY_PHRASE );\r\n  if( sqlite3_fts3_enable_parentheses ){\r\n    return p->eType;\r\n  }else if( p->eType==FTSQUERY_NEAR ){\r\n    return 1;\r\n  }else if( p->eType==FTSQUERY_OR ){\r\n    return 2;\r\n  }\r\n  assert( p->eType==FTSQUERY_AND );\r\n  return 3;\r\n}\r\n\r\n/*\r\n** Argument ppHead contains a pointer to the current head of a query \r\n** expression tree being parsed. pPrev is the expression node most recently\r\n** inserted into the tree. This function adds pNew, which is always a binary\r\n** operator node, into the expression tree based on the relative precedence\r\n** of pNew and the existing nodes of the tree. This may result in the head\r\n** of the tree changing, in which case *ppHead is set to the new root node.\r\n*/\r\nstatic void insertBinaryOperator(\r\n  Fts3Expr **ppHead,       /* Pointer to the root node of a tree */\r\n  Fts3Expr *pPrev,         /* Node most recently inserted into the tree */\r\n  Fts3Expr *pNew           /* New binary node to insert into expression tree */\r\n){\r\n  Fts3Expr *pSplit = pPrev;\r\n  while( pSplit->pParent && opPrecedence(pSplit->pParent)<=opPrecedence(pNew) ){\r\n    pSplit = pSplit->pParent;\r\n  }\r\n\r\n  if( pSplit->pParent ){\r\n    assert( pSplit->pParent->pRight==pSplit );\r\n    pSplit->pParent->pRight = pNew;\r\n    pNew->pParent = pSplit->pParent;\r\n  }else{\r\n    *ppHead = pNew;\r\n  }\r\n  pNew->pLeft = pSplit;\r\n  pSplit->pParent = pNew;\r\n}\r\n\r\n/*\r\n** Parse the fts3 query expression found in buffer z, length n. This function\r\n** returns either when the end of the buffer is reached or an unmatched \r\n** closing bracket - ')' - is encountered.\r\n**\r\n** If successful, SQLITE_OK is returned, *ppExpr is set to point to the\r\n** parsed form of the expression and *pnConsumed is set to the number of\r\n** bytes read from buffer z. Otherwise, *ppExpr is set to 0 and SQLITE_NOMEM\r\n** (out of memory error) or SQLITE_ERROR (parse error) is returned.\r\n*/\r\nstatic int fts3ExprParse(\r\n  ParseContext *pParse,                   /* fts3 query parse context */\r\n  const char *z, int n,                   /* Text of MATCH query */\r\n  Fts3Expr **ppExpr,                      /* OUT: Parsed query structure */\r\n  int *pnConsumed                         /* OUT: Number of bytes consumed */\r\n){\r\n  Fts3Expr *pRet = 0;\r\n  Fts3Expr *pPrev = 0;\r\n  Fts3Expr *pNotBranch = 0;               /* Only used in legacy parse mode */\r\n  int nIn = n;\r\n  const char *zIn = z;\r\n  int rc = SQLITE_OK;\r\n  int isRequirePhrase = 1;\r\n\r\n  while( rc==SQLITE_OK ){\r\n    Fts3Expr *p = 0;\r\n    int nByte = 0;\r\n    rc = getNextNode(pParse, zIn, nIn, &p, &nByte);\r\n    if( rc==SQLITE_OK ){\r\n      int isPhrase;\r\n\r\n      if( !sqlite3_fts3_enable_parentheses \r\n       && p->eType==FTSQUERY_PHRASE && pParse->isNot \r\n      ){\r\n        /* Create an implicit NOT operator. */\r\n        Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr));\r\n        if( !pNot ){\r\n          sqlite3Fts3ExprFree(p);\r\n          rc = SQLITE_NOMEM;\r\n          goto exprparse_out;\r\n        }\r\n        pNot->eType = FTSQUERY_NOT;\r\n        pNot->pRight = p;\r\n        if( pNotBranch ){\r\n          pNot->pLeft = pNotBranch;\r\n        }\r\n        pNotBranch = pNot;\r\n        p = pPrev;\r\n      }else{\r\n        int eType = p->eType;\r\n        isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft);\r\n\r\n        /* The isRequirePhrase variable is set to true if a phrase or\r\n        ** an expression contained in parenthesis is required. If a\r\n        ** binary operator (AND, OR, NOT or NEAR) is encounted when\r\n        ** isRequirePhrase is set, this is a syntax error.\r\n        */\r\n        if( !isPhrase && isRequirePhrase ){\r\n          sqlite3Fts3ExprFree(p);\r\n          rc = SQLITE_ERROR;\r\n          goto exprparse_out;\r\n        }\r\n  \r\n        if( isPhrase && !isRequirePhrase ){\r\n          /* Insert an implicit AND operator. */\r\n          Fts3Expr *pAnd;\r\n          assert( pRet && pPrev );\r\n          pAnd = fts3MallocZero(sizeof(Fts3Expr));\r\n          if( !pAnd ){\r\n            sqlite3Fts3ExprFree(p);\r\n            rc = SQLITE_NOMEM;\r\n            goto exprparse_out;\r\n          }\r\n          pAnd->eType = FTSQUERY_AND;\r\n          insertBinaryOperator(&pRet, pPrev, pAnd);\r\n          pPrev = pAnd;\r\n        }\r\n\r\n        /* This test catches attempts to make either operand of a NEAR\r\n        ** operator something other than a phrase. For example, either of\r\n        ** the following:\r\n        **\r\n        **    (bracketed expression) NEAR phrase\r\n        **    phrase NEAR (bracketed expression)\r\n        **\r\n        ** Return an error in either case.\r\n        */\r\n        if( pPrev && (\r\n            (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE)\r\n         || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR)\r\n        )){\r\n          sqlite3Fts3ExprFree(p);\r\n          rc = SQLITE_ERROR;\r\n          goto exprparse_out;\r\n        }\r\n  \r\n        if( isPhrase ){\r\n          if( pRet ){\r\n            assert( pPrev && pPrev->pLeft && pPrev->pRight==0 );\r\n            pPrev->pRight = p;\r\n            p->pParent = pPrev;\r\n          }else{\r\n            pRet = p;\r\n          }\r\n        }else{\r\n          insertBinaryOperator(&pRet, pPrev, p);\r\n        }\r\n        isRequirePhrase = !isPhrase;\r\n      }\r\n      assert( nByte>0 );\r\n    }\r\n    assert( rc!=SQLITE_OK || (nByte>0 && nByte<=nIn) );\r\n    nIn -= nByte;\r\n    zIn += nByte;\r\n    pPrev = p;\r\n  }\r\n\r\n  if( rc==SQLITE_DONE && pRet && isRequirePhrase ){\r\n    rc = SQLITE_ERROR;\r\n  }\r\n\r\n  if( rc==SQLITE_DONE ){\r\n    rc = SQLITE_OK;\r\n    if( !sqlite3_fts3_enable_parentheses && pNotBranch ){\r\n      if( !pRet ){\r\n        rc = SQLITE_ERROR;\r\n      }else{\r\n        Fts3Expr *pIter = pNotBranch;\r\n        while( pIter->pLeft ){\r\n          pIter = pIter->pLeft;\r\n        }\r\n        pIter->pLeft = pRet;\r\n        pRet = pNotBranch;\r\n      }\r\n    }\r\n  }\r\n  *pnConsumed = n - nIn;\r\n\r\nexprparse_out:\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3Fts3ExprFree(pRet);\r\n    sqlite3Fts3ExprFree(pNotBranch);\r\n    pRet = 0;\r\n  }\r\n  *ppExpr = pRet;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Parameters z and n contain a pointer to and length of a buffer containing\r\n** an fts3 query expression, respectively. This function attempts to parse the\r\n** query expression and create a tree of Fts3Expr structures representing the\r\n** parsed expression. If successful, *ppExpr is set to point to the head\r\n** of the parsed expression tree and SQLITE_OK is returned. If an error\r\n** occurs, either SQLITE_NOMEM (out-of-memory error) or SQLITE_ERROR (parse\r\n** error) is returned and *ppExpr is set to 0.\r\n**\r\n** If parameter n is a negative number, then z is assumed to point to a\r\n** nul-terminated string and the length is determined using strlen().\r\n**\r\n** The first parameter, pTokenizer, is passed the fts3 tokenizer module to\r\n** use to normalize query tokens while parsing the expression. The azCol[]\r\n** array, which is assumed to contain nCol entries, should contain the names\r\n** of each column in the target fts3 table, in order from left to right. \r\n** Column names must be nul-terminated strings.\r\n**\r\n** The iDefaultCol parameter should be passed the index of the table column\r\n** that appears on the left-hand-side of the MATCH operator (the default\r\n** column to match against for tokens for which a column name is not explicitly\r\n** specified as part of the query string), or -1 if tokens may by default\r\n** match any table column.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3ExprParse(\r\n  sqlite3_tokenizer *pTokenizer,      /* Tokenizer module */\r\n  int iLangid,                        /* Language id for tokenizer */\r\n  char **azCol,                       /* Array of column names for fts3 table */\r\n  int bFts4,                          /* True to allow FTS4-only syntax */\r\n  int nCol,                           /* Number of entries in azCol[] */\r\n  int iDefaultCol,                    /* Default column to query */\r\n  const char *z, int n,               /* Text of MATCH query */\r\n  Fts3Expr **ppExpr                   /* OUT: Parsed query structure */\r\n){\r\n  int nParsed;\r\n  int rc;\r\n  ParseContext sParse;\r\n\r\n  memset(&sParse, 0, sizeof(ParseContext));\r\n  sParse.pTokenizer = pTokenizer;\r\n  sParse.iLangid = iLangid;\r\n  sParse.azCol = (const char **)azCol;\r\n  sParse.nCol = nCol;\r\n  sParse.iDefaultCol = iDefaultCol;\r\n  sParse.bFts4 = bFts4;\r\n  if( z==0 ){\r\n    *ppExpr = 0;\r\n    return SQLITE_OK;\r\n  }\r\n  if( n<0 ){\r\n    n = (int)strlen(z);\r\n  }\r\n  rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed);\r\n\r\n  /* Check for mismatched parenthesis */\r\n  if( rc==SQLITE_OK && sParse.nNest ){\r\n    rc = SQLITE_ERROR;\r\n    sqlite3Fts3ExprFree(*ppExpr);\r\n    *ppExpr = 0;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Free a parsed fts3 query expression allocated by sqlite3Fts3ExprParse().\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *p){\r\n  if( p ){\r\n    assert( p->eType==FTSQUERY_PHRASE || p->pPhrase==0 );\r\n    sqlite3Fts3ExprFree(p->pLeft);\r\n    sqlite3Fts3ExprFree(p->pRight);\r\n    sqlite3Fts3EvalPhraseCleanup(p->pPhrase);\r\n    sqlite3_free(p->aMI);\r\n    sqlite3_free(p);\r\n  }\r\n}\r\n\r\n/****************************************************************************\r\n*****************************************************************************\r\n** Everything after this point is just test code.\r\n*/\r\n\r\n#ifdef SQLITE_TEST\r\n\r\n/* #include <stdio.h> */\r\n\r\n/*\r\n** Function to query the hash-table of tokenizers (see README.tokenizers).\r\n*/\r\nstatic int queryTestTokenizer(\r\n  sqlite3 *db, \r\n  const char *zName,  \r\n  const sqlite3_tokenizer_module **pp\r\n){\r\n  int rc;\r\n  sqlite3_stmt *pStmt;\r\n  const char zSql[] = \"SELECT fts3_tokenizer(?)\";\r\n\r\n  *pp = 0;\r\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);\r\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n    if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){\r\n      memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));\r\n    }\r\n  }\r\n\r\n  return sqlite3_finalize(pStmt);\r\n}\r\n\r\n/*\r\n** Return a pointer to a buffer containing a text representation of the\r\n** expression passed as the first argument. The buffer is obtained from\r\n** sqlite3_malloc(). It is the responsibility of the caller to use \r\n** sqlite3_free() to release the memory. If an OOM condition is encountered,\r\n** NULL is returned.\r\n**\r\n** If the second argument is not NULL, then its contents are prepended to \r\n** the returned expression text and then freed using sqlite3_free().\r\n*/\r\nstatic char *exprToString(Fts3Expr *pExpr, char *zBuf){\r\n  switch( pExpr->eType ){\r\n    case FTSQUERY_PHRASE: {\r\n      Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n      int i;\r\n      zBuf = sqlite3_mprintf(\r\n          \"%zPHRASE %d 0\", zBuf, pPhrase->iColumn);\r\n      for(i=0; zBuf && i<pPhrase->nToken; i++){\r\n        zBuf = sqlite3_mprintf(\"%z %.*s%s\", zBuf, \r\n            pPhrase->aToken[i].n, pPhrase->aToken[i].z,\r\n            (pPhrase->aToken[i].isPrefix?\"+\":\"\")\r\n        );\r\n      }\r\n      return zBuf;\r\n    }\r\n\r\n    case FTSQUERY_NEAR:\r\n      zBuf = sqlite3_mprintf(\"%zNEAR/%d \", zBuf, pExpr->nNear);\r\n      break;\r\n    case FTSQUERY_NOT:\r\n      zBuf = sqlite3_mprintf(\"%zNOT \", zBuf);\r\n      break;\r\n    case FTSQUERY_AND:\r\n      zBuf = sqlite3_mprintf(\"%zAND \", zBuf);\r\n      break;\r\n    case FTSQUERY_OR:\r\n      zBuf = sqlite3_mprintf(\"%zOR \", zBuf);\r\n      break;\r\n  }\r\n\r\n  if( zBuf ) zBuf = sqlite3_mprintf(\"%z{\", zBuf);\r\n  if( zBuf ) zBuf = exprToString(pExpr->pLeft, zBuf);\r\n  if( zBuf ) zBuf = sqlite3_mprintf(\"%z} {\", zBuf);\r\n\r\n  if( zBuf ) zBuf = exprToString(pExpr->pRight, zBuf);\r\n  if( zBuf ) zBuf = sqlite3_mprintf(\"%z}\", zBuf);\r\n\r\n  return zBuf;\r\n}\r\n\r\n/*\r\n** This is the implementation of a scalar SQL function used to test the \r\n** expression parser. It should be called as follows:\r\n**\r\n**   fts3_exprtest(<tokenizer>, <expr>, <column 1>, ...);\r\n**\r\n** The first argument, <tokenizer>, is the name of the fts3 tokenizer used\r\n** to parse the query expression (see README.tokenizers). The second argument\r\n** is the query expression to parse. Each subsequent argument is the name\r\n** of a column of the fts3 table that the query expression may refer to.\r\n** For example:\r\n**\r\n**   SELECT fts3_exprtest('simple', 'Bill col2:Bloggs', 'col1', 'col2');\r\n*/\r\nstatic void fts3ExprTest(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  sqlite3_tokenizer_module const *pModule = 0;\r\n  sqlite3_tokenizer *pTokenizer = 0;\r\n  int rc;\r\n  char **azCol = 0;\r\n  const char *zExpr;\r\n  int nExpr;\r\n  int nCol;\r\n  int ii;\r\n  Fts3Expr *pExpr;\r\n  char *zBuf = 0;\r\n  sqlite3 *db = sqlite3_context_db_handle(context);\r\n\r\n  if( argc<3 ){\r\n    sqlite3_result_error(context, \r\n        \"Usage: fts3_exprtest(tokenizer, expr, col1, ...\", -1\r\n    );\r\n    return;\r\n  }\r\n\r\n  rc = queryTestTokenizer(db,\r\n                          (const char *)sqlite3_value_text(argv[0]), &pModule);\r\n  if( rc==SQLITE_NOMEM ){\r\n    sqlite3_result_error_nomem(context);\r\n    goto exprtest_out;\r\n  }else if( !pModule ){\r\n    sqlite3_result_error(context, \"No such tokenizer module\", -1);\r\n    goto exprtest_out;\r\n  }\r\n\r\n  rc = pModule->xCreate(0, 0, &pTokenizer);\r\n  assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );\r\n  if( rc==SQLITE_NOMEM ){\r\n    sqlite3_result_error_nomem(context);\r\n    goto exprtest_out;\r\n  }\r\n  pTokenizer->pModule = pModule;\r\n\r\n  zExpr = (const char *)sqlite3_value_text(argv[1]);\r\n  nExpr = sqlite3_value_bytes(argv[1]);\r\n  nCol = argc-2;\r\n  azCol = (char **)sqlite3_malloc(nCol*sizeof(char *));\r\n  if( !azCol ){\r\n    sqlite3_result_error_nomem(context);\r\n    goto exprtest_out;\r\n  }\r\n  for(ii=0; ii<nCol; ii++){\r\n    azCol[ii] = (char *)sqlite3_value_text(argv[ii+2]);\r\n  }\r\n\r\n  rc = sqlite3Fts3ExprParse(\r\n      pTokenizer, 0, azCol, 0, nCol, nCol, zExpr, nExpr, &pExpr\r\n  );\r\n  if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM ){\r\n    sqlite3_result_error(context, \"Error parsing expression\", -1);\r\n  }else if( rc==SQLITE_NOMEM || !(zBuf = exprToString(pExpr, 0)) ){\r\n    sqlite3_result_error_nomem(context);\r\n  }else{\r\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\r\n    sqlite3_free(zBuf);\r\n  }\r\n\r\n  sqlite3Fts3ExprFree(pExpr);\r\n\r\nexprtest_out:\r\n  if( pModule && pTokenizer ){\r\n    rc = pModule->xDestroy(pTokenizer);\r\n  }\r\n  sqlite3_free(azCol);\r\n}\r\n\r\n/*\r\n** Register the query expression parser test function fts3_exprtest() \r\n** with database connection db. \r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3* db){\r\n  return sqlite3_create_function(\r\n      db, \"fts3_exprtest\", -1, SQLITE_UTF8, 0, fts3ExprTest, 0, 0\r\n  );\r\n}\r\n\r\n#endif\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_expr.c *******************************************/\r\n/************** Begin file fts3_hash.c ***************************************/\r\n/*\r\n** 2001 September 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This is the implementation of generic hash-tables used in SQLite.\r\n** We've modified it slightly to serve as a standalone hash table\r\n** implementation for the full-text indexing module.\r\n*/\r\n\r\n/*\r\n** The code in this file is only compiled if:\r\n**\r\n**     * The FTS3 module is being built as an extension\r\n**       (in which case SQLITE_CORE is not defined), or\r\n**\r\n**     * The FTS3 module is being built into the core of\r\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <assert.h> */\r\n/* #include <stdlib.h> */\r\n/* #include <string.h> */\r\n\r\n\r\n/*\r\n** Malloc and Free functions\r\n*/\r\nstatic void *fts3HashMalloc(int n){\r\n  void *p = sqlite3_malloc(n);\r\n  if( p ){\r\n    memset(p, 0, n);\r\n  }\r\n  return p;\r\n}\r\nstatic void fts3HashFree(void *p){\r\n  sqlite3_free(p);\r\n}\r\n\r\n/* Turn bulk memory into a hash table object by initializing the\r\n** fields of the Hash structure.\r\n**\r\n** \"pNew\" is a pointer to the hash table that is to be initialized.\r\n** keyClass is one of the constants \r\n** FTS3_HASH_BINARY or FTS3_HASH_STRING.  The value of keyClass \r\n** determines what kind of key the hash table will use.  \"copyKey\" is\r\n** true if the hash table should make its own private copy of keys and\r\n** false if it should just use the supplied pointer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){\r\n  assert( pNew!=0 );\r\n  assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY );\r\n  pNew->keyClass = keyClass;\r\n  pNew->copyKey = copyKey;\r\n  pNew->first = 0;\r\n  pNew->count = 0;\r\n  pNew->htsize = 0;\r\n  pNew->ht = 0;\r\n}\r\n\r\n/* Remove all entries from a hash table.  Reclaim all memory.\r\n** Call this routine to delete a hash table or to reset a hash table\r\n** to the empty state.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){\r\n  Fts3HashElem *elem;         /* For looping over all elements of the table */\r\n\r\n  assert( pH!=0 );\r\n  elem = pH->first;\r\n  pH->first = 0;\r\n  fts3HashFree(pH->ht);\r\n  pH->ht = 0;\r\n  pH->htsize = 0;\r\n  while( elem ){\r\n    Fts3HashElem *next_elem = elem->next;\r\n    if( pH->copyKey && elem->pKey ){\r\n      fts3HashFree(elem->pKey);\r\n    }\r\n    fts3HashFree(elem);\r\n    elem = next_elem;\r\n  }\r\n  pH->count = 0;\r\n}\r\n\r\n/*\r\n** Hash and comparison functions when the mode is FTS3_HASH_STRING\r\n*/\r\nstatic int fts3StrHash(const void *pKey, int nKey){\r\n  const char *z = (const char *)pKey;\r\n  int h = 0;\r\n  if( nKey<=0 ) nKey = (int) strlen(z);\r\n  while( nKey > 0  ){\r\n    h = (h<<3) ^ h ^ *z++;\r\n    nKey--;\r\n  }\r\n  return h & 0x7fffffff;\r\n}\r\nstatic int fts3StrCompare(const void *pKey1, int n1, const void *pKey2, int n2){\r\n  if( n1!=n2 ) return 1;\r\n  return strncmp((const char*)pKey1,(const char*)pKey2,n1);\r\n}\r\n\r\n/*\r\n** Hash and comparison functions when the mode is FTS3_HASH_BINARY\r\n*/\r\nstatic int fts3BinHash(const void *pKey, int nKey){\r\n  int h = 0;\r\n  const char *z = (const char *)pKey;\r\n  while( nKey-- > 0 ){\r\n    h = (h<<3) ^ h ^ *(z++);\r\n  }\r\n  return h & 0x7fffffff;\r\n}\r\nstatic int fts3BinCompare(const void *pKey1, int n1, const void *pKey2, int n2){\r\n  if( n1!=n2 ) return 1;\r\n  return memcmp(pKey1,pKey2,n1);\r\n}\r\n\r\n/*\r\n** Return a pointer to the appropriate hash function given the key class.\r\n**\r\n** The C syntax in this function definition may be unfamilar to some \r\n** programmers, so we provide the following additional explanation:\r\n**\r\n** The name of the function is \"ftsHashFunction\".  The function takes a\r\n** single parameter \"keyClass\".  The return value of ftsHashFunction()\r\n** is a pointer to another function.  Specifically, the return value\r\n** of ftsHashFunction() is a pointer to a function that takes two parameters\r\n** with types \"const void*\" and \"int\" and returns an \"int\".\r\n*/\r\nstatic int (*ftsHashFunction(int keyClass))(const void*,int){\r\n  if( keyClass==FTS3_HASH_STRING ){\r\n    return &fts3StrHash;\r\n  }else{\r\n    assert( keyClass==FTS3_HASH_BINARY );\r\n    return &fts3BinHash;\r\n  }\r\n}\r\n\r\n/*\r\n** Return a pointer to the appropriate hash function given the key class.\r\n**\r\n** For help in interpreted the obscure C code in the function definition,\r\n** see the header comment on the previous function.\r\n*/\r\nstatic int (*ftsCompareFunction(int keyClass))(const void*,int,const void*,int){\r\n  if( keyClass==FTS3_HASH_STRING ){\r\n    return &fts3StrCompare;\r\n  }else{\r\n    assert( keyClass==FTS3_HASH_BINARY );\r\n    return &fts3BinCompare;\r\n  }\r\n}\r\n\r\n/* Link an element into the hash table\r\n*/\r\nstatic void fts3HashInsertElement(\r\n  Fts3Hash *pH,            /* The complete hash table */\r\n  struct _fts3ht *pEntry,  /* The entry into which pNew is inserted */\r\n  Fts3HashElem *pNew       /* The element to be inserted */\r\n){\r\n  Fts3HashElem *pHead;     /* First element already in pEntry */\r\n  pHead = pEntry->chain;\r\n  if( pHead ){\r\n    pNew->next = pHead;\r\n    pNew->prev = pHead->prev;\r\n    if( pHead->prev ){ pHead->prev->next = pNew; }\r\n    else             { pH->first = pNew; }\r\n    pHead->prev = pNew;\r\n  }else{\r\n    pNew->next = pH->first;\r\n    if( pH->first ){ pH->first->prev = pNew; }\r\n    pNew->prev = 0;\r\n    pH->first = pNew;\r\n  }\r\n  pEntry->count++;\r\n  pEntry->chain = pNew;\r\n}\r\n\r\n\r\n/* Resize the hash table so that it cantains \"new_size\" buckets.\r\n** \"new_size\" must be a power of 2.  The hash table might fail \r\n** to resize if sqliteMalloc() fails.\r\n**\r\n** Return non-zero if a memory allocation error occurs.\r\n*/\r\nstatic int fts3Rehash(Fts3Hash *pH, int new_size){\r\n  struct _fts3ht *new_ht;          /* The new hash table */\r\n  Fts3HashElem *elem, *next_elem;  /* For looping over existing elements */\r\n  int (*xHash)(const void*,int);   /* The hash function */\r\n\r\n  assert( (new_size & (new_size-1))==0 );\r\n  new_ht = (struct _fts3ht *)fts3HashMalloc( new_size*sizeof(struct _fts3ht) );\r\n  if( new_ht==0 ) return 1;\r\n  fts3HashFree(pH->ht);\r\n  pH->ht = new_ht;\r\n  pH->htsize = new_size;\r\n  xHash = ftsHashFunction(pH->keyClass);\r\n  for(elem=pH->first, pH->first=0; elem; elem = next_elem){\r\n    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);\r\n    next_elem = elem->next;\r\n    fts3HashInsertElement(pH, &new_ht[h], elem);\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* This function (for internal use only) locates an element in an\r\n** hash table that matches the given key.  The hash for this key has\r\n** already been computed and is passed as the 4th parameter.\r\n*/\r\nstatic Fts3HashElem *fts3FindElementByHash(\r\n  const Fts3Hash *pH, /* The pH to be searched */\r\n  const void *pKey,   /* The key we are searching for */\r\n  int nKey,\r\n  int h               /* The hash for this key. */\r\n){\r\n  Fts3HashElem *elem;            /* Used to loop thru the element list */\r\n  int count;                     /* Number of elements left to test */\r\n  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */\r\n\r\n  if( pH->ht ){\r\n    struct _fts3ht *pEntry = &pH->ht[h];\r\n    elem = pEntry->chain;\r\n    count = pEntry->count;\r\n    xCompare = ftsCompareFunction(pH->keyClass);\r\n    while( count-- && elem ){\r\n      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ \r\n        return elem;\r\n      }\r\n      elem = elem->next;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* Remove a single entry from the hash table given a pointer to that\r\n** element and a hash on the element's key.\r\n*/\r\nstatic void fts3RemoveElementByHash(\r\n  Fts3Hash *pH,         /* The pH containing \"elem\" */\r\n  Fts3HashElem* elem,   /* The element to be removed from the pH */\r\n  int h                 /* Hash value for the element */\r\n){\r\n  struct _fts3ht *pEntry;\r\n  if( elem->prev ){\r\n    elem->prev->next = elem->next; \r\n  }else{\r\n    pH->first = elem->next;\r\n  }\r\n  if( elem->next ){\r\n    elem->next->prev = elem->prev;\r\n  }\r\n  pEntry = &pH->ht[h];\r\n  if( pEntry->chain==elem ){\r\n    pEntry->chain = elem->next;\r\n  }\r\n  pEntry->count--;\r\n  if( pEntry->count<=0 ){\r\n    pEntry->chain = 0;\r\n  }\r\n  if( pH->copyKey && elem->pKey ){\r\n    fts3HashFree(elem->pKey);\r\n  }\r\n  fts3HashFree( elem );\r\n  pH->count--;\r\n  if( pH->count<=0 ){\r\n    assert( pH->first==0 );\r\n    assert( pH->count==0 );\r\n    fts3HashClear(pH);\r\n  }\r\n}\r\n\r\nSQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(\r\n  const Fts3Hash *pH, \r\n  const void *pKey, \r\n  int nKey\r\n){\r\n  int h;                          /* A hash on key */\r\n  int (*xHash)(const void*,int);  /* The hash function */\r\n\r\n  if( pH==0 || pH->ht==0 ) return 0;\r\n  xHash = ftsHashFunction(pH->keyClass);\r\n  assert( xHash!=0 );\r\n  h = (*xHash)(pKey,nKey);\r\n  assert( (pH->htsize & (pH->htsize-1))==0 );\r\n  return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));\r\n}\r\n\r\n/* \r\n** Attempt to locate an element of the hash table pH with a key\r\n** that matches pKey,nKey.  Return the data for this element if it is\r\n** found, or NULL if there is no match.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){\r\n  Fts3HashElem *pElem;            /* The element that matches key (if any) */\r\n\r\n  pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);\r\n  return pElem ? pElem->data : 0;\r\n}\r\n\r\n/* Insert an element into the hash table pH.  The key is pKey,nKey\r\n** and the data is \"data\".\r\n**\r\n** If no element exists with a matching key, then a new\r\n** element is created.  A copy of the key is made if the copyKey\r\n** flag is set.  NULL is returned.\r\n**\r\n** If another element already exists with the same key, then the\r\n** new data replaces the old data and the old data is returned.\r\n** The key is not copied in this instance.  If a malloc fails, then\r\n** the new data is returned and the hash table is unchanged.\r\n**\r\n** If the \"data\" parameter to this function is NULL, then the\r\n** element corresponding to \"key\" is removed from the hash table.\r\n*/\r\nSQLITE_PRIVATE void *sqlite3Fts3HashInsert(\r\n  Fts3Hash *pH,        /* The hash table to insert into */\r\n  const void *pKey,    /* The key */\r\n  int nKey,            /* Number of bytes in the key */\r\n  void *data           /* The data */\r\n){\r\n  int hraw;                 /* Raw hash value of the key */\r\n  int h;                    /* the hash of the key modulo hash table size */\r\n  Fts3HashElem *elem;       /* Used to loop thru the element list */\r\n  Fts3HashElem *new_elem;   /* New element added to the pH */\r\n  int (*xHash)(const void*,int);  /* The hash function */\r\n\r\n  assert( pH!=0 );\r\n  xHash = ftsHashFunction(pH->keyClass);\r\n  assert( xHash!=0 );\r\n  hraw = (*xHash)(pKey, nKey);\r\n  assert( (pH->htsize & (pH->htsize-1))==0 );\r\n  h = hraw & (pH->htsize-1);\r\n  elem = fts3FindElementByHash(pH,pKey,nKey,h);\r\n  if( elem ){\r\n    void *old_data = elem->data;\r\n    if( data==0 ){\r\n      fts3RemoveElementByHash(pH,elem,h);\r\n    }else{\r\n      elem->data = data;\r\n    }\r\n    return old_data;\r\n  }\r\n  if( data==0 ) return 0;\r\n  if( (pH->htsize==0 && fts3Rehash(pH,8))\r\n   || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))\r\n  ){\r\n    pH->count = 0;\r\n    return data;\r\n  }\r\n  assert( pH->htsize>0 );\r\n  new_elem = (Fts3HashElem*)fts3HashMalloc( sizeof(Fts3HashElem) );\r\n  if( new_elem==0 ) return data;\r\n  if( pH->copyKey && pKey!=0 ){\r\n    new_elem->pKey = fts3HashMalloc( nKey );\r\n    if( new_elem->pKey==0 ){\r\n      fts3HashFree(new_elem);\r\n      return data;\r\n    }\r\n    memcpy((void*)new_elem->pKey, pKey, nKey);\r\n  }else{\r\n    new_elem->pKey = (void*)pKey;\r\n  }\r\n  new_elem->nKey = nKey;\r\n  pH->count++;\r\n  assert( pH->htsize>0 );\r\n  assert( (pH->htsize & (pH->htsize-1))==0 );\r\n  h = hraw & (pH->htsize-1);\r\n  fts3HashInsertElement(pH, &pH->ht[h], new_elem);\r\n  new_elem->data = data;\r\n  return 0;\r\n}\r\n\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_hash.c *******************************************/\r\n/************** Begin file fts3_porter.c *************************************/\r\n/*\r\n** 2006 September 30\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** Implementation of the full-text-search tokenizer that implements\r\n** a Porter stemmer.\r\n*/\r\n\r\n/*\r\n** The code in this file is only compiled if:\r\n**\r\n**     * The FTS3 module is being built as an extension\r\n**       (in which case SQLITE_CORE is not defined), or\r\n**\r\n**     * The FTS3 module is being built into the core of\r\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <assert.h> */\r\n/* #include <stdlib.h> */\r\n/* #include <stdio.h> */\r\n/* #include <string.h> */\r\n\r\n\r\n/*\r\n** Class derived from sqlite3_tokenizer\r\n*/\r\ntypedef struct porter_tokenizer {\r\n  sqlite3_tokenizer base;      /* Base class */\r\n} porter_tokenizer;\r\n\r\n/*\r\n** Class derived from sqlite3_tokenizer_cursor\r\n*/\r\ntypedef struct porter_tokenizer_cursor {\r\n  sqlite3_tokenizer_cursor base;\r\n  const char *zInput;          /* input we are tokenizing */\r\n  int nInput;                  /* size of the input */\r\n  int iOffset;                 /* current position in zInput */\r\n  int iToken;                  /* index of next token to be returned */\r\n  char *zToken;                /* storage for current token */\r\n  int nAllocated;              /* space allocated to zToken buffer */\r\n} porter_tokenizer_cursor;\r\n\r\n\r\n/*\r\n** Create a new tokenizer instance.\r\n*/\r\nstatic int porterCreate(\r\n  int argc, const char * const *argv,\r\n  sqlite3_tokenizer **ppTokenizer\r\n){\r\n  porter_tokenizer *t;\r\n\r\n  UNUSED_PARAMETER(argc);\r\n  UNUSED_PARAMETER(argv);\r\n\r\n  t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t));\r\n  if( t==NULL ) return SQLITE_NOMEM;\r\n  memset(t, 0, sizeof(*t));\r\n  *ppTokenizer = &t->base;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Destroy a tokenizer\r\n*/\r\nstatic int porterDestroy(sqlite3_tokenizer *pTokenizer){\r\n  sqlite3_free(pTokenizer);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Prepare to begin tokenizing a particular string.  The input\r\n** string to be tokenized is zInput[0..nInput-1].  A cursor\r\n** used to incrementally tokenize this string is returned in \r\n** *ppCursor.\r\n*/\r\nstatic int porterOpen(\r\n  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */\r\n  const char *zInput, int nInput,        /* String to be tokenized */\r\n  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */\r\n){\r\n  porter_tokenizer_cursor *c;\r\n\r\n  UNUSED_PARAMETER(pTokenizer);\r\n\r\n  c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));\r\n  if( c==NULL ) return SQLITE_NOMEM;\r\n\r\n  c->zInput = zInput;\r\n  if( zInput==0 ){\r\n    c->nInput = 0;\r\n  }else if( nInput<0 ){\r\n    c->nInput = (int)strlen(zInput);\r\n  }else{\r\n    c->nInput = nInput;\r\n  }\r\n  c->iOffset = 0;                 /* start tokenizing at the beginning */\r\n  c->iToken = 0;\r\n  c->zToken = NULL;               /* no space allocated, yet. */\r\n  c->nAllocated = 0;\r\n\r\n  *ppCursor = &c->base;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close a tokenization cursor previously opened by a call to\r\n** porterOpen() above.\r\n*/\r\nstatic int porterClose(sqlite3_tokenizer_cursor *pCursor){\r\n  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;\r\n  sqlite3_free(c->zToken);\r\n  sqlite3_free(c);\r\n  return SQLITE_OK;\r\n}\r\n/*\r\n** Vowel or consonant\r\n*/\r\nstatic const char cType[] = {\r\n   0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,\r\n   1, 1, 1, 2, 1\r\n};\r\n\r\n/*\r\n** isConsonant() and isVowel() determine if their first character in\r\n** the string they point to is a consonant or a vowel, according\r\n** to Porter ruls.  \r\n**\r\n** A consonate is any letter other than 'a', 'e', 'i', 'o', or 'u'.\r\n** 'Y' is a consonant unless it follows another consonant,\r\n** in which case it is a vowel.\r\n**\r\n** In these routine, the letters are in reverse order.  So the 'y' rule\r\n** is that 'y' is a consonant unless it is followed by another\r\n** consonent.\r\n*/\r\nstatic int isVowel(const char*);\r\nstatic int isConsonant(const char *z){\r\n  int j;\r\n  char x = *z;\r\n  if( x==0 ) return 0;\r\n  assert( x>='a' && x<='z' );\r\n  j = cType[x-'a'];\r\n  if( j<2 ) return j;\r\n  return z[1]==0 || isVowel(z + 1);\r\n}\r\nstatic int isVowel(const char *z){\r\n  int j;\r\n  char x = *z;\r\n  if( x==0 ) return 0;\r\n  assert( x>='a' && x<='z' );\r\n  j = cType[x-'a'];\r\n  if( j<2 ) return 1-j;\r\n  return isConsonant(z + 1);\r\n}\r\n\r\n/*\r\n** Let any sequence of one or more vowels be represented by V and let\r\n** C be sequence of one or more consonants.  Then every word can be\r\n** represented as:\r\n**\r\n**           [C] (VC){m} [V]\r\n**\r\n** In prose:  A word is an optional consonant followed by zero or\r\n** vowel-consonant pairs followed by an optional vowel.  \"m\" is the\r\n** number of vowel consonant pairs.  This routine computes the value\r\n** of m for the first i bytes of a word.\r\n**\r\n** Return true if the m-value for z is 1 or more.  In other words,\r\n** return true if z contains at least one vowel that is followed\r\n** by a consonant.\r\n**\r\n** In this routine z[] is in reverse order.  So we are really looking\r\n** for an instance of of a consonant followed by a vowel.\r\n*/\r\nstatic int m_gt_0(const char *z){\r\n  while( isVowel(z) ){ z++; }\r\n  if( *z==0 ) return 0;\r\n  while( isConsonant(z) ){ z++; }\r\n  return *z!=0;\r\n}\r\n\r\n/* Like mgt0 above except we are looking for a value of m which is\r\n** exactly 1\r\n*/\r\nstatic int m_eq_1(const char *z){\r\n  while( isVowel(z) ){ z++; }\r\n  if( *z==0 ) return 0;\r\n  while( isConsonant(z) ){ z++; }\r\n  if( *z==0 ) return 0;\r\n  while( isVowel(z) ){ z++; }\r\n  if( *z==0 ) return 1;\r\n  while( isConsonant(z) ){ z++; }\r\n  return *z==0;\r\n}\r\n\r\n/* Like mgt0 above except we are looking for a value of m>1 instead\r\n** or m>0\r\n*/\r\nstatic int m_gt_1(const char *z){\r\n  while( isVowel(z) ){ z++; }\r\n  if( *z==0 ) return 0;\r\n  while( isConsonant(z) ){ z++; }\r\n  if( *z==0 ) return 0;\r\n  while( isVowel(z) ){ z++; }\r\n  if( *z==0 ) return 0;\r\n  while( isConsonant(z) ){ z++; }\r\n  return *z!=0;\r\n}\r\n\r\n/*\r\n** Return TRUE if there is a vowel anywhere within z[0..n-1]\r\n*/\r\nstatic int hasVowel(const char *z){\r\n  while( isConsonant(z) ){ z++; }\r\n  return *z!=0;\r\n}\r\n\r\n/*\r\n** Return TRUE if the word ends in a double consonant.\r\n**\r\n** The text is reversed here. So we are really looking at\r\n** the first two characters of z[].\r\n*/\r\nstatic int doubleConsonant(const char *z){\r\n  return isConsonant(z) && z[0]==z[1];\r\n}\r\n\r\n/*\r\n** Return TRUE if the word ends with three letters which\r\n** are consonant-vowel-consonent and where the final consonant\r\n** is not 'w', 'x', or 'y'.\r\n**\r\n** The word is reversed here.  So we are really checking the\r\n** first three letters and the first one cannot be in [wxy].\r\n*/\r\nstatic int star_oh(const char *z){\r\n  return\r\n    isConsonant(z) &&\r\n    z[0]!='w' && z[0]!='x' && z[0]!='y' &&\r\n    isVowel(z+1) &&\r\n    isConsonant(z+2);\r\n}\r\n\r\n/*\r\n** If the word ends with zFrom and xCond() is true for the stem\r\n** of the word that preceeds the zFrom ending, then change the \r\n** ending to zTo.\r\n**\r\n** The input word *pz and zFrom are both in reverse order.  zTo\r\n** is in normal order. \r\n**\r\n** Return TRUE if zFrom matches.  Return FALSE if zFrom does not\r\n** match.  Not that TRUE is returned even if xCond() fails and\r\n** no substitution occurs.\r\n*/\r\nstatic int stem(\r\n  char **pz,             /* The word being stemmed (Reversed) */\r\n  const char *zFrom,     /* If the ending matches this... (Reversed) */\r\n  const char *zTo,       /* ... change the ending to this (not reversed) */\r\n  int (*xCond)(const char*)   /* Condition that must be true */\r\n){\r\n  char *z = *pz;\r\n  while( *zFrom && *zFrom==*z ){ z++; zFrom++; }\r\n  if( *zFrom!=0 ) return 0;\r\n  if( xCond && !xCond(z) ) return 1;\r\n  while( *zTo ){\r\n    *(--z) = *(zTo++);\r\n  }\r\n  *pz = z;\r\n  return 1;\r\n}\r\n\r\n/*\r\n** This is the fallback stemmer used when the porter stemmer is\r\n** inappropriate.  The input word is copied into the output with\r\n** US-ASCII case folding.  If the input word is too long (more\r\n** than 20 bytes if it contains no digits or more than 6 bytes if\r\n** it contains digits) then word is truncated to 20 or 6 bytes\r\n** by taking 10 or 3 bytes from the beginning and end.\r\n*/\r\nstatic void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){\r\n  int i, mx, j;\r\n  int hasDigit = 0;\r\n  for(i=0; i<nIn; i++){\r\n    char c = zIn[i];\r\n    if( c>='A' && c<='Z' ){\r\n      zOut[i] = c - 'A' + 'a';\r\n    }else{\r\n      if( c>='0' && c<='9' ) hasDigit = 1;\r\n      zOut[i] = c;\r\n    }\r\n  }\r\n  mx = hasDigit ? 3 : 10;\r\n  if( nIn>mx*2 ){\r\n    for(j=mx, i=nIn-mx; i<nIn; i++, j++){\r\n      zOut[j] = zOut[i];\r\n    }\r\n    i = j;\r\n  }\r\n  zOut[i] = 0;\r\n  *pnOut = i;\r\n}\r\n\r\n\r\n/*\r\n** Stem the input word zIn[0..nIn-1].  Store the output in zOut.\r\n** zOut is at least big enough to hold nIn bytes.  Write the actual\r\n** size of the output word (exclusive of the '\\0' terminator) into *pnOut.\r\n**\r\n** Any upper-case characters in the US-ASCII character set ([A-Z])\r\n** are converted to lower case.  Upper-case UTF characters are\r\n** unchanged.\r\n**\r\n** Words that are longer than about 20 bytes are stemmed by retaining\r\n** a few bytes from the beginning and the end of the word.  If the\r\n** word contains digits, 3 bytes are taken from the beginning and\r\n** 3 bytes from the end.  For long words without digits, 10 bytes\r\n** are taken from each end.  US-ASCII case folding still applies.\r\n** \r\n** If the input word contains not digits but does characters not \r\n** in [a-zA-Z] then no stemming is attempted and this routine just \r\n** copies the input into the input into the output with US-ASCII\r\n** case folding.\r\n**\r\n** Stemming never increases the length of the word.  So there is\r\n** no chance of overflowing the zOut buffer.\r\n*/\r\nstatic void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){\r\n  int i, j;\r\n  char zReverse[28];\r\n  char *z, *z2;\r\n  if( nIn<3 || nIn>=(int)sizeof(zReverse)-7 ){\r\n    /* The word is too big or too small for the porter stemmer.\r\n    ** Fallback to the copy stemmer */\r\n    copy_stemmer(zIn, nIn, zOut, pnOut);\r\n    return;\r\n  }\r\n  for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){\r\n    char c = zIn[i];\r\n    if( c>='A' && c<='Z' ){\r\n      zReverse[j] = c + 'a' - 'A';\r\n    }else if( c>='a' && c<='z' ){\r\n      zReverse[j] = c;\r\n    }else{\r\n      /* The use of a character not in [a-zA-Z] means that we fallback\r\n      ** to the copy stemmer */\r\n      copy_stemmer(zIn, nIn, zOut, pnOut);\r\n      return;\r\n    }\r\n  }\r\n  memset(&zReverse[sizeof(zReverse)-5], 0, 5);\r\n  z = &zReverse[j+1];\r\n\r\n\r\n  /* Step 1a */\r\n  if( z[0]=='s' ){\r\n    if(\r\n     !stem(&z, \"sess\", \"ss\", 0) &&\r\n     !stem(&z, \"sei\", \"i\", 0)  &&\r\n     !stem(&z, \"ss\", \"ss\", 0)\r\n    ){\r\n      z++;\r\n    }\r\n  }\r\n\r\n  /* Step 1b */  \r\n  z2 = z;\r\n  if( stem(&z, \"dee\", \"ee\", m_gt_0) ){\r\n    /* Do nothing.  The work was all in the test */\r\n  }else if( \r\n     (stem(&z, \"gni\", \"\", hasVowel) || stem(&z, \"de\", \"\", hasVowel))\r\n      && z!=z2\r\n  ){\r\n     if( stem(&z, \"ta\", \"ate\", 0) ||\r\n         stem(&z, \"lb\", \"ble\", 0) ||\r\n         stem(&z, \"zi\", \"ize\", 0) ){\r\n       /* Do nothing.  The work was all in the test */\r\n     }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){\r\n       z++;\r\n     }else if( m_eq_1(z) && star_oh(z) ){\r\n       *(--z) = 'e';\r\n     }\r\n  }\r\n\r\n  /* Step 1c */\r\n  if( z[0]=='y' && hasVowel(z+1) ){\r\n    z[0] = 'i';\r\n  }\r\n\r\n  /* Step 2 */\r\n  switch( z[1] ){\r\n   case 'a':\r\n     stem(&z, \"lanoita\", \"ate\", m_gt_0) ||\r\n     stem(&z, \"lanoit\", \"tion\", m_gt_0);\r\n     break;\r\n   case 'c':\r\n     stem(&z, \"icne\", \"ence\", m_gt_0) ||\r\n     stem(&z, \"icna\", \"ance\", m_gt_0);\r\n     break;\r\n   case 'e':\r\n     stem(&z, \"rezi\", \"ize\", m_gt_0);\r\n     break;\r\n   case 'g':\r\n     stem(&z, \"igol\", \"log\", m_gt_0);\r\n     break;\r\n   case 'l':\r\n     stem(&z, \"ilb\", \"ble\", m_gt_0) ||\r\n     stem(&z, \"illa\", \"al\", m_gt_0) ||\r\n     stem(&z, \"iltne\", \"ent\", m_gt_0) ||\r\n     stem(&z, \"ile\", \"e\", m_gt_0) ||\r\n     stem(&z, \"ilsuo\", \"ous\", m_gt_0);\r\n     break;\r\n   case 'o':\r\n     stem(&z, \"noitazi\", \"ize\", m_gt_0) ||\r\n     stem(&z, \"noita\", \"ate\", m_gt_0) ||\r\n     stem(&z, \"rota\", \"ate\", m_gt_0);\r\n     break;\r\n   case 's':\r\n     stem(&z, \"msila\", \"al\", m_gt_0) ||\r\n     stem(&z, \"ssenevi\", \"ive\", m_gt_0) ||\r\n     stem(&z, \"ssenluf\", \"ful\", m_gt_0) ||\r\n     stem(&z, \"ssensuo\", \"ous\", m_gt_0);\r\n     break;\r\n   case 't':\r\n     stem(&z, \"itila\", \"al\", m_gt_0) ||\r\n     stem(&z, \"itivi\", \"ive\", m_gt_0) ||\r\n     stem(&z, \"itilib\", \"ble\", m_gt_0);\r\n     break;\r\n  }\r\n\r\n  /* Step 3 */\r\n  switch( z[0] ){\r\n   case 'e':\r\n     stem(&z, \"etaci\", \"ic\", m_gt_0) ||\r\n     stem(&z, \"evita\", \"\", m_gt_0)   ||\r\n     stem(&z, \"ezila\", \"al\", m_gt_0);\r\n     break;\r\n   case 'i':\r\n     stem(&z, \"itici\", \"ic\", m_gt_0);\r\n     break;\r\n   case 'l':\r\n     stem(&z, \"laci\", \"ic\", m_gt_0) ||\r\n     stem(&z, \"luf\", \"\", m_gt_0);\r\n     break;\r\n   case 's':\r\n     stem(&z, \"ssen\", \"\", m_gt_0);\r\n     break;\r\n  }\r\n\r\n  /* Step 4 */\r\n  switch( z[1] ){\r\n   case 'a':\r\n     if( z[0]=='l' && m_gt_1(z+2) ){\r\n       z += 2;\r\n     }\r\n     break;\r\n   case 'c':\r\n     if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e')  && m_gt_1(z+4)  ){\r\n       z += 4;\r\n     }\r\n     break;\r\n   case 'e':\r\n     if( z[0]=='r' && m_gt_1(z+2) ){\r\n       z += 2;\r\n     }\r\n     break;\r\n   case 'i':\r\n     if( z[0]=='c' && m_gt_1(z+2) ){\r\n       z += 2;\r\n     }\r\n     break;\r\n   case 'l':\r\n     if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){\r\n       z += 4;\r\n     }\r\n     break;\r\n   case 'n':\r\n     if( z[0]=='t' ){\r\n       if( z[2]=='a' ){\r\n         if( m_gt_1(z+3) ){\r\n           z += 3;\r\n         }\r\n       }else if( z[2]=='e' ){\r\n         stem(&z, \"tneme\", \"\", m_gt_1) ||\r\n         stem(&z, \"tnem\", \"\", m_gt_1) ||\r\n         stem(&z, \"tne\", \"\", m_gt_1);\r\n       }\r\n     }\r\n     break;\r\n   case 'o':\r\n     if( z[0]=='u' ){\r\n       if( m_gt_1(z+2) ){\r\n         z += 2;\r\n       }\r\n     }else if( z[3]=='s' || z[3]=='t' ){\r\n       stem(&z, \"noi\", \"\", m_gt_1);\r\n     }\r\n     break;\r\n   case 's':\r\n     if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){\r\n       z += 3;\r\n     }\r\n     break;\r\n   case 't':\r\n     stem(&z, \"eta\", \"\", m_gt_1) ||\r\n     stem(&z, \"iti\", \"\", m_gt_1);\r\n     break;\r\n   case 'u':\r\n     if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){\r\n       z += 3;\r\n     }\r\n     break;\r\n   case 'v':\r\n   case 'z':\r\n     if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){\r\n       z += 3;\r\n     }\r\n     break;\r\n  }\r\n\r\n  /* Step 5a */\r\n  if( z[0]=='e' ){\r\n    if( m_gt_1(z+1) ){\r\n      z++;\r\n    }else if( m_eq_1(z+1) && !star_oh(z+1) ){\r\n      z++;\r\n    }\r\n  }\r\n\r\n  /* Step 5b */\r\n  if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){\r\n    z++;\r\n  }\r\n\r\n  /* z[] is now the stemmed word in reverse order.  Flip it back\r\n  ** around into forward order and return.\r\n  */\r\n  *pnOut = i = (int)strlen(z);\r\n  zOut[i] = 0;\r\n  while( *z ){\r\n    zOut[--i] = *(z++);\r\n  }\r\n}\r\n\r\n/*\r\n** Characters that can be part of a token.  We assume any character\r\n** whose value is greater than 0x80 (any UTF character) can be\r\n** part of a token.  In other words, delimiters all must have\r\n** values of 0x7f or lower.\r\n*/\r\nstatic const char porterIdChar[] = {\r\n/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */\r\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */\r\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */\r\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */\r\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */\r\n};\r\n#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !porterIdChar[ch-0x30]))\r\n\r\n/*\r\n** Extract the next token from a tokenization cursor.  The cursor must\r\n** have been opened by a prior call to porterOpen().\r\n*/\r\nstatic int porterNext(\r\n  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by porterOpen */\r\n  const char **pzToken,               /* OUT: *pzToken is the token text */\r\n  int *pnBytes,                       /* OUT: Number of bytes in token */\r\n  int *piStartOffset,                 /* OUT: Starting offset of token */\r\n  int *piEndOffset,                   /* OUT: Ending offset of token */\r\n  int *piPosition                     /* OUT: Position integer of token */\r\n){\r\n  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;\r\n  const char *z = c->zInput;\r\n\r\n  while( c->iOffset<c->nInput ){\r\n    int iStartOffset, ch;\r\n\r\n    /* Scan past delimiter characters */\r\n    while( c->iOffset<c->nInput && isDelim(z[c->iOffset]) ){\r\n      c->iOffset++;\r\n    }\r\n\r\n    /* Count non-delimiter characters. */\r\n    iStartOffset = c->iOffset;\r\n    while( c->iOffset<c->nInput && !isDelim(z[c->iOffset]) ){\r\n      c->iOffset++;\r\n    }\r\n\r\n    if( c->iOffset>iStartOffset ){\r\n      int n = c->iOffset-iStartOffset;\r\n      if( n>c->nAllocated ){\r\n        char *pNew;\r\n        c->nAllocated = n+20;\r\n        pNew = sqlite3_realloc(c->zToken, c->nAllocated);\r\n        if( !pNew ) return SQLITE_NOMEM;\r\n        c->zToken = pNew;\r\n      }\r\n      porter_stemmer(&z[iStartOffset], n, c->zToken, pnBytes);\r\n      *pzToken = c->zToken;\r\n      *piStartOffset = iStartOffset;\r\n      *piEndOffset = c->iOffset;\r\n      *piPosition = c->iToken++;\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n  return SQLITE_DONE;\r\n}\r\n\r\n/*\r\n** The set of routines that implement the porter-stemmer tokenizer\r\n*/\r\nstatic const sqlite3_tokenizer_module porterTokenizerModule = {\r\n  0,\r\n  porterCreate,\r\n  porterDestroy,\r\n  porterOpen,\r\n  porterClose,\r\n  porterNext,\r\n  0\r\n};\r\n\r\n/*\r\n** Allocate a new porter tokenizer.  Return a pointer to the new\r\n** tokenizer in *ppModule\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule(\r\n  sqlite3_tokenizer_module const**ppModule\r\n){\r\n  *ppModule = &porterTokenizerModule;\r\n}\r\n\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_porter.c *****************************************/\r\n/************** Begin file fts3_tokenizer.c **********************************/\r\n/*\r\n** 2007 June 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This is part of an SQLite module implementing full-text search.\r\n** This particular file implements the generic tokenizer interface.\r\n*/\r\n\r\n/*\r\n** The code in this file is only compiled if:\r\n**\r\n**     * The FTS3 module is being built as an extension\r\n**       (in which case SQLITE_CORE is not defined), or\r\n**\r\n**     * The FTS3 module is being built into the core of\r\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <assert.h> */\r\n/* #include <string.h> */\r\n\r\n/*\r\n** Implementation of the SQL scalar function for accessing the underlying \r\n** hash table. This function may be called as follows:\r\n**\r\n**   SELECT <function-name>(<key-name>);\r\n**   SELECT <function-name>(<key-name>, <pointer>);\r\n**\r\n** where <function-name> is the name passed as the second argument\r\n** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer').\r\n**\r\n** If the <pointer> argument is specified, it must be a blob value\r\n** containing a pointer to be stored as the hash data corresponding\r\n** to the string <key-name>. If <pointer> is not specified, then\r\n** the string <key-name> must already exist in the has table. Otherwise,\r\n** an error is returned.\r\n**\r\n** Whether or not the <pointer> argument is specified, the value returned\r\n** is a blob containing the pointer stored as the hash data corresponding\r\n** to string <key-name> (after the hash-table is updated, if applicable).\r\n*/\r\nstatic void scalarFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  Fts3Hash *pHash;\r\n  void *pPtr = 0;\r\n  const unsigned char *zName;\r\n  int nName;\r\n\r\n  assert( argc==1 || argc==2 );\r\n\r\n  pHash = (Fts3Hash *)sqlite3_user_data(context);\r\n\r\n  zName = sqlite3_value_text(argv[0]);\r\n  nName = sqlite3_value_bytes(argv[0])+1;\r\n\r\n  if( argc==2 ){\r\n    void *pOld;\r\n    int n = sqlite3_value_bytes(argv[1]);\r\n    if( n!=sizeof(pPtr) ){\r\n      sqlite3_result_error(context, \"argument type mismatch\", -1);\r\n      return;\r\n    }\r\n    pPtr = *(void **)sqlite3_value_blob(argv[1]);\r\n    pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr);\r\n    if( pOld==pPtr ){\r\n      sqlite3_result_error(context, \"out of memory\", -1);\r\n      return;\r\n    }\r\n  }else{\r\n    pPtr = sqlite3Fts3HashFind(pHash, zName, nName);\r\n    if( !pPtr ){\r\n      char *zErr = sqlite3_mprintf(\"unknown tokenizer: %s\", zName);\r\n      sqlite3_result_error(context, zErr, -1);\r\n      sqlite3_free(zErr);\r\n      return;\r\n    }\r\n  }\r\n\r\n  sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT);\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3IsIdChar(char c){\r\n  static const char isFtsIdChar[] = {\r\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 0x */\r\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 1x */\r\n      0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */\r\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */\r\n      0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */\r\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */\r\n      0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */\r\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */\r\n  };\r\n  return (c&0x80 || isFtsIdChar[(int)(c)]);\r\n}\r\n\r\nSQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *zStr, int *pn){\r\n  const char *z1;\r\n  const char *z2 = 0;\r\n\r\n  /* Find the start of the next token. */\r\n  z1 = zStr;\r\n  while( z2==0 ){\r\n    char c = *z1;\r\n    switch( c ){\r\n      case '\\0': return 0;        /* No more tokens here */\r\n      case '\\'':\r\n      case '\"':\r\n      case '`': {\r\n        z2 = z1;\r\n        while( *++z2 && (*z2!=c || *++z2==c) );\r\n        break;\r\n      }\r\n      case '[':\r\n        z2 = &z1[1];\r\n        while( *z2 && z2[0]!=']' ) z2++;\r\n        if( *z2 ) z2++;\r\n        break;\r\n\r\n      default:\r\n        if( sqlite3Fts3IsIdChar(*z1) ){\r\n          z2 = &z1[1];\r\n          while( sqlite3Fts3IsIdChar(*z2) ) z2++;\r\n        }else{\r\n          z1++;\r\n        }\r\n    }\r\n  }\r\n\r\n  *pn = (int)(z2-z1);\r\n  return z1;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3InitTokenizer(\r\n  Fts3Hash *pHash,                /* Tokenizer hash table */\r\n  const char *zArg,               /* Tokenizer name */\r\n  sqlite3_tokenizer **ppTok,      /* OUT: Tokenizer (if applicable) */\r\n  char **pzErr                    /* OUT: Set to malloced error message */\r\n){\r\n  int rc;\r\n  char *z = (char *)zArg;\r\n  int n = 0;\r\n  char *zCopy;\r\n  char *zEnd;                     /* Pointer to nul-term of zCopy */\r\n  sqlite3_tokenizer_module *m;\r\n\r\n  zCopy = sqlite3_mprintf(\"%s\", zArg);\r\n  if( !zCopy ) return SQLITE_NOMEM;\r\n  zEnd = &zCopy[strlen(zCopy)];\r\n\r\n  z = (char *)sqlite3Fts3NextToken(zCopy, &n);\r\n  z[n] = '\\0';\r\n  sqlite3Fts3Dequote(z);\r\n\r\n  m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1);\r\n  if( !m ){\r\n    *pzErr = sqlite3_mprintf(\"unknown tokenizer: %s\", z);\r\n    rc = SQLITE_ERROR;\r\n  }else{\r\n    char const **aArg = 0;\r\n    int iArg = 0;\r\n    z = &z[n+1];\r\n    while( z<zEnd && (NULL!=(z = (char *)sqlite3Fts3NextToken(z, &n))) ){\r\n      int nNew = sizeof(char *)*(iArg+1);\r\n      char const **aNew = (const char **)sqlite3_realloc((void *)aArg, nNew);\r\n      if( !aNew ){\r\n        sqlite3_free(zCopy);\r\n        sqlite3_free((void *)aArg);\r\n        return SQLITE_NOMEM;\r\n      }\r\n      aArg = aNew;\r\n      aArg[iArg++] = z;\r\n      z[n] = '\\0';\r\n      sqlite3Fts3Dequote(z);\r\n      z = &z[n+1];\r\n    }\r\n    rc = m->xCreate(iArg, aArg, ppTok);\r\n    assert( rc!=SQLITE_OK || *ppTok );\r\n    if( rc!=SQLITE_OK ){\r\n      *pzErr = sqlite3_mprintf(\"unknown tokenizer\");\r\n    }else{\r\n      (*ppTok)->pModule = m; \r\n    }\r\n    sqlite3_free((void *)aArg);\r\n  }\r\n\r\n  sqlite3_free(zCopy);\r\n  return rc;\r\n}\r\n\r\n\r\n#ifdef SQLITE_TEST\r\n\r\n/* #include <tcl.h> */\r\n/* #include <string.h> */\r\n\r\n/*\r\n** Implementation of a special SQL scalar function for testing tokenizers \r\n** designed to be used in concert with the Tcl testing framework. This\r\n** function must be called with two arguments:\r\n**\r\n**   SELECT <function-name>(<key-name>, <input-string>);\r\n**   SELECT <function-name>(<key-name>, <pointer>);\r\n**\r\n** where <function-name> is the name passed as the second argument\r\n** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer')\r\n** concatenated with the string '_test' (e.g. 'fts3_tokenizer_test').\r\n**\r\n** The return value is a string that may be interpreted as a Tcl\r\n** list. For each token in the <input-string>, three elements are\r\n** added to the returned list. The first is the token position, the \r\n** second is the token text (folded, stemmed, etc.) and the third is the\r\n** substring of <input-string> associated with the token. For example, \r\n** using the built-in \"simple\" tokenizer:\r\n**\r\n**   SELECT fts_tokenizer_test('simple', 'I don't see how');\r\n**\r\n** will return the string:\r\n**\r\n**   \"{0 i I 1 dont don't 2 see see 3 how how}\"\r\n**   \r\n*/\r\nstatic void testFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  Fts3Hash *pHash;\r\n  sqlite3_tokenizer_module *p;\r\n  sqlite3_tokenizer *pTokenizer = 0;\r\n  sqlite3_tokenizer_cursor *pCsr = 0;\r\n\r\n  const char *zErr = 0;\r\n\r\n  const char *zName;\r\n  int nName;\r\n  const char *zInput;\r\n  int nInput;\r\n\r\n  const char *zArg = 0;\r\n\r\n  const char *zToken;\r\n  int nToken;\r\n  int iStart;\r\n  int iEnd;\r\n  int iPos;\r\n\r\n  Tcl_Obj *pRet;\r\n\r\n  assert( argc==2 || argc==3 );\r\n\r\n  nName = sqlite3_value_bytes(argv[0]);\r\n  zName = (const char *)sqlite3_value_text(argv[0]);\r\n  nInput = sqlite3_value_bytes(argv[argc-1]);\r\n  zInput = (const char *)sqlite3_value_text(argv[argc-1]);\r\n\r\n  if( argc==3 ){\r\n    zArg = (const char *)sqlite3_value_text(argv[1]);\r\n  }\r\n\r\n  pHash = (Fts3Hash *)sqlite3_user_data(context);\r\n  p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1);\r\n\r\n  if( !p ){\r\n    char *zErr = sqlite3_mprintf(\"unknown tokenizer: %s\", zName);\r\n    sqlite3_result_error(context, zErr, -1);\r\n    sqlite3_free(zErr);\r\n    return;\r\n  }\r\n\r\n  pRet = Tcl_NewObj();\r\n  Tcl_IncrRefCount(pRet);\r\n\r\n  if( SQLITE_OK!=p->xCreate(zArg ? 1 : 0, &zArg, &pTokenizer) ){\r\n    zErr = \"error in xCreate()\";\r\n    goto finish;\r\n  }\r\n  pTokenizer->pModule = p;\r\n  if( sqlite3Fts3OpenTokenizer(pTokenizer, 0, zInput, nInput, &pCsr) ){\r\n    zErr = \"error in xOpen()\";\r\n    goto finish;\r\n  }\r\n\r\n  while( SQLITE_OK==p->xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos) ){\r\n    Tcl_ListObjAppendElement(0, pRet, Tcl_NewIntObj(iPos));\r\n    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));\r\n    zToken = &zInput[iStart];\r\n    nToken = iEnd-iStart;\r\n    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));\r\n  }\r\n\r\n  if( SQLITE_OK!=p->xClose(pCsr) ){\r\n    zErr = \"error in xClose()\";\r\n    goto finish;\r\n  }\r\n  if( SQLITE_OK!=p->xDestroy(pTokenizer) ){\r\n    zErr = \"error in xDestroy()\";\r\n    goto finish;\r\n  }\r\n\r\nfinish:\r\n  if( zErr ){\r\n    sqlite3_result_error(context, zErr, -1);\r\n  }else{\r\n    sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT);\r\n  }\r\n  Tcl_DecrRefCount(pRet);\r\n}\r\n\r\nstatic\r\nint registerTokenizer(\r\n  sqlite3 *db, \r\n  char *zName, \r\n  const sqlite3_tokenizer_module *p\r\n){\r\n  int rc;\r\n  sqlite3_stmt *pStmt;\r\n  const char zSql[] = \"SELECT fts3_tokenizer(?, ?)\";\r\n\r\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);\r\n  sqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC);\r\n  sqlite3_step(pStmt);\r\n\r\n  return sqlite3_finalize(pStmt);\r\n}\r\n\r\nstatic\r\nint queryTokenizer(\r\n  sqlite3 *db, \r\n  char *zName,  \r\n  const sqlite3_tokenizer_module **pp\r\n){\r\n  int rc;\r\n  sqlite3_stmt *pStmt;\r\n  const char zSql[] = \"SELECT fts3_tokenizer(?)\";\r\n\r\n  *pp = 0;\r\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);\r\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n    if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){\r\n      memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));\r\n    }\r\n  }\r\n\r\n  return sqlite3_finalize(pStmt);\r\n}\r\n\r\nSQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);\r\n\r\n/*\r\n** Implementation of the scalar function fts3_tokenizer_internal_test().\r\n** This function is used for testing only, it is not included in the\r\n** build unless SQLITE_TEST is defined.\r\n**\r\n** The purpose of this is to test that the fts3_tokenizer() function\r\n** can be used as designed by the C-code in the queryTokenizer and\r\n** registerTokenizer() functions above. These two functions are repeated\r\n** in the README.tokenizer file as an example, so it is important to\r\n** test them.\r\n**\r\n** To run the tests, evaluate the fts3_tokenizer_internal_test() scalar\r\n** function with no arguments. An assert() will fail if a problem is\r\n** detected. i.e.:\r\n**\r\n**     SELECT fts3_tokenizer_internal_test();\r\n**\r\n*/\r\nstatic void intTestFunc(\r\n  sqlite3_context *context,\r\n  int argc,\r\n  sqlite3_value **argv\r\n){\r\n  int rc;\r\n  const sqlite3_tokenizer_module *p1;\r\n  const sqlite3_tokenizer_module *p2;\r\n  sqlite3 *db = (sqlite3 *)sqlite3_user_data(context);\r\n\r\n  UNUSED_PARAMETER(argc);\r\n  UNUSED_PARAMETER(argv);\r\n\r\n  /* Test the query function */\r\n  sqlite3Fts3SimpleTokenizerModule(&p1);\r\n  rc = queryTokenizer(db, \"simple\", &p2);\r\n  assert( rc==SQLITE_OK );\r\n  assert( p1==p2 );\r\n  rc = queryTokenizer(db, \"nosuchtokenizer\", &p2);\r\n  assert( rc==SQLITE_ERROR );\r\n  assert( p2==0 );\r\n  assert( 0==strcmp(sqlite3_errmsg(db), \"unknown tokenizer: nosuchtokenizer\") );\r\n\r\n  /* Test the storage function */\r\n  rc = registerTokenizer(db, \"nosuchtokenizer\", p1);\r\n  assert( rc==SQLITE_OK );\r\n  rc = queryTokenizer(db, \"nosuchtokenizer\", &p2);\r\n  assert( rc==SQLITE_OK );\r\n  assert( p2==p1 );\r\n\r\n  sqlite3_result_text(context, \"ok\", -1, SQLITE_STATIC);\r\n}\r\n\r\n#endif\r\n\r\n/*\r\n** Set up SQL objects in database db used to access the contents of\r\n** the hash table pointed to by argument pHash. The hash table must\r\n** been initialised to use string keys, and to take a private copy \r\n** of the key when a value is inserted. i.e. by a call similar to:\r\n**\r\n**    sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);\r\n**\r\n** This function adds a scalar function (see header comment above\r\n** scalarFunc() in this file for details) and, if ENABLE_TABLE is\r\n** defined at compilation time, a temporary virtual table (see header \r\n** comment above struct HashTableVtab) to the database schema. Both \r\n** provide read/write access to the contents of *pHash.\r\n**\r\n** The third argument to this function, zName, is used as the name\r\n** of both the scalar and, if created, the virtual table.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3InitHashTable(\r\n  sqlite3 *db, \r\n  Fts3Hash *pHash, \r\n  const char *zName\r\n){\r\n  int rc = SQLITE_OK;\r\n  void *p = (void *)pHash;\r\n  const int any = SQLITE_ANY;\r\n\r\n#ifdef SQLITE_TEST\r\n  char *zTest = 0;\r\n  char *zTest2 = 0;\r\n  void *pdb = (void *)db;\r\n  zTest = sqlite3_mprintf(\"%s_test\", zName);\r\n  zTest2 = sqlite3_mprintf(\"%s_internal_test\", zName);\r\n  if( !zTest || !zTest2 ){\r\n    rc = SQLITE_NOMEM;\r\n  }\r\n#endif\r\n\r\n  if( SQLITE_OK==rc ){\r\n    rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0);\r\n  }\r\n  if( SQLITE_OK==rc ){\r\n    rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0);\r\n  }\r\n#ifdef SQLITE_TEST\r\n  if( SQLITE_OK==rc ){\r\n    rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0);\r\n  }\r\n  if( SQLITE_OK==rc ){\r\n    rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0);\r\n  }\r\n  if( SQLITE_OK==rc ){\r\n    rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0);\r\n  }\r\n#endif\r\n\r\n#ifdef SQLITE_TEST\r\n  sqlite3_free(zTest);\r\n  sqlite3_free(zTest2);\r\n#endif\r\n\r\n  return rc;\r\n}\r\n\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_tokenizer.c **************************************/\r\n/************** Begin file fts3_tokenizer1.c *********************************/\r\n/*\r\n** 2006 Oct 10\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** Implementation of the \"simple\" full-text-search tokenizer.\r\n*/\r\n\r\n/*\r\n** The code in this file is only compiled if:\r\n**\r\n**     * The FTS3 module is being built as an extension\r\n**       (in which case SQLITE_CORE is not defined), or\r\n**\r\n**     * The FTS3 module is being built into the core of\r\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <assert.h> */\r\n/* #include <stdlib.h> */\r\n/* #include <stdio.h> */\r\n/* #include <string.h> */\r\n\r\n\r\ntypedef struct simple_tokenizer {\r\n  sqlite3_tokenizer base;\r\n  char delim[128];             /* flag ASCII delimiters */\r\n} simple_tokenizer;\r\n\r\ntypedef struct simple_tokenizer_cursor {\r\n  sqlite3_tokenizer_cursor base;\r\n  const char *pInput;          /* input we are tokenizing */\r\n  int nBytes;                  /* size of the input */\r\n  int iOffset;                 /* current position in pInput */\r\n  int iToken;                  /* index of next token to be returned */\r\n  char *pToken;                /* storage for current token */\r\n  int nTokenAllocated;         /* space allocated to zToken buffer */\r\n} simple_tokenizer_cursor;\r\n\r\n\r\nstatic int simpleDelim(simple_tokenizer *t, unsigned char c){\r\n  return c<0x80 && t->delim[c];\r\n}\r\nstatic int fts3_isalnum(int x){\r\n  return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');\r\n}\r\n\r\n/*\r\n** Create a new tokenizer instance.\r\n*/\r\nstatic int simpleCreate(\r\n  int argc, const char * const *argv,\r\n  sqlite3_tokenizer **ppTokenizer\r\n){\r\n  simple_tokenizer *t;\r\n\r\n  t = (simple_tokenizer *) sqlite3_malloc(sizeof(*t));\r\n  if( t==NULL ) return SQLITE_NOMEM;\r\n  memset(t, 0, sizeof(*t));\r\n\r\n  /* TODO(shess) Delimiters need to remain the same from run to run,\r\n  ** else we need to reindex.  One solution would be a meta-table to\r\n  ** track such information in the database, then we'd only want this\r\n  ** information on the initial create.\r\n  */\r\n  if( argc>1 ){\r\n    int i, n = (int)strlen(argv[1]);\r\n    for(i=0; i<n; i++){\r\n      unsigned char ch = argv[1][i];\r\n      /* We explicitly don't support UTF-8 delimiters for now. */\r\n      if( ch>=0x80 ){\r\n        sqlite3_free(t);\r\n        return SQLITE_ERROR;\r\n      }\r\n      t->delim[ch] = 1;\r\n    }\r\n  } else {\r\n    /* Mark non-alphanumeric ASCII characters as delimiters */\r\n    int i;\r\n    for(i=1; i<0x80; i++){\r\n      t->delim[i] = !fts3_isalnum(i) ? -1 : 0;\r\n    }\r\n  }\r\n\r\n  *ppTokenizer = &t->base;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Destroy a tokenizer\r\n*/\r\nstatic int simpleDestroy(sqlite3_tokenizer *pTokenizer){\r\n  sqlite3_free(pTokenizer);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Prepare to begin tokenizing a particular string.  The input\r\n** string to be tokenized is pInput[0..nBytes-1].  A cursor\r\n** used to incrementally tokenize this string is returned in \r\n** *ppCursor.\r\n*/\r\nstatic int simpleOpen(\r\n  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */\r\n  const char *pInput, int nBytes,        /* String to be tokenized */\r\n  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */\r\n){\r\n  simple_tokenizer_cursor *c;\r\n\r\n  UNUSED_PARAMETER(pTokenizer);\r\n\r\n  c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));\r\n  if( c==NULL ) return SQLITE_NOMEM;\r\n\r\n  c->pInput = pInput;\r\n  if( pInput==0 ){\r\n    c->nBytes = 0;\r\n  }else if( nBytes<0 ){\r\n    c->nBytes = (int)strlen(pInput);\r\n  }else{\r\n    c->nBytes = nBytes;\r\n  }\r\n  c->iOffset = 0;                 /* start tokenizing at the beginning */\r\n  c->iToken = 0;\r\n  c->pToken = NULL;               /* no space allocated, yet. */\r\n  c->nTokenAllocated = 0;\r\n\r\n  *ppCursor = &c->base;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close a tokenization cursor previously opened by a call to\r\n** simpleOpen() above.\r\n*/\r\nstatic int simpleClose(sqlite3_tokenizer_cursor *pCursor){\r\n  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;\r\n  sqlite3_free(c->pToken);\r\n  sqlite3_free(c);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Extract the next token from a tokenization cursor.  The cursor must\r\n** have been opened by a prior call to simpleOpen().\r\n*/\r\nstatic int simpleNext(\r\n  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */\r\n  const char **ppToken,               /* OUT: *ppToken is the token text */\r\n  int *pnBytes,                       /* OUT: Number of bytes in token */\r\n  int *piStartOffset,                 /* OUT: Starting offset of token */\r\n  int *piEndOffset,                   /* OUT: Ending offset of token */\r\n  int *piPosition                     /* OUT: Position integer of token */\r\n){\r\n  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;\r\n  simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer;\r\n  unsigned char *p = (unsigned char *)c->pInput;\r\n\r\n  while( c->iOffset<c->nBytes ){\r\n    int iStartOffset;\r\n\r\n    /* Scan past delimiter characters */\r\n    while( c->iOffset<c->nBytes && simpleDelim(t, p[c->iOffset]) ){\r\n      c->iOffset++;\r\n    }\r\n\r\n    /* Count non-delimiter characters. */\r\n    iStartOffset = c->iOffset;\r\n    while( c->iOffset<c->nBytes && !simpleDelim(t, p[c->iOffset]) ){\r\n      c->iOffset++;\r\n    }\r\n\r\n    if( c->iOffset>iStartOffset ){\r\n      int i, n = c->iOffset-iStartOffset;\r\n      if( n>c->nTokenAllocated ){\r\n        char *pNew;\r\n        c->nTokenAllocated = n+20;\r\n        pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);\r\n        if( !pNew ) return SQLITE_NOMEM;\r\n        c->pToken = pNew;\r\n      }\r\n      for(i=0; i<n; i++){\r\n        /* TODO(shess) This needs expansion to handle UTF-8\r\n        ** case-insensitivity.\r\n        */\r\n        unsigned char ch = p[iStartOffset+i];\r\n        c->pToken[i] = (char)((ch>='A' && ch<='Z') ? ch-'A'+'a' : ch);\r\n      }\r\n      *ppToken = c->pToken;\r\n      *pnBytes = n;\r\n      *piStartOffset = iStartOffset;\r\n      *piEndOffset = c->iOffset;\r\n      *piPosition = c->iToken++;\r\n\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n  return SQLITE_DONE;\r\n}\r\n\r\n/*\r\n** The set of routines that implement the simple tokenizer\r\n*/\r\nstatic const sqlite3_tokenizer_module simpleTokenizerModule = {\r\n  0,\r\n  simpleCreate,\r\n  simpleDestroy,\r\n  simpleOpen,\r\n  simpleClose,\r\n  simpleNext,\r\n  0,\r\n};\r\n\r\n/*\r\n** Allocate a new simple tokenizer.  Return a pointer to the new\r\n** tokenizer in *ppModule\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(\r\n  sqlite3_tokenizer_module const**ppModule\r\n){\r\n  *ppModule = &simpleTokenizerModule;\r\n}\r\n\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_tokenizer1.c *************************************/\r\n/************** Begin file fts3_write.c **************************************/\r\n/*\r\n** 2009 Oct 23\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n**\r\n** This file is part of the SQLite FTS3 extension module. Specifically,\r\n** this file contains code to insert, update and delete rows from FTS3\r\n** tables. It also contains code to merge FTS3 b-tree segments. Some\r\n** of the sub-routines used to merge segments are also used by the query \r\n** code in fts3.c.\r\n*/\r\n\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <string.h> */\r\n/* #include <assert.h> */\r\n/* #include <stdlib.h> */\r\n\r\n/*\r\n** When full-text index nodes are loaded from disk, the buffer that they\r\n** are loaded into has the following number of bytes of padding at the end \r\n** of it. i.e. if a full-text index node is 900 bytes in size, then a buffer\r\n** of 920 bytes is allocated for it.\r\n**\r\n** This means that if we have a pointer into a buffer containing node data,\r\n** it is always safe to read up to two varints from it without risking an\r\n** overread, even if the node data is corrupted.\r\n*/\r\n#define FTS3_NODE_PADDING (FTS3_VARINT_MAX*2)\r\n\r\n/*\r\n** Under certain circumstances, b-tree nodes (doclists) can be loaded into\r\n** memory incrementally instead of all at once. This can be a big performance\r\n** win (reduced IO and CPU) if SQLite stops calling the virtual table xNext()\r\n** method before retrieving all query results (as may happen, for example,\r\n** if a query has a LIMIT clause).\r\n**\r\n** Incremental loading is used for b-tree nodes FTS3_NODE_CHUNK_THRESHOLD \r\n** bytes and larger. Nodes are loaded in chunks of FTS3_NODE_CHUNKSIZE bytes.\r\n** The code is written so that the hard lower-limit for each of these values \r\n** is 1. Clearly such small values would be inefficient, but can be useful \r\n** for testing purposes.\r\n**\r\n** If this module is built with SQLITE_TEST defined, these constants may\r\n** be overridden at runtime for testing purposes. File fts3_test.c contains\r\n** a Tcl interface to read and write the values.\r\n*/\r\n#ifdef SQLITE_TEST\r\nint test_fts3_node_chunksize = (4*1024);\r\nint test_fts3_node_chunk_threshold = (4*1024)*4;\r\n# define FTS3_NODE_CHUNKSIZE       test_fts3_node_chunksize\r\n# define FTS3_NODE_CHUNK_THRESHOLD test_fts3_node_chunk_threshold\r\n#else\r\n# define FTS3_NODE_CHUNKSIZE (4*1024) \r\n# define FTS3_NODE_CHUNK_THRESHOLD (FTS3_NODE_CHUNKSIZE*4)\r\n#endif\r\n\r\ntypedef struct PendingList PendingList;\r\ntypedef struct SegmentNode SegmentNode;\r\ntypedef struct SegmentWriter SegmentWriter;\r\n\r\n/*\r\n** An instance of the following data structure is used to build doclists\r\n** incrementally. See function fts3PendingListAppend() for details.\r\n*/\r\nstruct PendingList {\r\n  int nData;\r\n  char *aData;\r\n  int nSpace;\r\n  sqlite3_int64 iLastDocid;\r\n  sqlite3_int64 iLastCol;\r\n  sqlite3_int64 iLastPos;\r\n};\r\n\r\n\r\n/*\r\n** Each cursor has a (possibly empty) linked list of the following objects.\r\n*/\r\nstruct Fts3DeferredToken {\r\n  Fts3PhraseToken *pToken;        /* Pointer to corresponding expr token */\r\n  int iCol;                       /* Column token must occur in */\r\n  Fts3DeferredToken *pNext;       /* Next in list of deferred tokens */\r\n  PendingList *pList;             /* Doclist is assembled here */\r\n};\r\n\r\n/*\r\n** An instance of this structure is used to iterate through the terms on\r\n** a contiguous set of segment b-tree leaf nodes. Although the details of\r\n** this structure are only manipulated by code in this file, opaque handles\r\n** of type Fts3SegReader* are also used by code in fts3.c to iterate through\r\n** terms when querying the full-text index. See functions:\r\n**\r\n**   sqlite3Fts3SegReaderNew()\r\n**   sqlite3Fts3SegReaderFree()\r\n**   sqlite3Fts3SegReaderIterate()\r\n**\r\n** Methods used to manipulate Fts3SegReader structures:\r\n**\r\n**   fts3SegReaderNext()\r\n**   fts3SegReaderFirstDocid()\r\n**   fts3SegReaderNextDocid()\r\n*/\r\nstruct Fts3SegReader {\r\n  int iIdx;                       /* Index within level, or 0x7FFFFFFF for PT */\r\n  int bLookup;                    /* True for a lookup only */\r\n\r\n  sqlite3_int64 iStartBlock;      /* Rowid of first leaf block to traverse */\r\n  sqlite3_int64 iLeafEndBlock;    /* Rowid of final leaf block to traverse */\r\n  sqlite3_int64 iEndBlock;        /* Rowid of final block in segment (or 0) */\r\n  sqlite3_int64 iCurrentBlock;    /* Current leaf block (or 0) */\r\n\r\n  char *aNode;                    /* Pointer to node data (or NULL) */\r\n  int nNode;                      /* Size of buffer at aNode (or 0) */\r\n  int nPopulate;                  /* If >0, bytes of buffer aNode[] loaded */\r\n  sqlite3_blob *pBlob;            /* If not NULL, blob handle to read node */\r\n\r\n  Fts3HashElem **ppNextElem;\r\n\r\n  /* Variables set by fts3SegReaderNext(). These may be read directly\r\n  ** by the caller. They are valid from the time SegmentReaderNew() returns\r\n  ** until SegmentReaderNext() returns something other than SQLITE_OK\r\n  ** (i.e. SQLITE_DONE).\r\n  */\r\n  int nTerm;                      /* Number of bytes in current term */\r\n  char *zTerm;                    /* Pointer to current term */\r\n  int nTermAlloc;                 /* Allocated size of zTerm buffer */\r\n  char *aDoclist;                 /* Pointer to doclist of current entry */\r\n  int nDoclist;                   /* Size of doclist in current entry */\r\n\r\n  /* The following variables are used by fts3SegReaderNextDocid() to iterate \r\n  ** through the current doclist (aDoclist/nDoclist).\r\n  */\r\n  char *pOffsetList;\r\n  int nOffsetList;                /* For descending pending seg-readers only */\r\n  sqlite3_int64 iDocid;\r\n};\r\n\r\n#define fts3SegReaderIsPending(p) ((p)->ppNextElem!=0)\r\n#define fts3SegReaderIsRootOnly(p) ((p)->aNode==(char *)&(p)[1])\r\n\r\n/*\r\n** An instance of this structure is used to create a segment b-tree in the\r\n** database. The internal details of this type are only accessed by the\r\n** following functions:\r\n**\r\n**   fts3SegWriterAdd()\r\n**   fts3SegWriterFlush()\r\n**   fts3SegWriterFree()\r\n*/\r\nstruct SegmentWriter {\r\n  SegmentNode *pTree;             /* Pointer to interior tree structure */\r\n  sqlite3_int64 iFirst;           /* First slot in %_segments written */\r\n  sqlite3_int64 iFree;            /* Next free slot in %_segments */\r\n  char *zTerm;                    /* Pointer to previous term buffer */\r\n  int nTerm;                      /* Number of bytes in zTerm */\r\n  int nMalloc;                    /* Size of malloc'd buffer at zMalloc */\r\n  char *zMalloc;                  /* Malloc'd space (possibly) used for zTerm */\r\n  int nSize;                      /* Size of allocation at aData */\r\n  int nData;                      /* Bytes of data in aData */\r\n  char *aData;                    /* Pointer to block from malloc() */\r\n};\r\n\r\n/*\r\n** Type SegmentNode is used by the following three functions to create\r\n** the interior part of the segment b+-tree structures (everything except\r\n** the leaf nodes). These functions and type are only ever used by code\r\n** within the fts3SegWriterXXX() family of functions described above.\r\n**\r\n**   fts3NodeAddTerm()\r\n**   fts3NodeWrite()\r\n**   fts3NodeFree()\r\n**\r\n** When a b+tree is written to the database (either as a result of a merge\r\n** or the pending-terms table being flushed), leaves are written into the \r\n** database file as soon as they are completely populated. The interior of\r\n** the tree is assembled in memory and written out only once all leaves have\r\n** been populated and stored. This is Ok, as the b+-tree fanout is usually\r\n** very large, meaning that the interior of the tree consumes relatively \r\n** little memory.\r\n*/\r\nstruct SegmentNode {\r\n  SegmentNode *pParent;           /* Parent node (or NULL for root node) */\r\n  SegmentNode *pRight;            /* Pointer to right-sibling */\r\n  SegmentNode *pLeftmost;         /* Pointer to left-most node of this depth */\r\n  int nEntry;                     /* Number of terms written to node so far */\r\n  char *zTerm;                    /* Pointer to previous term buffer */\r\n  int nTerm;                      /* Number of bytes in zTerm */\r\n  int nMalloc;                    /* Size of malloc'd buffer at zMalloc */\r\n  char *zMalloc;                  /* Malloc'd space (possibly) used for zTerm */\r\n  int nData;                      /* Bytes of valid data so far */\r\n  char *aData;                    /* Node data */\r\n};\r\n\r\n/*\r\n** Valid values for the second argument to fts3SqlStmt().\r\n*/\r\n#define SQL_DELETE_CONTENT             0\r\n#define SQL_IS_EMPTY                   1\r\n#define SQL_DELETE_ALL_CONTENT         2 \r\n#define SQL_DELETE_ALL_SEGMENTS        3\r\n#define SQL_DELETE_ALL_SEGDIR          4\r\n#define SQL_DELETE_ALL_DOCSIZE         5\r\n#define SQL_DELETE_ALL_STAT            6\r\n#define SQL_SELECT_CONTENT_BY_ROWID    7\r\n#define SQL_NEXT_SEGMENT_INDEX         8\r\n#define SQL_INSERT_SEGMENTS            9\r\n#define SQL_NEXT_SEGMENTS_ID          10\r\n#define SQL_INSERT_SEGDIR             11\r\n#define SQL_SELECT_LEVEL              12\r\n#define SQL_SELECT_LEVEL_RANGE        13\r\n#define SQL_SELECT_LEVEL_COUNT        14\r\n#define SQL_SELECT_SEGDIR_MAX_LEVEL   15\r\n#define SQL_DELETE_SEGDIR_LEVEL       16\r\n#define SQL_DELETE_SEGMENTS_RANGE     17\r\n#define SQL_CONTENT_INSERT            18\r\n#define SQL_DELETE_DOCSIZE            19\r\n#define SQL_REPLACE_DOCSIZE           20\r\n#define SQL_SELECT_DOCSIZE            21\r\n#define SQL_SELECT_DOCTOTAL           22\r\n#define SQL_REPLACE_DOCTOTAL          23\r\n\r\n#define SQL_SELECT_ALL_PREFIX_LEVEL   24\r\n#define SQL_DELETE_ALL_TERMS_SEGDIR   25\r\n\r\n#define SQL_DELETE_SEGDIR_RANGE       26\r\n\r\n#define SQL_SELECT_ALL_LANGID         27\r\n\r\n/*\r\n** This function is used to obtain an SQLite prepared statement handle\r\n** for the statement identified by the second argument. If successful,\r\n** *pp is set to the requested statement handle and SQLITE_OK returned.\r\n** Otherwise, an SQLite error code is returned and *pp is set to 0.\r\n**\r\n** If argument apVal is not NULL, then it must point to an array with\r\n** at least as many entries as the requested statement has bound \r\n** parameters. The values are bound to the statements parameters before\r\n** returning.\r\n*/\r\nstatic int fts3SqlStmt(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  int eStmt,                      /* One of the SQL_XXX constants above */\r\n  sqlite3_stmt **pp,              /* OUT: Statement handle */\r\n  sqlite3_value **apVal           /* Values to bind to statement */\r\n){\r\n  const char *azSql[] = {\r\n/* 0  */  \"DELETE FROM %Q.'%q_content' WHERE rowid = ?\",\r\n/* 1  */  \"SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)\",\r\n/* 2  */  \"DELETE FROM %Q.'%q_content'\",\r\n/* 3  */  \"DELETE FROM %Q.'%q_segments'\",\r\n/* 4  */  \"DELETE FROM %Q.'%q_segdir'\",\r\n/* 5  */  \"DELETE FROM %Q.'%q_docsize'\",\r\n/* 6  */  \"DELETE FROM %Q.'%q_stat'\",\r\n/* 7  */  \"SELECT %s WHERE rowid=?\",\r\n/* 8  */  \"SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1\",\r\n/* 9  */  \"INSERT INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)\",\r\n/* 10 */  \"SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)\",\r\n/* 11 */  \"INSERT INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)\",\r\n\r\n          /* Return segments in order from oldest to newest.*/ \r\n/* 12 */  \"SELECT idx, start_block, leaves_end_block, end_block, root \"\r\n            \"FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC\",\r\n/* 13 */  \"SELECT idx, start_block, leaves_end_block, end_block, root \"\r\n            \"FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\"\r\n            \"ORDER BY level DESC, idx ASC\",\r\n\r\n/* 14 */  \"SELECT count(*) FROM %Q.'%q_segdir' WHERE level = ?\",\r\n/* 15 */  \"SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\",\r\n\r\n/* 16 */  \"DELETE FROM %Q.'%q_segdir' WHERE level = ?\",\r\n/* 17 */  \"DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?\",\r\n/* 18 */  \"INSERT INTO %Q.'%q_content' VALUES(%s)\",\r\n/* 19 */  \"DELETE FROM %Q.'%q_docsize' WHERE docid = ?\",\r\n/* 20 */  \"REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\",\r\n/* 21 */  \"SELECT size FROM %Q.'%q_docsize' WHERE docid=?\",\r\n/* 22 */  \"SELECT value FROM %Q.'%q_stat' WHERE id=0\",\r\n/* 23 */  \"REPLACE INTO %Q.'%q_stat' VALUES(0,?)\",\r\n/* 24 */  \"\",\r\n/* 25 */  \"\",\r\n\r\n/* 26 */ \"DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\",\r\n/* 27 */ \"SELECT DISTINCT level / (1024 * ?) FROM %Q.'%q_segdir'\",\r\n\r\n  };\r\n  int rc = SQLITE_OK;\r\n  sqlite3_stmt *pStmt;\r\n\r\n  assert( SizeofArray(azSql)==SizeofArray(p->aStmt) );\r\n  assert( eStmt<SizeofArray(azSql) && eStmt>=0 );\r\n  \r\n  pStmt = p->aStmt[eStmt];\r\n  if( !pStmt ){\r\n    char *zSql;\r\n    if( eStmt==SQL_CONTENT_INSERT ){\r\n      zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist);\r\n    }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){\r\n      zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist);\r\n    }else{\r\n      zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName);\r\n    }\r\n    if( !zSql ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL);\r\n      sqlite3_free(zSql);\r\n      assert( rc==SQLITE_OK || pStmt==0 );\r\n      p->aStmt[eStmt] = pStmt;\r\n    }\r\n  }\r\n  if( apVal ){\r\n    int i;\r\n    int nParam = sqlite3_bind_parameter_count(pStmt);\r\n    for(i=0; rc==SQLITE_OK && i<nParam; i++){\r\n      rc = sqlite3_bind_value(pStmt, i+1, apVal[i]);\r\n    }\r\n  }\r\n  *pp = pStmt;\r\n  return rc;\r\n}\r\n\r\nstatic int fts3SelectDocsize(\r\n  Fts3Table *pTab,                /* FTS3 table handle */\r\n  int eStmt,                      /* Either SQL_SELECT_DOCSIZE or DOCTOTAL */\r\n  sqlite3_int64 iDocid,           /* Docid to bind for SQL_SELECT_DOCSIZE */\r\n  sqlite3_stmt **ppStmt           /* OUT: Statement handle */\r\n){\r\n  sqlite3_stmt *pStmt = 0;        /* Statement requested from fts3SqlStmt() */\r\n  int rc;                         /* Return code */\r\n\r\n  assert( eStmt==SQL_SELECT_DOCSIZE || eStmt==SQL_SELECT_DOCTOTAL );\r\n\r\n  rc = fts3SqlStmt(pTab, eStmt, &pStmt, 0);\r\n  if( rc==SQLITE_OK ){\r\n    if( eStmt==SQL_SELECT_DOCSIZE ){\r\n      sqlite3_bind_int64(pStmt, 1, iDocid);\r\n    }\r\n    rc = sqlite3_step(pStmt);\r\n    if( rc!=SQLITE_ROW || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB ){\r\n      rc = sqlite3_reset(pStmt);\r\n      if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB;\r\n      pStmt = 0;\r\n    }else{\r\n      rc = SQLITE_OK;\r\n    }\r\n  }\r\n\r\n  *ppStmt = pStmt;\r\n  return rc;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SelectDoctotal(\r\n  Fts3Table *pTab,                /* Fts3 table handle */\r\n  sqlite3_stmt **ppStmt           /* OUT: Statement handle */\r\n){\r\n  return fts3SelectDocsize(pTab, SQL_SELECT_DOCTOTAL, 0, ppStmt);\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SelectDocsize(\r\n  Fts3Table *pTab,                /* Fts3 table handle */\r\n  sqlite3_int64 iDocid,           /* Docid to read size data for */\r\n  sqlite3_stmt **ppStmt           /* OUT: Statement handle */\r\n){\r\n  return fts3SelectDocsize(pTab, SQL_SELECT_DOCSIZE, iDocid, ppStmt);\r\n}\r\n\r\n/*\r\n** Similar to fts3SqlStmt(). Except, after binding the parameters in\r\n** array apVal[] to the SQL statement identified by eStmt, the statement\r\n** is executed.\r\n**\r\n** Returns SQLITE_OK if the statement is successfully executed, or an\r\n** SQLite error code otherwise.\r\n*/\r\nstatic void fts3SqlExec(\r\n  int *pRC,                /* Result code */\r\n  Fts3Table *p,            /* The FTS3 table */\r\n  int eStmt,               /* Index of statement to evaluate */\r\n  sqlite3_value **apVal    /* Parameters to bind */\r\n){\r\n  sqlite3_stmt *pStmt;\r\n  int rc;\r\n  if( *pRC ) return;\r\n  rc = fts3SqlStmt(p, eStmt, &pStmt, apVal); \r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_step(pStmt);\r\n    rc = sqlite3_reset(pStmt);\r\n  }\r\n  *pRC = rc;\r\n}\r\n\r\n\r\n/*\r\n** This function ensures that the caller has obtained a shared-cache\r\n** table-lock on the %_content table. This is required before reading\r\n** data from the fts3 table. If this lock is not acquired first, then\r\n** the caller may end up holding read-locks on the %_segments and %_segdir\r\n** tables, but no read-lock on the %_content table. If this happens \r\n** a second connection will be able to write to the fts3 table, but\r\n** attempting to commit those writes might return SQLITE_LOCKED or\r\n** SQLITE_LOCKED_SHAREDCACHE (because the commit attempts to obtain \r\n** write-locks on the %_segments and %_segdir ** tables). \r\n**\r\n** We try to avoid this because if FTS3 returns any error when committing\r\n** a transaction, the whole transaction will be rolled back. And this is\r\n** not what users expect when they get SQLITE_LOCKED_SHAREDCACHE. It can\r\n** still happen if the user reads data directly from the %_segments or\r\n** %_segdir tables instead of going through FTS3 though.\r\n**\r\n** This reasoning does not apply to a content=xxx table.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3ReadLock(Fts3Table *p){\r\n  int rc;                         /* Return code */\r\n  sqlite3_stmt *pStmt;            /* Statement used to obtain lock */\r\n\r\n  if( p->zContentTbl==0 ){\r\n    rc = fts3SqlStmt(p, SQL_SELECT_CONTENT_BY_ROWID, &pStmt, 0);\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3_bind_null(pStmt, 1);\r\n      sqlite3_step(pStmt);\r\n      rc = sqlite3_reset(pStmt);\r\n    }\r\n  }else{\r\n    rc = SQLITE_OK;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** FTS maintains a separate indexes for each language-id (a 32-bit integer).\r\n** Within each language id, a separate index is maintained to store the\r\n** document terms, and each configured prefix size (configured the FTS \r\n** \"prefix=\" option). And each index consists of multiple levels (\"relative\r\n** levels\").\r\n**\r\n** All three of these values (the language id, the specific index and the\r\n** level within the index) are encoded in 64-bit integer values stored\r\n** in the %_segdir table on disk. This function is used to convert three\r\n** separate component values into the single 64-bit integer value that\r\n** can be used to query the %_segdir table.\r\n**\r\n** Specifically, each language-id/index combination is allocated 1024 \r\n** 64-bit integer level values (\"absolute levels\"). The main terms index\r\n** for language-id 0 is allocate values 0-1023. The first prefix index\r\n** (if any) for language-id 0 is allocated values 1024-2047. And so on.\r\n** Language 1 indexes are allocated immediately following language 0.\r\n**\r\n** So, for a system with nPrefix prefix indexes configured, the block of\r\n** absolute levels that corresponds to language-id iLangid and index \r\n** iIndex starts at absolute level ((iLangid * (nPrefix+1) + iIndex) * 1024).\r\n*/\r\nstatic sqlite3_int64 getAbsoluteLevel(\r\n  Fts3Table *p, \r\n  int iLangid, \r\n  int iIndex, \r\n  int iLevel\r\n){\r\n  sqlite3_int64 iBase;            /* First absolute level for iLangid/iIndex */\r\n  assert( iLangid>=0 );\r\n  assert( p->nIndex>0 );\r\n  assert( iIndex>=0 && iIndex<p->nIndex );\r\n\r\n  iBase = ((sqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL;\r\n  return iBase + iLevel;\r\n}\r\n\r\n\r\n/*\r\n** Set *ppStmt to a statement handle that may be used to iterate through\r\n** all rows in the %_segdir table, from oldest to newest. If successful,\r\n** return SQLITE_OK. If an error occurs while preparing the statement, \r\n** return an SQLite error code.\r\n**\r\n** There is only ever one instance of this SQL statement compiled for\r\n** each FTS3 table.\r\n**\r\n** The statement returns the following columns from the %_segdir table:\r\n**\r\n**   0: idx\r\n**   1: start_block\r\n**   2: leaves_end_block\r\n**   3: end_block\r\n**   4: root\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3AllSegdirs(\r\n  Fts3Table *p,                   /* FTS3 table */\r\n  int iLangid,                    /* Language being queried */\r\n  int iIndex,                     /* Index for p->aIndex[] */\r\n  int iLevel,                     /* Level to select (relative level) */\r\n  sqlite3_stmt **ppStmt           /* OUT: Compiled statement */\r\n){\r\n  int rc;\r\n  sqlite3_stmt *pStmt = 0;\r\n\r\n  assert( iLevel==FTS3_SEGCURSOR_ALL || iLevel>=0 );\r\n  assert( iLevel<FTS3_SEGDIR_MAXLEVEL );\r\n  assert( iIndex>=0 && iIndex<p->nIndex );\r\n\r\n  if( iLevel<0 ){\r\n    /* \"SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ...\" */\r\n    rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE, &pStmt, 0);\r\n    if( rc==SQLITE_OK ){ \r\n      sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0));\r\n      sqlite3_bind_int64(pStmt, 2, \r\n          getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1)\r\n      );\r\n    }\r\n  }else{\r\n    /* \"SELECT * FROM %_segdir WHERE level = ? ORDER BY ...\" */\r\n    rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0);\r\n    if( rc==SQLITE_OK ){ \r\n      sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel));\r\n    }\r\n  }\r\n  *ppStmt = pStmt;\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Append a single varint to a PendingList buffer. SQLITE_OK is returned\r\n** if successful, or an SQLite error code otherwise.\r\n**\r\n** This function also serves to allocate the PendingList structure itself.\r\n** For example, to create a new PendingList structure containing two\r\n** varints:\r\n**\r\n**   PendingList *p = 0;\r\n**   fts3PendingListAppendVarint(&p, 1);\r\n**   fts3PendingListAppendVarint(&p, 2);\r\n*/\r\nstatic int fts3PendingListAppendVarint(\r\n  PendingList **pp,               /* IN/OUT: Pointer to PendingList struct */\r\n  sqlite3_int64 i                 /* Value to append to data */\r\n){\r\n  PendingList *p = *pp;\r\n\r\n  /* Allocate or grow the PendingList as required. */\r\n  if( !p ){\r\n    p = sqlite3_malloc(sizeof(*p) + 100);\r\n    if( !p ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    p->nSpace = 100;\r\n    p->aData = (char *)&p[1];\r\n    p->nData = 0;\r\n  }\r\n  else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){\r\n    int nNew = p->nSpace * 2;\r\n    p = sqlite3_realloc(p, sizeof(*p) + nNew);\r\n    if( !p ){\r\n      sqlite3_free(*pp);\r\n      *pp = 0;\r\n      return SQLITE_NOMEM;\r\n    }\r\n    p->nSpace = nNew;\r\n    p->aData = (char *)&p[1];\r\n  }\r\n\r\n  /* Append the new serialized varint to the end of the list. */\r\n  p->nData += sqlite3Fts3PutVarint(&p->aData[p->nData], i);\r\n  p->aData[p->nData] = '\\0';\r\n  *pp = p;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Add a docid/column/position entry to a PendingList structure. Non-zero\r\n** is returned if the structure is sqlite3_realloced as part of adding\r\n** the entry. Otherwise, zero.\r\n**\r\n** If an OOM error occurs, *pRc is set to SQLITE_NOMEM before returning.\r\n** Zero is always returned in this case. Otherwise, if no OOM error occurs,\r\n** it is set to SQLITE_OK.\r\n*/\r\nstatic int fts3PendingListAppend(\r\n  PendingList **pp,               /* IN/OUT: PendingList structure */\r\n  sqlite3_int64 iDocid,           /* Docid for entry to add */\r\n  sqlite3_int64 iCol,             /* Column for entry to add */\r\n  sqlite3_int64 iPos,             /* Position of term for entry to add */\r\n  int *pRc                        /* OUT: Return code */\r\n){\r\n  PendingList *p = *pp;\r\n  int rc = SQLITE_OK;\r\n\r\n  assert( !p || p->iLastDocid<=iDocid );\r\n\r\n  if( !p || p->iLastDocid!=iDocid ){\r\n    sqlite3_int64 iDelta = iDocid - (p ? p->iLastDocid : 0);\r\n    if( p ){\r\n      assert( p->nData<p->nSpace );\r\n      assert( p->aData[p->nData]==0 );\r\n      p->nData++;\r\n    }\r\n    if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iDelta)) ){\r\n      goto pendinglistappend_out;\r\n    }\r\n    p->iLastCol = -1;\r\n    p->iLastPos = 0;\r\n    p->iLastDocid = iDocid;\r\n  }\r\n  if( iCol>0 && p->iLastCol!=iCol ){\r\n    if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, 1))\r\n     || SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iCol))\r\n    ){\r\n      goto pendinglistappend_out;\r\n    }\r\n    p->iLastCol = iCol;\r\n    p->iLastPos = 0;\r\n  }\r\n  if( iCol>=0 ){\r\n    assert( iPos>p->iLastPos || (iPos==0 && p->iLastPos==0) );\r\n    rc = fts3PendingListAppendVarint(&p, 2+iPos-p->iLastPos);\r\n    if( rc==SQLITE_OK ){\r\n      p->iLastPos = iPos;\r\n    }\r\n  }\r\n\r\n pendinglistappend_out:\r\n  *pRc = rc;\r\n  if( p!=*pp ){\r\n    *pp = p;\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Free a PendingList object allocated by fts3PendingListAppend().\r\n*/\r\nstatic void fts3PendingListDelete(PendingList *pList){\r\n  sqlite3_free(pList);\r\n}\r\n\r\n/*\r\n** Add an entry to one of the pending-terms hash tables.\r\n*/\r\nstatic int fts3PendingTermsAddOne(\r\n  Fts3Table *p,\r\n  int iCol,\r\n  int iPos,\r\n  Fts3Hash *pHash,                /* Pending terms hash table to add entry to */\r\n  const char *zToken,\r\n  int nToken\r\n){\r\n  PendingList *pList;\r\n  int rc = SQLITE_OK;\r\n\r\n  pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);\r\n  if( pList ){\r\n    p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem));\r\n  }\r\n  if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){\r\n    if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){\r\n      /* Malloc failed while inserting the new entry. This can only \r\n      ** happen if there was no previous entry for this token.\r\n      */\r\n      assert( 0==fts3HashFind(pHash, zToken, nToken) );\r\n      sqlite3_free(pList);\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem));\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Tokenize the nul-terminated string zText and add all tokens to the\r\n** pending-terms hash-table. The docid used is that currently stored in\r\n** p->iPrevDocid, and the column is specified by argument iCol.\r\n**\r\n** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code.\r\n*/\r\nstatic int fts3PendingTermsAdd(\r\n  Fts3Table *p,                   /* Table into which text will be inserted */\r\n  int iLangid,                    /* Language id to use */\r\n  const char *zText,              /* Text of document to be inserted */\r\n  int iCol,                       /* Column into which text is being inserted */\r\n  u32 *pnWord                     /* OUT: Number of tokens inserted */\r\n){\r\n  int rc;\r\n  int iStart;\r\n  int iEnd;\r\n  int iPos;\r\n  int nWord = 0;\r\n\r\n  char const *zToken;\r\n  int nToken;\r\n\r\n  sqlite3_tokenizer *pTokenizer = p->pTokenizer;\r\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\r\n  sqlite3_tokenizer_cursor *pCsr;\r\n  int (*xNext)(sqlite3_tokenizer_cursor *pCursor,\r\n      const char**,int*,int*,int*,int*);\r\n\r\n  assert( pTokenizer && pModule );\r\n\r\n  /* If the user has inserted a NULL value, this function may be called with\r\n  ** zText==0. In this case, add zero token entries to the hash table and \r\n  ** return early. */\r\n  if( zText==0 ){\r\n    *pnWord = 0;\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  rc = sqlite3Fts3OpenTokenizer(pTokenizer, iLangid, zText, -1, &pCsr);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  xNext = pModule->xNext;\r\n  while( SQLITE_OK==rc\r\n      && SQLITE_OK==(rc = xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos))\r\n  ){\r\n    int i;\r\n    if( iPos>=nWord ) nWord = iPos+1;\r\n\r\n    /* Positions cannot be negative; we use -1 as a terminator internally.\r\n    ** Tokens must have a non-zero length.\r\n    */\r\n    if( iPos<0 || !zToken || nToken<=0 ){\r\n      rc = SQLITE_ERROR;\r\n      break;\r\n    }\r\n\r\n    /* Add the term to the terms index */\r\n    rc = fts3PendingTermsAddOne(\r\n        p, iCol, iPos, &p->aIndex[0].hPending, zToken, nToken\r\n    );\r\n    \r\n    /* Add the term to each of the prefix indexes that it is not too \r\n    ** short for. */\r\n    for(i=1; rc==SQLITE_OK && i<p->nIndex; i++){\r\n      struct Fts3Index *pIndex = &p->aIndex[i];\r\n      if( nToken<pIndex->nPrefix ) continue;\r\n      rc = fts3PendingTermsAddOne(\r\n          p, iCol, iPos, &pIndex->hPending, zToken, pIndex->nPrefix\r\n      );\r\n    }\r\n  }\r\n\r\n  pModule->xClose(pCsr);\r\n  *pnWord = nWord;\r\n  return (rc==SQLITE_DONE ? SQLITE_OK : rc);\r\n}\r\n\r\n/* \r\n** Calling this function indicates that subsequent calls to \r\n** fts3PendingTermsAdd() are to add term/position-list pairs for the\r\n** contents of the document with docid iDocid.\r\n*/\r\nstatic int fts3PendingTermsDocid(\r\n  Fts3Table *p,                   /* Full-text table handle */\r\n  int iLangid,                    /* Language id of row being written */\r\n  sqlite_int64 iDocid             /* Docid of row being written */\r\n){\r\n  assert( iLangid>=0 );\r\n\r\n  /* TODO(shess) Explore whether partially flushing the buffer on\r\n  ** forced-flush would provide better performance.  I suspect that if\r\n  ** we ordered the doclists by size and flushed the largest until the\r\n  ** buffer was half empty, that would let the less frequent terms\r\n  ** generate longer doclists.\r\n  */\r\n  if( iDocid<=p->iPrevDocid \r\n   || p->iPrevLangid!=iLangid\r\n   || p->nPendingData>p->nMaxPendingData \r\n  ){\r\n    int rc = sqlite3Fts3PendingTermsFlush(p);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n  p->iPrevDocid = iDocid;\r\n  p->iPrevLangid = iLangid;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Discard the contents of the pending-terms hash tables. \r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *p){\r\n  int i;\r\n  for(i=0; i<p->nIndex; i++){\r\n    Fts3HashElem *pElem;\r\n    Fts3Hash *pHash = &p->aIndex[i].hPending;\r\n    for(pElem=fts3HashFirst(pHash); pElem; pElem=fts3HashNext(pElem)){\r\n      PendingList *pList = (PendingList *)fts3HashData(pElem);\r\n      fts3PendingListDelete(pList);\r\n    }\r\n    fts3HashClear(pHash);\r\n  }\r\n  p->nPendingData = 0;\r\n}\r\n\r\n/*\r\n** This function is called by the xUpdate() method as part of an INSERT\r\n** operation. It adds entries for each term in the new record to the\r\n** pendingTerms hash table.\r\n**\r\n** Argument apVal is the same as the similarly named argument passed to\r\n** fts3InsertData(). Parameter iDocid is the docid of the new row.\r\n*/\r\nstatic int fts3InsertTerms(\r\n  Fts3Table *p, \r\n  int iLangid, \r\n  sqlite3_value **apVal, \r\n  u32 *aSz\r\n){\r\n  int i;                          /* Iterator variable */\r\n  for(i=2; i<p->nColumn+2; i++){\r\n    const char *zText = (const char *)sqlite3_value_text(apVal[i]);\r\n    int rc = fts3PendingTermsAdd(p, iLangid, zText, i-2, &aSz[i-2]);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n    aSz[p->nColumn] += sqlite3_value_bytes(apVal[i]);\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is called by the xUpdate() method for an INSERT operation.\r\n** The apVal parameter is passed a copy of the apVal argument passed by\r\n** SQLite to the xUpdate() method. i.e:\r\n**\r\n**   apVal[0]                Not used for INSERT.\r\n**   apVal[1]                rowid\r\n**   apVal[2]                Left-most user-defined column\r\n**   ...\r\n**   apVal[p->nColumn+1]     Right-most user-defined column\r\n**   apVal[p->nColumn+2]     Hidden column with same name as table\r\n**   apVal[p->nColumn+3]     Hidden \"docid\" column (alias for rowid)\r\n**   apVal[p->nColumn+4]     Hidden languageid column\r\n*/\r\nstatic int fts3InsertData(\r\n  Fts3Table *p,                   /* Full-text table */\r\n  sqlite3_value **apVal,          /* Array of values to insert */\r\n  sqlite3_int64 *piDocid          /* OUT: Docid for row just inserted */\r\n){\r\n  int rc;                         /* Return code */\r\n  sqlite3_stmt *pContentInsert;   /* INSERT INTO %_content VALUES(...) */\r\n\r\n  if( p->zContentTbl ){\r\n    sqlite3_value *pRowid = apVal[p->nColumn+3];\r\n    if( sqlite3_value_type(pRowid)==SQLITE_NULL ){\r\n      pRowid = apVal[1];\r\n    }\r\n    if( sqlite3_value_type(pRowid)!=SQLITE_INTEGER ){\r\n      return SQLITE_CONSTRAINT;\r\n    }\r\n    *piDocid = sqlite3_value_int64(pRowid);\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  /* Locate the statement handle used to insert data into the %_content\r\n  ** table. The SQL for this statement is:\r\n  **\r\n  **   INSERT INTO %_content VALUES(?, ?, ?, ...)\r\n  **\r\n  ** The statement features N '?' variables, where N is the number of user\r\n  ** defined columns in the FTS3 table, plus one for the docid field.\r\n  */\r\n  rc = fts3SqlStmt(p, SQL_CONTENT_INSERT, &pContentInsert, &apVal[1]);\r\n  if( rc==SQLITE_OK && p->zLanguageid ){\r\n    rc = sqlite3_bind_int(\r\n        pContentInsert, p->nColumn+2, \r\n        sqlite3_value_int(apVal[p->nColumn+4])\r\n    );\r\n  }\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  /* There is a quirk here. The users INSERT statement may have specified\r\n  ** a value for the \"rowid\" field, for the \"docid\" field, or for both.\r\n  ** Which is a problem, since \"rowid\" and \"docid\" are aliases for the\r\n  ** same value. For example:\r\n  **\r\n  **   INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);\r\n  **\r\n  ** In FTS3, this is an error. It is an error to specify non-NULL values\r\n  ** for both docid and some other rowid alias.\r\n  */\r\n  if( SQLITE_NULL!=sqlite3_value_type(apVal[3+p->nColumn]) ){\r\n    if( SQLITE_NULL==sqlite3_value_type(apVal[0])\r\n     && SQLITE_NULL!=sqlite3_value_type(apVal[1])\r\n    ){\r\n      /* A rowid/docid conflict. */\r\n      return SQLITE_ERROR;\r\n    }\r\n    rc = sqlite3_bind_value(pContentInsert, 1, apVal[3+p->nColumn]);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n\r\n  /* Execute the statement to insert the record. Set *piDocid to the \r\n  ** new docid value. \r\n  */\r\n  sqlite3_step(pContentInsert);\r\n  rc = sqlite3_reset(pContentInsert);\r\n\r\n  *piDocid = sqlite3_last_insert_rowid(p->db);\r\n  return rc;\r\n}\r\n\r\n\r\n\r\n/*\r\n** Remove all data from the FTS3 table. Clear the hash table containing\r\n** pending terms.\r\n*/\r\nstatic int fts3DeleteAll(Fts3Table *p, int bContent){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n\r\n  /* Discard the contents of the pending-terms hash table. */\r\n  sqlite3Fts3PendingTermsClear(p);\r\n\r\n  /* Delete everything from the shadow tables. Except, leave %_content as\r\n  ** is if bContent is false.  */\r\n  assert( p->zContentTbl==0 || bContent==0 );\r\n  if( bContent ) fts3SqlExec(&rc, p, SQL_DELETE_ALL_CONTENT, 0);\r\n  fts3SqlExec(&rc, p, SQL_DELETE_ALL_SEGMENTS, 0);\r\n  fts3SqlExec(&rc, p, SQL_DELETE_ALL_SEGDIR, 0);\r\n  if( p->bHasDocsize ){\r\n    fts3SqlExec(&rc, p, SQL_DELETE_ALL_DOCSIZE, 0);\r\n  }\r\n  if( p->bHasStat ){\r\n    fts3SqlExec(&rc, p, SQL_DELETE_ALL_STAT, 0);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n**\r\n*/\r\nstatic int langidFromSelect(Fts3Table *p, sqlite3_stmt *pSelect){\r\n  int iLangid = 0;\r\n  if( p->zLanguageid ) iLangid = sqlite3_column_int(pSelect, p->nColumn+1);\r\n  return iLangid;\r\n}\r\n\r\n/*\r\n** The first element in the apVal[] array is assumed to contain the docid\r\n** (an integer) of a row about to be deleted. Remove all terms from the\r\n** full-text index.\r\n*/\r\nstatic void fts3DeleteTerms( \r\n  int *pRC,               /* Result code */\r\n  Fts3Table *p,           /* The FTS table to delete from */\r\n  sqlite3_value *pRowid,  /* The docid to be deleted */\r\n  u32 *aSz                /* Sizes of deleted document written here */\r\n){\r\n  int rc;\r\n  sqlite3_stmt *pSelect;\r\n\r\n  if( *pRC ) return;\r\n  rc = fts3SqlStmt(p, SQL_SELECT_CONTENT_BY_ROWID, &pSelect, &pRowid);\r\n  if( rc==SQLITE_OK ){\r\n    if( SQLITE_ROW==sqlite3_step(pSelect) ){\r\n      int i;\r\n      int iLangid = langidFromSelect(p, pSelect);\r\n      rc = fts3PendingTermsDocid(p, iLangid, sqlite3_column_int64(pSelect, 0));\r\n      for(i=1; rc==SQLITE_OK && i<=p->nColumn; i++){\r\n        const char *zText = (const char *)sqlite3_column_text(pSelect, i);\r\n        rc = fts3PendingTermsAdd(p, iLangid, zText, -1, &aSz[i-1]);\r\n        aSz[p->nColumn] += sqlite3_column_bytes(pSelect, i);\r\n      }\r\n      if( rc!=SQLITE_OK ){\r\n        sqlite3_reset(pSelect);\r\n        *pRC = rc;\r\n        return;\r\n      }\r\n    }\r\n    rc = sqlite3_reset(pSelect);\r\n  }else{\r\n    sqlite3_reset(pSelect);\r\n  }\r\n  *pRC = rc;\r\n}\r\n\r\n/*\r\n** Forward declaration to account for the circular dependency between\r\n** functions fts3SegmentMerge() and fts3AllocateSegdirIdx().\r\n*/\r\nstatic int fts3SegmentMerge(Fts3Table *, int, int, int);\r\n\r\n/* \r\n** This function allocates a new level iLevel index in the segdir table.\r\n** Usually, indexes are allocated within a level sequentially starting\r\n** with 0, so the allocated index is one greater than the value returned\r\n** by:\r\n**\r\n**   SELECT max(idx) FROM %_segdir WHERE level = :iLevel\r\n**\r\n** However, if there are already FTS3_MERGE_COUNT indexes at the requested\r\n** level, they are merged into a single level (iLevel+1) segment and the \r\n** allocated index is 0.\r\n**\r\n** If successful, *piIdx is set to the allocated index slot and SQLITE_OK\r\n** returned. Otherwise, an SQLite error code is returned.\r\n*/\r\nstatic int fts3AllocateSegdirIdx(\r\n  Fts3Table *p, \r\n  int iLangid,                    /* Language id */\r\n  int iIndex,                     /* Index for p->aIndex */\r\n  int iLevel, \r\n  int *piIdx\r\n){\r\n  int rc;                         /* Return Code */\r\n  sqlite3_stmt *pNextIdx;         /* Query for next idx at level iLevel */\r\n  int iNext = 0;                  /* Result of query pNextIdx */\r\n\r\n  assert( iLangid>=0 );\r\n  assert( p->nIndex>=1 );\r\n\r\n  /* Set variable iNext to the next available segdir index at level iLevel. */\r\n  rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_bind_int64(\r\n        pNextIdx, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel)\r\n    );\r\n    if( SQLITE_ROW==sqlite3_step(pNextIdx) ){\r\n      iNext = sqlite3_column_int(pNextIdx, 0);\r\n    }\r\n    rc = sqlite3_reset(pNextIdx);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    /* If iNext is FTS3_MERGE_COUNT, indicating that level iLevel is already\r\n    ** full, merge all segments in level iLevel into a single iLevel+1\r\n    ** segment and allocate (newly freed) index 0 at level iLevel. Otherwise,\r\n    ** if iNext is less than FTS3_MERGE_COUNT, allocate index iNext.\r\n    */\r\n    if( iNext>=FTS3_MERGE_COUNT ){\r\n      rc = fts3SegmentMerge(p, iLangid, iIndex, iLevel);\r\n      *piIdx = 0;\r\n    }else{\r\n      *piIdx = iNext;\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The %_segments table is declared as follows:\r\n**\r\n**   CREATE TABLE %_segments(blockid INTEGER PRIMARY KEY, block BLOB)\r\n**\r\n** This function reads data from a single row of the %_segments table. The\r\n** specific row is identified by the iBlockid parameter. If paBlob is not\r\n** NULL, then a buffer is allocated using sqlite3_malloc() and populated\r\n** with the contents of the blob stored in the \"block\" column of the \r\n** identified table row is. Whether or not paBlob is NULL, *pnBlob is set\r\n** to the size of the blob in bytes before returning.\r\n**\r\n** If an error occurs, or the table does not contain the specified row,\r\n** an SQLite error code is returned. Otherwise, SQLITE_OK is returned. If\r\n** paBlob is non-NULL, then it is the responsibility of the caller to\r\n** eventually free the returned buffer.\r\n**\r\n** This function may leave an open sqlite3_blob* handle in the\r\n** Fts3Table.pSegments variable. This handle is reused by subsequent calls\r\n** to this function. The handle may be closed by calling the\r\n** sqlite3Fts3SegmentsClose() function. Reusing a blob handle is a handy\r\n** performance improvement, but the blob handle should always be closed\r\n** before control is returned to the user (to prevent a lock being held\r\n** on the database file for longer than necessary). Thus, any virtual table\r\n** method (xFilter etc.) that may directly or indirectly call this function\r\n** must call sqlite3Fts3SegmentsClose() before returning.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3ReadBlock(\r\n  Fts3Table *p,                   /* FTS3 table handle */\r\n  sqlite3_int64 iBlockid,         /* Access the row with blockid=$iBlockid */\r\n  char **paBlob,                  /* OUT: Blob data in malloc'd buffer */\r\n  int *pnBlob,                    /* OUT: Size of blob data */\r\n  int *pnLoad                     /* OUT: Bytes actually loaded */\r\n){\r\n  int rc;                         /* Return code */\r\n\r\n  /* pnBlob must be non-NULL. paBlob may be NULL or non-NULL. */\r\n  assert( pnBlob);\r\n\r\n  if( p->pSegments ){\r\n    rc = sqlite3_blob_reopen(p->pSegments, iBlockid);\r\n  }else{\r\n    if( 0==p->zSegmentsTbl ){\r\n      p->zSegmentsTbl = sqlite3_mprintf(\"%s_segments\", p->zName);\r\n      if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM;\r\n    }\r\n    rc = sqlite3_blob_open(\r\n       p->db, p->zDb, p->zSegmentsTbl, \"block\", iBlockid, 0, &p->pSegments\r\n    );\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    int nByte = sqlite3_blob_bytes(p->pSegments);\r\n    *pnBlob = nByte;\r\n    if( paBlob ){\r\n      char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING);\r\n      if( !aByte ){\r\n        rc = SQLITE_NOMEM;\r\n      }else{\r\n        if( pnLoad && nByte>(FTS3_NODE_CHUNK_THRESHOLD) ){\r\n          nByte = FTS3_NODE_CHUNKSIZE;\r\n          *pnLoad = nByte;\r\n        }\r\n        rc = sqlite3_blob_read(p->pSegments, aByte, nByte, 0);\r\n        memset(&aByte[nByte], 0, FTS3_NODE_PADDING);\r\n        if( rc!=SQLITE_OK ){\r\n          sqlite3_free(aByte);\r\n          aByte = 0;\r\n        }\r\n      }\r\n      *paBlob = aByte;\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Close the blob handle at p->pSegments, if it is open. See comments above\r\n** the sqlite3Fts3ReadBlock() function for details.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *p){\r\n  sqlite3_blob_close(p->pSegments);\r\n  p->pSegments = 0;\r\n}\r\n    \r\nstatic int fts3SegReaderIncrRead(Fts3SegReader *pReader){\r\n  int nRead;                      /* Number of bytes to read */\r\n  int rc;                         /* Return code */\r\n\r\n  nRead = MIN(pReader->nNode - pReader->nPopulate, FTS3_NODE_CHUNKSIZE);\r\n  rc = sqlite3_blob_read(\r\n      pReader->pBlob, \r\n      &pReader->aNode[pReader->nPopulate],\r\n      nRead,\r\n      pReader->nPopulate\r\n  );\r\n\r\n  if( rc==SQLITE_OK ){\r\n    pReader->nPopulate += nRead;\r\n    memset(&pReader->aNode[pReader->nPopulate], 0, FTS3_NODE_PADDING);\r\n    if( pReader->nPopulate==pReader->nNode ){\r\n      sqlite3_blob_close(pReader->pBlob);\r\n      pReader->pBlob = 0;\r\n      pReader->nPopulate = 0;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\nstatic int fts3SegReaderRequire(Fts3SegReader *pReader, char *pFrom, int nByte){\r\n  int rc = SQLITE_OK;\r\n  assert( !pReader->pBlob \r\n       || (pFrom>=pReader->aNode && pFrom<&pReader->aNode[pReader->nNode])\r\n  );\r\n  while( pReader->pBlob && rc==SQLITE_OK \r\n     &&  (pFrom - pReader->aNode + nByte)>pReader->nPopulate\r\n  ){\r\n    rc = fts3SegReaderIncrRead(pReader);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set an Fts3SegReader cursor to point at EOF.\r\n*/\r\nstatic void fts3SegReaderSetEof(Fts3SegReader *pSeg){\r\n  if( !fts3SegReaderIsRootOnly(pSeg) ){\r\n    sqlite3_free(pSeg->aNode);\r\n    sqlite3_blob_close(pSeg->pBlob);\r\n    pSeg->pBlob = 0;\r\n  }\r\n  pSeg->aNode = 0;\r\n}\r\n\r\n/*\r\n** Move the iterator passed as the first argument to the next term in the\r\n** segment. If successful, SQLITE_OK is returned. If there is no next term,\r\n** SQLITE_DONE. Otherwise, an SQLite error code.\r\n*/\r\nstatic int fts3SegReaderNext(\r\n  Fts3Table *p, \r\n  Fts3SegReader *pReader,\r\n  int bIncr\r\n){\r\n  int rc;                         /* Return code of various sub-routines */\r\n  char *pNext;                    /* Cursor variable */\r\n  int nPrefix;                    /* Number of bytes in term prefix */\r\n  int nSuffix;                    /* Number of bytes in term suffix */\r\n\r\n  if( !pReader->aDoclist ){\r\n    pNext = pReader->aNode;\r\n  }else{\r\n    pNext = &pReader->aDoclist[pReader->nDoclist];\r\n  }\r\n\r\n  if( !pNext || pNext>=&pReader->aNode[pReader->nNode] ){\r\n\r\n    if( fts3SegReaderIsPending(pReader) ){\r\n      Fts3HashElem *pElem = *(pReader->ppNextElem);\r\n      if( pElem==0 ){\r\n        pReader->aNode = 0;\r\n      }else{\r\n        PendingList *pList = (PendingList *)fts3HashData(pElem);\r\n        pReader->zTerm = (char *)fts3HashKey(pElem);\r\n        pReader->nTerm = fts3HashKeysize(pElem);\r\n        pReader->nNode = pReader->nDoclist = pList->nData + 1;\r\n        pReader->aNode = pReader->aDoclist = pList->aData;\r\n        pReader->ppNextElem++;\r\n        assert( pReader->aNode );\r\n      }\r\n      return SQLITE_OK;\r\n    }\r\n\r\n    fts3SegReaderSetEof(pReader);\r\n\r\n    /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf \r\n    ** blocks have already been traversed.  */\r\n    assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );\r\n    if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){\r\n      return SQLITE_OK;\r\n    }\r\n\r\n    rc = sqlite3Fts3ReadBlock(\r\n        p, ++pReader->iCurrentBlock, &pReader->aNode, &pReader->nNode, \r\n        (bIncr ? &pReader->nPopulate : 0)\r\n    );\r\n    if( rc!=SQLITE_OK ) return rc;\r\n    assert( pReader->pBlob==0 );\r\n    if( bIncr && pReader->nPopulate<pReader->nNode ){\r\n      pReader->pBlob = p->pSegments;\r\n      p->pSegments = 0;\r\n    }\r\n    pNext = pReader->aNode;\r\n  }\r\n\r\n  assert( !fts3SegReaderIsPending(pReader) );\r\n\r\n  rc = fts3SegReaderRequire(pReader, pNext, FTS3_VARINT_MAX*2);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n  \r\n  /* Because of the FTS3_NODE_PADDING bytes of padding, the following is \r\n  ** safe (no risk of overread) even if the node data is corrupted. */\r\n  pNext += sqlite3Fts3GetVarint32(pNext, &nPrefix);\r\n  pNext += sqlite3Fts3GetVarint32(pNext, &nSuffix);\r\n  if( nPrefix<0 || nSuffix<=0 \r\n   || &pNext[nSuffix]>&pReader->aNode[pReader->nNode] \r\n  ){\r\n    return FTS_CORRUPT_VTAB;\r\n  }\r\n\r\n  if( nPrefix+nSuffix>pReader->nTermAlloc ){\r\n    int nNew = (nPrefix+nSuffix)*2;\r\n    char *zNew = sqlite3_realloc(pReader->zTerm, nNew);\r\n    if( !zNew ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    pReader->zTerm = zNew;\r\n    pReader->nTermAlloc = nNew;\r\n  }\r\n\r\n  rc = fts3SegReaderRequire(pReader, pNext, nSuffix+FTS3_VARINT_MAX);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  memcpy(&pReader->zTerm[nPrefix], pNext, nSuffix);\r\n  pReader->nTerm = nPrefix+nSuffix;\r\n  pNext += nSuffix;\r\n  pNext += sqlite3Fts3GetVarint32(pNext, &pReader->nDoclist);\r\n  pReader->aDoclist = pNext;\r\n  pReader->pOffsetList = 0;\r\n\r\n  /* Check that the doclist does not appear to extend past the end of the\r\n  ** b-tree node. And that the final byte of the doclist is 0x00. If either \r\n  ** of these statements is untrue, then the data structure is corrupt.\r\n  */\r\n  if( &pReader->aDoclist[pReader->nDoclist]>&pReader->aNode[pReader->nNode] \r\n   || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])\r\n  ){\r\n    return FTS_CORRUPT_VTAB;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Set the SegReader to point to the first docid in the doclist associated\r\n** with the current term.\r\n*/\r\nstatic int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){\r\n  int rc = SQLITE_OK;\r\n  assert( pReader->aDoclist );\r\n  assert( !pReader->pOffsetList );\r\n  if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){\r\n    u8 bEof = 0;\r\n    pReader->iDocid = 0;\r\n    pReader->nOffsetList = 0;\r\n    sqlite3Fts3DoclistPrev(0,\r\n        pReader->aDoclist, pReader->nDoclist, &pReader->pOffsetList, \r\n        &pReader->iDocid, &pReader->nOffsetList, &bEof\r\n    );\r\n  }else{\r\n    rc = fts3SegReaderRequire(pReader, pReader->aDoclist, FTS3_VARINT_MAX);\r\n    if( rc==SQLITE_OK ){\r\n      int n = sqlite3Fts3GetVarint(pReader->aDoclist, &pReader->iDocid);\r\n      pReader->pOffsetList = &pReader->aDoclist[n];\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Advance the SegReader to point to the next docid in the doclist\r\n** associated with the current term.\r\n** \r\n** If arguments ppOffsetList and pnOffsetList are not NULL, then \r\n** *ppOffsetList is set to point to the first column-offset list\r\n** in the doclist entry (i.e. immediately past the docid varint).\r\n** *pnOffsetList is set to the length of the set of column-offset\r\n** lists, not including the nul-terminator byte. For example:\r\n*/\r\nstatic int fts3SegReaderNextDocid(\r\n  Fts3Table *pTab,\r\n  Fts3SegReader *pReader,         /* Reader to advance to next docid */\r\n  char **ppOffsetList,            /* OUT: Pointer to current position-list */\r\n  int *pnOffsetList               /* OUT: Length of *ppOffsetList in bytes */\r\n){\r\n  int rc = SQLITE_OK;\r\n  char *p = pReader->pOffsetList;\r\n  char c = 0;\r\n\r\n  assert( p );\r\n\r\n  if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){\r\n    /* A pending-terms seg-reader for an FTS4 table that uses order=desc.\r\n    ** Pending-terms doclists are always built up in ascending order, so\r\n    ** we have to iterate through them backwards here. */\r\n    u8 bEof = 0;\r\n    if( ppOffsetList ){\r\n      *ppOffsetList = pReader->pOffsetList;\r\n      *pnOffsetList = pReader->nOffsetList - 1;\r\n    }\r\n    sqlite3Fts3DoclistPrev(0,\r\n        pReader->aDoclist, pReader->nDoclist, &p, &pReader->iDocid,\r\n        &pReader->nOffsetList, &bEof\r\n    );\r\n    if( bEof ){\r\n      pReader->pOffsetList = 0;\r\n    }else{\r\n      pReader->pOffsetList = p;\r\n    }\r\n  }else{\r\n    char *pEnd = &pReader->aDoclist[pReader->nDoclist];\r\n\r\n    /* Pointer p currently points at the first byte of an offset list. The\r\n    ** following block advances it to point one byte past the end of\r\n    ** the same offset list. */\r\n    while( 1 ){\r\n  \r\n      /* The following line of code (and the \"p++\" below the while() loop) is\r\n      ** normally all that is required to move pointer p to the desired \r\n      ** position. The exception is if this node is being loaded from disk\r\n      ** incrementally and pointer \"p\" now points to the first byte passed\r\n      ** the populated part of pReader->aNode[].\r\n      */\r\n      while( *p | c ) c = *p++ & 0x80;\r\n      assert( *p==0 );\r\n  \r\n      if( pReader->pBlob==0 || p<&pReader->aNode[pReader->nPopulate] ) break;\r\n      rc = fts3SegReaderIncrRead(pReader);\r\n      if( rc!=SQLITE_OK ) return rc;\r\n    }\r\n    p++;\r\n  \r\n    /* If required, populate the output variables with a pointer to and the\r\n    ** size of the previous offset-list.\r\n    */\r\n    if( ppOffsetList ){\r\n      *ppOffsetList = pReader->pOffsetList;\r\n      *pnOffsetList = (int)(p - pReader->pOffsetList - 1);\r\n    }\r\n\r\n    while( p<pEnd && *p==0 ) p++;\r\n  \r\n    /* If there are no more entries in the doclist, set pOffsetList to\r\n    ** NULL. Otherwise, set Fts3SegReader.iDocid to the next docid and\r\n    ** Fts3SegReader.pOffsetList to point to the next offset list before\r\n    ** returning.\r\n    */\r\n    if( p>=pEnd ){\r\n      pReader->pOffsetList = 0;\r\n    }else{\r\n      rc = fts3SegReaderRequire(pReader, p, FTS3_VARINT_MAX);\r\n      if( rc==SQLITE_OK ){\r\n        sqlite3_int64 iDelta;\r\n        pReader->pOffsetList = p + sqlite3Fts3GetVarint(p, &iDelta);\r\n        if( pTab->bDescIdx ){\r\n          pReader->iDocid -= iDelta;\r\n        }else{\r\n          pReader->iDocid += iDelta;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3MsrOvfl(\r\n  Fts3Cursor *pCsr, \r\n  Fts3MultiSegReader *pMsr,\r\n  int *pnOvfl\r\n){\r\n  Fts3Table *p = (Fts3Table*)pCsr->base.pVtab;\r\n  int nOvfl = 0;\r\n  int ii;\r\n  int rc = SQLITE_OK;\r\n  int pgsz = p->nPgsz;\r\n\r\n  assert( p->bHasStat );\r\n  assert( pgsz>0 );\r\n\r\n  for(ii=0; rc==SQLITE_OK && ii<pMsr->nSegment; ii++){\r\n    Fts3SegReader *pReader = pMsr->apSegment[ii];\r\n    if( !fts3SegReaderIsPending(pReader) \r\n     && !fts3SegReaderIsRootOnly(pReader) \r\n    ){\r\n      sqlite3_int64 jj;\r\n      for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){\r\n        int nBlob;\r\n        rc = sqlite3Fts3ReadBlock(p, jj, 0, &nBlob, 0);\r\n        if( rc!=SQLITE_OK ) break;\r\n        if( (nBlob+35)>pgsz ){\r\n          nOvfl += (nBlob + 34)/pgsz;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  *pnOvfl = nOvfl;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Free all allocations associated with the iterator passed as the \r\n** second argument.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *pReader){\r\n  if( pReader && !fts3SegReaderIsPending(pReader) ){\r\n    sqlite3_free(pReader->zTerm);\r\n    if( !fts3SegReaderIsRootOnly(pReader) ){\r\n      sqlite3_free(pReader->aNode);\r\n      sqlite3_blob_close(pReader->pBlob);\r\n    }\r\n  }\r\n  sqlite3_free(pReader);\r\n}\r\n\r\n/*\r\n** Allocate a new SegReader object.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderNew(\r\n  int iAge,                       /* Segment \"age\". */\r\n  int bLookup,                    /* True for a lookup only */\r\n  sqlite3_int64 iStartLeaf,       /* First leaf to traverse */\r\n  sqlite3_int64 iEndLeaf,         /* Final leaf to traverse */\r\n  sqlite3_int64 iEndBlock,        /* Final block of segment */\r\n  const char *zRoot,              /* Buffer containing root node */\r\n  int nRoot,                      /* Size of buffer containing root node */\r\n  Fts3SegReader **ppReader        /* OUT: Allocated Fts3SegReader */\r\n){\r\n  Fts3SegReader *pReader;         /* Newly allocated SegReader object */\r\n  int nExtra = 0;                 /* Bytes to allocate segment root node */\r\n\r\n  assert( iStartLeaf<=iEndLeaf );\r\n  if( iStartLeaf==0 ){\r\n    nExtra = nRoot + FTS3_NODE_PADDING;\r\n  }\r\n\r\n  pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);\r\n  if( !pReader ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pReader, 0, sizeof(Fts3SegReader));\r\n  pReader->iIdx = iAge;\r\n  pReader->bLookup = bLookup;\r\n  pReader->iStartBlock = iStartLeaf;\r\n  pReader->iLeafEndBlock = iEndLeaf;\r\n  pReader->iEndBlock = iEndBlock;\r\n\r\n  if( nExtra ){\r\n    /* The entire segment is stored in the root node. */\r\n    pReader->aNode = (char *)&pReader[1];\r\n    pReader->nNode = nRoot;\r\n    memcpy(pReader->aNode, zRoot, nRoot);\r\n    memset(&pReader->aNode[nRoot], 0, FTS3_NODE_PADDING);\r\n  }else{\r\n    pReader->iCurrentBlock = iStartLeaf-1;\r\n  }\r\n  *ppReader = pReader;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This is a comparison function used as a qsort() callback when sorting\r\n** an array of pending terms by term. This occurs as part of flushing\r\n** the contents of the pending-terms hash table to the database.\r\n*/\r\nstatic int fts3CompareElemByTerm(const void *lhs, const void *rhs){\r\n  char *z1 = fts3HashKey(*(Fts3HashElem **)lhs);\r\n  char *z2 = fts3HashKey(*(Fts3HashElem **)rhs);\r\n  int n1 = fts3HashKeysize(*(Fts3HashElem **)lhs);\r\n  int n2 = fts3HashKeysize(*(Fts3HashElem **)rhs);\r\n\r\n  int n = (n1<n2 ? n1 : n2);\r\n  int c = memcmp(z1, z2, n);\r\n  if( c==0 ){\r\n    c = n1 - n2;\r\n  }\r\n  return c;\r\n}\r\n\r\n/*\r\n** This function is used to allocate an Fts3SegReader that iterates through\r\n** a subset of the terms stored in the Fts3Table.pendingTerms array.\r\n**\r\n** If the isPrefixIter parameter is zero, then the returned SegReader iterates\r\n** through each term in the pending-terms table. Or, if isPrefixIter is\r\n** non-zero, it iterates through each term and its prefixes. For example, if\r\n** the pending terms hash table contains the terms \"sqlite\", \"mysql\" and\r\n** \"firebird\", then the iterator visits the following 'terms' (in the order\r\n** shown):\r\n**\r\n**   f fi fir fire fireb firebi firebir firebird\r\n**   m my mys mysq mysql\r\n**   s sq sql sqli sqlit sqlite\r\n**\r\n** Whereas if isPrefixIter is zero, the terms visited are:\r\n**\r\n**   firebird mysql sqlite\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderPending(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  int iIndex,                     /* Index for p->aIndex */\r\n  const char *zTerm,              /* Term to search for */\r\n  int nTerm,                      /* Size of buffer zTerm */\r\n  int bPrefix,                    /* True for a prefix iterator */\r\n  Fts3SegReader **ppReader        /* OUT: SegReader for pending-terms */\r\n){\r\n  Fts3SegReader *pReader = 0;     /* Fts3SegReader object to return */\r\n  Fts3HashElem *pE;               /* Iterator variable */\r\n  Fts3HashElem **aElem = 0;       /* Array of term hash entries to scan */\r\n  int nElem = 0;                  /* Size of array at aElem */\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n  Fts3Hash *pHash;\r\n\r\n  pHash = &p->aIndex[iIndex].hPending;\r\n  if( bPrefix ){\r\n    int nAlloc = 0;               /* Size of allocated array at aElem */\r\n\r\n    for(pE=fts3HashFirst(pHash); pE; pE=fts3HashNext(pE)){\r\n      char *zKey = (char *)fts3HashKey(pE);\r\n      int nKey = fts3HashKeysize(pE);\r\n      if( nTerm==0 || (nKey>=nTerm && 0==memcmp(zKey, zTerm, nTerm)) ){\r\n        if( nElem==nAlloc ){\r\n          Fts3HashElem **aElem2;\r\n          nAlloc += 16;\r\n          aElem2 = (Fts3HashElem **)sqlite3_realloc(\r\n              aElem, nAlloc*sizeof(Fts3HashElem *)\r\n          );\r\n          if( !aElem2 ){\r\n            rc = SQLITE_NOMEM;\r\n            nElem = 0;\r\n            break;\r\n          }\r\n          aElem = aElem2;\r\n        }\r\n\r\n        aElem[nElem++] = pE;\r\n      }\r\n    }\r\n\r\n    /* If more than one term matches the prefix, sort the Fts3HashElem\r\n    ** objects in term order using qsort(). This uses the same comparison\r\n    ** callback as is used when flushing terms to disk.\r\n    */\r\n    if( nElem>1 ){\r\n      qsort(aElem, nElem, sizeof(Fts3HashElem *), fts3CompareElemByTerm);\r\n    }\r\n\r\n  }else{\r\n    /* The query is a simple term lookup that matches at most one term in\r\n    ** the index. All that is required is a straight hash-lookup. \r\n    **\r\n    ** Because the stack address of pE may be accessed via the aElem pointer\r\n    ** below, the \"Fts3HashElem *pE\" must be declared so that it is valid\r\n    ** within this entire function, not just this \"else{...}\" block.\r\n    */\r\n    pE = fts3HashFindElem(pHash, zTerm, nTerm);\r\n    if( pE ){\r\n      aElem = &pE;\r\n      nElem = 1;\r\n    }\r\n  }\r\n\r\n  if( nElem>0 ){\r\n    int nByte = sizeof(Fts3SegReader) + (nElem+1)*sizeof(Fts3HashElem *);\r\n    pReader = (Fts3SegReader *)sqlite3_malloc(nByte);\r\n    if( !pReader ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      memset(pReader, 0, nByte);\r\n      pReader->iIdx = 0x7FFFFFFF;\r\n      pReader->ppNextElem = (Fts3HashElem **)&pReader[1];\r\n      memcpy(pReader->ppNextElem, aElem, nElem*sizeof(Fts3HashElem *));\r\n    }\r\n  }\r\n\r\n  if( bPrefix ){\r\n    sqlite3_free(aElem);\r\n  }\r\n  *ppReader = pReader;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Compare the entries pointed to by two Fts3SegReader structures. \r\n** Comparison is as follows:\r\n**\r\n**   1) EOF is greater than not EOF.\r\n**\r\n**   2) The current terms (if any) are compared using memcmp(). If one\r\n**      term is a prefix of another, the longer term is considered the\r\n**      larger.\r\n**\r\n**   3) By segment age. An older segment is considered larger.\r\n*/\r\nstatic int fts3SegReaderCmp(Fts3SegReader *pLhs, Fts3SegReader *pRhs){\r\n  int rc;\r\n  if( pLhs->aNode && pRhs->aNode ){\r\n    int rc2 = pLhs->nTerm - pRhs->nTerm;\r\n    if( rc2<0 ){\r\n      rc = memcmp(pLhs->zTerm, pRhs->zTerm, pLhs->nTerm);\r\n    }else{\r\n      rc = memcmp(pLhs->zTerm, pRhs->zTerm, pRhs->nTerm);\r\n    }\r\n    if( rc==0 ){\r\n      rc = rc2;\r\n    }\r\n  }else{\r\n    rc = (pLhs->aNode==0) - (pRhs->aNode==0);\r\n  }\r\n  if( rc==0 ){\r\n    rc = pRhs->iIdx - pLhs->iIdx;\r\n  }\r\n  assert( rc!=0 );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** A different comparison function for SegReader structures. In this\r\n** version, it is assumed that each SegReader points to an entry in\r\n** a doclist for identical terms. Comparison is made as follows:\r\n**\r\n**   1) EOF (end of doclist in this case) is greater than not EOF.\r\n**\r\n**   2) By current docid.\r\n**\r\n**   3) By segment age. An older segment is considered larger.\r\n*/\r\nstatic int fts3SegReaderDoclistCmp(Fts3SegReader *pLhs, Fts3SegReader *pRhs){\r\n  int rc = (pLhs->pOffsetList==0)-(pRhs->pOffsetList==0);\r\n  if( rc==0 ){\r\n    if( pLhs->iDocid==pRhs->iDocid ){\r\n      rc = pRhs->iIdx - pLhs->iIdx;\r\n    }else{\r\n      rc = (pLhs->iDocid > pRhs->iDocid) ? 1 : -1;\r\n    }\r\n  }\r\n  assert( pLhs->aNode && pRhs->aNode );\r\n  return rc;\r\n}\r\nstatic int fts3SegReaderDoclistCmpRev(Fts3SegReader *pLhs, Fts3SegReader *pRhs){\r\n  int rc = (pLhs->pOffsetList==0)-(pRhs->pOffsetList==0);\r\n  if( rc==0 ){\r\n    if( pLhs->iDocid==pRhs->iDocid ){\r\n      rc = pRhs->iIdx - pLhs->iIdx;\r\n    }else{\r\n      rc = (pLhs->iDocid < pRhs->iDocid) ? 1 : -1;\r\n    }\r\n  }\r\n  assert( pLhs->aNode && pRhs->aNode );\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Compare the term that the Fts3SegReader object passed as the first argument\r\n** points to with the term specified by arguments zTerm and nTerm. \r\n**\r\n** If the pSeg iterator is already at EOF, return 0. Otherwise, return\r\n** -ve if the pSeg term is less than zTerm/nTerm, 0 if the two terms are\r\n** equal, or +ve if the pSeg term is greater than zTerm/nTerm.\r\n*/\r\nstatic int fts3SegReaderTermCmp(\r\n  Fts3SegReader *pSeg,            /* Segment reader object */\r\n  const char *zTerm,              /* Term to compare to */\r\n  int nTerm                       /* Size of term zTerm in bytes */\r\n){\r\n  int res = 0;\r\n  if( pSeg->aNode ){\r\n    if( pSeg->nTerm>nTerm ){\r\n      res = memcmp(pSeg->zTerm, zTerm, nTerm);\r\n    }else{\r\n      res = memcmp(pSeg->zTerm, zTerm, pSeg->nTerm);\r\n    }\r\n    if( res==0 ){\r\n      res = pSeg->nTerm-nTerm;\r\n    }\r\n  }\r\n  return res;\r\n}\r\n\r\n/*\r\n** Argument apSegment is an array of nSegment elements. It is known that\r\n** the final (nSegment-nSuspect) members are already in sorted order\r\n** (according to the comparison function provided). This function shuffles\r\n** the array around until all entries are in sorted order.\r\n*/\r\nstatic void fts3SegReaderSort(\r\n  Fts3SegReader **apSegment,                     /* Array to sort entries of */\r\n  int nSegment,                                  /* Size of apSegment array */\r\n  int nSuspect,                                  /* Unsorted entry count */\r\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *)  /* Comparison function */\r\n){\r\n  int i;                          /* Iterator variable */\r\n\r\n  assert( nSuspect<=nSegment );\r\n\r\n  if( nSuspect==nSegment ) nSuspect--;\r\n  for(i=nSuspect-1; i>=0; i--){\r\n    int j;\r\n    for(j=i; j<(nSegment-1); j++){\r\n      Fts3SegReader *pTmp;\r\n      if( xCmp(apSegment[j], apSegment[j+1])<0 ) break;\r\n      pTmp = apSegment[j+1];\r\n      apSegment[j+1] = apSegment[j];\r\n      apSegment[j] = pTmp;\r\n    }\r\n  }\r\n\r\n#ifndef NDEBUG\r\n  /* Check that the list really is sorted now. */\r\n  for(i=0; i<(nSuspect-1); i++){\r\n    assert( xCmp(apSegment[i], apSegment[i+1])<0 );\r\n  }\r\n#endif\r\n}\r\n\r\n/* \r\n** Insert a record into the %_segments table.\r\n*/\r\nstatic int fts3WriteSegment(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  sqlite3_int64 iBlock,           /* Block id for new block */\r\n  char *z,                        /* Pointer to buffer containing block data */\r\n  int n                           /* Size of buffer z in bytes */\r\n){\r\n  sqlite3_stmt *pStmt;\r\n  int rc = fts3SqlStmt(p, SQL_INSERT_SEGMENTS, &pStmt, 0);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_bind_int64(pStmt, 1, iBlock);\r\n    sqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC);\r\n    sqlite3_step(pStmt);\r\n    rc = sqlite3_reset(pStmt);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Insert a record into the %_segdir table.\r\n*/\r\nstatic int fts3WriteSegdir(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  sqlite3_int64 iLevel,           /* Value for \"level\" field (absolute level) */\r\n  int iIdx,                       /* Value for \"idx\" field */\r\n  sqlite3_int64 iStartBlock,      /* Value for \"start_block\" field */\r\n  sqlite3_int64 iLeafEndBlock,    /* Value for \"leaves_end_block\" field */\r\n  sqlite3_int64 iEndBlock,        /* Value for \"end_block\" field */\r\n  char *zRoot,                    /* Blob value for \"root\" field */\r\n  int nRoot                       /* Number of bytes in buffer zRoot */\r\n){\r\n  sqlite3_stmt *pStmt;\r\n  int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0);\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_bind_int64(pStmt, 1, iLevel);\r\n    sqlite3_bind_int(pStmt, 2, iIdx);\r\n    sqlite3_bind_int64(pStmt, 3, iStartBlock);\r\n    sqlite3_bind_int64(pStmt, 4, iLeafEndBlock);\r\n    sqlite3_bind_int64(pStmt, 5, iEndBlock);\r\n    sqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC);\r\n    sqlite3_step(pStmt);\r\n    rc = sqlite3_reset(pStmt);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the size of the common prefix (if any) shared by zPrev and\r\n** zNext, in bytes. For example, \r\n**\r\n**   fts3PrefixCompress(\"abc\", 3, \"abcdef\", 6)   // returns 3\r\n**   fts3PrefixCompress(\"abX\", 3, \"abcdef\", 6)   // returns 2\r\n**   fts3PrefixCompress(\"abX\", 3, \"Xbcdef\", 6)   // returns 0\r\n*/\r\nstatic int fts3PrefixCompress(\r\n  const char *zPrev,              /* Buffer containing previous term */\r\n  int nPrev,                      /* Size of buffer zPrev in bytes */\r\n  const char *zNext,              /* Buffer containing next term */\r\n  int nNext                       /* Size of buffer zNext in bytes */\r\n){\r\n  int n;\r\n  UNUSED_PARAMETER(nNext);\r\n  for(n=0; n<nPrev && zPrev[n]==zNext[n]; n++);\r\n  return n;\r\n}\r\n\r\n/*\r\n** Add term zTerm to the SegmentNode. It is guaranteed that zTerm is larger\r\n** (according to memcmp) than the previous term.\r\n*/\r\nstatic int fts3NodeAddTerm(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  SegmentNode **ppTree,           /* IN/OUT: SegmentNode handle */ \r\n  int isCopyTerm,                 /* True if zTerm/nTerm is transient */\r\n  const char *zTerm,              /* Pointer to buffer containing term */\r\n  int nTerm                       /* Size of term in bytes */\r\n){\r\n  SegmentNode *pTree = *ppTree;\r\n  int rc;\r\n  SegmentNode *pNew;\r\n\r\n  /* First try to append the term to the current node. Return early if \r\n  ** this is possible.\r\n  */\r\n  if( pTree ){\r\n    int nData = pTree->nData;     /* Current size of node in bytes */\r\n    int nReq = nData;             /* Required space after adding zTerm */\r\n    int nPrefix;                  /* Number of bytes of prefix compression */\r\n    int nSuffix;                  /* Suffix length */\r\n\r\n    nPrefix = fts3PrefixCompress(pTree->zTerm, pTree->nTerm, zTerm, nTerm);\r\n    nSuffix = nTerm-nPrefix;\r\n\r\n    nReq += sqlite3Fts3VarintLen(nPrefix)+sqlite3Fts3VarintLen(nSuffix)+nSuffix;\r\n    if( nReq<=p->nNodeSize || !pTree->zTerm ){\r\n\r\n      if( nReq>p->nNodeSize ){\r\n        /* An unusual case: this is the first term to be added to the node\r\n        ** and the static node buffer (p->nNodeSize bytes) is not large\r\n        ** enough. Use a separately malloced buffer instead This wastes\r\n        ** p->nNodeSize bytes, but since this scenario only comes about when\r\n        ** the database contain two terms that share a prefix of almost 2KB, \r\n        ** this is not expected to be a serious problem. \r\n        */\r\n        assert( pTree->aData==(char *)&pTree[1] );\r\n        pTree->aData = (char *)sqlite3_malloc(nReq);\r\n        if( !pTree->aData ){\r\n          return SQLITE_NOMEM;\r\n        }\r\n      }\r\n\r\n      if( pTree->zTerm ){\r\n        /* There is no prefix-length field for first term in a node */\r\n        nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nPrefix);\r\n      }\r\n\r\n      nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nSuffix);\r\n      memcpy(&pTree->aData[nData], &zTerm[nPrefix], nSuffix);\r\n      pTree->nData = nData + nSuffix;\r\n      pTree->nEntry++;\r\n\r\n      if( isCopyTerm ){\r\n        if( pTree->nMalloc<nTerm ){\r\n          char *zNew = sqlite3_realloc(pTree->zMalloc, nTerm*2);\r\n          if( !zNew ){\r\n            return SQLITE_NOMEM;\r\n          }\r\n          pTree->nMalloc = nTerm*2;\r\n          pTree->zMalloc = zNew;\r\n        }\r\n        pTree->zTerm = pTree->zMalloc;\r\n        memcpy(pTree->zTerm, zTerm, nTerm);\r\n        pTree->nTerm = nTerm;\r\n      }else{\r\n        pTree->zTerm = (char *)zTerm;\r\n        pTree->nTerm = nTerm;\r\n      }\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n\r\n  /* If control flows to here, it was not possible to append zTerm to the\r\n  ** current node. Create a new node (a right-sibling of the current node).\r\n  ** If this is the first node in the tree, the term is added to it.\r\n  **\r\n  ** Otherwise, the term is not added to the new node, it is left empty for\r\n  ** now. Instead, the term is inserted into the parent of pTree. If pTree \r\n  ** has no parent, one is created here.\r\n  */\r\n  pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);\r\n  if( !pNew ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pNew, 0, sizeof(SegmentNode));\r\n  pNew->nData = 1 + FTS3_VARINT_MAX;\r\n  pNew->aData = (char *)&pNew[1];\r\n\r\n  if( pTree ){\r\n    SegmentNode *pParent = pTree->pParent;\r\n    rc = fts3NodeAddTerm(p, &pParent, isCopyTerm, zTerm, nTerm);\r\n    if( pTree->pParent==0 ){\r\n      pTree->pParent = pParent;\r\n    }\r\n    pTree->pRight = pNew;\r\n    pNew->pLeftmost = pTree->pLeftmost;\r\n    pNew->pParent = pParent;\r\n    pNew->zMalloc = pTree->zMalloc;\r\n    pNew->nMalloc = pTree->nMalloc;\r\n    pTree->zMalloc = 0;\r\n  }else{\r\n    pNew->pLeftmost = pNew;\r\n    rc = fts3NodeAddTerm(p, &pNew, isCopyTerm, zTerm, nTerm); \r\n  }\r\n\r\n  *ppTree = pNew;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Helper function for fts3NodeWrite().\r\n*/\r\nstatic int fts3TreeFinishNode(\r\n  SegmentNode *pTree, \r\n  int iHeight, \r\n  sqlite3_int64 iLeftChild\r\n){\r\n  int nStart;\r\n  assert( iHeight>=1 && iHeight<128 );\r\n  nStart = FTS3_VARINT_MAX - sqlite3Fts3VarintLen(iLeftChild);\r\n  pTree->aData[nStart] = (char)iHeight;\r\n  sqlite3Fts3PutVarint(&pTree->aData[nStart+1], iLeftChild);\r\n  return nStart;\r\n}\r\n\r\n/*\r\n** Write the buffer for the segment node pTree and all of its peers to the\r\n** database. Then call this function recursively to write the parent of \r\n** pTree and its peers to the database. \r\n**\r\n** Except, if pTree is a root node, do not write it to the database. Instead,\r\n** set output variables *paRoot and *pnRoot to contain the root node.\r\n**\r\n** If successful, SQLITE_OK is returned and output variable *piLast is\r\n** set to the largest blockid written to the database (or zero if no\r\n** blocks were written to the db). Otherwise, an SQLite error code is \r\n** returned.\r\n*/\r\nstatic int fts3NodeWrite(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  SegmentNode *pTree,             /* SegmentNode handle */\r\n  int iHeight,                    /* Height of this node in tree */\r\n  sqlite3_int64 iLeaf,            /* Block id of first leaf node */\r\n  sqlite3_int64 iFree,            /* Block id of next free slot in %_segments */\r\n  sqlite3_int64 *piLast,          /* OUT: Block id of last entry written */\r\n  char **paRoot,                  /* OUT: Data for root node */\r\n  int *pnRoot                     /* OUT: Size of root node in bytes */\r\n){\r\n  int rc = SQLITE_OK;\r\n\r\n  if( !pTree->pParent ){\r\n    /* Root node of the tree. */\r\n    int nStart = fts3TreeFinishNode(pTree, iHeight, iLeaf);\r\n    *piLast = iFree-1;\r\n    *pnRoot = pTree->nData - nStart;\r\n    *paRoot = &pTree->aData[nStart];\r\n  }else{\r\n    SegmentNode *pIter;\r\n    sqlite3_int64 iNextFree = iFree;\r\n    sqlite3_int64 iNextLeaf = iLeaf;\r\n    for(pIter=pTree->pLeftmost; pIter && rc==SQLITE_OK; pIter=pIter->pRight){\r\n      int nStart = fts3TreeFinishNode(pIter, iHeight, iNextLeaf);\r\n      int nWrite = pIter->nData - nStart;\r\n  \r\n      rc = fts3WriteSegment(p, iNextFree, &pIter->aData[nStart], nWrite);\r\n      iNextFree++;\r\n      iNextLeaf += (pIter->nEntry+1);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      assert( iNextLeaf==iFree );\r\n      rc = fts3NodeWrite(\r\n          p, pTree->pParent, iHeight+1, iFree, iNextFree, piLast, paRoot, pnRoot\r\n      );\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Free all memory allocations associated with the tree pTree.\r\n*/\r\nstatic void fts3NodeFree(SegmentNode *pTree){\r\n  if( pTree ){\r\n    SegmentNode *p = pTree->pLeftmost;\r\n    fts3NodeFree(p->pParent);\r\n    while( p ){\r\n      SegmentNode *pRight = p->pRight;\r\n      if( p->aData!=(char *)&p[1] ){\r\n        sqlite3_free(p->aData);\r\n      }\r\n      assert( pRight==0 || p->zMalloc==0 );\r\n      sqlite3_free(p->zMalloc);\r\n      sqlite3_free(p);\r\n      p = pRight;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Add a term to the segment being constructed by the SegmentWriter object\r\n** *ppWriter. When adding the first term to a segment, *ppWriter should\r\n** be passed NULL. This function will allocate a new SegmentWriter object\r\n** and return it via the input/output variable *ppWriter in this case.\r\n**\r\n** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code.\r\n*/\r\nstatic int fts3SegWriterAdd(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  SegmentWriter **ppWriter,       /* IN/OUT: SegmentWriter handle */ \r\n  int isCopyTerm,                 /* True if buffer zTerm must be copied */\r\n  const char *zTerm,              /* Pointer to buffer containing term */\r\n  int nTerm,                      /* Size of term in bytes */\r\n  const char *aDoclist,           /* Pointer to buffer containing doclist */\r\n  int nDoclist                    /* Size of doclist in bytes */\r\n){\r\n  int nPrefix;                    /* Size of term prefix in bytes */\r\n  int nSuffix;                    /* Size of term suffix in bytes */\r\n  int nReq;                       /* Number of bytes required on leaf page */\r\n  int nData;\r\n  SegmentWriter *pWriter = *ppWriter;\r\n\r\n  if( !pWriter ){\r\n    int rc;\r\n    sqlite3_stmt *pStmt;\r\n\r\n    /* Allocate the SegmentWriter structure */\r\n    pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));\r\n    if( !pWriter ) return SQLITE_NOMEM;\r\n    memset(pWriter, 0, sizeof(SegmentWriter));\r\n    *ppWriter = pWriter;\r\n\r\n    /* Allocate a buffer in which to accumulate data */\r\n    pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);\r\n    if( !pWriter->aData ) return SQLITE_NOMEM;\r\n    pWriter->nSize = p->nNodeSize;\r\n\r\n    /* Find the next free blockid in the %_segments table */\r\n    rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pStmt, 0);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n    if( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n      pWriter->iFree = sqlite3_column_int64(pStmt, 0);\r\n      pWriter->iFirst = pWriter->iFree;\r\n    }\r\n    rc = sqlite3_reset(pStmt);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n  nData = pWriter->nData;\r\n\r\n  nPrefix = fts3PrefixCompress(pWriter->zTerm, pWriter->nTerm, zTerm, nTerm);\r\n  nSuffix = nTerm-nPrefix;\r\n\r\n  /* Figure out how many bytes are required by this new entry */\r\n  nReq = sqlite3Fts3VarintLen(nPrefix) +    /* varint containing prefix size */\r\n    sqlite3Fts3VarintLen(nSuffix) +         /* varint containing suffix size */\r\n    nSuffix +                               /* Term suffix */\r\n    sqlite3Fts3VarintLen(nDoclist) +        /* Size of doclist */\r\n    nDoclist;                               /* Doclist data */\r\n\r\n  if( nData>0 && nData+nReq>p->nNodeSize ){\r\n    int rc;\r\n\r\n    /* The current leaf node is full. Write it out to the database. */\r\n    rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n\r\n    /* Add the current term to the interior node tree. The term added to\r\n    ** the interior tree must:\r\n    **\r\n    **   a) be greater than the largest term on the leaf node just written\r\n    **      to the database (still available in pWriter->zTerm), and\r\n    **\r\n    **   b) be less than or equal to the term about to be added to the new\r\n    **      leaf node (zTerm/nTerm).\r\n    **\r\n    ** In other words, it must be the prefix of zTerm 1 byte longer than\r\n    ** the common prefix (if any) of zTerm and pWriter->zTerm.\r\n    */\r\n    assert( nPrefix<nTerm );\r\n    rc = fts3NodeAddTerm(p, &pWriter->pTree, isCopyTerm, zTerm, nPrefix+1);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n\r\n    nData = 0;\r\n    pWriter->nTerm = 0;\r\n\r\n    nPrefix = 0;\r\n    nSuffix = nTerm;\r\n    nReq = 1 +                              /* varint containing prefix size */\r\n      sqlite3Fts3VarintLen(nTerm) +         /* varint containing suffix size */\r\n      nTerm +                               /* Term suffix */\r\n      sqlite3Fts3VarintLen(nDoclist) +      /* Size of doclist */\r\n      nDoclist;                             /* Doclist data */\r\n  }\r\n\r\n  /* If the buffer currently allocated is too small for this entry, realloc\r\n  ** the buffer to make it large enough.\r\n  */\r\n  if( nReq>pWriter->nSize ){\r\n    char *aNew = sqlite3_realloc(pWriter->aData, nReq);\r\n    if( !aNew ) return SQLITE_NOMEM;\r\n    pWriter->aData = aNew;\r\n    pWriter->nSize = nReq;\r\n  }\r\n  assert( nData+nReq<=pWriter->nSize );\r\n\r\n  /* Append the prefix-compressed term and doclist to the buffer. */\r\n  nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix);\r\n  nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix);\r\n  memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix);\r\n  nData += nSuffix;\r\n  nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist);\r\n  memcpy(&pWriter->aData[nData], aDoclist, nDoclist);\r\n  pWriter->nData = nData + nDoclist;\r\n\r\n  /* Save the current term so that it can be used to prefix-compress the next.\r\n  ** If the isCopyTerm parameter is true, then the buffer pointed to by\r\n  ** zTerm is transient, so take a copy of the term data. Otherwise, just\r\n  ** store a copy of the pointer.\r\n  */\r\n  if( isCopyTerm ){\r\n    if( nTerm>pWriter->nMalloc ){\r\n      char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);\r\n      if( !zNew ){\r\n        return SQLITE_NOMEM;\r\n      }\r\n      pWriter->nMalloc = nTerm*2;\r\n      pWriter->zMalloc = zNew;\r\n      pWriter->zTerm = zNew;\r\n    }\r\n    assert( pWriter->zTerm==pWriter->zMalloc );\r\n    memcpy(pWriter->zTerm, zTerm, nTerm);\r\n  }else{\r\n    pWriter->zTerm = (char *)zTerm;\r\n  }\r\n  pWriter->nTerm = nTerm;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Flush all data associated with the SegmentWriter object pWriter to the\r\n** database. This function must be called after all terms have been added\r\n** to the segment using fts3SegWriterAdd(). If successful, SQLITE_OK is\r\n** returned. Otherwise, an SQLite error code.\r\n*/\r\nstatic int fts3SegWriterFlush(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  SegmentWriter *pWriter,         /* SegmentWriter to flush to the db */\r\n  sqlite3_int64 iLevel,           /* Value for 'level' column of %_segdir */\r\n  int iIdx                        /* Value for 'idx' column of %_segdir */\r\n){\r\n  int rc;                         /* Return code */\r\n  if( pWriter->pTree ){\r\n    sqlite3_int64 iLast = 0;      /* Largest block id written to database */\r\n    sqlite3_int64 iLastLeaf;      /* Largest leaf block id written to db */\r\n    char *zRoot = NULL;           /* Pointer to buffer containing root node */\r\n    int nRoot = 0;                /* Size of buffer zRoot */\r\n\r\n    iLastLeaf = pWriter->iFree;\r\n    rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData);\r\n    if( rc==SQLITE_OK ){\r\n      rc = fts3NodeWrite(p, pWriter->pTree, 1,\r\n          pWriter->iFirst, pWriter->iFree, &iLast, &zRoot, &nRoot);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      rc = fts3WriteSegdir(\r\n          p, iLevel, iIdx, pWriter->iFirst, iLastLeaf, iLast, zRoot, nRoot);\r\n    }\r\n  }else{\r\n    /* The entire tree fits on the root node. Write it to the segdir table. */\r\n    rc = fts3WriteSegdir(\r\n        p, iLevel, iIdx, 0, 0, 0, pWriter->aData, pWriter->nData);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Release all memory held by the SegmentWriter object passed as the \r\n** first argument.\r\n*/\r\nstatic void fts3SegWriterFree(SegmentWriter *pWriter){\r\n  if( pWriter ){\r\n    sqlite3_free(pWriter->aData);\r\n    sqlite3_free(pWriter->zMalloc);\r\n    fts3NodeFree(pWriter->pTree);\r\n    sqlite3_free(pWriter);\r\n  }\r\n}\r\n\r\n/*\r\n** The first value in the apVal[] array is assumed to contain an integer.\r\n** This function tests if there exist any documents with docid values that\r\n** are different from that integer. i.e. if deleting the document with docid\r\n** pRowid would mean the FTS3 table were empty.\r\n**\r\n** If successful, *pisEmpty is set to true if the table is empty except for\r\n** document pRowid, or false otherwise, and SQLITE_OK is returned. If an\r\n** error occurs, an SQLite error code is returned.\r\n*/\r\nstatic int fts3IsEmpty(Fts3Table *p, sqlite3_value *pRowid, int *pisEmpty){\r\n  sqlite3_stmt *pStmt;\r\n  int rc;\r\n  if( p->zContentTbl ){\r\n    /* If using the content=xxx option, assume the table is never empty */\r\n    *pisEmpty = 0;\r\n    rc = SQLITE_OK;\r\n  }else{\r\n    rc = fts3SqlStmt(p, SQL_IS_EMPTY, &pStmt, &pRowid);\r\n    if( rc==SQLITE_OK ){\r\n      if( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n        *pisEmpty = sqlite3_column_int(pStmt, 0);\r\n      }\r\n      rc = sqlite3_reset(pStmt);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Set *pnMax to the largest segment level in the database for the index\r\n** iIndex.\r\n**\r\n** Segment levels are stored in the 'level' column of the %_segdir table.\r\n**\r\n** Return SQLITE_OK if successful, or an SQLite error code if not.\r\n*/\r\nstatic int fts3SegmentMaxLevel(\r\n  Fts3Table *p, \r\n  int iLangid,\r\n  int iIndex, \r\n  sqlite3_int64 *pnMax\r\n){\r\n  sqlite3_stmt *pStmt;\r\n  int rc;\r\n  assert( iIndex>=0 && iIndex<p->nIndex );\r\n\r\n  /* Set pStmt to the compiled version of:\r\n  **\r\n  **   SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\r\n  **\r\n  ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR).\r\n  */\r\n  rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n  sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0));\r\n  sqlite3_bind_int64(pStmt, 2, \r\n      getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1)\r\n  );\r\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n    *pnMax = sqlite3_column_int64(pStmt, 0);\r\n  }\r\n  return sqlite3_reset(pStmt);\r\n}\r\n\r\n/*\r\n** This function is used after merging multiple segments into a single large\r\n** segment to delete the old, now redundant, segment b-trees. Specifically,\r\n** it:\r\n** \r\n**   1) Deletes all %_segments entries for the segments associated with \r\n**      each of the SegReader objects in the array passed as the third \r\n**      argument, and\r\n**\r\n**   2) deletes all %_segdir entries with level iLevel, or all %_segdir\r\n**      entries regardless of level if (iLevel<0).\r\n**\r\n** SQLITE_OK is returned if successful, otherwise an SQLite error code.\r\n*/\r\nstatic int fts3DeleteSegdir(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  int iLangid,                    /* Language id */\r\n  int iIndex,                     /* Index for p->aIndex */\r\n  int iLevel,                     /* Level of %_segdir entries to delete */\r\n  Fts3SegReader **apSegment,      /* Array of SegReader objects */\r\n  int nReader                     /* Size of array apSegment */\r\n){\r\n  int rc;                         /* Return Code */\r\n  int i;                          /* Iterator variable */\r\n  sqlite3_stmt *pDelete;          /* SQL statement to delete rows */\r\n\r\n  rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDelete, 0);\r\n  for(i=0; rc==SQLITE_OK && i<nReader; i++){\r\n    Fts3SegReader *pSegment = apSegment[i];\r\n    if( pSegment->iStartBlock ){\r\n      sqlite3_bind_int64(pDelete, 1, pSegment->iStartBlock);\r\n      sqlite3_bind_int64(pDelete, 2, pSegment->iEndBlock);\r\n      sqlite3_step(pDelete);\r\n      rc = sqlite3_reset(pDelete);\r\n    }\r\n  }\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  assert( iLevel>=0 || iLevel==FTS3_SEGCURSOR_ALL );\r\n  if( iLevel==FTS3_SEGCURSOR_ALL ){\r\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_RANGE, &pDelete, 0);\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3_bind_int64(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0));\r\n      sqlite3_bind_int64(pDelete, 2, \r\n          getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1)\r\n      );\r\n    }\r\n  }else{\r\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pDelete, 0);\r\n    if( rc==SQLITE_OK ){\r\n      sqlite3_bind_int64(\r\n          pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel)\r\n      );\r\n    }\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_step(pDelete);\r\n    rc = sqlite3_reset(pDelete);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** When this function is called, buffer *ppList (size *pnList bytes) contains \r\n** a position list that may (or may not) feature multiple columns. This\r\n** function adjusts the pointer *ppList and the length *pnList so that they\r\n** identify the subset of the position list that corresponds to column iCol.\r\n**\r\n** If there are no entries in the input position list for column iCol, then\r\n** *pnList is set to zero before returning.\r\n*/\r\nstatic void fts3ColumnFilter(\r\n  int iCol,                       /* Column to filter on */\r\n  char **ppList,                  /* IN/OUT: Pointer to position list */\r\n  int *pnList                     /* IN/OUT: Size of buffer *ppList in bytes */\r\n){\r\n  char *pList = *ppList;\r\n  int nList = *pnList;\r\n  char *pEnd = &pList[nList];\r\n  int iCurrent = 0;\r\n  char *p = pList;\r\n\r\n  assert( iCol>=0 );\r\n  while( 1 ){\r\n    char c = 0;\r\n    while( p<pEnd && (c | *p)&0xFE ) c = *p++ & 0x80;\r\n  \r\n    if( iCol==iCurrent ){\r\n      nList = (int)(p - pList);\r\n      break;\r\n    }\r\n\r\n    nList -= (int)(p - pList);\r\n    pList = p;\r\n    if( nList==0 ){\r\n      break;\r\n    }\r\n    p = &pList[1];\r\n    p += sqlite3Fts3GetVarint32(p, &iCurrent);\r\n  }\r\n\r\n  *ppList = pList;\r\n  *pnList = nList;\r\n}\r\n\r\n/*\r\n** Cache data in the Fts3MultiSegReader.aBuffer[] buffer (overwriting any\r\n** existing data). Grow the buffer if required.\r\n**\r\n** If successful, return SQLITE_OK. Otherwise, if an OOM error is encountered\r\n** trying to resize the buffer, return SQLITE_NOMEM.\r\n*/\r\nstatic int fts3MsrBufferData(\r\n  Fts3MultiSegReader *pMsr,       /* Multi-segment-reader handle */\r\n  char *pList,\r\n  int nList\r\n){\r\n  if( nList>pMsr->nBuffer ){\r\n    char *pNew;\r\n    pMsr->nBuffer = nList*2;\r\n    pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);\r\n    if( !pNew ) return SQLITE_NOMEM;\r\n    pMsr->aBuffer = pNew;\r\n  }\r\n\r\n  memcpy(pMsr->aBuffer, pList, nList);\r\n  return SQLITE_OK;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  Fts3MultiSegReader *pMsr,       /* Multi-segment-reader handle */\r\n  sqlite3_int64 *piDocid,         /* OUT: Docid value */\r\n  char **paPoslist,               /* OUT: Pointer to position list */\r\n  int *pnPoslist                  /* OUT: Size of position list in bytes */\r\n){\r\n  int nMerge = pMsr->nAdvance;\r\n  Fts3SegReader **apSegment = pMsr->apSegment;\r\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = (\r\n    p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp\r\n  );\r\n\r\n  if( nMerge==0 ){\r\n    *paPoslist = 0;\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  while( 1 ){\r\n    Fts3SegReader *pSeg;\r\n    pSeg = pMsr->apSegment[0];\r\n\r\n    if( pSeg->pOffsetList==0 ){\r\n      *paPoslist = 0;\r\n      break;\r\n    }else{\r\n      int rc;\r\n      char *pList;\r\n      int nList;\r\n      int j;\r\n      sqlite3_int64 iDocid = apSegment[0]->iDocid;\r\n\r\n      rc = fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList);\r\n      j = 1;\r\n      while( rc==SQLITE_OK \r\n        && j<nMerge\r\n        && apSegment[j]->pOffsetList\r\n        && apSegment[j]->iDocid==iDocid\r\n      ){\r\n        rc = fts3SegReaderNextDocid(p, apSegment[j], 0, 0);\r\n        j++;\r\n      }\r\n      if( rc!=SQLITE_OK ) return rc;\r\n      fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);\r\n\r\n      if( pMsr->iColFilter>=0 ){\r\n        fts3ColumnFilter(pMsr->iColFilter, &pList, &nList);\r\n      }\r\n\r\n      if( nList>0 ){\r\n        if( fts3SegReaderIsPending(apSegment[0]) ){\r\n          rc = fts3MsrBufferData(pMsr, pList, nList+1);\r\n          if( rc!=SQLITE_OK ) return rc;\r\n          *paPoslist = pMsr->aBuffer;\r\n          assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );\r\n        }else{\r\n          *paPoslist = pList;\r\n        }\r\n        *piDocid = iDocid;\r\n        *pnPoslist = nList;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\nstatic int fts3SegReaderStart(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  Fts3MultiSegReader *pCsr,       /* Cursor object */\r\n  const char *zTerm,              /* Term searched for (or NULL) */\r\n  int nTerm                       /* Length of zTerm in bytes */\r\n){\r\n  int i;\r\n  int nSeg = pCsr->nSegment;\r\n\r\n  /* If the Fts3SegFilter defines a specific term (or term prefix) to search \r\n  ** for, then advance each segment iterator until it points to a term of\r\n  ** equal or greater value than the specified term. This prevents many\r\n  ** unnecessary merge/sort operations for the case where single segment\r\n  ** b-tree leaf nodes contain more than one term.\r\n  */\r\n  for(i=0; pCsr->bRestart==0 && i<pCsr->nSegment; i++){\r\n    int res = 0;\r\n    Fts3SegReader *pSeg = pCsr->apSegment[i];\r\n    do {\r\n      int rc = fts3SegReaderNext(p, pSeg, 0);\r\n      if( rc!=SQLITE_OK ) return rc;\r\n    }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 );\r\n\r\n    if( pSeg->bLookup && res!=0 ){\r\n      fts3SegReaderSetEof(pSeg);\r\n    }\r\n  }\r\n  fts3SegReaderSort(pCsr->apSegment, nSeg, nSeg, fts3SegReaderCmp);\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderStart(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  Fts3MultiSegReader *pCsr,       /* Cursor object */\r\n  Fts3SegFilter *pFilter          /* Restrictions on range of iteration */\r\n){\r\n  pCsr->pFilter = pFilter;\r\n  return fts3SegReaderStart(p, pCsr, pFilter->zTerm, pFilter->nTerm);\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3MsrIncrStart(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  Fts3MultiSegReader *pCsr,       /* Cursor object */\r\n  int iCol,                       /* Column to match on. */\r\n  const char *zTerm,              /* Term to iterate through a doclist for */\r\n  int nTerm                       /* Number of bytes in zTerm */\r\n){\r\n  int i;\r\n  int rc;\r\n  int nSegment = pCsr->nSegment;\r\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = (\r\n    p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp\r\n  );\r\n\r\n  assert( pCsr->pFilter==0 );\r\n  assert( zTerm && nTerm>0 );\r\n\r\n  /* Advance each segment iterator until it points to the term zTerm/nTerm. */\r\n  rc = fts3SegReaderStart(p, pCsr, zTerm, nTerm);\r\n  if( rc!=SQLITE_OK ) return rc;\r\n\r\n  /* Determine how many of the segments actually point to zTerm/nTerm. */\r\n  for(i=0; i<nSegment; i++){\r\n    Fts3SegReader *pSeg = pCsr->apSegment[i];\r\n    if( !pSeg->aNode || fts3SegReaderTermCmp(pSeg, zTerm, nTerm) ){\r\n      break;\r\n    }\r\n  }\r\n  pCsr->nAdvance = i;\r\n\r\n  /* Advance each of the segments to point to the first docid. */\r\n  for(i=0; i<pCsr->nAdvance; i++){\r\n    rc = fts3SegReaderFirstDocid(p, pCsr->apSegment[i]);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n  fts3SegReaderSort(pCsr->apSegment, i, i, xCmp);\r\n\r\n  assert( iCol<0 || iCol<p->nColumn );\r\n  pCsr->iColFilter = iCol;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** This function is called on a MultiSegReader that has been started using\r\n** sqlite3Fts3MsrIncrStart(). One or more calls to MsrIncrNext() may also\r\n** have been made. Calling this function puts the MultiSegReader in such\r\n** a state that if the next two calls are:\r\n**\r\n**   sqlite3Fts3SegReaderStart()\r\n**   sqlite3Fts3SegReaderStep()\r\n**\r\n** then the entire doclist for the term is available in \r\n** MultiSegReader.aDoclist/nDoclist.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){\r\n  int i;                          /* Used to iterate through segment-readers */\r\n\r\n  assert( pCsr->zTerm==0 );\r\n  assert( pCsr->nTerm==0 );\r\n  assert( pCsr->aDoclist==0 );\r\n  assert( pCsr->nDoclist==0 );\r\n\r\n  pCsr->nAdvance = 0;\r\n  pCsr->bRestart = 1;\r\n  for(i=0; i<pCsr->nSegment; i++){\r\n    pCsr->apSegment[i]->pOffsetList = 0;\r\n    pCsr->apSegment[i]->nOffsetList = 0;\r\n    pCsr->apSegment[i]->iDocid = 0;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3SegReaderStep(\r\n  Fts3Table *p,                   /* Virtual table handle */\r\n  Fts3MultiSegReader *pCsr        /* Cursor object */\r\n){\r\n  int rc = SQLITE_OK;\r\n\r\n  int isIgnoreEmpty =  (pCsr->pFilter->flags & FTS3_SEGMENT_IGNORE_EMPTY);\r\n  int isRequirePos =   (pCsr->pFilter->flags & FTS3_SEGMENT_REQUIRE_POS);\r\n  int isColFilter =    (pCsr->pFilter->flags & FTS3_SEGMENT_COLUMN_FILTER);\r\n  int isPrefix =       (pCsr->pFilter->flags & FTS3_SEGMENT_PREFIX);\r\n  int isScan =         (pCsr->pFilter->flags & FTS3_SEGMENT_SCAN);\r\n  int isFirst =        (pCsr->pFilter->flags & FTS3_SEGMENT_FIRST);\r\n\r\n  Fts3SegReader **apSegment = pCsr->apSegment;\r\n  int nSegment = pCsr->nSegment;\r\n  Fts3SegFilter *pFilter = pCsr->pFilter;\r\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = (\r\n    p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp\r\n  );\r\n\r\n  if( pCsr->nSegment==0 ) return SQLITE_OK;\r\n\r\n  do {\r\n    int nMerge;\r\n    int i;\r\n  \r\n    /* Advance the first pCsr->nAdvance entries in the apSegment[] array\r\n    ** forward. Then sort the list in order of current term again.  \r\n    */\r\n    for(i=0; i<pCsr->nAdvance; i++){\r\n      Fts3SegReader *pSeg = apSegment[i];\r\n      if( pSeg->bLookup ){\r\n        fts3SegReaderSetEof(pSeg);\r\n      }else{\r\n        rc = fts3SegReaderNext(p, pSeg, 0);\r\n      }\r\n      if( rc!=SQLITE_OK ) return rc;\r\n    }\r\n    fts3SegReaderSort(apSegment, nSegment, pCsr->nAdvance, fts3SegReaderCmp);\r\n    pCsr->nAdvance = 0;\r\n\r\n    /* If all the seg-readers are at EOF, we're finished. return SQLITE_OK. */\r\n    assert( rc==SQLITE_OK );\r\n    if( apSegment[0]->aNode==0 ) break;\r\n\r\n    pCsr->nTerm = apSegment[0]->nTerm;\r\n    pCsr->zTerm = apSegment[0]->zTerm;\r\n\r\n    /* If this is a prefix-search, and if the term that apSegment[0] points\r\n    ** to does not share a suffix with pFilter->zTerm/nTerm, then all \r\n    ** required callbacks have been made. In this case exit early.\r\n    **\r\n    ** Similarly, if this is a search for an exact match, and the first term\r\n    ** of segment apSegment[0] is not a match, exit early.\r\n    */\r\n    if( pFilter->zTerm && !isScan ){\r\n      if( pCsr->nTerm<pFilter->nTerm \r\n       || (!isPrefix && pCsr->nTerm>pFilter->nTerm)\r\n       || memcmp(pCsr->zTerm, pFilter->zTerm, pFilter->nTerm) \r\n      ){\r\n        break;\r\n      }\r\n    }\r\n\r\n    nMerge = 1;\r\n    while( nMerge<nSegment \r\n        && apSegment[nMerge]->aNode\r\n        && apSegment[nMerge]->nTerm==pCsr->nTerm \r\n        && 0==memcmp(pCsr->zTerm, apSegment[nMerge]->zTerm, pCsr->nTerm)\r\n    ){\r\n      nMerge++;\r\n    }\r\n\r\n    assert( isIgnoreEmpty || (isRequirePos && !isColFilter) );\r\n    if( nMerge==1 \r\n     && !isIgnoreEmpty \r\n     && !isFirst \r\n     && (p->bDescIdx==0 || fts3SegReaderIsPending(apSegment[0])==0)\r\n    ){\r\n      pCsr->nDoclist = apSegment[0]->nDoclist;\r\n      if( fts3SegReaderIsPending(apSegment[0]) ){\r\n        rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist);\r\n        pCsr->aDoclist = pCsr->aBuffer;\r\n      }else{\r\n        pCsr->aDoclist = apSegment[0]->aDoclist;\r\n      }\r\n      if( rc==SQLITE_OK ) rc = SQLITE_ROW;\r\n    }else{\r\n      int nDoclist = 0;           /* Size of doclist */\r\n      sqlite3_int64 iPrev = 0;    /* Previous docid stored in doclist */\r\n\r\n      /* The current term of the first nMerge entries in the array\r\n      ** of Fts3SegReader objects is the same. The doclists must be merged\r\n      ** and a single term returned with the merged doclist.\r\n      */\r\n      for(i=0; i<nMerge; i++){\r\n        fts3SegReaderFirstDocid(p, apSegment[i]);\r\n      }\r\n      fts3SegReaderSort(apSegment, nMerge, nMerge, xCmp);\r\n      while( apSegment[0]->pOffsetList ){\r\n        int j;                    /* Number of segments that share a docid */\r\n        char *pList;\r\n        int nList;\r\n        int nByte;\r\n        sqlite3_int64 iDocid = apSegment[0]->iDocid;\r\n        fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList);\r\n        j = 1;\r\n        while( j<nMerge\r\n            && apSegment[j]->pOffsetList\r\n            && apSegment[j]->iDocid==iDocid\r\n        ){\r\n          fts3SegReaderNextDocid(p, apSegment[j], 0, 0);\r\n          j++;\r\n        }\r\n\r\n        if( isColFilter ){\r\n          fts3ColumnFilter(pFilter->iCol, &pList, &nList);\r\n        }\r\n\r\n        if( !isIgnoreEmpty || nList>0 ){\r\n\r\n          /* Calculate the 'docid' delta value to write into the merged \r\n          ** doclist. */\r\n          sqlite3_int64 iDelta;\r\n          if( p->bDescIdx && nDoclist>0 ){\r\n            iDelta = iPrev - iDocid;\r\n          }else{\r\n            iDelta = iDocid - iPrev;\r\n          }\r\n          assert( iDelta>0 || (nDoclist==0 && iDelta==iDocid) );\r\n          assert( nDoclist>0 || iDelta==iDocid );\r\n\r\n          nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);\r\n          if( nDoclist+nByte>pCsr->nBuffer ){\r\n            char *aNew;\r\n            pCsr->nBuffer = (nDoclist+nByte)*2;\r\n            aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);\r\n            if( !aNew ){\r\n              return SQLITE_NOMEM;\r\n            }\r\n            pCsr->aBuffer = aNew;\r\n          }\r\n\r\n          if( isFirst ){\r\n            char *a = &pCsr->aBuffer[nDoclist];\r\n            int nWrite;\r\n           \r\n            nWrite = sqlite3Fts3FirstFilter(iDelta, pList, nList, a);\r\n            if( nWrite ){\r\n              iPrev = iDocid;\r\n              nDoclist += nWrite;\r\n            }\r\n          }else{\r\n            nDoclist += sqlite3Fts3PutVarint(&pCsr->aBuffer[nDoclist], iDelta);\r\n            iPrev = iDocid;\r\n            if( isRequirePos ){\r\n              memcpy(&pCsr->aBuffer[nDoclist], pList, nList);\r\n              nDoclist += nList;\r\n              pCsr->aBuffer[nDoclist++] = '\\0';\r\n            }\r\n          }\r\n        }\r\n\r\n        fts3SegReaderSort(apSegment, nMerge, j, xCmp);\r\n      }\r\n      if( nDoclist>0 ){\r\n        pCsr->aDoclist = pCsr->aBuffer;\r\n        pCsr->nDoclist = nDoclist;\r\n        rc = SQLITE_ROW;\r\n      }\r\n    }\r\n    pCsr->nAdvance = nMerge;\r\n  }while( rc==SQLITE_OK );\r\n\r\n  return rc;\r\n}\r\n\r\n\r\nSQLITE_PRIVATE void sqlite3Fts3SegReaderFinish(\r\n  Fts3MultiSegReader *pCsr       /* Cursor object */\r\n){\r\n  if( pCsr ){\r\n    int i;\r\n    for(i=0; i<pCsr->nSegment; i++){\r\n      sqlite3Fts3SegReaderFree(pCsr->apSegment[i]);\r\n    }\r\n    sqlite3_free(pCsr->apSegment);\r\n    sqlite3_free(pCsr->aBuffer);\r\n\r\n    pCsr->nSegment = 0;\r\n    pCsr->apSegment = 0;\r\n    pCsr->aBuffer = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Merge all level iLevel segments in the database into a single \r\n** iLevel+1 segment. Or, if iLevel<0, merge all segments into a\r\n** single segment with a level equal to the numerically largest level \r\n** currently present in the database.\r\n**\r\n** If this function is called with iLevel<0, but there is only one\r\n** segment in the database, SQLITE_DONE is returned immediately. \r\n** Otherwise, if successful, SQLITE_OK is returned. If an error occurs, \r\n** an SQLite error code is returned.\r\n*/\r\nstatic int fts3SegmentMerge(\r\n  Fts3Table *p, \r\n  int iLangid,                    /* Language id to merge */\r\n  int iIndex,                     /* Index in p->aIndex[] to merge */\r\n  int iLevel                      /* Level to merge */\r\n){\r\n  int rc;                         /* Return code */\r\n  int iIdx = 0;                   /* Index of new segment */\r\n  sqlite3_int64 iNewLevel = 0;    /* Level/index to create new segment at */\r\n  SegmentWriter *pWriter = 0;     /* Used to write the new, merged, segment */\r\n  Fts3SegFilter filter;           /* Segment term filter condition */\r\n  Fts3MultiSegReader csr;         /* Cursor to iterate through level(s) */\r\n  int bIgnoreEmpty = 0;           /* True to ignore empty segments */\r\n\r\n  assert( iLevel==FTS3_SEGCURSOR_ALL\r\n       || iLevel==FTS3_SEGCURSOR_PENDING\r\n       || iLevel>=0\r\n  );\r\n  assert( iLevel<FTS3_SEGDIR_MAXLEVEL );\r\n  assert( iIndex>=0 && iIndex<p->nIndex );\r\n\r\n  rc = sqlite3Fts3SegReaderCursor(p, iLangid, iIndex, iLevel, 0, 0, 1, 0, &csr);\r\n  if( rc!=SQLITE_OK || csr.nSegment==0 ) goto finished;\r\n\r\n  if( iLevel==FTS3_SEGCURSOR_ALL ){\r\n    /* This call is to merge all segments in the database to a single\r\n    ** segment. The level of the new segment is equal to the the numerically \r\n    ** greatest segment level currently present in the database for this\r\n    ** index. The idx of the new segment is always 0.  */\r\n    if( csr.nSegment==1 ){\r\n      rc = SQLITE_DONE;\r\n      goto finished;\r\n    }\r\n    rc = fts3SegmentMaxLevel(p, iLangid, iIndex, &iNewLevel);\r\n    bIgnoreEmpty = 1;\r\n\r\n  }else if( iLevel==FTS3_SEGCURSOR_PENDING ){\r\n    iNewLevel = getAbsoluteLevel(p, iLangid, iIndex, 0);\r\n    rc = fts3AllocateSegdirIdx(p, iLangid, iIndex, 0, &iIdx);\r\n  }else{\r\n    /* This call is to merge all segments at level iLevel. find the next\r\n    ** available segment index at level iLevel+1. The call to\r\n    ** fts3AllocateSegdirIdx() will merge the segments at level iLevel+1 to \r\n    ** a single iLevel+2 segment if necessary.  */\r\n    rc = fts3AllocateSegdirIdx(p, iLangid, iIndex, iLevel+1, &iIdx);\r\n    iNewLevel = getAbsoluteLevel(p, iLangid, iIndex, iLevel+1);\r\n  }\r\n  if( rc!=SQLITE_OK ) goto finished;\r\n  assert( csr.nSegment>0 );\r\n  assert( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) );\r\n  assert( iNewLevel<getAbsoluteLevel(p, iLangid, iIndex,FTS3_SEGDIR_MAXLEVEL) );\r\n\r\n  memset(&filter, 0, sizeof(Fts3SegFilter));\r\n  filter.flags = FTS3_SEGMENT_REQUIRE_POS;\r\n  filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0);\r\n\r\n  rc = sqlite3Fts3SegReaderStart(p, &csr, &filter);\r\n  while( SQLITE_OK==rc ){\r\n    rc = sqlite3Fts3SegReaderStep(p, &csr);\r\n    if( rc!=SQLITE_ROW ) break;\r\n    rc = fts3SegWriterAdd(p, &pWriter, 1, \r\n        csr.zTerm, csr.nTerm, csr.aDoclist, csr.nDoclist);\r\n  }\r\n  if( rc!=SQLITE_OK ) goto finished;\r\n  assert( pWriter );\r\n\r\n  if( iLevel!=FTS3_SEGCURSOR_PENDING ){\r\n    rc = fts3DeleteSegdir(\r\n        p, iLangid, iIndex, iLevel, csr.apSegment, csr.nSegment\r\n    );\r\n    if( rc!=SQLITE_OK ) goto finished;\r\n  }\r\n  rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);\r\n\r\n finished:\r\n  fts3SegWriterFree(pWriter);\r\n  sqlite3Fts3SegReaderFinish(&csr);\r\n  return rc;\r\n}\r\n\r\n\r\n/* \r\n** Flush the contents of pendingTerms to level 0 segments.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){\r\n  int rc = SQLITE_OK;\r\n  int i;\r\n  for(i=0; rc==SQLITE_OK && i<p->nIndex; i++){\r\n    rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING);\r\n    if( rc==SQLITE_DONE ) rc = SQLITE_OK;\r\n  }\r\n  sqlite3Fts3PendingTermsClear(p);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Encode N integers as varints into a blob.\r\n*/\r\nstatic void fts3EncodeIntArray(\r\n  int N,             /* The number of integers to encode */\r\n  u32 *a,            /* The integer values */\r\n  char *zBuf,        /* Write the BLOB here */\r\n  int *pNBuf         /* Write number of bytes if zBuf[] used here */\r\n){\r\n  int i, j;\r\n  for(i=j=0; i<N; i++){\r\n    j += sqlite3Fts3PutVarint(&zBuf[j], (sqlite3_int64)a[i]);\r\n  }\r\n  *pNBuf = j;\r\n}\r\n\r\n/*\r\n** Decode a blob of varints into N integers\r\n*/\r\nstatic void fts3DecodeIntArray(\r\n  int N,             /* The number of integers to decode */\r\n  u32 *a,            /* Write the integer values */\r\n  const char *zBuf,  /* The BLOB containing the varints */\r\n  int nBuf           /* size of the BLOB */\r\n){\r\n  int i, j;\r\n  UNUSED_PARAMETER(nBuf);\r\n  for(i=j=0; i<N; i++){\r\n    sqlite3_int64 x;\r\n    j += sqlite3Fts3GetVarint(&zBuf[j], &x);\r\n    assert(j<=nBuf);\r\n    a[i] = (u32)(x & 0xffffffff);\r\n  }\r\n}\r\n\r\n/*\r\n** Insert the sizes (in tokens) for each column of the document\r\n** with docid equal to p->iPrevDocid.  The sizes are encoded as\r\n** a blob of varints.\r\n*/\r\nstatic void fts3InsertDocsize(\r\n  int *pRC,                       /* Result code */\r\n  Fts3Table *p,                   /* Table into which to insert */\r\n  u32 *aSz                        /* Sizes of each column, in tokens */\r\n){\r\n  char *pBlob;             /* The BLOB encoding of the document size */\r\n  int nBlob;               /* Number of bytes in the BLOB */\r\n  sqlite3_stmt *pStmt;     /* Statement used to insert the encoding */\r\n  int rc;                  /* Result code from subfunctions */\r\n\r\n  if( *pRC ) return;\r\n  pBlob = sqlite3_malloc( 10*p->nColumn );\r\n  if( pBlob==0 ){\r\n    *pRC = SQLITE_NOMEM;\r\n    return;\r\n  }\r\n  fts3EncodeIntArray(p->nColumn, aSz, pBlob, &nBlob);\r\n  rc = fts3SqlStmt(p, SQL_REPLACE_DOCSIZE, &pStmt, 0);\r\n  if( rc ){\r\n    sqlite3_free(pBlob);\r\n    *pRC = rc;\r\n    return;\r\n  }\r\n  sqlite3_bind_int64(pStmt, 1, p->iPrevDocid);\r\n  sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, sqlite3_free);\r\n  sqlite3_step(pStmt);\r\n  *pRC = sqlite3_reset(pStmt);\r\n}\r\n\r\n/*\r\n** Record 0 of the %_stat table contains a blob consisting of N varints,\r\n** where N is the number of user defined columns in the fts3 table plus\r\n** two. If nCol is the number of user defined columns, then values of the \r\n** varints are set as follows:\r\n**\r\n**   Varint 0:       Total number of rows in the table.\r\n**\r\n**   Varint 1..nCol: For each column, the total number of tokens stored in\r\n**                   the column for all rows of the table.\r\n**\r\n**   Varint 1+nCol:  The total size, in bytes, of all text values in all\r\n**                   columns of all rows of the table.\r\n**\r\n*/\r\nstatic void fts3UpdateDocTotals(\r\n  int *pRC,                       /* The result code */\r\n  Fts3Table *p,                   /* Table being updated */\r\n  u32 *aSzIns,                    /* Size increases */\r\n  u32 *aSzDel,                    /* Size decreases */\r\n  int nChng                       /* Change in the number of documents */\r\n){\r\n  char *pBlob;             /* Storage for BLOB written into %_stat */\r\n  int nBlob;               /* Size of BLOB written into %_stat */\r\n  u32 *a;                  /* Array of integers that becomes the BLOB */\r\n  sqlite3_stmt *pStmt;     /* Statement for reading and writing */\r\n  int i;                   /* Loop counter */\r\n  int rc;                  /* Result code from subfunctions */\r\n\r\n  const int nStat = p->nColumn+2;\r\n\r\n  if( *pRC ) return;\r\n  a = sqlite3_malloc( (sizeof(u32)+10)*nStat );\r\n  if( a==0 ){\r\n    *pRC = SQLITE_NOMEM;\r\n    return;\r\n  }\r\n  pBlob = (char*)&a[nStat];\r\n  rc = fts3SqlStmt(p, SQL_SELECT_DOCTOTAL, &pStmt, 0);\r\n  if( rc ){\r\n    sqlite3_free(a);\r\n    *pRC = rc;\r\n    return;\r\n  }\r\n  if( sqlite3_step(pStmt)==SQLITE_ROW ){\r\n    fts3DecodeIntArray(nStat, a,\r\n         sqlite3_column_blob(pStmt, 0),\r\n         sqlite3_column_bytes(pStmt, 0));\r\n  }else{\r\n    memset(a, 0, sizeof(u32)*(nStat) );\r\n  }\r\n  sqlite3_reset(pStmt);\r\n  if( nChng<0 && a[0]<(u32)(-nChng) ){\r\n    a[0] = 0;\r\n  }else{\r\n    a[0] += nChng;\r\n  }\r\n  for(i=0; i<p->nColumn+1; i++){\r\n    u32 x = a[i+1];\r\n    if( x+aSzIns[i] < aSzDel[i] ){\r\n      x = 0;\r\n    }else{\r\n      x = x + aSzIns[i] - aSzDel[i];\r\n    }\r\n    a[i+1] = x;\r\n  }\r\n  fts3EncodeIntArray(nStat, a, pBlob, &nBlob);\r\n  rc = fts3SqlStmt(p, SQL_REPLACE_DOCTOTAL, &pStmt, 0);\r\n  if( rc ){\r\n    sqlite3_free(a);\r\n    *pRC = rc;\r\n    return;\r\n  }\r\n  sqlite3_bind_blob(pStmt, 1, pBlob, nBlob, SQLITE_STATIC);\r\n  sqlite3_step(pStmt);\r\n  *pRC = sqlite3_reset(pStmt);\r\n  sqlite3_free(a);\r\n}\r\n\r\n/*\r\n** Merge the entire database so that there is one segment for each \r\n** iIndex/iLangid combination.\r\n*/\r\nstatic int fts3DoOptimize(Fts3Table *p, int bReturnDone){\r\n  int bSeenDone = 0;\r\n  int rc;\r\n  sqlite3_stmt *pAllLangid = 0;\r\n\r\n  rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);\r\n  if( rc==SQLITE_OK ){\r\n    int rc2;\r\n    sqlite3_bind_int(pAllLangid, 1, p->nIndex);\r\n    while( sqlite3_step(pAllLangid)==SQLITE_ROW ){\r\n      int i;\r\n      int iLangid = sqlite3_column_int(pAllLangid, 0);\r\n      for(i=0; rc==SQLITE_OK && i<p->nIndex; i++){\r\n        rc = fts3SegmentMerge(p, iLangid, i, FTS3_SEGCURSOR_ALL);\r\n        if( rc==SQLITE_DONE ){\r\n          bSeenDone = 1;\r\n          rc = SQLITE_OK;\r\n        }\r\n      }\r\n    }\r\n    rc2 = sqlite3_reset(pAllLangid);\r\n    if( rc==SQLITE_OK ) rc = rc2;\r\n  }\r\n\r\n  sqlite3Fts3SegmentsClose(p);\r\n  sqlite3Fts3PendingTermsClear(p);\r\n\r\n  return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc;\r\n}\r\n\r\n/*\r\n** This function is called when the user executes the following statement:\r\n**\r\n**     INSERT INTO <tbl>(<tbl>) VALUES('rebuild');\r\n**\r\n** The entire FTS index is discarded and rebuilt. If the table is one \r\n** created using the content=xxx option, then the new index is based on\r\n** the current contents of the xxx table. Otherwise, it is rebuilt based\r\n** on the contents of the %_content table.\r\n*/\r\nstatic int fts3DoRebuild(Fts3Table *p){\r\n  int rc;                         /* Return Code */\r\n\r\n  rc = fts3DeleteAll(p, 0);\r\n  if( rc==SQLITE_OK ){\r\n    u32 *aSz = 0;\r\n    u32 *aSzIns = 0;\r\n    u32 *aSzDel = 0;\r\n    sqlite3_stmt *pStmt = 0;\r\n    int nEntry = 0;\r\n\r\n    /* Compose and prepare an SQL statement to loop through the content table */\r\n    char *zSql = sqlite3_mprintf(\"SELECT %s\" , p->zReadExprlist);\r\n    if( !zSql ){\r\n      rc = SQLITE_NOMEM;\r\n    }else{\r\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);\r\n      sqlite3_free(zSql);\r\n    }\r\n\r\n    if( rc==SQLITE_OK ){\r\n      int nByte = sizeof(u32) * (p->nColumn+1)*3;\r\n      aSz = (u32 *)sqlite3_malloc(nByte);\r\n      if( aSz==0 ){\r\n        rc = SQLITE_NOMEM;\r\n      }else{\r\n        memset(aSz, 0, nByte);\r\n        aSzIns = &aSz[p->nColumn+1];\r\n        aSzDel = &aSzIns[p->nColumn+1];\r\n      }\r\n    }\r\n\r\n    while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){\r\n      int iCol;\r\n      int iLangid = langidFromSelect(p, pStmt);\r\n      rc = fts3PendingTermsDocid(p, iLangid, sqlite3_column_int64(pStmt, 0));\r\n      aSz[p->nColumn] = 0;\r\n      for(iCol=0; rc==SQLITE_OK && iCol<p->nColumn; iCol++){\r\n        const char *z = (const char *) sqlite3_column_text(pStmt, iCol+1);\r\n        rc = fts3PendingTermsAdd(p, iLangid, z, iCol, &aSz[iCol]);\r\n        aSz[p->nColumn] += sqlite3_column_bytes(pStmt, iCol+1);\r\n      }\r\n      if( p->bHasDocsize ){\r\n        fts3InsertDocsize(&rc, p, aSz);\r\n      }\r\n      if( rc!=SQLITE_OK ){\r\n        sqlite3_finalize(pStmt);\r\n        pStmt = 0;\r\n      }else{\r\n        nEntry++;\r\n        for(iCol=0; iCol<=p->nColumn; iCol++){\r\n          aSzIns[iCol] += aSz[iCol];\r\n        }\r\n      }\r\n    }\r\n    if( p->bHasStat ){\r\n      fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nEntry);\r\n    }\r\n    sqlite3_free(aSz);\r\n\r\n    if( pStmt ){\r\n      int rc2 = sqlite3_finalize(pStmt);\r\n      if( rc==SQLITE_OK ){\r\n        rc = rc2;\r\n      }\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Handle a 'special' INSERT of the form:\r\n**\r\n**   \"INSERT INTO tbl(tbl) VALUES(<expr>)\"\r\n**\r\n** Argument pVal contains the result of <expr>. Currently the only \r\n** meaningful value to insert is the text 'optimize'.\r\n*/\r\nstatic int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){\r\n  int rc;                         /* Return Code */\r\n  const char *zVal = (const char *)sqlite3_value_text(pVal);\r\n  int nVal = sqlite3_value_bytes(pVal);\r\n\r\n  if( !zVal ){\r\n    return SQLITE_NOMEM;\r\n  }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, \"optimize\", 8) ){\r\n    rc = fts3DoOptimize(p, 0);\r\n  }else if( nVal==7 && 0==sqlite3_strnicmp(zVal, \"rebuild\", 7) ){\r\n    rc = fts3DoRebuild(p);\r\n#ifdef SQLITE_TEST\r\n  }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, \"nodesize=\", 9) ){\r\n    p->nNodeSize = atoi(&zVal[9]);\r\n    rc = SQLITE_OK;\r\n  }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, \"maxpending=\", 9) ){\r\n    p->nMaxPendingData = atoi(&zVal[11]);\r\n    rc = SQLITE_OK;\r\n#endif\r\n  }else{\r\n    rc = SQLITE_ERROR;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Delete all cached deferred doclists. Deferred doclists are cached\r\n** (allocated) by the sqlite3Fts3CacheDeferredDoclists() function.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *pCsr){\r\n  Fts3DeferredToken *pDef;\r\n  for(pDef=pCsr->pDeferred; pDef; pDef=pDef->pNext){\r\n    fts3PendingListDelete(pDef->pList);\r\n    pDef->pList = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Free all entries in the pCsr->pDeffered list. Entries are added to \r\n** this list using sqlite3Fts3DeferToken().\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *pCsr){\r\n  Fts3DeferredToken *pDef;\r\n  Fts3DeferredToken *pNext;\r\n  for(pDef=pCsr->pDeferred; pDef; pDef=pNext){\r\n    pNext = pDef->pNext;\r\n    fts3PendingListDelete(pDef->pList);\r\n    sqlite3_free(pDef);\r\n  }\r\n  pCsr->pDeferred = 0;\r\n}\r\n\r\n/*\r\n** Generate deferred-doclists for all tokens in the pCsr->pDeferred list\r\n** based on the row that pCsr currently points to.\r\n**\r\n** A deferred-doclist is like any other doclist with position information\r\n** included, except that it only contains entries for a single row of the\r\n** table, not for all rows.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *pCsr){\r\n  int rc = SQLITE_OK;             /* Return code */\r\n  if( pCsr->pDeferred ){\r\n    int i;                        /* Used to iterate through table columns */\r\n    sqlite3_int64 iDocid;         /* Docid of the row pCsr points to */\r\n    Fts3DeferredToken *pDef;      /* Used to iterate through deferred tokens */\r\n  \r\n    Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;\r\n    sqlite3_tokenizer *pT = p->pTokenizer;\r\n    sqlite3_tokenizer_module const *pModule = pT->pModule;\r\n   \r\n    assert( pCsr->isRequireSeek==0 );\r\n    iDocid = sqlite3_column_int64(pCsr->pStmt, 0);\r\n  \r\n    for(i=0; i<p->nColumn && rc==SQLITE_OK; i++){\r\n      const char *zText = (const char *)sqlite3_column_text(pCsr->pStmt, i+1);\r\n      sqlite3_tokenizer_cursor *pTC = 0;\r\n  \r\n      rc = sqlite3Fts3OpenTokenizer(pT, pCsr->iLangid, zText, -1, &pTC);\r\n      while( rc==SQLITE_OK ){\r\n        char const *zToken;       /* Buffer containing token */\r\n        int nToken;               /* Number of bytes in token */\r\n        int iDum1, iDum2;         /* Dummy variables */\r\n        int iPos;                 /* Position of token in zText */\r\n  \r\n        rc = pModule->xNext(pTC, &zToken, &nToken, &iDum1, &iDum2, &iPos);\r\n        for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){\r\n          Fts3PhraseToken *pPT = pDef->pToken;\r\n          if( (pDef->iCol>=p->nColumn || pDef->iCol==i)\r\n           && (pPT->bFirst==0 || iPos==0)\r\n           && (pPT->n==nToken || (pPT->isPrefix && pPT->n<nToken))\r\n           && (0==memcmp(zToken, pPT->z, pPT->n))\r\n          ){\r\n            fts3PendingListAppend(&pDef->pList, iDocid, i, iPos, &rc);\r\n          }\r\n        }\r\n      }\r\n      if( pTC ) pModule->xClose(pTC);\r\n      if( rc==SQLITE_DONE ) rc = SQLITE_OK;\r\n    }\r\n  \r\n    for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){\r\n      if( pDef->pList ){\r\n        rc = fts3PendingListAppendVarint(&pDef->pList, 0);\r\n      }\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\nSQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(\r\n  Fts3DeferredToken *p, \r\n  char **ppData, \r\n  int *pnData\r\n){\r\n  char *pRet;\r\n  int nSkip;\r\n  sqlite3_int64 dummy;\r\n\r\n  *ppData = 0;\r\n  *pnData = 0;\r\n\r\n  if( p->pList==0 ){\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  pRet = (char *)sqlite3_malloc(p->pList->nData);\r\n  if( !pRet ) return SQLITE_NOMEM;\r\n\r\n  nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);\r\n  *pnData = p->pList->nData - nSkip;\r\n  *ppData = pRet;\r\n  \r\n  memcpy(pRet, &p->pList->aData[nSkip], *pnData);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Add an entry for token pToken to the pCsr->pDeferred list.\r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3DeferToken(\r\n  Fts3Cursor *pCsr,               /* Fts3 table cursor */\r\n  Fts3PhraseToken *pToken,        /* Token to defer */\r\n  int iCol                        /* Column that token must appear in (or -1) */\r\n){\r\n  Fts3DeferredToken *pDeferred;\r\n  pDeferred = sqlite3_malloc(sizeof(*pDeferred));\r\n  if( !pDeferred ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pDeferred, 0, sizeof(*pDeferred));\r\n  pDeferred->pToken = pToken;\r\n  pDeferred->pNext = pCsr->pDeferred; \r\n  pDeferred->iCol = iCol;\r\n  pCsr->pDeferred = pDeferred;\r\n\r\n  assert( pToken->pDeferred==0 );\r\n  pToken->pDeferred = pDeferred;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** SQLite value pRowid contains the rowid of a row that may or may not be\r\n** present in the FTS3 table. If it is, delete it and adjust the contents\r\n** of subsiduary data structures accordingly.\r\n*/\r\nstatic int fts3DeleteByRowid(\r\n  Fts3Table *p, \r\n  sqlite3_value *pRowid, \r\n  int *pnDoc,\r\n  u32 *aSzDel\r\n){\r\n  int isEmpty = 0;\r\n  int rc = fts3IsEmpty(p, pRowid, &isEmpty);\r\n  if( rc==SQLITE_OK ){\r\n    if( isEmpty ){\r\n      /* Deleting this row means the whole table is empty. In this case\r\n      ** delete the contents of all three tables and throw away any\r\n      ** data in the pendingTerms hash table.  */\r\n      rc = fts3DeleteAll(p, 1);\r\n      *pnDoc = *pnDoc - 1;\r\n    }else{\r\n      fts3DeleteTerms(&rc, p, pRowid, aSzDel);\r\n      if( p->zContentTbl==0 ){\r\n        fts3SqlExec(&rc, p, SQL_DELETE_CONTENT, &pRowid);\r\n        if( sqlite3_changes(p->db) ) *pnDoc = *pnDoc - 1;\r\n      }else{\r\n        *pnDoc = *pnDoc - 1;\r\n      }\r\n      if( p->bHasDocsize ){\r\n        fts3SqlExec(&rc, p, SQL_DELETE_DOCSIZE, &pRowid);\r\n      }\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function does the work for the xUpdate method of FTS3 virtual\r\n** tables. The schema of the virtual table being:\r\n**\r\n**     CREATE TABLE <table name>( \r\n**       <user COLUMns>,\r\n**       <table name> HIDDEN, \r\n**       docid HIDDEN, \r\n**       <langid> HIDDEN\r\n**     );\r\n**\r\n** \r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3UpdateMethod(\r\n  sqlite3_vtab *pVtab,            /* FTS3 vtab object */\r\n  int nArg,                       /* Size of argument array */\r\n  sqlite3_value **apVal,          /* Array of arguments */\r\n  sqlite_int64 *pRowid            /* OUT: The affected (or effected) rowid */\r\n){\r\n  Fts3Table *p = (Fts3Table *)pVtab;\r\n  int rc = SQLITE_OK;             /* Return Code */\r\n  int isRemove = 0;               /* True for an UPDATE or DELETE */\r\n  u32 *aSzIns = 0;                /* Sizes of inserted documents */\r\n  u32 *aSzDel;                    /* Sizes of deleted documents */\r\n  int nChng = 0;                  /* Net change in number of documents */\r\n  int bInsertDone = 0;\r\n\r\n  assert( p->pSegments==0 );\r\n  assert( \r\n      nArg==1                     /* DELETE operations */\r\n   || nArg==(2 + p->nColumn + 3)  /* INSERT or UPDATE operations */\r\n  );\r\n\r\n  /* Check for a \"special\" INSERT operation. One of the form:\r\n  **\r\n  **   INSERT INTO xyz(xyz) VALUES('command');\r\n  */\r\n  if( nArg>1 \r\n   && sqlite3_value_type(apVal[0])==SQLITE_NULL \r\n   && sqlite3_value_type(apVal[p->nColumn+2])!=SQLITE_NULL \r\n  ){\r\n    rc = fts3SpecialInsert(p, apVal[p->nColumn+2]);\r\n    goto update_out;\r\n  }\r\n\r\n  if( nArg>1 && sqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){\r\n    rc = SQLITE_CONSTRAINT;\r\n    goto update_out;\r\n  }\r\n\r\n  /* Allocate space to hold the change in document sizes */\r\n  aSzIns = sqlite3_malloc( sizeof(aSzIns[0])*(p->nColumn+1)*2 );\r\n  if( aSzIns==0 ){\r\n    rc = SQLITE_NOMEM;\r\n    goto update_out;\r\n  }\r\n  aSzDel = &aSzIns[p->nColumn+1];\r\n  memset(aSzIns, 0, sizeof(aSzIns[0])*(p->nColumn+1)*2);\r\n\r\n  /* If this is an INSERT operation, or an UPDATE that modifies the rowid\r\n  ** value, then this operation requires constraint handling.\r\n  **\r\n  ** If the on-conflict mode is REPLACE, this means that the existing row\r\n  ** should be deleted from the database before inserting the new row. Or,\r\n  ** if the on-conflict mode is other than REPLACE, then this method must\r\n  ** detect the conflict and return SQLITE_CONSTRAINT before beginning to\r\n  ** modify the database file.\r\n  */\r\n  if( nArg>1 && p->zContentTbl==0 ){\r\n    /* Find the value object that holds the new rowid value. */\r\n    sqlite3_value *pNewRowid = apVal[3+p->nColumn];\r\n    if( sqlite3_value_type(pNewRowid)==SQLITE_NULL ){\r\n      pNewRowid = apVal[1];\r\n    }\r\n\r\n    if( sqlite3_value_type(pNewRowid)!=SQLITE_NULL && ( \r\n        sqlite3_value_type(apVal[0])==SQLITE_NULL\r\n     || sqlite3_value_int64(apVal[0])!=sqlite3_value_int64(pNewRowid)\r\n    )){\r\n      /* The new rowid is not NULL (in this case the rowid will be\r\n      ** automatically assigned and there is no chance of a conflict), and \r\n      ** the statement is either an INSERT or an UPDATE that modifies the\r\n      ** rowid column. So if the conflict mode is REPLACE, then delete any\r\n      ** existing row with rowid=pNewRowid. \r\n      **\r\n      ** Or, if the conflict mode is not REPLACE, insert the new record into \r\n      ** the %_content table. If we hit the duplicate rowid constraint (or any\r\n      ** other error) while doing so, return immediately.\r\n      **\r\n      ** This branch may also run if pNewRowid contains a value that cannot\r\n      ** be losslessly converted to an integer. In this case, the eventual \r\n      ** call to fts3InsertData() (either just below or further on in this\r\n      ** function) will return SQLITE_MISMATCH. If fts3DeleteByRowid is \r\n      ** invoked, it will delete zero rows (since no row will have\r\n      ** docid=$pNewRowid if $pNewRowid is not an integer value).\r\n      */\r\n      if( sqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){\r\n        rc = fts3DeleteByRowid(p, pNewRowid, &nChng, aSzDel);\r\n      }else{\r\n        rc = fts3InsertData(p, apVal, pRowid);\r\n        bInsertDone = 1;\r\n      }\r\n    }\r\n  }\r\n  if( rc!=SQLITE_OK ){\r\n    goto update_out;\r\n  }\r\n\r\n  /* If this is a DELETE or UPDATE operation, remove the old record. */\r\n  if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){\r\n    assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER );\r\n    rc = fts3DeleteByRowid(p, apVal[0], &nChng, aSzDel);\r\n    isRemove = 1;\r\n  }\r\n  \r\n  /* If this is an INSERT or UPDATE operation, insert the new record. */\r\n  if( nArg>1 && rc==SQLITE_OK ){\r\n    int iLangid = sqlite3_value_int(apVal[2 + p->nColumn + 2]);\r\n    if( bInsertDone==0 ){\r\n      rc = fts3InsertData(p, apVal, pRowid);\r\n      if( rc==SQLITE_CONSTRAINT && p->zContentTbl==0 ){\r\n        rc = FTS_CORRUPT_VTAB;\r\n      }\r\n    }\r\n    if( rc==SQLITE_OK && (!isRemove || *pRowid!=p->iPrevDocid ) ){\r\n      rc = fts3PendingTermsDocid(p, iLangid, *pRowid);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      assert( p->iPrevDocid==*pRowid );\r\n      rc = fts3InsertTerms(p, iLangid, apVal, aSzIns);\r\n    }\r\n    if( p->bHasDocsize ){\r\n      fts3InsertDocsize(&rc, p, aSzIns);\r\n    }\r\n    nChng++;\r\n  }\r\n\r\n  if( p->bHasStat ){\r\n    fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nChng);\r\n  }\r\n\r\n update_out:\r\n  sqlite3_free(aSzIns);\r\n  sqlite3Fts3SegmentsClose(p);\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Flush any data in the pending-terms hash table to disk. If successful,\r\n** merge all segments in the database (including the new segment, if \r\n** there was any data to flush) into a single segment. \r\n*/\r\nSQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *p){\r\n  int rc;\r\n  rc = sqlite3_exec(p->db, \"SAVEPOINT fts3\", 0, 0, 0);\r\n  if( rc==SQLITE_OK ){\r\n    rc = fts3DoOptimize(p, 1);\r\n    if( rc==SQLITE_OK || rc==SQLITE_DONE ){\r\n      int rc2 = sqlite3_exec(p->db, \"RELEASE fts3\", 0, 0, 0);\r\n      if( rc2!=SQLITE_OK ) rc = rc2;\r\n    }else{\r\n      sqlite3_exec(p->db, \"ROLLBACK TO fts3\", 0, 0, 0);\r\n      sqlite3_exec(p->db, \"RELEASE fts3\", 0, 0, 0);\r\n    }\r\n  }\r\n  sqlite3Fts3SegmentsClose(p);\r\n  return rc;\r\n}\r\n\r\n#endif\r\n\r\n/************** End of fts3_write.c ******************************************/\r\n/************** Begin file fts3_snippet.c ************************************/\r\n/*\r\n** 2009 Oct 23\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n******************************************************************************\r\n*/\r\n\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n\r\n/* #include <string.h> */\r\n/* #include <assert.h> */\r\n\r\n/*\r\n** Characters that may appear in the second argument to matchinfo().\r\n*/\r\n#define FTS3_MATCHINFO_NPHRASE   'p'        /* 1 value */\r\n#define FTS3_MATCHINFO_NCOL      'c'        /* 1 value */\r\n#define FTS3_MATCHINFO_NDOC      'n'        /* 1 value */\r\n#define FTS3_MATCHINFO_AVGLENGTH 'a'        /* nCol values */\r\n#define FTS3_MATCHINFO_LENGTH    'l'        /* nCol values */\r\n#define FTS3_MATCHINFO_LCS       's'        /* nCol values */\r\n#define FTS3_MATCHINFO_HITS      'x'        /* 3*nCol*nPhrase values */\r\n\r\n/*\r\n** The default value for the second argument to matchinfo(). \r\n*/\r\n#define FTS3_MATCHINFO_DEFAULT   \"pcx\"\r\n\r\n\r\n/*\r\n** Used as an fts3ExprIterate() context when loading phrase doclists to\r\n** Fts3Expr.aDoclist[]/nDoclist.\r\n*/\r\ntypedef struct LoadDoclistCtx LoadDoclistCtx;\r\nstruct LoadDoclistCtx {\r\n  Fts3Cursor *pCsr;               /* FTS3 Cursor */\r\n  int nPhrase;                    /* Number of phrases seen so far */\r\n  int nToken;                     /* Number of tokens seen so far */\r\n};\r\n\r\n/*\r\n** The following types are used as part of the implementation of the \r\n** fts3BestSnippet() routine.\r\n*/\r\ntypedef struct SnippetIter SnippetIter;\r\ntypedef struct SnippetPhrase SnippetPhrase;\r\ntypedef struct SnippetFragment SnippetFragment;\r\n\r\nstruct SnippetIter {\r\n  Fts3Cursor *pCsr;               /* Cursor snippet is being generated from */\r\n  int iCol;                       /* Extract snippet from this column */\r\n  int nSnippet;                   /* Requested snippet length (in tokens) */\r\n  int nPhrase;                    /* Number of phrases in query */\r\n  SnippetPhrase *aPhrase;         /* Array of size nPhrase */\r\n  int iCurrent;                   /* First token of current snippet */\r\n};\r\n\r\nstruct SnippetPhrase {\r\n  int nToken;                     /* Number of tokens in phrase */\r\n  char *pList;                    /* Pointer to start of phrase position list */\r\n  int iHead;                      /* Next value in position list */\r\n  char *pHead;                    /* Position list data following iHead */\r\n  int iTail;                      /* Next value in trailing position list */\r\n  char *pTail;                    /* Position list data following iTail */\r\n};\r\n\r\nstruct SnippetFragment {\r\n  int iCol;                       /* Column snippet is extracted from */\r\n  int iPos;                       /* Index of first token in snippet */\r\n  u64 covered;                    /* Mask of query phrases covered */\r\n  u64 hlmask;                     /* Mask of snippet terms to highlight */\r\n};\r\n\r\n/*\r\n** This type is used as an fts3ExprIterate() context object while \r\n** accumulating the data returned by the matchinfo() function.\r\n*/\r\ntypedef struct MatchInfo MatchInfo;\r\nstruct MatchInfo {\r\n  Fts3Cursor *pCursor;            /* FTS3 Cursor */\r\n  int nCol;                       /* Number of columns in table */\r\n  int nPhrase;                    /* Number of matchable phrases in query */\r\n  sqlite3_int64 nDoc;             /* Number of docs in database */\r\n  u32 *aMatchinfo;                /* Pre-allocated buffer */\r\n};\r\n\r\n\r\n\r\n/*\r\n** The snippet() and offsets() functions both return text values. An instance\r\n** of the following structure is used to accumulate those values while the\r\n** functions are running. See fts3StringAppend() for details.\r\n*/\r\ntypedef struct StrBuffer StrBuffer;\r\nstruct StrBuffer {\r\n  char *z;                        /* Pointer to buffer containing string */\r\n  int n;                          /* Length of z in bytes (excl. nul-term) */\r\n  int nAlloc;                     /* Allocated size of buffer z in bytes */\r\n};\r\n\r\n\r\n/*\r\n** This function is used to help iterate through a position-list. A position\r\n** list is a list of unique integers, sorted from smallest to largest. Each\r\n** element of the list is represented by an FTS3 varint that takes the value\r\n** of the difference between the current element and the previous one plus\r\n** two. For example, to store the position-list:\r\n**\r\n**     4 9 113\r\n**\r\n** the three varints:\r\n**\r\n**     6 7 106\r\n**\r\n** are encoded.\r\n**\r\n** When this function is called, *pp points to the start of an element of\r\n** the list. *piPos contains the value of the previous entry in the list.\r\n** After it returns, *piPos contains the value of the next element of the\r\n** list and *pp is advanced to the following varint.\r\n*/\r\nstatic void fts3GetDeltaPosition(char **pp, int *piPos){\r\n  int iVal;\r\n  *pp += sqlite3Fts3GetVarint32(*pp, &iVal);\r\n  *piPos += (iVal-2);\r\n}\r\n\r\n/*\r\n** Helper function for fts3ExprIterate() (see below).\r\n*/\r\nstatic int fts3ExprIterate2(\r\n  Fts3Expr *pExpr,                /* Expression to iterate phrases of */\r\n  int *piPhrase,                  /* Pointer to phrase counter */\r\n  int (*x)(Fts3Expr*,int,void*),  /* Callback function to invoke for phrases */\r\n  void *pCtx                      /* Second argument to pass to callback */\r\n){\r\n  int rc;                         /* Return code */\r\n  int eType = pExpr->eType;       /* Type of expression node pExpr */\r\n\r\n  if( eType!=FTSQUERY_PHRASE ){\r\n    assert( pExpr->pLeft && pExpr->pRight );\r\n    rc = fts3ExprIterate2(pExpr->pLeft, piPhrase, x, pCtx);\r\n    if( rc==SQLITE_OK && eType!=FTSQUERY_NOT ){\r\n      rc = fts3ExprIterate2(pExpr->pRight, piPhrase, x, pCtx);\r\n    }\r\n  }else{\r\n    rc = x(pExpr, *piPhrase, pCtx);\r\n    (*piPhrase)++;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Iterate through all phrase nodes in an FTS3 query, except those that\r\n** are part of a sub-tree that is the right-hand-side of a NOT operator.\r\n** For each phrase node found, the supplied callback function is invoked.\r\n**\r\n** If the callback function returns anything other than SQLITE_OK, \r\n** the iteration is abandoned and the error code returned immediately.\r\n** Otherwise, SQLITE_OK is returned after a callback has been made for\r\n** all eligible phrase nodes.\r\n*/\r\nstatic int fts3ExprIterate(\r\n  Fts3Expr *pExpr,                /* Expression to iterate phrases of */\r\n  int (*x)(Fts3Expr*,int,void*),  /* Callback function to invoke for phrases */\r\n  void *pCtx                      /* Second argument to pass to callback */\r\n){\r\n  int iPhrase = 0;                /* Variable used as the phrase counter */\r\n  return fts3ExprIterate2(pExpr, &iPhrase, x, pCtx);\r\n}\r\n\r\n/*\r\n** This is an fts3ExprIterate() callback used while loading the doclists\r\n** for each phrase into Fts3Expr.aDoclist[]/nDoclist. See also\r\n** fts3ExprLoadDoclists().\r\n*/\r\nstatic int fts3ExprLoadDoclistsCb(Fts3Expr *pExpr, int iPhrase, void *ctx){\r\n  int rc = SQLITE_OK;\r\n  Fts3Phrase *pPhrase = pExpr->pPhrase;\r\n  LoadDoclistCtx *p = (LoadDoclistCtx *)ctx;\r\n\r\n  UNUSED_PARAMETER(iPhrase);\r\n\r\n  p->nPhrase++;\r\n  p->nToken += pPhrase->nToken;\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Load the doclists for each phrase in the query associated with FTS3 cursor\r\n** pCsr. \r\n**\r\n** If pnPhrase is not NULL, then *pnPhrase is set to the number of matchable \r\n** phrases in the expression (all phrases except those directly or \r\n** indirectly descended from the right-hand-side of a NOT operator). If \r\n** pnToken is not NULL, then it is set to the number of tokens in all\r\n** matchable phrases of the expression.\r\n*/\r\nstatic int fts3ExprLoadDoclists(\r\n  Fts3Cursor *pCsr,               /* Fts3 cursor for current query */\r\n  int *pnPhrase,                  /* OUT: Number of phrases in query */\r\n  int *pnToken                    /* OUT: Number of tokens in query */\r\n){\r\n  int rc;                         /* Return Code */\r\n  LoadDoclistCtx sCtx = {0,0,0};  /* Context for fts3ExprIterate() */\r\n  sCtx.pCsr = pCsr;\r\n  rc = fts3ExprIterate(pCsr->pExpr, fts3ExprLoadDoclistsCb, (void *)&sCtx);\r\n  if( pnPhrase ) *pnPhrase = sCtx.nPhrase;\r\n  if( pnToken ) *pnToken = sCtx.nToken;\r\n  return rc;\r\n}\r\n\r\nstatic int fts3ExprPhraseCountCb(Fts3Expr *pExpr, int iPhrase, void *ctx){\r\n  (*(int *)ctx)++;\r\n  UNUSED_PARAMETER(pExpr);\r\n  UNUSED_PARAMETER(iPhrase);\r\n  return SQLITE_OK;\r\n}\r\nstatic int fts3ExprPhraseCount(Fts3Expr *pExpr){\r\n  int nPhrase = 0;\r\n  (void)fts3ExprIterate(pExpr, fts3ExprPhraseCountCb, (void *)&nPhrase);\r\n  return nPhrase;\r\n}\r\n\r\n/*\r\n** Advance the position list iterator specified by the first two \r\n** arguments so that it points to the first element with a value greater\r\n** than or equal to parameter iNext.\r\n*/\r\nstatic void fts3SnippetAdvance(char **ppIter, int *piIter, int iNext){\r\n  char *pIter = *ppIter;\r\n  if( pIter ){\r\n    int iIter = *piIter;\r\n\r\n    while( iIter<iNext ){\r\n      if( 0==(*pIter & 0xFE) ){\r\n        iIter = -1;\r\n        pIter = 0;\r\n        break;\r\n      }\r\n      fts3GetDeltaPosition(&pIter, &iIter);\r\n    }\r\n\r\n    *piIter = iIter;\r\n    *ppIter = pIter;\r\n  }\r\n}\r\n\r\n/*\r\n** Advance the snippet iterator to the next candidate snippet.\r\n*/\r\nstatic int fts3SnippetNextCandidate(SnippetIter *pIter){\r\n  int i;                          /* Loop counter */\r\n\r\n  if( pIter->iCurrent<0 ){\r\n    /* The SnippetIter object has just been initialized. The first snippet\r\n    ** candidate always starts at offset 0 (even if this candidate has a\r\n    ** score of 0.0).\r\n    */\r\n    pIter->iCurrent = 0;\r\n\r\n    /* Advance the 'head' iterator of each phrase to the first offset that\r\n    ** is greater than or equal to (iNext+nSnippet).\r\n    */\r\n    for(i=0; i<pIter->nPhrase; i++){\r\n      SnippetPhrase *pPhrase = &pIter->aPhrase[i];\r\n      fts3SnippetAdvance(&pPhrase->pHead, &pPhrase->iHead, pIter->nSnippet);\r\n    }\r\n  }else{\r\n    int iStart;\r\n    int iEnd = 0x7FFFFFFF;\r\n\r\n    for(i=0; i<pIter->nPhrase; i++){\r\n      SnippetPhrase *pPhrase = &pIter->aPhrase[i];\r\n      if( pPhrase->pHead && pPhrase->iHead<iEnd ){\r\n        iEnd = pPhrase->iHead;\r\n      }\r\n    }\r\n    if( iEnd==0x7FFFFFFF ){\r\n      return 1;\r\n    }\r\n\r\n    pIter->iCurrent = iStart = iEnd - pIter->nSnippet + 1;\r\n    for(i=0; i<pIter->nPhrase; i++){\r\n      SnippetPhrase *pPhrase = &pIter->aPhrase[i];\r\n      fts3SnippetAdvance(&pPhrase->pHead, &pPhrase->iHead, iEnd+1);\r\n      fts3SnippetAdvance(&pPhrase->pTail, &pPhrase->iTail, iStart);\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Retrieve information about the current candidate snippet of snippet \r\n** iterator pIter.\r\n*/\r\nstatic void fts3SnippetDetails(\r\n  SnippetIter *pIter,             /* Snippet iterator */\r\n  u64 mCovered,                   /* Bitmask of phrases already covered */\r\n  int *piToken,                   /* OUT: First token of proposed snippet */\r\n  int *piScore,                   /* OUT: \"Score\" for this snippet */\r\n  u64 *pmCover,                   /* OUT: Bitmask of phrases covered */\r\n  u64 *pmHighlight                /* OUT: Bitmask of terms to highlight */\r\n){\r\n  int iStart = pIter->iCurrent;   /* First token of snippet */\r\n  int iScore = 0;                 /* Score of this snippet */\r\n  int i;                          /* Loop counter */\r\n  u64 mCover = 0;                 /* Mask of phrases covered by this snippet */\r\n  u64 mHighlight = 0;             /* Mask of tokens to highlight in snippet */\r\n\r\n  for(i=0; i<pIter->nPhrase; i++){\r\n    SnippetPhrase *pPhrase = &pIter->aPhrase[i];\r\n    if( pPhrase->pTail ){\r\n      char *pCsr = pPhrase->pTail;\r\n      int iCsr = pPhrase->iTail;\r\n\r\n      while( iCsr<(iStart+pIter->nSnippet) ){\r\n        int j;\r\n        u64 mPhrase = (u64)1 << i;\r\n        u64 mPos = (u64)1 << (iCsr - iStart);\r\n        assert( iCsr>=iStart );\r\n        if( (mCover|mCovered)&mPhrase ){\r\n          iScore++;\r\n        }else{\r\n          iScore += 1000;\r\n        }\r\n        mCover |= mPhrase;\r\n\r\n        for(j=0; j<pPhrase->nToken; j++){\r\n          mHighlight |= (mPos>>j);\r\n        }\r\n\r\n        if( 0==(*pCsr & 0x0FE) ) break;\r\n        fts3GetDeltaPosition(&pCsr, &iCsr);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Set the output variables before returning. */\r\n  *piToken = iStart;\r\n  *piScore = iScore;\r\n  *pmCover = mCover;\r\n  *pmHighlight = mHighlight;\r\n}\r\n\r\n/*\r\n** This function is an fts3ExprIterate() callback used by fts3BestSnippet().\r\n** Each invocation populates an element of the SnippetIter.aPhrase[] array.\r\n*/\r\nstatic int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){\r\n  SnippetIter *p = (SnippetIter *)ctx;\r\n  SnippetPhrase *pPhrase = &p->aPhrase[iPhrase];\r\n  char *pCsr;\r\n\r\n  pPhrase->nToken = pExpr->pPhrase->nToken;\r\n\r\n  pCsr = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol);\r\n  if( pCsr ){\r\n    int iFirst = 0;\r\n    pPhrase->pList = pCsr;\r\n    fts3GetDeltaPosition(&pCsr, &iFirst);\r\n    assert( iFirst>=0 );\r\n    pPhrase->pHead = pCsr;\r\n    pPhrase->pTail = pCsr;\r\n    pPhrase->iHead = iFirst;\r\n    pPhrase->iTail = iFirst;\r\n  }else{\r\n    assert( pPhrase->pList==0 && pPhrase->pHead==0 && pPhrase->pTail==0 );\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Select the fragment of text consisting of nFragment contiguous tokens \r\n** from column iCol that represent the \"best\" snippet. The best snippet\r\n** is the snippet with the highest score, where scores are calculated\r\n** by adding:\r\n**\r\n**   (a) +1 point for each occurence of a matchable phrase in the snippet.\r\n**\r\n**   (b) +1000 points for the first occurence of each matchable phrase in \r\n**       the snippet for which the corresponding mCovered bit is not set.\r\n**\r\n** The selected snippet parameters are stored in structure *pFragment before\r\n** returning. The score of the selected snippet is stored in *piScore\r\n** before returning.\r\n*/\r\nstatic int fts3BestSnippet(\r\n  int nSnippet,                   /* Desired snippet length */\r\n  Fts3Cursor *pCsr,               /* Cursor to create snippet for */\r\n  int iCol,                       /* Index of column to create snippet from */\r\n  u64 mCovered,                   /* Mask of phrases already covered */\r\n  u64 *pmSeen,                    /* IN/OUT: Mask of phrases seen */\r\n  SnippetFragment *pFragment,     /* OUT: Best snippet found */\r\n  int *piScore                    /* OUT: Score of snippet pFragment */\r\n){\r\n  int rc;                         /* Return Code */\r\n  int nList;                      /* Number of phrases in expression */\r\n  SnippetIter sIter;              /* Iterates through snippet candidates */\r\n  int nByte;                      /* Number of bytes of space to allocate */\r\n  int iBestScore = -1;            /* Best snippet score found so far */\r\n  int i;                          /* Loop counter */\r\n\r\n  memset(&sIter, 0, sizeof(sIter));\r\n\r\n  /* Iterate through the phrases in the expression to count them. The same\r\n  ** callback makes sure the doclists are loaded for each phrase.\r\n  */\r\n  rc = fts3ExprLoadDoclists(pCsr, &nList, 0);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  /* Now that it is known how many phrases there are, allocate and zero\r\n  ** the required space using malloc().\r\n  */\r\n  nByte = sizeof(SnippetPhrase) * nList;\r\n  sIter.aPhrase = (SnippetPhrase *)sqlite3_malloc(nByte);\r\n  if( !sIter.aPhrase ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(sIter.aPhrase, 0, nByte);\r\n\r\n  /* Initialize the contents of the SnippetIter object. Then iterate through\r\n  ** the set of phrases in the expression to populate the aPhrase[] array.\r\n  */\r\n  sIter.pCsr = pCsr;\r\n  sIter.iCol = iCol;\r\n  sIter.nSnippet = nSnippet;\r\n  sIter.nPhrase = nList;\r\n  sIter.iCurrent = -1;\r\n  (void)fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);\r\n\r\n  /* Set the *pmSeen output variable. */\r\n  for(i=0; i<nList; i++){\r\n    if( sIter.aPhrase[i].pHead ){\r\n      *pmSeen |= (u64)1 << i;\r\n    }\r\n  }\r\n\r\n  /* Loop through all candidate snippets. Store the best snippet in \r\n  ** *pFragment. Store its associated 'score' in iBestScore.\r\n  */\r\n  pFragment->iCol = iCol;\r\n  while( !fts3SnippetNextCandidate(&sIter) ){\r\n    int iPos;\r\n    int iScore;\r\n    u64 mCover;\r\n    u64 mHighlight;\r\n    fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover, &mHighlight);\r\n    assert( iScore>=0 );\r\n    if( iScore>iBestScore ){\r\n      pFragment->iPos = iPos;\r\n      pFragment->hlmask = mHighlight;\r\n      pFragment->covered = mCover;\r\n      iBestScore = iScore;\r\n    }\r\n  }\r\n\r\n  sqlite3_free(sIter.aPhrase);\r\n  *piScore = iBestScore;\r\n  return SQLITE_OK;\r\n}\r\n\r\n\r\n/*\r\n** Append a string to the string-buffer passed as the first argument.\r\n**\r\n** If nAppend is negative, then the length of the string zAppend is\r\n** determined using strlen().\r\n*/\r\nstatic int fts3StringAppend(\r\n  StrBuffer *pStr,                /* Buffer to append to */\r\n  const char *zAppend,            /* Pointer to data to append to buffer */\r\n  int nAppend                     /* Size of zAppend in bytes (or -1) */\r\n){\r\n  if( nAppend<0 ){\r\n    nAppend = (int)strlen(zAppend);\r\n  }\r\n\r\n  /* If there is insufficient space allocated at StrBuffer.z, use realloc()\r\n  ** to grow the buffer until so that it is big enough to accomadate the\r\n  ** appended data.\r\n  */\r\n  if( pStr->n+nAppend+1>=pStr->nAlloc ){\r\n    int nAlloc = pStr->nAlloc+nAppend+100;\r\n    char *zNew = sqlite3_realloc(pStr->z, nAlloc);\r\n    if( !zNew ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    pStr->z = zNew;\r\n    pStr->nAlloc = nAlloc;\r\n  }\r\n\r\n  /* Append the data to the string buffer. */\r\n  memcpy(&pStr->z[pStr->n], zAppend, nAppend);\r\n  pStr->n += nAppend;\r\n  pStr->z[pStr->n] = '\\0';\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The fts3BestSnippet() function often selects snippets that end with a\r\n** query term. That is, the final term of the snippet is always a term\r\n** that requires highlighting. For example, if 'X' is a highlighted term\r\n** and '.' is a non-highlighted term, BestSnippet() may select:\r\n**\r\n**     ........X.....X\r\n**\r\n** This function \"shifts\" the beginning of the snippet forward in the \r\n** document so that there are approximately the same number of \r\n** non-highlighted terms to the right of the final highlighted term as there\r\n** are to the left of the first highlighted term. For example, to this:\r\n**\r\n**     ....X.....X....\r\n**\r\n** This is done as part of extracting the snippet text, not when selecting\r\n** the snippet. Snippet selection is done based on doclists only, so there\r\n** is no way for fts3BestSnippet() to know whether or not the document \r\n** actually contains terms that follow the final highlighted term. \r\n*/\r\nstatic int fts3SnippetShift(\r\n  Fts3Table *pTab,                /* FTS3 table snippet comes from */\r\n  int iLangid,                    /* Language id to use in tokenizing */\r\n  int nSnippet,                   /* Number of tokens desired for snippet */\r\n  const char *zDoc,               /* Document text to extract snippet from */\r\n  int nDoc,                       /* Size of buffer zDoc in bytes */\r\n  int *piPos,                     /* IN/OUT: First token of snippet */\r\n  u64 *pHlmask                    /* IN/OUT: Mask of tokens to highlight */\r\n){\r\n  u64 hlmask = *pHlmask;          /* Local copy of initial highlight-mask */\r\n\r\n  if( hlmask ){\r\n    int nLeft;                    /* Tokens to the left of first highlight */\r\n    int nRight;                   /* Tokens to the right of last highlight */\r\n    int nDesired;                 /* Ideal number of tokens to shift forward */\r\n\r\n    for(nLeft=0; !(hlmask & ((u64)1 << nLeft)); nLeft++);\r\n    for(nRight=0; !(hlmask & ((u64)1 << (nSnippet-1-nRight))); nRight++);\r\n    nDesired = (nLeft-nRight)/2;\r\n\r\n    /* Ideally, the start of the snippet should be pushed forward in the\r\n    ** document nDesired tokens. This block checks if there are actually\r\n    ** nDesired tokens to the right of the snippet. If so, *piPos and\r\n    ** *pHlMask are updated to shift the snippet nDesired tokens to the\r\n    ** right. Otherwise, the snippet is shifted by the number of tokens\r\n    ** available.\r\n    */\r\n    if( nDesired>0 ){\r\n      int nShift;                 /* Number of tokens to shift snippet by */\r\n      int iCurrent = 0;           /* Token counter */\r\n      int rc;                     /* Return Code */\r\n      sqlite3_tokenizer_module *pMod;\r\n      sqlite3_tokenizer_cursor *pC;\r\n      pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;\r\n\r\n      /* Open a cursor on zDoc/nDoc. Check if there are (nSnippet+nDesired)\r\n      ** or more tokens in zDoc/nDoc.\r\n      */\r\n      rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n      while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){\r\n        const char *ZDUMMY; int DUMMY1, DUMMY2, DUMMY3;\r\n        rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &DUMMY2, &DUMMY3, &iCurrent);\r\n      }\r\n      pMod->xClose(pC);\r\n      if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){ return rc; }\r\n\r\n      nShift = (rc==SQLITE_DONE)+iCurrent-nSnippet;\r\n      assert( nShift<=nDesired );\r\n      if( nShift>0 ){\r\n        *piPos += nShift;\r\n        *pHlmask = hlmask >> nShift;\r\n      }\r\n    }\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Extract the snippet text for fragment pFragment from cursor pCsr and\r\n** append it to string buffer pOut.\r\n*/\r\nstatic int fts3SnippetText(\r\n  Fts3Cursor *pCsr,               /* FTS3 Cursor */\r\n  SnippetFragment *pFragment,     /* Snippet to extract */\r\n  int iFragment,                  /* Fragment number */\r\n  int isLast,                     /* True for final fragment in snippet */\r\n  int nSnippet,                   /* Number of tokens in extracted snippet */\r\n  const char *zOpen,              /* String inserted before highlighted term */\r\n  const char *zClose,             /* String inserted after highlighted term */\r\n  const char *zEllipsis,          /* String inserted between snippets */\r\n  StrBuffer *pOut                 /* Write output here */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int rc;                         /* Return code */\r\n  const char *zDoc;               /* Document text to extract snippet from */\r\n  int nDoc;                       /* Size of zDoc in bytes */\r\n  int iCurrent = 0;               /* Current token number of document */\r\n  int iEnd = 0;                   /* Byte offset of end of current token */\r\n  int isShiftDone = 0;            /* True after snippet is shifted */\r\n  int iPos = pFragment->iPos;     /* First token of snippet */\r\n  u64 hlmask = pFragment->hlmask; /* Highlight-mask for snippet */\r\n  int iCol = pFragment->iCol+1;   /* Query column to extract text from */\r\n  sqlite3_tokenizer_module *pMod; /* Tokenizer module methods object */\r\n  sqlite3_tokenizer_cursor *pC;   /* Tokenizer cursor open on zDoc/nDoc */\r\n  const char *ZDUMMY;             /* Dummy argument used with tokenizer */\r\n  int DUMMY1;                     /* Dummy argument used with tokenizer */\r\n  \r\n  zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol);\r\n  if( zDoc==0 ){\r\n    if( sqlite3_column_type(pCsr->pStmt, iCol)!=SQLITE_NULL ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    return SQLITE_OK;\r\n  }\r\n  nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol);\r\n\r\n  /* Open a token cursor on the document. */\r\n  pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;\r\n  rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC);\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  while( rc==SQLITE_OK ){\r\n    int iBegin;                   /* Offset in zDoc of start of token */\r\n    int iFin;                     /* Offset in zDoc of end of token */\r\n    int isHighlight;              /* True for highlighted terms */\r\n\r\n    rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &iBegin, &iFin, &iCurrent);\r\n    if( rc!=SQLITE_OK ){\r\n      if( rc==SQLITE_DONE ){\r\n        /* Special case - the last token of the snippet is also the last token\r\n        ** of the column. Append any punctuation that occurred between the end\r\n        ** of the previous token and the end of the document to the output. \r\n        ** Then break out of the loop. */\r\n        rc = fts3StringAppend(pOut, &zDoc[iEnd], -1);\r\n      }\r\n      break;\r\n    }\r\n    if( iCurrent<iPos ){ continue; }\r\n\r\n    if( !isShiftDone ){\r\n      int n = nDoc - iBegin;\r\n      rc = fts3SnippetShift(\r\n          pTab, pCsr->iLangid, nSnippet, &zDoc[iBegin], n, &iPos, &hlmask\r\n      );\r\n      isShiftDone = 1;\r\n\r\n      /* Now that the shift has been done, check if the initial \"...\" are\r\n      ** required. They are required if (a) this is not the first fragment,\r\n      ** or (b) this fragment does not begin at position 0 of its column. \r\n      */\r\n      if( rc==SQLITE_OK && (iPos>0 || iFragment>0) ){\r\n        rc = fts3StringAppend(pOut, zEllipsis, -1);\r\n      }\r\n      if( rc!=SQLITE_OK || iCurrent<iPos ) continue;\r\n    }\r\n\r\n    if( iCurrent>=(iPos+nSnippet) ){\r\n      if( isLast ){\r\n        rc = fts3StringAppend(pOut, zEllipsis, -1);\r\n      }\r\n      break;\r\n    }\r\n\r\n    /* Set isHighlight to true if this term should be highlighted. */\r\n    isHighlight = (hlmask & ((u64)1 << (iCurrent-iPos)))!=0;\r\n\r\n    if( iCurrent>iPos ) rc = fts3StringAppend(pOut, &zDoc[iEnd], iBegin-iEnd);\r\n    if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zOpen, -1);\r\n    if( rc==SQLITE_OK ) rc = fts3StringAppend(pOut, &zDoc[iBegin], iFin-iBegin);\r\n    if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zClose, -1);\r\n\r\n    iEnd = iFin;\r\n  }\r\n\r\n  pMod->xClose(pC);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** This function is used to count the entries in a column-list (a \r\n** delta-encoded list of term offsets within a single column of a single \r\n** row). When this function is called, *ppCollist should point to the\r\n** beginning of the first varint in the column-list (the varint that\r\n** contains the position of the first matching term in the column data).\r\n** Before returning, *ppCollist is set to point to the first byte after\r\n** the last varint in the column-list (either the 0x00 signifying the end\r\n** of the position-list, or the 0x01 that precedes the column number of\r\n** the next column in the position-list).\r\n**\r\n** The number of elements in the column-list is returned.\r\n*/\r\nstatic int fts3ColumnlistCount(char **ppCollist){\r\n  char *pEnd = *ppCollist;\r\n  char c = 0;\r\n  int nEntry = 0;\r\n\r\n  /* A column-list is terminated by either a 0x01 or 0x00. */\r\n  while( 0xFE & (*pEnd | c) ){\r\n    c = *pEnd++ & 0x80;\r\n    if( !c ) nEntry++;\r\n  }\r\n\r\n  *ppCollist = pEnd;\r\n  return nEntry;\r\n}\r\n\r\n/*\r\n** fts3ExprIterate() callback used to collect the \"global\" matchinfo stats\r\n** for a single query. \r\n**\r\n** fts3ExprIterate() callback to load the 'global' elements of a\r\n** FTS3_MATCHINFO_HITS matchinfo array. The global stats are those elements \r\n** of the matchinfo array that are constant for all rows returned by the \r\n** current query.\r\n**\r\n** Argument pCtx is actually a pointer to a struct of type MatchInfo. This\r\n** function populates Matchinfo.aMatchinfo[] as follows:\r\n**\r\n**   for(iCol=0; iCol<nCol; iCol++){\r\n**     aMatchinfo[3*iPhrase*nCol + 3*iCol + 1] = X;\r\n**     aMatchinfo[3*iPhrase*nCol + 3*iCol + 2] = Y;\r\n**   }\r\n**\r\n** where X is the number of matches for phrase iPhrase is column iCol of all\r\n** rows of the table. Y is the number of rows for which column iCol contains\r\n** at least one instance of phrase iPhrase.\r\n**\r\n** If the phrase pExpr consists entirely of deferred tokens, then all X and\r\n** Y values are set to nDoc, where nDoc is the number of documents in the \r\n** file system. This is done because the full-text index doclist is required\r\n** to calculate these values properly, and the full-text index doclist is\r\n** not available for deferred tokens.\r\n*/\r\nstatic int fts3ExprGlobalHitsCb(\r\n  Fts3Expr *pExpr,                /* Phrase expression node */\r\n  int iPhrase,                    /* Phrase number (numbered from zero) */\r\n  void *pCtx                      /* Pointer to MatchInfo structure */\r\n){\r\n  MatchInfo *p = (MatchInfo *)pCtx;\r\n  return sqlite3Fts3EvalPhraseStats(\r\n      p->pCursor, pExpr, &p->aMatchinfo[3*iPhrase*p->nCol]\r\n  );\r\n}\r\n\r\n/*\r\n** fts3ExprIterate() callback used to collect the \"local\" part of the\r\n** FTS3_MATCHINFO_HITS array. The local stats are those elements of the \r\n** array that are different for each row returned by the query.\r\n*/\r\nstatic int fts3ExprLocalHitsCb(\r\n  Fts3Expr *pExpr,                /* Phrase expression node */\r\n  int iPhrase,                    /* Phrase number */\r\n  void *pCtx                      /* Pointer to MatchInfo structure */\r\n){\r\n  MatchInfo *p = (MatchInfo *)pCtx;\r\n  int iStart = iPhrase * p->nCol * 3;\r\n  int i;\r\n\r\n  for(i=0; i<p->nCol; i++){\r\n    char *pCsr;\r\n    pCsr = sqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i);\r\n    if( pCsr ){\r\n      p->aMatchinfo[iStart+i*3] = fts3ColumnlistCount(&pCsr);\r\n    }else{\r\n      p->aMatchinfo[iStart+i*3] = 0;\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\nstatic int fts3MatchinfoCheck(\r\n  Fts3Table *pTab, \r\n  char cArg,\r\n  char **pzErr\r\n){\r\n  if( (cArg==FTS3_MATCHINFO_NPHRASE)\r\n   || (cArg==FTS3_MATCHINFO_NCOL)\r\n   || (cArg==FTS3_MATCHINFO_NDOC && pTab->bHasStat)\r\n   || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bHasStat)\r\n   || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize)\r\n   || (cArg==FTS3_MATCHINFO_LCS)\r\n   || (cArg==FTS3_MATCHINFO_HITS)\r\n  ){\r\n    return SQLITE_OK;\r\n  }\r\n  *pzErr = sqlite3_mprintf(\"unrecognized matchinfo request: %c\", cArg);\r\n  return SQLITE_ERROR;\r\n}\r\n\r\nstatic int fts3MatchinfoSize(MatchInfo *pInfo, char cArg){\r\n  int nVal;                       /* Number of integers output by cArg */\r\n\r\n  switch( cArg ){\r\n    case FTS3_MATCHINFO_NDOC:\r\n    case FTS3_MATCHINFO_NPHRASE: \r\n    case FTS3_MATCHINFO_NCOL: \r\n      nVal = 1;\r\n      break;\r\n\r\n    case FTS3_MATCHINFO_AVGLENGTH:\r\n    case FTS3_MATCHINFO_LENGTH:\r\n    case FTS3_MATCHINFO_LCS:\r\n      nVal = pInfo->nCol;\r\n      break;\r\n\r\n    default:\r\n      assert( cArg==FTS3_MATCHINFO_HITS );\r\n      nVal = pInfo->nCol * pInfo->nPhrase * 3;\r\n      break;\r\n  }\r\n\r\n  return nVal;\r\n}\r\n\r\nstatic int fts3MatchinfoSelectDoctotal(\r\n  Fts3Table *pTab,\r\n  sqlite3_stmt **ppStmt,\r\n  sqlite3_int64 *pnDoc,\r\n  const char **paLen\r\n){\r\n  sqlite3_stmt *pStmt;\r\n  const char *a;\r\n  sqlite3_int64 nDoc;\r\n\r\n  if( !*ppStmt ){\r\n    int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt);\r\n    if( rc!=SQLITE_OK ) return rc;\r\n  }\r\n  pStmt = *ppStmt;\r\n  assert( sqlite3_data_count(pStmt)==1 );\r\n\r\n  a = sqlite3_column_blob(pStmt, 0);\r\n  a += sqlite3Fts3GetVarint(a, &nDoc);\r\n  if( nDoc==0 ) return FTS_CORRUPT_VTAB;\r\n  *pnDoc = (u32)nDoc;\r\n\r\n  if( paLen ) *paLen = a;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** An instance of the following structure is used to store state while \r\n** iterating through a multi-column position-list corresponding to the\r\n** hits for a single phrase on a single row in order to calculate the\r\n** values for a matchinfo() FTS3_MATCHINFO_LCS request.\r\n*/\r\ntypedef struct LcsIterator LcsIterator;\r\nstruct LcsIterator {\r\n  Fts3Expr *pExpr;                /* Pointer to phrase expression */\r\n  int iPosOffset;                 /* Tokens count up to end of this phrase */\r\n  char *pRead;                    /* Cursor used to iterate through aDoclist */\r\n  int iPos;                       /* Current position */\r\n};\r\n\r\n/* \r\n** If LcsIterator.iCol is set to the following value, the iterator has\r\n** finished iterating through all offsets for all columns.\r\n*/\r\n#define LCS_ITERATOR_FINISHED 0x7FFFFFFF;\r\n\r\nstatic int fts3MatchinfoLcsCb(\r\n  Fts3Expr *pExpr,                /* Phrase expression node */\r\n  int iPhrase,                    /* Phrase number (numbered from zero) */\r\n  void *pCtx                      /* Pointer to MatchInfo structure */\r\n){\r\n  LcsIterator *aIter = (LcsIterator *)pCtx;\r\n  aIter[iPhrase].pExpr = pExpr;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Advance the iterator passed as an argument to the next position. Return\r\n** 1 if the iterator is at EOF or if it now points to the start of the\r\n** position list for the next column.\r\n*/\r\nstatic int fts3LcsIteratorAdvance(LcsIterator *pIter){\r\n  char *pRead = pIter->pRead;\r\n  sqlite3_int64 iRead;\r\n  int rc = 0;\r\n\r\n  pRead += sqlite3Fts3GetVarint(pRead, &iRead);\r\n  if( iRead==0 || iRead==1 ){\r\n    pRead = 0;\r\n    rc = 1;\r\n  }else{\r\n    pIter->iPos += (int)(iRead-2);\r\n  }\r\n\r\n  pIter->pRead = pRead;\r\n  return rc;\r\n}\r\n  \r\n/*\r\n** This function implements the FTS3_MATCHINFO_LCS matchinfo() flag. \r\n**\r\n** If the call is successful, the longest-common-substring lengths for each\r\n** column are written into the first nCol elements of the pInfo->aMatchinfo[] \r\n** array before returning. SQLITE_OK is returned in this case.\r\n**\r\n** Otherwise, if an error occurs, an SQLite error code is returned and the\r\n** data written to the first nCol elements of pInfo->aMatchinfo[] is \r\n** undefined.\r\n*/\r\nstatic int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){\r\n  LcsIterator *aIter;\r\n  int i;\r\n  int iCol;\r\n  int nToken = 0;\r\n\r\n  /* Allocate and populate the array of LcsIterator objects. The array\r\n  ** contains one element for each matchable phrase in the query.\r\n  **/\r\n  aIter = sqlite3_malloc(sizeof(LcsIterator) * pCsr->nPhrase);\r\n  if( !aIter ) return SQLITE_NOMEM;\r\n  memset(aIter, 0, sizeof(LcsIterator) * pCsr->nPhrase);\r\n  (void)fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter);\r\n\r\n  for(i=0; i<pInfo->nPhrase; i++){\r\n    LcsIterator *pIter = &aIter[i];\r\n    nToken -= pIter->pExpr->pPhrase->nToken;\r\n    pIter->iPosOffset = nToken;\r\n  }\r\n\r\n  for(iCol=0; iCol<pInfo->nCol; iCol++){\r\n    int nLcs = 0;                 /* LCS value for this column */\r\n    int nLive = 0;                /* Number of iterators in aIter not at EOF */\r\n\r\n    for(i=0; i<pInfo->nPhrase; i++){\r\n      LcsIterator *pIt = &aIter[i];\r\n      pIt->pRead = sqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol);\r\n      if( pIt->pRead ){\r\n        pIt->iPos = pIt->iPosOffset;\r\n        fts3LcsIteratorAdvance(&aIter[i]);\r\n        nLive++;\r\n      }\r\n    }\r\n\r\n    while( nLive>0 ){\r\n      LcsIterator *pAdv = 0;      /* The iterator to advance by one position */\r\n      int nThisLcs = 0;           /* LCS for the current iterator positions */\r\n\r\n      for(i=0; i<pInfo->nPhrase; i++){\r\n        LcsIterator *pIter = &aIter[i];\r\n        if( pIter->pRead==0 ){\r\n          /* This iterator is already at EOF for this column. */\r\n          nThisLcs = 0;\r\n        }else{\r\n          if( pAdv==0 || pIter->iPos<pAdv->iPos ){\r\n            pAdv = pIter;\r\n          }\r\n          if( nThisLcs==0 || pIter->iPos==pIter[-1].iPos ){\r\n            nThisLcs++;\r\n          }else{\r\n            nThisLcs = 1;\r\n          }\r\n          if( nThisLcs>nLcs ) nLcs = nThisLcs;\r\n        }\r\n      }\r\n      if( fts3LcsIteratorAdvance(pAdv) ) nLive--;\r\n    }\r\n\r\n    pInfo->aMatchinfo[iCol] = nLcs;\r\n  }\r\n\r\n  sqlite3_free(aIter);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Populate the buffer pInfo->aMatchinfo[] with an array of integers to\r\n** be returned by the matchinfo() function. Argument zArg contains the \r\n** format string passed as the second argument to matchinfo (or the\r\n** default value \"pcx\" if no second argument was specified). The format\r\n** string has already been validated and the pInfo->aMatchinfo[] array\r\n** is guaranteed to be large enough for the output.\r\n**\r\n** If bGlobal is true, then populate all fields of the matchinfo() output.\r\n** If it is false, then assume that those fields that do not change between\r\n** rows (i.e. FTS3_MATCHINFO_NPHRASE, NCOL, NDOC, AVGLENGTH and part of HITS)\r\n** have already been populated.\r\n**\r\n** Return SQLITE_OK if successful, or an SQLite error code if an error \r\n** occurs. If a value other than SQLITE_OK is returned, the state the\r\n** pInfo->aMatchinfo[] buffer is left in is undefined.\r\n*/\r\nstatic int fts3MatchinfoValues(\r\n  Fts3Cursor *pCsr,               /* FTS3 cursor object */\r\n  int bGlobal,                    /* True to grab the global stats */\r\n  MatchInfo *pInfo,               /* Matchinfo context object */\r\n  const char *zArg                /* Matchinfo format string */\r\n){\r\n  int rc = SQLITE_OK;\r\n  int i;\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  sqlite3_stmt *pSelect = 0;\r\n\r\n  for(i=0; rc==SQLITE_OK && zArg[i]; i++){\r\n\r\n    switch( zArg[i] ){\r\n      case FTS3_MATCHINFO_NPHRASE:\r\n        if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nPhrase;\r\n        break;\r\n\r\n      case FTS3_MATCHINFO_NCOL:\r\n        if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nCol;\r\n        break;\r\n        \r\n      case FTS3_MATCHINFO_NDOC:\r\n        if( bGlobal ){\r\n          sqlite3_int64 nDoc = 0;\r\n          rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0);\r\n          pInfo->aMatchinfo[0] = (u32)nDoc;\r\n        }\r\n        break;\r\n\r\n      case FTS3_MATCHINFO_AVGLENGTH: \r\n        if( bGlobal ){\r\n          sqlite3_int64 nDoc;     /* Number of rows in table */\r\n          const char *a;          /* Aggregate column length array */\r\n\r\n          rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a);\r\n          if( rc==SQLITE_OK ){\r\n            int iCol;\r\n            for(iCol=0; iCol<pInfo->nCol; iCol++){\r\n              u32 iVal;\r\n              sqlite3_int64 nToken;\r\n              a += sqlite3Fts3GetVarint(a, &nToken);\r\n              iVal = (u32)(((u32)(nToken&0xffffffff)+nDoc/2)/nDoc);\r\n              pInfo->aMatchinfo[iCol] = iVal;\r\n            }\r\n          }\r\n        }\r\n        break;\r\n\r\n      case FTS3_MATCHINFO_LENGTH: {\r\n        sqlite3_stmt *pSelectDocsize = 0;\r\n        rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize);\r\n        if( rc==SQLITE_OK ){\r\n          int iCol;\r\n          const char *a = sqlite3_column_blob(pSelectDocsize, 0);\r\n          for(iCol=0; iCol<pInfo->nCol; iCol++){\r\n            sqlite3_int64 nToken;\r\n            a += sqlite3Fts3GetVarint(a, &nToken);\r\n            pInfo->aMatchinfo[iCol] = (u32)nToken;\r\n          }\r\n        }\r\n        sqlite3_reset(pSelectDocsize);\r\n        break;\r\n      }\r\n\r\n      case FTS3_MATCHINFO_LCS:\r\n        rc = fts3ExprLoadDoclists(pCsr, 0, 0);\r\n        if( rc==SQLITE_OK ){\r\n          rc = fts3MatchinfoLcs(pCsr, pInfo);\r\n        }\r\n        break;\r\n\r\n      default: {\r\n        Fts3Expr *pExpr;\r\n        assert( zArg[i]==FTS3_MATCHINFO_HITS );\r\n        pExpr = pCsr->pExpr;\r\n        rc = fts3ExprLoadDoclists(pCsr, 0, 0);\r\n        if( rc!=SQLITE_OK ) break;\r\n        if( bGlobal ){\r\n          if( pCsr->pDeferred ){\r\n            rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0);\r\n            if( rc!=SQLITE_OK ) break;\r\n          }\r\n          rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo);\r\n          if( rc!=SQLITE_OK ) break;\r\n        }\r\n        (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo);\r\n        break;\r\n      }\r\n    }\r\n\r\n    pInfo->aMatchinfo += fts3MatchinfoSize(pInfo, zArg[i]);\r\n  }\r\n\r\n  sqlite3_reset(pSelect);\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Populate pCsr->aMatchinfo[] with data for the current row. The \r\n** 'matchinfo' data is an array of 32-bit unsigned integers (C type u32).\r\n*/\r\nstatic int fts3GetMatchinfo(\r\n  Fts3Cursor *pCsr,               /* FTS3 Cursor object */\r\n  const char *zArg                /* Second argument to matchinfo() function */\r\n){\r\n  MatchInfo sInfo;\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int rc = SQLITE_OK;\r\n  int bGlobal = 0;                /* Collect 'global' stats as well as local */\r\n\r\n  memset(&sInfo, 0, sizeof(MatchInfo));\r\n  sInfo.pCursor = pCsr;\r\n  sInfo.nCol = pTab->nColumn;\r\n\r\n  /* If there is cached matchinfo() data, but the format string for the \r\n  ** cache does not match the format string for this request, discard \r\n  ** the cached data. */\r\n  if( pCsr->zMatchinfo && strcmp(pCsr->zMatchinfo, zArg) ){\r\n    assert( pCsr->aMatchinfo );\r\n    sqlite3_free(pCsr->aMatchinfo);\r\n    pCsr->zMatchinfo = 0;\r\n    pCsr->aMatchinfo = 0;\r\n  }\r\n\r\n  /* If Fts3Cursor.aMatchinfo[] is NULL, then this is the first time the\r\n  ** matchinfo function has been called for this query. In this case \r\n  ** allocate the array used to accumulate the matchinfo data and\r\n  ** initialize those elements that are constant for every row.\r\n  */\r\n  if( pCsr->aMatchinfo==0 ){\r\n    int nMatchinfo = 0;           /* Number of u32 elements in match-info */\r\n    int nArg;                     /* Bytes in zArg */\r\n    int i;                        /* Used to iterate through zArg */\r\n\r\n    /* Determine the number of phrases in the query */\r\n    pCsr->nPhrase = fts3ExprPhraseCount(pCsr->pExpr);\r\n    sInfo.nPhrase = pCsr->nPhrase;\r\n\r\n    /* Determine the number of integers in the buffer returned by this call. */\r\n    for(i=0; zArg[i]; i++){\r\n      nMatchinfo += fts3MatchinfoSize(&sInfo, zArg[i]);\r\n    }\r\n\r\n    /* Allocate space for Fts3Cursor.aMatchinfo[] and Fts3Cursor.zMatchinfo. */\r\n    nArg = (int)strlen(zArg);\r\n    pCsr->aMatchinfo = (u32 *)sqlite3_malloc(sizeof(u32)*nMatchinfo + nArg + 1);\r\n    if( !pCsr->aMatchinfo ) return SQLITE_NOMEM;\r\n\r\n    pCsr->zMatchinfo = (char *)&pCsr->aMatchinfo[nMatchinfo];\r\n    pCsr->nMatchinfo = nMatchinfo;\r\n    memcpy(pCsr->zMatchinfo, zArg, nArg+1);\r\n    memset(pCsr->aMatchinfo, 0, sizeof(u32)*nMatchinfo);\r\n    pCsr->isMatchinfoNeeded = 1;\r\n    bGlobal = 1;\r\n  }\r\n\r\n  sInfo.aMatchinfo = pCsr->aMatchinfo;\r\n  sInfo.nPhrase = pCsr->nPhrase;\r\n  if( pCsr->isMatchinfoNeeded ){\r\n    rc = fts3MatchinfoValues(pCsr, bGlobal, &sInfo, zArg);\r\n    pCsr->isMatchinfoNeeded = 0;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Implementation of snippet() function.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3Snippet(\r\n  sqlite3_context *pCtx,          /* SQLite function call context */\r\n  Fts3Cursor *pCsr,               /* Cursor object */\r\n  const char *zStart,             /* Snippet start text - \"<b>\" */\r\n  const char *zEnd,               /* Snippet end text - \"</b>\" */\r\n  const char *zEllipsis,          /* Snippet ellipsis text - \"<b>...</b>\" */\r\n  int iCol,                       /* Extract snippet from this column */\r\n  int nToken                      /* Approximate number of tokens in snippet */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int rc = SQLITE_OK;\r\n  int i;\r\n  StrBuffer res = {0, 0, 0};\r\n\r\n  /* The returned text includes up to four fragments of text extracted from\r\n  ** the data in the current row. The first iteration of the for(...) loop\r\n  ** below attempts to locate a single fragment of text nToken tokens in \r\n  ** size that contains at least one instance of all phrases in the query\r\n  ** expression that appear in the current row. If such a fragment of text\r\n  ** cannot be found, the second iteration of the loop attempts to locate\r\n  ** a pair of fragments, and so on.\r\n  */\r\n  int nSnippet = 0;               /* Number of fragments in this snippet */\r\n  SnippetFragment aSnippet[4];    /* Maximum of 4 fragments per snippet */\r\n  int nFToken = -1;               /* Number of tokens in each fragment */\r\n\r\n  if( !pCsr->pExpr ){\r\n    sqlite3_result_text(pCtx, \"\", 0, SQLITE_STATIC);\r\n    return;\r\n  }\r\n\r\n  for(nSnippet=1; 1; nSnippet++){\r\n\r\n    int iSnip;                    /* Loop counter 0..nSnippet-1 */\r\n    u64 mCovered = 0;             /* Bitmask of phrases covered by snippet */\r\n    u64 mSeen = 0;                /* Bitmask of phrases seen by BestSnippet() */\r\n\r\n    if( nToken>=0 ){\r\n      nFToken = (nToken+nSnippet-1) / nSnippet;\r\n    }else{\r\n      nFToken = -1 * nToken;\r\n    }\r\n\r\n    for(iSnip=0; iSnip<nSnippet; iSnip++){\r\n      int iBestScore = -1;        /* Best score of columns checked so far */\r\n      int iRead;                  /* Used to iterate through columns */\r\n      SnippetFragment *pFragment = &aSnippet[iSnip];\r\n\r\n      memset(pFragment, 0, sizeof(*pFragment));\r\n\r\n      /* Loop through all columns of the table being considered for snippets.\r\n      ** If the iCol argument to this function was negative, this means all\r\n      ** columns of the FTS3 table. Otherwise, only column iCol is considered.\r\n      */\r\n      for(iRead=0; iRead<pTab->nColumn; iRead++){\r\n        SnippetFragment sF = {0, 0, 0, 0};\r\n        int iS;\r\n        if( iCol>=0 && iRead!=iCol ) continue;\r\n\r\n        /* Find the best snippet of nFToken tokens in column iRead. */\r\n        rc = fts3BestSnippet(nFToken, pCsr, iRead, mCovered, &mSeen, &sF, &iS);\r\n        if( rc!=SQLITE_OK ){\r\n          goto snippet_out;\r\n        }\r\n        if( iS>iBestScore ){\r\n          *pFragment = sF;\r\n          iBestScore = iS;\r\n        }\r\n      }\r\n\r\n      mCovered |= pFragment->covered;\r\n    }\r\n\r\n    /* If all query phrases seen by fts3BestSnippet() are present in at least\r\n    ** one of the nSnippet snippet fragments, break out of the loop.\r\n    */\r\n    assert( (mCovered&mSeen)==mCovered );\r\n    if( mSeen==mCovered || nSnippet==SizeofArray(aSnippet) ) break;\r\n  }\r\n\r\n  assert( nFToken>0 );\r\n\r\n  for(i=0; i<nSnippet && rc==SQLITE_OK; i++){\r\n    rc = fts3SnippetText(pCsr, &aSnippet[i], \r\n        i, (i==nSnippet-1), nFToken, zStart, zEnd, zEllipsis, &res\r\n    );\r\n  }\r\n\r\n snippet_out:\r\n  sqlite3Fts3SegmentsClose(pTab);\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3_result_error_code(pCtx, rc);\r\n    sqlite3_free(res.z);\r\n  }else{\r\n    sqlite3_result_text(pCtx, res.z, -1, sqlite3_free);\r\n  }\r\n}\r\n\r\n\r\ntypedef struct TermOffset TermOffset;\r\ntypedef struct TermOffsetCtx TermOffsetCtx;\r\n\r\nstruct TermOffset {\r\n  char *pList;                    /* Position-list */\r\n  int iPos;                       /* Position just read from pList */\r\n  int iOff;                       /* Offset of this term from read positions */\r\n};\r\n\r\nstruct TermOffsetCtx {\r\n  Fts3Cursor *pCsr;\r\n  int iCol;                       /* Column of table to populate aTerm for */\r\n  int iTerm;\r\n  sqlite3_int64 iDocid;\r\n  TermOffset *aTerm;\r\n};\r\n\r\n/*\r\n** This function is an fts3ExprIterate() callback used by sqlite3Fts3Offsets().\r\n*/\r\nstatic int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){\r\n  TermOffsetCtx *p = (TermOffsetCtx *)ctx;\r\n  int nTerm;                      /* Number of tokens in phrase */\r\n  int iTerm;                      /* For looping through nTerm phrase terms */\r\n  char *pList;                    /* Pointer to position list for phrase */\r\n  int iPos = 0;                   /* First position in position-list */\r\n\r\n  UNUSED_PARAMETER(iPhrase);\r\n  pList = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol);\r\n  nTerm = pExpr->pPhrase->nToken;\r\n  if( pList ){\r\n    fts3GetDeltaPosition(&pList, &iPos);\r\n    assert( iPos>=0 );\r\n  }\r\n\r\n  for(iTerm=0; iTerm<nTerm; iTerm++){\r\n    TermOffset *pT = &p->aTerm[p->iTerm++];\r\n    pT->iOff = nTerm-iTerm-1;\r\n    pT->pList = pList;\r\n    pT->iPos = iPos;\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Implementation of offsets() function.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3Offsets(\r\n  sqlite3_context *pCtx,          /* SQLite function call context */\r\n  Fts3Cursor *pCsr                /* Cursor object */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  sqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule;\r\n  const char *ZDUMMY;             /* Dummy argument used with xNext() */\r\n  int NDUMMY;                     /* Dummy argument used with xNext() */\r\n  int rc;                         /* Return Code */\r\n  int nToken;                     /* Number of tokens in query */\r\n  int iCol;                       /* Column currently being processed */\r\n  StrBuffer res = {0, 0, 0};      /* Result string */\r\n  TermOffsetCtx sCtx;             /* Context for fts3ExprTermOffsetInit() */\r\n\r\n  if( !pCsr->pExpr ){\r\n    sqlite3_result_text(pCtx, \"\", 0, SQLITE_STATIC);\r\n    return;\r\n  }\r\n\r\n  memset(&sCtx, 0, sizeof(sCtx));\r\n  assert( pCsr->isRequireSeek==0 );\r\n\r\n  /* Count the number of terms in the query */\r\n  rc = fts3ExprLoadDoclists(pCsr, 0, &nToken);\r\n  if( rc!=SQLITE_OK ) goto offsets_out;\r\n\r\n  /* Allocate the array of TermOffset iterators. */\r\n  sCtx.aTerm = (TermOffset *)sqlite3_malloc(sizeof(TermOffset)*nToken);\r\n  if( 0==sCtx.aTerm ){\r\n    rc = SQLITE_NOMEM;\r\n    goto offsets_out;\r\n  }\r\n  sCtx.iDocid = pCsr->iPrevId;\r\n  sCtx.pCsr = pCsr;\r\n\r\n  /* Loop through the table columns, appending offset information to \r\n  ** string-buffer res for each column.\r\n  */\r\n  for(iCol=0; iCol<pTab->nColumn; iCol++){\r\n    sqlite3_tokenizer_cursor *pC; /* Tokenizer cursor */\r\n    int iStart;\r\n    int iEnd;\r\n    int iCurrent;\r\n    const char *zDoc;\r\n    int nDoc;\r\n\r\n    /* Initialize the contents of sCtx.aTerm[] for column iCol. There is \r\n    ** no way that this operation can fail, so the return code from\r\n    ** fts3ExprIterate() can be discarded.\r\n    */\r\n    sCtx.iCol = iCol;\r\n    sCtx.iTerm = 0;\r\n    (void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void *)&sCtx);\r\n\r\n    /* Retreive the text stored in column iCol. If an SQL NULL is stored \r\n    ** in column iCol, jump immediately to the next iteration of the loop.\r\n    ** If an OOM occurs while retrieving the data (this can happen if SQLite\r\n    ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM \r\n    ** to the caller. \r\n    */\r\n    zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol+1);\r\n    nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol+1);\r\n    if( zDoc==0 ){\r\n      if( sqlite3_column_type(pCsr->pStmt, iCol+1)==SQLITE_NULL ){\r\n        continue;\r\n      }\r\n      rc = SQLITE_NOMEM;\r\n      goto offsets_out;\r\n    }\r\n\r\n    /* Initialize a tokenizer iterator to iterate through column iCol. */\r\n    rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid,\r\n        zDoc, nDoc, &pC\r\n    );\r\n    if( rc!=SQLITE_OK ) goto offsets_out;\r\n\r\n    rc = pMod->xNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent);\r\n    while( rc==SQLITE_OK ){\r\n      int i;                      /* Used to loop through terms */\r\n      int iMinPos = 0x7FFFFFFF;   /* Position of next token */\r\n      TermOffset *pTerm = 0;      /* TermOffset associated with next token */\r\n\r\n      for(i=0; i<nToken; i++){\r\n        TermOffset *pT = &sCtx.aTerm[i];\r\n        if( pT->pList && (pT->iPos-pT->iOff)<iMinPos ){\r\n          iMinPos = pT->iPos-pT->iOff;\r\n          pTerm = pT;\r\n        }\r\n      }\r\n\r\n      if( !pTerm ){\r\n        /* All offsets for this column have been gathered. */\r\n        rc = SQLITE_DONE;\r\n      }else{\r\n        assert( iCurrent<=iMinPos );\r\n        if( 0==(0xFE&*pTerm->pList) ){\r\n          pTerm->pList = 0;\r\n        }else{\r\n          fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos);\r\n        }\r\n        while( rc==SQLITE_OK && iCurrent<iMinPos ){\r\n          rc = pMod->xNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent);\r\n        }\r\n        if( rc==SQLITE_OK ){\r\n          char aBuffer[64];\r\n          sqlite3_snprintf(sizeof(aBuffer), aBuffer, \r\n              \"%d %d %d %d \", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart\r\n          );\r\n          rc = fts3StringAppend(&res, aBuffer, -1);\r\n        }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){\r\n          rc = FTS_CORRUPT_VTAB;\r\n        }\r\n      }\r\n    }\r\n    if( rc==SQLITE_DONE ){\r\n      rc = SQLITE_OK;\r\n    }\r\n\r\n    pMod->xClose(pC);\r\n    if( rc!=SQLITE_OK ) goto offsets_out;\r\n  }\r\n\r\n offsets_out:\r\n  sqlite3_free(sCtx.aTerm);\r\n  assert( rc!=SQLITE_DONE );\r\n  sqlite3Fts3SegmentsClose(pTab);\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3_result_error_code(pCtx,  rc);\r\n    sqlite3_free(res.z);\r\n  }else{\r\n    sqlite3_result_text(pCtx, res.z, res.n-1, sqlite3_free);\r\n  }\r\n  return;\r\n}\r\n\r\n/*\r\n** Implementation of matchinfo() function.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3Matchinfo(\r\n  sqlite3_context *pContext,      /* Function call context */\r\n  Fts3Cursor *pCsr,               /* FTS3 table cursor */\r\n  const char *zArg                /* Second arg to matchinfo() function */\r\n){\r\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\r\n  int rc;\r\n  int i;\r\n  const char *zFormat;\r\n\r\n  if( zArg ){\r\n    for(i=0; zArg[i]; i++){\r\n      char *zErr = 0;\r\n      if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){\r\n        sqlite3_result_error(pContext, zErr, -1);\r\n        sqlite3_free(zErr);\r\n        return;\r\n      }\r\n    }\r\n    zFormat = zArg;\r\n  }else{\r\n    zFormat = FTS3_MATCHINFO_DEFAULT;\r\n  }\r\n\r\n  if( !pCsr->pExpr ){\r\n    sqlite3_result_blob(pContext, \"\", 0, SQLITE_STATIC);\r\n    return;\r\n  }\r\n\r\n  /* Retrieve matchinfo() data. */\r\n  rc = fts3GetMatchinfo(pCsr, zFormat);\r\n  sqlite3Fts3SegmentsClose(pTab);\r\n\r\n  if( rc!=SQLITE_OK ){\r\n    sqlite3_result_error_code(pContext, rc);\r\n  }else{\r\n    int n = pCsr->nMatchinfo * sizeof(u32);\r\n    sqlite3_result_blob(pContext, pCsr->aMatchinfo, n, SQLITE_TRANSIENT);\r\n  }\r\n}\r\n\r\n#endif\r\n\r\n/************** End of fts3_snippet.c ****************************************/\r\n/************** Begin file rtree.c *******************************************/\r\n/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file contains code for implementations of the r-tree and r*-tree\r\n** algorithms packaged as an SQLite virtual table module.\r\n*/\r\n\r\n/*\r\n** Database Format of R-Tree Tables\r\n** --------------------------------\r\n**\r\n** The data structure for a single virtual r-tree table is stored in three \r\n** native SQLite tables declared as follows. In each case, the '%' character\r\n** in the table name is replaced with the user-supplied name of the r-tree\r\n** table.\r\n**\r\n**   CREATE TABLE %_node(nodeno INTEGER PRIMARY KEY, data BLOB)\r\n**   CREATE TABLE %_parent(nodeno INTEGER PRIMARY KEY, parentnode INTEGER)\r\n**   CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)\r\n**\r\n** The data for each node of the r-tree structure is stored in the %_node\r\n** table. For each node that is not the root node of the r-tree, there is\r\n** an entry in the %_parent table associating the node with its parent.\r\n** And for each row of data in the table, there is an entry in the %_rowid\r\n** table that maps from the entries rowid to the id of the node that it\r\n** is stored on.\r\n**\r\n** The root node of an r-tree always exists, even if the r-tree table is\r\n** empty. The nodeno of the root node is always 1. All other nodes in the\r\n** table must be the same size as the root node. The content of each node\r\n** is formatted as follows:\r\n**\r\n**   1. If the node is the root node (node 1), then the first 2 bytes\r\n**      of the node contain the tree depth as a big-endian integer.\r\n**      For non-root nodes, the first 2 bytes are left unused.\r\n**\r\n**   2. The next 2 bytes contain the number of entries currently \r\n**      stored in the node.\r\n**\r\n**   3. The remainder of the node contains the node entries. Each entry\r\n**      consists of a single 8-byte integer followed by an even number\r\n**      of 4-byte coordinates. For leaf nodes the integer is the rowid\r\n**      of a record. For internal nodes it is the node number of a\r\n**      child page.\r\n*/\r\n\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RTREE)\r\n\r\n/*\r\n** This file contains an implementation of a couple of different variants\r\n** of the r-tree algorithm. See the README file for further details. The \r\n** same data-structure is used for all, but the algorithms for insert and\r\n** delete operations vary. The variants used are selected at compile time \r\n** by defining the following symbols:\r\n*/\r\n\r\n/* Either, both or none of the following may be set to activate \r\n** r*tree variant algorithms.\r\n*/\r\n#define VARIANT_RSTARTREE_CHOOSESUBTREE 0\r\n#define VARIANT_RSTARTREE_REINSERT      1\r\n\r\n/* \r\n** Exactly one of the following must be set to 1.\r\n*/\r\n#define VARIANT_GUTTMAN_QUADRATIC_SPLIT 0\r\n#define VARIANT_GUTTMAN_LINEAR_SPLIT    0\r\n#define VARIANT_RSTARTREE_SPLIT         1\r\n\r\n#define VARIANT_GUTTMAN_SPLIT \\\r\n        (VARIANT_GUTTMAN_LINEAR_SPLIT||VARIANT_GUTTMAN_QUADRATIC_SPLIT)\r\n\r\n#if VARIANT_GUTTMAN_QUADRATIC_SPLIT\r\n  #define PickNext QuadraticPickNext\r\n  #define PickSeeds QuadraticPickSeeds\r\n  #define AssignCells splitNodeGuttman\r\n#endif\r\n#if VARIANT_GUTTMAN_LINEAR_SPLIT\r\n  #define PickNext LinearPickNext\r\n  #define PickSeeds LinearPickSeeds\r\n  #define AssignCells splitNodeGuttman\r\n#endif\r\n#if VARIANT_RSTARTREE_SPLIT\r\n  #define AssignCells splitNodeStartree\r\n#endif\r\n\r\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \r\n# define NDEBUG 1\r\n#endif\r\n\r\n#ifndef SQLITE_CORE\r\n  SQLITE_EXTENSION_INIT1\r\n#else\r\n#endif\r\n\r\n/* #include <string.h> */\r\n/* #include <assert.h> */\r\n\r\n#ifndef SQLITE_AMALGAMATION\r\n#include \"sqlite3rtree.h\"\r\ntypedef sqlite3_int64 i64;\r\ntypedef unsigned char u8;\r\ntypedef unsigned int u32;\r\n#endif\r\n\r\n/*  The following macro is used to suppress compiler warnings.\r\n*/\r\n#ifndef UNUSED_PARAMETER\r\n# define UNUSED_PARAMETER(x) (void)(x)\r\n#endif\r\n\r\ntypedef struct Rtree Rtree;\r\ntypedef struct RtreeCursor RtreeCursor;\r\ntypedef struct RtreeNode RtreeNode;\r\ntypedef struct RtreeCell RtreeCell;\r\ntypedef struct RtreeConstraint RtreeConstraint;\r\ntypedef struct RtreeMatchArg RtreeMatchArg;\r\ntypedef struct RtreeGeomCallback RtreeGeomCallback;\r\ntypedef union RtreeCoord RtreeCoord;\r\n\r\n/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */\r\n#define RTREE_MAX_DIMENSIONS 5\r\n\r\n/* Size of hash table Rtree.aHash. This hash table is not expected to\r\n** ever contain very many entries, so a fixed number of buckets is \r\n** used.\r\n*/\r\n#define HASHSIZE 128\r\n\r\n/* \r\n** An rtree virtual-table object.\r\n*/\r\nstruct Rtree {\r\n  sqlite3_vtab base;\r\n  sqlite3 *db;                /* Host database connection */\r\n  int iNodeSize;              /* Size in bytes of each node in the node table */\r\n  int nDim;                   /* Number of dimensions */\r\n  int nBytesPerCell;          /* Bytes consumed per cell */\r\n  int iDepth;                 /* Current depth of the r-tree structure */\r\n  char *zDb;                  /* Name of database containing r-tree table */\r\n  char *zName;                /* Name of r-tree table */ \r\n  RtreeNode *aHash[HASHSIZE]; /* Hash table of in-memory nodes. */ \r\n  int nBusy;                  /* Current number of users of this structure */\r\n\r\n  /* List of nodes removed during a CondenseTree operation. List is\r\n  ** linked together via the pointer normally used for hash chains -\r\n  ** RtreeNode.pNext. RtreeNode.iNode stores the depth of the sub-tree \r\n  ** headed by the node (leaf nodes have RtreeNode.iNode==0).\r\n  */\r\n  RtreeNode *pDeleted;\r\n  int iReinsertHeight;        /* Height of sub-trees Reinsert() has run on */\r\n\r\n  /* Statements to read/write/delete a record from xxx_node */\r\n  sqlite3_stmt *pReadNode;\r\n  sqlite3_stmt *pWriteNode;\r\n  sqlite3_stmt *pDeleteNode;\r\n\r\n  /* Statements to read/write/delete a record from xxx_rowid */\r\n  sqlite3_stmt *pReadRowid;\r\n  sqlite3_stmt *pWriteRowid;\r\n  sqlite3_stmt *pDeleteRowid;\r\n\r\n  /* Statements to read/write/delete a record from xxx_parent */\r\n  sqlite3_stmt *pReadParent;\r\n  sqlite3_stmt *pWriteParent;\r\n  sqlite3_stmt *pDeleteParent;\r\n\r\n  int eCoordType;\r\n};\r\n\r\n/* Possible values for eCoordType: */\r\n#define RTREE_COORD_REAL32 0\r\n#define RTREE_COORD_INT32  1\r\n\r\n/*\r\n** The minimum number of cells allowed for a node is a third of the \r\n** maximum. In Gutman's notation:\r\n**\r\n**     m = M/3\r\n**\r\n** If an R*-tree \"Reinsert\" operation is required, the same number of\r\n** cells are removed from the overfull node and reinserted into the tree.\r\n*/\r\n#define RTREE_MINCELLS(p) ((((p)->iNodeSize-4)/(p)->nBytesPerCell)/3)\r\n#define RTREE_REINSERT(p) RTREE_MINCELLS(p)\r\n#define RTREE_MAXCELLS 51\r\n\r\n/*\r\n** The smallest possible node-size is (512-64)==448 bytes. And the largest\r\n** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).\r\n** Therefore all non-root nodes must contain at least 3 entries. Since \r\n** 2^40 is greater than 2^64, an r-tree structure always has a depth of\r\n** 40 or less.\r\n*/\r\n#define RTREE_MAX_DEPTH 40\r\n\r\n/* \r\n** An rtree cursor object.\r\n*/\r\nstruct RtreeCursor {\r\n  sqlite3_vtab_cursor base;\r\n  RtreeNode *pNode;                 /* Node cursor is currently pointing at */\r\n  int iCell;                        /* Index of current cell in pNode */\r\n  int iStrategy;                    /* Copy of idxNum search parameter */\r\n  int nConstraint;                  /* Number of entries in aConstraint */\r\n  RtreeConstraint *aConstraint;     /* Search constraints. */\r\n};\r\n\r\nunion RtreeCoord {\r\n  float f;\r\n  int i;\r\n};\r\n\r\n/*\r\n** The argument is an RtreeCoord. Return the value stored within the RtreeCoord\r\n** formatted as a double. This macro assumes that local variable pRtree points\r\n** to the Rtree structure associated with the RtreeCoord.\r\n*/\r\n#define DCOORD(coord) (                           \\\r\n  (pRtree->eCoordType==RTREE_COORD_REAL32) ?      \\\r\n    ((double)coord.f) :                           \\\r\n    ((double)coord.i)                             \\\r\n)\r\n\r\n/*\r\n** A search constraint.\r\n*/\r\nstruct RtreeConstraint {\r\n  int iCoord;                     /* Index of constrained coordinate */\r\n  int op;                         /* Constraining operation */\r\n  double rValue;                  /* Constraint value. */\r\n  int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);\r\n  sqlite3_rtree_geometry *pGeom;  /* Constraint callback argument for a MATCH */\r\n};\r\n\r\n/* Possible values for RtreeConstraint.op */\r\n#define RTREE_EQ    0x41\r\n#define RTREE_LE    0x42\r\n#define RTREE_LT    0x43\r\n#define RTREE_GE    0x44\r\n#define RTREE_GT    0x45\r\n#define RTREE_MATCH 0x46\r\n\r\n/* \r\n** An rtree structure node.\r\n*/\r\nstruct RtreeNode {\r\n  RtreeNode *pParent;               /* Parent node */\r\n  i64 iNode;\r\n  int nRef;\r\n  int isDirty;\r\n  u8 *zData;\r\n  RtreeNode *pNext;                 /* Next node in this hash chain */\r\n};\r\n#define NCELL(pNode) readInt16(&(pNode)->zData[2])\r\n\r\n/* \r\n** Structure to store a deserialized rtree record.\r\n*/\r\nstruct RtreeCell {\r\n  i64 iRowid;\r\n  RtreeCoord aCoord[RTREE_MAX_DIMENSIONS*2];\r\n};\r\n\r\n\r\n/*\r\n** Value for the first field of every RtreeMatchArg object. The MATCH\r\n** operator tests that the first field of a blob operand matches this\r\n** value to avoid operating on invalid blobs (which could cause a segfault).\r\n*/\r\n#define RTREE_GEOMETRY_MAGIC 0x891245AB\r\n\r\n/*\r\n** An instance of this structure must be supplied as a blob argument to\r\n** the right-hand-side of an SQL MATCH operator used to constrain an\r\n** r-tree query.\r\n*/\r\nstruct RtreeMatchArg {\r\n  u32 magic;                      /* Always RTREE_GEOMETRY_MAGIC */\r\n  int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);\r\n  void *pContext;\r\n  int nParam;\r\n  double aParam[1];\r\n};\r\n\r\n/*\r\n** When a geometry callback is created (see sqlite3_rtree_geometry_callback),\r\n** a single instance of the following structure is allocated. It is used\r\n** as the context for the user-function created by by s_r_g_c(). The object\r\n** is eventually deleted by the destructor mechanism provided by\r\n** sqlite3_create_function_v2() (which is called by s_r_g_c() to create\r\n** the geometry callback function).\r\n*/\r\nstruct RtreeGeomCallback {\r\n  int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);\r\n  void *pContext;\r\n};\r\n\r\n#ifndef MAX\r\n# define MAX(x,y) ((x) < (y) ? (y) : (x))\r\n#endif\r\n#ifndef MIN\r\n# define MIN(x,y) ((x) > (y) ? (y) : (x))\r\n#endif\r\n\r\n/*\r\n** Functions to deserialize a 16 bit integer, 32 bit real number and\r\n** 64 bit integer. The deserialized value is returned.\r\n*/\r\nstatic int readInt16(u8 *p){\r\n  return (p[0]<<8) + p[1];\r\n}\r\nstatic void readCoord(u8 *p, RtreeCoord *pCoord){\r\n  u32 i = (\r\n    (((u32)p[0]) << 24) + \r\n    (((u32)p[1]) << 16) + \r\n    (((u32)p[2]) <<  8) + \r\n    (((u32)p[3]) <<  0)\r\n  );\r\n  *(u32 *)pCoord = i;\r\n}\r\nstatic i64 readInt64(u8 *p){\r\n  return (\r\n    (((i64)p[0]) << 56) + \r\n    (((i64)p[1]) << 48) + \r\n    (((i64)p[2]) << 40) + \r\n    (((i64)p[3]) << 32) + \r\n    (((i64)p[4]) << 24) + \r\n    (((i64)p[5]) << 16) + \r\n    (((i64)p[6]) <<  8) + \r\n    (((i64)p[7]) <<  0)\r\n  );\r\n}\r\n\r\n/*\r\n** Functions to serialize a 16 bit integer, 32 bit real number and\r\n** 64 bit integer. The value returned is the number of bytes written\r\n** to the argument buffer (always 2, 4 and 8 respectively).\r\n*/\r\nstatic int writeInt16(u8 *p, int i){\r\n  p[0] = (i>> 8)&0xFF;\r\n  p[1] = (i>> 0)&0xFF;\r\n  return 2;\r\n}\r\nstatic int writeCoord(u8 *p, RtreeCoord *pCoord){\r\n  u32 i;\r\n  assert( sizeof(RtreeCoord)==4 );\r\n  assert( sizeof(u32)==4 );\r\n  i = *(u32 *)pCoord;\r\n  p[0] = (i>>24)&0xFF;\r\n  p[1] = (i>>16)&0xFF;\r\n  p[2] = (i>> 8)&0xFF;\r\n  p[3] = (i>> 0)&0xFF;\r\n  return 4;\r\n}\r\nstatic int writeInt64(u8 *p, i64 i){\r\n  p[0] = (i>>56)&0xFF;\r\n  p[1] = (i>>48)&0xFF;\r\n  p[2] = (i>>40)&0xFF;\r\n  p[3] = (i>>32)&0xFF;\r\n  p[4] = (i>>24)&0xFF;\r\n  p[5] = (i>>16)&0xFF;\r\n  p[6] = (i>> 8)&0xFF;\r\n  p[7] = (i>> 0)&0xFF;\r\n  return 8;\r\n}\r\n\r\n/*\r\n** Increment the reference count of node p.\r\n*/\r\nstatic void nodeReference(RtreeNode *p){\r\n  if( p ){\r\n    p->nRef++;\r\n  }\r\n}\r\n\r\n/*\r\n** Clear the content of node p (set all bytes to 0x00).\r\n*/\r\nstatic void nodeZero(Rtree *pRtree, RtreeNode *p){\r\n  memset(&p->zData[2], 0, pRtree->iNodeSize-2);\r\n  p->isDirty = 1;\r\n}\r\n\r\n/*\r\n** Given a node number iNode, return the corresponding key to use\r\n** in the Rtree.aHash table.\r\n*/\r\nstatic int nodeHash(i64 iNode){\r\n  return (\r\n    (iNode>>56) ^ (iNode>>48) ^ (iNode>>40) ^ (iNode>>32) ^ \r\n    (iNode>>24) ^ (iNode>>16) ^ (iNode>> 8) ^ (iNode>> 0)\r\n  ) % HASHSIZE;\r\n}\r\n\r\n/*\r\n** Search the node hash table for node iNode. If found, return a pointer\r\n** to it. Otherwise, return 0.\r\n*/\r\nstatic RtreeNode *nodeHashLookup(Rtree *pRtree, i64 iNode){\r\n  RtreeNode *p;\r\n  for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext);\r\n  return p;\r\n}\r\n\r\n/*\r\n** Add node pNode to the node hash table.\r\n*/\r\nstatic void nodeHashInsert(Rtree *pRtree, RtreeNode *pNode){\r\n  int iHash;\r\n  assert( pNode->pNext==0 );\r\n  iHash = nodeHash(pNode->iNode);\r\n  pNode->pNext = pRtree->aHash[iHash];\r\n  pRtree->aHash[iHash] = pNode;\r\n}\r\n\r\n/*\r\n** Remove node pNode from the node hash table.\r\n*/\r\nstatic void nodeHashDelete(Rtree *pRtree, RtreeNode *pNode){\r\n  RtreeNode **pp;\r\n  if( pNode->iNode!=0 ){\r\n    pp = &pRtree->aHash[nodeHash(pNode->iNode)];\r\n    for( ; (*pp)!=pNode; pp = &(*pp)->pNext){ assert(*pp); }\r\n    *pp = pNode->pNext;\r\n    pNode->pNext = 0;\r\n  }\r\n}\r\n\r\n/*\r\n** Allocate and return new r-tree node. Initially, (RtreeNode.iNode==0),\r\n** indicating that node has not yet been assigned a node number. It is\r\n** assigned a node number when nodeWrite() is called to write the\r\n** node contents out to the database.\r\n*/\r\nstatic RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){\r\n  RtreeNode *pNode;\r\n  pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize);\r\n  if( pNode ){\r\n    memset(pNode, 0, sizeof(RtreeNode) + pRtree->iNodeSize);\r\n    pNode->zData = (u8 *)&pNode[1];\r\n    pNode->nRef = 1;\r\n    pNode->pParent = pParent;\r\n    pNode->isDirty = 1;\r\n    nodeReference(pParent);\r\n  }\r\n  return pNode;\r\n}\r\n\r\n/*\r\n** Obtain a reference to an r-tree node.\r\n*/\r\nstatic int\r\nnodeAcquire(\r\n  Rtree *pRtree,             /* R-tree structure */\r\n  i64 iNode,                 /* Node number to load */\r\n  RtreeNode *pParent,        /* Either the parent node or NULL */\r\n  RtreeNode **ppNode         /* OUT: Acquired node */\r\n){\r\n  int rc;\r\n  int rc2 = SQLITE_OK;\r\n  RtreeNode *pNode;\r\n\r\n  /* Check if the requested node is already in the hash table. If so,\r\n  ** increase its reference count and return it.\r\n  */\r\n  if( (pNode = nodeHashLookup(pRtree, iNode)) ){\r\n    assert( !pParent || !pNode->pParent || pNode->pParent==pParent );\r\n    if( pParent && !pNode->pParent ){\r\n      nodeReference(pParent);\r\n      pNode->pParent = pParent;\r\n    }\r\n    pNode->nRef++;\r\n    *ppNode = pNode;\r\n    return SQLITE_OK;\r\n  }\r\n\r\n  sqlite3_bind_int64(pRtree->pReadNode, 1, iNode);\r\n  rc = sqlite3_step(pRtree->pReadNode);\r\n  if( rc==SQLITE_ROW ){\r\n    const u8 *zBlob = sqlite3_column_blob(pRtree->pReadNode, 0);\r\n    if( pRtree->iNodeSize==sqlite3_column_bytes(pRtree->pReadNode, 0) ){\r\n      pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode)+pRtree->iNodeSize);\r\n      if( !pNode ){\r\n        rc2 = SQLITE_NOMEM;\r\n      }else{\r\n        pNode->pParent = pParent;\r\n        pNode->zData = (u8 *)&pNode[1];\r\n        pNode->nRef = 1;\r\n        pNode->iNode = iNode;\r\n        pNode->isDirty = 0;\r\n        pNode->pNext = 0;\r\n        memcpy(pNode->zData, zBlob, pRtree->iNodeSize);\r\n        nodeReference(pParent);\r\n      }\r\n    }\r\n  }\r\n  rc = sqlite3_reset(pRtree->pReadNode);\r\n  if( rc==SQLITE_OK ) rc = rc2;\r\n\r\n  /* If the root node was just loaded, set pRtree->iDepth to the height\r\n  ** of the r-tree structure. A height of zero means all data is stored on\r\n  ** the root node. A height of one means the children of the root node\r\n  ** are the leaves, and so on. If the depth as specified on the root node\r\n  ** is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt.\r\n  */\r\n  if( pNode && iNode==1 ){\r\n    pRtree->iDepth = readInt16(pNode->zData);\r\n    if( pRtree->iDepth>RTREE_MAX_DEPTH ){\r\n      rc = SQLITE_CORRUPT_VTAB;\r\n    }\r\n  }\r\n\r\n  /* If no error has occurred so far, check if the \"number of entries\"\r\n  ** field on the node is too large. If so, set the return code to \r\n  ** SQLITE_CORRUPT_VTAB.\r\n  */\r\n  if( pNode && rc==SQLITE_OK ){\r\n    if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){\r\n      rc = SQLITE_CORRUPT_VTAB;\r\n    }\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    if( pNode!=0 ){\r\n      nodeHashInsert(pRtree, pNode);\r\n    }else{\r\n      rc = SQLITE_CORRUPT_VTAB;\r\n    }\r\n    *ppNode = pNode;\r\n  }else{\r\n    sqlite3_free(pNode);\r\n    *ppNode = 0;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Overwrite cell iCell of node pNode with the contents of pCell.\r\n*/\r\nstatic void nodeOverwriteCell(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode,  \r\n  RtreeCell *pCell, \r\n  int iCell\r\n){\r\n  int ii;\r\n  u8 *p = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];\r\n  p += writeInt64(p, pCell->iRowid);\r\n  for(ii=0; ii<(pRtree->nDim*2); ii++){\r\n    p += writeCoord(p, &pCell->aCoord[ii]);\r\n  }\r\n  pNode->isDirty = 1;\r\n}\r\n\r\n/*\r\n** Remove cell the cell with index iCell from node pNode.\r\n*/\r\nstatic void nodeDeleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell){\r\n  u8 *pDst = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];\r\n  u8 *pSrc = &pDst[pRtree->nBytesPerCell];\r\n  int nByte = (NCELL(pNode) - iCell - 1) * pRtree->nBytesPerCell;\r\n  memmove(pDst, pSrc, nByte);\r\n  writeInt16(&pNode->zData[2], NCELL(pNode)-1);\r\n  pNode->isDirty = 1;\r\n}\r\n\r\n/*\r\n** Insert the contents of cell pCell into node pNode. If the insert\r\n** is successful, return SQLITE_OK.\r\n**\r\n** If there is not enough free space in pNode, return SQLITE_FULL.\r\n*/\r\nstatic int\r\nnodeInsertCell(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode, \r\n  RtreeCell *pCell \r\n){\r\n  int nCell;                    /* Current number of cells in pNode */\r\n  int nMaxCell;                 /* Maximum number of cells for pNode */\r\n\r\n  nMaxCell = (pRtree->iNodeSize-4)/pRtree->nBytesPerCell;\r\n  nCell = NCELL(pNode);\r\n\r\n  assert( nCell<=nMaxCell );\r\n  if( nCell<nMaxCell ){\r\n    nodeOverwriteCell(pRtree, pNode, pCell, nCell);\r\n    writeInt16(&pNode->zData[2], nCell+1);\r\n    pNode->isDirty = 1;\r\n  }\r\n\r\n  return (nCell==nMaxCell);\r\n}\r\n\r\n/*\r\n** If the node is dirty, write it out to the database.\r\n*/\r\nstatic int\r\nnodeWrite(Rtree *pRtree, RtreeNode *pNode){\r\n  int rc = SQLITE_OK;\r\n  if( pNode->isDirty ){\r\n    sqlite3_stmt *p = pRtree->pWriteNode;\r\n    if( pNode->iNode ){\r\n      sqlite3_bind_int64(p, 1, pNode->iNode);\r\n    }else{\r\n      sqlite3_bind_null(p, 1);\r\n    }\r\n    sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC);\r\n    sqlite3_step(p);\r\n    pNode->isDirty = 0;\r\n    rc = sqlite3_reset(p);\r\n    if( pNode->iNode==0 && rc==SQLITE_OK ){\r\n      pNode->iNode = sqlite3_last_insert_rowid(pRtree->db);\r\n      nodeHashInsert(pRtree, pNode);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Release a reference to a node. If the node is dirty and the reference\r\n** count drops to zero, the node data is written to the database.\r\n*/\r\nstatic int\r\nnodeRelease(Rtree *pRtree, RtreeNode *pNode){\r\n  int rc = SQLITE_OK;\r\n  if( pNode ){\r\n    assert( pNode->nRef>0 );\r\n    pNode->nRef--;\r\n    if( pNode->nRef==0 ){\r\n      if( pNode->iNode==1 ){\r\n        pRtree->iDepth = -1;\r\n      }\r\n      if( pNode->pParent ){\r\n        rc = nodeRelease(pRtree, pNode->pParent);\r\n      }\r\n      if( rc==SQLITE_OK ){\r\n        rc = nodeWrite(pRtree, pNode);\r\n      }\r\n      nodeHashDelete(pRtree, pNode);\r\n      sqlite3_free(pNode);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the 64-bit integer value associated with cell iCell of\r\n** node pNode. If pNode is a leaf node, this is a rowid. If it is\r\n** an internal node, then the 64-bit integer is a child page number.\r\n*/\r\nstatic i64 nodeGetRowid(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode, \r\n  int iCell\r\n){\r\n  assert( iCell<NCELL(pNode) );\r\n  return readInt64(&pNode->zData[4 + pRtree->nBytesPerCell*iCell]);\r\n}\r\n\r\n/*\r\n** Return coordinate iCoord from cell iCell in node pNode.\r\n*/\r\nstatic void nodeGetCoord(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode, \r\n  int iCell,\r\n  int iCoord,\r\n  RtreeCoord *pCoord           /* Space to write result to */\r\n){\r\n  readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord);\r\n}\r\n\r\n/*\r\n** Deserialize cell iCell of node pNode. Populate the structure pointed\r\n** to by pCell with the results.\r\n*/\r\nstatic void nodeGetCell(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode, \r\n  int iCell,\r\n  RtreeCell *pCell\r\n){\r\n  int ii;\r\n  pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell);\r\n  for(ii=0; ii<pRtree->nDim*2; ii++){\r\n    nodeGetCoord(pRtree, pNode, iCell, ii, &pCell->aCoord[ii]);\r\n  }\r\n}\r\n\r\n\r\n/* Forward declaration for the function that does the work of\r\n** the virtual table module xCreate() and xConnect() methods.\r\n*/\r\nstatic int rtreeInit(\r\n  sqlite3 *, void *, int, const char *const*, sqlite3_vtab **, char **, int\r\n);\r\n\r\n/* \r\n** Rtree virtual table module xCreate method.\r\n*/\r\nstatic int rtreeCreate(\r\n  sqlite3 *db,\r\n  void *pAux,\r\n  int argc, const char *const*argv,\r\n  sqlite3_vtab **ppVtab,\r\n  char **pzErr\r\n){\r\n  return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 1);\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xConnect method.\r\n*/\r\nstatic int rtreeConnect(\r\n  sqlite3 *db,\r\n  void *pAux,\r\n  int argc, const char *const*argv,\r\n  sqlite3_vtab **ppVtab,\r\n  char **pzErr\r\n){\r\n  return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 0);\r\n}\r\n\r\n/*\r\n** Increment the r-tree reference count.\r\n*/\r\nstatic void rtreeReference(Rtree *pRtree){\r\n  pRtree->nBusy++;\r\n}\r\n\r\n/*\r\n** Decrement the r-tree reference count. When the reference count reaches\r\n** zero the structure is deleted.\r\n*/\r\nstatic void rtreeRelease(Rtree *pRtree){\r\n  pRtree->nBusy--;\r\n  if( pRtree->nBusy==0 ){\r\n    sqlite3_finalize(pRtree->pReadNode);\r\n    sqlite3_finalize(pRtree->pWriteNode);\r\n    sqlite3_finalize(pRtree->pDeleteNode);\r\n    sqlite3_finalize(pRtree->pReadRowid);\r\n    sqlite3_finalize(pRtree->pWriteRowid);\r\n    sqlite3_finalize(pRtree->pDeleteRowid);\r\n    sqlite3_finalize(pRtree->pReadParent);\r\n    sqlite3_finalize(pRtree->pWriteParent);\r\n    sqlite3_finalize(pRtree->pDeleteParent);\r\n    sqlite3_free(pRtree);\r\n  }\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xDisconnect method.\r\n*/\r\nstatic int rtreeDisconnect(sqlite3_vtab *pVtab){\r\n  rtreeRelease((Rtree *)pVtab);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xDestroy method.\r\n*/\r\nstatic int rtreeDestroy(sqlite3_vtab *pVtab){\r\n  Rtree *pRtree = (Rtree *)pVtab;\r\n  int rc;\r\n  char *zCreate = sqlite3_mprintf(\r\n    \"DROP TABLE '%q'.'%q_node';\"\r\n    \"DROP TABLE '%q'.'%q_rowid';\"\r\n    \"DROP TABLE '%q'.'%q_parent';\",\r\n    pRtree->zDb, pRtree->zName, \r\n    pRtree->zDb, pRtree->zName,\r\n    pRtree->zDb, pRtree->zName\r\n  );\r\n  if( !zCreate ){\r\n    rc = SQLITE_NOMEM;\r\n  }else{\r\n    rc = sqlite3_exec(pRtree->db, zCreate, 0, 0, 0);\r\n    sqlite3_free(zCreate);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    rtreeRelease(pRtree);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xOpen method.\r\n*/\r\nstatic int rtreeOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){\r\n  int rc = SQLITE_NOMEM;\r\n  RtreeCursor *pCsr;\r\n\r\n  pCsr = (RtreeCursor *)sqlite3_malloc(sizeof(RtreeCursor));\r\n  if( pCsr ){\r\n    memset(pCsr, 0, sizeof(RtreeCursor));\r\n    pCsr->base.pVtab = pVTab;\r\n    rc = SQLITE_OK;\r\n  }\r\n  *ppCursor = (sqlite3_vtab_cursor *)pCsr;\r\n\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Free the RtreeCursor.aConstraint[] array and its contents.\r\n*/\r\nstatic void freeCursorConstraints(RtreeCursor *pCsr){\r\n  if( pCsr->aConstraint ){\r\n    int i;                        /* Used to iterate through constraint array */\r\n    for(i=0; i<pCsr->nConstraint; i++){\r\n      sqlite3_rtree_geometry *pGeom = pCsr->aConstraint[i].pGeom;\r\n      if( pGeom ){\r\n        if( pGeom->xDelUser ) pGeom->xDelUser(pGeom->pUser);\r\n        sqlite3_free(pGeom);\r\n      }\r\n    }\r\n    sqlite3_free(pCsr->aConstraint);\r\n    pCsr->aConstraint = 0;\r\n  }\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xClose method.\r\n*/\r\nstatic int rtreeClose(sqlite3_vtab_cursor *cur){\r\n  Rtree *pRtree = (Rtree *)(cur->pVtab);\r\n  int rc;\r\n  RtreeCursor *pCsr = (RtreeCursor *)cur;\r\n  freeCursorConstraints(pCsr);\r\n  rc = nodeRelease(pRtree, pCsr->pNode);\r\n  sqlite3_free(pCsr);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Rtree virtual table module xEof method.\r\n**\r\n** Return non-zero if the cursor does not currently point to a valid \r\n** record (i.e if the scan has finished), or zero otherwise.\r\n*/\r\nstatic int rtreeEof(sqlite3_vtab_cursor *cur){\r\n  RtreeCursor *pCsr = (RtreeCursor *)cur;\r\n  return (pCsr->pNode==0);\r\n}\r\n\r\n/*\r\n** The r-tree constraint passed as the second argument to this function is\r\n** guaranteed to be a MATCH constraint.\r\n*/\r\nstatic int testRtreeGeom(\r\n  Rtree *pRtree,                  /* R-Tree object */\r\n  RtreeConstraint *pConstraint,   /* MATCH constraint to test */\r\n  RtreeCell *pCell,               /* Cell to test */\r\n  int *pbRes                      /* OUT: Test result */\r\n){\r\n  int i;\r\n  double aCoord[RTREE_MAX_DIMENSIONS*2];\r\n  int nCoord = pRtree->nDim*2;\r\n\r\n  assert( pConstraint->op==RTREE_MATCH );\r\n  assert( pConstraint->pGeom );\r\n\r\n  for(i=0; i<nCoord; i++){\r\n    aCoord[i] = DCOORD(pCell->aCoord[i]);\r\n  }\r\n  return pConstraint->xGeom(pConstraint->pGeom, nCoord, aCoord, pbRes);\r\n}\r\n\r\n/* \r\n** Cursor pCursor currently points to a cell in a non-leaf page.\r\n** Set *pbEof to true if the sub-tree headed by the cell is filtered\r\n** (excluded) by the constraints in the pCursor->aConstraint[] \r\n** array, or false otherwise.\r\n**\r\n** Return SQLITE_OK if successful or an SQLite error code if an error\r\n** occurs within a geometry callback.\r\n*/\r\nstatic int testRtreeCell(Rtree *pRtree, RtreeCursor *pCursor, int *pbEof){\r\n  RtreeCell cell;\r\n  int ii;\r\n  int bRes = 0;\r\n  int rc = SQLITE_OK;\r\n\r\n  nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);\r\n  for(ii=0; bRes==0 && ii<pCursor->nConstraint; ii++){\r\n    RtreeConstraint *p = &pCursor->aConstraint[ii];\r\n    double cell_min = DCOORD(cell.aCoord[(p->iCoord>>1)*2]);\r\n    double cell_max = DCOORD(cell.aCoord[(p->iCoord>>1)*2+1]);\r\n\r\n    assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE \r\n        || p->op==RTREE_GT || p->op==RTREE_EQ || p->op==RTREE_MATCH\r\n    );\r\n\r\n    switch( p->op ){\r\n      case RTREE_LE: case RTREE_LT: \r\n        bRes = p->rValue<cell_min; \r\n        break;\r\n\r\n      case RTREE_GE: case RTREE_GT: \r\n        bRes = p->rValue>cell_max; \r\n        break;\r\n\r\n      case RTREE_EQ:\r\n        bRes = (p->rValue>cell_max || p->rValue<cell_min);\r\n        break;\r\n\r\n      default: {\r\n        assert( p->op==RTREE_MATCH );\r\n        rc = testRtreeGeom(pRtree, p, &cell, &bRes);\r\n        bRes = !bRes;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n  *pbEof = bRes;\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Test if the cell that cursor pCursor currently points to\r\n** would be filtered (excluded) by the constraints in the \r\n** pCursor->aConstraint[] array. If so, set *pbEof to true before\r\n** returning. If the cell is not filtered (excluded) by the constraints,\r\n** set pbEof to zero.\r\n**\r\n** Return SQLITE_OK if successful or an SQLite error code if an error\r\n** occurs within a geometry callback.\r\n**\r\n** This function assumes that the cell is part of a leaf node.\r\n*/\r\nstatic int testRtreeEntry(Rtree *pRtree, RtreeCursor *pCursor, int *pbEof){\r\n  RtreeCell cell;\r\n  int ii;\r\n  *pbEof = 0;\r\n\r\n  nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);\r\n  for(ii=0; ii<pCursor->nConstraint; ii++){\r\n    RtreeConstraint *p = &pCursor->aConstraint[ii];\r\n    double coord = DCOORD(cell.aCoord[p->iCoord]);\r\n    int res;\r\n    assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE \r\n        || p->op==RTREE_GT || p->op==RTREE_EQ || p->op==RTREE_MATCH\r\n    );\r\n    switch( p->op ){\r\n      case RTREE_LE: res = (coord<=p->rValue); break;\r\n      case RTREE_LT: res = (coord<p->rValue);  break;\r\n      case RTREE_GE: res = (coord>=p->rValue); break;\r\n      case RTREE_GT: res = (coord>p->rValue);  break;\r\n      case RTREE_EQ: res = (coord==p->rValue); break;\r\n      default: {\r\n        int rc;\r\n        assert( p->op==RTREE_MATCH );\r\n        rc = testRtreeGeom(pRtree, p, &cell, &res);\r\n        if( rc!=SQLITE_OK ){\r\n          return rc;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n\r\n    if( !res ){\r\n      *pbEof = 1;\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Cursor pCursor currently points at a node that heads a sub-tree of\r\n** height iHeight (if iHeight==0, then the node is a leaf). Descend\r\n** to point to the left-most cell of the sub-tree that matches the \r\n** configured constraints.\r\n*/\r\nstatic int descendToCell(\r\n  Rtree *pRtree, \r\n  RtreeCursor *pCursor, \r\n  int iHeight,\r\n  int *pEof                 /* OUT: Set to true if cannot descend */\r\n){\r\n  int isEof;\r\n  int rc;\r\n  int ii;\r\n  RtreeNode *pChild;\r\n  sqlite3_int64 iRowid;\r\n\r\n  RtreeNode *pSavedNode = pCursor->pNode;\r\n  int iSavedCell = pCursor->iCell;\r\n\r\n  assert( iHeight>=0 );\r\n\r\n  if( iHeight==0 ){\r\n    rc = testRtreeEntry(pRtree, pCursor, &isEof);\r\n  }else{\r\n    rc = testRtreeCell(pRtree, pCursor, &isEof);\r\n  }\r\n  if( rc!=SQLITE_OK || isEof || iHeight==0 ){\r\n    goto descend_to_cell_out;\r\n  }\r\n\r\n  iRowid = nodeGetRowid(pRtree, pCursor->pNode, pCursor->iCell);\r\n  rc = nodeAcquire(pRtree, iRowid, pCursor->pNode, &pChild);\r\n  if( rc!=SQLITE_OK ){\r\n    goto descend_to_cell_out;\r\n  }\r\n\r\n  nodeRelease(pRtree, pCursor->pNode);\r\n  pCursor->pNode = pChild;\r\n  isEof = 1;\r\n  for(ii=0; isEof && ii<NCELL(pChild); ii++){\r\n    pCursor->iCell = ii;\r\n    rc = descendToCell(pRtree, pCursor, iHeight-1, &isEof);\r\n    if( rc!=SQLITE_OK ){\r\n      goto descend_to_cell_out;\r\n    }\r\n  }\r\n\r\n  if( isEof ){\r\n    assert( pCursor->pNode==pChild );\r\n    nodeReference(pSavedNode);\r\n    nodeRelease(pRtree, pChild);\r\n    pCursor->pNode = pSavedNode;\r\n    pCursor->iCell = iSavedCell;\r\n  }\r\n\r\ndescend_to_cell_out:\r\n  *pEof = isEof;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** One of the cells in node pNode is guaranteed to have a 64-bit \r\n** integer value equal to iRowid. Return the index of this cell.\r\n*/\r\nstatic int nodeRowidIndex(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode, \r\n  i64 iRowid,\r\n  int *piIndex\r\n){\r\n  int ii;\r\n  int nCell = NCELL(pNode);\r\n  for(ii=0; ii<nCell; ii++){\r\n    if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){\r\n      *piIndex = ii;\r\n      return SQLITE_OK;\r\n    }\r\n  }\r\n  return SQLITE_CORRUPT_VTAB;\r\n}\r\n\r\n/*\r\n** Return the index of the cell containing a pointer to node pNode\r\n** in its parent. If pNode is the root node, return -1.\r\n*/\r\nstatic int nodeParentIndex(Rtree *pRtree, RtreeNode *pNode, int *piIndex){\r\n  RtreeNode *pParent = pNode->pParent;\r\n  if( pParent ){\r\n    return nodeRowidIndex(pRtree, pParent, pNode->iNode, piIndex);\r\n  }\r\n  *piIndex = -1;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xNext method.\r\n*/\r\nstatic int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){\r\n  Rtree *pRtree = (Rtree *)(pVtabCursor->pVtab);\r\n  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;\r\n  int rc = SQLITE_OK;\r\n\r\n  /* RtreeCursor.pNode must not be NULL. If is is NULL, then this cursor is\r\n  ** already at EOF. It is against the rules to call the xNext() method of\r\n  ** a cursor that has already reached EOF.\r\n  */\r\n  assert( pCsr->pNode );\r\n\r\n  if( pCsr->iStrategy==1 ){\r\n    /* This \"scan\" is a direct lookup by rowid. There is no next entry. */\r\n    nodeRelease(pRtree, pCsr->pNode);\r\n    pCsr->pNode = 0;\r\n  }else{\r\n    /* Move to the next entry that matches the configured constraints. */\r\n    int iHeight = 0;\r\n    while( pCsr->pNode ){\r\n      RtreeNode *pNode = pCsr->pNode;\r\n      int nCell = NCELL(pNode);\r\n      for(pCsr->iCell++; pCsr->iCell<nCell; pCsr->iCell++){\r\n        int isEof;\r\n        rc = descendToCell(pRtree, pCsr, iHeight, &isEof);\r\n        if( rc!=SQLITE_OK || !isEof ){\r\n          return rc;\r\n        }\r\n      }\r\n      pCsr->pNode = pNode->pParent;\r\n      rc = nodeParentIndex(pRtree, pNode, &pCsr->iCell);\r\n      if( rc!=SQLITE_OK ){\r\n        return rc;\r\n      }\r\n      nodeReference(pCsr->pNode);\r\n      nodeRelease(pRtree, pNode);\r\n      iHeight++;\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xRowid method.\r\n*/\r\nstatic int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){\r\n  Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;\r\n  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;\r\n\r\n  assert(pCsr->pNode);\r\n  *pRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xColumn method.\r\n*/\r\nstatic int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){\r\n  Rtree *pRtree = (Rtree *)cur->pVtab;\r\n  RtreeCursor *pCsr = (RtreeCursor *)cur;\r\n\r\n  if( i==0 ){\r\n    i64 iRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);\r\n    sqlite3_result_int64(ctx, iRowid);\r\n  }else{\r\n    RtreeCoord c;\r\n    nodeGetCoord(pRtree, pCsr->pNode, pCsr->iCell, i-1, &c);\r\n    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){\r\n      sqlite3_result_double(ctx, c.f);\r\n    }else{\r\n      assert( pRtree->eCoordType==RTREE_COORD_INT32 );\r\n      sqlite3_result_int(ctx, c.i);\r\n    }\r\n  }\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n** Use nodeAcquire() to obtain the leaf node containing the record with \r\n** rowid iRowid. If successful, set *ppLeaf to point to the node and\r\n** return SQLITE_OK. If there is no such record in the table, set\r\n** *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf\r\n** to zero and return an SQLite error code.\r\n*/\r\nstatic int findLeafNode(Rtree *pRtree, i64 iRowid, RtreeNode **ppLeaf){\r\n  int rc;\r\n  *ppLeaf = 0;\r\n  sqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid);\r\n  if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){\r\n    i64 iNode = sqlite3_column_int64(pRtree->pReadRowid, 0);\r\n    rc = nodeAcquire(pRtree, iNode, 0, ppLeaf);\r\n    sqlite3_reset(pRtree->pReadRowid);\r\n  }else{\r\n    rc = sqlite3_reset(pRtree->pReadRowid);\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called to configure the RtreeConstraint object passed\r\n** as the second argument for a MATCH constraint. The value passed as the\r\n** first argument to this function is the right-hand operand to the MATCH\r\n** operator.\r\n*/\r\nstatic int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){\r\n  RtreeMatchArg *p;\r\n  sqlite3_rtree_geometry *pGeom;\r\n  int nBlob;\r\n\r\n  /* Check that value is actually a blob. */\r\n  if( sqlite3_value_type(pValue)!=SQLITE_BLOB ) return SQLITE_ERROR;\r\n\r\n  /* Check that the blob is roughly the right size. */\r\n  nBlob = sqlite3_value_bytes(pValue);\r\n  if( nBlob<(int)sizeof(RtreeMatchArg) \r\n   || ((nBlob-sizeof(RtreeMatchArg))%sizeof(double))!=0\r\n  ){\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  pGeom = (sqlite3_rtree_geometry *)sqlite3_malloc(\r\n      sizeof(sqlite3_rtree_geometry) + nBlob\r\n  );\r\n  if( !pGeom ) return SQLITE_NOMEM;\r\n  memset(pGeom, 0, sizeof(sqlite3_rtree_geometry));\r\n  p = (RtreeMatchArg *)&pGeom[1];\r\n\r\n  memcpy(p, sqlite3_value_blob(pValue), nBlob);\r\n  if( p->magic!=RTREE_GEOMETRY_MAGIC \r\n   || nBlob!=(int)(sizeof(RtreeMatchArg) + (p->nParam-1)*sizeof(double))\r\n  ){\r\n    sqlite3_free(pGeom);\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  pGeom->pContext = p->pContext;\r\n  pGeom->nParam = p->nParam;\r\n  pGeom->aParam = p->aParam;\r\n\r\n  pCons->xGeom = p->xGeom;\r\n  pCons->pGeom = pGeom;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/* \r\n** Rtree virtual table module xFilter method.\r\n*/\r\nstatic int rtreeFilter(\r\n  sqlite3_vtab_cursor *pVtabCursor, \r\n  int idxNum, const char *idxStr,\r\n  int argc, sqlite3_value **argv\r\n){\r\n  Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;\r\n  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;\r\n\r\n  RtreeNode *pRoot = 0;\r\n  int ii;\r\n  int rc = SQLITE_OK;\r\n\r\n  rtreeReference(pRtree);\r\n\r\n  freeCursorConstraints(pCsr);\r\n  pCsr->iStrategy = idxNum;\r\n\r\n  if( idxNum==1 ){\r\n    /* Special case - lookup by rowid. */\r\n    RtreeNode *pLeaf;        /* Leaf on which the required cell resides */\r\n    i64 iRowid = sqlite3_value_int64(argv[0]);\r\n    rc = findLeafNode(pRtree, iRowid, &pLeaf);\r\n    pCsr->pNode = pLeaf; \r\n    if( pLeaf ){\r\n      assert( rc==SQLITE_OK );\r\n      rc = nodeRowidIndex(pRtree, pLeaf, iRowid, &pCsr->iCell);\r\n    }\r\n  }else{\r\n    /* Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array \r\n    ** with the configured constraints. \r\n    */\r\n    if( argc>0 ){\r\n      pCsr->aConstraint = sqlite3_malloc(sizeof(RtreeConstraint)*argc);\r\n      pCsr->nConstraint = argc;\r\n      if( !pCsr->aConstraint ){\r\n        rc = SQLITE_NOMEM;\r\n      }else{\r\n        memset(pCsr->aConstraint, 0, sizeof(RtreeConstraint)*argc);\r\n        assert( (idxStr==0 && argc==0)\r\n                || (idxStr && (int)strlen(idxStr)==argc*2) );\r\n        for(ii=0; ii<argc; ii++){\r\n          RtreeConstraint *p = &pCsr->aConstraint[ii];\r\n          p->op = idxStr[ii*2];\r\n          p->iCoord = idxStr[ii*2+1]-'a';\r\n          if( p->op==RTREE_MATCH ){\r\n            /* A MATCH operator. The right-hand-side must be a blob that\r\n            ** can be cast into an RtreeMatchArg object. One created using\r\n            ** an sqlite3_rtree_geometry_callback() SQL user function.\r\n            */\r\n            rc = deserializeGeometry(argv[ii], p);\r\n            if( rc!=SQLITE_OK ){\r\n              break;\r\n            }\r\n          }else{\r\n            p->rValue = sqlite3_value_double(argv[ii]);\r\n          }\r\n        }\r\n      }\r\n    }\r\n  \r\n    if( rc==SQLITE_OK ){\r\n      pCsr->pNode = 0;\r\n      rc = nodeAcquire(pRtree, 1, 0, &pRoot);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      int isEof = 1;\r\n      int nCell = NCELL(pRoot);\r\n      pCsr->pNode = pRoot;\r\n      for(pCsr->iCell=0; rc==SQLITE_OK && pCsr->iCell<nCell; pCsr->iCell++){\r\n        assert( pCsr->pNode==pRoot );\r\n        rc = descendToCell(pRtree, pCsr, pRtree->iDepth, &isEof);\r\n        if( !isEof ){\r\n          break;\r\n        }\r\n      }\r\n      if( rc==SQLITE_OK && isEof ){\r\n        assert( pCsr->pNode==pRoot );\r\n        nodeRelease(pRtree, pRoot);\r\n        pCsr->pNode = 0;\r\n      }\r\n      assert( rc!=SQLITE_OK || !pCsr->pNode || pCsr->iCell<NCELL(pCsr->pNode) );\r\n    }\r\n  }\r\n\r\n  rtreeRelease(pRtree);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Rtree virtual table module xBestIndex method. There are three\r\n** table scan strategies to choose from (in order from most to \r\n** least desirable):\r\n**\r\n**   idxNum     idxStr        Strategy\r\n**   ------------------------------------------------\r\n**     1        Unused        Direct lookup by rowid.\r\n**     2        See below     R-tree query or full-table scan.\r\n**   ------------------------------------------------\r\n**\r\n** If strategy 1 is used, then idxStr is not meaningful. If strategy\r\n** 2 is used, idxStr is formatted to contain 2 bytes for each \r\n** constraint used. The first two bytes of idxStr correspond to \r\n** the constraint in sqlite3_index_info.aConstraintUsage[] with\r\n** (argvIndex==1) etc.\r\n**\r\n** The first of each pair of bytes in idxStr identifies the constraint\r\n** operator as follows:\r\n**\r\n**   Operator    Byte Value\r\n**   ----------------------\r\n**      =        0x41 ('A')\r\n**     <=        0x42 ('B')\r\n**      <        0x43 ('C')\r\n**     >=        0x44 ('D')\r\n**      >        0x45 ('E')\r\n**   MATCH       0x46 ('F')\r\n**   ----------------------\r\n**\r\n** The second of each pair of bytes identifies the coordinate column\r\n** to which the constraint applies. The leftmost coordinate column\r\n** is 'a', the second from the left 'b' etc.\r\n*/\r\nstatic int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){\r\n  int rc = SQLITE_OK;\r\n  int ii;\r\n\r\n  int iIdx = 0;\r\n  char zIdxStr[RTREE_MAX_DIMENSIONS*8+1];\r\n  memset(zIdxStr, 0, sizeof(zIdxStr));\r\n  UNUSED_PARAMETER(tab);\r\n\r\n  assert( pIdxInfo->idxStr==0 );\r\n  for(ii=0; ii<pIdxInfo->nConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){\r\n    struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii];\r\n\r\n    if( p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){\r\n      /* We have an equality constraint on the rowid. Use strategy 1. */\r\n      int jj;\r\n      for(jj=0; jj<ii; jj++){\r\n        pIdxInfo->aConstraintUsage[jj].argvIndex = 0;\r\n        pIdxInfo->aConstraintUsage[jj].omit = 0;\r\n      }\r\n      pIdxInfo->idxNum = 1;\r\n      pIdxInfo->aConstraintUsage[ii].argvIndex = 1;\r\n      pIdxInfo->aConstraintUsage[jj].omit = 1;\r\n\r\n      /* This strategy involves a two rowid lookups on an B-Tree structures\r\n      ** and then a linear search of an R-Tree node. This should be \r\n      ** considered almost as quick as a direct rowid lookup (for which \r\n      ** sqlite uses an internal cost of 0.0).\r\n      */ \r\n      pIdxInfo->estimatedCost = 10.0;\r\n      return SQLITE_OK;\r\n    }\r\n\r\n    if( p->usable && (p->iColumn>0 || p->op==SQLITE_INDEX_CONSTRAINT_MATCH) ){\r\n      u8 op;\r\n      switch( p->op ){\r\n        case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; break;\r\n        case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break;\r\n        case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break;\r\n        case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break;\r\n        case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break;\r\n        default:\r\n          assert( p->op==SQLITE_INDEX_CONSTRAINT_MATCH );\r\n          op = RTREE_MATCH; \r\n          break;\r\n      }\r\n      zIdxStr[iIdx++] = op;\r\n      zIdxStr[iIdx++] = p->iColumn - 1 + 'a';\r\n      pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);\r\n      pIdxInfo->aConstraintUsage[ii].omit = 1;\r\n    }\r\n  }\r\n\r\n  pIdxInfo->idxNum = 2;\r\n  pIdxInfo->needToFreeIdxStr = 1;\r\n  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf(\"%s\", zIdxStr)) ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  assert( iIdx>=0 );\r\n  pIdxInfo->estimatedCost = (2000000.0 / (double)(iIdx + 1));\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Return the N-dimensional volumn of the cell stored in *p.\r\n*/\r\nstatic float cellArea(Rtree *pRtree, RtreeCell *p){\r\n  float area = 1.0;\r\n  int ii;\r\n  for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n    area = (float)(area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii])));\r\n  }\r\n  return area;\r\n}\r\n\r\n/*\r\n** Return the margin length of cell p. The margin length is the sum\r\n** of the objects size in each dimension.\r\n*/\r\nstatic float cellMargin(Rtree *pRtree, RtreeCell *p){\r\n  float margin = 0.0;\r\n  int ii;\r\n  for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n    margin += (float)(DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));\r\n  }\r\n  return margin;\r\n}\r\n\r\n/*\r\n** Store the union of cells p1 and p2 in p1.\r\n*/\r\nstatic void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){\r\n  int ii;\r\n  if( pRtree->eCoordType==RTREE_COORD_REAL32 ){\r\n    for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n      p1->aCoord[ii].f = MIN(p1->aCoord[ii].f, p2->aCoord[ii].f);\r\n      p1->aCoord[ii+1].f = MAX(p1->aCoord[ii+1].f, p2->aCoord[ii+1].f);\r\n    }\r\n  }else{\r\n    for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n      p1->aCoord[ii].i = MIN(p1->aCoord[ii].i, p2->aCoord[ii].i);\r\n      p1->aCoord[ii+1].i = MAX(p1->aCoord[ii+1].i, p2->aCoord[ii+1].i);\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n** Return true if the area covered by p2 is a subset of the area covered\r\n** by p1. False otherwise.\r\n*/\r\nstatic int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){\r\n  int ii;\r\n  int isInt = (pRtree->eCoordType==RTREE_COORD_INT32);\r\n  for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n    RtreeCoord *a1 = &p1->aCoord[ii];\r\n    RtreeCoord *a2 = &p2->aCoord[ii];\r\n    if( (!isInt && (a2[0].f<a1[0].f || a2[1].f>a1[1].f)) \r\n     || ( isInt && (a2[0].i<a1[0].i || a2[1].i>a1[1].i)) \r\n    ){\r\n      return 0;\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n\r\n/*\r\n** Return the amount cell p would grow by if it were unioned with pCell.\r\n*/\r\nstatic float cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){\r\n  float area;\r\n  RtreeCell cell;\r\n  memcpy(&cell, p, sizeof(RtreeCell));\r\n  area = cellArea(pRtree, &cell);\r\n  cellUnion(pRtree, &cell, pCell);\r\n  return (cellArea(pRtree, &cell)-area);\r\n}\r\n\r\n#if VARIANT_RSTARTREE_CHOOSESUBTREE || VARIANT_RSTARTREE_SPLIT\r\nstatic float cellOverlap(\r\n  Rtree *pRtree, \r\n  RtreeCell *p, \r\n  RtreeCell *aCell, \r\n  int nCell, \r\n  int iExclude\r\n){\r\n  int ii;\r\n  float overlap = 0.0;\r\n  for(ii=0; ii<nCell; ii++){\r\n#if VARIANT_RSTARTREE_CHOOSESUBTREE\r\n    if( ii!=iExclude )\r\n#else\r\n    assert( iExclude==-1 );\r\n    UNUSED_PARAMETER(iExclude);\r\n#endif\r\n    {\r\n      int jj;\r\n      float o = 1.0;\r\n      for(jj=0; jj<(pRtree->nDim*2); jj+=2){\r\n        double x1;\r\n        double x2;\r\n\r\n        x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));\r\n        x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));\r\n\r\n        if( x2<x1 ){\r\n          o = 0.0;\r\n          break;\r\n        }else{\r\n          o = o * (float)(x2-x1);\r\n        }\r\n      }\r\n      overlap += o;\r\n    }\r\n  }\r\n  return overlap;\r\n}\r\n#endif\r\n\r\n#if VARIANT_RSTARTREE_CHOOSESUBTREE\r\nstatic float cellOverlapEnlargement(\r\n  Rtree *pRtree, \r\n  RtreeCell *p, \r\n  RtreeCell *pInsert, \r\n  RtreeCell *aCell, \r\n  int nCell, \r\n  int iExclude\r\n){\r\n  double before;\r\n  double after;\r\n  before = cellOverlap(pRtree, p, aCell, nCell, iExclude);\r\n  cellUnion(pRtree, p, pInsert);\r\n  after = cellOverlap(pRtree, p, aCell, nCell, iExclude);\r\n  return (float)(after-before);\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n** This function implements the ChooseLeaf algorithm from Gutman[84].\r\n** ChooseSubTree in r*tree terminology.\r\n*/\r\nstatic int ChooseLeaf(\r\n  Rtree *pRtree,               /* Rtree table */\r\n  RtreeCell *pCell,            /* Cell to insert into rtree */\r\n  int iHeight,                 /* Height of sub-tree rooted at pCell */\r\n  RtreeNode **ppLeaf           /* OUT: Selected leaf page */\r\n){\r\n  int rc;\r\n  int ii;\r\n  RtreeNode *pNode;\r\n  rc = nodeAcquire(pRtree, 1, 0, &pNode);\r\n\r\n  for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){\r\n    int iCell;\r\n    sqlite3_int64 iBest = 0;\r\n\r\n    float fMinGrowth = 0.0;\r\n    float fMinArea = 0.0;\r\n#if VARIANT_RSTARTREE_CHOOSESUBTREE\r\n    float fMinOverlap = 0.0;\r\n    float overlap;\r\n#endif\r\n\r\n    int nCell = NCELL(pNode);\r\n    RtreeCell cell;\r\n    RtreeNode *pChild;\r\n\r\n    RtreeCell *aCell = 0;\r\n\r\n#if VARIANT_RSTARTREE_CHOOSESUBTREE\r\n    if( ii==(pRtree->iDepth-1) ){\r\n      int jj;\r\n      aCell = sqlite3_malloc(sizeof(RtreeCell)*nCell);\r\n      if( !aCell ){\r\n        rc = SQLITE_NOMEM;\r\n        nodeRelease(pRtree, pNode);\r\n        pNode = 0;\r\n        continue;\r\n      }\r\n      for(jj=0; jj<nCell; jj++){\r\n        nodeGetCell(pRtree, pNode, jj, &aCell[jj]);\r\n      }\r\n    }\r\n#endif\r\n\r\n    /* Select the child node which will be enlarged the least if pCell\r\n    ** is inserted into it. Resolve ties by choosing the entry with\r\n    ** the smallest area.\r\n    */\r\n    for(iCell=0; iCell<nCell; iCell++){\r\n      int bBest = 0;\r\n      float growth;\r\n      float area;\r\n      nodeGetCell(pRtree, pNode, iCell, &cell);\r\n      growth = cellGrowth(pRtree, &cell, pCell);\r\n      area = cellArea(pRtree, &cell);\r\n\r\n#if VARIANT_RSTARTREE_CHOOSESUBTREE\r\n      if( ii==(pRtree->iDepth-1) ){\r\n        overlap = cellOverlapEnlargement(pRtree,&cell,pCell,aCell,nCell,iCell);\r\n      }else{\r\n        overlap = 0.0;\r\n      }\r\n      if( (iCell==0) \r\n       || (overlap<fMinOverlap) \r\n       || (overlap==fMinOverlap && growth<fMinGrowth)\r\n       || (overlap==fMinOverlap && growth==fMinGrowth && area<fMinArea)\r\n      ){\r\n        bBest = 1;\r\n        fMinOverlap = overlap;\r\n      }\r\n#else\r\n      if( iCell==0||growth<fMinGrowth||(growth==fMinGrowth && area<fMinArea) ){\r\n        bBest = 1;\r\n      }\r\n#endif\r\n      if( bBest ){\r\n        fMinGrowth = growth;\r\n        fMinArea = area;\r\n        iBest = cell.iRowid;\r\n      }\r\n    }\r\n\r\n    sqlite3_free(aCell);\r\n    rc = nodeAcquire(pRtree, iBest, pNode, &pChild);\r\n    nodeRelease(pRtree, pNode);\r\n    pNode = pChild;\r\n  }\r\n\r\n  *ppLeaf = pNode;\r\n  return rc;\r\n}\r\n\r\n/*\r\n** A cell with the same content as pCell has just been inserted into\r\n** the node pNode. This function updates the bounding box cells in\r\n** all ancestor elements.\r\n*/\r\nstatic int AdjustTree(\r\n  Rtree *pRtree,                    /* Rtree table */\r\n  RtreeNode *pNode,                 /* Adjust ancestry of this node. */\r\n  RtreeCell *pCell                  /* This cell was just inserted */\r\n){\r\n  RtreeNode *p = pNode;\r\n  while( p->pParent ){\r\n    RtreeNode *pParent = p->pParent;\r\n    RtreeCell cell;\r\n    int iCell;\r\n\r\n    if( nodeParentIndex(pRtree, p, &iCell) ){\r\n      return SQLITE_CORRUPT_VTAB;\r\n    }\r\n\r\n    nodeGetCell(pRtree, pParent, iCell, &cell);\r\n    if( !cellContains(pRtree, &cell, pCell) ){\r\n      cellUnion(pRtree, &cell, pCell);\r\n      nodeOverwriteCell(pRtree, pParent, &cell, iCell);\r\n    }\r\n \r\n    p = pParent;\r\n  }\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Write mapping (iRowid->iNode) to the <rtree>_rowid table.\r\n*/\r\nstatic int rowidWrite(Rtree *pRtree, sqlite3_int64 iRowid, sqlite3_int64 iNode){\r\n  sqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid);\r\n  sqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode);\r\n  sqlite3_step(pRtree->pWriteRowid);\r\n  return sqlite3_reset(pRtree->pWriteRowid);\r\n}\r\n\r\n/*\r\n** Write mapping (iNode->iPar) to the <rtree>_parent table.\r\n*/\r\nstatic int parentWrite(Rtree *pRtree, sqlite3_int64 iNode, sqlite3_int64 iPar){\r\n  sqlite3_bind_int64(pRtree->pWriteParent, 1, iNode);\r\n  sqlite3_bind_int64(pRtree->pWriteParent, 2, iPar);\r\n  sqlite3_step(pRtree->pWriteParent);\r\n  return sqlite3_reset(pRtree->pWriteParent);\r\n}\r\n\r\nstatic int rtreeInsertCell(Rtree *, RtreeNode *, RtreeCell *, int);\r\n\r\n#if VARIANT_GUTTMAN_LINEAR_SPLIT\r\n/*\r\n** Implementation of the linear variant of the PickNext() function from\r\n** Guttman[84].\r\n*/\r\nstatic RtreeCell *LinearPickNext(\r\n  Rtree *pRtree,\r\n  RtreeCell *aCell, \r\n  int nCell, \r\n  RtreeCell *pLeftBox, \r\n  RtreeCell *pRightBox,\r\n  int *aiUsed\r\n){\r\n  int ii;\r\n  for(ii=0; aiUsed[ii]; ii++);\r\n  aiUsed[ii] = 1;\r\n  return &aCell[ii];\r\n}\r\n\r\n/*\r\n** Implementation of the linear variant of the PickSeeds() function from\r\n** Guttman[84].\r\n*/\r\nstatic void LinearPickSeeds(\r\n  Rtree *pRtree,\r\n  RtreeCell *aCell, \r\n  int nCell, \r\n  int *piLeftSeed, \r\n  int *piRightSeed\r\n){\r\n  int i;\r\n  int iLeftSeed = 0;\r\n  int iRightSeed = 1;\r\n  float maxNormalInnerWidth = 0.0;\r\n\r\n  /* Pick two \"seed\" cells from the array of cells. The algorithm used\r\n  ** here is the LinearPickSeeds algorithm from Gutman[1984]. The \r\n  ** indices of the two seed cells in the array are stored in local\r\n  ** variables iLeftSeek and iRightSeed.\r\n  */\r\n  for(i=0; i<pRtree->nDim; i++){\r\n    float x1 = DCOORD(aCell[0].aCoord[i*2]);\r\n    float x2 = DCOORD(aCell[0].aCoord[i*2+1]);\r\n    float x3 = x1;\r\n    float x4 = x2;\r\n    int jj;\r\n\r\n    int iCellLeft = 0;\r\n    int iCellRight = 0;\r\n\r\n    for(jj=1; jj<nCell; jj++){\r\n      float left = DCOORD(aCell[jj].aCoord[i*2]);\r\n      float right = DCOORD(aCell[jj].aCoord[i*2+1]);\r\n\r\n      if( left<x1 ) x1 = left;\r\n      if( right>x4 ) x4 = right;\r\n      if( left>x3 ){\r\n        x3 = left;\r\n        iCellRight = jj;\r\n      }\r\n      if( right<x2 ){\r\n        x2 = right;\r\n        iCellLeft = jj;\r\n      }\r\n    }\r\n\r\n    if( x4!=x1 ){\r\n      float normalwidth = (x3 - x2) / (x4 - x1);\r\n      if( normalwidth>maxNormalInnerWidth ){\r\n        iLeftSeed = iCellLeft;\r\n        iRightSeed = iCellRight;\r\n      }\r\n    }\r\n  }\r\n\r\n  *piLeftSeed = iLeftSeed;\r\n  *piRightSeed = iRightSeed;\r\n}\r\n#endif /* VARIANT_GUTTMAN_LINEAR_SPLIT */\r\n\r\n#if VARIANT_GUTTMAN_QUADRATIC_SPLIT\r\n/*\r\n** Implementation of the quadratic variant of the PickNext() function from\r\n** Guttman[84].\r\n*/\r\nstatic RtreeCell *QuadraticPickNext(\r\n  Rtree *pRtree,\r\n  RtreeCell *aCell, \r\n  int nCell, \r\n  RtreeCell *pLeftBox, \r\n  RtreeCell *pRightBox,\r\n  int *aiUsed\r\n){\r\n  #define FABS(a) ((a)<0.0?-1.0*(a):(a))\r\n\r\n  int iSelect = -1;\r\n  float fDiff;\r\n  int ii;\r\n  for(ii=0; ii<nCell; ii++){\r\n    if( aiUsed[ii]==0 ){\r\n      float left = cellGrowth(pRtree, pLeftBox, &aCell[ii]);\r\n      float right = cellGrowth(pRtree, pLeftBox, &aCell[ii]);\r\n      float diff = FABS(right-left);\r\n      if( iSelect<0 || diff>fDiff ){\r\n        fDiff = diff;\r\n        iSelect = ii;\r\n      }\r\n    }\r\n  }\r\n  aiUsed[iSelect] = 1;\r\n  return &aCell[iSelect];\r\n}\r\n\r\n/*\r\n** Implementation of the quadratic variant of the PickSeeds() function from\r\n** Guttman[84].\r\n*/\r\nstatic void QuadraticPickSeeds(\r\n  Rtree *pRtree,\r\n  RtreeCell *aCell, \r\n  int nCell, \r\n  int *piLeftSeed, \r\n  int *piRightSeed\r\n){\r\n  int ii;\r\n  int jj;\r\n\r\n  int iLeftSeed = 0;\r\n  int iRightSeed = 1;\r\n  float fWaste = 0.0;\r\n\r\n  for(ii=0; ii<nCell; ii++){\r\n    for(jj=ii+1; jj<nCell; jj++){\r\n      float right = cellArea(pRtree, &aCell[jj]);\r\n      float growth = cellGrowth(pRtree, &aCell[ii], &aCell[jj]);\r\n      float waste = growth - right;\r\n\r\n      if( waste>fWaste ){\r\n        iLeftSeed = ii;\r\n        iRightSeed = jj;\r\n        fWaste = waste;\r\n      }\r\n    }\r\n  }\r\n\r\n  *piLeftSeed = iLeftSeed;\r\n  *piRightSeed = iRightSeed;\r\n}\r\n#endif /* VARIANT_GUTTMAN_QUADRATIC_SPLIT */\r\n\r\n/*\r\n** Arguments aIdx, aDistance and aSpare all point to arrays of size\r\n** nIdx. The aIdx array contains the set of integers from 0 to \r\n** (nIdx-1) in no particular order. This function sorts the values\r\n** in aIdx according to the indexed values in aDistance. For\r\n** example, assuming the inputs:\r\n**\r\n**   aIdx      = { 0,   1,   2,   3 }\r\n**   aDistance = { 5.0, 2.0, 7.0, 6.0 }\r\n**\r\n** this function sets the aIdx array to contain:\r\n**\r\n**   aIdx      = { 0,   1,   2,   3 }\r\n**\r\n** The aSpare array is used as temporary working space by the\r\n** sorting algorithm.\r\n*/\r\nstatic void SortByDistance(\r\n  int *aIdx, \r\n  int nIdx, \r\n  float *aDistance, \r\n  int *aSpare\r\n){\r\n  if( nIdx>1 ){\r\n    int iLeft = 0;\r\n    int iRight = 0;\r\n\r\n    int nLeft = nIdx/2;\r\n    int nRight = nIdx-nLeft;\r\n    int *aLeft = aIdx;\r\n    int *aRight = &aIdx[nLeft];\r\n\r\n    SortByDistance(aLeft, nLeft, aDistance, aSpare);\r\n    SortByDistance(aRight, nRight, aDistance, aSpare);\r\n\r\n    memcpy(aSpare, aLeft, sizeof(int)*nLeft);\r\n    aLeft = aSpare;\r\n\r\n    while( iLeft<nLeft || iRight<nRight ){\r\n      if( iLeft==nLeft ){\r\n        aIdx[iLeft+iRight] = aRight[iRight];\r\n        iRight++;\r\n      }else if( iRight==nRight ){\r\n        aIdx[iLeft+iRight] = aLeft[iLeft];\r\n        iLeft++;\r\n      }else{\r\n        float fLeft = aDistance[aLeft[iLeft]];\r\n        float fRight = aDistance[aRight[iRight]];\r\n        if( fLeft<fRight ){\r\n          aIdx[iLeft+iRight] = aLeft[iLeft];\r\n          iLeft++;\r\n        }else{\r\n          aIdx[iLeft+iRight] = aRight[iRight];\r\n          iRight++;\r\n        }\r\n      }\r\n    }\r\n\r\n#if 0\r\n    /* Check that the sort worked */\r\n    {\r\n      int jj;\r\n      for(jj=1; jj<nIdx; jj++){\r\n        float left = aDistance[aIdx[jj-1]];\r\n        float right = aDistance[aIdx[jj]];\r\n        assert( left<=right );\r\n      }\r\n    }\r\n#endif\r\n  }\r\n}\r\n\r\n/*\r\n** Arguments aIdx, aCell and aSpare all point to arrays of size\r\n** nIdx. The aIdx array contains the set of integers from 0 to \r\n** (nIdx-1) in no particular order. This function sorts the values\r\n** in aIdx according to dimension iDim of the cells in aCell. The\r\n** minimum value of dimension iDim is considered first, the\r\n** maximum used to break ties.\r\n**\r\n** The aSpare array is used as temporary working space by the\r\n** sorting algorithm.\r\n*/\r\nstatic void SortByDimension(\r\n  Rtree *pRtree,\r\n  int *aIdx, \r\n  int nIdx, \r\n  int iDim, \r\n  RtreeCell *aCell, \r\n  int *aSpare\r\n){\r\n  if( nIdx>1 ){\r\n\r\n    int iLeft = 0;\r\n    int iRight = 0;\r\n\r\n    int nLeft = nIdx/2;\r\n    int nRight = nIdx-nLeft;\r\n    int *aLeft = aIdx;\r\n    int *aRight = &aIdx[nLeft];\r\n\r\n    SortByDimension(pRtree, aLeft, nLeft, iDim, aCell, aSpare);\r\n    SortByDimension(pRtree, aRight, nRight, iDim, aCell, aSpare);\r\n\r\n    memcpy(aSpare, aLeft, sizeof(int)*nLeft);\r\n    aLeft = aSpare;\r\n    while( iLeft<nLeft || iRight<nRight ){\r\n      double xleft1 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2]);\r\n      double xleft2 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2+1]);\r\n      double xright1 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2]);\r\n      double xright2 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2+1]);\r\n      if( (iLeft!=nLeft) && ((iRight==nRight)\r\n       || (xleft1<xright1)\r\n       || (xleft1==xright1 && xleft2<xright2)\r\n      )){\r\n        aIdx[iLeft+iRight] = aLeft[iLeft];\r\n        iLeft++;\r\n      }else{\r\n        aIdx[iLeft+iRight] = aRight[iRight];\r\n        iRight++;\r\n      }\r\n    }\r\n\r\n#if 0\r\n    /* Check that the sort worked */\r\n    {\r\n      int jj;\r\n      for(jj=1; jj<nIdx; jj++){\r\n        float xleft1 = aCell[aIdx[jj-1]].aCoord[iDim*2];\r\n        float xleft2 = aCell[aIdx[jj-1]].aCoord[iDim*2+1];\r\n        float xright1 = aCell[aIdx[jj]].aCoord[iDim*2];\r\n        float xright2 = aCell[aIdx[jj]].aCoord[iDim*2+1];\r\n        assert( xleft1<=xright1 && (xleft1<xright1 || xleft2<=xright2) );\r\n      }\r\n    }\r\n#endif\r\n  }\r\n}\r\n\r\n#if VARIANT_RSTARTREE_SPLIT\r\n/*\r\n** Implementation of the R*-tree variant of SplitNode from Beckman[1990].\r\n*/\r\nstatic int splitNodeStartree(\r\n  Rtree *pRtree,\r\n  RtreeCell *aCell,\r\n  int nCell,\r\n  RtreeNode *pLeft,\r\n  RtreeNode *pRight,\r\n  RtreeCell *pBboxLeft,\r\n  RtreeCell *pBboxRight\r\n){\r\n  int **aaSorted;\r\n  int *aSpare;\r\n  int ii;\r\n\r\n  int iBestDim = 0;\r\n  int iBestSplit = 0;\r\n  float fBestMargin = 0.0;\r\n\r\n  int nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int));\r\n\r\n  aaSorted = (int **)sqlite3_malloc(nByte);\r\n  if( !aaSorted ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n\r\n  aSpare = &((int *)&aaSorted[pRtree->nDim])[pRtree->nDim*nCell];\r\n  memset(aaSorted, 0, nByte);\r\n  for(ii=0; ii<pRtree->nDim; ii++){\r\n    int jj;\r\n    aaSorted[ii] = &((int *)&aaSorted[pRtree->nDim])[ii*nCell];\r\n    for(jj=0; jj<nCell; jj++){\r\n      aaSorted[ii][jj] = jj;\r\n    }\r\n    SortByDimension(pRtree, aaSorted[ii], nCell, ii, aCell, aSpare);\r\n  }\r\n\r\n  for(ii=0; ii<pRtree->nDim; ii++){\r\n    float margin = 0.0;\r\n    float fBestOverlap = 0.0;\r\n    float fBestArea = 0.0;\r\n    int iBestLeft = 0;\r\n    int nLeft;\r\n\r\n    for(\r\n      nLeft=RTREE_MINCELLS(pRtree); \r\n      nLeft<=(nCell-RTREE_MINCELLS(pRtree)); \r\n      nLeft++\r\n    ){\r\n      RtreeCell left;\r\n      RtreeCell right;\r\n      int kk;\r\n      float overlap;\r\n      float area;\r\n\r\n      memcpy(&left, &aCell[aaSorted[ii][0]], sizeof(RtreeCell));\r\n      memcpy(&right, &aCell[aaSorted[ii][nCell-1]], sizeof(RtreeCell));\r\n      for(kk=1; kk<(nCell-1); kk++){\r\n        if( kk<nLeft ){\r\n          cellUnion(pRtree, &left, &aCell[aaSorted[ii][kk]]);\r\n        }else{\r\n          cellUnion(pRtree, &right, &aCell[aaSorted[ii][kk]]);\r\n        }\r\n      }\r\n      margin += cellMargin(pRtree, &left);\r\n      margin += cellMargin(pRtree, &right);\r\n      overlap = cellOverlap(pRtree, &left, &right, 1, -1);\r\n      area = cellArea(pRtree, &left) + cellArea(pRtree, &right);\r\n      if( (nLeft==RTREE_MINCELLS(pRtree))\r\n       || (overlap<fBestOverlap)\r\n       || (overlap==fBestOverlap && area<fBestArea)\r\n      ){\r\n        iBestLeft = nLeft;\r\n        fBestOverlap = overlap;\r\n        fBestArea = area;\r\n      }\r\n    }\r\n\r\n    if( ii==0 || margin<fBestMargin ){\r\n      iBestDim = ii;\r\n      fBestMargin = margin;\r\n      iBestSplit = iBestLeft;\r\n    }\r\n  }\r\n\r\n  memcpy(pBboxLeft, &aCell[aaSorted[iBestDim][0]], sizeof(RtreeCell));\r\n  memcpy(pBboxRight, &aCell[aaSorted[iBestDim][iBestSplit]], sizeof(RtreeCell));\r\n  for(ii=0; ii<nCell; ii++){\r\n    RtreeNode *pTarget = (ii<iBestSplit)?pLeft:pRight;\r\n    RtreeCell *pBbox = (ii<iBestSplit)?pBboxLeft:pBboxRight;\r\n    RtreeCell *pCell = &aCell[aaSorted[iBestDim][ii]];\r\n    nodeInsertCell(pRtree, pTarget, pCell);\r\n    cellUnion(pRtree, pBbox, pCell);\r\n  }\r\n\r\n  sqlite3_free(aaSorted);\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\n#if VARIANT_GUTTMAN_SPLIT\r\n/*\r\n** Implementation of the regular R-tree SplitNode from Guttman[1984].\r\n*/\r\nstatic int splitNodeGuttman(\r\n  Rtree *pRtree,\r\n  RtreeCell *aCell,\r\n  int nCell,\r\n  RtreeNode *pLeft,\r\n  RtreeNode *pRight,\r\n  RtreeCell *pBboxLeft,\r\n  RtreeCell *pBboxRight\r\n){\r\n  int iLeftSeed = 0;\r\n  int iRightSeed = 1;\r\n  int *aiUsed;\r\n  int i;\r\n\r\n  aiUsed = sqlite3_malloc(sizeof(int)*nCell);\r\n  if( !aiUsed ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(aiUsed, 0, sizeof(int)*nCell);\r\n\r\n  PickSeeds(pRtree, aCell, nCell, &iLeftSeed, &iRightSeed);\r\n\r\n  memcpy(pBboxLeft, &aCell[iLeftSeed], sizeof(RtreeCell));\r\n  memcpy(pBboxRight, &aCell[iRightSeed], sizeof(RtreeCell));\r\n  nodeInsertCell(pRtree, pLeft, &aCell[iLeftSeed]);\r\n  nodeInsertCell(pRtree, pRight, &aCell[iRightSeed]);\r\n  aiUsed[iLeftSeed] = 1;\r\n  aiUsed[iRightSeed] = 1;\r\n\r\n  for(i=nCell-2; i>0; i--){\r\n    RtreeCell *pNext;\r\n    pNext = PickNext(pRtree, aCell, nCell, pBboxLeft, pBboxRight, aiUsed);\r\n    float diff =  \r\n      cellGrowth(pRtree, pBboxLeft, pNext) - \r\n      cellGrowth(pRtree, pBboxRight, pNext)\r\n    ;\r\n    if( (RTREE_MINCELLS(pRtree)-NCELL(pRight)==i)\r\n     || (diff>0.0 && (RTREE_MINCELLS(pRtree)-NCELL(pLeft)!=i))\r\n    ){\r\n      nodeInsertCell(pRtree, pRight, pNext);\r\n      cellUnion(pRtree, pBboxRight, pNext);\r\n    }else{\r\n      nodeInsertCell(pRtree, pLeft, pNext);\r\n      cellUnion(pRtree, pBboxLeft, pNext);\r\n    }\r\n  }\r\n\r\n  sqlite3_free(aiUsed);\r\n  return SQLITE_OK;\r\n}\r\n#endif\r\n\r\nstatic int updateMapping(\r\n  Rtree *pRtree, \r\n  i64 iRowid, \r\n  RtreeNode *pNode, \r\n  int iHeight\r\n){\r\n  int (*xSetMapping)(Rtree *, sqlite3_int64, sqlite3_int64);\r\n  xSetMapping = ((iHeight==0)?rowidWrite:parentWrite);\r\n  if( iHeight>0 ){\r\n    RtreeNode *pChild = nodeHashLookup(pRtree, iRowid);\r\n    if( pChild ){\r\n      nodeRelease(pRtree, pChild->pParent);\r\n      nodeReference(pNode);\r\n      pChild->pParent = pNode;\r\n    }\r\n  }\r\n  return xSetMapping(pRtree, iRowid, pNode->iNode);\r\n}\r\n\r\nstatic int SplitNode(\r\n  Rtree *pRtree,\r\n  RtreeNode *pNode,\r\n  RtreeCell *pCell,\r\n  int iHeight\r\n){\r\n  int i;\r\n  int newCellIsRight = 0;\r\n\r\n  int rc = SQLITE_OK;\r\n  int nCell = NCELL(pNode);\r\n  RtreeCell *aCell;\r\n  int *aiUsed;\r\n\r\n  RtreeNode *pLeft = 0;\r\n  RtreeNode *pRight = 0;\r\n\r\n  RtreeCell leftbbox;\r\n  RtreeCell rightbbox;\r\n\r\n  /* Allocate an array and populate it with a copy of pCell and \r\n  ** all cells from node pLeft. Then zero the original node.\r\n  */\r\n  aCell = sqlite3_malloc((sizeof(RtreeCell)+sizeof(int))*(nCell+1));\r\n  if( !aCell ){\r\n    rc = SQLITE_NOMEM;\r\n    goto splitnode_out;\r\n  }\r\n  aiUsed = (int *)&aCell[nCell+1];\r\n  memset(aiUsed, 0, sizeof(int)*(nCell+1));\r\n  for(i=0; i<nCell; i++){\r\n    nodeGetCell(pRtree, pNode, i, &aCell[i]);\r\n  }\r\n  nodeZero(pRtree, pNode);\r\n  memcpy(&aCell[nCell], pCell, sizeof(RtreeCell));\r\n  nCell++;\r\n\r\n  if( pNode->iNode==1 ){\r\n    pRight = nodeNew(pRtree, pNode);\r\n    pLeft = nodeNew(pRtree, pNode);\r\n    pRtree->iDepth++;\r\n    pNode->isDirty = 1;\r\n    writeInt16(pNode->zData, pRtree->iDepth);\r\n  }else{\r\n    pLeft = pNode;\r\n    pRight = nodeNew(pRtree, pLeft->pParent);\r\n    nodeReference(pLeft);\r\n  }\r\n\r\n  if( !pLeft || !pRight ){\r\n    rc = SQLITE_NOMEM;\r\n    goto splitnode_out;\r\n  }\r\n\r\n  memset(pLeft->zData, 0, pRtree->iNodeSize);\r\n  memset(pRight->zData, 0, pRtree->iNodeSize);\r\n\r\n  rc = AssignCells(pRtree, aCell, nCell, pLeft, pRight, &leftbbox, &rightbbox);\r\n  if( rc!=SQLITE_OK ){\r\n    goto splitnode_out;\r\n  }\r\n\r\n  /* Ensure both child nodes have node numbers assigned to them by calling\r\n  ** nodeWrite(). Node pRight always needs a node number, as it was created\r\n  ** by nodeNew() above. But node pLeft sometimes already has a node number.\r\n  ** In this case avoid the all to nodeWrite().\r\n  */\r\n  if( SQLITE_OK!=(rc = nodeWrite(pRtree, pRight))\r\n   || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft)))\r\n  ){\r\n    goto splitnode_out;\r\n  }\r\n\r\n  rightbbox.iRowid = pRight->iNode;\r\n  leftbbox.iRowid = pLeft->iNode;\r\n\r\n  if( pNode->iNode==1 ){\r\n    rc = rtreeInsertCell(pRtree, pLeft->pParent, &leftbbox, iHeight+1);\r\n    if( rc!=SQLITE_OK ){\r\n      goto splitnode_out;\r\n    }\r\n  }else{\r\n    RtreeNode *pParent = pLeft->pParent;\r\n    int iCell;\r\n    rc = nodeParentIndex(pRtree, pLeft, &iCell);\r\n    if( rc==SQLITE_OK ){\r\n      nodeOverwriteCell(pRtree, pParent, &leftbbox, iCell);\r\n      rc = AdjustTree(pRtree, pParent, &leftbbox);\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      goto splitnode_out;\r\n    }\r\n  }\r\n  if( (rc = rtreeInsertCell(pRtree, pRight->pParent, &rightbbox, iHeight+1)) ){\r\n    goto splitnode_out;\r\n  }\r\n\r\n  for(i=0; i<NCELL(pRight); i++){\r\n    i64 iRowid = nodeGetRowid(pRtree, pRight, i);\r\n    rc = updateMapping(pRtree, iRowid, pRight, iHeight);\r\n    if( iRowid==pCell->iRowid ){\r\n      newCellIsRight = 1;\r\n    }\r\n    if( rc!=SQLITE_OK ){\r\n      goto splitnode_out;\r\n    }\r\n  }\r\n  if( pNode->iNode==1 ){\r\n    for(i=0; i<NCELL(pLeft); i++){\r\n      i64 iRowid = nodeGetRowid(pRtree, pLeft, i);\r\n      rc = updateMapping(pRtree, iRowid, pLeft, iHeight);\r\n      if( rc!=SQLITE_OK ){\r\n        goto splitnode_out;\r\n      }\r\n    }\r\n  }else if( newCellIsRight==0 ){\r\n    rc = updateMapping(pRtree, pCell->iRowid, pLeft, iHeight);\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    rc = nodeRelease(pRtree, pRight);\r\n    pRight = 0;\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    rc = nodeRelease(pRtree, pLeft);\r\n    pLeft = 0;\r\n  }\r\n\r\nsplitnode_out:\r\n  nodeRelease(pRtree, pRight);\r\n  nodeRelease(pRtree, pLeft);\r\n  sqlite3_free(aCell);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** If node pLeaf is not the root of the r-tree and its pParent pointer is \r\n** still NULL, load all ancestor nodes of pLeaf into memory and populate\r\n** the pLeaf->pParent chain all the way up to the root node.\r\n**\r\n** This operation is required when a row is deleted (or updated - an update\r\n** is implemented as a delete followed by an insert). SQLite provides the\r\n** rowid of the row to delete, which can be used to find the leaf on which\r\n** the entry resides (argument pLeaf). Once the leaf is located, this \r\n** function is called to determine its ancestry.\r\n*/\r\nstatic int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){\r\n  int rc = SQLITE_OK;\r\n  RtreeNode *pChild = pLeaf;\r\n  while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){\r\n    int rc2 = SQLITE_OK;          /* sqlite3_reset() return code */\r\n    sqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode);\r\n    rc = sqlite3_step(pRtree->pReadParent);\r\n    if( rc==SQLITE_ROW ){\r\n      RtreeNode *pTest;           /* Used to test for reference loops */\r\n      i64 iNode;                  /* Node number of parent node */\r\n\r\n      /* Before setting pChild->pParent, test that we are not creating a\r\n      ** loop of references (as we would if, say, pChild==pParent). We don't\r\n      ** want to do this as it leads to a memory leak when trying to delete\r\n      ** the referenced counted node structures.\r\n      */\r\n      iNode = sqlite3_column_int64(pRtree->pReadParent, 0);\r\n      for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent);\r\n      if( !pTest ){\r\n        rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent);\r\n      }\r\n    }\r\n    rc = sqlite3_reset(pRtree->pReadParent);\r\n    if( rc==SQLITE_OK ) rc = rc2;\r\n    if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT_VTAB;\r\n    pChild = pChild->pParent;\r\n  }\r\n  return rc;\r\n}\r\n\r\nstatic int deleteCell(Rtree *, RtreeNode *, int, int);\r\n\r\nstatic int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){\r\n  int rc;\r\n  int rc2;\r\n  RtreeNode *pParent = 0;\r\n  int iCell;\r\n\r\n  assert( pNode->nRef==1 );\r\n\r\n  /* Remove the entry in the parent cell. */\r\n  rc = nodeParentIndex(pRtree, pNode, &iCell);\r\n  if( rc==SQLITE_OK ){\r\n    pParent = pNode->pParent;\r\n    pNode->pParent = 0;\r\n    rc = deleteCell(pRtree, pParent, iCell, iHeight+1);\r\n  }\r\n  rc2 = nodeRelease(pRtree, pParent);\r\n  if( rc==SQLITE_OK ){\r\n    rc = rc2;\r\n  }\r\n  if( rc!=SQLITE_OK ){\r\n    return rc;\r\n  }\r\n\r\n  /* Remove the xxx_node entry. */\r\n  sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode);\r\n  sqlite3_step(pRtree->pDeleteNode);\r\n  if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){\r\n    return rc;\r\n  }\r\n\r\n  /* Remove the xxx_parent entry. */\r\n  sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode);\r\n  sqlite3_step(pRtree->pDeleteParent);\r\n  if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){\r\n    return rc;\r\n  }\r\n  \r\n  /* Remove the node from the in-memory hash table and link it into\r\n  ** the Rtree.pDeleted list. Its contents will be re-inserted later on.\r\n  */\r\n  nodeHashDelete(pRtree, pNode);\r\n  pNode->iNode = iHeight;\r\n  pNode->pNext = pRtree->pDeleted;\r\n  pNode->nRef++;\r\n  pRtree->pDeleted = pNode;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\nstatic int fixBoundingBox(Rtree *pRtree, RtreeNode *pNode){\r\n  RtreeNode *pParent = pNode->pParent;\r\n  int rc = SQLITE_OK; \r\n  if( pParent ){\r\n    int ii; \r\n    int nCell = NCELL(pNode);\r\n    RtreeCell box;                            /* Bounding box for pNode */\r\n    nodeGetCell(pRtree, pNode, 0, &box);\r\n    for(ii=1; ii<nCell; ii++){\r\n      RtreeCell cell;\r\n      nodeGetCell(pRtree, pNode, ii, &cell);\r\n      cellUnion(pRtree, &box, &cell);\r\n    }\r\n    box.iRowid = pNode->iNode;\r\n    rc = nodeParentIndex(pRtree, pNode, &ii);\r\n    if( rc==SQLITE_OK ){\r\n      nodeOverwriteCell(pRtree, pParent, &box, ii);\r\n      rc = fixBoundingBox(pRtree, pParent);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Delete the cell at index iCell of node pNode. After removing the\r\n** cell, adjust the r-tree data structure if required.\r\n*/\r\nstatic int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){\r\n  RtreeNode *pParent;\r\n  int rc;\r\n\r\n  if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){\r\n    return rc;\r\n  }\r\n\r\n  /* Remove the cell from the node. This call just moves bytes around\r\n  ** the in-memory node image, so it cannot fail.\r\n  */\r\n  nodeDeleteCell(pRtree, pNode, iCell);\r\n\r\n  /* If the node is not the tree root and now has less than the minimum\r\n  ** number of cells, remove it from the tree. Otherwise, update the\r\n  ** cell in the parent node so that it tightly contains the updated\r\n  ** node.\r\n  */\r\n  pParent = pNode->pParent;\r\n  assert( pParent || pNode->iNode==1 );\r\n  if( pParent ){\r\n    if( NCELL(pNode)<RTREE_MINCELLS(pRtree) ){\r\n      rc = removeNode(pRtree, pNode, iHeight);\r\n    }else{\r\n      rc = fixBoundingBox(pRtree, pNode);\r\n    }\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\nstatic int Reinsert(\r\n  Rtree *pRtree, \r\n  RtreeNode *pNode, \r\n  RtreeCell *pCell, \r\n  int iHeight\r\n){\r\n  int *aOrder;\r\n  int *aSpare;\r\n  RtreeCell *aCell;\r\n  float *aDistance;\r\n  int nCell;\r\n  float aCenterCoord[RTREE_MAX_DIMENSIONS];\r\n  int iDim;\r\n  int ii;\r\n  int rc = SQLITE_OK;\r\n\r\n  memset(aCenterCoord, 0, sizeof(float)*RTREE_MAX_DIMENSIONS);\r\n\r\n  nCell = NCELL(pNode)+1;\r\n\r\n  /* Allocate the buffers used by this operation. The allocation is\r\n  ** relinquished before this function returns.\r\n  */\r\n  aCell = (RtreeCell *)sqlite3_malloc(nCell * (\r\n    sizeof(RtreeCell) +         /* aCell array */\r\n    sizeof(int)       +         /* aOrder array */\r\n    sizeof(int)       +         /* aSpare array */\r\n    sizeof(float)               /* aDistance array */\r\n  ));\r\n  if( !aCell ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  aOrder    = (int *)&aCell[nCell];\r\n  aSpare    = (int *)&aOrder[nCell];\r\n  aDistance = (float *)&aSpare[nCell];\r\n\r\n  for(ii=0; ii<nCell; ii++){\r\n    if( ii==(nCell-1) ){\r\n      memcpy(&aCell[ii], pCell, sizeof(RtreeCell));\r\n    }else{\r\n      nodeGetCell(pRtree, pNode, ii, &aCell[ii]);\r\n    }\r\n    aOrder[ii] = ii;\r\n    for(iDim=0; iDim<pRtree->nDim; iDim++){\r\n      aCenterCoord[iDim] += (float)DCOORD(aCell[ii].aCoord[iDim*2]);\r\n      aCenterCoord[iDim] += (float)DCOORD(aCell[ii].aCoord[iDim*2+1]);\r\n    }\r\n  }\r\n  for(iDim=0; iDim<pRtree->nDim; iDim++){\r\n    aCenterCoord[iDim] = (float)(aCenterCoord[iDim]/((float)nCell*2.0));\r\n  }\r\n\r\n  for(ii=0; ii<nCell; ii++){\r\n    aDistance[ii] = 0.0;\r\n    for(iDim=0; iDim<pRtree->nDim; iDim++){\r\n      float coord = (float)(DCOORD(aCell[ii].aCoord[iDim*2+1]) - \r\n          DCOORD(aCell[ii].aCoord[iDim*2]));\r\n      aDistance[ii] += (coord-aCenterCoord[iDim])*(coord-aCenterCoord[iDim]);\r\n    }\r\n  }\r\n\r\n  SortByDistance(aOrder, nCell, aDistance, aSpare);\r\n  nodeZero(pRtree, pNode);\r\n\r\n  for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){\r\n    RtreeCell *p = &aCell[aOrder[ii]];\r\n    nodeInsertCell(pRtree, pNode, p);\r\n    if( p->iRowid==pCell->iRowid ){\r\n      if( iHeight==0 ){\r\n        rc = rowidWrite(pRtree, p->iRowid, pNode->iNode);\r\n      }else{\r\n        rc = parentWrite(pRtree, p->iRowid, pNode->iNode);\r\n      }\r\n    }\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    rc = fixBoundingBox(pRtree, pNode);\r\n  }\r\n  for(; rc==SQLITE_OK && ii<nCell; ii++){\r\n    /* Find a node to store this cell in. pNode->iNode currently contains\r\n    ** the height of the sub-tree headed by the cell.\r\n    */\r\n    RtreeNode *pInsert;\r\n    RtreeCell *p = &aCell[aOrder[ii]];\r\n    rc = ChooseLeaf(pRtree, p, iHeight, &pInsert);\r\n    if( rc==SQLITE_OK ){\r\n      int rc2;\r\n      rc = rtreeInsertCell(pRtree, pInsert, p, iHeight);\r\n      rc2 = nodeRelease(pRtree, pInsert);\r\n      if( rc==SQLITE_OK ){\r\n        rc = rc2;\r\n      }\r\n    }\r\n  }\r\n\r\n  sqlite3_free(aCell);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Insert cell pCell into node pNode. Node pNode is the head of a \r\n** subtree iHeight high (leaf nodes have iHeight==0).\r\n*/\r\nstatic int rtreeInsertCell(\r\n  Rtree *pRtree,\r\n  RtreeNode *pNode,\r\n  RtreeCell *pCell,\r\n  int iHeight\r\n){\r\n  int rc = SQLITE_OK;\r\n  if( iHeight>0 ){\r\n    RtreeNode *pChild = nodeHashLookup(pRtree, pCell->iRowid);\r\n    if( pChild ){\r\n      nodeRelease(pRtree, pChild->pParent);\r\n      nodeReference(pNode);\r\n      pChild->pParent = pNode;\r\n    }\r\n  }\r\n  if( nodeInsertCell(pRtree, pNode, pCell) ){\r\n#if VARIANT_RSTARTREE_REINSERT\r\n    if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){\r\n      rc = SplitNode(pRtree, pNode, pCell, iHeight);\r\n    }else{\r\n      pRtree->iReinsertHeight = iHeight;\r\n      rc = Reinsert(pRtree, pNode, pCell, iHeight);\r\n    }\r\n#else\r\n    rc = SplitNode(pRtree, pNode, pCell, iHeight);\r\n#endif\r\n  }else{\r\n    rc = AdjustTree(pRtree, pNode, pCell);\r\n    if( rc==SQLITE_OK ){\r\n      if( iHeight==0 ){\r\n        rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode);\r\n      }else{\r\n        rc = parentWrite(pRtree, pCell->iRowid, pNode->iNode);\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\nstatic int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){\r\n  int ii;\r\n  int rc = SQLITE_OK;\r\n  int nCell = NCELL(pNode);\r\n\r\n  for(ii=0; rc==SQLITE_OK && ii<nCell; ii++){\r\n    RtreeNode *pInsert;\r\n    RtreeCell cell;\r\n    nodeGetCell(pRtree, pNode, ii, &cell);\r\n\r\n    /* Find a node to store this cell in. pNode->iNode currently contains\r\n    ** the height of the sub-tree headed by the cell.\r\n    */\r\n    rc = ChooseLeaf(pRtree, &cell, (int)pNode->iNode, &pInsert);\r\n    if( rc==SQLITE_OK ){\r\n      int rc2;\r\n      rc = rtreeInsertCell(pRtree, pInsert, &cell, (int)pNode->iNode);\r\n      rc2 = nodeRelease(pRtree, pInsert);\r\n      if( rc==SQLITE_OK ){\r\n        rc = rc2;\r\n      }\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Select a currently unused rowid for a new r-tree record.\r\n*/\r\nstatic int newRowid(Rtree *pRtree, i64 *piRowid){\r\n  int rc;\r\n  sqlite3_bind_null(pRtree->pWriteRowid, 1);\r\n  sqlite3_bind_null(pRtree->pWriteRowid, 2);\r\n  sqlite3_step(pRtree->pWriteRowid);\r\n  rc = sqlite3_reset(pRtree->pWriteRowid);\r\n  *piRowid = sqlite3_last_insert_rowid(pRtree->db);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** Remove the entry with rowid=iDelete from the r-tree structure.\r\n*/\r\nstatic int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){\r\n  int rc;                         /* Return code */\r\n  RtreeNode *pLeaf;               /* Leaf node containing record iDelete */\r\n  int iCell;                      /* Index of iDelete cell in pLeaf */\r\n  RtreeNode *pRoot;               /* Root node of rtree structure */\r\n\r\n\r\n  /* Obtain a reference to the root node to initialise Rtree.iDepth */\r\n  rc = nodeAcquire(pRtree, 1, 0, &pRoot);\r\n\r\n  /* Obtain a reference to the leaf node that contains the entry \r\n  ** about to be deleted. \r\n  */\r\n  if( rc==SQLITE_OK ){\r\n    rc = findLeafNode(pRtree, iDelete, &pLeaf);\r\n  }\r\n\r\n  /* Delete the cell in question from the leaf node. */\r\n  if( rc==SQLITE_OK ){\r\n    int rc2;\r\n    rc = nodeRowidIndex(pRtree, pLeaf, iDelete, &iCell);\r\n    if( rc==SQLITE_OK ){\r\n      rc = deleteCell(pRtree, pLeaf, iCell, 0);\r\n    }\r\n    rc2 = nodeRelease(pRtree, pLeaf);\r\n    if( rc==SQLITE_OK ){\r\n      rc = rc2;\r\n    }\r\n  }\r\n\r\n  /* Delete the corresponding entry in the <rtree>_rowid table. */\r\n  if( rc==SQLITE_OK ){\r\n    sqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete);\r\n    sqlite3_step(pRtree->pDeleteRowid);\r\n    rc = sqlite3_reset(pRtree->pDeleteRowid);\r\n  }\r\n\r\n  /* Check if the root node now has exactly one child. If so, remove\r\n  ** it, schedule the contents of the child for reinsertion and \r\n  ** reduce the tree height by one.\r\n  **\r\n  ** This is equivalent to copying the contents of the child into\r\n  ** the root node (the operation that Gutman's paper says to perform \r\n  ** in this scenario).\r\n  */\r\n  if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){\r\n    int rc2;\r\n    RtreeNode *pChild;\r\n    i64 iChild = nodeGetRowid(pRtree, pRoot, 0);\r\n    rc = nodeAcquire(pRtree, iChild, pRoot, &pChild);\r\n    if( rc==SQLITE_OK ){\r\n      rc = removeNode(pRtree, pChild, pRtree->iDepth-1);\r\n    }\r\n    rc2 = nodeRelease(pRtree, pChild);\r\n    if( rc==SQLITE_OK ) rc = rc2;\r\n    if( rc==SQLITE_OK ){\r\n      pRtree->iDepth--;\r\n      writeInt16(pRoot->zData, pRtree->iDepth);\r\n      pRoot->isDirty = 1;\r\n    }\r\n  }\r\n\r\n  /* Re-insert the contents of any underfull nodes removed from the tree. */\r\n  for(pLeaf=pRtree->pDeleted; pLeaf; pLeaf=pRtree->pDeleted){\r\n    if( rc==SQLITE_OK ){\r\n      rc = reinsertNodeContent(pRtree, pLeaf);\r\n    }\r\n    pRtree->pDeleted = pLeaf->pNext;\r\n    sqlite3_free(pLeaf);\r\n  }\r\n\r\n  /* Release the reference to the root node. */\r\n  if( rc==SQLITE_OK ){\r\n    rc = nodeRelease(pRtree, pRoot);\r\n  }else{\r\n    nodeRelease(pRtree, pRoot);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The xUpdate method for rtree module virtual tables.\r\n*/\r\nstatic int rtreeUpdate(\r\n  sqlite3_vtab *pVtab, \r\n  int nData, \r\n  sqlite3_value **azData, \r\n  sqlite_int64 *pRowid\r\n){\r\n  Rtree *pRtree = (Rtree *)pVtab;\r\n  int rc = SQLITE_OK;\r\n  RtreeCell cell;                 /* New cell to insert if nData>1 */\r\n  int bHaveRowid = 0;             /* Set to 1 after new rowid is determined */\r\n\r\n  rtreeReference(pRtree);\r\n  assert(nData>=1);\r\n\r\n  /* Constraint handling. A write operation on an r-tree table may return\r\n  ** SQLITE_CONSTRAINT for two reasons:\r\n  **\r\n  **   1. A duplicate rowid value, or\r\n  **   2. The supplied data violates the \"x2>=x1\" constraint.\r\n  **\r\n  ** In the first case, if the conflict-handling mode is REPLACE, then\r\n  ** the conflicting row can be removed before proceeding. In the second\r\n  ** case, SQLITE_CONSTRAINT must be returned regardless of the\r\n  ** conflict-handling mode specified by the user.\r\n  */\r\n  if( nData>1 ){\r\n    int ii;\r\n\r\n    /* Populate the cell.aCoord[] array. The first coordinate is azData[3]. */\r\n    assert( nData==(pRtree->nDim*2 + 3) );\r\n    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){\r\n      for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n        cell.aCoord[ii].f = (float)sqlite3_value_double(azData[ii+3]);\r\n        cell.aCoord[ii+1].f = (float)sqlite3_value_double(azData[ii+4]);\r\n        if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){\r\n          rc = SQLITE_CONSTRAINT;\r\n          goto constraint;\r\n        }\r\n      }\r\n    }else{\r\n      for(ii=0; ii<(pRtree->nDim*2); ii+=2){\r\n        cell.aCoord[ii].i = sqlite3_value_int(azData[ii+3]);\r\n        cell.aCoord[ii+1].i = sqlite3_value_int(azData[ii+4]);\r\n        if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){\r\n          rc = SQLITE_CONSTRAINT;\r\n          goto constraint;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* If a rowid value was supplied, check if it is already present in \r\n    ** the table. If so, the constraint has failed. */\r\n    if( sqlite3_value_type(azData[2])!=SQLITE_NULL ){\r\n      cell.iRowid = sqlite3_value_int64(azData[2]);\r\n      if( sqlite3_value_type(azData[0])==SQLITE_NULL\r\n       || sqlite3_value_int64(azData[0])!=cell.iRowid\r\n      ){\r\n        int steprc;\r\n        sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid);\r\n        steprc = sqlite3_step(pRtree->pReadRowid);\r\n        rc = sqlite3_reset(pRtree->pReadRowid);\r\n        if( SQLITE_ROW==steprc ){\r\n          if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){\r\n            rc = rtreeDeleteRowid(pRtree, cell.iRowid);\r\n          }else{\r\n            rc = SQLITE_CONSTRAINT;\r\n            goto constraint;\r\n          }\r\n        }\r\n      }\r\n      bHaveRowid = 1;\r\n    }\r\n  }\r\n\r\n  /* If azData[0] is not an SQL NULL value, it is the rowid of a\r\n  ** record to delete from the r-tree table. The following block does\r\n  ** just that.\r\n  */\r\n  if( sqlite3_value_type(azData[0])!=SQLITE_NULL ){\r\n    rc = rtreeDeleteRowid(pRtree, sqlite3_value_int64(azData[0]));\r\n  }\r\n\r\n  /* If the azData[] array contains more than one element, elements\r\n  ** (azData[2]..azData[argc-1]) contain a new record to insert into\r\n  ** the r-tree structure.\r\n  */\r\n  if( rc==SQLITE_OK && nData>1 ){\r\n    /* Insert the new record into the r-tree */\r\n    RtreeNode *pLeaf;\r\n\r\n    /* Figure out the rowid of the new row. */\r\n    if( bHaveRowid==0 ){\r\n      rc = newRowid(pRtree, &cell.iRowid);\r\n    }\r\n    *pRowid = cell.iRowid;\r\n\r\n    if( rc==SQLITE_OK ){\r\n      rc = ChooseLeaf(pRtree, &cell, 0, &pLeaf);\r\n    }\r\n    if( rc==SQLITE_OK ){\r\n      int rc2;\r\n      pRtree->iReinsertHeight = -1;\r\n      rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0);\r\n      rc2 = nodeRelease(pRtree, pLeaf);\r\n      if( rc==SQLITE_OK ){\r\n        rc = rc2;\r\n      }\r\n    }\r\n  }\r\n\r\nconstraint:\r\n  rtreeRelease(pRtree);\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The xRename method for rtree module virtual tables.\r\n*/\r\nstatic int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){\r\n  Rtree *pRtree = (Rtree *)pVtab;\r\n  int rc = SQLITE_NOMEM;\r\n  char *zSql = sqlite3_mprintf(\r\n    \"ALTER TABLE %Q.'%q_node'   RENAME TO \\\"%w_node\\\";\"\r\n    \"ALTER TABLE %Q.'%q_parent' RENAME TO \\\"%w_parent\\\";\"\r\n    \"ALTER TABLE %Q.'%q_rowid'  RENAME TO \\\"%w_rowid\\\";\"\r\n    , pRtree->zDb, pRtree->zName, zNewName \r\n    , pRtree->zDb, pRtree->zName, zNewName \r\n    , pRtree->zDb, pRtree->zName, zNewName\r\n  );\r\n  if( zSql ){\r\n    rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0);\r\n    sqlite3_free(zSql);\r\n  }\r\n  return rc;\r\n}\r\n\r\nstatic sqlite3_module rtreeModule = {\r\n  0,                          /* iVersion */\r\n  rtreeCreate,                /* xCreate - create a table */\r\n  rtreeConnect,               /* xConnect - connect to an existing table */\r\n  rtreeBestIndex,             /* xBestIndex - Determine search strategy */\r\n  rtreeDisconnect,            /* xDisconnect - Disconnect from a table */\r\n  rtreeDestroy,               /* xDestroy - Drop a table */\r\n  rtreeOpen,                  /* xOpen - open a cursor */\r\n  rtreeClose,                 /* xClose - close a cursor */\r\n  rtreeFilter,                /* xFilter - configure scan constraints */\r\n  rtreeNext,                  /* xNext - advance a cursor */\r\n  rtreeEof,                   /* xEof */\r\n  rtreeColumn,                /* xColumn - read data */\r\n  rtreeRowid,                 /* xRowid - read data */\r\n  rtreeUpdate,                /* xUpdate - write data */\r\n  0,                          /* xBegin - begin transaction */\r\n  0,                          /* xSync - sync transaction */\r\n  0,                          /* xCommit - commit transaction */\r\n  0,                          /* xRollback - rollback transaction */\r\n  0,                          /* xFindFunction - function overloading */\r\n  rtreeRename,                /* xRename - rename the table */\r\n  0,                          /* xSavepoint */\r\n  0,                          /* xRelease */\r\n  0                           /* xRollbackTo */\r\n};\r\n\r\nstatic int rtreeSqlInit(\r\n  Rtree *pRtree, \r\n  sqlite3 *db, \r\n  const char *zDb, \r\n  const char *zPrefix, \r\n  int isCreate\r\n){\r\n  int rc = SQLITE_OK;\r\n\r\n  #define N_STATEMENT 9\r\n  static const char *azSql[N_STATEMENT] = {\r\n    /* Read and write the xxx_node table */\r\n    \"SELECT data FROM '%q'.'%q_node' WHERE nodeno = :1\",\r\n    \"INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(:1, :2)\",\r\n    \"DELETE FROM '%q'.'%q_node' WHERE nodeno = :1\",\r\n\r\n    /* Read and write the xxx_rowid table */\r\n    \"SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1\",\r\n    \"INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(:1, :2)\",\r\n    \"DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1\",\r\n\r\n    /* Read and write the xxx_parent table */\r\n    \"SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = :1\",\r\n    \"INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(:1, :2)\",\r\n    \"DELETE FROM '%q'.'%q_parent' WHERE nodeno = :1\"\r\n  };\r\n  sqlite3_stmt **appStmt[N_STATEMENT];\r\n  int i;\r\n\r\n  pRtree->db = db;\r\n\r\n  if( isCreate ){\r\n    char *zCreate = sqlite3_mprintf(\r\n\"CREATE TABLE \\\"%w\\\".\\\"%w_node\\\"(nodeno INTEGER PRIMARY KEY, data BLOB);\"\r\n\"CREATE TABLE \\\"%w\\\".\\\"%w_rowid\\\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);\"\r\n\"CREATE TABLE \\\"%w\\\".\\\"%w_parent\\\"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER);\"\r\n\"INSERT INTO '%q'.'%q_node' VALUES(1, zeroblob(%d))\",\r\n      zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, pRtree->iNodeSize\r\n    );\r\n    if( !zCreate ){\r\n      return SQLITE_NOMEM;\r\n    }\r\n    rc = sqlite3_exec(db, zCreate, 0, 0, 0);\r\n    sqlite3_free(zCreate);\r\n    if( rc!=SQLITE_OK ){\r\n      return rc;\r\n    }\r\n  }\r\n\r\n  appStmt[0] = &pRtree->pReadNode;\r\n  appStmt[1] = &pRtree->pWriteNode;\r\n  appStmt[2] = &pRtree->pDeleteNode;\r\n  appStmt[3] = &pRtree->pReadRowid;\r\n  appStmt[4] = &pRtree->pWriteRowid;\r\n  appStmt[5] = &pRtree->pDeleteRowid;\r\n  appStmt[6] = &pRtree->pReadParent;\r\n  appStmt[7] = &pRtree->pWriteParent;\r\n  appStmt[8] = &pRtree->pDeleteParent;\r\n\r\n  for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){\r\n    char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix);\r\n    if( zSql ){\r\n      rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0); \r\n    }else{\r\n      rc = SQLITE_NOMEM;\r\n    }\r\n    sqlite3_free(zSql);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** The second argument to this function contains the text of an SQL statement\r\n** that returns a single integer value. The statement is compiled and executed\r\n** using database connection db. If successful, the integer value returned\r\n** is written to *piVal and SQLITE_OK returned. Otherwise, an SQLite error\r\n** code is returned and the value of *piVal after returning is not defined.\r\n*/\r\nstatic int getIntFromStmt(sqlite3 *db, const char *zSql, int *piVal){\r\n  int rc = SQLITE_NOMEM;\r\n  if( zSql ){\r\n    sqlite3_stmt *pStmt = 0;\r\n    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\r\n    if( rc==SQLITE_OK ){\r\n      if( SQLITE_ROW==sqlite3_step(pStmt) ){\r\n        *piVal = sqlite3_column_int(pStmt, 0);\r\n      }\r\n      rc = sqlite3_finalize(pStmt);\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\n/*\r\n** This function is called from within the xConnect() or xCreate() method to\r\n** determine the node-size used by the rtree table being created or connected\r\n** to. If successful, pRtree->iNodeSize is populated and SQLITE_OK returned.\r\n** Otherwise, an SQLite error code is returned.\r\n**\r\n** If this function is being called as part of an xConnect(), then the rtree\r\n** table already exists. In this case the node-size is determined by inspecting\r\n** the root node of the tree.\r\n**\r\n** Otherwise, for an xCreate(), use 64 bytes less than the database page-size. \r\n** This ensures that each node is stored on a single database page. If the \r\n** database page-size is so large that more than RTREE_MAXCELLS entries \r\n** would fit in a single node, use a smaller node-size.\r\n*/\r\nstatic int getNodeSize(\r\n  sqlite3 *db,                    /* Database handle */\r\n  Rtree *pRtree,                  /* Rtree handle */\r\n  int isCreate                    /* True for xCreate, false for xConnect */\r\n){\r\n  int rc;\r\n  char *zSql;\r\n  if( isCreate ){\r\n    int iPageSize = 0;\r\n    zSql = sqlite3_mprintf(\"PRAGMA %Q.page_size\", pRtree->zDb);\r\n    rc = getIntFromStmt(db, zSql, &iPageSize);\r\n    if( rc==SQLITE_OK ){\r\n      pRtree->iNodeSize = iPageSize-64;\r\n      if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){\r\n        pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;\r\n      }\r\n    }\r\n  }else{\r\n    zSql = sqlite3_mprintf(\r\n        \"SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\",\r\n        pRtree->zDb, pRtree->zName\r\n    );\r\n    rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);\r\n  }\r\n\r\n  sqlite3_free(zSql);\r\n  return rc;\r\n}\r\n\r\n/* \r\n** This function is the implementation of both the xConnect and xCreate\r\n** methods of the r-tree virtual table.\r\n**\r\n**   argv[0]   -> module name\r\n**   argv[1]   -> database name\r\n**   argv[2]   -> table name\r\n**   argv[...] -> column names...\r\n*/\r\nstatic int rtreeInit(\r\n  sqlite3 *db,                        /* Database connection */\r\n  void *pAux,                         /* One of the RTREE_COORD_* constants */\r\n  int argc, const char *const*argv,   /* Parameters to CREATE TABLE statement */\r\n  sqlite3_vtab **ppVtab,              /* OUT: New virtual table */\r\n  char **pzErr,                       /* OUT: Error message, if any */\r\n  int isCreate                        /* True for xCreate, false for xConnect */\r\n){\r\n  int rc = SQLITE_OK;\r\n  Rtree *pRtree;\r\n  int nDb;              /* Length of string argv[1] */\r\n  int nName;            /* Length of string argv[2] */\r\n  int eCoordType = (pAux ? RTREE_COORD_INT32 : RTREE_COORD_REAL32);\r\n\r\n  const char *aErrMsg[] = {\r\n    0,                                                    /* 0 */\r\n    \"Wrong number of columns for an rtree table\",         /* 1 */\r\n    \"Too few columns for an rtree table\",                 /* 2 */\r\n    \"Too many columns for an rtree table\"                 /* 3 */\r\n  };\r\n\r\n  int iErr = (argc<6) ? 2 : argc>(RTREE_MAX_DIMENSIONS*2+4) ? 3 : argc%2;\r\n  if( aErrMsg[iErr] ){\r\n    *pzErr = sqlite3_mprintf(\"%s\", aErrMsg[iErr]);\r\n    return SQLITE_ERROR;\r\n  }\r\n\r\n  sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1);\r\n\r\n  /* Allocate the sqlite3_vtab structure */\r\n  nDb = (int)strlen(argv[1]);\r\n  nName = (int)strlen(argv[2]);\r\n  pRtree = (Rtree *)sqlite3_malloc(sizeof(Rtree)+nDb+nName+2);\r\n  if( !pRtree ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2);\r\n  pRtree->nBusy = 1;\r\n  pRtree->base.pModule = &rtreeModule;\r\n  pRtree->zDb = (char *)&pRtree[1];\r\n  pRtree->zName = &pRtree->zDb[nDb+1];\r\n  pRtree->nDim = (argc-4)/2;\r\n  pRtree->nBytesPerCell = 8 + pRtree->nDim*4*2;\r\n  pRtree->eCoordType = eCoordType;\r\n  memcpy(pRtree->zDb, argv[1], nDb);\r\n  memcpy(pRtree->zName, argv[2], nName);\r\n\r\n  /* Figure out the node size to use. */\r\n  rc = getNodeSize(db, pRtree, isCreate);\r\n\r\n  /* Create/Connect to the underlying relational database schema. If\r\n  ** that is successful, call sqlite3_declare_vtab() to configure\r\n  ** the r-tree table schema.\r\n  */\r\n  if( rc==SQLITE_OK ){\r\n    if( (rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate)) ){\r\n      *pzErr = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\r\n    }else{\r\n      char *zSql = sqlite3_mprintf(\"CREATE TABLE x(%s\", argv[3]);\r\n      char *zTmp;\r\n      int ii;\r\n      for(ii=4; zSql && ii<argc; ii++){\r\n        zTmp = zSql;\r\n        zSql = sqlite3_mprintf(\"%s, %s\", zTmp, argv[ii]);\r\n        sqlite3_free(zTmp);\r\n      }\r\n      if( zSql ){\r\n        zTmp = zSql;\r\n        zSql = sqlite3_mprintf(\"%s);\", zTmp);\r\n        sqlite3_free(zTmp);\r\n      }\r\n      if( !zSql ){\r\n        rc = SQLITE_NOMEM;\r\n      }else if( SQLITE_OK!=(rc = sqlite3_declare_vtab(db, zSql)) ){\r\n        *pzErr = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\r\n      }\r\n      sqlite3_free(zSql);\r\n    }\r\n  }\r\n\r\n  if( rc==SQLITE_OK ){\r\n    *ppVtab = (sqlite3_vtab *)pRtree;\r\n  }else{\r\n    rtreeRelease(pRtree);\r\n  }\r\n  return rc;\r\n}\r\n\r\n\r\n/*\r\n** Implementation of a scalar function that decodes r-tree nodes to\r\n** human readable strings. This can be used for debugging and analysis.\r\n**\r\n** The scalar function takes two arguments, a blob of data containing\r\n** an r-tree node, and the number of dimensions the r-tree indexes.\r\n** For a two-dimensional r-tree structure called \"rt\", to deserialize\r\n** all nodes, a statement like:\r\n**\r\n**   SELECT rtreenode(2, data) FROM rt_node;\r\n**\r\n** The human readable string takes the form of a Tcl list with one\r\n** entry for each cell in the r-tree node. Each entry is itself a\r\n** list, containing the 8-byte rowid/pageno followed by the \r\n** <num-dimension>*2 coordinates.\r\n*/\r\nstatic void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){\r\n  char *zText = 0;\r\n  RtreeNode node;\r\n  Rtree tree;\r\n  int ii;\r\n\r\n  UNUSED_PARAMETER(nArg);\r\n  memset(&node, 0, sizeof(RtreeNode));\r\n  memset(&tree, 0, sizeof(Rtree));\r\n  tree.nDim = sqlite3_value_int(apArg[0]);\r\n  tree.nBytesPerCell = 8 + 8 * tree.nDim;\r\n  node.zData = (u8 *)sqlite3_value_blob(apArg[1]);\r\n\r\n  for(ii=0; ii<NCELL(&node); ii++){\r\n    char zCell[512];\r\n    int nCell = 0;\r\n    RtreeCell cell;\r\n    int jj;\r\n\r\n    nodeGetCell(&tree, &node, ii, &cell);\r\n    sqlite3_snprintf(512-nCell,&zCell[nCell],\"%lld\", cell.iRowid);\r\n    nCell = (int)strlen(zCell);\r\n    for(jj=0; jj<tree.nDim*2; jj++){\r\n      sqlite3_snprintf(512-nCell,&zCell[nCell],\" %f\",(double)cell.aCoord[jj].f);\r\n      nCell = (int)strlen(zCell);\r\n    }\r\n\r\n    if( zText ){\r\n      char *zTextNew = sqlite3_mprintf(\"%s {%s}\", zText, zCell);\r\n      sqlite3_free(zText);\r\n      zText = zTextNew;\r\n    }else{\r\n      zText = sqlite3_mprintf(\"{%s}\", zCell);\r\n    }\r\n  }\r\n  \r\n  sqlite3_result_text(ctx, zText, -1, sqlite3_free);\r\n}\r\n\r\nstatic void rtreedepth(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){\r\n  UNUSED_PARAMETER(nArg);\r\n  if( sqlite3_value_type(apArg[0])!=SQLITE_BLOB \r\n   || sqlite3_value_bytes(apArg[0])<2\r\n  ){\r\n    sqlite3_result_error(ctx, \"Invalid argument to rtreedepth()\", -1); \r\n  }else{\r\n    u8 *zBlob = (u8 *)sqlite3_value_blob(apArg[0]);\r\n    sqlite3_result_int(ctx, readInt16(zBlob));\r\n  }\r\n}\r\n\r\n/*\r\n** Register the r-tree module with database handle db. This creates the\r\n** virtual table module \"rtree\" and the debugging/analysis scalar \r\n** function \"rtreenode\".\r\n*/\r\nSQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db){\r\n  const int utf8 = SQLITE_UTF8;\r\n  int rc;\r\n\r\n  rc = sqlite3_create_function(db, \"rtreenode\", 2, utf8, 0, rtreenode, 0, 0);\r\n  if( rc==SQLITE_OK ){\r\n    rc = sqlite3_create_function(db, \"rtreedepth\", 1, utf8, 0,rtreedepth, 0, 0);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    void *c = (void *)RTREE_COORD_REAL32;\r\n    rc = sqlite3_create_module_v2(db, \"rtree\", &rtreeModule, c, 0);\r\n  }\r\n  if( rc==SQLITE_OK ){\r\n    void *c = (void *)RTREE_COORD_INT32;\r\n    rc = sqlite3_create_module_v2(db, \"rtree_i32\", &rtreeModule, c, 0);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n** A version of sqlite3_free() that can be used as a callback. This is used\r\n** in two places - as the destructor for the blob value returned by the\r\n** invocation of a geometry function, and as the destructor for the geometry\r\n** functions themselves.\r\n*/\r\nstatic void doSqlite3Free(void *p){\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** Each call to sqlite3_rtree_geometry_callback() creates an ordinary SQLite\r\n** scalar user function. This C function is the callback used for all such\r\n** registered SQL functions.\r\n**\r\n** The scalar user functions return a blob that is interpreted by r-tree\r\n** table MATCH operators.\r\n*/\r\nstatic void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){\r\n  RtreeGeomCallback *pGeomCtx = (RtreeGeomCallback *)sqlite3_user_data(ctx);\r\n  RtreeMatchArg *pBlob;\r\n  int nBlob;\r\n\r\n  nBlob = sizeof(RtreeMatchArg) + (nArg-1)*sizeof(double);\r\n  pBlob = (RtreeMatchArg *)sqlite3_malloc(nBlob);\r\n  if( !pBlob ){\r\n    sqlite3_result_error_nomem(ctx);\r\n  }else{\r\n    int i;\r\n    pBlob->magic = RTREE_GEOMETRY_MAGIC;\r\n    pBlob->xGeom = pGeomCtx->xGeom;\r\n    pBlob->pContext = pGeomCtx->pContext;\r\n    pBlob->nParam = nArg;\r\n    for(i=0; i<nArg; i++){\r\n      pBlob->aParam[i] = sqlite3_value_double(aArg[i]);\r\n    }\r\n    sqlite3_result_blob(ctx, pBlob, nBlob, doSqlite3Free);\r\n  }\r\n}\r\n\r\n/*\r\n** Register a new geometry function for use with the r-tree MATCH operator.\r\n*/\r\nSQLITE_API int sqlite3_rtree_geometry_callback(\r\n  sqlite3 *db,\r\n  const char *zGeom,\r\n  int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *),\r\n  void *pContext\r\n){\r\n  RtreeGeomCallback *pGeomCtx;      /* Context object for new user-function */\r\n\r\n  /* Allocate and populate the context object. */\r\n  pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback));\r\n  if( !pGeomCtx ) return SQLITE_NOMEM;\r\n  pGeomCtx->xGeom = xGeom;\r\n  pGeomCtx->pContext = pContext;\r\n\r\n  /* Create the new user-function. Register a destructor function to delete\r\n  ** the context object when it is no longer required.  */\r\n  return sqlite3_create_function_v2(db, zGeom, -1, SQLITE_ANY, \r\n      (void *)pGeomCtx, geomCallback, 0, 0, doSqlite3Free\r\n  );\r\n}\r\n\r\n#if !SQLITE_CORE\r\nSQLITE_API int sqlite3_extension_init(\r\n  sqlite3 *db,\r\n  char **pzErrMsg,\r\n  const sqlite3_api_routines *pApi\r\n){\r\n  SQLITE_EXTENSION_INIT2(pApi)\r\n  return sqlite3RtreeInit(db);\r\n}\r\n#endif\r\n\r\n#endif\r\n\r\n/************** End of rtree.c ***********************************************/\r\n/************** Begin file icu.c *********************************************/\r\n/*\r\n** 2007 May 6\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** $Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp $\r\n**\r\n** This file implements an integration between the ICU library \r\n** (\"International Components for Unicode\", an open-source library \r\n** for handling unicode data) and SQLite. The integration uses \r\n** ICU to provide the following to SQLite:\r\n**\r\n**   * An implementation of the SQL regexp() function (and hence REGEXP\r\n**     operator) using the ICU uregex_XX() APIs.\r\n**\r\n**   * Implementations of the SQL scalar upper() and lower() functions\r\n**     for case mapping.\r\n**\r\n**   * Integration of ICU and SQLite collation seqences.\r\n**\r\n**   * An implementation of the LIKE operator that uses ICU to \r\n**     provide case-independent matching.\r\n*/\r\n\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)\r\n\r\n/* Include ICU headers */\r\n#include <unicode/utypes.h>\r\n#include <unicode/uregex.h>\r\n#include <unicode/ustring.h>\r\n#include <unicode/ucol.h>\r\n\r\n/* #include <assert.h> */\r\n\r\n#ifndef SQLITE_CORE\r\n  SQLITE_EXTENSION_INIT1\r\n#else\r\n#endif\r\n\r\n/*\r\n** Maximum length (in bytes) of the pattern in a LIKE or GLOB\r\n** operator.\r\n*/\r\n#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH\r\n# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000\r\n#endif\r\n\r\n/*\r\n** Version of sqlite3_free() that is always a function, never a macro.\r\n*/\r\nstatic void xFree(void *p){\r\n  sqlite3_free(p);\r\n}\r\n\r\n/*\r\n** Compare two UTF-8 strings for equality where the first string is\r\n** a \"LIKE\" expression. Return true (1) if they are the same and \r\n** false (0) if they are different.\r\n*/\r\nstatic int icuLikeCompare(\r\n  const uint8_t *zPattern,   /* LIKE pattern */\r\n  const uint8_t *zString,    /* The UTF-8 string to compare against */\r\n  const UChar32 uEsc         /* The escape character */\r\n){\r\n  static const int MATCH_ONE = (UChar32)'_';\r\n  static const int MATCH_ALL = (UChar32)'%';\r\n\r\n  int iPattern = 0;       /* Current byte index in zPattern */\r\n  int iString = 0;        /* Current byte index in zString */\r\n\r\n  int prevEscape = 0;     /* True if the previous character was uEsc */\r\n\r\n  while( zPattern[iPattern]!=0 ){\r\n\r\n    /* Read (and consume) the next character from the input pattern. */\r\n    UChar32 uPattern;\r\n    U8_NEXT_UNSAFE(zPattern, iPattern, uPattern);\r\n    assert(uPattern!=0);\r\n\r\n    /* There are now 4 possibilities:\r\n    **\r\n    **     1. uPattern is an unescaped match-all character \"%\",\r\n    **     2. uPattern is an unescaped match-one character \"_\",\r\n    **     3. uPattern is an unescaped escape character, or\r\n    **     4. uPattern is to be handled as an ordinary character\r\n    */\r\n    if( !prevEscape && uPattern==MATCH_ALL ){\r\n      /* Case 1. */\r\n      uint8_t c;\r\n\r\n      /* Skip any MATCH_ALL or MATCH_ONE characters that follow a\r\n      ** MATCH_ALL. For each MATCH_ONE, skip one character in the \r\n      ** test string.\r\n      */\r\n      while( (c=zPattern[iPattern]) == MATCH_ALL || c == MATCH_ONE ){\r\n        if( c==MATCH_ONE ){\r\n          if( zString[iString]==0 ) return 0;\r\n          U8_FWD_1_UNSAFE(zString, iString);\r\n        }\r\n        iPattern++;\r\n      }\r\n\r\n      if( zPattern[iPattern]==0 ) return 1;\r\n\r\n      while( zString[iString] ){\r\n        if( icuLikeCompare(&zPattern[iPattern], &zString[iString], uEsc) ){\r\n          return 1;\r\n        }\r\n        U8_FWD_1_UNSAFE(zString, iString);\r\n      }\r\n      return 0;\r\n\r\n    }else if( !prevEscape && uPattern==MATCH_ONE ){\r\n      /* Case 2. */\r\n      if( zString[iString]==0 ) return 0;\r\n      U8_FWD_1_UNSAFE(zString, iString);\r\n\r\n    }else if( !prevEscape && uPattern==uEsc){\r\n      /* Case 3. */\r\n      prevEscape = 1;\r\n\r\n    }else{\r\n      /* Case 4. */\r\n      UChar32 uString;\r\n      U8_NEXT_UNSAFE(zString, iString, uString);\r\n      uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT);\r\n      uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT);\r\n      if( uString!=uPattern ){\r\n        return 0;\r\n      }\r\n      prevEscape = 0;\r\n    }\r\n  }\r\n\r\n  return zString[iString]==0;\r\n}\r\n\r\n/*\r\n** Implementation of the like() SQL function.  This function implements\r\n** the build-in LIKE operator.  The first argument to the function is the\r\n** pattern and the second argument is the string.  So, the SQL statements:\r\n**\r\n**       A LIKE B\r\n**\r\n** is implemented as like(B, A). If there is an escape character E, \r\n**\r\n**       A LIKE B ESCAPE E\r\n**\r\n** is mapped to like(B, A, E).\r\n*/\r\nstatic void icuLikeFunc(\r\n  sqlite3_context *context, \r\n  int argc, \r\n  sqlite3_value **argv\r\n){\r\n  const unsigned char *zA = sqlite3_value_text(argv[0]);\r\n  const unsigned char *zB = sqlite3_value_text(argv[1]);\r\n  UChar32 uEsc = 0;\r\n\r\n  /* Limit the length of the LIKE or GLOB pattern to avoid problems\r\n  ** of deep recursion and N*N behavior in patternCompare().\r\n  */\r\n  if( sqlite3_value_bytes(argv[0])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){\r\n    sqlite3_result_error(context, \"LIKE or GLOB pattern too complex\", -1);\r\n    return;\r\n  }\r\n\r\n\r\n  if( argc==3 ){\r\n    /* The escape character string must consist of a single UTF-8 character.\r\n    ** Otherwise, return an error.\r\n    */\r\n    int nE= sqlite3_value_bytes(argv[2]);\r\n    const unsigned char *zE = sqlite3_value_text(argv[2]);\r\n    int i = 0;\r\n    if( zE==0 ) return;\r\n    U8_NEXT(zE, i, nE, uEsc);\r\n    if( i!=nE){\r\n      sqlite3_result_error(context, \r\n          \"ESCAPE expression must be a single character\", -1);\r\n      return;\r\n    }\r\n  }\r\n\r\n  if( zA && zB ){\r\n    sqlite3_result_int(context, icuLikeCompare(zA, zB, uEsc));\r\n  }\r\n}\r\n\r\n/*\r\n** This function is called when an ICU function called from within\r\n** the implementation of an SQL scalar function returns an error.\r\n**\r\n** The scalar function context passed as the first argument is \r\n** loaded with an error message based on the following two args.\r\n*/\r\nstatic void icuFunctionError(\r\n  sqlite3_context *pCtx,       /* SQLite scalar function context */\r\n  const char *zName,           /* Name of ICU function that failed */\r\n  UErrorCode e                 /* Error code returned by ICU function */\r\n){\r\n  char zBuf[128];\r\n  sqlite3_snprintf(128, zBuf, \"ICU error: %s(): %s\", zName, u_errorName(e));\r\n  zBuf[127] = '\\0';\r\n  sqlite3_result_error(pCtx, zBuf, -1);\r\n}\r\n\r\n/*\r\n** Function to delete compiled regexp objects. Registered as\r\n** a destructor function with sqlite3_set_auxdata().\r\n*/\r\nstatic void icuRegexpDelete(void *p){\r\n  URegularExpression *pExpr = (URegularExpression *)p;\r\n  uregex_close(pExpr);\r\n}\r\n\r\n/*\r\n** Implementation of SQLite REGEXP operator. This scalar function takes\r\n** two arguments. The first is a regular expression pattern to compile\r\n** the second is a string to match against that pattern. If either \r\n** argument is an SQL NULL, then NULL Is returned. Otherwise, the result\r\n** is 1 if the string matches the pattern, or 0 otherwise.\r\n**\r\n** SQLite maps the regexp() function to the regexp() operator such\r\n** that the following two are equivalent:\r\n**\r\n**     zString REGEXP zPattern\r\n**     regexp(zPattern, zString)\r\n**\r\n** Uses the following ICU regexp APIs:\r\n**\r\n**     uregex_open()\r\n**     uregex_matches()\r\n**     uregex_close()\r\n*/\r\nstatic void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){\r\n  UErrorCode status = U_ZERO_ERROR;\r\n  URegularExpression *pExpr;\r\n  UBool res;\r\n  const UChar *zString = sqlite3_value_text16(apArg[1]);\r\n\r\n  (void)nArg;  /* Unused parameter */\r\n\r\n  /* If the left hand side of the regexp operator is NULL, \r\n  ** then the result is also NULL. \r\n  */\r\n  if( !zString ){\r\n    return;\r\n  }\r\n\r\n  pExpr = sqlite3_get_auxdata(p, 0);\r\n  if( !pExpr ){\r\n    const UChar *zPattern = sqlite3_value_text16(apArg[0]);\r\n    if( !zPattern ){\r\n      return;\r\n    }\r\n    pExpr = uregex_open(zPattern, -1, 0, 0, &status);\r\n\r\n    if( U_SUCCESS(status) ){\r\n      sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete);\r\n    }else{\r\n      assert(!pExpr);\r\n      icuFunctionError(p, \"uregex_open\", status);\r\n      return;\r\n    }\r\n  }\r\n\r\n  /* Configure the text that the regular expression operates on. */\r\n  uregex_setText(pExpr, zString, -1, &status);\r\n  if( !U_SUCCESS(status) ){\r\n    icuFunctionError(p, \"uregex_setText\", status);\r\n    return;\r\n  }\r\n\r\n  /* Attempt the match */\r\n  res = uregex_matches(pExpr, 0, &status);\r\n  if( !U_SUCCESS(status) ){\r\n    icuFunctionError(p, \"uregex_matches\", status);\r\n    return;\r\n  }\r\n\r\n  /* Set the text that the regular expression operates on to a NULL\r\n  ** pointer. This is not really necessary, but it is tidier than \r\n  ** leaving the regular expression object configured with an invalid\r\n  ** pointer after this function returns.\r\n  */\r\n  uregex_setText(pExpr, 0, 0, &status);\r\n\r\n  /* Return 1 or 0. */\r\n  sqlite3_result_int(p, res ? 1 : 0);\r\n}\r\n\r\n/*\r\n** Implementations of scalar functions for case mapping - upper() and \r\n** lower(). Function upper() converts its input to upper-case (ABC).\r\n** Function lower() converts to lower-case (abc).\r\n**\r\n** ICU provides two types of case mapping, \"general\" case mapping and\r\n** \"language specific\". Refer to ICU documentation for the differences\r\n** between the two.\r\n**\r\n** To utilise \"general\" case mapping, the upper() or lower() scalar \r\n** functions are invoked with one argument:\r\n**\r\n**     upper('ABC') -> 'abc'\r\n**     lower('abc') -> 'ABC'\r\n**\r\n** To access ICU \"language specific\" case mapping, upper() or lower()\r\n** should be invoked with two arguments. The second argument is the name\r\n** of the locale to use. Passing an empty string (\"\") or SQL NULL value\r\n** as the second argument is the same as invoking the 1 argument version\r\n** of upper() or lower().\r\n**\r\n**     lower('I', 'en_us') -> 'i'\r\n**     lower('I', 'tr_tr') -> 'ı' (small dotless i)\r\n**\r\n** http://www.icu-project.org/userguide/posix.html#case_mappings\r\n*/\r\nstatic void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){\r\n  const UChar *zInput;\r\n  UChar *zOutput;\r\n  int nInput;\r\n  int nOutput;\r\n\r\n  UErrorCode status = U_ZERO_ERROR;\r\n  const char *zLocale = 0;\r\n\r\n  assert(nArg==1 || nArg==2);\r\n  if( nArg==2 ){\r\n    zLocale = (const char *)sqlite3_value_text(apArg[1]);\r\n  }\r\n\r\n  zInput = sqlite3_value_text16(apArg[0]);\r\n  if( !zInput ){\r\n    return;\r\n  }\r\n  nInput = sqlite3_value_bytes16(apArg[0]);\r\n\r\n  nOutput = nInput * 2 + 2;\r\n  zOutput = sqlite3_malloc(nOutput);\r\n  if( !zOutput ){\r\n    return;\r\n  }\r\n\r\n  if( sqlite3_user_data(p) ){\r\n    u_strToUpper(zOutput, nOutput/2, zInput, nInput/2, zLocale, &status);\r\n  }else{\r\n    u_strToLower(zOutput, nOutput/2, zInput, nInput/2, zLocale, &status);\r\n  }\r\n\r\n  if( !U_SUCCESS(status) ){\r\n    icuFunctionError(p, \"u_strToLower()/u_strToUpper\", status);\r\n    return;\r\n  }\r\n\r\n  sqlite3_result_text16(p, zOutput, -1, xFree);\r\n}\r\n\r\n/*\r\n** Collation sequence destructor function. The pCtx argument points to\r\n** a UCollator structure previously allocated using ucol_open().\r\n*/\r\nstatic void icuCollationDel(void *pCtx){\r\n  UCollator *p = (UCollator *)pCtx;\r\n  ucol_close(p);\r\n}\r\n\r\n/*\r\n** Collation sequence comparison function. The pCtx argument points to\r\n** a UCollator structure previously allocated using ucol_open().\r\n*/\r\nstatic int icuCollationColl(\r\n  void *pCtx,\r\n  int nLeft,\r\n  const void *zLeft,\r\n  int nRight,\r\n  const void *zRight\r\n){\r\n  UCollationResult res;\r\n  UCollator *p = (UCollator *)pCtx;\r\n  res = ucol_strcoll(p, (UChar *)zLeft, nLeft/2, (UChar *)zRight, nRight/2);\r\n  switch( res ){\r\n    case UCOL_LESS:    return -1;\r\n    case UCOL_GREATER: return +1;\r\n    case UCOL_EQUAL:   return 0;\r\n  }\r\n  assert(!\"Unexpected return value from ucol_strcoll()\");\r\n  return 0;\r\n}\r\n\r\n/*\r\n** Implementation of the scalar function icu_load_collation().\r\n**\r\n** This scalar function is used to add ICU collation based collation \r\n** types to an SQLite database connection. It is intended to be called\r\n** as follows:\r\n**\r\n**     SELECT icu_load_collation(<locale>, <collation-name>);\r\n**\r\n** Where <locale> is a string containing an ICU locale identifier (i.e.\r\n** \"en_AU\", \"tr_TR\" etc.) and <collation-name> is the name of the\r\n** collation sequence to create.\r\n*/\r\nstatic void icuLoadCollation(\r\n  sqlite3_context *p, \r\n  int nArg, \r\n  sqlite3_value **apArg\r\n){\r\n  sqlite3 *db = (sqlite3 *)sqlite3_user_data(p);\r\n  UErrorCode status = U_ZERO_ERROR;\r\n  const char *zLocale;      /* Locale identifier - (eg. \"jp_JP\") */\r\n  const char *zName;        /* SQL Collation sequence name (eg. \"japanese\") */\r\n  UCollator *pUCollator;    /* ICU library collation object */\r\n  int rc;                   /* Return code from sqlite3_create_collation_x() */\r\n\r\n  assert(nArg==2);\r\n  zLocale = (const char *)sqlite3_value_text(apArg[0]);\r\n  zName = (const char *)sqlite3_value_text(apArg[1]);\r\n\r\n  if( !zLocale || !zName ){\r\n    return;\r\n  }\r\n\r\n  pUCollator = ucol_open(zLocale, &status);\r\n  if( !U_SUCCESS(status) ){\r\n    icuFunctionError(p, \"ucol_open\", status);\r\n    return;\r\n  }\r\n  assert(p);\r\n\r\n  rc = sqlite3_create_collation_v2(db, zName, SQLITE_UTF16, (void *)pUCollator, \r\n      icuCollationColl, icuCollationDel\r\n  );\r\n  if( rc!=SQLITE_OK ){\r\n    ucol_close(pUCollator);\r\n    sqlite3_result_error(p, \"Error registering collation function\", -1);\r\n  }\r\n}\r\n\r\n/*\r\n** Register the ICU extension functions with database db.\r\n*/\r\nSQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){\r\n  struct IcuScalar {\r\n    const char *zName;                        /* Function name */\r\n    int nArg;                                 /* Number of arguments */\r\n    int enc;                                  /* Optimal text encoding */\r\n    void *pContext;                           /* sqlite3_user_data() context */\r\n    void (*xFunc)(sqlite3_context*,int,sqlite3_value**);\r\n  } scalars[] = {\r\n    {\"regexp\", 2, SQLITE_ANY,          0, icuRegexpFunc},\r\n\r\n    {\"lower\",  1, SQLITE_UTF16,        0, icuCaseFunc16},\r\n    {\"lower\",  2, SQLITE_UTF16,        0, icuCaseFunc16},\r\n    {\"upper\",  1, SQLITE_UTF16, (void*)1, icuCaseFunc16},\r\n    {\"upper\",  2, SQLITE_UTF16, (void*)1, icuCaseFunc16},\r\n\r\n    {\"lower\",  1, SQLITE_UTF8,         0, icuCaseFunc16},\r\n    {\"lower\",  2, SQLITE_UTF8,         0, icuCaseFunc16},\r\n    {\"upper\",  1, SQLITE_UTF8,  (void*)1, icuCaseFunc16},\r\n    {\"upper\",  2, SQLITE_UTF8,  (void*)1, icuCaseFunc16},\r\n\r\n    {\"like\",   2, SQLITE_UTF8,         0, icuLikeFunc},\r\n    {\"like\",   3, SQLITE_UTF8,         0, icuLikeFunc},\r\n\r\n    {\"icu_load_collation\",  2, SQLITE_UTF8, (void*)db, icuLoadCollation},\r\n  };\r\n\r\n  int rc = SQLITE_OK;\r\n  int i;\r\n\r\n  for(i=0; rc==SQLITE_OK && i<(int)(sizeof(scalars)/sizeof(scalars[0])); i++){\r\n    struct IcuScalar *p = &scalars[i];\r\n    rc = sqlite3_create_function(\r\n        db, p->zName, p->nArg, p->enc, p->pContext, p->xFunc, 0, 0\r\n    );\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n#if !SQLITE_CORE\r\nSQLITE_API int sqlite3_extension_init(\r\n  sqlite3 *db, \r\n  char **pzErrMsg,\r\n  const sqlite3_api_routines *pApi\r\n){\r\n  SQLITE_EXTENSION_INIT2(pApi)\r\n  return sqlite3IcuInit(db);\r\n}\r\n#endif\r\n\r\n#endif\r\n\r\n/************** End of icu.c *************************************************/\r\n/************** Begin file fts3_icu.c ****************************************/\r\n/*\r\n** 2007 June 22\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This file implements a tokenizer for fts3 based on the ICU library.\r\n*/\r\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\r\n#ifdef SQLITE_ENABLE_ICU\r\n\r\n/* #include <assert.h> */\r\n/* #include <string.h> */\r\n\r\n#include <unicode/ubrk.h>\r\n/* #include <unicode/ucol.h> */\r\n/* #include <unicode/ustring.h> */\r\n#include <unicode/utf16.h>\r\n\r\ntypedef struct IcuTokenizer IcuTokenizer;\r\ntypedef struct IcuCursor IcuCursor;\r\n\r\nstruct IcuTokenizer {\r\n  sqlite3_tokenizer base;\r\n  char *zLocale;\r\n};\r\n\r\nstruct IcuCursor {\r\n  sqlite3_tokenizer_cursor base;\r\n\r\n  UBreakIterator *pIter;      /* ICU break-iterator object */\r\n  int nChar;                  /* Number of UChar elements in pInput */\r\n  UChar *aChar;               /* Copy of input using utf-16 encoding */\r\n  int *aOffset;               /* Offsets of each character in utf-8 input */\r\n\r\n  int nBuffer;\r\n  char *zBuffer;\r\n\r\n  int iToken;\r\n};\r\n\r\n/*\r\n** Create a new tokenizer instance.\r\n*/\r\nstatic int icuCreate(\r\n  int argc,                            /* Number of entries in argv[] */\r\n  const char * const *argv,            /* Tokenizer creation arguments */\r\n  sqlite3_tokenizer **ppTokenizer      /* OUT: Created tokenizer */\r\n){\r\n  IcuTokenizer *p;\r\n  int n = 0;\r\n\r\n  if( argc>0 ){\r\n    n = strlen(argv[0])+1;\r\n  }\r\n  p = (IcuTokenizer *)sqlite3_malloc(sizeof(IcuTokenizer)+n);\r\n  if( !p ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(p, 0, sizeof(IcuTokenizer));\r\n\r\n  if( n ){\r\n    p->zLocale = (char *)&p[1];\r\n    memcpy(p->zLocale, argv[0], n);\r\n  }\r\n\r\n  *ppTokenizer = (sqlite3_tokenizer *)p;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Destroy a tokenizer\r\n*/\r\nstatic int icuDestroy(sqlite3_tokenizer *pTokenizer){\r\n  IcuTokenizer *p = (IcuTokenizer *)pTokenizer;\r\n  sqlite3_free(p);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Prepare to begin tokenizing a particular string.  The input\r\n** string to be tokenized is pInput[0..nBytes-1].  A cursor\r\n** used to incrementally tokenize this string is returned in \r\n** *ppCursor.\r\n*/\r\nstatic int icuOpen(\r\n  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */\r\n  const char *zInput,                    /* Input string */\r\n  int nInput,                            /* Length of zInput in bytes */\r\n  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */\r\n){\r\n  IcuTokenizer *p = (IcuTokenizer *)pTokenizer;\r\n  IcuCursor *pCsr;\r\n\r\n  const int32_t opt = U_FOLD_CASE_DEFAULT;\r\n  UErrorCode status = U_ZERO_ERROR;\r\n  int nChar;\r\n\r\n  UChar32 c;\r\n  int iInput = 0;\r\n  int iOut = 0;\r\n\r\n  *ppCursor = 0;\r\n\r\n  if( nInput<0 ){\r\n    nInput = strlen(zInput);\r\n  }\r\n  nChar = nInput+1;\r\n  pCsr = (IcuCursor *)sqlite3_malloc(\r\n      sizeof(IcuCursor) +                /* IcuCursor */\r\n      nChar * sizeof(UChar) +            /* IcuCursor.aChar[] */\r\n      (nChar+1) * sizeof(int)            /* IcuCursor.aOffset[] */\r\n  );\r\n  if( !pCsr ){\r\n    return SQLITE_NOMEM;\r\n  }\r\n  memset(pCsr, 0, sizeof(IcuCursor));\r\n  pCsr->aChar = (UChar *)&pCsr[1];\r\n  pCsr->aOffset = (int *)&pCsr->aChar[nChar];\r\n\r\n  pCsr->aOffset[iOut] = iInput;\r\n  U8_NEXT(zInput, iInput, nInput, c); \r\n  while( c>0 ){\r\n    int isError = 0;\r\n    c = u_foldCase(c, opt);\r\n    U16_APPEND(pCsr->aChar, iOut, nChar, c, isError);\r\n    if( isError ){\r\n      sqlite3_free(pCsr);\r\n      return SQLITE_ERROR;\r\n    }\r\n    pCsr->aOffset[iOut] = iInput;\r\n\r\n    if( iInput<nInput ){\r\n      U8_NEXT(zInput, iInput, nInput, c);\r\n    }else{\r\n      c = 0;\r\n    }\r\n  }\r\n\r\n  pCsr->pIter = ubrk_open(UBRK_WORD, p->zLocale, pCsr->aChar, iOut, &status);\r\n  if( !U_SUCCESS(status) ){\r\n    sqlite3_free(pCsr);\r\n    return SQLITE_ERROR;\r\n  }\r\n  pCsr->nChar = iOut;\r\n\r\n  ubrk_first(pCsr->pIter);\r\n  *ppCursor = (sqlite3_tokenizer_cursor *)pCsr;\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Close a tokenization cursor previously opened by a call to icuOpen().\r\n*/\r\nstatic int icuClose(sqlite3_tokenizer_cursor *pCursor){\r\n  IcuCursor *pCsr = (IcuCursor *)pCursor;\r\n  ubrk_close(pCsr->pIter);\r\n  sqlite3_free(pCsr->zBuffer);\r\n  sqlite3_free(pCsr);\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** Extract the next token from a tokenization cursor.\r\n*/\r\nstatic int icuNext(\r\n  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */\r\n  const char **ppToken,               /* OUT: *ppToken is the token text */\r\n  int *pnBytes,                       /* OUT: Number of bytes in token */\r\n  int *piStartOffset,                 /* OUT: Starting offset of token */\r\n  int *piEndOffset,                   /* OUT: Ending offset of token */\r\n  int *piPosition                     /* OUT: Position integer of token */\r\n){\r\n  IcuCursor *pCsr = (IcuCursor *)pCursor;\r\n\r\n  int iStart = 0;\r\n  int iEnd = 0;\r\n  int nByte = 0;\r\n\r\n  while( iStart==iEnd ){\r\n    UChar32 c;\r\n\r\n    iStart = ubrk_current(pCsr->pIter);\r\n    iEnd = ubrk_next(pCsr->pIter);\r\n    if( iEnd==UBRK_DONE ){\r\n      return SQLITE_DONE;\r\n    }\r\n\r\n    while( iStart<iEnd ){\r\n      int iWhite = iStart;\r\n      U8_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c);\r\n      if( u_isspace(c) ){\r\n        iStart = iWhite;\r\n      }else{\r\n        break;\r\n      }\r\n    }\r\n    assert(iStart<=iEnd);\r\n  }\r\n\r\n  do {\r\n    UErrorCode status = U_ZERO_ERROR;\r\n    if( nByte ){\r\n      char *zNew = sqlite3_realloc(pCsr->zBuffer, nByte);\r\n      if( !zNew ){\r\n        return SQLITE_NOMEM;\r\n      }\r\n      pCsr->zBuffer = zNew;\r\n      pCsr->nBuffer = nByte;\r\n    }\r\n\r\n    u_strToUTF8(\r\n        pCsr->zBuffer, pCsr->nBuffer, &nByte,    /* Output vars */\r\n        &pCsr->aChar[iStart], iEnd-iStart,       /* Input vars */\r\n        &status                                  /* Output success/failure */\r\n    );\r\n  } while( nByte>pCsr->nBuffer );\r\n\r\n  *ppToken = pCsr->zBuffer;\r\n  *pnBytes = nByte;\r\n  *piStartOffset = pCsr->aOffset[iStart];\r\n  *piEndOffset = pCsr->aOffset[iEnd];\r\n  *piPosition = pCsr->iToken++;\r\n\r\n  return SQLITE_OK;\r\n}\r\n\r\n/*\r\n** The set of routines that implement the simple tokenizer\r\n*/\r\nstatic const sqlite3_tokenizer_module icuTokenizerModule = {\r\n  0,                           /* iVersion */\r\n  icuCreate,                   /* xCreate  */\r\n  icuDestroy,                  /* xCreate  */\r\n  icuOpen,                     /* xOpen    */\r\n  icuClose,                    /* xClose   */\r\n  icuNext,                     /* xNext    */\r\n};\r\n\r\n/*\r\n** Set *ppModule to point at the implementation of the ICU tokenizer.\r\n*/\r\nSQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(\r\n  sqlite3_tokenizer_module const**ppModule\r\n){\r\n  *ppModule = &icuTokenizerModule;\r\n}\r\n\r\n#endif /* defined(SQLITE_ENABLE_ICU) */\r\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\r\n\r\n/************** End of fts3_icu.c ********************************************/\r\n\r\nsqlite3_vfs* getVFSList() {\r\n\treturn vfsList;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/SQLite/sqlite3.h",
    "content": "/*\r\n** 2001 September 15\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the interface that the SQLite library\r\n** presents to client programs.  If a C-function, structure, datatype,\r\n** or constant definition does not appear in this file, then it is\r\n** not a published API of SQLite, is subject to change without\r\n** notice, and should not be referenced by programs that use SQLite.\r\n**\r\n** Some of the definitions that are in this file are marked as\r\n** \"experimental\".  Experimental interfaces are normally new\r\n** features recently added to SQLite.  We do not anticipate changes\r\n** to experimental interfaces but reserve the right to make minor changes\r\n** if experience from use \"in the wild\" suggest such changes are prudent.\r\n**\r\n** The official C-language API documentation for SQLite is derived\r\n** from comments in this file.  This file is the authoritative source\r\n** on how SQLite interfaces are suppose to operate.\r\n**\r\n** The name of this file under configuration management is \"sqlite.h.in\".\r\n** The makefile makes some minor changes to this file (such as inserting\r\n** the version number) and changes its name to \"sqlite3.h\" as\r\n** part of the build process.\r\n*/\r\n#ifndef _SQLITE3_H_\r\n#define _SQLITE3_H_\r\n#include <stdarg.h>     /* Needed for the definition of va_list */\r\n\r\n/*\r\n** Make sure we can call this stuff from C++.\r\n*/\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\n/*\r\n** Add the ability to override 'extern'\r\n*/\r\n#ifndef SQLITE_EXTERN\r\n# define SQLITE_EXTERN extern\r\n#endif\r\n\r\n#ifndef SQLITE_API\r\n# define SQLITE_API\r\n#endif\r\n\r\n\r\n/*\r\n** These no-op macros are used in front of interfaces to mark those\r\n** interfaces as either deprecated or experimental.  New applications\r\n** should not use deprecated interfaces - they are support for backwards\r\n** compatibility only.  Application writers should be aware that\r\n** experimental interfaces are subject to change in point releases.\r\n**\r\n** These macros used to resolve to various kinds of compiler magic that\r\n** would generate warning messages when they were used.  But that\r\n** compiler magic ended up generating such a flurry of bug reports\r\n** that we have taken it all out and gone back to using simple\r\n** noop macros.\r\n*/\r\n#define SQLITE_DEPRECATED\r\n#define SQLITE_EXPERIMENTAL\r\n\r\n/*\r\n** Ensure these symbols were not defined by some previous header file.\r\n*/\r\n#ifdef SQLITE_VERSION\r\n# undef SQLITE_VERSION\r\n#endif\r\n#ifdef SQLITE_VERSION_NUMBER\r\n# undef SQLITE_VERSION_NUMBER\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Compile-Time Library Version Numbers\r\n**\r\n** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header\r\n** evaluates to a string literal that is the SQLite version in the\r\n** format \"X.Y.Z\" where X is the major version number (always 3 for\r\n** SQLite3) and Y is the minor version number and Z is the release number.)^\r\n** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer\r\n** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same\r\n** numbers used in [SQLITE_VERSION].)^\r\n** The SQLITE_VERSION_NUMBER for any given release of SQLite will also\r\n** be larger than the release from which it is derived.  Either Y will\r\n** be held constant and Z will be incremented or else Y will be incremented\r\n** and Z will be reset to zero.\r\n**\r\n** Since version 3.6.18, SQLite source code has been stored in the\r\n** <a href=\"http://www.fossil-scm.org/\">Fossil configuration management\r\n** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to\r\n** a string which identifies a particular check-in of SQLite\r\n** within its configuration management system.  ^The SQLITE_SOURCE_ID\r\n** string contains the date and time of the check-in (UTC) and an SHA1\r\n** hash of the entire source tree.\r\n**\r\n** See also: [sqlite3_libversion()],\r\n** [sqlite3_libversion_number()], [sqlite3_sourceid()],\r\n** [sqlite_version()] and [sqlite_source_id()].\r\n*/\r\n#define SQLITE_VERSION        \"3.7.11\"\r\n#define SQLITE_VERSION_NUMBER 3007011\r\n#define SQLITE_SOURCE_ID      \"2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669\"\r\n\r\n/*\r\n** CAPI3REF: Run-Time Library Version Numbers\r\n** KEYWORDS: sqlite3_version, sqlite3_sourceid\r\n**\r\n** These interfaces provide the same information as the [SQLITE_VERSION],\r\n** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros\r\n** but are associated with the library instead of the header file.  ^(Cautious\r\n** programmers might include assert() statements in their application to\r\n** verify that values returned by these interfaces match the macros in\r\n** the header, and thus insure that the application is\r\n** compiled with matching library and header files.\r\n**\r\n** <blockquote><pre>\r\n** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );\r\n** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );\r\n** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );\r\n** </pre></blockquote>)^\r\n**\r\n** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]\r\n** macro.  ^The sqlite3_libversion() function returns a pointer to the\r\n** to the sqlite3_version[] string constant.  The sqlite3_libversion()\r\n** function is provided for use in DLLs since DLL users usually do not have\r\n** direct access to string constants within the DLL.  ^The\r\n** sqlite3_libversion_number() function returns an integer equal to\r\n** [SQLITE_VERSION_NUMBER].  ^The sqlite3_sourceid() function returns \r\n** a pointer to a string constant whose value is the same as the \r\n** [SQLITE_SOURCE_ID] C preprocessor macro.\r\n**\r\n** See also: [sqlite_version()] and [sqlite_source_id()].\r\n*/\r\nSQLITE_API SQLITE_EXTERN const char sqlite3_version[];\r\nSQLITE_API const char *sqlite3_libversion(void);\r\nSQLITE_API const char *sqlite3_sourceid(void);\r\nSQLITE_API int sqlite3_libversion_number(void);\r\n\r\n/*\r\n** CAPI3REF: Run-Time Library Compilation Options Diagnostics\r\n**\r\n** ^The sqlite3_compileoption_used() function returns 0 or 1 \r\n** indicating whether the specified option was defined at \r\n** compile time.  ^The SQLITE_ prefix may be omitted from the \r\n** option name passed to sqlite3_compileoption_used().  \r\n**\r\n** ^The sqlite3_compileoption_get() function allows iterating\r\n** over the list of options that were defined at compile time by\r\n** returning the N-th compile time option string.  ^If N is out of range,\r\n** sqlite3_compileoption_get() returns a NULL pointer.  ^The SQLITE_ \r\n** prefix is omitted from any strings returned by \r\n** sqlite3_compileoption_get().\r\n**\r\n** ^Support for the diagnostic functions sqlite3_compileoption_used()\r\n** and sqlite3_compileoption_get() may be omitted by specifying the \r\n** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.\r\n**\r\n** See also: SQL functions [sqlite_compileoption_used()] and\r\n** [sqlite_compileoption_get()] and the [compile_options pragma].\r\n*/\r\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\r\nSQLITE_API int sqlite3_compileoption_used(const char *zOptName);\r\nSQLITE_API const char *sqlite3_compileoption_get(int N);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Test To See If The Library Is Threadsafe\r\n**\r\n** ^The sqlite3_threadsafe() function returns zero if and only if\r\n** SQLite was compiled with mutexing code omitted due to the\r\n** [SQLITE_THREADSAFE] compile-time option being set to 0.\r\n**\r\n** SQLite can be compiled with or without mutexes.  When\r\n** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes\r\n** are enabled and SQLite is threadsafe.  When the\r\n** [SQLITE_THREADSAFE] macro is 0, \r\n** the mutexes are omitted.  Without the mutexes, it is not safe\r\n** to use SQLite concurrently from more than one thread.\r\n**\r\n** Enabling mutexes incurs a measurable performance penalty.\r\n** So if speed is of utmost importance, it makes sense to disable\r\n** the mutexes.  But for maximum safety, mutexes should be enabled.\r\n** ^The default behavior is for mutexes to be enabled.\r\n**\r\n** This interface can be used by an application to make sure that the\r\n** version of SQLite that it is linking against was compiled with\r\n** the desired setting of the [SQLITE_THREADSAFE] macro.\r\n**\r\n** This interface only reports on the compile-time mutex setting\r\n** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with\r\n** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but\r\n** can be fully or partially disabled using a call to [sqlite3_config()]\r\n** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],\r\n** or [SQLITE_CONFIG_MUTEX].  ^(The return value of the\r\n** sqlite3_threadsafe() function shows only the compile-time setting of\r\n** thread safety, not any run-time changes to that setting made by\r\n** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()\r\n** is unchanged by calls to sqlite3_config().)^\r\n**\r\n** See the [threading mode] documentation for additional information.\r\n*/\r\nSQLITE_API int sqlite3_threadsafe(void);\r\n\r\n/*\r\n** CAPI3REF: Database Connection Handle\r\n** KEYWORDS: {database connection} {database connections}\r\n**\r\n** Each open SQLite database is represented by a pointer to an instance of\r\n** the opaque structure named \"sqlite3\".  It is useful to think of an sqlite3\r\n** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and\r\n** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]\r\n** is its destructor.  There are many other interfaces (such as\r\n** [sqlite3_prepare_v2()], [sqlite3_create_function()], and\r\n** [sqlite3_busy_timeout()] to name but three) that are methods on an\r\n** sqlite3 object.\r\n*/\r\ntypedef struct sqlite3 sqlite3;\r\n\r\n/*\r\n** CAPI3REF: 64-Bit Integer Types\r\n** KEYWORDS: sqlite_int64 sqlite_uint64\r\n**\r\n** Because there is no cross-platform way to specify 64-bit integer types\r\n** SQLite includes typedefs for 64-bit signed and unsigned integers.\r\n**\r\n** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.\r\n** The sqlite_int64 and sqlite_uint64 types are supported for backwards\r\n** compatibility only.\r\n**\r\n** ^The sqlite3_int64 and sqlite_int64 types can store integer values\r\n** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The\r\n** sqlite3_uint64 and sqlite_uint64 types can store integer values \r\n** between 0 and +18446744073709551615 inclusive.\r\n*/\r\n#ifdef SQLITE_INT64_TYPE\r\n  typedef SQLITE_INT64_TYPE sqlite_int64;\r\n  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;\r\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\r\n  typedef __int64 sqlite_int64;\r\n  typedef unsigned __int64 sqlite_uint64;\r\n#else\r\n  typedef long long int sqlite_int64;\r\n  typedef unsigned long long int sqlite_uint64;\r\n#endif\r\ntypedef sqlite_int64 sqlite3_int64;\r\ntypedef sqlite_uint64 sqlite3_uint64;\r\n\r\n/*\r\n** If compiling for a processor that lacks floating point support,\r\n** substitute integer for floating-point.\r\n*/\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n# define double sqlite3_int64\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Closing A Database Connection\r\n**\r\n** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.\r\n** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is\r\n** successfully destroyed and all associated resources are deallocated.\r\n**\r\n** Applications must [sqlite3_finalize | finalize] all [prepared statements]\r\n** and [sqlite3_blob_close | close] all [BLOB handles] associated with\r\n** the [sqlite3] object prior to attempting to close the object.  ^If\r\n** sqlite3_close() is called on a [database connection] that still has\r\n** outstanding [prepared statements] or [BLOB handles], then it returns\r\n** SQLITE_BUSY.\r\n**\r\n** ^If [sqlite3_close()] is invoked while a transaction is open,\r\n** the transaction is automatically rolled back.\r\n**\r\n** The C parameter to [sqlite3_close(C)] must be either a NULL\r\n** pointer or an [sqlite3] object pointer obtained\r\n** from [sqlite3_open()], [sqlite3_open16()], or\r\n** [sqlite3_open_v2()], and not previously closed.\r\n** ^Calling sqlite3_close() with a NULL pointer argument is a \r\n** harmless no-op.\r\n*/\r\nSQLITE_API int sqlite3_close(sqlite3 *);\r\n\r\n/*\r\n** The type for a callback function.\r\n** This is legacy and deprecated.  It is included for historical\r\n** compatibility and is not documented.\r\n*/\r\ntypedef int (*sqlite3_callback)(void*,int,char**, char**);\r\n\r\n/*\r\n** CAPI3REF: One-Step Query Execution Interface\r\n**\r\n** The sqlite3_exec() interface is a convenience wrapper around\r\n** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],\r\n** that allows an application to run multiple statements of SQL\r\n** without having to use a lot of C code. \r\n**\r\n** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,\r\n** semicolon-separate SQL statements passed into its 2nd argument,\r\n** in the context of the [database connection] passed in as its 1st\r\n** argument.  ^If the callback function of the 3rd argument to\r\n** sqlite3_exec() is not NULL, then it is invoked for each result row\r\n** coming out of the evaluated SQL statements.  ^The 4th argument to\r\n** sqlite3_exec() is relayed through to the 1st argument of each\r\n** callback invocation.  ^If the callback pointer to sqlite3_exec()\r\n** is NULL, then no callback is ever invoked and result rows are\r\n** ignored.\r\n**\r\n** ^If an error occurs while evaluating the SQL statements passed into\r\n** sqlite3_exec(), then execution of the current statement stops and\r\n** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()\r\n** is not NULL then any error message is written into memory obtained\r\n** from [sqlite3_malloc()] and passed back through the 5th parameter.\r\n** To avoid memory leaks, the application should invoke [sqlite3_free()]\r\n** on error message strings returned through the 5th parameter of\r\n** of sqlite3_exec() after the error message string is no longer needed.\r\n** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors\r\n** occur, then sqlite3_exec() sets the pointer in its 5th parameter to\r\n** NULL before returning.\r\n**\r\n** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()\r\n** routine returns SQLITE_ABORT without invoking the callback again and\r\n** without running any subsequent SQL statements.\r\n**\r\n** ^The 2nd argument to the sqlite3_exec() callback function is the\r\n** number of columns in the result.  ^The 3rd argument to the sqlite3_exec()\r\n** callback is an array of pointers to strings obtained as if from\r\n** [sqlite3_column_text()], one for each column.  ^If an element of a\r\n** result row is NULL then the corresponding string pointer for the\r\n** sqlite3_exec() callback is a NULL pointer.  ^The 4th argument to the\r\n** sqlite3_exec() callback is an array of pointers to strings where each\r\n** entry represents the name of corresponding result column as obtained\r\n** from [sqlite3_column_name()].\r\n**\r\n** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer\r\n** to an empty string, or a pointer that contains only whitespace and/or \r\n** SQL comments, then no SQL statements are evaluated and the database\r\n** is not changed.\r\n**\r\n** Restrictions:\r\n**\r\n** <ul>\r\n** <li> The application must insure that the 1st parameter to sqlite3_exec()\r\n**      is a valid and open [database connection].\r\n** <li> The application must not close [database connection] specified by\r\n**      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.\r\n** <li> The application must not modify the SQL statement text passed into\r\n**      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.\r\n** </ul>\r\n*/\r\nSQLITE_API int sqlite3_exec(\r\n  sqlite3*,                                  /* An open database */\r\n  const char *sql,                           /* SQL to be evaluated */\r\n  int (*callback)(void*,int,char**,char**),  /* Callback function */\r\n  void *,                                    /* 1st argument to callback */\r\n  char **errmsg                              /* Error msg written here */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Result Codes\r\n** KEYWORDS: SQLITE_OK {error code} {error codes}\r\n** KEYWORDS: {result code} {result codes}\r\n**\r\n** Many SQLite functions return an integer result code from the set shown\r\n** here in order to indicate success or failure.\r\n**\r\n** New error codes may be added in future versions of SQLite.\r\n**\r\n** See also: [SQLITE_IOERR_READ | extended result codes],\r\n** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes].\r\n*/\r\n#define SQLITE_OK           0   /* Successful result */\r\n/* beginning-of-error-codes */\r\n#define SQLITE_ERROR        1   /* SQL error or missing database */\r\n#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */\r\n#define SQLITE_PERM         3   /* Access permission denied */\r\n#define SQLITE_ABORT        4   /* Callback routine requested an abort */\r\n#define SQLITE_BUSY         5   /* The database file is locked */\r\n#define SQLITE_LOCKED       6   /* A table in the database is locked */\r\n#define SQLITE_NOMEM        7   /* A malloc() failed */\r\n#define SQLITE_READONLY     8   /* Attempt to write a readonly database */\r\n#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/\r\n#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */\r\n#define SQLITE_CORRUPT     11   /* The database disk image is malformed */\r\n#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */\r\n#define SQLITE_FULL        13   /* Insertion failed because database is full */\r\n#define SQLITE_CANTOPEN    14   /* Unable to open the database file */\r\n#define SQLITE_PROTOCOL    15   /* Database lock protocol error */\r\n#define SQLITE_EMPTY       16   /* Database is empty */\r\n#define SQLITE_SCHEMA      17   /* The database schema changed */\r\n#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */\r\n#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */\r\n#define SQLITE_MISMATCH    20   /* Data type mismatch */\r\n#define SQLITE_MISUSE      21   /* Library used incorrectly */\r\n#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */\r\n#define SQLITE_AUTH        23   /* Authorization denied */\r\n#define SQLITE_FORMAT      24   /* Auxiliary database format error */\r\n#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */\r\n#define SQLITE_NOTADB      26   /* File opened that is not a database file */\r\n#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */\r\n#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */\r\n/* end-of-error-codes */\r\n\r\n/*\r\n** CAPI3REF: Extended Result Codes\r\n** KEYWORDS: {extended error code} {extended error codes}\r\n** KEYWORDS: {extended result code} {extended result codes}\r\n**\r\n** In its default configuration, SQLite API routines return one of 26 integer\r\n** [SQLITE_OK | result codes].  However, experience has shown that many of\r\n** these result codes are too coarse-grained.  They do not provide as\r\n** much information about problems as programmers might like.  In an effort to\r\n** address this, newer versions of SQLite (version 3.3.8 and later) include\r\n** support for additional result codes that provide more detailed information\r\n** about errors. The extended result codes are enabled or disabled\r\n** on a per database connection basis using the\r\n** [sqlite3_extended_result_codes()] API.\r\n**\r\n** Some of the available extended result codes are listed here.\r\n** One may expect the number of extended result codes will be expand\r\n** over time.  Software that uses extended result codes should expect\r\n** to see new result codes in future releases of SQLite.\r\n**\r\n** The SQLITE_OK result code will never be extended.  It will always\r\n** be exactly zero.\r\n*/\r\n#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))\r\n#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))\r\n#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))\r\n#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))\r\n#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))\r\n#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))\r\n#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))\r\n#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))\r\n#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))\r\n#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))\r\n#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))\r\n#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))\r\n#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))\r\n#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))\r\n#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))\r\n#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))\r\n#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))\r\n#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))\r\n#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))\r\n#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))\r\n#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))\r\n#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))\r\n#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))\r\n#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))\r\n#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))\r\n#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))\r\n#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))\r\n#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))\r\n#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))\r\n\r\n/*\r\n** CAPI3REF: Flags For File Open Operations\r\n**\r\n** These bit values are intended for use in the\r\n** 3rd parameter to the [sqlite3_open_v2()] interface and\r\n** in the 4th parameter to the [sqlite3_vfs.xOpen] method.\r\n*/\r\n#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */\r\n#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */\r\n#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */\r\n#define SQLITE_OPEN_URI              0x00000040  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */\r\n#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */\r\n#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */\r\n#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */\r\n#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */\r\n#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */\r\n#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */\r\n#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */\r\n#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */\r\n\r\n/* Reserved:                         0x00F00000 */\r\n\r\n/*\r\n** CAPI3REF: Device Characteristics\r\n**\r\n** The xDeviceCharacteristics method of the [sqlite3_io_methods]\r\n** object returns an integer which is a vector of the these\r\n** bit values expressing I/O characteristics of the mass storage\r\n** device that holds the file that the [sqlite3_io_methods]\r\n** refers to.\r\n**\r\n** The SQLITE_IOCAP_ATOMIC property means that all writes of\r\n** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values\r\n** mean that writes of blocks that are nnn bytes in size and\r\n** are aligned to an address which is an integer multiple of\r\n** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means\r\n** that when data is appended to a file, the data is appended\r\n** first then the size of the file is extended, never the other\r\n** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that\r\n** information is written to disk in the same order as calls\r\n** to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that\r\n** after reboot following a crash or power loss, the only bytes in a\r\n** file that were written at the application level might have changed\r\n** and that adjacent bytes, even bytes within the same sector are\r\n** guaranteed to be unchanged.\r\n*/\r\n#define SQLITE_IOCAP_ATOMIC                 0x00000001\r\n#define SQLITE_IOCAP_ATOMIC512              0x00000002\r\n#define SQLITE_IOCAP_ATOMIC1K               0x00000004\r\n#define SQLITE_IOCAP_ATOMIC2K               0x00000008\r\n#define SQLITE_IOCAP_ATOMIC4K               0x00000010\r\n#define SQLITE_IOCAP_ATOMIC8K               0x00000020\r\n#define SQLITE_IOCAP_ATOMIC16K              0x00000040\r\n#define SQLITE_IOCAP_ATOMIC32K              0x00000080\r\n#define SQLITE_IOCAP_ATOMIC64K              0x00000100\r\n#define SQLITE_IOCAP_SAFE_APPEND            0x00000200\r\n#define SQLITE_IOCAP_SEQUENTIAL             0x00000400\r\n#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800\r\n#define SQLITE_IOCAP_POWERSAFE_OVERWRITE    0x00001000\r\n\r\n/*\r\n** CAPI3REF: File Locking Levels\r\n**\r\n** SQLite uses one of these integer values as the second\r\n** argument to calls it makes to the xLock() and xUnlock() methods\r\n** of an [sqlite3_io_methods] object.\r\n*/\r\n#define SQLITE_LOCK_NONE          0\r\n#define SQLITE_LOCK_SHARED        1\r\n#define SQLITE_LOCK_RESERVED      2\r\n#define SQLITE_LOCK_PENDING       3\r\n#define SQLITE_LOCK_EXCLUSIVE     4\r\n\r\n/*\r\n** CAPI3REF: Synchronization Type Flags\r\n**\r\n** When SQLite invokes the xSync() method of an\r\n** [sqlite3_io_methods] object it uses a combination of\r\n** these integer values as the second argument.\r\n**\r\n** When the SQLITE_SYNC_DATAONLY flag is used, it means that the\r\n** sync operation only needs to flush data to mass storage.  Inode\r\n** information need not be flushed. If the lower four bits of the flag\r\n** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.\r\n** If the lower four bits equal SQLITE_SYNC_FULL, that means\r\n** to use Mac OS X style fullsync instead of fsync().\r\n**\r\n** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags\r\n** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL\r\n** settings.  The [synchronous pragma] determines when calls to the\r\n** xSync VFS method occur and applies uniformly across all platforms.\r\n** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how\r\n** energetic or rigorous or forceful the sync operations are and\r\n** only make a difference on Mac OSX for the default SQLite code.\r\n** (Third-party VFS implementations might also make the distinction\r\n** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the\r\n** operating systems natively supported by SQLite, only Mac OSX\r\n** cares about the difference.)\r\n*/\r\n#define SQLITE_SYNC_NORMAL        0x00002\r\n#define SQLITE_SYNC_FULL          0x00003\r\n#define SQLITE_SYNC_DATAONLY      0x00010\r\n\r\n/*\r\n** CAPI3REF: OS Interface Open File Handle\r\n**\r\n** An [sqlite3_file] object represents an open file in the \r\n** [sqlite3_vfs | OS interface layer].  Individual OS interface\r\n** implementations will\r\n** want to subclass this object by appending additional fields\r\n** for their own use.  The pMethods entry is a pointer to an\r\n** [sqlite3_io_methods] object that defines methods for performing\r\n** I/O operations on the open file.\r\n*/\r\ntypedef struct sqlite3_file sqlite3_file;\r\nstruct sqlite3_file {\r\n  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */\r\n};\r\n\r\n/*\r\n** CAPI3REF: OS Interface File Virtual Methods Object\r\n**\r\n** Every file opened by the [sqlite3_vfs.xOpen] method populates an\r\n** [sqlite3_file] object (or, more commonly, a subclass of the\r\n** [sqlite3_file] object) with a pointer to an instance of this object.\r\n** This object defines the methods used to perform various operations\r\n** against the open file represented by the [sqlite3_file] object.\r\n**\r\n** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element \r\n** to a non-NULL pointer, then the sqlite3_io_methods.xClose method\r\n** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The\r\n** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]\r\n** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element\r\n** to NULL.\r\n**\r\n** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or\r\n** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().\r\n** The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]\r\n** flag may be ORed in to indicate that only the data of the file\r\n** and not its inode needs to be synced.\r\n**\r\n** The integer values to xLock() and xUnlock() are one of\r\n** <ul>\r\n** <li> [SQLITE_LOCK_NONE],\r\n** <li> [SQLITE_LOCK_SHARED],\r\n** <li> [SQLITE_LOCK_RESERVED],\r\n** <li> [SQLITE_LOCK_PENDING], or\r\n** <li> [SQLITE_LOCK_EXCLUSIVE].\r\n** </ul>\r\n** xLock() increases the lock. xUnlock() decreases the lock.\r\n** The xCheckReservedLock() method checks whether any database connection,\r\n** either in this process or in some other process, is holding a RESERVED,\r\n** PENDING, or EXCLUSIVE lock on the file.  It returns true\r\n** if such a lock exists and false otherwise.\r\n**\r\n** The xFileControl() method is a generic interface that allows custom\r\n** VFS implementations to directly control an open file using the\r\n** [sqlite3_file_control()] interface.  The second \"op\" argument is an\r\n** integer opcode.  The third argument is a generic pointer intended to\r\n** point to a structure that may contain arguments or space in which to\r\n** write return values.  Potential uses for xFileControl() might be\r\n** functions to enable blocking locks with timeouts, to change the\r\n** locking strategy (for example to use dot-file locks), to inquire\r\n** about the status of a lock, or to break stale locks.  The SQLite\r\n** core reserves all opcodes less than 100 for its own use.\r\n** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.\r\n** Applications that define a custom xFileControl method should use opcodes\r\n** greater than 100 to avoid conflicts.  VFS implementations should\r\n** return [SQLITE_NOTFOUND] for file control opcodes that they do not\r\n** recognize.\r\n**\r\n** The xSectorSize() method returns the sector size of the\r\n** device that underlies the file.  The sector size is the\r\n** minimum write that can be performed without disturbing\r\n** other bytes in the file.  The xDeviceCharacteristics()\r\n** method returns a bit vector describing behaviors of the\r\n** underlying device:\r\n**\r\n** <ul>\r\n** <li> [SQLITE_IOCAP_ATOMIC]\r\n** <li> [SQLITE_IOCAP_ATOMIC512]\r\n** <li> [SQLITE_IOCAP_ATOMIC1K]\r\n** <li> [SQLITE_IOCAP_ATOMIC2K]\r\n** <li> [SQLITE_IOCAP_ATOMIC4K]\r\n** <li> [SQLITE_IOCAP_ATOMIC8K]\r\n** <li> [SQLITE_IOCAP_ATOMIC16K]\r\n** <li> [SQLITE_IOCAP_ATOMIC32K]\r\n** <li> [SQLITE_IOCAP_ATOMIC64K]\r\n** <li> [SQLITE_IOCAP_SAFE_APPEND]\r\n** <li> [SQLITE_IOCAP_SEQUENTIAL]\r\n** </ul>\r\n**\r\n** The SQLITE_IOCAP_ATOMIC property means that all writes of\r\n** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values\r\n** mean that writes of blocks that are nnn bytes in size and\r\n** are aligned to an address which is an integer multiple of\r\n** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means\r\n** that when data is appended to a file, the data is appended\r\n** first then the size of the file is extended, never the other\r\n** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that\r\n** information is written to disk in the same order as calls\r\n** to xWrite().\r\n**\r\n** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill\r\n** in the unread portions of the buffer with zeros.  A VFS that\r\n** fails to zero-fill short reads might seem to work.  However,\r\n** failure to zero-fill short reads will eventually lead to\r\n** database corruption.\r\n*/\r\ntypedef struct sqlite3_io_methods sqlite3_io_methods;\r\nstruct sqlite3_io_methods {\r\n  int iVersion;\r\n  int (*xClose)(sqlite3_file*);\r\n  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);\r\n  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);\r\n  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);\r\n  int (*xSync)(sqlite3_file*, int flags);\r\n  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);\r\n  int (*xLock)(sqlite3_file*, int);\r\n  int (*xUnlock)(sqlite3_file*, int);\r\n  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);\r\n  int (*xFileControl)(sqlite3_file*, int op, void *pArg);\r\n  int (*xSectorSize)(sqlite3_file*);\r\n  int (*xDeviceCharacteristics)(sqlite3_file*);\r\n  /* Methods above are valid for version 1 */\r\n  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);\r\n  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);\r\n  void (*xShmBarrier)(sqlite3_file*);\r\n  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);\r\n  /* Methods above are valid for version 2 */\r\n  /* Additional methods may be added in future releases */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Standard File Control Opcodes\r\n**\r\n** These integer constants are opcodes for the xFileControl method\r\n** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]\r\n** interface.\r\n**\r\n** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This\r\n** opcode causes the xFileControl method to write the current state of\r\n** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],\r\n** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])\r\n** into an integer that the pArg argument points to. This capability\r\n** is used during testing and only needs to be supported when SQLITE_TEST\r\n** is defined.\r\n** <ul>\r\n** <li>[[SQLITE_FCNTL_SIZE_HINT]]\r\n** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS\r\n** layer a hint of how large the database file will grow to be during the\r\n** current transaction.  This hint is not guaranteed to be accurate but it\r\n** is often close.  The underlying VFS might choose to preallocate database\r\n** file space based on this hint in order to help writes to the database\r\n** file run faster.\r\n**\r\n** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]\r\n** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS\r\n** extends and truncates the database file in chunks of a size specified\r\n** by the user. The fourth argument to [sqlite3_file_control()] should \r\n** point to an integer (type int) containing the new chunk-size to use\r\n** for the nominated database. Allocating database file space in large\r\n** chunks (say 1MB at a time), may reduce file-system fragmentation and\r\n** improve performance on some systems.\r\n**\r\n** <li>[[SQLITE_FCNTL_FILE_POINTER]]\r\n** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer\r\n** to the [sqlite3_file] object associated with a particular database\r\n** connection.  See the [sqlite3_file_control()] documentation for\r\n** additional information.\r\n**\r\n** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]\r\n** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by\r\n** SQLite and sent to all VFSes in place of a call to the xSync method\r\n** when the database connection has [PRAGMA synchronous] set to OFF.)^\r\n** Some specialized VFSes need this signal in order to operate correctly\r\n** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most \r\n** VFSes do not need this signal and should silently ignore this opcode.\r\n** Applications should not call [sqlite3_file_control()] with this\r\n** opcode as doing so may disrupt the operation of the specialized VFSes\r\n** that do require it.  \r\n**\r\n** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]\r\n** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic\r\n** retry counts and intervals for certain disk I/O operations for the\r\n** windows [VFS] in order to provide robustness in the presence of\r\n** anti-virus programs.  By default, the windows VFS will retry file read,\r\n** file write, and file delete operations up to 10 times, with a delay\r\n** of 25 milliseconds before the first retry and with the delay increasing\r\n** by an additional 25 milliseconds with each subsequent retry.  This\r\n** opcode allows these two values (10 retries and 25 milliseconds of delay)\r\n** to be adjusted.  The values are changed for all database connections\r\n** within the same process.  The argument is a pointer to an array of two\r\n** integers where the first integer i the new retry count and the second\r\n** integer is the delay.  If either integer is negative, then the setting\r\n** is not changed but instead the prior value of that setting is written\r\n** into the array entry, allowing the current retry settings to be\r\n** interrogated.  The zDbName parameter is ignored.\r\n**\r\n** <li>[[SQLITE_FCNTL_PERSIST_WAL]]\r\n** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the\r\n** persistent [WAL | Write AHead Log] setting.  By default, the auxiliary\r\n** write ahead log and shared memory files used for transaction control\r\n** are automatically deleted when the latest connection to the database\r\n** closes.  Setting persistent WAL mode causes those files to persist after\r\n** close.  Persisting the files is useful when other processes that do not\r\n** have write permission on the directory containing the database file want\r\n** to read the database file, as the WAL and shared memory files must exist\r\n** in order for the database to be readable.  The fourth parameter to\r\n** [sqlite3_file_control()] for this opcode should be a pointer to an integer.\r\n** That integer is 0 to disable persistent WAL mode or 1 to enable persistent\r\n** WAL mode.  If the integer is -1, then it is overwritten with the current\r\n** WAL persistence setting.\r\n**\r\n** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]\r\n** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the\r\n** persistent \"powersafe-overwrite\" or \"PSOW\" setting.  The PSOW setting\r\n** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the\r\n** xDeviceCharacteristics methods. The fourth parameter to\r\n** [sqlite3_file_control()] for this opcode should be a pointer to an integer.\r\n** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage\r\n** mode.  If the integer is -1, then it is overwritten with the current\r\n** zero-damage mode setting.\r\n**\r\n** <li>[[SQLITE_FCNTL_OVERWRITE]]\r\n** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening\r\n** a write transaction to indicate that, unless it is rolled back for some\r\n** reason, the entire database file will be overwritten by the current \r\n** transaction. This is used by VACUUM operations.\r\n**\r\n** <li>[[SQLITE_FCNTL_VFSNAME]]\r\n** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of\r\n** all [VFSes] in the VFS stack.  The names are of all VFS shims and the\r\n** final bottom-level VFS are written into memory obtained from \r\n** [sqlite3_malloc()] and the result is stored in the char* variable\r\n** that the fourth parameter of [sqlite3_file_control()] points to.\r\n** The caller is responsible for freeing the memory when done.  As with\r\n** all file-control actions, there is no guarantee that this will actually\r\n** do anything.  Callers should initialize the char* variable to a NULL\r\n** pointer in case this file-control is not implemented.  This file-control\r\n** is intended for diagnostic use only.\r\n**\r\n** <li>[[SQLITE_FCNTL_PRAGMA]]\r\n** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] \r\n** file control is sent to the open [sqlite3_file] object corresponding\r\n** to the database file to which the pragma statement refers. ^The argument\r\n** to the [SQLITE_FCNTL_PRAGMA] file control is an array of\r\n** pointers to strings (char**) in which the second element of the array\r\n** is the name of the pragma and the third element is the argument to the\r\n** pragma or NULL if the pragma has no argument.  ^The handler for an\r\n** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element\r\n** of the char** argument point to a string obtained from [sqlite3_mprintf()]\r\n** or the equivalent and that string will become the result of the pragma or\r\n** the error message if the pragma fails. ^If the\r\n** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal \r\n** [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]\r\n** file control returns [SQLITE_OK], then the parser assumes that the\r\n** VFS has handled the PRAGMA itself and the parser generates a no-op\r\n** prepared statement.  ^If the [SQLITE_FCNTL_PRAGMA] file control returns\r\n** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means\r\n** that the VFS encountered an error while handling the [PRAGMA] and the\r\n** compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]\r\n** file control occurs at the beginning of pragma statement analysis and so\r\n** it is able to override built-in [PRAGMA] statements.\r\n** </ul>\r\n*/\r\n#define SQLITE_FCNTL_LOCKSTATE               1\r\n#define SQLITE_GET_LOCKPROXYFILE             2\r\n#define SQLITE_SET_LOCKPROXYFILE             3\r\n#define SQLITE_LAST_ERRNO                    4\r\n#define SQLITE_FCNTL_SIZE_HINT               5\r\n#define SQLITE_FCNTL_CHUNK_SIZE              6\r\n#define SQLITE_FCNTL_FILE_POINTER            7\r\n#define SQLITE_FCNTL_SYNC_OMITTED            8\r\n#define SQLITE_FCNTL_WIN32_AV_RETRY          9\r\n#define SQLITE_FCNTL_PERSIST_WAL            10\r\n#define SQLITE_FCNTL_OVERWRITE              11\r\n#define SQLITE_FCNTL_VFSNAME                12\r\n#define SQLITE_FCNTL_POWERSAFE_OVERWRITE    13\r\n#define SQLITE_FCNTL_PRAGMA                 14\r\n\r\n/*\r\n** CAPI3REF: Mutex Handle\r\n**\r\n** The mutex module within SQLite defines [sqlite3_mutex] to be an\r\n** abstract type for a mutex object.  The SQLite core never looks\r\n** at the internal representation of an [sqlite3_mutex].  It only\r\n** deals with pointers to the [sqlite3_mutex] object.\r\n**\r\n** Mutexes are created using [sqlite3_mutex_alloc()].\r\n*/\r\ntypedef struct sqlite3_mutex sqlite3_mutex;\r\n\r\n/*\r\n** CAPI3REF: OS Interface Object\r\n**\r\n** An instance of the sqlite3_vfs object defines the interface between\r\n** the SQLite core and the underlying operating system.  The \"vfs\"\r\n** in the name of the object stands for \"virtual file system\".  See\r\n** the [VFS | VFS documentation] for further information.\r\n**\r\n** The value of the iVersion field is initially 1 but may be larger in\r\n** future versions of SQLite.  Additional fields may be appended to this\r\n** object when the iVersion value is increased.  Note that the structure\r\n** of the sqlite3_vfs object changes in the transaction between\r\n** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not\r\n** modified.\r\n**\r\n** The szOsFile field is the size of the subclassed [sqlite3_file]\r\n** structure used by this VFS.  mxPathname is the maximum length of\r\n** a pathname in this VFS.\r\n**\r\n** Registered sqlite3_vfs objects are kept on a linked list formed by\r\n** the pNext pointer.  The [sqlite3_vfs_register()]\r\n** and [sqlite3_vfs_unregister()] interfaces manage this list\r\n** in a thread-safe way.  The [sqlite3_vfs_find()] interface\r\n** searches the list.  Neither the application code nor the VFS\r\n** implementation should use the pNext pointer.\r\n**\r\n** The pNext field is the only field in the sqlite3_vfs\r\n** structure that SQLite will ever modify.  SQLite will only access\r\n** or modify this field while holding a particular static mutex.\r\n** The application should never modify anything within the sqlite3_vfs\r\n** object once the object has been registered.\r\n**\r\n** The zName field holds the name of the VFS module.  The name must\r\n** be unique across all VFS modules.\r\n**\r\n** [[sqlite3_vfs.xOpen]]\r\n** ^SQLite guarantees that the zFilename parameter to xOpen\r\n** is either a NULL pointer or string obtained\r\n** from xFullPathname() with an optional suffix added.\r\n** ^If a suffix is added to the zFilename parameter, it will\r\n** consist of a single \"-\" character followed by no more than\r\n** 11 alphanumeric and/or \"-\" characters.\r\n** ^SQLite further guarantees that\r\n** the string will be valid and unchanged until xClose() is\r\n** called. Because of the previous sentence,\r\n** the [sqlite3_file] can safely store a pointer to the\r\n** filename if it needs to remember the filename for some reason.\r\n** If the zFilename parameter to xOpen is a NULL pointer then xOpen\r\n** must invent its own temporary name for the file.  ^Whenever the \r\n** xFilename parameter is NULL it will also be the case that the\r\n** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].\r\n**\r\n** The flags argument to xOpen() includes all bits set in\r\n** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]\r\n** or [sqlite3_open16()] is used, then flags includes at least\r\n** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. \r\n** If xOpen() opens a file read-only then it sets *pOutFlags to\r\n** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.\r\n**\r\n** ^(SQLite will also add one of the following flags to the xOpen()\r\n** call, depending on the object being opened:\r\n**\r\n** <ul>\r\n** <li>  [SQLITE_OPEN_MAIN_DB]\r\n** <li>  [SQLITE_OPEN_MAIN_JOURNAL]\r\n** <li>  [SQLITE_OPEN_TEMP_DB]\r\n** <li>  [SQLITE_OPEN_TEMP_JOURNAL]\r\n** <li>  [SQLITE_OPEN_TRANSIENT_DB]\r\n** <li>  [SQLITE_OPEN_SUBJOURNAL]\r\n** <li>  [SQLITE_OPEN_MASTER_JOURNAL]\r\n** <li>  [SQLITE_OPEN_WAL]\r\n** </ul>)^\r\n**\r\n** The file I/O implementation can use the object type flags to\r\n** change the way it deals with files.  For example, an application\r\n** that does not care about crash recovery or rollback might make\r\n** the open of a journal file a no-op.  Writes to this journal would\r\n** also be no-ops, and any attempt to read the journal would return\r\n** SQLITE_IOERR.  Or the implementation might recognize that a database\r\n** file will be doing page-aligned sector reads and writes in a random\r\n** order and set up its I/O subsystem accordingly.\r\n**\r\n** SQLite might also add one of the following flags to the xOpen method:\r\n**\r\n** <ul>\r\n** <li> [SQLITE_OPEN_DELETEONCLOSE]\r\n** <li> [SQLITE_OPEN_EXCLUSIVE]\r\n** </ul>\r\n**\r\n** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be\r\n** deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]\r\n** will be set for TEMP databases and their journals, transient\r\n** databases, and subjournals.\r\n**\r\n** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction\r\n** with the [SQLITE_OPEN_CREATE] flag, which are both directly\r\n** analogous to the O_EXCL and O_CREAT flags of the POSIX open()\r\n** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the \r\n** SQLITE_OPEN_CREATE, is used to indicate that file should always\r\n** be created, and that it is an error if it already exists.\r\n** It is <i>not</i> used to indicate the file should be opened \r\n** for exclusive access.\r\n**\r\n** ^At least szOsFile bytes of memory are allocated by SQLite\r\n** to hold the  [sqlite3_file] structure passed as the third\r\n** argument to xOpen.  The xOpen method does not have to\r\n** allocate the structure; it should just fill it in.  Note that\r\n** the xOpen method must set the sqlite3_file.pMethods to either\r\n** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do\r\n** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods\r\n** element will be valid after xOpen returns regardless of the success\r\n** or failure of the xOpen call.\r\n**\r\n** [[sqlite3_vfs.xAccess]]\r\n** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]\r\n** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to\r\n** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]\r\n** to test whether a file is at least readable.   The file can be a\r\n** directory.\r\n**\r\n** ^SQLite will always allocate at least mxPathname+1 bytes for the\r\n** output buffer xFullPathname.  The exact size of the output buffer\r\n** is also passed as a parameter to both  methods. If the output buffer\r\n** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is\r\n** handled as a fatal error by SQLite, vfs implementations should endeavor\r\n** to prevent this by setting mxPathname to a sufficiently large value.\r\n**\r\n** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()\r\n** interfaces are not strictly a part of the filesystem, but they are\r\n** included in the VFS structure for completeness.\r\n** The xRandomness() function attempts to return nBytes bytes\r\n** of good-quality randomness into zOut.  The return value is\r\n** the actual number of bytes of randomness obtained.\r\n** The xSleep() method causes the calling thread to sleep for at\r\n** least the number of microseconds given.  ^The xCurrentTime()\r\n** method returns a Julian Day Number for the current date and time as\r\n** a floating point value.\r\n** ^The xCurrentTimeInt64() method returns, as an integer, the Julian\r\n** Day Number multiplied by 86400000 (the number of milliseconds in \r\n** a 24-hour day).  \r\n** ^SQLite will use the xCurrentTimeInt64() method to get the current\r\n** date and time if that method is available (if iVersion is 2 or \r\n** greater and the function pointer is not NULL) and will fall back\r\n** to xCurrentTime() if xCurrentTimeInt64() is unavailable.\r\n**\r\n** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces\r\n** are not used by the SQLite core.  These optional interfaces are provided\r\n** by some VFSes to facilitate testing of the VFS code. By overriding \r\n** system calls with functions under its control, a test program can\r\n** simulate faults and error conditions that would otherwise be difficult\r\n** or impossible to induce.  The set of system calls that can be overridden\r\n** varies from one VFS to another, and from one version of the same VFS to the\r\n** next.  Applications that use these interfaces must be prepared for any\r\n** or all of these interfaces to be NULL or for their behavior to change\r\n** from one release to the next.  Applications must not attempt to access\r\n** any of these methods if the iVersion of the VFS is less than 3.\r\n*/\r\ntypedef struct sqlite3_vfs sqlite3_vfs;\r\ntypedef void (*sqlite3_syscall_ptr)(void);\r\nstruct sqlite3_vfs {\r\n  int iVersion;            /* Structure version number (currently 3) */\r\n  int szOsFile;            /* Size of subclassed sqlite3_file */\r\n  int mxPathname;          /* Maximum file pathname length */\r\n  sqlite3_vfs *pNext;      /* Next registered VFS */\r\n  const char *zName;       /* Name of this virtual file system */\r\n  void *pAppData;          /* Pointer to application-specific data */\r\n  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,\r\n               int flags, int *pOutFlags);\r\n  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);\r\n  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);\r\n  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);\r\n  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);\r\n  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);\r\n  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);\r\n  void (*xDlClose)(sqlite3_vfs*, void*);\r\n  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);\r\n  int (*xSleep)(sqlite3_vfs*, int microseconds);\r\n  int (*xCurrentTime)(sqlite3_vfs*, double*);\r\n  int (*xGetLastError)(sqlite3_vfs*, int, char *);\r\n  /*\r\n  ** The methods above are in version 1 of the sqlite_vfs object\r\n  ** definition.  Those that follow are added in version 2 or later\r\n  */\r\n  int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);\r\n  /*\r\n  ** The methods above are in versions 1 and 2 of the sqlite_vfs object.\r\n  ** Those below are for version 3 and greater.\r\n  */\r\n  int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);\r\n  sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);\r\n  const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);\r\n  /*\r\n  ** The methods above are in versions 1 through 3 of the sqlite_vfs object.\r\n  ** New fields may be appended in figure versions.  The iVersion\r\n  ** value will increment whenever this happens. \r\n  */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Flags for the xAccess VFS method\r\n**\r\n** These integer constants can be used as the third parameter to\r\n** the xAccess method of an [sqlite3_vfs] object.  They determine\r\n** what kind of permissions the xAccess method is looking for.\r\n** With SQLITE_ACCESS_EXISTS, the xAccess method\r\n** simply checks whether the file exists.\r\n** With SQLITE_ACCESS_READWRITE, the xAccess method\r\n** checks whether the named directory is both readable and writable\r\n** (in other words, if files can be added, removed, and renamed within\r\n** the directory).\r\n** The SQLITE_ACCESS_READWRITE constant is currently used only by the\r\n** [temp_store_directory pragma], though this could change in a future\r\n** release of SQLite.\r\n** With SQLITE_ACCESS_READ, the xAccess method\r\n** checks whether the file is readable.  The SQLITE_ACCESS_READ constant is\r\n** currently unused, though it might be used in a future release of\r\n** SQLite.\r\n*/\r\n#define SQLITE_ACCESS_EXISTS    0\r\n#define SQLITE_ACCESS_READWRITE 1   /* Used by PRAGMA temp_store_directory */\r\n#define SQLITE_ACCESS_READ      2   /* Unused */\r\n\r\n/*\r\n** CAPI3REF: Flags for the xShmLock VFS method\r\n**\r\n** These integer constants define the various locking operations\r\n** allowed by the xShmLock method of [sqlite3_io_methods].  The\r\n** following are the only legal combinations of flags to the\r\n** xShmLock method:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_SHARED\r\n** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE\r\n** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED\r\n** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE\r\n** </ul>\r\n**\r\n** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as\r\n** was given no the corresponding lock.  \r\n**\r\n** The xShmLock method can transition between unlocked and SHARED or\r\n** between unlocked and EXCLUSIVE.  It cannot transition between SHARED\r\n** and EXCLUSIVE.\r\n*/\r\n#define SQLITE_SHM_UNLOCK       1\r\n#define SQLITE_SHM_LOCK         2\r\n#define SQLITE_SHM_SHARED       4\r\n#define SQLITE_SHM_EXCLUSIVE    8\r\n\r\n/*\r\n** CAPI3REF: Maximum xShmLock index\r\n**\r\n** The xShmLock method on [sqlite3_io_methods] may use values\r\n** between 0 and this upper bound as its \"offset\" argument.\r\n** The SQLite core will never attempt to acquire or release a\r\n** lock outside of this range\r\n*/\r\n#define SQLITE_SHM_NLOCK        8\r\n\r\n\r\n/*\r\n** CAPI3REF: Initialize The SQLite Library\r\n**\r\n** ^The sqlite3_initialize() routine initializes the\r\n** SQLite library.  ^The sqlite3_shutdown() routine\r\n** deallocates any resources that were allocated by sqlite3_initialize().\r\n** These routines are designed to aid in process initialization and\r\n** shutdown on embedded systems.  Workstation applications using\r\n** SQLite normally do not need to invoke either of these routines.\r\n**\r\n** A call to sqlite3_initialize() is an \"effective\" call if it is\r\n** the first time sqlite3_initialize() is invoked during the lifetime of\r\n** the process, or if it is the first time sqlite3_initialize() is invoked\r\n** following a call to sqlite3_shutdown().  ^(Only an effective call\r\n** of sqlite3_initialize() does any initialization.  All other calls\r\n** are harmless no-ops.)^\r\n**\r\n** A call to sqlite3_shutdown() is an \"effective\" call if it is the first\r\n** call to sqlite3_shutdown() since the last sqlite3_initialize().  ^(Only\r\n** an effective call to sqlite3_shutdown() does any deinitialization.\r\n** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^\r\n**\r\n** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()\r\n** is not.  The sqlite3_shutdown() interface must only be called from a\r\n** single thread.  All open [database connections] must be closed and all\r\n** other SQLite resources must be deallocated prior to invoking\r\n** sqlite3_shutdown().\r\n**\r\n** Among other things, ^sqlite3_initialize() will invoke\r\n** sqlite3_os_init().  Similarly, ^sqlite3_shutdown()\r\n** will invoke sqlite3_os_end().\r\n**\r\n** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.\r\n** ^If for some reason, sqlite3_initialize() is unable to initialize\r\n** the library (perhaps it is unable to allocate a needed resource such\r\n** as a mutex) it returns an [error code] other than [SQLITE_OK].\r\n**\r\n** ^The sqlite3_initialize() routine is called internally by many other\r\n** SQLite interfaces so that an application usually does not need to\r\n** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]\r\n** calls sqlite3_initialize() so the SQLite library will be automatically\r\n** initialized when [sqlite3_open()] is called if it has not be initialized\r\n** already.  ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]\r\n** compile-time option, then the automatic calls to sqlite3_initialize()\r\n** are omitted and the application must call sqlite3_initialize() directly\r\n** prior to using any other SQLite interface.  For maximum portability,\r\n** it is recommended that applications always invoke sqlite3_initialize()\r\n** directly prior to using any other SQLite interface.  Future releases\r\n** of SQLite may require this.  In other words, the behavior exhibited\r\n** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the\r\n** default behavior in some future release of SQLite.\r\n**\r\n** The sqlite3_os_init() routine does operating-system specific\r\n** initialization of the SQLite library.  The sqlite3_os_end()\r\n** routine undoes the effect of sqlite3_os_init().  Typical tasks\r\n** performed by these routines include allocation or deallocation\r\n** of static resources, initialization of global variables,\r\n** setting up a default [sqlite3_vfs] module, or setting up\r\n** a default configuration using [sqlite3_config()].\r\n**\r\n** The application should never invoke either sqlite3_os_init()\r\n** or sqlite3_os_end() directly.  The application should only invoke\r\n** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()\r\n** interface is called automatically by sqlite3_initialize() and\r\n** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate\r\n** implementations for sqlite3_os_init() and sqlite3_os_end()\r\n** are built into SQLite when it is compiled for Unix, Windows, or OS/2.\r\n** When [custom builds | built for other platforms]\r\n** (using the [SQLITE_OS_OTHER=1] compile-time\r\n** option) the application must supply a suitable implementation for\r\n** sqlite3_os_init() and sqlite3_os_end().  An application-supplied\r\n** implementation of sqlite3_os_init() or sqlite3_os_end()\r\n** must return [SQLITE_OK] on success and some other [error code] upon\r\n** failure.\r\n*/\r\nSQLITE_API int sqlite3_initialize(void);\r\nSQLITE_API int sqlite3_shutdown(void);\r\nSQLITE_API int sqlite3_os_init(void);\r\nSQLITE_API int sqlite3_os_end(void);\r\n\r\n/*\r\n** CAPI3REF: Configuring The SQLite Library\r\n**\r\n** The sqlite3_config() interface is used to make global configuration\r\n** changes to SQLite in order to tune SQLite to the specific needs of\r\n** the application.  The default configuration is recommended for most\r\n** applications and so this routine is usually not necessary.  It is\r\n** provided to support rare applications with unusual needs.\r\n**\r\n** The sqlite3_config() interface is not threadsafe.  The application\r\n** must insure that no other SQLite interfaces are invoked by other\r\n** threads while sqlite3_config() is running.  Furthermore, sqlite3_config()\r\n** may only be invoked prior to library initialization using\r\n** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].\r\n** ^If sqlite3_config() is called after [sqlite3_initialize()] and before\r\n** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.\r\n** Note, however, that ^sqlite3_config() can be called as part of the\r\n** implementation of an application-defined [sqlite3_os_init()].\r\n**\r\n** The first argument to sqlite3_config() is an integer\r\n** [configuration option] that determines\r\n** what property of SQLite is to be configured.  Subsequent arguments\r\n** vary depending on the [configuration option]\r\n** in the first argument.\r\n**\r\n** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].\r\n** ^If the option is unknown or SQLite is unable to set the option\r\n** then this routine returns a non-zero [error code].\r\n*/\r\nSQLITE_API int sqlite3_config(int, ...);\r\n\r\n/*\r\n** CAPI3REF: Configure database connections\r\n**\r\n** The sqlite3_db_config() interface is used to make configuration\r\n** changes to a [database connection].  The interface is similar to\r\n** [sqlite3_config()] except that the changes apply to a single\r\n** [database connection] (specified in the first argument).\r\n**\r\n** The second argument to sqlite3_db_config(D,V,...)  is the\r\n** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code \r\n** that indicates what aspect of the [database connection] is being configured.\r\n** Subsequent arguments vary depending on the configuration verb.\r\n**\r\n** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if\r\n** the call is considered successful.\r\n*/\r\nSQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);\r\n\r\n/*\r\n** CAPI3REF: Memory Allocation Routines\r\n**\r\n** An instance of this object defines the interface between SQLite\r\n** and low-level memory allocation routines.\r\n**\r\n** This object is used in only one place in the SQLite interface.\r\n** A pointer to an instance of this object is the argument to\r\n** [sqlite3_config()] when the configuration option is\r\n** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].  \r\n** By creating an instance of this object\r\n** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])\r\n** during configuration, an application can specify an alternative\r\n** memory allocation subsystem for SQLite to use for all of its\r\n** dynamic memory needs.\r\n**\r\n** Note that SQLite comes with several [built-in memory allocators]\r\n** that are perfectly adequate for the overwhelming majority of applications\r\n** and that this object is only useful to a tiny minority of applications\r\n** with specialized memory allocation requirements.  This object is\r\n** also used during testing of SQLite in order to specify an alternative\r\n** memory allocator that simulates memory out-of-memory conditions in\r\n** order to verify that SQLite recovers gracefully from such\r\n** conditions.\r\n**\r\n** The xMalloc, xRealloc, and xFree methods must work like the\r\n** malloc(), realloc() and free() functions from the standard C library.\r\n** ^SQLite guarantees that the second argument to\r\n** xRealloc is always a value returned by a prior call to xRoundup.\r\n**\r\n** xSize should return the allocated size of a memory allocation\r\n** previously obtained from xMalloc or xRealloc.  The allocated size\r\n** is always at least as big as the requested size but may be larger.\r\n**\r\n** The xRoundup method returns what would be the allocated size of\r\n** a memory allocation given a particular requested size.  Most memory\r\n** allocators round up memory allocations at least to the next multiple\r\n** of 8.  Some allocators round up to a larger multiple or to a power of 2.\r\n** Every memory allocation request coming in through [sqlite3_malloc()]\r\n** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, \r\n** that causes the corresponding memory allocation to fail.\r\n**\r\n** The xInit method initializes the memory allocator.  (For example,\r\n** it might allocate any require mutexes or initialize internal data\r\n** structures.  The xShutdown method is invoked (indirectly) by\r\n** [sqlite3_shutdown()] and should deallocate any resources acquired\r\n** by xInit.  The pAppData pointer is used as the only parameter to\r\n** xInit and xShutdown.\r\n**\r\n** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes\r\n** the xInit method, so the xInit method need not be threadsafe.  The\r\n** xShutdown method is only called from [sqlite3_shutdown()] so it does\r\n** not need to be threadsafe either.  For all other methods, SQLite\r\n** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the\r\n** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which\r\n** it is by default) and so the methods are automatically serialized.\r\n** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other\r\n** methods must be threadsafe or else make their own arrangements for\r\n** serialization.\r\n**\r\n** SQLite will never invoke xInit() more than once without an intervening\r\n** call to xShutdown().\r\n*/\r\ntypedef struct sqlite3_mem_methods sqlite3_mem_methods;\r\nstruct sqlite3_mem_methods {\r\n  void *(*xMalloc)(int);         /* Memory allocation function */\r\n  void (*xFree)(void*);          /* Free a prior allocation */\r\n  void *(*xRealloc)(void*,int);  /* Resize an allocation */\r\n  int (*xSize)(void*);           /* Return the size of an allocation */\r\n  int (*xRoundup)(int);          /* Round up request size to allocation size */\r\n  int (*xInit)(void*);           /* Initialize the memory allocator */\r\n  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */\r\n  void *pAppData;                /* Argument to xInit() and xShutdown() */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Configuration Options\r\n** KEYWORDS: {configuration option}\r\n**\r\n** These constants are the available integer configuration options that\r\n** can be passed as the first argument to the [sqlite3_config()] interface.\r\n**\r\n** New configuration options may be added in future releases of SQLite.\r\n** Existing configuration options might be discontinued.  Applications\r\n** should check the return code from [sqlite3_config()] to make sure that\r\n** the call worked.  The [sqlite3_config()] interface will return a\r\n** non-zero [error code] if a discontinued or unsupported configuration option\r\n** is invoked.\r\n**\r\n** <dl>\r\n** [[SQLITE_CONFIG_SINGLETHREAD]] <dt>SQLITE_CONFIG_SINGLETHREAD</dt>\r\n** <dd>There are no arguments to this option.  ^This option sets the\r\n** [threading mode] to Single-thread.  In other words, it disables\r\n** all mutexing and puts SQLite into a mode where it can only be used\r\n** by a single thread.   ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** it is not possible to change the [threading mode] from its default\r\n** value of Single-thread and so [sqlite3_config()] will return \r\n** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD\r\n** configuration option.</dd>\r\n**\r\n** [[SQLITE_CONFIG_MULTITHREAD]] <dt>SQLITE_CONFIG_MULTITHREAD</dt>\r\n** <dd>There are no arguments to this option.  ^This option sets the\r\n** [threading mode] to Multi-thread.  In other words, it disables\r\n** mutexing on [database connection] and [prepared statement] objects.\r\n** The application is responsible for serializing access to\r\n** [database connections] and [prepared statements].  But other mutexes\r\n** are enabled so that SQLite will be safe to use in a multi-threaded\r\n** environment as long as no two threads attempt to use the same\r\n** [database connection] at the same time.  ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** it is not possible to set the Multi-thread [threading mode] and\r\n** [sqlite3_config()] will return [SQLITE_ERROR] if called with the\r\n** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>\r\n**\r\n** [[SQLITE_CONFIG_SERIALIZED]] <dt>SQLITE_CONFIG_SERIALIZED</dt>\r\n** <dd>There are no arguments to this option.  ^This option sets the\r\n** [threading mode] to Serialized. In other words, this option enables\r\n** all mutexes including the recursive\r\n** mutexes on [database connection] and [prepared statement] objects.\r\n** In this mode (which is the default when SQLite is compiled with\r\n** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access\r\n** to [database connections] and [prepared statements] so that the\r\n** application is free to use the same [database connection] or the\r\n** same [prepared statement] in different threads at the same time.\r\n** ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** it is not possible to set the Serialized [threading mode] and\r\n** [sqlite3_config()] will return [SQLITE_ERROR] if called with the\r\n** SQLITE_CONFIG_SERIALIZED configuration option.</dd>\r\n**\r\n** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mem_methods] structure.  The argument specifies\r\n** alternative low-level memory allocation routines to be used in place of\r\n** the memory allocation routines built into SQLite.)^ ^SQLite makes\r\n** its own private copy of the content of the [sqlite3_mem_methods] structure\r\n** before the [sqlite3_config()] call returns.</dd>\r\n**\r\n** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mem_methods] structure.  The [sqlite3_mem_methods]\r\n** structure is filled with the currently defined memory allocation routines.)^\r\n** This option can be used to overload the default memory allocation\r\n** routines with a wrapper that simulations memory allocation failure or\r\n** tracks memory usage, for example. </dd>\r\n**\r\n** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>\r\n** <dd> ^This option takes single argument of type int, interpreted as a \r\n** boolean, which enables or disables the collection of memory allocation \r\n** statistics. ^(When memory allocation statistics are disabled, the \r\n** following SQLite interfaces become non-operational:\r\n**   <ul>\r\n**   <li> [sqlite3_memory_used()]\r\n**   <li> [sqlite3_memory_highwater()]\r\n**   <li> [sqlite3_soft_heap_limit64()]\r\n**   <li> [sqlite3_status()]\r\n**   </ul>)^\r\n** ^Memory allocation statistics are enabled by default unless SQLite is\r\n** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory\r\n** allocation statistics are disabled by default.\r\n** </dd>\r\n**\r\n** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>\r\n** <dd> ^This option specifies a static memory buffer that SQLite can use for\r\n** scratch memory.  There are three arguments:  A pointer an 8-byte\r\n** aligned memory buffer from which the scratch allocations will be\r\n** drawn, the size of each scratch allocation (sz),\r\n** and the maximum number of scratch allocations (N).  The sz\r\n** argument must be a multiple of 16.\r\n** The first argument must be a pointer to an 8-byte aligned buffer\r\n** of at least sz*N bytes of memory.\r\n** ^SQLite will use no more than two scratch buffers per thread.  So\r\n** N should be set to twice the expected maximum number of threads.\r\n** ^SQLite will never require a scratch buffer that is more than 6\r\n** times the database page size. ^If SQLite needs needs additional\r\n** scratch memory beyond what is provided by this configuration option, then \r\n** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>\r\n**\r\n** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>\r\n** <dd> ^This option specifies a static memory buffer that SQLite can use for\r\n** the database page cache with the default page cache implementation.  \r\n** This configuration should not be used if an application-define page\r\n** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.\r\n** There are three arguments to this option: A pointer to 8-byte aligned\r\n** memory, the size of each page buffer (sz), and the number of pages (N).\r\n** The sz argument should be the size of the largest database page\r\n** (a power of two between 512 and 32768) plus a little extra for each\r\n** page header.  ^The page header size is 20 to 40 bytes depending on\r\n** the host architecture.  ^It is harmless, apart from the wasted memory,\r\n** to make sz a little too large.  The first\r\n** argument should point to an allocation of at least sz*N bytes of memory.\r\n** ^SQLite will use the memory provided by the first argument to satisfy its\r\n** memory needs for the first N pages that it adds to cache.  ^If additional\r\n** page cache memory is needed beyond what is provided by this option, then\r\n** SQLite goes to [sqlite3_malloc()] for the additional storage space.\r\n** The pointer in the first argument must\r\n** be aligned to an 8-byte boundary or subsequent behavior of SQLite\r\n** will be undefined.</dd>\r\n**\r\n** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>\r\n** <dd> ^This option specifies a static memory buffer that SQLite will use\r\n** for all of its dynamic memory allocation needs beyond those provided\r\n** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].\r\n** There are three arguments: An 8-byte aligned pointer to the memory,\r\n** the number of bytes in the memory buffer, and the minimum allocation size.\r\n** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts\r\n** to using its default memory allocator (the system malloc() implementation),\r\n** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  ^If the\r\n** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or\r\n** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory\r\n** allocator is engaged to handle all of SQLites memory allocation needs.\r\n** The first pointer (the memory pointer) must be aligned to an 8-byte\r\n** boundary or subsequent behavior of SQLite will be undefined.\r\n** The minimum allocation size is capped at 2**12. Reasonable values\r\n** for the minimum allocation size are 2**5 through 2**8.</dd>\r\n**\r\n** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mutex_methods] structure.  The argument specifies\r\n** alternative low-level mutex routines to be used in place\r\n** the mutex routines built into SQLite.)^  ^SQLite makes a copy of the\r\n** content of the [sqlite3_mutex_methods] structure before the call to\r\n** [sqlite3_config()] returns. ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** the entire mutexing subsystem is omitted from the build and hence calls to\r\n** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will\r\n** return [SQLITE_ERROR].</dd>\r\n**\r\n** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** instance of the [sqlite3_mutex_methods] structure.  The\r\n** [sqlite3_mutex_methods]\r\n** structure is filled with the currently defined mutex routines.)^\r\n** This option can be used to overload the default mutex allocation\r\n** routines with a wrapper used to track mutex usage for performance\r\n** profiling or testing, for example.   ^If SQLite is compiled with\r\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\r\n** the entire mutexing subsystem is omitted from the build and hence calls to\r\n** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will\r\n** return [SQLITE_ERROR].</dd>\r\n**\r\n** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>\r\n** <dd> ^(This option takes two arguments that determine the default\r\n** memory allocation for the lookaside memory allocator on each\r\n** [database connection].  The first argument is the\r\n** size of each lookaside buffer slot and the second is the number of\r\n** slots allocated to each database connection.)^  ^(This option sets the\r\n** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]\r\n** verb to [sqlite3_db_config()] can be used to change the lookaside\r\n** configuration on individual connections.)^ </dd>\r\n**\r\n** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to\r\n** an [sqlite3_pcache_methods2] object.  This object specifies the interface\r\n** to a custom page cache implementation.)^  ^SQLite makes a copy of the\r\n** object and uses it for page cache memory allocations.</dd>\r\n**\r\n** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>\r\n** <dd> ^(This option takes a single argument which is a pointer to an\r\n** [sqlite3_pcache_methods2] object.  SQLite copies of the current\r\n** page cache implementation into that object.)^ </dd>\r\n**\r\n** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>\r\n** <dd> ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a\r\n** function with a call signature of void(*)(void*,int,const char*), \r\n** and a pointer to void. ^If the function pointer is not NULL, it is\r\n** invoked by [sqlite3_log()] to process each logging event.  ^If the\r\n** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.\r\n** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is\r\n** passed through as the first parameter to the application-defined logger\r\n** function whenever that function is invoked.  ^The second parameter to\r\n** the logger function is a copy of the first parameter to the corresponding\r\n** [sqlite3_log()] call and is intended to be a [result code] or an\r\n** [extended result code].  ^The third parameter passed to the logger is\r\n** log message after formatting via [sqlite3_snprintf()].\r\n** The SQLite logging interface is not reentrant; the logger function\r\n** supplied by the application must not invoke any SQLite interface.\r\n** In a multi-threaded application, the application-defined logger\r\n** function must be threadsafe. </dd>\r\n**\r\n** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI\r\n** <dd> This option takes a single argument of type int. If non-zero, then\r\n** URI handling is globally enabled. If the parameter is zero, then URI handling\r\n** is globally disabled. If URI handling is globally enabled, all filenames\r\n** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or\r\n** specified as part of [ATTACH] commands are interpreted as URIs, regardless\r\n** of whether or not the [SQLITE_OPEN_URI] flag is set when the database\r\n** connection is opened. If it is globally disabled, filenames are\r\n** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the\r\n** database connection is opened. By default, URI handling is globally\r\n** disabled. The default value may be changed by compiling with the\r\n** [SQLITE_USE_URI] symbol defined.\r\n**\r\n** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]\r\n** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFNIG_GETPCACHE\r\n** <dd> These options are obsolete and should not be used by new code.\r\n** They are retained for backwards compatibility but are now no-ops.\r\n** </dl>\r\n*/\r\n#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */\r\n#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */\r\n#define SQLITE_CONFIG_SERIALIZED    3  /* nil */\r\n#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */\r\n#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */\r\n#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */\r\n#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */\r\n#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */\r\n#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */\r\n#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */\r\n#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */\r\n/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ \r\n#define SQLITE_CONFIG_LOOKASIDE    13  /* int int */\r\n#define SQLITE_CONFIG_PCACHE       14  /* no-op */\r\n#define SQLITE_CONFIG_GETPCACHE    15  /* no-op */\r\n#define SQLITE_CONFIG_LOG          16  /* xFunc, void* */\r\n#define SQLITE_CONFIG_URI          17  /* int */\r\n#define SQLITE_CONFIG_PCACHE2      18  /* sqlite3_pcache_methods2* */\r\n#define SQLITE_CONFIG_GETPCACHE2   19  /* sqlite3_pcache_methods2* */\r\n\r\n/*\r\n** CAPI3REF: Database Connection Configuration Options\r\n**\r\n** These constants are the available integer configuration options that\r\n** can be passed as the second argument to the [sqlite3_db_config()] interface.\r\n**\r\n** New configuration options may be added in future releases of SQLite.\r\n** Existing configuration options might be discontinued.  Applications\r\n** should check the return code from [sqlite3_db_config()] to make sure that\r\n** the call worked.  ^The [sqlite3_db_config()] interface will return a\r\n** non-zero [error code] if a discontinued or unsupported configuration option\r\n** is invoked.\r\n**\r\n** <dl>\r\n** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>\r\n** <dd> ^This option takes three additional arguments that determine the \r\n** [lookaside memory allocator] configuration for the [database connection].\r\n** ^The first argument (the third parameter to [sqlite3_db_config()] is a\r\n** pointer to a memory buffer to use for lookaside memory.\r\n** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb\r\n** may be NULL in which case SQLite will allocate the\r\n** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the\r\n** size of each lookaside buffer slot.  ^The third argument is the number of\r\n** slots.  The size of the buffer in the first argument must be greater than\r\n** or equal to the product of the second and third arguments.  The buffer\r\n** must be aligned to an 8-byte boundary.  ^If the second argument to\r\n** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally\r\n** rounded down to the next smaller multiple of 8.  ^(The lookaside memory\r\n** configuration for a database connection can only be changed when that\r\n** connection is not currently using lookaside memory, or in other words\r\n** when the \"current value\" returned by\r\n** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.\r\n** Any attempt to change the lookaside memory configuration when lookaside\r\n** memory is in use leaves the configuration unchanged and returns \r\n** [SQLITE_BUSY].)^</dd>\r\n**\r\n** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>\r\n** <dd> ^This option is used to enable or disable the enforcement of\r\n** [foreign key constraints].  There should be two additional arguments.\r\n** The first argument is an integer which is 0 to disable FK enforcement,\r\n** positive to enable FK enforcement or negative to leave FK enforcement\r\n** unchanged.  The second parameter is a pointer to an integer into which\r\n** is written 0 or 1 to indicate whether FK enforcement is off or on\r\n** following this call.  The second parameter may be a NULL pointer, in\r\n** which case the FK enforcement setting is not reported back. </dd>\r\n**\r\n** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>\r\n** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].\r\n** There should be two additional arguments.\r\n** The first argument is an integer which is 0 to disable triggers,\r\n** positive to enable triggers or negative to leave the setting unchanged.\r\n** The second parameter is a pointer to an integer into which\r\n** is written 0 or 1 to indicate whether triggers are disabled or enabled\r\n** following this call.  The second parameter may be a NULL pointer, in\r\n** which case the trigger setting is not reported back. </dd>\r\n**\r\n** </dl>\r\n*/\r\n#define SQLITE_DBCONFIG_LOOKASIDE       1001  /* void* int int */\r\n#define SQLITE_DBCONFIG_ENABLE_FKEY     1002  /* int int* */\r\n#define SQLITE_DBCONFIG_ENABLE_TRIGGER  1003  /* int int* */\r\n\r\n\r\n/*\r\n** CAPI3REF: Enable Or Disable Extended Result Codes\r\n**\r\n** ^The sqlite3_extended_result_codes() routine enables or disables the\r\n** [extended result codes] feature of SQLite. ^The extended result\r\n** codes are disabled by default for historical compatibility.\r\n*/\r\nSQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);\r\n\r\n/*\r\n** CAPI3REF: Last Insert Rowid\r\n**\r\n** ^Each entry in an SQLite table has a unique 64-bit signed\r\n** integer key called the [ROWID | \"rowid\"]. ^The rowid is always available\r\n** as an undeclared column named ROWID, OID, or _ROWID_ as long as those\r\n** names are not also used by explicitly declared columns. ^If\r\n** the table has a column of type [INTEGER PRIMARY KEY] then that column\r\n** is another alias for the rowid.\r\n**\r\n** ^This routine returns the [rowid] of the most recent\r\n** successful [INSERT] into the database from the [database connection]\r\n** in the first argument.  ^As of SQLite version 3.7.7, this routines\r\n** records the last insert rowid of both ordinary tables and [virtual tables].\r\n** ^If no successful [INSERT]s\r\n** have ever occurred on that database connection, zero is returned.\r\n**\r\n** ^(If an [INSERT] occurs within a trigger or within a [virtual table]\r\n** method, then this routine will return the [rowid] of the inserted\r\n** row as long as the trigger or virtual table method is running.\r\n** But once the trigger or virtual table method ends, the value returned \r\n** by this routine reverts to what it was before the trigger or virtual\r\n** table method began.)^\r\n**\r\n** ^An [INSERT] that fails due to a constraint violation is not a\r\n** successful [INSERT] and does not change the value returned by this\r\n** routine.  ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,\r\n** and INSERT OR ABORT make no changes to the return value of this\r\n** routine when their insertion fails.  ^(When INSERT OR REPLACE\r\n** encounters a constraint violation, it does not fail.  The\r\n** INSERT continues to completion after deleting rows that caused\r\n** the constraint problem so INSERT OR REPLACE will always change\r\n** the return value of this interface.)^\r\n**\r\n** ^For the purposes of this routine, an [INSERT] is considered to\r\n** be successful even if it is subsequently rolled back.\r\n**\r\n** This function is accessible to SQL statements via the\r\n** [last_insert_rowid() SQL function].\r\n**\r\n** If a separate thread performs a new [INSERT] on the same\r\n** database connection while the [sqlite3_last_insert_rowid()]\r\n** function is running and thus changes the last insert [rowid],\r\n** then the value returned by [sqlite3_last_insert_rowid()] is\r\n** unpredictable and might not equal either the old or the new\r\n** last insert [rowid].\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Count The Number Of Rows Modified\r\n**\r\n** ^This function returns the number of database rows that were changed\r\n** or inserted or deleted by the most recently completed SQL statement\r\n** on the [database connection] specified by the first parameter.\r\n** ^(Only changes that are directly specified by the [INSERT], [UPDATE],\r\n** or [DELETE] statement are counted.  Auxiliary changes caused by\r\n** triggers or [foreign key actions] are not counted.)^ Use the\r\n** [sqlite3_total_changes()] function to find the total number of changes\r\n** including changes caused by triggers and foreign key actions.\r\n**\r\n** ^Changes to a view that are simulated by an [INSTEAD OF trigger]\r\n** are not counted.  Only real table changes are counted.\r\n**\r\n** ^(A \"row change\" is a change to a single row of a single table\r\n** caused by an INSERT, DELETE, or UPDATE statement.  Rows that\r\n** are changed as side effects of [REPLACE] constraint resolution,\r\n** rollback, ABORT processing, [DROP TABLE], or by any other\r\n** mechanisms do not count as direct row changes.)^\r\n**\r\n** A \"trigger context\" is a scope of execution that begins and\r\n** ends with the script of a [CREATE TRIGGER | trigger]. \r\n** Most SQL statements are\r\n** evaluated outside of any trigger.  This is the \"top level\"\r\n** trigger context.  If a trigger fires from the top level, a\r\n** new trigger context is entered for the duration of that one\r\n** trigger.  Subtriggers create subcontexts for their duration.\r\n**\r\n** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does\r\n** not create a new trigger context.\r\n**\r\n** ^This function returns the number of direct row changes in the\r\n** most recent INSERT, UPDATE, or DELETE statement within the same\r\n** trigger context.\r\n**\r\n** ^Thus, when called from the top level, this function returns the\r\n** number of changes in the most recent INSERT, UPDATE, or DELETE\r\n** that also occurred at the top level.  ^(Within the body of a trigger,\r\n** the sqlite3_changes() interface can be called to find the number of\r\n** changes in the most recently completed INSERT, UPDATE, or DELETE\r\n** statement within the body of the same trigger.\r\n** However, the number returned does not include changes\r\n** caused by subtriggers since those have their own context.)^\r\n**\r\n** See also the [sqlite3_total_changes()] interface, the\r\n** [count_changes pragma], and the [changes() SQL function].\r\n**\r\n** If a separate thread makes changes on the same database connection\r\n** while [sqlite3_changes()] is running then the value returned\r\n** is unpredictable and not meaningful.\r\n*/\r\nSQLITE_API int sqlite3_changes(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Total Number Of Rows Modified\r\n**\r\n** ^This function returns the number of row changes caused by [INSERT],\r\n** [UPDATE] or [DELETE] statements since the [database connection] was opened.\r\n** ^(The count returned by sqlite3_total_changes() includes all changes\r\n** from all [CREATE TRIGGER | trigger] contexts and changes made by\r\n** [foreign key actions]. However,\r\n** the count does not include changes used to implement [REPLACE] constraints,\r\n** do rollbacks or ABORT processing, or [DROP TABLE] processing.  The\r\n** count does not include rows of views that fire an [INSTEAD OF trigger],\r\n** though if the INSTEAD OF trigger makes changes of its own, those changes \r\n** are counted.)^\r\n** ^The sqlite3_total_changes() function counts the changes as soon as\r\n** the statement that makes them is completed (when the statement handle\r\n** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).\r\n**\r\n** See also the [sqlite3_changes()] interface, the\r\n** [count_changes pragma], and the [total_changes() SQL function].\r\n**\r\n** If a separate thread makes changes on the same database connection\r\n** while [sqlite3_total_changes()] is running then the value\r\n** returned is unpredictable and not meaningful.\r\n*/\r\nSQLITE_API int sqlite3_total_changes(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Interrupt A Long-Running Query\r\n**\r\n** ^This function causes any pending database operation to abort and\r\n** return at its earliest opportunity. This routine is typically\r\n** called in response to a user action such as pressing \"Cancel\"\r\n** or Ctrl-C where the user wants a long query operation to halt\r\n** immediately.\r\n**\r\n** ^It is safe to call this routine from a thread different from the\r\n** thread that is currently running the database operation.  But it\r\n** is not safe to call this routine with a [database connection] that\r\n** is closed or might close before sqlite3_interrupt() returns.\r\n**\r\n** ^If an SQL operation is very nearly finished at the time when\r\n** sqlite3_interrupt() is called, then it might not have an opportunity\r\n** to be interrupted and might continue to completion.\r\n**\r\n** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].\r\n** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE\r\n** that is inside an explicit transaction, then the entire transaction\r\n** will be rolled back automatically.\r\n**\r\n** ^The sqlite3_interrupt(D) call is in effect until all currently running\r\n** SQL statements on [database connection] D complete.  ^Any new SQL statements\r\n** that are started after the sqlite3_interrupt() call and before the \r\n** running statements reaches zero are interrupted as if they had been\r\n** running prior to the sqlite3_interrupt() call.  ^New SQL statements\r\n** that are started after the running statement count reaches zero are\r\n** not effected by the sqlite3_interrupt().\r\n** ^A call to sqlite3_interrupt(D) that occurs when there are no running\r\n** SQL statements is a no-op and has no effect on SQL statements\r\n** that are started after the sqlite3_interrupt() call returns.\r\n**\r\n** If the database connection closes while [sqlite3_interrupt()]\r\n** is running then bad things will likely happen.\r\n*/\r\nSQLITE_API void sqlite3_interrupt(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Determine If An SQL Statement Is Complete\r\n**\r\n** These routines are useful during command-line input to determine if the\r\n** currently entered text seems to form a complete SQL statement or\r\n** if additional input is needed before sending the text into\r\n** SQLite for parsing.  ^These routines return 1 if the input string\r\n** appears to be a complete SQL statement.  ^A statement is judged to be\r\n** complete if it ends with a semicolon token and is not a prefix of a\r\n** well-formed CREATE TRIGGER statement.  ^Semicolons that are embedded within\r\n** string literals or quoted identifier names or comments are not\r\n** independent tokens (they are part of the token in which they are\r\n** embedded) and thus do not count as a statement terminator.  ^Whitespace\r\n** and comments that follow the final semicolon are ignored.\r\n**\r\n** ^These routines return 0 if the statement is incomplete.  ^If a\r\n** memory allocation fails, then SQLITE_NOMEM is returned.\r\n**\r\n** ^These routines do not parse the SQL statements thus\r\n** will not detect syntactically incorrect SQL.\r\n**\r\n** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior \r\n** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked\r\n** automatically by sqlite3_complete16().  If that initialization fails,\r\n** then the return value from sqlite3_complete16() will be non-zero\r\n** regardless of whether or not the input SQL is complete.)^\r\n**\r\n** The input to [sqlite3_complete()] must be a zero-terminated\r\n** UTF-8 string.\r\n**\r\n** The input to [sqlite3_complete16()] must be a zero-terminated\r\n** UTF-16 string in native byte order.\r\n*/\r\nSQLITE_API int sqlite3_complete(const char *sql);\r\nSQLITE_API int sqlite3_complete16(const void *sql);\r\n\r\n/*\r\n** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors\r\n**\r\n** ^This routine sets a callback function that might be invoked whenever\r\n** an attempt is made to open a database table that another thread\r\n** or process has locked.\r\n**\r\n** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]\r\n** is returned immediately upon encountering the lock.  ^If the busy callback\r\n** is not NULL, then the callback might be invoked with two arguments.\r\n**\r\n** ^The first argument to the busy handler is a copy of the void* pointer which\r\n** is the third argument to sqlite3_busy_handler().  ^The second argument to\r\n** the busy handler callback is the number of times that the busy handler has\r\n** been invoked for this locking event.  ^If the\r\n** busy callback returns 0, then no additional attempts are made to\r\n** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.\r\n** ^If the callback returns non-zero, then another attempt\r\n** is made to open the database for reading and the cycle repeats.\r\n**\r\n** The presence of a busy handler does not guarantee that it will be invoked\r\n** when there is lock contention. ^If SQLite determines that invoking the busy\r\n** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]\r\n** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.\r\n** Consider a scenario where one process is holding a read lock that\r\n** it is trying to promote to a reserved lock and\r\n** a second process is holding a reserved lock that it is trying\r\n** to promote to an exclusive lock.  The first process cannot proceed\r\n** because it is blocked by the second and the second process cannot\r\n** proceed because it is blocked by the first.  If both processes\r\n** invoke the busy handlers, neither will make any progress.  Therefore,\r\n** SQLite returns [SQLITE_BUSY] for the first process, hoping that this\r\n** will induce the first process to release its read lock and allow\r\n** the second process to proceed.\r\n**\r\n** ^The default busy callback is NULL.\r\n**\r\n** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]\r\n** when SQLite is in the middle of a large transaction where all the\r\n** changes will not fit into the in-memory cache.  SQLite will\r\n** already hold a RESERVED lock on the database file, but it needs\r\n** to promote this lock to EXCLUSIVE so that it can spill cache\r\n** pages into the database file without harm to concurrent\r\n** readers.  ^If it is unable to promote the lock, then the in-memory\r\n** cache will be left in an inconsistent state and so the error\r\n** code is promoted from the relatively benign [SQLITE_BUSY] to\r\n** the more severe [SQLITE_IOERR_BLOCKED].  ^This error code promotion\r\n** forces an automatic rollback of the changes.  See the\r\n** <a href=\"/cvstrac/wiki?p=CorruptionFollowingBusyError\">\r\n** CorruptionFollowingBusyError</a> wiki page for a discussion of why\r\n** this is important.\r\n**\r\n** ^(There can only be a single busy handler defined for each\r\n** [database connection].  Setting a new busy handler clears any\r\n** previously set handler.)^  ^Note that calling [sqlite3_busy_timeout()]\r\n** will also set or clear the busy handler.\r\n**\r\n** The busy callback should not take any actions which modify the\r\n** database connection that invoked the busy handler.  Any such actions\r\n** result in undefined behavior.\r\n** \r\n** A busy handler must not close the database connection\r\n** or [prepared statement] that invoked the busy handler.\r\n*/\r\nSQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);\r\n\r\n/*\r\n** CAPI3REF: Set A Busy Timeout\r\n**\r\n** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps\r\n** for a specified amount of time when a table is locked.  ^The handler\r\n** will sleep multiple times until at least \"ms\" milliseconds of sleeping\r\n** have accumulated.  ^After at least \"ms\" milliseconds of sleeping,\r\n** the handler returns 0 which causes [sqlite3_step()] to return\r\n** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].\r\n**\r\n** ^Calling this routine with an argument less than or equal to zero\r\n** turns off all busy handlers.\r\n**\r\n** ^(There can only be a single busy handler for a particular\r\n** [database connection] any any given moment.  If another busy handler\r\n** was defined  (using [sqlite3_busy_handler()]) prior to calling\r\n** this routine, that other busy handler is cleared.)^\r\n*/\r\nSQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);\r\n\r\n/*\r\n** CAPI3REF: Convenience Routines For Running Queries\r\n**\r\n** This is a legacy interface that is preserved for backwards compatibility.\r\n** Use of this interface is not recommended.\r\n**\r\n** Definition: A <b>result table</b> is memory data structure created by the\r\n** [sqlite3_get_table()] interface.  A result table records the\r\n** complete query results from one or more queries.\r\n**\r\n** The table conceptually has a number of rows and columns.  But\r\n** these numbers are not part of the result table itself.  These\r\n** numbers are obtained separately.  Let N be the number of rows\r\n** and M be the number of columns.\r\n**\r\n** A result table is an array of pointers to zero-terminated UTF-8 strings.\r\n** There are (N+1)*M elements in the array.  The first M pointers point\r\n** to zero-terminated strings that  contain the names of the columns.\r\n** The remaining entries all point to query results.  NULL values result\r\n** in NULL pointers.  All other values are in their UTF-8 zero-terminated\r\n** string representation as returned by [sqlite3_column_text()].\r\n**\r\n** A result table might consist of one or more memory allocations.\r\n** It is not safe to pass a result table directly to [sqlite3_free()].\r\n** A result table should be deallocated using [sqlite3_free_table()].\r\n**\r\n** ^(As an example of the result table format, suppose a query result\r\n** is as follows:\r\n**\r\n** <blockquote><pre>\r\n**        Name        | Age\r\n**        -----------------------\r\n**        Alice       | 43\r\n**        Bob         | 28\r\n**        Cindy       | 21\r\n** </pre></blockquote>\r\n**\r\n** There are two column (M==2) and three rows (N==3).  Thus the\r\n** result table has 8 entries.  Suppose the result table is stored\r\n** in an array names azResult.  Then azResult holds this content:\r\n**\r\n** <blockquote><pre>\r\n**        azResult&#91;0] = \"Name\";\r\n**        azResult&#91;1] = \"Age\";\r\n**        azResult&#91;2] = \"Alice\";\r\n**        azResult&#91;3] = \"43\";\r\n**        azResult&#91;4] = \"Bob\";\r\n**        azResult&#91;5] = \"28\";\r\n**        azResult&#91;6] = \"Cindy\";\r\n**        azResult&#91;7] = \"21\";\r\n** </pre></blockquote>)^\r\n**\r\n** ^The sqlite3_get_table() function evaluates one or more\r\n** semicolon-separated SQL statements in the zero-terminated UTF-8\r\n** string of its 2nd parameter and returns a result table to the\r\n** pointer given in its 3rd parameter.\r\n**\r\n** After the application has finished with the result from sqlite3_get_table(),\r\n** it must pass the result table pointer to sqlite3_free_table() in order to\r\n** release the memory that was malloced.  Because of the way the\r\n** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling\r\n** function must not try to call [sqlite3_free()] directly.  Only\r\n** [sqlite3_free_table()] is able to release the memory properly and safely.\r\n**\r\n** The sqlite3_get_table() interface is implemented as a wrapper around\r\n** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access\r\n** to any internal data structures of SQLite.  It uses only the public\r\n** interface defined here.  As a consequence, errors that occur in the\r\n** wrapper layer outside of the internal [sqlite3_exec()] call are not\r\n** reflected in subsequent calls to [sqlite3_errcode()] or\r\n** [sqlite3_errmsg()].\r\n*/\r\nSQLITE_API int sqlite3_get_table(\r\n  sqlite3 *db,          /* An open database */\r\n  const char *zSql,     /* SQL to be evaluated */\r\n  char ***pazResult,    /* Results of the query */\r\n  int *pnRow,           /* Number of result rows written here */\r\n  int *pnColumn,        /* Number of result columns written here */\r\n  char **pzErrmsg       /* Error msg written here */\r\n);\r\nSQLITE_API void sqlite3_free_table(char **result);\r\n\r\n/*\r\n** CAPI3REF: Formatted String Printing Functions\r\n**\r\n** These routines are work-alikes of the \"printf()\" family of functions\r\n** from the standard C library.\r\n**\r\n** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their\r\n** results into memory obtained from [sqlite3_malloc()].\r\n** The strings returned by these two routines should be\r\n** released by [sqlite3_free()].  ^Both routines return a\r\n** NULL pointer if [sqlite3_malloc()] is unable to allocate enough\r\n** memory to hold the resulting string.\r\n**\r\n** ^(The sqlite3_snprintf() routine is similar to \"snprintf()\" from\r\n** the standard C library.  The result is written into the\r\n** buffer supplied as the second parameter whose size is given by\r\n** the first parameter. Note that the order of the\r\n** first two parameters is reversed from snprintf().)^  This is an\r\n** historical accident that cannot be fixed without breaking\r\n** backwards compatibility.  ^(Note also that sqlite3_snprintf()\r\n** returns a pointer to its buffer instead of the number of\r\n** characters actually written into the buffer.)^  We admit that\r\n** the number of characters written would be a more useful return\r\n** value but we cannot change the implementation of sqlite3_snprintf()\r\n** now without breaking compatibility.\r\n**\r\n** ^As long as the buffer size is greater than zero, sqlite3_snprintf()\r\n** guarantees that the buffer is always zero-terminated.  ^The first\r\n** parameter \"n\" is the total size of the buffer, including space for\r\n** the zero terminator.  So the longest string that can be completely\r\n** written will be n-1 characters.\r\n**\r\n** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().\r\n**\r\n** These routines all implement some additional formatting\r\n** options that are useful for constructing SQL statements.\r\n** All of the usual printf() formatting options apply.  In addition, there\r\n** is are \"%q\", \"%Q\", and \"%z\" options.\r\n**\r\n** ^(The %q option works like %s in that it substitutes a nul-terminated\r\n** string from the argument list.  But %q also doubles every '\\'' character.\r\n** %q is designed for use inside a string literal.)^  By doubling each '\\''\r\n** character it escapes that character and allows it to be inserted into\r\n** the string.\r\n**\r\n** For example, assume the string variable zText contains text as follows:\r\n**\r\n** <blockquote><pre>\r\n**  char *zText = \"It's a happy day!\";\r\n** </pre></blockquote>\r\n**\r\n** One can use this text in an SQL statement as follows:\r\n**\r\n** <blockquote><pre>\r\n**  char *zSQL = sqlite3_mprintf(\"INSERT INTO table VALUES('%q')\", zText);\r\n**  sqlite3_exec(db, zSQL, 0, 0, 0);\r\n**  sqlite3_free(zSQL);\r\n** </pre></blockquote>\r\n**\r\n** Because the %q format string is used, the '\\'' character in zText\r\n** is escaped and the SQL generated is as follows:\r\n**\r\n** <blockquote><pre>\r\n**  INSERT INTO table1 VALUES('It''s a happy day!')\r\n** </pre></blockquote>\r\n**\r\n** This is correct.  Had we used %s instead of %q, the generated SQL\r\n** would have looked like this:\r\n**\r\n** <blockquote><pre>\r\n**  INSERT INTO table1 VALUES('It's a happy day!');\r\n** </pre></blockquote>\r\n**\r\n** This second example is an SQL syntax error.  As a general rule you should\r\n** always use %q instead of %s when inserting text into a string literal.\r\n**\r\n** ^(The %Q option works like %q except it also adds single quotes around\r\n** the outside of the total string.  Additionally, if the parameter in the\r\n** argument list is a NULL pointer, %Q substitutes the text \"NULL\" (without\r\n** single quotes).)^  So, for example, one could say:\r\n**\r\n** <blockquote><pre>\r\n**  char *zSQL = sqlite3_mprintf(\"INSERT INTO table VALUES(%Q)\", zText);\r\n**  sqlite3_exec(db, zSQL, 0, 0, 0);\r\n**  sqlite3_free(zSQL);\r\n** </pre></blockquote>\r\n**\r\n** The code above will render a correct SQL statement in the zSQL\r\n** variable even if the zText variable is a NULL pointer.\r\n**\r\n** ^(The \"%z\" formatting option works like \"%s\" but with the\r\n** addition that after the string has been read and copied into\r\n** the result, [sqlite3_free()] is called on the input string.)^\r\n*/\r\nSQLITE_API char *sqlite3_mprintf(const char*,...);\r\nSQLITE_API char *sqlite3_vmprintf(const char*, va_list);\r\nSQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);\r\nSQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);\r\n\r\n/*\r\n** CAPI3REF: Memory Allocation Subsystem\r\n**\r\n** The SQLite core uses these three routines for all of its own\r\n** internal memory allocation needs. \"Core\" in the previous sentence\r\n** does not include operating-system specific VFS implementation.  The\r\n** Windows VFS uses native malloc() and free() for some operations.\r\n**\r\n** ^The sqlite3_malloc() routine returns a pointer to a block\r\n** of memory at least N bytes in length, where N is the parameter.\r\n** ^If sqlite3_malloc() is unable to obtain sufficient free\r\n** memory, it returns a NULL pointer.  ^If the parameter N to\r\n** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns\r\n** a NULL pointer.\r\n**\r\n** ^Calling sqlite3_free() with a pointer previously returned\r\n** by sqlite3_malloc() or sqlite3_realloc() releases that memory so\r\n** that it might be reused.  ^The sqlite3_free() routine is\r\n** a no-op if is called with a NULL pointer.  Passing a NULL pointer\r\n** to sqlite3_free() is harmless.  After being freed, memory\r\n** should neither be read nor written.  Even reading previously freed\r\n** memory might result in a segmentation fault or other severe error.\r\n** Memory corruption, a segmentation fault, or other severe error\r\n** might result if sqlite3_free() is called with a non-NULL pointer that\r\n** was not obtained from sqlite3_malloc() or sqlite3_realloc().\r\n**\r\n** ^(The sqlite3_realloc() interface attempts to resize a\r\n** prior memory allocation to be at least N bytes, where N is the\r\n** second parameter.  The memory allocation to be resized is the first\r\n** parameter.)^ ^ If the first parameter to sqlite3_realloc()\r\n** is a NULL pointer then its behavior is identical to calling\r\n** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().\r\n** ^If the second parameter to sqlite3_realloc() is zero or\r\n** negative then the behavior is exactly the same as calling\r\n** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().\r\n** ^sqlite3_realloc() returns a pointer to a memory allocation\r\n** of at least N bytes in size or NULL if sufficient memory is unavailable.\r\n** ^If M is the size of the prior allocation, then min(N,M) bytes\r\n** of the prior allocation are copied into the beginning of buffer returned\r\n** by sqlite3_realloc() and the prior allocation is freed.\r\n** ^If sqlite3_realloc() returns NULL, then the prior allocation\r\n** is not freed.\r\n**\r\n** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()\r\n** is always aligned to at least an 8 byte boundary, or to a\r\n** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time\r\n** option is used.\r\n**\r\n** In SQLite version 3.5.0 and 3.5.1, it was possible to define\r\n** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in\r\n** implementation of these routines to be omitted.  That capability\r\n** is no longer provided.  Only built-in memory allocators can be used.\r\n**\r\n** The Windows OS interface layer calls\r\n** the system malloc() and free() directly when converting\r\n** filenames between the UTF-8 encoding used by SQLite\r\n** and whatever filename encoding is used by the particular Windows\r\n** installation.  Memory allocation errors are detected, but\r\n** they are reported back as [SQLITE_CANTOPEN] or\r\n** [SQLITE_IOERR] rather than [SQLITE_NOMEM].\r\n**\r\n** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]\r\n** must be either NULL or else pointers obtained from a prior\r\n** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have\r\n** not yet been released.\r\n**\r\n** The application must not read or write any part of\r\n** a block of memory after it has been released using\r\n** [sqlite3_free()] or [sqlite3_realloc()].\r\n*/\r\nSQLITE_API void *sqlite3_malloc(int);\r\nSQLITE_API void *sqlite3_realloc(void*, int);\r\nSQLITE_API void sqlite3_free(void*);\r\n\r\n/*\r\n** CAPI3REF: Memory Allocator Statistics\r\n**\r\n** SQLite provides these two interfaces for reporting on the status\r\n** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]\r\n** routines, which form the built-in memory allocation subsystem.\r\n**\r\n** ^The [sqlite3_memory_used()] routine returns the number of bytes\r\n** of memory currently outstanding (malloced but not freed).\r\n** ^The [sqlite3_memory_highwater()] routine returns the maximum\r\n** value of [sqlite3_memory_used()] since the high-water mark\r\n** was last reset.  ^The values returned by [sqlite3_memory_used()] and\r\n** [sqlite3_memory_highwater()] include any overhead\r\n** added by SQLite in its implementation of [sqlite3_malloc()],\r\n** but not overhead added by the any underlying system library\r\n** routines that [sqlite3_malloc()] may call.\r\n**\r\n** ^The memory high-water mark is reset to the current value of\r\n** [sqlite3_memory_used()] if and only if the parameter to\r\n** [sqlite3_memory_highwater()] is true.  ^The value returned\r\n** by [sqlite3_memory_highwater(1)] is the high-water mark\r\n** prior to the reset.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_memory_used(void);\r\nSQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);\r\n\r\n/*\r\n** CAPI3REF: Pseudo-Random Number Generator\r\n**\r\n** SQLite contains a high-quality pseudo-random number generator (PRNG) used to\r\n** select random [ROWID | ROWIDs] when inserting new records into a table that\r\n** already uses the largest possible [ROWID].  The PRNG is also used for\r\n** the build-in random() and randomblob() SQL functions.  This interface allows\r\n** applications to access the same PRNG for other purposes.\r\n**\r\n** ^A call to this routine stores N bytes of randomness into buffer P.\r\n**\r\n** ^The first time this routine is invoked (either internally or by\r\n** the application) the PRNG is seeded using randomness obtained\r\n** from the xRandomness method of the default [sqlite3_vfs] object.\r\n** ^On all subsequent invocations, the pseudo-randomness is generated\r\n** internally and without recourse to the [sqlite3_vfs] xRandomness\r\n** method.\r\n*/\r\nSQLITE_API void sqlite3_randomness(int N, void *P);\r\n\r\n/*\r\n** CAPI3REF: Compile-Time Authorization Callbacks\r\n**\r\n** ^This routine registers an authorizer callback with a particular\r\n** [database connection], supplied in the first argument.\r\n** ^The authorizer callback is invoked as SQL statements are being compiled\r\n** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],\r\n** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  ^At various\r\n** points during the compilation process, as logic is being created\r\n** to perform various actions, the authorizer callback is invoked to\r\n** see if those actions are allowed.  ^The authorizer callback should\r\n** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the\r\n** specific action but allow the SQL statement to continue to be\r\n** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be\r\n** rejected with an error.  ^If the authorizer callback returns\r\n** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]\r\n** then the [sqlite3_prepare_v2()] or equivalent call that triggered\r\n** the authorizer will fail with an error message.\r\n**\r\n** When the callback returns [SQLITE_OK], that means the operation\r\n** requested is ok.  ^When the callback returns [SQLITE_DENY], the\r\n** [sqlite3_prepare_v2()] or equivalent call that triggered the\r\n** authorizer will fail with an error message explaining that\r\n** access is denied. \r\n**\r\n** ^The first parameter to the authorizer callback is a copy of the third\r\n** parameter to the sqlite3_set_authorizer() interface. ^The second parameter\r\n** to the callback is an integer [SQLITE_COPY | action code] that specifies\r\n** the particular action to be authorized. ^The third through sixth parameters\r\n** to the callback are zero-terminated strings that contain additional\r\n** details about the action to be authorized.\r\n**\r\n** ^If the action code is [SQLITE_READ]\r\n** and the callback returns [SQLITE_IGNORE] then the\r\n** [prepared statement] statement is constructed to substitute\r\n** a NULL value in place of the table column that would have\r\n** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]\r\n** return can be used to deny an untrusted user access to individual\r\n** columns of a table.\r\n** ^If the action code is [SQLITE_DELETE] and the callback returns\r\n** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the\r\n** [truncate optimization] is disabled and all rows are deleted individually.\r\n**\r\n** An authorizer is used when [sqlite3_prepare | preparing]\r\n** SQL statements from an untrusted source, to ensure that the SQL statements\r\n** do not try to access data they are not allowed to see, or that they do not\r\n** try to execute malicious statements that damage the database.  For\r\n** example, an application may allow a user to enter arbitrary\r\n** SQL queries for evaluation by a database.  But the application does\r\n** not want the user to be able to make arbitrary changes to the\r\n** database.  An authorizer could then be put in place while the\r\n** user-entered SQL is being [sqlite3_prepare | prepared] that\r\n** disallows everything except [SELECT] statements.\r\n**\r\n** Applications that need to process SQL from untrusted sources\r\n** might also consider lowering resource limits using [sqlite3_limit()]\r\n** and limiting database size using the [max_page_count] [PRAGMA]\r\n** in addition to using an authorizer.\r\n**\r\n** ^(Only a single authorizer can be in place on a database connection\r\n** at a time.  Each call to sqlite3_set_authorizer overrides the\r\n** previous call.)^  ^Disable the authorizer by installing a NULL callback.\r\n** The authorizer is disabled by default.\r\n**\r\n** The authorizer callback must not do anything that will modify\r\n** the database connection that invoked the authorizer callback.\r\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\r\n** database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the\r\n** statement might be re-prepared during [sqlite3_step()] due to a \r\n** schema change.  Hence, the application should ensure that the\r\n** correct authorizer callback remains in place during the [sqlite3_step()].\r\n**\r\n** ^Note that the authorizer callback is invoked only during\r\n** [sqlite3_prepare()] or its variants.  Authorization is not\r\n** performed during statement evaluation in [sqlite3_step()], unless\r\n** as stated in the previous paragraph, sqlite3_step() invokes\r\n** sqlite3_prepare_v2() to reprepare a statement after a schema change.\r\n*/\r\nSQLITE_API int sqlite3_set_authorizer(\r\n  sqlite3*,\r\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),\r\n  void *pUserData\r\n);\r\n\r\n/*\r\n** CAPI3REF: Authorizer Return Codes\r\n**\r\n** The [sqlite3_set_authorizer | authorizer callback function] must\r\n** return either [SQLITE_OK] or one of these two constants in order\r\n** to signal SQLite whether or not the action is permitted.  See the\r\n** [sqlite3_set_authorizer | authorizer documentation] for additional\r\n** information.\r\n**\r\n** Note that SQLITE_IGNORE is also used as a [SQLITE_ROLLBACK | return code]\r\n** from the [sqlite3_vtab_on_conflict()] interface.\r\n*/\r\n#define SQLITE_DENY   1   /* Abort the SQL statement with an error */\r\n#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */\r\n\r\n/*\r\n** CAPI3REF: Authorizer Action Codes\r\n**\r\n** The [sqlite3_set_authorizer()] interface registers a callback function\r\n** that is invoked to authorize certain SQL statement actions.  The\r\n** second parameter to the callback is an integer code that specifies\r\n** what action is being authorized.  These are the integer action codes that\r\n** the authorizer callback may be passed.\r\n**\r\n** These action code values signify what kind of operation is to be\r\n** authorized.  The 3rd and 4th parameters to the authorization\r\n** callback function will be parameters or NULL depending on which of these\r\n** codes is used as the second parameter.  ^(The 5th parameter to the\r\n** authorizer callback is the name of the database (\"main\", \"temp\",\r\n** etc.) if applicable.)^  ^The 6th parameter to the authorizer callback\r\n** is the name of the inner-most trigger or view that is responsible for\r\n** the access attempt or NULL if this access attempt is directly from\r\n** top-level SQL code.\r\n*/\r\n/******************************************* 3rd ************ 4th ***********/\r\n#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */\r\n#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */\r\n#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */\r\n#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */\r\n#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */\r\n#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */\r\n#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */\r\n#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */\r\n#define SQLITE_DELETE                9   /* Table Name      NULL            */\r\n#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */\r\n#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */\r\n#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */\r\n#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */\r\n#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */\r\n#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */\r\n#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */\r\n#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */\r\n#define SQLITE_INSERT               18   /* Table Name      NULL            */\r\n#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */\r\n#define SQLITE_READ                 20   /* Table Name      Column Name     */\r\n#define SQLITE_SELECT               21   /* NULL            NULL            */\r\n#define SQLITE_TRANSACTION          22   /* Operation       NULL            */\r\n#define SQLITE_UPDATE               23   /* Table Name      Column Name     */\r\n#define SQLITE_ATTACH               24   /* Filename        NULL            */\r\n#define SQLITE_DETACH               25   /* Database Name   NULL            */\r\n#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */\r\n#define SQLITE_REINDEX              27   /* Index Name      NULL            */\r\n#define SQLITE_ANALYZE              28   /* Table Name      NULL            */\r\n#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */\r\n#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */\r\n#define SQLITE_FUNCTION             31   /* NULL            Function Name   */\r\n#define SQLITE_SAVEPOINT            32   /* Operation       Savepoint Name  */\r\n#define SQLITE_COPY                  0   /* No longer used */\r\n\r\n/*\r\n** CAPI3REF: Tracing And Profiling Functions\r\n**\r\n** These routines register callback functions that can be used for\r\n** tracing and profiling the execution of SQL statements.\r\n**\r\n** ^The callback function registered by sqlite3_trace() is invoked at\r\n** various times when an SQL statement is being run by [sqlite3_step()].\r\n** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the\r\n** SQL statement text as the statement first begins executing.\r\n** ^(Additional sqlite3_trace() callbacks might occur\r\n** as each triggered subprogram is entered.  The callbacks for triggers\r\n** contain a UTF-8 SQL comment that identifies the trigger.)^\r\n**\r\n** ^The callback function registered by sqlite3_profile() is invoked\r\n** as each SQL statement finishes.  ^The profile callback contains\r\n** the original statement text and an estimate of wall-clock time\r\n** of how long that statement took to run.  ^The profile callback\r\n** time is in units of nanoseconds, however the current implementation\r\n** is only capable of millisecond resolution so the six least significant\r\n** digits in the time are meaningless.  Future versions of SQLite\r\n** might provide greater resolution on the profiler callback.  The\r\n** sqlite3_profile() function is considered experimental and is\r\n** subject to change in future versions of SQLite.\r\n*/\r\nSQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);\r\nSQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,\r\n   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);\r\n\r\n/*\r\n** CAPI3REF: Query Progress Callbacks\r\n**\r\n** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback\r\n** function X to be invoked periodically during long running calls to\r\n** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for\r\n** database connection D.  An example use for this\r\n** interface is to keep a GUI updated during a large query.\r\n**\r\n** ^The parameter P is passed through as the only parameter to the \r\n** callback function X.  ^The parameter N is the number of \r\n** [virtual machine instructions] that are evaluated between successive\r\n** invocations of the callback X.\r\n**\r\n** ^Only a single progress handler may be defined at one time per\r\n** [database connection]; setting a new progress handler cancels the\r\n** old one.  ^Setting parameter X to NULL disables the progress handler.\r\n** ^The progress handler is also disabled by setting N to a value less\r\n** than 1.\r\n**\r\n** ^If the progress callback returns non-zero, the operation is\r\n** interrupted.  This feature can be used to implement a\r\n** \"Cancel\" button on a GUI progress dialog box.\r\n**\r\n** The progress handler callback must not do anything that will modify\r\n** the database connection that invoked the progress handler.\r\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\r\n** database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n*/\r\nSQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);\r\n\r\n/*\r\n** CAPI3REF: Opening A New Database Connection\r\n**\r\n** ^These routines open an SQLite database file as specified by the \r\n** filename argument. ^The filename argument is interpreted as UTF-8 for\r\n** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte\r\n** order for sqlite3_open16(). ^(A [database connection] handle is usually\r\n** returned in *ppDb, even if an error occurs.  The only exception is that\r\n** if SQLite is unable to allocate memory to hold the [sqlite3] object,\r\n** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]\r\n** object.)^ ^(If the database is opened (and/or created) successfully, then\r\n** [SQLITE_OK] is returned.  Otherwise an [error code] is returned.)^ ^The\r\n** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain\r\n** an English language description of the error following a failure of any\r\n** of the sqlite3_open() routines.\r\n**\r\n** ^The default encoding for the database will be UTF-8 if\r\n** sqlite3_open() or sqlite3_open_v2() is called and\r\n** UTF-16 in the native byte order if sqlite3_open16() is used.\r\n**\r\n** Whether or not an error occurs when it is opened, resources\r\n** associated with the [database connection] handle should be released by\r\n** passing it to [sqlite3_close()] when it is no longer required.\r\n**\r\n** The sqlite3_open_v2() interface works like sqlite3_open()\r\n** except that it accepts two additional parameters for additional control\r\n** over the new database connection.  ^(The flags parameter to\r\n** sqlite3_open_v2() can take one of\r\n** the following three values, optionally combined with the \r\n** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],\r\n** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^\r\n**\r\n** <dl>\r\n** ^(<dt>[SQLITE_OPEN_READONLY]</dt>\r\n** <dd>The database is opened in read-only mode.  If the database does not\r\n** already exist, an error is returned.</dd>)^\r\n**\r\n** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>\r\n** <dd>The database is opened for reading and writing if possible, or reading\r\n** only if the file is write protected by the operating system.  In either\r\n** case the database must already exist, otherwise an error is returned.</dd>)^\r\n**\r\n** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>\r\n** <dd>The database is opened for reading and writing, and is created if\r\n** it does not already exist. This is the behavior that is always used for\r\n** sqlite3_open() and sqlite3_open16().</dd>)^\r\n** </dl>\r\n**\r\n** If the 3rd parameter to sqlite3_open_v2() is not one of the\r\n** combinations shown above optionally combined with other\r\n** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]\r\n** then the behavior is undefined.\r\n**\r\n** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection\r\n** opens in the multi-thread [threading mode] as long as the single-thread\r\n** mode has not been set at compile-time or start-time.  ^If the\r\n** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens\r\n** in the serialized [threading mode] unless single-thread was\r\n** previously selected at compile-time or start-time.\r\n** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be\r\n** eligible to use [shared cache mode], regardless of whether or not shared\r\n** cache is enabled using [sqlite3_enable_shared_cache()].  ^The\r\n** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not\r\n** participate in [shared cache mode] even if it is enabled.\r\n**\r\n** ^The fourth parameter to sqlite3_open_v2() is the name of the\r\n** [sqlite3_vfs] object that defines the operating system interface that\r\n** the new database connection should use.  ^If the fourth parameter is\r\n** a NULL pointer then the default [sqlite3_vfs] object is used.\r\n**\r\n** ^If the filename is \":memory:\", then a private, temporary in-memory database\r\n** is created for the connection.  ^This in-memory database will vanish when\r\n** the database connection is closed.  Future versions of SQLite might\r\n** make use of additional special filenames that begin with the \":\" character.\r\n** It is recommended that when a database filename actually does begin with\r\n** a \":\" character you should prefix the filename with a pathname such as\r\n** \"./\" to avoid ambiguity.\r\n**\r\n** ^If the filename is an empty string, then a private, temporary\r\n** on-disk database will be created.  ^This private database will be\r\n** automatically deleted as soon as the database connection is closed.\r\n**\r\n** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>\r\n**\r\n** ^If [URI filename] interpretation is enabled, and the filename argument\r\n** begins with \"file:\", then the filename is interpreted as a URI. ^URI\r\n** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is\r\n** set in the fourth argument to sqlite3_open_v2(), or if it has\r\n** been enabled globally using the [SQLITE_CONFIG_URI] option with the\r\n** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.\r\n** As of SQLite version 3.7.7, URI filename interpretation is turned off\r\n** by default, but future releases of SQLite might enable URI filename\r\n** interpretation by default.  See \"[URI filenames]\" for additional\r\n** information.\r\n**\r\n** URI filenames are parsed according to RFC 3986. ^If the URI contains an\r\n** authority, then it must be either an empty string or the string \r\n** \"localhost\". ^If the authority is not an empty string or \"localhost\", an \r\n** error is returned to the caller. ^The fragment component of a URI, if \r\n** present, is ignored.\r\n**\r\n** ^SQLite uses the path component of the URI as the name of the disk file\r\n** which contains the database. ^If the path begins with a '/' character, \r\n** then it is interpreted as an absolute path. ^If the path does not begin \r\n** with a '/' (meaning that the authority section is omitted from the URI)\r\n** then the path is interpreted as a relative path. \r\n** ^On windows, the first component of an absolute path \r\n** is a drive specification (e.g. \"C:\").\r\n**\r\n** [[core URI query parameters]]\r\n** The query component of a URI may contain parameters that are interpreted\r\n** either by SQLite itself, or by a [VFS | custom VFS implementation].\r\n** SQLite interprets the following three query parameters:\r\n**\r\n** <ul>\r\n**   <li> <b>vfs</b>: ^The \"vfs\" parameter may be used to specify the name of\r\n**     a VFS object that provides the operating system interface that should\r\n**     be used to access the database file on disk. ^If this option is set to\r\n**     an empty string the default VFS object is used. ^Specifying an unknown\r\n**     VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is\r\n**     present, then the VFS specified by the option takes precedence over\r\n**     the value passed as the fourth parameter to sqlite3_open_v2().\r\n**\r\n**   <li> <b>mode</b>: ^(The mode parameter may be set to either \"ro\", \"rw\" or\r\n**     \"rwc\". Attempting to set it to any other value is an error)^. \r\n**     ^If \"ro\" is specified, then the database is opened for read-only \r\n**     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the \r\n**     third argument to sqlite3_prepare_v2(). ^If the mode option is set to \r\n**     \"rw\", then the database is opened for read-write (but not create) \r\n**     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had \r\n**     been set. ^Value \"rwc\" is equivalent to setting both \r\n**     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If sqlite3_open_v2() is \r\n**     used, it is an error to specify a value for the mode parameter that is \r\n**     less restrictive than that specified by the flags passed as the third \r\n**     parameter.\r\n**\r\n**   <li> <b>cache</b>: ^The cache parameter may be set to either \"shared\" or\r\n**     \"private\". ^Setting it to \"shared\" is equivalent to setting the\r\n**     SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to\r\n**     sqlite3_open_v2(). ^Setting the cache parameter to \"private\" is \r\n**     equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.\r\n**     ^If sqlite3_open_v2() is used and the \"cache\" parameter is present in\r\n**     a URI filename, its value overrides any behaviour requested by setting\r\n**     SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.\r\n** </ul>\r\n**\r\n** ^Specifying an unknown parameter in the query component of a URI is not an\r\n** error.  Future versions of SQLite might understand additional query\r\n** parameters.  See \"[query parameters with special meaning to SQLite]\" for\r\n** additional information.\r\n**\r\n** [[URI filename examples]] <h3>URI filename examples</h3>\r\n**\r\n** <table border=\"1\" align=center cellpadding=5>\r\n** <tr><th> URI filenames <th> Results\r\n** <tr><td> file:data.db <td> \r\n**          Open the file \"data.db\" in the current directory.\r\n** <tr><td> file:/home/fred/data.db<br>\r\n**          file:///home/fred/data.db <br> \r\n**          file://localhost/home/fred/data.db <br> <td> \r\n**          Open the database file \"/home/fred/data.db\".\r\n** <tr><td> file://darkstar/home/fred/data.db <td> \r\n**          An error. \"darkstar\" is not a recognized authority.\r\n** <tr><td style=\"white-space:nowrap\"> \r\n**          file:///C:/Documents%20and%20Settings/fred/Desktop/data.db\r\n**     <td> Windows only: Open the file \"data.db\" on fred's desktop on drive\r\n**          C:. Note that the %20 escaping in this example is not strictly \r\n**          necessary - space characters can be used literally\r\n**          in URI filenames.\r\n** <tr><td> file:data.db?mode=ro&cache=private <td> \r\n**          Open file \"data.db\" in the current directory for read-only access.\r\n**          Regardless of whether or not shared-cache mode is enabled by\r\n**          default, use a private cache.\r\n** <tr><td> file:/home/fred/data.db?vfs=unix-nolock <td>\r\n**          Open file \"/home/fred/data.db\". Use the special VFS \"unix-nolock\".\r\n** <tr><td> file:data.db?mode=readonly <td> \r\n**          An error. \"readonly\" is not a valid option for the \"mode\" parameter.\r\n** </table>\r\n**\r\n** ^URI hexadecimal escape sequences (%HH) are supported within the path and\r\n** query components of a URI. A hexadecimal escape sequence consists of a\r\n** percent sign - \"%\" - followed by exactly two hexadecimal digits \r\n** specifying an octet value. ^Before the path or query components of a\r\n** URI filename are interpreted, they are encoded using UTF-8 and all \r\n** hexadecimal escape sequences replaced by a single byte containing the\r\n** corresponding octet. If this process generates an invalid UTF-8 encoding,\r\n** the results are undefined.\r\n**\r\n** <b>Note to Windows users:</b>  The encoding used for the filename argument\r\n** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever\r\n** codepage is currently defined.  Filenames containing international\r\n** characters must be converted to UTF-8 prior to passing them into\r\n** sqlite3_open() or sqlite3_open_v2().\r\n*/\r\nSQLITE_API int sqlite3_open(\r\n  const char *filename,   /* Database filename (UTF-8) */\r\n  sqlite3 **ppDb          /* OUT: SQLite db handle */\r\n);\r\nSQLITE_API int sqlite3_open16(\r\n  const void *filename,   /* Database filename (UTF-16) */\r\n  sqlite3 **ppDb          /* OUT: SQLite db handle */\r\n);\r\nSQLITE_API int sqlite3_open_v2(\r\n  const char *filename,   /* Database filename (UTF-8) */\r\n  sqlite3 **ppDb,         /* OUT: SQLite db handle */\r\n  int flags,              /* Flags */\r\n  const char *zVfs        /* Name of VFS module to use */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Obtain Values For URI Parameters\r\n**\r\n** These are utility routines, useful to VFS implementations, that check\r\n** to see if a database file was a URI that contained a specific query \r\n** parameter, and if so obtains the value of that query parameter.\r\n**\r\n** If F is the database filename pointer passed into the xOpen() method of \r\n** a VFS implementation when the flags parameter to xOpen() has one or \r\n** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and\r\n** P is the name of the query parameter, then\r\n** sqlite3_uri_parameter(F,P) returns the value of the P\r\n** parameter if it exists or a NULL pointer if P does not appear as a \r\n** query parameter on F.  If P is a query parameter of F\r\n** has no explicit value, then sqlite3_uri_parameter(F,P) returns\r\n** a pointer to an empty string.\r\n**\r\n** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean\r\n** parameter and returns true (1) or false (0) according to the value\r\n** of P.  The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the\r\n** value of query parameter P is one of \"yes\", \"true\", or \"on\" in any\r\n** case or if the value begins with a non-zero number.  The \r\n** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of\r\n** query parameter P is one of \"no\", \"false\", or \"off\" in any case or\r\n** if the value begins with a numeric zero.  If P is not a query\r\n** parameter on F or if the value of P is does not match any of the\r\n** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).\r\n**\r\n** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a\r\n** 64-bit signed integer and returns that integer, or D if P does not\r\n** exist.  If the value of P is something other than an integer, then\r\n** zero is returned.\r\n** \r\n** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and\r\n** sqlite3_uri_boolean(F,P,B) returns B.  If F is not a NULL pointer and\r\n** is not a database file pathname pointer that SQLite passed into the xOpen\r\n** VFS method, then the behavior of this routine is undefined and probably\r\n** undesirable.\r\n*/\r\nSQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);\r\nSQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);\r\nSQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);\r\n\r\n\r\n/*\r\n** CAPI3REF: Error Codes And Messages\r\n**\r\n** ^The sqlite3_errcode() interface returns the numeric [result code] or\r\n** [extended result code] for the most recent failed sqlite3_* API call\r\n** associated with a [database connection]. If a prior API call failed\r\n** but the most recent API call succeeded, the return value from\r\n** sqlite3_errcode() is undefined.  ^The sqlite3_extended_errcode()\r\n** interface is the same except that it always returns the \r\n** [extended result code] even when extended result codes are\r\n** disabled.\r\n**\r\n** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language\r\n** text that describes the error, as either UTF-8 or UTF-16 respectively.\r\n** ^(Memory to hold the error message string is managed internally.\r\n** The application does not need to worry about freeing the result.\r\n** However, the error string might be overwritten or deallocated by\r\n** subsequent calls to other SQLite interface functions.)^\r\n**\r\n** When the serialized [threading mode] is in use, it might be the\r\n** case that a second error occurs on a separate thread in between\r\n** the time of the first error and the call to these interfaces.\r\n** When that happens, the second error will be reported since these\r\n** interfaces always report the most recent result.  To avoid\r\n** this, each thread can obtain exclusive use of the [database connection] D\r\n** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning\r\n** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after\r\n** all calls to the interfaces listed here are completed.\r\n**\r\n** If an interface fails with SQLITE_MISUSE, that means the interface\r\n** was invoked incorrectly by the application.  In that case, the\r\n** error code and message may or may not be set.\r\n*/\r\nSQLITE_API int sqlite3_errcode(sqlite3 *db);\r\nSQLITE_API int sqlite3_extended_errcode(sqlite3 *db);\r\nSQLITE_API const char *sqlite3_errmsg(sqlite3*);\r\nSQLITE_API const void *sqlite3_errmsg16(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: SQL Statement Object\r\n** KEYWORDS: {prepared statement} {prepared statements}\r\n**\r\n** An instance of this object represents a single SQL statement.\r\n** This object is variously known as a \"prepared statement\" or a\r\n** \"compiled SQL statement\" or simply as a \"statement\".\r\n**\r\n** The life of a statement object goes something like this:\r\n**\r\n** <ol>\r\n** <li> Create the object using [sqlite3_prepare_v2()] or a related\r\n**      function.\r\n** <li> Bind values to [host parameters] using the sqlite3_bind_*()\r\n**      interfaces.\r\n** <li> Run the SQL by calling [sqlite3_step()] one or more times.\r\n** <li> Reset the statement using [sqlite3_reset()] then go back\r\n**      to step 2.  Do this zero or more times.\r\n** <li> Destroy the object using [sqlite3_finalize()].\r\n** </ol>\r\n**\r\n** Refer to documentation on individual methods above for additional\r\n** information.\r\n*/\r\ntypedef struct sqlite3_stmt sqlite3_stmt;\r\n\r\n/*\r\n** CAPI3REF: Run-time Limits\r\n**\r\n** ^(This interface allows the size of various constructs to be limited\r\n** on a connection by connection basis.  The first parameter is the\r\n** [database connection] whose limit is to be set or queried.  The\r\n** second parameter is one of the [limit categories] that define a\r\n** class of constructs to be size limited.  The third parameter is the\r\n** new limit for that construct.)^\r\n**\r\n** ^If the new limit is a negative number, the limit is unchanged.\r\n** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a \r\n** [limits | hard upper bound]\r\n** set at compile-time by a C preprocessor macro called\r\n** [limits | SQLITE_MAX_<i>NAME</i>].\r\n** (The \"_LIMIT_\" in the name is changed to \"_MAX_\".))^\r\n** ^Attempts to increase a limit above its hard upper bound are\r\n** silently truncated to the hard upper bound.\r\n**\r\n** ^Regardless of whether or not the limit was changed, the \r\n** [sqlite3_limit()] interface returns the prior value of the limit.\r\n** ^Hence, to find the current value of a limit without changing it,\r\n** simply invoke this interface with the third parameter set to -1.\r\n**\r\n** Run-time limits are intended for use in applications that manage\r\n** both their own internal database and also databases that are controlled\r\n** by untrusted external sources.  An example application might be a\r\n** web browser that has its own databases for storing history and\r\n** separate databases controlled by JavaScript applications downloaded\r\n** off the Internet.  The internal databases can be given the\r\n** large, default limits.  Databases managed by external sources can\r\n** be given much smaller limits designed to prevent a denial of service\r\n** attack.  Developers might also want to use the [sqlite3_set_authorizer()]\r\n** interface to further control untrusted SQL.  The size of the database\r\n** created by an untrusted script can be contained using the\r\n** [max_page_count] [PRAGMA].\r\n**\r\n** New run-time limit categories may be added in future releases.\r\n*/\r\nSQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);\r\n\r\n/*\r\n** CAPI3REF: Run-Time Limit Categories\r\n** KEYWORDS: {limit category} {*limit categories}\r\n**\r\n** These constants define various performance limits\r\n** that can be lowered at run-time using [sqlite3_limit()].\r\n** The synopsis of the meanings of the various limits is shown below.\r\n** Additional information is available at [limits | Limits in SQLite].\r\n**\r\n** <dl>\r\n** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>\r\n** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^\r\n**\r\n** [[SQLITE_LIMIT_SQL_LENGTH]] ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>\r\n** <dd>The maximum length of an SQL statement, in bytes.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_COLUMN]] ^(<dt>SQLITE_LIMIT_COLUMN</dt>\r\n** <dd>The maximum number of columns in a table definition or in the\r\n** result set of a [SELECT] or the maximum number of columns in an index\r\n** or in an ORDER BY or GROUP BY clause.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>\r\n** <dd>The maximum depth of the parse tree on any expression.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>\r\n** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>\r\n** <dd>The maximum number of instructions in a virtual machine program\r\n** used to implement an SQL statement.  This limit is not currently\r\n** enforced, though that might be added in some future release of\r\n** SQLite.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>\r\n** <dd>The maximum number of arguments on a function.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_ATTACHED]] ^(<dt>SQLITE_LIMIT_ATTACHED</dt>\r\n** <dd>The maximum number of [ATTACH | attached databases].)^</dd>\r\n**\r\n** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]\r\n** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>\r\n** <dd>The maximum length of the pattern argument to the [LIKE] or\r\n** [GLOB] operators.</dd>)^\r\n**\r\n** [[SQLITE_LIMIT_VARIABLE_NUMBER]]\r\n** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>\r\n** <dd>The maximum index number of any [parameter] in an SQL statement.)^\r\n**\r\n** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>\r\n** <dd>The maximum depth of recursion for triggers.</dd>)^\r\n** </dl>\r\n*/\r\n#define SQLITE_LIMIT_LENGTH                    0\r\n#define SQLITE_LIMIT_SQL_LENGTH                1\r\n#define SQLITE_LIMIT_COLUMN                    2\r\n#define SQLITE_LIMIT_EXPR_DEPTH                3\r\n#define SQLITE_LIMIT_COMPOUND_SELECT           4\r\n#define SQLITE_LIMIT_VDBE_OP                   5\r\n#define SQLITE_LIMIT_FUNCTION_ARG              6\r\n#define SQLITE_LIMIT_ATTACHED                  7\r\n#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8\r\n#define SQLITE_LIMIT_VARIABLE_NUMBER           9\r\n#define SQLITE_LIMIT_TRIGGER_DEPTH            10\r\n\r\n/*\r\n** CAPI3REF: Compiling An SQL Statement\r\n** KEYWORDS: {SQL statement compiler}\r\n**\r\n** To execute an SQL query, it must first be compiled into a byte-code\r\n** program using one of these routines.\r\n**\r\n** The first argument, \"db\", is a [database connection] obtained from a\r\n** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or\r\n** [sqlite3_open16()].  The database connection must not have been closed.\r\n**\r\n** The second argument, \"zSql\", is the statement to be compiled, encoded\r\n** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()\r\n** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()\r\n** use UTF-16.\r\n**\r\n** ^If the nByte argument is less than zero, then zSql is read up to the\r\n** first zero terminator. ^If nByte is non-negative, then it is the maximum\r\n** number of  bytes read from zSql.  ^When nByte is non-negative, the\r\n** zSql string ends at either the first '\\000' or '\\u0000' character or\r\n** the nByte-th byte, whichever comes first. If the caller knows\r\n** that the supplied string is nul-terminated, then there is a small\r\n** performance advantage to be gained by passing an nByte parameter that\r\n** is equal to the number of bytes in the input string <i>including</i>\r\n** the nul-terminator bytes as this saves SQLite from having to\r\n** make a copy of the input string.\r\n**\r\n** ^If pzTail is not NULL then *pzTail is made to point to the first byte\r\n** past the end of the first SQL statement in zSql.  These routines only\r\n** compile the first statement in zSql, so *pzTail is left pointing to\r\n** what remains uncompiled.\r\n**\r\n** ^*ppStmt is left pointing to a compiled [prepared statement] that can be\r\n** executed using [sqlite3_step()].  ^If there is an error, *ppStmt is set\r\n** to NULL.  ^If the input text contains no SQL (if the input is an empty\r\n** string or a comment) then *ppStmt is set to NULL.\r\n** The calling procedure is responsible for deleting the compiled\r\n** SQL statement using [sqlite3_finalize()] after it has finished with it.\r\n** ppStmt may not be NULL.\r\n**\r\n** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];\r\n** otherwise an [error code] is returned.\r\n**\r\n** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are\r\n** recommended for all new programs. The two older interfaces are retained\r\n** for backwards compatibility, but their use is discouraged.\r\n** ^In the \"v2\" interfaces, the prepared statement\r\n** that is returned (the [sqlite3_stmt] object) contains a copy of the\r\n** original SQL text. This causes the [sqlite3_step()] interface to\r\n** behave differently in three ways:\r\n**\r\n** <ol>\r\n** <li>\r\n** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it\r\n** always used to do, [sqlite3_step()] will automatically recompile the SQL\r\n** statement and try to run it again.\r\n** </li>\r\n**\r\n** <li>\r\n** ^When an error occurs, [sqlite3_step()] will return one of the detailed\r\n** [error codes] or [extended error codes].  ^The legacy behavior was that\r\n** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code\r\n** and the application would have to make a second call to [sqlite3_reset()]\r\n** in order to find the underlying cause of the problem. With the \"v2\" prepare\r\n** interfaces, the underlying reason for the error is returned immediately.\r\n** </li>\r\n**\r\n** <li>\r\n** ^If the specific value bound to [parameter | host parameter] in the \r\n** WHERE clause might influence the choice of query plan for a statement,\r\n** then the statement will be automatically recompiled, as if there had been \r\n** a schema change, on the first  [sqlite3_step()] call following any change\r\n** to the [sqlite3_bind_text | bindings] of that [parameter]. \r\n** ^The specific value of WHERE-clause [parameter] might influence the \r\n** choice of query plan if the parameter is the left-hand side of a [LIKE]\r\n** or [GLOB] operator or if the parameter is compared to an indexed column\r\n** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.\r\n** the \r\n** </li>\r\n** </ol>\r\n*/\r\nSQLITE_API int sqlite3_prepare(\r\n  sqlite3 *db,            /* Database handle */\r\n  const char *zSql,       /* SQL statement, UTF-8 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const char **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\nSQLITE_API int sqlite3_prepare_v2(\r\n  sqlite3 *db,            /* Database handle */\r\n  const char *zSql,       /* SQL statement, UTF-8 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const char **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\nSQLITE_API int sqlite3_prepare16(\r\n  sqlite3 *db,            /* Database handle */\r\n  const void *zSql,       /* SQL statement, UTF-16 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const void **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\nSQLITE_API int sqlite3_prepare16_v2(\r\n  sqlite3 *db,            /* Database handle */\r\n  const void *zSql,       /* SQL statement, UTF-16 encoded */\r\n  int nByte,              /* Maximum length of zSql in bytes. */\r\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\r\n  const void **pzTail     /* OUT: Pointer to unused portion of zSql */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Retrieving Statement SQL\r\n**\r\n** ^This interface can be used to retrieve a saved copy of the original\r\n** SQL text used to create a [prepared statement] if that statement was\r\n** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].\r\n*/\r\nSQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Determine If An SQL Statement Writes The Database\r\n**\r\n** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if\r\n** and only if the [prepared statement] X makes no direct changes to\r\n** the content of the database file.\r\n**\r\n** Note that [application-defined SQL functions] or\r\n** [virtual tables] might change the database indirectly as a side effect.  \r\n** ^(For example, if an application defines a function \"eval()\" that \r\n** calls [sqlite3_exec()], then the following SQL statement would\r\n** change the database file through side-effects:\r\n**\r\n** <blockquote><pre>\r\n**    SELECT eval('DELETE FROM t1') FROM t2;\r\n** </pre></blockquote>\r\n**\r\n** But because the [SELECT] statement does not change the database file\r\n** directly, sqlite3_stmt_readonly() would still return true.)^\r\n**\r\n** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],\r\n** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,\r\n** since the statements themselves do not actually modify the database but\r\n** rather they control the timing of when other statements modify the \r\n** database.  ^The [ATTACH] and [DETACH] statements also cause\r\n** sqlite3_stmt_readonly() to return true since, while those statements\r\n** change the configuration of a database connection, they do not make \r\n** changes to the content of the database files on disk.\r\n*/\r\nSQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Determine If A Prepared Statement Has Been Reset\r\n**\r\n** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the\r\n** [prepared statement] S has been stepped at least once using \r\n** [sqlite3_step(S)] but has not run to completion and/or has not \r\n** been reset using [sqlite3_reset(S)].  ^The sqlite3_stmt_busy(S)\r\n** interface returns false if S is a NULL pointer.  If S is not a \r\n** NULL pointer and is not a pointer to a valid [prepared statement]\r\n** object, then the behavior is undefined and probably undesirable.\r\n**\r\n** This interface can be used in combination [sqlite3_next_stmt()]\r\n** to locate all prepared statements associated with a database \r\n** connection that are in need of being reset.  This can be used,\r\n** for example, in diagnostic routines to search for prepared \r\n** statements that are holding a transaction open.\r\n*/\r\nSQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Dynamically Typed Value Object\r\n** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}\r\n**\r\n** SQLite uses the sqlite3_value object to represent all values\r\n** that can be stored in a database table. SQLite uses dynamic typing\r\n** for the values it stores.  ^Values stored in sqlite3_value objects\r\n** can be integers, floating point values, strings, BLOBs, or NULL.\r\n**\r\n** An sqlite3_value object may be either \"protected\" or \"unprotected\".\r\n** Some interfaces require a protected sqlite3_value.  Other interfaces\r\n** will accept either a protected or an unprotected sqlite3_value.\r\n** Every interface that accepts sqlite3_value arguments specifies\r\n** whether or not it requires a protected sqlite3_value.\r\n**\r\n** The terms \"protected\" and \"unprotected\" refer to whether or not\r\n** a mutex is held.  An internal mutex is held for a protected\r\n** sqlite3_value object but no mutex is held for an unprotected\r\n** sqlite3_value object.  If SQLite is compiled to be single-threaded\r\n** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)\r\n** or if SQLite is run in one of reduced mutex modes \r\n** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]\r\n** then there is no distinction between protected and unprotected\r\n** sqlite3_value objects and they can be used interchangeably.  However,\r\n** for maximum code portability it is recommended that applications\r\n** still make the distinction between protected and unprotected\r\n** sqlite3_value objects even when not strictly required.\r\n**\r\n** ^The sqlite3_value objects that are passed as parameters into the\r\n** implementation of [application-defined SQL functions] are protected.\r\n** ^The sqlite3_value object returned by\r\n** [sqlite3_column_value()] is unprotected.\r\n** Unprotected sqlite3_value objects may only be used with\r\n** [sqlite3_result_value()] and [sqlite3_bind_value()].\r\n** The [sqlite3_value_blob | sqlite3_value_type()] family of\r\n** interfaces require protected sqlite3_value objects.\r\n*/\r\ntypedef struct Mem sqlite3_value;\r\n\r\n/*\r\n** CAPI3REF: SQL Function Context Object\r\n**\r\n** The context in which an SQL function executes is stored in an\r\n** sqlite3_context object.  ^A pointer to an sqlite3_context object\r\n** is always first parameter to [application-defined SQL functions].\r\n** The application-defined SQL function implementation will pass this\r\n** pointer through into calls to [sqlite3_result_int | sqlite3_result()],\r\n** [sqlite3_aggregate_context()], [sqlite3_user_data()],\r\n** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],\r\n** and/or [sqlite3_set_auxdata()].\r\n*/\r\ntypedef struct sqlite3_context sqlite3_context;\r\n\r\n/*\r\n** CAPI3REF: Binding Values To Prepared Statements\r\n** KEYWORDS: {host parameter} {host parameters} {host parameter name}\r\n** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}\r\n**\r\n** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,\r\n** literals may be replaced by a [parameter] that matches one of following\r\n** templates:\r\n**\r\n** <ul>\r\n** <li>  ?\r\n** <li>  ?NNN\r\n** <li>  :VVV\r\n** <li>  @VVV\r\n** <li>  $VVV\r\n** </ul>\r\n**\r\n** In the templates above, NNN represents an integer literal,\r\n** and VVV represents an alphanumeric identifier.)^  ^The values of these\r\n** parameters (also called \"host parameter names\" or \"SQL parameters\")\r\n** can be set using the sqlite3_bind_*() routines defined here.\r\n**\r\n** ^The first argument to the sqlite3_bind_*() routines is always\r\n** a pointer to the [sqlite3_stmt] object returned from\r\n** [sqlite3_prepare_v2()] or its variants.\r\n**\r\n** ^The second argument is the index of the SQL parameter to be set.\r\n** ^The leftmost SQL parameter has an index of 1.  ^When the same named\r\n** SQL parameter is used more than once, second and subsequent\r\n** occurrences have the same index as the first occurrence.\r\n** ^The index for named parameters can be looked up using the\r\n** [sqlite3_bind_parameter_index()] API if desired.  ^The index\r\n** for \"?NNN\" parameters is the value of NNN.\r\n** ^The NNN value must be between 1 and the [sqlite3_limit()]\r\n** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).\r\n**\r\n** ^The third argument is the value to bind to the parameter.\r\n**\r\n** ^(In those routines that have a fourth argument, its value is the\r\n** number of bytes in the parameter.  To be clear: the value is the\r\n** number of <u>bytes</u> in the value, not the number of characters.)^\r\n** ^If the fourth parameter is negative, the length of the string is\r\n** the number of bytes up to the first zero terminator.\r\n** If a non-negative fourth parameter is provided to sqlite3_bind_text()\r\n** or sqlite3_bind_text16() then that parameter must be the byte offset\r\n** where the NUL terminator would occur assuming the string were NUL\r\n** terminated.  If any NUL characters occur at byte offsets less than \r\n** the value of the fourth parameter then the resulting string value will\r\n** contain embedded NULs.  The result of expressions involving strings\r\n** with embedded NULs is undefined.\r\n**\r\n** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and\r\n** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or\r\n** string after SQLite has finished with it.  ^The destructor is called\r\n** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(),\r\n** sqlite3_bind_text(), or sqlite3_bind_text16() fails.  \r\n** ^If the fifth argument is\r\n** the special value [SQLITE_STATIC], then SQLite assumes that the\r\n** information is in static, unmanaged space and does not need to be freed.\r\n** ^If the fifth argument has the value [SQLITE_TRANSIENT], then\r\n** SQLite makes its own private copy of the data immediately, before\r\n** the sqlite3_bind_*() routine returns.\r\n**\r\n** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that\r\n** is filled with zeroes.  ^A zeroblob uses a fixed amount of memory\r\n** (just an integer to hold its size) while it is being processed.\r\n** Zeroblobs are intended to serve as placeholders for BLOBs whose\r\n** content is later written using\r\n** [sqlite3_blob_open | incremental BLOB I/O] routines.\r\n** ^A negative value for the zeroblob results in a zero-length BLOB.\r\n**\r\n** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer\r\n** for the [prepared statement] or with a prepared statement for which\r\n** [sqlite3_step()] has been called more recently than [sqlite3_reset()],\r\n** then the call will return [SQLITE_MISUSE].  If any sqlite3_bind_()\r\n** routine is passed a [prepared statement] that has been finalized, the\r\n** result is undefined and probably harmful.\r\n**\r\n** ^Bindings are not cleared by the [sqlite3_reset()] routine.\r\n** ^Unbound parameters are interpreted as NULL.\r\n**\r\n** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an\r\n** [error code] if anything goes wrong.\r\n** ^[SQLITE_RANGE] is returned if the parameter\r\n** index is out of range.  ^[SQLITE_NOMEM] is returned if malloc() fails.\r\n**\r\n** See also: [sqlite3_bind_parameter_count()],\r\n** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));\r\nSQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);\r\nSQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);\r\nSQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);\r\nSQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);\r\nSQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));\r\nSQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));\r\nSQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);\r\nSQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);\r\n\r\n/*\r\n** CAPI3REF: Number Of SQL Parameters\r\n**\r\n** ^This routine can be used to find the number of [SQL parameters]\r\n** in a [prepared statement].  SQL parameters are tokens of the\r\n** form \"?\", \"?NNN\", \":AAA\", \"$AAA\", or \"@AAA\" that serve as\r\n** placeholders for values that are [sqlite3_bind_blob | bound]\r\n** to the parameters at a later time.\r\n**\r\n** ^(This routine actually returns the index of the largest (rightmost)\r\n** parameter. For all forms except ?NNN, this will correspond to the\r\n** number of unique parameters.  If parameters of the ?NNN form are used,\r\n** there may be gaps in the list.)^\r\n**\r\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\r\n** [sqlite3_bind_parameter_name()], and\r\n** [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Name Of A Host Parameter\r\n**\r\n** ^The sqlite3_bind_parameter_name(P,N) interface returns\r\n** the name of the N-th [SQL parameter] in the [prepared statement] P.\r\n** ^(SQL parameters of the form \"?NNN\" or \":AAA\" or \"@AAA\" or \"$AAA\"\r\n** have a name which is the string \"?NNN\" or \":AAA\" or \"@AAA\" or \"$AAA\"\r\n** respectively.\r\n** In other words, the initial \":\" or \"$\" or \"@\" or \"?\"\r\n** is included as part of the name.)^\r\n** ^Parameters of the form \"?\" without a following integer have no name\r\n** and are referred to as \"nameless\" or \"anonymous parameters\".\r\n**\r\n** ^The first host parameter has an index of 1, not 0.\r\n**\r\n** ^If the value N is out of range or if the N-th parameter is\r\n** nameless, then NULL is returned.  ^The returned string is\r\n** always in UTF-8 encoding even if the named parameter was\r\n** originally specified as UTF-16 in [sqlite3_prepare16()] or\r\n** [sqlite3_prepare16_v2()].\r\n**\r\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\r\n** [sqlite3_bind_parameter_count()], and\r\n** [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);\r\n\r\n/*\r\n** CAPI3REF: Index Of A Parameter With A Given Name\r\n**\r\n** ^Return the index of an SQL parameter given its name.  ^The\r\n** index value returned is suitable for use as the second\r\n** parameter to [sqlite3_bind_blob|sqlite3_bind()].  ^A zero\r\n** is returned if no matching parameter is found.  ^The parameter\r\n** name must be given in UTF-8 even if the original statement\r\n** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].\r\n**\r\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\r\n** [sqlite3_bind_parameter_count()], and\r\n** [sqlite3_bind_parameter_index()].\r\n*/\r\nSQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);\r\n\r\n/*\r\n** CAPI3REF: Reset All Bindings On A Prepared Statement\r\n**\r\n** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset\r\n** the [sqlite3_bind_blob | bindings] on a [prepared statement].\r\n** ^Use this routine to reset all host parameters to NULL.\r\n*/\r\nSQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Number Of Columns In A Result Set\r\n**\r\n** ^Return the number of columns in the result set returned by the\r\n** [prepared statement]. ^This routine returns 0 if pStmt is an SQL\r\n** statement that does not return data (for example an [UPDATE]).\r\n**\r\n** See also: [sqlite3_data_count()]\r\n*/\r\nSQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Column Names In A Result Set\r\n**\r\n** ^These routines return the name assigned to a particular column\r\n** in the result set of a [SELECT] statement.  ^The sqlite3_column_name()\r\n** interface returns a pointer to a zero-terminated UTF-8 string\r\n** and sqlite3_column_name16() returns a pointer to a zero-terminated\r\n** UTF-16 string.  ^The first parameter is the [prepared statement]\r\n** that implements the [SELECT] statement. ^The second parameter is the\r\n** column number.  ^The leftmost column is number 0.\r\n**\r\n** ^The returned string pointer is valid until either the [prepared statement]\r\n** is destroyed by [sqlite3_finalize()] or until the statement is automatically\r\n** reprepared by the first call to [sqlite3_step()] for a particular run\r\n** or until the next call to\r\n** sqlite3_column_name() or sqlite3_column_name16() on the same column.\r\n**\r\n** ^If sqlite3_malloc() fails during the processing of either routine\r\n** (for example during a conversion from UTF-8 to UTF-16) then a\r\n** NULL pointer is returned.\r\n**\r\n** ^The name of a result column is the value of the \"AS\" clause for\r\n** that column, if there is an AS clause.  If there is no AS clause\r\n** then the name of the column is unspecified and may change from\r\n** one release of SQLite to the next.\r\n*/\r\nSQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);\r\nSQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);\r\n\r\n/*\r\n** CAPI3REF: Source Of Data In A Query Result\r\n**\r\n** ^These routines provide a means to determine the database, table, and\r\n** table column that is the origin of a particular result column in\r\n** [SELECT] statement.\r\n** ^The name of the database or table or column can be returned as\r\n** either a UTF-8 or UTF-16 string.  ^The _database_ routines return\r\n** the database name, the _table_ routines return the table name, and\r\n** the origin_ routines return the column name.\r\n** ^The returned string is valid until the [prepared statement] is destroyed\r\n** using [sqlite3_finalize()] or until the statement is automatically\r\n** reprepared by the first call to [sqlite3_step()] for a particular run\r\n** or until the same information is requested\r\n** again in a different encoding.\r\n**\r\n** ^The names returned are the original un-aliased names of the\r\n** database, table, and column.\r\n**\r\n** ^The first argument to these interfaces is a [prepared statement].\r\n** ^These functions return information about the Nth result column returned by\r\n** the statement, where N is the second function argument.\r\n** ^The left-most column is column 0 for these routines.\r\n**\r\n** ^If the Nth column returned by the statement is an expression or\r\n** subquery and is not a column value, then all of these functions return\r\n** NULL.  ^These routine might also return NULL if a memory allocation error\r\n** occurs.  ^Otherwise, they return the name of the attached database, table,\r\n** or column that query result column was extracted from.\r\n**\r\n** ^As with all other SQLite APIs, those whose names end with \"16\" return\r\n** UTF-16 encoded strings and the other functions return UTF-8.\r\n**\r\n** ^These APIs are only available if the library was compiled with the\r\n** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.\r\n**\r\n** If two or more threads call one or more of these routines against the same\r\n** prepared statement and column at the same time then the results are\r\n** undefined.\r\n**\r\n** If two or more threads call one or more\r\n** [sqlite3_column_database_name | column metadata interfaces]\r\n** for the same [prepared statement] and result column\r\n** at the same time then the results are undefined.\r\n*/\r\nSQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);\r\nSQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);\r\nSQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);\r\n\r\n/*\r\n** CAPI3REF: Declared Datatype Of A Query Result\r\n**\r\n** ^(The first parameter is a [prepared statement].\r\n** If this statement is a [SELECT] statement and the Nth column of the\r\n** returned result set of that [SELECT] is a table column (not an\r\n** expression or subquery) then the declared type of the table\r\n** column is returned.)^  ^If the Nth column of the result set is an\r\n** expression or subquery, then a NULL pointer is returned.\r\n** ^The returned string is always UTF-8 encoded.\r\n**\r\n** ^(For example, given the database schema:\r\n**\r\n** CREATE TABLE t1(c1 VARIANT);\r\n**\r\n** and the following statement to be compiled:\r\n**\r\n** SELECT c1 + 1, c1 FROM t1;\r\n**\r\n** this routine would return the string \"VARIANT\" for the second result\r\n** column (i==1), and a NULL pointer for the first result column (i==0).)^\r\n**\r\n** ^SQLite uses dynamic run-time typing.  ^So just because a column\r\n** is declared to contain a particular type does not mean that the\r\n** data stored in that column is of the declared type.  SQLite is\r\n** strongly typed, but the typing is dynamic not static.  ^Type\r\n** is associated with individual values, not with the containers\r\n** used to hold those values.\r\n*/\r\nSQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);\r\nSQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);\r\n\r\n/*\r\n** CAPI3REF: Evaluate An SQL Statement\r\n**\r\n** After a [prepared statement] has been prepared using either\r\n** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy\r\n** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function\r\n** must be called one or more times to evaluate the statement.\r\n**\r\n** The details of the behavior of the sqlite3_step() interface depend\r\n** on whether the statement was prepared using the newer \"v2\" interface\r\n** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy\r\n** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the\r\n** new \"v2\" interface is recommended for new applications but the legacy\r\n** interface will continue to be supported.\r\n**\r\n** ^In the legacy interface, the return value will be either [SQLITE_BUSY],\r\n** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].\r\n** ^With the \"v2\" interface, any of the other [result codes] or\r\n** [extended result codes] might be returned as well.\r\n**\r\n** ^[SQLITE_BUSY] means that the database engine was unable to acquire the\r\n** database locks it needs to do its job.  ^If the statement is a [COMMIT]\r\n** or occurs outside of an explicit transaction, then you can retry the\r\n** statement.  If the statement is not a [COMMIT] and occurs within an\r\n** explicit transaction then you should rollback the transaction before\r\n** continuing.\r\n**\r\n** ^[SQLITE_DONE] means that the statement has finished executing\r\n** successfully.  sqlite3_step() should not be called again on this virtual\r\n** machine without first calling [sqlite3_reset()] to reset the virtual\r\n** machine back to its initial state.\r\n**\r\n** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]\r\n** is returned each time a new row of data is ready for processing by the\r\n** caller. The values may be accessed using the [column access functions].\r\n** sqlite3_step() is called again to retrieve the next row of data.\r\n**\r\n** ^[SQLITE_ERROR] means that a run-time error (such as a constraint\r\n** violation) has occurred.  sqlite3_step() should not be called again on\r\n** the VM. More information may be found by calling [sqlite3_errmsg()].\r\n** ^With the legacy interface, a more specific error code (for example,\r\n** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)\r\n** can be obtained by calling [sqlite3_reset()] on the\r\n** [prepared statement].  ^In the \"v2\" interface,\r\n** the more specific error code is returned directly by sqlite3_step().\r\n**\r\n** [SQLITE_MISUSE] means that the this routine was called inappropriately.\r\n** Perhaps it was called on a [prepared statement] that has\r\n** already been [sqlite3_finalize | finalized] or on one that had\r\n** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could\r\n** be the case that the same database connection is being used by two or\r\n** more threads at the same moment in time.\r\n**\r\n** For all versions of SQLite up to and including 3.6.23.1, a call to\r\n** [sqlite3_reset()] was required after sqlite3_step() returned anything\r\n** other than [SQLITE_ROW] before any subsequent invocation of\r\n** sqlite3_step().  Failure to reset the prepared statement using \r\n** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from\r\n** sqlite3_step().  But after version 3.6.23.1, sqlite3_step() began\r\n** calling [sqlite3_reset()] automatically in this circumstance rather\r\n** than returning [SQLITE_MISUSE].  This is not considered a compatibility\r\n** break because any application that ever receives an SQLITE_MISUSE error\r\n** is broken by definition.  The [SQLITE_OMIT_AUTORESET] compile-time option\r\n** can be used to restore the legacy behavior.\r\n**\r\n** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()\r\n** API always returns a generic error code, [SQLITE_ERROR], following any\r\n** error other than [SQLITE_BUSY] and [SQLITE_MISUSE].  You must call\r\n** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the\r\n** specific [error codes] that better describes the error.\r\n** We admit that this is a goofy design.  The problem has been fixed\r\n** with the \"v2\" interface.  If you prepare all of your SQL statements\r\n** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead\r\n** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,\r\n** then the more specific [error codes] are returned directly\r\n** by sqlite3_step().  The use of the \"v2\" interface is recommended.\r\n*/\r\nSQLITE_API int sqlite3_step(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Number of columns in a result set\r\n**\r\n** ^The sqlite3_data_count(P) interface returns the number of columns in the\r\n** current row of the result set of [prepared statement] P.\r\n** ^If prepared statement P does not have results ready to return\r\n** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of\r\n** interfaces) then sqlite3_data_count(P) returns 0.\r\n** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.\r\n** ^The sqlite3_data_count(P) routine returns 0 if the previous call to\r\n** [sqlite3_step](P) returned [SQLITE_DONE].  ^The sqlite3_data_count(P)\r\n** will return non-zero if previous call to [sqlite3_step](P) returned\r\n** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]\r\n** where it always returns zero since each step of that multi-step\r\n** pragma returns 0 columns of data.\r\n**\r\n** See also: [sqlite3_column_count()]\r\n*/\r\nSQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Fundamental Datatypes\r\n** KEYWORDS: SQLITE_TEXT\r\n**\r\n** ^(Every value in SQLite has one of five fundamental datatypes:\r\n**\r\n** <ul>\r\n** <li> 64-bit signed integer\r\n** <li> 64-bit IEEE floating point number\r\n** <li> string\r\n** <li> BLOB\r\n** <li> NULL\r\n** </ul>)^\r\n**\r\n** These constants are codes for each of those types.\r\n**\r\n** Note that the SQLITE_TEXT constant was also used in SQLite version 2\r\n** for a completely different meaning.  Software that links against both\r\n** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not\r\n** SQLITE_TEXT.\r\n*/\r\n#define SQLITE_INTEGER  1\r\n#define SQLITE_FLOAT    2\r\n#define SQLITE_BLOB     4\r\n#define SQLITE_NULL     5\r\n#ifdef SQLITE_TEXT\r\n# undef SQLITE_TEXT\r\n#else\r\n# define SQLITE_TEXT     3\r\n#endif\r\n#define SQLITE3_TEXT     3\r\n\r\n/*\r\n** CAPI3REF: Result Values From A Query\r\n** KEYWORDS: {column access functions}\r\n**\r\n** These routines form the \"result set\" interface.\r\n**\r\n** ^These routines return information about a single column of the current\r\n** result row of a query.  ^In every case the first argument is a pointer\r\n** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]\r\n** that was returned from [sqlite3_prepare_v2()] or one of its variants)\r\n** and the second argument is the index of the column for which information\r\n** should be returned. ^The leftmost column of the result set has the index 0.\r\n** ^The number of columns in the result can be determined using\r\n** [sqlite3_column_count()].\r\n**\r\n** If the SQL statement does not currently point to a valid row, or if the\r\n** column index is out of range, the result is undefined.\r\n** These routines may only be called when the most recent call to\r\n** [sqlite3_step()] has returned [SQLITE_ROW] and neither\r\n** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.\r\n** If any of these routines are called after [sqlite3_reset()] or\r\n** [sqlite3_finalize()] or after [sqlite3_step()] has returned\r\n** something other than [SQLITE_ROW], the results are undefined.\r\n** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]\r\n** are called from a different thread while any of these routines\r\n** are pending, then the results are undefined.\r\n**\r\n** ^The sqlite3_column_type() routine returns the\r\n** [SQLITE_INTEGER | datatype code] for the initial data type\r\n** of the result column.  ^The returned value is one of [SQLITE_INTEGER],\r\n** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value\r\n** returned by sqlite3_column_type() is only meaningful if no type\r\n** conversions have occurred as described below.  After a type conversion,\r\n** the value returned by sqlite3_column_type() is undefined.  Future\r\n** versions of SQLite may change the behavior of sqlite3_column_type()\r\n** following a type conversion.\r\n**\r\n** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()\r\n** routine returns the number of bytes in that BLOB or string.\r\n** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts\r\n** the string to UTF-8 and then returns the number of bytes.\r\n** ^If the result is a numeric value then sqlite3_column_bytes() uses\r\n** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns\r\n** the number of bytes in that string.\r\n** ^If the result is NULL, then sqlite3_column_bytes() returns zero.\r\n**\r\n** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()\r\n** routine returns the number of bytes in that BLOB or string.\r\n** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts\r\n** the string to UTF-16 and then returns the number of bytes.\r\n** ^If the result is a numeric value then sqlite3_column_bytes16() uses\r\n** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns\r\n** the number of bytes in that string.\r\n** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.\r\n**\r\n** ^The values returned by [sqlite3_column_bytes()] and \r\n** [sqlite3_column_bytes16()] do not include the zero terminators at the end\r\n** of the string.  ^For clarity: the values returned by\r\n** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of\r\n** bytes in the string, not the number of characters.\r\n**\r\n** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),\r\n** even empty strings, are always zero-terminated.  ^The return\r\n** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.\r\n**\r\n** ^The object returned by [sqlite3_column_value()] is an\r\n** [unprotected sqlite3_value] object.  An unprotected sqlite3_value object\r\n** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].\r\n** If the [unprotected sqlite3_value] object returned by\r\n** [sqlite3_column_value()] is used in any other way, including calls\r\n** to routines like [sqlite3_value_int()], [sqlite3_value_text()],\r\n** or [sqlite3_value_bytes()], then the behavior is undefined.\r\n**\r\n** These routines attempt to convert the value where appropriate.  ^For\r\n** example, if the internal representation is FLOAT and a text result\r\n** is requested, [sqlite3_snprintf()] is used internally to perform the\r\n** conversion automatically.  ^(The following table details the conversions\r\n** that are applied:\r\n**\r\n** <blockquote>\r\n** <table border=\"1\">\r\n** <tr><th> Internal<br>Type <th> Requested<br>Type <th>  Conversion\r\n**\r\n** <tr><td>  NULL    <td> INTEGER   <td> Result is 0\r\n** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0\r\n** <tr><td>  NULL    <td>   TEXT    <td> Result is NULL pointer\r\n** <tr><td>  NULL    <td>   BLOB    <td> Result is NULL pointer\r\n** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float\r\n** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer\r\n** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT\r\n** <tr><td>  FLOAT   <td> INTEGER   <td> Convert from float to integer\r\n** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float\r\n** <tr><td>  FLOAT   <td>   BLOB    <td> Same as FLOAT->TEXT\r\n** <tr><td>  TEXT    <td> INTEGER   <td> Use atoi()\r\n** <tr><td>  TEXT    <td>  FLOAT    <td> Use atof()\r\n** <tr><td>  TEXT    <td>   BLOB    <td> No change\r\n** <tr><td>  BLOB    <td> INTEGER   <td> Convert to TEXT then use atoi()\r\n** <tr><td>  BLOB    <td>  FLOAT    <td> Convert to TEXT then use atof()\r\n** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed\r\n** </table>\r\n** </blockquote>)^\r\n**\r\n** The table above makes reference to standard C library functions atoi()\r\n** and atof().  SQLite does not really use these functions.  It has its\r\n** own equivalent internal routines.  The atoi() and atof() names are\r\n** used in the table for brevity and because they are familiar to most\r\n** C programmers.\r\n**\r\n** Note that when type conversions occur, pointers returned by prior\r\n** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or\r\n** sqlite3_column_text16() may be invalidated.\r\n** Type conversions and pointer invalidations might occur\r\n** in the following cases:\r\n**\r\n** <ul>\r\n** <li> The initial content is a BLOB and sqlite3_column_text() or\r\n**      sqlite3_column_text16() is called.  A zero-terminator might\r\n**      need to be added to the string.</li>\r\n** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or\r\n**      sqlite3_column_text16() is called.  The content must be converted\r\n**      to UTF-16.</li>\r\n** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or\r\n**      sqlite3_column_text() is called.  The content must be converted\r\n**      to UTF-8.</li>\r\n** </ul>\r\n**\r\n** ^Conversions between UTF-16be and UTF-16le are always done in place and do\r\n** not invalidate a prior pointer, though of course the content of the buffer\r\n** that the prior pointer references will have been modified.  Other kinds\r\n** of conversion are done in place when it is possible, but sometimes they\r\n** are not possible and in those cases prior pointers are invalidated.\r\n**\r\n** The safest and easiest to remember policy is to invoke these routines\r\n** in one of the following ways:\r\n**\r\n** <ul>\r\n**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>\r\n**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>\r\n**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>\r\n** </ul>\r\n**\r\n** In other words, you should call sqlite3_column_text(),\r\n** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result\r\n** into the desired format, then invoke sqlite3_column_bytes() or\r\n** sqlite3_column_bytes16() to find the size of the result.  Do not mix calls\r\n** to sqlite3_column_text() or sqlite3_column_blob() with calls to\r\n** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()\r\n** with calls to sqlite3_column_bytes().\r\n**\r\n** ^The pointers returned are valid until a type conversion occurs as\r\n** described above, or until [sqlite3_step()] or [sqlite3_reset()] or\r\n** [sqlite3_finalize()] is called.  ^The memory space used to hold strings\r\n** and BLOBs is freed automatically.  Do <b>not</b> pass the pointers returned\r\n** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into\r\n** [sqlite3_free()].\r\n**\r\n** ^(If a memory allocation error occurs during the evaluation of any\r\n** of these routines, a default value is returned.  The default value\r\n** is either the integer 0, the floating point number 0.0, or a NULL\r\n** pointer.  Subsequent calls to [sqlite3_errcode()] will return\r\n** [SQLITE_NOMEM].)^\r\n*/\r\nSQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);\r\nSQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);\r\nSQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);\r\nSQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);\r\nSQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);\r\nSQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);\r\nSQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);\r\n\r\n/*\r\n** CAPI3REF: Destroy A Prepared Statement Object\r\n**\r\n** ^The sqlite3_finalize() function is called to delete a [prepared statement].\r\n** ^If the most recent evaluation of the statement encountered no errors\r\n** or if the statement is never been evaluated, then sqlite3_finalize() returns\r\n** SQLITE_OK.  ^If the most recent evaluation of statement S failed, then\r\n** sqlite3_finalize(S) returns the appropriate [error code] or\r\n** [extended error code].\r\n**\r\n** ^The sqlite3_finalize(S) routine can be called at any point during\r\n** the life cycle of [prepared statement] S:\r\n** before statement S is ever evaluated, after\r\n** one or more calls to [sqlite3_reset()], or after any call\r\n** to [sqlite3_step()] regardless of whether or not the statement has\r\n** completed execution.\r\n**\r\n** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.\r\n**\r\n** The application must finalize every [prepared statement] in order to avoid\r\n** resource leaks.  It is a grievous error for the application to try to use\r\n** a prepared statement after it has been finalized.  Any use of a prepared\r\n** statement after it has been finalized can result in undefined and\r\n** undesirable behavior such as segfaults and heap corruption.\r\n*/\r\nSQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Reset A Prepared Statement Object\r\n**\r\n** The sqlite3_reset() function is called to reset a [prepared statement]\r\n** object back to its initial state, ready to be re-executed.\r\n** ^Any SQL statement variables that had values bound to them using\r\n** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.\r\n** Use [sqlite3_clear_bindings()] to reset the bindings.\r\n**\r\n** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S\r\n** back to the beginning of its program.\r\n**\r\n** ^If the most recent call to [sqlite3_step(S)] for the\r\n** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],\r\n** or if [sqlite3_step(S)] has never before been called on S,\r\n** then [sqlite3_reset(S)] returns [SQLITE_OK].\r\n**\r\n** ^If the most recent call to [sqlite3_step(S)] for the\r\n** [prepared statement] S indicated an error, then\r\n** [sqlite3_reset(S)] returns an appropriate [error code].\r\n**\r\n** ^The [sqlite3_reset(S)] interface does not change the values\r\n** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.\r\n*/\r\nSQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Create Or Redefine SQL Functions\r\n** KEYWORDS: {function creation routines}\r\n** KEYWORDS: {application-defined SQL function}\r\n** KEYWORDS: {application-defined SQL functions}\r\n**\r\n** ^These functions (collectively known as \"function creation routines\")\r\n** are used to add SQL functions or aggregates or to redefine the behavior\r\n** of existing SQL functions or aggregates.  The only differences between\r\n** these routines are the text encoding expected for\r\n** the second parameter (the name of the function being created)\r\n** and the presence or absence of a destructor callback for\r\n** the application data pointer.\r\n**\r\n** ^The first parameter is the [database connection] to which the SQL\r\n** function is to be added.  ^If an application uses more than one database\r\n** connection then application-defined SQL functions must be added\r\n** to each database connection separately.\r\n**\r\n** ^The second parameter is the name of the SQL function to be created or\r\n** redefined.  ^The length of the name is limited to 255 bytes in a UTF-8\r\n** representation, exclusive of the zero-terminator.  ^Note that the name\r\n** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.  \r\n** ^Any attempt to create a function with a longer name\r\n** will result in [SQLITE_MISUSE] being returned.\r\n**\r\n** ^The third parameter (nArg)\r\n** is the number of arguments that the SQL function or\r\n** aggregate takes. ^If this parameter is -1, then the SQL function or\r\n** aggregate may take any number of arguments between 0 and the limit\r\n** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]).  If the third\r\n** parameter is less than -1 or greater than 127 then the behavior is\r\n** undefined.\r\n**\r\n** ^The fourth parameter, eTextRep, specifies what\r\n** [SQLITE_UTF8 | text encoding] this SQL function prefers for\r\n** its parameters.  Every SQL function implementation must be able to work\r\n** with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be\r\n** more efficient with one encoding than another.  ^An application may\r\n** invoke sqlite3_create_function() or sqlite3_create_function16() multiple\r\n** times with the same function but with different values of eTextRep.\r\n** ^When multiple implementations of the same function are available, SQLite\r\n** will pick the one that involves the least amount of data conversion.\r\n** If there is only a single implementation which does not care what text\r\n** encoding is used, then the fourth argument should be [SQLITE_ANY].\r\n**\r\n** ^(The fifth parameter is an arbitrary pointer.  The implementation of the\r\n** function can gain access to this pointer using [sqlite3_user_data()].)^\r\n**\r\n** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are\r\n** pointers to C-language functions that implement the SQL function or\r\n** aggregate. ^A scalar SQL function requires an implementation of the xFunc\r\n** callback only; NULL pointers must be passed as the xStep and xFinal\r\n** parameters. ^An aggregate SQL function requires an implementation of xStep\r\n** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing\r\n** SQL function or aggregate, pass NULL pointers for all three function\r\n** callbacks.\r\n**\r\n** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,\r\n** then it is destructor for the application data pointer. \r\n** The destructor is invoked when the function is deleted, either by being\r\n** overloaded or when the database connection closes.)^\r\n** ^The destructor is also invoked if the call to\r\n** sqlite3_create_function_v2() fails.\r\n** ^When the destructor callback of the tenth parameter is invoked, it\r\n** is passed a single argument which is a copy of the application data \r\n** pointer which was the fifth parameter to sqlite3_create_function_v2().\r\n**\r\n** ^It is permitted to register multiple implementations of the same\r\n** functions with the same name but with either differing numbers of\r\n** arguments or differing preferred text encodings.  ^SQLite will use\r\n** the implementation that most closely matches the way in which the\r\n** SQL function is used.  ^A function implementation with a non-negative\r\n** nArg parameter is a better match than a function implementation with\r\n** a negative nArg.  ^A function where the preferred text encoding\r\n** matches the database encoding is a better\r\n** match than a function where the encoding is different.  \r\n** ^A function where the encoding difference is between UTF16le and UTF16be\r\n** is a closer match than a function where the encoding difference is\r\n** between UTF8 and UTF16.\r\n**\r\n** ^Built-in functions may be overloaded by new application-defined functions.\r\n**\r\n** ^An application-defined function is permitted to call other\r\n** SQLite interfaces.  However, such calls must not\r\n** close the database connection nor finalize or reset the prepared\r\n** statement in which the function is running.\r\n*/\r\nSQLITE_API int sqlite3_create_function(\r\n  sqlite3 *db,\r\n  const char *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *pApp,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*)\r\n);\r\nSQLITE_API int sqlite3_create_function16(\r\n  sqlite3 *db,\r\n  const void *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *pApp,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*)\r\n);\r\nSQLITE_API int sqlite3_create_function_v2(\r\n  sqlite3 *db,\r\n  const char *zFunctionName,\r\n  int nArg,\r\n  int eTextRep,\r\n  void *pApp,\r\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n  void (*xFinal)(sqlite3_context*),\r\n  void(*xDestroy)(void*)\r\n);\r\n\r\n/*\r\n** CAPI3REF: Text Encodings\r\n**\r\n** These constant define integer codes that represent the various\r\n** text encodings supported by SQLite.\r\n*/\r\n#define SQLITE_UTF8           1\r\n#define SQLITE_UTF16LE        2\r\n#define SQLITE_UTF16BE        3\r\n#define SQLITE_UTF16          4    /* Use native byte order */\r\n#define SQLITE_ANY            5    /* sqlite3_create_function only */\r\n#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */\r\n\r\n/*\r\n** CAPI3REF: Deprecated Functions\r\n** DEPRECATED\r\n**\r\n** These functions are [deprecated].  In order to maintain\r\n** backwards compatibility with older code, these functions continue \r\n** to be supported.  However, new applications should avoid\r\n** the use of these functions.  To help encourage people to avoid\r\n** using these functions, we are not going to tell you what they do.\r\n*/\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);\r\nSQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);\r\nSQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Obtaining SQL Function Parameter Values\r\n**\r\n** The C-language implementation of SQL functions and aggregates uses\r\n** this set of interface routines to access the parameter values on\r\n** the function or aggregate.\r\n**\r\n** The xFunc (for scalar functions) or xStep (for aggregates) parameters\r\n** to [sqlite3_create_function()] and [sqlite3_create_function16()]\r\n** define callbacks that implement the SQL functions and aggregates.\r\n** The 3rd parameter to these callbacks is an array of pointers to\r\n** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for\r\n** each parameter to the SQL function.  These routines are used to\r\n** extract values from the [sqlite3_value] objects.\r\n**\r\n** These routines work only with [protected sqlite3_value] objects.\r\n** Any attempt to use these routines on an [unprotected sqlite3_value]\r\n** object results in undefined behavior.\r\n**\r\n** ^These routines work just like the corresponding [column access functions]\r\n** except that  these routines take a single [protected sqlite3_value] object\r\n** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.\r\n**\r\n** ^The sqlite3_value_text16() interface extracts a UTF-16 string\r\n** in the native byte-order of the host machine.  ^The\r\n** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces\r\n** extract UTF-16 strings as big-endian and little-endian respectively.\r\n**\r\n** ^(The sqlite3_value_numeric_type() interface attempts to apply\r\n** numeric affinity to the value.  This means that an attempt is\r\n** made to convert the value to an integer or floating point.  If\r\n** such a conversion is possible without loss of information (in other\r\n** words, if the value is a string that looks like a number)\r\n** then the conversion is performed.  Otherwise no conversion occurs.\r\n** The [SQLITE_INTEGER | datatype] after conversion is returned.)^\r\n**\r\n** Please pay particular attention to the fact that the pointer returned\r\n** from [sqlite3_value_blob()], [sqlite3_value_text()], or\r\n** [sqlite3_value_text16()] can be invalidated by a subsequent call to\r\n** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],\r\n** or [sqlite3_value_text16()].\r\n**\r\n** These routines must be called from the same thread as\r\n** the SQL function that supplied the [sqlite3_value*] parameters.\r\n*/\r\nSQLITE_API const void *sqlite3_value_blob(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_bytes(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_bytes16(sqlite3_value*);\r\nSQLITE_API double sqlite3_value_double(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_int(sqlite3_value*);\r\nSQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);\r\nSQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);\r\nSQLITE_API const void *sqlite3_value_text16(sqlite3_value*);\r\nSQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);\r\nSQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_type(sqlite3_value*);\r\nSQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);\r\n\r\n/*\r\n** CAPI3REF: Obtain Aggregate Function Context\r\n**\r\n** Implementations of aggregate SQL functions use this\r\n** routine to allocate memory for storing their state.\r\n**\r\n** ^The first time the sqlite3_aggregate_context(C,N) routine is called \r\n** for a particular aggregate function, SQLite\r\n** allocates N of memory, zeroes out that memory, and returns a pointer\r\n** to the new memory. ^On second and subsequent calls to\r\n** sqlite3_aggregate_context() for the same aggregate function instance,\r\n** the same buffer is returned.  Sqlite3_aggregate_context() is normally\r\n** called once for each invocation of the xStep callback and then one\r\n** last time when the xFinal callback is invoked.  ^(When no rows match\r\n** an aggregate query, the xStep() callback of the aggregate function\r\n** implementation is never called and xFinal() is called exactly once.\r\n** In those cases, sqlite3_aggregate_context() might be called for the\r\n** first time from within xFinal().)^\r\n**\r\n** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is\r\n** less than or equal to zero or if a memory allocate error occurs.\r\n**\r\n** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is\r\n** determined by the N parameter on first successful call.  Changing the\r\n** value of N in subsequent call to sqlite3_aggregate_context() within\r\n** the same aggregate function instance will not resize the memory\r\n** allocation.)^\r\n**\r\n** ^SQLite automatically frees the memory allocated by \r\n** sqlite3_aggregate_context() when the aggregate query concludes.\r\n**\r\n** The first parameter must be a copy of the\r\n** [sqlite3_context | SQL function context] that is the first parameter\r\n** to the xStep or xFinal callback routine that implements the aggregate\r\n** function.\r\n**\r\n** This routine must be called from the same thread in which\r\n** the aggregate SQL function is running.\r\n*/\r\nSQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);\r\n\r\n/*\r\n** CAPI3REF: User Data For Functions\r\n**\r\n** ^The sqlite3_user_data() interface returns a copy of\r\n** the pointer that was the pUserData parameter (the 5th parameter)\r\n** of the [sqlite3_create_function()]\r\n** and [sqlite3_create_function16()] routines that originally\r\n** registered the application defined function.\r\n**\r\n** This routine must be called from the same thread in which\r\n** the application-defined function is running.\r\n*/\r\nSQLITE_API void *sqlite3_user_data(sqlite3_context*);\r\n\r\n/*\r\n** CAPI3REF: Database Connection For Functions\r\n**\r\n** ^The sqlite3_context_db_handle() interface returns a copy of\r\n** the pointer to the [database connection] (the 1st parameter)\r\n** of the [sqlite3_create_function()]\r\n** and [sqlite3_create_function16()] routines that originally\r\n** registered the application defined function.\r\n*/\r\nSQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);\r\n\r\n/*\r\n** CAPI3REF: Function Auxiliary Data\r\n**\r\n** The following two functions may be used by scalar SQL functions to\r\n** associate metadata with argument values. If the same value is passed to\r\n** multiple invocations of the same SQL function during query execution, under\r\n** some circumstances the associated metadata may be preserved. This may\r\n** be used, for example, to add a regular-expression matching scalar\r\n** function. The compiled version of the regular expression is stored as\r\n** metadata associated with the SQL value passed as the regular expression\r\n** pattern.  The compiled regular expression can be reused on multiple\r\n** invocations of the same function so that the original pattern string\r\n** does not need to be recompiled on each invocation.\r\n**\r\n** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata\r\n** associated by the sqlite3_set_auxdata() function with the Nth argument\r\n** value to the application-defined function. ^If no metadata has been ever\r\n** been set for the Nth argument of the function, or if the corresponding\r\n** function parameter has changed since the meta-data was set,\r\n** then sqlite3_get_auxdata() returns a NULL pointer.\r\n**\r\n** ^The sqlite3_set_auxdata() interface saves the metadata\r\n** pointed to by its 3rd parameter as the metadata for the N-th\r\n** argument of the application-defined function.  Subsequent\r\n** calls to sqlite3_get_auxdata() might return this data, if it has\r\n** not been destroyed.\r\n** ^If it is not NULL, SQLite will invoke the destructor\r\n** function given by the 4th parameter to sqlite3_set_auxdata() on\r\n** the metadata when the corresponding function parameter changes\r\n** or when the SQL statement completes, whichever comes first.\r\n**\r\n** SQLite is free to call the destructor and drop metadata on any\r\n** parameter of any function at any time.  ^The only guarantee is that\r\n** the destructor will be called before the metadata is dropped.\r\n**\r\n** ^(In practice, metadata is preserved between function calls for\r\n** expressions that are constant at compile time. This includes literal\r\n** values and [parameters].)^\r\n**\r\n** These routines must be called from the same thread in which\r\n** the SQL function is running.\r\n*/\r\nSQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);\r\nSQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));\r\n\r\n\r\n/*\r\n** CAPI3REF: Constants Defining Special Destructor Behavior\r\n**\r\n** These are special values for the destructor that is passed in as the\r\n** final argument to routines like [sqlite3_result_blob()].  ^If the destructor\r\n** argument is SQLITE_STATIC, it means that the content pointer is constant\r\n** and will never change.  It does not need to be destroyed.  ^The\r\n** SQLITE_TRANSIENT value means that the content will likely change in\r\n** the near future and that SQLite should make its own private copy of\r\n** the content before returning.\r\n**\r\n** The typedef is necessary to work around problems in certain\r\n** C++ compilers.  See ticket #2191.\r\n*/\r\ntypedef void (*sqlite3_destructor_type)(void*);\r\n#define SQLITE_STATIC      ((sqlite3_destructor_type)0)\r\n#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)\r\n\r\n/*\r\n** CAPI3REF: Setting The Result Of An SQL Function\r\n**\r\n** These routines are used by the xFunc or xFinal callbacks that\r\n** implement SQL functions and aggregates.  See\r\n** [sqlite3_create_function()] and [sqlite3_create_function16()]\r\n** for additional information.\r\n**\r\n** These functions work very much like the [parameter binding] family of\r\n** functions used to bind values to host parameters in prepared statements.\r\n** Refer to the [SQL parameter] documentation for additional information.\r\n**\r\n** ^The sqlite3_result_blob() interface sets the result from\r\n** an application-defined function to be the BLOB whose content is pointed\r\n** to by the second parameter and which is N bytes long where N is the\r\n** third parameter.\r\n**\r\n** ^The sqlite3_result_zeroblob() interfaces set the result of\r\n** the application-defined function to be a BLOB containing all zero\r\n** bytes and N bytes in size, where N is the value of the 2nd parameter.\r\n**\r\n** ^The sqlite3_result_double() interface sets the result from\r\n** an application-defined function to be a floating point value specified\r\n** by its 2nd argument.\r\n**\r\n** ^The sqlite3_result_error() and sqlite3_result_error16() functions\r\n** cause the implemented SQL function to throw an exception.\r\n** ^SQLite uses the string pointed to by the\r\n** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()\r\n** as the text of an error message.  ^SQLite interprets the error\r\n** message string from sqlite3_result_error() as UTF-8. ^SQLite\r\n** interprets the string from sqlite3_result_error16() as UTF-16 in native\r\n** byte order.  ^If the third parameter to sqlite3_result_error()\r\n** or sqlite3_result_error16() is negative then SQLite takes as the error\r\n** message all text up through the first zero character.\r\n** ^If the third parameter to sqlite3_result_error() or\r\n** sqlite3_result_error16() is non-negative then SQLite takes that many\r\n** bytes (not characters) from the 2nd parameter as the error message.\r\n** ^The sqlite3_result_error() and sqlite3_result_error16()\r\n** routines make a private copy of the error message text before\r\n** they return.  Hence, the calling function can deallocate or\r\n** modify the text after they return without harm.\r\n** ^The sqlite3_result_error_code() function changes the error code\r\n** returned by SQLite as a result of an error in a function.  ^By default,\r\n** the error code is SQLITE_ERROR.  ^A subsequent call to sqlite3_result_error()\r\n** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.\r\n**\r\n** ^The sqlite3_result_toobig() interface causes SQLite to throw an error\r\n** indicating that a string or BLOB is too long to represent.\r\n**\r\n** ^The sqlite3_result_nomem() interface causes SQLite to throw an error\r\n** indicating that a memory allocation failed.\r\n**\r\n** ^The sqlite3_result_int() interface sets the return value\r\n** of the application-defined function to be the 32-bit signed integer\r\n** value given in the 2nd argument.\r\n** ^The sqlite3_result_int64() interface sets the return value\r\n** of the application-defined function to be the 64-bit signed integer\r\n** value given in the 2nd argument.\r\n**\r\n** ^The sqlite3_result_null() interface sets the return value\r\n** of the application-defined function to be NULL.\r\n**\r\n** ^The sqlite3_result_text(), sqlite3_result_text16(),\r\n** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces\r\n** set the return value of the application-defined function to be\r\n** a text string which is represented as UTF-8, UTF-16 native byte order,\r\n** UTF-16 little endian, or UTF-16 big endian, respectively.\r\n** ^SQLite takes the text result from the application from\r\n** the 2nd parameter of the sqlite3_result_text* interfaces.\r\n** ^If the 3rd parameter to the sqlite3_result_text* interfaces\r\n** is negative, then SQLite takes result text from the 2nd parameter\r\n** through the first zero character.\r\n** ^If the 3rd parameter to the sqlite3_result_text* interfaces\r\n** is non-negative, then as many bytes (not characters) of the text\r\n** pointed to by the 2nd parameter are taken as the application-defined\r\n** function result.  If the 3rd parameter is non-negative, then it\r\n** must be the byte offset into the string where the NUL terminator would\r\n** appear if the string where NUL terminated.  If any NUL characters occur\r\n** in the string at a byte offset that is less than the value of the 3rd\r\n** parameter, then the resulting string will contain embedded NULs and the\r\n** result of expressions operating on strings with embedded NULs is undefined.\r\n** ^If the 4th parameter to the sqlite3_result_text* interfaces\r\n** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that\r\n** function as the destructor on the text or BLOB result when it has\r\n** finished using that result.\r\n** ^If the 4th parameter to the sqlite3_result_text* interfaces or to\r\n** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite\r\n** assumes that the text or BLOB result is in constant space and does not\r\n** copy the content of the parameter nor call a destructor on the content\r\n** when it has finished using that result.\r\n** ^If the 4th parameter to the sqlite3_result_text* interfaces\r\n** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT\r\n** then SQLite makes a copy of the result into space obtained from\r\n** from [sqlite3_malloc()] before it returns.\r\n**\r\n** ^The sqlite3_result_value() interface sets the result of\r\n** the application-defined function to be a copy the\r\n** [unprotected sqlite3_value] object specified by the 2nd parameter.  ^The\r\n** sqlite3_result_value() interface makes a copy of the [sqlite3_value]\r\n** so that the [sqlite3_value] specified in the parameter may change or\r\n** be deallocated after sqlite3_result_value() returns without harm.\r\n** ^A [protected sqlite3_value] object may always be used where an\r\n** [unprotected sqlite3_value] object is required, so either\r\n** kind of [sqlite3_value] object can be used with this interface.\r\n**\r\n** If these routines are called from within the different thread\r\n** than the one containing the application-defined function that received\r\n** the [sqlite3_context] pointer, the results are undefined.\r\n*/\r\nSQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));\r\nSQLITE_API void sqlite3_result_double(sqlite3_context*, double);\r\nSQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);\r\nSQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);\r\nSQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);\r\nSQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);\r\nSQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);\r\nSQLITE_API void sqlite3_result_int(sqlite3_context*, int);\r\nSQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);\r\nSQLITE_API void sqlite3_result_null(sqlite3_context*);\r\nSQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));\r\nSQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));\r\nSQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));\r\nSQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));\r\nSQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);\r\nSQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);\r\n\r\n/*\r\n** CAPI3REF: Define New Collating Sequences\r\n**\r\n** ^These functions add, remove, or modify a [collation] associated\r\n** with the [database connection] specified as the first argument.\r\n**\r\n** ^The name of the collation is a UTF-8 string\r\n** for sqlite3_create_collation() and sqlite3_create_collation_v2()\r\n** and a UTF-16 string in native byte order for sqlite3_create_collation16().\r\n** ^Collation names that compare equal according to [sqlite3_strnicmp()] are\r\n** considered to be the same name.\r\n**\r\n** ^(The third argument (eTextRep) must be one of the constants:\r\n** <ul>\r\n** <li> [SQLITE_UTF8],\r\n** <li> [SQLITE_UTF16LE],\r\n** <li> [SQLITE_UTF16BE],\r\n** <li> [SQLITE_UTF16], or\r\n** <li> [SQLITE_UTF16_ALIGNED].\r\n** </ul>)^\r\n** ^The eTextRep argument determines the encoding of strings passed\r\n** to the collating function callback, xCallback.\r\n** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep\r\n** force strings to be UTF16 with native byte order.\r\n** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin\r\n** on an even byte address.\r\n**\r\n** ^The fourth argument, pArg, is an application data pointer that is passed\r\n** through as the first argument to the collating function callback.\r\n**\r\n** ^The fifth argument, xCallback, is a pointer to the collating function.\r\n** ^Multiple collating functions can be registered using the same name but\r\n** with different eTextRep parameters and SQLite will use whichever\r\n** function requires the least amount of data transformation.\r\n** ^If the xCallback argument is NULL then the collating function is\r\n** deleted.  ^When all collating functions having the same name are deleted,\r\n** that collation is no longer usable.\r\n**\r\n** ^The collating function callback is invoked with a copy of the pArg \r\n** application data pointer and with two strings in the encoding specified\r\n** by the eTextRep argument.  The collating function must return an\r\n** integer that is negative, zero, or positive\r\n** if the first string is less than, equal to, or greater than the second,\r\n** respectively.  A collating function must always return the same answer\r\n** given the same inputs.  If two or more collating functions are registered\r\n** to the same collation name (using different eTextRep values) then all\r\n** must give an equivalent answer when invoked with equivalent strings.\r\n** The collating function must obey the following properties for all\r\n** strings A, B, and C:\r\n**\r\n** <ol>\r\n** <li> If A==B then B==A.\r\n** <li> If A==B and B==C then A==C.\r\n** <li> If A&lt;B THEN B&gt;A.\r\n** <li> If A&lt;B and B&lt;C then A&lt;C.\r\n** </ol>\r\n**\r\n** If a collating function fails any of the above constraints and that\r\n** collating function is  registered and used, then the behavior of SQLite\r\n** is undefined.\r\n**\r\n** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()\r\n** with the addition that the xDestroy callback is invoked on pArg when\r\n** the collating function is deleted.\r\n** ^Collating functions are deleted when they are overridden by later\r\n** calls to the collation creation functions or when the\r\n** [database connection] is closed using [sqlite3_close()].\r\n**\r\n** ^The xDestroy callback is <u>not</u> called if the \r\n** sqlite3_create_collation_v2() function fails.  Applications that invoke\r\n** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should \r\n** check the return code and dispose of the application data pointer\r\n** themselves rather than expecting SQLite to deal with it for them.\r\n** This is different from every other SQLite interface.  The inconsistency \r\n** is unfortunate but cannot be changed without breaking backwards \r\n** compatibility.\r\n**\r\n** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].\r\n*/\r\nSQLITE_API int sqlite3_create_collation(\r\n  sqlite3*, \r\n  const char *zName, \r\n  int eTextRep, \r\n  void *pArg,\r\n  int(*xCompare)(void*,int,const void*,int,const void*)\r\n);\r\nSQLITE_API int sqlite3_create_collation_v2(\r\n  sqlite3*, \r\n  const char *zName, \r\n  int eTextRep, \r\n  void *pArg,\r\n  int(*xCompare)(void*,int,const void*,int,const void*),\r\n  void(*xDestroy)(void*)\r\n);\r\nSQLITE_API int sqlite3_create_collation16(\r\n  sqlite3*, \r\n  const void *zName,\r\n  int eTextRep, \r\n  void *pArg,\r\n  int(*xCompare)(void*,int,const void*,int,const void*)\r\n);\r\n\r\n/*\r\n** CAPI3REF: Collation Needed Callbacks\r\n**\r\n** ^To avoid having to register all collation sequences before a database\r\n** can be used, a single callback function may be registered with the\r\n** [database connection] to be invoked whenever an undefined collation\r\n** sequence is required.\r\n**\r\n** ^If the function is registered using the sqlite3_collation_needed() API,\r\n** then it is passed the names of undefined collation sequences as strings\r\n** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,\r\n** the names are passed as UTF-16 in machine native byte order.\r\n** ^A call to either function replaces the existing collation-needed callback.\r\n**\r\n** ^(When the callback is invoked, the first argument passed is a copy\r\n** of the second argument to sqlite3_collation_needed() or\r\n** sqlite3_collation_needed16().  The second argument is the database\r\n** connection.  The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],\r\n** or [SQLITE_UTF16LE], indicating the most desirable form of the collation\r\n** sequence function required.  The fourth parameter is the name of the\r\n** required collation sequence.)^\r\n**\r\n** The callback function should register the desired collation using\r\n** [sqlite3_create_collation()], [sqlite3_create_collation16()], or\r\n** [sqlite3_create_collation_v2()].\r\n*/\r\nSQLITE_API int sqlite3_collation_needed(\r\n  sqlite3*, \r\n  void*, \r\n  void(*)(void*,sqlite3*,int eTextRep,const char*)\r\n);\r\nSQLITE_API int sqlite3_collation_needed16(\r\n  sqlite3*, \r\n  void*,\r\n  void(*)(void*,sqlite3*,int eTextRep,const void*)\r\n);\r\n\r\n#ifdef SQLITE_HAS_CODEC\r\n/*\r\n** Specify the key for an encrypted database.  This routine should be\r\n** called right after sqlite3_open().\r\n**\r\n** The code to implement this API is not available in the public release\r\n** of SQLite.\r\n*/\r\nSQLITE_API int sqlite3_key(\r\n  sqlite3 *db,                   /* Database to be rekeyed */\r\n  const void *pKey, int nKey     /* The key */\r\n);\r\n\r\n/*\r\n** Change the key on an open database.  If the current database is not\r\n** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the\r\n** database is decrypted.\r\n**\r\n** The code to implement this API is not available in the public release\r\n** of SQLite.\r\n*/\r\nSQLITE_API int sqlite3_rekey(\r\n  sqlite3 *db,                   /* Database to be rekeyed */\r\n  const void *pKey, int nKey     /* The new key */\r\n);\r\n\r\n/*\r\n** Specify the activation key for a SEE database.  Unless \r\n** activated, none of the SEE routines will work.\r\n*/\r\nSQLITE_API void sqlite3_activate_see(\r\n  const char *zPassPhrase        /* Activation phrase */\r\n);\r\n#endif\r\n\r\n#ifdef SQLITE_ENABLE_CEROD\r\n/*\r\n** Specify the activation key for a CEROD database.  Unless \r\n** activated, none of the CEROD routines will work.\r\n*/\r\nSQLITE_API void sqlite3_activate_cerod(\r\n  const char *zPassPhrase        /* Activation phrase */\r\n);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Suspend Execution For A Short Time\r\n**\r\n** The sqlite3_sleep() function causes the current thread to suspend execution\r\n** for at least a number of milliseconds specified in its parameter.\r\n**\r\n** If the operating system does not support sleep requests with\r\n** millisecond time resolution, then the time will be rounded up to\r\n** the nearest second. The number of milliseconds of sleep actually\r\n** requested from the operating system is returned.\r\n**\r\n** ^SQLite implements this interface by calling the xSleep()\r\n** method of the default [sqlite3_vfs] object.  If the xSleep() method\r\n** of the default VFS is not implemented correctly, or not implemented at\r\n** all, then the behavior of sqlite3_sleep() may deviate from the description\r\n** in the previous paragraphs.\r\n*/\r\nSQLITE_API int sqlite3_sleep(int);\r\n\r\n/*\r\n** CAPI3REF: Name Of The Folder Holding Temporary Files\r\n**\r\n** ^(If this global variable is made to point to a string which is\r\n** the name of a folder (a.k.a. directory), then all temporary files\r\n** created by SQLite when using a built-in [sqlite3_vfs | VFS]\r\n** will be placed in that directory.)^  ^If this variable\r\n** is a NULL pointer, then SQLite performs a search for an appropriate\r\n** temporary file directory.\r\n**\r\n** It is not safe to read or modify this variable in more than one\r\n** thread at a time.  It is not safe to read or modify this variable\r\n** if a [database connection] is being used at the same time in a separate\r\n** thread.\r\n** It is intended that this variable be set once\r\n** as part of process initialization and before any SQLite interface\r\n** routines have been called and that this variable remain unchanged\r\n** thereafter.\r\n**\r\n** ^The [temp_store_directory pragma] may modify this variable and cause\r\n** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,\r\n** the [temp_store_directory pragma] always assumes that any string\r\n** that this variable points to is held in memory obtained from \r\n** [sqlite3_malloc] and the pragma may attempt to free that memory\r\n** using [sqlite3_free].\r\n** Hence, if this variable is modified directly, either it should be\r\n** made NULL or made to point to memory obtained from [sqlite3_malloc]\r\n** or else the use of the [temp_store_directory pragma] should be avoided.\r\n*/\r\nSQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;\r\n\r\n/*\r\n** CAPI3REF: Test For Auto-Commit Mode\r\n** KEYWORDS: {autocommit mode}\r\n**\r\n** ^The sqlite3_get_autocommit() interface returns non-zero or\r\n** zero if the given database connection is or is not in autocommit mode,\r\n** respectively.  ^Autocommit mode is on by default.\r\n** ^Autocommit mode is disabled by a [BEGIN] statement.\r\n** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].\r\n**\r\n** If certain kinds of errors occur on a statement within a multi-statement\r\n** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],\r\n** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the\r\n** transaction might be rolled back automatically.  The only way to\r\n** find out whether SQLite automatically rolled back the transaction after\r\n** an error is to use this function.\r\n**\r\n** If another thread changes the autocommit status of the database\r\n** connection while this routine is running, then the return value\r\n** is undefined.\r\n*/\r\nSQLITE_API int sqlite3_get_autocommit(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Find The Database Handle Of A Prepared Statement\r\n**\r\n** ^The sqlite3_db_handle interface returns the [database connection] handle\r\n** to which a [prepared statement] belongs.  ^The [database connection]\r\n** returned by sqlite3_db_handle is the same [database connection]\r\n** that was the first argument\r\n** to the [sqlite3_prepare_v2()] call (or its variants) that was used to\r\n** create the statement in the first place.\r\n*/\r\nSQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);\r\n\r\n/*\r\n** CAPI3REF: Return The Filename For A Database Connection\r\n**\r\n** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename\r\n** associated with database N of connection D.  ^The main database file\r\n** has the name \"main\".  If there is no attached database N on the database\r\n** connection D, or if database N is a temporary or in-memory database, then\r\n** a NULL pointer is returned.\r\n**\r\n** ^The filename returned by this function is the output of the\r\n** xFullPathname method of the [VFS].  ^In other words, the filename\r\n** will be an absolute pathname, even if the filename used\r\n** to open the database originally was a URI or relative pathname.\r\n*/\r\nSQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);\r\n\r\n/*\r\n** CAPI3REF: Determine if a database is read-only\r\n**\r\n** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N\r\n** of connection D is read-only, 0 if it is read/write, or -1 if N is not\r\n** the name of a database on connection D.\r\n*/\r\nSQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);\r\n\r\n/*\r\n** CAPI3REF: Find the next prepared statement\r\n**\r\n** ^This interface returns a pointer to the next [prepared statement] after\r\n** pStmt associated with the [database connection] pDb.  ^If pStmt is NULL\r\n** then this interface returns a pointer to the first prepared statement\r\n** associated with the database connection pDb.  ^If no prepared statement\r\n** satisfies the conditions of this routine, it returns NULL.\r\n**\r\n** The [database connection] pointer D in a call to\r\n** [sqlite3_next_stmt(D,S)] must refer to an open database\r\n** connection and in particular must not be a NULL pointer.\r\n*/\r\nSQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);\r\n\r\n/*\r\n** CAPI3REF: Commit And Rollback Notification Callbacks\r\n**\r\n** ^The sqlite3_commit_hook() interface registers a callback\r\n** function to be invoked whenever a transaction is [COMMIT | committed].\r\n** ^Any callback set by a previous call to sqlite3_commit_hook()\r\n** for the same database connection is overridden.\r\n** ^The sqlite3_rollback_hook() interface registers a callback\r\n** function to be invoked whenever a transaction is [ROLLBACK | rolled back].\r\n** ^Any callback set by a previous call to sqlite3_rollback_hook()\r\n** for the same database connection is overridden.\r\n** ^The pArg argument is passed through to the callback.\r\n** ^If the callback on a commit hook function returns non-zero,\r\n** then the commit is converted into a rollback.\r\n**\r\n** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions\r\n** return the P argument from the previous call of the same function\r\n** on the same [database connection] D, or NULL for\r\n** the first call for each function on D.\r\n**\r\n** The commit and rollback hook callbacks are not reentrant.\r\n** The callback implementation must not do anything that will modify\r\n** the database connection that invoked the callback.  Any actions\r\n** to modify the database connection must be deferred until after the\r\n** completion of the [sqlite3_step()] call that triggered the commit\r\n** or rollback hook in the first place.\r\n** Note that running any other SQL statements, including SELECT statements,\r\n** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify\r\n** the database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n** ^Registering a NULL function disables the callback.\r\n**\r\n** ^When the commit hook callback routine returns zero, the [COMMIT]\r\n** operation is allowed to continue normally.  ^If the commit hook\r\n** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].\r\n** ^The rollback hook is invoked on a rollback that results from a commit\r\n** hook returning non-zero, just as it would be with any other rollback.\r\n**\r\n** ^For the purposes of this API, a transaction is said to have been\r\n** rolled back if an explicit \"ROLLBACK\" statement is executed, or\r\n** an error or constraint causes an implicit rollback to occur.\r\n** ^The rollback callback is not invoked if a transaction is\r\n** automatically rolled back because the database connection is closed.\r\n**\r\n** See also the [sqlite3_update_hook()] interface.\r\n*/\r\nSQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);\r\nSQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);\r\n\r\n/*\r\n** CAPI3REF: Data Change Notification Callbacks\r\n**\r\n** ^The sqlite3_update_hook() interface registers a callback function\r\n** with the [database connection] identified by the first argument\r\n** to be invoked whenever a row is updated, inserted or deleted.\r\n** ^Any callback set by a previous call to this function\r\n** for the same database connection is overridden.\r\n**\r\n** ^The second argument is a pointer to the function to invoke when a\r\n** row is updated, inserted or deleted.\r\n** ^The first argument to the callback is a copy of the third argument\r\n** to sqlite3_update_hook().\r\n** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],\r\n** or [SQLITE_UPDATE], depending on the operation that caused the callback\r\n** to be invoked.\r\n** ^The third and fourth arguments to the callback contain pointers to the\r\n** database and table name containing the affected row.\r\n** ^The final callback parameter is the [rowid] of the row.\r\n** ^In the case of an update, this is the [rowid] after the update takes place.\r\n**\r\n** ^(The update hook is not invoked when internal system tables are\r\n** modified (i.e. sqlite_master and sqlite_sequence).)^\r\n**\r\n** ^In the current implementation, the update hook\r\n** is not invoked when duplication rows are deleted because of an\r\n** [ON CONFLICT | ON CONFLICT REPLACE] clause.  ^Nor is the update hook\r\n** invoked when rows are deleted using the [truncate optimization].\r\n** The exceptions defined in this paragraph might change in a future\r\n** release of SQLite.\r\n**\r\n** The update hook implementation must not do anything that will modify\r\n** the database connection that invoked the update hook.  Any actions\r\n** to modify the database connection must be deferred until after the\r\n** completion of the [sqlite3_step()] call that triggered the update hook.\r\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\r\n** database connections for the meaning of \"modify\" in this paragraph.\r\n**\r\n** ^The sqlite3_update_hook(D,C,P) function\r\n** returns the P argument from the previous call\r\n** on the same [database connection] D, or NULL for\r\n** the first call on D.\r\n**\r\n** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]\r\n** interfaces.\r\n*/\r\nSQLITE_API void *sqlite3_update_hook(\r\n  sqlite3*, \r\n  void(*)(void *,int ,char const *,char const *,sqlite3_int64),\r\n  void*\r\n);\r\n\r\n/*\r\n** CAPI3REF: Enable Or Disable Shared Pager Cache\r\n** KEYWORDS: {shared cache}\r\n**\r\n** ^(This routine enables or disables the sharing of the database cache\r\n** and schema data structures between [database connection | connections]\r\n** to the same database. Sharing is enabled if the argument is true\r\n** and disabled if the argument is false.)^\r\n**\r\n** ^Cache sharing is enabled and disabled for an entire process.\r\n** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,\r\n** sharing was enabled or disabled for each thread separately.\r\n**\r\n** ^(The cache sharing mode set by this interface effects all subsequent\r\n** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].\r\n** Existing database connections continue use the sharing mode\r\n** that was in effect at the time they were opened.)^\r\n**\r\n** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled\r\n** successfully.  An [error code] is returned otherwise.)^\r\n**\r\n** ^Shared cache is disabled by default. But this might change in\r\n** future releases of SQLite.  Applications that care about shared\r\n** cache setting should set it explicitly.\r\n**\r\n** See Also:  [SQLite Shared-Cache Mode]\r\n*/\r\nSQLITE_API int sqlite3_enable_shared_cache(int);\r\n\r\n/*\r\n** CAPI3REF: Attempt To Free Heap Memory\r\n**\r\n** ^The sqlite3_release_memory() interface attempts to free N bytes\r\n** of heap memory by deallocating non-essential memory allocations\r\n** held by the database library.   Memory used to cache database\r\n** pages to improve performance is an example of non-essential memory.\r\n** ^sqlite3_release_memory() returns the number of bytes actually freed,\r\n** which might be more or less than the amount requested.\r\n** ^The sqlite3_release_memory() routine is a no-op returning zero\r\n** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].\r\n**\r\n** See also: [sqlite3_db_release_memory()]\r\n*/\r\nSQLITE_API int sqlite3_release_memory(int);\r\n\r\n/*\r\n** CAPI3REF: Free Memory Used By A Database Connection\r\n**\r\n** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap\r\n** memory as possible from database connection D. Unlike the\r\n** [sqlite3_release_memory()] interface, this interface is effect even\r\n** when then [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is\r\n** omitted.\r\n**\r\n** See also: [sqlite3_release_memory()]\r\n*/\r\nSQLITE_API int sqlite3_db_release_memory(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Impose A Limit On Heap Size\r\n**\r\n** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the\r\n** soft limit on the amount of heap memory that may be allocated by SQLite.\r\n** ^SQLite strives to keep heap memory utilization below the soft heap\r\n** limit by reducing the number of pages held in the page cache\r\n** as heap memory usages approaches the limit.\r\n** ^The soft heap limit is \"soft\" because even though SQLite strives to stay\r\n** below the limit, it will exceed the limit rather than generate\r\n** an [SQLITE_NOMEM] error.  In other words, the soft heap limit \r\n** is advisory only.\r\n**\r\n** ^The return value from sqlite3_soft_heap_limit64() is the size of\r\n** the soft heap limit prior to the call, or negative in the case of an\r\n** error.  ^If the argument N is negative\r\n** then no change is made to the soft heap limit.  Hence, the current\r\n** size of the soft heap limit can be determined by invoking\r\n** sqlite3_soft_heap_limit64() with a negative argument.\r\n**\r\n** ^If the argument N is zero then the soft heap limit is disabled.\r\n**\r\n** ^(The soft heap limit is not enforced in the current implementation\r\n** if one or more of following conditions are true:\r\n**\r\n** <ul>\r\n** <li> The soft heap limit is set to zero.\r\n** <li> Memory accounting is disabled using a combination of the\r\n**      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and\r\n**      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.\r\n** <li> An alternative page cache implementation is specified using\r\n**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).\r\n** <li> The page cache allocates from its own memory pool supplied\r\n**      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than\r\n**      from the heap.\r\n** </ul>)^\r\n**\r\n** Beginning with SQLite version 3.7.3, the soft heap limit is enforced\r\n** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]\r\n** compile-time option is invoked.  With [SQLITE_ENABLE_MEMORY_MANAGEMENT],\r\n** the soft heap limit is enforced on every memory allocation.  Without\r\n** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced\r\n** when memory is allocated by the page cache.  Testing suggests that because\r\n** the page cache is the predominate memory user in SQLite, most\r\n** applications will achieve adequate soft heap limit enforcement without\r\n** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].\r\n**\r\n** The circumstances under which SQLite will enforce the soft heap limit may\r\n** changes in future releases of SQLite.\r\n*/\r\nSQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);\r\n\r\n/*\r\n** CAPI3REF: Deprecated Soft Heap Limit Interface\r\n** DEPRECATED\r\n**\r\n** This is a deprecated version of the [sqlite3_soft_heap_limit64()]\r\n** interface.  This routine is provided for historical compatibility\r\n** only.  All new applications should use the\r\n** [sqlite3_soft_heap_limit64()] interface rather than this one.\r\n*/\r\nSQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);\r\n\r\n\r\n/*\r\n** CAPI3REF: Extract Metadata About A Column Of A Table\r\n**\r\n** ^This routine returns metadata about a specific column of a specific\r\n** database table accessible using the [database connection] handle\r\n** passed as the first function argument.\r\n**\r\n** ^The column is identified by the second, third and fourth parameters to\r\n** this function. ^The second parameter is either the name of the database\r\n** (i.e. \"main\", \"temp\", or an attached database) containing the specified\r\n** table or NULL. ^If it is NULL, then all attached databases are searched\r\n** for the table using the same algorithm used by the database engine to\r\n** resolve unqualified table references.\r\n**\r\n** ^The third and fourth parameters to this function are the table and column\r\n** name of the desired column, respectively. Neither of these parameters\r\n** may be NULL.\r\n**\r\n** ^Metadata is returned by writing to the memory locations passed as the 5th\r\n** and subsequent parameters to this function. ^Any of these arguments may be\r\n** NULL, in which case the corresponding element of metadata is omitted.\r\n**\r\n** ^(<blockquote>\r\n** <table border=\"1\">\r\n** <tr><th> Parameter <th> Output<br>Type <th>  Description\r\n**\r\n** <tr><td> 5th <td> const char* <td> Data type\r\n** <tr><td> 6th <td> const char* <td> Name of default collation sequence\r\n** <tr><td> 7th <td> int         <td> True if column has a NOT NULL constraint\r\n** <tr><td> 8th <td> int         <td> True if column is part of the PRIMARY KEY\r\n** <tr><td> 9th <td> int         <td> True if column is [AUTOINCREMENT]\r\n** </table>\r\n** </blockquote>)^\r\n**\r\n** ^The memory pointed to by the character pointers returned for the\r\n** declaration type and collation sequence is valid only until the next\r\n** call to any SQLite API function.\r\n**\r\n** ^If the specified table is actually a view, an [error code] is returned.\r\n**\r\n** ^If the specified column is \"rowid\", \"oid\" or \"_rowid_\" and an\r\n** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output\r\n** parameters are set for the explicitly declared column. ^(If there is no\r\n** explicitly declared [INTEGER PRIMARY KEY] column, then the output\r\n** parameters are set as follows:\r\n**\r\n** <pre>\r\n**     data type: \"INTEGER\"\r\n**     collation sequence: \"BINARY\"\r\n**     not null: 0\r\n**     primary key: 1\r\n**     auto increment: 0\r\n** </pre>)^\r\n**\r\n** ^(This function may load one or more schemas from database files. If an\r\n** error occurs during this process, or if the requested table or column\r\n** cannot be found, an [error code] is returned and an error message left\r\n** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^\r\n**\r\n** ^This API is only available if the library was compiled with the\r\n** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.\r\n*/\r\nSQLITE_API int sqlite3_table_column_metadata(\r\n  sqlite3 *db,                /* Connection handle */\r\n  const char *zDbName,        /* Database name or NULL */\r\n  const char *zTableName,     /* Table name */\r\n  const char *zColumnName,    /* Column name */\r\n  char const **pzDataType,    /* OUTPUT: Declared data type */\r\n  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */\r\n  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */\r\n  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */\r\n  int *pAutoinc               /* OUTPUT: True if column is auto-increment */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Load An Extension\r\n**\r\n** ^This interface loads an SQLite extension library from the named file.\r\n**\r\n** ^The sqlite3_load_extension() interface attempts to load an\r\n** SQLite extension library contained in the file zFile.\r\n**\r\n** ^The entry point is zProc.\r\n** ^zProc may be 0, in which case the name of the entry point\r\n** defaults to \"sqlite3_extension_init\".\r\n** ^The sqlite3_load_extension() interface returns\r\n** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.\r\n** ^If an error occurs and pzErrMsg is not 0, then the\r\n** [sqlite3_load_extension()] interface shall attempt to\r\n** fill *pzErrMsg with error message text stored in memory\r\n** obtained from [sqlite3_malloc()]. The calling function\r\n** should free this memory by calling [sqlite3_free()].\r\n**\r\n** ^Extension loading must be enabled using\r\n** [sqlite3_enable_load_extension()] prior to calling this API,\r\n** otherwise an error will be returned.\r\n**\r\n** See also the [load_extension() SQL function].\r\n*/\r\nSQLITE_API int sqlite3_load_extension(\r\n  sqlite3 *db,          /* Load the extension into this database connection */\r\n  const char *zFile,    /* Name of the shared library containing extension */\r\n  const char *zProc,    /* Entry point.  Derived from zFile if 0 */\r\n  char **pzErrMsg       /* Put error message here if not 0 */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Enable Or Disable Extension Loading\r\n**\r\n** ^So as not to open security holes in older applications that are\r\n** unprepared to deal with extension loading, and as a means of disabling\r\n** extension loading while evaluating user-entered SQL, the following API\r\n** is provided to turn the [sqlite3_load_extension()] mechanism on and off.\r\n**\r\n** ^Extension loading is off by default. See ticket #1863.\r\n** ^Call the sqlite3_enable_load_extension() routine with onoff==1\r\n** to turn extension loading on and call it with onoff==0 to turn\r\n** it back off again.\r\n*/\r\nSQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);\r\n\r\n/*\r\n** CAPI3REF: Automatically Load Statically Linked Extensions\r\n**\r\n** ^This interface causes the xEntryPoint() function to be invoked for\r\n** each new [database connection] that is created.  The idea here is that\r\n** xEntryPoint() is the entry point for a statically linked SQLite extension\r\n** that is to be automatically loaded into all new database connections.\r\n**\r\n** ^(Even though the function prototype shows that xEntryPoint() takes\r\n** no arguments and returns void, SQLite invokes xEntryPoint() with three\r\n** arguments and expects and integer result as if the signature of the\r\n** entry point where as follows:\r\n**\r\n** <blockquote><pre>\r\n** &nbsp;  int xEntryPoint(\r\n** &nbsp;    sqlite3 *db,\r\n** &nbsp;    const char **pzErrMsg,\r\n** &nbsp;    const struct sqlite3_api_routines *pThunk\r\n** &nbsp;  );\r\n** </pre></blockquote>)^\r\n**\r\n** If the xEntryPoint routine encounters an error, it should make *pzErrMsg\r\n** point to an appropriate error message (obtained from [sqlite3_mprintf()])\r\n** and return an appropriate [error code].  ^SQLite ensures that *pzErrMsg\r\n** is NULL before calling the xEntryPoint().  ^SQLite will invoke\r\n** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns.  ^If any\r\n** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],\r\n** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.\r\n**\r\n** ^Calling sqlite3_auto_extension(X) with an entry point X that is already\r\n** on the list of automatic extensions is a harmless no-op. ^No entry point\r\n** will be called more than once for each database connection that is opened.\r\n**\r\n** See also: [sqlite3_reset_auto_extension()].\r\n*/\r\nSQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));\r\n\r\n/*\r\n** CAPI3REF: Reset Automatic Extension Loading\r\n**\r\n** ^This interface disables all automatic extensions previously\r\n** registered using [sqlite3_auto_extension()].\r\n*/\r\nSQLITE_API void sqlite3_reset_auto_extension(void);\r\n\r\n/*\r\n** The interface to the virtual-table mechanism is currently considered\r\n** to be experimental.  The interface might change in incompatible ways.\r\n** If this is a problem for you, do not use the interface at this time.\r\n**\r\n** When the virtual-table mechanism stabilizes, we will declare the\r\n** interface fixed, support it indefinitely, and remove this comment.\r\n*/\r\n\r\n/*\r\n** Structures used by the virtual table interface\r\n*/\r\ntypedef struct sqlite3_vtab sqlite3_vtab;\r\ntypedef struct sqlite3_index_info sqlite3_index_info;\r\ntypedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;\r\ntypedef struct sqlite3_module sqlite3_module;\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Object\r\n** KEYWORDS: sqlite3_module {virtual table module}\r\n**\r\n** This structure, sometimes called a \"virtual table module\", \r\n** defines the implementation of a [virtual tables].  \r\n** This structure consists mostly of methods for the module.\r\n**\r\n** ^A virtual table module is created by filling in a persistent\r\n** instance of this structure and passing a pointer to that instance\r\n** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].\r\n** ^The registration remains valid until it is replaced by a different\r\n** module or until the [database connection] closes.  The content\r\n** of this structure must not change while it is registered with\r\n** any database connection.\r\n*/\r\nstruct sqlite3_module {\r\n  int iVersion;\r\n  int (*xCreate)(sqlite3*, void *pAux,\r\n               int argc, const char *const*argv,\r\n               sqlite3_vtab **ppVTab, char**);\r\n  int (*xConnect)(sqlite3*, void *pAux,\r\n               int argc, const char *const*argv,\r\n               sqlite3_vtab **ppVTab, char**);\r\n  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);\r\n  int (*xDisconnect)(sqlite3_vtab *pVTab);\r\n  int (*xDestroy)(sqlite3_vtab *pVTab);\r\n  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);\r\n  int (*xClose)(sqlite3_vtab_cursor*);\r\n  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,\r\n                int argc, sqlite3_value **argv);\r\n  int (*xNext)(sqlite3_vtab_cursor*);\r\n  int (*xEof)(sqlite3_vtab_cursor*);\r\n  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);\r\n  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);\r\n  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);\r\n  int (*xBegin)(sqlite3_vtab *pVTab);\r\n  int (*xSync)(sqlite3_vtab *pVTab);\r\n  int (*xCommit)(sqlite3_vtab *pVTab);\r\n  int (*xRollback)(sqlite3_vtab *pVTab);\r\n  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,\r\n                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                       void **ppArg);\r\n  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);\r\n  /* The methods above are in version 1 of the sqlite_module object. Those \r\n  ** below are for version 2 and greater. */\r\n  int (*xSavepoint)(sqlite3_vtab *pVTab, int);\r\n  int (*xRelease)(sqlite3_vtab *pVTab, int);\r\n  int (*xRollbackTo)(sqlite3_vtab *pVTab, int);\r\n};\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Indexing Information\r\n** KEYWORDS: sqlite3_index_info\r\n**\r\n** The sqlite3_index_info structure and its substructures is used as part\r\n** of the [virtual table] interface to\r\n** pass information into and receive the reply from the [xBestIndex]\r\n** method of a [virtual table module].  The fields under **Inputs** are the\r\n** inputs to xBestIndex and are read-only.  xBestIndex inserts its\r\n** results into the **Outputs** fields.\r\n**\r\n** ^(The aConstraint[] array records WHERE clause constraints of the form:\r\n**\r\n** <blockquote>column OP expr</blockquote>\r\n**\r\n** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is\r\n** stored in aConstraint[].op using one of the\r\n** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^\r\n** ^(The index of the column is stored in\r\n** aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the\r\n** expr on the right-hand side can be evaluated (and thus the constraint\r\n** is usable) and false if it cannot.)^\r\n**\r\n** ^The optimizer automatically inverts terms of the form \"expr OP column\"\r\n** and makes other simplifications to the WHERE clause in an attempt to\r\n** get as many WHERE clause terms into the form shown above as possible.\r\n** ^The aConstraint[] array only reports WHERE clause terms that are\r\n** relevant to the particular virtual table being queried.\r\n**\r\n** ^Information about the ORDER BY clause is stored in aOrderBy[].\r\n** ^Each term of aOrderBy records a column of the ORDER BY clause.\r\n**\r\n** The [xBestIndex] method must fill aConstraintUsage[] with information\r\n** about what parameters to pass to xFilter.  ^If argvIndex>0 then\r\n** the right-hand side of the corresponding aConstraint[] is evaluated\r\n** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit\r\n** is true, then the constraint is assumed to be fully handled by the\r\n** virtual table and is not checked again by SQLite.)^\r\n**\r\n** ^The idxNum and idxPtr values are recorded and passed into the\r\n** [xFilter] method.\r\n** ^[sqlite3_free()] is used to free idxPtr if and only if\r\n** needToFreeIdxPtr is true.\r\n**\r\n** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in\r\n** the correct order to satisfy the ORDER BY clause so that no separate\r\n** sorting step is required.\r\n**\r\n** ^The estimatedCost value is an estimate of the cost of doing the\r\n** particular lookup.  A full scan of a table with N entries should have\r\n** a cost of N.  A binary search of a table of N entries should have a\r\n** cost of approximately log(N).\r\n*/\r\nstruct sqlite3_index_info {\r\n  /* Inputs */\r\n  int nConstraint;           /* Number of entries in aConstraint */\r\n  struct sqlite3_index_constraint {\r\n     int iColumn;              /* Column on left-hand side of constraint */\r\n     unsigned char op;         /* Constraint operator */\r\n     unsigned char usable;     /* True if this constraint is usable */\r\n     int iTermOffset;          /* Used internally - xBestIndex should ignore */\r\n  } *aConstraint;            /* Table of WHERE clause constraints */\r\n  int nOrderBy;              /* Number of terms in the ORDER BY clause */\r\n  struct sqlite3_index_orderby {\r\n     int iColumn;              /* Column number */\r\n     unsigned char desc;       /* True for DESC.  False for ASC. */\r\n  } *aOrderBy;               /* The ORDER BY clause */\r\n  /* Outputs */\r\n  struct sqlite3_index_constraint_usage {\r\n    int argvIndex;           /* if >0, constraint is part of argv to xFilter */\r\n    unsigned char omit;      /* Do not code a test for this constraint */\r\n  } *aConstraintUsage;\r\n  int idxNum;                /* Number used to identify the index */\r\n  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */\r\n  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */\r\n  int orderByConsumed;       /* True if output is already ordered */\r\n  double estimatedCost;      /* Estimated cost of using this index */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Constraint Operator Codes\r\n**\r\n** These macros defined the allowed values for the\r\n** [sqlite3_index_info].aConstraint[].op field.  Each value represents\r\n** an operator that is part of a constraint term in the wHERE clause of\r\n** a query that uses a [virtual table].\r\n*/\r\n#define SQLITE_INDEX_CONSTRAINT_EQ    2\r\n#define SQLITE_INDEX_CONSTRAINT_GT    4\r\n#define SQLITE_INDEX_CONSTRAINT_LE    8\r\n#define SQLITE_INDEX_CONSTRAINT_LT    16\r\n#define SQLITE_INDEX_CONSTRAINT_GE    32\r\n#define SQLITE_INDEX_CONSTRAINT_MATCH 64\r\n\r\n/*\r\n** CAPI3REF: Register A Virtual Table Implementation\r\n**\r\n** ^These routines are used to register a new [virtual table module] name.\r\n** ^Module names must be registered before\r\n** creating a new [virtual table] using the module and before using a\r\n** preexisting [virtual table] for the module.\r\n**\r\n** ^The module name is registered on the [database connection] specified\r\n** by the first parameter.  ^The name of the module is given by the \r\n** second parameter.  ^The third parameter is a pointer to\r\n** the implementation of the [virtual table module].   ^The fourth\r\n** parameter is an arbitrary client data pointer that is passed through\r\n** into the [xCreate] and [xConnect] methods of the virtual table module\r\n** when a new virtual table is be being created or reinitialized.\r\n**\r\n** ^The sqlite3_create_module_v2() interface has a fifth parameter which\r\n** is a pointer to a destructor for the pClientData.  ^SQLite will\r\n** invoke the destructor function (if it is not NULL) when SQLite\r\n** no longer needs the pClientData pointer.  ^The destructor will also\r\n** be invoked if the call to sqlite3_create_module_v2() fails.\r\n** ^The sqlite3_create_module()\r\n** interface is equivalent to sqlite3_create_module_v2() with a NULL\r\n** destructor.\r\n*/\r\nSQLITE_API int sqlite3_create_module(\r\n  sqlite3 *db,               /* SQLite connection to register module with */\r\n  const char *zName,         /* Name of the module */\r\n  const sqlite3_module *p,   /* Methods for the module */\r\n  void *pClientData          /* Client data for xCreate/xConnect */\r\n);\r\nSQLITE_API int sqlite3_create_module_v2(\r\n  sqlite3 *db,               /* SQLite connection to register module with */\r\n  const char *zName,         /* Name of the module */\r\n  const sqlite3_module *p,   /* Methods for the module */\r\n  void *pClientData,         /* Client data for xCreate/xConnect */\r\n  void(*xDestroy)(void*)     /* Module destructor function */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Instance Object\r\n** KEYWORDS: sqlite3_vtab\r\n**\r\n** Every [virtual table module] implementation uses a subclass\r\n** of this object to describe a particular instance\r\n** of the [virtual table].  Each subclass will\r\n** be tailored to the specific needs of the module implementation.\r\n** The purpose of this superclass is to define certain fields that are\r\n** common to all module implementations.\r\n**\r\n** ^Virtual tables methods can set an error message by assigning a\r\n** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should\r\n** take care that any prior string is freed by a call to [sqlite3_free()]\r\n** prior to assigning a new string to zErrMsg.  ^After the error message\r\n** is delivered up to the client application, the string will be automatically\r\n** freed by sqlite3_free() and the zErrMsg field will be zeroed.\r\n*/\r\nstruct sqlite3_vtab {\r\n  const sqlite3_module *pModule;  /* The module for this virtual table */\r\n  int nRef;                       /* NO LONGER USED */\r\n  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */\r\n  /* Virtual table implementations will typically add additional fields */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Cursor Object\r\n** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}\r\n**\r\n** Every [virtual table module] implementation uses a subclass of the\r\n** following structure to describe cursors that point into the\r\n** [virtual table] and are used\r\n** to loop through the virtual table.  Cursors are created using the\r\n** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed\r\n** by the [sqlite3_module.xClose | xClose] method.  Cursors are used\r\n** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods\r\n** of the module.  Each module implementation will define\r\n** the content of a cursor structure to suit its own needs.\r\n**\r\n** This superclass exists in order to define fields of the cursor that\r\n** are common to all implementations.\r\n*/\r\nstruct sqlite3_vtab_cursor {\r\n  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */\r\n  /* Virtual table implementations will typically add additional fields */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Declare The Schema Of A Virtual Table\r\n**\r\n** ^The [xCreate] and [xConnect] methods of a\r\n** [virtual table module] call this interface\r\n** to declare the format (the names and datatypes of the columns) of\r\n** the virtual tables they implement.\r\n*/\r\nSQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);\r\n\r\n/*\r\n** CAPI3REF: Overload A Function For A Virtual Table\r\n**\r\n** ^(Virtual tables can provide alternative implementations of functions\r\n** using the [xFindFunction] method of the [virtual table module].  \r\n** But global versions of those functions\r\n** must exist in order to be overloaded.)^\r\n**\r\n** ^(This API makes sure a global version of a function with a particular\r\n** name and number of parameters exists.  If no such function exists\r\n** before this API is called, a new function is created.)^  ^The implementation\r\n** of the new function always causes an exception to be thrown.  So\r\n** the new function is not good for anything by itself.  Its only\r\n** purpose is to be a placeholder function that can be overloaded\r\n** by a [virtual table].\r\n*/\r\nSQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);\r\n\r\n/*\r\n** The interface to the virtual-table mechanism defined above (back up\r\n** to a comment remarkably similar to this one) is currently considered\r\n** to be experimental.  The interface might change in incompatible ways.\r\n** If this is a problem for you, do not use the interface at this time.\r\n**\r\n** When the virtual-table mechanism stabilizes, we will declare the\r\n** interface fixed, support it indefinitely, and remove this comment.\r\n*/\r\n\r\n/*\r\n** CAPI3REF: A Handle To An Open BLOB\r\n** KEYWORDS: {BLOB handle} {BLOB handles}\r\n**\r\n** An instance of this object represents an open BLOB on which\r\n** [sqlite3_blob_open | incremental BLOB I/O] can be performed.\r\n** ^Objects of this type are created by [sqlite3_blob_open()]\r\n** and destroyed by [sqlite3_blob_close()].\r\n** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces\r\n** can be used to read or write small subsections of the BLOB.\r\n** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.\r\n*/\r\ntypedef struct sqlite3_blob sqlite3_blob;\r\n\r\n/*\r\n** CAPI3REF: Open A BLOB For Incremental I/O\r\n**\r\n** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located\r\n** in row iRow, column zColumn, table zTable in database zDb;\r\n** in other words, the same BLOB that would be selected by:\r\n**\r\n** <pre>\r\n**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;\r\n** </pre>)^\r\n**\r\n** ^If the flags parameter is non-zero, then the BLOB is opened for read\r\n** and write access. ^If it is zero, the BLOB is opened for read access.\r\n** ^It is not possible to open a column that is part of an index or primary \r\n** key for writing. ^If [foreign key constraints] are enabled, it is \r\n** not possible to open a column that is part of a [child key] for writing.\r\n**\r\n** ^Note that the database name is not the filename that contains\r\n** the database but rather the symbolic name of the database that\r\n** appears after the AS keyword when the database is connected using [ATTACH].\r\n** ^For the main database file, the database name is \"main\".\r\n** ^For TEMP tables, the database name is \"temp\".\r\n**\r\n** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written\r\n** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set\r\n** to be a null pointer.)^\r\n** ^This function sets the [database connection] error code and message\r\n** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related\r\n** functions. ^Note that the *ppBlob variable is always initialized in a\r\n** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob\r\n** regardless of the success or failure of this routine.\r\n**\r\n** ^(If the row that a BLOB handle points to is modified by an\r\n** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects\r\n** then the BLOB handle is marked as \"expired\".\r\n** This is true if any column of the row is changed, even a column\r\n** other than the one the BLOB handle is open on.)^\r\n** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for\r\n** an expired BLOB handle fail with a return code of [SQLITE_ABORT].\r\n** ^(Changes written into a BLOB prior to the BLOB expiring are not\r\n** rolled back by the expiration of the BLOB.  Such changes will eventually\r\n** commit if the transaction continues to completion.)^\r\n**\r\n** ^Use the [sqlite3_blob_bytes()] interface to determine the size of\r\n** the opened blob.  ^The size of a blob may not be changed by this\r\n** interface.  Use the [UPDATE] SQL command to change the size of a\r\n** blob.\r\n**\r\n** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces\r\n** and the built-in [zeroblob] SQL function can be used, if desired,\r\n** to create an empty, zero-filled blob in which to read or write using\r\n** this interface.\r\n**\r\n** To avoid a resource leak, every open [BLOB handle] should eventually\r\n** be released by a call to [sqlite3_blob_close()].\r\n*/\r\nSQLITE_API int sqlite3_blob_open(\r\n  sqlite3*,\r\n  const char *zDb,\r\n  const char *zTable,\r\n  const char *zColumn,\r\n  sqlite3_int64 iRow,\r\n  int flags,\r\n  sqlite3_blob **ppBlob\r\n);\r\n\r\n/*\r\n** CAPI3REF: Move a BLOB Handle to a New Row\r\n**\r\n** ^This function is used to move an existing blob handle so that it points\r\n** to a different row of the same database table. ^The new row is identified\r\n** by the rowid value passed as the second argument. Only the row can be\r\n** changed. ^The database, table and column on which the blob handle is open\r\n** remain the same. Moving an existing blob handle to a new row can be\r\n** faster than closing the existing handle and opening a new one.\r\n**\r\n** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -\r\n** it must exist and there must be either a blob or text value stored in\r\n** the nominated column.)^ ^If the new row is not present in the table, or if\r\n** it does not contain a blob or text value, or if another error occurs, an\r\n** SQLite error code is returned and the blob handle is considered aborted.\r\n** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or\r\n** [sqlite3_blob_reopen()] on an aborted blob handle immediately return\r\n** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle\r\n** always returns zero.\r\n**\r\n** ^This function sets the database handle error code and message.\r\n*/\r\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);\r\n\r\n/*\r\n** CAPI3REF: Close A BLOB Handle\r\n**\r\n** ^Closes an open [BLOB handle].\r\n**\r\n** ^Closing a BLOB shall cause the current transaction to commit\r\n** if there are no other BLOBs, no pending prepared statements, and the\r\n** database connection is in [autocommit mode].\r\n** ^If any writes were made to the BLOB, they might be held in cache\r\n** until the close operation if they will fit.\r\n**\r\n** ^(Closing the BLOB often forces the changes\r\n** out to disk and so if any I/O errors occur, they will likely occur\r\n** at the time when the BLOB is closed.  Any errors that occur during\r\n** closing are reported as a non-zero return value.)^\r\n**\r\n** ^(The BLOB is closed unconditionally.  Even if this routine returns\r\n** an error code, the BLOB is still closed.)^\r\n**\r\n** ^Calling this routine with a null pointer (such as would be returned\r\n** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.\r\n*/\r\nSQLITE_API int sqlite3_blob_close(sqlite3_blob *);\r\n\r\n/*\r\n** CAPI3REF: Return The Size Of An Open BLOB\r\n**\r\n** ^Returns the size in bytes of the BLOB accessible via the \r\n** successfully opened [BLOB handle] in its only argument.  ^The\r\n** incremental blob I/O routines can only read or overwriting existing\r\n** blob content; they cannot change the size of a blob.\r\n**\r\n** This routine only works on a [BLOB handle] which has been created\r\n** by a prior successful call to [sqlite3_blob_open()] and which has not\r\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\r\n** to this routine results in undefined and probably undesirable behavior.\r\n*/\r\nSQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);\r\n\r\n/*\r\n** CAPI3REF: Read Data From A BLOB Incrementally\r\n**\r\n** ^(This function is used to read data from an open [BLOB handle] into a\r\n** caller-supplied buffer. N bytes of data are copied into buffer Z\r\n** from the open BLOB, starting at offset iOffset.)^\r\n**\r\n** ^If offset iOffset is less than N bytes from the end of the BLOB,\r\n** [SQLITE_ERROR] is returned and no data is read.  ^If N or iOffset is\r\n** less than zero, [SQLITE_ERROR] is returned and no data is read.\r\n** ^The size of the blob (and hence the maximum value of N+iOffset)\r\n** can be determined using the [sqlite3_blob_bytes()] interface.\r\n**\r\n** ^An attempt to read from an expired [BLOB handle] fails with an\r\n** error code of [SQLITE_ABORT].\r\n**\r\n** ^(On success, sqlite3_blob_read() returns SQLITE_OK.\r\n** Otherwise, an [error code] or an [extended error code] is returned.)^\r\n**\r\n** This routine only works on a [BLOB handle] which has been created\r\n** by a prior successful call to [sqlite3_blob_open()] and which has not\r\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\r\n** to this routine results in undefined and probably undesirable behavior.\r\n**\r\n** See also: [sqlite3_blob_write()].\r\n*/\r\nSQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);\r\n\r\n/*\r\n** CAPI3REF: Write Data Into A BLOB Incrementally\r\n**\r\n** ^This function is used to write data into an open [BLOB handle] from a\r\n** caller-supplied buffer. ^N bytes of data are copied from the buffer Z\r\n** into the open BLOB, starting at offset iOffset.\r\n**\r\n** ^If the [BLOB handle] passed as the first argument was not opened for\r\n** writing (the flags parameter to [sqlite3_blob_open()] was zero),\r\n** this function returns [SQLITE_READONLY].\r\n**\r\n** ^This function may only modify the contents of the BLOB; it is\r\n** not possible to increase the size of a BLOB using this API.\r\n** ^If offset iOffset is less than N bytes from the end of the BLOB,\r\n** [SQLITE_ERROR] is returned and no data is written.  ^If N is\r\n** less than zero [SQLITE_ERROR] is returned and no data is written.\r\n** The size of the BLOB (and hence the maximum value of N+iOffset)\r\n** can be determined using the [sqlite3_blob_bytes()] interface.\r\n**\r\n** ^An attempt to write to an expired [BLOB handle] fails with an\r\n** error code of [SQLITE_ABORT].  ^Writes to the BLOB that occurred\r\n** before the [BLOB handle] expired are not rolled back by the\r\n** expiration of the handle, though of course those changes might\r\n** have been overwritten by the statement that expired the BLOB handle\r\n** or by other independent statements.\r\n**\r\n** ^(On success, sqlite3_blob_write() returns SQLITE_OK.\r\n** Otherwise, an  [error code] or an [extended error code] is returned.)^\r\n**\r\n** This routine only works on a [BLOB handle] which has been created\r\n** by a prior successful call to [sqlite3_blob_open()] and which has not\r\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\r\n** to this routine results in undefined and probably undesirable behavior.\r\n**\r\n** See also: [sqlite3_blob_read()].\r\n*/\r\nSQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);\r\n\r\n/*\r\n** CAPI3REF: Virtual File System Objects\r\n**\r\n** A virtual filesystem (VFS) is an [sqlite3_vfs] object\r\n** that SQLite uses to interact\r\n** with the underlying operating system.  Most SQLite builds come with a\r\n** single default VFS that is appropriate for the host computer.\r\n** New VFSes can be registered and existing VFSes can be unregistered.\r\n** The following interfaces are provided.\r\n**\r\n** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.\r\n** ^Names are case sensitive.\r\n** ^Names are zero-terminated UTF-8 strings.\r\n** ^If there is no match, a NULL pointer is returned.\r\n** ^If zVfsName is NULL then the default VFS is returned.\r\n**\r\n** ^New VFSes are registered with sqlite3_vfs_register().\r\n** ^Each new VFS becomes the default VFS if the makeDflt flag is set.\r\n** ^The same VFS can be registered multiple times without injury.\r\n** ^To make an existing VFS into the default VFS, register it again\r\n** with the makeDflt flag set.  If two different VFSes with the\r\n** same name are registered, the behavior is undefined.  If a\r\n** VFS is registered with a name that is NULL or an empty string,\r\n** then the behavior is undefined.\r\n**\r\n** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.\r\n** ^(If the default VFS is unregistered, another VFS is chosen as\r\n** the default.  The choice for the new VFS is arbitrary.)^\r\n*/\r\nSQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);\r\nSQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);\r\nSQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);\r\n\r\n/*\r\n** CAPI3REF: Mutexes\r\n**\r\n** The SQLite core uses these routines for thread\r\n** synchronization. Though they are intended for internal\r\n** use by SQLite, code that links against SQLite is\r\n** permitted to use any of these routines.\r\n**\r\n** The SQLite source code contains multiple implementations\r\n** of these mutex routines.  An appropriate implementation\r\n** is selected automatically at compile-time.  ^(The following\r\n** implementations are available in the SQLite core:\r\n**\r\n** <ul>\r\n** <li>   SQLITE_MUTEX_OS2\r\n** <li>   SQLITE_MUTEX_PTHREADS\r\n** <li>   SQLITE_MUTEX_W32\r\n** <li>   SQLITE_MUTEX_NOOP\r\n** </ul>)^\r\n**\r\n** ^The SQLITE_MUTEX_NOOP implementation is a set of routines\r\n** that does no real locking and is appropriate for use in\r\n** a single-threaded application.  ^The SQLITE_MUTEX_OS2,\r\n** SQLITE_MUTEX_PTHREADS, and SQLITE_MUTEX_W32 implementations\r\n** are appropriate for use on OS/2, Unix, and Windows.\r\n**\r\n** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor\r\n** macro defined (with \"-DSQLITE_MUTEX_APPDEF=1\"), then no mutex\r\n** implementation is included with the library. In this case the\r\n** application must supply a custom mutex implementation using the\r\n** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function\r\n** before calling sqlite3_initialize() or any other public sqlite3_\r\n** function that calls sqlite3_initialize().)^\r\n**\r\n** ^The sqlite3_mutex_alloc() routine allocates a new\r\n** mutex and returns a pointer to it. ^If it returns NULL\r\n** that means that a mutex could not be allocated.  ^SQLite\r\n** will unwind its stack and return an error.  ^(The argument\r\n** to sqlite3_mutex_alloc() is one of these integer constants:\r\n**\r\n** <ul>\r\n** <li>  SQLITE_MUTEX_FAST\r\n** <li>  SQLITE_MUTEX_RECURSIVE\r\n** <li>  SQLITE_MUTEX_STATIC_MASTER\r\n** <li>  SQLITE_MUTEX_STATIC_MEM\r\n** <li>  SQLITE_MUTEX_STATIC_MEM2\r\n** <li>  SQLITE_MUTEX_STATIC_PRNG\r\n** <li>  SQLITE_MUTEX_STATIC_LRU\r\n** <li>  SQLITE_MUTEX_STATIC_LRU2\r\n** </ul>)^\r\n**\r\n** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)\r\n** cause sqlite3_mutex_alloc() to create\r\n** a new mutex.  ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\r\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\r\n** The mutex implementation does not need to make a distinction\r\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\r\n** not want to.  ^SQLite will only request a recursive mutex in\r\n** cases where it really needs one.  ^If a faster non-recursive mutex\r\n** implementation is available on the host platform, the mutex subsystem\r\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\r\n**\r\n** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other\r\n** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return\r\n** a pointer to a static preexisting mutex.  ^Six static mutexes are\r\n** used by the current version of SQLite.  Future versions of SQLite\r\n** may add additional static mutexes.  Static mutexes are for internal\r\n** use by SQLite only.  Applications that use SQLite mutexes should\r\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\r\n** SQLITE_MUTEX_RECURSIVE.\r\n**\r\n** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\r\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\r\n** returns a different mutex on every call.  ^But for the static\r\n** mutex types, the same mutex is returned on every call that has\r\n** the same type number.\r\n**\r\n** ^The sqlite3_mutex_free() routine deallocates a previously\r\n** allocated dynamic mutex.  ^SQLite is careful to deallocate every\r\n** dynamic mutex that it allocates.  The dynamic mutexes must not be in\r\n** use when they are deallocated.  Attempting to deallocate a static\r\n** mutex results in undefined behavior.  ^SQLite never deallocates\r\n** a static mutex.\r\n**\r\n** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\r\n** to enter a mutex.  ^If another thread is already within the mutex,\r\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\r\n** SQLITE_BUSY.  ^The sqlite3_mutex_try() interface returns [SQLITE_OK]\r\n** upon successful entry.  ^(Mutexes created using\r\n** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.\r\n** In such cases the,\r\n** mutex must be exited an equal number of times before another thread\r\n** can enter.)^  ^(If the same thread tries to enter any other\r\n** kind of mutex more than once, the behavior is undefined.\r\n** SQLite will never exhibit\r\n** such behavior in its own use of mutexes.)^\r\n**\r\n** ^(Some systems (for example, Windows 95) do not support the operation\r\n** implemented by sqlite3_mutex_try().  On those systems, sqlite3_mutex_try()\r\n** will always return SQLITE_BUSY.  The SQLite core only ever uses\r\n** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^\r\n**\r\n** ^The sqlite3_mutex_leave() routine exits a mutex that was\r\n** previously entered by the same thread.   ^(The behavior\r\n** is undefined if the mutex is not currently entered by the\r\n** calling thread or is not currently allocated.  SQLite will\r\n** never do either.)^\r\n**\r\n** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or\r\n** sqlite3_mutex_leave() is a NULL pointer, then all three routines\r\n** behave as no-ops.\r\n**\r\n** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].\r\n*/\r\nSQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);\r\nSQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);\r\nSQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);\r\nSQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);\r\nSQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);\r\n\r\n/*\r\n** CAPI3REF: Mutex Methods Object\r\n**\r\n** An instance of this structure defines the low-level routines\r\n** used to allocate and use mutexes.\r\n**\r\n** Usually, the default mutex implementations provided by SQLite are\r\n** sufficient, however the user has the option of substituting a custom\r\n** implementation for specialized deployments or systems for which SQLite\r\n** does not provide a suitable implementation. In this case, the user\r\n** creates and populates an instance of this structure to pass\r\n** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.\r\n** Additionally, an instance of this structure can be used as an\r\n** output variable when querying the system for the current mutex\r\n** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.\r\n**\r\n** ^The xMutexInit method defined by this structure is invoked as\r\n** part of system initialization by the sqlite3_initialize() function.\r\n** ^The xMutexInit routine is called by SQLite exactly once for each\r\n** effective call to [sqlite3_initialize()].\r\n**\r\n** ^The xMutexEnd method defined by this structure is invoked as\r\n** part of system shutdown by the sqlite3_shutdown() function. The\r\n** implementation of this method is expected to release all outstanding\r\n** resources obtained by the mutex methods implementation, especially\r\n** those obtained by the xMutexInit method.  ^The xMutexEnd()\r\n** interface is invoked exactly once for each call to [sqlite3_shutdown()].\r\n**\r\n** ^(The remaining seven methods defined by this structure (xMutexAlloc,\r\n** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and\r\n** xMutexNotheld) implement the following interfaces (respectively):\r\n**\r\n** <ul>\r\n**   <li>  [sqlite3_mutex_alloc()] </li>\r\n**   <li>  [sqlite3_mutex_free()] </li>\r\n**   <li>  [sqlite3_mutex_enter()] </li>\r\n**   <li>  [sqlite3_mutex_try()] </li>\r\n**   <li>  [sqlite3_mutex_leave()] </li>\r\n**   <li>  [sqlite3_mutex_held()] </li>\r\n**   <li>  [sqlite3_mutex_notheld()] </li>\r\n** </ul>)^\r\n**\r\n** The only difference is that the public sqlite3_XXX functions enumerated\r\n** above silently ignore any invocations that pass a NULL pointer instead\r\n** of a valid mutex handle. The implementations of the methods defined\r\n** by this structure are not required to handle this case, the results\r\n** of passing a NULL pointer instead of a valid mutex handle are undefined\r\n** (i.e. it is acceptable to provide an implementation that segfaults if\r\n** it is passed a NULL pointer).\r\n**\r\n** The xMutexInit() method must be threadsafe.  ^It must be harmless to\r\n** invoke xMutexInit() multiple times within the same process and without\r\n** intervening calls to xMutexEnd().  Second and subsequent calls to\r\n** xMutexInit() must be no-ops.\r\n**\r\n** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]\r\n** and its associates).  ^Similarly, xMutexAlloc() must not use SQLite memory\r\n** allocation for a static mutex.  ^However xMutexAlloc() may use SQLite\r\n** memory allocation for a fast or recursive mutex.\r\n**\r\n** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is\r\n** called, but only if the prior call to xMutexInit returned SQLITE_OK.\r\n** If xMutexInit fails in any way, it is expected to clean up after itself\r\n** prior to returning.\r\n*/\r\ntypedef struct sqlite3_mutex_methods sqlite3_mutex_methods;\r\nstruct sqlite3_mutex_methods {\r\n  int (*xMutexInit)(void);\r\n  int (*xMutexEnd)(void);\r\n  sqlite3_mutex *(*xMutexAlloc)(int);\r\n  void (*xMutexFree)(sqlite3_mutex *);\r\n  void (*xMutexEnter)(sqlite3_mutex *);\r\n  int (*xMutexTry)(sqlite3_mutex *);\r\n  void (*xMutexLeave)(sqlite3_mutex *);\r\n  int (*xMutexHeld)(sqlite3_mutex *);\r\n  int (*xMutexNotheld)(sqlite3_mutex *);\r\n};\r\n\r\n/*\r\n** CAPI3REF: Mutex Verification Routines\r\n**\r\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines\r\n** are intended for use inside assert() statements.  ^The SQLite core\r\n** never uses these routines except inside an assert() and applications\r\n** are advised to follow the lead of the core.  ^The SQLite core only\r\n** provides implementations for these routines when it is compiled\r\n** with the SQLITE_DEBUG flag.  ^External mutex implementations\r\n** are only required to provide these routines if SQLITE_DEBUG is\r\n** defined and if NDEBUG is not defined.\r\n**\r\n** ^These routines should return true if the mutex in their argument\r\n** is held or not held, respectively, by the calling thread.\r\n**\r\n** ^The implementation is not required to provide versions of these\r\n** routines that actually work. If the implementation does not provide working\r\n** versions of these routines, it should at least provide stubs that always\r\n** return true so that one does not get spurious assertion failures.\r\n**\r\n** ^If the argument to sqlite3_mutex_held() is a NULL pointer then\r\n** the routine should return 1.   This seems counter-intuitive since\r\n** clearly the mutex cannot be held if it does not exist.  But\r\n** the reason the mutex does not exist is because the build is not\r\n** using mutexes.  And we do not want the assert() containing the\r\n** call to sqlite3_mutex_held() to fail, so a non-zero return is\r\n** the appropriate thing to do.  ^The sqlite3_mutex_notheld()\r\n** interface should also return 1 when given a NULL pointer.\r\n*/\r\n#ifndef NDEBUG\r\nSQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);\r\nSQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);\r\n#endif\r\n\r\n/*\r\n** CAPI3REF: Mutex Types\r\n**\r\n** The [sqlite3_mutex_alloc()] interface takes a single argument\r\n** which is one of these integer constants.\r\n**\r\n** The set of static mutexes may change from one SQLite release to the\r\n** next.  Applications that override the built-in mutex logic must be\r\n** prepared to accommodate additional static mutexes.\r\n*/\r\n#define SQLITE_MUTEX_FAST             0\r\n#define SQLITE_MUTEX_RECURSIVE        1\r\n#define SQLITE_MUTEX_STATIC_MASTER    2\r\n#define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */\r\n#define SQLITE_MUTEX_STATIC_MEM2      4  /* NOT USED */\r\n#define SQLITE_MUTEX_STATIC_OPEN      4  /* sqlite3BtreeOpen() */\r\n#define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */\r\n#define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */\r\n#define SQLITE_MUTEX_STATIC_LRU2      7  /* NOT USED */\r\n#define SQLITE_MUTEX_STATIC_PMEM      7  /* sqlite3PageMalloc() */\r\n\r\n/*\r\n** CAPI3REF: Retrieve the mutex for a database connection\r\n**\r\n** ^This interface returns a pointer the [sqlite3_mutex] object that \r\n** serializes access to the [database connection] given in the argument\r\n** when the [threading mode] is Serialized.\r\n** ^If the [threading mode] is Single-thread or Multi-thread then this\r\n** routine returns a NULL pointer.\r\n*/\r\nSQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);\r\n\r\n/*\r\n** CAPI3REF: Low-Level Control Of Database Files\r\n**\r\n** ^The [sqlite3_file_control()] interface makes a direct call to the\r\n** xFileControl method for the [sqlite3_io_methods] object associated\r\n** with a particular database identified by the second argument. ^The\r\n** name of the database is \"main\" for the main database or \"temp\" for the\r\n** TEMP database, or the name that appears after the AS keyword for\r\n** databases that are added using the [ATTACH] SQL command.\r\n** ^A NULL pointer can be used in place of \"main\" to refer to the\r\n** main database file.\r\n** ^The third and fourth parameters to this routine\r\n** are passed directly through to the second and third parameters of\r\n** the xFileControl method.  ^The return value of the xFileControl\r\n** method becomes the return value of this routine.\r\n**\r\n** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes\r\n** a pointer to the underlying [sqlite3_file] object to be written into\r\n** the space pointed to by the 4th parameter.  ^The SQLITE_FCNTL_FILE_POINTER\r\n** case is a short-circuit path which does not actually invoke the\r\n** underlying sqlite3_io_methods.xFileControl method.\r\n**\r\n** ^If the second parameter (zDbName) does not match the name of any\r\n** open database file, then SQLITE_ERROR is returned.  ^This error\r\n** code is not remembered and will not be recalled by [sqlite3_errcode()]\r\n** or [sqlite3_errmsg()].  The underlying xFileControl method might\r\n** also return SQLITE_ERROR.  There is no way to distinguish between\r\n** an incorrect zDbName and an SQLITE_ERROR return from the underlying\r\n** xFileControl method.\r\n**\r\n** See also: [SQLITE_FCNTL_LOCKSTATE]\r\n*/\r\nSQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);\r\n\r\n/*\r\n** CAPI3REF: Testing Interface\r\n**\r\n** ^The sqlite3_test_control() interface is used to read out internal\r\n** state of SQLite and to inject faults into SQLite for testing\r\n** purposes.  ^The first parameter is an operation code that determines\r\n** the number, meaning, and operation of all subsequent parameters.\r\n**\r\n** This interface is not for use by applications.  It exists solely\r\n** for verifying the correct operation of the SQLite library.  Depending\r\n** on how the SQLite library is compiled, this interface might not exist.\r\n**\r\n** The details of the operation codes, their meanings, the parameters\r\n** they take, and what they do are all subject to change without notice.\r\n** Unlike most of the SQLite API, this function is not guaranteed to\r\n** operate consistently from one release to the next.\r\n*/\r\nSQLITE_API int sqlite3_test_control(int op, ...);\r\n\r\n/*\r\n** CAPI3REF: Testing Interface Operation Codes\r\n**\r\n** These constants are the valid operation code parameters used\r\n** as the first argument to [sqlite3_test_control()].\r\n**\r\n** These parameters and their meanings are subject to change\r\n** without notice.  These values are for testing purposes only.\r\n** Applications should not use any of these parameters or the\r\n** [sqlite3_test_control()] interface.\r\n*/\r\n#define SQLITE_TESTCTRL_FIRST                    5\r\n#define SQLITE_TESTCTRL_PRNG_SAVE                5\r\n#define SQLITE_TESTCTRL_PRNG_RESTORE             6\r\n#define SQLITE_TESTCTRL_PRNG_RESET               7\r\n#define SQLITE_TESTCTRL_BITVEC_TEST              8\r\n#define SQLITE_TESTCTRL_FAULT_INSTALL            9\r\n#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10\r\n#define SQLITE_TESTCTRL_PENDING_BYTE            11\r\n#define SQLITE_TESTCTRL_ASSERT                  12\r\n#define SQLITE_TESTCTRL_ALWAYS                  13\r\n#define SQLITE_TESTCTRL_RESERVE                 14\r\n#define SQLITE_TESTCTRL_OPTIMIZATIONS           15\r\n#define SQLITE_TESTCTRL_ISKEYWORD               16\r\n#define SQLITE_TESTCTRL_SCRATCHMALLOC           17\r\n#define SQLITE_TESTCTRL_LOCALTIME_FAULT         18\r\n#define SQLITE_TESTCTRL_EXPLAIN_STMT            19\r\n#define SQLITE_TESTCTRL_LAST                    19\r\n\r\n/*\r\n** CAPI3REF: SQLite Runtime Status\r\n**\r\n** ^This interface is used to retrieve runtime status information\r\n** about the performance of SQLite, and optionally to reset various\r\n** highwater marks.  ^The first argument is an integer code for\r\n** the specific parameter to measure.  ^(Recognized integer codes\r\n** are of the form [status parameters | SQLITE_STATUS_...].)^\r\n** ^The current value of the parameter is returned into *pCurrent.\r\n** ^The highest recorded value is returned in *pHighwater.  ^If the\r\n** resetFlag is true, then the highest record value is reset after\r\n** *pHighwater is written.  ^(Some parameters do not record the highest\r\n** value.  For those parameters\r\n** nothing is written into *pHighwater and the resetFlag is ignored.)^\r\n** ^(Other parameters record only the highwater mark and not the current\r\n** value.  For these latter parameters nothing is written into *pCurrent.)^\r\n**\r\n** ^The sqlite3_status() routine returns SQLITE_OK on success and a\r\n** non-zero [error code] on failure.\r\n**\r\n** This routine is threadsafe but is not atomic.  This routine can be\r\n** called while other threads are running the same or different SQLite\r\n** interfaces.  However the values returned in *pCurrent and\r\n** *pHighwater reflect the status of SQLite at different points in time\r\n** and it is possible that another thread might change the parameter\r\n** in between the times when *pCurrent and *pHighwater are written.\r\n**\r\n** See also: [sqlite3_db_status()]\r\n*/\r\nSQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);\r\n\r\n\r\n/*\r\n** CAPI3REF: Status Parameters\r\n** KEYWORDS: {status parameters}\r\n**\r\n** These integer constants designate various run-time status parameters\r\n** that can be returned by [sqlite3_status()].\r\n**\r\n** <dl>\r\n** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>\r\n** <dd>This parameter is the current amount of memory checked out\r\n** using [sqlite3_malloc()], either directly or indirectly.  The\r\n** figure includes calls made to [sqlite3_malloc()] by the application\r\n** and internal memory usage by the SQLite library.  Scratch memory\r\n** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache\r\n** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in\r\n** this parameter.  The amount returned is the sum of the allocation\r\n** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^\r\n**\r\n** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>\r\n** <dd>This parameter records the largest memory allocation request\r\n** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their\r\n** internal equivalents).  Only the value returned in the\r\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \r\n** The value written into the *pCurrent parameter is undefined.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_MALLOC_COUNT]] ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>\r\n** <dd>This parameter records the number of separate memory allocations\r\n** currently checked out.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PAGECACHE_USED]] ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>\r\n** <dd>This parameter returns the number of pages used out of the\r\n** [pagecache memory allocator] that was configured using \r\n** [SQLITE_CONFIG_PAGECACHE].  The\r\n** value returned is in pages, not in bytes.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] \r\n** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>\r\n** <dd>This parameter returns the number of bytes of page cache\r\n** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]\r\n** buffer and where forced to overflow to [sqlite3_malloc()].  The\r\n** returned value includes allocations that overflowed because they\r\n** where too large (they were larger than the \"sz\" parameter to\r\n** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because\r\n** no space was left in the page cache.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>\r\n** <dd>This parameter records the largest memory allocation request\r\n** handed to [pagecache memory allocator].  Only the value returned in the\r\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \r\n** The value written into the *pCurrent parameter is undefined.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>\r\n** <dd>This parameter returns the number of allocations used out of the\r\n** [scratch memory allocator] configured using\r\n** [SQLITE_CONFIG_SCRATCH].  The value returned is in allocations, not\r\n** in bytes.  Since a single thread may only have one scratch allocation\r\n** outstanding at time, this parameter also reports the number of threads\r\n** using scratch memory at the same time.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>\r\n** <dd>This parameter returns the number of bytes of scratch memory\r\n** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]\r\n** buffer and where forced to overflow to [sqlite3_malloc()].  The values\r\n** returned include overflows because the requested allocation was too\r\n** larger (that is, because the requested allocation was larger than the\r\n** \"sz\" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer\r\n** slots were available.\r\n** </dd>)^\r\n**\r\n** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>\r\n** <dd>This parameter records the largest memory allocation request\r\n** handed to [scratch memory allocator].  Only the value returned in the\r\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \r\n** The value written into the *pCurrent parameter is undefined.</dd>)^\r\n**\r\n** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>\r\n** <dd>This parameter records the deepest parser stack.  It is only\r\n** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^\r\n** </dl>\r\n**\r\n** New status parameters may be added from time to time.\r\n*/\r\n#define SQLITE_STATUS_MEMORY_USED          0\r\n#define SQLITE_STATUS_PAGECACHE_USED       1\r\n#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2\r\n#define SQLITE_STATUS_SCRATCH_USED         3\r\n#define SQLITE_STATUS_SCRATCH_OVERFLOW     4\r\n#define SQLITE_STATUS_MALLOC_SIZE          5\r\n#define SQLITE_STATUS_PARSER_STACK         6\r\n#define SQLITE_STATUS_PAGECACHE_SIZE       7\r\n#define SQLITE_STATUS_SCRATCH_SIZE         8\r\n#define SQLITE_STATUS_MALLOC_COUNT         9\r\n\r\n/*\r\n** CAPI3REF: Database Connection Status\r\n**\r\n** ^This interface is used to retrieve runtime status information \r\n** about a single [database connection].  ^The first argument is the\r\n** database connection object to be interrogated.  ^The second argument\r\n** is an integer constant, taken from the set of\r\n** [SQLITE_DBSTATUS options], that\r\n** determines the parameter to interrogate.  The set of \r\n** [SQLITE_DBSTATUS options] is likely\r\n** to grow in future releases of SQLite.\r\n**\r\n** ^The current value of the requested parameter is written into *pCur\r\n** and the highest instantaneous value is written into *pHiwtr.  ^If\r\n** the resetFlg is true, then the highest instantaneous value is\r\n** reset back down to the current value.\r\n**\r\n** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a\r\n** non-zero [error code] on failure.\r\n**\r\n** See also: [sqlite3_status()] and [sqlite3_stmt_status()].\r\n*/\r\nSQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);\r\n\r\n/*\r\n** CAPI3REF: Status Parameters for database connections\r\n** KEYWORDS: {SQLITE_DBSTATUS options}\r\n**\r\n** These constants are the available integer \"verbs\" that can be passed as\r\n** the second argument to the [sqlite3_db_status()] interface.\r\n**\r\n** New verbs may be added in future releases of SQLite. Existing verbs\r\n** might be discontinued. Applications should check the return code from\r\n** [sqlite3_db_status()] to make sure that the call worked.\r\n** The [sqlite3_db_status()] interface will return a non-zero error code\r\n** if a discontinued or unsupported verb is invoked.\r\n**\r\n** <dl>\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>\r\n** <dd>This parameter returns the number of lookaside memory slots currently\r\n** checked out.</dd>)^\r\n**\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>\r\n** <dd>This parameter returns the number malloc attempts that were \r\n** satisfied using lookaside memory. Only the high-water value is meaningful;\r\n** the current value is always zero.)^\r\n**\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]\r\n** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>\r\n** <dd>This parameter returns the number malloc attempts that might have\r\n** been satisfied using lookaside memory but failed due to the amount of\r\n** memory requested being larger than the lookaside slot size.\r\n** Only the high-water value is meaningful;\r\n** the current value is always zero.)^\r\n**\r\n** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]\r\n** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>\r\n** <dd>This parameter returns the number malloc attempts that might have\r\n** been satisfied using lookaside memory but failed due to all lookaside\r\n** memory already being in use.\r\n** Only the high-water value is meaningful;\r\n** the current value is always zero.)^\r\n**\r\n** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>\r\n** <dd>This parameter returns the approximate number of of bytes of heap\r\n** memory used by all pager caches associated with the database connection.)^\r\n** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.\r\n**\r\n** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>\r\n** <dd>This parameter returns the approximate number of of bytes of heap\r\n** memory used to store the schema for all databases associated\r\n** with the connection - main, temp, and any [ATTACH]-ed databases.)^ \r\n** ^The full amount of memory used by the schemas is reported, even if the\r\n** schema memory is shared with other database connections due to\r\n** [shared cache mode] being enabled.\r\n** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.\r\n**\r\n** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>\r\n** <dd>This parameter returns the approximate number of of bytes of heap\r\n** and lookaside memory used by all prepared statements associated with\r\n** the database connection.)^\r\n** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.\r\n** </dd>\r\n**\r\n** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>\r\n** <dd>This parameter returns the number of pager cache hits that have\r\n** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT \r\n** is always 0.\r\n** </dd>\r\n**\r\n** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>\r\n** <dd>This parameter returns the number of pager cache misses that have\r\n** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS \r\n** is always 0.\r\n** </dd>\r\n** </dl>\r\n*/\r\n#define SQLITE_DBSTATUS_LOOKASIDE_USED       0\r\n#define SQLITE_DBSTATUS_CACHE_USED           1\r\n#define SQLITE_DBSTATUS_SCHEMA_USED          2\r\n#define SQLITE_DBSTATUS_STMT_USED            3\r\n#define SQLITE_DBSTATUS_LOOKASIDE_HIT        4\r\n#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE  5\r\n#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL  6\r\n#define SQLITE_DBSTATUS_CACHE_HIT            7\r\n#define SQLITE_DBSTATUS_CACHE_MISS           8\r\n#define SQLITE_DBSTATUS_MAX                  8   /* Largest defined DBSTATUS */\r\n\r\n\r\n/*\r\n** CAPI3REF: Prepared Statement Status\r\n**\r\n** ^(Each prepared statement maintains various\r\n** [SQLITE_STMTSTATUS counters] that measure the number\r\n** of times it has performed specific operations.)^  These counters can\r\n** be used to monitor the performance characteristics of the prepared\r\n** statements.  For example, if the number of table steps greatly exceeds\r\n** the number of table searches or result rows, that would tend to indicate\r\n** that the prepared statement is using a full table scan rather than\r\n** an index.  \r\n**\r\n** ^(This interface is used to retrieve and reset counter values from\r\n** a [prepared statement].  The first argument is the prepared statement\r\n** object to be interrogated.  The second argument\r\n** is an integer code for a specific [SQLITE_STMTSTATUS counter]\r\n** to be interrogated.)^\r\n** ^The current value of the requested counter is returned.\r\n** ^If the resetFlg is true, then the counter is reset to zero after this\r\n** interface call returns.\r\n**\r\n** See also: [sqlite3_status()] and [sqlite3_db_status()].\r\n*/\r\nSQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);\r\n\r\n/*\r\n** CAPI3REF: Status Parameters for prepared statements\r\n** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}\r\n**\r\n** These preprocessor macros define integer codes that name counter\r\n** values associated with the [sqlite3_stmt_status()] interface.\r\n** The meanings of the various counters are as follows:\r\n**\r\n** <dl>\r\n** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>\r\n** <dd>^This is the number of times that SQLite has stepped forward in\r\n** a table as part of a full table scan.  Large numbers for this counter\r\n** may indicate opportunities for performance improvement through \r\n** careful use of indices.</dd>\r\n**\r\n** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>\r\n** <dd>^This is the number of sort operations that have occurred.\r\n** A non-zero value in this counter may indicate an opportunity to\r\n** improvement performance through careful use of indices.</dd>\r\n**\r\n** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>\r\n** <dd>^This is the number of rows inserted into transient indices that\r\n** were created automatically in order to help joins run faster.\r\n** A non-zero value in this counter may indicate an opportunity to\r\n** improvement performance by adding permanent indices that do not\r\n** need to be reinitialized each time the statement is run.</dd>\r\n** </dl>\r\n*/\r\n#define SQLITE_STMTSTATUS_FULLSCAN_STEP     1\r\n#define SQLITE_STMTSTATUS_SORT              2\r\n#define SQLITE_STMTSTATUS_AUTOINDEX         3\r\n\r\n/*\r\n** CAPI3REF: Custom Page Cache Object\r\n**\r\n** The sqlite3_pcache type is opaque.  It is implemented by\r\n** the pluggable module.  The SQLite core has no knowledge of\r\n** its size or internal structure and never deals with the\r\n** sqlite3_pcache object except by holding and passing pointers\r\n** to the object.\r\n**\r\n** See [sqlite3_pcache_methods2] for additional information.\r\n*/\r\ntypedef struct sqlite3_pcache sqlite3_pcache;\r\n\r\n/*\r\n** CAPI3REF: Custom Page Cache Object\r\n**\r\n** The sqlite3_pcache_page object represents a single page in the\r\n** page cache.  The page cache will allocate instances of this\r\n** object.  Various methods of the page cache use pointers to instances\r\n** of this object as parameters or as their return value.\r\n**\r\n** See [sqlite3_pcache_methods2] for additional information.\r\n*/\r\ntypedef struct sqlite3_pcache_page sqlite3_pcache_page;\r\nstruct sqlite3_pcache_page {\r\n  void *pBuf;        /* The content of the page */\r\n  void *pExtra;      /* Extra information associated with the page */\r\n};\r\n\r\n/*\r\n** CAPI3REF: Application Defined Page Cache.\r\n** KEYWORDS: {page cache}\r\n**\r\n** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can\r\n** register an alternative page cache implementation by passing in an \r\n** instance of the sqlite3_pcache_methods2 structure.)^\r\n** In many applications, most of the heap memory allocated by \r\n** SQLite is used for the page cache.\r\n** By implementing a \r\n** custom page cache using this API, an application can better control\r\n** the amount of memory consumed by SQLite, the way in which \r\n** that memory is allocated and released, and the policies used to \r\n** determine exactly which parts of a database file are cached and for \r\n** how long.\r\n**\r\n** The alternative page cache mechanism is an\r\n** extreme measure that is only needed by the most demanding applications.\r\n** The built-in page cache is recommended for most uses.\r\n**\r\n** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an\r\n** internal buffer by SQLite within the call to [sqlite3_config].  Hence\r\n** the application may discard the parameter after the call to\r\n** [sqlite3_config()] returns.)^\r\n**\r\n** [[the xInit() page cache method]]\r\n** ^(The xInit() method is called once for each effective \r\n** call to [sqlite3_initialize()])^\r\n** (usually only once during the lifetime of the process). ^(The xInit()\r\n** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^\r\n** The intent of the xInit() method is to set up global data structures \r\n** required by the custom page cache implementation. \r\n** ^(If the xInit() method is NULL, then the \r\n** built-in default page cache is used instead of the application defined\r\n** page cache.)^\r\n**\r\n** [[the xShutdown() page cache method]]\r\n** ^The xShutdown() method is called by [sqlite3_shutdown()].\r\n** It can be used to clean up \r\n** any outstanding resources before process shutdown, if required.\r\n** ^The xShutdown() method may be NULL.\r\n**\r\n** ^SQLite automatically serializes calls to the xInit method,\r\n** so the xInit method need not be threadsafe.  ^The\r\n** xShutdown method is only called from [sqlite3_shutdown()] so it does\r\n** not need to be threadsafe either.  All other methods must be threadsafe\r\n** in multithreaded applications.\r\n**\r\n** ^SQLite will never invoke xInit() more than once without an intervening\r\n** call to xShutdown().\r\n**\r\n** [[the xCreate() page cache methods]]\r\n** ^SQLite invokes the xCreate() method to construct a new cache instance.\r\n** SQLite will typically create one cache instance for each open database file,\r\n** though this is not guaranteed. ^The\r\n** first parameter, szPage, is the size in bytes of the pages that must\r\n** be allocated by the cache.  ^szPage will always a power of two.  ^The\r\n** second parameter szExtra is a number of bytes of extra storage \r\n** associated with each page cache entry.  ^The szExtra parameter will\r\n** a number less than 250.  SQLite will use the\r\n** extra szExtra bytes on each page to store metadata about the underlying\r\n** database page on disk.  The value passed into szExtra depends\r\n** on the SQLite version, the target platform, and how SQLite was compiled.\r\n** ^The third argument to xCreate(), bPurgeable, is true if the cache being\r\n** created will be used to cache database pages of a file stored on disk, or\r\n** false if it is used for an in-memory database. The cache implementation\r\n** does not have to do anything special based with the value of bPurgeable;\r\n** it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will\r\n** never invoke xUnpin() except to deliberately delete a page.\r\n** ^In other words, calls to xUnpin() on a cache with bPurgeable set to\r\n** false will always have the \"discard\" flag set to true.  \r\n** ^Hence, a cache created with bPurgeable false will\r\n** never contain any unpinned pages.\r\n**\r\n** [[the xCachesize() page cache method]]\r\n** ^(The xCachesize() method may be called at any time by SQLite to set the\r\n** suggested maximum cache-size (number of pages stored by) the cache\r\n** instance passed as the first argument. This is the value configured using\r\n** the SQLite \"[PRAGMA cache_size]\" command.)^  As with the bPurgeable\r\n** parameter, the implementation is not required to do anything with this\r\n** value; it is advisory only.\r\n**\r\n** [[the xPagecount() page cache methods]]\r\n** The xPagecount() method must return the number of pages currently\r\n** stored in the cache, both pinned and unpinned.\r\n** \r\n** [[the xFetch() page cache methods]]\r\n** The xFetch() method locates a page in the cache and returns a pointer to \r\n** an sqlite3_pcache_page object associated with that page, or a NULL pointer.\r\n** The pBuf element of the returned sqlite3_pcache_page object will be a\r\n** pointer to a buffer of szPage bytes used to store the content of a \r\n** single database page.  The pExtra element of sqlite3_pcache_page will be\r\n** a pointer to the szExtra bytes of extra storage that SQLite has requested\r\n** for each entry in the page cache.\r\n**\r\n** The page to be fetched is determined by the key. ^The minimum key value\r\n** is 1.  After it has been retrieved using xFetch, the page is considered\r\n** to be \"pinned\".\r\n**\r\n** If the requested page is already in the page cache, then the page cache\r\n** implementation must return a pointer to the page buffer with its content\r\n** intact.  If the requested page is not already in the cache, then the\r\n** cache implementation should use the value of the createFlag\r\n** parameter to help it determined what action to take:\r\n**\r\n** <table border=1 width=85% align=center>\r\n** <tr><th> createFlag <th> Behaviour when page is not already in cache\r\n** <tr><td> 0 <td> Do not allocate a new page.  Return NULL.\r\n** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.\r\n**                 Otherwise return NULL.\r\n** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return\r\n**                 NULL if allocating a new page is effectively impossible.\r\n** </table>\r\n**\r\n** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite\r\n** will only use a createFlag of 2 after a prior call with a createFlag of 1\r\n** failed.)^  In between the to xFetch() calls, SQLite may\r\n** attempt to unpin one or more cache pages by spilling the content of\r\n** pinned pages to disk and synching the operating system disk cache.\r\n**\r\n** [[the xUnpin() page cache method]]\r\n** ^xUnpin() is called by SQLite with a pointer to a currently pinned page\r\n** as its second argument.  If the third parameter, discard, is non-zero,\r\n** then the page must be evicted from the cache.\r\n** ^If the discard parameter is\r\n** zero, then the page may be discarded or retained at the discretion of\r\n** page cache implementation. ^The page cache implementation\r\n** may choose to evict unpinned pages at any time.\r\n**\r\n** The cache must not perform any reference counting. A single \r\n** call to xUnpin() unpins the page regardless of the number of prior calls \r\n** to xFetch().\r\n**\r\n** [[the xRekey() page cache methods]]\r\n** The xRekey() method is used to change the key value associated with the\r\n** page passed as the second argument. If the cache\r\n** previously contains an entry associated with newKey, it must be\r\n** discarded. ^Any prior cache entry associated with newKey is guaranteed not\r\n** to be pinned.\r\n**\r\n** When SQLite calls the xTruncate() method, the cache must discard all\r\n** existing cache entries with page numbers (keys) greater than or equal\r\n** to the value of the iLimit parameter passed to xTruncate(). If any\r\n** of these pages are pinned, they are implicitly unpinned, meaning that\r\n** they can be safely discarded.\r\n**\r\n** [[the xDestroy() page cache method]]\r\n** ^The xDestroy() method is used to delete a cache allocated by xCreate().\r\n** All resources associated with the specified cache should be freed. ^After\r\n** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]\r\n** handle invalid, and will not use it with any other sqlite3_pcache_methods2\r\n** functions.\r\n**\r\n** [[the xShrink() page cache method]]\r\n** ^SQLite invokes the xShrink() method when it wants the page cache to\r\n** free up as much of heap memory as possible.  The page cache implementation\r\n** is not obligated to free any memory, but well-behaved implementations should\r\n** do their best.\r\n*/\r\ntypedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;\r\nstruct sqlite3_pcache_methods2 {\r\n  int iVersion;\r\n  void *pArg;\r\n  int (*xInit)(void*);\r\n  void (*xShutdown)(void*);\r\n  sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);\r\n  void (*xCachesize)(sqlite3_pcache*, int nCachesize);\r\n  int (*xPagecount)(sqlite3_pcache*);\r\n  sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);\r\n  void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);\r\n  void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, \r\n      unsigned oldKey, unsigned newKey);\r\n  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);\r\n  void (*xDestroy)(sqlite3_pcache*);\r\n  void (*xShrink)(sqlite3_pcache*);\r\n};\r\n\r\n/*\r\n** This is the obsolete pcache_methods object that has now been replaced\r\n** by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is\r\n** retained in the header file for backwards compatibility only.\r\n*/\r\ntypedef struct sqlite3_pcache_methods sqlite3_pcache_methods;\r\nstruct sqlite3_pcache_methods {\r\n  void *pArg;\r\n  int (*xInit)(void*);\r\n  void (*xShutdown)(void*);\r\n  sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);\r\n  void (*xCachesize)(sqlite3_pcache*, int nCachesize);\r\n  int (*xPagecount)(sqlite3_pcache*);\r\n  void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);\r\n  void (*xUnpin)(sqlite3_pcache*, void*, int discard);\r\n  void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);\r\n  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);\r\n  void (*xDestroy)(sqlite3_pcache*);\r\n};\r\n\r\n\r\n/*\r\n** CAPI3REF: Online Backup Object\r\n**\r\n** The sqlite3_backup object records state information about an ongoing\r\n** online backup operation.  ^The sqlite3_backup object is created by\r\n** a call to [sqlite3_backup_init()] and is destroyed by a call to\r\n** [sqlite3_backup_finish()].\r\n**\r\n** See Also: [Using the SQLite Online Backup API]\r\n*/\r\ntypedef struct sqlite3_backup sqlite3_backup;\r\n\r\n/*\r\n** CAPI3REF: Online Backup API.\r\n**\r\n** The backup API copies the content of one database into another.\r\n** It is useful either for creating backups of databases or\r\n** for copying in-memory databases to or from persistent files. \r\n**\r\n** See Also: [Using the SQLite Online Backup API]\r\n**\r\n** ^SQLite holds a write transaction open on the destination database file\r\n** for the duration of the backup operation.\r\n** ^The source database is read-locked only while it is being read;\r\n** it is not locked continuously for the entire backup operation.\r\n** ^Thus, the backup may be performed on a live source database without\r\n** preventing other database connections from\r\n** reading or writing to the source database while the backup is underway.\r\n** \r\n** ^(To perform a backup operation: \r\n**   <ol>\r\n**     <li><b>sqlite3_backup_init()</b> is called once to initialize the\r\n**         backup, \r\n**     <li><b>sqlite3_backup_step()</b> is called one or more times to transfer \r\n**         the data between the two databases, and finally\r\n**     <li><b>sqlite3_backup_finish()</b> is called to release all resources \r\n**         associated with the backup operation. \r\n**   </ol>)^\r\n** There should be exactly one call to sqlite3_backup_finish() for each\r\n** successful call to sqlite3_backup_init().\r\n**\r\n** [[sqlite3_backup_init()]] <b>sqlite3_backup_init()</b>\r\n**\r\n** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the \r\n** [database connection] associated with the destination database \r\n** and the database name, respectively.\r\n** ^The database name is \"main\" for the main database, \"temp\" for the\r\n** temporary database, or the name specified after the AS keyword in\r\n** an [ATTACH] statement for an attached database.\r\n** ^The S and M arguments passed to \r\n** sqlite3_backup_init(D,N,S,M) identify the [database connection]\r\n** and database name of the source database, respectively.\r\n** ^The source and destination [database connections] (parameters S and D)\r\n** must be different or else sqlite3_backup_init(D,N,S,M) will fail with\r\n** an error.\r\n**\r\n** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is\r\n** returned and an error code and error message are stored in the\r\n** destination [database connection] D.\r\n** ^The error code and message for the failed call to sqlite3_backup_init()\r\n** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or\r\n** [sqlite3_errmsg16()] functions.\r\n** ^A successful call to sqlite3_backup_init() returns a pointer to an\r\n** [sqlite3_backup] object.\r\n** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and\r\n** sqlite3_backup_finish() functions to perform the specified backup \r\n** operation.\r\n**\r\n** [[sqlite3_backup_step()]] <b>sqlite3_backup_step()</b>\r\n**\r\n** ^Function sqlite3_backup_step(B,N) will copy up to N pages between \r\n** the source and destination databases specified by [sqlite3_backup] object B.\r\n** ^If N is negative, all remaining source pages are copied. \r\n** ^If sqlite3_backup_step(B,N) successfully copies N pages and there\r\n** are still more pages to be copied, then the function returns [SQLITE_OK].\r\n** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages\r\n** from source to destination, then it returns [SQLITE_DONE].\r\n** ^If an error occurs while running sqlite3_backup_step(B,N),\r\n** then an [error code] is returned. ^As well as [SQLITE_OK] and\r\n** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],\r\n** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an\r\n** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.\r\n**\r\n** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if\r\n** <ol>\r\n** <li> the destination database was opened read-only, or\r\n** <li> the destination database is using write-ahead-log journaling\r\n** and the destination and source page sizes differ, or\r\n** <li> the destination database is an in-memory database and the\r\n** destination and source page sizes differ.\r\n** </ol>)^\r\n**\r\n** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then\r\n** the [sqlite3_busy_handler | busy-handler function]\r\n** is invoked (if one is specified). ^If the \r\n** busy-handler returns non-zero before the lock is available, then \r\n** [SQLITE_BUSY] is returned to the caller. ^In this case the call to\r\n** sqlite3_backup_step() can be retried later. ^If the source\r\n** [database connection]\r\n** is being used to write to the source database when sqlite3_backup_step()\r\n** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this\r\n** case the call to sqlite3_backup_step() can be retried later on. ^(If\r\n** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or\r\n** [SQLITE_READONLY] is returned, then \r\n** there is no point in retrying the call to sqlite3_backup_step(). These \r\n** errors are considered fatal.)^  The application must accept \r\n** that the backup operation has failed and pass the backup operation handle \r\n** to the sqlite3_backup_finish() to release associated resources.\r\n**\r\n** ^The first call to sqlite3_backup_step() obtains an exclusive lock\r\n** on the destination file. ^The exclusive lock is not released until either \r\n** sqlite3_backup_finish() is called or the backup operation is complete \r\n** and sqlite3_backup_step() returns [SQLITE_DONE].  ^Every call to\r\n** sqlite3_backup_step() obtains a [shared lock] on the source database that\r\n** lasts for the duration of the sqlite3_backup_step() call.\r\n** ^Because the source database is not locked between calls to\r\n** sqlite3_backup_step(), the source database may be modified mid-way\r\n** through the backup process.  ^If the source database is modified by an\r\n** external process or via a database connection other than the one being\r\n** used by the backup operation, then the backup will be automatically\r\n** restarted by the next call to sqlite3_backup_step(). ^If the source \r\n** database is modified by the using the same database connection as is used\r\n** by the backup operation, then the backup database is automatically\r\n** updated at the same time.\r\n**\r\n** [[sqlite3_backup_finish()]] <b>sqlite3_backup_finish()</b>\r\n**\r\n** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the \r\n** application wishes to abandon the backup operation, the application\r\n** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().\r\n** ^The sqlite3_backup_finish() interfaces releases all\r\n** resources associated with the [sqlite3_backup] object. \r\n** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any\r\n** active write-transaction on the destination database is rolled back.\r\n** The [sqlite3_backup] object is invalid\r\n** and may not be used following a call to sqlite3_backup_finish().\r\n**\r\n** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no\r\n** sqlite3_backup_step() errors occurred, regardless or whether or not\r\n** sqlite3_backup_step() completed.\r\n** ^If an out-of-memory condition or IO error occurred during any prior\r\n** sqlite3_backup_step() call on the same [sqlite3_backup] object, then\r\n** sqlite3_backup_finish() returns the corresponding [error code].\r\n**\r\n** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()\r\n** is not a permanent error and does not affect the return value of\r\n** sqlite3_backup_finish().\r\n**\r\n** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]]\r\n** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>\r\n**\r\n** ^Each call to sqlite3_backup_step() sets two values inside\r\n** the [sqlite3_backup] object: the number of pages still to be backed\r\n** up and the total number of pages in the source database file.\r\n** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces\r\n** retrieve these two values, respectively.\r\n**\r\n** ^The values returned by these functions are only updated by\r\n** sqlite3_backup_step(). ^If the source database is modified during a backup\r\n** operation, then the values are not updated to account for any extra\r\n** pages that need to be updated or the size of the source database file\r\n** changing.\r\n**\r\n** <b>Concurrent Usage of Database Handles</b>\r\n**\r\n** ^The source [database connection] may be used by the application for other\r\n** purposes while a backup operation is underway or being initialized.\r\n** ^If SQLite is compiled and configured to support threadsafe database\r\n** connections, then the source database connection may be used concurrently\r\n** from within other threads.\r\n**\r\n** However, the application must guarantee that the destination \r\n** [database connection] is not passed to any other API (by any thread) after \r\n** sqlite3_backup_init() is called and before the corresponding call to\r\n** sqlite3_backup_finish().  SQLite does not currently check to see\r\n** if the application incorrectly accesses the destination [database connection]\r\n** and so no error code is reported, but the operations may malfunction\r\n** nevertheless.  Use of the destination database connection while a\r\n** backup is in progress might also also cause a mutex deadlock.\r\n**\r\n** If running in [shared cache mode], the application must\r\n** guarantee that the shared cache used by the destination database\r\n** is not accessed while the backup is running. In practice this means\r\n** that the application must guarantee that the disk file being \r\n** backed up to is not accessed by any connection within the process,\r\n** not just the specific connection that was passed to sqlite3_backup_init().\r\n**\r\n** The [sqlite3_backup] object itself is partially threadsafe. Multiple \r\n** threads may safely make multiple concurrent calls to sqlite3_backup_step().\r\n** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()\r\n** APIs are not strictly speaking threadsafe. If they are invoked at the\r\n** same time as another thread is invoking sqlite3_backup_step() it is\r\n** possible that they return invalid values.\r\n*/\r\nSQLITE_API sqlite3_backup *sqlite3_backup_init(\r\n  sqlite3 *pDest,                        /* Destination database handle */\r\n  const char *zDestName,                 /* Destination database name */\r\n  sqlite3 *pSource,                      /* Source database handle */\r\n  const char *zSourceName                /* Source database name */\r\n);\r\nSQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);\r\nSQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);\r\nSQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);\r\nSQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);\r\n\r\n/*\r\n** CAPI3REF: Unlock Notification\r\n**\r\n** ^When running in shared-cache mode, a database operation may fail with\r\n** an [SQLITE_LOCKED] error if the required locks on the shared-cache or\r\n** individual tables within the shared-cache cannot be obtained. See\r\n** [SQLite Shared-Cache Mode] for a description of shared-cache locking. \r\n** ^This API may be used to register a callback that SQLite will invoke \r\n** when the connection currently holding the required lock relinquishes it.\r\n** ^This API is only available if the library was compiled with the\r\n** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.\r\n**\r\n** See Also: [Using the SQLite Unlock Notification Feature].\r\n**\r\n** ^Shared-cache locks are released when a database connection concludes\r\n** its current transaction, either by committing it or rolling it back. \r\n**\r\n** ^When a connection (known as the blocked connection) fails to obtain a\r\n** shared-cache lock and SQLITE_LOCKED is returned to the caller, the\r\n** identity of the database connection (the blocking connection) that\r\n** has locked the required resource is stored internally. ^After an \r\n** application receives an SQLITE_LOCKED error, it may call the\r\n** sqlite3_unlock_notify() method with the blocked connection handle as \r\n** the first argument to register for a callback that will be invoked\r\n** when the blocking connections current transaction is concluded. ^The\r\n** callback is invoked from within the [sqlite3_step] or [sqlite3_close]\r\n** call that concludes the blocking connections transaction.\r\n**\r\n** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,\r\n** there is a chance that the blocking connection will have already\r\n** concluded its transaction by the time sqlite3_unlock_notify() is invoked.\r\n** If this happens, then the specified callback is invoked immediately,\r\n** from within the call to sqlite3_unlock_notify().)^\r\n**\r\n** ^If the blocked connection is attempting to obtain a write-lock on a\r\n** shared-cache table, and more than one other connection currently holds\r\n** a read-lock on the same table, then SQLite arbitrarily selects one of \r\n** the other connections to use as the blocking connection.\r\n**\r\n** ^(There may be at most one unlock-notify callback registered by a \r\n** blocked connection. If sqlite3_unlock_notify() is called when the\r\n** blocked connection already has a registered unlock-notify callback,\r\n** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is\r\n** called with a NULL pointer as its second argument, then any existing\r\n** unlock-notify callback is canceled. ^The blocked connections \r\n** unlock-notify callback may also be canceled by closing the blocked\r\n** connection using [sqlite3_close()].\r\n**\r\n** The unlock-notify callback is not reentrant. If an application invokes\r\n** any sqlite3_xxx API functions from within an unlock-notify callback, a\r\n** crash or deadlock may be the result.\r\n**\r\n** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always\r\n** returns SQLITE_OK.\r\n**\r\n** <b>Callback Invocation Details</b>\r\n**\r\n** When an unlock-notify callback is registered, the application provides a \r\n** single void* pointer that is passed to the callback when it is invoked.\r\n** However, the signature of the callback function allows SQLite to pass\r\n** it an array of void* context pointers. The first argument passed to\r\n** an unlock-notify callback is a pointer to an array of void* pointers,\r\n** and the second is the number of entries in the array.\r\n**\r\n** When a blocking connections transaction is concluded, there may be\r\n** more than one blocked connection that has registered for an unlock-notify\r\n** callback. ^If two or more such blocked connections have specified the\r\n** same callback function, then instead of invoking the callback function\r\n** multiple times, it is invoked once with the set of void* context pointers\r\n** specified by the blocked connections bundled together into an array.\r\n** This gives the application an opportunity to prioritize any actions \r\n** related to the set of unblocked database connections.\r\n**\r\n** <b>Deadlock Detection</b>\r\n**\r\n** Assuming that after registering for an unlock-notify callback a \r\n** database waits for the callback to be issued before taking any further\r\n** action (a reasonable assumption), then using this API may cause the\r\n** application to deadlock. For example, if connection X is waiting for\r\n** connection Y's transaction to be concluded, and similarly connection\r\n** Y is waiting on connection X's transaction, then neither connection\r\n** will proceed and the system may remain deadlocked indefinitely.\r\n**\r\n** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock\r\n** detection. ^If a given call to sqlite3_unlock_notify() would put the\r\n** system in a deadlocked state, then SQLITE_LOCKED is returned and no\r\n** unlock-notify callback is registered. The system is said to be in\r\n** a deadlocked state if connection A has registered for an unlock-notify\r\n** callback on the conclusion of connection B's transaction, and connection\r\n** B has itself registered for an unlock-notify callback when connection\r\n** A's transaction is concluded. ^Indirect deadlock is also detected, so\r\n** the system is also considered to be deadlocked if connection B has\r\n** registered for an unlock-notify callback on the conclusion of connection\r\n** C's transaction, where connection C is waiting on connection A. ^Any\r\n** number of levels of indirection are allowed.\r\n**\r\n** <b>The \"DROP TABLE\" Exception</b>\r\n**\r\n** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost \r\n** always appropriate to call sqlite3_unlock_notify(). There is however,\r\n** one exception. When executing a \"DROP TABLE\" or \"DROP INDEX\" statement,\r\n** SQLite checks if there are any currently executing SELECT statements\r\n** that belong to the same connection. If there are, SQLITE_LOCKED is\r\n** returned. In this case there is no \"blocking connection\", so invoking\r\n** sqlite3_unlock_notify() results in the unlock-notify callback being\r\n** invoked immediately. If the application then re-attempts the \"DROP TABLE\"\r\n** or \"DROP INDEX\" query, an infinite loop might be the result.\r\n**\r\n** One way around this problem is to check the extended error code returned\r\n** by an sqlite3_step() call. ^(If there is a blocking connection, then the\r\n** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in\r\n** the special \"DROP TABLE/INDEX\" case, the extended error code is just \r\n** SQLITE_LOCKED.)^\r\n*/\r\nSQLITE_API int sqlite3_unlock_notify(\r\n  sqlite3 *pBlocked,                          /* Waiting connection */\r\n  void (*xNotify)(void **apArg, int nArg),    /* Callback function to invoke */\r\n  void *pNotifyArg                            /* Argument to pass to xNotify */\r\n);\r\n\r\n\r\n/*\r\n** CAPI3REF: String Comparison\r\n**\r\n** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications\r\n** and extensions to compare the contents of two buffers containing UTF-8\r\n** strings in a case-independent fashion, using the same definition of \"case\r\n** independence\" that SQLite uses internally when comparing identifiers.\r\n*/\r\nSQLITE_API int sqlite3_stricmp(const char *, const char *);\r\nSQLITE_API int sqlite3_strnicmp(const char *, const char *, int);\r\n\r\n/*\r\n** CAPI3REF: Error Logging Interface\r\n**\r\n** ^The [sqlite3_log()] interface writes a message into the error log\r\n** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].\r\n** ^If logging is enabled, the zFormat string and subsequent arguments are\r\n** used with [sqlite3_snprintf()] to generate the final output string.\r\n**\r\n** The sqlite3_log() interface is intended for use by extensions such as\r\n** virtual tables, collating functions, and SQL functions.  While there is\r\n** nothing to prevent an application from calling sqlite3_log(), doing so\r\n** is considered bad form.\r\n**\r\n** The zFormat string must not be NULL.\r\n**\r\n** To avoid deadlocks and other threading problems, the sqlite3_log() routine\r\n** will not use dynamically allocated memory.  The log message is stored in\r\n** a fixed-length buffer on the stack.  If the log message is longer than\r\n** a few hundred characters, it will be truncated to the length of the\r\n** buffer.\r\n*/\r\nSQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);\r\n\r\n/*\r\n** CAPI3REF: Write-Ahead Log Commit Hook\r\n**\r\n** ^The [sqlite3_wal_hook()] function is used to register a callback that\r\n** will be invoked each time a database connection commits data to a\r\n** [write-ahead log] (i.e. whenever a transaction is committed in\r\n** [journal_mode | journal_mode=WAL mode]). \r\n**\r\n** ^The callback is invoked by SQLite after the commit has taken place and \r\n** the associated write-lock on the database released, so the implementation \r\n** may read, write or [checkpoint] the database as required.\r\n**\r\n** ^The first parameter passed to the callback function when it is invoked\r\n** is a copy of the third parameter passed to sqlite3_wal_hook() when\r\n** registering the callback. ^The second is a copy of the database handle.\r\n** ^The third parameter is the name of the database that was written to -\r\n** either \"main\" or the name of an [ATTACH]-ed database. ^The fourth parameter\r\n** is the number of pages currently in the write-ahead log file,\r\n** including those that were just committed.\r\n**\r\n** The callback function should normally return [SQLITE_OK].  ^If an error\r\n** code is returned, that error will propagate back up through the\r\n** SQLite code base to cause the statement that provoked the callback\r\n** to report an error, though the commit will have still occurred. If the\r\n** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value\r\n** that does not correspond to any valid SQLite error code, the results\r\n** are undefined.\r\n**\r\n** A single database handle may have at most a single write-ahead log callback \r\n** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any\r\n** previously registered write-ahead log callback. ^Note that the\r\n** [sqlite3_wal_autocheckpoint()] interface and the\r\n** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will\r\n** those overwrite any prior [sqlite3_wal_hook()] settings.\r\n*/\r\nSQLITE_API void *sqlite3_wal_hook(\r\n  sqlite3*, \r\n  int(*)(void *,sqlite3*,const char*,int),\r\n  void*\r\n);\r\n\r\n/*\r\n** CAPI3REF: Configure an auto-checkpoint\r\n**\r\n** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around\r\n** [sqlite3_wal_hook()] that causes any database on [database connection] D\r\n** to automatically [checkpoint]\r\n** after committing a transaction if there are N or\r\n** more frames in the [write-ahead log] file.  ^Passing zero or \r\n** a negative value as the nFrame parameter disables automatic\r\n** checkpoints entirely.\r\n**\r\n** ^The callback registered by this function replaces any existing callback\r\n** registered using [sqlite3_wal_hook()].  ^Likewise, registering a callback\r\n** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism\r\n** configured by this function.\r\n**\r\n** ^The [wal_autocheckpoint pragma] can be used to invoke this interface\r\n** from SQL.\r\n**\r\n** ^Every new [database connection] defaults to having the auto-checkpoint\r\n** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]\r\n** pages.  The use of this interface\r\n** is only necessary if the default setting is found to be suboptimal\r\n** for a particular application.\r\n*/\r\nSQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);\r\n\r\n/*\r\n** CAPI3REF: Checkpoint a database\r\n**\r\n** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X\r\n** on [database connection] D to be [checkpointed].  ^If X is NULL or an\r\n** empty string, then a checkpoint is run on all databases of\r\n** connection D.  ^If the database connection D is not in\r\n** [WAL | write-ahead log mode] then this interface is a harmless no-op.\r\n**\r\n** ^The [wal_checkpoint pragma] can be used to invoke this interface\r\n** from SQL.  ^The [sqlite3_wal_autocheckpoint()] interface and the\r\n** [wal_autocheckpoint pragma] can be used to cause this interface to be\r\n** run whenever the WAL reaches a certain size threshold.\r\n**\r\n** See also: [sqlite3_wal_checkpoint_v2()]\r\n*/\r\nSQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);\r\n\r\n/*\r\n** CAPI3REF: Checkpoint a database\r\n**\r\n** Run a checkpoint operation on WAL database zDb attached to database \r\n** handle db. The specific operation is determined by the value of the \r\n** eMode parameter:\r\n**\r\n** <dl>\r\n** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>\r\n**   Checkpoint as many frames as possible without waiting for any database \r\n**   readers or writers to finish. Sync the db file if all frames in the log\r\n**   are checkpointed. This mode is the same as calling \r\n**   sqlite3_wal_checkpoint(). The busy-handler callback is never invoked.\r\n**\r\n** <dt>SQLITE_CHECKPOINT_FULL<dd>\r\n**   This mode blocks (calls the busy-handler callback) until there is no\r\n**   database writer and all readers are reading from the most recent database\r\n**   snapshot. It then checkpoints all frames in the log file and syncs the\r\n**   database file. This call blocks database writers while it is running,\r\n**   but not database readers.\r\n**\r\n** <dt>SQLITE_CHECKPOINT_RESTART<dd>\r\n**   This mode works the same way as SQLITE_CHECKPOINT_FULL, except after \r\n**   checkpointing the log file it blocks (calls the busy-handler callback)\r\n**   until all readers are reading from the database file only. This ensures \r\n**   that the next client to write to the database file restarts the log file \r\n**   from the beginning. This call blocks database writers while it is running,\r\n**   but not database readers.\r\n** </dl>\r\n**\r\n** If pnLog is not NULL, then *pnLog is set to the total number of frames in\r\n** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to\r\n** the total number of checkpointed frames (including any that were already\r\n** checkpointed when this function is called). *pnLog and *pnCkpt may be\r\n** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.\r\n** If no values are available because of an error, they are both set to -1\r\n** before returning to communicate this to the caller.\r\n**\r\n** All calls obtain an exclusive \"checkpoint\" lock on the database file. If\r\n** any other process is running a checkpoint operation at the same time, the \r\n** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a \r\n** busy-handler configured, it will not be invoked in this case.\r\n**\r\n** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive \r\n** \"writer\" lock on the database file. If the writer lock cannot be obtained\r\n** immediately, and a busy-handler is configured, it is invoked and the writer\r\n** lock retried until either the busy-handler returns 0 or the lock is\r\n** successfully obtained. The busy-handler is also invoked while waiting for\r\n** database readers as described above. If the busy-handler returns 0 before\r\n** the writer lock is obtained or while waiting for database readers, the\r\n** checkpoint operation proceeds from that point in the same way as \r\n** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible \r\n** without blocking any further. SQLITE_BUSY is returned in this case.\r\n**\r\n** If parameter zDb is NULL or points to a zero length string, then the\r\n** specified operation is attempted on all WAL databases. In this case the\r\n** values written to output parameters *pnLog and *pnCkpt are undefined. If \r\n** an SQLITE_BUSY error is encountered when processing one or more of the \r\n** attached WAL databases, the operation is still attempted on any remaining \r\n** attached databases and SQLITE_BUSY is returned to the caller. If any other \r\n** error occurs while processing an attached database, processing is abandoned \r\n** and the error code returned to the caller immediately. If no error \r\n** (SQLITE_BUSY or otherwise) is encountered while processing the attached \r\n** databases, SQLITE_OK is returned.\r\n**\r\n** If database zDb is the name of an attached database that is not in WAL\r\n** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If\r\n** zDb is not NULL (or a zero length string) and is not the name of any\r\n** attached database, SQLITE_ERROR is returned to the caller.\r\n*/\r\nSQLITE_API int sqlite3_wal_checkpoint_v2(\r\n  sqlite3 *db,                    /* Database handle */\r\n  const char *zDb,                /* Name of attached database (or NULL) */\r\n  int eMode,                      /* SQLITE_CHECKPOINT_* value */\r\n  int *pnLog,                     /* OUT: Size of WAL log in frames */\r\n  int *pnCkpt                     /* OUT: Total number of frames checkpointed */\r\n);\r\n\r\n/*\r\n** CAPI3REF: Checkpoint operation parameters\r\n**\r\n** These constants can be used as the 3rd parameter to\r\n** [sqlite3_wal_checkpoint_v2()].  See the [sqlite3_wal_checkpoint_v2()]\r\n** documentation for additional information about the meaning and use of\r\n** each of these values.\r\n*/\r\n#define SQLITE_CHECKPOINT_PASSIVE 0\r\n#define SQLITE_CHECKPOINT_FULL    1\r\n#define SQLITE_CHECKPOINT_RESTART 2\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Interface Configuration\r\n**\r\n** This function may be called by either the [xConnect] or [xCreate] method\r\n** of a [virtual table] implementation to configure\r\n** various facets of the virtual table interface.\r\n**\r\n** If this interface is invoked outside the context of an xConnect or\r\n** xCreate virtual table method then the behavior is undefined.\r\n**\r\n** At present, there is only one option that may be configured using\r\n** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].)  Further options\r\n** may be added in the future.\r\n*/\r\nSQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);\r\n\r\n/*\r\n** CAPI3REF: Virtual Table Configuration Options\r\n**\r\n** These macros define the various options to the\r\n** [sqlite3_vtab_config()] interface that [virtual table] implementations\r\n** can use to customize and optimize their behavior.\r\n**\r\n** <dl>\r\n** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT\r\n** <dd>Calls of the form\r\n** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,\r\n** where X is an integer.  If X is zero, then the [virtual table] whose\r\n** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not\r\n** support constraints.  In this configuration (which is the default) if\r\n** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire\r\n** statement is rolled back as if [ON CONFLICT | OR ABORT] had been\r\n** specified as part of the users SQL statement, regardless of the actual\r\n** ON CONFLICT mode specified.\r\n**\r\n** If X is non-zero, then the virtual table implementation guarantees\r\n** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before\r\n** any modifications to internal or persistent data structures have been made.\r\n** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite \r\n** is able to roll back a statement or database transaction, and abandon\r\n** or continue processing the current SQL statement as appropriate. \r\n** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns\r\n** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode\r\n** had been ABORT.\r\n**\r\n** Virtual table implementations that are required to handle OR REPLACE\r\n** must do so within the [xUpdate] method. If a call to the \r\n** [sqlite3_vtab_on_conflict()] function indicates that the current ON \r\n** CONFLICT policy is REPLACE, the virtual table implementation should \r\n** silently replace the appropriate rows within the xUpdate callback and\r\n** return SQLITE_OK. Or, if this is not possible, it may return\r\n** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT \r\n** constraint handling.\r\n** </dl>\r\n*/\r\n#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1\r\n\r\n/*\r\n** CAPI3REF: Determine The Virtual Table Conflict Policy\r\n**\r\n** This function may only be called from within a call to the [xUpdate] method\r\n** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The\r\n** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],\r\n** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode\r\n** of the SQL statement that triggered the call to the [xUpdate] method of the\r\n** [virtual table].\r\n*/\r\nSQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);\r\n\r\n/*\r\n** CAPI3REF: Conflict resolution modes\r\n**\r\n** These constants are returned by [sqlite3_vtab_on_conflict()] to\r\n** inform a [virtual table] implementation what the [ON CONFLICT] mode\r\n** is for the SQL statement being evaluated.\r\n**\r\n** Note that the [SQLITE_IGNORE] constant is also used as a potential\r\n** return value from the [sqlite3_set_authorizer()] callback and that\r\n** [SQLITE_ABORT] is also a [result code].\r\n*/\r\n#define SQLITE_ROLLBACK 1\r\n/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */\r\n#define SQLITE_FAIL     3\r\n/* #define SQLITE_ABORT 4  // Also an error code */\r\n#define SQLITE_REPLACE  5\r\n\r\n\r\n\r\n/*\r\n** Undo the hack that converts floating point types to integer for\r\n** builds on processors without floating point support.\r\n*/\r\n#ifdef SQLITE_OMIT_FLOATING_POINT\r\n# undef double\r\n#endif\r\n\r\n#ifdef __cplusplus\r\n}  /* End of the 'extern \"C\"' block */\r\n#endif\r\n#endif\r\n\r\n/*\r\n** 2010 August 30\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n*/\r\n\r\n#ifndef _SQLITE3RTREE_H_\r\n#define _SQLITE3RTREE_H_\r\n\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;\r\n\r\n/*\r\n** Register a geometry callback named zGeom that can be used as part of an\r\n** R-Tree geometry query as follows:\r\n**\r\n**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)\r\n*/\r\nSQLITE_API int sqlite3_rtree_geometry_callback(\r\n  sqlite3 *db,\r\n  const char *zGeom,\r\n  int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes),\r\n  void *pContext\r\n);\r\n\r\n\r\n/*\r\n** A pointer to a structure of the following type is passed as the first\r\n** argument to callbacks registered using rtree_geometry_callback().\r\n*/\r\nstruct sqlite3_rtree_geometry {\r\n  void *pContext;                 /* Copy of pContext passed to s_r_g_c() */\r\n  int nParam;                     /* Size of array aParam[] */\r\n  double *aParam;                 /* Parameters passed to SQL geom function */\r\n  void *pUser;                    /* Callback implementation user data */\r\n  void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */\r\n};\r\n\r\nsqlite3_vfs* getVFSList();\r\n\r\n#ifdef __cplusplus\r\n}  /* end of the 'extern \"C\"' block */\r\n#endif\r\n\r\n#endif  /* ifndef _SQLITE3RTREE_H_ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/SQLite/sqlite3ext.h",
    "content": "/*\r\n** 2006 June 7\r\n**\r\n** The author disclaims copyright to this source code.  In place of\r\n** a legal notice, here is a blessing:\r\n**\r\n**    May you do good and not evil.\r\n**    May you find forgiveness for yourself and forgive others.\r\n**    May you share freely, never taking more than you give.\r\n**\r\n*************************************************************************\r\n** This header file defines the SQLite interface for use by\r\n** shared libraries that want to be imported as extensions into\r\n** an SQLite instance.  Shared libraries that intend to be loaded\r\n** as extensions by SQLite should #include this file instead of \r\n** sqlite3.h.\r\n*/\r\n#ifndef _SQLITE3EXT_H_\r\n#define _SQLITE3EXT_H_\r\n#include \"sqlite3.h\"\r\n\r\ntypedef struct sqlite3_api_routines sqlite3_api_routines;\r\n\r\n/*\r\n** The following structure holds pointers to all of the SQLite API\r\n** routines.\r\n**\r\n** WARNING:  In order to maintain backwards compatibility, add new\r\n** interfaces to the end of this structure only.  If you insert new\r\n** interfaces in the middle of this structure, then older different\r\n** versions of SQLite will not be able to load each others' shared\r\n** libraries!\r\n*/\r\nstruct sqlite3_api_routines {\r\n  void * (*aggregate_context)(sqlite3_context*,int nBytes);\r\n  int  (*aggregate_count)(sqlite3_context*);\r\n  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));\r\n  int  (*bind_double)(sqlite3_stmt*,int,double);\r\n  int  (*bind_int)(sqlite3_stmt*,int,int);\r\n  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);\r\n  int  (*bind_null)(sqlite3_stmt*,int);\r\n  int  (*bind_parameter_count)(sqlite3_stmt*);\r\n  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);\r\n  const char * (*bind_parameter_name)(sqlite3_stmt*,int);\r\n  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));\r\n  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));\r\n  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);\r\n  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);\r\n  int  (*busy_timeout)(sqlite3*,int ms);\r\n  int  (*changes)(sqlite3*);\r\n  int  (*close)(sqlite3*);\r\n  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,\r\n                           int eTextRep,const char*));\r\n  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,\r\n                             int eTextRep,const void*));\r\n  const void * (*column_blob)(sqlite3_stmt*,int iCol);\r\n  int  (*column_bytes)(sqlite3_stmt*,int iCol);\r\n  int  (*column_bytes16)(sqlite3_stmt*,int iCol);\r\n  int  (*column_count)(sqlite3_stmt*pStmt);\r\n  const char * (*column_database_name)(sqlite3_stmt*,int);\r\n  const void * (*column_database_name16)(sqlite3_stmt*,int);\r\n  const char * (*column_decltype)(sqlite3_stmt*,int i);\r\n  const void * (*column_decltype16)(sqlite3_stmt*,int);\r\n  double  (*column_double)(sqlite3_stmt*,int iCol);\r\n  int  (*column_int)(sqlite3_stmt*,int iCol);\r\n  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);\r\n  const char * (*column_name)(sqlite3_stmt*,int);\r\n  const void * (*column_name16)(sqlite3_stmt*,int);\r\n  const char * (*column_origin_name)(sqlite3_stmt*,int);\r\n  const void * (*column_origin_name16)(sqlite3_stmt*,int);\r\n  const char * (*column_table_name)(sqlite3_stmt*,int);\r\n  const void * (*column_table_name16)(sqlite3_stmt*,int);\r\n  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);\r\n  const void * (*column_text16)(sqlite3_stmt*,int iCol);\r\n  int  (*column_type)(sqlite3_stmt*,int iCol);\r\n  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);\r\n  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);\r\n  int  (*complete)(const char*sql);\r\n  int  (*complete16)(const void*sql);\r\n  int  (*create_collation)(sqlite3*,const char*,int,void*,\r\n                           int(*)(void*,int,const void*,int,const void*));\r\n  int  (*create_collation16)(sqlite3*,const void*,int,void*,\r\n                             int(*)(void*,int,const void*,int,const void*));\r\n  int  (*create_function)(sqlite3*,const char*,int,int,void*,\r\n                          void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                          void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n                          void (*xFinal)(sqlite3_context*));\r\n  int  (*create_function16)(sqlite3*,const void*,int,int,void*,\r\n                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xFinal)(sqlite3_context*));\r\n  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);\r\n  int  (*data_count)(sqlite3_stmt*pStmt);\r\n  sqlite3 * (*db_handle)(sqlite3_stmt*);\r\n  int (*declare_vtab)(sqlite3*,const char*);\r\n  int  (*enable_shared_cache)(int);\r\n  int  (*errcode)(sqlite3*db);\r\n  const char * (*errmsg)(sqlite3*);\r\n  const void * (*errmsg16)(sqlite3*);\r\n  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);\r\n  int  (*expired)(sqlite3_stmt*);\r\n  int  (*finalize)(sqlite3_stmt*pStmt);\r\n  void  (*free)(void*);\r\n  void  (*free_table)(char**result);\r\n  int  (*get_autocommit)(sqlite3*);\r\n  void * (*get_auxdata)(sqlite3_context*,int);\r\n  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);\r\n  int  (*global_recover)(void);\r\n  void  (*interruptx)(sqlite3*);\r\n  sqlite_int64  (*last_insert_rowid)(sqlite3*);\r\n  const char * (*libversion)(void);\r\n  int  (*libversion_number)(void);\r\n  void *(*malloc)(int);\r\n  char * (*mprintf)(const char*,...);\r\n  int  (*open)(const char*,sqlite3**);\r\n  int  (*open16)(const void*,sqlite3**);\r\n  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);\r\n  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);\r\n  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);\r\n  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);\r\n  void *(*realloc)(void*,int);\r\n  int  (*reset)(sqlite3_stmt*pStmt);\r\n  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_double)(sqlite3_context*,double);\r\n  void  (*result_error)(sqlite3_context*,const char*,int);\r\n  void  (*result_error16)(sqlite3_context*,const void*,int);\r\n  void  (*result_int)(sqlite3_context*,int);\r\n  void  (*result_int64)(sqlite3_context*,sqlite_int64);\r\n  void  (*result_null)(sqlite3_context*);\r\n  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));\r\n  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));\r\n  void  (*result_value)(sqlite3_context*,sqlite3_value*);\r\n  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);\r\n  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,\r\n                         const char*,const char*),void*);\r\n  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));\r\n  char * (*snprintf)(int,char*,const char*,...);\r\n  int  (*step)(sqlite3_stmt*);\r\n  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,\r\n                                char const**,char const**,int*,int*,int*);\r\n  void  (*thread_cleanup)(void);\r\n  int  (*total_changes)(sqlite3*);\r\n  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);\r\n  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);\r\n  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,\r\n                                         sqlite_int64),void*);\r\n  void * (*user_data)(sqlite3_context*);\r\n  const void * (*value_blob)(sqlite3_value*);\r\n  int  (*value_bytes)(sqlite3_value*);\r\n  int  (*value_bytes16)(sqlite3_value*);\r\n  double  (*value_double)(sqlite3_value*);\r\n  int  (*value_int)(sqlite3_value*);\r\n  sqlite_int64  (*value_int64)(sqlite3_value*);\r\n  int  (*value_numeric_type)(sqlite3_value*);\r\n  const unsigned char * (*value_text)(sqlite3_value*);\r\n  const void * (*value_text16)(sqlite3_value*);\r\n  const void * (*value_text16be)(sqlite3_value*);\r\n  const void * (*value_text16le)(sqlite3_value*);\r\n  int  (*value_type)(sqlite3_value*);\r\n  char *(*vmprintf)(const char*,va_list);\r\n  /* Added ??? */\r\n  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);\r\n  /* Added by 3.3.13 */\r\n  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);\r\n  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);\r\n  int (*clear_bindings)(sqlite3_stmt*);\r\n  /* Added by 3.4.1 */\r\n  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,\r\n                          void (*xDestroy)(void *));\r\n  /* Added by 3.5.0 */\r\n  int (*bind_zeroblob)(sqlite3_stmt*,int,int);\r\n  int (*blob_bytes)(sqlite3_blob*);\r\n  int (*blob_close)(sqlite3_blob*);\r\n  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,\r\n                   int,sqlite3_blob**);\r\n  int (*blob_read)(sqlite3_blob*,void*,int,int);\r\n  int (*blob_write)(sqlite3_blob*,const void*,int,int);\r\n  int (*create_collation_v2)(sqlite3*,const char*,int,void*,\r\n                             int(*)(void*,int,const void*,int,const void*),\r\n                             void(*)(void*));\r\n  int (*file_control)(sqlite3*,const char*,int,void*);\r\n  sqlite3_int64 (*memory_highwater)(int);\r\n  sqlite3_int64 (*memory_used)(void);\r\n  sqlite3_mutex *(*mutex_alloc)(int);\r\n  void (*mutex_enter)(sqlite3_mutex*);\r\n  void (*mutex_free)(sqlite3_mutex*);\r\n  void (*mutex_leave)(sqlite3_mutex*);\r\n  int (*mutex_try)(sqlite3_mutex*);\r\n  int (*open_v2)(const char*,sqlite3**,int,const char*);\r\n  int (*release_memory)(int);\r\n  void (*result_error_nomem)(sqlite3_context*);\r\n  void (*result_error_toobig)(sqlite3_context*);\r\n  int (*sleep)(int);\r\n  void (*soft_heap_limit)(int);\r\n  sqlite3_vfs *(*vfs_find)(const char*);\r\n  int (*vfs_register)(sqlite3_vfs*,int);\r\n  int (*vfs_unregister)(sqlite3_vfs*);\r\n  int (*xthreadsafe)(void);\r\n  void (*result_zeroblob)(sqlite3_context*,int);\r\n  void (*result_error_code)(sqlite3_context*,int);\r\n  int (*test_control)(int, ...);\r\n  void (*randomness)(int,void*);\r\n  sqlite3 *(*context_db_handle)(sqlite3_context*);\r\n  int (*extended_result_codes)(sqlite3*,int);\r\n  int (*limit)(sqlite3*,int,int);\r\n  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);\r\n  const char *(*sql)(sqlite3_stmt*);\r\n  int (*status)(int,int*,int*,int);\r\n  int (*backup_finish)(sqlite3_backup*);\r\n  sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);\r\n  int (*backup_pagecount)(sqlite3_backup*);\r\n  int (*backup_remaining)(sqlite3_backup*);\r\n  int (*backup_step)(sqlite3_backup*,int);\r\n  const char *(*compileoption_get)(int);\r\n  int (*compileoption_used)(const char*);\r\n  int (*create_function_v2)(sqlite3*,const char*,int,int,void*,\r\n                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),\r\n                            void (*xFinal)(sqlite3_context*),\r\n                            void(*xDestroy)(void*));\r\n  int (*db_config)(sqlite3*,int,...);\r\n  sqlite3_mutex *(*db_mutex)(sqlite3*);\r\n  int (*db_status)(sqlite3*,int,int*,int*,int);\r\n  int (*extended_errcode)(sqlite3*);\r\n  void (*log)(int,const char*,...);\r\n  sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);\r\n  const char *(*sourceid)(void);\r\n  int (*stmt_status)(sqlite3_stmt*,int,int);\r\n  int (*strnicmp)(const char*,const char*,int);\r\n  int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);\r\n  int (*wal_autocheckpoint)(sqlite3*,int);\r\n  int (*wal_checkpoint)(sqlite3*,const char*);\r\n  void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);\r\n  int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);\r\n  int (*vtab_config)(sqlite3*,int op,...);\r\n  int (*vtab_on_conflict)(sqlite3*);\r\n};\r\n\r\n/*\r\n** The following macros redefine the API routines so that they are\r\n** redirected throught the global sqlite3_api structure.\r\n**\r\n** This header file is also used by the loadext.c source file\r\n** (part of the main SQLite library - not an extension) so that\r\n** it can get access to the sqlite3_api_routines structure\r\n** definition.  But the main library does not want to redefine\r\n** the API.  So the redefinition macros are only valid if the\r\n** SQLITE_CORE macros is undefined.\r\n*/\r\n#ifndef SQLITE_CORE\r\n#define sqlite3_aggregate_context      sqlite3_api->aggregate_context\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_aggregate_count        sqlite3_api->aggregate_count\r\n#endif\r\n#define sqlite3_bind_blob              sqlite3_api->bind_blob\r\n#define sqlite3_bind_double            sqlite3_api->bind_double\r\n#define sqlite3_bind_int               sqlite3_api->bind_int\r\n#define sqlite3_bind_int64             sqlite3_api->bind_int64\r\n#define sqlite3_bind_null              sqlite3_api->bind_null\r\n#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count\r\n#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index\r\n#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name\r\n#define sqlite3_bind_text              sqlite3_api->bind_text\r\n#define sqlite3_bind_text16            sqlite3_api->bind_text16\r\n#define sqlite3_bind_value             sqlite3_api->bind_value\r\n#define sqlite3_busy_handler           sqlite3_api->busy_handler\r\n#define sqlite3_busy_timeout           sqlite3_api->busy_timeout\r\n#define sqlite3_changes                sqlite3_api->changes\r\n#define sqlite3_close                  sqlite3_api->close\r\n#define sqlite3_collation_needed       sqlite3_api->collation_needed\r\n#define sqlite3_collation_needed16     sqlite3_api->collation_needed16\r\n#define sqlite3_column_blob            sqlite3_api->column_blob\r\n#define sqlite3_column_bytes           sqlite3_api->column_bytes\r\n#define sqlite3_column_bytes16         sqlite3_api->column_bytes16\r\n#define sqlite3_column_count           sqlite3_api->column_count\r\n#define sqlite3_column_database_name   sqlite3_api->column_database_name\r\n#define sqlite3_column_database_name16 sqlite3_api->column_database_name16\r\n#define sqlite3_column_decltype        sqlite3_api->column_decltype\r\n#define sqlite3_column_decltype16      sqlite3_api->column_decltype16\r\n#define sqlite3_column_double          sqlite3_api->column_double\r\n#define sqlite3_column_int             sqlite3_api->column_int\r\n#define sqlite3_column_int64           sqlite3_api->column_int64\r\n#define sqlite3_column_name            sqlite3_api->column_name\r\n#define sqlite3_column_name16          sqlite3_api->column_name16\r\n#define sqlite3_column_origin_name     sqlite3_api->column_origin_name\r\n#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16\r\n#define sqlite3_column_table_name      sqlite3_api->column_table_name\r\n#define sqlite3_column_table_name16    sqlite3_api->column_table_name16\r\n#define sqlite3_column_text            sqlite3_api->column_text\r\n#define sqlite3_column_text16          sqlite3_api->column_text16\r\n#define sqlite3_column_type            sqlite3_api->column_type\r\n#define sqlite3_column_value           sqlite3_api->column_value\r\n#define sqlite3_commit_hook            sqlite3_api->commit_hook\r\n#define sqlite3_complete               sqlite3_api->complete\r\n#define sqlite3_complete16             sqlite3_api->complete16\r\n#define sqlite3_create_collation       sqlite3_api->create_collation\r\n#define sqlite3_create_collation16     sqlite3_api->create_collation16\r\n#define sqlite3_create_function        sqlite3_api->create_function\r\n#define sqlite3_create_function16      sqlite3_api->create_function16\r\n#define sqlite3_create_module          sqlite3_api->create_module\r\n#define sqlite3_create_module_v2       sqlite3_api->create_module_v2\r\n#define sqlite3_data_count             sqlite3_api->data_count\r\n#define sqlite3_db_handle              sqlite3_api->db_handle\r\n#define sqlite3_declare_vtab           sqlite3_api->declare_vtab\r\n#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache\r\n#define sqlite3_errcode                sqlite3_api->errcode\r\n#define sqlite3_errmsg                 sqlite3_api->errmsg\r\n#define sqlite3_errmsg16               sqlite3_api->errmsg16\r\n#define sqlite3_exec                   sqlite3_api->exec\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_expired                sqlite3_api->expired\r\n#endif\r\n#define sqlite3_finalize               sqlite3_api->finalize\r\n#define sqlite3_free                   sqlite3_api->free\r\n#define sqlite3_free_table             sqlite3_api->free_table\r\n#define sqlite3_get_autocommit         sqlite3_api->get_autocommit\r\n#define sqlite3_get_auxdata            sqlite3_api->get_auxdata\r\n#define sqlite3_get_table              sqlite3_api->get_table\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_global_recover         sqlite3_api->global_recover\r\n#endif\r\n#define sqlite3_interrupt              sqlite3_api->interruptx\r\n#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid\r\n#define sqlite3_libversion             sqlite3_api->libversion\r\n#define sqlite3_libversion_number      sqlite3_api->libversion_number\r\n#define sqlite3_malloc                 sqlite3_api->malloc\r\n#define sqlite3_mprintf                sqlite3_api->mprintf\r\n#define sqlite3_open                   sqlite3_api->open\r\n#define sqlite3_open16                 sqlite3_api->open16\r\n#define sqlite3_prepare                sqlite3_api->prepare\r\n#define sqlite3_prepare16              sqlite3_api->prepare16\r\n#define sqlite3_prepare_v2             sqlite3_api->prepare_v2\r\n#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2\r\n#define sqlite3_profile                sqlite3_api->profile\r\n#define sqlite3_progress_handler       sqlite3_api->progress_handler\r\n#define sqlite3_realloc                sqlite3_api->realloc\r\n#define sqlite3_reset                  sqlite3_api->reset\r\n#define sqlite3_result_blob            sqlite3_api->result_blob\r\n#define sqlite3_result_double          sqlite3_api->result_double\r\n#define sqlite3_result_error           sqlite3_api->result_error\r\n#define sqlite3_result_error16         sqlite3_api->result_error16\r\n#define sqlite3_result_int             sqlite3_api->result_int\r\n#define sqlite3_result_int64           sqlite3_api->result_int64\r\n#define sqlite3_result_null            sqlite3_api->result_null\r\n#define sqlite3_result_text            sqlite3_api->result_text\r\n#define sqlite3_result_text16          sqlite3_api->result_text16\r\n#define sqlite3_result_text16be        sqlite3_api->result_text16be\r\n#define sqlite3_result_text16le        sqlite3_api->result_text16le\r\n#define sqlite3_result_value           sqlite3_api->result_value\r\n#define sqlite3_rollback_hook          sqlite3_api->rollback_hook\r\n#define sqlite3_set_authorizer         sqlite3_api->set_authorizer\r\n#define sqlite3_set_auxdata            sqlite3_api->set_auxdata\r\n#define sqlite3_snprintf               sqlite3_api->snprintf\r\n#define sqlite3_step                   sqlite3_api->step\r\n#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata\r\n#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup\r\n#define sqlite3_total_changes          sqlite3_api->total_changes\r\n#define sqlite3_trace                  sqlite3_api->trace\r\n#ifndef SQLITE_OMIT_DEPRECATED\r\n#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings\r\n#endif\r\n#define sqlite3_update_hook            sqlite3_api->update_hook\r\n#define sqlite3_user_data              sqlite3_api->user_data\r\n#define sqlite3_value_blob             sqlite3_api->value_blob\r\n#define sqlite3_value_bytes            sqlite3_api->value_bytes\r\n#define sqlite3_value_bytes16          sqlite3_api->value_bytes16\r\n#define sqlite3_value_double           sqlite3_api->value_double\r\n#define sqlite3_value_int              sqlite3_api->value_int\r\n#define sqlite3_value_int64            sqlite3_api->value_int64\r\n#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type\r\n#define sqlite3_value_text             sqlite3_api->value_text\r\n#define sqlite3_value_text16           sqlite3_api->value_text16\r\n#define sqlite3_value_text16be         sqlite3_api->value_text16be\r\n#define sqlite3_value_text16le         sqlite3_api->value_text16le\r\n#define sqlite3_value_type             sqlite3_api->value_type\r\n#define sqlite3_vmprintf               sqlite3_api->vmprintf\r\n#define sqlite3_overload_function      sqlite3_api->overload_function\r\n#define sqlite3_prepare_v2             sqlite3_api->prepare_v2\r\n#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2\r\n#define sqlite3_clear_bindings         sqlite3_api->clear_bindings\r\n#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob\r\n#define sqlite3_blob_bytes             sqlite3_api->blob_bytes\r\n#define sqlite3_blob_close             sqlite3_api->blob_close\r\n#define sqlite3_blob_open              sqlite3_api->blob_open\r\n#define sqlite3_blob_read              sqlite3_api->blob_read\r\n#define sqlite3_blob_write             sqlite3_api->blob_write\r\n#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2\r\n#define sqlite3_file_control           sqlite3_api->file_control\r\n#define sqlite3_memory_highwater       sqlite3_api->memory_highwater\r\n#define sqlite3_memory_used            sqlite3_api->memory_used\r\n#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc\r\n#define sqlite3_mutex_enter            sqlite3_api->mutex_enter\r\n#define sqlite3_mutex_free             sqlite3_api->mutex_free\r\n#define sqlite3_mutex_leave            sqlite3_api->mutex_leave\r\n#define sqlite3_mutex_try              sqlite3_api->mutex_try\r\n#define sqlite3_open_v2                sqlite3_api->open_v2\r\n#define sqlite3_release_memory         sqlite3_api->release_memory\r\n#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem\r\n#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig\r\n#define sqlite3_sleep                  sqlite3_api->sleep\r\n#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit\r\n#define sqlite3_vfs_find               sqlite3_api->vfs_find\r\n#define sqlite3_vfs_register           sqlite3_api->vfs_register\r\n#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister\r\n#define sqlite3_threadsafe             sqlite3_api->xthreadsafe\r\n#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob\r\n#define sqlite3_result_error_code      sqlite3_api->result_error_code\r\n#define sqlite3_test_control           sqlite3_api->test_control\r\n#define sqlite3_randomness             sqlite3_api->randomness\r\n#define sqlite3_context_db_handle      sqlite3_api->context_db_handle\r\n#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes\r\n#define sqlite3_limit                  sqlite3_api->limit\r\n#define sqlite3_next_stmt              sqlite3_api->next_stmt\r\n#define sqlite3_sql                    sqlite3_api->sql\r\n#define sqlite3_status                 sqlite3_api->status\r\n#define sqlite3_backup_finish          sqlite3_api->backup_finish\r\n#define sqlite3_backup_init            sqlite3_api->backup_init\r\n#define sqlite3_backup_pagecount       sqlite3_api->backup_pagecount\r\n#define sqlite3_backup_remaining       sqlite3_api->backup_remaining\r\n#define sqlite3_backup_step            sqlite3_api->backup_step\r\n#define sqlite3_compileoption_get      sqlite3_api->compileoption_get\r\n#define sqlite3_compileoption_used     sqlite3_api->compileoption_used\r\n#define sqlite3_create_function_v2     sqlite3_api->create_function_v2\r\n#define sqlite3_db_config              sqlite3_api->db_config\r\n#define sqlite3_db_mutex               sqlite3_api->db_mutex\r\n#define sqlite3_db_status              sqlite3_api->db_status\r\n#define sqlite3_extended_errcode       sqlite3_api->extended_errcode\r\n#define sqlite3_log                    sqlite3_api->log\r\n#define sqlite3_soft_heap_limit64      sqlite3_api->soft_heap_limit64\r\n#define sqlite3_sourceid               sqlite3_api->sourceid\r\n#define sqlite3_stmt_status            sqlite3_api->stmt_status\r\n#define sqlite3_strnicmp               sqlite3_api->strnicmp\r\n#define sqlite3_unlock_notify          sqlite3_api->unlock_notify\r\n#define sqlite3_wal_autocheckpoint     sqlite3_api->wal_autocheckpoint\r\n#define sqlite3_wal_checkpoint         sqlite3_api->wal_checkpoint\r\n#define sqlite3_wal_hook               sqlite3_api->wal_hook\r\n#define sqlite3_blob_reopen            sqlite3_api->blob_reopen\r\n#define sqlite3_vtab_config            sqlite3_api->vtab_config\r\n#define sqlite3_vtab_on_conflict       sqlite3_api->vtab_on_conflict\r\n#endif /* SQLITE_CORE */\r\n\r\n#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;\r\n#define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;\r\n\r\n#endif /* _SQLITE3EXT_H_ */\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/asm_arm.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: arm7 and later wide math functions\r\n\r\n ************************************************************************/\r\n\r\n#ifdef _ARM_ASSEM_\r\n\r\n#if !defined(_V_WIDE_MATH) && !defined(_LOW_ACCURACY_)\r\n#define _V_WIDE_MATH\r\n\r\nstatic inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {\r\n  int lo,hi;\r\n  asm volatile(\"smull\\t%0, %1, %2, %3\"\r\n               : \"=&r\"(lo),\"=&r\"(hi)\r\n               : \"%r\"(x),\"r\"(y)\r\n\t       : \"cc\");\r\n  return(hi);\r\n}\r\n\r\nstatic inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {\r\n  return MULT32(x,y)<<1;\r\n}\r\n\r\nstatic inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {\r\n  int lo,hi;\r\n  asm volatile(\"smull\t%0, %1, %2, %3\\n\\t\"\r\n\t       \"movs\t%0, %0, lsr #15\\n\\t\"\r\n\t       \"adc\t%1, %0, %1, lsl #17\\n\\t\"\r\n               : \"=&r\"(lo),\"=&r\"(hi)\r\n               : \"%r\"(x),\"r\"(y)\r\n\t       : \"cc\");\r\n  return(hi);\r\n}\r\n\r\n#define MB() asm volatile (\"\" : : : \"memory\")\r\n\r\nstatic inline void XPROD32(ogg_int32_t  a, ogg_int32_t  b,\r\n\t\t\t   ogg_int32_t  t, ogg_int32_t  v,\r\n\t\t\t   ogg_int32_t *x, ogg_int32_t *y)\r\n{\r\n  int x1, y1, l;\r\n  asm(\t\"smull\t%0, %1, %4, %6\\n\\t\"\r\n\t\"smlal\t%0, %1, %5, %7\\n\\t\"\r\n\t\"rsb\t%3, %4, #0\\n\\t\"\r\n\t\"smull\t%0, %2, %5, %6\\n\\t\"\r\n\t\"smlal\t%0, %2, %3, %7\"\r\n\t: \"=&r\" (l), \"=&r\" (x1), \"=&r\" (y1), \"=r\" (a)\r\n\t: \"3\" (a), \"r\" (b), \"r\" (t), \"r\" (v)\r\n\t: \"cc\" );\r\n  *x = x1;\r\n  MB();\r\n  *y = y1;\r\n}\r\n\r\n/* x = (a*t + b*v)>>31,    y = (b*t - a*v)>>31 */\r\nstatic inline void XPROD31(ogg_int32_t  a, ogg_int32_t  b,\r\n\t\t\t   ogg_int32_t  t, ogg_int32_t  v,\r\n\t\t\t   ogg_int32_t *x, ogg_int32_t *y)\r\n{\r\n  int x1, y1, l;\r\n  asm(\t\"smull\t%0, %1, %4, %6\\n\\t\"\r\n\t\"smlal\t%0, %1, %5, %7\\n\\t\"\r\n\t\"rsb\t%3, %4, #0\\n\\t\"\r\n\t\"smull\t%0, %2, %5, %6\\n\\t\"\r\n\t\"smlal\t%0, %2, %3, %7\"\r\n\t: \"=&r\" (l), \"=&r\" (x1), \"=&r\" (y1), \"=r\" (a)\r\n\t: \"3\" (a), \"r\" (b), \"r\" (t), \"r\" (v)\r\n\t: \"cc\" );\r\n  *x = x1 << 1;\r\n  MB();\r\n  *y = y1 << 1;\r\n}\r\n\r\n/* x = (a*t - b*v)>>31,     y = (b*t + a*v)>>31 */\r\nstatic inline void XNPROD31(ogg_int32_t  a, ogg_int32_t  b,\r\n\t\t\t    ogg_int32_t  t, ogg_int32_t  v,\r\n\t\t\t    ogg_int32_t *x, ogg_int32_t *y)\r\n{\r\n  int x1, y1, l;\r\n  asm(\t\"rsb\t%2, %4, #0\\n\\t\"\r\n\t\"smull\t%0, %1, %3, %5\\n\\t\"\r\n\t\"smlal\t%0, %1, %2, %6\\n\\t\"\r\n\t\"smull\t%0, %2, %4, %5\\n\\t\"\r\n\t\"smlal\t%0, %2, %3, %6\"\r\n\t: \"=&r\" (l), \"=&r\" (x1), \"=&r\" (y1)\r\n\t: \"r\" (a), \"r\" (b), \"r\" (t), \"r\" (v)\r\n\t: \"cc\" );\r\n  *x = x1 << 1;\r\n  MB();\r\n  *y = y1 << 1;\r\n}\r\n\r\n#endif\r\n\r\n#ifndef _V_CLIP_MATH\r\n#define _V_CLIP_MATH\r\n\r\nstatic inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {\r\n  int tmp;\r\n  asm volatile(\"subs\t%1, %0, #32768\\n\\t\"\r\n\t       \"movpl\t%0, #0x7f00\\n\\t\"\r\n\t       \"orrpl\t%0, %0, #0xff\\n\"\r\n\t       \"adds\t%1, %0, #32768\\n\\t\"\r\n\t       \"movmi\t%0, #0x8000\"\r\n\t       : \"+r\"(x),\"=r\"(tmp)\r\n\t       :\r\n\t       : \"cc\");\r\n  return(x);\r\n}\r\n\r\n#endif\r\n\r\n#ifndef _V_LSP_MATH_ASM\r\n#define _V_LSP_MATH_ASM\r\n\r\nstatic inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,\r\n\t\t\t\togg_int32_t *qexpp,\r\n\t\t\t\togg_int32_t *ilsp,ogg_int32_t wi,\r\n\t\t\t\togg_int32_t m){\r\n\r\n  ogg_uint32_t qi=*qip,pi=*pip;\r\n  ogg_int32_t qexp=*qexpp;\r\n\r\n  asm(\"mov     r0,%3;\"\r\n      \"mov     r1,%5,asr#1;\"\r\n      \"add     r0,r0,r1,lsl#3;\"\r\n      \"1:\"\r\n\r\n      \"ldmdb   r0!,{r1,r3};\"\r\n      \"subs    r1,r1,%4;\"          //ilsp[j]-wi\r\n      \"rsbmi   r1,r1,#0;\"          //labs(ilsp[j]-wi)\r\n      \"umull   %0,r2,r1,%0;\"       //qi*=labs(ilsp[j]-wi)\r\n\r\n      \"subs    r1,r3,%4;\"          //ilsp[j+1]-wi\r\n      \"rsbmi   r1,r1,#0;\"          //labs(ilsp[j+1]-wi)\r\n      \"umull   %1,r3,r1,%1;\"       //pi*=labs(ilsp[j+1]-wi)\r\n\r\n      \"cmn     r2,r3;\"             // shift down 16?\r\n      \"beq     0f;\"\r\n      \"add     %2,%2,#16;\"\r\n      \"mov     %0,%0,lsr #16;\"\r\n      \"orr     %0,%0,r2,lsl #16;\"\r\n      \"mov     %1,%1,lsr #16;\"\r\n      \"orr     %1,%1,r3,lsl #16;\"\r\n      \"0:\"\r\n      \"cmp     r0,%3;\\n\"\r\n      \"bhi     1b;\\n\"\r\n\r\n      // odd filter assymetry\r\n      \"ands    r0,%5,#1;\\n\"\r\n      \"beq     2f;\\n\"\r\n      \"add     r0,%3,%5,lsl#2;\\n\"\r\n\r\n      \"ldr     r1,[r0,#-4];\\n\"\r\n      \"mov     r0,#0x4000;\\n\"\r\n\r\n      \"subs    r1,r1,%4;\\n\"          //ilsp[j]-wi\r\n      \"rsbmi   r1,r1,#0;\\n\"          //labs(ilsp[j]-wi)\r\n      \"umull   %0,r2,r1,%0;\\n\"       //qi*=labs(ilsp[j]-wi)\r\n      \"umull   %1,r3,r0,%1;\\n\"       //pi*=labs(ilsp[j+1]-wi)\r\n\r\n      \"cmn     r2,r3;\\n\"             // shift down 16?\r\n      \"beq     2f;\\n\"\r\n      \"add     %2,%2,#16;\\n\"\r\n      \"mov     %0,%0,lsr #16;\\n\"\r\n      \"orr     %0,%0,r2,lsl #16;\\n\"\r\n      \"mov     %1,%1,lsr #16;\\n\"\r\n      \"orr     %1,%1,r3,lsl #16;\\n\"\r\n\r\n      //qi=(pi>>shift)*labs(ilsp[j]-wi);\r\n      //pi=(qi>>shift)*labs(ilsp[j+1]-wi);\r\n      //qexp+=shift;\r\n\r\n      //}\r\n\r\n      /* normalize to max 16 sig figs */\r\n      \"2:\"\r\n      \"mov     r2,#0;\"\r\n      \"orr     r1,%0,%1;\"\r\n      \"tst     r1,#0xff000000;\"\r\n      \"addne   r2,r2,#8;\"\r\n      \"movne   r1,r1,lsr #8;\"\r\n      \"tst     r1,#0x00f00000;\"\r\n      \"addne   r2,r2,#4;\"\r\n      \"movne   r1,r1,lsr #4;\"\r\n      \"tst     r1,#0x000c0000;\"\r\n      \"addne   r2,r2,#2;\"\r\n      \"movne   r1,r1,lsr #2;\"\r\n      \"tst     r1,#0x00020000;\"\r\n      \"addne   r2,r2,#1;\"\r\n      \"movne   r1,r1,lsr #1;\"\r\n      \"tst     r1,#0x00010000;\"\r\n      \"addne   r2,r2,#1;\"\r\n      \"mov     %0,%0,lsr r2;\"\r\n      \"mov     %1,%1,lsr r2;\"\r\n      \"add     %2,%2,r2;\"\r\n\r\n      : \"+r\"(qi),\"+r\"(pi),\"+r\"(qexp)\r\n      : \"r\"(ilsp),\"r\"(wi),\"r\"(m)\r\n      : \"r0\",\"r1\",\"r2\",\"r3\",\"cc\");\r\n\r\n  *qip=qi;\r\n  *pip=pi;\r\n  *qexpp=qexp;\r\n}\r\n\r\nstatic inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){\r\n\r\n  ogg_uint32_t qi=*qip;\r\n  ogg_int32_t qexp=*qexpp;\r\n\r\n  asm(\"tst     %0,#0x0000ff00;\"\r\n      \"moveq   %0,%0,lsl #8;\"\r\n      \"subeq   %1,%1,#8;\"\r\n      \"tst     %0,#0x0000f000;\"\r\n      \"moveq   %0,%0,lsl #4;\"\r\n      \"subeq   %1,%1,#4;\"\r\n      \"tst     %0,#0x0000c000;\"\r\n      \"moveq   %0,%0,lsl #2;\"\r\n      \"subeq   %1,%1,#2;\"\r\n      \"tst     %0,#0x00008000;\"\r\n      \"moveq   %0,%0,lsl #1;\"\r\n      \"subeq   %1,%1,#1;\"\r\n      : \"+r\"(qi),\"+r\"(qexp)\r\n      :\r\n      : \"cc\");\r\n  *qip=qi;\r\n  *qexpp=qexp;\r\n}\r\n\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/bitwise.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n  function: packing variable sized words into an octet stream\r\n\r\n ************************************************************************/\r\n\r\n/* We're 'LSb' endian; if we write a word but read individual bits,\r\n   then we'll read the lsb first */\r\n\r\n#include <string.h>\r\n#include <stdlib.h>\r\n#include \"misc.h\"\r\n#include \"ogg.h\"\r\n\r\n#include <stdio.h>\r\n\r\n\r\n#if !defined(ARM_LITTLE_ENDIAN) || defined(_V_BIT_TEST)\r\nstatic unsigned long mask[]=\r\n{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,\r\n 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,\r\n 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,\r\n 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,\r\n 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,\r\n 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,\r\n 0x3fffffff,0x7fffffff,0xffffffff };\r\n#endif\r\n\r\n#ifdef ARM_LITTLE_ENDIAN\r\n\r\n#ifdef DEBUGGING_BITWISE\r\nextern void oggpack_readinitARM(oggpack_buffer *b,ogg_reference *r);\r\n\r\nvoid oggpack_readinit(oggpack_buffer *b,ogg_reference *r){\r\n    oggpack_readinitARM(b,r);\r\n    //fprintf(stderr, \"Init: buffer=(%d,%x,%d,%d) %08x%08x\\n\",\r\n    //        b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord, b->count,\r\n    //        b->ptr[1], b->ptr[0]);\r\n    //fflush(stderr);\r\n}\r\n\r\nextern long oggpack_lookARM(oggpack_buffer *b,int bits);\r\n\r\nlong oggpack_look(oggpack_buffer *b,int bits){\r\n    long l;\r\n\r\n    //fprintf(stderr, \"PreLook: buffer=(%x,%x,%x) %08x%08x (%d bits)\\n\",\r\n    //        b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord,\r\n    //        b->ptr[1], b->ptr[0], bits);\r\n    //fflush(stderr);\r\n    l = oggpack_lookARM(b,bits);\r\n    //fprintf(stderr, \"Look: buffer=(%d,%x,%d,%d) %08x%08x (%d bits) (result=%x)\\n\",\r\n    //        b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord, b->count,\r\n    //        b->ptr[1], b->ptr[0], bits, l);\r\n    //fflush(stderr);\r\n\r\n    return l;\r\n}\r\n\r\nextern void oggpack_advARM(oggpack_buffer *b,int bits);\r\n\r\nvoid oggpack_adv(oggpack_buffer *b,int bits){\r\n    //fprintf(stderr, \"Adv before: buffer=(%x,%x,%x) %08x%08x (%d bits)\\n\",\r\n    //        b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord,\r\n    //        b->ptr[1], b->ptr[0],bits);\r\n    //fflush(stderr);\r\n    oggpack_advARM(b,bits);\r\n    //fprintf(stderr, \"Adv: buffer=(%d,%x,%d,%d) %08x%08x\\n\",\r\n    //        b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord, b->count,\r\n    //        b->ptr[1], b->ptr[0]);\r\n    //fflush(stderr);\r\n}\r\n\r\nextern long oggpack_readARM(oggpack_buffer *b,int bits);\r\n\r\n/* bits <= 32 */\r\nlong oggpack_read(oggpack_buffer *b,int bits){\r\n    long l;\r\n\r\n    //fprintf(stderr, \"PreRead: buffer=(%d,%x,%d,%d) %08x%08x (%d bits)\\n\",\r\n    //        b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord, b->count,\r\n    //        b->ptr[1], b->ptr[0], bits);\r\n    //fflush(stderr);\r\n    l = oggpack_readARM(b,bits);\r\n    //fprintf(stderr, \"Read: buffer=(%d,%x,%d,%d) %08x%08x (%d bits) (result=%x)\\n\",\r\n    //       b->bitsLeftInSegment, b->ptr, b->bitsLeftInWord, b->count,\r\n    //       b->ptr[1], b->ptr[0], bits, l);\r\n    //fflush(stderr);\r\n\r\n    return l;\r\n}\r\n#endif\r\n\r\nint oggpack_eop(oggpack_buffer *b){\r\n  int ret;\r\n  if(b->bitsLeftInSegment<0)ret= -1;\r\n  else ret = 0;\r\n  //fprintf(stderr, \"EOP %d\\n\", ret);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\nlong oggpack_bytes(oggpack_buffer *b){\r\n  long ret;\r\n  if(b->bitsLeftInSegment<0) ret = b->count+b->head->length;\r\n  else ret = b->count + b->head->length - (b->bitsLeftInSegment)/8;\r\n  //fprintf(stderr, \"count=%d length=%d bitsLeftInSegment=%d\\n\",\r\n  //        b->count, b->head->length, b->bitsLeftInSegment);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\nlong oggpack_bits(oggpack_buffer *b){\r\n  long ret;\r\n  if(b->bitsLeftInSegment<0) ret=(b->count+b->head->length)*8;\r\n  else ret = b->count*8 + b->head->length*8 - b->bitsLeftInSegment;\r\n  //fprintf(stderr, \"count=%d length=%d bitsLeftInSegment=%d\\n\",\r\n  //        b->count, b->head->length, b->bitsLeftInSegment);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\n#else\r\n\r\n/* spans forward, skipping as many bytes as headend is negative; if\r\n   headend is zero, simply finds next byte.  If we're up to the end\r\n   of the buffer, leaves headend at zero.  If we've read past the end,\r\n   halt the decode process. */\r\n\r\nstatic void _span(oggpack_buffer *b){\r\n  while(b->headend-(b->headbit>>3)<1){\r\n    b->headend-=b->headbit>>3;\r\n    b->headbit&=0x7;\r\n\r\n    if(b->head && b->head->next){\r\n      b->count+=b->head->length;\r\n      b->head=b->head->next;\r\n\r\n      if(b->headend+b->head->length>0)\r\n\tb->headptr=b->head->buffer->data+b->head->begin-b->headend;\r\n\r\n      b->headend+=b->head->length;\r\n    }else{\r\n      /* we've either met the end of decode, or gone past it. halt\r\n\t only if we're past */\r\n      if(b->headend*8<b->headbit)\r\n\t/* read has fallen off the end */\r\n\tb->headend=-1;\r\n        break;\r\n    }\r\n  }\r\n}\r\n\r\nvoid oggpack_readinit(oggpack_buffer *b,ogg_reference *r){\r\n  memset(b,0,sizeof(*b));\r\n\r\n  b->tail=b->head=r;\r\n  b->count=0;\r\n  if (b->head) {\r\n    b->headptr=b->head->buffer->data+b->head->begin;\r\n    b->headend=b->head->length;\r\n  } else {\r\n    b->headptr=0;\r\n    b->headend=0;\r\n  }\r\n  _span(b);\r\n\r\n  //fprintf(stderr,\r\n  //        \"Init: buffer=(%d,%x,%d,%d) %02x%02x%02x%02x%02x%02x%02x%02x\\n\",\r\n  //        b->headbit, b->headptr, b->headend, b->count,\r\n  //        b->headptr[7], b->headptr[6], b->headptr[5], b->headptr[4],\r\n  //        b->headptr[3], b->headptr[2], b->headptr[1], b->headptr[0]);\r\n  //fflush(stderr);\r\n}\r\n\r\n#define _lookspan()   while(!end){\\\r\n                        head=head->next;\\\r\n                        if(!head) return -1;\\\r\n                        ptr=head->buffer->data + head->begin;\\\r\n                        end=head->length;\\\r\n                      }\r\n\r\n/* Read in bits without advancing the bitptr; bits <= 32 */\r\nlong oggpack_look(oggpack_buffer *b,int bits){\r\n  unsigned long m=mask[bits];\r\n  unsigned long ret = 0;\r\n  int BITS = bits;\r\n\r\n  bits+=b->headbit;\r\n\r\n  if(bits >= b->headend<<3){\r\n    int            end=b->headend;\r\n    unsigned char *ptr=b->headptr;\r\n    ogg_reference *head=b->head;\r\n\r\n    if(end<0)return -1;\r\n    if (!head || !end)return -1;\r\n\r\n    if(bits){\r\n      _lookspan();\r\n      ret=*ptr++>>b->headbit;\r\n      if(bits>8){\r\n        --end;\r\n        _lookspan();\r\n        ret|=*ptr++<<(8-b->headbit);\r\n        if(bits>16){\r\n          --end;\r\n          _lookspan();\r\n          ret|=*ptr++<<(16-b->headbit);\r\n          if(bits>24){\r\n            --end;\r\n            _lookspan();\r\n            ret|=*ptr++<<(24-b->headbit);\r\n            if(bits>32 && b->headbit){\r\n              --end;\r\n              _lookspan();\r\n              ret|=*ptr<<(32-b->headbit);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n  }else{\r\n\r\n    /* make this a switch jump-table */\r\n    ret=b->headptr[0]>>b->headbit;\r\n    if(bits>8){\r\n      ret|=b->headptr[1]<<(8-b->headbit);\r\n      if(bits>16){\r\n        ret|=b->headptr[2]<<(16-b->headbit);\r\n        if(bits>24){\r\n          ret|=b->headptr[3]<<(24-b->headbit);\r\n          if(bits>32 && b->headbit)\r\n            ret|=b->headptr[4]<<(32-b->headbit);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  ret&=m;\r\n  //fprintf(stderr,\r\n  //        \"Look: buffer=(%d,%x,%d,%d) %02x%02x%02x%02x%02x%02x%02x%02x (%d bits) return=%x\\n\",\r\n  //        b->headbit, b->headptr, b->headend, b->count,\r\n  //        b->headptr[7], b->headptr[6], b->headptr[5], b->headptr[4],\r\n  //        b->headptr[3], b->headptr[2], b->headptr[1], b->headptr[0],\r\n  //        BITS, ret);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\n/* limited to 32 at a time */\r\nvoid oggpack_adv(oggpack_buffer *b,int bits){\r\n    int BITS=bits;\r\n  bits+=b->headbit;\r\n  b->headbit=bits&7;\r\n  b->headend-=(bits>>3);\r\n  b->headptr+=(bits>>3);\r\n  if(b->headend<1)_span(b);\r\n  //fprintf(stderr, \"Adv: buffer=(%d,%x,%d,%d) %02x%02x%02x%02x%02x%02x%02x%02x (%d bits)\\n\",\r\n  //        b->headbit, b->headptr, b->headend,b->count,\r\n  //        b->headptr[7], b->headptr[6], b->headptr[5], b->headptr[4],\r\n  //        b->headptr[3], b->headptr[2], b->headptr[1], b->headptr[0],\r\n  //        BITS);\r\n  //fflush(stderr);\r\n}\r\n\r\nint oggpack_eop(oggpack_buffer *b){\r\n  int ret;\r\n  if(b->headend<0)ret= -1;\r\n  else ret = 0;\r\n  //fprintf(stderr, \"EOP %d\\n\", ret);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\nlong oggpack_bytes(oggpack_buffer *b){\r\n  long ret;\r\n  if(b->headend<0) ret = b->count+b->head->length;\r\n  ret = b->count + b->head->length-b->headend + (b->headbit+7)/8;\r\n  //fprintf(stderr, \"Bytes: buffer=(%d,%x,%d,%d) %02x%02x%02x%02x%02x%02x%02x%02x (%d bytes)\\n\",\r\n  //        b->headbit, b->headptr, b->headend, b->count,\r\n  //        b->headptr[7], b->headptr[6], b->headptr[5], b->headptr[4],\r\n  //        b->headptr[3], b->headptr[2], b->headptr[1], b->headptr[0],\r\n  //        ret);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\nlong oggpack_bits(oggpack_buffer *b){\r\n  long ret;\r\n  if(b->headend<0) ret = (b->count+b->head->length)*8;\r\n  else ret = (b->count + b->head->length-b->headend)*8 + b->headbit;\r\n  //fprintf(stderr, \"Bits: buffer=(%x,%x,%x) %02x%02x%02x%02x%02x%02x%02x%02x (%d bits)\\n\",\r\n  //        b->headbit, b->headptr, b->headend,\r\n  //        b->headptr[7], b->headptr[6], b->headptr[5], b->headptr[4],\r\n  //        b->headptr[3], b->headptr[2], b->headptr[1], b->headptr[0],\r\n  //        ret);\r\n  //fflush(stderr);\r\n  return ret;\r\n}\r\n\r\n/* bits <= 32 */\r\nlong oggpack_read(oggpack_buffer *b,int bits){\r\n  long ret=oggpack_look(b,bits);\r\n  oggpack_adv(b,bits);\r\n  return(ret);\r\n}\r\n\r\n#endif\r\n\r\n/* Self test of the bitwise routines; everything else is based on\r\n   them, so they damned well better be solid. */\r\n\r\n#ifdef _V_BIT_TEST\r\n#include <string.h>\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n#include \"framing.c\"\r\n\r\nstatic int ilog(unsigned long v){\r\n  int ret=0;\r\n  while(v){\r\n    ret++;\r\n    v>>=1;\r\n  }\r\n  return(ret);\r\n}\r\n\r\noggpack_buffer r;\r\noggpack_buffer o;\r\nogg_buffer_state *bs;\r\nogg_reference *or;\r\n#define TESTWORDS 256\r\n\r\nvoid report(char *in){\r\n  fprintf(stderr,\"%s\",in);\r\n  exit(1);\r\n}\r\n\r\nint getbyte(ogg_reference *or,int position){\r\n  while(or && position>=or->length){\r\n    position-=or->length;\r\n    or=or->next;\r\n    if(or==NULL){\r\n      fprintf(stderr,\"\\n\\tERROR: getbyte ran off end of buffer.\\n\");\r\n      exit(1);\r\n    }\r\n  }\r\n\r\n  if((position+or->begin)&1)\r\n    return (or->buffer->data[(position+or->begin)>>1])&0xff;\r\n  else\r\n    return (or->buffer->data[(position+or->begin)>>1]>>8)&0xff;\r\n}\r\n\r\nvoid cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){\r\n  long i,bitcount=0;\r\n  ogg_reference *or=ogg_buffer_alloc(bs,64);\r\n  for(i=0;i<compsize;i++)\r\n    or->buffer->data[i]= comp[i];\r\n  or->length=i;\r\n\r\n  oggpack_readinit(&r,or);\r\n  for(i=0;i<vals;i++){\r\n    unsigned long test;\r\n    int tbit=bits?bits:ilog(b[i]);\r\n    if((test=oggpack_look(&r,tbit))==0xffffffff)\r\n      report(\"out of data!\\n\");\r\n    if(test!=(b[i]&mask[tbit])){\r\n      fprintf(stderr,\"%ld) %lx %lx\\n\",i,(b[i]&mask[tbit]),test);\r\n      report(\"looked at incorrect value!\\n\");\r\n    }\r\n    if((test=oggpack_read(&r,tbit))==0xffffffff){\r\n      report(\"premature end of data when reading!\\n\");\r\n    }\r\n    if(test!=(b[i]&mask[tbit])){\r\n      fprintf(stderr,\"%ld) %lx %lx\\n\",i,(b[i]&mask[tbit]),test);\r\n      report(\"read incorrect value!\\n\");\r\n    }\r\n    bitcount+=tbit;\r\n\r\n    if(bitcount!=oggpack_bits(&r))\r\n      report(\"wrong number of bits while reading!\\n\");\r\n    if((bitcount+7)/8!=oggpack_bytes(&r))\r\n      report(\"wrong number of bytes while reading!\\n\");\r\n\r\n  }\r\n  if(oggpack_bytes(&r)!=(bitcount+7)/8){\r\n      fprintf(stderr, \"%d vs %d\\n\", oggpack_bytes(&r), (bitcount+7)/8);\r\n      report(\"leftover bytes after read!\\n\");\r\n  }\r\n  ogg_buffer_release(or);\r\n}\r\n\r\nvoid _end_verify(int count){\r\n  int i;\r\n\r\n  /* are the proper number of bits left over? */\r\n  int leftover=count*8-oggpack_bits(&o);\r\n  if(leftover>7)\r\n    report(\"\\nERROR: too many bits reported left over.\\n\");\r\n\r\n  /* does reading to exactly byte alignment *not* trip EOF? */\r\n  if(oggpack_read(&o,leftover)==-1)\r\n    report(\"\\nERROR: read to but not past exact end tripped EOF.\\n\");\r\n  if(oggpack_bits(&o)!=count*8)\r\n    report(\"\\nERROR: read to but not past exact end reported bad bitcount.\\n\");\r\n\r\n  /* does EOF trip properly after a single additional bit? */\r\n  if(oggpack_read(&o,1)!=-1)\r\n    report(\"\\nERROR: read past exact end did not trip EOF.\\n\");\r\n  if(oggpack_bits(&o)!=count*8)\r\n    report(\"\\nERROR: read past exact end reported bad bitcount.\\n\");\r\n\r\n  /* does EOF stay set over additional bit reads? */\r\n  for(i=0;i<=32;i++){\r\n    if(oggpack_read(&o,i)!=-1)\r\n      report(\"\\nERROR: EOF did not stay set on stream.\\n\");\r\n    if(oggpack_bits(&o)!=count*8)\r\n      report(\"\\nERROR: read past exact end reported bad bitcount.\\n\");\r\n  }\r\n}\r\n\r\nvoid _end_verify2(int count){\r\n  int i;\r\n\r\n  /* are the proper number of bits left over? */\r\n  int leftover=count*8-oggpack_bits(&o);\r\n  if(leftover>7)\r\n    report(\"\\nERROR: too many bits reported left over.\\n\");\r\n\r\n  /* does reading to exactly byte alignment *not* trip EOF? */\r\n  oggpack_adv(&o,leftover);\r\n#ifdef ARM_LITTLE_ENDIAN\r\n    if(o.bitsLeftInSegment!=0)\r\n#else\r\n  if(o.headend!=0)\r\n#endif\r\n    report(\"\\nERROR: read to but not past exact end tripped EOF.\\n\");\r\n  if(oggpack_bits(&o)!=count*8)\r\n    report(\"\\nERROR: read to but not past exact end reported bad bitcount.\\n\");\r\n\r\n  /* does EOF trip properly after a single additional bit? */\r\n  oggpack_adv(&o,1);\r\n#ifdef ARM_LITTLE_ENDIAN\r\n    if(o.bitsLeftInSegment>=0)\r\n#else\r\n  if(o.headend>=0)\r\n#endif\r\n    report(\"\\nERROR: read past exact end did not trip EOF.\\n\");\r\n  if(oggpack_bits(&o)!=count*8)\r\n    report(\"\\nERROR: read past exact end reported bad bitcount.\\n\");\r\n\r\n  /* does EOF stay set over additional bit reads? */\r\n  for(i=0;i<=32;i++){\r\n    oggpack_adv(&o,i);\r\n#ifdef ARM_LITTLE_ENDIAN\r\n    if(o.bitsLeftInSegment>=0)\r\n#else\r\n    if(o.headend>=0)\r\n#endif\r\n      report(\"\\nERROR: EOF did not stay set on stream.\\n\");\r\n    if(oggpack_bits(&o)!=count*8)\r\n      report(\"\\nERROR: read past exact end reported bad bitcount.\\n\");\r\n  }\r\n}\r\n\r\nlong ogg_buffer_length(ogg_reference *or){\r\n  int count=0;\r\n  while(or){\r\n    count+=or->length;\r\n    or=or->next;\r\n  }\r\n  return count;\r\n}\r\n\r\nogg_reference *ogg_buffer_extend(ogg_reference *or,long bytes){\r\n  if(or){\r\n    while(or->next){\r\n      or=or->next;\r\n    }\r\n    or->next=ogg_buffer_alloc(or->buffer->ptr.owner,bytes);\r\n    return(or->next);\r\n  }\r\n  return 0;\r\n}\r\n\r\nvoid ogg_buffer_posttruncate(ogg_reference *or,long pos){\r\n  /* walk to the point where we want to begin truncate */\r\n  while(or && pos>or->length){\r\n    pos-=or->length;\r\n    or=or->next;\r\n  }\r\n  if(or){\r\n    ogg_buffer_release(or->next);\r\n    or->next=0;\r\n    or->length=pos;\r\n  }\r\n}\r\n\r\nint main(void){\r\n  long i;\r\n  static unsigned long testbuffer1[]=\r\n    {18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,\r\n       567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};\r\n  int test1size=43;\r\n\r\n  static unsigned long testbuffer2[]=\r\n    {216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,\r\n       1233432,534,5,346435231,14436467,7869299,76326614,167548585,\r\n       85525151,0,12321,1,349528352};\r\n  int test2size=21;\r\n\r\n  static unsigned long testbuffer3[]=\r\n    {1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,\r\n       0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};\r\n  int test3size=56;\r\n\r\n  static unsigned long large[]=\r\n    {2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,\r\n       1233432,534,5,2146435231,14436467,7869299,76326614,167548585,\r\n       85525151,0,12321,1,2146528352};\r\n\r\n  int onesize=33;\r\n  static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,\r\n                    34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,\r\n                    223,4};\r\n\r\n  int twosize=6;\r\n  static int two[6]={61,255,255,251,231,29};\r\n\r\n  int threesize=54;\r\n  static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,\r\n                      142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,\r\n                      58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,\r\n                      100,52,4,14,18,86,77,1};\r\n\r\n  int foursize=38;\r\n  static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,\r\n                     132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,\r\n                     28,2,133,0,1};\r\n\r\n  int fivesize=45;\r\n  static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,\r\n                     241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,\r\n                     84,75,159,2,1,0,132,192,8,0,0,18,22};\r\n\r\n  int sixsize=7;\r\n  static int six[7]={17,177,170,242,169,19,148};\r\n\r\n  /* Test read/write together */\r\n  /* Later we test against pregenerated bitstreams */\r\n  bs=ogg_buffer_create();\r\n\r\n  fprintf(stderr,\"\\nSmall preclipped packing (LSb): \");\r\n  cliptest(testbuffer1,test1size,0,one,onesize);\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\nNull bit call (LSb): \");\r\n  cliptest(testbuffer3,test3size,0,two,twosize);\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\nLarge preclipped packing (LSb): \");\r\n  cliptest(testbuffer2,test2size,0,three,threesize);\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\n32 bit preclipped packing (LSb): \");\r\n\r\n  or=ogg_buffer_alloc(bs,128);\r\n  for(i=0;i<test2size;i++){\r\n    or->buffer->data[i*4]  = large[i]&0xff;\r\n    or->buffer->data[i*4+1]  = (large[i]>>8)&0xff;\r\n    or->buffer->data[i*4+2]  = (large[i]>>16)&0xff;\r\n    or->buffer->data[i*4+3]  = (large[i]>>24)&0xff;\r\n  }\r\n  or->length=test2size*4;\r\n  oggpack_readinit(&r,or);\r\n  for(i=0;i<test2size;i++){\r\n    unsigned long test;\r\n    if((test=oggpack_look(&r,32))==0xffffffffUL)report(\"out of data. failed!\");\r\n    if(test!=large[i]){\r\n      fprintf(stderr,\"%ld != %ld (%lx!=%lx):\",test,large[i],\r\n              test,large[i]);\r\n      report(\"read incorrect value!\\n\");\r\n    }\r\n    oggpack_adv(&r,32);\r\n  }\r\n  ogg_buffer_release(or);\r\n  if(oggpack_bytes(&r)!=test2size*4){\r\n    fprintf(stderr, \"%d vs %d\\n\", oggpack_bytes(&r), test2size*4);\r\n    report(\"leftover bytes after read!\\n\");\r\n  }\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\nSmall unclipped packing (LSb): \");\r\n  cliptest(testbuffer1,test1size,7,four,foursize);\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\nLarge unclipped packing (LSb): \");\r\n  cliptest(testbuffer2,test2size,17,five,fivesize);\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\nSingle bit unclipped packing (LSb): \");\r\n  cliptest(testbuffer3,test3size,1,six,sixsize);\r\n  fprintf(stderr,\"ok.\");\r\n\r\n  fprintf(stderr,\"\\nTesting read past end (LSb): \");\r\n  {\r\n    unsigned char dda[]={0,0,0,0};\r\n    ogg_buffer lob={dda,8,0,{0}};\r\n    ogg_reference lor={&lob,0,8,0};\r\n\r\n    oggpack_readinit(&r,&lor);\r\n    for(i=0;i<64;i++){\r\n      if(oggpack_read(&r,1)<0){\r\n        fprintf(stderr,\"failed; got -1 prematurely.\\n\");\r\n        exit(1);\r\n      }\r\n    }\r\n    if(oggpack_look(&r,1)!=-1 ||\r\n       oggpack_read(&r,1)!=-1){\r\n      fprintf(stderr,\"failed; read past end without -1.\\n\");\r\n      exit(1);\r\n    }\r\n  }\r\n  {\r\n    unsigned char dda[]={0,0,0,0};\r\n    ogg_buffer lob={dda,8,0,{0}};\r\n    ogg_reference lor={&lob,0,8,0};\r\n    unsigned long test;\r\n\r\n    oggpack_readinit(&r,&lor);\r\n    if((test=oggpack_read(&r,30))==0xffffffffUL ||\r\n       (test=oggpack_read(&r,16))==0xffffffffUL){\r\n      fprintf(stderr,\"failed 2; got -1 prematurely.\\n\");\r\n      exit(1);\r\n    }\r\n\r\n    if((test=oggpack_look(&r,18))==0xffffffffUL){\r\n      fprintf(stderr,\"failed 3; got -1 prematurely.\\n\");\r\n      exit(1);\r\n    }\r\n    if((test=oggpack_look(&r,19))!=0xffffffffUL){\r\n      fprintf(stderr,\"failed; read past end without -1.\\n\");\r\n      exit(1);\r\n    }\r\n    if((test=oggpack_look(&r,32))!=0xffffffffUL){\r\n      fprintf(stderr,\"failed; read past end without -1.\\n\");\r\n      exit(1);\r\n    }\r\n  }\r\n  fprintf(stderr,\"ok.\\n\");\r\n\r\n  /* now the scary shit: randomized testing */\r\n\r\n  for(i=0;i<10000;i++){\r\n    long j,count=0,count2=0,bitcount=0;\r\n    unsigned long values[TESTWORDS];\r\n    int len[TESTWORDS];\r\n    unsigned char flat[4*TESTWORDS]; /* max possible needed size */\r\n\r\n    memset(flat,0,sizeof(flat));\r\n    fprintf(stderr,\"\\rRandomized testing (LSb)... (%ld)   \",10000-i);\r\n\r\n    /* generate a list of words and lengths */\r\n    /* write the required number of bits out to packbuffer */\r\n    {\r\n      long word=0;\r\n      long bit=0;\r\n      int k;\r\n\r\n      for(j=0;j<TESTWORDS;j++){\r\n\tvalues[j]=rand();\r\n\tlen[j]=(rand()%33);\r\n\r\n\tfor(k=0;k<len[j];k++){\r\n\t  flat[word] |= ((values[j]>>k)&0x1)<<bit;\r\n\t  bit++;\r\n\t  bitcount++;\r\n\t  if(bit>7){\r\n\t    bit=0;\r\n\t    word++;\r\n\t  }\r\n\t}\r\n      }\r\n    }\r\n    count2=(bitcount+7)>>3;\r\n\r\n    /* construct random-length buffer chain from flat vector; random\r\n       byte starting offset within the length of the vector */\r\n    {\r\n      ogg_reference *or=NULL,*orl=NULL;\r\n      long pos=0;\r\n\r\n      /* build buffer chain */\r\n      while(count2){\r\n        int ilen=(rand()%32),k;\r\n        int ibegin=(rand()%32);\r\n\r\n\r\n        if(ilen>count2)ilen=count2;\r\n\r\n        if(or)\r\n          orl=ogg_buffer_extend(orl,64);\r\n        else\r\n          or=orl=ogg_buffer_alloc(bs,64);\r\n\r\n        orl->length=ilen;\r\n        orl->begin=ibegin;\r\n\r\n\tfor(k=0;k<ilen;k++)\r\n\t  orl->buffer->data[ibegin++]= flat[pos++];\r\n\r\n        count2-=ilen;\r\n      }\r\n\r\n      if(ogg_buffer_length(or)!=(bitcount+7)/8){\r\n        fprintf(stderr,\"\\nERROR: buffer length incorrect after build.\\n\");\r\n        exit(1);\r\n      }\r\n\r\n\r\n      {\r\n        int begin=0; //=(rand()%TESTWORDS);\r\n        int ilen=(rand()%(TESTWORDS-begin));\r\n        int bitoffset,bitcount=0;\r\n        unsigned long temp;\r\n\r\n        for(j=0;j<begin;j++)\r\n          bitcount+=len[j];\r\n        or=ogg_buffer_pretruncate(or,bitcount/8);\r\n        bitoffset=bitcount%=8;\r\n        for(;j<begin+ilen;j++)\r\n          bitcount+=len[j];\r\n        ogg_buffer_posttruncate(or,((bitcount+7)/8));\r\n\r\n        if((count=ogg_buffer_length(or))!=(bitcount+7)/8){\r\n          fprintf(stderr,\"\\nERROR: buffer length incorrect after truncate.\\n\");\r\n          exit(1);\r\n        }\r\n\r\n        oggpack_readinit(&o,or);\r\n\r\n        /* verify bit count */\r\n        if(oggpack_bits(&o)!=0){\r\n          fprintf(stderr,\"\\nERROR: Read bitcounter not zero!\\n\");\r\n          exit(1);\r\n        }\r\n        if(oggpack_bytes(&o)!=0){\r\n          fprintf(stderr,\"\\nERROR: Read bytecounter not zero!\\n\");\r\n          exit(1);\r\n        }\r\n\r\n        bitcount=bitoffset;\r\n        oggpack_read(&o,bitoffset);\r\n\r\n        /* read and compare to original list */\r\n        for(j=begin;j<begin+ilen;j++){\r\n\t  temp=oggpack_read(&o,len[j]);\r\n          if(temp==0xffffffffUL){\r\n            fprintf(stderr,\"\\nERROR: End of stream too soon! word: %ld,%d\\n\",\r\n                    j-begin,ilen);\r\n            exit(1);\r\n          }\r\n          if(temp!=(values[j]&mask[len[j]])){\r\n            fprintf(stderr,\"\\nERROR: Incorrect read %lx != %lx, word %ld, len %d\\n\"\r\n,\r\n                    values[j]&mask[len[j]],temp,j-begin,len[j]);\r\n            exit(1);\r\n          }\r\n          bitcount+=len[j];\r\n          if(oggpack_bits(&o)!=bitcount){\r\n            fprintf(stderr,\"\\nERROR: Read bitcounter %d != %ld!\\n\",\r\n                    bitcount,oggpack_bits(&o));\r\n            exit(1);\r\n          }\r\n          if(oggpack_bytes(&o)!=(bitcount+7)/8){\r\n            fprintf(stderr,\"\\nERROR: Read bytecounter %d != %ld!\\n\",\r\n                    (bitcount+7)/8,oggpack_bytes(&o));\r\n            exit(1);\r\n          }\r\n\r\n        }\r\n        _end_verify(count);\r\n\r\n        /* look/adv version */\r\n        oggpack_readinit(&o,or);\r\n        bitcount=bitoffset;\r\n        oggpack_adv(&o,bitoffset);\r\n\r\n        /* read and compare to original list */\r\n        for(j=begin;j<begin+ilen;j++){\r\n\t  temp=oggpack_look(&o,len[j]);\r\n\r\n          if(temp==0xffffffffUL){\r\n            fprintf(stderr,\"\\nERROR: End of stream too soon! word: %ld\\n\",\r\n                    j-begin);\r\n            exit(1);\r\n          }\r\n          if(temp!=(values[j]&mask[len[j]])){\r\n            fprintf(stderr,\"\\nERROR: Incorrect look %lx != %lx, word %ld, len %d\\n\"\r\n,\r\n                    values[j]&mask[len[j]],temp,j-begin,len[j]);\r\n            exit(1);\r\n          }\r\n\t  oggpack_adv(&o,len[j]);\r\n          bitcount+=len[j];\r\n          if(oggpack_bits(&o)!=bitcount){\r\n            fprintf(stderr,\"\\nERROR: Look/Adv bitcounter %d != %ld!\\n\",\r\n                    bitcount,oggpack_bits(&o));\r\n            exit(1);\r\n          }\r\n          if(oggpack_bytes(&o)!=(bitcount+7)/8){\r\n            fprintf(stderr,\"\\nERROR: Look/Adv bytecounter %d != %ld!\\n\",\r\n                    (bitcount+7)/8,oggpack_bytes(&o));\r\n            exit(1);\r\n          }\r\n\r\n        }\r\n        _end_verify2(count);\r\n\r\n      }\r\n      ogg_buffer_release(or);\r\n    }\r\n  }\r\n  fprintf(stderr,\"\\rRandomized testing (LSb)... ok.   \\n\");\r\n\r\n  return(0);\r\n}\r\n\r\n#ifdef _WIN32_WCE\r\nint WinMain(void){\r\n    return main();\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/bitwiseARM.s",
    "content": "@ Tremolo library\r\n@-----------------------------------------------------------------------\r\n@ Copyright (C) 2002-2009, Xiph.org Foundation\r\n@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n@ All rights reserved.\r\n\r\n@ Redistribution and use in source and binary forms, with or without\r\n@ modification, are permitted provided that the following conditions\r\n@ are met:\r\n\r\n@     * Redistributions of source code must retain the above copyright\r\n@ notice, this list of conditions and the following disclaimer.\r\n@     * Redistributions in binary form must reproduce the above\r\n@ copyright notice, this list of conditions and the following disclaimer\r\n@ in the documentation and/or other materials provided with the\r\n@ distribution.\r\n@     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n@ Productions Ltd nor the names of its contributors may be used to\r\n@ endorse or promote products derived from this software without\r\n@ specific prior written permission.\r\n@\r\n@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n@ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n@ ----------------------------------------------------------------------\r\n\r\n    .text\r\n\r\n\t.global\toggpack_look\r\n\t.global\toggpack_adv\r\n\t.global\toggpack_readinit\r\n\t.global\toggpack_read\r\n\r\noggpack_look:\r\n\t@ r0 = oggpack_buffer *b\r\n\t@ r1 = int             bits\r\n\tSTMFD\tr13!,{r10,r11,r14}\r\n\tLDMIA\tr0,{r2,r3,r12}\r\n\t\t\t\t\t@ r2 = bitsLeftInSegment\r\n\t\t\t\t\t@ r3 = ptr\r\n\t\t\t\t\t@ r12= bitsLeftInWord\r\n\tSUBS\tr2,r2,r1\t\t@ bitsLeftinSegment -= bits\r\n\tBLT\tlook_slow\t\t@ Not enough bits in this segment for\r\n\t\t\t\t\t@ this request. Do it slowly.\r\n\tLDR\tr10,[r3]\t\t@ r10= ptr[0]\r\n\tRSB\tr14,r12,#32\t\t@ r14= 32-bitsLeftInWord\r\n\tSUBS\tr12,r12,r1\t\t@ r12= bitsLeftInWord -= bits\r\n\tLDRLT\tr11,[r3,#4]!\t\t@ r11= ptr[1]\r\n\tMOV\tr10,r10,LSR r14\t\t@ r10= ptr[0]>>(32-bitsLeftInWord)\r\n\tADDLE\tr12,r12,#32\t\t@ r12= bitsLeftInWord += 32\r\n\tRSB\tr14,r14,#32\t\t@ r14= 32-bitsLeftInWord\r\n\tORRLT\tr10,r10,r11,LSL r14\t@ r10= Next 32 bits.\r\n\tMOV\tr14,#1\r\n\tRSB\tr14,r14,r14,LSL r1\r\n\tAND\tr0,r10,r14\r\n\tLDMFD\tr13!,{r10,r11,PC}\r\n\r\nlook_slow:\r\n\tSTMFD\tr13!,{r5,r6}\r\n\tADDS\tr10,r2,r1\t\t@ r10= bitsLeftInSegment + bits (i.e.\r\n\t\t\t\t\t@ the initial value of bitsLeftInSeg)\r\n\t@ r10 = bitsLeftInSegment (initial)\r\n\t@ r12 = bitsLeftInWord\r\n\tRSB\tr14,r12,#32\t\t@ r14= 32-bitsLeftInWord\r\n\tMOV\tr5,r10\t\t\t@ r5 = bitsLeftInSegment (initial)\r\n\tBLT\tlook_overrun\r\n\tBEQ\tlook_next_segment\t@ r10= r12 = 0, if we branch\r\n\tCMP\tr12,r10\t\t\t@ If bitsLeftInWord < bitsLeftInSeg\r\n\t\t\t\t\t@ there must be more in the next word\r\n\tLDR\tr10,[r3],#4\t\t@ r10= ptr[0]\r\n\tLDRLT\tr6,[r3]\t\t\t@ r6 = ptr[1]\r\n\tMOV\tr11,#1\r\n\tMOV\tr10,r10,LSR r14\t\t@ r10= first bitsLeftInWord bits\r\n\tORRLT\tr10,r10,r6,LSL r12\t@ r10= first bitsLeftInSeg bits+crap\r\n\tRSB\tr11,r11,r11,LSL r5\t@ r11= mask\r\n\tAND\tr10,r10,r11\t\t@ r10= first r5 bits\r\n\t@ Load the next segments data\r\nlook_next_segment:\r\n\t@ At this point, r10 contains the first r5 bits of the result\r\n\tLDR\tr11,[r0,#12]\t\t@ r11= head = b->head\r\n\t@ Stall\r\n\t@ Stall\r\nlook_next_segment_2:\r\n\tLDR\tr11,[r11,#12]\t\t@ r11= head = head->next\r\n\t@ Stall\r\n\t@ Stall\r\n\tCMP\tr11,#0\r\n\tBEQ\tlook_out_of_data\r\n\tLDMIA\tr11,{r6,r12,r14}\t@ r6 = buffer\r\n\t\t\t\t\t@ r12= begin\r\n\t\t\t\t\t@ r14= length\r\n\tLDR\tr6,[r6]\t\t\t@ r6 = buffer->data\r\n\tCMP\tr14,#0\r\n\tBEQ\tlook_next_segment_2\r\n\tADD\tr6,r6,r12\t\t@ r6 = buffer->data+begin\r\nlook_slow_loop:\r\n\tLDRB\tr12,[r6],#1\t\t@ r12= *buffer\r\n\tSUBS\tr14,r14,#1\t\t@ r14= length\r\n\t@ Stall\r\n\tORR\tr10,r10,r12,LSL r5\t@ r10= first r5+8 bits\r\n\tADD\tr5,r5,#8\r\n\tBLE\tlook_really_slow\r\n\tCMP\tr5,r1\r\n\tBLT\tlook_slow_loop\r\n\tMOV\tr14,#1\r\n\tRSB\tr14,r14,r14,LSL r1\r\n\tAND\tr0,r10,r14\r\n\tLDMFD\tr13!,{r5,r6,r10,r11,PC}\r\n\r\n\r\nlook_really_slow:\r\n\tCMP\tr5,r1\r\n\tBLT\tlook_next_segment_2\r\n\tMOV\tr14,#1\r\n\tRSB\tr14,r14,r14,LSL r1\r\n\tAND\tr0,r10,r14\r\n\tLDMFD\tr13!,{r5,r6,r10,r11,PC}\r\n\r\nlook_out_of_data:\r\n\t@MVN\tr0,#0\t\t\t; return -1\r\n\tMOV\tr0,#0\r\n\tLDMFD\tr13!,{r5,r6,r10,r11,PC}\r\n\r\nlook_overrun:\r\n\t@ We had overrun when we started, so we need to skip -r10 bits.\r\n\tLDR\tr11,[r0,#12]\t\t@ r11 = head = b->head\r\n\t@ stall\r\n\t@ stall\r\nlook_overrun_next_segment:\r\n\tLDR\tr11,[r11,#12]\t\t@ r11 = head->next\r\n\t@ stall\r\n\t@ stall\r\n\tCMP\tr11,#0\r\n\tBEQ\tlook_out_of_data\r\n\tLDMIA\tr11,{r6,r7,r14}\t\t@ r6 = buffer\r\n\t\t\t\t\t@ r7 = begin\r\n\t\t\t\t\t@ r14= length\r\n\tLDR\tr6,[r6]\t\t\t@ r6 = buffer->data\r\n\t@ stall\r\n\t@ stall\r\n\tADD\tr6,r6,r7\t\t@ r6 = buffer->data+begin\r\n\tMOV\tr14,r14,LSL #3\t\t@ r14= length in bits\r\n\tADDS\tr14,r14,r10\t\t@ r14= length in bits-bits to skip\r\n\tMOVLE\tr10,r14\r\n\tBLE\tlook_overrun_next_segment\r\n\tRSB\tr10,r10,#0\t\t@ r10= bits to skip\r\n\tADD\tr6,r10,r10,LSR #3\t@ r6 = pointer to data\r\n\tMOV\tr10,#0\r\n\tB\tlook_slow_loop\r\n\r\noggpack_adv:\r\n\t@ r0 = oggpack_buffer *b\r\n\t@ r1 = bits\r\n\tLDMIA\tr0,{r2,r3,r12}\r\n\t\t\t\t\t@ r2 = bitsLeftInSegment\r\n\t\t\t\t\t@ r3 = ptr\r\n\t\t\t\t\t@ r12= bitsLeftInWord\r\n\tSUBS\tr2,r2,r1\t\t@ Does this run us out of bits in the\r\n\tBLE\tadv_slow\t\t@ segment? If so, do it slowly\r\n\tSUBS\tr12,r12,r1\r\n\tADDLE\tr12,r12,#32\r\n\tADDLE\tr3,r3,#4\r\n\tSTMIA\tr0,{r2,r3,r12}\r\n\tBX      LR\r\nadv_slow:\r\n\tSTMFD\tr13!,{r10,r14}\r\n\r\n\tLDR\tr14,[r0,#12]\t\t@ r14= head\r\n\t@ stall\r\nadv_slow_loop:\r\n\tLDR\tr1,[r0,#20]\t\t@ r1 = count\r\n\tLDR\tr10,[r14,#8]\t\t@ r10= head->length\r\n\tLDR\tr14,[r14,#12]\t\t@ r14= head->next\r\n\t@ stall\r\n\tADD\tr1,r1,r10\t\t@ r1 = count += head->length\r\n\tCMP\tr14,#0\r\n\tBEQ\tadv_end\r\n\tSTR\tr1,[r0,#20]\t\t@ b->count = count\r\n\tSTR\tr14,[r0,#12]\t\t@ b->head = head\r\n\tLDMIA\tr14,{r3,r10,r12}\t@ r3 = buffer\r\n\t\t\t\t\t@ r10= begin\r\n\t\t\t\t\t@ r12= length\r\n\tLDR\tr3,[r3]\t\t\t@ r3 = buffer->data\r\n\tADD\tr3,r3,r10\t\t@ r3 = Pointer to start (byte)\r\n\tAND\tr10,r3,#3\t\t@ r10= bytes to backtrk to word align\r\n\tMOV\tr10,r10,LSL #3\t\t@ r10= bits to backtrk to word align\r\n\tRSB\tr10,r10,#32\t\t@ r10= bits left in word\r\n\tADDS\tr10,r10,r2\t\t@ r10= bits left in word after skip\r\n\tADDLE\tr10,r10,#32\r\n\tADDLE\tr3,r3,#4\r\n\tBIC\tr3,r3,#3\t\t@ r3 = Pointer to start (word)\r\n\tADDS\tr2,r2,r12,LSL #3\t@ r2 = length in bits after advance\r\n\tBLE\tadv_slow_loop\r\n\tSTMIA\tr0,{r2,r3,r10}\r\n\r\n\tLDMFD\tr13!,{r10,PC}\r\nadv_end:\r\n\tMOV\tr2, #0\r\n\tMOV\tr12,#0\r\n\tSTMIA\tr0,{r2,r3,r12}\r\n\r\n\tLDMFD\tr13!,{r10,PC}\r\n\r\noggpack_readinit:\r\n\t@ r0 = oggpack_buffer *b\r\n\t@ r1 = oggreference   *r\r\n\tSTR\tr1,[r0,#12]\t\t@ b->head = r1\r\n\tSTR\tr1,[r0,#16]\t\t@ b->tail = r1\r\n\tLDMIA\tr1,{r2,r3,r12}\t\t@ r2 = b->head->buffer\r\n\t\t\t\t\t@ r3 = b->head->begin\r\n\t\t\t\t\t@ r12= b->head->length\r\n\tLDR\tr2,[r2]\t\t\t@ r2 = b->head->buffer->data\r\n\tMOV\tr1,r12,LSL #3\t\t@ r1 = BitsInSegment\r\n\tMOV\tr12,#0\r\n\tADD\tr3,r2,r3\t\t@ r3 = r2+b->head->begin\r\n\tBIC\tr2,r3,#3\t\t@ r2 = b->headptr (word)\r\n\tAND\tr3,r3,#3\r\n\tMOV\tr3,r3,LSL #3\r\n\tRSB\tr3,r3,#32\t\t@ r3 = BitsInWord\r\n\tSTMIA\tr0,{r1,r2,r3}\r\n\tSTR\tr12,[r0,#20]\r\n\tBX      LR\r\n\r\noggpack_read:\r\n\t@ r0 = oggpack_buffer *b\r\n\t@ r1 = int             bits\r\n\tSTMFD\tr13!,{r10,r11,r14}\r\n\tLDMIA\tr0,{r2,r3,r12}\r\n\t\t\t\t\t@ r2 = bitsLeftInSegment\r\n\t\t\t\t\t@ r3 = ptr\r\n\t\t\t\t\t@ r12= bitsLeftInWord\r\n\tSUBS\tr2,r2,r1\t\t@ bitsLeftinSegment -= bits\r\n\tBLT\tread_slow\t\t@ Not enough bits in this segment for\r\n\t\t\t\t\t@ this request. Do it slowly.\r\n\tLDR\tr10,[r3]\t\t@ r10= ptr[0]\r\n\tRSB\tr14,r12,#32\t\t@ r14= 32-bitsLeftInWord\r\n\tSUBS\tr12,r12,r1\t\t@ r12= bitsLeftInWord -= bits\r\n\tADDLE\tr3,r3,#4\r\n\tLDRLT\tr11,[r3]\t\t@ r11= ptr[1]\r\n\tMOV\tr10,r10,LSR r14\t\t@ r10= ptr[0]>>(32-bitsLeftInWord)\r\n\tADDLE\tr12,r12,#32\t\t@ r12= bitsLeftInWord += 32\r\n\tRSB\tr14,r14,#32\t\t@ r14= 32-bitsLeftInWord\r\n\tORRLT\tr10,r10,r11,LSL r14\t@ r10= Next 32 bits.\r\n\tSTMIA\tr0,{r2,r3,r12}\r\n\tMOV\tr14,#1\r\n\tRSB\tr14,r14,r14,LSL r1\r\n\tAND\tr0,r10,r14\r\n\tLDMFD\tr13!,{r10,r11,PC}\r\n\r\nread_slow:\r\n\tSTMFD\tr13!,{r5,r6}\r\n\tADDS\tr10,r2,r1\t\t@ r10= bitsLeftInSegment + bits (i.e.\r\n\t\t\t\t\t@ the initial value of bitsLeftInSeg)\r\n\t@ r10 = bitsLeftInSegment (initial)\r\n\t@ r12 = bitsLeftInWord\r\n\tRSB\tr14,r12,#32\t\t@ r14= 32-bitsLeftInWord\r\n\tMOV\tr5,r10\t\t\t@ r5 = bitsLeftInSegment (initial)\r\n\tBLT\tread_overrun\r\n\tBEQ\tread_next_segment\t@ r10= r12 = 0, if we branch\r\n\tCMP\tr12,r10\t\t\t@ If bitsLeftInWord < bitsLeftInSeg\r\n\t\t\t\t\t@ there must be more in the next word\r\n\tLDR\tr10,[r3],#4\t\t@ r10= ptr[0]\r\n\tLDRLT\tr6,[r3]\t\t\t@ r6 = ptr[1]\r\n\tMOV\tr11,#1\r\n\tMOV\tr10,r10,LSR r14\t\t@ r10= first bitsLeftInWord bits\r\n\tORRLT\tr10,r10,r6,LSL r12\t@ r10= first bitsLeftInSeg bits+crap\r\n\tRSB\tr11,r11,r11,LSL r5\t@ r11= mask\r\n\tAND\tr10,r10,r11\t\t@ r10= first r5 bits\r\n\t@ Load the next segments data\r\nread_next_segment:\r\n\t@ At this point, r10 contains the first r5 bits of the result\r\n\tLDR\tr11,[r0,#12]\t\t@ r11= head = b->head\r\n\t@ Stall\r\nread_next_segment_2:\r\n\t@ r11 = head\r\n\tLDR\tr6,[r0,#20]\t\t@ r6 = count\r\n\tLDR\tr12,[r11,#8]\t\t@ r12= length\r\n\tLDR\tr11,[r11,#12]\t\t@ r11= head = head->next\r\n\t@ Stall\r\n\tADD\tr6,r6,r12\t\t@ count += length\r\n\tCMP\tr11,#0\r\n\tBEQ\tread_out_of_data\r\n\tSTR\tr11,[r0,#12]\r\n\tSTR\tr6,[r0,#20]\t\t@ b->count = count\r\n\tLDMIA\tr11,{r6,r12,r14}\t@ r6 = buffer\r\n\t\t\t\t\t@ r12= begin\r\n\t\t\t\t\t@ r14= length\r\n\tLDR\tr6,[r6]\t\t\t@ r6 = buffer->data\r\n\tCMP\tr14,#0\r\n\tBEQ\tread_next_segment_2\r\n\tADD\tr6,r6,r12\t\t@ r6 = buffer->data+begin\r\nread_slow_loop:\r\n\tLDRB\tr12,[r6],#1\t\t@ r12= *buffer\r\n\tSUBS\tr14,r14,#1\t\t@ r14= length\r\n\t@ Stall\r\n\tORR\tr10,r10,r12,LSL r5\t@ r10= first r5+8 bits\r\n\tADD\tr5,r5,#8\r\n\tBLE\tread_really_slow\r\n\tCMP\tr5,r1\r\n\tBLT\tread_slow_loop\r\nread_end:\r\n\tMOV\tr12,#1\r\n\tRSB\tr12,r12,r12,LSL r1\r\n\r\n\t@ Store back the new position\r\n\t@ r2 = -number of bits to go from this segment\r\n\t@ r6 = ptr\r\n\t@ r14= bytesLeftInSegment\r\n\t@ r11= New head value\r\n\tLDMIA\tr11,{r3,r6,r14}\t\t@ r3 = buffer\r\n\t\t\t\t\t@ r6 = begin\r\n\t\t\t\t\t@ r14= length\r\n\tLDR\tr3,[r3]\t\t\t@ r3 = buffer->data\r\n\tADD\tr1,r2,r14,LSL #3\t@ r1 = bitsLeftInSegment\r\n\t@ stall\r\n\tADD\tr6,r3,r6\t\t@ r6 = pointer\r\n\tAND\tr3,r6,#3\t\t@ r3 = bytes used in first word\r\n\tRSB\tr3,r2,r3,LSL #3\t\t@ r3 = bits used in first word\r\n\tBIC\tr2,r6,#3\t\t@ r2 = word ptr\r\n\tRSBS\tr3,r3,#32\t\t@ r3 = bitsLeftInWord\r\n\tADDLE\tr3,r3,#32\r\n\tADDLE\tr2,r2,#4\r\n\tSTMIA\tr0,{r1,r2,r3}\r\n\r\n\tAND\tr0,r10,r12\r\n\tLDMFD\tr13!,{r5,r6,r10,r11,PC}\r\n\r\n\r\nread_really_slow:\r\n\tCMP\tr5,r1\r\n\tBGE\tread_end\r\n\tLDR\tr14,[r11,#8]\t\t@ r14= length of segment just done\r\n\t@ stall\r\n\t@ stall\r\n\tADD\tr2,r2,r14,LSL #3\t@ r2 = -bits to use from next seg\r\n\tB\tread_next_segment_2\r\n\r\nread_out_of_data:\r\n\t@ Store back the new position\r\n\t@ r2 = -number of bits to go from this segment\r\n\t@ r6 = ptr\r\n\t@ r14= bytesLeftInSegment\r\n\t@ RJW: This may be overkill - we leave the buffer empty, with -1\r\n\t@ bits left in it. We might get away with just storing the\r\n\t@ bitsLeftInSegment as -1.\r\n\tLDR\tr11,[r0,#12]\t\t@ r11=head\r\n\r\n\tLDMIA\tr11,{r3,r6,r14}\t\t@ r3 = buffer\r\n\t\t\t\t\t@ r6 = begin\r\n\t\t\t\t\t@ r14= length\r\n\tLDR\tr3,[r3]\t\t\t@ r3 = buffer->data\r\n\tADD\tr6,r3,r6\t\t@ r6 = pointer\r\n\tADD\tr6,r6,r14\r\n\tAND\tr3,r6,#3\t\t@ r3 = bytes used in first word\r\n\tMOV\tr3,r3,LSL #3\t\t@ r3 = bits used in first word\r\n\tBIC\tr2,r6,#3\t\t@ r2 = word ptr\r\n\tRSBS\tr3,r3,#32\t\t@ r3 = bitsLeftInWord\r\n\tMVN\tr1,#0\t\t\t@ r1 = -1 = bitsLeftInSegment\r\n\tSTMIA\tr0,{r1,r2,r3}\r\n\t@MVN\tr0,#0\t\t\t; return -1\r\n\tMOV\tr0,#0\r\n\tLDMFD\tr13!,{r5,r6,r10,r11,PC}\r\n\r\nread_overrun:\r\n\t@ We had overrun when we started, so we need to skip -r10 bits.\r\n\tLDR\tr11,[r0,#12]\t\t@ r11 = head = b->head\r\n\t@ stall\r\n\t@ stall\r\nread_overrun_next_segment:\r\n\tLDR\tr11,[r11,#12]\t\t@ r11 = head->next\r\n\t@ stall\r\n\t@ stall\r\n\tCMP\tr11,#0\r\n\tBEQ\tread_out_of_data\r\n\tLDMIA\tr11,{r6,r7,r14}\t\t@ r6 = buffer\r\n\t\t\t\t\t@ r7 = begin\r\n\t\t\t\t\t@ r14= length\r\n\tLDR\tr6,[r6]\t\t\t@ r6 = buffer->data\r\n\t@ stall\r\n\t@ stall\r\n\tADD\tr6,r6,r7\t\t@ r6 = buffer->data+begin\r\n\tMOV\tr14,r14,LSL #3\t\t@ r14= length in bits\r\n\tADDS\tr14,r14,r10\t\t@ r14= length in bits-bits to skip\r\n\tMOVLE\tr10,r14\r\n\tBLE\tread_overrun_next_segment\r\n\tRSB\tr10,r10,#0\t\t@ r10= bits to skip\r\n\tADD\tr6,r10,r10,LSR #3\t@ r6 = pointer to data\r\n\tMOV\tr10,#0\r\n\tB\tread_slow_loop\r\n\r\n\t@ END\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/codebook.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: basic codebook pack/unpack/code/decode operations\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <math.h>\r\n#include <limits.h>\r\n#include \"ogg.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"codebook.h\"\r\n#include \"misc.h\"\r\n#include \"os.h\"\r\n\r\n\r\n/**** pack/unpack helpers ******************************************/\r\nint _ilog(unsigned int v){\r\n  int ret=0;\r\n  while(v){\r\n    ret++;\r\n    v>>=1;\r\n  }\r\n  return(ret);\r\n}\r\n\r\nstatic ogg_uint32_t decpack(long entry,long used_entry,long quantvals,\r\n\t\t\t    codebook *b,oggpack_buffer *opb,int maptype){\r\n  ogg_uint32_t ret=0;\r\n  int j;\r\n\r\n  switch(b->dec_type){\r\n\r\n  case 0:\r\n    return (ogg_uint32_t)entry;\r\n\r\n  case 1:\r\n    if(maptype==1){\r\n      /* vals are already read into temporary column vector here */\r\n      for(j=0;j<b->dim;j++){\r\n\togg_uint32_t off=entry%quantvals;\r\n\tentry/=quantvals;\r\n\tret|=((ogg_uint16_t *)(b->q_val))[off]<<(b->q_bits*j);\r\n      }\r\n    }else{\r\n      for(j=0;j<b->dim;j++)\r\n\tret|=oggpack_read(opb,b->q_bits)<<(b->q_bits*j);\r\n    }\r\n    return ret;\r\n\r\n  case 2:\r\n    for(j=0;j<b->dim;j++){\r\n      ogg_uint32_t off=entry%quantvals;\r\n      entry/=quantvals;\r\n      ret|=off<<(b->q_pack*j);\r\n    }\r\n    return ret;\r\n\r\n  case 3:\r\n    return (ogg_uint32_t)used_entry;\r\n\r\n  }\r\n  return 0; /* silence compiler */\r\n}\r\n\r\n/* 32 bit float (not IEEE; nonnormalized mantissa +\r\n   biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm\r\n   Why not IEEE?  It's just not that important here. */\r\n\r\nstatic ogg_int32_t _float32_unpack(long val,int *point){\r\n  long   mant=val&0x1fffff;\r\n  int    sign=val&0x80000000;\r\n\r\n  *point=((val&0x7fe00000L)>>21)-788;\r\n\r\n  if(mant){\r\n    while(!(mant&0x40000000)){\r\n      mant<<=1;\r\n      *point-=1;\r\n    }\r\n    if(sign)mant= -mant;\r\n  }else{\r\n    *point=-9999;\r\n  }\r\n  return mant;\r\n}\r\n\r\n/* choose the smallest supported node size that fits our decode table.\r\n   Legal bytewidths are 1/1 1/2 2/2 2/4 4/4 */\r\nstatic int _determine_node_bytes(long used, int leafwidth){\r\n\r\n  /* special case small books to size 4 to avoid multiple special\r\n     cases in repack */\r\n  if(used<2)\r\n    return 4;\r\n\r\n  if(leafwidth==3)leafwidth=4;\r\n  if(_ilog(3*used-6)+1 <= leafwidth*4)\r\n    return leafwidth/2?leafwidth/2:1;\r\n  return leafwidth;\r\n}\r\n\r\n/* convenience/clarity; leaves are specified as multiple of node word\r\n   size (1 or 2) */\r\nstatic int _determine_leaf_words(int nodeb, int leafwidth){\r\n  if(leafwidth>nodeb)return 2;\r\n  return 1;\r\n}\r\n\r\n/* given a list of word lengths, number of used entries, and byte\r\n   width of a leaf, generate the decode table */\r\nstatic int _make_words(char *l,long n,ogg_uint32_t *r,long quantvals,\r\n\t\t       codebook *b, oggpack_buffer *opb,int maptype){\r\n  long i,j,count=0;\r\n  long top=0;\r\n  ogg_uint32_t marker[33];\r\n\r\n  if (n<1)\r\n    return 1;\r\n\r\n  if(n<2){\r\n    r[0]=0x80000000;\r\n  }else{\r\n    memset(marker,0,sizeof(marker));\r\n\r\n    for(i=0;i<n;i++){\r\n      long length=l[i];\r\n      if(length){\r\n\togg_uint32_t entry=marker[length];\r\n\tlong chase=0;\r\n\tif(count && !entry)return -1; /* overpopulated tree! */\r\n\r\n\t/* chase the tree as far as it's already populated, fill in past */\r\n\tfor(j=0;j<length-1;j++){\r\n\t  int bit=(entry>>(length-j-1))&1;\r\n\t  if(chase>=top){\r\n\t    if (chase < 0 || chase >= n) return 1;\r\n\t    top++;\r\n\t    r[chase*2]=top;\r\n\t    r[chase*2+1]=0;\r\n\t  }else\r\n\t    if (chase < 0 || chase >= n || chase*2+bit > n*2+1) return 1;\r\n\t    if(!r[chase*2+bit])\r\n\t      r[chase*2+bit]=top;\r\n\t  chase=r[chase*2+bit];\r\n\t  if (chase < 0 || chase >= n) return 1;\r\n\t}\r\n\t{\r\n\t  int bit=(entry>>(length-j-1))&1;\r\n\t  if(chase>=top){\r\n\t    top++;\r\n\t    r[chase*2+1]=0;\r\n\t  }\r\n\t  r[chase*2+bit]= decpack(i,count++,quantvals,b,opb,maptype) |\r\n\t    0x80000000;\r\n\t}\r\n\r\n\t/* Look to see if the next shorter marker points to the node\r\n\t   above. if so, update it and repeat.  */\r\n\tfor(j=length;j>0;j--){\r\n\t  if(marker[j]&1){\r\n\t    marker[j]=marker[j-1]<<1;\r\n\t    break;\r\n\t  }\r\n\t  marker[j]++;\r\n\t}\r\n\r\n\t/* prune the tree; the implicit invariant says all the longer\r\n\t   markers were dangling from our just-taken node.  Dangle them\r\n\t   from our *new* node. */\r\n\tfor(j=length+1;j<33;j++)\r\n\t  if((marker[j]>>1) == entry){\r\n\t    entry=marker[j];\r\n\t    marker[j]=marker[j-1]<<1;\r\n\t  }else\r\n\t    break;\r\n      }\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\nstatic int _make_decode_table(codebook *s,char *lengthlist,long quantvals,\r\n\t\t\t      oggpack_buffer *opb,int maptype){\r\n  int i;\r\n  ogg_uint32_t *work;\r\n\r\n  if (!lengthlist) return 1;\r\n  if(s->dec_nodeb==4){\r\n    /* Over-allocate by using s->entries instead of used_entries.\r\n     * This means that we can use s->entries to enforce size in\r\n     * _make_words without messing up length list looping.\r\n     * This probably wastes a bit of space, but it shouldn't\r\n     * impact behavior or size too much.\r\n     */\r\n    s->dec_table=_ogg_malloc((s->entries*2+1)*sizeof(*work));\r\n    if (!s->dec_table) return 1;\r\n    /* +1 (rather than -2) is to accommodate 0 and 1 sized books,\r\n       which are specialcased to nodeb==4 */\r\n    if(_make_words(lengthlist,s->entries,\r\n\t\t   s->dec_table,quantvals,s,opb,maptype))return 1;\r\n\r\n    return 0;\r\n  }\r\n\r\n  if (s->used_entries > INT_MAX/2 ||\r\n      s->used_entries*2 > INT_MAX/((long) sizeof(*work)) - 1) return 1;\r\n  /* Overallocate as above */\r\n  work=alloca((s->entries*2+1)*sizeof(*work));\r\n  if(_make_words(lengthlist,s->entries,work,quantvals,s,opb,maptype))return 1;\r\n  if (s->used_entries > INT_MAX/(s->dec_leafw+1)) return 1;\r\n  if (s->dec_nodeb && s->used_entries * (s->dec_leafw+1) > INT_MAX/s->dec_nodeb) return 1;\r\n  s->dec_table=_ogg_malloc((s->used_entries*(s->dec_leafw+1)-2)*\r\n\t\t\t   s->dec_nodeb);\r\n  if (!s->dec_table) return 1;\r\n\r\n  if(s->dec_leafw==1){\r\n    switch(s->dec_nodeb){\r\n    case 1:\r\n      for(i=0;i<s->used_entries*2-2;i++)\r\n\t  ((unsigned char *)s->dec_table)[i]=(unsigned char)\r\n\t    (((work[i] & 0x80000000UL) >> 24) | work[i]);\r\n      break;\r\n    case 2:\r\n      for(i=0;i<s->used_entries*2-2;i++)\r\n\t  ((ogg_uint16_t *)s->dec_table)[i]=(ogg_uint16_t)\r\n\t    (((work[i] & 0x80000000UL) >> 16) | work[i]);\r\n      break;\r\n    }\r\n\r\n  }else{\r\n    /* more complex; we have to do a two-pass repack that updates the\r\n       node indexing. */\r\n    long top=s->used_entries*3-2;\r\n    if(s->dec_nodeb==1){\r\n      unsigned char *out=(unsigned char *)s->dec_table;\r\n\r\n      for(i=s->used_entries*2-4;i>=0;i-=2){\r\n\tif(work[i]&0x80000000UL){\r\n\t  if(work[i+1]&0x80000000UL){\r\n\t    top-=4;\r\n\t    out[top]=(work[i]>>8 & 0x7f)|0x80;\r\n\t    out[top+1]=(work[i+1]>>8 & 0x7f)|0x80;\r\n\t    out[top+2]=work[i] & 0xff;\r\n\t    out[top+3]=work[i+1] & 0xff;\r\n\t  }else{\r\n\t    top-=3;\r\n\t    out[top]=(work[i]>>8 & 0x7f)|0x80;\r\n\t    out[top+1]=work[work[i+1]*2];\r\n\t    out[top+2]=work[i] & 0xff;\r\n\t  }\r\n\t}else{\r\n\t  if(work[i+1]&0x80000000UL){\r\n\t    top-=3;\r\n\t    out[top]=work[work[i]*2];\r\n\t    out[top+1]=(work[i+1]>>8 & 0x7f)|0x80;\r\n\t    out[top+2]=work[i+1] & 0xff;\r\n\t  }else{\r\n\t    top-=2;\r\n\t    out[top]=work[work[i]*2];\r\n\t    out[top+1]=work[work[i+1]*2];\r\n\t  }\r\n\t}\r\n\twork[i]=top;\r\n      }\r\n    }else{\r\n      ogg_uint16_t *out=(ogg_uint16_t *)s->dec_table;\r\n      for(i=s->used_entries*2-4;i>=0;i-=2){\r\n\tif(work[i]&0x80000000UL){\r\n\t  if(work[i+1]&0x80000000UL){\r\n\t    top-=4;\r\n\t    out[top]=(work[i]>>16 & 0x7fff)|0x8000;\r\n\t    out[top+1]=(work[i+1]>>16 & 0x7fff)|0x8000;\r\n\t    out[top+2]=work[i] & 0xffff;\r\n\t    out[top+3]=work[i+1] & 0xffff;\r\n\t  }else{\r\n\t    top-=3;\r\n\t    out[top]=(work[i]>>16 & 0x7fff)|0x8000;\r\n\t    out[top+1]=work[work[i+1]*2];\r\n\t    out[top+2]=work[i] & 0xffff;\r\n\t  }\r\n\t}else{\r\n\t  if(work[i+1]&0x80000000UL){\r\n\t    top-=3;\r\n\t    out[top]=work[work[i]*2];\r\n\t    out[top+1]=(work[i+1]>>16 & 0x7fff)|0x8000;\r\n\t    out[top+2]=work[i+1] & 0xffff;\r\n\t  }else{\r\n\t    top-=2;\r\n\t    out[top]=work[work[i]*2];\r\n\t    out[top+1]=work[work[i+1]*2];\r\n\t  }\r\n\t}\r\n\twork[i]=top;\r\n      }\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n/* most of the time, entries%dimensions == 0, but we need to be\r\n   well defined.  We define that the possible vales at each\r\n   scalar is values == entries/dim.  If entries%dim != 0, we'll\r\n   have 'too few' values (values*dim<entries), which means that\r\n   we'll have 'left over' entries; left over entries use zeroed\r\n   values (and are wasted).  So don't generate codebooks like\r\n   that */\r\n/* there might be a straightforward one-line way to do the below\r\n   that's portable and totally safe against roundoff, but I haven't\r\n   thought of it.  Therefore, we opt on the side of caution */\r\nlong _book_maptype1_quantvals(codebook *b){\r\n  /* get us a starting hint, we'll polish it below */\r\n  int bits=_ilog(b->entries);\r\n  int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);\r\n\r\n  while(1){\r\n    long acc=1;\r\n    long acc1=1;\r\n    int i;\r\n    for(i=0;i<b->dim;i++){\r\n      acc*=vals;\r\n      acc1*=vals+1;\r\n    }\r\n    if(acc<=b->entries && acc1>b->entries){\r\n      return(vals);\r\n    }else{\r\n      if(acc>b->entries){\r\n        vals--;\r\n      }else{\r\n        vals++;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\nvoid vorbis_book_clear(codebook *b){\r\n  /* static book is not cleared; we're likely called on the lookup and\r\n     the static codebook belongs to the info struct */\r\n  if(b->q_val)_ogg_free(b->q_val);\r\n  if(b->dec_table)_ogg_free(b->dec_table);\r\n  if(b->dec_buf)_ogg_free(b->dec_buf);\r\n\r\n  memset(b,0,sizeof(*b));\r\n}\r\n\r\nint vorbis_book_unpack(oggpack_buffer *opb,codebook *s){\r\n  char         *lengthlist=NULL;\r\n  int           quantvals=0;\r\n  long          i,j;\r\n  int           maptype;\r\n\r\n  memset(s,0,sizeof(*s));\r\n\r\n  /* make sure alignment is correct */\r\n  if(oggpack_read(opb,24)!=0x564342)goto _eofout;\r\n\r\n  /* first the basic parameters */\r\n  s->dim=oggpack_read(opb,16);\r\n  s->dec_buf=_ogg_malloc(sizeof(ogg_int32_t)*s->dim);\r\n  if (s->dec_buf == NULL)\r\n      goto _errout;\r\n  s->entries=oggpack_read(opb,24);\r\n  if(s->entries<=0)goto _eofout;\r\n  if(s->dim<=0)goto _eofout;\r\n  if(_ilog(s->dim)+_ilog(s->entries)>24)goto _eofout; \r\n  if (s->dim > INT_MAX/s->entries) goto _eofout;\r\n\r\n  /* codeword ordering.... length ordered or unordered? */\r\n  switch((int)oggpack_read(opb,1)){\r\n  case 0:\r\n    /* unordered */\r\n    lengthlist=(char *)alloca(sizeof(*lengthlist)*s->entries);\r\n    if(!lengthlist) goto _eofout;\r\n\r\n    /* allocated but unused entries? */\r\n    if(oggpack_read(opb,1)){\r\n      /* yes, unused entries */\r\n\r\n      for(i=0;i<s->entries;i++){\r\n\tif(oggpack_read(opb,1)){\r\n\t  long num=oggpack_read(opb,5);\r\n\t  if(num==-1)goto _eofout;\r\n\t  lengthlist[i]=(char)(num+1);\r\n\t  s->used_entries++;\r\n\t  if(num+1>s->dec_maxlength)s->dec_maxlength=num+1;\r\n\t}else\r\n\t  lengthlist[i]=0;\r\n      }\r\n    }else{\r\n      /* all entries used; no tagging */\r\n      s->used_entries=s->entries;\r\n      for(i=0;i<s->entries;i++){\r\n\tlong num=oggpack_read(opb,5);\r\n\tif(num==-1)goto _eofout;\r\n\tlengthlist[i]=(char)(num+1);\r\n\tif(num+1>s->dec_maxlength)s->dec_maxlength=num+1;\r\n      }\r\n    }\r\n\r\n    break;\r\n  case 1:\r\n    /* ordered */\r\n    {\r\n      long length=oggpack_read(opb,5)+1;\r\n\r\n      s->used_entries=s->entries;\r\n      lengthlist=(char *)alloca(sizeof(*lengthlist)*s->entries);\r\n      if (!lengthlist) goto _eofout;\r\n\r\n      for(i=0;i<s->entries;){\r\n\tlong num=oggpack_read(opb,_ilog(s->entries-i));\r\n\tif(num<0)goto _eofout;\r\n\tfor(j=0;j<num && i<s->entries;j++,i++)\r\n\t  lengthlist[i]=(char)length;\r\n\ts->dec_maxlength=length;\r\n\tlength++;\r\n      }\r\n    }\r\n    break;\r\n  default:\r\n    /* EOF */\r\n    goto _eofout;\r\n  }\r\n\r\n\r\n  /* Do we have a mapping to unpack? */\r\n\r\n  if((maptype=oggpack_read(opb,4))>0){\r\n    s->q_min=_float32_unpack(oggpack_read(opb,32),&s->q_minp);\r\n    s->q_del=_float32_unpack(oggpack_read(opb,32),&s->q_delp);\r\n    s->q_bits=oggpack_read(opb,4)+1;\r\n    s->q_seq=oggpack_read(opb,1);\r\n\r\n    s->q_del>>=s->q_bits;\r\n    s->q_delp+=s->q_bits;\r\n  }\r\n\r\n  switch(maptype){\r\n  case 0:\r\n\r\n    /* no mapping; decode type 0 */\r\n\r\n    /* how many bytes for the indexing? */\r\n    /* this is the correct boundary here; we lose one bit to\r\n       node/leaf mark */\r\n    s->dec_nodeb=_determine_node_bytes(s->used_entries,_ilog(s->entries)/8+1);\r\n    s->dec_leafw=_determine_leaf_words(s->dec_nodeb,_ilog(s->entries)/8+1);\r\n    s->dec_type=0;\r\n\r\n    if(_make_decode_table(s,lengthlist,quantvals,opb,maptype)) goto _errout;\r\n    break;\r\n\r\n  case 1:\r\n\r\n    /* mapping type 1; implicit values by lattice  position */\r\n    quantvals=_book_maptype1_quantvals(s);\r\n\r\n    /* dec_type choices here are 1,2; 3 doesn't make sense */\r\n    {\r\n      /* packed values */\r\n      long total1=(s->q_bits*s->dim+8)/8; /* remember flag bit */\r\n      if (s->dim > (INT_MAX-8)/s->q_bits) goto _eofout;\r\n      /* vector of column offsets; remember flag bit */\r\n      long total2=(_ilog(quantvals-1)*s->dim+8)/8+(s->q_bits+7)/8;\r\n\r\n\r\n      if(total1<=4 && total1<=total2){\r\n\t/* use dec_type 1: vector of packed values */\r\n\r\n\t/* need quantized values before  */\r\n\ts->q_val=alloca(sizeof(ogg_uint16_t)*quantvals);\r\n\tif (!s->q_val) goto _eofout;\r\n\tfor(i=0;i<quantvals;i++)\r\n\t  ((ogg_uint16_t *)s->q_val)[i]=(ogg_uint16_t)oggpack_read(opb,s->q_bits);\r\n\r\n\tif(oggpack_eop(opb)){\r\n\t  s->q_val=0; /* cleanup must not free alloca memory */\r\n\t  goto _eofout;\r\n\t}\r\n\r\n\ts->dec_type=1;\r\n\ts->dec_nodeb=_determine_node_bytes(s->used_entries,\r\n\t\t\t\t\t   (s->q_bits*s->dim+8)/8);\r\n\ts->dec_leafw=_determine_leaf_words(s->dec_nodeb,\r\n\t\t\t\t\t   (s->q_bits*s->dim+8)/8);\r\n\tif(_make_decode_table(s,lengthlist,quantvals,opb,maptype)){\r\n\t  s->q_val=0; /* cleanup must not free alloca memory */\r\n\t  goto _errout;\r\n\t}\r\n\r\n\ts->q_val=0; /* about to go out of scope; _make_decode_table\r\n                       was using it */\r\n\r\n      }else{\r\n\t/* use dec_type 2: packed vector of column offsets */\r\n\r\n\t/* need quantized values before */\r\n\tif(s->q_bits<=8){\r\n\t  s->q_val=_ogg_malloc(quantvals);\r\n\t  if (!s->q_val) goto _eofout;\r\n\t  for(i=0;i<quantvals;i++)\r\n\t    ((unsigned char *)s->q_val)[i]=(unsigned char)oggpack_read(opb,s->q_bits);\r\n\t}else{\r\n\t  s->q_val=_ogg_malloc(quantvals*2);\r\n\t  if (!s->q_val) goto _eofout;\r\n\t  for(i=0;i<quantvals;i++)\r\n\t    ((ogg_uint16_t *)s->q_val)[i]=(ogg_uint16_t)oggpack_read(opb,s->q_bits);\r\n\t}\r\n\r\n\tif(oggpack_eop(opb))goto _eofout;\r\n\r\n\ts->q_pack=_ilog(quantvals-1);\r\n\ts->dec_type=2;\r\n\ts->dec_nodeb=_determine_node_bytes(s->used_entries,\r\n\t\t\t\t\t   (_ilog(quantvals-1)*s->dim+8)/8);\r\n\ts->dec_leafw=_determine_leaf_words(s->dec_nodeb,\r\n\t\t\t\t\t   (_ilog(quantvals-1)*s->dim+8)/8);\r\n\tif(_make_decode_table(s,lengthlist,quantvals,opb,maptype))goto _errout;\r\n\r\n      }\r\n    }\r\n    break;\r\n  case 2:\r\n\r\n    /* mapping type 2; explicit array of values */\r\n    quantvals=s->entries*s->dim;\r\n    /* dec_type choices here are 1,3; 2 is not possible */\r\n\r\n    if( (s->q_bits*s->dim+8)/8 <=4){ /* remember flag bit */\r\n      /* use dec_type 1: vector of packed values */\r\n\r\n      s->dec_type=1;\r\n      s->dec_nodeb=_determine_node_bytes(s->used_entries,(s->q_bits*s->dim+8)/8);\r\n      s->dec_leafw=_determine_leaf_words(s->dec_nodeb,(s->q_bits*s->dim+8)/8);\r\n      if(_make_decode_table(s,lengthlist,quantvals,opb,maptype))goto _errout;\r\n\r\n    }else{\r\n      /* use dec_type 3: scalar offset into packed value array */\r\n\r\n      s->dec_type=3;\r\n      s->dec_nodeb=_determine_node_bytes(s->used_entries,_ilog(s->used_entries-1)/8+1);\r\n      s->dec_leafw=_determine_leaf_words(s->dec_nodeb,_ilog(s->used_entries-1)/8+1);\r\n      if(_make_decode_table(s,lengthlist,quantvals,opb,maptype))goto _errout;\r\n\r\n      /* get the vals & pack them */\r\n      s->q_pack=(s->q_bits+7)/8*s->dim;\r\n      s->q_val=_ogg_malloc(s->q_pack*s->used_entries);\r\n\r\n      if(s->q_bits<=8){\r\n\tfor(i=0;i<s->used_entries*s->dim;i++)\r\n\t  ((unsigned char *)(s->q_val))[i]=(unsigned char)oggpack_read(opb,s->q_bits);\r\n      }else{\r\n\tfor(i=0;i<s->used_entries*s->dim;i++)\r\n\t  ((ogg_uint16_t *)(s->q_val))[i]=(ogg_uint16_t)oggpack_read(opb,s->q_bits);\r\n      }\r\n    }\r\n    break;\r\n  default:\r\n    goto _errout;\r\n  }\r\n\r\n  if (s->dec_nodeb==1)\r\n    if (s->dec_leafw == 1)\r\n      s->dec_method = 0;\r\n    else\r\n      s->dec_method = 1;\r\n  else if (s->dec_nodeb==2)\r\n    if (s->dec_leafw == 1)\r\n      s->dec_method = 2;\r\n    else\r\n      s->dec_method = 3;\r\n  else\r\n    s->dec_method = 4;\r\n\r\n  if(oggpack_eop(opb))goto _eofout;\r\n\r\n  return 0;\r\n _errout:\r\n _eofout:\r\n  vorbis_book_clear(s);\r\n  return -1;\r\n}\r\n\r\n#ifndef ONLY_C\r\nogg_uint32_t decode_packed_entry_number(codebook *book,\r\n                                        oggpack_buffer *b);\r\n#else\r\nstatic inline ogg_uint32_t decode_packed_entry_number(codebook *book,\r\n\t\t\t\t\t\t      oggpack_buffer *b){\r\n  ogg_uint32_t chase=0;\r\n  int  read=book->dec_maxlength;\r\n  long lok = oggpack_look(b,read),i;\r\n\r\n  while(lok<0 && read>1)\r\n    lok = oggpack_look(b, --read);\r\n\r\n  if(lok<0){\r\n    oggpack_adv(b,1); /* force eop */\r\n    return -1;\r\n  }\r\n\r\n  /* chase the tree with the bits we got */\r\n  switch (book->dec_method)\r\n  {\r\n    case 0:\r\n    {\r\n      /* book->dec_nodeb==1, book->dec_leafw==1 */\r\n      /* 8/8 - Used */\r\n      unsigned char *t=(unsigned char *)book->dec_table;\r\n\r\n      for(i=0;i<read;i++){\r\n\tchase=t[chase*2+((lok>>i)&1)];\r\n\tif(chase&0x80UL)break;\r\n      }\r\n      chase&=0x7fUL;\r\n      break;\r\n    }\r\n    case 1:\r\n    {\r\n      /* book->dec_nodeb==1, book->dec_leafw!=1 */\r\n      /* 8/16 - Used by infile2 */\r\n      unsigned char *t=(unsigned char *)book->dec_table;\r\n      for(i=0;i<read;i++){\r\n\tint bit=(lok>>i)&1;\r\n\tint next=t[chase+bit];\r\n\tif(next&0x80){\r\n\t  chase= (next<<8) | t[chase+bit+1+(!bit || t[chase]&0x80)];\r\n\t  break;\r\n\t}\r\n\tchase=next;\r\n      }\r\n      //chase&=0x7fffUL;\r\n      chase&=~0x8000UL;\r\n      break;\r\n    }\r\n    case 2:\r\n    {\r\n      /* book->dec_nodeb==2, book->dec_leafw==1 */\r\n      /* 16/16 - Used */\r\n      for(i=0;i<read;i++){\r\n\tchase=((ogg_uint16_t *)(book->dec_table))[chase*2+((lok>>i)&1)];\r\n\tif(chase&0x8000UL)break;\r\n      }\r\n      //chase&=0x7fffUL;\r\n      chase&=~0x8000UL;\r\n      break;\r\n    }\r\n    case 3:\r\n    {\r\n      /* book->dec_nodeb==2, book->dec_leafw!=1 */\r\n      /* 16/32 - Used by infile2 */\r\n      ogg_uint16_t *t=(ogg_uint16_t *)book->dec_table;\r\n      for(i=0;i<read;i++){\r\n\tint bit=(lok>>i)&1;\r\n\tint next=t[chase+bit];\r\n\tif(next&0x8000){\r\n\t  chase= (next<<16) | t[chase+bit+1+(!bit || t[chase]&0x8000)];\r\n\t  break;\r\n\t}\r\n\tchase=next;\r\n      }\r\n      //chase&=0x7fffffffUL;\r\n      chase&=~0x80000000UL;\r\n      break;\r\n    }\r\n    case 4:\r\n    {\r\n      //Output(\"32/32\");\r\n      for(i=0;i<read;i++){\r\n\tchase=((ogg_uint32_t *)(book->dec_table))[chase*2+((lok>>i)&1)];\r\n\tif(chase&0x80000000UL)break;\r\n      }\r\n      //chase&=0x7fffffffUL;\r\n      chase&=~0x80000000UL;\r\n      break;\r\n    }\r\n  }\r\n\r\n  if(i<read){\r\n    oggpack_adv(b,i+1);\r\n    return chase;\r\n  }\r\n  oggpack_adv(b,read+1);\r\n  return(-1);\r\n}\r\n#endif\r\n\r\n/* returns the [original, not compacted] entry number or -1 on eof *********/\r\nlong vorbis_book_decode(codebook *book, oggpack_buffer *b){\r\n  if(book->dec_type)return -1;\r\n return decode_packed_entry_number(book,b);\r\n}\r\n\r\n#ifndef ONLY_C\r\nint decode_map(codebook *s, oggpack_buffer *b, ogg_int32_t *v, int point);\r\n#else\r\nstatic int decode_map(codebook *s, oggpack_buffer *b, ogg_int32_t *v, int point){\r\n  ogg_uint32_t entry = decode_packed_entry_number(s,b);\r\n  int i;\r\n  if(oggpack_eop(b))return(-1);\r\n\r\n  /* 1 used by test file 0 */\r\n\r\n  /* according to decode type */\r\n  switch(s->dec_type){\r\n  case 1:{\r\n    /* packed vector of values */\r\n    int mask=(1<<s->q_bits)-1;\r\n    for(i=0;i<s->dim;i++){\r\n      v[i]=entry&mask;\r\n      entry>>=s->q_bits;\r\n    }\r\n    break;\r\n  }\r\n  case 2:{\r\n    /* packed vector of column offsets */\r\n    int mask=(1<<s->q_pack)-1;\r\n    for(i=0;i<s->dim;i++){\r\n      if(s->q_bits<=8)\r\n\tv[i]=((unsigned char *)(s->q_val))[entry&mask];\r\n      else\r\n\tv[i]=((ogg_uint16_t *)(s->q_val))[entry&mask];\r\n      entry>>=s->q_pack;\r\n    }\r\n    break;\r\n  }\r\n  case 3:{\r\n    /* offset into array */\r\n    void *ptr=s->q_val+entry*s->q_pack;\r\n\r\n    if(s->q_bits<=8){\r\n      for(i=0;i<s->dim;i++)\r\n\tv[i]=((unsigned char *)ptr)[i];\r\n    }else{\r\n      for(i=0;i<s->dim;i++)\r\n\tv[i]=((ogg_uint16_t *)ptr)[i];\r\n    }\r\n    break;\r\n  }\r\n  default:\r\n    return -1;\r\n  }\r\n\r\n  /* we have the unpacked multiplicands; compute final vals */\r\n  {\r\n    int         shiftM = point-s->q_delp;\r\n    ogg_int32_t add    = point-s->q_minp;\r\n    int         mul    = s->q_del;\r\n\r\n    if(add>0)\r\n      add= s->q_min >> add;\r\n    else\r\n      add= s->q_min << -add;\r\n    if (shiftM<0)\r\n    {\r\n      mul <<= -shiftM;\r\n      shiftM = 0;\r\n    }\r\n    add <<= shiftM;\r\n\r\n    for(i=0;i<s->dim;i++)\r\n      v[i]= ((add + v[i] * mul) >> shiftM);\r\n\r\n    if(s->q_seq)\r\n      for(i=1;i<s->dim;i++)\r\n\tv[i]+=v[i-1];\r\n  }\r\n\r\n  return 0;\r\n}\r\n#endif\r\n\r\n/* returns 0 on OK or -1 on eof *************************************/\r\nlong vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,\r\n\t\t\t      oggpack_buffer *b,int n,int point){\r\n  if(book->used_entries>0){\r\n    int step=n/book->dim;\r\n    ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim);\r\n    int i,j,o;\r\n    if (!v) return -1;\r\n\r\n    for (j=0;j<step;j++){\r\n      if(decode_map(book,b,v,point))return -1;\r\n      for(i=0,o=j;i<book->dim;i++,o+=step)\r\n\ta[o]+=v[i];\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\nlong vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,\r\n\t\t\t     oggpack_buffer *b,int n,int point){\r\n  if(book->used_entries>0){\r\n    ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim);\r\n    int i,j;\r\n\r\n    if (!v) return -1;\r\n    for(i=0;i<n;){\r\n      if(decode_map(book,b,v,point))return -1;\r\n      for (j=0;j<book->dim;j++)\r\n\ta[i++]+=v[j];\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\nlong vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,\r\n\t\t\t     oggpack_buffer *b,int n,int point){\r\n  if(book->used_entries>0){\r\n    ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim);\r\n    int i,j;\r\n\r\n    if (!v) return -1;\r\n    for(i=0;i<n;){\r\n      if(decode_map(book,b,v,point))return -1;\r\n      for (j=0;j<book->dim;j++)\r\n\ta[i++]=v[j];\r\n    }\r\n  }else{\r\n    int i,j;\r\n\r\n    for(i=0;i<n;){\r\n      for (j=0;j<book->dim;j++)\r\n\ta[i++]=0;\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n#ifndef ONLY_C\r\nlong vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\r\n\t\t\t      long offset,int ch,\r\n\t\t\t      oggpack_buffer *b,int n,int point);\r\n#else\r\nlong vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\r\n\t\t\t      long offset,int ch,\r\n\t\t\t      oggpack_buffer *b,int n,int point){\r\n  if(book->used_entries>0){\r\n\r\n    ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim);\r\n    long i,j;\r\n    int chptr=0;\r\n\r\n    if (!v) return -1;\r\n    for(i=offset;i<offset+n;){\r\n      if(decode_map(book,b,v,point))return -1;\r\n      for (j=0;j<book->dim;j++){\r\n\ta[chptr++][i]+=v[j];\r\n\tif(chptr==ch){\r\n\t  chptr=0;\r\n\t  i++;\r\n\t}\r\n      }\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/codebook.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: basic shared codebook operations\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _V_CODEBOOK_H_\r\n#define _V_CODEBOOK_H_\r\n\r\n#include \"ogg.h\"\r\n\r\ntypedef struct codebook{\r\n  /* Top 15 used in ARM code */\r\n  int          dec_maxlength;\r\n  void        *dec_table;\r\n  int          dec_method;\r\n  int          dec_type; /* 0 = entry number\r\n\t\t\t    1 = packed vector of values\r\n\t\t\t    2 = packed vector of column offsets, maptype 1\r\n\t\t\t    3 = scalar offset into value array,  maptype 2 */\r\n  int          q_bits;\r\n  long         dim;      /* codebook dimensions (elements per vector) */\r\n  int          q_delp;\r\n  int          q_minp;\r\n  ogg_int32_t  q_del;\r\n  ogg_int32_t  q_min;\r\n  int          q_seq;\r\n  int          q_pack;\r\n  void        *q_val;\r\n  long         used_entries;    /* populated codebook entries */\r\n  ogg_int32_t *dec_buf;\r\n\r\n  /* C only */\r\n  int   dec_nodeb;\r\n  int   dec_leafw;\r\n\r\n  long  entries;         /* codebook entries */\r\n\r\n} codebook;\r\n\r\nextern void vorbis_book_clear(codebook *b);\r\nextern int  vorbis_book_unpack(oggpack_buffer *b,codebook *c);\r\n\r\nextern long vorbis_book_decode(codebook *book, oggpack_buffer *b);\r\nextern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,\r\n\t\t\t\t     oggpack_buffer *b,int n,int point);\r\nextern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,\r\n\t\t\t\t    oggpack_buffer *b,int n,int point);\r\nextern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,\r\n\t\t\t\t    oggpack_buffer *b,int n,int point);\r\nextern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,\r\n\t\t\t\t     long off,int ch,\r\n\t\t\t\t    oggpack_buffer *b,int n,int point);\r\n\r\nextern int _ilog(unsigned int v);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/codec_internal.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: libvorbis codec headers\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _V_CODECI_H_\r\n#define _V_CODECI_H_\r\n\r\n#define CHUNKSIZE 1024\r\n\r\n#include \"codebook.h\"\r\n#include \"ivorbiscodec.h\"\r\n\r\n#define VI_TRANSFORMB 1\r\n#define VI_WINDOWB 1\r\n#define VI_TIMEB 1\r\n#define VI_FLOORB 2\r\n#define VI_RESB 3\r\n#define VI_MAPB 1\r\n\r\ntypedef void vorbis_info_floor;\r\n\r\n/* vorbis_dsp_state buffers the current vorbis audio\r\n   analysis/synthesis state.  The DSP state belongs to a specific\r\n   logical bitstream ****************************************************/\r\nstruct vorbis_dsp_state{\r\n  vorbis_info    *vi;\r\n  oggpack_buffer  opb;\r\n\r\n  ogg_int32_t   **work;\r\n  ogg_int32_t   **mdctright;\r\n  int             out_begin;\r\n  int             out_end;\r\n\r\n  long lW;\r\n  long W;\r\n\r\n  ogg_int64_t granulepos;\r\n  ogg_int64_t sequence;\r\n  ogg_int64_t sample_count;\r\n\r\n};\r\n\r\n\r\n/* Floor backend generic *****************************************/\r\n\r\nextern vorbis_info_floor *floor0_info_unpack(vorbis_info *,oggpack_buffer *);\r\nextern void floor0_free_info(vorbis_info_floor *);\r\nextern int floor0_memosize(vorbis_info_floor *);\r\nextern ogg_int32_t *floor0_inverse1(struct vorbis_dsp_state *,\r\n\t\t\t\t    vorbis_info_floor *,ogg_int32_t *);\r\nextern int floor0_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *,\r\n\t\t\t    ogg_int32_t *buffer,ogg_int32_t *);\r\n\r\nextern vorbis_info_floor *floor1_info_unpack(vorbis_info *,oggpack_buffer *);\r\nextern void floor1_free_info(vorbis_info_floor *);\r\nextern int floor1_memosize(vorbis_info_floor *);\r\nextern ogg_int32_t *floor1_inverse1(struct vorbis_dsp_state *,\r\n\t\t\t\t    vorbis_info_floor *,ogg_int32_t *);\r\nextern int floor1_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *,\r\n\t\t\t    ogg_int32_t *buffer,ogg_int32_t *);\r\n\r\ntypedef struct{\r\n  int   order;\r\n  long  rate;\r\n  long  barkmap;\r\n\r\n  int   ampbits;\r\n  int   ampdB;\r\n\r\n  int   numbooks; /* <= 16 */\r\n  char  books[16];\r\n\r\n} vorbis_info_floor0;\r\n\r\ntypedef struct{\r\n  char  class_dim;        /* 1 to 8 */\r\n  char  class_subs;       /* 0,1,2,3 (bits: 1<<n poss) */\r\n  unsigned char  class_book;       /* subs ^ dim entries */\r\n  unsigned char  class_subbook[8]; /* [VIF_CLASS][subs] */\r\n} floor1class;\r\n\r\ntypedef struct{\r\n  floor1class  *klass;          /* [VIF_CLASS] */\r\n  char         *partitionclass; /* [VIF_PARTS]; 0 to 15 */\r\n  ogg_uint16_t *postlist;       /* [VIF_POSIT+2]; first two implicit */\r\n  char         *forward_index;  /* [VIF_POSIT+2]; */\r\n  char         *hineighbor;     /* [VIF_POSIT]; */\r\n  char         *loneighbor;     /* [VIF_POSIT]; */\r\n\r\n  int          partitions;    /* 0 to 31 */\r\n  int          posts;\r\n  int          mult;          /* 1 2 3 or 4 */\r\n\r\n} vorbis_info_floor1;\r\n\r\n/* Residue backend generic *****************************************/\r\n\r\ntypedef struct vorbis_info_residue{\r\n  int type;\r\n  unsigned char *stagemasks;\r\n  unsigned char *stagebooks;\r\n\r\n/* block-partitioned VQ coded straight residue */\r\n  long begin;\r\n  long end;\r\n\r\n  /* first stage (lossless partitioning) */\r\n  int           grouping;         /* group n vectors per partition */\r\n  char          partitions;       /* possible codebooks for a partition */\r\n  unsigned char groupbook;        /* huffbook for partitioning */\r\n  char          stages;\r\n} vorbis_info_residue;\r\n\r\nextern void res_clear_info(vorbis_info_residue *info);\r\nextern int res_unpack(vorbis_info_residue *info,\r\n\t\t      vorbis_info *vi,oggpack_buffer *opb);\r\nextern int res_inverse(vorbis_dsp_state *,vorbis_info_residue *info,\r\n\t\t       ogg_int32_t **in,int *nonzero,int ch);\r\n\r\n/* mode ************************************************************/\r\ntypedef struct {\r\n  unsigned char blockflag;\r\n  unsigned char mapping;\r\n} vorbis_info_mode;\r\n\r\n/* Mapping backend generic *****************************************/\r\ntypedef struct coupling_step{\r\n  unsigned char mag;\r\n  unsigned char ang;\r\n} coupling_step;\r\n\r\ntypedef struct submap{\r\n  char floor;\r\n  char residue;\r\n} submap;\r\n\r\ntypedef struct vorbis_info_mapping{\r\n  int            submaps;\r\n\r\n  unsigned char *chmuxlist;\r\n  submap        *submaplist;\r\n\r\n  int            coupling_steps;\r\n  coupling_step *coupling;\r\n} vorbis_info_mapping;\r\n\r\nextern int mapping_info_unpack(vorbis_info_mapping *,vorbis_info *,\r\n\t\t\t       oggpack_buffer *);\r\nextern void mapping_clear_info(vorbis_info_mapping *);\r\nextern int mapping_inverse(struct vorbis_dsp_state *,vorbis_info_mapping *);\r\n\r\n/* codec_setup_info contains all the setup information specific to the\r\n   specific compression/decompression mode in progress (eg,\r\n   psychoacoustic settings, channel setup, options, codebook\r\n   etc).\r\n*********************************************************************/\r\n\r\ntypedef struct codec_setup_info {\r\n\r\n  /* Vorbis supports only short and long blocks, but allows the\r\n     encoder to choose the sizes */\r\n\r\n  long blocksizes[2];\r\n\r\n  /* modes are the primary means of supporting on-the-fly different\r\n     blocksizes, different channel mappings (LR or M/A),\r\n     different residue backends, etc.  Each mode consists of a\r\n     blocksize flag and a mapping (along with the mapping setup */\r\n\r\n  int        modes;\r\n  int        maps;\r\n  int        floors;\r\n  int        residues;\r\n  int        books;\r\n\r\n  vorbis_info_mode       *mode_param;\r\n  vorbis_info_mapping    *map_param;\r\n  char                   *floor_type;\r\n  vorbis_info_floor     **floor_param;\r\n  vorbis_info_residue    *residue_param;\r\n  codebook               *book_param;\r\n\r\n} codec_setup_info;\r\n\r\nextern int      vorbis_dsp_init(vorbis_dsp_state *v, vorbis_info *vi);\r\nextern void     vorbis_dsp_clear(vorbis_dsp_state *v);\r\nextern vorbis_dsp_state *vorbis_dsp_create(vorbis_info *vi);\r\nextern void     vorbis_dsp_destroy(vorbis_dsp_state *v);\r\nextern int      vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,\r\n\t\t\t\t    ogg_packet *op);\r\n\r\nextern int      vorbis_dsp_restart(vorbis_dsp_state *v);\r\nextern int      vorbis_dsp_synthesis(vorbis_dsp_state *vd,\r\n\t\t\t\t     ogg_packet *op,int decodep);\r\nextern int      vorbis_dsp_pcmout(vorbis_dsp_state *v,\r\n\t\t\t\t  ogg_int16_t *pcm,int samples);\r\nextern int      vorbis_dsp_read(vorbis_dsp_state *v,int samples);\r\nextern long     vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);\r\n\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/config_types.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: #ifdef jail to whip a few platforms into the UNIX ideal.\r\n\r\n ************************************************************************/\r\n#ifndef _OS_CVTYPES_H\r\n#define _OS_CVTYPES_H\r\n\r\ntypedef long long ogg_int64_t;\r\ntypedef int ogg_int32_t;\r\ntypedef unsigned int ogg_uint32_t;\r\ntypedef short ogg_int16_t;\r\ntypedef unsigned short ogg_uint16_t;\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/dpen.s",
    "content": "@ Tremolo library\r\n@-----------------------------------------------------------------------\r\n@ Copyright (C) 2002-2009, Xiph.org Foundation\r\n@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n@ All rights reserved.\r\n\r\n@ Redistribution and use in source and binary forms, with or without\r\n@ modification, are permitted provided that the following conditions\r\n@ are met:\r\n\r\n@     * Redistributions of source code must retain the above copyright\r\n@ notice, this list of conditions and the following disclaimer.\r\n@     * Redistributions in binary form must reproduce the above\r\n@ copyright notice, this list of conditions and the following disclaimer\r\n@ in the documentation and/or other materials provided with the\r\n@ distribution.\r\n@     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n@ Productions Ltd nor the names of its contributors may be used to\r\n@ endorse or promote products derived from this software without\r\n@ specific prior written permission.\r\n@\r\n@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n@ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n@ ----------------------------------------------------------------------\r\n\r\n    .text\r\n\r\n\t.global\tdecode_packed_entry_number\r\n\t.global decode_packed_entry_number_REALSTART\r\n\t.global decode_map\r\n\t.global vorbis_book_decodevv_add\r\n\t.global _checksum\r\n\r\n\t.extern\toggpack_adv\r\n\t.extern\toggpack_look\r\n\t.extern\toggpack_eop\r\n\t.extern\tcrc_lookup\r\n\r\ndecode_packed_entry_number_REALSTART:\r\ndpen_nobits:\r\n\tMOV\tr0,r5\t\t@ r0 = b\r\n\tMOV\tr1,#1\t\t@ r1 = 1\r\n\tBL\toggpack_adv\t@ oggpack_adv(b,1)      /* Force eop */\r\nduff:\r\n\tMVN\tr0,#0\t\t@ return -1\r\n\tLDMFD\tr13!,{r4-r8,r10,PC}\r\n\r\ndpen_readfailed:\r\n\tSUBS\tr4,r4,#1\t@ r4 = --read\r\n\tBEQ\tdpen_nobits\r\n\tMOV\tr0,r5\t\t@ r0 = b\r\n\tMOV\tr1,r4\t\t@ r1 = read\r\n\tADR\tr14,dpen_read_return\r\n\tB\toggpack_look\r\n\r\ndecode_packed_entry_number:\r\n\t@ r0 = codebook       *book\r\n\t@ r1 = oggpack_buffer *b\r\n\tSTMFD\tr13!,{r4-r8,r10,r14}\r\n\r\n\tLDMIA\tr0,{r4,r6,r7}\t\t@ r4 = read = book->max_length\r\n\t\t\t\t\t@ r6 = book->dec_table\r\n\t\t\t\t\t@ r7 = book->dec_method\r\n\tMOV\tr5,r1\t\t@ r5 = b\r\n\r\n\tMOV\tr0,r5\t\t@ r0 = b\r\n\tMOV\tr1,r4\t\t@ r1 = read\r\n\tBL\toggpack_look\r\ndpen_read_return:\r\n\tCMP\tr0,#0\r\n\tBLT\tdpen_readfailed\r\n\r\n\t@ r0 = lok\r\n\t@ r4 = read\r\n\t@ r5 = b\r\n\t@ r6 = dec_table\r\n\t@ r7 = dec_method\r\n\r\n\tCMP\tr7, #3\r\n\tBGT\tmeth4\r\n\tBEQ\tmeth3\r\n\tCMP\tr7, #1\r\n\tBGT\tmeth2\r\n\tBEQ\tmeth1\r\nmeth0:\r\n\tRSB\tr1, r4, #0\t\t@ r1 = i-read = 0-read\r\n\tMOV\tr7, #0\t\t\t@ r7 = chase\r\nm0_loop:\r\n\tMOVS\tr0, r0, LSR #1\t\t@ r0 = lok>>1   C = bottom bit\r\n\tADC\tr2, r6, r7, LSL #1\t@ r8 = &t[chase*2+C]\r\n\tLDRB\tr7, [r2]\r\n\tADDS\tr1, r1, #1\t\t@ r1 = i-read++ (i-read<0 => i<read)\r\n\t@ stall Xscale\r\n\tCMPLT\tr7, #0x80\r\n\tBLT\tm0_loop\r\n\tAND\tr7, r7, #0x7F\t\t@ r7 = chase\r\n\tCMP\tr1, #0\t\t\t@ if (i-read >= 0) === (i >= read)\r\n\tMVNGT\tr7, #0\t\t\t@ if (i >= read) value to return = -1\r\n\tADD\tr1, r1, r4\t\t@ r1 = i-read+read+1 = i +1\r\n\tMOV\tr0, r5\t\t\t@ r0 = b\r\n\tBL\toggpack_adv\t\t@ oggpack_adv(b, i+1);\r\n\tMOV\tr0, r7\t\t\t@ return chase\r\n\tLDMFD\tr13!,{r4-r8,r10,PC}\r\n\r\nmeth1:\r\n\t@ r0 = lok\r\n\t@ r4 = read\r\n\t@ r5 = b\r\n\t@ r6 = dec_table\r\n\tRSB\tr1, r4, #0\t\t@ r1 = i = -read\r\n\tMOV\tr10,#0\t\t\t@ r10= next = 0\r\nm1_loop:\r\n\tMOV\tr7, r10\t\t\t@ r7 = chase=next\r\n\tMOVS\tr0, r0, LSR #1\t\t@ r0 = lok>>1     C = bottom bit\r\n\tADC\tr8, r6, r7\t\t@ r8 = t+chase+bit\r\n\tLDRB\tr10,[r8], -r6\t\t@ r10= next=t[chase+bit] r8=chase+bit\r\n\tADDS\tr1, r1, #1\t\t@ r1 = i++\r\n\t@ stall Xscale\r\n\tCMPLT\tr10,#0x80\t\t@ if (next & 0x80) == 0\r\n\tBLT\tm1_loop\r\n\r\n\tADD\tr1, r1, r4\t\t@ r1 = i+read\r\n\tMOV\tr0, r5\t\t\t@ r0 = b\r\n\tBL\toggpack_adv\t\t@ oggpack_adv(b, i)\r\n\r\n\tCMP\tr10,#0x80\r\n\tBLT\tduff\r\n\r\n\tCMP\tr8, r7\t\t\t@ if bit==0 (chase+bit==chase) (sets C)\r\n\tLDRNEB\tr14,[r6, r7]\t\t@ r14= t[chase]\r\n\tMOVEQ\tr14,#128\r\n\tADC\tr12,r8, r6\t\t@ r12= chase+bit+1+t\r\n\tLDRB\tr14,[r12,r14,LSR #7]\t@ r14= t[chase+bit+1+(!bit || t[chase]0x0x80)]\r\n\tBIC\tr10,r10,#0x80\t\t@ r3 = next &= ~0x80\r\n\t@ stall Xscale\r\n\tORR\tr0, r14,r10,LSL #8\t@ r7 = chase = (next<<8) | r14\r\n\r\n\tLDMFD\tr13!,{r4-r8,r10,PC}\r\n\r\n\r\nmeth2:\r\n\tRSB\tr1, r4, #0\t\t@ r1 = i-read = 0-read\r\n\tMOV\tr7, #0\t\t\t@ r7 = chase\r\n\tMOV\tr6, r6, LSR #1\r\nm2_loop:\r\n\tMOVS\tr0, r0, LSR #1\t\t@ r0 = lok>>1   C = bottom bit\r\n\tADC\tr2, r6, r7, LSL #1\t@ r8 = &t[chase*2+C]\r\n\tLDRH\tr7, [r2, r2]\r\n\tADDS\tr1, r1, #1\t\t@ r1 = i-read++ (i-read<0 => i<read)\r\n\t@ stall Xscale\r\n\tCMPLT\tr7, #0x8000\r\n\tBLT\tm2_loop\r\n\tBIC\tr7, r7, #0x8000\t\t@ r7 = chase\r\n\tCMP\tr1, #0\t\t\t@ if (i-read >= 0) === (i >= read)\r\n\tMVNGT\tr7, #0\t\t\t@ if (i >= read) value to return = -1\r\n\tADD\tr1, r1, r4\t\t@ r1 = i-read+read+1 = i +1\r\n\tMOV\tr0, r5\t\t\t@ r0 = b\r\n\tBL\toggpack_adv\t\t@ oggpack_adv(b, i+1);\r\n\tMOV\tr0, r7\t\t\t@ return chase\r\n\tLDMFD\tr13!,{r4-r8,r10,PC}\r\n\r\nmeth3:\r\n\t@ r0 = lok\r\n\t@ r4 = read\r\n\t@ r5 = b\r\n\t@ r6 = dec_table\r\n\tRSB\tr1, r4, #0\t\t@ r1 = i = -read\r\n\tMOV\tr10,#0\t\t\t@ r10= next = 0\r\nm3_loop:\r\n\tMOV\tr7, r10\t\t\t@ r7 = chase=next\r\n\tMOVS\tr0, r0, LSR #1\t\t@ r0 = lok>>1     C = bottom bit\r\n\tADC\tr8, r7, #0\t\t@ r8 = chase+bit\r\n\tMOV\tr8, r8, LSL #1\t\t@ r8 = (chase+bit)<<1\r\n\tLDRH\tr10,[r6, r8]\t\t@ r10= next=t[chase+bit]\r\n\tADDS\tr1, r1, #1\t\t@ r1 = i++\r\n\t@ stall Xscale\r\n\tCMPLT\tr10,#0x8000\t\t@ if (next & 0x8000) == 0\r\n\tBLT\tm3_loop\r\n\r\n\tADD\tr1, r1, r4\t\t@ r1 = i+read\r\n\tMOV\tr0, r5\t\t\t@ r0 = b\r\n\tBL\toggpack_adv\t\t@ oggpack_adv(b, i)\r\n\r\n\tCMP\tr10,#0x8000\r\n\tBLT\tduff\r\n\r\n\tMOV\tr7, r7, LSL #1\r\n\tCMP\tr8, r7\t\t\t@ if bit==0 (chase+bit==chase) sets C\r\n\tLDRNEH\tr14,[r6, r7]\t\t@ r14= t[chase]\r\n\tMOVEQ\tr14,#0x8000\r\n\tADC\tr12,r8, r14,LSR #15\t@ r12= 1+((chase+bit)<<1)+(!bit || t[chase]0x0x8000)\r\n\tADC\tr12,r12,r14,LSR #15\t@ r12= t + (1+chase+bit+(!bit || t[chase]0x0x8000))<<1\r\n\tLDRH\tr14,[r6, r12]\t\t@ r14= t[chase+bit+1\r\n\tBIC\tr10,r10,#0x8000\t\t@ r3 = next &= ~0x8000\r\n\t@ stall Xscale\r\n\tORR\tr0, r14,r10,LSL #16\t@ r7 = chase = (next<<16) | r14\r\n\r\n\tLDMFD\tr13!,{r4-r8,r10,PC}\r\n\r\nmeth4:\r\n\tRSB\tr1, r4, #0\t\t@ r1 = i-read = 0-read\r\n\tMOV\tr7, #0\t\t\t@ r7 = chase\r\nm4_loop:\r\n\tMOVS\tr0, r0, LSR #1\t\t@ r0 = lok>>1   C = bottom bit\r\n\tADC\tr2, r7, r7\t\t@ r8 = chase*2+C\r\n\tLDR\tr7, [r6, r2, LSL #2]\r\n\tADDS\tr1, r1, #1\t\t@ r1 = i-read++ (i-read<0 => i<read)\r\n\t@ stall Xscale\r\n\tCMPLT\tr7, #0x80000000\r\n\tBLT\tm4_loop\r\n\tBIC\tr7, r7, #0x80000000\t@ r7 = chase\r\n\tCMP\tr1, #0\t\t\t@ if (i-read >= 0) === (i >= read)\r\n\tMVNGT\tr7, #0\t\t\t@ if (i >= read) value to return = -1\r\n\tADD\tr1, r1, r4\t\t@ r1 = i-read+read+1 = i +1\r\n\tMOV\tr0, r5\t\t\t@ r0 = b\r\n\tBL\toggpack_adv\t\t@ oggpack_adv(b, i+1);\r\n\tMOV\tr0, r7\t\t\t@ return chase\r\n\tLDMFD\tr13!,{r4-r8,r10,PC}\r\n\r\ndecode_map:\r\n\t@ r0 = codebook *s\r\n\t@ r1 = oggpack_buffer *b\r\n\t@ r2 = int v\r\n\t@ r3 = int point\r\n\tSTMFD\tr13!,{r4-r11,r14}\r\n\r\n\tMOV\tr4, r0\t\t@ r4 = s\r\n\tMOV\tr5, r1\t\t@ r5 = b\r\n\tMOV\tr6, r2\t\t@ r6 = v\r\n\tMOV\tr7, r3\t\t@ r7 = point\r\n\tBL\tdecode_packed_entry_number\r\n\tMOV\tr8, r0\r\n\r\n\tMOV\tr0, r5\r\n\tBL\toggpack_eop\r\n\tCMP\tr0, #0\r\n\tBNE\tdm_duff\r\n\r\n\t@ r4 = s\r\n\t@ r5 = b\r\n\t@ r6 = v\r\n\t@ r7 = point\r\n\t@ r8 = entry\r\n\r\n\tLDR\tr1, [r4,#12]\t@ r1 = s->dec_type\r\n\tLDR\tr2, [r4,#16]\t@ r2 = s->q_bits\r\n\tLDR\tr3, [r4,#20]\t@ r3 = s->dim\r\n\tLDR\tr5, [r4,#24]\t@ r5 = s->q_delp\r\n\tLDR\tr11,[r4,#28]\t@ r11= s->q_minp\r\n\tLDR\tr12,[r4,#32]\t@ r12= s->q_del = mul\r\n\tLDR\tr14,[r4,#36]\t@ r14= s->q_min\r\n\tSUBS\tr11,r7, r11\t@ r11= add    = point - s->q_minp\r\n\r\n\tMOVGT\tr14,r14,ASR r11\t@ r14= add = s->q_min >> add  (if add >0)\r\n\tRSBLT\tr11,r11,#0\r\n\tMOVLT\tr14,r14,LSL r11\t@ r14= add = s->q_min << -add (if add < 0)\r\n\r\n\tSUBS\tr5, r7, r5\t@ r5 = shiftM = point - s->q_delp\r\n\tLDR\tr7, [r4,#40]\t@ r7 = s->q_seq\r\n\tRSBLT\tr5, r5, #0\t@ if (shiftM<0)  r5 =-shiftM\r\n\tMOVLT\tr12,r12,LSL r5\t@                r12=mul<<-shiftM\r\n\tMOVLT\tr5, #0\t\t@                r5 =shiftM = 0\r\n\tMOVGT\tr14,r14,LSL r5\t@ add <<= shiftM\r\n\r\n\tCMP\tr7,#0\t\t@ seqMask = (s->q_seq?-1:0)\r\n\tMVNNE\tr7,#0\r\n\r\n\tCMP\tr1, #2\r\n\tBEQ\tdm2\r\n\tBGT\tdm3\r\n\tCMP\tr1,#0\t\t@ probably never happens\r\n\tBLE\tdm_duff\r\ndm1:\r\n\t@ r1 = s->dec_type\r\n\t@ r2 = s->q_bits\r\n\t@ r3 = s->dim\r\n\t@ r5 = shiftM\r\n\t@ r6 = v\r\n\t@ r7 = seqMask\r\n\t@ r8 = entry\r\n\t@ r12= mul\r\n\t@ r14= add\r\n\tMOV\tr0, #1\r\n\tRSB\tr0, r0, r0, LSL r2\t@ r0 = mask = (1<<s->q_bits)-1\r\n\tMOV\tr11,#0\t\t\t@ r11= prev = 0\r\ndm1_loop:\r\n\tAND\tr1, r8, r0\t\t@ r1 = v = entry & mask\r\n\tMLA\tr1, r12, r1, r14\t@ r1 = (add + mul*v)\r\n\tMOV\tr8, r8, LSR r2\t\t@ r8 = entry>>s->q_bits\r\n\tSUBS\tr3, r3, #1\r\n\tADD\tr1, r11,r1, ASR r5\t@ r1 = v = prev+((add+mul*v)>>shiftM)\r\n\tAND\tr11,r1, r7\t\t@ r11= prev = seqMask & v\r\n\tSTR\tr1, [r6], #4\t\t@ *v++ = v\r\n\tBGT\tdm1_loop\r\n\r\n\tMOV\tr0, #0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\ndm2:\r\n\t@ r1 = s->dec_type\r\n\t@ r2 = s->q_bits\r\n\t@ r3 = s->dim\r\n\t@ r4 = s\r\n\t@ r5 = shiftM\r\n\t@ r6 = v\r\n\t@ r7 = seqMask\r\n\t@ r8 = entry\r\n\t@ r12= mul\r\n\t@ r14= add\r\n\tLDR\tr1, [r4,#44]\t\t@ r1 = s->q_pack\r\n\tLDR\tr4, [r4,#48]\t\t@ r4 = s->q_val\r\n\tMOV\tr11,#0\t\t\t@ r11= prev\r\n\tMOV\tr0, #1\r\n\tRSB\tr0, r0, r0, LSL r1\t@ r8 = mask = (1<<s->q_pack)-1\r\n\tCMP\tr2,#8\r\n\tBGT\tdm2_hword\r\ndm2_loop:\r\n\tAND\tr2, r8, r0\t\t@ r2 = entry & mask\r\n\tLDRB\tr2, [r4, r2]\t\t@ r2 = v = q->val[entry & mask]\r\n\tMOV\tr8, r8, LSR r1\t\t@ r8 = entry>>q_pack\r\n\tMLA\tr2, r12,r2, r14\t\t@ r2 = (add+mul*v)\r\n\tSUBS\tr3, r3, #1\r\n\tADD\tr2, r11,r2, ASR r5\t@ r2 = v = prev+(add+mul*v)>>shiftM\r\n\tAND\tr11,r2, r7\t\t@ r11= prev = seqMask & v\r\n\tSTR\tr2, [r6], #4\t\t@ *v++ = v\r\n\tBGT\tdm2_loop\r\n\tMOV\tr0, #0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\ndm2_hword:\r\n\tAND\tr2, r8, r0\t\t@ r2 = entry & mask\r\n\tMOV\tr2, r2, LSL #1\t\t@ r2 = 2*r2\r\n\tLDRH\tr2, [r4, r2]\t\t@ r2 = v = q->val[entry & mask]\r\n\tMOV\tr8, r8, LSR r1\t\t@ r8 = entry>>q_pack\r\n\tMLA\tr2, r12,r2, r14\t\t@ r2 = (add+mul*v)\r\n\tSUBS\tr3, r3, #1\r\n\tADD\tr2, r11,r2, ASR r5\t@ r2 = v = prev+(add+mul*v)>>shiftM\r\n\tAND\tr11,r2, r7\t\t@ r11= prev = seqMask & v\r\n\tSTR\tr2, [r6], #4\t\t@ *v++ = v\r\n\tBGT\tdm2_hword\r\n\tMOV\tr0, #0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\ndm3:\r\n\t@ r1 = s->dec_type\r\n\t@ r2 = s->q_bits\r\n\t@ r3 = s->dim\r\n\t@ r4 = s\r\n\t@ r5 = shiftM\r\n\t@ r6 = v\r\n\t@ r7 = seqMask\r\n\t@ r8 = entry\r\n\t@ r12= mul\r\n\t@ r14= add\r\n\tLDR\tr1, [r4,#44]\t\t@ r1 = s->q_pack\r\n\tLDR\tr4, [r4,#52]\t\t@ r4 = s->q_val\r\n\tCMP\tr2,#8\r\n\tMOV\tr11,#0\t\t\t@ r11= prev\r\n\tMLA\tr4,r1,r8,r4\t\t@ r4 = ptr = s->q_val+entry*s->q_pack\r\n\r\n\tBGT\tdm3_hword\r\ndm3_loop:\r\n\tLDRB\tr2, [r4], #1\t\t@ r2 = v = *ptr++\r\n\tSUBS\tr3, r3, #1\r\n\tMLA\tr2, r12,r2, r14\t\t@ r2 = (add+mul*v)\r\n\tADD\tr2, r11,r2, ASR r5\t@ r2 = v = prev+(add+mul*v)>>shiftM\r\n\tAND\tr11,r2, r7\t\t@ r11= prev = seqMask & v\r\n\tSTR\tr2, [r6], #4\t\t@ *v++ = v\r\n\tBGT\tdm3_loop\r\n\tMOV\tr0, #0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\ndm3_hword:\r\n\tLDRH\tr2, [r4], #2\t\t@ r2 = *ptr++\r\n\tSUBS\tr3, r3, #1\r\n\tMLA\tr2, r12,r2, r14\t\t@ r2 = (add+mul*v)\r\n\tADD\tr2, r11,r2, ASR r5\t@ r2 = v = prev+(add+mul*v)>>shiftM\r\n\tAND\tr11,r2, r7\t\t@ r11= prev = seqMask & v\r\n\tSTR\tr2, [r6], #4\t\t@ *v++ = v\r\n\tBGT\tdm3_hword\r\n\tMOV\tr0, #0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\ndm_duff:\r\n\tMVN\tr0,#0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\nvorbis_book_decodevv_add:\r\n\t@ r0 = codebook     *book\r\n\t@ r1 = ogg_int32_t **a\r\n\t@ r2 = long          offset\r\n\t@ r3 = int           ch\r\n\t@ <> = b\r\n\t@ <> = n\r\n\t@ <> = point\r\n\tSTMFD\tr13!,{r4-r11,R14}\r\n\tLDR\tr7, [r0, #13*4]\t\t@ r7 = used_entries\r\n\tMOV\tr9, r0\t\t\t@ r9 = book\r\n\tMOV\tr10,r1\t\t\t@ r10= 0xa[chptr]      chptr=0\r\n\tMOV\tr6, r3\t\t\t@ r6 = ch\r\n\tADD\tr8, r10,r3, LSL #2\t@ r8 = 0xa[ch]\r\n\tMOV\tr11,r2\t\t\t@ r11= offset\r\n\tCMP\tr7, #0\t\t\t@ if (used_entries <= 0)\r\n\tBLE\tvbdvva_exit\t\t@     exit\r\n\tLDR\tr5, [r13,#10*4]\t\t@ r5 = n\r\nvbdvva_loop1:\r\n\t@ r5 = n\r\n\t@ r6 = ch\r\n\t@ r8 = 0xa[ch]\r\n\t@ r9 = book\r\n\t@ r10= 0xa[chptr]\r\n\t@ r11= offset\r\n\tMOV\tr0, r9\t\t\t@ r0 = book\r\n\tLDR\tr1, [r13,# 9*4]\t\t@ r1 = b\r\n\tLDR\tr2, [r9, #14*4]\t\t@ r2 = v = dec_buf\r\n\tLDR\tr3, [r13,#11*4]\t\t@ r3 = point\r\n\tBL\tdecode_map\r\n\tCMP\tr0, #0\r\n\tBNE\tvbdvva_fail\r\n\r\n\tLDR\tr0, [r9, # 5*4]\t\t@ r0 = book->dim\r\n\tLDR\tr1, [r9, #14*4]\t\t@ r1 = v = dec_buf\r\nvbdvva_loop2:\r\n\tLDR\tr2, [r10],#4\t\t@ r2 = a[chptr++]\r\n\tLDR\tr12,[r1], #4\t\t@ r1 = v[j++]\r\n\tCMP\tr10,r8\t\t\t@ if (chptr == ch)\r\n\tSUBEQ\tr10,r10,r6, LSL #2\t@    chptr = 0\r\n\tLDR\tr14,[r2, r11,LSL #2]!\t@ r2 = 0xa[chptr++][i] r14=[r12]\r\n\tADDEQ\tr11,r11,#1\t\t@    i++\r\n\tSUBEQ\tr5, r5, #1\t\t@    n--\r\n\tSUBS\tr0, r0, #1\t\t@ r0--\r\n\tADD\tr12,r12,r14\t\t@ r12= a[chptr++][i]+ v[j]\r\n\tSTR\tr12,[r2]\t\t@ r12= a[chptr++][i]+=v[j]\r\n\tBGT\tvbdvva_loop2\r\n\tCMP\tr5,#0\r\n\tBGT\tvbdvva_loop1\r\nvbdvva_exit:\r\n\tMOV\tr0, #0\t\t\t@ return 0\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\nvbdvva_fail:\r\n\tMVN\tr0, #0\t\t\t@ return -1\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\n_checksum:\r\n\t@ r0 = ogg_reference *or\r\n\t@ r1 = bytes\r\n\tSTMFD\tr13!,{r5-r6,r14}\r\n\r\n\tADR\tr6,.Lcrc_lookup\r\n\tLDR\tr5,[r6]\r\n\tADD\tr5,r6\r\n\tMOV\tr14,#0\t\t\t@ r14= crc_reg = 0\r\n\tMOVS\tr12,r0\r\n\tBEQ\t_cs_end\r\n_cs_loop1:\r\n\tLDMIA\tr12,{r0,r2,r3,r12}\t@ r0 = or->buffer\r\n\t\t\t\t\t@ r2 = or->begin\r\n\t\t\t\t\t@ r3 = or->length\r\n\t\t\t\t\t@ r12= or->next\r\n\tLDR\tr0,[r0]\t\t\t@ r0 = or->buffer->data\r\n\tCMP\tr1,r3\t\t\t@ r3 = post = (bytes < or->length ?\r\n\tMOVLT\tr3,r1\t\t\t@              bytes : or->length)\r\n\tMOVS\tr6,r3\t\t\t@ r6 = j = post\r\n\tBEQ\t_cs_no_bytes\r\n\tADD\tr0,r0,r2\t\t@ r0 = or->buffer->data + or->begin\r\n_cs_loop2:\r\n\tLDRB\tr2, [r0],#1\t\t@ r2 = data[j]\r\n\t@ stall\r\n\t@ stall Xscale\r\n\tEOR\tr2, r2, r14,LSR #24\t@ r2 = (crc_reg>>24)^data[j]\r\n\tLDR\tr2, [r5, r2, LSL #2]\t@ r2 = crc_lkp[(crc_reg>>24)^data[j]]\r\n\tSUBS\tr6, r6, #1\t\t@ j--\r\n\t@ stall Xscale\r\n\tEOR\tr14,r2, r14,LSL #8\t@ r14= crc_reg = (crc_reg<<8)^r2\r\n\tBGT\t_cs_loop2\r\n_cs_no_bytes:\r\n\tSUBS\tr1, r1, r3\r\n\tCMPNE\tr12,#0\r\n\tBNE\t_cs_loop1\r\n_cs_end:\r\n\tMOV\tr0,r14\r\n\tLDMFD\tr13!,{r5-r6,PC}\r\n\r\n.Lcrc_lookup:\r\n        .WORD   crc_lookup-.Lcrc_lookup\r\n\r\n\t@ END\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/dsp.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: PCM data vector blocking, windowing and dis/reassembly\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include \"ogg.h\"\r\n#include \"mdct.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"codec_internal.h\"\r\n#include \"misc.h\"\r\n#include \"window_lookup.h\"\r\n\r\nint vorbis_dsp_restart(vorbis_dsp_state *v){\r\n  if(!v)return -1;\r\n  {\r\n    vorbis_info *vi=v->vi;\r\n    codec_setup_info *ci;\r\n\r\n    if(!vi)return -1;\r\n    ci=vi->codec_setup;\r\n    if(!ci)return -1;\r\n\r\n    v->out_end=-1;\r\n    v->out_begin=-1;\r\n\r\n    v->granulepos=-1;\r\n    v->sequence=-1;\r\n    v->sample_count=-1;\r\n  }\r\n  return 0;\r\n}\r\n\r\nint vorbis_dsp_init(vorbis_dsp_state *v,vorbis_info *vi){\r\n  int i;\r\n\r\n  codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;\r\n\r\n  v->vi=vi;\r\n\r\n  v->work=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->work));\r\n  v->mdctright=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->mdctright));\r\n  for(i=0;i<vi->channels;i++){\r\n    v->work[i]=(ogg_int32_t *)_ogg_calloc(1,(ci->blocksizes[1]>>1)*\r\n\t\t\t\t\t  sizeof(*v->work[i]));\r\n    v->mdctright[i]=(ogg_int32_t *)_ogg_calloc(1,(ci->blocksizes[1]>>2)*\r\n\t\t\t\t\t       sizeof(*v->mdctright[i]));\r\n  }\r\n\r\n  v->lW=0; /* previous window size */\r\n  v->W=0;  /* current window size */\r\n\r\n  vorbis_dsp_restart(v);\r\n  return 0;\r\n}\r\n\r\nvorbis_dsp_state *vorbis_dsp_create(vorbis_info *vi){\r\n  vorbis_dsp_state *v=_ogg_calloc(1,sizeof(*v));\r\n  vorbis_dsp_init(v,vi);\r\n  return v;\r\n}\r\n\r\nvoid vorbis_dsp_clear(vorbis_dsp_state *v){\r\n  int i;\r\n  if(v){\r\n    vorbis_info *vi=v->vi;\r\n\r\n    if(v->work){\r\n      for(i=0;i<vi->channels;i++)\r\n        if(v->work[i])_ogg_free(v->work[i]);\r\n      _ogg_free(v->work);\r\n    }\r\n    if(v->mdctright){\r\n      for(i=0;i<vi->channels;i++)\r\n        if(v->mdctright[i])_ogg_free(v->mdctright[i]);\r\n      _ogg_free(v->mdctright);\r\n    }\r\n  }\r\n}\r\n\r\nvoid vorbis_dsp_destroy(vorbis_dsp_state *v){\r\n  vorbis_dsp_clear(v);\r\n  _ogg_free(v);\r\n}\r\n\r\nstatic LOOKUP_T *_vorbis_window(int left){\r\n  switch(left){\r\n  case 32:\r\n    return vwin64;\r\n  case 64:\r\n    return vwin128;\r\n  case 128:\r\n    return vwin256;\r\n  case 256:\r\n    return vwin512;\r\n  case 512:\r\n    return vwin1024;\r\n  case 1024:\r\n    return vwin2048;\r\n  case 2048:\r\n    return vwin4096;\r\n#ifndef LIMIT_TO_64kHz\r\n  case 4096:\r\n    return vwin8192;\r\n#endif\r\n  default:\r\n    return(0);\r\n  }\r\n}\r\n\r\n/* pcm==0 indicates we just want the pending samples, no more */\r\nint vorbis_dsp_pcmout(vorbis_dsp_state *v,ogg_int16_t *pcm,int samples){\r\n  vorbis_info *vi=v->vi;\r\n  codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;\r\n  if(v->out_begin>-1 && v->out_begin<v->out_end){\r\n    int n=v->out_end-v->out_begin;\r\n    if(pcm){\r\n      int i;\r\n      if(n>samples)n=samples;\r\n      for(i=0;i<vi->channels;i++)\r\n\tmdct_unroll_lap(ci->blocksizes[0],ci->blocksizes[1],\r\n\t\t\tv->lW,v->W,v->work[i],v->mdctright[i],\r\n\t\t\t_vorbis_window(ci->blocksizes[0]>>1),\r\n\t\t\t_vorbis_window(ci->blocksizes[1]>>1),\r\n\t\t\tpcm+i,vi->channels,\r\n\t\t\tv->out_begin,v->out_begin+n);\r\n    }\r\n    return(n);\r\n  }\r\n  return(0);\r\n}\r\n\r\nint vorbis_dsp_read(vorbis_dsp_state *v,int s){\r\n  if(s && v->out_begin+s>v->out_end)return(OV_EINVAL);\r\n  v->out_begin+=s;\r\n  return(0);\r\n}\r\n\r\nlong vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  oggpack_buffer       opb;\r\n  int                  mode;\r\n  int modebits=0;\r\n  int v=ci->modes;\r\n\r\n  oggpack_readinit(&opb,op->packet);\r\n\r\n  /* Check the packet type */\r\n  if(oggpack_read(&opb,1)!=0){\r\n    /* Oops.  This is not an audio data packet */\r\n    return(OV_ENOTAUDIO);\r\n  }\r\n\r\n  while(v>1){\r\n    modebits++;\r\n    v>>=1;\r\n  }\r\n\r\n  /* read our mode and pre/post windowsize */\r\n  mode=oggpack_read(&opb,modebits);\r\n  if(mode==-1)return(OV_EBADPACKET);\r\n  return(ci->blocksizes[ci->mode_param[mode].blockflag]);\r\n}\r\n\r\n\r\nstatic int ilog(ogg_uint32_t v){\r\n  int ret=0;\r\n  if(v)--v;\r\n  while(v){\r\n    ret++;\r\n    v>>=1;\r\n  }\r\n  return(ret);\r\n}\r\n\r\nint vorbis_dsp_synthesis(vorbis_dsp_state *vd,ogg_packet *op,int decodep){\r\n  vorbis_info          *vi=vd->vi;\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  int                   mode,i;\r\n\r\n  oggpack_readinit(&vd->opb,op->packet);\r\n\r\n  /* Check the packet type */\r\n  if(oggpack_read(&vd->opb,1)!=0){\r\n    /* Oops.  This is not an audio data packet */\r\n    return OV_ENOTAUDIO ;\r\n  }\r\n\r\n  /* read our mode and pre/post windowsize */\r\n  mode=oggpack_read(&vd->opb,ilog(ci->modes));\r\n  if(mode==-1 || mode>=ci->modes) return OV_EBADPACKET;\r\n\r\n  /* shift information we still need from last window */\r\n  vd->lW=vd->W;\r\n  vd->W=ci->mode_param[mode].blockflag;\r\n  for(i=0;i<vi->channels;i++)\r\n    mdct_shift_right(ci->blocksizes[vd->lW],vd->work[i],vd->mdctright[i]);\r\n\r\n  if(vd->W){\r\n    int temp;\r\n    oggpack_read(&vd->opb,1);\r\n    temp=oggpack_read(&vd->opb,1);\r\n    if(temp==-1) return OV_EBADPACKET;\r\n  }\r\n\r\n  /* packet decode and portions of synthesis that rely on only this block */\r\n  if(decodep){\r\n    mapping_inverse(vd,ci->map_param+ci->mode_param[mode].mapping);\r\n\r\n    if(vd->out_begin==-1){\r\n      vd->out_begin=0;\r\n      vd->out_end=0;\r\n    }else{\r\n      vd->out_begin=0;\r\n      vd->out_end=ci->blocksizes[vd->lW]/4+ci->blocksizes[vd->W]/4;\r\n    }\r\n  }\r\n\r\n  /* track the frame number... This is for convenience, but also\r\n     making sure our last packet doesn't end with added padding.\r\n\r\n     This is not foolproof!  It will be confused if we begin\r\n     decoding at the last page after a seek or hole.  In that case,\r\n     we don't have a starting point to judge where the last frame\r\n     is.  For this reason, vorbisfile will always try to make sure\r\n     it reads the last two marked pages in proper sequence */\r\n\r\n  /* if we're out of sequence, dump granpos tracking until we sync back up */\r\n  if(vd->sequence==-1 || vd->sequence+1 != op->packetno-3){\r\n    /* out of sequence; lose count */\r\n    vd->granulepos=-1;\r\n    vd->sample_count=-1;\r\n  }\r\n\r\n  vd->sequence=op->packetno;\r\n  vd->sequence=vd->sequence-3;\r\n\r\n  if(vd->sample_count==-1){\r\n    vd->sample_count=0;\r\n  }else{\r\n    vd->sample_count+=\r\n      ci->blocksizes[vd->lW]/4+ci->blocksizes[vd->W]/4;\r\n  }\r\n\r\n  if(vd->granulepos==-1){\r\n    if(op->granulepos!=-1){ /* only set if we have a\r\n\t\t\t       position to set to */\r\n\r\n      vd->granulepos=op->granulepos;\r\n\r\n      /* is this a short page? */\r\n      if(vd->sample_count>vd->granulepos){\r\n\t/* corner case; if this is both the first and last audio page,\r\n\t   then spec says the end is cut, not beginning */\r\n\tif(op->e_o_s){\r\n\t  /* trim the end */\r\n\t  /* no preceeding granulepos; assume we started at zero (we'd\r\n\t     have to in a short single-page stream) */\r\n\t  /* granulepos could be -1 due to a seek, but that would result\r\n\t     in a long coun t, not short count */\r\n\r\n\t  vd->out_end-=(int)(vd->sample_count-vd->granulepos);\r\n\t}else{\r\n\t  /* trim the beginning */\r\n\t  vd->out_begin+=(int)(vd->sample_count-vd->granulepos);\r\n\t  if(vd->out_begin>vd->out_end)\r\n\t    vd->out_begin=vd->out_end;\r\n\t}\r\n\r\n      }\r\n\r\n    }\r\n  }else{\r\n    vd->granulepos+=\r\n      ci->blocksizes[vd->lW]/4+ci->blocksizes[vd->W]/4;\r\n    if(op->granulepos!=-1 && vd->granulepos!=op->granulepos){\r\n\r\n      if(vd->granulepos>op->granulepos){\r\n\tlong extra=(long)(vd->granulepos-op->granulepos);\r\n\r\n\tif(extra)\r\n\t  if(op->e_o_s){\r\n\t    /* partial last frame.  Strip the extra samples off */\r\n\t    vd->out_end-=extra;\r\n\t  } /* else {Shouldn't happen *unless* the bitstream is out of\r\n\t       spec.  Either way, believe the bitstream } */\r\n      } /* else {Shouldn't happen *unless* the bitstream is out of\r\n\t   spec.  Either way, believe the bitstream } */\r\n      vd->granulepos=op->granulepos;\r\n    }\r\n  }\r\n\r\n  return(0);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/floor0.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: floor backend 0 implementation\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <math.h>\r\n#include \"ogg.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"codec_internal.h\"\r\n#include \"codebook.h\"\r\n#include \"misc.h\"\r\n#include \"os.h\"\r\n\r\n#define LSP_FRACBITS 14\r\nextern const ogg_int32_t FLOOR_fromdB_LOOKUP[];\r\n\r\n/*************** LSP decode ********************/\r\n\r\n#include \"lsp_lookup.h\"\r\n\r\n/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in\r\n   16.16 format\r\n   returns in m.8 format */\r\n\r\nstatic long ADJUST_SQRT2[2]={8192,5792};\r\nstatic inline ogg_int32_t vorbis_invsqlook_i(long a,long e){\r\n  long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);\r\n  long d=a&INVSQ_LOOKUP_I_MASK;                              /*  0.10 */\r\n  long val=INVSQ_LOOKUP_I[i]-                                /*  1.16 */\r\n    ((INVSQ_LOOKUP_IDel[i]*d)>>INVSQ_LOOKUP_I_SHIFT);        /* result 1.16 */\r\n  val*=ADJUST_SQRT2[e&1];\r\n  e=(e>>1)+21;\r\n  return(val>>e);\r\n}\r\n\r\n/* interpolated lookup based fromdB function, domain -140dB to 0dB only */\r\n/* a is in n.12 format */\r\n#ifdef _LOW_ACCURACY_\r\nstatic inline ogg_int32_t vorbis_fromdBlook_i(long a){\r\n  if(a>0) return 0x7fffffff;\r\n  if(a<(-140<<12)) return 0;\r\n  return FLOOR_fromdB_LOOKUP[((a+140)*467)>>20]<<9;\r\n}\r\n#else\r\nstatic inline ogg_int32_t vorbis_fromdBlook_i(long a){\r\n  if(a>0) return 0x7fffffff;\r\n  if(a<(-140<<12)) return 0;\r\n  return FLOOR_fromdB_LOOKUP[((a+(140<<12))*467)>>20];\r\n}\r\n#endif\r\n\r\n/* interpolated lookup based cos function, domain 0 to PI only */\r\n/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */\r\nstatic inline ogg_int32_t vorbis_coslook_i(long a){\r\n  int i=a>>COS_LOOKUP_I_SHIFT;\r\n  int d=a&COS_LOOKUP_I_MASK;\r\n  return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>\r\n\t\t\t   COS_LOOKUP_I_SHIFT);\r\n}\r\n\r\n/* interpolated half-wave lookup based cos function */\r\n/* a is in 0.16 format, where 0==0, 2^^16==PI, return .LSP_FRACBITS */\r\nstatic inline ogg_int32_t vorbis_coslook2_i(long a){\r\n  int i=a>>COS_LOOKUP_I_SHIFT;\r\n  int d=a&COS_LOOKUP_I_MASK;\r\n  return ((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-\r\n\t  d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>\r\n    (COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);\r\n}\r\n\r\nstatic const ogg_uint16_t barklook[54]={\r\n  0,51,102,154,            206,258,311,365,\r\n  420,477,535,594,         656,719,785,854,\r\n  926,1002,1082,1166,      1256,1352,1454,1564,\r\n  1683,1812,1953,2107,     2276,2463,2670,2900,\r\n  3155,3440,3756,4106,     4493,4919,5387,5901,\r\n  6466,7094,7798,8599,     9528,10623,11935,13524,\r\n  15453,17775,20517,23667, 27183,31004\r\n};\r\n\r\n/* used in init only; interpolate the long way */\r\nstatic inline ogg_int32_t toBARK(int n){\r\n  int i;\r\n  for(i=0;i<54;i++)\r\n    if(n>=barklook[i] && n<barklook[i+1])break;\r\n\r\n  if(i==54){\r\n    return 54<<14;\r\n  }else{\r\n    return (i<<14)+(((n-barklook[i])*\r\n\t\t     ((1UL<<31)/(barklook[i+1]-barklook[i])))>>17);\r\n  }\r\n}\r\n\r\nstatic const unsigned char MLOOP_1[64]={\r\n   0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,\r\n  14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,\r\n  15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,\r\n  15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,\r\n};\r\n\r\nstatic const unsigned char MLOOP_2[64]={\r\n  0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,\r\n  8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,\r\n  9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,\r\n  9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,\r\n};\r\n\r\nstatic const unsigned char MLOOP_3[8]={0,1,2,2,3,3,3,3};\r\n\r\nvoid vorbis_lsp_to_curve(ogg_int32_t *curve,int n,int ln,\r\n\t\t\t ogg_int32_t *lsp,int m,\r\n\t\t\t ogg_int32_t amp,\r\n\t\t\t ogg_int32_t ampoffset,\r\n\t\t\t ogg_int32_t nyq){\r\n\r\n  /* 0 <= m < 256 */\r\n\r\n  /* set up for using all int later */\r\n  int i;\r\n  int ampoffseti=ampoffset*4096;\r\n  int ampi=amp;\r\n  ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));\r\n\r\n  ogg_uint32_t inyq= (1UL<<31) / toBARK(nyq);\r\n  ogg_uint32_t imap= (1UL<<31) / ln;\r\n  ogg_uint32_t tBnyq1 = toBARK(nyq)<<1;\r\n\r\n  /* Besenham for frequency scale to avoid a division */\r\n  int f=0;\r\n  int fdx=n;\r\n  int fbase=nyq/fdx;\r\n  int ferr=0;\r\n  int fdy=nyq-fbase*fdx;\r\n  int map=0;\r\n\r\n#ifdef _LOW_ACCURACY_\r\n  ogg_uint32_t nextbark=((tBnyq1<<11)/ln)>>12;\r\n#else\r\n  ogg_uint32_t nextbark=MULT31(imap>>1,tBnyq1);\r\n#endif\r\n  int nextf=barklook[nextbark>>14]+(((nextbark&0x3fff)*\r\n\t    (barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);\r\n\r\n  /* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/\r\n  for(i=0;i<m;i++){\r\n#ifndef _LOW_ACCURACY_\r\n    ogg_int32_t val=MULT32(lsp[i],0x517cc2);\r\n#else\r\n    ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;\r\n#endif\r\n\r\n    /* safeguard against a malicious stream */\r\n    if(val<0 || (val>>COS_LOOKUP_I_SHIFT)>=COS_LOOKUP_I_SZ){\r\n      memset(curve,0,sizeof(*curve)*n);\r\n      return;\r\n    }\r\n\r\n    ilsp[i]=vorbis_coslook_i(val);\r\n  }\r\n\r\n  i=0;\r\n  while(i<n){\r\n    int j;\r\n    ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */\r\n    ogg_uint32_t qi=46341;\r\n    ogg_int32_t qexp=0,shift;\r\n    ogg_int32_t wi;\r\n\r\n    wi=vorbis_coslook2_i((map*imap)>>15);\r\n\r\n\r\n#ifdef _V_LSP_MATH_ASM\r\n    lsp_loop_asm(&qi,&pi,&qexp,ilsp,wi,m);\r\n\r\n    pi=((pi*pi)>>16);\r\n    qi=((qi*qi)>>16);\r\n\r\n    if(m&1){\r\n      qexp= qexp*2-28*((m+1)>>1)+m;\r\n      pi*=(1<<14)-((wi*wi)>>14);\r\n      qi+=pi>>14;\r\n    }else{\r\n      qexp= qexp*2-13*m;\r\n\r\n      pi*=(1<<14)-wi;\r\n      qi*=(1<<14)+wi;\r\n\r\n      qi=(qi+pi)>>14;\r\n    }\r\n\r\n    if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */\r\n      qi>>=1; qexp++;\r\n    }else\r\n      lsp_norm_asm(&qi,&qexp);\r\n\r\n#else\r\n\r\n    qi*=labs(ilsp[0]-wi);\r\n    pi*=labs(ilsp[1]-wi);\r\n\r\n    for(j=3;j<m;j+=2){\r\n      if(!(shift=MLOOP_1[(pi|qi)>>25]))\r\n      \tif(!(shift=MLOOP_2[(pi|qi)>>19]))\r\n      \t  shift=MLOOP_3[(pi|qi)>>16];\r\n\r\n      qi=(qi>>shift)*labs(ilsp[j-1]-wi);\r\n      pi=(pi>>shift)*labs(ilsp[j]-wi);\r\n      qexp+=shift;\r\n    }\r\n    if(!(shift=MLOOP_1[(pi|qi)>>25]))\r\n      if(!(shift=MLOOP_2[(pi|qi)>>19]))\r\n\tshift=MLOOP_3[(pi|qi)>>16];\r\n\r\n    /* pi,qi normalized collectively, both tracked using qexp */\r\n\r\n    if(m&1){\r\n      /* odd order filter; slightly assymetric */\r\n      /* the last coefficient */\r\n      qi=(qi>>shift)*labs(ilsp[j-1]-wi);\r\n      pi=(pi>>shift)<<14;\r\n      qexp+=shift;\r\n\r\n      if(!(shift=MLOOP_1[(pi|qi)>>25]))\r\n\tif(!(shift=MLOOP_2[(pi|qi)>>19]))\r\n\t  shift=MLOOP_3[(pi|qi)>>16];\r\n\r\n      pi>>=shift;\r\n      qi>>=shift;\r\n      qexp+=shift-14*((m+1)>>1);\r\n\r\n      pi=((pi*pi)>>16);\r\n      qi=((qi*qi)>>16);\r\n      qexp=qexp*2+m;\r\n\r\n      pi*=(1<<14)-((wi*wi)>>14);\r\n      qi+=pi>>14;\r\n\r\n    }else{\r\n      /* even order filter; still symmetric */\r\n\r\n      /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't\r\n\t worth tracking step by step */\r\n\r\n      pi>>=shift;\r\n      qi>>=shift;\r\n      qexp+=shift-7*m;\r\n\r\n      pi=((pi*pi)>>16);\r\n      qi=((qi*qi)>>16);\r\n      qexp=qexp*2+m;\r\n\r\n      pi*=(1<<14)-wi;\r\n      qi*=(1<<14)+wi;\r\n      qi=(qi+pi)>>14;\r\n\r\n    }\r\n\r\n\r\n    /* we've let the normalization drift because it wasn't important;\r\n       however, for the lookup, things must be normalized again.  We\r\n       need at most one right shift or a number of left shifts */\r\n\r\n    if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */\r\n      qi>>=1; qexp++;\r\n    }else\r\n      while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/\r\n\tqi<<=1; qexp--;\r\n      }\r\n\r\n#endif\r\n\r\n    amp=vorbis_fromdBlook_i(ampi*                     /*  n.4         */\r\n\t\t\t    vorbis_invsqlook_i(qi,qexp)-\r\n\t\t\t                              /*  m.8, m+n<=8 */\r\n\t\t\t    ampoffseti);              /*  8.12[0]     */\r\n\r\n#ifdef _LOW_ACCURACY_\r\n    amp>>=9;\r\n#endif\r\n    curve[i]= MULT31_SHIFT15(curve[i],amp);\r\n\r\n    while(++i<n){\r\n\r\n      /* line plot to get new f */\r\n      ferr+=fdy;\r\n      if(ferr>=fdx){\r\n\tferr-=fdx;\r\n\tf++;\r\n      }\r\n      f+=fbase;\r\n\r\n      if(f>=nextf)break;\r\n\r\n      curve[i]= MULT31_SHIFT15(curve[i],amp);\r\n    }\r\n\r\n    while(1){\r\n      map++;\r\n\r\n      if(map+1<ln){\r\n\r\n#ifdef _LOW_ACCURACY_\r\n\tnextbark=((tBnyq1<<11)/ln*(map+1))>>12;\r\n#else\r\n\tnextbark=MULT31((map+1)*(imap>>1),tBnyq1);\r\n#endif\r\n\tnextf=barklook[nextbark>>14]+\r\n\t  (((nextbark&0x3fff)*\r\n\t    (barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);\r\n\tif(f<=nextf)break;\r\n\r\n      }else{\r\n\tnextf=9999999;\r\n\tbreak;\r\n      }\r\n    }\r\n    if(map>=ln){\r\n      map=ln-1; /* guard against the approximation */\r\n      nextf=9999999;\r\n    }\r\n  }\r\n}\r\n\r\n/*************** vorbis decode glue ************/\r\n\r\nvoid floor0_free_info(vorbis_info_floor *i){\r\n  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;\r\n  if(info)_ogg_free(info);\r\n}\r\n\r\nvorbis_info_floor *floor0_info_unpack (vorbis_info *vi,oggpack_buffer *opb){\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  int j;\r\n\r\n  vorbis_info_floor0 *info=(vorbis_info_floor0 *)_ogg_malloc(sizeof(*info));\r\n  info->order=oggpack_read(opb,8);\r\n  info->rate=oggpack_read(opb,16);\r\n  info->barkmap=oggpack_read(opb,16);\r\n  info->ampbits=oggpack_read(opb,6);\r\n  info->ampdB=oggpack_read(opb,8);\r\n  info->numbooks=oggpack_read(opb,4)+1;\r\n\r\n  if(info->order<1)goto err_out;\r\n  if(info->rate<1)goto err_out;\r\n  if(info->barkmap<1)goto err_out;\r\n\r\n  for(j=0;j<info->numbooks;j++){\r\n    info->books[j]=(char)oggpack_read(opb,8);\r\n    if(info->books[j]>=ci->books)goto err_out;\r\n  }\r\n\r\n  if(oggpack_eop(opb))goto err_out;\r\n  return(info);\r\n\r\n err_out:\r\n  floor0_free_info(info);\r\n  return(NULL);\r\n}\r\n\r\nint floor0_memosize(vorbis_info_floor *i){\r\n  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;\r\n  return info->order+1;\r\n}\r\n\r\nogg_int32_t *floor0_inverse1(vorbis_dsp_state *vd,vorbis_info_floor *i,\r\n\t\t\t     ogg_int32_t *lsp){\r\n  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;\r\n  int j,k;\r\n\r\n  int ampraw=oggpack_read(&vd->opb,info->ampbits);\r\n  if(ampraw>0){ /* also handles the -1 out of data case */\r\n    long maxval=(1<<info->ampbits)-1;\r\n    int amp=((ampraw*info->ampdB)<<4)/maxval;\r\n    int booknum=oggpack_read(&vd->opb,_ilog(info->numbooks));\r\n\r\n    if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */\r\n      codec_setup_info  *ci=(codec_setup_info *)vd->vi->codec_setup;\r\n      codebook *b=ci->book_param+info->books[booknum];\r\n      ogg_int32_t last=0;\r\n\r\n      for(j=0;j<info->order;j+=b->dim)\r\n\tif(vorbis_book_decodev_set(b,lsp+j,&vd->opb,b->dim,-24)==-1)goto eop;\r\n      for(j=0;j<info->order;){\r\n\tfor(k=0;k<b->dim;k++,j++)lsp[j]+=last;\r\n\tlast=lsp[j-1];\r\n      }\r\n\r\n      lsp[info->order]=amp;\r\n      return(lsp);\r\n    }\r\n  }\r\n eop:\r\n  return(NULL);\r\n}\r\n\r\nint floor0_inverse2(vorbis_dsp_state *vd,vorbis_info_floor *i,\r\n\t\t\t   ogg_int32_t *lsp,ogg_int32_t *out){\r\n  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;\r\n  codec_setup_info  *ci=(codec_setup_info *)vd->vi->codec_setup;\r\n\r\n  if(lsp){\r\n    ogg_int32_t amp=lsp[info->order];\r\n\r\n    /* take the coefficients back to a spectral envelope curve */\r\n    vorbis_lsp_to_curve(out,ci->blocksizes[vd->W]/2,info->barkmap,\r\n\t\t\tlsp,info->order,amp,info->ampdB,\r\n\t\t\tinfo->rate>>1);\r\n    return(1);\r\n  }\r\n  memset(out,0,sizeof(*out)*ci->blocksizes[vd->W]/2);\r\n  return(0);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/floor1.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: floor backend 1 implementation\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <math.h>\r\n#include \"ogg.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"codec_internal.h\"\r\n#include \"codebook.h\"\r\n#include \"misc.h\"\r\n\r\nextern const ogg_int32_t FLOOR_fromdB_LOOKUP[];\r\n#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */\r\n#define VIF_POSIT 63\r\n\r\n/***********************************************/\r\n\r\nvoid floor1_free_info(vorbis_info_floor *i){\r\n  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;\r\n  if(info){\r\n    if(info->klass)_ogg_free(info->klass);\r\n    if(info->partitionclass)_ogg_free(info->partitionclass);\r\n    if(info->postlist)_ogg_free(info->postlist);\r\n    if(info->forward_index)_ogg_free(info->forward_index);\r\n    if(info->hineighbor)_ogg_free(info->hineighbor);\r\n    if(info->loneighbor)_ogg_free(info->loneighbor);\r\n    memset(info,0,sizeof(*info));\r\n    _ogg_free(info);\r\n  }\r\n}\r\n\r\nstatic int ilog(unsigned int v){\r\n  int ret=0;\r\n  while(v){\r\n    ret++;\r\n    v>>=1;\r\n  }\r\n  return(ret);\r\n}\r\n\r\nstatic void mergesort(char *index,ogg_uint16_t *vals,ogg_uint16_t n){\r\n  ogg_uint16_t i,j;\r\n  char *temp,*A=index,*B=_ogg_malloc(n*sizeof(*B));\r\n\r\n  for(i=1;i<n;i<<=1){\r\n    for(j=0;j+i<n;){\r\n      int k1=j;\r\n      int mid=j+i;\r\n      int k2=mid;\r\n      int end=(j+i*2<n?j+i*2:n);\r\n      while(k1<mid && k2<end){\r\n\tif(vals[A[k1]]<vals[A[k2]])\r\n\t  B[j++]=A[k1++];\r\n\telse\r\n\t  B[j++]=A[k2++];\r\n      }\r\n      while(k1<mid) B[j++]=A[k1++];\r\n      while(k2<end) B[j++]=A[k2++];\r\n    }\r\n    for(;j<n;j++)B[j]=A[j];\r\n    temp=A;A=B;B=temp;\r\n  }\r\n\r\n  if(B==index){\r\n    for(j=0;j<n;j++)B[j]=A[j];\r\n    _ogg_free(A);\r\n  }else\r\n    _ogg_free(B);\r\n}\r\n\r\n\r\nvorbis_info_floor *floor1_info_unpack (vorbis_info *vi,oggpack_buffer *opb){\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  int j,k,count=0,maxclass=-1,rangebits;\r\n\r\n  vorbis_info_floor1 *info=(vorbis_info_floor1 *)_ogg_calloc(1,sizeof(*info));\r\n  /* read partitions */\r\n  info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */\r\n  info->partitionclass=\r\n    (char *)_ogg_malloc(info->partitions*sizeof(*info->partitionclass));\r\n  for(j=0;j<info->partitions;j++){\r\n    info->partitionclass[j]=(char)oggpack_read(opb,4); /* only 0 to 15 legal */\r\n    if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];\r\n  }\r\n\r\n  /* read partition classes */\r\n  info->klass=\r\n    (floor1class *)_ogg_malloc((maxclass+1)*sizeof(*info->klass));\r\n  for(j=0;j<maxclass+1;j++){\r\n    info->klass[j].class_dim=(char)oggpack_read(opb,3)+1; /* 1 to 8 */\r\n    info->klass[j].class_subs=(char)oggpack_read(opb,2); /* 0,1,2,3 bits */\r\n    if(oggpack_eop(opb)<0) goto err_out;\r\n    if(info->klass[j].class_subs)\r\n      info->klass[j].class_book=(unsigned char)oggpack_read(opb,8);\r\n    else\r\n      info->klass[j].class_book=0;\r\n    if(info->klass[j].class_book>=ci->books)goto err_out;\r\n    for(k=0;k<(1<<info->klass[j].class_subs);k++){\r\n      info->klass[j].class_subbook[k]=(unsigned char)(oggpack_read(opb,8)-1);\r\n      if(info->klass[j].class_subbook[k]>=ci->books &&\r\n\t info->klass[j].class_subbook[k]!=0xff)goto err_out;\r\n    }\r\n  }\r\n\r\n  /* read the post list */\r\n  info->mult=oggpack_read(opb,2)+1;     /* only 1,2,3,4 legal now */\r\n  rangebits=oggpack_read(opb,4);\r\n\r\n  for(j=0,k=0;j<info->partitions;j++)\r\n    count+=info->klass[info->partitionclass[j]].class_dim;\r\n  info->postlist=\r\n    (ogg_uint16_t *)_ogg_malloc((count+2)*sizeof(*info->postlist));\r\n  info->forward_index=\r\n    (char *)_ogg_malloc((count+2)*sizeof(*info->forward_index));\r\n  info->loneighbor=\r\n    (char *)_ogg_malloc(count*sizeof(*info->loneighbor));\r\n  info->hineighbor=\r\n    (char *)_ogg_malloc(count*sizeof(*info->hineighbor));\r\n\r\n  count=0;\r\n  for(j=0,k=0;j<info->partitions;j++){\r\n    count+=info->klass[info->partitionclass[j]].class_dim;\r\n    for(;k<count;k++){\r\n      int t=info->postlist[k+2]=(ogg_uint16_t)oggpack_read(opb,rangebits);\r\n      if(t>=(1<<rangebits))goto err_out;\r\n    }\r\n  }\r\n  if(oggpack_eop(opb))goto err_out;\r\n  info->postlist[0]=0;\r\n  info->postlist[1]=1<<rangebits;\r\n  info->posts=count+2;\r\n\r\n  /* also store a sorted position index */\r\n  for(j=0;j<info->posts;j++)info->forward_index[j]=j;\r\n  mergesort(info->forward_index,info->postlist,info->posts);\r\n\r\n  /* discover our neighbors for decode where we don't use fit flags\r\n     (that would push the neighbors outward) */\r\n  for(j=0;j<info->posts-2;j++){\r\n    int lo=0;\r\n    int hi=1;\r\n    int lx=0;\r\n    int hx=info->postlist[1];\r\n    int currentx=info->postlist[j+2];\r\n    for(k=0;k<j+2;k++){\r\n      int x=info->postlist[k];\r\n      if(x>lx && x<currentx){\r\n\tlo=k;\r\n\tlx=x;\r\n      }\r\n      if(x<hx && x>currentx){\r\n\thi=k;\r\n\thx=x;\r\n      }\r\n    }\r\n    info->loneighbor[j]=lo;\r\n    info->hineighbor[j]=hi;\r\n  }\r\n\r\n  return(info);\r\n\r\n err_out:\r\n  floor1_free_info(info);\r\n  return(NULL);\r\n}\r\n\r\n#ifdef ONLY_C\r\nstatic\r\n#endif\r\nint render_point(int x0,int x1,int y0,int y1,int x){\r\n  y0&=0x7fff; /* mask off flag */\r\n  y1&=0x7fff;\r\n\r\n  {\r\n    int dy=y1-y0;\r\n    int adx=x1-x0;\r\n    int ady=abs(dy);\r\n    int err=ady*(x-x0);\r\n\r\n    int off=err/adx;\r\n    if(dy<0)return(y0-off);\r\n    return(y0+off);\r\n  }\r\n}\r\n\r\n#ifndef ONLY_C\r\nvoid render_lineARM(int n, ogg_int32_t *d,const ogg_int32_t *floor, int base, int err, int adx, int ady);\r\n#endif\r\n\r\nstatic void render_line(int n,int x0,int x1,int y0,int y1,ogg_int32_t *d){\r\n  int dy;\r\n  int adx;\r\n  int ady;\r\n  int base;\r\n  int err;\r\n  const ogg_int32_t *floor;\r\n\r\n  if(n>x1)n=x1;\r\n  n -= x0;\r\n  if (n <= 0)\r\n    return;\r\n  dy=y1-y0;\r\n  adx=x1-x0;\r\n  ady=abs(dy);\r\n  base=dy/adx;\r\n  err=adx-1;\r\n  floor=&FLOOR_fromdB_LOOKUP[y0];\r\n  d += x0;\r\n  ady-=abs(base*adx);\r\n\r\n  /* We should add base each time, and then:\r\n   *   if dy >=0 we occasionally add 1\r\n   *   else         occasionally subtract 1.\r\n   * As an optimisation we say that if dy <0 we make base 1 smaller.\r\n   * Then we need to add 1 occassionally, rather than subtract 1 - but we\r\n   * need to add 1 in all the cases when we wouldn't have done so before.\r\n   * Previously we'd have added 1 (100*ady/adx)% of the time. Now we want\r\n   * to do so (100*(adx-ady)/adx)% of the time.\r\n   */\r\n  if (dy < 0){\r\n    base--;\r\n    ady = adx-ady;\r\n    err = 0;\r\n  }\r\n\r\n  //if(x<n)\r\n  //  d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);\r\n\r\n#if defined(ONLY_C)\r\n  do{\r\n    *d = MULT31_SHIFT15(*d,*floor);\r\n    d++;\r\n    floor+=base;\r\n    err-=ady;\r\n    if(err<0){\r\n      err+=adx;\r\n      floor+=1;\r\n    }\r\n    n--;\r\n  } while(n>0);\r\n#else\r\n  render_lineARM(n,d,floor,base,err,adx,ady);\r\n#endif\r\n}\r\n\r\nint floor1_memosize(vorbis_info_floor *i){\r\n  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;\r\n  return info->posts;\r\n}\r\n\r\nstatic int quant_look[4]={256,128,86,64};\r\n\r\nogg_int32_t *floor1_inverse1(vorbis_dsp_state *vd,vorbis_info_floor *in,\r\n\t\t\t     ogg_int32_t *fit_value){\r\n  vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;\r\n  codec_setup_info   *ci=(codec_setup_info *)vd->vi->codec_setup;\r\n\r\n  int i,j,k;\r\n  codebook *books=ci->book_param;\r\n  int quant_q=quant_look[info->mult-1];\r\n\r\n  /* unpack wrapped/predicted values from stream */\r\n  if(oggpack_read(&vd->opb,1)==1){\r\n    fit_value[0]=oggpack_read(&vd->opb,ilog(quant_q-1));\r\n    fit_value[1]=oggpack_read(&vd->opb,ilog(quant_q-1));\r\n\r\n    /* partition by partition */\r\n    /* partition by partition */\r\n    for(i=0,j=2;i<info->partitions;i++){\r\n      int classv=info->partitionclass[i];\r\n      int cdim=info->klass[classv].class_dim;\r\n      int csubbits=info->klass[classv].class_subs;\r\n      int csub=1<<csubbits;\r\n      int cval=0;\r\n\r\n      /* decode the partition's first stage cascade value */\r\n      if(csubbits){\r\n\tcval=vorbis_book_decode(books+info->klass[classv].class_book,&vd->opb);\r\n\r\n\tif(cval==-1)goto eop;\r\n      }\r\n\r\n      for(k=0;k<cdim;k++){\r\n\tint book=info->klass[classv].class_subbook[cval&(csub-1)];\r\n\tcval>>=csubbits;\r\n\tif(book!=0xff){\r\n\t  if((fit_value[j+k]=vorbis_book_decode(books+book,&vd->opb))==-1)\r\n\t    goto eop;\r\n\t}else{\r\n\t  fit_value[j+k]=0;\r\n\t}\r\n      }\r\n      j+=cdim;\r\n    }\r\n\r\n    /* unwrap positive values and reconsitute via linear interpolation */\r\n    for(i=2;i<info->posts;i++){\r\n      int predicted=render_point(info->postlist[info->loneighbor[i-2]],\r\n\t\t\t\t info->postlist[info->hineighbor[i-2]],\r\n\t\t\t\t fit_value[info->loneighbor[i-2]],\r\n\t\t\t\t fit_value[info->hineighbor[i-2]],\r\n\t\t\t\t info->postlist[i]);\r\n      int hiroom=quant_q-predicted;\r\n      int loroom=predicted;\r\n      int room=(hiroom<loroom?hiroom:loroom)<<1;\r\n      int val=fit_value[i];\r\n\r\n      if(val){\r\n\tif(val>=room){\r\n\t  if(hiroom>loroom){\r\n\t    val = val-loroom;\r\n\t  }else{\r\n\t  val = -1-(val-hiroom);\r\n\t  }\r\n\t}else{\r\n\t  if(val&1){\r\n\t    val= -((val+1)>>1);\r\n\t  }else{\r\n\t    val>>=1;\r\n\t  }\r\n\t}\r\n\r\n\tfit_value[i]=val+predicted;\r\n\tfit_value[info->loneighbor[i-2]]&=0x7fff;\r\n\tfit_value[info->hineighbor[i-2]]&=0x7fff;\r\n\r\n      }else{\r\n\tfit_value[i]=predicted|0x8000;\r\n      }\r\n\r\n    }\r\n\r\n    return(fit_value);\r\n  }\r\n eop:\r\n  return(NULL);\r\n}\r\n\r\nint floor1_inverse2(vorbis_dsp_state *vd,vorbis_info_floor *in,\r\n\t\t    ogg_int32_t *fit_value,ogg_int32_t *out){\r\n  vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;\r\n\r\n  codec_setup_info   *ci=(codec_setup_info *)vd->vi->codec_setup;\r\n  int                  n=ci->blocksizes[vd->W]/2;\r\n  int j;\r\n\r\n  if(fit_value){\r\n    /* render the lines */\r\n    int hx=0;\r\n    int lx=0;\r\n    int ly=fit_value[0]*info->mult;\r\n    for(j=1;j<info->posts;j++){\r\n      int current=info->forward_index[j];\r\n      int hy=fit_value[current]&0x7fff;\r\n      if(hy==fit_value[current]){\r\n\r\n\thy*=info->mult;\r\n\thx=info->postlist[current];\r\n\r\n\trender_line(n,lx,hx,ly,hy,out);\r\n\r\n\tlx=hx;\r\n\tly=hy;\r\n      }\r\n    }\r\n    for(j=hx;j<n;j++)out[j]*=ly; /* be certain */\r\n    return(1);\r\n  }\r\n  memset(out,0,sizeof(*out)*n);\r\n  return(0);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/floor1ARM.s",
    "content": "@ Tremolo library\r\n@-----------------------------------------------------------------------\r\n@ Copyright (C) 2002-2009, Xiph.org Foundation\r\n@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n@ All rights reserved.\r\n\r\n@ Redistribution and use in source and binary forms, with or without\r\n@ modification, are permitted provided that the following conditions\r\n@ are met:\r\n\r\n@     * Redistributions of source code must retain the above copyright\r\n@ notice, this list of conditions and the following disclaimer.\r\n@     * Redistributions in binary form must reproduce the above\r\n@ copyright notice, this list of conditions and the following disclaimer\r\n@ in the documentation and/or other materials provided with the\r\n@ distribution.\r\n@     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n@ Productions Ltd nor the names of its contributors may be used to\r\n@ endorse or promote products derived from this software without\r\n@ specific prior written permission.\r\n@\r\n@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n@ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n@ ----------------------------------------------------------------------\r\n\r\n    .text\r\n\r\n\t.global\trender_lineARM\r\n\r\nrender_lineARM:\r\n\t@ r0 = n\r\n\t@ r1 = d\r\n\t@ r2 = floor\r\n\t@ r3 = base\r\n\t@ <> = err\r\n\t@ <> = adx\r\n\t@ <> = ady\r\n\tMOV\tr12,r13\r\n\tSTMFD\tr13!,{r4-r6,r11,r14}\r\n\tLDMFD\tr12,{r11,r12,r14}\t@ r11 = err\r\n\t\t\t\t\t@ r12 = adx\r\n\t\t\t\t\t@ r14 = ady\r\nrl_loop:\r\n\tLDR\tr4,[r1]\t\t\t@ r4 = *d\r\n\tLDR\tr5,[r2],r3,LSL #2\t@ r5 = *floor    r2 = floor+base\r\n\tSUBS\tr11,r11,r14\t\t@ err -= ady\r\n\tADDLT\tr11,r11,r12\t\t@ if (err < 0) err+=adx\r\n\tSMULL\tr6, r5, r4, r5\t\t@ (r6,r5) = *d * *floor\r\n\tADDLT\tr2, r2, #4\t\t@              floor+=1\r\n\tMOVS\tr6, r6, LSR #15\r\n\tADC\tr5, r6, r5, LSL #17\t@ r5 = MULT31_SHIFT15\r\n\tSTR\tr5,[r1],#4\r\n\tSUBS\tr0, r0, #1\r\n\tBGT\trl_loop\r\n\r\n\tLDMFD\tr13!,{r4-r6,r11,PC}\r\n\r\n\t@ END\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/floor1LARM.s",
    "content": "@ Tremolo library\r\n@-----------------------------------------------------------------------\r\n@ Copyright (C) 2002-2009, Xiph.org Foundation\r\n@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n@ All rights reserved.\r\n\r\n@ Redistribution and use in source and binary forms, with or without\r\n@ modification, are permitted provided that the following conditions\r\n@ are met:\r\n\r\n@     * Redistributions of source code must retain the above copyright\r\n@ notice, this list of conditions and the following disclaimer.\r\n@     * Redistributions in binary form must reproduce the above\r\n@ copyright notice, this list of conditions and the following disclaimer\r\n@ in the documentation and/or other materials provided with the\r\n@ distribution.\r\n@     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n@ Productions Ltd nor the names of its contributors may be used to\r\n@ endorse or promote products derived from this software without\r\n@ specific prior written permission.\r\n@\r\n@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n@ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n@ ----------------------------------------------------------------------\r\n\r\n    .text\r\n\r\n\t.global\trender_lineARM\r\n\r\nrender_lineARM:\r\n\t@ r0 = n\r\n\t@ r1 = d\r\n\t@ r2 = floor\r\n\t@ r3 = base\r\n\t@ <> = err\r\n\t@ <> = adx\r\n\t@ <> = ady\r\n\tMOV\tr12,r13\r\n\tSTMFD\tr13!,{r4-r6,r11,r14}\r\n\tLDMFD\tr12,{r11,r12,r14}\t@ r11 = err\r\n\t\t\t\t\t@ r12 = adx\r\n\t\t\t\t\t@ r14 = ady\r\nrl_loop:\r\n\tLDR\tr4, [r1]\t\t@ r4 = *d\r\n\tLDR\tr5, [r2], r3,LSL #2\t@ r5 = *floor    r2 = floor+base\r\n\tSUBS\tr11,r11,r14\t\t@ err -= ady\r\n\tMOV\tr4, r4, ASR #6\r\n\tMUL\tr5, r4, r5\t\t@ r5 = MULT31_SHIFT15\r\n\tADDLT\tr11,r11,r12\t\t@ if (err < 0) err+=adx\r\n\tADDLT\tr2, r2, #4\t\t@              floor+=1\r\n\tSUBS\tr0, r0, #1\r\n\tSTR\tr5, [r1], #4\r\n\tBGT\trl_loop\r\n\r\n\tLDMFD\tr13!,{r4-r6,r11,PC}\r\n\r\n\t@ END\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/floor_lookup.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: floor dB lookup\r\n\r\n ************************************************************************/\r\n\r\n#include \"os.h\"\r\n\r\n#ifdef _LOW_ACCURACY_\r\n#  define XdB(n) ((((n)>>8)+1)>>1)\r\n#else\r\n#  define XdB(n) (n)\r\n#endif\r\n\r\nconst ogg_int32_t FLOOR_fromdB_LOOKUP[256]={\r\n  XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),\r\n  XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),\r\n  XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),\r\n  XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),\r\n  XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),\r\n  XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),\r\n  XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),\r\n  XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),\r\n  XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),\r\n  XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),\r\n  XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),\r\n  XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),\r\n  XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),\r\n  XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),\r\n  XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),\r\n  XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),\r\n  XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),\r\n  XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),\r\n  XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),\r\n  XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),\r\n  XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),\r\n  XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),\r\n  XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),\r\n  XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),\r\n  XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),\r\n  XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),\r\n  XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),\r\n  XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),\r\n  XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),\r\n  XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),\r\n  XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),\r\n  XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),\r\n  XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),\r\n  XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),\r\n  XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),\r\n  XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),\r\n  XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),\r\n  XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),\r\n  XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),\r\n  XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),\r\n  XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),\r\n  XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),\r\n  XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),\r\n  XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),\r\n  XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),\r\n  XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),\r\n  XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),\r\n  XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),\r\n  XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),\r\n  XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),\r\n  XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),\r\n  XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),\r\n  XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),\r\n  XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),\r\n  XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),\r\n  XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),\r\n  XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),\r\n  XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),\r\n  XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),\r\n  XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),\r\n  XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),\r\n  XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),\r\n  XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),\r\n  XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),\r\n};\r\n  \r\n"
  },
  {
    "path": "Engine/libs/Tremolo/framing.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: decode Ogg streams back into raw packets\r\n\r\n note: The CRC code is directly derived from public domain code by\r\n Ross Williams (ross@guest.adelaide.edu.au).  See docs/framing.html\r\n for details.\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include \"ogg.h\"\r\n#include \"misc.h\"\r\n\r\n\r\n/* A complete description of Ogg framing exists in docs/framing.html */\r\n\r\n/* basic, centralized Ogg memory management based on linked lists of\r\n   references to refcounted memory buffers.  References and buffers\r\n   are both recycled.  Buffers are passed around and consumed in\r\n   reference form. */\r\n\r\nstatic ogg_buffer_state *ogg_buffer_create(void){\r\n  ogg_buffer_state *bs=_ogg_calloc(1,sizeof(*bs));\r\n  return bs;\r\n}\r\n\r\n/* destruction is 'lazy'; there may be memory references outstanding,\r\n   and yanking the buffer state out from underneath would be\r\n   antisocial.  Dealloc what is currently unused and have\r\n   _release_one watch for the stragglers to come in.  When they do,\r\n   finish destruction. */\r\n\r\n/* call the helper while holding lock */\r\nstatic void _ogg_buffer_destroy(ogg_buffer_state *bs){\r\n  ogg_buffer *bt;\r\n  ogg_reference *rt;\r\n\r\n  if(bs->shutdown){\r\n\r\n    bt=bs->unused_buffers;\r\n    rt=bs->unused_references;\r\n\r\n    while(bt){\r\n      ogg_buffer *b=bt;\r\n      bt=b->ptr.next;\r\n      if(b->data)_ogg_free(b->data);\r\n      _ogg_free(b);\r\n    }\r\n    bs->unused_buffers=0;\r\n    while(rt){\r\n      ogg_reference *r=rt;\r\n      rt=r->next;\r\n      _ogg_free(r);\r\n    }\r\n    bs->unused_references=0;\r\n\r\n    if(!bs->outstanding)\r\n      _ogg_free(bs);\r\n\r\n  }\r\n}\r\n\r\nstatic void ogg_buffer_destroy(ogg_buffer_state *bs){\r\n  bs->shutdown=1;\r\n  _ogg_buffer_destroy(bs);\r\n}\r\n\r\nstatic ogg_buffer *_fetch_buffer(ogg_buffer_state *bs,long bytes){\r\n  ogg_buffer    *ob;\r\n  bs->outstanding++;\r\n\r\n  /* do we have an unused buffer sitting in the pool? */\r\n  if(bs->unused_buffers){\r\n    ob=bs->unused_buffers;\r\n    bs->unused_buffers=ob->ptr.next;\r\n\r\n    /* if the unused buffer is too small, grow it */\r\n    if(ob->size<bytes){\r\n      ob->data=_ogg_realloc(ob->data,bytes);\r\n      ob->size=bytes;\r\n    }\r\n  }else{\r\n    /* allocate a new buffer */\r\n    ob=_ogg_malloc(sizeof(*ob));\r\n    ob->data=_ogg_malloc(bytes<16?16:bytes);\r\n    ob->size=bytes;\r\n  }\r\n\r\n  ob->refcount=1;\r\n  ob->ptr.owner=bs;\r\n  return ob;\r\n}\r\n\r\nstatic ogg_reference *_fetch_ref(ogg_buffer_state *bs){\r\n  ogg_reference *or;\r\n  bs->outstanding++;\r\n\r\n  /* do we have an unused reference sitting in the pool? */\r\n  if(bs->unused_references){\r\n    or=bs->unused_references;\r\n    bs->unused_references=or->next;\r\n  }else{\r\n    /* allocate a new reference */\r\n    or=_ogg_malloc(sizeof(*or));\r\n  }\r\n\r\n  or->begin=0;\r\n  or->length=0;\r\n  or->next=0;\r\n  return or;\r\n}\r\n\r\n/* fetch a reference pointing to a fresh, initially continguous buffer\r\n   of at least [bytes] length */\r\nstatic ogg_reference *ogg_buffer_alloc(ogg_buffer_state *bs,long bytes){\r\n  ogg_buffer    *ob=_fetch_buffer(bs,bytes);\r\n  ogg_reference *or=_fetch_ref(bs);\r\n  or->buffer=ob;\r\n  return or;\r\n}\r\n\r\n/* enlarge the data buffer in the current link */\r\nstatic void ogg_buffer_realloc(ogg_reference *or,long bytes){\r\n  ogg_buffer    *ob=or->buffer;\r\n\r\n  /* if the unused buffer is too small, grow it */\r\n  if(ob->size<bytes){\r\n    ob->data=_ogg_realloc(ob->data,bytes);\r\n    ob->size=bytes;\r\n  }\r\n}\r\n\r\nstatic void _ogg_buffer_mark_one(ogg_reference *or){\r\n  or->buffer->refcount++;\r\n}\r\n\r\n/* increase the refcount of the buffers to which the reference points */\r\nstatic void ogg_buffer_mark(ogg_reference *or){\r\n  while(or){\r\n    _ogg_buffer_mark_one(or);\r\n    or=or->next;\r\n  }\r\n}\r\n\r\n/* duplicate a reference (pointing to the same actual buffer memory)\r\n   and increment buffer refcount.  If the desired segment is zero\r\n   length, a zero length ref is returned. */\r\nstatic ogg_reference *ogg_buffer_sub(ogg_reference *or,long length){\r\n  ogg_reference *ret=0,*head=0;\r\n\r\n  /* duplicate the reference chain; increment refcounts */\r\n  while(or && length){\r\n    ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);\r\n    if(head)\r\n      head->next=temp;\r\n    else\r\n      ret=temp;\r\n    head=temp;\r\n    head->buffer=or->buffer;\r\n    head->begin=or->begin;\r\n    head->length=length;\r\n    if(head->length>or->length)\r\n      head->length=or->length;\r\n\r\n    length-=head->length;\r\n    or=or->next;\r\n  }\r\n\r\n  ogg_buffer_mark(ret);\r\n  return ret;\r\n}\r\n\r\nogg_reference *ogg_buffer_dup(ogg_reference *or){\r\n  ogg_reference *ret=0,*head=0;\r\n  /* duplicate the reference chain; increment refcounts */\r\n  while(or){\r\n    ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);\r\n    if(head)\r\n      head->next=temp;\r\n    else\r\n      ret=temp;\r\n    head=temp;\r\n    head->buffer=or->buffer;\r\n    head->begin=or->begin;\r\n    head->length=or->length;\r\n    or=or->next;\r\n  }\r\n\r\n  ogg_buffer_mark(ret);\r\n  return ret;\r\n}\r\n\r\n/* split a reference into two references; 'return' is a reference to\r\n   the buffer preceeding pos and 'head'/'tail' are the buffer past the\r\n   split.  If pos is at or past the end of the passed in segment,\r\n   'head/tail' are NULL */\r\nstatic ogg_reference *ogg_buffer_split(ogg_reference **tail,\r\n                                ogg_reference **head,long pos){\r\n\r\n  /* walk past any preceeding fragments to one of:\r\n     a) the exact boundary that seps two fragments\r\n     b) the fragment that needs split somewhere in the middle */\r\n  ogg_reference *ret=*tail;\r\n  ogg_reference *or=*tail;\r\n\r\n  while(or && pos>or->length){\r\n    pos-=or->length;\r\n    or=or->next;\r\n  }\r\n\r\n  if(!or || pos==0){\r\n\r\n    return 0;\r\n\r\n  }else{\r\n\r\n    if(pos>=or->length){\r\n      /* exact split, or off the end? */\r\n      if(or->next){\r\n\r\n        /* a split */\r\n        *tail=or->next;\r\n        or->next=0;\r\n\r\n      }else{\r\n\r\n        /* off or at the end */\r\n        *tail=*head=0;\r\n\r\n      }\r\n    }else{\r\n\r\n      /* split within a fragment */\r\n      long lengthA=pos;\r\n      long beginB=or->begin+pos;\r\n      long lengthB=or->length-pos;\r\n\r\n      /* make a new reference to tail the second piece */\r\n      *tail=_fetch_ref(or->buffer->ptr.owner);\r\n\r\n      (*tail)->buffer=or->buffer;\r\n      (*tail)->begin=beginB;\r\n      (*tail)->length=lengthB;\r\n      (*tail)->next=or->next;\r\n      _ogg_buffer_mark_one(*tail);\r\n      if(head && or==*head)*head=*tail;\r\n\r\n      /* update the first piece */\r\n      or->next=0;\r\n      or->length=lengthA;\r\n\r\n    }\r\n  }\r\n  return ret;\r\n}\r\n\r\nstatic void ogg_buffer_release_one(ogg_reference *or){\r\n  ogg_buffer *ob=or->buffer;\r\n  ogg_buffer_state *bs=ob->ptr.owner;\r\n\r\n  ob->refcount--;\r\n  if(ob->refcount==0){\r\n    bs->outstanding--; /* for the returned buffer */\r\n    ob->ptr.next=bs->unused_buffers;\r\n    bs->unused_buffers=ob;\r\n  }\r\n\r\n  bs->outstanding--; /* for the returned reference */\r\n  or->next=bs->unused_references;\r\n  bs->unused_references=or;\r\n\r\n  _ogg_buffer_destroy(bs); /* lazy cleanup (if needed) */\r\n\r\n}\r\n\r\n/* release the references, decrease the refcounts of buffers to which\r\n   they point, release any buffers with a refcount that drops to zero */\r\nstatic void ogg_buffer_release(ogg_reference *or){\r\n  while(or){\r\n    ogg_reference *next=or->next;\r\n    ogg_buffer_release_one(or);\r\n    or=next;\r\n  }\r\n}\r\n\r\nstatic ogg_reference *ogg_buffer_pretruncate(ogg_reference *or,long pos){\r\n  /* release preceeding fragments we don't want */\r\n  while(or && pos>=or->length){\r\n    ogg_reference *next=or->next;\r\n    pos-=or->length;\r\n    ogg_buffer_release_one(or);\r\n    or=next;\r\n  }\r\n  if (or) {\r\n    or->begin+=pos;\r\n    or->length-=pos;\r\n  }\r\n  return or;\r\n}\r\n\r\nstatic ogg_reference *ogg_buffer_walk(ogg_reference *or){\r\n  if(!or)return NULL;\r\n  while(or->next){\r\n    or=or->next;\r\n  }\r\n  return(or);\r\n}\r\n\r\n/* *head is appended to the front end (head) of *tail; both continue to\r\n   be valid pointers, with *tail at the tail and *head at the head */\r\nstatic ogg_reference *ogg_buffer_cat(ogg_reference *tail, ogg_reference *head){\r\n  if(!tail)return head;\r\n\r\n  while(tail->next){\r\n    tail=tail->next;\r\n  }\r\n  tail->next=head;\r\n  return ogg_buffer_walk(head);\r\n}\r\n\r\nstatic void _positionB(oggbyte_buffer *b,int pos){\r\n  if(pos<b->pos){\r\n    /* start at beginning, scan forward */\r\n    b->ref=b->baseref;\r\n    b->pos=0;\r\n    b->end=b->pos+b->ref->length;\r\n    b->ptr=b->ref->buffer->data+b->ref->begin;\r\n  }\r\n}\r\n\r\nstatic void _positionF(oggbyte_buffer *b,int pos){\r\n  /* scan forward for position */\r\n  while(pos>=b->end){\r\n    /* just seek forward */\r\n    b->pos+=b->ref->length;\r\n    b->ref=b->ref->next;\r\n    b->end=b->ref->length+b->pos;\r\n    b->ptr=b->ref->buffer->data+b->ref->begin;\r\n  }\r\n}\r\n\r\nstatic int oggbyte_init(oggbyte_buffer *b,ogg_reference *or){\r\n  memset(b,0,sizeof(*b));\r\n  if(or){\r\n    b->ref=b->baseref=or;\r\n    b->pos=0;\r\n    b->end=b->ref->length;\r\n    b->ptr=b->ref->buffer->data+b->ref->begin;\r\n    return 0;\r\n  }else\r\n    return -1;\r\n}\r\n\r\nstatic void oggbyte_set4(oggbyte_buffer *b,ogg_uint32_t val,int pos){\r\n  int i;\r\n  _positionB(b,pos);\r\n  for(i=0;i<4;i++){\r\n    _positionF(b,pos);\r\n    b->ptr[pos-b->pos]=val;\r\n    val>>=8;\r\n    ++pos;\r\n  }\r\n}\r\n\r\nstatic unsigned char oggbyte_read1(oggbyte_buffer *b,int pos){\r\n  _positionB(b,pos);\r\n  _positionF(b,pos);\r\n  return b->ptr[pos-b->pos];\r\n}\r\n\r\nstatic ogg_uint32_t oggbyte_read4(oggbyte_buffer *b,int pos){\r\n  ogg_uint32_t ret;\r\n  _positionB(b,pos);\r\n  _positionF(b,pos);\r\n  ret=b->ptr[pos-b->pos];\r\n  _positionF(b,++pos);\r\n  ret|=b->ptr[pos-b->pos]<<8;\r\n  _positionF(b,++pos);\r\n  ret|=b->ptr[pos-b->pos]<<16;\r\n  _positionF(b,++pos);\r\n  ret|=b->ptr[pos-b->pos]<<24;\r\n  return ret;\r\n}\r\n\r\nstatic ogg_int64_t oggbyte_read8(oggbyte_buffer *b,int pos){\r\n  ogg_int64_t ret;\r\n  unsigned char t[7];\r\n  int i;\r\n  _positionB(b,pos);\r\n  for(i=0;i<7;i++){\r\n    _positionF(b,pos);\r\n    t[i]=b->ptr[pos++ -b->pos];\r\n  }\r\n\r\n  _positionF(b,pos);\r\n  ret=b->ptr[pos-b->pos];\r\n\r\n  for(i=6;i>=0;--i)\r\n    ret= ret<<8 | t[i];\r\n\r\n  return ret;\r\n}\r\n\r\n/* Now we get to the actual framing code */\r\n\r\nint ogg_page_version(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header))return -1;\r\n  return oggbyte_read1(&ob,4);\r\n}\r\n\r\nint ogg_page_continued(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header))return -1;\r\n  return oggbyte_read1(&ob,5)&0x01;\r\n}\r\n\r\nint ogg_page_bos(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header))return -1;\r\n  return oggbyte_read1(&ob,5)&0x02;\r\n}\r\n\r\nint ogg_page_eos(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header))return -1;\r\n  return oggbyte_read1(&ob,5)&0x04;\r\n}\r\n\r\nogg_int64_t ogg_page_granulepos(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header))return -1;\r\n  return oggbyte_read8(&ob,6);\r\n}\r\n\r\nogg_uint32_t ogg_page_serialno(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header)) return 0xffffffffUL;\r\n  return oggbyte_read4(&ob,14);\r\n}\r\n\r\nogg_uint32_t ogg_page_pageno(ogg_page *og){\r\n  oggbyte_buffer ob;\r\n  if(oggbyte_init(&ob,og->header))return 0xffffffffUL;\r\n  return oggbyte_read4(&ob,18);\r\n}\r\n\r\n/* returns the number of packets that are completed on this page (if\r\n   the leading packet is begun on a previous page, but ends on this\r\n   page, it's counted */\r\n\r\n/* NOTE:\r\nIf a page consists of a packet begun on a previous page, and a new\r\npacket begun (but not completed) on this page, the return will be:\r\n  ogg_page_packets(page)   ==1,\r\n  ogg_page_continued(page) !=0\r\n\r\nIf a page happens to be a single packet that was begun on a\r\nprevious page, and spans to the next page (in the case of a three or\r\nmore page packet), the return will be:\r\n  ogg_page_packets(page)   ==0,\r\n  ogg_page_continued(page) !=0\r\n*/\r\n\r\nint ogg_page_packets(ogg_page *og){\r\n  int i;\r\n  int n;\r\n  int count=0;\r\n  oggbyte_buffer ob;\r\n  oggbyte_init(&ob,og->header);\r\n\r\n  n=oggbyte_read1(&ob,26);\r\n  for(i=0;i<n;i++)\r\n    if(oggbyte_read1(&ob,27+i)<255)count++;\r\n  return(count);\r\n}\r\n\r\n/* Static CRC calculation table.  See older code in CVS for dead\r\n   run-time initialization code. */\r\n\r\nogg_uint32_t crc_lookup[256]={\r\n  0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,\r\n  0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,\r\n  0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,\r\n  0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,\r\n  0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,\r\n  0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,\r\n  0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,\r\n  0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,\r\n  0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,\r\n  0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,\r\n  0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,\r\n  0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,\r\n  0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,\r\n  0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,\r\n  0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,\r\n  0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,\r\n  0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,\r\n  0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,\r\n  0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,\r\n  0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,\r\n  0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,\r\n  0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,\r\n  0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,\r\n  0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,\r\n  0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,\r\n  0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,\r\n  0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,\r\n  0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,\r\n  0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,\r\n  0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,\r\n  0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,\r\n  0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,\r\n  0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,\r\n  0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,\r\n  0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,\r\n  0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,\r\n  0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,\r\n  0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,\r\n  0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,\r\n  0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,\r\n  0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,\r\n  0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,\r\n  0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,\r\n  0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,\r\n  0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,\r\n  0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,\r\n  0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,\r\n  0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,\r\n  0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,\r\n  0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,\r\n  0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,\r\n  0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,\r\n  0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,\r\n  0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,\r\n  0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,\r\n  0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,\r\n  0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,\r\n  0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,\r\n  0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,\r\n  0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,\r\n  0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,\r\n  0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,\r\n  0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,\r\n  0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};\r\n\r\nvoid ogg_sync_init(ogg_sync_state *oy){\r\n  memset(oy,0,sizeof(*oy));\r\n  oy->bufferpool=ogg_buffer_create();\r\n}\r\n\r\nogg_sync_state *ogg_sync_create(void){\r\n  ogg_sync_state *oy=_ogg_calloc(1,sizeof(*oy));\r\n  memset(oy,0,sizeof(*oy));\r\n  oy->bufferpool=ogg_buffer_create();\r\n  return oy;\r\n}\r\n\r\nint ogg_sync_clear(ogg_sync_state *oy){\r\n  if(oy){\r\n    ogg_sync_reset(oy);\r\n    ogg_buffer_destroy(oy->bufferpool);\r\n    memset(oy,0,sizeof(*oy));\r\n  }\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nint ogg_sync_destroy(ogg_sync_state *oy){\r\n  if(oy){\r\n    ogg_sync_reset(oy);\r\n    ogg_buffer_destroy(oy->bufferpool);\r\n    memset(oy,0,sizeof(*oy));\r\n    _ogg_free(oy);\r\n  }\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nunsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long bytes){\r\n\r\n  /* [allocate and] expose a buffer for data submission.\r\n\r\n     If there is no head fragment\r\n       allocate one and expose it\r\n     else\r\n       if the current head fragment has sufficient unused space\r\n         expose it\r\n       else\r\n         if the current head fragment is unused\r\n           resize and expose it\r\n         else\r\n           allocate new fragment and expose it\r\n  */\r\n\r\n  /* base case; fifo uninitialized */\r\n  if(!oy->fifo_head){\r\n    oy->fifo_head=oy->fifo_tail=ogg_buffer_alloc(oy->bufferpool,bytes);\r\n    return oy->fifo_head->buffer->data;\r\n  }\r\n\r\n  /* space left in current fragment case */\r\n  if(oy->fifo_head->buffer->size-\r\n     oy->fifo_head->length-\r\n     oy->fifo_head->begin >= bytes)\r\n    return oy->fifo_head->buffer->data+\r\n      oy->fifo_head->length+oy->fifo_head->begin;\r\n\r\n  /* current fragment is unused, but too small */\r\n  if(!oy->fifo_head->length){\r\n    ogg_buffer_realloc(oy->fifo_head,bytes);\r\n    return oy->fifo_head->buffer->data+oy->fifo_head->begin;\r\n  }\r\n\r\n  /* current fragment used/full; get new fragment */\r\n  {\r\n    ogg_reference *new=ogg_buffer_alloc(oy->bufferpool,bytes);\r\n    oy->fifo_head->next=new;\r\n    oy->fifo_head=new;\r\n  }\r\n  return oy->fifo_head->buffer->data;\r\n}\r\n\r\nint ogg_sync_wrote(ogg_sync_state *oy, long bytes){\r\n  if(!oy->fifo_head)return OGG_EINVAL;\r\n  if(oy->fifo_head->buffer->size-oy->fifo_head->length-oy->fifo_head->begin <\r\n     bytes)return OGG_EINVAL;\r\n  oy->fifo_head->length+=bytes;\r\n  oy->fifo_fill+=bytes;\r\n  return OGG_SUCCESS;\r\n}\r\n\r\n#ifndef ONLY_C\r\nogg_uint32_t _checksum(ogg_reference *or, int bytes);\r\n#else\r\nstatic ogg_uint32_t _checksum(ogg_reference *or, int bytes){\r\n  ogg_uint32_t crc_reg=0;\r\n  int j,post;\r\n\r\n  while(or){\r\n    unsigned char *data=or->buffer->data+or->begin;\r\n    post=(bytes<or->length?bytes:or->length);\r\n    for(j=0;j<post;++j)\r\n      crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^data[j]];\r\n    bytes-=j;\r\n    or=or->next;\r\n  }\r\n\r\n  return crc_reg;\r\n}\r\n#endif\r\n\r\n/* sync the stream.  This is meant to be useful for finding page\r\n   boundaries.\r\n\r\n   return values for this:\r\n  -n) skipped n bytes\r\n   0) page not ready; more data (no bytes skipped)\r\n   n) page synced at current location; page length n bytes\r\n\r\n*/\r\n\r\nlong ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){\r\n  oggbyte_buffer page;\r\n  long           bytes,ret=0;\r\n\r\n  ogg_page_release(og);\r\n\r\n  bytes=oy->fifo_fill;\r\n  oggbyte_init(&page,oy->fifo_tail);\r\n\r\n  if(oy->headerbytes==0){\r\n    if(bytes<27)goto sync_out; /* not enough for even a minimal header */\r\n\r\n    /* verify capture pattern */\r\n    if(oggbyte_read1(&page,0)!=(int)'O' ||\r\n       oggbyte_read1(&page,1)!=(int)'g' ||\r\n       oggbyte_read1(&page,2)!=(int)'g' ||\r\n       oggbyte_read1(&page,3)!=(int)'S'    ) goto sync_fail;\r\n\r\n    oy->headerbytes=oggbyte_read1(&page,26)+27;\r\n  }\r\n  if(bytes<oy->headerbytes)goto sync_out; /* not enough for header +\r\n                                             seg table */\r\n  if(oy->bodybytes==0){\r\n    int i;\r\n    /* count up body length in the segment table */\r\n    for(i=0;i<oy->headerbytes-27;i++)\r\n      oy->bodybytes+=oggbyte_read1(&page,27+i);\r\n  }\r\n\r\n  if(oy->bodybytes+oy->headerbytes>bytes)goto sync_out;\r\n\r\n  /* we have what appears to be a complete page; last test: verify\r\n     checksum */\r\n  {\r\n    ogg_uint32_t chksum=oggbyte_read4(&page,22);\r\n    oggbyte_set4(&page,0,22);\r\n\r\n    /* Compare checksums; memory continues to be common access */\r\n    if(chksum!=_checksum(oy->fifo_tail,oy->bodybytes+oy->headerbytes)){\r\n\r\n      /* D'oh.  Mismatch! Corrupt page (or miscapture and not a page\r\n         at all). replace the computed checksum with the one actually\r\n         read in; remember all the memory is common access */\r\n\r\n      oggbyte_set4(&page,chksum,22);\r\n      goto sync_fail;\r\n    }\r\n    oggbyte_set4(&page,chksum,22);\r\n  }\r\n\r\n  /* We have a page.  Set up page return. */\r\n  if(og){\r\n    /* set up page output */\r\n    og->header=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->headerbytes);\r\n    og->header_len=oy->headerbytes;\r\n    og->body=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->bodybytes);\r\n    og->body_len=oy->bodybytes;\r\n  }else{\r\n    /* simply advance */\r\n    oy->fifo_tail=\r\n      ogg_buffer_pretruncate(oy->fifo_tail,oy->headerbytes+oy->bodybytes);\r\n    if(!oy->fifo_tail)oy->fifo_head=0;\r\n  }\r\n\r\n  ret=oy->headerbytes+oy->bodybytes;\r\n  oy->unsynced=0;\r\n  oy->headerbytes=0;\r\n  oy->bodybytes=0;\r\n  oy->fifo_fill-=ret;\r\n\r\n  return ret;\r\n\r\n sync_fail:\r\n\r\n  oy->headerbytes=0;\r\n  oy->bodybytes=0;\r\n  oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,1);\r\n  ret--;\r\n\r\n  /* search forward through fragments for possible capture */\r\n  while(oy->fifo_tail){\r\n    /* invariant: fifo_cursor points to a position in fifo_tail */\r\n    unsigned char *now=oy->fifo_tail->buffer->data+oy->fifo_tail->begin;\r\n    unsigned char *next=memchr(now, 'O', oy->fifo_tail->length);\r\n\r\n    if(next){\r\n      /* possible capture in this segment */\r\n      long bytes=next-now;\r\n      oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);\r\n      ret-=bytes;\r\n      break;\r\n    }else{\r\n      /* no capture.  advance to next segment */\r\n      long bytes=oy->fifo_tail->length;\r\n      ret-=bytes;\r\n      oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);\r\n    }\r\n  }\r\n  if(!oy->fifo_tail)oy->fifo_head=0;\r\n  oy->fifo_fill+=ret;\r\n\r\n sync_out:\r\n  return ret;\r\n}\r\n\r\n/* sync the stream and get a page.  Keep trying until we find a page.\r\n   Supress 'sync errors' after reporting the first.\r\n\r\n   return values:\r\n   OGG_HOLE) recapture (hole in data)\r\n          0) need more data\r\n          1) page returned\r\n\r\n   Returns pointers into buffered data; invalidated by next call to\r\n   _stream, _clear, _init, or _buffer */\r\n\r\nint ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){\r\n\r\n  /* all we need to do is verify a page at the head of the stream\r\n     buffer.  If it doesn't verify, we look for the next potential\r\n     frame */\r\n\r\n  while(1){\r\n    long ret=ogg_sync_pageseek(oy,og);\r\n    if(ret>0){\r\n      /* have a page */\r\n      return 1;\r\n    }\r\n    if(ret==0){\r\n      /* need more data */\r\n      return 0;\r\n    }\r\n\r\n    /* head did not start a synced page... skipped some bytes */\r\n    if(!oy->unsynced){\r\n      oy->unsynced=1;\r\n      return OGG_HOLE;\r\n    }\r\n\r\n    /* loop. keep looking */\r\n\r\n  }\r\n}\r\n\r\n/* clear things to an initial state.  Good to call, eg, before seeking */\r\nint ogg_sync_reset(ogg_sync_state *oy){\r\n\r\n  ogg_buffer_release(oy->fifo_tail);\r\n  oy->fifo_tail=0;\r\n  oy->fifo_head=0;\r\n  oy->fifo_fill=0;\r\n\r\n  oy->unsynced=0;\r\n  oy->headerbytes=0;\r\n  oy->bodybytes=0;\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nvoid ogg_stream_init(ogg_stream_state *os, int serialno){\r\n  memset(os, 0, sizeof(*os));\r\n  os->serialno=serialno;\r\n  os->pageno=-1;\r\n}\r\n\r\nogg_stream_state *ogg_stream_create(int serialno){\r\n  ogg_stream_state *os=_ogg_calloc(1,sizeof(*os));\r\n  os->serialno=serialno;\r\n  os->pageno=-1;\r\n  return os;\r\n}\r\n\r\nint ogg_stream_clear(ogg_stream_state *os){\r\n  if(os){\r\n    ogg_buffer_release(os->header_tail);\r\n    ogg_buffer_release(os->body_tail);\r\n    memset(os,0,sizeof(*os));\r\n  }\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nint ogg_stream_destroy(ogg_stream_state *os){\r\n  if(os){\r\n    ogg_buffer_release(os->header_tail);\r\n    ogg_buffer_release(os->body_tail);\r\n    memset(os,0,sizeof(*os));\r\n    _ogg_free(os);\r\n  }\r\n  return OGG_SUCCESS;\r\n}\r\n\r\n\r\n#define FINFLAG 0x80000000UL\r\n#define FINMASK 0x7fffffffUL\r\n\r\nstatic void _next_lace(oggbyte_buffer *ob,ogg_stream_state *os){\r\n  /* search ahead one lace */\r\n  os->body_fill_next=0;\r\n  while(os->laceptr<os->lacing_fill){\r\n    int val=oggbyte_read1(ob,27+os->laceptr++);\r\n    os->body_fill_next+=val;\r\n    if(val<255){\r\n      os->body_fill_next|=FINFLAG;\r\n      os->clearflag=1;\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\nstatic void _span_queued_page(ogg_stream_state *os){\r\n  while( !(os->body_fill&FINFLAG) ){\r\n\r\n    if(!os->header_tail)break;\r\n\r\n    /* first flush out preceeding page header (if any).  Body is\r\n       flushed as it's consumed, so that's not done here. */\r\n\r\n    if(os->lacing_fill>=0)\r\n      os->header_tail=ogg_buffer_pretruncate(os->header_tail,\r\n                                             os->lacing_fill+27);\r\n    os->lacing_fill=0;\r\n    os->laceptr=0;\r\n    os->clearflag=0;\r\n\r\n    if(!os->header_tail){\r\n      os->header_head=0;\r\n      break;\r\n    }else{\r\n\r\n      /* process/prepare next page, if any */\r\n\r\n      long pageno;\r\n      oggbyte_buffer ob;\r\n      ogg_page og;               /* only for parsing header values */\r\n      og.header=os->header_tail; /* only for parsing header values */\r\n      pageno=ogg_page_pageno(&og);\r\n\r\n      oggbyte_init(&ob,os->header_tail);\r\n      os->lacing_fill=oggbyte_read1(&ob,26);\r\n\r\n      /* are we in sequence? */\r\n      if(pageno!=os->pageno){\r\n        if(os->pageno==-1) /* indicates seek or reset */\r\n          os->holeflag=1;  /* set for internal use */\r\n        else\r\n          os->holeflag=2;  /* set for external reporting */\r\n\r\n        os->body_tail=ogg_buffer_pretruncate(os->body_tail,\r\n                                             os->body_fill);\r\n        if(os->body_tail==0)os->body_head=0;\r\n        os->body_fill=0;\r\n\r\n      }\r\n\r\n      if(ogg_page_continued(&og)){\r\n        if(os->body_fill==0){\r\n          /* continued packet, but no preceeding data to continue */\r\n          /* dump the first partial packet on the page */\r\n          _next_lace(&ob,os);\r\n          os->body_tail=\r\n            ogg_buffer_pretruncate(os->body_tail,os->body_fill_next&FINMASK);\r\n          if(os->body_tail==0)os->body_head=0;\r\n          /* set span flag */\r\n          if(!os->spanflag && !os->holeflag)os->spanflag=2;\r\n        }\r\n      }else{\r\n        if(os->body_fill>0){\r\n          /* preceeding data to continue, but not a continued page */\r\n          /* dump body_fill */\r\n          os->body_tail=ogg_buffer_pretruncate(os->body_tail,\r\n                                               os->body_fill);\r\n          if(os->body_tail==0)os->body_head=0;\r\n          os->body_fill=0;\r\n\r\n          /* set espan flag */\r\n          if(!os->spanflag && !os->holeflag)os->spanflag=2;\r\n        }\r\n      }\r\n\r\n      if(os->laceptr<os->lacing_fill){\r\n        os->granulepos=ogg_page_granulepos(&og);\r\n\r\n        /* get current packet size & flag */\r\n        _next_lace(&ob,os);\r\n        os->body_fill+=os->body_fill_next; /* addition handles the flag fine;\r\n                                             unsigned on purpose */\r\n        /* ...and next packet size & flag */\r\n        _next_lace(&ob,os);\r\n\r\n      }\r\n\r\n      os->pageno=pageno+1;\r\n      os->e_o_s=ogg_page_eos(&og);\r\n      os->b_o_s=ogg_page_bos(&og);\r\n\r\n    }\r\n  }\r\n}\r\n\r\n/* add the incoming page to the stream state; we decompose the page\r\n   into packet segments here as well. */\r\n\r\nint ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){\r\n\r\n  int serialno=ogg_page_serialno(og);\r\n  int version=ogg_page_version(og);\r\n\r\n  /* check the serial number */\r\n  if(serialno!=os->serialno){\r\n    //ogg_page_release(og);\r\n    return OGG_ESERIAL;\r\n  }\r\n  if(version>0){\r\n    //ogg_page_release(og);\r\n    return OGG_EVERSION;\r\n  }\r\n\r\n  /* add to fifos */\r\n  if(!os->body_tail){\r\n    os->body_tail=og->body;\r\n    os->body_head=ogg_buffer_walk(og->body);\r\n  }else{\r\n    os->body_head=ogg_buffer_cat(os->body_head,og->body);\r\n  }\r\n  if(!os->header_tail){\r\n    os->header_tail=og->header;\r\n    os->header_head=ogg_buffer_walk(og->header);\r\n    os->lacing_fill=-27;\r\n  }else{\r\n    os->header_head=ogg_buffer_cat(os->header_head,og->header);\r\n  }\r\n\r\n  memset(og,0,sizeof(*og));\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nint ogg_stream_reset(ogg_stream_state *os){\r\n\r\n  ogg_buffer_release(os->header_tail);\r\n  ogg_buffer_release(os->body_tail);\r\n  os->header_tail=os->header_head=0;\r\n  os->body_tail=os->body_head=0;\r\n\r\n  os->e_o_s=0;\r\n  os->b_o_s=0;\r\n  os->pageno=-1;\r\n  os->packetno=0;\r\n  os->granulepos=0;\r\n\r\n  os->body_fill=0;\r\n  os->lacing_fill=0;\r\n\r\n  os->holeflag=0;\r\n  os->spanflag=0;\r\n  os->clearflag=0;\r\n  os->laceptr=0;\r\n  os->body_fill_next=0;\r\n\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nint ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){\r\n  ogg_stream_reset(os);\r\n  os->serialno=serialno;\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nstatic int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){\r\n\r\n  ogg_packet_release(op);\r\n  _span_queued_page(os);\r\n\r\n  if(os->holeflag){\r\n    int temp=os->holeflag;\r\n    if(os->clearflag)\r\n      os->holeflag=0;\r\n    else\r\n      os->holeflag=1;\r\n    if(temp==2){\r\n      os->packetno++;\r\n      return OGG_HOLE;\r\n    }\r\n  }\r\n  if(os->spanflag){\r\n    int temp=os->spanflag;\r\n    if(os->clearflag)\r\n      os->spanflag=0;\r\n    else\r\n      os->spanflag=1;\r\n    if(temp==2){\r\n      os->packetno++;\r\n      return OGG_SPAN;\r\n    }\r\n  }\r\n\r\n  if(!(os->body_fill&FINFLAG)) return 0;\r\n  if(!op && !adv)return 1; /* just using peek as an inexpensive way\r\n                               to ask if there's a whole packet\r\n                               waiting */\r\n  if(op){\r\n    op->b_o_s=os->b_o_s;\r\n    if(os->e_o_s && os->body_fill_next==0)\r\n      op->e_o_s=os->e_o_s;\r\n    else\r\n      op->e_o_s=0;\r\n    if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )\r\n      op->granulepos=os->granulepos;\r\n    else\r\n      op->granulepos=-1;\r\n    op->packetno=os->packetno;\r\n  }\r\n\r\n  if(adv){\r\n    oggbyte_buffer ob;\r\n    oggbyte_init(&ob,os->header_tail);\r\n\r\n    /* split the body contents off */\r\n    if(op){\r\n      op->packet=ogg_buffer_split(&os->body_tail,&os->body_head,\r\n\t\t\t\t  os->body_fill&FINMASK);\r\n      op->bytes=os->body_fill&FINMASK;\r\n    }else{\r\n      os->body_tail=ogg_buffer_pretruncate(os->body_tail,\r\n\t\t\t\t\t   os->body_fill&FINMASK);\r\n      if(os->body_tail==0)os->body_head=0;\r\n    }\r\n\r\n    /* update lacing pointers */\r\n    os->body_fill=os->body_fill_next;\r\n    _next_lace(&ob,os);\r\n  }else{\r\n    if(op){\r\n      op->packet=ogg_buffer_sub(os->body_tail,os->body_fill&FINMASK);\r\n      op->bytes=os->body_fill&FINMASK;\r\n    }\r\n  }\r\n\r\n  if(adv){\r\n    os->packetno++;\r\n    os->b_o_s=0;\r\n  }\r\n\r\n  return 1;\r\n}\r\n\r\nint ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){\r\n  return _packetout(os,op,1);\r\n}\r\n\r\nint ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){\r\n  return _packetout(os,op,0);\r\n}\r\n\r\nint ogg_packet_release(ogg_packet *op) {\r\n  if(op){\r\n    ogg_buffer_release(op->packet);\r\n    memset(op, 0, sizeof(*op));\r\n  }\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nint ogg_page_release(ogg_page *og) {\r\n  if(og){\r\n    ogg_buffer_release(og->header);\r\n    ogg_buffer_release(og->body);\r\n    memset(og, 0, sizeof(*og));\r\n  }\r\n  return OGG_SUCCESS;\r\n}\r\n\r\nvoid ogg_page_dup(ogg_page *dup,ogg_page *orig){\r\n  dup->header_len=orig->header_len;\r\n  dup->body_len=orig->body_len;\r\n  dup->header=ogg_buffer_dup(orig->header);\r\n  dup->body=ogg_buffer_dup(orig->body);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/ivorbiscodec.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: libvorbis codec headers\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _vorbis_codec_h_\r\n#define _vorbis_codec_h_\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif /* __cplusplus */\r\n\r\n#include \"ogg.h\"\r\n\r\nstruct vorbis_dsp_state;\r\ntypedef struct vorbis_dsp_state vorbis_dsp_state;\r\n\r\ntypedef struct vorbis_info{\r\n  int version;\r\n  int channels;\r\n  long rate;\r\n\r\n  /* The below bitrate declarations are *hints*.\r\n     Combinations of the three values carry the following implications:\r\n\r\n     all three set to the same value:\r\n       implies a fixed rate bitstream\r\n     only nominal set:\r\n       implies a VBR stream that averages the nominal bitrate.  No hard\r\n       upper/lower limit\r\n     upper and or lower set:\r\n       implies a VBR bitstream that obeys the bitrate limits. nominal\r\n       may also be set to give a nominal rate.\r\n     none set:\r\n       the coder does not care to speculate.\r\n  */\r\n\r\n  long bitrate_upper;\r\n  long bitrate_nominal;\r\n  long bitrate_lower;\r\n  long bitrate_window;\r\n\r\n  void *codec_setup;\r\n} vorbis_info;\r\n\r\ntypedef struct vorbis_comment{\r\n  char **user_comments;\r\n  int   *comment_lengths;\r\n  int    comments;\r\n  char  *vendor;\r\n\r\n} vorbis_comment;\r\n\r\n\r\n/* Vorbis PRIMITIVES: general ***************************************/\r\n\r\nextern void     vorbis_info_init(vorbis_info *vi);\r\nextern void     vorbis_info_clear(vorbis_info *vi);\r\nextern int      vorbis_info_blocksize(vorbis_info *vi,int zo);\r\nextern void     vorbis_comment_init(vorbis_comment *vc);\r\nextern void     vorbis_comment_add(vorbis_comment *vc, char *comment);\r\nextern void     vorbis_comment_add_tag(vorbis_comment *vc,\r\n\t\t\t\t       char *tag, char *contents);\r\nextern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);\r\nextern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);\r\nextern void     vorbis_comment_clear(vorbis_comment *vc);\r\n\r\n/* Vorbis ERRORS and return codes ***********************************/\r\n\r\n#define OV_FALSE      -1\r\n#define OV_EOF        -2\r\n#define OV_HOLE       -3\r\n\r\n#define OV_EREAD      -128\r\n#define OV_EFAULT     -129\r\n#define OV_EIMPL      -130\r\n#define OV_EINVAL     -131\r\n#define OV_ENOTVORBIS -132\r\n#define OV_EBADHEADER -133\r\n#define OV_EVERSION   -134\r\n#define OV_ENOTAUDIO  -135\r\n#define OV_EBADPACKET -136\r\n#define OV_EBADLINK   -137\r\n#define OV_ENOSEEK    -138\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif /* __cplusplus */\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/ivorbisfile.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: stdio-based convenience library for opening/seeking/decoding\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _OV_FILE_H_\r\n#define _OV_FILE_H_\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif /* __cplusplus */\r\n\r\n#include <stdio.h>\r\n#include \"ivorbiscodec.h\"\r\n\r\n/* The function prototypes for the callbacks are basically the same as for\r\n * the stdio functions fread, fseek, fclose, ftell. \r\n * The one difference is that the FILE * arguments have been replaced with\r\n * a void * - this is to be used as a pointer to whatever internal data these\r\n * functions might need. In the stdio case, it's just a FILE * cast to a void *\r\n * \r\n * If you use other functions, check the docs for these functions and return\r\n * the right values. For seek_func(), you *MUST* return -1 if the stream is\r\n * unseekable\r\n */\r\ntypedef struct {\r\n  size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);\r\n  int    (*seek_func)  (void *datasource, ogg_int64_t offset, int whence);\r\n  int    (*close_func) (void *datasource);\r\n  long   (*tell_func)  (void *datasource);\r\n} ov_callbacks;\r\n\r\ntypedef struct OggVorbis_File {\r\n  void            *datasource; /* Pointer to a FILE *, etc. */\r\n  int              seekable;\r\n  ogg_int64_t      offset;\r\n  ogg_int64_t      end;\r\n  ogg_sync_state   *oy; \r\n\r\n  /* If the FILE handle isn't seekable (eg, a pipe), only the current\r\n     stream appears */\r\n  int              links;\r\n  ogg_int64_t     *offsets;\r\n  ogg_int64_t     *dataoffsets;\r\n  ogg_uint32_t    *serialnos;\r\n  ogg_int64_t     *pcmlengths;\r\n  vorbis_info     vi;\r\n  vorbis_comment  vc;\r\n\r\n  /* Decoding working state local storage */\r\n  ogg_int64_t      pcm_offset;\r\n  int              ready_state;\r\n  ogg_uint32_t     current_serialno;\r\n  int              current_link;\r\n\r\n  ogg_int64_t      bittrack;\r\n  ogg_int64_t      samptrack;\r\n\r\n  ogg_stream_state *os; /* take physical pages, weld into a logical\r\n                          stream of packets */\r\n  vorbis_dsp_state *vd; /* central working state for the packet->PCM decoder */\r\n\r\n  ov_callbacks callbacks;\r\n\r\n} OggVorbis_File;\r\n\r\nextern int ov_clear(OggVorbis_File *vf);\r\nextern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);\r\nextern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,\r\n\t\tchar *initial, long ibytes, ov_callbacks callbacks);\r\n\r\nextern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);\r\nextern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,\r\n\t\tchar *initial, long ibytes, ov_callbacks callbacks);\r\nextern int ov_test_open(OggVorbis_File *vf);\r\n\r\nextern long ov_bitrate(OggVorbis_File *vf,int i);\r\nextern long ov_bitrate_instant(OggVorbis_File *vf);\r\nextern long ov_streams(OggVorbis_File *vf);\r\nextern long ov_seekable(OggVorbis_File *vf);\r\nextern long ov_serialnumber(OggVorbis_File *vf,int i);\r\n\r\nextern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);\r\nextern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);\r\nextern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);\r\n\r\nextern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);\r\nextern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);\r\nextern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);\r\nextern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);\r\nextern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);\r\n\r\nextern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);\r\nextern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);\r\nextern ogg_int64_t ov_time_tell(OggVorbis_File *vf);\r\n\r\nextern vorbis_info *ov_info(OggVorbis_File *vf,int link);\r\nextern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);\r\n\r\nextern long ov_read(OggVorbis_File *vf,void *buffer,int length,\r\n\t\t    int *bitstream);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif /* __cplusplus */\r\n\r\n#endif\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/lsp_lookup.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n  function: lookup data\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _V_LOOKUP_DATA_H_\r\n#define _V_LOOKUP_DATA_H_\r\n\r\n#include \"os_types.h\"\r\n\r\n#define INVSQ_LOOKUP_I_SHIFT 10\r\n#define INVSQ_LOOKUP_I_MASK 1023\r\nstatic const long INVSQ_LOOKUP_I[64+1]={\r\n\t   92682,   91966,   91267,   90583,\r\n\t   89915,   89261,   88621,   87995,\r\n\t   87381,   86781,   86192,   85616,\r\n\t   85051,   84497,   83953,   83420,\r\n\t   82897,   82384,   81880,   81385,\r\n\t   80899,   80422,   79953,   79492,\r\n\t   79039,   78594,   78156,   77726,\r\n\t   77302,   76885,   76475,   76072,\r\n\t   75674,   75283,   74898,   74519,\r\n\t   74146,   73778,   73415,   73058,\r\n\t   72706,   72359,   72016,   71679,\r\n\t   71347,   71019,   70695,   70376,\r\n\t   70061,   69750,   69444,   69141,\r\n\t   68842,   68548,   68256,   67969,\r\n\t   67685,   67405,   67128,   66855,\r\n\t   66585,   66318,   66054,   65794,\r\n\t   65536,\r\n};\r\n\r\nstatic const long INVSQ_LOOKUP_IDel[64]={\r\n             716,     699,     684,     668,\r\n             654,     640,     626,     614,\r\n             600,     589,     576,     565,\r\n             554,     544,     533,     523,\r\n             513,     504,     495,     486,\r\n             477,     469,     461,     453,\r\n             445,     438,     430,     424,\r\n             417,     410,     403,     398,\r\n             391,     385,     379,     373,\r\n             368,     363,     357,     352,\r\n             347,     343,     337,     332,\r\n             328,     324,     319,     315,\r\n             311,     306,     303,     299,\r\n             294,     292,     287,     284,\r\n             280,     277,     273,     270,\r\n             267,     264,     260,     258,\r\n};\r\n\r\n#define COS_LOOKUP_I_SHIFT 9\r\n#define COS_LOOKUP_I_MASK 511\r\n#define COS_LOOKUP_I_SZ 128\r\nstatic const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={\r\n\t   16384,   16379,   16364,   16340,\r\n\t   16305,   16261,   16207,   16143,\r\n\t   16069,   15986,   15893,   15791,\r\n\t   15679,   15557,   15426,   15286,\r\n\t   15137,   14978,   14811,   14635,\r\n\t   14449,   14256,   14053,   13842,\r\n\t   13623,   13395,   13160,   12916,\r\n\t   12665,   12406,   12140,   11866,\r\n\t   11585,   11297,   11003,   10702,\r\n\t   10394,   10080,    9760,    9434,\r\n\t    9102,    8765,    8423,    8076,\r\n\t    7723,    7366,    7005,    6639,\r\n\t    6270,    5897,    5520,    5139,\r\n\t    4756,    4370,    3981,    3590,\r\n\t    3196,    2801,    2404,    2006,\r\n\t    1606,    1205,     804,     402,\r\n\t       0,    -401,    -803,   -1204,\r\n\t   -1605,   -2005,   -2403,   -2800,\r\n\t   -3195,   -3589,   -3980,   -4369,\r\n\t   -4755,   -5138,   -5519,   -5896,\r\n\t   -6269,   -6638,   -7004,   -7365,\r\n\t   -7722,   -8075,   -8422,   -8764,\r\n\t   -9101,   -9433,   -9759,  -10079,\r\n\t  -10393,  -10701,  -11002,  -11296,\r\n\t  -11584,  -11865,  -12139,  -12405,\r\n\t  -12664,  -12915,  -13159,  -13394,\r\n\t  -13622,  -13841,  -14052,  -14255,\r\n\t  -14448,  -14634,  -14810,  -14977,\r\n\t  -15136,  -15285,  -15425,  -15556,\r\n\t  -15678,  -15790,  -15892,  -15985,\r\n\t  -16068,  -16142,  -16206,  -16260,\r\n\t  -16304,  -16339,  -16363,  -16378,\r\n\t  -16383,\r\n};\r\n\r\n#endif\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/mapping0.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: channel mapping 0 implementation\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n#include <string.h>\r\n#include <math.h>\r\n#include \"ogg.h\"\r\n#include \"os.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"mdct.h\"\r\n#include \"codec_internal.h\"\r\n#include \"codebook.h\"\r\n#include \"misc.h\"\r\n\r\nvoid mapping_clear_info(vorbis_info_mapping *info){\r\n  if(info){\r\n    if(info->chmuxlist)_ogg_free(info->chmuxlist);\r\n    if(info->submaplist)_ogg_free(info->submaplist);\r\n    if(info->coupling)_ogg_free(info->coupling);\r\n    memset(info,0,sizeof(*info));\r\n  }\r\n}\r\n\r\nstatic int ilog(unsigned int v){\r\n  int ret=0;\r\n  if(v)--v;\r\n  while(v){\r\n    ret++;\r\n    v>>=1;\r\n  }\r\n  return(ret);\r\n}\r\n\r\n/* also responsible for range checking */\r\nint mapping_info_unpack(vorbis_info_mapping *info,vorbis_info *vi,\r\n\t\t\toggpack_buffer *opb){\r\n  int i;\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  memset(info,0,sizeof(*info));\r\n\r\n  if(oggpack_read(opb,1))\r\n    info->submaps=oggpack_read(opb,4)+1;\r\n  else\r\n    info->submaps=1;\r\n\r\n  if(oggpack_read(opb,1)){\r\n    info->coupling_steps=oggpack_read(opb,8)+1;\r\n    info->coupling=\r\n      _ogg_malloc(info->coupling_steps*sizeof(*info->coupling));\r\n    \r\n    for(i=0;i<info->coupling_steps;i++){\r\n      int testM=info->coupling[i].mag=(unsigned char)(oggpack_read(opb,ilog(vi->channels)));\r\n      int testA=info->coupling[i].ang=(unsigned char)(oggpack_read(opb,ilog(vi->channels)));\r\n\r\n      if(testM<0 || \r\n\t testA<0 || \r\n\t testM==testA || \r\n\t testM>=vi->channels ||\r\n\t testA>=vi->channels) goto err_out;\r\n    }\r\n\r\n  }\r\n\r\n  if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */\r\n    \r\n  if(info->submaps>1){\r\n    info->chmuxlist=_ogg_malloc(sizeof(*info->chmuxlist)*vi->channels);\r\n    for(i=0;i<vi->channels;i++){\r\n      info->chmuxlist[i]=(unsigned char)(oggpack_read(opb,4));\r\n      if(info->chmuxlist[i]>=info->submaps)goto err_out;\r\n    }\r\n  }\r\n\r\n  info->submaplist=_ogg_malloc(sizeof(*info->submaplist)*info->submaps);\r\n  for(i=0;i<info->submaps;i++){\r\n    int temp=oggpack_read(opb,8);\r\n    info->submaplist[i].floor=(char)oggpack_read(opb,8);\r\n    if(info->submaplist[i].floor>=ci->floors)goto err_out;\r\n    info->submaplist[i].residue=(char)oggpack_read(opb,8);\r\n    if(info->submaplist[i].residue>=ci->residues)goto err_out;\r\n  }\r\n\r\n  return 0;\r\n\r\n err_out:\r\n  mapping_clear_info(info);\r\n  return -1;\r\n}\r\n\r\nint mapping_inverse(vorbis_dsp_state *vd,vorbis_info_mapping *info){\r\n  vorbis_info          *vi=vd->vi;\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n\r\n  int                   i,j;\r\n  long                  n=ci->blocksizes[vd->W];\r\n\r\n  ogg_int32_t **pcmbundle=\r\n    alloca(sizeof(*pcmbundle)*vi->channels);\r\n  int          *zerobundle=\r\n    alloca(sizeof(*zerobundle)*vi->channels);\r\n  int          *nonzero=\r\n    alloca(sizeof(*nonzero)*vi->channels);\r\n  ogg_int32_t **floormemo=\r\n    alloca(sizeof(*floormemo)*vi->channels);\r\n  \r\n  /* recover the spectral envelope; store it in the PCM vector for now */\r\n  for(i=0;i<vi->channels;i++){\r\n    int submap=0;\r\n    int floorno;\r\n    \r\n    if(info->submaps>1)\r\n      submap=info->chmuxlist[i];\r\n    floorno=info->submaplist[submap].floor;\r\n    \r\n    if(ci->floor_type[floorno]){\r\n      /* floor 1 */\r\n      floormemo[i]=alloca(sizeof(*floormemo[i])*\r\n\t\t\t  floor1_memosize(ci->floor_param[floorno]));\r\n      floormemo[i]=floor1_inverse1(vd,ci->floor_param[floorno],floormemo[i]);\r\n    }else{\r\n      /* floor 0 */\r\n      floormemo[i]=alloca(sizeof(*floormemo[i])*\r\n\t\t\t  floor0_memosize(ci->floor_param[floorno]));\r\n      floormemo[i]=floor0_inverse1(vd,ci->floor_param[floorno],floormemo[i]);\r\n    }\r\n    \r\n    if(floormemo[i])\r\n      nonzero[i]=1;\r\n    else\r\n      nonzero[i]=0;      \r\n    memset(vd->work[i],0,sizeof(*vd->work[i])*n/2);\r\n  }\r\n\r\n  /* channel coupling can 'dirty' the nonzero listing */\r\n  for(i=0;i<info->coupling_steps;i++){\r\n    if(nonzero[info->coupling[i].mag] ||\r\n       nonzero[info->coupling[i].ang]){\r\n      nonzero[info->coupling[i].mag]=1; \r\n      nonzero[info->coupling[i].ang]=1; \r\n    }\r\n  }\r\n\r\n  /* recover the residue into our working vectors */\r\n  for(i=0;i<info->submaps;i++){\r\n    int ch_in_bundle=0;\r\n    for(j=0;j<vi->channels;j++){\r\n      if(!info->chmuxlist || info->chmuxlist[j]==i){\r\n\tif(nonzero[j])\r\n\t  zerobundle[ch_in_bundle]=1;\r\n\telse\r\n\t  zerobundle[ch_in_bundle]=0;\r\n\tpcmbundle[ch_in_bundle++]=vd->work[j];\r\n      }\r\n    }\r\n    \r\n    res_inverse(vd,ci->residue_param+info->submaplist[i].residue,\r\n\t\tpcmbundle,zerobundle,ch_in_bundle);\r\n  }\r\n\r\n  //for(j=0;j<vi->channels;j++)\r\n  //_analysis_output(\"coupled\",seq+j,vb->pcm[j],-8,n/2,0,0);\r\n\r\n  /* channel coupling */\r\n  for(i=info->coupling_steps-1;i>=0;i--){\r\n    ogg_int32_t *pcmM=vd->work[info->coupling[i].mag];\r\n    ogg_int32_t *pcmA=vd->work[info->coupling[i].ang];\r\n    \r\n    for(j=0;j<n/2;j++){\r\n      ogg_int32_t mag=pcmM[j];\r\n      ogg_int32_t ang=pcmA[j];\r\n      \r\n      if(mag>0)\r\n\tif(ang>0){\r\n\t  pcmM[j]=mag;\r\n\t  pcmA[j]=mag-ang;\r\n\t}else{\r\n\t  pcmA[j]=mag;\r\n\t  pcmM[j]=mag+ang;\r\n\t}\r\n      else\r\n\tif(ang>0){\r\n\t  pcmM[j]=mag;\r\n\t  pcmA[j]=mag+ang;\r\n\t}else{\r\n\t  pcmA[j]=mag;\r\n\t  pcmM[j]=mag-ang;\r\n\t}\r\n    }\r\n  }\r\n\r\n  //for(j=0;j<vi->channels;j++)\r\n  //_analysis_output(\"residue\",seq+j,vb->pcm[j],-8,n/2,0,0);\r\n\r\n  /* compute and apply spectral envelope */\r\n  for(i=0;i<vi->channels;i++){\r\n    ogg_int32_t *pcm=vd->work[i];\r\n    int submap=0;\r\n    int floorno;\r\n\r\n    if(info->submaps>1)\r\n      submap=info->chmuxlist[i];\r\n    floorno=info->submaplist[submap].floor;\r\n\r\n    if(ci->floor_type[floorno]){\r\n      /* floor 1 */\r\n      floor1_inverse2(vd,ci->floor_param[floorno],floormemo[i],pcm);\r\n    }else{\r\n      /* floor 0 */\r\n      floor0_inverse2(vd,ci->floor_param[floorno],floormemo[i],pcm);\r\n    }\r\n  }\r\n\r\n  //for(j=0;j<vi->channels;j++)\r\n  //_analysis_output(\"mdct\",seq+j,vb->pcm[j],-24,n/2,0,1);\r\n\r\n  /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */\r\n  /* only MDCT right now.... */\r\n  for(i=0;i<vi->channels;i++)\r\n    mdct_backward(n,vd->work[i]);\r\n\r\n  //for(j=0;j<vi->channels;j++)\r\n  //_analysis_output(\"imdct\",seq+j,vb->pcm[j],-24,n,0,0);\r\n\r\n  /* all done! */\r\n  return(0);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/mdct.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: normalized modified discrete cosine transform\r\n           power of two length transform only [64 <= n ]\r\n last mod: $Id: mdct.c,v 1.9.6.5 2003/04/29 04:03:27 xiphmont Exp $\r\n\r\n Original algorithm adapted long ago from _The use of multirate filter\r\n banks for coding of high quality digital audio_, by T. Sporer,\r\n K. Brandenburg and B. Edler, collection of the European Signal\r\n Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp\r\n 211-214\r\n\r\n The below code implements an algorithm that no longer looks much like\r\n that presented in the paper, but the basic structure remains if you\r\n dig deep enough to see it.\r\n\r\n This module DOES NOT INCLUDE code to generate/apply the window\r\n function.  Everybody has their own weird favorite including me... I\r\n happen to like the properties of y=sin(.5PI*sin^2(x)), but others may\r\n vehemently disagree.\r\n\r\n ************************************************************************/\r\n\r\n#include \"ivorbiscodec.h\"\r\n#include \"os.h\"\r\n#include \"misc.h\"\r\n#include \"mdct.h\"\r\n#include \"mdct_lookup.h\"\r\n\r\n#include <stdio.h>\r\n\r\n#if defined(ONLY_C)\r\nSTIN void presymmetry(DATA_TYPE *in,int n2,int step){\r\n  DATA_TYPE *aX;\r\n  DATA_TYPE *bX;\r\n  LOOKUP_T *T;\r\n  int n4=n2>>1;\r\n\r\n  aX            = in+n2-3;\r\n  T             = sincos_lookup0;\r\n\r\n  do{\r\n    REG_TYPE  s0= aX[0];\r\n    REG_TYPE  s2= aX[2];\r\n    XPROD31( s0, s2, T[0], T[1], &aX[0], &aX[2] ); T+=step;\r\n    aX-=4;\r\n  }while(aX>=in+n4);\r\n  do{\r\n    REG_TYPE  s0= aX[0];\r\n    REG_TYPE  s2= aX[2];\r\n    XPROD31( s0, s2, T[1], T[0], &aX[0], &aX[2] ); T-=step;\r\n    aX-=4;\r\n  }while(aX>=in);\r\n\r\n  aX            = in+n2-4;\r\n  bX            = in;\r\n  T             = sincos_lookup0;\r\n  do{\r\n    REG_TYPE  ri0= aX[0];\r\n    REG_TYPE  ri2= aX[2];\r\n    REG_TYPE  ro0= bX[0];\r\n    REG_TYPE  ro2= bX[2];\r\n\r\n    XNPROD31( ro2, ro0, T[1], T[0], &aX[0], &aX[2] ); T+=step;\r\n    XNPROD31( ri2, ri0, T[0], T[1], &bX[0], &bX[2] );\r\n\r\n    aX-=4;\r\n    bX+=4;\r\n  }while(aX>=bX);\r\n}\r\n\r\n/* 8 point butterfly (in place) */\r\nSTIN void mdct_butterfly_8(DATA_TYPE *x){\r\n\r\n  REG_TYPE s0   = x[0] + x[1];\r\n  REG_TYPE s1   = x[0] - x[1];\r\n  REG_TYPE s2   = x[2] + x[3];\r\n  REG_TYPE s3   = x[2] - x[3];\r\n  REG_TYPE s4   = x[4] + x[5];\r\n  REG_TYPE s5   = x[4] - x[5];\r\n  REG_TYPE s6   = x[6] + x[7];\r\n  REG_TYPE s7   = x[6] - x[7];\r\n\r\n\t   x[0] = s5   + s3;\r\n\t   x[1] = s7   - s1;\r\n\t   x[2] = s5   - s3;\r\n\t   x[3] = s7   + s1;\r\n           x[4] = s4   - s0;\r\n\t   x[5] = s6   - s2;\r\n           x[6] = s4   + s0;\r\n\t   x[7] = s6   + s2;\r\n\t   MB();\r\n}\r\n\r\n/* 16 point butterfly (in place, 4 register) */\r\nSTIN void mdct_butterfly_16(DATA_TYPE *x){\r\n\r\n  REG_TYPE s0, s1, s2, s3;\r\n\r\n\t   s0 = x[ 8] - x[ 9]; x[ 8] += x[ 9];\r\n\t   s1 = x[10] - x[11]; x[10] += x[11];\r\n\t   s2 = x[ 1] - x[ 0]; x[ 9]  = x[ 1] + x[0];\r\n\t   s3 = x[ 3] - x[ 2]; x[11]  = x[ 3] + x[2];\r\n\t   x[ 0] = MULT31((s0 - s1) , cPI2_8);\r\n\t   x[ 1] = MULT31((s2 + s3) , cPI2_8);\r\n\t   x[ 2] = MULT31((s0 + s1) , cPI2_8);\r\n\t   x[ 3] = MULT31((s3 - s2) , cPI2_8);\r\n\t   MB();\r\n\r\n\t   s2 = x[12] - x[13]; x[12] += x[13];\r\n\t   s3 = x[14] - x[15]; x[14] += x[15];\r\n\t   s0 = x[ 4] - x[ 5]; x[13]  = x[ 5] + x[ 4];\r\n\t   s1 = x[ 7] - x[ 6]; x[15]  = x[ 7] + x[ 6];\r\n\t   x[ 4] = s2; x[ 5] = s1;\r\n\t   x[ 6] = s3; x[ 7] = s0;\r\n\t   MB();\r\n\r\n\t   mdct_butterfly_8(x);\r\n\t   mdct_butterfly_8(x+8);\r\n}\r\n\r\n/* 32 point butterfly (in place, 4 register) */\r\nSTIN void mdct_butterfly_32(DATA_TYPE *x){\r\n\r\n  REG_TYPE s0, s1, s2, s3;\r\n\r\n\t   s0 = x[16] - x[17]; x[16] += x[17];\r\n\t   s1 = x[18] - x[19]; x[18] += x[19];\r\n\t   s2 = x[ 1] - x[ 0]; x[17]  = x[ 1] + x[ 0];\r\n\t   s3 = x[ 3] - x[ 2]; x[19]  = x[ 3] + x[ 2];\r\n\t   XNPROD31( s0, s1, cPI3_8, cPI1_8, &x[ 0], &x[ 2] );\r\n\t   XPROD31 ( s2, s3, cPI1_8, cPI3_8, &x[ 1], &x[ 3] );\r\n\t   MB();\r\n\r\n\t   s0 = x[20] - x[21]; x[20] += x[21];\r\n\t   s1 = x[22] - x[23]; x[22] += x[23];\r\n\t   s2 = x[ 5] - x[ 4]; x[21]  = x[ 5] + x[ 4];\r\n\t   s3 = x[ 7] - x[ 6]; x[23]  = x[ 7] + x[ 6];\r\n\t   x[ 4] = MULT31((s0 - s1) , cPI2_8);\r\n\t   x[ 5] = MULT31((s3 + s2) , cPI2_8);\r\n\t   x[ 6] = MULT31((s0 + s1) , cPI2_8);\r\n\t   x[ 7] = MULT31((s3 - s2) , cPI2_8);\r\n\t   MB();\r\n\r\n\t   s0 = x[24] - x[25]; x[24] += x[25];\r\n\t   s1 = x[26] - x[27]; x[26] += x[27];\r\n\t   s2 = x[ 9] - x[ 8]; x[25]  = x[ 9] + x[ 8];\r\n\t   s3 = x[11] - x[10]; x[27]  = x[11] + x[10];\r\n\t   XNPROD31( s0, s1, cPI1_8, cPI3_8, &x[ 8], &x[10] );\r\n\t   XPROD31 ( s2, s3, cPI3_8, cPI1_8, &x[ 9], &x[11] );\r\n\t   MB();\r\n\r\n\t   s0 = x[28] - x[29]; x[28] += x[29];\r\n\t   s1 = x[30] - x[31]; x[30] += x[31];\r\n\t   s2 = x[12] - x[13]; x[29]  = x[13] + x[12];\r\n\t   s3 = x[15] - x[14]; x[31]  = x[15] + x[14];\r\n\t   x[12] = s0; x[13] = s3;\r\n\t   x[14] = s1; x[15] = s2;\r\n\t   MB();\r\n\r\n\t   mdct_butterfly_16(x);\r\n\t   mdct_butterfly_16(x+16);\r\n}\r\n\r\n/* N/stage point generic N stage butterfly (in place, 2 register) */\r\nSTIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){\r\n  LOOKUP_T   *T  = sincos_lookup0;\r\n  DATA_TYPE *x1  = x + points - 4;\r\n  DATA_TYPE *x2  = x + (points>>1) - 4;\r\n  REG_TYPE   s0, s1, s2, s3;\r\n\r\n  do{\r\n    s0 = x1[0] - x1[1]; x1[0] += x1[1];\r\n    s1 = x1[3] - x1[2]; x1[2] += x1[3];\r\n    s2 = x2[1] - x2[0]; x1[1]  = x2[1] + x2[0];\r\n    s3 = x2[3] - x2[2]; x1[3]  = x2[3] + x2[2];\r\n    XPROD31( s1, s0, T[0], T[1], &x2[0], &x2[2] );\r\n    XPROD31( s2, s3, T[0], T[1], &x2[1], &x2[3] ); T+=step;\r\n    x1-=4;\r\n    x2-=4;\r\n  }while(T<sincos_lookup0+1024);\r\n  x1 = x + (points>>1) + (points>>2) - 4;\r\n  x2 = x +               (points>>2) - 4;\r\n  T = sincos_lookup0+1024;\r\n  do{\r\n    s0 = x1[0] - x1[1]; x1[0] += x1[1];\r\n    s1 = x1[2] - x1[3]; x1[2] += x1[3];\r\n    s2 = x2[0] - x2[1]; x1[1]  = x2[1] + x2[0];\r\n    s3 = x2[3] - x2[2]; x1[3]  = x2[3] + x2[2];\r\n    XNPROD31( s0, s1, T[0], T[1], &x2[0], &x2[2] );\r\n    XNPROD31( s3, s2, T[0], T[1], &x2[1], &x2[3] ); T-=step;\r\n    x1-=4;\r\n    x2-=4;\r\n  }while(T>sincos_lookup0);\r\n}\r\n\r\nSTIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){\r\n\r\n  int stages=7-shift;\r\n  int i,j;\r\n\r\n  for(i=0;--stages>=0;i++){\r\n    for(j=0;j<(1<<i);j++)\r\n    {\r\n        mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift));\r\n    }\r\n  }\r\n\r\n  for(j=0;j<points;j+=32)\r\n    mdct_butterfly_32(x+j);\r\n}\r\n\r\nstatic unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};\r\n\r\nSTIN int bitrev12(int x){\r\n  return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);\r\n}\r\n\r\nSTIN void mdct_bitreverse(DATA_TYPE *x,int n,int shift){\r\n  int          bit   = 0;\r\n  DATA_TYPE   *w     = x+(n>>1);\r\n\r\n  do{\r\n    DATA_TYPE  b     = bitrev12(bit++);\r\n    DATA_TYPE *xx    = x + (b>>shift);\r\n    REG_TYPE  r;\r\n\r\n               w    -= 2;\r\n\r\n\t       if(w>xx){\r\n\r\n\t\t r      = xx[0];\r\n\t\t xx[0]  = w[0];\r\n\t\t w[0]   = r;\r\n\r\n\t\t r      = xx[1];\r\n\t\t xx[1]  = w[1];\r\n\t\t w[1]   = r;\r\n\t       }\r\n  }while(w>x);\r\n}\r\n\r\nSTIN void mdct_step7(DATA_TYPE *x,int n,int step){\r\n  DATA_TYPE   *w0    = x;\r\n  DATA_TYPE   *w1    = x+(n>>1);\r\n  LOOKUP_T    *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;\r\n  LOOKUP_T    *Ttop  = T+1024;\r\n  REG_TYPE     s0, s1, s2, s3;\r\n\r\n  do{\r\n\t      w1    -= 2;\r\n\r\n              s0     = w0[0]  + w1[0];\r\n              s1     = w1[1]  - w0[1];\r\n\t      s2     = MULT32(s0, T[1]) + MULT32(s1, T[0]);\r\n\t      s3     = MULT32(s1, T[1]) - MULT32(s0, T[0]);\r\n\t      T+=step;\r\n\r\n\t      s0     = (w0[1] + w1[1])>>1;\r\n              s1     = (w0[0] - w1[0])>>1;\r\n\t      w0[0]  = s0     + s2;\r\n\t      w0[1]  = s1     + s3;\r\n\t      w1[0]  = s0     - s2;\r\n\t      w1[1]  = s3     - s1;\r\n\r\n\t      w0    += 2;\r\n  }while(T<Ttop);\r\n  do{\r\n\t      w1    -= 2;\r\n\r\n              s0     = w0[0]  + w1[0];\r\n              s1     = w1[1]  - w0[1];\r\n\t      T-=step;\r\n\t      s2     = MULT32(s0, T[0]) + MULT32(s1, T[1]);\r\n\t      s3     = MULT32(s1, T[0]) - MULT32(s0, T[1]);\r\n\r\n\t      s0     = (w0[1] + w1[1])>>1;\r\n              s1     = (w0[0] - w1[0])>>1;\r\n\t      w0[0]  = s0     + s2;\r\n\t      w0[1]  = s1     + s3;\r\n\t      w1[0]  = s0     - s2;\r\n\t      w1[1]  = s3     - s1;\r\n\r\n\t      w0    += 2;\r\n  }while(w0<w1);\r\n}\r\n#endif\r\n\r\nSTIN void mdct_step8(DATA_TYPE *x, int n, int step){\r\n  LOOKUP_T *T;\r\n  LOOKUP_T *V;\r\n  DATA_TYPE *iX =x+(n>>1);\r\n\r\n  switch(step) {\r\n#if defined(ONLY_C)\r\n  default:\r\n    T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;\r\n    do{\r\n      REG_TYPE     s0  =  x[0];\r\n      REG_TYPE     s1  = -x[1];\r\n                   XPROD31( s0, s1, T[0], T[1], x, x+1); T+=step;\r\n                   x  +=2;\r\n    }while(x<iX);\r\n    break;\r\n#endif\r\n\r\n  case 1:\r\n    {\r\n      /* linear interpolation between table values: offset=0.5, step=1 */\r\n      REG_TYPE    t0,t1,v0,v1,s0,s1;\r\n      T         = sincos_lookup0;\r\n      V         = sincos_lookup1;\r\n      t0        = (*T++)>>1;\r\n      t1        = (*T++)>>1;\r\n      do{\r\n\t    s0  =  x[0];\r\n\t    s1  = -x[1];\r\n\t    t0 += (v0 = (*V++)>>1);\r\n\t    t1 += (v1 = (*V++)>>1);\r\n\t    XPROD31( s0, s1, t0, t1, x, x+1 );\r\n\r\n\t    s0  =  x[2];\r\n\t    s1  = -x[3];\r\n\t    v0 += (t0 = (*T++)>>1);\r\n\t    v1 += (t1 = (*T++)>>1);\r\n\t    XPROD31( s0, s1, v0, v1, x+2, x+3 );\r\n\r\n\t    x += 4;\r\n      }while(x<iX);\r\n      break;\r\n    }\r\n\r\n  case 0:\r\n    {\r\n      /* linear interpolation between table values: offset=0.25, step=0.5 */\r\n      REG_TYPE    t0,t1,v0,v1,q0,q1,s0,s1;\r\n      T         = sincos_lookup0;\r\n      V         = sincos_lookup1;\r\n      t0        = *T++;\r\n      t1        = *T++;\r\n      do{\r\n\r\n\r\n\tv0  = *V++;\r\n\tv1  = *V++;\r\n\tt0 +=  (q0 = (v0-t0)>>2);\r\n\tt1 +=  (q1 = (v1-t1)>>2);\r\n\ts0  =  x[0];\r\n\ts1  = -x[1];\r\n\tXPROD31( s0, s1, t0, t1, x, x+1 );\r\n\tt0  = v0-q0;\r\n\tt1  = v1-q1;\r\n\ts0  =  x[2];\r\n\ts1  = -x[3];\r\n\tXPROD31( s0, s1, t0, t1, x+2, x+3 );\r\n\r\n\tt0  = *T++;\r\n\tt1  = *T++;\r\n\tv0 += (q0 = (t0-v0)>>2);\r\n\tv1 += (q1 = (t1-v1)>>2);\r\n\ts0  =  x[4];\r\n\ts1  = -x[5];\r\n\tXPROD31( s0, s1, v0, v1, x+4, x+5 );\r\n\tv0  = t0-q0;\r\n\tv1  = t1-q1;\r\n\ts0  =  x[6];\r\n\ts1  = -x[7];\r\n\tXPROD31( s0, s1, v0, v1, x+5, x+6 );\r\n\r\n\tx+=8;\r\n      }while(x<iX);\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\nextern int mdct_backwardARM(int n, DATA_TYPE *in);\r\n\r\n/* partial; doesn't perform last-step deinterleave/unrolling.  That\r\n   can be done more efficiently during pcm output */\r\nvoid mdct_backward(int n, DATA_TYPE *in){\r\n  int step;\r\n\r\n#if defined(ONLY_C)\r\n  int shift;\r\n\r\n  for (shift=4;!(n&(1<<shift));shift++);\r\n  shift=13-shift;\r\n  step=2<<shift;\r\n\r\n  presymmetry(in,n>>1,step);\r\n  mdct_butterflies(in,n>>1,shift);\r\n  mdct_bitreverse(in,n,shift);\r\n  mdct_step7(in,n,step);\r\n  mdct_step8(in,n,step>>2);\r\n#else\r\n  step = mdct_backwardARM(n, in);\r\n  if (step <= 1)\r\n    mdct_step8(in,n,step);\r\n#endif\r\n}\r\n\r\n#if defined(ONLY_C)\r\nvoid mdct_shift_right(int n, DATA_TYPE *in, DATA_TYPE *right){\r\n  int i;\r\n  n>>=2;\r\n  in+=1;\r\n\r\n  for(i=0;i<n;i++)\r\n    right[i]=in[i<<1];\r\n}\r\n#endif\r\n\r\nextern ogg_int16_t *mdct_unroll_prelap(ogg_int16_t *out,\r\n                                       DATA_TYPE   *post,\r\n                                       DATA_TYPE   *l,\r\n                                       int          step);\r\nextern ogg_int16_t *mdct_unroll_part2(ogg_int16_t *out,\r\n                                      DATA_TYPE   *post,\r\n                                      DATA_TYPE   *l,\r\n                                      DATA_TYPE   *r,\r\n                                      int          step,\r\n                                      LOOKUP_T    *wL,\r\n                                      LOOKUP_T    *wR);\r\nextern ogg_int16_t *mdct_unroll_part3(ogg_int16_t *out,\r\n                                      DATA_TYPE   *post,\r\n                                      DATA_TYPE   *l,\r\n                                      DATA_TYPE   *r,\r\n                                      int          step,\r\n                                      LOOKUP_T    *wL,\r\n                                      LOOKUP_T    *wR);\r\nextern ogg_int16_t *mdct_unroll_postlap(ogg_int16_t *out,\r\n                                        DATA_TYPE   *post,\r\n                                        DATA_TYPE   *l,\r\n                                        int          step);\r\n\r\nvoid mdct_unroll_lap(int n0,int n1,\r\n\t\t     int lW,int W,\r\n\t\t     DATA_TYPE *in,\r\n\t\t     DATA_TYPE *right,\r\n\t\t     LOOKUP_T *w0,\r\n\t\t     LOOKUP_T *w1,\r\n\t\t     ogg_int16_t *out,\r\n\t\t     int step,\r\n\t\t     int start, /* samples, this frame */\r\n\t\t     int end    /* samples, this frame */){\r\n\r\n  DATA_TYPE *l=in+(W&&lW ? n1>>1 : n0>>1);\r\n  DATA_TYPE *r=right+(lW ? n1>>2 : n0>>2);\r\n  DATA_TYPE *post;\r\n  LOOKUP_T *wR=(W && lW ? w1+(n1>>1) : w0+(n0>>1));\r\n  LOOKUP_T *wL=(W && lW ? w1         : w0        );\r\n\r\n  int preLap=(lW && !W ? (n1>>2)-(n0>>2) : 0 );\r\n  int halfLap=(lW && W ? (n1>>2) : (n0>>2) );\r\n  int postLap=(!lW && W ? (n1>>2)-(n0>>2) : 0 );\r\n  int n,off;\r\n\r\n  /* preceeding direct-copy lapping from previous frame, if any */\r\n  if(preLap){\r\n    n      = (end<preLap?end:preLap);\r\n    off    = (start<preLap?start:preLap);\r\n    post   = r-n;\r\n    r     -= off;\r\n    start -= off;\r\n    end   -= n;\r\n#if defined(ONLY_C)\r\n    while(r>post){\r\n      *out = CLIP_TO_15((*--r)>>9);\r\n      out+=step;\r\n    }\r\n#else\r\n    out = mdct_unroll_prelap(out,post,r,step);\r\n    n -= off;\r\n    if (n < 0)\r\n      n = 0;\r\n    r -= n;\r\n#endif\r\n  }\r\n\r\n  /* cross-lap; two halves due to wrap-around */\r\n  n      = (end<halfLap?end:halfLap);\r\n  off    = (start<halfLap?start:halfLap);\r\n  post   = r-n;\r\n  r     -= off;\r\n  l     -= off*2;\r\n  start -= off;\r\n  wR    -= off;\r\n  wL    += off;\r\n  end   -= n;\r\n#if defined(ONLY_C)\r\n  while(r>post){\r\n    l-=2;\r\n    *out = CLIP_TO_15((MULT31(*--r,*--wR) + MULT31(*l,*wL++))>>9);\r\n    out+=step;\r\n  }\r\n#else\r\n  out = mdct_unroll_part2(out, post, l, r, step, wL, wR);\r\n  n -= off;\r\n  if (n < 0)\r\n      n = 0;\r\n  l -= 2*n;\r\n  r -= n;\r\n  wR -= n;\r\n  wL += n;\r\n#endif\r\n\r\n  n      = (end<halfLap?end:halfLap);\r\n  off    = (start<halfLap?start:halfLap);\r\n  post   = r+n;\r\n  r     += off;\r\n  l     += off*2;\r\n  start -= off;\r\n  end   -= n;\r\n  wR    -= off;\r\n  wL    += off;\r\n#if defined(ONLY_C)\r\n  while(r<post){\r\n    *out = CLIP_TO_15((MULT31(*r++,*--wR) - MULT31(*l,*wL++))>>9);\r\n    out+=step;\r\n    l+=2;\r\n  }\r\n#else\r\n  out = mdct_unroll_part3(out, post, l, r, step, wL, wR);\r\n  n -= off;\r\n  if (n < 0)\r\n      n = 0;\r\n  l += 2*n;\r\n  r += n;\r\n  wR -= n;\r\n  wL += n;\r\n#endif\r\n\r\n  /* preceeding direct-copy lapping from previous frame, if any */\r\n  if(postLap){\r\n    n      = (end<postLap?end:postLap);\r\n    off    = (start<postLap?start:postLap);\r\n    post   = l+n*2;\r\n    l     += off*2;\r\n#if defined(ONLY_C)\r\n    while(l<post){\r\n      *out = CLIP_TO_15((-*l)>>9);\r\n      out+=step;\r\n      l+=2;\r\n    }\r\n#else\r\n    out = mdct_unroll_postlap(out,post,l,step);\r\n#endif\r\n  }\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/mdct.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: modified discrete cosine transform prototypes\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _OGG_mdct_H_\r\n#define _OGG_mdct_H_\r\n\r\n#include \"ivorbiscodec.h\"\r\n#include \"misc.h\"\r\n\r\n#define DATA_TYPE ogg_int32_t\r\n#define REG_TYPE  register ogg_int32_t\r\n\r\n#ifdef _LOW_ACCURACY_\r\n#define cPI3_8 (0x0062)\r\n#define cPI2_8 (0x00b5)\r\n#define cPI1_8 (0x00ed)\r\n#else\r\n#define cPI3_8 (0x30fbc54d)\r\n#define cPI2_8 (0x5a82799a)\r\n#define cPI1_8 (0x7641af3d)\r\n#endif\r\n\r\nextern void mdct_backward(int n, DATA_TYPE *in);\r\nextern void mdct_shift_right(int n, DATA_TYPE *in, DATA_TYPE *right);\r\nextern void mdct_unroll_lap(int n0,int n1,\r\n\t\t\t    int lW,int W,\r\n\t\t\t    DATA_TYPE *in,DATA_TYPE *right,\r\n\t\t\t    LOOKUP_T *w0,LOOKUP_T *w1,\r\n\t\t\t    ogg_int16_t *out,\r\n\t\t\t    int step,\r\n\t\t\t    int start,int end /* samples, this frame */);\r\n\r\n#endif\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/mdctARM.s",
    "content": "@ Tremolo library\r\n@-----------------------------------------------------------------------\r\n@ Copyright (C) 2002-2009, Xiph.org Foundation\r\n@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n@ All rights reserved.\r\n\r\n@ Redistribution and use in source and binary forms, with or without\r\n@ modification, are permitted provided that the following conditions\r\n@ are met:\r\n\r\n@     * Redistributions of source code must retain the above copyright\r\n@ notice, this list of conditions and the following disclaimer.\r\n@     * Redistributions in binary form must reproduce the above\r\n@ copyright notice, this list of conditions and the following disclaimer\r\n@ in the documentation and/or other materials provided with the\r\n@ distribution.\r\n@     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n@ Productions Ltd nor the names of its contributors may be used to\r\n@ endorse or promote products derived from this software without\r\n@ specific prior written permission.\r\n@\r\n@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n@ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n@ ----------------------------------------------------------------------\r\n\r\n    .text\r\n\r\n\t@ full accuracy version\r\n\r\n\t.global mdct_backwardARM\r\n\t.global mdct_shift_right\r\n\t.global mdct_unroll_prelap\r\n\t.global mdct_unroll_part2\r\n\t.global mdct_unroll_part3\r\n\t.global mdct_unroll_postlap\r\n\r\n\t.extern\tsincos_lookup0\r\n\t.extern\tsincos_lookup1\r\n\r\nmdct_unroll_prelap:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = r\r\n\t@ r3 = step\r\n\tSTMFD\tr13!,{r4-r7,r14}\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr3, r3, LSL #1\r\n\tSUB\tr1, r2, r1\t\t@ r1 = r - post\r\n\tSUBS\tr1, r1, #16\t\t@ r1 = r - post - 16\r\n\tBLT\tunroll_over\r\nunroll_loop:\r\n\tLDMDB\tr2!,{r5,r6,r7,r12}\r\n\r\n\tMOV\tr5, r5, ASR #9\t\t@ r5 = (*--r)>>9\r\n\tMOV\tr6, r6, ASR #9\t\t@ r6 = (*--r)>>9\r\n\tMOV\tr7, r7, ASR #9\t\t@ r7 = (*--r)>>9\r\n\tMOV\tr12,r12,ASR #9\t\t@ r12= (*--r)>>9\r\n\r\n\tMOV\tr14,r12,ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr12,r4, r14,ASR #31\r\n\tSTRH\tr12,[r0], r3\r\n\r\n\tMOV\tr14,r7, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr7, r4, r14,ASR #31\r\n\tSTRH\tr7, [r0], r3\r\n\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r3\r\n\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\r\n\tSUBS\tr1, r1, #16\r\n\tBGE\tunroll_loop\r\n\r\nunroll_over:\r\n\tADDS\tr1, r1, #16\r\n\tBLE\tunroll_end\r\nunroll_loop2:\r\n\tLDR\tr5,[r2,#-4]!\r\n\t@ stall\r\n\t@ stall (Xscale)\r\n\tMOV\tr5, r5, ASR #9\t\t@ r5 = (*--r)>>9\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop2\r\nunroll_end:\r\n\tLDMFD\tr13!,{r4-r7,PC}\r\n\r\nmdct_unroll_postlap:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = l\r\n\t@ r3 = step\r\n\tSTMFD\tr13!,{r4-r7,r14}\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr3, r3, LSL #1\r\n\tSUB\tr1, r1, r2\t\t@ r1 = post - l\r\n\tMOV\tr1, r1, ASR #1\t\t@ r1 = (post - l)>>1\r\n\tSUBS\tr1, r1, #16\t\t@ r1 = ((post - l)>>1) - 4\r\n\tBLT\tunroll_over3\r\nunroll_loop3:\r\n\tLDR\tr12,[r2],#8\r\n\tLDR\tr7, [r2],#8\r\n\tLDR\tr6, [r2],#8\r\n\tLDR\tr5, [r2],#8\r\n\r\n\tRSB\tr12,r12,#0\r\n\tRSB\tr5, r5, #0\r\n\tRSB\tr6, r6, #0\r\n\tRSB\tr7, r7, #0\r\n\r\n\tMOV\tr12, r12,ASR #9\t\t@ r12= (-*l)>>9\r\n\tMOV\tr5,  r5, ASR #9\t\t@ r5 = (-*l)>>9\r\n\tMOV\tr6,  r6, ASR #9\t\t@ r6 = (-*l)>>9\r\n\tMOV\tr7,  r7, ASR #9\t\t@ r7 = (-*l)>>9\r\n\r\n\tMOV\tr14,r12,ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr12,r4, r14,ASR #31\r\n\tSTRH\tr12,[r0], r3\r\n\r\n\tMOV\tr14,r7, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr7, r4, r14,ASR #31\r\n\tSTRH\tr7, [r0], r3\r\n\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r3\r\n\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\r\n\tSUBS\tr1, r1, #16\r\n\tBGE\tunroll_loop3\r\n\r\nunroll_over3:\r\n\tADDS\tr1, r1, #16\r\n\tBLE\tunroll_over4\r\nunroll_loop4:\r\n\tLDR\tr5,[r2], #8\r\n\t@ stall\r\n\t@ stall (Xscale)\r\n\tRSB\tr5, r5, #0\r\n\tMOV\tr5, r5, ASR #9\t\t@ r5 = (-*l)>>9\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop4\r\nunroll_over4:\r\n\tLDMFD\tr13!,{r4-r7,PC}\r\n\r\nmdct_unroll_part2:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = l\r\n\t@ r3 = r\r\n\t@ <> = step\r\n\t@ <> = wL\r\n\t@ <> = wR\r\n\tMOV\tr12,r13\r\n\tSTMFD\tr13!,{r4,r6-r11,r14}\r\n\tLDMFD\tr12,{r8,r9,r10}\t\t@ r8 = step\r\n\t\t\t\t\t@ r9 = wL\r\n\t\t\t\t\t@ r10= wR\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr8, r8, LSL #1\r\n\tSUBS\tr1, r3, r1\t\t@ r1 = (r - post)\r\n\tBLE\tunroll_over5\r\nunroll_loop5:\r\n\tLDR\tr12,[r2, #-8]!\t\t@ r12= *l       (but l -= 2 first)\r\n\tLDR\tr11,[r9],#4\t\t@ r11= *wL++\r\n\tLDR\tr7, [r3, #-4]!\t\t@ r7 = *--r\r\n\tLDR\tr6, [r10,#-4]!\t\t@ r6 = *--wR\r\n\r\n\t@ Can save a cycle here, at the cost of 1bit errors in rounding\r\n\tSMULL\tr14,r11,r12,r11\t\t@ (r14,r11)  = *l   * *wL++\r\n\tSMULL\tr14,r6, r7, r6\t\t@ (r14,r6)   = *--r * *--wR\r\n\tADD\tr6, r6, r11\r\n\tMOV\tr6, r6, ASR #8\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r8\r\n\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop5\r\n\r\nunroll_over5:\r\n\tLDMFD\tr13!,{r4,r6-r11,PC}\r\n\r\nmdct_unroll_part3:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = l\r\n\t@ r3 = r\r\n\t@ <> = step\r\n\t@ <> = wL\r\n\t@ <> = wR\r\n\tMOV\tr12,r13\r\n\tSTMFD\tr13!,{r4,r6-r11,r14}\r\n\tLDMFD\tr12,{r8,r9,r10}\t\t@ r8 = step\r\n\t\t\t\t\t@ r9 = wL\r\n\t\t\t\t\t@ r10= wR\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr8, r8, LSL #1\r\n\tSUBS\tr1, r1, r3\t\t@ r1 = (post - r)\r\n\tBLE\tunroll_over6\r\nunroll_loop6:\r\n\tLDR\tr12,[r2],#8\t\t@ r12= *l       (but l += 2 first)\r\n\tLDR\tr11,[r9],#4\t\t@ r11= *wL++\r\n\tLDR\tr7, [r3],#4\t\t@ r7 = *r++\r\n\tLDR\tr6, [r10,#-4]!\t\t@ r6 = *--wR\r\n\r\n\t@ Can save a cycle here, at the cost of 1bit errors in rounding\r\n\tSMULL\tr14,r11,r12,r11\t\t@ (r14,r11)  = *l   * *wL++\r\n\tSMULL\tr14,r6, r7, r6\t\t@ (r14,r6)   = *--r * *--wR\r\n\tSUB\tr6, r6, r11\r\n\tMOV\tr6, r6, ASR #8\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r8\r\n\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop6\r\n\r\nunroll_over6:\r\n\tLDMFD\tr13!,{r4,r6-r11,PC}\r\n\r\nmdct_shift_right:\r\n\t@ r0 = n\r\n\t@ r1 = in\r\n\t@ r2 = right\r\n\tSTMFD\tr13!,{r4-r11,r14}\r\n\r\n\tMOV\tr0, r0, LSR #2\t\t@ n >>= 2\r\n\tADD\tr1, r1, #4\r\n\r\n\tSUBS\tr0, r0,\t#8\r\n\tBLT\tsr_less_than_8\r\nsr_loop:\r\n\tLDR\tr3, [r1], #8\r\n\tLDR\tr4, [r1], #8\r\n\tLDR\tr5, [r1], #8\r\n\tLDR\tr6, [r1], #8\r\n\tLDR\tr7, [r1], #8\r\n\tLDR\tr8, [r1], #8\r\n\tLDR\tr12,[r1], #8\r\n\tLDR\tr14,[r1], #8\r\n\tSUBS\tr0, r0, #8\r\n\tSTMIA\tr2!,{r3,r4,r5,r6,r7,r8,r12,r14}\r\n\tBGE\tsr_loop\r\nsr_less_than_8:\r\n\tADDS\tr0, r0, #8\r\n\tBEQ\tsr_end\r\nsr_loop2:\r\n\tLDR\tr3, [r1], #8\r\n\tSUBS\tr0, r0, #1\r\n\tSTR\tr3, [r2], #4\r\n\tBGT\tsr_loop2\r\nsr_end:\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\nmdct_backwardARM:\r\n\t@ r0 = n\r\n\t@ r1 = in\r\n\tSTMFD\tr13!,{r4-r11,r14}\r\n\r\n\tMOV\tr2,#1<<4\t@ r2 = 1<<shift\r\n\tMOV\tr3,#13-4\t@ r3 = 13-shift\r\nfind_shift_loop:\r\n\tTST\tr0,r2\t\t@ if (n & (1<<shift)) == 0\r\n\tMOV\tr2,r2,LSL #1\r\n\tSUBEQ\tr3,r3,#1\t@ shift--\r\n\tBEQ\tfind_shift_loop\r\n\tMOV\tr2,#2\r\n\tMOV\tr2,r2,LSL r3\t@ r2 = step = 2<<shift\r\n\r\n\t@ presymmetry\r\n\t@ r0 = n (a multiple of 4)\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\n\tADD\tr4, r1, r0, LSL #1\t@ r4 = aX = in+(n>>1)\r\n\tADD\tr14,r1, r0\t\t@ r14= in+(n>>2)\r\n\tSUB\tr4, r4, #3*4\t\t@ r4 = aX = in+n2-3\r\n\tADRL\tr7, .Lsincos_lookup\r\n\tLDR\tr5, [r7]\t\t@ r5 = T=sincos_lookup0\r\n\tADD\tr5, r7\r\n\r\npresymmetry_loop1:\r\n\tLDR\tr7, [r4,#8]\t\t@ r6 = s2 = aX[2]\r\n\tLDR\tr11,[r5,#4]\t\t@ r11= T[1]\r\n\tLDR\tr6, [r4]\t\t@ r6 = s0 = aX[0]\r\n\tLDR\tr10,[r5],r2,LSL #2\t@ r10= T[0]   T += step\r\n\r\n\t@ XPROD31(s0, s2, T[0], T[1], 0xaX[0], &ax[2])\r\n\tSMULL\tr8, r9, r7, r11\t\t@ (r8, r9)   = s2*T[1]\r\n\t@ stall\r\n\t@ stall ?\r\n\tSMLAL\tr8, r9, r6, r10\t\t@ (r8, r9)  += s0*T[0]\r\n\tRSB\tr6, r6, #0\r\n\t@ stall ?\r\n\tSMULL\tr8, r12,r7, r10\t\t@ (r8, r12)  = s2*T[0]\r\n\tMOV\tr9, r9, LSL #1\r\n\t@ stall ?\r\n\tSMLAL\tr8, r12,r6, r11\t\t@ (r8, r12) -= s0*T[1]\r\n\tSTR\tr9, [r4],#-16\t\t@ aX[0] = r9\r\n\tCMP\tr4,r14\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTR\tr12,[r4,#8+16]\t\t@ aX[2] = r12\r\n\r\n\tBGE\tpresymmetry_loop1\t@ while (aX >= in+n4)\r\n\r\npresymmetry_loop2:\r\n\tLDR\tr6,[r4]\t\t\t@ r6 = s0 = aX[0]\r\n\tLDR\tr10,[r5,#4]\t\t@ r10= T[1]\r\n\tLDR\tr7,[r4,#8]\t\t@ r6 = s2 = aX[2]\r\n\tLDR\tr11,[r5],-r2,LSL #2\t@ r11= T[0]   T -= step\r\n\r\n\t@ XPROD31(s0, s2, T[1], T[0], 0xaX[0], &ax[2])\r\n\tSMULL\tr8, r9, r6, r10\t\t@ (r8, r9)   = s0*T[1]\r\n\t@ stall\r\n\t@ stall ?\r\n\tSMLAL\tr8, r9, r7, r11\t\t@ (r8, r9)  += s2*T[0]\r\n\tRSB\tr6, r6, #0\r\n\t@ stall ?\r\n\tSMULL\tr8, r12,r7, r10\t\t@ (r8, r12)  = s2*T[1]\r\n\tMOV\tr9, r9, LSL #1\r\n\t@ stall ?\r\n\tSMLAL\tr8, r12,r6, r11\t\t@ (r8, r12) -= s0*T[0]\r\n\tSTR\tr9, [r4],#-16\t\t@ aX[0] = r9\r\n\tCMP\tr4,r1\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTR\tr12,[r4,#8+16]\t\t@ aX[2] = r12\r\n\r\n\tBGE\tpresymmetry_loop2\t@ while (aX >= in)\r\n\r\n\t@ r0 = n\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\tSTMFD\tr13!,{r3}\r\n\tADRL\tr4, .Lsincos_lookup\r\n\tLDR\tr5, [r4]\t\t@ r5 = T=sincos_lookup0\r\n\tADD\tr5, r4\r\n\tADD\tr4, r1, r0, LSL #1\t@ r4 = aX = in+(n>>1)\r\n\tSUB\tr4, r4, #4*4\t\t@ r4 = aX = in+(n>>1)-4\r\n\tLDR\tr11,[r5,#4]\t\t@ r11= T[1]\r\n\tLDR\tr10,[r5],r2, LSL #2\t@ r10= T[0]    T += step\r\npresymmetry_loop3:\r\n\tLDR\tr8,[r1],#16 \t\t@ r8 = ro0 = bX[0]\r\n\tLDR\tr9,[r1,#8-16]\t\t@ r9 = ro2 = bX[2]\r\n\tLDR\tr6,[r4]\t\t\t@ r6 = ri0 = aX[0]\r\n\r\n\t@ XNPROD31( ro2, ro0, T[1], T[0], 0xaX[0], &aX[2] )\r\n\t@ aX[0] = (ro2*T[1] - ro0*T[0])>>31 aX[2] = (ro0*T[1] + ro2*T[0])>>31\r\n\tSMULL\tr14,r12,r8, r11\t\t@ (r14,r12)  = ro0*T[1]\r\n\tRSB\tr8,r8,#0\t\t@ r8 = -ro0\r\n\t@ Stall ?\r\n\tSMLAL\tr14,r12,r9, r10\t\t@ (r14,r12) += ro2*T[0]\r\n\tLDR\tr7,[r4,#8]\t\t@ r7 = ri2 = aX[2]\r\n\t@ Stall ?\r\n\tSMULL\tr14,r3, r9, r11\t\t@ (r14,r3)   = ro2*T[1]\r\n\tMOV\tr12,r12,LSL #1\r\n\tLDR\tr11,[r5,#4]\t\t@ r11= T[1]\r\n\tSMLAL\tr14,r3, r8, r10\t\t@ (r14,r3)  -= ro0*T[0]\r\n\tLDR\tr10,[r5],r2, LSL #2\t@ r10= T[0]    T += step\r\n\tSTR\tr12,[r4,#8]\r\n\tMOV\tr3, r3, LSL #1\r\n\tSTR\tr3, [r4],#-16\r\n\r\n\t@ XNPROD31( ri2, ri0, T[0], T[1], 0xbX[0], &bX[2] )\r\n\t@ bX[0] = (ri2*T[0] - ri0*T[1])>>31 bX[2] = (ri0*T[0] + ri2*T[1])>>31\r\n\tSMULL\tr14,r12,r6, r10\t\t@ (r14,r12)  = ri0*T[0]\r\n\tRSB\tr6,r6,#0\t\t@ r6 = -ri0\r\n\t@ stall ?\r\n\tSMLAL\tr14,r12,r7, r11\t\t@ (r14,r12) += ri2*T[1]\r\n\t@ stall ?\r\n\t@ stall ?\r\n\tSMULL\tr14,r3, r7, r10\t\t@ (r14,r3)   = ri2*T[0]\r\n\tMOV\tr12,r12,LSL #1\r\n\t@ stall ?\r\n\tSMLAL\tr14,r3, r6, r11\t\t@ (r14,r3)  -= ri0*T[1]\r\n\tCMP\tr4,r1\r\n\tSTR\tr12,[r1,#8-16]\r\n\tMOV\tr3, r3, LSL #1\r\n\tSTR\tr3, [r1,#-16]\r\n\r\n\tBGE\tpresymmetry_loop3\r\n\r\n\tSUB\tr1,r1,r0\t\t@ r1 = in -= n>>2 (i.e. restore in)\r\n\r\n\tLDR\tr3,[r13]\r\n\tSTR\tr2,[r13,#-4]!\r\n\r\n\t@ mdct_butterflies\r\n\t@ r0 = n  = (points * 2)\r\n\t@ r1 = in = x\r\n\t@ r2 = i\r\n\t@ r3 = shift\r\n\tSTMFD\tr13!,{r0-r1}\r\n\tADRL\tr4, .Lsincos_lookup\r\n\tLDR\tr5, [r4]\r\n\tADD\tr5, r4\r\n\tRSBS\tr4,r3,#6\t\t@ r4 = stages = 7-shift then --stages\r\n\tBLE\tno_generics\r\n\tMOV\tr14,#4\t\t\t@ r14= 4               (i=0)\r\n\tMOV\tr6, r14,LSL r3\t\t@ r6 = (4<<i)<<shift\r\nmdct_butterflies_loop1:\r\n\tMOV\tr0, r0, LSR #1\t\t@ r0 = points>>i = POINTS\r\n\tMOV\tr2, r14,LSR #2\t\t@ r2 = (1<<i)-j        (j=0)\r\n\tSTMFD\tr13!,{r4,r14}\r\nmdct_butterflies_loop2:\r\n\r\n\t@ mdct_butterfly_generic(x+POINTS*j, POINTS, 4<<(i+shift))\r\n\t@ mdct_butterfly_generic(r1, r0, r6)\r\n\t@ r0 = points\r\n\t@ r1 = x\r\n\t@ preserve r2 (external loop counter)\r\n\t@ preserve r3\r\n\t@ preserve r4 (external loop counter)\r\n\t@ r5 = T = sincos_lookup0\r\n\t@ r6 = step\r\n\t@ preserve r14\r\n\r\n\tSTR\tr2,[r13,#-4]!\t\t@ stack r2\r\n\tADD\tr1,r1,r0,LSL #1\t\t@ r1 = x2+4 = x + (POINTS>>1)\r\n\tADD\tr7,r1,r0,LSL #1\t\t@ r7 = x1+4 = x + POINTS\r\n\tADD\tr12,r5,#1024*4\t\t@ r12= sincos_lookup0+1024\r\n\r\nmdct_bufferfly_generic_loop1:\r\n\tLDMDB\tr7!,{r2,r3,r8,r11}\t@ r2 = x1[0]\r\n\t\t\t\t\t@ r3 = x1[1]\r\n\t\t\t\t\t@ r8 = x1[2]\r\n\t\t\t\t\t@ r11= x1[3]    x1 -= 4\r\n\tLDMDB\tr1!,{r4,r9,r10,r14}\t@ r4 = x2[0]\r\n\t\t\t\t\t@ r9 = x2[1]\r\n\t\t\t\t\t@ r10= x2[2]\r\n\t\t\t\t\t@ r14= x2[3]    x2 -= 4\r\n\r\n\tSUB\tr2, r2, r3\t\t@ r2 = s0 = x1[0] - x1[1]\r\n\tADD\tr3, r2, r3, LSL #1\t@ r3 =      x1[0] + x1[1] (-> x1[0])\r\n\tSUB\tr11,r11,r8\t\t@ r11= s1 = x1[3] - x1[2]\r\n\tADD\tr8, r11,r8, LSL #1\t@ r8 =      x1[3] + x1[2] (-> x1[2])\r\n\tSUB\tr9, r9, r4\t\t@ r9 = s2 = x2[1] - x2[0]\r\n\tADD\tr4, r9, r4, LSL #1\t@ r4 =      x2[1] + x2[0] (-> x1[1])\r\n\tSUB\tr14,r14,r10\t\t@ r14= s3 = x2[3] - x2[2]\r\n\tADD\tr10,r14,r10,LSL #1\t@ r10=      x2[3] + x2[2] (-> x1[3])\r\n\tSTMIA\tr7,{r3,r4,r8,r10}\r\n\r\n\t@ r0 = points\r\n\t@ r1 = x2\r\n\t@ r2 = s0\r\n\t@ r3 free\r\n\t@ r4 free\r\n\t@ r5 = T\r\n\t@ r6 = step\r\n\t@ r7 = x1\r\n\t@ r8 free\r\n\t@ r9 = s2\r\n\t@ r10 free\r\n\t@ r11= s1\r\n\t@ r12= limit\r\n\t@ r14= s3\r\n\r\n\tLDR\tr8, [r5,#4]\t\t@ r8 = T[1]\r\n\tLDR\tr10,[r5],r6,LSL #2\t@ r10= T[0]\t\tT += step\r\n\r\n\t@ XPROD31(s1, s0, T[0], T[1], &x2[0], &x2[2])\r\n\t@ x2[0] = (s1*T[0] + s0*T[1])>>31     x2[2] = (s0*T[0] - s1*T[1])>>31\r\n\t@ stall Xscale\r\n\tSMULL\tr4, r3, r2, r8\t\t@ (r4, r3)   = s0*T[1]\r\n\tSMLAL\tr4, r3, r11,r10\t\t@ (r4, r3)  += s1*T[0]\r\n\tRSB\tr11,r11,#0\r\n\tSMULL\tr11,r4, r8, r11\t\t@ (r11,r4)   = -s1*T[1]\r\n\tSMLAL\tr11,r4, r2, r10\t\t@ (r11,r4)  += s0*T[0]\r\n\tMOV\tr2, r3, LSL #1\t\t@ r2 = r3<<1 = Value for x2[0]\r\n\r\n\t@ XPROD31(s2, s3, T[0], T[1], &x2[1], &x2[3])\r\n\t@ x2[1] = (s2*T[0] + s3*T[1])>>31     x2[3] = (s3*T[0] - s2*T[1])>>31\r\n\tSMULL\tr11,r3, r9, r10\t\t@ (r11,r3)   = s2*T[0]\r\n\tMOV\tr4, r4, LSL #1\t\t@ r4 = r4<<1 = Value for x2[2]\r\n\tSMLAL\tr11,r3, r14,r8\t\t@ (r11,r3)  += s3*T[1]\r\n\tRSB\tr9, r9, #0\r\n\tSMULL\tr10,r11,r14,r10\t\t@ (r10,r11)  = s3*T[0]\r\n\tMOV\tr3, r3, LSL #1\t\t@ r3 = r3<<1 = Value for x2[1]\r\n\tSMLAL\tr10,r11,r9,r8\t\t@ (r10,r11) -= s2*T[1]\r\n\tCMP\tr5, r12\r\n\tMOV\tr11,r11,LSL #1\t\t@ r11= r11<<1 = Value for x2[3]\r\n\r\n\tSTMIA\tr1,{r2,r3,r4,r11}\r\n\r\n\tBLT\tmdct_bufferfly_generic_loop1\r\n\r\n\tSUB\tr12,r12,#1024*4\r\nmdct_bufferfly_generic_loop2:\r\n\tLDMDB\tr7!,{r2,r3,r9,r10}\t@ r2 = x1[0]\r\n\t\t\t\t\t@ r3 = x1[1]\r\n\t\t\t\t\t@ r9 = x1[2]\r\n\t\t\t\t\t@ r10= x1[3]    x1 -= 4\r\n\tLDMDB\tr1!,{r4,r8,r11,r14}\t@ r4 = x2[0]\r\n\t\t\t\t\t@ r8 = x2[1]\r\n\t\t\t\t\t@ r11= x2[2]\r\n\t\t\t\t\t@ r14= x2[3]    x2 -= 4\r\n\r\n\tSUB\tr2, r2, r3\t\t@ r2 = s0 = x1[0] - x1[1]\r\n\tADD\tr3, r2, r3, LSL #1\t@ r3 =      x1[0] + x1[1] (-> x1[0])\r\n\tSUB\tr9, r9,r10\t\t@ r9 = s1 = x1[2] - x1[3]\r\n\tADD\tr10,r9,r10, LSL #1\t@ r10=      x1[2] + x1[3] (-> x1[2])\r\n\tSUB\tr4, r4, r8\t\t@ r4 = s2 = x2[0] - x2[1]\r\n\tADD\tr8, r4, r8, LSL #1\t@ r8 =      x2[0] + x2[1] (-> x1[1])\r\n\tSUB\tr14,r14,r11\t\t@ r14= s3 = x2[3] - x2[2]\r\n\tADD\tr11,r14,r11,LSL #1\t@ r11=      x2[3] + x2[2] (-> x1[3])\r\n\tSTMIA\tr7,{r3,r8,r10,r11}\r\n\r\n\t@ r0 = points\r\n\t@ r1 = x2\r\n\t@ r2 = s0\r\n\t@ r3 free\r\n\t@ r4 = s2\r\n\t@ r5 = T\r\n\t@ r6 = step\r\n\t@ r7 = x1\r\n\t@ r8 free\r\n\t@ r9 = s1\r\n\t@ r10 free\r\n\t@ r11 free\r\n\t@ r12= limit\r\n\t@ r14= s3\r\n\r\n\tLDR\tr8, [r5,#4]\t\t@ r8 = T[1]\r\n\tLDR\tr10,[r5],-r6,LSL #2\t@ r10= T[0]\t\tT -= step\r\n\r\n\t@ XNPROD31(s0, s1, T[0], T[1], &x2[0], &x2[2])\r\n\t@ x2[0] = (s0*T[0] - s1*T[1])>>31     x2[2] = (s1*T[0] + s0*T[1])>>31\r\n\t@ stall Xscale\r\n\tSMULL\tr3, r11,r2, r8\t\t@ (r3, r11)  = s0*T[1]\r\n\tSMLAL\tr3, r11,r9, r10\t\t@ (r3, r11) += s1*T[0]\r\n\tRSB\tr9, r9, #0\r\n\tSMULL\tr3, r2, r10,r2\t\t@ (r3, r2)   = s0*T[0]\r\n\tSMLAL\tr3, r2, r9, r8\t\t@ (r3, r2)  += -s1*T[1]\r\n\tMOV\tr9, r11,LSL #1\t\t@ r9 = r11<<1 = Value for x2[2]\r\n\r\n\t@ XNPROD31(s3, s2, T[0], T[1], &x2[1], &x2[3])\r\n\t@ x2[1] = (s3*T[0] - s2*T[1])>>31     x2[3] = (s2*T[0] + s3*T[1])>>31\r\n\tSMULL\tr3, r11,r4, r10\t\t@ (r3,r11)   = s2*T[0]\r\n\tMOV\tr2, r2, LSL #1\t\t@ r2 = r2<<1  = Value for x2[0]\r\n\tSMLAL\tr3, r11,r14,r8\t\t@ (r3,r11)  += s3*T[1]\r\n\tRSB\tr4, r4, #0\r\n\tSMULL\tr10,r3,r14,r10\t\t@ (r10,r3)   = s3*T[0]\r\n\tMOV\tr11,r11,LSL #1\t\t@ r11= r11<<1 = Value for x2[3]\r\n\tSMLAL\tr10,r3, r4, r8\t\t@ (r10,r3)  -= s2*T[1]\r\n\tCMP\tr5, r12\r\n\tMOV\tr3, r3, LSL #1\t\t@ r3 = r3<<1  = Value for x2[1]\r\n\r\n\tSTMIA\tr1,{r2,r3,r9,r11}\r\n\r\n\tBGT\tmdct_bufferfly_generic_loop2\r\n\r\n\tLDR\tr2,[r13],#4\t\t@ unstack r2\r\n\tADD\tr1, r1, r0, LSL #2\t@ r1 = x+POINTS*j\r\n\t@ stall Xscale\r\n\tSUBS\tr2, r2, #1\t\t@ r2--                 (j++)\r\n\tBGT\tmdct_butterflies_loop2\r\n\r\n\tLDMFD\tr13!,{r4,r14}\r\n\r\n\tLDR\tr1,[r13,#4]\r\n\r\n\tSUBS\tr4, r4, #1\t\t@ stages--\r\n\tMOV\tr14,r14,LSL #1\t\t@ r14= 4<<i            (i++)\r\n\tMOV\tr6, r6, LSL #1\t\t@ r6 = step <<= 1      (i++)\r\n\tBGE\tmdct_butterflies_loop1\r\n\tLDMFD\tr13,{r0-r1}\r\nno_generics:\r\n\t@ mdct_butterflies part2 (loop around mdct_bufferfly_32)\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\nmdct_bufferflies_loop3:\r\n\t@ mdct_bufferfly_32\r\n\r\n\t@ block1\r\n\tADD\tr4, r1, #16*4\t\t@ r4 = &in[16]\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[16]\r\n\t\t\t\t\t@ r6 = x[17]\r\n\t\t\t\t\t@ r9 = x[18]\r\n\t\t\t\t\t@ r10= x[19]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[0]\r\n\t\t\t\t\t@ r8 = x[1]\r\n\t\t\t\t\t@ r11= x[2]\r\n\t\t\t\t\t@ r12= x[3]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[16] - x[17]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[16] + x[17]  -> x[16]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[18] - x[19]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[18] + x[19]  -> x[18]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 1] - x[ 0]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 1] + x[ 0]  -> x[17]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 3] - x[ 2]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 3] + x[ 2]  -> x[19]\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tLDR\tr6,cPI1_8\r\n\tLDR\tr7,cPI3_8\r\n\r\n\t@ XNPROD31( s0, s1, cPI3_8, cPI1_8, &x[ 0], &x[ 2] )\r\n\t@ x[0] = s0*cPI3_8 - s1*cPI1_8     x[2] = s1*cPI3_8 + s0*cPI1_8\r\n\t@ stall Xscale\r\n\tSMULL\tr14,r11,r5, r6\t\t@ (r14,r11)  = s0*cPI1_8\r\n\tSMLAL\tr14,r11,r9, r7\t\t@ (r14,r11) += s1*cPI3_8\r\n\tRSB\tr9, r9, #0\r\n\tSMULL\tr14,r5, r7, r5\t\t@ (r14,r5)   = s0*cPI3_8\r\n\tSMLAL\tr14,r5, r9, r6\t\t@ (r14,r5)  -= s1*cPI1_8\r\n\tMOV\tr11,r11,LSL #1\r\n\tMOV\tr5, r5, LSL #1\r\n\r\n\t@ XPROD31 ( s2, s3, cPI1_8, cPI3_8, &x[ 1], &x[ 3] )\r\n\t@ x[1] = s2*cPI1_8 + s3*cPI3_8     x[3] = s3*cPI1_8 - s2*cPI3_8\r\n\tSMULL\tr14,r9, r8, r6\t\t@ (r14,r9)   = s2*cPI1_8\r\n\tSMLAL\tr14,r9, r12,r7\t\t@ (r14,r9)  += s3*cPI3_8\r\n\tRSB\tr8,r8,#0\r\n\tSMULL\tr14,r12,r6, r12\t\t@ (r14,r12)  = s3*cPI1_8\r\n\tSMLAL\tr14,r12,r8, r7\t\t@ (r14,r12) -= s2*cPI3_8\r\n\tMOV\tr9, r9, LSL #1\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTMIA\tr1!,{r5,r9,r11,r12}\r\n\r\n\t@ block2\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[20]\r\n\t\t\t\t\t@ r6 = x[21]\r\n\t\t\t\t\t@ r9 = x[22]\r\n\t\t\t\t\t@ r10= x[23]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[4]\r\n\t\t\t\t\t@ r8 = x[5]\r\n\t\t\t\t\t@ r11= x[6]\r\n\t\t\t\t\t@ r12= x[7]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[20] - x[21]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[20] + x[21]  -> x[20]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[22] - x[23]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[22] + x[23]  -> x[22]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 5] - x[ 4]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 5] + x[ 4]  -> x[21]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 7] - x[ 6]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 7] + x[ 6]  -> x[23]\r\n\tLDR\tr14,cPI2_8\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tSUB\tr5, r5, r9\t\t@ r5 = s0 - s1\r\n\tADD\tr9, r5, r9, LSL #1\t@ r9 = s0 + s1\r\n\tSMULL\tr6, r5, r14,r5\t\t@ (r6,r5)  = (s0-s1)*cPI2_8\r\n\tSUB\tr12,r12,r8\t\t@ r12= s3 - s2\r\n\tADD\tr8, r12,r8, LSL #1\t@ r8 = s3 + s2\r\n\r\n\tSMULL\tr6, r8, r14,r8\t\t@ (r6,r8)  = (s3+s2)*cPI2_8\r\n\tMOV\tr5, r5, LSL #1\r\n\tSMULL\tr6, r9, r14,r9\t\t@ (r6,r9)  = (s0+s1)*cPI2_8\r\n\tMOV\tr8, r8, LSL #1\r\n\tSMULL\tr6, r12,r14,r12\t\t@ (r6,r12) = (s3-s2)*cPI2_8\r\n\tMOV\tr9, r9, LSL #1\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTMIA\tr1!,{r5,r8,r9,r12}\r\n\r\n\t@ block3\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[24]\r\n\t\t\t\t\t@ r6 = x[25]\r\n\t\t\t\t\t@ r9 = x[25]\r\n\t\t\t\t\t@ r10= x[26]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[8]\r\n\t\t\t\t\t@ r8 = x[9]\r\n\t\t\t\t\t@ r11= x[10]\r\n\t\t\t\t\t@ r12= x[11]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[24] - x[25]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[24] + x[25]  -> x[25]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[26] - x[27]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[26] + x[27]  -> x[26]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 9] - x[ 8]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 9] + x[ 8]  -> x[25]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[11] - x[10]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[11] + x[10]  -> x[27]\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tLDR\tr6,cPI3_8\r\n\tLDR\tr7,cPI1_8\r\n\r\n\t@ XNPROD31( s0, s1, cPI1_8, cPI3_8, &x[ 8], &x[10] )\r\n\t@ x[8] = s0*cPI1_8 - s1*cPI3_8     x[10] = s1*cPI1_8 + s0*cPI3_8\r\n\t@ stall Xscale\r\n\tSMULL\tr14,r11,r5, r6\t\t@ (r14,r11)  = s0*cPI3_8\r\n\tSMLAL\tr14,r11,r9, r7\t\t@ (r14,r11) += s1*cPI1_8\r\n\tRSB\tr9, r9, #0\r\n\tSMULL\tr14,r5, r7, r5\t\t@ (r14,r5)   = s0*cPI1_8\r\n\tSMLAL\tr14,r5, r9, r6\t\t@ (r14,r5)  -= s1*cPI3_8\r\n\tMOV\tr11,r11,LSL #1\r\n\tMOV\tr5, r5, LSL #1\r\n\r\n\t@ XPROD31 ( s2, s3, cPI3_8, cPI1_8, &x[ 9], &x[11] )\r\n\t@ x[9] = s2*cPI3_8 + s3*cPI1_8     x[11] = s3*cPI3_8 - s2*cPI1_8\r\n\tSMULL\tr14,r9, r8, r6\t\t@ (r14,r9)   = s2*cPI3_8\r\n\tSMLAL\tr14,r9, r12,r7\t\t@ (r14,r9)  += s3*cPI1_8\r\n\tRSB\tr8,r8,#0\r\n\tSMULL\tr14,r12,r6, r12\t\t@ (r14,r12)  = s3*cPI3_8\r\n\tSMLAL\tr14,r12,r8, r7\t\t@ (r14,r12) -= s2*cPI1_8\r\n\tMOV\tr9, r9, LSL #1\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTMIA\tr1!,{r5,r9,r11,r12}\r\n\r\n\t@ block4\r\n\tLDMIA\tr4,{r5,r6,r10,r11}\t@ r5 = x[28]\r\n\t\t\t\t\t@ r6 = x[29]\r\n\t\t\t\t\t@ r10= x[30]\r\n\t\t\t\t\t@ r11= x[31]\r\n\tLDMIA\tr1,{r8,r9,r12,r14}\t@ r8 = x[12]\r\n\t\t\t\t\t@ r9 = x[13]\r\n\t\t\t\t\t@ r12= x[14]\r\n\t\t\t\t\t@ r14= x[15]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[28] - x[29]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[28] + x[29]  -> x[28]\r\n\tSUB\tr7, r14,r12\t\t@ r7 = s3 = x[15] - x[14]\r\n\tADD\tr12,r7, r12, LSL #1\t@ r12=      x[15] + x[14]  -> x[31]\r\n\tSUB\tr10,r10,r11\t\t@ r10= s1 = x[30] - x[31]\r\n\tADD\tr11,r10,r11,LSL #1\t@ r11=      x[30] + x[31]  -> x[30]\r\n\tSUB\tr14, r8, r9\t\t@ r14= s2 = x[12] - x[13]\r\n\tADD\tr9, r14, r9, LSL #1\t@ r9 =      x[12] + x[13]  -> x[29]\r\n\tSTMIA\tr4!,{r6,r9,r11,r12}\r\n\tSTMIA\tr1!,{r5,r7,r10,r14}\r\n\r\n\t@ mdct_butterfly16 (1st version)\r\n\t@ block 1\r\n\tSUB\tr1,r1,#16*4\r\n\tADD\tr4,r1,#8*4\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[ 8]\r\n\t\t\t\t\t@ r6 = x[ 9]\r\n\t\t\t\t\t@ r9 = x[10]\r\n\t\t\t\t\t@ r10= x[11]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[0]\r\n\t\t\t\t\t@ r8 = x[1]\r\n\t\t\t\t\t@ r11= x[2]\r\n\t\t\t\t\t@ r12= x[3]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[ 8] - x[ 9]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[ 8] + x[ 9]  -> x[ 8]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[10] - x[11]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[10] + x[11]  -> x[10]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 1] - x[ 0]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 1] + x[ 0]  -> x[ 9]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 3] - x[ 2]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 3] + x[ 2]  -> x[11]\r\n\tLDR\tr14,cPI2_8\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tSUB\tr5, r5, r9\t\t@ r5 = s0 - s1\r\n\tADD\tr9, r5, r9, LSL #1\t@ r9 = s0 + s1\r\n\tSMULL\tr6, r5, r14,r5\t\t@ (r6,r5)  = (s0-s1)*cPI2_8\r\n\tSUB\tr12,r12,r8\t\t@ r12= s3 - s2\r\n\tADD\tr8, r12,r8, LSL #1\t@ r8 = s3 + s2\r\n\r\n\tSMULL\tr6, r8, r14,r8\t\t@ (r6,r8)  = (s3+s2)*cPI2_8\r\n\tMOV\tr5, r5, LSL #1\r\n\tSMULL\tr6, r9, r14,r9\t\t@ (r6,r9)  = (s0+s1)*cPI2_8\r\n\tMOV\tr8, r8, LSL #1\r\n\tSMULL\tr6, r12,r14,r12\t\t@ (r6,r12) = (s3-s2)*cPI2_8\r\n\tMOV\tr9, r9, LSL #1\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTMIA\tr1!,{r5,r8,r9,r12}\r\n\r\n\t@ block4\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[12]\r\n\t\t\t\t\t@ r6 = x[13]\r\n\t\t\t\t\t@ r9 = x[14]\r\n\t\t\t\t\t@ r10= x[15]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[ 4]\r\n\t\t\t\t\t@ r8 = x[ 5]\r\n\t\t\t\t\t@ r11= x[ 6]\r\n\t\t\t\t\t@ r12= x[ 7]\r\n\tSUB\tr14,r7, r8\t\t@ r14= s0 = x[ 4] - x[ 5]\r\n\tADD\tr8, r14,r8, LSL #1\t@ r8 =      x[ 4] + x[ 5]  -> x[13]\r\n\tSUB\tr7, r12,r11\t\t@ r7 = s1 = x[ 7] - x[ 6]\r\n\tADD\tr11,r7, r11, LSL #1\t@ r11=      x[ 7] + x[ 6]  -> x[15]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s2 = x[12] - x[13]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[12] + x[13]  -> x[12]\r\n\tSUB\tr12,r9, r10\t\t@ r12= s3 = x[14] - x[15]\r\n\tADD\tr10,r12,r10,LSL #1\t@ r10=      x[14] + x[15]  -> x[14]\r\n\tSTMIA\tr4!,{r6,r8,r10,r11}\r\n\tSTMIA\tr1!,{r5,r7,r12,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMDB\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMDB\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMIA\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMIA\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\t@ block 2\r\n\tADD\tr1,r1,#16*4-8*4\r\n\tADD\tr4,r1,#8*4\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[ 8]\r\n\t\t\t\t\t@ r6 = x[ 9]\r\n\t\t\t\t\t@ r9 = x[10]\r\n\t\t\t\t\t@ r10= x[11]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[0]\r\n\t\t\t\t\t@ r8 = x[1]\r\n\t\t\t\t\t@ r11= x[2]\r\n\t\t\t\t\t@ r12= x[3]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[ 8] - x[ 9]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[ 8] + x[ 9]  -> x[ 8]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[10] - x[11]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[10] + x[11]  -> x[10]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 1] - x[ 0]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 1] + x[ 0]  -> x[ 9]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 3] - x[ 2]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 3] + x[ 2]  -> x[11]\r\n\tLDR\tr14,cPI2_8\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tSUB\tr5, r5, r9\t\t@ r5 = s0 - s1\r\n\tADD\tr9, r5, r9, LSL #1\t@ r9 = s0 + s1\r\n\tSMULL\tr6, r5, r14,r5\t\t@ (r6,r5)  = (s0-s1)*cPI2_8\r\n\tSUB\tr12,r12,r8\t\t@ r12= s3 - s2\r\n\tADD\tr8, r12,r8, LSL #1\t@ r8 = s3 + s2\r\n\r\n\tSMULL\tr6, r8, r14,r8\t\t@ (r6,r8)  = (s3+s2)*cPI2_8\r\n\tMOV\tr5, r5, LSL #1\r\n\tSMULL\tr6, r9, r14,r9\t\t@ (r6,r9)  = (s0+s1)*cPI2_8\r\n\tMOV\tr8, r8, LSL #1\r\n\tSMULL\tr6, r12,r14,r12\t\t@ (r6,r12) = (s3-s2)*cPI2_8\r\n\tMOV\tr9, r9, LSL #1\r\n\tMOV\tr12,r12,LSL #1\r\n\tSTMIA\tr1!,{r5,r8,r9,r12}\r\n\r\n\t@ block4\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[12]\r\n\t\t\t\t\t@ r6 = x[13]\r\n\t\t\t\t\t@ r9 = x[14]\r\n\t\t\t\t\t@ r10= x[15]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[ 4]\r\n\t\t\t\t\t@ r8 = x[ 5]\r\n\t\t\t\t\t@ r11= x[ 6]\r\n\t\t\t\t\t@ r12= x[ 7]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s2 = x[12] - x[13]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[12] + x[13]  -> x[12]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s3 = x[14] - x[15]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[14] + x[15]  -> x[14]\r\n\tSUB\tr14,r7, r8\t\t@ r14= s0 = x[ 4] - x[ 5]\r\n\tADD\tr8, r14,r8, LSL #1\t@ r8 =      x[ 4] + x[ 5]  -> x[13]\r\n\tSUB\tr7, r12,r11\t\t@ r7 = s1 = x[ 7] - x[ 6]\r\n\tADD\tr11,r7, r11, LSL #1\t@ r11=      x[ 7] + x[ 6]  -> x[15]\r\n\tSTMIA\tr4!,{r6,r8,r10,r11}\r\n\tSTMIA\tr1!,{r5,r7,r9,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMDB\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMDB\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMIA\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMIA\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\tADD\tr1,r1,#8*4\r\n\tSUBS\tr0,r0,#64\r\n\tBGT\tmdct_bufferflies_loop3\r\n\r\n\tLDMFD\tr13,{r0-r3}\r\n\r\nmdct_bitreverseARM:\r\n\t@ r0 = points = n\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\n\tMOV\tr4, #0\t\t\t@ r4 = bit = 0\r\n\tADD\tr5, r1, r0, LSL #1\t@ r5 = w = x + (n>>1)\r\n\tADR\tr6, bitrev\r\n\tSUB\tr5, r5, #8\r\nbrev_lp:\r\n\tLDRB\tr7, [r6, r4, LSR #6]\r\n\tAND\tr8, r4, #0x3f\r\n\tLDRB\tr8, [r6, r8]\r\n\tADD\tr4, r4, #1\t\t@ bit++\r\n\t@ stall XScale\r\n\tORR\tr7, r7, r8, LSL #6\t@ r7 = bitrev[bit]\r\n\tMOV\tr7, r7, LSR r3\r\n\tADD\tr9, r1, r7, LSL #2\t@ r9 = xx = x + (b>>shift)\r\n\tCMP\tr5, r9\t\t\t@ if (w > xx)\r\n\tLDR\tr10,[r5],#-8\t\t@   r10 = w[0]\t\tw -= 2\r\n\tLDRGT\tr11,[r5,#12]\t\t@   r11 = w[1]\r\n\tLDRGT\tr12,[r9]\t\t@   r12 = xx[0]\r\n\tLDRGT\tr14,[r9,#4]\t\t@   r14 = xx[1]\r\n\tSTRGT\tr10,[r9]\t\t@   xx[0]= w[0]\r\n\tSTRGT\tr11,[r9,#4]\t\t@   xx[1]= w[1]\r\n\tSTRGT\tr12,[r5,#8]\t\t@   w[0] = xx[0]\r\n\tSTRGT\tr14,[r5,#12]\t\t@   w[1] = xx[1]\r\n\tCMP\tr5,r1\r\n\tBGT\tbrev_lp\r\n\r\n\t@ mdct_step7\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\n\tCMP\tr2, #4\t\t\t@ r5 = T = (step>=4) ?\r\n\tADR\tr7, .Lsincos_lookup\t@          sincos_lookup0 +\r\n\tADDLT\tr7, #4\t\t\t@          sincos_lookup1\r\n\tLDR\tr5, [r7]\r\n\tADD\tr5, r7\r\n\tADD\tr7, r1, r0, LSL #1\t@ r7 = w1 = x + (n>>1)\r\n\tADDGE\tr5, r5, r2, LSL #1\t@\t\t            (step>>1)\r\n\tADD\tr8, r5, #1024*4\t\t@ r8 = Ttop\r\nstep7_loop1:\r\n\tLDR\tr6, [r1]\t\t@ r6 = w0[0]\r\n\tLDR\tr9, [r1,#4]\t\t@ r9 = w0[1]\r\n\tLDR\tr10,[r7,#-8]!\t\t@ r10= w1[0]\tw1 -= 2\r\n\tLDR\tr11,[r7,#4]\t\t@ r11= w1[1]\r\n\tLDR\tr14,[r5,#4]\t\t@ r14= T[1]\r\n\tLDR\tr12,[r5],r2,LSL #2\t@ r12= T[0]\tT += step\r\n\r\n\tADD\tr6, r6, r10\t\t@ r6 = s0 = w0[0] + w1[0]\r\n\tSUB\tr10,r6, r10,LSL #1\t@ r10= s1b= w0[0] - w1[0]\r\n\tSUB\tr11,r11,r9\t\t@ r11= s1 = w1[1] - w0[1]\r\n\tADD\tr9, r11,r9, LSL #1\t@ r9 = s0b= w1[1] + w0[1]\r\n\r\n\t@ Can save 1 cycle by using SMULL SMLAL - at the cost of being\r\n\t@ 1 off.\r\n\tSMULL\tr0, r3, r6, r14\t\t@ (r0,r3)   = s0*T[1]\r\n\tSMULL\tr0, r4, r11,r12\t\t@ (r0,r4)  += s1*T[0] = s2\r\n\tADD\tr3, r3, r4\r\n\tSMULL\tr0, r14,r11,r14\t\t@ (r0,r14)  = s1*T[1]\r\n\tSMULL\tr0, r12,r6, r12\t\t@ (r0,r12) += s0*T[0] = s3\r\n\tSUB\tr14,r14,r12\r\n\r\n\t@ r9 = s0b<<1\r\n\t@ r10= s1b<<1\r\n\tADD\tr9, r3, r9, ASR #1\t@ r9 = s0b + s2\r\n\tSUB\tr3, r9, r3, LSL #1\t@ r3 = s0b - s2\r\n\r\n\tSUB\tr12,r14,r10,ASR #1\t@ r12= s3  - s1b\r\n\tADD\tr10,r14,r10,ASR #1\t@ r10= s3  + s1b\r\n\tSTR\tr9, [r1],#4\r\n\tSTR\tr10,[r1],#4\t\t@ w0 += 2\r\n\tSTR\tr3, [r7]\r\n\tSTR\tr12,[r7,#4]\r\n\r\n\tCMP\tr5,r8\r\n\tBLT\tstep7_loop1\r\n\r\nstep7_loop2:\r\n\tLDR\tr6, [r1]\t\t@ r6 = w0[0]\r\n\tLDR\tr9, [r1,#4]\t\t@ r9 = w0[1]\r\n\tLDR\tr10,[r7,#-8]!\t\t@ r10= w1[0]\tw1 -= 2\r\n\tLDR\tr11,[r7,#4]\t\t@ r11= w1[1]\r\n\tLDR\tr14,[r5,-r2,LSL #2]!\t@ r12= T[1]\tT -= step\r\n\tLDR\tr12,[r5,#4]\t\t@ r14= T[0]\r\n\r\n\tADD\tr6, r6, r10\t\t@ r6 = s0 = w0[0] + w1[0]\r\n\tSUB\tr10,r6, r10,LSL #1\t@ r10= s1b= w0[0] - w1[0]\r\n\tSUB\tr11,r11,r9\t\t@ r11= s1 = w1[1] - w0[1]\r\n\tADD\tr9, r11,r9, LSL #1\t@ r9 = s0b= w1[1] + w0[1]\r\n\r\n\t@ Can save 1 cycle by using SMULL SMLAL - at the cost of being\r\n\t@ 1 off.\r\n\tSMULL\tr0, r3, r6, r14\t\t@ (r0,r3)   = s0*T[0]\r\n\tSMULL\tr0, r4, r11,r12\t\t@ (r0,r4)  += s1*T[1] = s2\r\n\tADD\tr3, r3, r4\r\n\tSMULL\tr0, r14,r11,r14\t\t@ (r0,r14)  = s1*T[0]\r\n\tSMULL\tr0, r12,r6, r12\t\t@ (r0,r12) += s0*T[1] = s3\r\n\tSUB\tr14,r14,r12\r\n\r\n\t@ r9 = s0b<<1\r\n\t@ r10= s1b<<1\r\n\tADD\tr9, r3, r9, ASR #1\t@ r9 = s0b + s2\r\n\tSUB\tr3, r9, r3, LSL #1\t@ r3 = s0b - s2\r\n\r\n\tSUB\tr12,r14,r10,ASR #1\t@ r12= s3  - s1b\r\n\tADD\tr10,r14,r10,ASR #1\t@ r10= s3  + s1b\r\n\tSTR\tr9, [r1],#4\r\n\tSTR\tr10,[r1],#4\t\t@ w0 += 2\r\n\tSTR\tr3, [r7]\r\n\tSTR\tr12,[r7,#4]\r\n\r\n\tCMP\tr1,r7\r\n\tBLT\tstep7_loop2\r\n\r\n\tLDMFD\tr13!,{r0-r3}\r\n\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\tMOV\tr2, r2, ASR #2\t\t@ r2 = step >>= 2\r\n\tCMP\tr2, #0\r\n\tCMPNE\tr2, #1\r\n\tBEQ\tmdct_end\r\n\r\n\t@ step > 1 (default case)\r\n\tCMP\tr2, #4\t\t\t@ r5 = T = (step>=4) ?\r\n\tADR\tr7, .Lsincos_lookup\t@          sincos_lookup0 +\r\n\tADDLT\tr7, #4\t\t\t@          sincos_lookup1\r\n\tLDR\tr5, [r7]\r\n\tADD\tr5, r7\r\n\tADD\tr7, r1, r0, LSL #1\t@ r7 = iX = x + (n>>1)\r\n\tADDGE\tr5, r5, r2, LSL #1\t@\t\t            (step>>1)\r\nmdct_step8_default:\r\n\tLDR\tr6, [r1],#4\t\t@ r6 =  s0 = x[0]\r\n\tLDR\tr8, [r1],#4\t\t@ r8 = -s1 = x[1]\r\n\tLDR\tr12,[r5,#4]       \t@ r12= T[1]\r\n\tLDR\tr14,[r5],r2,LSL #2\t@ r14= T[0]\tT += step\r\n\tRSB\tr8, r8, #0\t\t@ r8 = s1\r\n\r\n\t@ XPROD31(s0, s1, T[0], T[1], x, x+1)\r\n\t@ x[0] = s0 * T[0] + s1 * T[1]      x[1] = s1 * T[0] - s0 * T[1]\r\n\tSMULL\tr9, r10, r8, r12\t@ (r9,r10)  = s1 * T[1]\r\n\tCMP\tr1, r7\r\n\tSMLAL\tr9, r10, r6, r14\t@ (r9,r10) += s0 * T[0]\r\n\tRSB\tr6, r6, #0\t\t@ r6 = -s0\r\n\tSMULL\tr9, r11, r8, r14\t@ (r9,r11)  = s1 * T[0]\r\n\tMOV\tr10,r10,LSL #1\r\n\tSMLAL\tr9, r11, r6, r12\t@ (r9,r11) -= s0 * T[1]\r\n\tSTR\tr10,[r1,#-8]\r\n\tMOV\tr11,r11,LSL #1\r\n\tSTR\tr11,[r1,#-4]\r\n\tBLT\tmdct_step8_default\r\n\r\nmdct_end:\r\n\tMOV\tr0, r2\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\ncPI1_8:\r\n\t.word\t0x7641af3d\r\ncPI2_8:\r\n\t.word\t0x5a82799a\r\ncPI3_8:\r\n\t.word\t0x30fbc54d\r\nbitrev:\r\n\t.byte\t0\r\n\t.byte\t32\r\n\t.byte\t16\r\n\t.byte\t48\r\n\t.byte\t8\r\n\t.byte\t40\r\n\t.byte\t24\r\n\t.byte\t56\r\n\t.byte\t4\r\n\t.byte\t36\r\n\t.byte\t20\r\n\t.byte\t52\r\n\t.byte\t12\r\n\t.byte\t44\r\n\t.byte\t28\r\n\t.byte\t60\r\n\t.byte\t2\r\n\t.byte\t34\r\n\t.byte\t18\r\n\t.byte\t50\r\n\t.byte\t10\r\n\t.byte\t42\r\n\t.byte\t26\r\n\t.byte\t58\r\n\t.byte\t6\r\n\t.byte\t38\r\n\t.byte\t22\r\n\t.byte\t54\r\n\t.byte\t14\r\n\t.byte\t46\r\n\t.byte\t30\r\n\t.byte\t62\r\n\t.byte\t1\r\n\t.byte\t33\r\n\t.byte\t17\r\n\t.byte\t49\r\n\t.byte\t9\r\n\t.byte\t41\r\n\t.byte\t25\r\n\t.byte\t57\r\n\t.byte\t5\r\n\t.byte\t37\r\n\t.byte\t21\r\n\t.byte\t53\r\n\t.byte\t13\r\n\t.byte\t45\r\n\t.byte\t29\r\n\t.byte\t61\r\n\t.byte\t3\r\n\t.byte\t35\r\n\t.byte\t19\r\n\t.byte\t51\r\n\t.byte\t11\r\n\t.byte\t43\r\n\t.byte\t27\r\n\t.byte\t59\r\n\t.byte\t7\r\n\t.byte\t39\r\n\t.byte\t23\r\n\t.byte\t55\r\n\t.byte\t15\r\n\t.byte\t47\r\n\t.byte\t31\r\n\t.byte\t63\r\n\r\n.Lsincos_lookup:\r\n\t.word\tsincos_lookup0-.Lsincos_lookup\r\n\t.word\tsincos_lookup1-(.Lsincos_lookup+4)\r\n\r\n\t@ END\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/mdctLARM.s",
    "content": "@ Tremolo library\r\n@-----------------------------------------------------------------------\r\n@ Copyright (C) 2002-2009, Xiph.org Foundation\r\n@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n@ All rights reserved.\r\n\r\n@ Redistribution and use in source and binary forms, with or without\r\n@ modification, are permitted provided that the following conditions\r\n@ are met:\r\n\r\n@     * Redistributions of source code must retain the above copyright\r\n@ notice, this list of conditions and the following disclaimer.\r\n@     * Redistributions in binary form must reproduce the above\r\n@ copyright notice, this list of conditions and the following disclaimer\r\n@ in the documentation and/or other materials provided with the\r\n@ distribution.\r\n@     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n@ Productions Ltd nor the names of its contributors may be used to\r\n@ endorse or promote products derived from this software without\r\n@ specific prior written permission.\r\n@\r\n@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n@ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n@ ----------------------------------------------------------------------\r\n\r\n    .text\r\n\r\n\t@ low accuracy version\r\n\r\n\t.global mdct_backwardARM\r\n\t.global mdct_shift_right\r\n\t.global mdct_unroll_prelap\r\n\t.global mdct_unroll_part2\r\n\t.global mdct_unroll_part3\r\n\t.global mdct_unroll_postlap\r\n\r\n\t.extern\tsincos_lookup0\r\n\t.extern\tsincos_lookup1\r\n\r\nmdct_unroll_prelap:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = r\r\n\t@ r3 = step\r\n\tSTMFD\tr13!,{r4-r7,r14}\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr3, r3, LSL #1\r\n\tSUB\tr1, r2, r1\t\t@ r1 = r - post\r\n\tSUBS\tr1, r1, #16\t\t@ r1 = r - post - 16\r\n\tBLT\tunroll_over\r\nunroll_loop:\r\n\tLDMDB\tr2!,{r5,r6,r7,r12}\r\n\r\n\tMOV\tr5, r5, ASR #9\t\t@ r5 = (*--r)>>9\r\n\tMOV\tr6, r6, ASR #9\t\t@ r6 = (*--r)>>9\r\n\tMOV\tr7, r7, ASR #9\t\t@ r7 = (*--r)>>9\r\n\tMOV\tr12,r12,ASR #9\t\t@ r12= (*--r)>>9\r\n\r\n\tMOV\tr14,r12,ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr12,r4, r14,ASR #31\r\n\tSTRH\tr12,[r0], r3\r\n\r\n\tMOV\tr14,r7, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr7, r4, r14,ASR #31\r\n\tSTRH\tr7, [r0], r3\r\n\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r3\r\n\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\r\n\tSUBS\tr1, r1, #16\r\n\tBGE\tunroll_loop\r\n\r\nunroll_over:\r\n\tADDS\tr1, r1, #16\r\n\tBLE\tunroll_end\r\nunroll_loop2:\r\n\tLDR\tr5,[r2,#-4]!\r\n\t@ stall\r\n\t@ stall (Xscale)\r\n\tMOV\tr5, r5, ASR #9\t\t@ r5 = (*--r)>>9\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop2\r\nunroll_end:\r\n\tLDMFD\tr13!,{r4-r7,PC}\r\n\r\nmdct_unroll_postlap:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = l\r\n\t@ r3 = step\r\n\tSTMFD\tr13!,{r4-r7,r14}\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr3, r3, LSL #1\r\n\tSUB\tr1, r1, r2\t\t@ r1 = post - l\r\n\tMOV\tr1, r1, ASR #1\t\t@ r1 = (post - l)>>1\r\n\tSUBS\tr1, r1, #16\t\t@ r1 = ((post - l)>>1) - 4\r\n\tBLT\tunroll_over3\r\nunroll_loop3:\r\n\tLDR\tr12,[r2],#8\r\n\tLDR\tr7, [r2],#8\r\n\tLDR\tr6, [r2],#8\r\n\tLDR\tr5, [r2],#8\r\n\r\n\tRSB\tr12,r12,#0\r\n\tRSB\tr5, r5, #0\r\n\tRSB\tr6, r6, #0\r\n\tRSB\tr7, r7, #0\r\n\r\n\tMOV\tr12, r12,ASR #9\t\t@ r12= (-*l)>>9\r\n\tMOV\tr5,  r5, ASR #9\t\t@ r5 = (-*l)>>9\r\n\tMOV\tr6,  r6, ASR #9\t\t@ r6 = (-*l)>>9\r\n\tMOV\tr7,  r7, ASR #9\t\t@ r7 = (-*l)>>9\r\n\r\n\tMOV\tr14,r12,ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr12,r4, r14,ASR #31\r\n\tSTRH\tr12,[r0], r3\r\n\r\n\tMOV\tr14,r7, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr7, r4, r14,ASR #31\r\n\tSTRH\tr7, [r0], r3\r\n\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r3\r\n\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\r\n\tSUBS\tr1, r1, #16\r\n\tBGE\tunroll_loop3\r\n\r\nunroll_over3:\r\n\tADDS\tr1, r1, #16\r\n\tBLE\tunroll_over4\r\nunroll_loop4:\r\n\tLDR\tr5,[r2], #8\r\n\t@ stall\r\n\t@ stall (Xscale)\r\n\tRSB\tr5, r5, #0\r\n\tMOV\tr5, r5, ASR #9\t\t@ r5 = (-*l)>>9\r\n\tMOV\tr14,r5, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr5, r4, r14,ASR #31\r\n\tSTRH\tr5, [r0], r3\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop4\r\nunroll_over4:\r\n\tLDMFD\tr13!,{r4-r7,PC}\r\n\r\nmdct_unroll_part2:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = l\r\n\t@ r3 = r\r\n\t@ <> = step\r\n\t@ <> = wL\r\n\t@ <> = wR\r\n\tMOV\tr12,r13\r\n\tSTMFD\tr13!,{r4,r6-r11,r14}\r\n\tLDMFD\tr12,{r8,r9,r10}\t\t@ r8 = step\r\n\t\t\t\t\t@ r9 = wL\r\n\t\t\t\t\t@ r10= wR\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr8, r8, LSL #1\r\n\tSUBS\tr1, r3, r1\t\t@ r1 = (r - post)\r\n\tBLE\tunroll_over5\r\nunroll_loop5:\r\n\tLDR\tr12,[r2, #-8]!\t\t@ r12= *l       (but l -= 2 first)\r\n\tLDR\tr7, [r3, #-4]!\t\t@ r7 = *--r\r\n\tLDRB\tr6, [r10,#-1]!\t\t@ r6 = *--wR\r\n\tLDRB\tr11,[r9],#1\t\t@ r11= *wL++\r\n\r\n\tMOV\tr12, r12, ASR #8\r\n\t@ Can save a cycle here, at the cost of 1bit errors in rounding\r\n\tMUL\tr11,r12,r11\t\t@ r11  = *l   * *wL++\r\n\tMOV\tr7, r7, ASR #8\r\n\tMLA\tr6, r7, r6, r11\t\t@ r6   = *--r * *--wR\r\n\tMOV\tr6, r6, ASR #9\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r8\r\n\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop5\r\n\r\nunroll_over5:\r\n\tLDMFD\tr13!,{r4,r6-r11,PC}\r\n\r\nmdct_unroll_part3:\r\n\t@ r0 = out\r\n\t@ r1 = post\r\n\t@ r2 = l\r\n\t@ r3 = r\r\n\t@ <> = step\r\n\t@ <> = wL\r\n\t@ <> = wR\r\n\tMOV\tr12,r13\r\n\tSTMFD\tr13!,{r4,r6-r11,r14}\r\n\tLDMFD\tr12,{r8,r9,r10}\t\t@ r8 = step\r\n\t\t\t\t\t@ r9 = wL\r\n\t\t\t\t\t@ r10= wR\r\n\tMVN\tr4, #0x8000\r\n\tMOV\tr8, r8, LSL #1\r\n\tSUBS\tr1, r1, r3\t\t@ r1 = (post - r)\r\n\tBLE\tunroll_over6\r\nunroll_loop6:\r\n\tLDR\tr12,[r2],#8\t\t@ r12= *l       (but l += 2 first)\r\n\tLDR\tr7, [r3],#4\t\t@ r7 = *r++\r\n\tLDRB\tr11,[r9],#1\t\t@ r11= *wL++\r\n\tLDRB\tr6, [r10,#-1]!\t\t@ r6 = *--wR\r\n\r\n\t@ Can save a cycle here, at the cost of 1bit errors in rounding\r\n\tMOV\tr12,r12,ASR #8\r\n\tMUL\tr11,r12,r11\t\t@ (r14,r11)  = *l   * *wL++\r\n\tMOV\tr7, r7, ASR #8\r\n\tMUL\tr6, r7, r6\t\t@ (r14,r6)   = *--r * *--wR\r\n\tSUB\tr6, r6, r11\r\n\tMOV\tr6, r6, ASR #9\r\n\tMOV\tr14,r6, ASR #15\r\n\tTEQ\tr14,r14,ASR #31\t\t@ if r14==0 || r14==-1 then in range\r\n\tEORNE\tr6, r4, r14,ASR #31\r\n\tSTRH\tr6, [r0], r8\r\n\r\n\tSUBS\tr1, r1, #4\r\n\tBGT\tunroll_loop6\r\n\r\nunroll_over6:\r\n\tLDMFD\tr13!,{r4,r6-r11,PC}\r\n\r\nmdct_shift_right:\r\n\t@ r0 = n\r\n\t@ r1 = in\r\n\t@ r2 = right\r\n\tSTMFD\tr13!,{r4-r11,r14}\r\n\r\n\tMOV\tr0, r0, LSR #2\t\t@ n >>= 2\r\n\tADD\tr1, r1, #4\r\n\r\n\tSUBS\tr0, r0,\t#8\r\n\tBLT\tsr_less_than_8\r\nsr_loop:\r\n\tLDR\tr3, [r1], #8\r\n\tLDR\tr4, [r1], #8\r\n\tLDR\tr5, [r1], #8\r\n\tLDR\tr6, [r1], #8\r\n\tLDR\tr7, [r1], #8\r\n\tLDR\tr8, [r1], #8\r\n\tLDR\tr12,[r1], #8\r\n\tLDR\tr14,[r1], #8\r\n\tSUBS\tr0, r0, #8\r\n\tSTMIA\tr2!,{r3,r4,r5,r6,r7,r8,r12,r14}\r\n\tBGE\tsr_loop\r\nsr_less_than_8:\r\n\tADDS\tr0, r0, #8\r\n\tBEQ\tsr_end\r\nsr_loop2:\r\n\tLDR\tr3, [r1], #8\r\n\tSUBS\tr0, r0, #1\r\n\tSTR\tr3, [r2], #4\r\n\tBGT\tsr_loop2\r\nsr_end:\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\nmdct_backwardARM:\r\n\t@ r0 = n\r\n\t@ r1 = in\r\n\tSTMFD\tr13!,{r4-r11,r14}\r\n\r\n\tMOV\tr2, #1<<4\t@ r2 = 1<<shift\r\n\tMOV\tr3, #13-4\t@ r3 = 13-shift\r\nfind_shift_loop:\r\n\tTST\tr0, r2\t\t@ if (n & (1<<shift)) == 0\r\n\tMOV\tr2, r2, LSL #1\r\n\tSUBEQ\tr3, r3, #1\t@ shift--\r\n\tBEQ\tfind_shift_loop\r\n\tMOV\tr2, #2\r\n\tMOV\tr2, r2, LSL r3\t@ r2 = step = 2<<shift\r\n\r\n\t@ presymmetry\r\n\t@ r0 = n (a multiple of 4)\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\n\tADD\tr4, r1, r0, LSL #1\t@ r4 = aX = in+(n>>1)\r\n\tADD\tr14,r1, r0\t\t@ r14= in+(n>>2)\r\n\tSUB\tr4, r4, #3*4\t\t@ r4 = aX = in+n2-3\r\n\tLDR\tr5, =sincos_lookup0\t@ r5 = T=sincos_lookup0\r\n\r\npresymmetry_loop1:\r\n\tLDR\tr7, [r4,#8]\t\t@ r6 = s2 = aX[2]\r\n\tLDRB\tr11,[r5,#1]\t\t@ r11= T[1]\r\n\tLDR\tr6, [r4],#-16\t\t@ r6 = s0 = aX[0]\r\n\tLDRB\tr10,[r5],r2\t\t@ r10= T[0]   T += step\r\n\tMOV\tr6, r6, ASR #8\r\n\tMOV\tr7, r7, ASR #8\r\n\r\n\t@ XPROD31(s0, s2, T[0], T[1], 0xaX[0], &ax[2])\r\n\tMUL\tr9, r6, r10\t\t@ r9   = s0*T[0]\r\n\tRSB\tr6, r6, #0\r\n\tMLA\tr9, r7, r11,r9\t\t@ r9  += s2*T[1]\r\n\tCMP\tr4, r14\r\n\tMUL\tr12,r7, r10\t\t@ r12  = s2*T[0]\r\n\tSTR\tr9, [r4,#16]\t\t@ aX[0] = r9\r\n\tMLA\tr12,r6, r11,r12\t\t@ r12 -= s0*T[1]\r\n\tSTR\tr12,[r4,#8+16]\t\t@ aX[2] = r12\r\n\r\n\tBGE\tpresymmetry_loop1\t@ while (aX >= in+n4)\r\n\r\npresymmetry_loop2:\r\n\tLDR\tr6, [r4],#-16\t\t@ r6 = s0 = aX[0]\r\n\tLDRB\tr10,[r5,#1]\t\t@ r10= T[1]\r\n\tLDR\tr7, [r4,#16+8]\t\t@ r6 = s2 = aX[2]\r\n\tLDRB\tr11,[r5],-r2\t\t@ r11= T[0]   T -= step\r\n\tMOV\tr6, r6, ASR #8\r\n\tMOV\tr7, r7, ASR #8\r\n\r\n\t@ XPROD31(s0, s2, T[1], T[0], 0xaX[0], &ax[2])\r\n\tMUL\tr9, r6, r10\t\t@ r9   = s0*T[1]\r\n\tRSB\tr6, r6, #0\r\n\tMLA\tr9, r7, r11,r9\t\t@ r9  += s2*T[0]\r\n\tCMP\tr4, r1\r\n\tMUL\tr12,r7, r10\t\t@ r12  = s2*T[1]\r\n\tSTR\tr9, [r4,#16]\t\t@ aX[0] = r9\r\n\tMLA\tr12,r6, r11,r12\t\t@ r12 -= s0*T[0]\r\n\tSTR\tr12,[r4,#8+16]\t\t@ aX[2] = r12\r\n\r\n\tBGE\tpresymmetry_loop2\t@ while (aX >= in)\r\n\r\n\t@ r0 = n\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\tSTMFD\tr13!,{r3}\r\n\tLDR\tr5, =sincos_lookup0\t@ r5 = T=sincos_lookup0\r\n\tADD\tr4, r1, r0, LSL #1\t@ r4 = aX = in+(n>>1)\r\n\tSUB\tr4, r4, #4*4\t\t@ r4 = aX = in+(n>>1)-4\r\n\tLDRB\tr11,[r5,#1]\t\t@ r11= T[1]\r\n\tLDRB\tr10,[r5],r2\t\t@ r10= T[0]    T += step\r\npresymmetry_loop3:\r\n\tLDR\tr8, [r1],#16 \t\t@ r8 = ro0 = bX[0]\r\n\tLDR\tr9, [r1,#8-16]\t\t@ r9 = ro2 = bX[2]\r\n\tLDR\tr6, [r4],#-16\t\t@ r6 = ri0 = aX[0]\r\n\tLDR\tr7, [r4,#8+16]\t\t@ r7 = ri2 = aX[2]\r\n\tMOV\tr8, r8, ASR #8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMOV\tr6, r6, ASR #8\r\n\r\n\t@ XNPROD31( ro2, ro0, T[1], T[0], 0xaX[0], &aX[2] )\r\n\t@ aX[0] = (ro2*T[1] - ro0*T[0])>>31 aX[2] = (ro0*T[1] + ro2*T[0])>>31\r\n\tMUL\tr12,r8, r11\t\t@ r12  = ro0*T[1]\r\n\tMOV\tr7, r7, ASR #8\r\n\tMLA\tr12,r9, r10,r12\t\t@ r12 += ro2*T[0]\r\n\tRSB\tr8, r8, #0\t\t@ r8 = -ro0\r\n\tMUL\tr3, r9, r11\t\t@ r3   = ro2*T[1]\r\n\tLDRB\tr11,[r5,#1]\t\t@ r11= T[1]\r\n\tMLA\tr3, r8, r10,r3\t\t@ r3  -= ro0*T[0]\r\n\tLDRB\tr10,[r5],r2\t\t@ r10= T[0]    T += step\r\n\tSTR\tr12,[r4,#16+8]\r\n\tSTR\tr3, [r4,#16]\r\n\r\n\t@ XNPROD31( ri2, ri0, T[0], T[1], 0xbX[0], &bX[2] )\r\n\t@ bX[0] = (ri2*T[0] - ri0*T[1])>>31 bX[2] = (ri0*T[0] + ri2*T[1])>>31\r\n\tMUL\tr12,r6, r10\t\t@ r12  = ri0*T[0]\r\n\tRSB\tr6, r6, #0\t\t@ r6 = -ri0\r\n\tMLA\tr12,r7, r11,r12\t\t@ r12 += ri2*T[1]\r\n\tCMP\tr4, r1\r\n\tMUL\tr3, r7, r10\t\t@ r3   = ri2*T[0]\r\n\tSTR\tr12,[r1,#8-16]\r\n\tMLA\tr3, r6, r11,r3\t\t@ r3  -= ri0*T[1]\r\n\tSTR\tr3, [r1,#-16]\r\n\r\n\tBGE\tpresymmetry_loop3\r\n\r\n\tSUB\tr1,r1,r0\t\t@ r1 = in -= n>>2 (i.e. restore in)\r\n\r\n\tLDR\tr3,[r13]\r\n\tSTR\tr2,[r13,#-4]!\r\n\r\n\t@ mdct_butterflies\r\n\t@ r0 = n  = (points * 2)\r\n\t@ r1 = in = x\r\n\t@ r2 = i\r\n\t@ r3 = shift\r\n\tSTMFD\tr13!,{r0-r1}\r\n\tRSBS\tr4,r3,#6\t\t@ r4 = stages = 7-shift then --stages\r\n\tLDR\tr5,=sincos_lookup0\r\n\tBLE\tno_generics\r\n\tMOV\tr14,#4\t\t\t@ r14= 4               (i=0)\r\n\tMOV\tr6, r14,LSL r3\t\t@ r6 = (4<<i)<<shift\r\nmdct_butterflies_loop1:\r\n\tMOV\tr0, r0, LSR #1\t\t@ r0 = points>>i = POINTS\r\n\tMOV\tr2, r14,LSR #2\t\t@ r2 = (1<<i)-j        (j=0)\r\n\tSTMFD\tr13!,{r4,r14}\r\nmdct_butterflies_loop2:\r\n\r\n\t@ mdct_butterfly_generic(x+POINTS*j, POINTS, 4<<(i+shift))\r\n\t@ mdct_butterfly_generic(r1, r0, r6)\r\n\t@ r0 = points\r\n\t@ r1 = x\r\n\t@ preserve r2 (external loop counter)\r\n\t@ preserve r3\r\n\t@ preserve r4 (external loop counter)\r\n\t@ r5 = T = sincos_lookup0\r\n\t@ r6 = step\r\n\t@ preserve r14\r\n\r\n\tSTR\tr2,[r13,#-4]!\t\t@ stack r2\r\n\tADD\tr1,r1,r0,LSL #1\t\t@ r1 = x2+4 = x + (POINTS>>1)\r\n\tADD\tr7,r1,r0,LSL #1\t\t@ r7 = x1+4 = x + POINTS\r\n\tADD\tr12,r5,#1024\t\t@ r12= sincos_lookup0+1024\r\n\r\nmdct_bufferfly_generic_loop1:\r\n\tLDMDB\tr7!,{r2,r3,r8,r11}\t@ r2 = x1[0]\r\n\t\t\t\t\t@ r3 = x1[1]\r\n\t\t\t\t\t@ r8 = x1[2]\r\n\t\t\t\t\t@ r11= x1[3]    x1 -= 4\r\n\tLDMDB\tr1!,{r4,r9,r10,r14}\t@ r4 = x2[0]\r\n\t\t\t\t\t@ r9 = x2[1]\r\n\t\t\t\t\t@ r10= x2[2]\r\n\t\t\t\t\t@ r14= x2[3]    x2 -= 4\r\n\r\n\tSUB\tr2, r2, r3\t\t@ r2 = s0 = x1[0] - x1[1]\r\n\tADD\tr3, r2, r3, LSL #1\t@ r3 =      x1[0] + x1[1] (-> x1[0])\r\n\tSUB\tr11,r11,r8\t\t@ r11= s1 = x1[3] - x1[2]\r\n\tADD\tr8, r11,r8, LSL #1\t@ r8 =      x1[3] + x1[2] (-> x1[2])\r\n\tSUB\tr9, r9, r4\t\t@ r9 = s2 = x2[1] - x2[0]\r\n\tADD\tr4, r9, r4, LSL #1\t@ r4 =      x2[1] + x2[0] (-> x1[1])\r\n\tSUB\tr14,r14,r10\t\t@ r14= s3 = x2[3] - x2[2]\r\n\tADD\tr10,r14,r10,LSL #1\t@ r10=      x2[3] + x2[2] (-> x1[3])\r\n\tSTMIA\tr7,{r3,r4,r8,r10}\r\n\r\n\t@ r0 = points\r\n\t@ r1 = x2\r\n\t@ r2 = s0\r\n\t@ r3 free\r\n\t@ r4 free\r\n\t@ r5 = T\r\n\t@ r6 = step\r\n\t@ r7 = x1\r\n\t@ r8 free\r\n\t@ r9 = s2\r\n\t@ r10 free\r\n\t@ r11= s1\r\n\t@ r12= limit\r\n\t@ r14= s3\r\n\r\n\tLDRB\tr8, [r5,#1]\t\t@ r8 = T[1]\r\n\tLDRB\tr10,[r5],r6\t\t@ r10= T[0]\t\tT += step\r\n\tMOV\tr2, r2, ASR #8\r\n\tMOV\tr11,r11,ASR #8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMOV\tr14,r14,ASR #8\r\n\r\n\t@ XPROD31(s1, s0, T[0], T[1], &x2[0], &x2[2])\r\n\t@ x2[0] = (s1*T[0] + s0*T[1])>>31     x2[2] = (s0*T[0] - s1*T[1])>>31\r\n\t@ stall Xscale\r\n\tMUL\tr3, r2, r8\t\t@ r3   = s0*T[1]\r\n\tMLA\tr3, r11,r10,r3\t\t@ r3  += s1*T[0]\r\n\tRSB\tr11,r11,#0\r\n\tMUL\tr4, r8, r11\t\t@ r4   = -s1*T[1]\r\n\tMLA\tr4, r2, r10,r4\t\t@ r4  += s0*T[0] = Value for x2[2]\r\n\tMOV\tr2, r3\t\t\t@ r2 = r3 = Value for x2[0]\r\n\r\n\t@ XPROD31(s2, s3, T[0], T[1], &x2[1], &x2[3])\r\n\t@ x2[1] = (s2*T[0] + s3*T[1])>>31     x2[3] = (s3*T[0] - s2*T[1])>>31\r\n\tMUL\tr3, r9, r10\t\t@ r3   = s2*T[0]\r\n\tMLA\tr3, r14,r8, r3\t\t@ r3  += s3*T[1] = Value for x2[1]\r\n\tRSB\tr9, r9, #0\r\n\tMUL\tr11,r14,r10\t\t@ r11  = s3*T[0]\r\n\tMLA\tr11,r9, r8, r11\t\t@ r11 -= s2*T[1] = Value for x2[3]\r\n\tCMP\tr5, r12\r\n\r\n\tSTMIA\tr1,{r2,r3,r4,r11}\r\n\r\n\tBLT\tmdct_bufferfly_generic_loop1\r\n\r\n\tSUB\tr12,r12,#1024\r\nmdct_bufferfly_generic_loop2:\r\n\tLDMDB\tr7!,{r2,r3,r9,r10}\t@ r2 = x1[0]\r\n\t\t\t\t\t@ r3 = x1[1]\r\n\t\t\t\t\t@ r9 = x1[2]\r\n\t\t\t\t\t@ r10= x1[3]    x1 -= 4\r\n\tLDMDB\tr1!,{r4,r8,r11,r14}\t@ r4 = x2[0]\r\n\t\t\t\t\t@ r8 = x2[1]\r\n\t\t\t\t\t@ r11= x2[2]\r\n\t\t\t\t\t@ r14= x2[3]    x2 -= 4\r\n\r\n\tSUB\tr2, r2, r3\t\t@ r2 = s0 = x1[0] - x1[1]\r\n\tADD\tr3, r2, r3, LSL #1\t@ r3 =      x1[0] + x1[1] (-> x1[0])\r\n\tSUB\tr9, r9,r10\t\t@ r9 = s1 = x1[2] - x1[3]\r\n\tADD\tr10,r9,r10, LSL #1\t@ r10=      x1[2] + x1[3] (-> x1[2])\r\n\tSUB\tr4, r4, r8\t\t@ r4 = s2 = x2[0] - x2[1]\r\n\tADD\tr8, r4, r8, LSL #1\t@ r8 =      x2[0] + x2[1] (-> x1[1])\r\n\tSUB\tr14,r14,r11\t\t@ r14= s3 = x2[3] - x2[2]\r\n\tADD\tr11,r14,r11,LSL #1\t@ r11=      x2[3] + x2[2] (-> x1[3])\r\n\tSTMIA\tr7,{r3,r8,r10,r11}\r\n\r\n\t@ r0 = points\r\n\t@ r1 = x2\r\n\t@ r2 = s0\r\n\t@ r3 free\r\n\t@ r4 = s2\r\n\t@ r5 = T\r\n\t@ r6 = step\r\n\t@ r7 = x1\r\n\t@ r8 free\r\n\t@ r9 = s1\r\n\t@ r10 free\r\n\t@ r11 free\r\n\t@ r12= limit\r\n\t@ r14= s3\r\n\r\n\tLDRB\tr8, [r5,#1]\t\t@ r8 = T[1]\r\n\tLDRB\tr10,[r5],-r6\t\t@ r10= T[0]\t\tT -= step\r\n\tMOV\tr2, r2, ASR #8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMOV\tr4, r4, ASR #8\r\n\tMOV\tr14,r14,ASR #8\r\n\r\n\t@ XNPROD31(s0, s1, T[0], T[1], &x2[0], &x2[2])\r\n\t@ x2[0] = (s0*T[0] - s1*T[1])>>31     x2[2] = (s1*T[0] + s0*T[1])>>31\r\n\t@ stall Xscale\r\n\tMUL\tr11,r2, r8\t\t@ r11  = s0*T[1]\r\n\tMLA\tr11,r9, r10,r11\t\t@ r11 += s1*T[0]\r\n\tRSB\tr9, r9, #0\r\n\tMUL\tr2, r10,r2\t\t@ r2   = s0*T[0]\r\n\tMLA\tr2, r9, r8, r2\t\t@ r2  += -s1*T[1] = Value for x2[0]\r\n\tMOV\tr9, r11\t\t\t@ r9 = r11 = Value for x2[2]\r\n\r\n\t@ XNPROD31(s3, s2, T[0], T[1], &x2[1], &x2[3])\r\n\t@ x2[1] = (s3*T[0] - s2*T[1])>>31     x2[3] = (s2*T[0] + s3*T[1])>>31\r\n\tMUL\tr11,r4, r10\t\t@ r11   = s2*T[0]\r\n\tMLA\tr11,r14,r8, r11\t\t@ r11  += s3*T[1] = Value for x2[3]\r\n\tRSB\tr4, r4, #0\r\n\tMUL\tr3, r14,r10\t\t@ r3   = s3*T[0]\r\n\tMLA\tr3, r4, r8, r3\t\t@ r3  -= s2*T[1] = Value for x2[1]\r\n\tCMP\tr5, r12\r\n\r\n\tSTMIA\tr1,{r2,r3,r9,r11}\r\n\r\n\tBGT\tmdct_bufferfly_generic_loop2\r\n\r\n\tLDR\tr2,[r13],#4\t\t@ unstack r2\r\n\tADD\tr1, r1, r0, LSL #2\t@ r1 = x+POINTS*j\r\n\t@ stall Xscale\r\n\tSUBS\tr2, r2, #1\t\t@ r2--                 (j++)\r\n\tBGT\tmdct_butterflies_loop2\r\n\r\n\tLDMFD\tr13!,{r4,r14}\r\n\r\n\tLDR\tr1,[r13,#4]\r\n\r\n\tSUBS\tr4, r4, #1\t\t@ stages--\r\n\tMOV\tr14,r14,LSL #1\t\t@ r14= 4<<i            (i++)\r\n\tMOV\tr6, r6, LSL #1\t\t@ r6 = step <<= 1      (i++)\r\n\tBGE\tmdct_butterflies_loop1\r\n\tLDMFD\tr13,{r0-r1}\r\n\r\nno_generics:\r\n\t@ mdct_butterflies part2 (loop around mdct_bufferfly_32)\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\nmdct_bufferflies_loop3:\r\n\t@ mdct_bufferfly_32\r\n\r\n\t@ block1\r\n\tADD\tr4, r1, #16*4\t\t@ r4 = &in[16]\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[16]\r\n\t\t\t\t\t@ r6 = x[17]\r\n\t\t\t\t\t@ r9 = x[18]\r\n\t\t\t\t\t@ r10= x[19]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[0]\r\n\t\t\t\t\t@ r8 = x[1]\r\n\t\t\t\t\t@ r11= x[2]\r\n\t\t\t\t\t@ r12= x[3]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[16] - x[17]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[16] + x[17]  -> x[16]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[18] - x[19]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[18] + x[19]  -> x[18]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 1] - x[ 0]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 1] + x[ 0]  -> x[17]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 3] - x[ 2]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 3] + x[ 2]  -> x[19]\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tMOV\tr6,#0xed\t\t@ r6 =cPI1_8\r\n\tMOV\tr7,#0x62\t\t@ r7 =cPI3_8\r\n\r\n\tMOV\tr5, r5, ASR #8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMOV\tr8, r8, ASR #8\r\n\tMOV\tr12,r12,ASR #8\r\n\r\n\t@ XNPROD31( s0, s1, cPI3_8, cPI1_8, &x[ 0], &x[ 2] )\r\n\t@ x[0] = s0*cPI3_8 - s1*cPI1_8     x[2] = s1*cPI3_8 + s0*cPI1_8\r\n\t@ stall Xscale\r\n\tMUL\tr11,r5, r6\t\t@ r11  = s0*cPI1_8\r\n\tMLA\tr11,r9, r7, r11\t\t@ r11 += s1*cPI3_8\r\n\tRSB\tr9, r9, #0\r\n\tMUL\tr5, r7, r5\t\t@ r5   = s0*cPI3_8\r\n\tMLA\tr5, r9, r6, r5\t\t@ r5  -= s1*cPI1_8\r\n\r\n\t@ XPROD31 ( s2, s3, cPI1_8, cPI3_8, &x[ 1], &x[ 3] )\r\n\t@ x[1] = s2*cPI1_8 + s3*cPI3_8     x[3] = s3*cPI1_8 - s2*cPI3_8\r\n\tMUL\tr9, r8, r6\t\t@ r9   = s2*cPI1_8\r\n\tMLA\tr9, r12,r7, r9\t\t@ r9  += s3*cPI3_8\r\n\tRSB\tr8,r8,#0\r\n\tMUL\tr12,r6, r12\t\t@ r12  = s3*cPI1_8\r\n\tMLA\tr12,r8, r7, r12\t\t@ r12 -= s2*cPI3_8\r\n\tSTMIA\tr1!,{r5,r9,r11,r12}\r\n\r\n\t@ block2\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[20]\r\n\t\t\t\t\t@ r6 = x[21]\r\n\t\t\t\t\t@ r9 = x[22]\r\n\t\t\t\t\t@ r10= x[23]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[4]\r\n\t\t\t\t\t@ r8 = x[5]\r\n\t\t\t\t\t@ r11= x[6]\r\n\t\t\t\t\t@ r12= x[7]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[20] - x[21]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[20] + x[21]  -> x[20]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[22] - x[23]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[22] + x[23]  -> x[22]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 5] - x[ 4]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 5] + x[ 4]  -> x[21]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 7] - x[ 6]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 7] + x[ 6]  -> x[23]\r\n\tMOV\tr14,#0xb5\t\t@ cPI2_8\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tSUB\tr5, r5, r9\t\t@ r5 = s0 - s1\r\n\tADD\tr9, r5, r9, LSL #1\t@ r9 = s0 + s1\r\n\tMOV\tr5, r5, ASR #8\r\n\tMUL\tr5, r14,r5\t\t@ r5 = (s0-s1)*cPI2_8\r\n\tSUB\tr12,r12,r8\t\t@ r12= s3 - s2\r\n\tADD\tr8, r12,r8, LSL #1\t@ r8 = s3 + s2\r\n\r\n\tMOV\tr8, r8, ASR #8\r\n\tMUL\tr8, r14,r8\t\t@ r8  = (s3+s2)*cPI2_8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMUL\tr9, r14,r9\t\t@ r9  = (s0+s1)*cPI2_8\r\n\tMOV\tr12,r12,ASR #8\r\n\tMUL\tr12,r14,r12\t\t@ r12 = (s3-s2)*cPI2_8\r\n\tSTMIA\tr1!,{r5,r8,r9,r12}\r\n\r\n\t@ block3\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[24]\r\n\t\t\t\t\t@ r6 = x[25]\r\n\t\t\t\t\t@ r9 = x[25]\r\n\t\t\t\t\t@ r10= x[26]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[8]\r\n\t\t\t\t\t@ r8 = x[9]\r\n\t\t\t\t\t@ r11= x[10]\r\n\t\t\t\t\t@ r12= x[11]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[24] - x[25]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[24] + x[25]  -> x[25]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[26] - x[27]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[26] + x[27]  -> x[26]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 9] - x[ 8]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 9] + x[ 8]  -> x[25]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[11] - x[10]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[11] + x[10]  -> x[27]\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tMOV\tr6,#0x62\t\t@ r6 = cPI3_8\r\n\tMOV\tr7,#0xED\t\t@ r7 = cPI1_8\r\n\r\n\t@ XNPROD31( s0, s1, cPI1_8, cPI3_8, &x[ 8], &x[10] )\r\n\t@ x[8] = s0*cPI1_8 - s1*cPI3_8     x[10] = s1*cPI1_8 + s0*cPI3_8\r\n\t@ stall Xscale\r\n\tMOV\tr5, r5, ASR #8\r\n\tMUL\tr11,r5, r6\t\t@ r11  = s0*cPI3_8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMLA\tr11,r9, r7, r11\t\t@ r11 += s1*cPI1_8\r\n\tRSB\tr9, r9, #0\r\n\tMUL\tr5, r7, r5\t\t@ r5   = s0*cPI1_8\r\n\tMLA\tr5, r9, r6, r5\t\t@ r5  -= s1*cPI3_8\r\n\r\n\t@ XPROD31 ( s2, s3, cPI3_8, cPI1_8, &x[ 9], &x[11] )\r\n\t@ x[9] = s2*cPI3_8 + s3*cPI1_8     x[11] = s3*cPI3_8 - s2*cPI1_8\r\n\tMOV\tr8, r8, ASR #8\r\n\tMUL\tr9, r8, r6\t\t@ r9   = s2*cPI3_8\r\n\tMOV\tr12,r12,ASR #8\r\n\tMLA\tr9, r12,r7, r9\t\t@ r9  += s3*cPI1_8\r\n\tRSB\tr8,r8,#0\r\n\tMUL\tr12,r6, r12\t\t@ r12  = s3*cPI3_8\r\n\tMLA\tr12,r8, r7, r12\t\t@ r12 -= s2*cPI1_8\r\n\tSTMIA\tr1!,{r5,r9,r11,r12}\r\n\r\n\t@ block4\r\n\tLDMIA\tr4,{r5,r6,r10,r11}\t@ r5 = x[28]\r\n\t\t\t\t\t@ r6 = x[29]\r\n\t\t\t\t\t@ r10= x[30]\r\n\t\t\t\t\t@ r11= x[31]\r\n\tLDMIA\tr1,{r8,r9,r12,r14}\t@ r8 = x[12]\r\n\t\t\t\t\t@ r9 = x[13]\r\n\t\t\t\t\t@ r12= x[14]\r\n\t\t\t\t\t@ r14= x[15]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[28] - x[29]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[28] + x[29]  -> x[28]\r\n\tSUB\tr7, r14,r12\t\t@ r7 = s3 = x[15] - x[14]\r\n\tADD\tr12,r7, r12, LSL #1\t@ r12=      x[15] + x[14]  -> x[31]\r\n\tSUB\tr10,r10,r11\t\t@ r10= s1 = x[30] - x[31]\r\n\tADD\tr11,r10,r11,LSL #1\t@ r11=      x[30] + x[31]  -> x[30]\r\n\tSUB\tr14, r8, r9\t\t@ r14= s2 = x[12] - x[13]\r\n\tADD\tr9, r14, r9, LSL #1\t@ r9 =      x[12] + x[13]  -> x[29]\r\n\tSTMIA\tr4!,{r6,r9,r11,r12}\r\n\tSTMIA\tr1!,{r5,r7,r10,r14}\r\n\r\n\t@ mdct_butterfly16 (1st version)\r\n\t@ block 1\r\n\tSUB\tr1,r1,#16*4\r\n\tADD\tr4,r1,#8*4\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[ 8]\r\n\t\t\t\t\t@ r6 = x[ 9]\r\n\t\t\t\t\t@ r9 = x[10]\r\n\t\t\t\t\t@ r10= x[11]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[0]\r\n\t\t\t\t\t@ r8 = x[1]\r\n\t\t\t\t\t@ r11= x[2]\r\n\t\t\t\t\t@ r12= x[3]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[ 8] - x[ 9]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[ 8] + x[ 9]  -> x[ 8]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[10] - x[11]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[10] + x[11]  -> x[10]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 1] - x[ 0]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 1] + x[ 0]  -> x[ 9]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 3] - x[ 2]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 3] + x[ 2]  -> x[11]\r\n\tMOV\tr14,#0xB5\t\t@ r14= cPI2_8\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tSUB\tr5, r5, r9\t\t@ r5 = s0 - s1\r\n\tADD\tr9, r5, r9, LSL #1\t@ r9 = s0 + s1\r\n\tMOV\tr5, r5, ASR #8\r\n\tMUL\tr5, r14,r5\t\t@ r5  = (s0-s1)*cPI2_8\r\n\tSUB\tr12,r12,r8\t\t@ r12= s3 - s2\r\n\tADD\tr8, r12,r8, LSL #1\t@ r8 = s3 + s2\r\n\r\n\tMOV\tr8, r8, ASR #8\r\n\tMUL\tr8, r14,r8\t\t@ r8  = (s3+s2)*cPI2_8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMUL\tr9, r14,r9\t\t@ r9  = (s0+s1)*cPI2_8\r\n\tMOV\tr12,r12,ASR #8\r\n\tMUL\tr12,r14,r12\t\t@ r12 = (s3-s2)*cPI2_8\r\n\tSTMIA\tr1!,{r5,r8,r9,r12}\r\n\r\n\t@ block2\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[12]\r\n\t\t\t\t\t@ r6 = x[13]\r\n\t\t\t\t\t@ r9 = x[14]\r\n\t\t\t\t\t@ r10= x[15]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[ 4]\r\n\t\t\t\t\t@ r8 = x[ 5]\r\n\t\t\t\t\t@ r11= x[ 6]\r\n\t\t\t\t\t@ r12= x[ 7]\r\n\tSUB\tr14,r7, r8\t\t@ r14= s0 = x[ 4] - x[ 5]\r\n\tADD\tr8, r14,r8, LSL #1\t@ r8 =      x[ 4] + x[ 5]  -> x[13]\r\n\tSUB\tr7, r12,r11\t\t@ r7 = s1 = x[ 7] - x[ 6]\r\n\tADD\tr11,r7, r11, LSL #1\t@ r11=      x[ 7] + x[ 6]  -> x[15]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s2 = x[12] - x[13]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[12] + x[13]  -> x[12]\r\n\tSUB\tr12,r9, r10\t\t@ r12= s3 = x[14] - x[15]\r\n\tADD\tr10,r12,r10,LSL #1\t@ r10=      x[14] + x[15]  -> x[14]\r\n\tSTMIA\tr4!,{r6,r8,r10,r11}\r\n\tSTMIA\tr1!,{r5,r7,r12,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMDB\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMDB\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMIA\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMIA\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\t@ mdct_butterfly16 (2nd version)\r\n\t@ block 1\r\n\tADD\tr1,r1,#16*4-8*4\r\n\tADD\tr4,r1,#8*4\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[ 8]\r\n\t\t\t\t\t@ r6 = x[ 9]\r\n\t\t\t\t\t@ r9 = x[10]\r\n\t\t\t\t\t@ r10= x[11]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[0]\r\n\t\t\t\t\t@ r8 = x[1]\r\n\t\t\t\t\t@ r11= x[2]\r\n\t\t\t\t\t@ r12= x[3]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s0 = x[ 8] - x[ 9]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[ 8] + x[ 9]  -> x[ 8]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s1 = x[10] - x[11]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[10] + x[11]  -> x[10]\r\n\tSUB\tr8, r8, r7\t\t@ r8 = s2 = x[ 1] - x[ 0]\r\n\tADD\tr7, r8, r7, LSL #1\t@ r7 =      x[ 1] + x[ 0]  -> x[ 9]\r\n\tSUB\tr12,r12,r11\t\t@ r12= s3 = x[ 3] - x[ 2]\r\n\tADD\tr11,r12,r11, LSL #1\t@ r11=      x[ 3] + x[ 2]  -> x[11]\r\n\tMOV\tr14,#0xb5\t\t@ r14= cPI2_8\r\n\tSTMIA\tr4!,{r6,r7,r10,r11}\r\n\r\n\tSUB\tr5, r5, r9\t\t@ r5 = s0 - s1\r\n\tADD\tr9, r5, r9, LSL #1\t@ r9 = s0 + s1\r\n\tMOV\tr5, r5, ASR #8\r\n\tMUL\tr5, r14,r5\t\t@ r5  = (s0-s1)*cPI2_8\r\n\tSUB\tr12,r12,r8\t\t@ r12= s3 - s2\r\n\tADD\tr8, r12,r8, LSL #1\t@ r8 = s3 + s2\r\n\r\n\tMOV\tr8, r8, ASR #8\r\n\tMUL\tr8, r14,r8\t\t@ r8  = (s3+s2)*cPI2_8\r\n\tMOV\tr9, r9, ASR #8\r\n\tMUL\tr9, r14,r9\t\t@ r9  = (s0+s1)*cPI2_8\r\n\tMOV\tr12,r12,ASR #8\r\n\tMUL\tr12,r14,r12\t\t@ r12 = (s3-s2)*cPI2_8\r\n\tSTMIA\tr1!,{r5,r8,r9,r12}\r\n\r\n\t@ block2\r\n\tLDMIA\tr4,{r5,r6,r9,r10}\t@ r5 = x[12]\r\n\t\t\t\t\t@ r6 = x[13]\r\n\t\t\t\t\t@ r9 = x[14]\r\n\t\t\t\t\t@ r10= x[15]\r\n\tLDMIA\tr1,{r7,r8,r11,r12}\t@ r7 = x[ 4]\r\n\t\t\t\t\t@ r8 = x[ 5]\r\n\t\t\t\t\t@ r11= x[ 6]\r\n\t\t\t\t\t@ r12= x[ 7]\r\n\tSUB\tr5, r5, r6\t\t@ r5 = s2 = x[12] - x[13]\r\n\tADD\tr6, r5, r6, LSL #1\t@ r6 =      x[12] + x[13]  -> x[12]\r\n\tSUB\tr9, r9, r10\t\t@ r9 = s3 = x[14] - x[15]\r\n\tADD\tr10,r9, r10,LSL #1\t@ r10=      x[14] + x[15]  -> x[14]\r\n\tSUB\tr14,r7, r8\t\t@ r14= s0 = x[ 4] - x[ 5]\r\n\tADD\tr8, r14,r8, LSL #1\t@ r8 =      x[ 4] + x[ 5]  -> x[13]\r\n\tSUB\tr7, r12,r11\t\t@ r7 = s1 = x[ 7] - x[ 6]\r\n\tADD\tr11,r7, r11, LSL #1\t@ r11=      x[ 7] + x[ 6]  -> x[15]\r\n\tSTMIA\tr4!,{r6,r8,r10,r11}\r\n\tSTMIA\tr1!,{r5,r7,r9,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMDB\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMDB\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\t@ mdct_butterfly_8\r\n\tLDMIA\tr1,{r6,r7,r8,r9,r10,r11,r12,r14}\r\n\t\t\t\t\t@ r6 = x[0]\r\n\t\t\t\t\t@ r7 = x[1]\r\n\t\t\t\t\t@ r8 = x[2]\r\n\t\t\t\t\t@ r9 = x[3]\r\n\t\t\t\t\t@ r10= x[4]\r\n\t\t\t\t\t@ r11= x[5]\r\n\t\t\t\t\t@ r12= x[6]\r\n\t\t\t\t\t@ r14= x[7]\r\n\tADD\tr6, r6, r7\t\t@ r6 = s0 = x[0] + x[1]\r\n\tSUB\tr7, r6, r7, LSL #1\t@ r7 = s1 = x[0] - x[1]\r\n\tADD\tr8, r8, r9\t\t@ r8 = s2 = x[2] + x[3]\r\n\tSUB\tr9, r8, r9, LSL #1\t@ r9 = s3 = x[2] - x[3]\r\n\tADD\tr10,r10,r11\t\t@ r10= s4 = x[4] + x[5]\r\n\tSUB\tr11,r10,r11,LSL #1\t@ r11= s5 = x[4] - x[5]\r\n\tADD\tr12,r12,r14\t\t@ r12= s6 = x[6] + x[7]\r\n\tSUB\tr14,r12,r14,LSL #1\t@ r14= s7 = x[6] - x[7]\r\n\r\n\tADD\tr2, r11,r9\t\t@ r2 = x[0] = s5 + s3\r\n\tSUB\tr4, r2, r9, LSL #1\t@ r4 = x[2] = s5 - s3\r\n\tSUB\tr3, r14,r7\t\t@ r3 = x[1] = s7 - s1\r\n\tADD\tr5, r3, r7, LSL #1\t@ r5 = x[3] = s7 + s1\r\n\tSUB\tr10,r10,r6\t\t@ r10= x[4] = s4 - s0\r\n\tSUB\tr11,r12,r8\t\t@ r11= x[5] = s6 - s2\r\n\tADD\tr12,r10,r6, LSL #1\t@ r12= x[6] = s4 + s0\r\n\tADD\tr14,r11,r8, LSL #1\t@ r14= x[7] = s6 + s2\r\n\tSTMIA\tr1,{r2,r3,r4,r5,r10,r11,r12,r14}\r\n\r\n\tADD\tr1,r1,#8*4\r\n\tSUBS\tr0,r0,#64\r\n\tBGT\tmdct_bufferflies_loop3\r\n\r\n\tLDMFD\tr13,{r0-r3}\r\n\r\nmdct_bitreverseARM:\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\r\n\tMOV\tr4, #0\t\t\t@ r4 = bit = 0\r\n\tADD\tr5, r1, r0, LSL #1\t@ r5 = w = x + (n>>1)\r\n\tADR\tr6, bitrev\r\n\tSUB\tr3, r3, #2\t\t@ r3 = shift -= 2\r\n\tSUB\tr5, r5, #8\r\nbrev_lp:\r\n\tLDRB\tr7, [r6, r4, LSR #6]\r\n\tAND\tr8, r4, #0x3f\r\n\tLDRB\tr8, [r6, r8]\r\n\tADD\tr4, r4, #1\t\t@ bit++\r\n\t@ stall XScale\r\n\tORR\tr7, r7, r8, LSL #6\t@ r7 = bitrev[bit]\r\n\tADD\tr9, r1, r7, LSR r3\t@ r9 = xx = x + (b>>shift)\r\n\tCMP\tr5, r9\t\t\t@ if (w > xx)\r\n\tLDR\tr10,[r5],#-8\t\t@   r10 = w[0]\t\tw -= 2\r\n\tLDRGT\tr11,[r5,#12]\t\t@   r11 = w[1]\r\n\tLDRGT\tr12,[r9]\t\t@   r12 = xx[0]\r\n\tLDRGT\tr14,[r9,#4]\t\t@   r14 = xx[1]\r\n\tSTRGT\tr10,[r9]\t\t@   xx[0]= w[0]\r\n\tSTRGT\tr11,[r9,#4]\t\t@   xx[1]= w[1]\r\n\tSTRGT\tr12,[r5,#8]\t\t@   w[0] = xx[0]\r\n\tSTRGT\tr14,[r5,#12]\t\t@   w[1] = xx[1]\r\n\tCMP\tr5,r1\r\n\tBGT\tbrev_lp\r\n\r\n\t@ mdct_step7\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift-2\r\n\r\n\tCMP\tr2, #4\t\t\t@ r5 = T = (step>=4) ?\r\n\tLDRGE\tr5, =sincos_lookup0\t@          sincos_lookup0 +\r\n\tLDRLT\tr5, =sincos_lookup1\t@          sincos_lookup0 +\r\n\tADD\tr7, r1, r0, LSL #1\t@ r7 = w1 = x + (n>>1)\r\n\tADDGE\tr5, r5, r2, LSR #1\t@\t\t            (step>>1)\r\n\tADD\tr8, r5, #1024\t\t@ r8 = Ttop\r\nstep7_loop1:\r\n\tLDR\tr6, [r1]\t\t@ r6 = w0[0]\r\n\tLDR\tr9, [r1,#4]\t\t@ r9 = w0[1]\r\n\tLDR\tr10,[r7,#-8]!\t\t@ r10= w1[0]\tw1 -= 2\r\n\tLDR\tr11,[r7,#4]\t\t@ r11= w1[1]\r\n\tLDRB\tr14,[r5,#1]\t\t@ r14= T[1]\r\n\tLDRB\tr12,[r5],r2\t\t@ r12= T[0]\tT += step\r\n\r\n\tADD\tr6, r6, r10\t\t@ r6 = s0 = w0[0] + w1[0]\r\n\tSUB\tr10,r6, r10,LSL #1\t@ r10= s1b= w0[0] - w1[0]\r\n\tSUB\tr11,r11,r9\t\t@ r11= s1 = w1[1] - w0[1]\r\n\tADD\tr9, r11,r9, LSL #1\t@ r9 = s0b= w1[1] + w0[1]\r\n\r\n\tMOV\tr6, r6, ASR #9\r\n\tMUL\tr3, r6, r14\t\t@ r3   = s0*T[1]\r\n\tMOV\tr11,r11,ASR #9\r\n\tMUL\tr4, r11,r12\t\t@ r4  += s1*T[0] = s2\r\n\tADD\tr3, r3, r4\r\n\tMUL\tr14,r11,r14\t\t@ r14  = s1*T[1]\r\n\tMUL\tr12,r6, r12\t\t@ r12 += s0*T[0] = s3\r\n\tSUB\tr14,r14,r12\r\n\r\n\t@ r9 = s0b<<1\r\n\t@ r10= s1b<<1\r\n\tADD\tr9, r3, r9, ASR #1\t@ r9 = s0b + s2\r\n\tSUB\tr3, r9, r3, LSL #1\t@ r3 = s0b - s2\r\n\r\n\tSUB\tr12,r14,r10,ASR #1\t@ r12= s3  - s1b\r\n\tADD\tr10,r14,r10,ASR #1\t@ r10= s3  + s1b\r\n\tSTR\tr9, [r1],#4\r\n\tSTR\tr10,[r1],#4\t\t@ w0 += 2\r\n\tSTR\tr3, [r7]\r\n\tSTR\tr12,[r7,#4]\r\n\r\n\tCMP\tr5,r8\r\n\tBLT\tstep7_loop1\r\n\r\nstep7_loop2:\r\n\tLDR\tr6, [r1]\t\t@ r6 = w0[0]\r\n\tLDR\tr9, [r1,#4]\t\t@ r9 = w0[1]\r\n\tLDR\tr10,[r7,#-8]!\t\t@ r10= w1[0]\tw1 -= 2\r\n\tLDR\tr11,[r7,#4]\t\t@ r11= w1[1]\r\n\tLDRB\tr14,[r5,-r2]!\t\t@ r12= T[1]\tT -= step\r\n\tLDRB\tr12,[r5,#1]\t\t@ r14= T[0]\r\n\r\n\tADD\tr6, r6, r10\t\t@ r6 = s0 = w0[0] + w1[0]\r\n\tSUB\tr10,r6, r10,LSL #1\t@ r10= s1b= w0[0] - w1[0]\r\n\tSUB\tr11,r11,r9\t\t@ r11= s1 = w1[1] - w0[1]\r\n\tADD\tr9, r11,r9, LSL #1\t@ r9 = s0b= w1[1] + w0[1]\r\n\r\n\tMOV\tr6, r6, ASR #9\r\n\tMUL\tr3, r6, r14\t\t@ r3   = s0*T[0]\r\n\tMOV\tr11,r11,ASR #9\r\n\tMUL\tr4, r11,r12\t\t@ r4  += s1*T[1] = s2\r\n\tADD\tr3, r3, r4\r\n\tMUL\tr14,r11,r14\t\t@ r14  = s1*T[0]\r\n\tMUL\tr12,r6, r12\t\t@ r12 += s0*T[1] = s3\r\n\tSUB\tr14,r14,r12\r\n\r\n\t@ r9 = s0b<<1\r\n\t@ r10= s1b<<1\r\n\tADD\tr9, r3, r9, ASR #1\t@ r9 = s0b + s2\r\n\tSUB\tr3, r9, r3, LSL #1\t@ r3 = s0b - s2\r\n\r\n\tSUB\tr12,r14,r10,ASR #1\t@ r12= s3  - s1b\r\n\tADD\tr10,r14,r10,ASR #1\t@ r10= s3  + s1b\r\n\tSTR\tr9, [r1],#4\r\n\tSTR\tr10,[r1],#4\t\t@ w0 += 2\r\n\tSTR\tr3, [r7]\r\n\tSTR\tr12,[r7,#4]\r\n\r\n\tCMP\tr1,r7\r\n\tBLT\tstep7_loop2\r\n\r\n\tLDMFD\tr13!,{r0-r3}\r\n\r\n\t@ r0 = points\r\n\t@ r1 = in\r\n\t@ r2 = step\r\n\t@ r3 = shift\r\n\tMOV\tr2, r2, ASR #2\t\t@ r2 = step >>= 2\r\n\tCMP\tr2, #0\r\n\tCMPNE\tr2, #1\r\n\tBEQ\tmdct_end\r\n\r\n\t@ step > 1 (default case)\r\n\tCMP\tr2, #4\t\t\t@ r5 = T = (step>=4) ?\r\n\tLDRGE\tr5, =sincos_lookup0\t@          sincos_lookup0 +\r\n\tLDRLT\tr5, =sincos_lookup1\t@          sincos_lookup1\r\n\tADD\tr7, r1, r0, LSL #1\t@ r7 = iX = x + (n>>1)\r\n\tADDGE\tr5, r5, r2, LSR #1\t@\t\t            (step>>1)\r\nmdct_step8_default:\r\n\tLDR\tr6, [r1],#4\t\t@ r6 =  s0 = x[0]\r\n\tLDR\tr8, [r1],#4\t\t@ r8 = -s1 = x[1]\r\n\tLDRB\tr12,[r5,#1]       \t@ r12= T[1]\r\n\tLDRB\tr14,[r5],r2\t\t@ r14= T[0]\tT += step\r\n\tRSB\tr8, r8, #0\t\t@ r8 = s1\r\n\r\n\t@ XPROD31(s0, s1, T[0], T[1], x, x+1)\r\n\t@ x[0] = s0 * T[0] + s1 * T[1]      x[1] = s1 * T[0] - s0 * T[1]\r\n\tMOV\tr6, r6, ASR #8\r\n\tMOV\tr8, r8, ASR #8\r\n\tMUL\tr10,r8, r12\t\t@ r10  = s1 * T[1]\r\n\tCMP\tr1, r7\r\n\tMLA\tr10,r6, r14,r10\t@ r10 += s0 * T[0]\r\n\tRSB\tr6, r6, #0\t\t@ r6 = -s0\r\n\tMUL\tr11,r8, r14\t\t@ r11  = s1 * T[0]\r\n\tMLA\tr11,r6, r12,r11\t@ r11 -= s0 * T[1]\r\n\tSTR\tr10,[r1,#-8]\r\n\tSTR\tr11,[r1,#-4]\r\n\tBLT\tmdct_step8_default\r\n\r\nmdct_end:\r\n\tMOV\tr0, r2\r\n\tLDMFD\tr13!,{r4-r11,PC}\r\n\r\nbitrev:\r\n\t.byte\t0\r\n\t.byte\t32\r\n\t.byte\t16\r\n\t.byte\t48\r\n\t.byte\t8\r\n\t.byte\t40\r\n\t.byte\t24\r\n\t.byte\t56\r\n\t.byte\t4\r\n\t.byte\t36\r\n\t.byte\t20\r\n\t.byte\t52\r\n\t.byte\t12\r\n\t.byte\t44\r\n\t.byte\t28\r\n\t.byte\t60\r\n\t.byte\t2\r\n\t.byte\t34\r\n\t.byte\t18\r\n\t.byte\t50\r\n\t.byte\t10\r\n\t.byte\t42\r\n\t.byte\t26\r\n\t.byte\t58\r\n\t.byte\t6\r\n\t.byte\t38\r\n\t.byte\t22\r\n\t.byte\t54\r\n\t.byte\t14\r\n\t.byte\t46\r\n\t.byte\t30\r\n\t.byte\t62\r\n\t.byte\t1\r\n\t.byte\t33\r\n\t.byte\t17\r\n\t.byte\t49\r\n\t.byte\t9\r\n\t.byte\t41\r\n\t.byte\t25\r\n\t.byte\t57\r\n\t.byte\t5\r\n\t.byte\t37\r\n\t.byte\t21\r\n\t.byte\t53\r\n\t.byte\t13\r\n\t.byte\t45\r\n\t.byte\t29\r\n\t.byte\t61\r\n\t.byte\t3\r\n\t.byte\t35\r\n\t.byte\t19\r\n\t.byte\t51\r\n\t.byte\t11\r\n\t.byte\t43\r\n\t.byte\t27\r\n\t.byte\t59\r\n\t.byte\t7\r\n\t.byte\t39\r\n\t.byte\t23\r\n\t.byte\t55\r\n\t.byte\t15\r\n\t.byte\t47\r\n\t.byte\t31\r\n\t.byte\t63\r\n\r\n\t@ END\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/mdct_lookup.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: sin,cos lookup tables\r\n\r\n ************************************************************************/\r\n\r\n#include \"os_types.h\"\r\n\r\n/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */\r\nLOOKUP_T sincos_lookup0[1026] = {\r\n  X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621),\r\n  X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c),\r\n  X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943),\r\n  X(0x012d96b1), X(0x7ffe9cb2), X(0x015fda03), X(0x7ffe1c65),\r\n  X(0x01921d20), X(0x7ffd885a), X(0x01c45ffe), X(0x7ffce093),\r\n  X(0x01f6a297), X(0x7ffc250f), X(0x0228e4e2), X(0x7ffb55ce),\r\n  X(0x025b26d7), X(0x7ffa72d1), X(0x028d6870), X(0x7ff97c18),\r\n  X(0x02bfa9a4), X(0x7ff871a2), X(0x02f1ea6c), X(0x7ff75370),\r\n  X(0x03242abf), X(0x7ff62182), X(0x03566a96), X(0x7ff4dbd9),\r\n  X(0x0388a9ea), X(0x7ff38274), X(0x03bae8b2), X(0x7ff21553),\r\n  X(0x03ed26e6), X(0x7ff09478), X(0x041f6480), X(0x7feeffe1),\r\n  X(0x0451a177), X(0x7fed5791), X(0x0483ddc3), X(0x7feb9b85),\r\n  X(0x04b6195d), X(0x7fe9cbc0), X(0x04e8543e), X(0x7fe7e841),\r\n  X(0x051a8e5c), X(0x7fe5f108), X(0x054cc7b1), X(0x7fe3e616),\r\n  X(0x057f0035), X(0x7fe1c76b), X(0x05b137df), X(0x7fdf9508),\r\n  X(0x05e36ea9), X(0x7fdd4eec), X(0x0615a48b), X(0x7fdaf519),\r\n  X(0x0647d97c), X(0x7fd8878e), X(0x067a0d76), X(0x7fd6064c),\r\n  X(0x06ac406f), X(0x7fd37153), X(0x06de7262), X(0x7fd0c8a3),\r\n  X(0x0710a345), X(0x7fce0c3e), X(0x0742d311), X(0x7fcb3c23),\r\n  X(0x077501be), X(0x7fc85854), X(0x07a72f45), X(0x7fc560cf),\r\n  X(0x07d95b9e), X(0x7fc25596), X(0x080b86c2), X(0x7fbf36aa),\r\n  X(0x083db0a7), X(0x7fbc040a), X(0x086fd947), X(0x7fb8bdb8),\r\n  X(0x08a2009a), X(0x7fb563b3), X(0x08d42699), X(0x7fb1f5fc),\r\n  X(0x09064b3a), X(0x7fae7495), X(0x09386e78), X(0x7faadf7c),\r\n  X(0x096a9049), X(0x7fa736b4), X(0x099cb0a7), X(0x7fa37a3c),\r\n  X(0x09cecf89), X(0x7f9faa15), X(0x0a00ece8), X(0x7f9bc640),\r\n  X(0x0a3308bd), X(0x7f97cebd), X(0x0a6522fe), X(0x7f93c38c),\r\n  X(0x0a973ba5), X(0x7f8fa4b0), X(0x0ac952aa), X(0x7f8b7227),\r\n  X(0x0afb6805), X(0x7f872bf3), X(0x0b2d7baf), X(0x7f82d214),\r\n  X(0x0b5f8d9f), X(0x7f7e648c), X(0x0b919dcf), X(0x7f79e35a),\r\n  X(0x0bc3ac35), X(0x7f754e80), X(0x0bf5b8cb), X(0x7f70a5fe),\r\n  X(0x0c27c389), X(0x7f6be9d4), X(0x0c59cc68), X(0x7f671a05),\r\n  X(0x0c8bd35e), X(0x7f62368f), X(0x0cbdd865), X(0x7f5d3f75),\r\n  X(0x0cefdb76), X(0x7f5834b7), X(0x0d21dc87), X(0x7f531655),\r\n  X(0x0d53db92), X(0x7f4de451), X(0x0d85d88f), X(0x7f489eaa),\r\n  X(0x0db7d376), X(0x7f434563), X(0x0de9cc40), X(0x7f3dd87c),\r\n  X(0x0e1bc2e4), X(0x7f3857f6), X(0x0e4db75b), X(0x7f32c3d1),\r\n  X(0x0e7fa99e), X(0x7f2d1c0e), X(0x0eb199a4), X(0x7f2760af),\r\n  X(0x0ee38766), X(0x7f2191b4), X(0x0f1572dc), X(0x7f1baf1e),\r\n  X(0x0f475bff), X(0x7f15b8ee), X(0x0f7942c7), X(0x7f0faf25),\r\n  X(0x0fab272b), X(0x7f0991c4), X(0x0fdd0926), X(0x7f0360cb),\r\n  X(0x100ee8ad), X(0x7efd1c3c), X(0x1040c5bb), X(0x7ef6c418),\r\n  X(0x1072a048), X(0x7ef05860), X(0x10a4784b), X(0x7ee9d914),\r\n  X(0x10d64dbd), X(0x7ee34636), X(0x11082096), X(0x7edc9fc6),\r\n  X(0x1139f0cf), X(0x7ed5e5c6), X(0x116bbe60), X(0x7ecf1837),\r\n  X(0x119d8941), X(0x7ec8371a), X(0x11cf516a), X(0x7ec14270),\r\n  X(0x120116d5), X(0x7eba3a39), X(0x1232d979), X(0x7eb31e78),\r\n  X(0x1264994e), X(0x7eabef2c), X(0x1296564d), X(0x7ea4ac58),\r\n  X(0x12c8106f), X(0x7e9d55fc), X(0x12f9c7aa), X(0x7e95ec1a),\r\n  X(0x132b7bf9), X(0x7e8e6eb2), X(0x135d2d53), X(0x7e86ddc6),\r\n  X(0x138edbb1), X(0x7e7f3957), X(0x13c0870a), X(0x7e778166),\r\n  X(0x13f22f58), X(0x7e6fb5f4), X(0x1423d492), X(0x7e67d703),\r\n  X(0x145576b1), X(0x7e5fe493), X(0x148715ae), X(0x7e57dea7),\r\n  X(0x14b8b17f), X(0x7e4fc53e), X(0x14ea4a1f), X(0x7e47985b),\r\n  X(0x151bdf86), X(0x7e3f57ff), X(0x154d71aa), X(0x7e37042a),\r\n  X(0x157f0086), X(0x7e2e9cdf), X(0x15b08c12), X(0x7e26221f),\r\n  X(0x15e21445), X(0x7e1d93ea), X(0x16139918), X(0x7e14f242),\r\n  X(0x16451a83), X(0x7e0c3d29), X(0x1676987f), X(0x7e0374a0),\r\n  X(0x16a81305), X(0x7dfa98a8), X(0x16d98a0c), X(0x7df1a942),\r\n  X(0x170afd8d), X(0x7de8a670), X(0x173c6d80), X(0x7ddf9034),\r\n  X(0x176dd9de), X(0x7dd6668f), X(0x179f429f), X(0x7dcd2981),\r\n  X(0x17d0a7bc), X(0x7dc3d90d), X(0x1802092c), X(0x7dba7534),\r\n  X(0x183366e9), X(0x7db0fdf8), X(0x1864c0ea), X(0x7da77359),\r\n  X(0x18961728), X(0x7d9dd55a), X(0x18c7699b), X(0x7d9423fc),\r\n  X(0x18f8b83c), X(0x7d8a5f40), X(0x192a0304), X(0x7d808728),\r\n  X(0x195b49ea), X(0x7d769bb5), X(0x198c8ce7), X(0x7d6c9ce9),\r\n  X(0x19bdcbf3), X(0x7d628ac6), X(0x19ef0707), X(0x7d58654d),\r\n  X(0x1a203e1b), X(0x7d4e2c7f), X(0x1a517128), X(0x7d43e05e),\r\n  X(0x1a82a026), X(0x7d3980ec), X(0x1ab3cb0d), X(0x7d2f0e2b),\r\n  X(0x1ae4f1d6), X(0x7d24881b), X(0x1b161479), X(0x7d19eebf),\r\n  X(0x1b4732ef), X(0x7d0f4218), X(0x1b784d30), X(0x7d048228),\r\n  X(0x1ba96335), X(0x7cf9aef0), X(0x1bda74f6), X(0x7ceec873),\r\n  X(0x1c0b826a), X(0x7ce3ceb2), X(0x1c3c8b8c), X(0x7cd8c1ae),\r\n  X(0x1c6d9053), X(0x7ccda169), X(0x1c9e90b8), X(0x7cc26de5),\r\n  X(0x1ccf8cb3), X(0x7cb72724), X(0x1d00843d), X(0x7cabcd28),\r\n  X(0x1d31774d), X(0x7ca05ff1), X(0x1d6265dd), X(0x7c94df83),\r\n  X(0x1d934fe5), X(0x7c894bde), X(0x1dc4355e), X(0x7c7da505),\r\n  X(0x1df5163f), X(0x7c71eaf9), X(0x1e25f282), X(0x7c661dbc),\r\n  X(0x1e56ca1e), X(0x7c5a3d50), X(0x1e879d0d), X(0x7c4e49b7),\r\n  X(0x1eb86b46), X(0x7c4242f2), X(0x1ee934c3), X(0x7c362904),\r\n  X(0x1f19f97b), X(0x7c29fbee), X(0x1f4ab968), X(0x7c1dbbb3),\r\n  X(0x1f7b7481), X(0x7c116853), X(0x1fac2abf), X(0x7c0501d2),\r\n  X(0x1fdcdc1b), X(0x7bf88830), X(0x200d888d), X(0x7bebfb70),\r\n  X(0x203e300d), X(0x7bdf5b94), X(0x206ed295), X(0x7bd2a89e),\r\n  X(0x209f701c), X(0x7bc5e290), X(0x20d0089c), X(0x7bb9096b),\r\n  X(0x21009c0c), X(0x7bac1d31), X(0x21312a65), X(0x7b9f1de6),\r\n  X(0x2161b3a0), X(0x7b920b89), X(0x219237b5), X(0x7b84e61f),\r\n  X(0x21c2b69c), X(0x7b77ada8), X(0x21f3304f), X(0x7b6a6227),\r\n  X(0x2223a4c5), X(0x7b5d039e), X(0x225413f8), X(0x7b4f920e),\r\n  X(0x22847de0), X(0x7b420d7a), X(0x22b4e274), X(0x7b3475e5),\r\n  X(0x22e541af), X(0x7b26cb4f), X(0x23159b88), X(0x7b190dbc),\r\n  X(0x2345eff8), X(0x7b0b3d2c), X(0x23763ef7), X(0x7afd59a4),\r\n  X(0x23a6887f), X(0x7aef6323), X(0x23d6cc87), X(0x7ae159ae),\r\n  X(0x24070b08), X(0x7ad33d45), X(0x243743fa), X(0x7ac50dec),\r\n  X(0x24677758), X(0x7ab6cba4), X(0x2497a517), X(0x7aa8766f),\r\n  X(0x24c7cd33), X(0x7a9a0e50), X(0x24f7efa2), X(0x7a8b9348),\r\n  X(0x25280c5e), X(0x7a7d055b), X(0x2558235f), X(0x7a6e648a),\r\n  X(0x2588349d), X(0x7a5fb0d8), X(0x25b84012), X(0x7a50ea47),\r\n  X(0x25e845b6), X(0x7a4210d8), X(0x26184581), X(0x7a332490),\r\n  X(0x26483f6c), X(0x7a24256f), X(0x26783370), X(0x7a151378),\r\n  X(0x26a82186), X(0x7a05eead), X(0x26d809a5), X(0x79f6b711),\r\n  X(0x2707ebc7), X(0x79e76ca7), X(0x2737c7e3), X(0x79d80f6f),\r\n  X(0x27679df4), X(0x79c89f6e), X(0x27976df1), X(0x79b91ca4),\r\n  X(0x27c737d3), X(0x79a98715), X(0x27f6fb92), X(0x7999dec4),\r\n  X(0x2826b928), X(0x798a23b1), X(0x2856708d), X(0x797a55e0),\r\n  X(0x288621b9), X(0x796a7554), X(0x28b5cca5), X(0x795a820e),\r\n  X(0x28e5714b), X(0x794a7c12), X(0x29150fa1), X(0x793a6361),\r\n  X(0x2944a7a2), X(0x792a37fe), X(0x29743946), X(0x7919f9ec),\r\n  X(0x29a3c485), X(0x7909a92d), X(0x29d34958), X(0x78f945c3),\r\n  X(0x2a02c7b8), X(0x78e8cfb2), X(0x2a323f9e), X(0x78d846fb),\r\n  X(0x2a61b101), X(0x78c7aba2), X(0x2a911bdc), X(0x78b6fda8),\r\n  X(0x2ac08026), X(0x78a63d11), X(0x2aefddd8), X(0x789569df),\r\n  X(0x2b1f34eb), X(0x78848414), X(0x2b4e8558), X(0x78738bb3),\r\n  X(0x2b7dcf17), X(0x786280bf), X(0x2bad1221), X(0x7851633b),\r\n  X(0x2bdc4e6f), X(0x78403329), X(0x2c0b83fa), X(0x782ef08b),\r\n  X(0x2c3ab2b9), X(0x781d9b65), X(0x2c69daa6), X(0x780c33b8),\r\n  X(0x2c98fbba), X(0x77fab989), X(0x2cc815ee), X(0x77e92cd9),\r\n  X(0x2cf72939), X(0x77d78daa), X(0x2d263596), X(0x77c5dc01),\r\n  X(0x2d553afc), X(0x77b417df), X(0x2d843964), X(0x77a24148),\r\n  X(0x2db330c7), X(0x7790583e), X(0x2de2211e), X(0x777e5cc3),\r\n  X(0x2e110a62), X(0x776c4edb), X(0x2e3fec8b), X(0x775a2e89),\r\n  X(0x2e6ec792), X(0x7747fbce), X(0x2e9d9b70), X(0x7735b6af),\r\n  X(0x2ecc681e), X(0x77235f2d), X(0x2efb2d95), X(0x7710f54c),\r\n  X(0x2f29ebcc), X(0x76fe790e), X(0x2f58a2be), X(0x76ebea77),\r\n  X(0x2f875262), X(0x76d94989), X(0x2fb5fab2), X(0x76c69647),\r\n  X(0x2fe49ba7), X(0x76b3d0b4), X(0x30133539), X(0x76a0f8d2),\r\n  X(0x3041c761), X(0x768e0ea6), X(0x30705217), X(0x767b1231),\r\n  X(0x309ed556), X(0x76680376), X(0x30cd5115), X(0x7654e279),\r\n  X(0x30fbc54d), X(0x7641af3d), X(0x312a31f8), X(0x762e69c4),\r\n  X(0x3158970e), X(0x761b1211), X(0x3186f487), X(0x7607a828),\r\n  X(0x31b54a5e), X(0x75f42c0b), X(0x31e39889), X(0x75e09dbd),\r\n  X(0x3211df04), X(0x75ccfd42), X(0x32401dc6), X(0x75b94a9c),\r\n  X(0x326e54c7), X(0x75a585cf), X(0x329c8402), X(0x7591aedd),\r\n  X(0x32caab6f), X(0x757dc5ca), X(0x32f8cb07), X(0x7569ca99),\r\n  X(0x3326e2c3), X(0x7555bd4c), X(0x3354f29b), X(0x75419de7),\r\n  X(0x3382fa88), X(0x752d6c6c), X(0x33b0fa84), X(0x751928e0),\r\n  X(0x33def287), X(0x7504d345), X(0x340ce28b), X(0x74f06b9e),\r\n  X(0x343aca87), X(0x74dbf1ef), X(0x3468aa76), X(0x74c7663a),\r\n  X(0x34968250), X(0x74b2c884), X(0x34c4520d), X(0x749e18cd),\r\n  X(0x34f219a8), X(0x7489571c), X(0x351fd918), X(0x74748371),\r\n  X(0x354d9057), X(0x745f9dd1), X(0x357b3f5d), X(0x744aa63f),\r\n  X(0x35a8e625), X(0x74359cbd), X(0x35d684a6), X(0x74208150),\r\n  X(0x36041ad9), X(0x740b53fb), X(0x3631a8b8), X(0x73f614c0),\r\n  X(0x365f2e3b), X(0x73e0c3a3), X(0x368cab5c), X(0x73cb60a8),\r\n  X(0x36ba2014), X(0x73b5ebd1), X(0x36e78c5b), X(0x73a06522),\r\n  X(0x3714f02a), X(0x738acc9e), X(0x37424b7b), X(0x73752249),\r\n  X(0x376f9e46), X(0x735f6626), X(0x379ce885), X(0x73499838),\r\n  X(0x37ca2a30), X(0x7333b883), X(0x37f76341), X(0x731dc70a),\r\n  X(0x382493b0), X(0x7307c3d0), X(0x3851bb77), X(0x72f1aed9),\r\n  X(0x387eda8e), X(0x72db8828), X(0x38abf0ef), X(0x72c54fc1),\r\n  X(0x38d8fe93), X(0x72af05a7), X(0x39060373), X(0x7298a9dd),\r\n  X(0x3932ff87), X(0x72823c67), X(0x395ff2c9), X(0x726bbd48),\r\n  X(0x398cdd32), X(0x72552c85), X(0x39b9bebc), X(0x723e8a20),\r\n  X(0x39e6975e), X(0x7227d61c), X(0x3a136712), X(0x7211107e),\r\n  X(0x3a402dd2), X(0x71fa3949), X(0x3a6ceb96), X(0x71e35080),\r\n  X(0x3a99a057), X(0x71cc5626), X(0x3ac64c0f), X(0x71b54a41),\r\n  X(0x3af2eeb7), X(0x719e2cd2), X(0x3b1f8848), X(0x7186fdde),\r\n  X(0x3b4c18ba), X(0x716fbd68), X(0x3b78a007), X(0x71586b74),\r\n  X(0x3ba51e29), X(0x71410805), X(0x3bd19318), X(0x7129931f),\r\n  X(0x3bfdfecd), X(0x71120cc5), X(0x3c2a6142), X(0x70fa74fc),\r\n  X(0x3c56ba70), X(0x70e2cbc6), X(0x3c830a50), X(0x70cb1128),\r\n  X(0x3caf50da), X(0x70b34525), X(0x3cdb8e09), X(0x709b67c0),\r\n  X(0x3d07c1d6), X(0x708378ff), X(0x3d33ec39), X(0x706b78e3),\r\n  X(0x3d600d2c), X(0x70536771), X(0x3d8c24a8), X(0x703b44ad),\r\n  X(0x3db832a6), X(0x7023109a), X(0x3de4371f), X(0x700acb3c),\r\n  X(0x3e10320d), X(0x6ff27497), X(0x3e3c2369), X(0x6fda0cae),\r\n  X(0x3e680b2c), X(0x6fc19385), X(0x3e93e950), X(0x6fa90921),\r\n  X(0x3ebfbdcd), X(0x6f906d84), X(0x3eeb889c), X(0x6f77c0b3),\r\n  X(0x3f1749b8), X(0x6f5f02b2), X(0x3f430119), X(0x6f463383),\r\n  X(0x3f6eaeb8), X(0x6f2d532c), X(0x3f9a5290), X(0x6f1461b0),\r\n  X(0x3fc5ec98), X(0x6efb5f12), X(0x3ff17cca), X(0x6ee24b57),\r\n  X(0x401d0321), X(0x6ec92683), X(0x40487f94), X(0x6eaff099),\r\n  X(0x4073f21d), X(0x6e96a99d), X(0x409f5ab6), X(0x6e7d5193),\r\n  X(0x40cab958), X(0x6e63e87f), X(0x40f60dfb), X(0x6e4a6e66),\r\n  X(0x4121589b), X(0x6e30e34a), X(0x414c992f), X(0x6e174730),\r\n  X(0x4177cfb1), X(0x6dfd9a1c), X(0x41a2fc1a), X(0x6de3dc11),\r\n  X(0x41ce1e65), X(0x6dca0d14), X(0x41f93689), X(0x6db02d29),\r\n  X(0x42244481), X(0x6d963c54), X(0x424f4845), X(0x6d7c3a98),\r\n  X(0x427a41d0), X(0x6d6227fa), X(0x42a5311b), X(0x6d48047e),\r\n  X(0x42d0161e), X(0x6d2dd027), X(0x42faf0d4), X(0x6d138afb),\r\n  X(0x4325c135), X(0x6cf934fc), X(0x4350873c), X(0x6cdece2f),\r\n  X(0x437b42e1), X(0x6cc45698), X(0x43a5f41e), X(0x6ca9ce3b),\r\n  X(0x43d09aed), X(0x6c8f351c), X(0x43fb3746), X(0x6c748b3f),\r\n  X(0x4425c923), X(0x6c59d0a9), X(0x4450507e), X(0x6c3f055d),\r\n  X(0x447acd50), X(0x6c242960), X(0x44a53f93), X(0x6c093cb6),\r\n  X(0x44cfa740), X(0x6bee3f62), X(0x44fa0450), X(0x6bd3316a),\r\n  X(0x452456bd), X(0x6bb812d1), X(0x454e9e80), X(0x6b9ce39b),\r\n  X(0x4578db93), X(0x6b81a3cd), X(0x45a30df0), X(0x6b66536b),\r\n  X(0x45cd358f), X(0x6b4af279), X(0x45f7526b), X(0x6b2f80fb),\r\n  X(0x4621647d), X(0x6b13fef5), X(0x464b6bbe), X(0x6af86c6c),\r\n  X(0x46756828), X(0x6adcc964), X(0x469f59b4), X(0x6ac115e2),\r\n  X(0x46c9405c), X(0x6aa551e9), X(0x46f31c1a), X(0x6a897d7d),\r\n  X(0x471cece7), X(0x6a6d98a4), X(0x4746b2bc), X(0x6a51a361),\r\n  X(0x47706d93), X(0x6a359db9), X(0x479a1d67), X(0x6a1987b0),\r\n  X(0x47c3c22f), X(0x69fd614a), X(0x47ed5be6), X(0x69e12a8c),\r\n  X(0x4816ea86), X(0x69c4e37a), X(0x48406e08), X(0x69a88c19),\r\n  X(0x4869e665), X(0x698c246c), X(0x48935397), X(0x696fac78),\r\n  X(0x48bcb599), X(0x69532442), X(0x48e60c62), X(0x69368bce),\r\n  X(0x490f57ee), X(0x6919e320), X(0x49389836), X(0x68fd2a3d),\r\n  X(0x4961cd33), X(0x68e06129), X(0x498af6df), X(0x68c387e9),\r\n  X(0x49b41533), X(0x68a69e81), X(0x49dd282a), X(0x6889a4f6),\r\n  X(0x4a062fbd), X(0x686c9b4b), X(0x4a2f2be6), X(0x684f8186),\r\n  X(0x4a581c9e), X(0x683257ab), X(0x4a8101de), X(0x68151dbe),\r\n  X(0x4aa9dba2), X(0x67f7d3c5), X(0x4ad2a9e2), X(0x67da79c3),\r\n  X(0x4afb6c98), X(0x67bd0fbd), X(0x4b2423be), X(0x679f95b7),\r\n  X(0x4b4ccf4d), X(0x67820bb7), X(0x4b756f40), X(0x676471c0),\r\n  X(0x4b9e0390), X(0x6746c7d8), X(0x4bc68c36), X(0x67290e02),\r\n  X(0x4bef092d), X(0x670b4444), X(0x4c177a6e), X(0x66ed6aa1),\r\n  X(0x4c3fdff4), X(0x66cf8120), X(0x4c6839b7), X(0x66b187c3),\r\n  X(0x4c9087b1), X(0x66937e91), X(0x4cb8c9dd), X(0x6675658c),\r\n  X(0x4ce10034), X(0x66573cbb), X(0x4d092ab0), X(0x66390422),\r\n  X(0x4d31494b), X(0x661abbc5), X(0x4d595bfe), X(0x65fc63a9),\r\n  X(0x4d8162c4), X(0x65ddfbd3), X(0x4da95d96), X(0x65bf8447),\r\n  X(0x4dd14c6e), X(0x65a0fd0b), X(0x4df92f46), X(0x65826622),\r\n  X(0x4e210617), X(0x6563bf92), X(0x4e48d0dd), X(0x6545095f),\r\n  X(0x4e708f8f), X(0x6526438f), X(0x4e984229), X(0x65076e25),\r\n  X(0x4ebfe8a5), X(0x64e88926), X(0x4ee782fb), X(0x64c99498),\r\n  X(0x4f0f1126), X(0x64aa907f), X(0x4f369320), X(0x648b7ce0),\r\n  X(0x4f5e08e3), X(0x646c59bf), X(0x4f857269), X(0x644d2722),\r\n  X(0x4faccfab), X(0x642de50d), X(0x4fd420a4), X(0x640e9386),\r\n  X(0x4ffb654d), X(0x63ef3290), X(0x50229da1), X(0x63cfc231),\r\n  X(0x5049c999), X(0x63b0426d), X(0x5070e92f), X(0x6390b34a),\r\n  X(0x5097fc5e), X(0x637114cc), X(0x50bf031f), X(0x635166f9),\r\n  X(0x50e5fd6d), X(0x6331a9d4), X(0x510ceb40), X(0x6311dd64),\r\n  X(0x5133cc94), X(0x62f201ac), X(0x515aa162), X(0x62d216b3),\r\n  X(0x518169a5), X(0x62b21c7b), X(0x51a82555), X(0x6292130c),\r\n  X(0x51ced46e), X(0x6271fa69), X(0x51f576ea), X(0x6251d298),\r\n  X(0x521c0cc2), X(0x62319b9d), X(0x524295f0), X(0x6211557e),\r\n  X(0x5269126e), X(0x61f1003f), X(0x528f8238), X(0x61d09be5),\r\n  X(0x52b5e546), X(0x61b02876), X(0x52dc3b92), X(0x618fa5f7),\r\n  X(0x53028518), X(0x616f146c), X(0x5328c1d0), X(0x614e73da),\r\n  X(0x534ef1b5), X(0x612dc447), X(0x537514c2), X(0x610d05b7),\r\n  X(0x539b2af0), X(0x60ec3830), X(0x53c13439), X(0x60cb5bb7),\r\n  X(0x53e73097), X(0x60aa7050), X(0x540d2005), X(0x60897601),\r\n  X(0x5433027d), X(0x60686ccf), X(0x5458d7f9), X(0x604754bf),\r\n  X(0x547ea073), X(0x60262dd6), X(0x54a45be6), X(0x6004f819),\r\n  X(0x54ca0a4b), X(0x5fe3b38d), X(0x54efab9c), X(0x5fc26038),\r\n  X(0x55153fd4), X(0x5fa0fe1f), X(0x553ac6ee), X(0x5f7f8d46),\r\n  X(0x556040e2), X(0x5f5e0db3), X(0x5585adad), X(0x5f3c7f6b),\r\n  X(0x55ab0d46), X(0x5f1ae274), X(0x55d05faa), X(0x5ef936d1),\r\n  X(0x55f5a4d2), X(0x5ed77c8a), X(0x561adcb9), X(0x5eb5b3a2),\r\n  X(0x56400758), X(0x5e93dc1f), X(0x566524aa), X(0x5e71f606),\r\n  X(0x568a34a9), X(0x5e50015d), X(0x56af3750), X(0x5e2dfe29),\r\n  X(0x56d42c99), X(0x5e0bec6e), X(0x56f9147e), X(0x5de9cc33),\r\n  X(0x571deefa), X(0x5dc79d7c), X(0x5742bc06), X(0x5da5604f),\r\n  X(0x57677b9d), X(0x5d8314b1), X(0x578c2dba), X(0x5d60baa7),\r\n  X(0x57b0d256), X(0x5d3e5237), X(0x57d5696d), X(0x5d1bdb65),\r\n  X(0x57f9f2f8), X(0x5cf95638), X(0x581e6ef1), X(0x5cd6c2b5),\r\n  X(0x5842dd54), X(0x5cb420e0), X(0x58673e1b), X(0x5c9170bf),\r\n  X(0x588b9140), X(0x5c6eb258), X(0x58afd6bd), X(0x5c4be5b0),\r\n  X(0x58d40e8c), X(0x5c290acc), X(0x58f838a9), X(0x5c0621b2),\r\n  X(0x591c550e), X(0x5be32a67), X(0x594063b5), X(0x5bc024f0),\r\n  X(0x59646498), X(0x5b9d1154), X(0x598857b2), X(0x5b79ef96),\r\n  X(0x59ac3cfd), X(0x5b56bfbd), X(0x59d01475), X(0x5b3381ce),\r\n  X(0x59f3de12), X(0x5b1035cf), X(0x5a1799d1), X(0x5aecdbc5),\r\n  X(0x5a3b47ab), X(0x5ac973b5), X(0x5a5ee79a), X(0x5aa5fda5),\r\n  X(0x5a82799a), X(0x5a82799a)\r\n  };\r\n\r\n  /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */\r\nLOOKUP_T sincos_lookup1[1024] = {\r\n  X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb),\r\n  X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719),\r\n  X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572),\r\n  X(0x0146b860), X(0x7ffe5f03), X(0x0178fb99), X(0x7ffdd4d7),\r\n  X(0x01ab3e97), X(0x7ffd36ee), X(0x01dd8154), X(0x7ffc8549),\r\n  X(0x020fc3c6), X(0x7ffbbfe6), X(0x024205e8), X(0x7ffae6c7),\r\n  X(0x027447b0), X(0x7ff9f9ec), X(0x02a68917), X(0x7ff8f954),\r\n  X(0x02d8ca16), X(0x7ff7e500), X(0x030b0aa4), X(0x7ff6bcf0),\r\n  X(0x033d4abb), X(0x7ff58125), X(0x036f8a51), X(0x7ff4319d),\r\n  X(0x03a1c960), X(0x7ff2ce5b), X(0x03d407df), X(0x7ff1575d),\r\n  X(0x040645c7), X(0x7fefcca4), X(0x04388310), X(0x7fee2e30),\r\n  X(0x046abfb3), X(0x7fec7c02), X(0x049cfba7), X(0x7feab61a),\r\n  X(0x04cf36e5), X(0x7fe8dc78), X(0x05017165), X(0x7fe6ef1c),\r\n  X(0x0533ab20), X(0x7fe4ee06), X(0x0565e40d), X(0x7fe2d938),\r\n  X(0x05981c26), X(0x7fe0b0b1), X(0x05ca5361), X(0x7fde7471),\r\n  X(0x05fc89b8), X(0x7fdc247a), X(0x062ebf22), X(0x7fd9c0ca),\r\n  X(0x0660f398), X(0x7fd74964), X(0x06932713), X(0x7fd4be46),\r\n  X(0x06c5598a), X(0x7fd21f72), X(0x06f78af6), X(0x7fcf6ce8),\r\n  X(0x0729bb4e), X(0x7fcca6a7), X(0x075bea8c), X(0x7fc9ccb2),\r\n  X(0x078e18a7), X(0x7fc6df08), X(0x07c04598), X(0x7fc3dda9),\r\n  X(0x07f27157), X(0x7fc0c896), X(0x08249bdd), X(0x7fbd9fd0),\r\n  X(0x0856c520), X(0x7fba6357), X(0x0888ed1b), X(0x7fb7132b),\r\n  X(0x08bb13c5), X(0x7fb3af4e), X(0x08ed3916), X(0x7fb037bf),\r\n  X(0x091f5d06), X(0x7facac7f), X(0x09517f8f), X(0x7fa90d8e),\r\n  X(0x0983a0a7), X(0x7fa55aee), X(0x09b5c048), X(0x7fa1949e),\r\n  X(0x09e7de6a), X(0x7f9dbaa0), X(0x0a19fb04), X(0x7f99ccf4),\r\n  X(0x0a4c1610), X(0x7f95cb9a), X(0x0a7e2f85), X(0x7f91b694),\r\n  X(0x0ab0475c), X(0x7f8d8de1), X(0x0ae25d8d), X(0x7f895182),\r\n  X(0x0b147211), X(0x7f850179), X(0x0b4684df), X(0x7f809dc5),\r\n  X(0x0b7895f0), X(0x7f7c2668), X(0x0baaa53b), X(0x7f779b62),\r\n  X(0x0bdcb2bb), X(0x7f72fcb4), X(0x0c0ebe66), X(0x7f6e4a5e),\r\n  X(0x0c40c835), X(0x7f698461), X(0x0c72d020), X(0x7f64aabf),\r\n  X(0x0ca4d620), X(0x7f5fbd77), X(0x0cd6da2d), X(0x7f5abc8a),\r\n  X(0x0d08dc3f), X(0x7f55a7fa), X(0x0d3adc4e), X(0x7f507fc7),\r\n  X(0x0d6cda53), X(0x7f4b43f2), X(0x0d9ed646), X(0x7f45f47b),\r\n  X(0x0dd0d01f), X(0x7f409164), X(0x0e02c7d7), X(0x7f3b1aad),\r\n  X(0x0e34bd66), X(0x7f359057), X(0x0e66b0c3), X(0x7f2ff263),\r\n  X(0x0e98a1e9), X(0x7f2a40d2), X(0x0eca90ce), X(0x7f247ba5),\r\n  X(0x0efc7d6b), X(0x7f1ea2dc), X(0x0f2e67b8), X(0x7f18b679),\r\n  X(0x0f604faf), X(0x7f12b67c), X(0x0f923546), X(0x7f0ca2e7),\r\n  X(0x0fc41876), X(0x7f067bba), X(0x0ff5f938), X(0x7f0040f6),\r\n  X(0x1027d784), X(0x7ef9f29d), X(0x1059b352), X(0x7ef390ae),\r\n  X(0x108b8c9b), X(0x7eed1b2c), X(0x10bd6356), X(0x7ee69217),\r\n  X(0x10ef377d), X(0x7edff570), X(0x11210907), X(0x7ed94538),\r\n  X(0x1152d7ed), X(0x7ed28171), X(0x1184a427), X(0x7ecbaa1a),\r\n  X(0x11b66dad), X(0x7ec4bf36), X(0x11e83478), X(0x7ebdc0c6),\r\n  X(0x1219f880), X(0x7eb6aeca), X(0x124bb9be), X(0x7eaf8943),\r\n  X(0x127d7829), X(0x7ea85033), X(0x12af33ba), X(0x7ea1039b),\r\n  X(0x12e0ec6a), X(0x7e99a37c), X(0x1312a230), X(0x7e922fd6),\r\n  X(0x13445505), X(0x7e8aa8ac), X(0x137604e2), X(0x7e830dff),\r\n  X(0x13a7b1bf), X(0x7e7b5fce), X(0x13d95b93), X(0x7e739e1d),\r\n  X(0x140b0258), X(0x7e6bc8eb), X(0x143ca605), X(0x7e63e03b),\r\n  X(0x146e4694), X(0x7e5be40c), X(0x149fe3fc), X(0x7e53d462),\r\n  X(0x14d17e36), X(0x7e4bb13c), X(0x1503153a), X(0x7e437a9c),\r\n  X(0x1534a901), X(0x7e3b3083), X(0x15663982), X(0x7e32d2f4),\r\n  X(0x1597c6b7), X(0x7e2a61ed), X(0x15c95097), X(0x7e21dd73),\r\n  X(0x15fad71b), X(0x7e194584), X(0x162c5a3b), X(0x7e109a24),\r\n  X(0x165dd9f0), X(0x7e07db52), X(0x168f5632), X(0x7dff0911),\r\n  X(0x16c0cef9), X(0x7df62362), X(0x16f2443e), X(0x7ded2a47),\r\n  X(0x1723b5f9), X(0x7de41dc0), X(0x17552422), X(0x7ddafdce),\r\n  X(0x17868eb3), X(0x7dd1ca75), X(0x17b7f5a3), X(0x7dc883b4),\r\n  X(0x17e958ea), X(0x7dbf298d), X(0x181ab881), X(0x7db5bc02),\r\n  X(0x184c1461), X(0x7dac3b15), X(0x187d6c82), X(0x7da2a6c6),\r\n  X(0x18aec0db), X(0x7d98ff17), X(0x18e01167), X(0x7d8f4409),\r\n  X(0x19115e1c), X(0x7d85759f), X(0x1942a6f3), X(0x7d7b93da),\r\n  X(0x1973ebe6), X(0x7d719eba), X(0x19a52ceb), X(0x7d679642),\r\n  X(0x19d669fc), X(0x7d5d7a74), X(0x1a07a311), X(0x7d534b50),\r\n  X(0x1a38d823), X(0x7d4908d9), X(0x1a6a0929), X(0x7d3eb30f),\r\n  X(0x1a9b361d), X(0x7d3449f5), X(0x1acc5ef6), X(0x7d29cd8c),\r\n  X(0x1afd83ad), X(0x7d1f3dd6), X(0x1b2ea43a), X(0x7d149ad5),\r\n  X(0x1b5fc097), X(0x7d09e489), X(0x1b90d8bb), X(0x7cff1af5),\r\n  X(0x1bc1ec9e), X(0x7cf43e1a), X(0x1bf2fc3a), X(0x7ce94dfb),\r\n  X(0x1c240786), X(0x7cde4a98), X(0x1c550e7c), X(0x7cd333f3),\r\n  X(0x1c861113), X(0x7cc80a0f), X(0x1cb70f43), X(0x7cbcccec),\r\n  X(0x1ce80906), X(0x7cb17c8d), X(0x1d18fe54), X(0x7ca618f3),\r\n  X(0x1d49ef26), X(0x7c9aa221), X(0x1d7adb73), X(0x7c8f1817),\r\n  X(0x1dabc334), X(0x7c837ad8), X(0x1ddca662), X(0x7c77ca65),\r\n  X(0x1e0d84f5), X(0x7c6c06c0), X(0x1e3e5ee5), X(0x7c602fec),\r\n  X(0x1e6f342c), X(0x7c5445e9), X(0x1ea004c1), X(0x7c4848ba),\r\n  X(0x1ed0d09d), X(0x7c3c3860), X(0x1f0197b8), X(0x7c3014de),\r\n  X(0x1f325a0b), X(0x7c23de35), X(0x1f63178f), X(0x7c179467),\r\n  X(0x1f93d03c), X(0x7c0b3777), X(0x1fc4840a), X(0x7bfec765),\r\n  X(0x1ff532f2), X(0x7bf24434), X(0x2025dcec), X(0x7be5ade6),\r\n  X(0x205681f1), X(0x7bd9047c), X(0x208721f9), X(0x7bcc47fa),\r\n  X(0x20b7bcfe), X(0x7bbf7860), X(0x20e852f6), X(0x7bb295b0),\r\n  X(0x2118e3dc), X(0x7ba59fee), X(0x21496fa7), X(0x7b989719),\r\n  X(0x2179f64f), X(0x7b8b7b36), X(0x21aa77cf), X(0x7b7e4c45),\r\n  X(0x21daf41d), X(0x7b710a49), X(0x220b6b32), X(0x7b63b543),\r\n  X(0x223bdd08), X(0x7b564d36), X(0x226c4996), X(0x7b48d225),\r\n  X(0x229cb0d5), X(0x7b3b4410), X(0x22cd12bd), X(0x7b2da2fa),\r\n  X(0x22fd6f48), X(0x7b1feee5), X(0x232dc66d), X(0x7b1227d3),\r\n  X(0x235e1826), X(0x7b044dc7), X(0x238e646a), X(0x7af660c2),\r\n  X(0x23beab33), X(0x7ae860c7), X(0x23eeec78), X(0x7ada4dd8),\r\n  X(0x241f2833), X(0x7acc27f7), X(0x244f5e5c), X(0x7abdef25),\r\n  X(0x247f8eec), X(0x7aafa367), X(0x24afb9da), X(0x7aa144bc),\r\n  X(0x24dfdf20), X(0x7a92d329), X(0x250ffeb7), X(0x7a844eae),\r\n  X(0x25401896), X(0x7a75b74f), X(0x25702cb7), X(0x7a670d0d),\r\n  X(0x25a03b11), X(0x7a584feb), X(0x25d0439f), X(0x7a497feb),\r\n  X(0x26004657), X(0x7a3a9d0f), X(0x26304333), X(0x7a2ba75a),\r\n  X(0x26603a2c), X(0x7a1c9ece), X(0x26902b39), X(0x7a0d836d),\r\n  X(0x26c01655), X(0x79fe5539), X(0x26effb76), X(0x79ef1436),\r\n  X(0x271fda96), X(0x79dfc064), X(0x274fb3ae), X(0x79d059c8),\r\n  X(0x277f86b5), X(0x79c0e062), X(0x27af53a6), X(0x79b15435),\r\n  X(0x27df1a77), X(0x79a1b545), X(0x280edb23), X(0x79920392),\r\n  X(0x283e95a1), X(0x79823f20), X(0x286e49ea), X(0x797267f2),\r\n  X(0x289df7f8), X(0x79627e08), X(0x28cd9fc1), X(0x79528167),\r\n  X(0x28fd4140), X(0x79427210), X(0x292cdc6d), X(0x79325006),\r\n  X(0x295c7140), X(0x79221b4b), X(0x298bffb2), X(0x7911d3e2),\r\n  X(0x29bb87bc), X(0x790179cd), X(0x29eb0957), X(0x78f10d0f),\r\n  X(0x2a1a847b), X(0x78e08dab), X(0x2a49f920), X(0x78cffba3),\r\n  X(0x2a796740), X(0x78bf56f9), X(0x2aa8ced3), X(0x78ae9fb0),\r\n  X(0x2ad82fd2), X(0x789dd5cb), X(0x2b078a36), X(0x788cf94c),\r\n  X(0x2b36ddf7), X(0x787c0a36), X(0x2b662b0e), X(0x786b088c),\r\n  X(0x2b957173), X(0x7859f44f), X(0x2bc4b120), X(0x7848cd83),\r\n  X(0x2bf3ea0d), X(0x7837942b), X(0x2c231c33), X(0x78264849),\r\n  X(0x2c52478a), X(0x7814e9df), X(0x2c816c0c), X(0x780378f1),\r\n  X(0x2cb089b1), X(0x77f1f581), X(0x2cdfa071), X(0x77e05f91),\r\n  X(0x2d0eb046), X(0x77ceb725), X(0x2d3db928), X(0x77bcfc3f),\r\n  X(0x2d6cbb10), X(0x77ab2ee2), X(0x2d9bb5f6), X(0x77994f11),\r\n  X(0x2dcaa9d5), X(0x77875cce), X(0x2df996a3), X(0x7775581d),\r\n  X(0x2e287c5a), X(0x776340ff), X(0x2e575af3), X(0x77511778),\r\n  X(0x2e863267), X(0x773edb8b), X(0x2eb502ae), X(0x772c8d3a),\r\n  X(0x2ee3cbc1), X(0x771a2c88), X(0x2f128d99), X(0x7707b979),\r\n  X(0x2f41482e), X(0x76f5340e), X(0x2f6ffb7a), X(0x76e29c4b),\r\n  X(0x2f9ea775), X(0x76cff232), X(0x2fcd4c19), X(0x76bd35c7),\r\n  X(0x2ffbe95d), X(0x76aa670d), X(0x302a7f3a), X(0x76978605),\r\n  X(0x30590dab), X(0x768492b4), X(0x308794a6), X(0x76718d1c),\r\n  X(0x30b61426), X(0x765e7540), X(0x30e48c22), X(0x764b4b23),\r\n  X(0x3112fc95), X(0x76380ec8), X(0x31416576), X(0x7624c031),\r\n  X(0x316fc6be), X(0x76115f63), X(0x319e2067), X(0x75fdec60),\r\n  X(0x31cc7269), X(0x75ea672a), X(0x31fabcbd), X(0x75d6cfc5),\r\n  X(0x3228ff5c), X(0x75c32634), X(0x32573a3f), X(0x75af6a7b),\r\n  X(0x32856d5e), X(0x759b9c9b), X(0x32b398b3), X(0x7587bc98),\r\n  X(0x32e1bc36), X(0x7573ca75), X(0x330fd7e1), X(0x755fc635),\r\n  X(0x333debab), X(0x754bafdc), X(0x336bf78f), X(0x7537876c),\r\n  X(0x3399fb85), X(0x75234ce8), X(0x33c7f785), X(0x750f0054),\r\n  X(0x33f5eb89), X(0x74faa1b3), X(0x3423d78a), X(0x74e63108),\r\n  X(0x3451bb81), X(0x74d1ae55), X(0x347f9766), X(0x74bd199f),\r\n  X(0x34ad6b32), X(0x74a872e8), X(0x34db36df), X(0x7493ba34),\r\n  X(0x3508fa66), X(0x747eef85), X(0x3536b5be), X(0x746a12df),\r\n  X(0x356468e2), X(0x74552446), X(0x359213c9), X(0x744023bc),\r\n  X(0x35bfb66e), X(0x742b1144), X(0x35ed50c9), X(0x7415ece2),\r\n  X(0x361ae2d3), X(0x7400b69a), X(0x36486c86), X(0x73eb6e6e),\r\n  X(0x3675edd9), X(0x73d61461), X(0x36a366c6), X(0x73c0a878),\r\n  X(0x36d0d746), X(0x73ab2ab4), X(0x36fe3f52), X(0x73959b1b),\r\n  X(0x372b9ee3), X(0x737ff9ae), X(0x3758f5f2), X(0x736a4671),\r\n  X(0x37864477), X(0x73548168), X(0x37b38a6d), X(0x733eaa96),\r\n  X(0x37e0c7cc), X(0x7328c1ff), X(0x380dfc8d), X(0x7312c7a5),\r\n  X(0x383b28a9), X(0x72fcbb8c), X(0x38684c19), X(0x72e69db7),\r\n  X(0x389566d6), X(0x72d06e2b), X(0x38c278d9), X(0x72ba2cea),\r\n  X(0x38ef821c), X(0x72a3d9f7), X(0x391c8297), X(0x728d7557),\r\n  X(0x39497a43), X(0x7276ff0d), X(0x39766919), X(0x7260771b),\r\n  X(0x39a34f13), X(0x7249dd86), X(0x39d02c2a), X(0x72333251),\r\n  X(0x39fd0056), X(0x721c7580), X(0x3a29cb91), X(0x7205a716),\r\n  X(0x3a568dd4), X(0x71eec716), X(0x3a834717), X(0x71d7d585),\r\n  X(0x3aaff755), X(0x71c0d265), X(0x3adc9e86), X(0x71a9bdba),\r\n  X(0x3b093ca3), X(0x71929789), X(0x3b35d1a5), X(0x717b5fd3),\r\n  X(0x3b625d86), X(0x7164169d), X(0x3b8ee03e), X(0x714cbbeb),\r\n  X(0x3bbb59c7), X(0x71354fc0), X(0x3be7ca1a), X(0x711dd220),\r\n  X(0x3c143130), X(0x7106430e), X(0x3c408f03), X(0x70eea28e),\r\n  X(0x3c6ce38a), X(0x70d6f0a4), X(0x3c992ec0), X(0x70bf2d53),\r\n  X(0x3cc5709e), X(0x70a7589f), X(0x3cf1a91c), X(0x708f728b),\r\n  X(0x3d1dd835), X(0x70777b1c), X(0x3d49fde1), X(0x705f7255),\r\n  X(0x3d761a19), X(0x70475839), X(0x3da22cd7), X(0x702f2ccd),\r\n  X(0x3dce3614), X(0x7016f014), X(0x3dfa35c8), X(0x6ffea212),\r\n  X(0x3e262bee), X(0x6fe642ca), X(0x3e52187f), X(0x6fcdd241),\r\n  X(0x3e7dfb73), X(0x6fb5507a), X(0x3ea9d4c3), X(0x6f9cbd79),\r\n  X(0x3ed5a46b), X(0x6f841942), X(0x3f016a61), X(0x6f6b63d8),\r\n  X(0x3f2d26a0), X(0x6f529d40), X(0x3f58d921), X(0x6f39c57d),\r\n  X(0x3f8481dd), X(0x6f20dc92), X(0x3fb020ce), X(0x6f07e285),\r\n  X(0x3fdbb5ec), X(0x6eeed758), X(0x40074132), X(0x6ed5bb10),\r\n  X(0x4032c297), X(0x6ebc8db0), X(0x405e3a16), X(0x6ea34f3d),\r\n  X(0x4089a7a8), X(0x6e89ffb9), X(0x40b50b46), X(0x6e709f2a),\r\n  X(0x40e064ea), X(0x6e572d93), X(0x410bb48c), X(0x6e3daaf8),\r\n  X(0x4136fa27), X(0x6e24175c), X(0x416235b2), X(0x6e0a72c5),\r\n  X(0x418d6729), X(0x6df0bd35), X(0x41b88e84), X(0x6dd6f6b1),\r\n  X(0x41e3abbc), X(0x6dbd1f3c), X(0x420ebecb), X(0x6da336dc),\r\n  X(0x4239c7aa), X(0x6d893d93), X(0x4264c653), X(0x6d6f3365),\r\n  X(0x428fbabe), X(0x6d551858), X(0x42baa4e6), X(0x6d3aec6e),\r\n  X(0x42e584c3), X(0x6d20afac), X(0x43105a50), X(0x6d066215),\r\n  X(0x433b2585), X(0x6cec03af), X(0x4365e65b), X(0x6cd1947c),\r\n  X(0x43909ccd), X(0x6cb71482), X(0x43bb48d4), X(0x6c9c83c3),\r\n  X(0x43e5ea68), X(0x6c81e245), X(0x44108184), X(0x6c67300b),\r\n  X(0x443b0e21), X(0x6c4c6d1a), X(0x44659039), X(0x6c319975),\r\n  X(0x449007c4), X(0x6c16b521), X(0x44ba74bd), X(0x6bfbc021),\r\n  X(0x44e4d71c), X(0x6be0ba7b), X(0x450f2edb), X(0x6bc5a431),\r\n  X(0x45397bf4), X(0x6baa7d49), X(0x4563be60), X(0x6b8f45c7),\r\n  X(0x458df619), X(0x6b73fdae), X(0x45b82318), X(0x6b58a503),\r\n  X(0x45e24556), X(0x6b3d3bcb), X(0x460c5cce), X(0x6b21c208),\r\n  X(0x46366978), X(0x6b0637c1), X(0x46606b4e), X(0x6aea9cf8),\r\n  X(0x468a624a), X(0x6acef1b2), X(0x46b44e65), X(0x6ab335f4),\r\n  X(0x46de2f99), X(0x6a9769c1), X(0x470805df), X(0x6a7b8d1e),\r\n  X(0x4731d131), X(0x6a5fa010), X(0x475b9188), X(0x6a43a29a),\r\n  X(0x478546de), X(0x6a2794c1), X(0x47aef12c), X(0x6a0b7689),\r\n  X(0x47d8906d), X(0x69ef47f6), X(0x48022499), X(0x69d3090e),\r\n  X(0x482badab), X(0x69b6b9d3), X(0x48552b9b), X(0x699a5a4c),\r\n  X(0x487e9e64), X(0x697dea7b), X(0x48a805ff), X(0x69616a65),\r\n  X(0x48d16265), X(0x6944da10), X(0x48fab391), X(0x6928397e),\r\n  X(0x4923f97b), X(0x690b88b5), X(0x494d341e), X(0x68eec7b9),\r\n  X(0x49766373), X(0x68d1f68f), X(0x499f8774), X(0x68b5153a),\r\n  X(0x49c8a01b), X(0x689823bf), X(0x49f1ad61), X(0x687b2224),\r\n  X(0x4a1aaf3f), X(0x685e106c), X(0x4a43a5b0), X(0x6840ee9b),\r\n  X(0x4a6c90ad), X(0x6823bcb7), X(0x4a957030), X(0x68067ac3),\r\n  X(0x4abe4433), X(0x67e928c5), X(0x4ae70caf), X(0x67cbc6c0),\r\n  X(0x4b0fc99d), X(0x67ae54ba), X(0x4b387af9), X(0x6790d2b6),\r\n  X(0x4b6120bb), X(0x677340ba), X(0x4b89badd), X(0x67559eca),\r\n  X(0x4bb24958), X(0x6737ecea), X(0x4bdacc28), X(0x671a2b20),\r\n  X(0x4c034345), X(0x66fc596f), X(0x4c2baea9), X(0x66de77dc),\r\n  X(0x4c540e4e), X(0x66c0866d), X(0x4c7c622d), X(0x66a28524),\r\n  X(0x4ca4aa41), X(0x66847408), X(0x4ccce684), X(0x6666531d),\r\n  X(0x4cf516ee), X(0x66482267), X(0x4d1d3b7a), X(0x6629e1ec),\r\n  X(0x4d455422), X(0x660b91af), X(0x4d6d60df), X(0x65ed31b5),\r\n  X(0x4d9561ac), X(0x65cec204), X(0x4dbd5682), X(0x65b0429f),\r\n  X(0x4de53f5a), X(0x6591b38c), X(0x4e0d1c30), X(0x657314cf),\r\n  X(0x4e34ecfc), X(0x6554666d), X(0x4e5cb1b9), X(0x6535a86b),\r\n  X(0x4e846a60), X(0x6516dacd), X(0x4eac16eb), X(0x64f7fd98),\r\n  X(0x4ed3b755), X(0x64d910d1), X(0x4efb4b96), X(0x64ba147d),\r\n  X(0x4f22d3aa), X(0x649b08a0), X(0x4f4a4f89), X(0x647bed3f),\r\n  X(0x4f71bf2e), X(0x645cc260), X(0x4f992293), X(0x643d8806),\r\n  X(0x4fc079b1), X(0x641e3e38), X(0x4fe7c483), X(0x63fee4f8),\r\n  X(0x500f0302), X(0x63df7c4d), X(0x50363529), X(0x63c0043b),\r\n  X(0x505d5af1), X(0x63a07cc7), X(0x50847454), X(0x6380e5f6),\r\n  X(0x50ab814d), X(0x63613fcd), X(0x50d281d5), X(0x63418a50),\r\n  X(0x50f975e6), X(0x6321c585), X(0x51205d7b), X(0x6301f171),\r\n  X(0x5147388c), X(0x62e20e17), X(0x516e0715), X(0x62c21b7e),\r\n  X(0x5194c910), X(0x62a219aa), X(0x51bb7e75), X(0x628208a1),\r\n  X(0x51e22740), X(0x6261e866), X(0x5208c36a), X(0x6241b8ff),\r\n  X(0x522f52ee), X(0x62217a72), X(0x5255d5c5), X(0x62012cc2),\r\n  X(0x527c4bea), X(0x61e0cff5), X(0x52a2b556), X(0x61c06410),\r\n  X(0x52c91204), X(0x619fe918), X(0x52ef61ee), X(0x617f5f12),\r\n  X(0x5315a50e), X(0x615ec603), X(0x533bdb5d), X(0x613e1df0),\r\n  X(0x536204d7), X(0x611d66de), X(0x53882175), X(0x60fca0d2),\r\n  X(0x53ae3131), X(0x60dbcbd1), X(0x53d43406), X(0x60bae7e1),\r\n  X(0x53fa29ed), X(0x6099f505), X(0x542012e1), X(0x6078f344),\r\n  X(0x5445eedb), X(0x6057e2a2), X(0x546bbdd7), X(0x6036c325),\r\n  X(0x54917fce), X(0x601594d1), X(0x54b734ba), X(0x5ff457ad),\r\n  X(0x54dcdc96), X(0x5fd30bbc), X(0x5502775c), X(0x5fb1b104),\r\n  X(0x55280505), X(0x5f90478a), X(0x554d858d), X(0x5f6ecf53),\r\n  X(0x5572f8ed), X(0x5f4d4865), X(0x55985f20), X(0x5f2bb2c5),\r\n  X(0x55bdb81f), X(0x5f0a0e77), X(0x55e303e6), X(0x5ee85b82),\r\n  X(0x5608426e), X(0x5ec699e9), X(0x562d73b2), X(0x5ea4c9b3),\r\n  X(0x565297ab), X(0x5e82eae5), X(0x5677ae54), X(0x5e60fd84),\r\n  X(0x569cb7a8), X(0x5e3f0194), X(0x56c1b3a1), X(0x5e1cf71c),\r\n  X(0x56e6a239), X(0x5dfade20), X(0x570b8369), X(0x5dd8b6a7),\r\n  X(0x5730572e), X(0x5db680b4), X(0x57551d80), X(0x5d943c4e),\r\n  X(0x5779d65b), X(0x5d71e979), X(0x579e81b8), X(0x5d4f883b),\r\n  X(0x57c31f92), X(0x5d2d189a), X(0x57e7afe4), X(0x5d0a9a9a),\r\n  X(0x580c32a7), X(0x5ce80e41), X(0x5830a7d6), X(0x5cc57394),\r\n  X(0x58550f6c), X(0x5ca2ca99), X(0x58796962), X(0x5c801354),\r\n  X(0x589db5b3), X(0x5c5d4dcc), X(0x58c1f45b), X(0x5c3a7a05),\r\n  X(0x58e62552), X(0x5c179806), X(0x590a4893), X(0x5bf4a7d2),\r\n  X(0x592e5e19), X(0x5bd1a971), X(0x595265df), X(0x5bae9ce7),\r\n  X(0x59765fde), X(0x5b8b8239), X(0x599a4c12), X(0x5b68596d),\r\n  X(0x59be2a74), X(0x5b452288), X(0x59e1faff), X(0x5b21dd90),\r\n  X(0x5a05bdae), X(0x5afe8a8b), X(0x5a29727b), X(0x5adb297d),\r\n  X(0x5a4d1960), X(0x5ab7ba6c), X(0x5a70b258), X(0x5a943d5e),\r\n};\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/misc.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************/\r\n\r\n#define HEAD_ALIGN 64\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <stdio.h>\r\n#define MISC_C\r\n#include \"misc.h\"\r\n//#include <sys/time.h>\r\n\r\nstatic void **pointers=NULL;\r\nstatic long *insertlist=NULL; /* We can't embed this in the pointer list;\r\n\t\t\t  a pointer can have any value... */\r\n\r\nstatic char **files=NULL;\r\nstatic long *file_bytes=NULL;\r\nstatic int  filecount=0;\r\n\r\nstatic int ptop=0;\r\nstatic int palloced=0;\r\nstatic int pinsert=0;\r\n\r\ntypedef struct {\r\n  char *file;\r\n  long line;\r\n  long ptr;\r\n  long bytes;\r\n} head;\r\n\r\nlong global_bytes=0;\r\nlong start_time=-1;\r\n\r\nstatic void *_insert(void *ptr,long bytes,char *file,long line){\r\n  ((head *)ptr)->file=file;\r\n  ((head *)ptr)->line=line;\r\n  ((head *)ptr)->ptr=pinsert;\r\n  ((head *)ptr)->bytes=bytes-HEAD_ALIGN;\r\n\r\n  if(pinsert>=palloced){\r\n    palloced+=64;\r\n    if(pointers){\r\n      pointers=(void **)realloc(pointers,sizeof(void **)*palloced);\r\n      insertlist=(long *)realloc(insertlist,sizeof(long *)*palloced);\r\n    }else{\r\n      pointers=(void **)malloc(sizeof(void **)*palloced);\r\n      insertlist=(long *)malloc(sizeof(long *)*palloced);\r\n    }\r\n  }\r\n\r\n  pointers[pinsert]=ptr;\r\n\r\n  if(pinsert==ptop)\r\n    pinsert=++ptop;\r\n  else\r\n    pinsert=insertlist[pinsert];\r\n\r\n#ifdef _VDBG_GRAPHFILE\r\n  {\r\n    FILE *out;\r\n    struct timeval tv;\r\n    static struct timezone tz;\r\n    int i;\r\n    char buffer[80];\r\n    gettimeofday(&tv,&tz);\r\n\r\n    for(i=0;i<filecount;i++)\r\n      if(!strcmp(file,files[i]))break;\r\n\r\n    if(i==filecount){\r\n      filecount++;\r\n      if(!files){\r\n\tfiles=malloc(filecount*sizeof(*files));\r\n\tfile_bytes=malloc(filecount*sizeof(*file_bytes));\r\n      }else{\r\n\tfiles=realloc(files,filecount*sizeof(*files));\r\n\tfile_bytes=realloc(file_bytes,filecount*sizeof(*file_bytes));\r\n      }\r\n      files[i]=strdup(file);\r\n      file_bytes[i]=0;\r\n    }\r\n\r\n    file_bytes[i]+=bytes-HEAD_ALIGN;\r\n\r\n    if(start_time==-1)start_time=(tv.tv_sec*1000)+(tv.tv_usec/1000);\r\n\r\n    snprintf(buffer,80,\"%s\",file);\r\n    if(strchr(buffer,'.'))strchr(buffer,'.')[0]=0;\r\n    strcat(buffer,_VDBG_GRAPHFILE);\r\n    out=fopen(buffer,\"a\");\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    file_bytes[i]-(bytes-HEAD_ALIGN));\r\n    fprintf(out,\"%ld, %ld # FILE %s LINE %ld\\n\",\r\n\t    -start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    file_bytes[i],file,line);\r\n    fclose(out);\r\n\r\n    out=fopen(\"total\"_VDBG_GRAPHFILE,\"a\");\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    global_bytes);\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    global_bytes+(bytes-HEAD_ALIGN));\r\n    fclose(out);\r\n  }\r\n#endif\r\n\r\n  global_bytes+=(bytes-HEAD_ALIGN);\r\n\r\n  return(void *)(((char *)ptr)+HEAD_ALIGN);\r\n}\r\n\r\nstatic void _ripremove(void *ptr){\r\n  int insert;\r\n\r\n#ifdef _VDBG_GRAPHFILE\r\n  {\r\n    FILE *out=fopen(\"total\"_VDBG_GRAPHFILE,\"a\");\r\n    struct timeval tv;\r\n    static struct timezone tz;\r\n    char buffer[80];\r\n    char *file =((head *)ptr)->file;\r\n    long bytes =((head *)ptr)->bytes;\r\n    int i;\r\n\r\n    gettimeofday(&tv,&tz);\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    global_bytes);\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    global_bytes-((head *)ptr)->bytes);\r\n    fclose(out);\r\n\r\n    for(i=0;i<filecount;i++)\r\n      if(!strcmp(file,files[i]))break;\r\n\r\n    snprintf(buffer,80,\"%s\",file);\r\n    if(strchr(buffer,'.'))strchr(buffer,'.')[0]=0;\r\n    strcat(buffer,_VDBG_GRAPHFILE);\r\n    out=fopen(buffer,\"a\");\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    file_bytes[i]);\r\n    fprintf(out,\"%ld, %ld\\n\",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),\r\n\t    file_bytes[i]-bytes);\r\n    fclose(out);\r\n\r\n    file_bytes[i]-=bytes;\r\n\r\n  }\r\n#endif\r\n\r\n  global_bytes-=((head *)ptr)->bytes;\r\n\r\n  insert=((head *)ptr)->ptr;\r\n  insertlist[insert]=pinsert;\r\n  pinsert=insert;\r\n\r\n  if(pointers[insert]==NULL){\r\n    fprintf(stderr,\"DEBUGGING MALLOC ERROR: freeing previously freed memory\\n\");\r\n    fprintf(stderr,\"\\t%s %ld\\n\",((head *)ptr)->file,((head *)ptr)->line);\r\n  }\r\n\r\n  if(global_bytes<0){\r\n    fprintf(stderr,\"DEBUGGING MALLOC ERROR: freeing unmalloced memory\\n\");\r\n  }\r\n\r\n  pointers[insert]=NULL;\r\n}\r\n\r\nvoid _VDBG_dump(void){\r\n  int i;\r\n  for(i=0;i<ptop;i++){\r\n    head *ptr=pointers[i];\r\n    if(ptr)\r\n      fprintf(stderr,\"unfreed bytes from %s:%ld\\n\",\r\n\t      ptr->file,ptr->line);\r\n  }\r\n\r\n}\r\n\r\nextern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){\r\n  bytes+=HEAD_ALIGN;\r\n  if(ptr){\r\n    ptr=(void *)(((char *)ptr)-HEAD_ALIGN);\r\n    _ripremove(ptr);\r\n    ptr=realloc(ptr,bytes);\r\n  }else{\r\n    ptr=malloc(bytes);\r\n    memset(ptr,0,bytes);\r\n  }\r\n  return _insert(ptr,bytes,file,line);\r\n}\r\n\r\nextern void _VDBG_free(void *ptr,char *file,long line){\r\n  if(ptr){\r\n    ptr=(void *)(((char *)ptr)-HEAD_ALIGN);\r\n    _ripremove(ptr);\r\n    free(ptr);\r\n  }\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/misc.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: miscellaneous math and prototypes\r\n\r\n ************************************************************************/\r\n\r\n#ifndef _V_RANDOM_H_\r\n#define _V_RANDOM_H_\r\n#include \"ivorbiscodec.h\"\r\n#include \"os_types.h\"\r\n\r\n/*#define _VDBG_GRAPHFILE \"_0.m\"*/\r\n\r\n\r\n#ifdef _VDBG_GRAPHFILE\r\nextern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);\r\nextern void _VDBG_free(void *ptr,char *file,long line);\r\n\r\n#undef _ogg_malloc\r\n#undef _ogg_calloc\r\n#undef _ogg_realloc\r\n#undef _ogg_free\r\n\r\n#define _ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__)\r\n#define _ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__)\r\n#define _ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__)\r\n#define _ogg_free(x) _VDBG_free((x),__FILE__,__LINE__)\r\n#endif\r\n\r\n#include \"asm_arm.h\"\r\n\r\n#ifndef _V_WIDE_MATH\r\n#define _V_WIDE_MATH\r\n\r\n#ifndef  _LOW_ACCURACY_\r\n/* 64 bit multiply */\r\n\r\n#include <endian.h>\r\n#include <sys/types.h>\r\n\r\n#if BYTE_ORDER==LITTLE_ENDIAN\r\nunion magic {\r\n  struct {\r\n    ogg_int32_t lo;\r\n    ogg_int32_t hi;\r\n  } halves;\r\n  ogg_int64_t whole;\r\n};\r\n#endif\r\n\r\n#if BYTE_ORDER==BIG_ENDIAN\r\nunion magic {\r\n  struct {\r\n    ogg_int32_t hi;\r\n    ogg_int32_t lo;\r\n  } halves;\r\n  ogg_int64_t whole;\r\n};\r\n#endif\r\n\r\nstatic inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {\r\n  union magic magic;\r\n  magic.whole = (ogg_int64_t)x * y;\r\n  return magic.halves.hi;\r\n}\r\n\r\nstatic inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {\r\n  return MULT32(x,y)<<1;\r\n}\r\n\r\nstatic inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {\r\n  union magic magic;\r\n  magic.whole  = (ogg_int64_t)x * y;\r\n  return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);\r\n}\r\n\r\n#else\r\n/* 32 bit multiply, more portable but less accurate */\r\n\r\n/*\r\n * Note: Precision is biased towards the first argument therefore ordering\r\n * is important.  Shift values were chosen for the best sound quality after\r\n * many listening tests.\r\n */\r\n\r\n/*\r\n * For MULT32 and MULT31: The second argument is always a lookup table\r\n * value already preshifted from 31 to 8 bits.  We therefore take the\r\n * opportunity to save on text space and use unsigned char for those\r\n * tables in this case.\r\n */\r\n\r\nstatic inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {\r\n  return (x >> 9) * y;  /* y preshifted >>23 */\r\n}\r\n\r\nstatic inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {\r\n  return (x >> 8) * y;  /* y preshifted >>23 */\r\n}\r\n\r\nstatic inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {\r\n  return (x >> 6) * y;  /* y preshifted >>9 */\r\n}\r\n\r\n#endif\r\n\r\n/*\r\n * This should be used as a memory barrier, forcing all cached values in\r\n * registers to wr writen back to memory.  Might or might not be beneficial\r\n * depending on the architecture and compiler.\r\n */\r\n#define MB()\r\n\r\n/*\r\n * The XPROD functions are meant to optimize the cross products found all\r\n * over the place in mdct.c by forcing memory operation ordering to avoid\r\n * unnecessary register reloads as soon as memory is being written to.\r\n * However this is only beneficial on CPUs with a sane number of general\r\n * purpose registers which exclude the Intel x86.  On Intel, better let the\r\n * compiler actually reload registers directly from original memory by using\r\n * macros.\r\n */\r\n\r\n#ifdef __i386__\r\n\r\n#define XPROD32(_a, _b, _t, _v, _x, _y)\t\t\\\r\n  { *(_x)=MULT32(_a,_t)+MULT32(_b,_v);\t\t\\\r\n    *(_y)=MULT32(_b,_t)-MULT32(_a,_v); }\r\n#define XPROD31(_a, _b, _t, _v, _x, _y)\t\t\\\r\n  { *(_x)=MULT31(_a,_t)+MULT31(_b,_v);\t\t\\\r\n    *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }\r\n#define XNPROD31(_a, _b, _t, _v, _x, _y)\t\\\r\n  { *(_x)=MULT31(_a,_t)-MULT31(_b,_v);\t\t\\\r\n    *(_y)=MULT31(_b,_t)+MULT31(_a,_v); }\r\n\r\n#else\r\n\r\nstatic inline void XPROD32(ogg_int32_t  a, ogg_int32_t  b,\r\n\t\t\t   ogg_int32_t  t, ogg_int32_t  v,\r\n\t\t\t   ogg_int32_t *x, ogg_int32_t *y)\r\n{\r\n  *x = MULT32(a, t) + MULT32(b, v);\r\n  *y = MULT32(b, t) - MULT32(a, v);\r\n}\r\n\r\nstatic inline void XPROD31(ogg_int32_t  a, ogg_int32_t  b,\r\n\t\t\t   ogg_int32_t  t, ogg_int32_t  v,\r\n\t\t\t   ogg_int32_t *x, ogg_int32_t *y)\r\n{\r\n  *x = MULT31(a, t) + MULT31(b, v);\r\n  *y = MULT31(b, t) - MULT31(a, v);\r\n}\r\n\r\nstatic inline void XNPROD31(ogg_int32_t  a, ogg_int32_t  b,\r\n\t\t\t    ogg_int32_t  t, ogg_int32_t  v,\r\n\t\t\t    ogg_int32_t *x, ogg_int32_t *y)\r\n{\r\n  *x = MULT31(a, t) - MULT31(b, v);\r\n  *y = MULT31(b, t) + MULT31(a, v);\r\n}\r\n\r\n#endif\r\n\r\n#endif\r\n\r\n#ifndef _V_CLIP_MATH\r\n#define _V_CLIP_MATH\r\n\r\nstatic inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {\r\n  int ret=x;\r\n  ret-= ((x<=32767)-1)&(x-32767);\r\n  ret-= ((x>=-32768)-1)&(x+32768);\r\n  return(ret);\r\n}\r\n\r\n#endif\r\n\r\n#endif\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/ogg.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: subsumed libogg includes\r\n\r\n ************************************************************************/\r\n#ifndef _OGG_H\r\n#define _OGG_H\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#include \"os_types.h\"\r\n\r\n#ifndef ONLY_C\r\n#define ARM_LITTLE_ENDIAN\r\n#endif\r\n\r\ntypedef struct ogg_buffer_state{\r\n  struct ogg_buffer    *unused_buffers;\r\n  struct ogg_reference *unused_references;\r\n  int                   outstanding;\r\n  int                   shutdown;\r\n} ogg_buffer_state;\r\n\r\ntypedef struct ogg_buffer {\r\n  unsigned char      *data;\r\n  long                size;\r\n  int                 refcount;\r\n\r\n  union {\r\n    ogg_buffer_state  *owner;\r\n    struct ogg_buffer *next;\r\n  } ptr;\r\n} ogg_buffer;\r\n\r\ntypedef struct ogg_reference {\r\n  ogg_buffer    *buffer;\r\n  long           begin;\r\n  long           length;\r\n\r\n  struct ogg_reference *next;\r\n} ogg_reference;\r\n\r\ntypedef struct oggpack_buffer {\r\n#ifdef ARM_LITTLE_ENDIAN\r\n  int            bitsLeftInSegment;\r\n  ogg_uint32_t  *ptr;\r\n  long           bitsLeftInWord;\r\n#else\r\n  int            headbit;\r\n  unsigned char *headptr;\r\n  long           headend;\r\n#endif /* ARM_LITTLE_ENDIAN */\r\n  /* memory management */\r\n  ogg_reference *head;\r\n  ogg_reference *tail;\r\n\r\n  /* render the byte/bit counter API constant time */\r\n  long              count; /* doesn't count the tail */\r\n} oggpack_buffer;\r\n\r\ntypedef struct oggbyte_buffer {\r\n  ogg_reference *baseref;\r\n\r\n  ogg_reference *ref;\r\n  unsigned char *ptr;\r\n  long           pos;\r\n  long           end;\r\n} oggbyte_buffer;\r\n\r\ntypedef struct ogg_sync_state {\r\n  /* decode memory management pool */\r\n  ogg_buffer_state *bufferpool;\r\n\r\n  /* stream buffers */\r\n  ogg_reference    *fifo_head;\r\n  ogg_reference    *fifo_tail;\r\n  long              fifo_fill;\r\n\r\n  /* stream sync management */\r\n  int               unsynced;\r\n  int               headerbytes;\r\n  int               bodybytes;\r\n\r\n} ogg_sync_state;\r\n\r\ntypedef struct ogg_stream_state {\r\n  ogg_reference *header_head;\r\n  ogg_reference *header_tail;\r\n  ogg_reference *body_head;\r\n  ogg_reference *body_tail;\r\n\r\n  int            e_o_s;    /* set when we have buffered the last\r\n                              packet in the logical bitstream */\r\n  int            b_o_s;    /* set after we've written the initial page\r\n                              of a logical bitstream */\r\n  long           serialno;\r\n  long           pageno;\r\n  ogg_int64_t    packetno; /* sequence number for decode; the framing\r\n                              knows where there's a hole in the data,\r\n                              but we need coupling so that the codec\r\n                              (which is in a seperate abstraction\r\n                              layer) also knows about the gap */\r\n  ogg_int64_t    granulepos;\r\n\r\n  int            lacing_fill;\r\n  ogg_uint32_t   body_fill;\r\n\r\n  /* decode-side state data */\r\n  int            holeflag;\r\n  int            spanflag;\r\n  int            clearflag;\r\n  int            laceptr;\r\n  ogg_uint32_t   body_fill_next;\r\n\r\n} ogg_stream_state;\r\n\r\ntypedef struct {\r\n  ogg_reference *packet;\r\n  long           bytes;\r\n  long           b_o_s;\r\n  long           e_o_s;\r\n  ogg_int64_t    granulepos;\r\n  ogg_int64_t    packetno;     /* sequence number for decode; the framing\r\n                                  knows where there's a hole in the data,\r\n                                  but we need coupling so that the codec\r\n                                  (which is in a seperate abstraction\r\n                                  layer) also knows about the gap */\r\n} ogg_packet;\r\n\r\ntypedef struct {\r\n  ogg_reference *header;\r\n  int            header_len;\r\n  ogg_reference *body;\r\n  long           body_len;\r\n} ogg_page;\r\n\r\n/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/\r\n\r\nextern void  oggpack_readinit(oggpack_buffer *b,ogg_reference *r);\r\nextern long  oggpack_look(oggpack_buffer *b,int bits);\r\nextern void  oggpack_adv(oggpack_buffer *b,int bits);\r\nextern long  oggpack_read(oggpack_buffer *b,int bits);\r\nextern long  oggpack_bytes(oggpack_buffer *b);\r\nextern long  oggpack_bits(oggpack_buffer *b);\r\nextern int   oggpack_eop(oggpack_buffer *b);\r\n\r\n// Quick hack\r\n#define oggpack_bytesleft(B)  (((B)->bitsLeftInSegment+7)/8)\r\n\r\n/* Ogg BITSTREAM PRIMITIVES: decoding **************************/\r\n\r\nextern void     ogg_sync_init(ogg_sync_state *oy);\r\nextern ogg_sync_state *ogg_sync_create(void);\r\nextern int      ogg_sync_clear(ogg_sync_state *oy);\r\nextern int      ogg_sync_destroy(ogg_sync_state *oy);\r\nextern int      ogg_sync_reset(ogg_sync_state *oy);\r\n\r\nextern unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long size);\r\nextern int      ogg_sync_wrote(ogg_sync_state *oy, long bytes);\r\nextern long     ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);\r\nextern int      ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);\r\nextern int      ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);\r\nextern int      ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);\r\nextern int      ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);\r\n\r\n/* Ogg BITSTREAM PRIMITIVES: general ***************************/\r\n\r\nextern void     ogg_stream_init(ogg_stream_state *os, int serialno);\r\nextern ogg_stream_state *ogg_stream_create(int serialno);\r\nextern int      ogg_stream_destroy(ogg_stream_state *os);\r\nextern int      ogg_stream_clear(ogg_stream_state *os);\r\nextern int      ogg_stream_reset(ogg_stream_state *os);\r\nextern int      ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);\r\nextern int      ogg_stream_eos(ogg_stream_state *os);\r\n\r\nextern int      ogg_page_checksum_set(ogg_page *og);\r\n\r\nextern int      ogg_page_version(ogg_page *og);\r\nextern int      ogg_page_continued(ogg_page *og);\r\nextern int      ogg_page_bos(ogg_page *og);\r\nextern int      ogg_page_eos(ogg_page *og);\r\nextern ogg_int64_t  ogg_page_granulepos(ogg_page *og);\r\nextern ogg_uint32_t ogg_page_serialno(ogg_page *og);\r\nextern ogg_uint32_t ogg_page_pageno(ogg_page *og);\r\nextern int      ogg_page_packets(ogg_page *og);\r\nextern int      ogg_page_getbuffer(ogg_page *og, unsigned char **buffer);\r\n\r\nextern int      ogg_packet_release(ogg_packet *op);\r\nextern int      ogg_page_release(ogg_page *og);\r\n\r\nextern void     ogg_page_dup(ogg_page *d, ogg_page *s);\r\n\r\n/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/\r\n\r\n#define  OGG_SUCCESS   0\r\n\r\n#define  OGG_HOLE     -10\r\n#define  OGG_SPAN     -11\r\n#define  OGG_EVERSION -12\r\n#define  OGG_ESERIAL  -13\r\n#define  OGG_EINVAL   -14\r\n#define  OGG_EEOS     -15\r\n\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif  /* _OGG_H */\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/os.h",
    "content": "#ifndef _OS_H\r\n#define _OS_H\r\n/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: #ifdef jail to whip a few platforms into the UNIX ideal.\r\n\r\n ************************************************************************/\r\n\r\n#include <math.h>\r\n#include \"os_types.h\"\r\n\r\n#ifndef _V_IFDEFJAIL_H_\r\n#  define _V_IFDEFJAIL_H_\r\n\r\n#  ifdef __GNUC__\r\n#    define STIN static __inline__\r\n#  elif _WIN32\r\n#    define STIN static __inline\r\n#  endif\r\n#else\r\n#  define STIN static\r\n#endif\r\n\r\n#ifndef M_PI\r\n#  define M_PI (3.1415926536f)\r\n#endif\r\n\r\n#ifdef _WIN32\r\n#  include <malloc.h>\r\n#  define rint(x)   (floor((x)+0.5f)) \r\n#  define NO_FLOAT_MATH_LIB\r\n#  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))\r\n#endif\r\n\r\n#ifdef HAVE_ALLOCA_H\r\n#  include <alloca.h>\r\n#endif\r\n\r\n#ifdef USE_MEMORY_H\r\n#  include <memory.h>\r\n#endif\r\n\r\n#ifndef min\r\n#  define min(x,y)  ((x)>(y)?(y):(x))\r\n#endif\r\n\r\n#ifndef max\r\n#  define max(x,y)  ((x)<(y)?(y):(x))\r\n#endif\r\n\r\n#endif /* _OS_H */\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/os_types.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: #ifdef jail to whip a few platforms into the UNIX ideal.\r\n\r\n ************************************************************************/\r\n#ifndef _OS_TYPES_H\r\n#define _OS_TYPES_H\r\n\r\n#ifdef _LOW_ACCURACY_\r\n#  define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))\r\n#  define LOOKUP_T const unsigned char\r\n#else\r\n#  define X(n) (n)\r\n#  define LOOKUP_T const ogg_int32_t\r\n#endif\r\n\r\n/* make it easy on the folks that want to compile the libs with a\r\n   different malloc than stdlib */\r\n#define _ogg_malloc  malloc\r\n#define _ogg_calloc  calloc\r\n#define _ogg_realloc realloc\r\n#define _ogg_free    free\r\n\r\n#if defined (_WIN32_WCE)\r\n\r\n   typedef unsigned short ogg_uint16_t;\r\n   typedef short ogg_int16_t;\r\n   typedef int ogg_int32_t;\r\n   typedef unsigned int ogg_uint32_t;\r\n   typedef __int64 ogg_int64_t;\r\n\r\n   #define inline\r\n\r\n#elif defined(_WIN32)\r\n\r\n#  ifndef __GNUC__\r\n   /* MSVC/Borland */\r\n   typedef __int64 ogg_int64_t;\r\n   typedef __int32 ogg_int32_t;\r\n   typedef unsigned __int32 ogg_uint32_t;\r\n   typedef __int16 ogg_int16_t;\r\n   typedef unsigned __int16 ogg_uint16_t;\r\n#  else\r\n   /* Cygwin */\r\n   #include <_G_config.h>\r\n   typedef _G_int64_t ogg_int64_t;\r\n   typedef _G_int32_t ogg_int32_t;\r\n   typedef _G_uint32_t ogg_uint32_t;\r\n   typedef _G_int16_t ogg_int16_t;\r\n   typedef _G_uint16_t ogg_uint16_t;\r\n#  endif\r\n\r\n#elif defined(__MACOS__)\r\n\r\n#  include <sys/types.h>\r\n   typedef SInt16 ogg_int16_t;\r\n   typedef UInt16 ogg_uint16_t;\r\n   typedef SInt32 ogg_int32_t;\r\n   typedef UInt32 ogg_uint32_t;\r\n   typedef SInt64 ogg_int64_t;\r\n\r\n#elif defined(__MACOSX__) /* MacOS X Framework build */\r\n\r\n#  include <sys/types.h>\r\n   typedef int16_t ogg_int16_t;\r\n   typedef u_int16_t ogg_uint16_t;\r\n   typedef int32_t ogg_int32_t;\r\n   typedef u_int32_t ogg_uint32_t;\r\n   typedef int64_t ogg_int64_t;\r\n\r\n#elif defined(__BEOS__)\r\n\r\n   /* Be */\r\n#  include <inttypes.h>\r\n\r\n#elif defined (__EMX__)\r\n\r\n   /* OS/2 GCC */\r\n   typedef short ogg_int16_t;\r\n   typedef unsigned short ogg_uint16_t;\r\n   typedef int ogg_int32_t;\r\n   typedef unsigned int ogg_uint32_t;\r\n   typedef long long ogg_int64_t;\r\n\r\n#else\r\n\r\n#  include <sys/types.h>\r\n#  include \"config_types.h\"\r\n#  include <endian.h>\r\n\r\n#endif\r\n\r\n#endif  /* _OS_TYPES_H */\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/res012.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: residue backend 0, 1 and 2 implementation\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <math.h>\r\n#include \"ogg.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"codec_internal.h\"\r\n#include \"codebook.h\"\r\n#include \"misc.h\"\r\n#include \"os.h\"\r\n\r\nvoid res_clear_info(vorbis_info_residue *info){\r\n  if(info){\r\n    if(info->stagemasks)_ogg_free(info->stagemasks);\r\n    if(info->stagebooks)_ogg_free(info->stagebooks);\r\n    memset(info,0,sizeof(*info));\r\n  }\r\n}\r\n\r\n\r\n/* vorbis_info is for range checking */\r\nint res_unpack(vorbis_info_residue *info,\r\n\t\tvorbis_info *vi,oggpack_buffer *opb){\r\n  int j,k;\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  memset(info,0,sizeof(*info));\r\n\r\n  info->type=oggpack_read(opb,16);\r\n  if(info->type>2 || info->type<0)goto errout;\r\n  info->begin=oggpack_read(opb,24);\r\n  info->end=oggpack_read(opb,24);\r\n  info->grouping=oggpack_read(opb,24)+1;\r\n  info->partitions=(char)(oggpack_read(opb,6)+1);\r\n  info->groupbook=(unsigned char)oggpack_read(opb,8);\r\n  if(info->groupbook>=ci->books)goto errout;\r\n\r\n  info->stagemasks=_ogg_malloc(info->partitions*sizeof(*info->stagemasks));\r\n  info->stagebooks=_ogg_malloc(info->partitions*8*sizeof(*info->stagebooks));\r\n\r\n  for(j=0;j<info->partitions;j++){\r\n    int cascade=oggpack_read(opb,3);\r\n    if(oggpack_read(opb,1))\r\n      cascade|=(oggpack_read(opb,5)<<3);\r\n    info->stagemasks[j]=cascade;\r\n  }\r\n\r\n  for(j=0;j<info->partitions;j++){\r\n    for(k=0;k<8;k++){\r\n      if((info->stagemasks[j]>>k)&1){\r\n\tunsigned char book=(unsigned char)oggpack_read(opb,8);\r\n\tif(book>=ci->books)goto errout;\r\n\tinfo->stagebooks[j*8+k]=book;\r\n\tif(k+1>info->stages)info->stages=k+1;\r\n      }else\r\n\tinfo->stagebooks[j*8+k]=0xff;\r\n    }\r\n  }\r\n\r\n  if(oggpack_eop(opb))goto errout;\r\n\r\n  return 0;\r\n errout:\r\n  res_clear_info(info);\r\n  return 1;\r\n}\r\n\r\nint res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info,\r\n\t\togg_int32_t **in,int *nonzero,int ch){\r\n\r\n  int i,j,k,s,used=0;\r\n  codec_setup_info     *ci=(codec_setup_info *)vd->vi->codec_setup;\r\n  codebook *phrasebook=ci->book_param+info->groupbook;\r\n  int samples_per_partition=info->grouping;\r\n  int partitions_per_word=phrasebook->dim;\r\n  int pcmend=ci->blocksizes[vd->W];\r\n\r\n  if(info->type<2){\r\n    int max=pcmend>>1;\r\n    int end=(info->end<max?info->end:max);\r\n    int n=end-info->begin;\r\n\r\n    if(n>0){\r\n      int partvals=n/samples_per_partition;\r\n      int partwords=(partvals+partitions_per_word-1)/partitions_per_word;\r\n\r\n      for(i=0;i<ch;i++)\r\n\tif(nonzero[i])\r\n\t  in[used++]=in[i];\r\n      ch=used;\r\n\r\n      if(used){\r\n\r\n\tchar **partword=(char **)alloca(ch*sizeof(*partword));\r\n\tfor(j=0;j<ch;j++)\r\n\t  partword[j]=(char *)alloca(partwords*partitions_per_word*\r\n\t\t\t\t     sizeof(*partword[j]));\r\n\r\n\tfor(s=0;s<info->stages;s++){\r\n\r\n\t  for(i=0;i<partvals;){\r\n\t    if(s==0){\r\n\t      /* fetch the partition word for each channel */\r\n\r\n\t      partword[0][i+partitions_per_word-1]=1;\r\n\t      for(k=partitions_per_word-2;k>=0;k--)\r\n\t\tpartword[0][i+k]=partword[0][i+k+1]*info->partitions;\r\n\r\n\t      for(j=1;j<ch;j++)\r\n\t\tfor(k=partitions_per_word-1;k>=0;k--)\r\n\t\t  partword[j][i+k]=partword[j-1][i+k];\r\n\r\n\t      for(j=0;j<ch;j++){\r\n\t\tint temp=vorbis_book_decode(phrasebook,&vd->opb);\r\n\t\tif(temp==-1)goto eopbreak;\r\n\r\n\t\t/* this can be done quickly in assembly due to the quotient\r\n\t\t   always being at most six bits */\r\n\t\tfor(k=0;k<partitions_per_word;k++){\r\n\t\t  ogg_uint32_t div=partword[j][i+k];\r\n\t\t  partword[j][i+k]=temp/div;\r\n\t\t  temp-=partword[j][i+k]*div;\r\n\t\t}\r\n\r\n\t      }\r\n\t    }\r\n\r\n\t    /* now we decode residual values for the partitions */\r\n\t    for(k=0;k<partitions_per_word && i<partvals;k++,i++)\r\n\t      for(j=0;j<ch;j++){\r\n\t\tlong offset=info->begin+i*samples_per_partition;\r\n\t\tif(info->stagemasks[(int)partword[j][i]]&(1<<s)){\r\n\t\t  codebook *stagebook=ci->book_param+\r\n\t\t    info->stagebooks[(partword[j][i]<<3)+s];\r\n\t\t  if(info->type){\r\n\t\t    if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vd->opb,\r\n\t\t\t\t\t       samples_per_partition,-8)==-1)\r\n\t\t      goto eopbreak;\r\n\t\t  }else{\r\n\t\t    if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vd->opb,\r\n\t\t\t\t\t\tsamples_per_partition,-8)==-1)\r\n\t\t      goto eopbreak;\r\n\t\t  }\r\n\t\t}\r\n\t      }\r\n\t  }\r\n\t}\r\n      }\r\n    }\r\n  }else{\r\n    int max=(pcmend*ch)>>1;\r\n    int end=(info->end<max?info->end:max);\r\n    int n=end-info->begin;\r\n\r\n    if(n>0){\r\n      int partvals=n/samples_per_partition;\r\n      int partwords=(partvals+partitions_per_word-1)/partitions_per_word;\r\n\r\n      char *partword=\r\n\t(char *)alloca(partwords*partitions_per_word*sizeof(*partword));\r\n      int beginoff=info->begin/ch;\r\n\r\n      for(i=0;i<ch;i++)if(nonzero[i])break;\r\n      if(i==ch)return(0); /* no nonzero vectors */\r\n\r\n      samples_per_partition/=ch;\r\n\r\n      for(s=0;s<info->stages;s++){\r\n\tfor(i=0;i<partvals;){\r\n\r\n\t  if(s==0){\r\n\t    int temp;\r\n\t    partword[i+partitions_per_word-1]=1;\r\n\t    for(k=partitions_per_word-2;k>=0;k--)\r\n\t      partword[i+k]=partword[i+k+1]*info->partitions;\r\n\r\n\t    /* fetch the partition word */\r\n\t    temp=vorbis_book_decode(phrasebook,&vd->opb);\r\n\t    if(temp==-1)goto eopbreak;\r\n\r\n\t    /* this can be done quickly in assembly due to the quotient\r\n\t       always being at most six bits */\r\n\t    for(k=0;k<partitions_per_word;k++){\r\n\t      ogg_uint32_t div=partword[i+k];\r\n\t      partword[i+k]=temp/div;\r\n\t      temp-=partword[i+k]*div;\r\n\t    }\r\n\t  }\r\n\r\n\t  /* now we decode residual values for the partitions */\r\n\t  for(k=0;k<partitions_per_word && i<partvals;k++,i++)\r\n\t    if(info->stagemasks[(int)partword[i]]&(1<<s)){\r\n\t      codebook *stagebook=ci->book_param+\r\n\t\tinfo->stagebooks[(partword[i]<<3)+s];\r\n\t      if(vorbis_book_decodevv_add(stagebook,in,\r\n\t\t\t\t\t  i*samples_per_partition+beginoff,ch,\r\n\t\t\t\t\t  &vd->opb,\r\n\t\t\t\t\t  samples_per_partition,-8)==-1)\r\n\t\tgoto eopbreak;\r\n\t    }\r\n\t}\r\n      }\r\n    }\r\n  }\r\n eopbreak:\r\n\r\n  return 0;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/treminfo.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: maintain the info structure, info <-> header packets\r\n\r\n ************************************************************************/\r\n\r\n/* general handling of the header and the vorbis_info structure (and\r\n   substructures) */\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <ctype.h>\r\n#include \"ogg.h\"\r\n#include \"ivorbiscodec.h\"\r\n#include \"codec_internal.h\"\r\n#include \"codebook.h\"\r\n#include \"misc.h\"\r\n#include \"os.h\"\r\n\r\n/* helpers */\r\nstatic void _v_readstring(oggpack_buffer *o,char *buf,int bytes){\r\n  while(bytes--){\r\n    *buf++=(char)oggpack_read(o,8);\r\n  }\r\n}\r\n\r\nvoid vorbis_comment_init(vorbis_comment *vc){\r\n  memset(vc,0,sizeof(*vc));\r\n}\r\n\r\n/* This is more or less the same as strncasecmp - but that doesn't exist\r\n * everywhere, and this is a fairly trivial function, so we include it */\r\nstatic int tagcompare(const char *s1, const char *s2, int n){\r\n  int c=0;\r\n  while(c < n){\r\n    if(toupper(s1[c]) != toupper(s2[c]))\r\n      return !0;\r\n    c++;\r\n  }\r\n  return 0;\r\n}\r\n\r\nchar *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){\r\n  long i;\r\n  int found = 0;\r\n  int taglen = strlen(tag)+1; /* +1 for the = we append */\r\n  char *fulltag = (char *)alloca(taglen+ 1);\r\n\r\n  strcpy(fulltag, tag);\r\n  strcat(fulltag, \"=\");\r\n\r\n  for(i=0;i<vc->comments;i++){\r\n    if(!tagcompare(vc->user_comments[i], fulltag, taglen)){\r\n      if(count == found)\r\n\t/* We return a pointer to the data, not a copy */\r\n      \treturn vc->user_comments[i] + taglen;\r\n      else\r\n\tfound++;\r\n    }\r\n  }\r\n  return NULL; /* didn't find anything */\r\n}\r\n\r\nint vorbis_comment_query_count(vorbis_comment *vc, char *tag){\r\n  int i,count=0;\r\n  int taglen = strlen(tag)+1; /* +1 for the = we append */\r\n  char *fulltag = (char *)alloca(taglen+1);\r\n  strcpy(fulltag,tag);\r\n  strcat(fulltag, \"=\");\r\n\r\n  for(i=0;i<vc->comments;i++){\r\n    if(!tagcompare(vc->user_comments[i], fulltag, taglen))\r\n      count++;\r\n  }\r\n\r\n  return count;\r\n}\r\n\r\nvoid vorbis_comment_clear(vorbis_comment *vc){\r\n  if(vc){\r\n    long i;\r\n    for(i=0;i<vc->comments;i++)\r\n      if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);\r\n    if(vc->user_comments)_ogg_free(vc->user_comments);\r\n\tif(vc->comment_lengths)_ogg_free(vc->comment_lengths);\r\n    if(vc->vendor)_ogg_free(vc->vendor);\r\n  }\r\n  memset(vc,0,sizeof(*vc));\r\n}\r\n\r\n/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.\r\n   They may be equal, but short will never ge greater than long */\r\nint vorbis_info_blocksize(vorbis_info *vi,int zo){\r\n  codec_setup_info *ci = (codec_setup_info *)vi->codec_setup;\r\n  return ci ? ci->blocksizes[zo] : -1;\r\n}\r\n\r\n/* used by synthesis, which has a full, alloced vi */\r\nvoid vorbis_info_init(vorbis_info *vi){\r\n  memset(vi,0,sizeof(*vi));\r\n  vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));\r\n}\r\n\r\nvoid vorbis_info_clear(vorbis_info *vi){\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  int i;\r\n\r\n  if(ci){\r\n\r\n    if(ci->mode_param)_ogg_free(ci->mode_param);\r\n\r\n    if(ci->map_param){\r\n      for(i=0;i<ci->maps;i++) /* unpack does the range checking */\r\n\tmapping_clear_info(ci->map_param+i);\r\n      _ogg_free(ci->map_param);\r\n    }\r\n\r\n    if(ci->floor_param){\r\n      for(i=0;i<ci->floors;i++) /* unpack does the range checking */\r\n\tif(ci->floor_type[i])\r\n\t  floor1_free_info(ci->floor_param[i]);\r\n\telse\r\n\t  floor0_free_info(ci->floor_param[i]);\r\n      _ogg_free(ci->floor_param);\r\n      _ogg_free(ci->floor_type);\r\n    }\r\n\r\n    if(ci->residue_param){\r\n      for(i=0;i<ci->residues;i++) /* unpack does the range checking */\r\n\tres_clear_info(ci->residue_param+i);\r\n      _ogg_free(ci->residue_param);\r\n    }\r\n\r\n    if(ci->book_param){\r\n      for(i=0;i<ci->books;i++)\r\n\tvorbis_book_clear(ci->book_param+i);\r\n      _ogg_free(ci->book_param);\r\n    }\r\n\r\n    _ogg_free(ci);\r\n  }\r\n\r\n  memset(vi,0,sizeof(*vi));\r\n}\r\n\r\n/* Header packing/unpacking ********************************************/\r\n\r\nint _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  if(!ci)return(OV_EFAULT);\r\n\r\n  vi->version=oggpack_read(opb,32);\r\n  if(vi->version!=0)return(OV_EVERSION);\r\n\r\n  vi->channels=oggpack_read(opb,8);\r\n  vi->rate=oggpack_read(opb,32);\r\n\r\n  vi->bitrate_upper=oggpack_read(opb,32);\r\n  vi->bitrate_nominal=oggpack_read(opb,32);\r\n  vi->bitrate_lower=oggpack_read(opb,32);\r\n\r\n  ci->blocksizes[0]=1<<oggpack_read(opb,4);\r\n  ci->blocksizes[1]=1<<oggpack_read(opb,4);\r\n\r\n#ifdef LIMIT_TO_64kHz\r\n  if(vi->rate>=64000 || ci->blocksizes[1]>4096)goto err_out;\r\n#else\r\n  if(vi->rate<64000 && ci->blocksizes[1]>4096)goto err_out;\r\n#endif\r\n\r\n  if(vi->rate<1)goto err_out;\r\n  if(vi->channels<1)goto err_out;\r\n  if(ci->blocksizes[0]<64)goto err_out;\r\n  if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;\r\n  if(ci->blocksizes[1]>8192)goto err_out;\r\n\r\n  if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */\r\n\r\n  return(0);\r\n err_out:\r\n  vorbis_info_clear(vi);\r\n  return(OV_EBADHEADER);\r\n}\r\n\r\nint _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){\r\n  int i;\r\n  int vendorlen=oggpack_read(opb,32);\r\n  if(vendorlen<0)goto err_out;\r\n  vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);\r\n  _v_readstring(opb,vc->vendor,vendorlen);\r\n  vc->comments=oggpack_read(opb,32);\r\n  if(vc->comments<0)goto err_out;\r\n  vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));\r\n  vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));\r\n\r\n  for(i=0;i<vc->comments;i++){\r\n    int len=oggpack_read(opb,32);\r\n    if(len<0)goto err_out;\r\n\tvc->comment_lengths[i]=len;\r\n    vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);\r\n    _v_readstring(opb,vc->user_comments[i],len);\r\n  }\r\n  if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */\r\n\r\n  return(0);\r\n err_out:\r\n  vorbis_comment_clear(vc);\r\n  return(OV_EBADHEADER);\r\n}\r\n\r\n/* all of the real encoding details are here.  The modes, books,\r\n   everything */\r\nint _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){\r\n  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;\r\n  int i;\r\n  if(!ci)return(OV_EFAULT);\r\n\r\n  /* codebooks */\r\n  ci->books=oggpack_read(opb,8)+1;\r\n  ci->book_param=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->book_param));\r\n  for(i=0;i<ci->books;i++)\r\n    if(vorbis_book_unpack(opb,ci->book_param+i))goto err_out;\r\n\r\n  /* time backend settings, not actually used */\r\n  i=oggpack_read(opb,6);\r\n  for(;i>=0;i--)\r\n    if(oggpack_read(opb,16)!=0)goto err_out;\r\n\r\n  /* floor backend settings */\r\n  ci->floors=oggpack_read(opb,6)+1;\r\n  ci->floor_param=_ogg_malloc(sizeof(*ci->floor_param)*ci->floors);\r\n  ci->floor_type=_ogg_malloc(sizeof(*ci->floor_type)*ci->floors);\r\n  for(i=0;i<ci->floors;i++){\r\n    ci->floor_type[i]=(char)oggpack_read(opb,16);\r\n    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;\r\n    if(ci->floor_type[i])\r\n      ci->floor_param[i]=floor1_info_unpack(vi,opb);\r\n    else\r\n      ci->floor_param[i]=floor0_info_unpack(vi,opb);\r\n    if(!ci->floor_param[i])goto err_out;\r\n  }\r\n\r\n  /* residue backend settings */\r\n  ci->residues=oggpack_read(opb,6)+1;\r\n  ci->residue_param=_ogg_malloc(sizeof(*ci->residue_param)*ci->residues);\r\n  for(i=0;i<ci->residues;i++)\r\n    if(res_unpack(ci->residue_param+i,vi,opb))goto err_out;\r\n\r\n  /* map backend settings */\r\n  ci->maps=oggpack_read(opb,6)+1;\r\n  ci->map_param=_ogg_malloc(sizeof(*ci->map_param)*ci->maps);\r\n  for(i=0;i<ci->maps;i++){\r\n    if(oggpack_read(opb,16)!=0)goto err_out;\r\n    if(mapping_info_unpack(ci->map_param+i,vi,opb))goto err_out;\r\n  }\r\n\r\n  /* mode settings */\r\n  ci->modes=oggpack_read(opb,6)+1;\r\n  ci->mode_param=\r\n    (vorbis_info_mode *)_ogg_malloc(ci->modes*sizeof(*ci->mode_param));\r\n  for(i=0;i<ci->modes;i++){\r\n    ci->mode_param[i].blockflag=(unsigned char)oggpack_read(opb,1);\r\n    if(oggpack_read(opb,16))goto err_out;\r\n    if(oggpack_read(opb,16))goto err_out;\r\n    ci->mode_param[i].mapping=(unsigned char)oggpack_read(opb,8);\r\n    if(ci->mode_param[i].mapping>=ci->maps)goto err_out;\r\n  }\r\n\r\n  if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */\r\n\r\n  return(0);\r\n err_out:\r\n  vorbis_info_clear(vi);\r\n  return(OV_EBADHEADER);\r\n}\r\n\r\n/* The Vorbis header is in three packets; the initial small packet in\r\n   the first page that identifies basic parameters, a second packet\r\n   with bitstream comments and a third packet that holds the\r\n   codebook. */\r\n\r\nint vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){\r\n  oggpack_buffer opb;\r\n\r\n  if(op){\r\n    oggpack_readinit(&opb,op->packet);\r\n\r\n    /* Which of the three types of header is this? */\r\n    /* Also verify header-ness, vorbis */\r\n    {\r\n      char buffer[6];\r\n      int packtype=oggpack_read(&opb,8);\r\n      memset(buffer,0,6);\r\n      _v_readstring(&opb,buffer,6);\r\n      if(memcmp(buffer,\"vorbis\",6)){\r\n\t/* not a vorbis header */\r\n\treturn(OV_ENOTVORBIS);\r\n      }\r\n      switch(packtype){\r\n      case 0x01: /* least significant *bit* is read first */\r\n\tif(!op->b_o_s){\r\n\t  /* Not the initial packet */\r\n\t  return(OV_EBADHEADER);\r\n\t}\r\n\tif(vi->rate!=0){\r\n\t  /* previously initialized info header */\r\n\t  return(OV_EBADHEADER);\r\n\t}\r\n\r\n\treturn(_vorbis_unpack_info(vi,&opb));\r\n\r\n      case 0x03: /* least significant *bit* is read first */\r\n\tif(vi->rate==0){\r\n\t  /* um... we didn't get the initial header */\r\n\t  return(OV_EBADHEADER);\r\n\t}\r\n\r\n\treturn(_vorbis_unpack_comment(vc,&opb));\r\n\r\n      case 0x05: /* least significant *bit* is read first */\r\n\tif(vi->rate==0 || vc->vendor==NULL){\r\n\t  /* um... we didn;t get the initial header or comments yet */\r\n\t  return(OV_EBADHEADER);\r\n\t}\r\n\r\n\treturn(_vorbis_unpack_books(vi,&opb));\r\n\r\n      default:\r\n\t/* Not a valid vorbis header type */\r\n\treturn(OV_EBADHEADER);\r\n\tbreak;\r\n      }\r\n    }\r\n  }\r\n  return(OV_EBADHEADER);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/vorbisfile.c",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: stdio-based convenience library for opening/seeking/decoding\r\n last mod: $Id: vorbisfile.c,v 1.6.2.5 2003/11/20 06:16:17 xiphmont Exp $\r\n\r\n ************************************************************************/\r\n\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n//#include <gerrno.h>\r\n#include <string.h>\r\n#include <math.h>\r\n\r\n#include \"codec_internal.h\"\r\n#include \"ivorbisfile.h\"\r\n\r\n#include \"os.h\"\r\n#include \"misc.h\"\r\n\r\nint gerrno;\r\n\r\n#define  NOTOPEN   0\r\n#define  PARTOPEN  1\r\n#define  OPENED    2\r\n#define  STREAMSET 3 /* serialno and link set, but not to current link */\r\n#define  LINKSET   4 /* serialno and link set to current link */\r\n#define  INITSET   5\r\n\r\n/* A 'chained bitstream' is a Vorbis bitstream that contains more than\r\n   one logical bitstream arranged end to end (the only form of Ogg\r\n   multiplexing allowed in a Vorbis bitstream; grouping [parallel\r\n   multiplexing] is not allowed in Vorbis) */\r\n\r\n/* A Vorbis file can be played beginning to end (streamed) without\r\n   worrying ahead of time about chaining (see decoder_example.c).  If\r\n   we have the whole file, however, and want random access\r\n   (seeking/scrubbing) or desire to know the total length/time of a\r\n   file, we need to account for the possibility of chaining. */\r\n\r\n/* We can handle things a number of ways; we can determine the entire\r\n   bitstream structure right off the bat, or find pieces on demand.\r\n   This example determines and caches structure for the entire\r\n   bitstream, but builds a virtual decoder on the fly when moving\r\n   between links in the chain. */\r\n\r\n/* There are also different ways to implement seeking.  Enough\r\n   information exists in an Ogg bitstream to seek to\r\n   sample-granularity positions in the output.  Or, one can seek by\r\n   picking some portion of the stream roughly in the desired area if\r\n   we only want coarse navigation through the stream. */\r\n\r\n/*************************************************************************\r\n * Many, many internal helpers.  The intention is not to be confusing;\r\n * rampant duplication and monolithic function implementation would be\r\n * harder to understand anyway.  The high level functions are last.  Begin\r\n * grokking near the end of the file */\r\n\r\n\r\n/* read a little more data from the file/pipe into the ogg_sync framer */\r\nstatic long _get_data(OggVorbis_File *vf){\r\n  gerrno=0;\r\n  if(vf->datasource){\r\n    unsigned char *buffer=ogg_sync_bufferin(vf->oy,CHUNKSIZE);\r\n    long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);\r\n    if(bytes>0)ogg_sync_wrote(vf->oy,bytes);\r\n    if(bytes==0 && gerrno)return -1;\r\n    return bytes;\r\n  }else\r\n    return 0;\r\n}\r\n\r\n/* save a tiny smidge of verbosity to make the code more readable */\r\nstatic void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){\r\n  if(vf->datasource){\r\n    (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);\r\n    vf->offset=offset;\r\n    ogg_sync_reset(vf->oy);\r\n  }else{\r\n    /* shouldn't happen unless someone writes a broken callback */\r\n    return;\r\n  }\r\n}\r\n\r\n/* The read/seek functions track absolute position within the stream */\r\n\r\n/* from the head of the stream, get the next page.  boundary specifies\r\n   if the function is allowed to fetch more data from the stream (and\r\n   how much) or only use internally buffered data.\r\n\r\n   boundary: -1) unbounded search\r\n              0) read no additional data; use cached only\r\n\t      n) search for a new page beginning for n bytes\r\n\r\n   return:   <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD)\r\n              n) found a page at absolute offset n\r\n\r\n              produces a refcounted page */\r\n\r\nstatic ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og,\r\n\t\t\t\t  ogg_int64_t boundary){\r\n  if(boundary>0)boundary+=vf->offset;\r\n  while(1){\r\n    long more;\r\n\r\n    if(boundary>0 && vf->offset>=boundary)return OV_FALSE;\r\n    more=ogg_sync_pageseek(vf->oy,og);\r\n\r\n    if(more<0){\r\n      /* skipped n bytes */\r\n      vf->offset-=more;\r\n    }else{\r\n      if(more==0){\r\n\t/* send more paramedics */\r\n\tif(!boundary)return OV_FALSE;\r\n\t{\r\n\t  long ret=_get_data(vf);\r\n\t  if(ret==0)return OV_EOF;\r\n\t  if(ret<0)return OV_EREAD;\r\n\t}\r\n      }else{\r\n\t/* got a page.  Return the offset at the page beginning,\r\n           advance the internal offset past the page end */\r\n\togg_int64_t ret=vf->offset;\r\n\tvf->offset+=more;\r\n\treturn ret;\r\n\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/* find the latest page beginning before the current stream cursor\r\n   position. Much dirtier than the above as Ogg doesn't have any\r\n   backward search linkage.  no 'readp' as it will certainly have to\r\n   read. */\r\n/* returns offset or OV_EREAD, OV_FAULT and produces a refcounted page */\r\n\r\nstatic ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){\r\n  ogg_int64_t begin=vf->offset;\r\n  ogg_int64_t end=begin;\r\n  ogg_int64_t ret;\r\n  ogg_int64_t offset=-1;\r\n\r\n  while(offset==-1){\r\n    begin-=CHUNKSIZE;\r\n    if(begin<0)\r\n      begin=0;\r\n    _seek_helper(vf,begin);\r\n    while(vf->offset<end){\r\n      ret=_get_next_page(vf,og,end-vf->offset);\r\n      if(ret==OV_EREAD)return OV_EREAD;\r\n      if(ret<0){\r\n\tbreak;\r\n      }else{\r\n\toffset=ret;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* we have the offset.  Actually snork and hold the page now */\r\n  _seek_helper(vf,offset);\r\n  ret=_get_next_page(vf,og,CHUNKSIZE);\r\n  if(ret<0)\r\n    /* this shouldn't be possible */\r\n    return OV_EFAULT;\r\n\r\n  return offset;\r\n}\r\n\r\n/* finds each bitstream link one at a time using a bisection search\r\n   (has to begin by knowing the offset of the lb's initial page).\r\n   Recurses for each link so it can alloc the link storage after\r\n   finding them all, then unroll and fill the cache at the same time */\r\nstatic int _bisect_forward_serialno(OggVorbis_File *vf,\r\n\t\t\t\t    ogg_int64_t begin,\r\n\t\t\t\t    ogg_int64_t searched,\r\n\t\t\t\t    ogg_int64_t end,\r\n\t\t\t\t    ogg_uint32_t currentno,\r\n\t\t\t\t    long m){\r\n  ogg_int64_t endsearched=end;\r\n  ogg_int64_t next=end;\r\n  ogg_page og={0,0,0,0};\r\n  ogg_int64_t ret;\r\n\r\n  /* the below guards against garbage seperating the last and\r\n     first pages of two links. */\r\n  while(searched<endsearched){\r\n    ogg_int64_t bisect;\r\n\r\n    if(endsearched-searched<CHUNKSIZE){\r\n      bisect=searched;\r\n    }else{\r\n      bisect=(searched+endsearched)/2;\r\n    }\r\n\r\n    _seek_helper(vf,bisect);\r\n    ret=_get_next_page(vf,&og,-1);\r\n    if(ret==OV_EREAD)return OV_EREAD;\r\n    if(ret<0 || ogg_page_serialno(&og)!=currentno){\r\n      endsearched=bisect;\r\n      if(ret>=0)next=ret;\r\n    }else{\r\n      searched=ret+og.header_len+og.body_len;\r\n    }\r\n    ogg_page_release(&og);\r\n  }\r\n\r\n  _seek_helper(vf,next);\r\n  ret=_get_next_page(vf,&og,-1);\r\n  if(ret==OV_EREAD)return OV_EREAD;\r\n\r\n  if(searched>=end || ret<0){\r\n    ogg_page_release(&og);\r\n    vf->links=m+1;\r\n    vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));\r\n    vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));\r\n    vf->offsets[m+1]=searched;\r\n  }else{\r\n    ret=_bisect_forward_serialno(vf,next,vf->offset,\r\n\t\t\t\t end,ogg_page_serialno(&og),m+1);\r\n    ogg_page_release(&og);\r\n    if(ret==OV_EREAD)return OV_EREAD;\r\n  }\r\n\r\n  vf->offsets[m]=begin;\r\n  vf->serialnos[m]=currentno;\r\n  return 0;\r\n}\r\n\r\nstatic int _decode_clear(OggVorbis_File *vf){\r\n  if(vf->ready_state==INITSET){\r\n    vorbis_dsp_destroy(vf->vd);\r\n    vf->vd=0;\r\n    vf->ready_state=STREAMSET;\r\n  }\r\n\r\n  if(vf->ready_state>=STREAMSET){\r\n    vorbis_info_clear(&vf->vi);\r\n    vorbis_comment_clear(&vf->vc);\r\n    vf->ready_state=OPENED;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* uses the local ogg_stream storage in vf; this is important for\r\n   non-streaming input sources */\r\n/* consumes the page that's passed in (if any) */\r\n/* state is LINKSET upon successful return */\r\n\r\nstatic int _fetch_headers(OggVorbis_File *vf,\r\n\t\t\t  vorbis_info *vi,\r\n\t\t\t  vorbis_comment *vc,\r\n\t\t\t  ogg_uint32_t *serialno,\r\n\t\t\t  ogg_page *og_ptr){\r\n  ogg_page og={0,0,0,0};\r\n  ogg_packet op={0,0,0,0,0,0};\r\n  int i,ret;\r\n\r\n  if(vf->ready_state>OPENED)_decode_clear(vf);\r\n\r\n  if(!og_ptr){\r\n    ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);\r\n    if(llret==OV_EREAD)return OV_EREAD;\r\n    if(llret<0)return OV_ENOTVORBIS;\r\n    og_ptr=&og;\r\n  }\r\n\r\n  ogg_stream_reset_serialno(vf->os,ogg_page_serialno(og_ptr));\r\n  if(serialno)*serialno=vf->os->serialno;\r\n\r\n  /* extract the initial header from the first page and verify that the\r\n     Ogg bitstream is in fact Vorbis data */\r\n\r\n  vorbis_info_init(vi);\r\n  vorbis_comment_init(vc);\r\n\r\n  i=0;\r\n  while(i<3){\r\n    ogg_stream_pagein(vf->os,og_ptr);\r\n    while(i<3){\r\n      int result=ogg_stream_packetout(vf->os,&op);\r\n      if(result==0)break;\r\n      if(result==-1){\r\n\tret=OV_EBADHEADER;\r\n\tgoto bail_header;\r\n      }\r\n      if((ret=vorbis_dsp_headerin(vi,vc,&op))){\r\n\tgoto bail_header;\r\n      }\r\n      i++;\r\n    }\r\n    if(i<3)\r\n      if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){\r\n\tret=OV_EBADHEADER;\r\n\tgoto bail_header;\r\n      }\r\n  }\r\n\r\n  ogg_packet_release(&op);\r\n  ogg_page_release(&og);\r\n  vf->ready_state=LINKSET;\r\n  return 0;\r\n\r\n bail_header:\r\n  ogg_packet_release(&op);\r\n  ogg_page_release(&og);\r\n  vorbis_info_clear(vi);\r\n  vorbis_comment_clear(vc);\r\n  vf->ready_state=OPENED;\r\n\r\n  return ret;\r\n}\r\n\r\n/* we no longer preload all vorbis_info (and the associated\r\n   codec_setup) structs.  Call this to seek and fetch the info from\r\n   the bitstream, if needed */\r\nstatic int _set_link_number(OggVorbis_File *vf,int link){\r\n  if(link != vf->current_link) _decode_clear(vf);\r\n  if(vf->ready_state<STREAMSET){\r\n    _seek_helper(vf,vf->offsets[link]);\r\n    ogg_stream_reset_serialno(vf->os,vf->serialnos[link]);\r\n    vf->current_serialno=vf->serialnos[link];\r\n    vf->current_link=link;\r\n    return _fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,NULL);\r\n  }\r\n  return 0;\r\n}\r\n\r\nstatic int _set_link_number_preserve_pos(OggVorbis_File *vf,int link){\r\n  ogg_int64_t pos=vf->offset;\r\n  int ret=_set_link_number(vf,link);\r\n  if(ret)return ret;\r\n  _seek_helper(vf,pos);\r\n  if(pos<vf->offsets[link] || pos>=vf->offsets[link+1])\r\n    vf->ready_state=STREAMSET;\r\n  return 0;\r\n}\r\n\r\n/* last step of the OggVorbis_File initialization; get all the offset\r\n   positions.  Only called by the seekable initialization (local\r\n   stream storage is hacked slightly; pay attention to how that's\r\n   done) */\r\n\r\n/* this is void and does not propogate errors up because we want to be\r\n   able to open and use damaged bitstreams as well as we can.  Just\r\n   watch out for missing information for links in the OggVorbis_File\r\n   struct */\r\nstatic void _prefetch_all_offsets(OggVorbis_File *vf, ogg_int64_t dataoffset){\r\n  ogg_page og={0,0,0,0};\r\n  int i;\r\n  ogg_int64_t ret;\r\n\r\n  vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));\r\n  vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));\r\n\r\n  for(i=0;i<vf->links;i++){\r\n    if(i==0){\r\n      /* we already grabbed the initial header earlier.  Just set the offset */\r\n      vf->dataoffsets[i]=dataoffset;\r\n      _seek_helper(vf,dataoffset);\r\n\r\n    }else{\r\n\r\n      /* seek to the location of the initial header */\r\n\r\n      _seek_helper(vf,vf->offsets[i]);\r\n      if(_fetch_headers(vf,&vf->vi,&vf->vc,NULL,NULL)<0){\r\n    \tvf->dataoffsets[i]=-1;\r\n      }else{\r\n\tvf->dataoffsets[i]=vf->offset;\r\n      }\r\n    }\r\n\r\n    /* fetch beginning PCM offset */\r\n\r\n    if(vf->dataoffsets[i]!=-1){\r\n      ogg_int64_t accumulated=0,pos;\r\n      long        lastblock=-1;\r\n      int         result;\r\n\r\n      ogg_stream_reset_serialno(vf->os,vf->serialnos[i]);\r\n\r\n      while(1){\r\n\togg_packet op={0,0,0,0,0,0};\r\n\r\n\tret=_get_next_page(vf,&og,-1);\r\n\tif(ret<0)\r\n\t  /* this should not be possible unless the file is\r\n             truncated/mangled */\r\n\t  break;\r\n\r\n\tif(ogg_page_serialno(&og)!=vf->serialnos[i])\r\n\t  break;\r\n\r\n\tpos=ogg_page_granulepos(&og);\r\n\r\n\t/* count blocksizes of all frames in the page */\r\n\togg_stream_pagein(vf->os,&og);\r\n\twhile((result=ogg_stream_packetout(vf->os,&op))){\r\n\t  if(result>0){ /* ignore holes */\r\n\t    long thisblock=vorbis_packet_blocksize(&vf->vi,&op);\r\n\t    if(lastblock!=-1)\r\n\t      accumulated+=(lastblock+thisblock)>>2;\r\n\t    lastblock=thisblock;\r\n\t  }\r\n\t}\r\n\togg_packet_release(&op);\r\n\r\n\tif(pos!=-1){\r\n\t  /* pcm offset of last packet on the first audio page */\r\n\t  accumulated= pos-accumulated;\r\n\t  break;\r\n\t}\r\n      }\r\n\r\n      /* less than zero?  This is a stream with samples trimmed off\r\n         the beginning, a normal occurrence; set the offset to zero */\r\n      if(accumulated<0)accumulated=0;\r\n\r\n      vf->pcmlengths[i*2]=accumulated;\r\n    }\r\n\r\n    /* get the PCM length of this link. To do this,\r\n       get the last page of the stream */\r\n    {\r\n      ogg_int64_t end=vf->offsets[i+1];\r\n      _seek_helper(vf,end);\r\n\r\n      while(1){\r\n\tret=_get_prev_page(vf,&og);\r\n\tif(ret<0){\r\n\t  /* this should not be possible */\r\n\t  vorbis_info_clear(&vf->vi);\r\n\t  vorbis_comment_clear(&vf->vc);\r\n\t  break;\r\n\t}\r\n\tif(ogg_page_granulepos(&og)!=-1){\r\n\t  vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];\r\n\t  break;\r\n\t}\r\n\tvf->offset=ret;\r\n      }\r\n    }\r\n  }\r\n  ogg_page_release(&og);\r\n}\r\n\r\nstatic int _make_decode_ready(OggVorbis_File *vf){\r\n  int i;\r\n  switch(vf->ready_state){\r\n  case OPENED:\r\n  case STREAMSET:\r\n    for(i=0;i<vf->links;i++)\r\n      if(vf->offsets[i+1]>=vf->offset)break;\r\n    if(i==vf->links)return -1;\r\n    i=_set_link_number_preserve_pos(vf,i);\r\n    if(i)return i;\r\n    /* fall through */\r\n  case LINKSET:\r\n    vf->vd=vorbis_dsp_create(&vf->vi);\r\n    vf->ready_state=INITSET;\r\n    vf->bittrack=0;\r\n    vf->samptrack=0;\r\n  case INITSET:\r\n    return 0;\r\n  default:\r\n    return -1;\r\n  }\r\n\r\n}\r\n\r\nstatic int _open_seekable2(OggVorbis_File *vf){\r\n  ogg_uint32_t serialno=vf->current_serialno;\r\n  ogg_uint32_t tempserialno;\r\n  ogg_int64_t dataoffset=vf->offset, end;\r\n  ogg_page og={0,0,0,0};\r\n\r\n  /* we're partially open and have a first link header state in\r\n     storage in vf */\r\n  /* we can seek, so set out learning all about this file */\r\n  (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);\r\n  vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);\r\n\r\n  /* We get the offset for the last page of the physical bitstream.\r\n     Most OggVorbis files will contain a single logical bitstream */\r\n  end=_get_prev_page(vf,&og);\r\n  if(end<0)return (int)end;\r\n\r\n  /* more than one logical bitstream? */\r\n  tempserialno=ogg_page_serialno(&og);\r\n  ogg_page_release(&og);\r\n\r\n  if(tempserialno!=serialno){\r\n\r\n    /* Chained bitstream. Bisect-search each logical bitstream\r\n       section.  Do so based on serial number only */\r\n    if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return OV_EREAD;\r\n\r\n  }else{\r\n\r\n    /* Only one logical bitstream */\r\n    if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return OV_EREAD;\r\n\r\n  }\r\n\r\n  /* the initial header memory is referenced by vf after; don't free it */\r\n  _prefetch_all_offsets(vf,dataoffset);\r\n  return ov_raw_seek(vf,0);\r\n}\r\n\r\n/* fetch and process a packet.  Handles the case where we're at a\r\n   bitstream boundary and dumps the decoding machine.  If the decoding\r\n   machine is unloaded, it loads it.  It also keeps pcm_offset up to\r\n   date (seek and read both use this.  seek uses a special hack with\r\n   readp).\r\n\r\n   return: <0) error, OV_HOLE (lost packet) or OV_EOF\r\n            0) need more data (only if readp==0)\r\n\t    1) got a packet\r\n*/\r\n\r\nstatic int _fetch_and_process_packet(OggVorbis_File *vf,\r\n\t\t\t\t     int readp,\r\n\t\t\t\t     int spanp){\r\n  ogg_page og={0,0,0,0};\r\n  ogg_packet op={0,0,0,0,0,0};\r\n  int ret=0;\r\n\r\n  /* handle one packet.  Try to fetch it from current stream state */\r\n  /* extract packets from page */\r\n  while(1){\r\n\r\n    /* process a packet if we can.  If the machine isn't loaded,\r\n       neither is a page */\r\n    if(vf->ready_state==INITSET){\r\n      while(1) {\r\n\tint result=ogg_stream_packetout(vf->os,&op);\r\n\togg_int64_t granulepos;\r\n\r\n\tif(result<0){\r\n\t  ret=OV_HOLE; /* hole in the data. */\r\n\t  goto cleanup;\r\n\t}\r\n\tif(result>0){\r\n\t  /* got a packet.  process it */\r\n\t  granulepos=op.granulepos;\r\n\t  if(!vorbis_dsp_synthesis(vf->vd,&op,1)){ /* lazy check for lazy\r\n\t\t\t\t\t\t      header handling.  The\r\n\t\t\t\t\t\t      header packets aren't\r\n\t\t\t\t\t\t      audio, so if/when we\r\n\t\t\t\t\t\t      submit them,\r\n\t\t\t\t\t\t      vorbis_synthesis will\r\n\t\t\t\t\t\t      reject them */\r\n\r\n\t    vf->samptrack+=vorbis_dsp_pcmout(vf->vd,NULL,0);\r\n\t    vf->bittrack+=op.bytes*8;\r\n\r\n\t    /* update the pcm offset. */\r\n\t    if(granulepos!=-1 && !op.e_o_s){\r\n\t      int link=(vf->seekable?vf->current_link:0);\r\n\t      int i,samples;\r\n\r\n\t      /* this packet has a pcm_offset on it (the last packet\r\n\t         completed on a page carries the offset) After processing\r\n\t         (above), we know the pcm position of the *last* sample\r\n\t         ready to be returned. Find the offset of the *first*\r\n\r\n\t         As an aside, this trick is inaccurate if we begin\r\n\t         reading anew right at the last page; the end-of-stream\r\n\t         granulepos declares the last frame in the stream, and the\r\n\t         last packet of the last page may be a partial frame.\r\n\t         So, we need a previous granulepos from an in-sequence page\r\n\t         to have a reference point.  Thus the !op.e_o_s clause\r\n\t         above */\r\n\r\n\t      if(vf->seekable && link>0)\r\n\t\tgranulepos-=vf->pcmlengths[link*2];\r\n\t      if(granulepos<0)granulepos=0; /* actually, this\r\n\t\t\t\t\t       shouldn't be possible\r\n\t\t\t\t\t       here unless the stream\r\n\t\t\t\t\t       is very broken */\r\n\r\n\t      samples=vorbis_dsp_pcmout(vf->vd,NULL,0);\r\n\r\n\t      granulepos-=samples;\r\n\t      for(i=0;i<link;i++)\r\n\t        granulepos+=vf->pcmlengths[i*2+1];\r\n\t      vf->pcm_offset=granulepos;\r\n\t    }\r\n\t    ret=1;\r\n\t    goto cleanup;\r\n\t  }\r\n\t}\r\n\telse\r\n\t  break;\r\n      }\r\n    }\r\n\r\n    if(vf->ready_state>=OPENED){\r\n      int ret;\r\n      if(!readp){\r\n\tret=0;\r\n\tgoto cleanup;\r\n      }\r\n      ret=(int)_get_next_page(vf,&og,-1);\r\n      if(ret<0){\r\n\tret=OV_EOF; /* eof. leave unitialized */\r\n\tgoto cleanup;\r\n      }\r\n\r\n\t/* bitrate tracking; add the header's bytes here, the body bytes\r\n\t   are done by packet above */\r\n      vf->bittrack+=og.header_len*8;\r\n\r\n      /* has our decoding just traversed a bitstream boundary? */\r\n      if(vf->ready_state==INITSET){\r\n\tif(vf->current_serialno!=ogg_page_serialno(&og)){\r\n\t  if(!spanp){\r\n\t    ret=OV_EOF;\r\n\t    goto cleanup;\r\n\t  }\r\n\r\n\t  _decode_clear(vf);\r\n\t}\r\n      }\r\n    }\r\n\r\n    /* Do we need to load a new machine before submitting the page? */\r\n    /* This is different in the seekable and non-seekable cases.\r\n\r\n       In the seekable case, we already have all the header\r\n       information loaded and cached; we just initialize the machine\r\n       with it and continue on our merry way.\r\n\r\n       In the non-seekable (streaming) case, we'll only be at a\r\n       boundary if we just left the previous logical bitstream and\r\n       we're now nominally at the header of the next bitstream\r\n    */\r\n\r\n    if(vf->ready_state!=INITSET){\r\n      int link,ret;\r\n\r\n      if(vf->ready_state<STREAMSET){\r\n\tif(vf->seekable){\r\n\t  vf->current_serialno=ogg_page_serialno(&og);\r\n\r\n\t  /* match the serialno to bitstream section.  We use this rather than\r\n\t     offset positions to avoid problems near logical bitstream\r\n\t     boundaries */\r\n\t  for(link=0;link<vf->links;link++)\r\n\t    if(vf->serialnos[link]==vf->current_serialno)break;\r\n\t  if(link==vf->links){\r\n\t    ret=OV_EBADLINK; /* sign of a bogus stream.  error out,\r\n\t\t\t\tleave machine uninitialized */\r\n\t    goto cleanup;\r\n\t  }\r\n\r\n\t  vf->current_link=link;\r\n\t  ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,&og);\r\n\t  if(ret) goto cleanup;\r\n\r\n\t}else{\r\n\t  /* we're streaming */\r\n\t  /* fetch the three header packets, build the info struct */\r\n\r\n\t  int ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,&og);\r\n\t  if(ret) goto cleanup;\r\n\t  vf->current_link++;\r\n\t}\r\n      }\r\n\r\n      if(_make_decode_ready(vf)) return OV_EBADLINK;\r\n    }\r\n    ogg_stream_pagein(vf->os,&og);\r\n  }\r\n cleanup:\r\n  ogg_packet_release(&op);\r\n  ogg_page_release(&og);\r\n  return ret;\r\n}\r\n\r\n/* if, eg, 64 bit stdio is configured by default, this will build with\r\n   fseek64 */\r\nstatic int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){\r\n  if(f==NULL)return -1;\r\n  return fseek(f,(long)off,whence);\r\n}\r\n\r\nstatic int _ov_open1(void *f,OggVorbis_File *vf,char *initial,\r\n\t\t     long ibytes, ov_callbacks callbacks){\r\n  int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);\r\n  int ret;\r\n\r\n  memset(vf,0,sizeof(*vf));\r\n\r\n  /* Tremor assumes in multiple places that right shift of a signed\r\n     integer is an arithmetic shift */\r\n  if( (-1>>1) != -1) return OV_EIMPL;\r\n\r\n  vf->datasource=f;\r\n  vf->callbacks = callbacks;\r\n\r\n  /* init the framing state */\r\n  vf->oy=ogg_sync_create();\r\n\r\n  /* perhaps some data was previously read into a buffer for testing\r\n     against other stream types.  Allow initialization from this\r\n     previously read data (as we may be reading from a non-seekable\r\n     stream) */\r\n  if(initial){\r\n    unsigned char *buffer=ogg_sync_bufferin(vf->oy,ibytes);\r\n    memcpy(buffer,initial,ibytes);\r\n    ogg_sync_wrote(vf->oy,ibytes);\r\n  }\r\n\r\n  /* can we seek? Stevens suggests the seek test was portable */\r\n  if(offsettest!=-1)vf->seekable=1;\r\n\r\n  /* No seeking yet; Set up a 'single' (current) logical bitstream\r\n     entry for partial open */\r\n  vf->links=1;\r\n  vf->os=ogg_stream_create(-1); /* fill in the serialno later */\r\n\r\n  /* Try to fetch the headers, maintaining all the storage */\r\n  if((ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,NULL))<0){\r\n    vf->datasource=NULL;\r\n    ov_clear(vf);\r\n  }else if(vf->ready_state < PARTOPEN)\r\n    vf->ready_state=PARTOPEN;\r\n  return ret;\r\n}\r\n\r\nstatic int _ov_open2(OggVorbis_File *vf){\r\n  if(vf->ready_state < OPENED)\r\n    vf->ready_state=OPENED;\r\n  if(vf->seekable){\r\n    int ret=_open_seekable2(vf);\r\n    if(ret){\r\n      vf->datasource=NULL;\r\n      ov_clear(vf);\r\n    }\r\n    return ret;\r\n  }\r\n  return 0;\r\n}\r\n\r\n\r\n/* clear out the OggVorbis_File struct */\r\nint ov_clear(OggVorbis_File *vf){\r\n  if(vf){\r\n    vorbis_dsp_destroy(vf->vd);\r\n    vf->vd=0;\r\n    ogg_stream_destroy(vf->os);\r\n    vorbis_info_clear(&vf->vi);\r\n    vorbis_comment_clear(&vf->vc);\r\n    if(vf->dataoffsets)_ogg_free(vf->dataoffsets);\r\n    if(vf->pcmlengths)_ogg_free(vf->pcmlengths);\r\n    if(vf->serialnos)_ogg_free(vf->serialnos);\r\n    if(vf->offsets)_ogg_free(vf->offsets);\r\n    ogg_sync_destroy(vf->oy);\r\n\r\n    if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);\r\n    memset(vf,0,sizeof(*vf));\r\n  }\r\n#ifdef DEBUG_LEAKS\r\n  _VDBG_dump();\r\n#endif\r\n  return 0;\r\n}\r\n\r\n/* inspects the OggVorbis file and finds/documents all the logical\r\n   bitstreams contained in it.  Tries to be tolerant of logical\r\n   bitstream sections that are truncated/woogie.\r\n\r\n   return: -1) error\r\n            0) OK\r\n*/\r\n\r\nint ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,\r\n    ov_callbacks callbacks){\r\n  int ret=_ov_open1(f,vf,initial,ibytes,callbacks);\r\n  if(ret)return ret;\r\n  return _ov_open2(vf);\r\n}\r\n\r\nint ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){\r\n  ov_callbacks callbacks = {\r\n    (size_t (*)(void *, size_t, size_t, void *))  fread,\r\n    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,\r\n    (int (*)(void *))                             fclose,\r\n    (long (*)(void *))                            ftell\r\n  };\r\n\r\n  return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);\r\n}\r\n\r\n/* Only partially open the vorbis file; test for Vorbisness, and load\r\n   the headers for the first chain.  Do not seek (although test for\r\n   seekability).  Use ov_test_open to finish opening the file, else\r\n   ov_clear to close/free it. Same return codes as open. */\r\n\r\nint ov_test_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,\r\n    ov_callbacks callbacks)\r\n{\r\n  return _ov_open1(f,vf,initial,ibytes,callbacks);\r\n}\r\n\r\nint ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){\r\n  ov_callbacks callbacks = {\r\n    (size_t (*)(void *, size_t, size_t, void *))  fread,\r\n    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,\r\n    (int (*)(void *))                             fclose,\r\n    (long (*)(void *))                            ftell\r\n  };\r\n\r\n  return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);\r\n}\r\n\r\nint ov_test_open(OggVorbis_File *vf){\r\n  if(vf->ready_state!=PARTOPEN)return OV_EINVAL;\r\n  return _ov_open2(vf);\r\n}\r\n\r\n/* How many logical bitstreams in this physical bitstream? */\r\nlong ov_streams(OggVorbis_File *vf){\r\n  return vf->links;\r\n}\r\n\r\n/* Is the FILE * associated with vf seekable? */\r\nlong ov_seekable(OggVorbis_File *vf){\r\n  return vf->seekable;\r\n}\r\n\r\n/* returns the bitrate for a given logical bitstream or the entire\r\n   physical bitstream.  If the file is open for random access, it will\r\n   find the *actual* average bitrate.  If the file is streaming, it\r\n   returns the nominal bitrate (if set) else the average of the\r\n   upper/lower bounds (if set) else -1 (unset).\r\n\r\n   If you want the actual bitrate field settings, get them from the\r\n   vorbis_info structs */\r\n\r\nlong ov_bitrate(OggVorbis_File *vf,int i){\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(i>=vf->links)return OV_EINVAL;\r\n  if(!vf->seekable && i!=0)return ov_bitrate(vf,0);\r\n  if(i<0){\r\n    ogg_int64_t bits=0;\r\n    int i;\r\n    for(i=0;i<vf->links;i++)\r\n      bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;\r\n    /* This once read: return(rint(bits/ov_time_total(vf,-1)));\r\n     * gcc 3.x on x86 miscompiled this at optimisation level 2 and above,\r\n     * so this is slightly transformed to make it work.\r\n     */\r\n    return (long)(bits*1000/ov_time_total(vf,-1));\r\n  }else{\r\n    if(vf->seekable){\r\n      /* return the actual bitrate */\r\n      return (long)((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));\r\n    }else{\r\n      /* return nominal if set */\r\n      if(vf->vi.bitrate_nominal>0){\r\n\treturn vf->vi.bitrate_nominal;\r\n      }else{\r\n\tif(vf->vi.bitrate_upper>0){\r\n\t  if(vf->vi.bitrate_lower>0){\r\n\t    return (vf->vi.bitrate_upper+vf->vi.bitrate_lower)/2;\r\n\t  }else{\r\n\t    return vf->vi.bitrate_upper;\r\n\t  }\r\n\t}\r\n\treturn OV_FALSE;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/* returns the actual bitrate since last call.  returns -1 if no\r\n   additional data to offer since last call (or at beginning of stream),\r\n   EINVAL if stream is only partially open\r\n*/\r\nlong ov_bitrate_instant(OggVorbis_File *vf){\r\n  long ret;\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(vf->samptrack==0)return OV_FALSE;\r\n  ret=(long)(vf->bittrack/vf->samptrack*vf->vi.rate);\r\n  vf->bittrack=0;\r\n  vf->samptrack=0;\r\n  return ret;\r\n}\r\n\r\n/* Guess */\r\nlong ov_serialnumber(OggVorbis_File *vf,int i){\r\n  if(i>=vf->links)return ov_serialnumber(vf,vf->links-1);\r\n  if(!vf->seekable && i>=0)return ov_serialnumber(vf,-1);\r\n  if(i<0){\r\n    return vf->current_serialno;\r\n  }else{\r\n    return vf->serialnos[i];\r\n  }\r\n}\r\n\r\n/* returns: total raw (compressed) length of content if i==-1\r\n            raw (compressed) length of that logical bitstream for i==0 to n\r\n\t    OV_EINVAL if the stream is not seekable (we can't know the length)\r\n\t    or if stream is only partially open\r\n*/\r\nogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable || i>=vf->links)return OV_EINVAL;\r\n  if(i<0){\r\n    ogg_int64_t acc=0;\r\n    int i;\r\n    for(i=0;i<vf->links;i++)\r\n      acc+=ov_raw_total(vf,i);\r\n    return acc;\r\n  }else{\r\n    return vf->offsets[i+1]-vf->offsets[i];\r\n  }\r\n}\r\n\r\n/* returns: total PCM length (samples) of content if i==-1 PCM length\r\n\t    (samples) of that logical bitstream for i==0 to n\r\n\t    OV_EINVAL if the stream is not seekable (we can't know the\r\n\t    length) or only partially open\r\n*/\r\nogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable || i>=vf->links)return OV_EINVAL;\r\n  if(i<0){\r\n    ogg_int64_t acc=0;\r\n    int i;\r\n    for(i=0;i<vf->links;i++)\r\n      acc+=ov_pcm_total(vf,i);\r\n    return acc;\r\n  }else{\r\n    return vf->pcmlengths[i*2+1];\r\n  }\r\n}\r\n\r\n/* returns: total milliseconds of content if i==-1\r\n            milliseconds in that logical bitstream for i==0 to n\r\n\t    OV_EINVAL if the stream is not seekable (we can't know the\r\n\t    length) or only partially open\r\n*/\r\nogg_int64_t ov_time_total(OggVorbis_File *vf,int i){\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable || i>=vf->links)return OV_EINVAL;\r\n  if(i<0){\r\n    ogg_int64_t acc=0;\r\n    int i;\r\n    for(i=0;i<vf->links;i++)\r\n      acc+=ov_time_total(vf,i);\r\n    return acc;\r\n  }else{\r\n    return ((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi.rate;\r\n  }\r\n}\r\n\r\n/* seek to an offset relative to the *compressed* data. This also\r\n   scans packets to update the PCM cursor. It will cross a logical\r\n   bitstream boundary, but only if it can't get any packets out of the\r\n   tail of the bitstream we seek to (so no surprises).\r\n\r\n   returns zero on success, nonzero on failure */\r\n\r\nint ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){\r\n  ogg_stream_state *work_os=NULL;\r\n  ogg_page og={0,0,0,0};\r\n  ogg_packet op={0,0,0,0,0,0};\r\n\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable)\r\n    return OV_ENOSEEK; /* don't dump machine if we can't seek */\r\n\r\n  if(pos<0 || pos>vf->end)return OV_EINVAL;\r\n\r\n  /* don't yet clear out decoding machine (if it's initialized), in\r\n     the case we're in the same link.  Restart the decode lapping, and\r\n     let _fetch_and_process_packet deal with a potential bitstream\r\n     boundary */\r\n  vf->pcm_offset=-1;\r\n  ogg_stream_reset_serialno(vf->os,\r\n\t\t\t    vf->current_serialno); /* must set serialno */\r\n  vorbis_dsp_restart(vf->vd);\r\n\r\n  _seek_helper(vf,pos);\r\n\r\n  /* we need to make sure the pcm_offset is set, but we don't want to\r\n     advance the raw cursor past good packets just to get to the first\r\n     with a granulepos.  That's not equivalent behavior to beginning\r\n     decoding as immediately after the seek position as possible.\r\n\r\n     So, a hack.  We use two stream states; a local scratch state and\r\n     the shared vf->os stream state.  We use the local state to\r\n     scan, and the shared state as a buffer for later decode.\r\n\r\n     Unfortuantely, on the last page we still advance to last packet\r\n     because the granulepos on the last page is not necessarily on a\r\n     packet boundary, and we need to make sure the granpos is\r\n     correct.\r\n  */\r\n\r\n  {\r\n    int lastblock=0;\r\n    int accblock=0;\r\n    int thisblock;\r\n    int eosflag;\r\n\r\n    work_os=ogg_stream_create(vf->current_serialno); /* get the memory ready */\r\n    while(1){\r\n      if(vf->ready_state>=STREAMSET){\r\n\t/* snarf/scan a packet if we can */\r\n\tint result=ogg_stream_packetout(work_os,&op);\r\n\r\n\tif(result>0){\r\n\r\n\t  if(vf->vi.codec_setup){\r\n\t    thisblock=vorbis_packet_blocksize(&vf->vi,&op);\r\n\t    if(thisblock<0){\r\n\t      ogg_stream_packetout(vf->os,NULL);\r\n\t      thisblock=0;\r\n\t    }else{\r\n\r\n\t      if(eosflag)\r\n\t\togg_stream_packetout(vf->os,NULL);\r\n\t      else\r\n\t\tif(lastblock)accblock+=(lastblock+thisblock)>>2;\r\n\t    }\r\n\r\n\t    if(op.granulepos!=-1){\r\n\t      int i,link=vf->current_link;\r\n\t      ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2];\r\n\t      if(granulepos<0)granulepos=0;\r\n\r\n\t      for(i=0;i<link;i++)\r\n\t\tgranulepos+=vf->pcmlengths[i*2+1];\r\n\t      vf->pcm_offset=granulepos-accblock;\r\n\t      break;\r\n\t    }\r\n\t    lastblock=thisblock;\r\n\t    continue;\r\n\t  }else\r\n\t    ogg_stream_packetout(vf->os,NULL);\r\n\t}\r\n      }\r\n\r\n      if(!lastblock){\r\n\tif(_get_next_page(vf,&og,-1)<0){\r\n\t  vf->pcm_offset=ov_pcm_total(vf,-1);\r\n\t  break;\r\n\t}\r\n      }else{\r\n\t/* huh?  Bogus stream with packets but no granulepos */\r\n\tvf->pcm_offset=-1;\r\n\tbreak;\r\n      }\r\n\r\n      /* did we just grab a page from other than current link? */\r\n      if(vf->ready_state>=STREAMSET)\r\n\tif(vf->current_serialno!=ogg_page_serialno(&og)){\r\n\t  _decode_clear(vf); /* clear out stream state */\r\n\t  ogg_stream_destroy(work_os);\r\n\t}\r\n\r\n      if(vf->ready_state<STREAMSET){\r\n\tint link;\r\n\r\n\tvf->current_serialno=ogg_page_serialno(&og);\r\n\tfor(link=0;link<vf->links;link++)\r\n\t  if(vf->serialnos[link]==vf->current_serialno)break;\r\n\tif(link==vf->links)\r\n\t  goto seek_error; /* sign of a bogus stream.  error out,\r\n\t\t\t      leave machine uninitialized */\r\n\r\n\t/* need to initialize machine to this link */\r\n\t{\r\n\t  int ret=_set_link_number_preserve_pos(vf,link);\r\n\t  if(ret) goto seek_error;\r\n\t}\r\n\togg_stream_reset_serialno(vf->os,vf->current_serialno);\r\n\togg_stream_reset_serialno(work_os,vf->current_serialno);\r\n\r\n\r\n      }\r\n\r\n      {\r\n\togg_page dup;\r\n\togg_page_dup(&dup,&og);\r\n\teosflag=ogg_page_eos(&og);\r\n\togg_stream_pagein(vf->os,&og);\r\n\togg_stream_pagein(work_os,&dup);\r\n      }\r\n    }\r\n  }\r\n\r\n  ogg_packet_release(&op);\r\n  ogg_page_release(&og);\r\n  ogg_stream_destroy(work_os);\r\n  vf->bittrack=0;\r\n  vf->samptrack=0;\r\n  return 0;\r\n\r\n seek_error:\r\n  ogg_packet_release(&op);\r\n  ogg_page_release(&og);\r\n\r\n  /* dump the machine so we're in a known state */\r\n  vf->pcm_offset=-1;\r\n  ogg_stream_destroy(work_os);\r\n  _decode_clear(vf);\r\n  return OV_EBADLINK;\r\n}\r\n\r\n/* Page granularity seek (faster than sample granularity because we\r\n   don't do the last bit of decode to find a specific sample).\r\n\r\n   Seek to the last [granule marked] page preceeding the specified pos\r\n   location, such that decoding past the returned point will quickly\r\n   arrive at the requested position. */\r\nint ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){\r\n  int link=-1;\r\n  ogg_int64_t result=0;\r\n  ogg_int64_t total=ov_pcm_total(vf,-1);\r\n  ogg_page og={0,0,0,0};\r\n  ogg_packet op={0,0,0,0,0,0};\r\n\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable)return OV_ENOSEEK;\r\n  if(pos<0 || pos>total)return OV_EINVAL;\r\n\r\n  /* which bitstream section does this pcm offset occur in? */\r\n  for(link=vf->links-1;link>=0;link--){\r\n    total-=vf->pcmlengths[link*2+1];\r\n    if(pos>=total)break;\r\n  }\r\n\r\n\r\n  if(link!=vf->current_link){\r\n    int ret=_set_link_number(vf,link);\r\n    if(ret) goto seek_error;\r\n  }else{\r\n    vorbis_dsp_restart(vf->vd);\r\n  }\r\n\r\n  ogg_stream_reset_serialno(vf->os,vf->serialnos[link]);\r\n\r\n  /* search within the logical bitstream for the page with the highest\r\n     pcm_pos preceeding (or equal to) pos.  There is a danger here;\r\n     missing pages or incorrect frame number information in the\r\n     bitstream could make our task impossible.  Account for that (it\r\n     would be an error condition) */\r\n\r\n  /* new search algorithm by HB (Nicholas Vinen) */\r\n  {\r\n    ogg_int64_t end=vf->offsets[link+1];\r\n    ogg_int64_t begin=vf->offsets[link];\r\n    ogg_int64_t begintime = vf->pcmlengths[link*2];\r\n    ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime;\r\n    ogg_int64_t target=pos-total+begintime;\r\n    ogg_int64_t best=begin;\r\n\r\n    while(begin<end){\r\n      ogg_int64_t bisect;\r\n\r\n      if(end-begin<CHUNKSIZE){\r\n\tbisect=begin;\r\n      }else{\r\n\t/* take a (pretty decent) guess. */\r\n\tbisect=begin +\r\n\t  (target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;\r\n\tif(bisect<=begin)\r\n\t  bisect=begin+1;\r\n      }\r\n\r\n      _seek_helper(vf,bisect);\r\n\r\n      while(begin<end){\r\n\tresult=_get_next_page(vf,&og,end-vf->offset);\r\n\tif(result==OV_EREAD) goto seek_error;\r\n\tif(result<0){\r\n\t  if(bisect<=begin+1)\r\n\t    end=begin; /* found it */\r\n\t  else{\r\n\t    if(bisect==0) goto seek_error;\r\n\t    bisect-=CHUNKSIZE;\r\n\t    if(bisect<=begin)bisect=begin+1;\r\n\t    _seek_helper(vf,bisect);\r\n\t  }\r\n\t}else{\r\n\t  ogg_int64_t granulepos=ogg_page_granulepos(&og);\r\n\t  if(granulepos==-1)continue;\r\n\t  if(granulepos<target){\r\n\t    best=result;  /* raw offset of packet with granulepos */\r\n\t    begin=vf->offset; /* raw offset of next page */\r\n\t    begintime=granulepos;\r\n\r\n\t    if(target-begintime>44100)break;\r\n\t    bisect=begin; /* *not* begin + 1 */\r\n\t  }else{\r\n\t    if(bisect<=begin+1)\r\n\t      end=begin;  /* found it */\r\n\t    else{\r\n\t      if(end==vf->offset){ /* we're pretty close - we'd be stuck in */\r\n\t\tend=result;\r\n\t\tbisect-=CHUNKSIZE; /* an endless loop otherwise. */\r\n\t\tif(bisect<=begin)bisect=begin+1;\r\n\t\t_seek_helper(vf,bisect);\r\n\t      }else{\r\n\t\tend=result;\r\n\t\tendtime=granulepos;\r\n\t\tbreak;\r\n\t      }\r\n\t    }\r\n\t  }\r\n\t}\r\n      }\r\n    }\r\n\r\n    /* found our page. seek to it, update pcm offset. Easier case than\r\n       raw_seek, don't keep packets preceeding granulepos. */\r\n    {\r\n\r\n      /* seek */\r\n      _seek_helper(vf,best);\r\n      vf->pcm_offset=-1;\r\n\r\n      if(_get_next_page(vf,&og,-1)<0){\r\n\togg_page_release(&og);\r\n\treturn OV_EOF; /* shouldn't happen */\r\n      }\r\n\r\n      ogg_stream_pagein(vf->os,&og);\r\n\r\n      /* pull out all but last packet; the one with granulepos */\r\n      while(1){\r\n\tresult=ogg_stream_packetpeek(vf->os,&op);\r\n\tif(result==0){\r\n\t  /* !!! the packet finishing this page originated on a\r\n             preceeding page. Keep fetching previous pages until we\r\n             get one with a granulepos or without the 'continued' flag\r\n             set.  Then just use raw_seek for simplicity. */\r\n\r\n\t  _seek_helper(vf,best);\r\n\r\n\t  while(1){\r\n\t    result=_get_prev_page(vf,&og);\r\n\t    if(result<0) goto seek_error;\r\n\t    if(ogg_page_granulepos(&og)>-1 ||\r\n\t       !ogg_page_continued(&og)){\r\n\t      return ov_raw_seek(vf,result);\r\n\t    }\r\n\t    vf->offset=result;\r\n\t  }\r\n\t}\r\n\tif(result<0){\r\n\t  result = OV_EBADPACKET;\r\n\t  goto seek_error;\r\n\t}\r\n\tif(op.granulepos!=-1){\r\n\t  vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];\r\n\t  if(vf->pcm_offset<0)vf->pcm_offset=0;\r\n\t  vf->pcm_offset+=total;\r\n\t  break;\r\n\t}else\r\n\t  result=ogg_stream_packetout(vf->os,NULL);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* verify result */\r\n  if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){\r\n    result=OV_EFAULT;\r\n    goto seek_error;\r\n  }\r\n  vf->bittrack=0;\r\n  vf->samptrack=0;\r\n\r\n  ogg_page_release(&og);\r\n  ogg_packet_release(&op);\r\n  return 0;\r\n\r\n seek_error:\r\n\r\n  ogg_page_release(&og);\r\n  ogg_packet_release(&op);\r\n\r\n  /* dump machine so we're in a known state */\r\n  vf->pcm_offset=-1;\r\n  _decode_clear(vf);\r\n  return (int)result;\r\n}\r\n\r\n/* seek to a sample offset relative to the decompressed pcm stream\r\n   returns zero on success, nonzero on failure */\r\n\r\nint ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){\r\n  ogg_packet op={0,0,0,0,0,0};\r\n  ogg_page og={0,0,0,0};\r\n  int thisblock,lastblock=0;\r\n  int ret=ov_pcm_seek_page(vf,pos);\r\n  if(ret<0)return ret;\r\n  if(_make_decode_ready(vf))return OV_EBADLINK;\r\n\r\n  /* discard leading packets we don't need for the lapping of the\r\n     position we want; don't decode them */\r\n\r\n  while(1){\r\n\r\n    int ret=ogg_stream_packetpeek(vf->os,&op);\r\n    if(ret>0){\r\n      thisblock=vorbis_packet_blocksize(&vf->vi,&op);\r\n      if(thisblock<0){\r\n\togg_stream_packetout(vf->os,NULL);\r\n\tcontinue; /* non audio packet */\r\n      }\r\n      if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;\r\n\r\n      if(vf->pcm_offset+((thisblock+\r\n\t\t\t  vorbis_info_blocksize(&vf->vi,1))>>2)>=pos)break;\r\n\r\n      /* remove the packet from packet queue and track its granulepos */\r\n      ogg_stream_packetout(vf->os,NULL);\r\n      vorbis_dsp_synthesis(vf->vd,&op,0);  /* set up a vb with\r\n\t\t\t\t\t      only tracking, no\r\n\t\t\t\t\t      pcm_decode */\r\n\r\n      /* end of logical stream case is hard, especially with exact\r\n\t length positioning. */\r\n\r\n      if(op.granulepos>-1){\r\n\tint i;\r\n\t/* always believe the stream markers */\r\n\tvf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];\r\n\tif(vf->pcm_offset<0)vf->pcm_offset=0;\r\n\tfor(i=0;i<vf->current_link;i++)\r\n\t  vf->pcm_offset+=vf->pcmlengths[i*2+1];\r\n      }\r\n\r\n      lastblock=thisblock;\r\n\r\n    }else{\r\n      if(ret<0 && ret!=OV_HOLE)break;\r\n\r\n      /* suck in a new page */\r\n      if(_get_next_page(vf,&og,-1)<0)break;\r\n      if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);\r\n\r\n      if(vf->ready_state<STREAMSET){\r\n\tint link,ret;\r\n\r\n\tvf->current_serialno=ogg_page_serialno(&og);\r\n\tfor(link=0;link<vf->links;link++)\r\n\t  if(vf->serialnos[link]==vf->current_serialno)break;\r\n\tif(link==vf->links){\r\n\t  ogg_page_release(&og);\r\n\t  ogg_packet_release(&op);\r\n\t  return OV_EBADLINK;\r\n\t}\r\n\r\n\r\n\tvf->current_link=link;\r\n\tret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,&og);\r\n\tif(ret) return ret;\r\n\tif(_make_decode_ready(vf))return OV_EBADLINK;\r\n\tlastblock=0;\r\n      }\r\n\r\n      ogg_stream_pagein(vf->os,&og);\r\n    }\r\n  }\r\n\r\n  vf->bittrack=0;\r\n  vf->samptrack=0;\r\n  /* discard samples until we reach the desired position. Crossing a\r\n     logical bitstream boundary with abandon is OK. */\r\n  while(vf->pcm_offset<pos){\r\n    ogg_int64_t target=pos-vf->pcm_offset;\r\n    long samples=vorbis_dsp_pcmout(vf->vd,NULL,0);\r\n\r\n    if(samples>target)samples=(long)target;\r\n    vorbis_dsp_read(vf->vd,samples);\r\n    vf->pcm_offset+=samples;\r\n\r\n    if(samples<target)\r\n      if(_fetch_and_process_packet(vf,1,1)<=0)\r\n\tvf->pcm_offset=ov_pcm_total(vf,-1); /* eof */\r\n  }\r\n\r\n  ogg_page_release(&og);\r\n  ogg_packet_release(&op);\r\n  return 0;\r\n}\r\n\r\n/* seek to a playback time relative to the decompressed pcm stream\r\n   returns zero on success, nonzero on failure */\r\nint ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){\r\n  /* translate time to PCM position and call ov_pcm_seek */\r\n\r\n  int link=-1;\r\n  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);\r\n  ogg_int64_t time_total=ov_time_total(vf,-1);\r\n\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable)return OV_ENOSEEK;\r\n  if(milliseconds<0 || milliseconds>time_total)return OV_EINVAL;\r\n\r\n  /* which bitstream section does this time offset occur in? */\r\n  for(link=vf->links-1;link>=0;link--){\r\n    pcm_total-=vf->pcmlengths[link*2+1];\r\n    time_total-=ov_time_total(vf,link);\r\n    if(milliseconds>=time_total)break;\r\n  }\r\n\r\n  /* enough information to convert time offset to pcm offset */\r\n  {\r\n    int ret=_set_link_number(vf,link);\r\n    if(ret)return ret;\r\n    return\r\n      ov_pcm_seek(vf,pcm_total+(milliseconds-time_total)*\r\n\t\t  vf->vi.rate/1000);\r\n  }\r\n}\r\n\r\n/* page-granularity version of ov_time_seek\r\n   returns zero on success, nonzero on failure */\r\nint ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){\r\n  /* translate time to PCM position and call ov_pcm_seek */\r\n\r\n  int link=-1;\r\n  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);\r\n  ogg_int64_t time_total=ov_time_total(vf,-1);\r\n\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(!vf->seekable)return OV_ENOSEEK;\r\n  if(milliseconds<0 || milliseconds>time_total)return OV_EINVAL;\r\n\r\n  /* which bitstream section does this time offset occur in? */\r\n  for(link=vf->links-1;link>=0;link--){\r\n    pcm_total-=vf->pcmlengths[link*2+1];\r\n    time_total-=ov_time_total(vf,link);\r\n    if(milliseconds>=time_total)break;\r\n  }\r\n\r\n  /* enough information to convert time offset to pcm offset */\r\n  {\r\n    int ret=_set_link_number(vf,link);\r\n    if(ret)return ret;\r\n    return\r\n      ov_pcm_seek_page(vf,pcm_total+(milliseconds-time_total)*\r\n\t\t       vf->vi.rate/1000);\r\n  }\r\n}\r\n\r\n/* tell the current stream offset cursor.  Note that seek followed by\r\n   tell will likely not give the set offset due to caching */\r\nogg_int64_t ov_raw_tell(OggVorbis_File *vf){\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  return vf->offset;\r\n}\r\n\r\n/* return PCM offset (sample) of next PCM sample to be read */\r\nogg_int64_t ov_pcm_tell(OggVorbis_File *vf){\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  return vf->pcm_offset;\r\n}\r\n\r\n/* return time offset (milliseconds) of next PCM sample to be read */\r\nogg_int64_t ov_time_tell(OggVorbis_File *vf){\r\n  int link=0;\r\n  ogg_int64_t pcm_total=0;\r\n  ogg_int64_t time_total=0;\r\n\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n  if(vf->seekable){\r\n    pcm_total=ov_pcm_total(vf,-1);\r\n    time_total=ov_time_total(vf,-1);\r\n\r\n    /* which bitstream section does this time offset occur in? */\r\n    for(link=vf->links-1;link>=0;link--){\r\n      pcm_total-=vf->pcmlengths[link*2+1];\r\n      time_total-=ov_time_total(vf,link);\r\n      if(vf->pcm_offset>=pcm_total)break;\r\n    }\r\n  }\r\n\r\n  return time_total+(1000*vf->pcm_offset-pcm_total)/vf->vi.rate;\r\n}\r\n\r\n/*  link:   -1) return the vorbis_info struct for the bitstream section\r\n                currently being decoded\r\n           0-n) to request information for a specific bitstream section\r\n\r\n    In the case of a non-seekable bitstream, any call returns the\r\n    current bitstream.  NULL in the case that the machine is not\r\n    initialized */\r\n\r\nvorbis_info *ov_info(OggVorbis_File *vf,int link){\r\n  if(vf->seekable){\r\n    if(link>=vf->links)return NULL;\r\n    if(link>=0){\r\n      int ret=_set_link_number_preserve_pos(vf,link);\r\n      if(ret)return NULL;\r\n    }\r\n  }\r\n  return &vf->vi;\r\n}\r\n\r\n/* grr, strong typing, grr, no templates/inheritence, grr */\r\nvorbis_comment *ov_comment(OggVorbis_File *vf,int link){\r\n  if(vf->seekable){\r\n    if(link>=vf->links)return NULL;\r\n    if(link>=0){\r\n      int ret=_set_link_number_preserve_pos(vf,link);\r\n      if(ret)return NULL;\r\n    }\r\n  }\r\n  return &vf->vc;\r\n}\r\n\r\n/* up to this point, everything could more or less hide the multiple\r\n   logical bitstream nature of chaining from the toplevel application\r\n   if the toplevel application didn't particularly care.  However, at\r\n   the point that we actually read audio back, the multiple-section\r\n   nature must surface: Multiple bitstream sections do not necessarily\r\n   have to have the same number of channels or sampling rate.\r\n\r\n   ov_read returns the sequential logical bitstream number currently\r\n   being decoded along with the PCM data in order that the toplevel\r\n   application can take action on channel/sample rate changes.  This\r\n   number will be incremented even for streamed (non-seekable) streams\r\n   (for seekable streams, it represents the actual logical bitstream\r\n   index within the physical bitstream.  Note that the accessor\r\n   functions above are aware of this dichotomy).\r\n\r\n   input values: buffer) a buffer to hold packed PCM data for return\r\n\t\t length) the byte length requested to be placed into buffer\r\n\r\n   return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)\r\n                   0) EOF\r\n\t\t   n) number of bytes of PCM actually returned.  The\r\n\t\t   below works on a packet-by-packet basis, so the\r\n\t\t   return length is not related to the 'length' passed\r\n\t\t   in, just guaranteed to fit.\r\n\r\n\t    *section) set to the logical bitstream number */\r\n\r\nlong ov_read(OggVorbis_File *vf,void *buffer,int bytes_req,int *bitstream){\r\n\r\n  long samples;\r\n  long channels;\r\n\r\n  if(vf->ready_state<OPENED)return OV_EINVAL;\r\n\r\n  while(1){\r\n    if(vf->ready_state==INITSET){\r\n      channels=vf->vi.channels;\r\n      samples=vorbis_dsp_pcmout(vf->vd,buffer,(bytes_req>>1)/channels);\r\n      if(samples){\r\n\tif(samples>0){\r\n\t  vorbis_dsp_read(vf->vd,samples);\r\n\t  vf->pcm_offset+=samples;\r\n\t  if(bitstream)*bitstream=vf->current_link;\r\n\t  return samples*2*channels;\r\n\t}\r\n\treturn samples;\r\n      }\r\n    }\r\n\r\n    /* suck in another packet */\r\n    {\r\n      int ret=_fetch_and_process_packet(vf,1,1);\r\n      if(ret==OV_EOF)\r\n\treturn 0;\r\n      if(ret<=0)\r\n\treturn ret;\r\n    }\r\n\r\n  }\r\n}\r\n"
  },
  {
    "path": "Engine/libs/Tremolo/window_lookup.h",
    "content": "/************************************************************************\r\n * Copyright (C) 2002-2009, Xiph.org Foundation\r\n * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n *     * Redistributions of source code must retain the above copyright\r\n * notice, this list of conditions and the following disclaimer.\r\n *     * Redistributions in binary form must reproduce the above\r\n * copyright notice, this list of conditions and the following disclaimer\r\n * in the documentation and/or other materials provided with the\r\n * distribution.\r\n *     * Neither the names of the Xiph.org Foundation nor Pinknoise\r\n * Productions Ltd nor the names of its contributors may be used to\r\n * endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n ************************************************************************\r\n\r\n function: window lookup tables\r\n\r\n ************************************************************************/\r\n\r\n\r\n#include \"os_types.h\"\r\n\r\nstatic LOOKUP_T vwin64[32] = {\r\n  X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),\r\n  X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),\r\n  X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),\r\n  X(0x3fb0ab28), X(0x47b2dcd1), X(0x4f807bc6), X(0x56f48e70),\r\n  X(0x5dedfc79), X(0x64511653), X(0x6a08cfff), X(0x6f079328),\r\n  X(0x734796f4), X(0x76cab7f2), X(0x7999d6e8), X(0x7bc3cf9f),\r\n  X(0x7d5c20c1), X(0x7e7961df), X(0x7f33a567), X(0x7fa2e1d0),\r\n  X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),\r\n};\r\n\r\nstatic LOOKUP_T vwin128[64] = {\r\n  X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),\r\n  X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),\r\n  X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),\r\n  X(0x12469488), X(0x152e0c7a), X(0x1842a81c), X(0x1b81686d),\r\n  X(0x1ee705d9), X(0x226ff15d), X(0x26185705), X(0x29dc21cc),\r\n  X(0x2db700fe), X(0x31a46f08), X(0x359fb9c1), X(0x39a40c0c),\r\n  X(0x3dac78b6), X(0x41b40674), X(0x45b5bcb0), X(0x49acb109),\r\n  X(0x4d94152b), X(0x516744bd), X(0x5521d320), X(0x58bf98a5),\r\n  X(0x5c3cbef4), X(0x5f95cc5d), X(0x62c7add7), X(0x65cfbf64),\r\n  X(0x68abd2ba), X(0x6b5a3405), X(0x6dd9acab), X(0x7029840d),\r\n  X(0x72497e38), X(0x7439d8ac), X(0x75fb4532), X(0x778ee30a),\r\n  X(0x78f6367e), X(0x7a331f1a), X(0x7b47cccd), X(0x7c36b416),\r\n  X(0x7d028192), X(0x7dae0d18), X(0x7e3c4caa), X(0x7eb04763),\r\n  X(0x7f0d08a7), X(0x7f5593b7), X(0x7f8cd7d5), X(0x7fb5a513),\r\n  X(0x7fd2a1fc), X(0x7fe64212), X(0x7ff2bd4c), X(0x7ffa0890),\r\n  X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),\r\n};\r\n\r\nstatic LOOKUP_T vwin256[128] = {\r\n  X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),\r\n  X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),\r\n  X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),\r\n  X(0x04b17167), X(0x05776b90), X(0x064bfcdc), X(0x072efedd),\r\n  X(0x082047b4), X(0x091fa9f1), X(0x0a2cf477), X(0x0b47f25d),\r\n  X(0x0c706ad2), X(0x0da620ff), X(0x0ee8d3ef), X(0x10383e75),\r\n  X(0x11941716), X(0x12fc0ff6), X(0x146fd6c8), X(0x15ef14c2),\r\n  X(0x17796e8e), X(0x190e844f), X(0x1aadf196), X(0x1c574d6e),\r\n  X(0x1e0a2a62), X(0x1fc61688), X(0x218a9b9c), X(0x23573f12),\r\n  X(0x252b823d), X(0x2706e269), X(0x28e8d913), X(0x2ad0dc0e),\r\n  X(0x2cbe5dc1), X(0x2eb0cd60), X(0x30a79733), X(0x32a224d5),\r\n  X(0x349fdd8b), X(0x36a02690), X(0x38a2636f), X(0x3aa5f65e),\r\n  X(0x3caa409e), X(0x3eaea2df), X(0x40b27da6), X(0x42b531b8),\r\n  X(0x44b62086), X(0x46b4ac99), X(0x48b03a05), X(0x4aa82ed5),\r\n  X(0x4c9bf37d), X(0x4e8af349), X(0x50749ccb), X(0x52586246),\r\n  X(0x5435ba1c), X(0x560c1f31), X(0x57db1152), X(0x59a21591),\r\n  X(0x5b60b6a3), X(0x5d168535), X(0x5ec31839), X(0x60660d36),\r\n  X(0x61ff0886), X(0x638db595), X(0x6511c717), X(0x668af734),\r\n  X(0x67f907b0), X(0x695bc207), X(0x6ab2f787), X(0x6bfe815a),\r\n  X(0x6d3e4090), X(0x6e721e16), X(0x6f9a0ab5), X(0x70b5fef8),\r\n  X(0x71c5fb16), X(0x72ca06cd), X(0x73c2313d), X(0x74ae90b2),\r\n  X(0x758f4275), X(0x76646a85), X(0x772e335c), X(0x77eccda0),\r\n  X(0x78a06fd7), X(0x79495613), X(0x79e7c19c), X(0x7a7bf894),\r\n  X(0x7b064596), X(0x7b86f757), X(0x7bfe6044), X(0x7c6cd615),\r\n  X(0x7cd2b16e), X(0x7d304d71), X(0x7d860756), X(0x7dd43e06),\r\n  X(0x7e1b51ad), X(0x7e5ba355), X(0x7e95947e), X(0x7ec986bb),\r\n  X(0x7ef7db4a), X(0x7f20f2b9), X(0x7f452c7f), X(0x7f64e6a7),\r\n  X(0x7f807d71), X(0x7f984aff), X(0x7faca700), X(0x7fbde662),\r\n  X(0x7fcc5b04), X(0x7fd85372), X(0x7fe21a99), X(0x7fe9f791),\r\n  X(0x7ff02d58), X(0x7ff4fa9e), X(0x7ff89990), X(0x7ffb3faa),\r\n  X(0x7ffd1d8b), X(0x7ffe5ecc), X(0x7fff29e0), X(0x7fff9ff3),\r\n  X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),\r\n};\r\n\r\nstatic LOOKUP_T vwin512[256] = {\r\n  X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),\r\n  X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),\r\n  X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),\r\n  X(0x012e32b6), X(0x01605df5), X(0x01965b85), X(0x01d02939),\r\n  X(0x020dc4ba), X(0x024f2b83), X(0x02945ae6), X(0x02dd5004),\r\n  X(0x032a07d3), X(0x037a7f19), X(0x03ceb26e), X(0x04269e37),\r\n  X(0x04823eab), X(0x04e18fcc), X(0x05448d6d), X(0x05ab3329),\r\n  X(0x06157c68), X(0x0683645e), X(0x06f4e607), X(0x0769fc25),\r\n  X(0x07e2a146), X(0x085ecfbc), X(0x08de819f), X(0x0961b0cc),\r\n  X(0x09e856e3), X(0x0a726d46), X(0x0affed1d), X(0x0b90cf4c),\r\n  X(0x0c250c79), X(0x0cbc9d0b), X(0x0d577926), X(0x0df598aa),\r\n  X(0x0e96f337), X(0x0f3b8026), X(0x0fe3368f), X(0x108e0d42),\r\n  X(0x113bfaca), X(0x11ecf56b), X(0x12a0f324), X(0x1357e9ac),\r\n  X(0x1411ce70), X(0x14ce9698), X(0x158e3702), X(0x1650a444),\r\n  X(0x1715d2aa), X(0x17ddb638), X(0x18a842aa), X(0x19756b72),\r\n  X(0x1a4523b9), X(0x1b175e62), X(0x1bec0e04), X(0x1cc324f0),\r\n  X(0x1d9c9532), X(0x1e78508a), X(0x1f564876), X(0x20366e2e),\r\n  X(0x2118b2a2), X(0x21fd0681), X(0x22e35a37), X(0x23cb9dee),\r\n  X(0x24b5c18e), X(0x25a1b4c0), X(0x268f66f1), X(0x277ec74e),\r\n  X(0x286fc4cc), X(0x29624e23), X(0x2a5651d7), X(0x2b4bbe34),\r\n  X(0x2c428150), X(0x2d3a8913), X(0x2e33c332), X(0x2f2e1d35),\r\n  X(0x30298478), X(0x3125e62d), X(0x32232f61), X(0x33214cfc),\r\n  X(0x34202bc2), X(0x351fb85a), X(0x361fdf4f), X(0x37208d10),\r\n  X(0x3821adf7), X(0x39232e49), X(0x3a24fa3c), X(0x3b26fdf6),\r\n  X(0x3c292593), X(0x3d2b5d29), X(0x3e2d90c8), X(0x3f2fac7f),\r\n  X(0x40319c5f), X(0x41334c81), X(0x4234a905), X(0x43359e16),\r\n  X(0x443617f3), X(0x453602eb), X(0x46354b65), X(0x4733dde1),\r\n  X(0x4831a6ff), X(0x492e937f), X(0x4a2a9045), X(0x4b258a5f),\r\n  X(0x4c1f6f06), X(0x4d182ba2), X(0x4e0fadce), X(0x4f05e35b),\r\n  X(0x4ffaba53), X(0x50ee20fd), X(0x51e005e1), X(0x52d057ca),\r\n  X(0x53bf05ca), X(0x54abff3b), X(0x559733c7), X(0x56809365),\r\n  X(0x57680e62), X(0x584d955d), X(0x59311952), X(0x5a128b96),\r\n  X(0x5af1dddd), X(0x5bcf023a), X(0x5ca9eb27), X(0x5d828b81),\r\n  X(0x5e58d68d), X(0x5f2cbffc), X(0x5ffe3be9), X(0x60cd3edf),\r\n  X(0x6199bdda), X(0x6263ae45), X(0x632b0602), X(0x63efbb66),\r\n  X(0x64b1c53f), X(0x65711ad0), X(0x662db3d7), X(0x66e7888d),\r\n  X(0x679e91a5), X(0x6852c84e), X(0x69042635), X(0x69b2a582),\r\n  X(0x6a5e40dd), X(0x6b06f36c), X(0x6bacb8d2), X(0x6c4f8d30),\r\n  X(0x6cef6d26), X(0x6d8c55d4), X(0x6e2644d4), X(0x6ebd3840),\r\n  X(0x6f512ead), X(0x6fe2272e), X(0x7070214f), X(0x70fb1d17),\r\n  X(0x71831b06), X(0x72081c16), X(0x728a21b5), X(0x73092dc8),\r\n  X(0x738542a6), X(0x73fe631b), X(0x74749261), X(0x74e7d421),\r\n  X(0x75582c72), X(0x75c59fd5), X(0x76303333), X(0x7697ebdd),\r\n  X(0x76fccf85), X(0x775ee443), X(0x77be308a), X(0x781abb2e),\r\n  X(0x78748b59), X(0x78cba88e), X(0x79201aa7), X(0x7971e9cd),\r\n  X(0x79c11e79), X(0x7a0dc170), X(0x7a57dbc2), X(0x7a9f76c1),\r\n  X(0x7ae49c07), X(0x7b27556b), X(0x7b67ad02), X(0x7ba5ad1b),\r\n  X(0x7be1603a), X(0x7c1ad118), X(0x7c520a9e), X(0x7c8717e1),\r\n  X(0x7cba0421), X(0x7ceadac3), X(0x7d19a74f), X(0x7d46756e),\r\n  X(0x7d7150e5), X(0x7d9a4592), X(0x7dc15f69), X(0x7de6aa71),\r\n  X(0x7e0a32c0), X(0x7e2c0479), X(0x7e4c2bc7), X(0x7e6ab4db),\r\n  X(0x7e87abe9), X(0x7ea31d24), X(0x7ebd14be), X(0x7ed59edd),\r\n  X(0x7eecc7a3), X(0x7f029b21), X(0x7f17255a), X(0x7f2a723f),\r\n  X(0x7f3c8daa), X(0x7f4d835d), X(0x7f5d5f00), X(0x7f6c2c1b),\r\n  X(0x7f79f617), X(0x7f86c83a), X(0x7f92ada2), X(0x7f9db146),\r\n  X(0x7fa7ddf3), X(0x7fb13e46), X(0x7fb9dcb0), X(0x7fc1c36c),\r\n  X(0x7fc8fc83), X(0x7fcf91c7), X(0x7fd58cd2), X(0x7fdaf702),\r\n  X(0x7fdfd979), X(0x7fe43d1c), X(0x7fe82a8b), X(0x7febaa29),\r\n  X(0x7feec412), X(0x7ff1801c), X(0x7ff3e5d6), X(0x7ff5fc86),\r\n  X(0x7ff7cb29), X(0x7ff9586f), X(0x7ffaaaba), X(0x7ffbc81e),\r\n  X(0x7ffcb660), X(0x7ffd7af3), X(0x7ffe1afa), X(0x7ffe9b42),\r\n  X(0x7fff0047), X(0x7fff4e2f), X(0x7fff88c9), X(0x7fffb390),\r\n  X(0x7fffd1a6), X(0x7fffe5d7), X(0x7ffff296), X(0x7ffff9fd),\r\n  X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),\r\n};\r\n\r\nstatic LOOKUP_T vwin1024[512] = {\r\n  X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),\r\n  X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),\r\n  X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),\r\n  X(0x004ba968), X(0x00583ea0), X(0x0065cb0a), X(0x00744e84),\r\n  X(0x0083c8ea), X(0x00943a14), X(0x00a5a1da), X(0x00b80010),\r\n  X(0x00cb5488), X(0x00df9f10), X(0x00f4df76), X(0x010b1584),\r\n  X(0x01224101), X(0x013a61b2), X(0x01537759), X(0x016d81b6),\r\n  X(0x01888087), X(0x01a47385), X(0x01c15a69), X(0x01df34e6),\r\n  X(0x01fe02b1), X(0x021dc377), X(0x023e76e7), X(0x02601ca9),\r\n  X(0x0282b466), X(0x02a63dc1), X(0x02cab85d), X(0x02f023d6),\r\n  X(0x03167fcb), X(0x033dcbd3), X(0x03660783), X(0x038f3270),\r\n  X(0x03b94c29), X(0x03e4543a), X(0x04104a2e), X(0x043d2d8b),\r\n  X(0x046afdd5), X(0x0499ba8c), X(0x04c9632d), X(0x04f9f734),\r\n  X(0x052b7615), X(0x055ddf46), X(0x05913237), X(0x05c56e53),\r\n  X(0x05fa9306), X(0x06309fb6), X(0x066793c5), X(0x069f6e93),\r\n  X(0x06d82f7c), X(0x0711d5d9), X(0x074c60fe), X(0x0787d03d),\r\n  X(0x07c422e4), X(0x0801583e), X(0x083f6f91), X(0x087e681f),\r\n  X(0x08be4129), X(0x08fef9ea), X(0x0940919a), X(0x0983076d),\r\n  X(0x09c65a92), X(0x0a0a8a38), X(0x0a4f9585), X(0x0a957b9f),\r\n  X(0x0adc3ba7), X(0x0b23d4b9), X(0x0b6c45ee), X(0x0bb58e5a),\r\n  X(0x0bffad0f), X(0x0c4aa11a), X(0x0c966982), X(0x0ce3054d),\r\n  X(0x0d30737b), X(0x0d7eb308), X(0x0dcdc2eb), X(0x0e1da21a),\r\n  X(0x0e6e4f83), X(0x0ebfca11), X(0x0f1210ad), X(0x0f652238),\r\n  X(0x0fb8fd91), X(0x100da192), X(0x10630d11), X(0x10b93ee0),\r\n  X(0x111035cb), X(0x1167f09a), X(0x11c06e13), X(0x1219acf5),\r\n  X(0x1273abfb), X(0x12ce69db), X(0x1329e54a), X(0x13861cf3),\r\n  X(0x13e30f80), X(0x1440bb97), X(0x149f1fd8), X(0x14fe3ade),\r\n  X(0x155e0b40), X(0x15be8f92), X(0x161fc662), X(0x1681ae38),\r\n  X(0x16e4459b), X(0x17478b0b), X(0x17ab7d03), X(0x181019fb),\r\n  X(0x18756067), X(0x18db4eb3), X(0x1941e34a), X(0x19a91c92),\r\n  X(0x1a10f8ea), X(0x1a7976af), X(0x1ae29439), X(0x1b4c4fda),\r\n  X(0x1bb6a7e2), X(0x1c219a9a), X(0x1c8d2649), X(0x1cf9492e),\r\n  X(0x1d660188), X(0x1dd34d8e), X(0x1e412b74), X(0x1eaf996a),\r\n  X(0x1f1e959b), X(0x1f8e1e2f), X(0x1ffe3146), X(0x206ecd01),\r\n  X(0x20dfef78), X(0x215196c2), X(0x21c3c0f0), X(0x22366c10),\r\n  X(0x22a9962a), X(0x231d3d45), X(0x23915f60), X(0x2405fa7a),\r\n  X(0x247b0c8c), X(0x24f09389), X(0x25668d65), X(0x25dcf80c),\r\n  X(0x2653d167), X(0x26cb175e), X(0x2742c7d0), X(0x27bae09e),\r\n  X(0x28335fa2), X(0x28ac42b3), X(0x292587a5), X(0x299f2c48),\r\n  X(0x2a192e69), X(0x2a938bd1), X(0x2b0e4247), X(0x2b894f8d),\r\n  X(0x2c04b164), X(0x2c806588), X(0x2cfc69b2), X(0x2d78bb9a),\r\n  X(0x2df558f4), X(0x2e723f6f), X(0x2eef6cbb), X(0x2f6cde83),\r\n  X(0x2fea9270), X(0x30688627), X(0x30e6b74e), X(0x31652385),\r\n  X(0x31e3c86b), X(0x3262a39e), X(0x32e1b2b8), X(0x3360f352),\r\n  X(0x33e06303), X(0x345fff5e), X(0x34dfc5f8), X(0x355fb462),\r\n  X(0x35dfc82a), X(0x365ffee0), X(0x36e0560f), X(0x3760cb43),\r\n  X(0x37e15c05), X(0x386205df), X(0x38e2c657), X(0x39639af5),\r\n  X(0x39e4813e), X(0x3a6576b6), X(0x3ae678e3), X(0x3b678547),\r\n  X(0x3be89965), X(0x3c69b2c1), X(0x3ceacedc), X(0x3d6beb37),\r\n  X(0x3ded0557), X(0x3e6e1abb), X(0x3eef28e6), X(0x3f702d5a),\r\n  X(0x3ff1259a), X(0x40720f29), X(0x40f2e789), X(0x4173ac3f),\r\n  X(0x41f45ad0), X(0x4274f0c2), X(0x42f56b9a), X(0x4375c8e0),\r\n  X(0x43f6061d), X(0x447620db), X(0x44f616a5), X(0x4575e509),\r\n  X(0x45f58994), X(0x467501d6), X(0x46f44b62), X(0x477363cb),\r\n  X(0x47f248a6), X(0x4870f78e), X(0x48ef6e1a), X(0x496da9e8),\r\n  X(0x49eba897), X(0x4a6967c8), X(0x4ae6e521), X(0x4b641e47),\r\n  X(0x4be110e5), X(0x4c5dbaa7), X(0x4cda193f), X(0x4d562a5f),\r\n  X(0x4dd1ebbd), X(0x4e4d5b15), X(0x4ec87623), X(0x4f433aa9),\r\n  X(0x4fbda66c), X(0x5037b734), X(0x50b16acf), X(0x512abf0e),\r\n  X(0x51a3b1c5), X(0x521c40ce), X(0x52946a06), X(0x530c2b50),\r\n  X(0x53838292), X(0x53fa6db8), X(0x5470eab3), X(0x54e6f776),\r\n  X(0x555c91fc), X(0x55d1b844), X(0x56466851), X(0x56baa02f),\r\n  X(0x572e5deb), X(0x57a19f98), X(0x58146352), X(0x5886a737),\r\n  X(0x58f8696d), X(0x5969a81c), X(0x59da6177), X(0x5a4a93b4),\r\n  X(0x5aba3d0f), X(0x5b295bcb), X(0x5b97ee30), X(0x5c05f28d),\r\n  X(0x5c736738), X(0x5ce04a8d), X(0x5d4c9aed), X(0x5db856c1),\r\n  X(0x5e237c78), X(0x5e8e0a89), X(0x5ef7ff6f), X(0x5f6159b0),\r\n  X(0x5fca17d4), X(0x6032386e), X(0x6099ba15), X(0x61009b69),\r\n  X(0x6166db11), X(0x61cc77b9), X(0x62317017), X(0x6295c2e7),\r\n  X(0x62f96eec), X(0x635c72f1), X(0x63becdc8), X(0x64207e4b),\r\n  X(0x6481835a), X(0x64e1dbde), X(0x654186c8), X(0x65a0830e),\r\n  X(0x65fecfb1), X(0x665c6bb7), X(0x66b95630), X(0x67158e30),\r\n  X(0x677112d7), X(0x67cbe34b), X(0x6825feb9), X(0x687f6456),\r\n  X(0x68d81361), X(0x69300b1e), X(0x69874ada), X(0x69ddd1ea),\r\n  X(0x6a339fab), X(0x6a88b382), X(0x6add0cdb), X(0x6b30ab2a),\r\n  X(0x6b838dec), X(0x6bd5b4a6), X(0x6c271ee2), X(0x6c77cc36),\r\n  X(0x6cc7bc3d), X(0x6d16ee9b), X(0x6d6562fb), X(0x6db31911),\r\n  X(0x6e001099), X(0x6e4c4955), X(0x6e97c311), X(0x6ee27d9f),\r\n  X(0x6f2c78d9), X(0x6f75b4a2), X(0x6fbe30e4), X(0x7005ed91),\r\n  X(0x704ceaa1), X(0x70932816), X(0x70d8a5f8), X(0x711d6457),\r\n  X(0x7161634b), X(0x71a4a2f3), X(0x71e72375), X(0x7228e500),\r\n  X(0x7269e7c8), X(0x72aa2c0a), X(0x72e9b209), X(0x73287a12),\r\n  X(0x73668476), X(0x73a3d18f), X(0x73e061bc), X(0x741c3566),\r\n  X(0x74574cfa), X(0x7491a8ee), X(0x74cb49be), X(0x75042fec),\r\n  X(0x753c5c03), X(0x7573ce92), X(0x75aa882f), X(0x75e08979),\r\n  X(0x7615d313), X(0x764a65a7), X(0x767e41e5), X(0x76b16884),\r\n  X(0x76e3da40), X(0x771597dc), X(0x7746a221), X(0x7776f9dd),\r\n  X(0x77a69fe6), X(0x77d59514), X(0x7803da49), X(0x7831706a),\r\n  X(0x785e5861), X(0x788a9320), X(0x78b6219c), X(0x78e104cf),\r\n  X(0x790b3dbb), X(0x7934cd64), X(0x795db4d5), X(0x7985f51d),\r\n  X(0x79ad8f50), X(0x79d48486), X(0x79fad5de), X(0x7a208478),\r\n  X(0x7a45917b), X(0x7a69fe12), X(0x7a8dcb6c), X(0x7ab0fabb),\r\n  X(0x7ad38d36), X(0x7af5841a), X(0x7b16e0a3), X(0x7b37a416),\r\n  X(0x7b57cfb8), X(0x7b7764d4), X(0x7b9664b6), X(0x7bb4d0b0),\r\n  X(0x7bd2aa14), X(0x7beff23b), X(0x7c0caa7f), X(0x7c28d43c),\r\n  X(0x7c4470d2), X(0x7c5f81a5), X(0x7c7a081a), X(0x7c940598),\r\n  X(0x7cad7b8b), X(0x7cc66b5e), X(0x7cded680), X(0x7cf6be64),\r\n  X(0x7d0e247b), X(0x7d250a3c), X(0x7d3b711c), X(0x7d515a95),\r\n  X(0x7d66c822), X(0x7d7bbb3c), X(0x7d903563), X(0x7da43814),\r\n  X(0x7db7c4d0), X(0x7dcadd16), X(0x7ddd826a), X(0x7defb64d),\r\n  X(0x7e017a44), X(0x7e12cfd3), X(0x7e23b87f), X(0x7e3435cc),\r\n  X(0x7e444943), X(0x7e53f467), X(0x7e6338c0), X(0x7e7217d5),\r\n  X(0x7e80932b), X(0x7e8eac49), X(0x7e9c64b7), X(0x7ea9bdf8),\r\n  X(0x7eb6b994), X(0x7ec35910), X(0x7ecf9def), X(0x7edb89b6),\r\n  X(0x7ee71de9), X(0x7ef25c09), X(0x7efd4598), X(0x7f07dc16),\r\n  X(0x7f122103), X(0x7f1c15dc), X(0x7f25bc1f), X(0x7f2f1547),\r\n  X(0x7f3822cd), X(0x7f40e62b), X(0x7f4960d6), X(0x7f519443),\r\n  X(0x7f5981e7), X(0x7f612b31), X(0x7f689191), X(0x7f6fb674),\r\n  X(0x7f769b45), X(0x7f7d416c), X(0x7f83aa51), X(0x7f89d757),\r\n  X(0x7f8fc9df), X(0x7f958348), X(0x7f9b04ef), X(0x7fa0502e),\r\n  X(0x7fa56659), X(0x7faa48c7), X(0x7faef8c7), X(0x7fb377a7),\r\n  X(0x7fb7c6b3), X(0x7fbbe732), X(0x7fbfda67), X(0x7fc3a196),\r\n  X(0x7fc73dfa), X(0x7fcab0ce), X(0x7fcdfb4a), X(0x7fd11ea0),\r\n  X(0x7fd41c00), X(0x7fd6f496), X(0x7fd9a989), X(0x7fdc3bff),\r\n  X(0x7fdead17), X(0x7fe0fdee), X(0x7fe32f9d), X(0x7fe54337),\r\n  X(0x7fe739ce), X(0x7fe9146c), X(0x7fead41b), X(0x7fec79dd),\r\n  X(0x7fee06b2), X(0x7fef7b94), X(0x7ff0d97b), X(0x7ff22158),\r\n  X(0x7ff35417), X(0x7ff472a3), X(0x7ff57de0), X(0x7ff676ac),\r\n  X(0x7ff75de3), X(0x7ff8345a), X(0x7ff8fae4), X(0x7ff9b24b),\r\n  X(0x7ffa5b58), X(0x7ffaf6cd), X(0x7ffb8568), X(0x7ffc07e2),\r\n  X(0x7ffc7eed), X(0x7ffceb38), X(0x7ffd4d6d), X(0x7ffda631),\r\n  X(0x7ffdf621), X(0x7ffe3dd8), X(0x7ffe7dea), X(0x7ffeb6e7),\r\n  X(0x7ffee959), X(0x7fff15c4), X(0x7fff3ca9), X(0x7fff5e80),\r\n  X(0x7fff7bc0), X(0x7fff94d6), X(0x7fffaa2d), X(0x7fffbc29),\r\n  X(0x7fffcb29), X(0x7fffd786), X(0x7fffe195), X(0x7fffe9a3),\r\n  X(0x7fffeffa), X(0x7ffff4dd), X(0x7ffff889), X(0x7ffffb37),\r\n  X(0x7ffffd1a), X(0x7ffffe5d), X(0x7fffff29), X(0x7fffffa0),\r\n  X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),\r\n};\r\n\r\nstatic LOOKUP_T vwin2048[1024] = {\r\n  X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),\r\n  X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),\r\n  X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),\r\n  X(0x0012ec23), X(0x00161216), X(0x001975fe), X(0x001d17da),\r\n  X(0x0020f7a8), X(0x00251564), X(0x0029710c), X(0x002e0a9e),\r\n  X(0x0032e217), X(0x0037f773), X(0x003d4ab0), X(0x0042dbca),\r\n  X(0x0048aabe), X(0x004eb788), X(0x00550224), X(0x005b8a8f),\r\n  X(0x006250c5), X(0x006954c1), X(0x0070967e), X(0x007815f9),\r\n  X(0x007fd32c), X(0x0087ce13), X(0x009006a9), X(0x00987ce9),\r\n  X(0x00a130cc), X(0x00aa224f), X(0x00b3516b), X(0x00bcbe1a),\r\n  X(0x00c66856), X(0x00d0501a), X(0x00da755f), X(0x00e4d81f),\r\n  X(0x00ef7853), X(0x00fa55f4), X(0x010570fc), X(0x0110c963),\r\n  X(0x011c5f22), X(0x01283232), X(0x0134428c), X(0x01409027),\r\n  X(0x014d1afb), X(0x0159e302), X(0x0166e831), X(0x01742a82),\r\n  X(0x0181a9ec), X(0x018f6665), X(0x019d5fe5), X(0x01ab9663),\r\n  X(0x01ba09d6), X(0x01c8ba34), X(0x01d7a775), X(0x01e6d18d),\r\n  X(0x01f63873), X(0x0205dc1e), X(0x0215bc82), X(0x0225d997),\r\n  X(0x02363350), X(0x0246c9a3), X(0x02579c86), X(0x0268abed),\r\n  X(0x0279f7cc), X(0x028b801a), X(0x029d44c9), X(0x02af45ce),\r\n  X(0x02c1831d), X(0x02d3fcaa), X(0x02e6b269), X(0x02f9a44c),\r\n  X(0x030cd248), X(0x03203c4f), X(0x0333e255), X(0x0347c44b),\r\n  X(0x035be225), X(0x03703bd5), X(0x0384d14d), X(0x0399a280),\r\n  X(0x03aeaf5e), X(0x03c3f7d9), X(0x03d97be4), X(0x03ef3b6e),\r\n  X(0x0405366a), X(0x041b6cc8), X(0x0431de78), X(0x04488b6c),\r\n  X(0x045f7393), X(0x047696dd), X(0x048df53b), X(0x04a58e9b),\r\n  X(0x04bd62ee), X(0x04d57223), X(0x04edbc28), X(0x050640ed),\r\n  X(0x051f0060), X(0x0537fa70), X(0x05512f0a), X(0x056a9e1e),\r\n  X(0x05844798), X(0x059e2b67), X(0x05b84978), X(0x05d2a1b8),\r\n  X(0x05ed3414), X(0x06080079), X(0x062306d3), X(0x063e470f),\r\n  X(0x0659c119), X(0x067574dd), X(0x06916247), X(0x06ad8941),\r\n  X(0x06c9e9b8), X(0x06e68397), X(0x070356c8), X(0x07206336),\r\n  X(0x073da8cb), X(0x075b2772), X(0x0778df15), X(0x0796cf9c),\r\n  X(0x07b4f8f3), X(0x07d35b01), X(0x07f1f5b1), X(0x0810c8eb),\r\n  X(0x082fd497), X(0x084f189e), X(0x086e94e9), X(0x088e495e),\r\n  X(0x08ae35e6), X(0x08ce5a68), X(0x08eeb6cc), X(0x090f4af8),\r\n  X(0x093016d3), X(0x09511a44), X(0x09725530), X(0x0993c77f),\r\n  X(0x09b57115), X(0x09d751d8), X(0x09f969ae), X(0x0a1bb87c),\r\n  X(0x0a3e3e26), X(0x0a60fa91), X(0x0a83eda2), X(0x0aa7173c),\r\n  X(0x0aca7743), X(0x0aee0d9b), X(0x0b11da28), X(0x0b35dccc),\r\n  X(0x0b5a156a), X(0x0b7e83e5), X(0x0ba3281f), X(0x0bc801fa),\r\n  X(0x0bed1159), X(0x0c12561c), X(0x0c37d025), X(0x0c5d7f55),\r\n  X(0x0c83638d), X(0x0ca97cae), X(0x0ccfca97), X(0x0cf64d2a),\r\n  X(0x0d1d0444), X(0x0d43efc7), X(0x0d6b0f92), X(0x0d926383),\r\n  X(0x0db9eb79), X(0x0de1a752), X(0x0e0996ee), X(0x0e31ba29),\r\n  X(0x0e5a10e2), X(0x0e829af6), X(0x0eab5841), X(0x0ed448a2),\r\n  X(0x0efd6bf4), X(0x0f26c214), X(0x0f504ade), X(0x0f7a062e),\r\n  X(0x0fa3f3df), X(0x0fce13cd), X(0x0ff865d2), X(0x1022e9ca),\r\n  X(0x104d9f8e), X(0x107886f9), X(0x10a39fe5), X(0x10ceea2c),\r\n  X(0x10fa65a6), X(0x1126122d), X(0x1151ef9a), X(0x117dfdc5),\r\n  X(0x11aa3c87), X(0x11d6abb6), X(0x12034b2c), X(0x12301ac0),\r\n  X(0x125d1a48), X(0x128a499b), X(0x12b7a891), X(0x12e536ff),\r\n  X(0x1312f4bb), X(0x1340e19c), X(0x136efd75), X(0x139d481e),\r\n  X(0x13cbc16a), X(0x13fa692f), X(0x14293f40), X(0x14584371),\r\n  X(0x14877597), X(0x14b6d585), X(0x14e6630d), X(0x15161e04),\r\n  X(0x1546063b), X(0x15761b85), X(0x15a65db3), X(0x15d6cc99),\r\n  X(0x16076806), X(0x16382fcd), X(0x166923bf), X(0x169a43ab),\r\n  X(0x16cb8f62), X(0x16fd06b5), X(0x172ea973), X(0x1760776b),\r\n  X(0x1792706e), X(0x17c49449), X(0x17f6e2cb), X(0x18295bc3),\r\n  X(0x185bfeff), X(0x188ecc4c), X(0x18c1c379), X(0x18f4e452),\r\n  X(0x19282ea4), X(0x195ba23c), X(0x198f3ee6), X(0x19c3046e),\r\n  X(0x19f6f2a1), X(0x1a2b094a), X(0x1a5f4833), X(0x1a93af28),\r\n  X(0x1ac83df3), X(0x1afcf460), X(0x1b31d237), X(0x1b66d744),\r\n  X(0x1b9c034e), X(0x1bd15621), X(0x1c06cf84), X(0x1c3c6f40),\r\n  X(0x1c72351e), X(0x1ca820e6), X(0x1cde3260), X(0x1d146953),\r\n  X(0x1d4ac587), X(0x1d8146c3), X(0x1db7eccd), X(0x1deeb76c),\r\n  X(0x1e25a667), X(0x1e5cb982), X(0x1e93f085), X(0x1ecb4b33),\r\n  X(0x1f02c953), X(0x1f3a6aaa), X(0x1f722efb), X(0x1faa160b),\r\n  X(0x1fe21f9e), X(0x201a4b79), X(0x2052995d), X(0x208b0910),\r\n  X(0x20c39a53), X(0x20fc4cea), X(0x21352097), X(0x216e151c),\r\n  X(0x21a72a3a), X(0x21e05fb5), X(0x2219b54d), X(0x22532ac3),\r\n  X(0x228cbfd8), X(0x22c6744d), X(0x230047e2), X(0x233a3a58),\r\n  X(0x23744b6d), X(0x23ae7ae3), X(0x23e8c878), X(0x242333ec),\r\n  X(0x245dbcfd), X(0x24986369), X(0x24d326f1), X(0x250e0750),\r\n  X(0x25490446), X(0x25841d90), X(0x25bf52ec), X(0x25faa417),\r\n  X(0x263610cd), X(0x267198cc), X(0x26ad3bcf), X(0x26e8f994),\r\n  X(0x2724d1d6), X(0x2760c451), X(0x279cd0c0), X(0x27d8f6e0),\r\n  X(0x2815366a), X(0x28518f1b), X(0x288e00ac), X(0x28ca8ad8),\r\n  X(0x29072d5a), X(0x2943e7eb), X(0x2980ba45), X(0x29bda422),\r\n  X(0x29faa53c), X(0x2a37bd4a), X(0x2a74ec07), X(0x2ab2312b),\r\n  X(0x2aef8c6f), X(0x2b2cfd8b), X(0x2b6a8437), X(0x2ba8202c),\r\n  X(0x2be5d120), X(0x2c2396cc), X(0x2c6170e7), X(0x2c9f5f29),\r\n  X(0x2cdd6147), X(0x2d1b76fa), X(0x2d599ff7), X(0x2d97dbf5),\r\n  X(0x2dd62aab), X(0x2e148bcf), X(0x2e52ff16), X(0x2e918436),\r\n  X(0x2ed01ae5), X(0x2f0ec2d9), X(0x2f4d7bc6), X(0x2f8c4562),\r\n  X(0x2fcb1f62), X(0x300a097a), X(0x3049035f), X(0x30880cc6),\r\n  X(0x30c72563), X(0x31064cea), X(0x3145830f), X(0x3184c786),\r\n  X(0x31c41a03), X(0x32037a39), X(0x3242e7dc), X(0x3282629f),\r\n  X(0x32c1ea36), X(0x33017e53), X(0x33411ea9), X(0x3380caec),\r\n  X(0x33c082ce), X(0x34004602), X(0x34401439), X(0x347fed27),\r\n  X(0x34bfd07e), X(0x34ffbdf0), X(0x353fb52e), X(0x357fb5ec),\r\n  X(0x35bfbfda), X(0x35ffd2aa), X(0x363fee0f), X(0x368011b9),\r\n  X(0x36c03d5a), X(0x370070a4), X(0x3740ab48), X(0x3780ecf7),\r\n  X(0x37c13562), X(0x3801843a), X(0x3841d931), X(0x388233f7),\r\n  X(0x38c2943d), X(0x3902f9b4), X(0x3943640d), X(0x3983d2f8),\r\n  X(0x39c44626), X(0x3a04bd48), X(0x3a45380e), X(0x3a85b62a),\r\n  X(0x3ac6374a), X(0x3b06bb20), X(0x3b47415c), X(0x3b87c9ae),\r\n  X(0x3bc853c7), X(0x3c08df57), X(0x3c496c0f), X(0x3c89f99f),\r\n  X(0x3cca87b6), X(0x3d0b1605), X(0x3d4ba43d), X(0x3d8c320e),\r\n  X(0x3dccbf27), X(0x3e0d4b3a), X(0x3e4dd5f6), X(0x3e8e5f0c),\r\n  X(0x3ecee62b), X(0x3f0f6b05), X(0x3f4fed49), X(0x3f906ca8),\r\n  X(0x3fd0e8d2), X(0x40116177), X(0x4051d648), X(0x409246f6),\r\n  X(0x40d2b330), X(0x41131aa7), X(0x41537d0c), X(0x4193da10),\r\n  X(0x41d43162), X(0x421482b4), X(0x4254cdb7), X(0x4295121b),\r\n  X(0x42d54f91), X(0x431585ca), X(0x4355b477), X(0x4395db49),\r\n  X(0x43d5f9f1), X(0x44161021), X(0x44561d8a), X(0x449621dd),\r\n  X(0x44d61ccc), X(0x45160e08), X(0x4555f544), X(0x4595d230),\r\n  X(0x45d5a47f), X(0x46156be3), X(0x4655280e), X(0x4694d8b2),\r\n  X(0x46d47d82), X(0x4714162f), X(0x4753a26d), X(0x479321ef),\r\n  X(0x47d29466), X(0x4811f987), X(0x48515104), X(0x48909a91),\r\n  X(0x48cfd5e1), X(0x490f02a7), X(0x494e2098), X(0x498d2f66),\r\n  X(0x49cc2ec7), X(0x4a0b1e6f), X(0x4a49fe11), X(0x4a88cd62),\r\n  X(0x4ac78c18), X(0x4b0639e6), X(0x4b44d683), X(0x4b8361a2),\r\n  X(0x4bc1dafa), X(0x4c004241), X(0x4c3e972c), X(0x4c7cd970),\r\n  X(0x4cbb08c5), X(0x4cf924e1), X(0x4d372d7a), X(0x4d752247),\r\n  X(0x4db30300), X(0x4df0cf5a), X(0x4e2e870f), X(0x4e6c29d6),\r\n  X(0x4ea9b766), X(0x4ee72f78), X(0x4f2491c4), X(0x4f61de02),\r\n  X(0x4f9f13ec), X(0x4fdc333b), X(0x50193ba8), X(0x50562ced),\r\n  X(0x509306c3), X(0x50cfc8e5), X(0x510c730d), X(0x514904f6),\r\n  X(0x51857e5a), X(0x51c1def5), X(0x51fe2682), X(0x523a54bc),\r\n  X(0x52766961), X(0x52b2642c), X(0x52ee44d9), X(0x532a0b26),\r\n  X(0x5365b6d0), X(0x53a14793), X(0x53dcbd2f), X(0x54181760),\r\n  X(0x545355e5), X(0x548e787d), X(0x54c97ee6), X(0x550468e1),\r\n  X(0x553f362c), X(0x5579e687), X(0x55b479b3), X(0x55eeef70),\r\n  X(0x5629477f), X(0x566381a1), X(0x569d9d97), X(0x56d79b24),\r\n  X(0x57117a0a), X(0x574b3a0a), X(0x5784dae9), X(0x57be5c69),\r\n  X(0x57f7be4d), X(0x5831005a), X(0x586a2254), X(0x58a32400),\r\n  X(0x58dc0522), X(0x5914c57f), X(0x594d64de), X(0x5985e305),\r\n  X(0x59be3fba), X(0x59f67ac3), X(0x5a2e93e9), X(0x5a668af2),\r\n  X(0x5a9e5fa6), X(0x5ad611ce), X(0x5b0da133), X(0x5b450d9d),\r\n  X(0x5b7c56d7), X(0x5bb37ca9), X(0x5bea7ede), X(0x5c215d41),\r\n  X(0x5c58179d), X(0x5c8eadbe), X(0x5cc51f6f), X(0x5cfb6c7c),\r\n  X(0x5d3194b2), X(0x5d6797de), X(0x5d9d75cf), X(0x5dd32e51),\r\n  X(0x5e08c132), X(0x5e3e2e43), X(0x5e737551), X(0x5ea8962d),\r\n  X(0x5edd90a7), X(0x5f12648e), X(0x5f4711b4), X(0x5f7b97ea),\r\n  X(0x5faff702), X(0x5fe42ece), X(0x60183f20), X(0x604c27cc),\r\n  X(0x607fe8a6), X(0x60b38180), X(0x60e6f22f), X(0x611a3a89),\r\n  X(0x614d5a62), X(0x61805190), X(0x61b31fe9), X(0x61e5c545),\r\n  X(0x62184179), X(0x624a945d), X(0x627cbdca), X(0x62aebd98),\r\n  X(0x62e0939f), X(0x63123fba), X(0x6343c1c1), X(0x6375198f),\r\n  X(0x63a646ff), X(0x63d749ec), X(0x64082232), X(0x6438cfad),\r\n  X(0x64695238), X(0x6499a9b3), X(0x64c9d5f9), X(0x64f9d6ea),\r\n  X(0x6529ac63), X(0x65595643), X(0x6588d46a), X(0x65b826b8),\r\n  X(0x65e74d0e), X(0x6616474b), X(0x66451552), X(0x6673b704),\r\n  X(0x66a22c44), X(0x66d074f4), X(0x66fe90f8), X(0x672c8033),\r\n  X(0x675a428a), X(0x6787d7e1), X(0x67b5401f), X(0x67e27b27),\r\n  X(0x680f88e1), X(0x683c6934), X(0x68691c05), X(0x6895a13e),\r\n  X(0x68c1f8c7), X(0x68ee2287), X(0x691a1e68), X(0x6945ec54),\r\n  X(0x69718c35), X(0x699cfdf5), X(0x69c8417f), X(0x69f356c0),\r\n  X(0x6a1e3da3), X(0x6a48f615), X(0x6a738002), X(0x6a9ddb5a),\r\n  X(0x6ac80808), X(0x6af205fd), X(0x6b1bd526), X(0x6b457575),\r\n  X(0x6b6ee6d8), X(0x6b982940), X(0x6bc13c9f), X(0x6bea20e5),\r\n  X(0x6c12d605), X(0x6c3b5bf1), X(0x6c63b29c), X(0x6c8bd9fb),\r\n  X(0x6cb3d200), X(0x6cdb9aa0), X(0x6d0333d0), X(0x6d2a9d86),\r\n  X(0x6d51d7b7), X(0x6d78e25a), X(0x6d9fbd67), X(0x6dc668d3),\r\n  X(0x6dece498), X(0x6e1330ad), X(0x6e394d0c), X(0x6e5f39ae),\r\n  X(0x6e84f68d), X(0x6eaa83a2), X(0x6ecfe0ea), X(0x6ef50e5e),\r\n  X(0x6f1a0bfc), X(0x6f3ed9bf), X(0x6f6377a4), X(0x6f87e5a8),\r\n  X(0x6fac23c9), X(0x6fd03206), X(0x6ff4105c), X(0x7017becc),\r\n  X(0x703b3d54), X(0x705e8bf5), X(0x7081aaaf), X(0x70a49984),\r\n  X(0x70c75874), X(0x70e9e783), X(0x710c46b2), X(0x712e7605),\r\n  X(0x7150757f), X(0x71724523), X(0x7193e4f6), X(0x71b554fd),\r\n  X(0x71d6953e), X(0x71f7a5bd), X(0x72188681), X(0x72393792),\r\n  X(0x7259b8f5), X(0x727a0ab2), X(0x729a2cd2), X(0x72ba1f5d),\r\n  X(0x72d9e25c), X(0x72f975d8), X(0x7318d9db), X(0x73380e6f),\r\n  X(0x735713a0), X(0x7375e978), X(0x73949003), X(0x73b3074c),\r\n  X(0x73d14f61), X(0x73ef684f), X(0x740d5222), X(0x742b0ce9),\r\n  X(0x744898b1), X(0x7465f589), X(0x74832381), X(0x74a022a8),\r\n  X(0x74bcf30e), X(0x74d994c3), X(0x74f607d8), X(0x75124c5f),\r\n  X(0x752e6268), X(0x754a4a05), X(0x7566034b), X(0x75818e4a),\r\n  X(0x759ceb16), X(0x75b819c4), X(0x75d31a66), X(0x75eded12),\r\n  X(0x760891dc), X(0x762308da), X(0x763d5221), X(0x76576dc8),\r\n  X(0x76715be4), X(0x768b1c8c), X(0x76a4afd9), X(0x76be15e0),\r\n  X(0x76d74ebb), X(0x76f05a82), X(0x7709394d), X(0x7721eb35),\r\n  X(0x773a7054), X(0x7752c8c4), X(0x776af49f), X(0x7782f400),\r\n  X(0x779ac701), X(0x77b26dbd), X(0x77c9e851), X(0x77e136d8),\r\n  X(0x77f8596f), X(0x780f5032), X(0x78261b3f), X(0x783cbab2),\r\n  X(0x78532eaa), X(0x78697745), X(0x787f94a0), X(0x789586db),\r\n  X(0x78ab4e15), X(0x78c0ea6d), X(0x78d65c03), X(0x78eba2f7),\r\n  X(0x7900bf68), X(0x7915b179), X(0x792a7949), X(0x793f16fb),\r\n  X(0x79538aaf), X(0x7967d488), X(0x797bf4a8), X(0x798feb31),\r\n  X(0x79a3b846), X(0x79b75c0a), X(0x79cad6a1), X(0x79de282e),\r\n  X(0x79f150d5), X(0x7a0450bb), X(0x7a172803), X(0x7a29d6d3),\r\n  X(0x7a3c5d50), X(0x7a4ebb9f), X(0x7a60f1e6), X(0x7a73004a),\r\n  X(0x7a84e6f2), X(0x7a96a604), X(0x7aa83da7), X(0x7ab9ae01),\r\n  X(0x7acaf73a), X(0x7adc1979), X(0x7aed14e6), X(0x7afde9a8),\r\n  X(0x7b0e97e8), X(0x7b1f1fcd), X(0x7b2f8182), X(0x7b3fbd2d),\r\n  X(0x7b4fd2f9), X(0x7b5fc30f), X(0x7b6f8d98), X(0x7b7f32bd),\r\n  X(0x7b8eb2a9), X(0x7b9e0d85), X(0x7bad437d), X(0x7bbc54b9),\r\n  X(0x7bcb4166), X(0x7bda09ae), X(0x7be8adbc), X(0x7bf72dbc),\r\n  X(0x7c0589d8), X(0x7c13c23d), X(0x7c21d716), X(0x7c2fc88f),\r\n  X(0x7c3d96d5), X(0x7c4b4214), X(0x7c58ca78), X(0x7c66302d),\r\n  X(0x7c737362), X(0x7c809443), X(0x7c8d92fc), X(0x7c9a6fbc),\r\n  X(0x7ca72aaf), X(0x7cb3c404), X(0x7cc03be8), X(0x7ccc9288),\r\n  X(0x7cd8c814), X(0x7ce4dcb9), X(0x7cf0d0a5), X(0x7cfca406),\r\n  X(0x7d08570c), X(0x7d13e9e5), X(0x7d1f5cbf), X(0x7d2aafca),\r\n  X(0x7d35e335), X(0x7d40f72e), X(0x7d4bebe4), X(0x7d56c188),\r\n  X(0x7d617848), X(0x7d6c1054), X(0x7d7689db), X(0x7d80e50e),\r\n  X(0x7d8b221b), X(0x7d954133), X(0x7d9f4286), X(0x7da92643),\r\n  X(0x7db2ec9b), X(0x7dbc95bd), X(0x7dc621da), X(0x7dcf9123),\r\n  X(0x7dd8e3c6), X(0x7de219f6), X(0x7deb33e2), X(0x7df431ba),\r\n  X(0x7dfd13af), X(0x7e05d9f2), X(0x7e0e84b4), X(0x7e171424),\r\n  X(0x7e1f8874), X(0x7e27e1d4), X(0x7e302074), X(0x7e384487),\r\n  X(0x7e404e3c), X(0x7e483dc4), X(0x7e501350), X(0x7e57cf11),\r\n  X(0x7e5f7138), X(0x7e66f9f4), X(0x7e6e6979), X(0x7e75bff5),\r\n  X(0x7e7cfd9a), X(0x7e842298), X(0x7e8b2f22), X(0x7e922366),\r\n  X(0x7e98ff97), X(0x7e9fc3e4), X(0x7ea6707f), X(0x7ead0598),\r\n  X(0x7eb38360), X(0x7eb9ea07), X(0x7ec039bf), X(0x7ec672b7),\r\n  X(0x7ecc9521), X(0x7ed2a12c), X(0x7ed8970a), X(0x7ede76ea),\r\n  X(0x7ee440fd), X(0x7ee9f573), X(0x7eef947d), X(0x7ef51e4b),\r\n  X(0x7efa930d), X(0x7efff2f2), X(0x7f053e2b), X(0x7f0a74e8),\r\n  X(0x7f0f9758), X(0x7f14a5ac), X(0x7f19a013), X(0x7f1e86bc),\r\n  X(0x7f2359d8), X(0x7f281995), X(0x7f2cc623), X(0x7f315fb1),\r\n  X(0x7f35e66e), X(0x7f3a5a8a), X(0x7f3ebc33), X(0x7f430b98),\r\n  X(0x7f4748e7), X(0x7f4b7450), X(0x7f4f8e01), X(0x7f539629),\r\n  X(0x7f578cf5), X(0x7f5b7293), X(0x7f5f4732), X(0x7f630b00),\r\n  X(0x7f66be2b), X(0x7f6a60df), X(0x7f6df34b), X(0x7f71759b),\r\n  X(0x7f74e7fe), X(0x7f784aa0), X(0x7f7b9daf), X(0x7f7ee156),\r\n  X(0x7f8215c3), X(0x7f853b22), X(0x7f88519f), X(0x7f8b5967),\r\n  X(0x7f8e52a6), X(0x7f913d87), X(0x7f941a36), X(0x7f96e8df),\r\n  X(0x7f99a9ad), X(0x7f9c5ccb), X(0x7f9f0265), X(0x7fa19aa5),\r\n  X(0x7fa425b5), X(0x7fa6a3c1), X(0x7fa914f3), X(0x7fab7974),\r\n  X(0x7fadd16f), X(0x7fb01d0d), X(0x7fb25c78), X(0x7fb48fd9),\r\n  X(0x7fb6b75a), X(0x7fb8d323), X(0x7fbae35d), X(0x7fbce831),\r\n  X(0x7fbee1c7), X(0x7fc0d047), X(0x7fc2b3d9), X(0x7fc48ca5),\r\n  X(0x7fc65ad3), X(0x7fc81e88), X(0x7fc9d7ee), X(0x7fcb872a),\r\n  X(0x7fcd2c63), X(0x7fcec7bf), X(0x7fd05966), X(0x7fd1e17c),\r\n  X(0x7fd36027), X(0x7fd4d58d), X(0x7fd641d3), X(0x7fd7a51e),\r\n  X(0x7fd8ff94), X(0x7fda5157), X(0x7fdb9a8e), X(0x7fdcdb5b),\r\n  X(0x7fde13e2), X(0x7fdf4448), X(0x7fe06caf), X(0x7fe18d3b),\r\n  X(0x7fe2a60e), X(0x7fe3b74b), X(0x7fe4c114), X(0x7fe5c38b),\r\n  X(0x7fe6bed2), X(0x7fe7b30a), X(0x7fe8a055), X(0x7fe986d4),\r\n  X(0x7fea66a7), X(0x7feb3ff0), X(0x7fec12cd), X(0x7fecdf5f),\r\n  X(0x7feda5c5), X(0x7fee6620), X(0x7fef208d), X(0x7fefd52c),\r\n  X(0x7ff0841c), X(0x7ff12d7a), X(0x7ff1d164), X(0x7ff26ff9),\r\n  X(0x7ff30955), X(0x7ff39d96), X(0x7ff42cd9), X(0x7ff4b739),\r\n  X(0x7ff53cd4), X(0x7ff5bdc5), X(0x7ff63a28), X(0x7ff6b217),\r\n  X(0x7ff725af), X(0x7ff7950a), X(0x7ff80043), X(0x7ff86773),\r\n  X(0x7ff8cab4), X(0x7ff92a21), X(0x7ff985d1), X(0x7ff9dddf),\r\n  X(0x7ffa3262), X(0x7ffa8374), X(0x7ffad12c), X(0x7ffb1ba1),\r\n  X(0x7ffb62ec), X(0x7ffba723), X(0x7ffbe85c), X(0x7ffc26b0),\r\n  X(0x7ffc6233), X(0x7ffc9afb), X(0x7ffcd11e), X(0x7ffd04b1),\r\n  X(0x7ffd35c9), X(0x7ffd647b), X(0x7ffd90da), X(0x7ffdbafa),\r\n  X(0x7ffde2f0), X(0x7ffe08ce), X(0x7ffe2ca7), X(0x7ffe4e8e),\r\n  X(0x7ffe6e95), X(0x7ffe8cce), X(0x7ffea94a), X(0x7ffec41b),\r\n  X(0x7ffedd52), X(0x7ffef4ff), X(0x7fff0b33), X(0x7fff1ffd),\r\n  X(0x7fff336e), X(0x7fff4593), X(0x7fff567d), X(0x7fff663a),\r\n  X(0x7fff74d8), X(0x7fff8265), X(0x7fff8eee), X(0x7fff9a81),\r\n  X(0x7fffa52b), X(0x7fffaef8), X(0x7fffb7f5), X(0x7fffc02d),\r\n  X(0x7fffc7ab), X(0x7fffce7c), X(0x7fffd4a9), X(0x7fffda3e),\r\n  X(0x7fffdf44), X(0x7fffe3c6), X(0x7fffe7cc), X(0x7fffeb60),\r\n  X(0x7fffee8a), X(0x7ffff153), X(0x7ffff3c4), X(0x7ffff5e3),\r\n  X(0x7ffff7b8), X(0x7ffff94b), X(0x7ffffaa1), X(0x7ffffbc1),\r\n  X(0x7ffffcb2), X(0x7ffffd78), X(0x7ffffe19), X(0x7ffffe9a),\r\n  X(0x7ffffeff), X(0x7fffff4e), X(0x7fffff89), X(0x7fffffb3),\r\n  X(0x7fffffd2), X(0x7fffffe6), X(0x7ffffff3), X(0x7ffffffa),\r\n  X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),\r\n};\r\n\r\nstatic LOOKUP_T vwin4096[2048] = {\r\n  X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),\r\n  X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),\r\n  X(0x0002300b), X(0x0002bb91), X(0x00035698), X(0x0004011e),\r\n  X(0x0004bb25), X(0x000584ac), X(0x00065db3), X(0x0007463a),\r\n  X(0x00083e41), X(0x000945c7), X(0x000a5ccc), X(0x000b8350),\r\n  X(0x000cb954), X(0x000dfed7), X(0x000f53d8), X(0x0010b857),\r\n  X(0x00122c55), X(0x0013afd1), X(0x001542ca), X(0x0016e541),\r\n  X(0x00189735), X(0x001a58a7), X(0x001c2995), X(0x001e09ff),\r\n  X(0x001ff9e6), X(0x0021f948), X(0x00240826), X(0x00262680),\r\n  X(0x00285454), X(0x002a91a3), X(0x002cde6c), X(0x002f3aaf),\r\n  X(0x0031a66b), X(0x003421a0), X(0x0036ac4f), X(0x00394675),\r\n  X(0x003bf014), X(0x003ea92a), X(0x004171b7), X(0x004449bb),\r\n  X(0x00473135), X(0x004a2824), X(0x004d2e8a), X(0x00504463),\r\n  X(0x005369b2), X(0x00569e74), X(0x0059e2aa), X(0x005d3652),\r\n  X(0x0060996d), X(0x00640bf9), X(0x00678df7), X(0x006b1f66),\r\n  X(0x006ec045), X(0x00727093), X(0x00763051), X(0x0079ff7d),\r\n  X(0x007dde16), X(0x0081cc1d), X(0x0085c991), X(0x0089d671),\r\n  X(0x008df2bc), X(0x00921e71), X(0x00965991), X(0x009aa41a),\r\n  X(0x009efe0c), X(0x00a36766), X(0x00a7e028), X(0x00ac6850),\r\n  X(0x00b0ffde), X(0x00b5a6d1), X(0x00ba5d28), X(0x00bf22e4),\r\n  X(0x00c3f802), X(0x00c8dc83), X(0x00cdd065), X(0x00d2d3a8),\r\n  X(0x00d7e64a), X(0x00dd084c), X(0x00e239ac), X(0x00e77a69),\r\n  X(0x00ecca83), X(0x00f229f9), X(0x00f798ca), X(0x00fd16f5),\r\n  X(0x0102a479), X(0x01084155), X(0x010ded89), X(0x0113a913),\r\n  X(0x011973f3), X(0x011f4e27), X(0x012537af), X(0x012b308a),\r\n  X(0x013138b7), X(0x01375035), X(0x013d7702), X(0x0143ad1f),\r\n  X(0x0149f289), X(0x01504741), X(0x0156ab44), X(0x015d1e92),\r\n  X(0x0163a12a), X(0x016a330b), X(0x0170d433), X(0x017784a3),\r\n  X(0x017e4458), X(0x01851351), X(0x018bf18e), X(0x0192df0d),\r\n  X(0x0199dbcd), X(0x01a0e7cd), X(0x01a8030c), X(0x01af2d89),\r\n  X(0x01b66743), X(0x01bdb038), X(0x01c50867), X(0x01cc6fd0),\r\n  X(0x01d3e670), X(0x01db6c47), X(0x01e30153), X(0x01eaa593),\r\n  X(0x01f25907), X(0x01fa1bac), X(0x0201ed81), X(0x0209ce86),\r\n  X(0x0211beb8), X(0x0219be17), X(0x0221cca2), X(0x0229ea56),\r\n  X(0x02321733), X(0x023a5337), X(0x02429e60), X(0x024af8af),\r\n  X(0x02536220), X(0x025bdab3), X(0x02646267), X(0x026cf93a),\r\n  X(0x02759f2a), X(0x027e5436), X(0x0287185d), X(0x028feb9d),\r\n  X(0x0298cdf4), X(0x02a1bf62), X(0x02aabfe5), X(0x02b3cf7b),\r\n  X(0x02bcee23), X(0x02c61bdb), X(0x02cf58a2), X(0x02d8a475),\r\n  X(0x02e1ff55), X(0x02eb693e), X(0x02f4e230), X(0x02fe6a29),\r\n  X(0x03080127), X(0x0311a729), X(0x031b5c2d), X(0x03252031),\r\n  X(0x032ef334), X(0x0338d534), X(0x0342c630), X(0x034cc625),\r\n  X(0x0356d512), X(0x0360f2f6), X(0x036b1fce), X(0x03755b99),\r\n  X(0x037fa655), X(0x038a0001), X(0x0394689a), X(0x039ee020),\r\n  X(0x03a9668f), X(0x03b3fbe6), X(0x03bea024), X(0x03c95347),\r\n  X(0x03d4154d), X(0x03dee633), X(0x03e9c5f9), X(0x03f4b49b),\r\n  X(0x03ffb219), X(0x040abe71), X(0x0415d9a0), X(0x042103a5),\r\n  X(0x042c3c7d), X(0x04378428), X(0x0442daa2), X(0x044e3fea),\r\n  X(0x0459b3fd), X(0x046536db), X(0x0470c880), X(0x047c68eb),\r\n  X(0x0488181a), X(0x0493d60b), X(0x049fa2bc), X(0x04ab7e2a),\r\n  X(0x04b76854), X(0x04c36137), X(0x04cf68d1), X(0x04db7f21),\r\n  X(0x04e7a424), X(0x04f3d7d8), X(0x05001a3b), X(0x050c6b4a),\r\n  X(0x0518cb04), X(0x05253966), X(0x0531b66e), X(0x053e421a),\r\n  X(0x054adc68), X(0x05578555), X(0x05643cdf), X(0x05710304),\r\n  X(0x057dd7c1), X(0x058abb15), X(0x0597acfd), X(0x05a4ad76),\r\n  X(0x05b1bc7f), X(0x05beda14), X(0x05cc0635), X(0x05d940dd),\r\n  X(0x05e68a0b), X(0x05f3e1bd), X(0x060147f0), X(0x060ebca1),\r\n  X(0x061c3fcf), X(0x0629d176), X(0x06377194), X(0x06452027),\r\n  X(0x0652dd2c), X(0x0660a8a2), X(0x066e8284), X(0x067c6ad1),\r\n  X(0x068a6186), X(0x069866a1), X(0x06a67a1e), X(0x06b49bfc),\r\n  X(0x06c2cc38), X(0x06d10acf), X(0x06df57bf), X(0x06edb304),\r\n  X(0x06fc1c9d), X(0x070a9487), X(0x07191abe), X(0x0727af40),\r\n  X(0x0736520b), X(0x0745031c), X(0x0753c270), X(0x07629004),\r\n  X(0x07716bd6), X(0x078055e2), X(0x078f4e26), X(0x079e549f),\r\n  X(0x07ad694b), X(0x07bc8c26), X(0x07cbbd2e), X(0x07dafc5f),\r\n  X(0x07ea49b7), X(0x07f9a533), X(0x08090ed1), X(0x0818868c),\r\n  X(0x08280c62), X(0x0837a051), X(0x08474255), X(0x0856f26b),\r\n  X(0x0866b091), X(0x08767cc3), X(0x088656fe), X(0x08963f3f),\r\n  X(0x08a63584), X(0x08b639c8), X(0x08c64c0a), X(0x08d66c45),\r\n  X(0x08e69a77), X(0x08f6d69d), X(0x090720b3), X(0x091778b7),\r\n  X(0x0927dea5), X(0x0938527a), X(0x0948d433), X(0x095963cc),\r\n  X(0x096a0143), X(0x097aac94), X(0x098b65bb), X(0x099c2cb6),\r\n  X(0x09ad0182), X(0x09bde41a), X(0x09ced47d), X(0x09dfd2a5),\r\n  X(0x09f0de90), X(0x0a01f83b), X(0x0a131fa3), X(0x0a2454c3),\r\n  X(0x0a359798), X(0x0a46e820), X(0x0a584656), X(0x0a69b237),\r\n  X(0x0a7b2bc0), X(0x0a8cb2ec), X(0x0a9e47ba), X(0x0aafea24),\r\n  X(0x0ac19a29), X(0x0ad357c3), X(0x0ae522ef), X(0x0af6fbab),\r\n  X(0x0b08e1f1), X(0x0b1ad5c0), X(0x0b2cd712), X(0x0b3ee5e5),\r\n  X(0x0b510234), X(0x0b632bfd), X(0x0b75633b), X(0x0b87a7eb),\r\n  X(0x0b99fa08), X(0x0bac5990), X(0x0bbec67e), X(0x0bd140cf),\r\n  X(0x0be3c87e), X(0x0bf65d89), X(0x0c08ffeb), X(0x0c1bafa1),\r\n  X(0x0c2e6ca6), X(0x0c4136f6), X(0x0c540e8f), X(0x0c66f36c),\r\n  X(0x0c79e588), X(0x0c8ce4e1), X(0x0c9ff172), X(0x0cb30b37),\r\n  X(0x0cc6322c), X(0x0cd9664d), X(0x0ceca797), X(0x0cfff605),\r\n  X(0x0d135193), X(0x0d26ba3d), X(0x0d3a2fff), X(0x0d4db2d5),\r\n  X(0x0d6142ba), X(0x0d74dfac), X(0x0d8889a5), X(0x0d9c40a1),\r\n  X(0x0db0049d), X(0x0dc3d593), X(0x0dd7b380), X(0x0deb9e60),\r\n  X(0x0dff962f), X(0x0e139ae7), X(0x0e27ac85), X(0x0e3bcb05),\r\n  X(0x0e4ff662), X(0x0e642e98), X(0x0e7873a2), X(0x0e8cc57d),\r\n  X(0x0ea12423), X(0x0eb58f91), X(0x0eca07c2), X(0x0ede8cb1),\r\n  X(0x0ef31e5b), X(0x0f07bcba), X(0x0f1c67cb), X(0x0f311f88),\r\n  X(0x0f45e3ee), X(0x0f5ab4f7), X(0x0f6f92a0), X(0x0f847ce3),\r\n  X(0x0f9973bc), X(0x0fae7726), X(0x0fc3871e), X(0x0fd8a39d),\r\n  X(0x0fedcca1), X(0x10030223), X(0x1018441f), X(0x102d9291),\r\n  X(0x1042ed74), X(0x105854c3), X(0x106dc879), X(0x10834892),\r\n  X(0x1098d508), X(0x10ae6dd8), X(0x10c412fc), X(0x10d9c46f),\r\n  X(0x10ef822d), X(0x11054c30), X(0x111b2274), X(0x113104f5),\r\n  X(0x1146f3ac), X(0x115cee95), X(0x1172f5ab), X(0x118908e9),\r\n  X(0x119f284a), X(0x11b553ca), X(0x11cb8b62), X(0x11e1cf0f),\r\n  X(0x11f81ecb), X(0x120e7a90), X(0x1224e25a), X(0x123b5624),\r\n  X(0x1251d5e9), X(0x126861a3), X(0x127ef94e), X(0x12959ce3),\r\n  X(0x12ac4c5f), X(0x12c307bb), X(0x12d9cef2), X(0x12f0a200),\r\n  X(0x130780df), X(0x131e6b8a), X(0x133561fa), X(0x134c642c),\r\n  X(0x1363721a), X(0x137a8bbe), X(0x1391b113), X(0x13a8e214),\r\n  X(0x13c01eba), X(0x13d76702), X(0x13eebae5), X(0x14061a5e),\r\n  X(0x141d8567), X(0x1434fbfb), X(0x144c7e14), X(0x14640bae),\r\n  X(0x147ba4c1), X(0x14934949), X(0x14aaf941), X(0x14c2b4a2),\r\n  X(0x14da7b67), X(0x14f24d8a), X(0x150a2b06), X(0x152213d5),\r\n  X(0x153a07f1), X(0x15520755), X(0x156a11fb), X(0x158227dd),\r\n  X(0x159a48f5), X(0x15b2753d), X(0x15caacb1), X(0x15e2ef49),\r\n  X(0x15fb3d01), X(0x161395d2), X(0x162bf9b6), X(0x164468a8),\r\n  X(0x165ce2a1), X(0x1675679c), X(0x168df793), X(0x16a69280),\r\n  X(0x16bf385c), X(0x16d7e922), X(0x16f0a4cc), X(0x17096b54),\r\n  X(0x17223cb4), X(0x173b18e5), X(0x1753ffe2), X(0x176cf1a5),\r\n  X(0x1785ee27), X(0x179ef562), X(0x17b80750), X(0x17d123eb),\r\n  X(0x17ea4b2d), X(0x18037d10), X(0x181cb98d), X(0x1836009e),\r\n  X(0x184f523c), X(0x1868ae63), X(0x1882150a), X(0x189b862c),\r\n  X(0x18b501c4), X(0x18ce87c9), X(0x18e81836), X(0x1901b305),\r\n  X(0x191b582f), X(0x193507ad), X(0x194ec17a), X(0x1968858f),\r\n  X(0x198253e5), X(0x199c2c75), X(0x19b60f3a), X(0x19cffc2d),\r\n  X(0x19e9f347), X(0x1a03f482), X(0x1a1dffd7), X(0x1a381540),\r\n  X(0x1a5234b5), X(0x1a6c5e31), X(0x1a8691ac), X(0x1aa0cf21),\r\n  X(0x1abb1687), X(0x1ad567da), X(0x1aefc311), X(0x1b0a2826),\r\n  X(0x1b249712), X(0x1b3f0fd0), X(0x1b599257), X(0x1b741ea1),\r\n  X(0x1b8eb4a7), X(0x1ba95462), X(0x1bc3fdcd), X(0x1bdeb0de),\r\n  X(0x1bf96d91), X(0x1c1433dd), X(0x1c2f03bc), X(0x1c49dd27),\r\n  X(0x1c64c017), X(0x1c7fac85), X(0x1c9aa269), X(0x1cb5a1be),\r\n  X(0x1cd0aa7c), X(0x1cebbc9c), X(0x1d06d816), X(0x1d21fce4),\r\n  X(0x1d3d2aff), X(0x1d586260), X(0x1d73a2fe), X(0x1d8eecd4),\r\n  X(0x1daa3fda), X(0x1dc59c09), X(0x1de1015a), X(0x1dfc6fc5),\r\n  X(0x1e17e743), X(0x1e3367cd), X(0x1e4ef15b), X(0x1e6a83e7),\r\n  X(0x1e861f6a), X(0x1ea1c3da), X(0x1ebd7133), X(0x1ed9276b),\r\n  X(0x1ef4e67c), X(0x1f10ae5e), X(0x1f2c7f0a), X(0x1f485879),\r\n  X(0x1f643aa2), X(0x1f80257f), X(0x1f9c1908), X(0x1fb81536),\r\n  X(0x1fd41a00), X(0x1ff02761), X(0x200c3d4f), X(0x20285bc3),\r\n  X(0x204482b7), X(0x2060b221), X(0x207ce9fb), X(0x20992a3e),\r\n  X(0x20b572e0), X(0x20d1c3dc), X(0x20ee1d28), X(0x210a7ebe),\r\n  X(0x2126e895), X(0x21435aa6), X(0x215fd4ea), X(0x217c5757),\r\n  X(0x2198e1e8), X(0x21b57493), X(0x21d20f51), X(0x21eeb21b),\r\n  X(0x220b5ce7), X(0x22280fb0), X(0x2244ca6c), X(0x22618d13),\r\n  X(0x227e579f), X(0x229b2a06), X(0x22b80442), X(0x22d4e649),\r\n  X(0x22f1d015), X(0x230ec19d), X(0x232bbad9), X(0x2348bbc1),\r\n  X(0x2365c44c), X(0x2382d474), X(0x239fec30), X(0x23bd0b78),\r\n  X(0x23da3244), X(0x23f7608b), X(0x24149646), X(0x2431d36c),\r\n  X(0x244f17f5), X(0x246c63da), X(0x2489b711), X(0x24a71193),\r\n  X(0x24c47358), X(0x24e1dc57), X(0x24ff4c88), X(0x251cc3e2),\r\n  X(0x253a425e), X(0x2557c7f4), X(0x2575549a), X(0x2592e848),\r\n  X(0x25b082f7), X(0x25ce249e), X(0x25ebcd34), X(0x26097cb2),\r\n  X(0x2627330e), X(0x2644f040), X(0x2662b441), X(0x26807f07),\r\n  X(0x269e5089), X(0x26bc28c1), X(0x26da07a4), X(0x26f7ed2b),\r\n  X(0x2715d94d), X(0x2733cc02), X(0x2751c540), X(0x276fc500),\r\n  X(0x278dcb39), X(0x27abd7e2), X(0x27c9eaf3), X(0x27e80463),\r\n  X(0x28062429), X(0x28244a3e), X(0x28427697), X(0x2860a92d),\r\n  X(0x287ee1f7), X(0x289d20eb), X(0x28bb6603), X(0x28d9b134),\r\n  X(0x28f80275), X(0x291659c0), X(0x2934b709), X(0x29531a49),\r\n  X(0x29718378), X(0x298ff28b), X(0x29ae677b), X(0x29cce23e),\r\n  X(0x29eb62cb), X(0x2a09e91b), X(0x2a287523), X(0x2a4706dc),\r\n  X(0x2a659e3c), X(0x2a843b39), X(0x2aa2ddcd), X(0x2ac185ec),\r\n  X(0x2ae0338f), X(0x2afee6ad), X(0x2b1d9f3c), X(0x2b3c5d33),\r\n  X(0x2b5b208b), X(0x2b79e939), X(0x2b98b734), X(0x2bb78a74),\r\n  X(0x2bd662ef), X(0x2bf5409d), X(0x2c142374), X(0x2c330b6b),\r\n  X(0x2c51f87a), X(0x2c70ea97), X(0x2c8fe1b9), X(0x2caeddd6),\r\n  X(0x2ccddee7), X(0x2cece4e1), X(0x2d0befbb), X(0x2d2aff6d),\r\n  X(0x2d4a13ec), X(0x2d692d31), X(0x2d884b32), X(0x2da76de4),\r\n  X(0x2dc69540), X(0x2de5c13d), X(0x2e04f1d0), X(0x2e2426f0),\r\n  X(0x2e436095), X(0x2e629eb4), X(0x2e81e146), X(0x2ea1283f),\r\n  X(0x2ec07398), X(0x2edfc347), X(0x2eff1742), X(0x2f1e6f80),\r\n  X(0x2f3dcbf8), X(0x2f5d2ca0), X(0x2f7c916f), X(0x2f9bfa5c),\r\n  X(0x2fbb675d), X(0x2fdad869), X(0x2ffa4d76), X(0x3019c67b),\r\n  X(0x3039436f), X(0x3058c448), X(0x307848fc), X(0x3097d183),\r\n  X(0x30b75dd3), X(0x30d6ede2), X(0x30f681a6), X(0x31161917),\r\n  X(0x3135b42b), X(0x315552d8), X(0x3174f514), X(0x31949ad7),\r\n  X(0x31b44417), X(0x31d3f0ca), X(0x31f3a0e6), X(0x32135462),\r\n  X(0x32330b35), X(0x3252c555), X(0x327282b7), X(0x32924354),\r\n  X(0x32b20720), X(0x32d1ce13), X(0x32f19823), X(0x33116546),\r\n  X(0x33313573), X(0x3351089f), X(0x3370dec2), X(0x3390b7d1),\r\n  X(0x33b093c3), X(0x33d0728f), X(0x33f05429), X(0x3410388a),\r\n  X(0x34301fa7), X(0x34500977), X(0x346ff5ef), X(0x348fe506),\r\n  X(0x34afd6b3), X(0x34cfcaeb), X(0x34efc1a5), X(0x350fbad7),\r\n  X(0x352fb678), X(0x354fb47d), X(0x356fb4dd), X(0x358fb78e),\r\n  X(0x35afbc86), X(0x35cfc3bc), X(0x35efcd25), X(0x360fd8b8),\r\n  X(0x362fe66c), X(0x364ff636), X(0x3670080c), X(0x36901be5),\r\n  X(0x36b031b7), X(0x36d04978), X(0x36f0631e), X(0x37107ea0),\r\n  X(0x37309bf3), X(0x3750bb0e), X(0x3770dbe6), X(0x3790fe73),\r\n  X(0x37b122aa), X(0x37d14881), X(0x37f16fee), X(0x381198e8),\r\n  X(0x3831c365), X(0x3851ef5a), X(0x38721cbe), X(0x38924b87),\r\n  X(0x38b27bac), X(0x38d2ad21), X(0x38f2dfde), X(0x391313d8),\r\n  X(0x39334906), X(0x39537f5d), X(0x3973b6d4), X(0x3993ef60),\r\n  X(0x39b428f9), X(0x39d46393), X(0x39f49f25), X(0x3a14dba6),\r\n  X(0x3a35190a), X(0x3a555748), X(0x3a759657), X(0x3a95d62c),\r\n  X(0x3ab616be), X(0x3ad65801), X(0x3af699ed), X(0x3b16dc78),\r\n  X(0x3b371f97), X(0x3b576341), X(0x3b77a76c), X(0x3b97ec0d),\r\n  X(0x3bb8311b), X(0x3bd8768b), X(0x3bf8bc55), X(0x3c19026d),\r\n  X(0x3c3948ca), X(0x3c598f62), X(0x3c79d62b), X(0x3c9a1d1b),\r\n  X(0x3cba6428), X(0x3cdaab48), X(0x3cfaf271), X(0x3d1b3999),\r\n  X(0x3d3b80b6), X(0x3d5bc7be), X(0x3d7c0ea8), X(0x3d9c5569),\r\n  X(0x3dbc9bf7), X(0x3ddce248), X(0x3dfd2852), X(0x3e1d6e0c),\r\n  X(0x3e3db36c), X(0x3e5df866), X(0x3e7e3cf2), X(0x3e9e8106),\r\n  X(0x3ebec497), X(0x3edf079b), X(0x3eff4a09), X(0x3f1f8bd7),\r\n  X(0x3f3fccfa), X(0x3f600d69), X(0x3f804d1a), X(0x3fa08c02),\r\n  X(0x3fc0ca19), X(0x3fe10753), X(0x400143a7), X(0x40217f0a),\r\n  X(0x4041b974), X(0x4061f2da), X(0x40822b32), X(0x40a26272),\r\n  X(0x40c29891), X(0x40e2cd83), X(0x41030140), X(0x412333bd),\r\n  X(0x414364f1), X(0x416394d2), X(0x4183c355), X(0x41a3f070),\r\n  X(0x41c41c1b), X(0x41e4464a), X(0x42046ef4), X(0x42249610),\r\n  X(0x4244bb92), X(0x4264df72), X(0x428501a5), X(0x42a52222),\r\n  X(0x42c540de), X(0x42e55dd0), X(0x430578ed), X(0x4325922d),\r\n  X(0x4345a985), X(0x4365beeb), X(0x4385d255), X(0x43a5e3ba),\r\n  X(0x43c5f30f), X(0x43e6004b), X(0x44060b65), X(0x44261451),\r\n  X(0x44461b07), X(0x44661f7c), X(0x448621a7), X(0x44a6217d),\r\n  X(0x44c61ef6), X(0x44e61a07), X(0x450612a6), X(0x452608ca),\r\n  X(0x4545fc69), X(0x4565ed79), X(0x4585dbf1), X(0x45a5c7c6),\r\n  X(0x45c5b0ef), X(0x45e59761), X(0x46057b15), X(0x46255bfe),\r\n  X(0x46453a15), X(0x4665154f), X(0x4684eda2), X(0x46a4c305),\r\n  X(0x46c4956e), X(0x46e464d3), X(0x4704312b), X(0x4723fa6c),\r\n  X(0x4743c08d), X(0x47638382), X(0x47834344), X(0x47a2ffc9),\r\n  X(0x47c2b906), X(0x47e26ef2), X(0x48022183), X(0x4821d0b1),\r\n  X(0x48417c71), X(0x486124b9), X(0x4880c981), X(0x48a06abe),\r\n  X(0x48c00867), X(0x48dfa272), X(0x48ff38d6), X(0x491ecb8a),\r\n  X(0x493e5a84), X(0x495de5b9), X(0x497d6d22), X(0x499cf0b4),\r\n  X(0x49bc7066), X(0x49dbec2e), X(0x49fb6402), X(0x4a1ad7db),\r\n  X(0x4a3a47ad), X(0x4a59b370), X(0x4a791b1a), X(0x4a987ea1),\r\n  X(0x4ab7ddfd), X(0x4ad73924), X(0x4af6900c), X(0x4b15e2ad),\r\n  X(0x4b3530fc), X(0x4b547af1), X(0x4b73c082), X(0x4b9301a6),\r\n  X(0x4bb23e53), X(0x4bd17681), X(0x4bf0aa25), X(0x4c0fd937),\r\n  X(0x4c2f03ae), X(0x4c4e297f), X(0x4c6d4aa3), X(0x4c8c670f),\r\n  X(0x4cab7eba), X(0x4cca919c), X(0x4ce99fab), X(0x4d08a8de),\r\n  X(0x4d27ad2c), X(0x4d46ac8b), X(0x4d65a6f3), X(0x4d849c5a),\r\n  X(0x4da38cb7), X(0x4dc27802), X(0x4de15e31), X(0x4e003f3a),\r\n  X(0x4e1f1b16), X(0x4e3df1ba), X(0x4e5cc31e), X(0x4e7b8f3a),\r\n  X(0x4e9a5603), X(0x4eb91771), X(0x4ed7d37b), X(0x4ef68a18),\r\n  X(0x4f153b3f), X(0x4f33e6e7), X(0x4f528d08), X(0x4f712d97),\r\n  X(0x4f8fc88e), X(0x4fae5de1), X(0x4fcced8a), X(0x4feb777f),\r\n  X(0x5009fbb6), X(0x50287a28), X(0x5046f2cc), X(0x50656598),\r\n  X(0x5083d284), X(0x50a23988), X(0x50c09a9a), X(0x50def5b1),\r\n  X(0x50fd4ac7), X(0x511b99d0), X(0x5139e2c5), X(0x5158259e),\r\n  X(0x51766251), X(0x519498d6), X(0x51b2c925), X(0x51d0f334),\r\n  X(0x51ef16fb), X(0x520d3473), X(0x522b4b91), X(0x52495c4e),\r\n  X(0x526766a2), X(0x52856a83), X(0x52a367e9), X(0x52c15ecd),\r\n  X(0x52df4f24), X(0x52fd38e8), X(0x531b1c10), X(0x5338f892),\r\n  X(0x5356ce68), X(0x53749d89), X(0x539265eb), X(0x53b02788),\r\n  X(0x53cde257), X(0x53eb964f), X(0x54094369), X(0x5426e99c),\r\n  X(0x544488df), X(0x5462212c), X(0x547fb279), X(0x549d3cbe),\r\n  X(0x54babff4), X(0x54d83c12), X(0x54f5b110), X(0x55131ee7),\r\n  X(0x5530858d), X(0x554de4fc), X(0x556b3d2a), X(0x55888e11),\r\n  X(0x55a5d7a8), X(0x55c319e7), X(0x55e054c7), X(0x55fd883f),\r\n  X(0x561ab447), X(0x5637d8d8), X(0x5654f5ea), X(0x56720b75),\r\n  X(0x568f1971), X(0x56ac1fd7), X(0x56c91e9e), X(0x56e615c0),\r\n  X(0x57030534), X(0x571fecf2), X(0x573cccf3), X(0x5759a530),\r\n  X(0x577675a0), X(0x57933e3c), X(0x57affefd), X(0x57ccb7db),\r\n  X(0x57e968ce), X(0x580611cf), X(0x5822b2d6), X(0x583f4bdd),\r\n  X(0x585bdcdb), X(0x587865c9), X(0x5894e69f), X(0x58b15f57),\r\n  X(0x58cdcfe9), X(0x58ea384e), X(0x5906987d), X(0x5922f071),\r\n  X(0x593f4022), X(0x595b8788), X(0x5977c69c), X(0x5993fd57),\r\n  X(0x59b02bb2), X(0x59cc51a6), X(0x59e86f2c), X(0x5a04843c),\r\n  X(0x5a2090d0), X(0x5a3c94e0), X(0x5a589065), X(0x5a748359),\r\n  X(0x5a906db4), X(0x5aac4f70), X(0x5ac82884), X(0x5ae3f8ec),\r\n  X(0x5affc09f), X(0x5b1b7f97), X(0x5b3735cd), X(0x5b52e33a),\r\n  X(0x5b6e87d8), X(0x5b8a239f), X(0x5ba5b689), X(0x5bc1408f),\r\n  X(0x5bdcc1aa), X(0x5bf839d5), X(0x5c13a907), X(0x5c2f0f3b),\r\n  X(0x5c4a6c6a), X(0x5c65c08d), X(0x5c810b9e), X(0x5c9c4d97),\r\n  X(0x5cb78670), X(0x5cd2b623), X(0x5ceddcaa), X(0x5d08f9ff),\r\n  X(0x5d240e1b), X(0x5d3f18f8), X(0x5d5a1a8f), X(0x5d7512da),\r\n  X(0x5d9001d3), X(0x5daae773), X(0x5dc5c3b5), X(0x5de09692),\r\n  X(0x5dfb6004), X(0x5e162004), X(0x5e30d68d), X(0x5e4b8399),\r\n  X(0x5e662721), X(0x5e80c11f), X(0x5e9b518e), X(0x5eb5d867),\r\n  X(0x5ed055a4), X(0x5eeac940), X(0x5f053334), X(0x5f1f937b),\r\n  X(0x5f39ea0f), X(0x5f5436ea), X(0x5f6e7a06), X(0x5f88b35d),\r\n  X(0x5fa2e2e9), X(0x5fbd08a6), X(0x5fd7248d), X(0x5ff13698),\r\n  X(0x600b3ec2), X(0x60253d05), X(0x603f315b), X(0x60591bc0),\r\n  X(0x6072fc2d), X(0x608cd29e), X(0x60a69f0b), X(0x60c06171),\r\n  X(0x60da19ca), X(0x60f3c80f), X(0x610d6c3d), X(0x6127064d),\r\n  X(0x6140963a), X(0x615a1bff), X(0x61739797), X(0x618d08fc),\r\n  X(0x61a67029), X(0x61bfcd1a), X(0x61d91fc8), X(0x61f2682f),\r\n  X(0x620ba64a), X(0x6224da13), X(0x623e0386), X(0x6257229d),\r\n  X(0x62703754), X(0x628941a6), X(0x62a2418e), X(0x62bb3706),\r\n  X(0x62d4220a), X(0x62ed0296), X(0x6305d8a3), X(0x631ea42f),\r\n  X(0x63376533), X(0x63501bab), X(0x6368c793), X(0x638168e5),\r\n  X(0x6399ff9e), X(0x63b28bb8), X(0x63cb0d2f), X(0x63e383ff),\r\n  X(0x63fbf022), X(0x64145195), X(0x642ca853), X(0x6444f457),\r\n  X(0x645d359e), X(0x64756c22), X(0x648d97e0), X(0x64a5b8d3),\r\n  X(0x64bdcef6), X(0x64d5da47), X(0x64eddabf), X(0x6505d05c),\r\n  X(0x651dbb19), X(0x65359af2), X(0x654d6fe3), X(0x656539e7),\r\n  X(0x657cf8fb), X(0x6594ad1b), X(0x65ac5643), X(0x65c3f46e),\r\n  X(0x65db8799), X(0x65f30fc0), X(0x660a8ce0), X(0x6621fef3),\r\n  X(0x663965f7), X(0x6650c1e7), X(0x666812c1), X(0x667f5880),\r\n  X(0x66969320), X(0x66adc29e), X(0x66c4e6f7), X(0x66dc0026),\r\n  X(0x66f30e28), X(0x670a10fa), X(0x67210898), X(0x6737f4ff),\r\n  X(0x674ed62b), X(0x6765ac19), X(0x677c76c5), X(0x6793362c),\r\n  X(0x67a9ea4b), X(0x67c0931f), X(0x67d730a3), X(0x67edc2d6),\r\n  X(0x680449b3), X(0x681ac538), X(0x68313562), X(0x68479a2d),\r\n  X(0x685df396), X(0x6874419b), X(0x688a8438), X(0x68a0bb6a),\r\n  X(0x68b6e72e), X(0x68cd0782), X(0x68e31c63), X(0x68f925cd),\r\n  X(0x690f23be), X(0x69251633), X(0x693afd29), X(0x6950d89e),\r\n  X(0x6966a88f), X(0x697c6cf8), X(0x699225d9), X(0x69a7d32d),\r\n  X(0x69bd74f3), X(0x69d30b27), X(0x69e895c8), X(0x69fe14d2),\r\n  X(0x6a138844), X(0x6a28f01b), X(0x6a3e4c54), X(0x6a539ced),\r\n  X(0x6a68e1e4), X(0x6a7e1b37), X(0x6a9348e3), X(0x6aa86ae6),\r\n  X(0x6abd813d), X(0x6ad28be7), X(0x6ae78ae2), X(0x6afc7e2b),\r\n  X(0x6b1165c0), X(0x6b26419f), X(0x6b3b11c7), X(0x6b4fd634),\r\n  X(0x6b648ee6), X(0x6b793bda), X(0x6b8ddd0e), X(0x6ba27281),\r\n  X(0x6bb6fc31), X(0x6bcb7a1b), X(0x6bdfec3e), X(0x6bf45299),\r\n  X(0x6c08ad29), X(0x6c1cfbed), X(0x6c313ee4), X(0x6c45760a),\r\n  X(0x6c59a160), X(0x6c6dc0e4), X(0x6c81d493), X(0x6c95dc6d),\r\n  X(0x6ca9d86f), X(0x6cbdc899), X(0x6cd1acea), X(0x6ce5855f),\r\n  X(0x6cf951f7), X(0x6d0d12b1), X(0x6d20c78c), X(0x6d347087),\r\n  X(0x6d480da0), X(0x6d5b9ed6), X(0x6d6f2427), X(0x6d829d94),\r\n  X(0x6d960b1a), X(0x6da96cb9), X(0x6dbcc270), X(0x6dd00c3c),\r\n  X(0x6de34a1f), X(0x6df67c16), X(0x6e09a221), X(0x6e1cbc3f),\r\n  X(0x6e2fca6e), X(0x6e42ccaf), X(0x6e55c300), X(0x6e68ad60),\r\n  X(0x6e7b8bd0), X(0x6e8e5e4d), X(0x6ea124d8), X(0x6eb3df70),\r\n  X(0x6ec68e13), X(0x6ed930c3), X(0x6eebc77d), X(0x6efe5242),\r\n  X(0x6f10d111), X(0x6f2343e9), X(0x6f35aacb), X(0x6f4805b5),\r\n  X(0x6f5a54a8), X(0x6f6c97a2), X(0x6f7ecea4), X(0x6f90f9ae),\r\n  X(0x6fa318be), X(0x6fb52bd6), X(0x6fc732f4), X(0x6fd92e19),\r\n  X(0x6feb1d44), X(0x6ffd0076), X(0x700ed7ad), X(0x7020a2eb),\r\n  X(0x7032622f), X(0x7044157a), X(0x7055bcca), X(0x70675821),\r\n  X(0x7078e77e), X(0x708a6ae2), X(0x709be24c), X(0x70ad4dbd),\r\n  X(0x70bead36), X(0x70d000b5), X(0x70e1483d), X(0x70f283cc),\r\n  X(0x7103b363), X(0x7114d704), X(0x7125eead), X(0x7136fa60),\r\n  X(0x7147fa1c), X(0x7158ede4), X(0x7169d5b6), X(0x717ab193),\r\n  X(0x718b817d), X(0x719c4573), X(0x71acfd76), X(0x71bda988),\r\n  X(0x71ce49a8), X(0x71deddd7), X(0x71ef6617), X(0x71ffe267),\r\n  X(0x721052ca), X(0x7220b73e), X(0x72310fc6), X(0x72415c62),\r\n  X(0x72519d14), X(0x7261d1db), X(0x7271faba), X(0x728217b1),\r\n  X(0x729228c0), X(0x72a22dea), X(0x72b22730), X(0x72c21491),\r\n  X(0x72d1f611), X(0x72e1cbaf), X(0x72f1956c), X(0x7301534c),\r\n  X(0x7311054d), X(0x7320ab72), X(0x733045bc), X(0x733fd42d),\r\n  X(0x734f56c5), X(0x735ecd86), X(0x736e3872), X(0x737d9789),\r\n  X(0x738ceacf), X(0x739c3243), X(0x73ab6de7), X(0x73ba9dbe),\r\n  X(0x73c9c1c8), X(0x73d8da08), X(0x73e7e67f), X(0x73f6e72e),\r\n  X(0x7405dc17), X(0x7414c53c), X(0x7423a29f), X(0x74327442),\r\n  X(0x74413a26), X(0x744ff44d), X(0x745ea2b9), X(0x746d456c),\r\n  X(0x747bdc68), X(0x748a67ae), X(0x7498e741), X(0x74a75b23),\r\n  X(0x74b5c356), X(0x74c41fdb), X(0x74d270b6), X(0x74e0b5e7),\r\n  X(0x74eeef71), X(0x74fd1d57), X(0x750b3f9a), X(0x7519563c),\r\n  X(0x75276140), X(0x753560a8), X(0x75435477), X(0x75513cae),\r\n  X(0x755f1951), X(0x756cea60), X(0x757aafdf), X(0x758869d1),\r\n  X(0x75961837), X(0x75a3bb14), X(0x75b1526a), X(0x75bede3c),\r\n  X(0x75cc5e8d), X(0x75d9d35f), X(0x75e73cb5), X(0x75f49a91),\r\n  X(0x7601ecf6), X(0x760f33e6), X(0x761c6f65), X(0x76299f74),\r\n  X(0x7636c417), X(0x7643dd51), X(0x7650eb24), X(0x765ded93),\r\n  X(0x766ae4a0), X(0x7677d050), X(0x7684b0a4), X(0x7691859f),\r\n  X(0x769e4f45), X(0x76ab0d98), X(0x76b7c09c), X(0x76c46852),\r\n  X(0x76d104bf), X(0x76dd95e6), X(0x76ea1bc9), X(0x76f6966b),\r\n  X(0x770305d0), X(0x770f69fb), X(0x771bc2ef), X(0x772810af),\r\n  X(0x7734533e), X(0x77408aa0), X(0x774cb6d7), X(0x7758d7e8),\r\n  X(0x7764edd5), X(0x7770f8a2), X(0x777cf852), X(0x7788ece8),\r\n  X(0x7794d668), X(0x77a0b4d5), X(0x77ac8833), X(0x77b85085),\r\n  X(0x77c40dce), X(0x77cfc013), X(0x77db6756), X(0x77e7039b),\r\n  X(0x77f294e6), X(0x77fe1b3b), X(0x7809969c), X(0x7815070e),\r\n  X(0x78206c93), X(0x782bc731), X(0x783716ea), X(0x78425bc3),\r\n  X(0x784d95be), X(0x7858c4e1), X(0x7863e92d), X(0x786f02a8),\r\n  X(0x787a1156), X(0x78851539), X(0x78900e56), X(0x789afcb1),\r\n  X(0x78a5e04d), X(0x78b0b92f), X(0x78bb875b), X(0x78c64ad4),\r\n  X(0x78d1039e), X(0x78dbb1be), X(0x78e65537), X(0x78f0ee0e),\r\n  X(0x78fb7c46), X(0x7905ffe4), X(0x791078ec), X(0x791ae762),\r\n  X(0x79254b4a), X(0x792fa4a7), X(0x7939f380), X(0x794437d7),\r\n  X(0x794e71b0), X(0x7958a111), X(0x7962c5fd), X(0x796ce078),\r\n  X(0x7976f087), X(0x7980f62f), X(0x798af173), X(0x7994e258),\r\n  X(0x799ec8e2), X(0x79a8a515), X(0x79b276f7), X(0x79bc3e8b),\r\n  X(0x79c5fbd6), X(0x79cfaedc), X(0x79d957a2), X(0x79e2f62c),\r\n  X(0x79ec8a7f), X(0x79f6149f), X(0x79ff9492), X(0x7a090a5a),\r\n  X(0x7a1275fe), X(0x7a1bd781), X(0x7a252ee9), X(0x7a2e7c39),\r\n  X(0x7a37bf77), X(0x7a40f8a7), X(0x7a4a27ce), X(0x7a534cf0),\r\n  X(0x7a5c6813), X(0x7a65793b), X(0x7a6e806d), X(0x7a777dad),\r\n  X(0x7a807100), X(0x7a895a6b), X(0x7a9239f4), X(0x7a9b0f9e),\r\n  X(0x7aa3db6f), X(0x7aac9d6b), X(0x7ab55597), X(0x7abe03f9),\r\n  X(0x7ac6a895), X(0x7acf4370), X(0x7ad7d48f), X(0x7ae05bf6),\r\n  X(0x7ae8d9ac), X(0x7af14db5), X(0x7af9b815), X(0x7b0218d2),\r\n  X(0x7b0a6ff2), X(0x7b12bd78), X(0x7b1b016a), X(0x7b233bce),\r\n  X(0x7b2b6ca7), X(0x7b3393fc), X(0x7b3bb1d1), X(0x7b43c62c),\r\n  X(0x7b4bd111), X(0x7b53d286), X(0x7b5bca90), X(0x7b63b935),\r\n  X(0x7b6b9e78), X(0x7b737a61), X(0x7b7b4cf3), X(0x7b831634),\r\n  X(0x7b8ad629), X(0x7b928cd8), X(0x7b9a3a45), X(0x7ba1de77),\r\n  X(0x7ba97972), X(0x7bb10b3c), X(0x7bb893d9), X(0x7bc01350),\r\n  X(0x7bc789a6), X(0x7bcef6e0), X(0x7bd65b03), X(0x7bddb616),\r\n  X(0x7be5081c), X(0x7bec511c), X(0x7bf3911b), X(0x7bfac81f),\r\n  X(0x7c01f62c), X(0x7c091b49), X(0x7c10377b), X(0x7c174ac7),\r\n  X(0x7c1e5532), X(0x7c2556c4), X(0x7c2c4f80), X(0x7c333f6c),\r\n  X(0x7c3a268e), X(0x7c4104ec), X(0x7c47da8a), X(0x7c4ea76f),\r\n  X(0x7c556ba1), X(0x7c5c2724), X(0x7c62d9fe), X(0x7c698435),\r\n  X(0x7c7025cf), X(0x7c76bed0), X(0x7c7d4f40), X(0x7c83d723),\r\n  X(0x7c8a567f), X(0x7c90cd5a), X(0x7c973bb9), X(0x7c9da1a2),\r\n  X(0x7ca3ff1b), X(0x7caa542a), X(0x7cb0a0d3), X(0x7cb6e51e),\r\n  X(0x7cbd210f), X(0x7cc354ac), X(0x7cc97ffc), X(0x7ccfa304),\r\n  X(0x7cd5bdc9), X(0x7cdbd051), X(0x7ce1daa3), X(0x7ce7dcc3),\r\n  X(0x7cedd6b8), X(0x7cf3c888), X(0x7cf9b238), X(0x7cff93cf),\r\n  X(0x7d056d51), X(0x7d0b3ec5), X(0x7d110830), X(0x7d16c99a),\r\n  X(0x7d1c8306), X(0x7d22347c), X(0x7d27de00), X(0x7d2d7f9a),\r\n  X(0x7d33194f), X(0x7d38ab24), X(0x7d3e351f), X(0x7d43b748),\r\n  X(0x7d4931a2), X(0x7d4ea435), X(0x7d540f06), X(0x7d59721b),\r\n  X(0x7d5ecd7b), X(0x7d64212a), X(0x7d696d2f), X(0x7d6eb190),\r\n  X(0x7d73ee53), X(0x7d79237e), X(0x7d7e5117), X(0x7d837723),\r\n  X(0x7d8895a9), X(0x7d8dacae), X(0x7d92bc3a), X(0x7d97c451),\r\n  X(0x7d9cc4f9), X(0x7da1be39), X(0x7da6b017), X(0x7dab9a99),\r\n  X(0x7db07dc4), X(0x7db5599e), X(0x7dba2e2f), X(0x7dbefb7b),\r\n  X(0x7dc3c189), X(0x7dc8805e), X(0x7dcd3802), X(0x7dd1e879),\r\n  X(0x7dd691ca), X(0x7ddb33fb), X(0x7ddfcf12), X(0x7de46315),\r\n  X(0x7de8f00a), X(0x7ded75f8), X(0x7df1f4e3), X(0x7df66cd3),\r\n  X(0x7dfaddcd), X(0x7dff47d7), X(0x7e03aaf8), X(0x7e080735),\r\n  X(0x7e0c5c95), X(0x7e10ab1e), X(0x7e14f2d5), X(0x7e1933c1),\r\n  X(0x7e1d6de8), X(0x7e21a150), X(0x7e25cdff), X(0x7e29f3fc),\r\n  X(0x7e2e134c), X(0x7e322bf5), X(0x7e363dfd), X(0x7e3a496b),\r\n  X(0x7e3e4e45), X(0x7e424c90), X(0x7e464454), X(0x7e4a3595),\r\n  X(0x7e4e205a), X(0x7e5204aa), X(0x7e55e289), X(0x7e59b9ff),\r\n  X(0x7e5d8b12), X(0x7e6155c7), X(0x7e651a24), X(0x7e68d831),\r\n  X(0x7e6c8ff2), X(0x7e70416e), X(0x7e73ecac), X(0x7e7791b0),\r\n  X(0x7e7b3082), X(0x7e7ec927), X(0x7e825ba6), X(0x7e85e804),\r\n  X(0x7e896e48), X(0x7e8cee77), X(0x7e906899), X(0x7e93dcb2),\r\n  X(0x7e974aca), X(0x7e9ab2e5), X(0x7e9e150b), X(0x7ea17141),\r\n  X(0x7ea4c78e), X(0x7ea817f7), X(0x7eab6283), X(0x7eaea737),\r\n  X(0x7eb1e61a), X(0x7eb51f33), X(0x7eb85285), X(0x7ebb8019),\r\n  X(0x7ebea7f4), X(0x7ec1ca1d), X(0x7ec4e698), X(0x7ec7fd6d),\r\n  X(0x7ecb0ea1), X(0x7ece1a3a), X(0x7ed1203f), X(0x7ed420b6),\r\n  X(0x7ed71ba4), X(0x7eda110f), X(0x7edd00ff), X(0x7edfeb78),\r\n  X(0x7ee2d081), X(0x7ee5b01f), X(0x7ee88a5a), X(0x7eeb5f36),\r\n  X(0x7eee2eba), X(0x7ef0f8ed), X(0x7ef3bdd3), X(0x7ef67d73),\r\n  X(0x7ef937d3), X(0x7efbecf9), X(0x7efe9ceb), X(0x7f0147ae),\r\n  X(0x7f03ed4a), X(0x7f068dc4), X(0x7f092922), X(0x7f0bbf69),\r\n  X(0x7f0e50a1), X(0x7f10dcce), X(0x7f1363f7), X(0x7f15e622),\r\n  X(0x7f186355), X(0x7f1adb95), X(0x7f1d4ee9), X(0x7f1fbd57),\r\n  X(0x7f2226e4), X(0x7f248b96), X(0x7f26eb74), X(0x7f294683),\r\n  X(0x7f2b9cc9), X(0x7f2dee4d), X(0x7f303b13), X(0x7f328322),\r\n  X(0x7f34c680), X(0x7f370533), X(0x7f393f40), X(0x7f3b74ad),\r\n  X(0x7f3da581), X(0x7f3fd1c1), X(0x7f41f972), X(0x7f441c9c),\r\n  X(0x7f463b43), X(0x7f48556d), X(0x7f4a6b21), X(0x7f4c7c64),\r\n  X(0x7f4e893c), X(0x7f5091ae), X(0x7f5295c1), X(0x7f54957a),\r\n  X(0x7f5690e0), X(0x7f5887f7), X(0x7f5a7ac5), X(0x7f5c6951),\r\n  X(0x7f5e53a0), X(0x7f6039b8), X(0x7f621b9e), X(0x7f63f958),\r\n  X(0x7f65d2ed), X(0x7f67a861), X(0x7f6979ba), X(0x7f6b46ff),\r\n  X(0x7f6d1034), X(0x7f6ed560), X(0x7f709687), X(0x7f7253b1),\r\n  X(0x7f740ce1), X(0x7f75c21f), X(0x7f777370), X(0x7f7920d8),\r\n  X(0x7f7aca5f), X(0x7f7c7008), X(0x7f7e11db), X(0x7f7fafdd),\r\n  X(0x7f814a13), X(0x7f82e082), X(0x7f847331), X(0x7f860224),\r\n  X(0x7f878d62), X(0x7f8914f0), X(0x7f8a98d4), X(0x7f8c1912),\r\n  X(0x7f8d95b0), X(0x7f8f0eb5), X(0x7f908425), X(0x7f91f605),\r\n  X(0x7f93645c), X(0x7f94cf2f), X(0x7f963683), X(0x7f979a5d),\r\n  X(0x7f98fac4), X(0x7f9a57bb), X(0x7f9bb14a), X(0x7f9d0775),\r\n  X(0x7f9e5a41), X(0x7f9fa9b4), X(0x7fa0f5d3), X(0x7fa23ea4),\r\n  X(0x7fa3842b), X(0x7fa4c66f), X(0x7fa60575), X(0x7fa74141),\r\n  X(0x7fa879d9), X(0x7fa9af42), X(0x7faae182), X(0x7fac109e),\r\n  X(0x7fad3c9a), X(0x7fae657d), X(0x7faf8b4c), X(0x7fb0ae0b),\r\n  X(0x7fb1cdc0), X(0x7fb2ea70), X(0x7fb40420), X(0x7fb51ad5),\r\n  X(0x7fb62e95), X(0x7fb73f64), X(0x7fb84d48), X(0x7fb95846),\r\n  X(0x7fba6062), X(0x7fbb65a2), X(0x7fbc680c), X(0x7fbd67a3),\r\n  X(0x7fbe646d), X(0x7fbf5e70), X(0x7fc055af), X(0x7fc14a31),\r\n  X(0x7fc23bf9), X(0x7fc32b0d), X(0x7fc41773), X(0x7fc5012e),\r\n  X(0x7fc5e844), X(0x7fc6ccba), X(0x7fc7ae94), X(0x7fc88dd8),\r\n  X(0x7fc96a8a), X(0x7fca44af), X(0x7fcb1c4c), X(0x7fcbf167),\r\n  X(0x7fccc403), X(0x7fcd9425), X(0x7fce61d3), X(0x7fcf2d11),\r\n  X(0x7fcff5e3), X(0x7fd0bc4f), X(0x7fd1805a), X(0x7fd24207),\r\n  X(0x7fd3015c), X(0x7fd3be5d), X(0x7fd47910), X(0x7fd53178),\r\n  X(0x7fd5e79b), X(0x7fd69b7c), X(0x7fd74d21), X(0x7fd7fc8e),\r\n  X(0x7fd8a9c8), X(0x7fd954d4), X(0x7fd9fdb5), X(0x7fdaa471),\r\n  X(0x7fdb490b), X(0x7fdbeb89), X(0x7fdc8bef), X(0x7fdd2a42),\r\n  X(0x7fddc685), X(0x7fde60be), X(0x7fdef8f0), X(0x7fdf8f20),\r\n  X(0x7fe02353), X(0x7fe0b58d), X(0x7fe145d3), X(0x7fe1d428),\r\n  X(0x7fe26091), X(0x7fe2eb12), X(0x7fe373b0), X(0x7fe3fa6f),\r\n  X(0x7fe47f53), X(0x7fe50260), X(0x7fe5839b), X(0x7fe60308),\r\n  X(0x7fe680ab), X(0x7fe6fc88), X(0x7fe776a4), X(0x7fe7ef02),\r\n  X(0x7fe865a7), X(0x7fe8da97), X(0x7fe94dd6), X(0x7fe9bf68),\r\n  X(0x7fea2f51), X(0x7fea9d95), X(0x7feb0a39), X(0x7feb7540),\r\n  X(0x7febdeae), X(0x7fec4687), X(0x7fecaccf), X(0x7fed118b),\r\n  X(0x7fed74be), X(0x7fedd66c), X(0x7fee3698), X(0x7fee9548),\r\n  X(0x7feef27e), X(0x7fef4e3f), X(0x7fefa88e), X(0x7ff0016f),\r\n  X(0x7ff058e7), X(0x7ff0aef8), X(0x7ff103a6), X(0x7ff156f6),\r\n  X(0x7ff1a8eb), X(0x7ff1f988), X(0x7ff248d2), X(0x7ff296cc),\r\n  X(0x7ff2e37a), X(0x7ff32edf), X(0x7ff378ff), X(0x7ff3c1de),\r\n  X(0x7ff4097e), X(0x7ff44fe5), X(0x7ff49515), X(0x7ff4d911),\r\n  X(0x7ff51bde), X(0x7ff55d7f), X(0x7ff59df7), X(0x7ff5dd4a),\r\n  X(0x7ff61b7b), X(0x7ff6588d), X(0x7ff69485), X(0x7ff6cf65),\r\n  X(0x7ff70930), X(0x7ff741eb), X(0x7ff77998), X(0x7ff7b03b),\r\n  X(0x7ff7e5d7), X(0x7ff81a6f), X(0x7ff84e06), X(0x7ff880a1),\r\n  X(0x7ff8b241), X(0x7ff8e2ea), X(0x7ff912a0), X(0x7ff94165),\r\n  X(0x7ff96f3d), X(0x7ff99c2b), X(0x7ff9c831), X(0x7ff9f354),\r\n  X(0x7ffa1d95), X(0x7ffa46f9), X(0x7ffa6f81), X(0x7ffa9731),\r\n  X(0x7ffabe0d), X(0x7ffae416), X(0x7ffb0951), X(0x7ffb2dbf),\r\n  X(0x7ffb5164), X(0x7ffb7442), X(0x7ffb965d), X(0x7ffbb7b8),\r\n  X(0x7ffbd854), X(0x7ffbf836), X(0x7ffc175f), X(0x7ffc35d3),\r\n  X(0x7ffc5394), X(0x7ffc70a5), X(0x7ffc8d09), X(0x7ffca8c2),\r\n  X(0x7ffcc3d4), X(0x7ffcde3f), X(0x7ffcf809), X(0x7ffd1132),\r\n  X(0x7ffd29be), X(0x7ffd41ae), X(0x7ffd5907), X(0x7ffd6fc9),\r\n  X(0x7ffd85f9), X(0x7ffd9b97), X(0x7ffdb0a7), X(0x7ffdc52b),\r\n  X(0x7ffdd926), X(0x7ffdec99), X(0x7ffdff88), X(0x7ffe11f4),\r\n  X(0x7ffe23e0), X(0x7ffe354f), X(0x7ffe4642), X(0x7ffe56bc),\r\n  X(0x7ffe66bf), X(0x7ffe764e), X(0x7ffe856a), X(0x7ffe9416),\r\n  X(0x7ffea254), X(0x7ffeb026), X(0x7ffebd8e), X(0x7ffeca8f),\r\n  X(0x7ffed72a), X(0x7ffee362), X(0x7ffeef38), X(0x7ffefaaf),\r\n  X(0x7fff05c9), X(0x7fff1087), X(0x7fff1aec), X(0x7fff24f9),\r\n  X(0x7fff2eb1), X(0x7fff3816), X(0x7fff4128), X(0x7fff49eb),\r\n  X(0x7fff5260), X(0x7fff5a88), X(0x7fff6266), X(0x7fff69fc),\r\n  X(0x7fff714b), X(0x7fff7854), X(0x7fff7f1a), X(0x7fff859f),\r\n  X(0x7fff8be3), X(0x7fff91ea), X(0x7fff97b3), X(0x7fff9d41),\r\n  X(0x7fffa296), X(0x7fffa7b3), X(0x7fffac99), X(0x7fffb14b),\r\n  X(0x7fffb5c9), X(0x7fffba15), X(0x7fffbe31), X(0x7fffc21d),\r\n  X(0x7fffc5dc), X(0x7fffc96f), X(0x7fffccd8), X(0x7fffd016),\r\n  X(0x7fffd32d), X(0x7fffd61c), X(0x7fffd8e7), X(0x7fffdb8d),\r\n  X(0x7fffde0f), X(0x7fffe071), X(0x7fffe2b1), X(0x7fffe4d2),\r\n  X(0x7fffe6d5), X(0x7fffe8bb), X(0x7fffea85), X(0x7fffec34),\r\n  X(0x7fffedc9), X(0x7fffef45), X(0x7ffff0aa), X(0x7ffff1f7),\r\n  X(0x7ffff330), X(0x7ffff453), X(0x7ffff562), X(0x7ffff65f),\r\n  X(0x7ffff749), X(0x7ffff823), X(0x7ffff8ec), X(0x7ffff9a6),\r\n  X(0x7ffffa51), X(0x7ffffaee), X(0x7ffffb7e), X(0x7ffffc02),\r\n  X(0x7ffffc7a), X(0x7ffffce7), X(0x7ffffd4a), X(0x7ffffda3),\r\n  X(0x7ffffdf4), X(0x7ffffe3c), X(0x7ffffe7c), X(0x7ffffeb6),\r\n  X(0x7ffffee8), X(0x7fffff15), X(0x7fffff3c), X(0x7fffff5e),\r\n  X(0x7fffff7b), X(0x7fffff95), X(0x7fffffaa), X(0x7fffffbc),\r\n  X(0x7fffffcb), X(0x7fffffd7), X(0x7fffffe2), X(0x7fffffea),\r\n  X(0x7ffffff0), X(0x7ffffff5), X(0x7ffffff9), X(0x7ffffffb),\r\n  X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff),\r\n  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),\r\n};\r\n\r\n#ifndef LIMIT_TO_64kHz\r\n\r\nstatic LOOKUP_T vwin8192[4096] = {\r\n  X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),\r\n  X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),\r\n  X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),\r\n  X(0x00012ecb), X(0x0001612d), X(0x00019770), X(0x0001d193),\r\n  X(0x00020f96), X(0x00025178), X(0x0002973c), X(0x0002e0df),\r\n  X(0x00032e62), X(0x00037fc5), X(0x0003d509), X(0x00042e2c),\r\n  X(0x00048b30), X(0x0004ec13), X(0x000550d7), X(0x0005b97a),\r\n  X(0x000625fe), X(0x00069661), X(0x00070aa4), X(0x000782c8),\r\n  X(0x0007fecb), X(0x00087eae), X(0x00090271), X(0x00098a14),\r\n  X(0x000a1597), X(0x000aa4f9), X(0x000b383b), X(0x000bcf5d),\r\n  X(0x000c6a5f), X(0x000d0941), X(0x000dac02), X(0x000e52a3),\r\n  X(0x000efd23), X(0x000fab84), X(0x00105dc3), X(0x001113e3),\r\n  X(0x0011cde2), X(0x00128bc0), X(0x00134d7e), X(0x0014131b),\r\n  X(0x0014dc98), X(0x0015a9f4), X(0x00167b30), X(0x0017504a),\r\n  X(0x00182945), X(0x0019061e), X(0x0019e6d7), X(0x001acb6f),\r\n  X(0x001bb3e6), X(0x001ca03c), X(0x001d9071), X(0x001e8485),\r\n  X(0x001f7c79), X(0x0020784b), X(0x002177fc), X(0x00227b8c),\r\n  X(0x002382fb), X(0x00248e49), X(0x00259d76), X(0x0026b081),\r\n  X(0x0027c76b), X(0x0028e234), X(0x002a00dc), X(0x002b2361),\r\n  X(0x002c49c6), X(0x002d7409), X(0x002ea22a), X(0x002fd42a),\r\n  X(0x00310a08), X(0x003243c5), X(0x00338160), X(0x0034c2d9),\r\n  X(0x00360830), X(0x00375165), X(0x00389e78), X(0x0039ef6a),\r\n  X(0x003b4439), X(0x003c9ce6), X(0x003df971), X(0x003f59da),\r\n  X(0x0040be20), X(0x00422645), X(0x00439247), X(0x00450226),\r\n  X(0x004675e3), X(0x0047ed7e), X(0x004968f5), X(0x004ae84b),\r\n  X(0x004c6b7d), X(0x004df28d), X(0x004f7d7a), X(0x00510c44),\r\n  X(0x00529eeb), X(0x00543570), X(0x0055cfd1), X(0x00576e0f),\r\n  X(0x00591029), X(0x005ab621), X(0x005c5ff5), X(0x005e0da6),\r\n  X(0x005fbf33), X(0x0061749d), X(0x00632de4), X(0x0064eb06),\r\n  X(0x0066ac05), X(0x006870e0), X(0x006a3998), X(0x006c062b),\r\n  X(0x006dd69b), X(0x006faae6), X(0x0071830d), X(0x00735f10),\r\n  X(0x00753eef), X(0x007722a9), X(0x00790a3f), X(0x007af5b1),\r\n  X(0x007ce4fe), X(0x007ed826), X(0x0080cf29), X(0x0082ca08),\r\n  X(0x0084c8c2), X(0x0086cb57), X(0x0088d1c7), X(0x008adc11),\r\n  X(0x008cea37), X(0x008efc37), X(0x00911212), X(0x00932bc7),\r\n  X(0x00954957), X(0x00976ac2), X(0x00999006), X(0x009bb925),\r\n  X(0x009de61e), X(0x00a016f1), X(0x00a24b9e), X(0x00a48425),\r\n  X(0x00a6c086), X(0x00a900c0), X(0x00ab44d4), X(0x00ad8cc2),\r\n  X(0x00afd889), X(0x00b22829), X(0x00b47ba2), X(0x00b6d2f5),\r\n  X(0x00b92e21), X(0x00bb8d26), X(0x00bdf004), X(0x00c056ba),\r\n  X(0x00c2c149), X(0x00c52fb1), X(0x00c7a1f1), X(0x00ca180a),\r\n  X(0x00cc91fb), X(0x00cf0fc5), X(0x00d19166), X(0x00d416df),\r\n  X(0x00d6a031), X(0x00d92d5a), X(0x00dbbe5b), X(0x00de5333),\r\n  X(0x00e0ebe3), X(0x00e3886b), X(0x00e628c9), X(0x00e8ccff),\r\n  X(0x00eb750c), X(0x00ee20f0), X(0x00f0d0ab), X(0x00f3843d),\r\n  X(0x00f63ba5), X(0x00f8f6e4), X(0x00fbb5fa), X(0x00fe78e5),\r\n  X(0x01013fa7), X(0x01040a3f), X(0x0106d8ae), X(0x0109aaf2),\r\n  X(0x010c810c), X(0x010f5afb), X(0x011238c0), X(0x01151a5b),\r\n  X(0x0117ffcb), X(0x011ae910), X(0x011dd62a), X(0x0120c719),\r\n  X(0x0123bbdd), X(0x0126b476), X(0x0129b0e4), X(0x012cb126),\r\n  X(0x012fb53c), X(0x0132bd27), X(0x0135c8e6), X(0x0138d879),\r\n  X(0x013bebdf), X(0x013f031a), X(0x01421e28), X(0x01453d0a),\r\n  X(0x01485fbf), X(0x014b8648), X(0x014eb0a4), X(0x0151ded2),\r\n  X(0x015510d4), X(0x015846a8), X(0x015b8050), X(0x015ebdc9),\r\n  X(0x0161ff15), X(0x01654434), X(0x01688d24), X(0x016bd9e6),\r\n  X(0x016f2a7b), X(0x01727ee1), X(0x0175d718), X(0x01793321),\r\n  X(0x017c92fc), X(0x017ff6a7), X(0x01835e24), X(0x0186c972),\r\n  X(0x018a3890), X(0x018dab7f), X(0x0191223f), X(0x01949ccf),\r\n  X(0x01981b2f), X(0x019b9d5f), X(0x019f235f), X(0x01a2ad2f),\r\n  X(0x01a63acf), X(0x01a9cc3e), X(0x01ad617c), X(0x01b0fa8a),\r\n  X(0x01b49767), X(0x01b83813), X(0x01bbdc8d), X(0x01bf84d6),\r\n  X(0x01c330ee), X(0x01c6e0d4), X(0x01ca9488), X(0x01ce4c0b),\r\n  X(0x01d2075b), X(0x01d5c679), X(0x01d98964), X(0x01dd501d),\r\n  X(0x01e11aa3), X(0x01e4e8f6), X(0x01e8bb17), X(0x01ec9104),\r\n  X(0x01f06abd), X(0x01f44844), X(0x01f82996), X(0x01fc0eb5),\r\n  X(0x01fff7a0), X(0x0203e456), X(0x0207d4d9), X(0x020bc926),\r\n  X(0x020fc140), X(0x0213bd24), X(0x0217bcd4), X(0x021bc04e),\r\n  X(0x021fc793), X(0x0223d2a3), X(0x0227e17d), X(0x022bf421),\r\n  X(0x02300a90), X(0x023424c8), X(0x023842ca), X(0x023c6495),\r\n  X(0x02408a2a), X(0x0244b389), X(0x0248e0b0), X(0x024d11a0),\r\n  X(0x02514659), X(0x02557eda), X(0x0259bb24), X(0x025dfb35),\r\n  X(0x02623f0f), X(0x026686b1), X(0x026ad21a), X(0x026f214b),\r\n  X(0x02737443), X(0x0277cb02), X(0x027c2588), X(0x028083d5),\r\n  X(0x0284e5e9), X(0x02894bc2), X(0x028db562), X(0x029222c8),\r\n  X(0x029693f4), X(0x029b08e6), X(0x029f819d), X(0x02a3fe19),\r\n  X(0x02a87e5b), X(0x02ad0261), X(0x02b18a2c), X(0x02b615bb),\r\n  X(0x02baa50f), X(0x02bf3827), X(0x02c3cf03), X(0x02c869a3),\r\n  X(0x02cd0807), X(0x02d1aa2d), X(0x02d65017), X(0x02daf9c4),\r\n  X(0x02dfa734), X(0x02e45866), X(0x02e90d5b), X(0x02edc612),\r\n  X(0x02f2828b), X(0x02f742c6), X(0x02fc06c3), X(0x0300ce80),\r\n  X(0x030599ff), X(0x030a6940), X(0x030f3c40), X(0x03141302),\r\n  X(0x0318ed84), X(0x031dcbc6), X(0x0322adc8), X(0x0327938a),\r\n  X(0x032c7d0c), X(0x03316a4c), X(0x03365b4d), X(0x033b500c),\r\n  X(0x03404889), X(0x034544c6), X(0x034a44c0), X(0x034f4879),\r\n  X(0x03544ff0), X(0x03595b24), X(0x035e6a16), X(0x03637cc5),\r\n  X(0x03689331), X(0x036dad5a), X(0x0372cb40), X(0x0377ece2),\r\n  X(0x037d1240), X(0x03823b5a), X(0x03876830), X(0x038c98c1),\r\n  X(0x0391cd0e), X(0x03970516), X(0x039c40d8), X(0x03a18055),\r\n  X(0x03a6c38d), X(0x03ac0a7f), X(0x03b1552b), X(0x03b6a390),\r\n  X(0x03bbf5af), X(0x03c14b88), X(0x03c6a519), X(0x03cc0263),\r\n  X(0x03d16366), X(0x03d6c821), X(0x03dc3094), X(0x03e19cc0),\r\n  X(0x03e70ca2), X(0x03ec803d), X(0x03f1f78e), X(0x03f77296),\r\n  X(0x03fcf155), X(0x040273cb), X(0x0407f9f7), X(0x040d83d9),\r\n  X(0x04131170), X(0x0418a2bd), X(0x041e37c0), X(0x0423d077),\r\n  X(0x04296ce4), X(0x042f0d04), X(0x0434b0da), X(0x043a5863),\r\n  X(0x044003a0), X(0x0445b290), X(0x044b6534), X(0x04511b8b),\r\n  X(0x0456d595), X(0x045c9352), X(0x046254c1), X(0x046819e1),\r\n  X(0x046de2b4), X(0x0473af39), X(0x04797f6e), X(0x047f5355),\r\n  X(0x04852aec), X(0x048b0635), X(0x0490e52d), X(0x0496c7d6),\r\n  X(0x049cae2e), X(0x04a29836), X(0x04a885ed), X(0x04ae7753),\r\n  X(0x04b46c68), X(0x04ba652b), X(0x04c0619d), X(0x04c661bc),\r\n  X(0x04cc658a), X(0x04d26d04), X(0x04d8782c), X(0x04de8701),\r\n  X(0x04e49983), X(0x04eaafb0), X(0x04f0c98a), X(0x04f6e710),\r\n  X(0x04fd0842), X(0x05032d1e), X(0x050955a6), X(0x050f81d8),\r\n  X(0x0515b1b5), X(0x051be53d), X(0x05221c6e), X(0x05285748),\r\n  X(0x052e95cd), X(0x0534d7fa), X(0x053b1dd0), X(0x0541674e),\r\n  X(0x0547b475), X(0x054e0544), X(0x055459bb), X(0x055ab1d9),\r\n  X(0x05610d9e), X(0x05676d0a), X(0x056dd01c), X(0x057436d5),\r\n  X(0x057aa134), X(0x05810f38), X(0x058780e2), X(0x058df631),\r\n  X(0x05946f25), X(0x059aebbe), X(0x05a16bfa), X(0x05a7efdb),\r\n  X(0x05ae775f), X(0x05b50287), X(0x05bb9152), X(0x05c223c0),\r\n  X(0x05c8b9d0), X(0x05cf5382), X(0x05d5f0d6), X(0x05dc91cc),\r\n  X(0x05e33663), X(0x05e9de9c), X(0x05f08a75), X(0x05f739ee),\r\n  X(0x05fded07), X(0x0604a3c0), X(0x060b5e19), X(0x06121c11),\r\n  X(0x0618dda8), X(0x061fa2dd), X(0x06266bb1), X(0x062d3822),\r\n  X(0x06340831), X(0x063adbde), X(0x0641b328), X(0x06488e0e),\r\n  X(0x064f6c91), X(0x06564eaf), X(0x065d346a), X(0x06641dc0),\r\n  X(0x066b0ab1), X(0x0671fb3d), X(0x0678ef64), X(0x067fe724),\r\n  X(0x0686e27f), X(0x068de173), X(0x0694e400), X(0x069bea27),\r\n  X(0x06a2f3e6), X(0x06aa013d), X(0x06b1122c), X(0x06b826b3),\r\n  X(0x06bf3ed1), X(0x06c65a86), X(0x06cd79d1), X(0x06d49cb3),\r\n  X(0x06dbc32b), X(0x06e2ed38), X(0x06ea1adb), X(0x06f14c13),\r\n  X(0x06f880df), X(0x06ffb940), X(0x0706f535), X(0x070e34bd),\r\n  X(0x071577d9), X(0x071cbe88), X(0x072408c9), X(0x072b569d),\r\n  X(0x0732a802), X(0x0739fcf9), X(0x07415582), X(0x0748b19b),\r\n  X(0x07501145), X(0x0757747f), X(0x075edb49), X(0x076645a3),\r\n  X(0x076db38c), X(0x07752503), X(0x077c9a09), X(0x0784129e),\r\n  X(0x078b8ec0), X(0x07930e70), X(0x079a91ac), X(0x07a21876),\r\n  X(0x07a9a2cc), X(0x07b130ad), X(0x07b8c21b), X(0x07c05714),\r\n  X(0x07c7ef98), X(0x07cf8ba6), X(0x07d72b3f), X(0x07dece62),\r\n  X(0x07e6750e), X(0x07ee1f43), X(0x07f5cd01), X(0x07fd7e48),\r\n  X(0x08053316), X(0x080ceb6d), X(0x0814a74a), X(0x081c66af),\r\n  X(0x0824299a), X(0x082bf00c), X(0x0833ba03), X(0x083b8780),\r\n  X(0x08435882), X(0x084b2d09), X(0x08530514), X(0x085ae0a3),\r\n  X(0x0862bfb6), X(0x086aa24c), X(0x08728865), X(0x087a7201),\r\n  X(0x08825f1e), X(0x088a4fbe), X(0x089243de), X(0x089a3b80),\r\n  X(0x08a236a2), X(0x08aa3545), X(0x08b23767), X(0x08ba3d09),\r\n  X(0x08c2462a), X(0x08ca52c9), X(0x08d262e7), X(0x08da7682),\r\n  X(0x08e28d9c), X(0x08eaa832), X(0x08f2c645), X(0x08fae7d4),\r\n  X(0x09030cdf), X(0x090b3566), X(0x09136168), X(0x091b90e5),\r\n  X(0x0923c3dc), X(0x092bfa4d), X(0x09343437), X(0x093c719b),\r\n  X(0x0944b277), X(0x094cf6cc), X(0x09553e99), X(0x095d89dd),\r\n  X(0x0965d899), X(0x096e2acb), X(0x09768073), X(0x097ed991),\r\n  X(0x09873625), X(0x098f962e), X(0x0997f9ac), X(0x09a0609e),\r\n  X(0x09a8cb04), X(0x09b138dd), X(0x09b9aa29), X(0x09c21ee8),\r\n  X(0x09ca9719), X(0x09d312bc), X(0x09db91d0), X(0x09e41456),\r\n  X(0x09ec9a4b), X(0x09f523b1), X(0x09fdb087), X(0x0a0640cc),\r\n  X(0x0a0ed47f), X(0x0a176ba2), X(0x0a200632), X(0x0a28a42f),\r\n  X(0x0a31459a), X(0x0a39ea72), X(0x0a4292b5), X(0x0a4b3e65),\r\n  X(0x0a53ed80), X(0x0a5ca006), X(0x0a6555f7), X(0x0a6e0f51),\r\n  X(0x0a76cc16), X(0x0a7f8c44), X(0x0a884fda), X(0x0a9116d9),\r\n  X(0x0a99e140), X(0x0aa2af0e), X(0x0aab8043), X(0x0ab454df),\r\n  X(0x0abd2ce1), X(0x0ac60849), X(0x0acee716), X(0x0ad7c948),\r\n  X(0x0ae0aedf), X(0x0ae997d9), X(0x0af28437), X(0x0afb73f7),\r\n  X(0x0b04671b), X(0x0b0d5da0), X(0x0b165788), X(0x0b1f54d0),\r\n  X(0x0b285579), X(0x0b315983), X(0x0b3a60ec), X(0x0b436bb5),\r\n  X(0x0b4c79dd), X(0x0b558b63), X(0x0b5ea048), X(0x0b67b88a),\r\n  X(0x0b70d429), X(0x0b79f324), X(0x0b83157c), X(0x0b8c3b30),\r\n  X(0x0b95643f), X(0x0b9e90a8), X(0x0ba7c06c), X(0x0bb0f38a),\r\n  X(0x0bba2a01), X(0x0bc363d1), X(0x0bcca0f9), X(0x0bd5e17a),\r\n  X(0x0bdf2552), X(0x0be86c81), X(0x0bf1b706), X(0x0bfb04e2),\r\n  X(0x0c045613), X(0x0c0daa99), X(0x0c170274), X(0x0c205da3),\r\n  X(0x0c29bc25), X(0x0c331dfb), X(0x0c3c8323), X(0x0c45eb9e),\r\n  X(0x0c4f576a), X(0x0c58c688), X(0x0c6238f6), X(0x0c6baeb5),\r\n  X(0x0c7527c3), X(0x0c7ea421), X(0x0c8823cd), X(0x0c91a6c8),\r\n  X(0x0c9b2d10), X(0x0ca4b6a6), X(0x0cae4389), X(0x0cb7d3b8),\r\n  X(0x0cc16732), X(0x0ccafdf8), X(0x0cd49809), X(0x0cde3564),\r\n  X(0x0ce7d609), X(0x0cf179f7), X(0x0cfb212e), X(0x0d04cbad),\r\n  X(0x0d0e7974), X(0x0d182a83), X(0x0d21ded8), X(0x0d2b9673),\r\n  X(0x0d355154), X(0x0d3f0f7b), X(0x0d48d0e6), X(0x0d529595),\r\n  X(0x0d5c5d88), X(0x0d6628be), X(0x0d6ff737), X(0x0d79c8f2),\r\n  X(0x0d839dee), X(0x0d8d762c), X(0x0d9751aa), X(0x0da13068),\r\n  X(0x0dab1266), X(0x0db4f7a3), X(0x0dbee01e), X(0x0dc8cbd8),\r\n  X(0x0dd2bace), X(0x0ddcad02), X(0x0de6a272), X(0x0df09b1e),\r\n  X(0x0dfa9705), X(0x0e049627), X(0x0e0e9883), X(0x0e189e19),\r\n  X(0x0e22a6e8), X(0x0e2cb2f0), X(0x0e36c230), X(0x0e40d4a8),\r\n  X(0x0e4aea56), X(0x0e55033b), X(0x0e5f1f56), X(0x0e693ea7),\r\n  X(0x0e73612c), X(0x0e7d86e5), X(0x0e87afd3), X(0x0e91dbf3),\r\n  X(0x0e9c0b47), X(0x0ea63dcc), X(0x0eb07383), X(0x0ebaac6b),\r\n  X(0x0ec4e883), X(0x0ecf27cc), X(0x0ed96a44), X(0x0ee3afea),\r\n  X(0x0eedf8bf), X(0x0ef844c2), X(0x0f0293f2), X(0x0f0ce64e),\r\n  X(0x0f173bd6), X(0x0f21948a), X(0x0f2bf069), X(0x0f364f72),\r\n  X(0x0f40b1a5), X(0x0f4b1701), X(0x0f557f86), X(0x0f5feb32),\r\n  X(0x0f6a5a07), X(0x0f74cc02), X(0x0f7f4124), X(0x0f89b96b),\r\n  X(0x0f9434d8), X(0x0f9eb369), X(0x0fa9351e), X(0x0fb3b9f7),\r\n  X(0x0fbe41f3), X(0x0fc8cd11), X(0x0fd35b51), X(0x0fddecb2),\r\n  X(0x0fe88134), X(0x0ff318d6), X(0x0ffdb397), X(0x10085177),\r\n  X(0x1012f275), X(0x101d9691), X(0x10283dca), X(0x1032e81f),\r\n  X(0x103d9591), X(0x1048461e), X(0x1052f9c5), X(0x105db087),\r\n  X(0x10686a62), X(0x10732756), X(0x107de763), X(0x1088aa87),\r\n  X(0x109370c2), X(0x109e3a14), X(0x10a9067c), X(0x10b3d5f9),\r\n  X(0x10bea88b), X(0x10c97e31), X(0x10d456eb), X(0x10df32b8),\r\n  X(0x10ea1197), X(0x10f4f387), X(0x10ffd889), X(0x110ac09b),\r\n  X(0x1115abbe), X(0x112099ef), X(0x112b8b2f), X(0x11367f7d),\r\n  X(0x114176d9), X(0x114c7141), X(0x11576eb6), X(0x11626f36),\r\n  X(0x116d72c1), X(0x11787957), X(0x118382f6), X(0x118e8f9e),\r\n  X(0x11999f4f), X(0x11a4b208), X(0x11afc7c7), X(0x11bae08e),\r\n  X(0x11c5fc5a), X(0x11d11b2c), X(0x11dc3d02), X(0x11e761dd),\r\n  X(0x11f289ba), X(0x11fdb49b), X(0x1208e27e), X(0x12141362),\r\n  X(0x121f4748), X(0x122a7e2d), X(0x1235b812), X(0x1240f4f6),\r\n  X(0x124c34d9), X(0x125777b9), X(0x1262bd96), X(0x126e0670),\r\n  X(0x12795245), X(0x1284a115), X(0x128ff2e0), X(0x129b47a5),\r\n  X(0x12a69f63), X(0x12b1fa19), X(0x12bd57c7), X(0x12c8b86c),\r\n  X(0x12d41c08), X(0x12df829a), X(0x12eaec21), X(0x12f6589d),\r\n  X(0x1301c80c), X(0x130d3a6f), X(0x1318afc4), X(0x1324280b),\r\n  X(0x132fa344), X(0x133b216d), X(0x1346a286), X(0x1352268e),\r\n  X(0x135dad85), X(0x1369376a), X(0x1374c43c), X(0x138053fb),\r\n  X(0x138be6a5), X(0x13977c3b), X(0x13a314bc), X(0x13aeb026),\r\n  X(0x13ba4e79), X(0x13c5efb5), X(0x13d193d9), X(0x13dd3ae4),\r\n  X(0x13e8e4d6), X(0x13f491ad), X(0x1400416a), X(0x140bf40b),\r\n  X(0x1417a98f), X(0x142361f7), X(0x142f1d41), X(0x143adb6d),\r\n  X(0x14469c7a), X(0x14526067), X(0x145e2734), X(0x1469f0df),\r\n  X(0x1475bd69), X(0x14818cd0), X(0x148d5f15), X(0x14993435),\r\n  X(0x14a50c31), X(0x14b0e708), X(0x14bcc4b8), X(0x14c8a542),\r\n  X(0x14d488a5), X(0x14e06edf), X(0x14ec57f1), X(0x14f843d9),\r\n  X(0x15043297), X(0x1510242b), X(0x151c1892), X(0x15280fcd),\r\n  X(0x153409dc), X(0x154006bc), X(0x154c066e), X(0x155808f1),\r\n  X(0x15640e44), X(0x15701666), X(0x157c2157), X(0x15882f16),\r\n  X(0x15943fa2), X(0x15a052fb), X(0x15ac691f), X(0x15b8820f),\r\n  X(0x15c49dc8), X(0x15d0bc4c), X(0x15dcdd98), X(0x15e901ad),\r\n  X(0x15f52888), X(0x1601522b), X(0x160d7e93), X(0x1619adc1),\r\n  X(0x1625dfb3), X(0x16321469), X(0x163e4be2), X(0x164a861d),\r\n  X(0x1656c31a), X(0x166302d8), X(0x166f4555), X(0x167b8a92),\r\n  X(0x1687d28e), X(0x16941d47), X(0x16a06abe), X(0x16acbaf0),\r\n  X(0x16b90ddf), X(0x16c56388), X(0x16d1bbeb), X(0x16de1708),\r\n  X(0x16ea74dd), X(0x16f6d56a), X(0x170338ae), X(0x170f9ea8),\r\n  X(0x171c0758), X(0x172872bd), X(0x1734e0d6), X(0x174151a2),\r\n  X(0x174dc520), X(0x175a3b51), X(0x1766b432), X(0x17732fc4),\r\n  X(0x177fae05), X(0x178c2ef4), X(0x1798b292), X(0x17a538dd),\r\n  X(0x17b1c1d4), X(0x17be4d77), X(0x17cadbc5), X(0x17d76cbc),\r\n  X(0x17e4005e), X(0x17f096a7), X(0x17fd2f98), X(0x1809cb31),\r\n  X(0x1816696f), X(0x18230a53), X(0x182faddc), X(0x183c5408),\r\n  X(0x1848fcd8), X(0x1855a849), X(0x1862565d), X(0x186f0711),\r\n  X(0x187bba64), X(0x18887057), X(0x189528e9), X(0x18a1e418),\r\n  X(0x18aea1e3), X(0x18bb624b), X(0x18c8254e), X(0x18d4eaeb),\r\n  X(0x18e1b321), X(0x18ee7df1), X(0x18fb4b58), X(0x19081b57),\r\n  X(0x1914edec), X(0x1921c317), X(0x192e9ad6), X(0x193b7529),\r\n  X(0x19485210), X(0x19553189), X(0x19621393), X(0x196ef82e),\r\n  X(0x197bdf59), X(0x1988c913), X(0x1995b55c), X(0x19a2a432),\r\n  X(0x19af9595), X(0x19bc8983), X(0x19c97ffd), X(0x19d67900),\r\n  X(0x19e3748e), X(0x19f072a3), X(0x19fd7341), X(0x1a0a7665),\r\n  X(0x1a177c10), X(0x1a248440), X(0x1a318ef4), X(0x1a3e9c2c),\r\n  X(0x1a4babe7), X(0x1a58be24), X(0x1a65d2e2), X(0x1a72ea20),\r\n  X(0x1a8003de), X(0x1a8d201a), X(0x1a9a3ed5), X(0x1aa7600c),\r\n  X(0x1ab483bf), X(0x1ac1a9ee), X(0x1aced297), X(0x1adbfdba),\r\n  X(0x1ae92b56), X(0x1af65b69), X(0x1b038df4), X(0x1b10c2f5),\r\n  X(0x1b1dfa6b), X(0x1b2b3456), X(0x1b3870b5), X(0x1b45af87),\r\n  X(0x1b52f0ca), X(0x1b60347f), X(0x1b6d7aa4), X(0x1b7ac339),\r\n  X(0x1b880e3c), X(0x1b955bad), X(0x1ba2ab8b), X(0x1baffdd5),\r\n  X(0x1bbd528a), X(0x1bcaa9a9), X(0x1bd80332), X(0x1be55f24),\r\n  X(0x1bf2bd7d), X(0x1c001e3d), X(0x1c0d8164), X(0x1c1ae6ef),\r\n  X(0x1c284edf), X(0x1c35b932), X(0x1c4325e7), X(0x1c5094fe),\r\n  X(0x1c5e0677), X(0x1c6b7a4f), X(0x1c78f086), X(0x1c86691b),\r\n  X(0x1c93e40d), X(0x1ca1615c), X(0x1caee107), X(0x1cbc630c),\r\n  X(0x1cc9e76b), X(0x1cd76e23), X(0x1ce4f733), X(0x1cf2829a),\r\n  X(0x1d001057), X(0x1d0da06a), X(0x1d1b32d1), X(0x1d28c78c),\r\n  X(0x1d365e9a), X(0x1d43f7f9), X(0x1d5193a9), X(0x1d5f31aa),\r\n  X(0x1d6cd1f9), X(0x1d7a7497), X(0x1d881982), X(0x1d95c0ba),\r\n  X(0x1da36a3d), X(0x1db1160a), X(0x1dbec422), X(0x1dcc7482),\r\n  X(0x1dda272b), X(0x1de7dc1a), X(0x1df59350), X(0x1e034ccb),\r\n  X(0x1e11088a), X(0x1e1ec68c), X(0x1e2c86d1), X(0x1e3a4958),\r\n  X(0x1e480e20), X(0x1e55d527), X(0x1e639e6d), X(0x1e7169f1),\r\n  X(0x1e7f37b2), X(0x1e8d07b0), X(0x1e9ad9e8), X(0x1ea8ae5b),\r\n  X(0x1eb68507), X(0x1ec45dec), X(0x1ed23908), X(0x1ee0165b),\r\n  X(0x1eedf5e4), X(0x1efbd7a1), X(0x1f09bb92), X(0x1f17a1b6),\r\n  X(0x1f258a0d), X(0x1f337494), X(0x1f41614b), X(0x1f4f5032),\r\n  X(0x1f5d4147), X(0x1f6b3489), X(0x1f7929f7), X(0x1f872192),\r\n  X(0x1f951b56), X(0x1fa31744), X(0x1fb1155b), X(0x1fbf159a),\r\n  X(0x1fcd17ff), X(0x1fdb1c8b), X(0x1fe9233b), X(0x1ff72c0f),\r\n  X(0x20053706), X(0x20134420), X(0x2021535a), X(0x202f64b4),\r\n  X(0x203d782e), X(0x204b8dc6), X(0x2059a57c), X(0x2067bf4e),\r\n  X(0x2075db3b), X(0x2083f943), X(0x20921964), X(0x20a03b9e),\r\n  X(0x20ae5fef), X(0x20bc8657), X(0x20caaed5), X(0x20d8d967),\r\n  X(0x20e7060e), X(0x20f534c7), X(0x21036592), X(0x2111986e),\r\n  X(0x211fcd59), X(0x212e0454), X(0x213c3d5d), X(0x214a7873),\r\n  X(0x2158b594), X(0x2166f4c1), X(0x217535f8), X(0x21837938),\r\n  X(0x2191be81), X(0x21a005d0), X(0x21ae4f26), X(0x21bc9a81),\r\n  X(0x21cae7e0), X(0x21d93743), X(0x21e788a8), X(0x21f5dc0e),\r\n  X(0x22043174), X(0x221288da), X(0x2220e23e), X(0x222f3da0),\r\n  X(0x223d9afe), X(0x224bfa58), X(0x225a5bac), X(0x2268bef9),\r\n  X(0x2277243f), X(0x22858b7d), X(0x2293f4b0), X(0x22a25fda),\r\n  X(0x22b0ccf8), X(0x22bf3c09), X(0x22cdad0d), X(0x22dc2002),\r\n  X(0x22ea94e8), X(0x22f90bbe), X(0x23078482), X(0x2315ff33),\r\n  X(0x23247bd1), X(0x2332fa5b), X(0x23417acf), X(0x234ffd2c),\r\n  X(0x235e8173), X(0x236d07a0), X(0x237b8fb4), X(0x238a19ae),\r\n  X(0x2398a58c), X(0x23a7334d), X(0x23b5c2f1), X(0x23c45477),\r\n  X(0x23d2e7dd), X(0x23e17d22), X(0x23f01446), X(0x23fead47),\r\n  X(0x240d4825), X(0x241be4dd), X(0x242a8371), X(0x243923dd),\r\n  X(0x2447c622), X(0x24566a3e), X(0x24651031), X(0x2473b7f8),\r\n  X(0x24826194), X(0x24910d03), X(0x249fba44), X(0x24ae6957),\r\n  X(0x24bd1a39), X(0x24cbccea), X(0x24da816a), X(0x24e937b7),\r\n  X(0x24f7efcf), X(0x2506a9b3), X(0x25156560), X(0x252422d6),\r\n  X(0x2532e215), X(0x2541a31a), X(0x255065e4), X(0x255f2a74),\r\n  X(0x256df0c7), X(0x257cb8dd), X(0x258b82b4), X(0x259a4e4c),\r\n  X(0x25a91ba4), X(0x25b7eaba), X(0x25c6bb8e), X(0x25d58e1e),\r\n  X(0x25e46269), X(0x25f3386e), X(0x2602102d), X(0x2610e9a4),\r\n  X(0x261fc4d3), X(0x262ea1b7), X(0x263d8050), X(0x264c609e),\r\n  X(0x265b429e), X(0x266a2650), X(0x26790bb3), X(0x2687f2c6),\r\n  X(0x2696db88), X(0x26a5c5f7), X(0x26b4b213), X(0x26c39fda),\r\n  X(0x26d28f4c), X(0x26e18067), X(0x26f0732b), X(0x26ff6796),\r\n  X(0x270e5da7), X(0x271d555d), X(0x272c4eb7), X(0x273b49b5),\r\n  X(0x274a4654), X(0x27594495), X(0x27684475), X(0x277745f4),\r\n  X(0x27864910), X(0x27954dc9), X(0x27a4541e), X(0x27b35c0d),\r\n  X(0x27c26596), X(0x27d170b7), X(0x27e07d6f), X(0x27ef8bbd),\r\n  X(0x27fe9ba0), X(0x280dad18), X(0x281cc022), X(0x282bd4be),\r\n  X(0x283aeaeb), X(0x284a02a7), X(0x28591bf2), X(0x286836cb),\r\n  X(0x28775330), X(0x28867120), X(0x2895909b), X(0x28a4b19e),\r\n  X(0x28b3d42a), X(0x28c2f83d), X(0x28d21dd5), X(0x28e144f3),\r\n  X(0x28f06d94), X(0x28ff97b8), X(0x290ec35d), X(0x291df082),\r\n  X(0x292d1f27), X(0x293c4f4a), X(0x294b80eb), X(0x295ab407),\r\n  X(0x2969e89e), X(0x29791eaf), X(0x29885639), X(0x29978f3b),\r\n  X(0x29a6c9b3), X(0x29b605a0), X(0x29c54302), X(0x29d481d7),\r\n  X(0x29e3c21e), X(0x29f303d6), X(0x2a0246fd), X(0x2a118b94),\r\n  X(0x2a20d198), X(0x2a301909), X(0x2a3f61e6), X(0x2a4eac2c),\r\n  X(0x2a5df7dc), X(0x2a6d44f4), X(0x2a7c9374), X(0x2a8be359),\r\n  X(0x2a9b34a2), X(0x2aaa8750), X(0x2ab9db60), X(0x2ac930d1),\r\n  X(0x2ad887a3), X(0x2ae7dfd3), X(0x2af73962), X(0x2b06944e),\r\n  X(0x2b15f096), X(0x2b254e38), X(0x2b34ad34), X(0x2b440d89),\r\n  X(0x2b536f34), X(0x2b62d236), X(0x2b72368d), X(0x2b819c38),\r\n  X(0x2b910336), X(0x2ba06b86), X(0x2bafd526), X(0x2bbf4015),\r\n  X(0x2bceac53), X(0x2bde19de), X(0x2bed88b5), X(0x2bfcf8d7),\r\n  X(0x2c0c6a43), X(0x2c1bdcf7), X(0x2c2b50f3), X(0x2c3ac635),\r\n  X(0x2c4a3cbd), X(0x2c59b488), X(0x2c692d97), X(0x2c78a7e7),\r\n  X(0x2c882378), X(0x2c97a049), X(0x2ca71e58), X(0x2cb69da4),\r\n  X(0x2cc61e2c), X(0x2cd59ff0), X(0x2ce522ed), X(0x2cf4a723),\r\n  X(0x2d042c90), X(0x2d13b334), X(0x2d233b0d), X(0x2d32c41a),\r\n  X(0x2d424e5a), X(0x2d51d9cc), X(0x2d61666e), X(0x2d70f440),\r\n  X(0x2d808340), X(0x2d90136e), X(0x2d9fa4c7), X(0x2daf374c),\r\n  X(0x2dbecafa), X(0x2dce5fd1), X(0x2dddf5cf), X(0x2ded8cf4),\r\n  X(0x2dfd253d), X(0x2e0cbeab), X(0x2e1c593b), X(0x2e2bf4ed),\r\n  X(0x2e3b91c0), X(0x2e4b2fb1), X(0x2e5acec1), X(0x2e6a6eee),\r\n  X(0x2e7a1037), X(0x2e89b29b), X(0x2e995618), X(0x2ea8faad),\r\n  X(0x2eb8a05a), X(0x2ec8471c), X(0x2ed7eef4), X(0x2ee797df),\r\n  X(0x2ef741dc), X(0x2f06eceb), X(0x2f16990a), X(0x2f264639),\r\n  X(0x2f35f475), X(0x2f45a3bd), X(0x2f555412), X(0x2f650570),\r\n  X(0x2f74b7d8), X(0x2f846b48), X(0x2f941fbe), X(0x2fa3d53a),\r\n  X(0x2fb38bbb), X(0x2fc3433f), X(0x2fd2fbc5), X(0x2fe2b54c),\r\n  X(0x2ff26fd3), X(0x30022b58), X(0x3011e7db), X(0x3021a55a),\r\n  X(0x303163d4), X(0x30412348), X(0x3050e3b5), X(0x3060a519),\r\n  X(0x30706773), X(0x30802ac3), X(0x308fef06), X(0x309fb43d),\r\n  X(0x30af7a65), X(0x30bf417d), X(0x30cf0985), X(0x30ded27a),\r\n  X(0x30ee9c5d), X(0x30fe672b), X(0x310e32e3), X(0x311dff85),\r\n  X(0x312dcd0f), X(0x313d9b80), X(0x314d6ad7), X(0x315d3b12),\r\n  X(0x316d0c30), X(0x317cde31), X(0x318cb113), X(0x319c84d4),\r\n  X(0x31ac5974), X(0x31bc2ef1), X(0x31cc054b), X(0x31dbdc7f),\r\n  X(0x31ebb48e), X(0x31fb8d74), X(0x320b6733), X(0x321b41c7),\r\n  X(0x322b1d31), X(0x323af96e), X(0x324ad67e), X(0x325ab45f),\r\n  X(0x326a9311), X(0x327a7291), X(0x328a52e0), X(0x329a33fb),\r\n  X(0x32aa15e1), X(0x32b9f892), X(0x32c9dc0c), X(0x32d9c04d),\r\n  X(0x32e9a555), X(0x32f98b22), X(0x330971b4), X(0x33195909),\r\n  X(0x3329411f), X(0x333929f6), X(0x3349138c), X(0x3358fde1),\r\n  X(0x3368e8f2), X(0x3378d4c0), X(0x3388c147), X(0x3398ae89),\r\n  X(0x33a89c82), X(0x33b88b32), X(0x33c87a98), X(0x33d86ab2),\r\n  X(0x33e85b80), X(0x33f84d00), X(0x34083f30), X(0x34183210),\r\n  X(0x3428259f), X(0x343819db), X(0x34480ec3), X(0x34580455),\r\n  X(0x3467fa92), X(0x3477f176), X(0x3487e902), X(0x3497e134),\r\n  X(0x34a7da0a), X(0x34b7d384), X(0x34c7cda0), X(0x34d7c85e),\r\n  X(0x34e7c3bb), X(0x34f7bfb7), X(0x3507bc50), X(0x3517b985),\r\n  X(0x3527b756), X(0x3537b5c0), X(0x3547b4c3), X(0x3557b45d),\r\n  X(0x3567b48d), X(0x3577b552), X(0x3587b6aa), X(0x3597b895),\r\n  X(0x35a7bb12), X(0x35b7be1e), X(0x35c7c1b9), X(0x35d7c5e1),\r\n  X(0x35e7ca96), X(0x35f7cfd6), X(0x3607d5a0), X(0x3617dbf3),\r\n  X(0x3627e2cd), X(0x3637ea2d), X(0x3647f212), X(0x3657fa7b),\r\n  X(0x36680366), X(0x36780cd2), X(0x368816bf), X(0x3698212b),\r\n  X(0x36a82c14), X(0x36b83779), X(0x36c8435a), X(0x36d84fb4),\r\n  X(0x36e85c88), X(0x36f869d2), X(0x37087793), X(0x371885c9),\r\n  X(0x37289473), X(0x3738a38f), X(0x3748b31d), X(0x3758c31a),\r\n  X(0x3768d387), X(0x3778e461), X(0x3788f5a7), X(0x37990759),\r\n  X(0x37a91975), X(0x37b92bf9), X(0x37c93ee4), X(0x37d95236),\r\n  X(0x37e965ed), X(0x37f97a08), X(0x38098e85), X(0x3819a363),\r\n  X(0x3829b8a2), X(0x3839ce3f), X(0x3849e43a), X(0x3859fa91),\r\n  X(0x386a1143), X(0x387a284f), X(0x388a3fb4), X(0x389a5770),\r\n  X(0x38aa6f83), X(0x38ba87ea), X(0x38caa0a5), X(0x38dab9b2),\r\n  X(0x38ead311), X(0x38faecbf), X(0x390b06bc), X(0x391b2107),\r\n  X(0x392b3b9e), X(0x393b5680), X(0x394b71ac), X(0x395b8d20),\r\n  X(0x396ba8dc), X(0x397bc4dd), X(0x398be124), X(0x399bfdae),\r\n  X(0x39ac1a7a), X(0x39bc3788), X(0x39cc54d5), X(0x39dc7261),\r\n  X(0x39ec902a), X(0x39fcae2f), X(0x3a0ccc70), X(0x3a1ceaea),\r\n  X(0x3a2d099c), X(0x3a3d2885), X(0x3a4d47a5), X(0x3a5d66f9),\r\n  X(0x3a6d8680), X(0x3a7da63a), X(0x3a8dc625), X(0x3a9de63f),\r\n  X(0x3aae0688), X(0x3abe26fe), X(0x3ace47a0), X(0x3ade686d),\r\n  X(0x3aee8963), X(0x3afeaa82), X(0x3b0ecbc7), X(0x3b1eed32),\r\n  X(0x3b2f0ec2), X(0x3b3f3075), X(0x3b4f524a), X(0x3b5f7440),\r\n  X(0x3b6f9656), X(0x3b7fb889), X(0x3b8fdada), X(0x3b9ffd46),\r\n  X(0x3bb01fce), X(0x3bc0426e), X(0x3bd06526), X(0x3be087f6),\r\n  X(0x3bf0aada), X(0x3c00cdd4), X(0x3c10f0e0), X(0x3c2113fe),\r\n  X(0x3c31372d), X(0x3c415a6b), X(0x3c517db7), X(0x3c61a110),\r\n  X(0x3c71c475), X(0x3c81e7e4), X(0x3c920b5c), X(0x3ca22edc),\r\n  X(0x3cb25262), X(0x3cc275ee), X(0x3cd2997e), X(0x3ce2bd11),\r\n  X(0x3cf2e0a6), X(0x3d03043b), X(0x3d1327cf), X(0x3d234b61),\r\n  X(0x3d336ef0), X(0x3d43927a), X(0x3d53b5ff), X(0x3d63d97c),\r\n  X(0x3d73fcf1), X(0x3d84205c), X(0x3d9443bd), X(0x3da46711),\r\n  X(0x3db48a58), X(0x3dc4ad91), X(0x3dd4d0ba), X(0x3de4f3d1),\r\n  X(0x3df516d7), X(0x3e0539c9), X(0x3e155ca6), X(0x3e257f6d),\r\n  X(0x3e35a21d), X(0x3e45c4b4), X(0x3e55e731), X(0x3e660994),\r\n  X(0x3e762bda), X(0x3e864e03), X(0x3e96700d), X(0x3ea691f7),\r\n  X(0x3eb6b3bf), X(0x3ec6d565), X(0x3ed6f6e8), X(0x3ee71845),\r\n  X(0x3ef7397c), X(0x3f075a8c), X(0x3f177b73), X(0x3f279c30),\r\n  X(0x3f37bcc2), X(0x3f47dd27), X(0x3f57fd5f), X(0x3f681d68),\r\n  X(0x3f783d40), X(0x3f885ce7), X(0x3f987c5c), X(0x3fa89b9c),\r\n  X(0x3fb8baa7), X(0x3fc8d97c), X(0x3fd8f819), X(0x3fe9167e),\r\n  X(0x3ff934a8), X(0x40095296), X(0x40197049), X(0x40298dbd),\r\n  X(0x4039aaf2), X(0x4049c7e7), X(0x4059e49a), X(0x406a010a),\r\n  X(0x407a1d36), X(0x408a391d), X(0x409a54bd), X(0x40aa7015),\r\n  X(0x40ba8b25), X(0x40caa5ea), X(0x40dac063), X(0x40eada90),\r\n  X(0x40faf46e), X(0x410b0dfe), X(0x411b273d), X(0x412b402a),\r\n  X(0x413b58c4), X(0x414b710a), X(0x415b88fa), X(0x416ba093),\r\n  X(0x417bb7d5), X(0x418bcebe), X(0x419be54c), X(0x41abfb7e),\r\n  X(0x41bc1153), X(0x41cc26ca), X(0x41dc3be2), X(0x41ec5099),\r\n  X(0x41fc64ef), X(0x420c78e1), X(0x421c8c6f), X(0x422c9f97),\r\n  X(0x423cb258), X(0x424cc4b2), X(0x425cd6a2), X(0x426ce827),\r\n  X(0x427cf941), X(0x428d09ee), X(0x429d1a2c), X(0x42ad29fb),\r\n  X(0x42bd3959), X(0x42cd4846), X(0x42dd56bf), X(0x42ed64c3),\r\n  X(0x42fd7252), X(0x430d7f6a), X(0x431d8c0a), X(0x432d9831),\r\n  X(0x433da3dd), X(0x434daf0d), X(0x435db9c0), X(0x436dc3f5),\r\n  X(0x437dcdab), X(0x438dd6df), X(0x439ddf92), X(0x43ade7c1),\r\n  X(0x43bdef6c), X(0x43cdf691), X(0x43ddfd2f), X(0x43ee0345),\r\n  X(0x43fe08d2), X(0x440e0dd4), X(0x441e124b), X(0x442e1634),\r\n  X(0x443e198f), X(0x444e1c5a), X(0x445e1e95), X(0x446e203e),\r\n  X(0x447e2153), X(0x448e21d5), X(0x449e21c0), X(0x44ae2115),\r\n  X(0x44be1fd1), X(0x44ce1df4), X(0x44de1b7d), X(0x44ee186a),\r\n  X(0x44fe14ba), X(0x450e106b), X(0x451e0b7e), X(0x452e05ef),\r\n  X(0x453dffbf), X(0x454df8eb), X(0x455df173), X(0x456de956),\r\n  X(0x457de092), X(0x458dd726), X(0x459dcd10), X(0x45adc251),\r\n  X(0x45bdb6e5), X(0x45cdaacd), X(0x45dd9e06), X(0x45ed9091),\r\n  X(0x45fd826a), X(0x460d7392), X(0x461d6407), X(0x462d53c8),\r\n  X(0x463d42d4), X(0x464d3129), X(0x465d1ec6), X(0x466d0baa),\r\n  X(0x467cf7d3), X(0x468ce342), X(0x469ccdf3), X(0x46acb7e7),\r\n  X(0x46bca11c), X(0x46cc8990), X(0x46dc7143), X(0x46ec5833),\r\n  X(0x46fc3e5f), X(0x470c23c6), X(0x471c0867), X(0x472bec40),\r\n  X(0x473bcf50), X(0x474bb196), X(0x475b9311), X(0x476b73c0),\r\n  X(0x477b53a1), X(0x478b32b4), X(0x479b10f6), X(0x47aaee67),\r\n  X(0x47bacb06), X(0x47caa6d1), X(0x47da81c7), X(0x47ea5be7),\r\n  X(0x47fa3530), X(0x480a0da1), X(0x4819e537), X(0x4829bbf3),\r\n  X(0x483991d3), X(0x484966d6), X(0x48593afb), X(0x48690e3f),\r\n  X(0x4878e0a3), X(0x4888b225), X(0x489882c4), X(0x48a8527e),\r\n  X(0x48b82153), X(0x48c7ef41), X(0x48d7bc47), X(0x48e78863),\r\n  X(0x48f75396), X(0x49071ddc), X(0x4916e736), X(0x4926afa2),\r\n  X(0x4936771f), X(0x49463dac), X(0x49560347), X(0x4965c7ef),\r\n  X(0x49758ba4), X(0x49854e63), X(0x4995102c), X(0x49a4d0fe),\r\n  X(0x49b490d7), X(0x49c44fb6), X(0x49d40d9a), X(0x49e3ca82),\r\n  X(0x49f3866c), X(0x4a034159), X(0x4a12fb45), X(0x4a22b430),\r\n  X(0x4a326c19), X(0x4a4222ff), X(0x4a51d8e1), X(0x4a618dbd),\r\n  X(0x4a714192), X(0x4a80f45f), X(0x4a90a623), X(0x4aa056dd),\r\n  X(0x4ab0068b), X(0x4abfb52c), X(0x4acf62c0), X(0x4adf0f44),\r\n  X(0x4aeebab9), X(0x4afe651c), X(0x4b0e0e6c), X(0x4b1db6a9),\r\n  X(0x4b2d5dd1), X(0x4b3d03e2), X(0x4b4ca8dd), X(0x4b5c4cbf),\r\n  X(0x4b6bef88), X(0x4b7b9136), X(0x4b8b31c8), X(0x4b9ad13d),\r\n  X(0x4baa6f93), X(0x4bba0ccb), X(0x4bc9a8e2), X(0x4bd943d7),\r\n  X(0x4be8dda9), X(0x4bf87658), X(0x4c080de1), X(0x4c17a444),\r\n  X(0x4c27397f), X(0x4c36cd92), X(0x4c46607b), X(0x4c55f239),\r\n  X(0x4c6582cb), X(0x4c75122f), X(0x4c84a065), X(0x4c942d6c),\r\n  X(0x4ca3b942), X(0x4cb343e6), X(0x4cc2cd57), X(0x4cd25594),\r\n  X(0x4ce1dc9c), X(0x4cf1626d), X(0x4d00e707), X(0x4d106a68),\r\n  X(0x4d1fec8f), X(0x4d2f6d7a), X(0x4d3eed2a), X(0x4d4e6b9d),\r\n  X(0x4d5de8d1), X(0x4d6d64c5), X(0x4d7cdf79), X(0x4d8c58eb),\r\n  X(0x4d9bd11a), X(0x4dab4804), X(0x4dbabdaa), X(0x4dca3209),\r\n  X(0x4dd9a520), X(0x4de916ef), X(0x4df88774), X(0x4e07f6ae),\r\n  X(0x4e17649c), X(0x4e26d13c), X(0x4e363c8f), X(0x4e45a692),\r\n  X(0x4e550f44), X(0x4e6476a4), X(0x4e73dcb2), X(0x4e83416c),\r\n  X(0x4e92a4d1), X(0x4ea206df), X(0x4eb16796), X(0x4ec0c6f5),\r\n  X(0x4ed024fa), X(0x4edf81a5), X(0x4eeedcf3), X(0x4efe36e5),\r\n  X(0x4f0d8f79), X(0x4f1ce6ad), X(0x4f2c3c82), X(0x4f3b90f4),\r\n  X(0x4f4ae405), X(0x4f5a35b1), X(0x4f6985fa), X(0x4f78d4dc),\r\n  X(0x4f882257), X(0x4f976e6a), X(0x4fa6b914), X(0x4fb60254),\r\n  X(0x4fc54a28), X(0x4fd49090), X(0x4fe3d58b), X(0x4ff31917),\r\n  X(0x50025b33), X(0x50119bde), X(0x5020db17), X(0x503018dd),\r\n  X(0x503f552f), X(0x504e900b), X(0x505dc971), X(0x506d0160),\r\n  X(0x507c37d7), X(0x508b6cd3), X(0x509aa055), X(0x50a9d25b),\r\n  X(0x50b902e4), X(0x50c831ef), X(0x50d75f7b), X(0x50e68b87),\r\n  X(0x50f5b612), X(0x5104df1a), X(0x5114069f), X(0x51232ca0),\r\n  X(0x5132511a), X(0x5141740f), X(0x5150957b), X(0x515fb55f),\r\n  X(0x516ed3b8), X(0x517df087), X(0x518d0bca), X(0x519c257f),\r\n  X(0x51ab3da7), X(0x51ba543f), X(0x51c96947), X(0x51d87cbd),\r\n  X(0x51e78ea1), X(0x51f69ef1), X(0x5205adad), X(0x5214bad3),\r\n  X(0x5223c662), X(0x5232d05a), X(0x5241d8b9), X(0x5250df7d),\r\n  X(0x525fe4a7), X(0x526ee835), X(0x527dea26), X(0x528cea78),\r\n  X(0x529be92c), X(0x52aae63f), X(0x52b9e1b0), X(0x52c8db80),\r\n  X(0x52d7d3ac), X(0x52e6ca33), X(0x52f5bf15), X(0x5304b251),\r\n  X(0x5313a3e5), X(0x532293d0), X(0x53318212), X(0x53406ea8),\r\n  X(0x534f5993), X(0x535e42d2), X(0x536d2a62), X(0x537c1043),\r\n  X(0x538af475), X(0x5399d6f6), X(0x53a8b7c4), X(0x53b796e0),\r\n  X(0x53c67447), X(0x53d54ffa), X(0x53e429f6), X(0x53f3023b),\r\n  X(0x5401d8c8), X(0x5410ad9c), X(0x541f80b5), X(0x542e5213),\r\n  X(0x543d21b5), X(0x544bef9a), X(0x545abbc0), X(0x54698627),\r\n  X(0x54784ece), X(0x548715b3), X(0x5495dad6), X(0x54a49e35),\r\n  X(0x54b35fd0), X(0x54c21fa6), X(0x54d0ddb5), X(0x54df99fd),\r\n  X(0x54ee547c), X(0x54fd0d32), X(0x550bc41d), X(0x551a793d),\r\n  X(0x55292c91), X(0x5537de16), X(0x55468dce), X(0x55553bb6),\r\n  X(0x5563e7cd), X(0x55729213), X(0x55813a87), X(0x558fe127),\r\n  X(0x559e85f2), X(0x55ad28e9), X(0x55bbca08), X(0x55ca6950),\r\n  X(0x55d906c0), X(0x55e7a257), X(0x55f63c13), X(0x5604d3f4),\r\n  X(0x561369f8), X(0x5621fe1f), X(0x56309067), X(0x563f20d1),\r\n  X(0x564daf5a), X(0x565c3c02), X(0x566ac6c7), X(0x56794faa),\r\n  X(0x5687d6a8), X(0x56965bc1), X(0x56a4def4), X(0x56b36040),\r\n  X(0x56c1dfa4), X(0x56d05d1f), X(0x56ded8af), X(0x56ed5255),\r\n  X(0x56fbca0f), X(0x570a3fdc), X(0x5718b3bc), X(0x572725ac),\r\n  X(0x573595ad), X(0x574403bd), X(0x57526fdb), X(0x5760da07),\r\n  X(0x576f423f), X(0x577da883), X(0x578c0cd1), X(0x579a6f29),\r\n  X(0x57a8cf8a), X(0x57b72df2), X(0x57c58a61), X(0x57d3e4d6),\r\n  X(0x57e23d50), X(0x57f093cd), X(0x57fee84e), X(0x580d3ad1),\r\n  X(0x581b8b54), X(0x5829d9d8), X(0x5838265c), X(0x584670dd),\r\n  X(0x5854b95c), X(0x5862ffd8), X(0x5871444f), X(0x587f86c1),\r\n  X(0x588dc72c), X(0x589c0591), X(0x58aa41ed), X(0x58b87c40),\r\n  X(0x58c6b489), X(0x58d4eac7), X(0x58e31ef9), X(0x58f1511f),\r\n  X(0x58ff8137), X(0x590daf40), X(0x591bdb3a), X(0x592a0524),\r\n  X(0x59382cfc), X(0x594652c2), X(0x59547675), X(0x59629815),\r\n  X(0x5970b79f), X(0x597ed513), X(0x598cf071), X(0x599b09b7),\r\n  X(0x59a920e5), X(0x59b735f9), X(0x59c548f4), X(0x59d359d2),\r\n  X(0x59e16895), X(0x59ef753b), X(0x59fd7fc4), X(0x5a0b882d),\r\n  X(0x5a198e77), X(0x5a2792a0), X(0x5a3594a9), X(0x5a43948e),\r\n  X(0x5a519251), X(0x5a5f8df0), X(0x5a6d876a), X(0x5a7b7ebe),\r\n  X(0x5a8973ec), X(0x5a9766f2), X(0x5aa557d0), X(0x5ab34685),\r\n  X(0x5ac1330f), X(0x5acf1d6f), X(0x5add05a3), X(0x5aeaebaa),\r\n  X(0x5af8cf84), X(0x5b06b12f), X(0x5b1490ab), X(0x5b226df7),\r\n  X(0x5b304912), X(0x5b3e21fc), X(0x5b4bf8b2), X(0x5b59cd35),\r\n  X(0x5b679f84), X(0x5b756f9e), X(0x5b833d82), X(0x5b91092e),\r\n  X(0x5b9ed2a3), X(0x5bac99e0), X(0x5bba5ee3), X(0x5bc821ac),\r\n  X(0x5bd5e23a), X(0x5be3a08c), X(0x5bf15ca1), X(0x5bff1679),\r\n  X(0x5c0cce12), X(0x5c1a836c), X(0x5c283686), X(0x5c35e760),\r\n  X(0x5c4395f7), X(0x5c51424c), X(0x5c5eec5e), X(0x5c6c942b),\r\n  X(0x5c7a39b4), X(0x5c87dcf7), X(0x5c957df3), X(0x5ca31ca8),\r\n  X(0x5cb0b915), X(0x5cbe5338), X(0x5ccbeb12), X(0x5cd980a1),\r\n  X(0x5ce713e5), X(0x5cf4a4dd), X(0x5d023387), X(0x5d0fbfe4),\r\n  X(0x5d1d49f2), X(0x5d2ad1b1), X(0x5d38571f), X(0x5d45da3c),\r\n  X(0x5d535b08), X(0x5d60d981), X(0x5d6e55a7), X(0x5d7bcf78),\r\n  X(0x5d8946f5), X(0x5d96bc1c), X(0x5da42eec), X(0x5db19f65),\r\n  X(0x5dbf0d86), X(0x5dcc794e), X(0x5dd9e2bd), X(0x5de749d1),\r\n  X(0x5df4ae8a), X(0x5e0210e7), X(0x5e0f70e7), X(0x5e1cce8a),\r\n  X(0x5e2a29ce), X(0x5e3782b4), X(0x5e44d93a), X(0x5e522d5f),\r\n  X(0x5e5f7f23), X(0x5e6cce85), X(0x5e7a1b85), X(0x5e876620),\r\n  X(0x5e94ae58), X(0x5ea1f42a), X(0x5eaf3797), X(0x5ebc789d),\r\n  X(0x5ec9b73c), X(0x5ed6f372), X(0x5ee42d41), X(0x5ef164a5),\r\n  X(0x5efe999f), X(0x5f0bcc2f), X(0x5f18fc52), X(0x5f262a09),\r\n  X(0x5f335553), X(0x5f407e2f), X(0x5f4da49d), X(0x5f5ac89b),\r\n  X(0x5f67ea29), X(0x5f750946), X(0x5f8225f2), X(0x5f8f402b),\r\n  X(0x5f9c57f2), X(0x5fa96d44), X(0x5fb68023), X(0x5fc3908c),\r\n  X(0x5fd09e7f), X(0x5fdda9fc), X(0x5feab302), X(0x5ff7b990),\r\n  X(0x6004bda5), X(0x6011bf40), X(0x601ebe62), X(0x602bbb09),\r\n  X(0x6038b534), X(0x6045ace4), X(0x6052a216), X(0x605f94cb),\r\n  X(0x606c8502), X(0x607972b9), X(0x60865df2), X(0x609346aa),\r\n  X(0x60a02ce1), X(0x60ad1096), X(0x60b9f1c9), X(0x60c6d079),\r\n  X(0x60d3aca5), X(0x60e0864d), X(0x60ed5d70), X(0x60fa320d),\r\n  X(0x61070424), X(0x6113d3b4), X(0x6120a0bc), X(0x612d6b3c),\r\n  X(0x613a3332), X(0x6146f89f), X(0x6153bb82), X(0x61607bd9),\r\n  X(0x616d39a5), X(0x6179f4e5), X(0x6186ad98), X(0x619363bd),\r\n  X(0x61a01753), X(0x61acc85b), X(0x61b976d3), X(0x61c622bc),\r\n  X(0x61d2cc13), X(0x61df72d8), X(0x61ec170c), X(0x61f8b8ad),\r\n  X(0x620557ba), X(0x6211f434), X(0x621e8e18), X(0x622b2568),\r\n  X(0x6237ba21), X(0x62444c44), X(0x6250dbd0), X(0x625d68c4),\r\n  X(0x6269f320), X(0x62767ae2), X(0x6283000b), X(0x628f829a),\r\n  X(0x629c028e), X(0x62a87fe6), X(0x62b4faa2), X(0x62c172c2),\r\n  X(0x62cde844), X(0x62da5b29), X(0x62e6cb6e), X(0x62f33915),\r\n  X(0x62ffa41c), X(0x630c0c83), X(0x63187248), X(0x6324d56d),\r\n  X(0x633135ef), X(0x633d93ce), X(0x6349ef0b), X(0x635647a3),\r\n  X(0x63629d97), X(0x636ef0e6), X(0x637b418f), X(0x63878f92),\r\n  X(0x6393daef), X(0x63a023a4), X(0x63ac69b1), X(0x63b8ad15),\r\n  X(0x63c4edd1), X(0x63d12be3), X(0x63dd674b), X(0x63e9a008),\r\n  X(0x63f5d61a), X(0x64020980), X(0x640e3a39), X(0x641a6846),\r\n  X(0x642693a5), X(0x6432bc56), X(0x643ee258), X(0x644b05ab),\r\n  X(0x6457264e), X(0x64634441), X(0x646f5f83), X(0x647b7814),\r\n  X(0x64878df3), X(0x6493a120), X(0x649fb199), X(0x64abbf5f),\r\n  X(0x64b7ca71), X(0x64c3d2ce), X(0x64cfd877), X(0x64dbdb69),\r\n  X(0x64e7dba6), X(0x64f3d92b), X(0x64ffd3fa), X(0x650bcc11),\r\n  X(0x6517c16f), X(0x6523b415), X(0x652fa402), X(0x653b9134),\r\n  X(0x65477bad), X(0x6553636a), X(0x655f486d), X(0x656b2ab3),\r\n  X(0x65770a3d), X(0x6582e70a), X(0x658ec11a), X(0x659a986d),\r\n  X(0x65a66d00), X(0x65b23ed5), X(0x65be0deb), X(0x65c9da41),\r\n  X(0x65d5a3d7), X(0x65e16aac), X(0x65ed2ebf), X(0x65f8f011),\r\n  X(0x6604aea1), X(0x66106a6e), X(0x661c2377), X(0x6627d9be),\r\n  X(0x66338d40), X(0x663f3dfd), X(0x664aebf5), X(0x66569728),\r\n  X(0x66623f95), X(0x666de53b), X(0x6679881b), X(0x66852833),\r\n  X(0x6690c583), X(0x669c600b), X(0x66a7f7ca), X(0x66b38cc0),\r\n  X(0x66bf1eec), X(0x66caae4f), X(0x66d63ae6), X(0x66e1c4b3),\r\n  X(0x66ed4bb4), X(0x66f8cfea), X(0x67045153), X(0x670fcfef),\r\n  X(0x671b4bbe), X(0x6726c4bf), X(0x67323af3), X(0x673dae58),\r\n  X(0x67491eee), X(0x67548cb5), X(0x675ff7ab), X(0x676b5fd2),\r\n  X(0x6776c528), X(0x678227ad), X(0x678d8761), X(0x6798e443),\r\n  X(0x67a43e52), X(0x67af958f), X(0x67bae9f9), X(0x67c63b8f),\r\n  X(0x67d18a52), X(0x67dcd640), X(0x67e81f59), X(0x67f3659d),\r\n  X(0x67fea90c), X(0x6809e9a5), X(0x68152768), X(0x68206254),\r\n  X(0x682b9a68), X(0x6836cfa6), X(0x6842020b), X(0x684d3199),\r\n  X(0x68585e4d), X(0x68638829), X(0x686eaf2b), X(0x6879d354),\r\n  X(0x6884f4a2), X(0x68901316), X(0x689b2eb0), X(0x68a6476d),\r\n  X(0x68b15d50), X(0x68bc7056), X(0x68c78080), X(0x68d28dcd),\r\n  X(0x68dd983e), X(0x68e89fd0), X(0x68f3a486), X(0x68fea65d),\r\n  X(0x6909a555), X(0x6914a16f), X(0x691f9aa9), X(0x692a9104),\r\n  X(0x69358480), X(0x6940751b), X(0x694b62d5), X(0x69564daf),\r\n  X(0x696135a7), X(0x696c1abe), X(0x6976fcf3), X(0x6981dc46),\r\n  X(0x698cb8b6), X(0x69979243), X(0x69a268ed), X(0x69ad3cb4),\r\n  X(0x69b80d97), X(0x69c2db96), X(0x69cda6b0), X(0x69d86ee5),\r\n  X(0x69e33436), X(0x69edf6a1), X(0x69f8b626), X(0x6a0372c5),\r\n  X(0x6a0e2c7e), X(0x6a18e350), X(0x6a23973c), X(0x6a2e4840),\r\n  X(0x6a38f65d), X(0x6a43a191), X(0x6a4e49de), X(0x6a58ef42),\r\n  X(0x6a6391be), X(0x6a6e3151), X(0x6a78cdfa), X(0x6a8367ba),\r\n  X(0x6a8dfe90), X(0x6a98927c), X(0x6aa3237d), X(0x6aadb194),\r\n  X(0x6ab83cc0), X(0x6ac2c500), X(0x6acd4a55), X(0x6ad7ccbf),\r\n  X(0x6ae24c3c), X(0x6aecc8cd), X(0x6af74271), X(0x6b01b929),\r\n  X(0x6b0c2cf4), X(0x6b169dd1), X(0x6b210bc1), X(0x6b2b76c2),\r\n  X(0x6b35ded6), X(0x6b4043fc), X(0x6b4aa632), X(0x6b55057a),\r\n  X(0x6b5f61d3), X(0x6b69bb3d), X(0x6b7411b7), X(0x6b7e6541),\r\n  X(0x6b88b5db), X(0x6b930385), X(0x6b9d4e3f), X(0x6ba79607),\r\n  X(0x6bb1dadf), X(0x6bbc1cc6), X(0x6bc65bbb), X(0x6bd097bf),\r\n  X(0x6bdad0d0), X(0x6be506f0), X(0x6bef3a1d), X(0x6bf96a58),\r\n  X(0x6c0397a0), X(0x6c0dc1f5), X(0x6c17e957), X(0x6c220dc6),\r\n  X(0x6c2c2f41), X(0x6c364dc9), X(0x6c40695c), X(0x6c4a81fc),\r\n  X(0x6c5497a7), X(0x6c5eaa5d), X(0x6c68ba1f), X(0x6c72c6eb),\r\n  X(0x6c7cd0c3), X(0x6c86d7a6), X(0x6c90db92), X(0x6c9adc8a),\r\n  X(0x6ca4da8b), X(0x6caed596), X(0x6cb8cdab), X(0x6cc2c2ca),\r\n  X(0x6cccb4f2), X(0x6cd6a424), X(0x6ce0905e), X(0x6cea79a1),\r\n  X(0x6cf45fee), X(0x6cfe4342), X(0x6d0823a0), X(0x6d120105),\r\n  X(0x6d1bdb73), X(0x6d25b2e8), X(0x6d2f8765), X(0x6d3958ea),\r\n  X(0x6d432777), X(0x6d4cf30a), X(0x6d56bba5), X(0x6d608147),\r\n  X(0x6d6a43f0), X(0x6d7403a0), X(0x6d7dc056), X(0x6d877a13),\r\n  X(0x6d9130d6), X(0x6d9ae4a0), X(0x6da4956f), X(0x6dae4345),\r\n  X(0x6db7ee20), X(0x6dc19601), X(0x6dcb3ae7), X(0x6dd4dcd3),\r\n  X(0x6dde7bc4), X(0x6de817bb), X(0x6df1b0b6), X(0x6dfb46b7),\r\n  X(0x6e04d9bc), X(0x6e0e69c7), X(0x6e17f6d5), X(0x6e2180e9),\r\n  X(0x6e2b0801), X(0x6e348c1d), X(0x6e3e0d3d), X(0x6e478b62),\r\n  X(0x6e51068a), X(0x6e5a7eb7), X(0x6e63f3e7), X(0x6e6d661b),\r\n  X(0x6e76d552), X(0x6e80418e), X(0x6e89aacc), X(0x6e93110f),\r\n  X(0x6e9c7454), X(0x6ea5d49d), X(0x6eaf31e9), X(0x6eb88c37),\r\n  X(0x6ec1e389), X(0x6ecb37de), X(0x6ed48936), X(0x6eddd790),\r\n  X(0x6ee722ee), X(0x6ef06b4d), X(0x6ef9b0b0), X(0x6f02f315),\r\n  X(0x6f0c327c), X(0x6f156ee6), X(0x6f1ea852), X(0x6f27dec1),\r\n  X(0x6f311232), X(0x6f3a42a5), X(0x6f43701a), X(0x6f4c9a91),\r\n  X(0x6f55c20a), X(0x6f5ee686), X(0x6f680803), X(0x6f712682),\r\n  X(0x6f7a4203), X(0x6f835a86), X(0x6f8c700b), X(0x6f958291),\r\n  X(0x6f9e921a), X(0x6fa79ea4), X(0x6fb0a830), X(0x6fb9aebd),\r\n  X(0x6fc2b24c), X(0x6fcbb2dd), X(0x6fd4b06f), X(0x6fddab03),\r\n  X(0x6fe6a299), X(0x6fef9730), X(0x6ff888c9), X(0x70017763),\r\n  X(0x700a62ff), X(0x70134b9c), X(0x701c313b), X(0x702513dc),\r\n  X(0x702df37e), X(0x7036d021), X(0x703fa9c6), X(0x7048806d),\r\n  X(0x70515415), X(0x705a24bf), X(0x7062f26b), X(0x706bbd17),\r\n  X(0x707484c6), X(0x707d4976), X(0x70860b28), X(0x708ec9dc),\r\n  X(0x70978591), X(0x70a03e48), X(0x70a8f400), X(0x70b1a6bb),\r\n  X(0x70ba5677), X(0x70c30335), X(0x70cbacf5), X(0x70d453b6),\r\n  X(0x70dcf77a), X(0x70e59840), X(0x70ee3607), X(0x70f6d0d1),\r\n  X(0x70ff689d), X(0x7107fd6b), X(0x71108f3b), X(0x71191e0d),\r\n  X(0x7121a9e2), X(0x712a32b9), X(0x7132b892), X(0x713b3b6e),\r\n  X(0x7143bb4c), X(0x714c382d), X(0x7154b211), X(0x715d28f7),\r\n  X(0x71659ce0), X(0x716e0dcc), X(0x71767bbb), X(0x717ee6ac),\r\n  X(0x71874ea1), X(0x718fb399), X(0x71981594), X(0x71a07493),\r\n  X(0x71a8d094), X(0x71b1299a), X(0x71b97fa2), X(0x71c1d2af),\r\n  X(0x71ca22bf), X(0x71d26fd2), X(0x71dab9ea), X(0x71e30106),\r\n  X(0x71eb4526), X(0x71f3864a), X(0x71fbc472), X(0x7203ff9e),\r\n  X(0x720c37cf), X(0x72146d05), X(0x721c9f3f), X(0x7224ce7e),\r\n  X(0x722cfac2), X(0x7235240b), X(0x723d4a59), X(0x72456dad),\r\n  X(0x724d8e05), X(0x7255ab63), X(0x725dc5c7), X(0x7265dd31),\r\n  X(0x726df1a0), X(0x72760315), X(0x727e1191), X(0x72861d12),\r\n  X(0x728e259a), X(0x72962b28), X(0x729e2dbd), X(0x72a62d59),\r\n  X(0x72ae29fc), X(0x72b623a5), X(0x72be1a56), X(0x72c60e0e),\r\n  X(0x72cdfece), X(0x72d5ec95), X(0x72ddd764), X(0x72e5bf3b),\r\n  X(0x72eda41a), X(0x72f58601), X(0x72fd64f1), X(0x730540e9),\r\n  X(0x730d19e9), X(0x7314eff3), X(0x731cc305), X(0x73249321),\r\n  X(0x732c6046), X(0x73342a75), X(0x733bf1ad), X(0x7343b5ef),\r\n  X(0x734b773b), X(0x73533591), X(0x735af0f2), X(0x7362a95d),\r\n  X(0x736a5ed3), X(0x73721153), X(0x7379c0df), X(0x73816d76),\r\n  X(0x73891719), X(0x7390bdc7), X(0x73986181), X(0x73a00247),\r\n  X(0x73a7a01a), X(0x73af3af8), X(0x73b6d2e4), X(0x73be67dc),\r\n  X(0x73c5f9e1), X(0x73cd88f3), X(0x73d51513), X(0x73dc9e40),\r\n  X(0x73e4247c), X(0x73eba7c5), X(0x73f3281c), X(0x73faa582),\r\n  X(0x74021ff7), X(0x7409977b), X(0x74110c0d), X(0x74187daf),\r\n  X(0x741fec61), X(0x74275822), X(0x742ec0f3), X(0x743626d5),\r\n  X(0x743d89c7), X(0x7444e9c9), X(0x744c46dd), X(0x7453a101),\r\n  X(0x745af837), X(0x74624c7f), X(0x74699dd8), X(0x7470ec44),\r\n  X(0x747837c2), X(0x747f8052), X(0x7486c5f5), X(0x748e08ac),\r\n  X(0x74954875), X(0x749c8552), X(0x74a3bf43), X(0x74aaf648),\r\n  X(0x74b22a62), X(0x74b95b90), X(0x74c089d2), X(0x74c7b52a),\r\n  X(0x74cedd97), X(0x74d6031a), X(0x74dd25b2), X(0x74e44561),\r\n  X(0x74eb6226), X(0x74f27c02), X(0x74f992f5), X(0x7500a6ff),\r\n  X(0x7507b820), X(0x750ec659), X(0x7515d1aa), X(0x751cda14),\r\n  X(0x7523df96), X(0x752ae231), X(0x7531e1e5), X(0x7538deb2),\r\n  X(0x753fd89a), X(0x7546cf9b), X(0x754dc3b7), X(0x7554b4ed),\r\n  X(0x755ba33e), X(0x75628eaa), X(0x75697732), X(0x75705cd5),\r\n  X(0x75773f95), X(0x757e1f71), X(0x7584fc6a), X(0x758bd67f),\r\n  X(0x7592adb2), X(0x75998203), X(0x75a05371), X(0x75a721fe),\r\n  X(0x75adeda9), X(0x75b4b673), X(0x75bb7c5c), X(0x75c23f65),\r\n  X(0x75c8ff8d), X(0x75cfbcd6), X(0x75d6773f), X(0x75dd2ec8),\r\n  X(0x75e3e373), X(0x75ea953f), X(0x75f1442d), X(0x75f7f03d),\r\n  X(0x75fe996f), X(0x76053fc5), X(0x760be33d), X(0x761283d8),\r\n  X(0x76192197), X(0x761fbc7b), X(0x76265482), X(0x762ce9af),\r\n  X(0x76337c01), X(0x763a0b78), X(0x76409814), X(0x764721d7),\r\n  X(0x764da8c1), X(0x76542cd1), X(0x765aae08), X(0x76612c67),\r\n  X(0x7667a7ee), X(0x766e209d), X(0x76749675), X(0x767b0975),\r\n  X(0x7681799f), X(0x7687e6f3), X(0x768e5170), X(0x7694b918),\r\n  X(0x769b1deb), X(0x76a17fe9), X(0x76a7df13), X(0x76ae3b68),\r\n  X(0x76b494ea), X(0x76baeb98), X(0x76c13f74), X(0x76c7907c),\r\n  X(0x76cddeb3), X(0x76d42a18), X(0x76da72ab), X(0x76e0b86d),\r\n  X(0x76e6fb5e), X(0x76ed3b7f), X(0x76f378d0), X(0x76f9b352),\r\n  X(0x76ffeb05), X(0x77061fe8), X(0x770c51fe), X(0x77128145),\r\n  X(0x7718adbf), X(0x771ed76c), X(0x7724fe4c), X(0x772b225f),\r\n  X(0x773143a7), X(0x77376223), X(0x773d7dd3), X(0x774396ba),\r\n  X(0x7749acd5), X(0x774fc027), X(0x7755d0af), X(0x775bde6f),\r\n  X(0x7761e965), X(0x7767f193), X(0x776df6fa), X(0x7773f998),\r\n  X(0x7779f970), X(0x777ff681), X(0x7785f0cd), X(0x778be852),\r\n  X(0x7791dd12), X(0x7797cf0d), X(0x779dbe43), X(0x77a3aab6),\r\n  X(0x77a99465), X(0x77af7b50), X(0x77b55f79), X(0x77bb40e0),\r\n  X(0x77c11f85), X(0x77c6fb68), X(0x77ccd48a), X(0x77d2aaec),\r\n  X(0x77d87e8d), X(0x77de4f6f), X(0x77e41d92), X(0x77e9e8f5),\r\n  X(0x77efb19b), X(0x77f57782), X(0x77fb3aad), X(0x7800fb1a),\r\n  X(0x7806b8ca), X(0x780c73bf), X(0x78122bf7), X(0x7817e175),\r\n  X(0x781d9438), X(0x78234440), X(0x7828f18f), X(0x782e9c25),\r\n  X(0x78344401), X(0x7839e925), X(0x783f8b92), X(0x78452b46),\r\n  X(0x784ac844), X(0x7850628b), X(0x7855fa1c), X(0x785b8ef8),\r\n  X(0x7861211e), X(0x7866b090), X(0x786c3d4d), X(0x7871c757),\r\n  X(0x78774ead), X(0x787cd351), X(0x78825543), X(0x7887d483),\r\n  X(0x788d5111), X(0x7892caef), X(0x7898421c), X(0x789db69a),\r\n  X(0x78a32868), X(0x78a89787), X(0x78ae03f8), X(0x78b36dbb),\r\n  X(0x78b8d4d1), X(0x78be393a), X(0x78c39af6), X(0x78c8fa06),\r\n  X(0x78ce566c), X(0x78d3b026), X(0x78d90736), X(0x78de5b9c),\r\n  X(0x78e3ad58), X(0x78e8fc6c), X(0x78ee48d7), X(0x78f3929b),\r\n  X(0x78f8d9b7), X(0x78fe1e2c), X(0x79035ffb), X(0x79089f24),\r\n  X(0x790ddba8), X(0x79131587), X(0x79184cc2), X(0x791d8159),\r\n  X(0x7922b34d), X(0x7927e29e), X(0x792d0f4d), X(0x7932395a),\r\n  X(0x793760c6), X(0x793c8591), X(0x7941a7bd), X(0x7946c749),\r\n  X(0x794be435), X(0x7950fe84), X(0x79561634), X(0x795b2b47),\r\n  X(0x79603dbc), X(0x79654d96), X(0x796a5ad4), X(0x796f6576),\r\n  X(0x79746d7e), X(0x797972eb), X(0x797e75bf), X(0x798375f9),\r\n  X(0x7988739b), X(0x798d6ea5), X(0x79926717), X(0x79975cf2),\r\n  X(0x799c5037), X(0x79a140e6), X(0x79a62f00), X(0x79ab1a85),\r\n  X(0x79b00376), X(0x79b4e9d3), X(0x79b9cd9d), X(0x79beaed4),\r\n  X(0x79c38d79), X(0x79c8698d), X(0x79cd4310), X(0x79d21a03),\r\n  X(0x79d6ee66), X(0x79dbc03a), X(0x79e08f7f), X(0x79e55c36),\r\n  X(0x79ea265f), X(0x79eeedfc), X(0x79f3b30c), X(0x79f87590),\r\n  X(0x79fd3589), X(0x7a01f2f7), X(0x7a06addc), X(0x7a0b6636),\r\n  X(0x7a101c08), X(0x7a14cf52), X(0x7a198013), X(0x7a1e2e4d),\r\n  X(0x7a22da01), X(0x7a27832f), X(0x7a2c29d7), X(0x7a30cdfa),\r\n  X(0x7a356f99), X(0x7a3a0eb4), X(0x7a3eab4c), X(0x7a434561),\r\n  X(0x7a47dcf5), X(0x7a4c7207), X(0x7a510498), X(0x7a5594a9),\r\n  X(0x7a5a223a), X(0x7a5ead4d), X(0x7a6335e0), X(0x7a67bbf6),\r\n  X(0x7a6c3f8f), X(0x7a70c0ab), X(0x7a753f4b), X(0x7a79bb6f),\r\n  X(0x7a7e3519), X(0x7a82ac48), X(0x7a8720fe), X(0x7a8b933b),\r\n  X(0x7a9002ff), X(0x7a94704b), X(0x7a98db20), X(0x7a9d437e),\r\n  X(0x7aa1a967), X(0x7aa60cd9), X(0x7aaa6dd7), X(0x7aaecc61),\r\n  X(0x7ab32877), X(0x7ab7821b), X(0x7abbd94b), X(0x7ac02e0a),\r\n  X(0x7ac48058), X(0x7ac8d035), X(0x7acd1da3), X(0x7ad168a1),\r\n  X(0x7ad5b130), X(0x7ad9f751), X(0x7ade3b05), X(0x7ae27c4c),\r\n  X(0x7ae6bb27), X(0x7aeaf796), X(0x7aef319a), X(0x7af36934),\r\n  X(0x7af79e64), X(0x7afbd12c), X(0x7b00018a), X(0x7b042f81),\r\n  X(0x7b085b10), X(0x7b0c8439), X(0x7b10aafc), X(0x7b14cf5a),\r\n  X(0x7b18f153), X(0x7b1d10e8), X(0x7b212e1a), X(0x7b2548e9),\r\n  X(0x7b296155), X(0x7b2d7761), X(0x7b318b0b), X(0x7b359c55),\r\n  X(0x7b39ab3f), X(0x7b3db7cb), X(0x7b41c1f8), X(0x7b45c9c8),\r\n  X(0x7b49cf3b), X(0x7b4dd251), X(0x7b51d30b), X(0x7b55d16b),\r\n  X(0x7b59cd70), X(0x7b5dc71b), X(0x7b61be6d), X(0x7b65b366),\r\n  X(0x7b69a608), X(0x7b6d9653), X(0x7b718447), X(0x7b756fe5),\r\n  X(0x7b79592e), X(0x7b7d4022), X(0x7b8124c3), X(0x7b850710),\r\n  X(0x7b88e70a), X(0x7b8cc4b3), X(0x7b90a00a), X(0x7b947911),\r\n  X(0x7b984fc8), X(0x7b9c242f), X(0x7b9ff648), X(0x7ba3c612),\r\n  X(0x7ba79390), X(0x7bab5ec1), X(0x7baf27a5), X(0x7bb2ee3f),\r\n  X(0x7bb6b28e), X(0x7bba7493), X(0x7bbe344e), X(0x7bc1f1c1),\r\n  X(0x7bc5acec), X(0x7bc965cf), X(0x7bcd1c6c), X(0x7bd0d0c3),\r\n  X(0x7bd482d4), X(0x7bd832a1), X(0x7bdbe02a), X(0x7bdf8b70),\r\n  X(0x7be33473), X(0x7be6db34), X(0x7bea7fb4), X(0x7bee21f4),\r\n  X(0x7bf1c1f3), X(0x7bf55fb3), X(0x7bf8fb35), X(0x7bfc9479),\r\n  X(0x7c002b7f), X(0x7c03c04a), X(0x7c0752d8), X(0x7c0ae32b),\r\n  X(0x7c0e7144), X(0x7c11fd23), X(0x7c1586c9), X(0x7c190e36),\r\n  X(0x7c1c936c), X(0x7c20166b), X(0x7c239733), X(0x7c2715c6),\r\n  X(0x7c2a9224), X(0x7c2e0c4e), X(0x7c318444), X(0x7c34fa07),\r\n  X(0x7c386d98), X(0x7c3bdef8), X(0x7c3f4e26), X(0x7c42bb25),\r\n  X(0x7c4625f4), X(0x7c498e95), X(0x7c4cf507), X(0x7c50594c),\r\n  X(0x7c53bb65), X(0x7c571b51), X(0x7c5a7913), X(0x7c5dd4aa),\r\n  X(0x7c612e17), X(0x7c64855b), X(0x7c67da76), X(0x7c6b2d6a),\r\n  X(0x7c6e7e37), X(0x7c71ccdd), X(0x7c75195e), X(0x7c7863ba),\r\n  X(0x7c7babf1), X(0x7c7ef206), X(0x7c8235f7), X(0x7c8577c6),\r\n  X(0x7c88b774), X(0x7c8bf502), X(0x7c8f306f), X(0x7c9269bd),\r\n  X(0x7c95a0ec), X(0x7c98d5fe), X(0x7c9c08f2), X(0x7c9f39cb),\r\n  X(0x7ca26887), X(0x7ca59528), X(0x7ca8bfb0), X(0x7cabe81d),\r\n  X(0x7caf0e72), X(0x7cb232af), X(0x7cb554d4), X(0x7cb874e2),\r\n  X(0x7cbb92db), X(0x7cbeaebe), X(0x7cc1c88d), X(0x7cc4e047),\r\n  X(0x7cc7f5ef), X(0x7ccb0984), X(0x7cce1b08), X(0x7cd12a7b),\r\n  X(0x7cd437dd), X(0x7cd74330), X(0x7cda4c74), X(0x7cdd53aa),\r\n  X(0x7ce058d3), X(0x7ce35bef), X(0x7ce65cff), X(0x7ce95c04),\r\n  X(0x7cec58ff), X(0x7cef53f0), X(0x7cf24cd7), X(0x7cf543b7),\r\n  X(0x7cf8388f), X(0x7cfb2b60), X(0x7cfe1c2b), X(0x7d010af1),\r\n  X(0x7d03f7b2), X(0x7d06e26f), X(0x7d09cb29), X(0x7d0cb1e0),\r\n  X(0x7d0f9696), X(0x7d12794b), X(0x7d1559ff), X(0x7d1838b4),\r\n  X(0x7d1b156a), X(0x7d1df022), X(0x7d20c8dd), X(0x7d239f9b),\r\n  X(0x7d26745e), X(0x7d294725), X(0x7d2c17f1), X(0x7d2ee6c4),\r\n  X(0x7d31b39f), X(0x7d347e81), X(0x7d37476b), X(0x7d3a0e5f),\r\n  X(0x7d3cd35d), X(0x7d3f9665), X(0x7d425779), X(0x7d451699),\r\n  X(0x7d47d3c6), X(0x7d4a8f01), X(0x7d4d484b), X(0x7d4fffa3),\r\n  X(0x7d52b50c), X(0x7d556885), X(0x7d581a0f), X(0x7d5ac9ac),\r\n  X(0x7d5d775c), X(0x7d60231f), X(0x7d62ccf6), X(0x7d6574e3),\r\n  X(0x7d681ae6), X(0x7d6abeff), X(0x7d6d612f), X(0x7d700178),\r\n  X(0x7d729fd9), X(0x7d753c54), X(0x7d77d6e9), X(0x7d7a6f9a),\r\n  X(0x7d7d0666), X(0x7d7f9b4f), X(0x7d822e55), X(0x7d84bf79),\r\n  X(0x7d874ebc), X(0x7d89dc1e), X(0x7d8c67a1), X(0x7d8ef144),\r\n  X(0x7d91790a), X(0x7d93fef2), X(0x7d9682fd), X(0x7d99052d),\r\n  X(0x7d9b8581), X(0x7d9e03fb), X(0x7da0809b), X(0x7da2fb62),\r\n  X(0x7da57451), X(0x7da7eb68), X(0x7daa60a8), X(0x7dacd413),\r\n  X(0x7daf45a9), X(0x7db1b56a), X(0x7db42357), X(0x7db68f71),\r\n  X(0x7db8f9b9), X(0x7dbb6230), X(0x7dbdc8d6), X(0x7dc02dac),\r\n  X(0x7dc290b3), X(0x7dc4f1eb), X(0x7dc75156), X(0x7dc9aef4),\r\n  X(0x7dcc0ac5), X(0x7dce64cc), X(0x7dd0bd07), X(0x7dd31379),\r\n  X(0x7dd56821), X(0x7dd7bb01), X(0x7dda0c1a), X(0x7ddc5b6b),\r\n  X(0x7ddea8f7), X(0x7de0f4bd), X(0x7de33ebe), X(0x7de586fc),\r\n  X(0x7de7cd76), X(0x7dea122e), X(0x7dec5525), X(0x7dee965a),\r\n  X(0x7df0d5d0), X(0x7df31386), X(0x7df54f7e), X(0x7df789b8),\r\n  X(0x7df9c235), X(0x7dfbf8f5), X(0x7dfe2dfa), X(0x7e006145),\r\n  X(0x7e0292d5), X(0x7e04c2ac), X(0x7e06f0cb), X(0x7e091d32),\r\n  X(0x7e0b47e1), X(0x7e0d70db), X(0x7e0f981f), X(0x7e11bdaf),\r\n  X(0x7e13e18a), X(0x7e1603b3), X(0x7e182429), X(0x7e1a42ed),\r\n  X(0x7e1c6001), X(0x7e1e7b64), X(0x7e209518), X(0x7e22ad1d),\r\n  X(0x7e24c375), X(0x7e26d81f), X(0x7e28eb1d), X(0x7e2afc70),\r\n  X(0x7e2d0c17), X(0x7e2f1a15), X(0x7e31266a), X(0x7e333115),\r\n  X(0x7e353a1a), X(0x7e374177), X(0x7e39472e), X(0x7e3b4b3f),\r\n  X(0x7e3d4dac), X(0x7e3f4e75), X(0x7e414d9a), X(0x7e434b1e),\r\n  X(0x7e4546ff), X(0x7e474140), X(0x7e4939e0), X(0x7e4b30e2),\r\n  X(0x7e4d2644), X(0x7e4f1a09), X(0x7e510c30), X(0x7e52fcbc),\r\n  X(0x7e54ebab), X(0x7e56d900), X(0x7e58c4bb), X(0x7e5aaedd),\r\n  X(0x7e5c9766), X(0x7e5e7e57), X(0x7e6063b2), X(0x7e624776),\r\n  X(0x7e6429a5), X(0x7e660a3f), X(0x7e67e945), X(0x7e69c6b8),\r\n  X(0x7e6ba299), X(0x7e6d7ce7), X(0x7e6f55a5), X(0x7e712cd3),\r\n  X(0x7e730272), X(0x7e74d682), X(0x7e76a904), X(0x7e7879f9),\r\n  X(0x7e7a4962), X(0x7e7c173f), X(0x7e7de392), X(0x7e7fae5a),\r\n  X(0x7e817799), X(0x7e833f50), X(0x7e85057f), X(0x7e86ca27),\r\n  X(0x7e888d49), X(0x7e8a4ee5), X(0x7e8c0efd), X(0x7e8dcd91),\r\n  X(0x7e8f8aa1), X(0x7e914630), X(0x7e93003c), X(0x7e94b8c8),\r\n  X(0x7e966fd4), X(0x7e982560), X(0x7e99d96e), X(0x7e9b8bfe),\r\n  X(0x7e9d3d10), X(0x7e9eeca7), X(0x7ea09ac2), X(0x7ea24762),\r\n  X(0x7ea3f288), X(0x7ea59c35), X(0x7ea7446a), X(0x7ea8eb27),\r\n  X(0x7eaa906c), X(0x7eac343c), X(0x7eadd696), X(0x7eaf777b),\r\n  X(0x7eb116ed), X(0x7eb2b4eb), X(0x7eb45177), X(0x7eb5ec91),\r\n  X(0x7eb7863b), X(0x7eb91e74), X(0x7ebab53e), X(0x7ebc4a99),\r\n  X(0x7ebdde87), X(0x7ebf7107), X(0x7ec1021b), X(0x7ec291c3),\r\n  X(0x7ec42001), X(0x7ec5acd5), X(0x7ec7383f), X(0x7ec8c241),\r\n  X(0x7eca4adb), X(0x7ecbd20d), X(0x7ecd57da), X(0x7ecedc41),\r\n  X(0x7ed05f44), X(0x7ed1e0e2), X(0x7ed3611d), X(0x7ed4dff6),\r\n  X(0x7ed65d6d), X(0x7ed7d983), X(0x7ed95438), X(0x7edacd8f),\r\n  X(0x7edc4586), X(0x7eddbc20), X(0x7edf315c), X(0x7ee0a53c),\r\n  X(0x7ee217c1), X(0x7ee388ea), X(0x7ee4f8b9), X(0x7ee6672f),\r\n  X(0x7ee7d44c), X(0x7ee94012), X(0x7eeaaa80), X(0x7eec1397),\r\n  X(0x7eed7b59), X(0x7eeee1c6), X(0x7ef046df), X(0x7ef1aaa5),\r\n  X(0x7ef30d18), X(0x7ef46e39), X(0x7ef5ce09), X(0x7ef72c88),\r\n  X(0x7ef889b8), X(0x7ef9e599), X(0x7efb402c), X(0x7efc9972),\r\n  X(0x7efdf16b), X(0x7eff4818), X(0x7f009d79), X(0x7f01f191),\r\n  X(0x7f03445f), X(0x7f0495e4), X(0x7f05e620), X(0x7f073516),\r\n  X(0x7f0882c5), X(0x7f09cf2d), X(0x7f0b1a51), X(0x7f0c6430),\r\n  X(0x7f0daccc), X(0x7f0ef425), X(0x7f103a3b), X(0x7f117f11),\r\n  X(0x7f12c2a5), X(0x7f1404fa), X(0x7f15460f), X(0x7f1685e6),\r\n  X(0x7f17c47f), X(0x7f1901db), X(0x7f1a3dfb), X(0x7f1b78e0),\r\n  X(0x7f1cb28a), X(0x7f1deafa), X(0x7f1f2231), X(0x7f20582f),\r\n  X(0x7f218cf5), X(0x7f22c085), X(0x7f23f2de), X(0x7f252401),\r\n  X(0x7f2653f0), X(0x7f2782ab), X(0x7f28b032), X(0x7f29dc87),\r\n  X(0x7f2b07aa), X(0x7f2c319c), X(0x7f2d5a5e), X(0x7f2e81f0),\r\n  X(0x7f2fa853), X(0x7f30cd88), X(0x7f31f18f), X(0x7f33146a),\r\n  X(0x7f343619), X(0x7f35569c), X(0x7f3675f6), X(0x7f379425),\r\n  X(0x7f38b12c), X(0x7f39cd0a), X(0x7f3ae7c0), X(0x7f3c0150),\r\n  X(0x7f3d19ba), X(0x7f3e30fe), X(0x7f3f471e), X(0x7f405c1a),\r\n  X(0x7f416ff3), X(0x7f4282a9), X(0x7f43943e), X(0x7f44a4b2),\r\n  X(0x7f45b405), X(0x7f46c239), X(0x7f47cf4e), X(0x7f48db45),\r\n  X(0x7f49e61f), X(0x7f4aefdc), X(0x7f4bf87e), X(0x7f4d0004),\r\n  X(0x7f4e0670), X(0x7f4f0bc2), X(0x7f500ffb), X(0x7f51131c),\r\n  X(0x7f521525), X(0x7f531618), X(0x7f5415f4), X(0x7f5514bb),\r\n  X(0x7f56126e), X(0x7f570f0c), X(0x7f580a98), X(0x7f590511),\r\n  X(0x7f59fe78), X(0x7f5af6ce), X(0x7f5bee14), X(0x7f5ce44a),\r\n  X(0x7f5dd972), X(0x7f5ecd8b), X(0x7f5fc097), X(0x7f60b296),\r\n  X(0x7f61a389), X(0x7f629370), X(0x7f63824e), X(0x7f647021),\r\n  X(0x7f655ceb), X(0x7f6648ad), X(0x7f673367), X(0x7f681d19),\r\n  X(0x7f6905c6), X(0x7f69ed6d), X(0x7f6ad40f), X(0x7f6bb9ad),\r\n  X(0x7f6c9e48), X(0x7f6d81e0), X(0x7f6e6475), X(0x7f6f460a),\r\n  X(0x7f70269d), X(0x7f710631), X(0x7f71e4c6), X(0x7f72c25c),\r\n  X(0x7f739ef4), X(0x7f747a8f), X(0x7f75552e), X(0x7f762ed1),\r\n  X(0x7f770779), X(0x7f77df27), X(0x7f78b5db), X(0x7f798b97),\r\n  X(0x7f7a605a), X(0x7f7b3425), X(0x7f7c06fa), X(0x7f7cd8d9),\r\n  X(0x7f7da9c2), X(0x7f7e79b7), X(0x7f7f48b8), X(0x7f8016c5),\r\n  X(0x7f80e3e0), X(0x7f81b009), X(0x7f827b40), X(0x7f834588),\r\n  X(0x7f840edf), X(0x7f84d747), X(0x7f859ec1), X(0x7f86654d),\r\n  X(0x7f872aec), X(0x7f87ef9e), X(0x7f88b365), X(0x7f897641),\r\n  X(0x7f8a3832), X(0x7f8af93a), X(0x7f8bb959), X(0x7f8c7890),\r\n  X(0x7f8d36df), X(0x7f8df448), X(0x7f8eb0ca), X(0x7f8f6c67),\r\n  X(0x7f90271e), X(0x7f90e0f2), X(0x7f9199e2), X(0x7f9251f0),\r\n  X(0x7f93091b), X(0x7f93bf65), X(0x7f9474ce), X(0x7f952958),\r\n  X(0x7f95dd01), X(0x7f968fcd), X(0x7f9741ba), X(0x7f97f2ca),\r\n  X(0x7f98a2fd), X(0x7f995254), X(0x7f9a00d0), X(0x7f9aae71),\r\n  X(0x7f9b5b38), X(0x7f9c0726), X(0x7f9cb23b), X(0x7f9d5c78),\r\n  X(0x7f9e05de), X(0x7f9eae6e), X(0x7f9f5627), X(0x7f9ffd0b),\r\n  X(0x7fa0a31b), X(0x7fa14856), X(0x7fa1ecbf), X(0x7fa29054),\r\n  X(0x7fa33318), X(0x7fa3d50b), X(0x7fa4762c), X(0x7fa5167e),\r\n  X(0x7fa5b601), X(0x7fa654b5), X(0x7fa6f29b), X(0x7fa78fb3),\r\n  X(0x7fa82bff), X(0x7fa8c77f), X(0x7fa96234), X(0x7fa9fc1e),\r\n  X(0x7faa953e), X(0x7fab2d94), X(0x7fabc522), X(0x7fac5be8),\r\n  X(0x7facf1e6), X(0x7fad871d), X(0x7fae1b8f), X(0x7faeaf3b),\r\n  X(0x7faf4222), X(0x7fafd445), X(0x7fb065a4), X(0x7fb0f641),\r\n  X(0x7fb1861b), X(0x7fb21534), X(0x7fb2a38c), X(0x7fb33124),\r\n  X(0x7fb3bdfb), X(0x7fb44a14), X(0x7fb4d56f), X(0x7fb5600c),\r\n  X(0x7fb5e9ec), X(0x7fb6730f), X(0x7fb6fb76), X(0x7fb78323),\r\n  X(0x7fb80a15), X(0x7fb8904d), X(0x7fb915cc), X(0x7fb99a92),\r\n  X(0x7fba1ea0), X(0x7fbaa1f7), X(0x7fbb2497), X(0x7fbba681),\r\n  X(0x7fbc27b5), X(0x7fbca835), X(0x7fbd2801), X(0x7fbda719),\r\n  X(0x7fbe257e), X(0x7fbea331), X(0x7fbf2032), X(0x7fbf9c82),\r\n  X(0x7fc01821), X(0x7fc09311), X(0x7fc10d52), X(0x7fc186e4),\r\n  X(0x7fc1ffc8), X(0x7fc277ff), X(0x7fc2ef89), X(0x7fc36667),\r\n  X(0x7fc3dc9a), X(0x7fc45221), X(0x7fc4c6ff), X(0x7fc53b33),\r\n  X(0x7fc5aebe), X(0x7fc621a0), X(0x7fc693db), X(0x7fc7056f),\r\n  X(0x7fc7765c), X(0x7fc7e6a3), X(0x7fc85645), X(0x7fc8c542),\r\n  X(0x7fc9339b), X(0x7fc9a150), X(0x7fca0e63), X(0x7fca7ad3),\r\n  X(0x7fcae6a2), X(0x7fcb51cf), X(0x7fcbbc5c), X(0x7fcc2649),\r\n  X(0x7fcc8f97), X(0x7fccf846), X(0x7fcd6058), X(0x7fcdc7cb),\r\n  X(0x7fce2ea2), X(0x7fce94dd), X(0x7fcefa7b), X(0x7fcf5f7f),\r\n  X(0x7fcfc3e8), X(0x7fd027b7), X(0x7fd08aed), X(0x7fd0ed8b),\r\n  X(0x7fd14f90), X(0x7fd1b0fd), X(0x7fd211d4), X(0x7fd27214),\r\n  X(0x7fd2d1bf), X(0x7fd330d4), X(0x7fd38f55), X(0x7fd3ed41),\r\n  X(0x7fd44a9a), X(0x7fd4a761), X(0x7fd50395), X(0x7fd55f37),\r\n  X(0x7fd5ba48), X(0x7fd614c9), X(0x7fd66eba), X(0x7fd6c81b),\r\n  X(0x7fd720ed), X(0x7fd77932), X(0x7fd7d0e8), X(0x7fd82812),\r\n  X(0x7fd87eae), X(0x7fd8d4bf), X(0x7fd92a45), X(0x7fd97f40),\r\n  X(0x7fd9d3b0), X(0x7fda2797), X(0x7fda7af5), X(0x7fdacdca),\r\n  X(0x7fdb2018), X(0x7fdb71dd), X(0x7fdbc31c), X(0x7fdc13d5),\r\n  X(0x7fdc6408), X(0x7fdcb3b6), X(0x7fdd02df), X(0x7fdd5184),\r\n  X(0x7fdd9fa5), X(0x7fdded44), X(0x7fde3a60), X(0x7fde86fb),\r\n  X(0x7fded314), X(0x7fdf1eac), X(0x7fdf69c4), X(0x7fdfb45d),\r\n  X(0x7fdffe76), X(0x7fe04811), X(0x7fe0912e), X(0x7fe0d9ce),\r\n  X(0x7fe121f0), X(0x7fe16996), X(0x7fe1b0c1), X(0x7fe1f770),\r\n  X(0x7fe23da4), X(0x7fe2835f), X(0x7fe2c89f), X(0x7fe30d67),\r\n  X(0x7fe351b5), X(0x7fe3958c), X(0x7fe3d8ec), X(0x7fe41bd4),\r\n  X(0x7fe45e46), X(0x7fe4a042), X(0x7fe4e1c8), X(0x7fe522da),\r\n  X(0x7fe56378), X(0x7fe5a3a1), X(0x7fe5e358), X(0x7fe6229b),\r\n  X(0x7fe6616d), X(0x7fe69fcc), X(0x7fe6ddbb), X(0x7fe71b39),\r\n  X(0x7fe75847), X(0x7fe794e5), X(0x7fe7d114), X(0x7fe80cd5),\r\n  X(0x7fe84827), X(0x7fe8830c), X(0x7fe8bd84), X(0x7fe8f78f),\r\n  X(0x7fe9312f), X(0x7fe96a62), X(0x7fe9a32b), X(0x7fe9db8a),\r\n  X(0x7fea137e), X(0x7fea4b09), X(0x7fea822b), X(0x7feab8e5),\r\n  X(0x7feaef37), X(0x7feb2521), X(0x7feb5aa4), X(0x7feb8fc1),\r\n  X(0x7febc478), X(0x7febf8ca), X(0x7fec2cb6), X(0x7fec603e),\r\n  X(0x7fec9363), X(0x7fecc623), X(0x7fecf881), X(0x7fed2a7c),\r\n  X(0x7fed5c16), X(0x7fed8d4e), X(0x7fedbe24), X(0x7fedee9b),\r\n  X(0x7fee1eb1), X(0x7fee4e68), X(0x7fee7dc0), X(0x7feeacb9),\r\n  X(0x7feedb54), X(0x7fef0991), X(0x7fef3771), X(0x7fef64f5),\r\n  X(0x7fef921d), X(0x7fefbee8), X(0x7fefeb59), X(0x7ff0176f),\r\n  X(0x7ff0432a), X(0x7ff06e8c), X(0x7ff09995), X(0x7ff0c444),\r\n  X(0x7ff0ee9c), X(0x7ff1189b), X(0x7ff14243), X(0x7ff16b94),\r\n  X(0x7ff1948e), X(0x7ff1bd32), X(0x7ff1e581), X(0x7ff20d7b),\r\n  X(0x7ff2351f), X(0x7ff25c70), X(0x7ff2836d), X(0x7ff2aa17),\r\n  X(0x7ff2d06d), X(0x7ff2f672), X(0x7ff31c24), X(0x7ff34185),\r\n  X(0x7ff36695), X(0x7ff38b55), X(0x7ff3afc4), X(0x7ff3d3e4),\r\n  X(0x7ff3f7b4), X(0x7ff41b35), X(0x7ff43e69), X(0x7ff4614e),\r\n  X(0x7ff483e6), X(0x7ff4a631), X(0x7ff4c82f), X(0x7ff4e9e1),\r\n  X(0x7ff50b47), X(0x7ff52c62), X(0x7ff54d33), X(0x7ff56db9),\r\n  X(0x7ff58df5), X(0x7ff5ade7), X(0x7ff5cd90), X(0x7ff5ecf1),\r\n  X(0x7ff60c09), X(0x7ff62ada), X(0x7ff64963), X(0x7ff667a5),\r\n  X(0x7ff685a1), X(0x7ff6a357), X(0x7ff6c0c7), X(0x7ff6ddf1),\r\n  X(0x7ff6fad7), X(0x7ff71778), X(0x7ff733d6), X(0x7ff74fef),\r\n  X(0x7ff76bc6), X(0x7ff78759), X(0x7ff7a2ab), X(0x7ff7bdba),\r\n  X(0x7ff7d888), X(0x7ff7f315), X(0x7ff80d61), X(0x7ff8276c),\r\n  X(0x7ff84138), X(0x7ff85ac4), X(0x7ff87412), X(0x7ff88d20),\r\n  X(0x7ff8a5f0), X(0x7ff8be82), X(0x7ff8d6d7), X(0x7ff8eeef),\r\n  X(0x7ff906c9), X(0x7ff91e68), X(0x7ff935cb), X(0x7ff94cf2),\r\n  X(0x7ff963dd), X(0x7ff97a8f), X(0x7ff99105), X(0x7ff9a742),\r\n  X(0x7ff9bd45), X(0x7ff9d30f), X(0x7ff9e8a0), X(0x7ff9fdf9),\r\n  X(0x7ffa131a), X(0x7ffa2803), X(0x7ffa3cb4), X(0x7ffa512f),\r\n  X(0x7ffa6573), X(0x7ffa7981), X(0x7ffa8d59), X(0x7ffaa0fc),\r\n  X(0x7ffab46a), X(0x7ffac7a3), X(0x7ffadaa8), X(0x7ffaed78),\r\n  X(0x7ffb0015), X(0x7ffb127f), X(0x7ffb24b6), X(0x7ffb36bb),\r\n  X(0x7ffb488d), X(0x7ffb5a2e), X(0x7ffb6b9d), X(0x7ffb7cdb),\r\n  X(0x7ffb8de9), X(0x7ffb9ec6), X(0x7ffbaf73), X(0x7ffbbff1),\r\n  X(0x7ffbd03f), X(0x7ffbe05e), X(0x7ffbf04f), X(0x7ffc0012),\r\n  X(0x7ffc0fa6), X(0x7ffc1f0d), X(0x7ffc2e47), X(0x7ffc3d54),\r\n  X(0x7ffc4c35), X(0x7ffc5ae9), X(0x7ffc6971), X(0x7ffc77ce),\r\n  X(0x7ffc8600), X(0x7ffc9407), X(0x7ffca1e4), X(0x7ffcaf96),\r\n  X(0x7ffcbd1f), X(0x7ffcca7e), X(0x7ffcd7b4), X(0x7ffce4c1),\r\n  X(0x7ffcf1a5), X(0x7ffcfe62), X(0x7ffd0af6), X(0x7ffd1763),\r\n  X(0x7ffd23a9), X(0x7ffd2fc8), X(0x7ffd3bc1), X(0x7ffd4793),\r\n  X(0x7ffd533f), X(0x7ffd5ec5), X(0x7ffd6a27), X(0x7ffd7563),\r\n  X(0x7ffd807a), X(0x7ffd8b6e), X(0x7ffd963d), X(0x7ffda0e8),\r\n  X(0x7ffdab70), X(0x7ffdb5d5), X(0x7ffdc017), X(0x7ffdca36),\r\n  X(0x7ffdd434), X(0x7ffdde0f), X(0x7ffde7c9), X(0x7ffdf161),\r\n  X(0x7ffdfad8), X(0x7ffe042f), X(0x7ffe0d65), X(0x7ffe167b),\r\n  X(0x7ffe1f71), X(0x7ffe2848), X(0x7ffe30ff), X(0x7ffe3997),\r\n  X(0x7ffe4211), X(0x7ffe4a6c), X(0x7ffe52a9), X(0x7ffe5ac8),\r\n  X(0x7ffe62c9), X(0x7ffe6aae), X(0x7ffe7275), X(0x7ffe7a1f),\r\n  X(0x7ffe81ad), X(0x7ffe891f), X(0x7ffe9075), X(0x7ffe97b0),\r\n  X(0x7ffe9ece), X(0x7ffea5d2), X(0x7ffeacbb), X(0x7ffeb38a),\r\n  X(0x7ffeba3e), X(0x7ffec0d8), X(0x7ffec758), X(0x7ffecdbf),\r\n  X(0x7ffed40d), X(0x7ffeda41), X(0x7ffee05d), X(0x7ffee660),\r\n  X(0x7ffeec4b), X(0x7ffef21f), X(0x7ffef7da), X(0x7ffefd7e),\r\n  X(0x7fff030b), X(0x7fff0881), X(0x7fff0de0), X(0x7fff1328),\r\n  X(0x7fff185b), X(0x7fff1d77), X(0x7fff227e), X(0x7fff276f),\r\n  X(0x7fff2c4b), X(0x7fff3112), X(0x7fff35c4), X(0x7fff3a62),\r\n  X(0x7fff3eeb), X(0x7fff4360), X(0x7fff47c2), X(0x7fff4c0f),\r\n  X(0x7fff504a), X(0x7fff5471), X(0x7fff5885), X(0x7fff5c87),\r\n  X(0x7fff6076), X(0x7fff6452), X(0x7fff681d), X(0x7fff6bd6),\r\n  X(0x7fff6f7d), X(0x7fff7313), X(0x7fff7698), X(0x7fff7a0c),\r\n  X(0x7fff7d6f), X(0x7fff80c2), X(0x7fff8404), X(0x7fff8736),\r\n  X(0x7fff8a58), X(0x7fff8d6b), X(0x7fff906e), X(0x7fff9362),\r\n  X(0x7fff9646), X(0x7fff991c), X(0x7fff9be3), X(0x7fff9e9c),\r\n  X(0x7fffa146), X(0x7fffa3e2), X(0x7fffa671), X(0x7fffa8f1),\r\n  X(0x7fffab65), X(0x7fffadca), X(0x7fffb023), X(0x7fffb26f),\r\n  X(0x7fffb4ae), X(0x7fffb6e0), X(0x7fffb906), X(0x7fffbb20),\r\n  X(0x7fffbd2e), X(0x7fffbf30), X(0x7fffc126), X(0x7fffc311),\r\n  X(0x7fffc4f1), X(0x7fffc6c5), X(0x7fffc88f), X(0x7fffca4d),\r\n  X(0x7fffcc01), X(0x7fffcdab), X(0x7fffcf4a), X(0x7fffd0e0),\r\n  X(0x7fffd26b), X(0x7fffd3ec), X(0x7fffd564), X(0x7fffd6d2),\r\n  X(0x7fffd838), X(0x7fffd993), X(0x7fffdae6), X(0x7fffdc31),\r\n  X(0x7fffdd72), X(0x7fffdeab), X(0x7fffdfdb), X(0x7fffe104),\r\n  X(0x7fffe224), X(0x7fffe33c), X(0x7fffe44d), X(0x7fffe556),\r\n  X(0x7fffe657), X(0x7fffe751), X(0x7fffe844), X(0x7fffe930),\r\n  X(0x7fffea15), X(0x7fffeaf3), X(0x7fffebca), X(0x7fffec9b),\r\n  X(0x7fffed66), X(0x7fffee2a), X(0x7fffeee8), X(0x7fffefa0),\r\n  X(0x7ffff053), X(0x7ffff0ff), X(0x7ffff1a6), X(0x7ffff247),\r\n  X(0x7ffff2e4), X(0x7ffff37a), X(0x7ffff40c), X(0x7ffff499),\r\n  X(0x7ffff520), X(0x7ffff5a3), X(0x7ffff621), X(0x7ffff69b),\r\n  X(0x7ffff710), X(0x7ffff781), X(0x7ffff7ee), X(0x7ffff857),\r\n  X(0x7ffff8bb), X(0x7ffff91c), X(0x7ffff979), X(0x7ffff9d2),\r\n  X(0x7ffffa27), X(0x7ffffa79), X(0x7ffffac8), X(0x7ffffb13),\r\n  X(0x7ffffb5b), X(0x7ffffba0), X(0x7ffffbe2), X(0x7ffffc21),\r\n  X(0x7ffffc5d), X(0x7ffffc96), X(0x7ffffccd), X(0x7ffffd01),\r\n  X(0x7ffffd32), X(0x7ffffd61), X(0x7ffffd8e), X(0x7ffffdb8),\r\n  X(0x7ffffde0), X(0x7ffffe07), X(0x7ffffe2b), X(0x7ffffe4d),\r\n  X(0x7ffffe6d), X(0x7ffffe8b), X(0x7ffffea8), X(0x7ffffec3),\r\n  X(0x7ffffedc), X(0x7ffffef4), X(0x7fffff0a), X(0x7fffff1f),\r\n  X(0x7fffff33), X(0x7fffff45), X(0x7fffff56), X(0x7fffff66),\r\n  X(0x7fffff75), X(0x7fffff82), X(0x7fffff8f), X(0x7fffff9a),\r\n  X(0x7fffffa5), X(0x7fffffaf), X(0x7fffffb8), X(0x7fffffc0),\r\n  X(0x7fffffc8), X(0x7fffffce), X(0x7fffffd5), X(0x7fffffda),\r\n  X(0x7fffffdf), X(0x7fffffe4), X(0x7fffffe8), X(0x7fffffeb),\r\n  X(0x7fffffef), X(0x7ffffff1), X(0x7ffffff4), X(0x7ffffff6),\r\n  X(0x7ffffff8), X(0x7ffffff9), X(0x7ffffffb), X(0x7ffffffc),\r\n  X(0x7ffffffd), X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff),\r\n  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),\r\n  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),\r\n  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/curl.h",
    "content": "#ifndef __CURL_CURL_H\r\n#define __CURL_CURL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * If you have libcurl problems, all docs and details are found here:\r\n *   http://curl.haxx.se/libcurl/\r\n *\r\n * curl-library mailing list subscription and unsubscription web interface:\r\n *   http://cool.haxx.se/mailman/listinfo/curl-library/\r\n */\r\n\r\n#include \"curlver.h\"         /* libcurl version defines   */\r\n#include \"curlbuild.h\"       /* libcurl build definitions */\r\n#include \"curlrules.h\"       /* libcurl rules enforcement */\r\n\r\n/*\r\n * Define WIN32 when build target is Win32 API\r\n */\r\n\r\n#if (defined(_WIN32) || defined(__WIN32__)) && \\\r\n     !defined(WIN32) && !defined(__SYMBIAN32__)\r\n#define WIN32\r\n#endif\r\n\r\n#include <stdio.h>\r\n#include <limits.h>\r\n\r\n#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)\r\n/* Needed for __FreeBSD_version symbol definition */\r\n#include <osreldate.h>\r\n#endif\r\n\r\n/* The include stuff here below is mainly for time_t! */\r\n#include <sys/types.h>\r\n#include <time.h>\r\n\r\n#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)\r\n#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))\r\n/* The check above prevents the winsock2 inclusion if winsock.h already was\r\n   included, since they can't co-exist without problems */\r\n#include <winsock2.h>\r\n#include <ws2tcpip.h>\r\n#endif\r\n#endif\r\n\r\n/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish\r\n   libc5-based Linux systems. Only include it on systems that are known to\r\n   require it! */\r\n#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \\\r\n    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \\\r\n    defined(ANDROID) || defined(__ANDROID__) || \\\r\n   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(_WIN32_WCE)\r\n#include <sys/socket.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)\r\n#include <sys/time.h>\r\n#endif\r\n\r\n#ifdef __BEOS__\r\n#include <support/SupportDefs.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURL;\r\n\r\n/*\r\n * Decorate exportable functions for Win32 and Symbian OS DLL linking.\r\n * This avoids using a .def file for building libcurl.dll.\r\n */\r\n#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \\\r\n     !defined(CURL_STATICLIB)\r\n#if defined(BUILDING_LIBCURL)\r\n#define CURL_EXTERN  __declspec(dllexport)\r\n#else\r\n#define CURL_EXTERN  __declspec(dllimport)\r\n#endif\r\n#else\r\n\r\n#ifdef CURL_HIDDEN_SYMBOLS\r\n/*\r\n * This definition is used to make external definitions visible in the\r\n * shared library when symbols are hidden by default.  It makes no\r\n * difference when compiling applications whether this is set or not,\r\n * only when compiling the library.\r\n */\r\n#define CURL_EXTERN CURL_EXTERN_SYMBOL\r\n#else\r\n#define CURL_EXTERN\r\n#endif\r\n#endif\r\n\r\n#ifndef curl_socket_typedef\r\n/* socket typedef */\r\n#if defined(WIN32) && !defined(__LWIP_OPT_H__)\r\ntypedef SOCKET curl_socket_t;\r\n#define CURL_SOCKET_BAD INVALID_SOCKET\r\n#else\r\ntypedef int curl_socket_t;\r\n#define CURL_SOCKET_BAD -1\r\n#endif\r\n#define curl_socket_typedef\r\n#endif /* curl_socket_typedef */\r\n\r\nstruct curl_httppost {\r\n  struct curl_httppost *next;       /* next entry in the list */\r\n  char *name;                       /* pointer to allocated name */\r\n  long namelength;                  /* length of name length */\r\n  char *contents;                   /* pointer to allocated data contents */\r\n  long contentslength;              /* length of contents field */\r\n  char *buffer;                     /* pointer to allocated buffer contents */\r\n  long bufferlength;                /* length of buffer field */\r\n  char *contenttype;                /* Content-Type */\r\n  struct curl_slist* contentheader; /* list of extra headers for this form */\r\n  struct curl_httppost *more;       /* if one field name has more than one\r\n                                       file, this link should link to following\r\n                                       files */\r\n  long flags;                       /* as defined below */\r\n#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */\r\n#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */\r\n#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */\r\n#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */\r\n#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the\r\n                                       regular read callback to get the data\r\n                                       and pass the given pointer as custom\r\n                                       pointer */\r\n\r\n  char *showfilename;               /* The file name to show. If not set, the\r\n                                       actual file name will be used (if this\r\n                                       is a file part) */\r\n  void *userp;                      /* custom pointer used for\r\n                                       HTTPPOST_CALLBACK posts */\r\n};\r\n\r\ntypedef int (*curl_progress_callback)(void *clientp,\r\n                                      double dltotal,\r\n                                      double dlnow,\r\n                                      double ultotal,\r\n                                      double ulnow);\r\n\r\n#ifndef CURL_MAX_WRITE_SIZE\r\n  /* Tests have proven that 20K is a very bad buffer size for uploads on\r\n     Windows, while 16K for some odd reason performed a lot better.\r\n     We do the ifndef check to allow this value to easier be changed at build\r\n     time for those who feel adventurous. The practical minimum is about\r\n     400 bytes since libcurl uses a buffer of this size as a scratch area\r\n     (unrelated to network send operations). */\r\n#define CURL_MAX_WRITE_SIZE 16384\r\n#endif\r\n\r\n#ifndef CURL_MAX_HTTP_HEADER\r\n/* The only reason to have a max limit for this is to avoid the risk of a bad\r\n   server feeding libcurl with a never-ending header that will cause reallocs\r\n   infinitely */\r\n#define CURL_MAX_HTTP_HEADER (100*1024)\r\n#endif\r\n\r\n/* This is a magic return code for the write callback that, when returned,\r\n   will signal libcurl to pause receiving on the current transfer. */\r\n#define CURL_WRITEFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_write_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *outstream);\r\n\r\n\r\n\r\n/* enumeration of file types */\r\ntypedef enum {\r\n  CURLFILETYPE_FILE = 0,\r\n  CURLFILETYPE_DIRECTORY,\r\n  CURLFILETYPE_SYMLINK,\r\n  CURLFILETYPE_DEVICE_BLOCK,\r\n  CURLFILETYPE_DEVICE_CHAR,\r\n  CURLFILETYPE_NAMEDPIPE,\r\n  CURLFILETYPE_SOCKET,\r\n  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */\r\n\r\n  CURLFILETYPE_UNKNOWN /* should never occur */\r\n} curlfiletype;\r\n\r\n#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)\r\n#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)\r\n#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)\r\n#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)\r\n#define CURLFINFOFLAG_KNOWN_UID         (1<<4)\r\n#define CURLFINFOFLAG_KNOWN_GID         (1<<5)\r\n#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)\r\n#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)\r\n\r\n/* Content of this structure depends on information which is known and is\r\n   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man\r\n   page for callbacks returning this structure -- some fields are mandatory,\r\n   some others are optional. The FLAG field has special meaning. */\r\nstruct curl_fileinfo {\r\n  char *filename;\r\n  curlfiletype filetype;\r\n  time_t time;\r\n  unsigned int perm;\r\n  int uid;\r\n  int gid;\r\n  curl_off_t size;\r\n  long int hardlinks;\r\n\r\n  struct {\r\n    /* If some of these fields is not NULL, it is a pointer to b_data. */\r\n    char *time;\r\n    char *perm;\r\n    char *user;\r\n    char *group;\r\n    char *target; /* pointer to the target filename of a symlink */\r\n  } strings;\r\n\r\n  unsigned int flags;\r\n\r\n  /* used internally */\r\n  char * b_data;\r\n  size_t b_size;\r\n  size_t b_used;\r\n};\r\n\r\n/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */\r\n#define CURL_CHUNK_BGN_FUNC_OK      0\r\n#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */\r\n#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */\r\n\r\n/* if splitting of data transfer is enabled, this callback is called before\r\n   download of an individual chunk started. Note that parameter \"remains\" works\r\n   only for FTP wildcard downloading (for now), otherwise is not used */\r\ntypedef long (*curl_chunk_bgn_callback)(const void *transfer_info,\r\n                                        void *ptr,\r\n                                        int remains);\r\n\r\n/* return codes for CURLOPT_CHUNK_END_FUNCTION */\r\n#define CURL_CHUNK_END_FUNC_OK      0\r\n#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */\r\n\r\n/* If splitting of data transfer is enabled this callback is called after\r\n   download of an individual chunk finished.\r\n   Note! After this callback was set then it have to be called FOR ALL chunks.\r\n   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.\r\n   This is the reason why we don't need \"transfer_info\" parameter in this\r\n   callback and we are not interested in \"remains\" parameter too. */\r\ntypedef long (*curl_chunk_end_callback)(void *ptr);\r\n\r\n/* return codes for FNMATCHFUNCTION */\r\n#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */\r\n#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */\r\n#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */\r\n\r\n/* callback type for wildcard downloading pattern matching. If the\r\n   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */\r\ntypedef int (*curl_fnmatch_callback)(void *ptr,\r\n                                     const char *pattern,\r\n                                     const char *string);\r\n\r\n/* These are the return codes for the seek callbacks */\r\n#define CURL_SEEKFUNC_OK       0\r\n#define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */\r\n#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so\r\n                                    libcurl might try other means instead */\r\ntypedef int (*curl_seek_callback)(void *instream,\r\n                                  curl_off_t offset,\r\n                                  int origin); /* 'whence' */\r\n\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to immediately abort the current transfer. */\r\n#define CURL_READFUNC_ABORT 0x10000000\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to pause sending data on the current transfer. */\r\n#define CURL_READFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_read_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *instream);\r\n\r\ntypedef enum  {\r\n  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */\r\n  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */\r\n  CURLSOCKTYPE_LAST    /* never use */\r\n} curlsocktype;\r\n\r\n/* The return code from the sockopt_callback can signal information back\r\n   to libcurl: */\r\n#define CURL_SOCKOPT_OK 0\r\n#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return\r\n                                CURLE_ABORTED_BY_CALLBACK */\r\n#define CURL_SOCKOPT_ALREADY_CONNECTED 2\r\n\r\ntypedef int (*curl_sockopt_callback)(void *clientp,\r\n                                     curl_socket_t curlfd,\r\n                                     curlsocktype purpose);\r\n\r\nstruct curl_sockaddr {\r\n  int family;\r\n  int socktype;\r\n  int protocol;\r\n  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it\r\n                           turned really ugly and painful on the systems that\r\n                           lack this type */\r\n  struct sockaddr addr;\r\n};\r\n\r\ntypedef curl_socket_t\r\n(*curl_opensocket_callback)(void *clientp,\r\n                            curlsocktype purpose,\r\n                            struct curl_sockaddr *address);\r\n\r\ntypedef int\r\n(*curl_closesocket_callback)(void *clientp, curl_socket_t item);\r\n\r\ntypedef enum {\r\n  CURLIOE_OK,            /* I/O operation successful */\r\n  CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */\r\n  CURLIOE_FAILRESTART,   /* failed to restart the read */\r\n  CURLIOE_LAST           /* never use */\r\n} curlioerr;\r\n\r\ntypedef enum  {\r\n  CURLIOCMD_NOP,         /* no operation */\r\n  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */\r\n  CURLIOCMD_LAST         /* never use */\r\n} curliocmd;\r\n\r\ntypedef curlioerr (*curl_ioctl_callback)(CURL *handle,\r\n                                         int cmd,\r\n                                         void *clientp);\r\n\r\n/*\r\n * The following typedef's are signatures of malloc, free, realloc, strdup and\r\n * calloc respectively.  Function pointers of these types can be passed to the\r\n * curl_global_init_mem() function to set user defined memory management\r\n * callback routines.\r\n */\r\ntypedef void *(*curl_malloc_callback)(size_t size);\r\ntypedef void (*curl_free_callback)(void *ptr);\r\ntypedef void *(*curl_realloc_callback)(void *ptr, size_t size);\r\ntypedef char *(*curl_strdup_callback)(const char *str);\r\ntypedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);\r\n\r\n/* the kind of data that is passed to information_callback*/\r\ntypedef enum {\r\n  CURLINFO_TEXT = 0,\r\n  CURLINFO_HEADER_IN,    /* 1 */\r\n  CURLINFO_HEADER_OUT,   /* 2 */\r\n  CURLINFO_DATA_IN,      /* 3 */\r\n  CURLINFO_DATA_OUT,     /* 4 */\r\n  CURLINFO_SSL_DATA_IN,  /* 5 */\r\n  CURLINFO_SSL_DATA_OUT, /* 6 */\r\n  CURLINFO_END\r\n} curl_infotype;\r\n\r\ntypedef int (*curl_debug_callback)\r\n       (CURL *handle,      /* the handle/transfer this concerns */\r\n        curl_infotype type, /* what kind of data */\r\n        char *data,        /* points to the data */\r\n        size_t size,       /* size of the data pointed to */\r\n        void *userptr);    /* whatever the user please */\r\n\r\n/* All possible error codes from all sorts of curl functions. Future versions\r\n   may return other values, stay prepared.\r\n\r\n   Always add new return codes last. Never *EVER* remove any. The return\r\n   codes must remain the same!\r\n */\r\n\r\ntypedef enum {\r\n  CURLE_OK = 0,\r\n  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */\r\n  CURLE_FAILED_INIT,             /* 2 */\r\n  CURLE_URL_MALFORMAT,           /* 3 */\r\n  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for\r\n                                    7.17.0, reused in April 2011 for 7.21.5] */\r\n  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */\r\n  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */\r\n  CURLE_COULDNT_CONNECT,         /* 7 */\r\n  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */\r\n  CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server\r\n                                    due to lack of access - when login fails\r\n                                    this is not returned. */\r\n  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for\r\n                                    7.15.4, reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */\r\n  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server\r\n                                    [was obsoleted in August 2007 for 7.17.0,\r\n                                    reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */\r\n  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */\r\n  CURLE_FTP_CANT_GET_HOST,       /* 15 */\r\n  CURLE_OBSOLETE16,              /* 16 - NOT USED */\r\n  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */\r\n  CURLE_PARTIAL_FILE,            /* 18 */\r\n  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */\r\n  CURLE_OBSOLETE20,              /* 20 - NOT USED */\r\n  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */\r\n  CURLE_HTTP_RETURNED_ERROR,     /* 22 */\r\n  CURLE_WRITE_ERROR,             /* 23 */\r\n  CURLE_OBSOLETE24,              /* 24 - NOT USED */\r\n  CURLE_UPLOAD_FAILED,           /* 25 - failed upload \"command\" */\r\n  CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */\r\n  CURLE_OUT_OF_MEMORY,           /* 27 */\r\n  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error\r\n           instead of a memory allocation error if CURL_DOES_CONVERSIONS\r\n           is defined\r\n  */\r\n  CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */\r\n  CURLE_OBSOLETE29,              /* 29 - NOT USED */\r\n  CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */\r\n  CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */\r\n  CURLE_OBSOLETE32,              /* 32 - NOT USED */\r\n  CURLE_RANGE_ERROR,             /* 33 - RANGE \"command\" didn't work */\r\n  CURLE_HTTP_POST_ERROR,         /* 34 */\r\n  CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */\r\n  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */\r\n  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */\r\n  CURLE_LDAP_CANNOT_BIND,        /* 38 */\r\n  CURLE_LDAP_SEARCH_FAILED,      /* 39 */\r\n  CURLE_OBSOLETE40,              /* 40 - NOT USED */\r\n  CURLE_FUNCTION_NOT_FOUND,      /* 41 */\r\n  CURLE_ABORTED_BY_CALLBACK,     /* 42 */\r\n  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */\r\n  CURLE_OBSOLETE44,              /* 44 - NOT USED */\r\n  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */\r\n  CURLE_OBSOLETE46,              /* 46 - NOT USED */\r\n  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */\r\n  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */\r\n  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */\r\n  CURLE_OBSOLETE50,              /* 50 - NOT USED */\r\n  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint\r\n                                     wasn't verified fine */\r\n  CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */\r\n  CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */\r\n  CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as\r\n                                    default */\r\n  CURLE_SEND_ERROR,              /* 55 - failed sending network data */\r\n  CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */\r\n  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */\r\n  CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */\r\n  CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */\r\n  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */\r\n  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */\r\n  CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */\r\n  CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */\r\n  CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */\r\n  CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind\r\n                                    that failed */\r\n  CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */\r\n  CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not\r\n                                    accepted and we failed to login */\r\n  CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */\r\n  CURLE_TFTP_PERM,               /* 69 - permission problem on server */\r\n  CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */\r\n  CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */\r\n  CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */\r\n  CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */\r\n  CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */\r\n  CURLE_CONV_FAILED,             /* 75 - conversion failed */\r\n  CURLE_CONV_REQD,               /* 76 - caller must register conversion\r\n                                    callbacks using curl_easy_setopt options\r\n                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,\r\n                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and\r\n                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */\r\n  CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing\r\n                                    or wrong format */\r\n  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */\r\n  CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat\r\n                                    generic so the error message will be of\r\n                                    interest when this has happened */\r\n\r\n  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL\r\n                                    connection */\r\n  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,\r\n                                    wait till it's ready and try again (Added\r\n                                    in 7.18.2) */\r\n  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or\r\n                                    wrong format (Added in 7.19.0) */\r\n  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in\r\n                                    7.19.0) */\r\n  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */\r\n  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */\r\n  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */\r\n  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */\r\n  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */\r\n  CURL_LAST /* never use! */\r\n} CURLcode;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Previously obsoletes error codes re-used in 7.24.0 */\r\n#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED\r\n#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT\r\n\r\n/*  compatibility with older names */\r\n#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING\r\n\r\n/* The following were added in 7.21.5, April 2011 */\r\n#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION\r\n\r\n/* The following were added in 7.17.1 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION\r\n\r\n/* The following were added in 7.17.0 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */\r\n#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46\r\n#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44\r\n#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10\r\n#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16\r\n#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32\r\n#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29\r\n#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12\r\n#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20\r\n#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40\r\n#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24\r\n#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57\r\n#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN\r\n\r\n#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED\r\n#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE\r\n#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR\r\n#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL\r\n#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS\r\n#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR\r\n#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT\r\n\r\n#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR\r\n#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED\r\n#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED\r\n\r\n#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE\r\n#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME\r\n\r\n/* This was the error code 50 in 7.7.3 and a few earlier versions, this\r\n   is no longer used by libcurl but is instead #defined here only to not\r\n   make programs break */\r\n#define CURLE_ALREADY_COMPLETE 99999\r\n\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* This prototype applies to all conversion callbacks */\r\ntypedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);\r\n\r\ntypedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */\r\n                                          void *ssl_ctx, /* actually an\r\n                                                            OpenSSL SSL_CTX */\r\n                                          void *userptr);\r\n\r\ntypedef enum {\r\n  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use\r\n                           CONNECT HTTP/1.1 */\r\n  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT\r\n                               HTTP/1.0  */\r\n  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already\r\n                           in 7.10 */\r\n  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */\r\n  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */\r\n  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the\r\n                                   host name rather than the IP address. added\r\n                                   in 7.18.0 */\r\n} curl_proxytype;  /* this enum was added in 7.10 */\r\n\r\n/*\r\n * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:\r\n *\r\n * CURLAUTH_NONE         - No HTTP authentication\r\n * CURLAUTH_BASIC        - HTTP Basic authentication (default)\r\n * CURLAUTH_DIGEST       - HTTP Digest authentication\r\n * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication\r\n * CURLAUTH_NTLM         - HTTP NTLM authentication\r\n * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour\r\n * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper\r\n * CURLAUTH_ONLY         - Use together with a single other type to force no\r\n *                         authentication or just that single type\r\n * CURLAUTH_ANY          - All fine types set\r\n * CURLAUTH_ANYSAFE      - All fine types except Basic\r\n */\r\n\r\n#define CURLAUTH_NONE         ((unsigned long)0)\r\n#define CURLAUTH_BASIC        (((unsigned long)1)<<0)\r\n#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)\r\n#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)\r\n#define CURLAUTH_NTLM         (((unsigned long)1)<<3)\r\n#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)\r\n#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)\r\n#define CURLAUTH_ONLY         (((unsigned long)1)<<31)\r\n#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)\r\n#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))\r\n\r\n#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */\r\n#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */\r\n#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */\r\n#define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */\r\n#define CURLSSH_AUTH_HOST      (1<<2) /* host key files */\r\n#define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */\r\n#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */\r\n#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY\r\n\r\n#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */\r\n#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */\r\n#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */\r\n\r\n#define CURL_ERROR_SIZE 256\r\n\r\nstruct curl_khkey {\r\n  const char *key; /* points to a zero-terminated string encoded with base64\r\n                      if len is zero, otherwise to the \"raw\" data */\r\n  size_t len;\r\n  enum type {\r\n    CURLKHTYPE_UNKNOWN,\r\n    CURLKHTYPE_RSA1,\r\n    CURLKHTYPE_RSA,\r\n    CURLKHTYPE_DSS\r\n  } keytype;\r\n};\r\n\r\n/* this is the set of return values expected from the curl_sshkeycallback\r\n   callback */\r\nenum curl_khstat {\r\n  CURLKHSTAT_FINE_ADD_TO_FILE,\r\n  CURLKHSTAT_FINE,\r\n  CURLKHSTAT_REJECT, /* reject the connection, return an error */\r\n  CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so\r\n                        this causes a CURLE_DEFER error but otherwise the\r\n                        connection will be left intact etc */\r\n  CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */\r\n};\r\n\r\n/* this is the set of status codes pass in to the callback */\r\nenum curl_khmatch {\r\n  CURLKHMATCH_OK,       /* match */\r\n  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */\r\n  CURLKHMATCH_MISSING,  /* no matching host/key found */\r\n  CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */\r\n};\r\n\r\ntypedef int\r\n  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */\r\n                          const struct curl_khkey *knownkey, /* known */\r\n                          const struct curl_khkey *foundkey, /* found */\r\n                          enum curl_khmatch, /* libcurl's view on the keys */\r\n                          void *clientp); /* custom pointer passed from app */\r\n\r\n/* parameter for the CURLOPT_USE_SSL option */\r\ntypedef enum {\r\n  CURLUSESSL_NONE,    /* do not attempt to use SSL */\r\n  CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */\r\n  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */\r\n  CURLUSESSL_ALL,     /* SSL for all communication or fail */\r\n  CURLUSESSL_LAST     /* not an option, never use */\r\n} curl_usessl;\r\n\r\n/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */\r\n\r\n/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the\r\n   name of improving interoperability with older servers. Some SSL libraries\r\n   have introduced work-arounds for this flaw but those work-arounds sometimes\r\n   make the SSL communication fail. To regain functionality with those broken\r\n   servers, a user can this way allow the vulnerability back. */\r\n#define CURLSSLOPT_ALLOW_BEAST (1<<0)\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n#define CURLFTPSSL_NONE CURLUSESSL_NONE\r\n#define CURLFTPSSL_TRY CURLUSESSL_TRY\r\n#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL\r\n#define CURLFTPSSL_ALL CURLUSESSL_ALL\r\n#define CURLFTPSSL_LAST CURLUSESSL_LAST\r\n#define curl_ftpssl curl_usessl\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* parameter for the CURLOPT_FTP_SSL_CCC option */\r\ntypedef enum {\r\n  CURLFTPSSL_CCC_NONE,    /* do not send CCC */\r\n  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */\r\n  CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */\r\n  CURLFTPSSL_CCC_LAST     /* not an option, never use */\r\n} curl_ftpccc;\r\n\r\n/* parameter for the CURLOPT_FTPSSLAUTH option */\r\ntypedef enum {\r\n  CURLFTPAUTH_DEFAULT, /* let libcurl decide */\r\n  CURLFTPAUTH_SSL,     /* use \"AUTH SSL\" */\r\n  CURLFTPAUTH_TLS,     /* use \"AUTH TLS\" */\r\n  CURLFTPAUTH_LAST /* not an option, never use */\r\n} curl_ftpauth;\r\n\r\n/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */\r\ntypedef enum {\r\n  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */\r\n  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD\r\n                               again if MKD succeeded, for SFTP this does\r\n                               similar magic */\r\n  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD\r\n                               again even if MKD failed! */\r\n  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */\r\n} curl_ftpcreatedir;\r\n\r\n/* parameter for the CURLOPT_FTP_FILEMETHOD option */\r\ntypedef enum {\r\n  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */\r\n  CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */\r\n  CURLFTPMETHOD_NOCWD,     /* no CWD at all */\r\n  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */\r\n  CURLFTPMETHOD_LAST       /* not an option, never use */\r\n} curl_ftpmethod;\r\n\r\n/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */\r\n#define CURLPROTO_HTTP   (1<<0)\r\n#define CURLPROTO_HTTPS  (1<<1)\r\n#define CURLPROTO_FTP    (1<<2)\r\n#define CURLPROTO_FTPS   (1<<3)\r\n#define CURLPROTO_SCP    (1<<4)\r\n#define CURLPROTO_SFTP   (1<<5)\r\n#define CURLPROTO_TELNET (1<<6)\r\n#define CURLPROTO_LDAP   (1<<7)\r\n#define CURLPROTO_LDAPS  (1<<8)\r\n#define CURLPROTO_DICT   (1<<9)\r\n#define CURLPROTO_FILE   (1<<10)\r\n#define CURLPROTO_TFTP   (1<<11)\r\n#define CURLPROTO_IMAP   (1<<12)\r\n#define CURLPROTO_IMAPS  (1<<13)\r\n#define CURLPROTO_POP3   (1<<14)\r\n#define CURLPROTO_POP3S  (1<<15)\r\n#define CURLPROTO_SMTP   (1<<16)\r\n#define CURLPROTO_SMTPS  (1<<17)\r\n#define CURLPROTO_RTSP   (1<<18)\r\n#define CURLPROTO_RTMP   (1<<19)\r\n#define CURLPROTO_RTMPT  (1<<20)\r\n#define CURLPROTO_RTMPE  (1<<21)\r\n#define CURLPROTO_RTMPTE (1<<22)\r\n#define CURLPROTO_RTMPS  (1<<23)\r\n#define CURLPROTO_RTMPTS (1<<24)\r\n#define CURLPROTO_GOPHER (1<<25)\r\n#define CURLPROTO_ALL    (~0) /* enable everything */\r\n\r\n/* long may be 32 or 64 bits, but we should never depend on anything else\r\n   but 32 */\r\n#define CURLOPTTYPE_LONG          0\r\n#define CURLOPTTYPE_OBJECTPOINT   10000\r\n#define CURLOPTTYPE_FUNCTIONPOINT 20000\r\n#define CURLOPTTYPE_OFF_T         30000\r\n\r\n/* name is uppercase CURLOPT_<name>,\r\n   type is one of the defined CURLOPTTYPE_<type>\r\n   number is unique identifier */\r\n#ifdef CINIT\r\n#undef CINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLOPT_/**/name = type + number\r\n#endif\r\n\r\n/*\r\n * This macro-mania below setups the CURLOPT_[what] enum, to be used with\r\n * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]\r\n * word.\r\n */\r\n\r\ntypedef enum {\r\n  /* This is the FILE * or void * the regular output should be written to. */\r\n  CINIT(FILE, OBJECTPOINT, 1),\r\n\r\n  /* The full URL to get/put */\r\n  CINIT(URL,  OBJECTPOINT, 2),\r\n\r\n  /* Port number to connect to, if other than default. */\r\n  CINIT(PORT, LONG, 3),\r\n\r\n  /* Name of proxy to use. */\r\n  CINIT(PROXY, OBJECTPOINT, 4),\r\n\r\n  /* \"name:password\" to use when fetching. */\r\n  CINIT(USERPWD, OBJECTPOINT, 5),\r\n\r\n  /* \"name:password\" to use with proxy. */\r\n  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),\r\n\r\n  /* Range to get, specified as an ASCII string. */\r\n  CINIT(RANGE, OBJECTPOINT, 7),\r\n\r\n  /* not used */\r\n\r\n  /* Specified file stream to upload from (use as input): */\r\n  CINIT(INFILE, OBJECTPOINT, 9),\r\n\r\n  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE\r\n   * bytes big. If this is not used, error messages go to stderr instead: */\r\n  CINIT(ERRORBUFFER, OBJECTPOINT, 10),\r\n\r\n  /* Function that will be called to store the output (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),\r\n\r\n  /* Function that will be called to read the input (instead of fread). The\r\n   * parameters will use fread() syntax, make sure to follow them. */\r\n  CINIT(READFUNCTION, FUNCTIONPOINT, 12),\r\n\r\n  /* Time-out the read operation after this amount of seconds */\r\n  CINIT(TIMEOUT, LONG, 13),\r\n\r\n  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about\r\n   * how large the file being sent really is. That allows better error\r\n   * checking and better verifies that the upload was successful. -1 means\r\n   * unknown size.\r\n   *\r\n   * For large file support, there is also a _LARGE version of the key\r\n   * which takes an off_t type, allowing platforms with larger off_t\r\n   * sizes to handle larger files.  See below for INFILESIZE_LARGE.\r\n   */\r\n  CINIT(INFILESIZE, LONG, 14),\r\n\r\n  /* POST static input fields. */\r\n  CINIT(POSTFIELDS, OBJECTPOINT, 15),\r\n\r\n  /* Set the referrer page (needed by some CGIs) */\r\n  CINIT(REFERER, OBJECTPOINT, 16),\r\n\r\n  /* Set the FTP PORT string (interface name, named or numerical IP address)\r\n     Use i.e '-' to use default address. */\r\n  CINIT(FTPPORT, OBJECTPOINT, 17),\r\n\r\n  /* Set the User-Agent string (examined by some CGIs) */\r\n  CINIT(USERAGENT, OBJECTPOINT, 18),\r\n\r\n  /* If the download receives less than \"low speed limit\" bytes/second\r\n   * during \"low speed time\" seconds, the operations is aborted.\r\n   * You could i.e if you have a pretty high speed connection, abort if\r\n   * it is less than 2000 bytes/sec during 20 seconds.\r\n   */\r\n\r\n  /* Set the \"low speed limit\" */\r\n  CINIT(LOW_SPEED_LIMIT, LONG, 19),\r\n\r\n  /* Set the \"low speed time\" */\r\n  CINIT(LOW_SPEED_TIME, LONG, 20),\r\n\r\n  /* Set the continuation offset.\r\n   *\r\n   * Note there is also a _LARGE version of this key which uses\r\n   * off_t types, allowing for large file offsets on platforms which\r\n   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.\r\n   */\r\n  CINIT(RESUME_FROM, LONG, 21),\r\n\r\n  /* Set cookie in request: */\r\n  CINIT(COOKIE, OBJECTPOINT, 22),\r\n\r\n  /* This points to a linked list of headers, struct curl_slist kind */\r\n  CINIT(HTTPHEADER, OBJECTPOINT, 23),\r\n\r\n  /* This points to a linked list of post entries, struct curl_httppost */\r\n  CINIT(HTTPPOST, OBJECTPOINT, 24),\r\n\r\n  /* name of the file keeping your private SSL-certificate */\r\n  CINIT(SSLCERT, OBJECTPOINT, 25),\r\n\r\n  /* password for the SSL or SSH private key */\r\n  CINIT(KEYPASSWD, OBJECTPOINT, 26),\r\n\r\n  /* send TYPE parameter? */\r\n  CINIT(CRLF, LONG, 27),\r\n\r\n  /* send linked-list of QUOTE commands */\r\n  CINIT(QUOTE, OBJECTPOINT, 28),\r\n\r\n  /* send FILE * or void * to store headers to, if you use a callback it\r\n     is simply passed to the callback unmodified */\r\n  CINIT(WRITEHEADER, OBJECTPOINT, 29),\r\n\r\n  /* point to a file to read the initial cookies from, also enables\r\n     \"cookie awareness\" */\r\n  CINIT(COOKIEFILE, OBJECTPOINT, 31),\r\n\r\n  /* What version to specifically try to use.\r\n     See CURL_SSLVERSION defines below. */\r\n  CINIT(SSLVERSION, LONG, 32),\r\n\r\n  /* What kind of HTTP time condition to use, see defines */\r\n  CINIT(TIMECONDITION, LONG, 33),\r\n\r\n  /* Time to use with the above condition. Specified in number of seconds\r\n     since 1 Jan 1970 */\r\n  CINIT(TIMEVALUE, LONG, 34),\r\n\r\n  /* 35 = OBSOLETE */\r\n\r\n  /* Custom request, for customizing the get command like\r\n     HTTP: DELETE, TRACE and others\r\n     FTP: to use a different list command\r\n     */\r\n  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),\r\n\r\n  /* HTTP request, for odd commands like DELETE, TRACE and others */\r\n  CINIT(STDERR, OBJECTPOINT, 37),\r\n\r\n  /* 38 is not used */\r\n\r\n  /* send linked-list of post-transfer QUOTE commands */\r\n  CINIT(POSTQUOTE, OBJECTPOINT, 39),\r\n\r\n  CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */\r\n\r\n  CINIT(VERBOSE, LONG, 41),      /* talk a lot */\r\n  CINIT(HEADER, LONG, 42),       /* throw the header out too */\r\n  CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */\r\n  CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */\r\n  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */\r\n  CINIT(UPLOAD, LONG, 46),       /* this is an upload */\r\n  CINIT(POST, LONG, 47),         /* HTTP POST method */\r\n  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */\r\n\r\n  CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */\r\n\r\n  /* Specify whether to read the user+password from the .netrc or the URL.\r\n   * This must be one of the CURL_NETRC_* enums below. */\r\n  CINIT(NETRC, LONG, 51),\r\n\r\n  CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */\r\n\r\n  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */\r\n  CINIT(PUT, LONG, 54),          /* HTTP PUT */\r\n\r\n  /* 55 = OBSOLETE */\r\n\r\n  /* Function that will be called instead of the internal progress display\r\n   * function. This function should be defined as the curl_progress_callback\r\n   * prototype defines. */\r\n  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),\r\n\r\n  /* Data passed to the progress callback */\r\n  CINIT(PROGRESSDATA, OBJECTPOINT, 57),\r\n\r\n  /* We want the referrer field set automatically when following locations */\r\n  CINIT(AUTOREFERER, LONG, 58),\r\n\r\n  /* Port of the proxy, can be set in the proxy string as well with:\r\n     \"[host]:[port]\" */\r\n  CINIT(PROXYPORT, LONG, 59),\r\n\r\n  /* size of the POST input data, if strlen() is not good to use */\r\n  CINIT(POSTFIELDSIZE, LONG, 60),\r\n\r\n  /* tunnel non-http operations through a HTTP proxy */\r\n  CINIT(HTTPPROXYTUNNEL, LONG, 61),\r\n\r\n  /* Set the interface string to use as outgoing network interface */\r\n  CINIT(INTERFACE, OBJECTPOINT, 62),\r\n\r\n  /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This\r\n   * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string\r\n   * is set but doesn't match one of these, 'private' will be used.  */\r\n  CINIT(KRBLEVEL, OBJECTPOINT, 63),\r\n\r\n  /* Set if we should verify the peer in ssl handshake, set 1 to verify. */\r\n  CINIT(SSL_VERIFYPEER, LONG, 64),\r\n\r\n  /* The CApath or CAfile used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAINFO, OBJECTPOINT, 65),\r\n\r\n  /* 66 = OBSOLETE */\r\n  /* 67 = OBSOLETE */\r\n\r\n  /* Maximum number of http redirects to follow */\r\n  CINIT(MAXREDIRS, LONG, 68),\r\n\r\n  /* Pass a long set to 1 to get the date of the requested document (if\r\n     possible)! Pass a zero to shut it off. */\r\n  CINIT(FILETIME, LONG, 69),\r\n\r\n  /* This points to a linked list of telnet options */\r\n  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),\r\n\r\n  /* Max amount of cached alive connections */\r\n  CINIT(MAXCONNECTS, LONG, 71),\r\n\r\n  CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */\r\n\r\n  /* 73 = OBSOLETE */\r\n\r\n  /* Set to explicitly use a new connection for the upcoming transfer.\r\n     Do not use this unless you're absolutely sure of this, as it makes the\r\n     operation slower and is less friendly for the network. */\r\n  CINIT(FRESH_CONNECT, LONG, 74),\r\n\r\n  /* Set to explicitly forbid the upcoming transfer's connection to be re-used\r\n     when done. Do not use this unless you're absolutely sure of this, as it\r\n     makes the operation slower and is less friendly for the network. */\r\n  CINIT(FORBID_REUSE, LONG, 75),\r\n\r\n  /* Set to a file name that contains random data for libcurl to use to\r\n     seed the random engine when doing SSL connects. */\r\n  CINIT(RANDOM_FILE, OBJECTPOINT, 76),\r\n\r\n  /* Set to the Entropy Gathering Daemon socket pathname */\r\n  CINIT(EGDSOCKET, OBJECTPOINT, 77),\r\n\r\n  /* Time-out connect operations after this amount of seconds, if connects are\r\n     OK within this time, then fine... This only aborts the connect phase. */\r\n  CINIT(CONNECTTIMEOUT, LONG, 78),\r\n\r\n  /* Function that will be called to store headers (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),\r\n\r\n  /* Set this to force the HTTP request to get back to GET. Only really usable\r\n     if POST, PUT or a custom request have been used first.\r\n   */\r\n  CINIT(HTTPGET, LONG, 80),\r\n\r\n  /* Set if we should verify the Common name from the peer certificate in ssl\r\n   * handshake, set 1 to check existence, 2 to ensure that it matches the\r\n   * provided hostname. */\r\n  CINIT(SSL_VERIFYHOST, LONG, 81),\r\n\r\n  /* Specify which file name to write all known cookies in after completed\r\n     operation. Set file name to \"-\" (dash) to make it go to stdout. */\r\n  CINIT(COOKIEJAR, OBJECTPOINT, 82),\r\n\r\n  /* Specify which SSL ciphers to use */\r\n  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),\r\n\r\n  /* Specify which HTTP version to use! This must be set to one of the\r\n     CURL_HTTP_VERSION* enums set below. */\r\n  CINIT(HTTP_VERSION, LONG, 84),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPSV command. By\r\n     default, that one will always be attempted before the more traditional\r\n     PASV command. */\r\n  CINIT(FTP_USE_EPSV, LONG, 85),\r\n\r\n  /* type of the file keeping your SSL-certificate (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),\r\n\r\n  /* name of the file keeping your private SSL-key */\r\n  CINIT(SSLKEY, OBJECTPOINT, 87),\r\n\r\n  /* type of the file keeping your private SSL-key (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),\r\n\r\n  /* crypto engine for the SSL-sub system */\r\n  CINIT(SSLENGINE, OBJECTPOINT, 89),\r\n\r\n  /* set the crypto engine for the SSL-sub system as default\r\n     the param has no meaning...\r\n   */\r\n  CINIT(SSLENGINE_DEFAULT, LONG, 90),\r\n\r\n  /* Non-zero value means to use the global dns cache */\r\n  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */\r\n\r\n  /* DNS cache timeout */\r\n  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),\r\n\r\n  /* send linked-list of pre-transfer QUOTE commands */\r\n  CINIT(PREQUOTE, OBJECTPOINT, 93),\r\n\r\n  /* set the debug function */\r\n  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),\r\n\r\n  /* set the data for the debug function */\r\n  CINIT(DEBUGDATA, OBJECTPOINT, 95),\r\n\r\n  /* mark this as start of a cookie session */\r\n  CINIT(COOKIESESSION, LONG, 96),\r\n\r\n  /* The CApath directory used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAPATH, OBJECTPOINT, 97),\r\n\r\n  /* Instruct libcurl to use a smaller receive buffer */\r\n  CINIT(BUFFERSIZE, LONG, 98),\r\n\r\n  /* Instruct libcurl to not use any signal/alarm handlers, even when using\r\n     timeouts. This option is useful for multi-threaded applications.\r\n     See libcurl-the-guide for more background information. */\r\n  CINIT(NOSIGNAL, LONG, 99),\r\n\r\n  /* Provide a CURLShare for mutexing non-ts data */\r\n  CINIT(SHARE, OBJECTPOINT, 100),\r\n\r\n  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),\r\n     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */\r\n  CINIT(PROXYTYPE, LONG, 101),\r\n\r\n  /* Set the Accept-Encoding string. Use this to tell a server you would like\r\n     the response to be compressed. Before 7.21.6, this was known as\r\n     CURLOPT_ENCODING */\r\n  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),\r\n\r\n  /* Set pointer to private data */\r\n  CINIT(PRIVATE, OBJECTPOINT, 103),\r\n\r\n  /* Set aliases for HTTP 200 in the HTTP Response header */\r\n  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),\r\n\r\n  /* Continue to send authentication (user+password) when following locations,\r\n     even when hostname changed. This can potentially send off the name\r\n     and password to whatever host the server decides. */\r\n  CINIT(UNRESTRICTED_AUTH, LONG, 105),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPRT command (\r\n     it also disables the LPRT attempt). By default, those ones will always be\r\n     attempted before the good old traditional PORT command. */\r\n  CINIT(FTP_USE_EPRT, LONG, 106),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_USERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(HTTPAUTH, LONG, 107),\r\n\r\n  /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx\r\n     in second argument. The function must be matching the\r\n     curl_ssl_ctx_callback proto. */\r\n  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),\r\n\r\n  /* Set the userdata for the ssl context callback function's third\r\n     argument */\r\n  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),\r\n\r\n  /* FTP Option that causes missing dirs to be created on the remote server.\r\n     In 7.19.4 we introduced the convenience enums for this option using the\r\n     CURLFTP_CREATE_DIR prefix.\r\n  */\r\n  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(PROXYAUTH, LONG, 111),\r\n\r\n  /* FTP option that changes the timeout, in seconds, associated with\r\n     getting a response.  This is different from transfer timeout time and\r\n     essentially places a demand on the FTP server to acknowledge commands\r\n     in a timely manner. */\r\n  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),\r\n#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT\r\n\r\n  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to\r\n     tell libcurl to resolve names to those IP versions only. This only has\r\n     affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */\r\n  CINIT(IPRESOLVE, LONG, 113),\r\n\r\n  /* Set this option to limit the size of a file that will be downloaded from\r\n     an HTTP or FTP server.\r\n\r\n     Note there is also _LARGE version which adds large file support for\r\n     platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */\r\n  CINIT(MAXFILESIZE, LONG, 114),\r\n\r\n  /* See the comment for INFILESIZE above, but in short, specifies\r\n   * the size of the file being uploaded.  -1 means unknown.\r\n   */\r\n  CINIT(INFILESIZE_LARGE, OFF_T, 115),\r\n\r\n  /* Sets the continuation offset.  There is also a LONG version of this;\r\n   * look above for RESUME_FROM.\r\n   */\r\n  CINIT(RESUME_FROM_LARGE, OFF_T, 116),\r\n\r\n  /* Sets the maximum size of data that will be downloaded from\r\n   * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.\r\n   */\r\n  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),\r\n\r\n  /* Set this option to the file name of your .netrc file you want libcurl\r\n     to parse (using the CURLOPT_NETRC option). If not set, libcurl will do\r\n     a poor attempt to find the user's home directory and check for a .netrc\r\n     file in there. */\r\n  CINIT(NETRC_FILE, OBJECTPOINT, 118),\r\n\r\n  /* Enable SSL/TLS for FTP, pick one of:\r\n     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise\r\n     CURLUSESSL_CONTROL - SSL for the control connection or fail\r\n     CURLUSESSL_ALL     - SSL for all communication or fail\r\n  */\r\n  CINIT(USE_SSL, LONG, 119),\r\n\r\n  /* The _LARGE version of the standard POSTFIELDSIZE option */\r\n  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),\r\n\r\n  /* Enable/disable the TCP Nagle algorithm */\r\n  CINIT(TCP_NODELAY, LONG, 121),\r\n\r\n  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 123 OBSOLETE. Gone in 7.16.0 */\r\n  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 127 OBSOLETE. Gone in 7.16.0 */\r\n  /* 128 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option\r\n     can be used to change libcurl's default action which is to first try\r\n     \"AUTH SSL\" and then \"AUTH TLS\" in this order, and proceed when a OK\r\n     response has been received.\r\n\r\n     Available parameters are:\r\n     CURLFTPAUTH_DEFAULT - let libcurl decide\r\n     CURLFTPAUTH_SSL     - try \"AUTH SSL\" first, then TLS\r\n     CURLFTPAUTH_TLS     - try \"AUTH TLS\" first, then SSL\r\n  */\r\n  CINIT(FTPSSLAUTH, LONG, 129),\r\n\r\n  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),\r\n  CINIT(IOCTLDATA, OBJECTPOINT, 131),\r\n\r\n  /* 132 OBSOLETE. Gone in 7.16.0 */\r\n  /* 133 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* zero terminated string for pass on to the FTP server when asked for\r\n     \"account\" info */\r\n  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),\r\n\r\n  /* feed cookies into cookie engine */\r\n  CINIT(COOKIELIST, OBJECTPOINT, 135),\r\n\r\n  /* ignore Content-Length */\r\n  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),\r\n\r\n  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server\r\n     response. Typically used for FTP-SSL purposes but is not restricted to\r\n     that. libcurl will then instead use the same IP address it used for the\r\n     control connection. */\r\n  CINIT(FTP_SKIP_PASV_IP, LONG, 137),\r\n\r\n  /* Select \"file method\" to use when doing FTP, see the curl_ftpmethod\r\n     above. */\r\n  CINIT(FTP_FILEMETHOD, LONG, 138),\r\n\r\n  /* Local port number to bind the socket to */\r\n  CINIT(LOCALPORT, LONG, 139),\r\n\r\n  /* Number of ports to try, including the first one set with LOCALPORT.\r\n     Thus, setting it to 1 will make no additional attempts but the first.\r\n  */\r\n  CINIT(LOCALPORTRANGE, LONG, 140),\r\n\r\n  /* no transfer, set up connection and let application use the socket by\r\n     extracting it with CURLINFO_LASTSOCKET */\r\n  CINIT(CONNECT_ONLY, LONG, 141),\r\n\r\n  /* Function that will be called to convert from the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),\r\n\r\n  /* Function that will be called to convert to the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),\r\n\r\n  /* Function that will be called to convert from UTF8\r\n     (instead of using the iconv calls in libcurl)\r\n     Note that this is used only for SSL certificate processing */\r\n  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),\r\n\r\n  /* if the connection proceeds too quickly then need to slow it down */\r\n  /* limit-rate: maximum number of bytes per second to send or receive */\r\n  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),\r\n  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),\r\n\r\n  /* Pointer to command string to send if USER/PASS fails. */\r\n  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),\r\n\r\n  /* callback function for setting socket options */\r\n  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),\r\n  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),\r\n\r\n  /* set to 0 to disable session ID re-use for this transfer, default is\r\n     enabled (== 1) */\r\n  CINIT(SSL_SESSIONID_CACHE, LONG, 150),\r\n\r\n  /* allowed SSH authentication methods */\r\n  CINIT(SSH_AUTH_TYPES, LONG, 151),\r\n\r\n  /* Used by scp/sftp to do public/private key authentication */\r\n  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),\r\n  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),\r\n\r\n  /* Send CCC (Clear Command Channel) after authentication */\r\n  CINIT(FTP_SSL_CCC, LONG, 154),\r\n\r\n  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */\r\n  CINIT(TIMEOUT_MS, LONG, 155),\r\n  CINIT(CONNECTTIMEOUT_MS, LONG, 156),\r\n\r\n  /* set to zero to disable the libcurl's decoding and thus pass the raw body\r\n     data to the application even when it is encoded/compressed */\r\n  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),\r\n  CINIT(HTTP_CONTENT_DECODING, LONG, 158),\r\n\r\n  /* Permission used when creating new files and directories on the remote\r\n     server for protocols that support it, SFTP/SCP/FILE */\r\n  CINIT(NEW_FILE_PERMS, LONG, 159),\r\n  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),\r\n\r\n  /* Set the behaviour of POST when redirecting. Values must be set to one\r\n     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */\r\n  CINIT(POSTREDIR, LONG, 161),\r\n\r\n  /* used by scp/sftp to verify the host's public key */\r\n  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),\r\n\r\n  /* Callback function for opening socket (instead of socket(2)). Optionally,\r\n     callback is able change the address or refuse to connect returning\r\n     CURL_SOCKET_BAD.  The callback should have type\r\n     curl_opensocket_callback */\r\n  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),\r\n  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),\r\n\r\n  /* POST volatile input fields. */\r\n  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),\r\n\r\n  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */\r\n  CINIT(PROXY_TRANSFER_MODE, LONG, 166),\r\n\r\n  /* Callback function for seeking in the input stream */\r\n  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),\r\n  CINIT(SEEKDATA, OBJECTPOINT, 168),\r\n\r\n  /* CRL file */\r\n  CINIT(CRLFILE, OBJECTPOINT, 169),\r\n\r\n  /* Issuer certificate */\r\n  CINIT(ISSUERCERT, OBJECTPOINT, 170),\r\n\r\n  /* (IPv6) Address scope */\r\n  CINIT(ADDRESS_SCOPE, LONG, 171),\r\n\r\n  /* Collect certificate chain info and allow it to get retrievable with\r\n     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only\r\n     working with OpenSSL-powered builds. */\r\n  CINIT(CERTINFO, LONG, 172),\r\n\r\n  /* \"name\" and \"pwd\" to use when fetching. */\r\n  CINIT(USERNAME, OBJECTPOINT, 173),\r\n  CINIT(PASSWORD, OBJECTPOINT, 174),\r\n\r\n    /* \"name\" and \"pwd\" to use with Proxy when fetching. */\r\n  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),\r\n  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),\r\n\r\n  /* Comma separated list of hostnames defining no-proxy zones. These should\r\n     match both hostnames directly, and hostnames within a domain. For\r\n     example, local.com will match local.com and www.local.com, but NOT\r\n     notlocal.com or www.notlocal.com. For compatibility with other\r\n     implementations of this, .local.com will be considered to be the same as\r\n     local.com. A single * is the only valid wildcard, and effectively\r\n     disables the use of proxy. */\r\n  CINIT(NOPROXY, OBJECTPOINT, 177),\r\n\r\n  /* block size for TFTP transfers */\r\n  CINIT(TFTP_BLKSIZE, LONG, 178),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),\r\n\r\n  /* set the bitmask for the protocols that are allowed to be used for the\r\n     transfer, which thus helps the app which takes URLs from users or other\r\n     external inputs and want to restrict what protocol(s) to deal\r\n     with. Defaults to CURLPROTO_ALL. */\r\n  CINIT(PROTOCOLS, LONG, 181),\r\n\r\n  /* set the bitmask for the protocols that libcurl is allowed to follow to,\r\n     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs\r\n     to be set in both bitmasks to be allowed to get redirected to. Defaults\r\n     to all protocols except FILE and SCP. */\r\n  CINIT(REDIR_PROTOCOLS, LONG, 182),\r\n\r\n  /* set the SSH knownhost file name to use */\r\n  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),\r\n\r\n  /* set the SSH host key callback, must point to a curl_sshkeycallback\r\n     function */\r\n  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),\r\n\r\n  /* set the SSH host key callback custom pointer */\r\n  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),\r\n\r\n  /* set the SMTP mail originator */\r\n  CINIT(MAIL_FROM, OBJECTPOINT, 186),\r\n\r\n  /* set the SMTP mail receiver(s) */\r\n  CINIT(MAIL_RCPT, OBJECTPOINT, 187),\r\n\r\n  /* FTP: send PRET before PASV */\r\n  CINIT(FTP_USE_PRET, LONG, 188),\r\n\r\n  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */\r\n  CINIT(RTSP_REQUEST, LONG, 189),\r\n\r\n  /* The RTSP session identifier */\r\n  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),\r\n\r\n  /* The RTSP stream URI */\r\n  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),\r\n\r\n  /* The Transport: header to use in RTSP requests */\r\n  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),\r\n\r\n  /* Manually initialize the client RTSP CSeq for this handle */\r\n  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),\r\n\r\n  /* Manually initialize the server RTSP CSeq for this handle */\r\n  CINIT(RTSP_SERVER_CSEQ, LONG, 194),\r\n\r\n  /* The stream to pass to INTERLEAVEFUNCTION. */\r\n  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),\r\n\r\n  /* Let the application define a custom write method for RTP data */\r\n  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),\r\n\r\n  /* Turn on wildcard matching */\r\n  CINIT(WILDCARDMATCH, LONG, 197),\r\n\r\n  /* Directory matching callback called before downloading of an\r\n     individual file (chunk) started */\r\n  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),\r\n\r\n  /* Directory matching callback called after the file (chunk)\r\n     was downloaded, or skipped */\r\n  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),\r\n\r\n  /* Change match (fnmatch-like) callback for wildcard matching */\r\n  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),\r\n\r\n  /* Let the application define custom chunk data pointer */\r\n  CINIT(CHUNK_DATA, OBJECTPOINT, 201),\r\n\r\n  /* FNMATCH_FUNCTION user pointer */\r\n  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),\r\n\r\n  /* send linked-list of name:port:address sets */\r\n  CINIT(RESOLVE, OBJECTPOINT, 203),\r\n\r\n  /* Set a username for authenticated TLS */\r\n  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),\r\n\r\n  /* Set a password for authenticated TLS */\r\n  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),\r\n\r\n  /* Set authentication type for authenticated TLS */\r\n  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),\r\n\r\n  /* Set to 1 to enable the \"TE:\" header in HTTP requests to ask for\r\n     compressed transfer-encoded responses. Set to 0 to disable the use of TE:\r\n     in outgoing requests. The current default is 0, but it might change in a\r\n     future libcurl release.\r\n\r\n     libcurl will ask for the compressed methods it knows of, and if that\r\n     isn't any, it will not ask for transfer-encoding at all even if this\r\n     option is set to 1.\r\n\r\n  */\r\n  CINIT(TRANSFER_ENCODING, LONG, 207),\r\n\r\n  /* Callback function for closing socket (instead of close(2)). The callback\r\n     should have type curl_closesocket_callback */\r\n  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),\r\n  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),\r\n\r\n  /* allow GSSAPI credential delegation */\r\n  CINIT(GSSAPI_DELEGATION, LONG, 210),\r\n\r\n  /* Set the name servers to use for DNS resolution */\r\n  CINIT(DNS_SERVERS, OBJECTPOINT, 211),\r\n\r\n  /* Time-out accept operations (currently for FTP only) after this amount\r\n     of miliseconds. */\r\n  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),\r\n\r\n  /* Set TCP keepalive */\r\n  CINIT(TCP_KEEPALIVE, LONG, 213),\r\n\r\n  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */\r\n  CINIT(TCP_KEEPIDLE, LONG, 214),\r\n  CINIT(TCP_KEEPINTVL, LONG, 215),\r\n\r\n  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */\r\n  CINIT(SSL_OPTIONS, LONG, 216),\r\n\r\n  /* set the SMTP auth originator */\r\n  CINIT(MAIL_AUTH, OBJECTPOINT, 217),\r\n\r\n  CURLOPT_LASTENTRY /* the last unused */\r\n} CURLoption;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2011 */\r\n\r\n/* This was added in version 7.19.1 */\r\n#define CURLOPT_POST301 CURLOPT_POSTREDIR\r\n\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n/* The following were added in 7.17.0 */\r\n#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_FTPAPPEND CURLOPT_APPEND\r\n#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY\r\n#define CURLOPT_FTP_SSL CURLOPT_USE_SSL\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL\r\n\r\n#else\r\n/* This is set if CURL_NO_OLDIES is defined at compile-time */\r\n#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */\r\n#endif\r\n\r\n\r\n  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host\r\n     name resolves addresses using more than one IP protocol version, this\r\n     option might be handy to force libcurl to use a specific IP version. */\r\n#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP\r\n                                     versions that your system allows */\r\n#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */\r\n#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */\r\n\r\n  /* three convenient \"aliases\" that follow the name scheme better */\r\n#define CURLOPT_WRITEDATA CURLOPT_FILE\r\n#define CURLOPT_READDATA  CURLOPT_INFILE\r\n#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER\r\n#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER\r\n\r\n  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */\r\nenum {\r\n  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd\r\n                             like the library to choose the best possible\r\n                             for us! */\r\n  CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */\r\n  CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */\r\n\r\n  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */\r\n};\r\n\r\n/*\r\n * Public API enums for RTSP requests\r\n */\r\nenum {\r\n    CURL_RTSPREQ_NONE, /* first in list */\r\n    CURL_RTSPREQ_OPTIONS,\r\n    CURL_RTSPREQ_DESCRIBE,\r\n    CURL_RTSPREQ_ANNOUNCE,\r\n    CURL_RTSPREQ_SETUP,\r\n    CURL_RTSPREQ_PLAY,\r\n    CURL_RTSPREQ_PAUSE,\r\n    CURL_RTSPREQ_TEARDOWN,\r\n    CURL_RTSPREQ_GET_PARAMETER,\r\n    CURL_RTSPREQ_SET_PARAMETER,\r\n    CURL_RTSPREQ_RECORD,\r\n    CURL_RTSPREQ_RECEIVE,\r\n    CURL_RTSPREQ_LAST /* last in list */\r\n};\r\n\r\n  /* These enums are for use with the CURLOPT_NETRC option. */\r\nenum CURL_NETRC_OPTION {\r\n  CURL_NETRC_IGNORED,     /* The .netrc will never be read.\r\n                           * This is the default. */\r\n  CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred\r\n                           * to one in the .netrc. */\r\n  CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.\r\n                           * Unless one is set programmatically, the .netrc\r\n                           * will be queried. */\r\n  CURL_NETRC_LAST\r\n};\r\n\r\nenum {\r\n  CURL_SSLVERSION_DEFAULT,\r\n  CURL_SSLVERSION_TLSv1,\r\n  CURL_SSLVERSION_SSLv2,\r\n  CURL_SSLVERSION_SSLv3,\r\n\r\n  CURL_SSLVERSION_LAST /* never use, keep last */\r\n};\r\n\r\nenum CURL_TLSAUTH {\r\n  CURL_TLSAUTH_NONE,\r\n  CURL_TLSAUTH_SRP,\r\n  CURL_TLSAUTH_LAST /* never use, keep last */\r\n};\r\n\r\n/* symbols to use with CURLOPT_POSTREDIR.\r\n   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303\r\n   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302\r\n   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */\r\n\r\n#define CURL_REDIR_GET_ALL  0\r\n#define CURL_REDIR_POST_301 1\r\n#define CURL_REDIR_POST_302 2\r\n#define CURL_REDIR_POST_303 4\r\n#define CURL_REDIR_POST_ALL \\\r\n    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)\r\n\r\ntypedef enum {\r\n  CURL_TIMECOND_NONE,\r\n\r\n  CURL_TIMECOND_IFMODSINCE,\r\n  CURL_TIMECOND_IFUNMODSINCE,\r\n  CURL_TIMECOND_LASTMOD,\r\n\r\n  CURL_TIMECOND_LAST\r\n} curl_TimeCond;\r\n\r\n\r\n/* curl_strequal() and curl_strnequal() are subject for removal in a future\r\n   libcurl, see lib/README.curlx for details */\r\nCURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);\r\nCURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);\r\n\r\n/* name is uppercase CURLFORM_<name> */\r\n#ifdef CFINIT\r\n#undef CFINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CFINIT(name) CURLFORM_ ## name\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define CFINIT(name) CURLFORM_/**/name\r\n#endif\r\n\r\ntypedef enum {\r\n  CFINIT(NOTHING),        /********* the first one is unused ************/\r\n\r\n  /*  */\r\n  CFINIT(COPYNAME),\r\n  CFINIT(PTRNAME),\r\n  CFINIT(NAMELENGTH),\r\n  CFINIT(COPYCONTENTS),\r\n  CFINIT(PTRCONTENTS),\r\n  CFINIT(CONTENTSLENGTH),\r\n  CFINIT(FILECONTENT),\r\n  CFINIT(ARRAY),\r\n  CFINIT(OBSOLETE),\r\n  CFINIT(FILE),\r\n\r\n  CFINIT(BUFFER),\r\n  CFINIT(BUFFERPTR),\r\n  CFINIT(BUFFERLENGTH),\r\n\r\n  CFINIT(CONTENTTYPE),\r\n  CFINIT(CONTENTHEADER),\r\n  CFINIT(FILENAME),\r\n  CFINIT(END),\r\n  CFINIT(OBSOLETE2),\r\n\r\n  CFINIT(STREAM),\r\n\r\n  CURLFORM_LASTENTRY /* the last unused */\r\n} CURLformoption;\r\n\r\n#undef CFINIT /* done */\r\n\r\n/* structure to be used as parameter for CURLFORM_ARRAY */\r\nstruct curl_forms {\r\n  CURLformoption option;\r\n  const char     *value;\r\n};\r\n\r\n/* use this for multipart formpost building */\r\n/* Returns code for curl_formadd()\r\n *\r\n * Returns:\r\n * CURL_FORMADD_OK             on success\r\n * CURL_FORMADD_MEMORY         if the FormInfo allocation fails\r\n * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form\r\n * CURL_FORMADD_NULL           if a null pointer was given for a char\r\n * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed\r\n * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used\r\n * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)\r\n * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated\r\n * CURL_FORMADD_MEMORY         if some allocation for string copying failed.\r\n * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array\r\n *\r\n ***************************************************************************/\r\ntypedef enum {\r\n  CURL_FORMADD_OK, /* first, no error */\r\n\r\n  CURL_FORMADD_MEMORY,\r\n  CURL_FORMADD_OPTION_TWICE,\r\n  CURL_FORMADD_NULL,\r\n  CURL_FORMADD_UNKNOWN_OPTION,\r\n  CURL_FORMADD_INCOMPLETE,\r\n  CURL_FORMADD_ILLEGAL_ARRAY,\r\n  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */\r\n\r\n  CURL_FORMADD_LAST /* last */\r\n} CURLFORMcode;\r\n\r\n/*\r\n * NAME curl_formadd()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Pretty advanced function for building multi-part formposts. Each invoke\r\n * adds one part that together construct a full post. Then use\r\n * CURLOPT_HTTPPOST to send it off to libcurl.\r\n */\r\nCURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,\r\n                                      struct curl_httppost **last_post,\r\n                                      ...);\r\n\r\n/*\r\n * callback function for curl_formget()\r\n * The void *arg pointer will be the one passed as second argument to\r\n *   curl_formget().\r\n * The character buffer passed to it must not be freed.\r\n * Should return the buffer length passed to it as the argument \"len\" on\r\n *   success.\r\n */\r\ntypedef size_t (*curl_formget_callback)(void *arg, const char *buf,\r\n                                        size_t len);\r\n\r\n/*\r\n * NAME curl_formget()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Serialize a curl_httppost struct built with curl_formadd().\r\n * Accepts a void pointer as second argument which will be passed to\r\n * the curl_formget_callback function.\r\n * Returns 0 on success.\r\n */\r\nCURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,\r\n                             curl_formget_callback append);\r\n/*\r\n * NAME curl_formfree()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Free a multipart formpost previously built with curl_formadd().\r\n */\r\nCURL_EXTERN void curl_formfree(struct curl_httppost *form);\r\n\r\n/*\r\n * NAME curl_getenv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a malloc()'ed string that MUST be curl_free()ed after usage is\r\n * complete. DEPRECATED - see lib/README.curlx\r\n */\r\nCURL_EXTERN char *curl_getenv(const char *variable);\r\n\r\n/*\r\n * NAME curl_version()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a static ascii string of the libcurl version.\r\n */\r\nCURL_EXTERN char *curl_version(void);\r\n\r\n/*\r\n * NAME curl_easy_escape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Escapes URL strings (converts all letters consider illegal in URLs to their\r\n * %XX versions). This function returns a new allocated string or NULL if an\r\n * error occurred.\r\n */\r\nCURL_EXTERN char *curl_easy_escape(CURL *handle,\r\n                                   const char *string,\r\n                                   int length);\r\n\r\n/* the previous version: */\r\nCURL_EXTERN char *curl_escape(const char *string,\r\n                              int length);\r\n\r\n\r\n/*\r\n * NAME curl_easy_unescape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Unescapes URL encoding in strings (converts all %XX codes to their 8bit\r\n * versions). This function returns a new allocated string or NULL if an error\r\n * occurred.\r\n * Conversion Note: On non-ASCII platforms the ASCII %XX codes are\r\n * converted into the host encoding.\r\n */\r\nCURL_EXTERN char *curl_easy_unescape(CURL *handle,\r\n                                     const char *string,\r\n                                     int length,\r\n                                     int *outlength);\r\n\r\n/* the previous version */\r\nCURL_EXTERN char *curl_unescape(const char *string,\r\n                                int length);\r\n\r\n/*\r\n * NAME curl_free()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Provided for de-allocation in the same translation unit that did the\r\n * allocation. Added in libcurl 7.10\r\n */\r\nCURL_EXTERN void curl_free(void *p);\r\n\r\n/*\r\n * NAME curl_global_init()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() should be invoked exactly once for each application that\r\n * uses libcurl and before any call of other libcurl functions.\r\n *\r\n * This function is not thread-safe!\r\n */\r\nCURL_EXTERN CURLcode curl_global_init(long flags);\r\n\r\n/*\r\n * NAME curl_global_init_mem()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() or curl_global_init_mem() should be invoked exactly once\r\n * for each application that uses libcurl.  This function can be used to\r\n * initialize libcurl and set user defined memory management callback\r\n * functions.  Users can implement memory management routines to check for\r\n * memory leaks, check for mis-use of the curl library etc.  User registered\r\n * callback routines with be invoked by this library instead of the system\r\n * memory management routines like malloc, free etc.\r\n */\r\nCURL_EXTERN CURLcode curl_global_init_mem(long flags,\r\n                                          curl_malloc_callback m,\r\n                                          curl_free_callback f,\r\n                                          curl_realloc_callback r,\r\n                                          curl_strdup_callback s,\r\n                                          curl_calloc_callback c);\r\n\r\n/*\r\n * NAME curl_global_cleanup()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_cleanup() should be invoked exactly once for each application\r\n * that uses libcurl\r\n */\r\nCURL_EXTERN void curl_global_cleanup(void);\r\n\r\n/* linked-list structure for the CURLOPT_QUOTE option (and other) */\r\nstruct curl_slist {\r\n  char *data;\r\n  struct curl_slist *next;\r\n};\r\n\r\n/*\r\n * NAME curl_slist_append()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Appends a string to a linked list. If no list exists, it will be created\r\n * first. Returns the new list, after appending.\r\n */\r\nCURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,\r\n                                                 const char *);\r\n\r\n/*\r\n * NAME curl_slist_free_all()\r\n *\r\n * DESCRIPTION\r\n *\r\n * free a previously built curl_slist.\r\n */\r\nCURL_EXTERN void curl_slist_free_all(struct curl_slist *);\r\n\r\n/*\r\n * NAME curl_getdate()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns the time, in seconds since 1 Jan 1970 of the time string given in\r\n * the first argument. The time argument in the second parameter is unused\r\n * and should be set to NULL.\r\n */\r\nCURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);\r\n\r\n/* info about the certificate chain, only for OpenSSL builds. Asked\r\n   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */\r\nstruct curl_certinfo {\r\n  int num_of_certs;             /* number of certificates with information */\r\n  struct curl_slist **certinfo; /* for each index in this array, there's a\r\n                                   linked list with textual information in the\r\n                                   format \"name: value\" */\r\n};\r\n\r\n#define CURLINFO_STRING   0x100000\r\n#define CURLINFO_LONG     0x200000\r\n#define CURLINFO_DOUBLE   0x300000\r\n#define CURLINFO_SLIST    0x400000\r\n#define CURLINFO_MASK     0x0fffff\r\n#define CURLINFO_TYPEMASK 0xf00000\r\n\r\ntypedef enum {\r\n  CURLINFO_NONE, /* first, never use this */\r\n  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,\r\n  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,\r\n  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,\r\n  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,\r\n  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,\r\n  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,\r\n  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,\r\n  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,\r\n  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,\r\n  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,\r\n  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,\r\n  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,\r\n  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,\r\n  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,\r\n  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,\r\n  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,\r\n  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,\r\n  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,\r\n  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,\r\n  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,\r\n  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,\r\n  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,\r\n  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,\r\n  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,\r\n  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,\r\n  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,\r\n  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,\r\n  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,\r\n  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,\r\n  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,\r\n  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,\r\n  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,\r\n  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,\r\n  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,\r\n  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,\r\n  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,\r\n  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,\r\n  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,\r\n  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,\r\n  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,\r\n  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,\r\n  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,\r\n  /* Fill in new entries below here! */\r\n\r\n  CURLINFO_LASTONE          = 42\r\n} CURLINFO;\r\n\r\n/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as\r\n   CURLINFO_HTTP_CODE */\r\n#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE\r\n\r\ntypedef enum {\r\n  CURLCLOSEPOLICY_NONE, /* first, never use this */\r\n\r\n  CURLCLOSEPOLICY_OLDEST,\r\n  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,\r\n  CURLCLOSEPOLICY_LEAST_TRAFFIC,\r\n  CURLCLOSEPOLICY_SLOWEST,\r\n  CURLCLOSEPOLICY_CALLBACK,\r\n\r\n  CURLCLOSEPOLICY_LAST /* last, never use this */\r\n} curl_closepolicy;\r\n\r\n#define CURL_GLOBAL_SSL (1<<0)\r\n#define CURL_GLOBAL_WIN32 (1<<1)\r\n#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)\r\n#define CURL_GLOBAL_NOTHING 0\r\n#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL\r\n\r\n\r\n/*****************************************************************************\r\n * Setup defines, protos etc for the sharing stuff.\r\n */\r\n\r\n/* Different data locks for a single share */\r\ntypedef enum {\r\n  CURL_LOCK_DATA_NONE = 0,\r\n  /*  CURL_LOCK_DATA_SHARE is used internally to say that\r\n   *  the locking is just made to change the internal state of the share\r\n   *  itself.\r\n   */\r\n  CURL_LOCK_DATA_SHARE,\r\n  CURL_LOCK_DATA_COOKIE,\r\n  CURL_LOCK_DATA_DNS,\r\n  CURL_LOCK_DATA_SSL_SESSION,\r\n  CURL_LOCK_DATA_CONNECT,\r\n  CURL_LOCK_DATA_LAST\r\n} curl_lock_data;\r\n\r\n/* Different lock access types */\r\ntypedef enum {\r\n  CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */\r\n  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */\r\n  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */\r\n  CURL_LOCK_ACCESS_LAST        /* never use */\r\n} curl_lock_access;\r\n\r\ntypedef void (*curl_lock_function)(CURL *handle,\r\n                                   curl_lock_data data,\r\n                                   curl_lock_access locktype,\r\n                                   void *userptr);\r\ntypedef void (*curl_unlock_function)(CURL *handle,\r\n                                     curl_lock_data data,\r\n                                     void *userptr);\r\n\r\ntypedef void CURLSH;\r\n\r\ntypedef enum {\r\n  CURLSHE_OK,  /* all is fine */\r\n  CURLSHE_BAD_OPTION, /* 1 */\r\n  CURLSHE_IN_USE,     /* 2 */\r\n  CURLSHE_INVALID,    /* 3 */\r\n  CURLSHE_NOMEM,      /* 4 out of memory */\r\n  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */\r\n  CURLSHE_LAST        /* never use */\r\n} CURLSHcode;\r\n\r\ntypedef enum {\r\n  CURLSHOPT_NONE,  /* don't use */\r\n  CURLSHOPT_SHARE,   /* specify a data type to share */\r\n  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */\r\n  CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */\r\n  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */\r\n  CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock\r\n                           callback functions */\r\n  CURLSHOPT_LAST  /* never use */\r\n} CURLSHoption;\r\n\r\nCURL_EXTERN CURLSH *curl_share_init(void);\r\nCURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);\r\nCURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);\r\n\r\n/****************************************************************************\r\n * Structures for querying information about the curl library at runtime.\r\n */\r\n\r\ntypedef enum {\r\n  CURLVERSION_FIRST,\r\n  CURLVERSION_SECOND,\r\n  CURLVERSION_THIRD,\r\n  CURLVERSION_FOURTH,\r\n  CURLVERSION_LAST /* never actually use this */\r\n} CURLversion;\r\n\r\n/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by\r\n   basically all programs ever that want to get version information. It is\r\n   meant to be a built-in version number for what kind of struct the caller\r\n   expects. If the struct ever changes, we redefine the NOW to another enum\r\n   from above. */\r\n#define CURLVERSION_NOW CURLVERSION_FOURTH\r\n\r\ntypedef struct {\r\n  CURLversion age;          /* age of the returned struct */\r\n  const char *version;      /* LIBCURL_VERSION */\r\n  unsigned int version_num; /* LIBCURL_VERSION_NUM */\r\n  const char *host;         /* OS/host/cpu/machine when configured */\r\n  int features;             /* bitmask, see defines below */\r\n  const char *ssl_version;  /* human readable string */\r\n  long ssl_version_num;     /* not used anymore, always 0 */\r\n  const char *libz_version; /* human readable string */\r\n  /* protocols is terminated by an entry with a NULL protoname */\r\n  const char * const *protocols;\r\n\r\n  /* The fields below this were added in CURLVERSION_SECOND */\r\n  const char *ares;\r\n  int ares_num;\r\n\r\n  /* This field was added in CURLVERSION_THIRD */\r\n  const char *libidn;\r\n\r\n  /* These field were added in CURLVERSION_FOURTH */\r\n\r\n  /* Same as '_libiconv_version' if built with HAVE_ICONV */\r\n  int iconv_ver_num;\r\n\r\n  const char *libssh_version; /* human readable string */\r\n\r\n} curl_version_info_data;\r\n\r\n#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */\r\n#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */\r\n#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */\r\n#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */\r\n#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */\r\n#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */\r\n#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */\r\n#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */\r\n#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */\r\n#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */\r\n#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */\r\n#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */\r\n#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */\r\n#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */\r\n#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */\r\n#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM delegating to winbind helper */\r\n\r\n /*\r\n * NAME curl_version_info()\r\n *\r\n * DESCRIPTION\r\n *\r\n * This function returns a pointer to a static copy of the version info\r\n * struct. See above.\r\n */\r\nCURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);\r\n\r\n/*\r\n * NAME curl_easy_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_strerror function may be used to turn a CURLcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_easy_strerror(CURLcode);\r\n\r\n/*\r\n * NAME curl_share_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_share_strerror function may be used to turn a CURLSHcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_share_strerror(CURLSHcode);\r\n\r\n/*\r\n * NAME curl_easy_pause()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_pause function pauses or unpauses transfers. Select the new\r\n * state by setting the bitmask, use the convenience defines below.\r\n *\r\n */\r\nCURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);\r\n\r\n#define CURLPAUSE_RECV      (1<<0)\r\n#define CURLPAUSE_RECV_CONT (0)\r\n\r\n#define CURLPAUSE_SEND      (1<<2)\r\n#define CURLPAUSE_SEND_CONT (0)\r\n\r\n#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)\r\n#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n/* unfortunately, the easy.h and multi.h include files need options and info\r\n  stuff before they can be included! */\r\n#include \"easy.h\" /* nothing in curl is fun without the easy stuff */\r\n#include \"multi.h\"\r\n\r\n/* the typechecker doesn't work in C++ (yet) */\r\n#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \\\r\n    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \\\r\n    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)\r\n#include \"typecheck-gcc.h\"\r\n#else\r\n#if defined(__STDC__) && (__STDC__ >= 1)\r\n/* This preprocessor magic that replaces a call with the exact same call is\r\n   only done to make sure application authors pass exactly three arguments\r\n   to these functions. */\r\n#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)\r\n#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n#endif /* __STDC__ >= 1 */\r\n#endif /* gcc >= 4.3 && !__cplusplus */\r\n\r\n#endif /* __CURL_CURL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/curlbuild.h",
    "content": "#ifndef __CURL_CURLBUILD_H\r\n#define __CURL_CURLBUILD_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * See file include/curl/curlbuild.h.in, run configure, and forget\r\n * that this file exists it is only used for non-configure systems.\r\n * But you can keep reading if you want ;-)\r\n *\r\n */\r\n\r\n/* ================================================================ */\r\n/*                 NOTES FOR NON-CONFIGURE SYSTEMS                  */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * If you think that something actually needs to be changed, adjusted\r\n * or fixed in this file, then, report it on the libcurl development\r\n * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * Try to keep one section per platform, compiler and architecture,\r\n * otherwise, if an existing section is reused for a different one and\r\n * later on the original is adjusted, probably the piggybacking one can\r\n * be adversely changed.\r\n *\r\n * In order to differentiate between platforms/compilers/architectures\r\n * use only compiler built in predefined preprocessor symbols.\r\n *\r\n * This header file shall only export symbols which are 'curl' or 'CURL'\r\n * prefixed, otherwise public name space would be polluted.\r\n *\r\n * NOTE 2:\r\n * -------\r\n *\r\n * For any given platform/compiler curl_off_t must be typedef'ed to a\r\n * 64-bit wide signed integral data type. The width of this data type\r\n * must remain constant and independent of any possible large file\r\n * support settings.\r\n *\r\n * As an exception to the above, curl_off_t shall be typedef'ed to a\r\n * 32-bit wide signed integral data type if there is no 64-bit type.\r\n *\r\n * As a general rule, curl_off_t shall not be mapped to off_t. This\r\n * rule shall only be violated if off_t is the only 64-bit data type\r\n * available and the size of off_t is independent of large file support\r\n * settings. Keep your build on the safe side avoiding an off_t gating.\r\n * If you have a 64-bit off_t then take for sure that another 64-bit\r\n * data type exists, dig deeper and you will find it.\r\n *\r\n * NOTE 3:\r\n * -------\r\n *\r\n * Right now you might be staring at file include/curl/curlbuild.h.dist or\r\n * at file include/curl/curlbuild.h, this is due to the following reason:\r\n * file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h\r\n * when the libcurl source code distribution archive file is created.\r\n *\r\n * File include/curl/curlbuild.h.dist is not included in the distribution\r\n * archive. File include/curl/curlbuild.h is not present in the git tree.\r\n *\r\n * The distributed include/curl/curlbuild.h file is only intended to be used\r\n * on systems which can not run the also distributed configure script.\r\n *\r\n * On systems capable of running the configure script, the configure process\r\n * will overwrite the distributed include/curl/curlbuild.h file with one that\r\n * is suitable and specific to the library being configured and built, which\r\n * is generated from the include/curl/curlbuild.h.in template file.\r\n *\r\n * If you check out from git on a non-configure platform, you must run the\r\n * appropriate buildconf* script to set up curlbuild.h and other local files.\r\n *\r\n */\r\n\r\n/* ================================================================ */\r\n/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */\r\n/* ================================================================ */\r\n\r\n#ifdef CURL_SIZEOF_LONG\r\n#  error \"CURL_SIZEOF_LONG shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_OFF_T\r\n#  error \"CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_T\r\n#  error \"CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_TU\r\n#  error \"CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_OFF_T\r\n#  error \"CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_OFF_T\r\n#  error \"CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_T\r\n#  error \"CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_TU\r\n#  error \"CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n/* ================================================================ */\r\n/*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */\r\n/* ================================================================ */\r\n\r\n#if defined(__DJGPP__) || defined(__GO32__)\r\n#  if defined(__DJGPP__) && (__DJGPP__ > 1)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  else\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     4\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__SALFORDC__)\r\n#  define CURL_SIZEOF_LONG           4\r\n#  define CURL_TYPEOF_CURL_OFF_T     long\r\n#  define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#  define CURL_FORMAT_OFF_T          \"%ld\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     4\r\n#  define CURL_SUFFIX_CURL_OFF_T     L\r\n#  define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__BORLANDC__)\r\n#  if (__BORLANDC__ < 0x520)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     4\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  else\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     __int64\r\n#    define CURL_FORMAT_CURL_OFF_T     \"I64d\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"I64u\"\r\n#    define CURL_FORMAT_OFF_T          \"%I64d\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     i64\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ui64\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__TURBOC__)\r\n#  define CURL_SIZEOF_LONG           4\r\n#  define CURL_TYPEOF_CURL_OFF_T     long\r\n#  define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#  define CURL_FORMAT_OFF_T          \"%ld\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     4\r\n#  define CURL_SUFFIX_CURL_OFF_T     L\r\n#  define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__WATCOMC__)\r\n#  if defined(__386__)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     __int64\r\n#    define CURL_FORMAT_CURL_OFF_T     \"I64d\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"I64u\"\r\n#    define CURL_FORMAT_OFF_T          \"%I64d\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     i64\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ui64\r\n#  else\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     4\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__POCC__)\r\n#  if (__POCC__ < 280)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     4\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  elif defined(_MSC_VER)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     __int64\r\n#    define CURL_FORMAT_CURL_OFF_T     \"I64d\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"I64u\"\r\n#    define CURL_FORMAT_OFF_T          \"%I64d\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     i64\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ui64\r\n#  else\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__LCC__)\r\n#  define CURL_SIZEOF_LONG           4\r\n#  define CURL_TYPEOF_CURL_OFF_T     long\r\n#  define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#  define CURL_FORMAT_OFF_T          \"%ld\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     4\r\n#  define CURL_SUFFIX_CURL_OFF_T     L\r\n#  define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__SYMBIAN32__)\r\n#  if defined(__EABI__)  /* Treat all ARM compilers equally */\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  elif defined(__CW32__)\r\n#    pragma longlong on\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  elif defined(__VC32__)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     __int64\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__MWERKS__)\r\n#  define CURL_SIZEOF_LONG           4\r\n#  define CURL_TYPEOF_CURL_OFF_T     long long\r\n#  define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#  define CURL_FORMAT_OFF_T          \"%lld\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     8\r\n#  define CURL_SUFFIX_CURL_OFF_T     LL\r\n#  define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(_WIN32_WCE)\r\n#  define CURL_SIZEOF_LONG           4\r\n#  define CURL_TYPEOF_CURL_OFF_T     __int64\r\n#  define CURL_FORMAT_CURL_OFF_T     \"I64d\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"I64u\"\r\n#  define CURL_FORMAT_OFF_T          \"%I64d\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     8\r\n#  define CURL_SUFFIX_CURL_OFF_T     i64\r\n#  define CURL_SUFFIX_CURL_OFF_TU    ui64\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__MINGW32__)\r\n#  define CURL_SIZEOF_LONG           4\r\n#  define CURL_TYPEOF_CURL_OFF_T     long long\r\n#  define CURL_FORMAT_CURL_OFF_T     \"I64d\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"I64u\"\r\n#  define CURL_FORMAT_OFF_T          \"%I64d\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     8\r\n#  define CURL_SUFFIX_CURL_OFF_T     LL\r\n#  define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__VMS)\r\n#  if defined(__VAX)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     4\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  else\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n#elif defined(__OS400__)\r\n#  if defined(__ILEC400__)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n#    define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n#    define CURL_PULL_SYS_TYPES_H      1\r\n#    define CURL_PULL_SYS_SOCKET_H     1\r\n#  endif\r\n\r\n#elif defined(__MVS__)\r\n#  if defined(__IBMC__) || defined(__IBMCPP__)\r\n#    if defined(_ILP32)\r\n#      define CURL_SIZEOF_LONG           4\r\n#    elif defined(_LP64)\r\n#      define CURL_SIZEOF_LONG           8\r\n#    endif\r\n#    if defined(_LONG_LONG)\r\n#      define CURL_TYPEOF_CURL_OFF_T     long long\r\n#      define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#      define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#      define CURL_FORMAT_OFF_T          \"%lld\"\r\n#      define CURL_SIZEOF_CURL_OFF_T     8\r\n#      define CURL_SUFFIX_CURL_OFF_T     LL\r\n#      define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#    elif defined(_LP64)\r\n#      define CURL_TYPEOF_CURL_OFF_T     long\r\n#      define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#      define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#      define CURL_FORMAT_OFF_T          \"%ld\"\r\n#      define CURL_SIZEOF_CURL_OFF_T     8\r\n#      define CURL_SUFFIX_CURL_OFF_T     L\r\n#      define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#    else\r\n#      define CURL_TYPEOF_CURL_OFF_T     long\r\n#      define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#      define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#      define CURL_FORMAT_OFF_T          \"%ld\"\r\n#      define CURL_SIZEOF_CURL_OFF_T     4\r\n#      define CURL_SUFFIX_CURL_OFF_T     L\r\n#      define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#    endif\r\n#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n#    define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n#    define CURL_PULL_SYS_TYPES_H      1\r\n#    define CURL_PULL_SYS_SOCKET_H     1\r\n#  endif\r\n\r\n#elif defined(__370__)\r\n#  if defined(__IBMC__) || defined(__IBMCPP__)\r\n#    if defined(_ILP32)\r\n#      define CURL_SIZEOF_LONG           4\r\n#    elif defined(_LP64)\r\n#      define CURL_SIZEOF_LONG           8\r\n#    endif\r\n#    if defined(_LONG_LONG)\r\n#      define CURL_TYPEOF_CURL_OFF_T     long long\r\n#      define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#      define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#      define CURL_FORMAT_OFF_T          \"%lld\"\r\n#      define CURL_SIZEOF_CURL_OFF_T     8\r\n#      define CURL_SUFFIX_CURL_OFF_T     LL\r\n#      define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#    elif defined(_LP64)\r\n#      define CURL_TYPEOF_CURL_OFF_T     long\r\n#      define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#      define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#      define CURL_FORMAT_OFF_T          \"%ld\"\r\n#      define CURL_SIZEOF_CURL_OFF_T     8\r\n#      define CURL_SUFFIX_CURL_OFF_T     L\r\n#      define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#    else\r\n#      define CURL_TYPEOF_CURL_OFF_T     long\r\n#      define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#      define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#      define CURL_FORMAT_OFF_T          \"%ld\"\r\n#      define CURL_SIZEOF_CURL_OFF_T     4\r\n#      define CURL_SUFFIX_CURL_OFF_T     L\r\n#      define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#    endif\r\n#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n#    define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n#    define CURL_PULL_SYS_TYPES_H      1\r\n#    define CURL_PULL_SYS_SOCKET_H     1\r\n#  endif\r\n\r\n#elif defined(TPF)\r\n#  define CURL_SIZEOF_LONG           8\r\n#  define CURL_TYPEOF_CURL_OFF_T     long\r\n#  define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#  define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#  define CURL_FORMAT_OFF_T          \"%ld\"\r\n#  define CURL_SIZEOF_CURL_OFF_T     8\r\n#  define CURL_SUFFIX_CURL_OFF_T     L\r\n#  define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n/* ===================================== */\r\n/*    KEEP MSVC THE PENULTIMATE ENTRY    */\r\n/* ===================================== */\r\n\r\n#elif defined(_MSC_VER)\r\n#  if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     __int64\r\n#    define CURL_FORMAT_CURL_OFF_T     \"I64d\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"I64u\"\r\n#    define CURL_FORMAT_OFF_T          \"%I64d\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     i64\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ui64\r\n#  else\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     4\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T int\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n/* ===================================== */\r\n/*    KEEP GENERIC GCC THE LAST ENTRY    */\r\n/* ===================================== */\r\n\r\n#elif defined(__GNUC__)\r\n#  if defined(__i386__) || defined(__ppc__)\r\n#    define CURL_SIZEOF_LONG           4\r\n#    define CURL_TYPEOF_CURL_OFF_T     long long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"lld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"llu\"\r\n#    define CURL_FORMAT_OFF_T          \"%lld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     LL\r\n#    define CURL_SUFFIX_CURL_OFF_TU    ULL\r\n#  elif defined(__x86_64__) || defined(__ppc64__)\r\n#    define CURL_SIZEOF_LONG           8\r\n#    define CURL_TYPEOF_CURL_OFF_T     long\r\n#    define CURL_FORMAT_CURL_OFF_T     \"ld\"\r\n#    define CURL_FORMAT_CURL_OFF_TU    \"lu\"\r\n#    define CURL_FORMAT_OFF_T          \"%ld\"\r\n#    define CURL_SIZEOF_CURL_OFF_T     8\r\n#    define CURL_SUFFIX_CURL_OFF_T     L\r\n#    define CURL_SUFFIX_CURL_OFF_TU    UL\r\n#  endif\r\n#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n#  define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n#  define CURL_PULL_SYS_TYPES_H      1\r\n#  define CURL_PULL_SYS_SOCKET_H     1\r\n\r\n#else\r\n#  error \"Unknown non-configure build target!\"\r\n   Error Compilation_aborted_Unknown_non_configure_build_target\r\n#endif\r\n\r\n/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file  */\r\n/* sys/types.h is required here to properly make type definitions below. */\r\n#ifdef CURL_PULL_SYS_TYPES_H\r\n#  include <sys/types.h>\r\n#endif\r\n\r\n/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */\r\n/* sys/socket.h is required here to properly make type definitions below. */\r\n#ifdef CURL_PULL_SYS_SOCKET_H\r\n#  include <sys/socket.h>\r\n#endif\r\n\r\n/* Data type definition of curl_socklen_t. */\r\n\r\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\r\n  typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;\r\n#endif\r\n\r\n/* Data type definition of curl_off_t. */\r\n\r\n#ifdef CURL_TYPEOF_CURL_OFF_T\r\n  typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;\r\n#endif\r\n\r\n#endif /* __CURL_CURLBUILD_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/curlbuild.h.in",
    "content": "#ifndef __CURL_CURLBUILD_H\r\n#define __CURL_CURLBUILD_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * If you think that something actually needs to be changed, adjusted\r\n * or fixed in this file, then, report it on the libcurl development\r\n * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * This header file shall only export symbols which are 'curl' or 'CURL'\r\n * prefixed, otherwise public name space would be polluted.\r\n *\r\n * NOTE 2:\r\n * -------\r\n *\r\n * Right now you might be staring at file include/curl/curlbuild.h.in or\r\n * at file include/curl/curlbuild.h, this is due to the following reason:\r\n *\r\n * On systems capable of running the configure script, the configure process\r\n * will overwrite the distributed include/curl/curlbuild.h file with one that\r\n * is suitable and specific to the library being configured and built, which\r\n * is generated from the include/curl/curlbuild.h.in template file.\r\n *\r\n */\r\n\r\n/* ================================================================ */\r\n/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */\r\n/* ================================================================ */\r\n\r\n#ifdef CURL_SIZEOF_LONG\r\n#error \"CURL_SIZEOF_LONG shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#error \"CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#error \"CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_OFF_T\r\n#error \"CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_T\r\n#error \"CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_TU\r\n#error \"CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_OFF_T\r\n#error \"CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_OFF_T\r\n#error \"CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_T\r\n#error \"CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_TU\r\n#error \"CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n/* ================================================================ */\r\n/*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */\r\n/* ================================================================ */\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file ws2tcpip.h must be included by the external interface. */\r\n#undef CURL_PULL_WS2TCPIP_H\r\n#ifdef CURL_PULL_WS2TCPIP_H\r\n#  ifndef WIN32_LEAN_AND_MEAN\r\n#    define WIN32_LEAN_AND_MEAN\r\n#  endif\r\n#  include <windows.h>\r\n#  include <winsock2.h>\r\n#  include <ws2tcpip.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system   */\r\n/* header file sys/types.h must be included by the external interface. */\r\n#undef CURL_PULL_SYS_TYPES_H\r\n#ifdef CURL_PULL_SYS_TYPES_H\r\n#  include <sys/types.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system */\r\n/* header file stdint.h must be included by the external interface.  */\r\n#undef CURL_PULL_STDINT_H\r\n#ifdef CURL_PULL_STDINT_H\r\n#  include <stdint.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file inttypes.h must be included by the external interface. */\r\n#undef CURL_PULL_INTTYPES_H\r\n#ifdef CURL_PULL_INTTYPES_H\r\n#  include <inttypes.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system    */\r\n/* header file sys/socket.h must be included by the external interface. */\r\n#undef CURL_PULL_SYS_SOCKET_H\r\n#ifdef CURL_PULL_SYS_SOCKET_H\r\n#  include <sys/socket.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file sys/poll.h must be included by the external interface. */\r\n#undef CURL_PULL_SYS_POLL_H\r\n#ifdef CURL_PULL_SYS_POLL_H\r\n#  include <sys/poll.h>\r\n#endif\r\n\r\n/* The size of `long', as computed by sizeof. */\r\n#undef CURL_SIZEOF_LONG\r\n\r\n/* Integral data type used for curl_socklen_t. */\r\n#undef CURL_TYPEOF_CURL_SOCKLEN_T\r\n\r\n/* The size of `curl_socklen_t', as computed by sizeof. */\r\n#undef CURL_SIZEOF_CURL_SOCKLEN_T\r\n\r\n/* Data type definition of curl_socklen_t. */\r\ntypedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;\r\n\r\n/* Signed integral data type used for curl_off_t. */\r\n#undef CURL_TYPEOF_CURL_OFF_T\r\n\r\n/* Data type definition of curl_off_t. */\r\ntypedef CURL_TYPEOF_CURL_OFF_T curl_off_t;\r\n\r\n/* curl_off_t formatting string directive without \"%\" conversion specifier. */\r\n#undef CURL_FORMAT_CURL_OFF_T\r\n\r\n/* unsigned curl_off_t formatting string without \"%\" conversion specifier. */\r\n#undef CURL_FORMAT_CURL_OFF_TU\r\n\r\n/* curl_off_t formatting string directive with \"%\" conversion specifier. */\r\n#undef CURL_FORMAT_OFF_T\r\n\r\n/* The size of `curl_off_t', as computed by sizeof. */\r\n#undef CURL_SIZEOF_CURL_OFF_T\r\n\r\n/* curl_off_t constant suffix. */\r\n#undef CURL_SUFFIX_CURL_OFF_T\r\n\r\n/* unsigned curl_off_t constant suffix. */\r\n#undef CURL_SUFFIX_CURL_OFF_TU\r\n\r\n#endif /* __CURL_CURLBUILD_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/curlrules.h",
    "content": "#ifndef __CURL_CURLRULES_H\r\n#define __CURL_CURLRULES_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*                    COMPILE TIME SANITY CHECKS                    */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * All checks done in this file are intentionally placed in a public\r\n * header file which is pulled by curl/curl.h when an application is\r\n * being built using an already built libcurl library. Additionally\r\n * this file is also included and used when building the library.\r\n *\r\n * If compilation fails on this file it is certainly sure that the\r\n * problem is elsewhere. It could be a problem in the curlbuild.h\r\n * header file, or simply that you are using different compilation\r\n * settings than those used to build the library.\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * Do not deactivate any check, these are done to make sure that the\r\n * library is properly built and used.\r\n *\r\n * You can find further help on the libcurl development mailing list:\r\n * http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * NOTE 2\r\n * ------\r\n *\r\n * Some of the following compile time checks are based on the fact\r\n * that the dimension of a constant array can not be a negative one.\r\n * In this way if the compile time verification fails, the compilation\r\n * will fail issuing an error. The error description wording is compiler\r\n * dependent but it will be quite similar to one of the following:\r\n *\r\n *   \"negative subscript or subscript is too large\"\r\n *   \"array must have at least one element\"\r\n *   \"-1 is an illegal array size\"\r\n *   \"size of array is negative\"\r\n *\r\n * If you are building an application which tries to use an already\r\n * built libcurl library and you are getting this kind of errors on\r\n * this file, it is a clear indication that there is a mismatch between\r\n * how the library was built and how you are trying to use it for your\r\n * application. Your already compiled or binary library provider is the\r\n * only one who can give you the details you need to properly use it.\r\n */\r\n\r\n/*\r\n * Verify that some macros are actually defined.\r\n */\r\n\r\n#ifndef CURL_SIZEOF_LONG\r\n#  error \"CURL_SIZEOF_LONG definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_OFF_T\r\n#  error \"CURL_TYPEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_T\r\n#  error \"CURL_FORMAT_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_TU\r\n#  error \"CURL_FORMAT_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_OFF_T\r\n#  error \"CURL_FORMAT_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_OFF_T\r\n#  error \"CURL_SIZEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_T\r\n#  error \"CURL_SUFFIX_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_TU\r\n#  error \"CURL_SUFFIX_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n/*\r\n * Macros private to this header file.\r\n */\r\n\r\n#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1\r\n\r\n#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1\r\n\r\n/*\r\n * Verify that the size previously defined and expected for long\r\n * is the same as the one reported by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_01__\r\n    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_off_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_02__\r\n    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_off_t as reported\r\n * by sizeof() is greater or equal than the one reported for long\r\n * for the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_03__\r\n    [CurlchkszGE(curl_off_t, long)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_socklen_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_04__\r\n    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_socklen_t as reported\r\n * by sizeof() is greater or equal than the one reported for int for\r\n * the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_05__\r\n    [CurlchkszGE(curl_socklen_t, int)];\r\n\r\n/* ================================================================ */\r\n/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */\r\n/* ================================================================ */\r\n\r\n/*\r\n * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow\r\n * these to be visible and exported by the external libcurl interface API,\r\n * while also making them visible to the library internals, simply including\r\n * curl_setup.h, without actually needing to include curl.h internally.\r\n * If some day this section would grow big enough, all this should be moved\r\n * to its own header file.\r\n */\r\n\r\n/*\r\n * Figure out if we can use the ## preprocessor operator, which is supported\r\n * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__\r\n * or  __cplusplus so we need to carefully check for them too.\r\n */\r\n\r\n#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \\\r\n  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \\\r\n  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \\\r\n  defined(__ILEC400__)\r\n  /* This compiler is believed to have an ISO compatible preprocessor */\r\n#define CURL_ISOCPP\r\n#else\r\n  /* This compiler is believed NOT to have an ISO compatible preprocessor */\r\n#undef CURL_ISOCPP\r\n#endif\r\n\r\n/*\r\n * Macros for minimum-width signed and unsigned curl_off_t integer constants.\r\n */\r\n\r\n#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)\r\n#  define __CURL_OFF_T_C_HLPR2(x) x\r\n#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)\r\n#else\r\n#  ifdef CURL_ISOCPP\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix\r\n#  else\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix\r\n#  endif\r\n#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)\r\n#endif\r\n\r\n/*\r\n * Get rid of macros private to this header file.\r\n */\r\n\r\n#undef CurlchkszEQ\r\n#undef CurlchkszGE\r\n\r\n/*\r\n * Get rid of macros not intended to exist beyond this point.\r\n */\r\n\r\n#undef CURL_PULL_WS2TCPIP_H\r\n#undef CURL_PULL_SYS_TYPES_H\r\n#undef CURL_PULL_SYS_SOCKET_H\r\n#undef CURL_PULL_SYS_POLL_H\r\n#undef CURL_PULL_STDINT_H\r\n#undef CURL_PULL_INTTYPES_H\r\n\r\n#undef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#undef CURL_TYPEOF_CURL_OFF_T\r\n\r\n#ifdef CURL_NO_OLDIES\r\n#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */\r\n#endif\r\n\r\n#endif /* __CURL_CURLRULES_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/curlver.h",
    "content": "#ifndef __CURL_CURLVER_H\r\n#define __CURL_CURLVER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* This header file contains nothing but libcurl version info, generated by\r\n   a script at release-time. This was made its own header file in 7.11.2 */\r\n\r\n/* This is the global package copyright */\r\n#define LIBCURL_COPYRIGHT \"1996 - 2013 Daniel Stenberg, <daniel@haxx.se>.\"\r\n\r\n/* This is the version number of the libcurl package from which this header\r\n   file origins: */\r\n#define LIBCURL_VERSION \"7.29.0\"\r\n\r\n/* The numeric version number is also available \"in parts\" by using these\r\n   defines: */\r\n#define LIBCURL_VERSION_MAJOR 7\r\n#define LIBCURL_VERSION_MINOR 29\r\n#define LIBCURL_VERSION_PATCH 0\r\n\r\n/* This is the numeric version of the libcurl version number, meant for easier\r\n   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will\r\n   always follow this syntax:\r\n\r\n         0xXXYYZZ\r\n\r\n   Where XX, YY and ZZ are the main version, release and patch numbers in\r\n   hexadecimal (using 8 bits each). All three numbers are always represented\r\n   using two digits.  1.2 would appear as \"0x010200\" while version 9.11.7\r\n   appears as \"0x090b07\".\r\n\r\n   This 6-digit (24 bits) hexadecimal number does not show pre-release number,\r\n   and it is always a greater number in a more recent release. It makes\r\n   comparisons with greater than and less than work.\r\n*/\r\n#define LIBCURL_VERSION_NUM 0x071d00\r\n\r\n/*\r\n * This is the date and time when the full source package was created. The\r\n * timestamp is not stored in git, as the timestamp is properly set in the\r\n * tarballs by the maketgz script.\r\n *\r\n * The format of the date should follow this template:\r\n *\r\n * \"Mon Feb 12 11:35:33 UTC 2007\"\r\n */\r\n#define LIBCURL_TIMESTAMP \"Wed Feb  6 10:13:08 UTC 2013\"\r\n\r\n#endif /* __CURL_CURLVER_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/easy.h",
    "content": "#ifndef __CURL_EASY_H\r\n#define __CURL_EASY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN CURL *curl_easy_init(void);\r\nCURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);\r\nCURL_EXTERN CURLcode curl_easy_perform(CURL *curl);\r\nCURL_EXTERN void curl_easy_cleanup(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_getinfo()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Request internal information from the curl session with this function.  The\r\n * third argument MUST be a pointer to a long, a pointer to a char * or a\r\n * pointer to a double (as the documentation describes elsewhere).  The data\r\n * pointed to will be filled in accordingly and can be relied upon only if the\r\n * function returns CURLE_OK.  This function is intended to get used *AFTER* a\r\n * performed transfer, all results from this function are undefined until the\r\n * transfer is completed.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);\r\n\r\n\r\n/*\r\n * NAME curl_easy_duphandle()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Creates a new curl session handle with the same options set for the handle\r\n * passed in. Duplicating a handle could only be a matter of cloning data and\r\n * options, internal state info and things like persistent connections cannot\r\n * be transferred. It is useful in multithreaded applications when you can run\r\n * curl_easy_duphandle() for each new thread to avoid a series of identical\r\n * curl_easy_setopt() invokes in every thread.\r\n */\r\nCURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_reset()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Re-initializes a CURL handle to the default values. This puts back the\r\n * handle to the same state as it was in when it was just created.\r\n *\r\n * It does keep: live connections, the Session ID cache, the DNS cache and the\r\n * cookies.\r\n */\r\nCURL_EXTERN void curl_easy_reset(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_recv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Receives data from the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,\r\n                                    size_t *n);\r\n\r\n/*\r\n * NAME curl_easy_send()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Sends data over the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,\r\n                                    size_t buflen, size_t *n);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/mprintf.h",
    "content": "#ifndef __CURL_MPRINTF_H\r\n#define __CURL_MPRINTF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <stdarg.h>\r\n#include <stdio.h> /* needed for FILE */\r\n\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN int curl_mprintf(const char *format, ...);\r\nCURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);\r\nCURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);\r\nCURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,\r\n                               const char *format, ...);\r\nCURL_EXTERN int curl_mvprintf(const char *format, va_list args);\r\nCURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,\r\n                                const char *format, va_list args);\r\nCURL_EXTERN char *curl_maprintf(const char *format, ...);\r\nCURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);\r\n\r\n#ifdef _MPRINTF_REPLACE\r\n# undef printf\r\n# undef fprintf\r\n# undef sprintf\r\n# undef vsprintf\r\n# undef snprintf\r\n# undef vprintf\r\n# undef vfprintf\r\n# undef vsnprintf\r\n# undef aprintf\r\n# undef vaprintf\r\n# define printf curl_mprintf\r\n# define fprintf curl_mfprintf\r\n#ifdef CURLDEBUG\r\n/* When built with CURLDEBUG we define away the sprintf() functions since we\r\n   don't want internal code to be using them */\r\n# define sprintf sprintf_was_used\r\n# define vsprintf vsprintf_was_used\r\n#else\r\n# define sprintf curl_msprintf\r\n# define vsprintf curl_mvsprintf\r\n#endif\r\n# define snprintf curl_msnprintf\r\n# define vprintf curl_mvprintf\r\n# define vfprintf curl_mvfprintf\r\n# define vsnprintf curl_mvsnprintf\r\n# define aprintf curl_maprintf\r\n# define vaprintf curl_mvaprintf\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* __CURL_MPRINTF_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/multi.h",
    "content": "#ifndef __CURL_MULTI_H\r\n#define __CURL_MULTI_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n  This is an \"external\" header file. Don't give away any internals here!\r\n\r\n  GOALS\r\n\r\n  o Enable a \"pull\" interface. The application that uses libcurl decides where\r\n    and when to ask libcurl to get/send data.\r\n\r\n  o Enable multiple simultaneous transfers in the same thread without making it\r\n    complicated for the application.\r\n\r\n  o Enable the application to select() on its own file descriptors and curl's\r\n    file descriptors simultaneous easily.\r\n\r\n*/\r\n\r\n/*\r\n * This header file should not really need to include \"curl.h\" since curl.h\r\n * itself includes this file and we expect user applications to do #include\r\n * <curl/curl.h> without the need for especially including multi.h.\r\n *\r\n * For some reason we added this include here at one point, and rather than to\r\n * break existing (wrongly written) libcurl applications, we leave it as-is\r\n * but with this warning attached.\r\n */\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURLM;\r\n\r\ntypedef enum {\r\n  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or\r\n                                    curl_multi_socket*() soon */\r\n  CURLM_OK,\r\n  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */\r\n  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */\r\n  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */\r\n  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */\r\n  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */\r\n  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */\r\n  CURLM_LAST\r\n} CURLMcode;\r\n\r\n/* just to make code nicer when using curl_multi_socket() you can now check\r\n   for CURLM_CALL_MULTI_SOCKET too in the same style it works for\r\n   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */\r\n#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM\r\n\r\ntypedef enum {\r\n  CURLMSG_NONE, /* first, not used */\r\n  CURLMSG_DONE, /* This easy handle has completed. 'result' contains\r\n                   the CURLcode of the transfer */\r\n  CURLMSG_LAST /* last, not used */\r\n} CURLMSG;\r\n\r\nstruct CURLMsg {\r\n  CURLMSG msg;       /* what this message means */\r\n  CURL *easy_handle; /* the handle it concerns */\r\n  union {\r\n    void *whatever;    /* message-specific data */\r\n    CURLcode result;   /* return code for transfer */\r\n  } data;\r\n};\r\ntypedef struct CURLMsg CURLMsg;\r\n\r\n/* Based on poll(2) structure and values.\r\n * We don't use pollfd and POLL* constants explicitly\r\n * to cover platforms without poll(). */\r\n#define CURL_WAIT_POLLIN    0x0001\r\n#define CURL_WAIT_POLLPRI   0x0002\r\n#define CURL_WAIT_POLLOUT   0x0004\r\n\r\nstruct curl_waitfd {\r\n  curl_socket_t fd;\r\n  short events;\r\n  short revents; /* not supported yet */\r\n};\r\n\r\n/*\r\n * Name:    curl_multi_init()\r\n *\r\n * Desc:    inititalize multi-style curl usage\r\n *\r\n * Returns: a new CURLM handle to use in all 'curl_multi' functions.\r\n */\r\nCURL_EXTERN CURLM *curl_multi_init(void);\r\n\r\n/*\r\n * Name:    curl_multi_add_handle()\r\n *\r\n * Desc:    add a standard curl handle to the multi stack\r\n *\r\n * Returns: CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,\r\n                                            CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_remove_handle()\r\n  *\r\n  * Desc:    removes a curl handle from the multi stack again\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,\r\n                                               CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_fdset()\r\n  *\r\n  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or\r\n  *          poll() on. We want curl_multi_perform() called as soon as one of\r\n  *          them are ready.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,\r\n                                       fd_set *read_fd_set,\r\n                                       fd_set *write_fd_set,\r\n                                       fd_set *exc_fd_set,\r\n                                       int *max_fd);\r\n\r\n/*\r\n * Name:     curl_multi_wait()\r\n *\r\n * Desc:     Poll on all fds within a CURLM set as well as any\r\n *           additional fds passed to the function.\r\n *\r\n * Returns:  CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,\r\n                                      struct curl_waitfd extra_fds[],\r\n                                      unsigned int extra_nfds,\r\n                                      int timeout_ms,\r\n                                      int *ret);\r\n\r\n /*\r\n  * Name:    curl_multi_perform()\r\n  *\r\n  * Desc:    When the app thinks there's data available for curl it calls this\r\n  *          function to read/write whatever there is right now. This returns\r\n  *          as soon as the reads and writes are done. This function does not\r\n  *          require that there actually is data available for reading or that\r\n  *          data can be written, it can be called just in case. It returns\r\n  *          the number of handles that still transfer data in the second\r\n  *          argument's integer-pointer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code. *NOTE* that this only\r\n  *          returns errors etc regarding the whole multi stack. There might\r\n  *          still have occurred problems on invidual transfers even when this\r\n  *          returns OK.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,\r\n                                         int *running_handles);\r\n\r\n /*\r\n  * Name:    curl_multi_cleanup()\r\n  *\r\n  * Desc:    Cleans up and removes a whole multi stack. It does not free or\r\n  *          touch any individual easy handles in any way. We need to define\r\n  *          in what state those handles will be if this function is called\r\n  *          in the middle of a transfer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);\r\n\r\n/*\r\n * Name:    curl_multi_info_read()\r\n *\r\n * Desc:    Ask the multi handle if there's any messages/informationals from\r\n *          the individual transfers. Messages include informationals such as\r\n *          error code from the transfer or just the fact that a transfer is\r\n *          completed. More details on these should be written down as well.\r\n *\r\n *          Repeated calls to this function will return a new struct each\r\n *          time, until a special \"end of msgs\" struct is returned as a signal\r\n *          that there is no more to get at this point.\r\n *\r\n *          The data the returned pointer points to will not survive calling\r\n *          curl_multi_cleanup().\r\n *\r\n *          The 'CURLMsg' struct is meant to be very simple and only contain\r\n *          very basic informations. If more involved information is wanted,\r\n *          we will provide the particular \"transfer handle\" in that struct\r\n *          and that should/could/would be used in subsequent\r\n *          curl_easy_getinfo() calls (or similar). The point being that we\r\n *          must never expose complex structs to applications, as then we'll\r\n *          undoubtably get backwards compatibility problems in the future.\r\n *\r\n * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out\r\n *          of structs. It also writes the number of messages left in the\r\n *          queue (after this read) in the integer the second argument points\r\n *          to.\r\n */\r\nCURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,\r\n                                          int *msgs_in_queue);\r\n\r\n/*\r\n * Name:    curl_multi_strerror()\r\n *\r\n * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode\r\n *          value into the equivalent human readable error string.  This is\r\n *          useful for printing meaningful error messages.\r\n *\r\n * Returns: A pointer to a zero-terminated error message.\r\n */\r\nCURL_EXTERN const char *curl_multi_strerror(CURLMcode);\r\n\r\n/*\r\n * Name:    curl_multi_socket() and\r\n *          curl_multi_socket_all()\r\n *\r\n * Desc:    An alternative version of curl_multi_perform() that allows the\r\n *          application to pass in one of the file descriptors that have been\r\n *          detected to have \"action\" on them and let libcurl perform.\r\n *          See man page for details.\r\n */\r\n#define CURL_POLL_NONE   0\r\n#define CURL_POLL_IN     1\r\n#define CURL_POLL_OUT    2\r\n#define CURL_POLL_INOUT  3\r\n#define CURL_POLL_REMOVE 4\r\n\r\n#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD\r\n\r\n#define CURL_CSELECT_IN   0x01\r\n#define CURL_CSELECT_OUT  0x02\r\n#define CURL_CSELECT_ERR  0x04\r\n\r\ntypedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */\r\n                                    curl_socket_t s, /* socket */\r\n                                    int what,        /* see above */\r\n                                    void *userp,     /* private callback\r\n                                                        pointer */\r\n                                    void *socketp);  /* private socket\r\n                                                        pointer */\r\n/*\r\n * Name:    curl_multi_timer_callback\r\n *\r\n * Desc:    Called by libcurl whenever the library detects a change in the\r\n *          maximum number of milliseconds the app is allowed to wait before\r\n *          curl_multi_socket() or curl_multi_perform() must be called\r\n *          (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: The callback should return zero.\r\n */\r\ntypedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */\r\n                                         long timeout_ms, /* see above */\r\n                                         void *userp);    /* private callback\r\n                                                             pointer */\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,\r\n                                        int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,\r\n                                               curl_socket_t s,\r\n                                               int ev_bitmask,\r\n                                               int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,\r\n                                            int *running_handles);\r\n\r\n#ifndef CURL_ALLOW_OLD_MULTI_SOCKET\r\n/* This macro below was added in 7.16.3 to push users who recompile to use\r\n   the new curl_multi_socket_action() instead of the old curl_multi_socket()\r\n*/\r\n#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)\r\n#endif\r\n\r\n/*\r\n * Name:    curl_multi_timeout()\r\n *\r\n * Desc:    Returns the maximum number of milliseconds the app is allowed to\r\n *          wait before curl_multi_socket() or curl_multi_perform() must be\r\n *          called (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,\r\n                                         long *milliseconds);\r\n\r\n#undef CINIT /* re-using the same name as in curl.h */\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLMOPT_/**/name = type + number\r\n#endif\r\n\r\ntypedef enum {\r\n  /* This is the socket callback function pointer */\r\n  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),\r\n\r\n  /* This is the argument passed to the socket callback */\r\n  CINIT(SOCKETDATA, OBJECTPOINT, 2),\r\n\r\n    /* set to 1 to enable pipelining for this multi handle */\r\n  CINIT(PIPELINING, LONG, 3),\r\n\r\n   /* This is the timer callback function pointer */\r\n  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),\r\n\r\n  /* This is the argument passed to the timer callback */\r\n  CINIT(TIMERDATA, OBJECTPOINT, 5),\r\n\r\n  /* maximum number of entries in the connection cache */\r\n  CINIT(MAXCONNECTS, LONG, 6),\r\n\r\n  CURLMOPT_LASTENTRY /* the last unused */\r\n} CURLMoption;\r\n\r\n\r\n/*\r\n * Name:    curl_multi_setopt()\r\n *\r\n * Desc:    Sets options for the multi handle.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,\r\n                                        CURLMoption option, ...);\r\n\r\n\r\n/*\r\n * Name:    curl_multi_assign()\r\n *\r\n * Desc:    This function sets an association in the multi handle between the\r\n *          given socket and a private pointer of the application. This is\r\n *          (only) useful for curl_multi_socket uses.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,\r\n                                        curl_socket_t sockfd, void *sockp);\r\n\r\n#ifdef __cplusplus\r\n} /* end of extern \"C\" */\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/stdcheaders.h",
    "content": "#ifndef __STDC_HEADERS_H\r\n#define __STDC_HEADERS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <sys/types.h>\r\n\r\nsize_t fread (void *, size_t, size_t, FILE *);\r\nsize_t fwrite (const void *, size_t, size_t, FILE *);\r\n\r\nint strcasecmp(const char *, const char *);\r\nint strncasecmp(const char *, const char *, size_t);\r\n\r\n#endif /* __STDC_HEADERS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/include/curl/typecheck-gcc.h",
    "content": "#ifndef __CURL_TYPECHECK_GCC_H\r\n#define __CURL_TYPECHECK_GCC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* wraps curl_easy_setopt() with typechecking */\r\n\r\n/* To add a new kind of warning, add an\r\n *   if(_curl_is_sometype_option(_curl_opt))\r\n *     if(!_curl_is_sometype(value))\r\n *       _curl_easy_setopt_err_sometype();\r\n * block and define _curl_is_sometype_option, _curl_is_sometype and\r\n * _curl_easy_setopt_err_sometype below\r\n *\r\n * NOTE: We use two nested 'if' statements here instead of the && operator, in\r\n *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x\r\n *       when compiling with -Wlogical-op.\r\n *\r\n * To add an option that uses the same type as an existing option, you'll just\r\n * need to extend the appropriate _curl_*_option macro\r\n */\r\n#define curl_easy_setopt(handle, option, value)                               \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (option) _curl_opt = option;                                     \\\r\n  if(__builtin_constant_p(_curl_opt)) {                                       \\\r\n    if(_curl_is_long_option(_curl_opt))                                       \\\r\n      if(!_curl_is_long(value))                                               \\\r\n        _curl_easy_setopt_err_long();                                         \\\r\n    if(_curl_is_off_t_option(_curl_opt))                                      \\\r\n      if(!_curl_is_off_t(value))                                              \\\r\n        _curl_easy_setopt_err_curl_off_t();                                   \\\r\n    if(_curl_is_string_option(_curl_opt))                                     \\\r\n      if(!_curl_is_string(value))                                             \\\r\n        _curl_easy_setopt_err_string();                                       \\\r\n    if(_curl_is_write_cb_option(_curl_opt))                                   \\\r\n      if(!_curl_is_write_cb(value))                                           \\\r\n        _curl_easy_setopt_err_write_callback();                               \\\r\n    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \\\r\n      if(!_curl_is_read_cb(value))                                            \\\r\n        _curl_easy_setopt_err_read_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \\\r\n      if(!_curl_is_ioctl_cb(value))                                           \\\r\n        _curl_easy_setopt_err_ioctl_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \\\r\n      if(!_curl_is_sockopt_cb(value))                                         \\\r\n        _curl_easy_setopt_err_sockopt_cb();                                   \\\r\n    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \\\r\n      if(!_curl_is_opensocket_cb(value))                                      \\\r\n        _curl_easy_setopt_err_opensocket_cb();                                \\\r\n    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \\\r\n      if(!_curl_is_progress_cb(value))                                        \\\r\n        _curl_easy_setopt_err_progress_cb();                                  \\\r\n    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \\\r\n      if(!_curl_is_debug_cb(value))                                           \\\r\n        _curl_easy_setopt_err_debug_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \\\r\n      if(!_curl_is_ssl_ctx_cb(value))                                         \\\r\n        _curl_easy_setopt_err_ssl_ctx_cb();                                   \\\r\n    if(_curl_is_conv_cb_option(_curl_opt))                                    \\\r\n      if(!_curl_is_conv_cb(value))                                            \\\r\n        _curl_easy_setopt_err_conv_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \\\r\n      if(!_curl_is_seek_cb(value))                                            \\\r\n        _curl_easy_setopt_err_seek_cb();                                      \\\r\n    if(_curl_is_cb_data_option(_curl_opt))                                    \\\r\n      if(!_curl_is_cb_data(value))                                            \\\r\n        _curl_easy_setopt_err_cb_data();                                      \\\r\n    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \\\r\n      if(!_curl_is_error_buffer(value))                                       \\\r\n        _curl_easy_setopt_err_error_buffer();                                 \\\r\n    if((_curl_opt) == CURLOPT_STDERR)                                         \\\r\n      if(!_curl_is_FILE(value))                                               \\\r\n        _curl_easy_setopt_err_FILE();                                         \\\r\n    if(_curl_is_postfields_option(_curl_opt))                                 \\\r\n      if(!_curl_is_postfields(value))                                         \\\r\n        _curl_easy_setopt_err_postfields();                                   \\\r\n    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \\\r\n      if(!_curl_is_arr((value), struct curl_httppost))                        \\\r\n        _curl_easy_setopt_err_curl_httpost();                                 \\\r\n    if(_curl_is_slist_option(_curl_opt))                                      \\\r\n      if(!_curl_is_arr((value), struct curl_slist))                           \\\r\n        _curl_easy_setopt_err_curl_slist();                                   \\\r\n    if((_curl_opt) == CURLOPT_SHARE)                                          \\\r\n      if(!_curl_is_ptr((value), CURLSH))                                      \\\r\n        _curl_easy_setopt_err_CURLSH();                                       \\\r\n  }                                                                           \\\r\n  curl_easy_setopt(handle, _curl_opt, value);                                 \\\r\n})\r\n\r\n/* wraps curl_easy_getinfo() with typechecking */\r\n/* FIXME: don't allow const pointers */\r\n#define curl_easy_getinfo(handle, info, arg)                                  \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (info) _curl_info = info;                                        \\\r\n  if(__builtin_constant_p(_curl_info)) {                                      \\\r\n    if(_curl_is_string_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), char *))                                        \\\r\n        _curl_easy_getinfo_err_string();                                      \\\r\n    if(_curl_is_long_info(_curl_info))                                        \\\r\n      if(!_curl_is_arr((arg), long))                                          \\\r\n        _curl_easy_getinfo_err_long();                                        \\\r\n    if(_curl_is_double_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), double))                                        \\\r\n        _curl_easy_getinfo_err_double();                                      \\\r\n    if(_curl_is_slist_info(_curl_info))                                       \\\r\n      if(!_curl_is_arr((arg), struct curl_slist *))                           \\\r\n        _curl_easy_getinfo_err_curl_slist();                                  \\\r\n  }                                                                           \\\r\n  curl_easy_getinfo(handle, _curl_info, arg);                                 \\\r\n})\r\n\r\n/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),\r\n * for now just make sure that the functions are called with three\r\n * arguments\r\n */\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n\r\n\r\n/* the actual warnings, triggered by calling the _curl_easy_setopt_err*\r\n * functions */\r\n\r\n/* To define a new warning, use _CURL_WARNING(identifier, \"message\") */\r\n#define _CURL_WARNING(id, message)                                            \\\r\n  static void __attribute__((__warning__(message)))                           \\\r\n  __attribute__((__unused__)) __attribute__((__noinline__))                   \\\r\n  id(void) { __asm__(\"\"); }\r\n\r\n_CURL_WARNING(_curl_easy_setopt_err_long,\r\n  \"curl_easy_setopt expects a long argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,\r\n  \"curl_easy_setopt expects a curl_off_t argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_string,\r\n              \"curl_easy_setopt expects a \"\r\n              \"string (char* or char[]) argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_write_callback,\r\n  \"curl_easy_setopt expects a curl_write_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_read_cb,\r\n  \"curl_easy_setopt expects a curl_read_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,\r\n  \"curl_easy_setopt expects a curl_ioctl_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,\r\n  \"curl_easy_setopt expects a curl_sockopt_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,\r\n              \"curl_easy_setopt expects a \"\r\n              \"curl_opensocket_callback argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_progress_cb,\r\n  \"curl_easy_setopt expects a curl_progress_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_debug_cb,\r\n  \"curl_easy_setopt expects a curl_debug_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,\r\n  \"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_conv_cb,\r\n  \"curl_easy_setopt expects a curl_conv_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_seek_cb,\r\n  \"curl_easy_setopt expects a curl_seek_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_cb_data,\r\n              \"curl_easy_setopt expects a \"\r\n              \"private data pointer as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_error_buffer,\r\n              \"curl_easy_setopt expects a \"\r\n              \"char buffer of CURL_ERROR_SIZE as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_FILE,\r\n  \"curl_easy_setopt expects a FILE* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_postfields,\r\n  \"curl_easy_setopt expects a void* or char* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,\r\n  \"curl_easy_setopt expects a struct curl_httppost* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_slist,\r\n  \"curl_easy_setopt expects a struct curl_slist* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_CURLSH,\r\n  \"curl_easy_setopt expects a CURLSH* argument for this option\")\r\n\r\n_CURL_WARNING(_curl_easy_getinfo_err_string,\r\n  \"curl_easy_getinfo expects a pointer to char * for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_long,\r\n  \"curl_easy_getinfo expects a pointer to long for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_double,\r\n  \"curl_easy_getinfo expects a pointer to double for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,\r\n  \"curl_easy_getinfo expects a pointer to struct curl_slist * for this info\")\r\n\r\n/* groups of curl_easy_setops options that take the same type of argument */\r\n\r\n/* To add a new option to one of the groups, just add\r\n *   (option) == CURLOPT_SOMETHING\r\n * to the or-expression. If the option takes a long or curl_off_t, you don't\r\n * have to do anything\r\n */\r\n\r\n/* evaluates to true if option takes a long argument */\r\n#define _curl_is_long_option(option)                                          \\\r\n  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)\r\n\r\n#define _curl_is_off_t_option(option)                                         \\\r\n  ((option) > CURLOPTTYPE_OFF_T)\r\n\r\n/* evaluates to true if option takes a char* argument */\r\n#define _curl_is_string_option(option)                                        \\\r\n  ((option) == CURLOPT_URL ||                                                 \\\r\n   (option) == CURLOPT_PROXY ||                                               \\\r\n   (option) == CURLOPT_INTERFACE ||                                           \\\r\n   (option) == CURLOPT_NETRC_FILE ||                                          \\\r\n   (option) == CURLOPT_USERPWD ||                                             \\\r\n   (option) == CURLOPT_USERNAME ||                                            \\\r\n   (option) == CURLOPT_PASSWORD ||                                            \\\r\n   (option) == CURLOPT_PROXYUSERPWD ||                                        \\\r\n   (option) == CURLOPT_PROXYUSERNAME ||                                       \\\r\n   (option) == CURLOPT_PROXYPASSWORD ||                                       \\\r\n   (option) == CURLOPT_NOPROXY ||                                             \\\r\n   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \\\r\n   (option) == CURLOPT_REFERER ||                                             \\\r\n   (option) == CURLOPT_USERAGENT ||                                           \\\r\n   (option) == CURLOPT_COOKIE ||                                              \\\r\n   (option) == CURLOPT_COOKIEFILE ||                                          \\\r\n   (option) == CURLOPT_COOKIEJAR ||                                           \\\r\n   (option) == CURLOPT_COOKIELIST ||                                          \\\r\n   (option) == CURLOPT_FTPPORT ||                                             \\\r\n   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \\\r\n   (option) == CURLOPT_FTP_ACCOUNT ||                                         \\\r\n   (option) == CURLOPT_RANGE ||                                               \\\r\n   (option) == CURLOPT_CUSTOMREQUEST ||                                       \\\r\n   (option) == CURLOPT_SSLCERT ||                                             \\\r\n   (option) == CURLOPT_SSLCERTTYPE ||                                         \\\r\n   (option) == CURLOPT_SSLKEY ||                                              \\\r\n   (option) == CURLOPT_SSLKEYTYPE ||                                          \\\r\n   (option) == CURLOPT_KEYPASSWD ||                                           \\\r\n   (option) == CURLOPT_SSLENGINE ||                                           \\\r\n   (option) == CURLOPT_CAINFO ||                                              \\\r\n   (option) == CURLOPT_CAPATH ||                                              \\\r\n   (option) == CURLOPT_RANDOM_FILE ||                                         \\\r\n   (option) == CURLOPT_EGDSOCKET ||                                           \\\r\n   (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \\\r\n   (option) == CURLOPT_KRBLEVEL ||                                            \\\r\n   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \\\r\n   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \\\r\n   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \\\r\n   (option) == CURLOPT_CRLFILE ||                                             \\\r\n   (option) == CURLOPT_ISSUERCERT ||                                          \\\r\n   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \\\r\n   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \\\r\n   (option) == CURLOPT_MAIL_FROM ||                                           \\\r\n   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \\\r\n   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \\\r\n   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a curl_write_callback argument */\r\n#define _curl_is_write_cb_option(option)                                      \\\r\n  ((option) == CURLOPT_HEADERFUNCTION ||                                      \\\r\n   (option) == CURLOPT_WRITEFUNCTION)\r\n\r\n/* evaluates to true if option takes a curl_conv_callback argument */\r\n#define _curl_is_conv_cb_option(option)                                       \\\r\n  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \\\r\n   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \\\r\n   (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)\r\n\r\n/* evaluates to true if option takes a data argument to pass to a callback */\r\n#define _curl_is_cb_data_option(option)                                       \\\r\n  ((option) == CURLOPT_WRITEDATA ||                                           \\\r\n   (option) == CURLOPT_READDATA ||                                            \\\r\n   (option) == CURLOPT_IOCTLDATA ||                                           \\\r\n   (option) == CURLOPT_SOCKOPTDATA ||                                         \\\r\n   (option) == CURLOPT_OPENSOCKETDATA ||                                      \\\r\n   (option) == CURLOPT_PROGRESSDATA ||                                        \\\r\n   (option) == CURLOPT_WRITEHEADER ||                                         \\\r\n   (option) == CURLOPT_DEBUGDATA ||                                           \\\r\n   (option) == CURLOPT_SSL_CTX_DATA ||                                        \\\r\n   (option) == CURLOPT_SEEKDATA ||                                            \\\r\n   (option) == CURLOPT_PRIVATE ||                                             \\\r\n   (option) == CURLOPT_SSH_KEYDATA ||                                         \\\r\n   (option) == CURLOPT_INTERLEAVEDATA ||                                      \\\r\n   (option) == CURLOPT_CHUNK_DATA ||                                          \\\r\n   (option) == CURLOPT_FNMATCH_DATA ||                                        \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a POST data argument (void* or char*) */\r\n#define _curl_is_postfields_option(option)                                    \\\r\n  ((option) == CURLOPT_POSTFIELDS ||                                          \\\r\n   (option) == CURLOPT_COPYPOSTFIELDS ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a struct curl_slist * argument */\r\n#define _curl_is_slist_option(option)                                         \\\r\n  ((option) == CURLOPT_HTTPHEADER ||                                          \\\r\n   (option) == CURLOPT_HTTP200ALIASES ||                                      \\\r\n   (option) == CURLOPT_QUOTE ||                                               \\\r\n   (option) == CURLOPT_POSTQUOTE ||                                           \\\r\n   (option) == CURLOPT_PREQUOTE ||                                            \\\r\n   (option) == CURLOPT_TELNETOPTIONS ||                                       \\\r\n   (option) == CURLOPT_MAIL_RCPT ||                                           \\\r\n   0)\r\n\r\n/* groups of curl_easy_getinfo infos that take the same type of argument */\r\n\r\n/* evaluates to true if info expects a pointer to char * argument */\r\n#define _curl_is_string_info(info)                                            \\\r\n  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)\r\n\r\n/* evaluates to true if info expects a pointer to long argument */\r\n#define _curl_is_long_info(info)                                              \\\r\n  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)\r\n\r\n/* evaluates to true if info expects a pointer to double argument */\r\n#define _curl_is_double_info(info)                                            \\\r\n  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)\r\n\r\n/* true if info expects a pointer to struct curl_slist * argument */\r\n#define _curl_is_slist_info(info)                                             \\\r\n  (CURLINFO_SLIST < (info))\r\n\r\n\r\n/* typecheck helpers -- check whether given expression has requested type*/\r\n\r\n/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,\r\n * otherwise define a new macro. Search for __builtin_types_compatible_p\r\n * in the GCC manual.\r\n * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is\r\n * the actual expression passed to the curl_easy_setopt macro. This\r\n * means that you can only apply the sizeof and __typeof__ operators, no\r\n * == or whatsoever.\r\n */\r\n\r\n/* XXX: should evaluate to true iff expr is a pointer */\r\n#define _curl_is_any_ptr(expr)                                                \\\r\n  (sizeof(expr) == sizeof(void*))\r\n\r\n/* evaluates to true if expr is NULL */\r\n/* XXX: must not evaluate expr, so this check is not accurate */\r\n#define _curl_is_NULL(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))\r\n\r\n/* evaluates to true if expr is type*, const type* or NULL */\r\n#define _curl_is_ptr(expr, type)                                              \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), const type *))\r\n\r\n/* evaluates to true if expr is one of type[], type*, NULL or const type* */\r\n#define _curl_is_arr(expr, type)                                              \\\r\n  (_curl_is_ptr((expr), type) ||                                              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type []))\r\n\r\n/* evaluates to true if expr is a string */\r\n#define _curl_is_string(expr)                                                 \\\r\n  (_curl_is_arr((expr), char) ||                                              \\\r\n   _curl_is_arr((expr), signed char) ||                                       \\\r\n   _curl_is_arr((expr), unsigned char))\r\n\r\n/* evaluates to true if expr is a long (no matter the signedness)\r\n * XXX: for now, int is also accepted (and therefore short and char, which\r\n * are promoted to int when passed to a variadic function) */\r\n#define _curl_is_long(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \\\r\n   __builtin_types_compatible_p(__typeof__(expr), int) ||                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed int) ||              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned int) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), short) ||                   \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed short) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned short) ||          \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed char) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned char))\r\n\r\n/* evaluates to true if expr is of type curl_off_t */\r\n#define _curl_is_off_t(expr)                                                  \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))\r\n\r\n/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */\r\n/* XXX: also check size of an char[] array? */\r\n#define _curl_is_error_buffer(expr)                                           \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char[]))\r\n\r\n/* evaluates to true if expr is of type (const) void* or (const) FILE* */\r\n#if 0\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_ptr((expr), FILE))\r\n#else /* be less strict */\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  _curl_is_any_ptr(expr)\r\n#endif\r\n\r\n/* evaluates to true if expr is of type FILE* */\r\n#define _curl_is_FILE(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), FILE *))\r\n\r\n/* evaluates to true if expr can be passed as POST data (void* or char*) */\r\n#define _curl_is_postfields(expr)                                             \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_arr((expr), char))\r\n\r\n/* FIXME: the whole callback checking is messy...\r\n * The idea is to tolerate char vs. void and const vs. not const\r\n * pointers in arguments at least\r\n */\r\n/* helper: __builtin_types_compatible_p distinguishes between functions and\r\n * function pointers, hide it */\r\n#define _curl_callback_compatible(func, type)                                 \\\r\n  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(func), type*))\r\n\r\n/* evaluates to true if expr is of type curl_read_callback or \"similar\" */\r\n#define _curl_is_read_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback6))\r\ntypedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_write_callback or \"similar\" */\r\n#define _curl_is_write_cb(expr)                                               \\\r\n  (_curl_is_read_cb(expr) ||                                            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_write_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback6))\r\ntypedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback2)(const char *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback5)(const void *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_ioctl_callback or \"similar\" */\r\n#define _curl_is_ioctl_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback4))\r\ntypedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);\r\ntypedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);\r\ntypedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);\r\ntypedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);\r\n\r\n/* evaluates to true if expr is of type curl_sockopt_callback or \"similar\" */\r\n#define _curl_is_sockopt_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback2))\r\ntypedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);\r\ntypedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,\r\n                                      curlsocktype);\r\n\r\n/* evaluates to true if expr is of type curl_opensocket_callback or\r\n   \"similar\" */\r\n#define _curl_is_opensocket_cb(expr)                                    \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback4))\r\ntypedef curl_socket_t (_curl_opensocket_callback1)\r\n  (void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback2)\r\n  (void *, curlsocktype, const struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback3)\r\n  (const void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback4)\r\n  (const void *, curlsocktype, const struct curl_sockaddr *);\r\n\r\n/* evaluates to true if expr is of type curl_progress_callback or \"similar\" */\r\n#define _curl_is_progress_cb(expr)                                      \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback2))\r\ntypedef int (_curl_progress_callback1)(void *,\r\n    double, double, double, double);\r\ntypedef int (_curl_progress_callback2)(const void *,\r\n    double, double, double, double);\r\n\r\n/* evaluates to true if expr is of type curl_debug_callback or \"similar\" */\r\n#define _curl_is_debug_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback8))\r\ntypedef int (_curl_debug_callback1) (CURL *,\r\n    curl_infotype, char *, size_t, void *);\r\ntypedef int (_curl_debug_callback2) (CURL *,\r\n    curl_infotype, char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback3) (CURL *,\r\n    curl_infotype, const char *, size_t, void *);\r\ntypedef int (_curl_debug_callback4) (CURL *,\r\n    curl_infotype, const char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback5) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback6) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback7) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback8) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, const void *);\r\n\r\n/* evaluates to true if expr is of type curl_ssl_ctx_callback or \"similar\" */\r\n/* this is getting even messier... */\r\n#define _curl_is_ssl_ctx_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))\r\ntypedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);\r\n#ifdef HEADER_SSL_H\r\n/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX\r\n * this will of course break if we're included before OpenSSL headers...\r\n */\r\ntypedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,\r\n                                           const void *);\r\n#else\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;\r\n#endif\r\n\r\n/* evaluates to true if expr is of type curl_conv_callback or \"similar\" */\r\n#define _curl_is_conv_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback4))\r\ntypedef CURLcode (*_curl_conv_callback1)(char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback3)(void *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);\r\n\r\n/* evaluates to true if expr is of type curl_seek_callback or \"similar\" */\r\n#define _curl_is_seek_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback2))\r\ntypedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);\r\ntypedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);\r\n\r\n\r\n#endif /* __CURL_TYPECHECK_GCC_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/amigaos.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(__AMIGA__) && !defined(__ixemul__)\r\n\r\n#include <amitcp/socketbasetags.h>\r\n\r\n#include \"amigaos.h\"\r\n\r\nstruct Library *SocketBase = NULL;\r\nextern int errno, h_errno;\r\n\r\n#ifdef __libnix__\r\n#include <stabs.h>\r\nvoid __request(const char *msg);\r\n#else\r\n# define __request( msg )       Printf( msg \"\\n\\a\")\r\n#endif\r\n\r\nvoid Curl_amiga_cleanup()\r\n{\r\n  if(SocketBase) {\r\n    CloseLibrary(SocketBase);\r\n    SocketBase = NULL;\r\n  }\r\n}\r\n\r\nbool Curl_amiga_init()\r\n{\r\n  if(!SocketBase)\r\n    SocketBase = OpenLibrary(\"bsdsocket.library\", 4);\r\n\r\n  if(!SocketBase) {\r\n    __request(\"No TCP/IP Stack running!\");\r\n    return FALSE;\r\n  }\r\n\r\n  if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,\r\n                    SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) \"cURL\",\r\n                    TAG_DONE)) {\r\n    __request(\"SocketBaseTags ERROR\");\r\n    return FALSE;\r\n  }\r\n\r\n#ifndef __libnix__\r\n  atexit(Curl_amiga_cleanup);\r\n#endif\r\n\r\n  return TRUE;\r\n}\r\n\r\n#ifdef __libnix__\r\nADD2EXIT(Curl_amiga_cleanup,-50);\r\n#endif\r\n\r\n#endif /* __AMIGA__ && ! __ixemul__ */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/amigaos.h",
    "content": "#ifndef HEADER_CURL_AMIGAOS_H\r\n#define HEADER_CURL_AMIGAOS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(__AMIGA__) && !defined(__ixemul__)\r\n\r\nbool Curl_amiga_init();\r\nvoid Curl_amiga_cleanup();\r\n\r\n#else\r\n\r\n#define Curl_amiga_init() 1\r\n#define Curl_amiga_cleanup() Curl_nop_stmt\r\n\r\n#endif\r\n\r\n#endif /* HEADER_CURL_AMIGAOS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/arpa_telnet.h",
    "content": "#ifndef HEADER_CURL_ARPA_TELNET_H\r\n#define HEADER_CURL_ARPA_TELNET_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifndef CURL_DISABLE_TELNET\r\n/*\r\n * Telnet option defines. Add more here if in need.\r\n */\r\n#define CURL_TELOPT_BINARY   0  /* binary 8bit data */\r\n#define CURL_TELOPT_ECHO     1  /* just echo! */\r\n#define CURL_TELOPT_SGA      3  /* Suppress Go Ahead */\r\n#define CURL_TELOPT_EXOPL  255  /* EXtended OPtions List */\r\n#define CURL_TELOPT_TTYPE   24  /* Terminal TYPE */\r\n#define CURL_TELOPT_NAWS    31  /* Negotiate About Window Size */\r\n#define CURL_TELOPT_XDISPLOC 35 /* X DISPlay LOCation */\r\n\r\n#define CURL_TELOPT_NEW_ENVIRON 39  /* NEW ENVIRONment variables */\r\n#define CURL_NEW_ENV_VAR   0\r\n#define CURL_NEW_ENV_VALUE 1\r\n\r\n/*\r\n * The telnet options represented as strings\r\n */\r\nstatic const char * const telnetoptions[]=\r\n{\r\n  \"BINARY\",      \"ECHO\",           \"RCP\",           \"SUPPRESS GO AHEAD\",\r\n  \"NAME\",        \"STATUS\",         \"TIMING MARK\",   \"RCTE\",\r\n  \"NAOL\",        \"NAOP\",           \"NAOCRD\",        \"NAOHTS\",\r\n  \"NAOHTD\",      \"NAOFFD\",         \"NAOVTS\",        \"NAOVTD\",\r\n  \"NAOLFD\",      \"EXTEND ASCII\",   \"LOGOUT\",        \"BYTE MACRO\",\r\n  \"DE TERMINAL\", \"SUPDUP\",         \"SUPDUP OUTPUT\", \"SEND LOCATION\",\r\n  \"TERM TYPE\",   \"END OF RECORD\",  \"TACACS UID\",    \"OUTPUT MARKING\",\r\n  \"TTYLOC\",      \"3270 REGIME\",    \"X3 PAD\",        \"NAWS\",\r\n  \"TERM SPEED\",  \"LFLOW\",          \"LINEMODE\",      \"XDISPLOC\",\r\n  \"OLD-ENVIRON\", \"AUTHENTICATION\", \"ENCRYPT\",       \"NEW-ENVIRON\"\r\n};\r\n\r\n#define CURL_TELOPT_MAXIMUM CURL_TELOPT_NEW_ENVIRON\r\n\r\n#define CURL_TELOPT_OK(x) ((x) <= CURL_TELOPT_MAXIMUM)\r\n#define CURL_TELOPT(x)    telnetoptions[x]\r\n\r\n#define CURL_NTELOPTS 40\r\n\r\n/*\r\n * First some defines\r\n */\r\n#define CURL_xEOF 236 /* End Of File */\r\n#define CURL_SE   240 /* Sub negotiation End */\r\n#define CURL_NOP  241 /* No OPeration */\r\n#define CURL_DM   242 /* Data Mark */\r\n#define CURL_GA   249 /* Go Ahead, reverse the line */\r\n#define CURL_SB   250 /* SuBnegotiation */\r\n#define CURL_WILL 251 /* Our side WILL use this option */\r\n#define CURL_WONT 252 /* Our side WON'T use this option */\r\n#define CURL_DO   253 /* DO use this option! */\r\n#define CURL_DONT 254 /* DON'T use this option! */\r\n#define CURL_IAC  255 /* Interpret As Command */\r\n\r\n/*\r\n * Then those numbers represented as strings:\r\n */\r\nstatic const char * const telnetcmds[]=\r\n{\r\n  \"EOF\",  \"SUSP\",  \"ABORT\", \"EOR\",  \"SE\",\r\n  \"NOP\",  \"DMARK\", \"BRK\",   \"IP\",   \"AO\",\r\n  \"AYT\",  \"EC\",    \"EL\",    \"GA\",   \"SB\",\r\n  \"WILL\", \"WONT\",  \"DO\",    \"DONT\", \"IAC\"\r\n};\r\n\r\n#define CURL_TELCMD_MINIMUM CURL_xEOF /* the first one */\r\n#define CURL_TELCMD_MAXIMUM CURL_IAC  /* surprise, 255 is the last one! ;-) */\r\n\r\n#define CURL_TELQUAL_IS   0\r\n#define CURL_TELQUAL_SEND 1\r\n#define CURL_TELQUAL_INFO 2\r\n#define CURL_TELQUAL_NAME 3\r\n\r\n#define CURL_TELCMD_OK(x) ( ((unsigned int)(x) >= CURL_TELCMD_MINIMUM) && \\\r\n                       ((unsigned int)(x) <= CURL_TELCMD_MAXIMUM) )\r\n#define CURL_TELCMD(x)    telnetcmds[(x)-CURL_TELCMD_MINIMUM]\r\n\r\n#endif /* CURL_DISABLE_TELNET */\r\n\r\n#endif /* HEADER_CURL_ARPA_TELNET_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/asyn-ares.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifdef HAVE_PROCESS_H\r\n#include <process.h>\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n/***********************************************************************\r\n * Only for ares-enabled builds\r\n * And only for functions that fulfill the asynch resolver backend API\r\n * as defined in asyn.h, nothing else belongs in this file!\r\n **********************************************************************/\r\n\r\n#ifdef CURLRES_ARES\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n#include \"multiif.h\"\r\n#include \"inet_pton.h\"\r\n#include \"connect.h\"\r\n#include \"select.h\"\r\n#include \"progress.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#  if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \\\r\n     (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))\r\n#    define CARES_STATICLIB\r\n#  endif\r\n#  include <ares.h>\r\n#  include <ares_version.h> /* really old c-ares didn't include this by\r\n                               itself */\r\n\r\n#if ARES_VERSION >= 0x010500\r\n/* c-ares 1.5.0 or later, the callback proto is modified */\r\n#define HAVE_CARES_CALLBACK_TIMEOUTS 1\r\n#endif\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstruct ResolverResults {\r\n  int num_pending; /* number of ares_gethostbyname() requests */\r\n  Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares parts */\r\n  int last_status;\r\n};\r\n\r\n/*\r\n * Curl_resolver_global_init() - the generic low-level asynchronous name\r\n * resolve API.  Called from curl_global_init() to initialize global resolver\r\n * environment.  Initializes ares library.\r\n */\r\nint Curl_resolver_global_init(void)\r\n{\r\n#ifdef CARES_HAVE_ARES_LIBRARY_INIT\r\n  if(ares_library_init(ARES_LIB_INIT_ALL)) {\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n#endif\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_resolver_global_cleanup()\r\n *\r\n * Called from curl_global_cleanup() to destroy global resolver environment.\r\n * Deinitializes ares library.\r\n */\r\nvoid Curl_resolver_global_cleanup(void)\r\n{\r\n#ifdef CARES_HAVE_ARES_LIBRARY_CLEANUP\r\n  ares_library_cleanup();\r\n#endif\r\n}\r\n\r\n/*\r\n * Curl_resolver_init()\r\n *\r\n * Called from curl_easy_init() -> Curl_open() to initialize resolver\r\n * URL-state specific environment ('resolver' member of the UrlState\r\n * structure).  Fills the passed pointer by the initialized ares_channel.\r\n */\r\nCURLcode Curl_resolver_init(void **resolver)\r\n{\r\n  int status = ares_init((ares_channel*)resolver);\r\n  if(status != ARES_SUCCESS) {\r\n    if(status == ARES_ENOMEM)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    else\r\n      return CURLE_FAILED_INIT;\r\n  }\r\n  return CURLE_OK;\r\n  /* make sure that all other returns from this function should destroy the\r\n     ares channel before returning error! */\r\n}\r\n\r\n/*\r\n * Curl_resolver_cleanup()\r\n *\r\n * Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver\r\n * URL-state specific environment ('resolver' member of the UrlState\r\n * structure).  Destroys the ares channel.\r\n */\r\nvoid Curl_resolver_cleanup(void *resolver)\r\n{\r\n  ares_destroy((ares_channel)resolver);\r\n}\r\n\r\n/*\r\n * Curl_resolver_duphandle()\r\n *\r\n * Called from curl_easy_duphandle() to duplicate resolver URL-state specific\r\n * environment ('resolver' member of the UrlState structure).  Duplicates the\r\n * 'from' ares channel and passes the resulting channel to the 'to' pointer.\r\n */\r\nint Curl_resolver_duphandle(void **to, void *from)\r\n{\r\n  /* Clone the ares channel for the new handle */\r\n  if(ARES_SUCCESS != ares_dup((ares_channel*)to,(ares_channel)from))\r\n    return CURLE_FAILED_INIT;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic void destroy_async_data (struct Curl_async *async);\r\n\r\n/*\r\n * Cancel all possibly still on-going resolves for this connection.\r\n */\r\nvoid Curl_resolver_cancel(struct connectdata *conn)\r\n{\r\n  if(conn && conn->data && conn->data->state.resolver)\r\n    ares_cancel((ares_channel)conn->data->state.resolver);\r\n  destroy_async_data(&conn->async);\r\n}\r\n\r\n/*\r\n * destroy_async_data() cleans up async resolver data.\r\n */\r\nstatic void destroy_async_data (struct Curl_async *async)\r\n{\r\n  if(async->hostname)\r\n    free(async->hostname);\r\n\r\n  if(async->os_specific) {\r\n    struct ResolverResults *res = (struct ResolverResults *)async->os_specific;\r\n    if(res) {\r\n      if(res->temp_ai) {\r\n        Curl_freeaddrinfo(res->temp_ai);\r\n        res->temp_ai = NULL;\r\n      }\r\n      free(res);\r\n    }\r\n    async->os_specific = NULL;\r\n  }\r\n\r\n  async->hostname = NULL;\r\n}\r\n\r\n/*\r\n * Curl_resolver_getsock() is called when someone from the outside world\r\n * (using curl_multi_fdset()) wants to get our fd_set setup and we're talking\r\n * with ares. The caller must make sure that this function is only called when\r\n * we have a working ares channel.\r\n *\r\n * Returns: sockets-in-use-bitmap\r\n */\r\n\r\nint Curl_resolver_getsock(struct connectdata *conn,\r\n                          curl_socket_t *socks,\r\n                          int numsocks)\r\n\r\n{\r\n  struct timeval maxtime;\r\n  struct timeval timebuf;\r\n  struct timeval *timeout;\r\n  long milli;\r\n  int max = ares_getsock((ares_channel)conn->data->state.resolver,\r\n                         (ares_socket_t *)socks, numsocks);\r\n\r\n  maxtime.tv_sec = CURL_TIMEOUT_RESOLVE;\r\n  maxtime.tv_usec = 0;\r\n\r\n  timeout = ares_timeout((ares_channel)conn->data->state.resolver, &maxtime,\r\n                         &timebuf);\r\n  milli = (timeout->tv_sec * 1000) + (timeout->tv_usec/1000);\r\n  if(milli == 0)\r\n    milli += 10;\r\n  Curl_expire(conn->data, milli);\r\n\r\n  return max;\r\n}\r\n\r\n/*\r\n * waitperform()\r\n *\r\n * 1) Ask ares what sockets it currently plays with, then\r\n * 2) wait for the timeout period to check for action on ares' sockets.\r\n * 3) tell ares to act on all the sockets marked as \"with action\"\r\n *\r\n * return number of sockets it worked on\r\n */\r\n\r\nstatic int waitperform(struct connectdata *conn, int timeout_ms)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  int nfds;\r\n  int bitmask;\r\n  ares_socket_t socks[ARES_GETSOCK_MAXNUM];\r\n  struct pollfd pfd[ARES_GETSOCK_MAXNUM];\r\n  int i;\r\n  int num = 0;\r\n\r\n  bitmask = ares_getsock((ares_channel)data->state.resolver, socks,\r\n                         ARES_GETSOCK_MAXNUM);\r\n\r\n  for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {\r\n    pfd[i].events = 0;\r\n    pfd[i].revents = 0;\r\n    if(ARES_GETSOCK_READABLE(bitmask, i)) {\r\n      pfd[i].fd = socks[i];\r\n      pfd[i].events |= POLLRDNORM|POLLIN;\r\n    }\r\n    if(ARES_GETSOCK_WRITABLE(bitmask, i)) {\r\n      pfd[i].fd = socks[i];\r\n      pfd[i].events |= POLLWRNORM|POLLOUT;\r\n    }\r\n    if(pfd[i].events != 0)\r\n      num++;\r\n    else\r\n      break;\r\n  }\r\n\r\n  if(num)\r\n    nfds = Curl_poll(pfd, num, timeout_ms);\r\n  else\r\n    nfds = 0;\r\n\r\n  if(!nfds)\r\n    /* Call ares_process() unconditonally here, even if we simply timed out\r\n       above, as otherwise the ares name resolve won't timeout! */\r\n    ares_process_fd((ares_channel)data->state.resolver, ARES_SOCKET_BAD,\r\n                    ARES_SOCKET_BAD);\r\n  else {\r\n    /* move through the descriptors and ask for processing on them */\r\n    for(i=0; i < num; i++)\r\n      ares_process_fd((ares_channel)data->state.resolver,\r\n                      pfd[i].revents & (POLLRDNORM|POLLIN)?\r\n                      pfd[i].fd:ARES_SOCKET_BAD,\r\n                      pfd[i].revents & (POLLWRNORM|POLLOUT)?\r\n                      pfd[i].fd:ARES_SOCKET_BAD);\r\n  }\r\n  return nfds;\r\n}\r\n\r\n/*\r\n * Curl_resolver_is_resolved() is called repeatedly to check if a previous\r\n * name resolve request has completed. It should also make sure to time-out if\r\n * the operation seems to take too long.\r\n *\r\n * Returns normal CURLcode errors.\r\n */\r\nCURLcode Curl_resolver_is_resolved(struct connectdata *conn,\r\n                                   struct Curl_dns_entry **dns)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ResolverResults *res = (struct ResolverResults *)\r\n    conn->async.os_specific;\r\n\r\n  *dns = NULL;\r\n\r\n  waitperform(conn, 0);\r\n\r\n  if(res && !res->num_pending) {\r\n    (void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);\r\n    /* temp_ai ownership is moved to the connection, so we need not free-up\r\n       them */\r\n    res->temp_ai = NULL;\r\n    destroy_async_data(&conn->async);\r\n    if(!conn->async.dns) {\r\n      failf(data, \"Could not resolve %s: %s (%s)\",\r\n            conn->bits.proxy?\"proxy\":\"host\",\r\n            conn->host.dispname,\r\n            ares_strerror(conn->async.status));\r\n      return conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:\r\n        CURLE_COULDNT_RESOLVE_HOST;\r\n    }\r\n    *dns = conn->async.dns;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_resolver_wait_resolv()\r\n *\r\n * waits for a resolve to finish. This function should be avoided since using\r\n * this risk getting the multi interface to \"hang\".\r\n *\r\n * If 'entry' is non-NULL, make it point to the resolved dns entry\r\n *\r\n * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and\r\n * CURLE_OPERATION_TIMEDOUT if a time-out occurred.\r\n */\r\nCURLcode Curl_resolver_wait_resolv(struct connectdata *conn,\r\n                                   struct Curl_dns_entry **entry)\r\n{\r\n  CURLcode rc=CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  long timeout;\r\n  struct timeval now = Curl_tvnow();\r\n  struct Curl_dns_entry *temp_entry;\r\n\r\n  timeout = Curl_timeleft(data, &now, TRUE);\r\n  if(!timeout)\r\n    timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */\r\n\r\n  /* Wait for the name resolve query to complete. */\r\n  for(;;) {\r\n    struct timeval *tvp, tv, store;\r\n    long timediff;\r\n    int itimeout;\r\n    int timeout_ms;\r\n\r\n    itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;\r\n\r\n    store.tv_sec = itimeout/1000;\r\n    store.tv_usec = (itimeout%1000)*1000;\r\n\r\n    tvp = ares_timeout((ares_channel)data->state.resolver, &store, &tv);\r\n\r\n    /* use the timeout period ares returned to us above if less than one\r\n       second is left, otherwise just use 1000ms to make sure the progress\r\n       callback gets called frequent enough */\r\n    if(!tvp->tv_sec)\r\n      timeout_ms = (int)(tvp->tv_usec/1000);\r\n    else\r\n      timeout_ms = 1000;\r\n\r\n    waitperform(conn, timeout_ms);\r\n    Curl_resolver_is_resolved(conn,&temp_entry);\r\n\r\n    if(conn->async.done)\r\n      break;\r\n\r\n    if(Curl_pgrsUpdate(conn)) {\r\n      rc = CURLE_ABORTED_BY_CALLBACK;\r\n      timeout = -1; /* trigger the cancel below */\r\n    }\r\n    else {\r\n      struct timeval now2 = Curl_tvnow();\r\n      timediff = Curl_tvdiff(now2, now); /* spent time */\r\n      timeout -= timediff?timediff:1; /* always deduct at least 1 */\r\n      now = now2; /* for next loop */\r\n    }\r\n    if(timeout < 0) {\r\n      /* our timeout, so we cancel the ares operation */\r\n      ares_cancel((ares_channel)data->state.resolver);\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* Operation complete, if the lookup was successful we now have the entry\r\n     in the cache. */\r\n\r\n  if(entry)\r\n    *entry = conn->async.dns;\r\n\r\n  if(!conn->async.dns) {\r\n    /* a name was not resolved */\r\n    if((timeout < 0) || (conn->async.status == ARES_ETIMEOUT)) {\r\n      if(conn->bits.proxy) {\r\n        failf(data, \"Resolving proxy timed out: %s\", conn->proxy.dispname);\r\n        rc = CURLE_COULDNT_RESOLVE_PROXY;\r\n      }\r\n      else {\r\n        failf(data, \"Resolving host timed out: %s\", conn->host.dispname);\r\n        rc = CURLE_COULDNT_RESOLVE_HOST;\r\n      }\r\n    }\r\n    else if(conn->async.done) {\r\n      if(conn->bits.proxy) {\r\n        failf(data, \"Could not resolve proxy: %s (%s)\", conn->proxy.dispname,\r\n              ares_strerror(conn->async.status));\r\n        rc = CURLE_COULDNT_RESOLVE_PROXY;\r\n      }\r\n      else {\r\n        failf(data, \"Could not resolve host: %s (%s)\", conn->host.dispname,\r\n              ares_strerror(conn->async.status));\r\n        rc = CURLE_COULDNT_RESOLVE_HOST;\r\n      }\r\n    }\r\n    else\r\n      rc = CURLE_OPERATION_TIMEDOUT;\r\n\r\n    /* close the connection, since we can't return failure here without\r\n       cleaning up this connection properly */\r\n    conn->bits.close = TRUE;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n/* Connects results to the list */\r\nstatic void compound_results(struct ResolverResults *res,\r\n                             Curl_addrinfo *ai)\r\n{\r\n  Curl_addrinfo *ai_tail;\r\n  if(!ai)\r\n    return;\r\n  ai_tail = ai;\r\n\r\n  while(ai_tail->ai_next)\r\n    ai_tail = ai_tail->ai_next;\r\n\r\n  /* Add the new results to the list of old results. */\r\n  ai_tail->ai_next = res->temp_ai;\r\n  res->temp_ai = ai;\r\n}\r\n\r\n/*\r\n * ares_query_completed_cb() is the callback that ares will call when\r\n * the host query initiated by ares_gethostbyname() from Curl_getaddrinfo(),\r\n * when using ares, is completed either successfully or with failure.\r\n */\r\nstatic void query_completed_cb(void *arg,  /* (struct connectdata *) */\r\n                               int status,\r\n#ifdef HAVE_CARES_CALLBACK_TIMEOUTS\r\n                               int timeouts,\r\n#endif\r\n                               struct hostent *hostent)\r\n{\r\n  struct connectdata *conn = (struct connectdata *)arg;\r\n  struct ResolverResults *res;\r\n\r\n#ifdef HAVE_CARES_CALLBACK_TIMEOUTS\r\n  (void)timeouts; /* ignored */\r\n#endif\r\n\r\n  if(ARES_EDESTRUCTION == status)\r\n    /* when this ares handle is getting destroyed, the 'arg' pointer may not\r\n       be valid so only defer it when we know the 'status' says its fine! */\r\n    return;\r\n\r\n  res = (struct ResolverResults *)conn->async.os_specific;\r\n  res->num_pending--;\r\n\r\n  if(CURL_ASYNC_SUCCESS == status) {\r\n    Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port);\r\n    if(ai) {\r\n      compound_results(res, ai);\r\n    }\r\n  }\r\n  /* A successful result overwrites any previous error */\r\n  if(res->last_status != ARES_SUCCESS)\r\n    res->last_status = status;\r\n}\r\n\r\n/*\r\n * Curl_resolver_getaddrinfo() - when using ares\r\n *\r\n * Returns name information about the given hostname and port number. If\r\n * successful, the 'hostent' is returned and the forth argument will point to\r\n * memory we need to free after use. That memory *MUST* be freed with\r\n * Curl_freeaddrinfo(), nothing else.\r\n */\r\nCurl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,\r\n                                         const char *hostname,\r\n                                         int port,\r\n                                         int *waitp)\r\n{\r\n  char *bufp;\r\n  struct SessionHandle *data = conn->data;\r\n  struct in_addr in;\r\n  int family = PF_INET;\r\n#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */\r\n  struct in6_addr in6;\r\n#endif /* CURLRES_IPV6 */\r\n\r\n  *waitp = 0; /* default to synchronous response */\r\n\r\n  /* First check if this is an IPv4 address string */\r\n  if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {\r\n    /* This is a dotted IP address 123.123.123.123-style */\r\n    return Curl_ip2addr(AF_INET, &in, hostname, port);\r\n  }\r\n\r\n#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */\r\n  /* Otherwise, check if this is an IPv6 address string */\r\n  if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0)\r\n    /* This must be an IPv6 address literal.  */\r\n    return Curl_ip2addr(AF_INET6, &in6, hostname, port);\r\n\r\n  switch(conn->ip_version) {\r\n  default:\r\n#if ARES_VERSION >= 0x010601\r\n    family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older\r\n                           c-ares versions this just falls through and defaults\r\n                           to PF_INET */\r\n    break;\r\n#endif\r\n  case CURL_IPRESOLVE_V4:\r\n    family = PF_INET;\r\n    break;\r\n  case CURL_IPRESOLVE_V6:\r\n    family = PF_INET6;\r\n    break;\r\n  }\r\n#endif /* CURLRES_IPV6 */\r\n\r\n  bufp = strdup(hostname);\r\n  if(bufp) {\r\n    struct ResolverResults *res = NULL;\r\n    Curl_safefree(conn->async.hostname);\r\n    conn->async.hostname = bufp;\r\n    conn->async.port = port;\r\n    conn->async.done = FALSE;   /* not done */\r\n    conn->async.status = 0;     /* clear */\r\n    conn->async.dns = NULL;     /* clear */\r\n    res = calloc(sizeof(struct ResolverResults),1);\r\n    if(!res) {\r\n      Curl_safefree(conn->async.hostname);\r\n      conn->async.hostname = NULL;\r\n      return NULL;\r\n    }\r\n    conn->async.os_specific = res;\r\n\r\n    /* initial status - failed */\r\n    res->last_status = ARES_ENOTFOUND;\r\n#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */\r\n    if(family == PF_UNSPEC) {\r\n      if(Curl_ipv6works()) {\r\n        res->num_pending = 2;\r\n\r\n        /* areschannel is already setup in the Curl_open() function */\r\n        ares_gethostbyname((ares_channel)data->state.resolver, hostname,\r\n                            PF_INET, query_completed_cb, conn);\r\n        ares_gethostbyname((ares_channel)data->state.resolver, hostname,\r\n                            PF_INET6, query_completed_cb, conn);\r\n      }\r\n      else {\r\n        res->num_pending = 1;\r\n\r\n        /* areschannel is already setup in the Curl_open() function */\r\n        ares_gethostbyname((ares_channel)data->state.resolver, hostname,\r\n                            PF_INET, query_completed_cb, conn);\r\n      }\r\n    }\r\n    else\r\n#endif /* CURLRES_IPV6 */\r\n    {\r\n      res->num_pending = 1;\r\n\r\n      /* areschannel is already setup in the Curl_open() function */\r\n      ares_gethostbyname((ares_channel)data->state.resolver, hostname, family,\r\n                         query_completed_cb, conn);\r\n    }\r\n\r\n    *waitp = 1; /* expect asynchronous response */\r\n  }\r\n  return NULL; /* no struct yet */\r\n}\r\n\r\nCURLcode Curl_set_dns_servers(struct SessionHandle *data,\r\n                              char *servers)\r\n{\r\n  CURLcode result = CURLE_NOT_BUILT_IN;\r\n#if (ARES_VERSION >= 0x010704)\r\n  int ares_result = ares_set_servers_csv(data->state.resolver, servers);\r\n  switch(ares_result) {\r\n  case ARES_SUCCESS:\r\n    result = CURLE_OK;\r\n    break;\r\n  case ARES_ENOMEM:\r\n    result = CURLE_OUT_OF_MEMORY;\r\n    break;\r\n  case ARES_ENOTINITIALIZED:\r\n  case ARES_ENODATA:\r\n  case ARES_EBADSTR:\r\n  default:\r\n    result = CURLE_BAD_FUNCTION_ARGUMENT;\r\n    break;\r\n  }\r\n#else /* too old c-ares version! */\r\n  (void)data;\r\n  (void)servers;\r\n#endif\r\n  return result;\r\n}\r\n#endif /* CURLRES_ARES */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/asyn-thread.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#if defined(USE_THREADS_POSIX)\r\n#  ifdef HAVE_PTHREAD_H\r\n#    include <pthread.h>\r\n#  endif\r\n#elif defined(USE_THREADS_WIN32)\r\n#  ifdef HAVE_PROCESS_H\r\n#    include <process.h>\r\n#  endif\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n#ifdef HAVE_GETADDRINFO\r\n#  define RESOLVER_ENOMEM  EAI_MEMORY\r\n#else\r\n#  define RESOLVER_ENOMEM  ENOMEM\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n#include \"multiif.h\"\r\n#include \"inet_pton.h\"\r\n#include \"inet_ntop.h\"\r\n#include \"curl_threads.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/***********************************************************************\r\n * Only for threaded name resolves builds\r\n **********************************************************************/\r\n#ifdef CURLRES_THREADED\r\n\r\n/*\r\n * Curl_resolver_global_init()\r\n * Called from curl_global_init() to initialize global resolver environment.\r\n * Does nothing here.\r\n */\r\nint Curl_resolver_global_init(void)\r\n{\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_resolver_global_cleanup()\r\n * Called from curl_global_cleanup() to destroy global resolver environment.\r\n * Does nothing here.\r\n */\r\nvoid Curl_resolver_global_cleanup(void)\r\n{\r\n}\r\n\r\n/*\r\n * Curl_resolver_init()\r\n * Called from curl_easy_init() -> Curl_open() to initialize resolver\r\n * URL-state specific environment ('resolver' member of the UrlState\r\n * structure).  Does nothing here.\r\n */\r\nCURLcode Curl_resolver_init(void **resolver)\r\n{\r\n  (void)resolver;\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_resolver_cleanup()\r\n * Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver\r\n * URL-state specific environment ('resolver' member of the UrlState\r\n * structure).  Does nothing here.\r\n */\r\nvoid Curl_resolver_cleanup(void *resolver)\r\n{\r\n  (void)resolver;\r\n}\r\n\r\n/*\r\n * Curl_resolver_duphandle()\r\n * Called from curl_easy_duphandle() to duplicate resolver URL state-specific\r\n * environment ('resolver' member of the UrlState structure).  Does nothing\r\n * here.\r\n */\r\nint Curl_resolver_duphandle(void **to, void *from)\r\n{\r\n  (void)to;\r\n  (void)from;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic void destroy_async_data(struct Curl_async *);\r\n\r\n/*\r\n * Cancel all possibly still on-going resolves for this connection.\r\n */\r\nvoid Curl_resolver_cancel(struct connectdata *conn)\r\n{\r\n  destroy_async_data(&conn->async);\r\n}\r\n\r\n/* This function is used to init a threaded resolve */\r\nstatic bool init_resolve_thread(struct connectdata *conn,\r\n                                const char *hostname, int port,\r\n                                const struct addrinfo *hints);\r\n\r\n\r\n/* Data for synchronization between resolver thread and its parent */\r\nstruct thread_sync_data {\r\n  curl_mutex_t * mtx;\r\n  int done;\r\n\r\n  char * hostname;        /* hostname to resolve, Curl_async.hostname\r\n                             duplicate */\r\n  int port;\r\n  int sock_error;\r\n  Curl_addrinfo *res;\r\n#ifdef HAVE_GETADDRINFO\r\n  struct addrinfo hints;\r\n#endif\r\n};\r\n\r\nstruct thread_data {\r\n  curl_thread_t thread_hnd;\r\n  unsigned int poll_interval;\r\n  int interval_end;\r\n  struct thread_sync_data tsd;\r\n};\r\n\r\nstatic struct thread_sync_data *conn_thread_sync_data(struct connectdata *conn)\r\n{\r\n  return &(((struct thread_data *)conn->async.os_specific)->tsd);\r\n}\r\n\r\n#define CONN_THREAD_SYNC_DATA(conn) &(((conn)->async.os_specific)->tsd);\r\n\r\n/* Destroy resolver thread synchronization data */\r\nstatic\r\nvoid destroy_thread_sync_data(struct thread_sync_data * tsd)\r\n{\r\n  if(tsd->mtx) {\r\n    Curl_mutex_destroy(tsd->mtx);\r\n    free(tsd->mtx);\r\n  }\r\n\r\n  if(tsd->hostname)\r\n    free(tsd->hostname);\r\n\r\n  if(tsd->res)\r\n    Curl_freeaddrinfo(tsd->res);\r\n\r\n  memset(tsd,0,sizeof(*tsd));\r\n}\r\n\r\n/* Initialize resolver thread synchronization data */\r\nstatic\r\nint init_thread_sync_data(struct thread_sync_data * tsd,\r\n                           const char * hostname,\r\n                           int port,\r\n                           const struct addrinfo *hints)\r\n{\r\n  memset(tsd, 0, sizeof(*tsd));\r\n\r\n  tsd->port = port;\r\n#ifdef CURLRES_IPV6\r\n  DEBUGASSERT(hints);\r\n  tsd->hints = *hints;\r\n#else\r\n  (void) hints;\r\n#endif\r\n\r\n  tsd->mtx = malloc(sizeof(curl_mutex_t));\r\n  if(tsd->mtx == NULL)\r\n    goto err_exit;\r\n\r\n  Curl_mutex_init(tsd->mtx);\r\n\r\n  tsd->sock_error = CURL_ASYNC_SUCCESS;\r\n\r\n  /* Copying hostname string because original can be destroyed by parent\r\n   * thread during gethostbyname execution.\r\n   */\r\n  tsd->hostname = strdup(hostname);\r\n  if(!tsd->hostname)\r\n    goto err_exit;\r\n\r\n  return 1;\r\n\r\n err_exit:\r\n  /* Memory allocation failed */\r\n  destroy_thread_sync_data(tsd);\r\n  return 0;\r\n}\r\n\r\nstatic int getaddrinfo_complete(struct connectdata *conn)\r\n{\r\n  struct thread_sync_data *tsd = conn_thread_sync_data(conn);\r\n  int rc;\r\n\r\n  rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res);\r\n  /* The tsd->res structure has been copied to async.dns and perhaps the DNS\r\n     cache.  Set our copy to NULL so destroy_thread_sync_data doesn't free it.\r\n  */\r\n  tsd->res = NULL;\r\n\r\n  return rc;\r\n}\r\n\r\n\r\n#ifdef HAVE_GETADDRINFO\r\n\r\n/*\r\n * getaddrinfo_thread() resolves a name and then exits.\r\n *\r\n * For builds without ARES, but with ENABLE_IPV6, create a resolver thread\r\n * and wait on it.\r\n */\r\nstatic unsigned int CURL_STDCALL getaddrinfo_thread (void *arg)\r\n{\r\n  struct thread_sync_data *tsd = (struct thread_sync_data*)arg;\r\n  char   service [NI_MAXSERV];\r\n  int rc;\r\n\r\n  snprintf(service, sizeof(service), \"%d\", tsd->port);\r\n\r\n  rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);\r\n\r\n  if(rc != 0) {\r\n    tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;\r\n    if(tsd->sock_error == 0)\r\n      tsd->sock_error = RESOLVER_ENOMEM;\r\n  }\r\n\r\n  Curl_mutex_acquire(tsd->mtx);\r\n  tsd->done = 1;\r\n  Curl_mutex_release(tsd->mtx);\r\n\r\n  return 0;\r\n}\r\n\r\n#else /* HAVE_GETADDRINFO */\r\n\r\n/*\r\n * gethostbyname_thread() resolves a name and then exits.\r\n */\r\nstatic unsigned int CURL_STDCALL gethostbyname_thread (void *arg)\r\n{\r\n  struct thread_sync_data *tsd = (struct thread_sync_data *)arg;\r\n\r\n  tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port);\r\n\r\n  if(!tsd->res) {\r\n    tsd->sock_error = SOCKERRNO;\r\n    if(tsd->sock_error == 0)\r\n      tsd->sock_error = RESOLVER_ENOMEM;\r\n  }\r\n\r\n  Curl_mutex_acquire(tsd->mtx);\r\n  tsd->done = 1;\r\n  Curl_mutex_release(tsd->mtx);\r\n\r\n  return 0;\r\n}\r\n\r\n#endif /* HAVE_GETADDRINFO */\r\n\r\n/*\r\n * destroy_async_data() cleans up async resolver data and thread handle.\r\n */\r\nstatic void destroy_async_data (struct Curl_async *async)\r\n{\r\n  if(async->hostname)\r\n    free(async->hostname);\r\n\r\n  if(async->os_specific) {\r\n    struct thread_data *td = (struct thread_data*) async->os_specific;\r\n\r\n    if(td->thread_hnd != curl_thread_t_null)\r\n      Curl_thread_join(&td->thread_hnd);\r\n\r\n    destroy_thread_sync_data(&td->tsd);\r\n\r\n    free(async->os_specific);\r\n  }\r\n  async->hostname = NULL;\r\n  async->os_specific = NULL;\r\n}\r\n\r\n/*\r\n * init_resolve_thread() starts a new thread that performs the actual\r\n * resolve. This function returns before the resolve is done.\r\n *\r\n * Returns FALSE in case of failure, otherwise TRUE.\r\n */\r\nstatic bool init_resolve_thread (struct connectdata *conn,\r\n                                 const char *hostname, int port,\r\n                                 const struct addrinfo *hints)\r\n{\r\n  struct thread_data *td = calloc(1, sizeof(struct thread_data));\r\n  int err = RESOLVER_ENOMEM;\r\n\r\n  conn->async.os_specific = (void*) td;\r\n  if(!td)\r\n    goto err_exit;\r\n\r\n  conn->async.port = port;\r\n  conn->async.done = FALSE;\r\n  conn->async.status = 0;\r\n  conn->async.dns = NULL;\r\n  td->thread_hnd = curl_thread_t_null;\r\n\r\n  if(!init_thread_sync_data(&td->tsd, hostname, port, hints))\r\n    goto err_exit;\r\n\r\n  Curl_safefree(conn->async.hostname);\r\n  conn->async.hostname = strdup(hostname);\r\n  if(!conn->async.hostname)\r\n    goto err_exit;\r\n\r\n#ifdef HAVE_GETADDRINFO\r\n  td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd);\r\n#else\r\n  td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd);\r\n#endif\r\n\r\n  if(!td->thread_hnd) {\r\n#ifndef _WIN32_WCE\r\n    err = errno;\r\n#endif\r\n    goto err_exit;\r\n  }\r\n\r\n  return TRUE;\r\n\r\n err_exit:\r\n  destroy_async_data(&conn->async);\r\n\r\n  SET_ERRNO(err);\r\n\r\n  return FALSE;\r\n}\r\n\r\n#if defined(HAVE_GETADDRINFO) && !defined(HAVE_GAI_STRERROR) && !defined(WIN32)\r\n/* NetWare has getaddrinfo but lacks gai_strerror.\r\n   Windows has a gai_strerror but it is bad (not thread-safe) and the generic\r\n   socket error string function can be used for this pupose. */\r\nstatic const char *gai_strerror(int ecode)\r\n{\r\n  switch (ecode) {\r\n  case EAI_AGAIN:\r\n    return \"The name could not be resolved at this time\";\r\n  case EAI_BADFLAGS:\r\n    return \"The flags parameter had an invalid value\";\r\n  case EAI_FAIL:\r\n    return \"A non-recoverable error occurred when attempting to \"\r\n      \"resolve the name\";\r\n  case EAI_FAMILY:\r\n    return \"The address family was not recognized\";\r\n  case EAI_MEMORY:\r\n    return \"Out of memory\";\r\n  case EAI_NONAME:\r\n    return \"The name does not resolve for the supplied parameters\";\r\n  case EAI_SERVICE:\r\n    return \"The service passed was not recognized for the \"\r\n      \"specified socket type\"\r\n  case EAI_SOCKTYPE:\r\n    return \"The intended socket type was not recognized\"\r\n  case EAI_SYSTEM:\r\n    return \"A system error occurred\";\r\n  case EAI_OVERFLOW:\r\n    return \"An argument buffer overflowed\";\r\n  default:\r\n    return \"Unknown error\";\r\n\r\n/* define this now as this is a private implementation of said function */\r\n#define HAVE_GAI_STRERROR\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n * resolver_error() calls failf() with the appropriate message after a resolve\r\n * error\r\n */\r\n\r\nstatic void resolver_error(struct connectdata *conn, const char *host_or_proxy)\r\n{\r\n  failf(conn->data, \"Could not resolve %s: %s; %s\", host_or_proxy,\r\n        conn->async.hostname,\r\n#ifdef HAVE_GAI_STRERROR\r\n        /* NetWare doesn't have gai_strerror and on Windows it isn't deemed\r\n           thread-safe */\r\n        gai_strerror(conn->async.status)\r\n#else\r\n        Curl_strerror(conn, conn->async.status)\r\n#endif\r\n    );\r\n}\r\n\r\n/*\r\n * Curl_resolver_wait_resolv()\r\n *\r\n * waits for a resolve to finish. This function should be avoided since using\r\n * this risk getting the multi interface to \"hang\".\r\n *\r\n * If 'entry' is non-NULL, make it point to the resolved dns entry\r\n *\r\n * This is the version for resolves-in-a-thread.\r\n */\r\nCURLcode Curl_resolver_wait_resolv(struct connectdata *conn,\r\n                                   struct Curl_dns_entry **entry)\r\n{\r\n  struct thread_data   *td = (struct thread_data*) conn->async.os_specific;\r\n  CURLcode rc = CURLE_OK;\r\n\r\n  DEBUGASSERT(conn && td);\r\n\r\n  /* wait for the thread to resolve the name */\r\n  if(Curl_thread_join(&td->thread_hnd))\r\n    rc = getaddrinfo_complete(conn);\r\n  else\r\n    DEBUGASSERT(0);\r\n\r\n  conn->async.done = TRUE;\r\n\r\n  if(entry)\r\n    *entry = conn->async.dns;\r\n\r\n  if(!conn->async.dns) {\r\n    /* a name was not resolved */\r\n    if(conn->bits.httpproxy) {\r\n      resolver_error(conn, \"proxy\");\r\n      rc = CURLE_COULDNT_RESOLVE_PROXY;\r\n    }\r\n    else {\r\n      resolver_error(conn, \"host\");\r\n      rc = CURLE_COULDNT_RESOLVE_HOST;\r\n    }\r\n  }\r\n\r\n  destroy_async_data(&conn->async);\r\n\r\n  if(!conn->async.dns)\r\n    conn->bits.close = TRUE;\r\n\r\n  return (rc);\r\n}\r\n\r\n/*\r\n * Curl_resolver_is_resolved() is called repeatedly to check if a previous\r\n * name resolve request has completed. It should also make sure to time-out if\r\n * the operation seems to take too long.\r\n */\r\nCURLcode Curl_resolver_is_resolved(struct connectdata *conn,\r\n                                   struct Curl_dns_entry **entry)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct thread_data   *td = (struct thread_data*) conn->async.os_specific;\r\n  int done = 0;\r\n\r\n  *entry = NULL;\r\n\r\n  if(!td) {\r\n    DEBUGASSERT(td);\r\n    return CURLE_COULDNT_RESOLVE_HOST;\r\n  }\r\n\r\n  Curl_mutex_acquire(td->tsd.mtx);\r\n  done = td->tsd.done;\r\n  Curl_mutex_release(td->tsd.mtx);\r\n\r\n  if(done) {\r\n    getaddrinfo_complete(conn);\r\n    destroy_async_data(&conn->async);\r\n\r\n    if(!conn->async.dns) {\r\n      resolver_error(conn, \"host\");\r\n      return CURLE_COULDNT_RESOLVE_HOST;\r\n    }\r\n    *entry = conn->async.dns;\r\n  }\r\n  else {\r\n    /* poll for name lookup done with exponential backoff up to 250ms */\r\n    int elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);\r\n    if(elapsed < 0)\r\n      elapsed = 0;\r\n\r\n    if(td->poll_interval == 0)\r\n      /* Start at 1ms poll interval */\r\n      td->poll_interval = 1;\r\n    else if(elapsed >= td->interval_end)\r\n      /* Back-off exponentially if last interval expired  */\r\n      td->poll_interval *= 2;\r\n\r\n    if(td->poll_interval > 250)\r\n      td->poll_interval = 250;\r\n\r\n    td->interval_end = elapsed + td->poll_interval;\r\n    Curl_expire(conn->data, td->poll_interval);\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nint Curl_resolver_getsock(struct connectdata *conn,\r\n                          curl_socket_t *socks,\r\n                          int numsocks)\r\n{\r\n  (void)conn;\r\n  (void)socks;\r\n  (void)numsocks;\r\n  return 0;\r\n}\r\n\r\n#ifndef HAVE_GETADDRINFO\r\n/*\r\n * Curl_getaddrinfo() - for platforms without getaddrinfo\r\n */\r\nCurl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,\r\n                                         const char *hostname,\r\n                                         int port,\r\n                                         int *waitp)\r\n{\r\n  struct in_addr in;\r\n\r\n  *waitp = 0; /* default to synchronous response */\r\n\r\n  if(Curl_inet_pton(AF_INET, hostname, &in) > 0)\r\n    /* This is a dotted IP address 123.123.123.123-style */\r\n    return Curl_ip2addr(AF_INET, &in, hostname, port);\r\n\r\n  /* fire up a new resolver thread! */\r\n  if(init_resolve_thread(conn, hostname, port, NULL)) {\r\n    *waitp = 1; /* expect asynchronous response */\r\n    return NULL;\r\n  }\r\n\r\n  /* fall-back to blocking version */\r\n  return Curl_ipv4_resolve_r(hostname, port);\r\n}\r\n\r\n#else /* !HAVE_GETADDRINFO */\r\n\r\n/*\r\n * Curl_resolver_getaddrinfo() - for getaddrinfo\r\n */\r\nCurl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,\r\n                                         const char *hostname,\r\n                                         int port,\r\n                                         int *waitp)\r\n{\r\n  struct addrinfo hints;\r\n  struct in_addr in;\r\n  Curl_addrinfo *res;\r\n  int error;\r\n  char sbuf[NI_MAXSERV];\r\n  int pf = PF_INET;\r\n#ifdef CURLRES_IPV6\r\n  struct in6_addr in6;\r\n#endif /* CURLRES_IPV6 */\r\n\r\n  *waitp = 0; /* default to synchronous response */\r\n\r\n  /* First check if this is an IPv4 address string */\r\n  if(Curl_inet_pton(AF_INET, hostname, &in) > 0)\r\n    /* This is a dotted IP address 123.123.123.123-style */\r\n    return Curl_ip2addr(AF_INET, &in, hostname, port);\r\n\r\n#ifdef CURLRES_IPV6\r\n  /* check if this is an IPv6 address string */\r\n  if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0)\r\n    /* This is an IPv6 address literal */\r\n    return Curl_ip2addr(AF_INET6, &in6, hostname, port);\r\n\r\n  /*\r\n   * Check if a limited name resolve has been requested.\r\n   */\r\n  switch(conn->ip_version) {\r\n  case CURL_IPRESOLVE_V4:\r\n    pf = PF_INET;\r\n    break;\r\n  case CURL_IPRESOLVE_V6:\r\n    pf = PF_INET6;\r\n    break;\r\n  default:\r\n    pf = PF_UNSPEC;\r\n    break;\r\n  }\r\n\r\n  if((pf != PF_INET) && !Curl_ipv6works())\r\n    /* the stack seems to be a non-ipv6 one */\r\n    pf = PF_INET;\r\n\r\n#endif /* CURLRES_IPV6 */\r\n\r\n  memset(&hints, 0, sizeof(hints));\r\n  hints.ai_family = pf;\r\n  hints.ai_socktype = conn->socktype;\r\n\r\n  snprintf(sbuf, sizeof(sbuf), \"%d\", port);\r\n\r\n  /* fire up a new resolver thread! */\r\n  if(init_resolve_thread(conn, hostname, port, &hints)) {\r\n    *waitp = 1; /* expect asynchronous response */\r\n    return NULL;\r\n  }\r\n\r\n  /* fall-back to blocking version */\r\n  infof(conn->data, \"init_resolve_thread() failed for %s; %s\\n\",\r\n        hostname, Curl_strerror(conn, ERRNO));\r\n\r\n  error = Curl_getaddrinfo_ex(hostname, sbuf, &hints, &res);\r\n  if(error) {\r\n    infof(conn->data, \"getaddrinfo() failed for %s:%d; %s\\n\",\r\n          hostname, port, Curl_strerror(conn, SOCKERRNO));\r\n    return NULL;\r\n  }\r\n  return res;\r\n}\r\n\r\n#endif /* !HAVE_GETADDRINFO */\r\n\r\nCURLcode Curl_set_dns_servers(struct SessionHandle *data,\r\n                              char *servers)\r\n{\r\n  (void)data;\r\n  (void)servers;\r\n  return CURLE_NOT_BUILT_IN;\r\n\r\n}\r\n\r\n#endif /* CURLRES_THREADED */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/asyn.h",
    "content": "#ifndef HEADER_CURL_ASYN_H\r\n#define HEADER_CURL_ASYN_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n#include \"curl_addrinfo.h\"\r\n\r\nstruct addrinfo;\r\nstruct hostent;\r\nstruct SessionHandle;\r\nstruct connectdata;\r\nstruct Curl_dns_entry;\r\n\r\n/*\r\n * This header defines all functions in the internal asynch resolver interface.\r\n * All asynch resolvers need to provide these functions.\r\n * asyn-ares.c and asyn-thread.c are the current implementations of asynch\r\n * resolver backends.\r\n */\r\n\r\n/*\r\n * Curl_resolver_global_init()\r\n *\r\n * Called from curl_global_init() to initialize global resolver environment.\r\n * Returning anything else than CURLE_OK fails curl_global_init().\r\n */\r\nint Curl_resolver_global_init(void);\r\n\r\n/*\r\n * Curl_resolver_global_cleanup()\r\n * Called from curl_global_cleanup() to destroy global resolver environment.\r\n */\r\nvoid Curl_resolver_global_cleanup(void);\r\n\r\n/*\r\n * Curl_resolver_init()\r\n * Called from curl_easy_init() -> Curl_open() to initialize resolver\r\n * URL-state specific environment ('resolver' member of the UrlState\r\n * structure).  Should fill the passed pointer by the initialized handler.\r\n * Returning anything else than CURLE_OK fails curl_easy_init() with the\r\n * correspondent code.\r\n */\r\nCURLcode Curl_resolver_init(void **resolver);\r\n\r\n/*\r\n * Curl_resolver_cleanup()\r\n * Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver\r\n * URL-state specific environment ('resolver' member of the UrlState\r\n * structure).  Should destroy the handler and free all resources connected to\r\n * it.\r\n */\r\nvoid Curl_resolver_cleanup(void *resolver);\r\n\r\n/*\r\n * Curl_resolver_duphandle()\r\n * Called from curl_easy_duphandle() to duplicate resolver URL-state specific\r\n * environment ('resolver' member of the UrlState structure).  Should\r\n * duplicate the 'from' handle and pass the resulting handle to the 'to'\r\n * pointer.  Returning anything else than CURLE_OK causes failed\r\n * curl_easy_duphandle() call.\r\n */\r\nint Curl_resolver_duphandle(void **to, void *from);\r\n\r\n/*\r\n * Curl_resolver_cancel().\r\n *\r\n * It is called from inside other functions to cancel currently performing\r\n * resolver request. Should also free any temporary resources allocated to\r\n * perform a request.\r\n */\r\nvoid Curl_resolver_cancel(struct connectdata *conn);\r\n\r\n/* Curl_resolver_getsock()\r\n *\r\n * This function is called from the multi_getsock() function.  'sock' is a\r\n * pointer to an array to hold the file descriptors, with 'numsock' being the\r\n * size of that array (in number of entries). This function is supposed to\r\n * return bitmask indicating what file descriptors (referring to array indexes\r\n * in the 'sock' array) to wait for, read/write.\r\n */\r\nint Curl_resolver_getsock(struct connectdata *conn, curl_socket_t *sock,\r\n                          int numsocks);\r\n\r\n/*\r\n * Curl_resolver_is_resolved()\r\n *\r\n * Called repeatedly to check if a previous name resolve request has\r\n * completed. It should also make sure to time-out if the operation seems to\r\n * take too long.\r\n *\r\n * Returns normal CURLcode errors.\r\n */\r\nCURLcode Curl_resolver_is_resolved(struct connectdata *conn,\r\n                                   struct Curl_dns_entry **dns);\r\n\r\n/*\r\n * Curl_resolver_wait_resolv()\r\n *\r\n * waits for a resolve to finish. This function should be avoided since using\r\n * this risk getting the multi interface to \"hang\".\r\n *\r\n * If 'entry' is non-NULL, make it point to the resolved dns entry\r\n *\r\n * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and\r\n * CURLE_OPERATION_TIMEDOUT if a time-out occurred.\r\n\r\n */\r\nCURLcode Curl_resolver_wait_resolv(struct connectdata *conn,\r\n                                   struct Curl_dns_entry **dnsentry);\r\n\r\n/*\r\n * Curl_resolver_getaddrinfo() - when using this resolver\r\n *\r\n * Returns name information about the given hostname and port number. If\r\n * successful, the 'hostent' is returned and the forth argument will point to\r\n * memory we need to free after use. That memory *MUST* be freed with\r\n * Curl_freeaddrinfo(), nothing else.\r\n *\r\n * Each resolver backend must of course make sure to return data in the\r\n * correct format to comply with this.\r\n */\r\nCurl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,\r\n                                         const char *hostname,\r\n                                         int port,\r\n                                         int *waitp);\r\n\r\n#ifndef CURLRES_ASYNCH\r\n/* convert these functions if an asynch resolver isn't used */\r\n#define Curl_resolver_cancel(x) Curl_nop_stmt\r\n#define Curl_resolver_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST\r\n#define Curl_resolver_wait_resolv(x,y) CURLE_COULDNT_RESOLVE_HOST\r\n#define Curl_resolver_getsock(x,y,z) 0\r\n#define Curl_resolver_duphandle(x,y) CURLE_OK\r\n#define Curl_resolver_init(x) CURLE_OK\r\n#define Curl_resolver_global_init() CURLE_OK\r\n#define Curl_resolver_global_cleanup() Curl_nop_stmt\r\n#define Curl_resolver_cleanup(x) Curl_nop_stmt\r\n#endif\r\n\r\n#ifdef CURLRES_ASYNCH\r\n#define Curl_resolver_asynch() 1\r\n#else\r\n#define Curl_resolver_asynch() 0\r\n#endif\r\n\r\n\r\n/********** end of generic resolver interface functions *****************/\r\n#endif /* HEADER_CURL_ASYN_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/axtls.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, DirecTV\r\n * contact: Eric Hu <ehu@directv.com>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all axTLS-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_AXTLS\r\n#include <axTLS/ssl.h>\r\n#include \"axtls.h\"\r\n\r\n#include \"sendf.h\"\r\n#include \"inet_pton.h\"\r\n#include \"sslgen.h\"\r\n#include \"parsedate.h\"\r\n#include \"connect.h\" /* for the connect timeout */\r\n#include \"select.h\"\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n#include \"hostcheck.h\"\r\n\r\n\r\n/* SSL_read is opied from axTLS compat layer */\r\nstatic int SSL_read(SSL *ssl, void *buf, int num)\r\n{\r\n  uint8_t *read_buf;\r\n  int ret;\r\n\r\n  while((ret = ssl_read(ssl, &read_buf)) == SSL_OK);\r\n\r\n  if(ret > SSL_OK) {\r\n    memcpy(buf, read_buf, ret > num ? num : ret);\r\n  }\r\n\r\n  return ret;\r\n}\r\n\r\n/* Global axTLS init, called from Curl_ssl_init() */\r\nint Curl_axtls_init(void)\r\n{\r\n/* axTLS has no global init.  Everything is done through SSL and SSL_CTX\r\n * structs stored in connectdata structure.  Perhaps can move to axtls.h.\r\n */\r\n  return 1;\r\n}\r\n\r\nint Curl_axtls_cleanup(void)\r\n{\r\n  /* axTLS has no global cleanup.  Perhaps can move this to axtls.h. */\r\n  return 1;\r\n}\r\n\r\nstatic CURLcode map_error_to_curl(int axtls_err)\r\n{\r\n  switch (axtls_err) {\r\n  case SSL_ERROR_NOT_SUPPORTED:\r\n  case SSL_ERROR_INVALID_VERSION:\r\n  case -70:                       /* protocol version alert from server */\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n    break;\r\n  case SSL_ERROR_NO_CIPHER:\r\n    return CURLE_SSL_CIPHER;\r\n    break;\r\n  case SSL_ERROR_BAD_CERTIFICATE: /* this may be bad server cert too */\r\n  case SSL_ERROR_NO_CERT_DEFINED:\r\n  case -42:                       /* bad certificate alert from server */\r\n  case -43:                       /* unsupported cert alert from server */\r\n  case -44:                       /* cert revoked alert from server */\r\n  case -45:                       /* cert expired alert from server */\r\n  case -46:                       /* cert unknown alert from server */\r\n    return CURLE_SSL_CERTPROBLEM;\r\n    break;\r\n  case SSL_X509_ERROR(X509_NOT_OK):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_NO_TRUSTED_CERT):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_BAD_SIGNATURE):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_NOT_YET_VALID):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_EXPIRED):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_SELF_SIGNED):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_INVALID_CHAIN):\r\n  case SSL_X509_ERROR(X509_VFY_ERROR_UNSUPPORTED_DIGEST):\r\n  case SSL_X509_ERROR(X509_INVALID_PRIV_KEY):\r\n    return CURLE_PEER_FAILED_VERIFICATION;\r\n    break;\r\n  case -48:                       /* unknown ca alert from server */\r\n    return CURLE_SSL_CACERT;\r\n    break;\r\n  case -49:                       /* access denied alert from server */\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n    break;\r\n  case SSL_ERROR_CONN_LOST:\r\n  case SSL_ERROR_SOCK_SETUP_FAILURE:\r\n  case SSL_ERROR_INVALID_HANDSHAKE:\r\n  case SSL_ERROR_INVALID_PROT_MSG:\r\n  case SSL_ERROR_INVALID_HMAC:\r\n  case SSL_ERROR_INVALID_SESSION:\r\n  case SSL_ERROR_INVALID_KEY:     /* it's too bad this doesn't map better */\r\n  case SSL_ERROR_FINISHED_INVALID:\r\n  case SSL_ERROR_NO_CLIENT_RENOG:\r\n  default:\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n    break;\r\n  }\r\n}\r\n\r\nstatic Curl_recv axtls_recv;\r\nstatic Curl_send axtls_send;\r\n\r\n/*\r\n * This function is called after the TCP connect has completed. Setup the TLS\r\n * layer and do all necessary magic.\r\n */\r\nCURLcode\r\nCurl_axtls_connect(struct connectdata *conn,\r\n                  int sockindex)\r\n\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  SSL_CTX *ssl_ctx;\r\n  SSL *ssl;\r\n  int cert_types[] = {SSL_OBJ_X509_CERT, SSL_OBJ_PKCS12, 0};\r\n  int key_types[] = {SSL_OBJ_RSA_KEY, SSL_OBJ_PKCS8, SSL_OBJ_PKCS12, 0};\r\n  int i, ssl_fcn_return;\r\n  const uint8_t *ssl_sessionid;\r\n  size_t ssl_idsize;\r\n  const char *peer_CN;\r\n  uint32_t dns_altname_index;\r\n  const char *dns_altname;\r\n  int8_t found_subject_alt_names = 0;\r\n  int8_t found_subject_alt_name_matching_conn = 0;\r\n\r\n  /* Assuming users will not compile in custom key/cert to axTLS */\r\n  uint32_t client_option = SSL_NO_DEFAULT_KEY|SSL_SERVER_VERIFY_LATER;\r\n\r\n  if(conn->ssl[sockindex].state == ssl_connection_complete)\r\n    /* to make us tolerant against being called more than once for the\r\n       same connection */\r\n    return CURLE_OK;\r\n\r\n  /* axTLS only supports TLSv1 */\r\n  /* check to see if we've been told to use an explicit SSL/TLS version */\r\n  switch(data->set.ssl.version) {\r\n  case CURL_SSLVERSION_DEFAULT:\r\n  case CURL_SSLVERSION_TLSv1:\r\n    break;\r\n  default:\r\n    failf(data, \"axTLS only supports TLSv1\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n#ifdef  AXTLSDEBUG\r\n  client_option |= SSL_DISPLAY_STATES | SSL_DISPLAY_RSA | SSL_DISPLAY_CERTS;\r\n#endif /* AXTLSDEBUG */\r\n\r\n  /* Allocate an SSL_CTX struct */\r\n  ssl_ctx = ssl_ctx_new(client_option, SSL_DEFAULT_CLNT_SESS);\r\n  if(ssl_ctx == NULL) {\r\n    failf(data, \"unable to create client SSL context\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  /* Load the trusted CA cert bundle file */\r\n  if(data->set.ssl.CAfile) {\r\n    if(ssl_obj_load(ssl_ctx, SSL_OBJ_X509_CACERT, data->set.ssl.CAfile, NULL)\r\n       != SSL_OK) {\r\n      infof(data, \"error reading ca cert file %s \\n\",\r\n            data->set.ssl.CAfile);\r\n      if(data->set.ssl.verifypeer) {\r\n        Curl_axtls_close(conn, sockindex);\r\n        return CURLE_SSL_CACERT_BADFILE;\r\n      }\r\n    }\r\n    else\r\n      infof(data, \"found certificates in %s\\n\", data->set.ssl.CAfile);\r\n  }\r\n\r\n  /* gtls.c tasks we're skipping for now:\r\n   * 1) certificate revocation list checking\r\n   * 2) dns name assignment to host\r\n   * 3) set protocol priority.  axTLS is TLSv1 only, so can probably ignore\r\n   * 4) set certificate priority.  axTLS ignores type and sends certs in\r\n   *  order added.  can probably ignore this.\r\n   */\r\n\r\n  /* Load client certificate */\r\n  if(data->set.str[STRING_CERT]) {\r\n    i=0;\r\n    /* Instead of trying to analyze cert type here, let axTLS try them all. */\r\n    while(cert_types[i] != 0) {\r\n      ssl_fcn_return = ssl_obj_load(ssl_ctx, cert_types[i],\r\n                                    data->set.str[STRING_CERT], NULL);\r\n      if(ssl_fcn_return == SSL_OK) {\r\n        infof(data, \"successfully read cert file %s \\n\",\r\n              data->set.str[STRING_CERT]);\r\n        break;\r\n      }\r\n      i++;\r\n    }\r\n    /* Tried all cert types, none worked. */\r\n    if(cert_types[i] == 0) {\r\n      failf(data, \"%s is not x509 or pkcs12 format\",\r\n            data->set.str[STRING_CERT]);\r\n      Curl_axtls_close(conn, sockindex);\r\n      return CURLE_SSL_CERTPROBLEM;\r\n    }\r\n  }\r\n\r\n  /* Load client key.\r\n     If a pkcs12 file successfully loaded a cert, then there's nothing to do\r\n     because the key has already been loaded. */\r\n  if(data->set.str[STRING_KEY] && cert_types[i] != SSL_OBJ_PKCS12) {\r\n    i=0;\r\n    /* Instead of trying to analyze key type here, let axTLS try them all. */\r\n    while(key_types[i] != 0) {\r\n      ssl_fcn_return = ssl_obj_load(ssl_ctx, key_types[i],\r\n                                    data->set.str[STRING_KEY], NULL);\r\n      if(ssl_fcn_return == SSL_OK) {\r\n        infof(data, \"successfully read key file %s \\n\",\r\n              data->set.str[STRING_KEY]);\r\n        break;\r\n      }\r\n      i++;\r\n    }\r\n    /* Tried all key types, none worked. */\r\n    if(key_types[i] == 0) {\r\n      failf(data, \"Failure: %s is not a supported key file\",\r\n            data->set.str[STRING_KEY]);\r\n      Curl_axtls_close(conn, sockindex);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n\r\n  /* gtls.c does more here that is being left out for now\r\n   * 1) set session credentials.  can probably ignore since axtls puts this\r\n   *    info in the ssl_ctx struct\r\n   * 2) setting up callbacks.  these seem gnutls specific\r\n   */\r\n\r\n  /* In axTLS, handshaking happens inside ssl_client_new. */\r\n  if(!Curl_ssl_getsessionid(conn, (void **) &ssl_sessionid, &ssl_idsize)) {\r\n    /* we got a session id, use it! */\r\n    infof (data, \"SSL re-using session ID\\n\");\r\n    ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex],\r\n                         ssl_sessionid, (uint8_t)ssl_idsize);\r\n  }\r\n  else\r\n    ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex], NULL, 0);\r\n\r\n  /* Check to make sure handshake was ok. */\r\n  ssl_fcn_return = ssl_handshake_status(ssl);\r\n  if(ssl_fcn_return != SSL_OK) {\r\n    Curl_axtls_close(conn, sockindex);\r\n    ssl_display_error(ssl_fcn_return); /* goes to stdout. */\r\n    return map_error_to_curl(ssl_fcn_return);\r\n  }\r\n  infof (data, \"handshake completed successfully\\n\");\r\n\r\n  /* Here, gtls.c gets the peer certificates and fails out depending on\r\n   * settings in \"data.\"  axTLS api doesn't have get cert chain fcn, so omit?\r\n   */\r\n\r\n  /* Verify server's certificate */\r\n  if(data->set.ssl.verifypeer) {\r\n    if(ssl_verify_cert(ssl) != SSL_OK) {\r\n      Curl_axtls_close(conn, sockindex);\r\n      failf(data, \"server cert verify failed\");\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n  else\r\n    infof(data, \"\\t server certificate verification SKIPPED\\n\");\r\n\r\n  /* Here, gtls.c does issuer verification. axTLS has no straightforward\r\n   * equivalent, so omitting for now.*/\r\n\r\n  /* Here, gtls.c does the following\r\n   * 1) x509 hostname checking per RFC2818.  axTLS doesn't support this, but\r\n   *    it seems useful. This is now implemented, by Oscar Koeroo\r\n   * 2) checks cert validity based on time.  axTLS does this in ssl_verify_cert\r\n   * 3) displays a bunch of cert information.  axTLS doesn't support most of\r\n   *    this, but a couple fields are available.\r\n   */\r\n\r\n\r\n  /* There is no (DNS) Altnames count in the version 1.4.8 API. There is a\r\n     risk of an inifite loop */\r\n  for(dns_altname_index = 0; ; dns_altname_index++) {\r\n    dns_altname = ssl_get_cert_subject_alt_dnsname(ssl, dns_altname_index);\r\n    if(dns_altname == NULL) {\r\n      break;\r\n    }\r\n    found_subject_alt_names = 1;\r\n\r\n    infof(data, \"\\tComparing subject alt name DNS with hostname: %s <-> %s\\n\",\r\n          dns_altname, conn->host.name);\r\n    if(Curl_cert_hostcheck(dns_altname, conn->host.name)) {\r\n      found_subject_alt_name_matching_conn = 1;\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* RFC2818 checks */\r\n  if(found_subject_alt_names && !found_subject_alt_name_matching_conn) {\r\n    /* Break connection ! */\r\n    Curl_axtls_close(conn, sockindex);\r\n    failf(data, \"\\tsubjectAltName(s) do not match %s\\n\", conn->host.dispname);\r\n    return CURLE_PEER_FAILED_VERIFICATION;\r\n  }\r\n  else if(found_subject_alt_names == 0) {\r\n    /* Per RFC2818, when no Subject Alt Names were available, examine the peer\r\n       CN as a legacy fallback */\r\n    peer_CN = ssl_get_cert_dn(ssl, SSL_X509_CERT_COMMON_NAME);\r\n    if(peer_CN == NULL) {\r\n      /* Similar behaviour to the OpenSSL interface */\r\n      Curl_axtls_close(conn, sockindex);\r\n      failf(data, \"unable to obtain common name from peer certificate\");\r\n      return CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n    else {\r\n      if(!Curl_cert_hostcheck((const char *)peer_CN, conn->host.name)) {\r\n        if(data->set.ssl.verifyhost) {\r\n          /* Break connection ! */\r\n          Curl_axtls_close(conn, sockindex);\r\n          failf(data, \"\\tcommon name \\\"%s\\\" does not match \\\"%s\\\"\\n\",\r\n                peer_CN, conn->host.dispname);\r\n          return CURLE_PEER_FAILED_VERIFICATION;\r\n        }\r\n        else\r\n          infof(data, \"\\tcommon name \\\"%s\\\" does not match \\\"%s\\\"\\n\",\r\n                peer_CN, conn->host.dispname);\r\n      }\r\n    }\r\n  }\r\n\r\n  /* General housekeeping */\r\n  conn->ssl[sockindex].state = ssl_connection_complete;\r\n  conn->ssl[sockindex].ssl = ssl;\r\n  conn->ssl[sockindex].ssl_ctx = ssl_ctx;\r\n  conn->recv[sockindex] = axtls_recv;\r\n  conn->send[sockindex] = axtls_send;\r\n\r\n  /* Put our freshly minted SSL session in cache */\r\n  ssl_idsize = ssl_get_session_id_size(ssl);\r\n  ssl_sessionid = ssl_get_session_id(ssl);\r\n  if(Curl_ssl_addsessionid(conn, (void *) ssl_sessionid, ssl_idsize)\r\n     != CURLE_OK)\r\n    infof (data, \"failed to add session to cache\\n\");\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/* return number of sent (non-SSL) bytes */\r\nstatic ssize_t axtls_send(struct connectdata *conn,\r\n                          int sockindex,\r\n                          const void *mem,\r\n                          size_t len,\r\n                          CURLcode *err)\r\n{\r\n  /* ssl_write() returns 'int' while write() and send() returns 'size_t' */\r\n  int rc = ssl_write(conn->ssl[sockindex].ssl, mem, (int)len);\r\n\r\n  infof(conn->data, \"  axtls_send\\n\");\r\n\r\n  if(rc < 0 ) {\r\n    *err = map_error_to_curl(rc);\r\n    rc = -1; /* generic error code for send failure */\r\n  }\r\n\r\n  *err = CURLE_OK;\r\n  return rc;\r\n}\r\n\r\nvoid Curl_axtls_close_all(struct SessionHandle *data)\r\n{\r\n  (void)data;\r\n  infof(data, \"  Curl_axtls_close_all\\n\");\r\n}\r\n\r\nvoid Curl_axtls_close(struct connectdata *conn, int sockindex)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  infof(conn->data, \"  Curl_axtls_close\\n\");\r\n  if(connssl->ssl) {\r\n    /* line from ssluse.c: (void)SSL_shutdown(connssl->ssl);\r\n       axTLS compat layer does nothing for SSL_shutdown */\r\n\r\n    /* The following line is from ssluse.c.  There seems to be no axTLS\r\n       equivalent.  ssl_free and ssl_ctx_free close things.\r\n       SSL_set_connect_state(connssl->handle); */\r\n\r\n    ssl_free (connssl->ssl);\r\n    connssl->ssl = NULL;\r\n  }\r\n  if(connssl->ssl_ctx) {\r\n    ssl_ctx_free (connssl->ssl_ctx);\r\n    connssl->ssl_ctx = NULL;\r\n  }\r\n}\r\n\r\n/*\r\n * This function is called to shut down the SSL layer but keep the\r\n * socket open (CCC - Clear Command Channel)\r\n */\r\nint Curl_axtls_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  /* Outline taken from ssluse.c since functions are in axTLS compat layer.\r\n     axTLS's error set is much smaller, so a lot of error-handling was removed.\r\n   */\r\n  int retval = 0;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n  char buf[120]; /* We will use this for the OpenSSL error buffer, so it has\r\n                    to be at least 120 bytes long. */\r\n  ssize_t nread;\r\n\r\n  infof(conn->data, \"  Curl_axtls_shutdown\\n\");\r\n\r\n  /* This has only been tested on the proftpd server, and the mod_tls code\r\n     sends a close notify alert without waiting for a close notify alert in\r\n     response. Thus we wait for a close notify alert from the server, but\r\n     we do not send one. Let's hope other servers do the same... */\r\n\r\n  /* axTLS compat layer does nothing for SSL_shutdown, so we do nothing too\r\n  if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE)\r\n      (void)SSL_shutdown(connssl->ssl);\r\n  */\r\n\r\n  if(connssl->ssl) {\r\n    int what = Curl_socket_ready(conn->sock[sockindex],\r\n                                 CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);\r\n    if(what > 0) {\r\n      /* Something to read, let's do it and hope that it is the close\r\n         notify alert from the server */\r\n      nread = (ssize_t)SSL_read(conn->ssl[sockindex].ssl, buf,\r\n                                sizeof(buf));\r\n\r\n      if(nread < SSL_OK) {\r\n        failf(data, \"close notify alert not received during shutdown\");\r\n        retval = -1;\r\n      }\r\n    }\r\n    else if(0 == what) {\r\n      /* timeout */\r\n      failf(data, \"SSL shutdown timeout\");\r\n    }\r\n    else {\r\n      /* anything that gets here is fatally bad */\r\n      failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n      retval = -1;\r\n    }\r\n\r\n    ssl_free (connssl->ssl);\r\n    connssl->ssl = NULL;\r\n  }\r\n  return retval;\r\n}\r\n\r\nstatic ssize_t axtls_recv(struct connectdata *conn, /* connection data */\r\n                          int num,                  /* socketindex */\r\n                          char *buf,                /* store read data here */\r\n                          size_t buffersize,        /* max amount to read */\r\n                          CURLcode *err)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[num];\r\n  ssize_t ret = 0;\r\n\r\n  infof(conn->data, \"  axtls_recv\\n\");\r\n\r\n  if(connssl) {\r\n    ret = (ssize_t)SSL_read(conn->ssl[num].ssl, buf, (int)buffersize);\r\n\r\n    /* axTLS isn't terribly generous about error reporting */\r\n    /* With patched axTLS, SSL_CLOSE_NOTIFY=-3.  Hard-coding until axTLS\r\n       team approves proposed fix. */\r\n    if(ret == -3 ) {\r\n      Curl_axtls_close(conn, num);\r\n    }\r\n    else if(ret < 0) {\r\n      failf(conn->data, \"axTLS recv error (%d)\", (int)ret);\r\n      *err = map_error_to_curl(ret);\r\n      return -1;\r\n    }\r\n  }\r\n\r\n  *err = CURLE_OK;\r\n  return ret;\r\n}\r\n\r\n/*\r\n * Return codes:\r\n *     1 means the connection is still in place\r\n *     0 means the connection has been closed\r\n *    -1 means the connection status is unknown\r\n */\r\nint Curl_axtls_check_cxn(struct connectdata *conn)\r\n{\r\n  /* ssluse.c line: rc = SSL_peek(conn->ssl[FIRSTSOCKET].ssl, (void*)&buf, 1);\r\n     axTLS compat layer always returns the last argument, so connection is\r\n     always alive? */\r\n\r\n  infof(conn->data, \"  Curl_axtls_check_cxn\\n\");\r\n   return 1; /* connection still in place */\r\n}\r\n\r\nvoid Curl_axtls_session_free(void *ptr)\r\n{\r\n  (void)ptr;\r\n  /* free the ID */\r\n  /* both ssluse.c and gtls.c do something here, but axTLS's OpenSSL\r\n     compatibility layer does nothing, so we do nothing too. */\r\n}\r\n\r\nsize_t Curl_axtls_version(char *buffer, size_t size)\r\n{\r\n  return snprintf(buffer, size, \"axTLS/%s\", ssl_version());\r\n}\r\n\r\n#endif /* USE_AXTLS */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/axtls.h",
    "content": "#ifndef HEADER_CURL_AXTLS_H\r\n#define HEADER_CURL_AXTLS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, DirecTV\r\n * contact: Eric Hu <ehu@directv.com>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifdef USE_AXTLS\r\n#include \"curl/curl.h\"\r\n#include \"urldata.h\"\r\n\r\nint Curl_axtls_init(void);\r\nint Curl_axtls_cleanup(void);\r\nCURLcode Curl_axtls_connect(struct connectdata *conn, int sockindex);\r\n\r\n/* tell axTLS to close down all open information regarding connections (and\r\n   thus session ID caching etc) */\r\nvoid Curl_axtls_close_all(struct SessionHandle *data);\r\n\r\n /* close a SSL connection */\r\nvoid Curl_axtls_close(struct connectdata *conn, int sockindex);\r\n\r\nvoid Curl_axtls_session_free(void *ptr);\r\nsize_t Curl_axtls_version(char *buffer, size_t size);\r\nint Curl_axtls_shutdown(struct connectdata *conn, int sockindex);\r\nint Curl_axtls_check_cxn(struct connectdata *conn);\r\n\r\n/* API setup for axTLS */\r\n#define curlssl_init Curl_axtls_init\r\n#define curlssl_cleanup Curl_axtls_cleanup\r\n#define curlssl_connect Curl_axtls_connect\r\n#define curlssl_session_free(x)  Curl_axtls_session_free(x)\r\n#define curlssl_close_all Curl_axtls_close_all\r\n#define curlssl_close Curl_axtls_close\r\n#define curlssl_shutdown(x,y) Curl_axtls_shutdown(x,y)\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_axtls_version\r\n#define curlssl_check_cxn(x) Curl_axtls_check_cxn(x)\r\n#define curlssl_data_pending(x,y) (x=x, y=y, 0)\r\n\r\n#endif /* USE_AXTLS */\r\n#endif /* HEADER_CURL_AXTLS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/base64.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* Base64 encoding/decoding */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"urldata.h\" /* for the SessionHandle definition */\r\n#include \"warnless.h\"\r\n#include \"curl_base64.h\"\r\n#include \"curl_memory.h\"\r\n#include \"non-ascii.h\"\r\n\r\n/* include memdebug.h last */\r\n#include \"memdebug.h\"\r\n\r\n/* ---- Base64 Encoding/Decoding Table --- */\r\nstatic const char table64[]=\r\n  \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n\r\nstatic void decodeQuantum(unsigned char *dest, const char *src)\r\n{\r\n  const char *s, *p;\r\n  unsigned long i, v, x = 0;\r\n\r\n  for(i = 0, s = src; i < 4; i++, s++) {\r\n    v = 0;\r\n    p = table64;\r\n    while(*p && (*p != *s)) {\r\n      v++;\r\n      p++;\r\n    }\r\n    if(*p == *s)\r\n      x = (x << 6) + v;\r\n    else if(*s == '=')\r\n      x = (x << 6);\r\n  }\r\n\r\n  dest[2] = curlx_ultouc(x & 0xFFUL);\r\n  x >>= 8;\r\n  dest[1] = curlx_ultouc(x & 0xFFUL);\r\n  x >>= 8;\r\n  dest[0] = curlx_ultouc(x & 0xFFUL);\r\n}\r\n\r\n/*\r\n * Curl_base64_decode()\r\n *\r\n * Given a base64 NUL-terminated string at src, decode it and return a\r\n * pointer in *outptr to a newly allocated memory area holding decoded\r\n * data. Size of decoded data is returned in variable pointed by outlen.\r\n *\r\n * Returns CURLE_OK on success, otherwise specific error code. Function\r\n * output shall not be considered valid unless CURLE_OK is returned.\r\n *\r\n * When decoded data length is 0, returns NULL in *outptr.\r\n *\r\n * @unittest: 1302\r\n */\r\nCURLcode Curl_base64_decode(const char *src,\r\n                            unsigned char **outptr, size_t *outlen)\r\n{\r\n  size_t length = 0;\r\n  size_t equalsTerm = 0;\r\n  size_t i;\r\n  size_t numQuantums;\r\n  unsigned char lastQuantum[3];\r\n  size_t rawlen = 0;\r\n  unsigned char *newstr;\r\n\r\n  *outptr = NULL;\r\n  *outlen = 0;\r\n\r\n  while((src[length] != '=') && src[length])\r\n    length++;\r\n  /* A maximum of two = padding characters is allowed */\r\n  if(src[length] == '=') {\r\n    equalsTerm++;\r\n    if(src[length+equalsTerm] == '=')\r\n      equalsTerm++;\r\n  }\r\n  numQuantums = (length + equalsTerm) / 4;\r\n\r\n  /* Don't allocate a buffer if the decoded length is 0 */\r\n  if(numQuantums == 0)\r\n    return CURLE_OK;\r\n\r\n  rawlen = (numQuantums * 3) - equalsTerm;\r\n\r\n  /* The buffer must be large enough to make room for the last quantum\r\n  (which may be partially thrown out) and the zero terminator. */\r\n  newstr = malloc(rawlen+4);\r\n  if(!newstr)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  *outptr = newstr;\r\n\r\n  /* Decode all but the last quantum (which may not decode to a\r\n  multiple of 3 bytes) */\r\n  for(i = 0; i < numQuantums - 1; i++) {\r\n    decodeQuantum(newstr, src);\r\n    newstr += 3; src += 4;\r\n  }\r\n\r\n  /* This final decode may actually read slightly past the end of the buffer\r\n  if the input string is missing pad bytes.  This will almost always be\r\n  harmless. */\r\n  decodeQuantum(lastQuantum, src);\r\n  for(i = 0; i < 3 - equalsTerm; i++)\r\n    newstr[i] = lastQuantum[i];\r\n\r\n  newstr[i] = '\\0'; /* zero terminate */\r\n\r\n  *outlen = rawlen; /* return size of decoded data */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_base64_encode()\r\n *\r\n * Given a pointer to an input buffer and an input size, encode it and\r\n * return a pointer in *outptr to a newly allocated memory area holding\r\n * encoded data. Size of encoded data is returned in variable pointed by\r\n * outlen.\r\n *\r\n * Input length of 0 indicates input buffer holds a NUL-terminated string.\r\n *\r\n * Returns CURLE_OK on success, otherwise specific error code. Function\r\n * output shall not be considered valid unless CURLE_OK is returned.\r\n *\r\n * When encoded data length is 0, returns NULL in *outptr.\r\n *\r\n * @unittest: 1302\r\n */\r\nCURLcode Curl_base64_encode(struct SessionHandle *data,\r\n                            const char *inputbuff, size_t insize,\r\n                            char **outptr, size_t *outlen)\r\n{\r\n  CURLcode error;\r\n  unsigned char ibuf[3];\r\n  unsigned char obuf[4];\r\n  int i;\r\n  int inputparts;\r\n  char *output;\r\n  char *base64data;\r\n  char *convbuf = NULL;\r\n\r\n  const char *indata = inputbuff;\r\n\r\n  *outptr = NULL;\r\n  *outlen = 0;\r\n\r\n  if(0 == insize)\r\n    insize = strlen(indata);\r\n\r\n  base64data = output = malloc(insize*4/3+4);\r\n  if(NULL == output)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /*\r\n   * The base64 data needs to be created using the network encoding\r\n   * not the host encoding.  And we can't change the actual input\r\n   * so we copy it to a buffer, translate it, and use that instead.\r\n   */\r\n  error = Curl_convert_clone(data, indata, insize, &convbuf);\r\n  if(error) {\r\n    free(output);\r\n    return error;\r\n  }\r\n\r\n  if(convbuf)\r\n    indata = (char *)convbuf;\r\n\r\n  while(insize > 0) {\r\n    for(i = inputparts = 0; i < 3; i++) {\r\n      if(insize > 0) {\r\n        inputparts++;\r\n        ibuf[i] = (unsigned char) *indata;\r\n        indata++;\r\n        insize--;\r\n      }\r\n      else\r\n        ibuf[i] = 0;\r\n    }\r\n\r\n    obuf[0] = (unsigned char)  ((ibuf[0] & 0xFC) >> 2);\r\n    obuf[1] = (unsigned char) (((ibuf[0] & 0x03) << 4) | \\\r\n                               ((ibuf[1] & 0xF0) >> 4));\r\n    obuf[2] = (unsigned char) (((ibuf[1] & 0x0F) << 2) | \\\r\n                               ((ibuf[2] & 0xC0) >> 6));\r\n    obuf[3] = (unsigned char)   (ibuf[2] & 0x3F);\r\n\r\n    switch(inputparts) {\r\n    case 1: /* only one byte read */\r\n      snprintf(output, 5, \"%c%c==\",\r\n               table64[obuf[0]],\r\n               table64[obuf[1]]);\r\n      break;\r\n    case 2: /* two bytes read */\r\n      snprintf(output, 5, \"%c%c%c=\",\r\n               table64[obuf[0]],\r\n               table64[obuf[1]],\r\n               table64[obuf[2]]);\r\n      break;\r\n    default:\r\n      snprintf(output, 5, \"%c%c%c%c\",\r\n               table64[obuf[0]],\r\n               table64[obuf[1]],\r\n               table64[obuf[2]],\r\n               table64[obuf[3]] );\r\n      break;\r\n    }\r\n    output += 4;\r\n  }\r\n  *output = '\\0';\r\n  *outptr = base64data; /* return pointer to new data, allocated memory */\r\n\r\n  if(convbuf)\r\n    free(convbuf);\r\n\r\n  *outlen = strlen(base64data); /* return the length of the new data */\r\n\r\n  return CURLE_OK;\r\n}\r\n/* ---- End of Base64 Encoding ---- */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/bundles.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, Linus Nielsen Feltzing, <linus@haxx.se>\r\n * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"url.h\"\r\n#include \"progress.h\"\r\n#include \"multiif.h\"\r\n#include \"bundles.h\"\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic void conn_llist_dtor(void *user, void *element)\r\n{\r\n  struct connectdata *data = element;\r\n  (void)user;\r\n\r\n  data->bundle = NULL;\r\n}\r\n\r\nCURLcode Curl_bundle_create(struct SessionHandle *data,\r\n                            struct connectbundle **cb_ptr)\r\n{\r\n  (void)data;\r\n  DEBUGASSERT(*cb_ptr == NULL);\r\n  *cb_ptr = malloc(sizeof(struct connectbundle));\r\n  if(!*cb_ptr)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  (*cb_ptr)->num_connections = 0;\r\n  (*cb_ptr)->server_supports_pipelining = FALSE;\r\n\r\n  (*cb_ptr)->conn_list = Curl_llist_alloc((curl_llist_dtor) conn_llist_dtor);\r\n  if(!(*cb_ptr)->conn_list) {\r\n    Curl_safefree(*cb_ptr);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid Curl_bundle_destroy(struct connectbundle *cb_ptr)\r\n{\r\n  if(!cb_ptr)\r\n    return;\r\n\r\n  if(cb_ptr->conn_list) {\r\n    Curl_llist_destroy(cb_ptr->conn_list, NULL);\r\n    cb_ptr->conn_list = NULL;\r\n  }\r\n  Curl_safefree(cb_ptr);\r\n}\r\n\r\n/* Add a connection to a bundle */\r\nCURLcode Curl_bundle_add_conn(struct connectbundle *cb_ptr,\r\n                              struct connectdata *conn)\r\n{\r\n  if(!Curl_llist_insert_next(cb_ptr->conn_list, cb_ptr->conn_list->tail, conn))\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  conn->bundle = cb_ptr;\r\n\r\n  cb_ptr->num_connections++;\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Remove a connection from a bundle */\r\nint Curl_bundle_remove_conn(struct connectbundle *cb_ptr,\r\n                            struct connectdata *conn)\r\n{\r\n  struct curl_llist_element *curr;\r\n\r\n  curr = cb_ptr->conn_list->head;\r\n  while(curr) {\r\n    if(curr->ptr == conn) {\r\n      Curl_llist_remove(cb_ptr->conn_list, curr, NULL);\r\n      cb_ptr->num_connections--;\r\n      conn->bundle = NULL;\r\n      return 1; /* we removed a handle */\r\n    }\r\n    curr = curr->next;\r\n  }\r\n  return 0;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/bundles.h",
    "content": "#ifndef HEADER_CURL_BUNDLES_H\r\n#define HEADER_CURL_BUNDLES_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, Linus Nielsen Feltzing, <linus@haxx.se>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nstruct connectbundle {\r\n  bool server_supports_pipelining; /* TRUE if server supports pipelining,\r\n                                      set after first response */\r\n  size_t num_connections;       /* Number of connections in the bundle */\r\n  struct curl_llist *conn_list; /* The connectdata members of the bundle */\r\n};\r\n\r\nCURLcode Curl_bundle_create(struct SessionHandle *data,\r\n                            struct connectbundle **cb_ptr);\r\n\r\nvoid Curl_bundle_destroy(struct connectbundle *cb_ptr);\r\n\r\nCURLcode Curl_bundle_add_conn(struct connectbundle *cb_ptr,\r\n                              struct connectdata *conn);\r\n\r\nint Curl_bundle_remove_conn(struct connectbundle *cb_ptr,\r\n                            struct connectdata *conn);\r\n\r\n\r\n#endif /* HEADER_CURL_BUNDLES_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-amigaos.h",
    "content": "#ifndef HEADER_CURL_CONFIG_AMIGAOS_H\r\n#define HEADER_CURL_CONFIG_AMIGAOS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               Hand crafted config file for AmigaOS               */\r\n/* ================================================================ */\r\n\r\n#ifdef __AMIGA__ /* Any AmigaOS flavour */\r\n\r\n#define HAVE_ARPA_INET_H 1\r\n#define HAVE_CLOSESOCKET_CAMEL 1\r\n#define HAVE_ERRNO_H 1\r\n#define HAVE_GETHOSTBYADDR 1\r\n#define HAVE_INET_ADDR 1\r\n#define HAVE_INTTYPES_H 1\r\n#define HAVE_IOCTLSOCKET_CAMEL 1\r\n#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1\r\n#define HAVE_LIBCRYPTO 1\r\n#define HAVE_LIBSSL 1\r\n#define HAVE_LIBZ 1\r\n#define HAVE_LONGLONG 1\r\n#define HAVE_MALLOC_H 1\r\n#define HAVE_MEMORY_H 1\r\n#define HAVE_NETDB_H 1\r\n#define HAVE_NETINET_IN_H 1\r\n#define HAVE_NET_IF_H 1\r\n#define HAVE_OPENSSL_CRYPTO_H 1\r\n#define HAVE_OPENSSL_ERR_H 1\r\n#define HAVE_OPENSSL_PEM_H 1\r\n#define HAVE_OPENSSL_RSA_H 1\r\n#define HAVE_OPENSSL_SSL_H 1\r\n#define HAVE_OPENSSL_X509_H 1\r\n#define HAVE_PERROR 1\r\n#define HAVE_PWD_H 1\r\n#define HAVE_RAND_EGD 1\r\n#define HAVE_RAND_STATUS 1\r\n#define HAVE_SELECT 1\r\n#define HAVE_SETJMP_H 1\r\n#define HAVE_SGTTY_H 1\r\n#define HAVE_SIGNAL 1\r\n#define HAVE_SIGNAL_H 1\r\n#define HAVE_SIG_ATOMIC_T 1\r\n#define HAVE_SOCKET 1\r\n#define HAVE_STRCASECMP 1\r\n#define HAVE_STRDUP 1\r\n#define HAVE_STRFTIME 1\r\n#define HAVE_STRICMP 1\r\n#define HAVE_STRINGS_H 1\r\n#define HAVE_STRING_H 1\r\n#define HAVE_STRSTR 1\r\n#define HAVE_STRUCT_TIMEVAL 1\r\n#define HAVE_SYS_PARAM_H 1\r\n#define HAVE_SYS_SOCKET_H 1\r\n#define HAVE_SYS_SOCKIO_H 1\r\n#define HAVE_SYS_STAT_H 1\r\n#define HAVE_SYS_TIME_H 1\r\n#define HAVE_SYS_TYPES_H 1\r\n#define HAVE_TIME_H 1\r\n#define HAVE_UNAME 1\r\n#define HAVE_UNISTD_H 1\r\n#define HAVE_UTIME 1\r\n#define HAVE_UTIME_H 1\r\n#define HAVE_WRITABLE_ARGV 1\r\n#define HAVE_ZLIB_H 1\r\n#define HAVE_SYS_IOCTL_H 1\r\n\r\n#define NEED_MALLOC_H 1\r\n\r\n#define SIZEOF_INT 4\r\n#define SIZEOF_SHORT 2\r\n#define SIZEOF_SIZE_T 4\r\n\r\n#define USE_MANUAL 1\r\n#define USE_OPENSSL 1\r\n#define USE_SSLEAY 1\r\n#define CURL_DISABLE_LDAP 1\r\n\r\n#define OS \"AmigaOS\"\r\n\r\n#define PACKAGE \"curl\"\r\n#define PACKAGE_BUGREPORT \"curl-bug@haxx.se\"\r\n#define PACKAGE_NAME \"curl\"\r\n#define PACKAGE_STRING \"curl -\"\r\n#define PACKAGE_TARNAME \"curl\"\r\n#define PACKAGE_VERSION \"-\"\r\n#define CURL_CA_BUNDLE \"s:curl-ca-bundle.crt\"\r\n\r\n#define RETSIGTYPE void\r\n#define SELECT_TYPE_ARG1 int\r\n#define SELECT_TYPE_ARG234 (fd_set *)\r\n#define SELECT_TYPE_ARG5 (struct timeval *)\r\n\r\n#define STDC_HEADERS 1\r\n#define TIME_WITH_SYS_TIME 1\r\n\r\n#define in_addr_t int\r\n\r\n#ifndef F_OK\r\n#  define F_OK 0\r\n#endif\r\n\r\n#ifndef O_RDONLY\r\n#  define O_RDONLY 0x0000\r\n#endif\r\n\r\n#ifndef LONG_MAX\r\n#  define LONG_MAX 0x7fffffffL\r\n#endif\r\n\r\n#ifndef LONG_MIN\r\n#  define LONG_MIN (-0x7fffffffL-1)\r\n#endif\r\n\r\n#define HAVE_GETNAMEINFO 1\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n#define GETNAMEINFO_TYPE_ARG2 int\r\n#define GETNAMEINFO_TYPE_ARG46 size_t\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n#define HAVE_RECV 1\r\n#define RECV_TYPE_ARG1 long\r\n#define RECV_TYPE_ARG2 char *\r\n#define RECV_TYPE_ARG3 long\r\n#define RECV_TYPE_ARG4 long\r\n#define RECV_TYPE_RETV long\r\n\r\n#define HAVE_RECVFROM 1\r\n#define RECVFROM_TYPE_ARG1 long\r\n#define RECVFROM_TYPE_ARG2 char\r\n#define RECVFROM_TYPE_ARG3 long\r\n#define RECVFROM_TYPE_ARG4 long\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n#define RECVFROM_TYPE_ARG6 long\r\n#define RECVFROM_TYPE_RETV long\r\n\r\n#define HAVE_SEND 1\r\n#define SEND_TYPE_ARG1 int\r\n#define SEND_QUAL_ARG2 const\r\n#define SEND_TYPE_ARG2 char *\r\n#define SEND_TYPE_ARG3 int\r\n#define SEND_TYPE_ARG4 int\r\n#define SEND_TYPE_RETV int\r\n\r\n#endif /* __AMIGA__ */\r\n#endif /* HEADER_CURL_CONFIG_AMIGAOS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-dos.h",
    "content": "#ifndef HEADER_CURL_CONFIG_DOS_H\r\n#define HEADER_CURL_CONFIG_DOS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n\r\n/* ================================================================ */\r\n/*       lib/config-dos.h - Hand crafted config file for DOS        */\r\n/* ================================================================ */\r\n\r\n#if defined(DJGPP)\r\n  #define OS  \"MSDOS/djgpp\"\r\n#elif defined(__HIGHC__)\r\n  #define OS  \"MSDOS/HighC\"\r\n#elif defined(__WATCOMC__)\r\n  #define OS  \"MSDOS/Watcom\"\r\n#else\r\n  #define OS  \"MSDOS/?\"\r\n#endif\r\n\r\n#define PACKAGE  \"curl\"\r\n\r\n#define HAVE_ARPA_INET_H       1\r\n#define HAVE_ERRNO_H           1\r\n#define HAVE_FCNTL_H           1\r\n#define HAVE_GETADDRINFO       1\r\n#define HAVE_GETNAMEINFO       1\r\n#define HAVE_GETPROTOBYNAME    1\r\n#define HAVE_GETTIMEOFDAY      1\r\n#define HAVE_IO_H              1\r\n#define HAVE_IOCTL             1\r\n#define HAVE_IOCTL_FIONBIO     1\r\n#define HAVE_IOCTLSOCKET       1\r\n#define HAVE_IOCTLSOCKET_FIONBIO   1\r\n#define HAVE_LIMITS_H          1\r\n#define HAVE_LOCALE_H          1\r\n#define HAVE_LONGLONG          1\r\n#define HAVE_MEMORY_H          1\r\n#define HAVE_NETDB_H           1\r\n#define HAVE_NETINET_IN_H      1\r\n#define HAVE_NETINET_TCP_H     1\r\n#define HAVE_NET_IF_H          1\r\n#define HAVE_PROCESS_H         1\r\n#define HAVE_RECV              1\r\n#define HAVE_RECVFROM          1\r\n#define HAVE_SELECT            1\r\n#define HAVE_SEND              1\r\n#define HAVE_SETJMP_H          1\r\n#define HAVE_SETLOCALE         1\r\n#define HAVE_SETMODE           1\r\n#define HAVE_SIGNAL            1\r\n#define HAVE_SOCKET            1\r\n#define HAVE_SPNEGO            1\r\n#define HAVE_STRDUP            1\r\n#define HAVE_STRICMP           1\r\n#define HAVE_STRTOLL           1\r\n#define HAVE_STRUCT_TIMEVAL    1\r\n#define HAVE_STRUCT_IN6_ADDR   1\r\n#define HAVE_SYS_IOCTL_H       1\r\n#define HAVE_SYS_SOCKET_H      1\r\n#define HAVE_SYS_STAT_H        1\r\n#define HAVE_SYS_TYPES_H       1\r\n#define HAVE_TERMIOS_H         1\r\n#define HAVE_TIME_H            1\r\n#define HAVE_UNISTD_H          1\r\n\r\n#define NEED_MALLOC_H          1\r\n\r\n#define RETSIGTYPE             void\r\n#define SIZEOF_INT             4\r\n#define SIZEOF_LONG_DOUBLE     16\r\n#define SIZEOF_SHORT           2\r\n#define SIZEOF_SIZE_T          4\r\n#define STDC_HEADERS           1\r\n#define TIME_WITH_SYS_TIME     1\r\n\r\n/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */\r\n\r\n#define SEND_TYPE_ARG1         int\r\n#define SEND_QUAL_ARG2         const\r\n#define SEND_TYPE_ARG2         void *\r\n#define SEND_TYPE_ARG3         int\r\n#define SEND_TYPE_ARG4         int\r\n#define SEND_TYPE_RETV         int\r\n\r\n#define RECV_TYPE_ARG1         int\r\n#define RECV_TYPE_ARG2         void *\r\n#define RECV_TYPE_ARG3         int\r\n#define RECV_TYPE_ARG4         int\r\n#define RECV_TYPE_RETV         int\r\n\r\n#define RECVFROM_TYPE_ARG1     int\r\n#define RECVFROM_TYPE_ARG2     void\r\n#define RECVFROM_TYPE_ARG3     int\r\n#define RECVFROM_TYPE_ARG4     int\r\n#define RECVFROM_TYPE_ARG5     struct sockaddr\r\n#define RECVFROM_TYPE_ARG6     int\r\n#define RECVFROM_TYPE_RETV     int\r\n#define RECVFROM_TYPE_ARG2_IS_VOID 1\r\n\r\n#define GETNAMEINFO_QUAL_ARG1  const\r\n#define GETNAMEINFO_TYPE_ARG1  struct sockaddr *\r\n#define GETNAMEINFO_TYPE_ARG2  int\r\n#define GETNAMEINFO_TYPE_ARG46 int\r\n#define GETNAMEINFO_TYPE_ARG7  int\r\n\r\n#define BSD\r\n\r\n/* CURLDEBUG definition enables memory tracking */\r\n/* #define CURLDEBUG */\r\n\r\n/* USE_ZLIB on cmd-line */\r\n#ifdef USE_ZLIB\r\n  #define HAVE_ZLIB_H            1\r\n  #define HAVE_LIBZ              1\r\n#endif\r\n\r\n/* USE_SSLEAY on cmd-line */\r\n#ifdef USE_SSLEAY\r\n  #define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1\r\n  #define HAVE_OPENSSL_ENGINE_H  1\r\n  #define OPENSSL_NO_KRB5        1\r\n  #define USE_OPENSSL            1\r\n#endif\r\n\r\n/* to disable LDAP */\r\n#define CURL_DISABLE_LDAP        1\r\n\r\n#define in_addr_t  u_long\r\n\r\n#if defined(__HIGHC__) || \\\r\n    (defined(__GNUC__) && (__GNUC__ < 4))\r\n#define ssize_t    int\r\n#endif\r\n\r\n#define CURL_CA_BUNDLE  getenv(\"CURL_CA_BUNDLE\")\r\n\r\n/* Target HAVE_x section */\r\n\r\n#if defined(DJGPP)\r\n  #define HAVE_BASENAME   1\r\n  #define HAVE_STRCASECMP 1\r\n  #define HAVE_SIGACTION  1\r\n  #define HAVE_SIGSETJMP  1\r\n  #define HAVE_SYS_TIME_H 1\r\n  #define HAVE_VARIADIC_MACROS_GCC 1\r\n\r\n  #if (DJGPP_MINOR >= 4)\r\n    #define HAVE_STRLCAT  1\r\n  #endif\r\n\r\n  /* Because djgpp <= 2.03 doesn't have snprintf() etc. */\r\n  #if (DJGPP_MINOR < 4)\r\n    #define _MPRINTF_REPLACE\r\n  #endif\r\n\r\n#elif defined(__WATCOMC__)\r\n  #define HAVE_STRCASECMP 1\r\n\r\n#elif defined(__HIGHC__)\r\n  #define HAVE_SYS_TIME_H 1\r\n#endif\r\n\r\n#ifdef MSDOS  /* Watt-32 */\r\n  #define HAVE_CLOSESOCKET_CAMEL  1\r\n  #define CloseSocket(s)          close_s((s))\r\n#endif\r\n\r\n#undef word\r\n#undef byte\r\n\r\n#endif /* HEADER_CURL_CONFIG_DOS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-mac.h",
    "content": "#ifndef HEADER_CURL_CONFIG_MAC_H\r\n#define HEADER_CURL_CONFIG_MAC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* =================================================================== */\r\n/*                Hand crafted config file for Mac OS 9                */\r\n/* =================================================================== */\r\n/*  On Mac OS X you must run configure to generate curl_config.h file  */\r\n/* =================================================================== */\r\n\r\n#define OS \"mac\"\r\n\r\n/* Define if you want the built-in manual */\r\n#define USE_MANUAL              1\r\n\r\n#define HAVE_ERRNO_H            1\r\n#define HAVE_NETINET_IN_H       1\r\n#define HAVE_SYS_SOCKET_H       1\r\n#define HAVE_SYS_SELECT_H       1\r\n#define HAVE_NETDB_H            1\r\n#define HAVE_ARPA_INET_H        1\r\n#define HAVE_UNISTD_H           1\r\n#define HAVE_NET_IF_H           1\r\n#define HAVE_SYS_TYPES_H        1\r\n#define HAVE_GETTIMEOFDAY       1\r\n#define HAVE_FCNTL_H            1\r\n#define HAVE_SYS_STAT_H         1\r\n#define HAVE_ALLOCA_H           1\r\n#define HAVE_STDLIB_H           1\r\n#define HAVE_TIME_H             1\r\n#define HAVE_UTIME_H            1\r\n#define HAVE_SYS_TIME_H         1\r\n#define HAVE_SYS_UTIME_H        1\r\n\r\n#define TIME_WITH_SYS_TIME      1\r\n\r\n#define HAVE_ALARM              1\r\n#define HAVE_FTRUNCATE          1\r\n#define HAVE_UTIME              1\r\n#define HAVE_SETVBUF            1\r\n#define HAVE_STRFTIME           1\r\n#define HAVE_INET_ADDR          1\r\n#define HAVE_MEMCPY             1\r\n#define HAVE_SELECT             1\r\n#define HAVE_SOCKET             1\r\n#define HAVE_STRUCT_TIMEVAL     1\r\n\r\n#define HAVE_SIGACTION          1\r\n#define HAVE_SIGNAL_H           1\r\n#define HAVE_SIG_ATOMIC_T       1\r\n\r\n#ifdef MACOS_SSL_SUPPORT\r\n#  define USE_SSLEAY            1\r\n#  define USE_OPENSSL           1\r\n#endif\r\n\r\n#define CURL_DISABLE_LDAP       1\r\n\r\n#define HAVE_RAND_STATUS        1\r\n#define HAVE_RAND_EGD           1\r\n\r\n#define HAVE_IOCTL              1\r\n#define HAVE_IOCTL_FIONBIO      1\r\n\r\n#define RETSIGTYPE void\r\n\r\n#define SIZEOF_INT              4\r\n#define SIZEOF_SHORT            2\r\n#define SIZEOF_SIZE_T           4\r\n\r\n#define HAVE_GETNAMEINFO 1\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n#define GETNAMEINFO_TYPE_ARG46 size_t\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n#define HAVE_RECV 1\r\n#define RECV_TYPE_ARG1 int\r\n#define RECV_TYPE_ARG2 void *\r\n#define RECV_TYPE_ARG3 size_t\r\n#define RECV_TYPE_ARG4 int\r\n#define RECV_TYPE_RETV ssize_t\r\n\r\n#define HAVE_RECVFROM 1\r\n#define RECVFROM_TYPE_ARG1 int\r\n#define RECVFROM_TYPE_ARG2 void\r\n#define RECVFROM_TYPE_ARG3 size_t\r\n#define RECVFROM_TYPE_ARG4 int\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n#define RECVFROM_TYPE_ARG6 int\r\n#define RECVFROM_TYPE_RETV ssize_t\r\n#define RECVFROM_TYPE_ARG2_IS_VOID 1\r\n\r\n#define HAVE_SEND 1\r\n#define SEND_TYPE_ARG1 int\r\n#define SEND_QUAL_ARG2 const\r\n#define SEND_TYPE_ARG2 void *\r\n#define SEND_TYPE_ARG3 size_T\r\n#define SEND_TYPE_ARG4 int\r\n#define SEND_TYPE_RETV ssize_t\r\n\r\n#define HAVE_EXTRA_STRICMP_H 1\r\n#define HAVE_EXTRA_STRDUP_H  1\r\n\r\n#endif /* HEADER_CURL_CONFIG_MAC_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-os400.h",
    "content": "#ifndef HEADER_CURL_CONFIG_OS400_H\r\n#define HEADER_CURL_CONFIG_OS400_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*                Hand crafted config file for OS/400               */\r\n/* ================================================================ */\r\n\r\n#pragma enum(int)\r\n\r\n#undef PACKAGE\r\n\r\n/* Version number of this archive. */\r\n#undef VERSION\r\n\r\n/* Define if you have the getpass function.  */\r\n#undef HAVE_GETPASS\r\n\r\n/* Define cpu-machine-OS */\r\n#define OS \"OS/400\"\r\n\r\n/* Define if you have the gethostbyaddr_r() function with 5 arguments */\r\n#define HAVE_GETHOSTBYADDR_R_5\r\n\r\n/* Define if you have the gethostbyaddr_r() function with 7 arguments */\r\n#undef HAVE_GETHOSTBYADDR_R_7\r\n\r\n/* Define if you have the gethostbyaddr_r() function with 8 arguments */\r\n#undef HAVE_GETHOSTBYADDR_R_8\r\n\r\n/* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its\r\n *  prototype is incompatible with the \"standard\" one (1st argument is not\r\n *  const). However, getaddrinfo() is supported (ASCII version defined as\r\n *  a local wrapper in setup-os400.h) in a threadsafe way: we can then\r\n *  configure getaddrinfo() as such and get rid of gethostbyname_r() without\r\n *  loss of threadsafeness. */\r\n#undef HAVE_GETHOSTBYNAME_R\r\n#undef HAVE_GETHOSTBYNAME_R_3\r\n#undef HAVE_GETHOSTBYNAME_R_5\r\n#undef HAVE_GETHOSTBYNAME_R_6\r\n#define HAVE_GETADDRINFO\r\n#define HAVE_GETADDRINFO_THREADSAFE\r\n\r\n/* Define if you need the _REENTRANT define for some functions */\r\n#undef NEED_REENTRANT\r\n\r\n/* Define if you have the Kerberos4 libraries (including -ldes) */\r\n#undef HAVE_KRB4\r\n\r\n/* Define if you want to enable IPv6 support */\r\n#define ENABLE_IPV6\r\n\r\n/* Define if struct sockaddr_in6 has the sin6_scope_id member */\r\n#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1\r\n\r\n/* Define this to 'int' if ssize_t is not an available typedefed type */\r\n#undef ssize_t\r\n\r\n/* Define this as a suitable file to read random data from */\r\n#undef RANDOM_FILE\r\n\r\n/* Define this to your Entropy Gathering Daemon socket pathname */\r\n#undef EGD_SOCKET\r\n\r\n/* Define to 1 if you have the alarm function. */\r\n#define HAVE_ALARM 1\r\n\r\n/* Define if you have the <alloca.h> header file. */\r\n#undef HAVE_ALLOCA_H\r\n\r\n/* Define if you have the <arpa/inet.h> header file. */\r\n#define HAVE_ARPA_INET_H\r\n\r\n/* Define if you have the `closesocket' function. */\r\n#undef HAVE_CLOSESOCKET\r\n\r\n/* Define if you have the <crypto.h> header file. */\r\n#undef HAVE_CRYPTO_H\r\n\r\n/* Define if you have the <des.h> header file. */\r\n#undef HAVE_DES_H\r\n\r\n/* Define if you have the <errno.h> header file. */\r\n#define HAVE_ERRNO_H\r\n\r\n/* Define if you have the <err.h> header file. */\r\n#undef HAVE_ERR_H\r\n\r\n/* Define if you have the <fcntl.h> header file. */\r\n#define HAVE_FCNTL_H\r\n\r\n/* Define if you have the `geteuid' function. */\r\n#define HAVE_GETEUID\r\n\r\n/* Define if you have the `gethostbyaddr' function. */\r\n#define HAVE_GETHOSTBYADDR\r\n\r\n/* Define if you have the `gethostbyaddr_r' function. */\r\n#define HAVE_GETHOSTBYADDR_R\r\n\r\n/* Define if you have the `gethostname' function. */\r\n#define HAVE_GETHOSTNAME\r\n\r\n/* Define if you have the <getopt.h> header file. */\r\n#undef HAVE_GETOPT_H\r\n\r\n/* Define if you have the `getpass_r' function. */\r\n#undef HAVE_GETPASS_R\r\n\r\n/* Define if you have the `getpwuid' function. */\r\n#define HAVE_GETPWUID\r\n\r\n/* Define if you have the `getservbyname' function. */\r\n#define HAVE_GETSERVBYNAME\r\n\r\n/* Define if you have the `gettimeofday' function. */\r\n#define HAVE_GETTIMEOFDAY\r\n\r\n/* Define if you have the `timeval' struct. */\r\n#define HAVE_STRUCT_TIMEVAL\r\n\r\n/* Define if you have the `inet_addr' function. */\r\n#define HAVE_INET_ADDR\r\n\r\n/* Define if you have the <inttypes.h> header file. */\r\n#define HAVE_INTTYPES_H\r\n\r\n/* Define if you have the <io.h> header file. */\r\n#undef HAVE_IO_H\r\n\r\n/* Define if you have the `krb_get_our_ip_for_realm' function. */\r\n#undef HAVE_KRB_GET_OUR_IP_FOR_REALM\r\n\r\n/* Define if you have the <krb.h> header file. */\r\n#undef HAVE_KRB_H\r\n\r\n/* Define if you have the `crypto' library (-lcrypto). */\r\n#undef HAVE_LIBCRYPTO\r\n\r\n/* Define if you have the `nsl' library (-lnsl). */\r\n#undef HAVE_LIBNSL\r\n\r\n/* Define if you have the `resolv' library (-lresolv). */\r\n#undef HAVE_LIBRESOLV\r\n\r\n/* Define if you have the `resolve' library (-lresolve). */\r\n#undef HAVE_LIBRESOLVE\r\n\r\n/* Define if you have the `socket' library (-lsocket). */\r\n#undef HAVE_LIBSOCKET\r\n\r\n/* Define if you have the `ssl' library (-lssl). */\r\n#undef HAVE_LIBSSL\r\n\r\n/* Define if you have GSS API. */\r\n#define HAVE_GSSAPI\r\n\r\n/* Define if you have the `ucb' library (-lucb). */\r\n#undef HAVE_LIBUCB\r\n\r\n/* Define if you have the `localtime_r' function. */\r\n#define HAVE_LOCALTIME_R\r\n\r\n/* Define if you have the <malloc.h> header file. */\r\n#define HAVE_MALLOC_H\r\n\r\n/* Define if you need the malloc.h header file even with stdlib.h  */\r\n/* #define NEED_MALLOC_H 1 */\r\n\r\n/* Define if you have the <memory.h> header file. */\r\n#undef HAVE_MEMORY_H\r\n\r\n/* Define if you have the <netdb.h> header file. */\r\n#define HAVE_NETDB_H\r\n\r\n/* Define if you have the <netinet/if_ether.h> header file. */\r\n#undef HAVE_NETINET_IF_ETHER_H\r\n\r\n/* Define if you have the <netinet/in.h> header file. */\r\n#define HAVE_NETINET_IN_H\r\n\r\n/* Define if you have the <net/if.h> header file. */\r\n#define HAVE_NET_IF_H\r\n\r\n/* Define if you have the <openssl/crypto.h> header file. */\r\n#undef HAVE_OPENSSL_CRYPTO_H\r\n\r\n/* Define if you have the <openssl/err.h> header file. */\r\n#undef HAVE_OPENSSL_ERR_H\r\n\r\n/* Define if you have the <openssl/pem.h> header file. */\r\n#undef HAVE_OPENSSL_PEM_H\r\n\r\n/* Define if you have the <openssl/rsa.h> header file. */\r\n#undef HAVE_OPENSSL_RSA_H\r\n\r\n/* Define if you have the <openssl/ssl.h> header file. */\r\n#undef HAVE_OPENSSL_SSL_H\r\n\r\n/* Define if you have the <openssl/x509.h> header file. */\r\n#undef HAVE_OPENSSL_X509_H\r\n\r\n/* Define if you have the <pem.h> header file. */\r\n#undef HAVE_PEM_H\r\n\r\n/* Define if you have the `perror' function. */\r\n#define HAVE_PERROR\r\n\r\n/* Define if you have the <pwd.h> header file. */\r\n#define HAVE_PWD_H\r\n\r\n/* Define if you have the `RAND_egd' function. */\r\n#undef HAVE_RAND_EGD\r\n\r\n/* Define if you have the `RAND_screen' function. */\r\n#undef HAVE_RAND_SCREEN\r\n\r\n/* Define if you have the `RAND_status' function. */\r\n#undef HAVE_RAND_STATUS\r\n\r\n/* Define if you have the <rsa.h> header file. */\r\n#undef HAVE_RSA_H\r\n\r\n/* Define if you have the `select' function. */\r\n#define HAVE_SELECT\r\n\r\n/* Define if you have the `setvbuf' function. */\r\n#define HAVE_SETVBUF\r\n\r\n/* Define if you have the <sgtty.h> header file. */\r\n#undef HAVE_SGTTY_H\r\n\r\n/* Define if you have the `sigaction' function. */\r\n#define HAVE_SIGACTION\r\n\r\n/* Define if you have the `signal' function. */\r\n#undef HAVE_SIGNAL\r\n\r\n/* Define if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H\r\n\r\n/* Define if sig_atomic_t is an available typedef. */\r\n#define HAVE_SIG_ATOMIC_T\r\n\r\n/* Define if sig_atomic_t is already defined as volatile. */\r\n#undef HAVE_SIG_ATOMIC_T_VOLATILE\r\n\r\n/* Define if you have the `socket' function. */\r\n#define HAVE_SOCKET\r\n\r\n/* Define if you have the <ssl.h> header file. */\r\n#undef HAVE_SSL_H\r\n\r\n/* Define if you have the <stdint.h> header file. */\r\n#undef HAVE_STDINT_H\r\n\r\n/* Define if you have the <stdlib.h> header file. */\r\n#define HAVE_STDLIB_H\r\n\r\n/* Define if you have the `strcasecmp' function. */\r\n#undef HAVE_STRCASECMP\r\n\r\n/* Define if you have the `strcmpi' function. */\r\n#undef HAVE_STRCMPI\r\n\r\n/* Define if you have the `strdup' function. */\r\n#undef HAVE_STRDUP\r\n\r\n/* Define if you have the `strftime' function. */\r\n#define HAVE_STRFTIME\r\n\r\n/* Define if you have the `stricmp' function. */\r\n#undef HAVE_STRICMP\r\n\r\n/* Define if you have the <strings.h> header file. */\r\n#define HAVE_STRINGS_H\r\n\r\n/* Define if you have the <string.h> header file. */\r\n#define HAVE_STRING_H\r\n\r\n/* Define if you have the `strlcat' function. */\r\n#undef HAVE_STRLCAT\r\n\r\n/* Define if you have the `strlcpy' function. */\r\n#undef HAVE_STRLCPY\r\n\r\n/* Define if you have the <stropts.h> header file. */\r\n#undef HAVE_STROPTS_H\r\n\r\n/* Define if you have the `strstr' function. */\r\n#define HAVE_STRSTR\r\n\r\n/* Define if you have the `strtok_r' function. */\r\n#define HAVE_STRTOK_R\r\n\r\n/* Define if you have the `strtoll' function. */\r\n#undef HAVE_STRTOLL             /* Allows ASCII compile on V5R1. */\r\n\r\n/* Define if you have the <sys/param.h> header file. */\r\n#define HAVE_SYS_PARAM_H\r\n\r\n/* Define if you have the <sys/select.h> header file. */\r\n#undef HAVE_SYS_SELECT_H\r\n\r\n/* Define if you have the <sys/socket.h> header file. */\r\n#define HAVE_SYS_SOCKET_H\r\n\r\n/* Define if you have the <sys/sockio.h> header file. */\r\n#undef HAVE_SYS_SOCKIO_H\r\n\r\n/* Define if you have the <sys/stat.h> header file. */\r\n#define HAVE_SYS_STAT_H\r\n\r\n/* Define if you have the <sys/time.h> header file. */\r\n#define HAVE_SYS_TIME_H\r\n\r\n/* Define if you have the <sys/types.h> header file. */\r\n#define HAVE_SYS_TYPES_H\r\n\r\n/* Define if you have the <sys/un.h> header file. */\r\n#define HAVE_SYS_UN_H\r\n\r\n/* Define if you have the <sys/ioctl.h> header file. */\r\n#define HAVE_SYS_IOCTL_H\r\n\r\n/* Define if you have the `tcgetattr' function. */\r\n#undef HAVE_TCGETATTR\r\n\r\n/* Define if you have the `tcsetattr' function. */\r\n#undef HAVE_TCSETATTR\r\n\r\n/* Define if you have the <termios.h> header file. */\r\n#undef HAVE_TERMIOS_H\r\n\r\n/* Define if you have the <termio.h> header file. */\r\n#undef HAVE_TERMIO_H\r\n\r\n/* Define if you have the <time.h> header file. */\r\n#define HAVE_TIME_H\r\n\r\n/* Define if you have the `uname' function. */\r\n#undef HAVE_UNAME\r\n\r\n/* Define if you have the <unistd.h> header file. */\r\n#define HAVE_UNISTD_H\r\n\r\n/* Define if you have the <winsock.h> header file. */\r\n#undef HAVE_WINSOCK_H\r\n\r\n/* Define if you have the <x509.h> header file. */\r\n#undef HAVE_X509_H\r\n\r\n/* Name of package */\r\n#undef PACKAGE\r\n\r\n/* Define as the return type of signal handlers (`int' or `void'). */\r\n#define RETSIGTYPE void\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT              4\r\n\r\n/* The size of a `long double', as computed by sizeof. */\r\n#define SIZEOF_LONG_DOUBLE      8\r\n\r\n/* Define if the compiler supports the 'long long' data type. */\r\n#define HAVE_LONGLONG\r\n\r\n/* The size of a `long long', as computed by sizeof. */\r\n#define SIZEOF_LONG_LONG        8\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT            2\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#define SIZEOF_SIZE_T           8\r\n\r\n/* Whether long long constants must be suffixed by LL. */\r\n\r\n#define HAVE_LL\r\n\r\n/* Define this if you have struct sockaddr_storage */\r\n#define HAVE_STRUCT_SOCKADDR_STORAGE\r\n\r\n/* Define if you have the ANSI C header files. */\r\n#define STDC_HEADERS\r\n\r\n/* Define if you can safely include both <sys/time.h> and <time.h>. */\r\n#define TIME_WITH_SYS_TIME\r\n\r\n/* Version number of package */\r\n#undef VERSION\r\n\r\n/* Number of bits in a file offset, on hosts where this is settable. */\r\n#undef _FILE_OFFSET_BITS\r\n\r\n/* Define for large files, on AIX-style hosts. */\r\n#define _LARGE_FILES\r\n\r\n/* Define to empty if `const' does not conform to ANSI C. */\r\n#undef const\r\n\r\n/* type to use in place of in_addr_t if not defined */\r\n#define in_addr_t       unsigned long\r\n\r\n/* Define to `unsigned' if <sys/types.h> does not define. */\r\n#undef size_t\r\n\r\n/* Define if you have the ioctl function. */\r\n#define HAVE_IOCTL\r\n\r\n/* Define if you have a working ioctl FIONBIO function. */\r\n#define HAVE_IOCTL_FIONBIO\r\n\r\n/* Define if you have a working ioctl SIOCGIFADDR function. */\r\n#define HAVE_IOCTL_SIOCGIFADDR\r\n\r\n/* To disable LDAP */\r\n#undef CURL_DISABLE_LDAP\r\n\r\n/* Definition to make a library symbol externally visible. */\r\n#define CURL_EXTERN_SYMBOL\r\n\r\n/* Define if you have the ldap_url_parse procedure. */\r\n/* #define HAVE_LDAP_URL_PARSE */    /* Disabled because of an IBM bug. */\r\n\r\n/* Define if you have the getnameinfo function. */\r\n/* OS400 has no ASCII version of this procedure: wrapped in setup-os400.h. */\r\n#define HAVE_GETNAMEINFO\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG46 socklen_t\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n/* Define if you have the recv function. */\r\n#define HAVE_RECV\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#define RECV_TYPE_ARG1 int\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#define RECV_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#define RECV_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#define RECV_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for recv. */\r\n#define RECV_TYPE_RETV int\r\n\r\n/* Define if you have the recvfrom function. */\r\n#define HAVE_RECVFROM\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG1 int\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG2 char\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG4 int\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG6 int\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#define RECVFROM_TYPE_RETV int\r\n\r\n/* Define if you have the send function. */\r\n#define HAVE_SEND\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#define SEND_TYPE_ARG1 int\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#define SEND_QUAL_ARG2\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#define SEND_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#define SEND_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#define SEND_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for send. */\r\n#define SEND_TYPE_RETV int\r\n\r\n/* Define to use the QsoSSL package. */\r\n#define USE_QSOSSL\r\n\r\n/* Use the system keyring as the default CA bundle. */\r\n#define CURL_CA_BUNDLE  \"/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB\"\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       ADDITIONAL DEFINITIONS                     */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* The following must be defined BEFORE system header files inclusion. */\r\n\r\n#define __ptr128                       /* No teraspace. */\r\n#define qadrt_use_fputc_inline         /* Generate fputc() wrapper inline. */\r\n#define qadrt_use_fread_inline         /* Generate fread() wrapper inline. */\r\n#define qadrt_use_fwrite_inline        /* Generate fwrite() wrapper inline. */\r\n\r\n#endif /* HEADER_CURL_CONFIG_OS400_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-riscos.h",
    "content": "#ifndef HEADER_CURL_CONFIG_RISCOS_H\r\n#define HEADER_CURL_CONFIG_RISCOS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               Hand crafted config file for RISC OS               */\r\n/* ================================================================ */\r\n\r\n/* Name of this package! */\r\n#undef PACKAGE\r\n\r\n/* Version number of this archive. */\r\n#undef VERSION\r\n\r\n/* Define if you have the getpass function.  */\r\n#undef HAVE_GETPASS\r\n\r\n/* Define cpu-machine-OS */\r\n#define OS \"ARM-RISC OS\"\r\n\r\n/* Define if you want the built-in manual */\r\n#define USE_MANUAL\r\n\r\n/* Define if you have the gethostbyaddr_r() function with 5 arguments */\r\n#undef HAVE_GETHOSTBYADDR_R_5\r\n\r\n/* Define if you have the gethostbyaddr_r() function with 7 arguments */\r\n#undef HAVE_GETHOSTBYADDR_R_7\r\n\r\n/* Define if you have the gethostbyaddr_r() function with 8 arguments */\r\n#undef HAVE_GETHOSTBYADDR_R_8\r\n\r\n/* Define if you have the gethostbyname_r() function with 3 arguments */\r\n#undef HAVE_GETHOSTBYNAME_R_3\r\n\r\n/* Define if you have the gethostbyname_r() function with 5 arguments */\r\n#undef HAVE_GETHOSTBYNAME_R_5\r\n\r\n/* Define if you have the gethostbyname_r() function with 6 arguments */\r\n#undef HAVE_GETHOSTBYNAME_R_6\r\n\r\n/* Define if you need the _REENTRANT define for some functions */\r\n#undef NEED_REENTRANT\r\n\r\n/* Define if you have the Kerberos4 libraries (including -ldes) */\r\n#undef HAVE_KRB4\r\n\r\n/* Define if you want to enable IPv6 support */\r\n#undef ENABLE_IPV6\r\n\r\n/* Define if struct sockaddr_in6 has the sin6_scope_id member */\r\n#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1\r\n\r\n/* Define this to 'int' if ssize_t is not an available typedefed type */\r\n#undef ssize_t\r\n\r\n/* Define this as a suitable file to read random data from */\r\n#undef RANDOM_FILE\r\n\r\n/* Define this to your Entropy Gathering Daemon socket pathname */\r\n#undef EGD_SOCKET\r\n\r\n/* Define if you want to enable IPv6 support */\r\n#undef ENABLE_IPV6\r\n\r\n/* Define if you have the alarm function. */\r\n#define HAVE_ALARM\r\n\r\n/* Define if you have the <alloca.h> header file. */\r\n#define HAVE_ALLOCA_H\r\n\r\n/* Define if you have the <arpa/inet.h> header file. */\r\n#define HAVE_ARPA_INET_H\r\n\r\n/* Define if you have the `closesocket' function. */\r\n#undef HAVE_CLOSESOCKET\r\n\r\n/* Define if you have the <crypto.h> header file. */\r\n#undef HAVE_CRYPTO_H\r\n\r\n/* Define if you have the <des.h> header file. */\r\n#undef HAVE_DES_H\r\n\r\n/* Define if you have the <errno.h> header file. */\r\n#define HAVE_ERRNO_H\r\n\r\n/* Define if you have the <err.h> header file. */\r\n#undef HAVE_ERR_H\r\n\r\n/* Define if you have the <fcntl.h> header file. */\r\n#define HAVE_FCNTL_H\r\n\r\n/* Define if you have the `ftruncate' function. */\r\n#define HAVE_FTRUNCATE\r\n\r\n/* Define if getaddrinfo exists and works */\r\n#define HAVE_GETADDRINFO\r\n\r\n/* Define if you have the `geteuid' function. */\r\n#undef HAVE_GETEUID\r\n\r\n/* Define if you have the `gethostbyaddr' function. */\r\n#define HAVE_GETHOSTBYADDR\r\n\r\n/* Define if you have the `gethostbyaddr_r' function. */\r\n#undef HAVE_GETHOSTBYADDR_R\r\n\r\n/* Define if you have the `gethostbyname_r' function. */\r\n#undef HAVE_GETHOSTBYNAME_R\r\n\r\n/* Define if you have the `gethostname' function. */\r\n#define HAVE_GETHOSTNAME\r\n\r\n/* Define if you have the <getopt.h> header file. */\r\n#define HAVE_GETOPT_H\r\n\r\n/* Define if you have the `getpass_r' function. */\r\n#undef HAVE_GETPASS_R\r\n\r\n/* Define if you have the `getpwuid' function. */\r\n#undef HAVE_GETPWUID\r\n\r\n/* Define if you have the `getservbyname' function. */\r\n#undef HAVE_GETSERVBYNAME\r\n\r\n/* Define if you have the `gettimeofday' function. */\r\n#define HAVE_GETTIMEOFDAY\r\n\r\n/* Define if you have the `timeval' struct. */\r\n#define HAVE_STRUCT_TIMEVAL\r\n\r\n/* Define if you have the `inet_addr' function. */\r\n#undef HAVE_INET_ADDR\r\n\r\n/* Define if you have the <inttypes.h> header file. */\r\n#define HAVE_INTTYPES_H\r\n\r\n/* Define if you have the <io.h> header file. */\r\n#undef HAVE_IO_H\r\n\r\n/* Define if you have the `krb_get_our_ip_for_realm' function. */\r\n#undef HAVE_KRB_GET_OUR_IP_FOR_REALM\r\n\r\n/* Define if you have the <krb.h> header file. */\r\n#undef HAVE_KRB_H\r\n\r\n/* Define if you have the `crypto' library (-lcrypto). */\r\n#undef HAVE_LIBCRYPTO\r\n\r\n/* Define if you have the `nsl' library (-lnsl). */\r\n#undef HAVE_LIBNSL\r\n\r\n/* Define if you have the `resolv' library (-lresolv). */\r\n#undef HAVE_LIBRESOLV\r\n\r\n/* Define if you have the `resolve' library (-lresolve). */\r\n#undef HAVE_LIBRESOLVE\r\n\r\n/* Define if you have the `socket' library (-lsocket). */\r\n#undef HAVE_LIBSOCKET\r\n\r\n/* Define if you have the `ssl' library (-lssl). */\r\n#undef HAVE_LIBSSL\r\n\r\n/* Define if you have the `ucb' library (-lucb). */\r\n#undef HAVE_LIBUCB\r\n\r\n/* Define if you have the `localtime_r' function. */\r\n#undef HAVE_LOCALTIME_R\r\n\r\n/* Define if you have the <malloc.h> header file. */\r\n#define HAVE_MALLOC_H\r\n\r\n/* Define if you need the malloc.h header file even with stdlib.h  */\r\n/* #define NEED_MALLOC_H 1 */\r\n\r\n/* Define if you have the <memory.h> header file. */\r\n#undef HAVE_MEMORY_H\r\n\r\n/* Define if you have the <netdb.h> header file. */\r\n#define HAVE_NETDB_H\r\n\r\n/* Define if you have the <netinet/if_ether.h> header file. */\r\n#undef HAVE_NETINET_IF_ETHER_H\r\n\r\n/* Define if you have the <netinet/in.h> header file. */\r\n#define HAVE_NETINET_IN_H\r\n\r\n/* Define if you have the <net/if.h> header file. */\r\n#define HAVE_NET_IF_H\r\n\r\n/* Define if you have the <openssl/crypto.h> header file. */\r\n#undef HAVE_OPENSSL_CRYPTO_H\r\n\r\n/* Define if you have the <openssl/err.h> header file. */\r\n#undef HAVE_OPENSSL_ERR_H\r\n\r\n/* Define if you have the <openssl/pem.h> header file. */\r\n#undef HAVE_OPENSSL_PEM_H\r\n\r\n/* Define if you have the <openssl/rsa.h> header file. */\r\n#undef HAVE_OPENSSL_RSA_H\r\n\r\n/* Define if you have the <openssl/ssl.h> header file. */\r\n#undef HAVE_OPENSSL_SSL_H\r\n\r\n/* Define if you have the <openssl/x509.h> header file. */\r\n#undef HAVE_OPENSSL_X509_H\r\n\r\n/* Define if you have the <pem.h> header file. */\r\n#undef HAVE_PEM_H\r\n\r\n/* Define if you have the `perror' function. */\r\n#undef HAVE_PERROR\r\n\r\n/* Define if you have the <pwd.h> header file. */\r\n#undef HAVE_PWD_H\r\n\r\n/* Define if you have the `RAND_egd' function. */\r\n#undef HAVE_RAND_EGD\r\n\r\n/* Define if you have the `RAND_screen' function. */\r\n#undef HAVE_RAND_SCREEN\r\n\r\n/* Define if you have the `RAND_status' function. */\r\n#undef HAVE_RAND_STATUS\r\n\r\n/* Define if you have the <rsa.h> header file. */\r\n#undef HAVE_RSA_H\r\n\r\n/* Define if you have the `select' function. */\r\n#define HAVE_SELECT\r\n\r\n/* Define if you have the `setvbuf' function. */\r\n#undef HAVE_SETVBUF\r\n\r\n/* Define if you have the <sgtty.h> header file. */\r\n#define HAVE_SGTTY_H\r\n\r\n/* Define if you have the `sigaction' function. */\r\n#undef HAVE_SIGACTION\r\n\r\n/* Define if you have the `signal' function. */\r\n#define HAVE_SIGNAL\r\n\r\n/* Define if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H\r\n\r\n/* Define if sig_atomic_t is an available typedef. */\r\n#define HAVE_SIG_ATOMIC_T\r\n\r\n/* Define if sig_atomic_t is already defined as volatile. */\r\n#undef HAVE_SIG_ATOMIC_T_VOLATILE\r\n\r\n/* Define if you have the `socket' function. */\r\n#define HAVE_SOCKET\r\n\r\n/* Define if you have the <ssl.h> header file. */\r\n#undef HAVE_SSL_H\r\n\r\n/* Define if you have the <stdint.h> header file. */\r\n#undef HAVE_STDINT_H\r\n\r\n/* Define if you have the <stdlib.h> header file. */\r\n#define HAVE_STDLIB_H\r\n\r\n/* Define if you have the `strcasecmp' function. */\r\n#undef HAVE_STRCASECMP\r\n\r\n/* Define if you have the `strcmpi' function. */\r\n#undef HAVE_STRCMPI\r\n\r\n/* Define if you have the `strdup' function. */\r\n#define HAVE_STRDUP\r\n\r\n/* Define if you have the `strftime' function. */\r\n#define HAVE_STRFTIME\r\n\r\n/* Define if you have the `stricmp' function. */\r\n#define HAVE_STRICMP\r\n\r\n/* Define if you have the <strings.h> header file. */\r\n#undef HAVE_STRINGS_H\r\n\r\n/* Define if you have the <string.h> header file. */\r\n#define HAVE_STRING_H\r\n\r\n/* Define if you have the `strlcat' function. */\r\n#undef HAVE_STRLCAT\r\n\r\n/* Define if you have the `strlcpy' function. */\r\n#undef HAVE_STRLCPY\r\n\r\n/* Define if you have the `strstr' function. */\r\n#define HAVE_STRSTR\r\n\r\n/* Define if you have the `strtok_r' function. */\r\n#undef HAVE_STRTOK_R\r\n\r\n/* Define if you have the `strtoll' function. */\r\n#undef HAVE_STRTOLL\r\n\r\n/* Define if you have the <sys/param.h> header file. */\r\n#undef HAVE_SYS_PARAM_H\r\n\r\n/* Define if you have the <sys/select.h> header file. */\r\n#undef HAVE_SYS_SELECT_H\r\n\r\n/* Define if you have the <sys/socket.h> header file. */\r\n#define HAVE_SYS_SOCKET_H\r\n\r\n/* Define if you have the <sys/sockio.h> header file. */\r\n#undef HAVE_SYS_SOCKIO_H\r\n\r\n/* Define if you have the <sys/stat.h> header file. */\r\n#undef HAVE_SYS_STAT_H\r\n\r\n/* Define if you have the <sys/time.h> header file. */\r\n#define HAVE_SYS_TIME_H\r\n\r\n/* Define if you have the <sys/types.h> header file. */\r\n#define HAVE_SYS_TYPES_H\r\n\r\n/* Define if you have the `tcgetattr' function. */\r\n#define HAVE_TCGETATTR\r\n\r\n/* Define if you have the `tcsetattr' function. */\r\n#define HAVE_TCSETATTR\r\n\r\n/* Define if you have the <termios.h> header file. */\r\n#define HAVE_TERMIOS_H\r\n\r\n/* Define if you have the <termio.h> header file. */\r\n#undef HAVE_TERMIO_H\r\n\r\n/* Define if you have the <time.h> header file. */\r\n#undef HAVE_TIME_H\r\n\r\n/* Define if you have the `uname' function. */\r\n#define HAVE_UNAME\r\n\r\n/* Define if you have the <unistd.h> header file. */\r\n#define HAVE_UNISTD_H\r\n\r\n/* Define if you have the <winsock.h> header file. */\r\n#undef HAVE_WINSOCK_H\r\n\r\n/* Define if you have the <x509.h> header file. */\r\n#undef HAVE_X509_H\r\n\r\n/* Name of package */\r\n#undef PACKAGE\r\n\r\n/* Define as the return type of signal handlers (`int' or `void'). */\r\n#define RETSIGTYPE void\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT 4\r\n\r\n/* The size of `long double', as computed by sizeof. */\r\n#undef SIZEOF_LONG_DOUBLE\r\n\r\n/* The size of `long long', as computed by sizeof. */\r\n#undef SIZEOF_LONG_LONG\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT 2\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#define SIZEOF_SIZE_T 4\r\n\r\n/* Define if you have the ANSI C header files. */\r\n#undef STDC_HEADERS\r\n\r\n/* Define if you can safely include both <sys/time.h> and <time.h>. */\r\n#undef TIME_WITH_SYS_TIME\r\n\r\n/* Version number of package */\r\n#undef VERSION\r\n\r\n/* Define if on AIX 3.\r\n   System headers sometimes define this.\r\n   We just want to avoid a redefinition error message.  */\r\n#ifndef _ALL_SOURCE\r\n# undef _ALL_SOURCE\r\n#endif\r\n\r\n/* Number of bits in a file offset, on hosts where this is settable. */\r\n#undef _FILE_OFFSET_BITS\r\n\r\n/* Define for large files, on AIX-style hosts. */\r\n#undef _LARGE_FILES\r\n\r\n/* Define to empty if `const' does not conform to ANSI C. */\r\n#undef const\r\n\r\n/* Define to `unsigned' if <sys/types.h> does not define. */\r\n#undef size_t\r\n\r\n/* Define to `int' if <sys/types.h> does not define. */\r\n#undef ssize_t\r\n\r\n/* Define if you have the ioctl function. */\r\n#define HAVE_IOCTL\r\n\r\n/* Define if you have a working ioctl FIONBIO function. */\r\n#define HAVE_IOCTL_FIONBIO\r\n\r\n/* to disable LDAP */\r\n#define CURL_DISABLE_LDAP\r\n\r\n/* Define if you have the getnameinfo function. */\r\n#define HAVE_GETNAMEINFO 1\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG46 size_t\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n/* Define if you have the recv function. */\r\n#define HAVE_RECV 1\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#define RECV_TYPE_ARG1 int\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#define RECV_TYPE_ARG2 void *\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#define RECV_TYPE_ARG3 size_t\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#define RECV_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for recv. */\r\n#define RECV_TYPE_RETV ssize_t\r\n\r\n/* Define 1 if you have the recvfrom function. */\r\n#define HAVE_RECVFROM 1\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG1 int\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG2 void\r\n\r\n/* Define if the type pointed by arg 2 for recvfrom is void. */\r\n#define RECVFROM_TYPE_ARG2_IS_VOID\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG3 size_t\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG4 int\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG6 int\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#define RECVFROM_TYPE_RETV ssize_t\r\n\r\n/* Define if you have the send function. */\r\n#define HAVE_SEND 1\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#define SEND_TYPE_ARG1 int\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#define SEND_QUAL_ARG2 const\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#define SEND_TYPE_ARG2 void *\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#define SEND_TYPE_ARG3 size_t\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#define SEND_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for send. */\r\n#define SEND_TYPE_RETV ssize_t\r\n\r\n#endif /* HEADER_CURL_CONFIG_RISCOS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-symbian.h",
    "content": "#ifndef HEADER_CURL_CONFIG_SYMBIAN_H\r\n#define HEADER_CURL_CONFIG_SYMBIAN_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               Hand crafted config file for Symbian               */\r\n/* ================================================================ */\r\n\r\n/* Location of default ca bundle */\r\n/* #define CURL_CA_BUNDLE \"/etc/pki/tls/certs/ca-bundle.crt\"*/\r\n\r\n/* Location of default ca path */\r\n/* #undef CURL_CA_PATH */\r\n\r\n/* to disable cookies support */\r\n/* #undef CURL_DISABLE_COOKIES */\r\n\r\n/* to disable cryptographic authentication */\r\n/* #undef CURL_DISABLE_CRYPTO_AUTH */\r\n\r\n/* to disable DICT */\r\n/* #undef CURL_DISABLE_DICT */\r\n\r\n/* to disable FILE */\r\n/* #undef CURL_DISABLE_FILE */\r\n\r\n/* to disable FTP */\r\n/* #undef CURL_DISABLE_FTP */\r\n\r\n/* to disable HTTP */\r\n/* #undef CURL_DISABLE_HTTP */\r\n\r\n/* to disable LDAP */\r\n#define CURL_DISABLE_LDAP 1\r\n\r\n/* to disable LDAPS */\r\n#define CURL_DISABLE_LDAPS 1\r\n\r\n/* to disable TELNET */\r\n/* #undef CURL_DISABLE_TELNET */\r\n\r\n/* to disable TFTP */\r\n/* #undef CURL_DISABLE_TFTP */\r\n\r\n/* to disable verbose strings */\r\n/* #define CURL_DISABLE_VERBOSE_STRINGS 1*/\r\n\r\n/* Definition to make a library symbol externally visible. */\r\n/* #undef CURL_EXTERN_SYMBOL */\r\n\r\n/* Use Windows LDAP implementation */\r\n/* #undef CURL_LDAP_WIN */\r\n\r\n/* your Entropy Gathering Daemon socket pathname */\r\n/* #undef EGD_SOCKET */\r\n\r\n/* Define if you want to enable IPv6 support */\r\n#define ENABLE_IPV6 1\r\n\r\n/* Define if struct sockaddr_in6 has the sin6_scope_id member */\r\n#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG46 size_t\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n/* Define to 1 if you have the <alloca.h> header file. */\r\n/*#define HAVE_ALLOCA_H 1*/\r\n\r\n/* Define to 1 if you have the <arpa/inet.h> header file. */\r\n#define HAVE_ARPA_INET_H 1\r\n\r\n/* Define to 1 if you have the <arpa/tftp.h> header file. */\r\n/*#define HAVE_ARPA_TFTP_H 1*/\r\n\r\n/* Define to 1 if you have the <assert.h> header file. */\r\n#define HAVE_ASSERT_H 1\r\n\r\n/* Define to 1 if you have the `basename' function. */\r\n/*#define HAVE_BASENAME 1*/\r\n\r\n/* Define to 1 if bool is an available type. */\r\n/*#define HAVE_BOOL_T 1*/\r\n\r\n/* Define to 1 if you have the `closesocket' function. */\r\n/* #undef HAVE_CLOSESOCKET */\r\n\r\n/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */\r\n/*#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1*/\r\n\r\n/* Define to 1 if you have the <crypto.h> header file. */\r\n/* #undef HAVE_CRYPTO_H */\r\n\r\n/* Define to 1 if you have the <des.h> header file. */\r\n/* #undef HAVE_DES_H */\r\n\r\n/* Define to 1 if you have the <dlfcn.h> header file. */\r\n#define HAVE_DLFCN_H 1\r\n\r\n/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */\r\n/*#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1*/\r\n\r\n/* Define to 1 if you have the <errno.h> header file. */\r\n#define HAVE_ERRNO_H 1\r\n\r\n/* Define to 1 if you have the <err.h> header file. */\r\n#define HAVE_ERR_H 1\r\n\r\n/* Define to 1 if you have the <fcntl.h> header file. */\r\n#define HAVE_FCNTL_H 1\r\n\r\n/* Define to 1 if you have the fcntl function. */\r\n#define HAVE_FCNTL 1\r\n\r\n/* Define to 1 if you have a working fcntl O_NONBLOCK function. */\r\n#define HAVE_FCNTL_O_NONBLOCK 1\r\n\r\n/* Define to 1 if you have the `fork' function. */\r\n/*#define HAVE_FORK 1*/\r\n\r\n/* Define to 1 if you have the `ftruncate' function. */\r\n#define HAVE_FTRUNCATE 1\r\n\r\n/* Define if getaddrinfo exists and works */\r\n#define HAVE_GETADDRINFO 1\r\n\r\n/* Define to 1 if you have the `geteuid' function. */\r\n#define HAVE_GETEUID 1\r\n\r\n/* Define to 1 if you have the `gethostbyaddr' function. */\r\n#define HAVE_GETHOSTBYADDR 1\r\n\r\n/* If you have gethostbyname */\r\n#define HAVE_GETHOSTBYNAME 1\r\n\r\n/* Define to 1 if you have the `gethostbyname_r' function. */\r\n/* #undef HAVE_GETHOSTBYNAME_R */\r\n\r\n/* gethostbyname_r() takes 3 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_3 */\r\n\r\n/* gethostbyname_r() takes 5 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_5 */\r\n\r\n/* gethostbyname_r() takes 6 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_6 */\r\n\r\n/* Define to 1 if you have the getnameinfo function. */\r\n#define HAVE_GETNAMEINFO 1\r\n\r\n/* Define to 1 if you have the `getpass_r' function. */\r\n/* #undef HAVE_GETPASS_R */\r\n\r\n/* Define to 1 if you have the `getppid' function. */\r\n#define HAVE_GETPPID 1\r\n\r\n/* Define to 1 if you have the `getprotobyname' function. */\r\n#define HAVE_GETPROTOBYNAME 1\r\n\r\n/* Define to 1 if you have the `getpwuid' function. */\r\n#define HAVE_GETPWUID 1\r\n\r\n/* Define to 1 if you have the `getrlimit' function. */\r\n/*#define HAVE_GETRLIMIT 1*/\r\n\r\n/* Define to 1 if you have the `gettimeofday' function. */\r\n#define HAVE_GETTIMEOFDAY 1\r\n\r\n/* we have a glibc-style strerror_r() */\r\n/* #undef HAVE_GLIBC_STRERROR_R */\r\n\r\n/* Define to 1 if you have the `gmtime_r' function. */\r\n#define HAVE_GMTIME_R 1\r\n\r\n/* if you have the gssapi libraries */\r\n/* #undef HAVE_GSSAPI */\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */\r\n/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi.h> header file. */\r\n/* #undef HAVE_GSSAPI_GSSAPI_H */\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */\r\n/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */\r\n\r\n/* if you have the GNU gssapi libraries */\r\n/* #undef HAVE_GSSGNU */\r\n\r\n/* if you have the Heimdal gssapi libraries */\r\n/* #undef HAVE_GSSHEIMDAL */\r\n\r\n/* if you have the MIT gssapi libraries */\r\n/* #undef HAVE_GSSMIT */\r\n\r\n/* Define to 1 if you have the `idna_strerror' function. */\r\n/*#define HAVE_IDNA_STRERROR 1*/\r\n\r\n/* Define to 1 if you have the `idn_free' function. */\r\n/*#define HAVE_IDN_FREE 1*/\r\n\r\n/* Define to 1 if you have the <idn-free.h> header file. */\r\n/*#define HAVE_IDN_FREE_H 1*/\r\n\r\n/* Define to 1 if you have the `inet_addr' function. */\r\n/*#define HAVE_INET_ADDR 1*/\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_ntop function. */\r\n/*#define HAVE_INET_NTOP 1*/\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_pton function. */\r\n/*#define HAVE_INET_PTON 1*/\r\n\r\n/* Define to 1 if you have the <inttypes.h> header file. */\r\n#define HAVE_INTTYPES_H 1\r\n\r\n/* Define to 1 if you have the ioctl function. */\r\n#define HAVE_IOCTL 1\r\n\r\n/* Define to 1 if you have a working ioctl FIONBIO function. */\r\n#define HAVE_IOCTL_FIONBIO 1\r\n\r\n/* Define to 1 if you have the ioctlsocket function. */\r\n/* #undef HAVE_IOCTLSOCKET */\r\n\r\n/* Define to 1 if you have a working ioctlsocket FIONBIO function. */\r\n/* #undef HAVE_IOCTLSOCKET_FIONBIO */\r\n\r\n/* Define to 1 if you have the IoctlSocket camel case function. */\r\n/* #undef HAVE_IOCTLSOCKET_CAMEL */\r\n\r\n/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */\r\n/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */\r\n\r\n/* Define to 1 if you have the <io.h> header file. */\r\n/* #undef HAVE_IO_H */\r\n\r\n/* if you have the Kerberos4 libraries (including -ldes) */\r\n/* #undef HAVE_KRB4 */\r\n\r\n/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */\r\n/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */\r\n\r\n/* Define to 1 if you have the <krb.h> header file. */\r\n/* #undef HAVE_KRB_H */\r\n\r\n/* Define to 1 if you have the lber.h header file. */\r\n/*#define HAVE_LBER_H 1*/\r\n\r\n/* Define to 1 if you have the ldapssl.h header file. */\r\n/* #undef HAVE_LDAPSSL_H */\r\n\r\n/* Define to 1 if you have the ldap.h header file. */\r\n/*#define HAVE_LDAP_H 1*/\r\n\r\n/* Use LDAPS implementation */\r\n/*#define HAVE_LDAP_SSL 1*/\r\n\r\n/* Define to 1 if you have the ldap_ssl.h header file. */\r\n/* #undef HAVE_LDAP_SSL_H */\r\n\r\n/* Define to 1 if you have the `ldap_url_parse' function. */\r\n/*#define HAVE_LDAP_URL_PARSE 1*/\r\n\r\n/* Define to 1 if you have the <libgen.h> header file. */\r\n/*#define HAVE_LIBGEN_H 1*/\r\n\r\n/* Define to 1 if you have the `idn' library (-lidn). */\r\n/*#define HAVE_LIBIDN 1*/\r\n\r\n/* Define to 1 if you have the `resolv' library (-lresolv). */\r\n/* #undef HAVE_LIBRESOLV */\r\n\r\n/* Define to 1 if you have the `resolve' library (-lresolve). */\r\n/* #undef HAVE_LIBRESOLVE */\r\n\r\n/* Define to 1 if you have the `socket' library (-lsocket). */\r\n/* #undef HAVE_LIBSOCKET */\r\n\r\n/* Define to 1 if you have the `ssh2' library (-lssh2). */\r\n/*#define HAVE_LIBSSH2 1*/\r\n\r\n/* Define to 1 if you have the <libssh2.h> header file. */\r\n/*#define HAVE_LIBSSH2_H 1*/\r\n\r\n/* Define to 1 if you have the `ssl' library (-lssl). */\r\n/*#define HAVE_LIBSSL 1*/\r\n\r\n/* Define to 1 if you have the <limits.h> header file. */\r\n#define HAVE_LIMITS_H 1\r\n\r\n/* if your compiler supports LL */\r\n#define HAVE_LL 1\r\n\r\n/* Define to 1 if you have the <locale.h> header file. */\r\n#define HAVE_LOCALE_H 1\r\n\r\n/* Define to 1 if you have the `localtime_r' function. */\r\n#define HAVE_LOCALTIME_R 1\r\n\r\n/* Define to 1 if the compiler supports the 'long long' data type. */\r\n#define HAVE_LONGLONG 1\r\n\r\n/* Define to 1 if you have the malloc.h header file. */\r\n/*#define HAVE_MALLOC_H 1*/\r\n\r\n/* Define to 1 if you have the <memory.h> header file. */\r\n#define HAVE_MEMORY_H 1\r\n\r\n/* Define to 1 if you have the MSG_NOSIGNAL flag. */\r\n/*#define HAVE_MSG_NOSIGNAL 1*/\r\n\r\n/* Define to 1 if you have the <netdb.h> header file. */\r\n#define HAVE_NETDB_H 1\r\n\r\n/* Define to 1 if you have the <netinet/in.h> header file. */\r\n#define HAVE_NETINET_IN_H 1\r\n\r\n/* Define to 1 if you have the <netinet/tcp.h> header file. */\r\n/*#define HAVE_NETINET_TCP_H 1*/\r\n\r\n/* Define to 1 if you have the <net/if.h> header file. */\r\n#define HAVE_NET_IF_H 1\r\n\r\n/* Define to 1 if NI_WITHSCOPEID exists and works. */\r\n/*#define HAVE_NI_WITHSCOPEID 1*/\r\n\r\n/* we have no strerror_r() proto */\r\n/* #undef HAVE_NO_STRERROR_R_DECL */\r\n\r\n/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE\r\n   */\r\n/* #undef HAVE_OLD_GSSMIT */\r\n\r\n/* Define to 1 if you have the <openssl/crypto.h> header file. */\r\n/*#define HAVE_OPENSSL_CRYPTO_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/engine.h> header file. */\r\n/*#define HAVE_OPENSSL_ENGINE_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/err.h> header file. */\r\n/*#define HAVE_OPENSSL_ERR_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/pem.h> header file. */\r\n/*#define HAVE_OPENSSL_PEM_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/pkcs12.h> header file. */\r\n/*#define HAVE_OPENSSL_PKCS12_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/rsa.h> header file. */\r\n/*#define HAVE_OPENSSL_RSA_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/ssl.h> header file. */\r\n/*#define HAVE_OPENSSL_SSL_H 1*/\r\n\r\n/* Define to 1 if you have the <openssl/x509.h> header file. */\r\n/*#define HAVE_OPENSSL_X509_H 1*/\r\n\r\n/* Define to 1 if you have the <pem.h> header file. */\r\n/* #undef HAVE_PEM_H */\r\n\r\n/* Define to 1 if you have the `perror' function. */\r\n#define HAVE_PERROR 1\r\n\r\n/* Define to 1 if you have the `pipe' function. */\r\n#define HAVE_PIPE 1\r\n\r\n/* Define to 1 if you have the `poll' function. */\r\n/*#define HAVE_POLL 1*/\r\n\r\n/* If you have a fine poll */\r\n/*#define HAVE_POLL_FINE 1*/\r\n\r\n/* Define to 1 if you have the <poll.h> header file. */\r\n/*#define HAVE_POLL_H 1*/\r\n\r\n/* we have a POSIX-style strerror_r() */\r\n#define HAVE_POSIX_STRERROR_R 1\r\n\r\n/* Define to 1 if you have the <pwd.h> header file. */\r\n#define HAVE_PWD_H 1\r\n\r\n/* Define to 1 if you have the `RAND_egd' function. */\r\n#define HAVE_RAND_EGD 1\r\n\r\n/* Define to 1 if you have the `RAND_screen' function. */\r\n/* #undef HAVE_RAND_SCREEN */\r\n\r\n/* Define to 1 if you have the `RAND_status' function. */\r\n/*#define HAVE_RAND_STATUS 1*/\r\n\r\n/* Define to 1 if you have the recv function. */\r\n#define HAVE_RECV 1\r\n\r\n/* Define to 1 if you have the recvfrom function. */\r\n#define HAVE_RECVFROM 1\r\n\r\n/* Define to 1 if you have the <rsa.h> header file. */\r\n/* #undef HAVE_RSA_H */\r\n\r\n/* Define to 1 if you have the select function. */\r\n#define HAVE_SELECT 1\r\n\r\n/* Define to 1 if you have the send function. */\r\n#define HAVE_SEND 1\r\n\r\n/* Define to 1 if you have the <setjmp.h> header file. */\r\n#define HAVE_SETJMP_H 1\r\n\r\n/* Define to 1 if you have the `setlocale' function. */\r\n#define HAVE_SETLOCALE 1\r\n\r\n/* Define to 1 if you have the `setmode' function. */\r\n/* #undef HAVE_SETMODE */\r\n\r\n/* Define to 1 if you have the `setrlimit' function. */\r\n/*#define HAVE_SETRLIMIT 1*/\r\n\r\n/* Define to 1 if you have the setsockopt function. */\r\n/* #undef HAVE_SETSOCKOPT */\r\n\r\n/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */\r\n/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */\r\n\r\n/* Define to 1 if you have the <sgtty.h> header file. */\r\n/*#define HAVE_SGTTY_H 1*/\r\n\r\n/* Define to 1 if you have the `sigaction' function. */\r\n/*#define HAVE_SIGACTION 1*/\r\n\r\n/* Define to 1 if you have the `siginterrupt' function. */\r\n/*#define HAVE_SIGINTERRUPT 1*/\r\n\r\n/* Define to 1 if you have the `signal' function. */\r\n/*#define HAVE_SIGNAL 1*/\r\n\r\n/* Define to 1 if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H 1\r\n\r\n/* If you have sigsetjmp */\r\n/*#define HAVE_SIGSETJMP 1*/\r\n\r\n/* Define to 1 if sig_atomic_t is an available typedef. */\r\n/*#define HAVE_SIG_ATOMIC_T 1*/\r\n\r\n/* Define to 1 if sig_atomic_t is already defined as volatile. */\r\n/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */\r\n\r\n/* Define to 1 if you have the `socket' function. */\r\n#define HAVE_SOCKET 1\r\n\r\n/* Define this if you have the SPNEGO library fbopenssl */\r\n/* #undef HAVE_SPNEGO */\r\n\r\n/* Define to 1 if you have the `SSL_get_shutdown' function. */\r\n/*#define HAVE_SSL_GET_SHUTDOWN 1*/\r\n\r\n/* Define to 1 if you have the <ssl.h> header file. */\r\n/* #undef HAVE_SSL_H */\r\n\r\n/* Define to 1 if you have the <stdbool.h> header file. */\r\n#define HAVE_STDBOOL_H 1\r\n\r\n/* Define to 1 if you have the <stdint.h> header file. */\r\n#define HAVE_STDINT_H 1\r\n\r\n/* Define to 1 if you have the <stdio.h> header file. */\r\n#define HAVE_STDIO_H 1\r\n\r\n/* Define to 1 if you have the <stdlib.h> header file. */\r\n#define HAVE_STDLIB_H 1\r\n\r\n/* Define to 1 if you have the `strcasecmp' function. */\r\n#define HAVE_STRCASECMP 1\r\n\r\n/* Define to 1 if you have the `strcasestr' function. */\r\n#define HAVE_STRCASESTR 1\r\n\r\n/* Define to 1 if you have the `strcmpi' function. */\r\n/* #undef HAVE_STRCMPI */\r\n\r\n/* Define to 1 if you have the `strdup' function. */\r\n#define HAVE_STRDUP 1\r\n\r\n/* Define to 1 if you have the `strerror_r' function. */\r\n#define HAVE_STRERROR_R 1\r\n\r\n/* Define to 1 if you have the `stricmp' function. */\r\n/* #undef HAVE_STRICMP */\r\n\r\n/* Define to 1 if you have the <strings.h> header file. */\r\n#define HAVE_STRINGS_H 1\r\n\r\n/* Define to 1 if you have the <string.h> header file. */\r\n#define HAVE_STRING_H 1\r\n\r\n/* Define to 1 if you have the `strlcat' function. */\r\n#define HAVE_STRLCAT 1\r\n\r\n/* Define to 1 if you have the `strlcpy' function. */\r\n#define HAVE_STRLCPY 1\r\n\r\n/* Define to 1 if you have the `strstr' function. */\r\n#define HAVE_STRSTR 1\r\n\r\n/* Define to 1 if you have the `strtok_r' function. */\r\n#define HAVE_STRTOK_R 1\r\n\r\n/* Define to 1 if you have the `strtoll' function. */\r\n#define HAVE_STRTOLL 1\r\n\r\n/* if struct sockaddr_storage is defined */\r\n#define HAVE_STRUCT_SOCKADDR_STORAGE 1\r\n\r\n/* Define to 1 if you have the timeval struct. */\r\n#define HAVE_STRUCT_TIMEVAL 1\r\n\r\n/* Define to 1 if you have the <sys/filio.h> header file. */\r\n#define HAVE_SYS_FILIO_H 1\r\n\r\n/* Define to 1 if you have the <sys/ioctl.h> header file. */\r\n#define HAVE_SYS_IOCTL_H 1\r\n\r\n/* Define to 1 if you have the <sys/param.h> header file. */\r\n#define HAVE_SYS_PARAM_H 1\r\n\r\n/* Define to 1 if you have the <sys/poll.h> header file. */\r\n/*#define HAVE_SYS_POLL_H 1*/\r\n\r\n/* Define to 1 if you have the <sys/resource.h> header file. */\r\n#define HAVE_SYS_RESOURCE_H 1\r\n\r\n/* Define to 1 if you have the <sys/select.h> header file. */\r\n#define HAVE_SYS_SELECT_H 1\r\n\r\n/* Define to 1 if you have the <sys/socket.h> header file. */\r\n#define HAVE_SYS_SOCKET_H 1\r\n\r\n/* Define to 1 if you have the <sys/sockio.h> header file. */\r\n#define HAVE_SYS_SOCKIO_H 1\r\n\r\n/* Define to 1 if you have the <sys/stat.h> header file. */\r\n#define HAVE_SYS_STAT_H 1\r\n\r\n/* Define to 1 if you have the <sys/time.h> header file. */\r\n#define HAVE_SYS_TIME_H 1\r\n\r\n/* Define to 1 if you have the <sys/types.h> header file. */\r\n#define HAVE_SYS_TYPES_H 1\r\n\r\n/* Define to 1 if you have the <sys/utime.h> header file. */\r\n/* #undef HAVE_SYS_UTIME_H */\r\n\r\n/* Define to 1 if you have the <termios.h> header file. */\r\n/*#define HAVE_TERMIOS_H 1*/\r\n\r\n/* Define to 1 if you have the <termio.h> header file. */\r\n/*#define HAVE_TERMIO_H 1*/\r\n\r\n/* Define to 1 if you have the <time.h> header file. */\r\n#define HAVE_TIME_H 1\r\n\r\n/* Define to 1 if you have the <tld.h> header file. */\r\n/*#define HAVE_TLD_H 1*/\r\n\r\n/* Define to 1 if you have the `tld_strerror' function. */\r\n/*#define HAVE_TLD_STRERROR 1*/\r\n\r\n/* Define to 1 if you have the `uname' function. */\r\n#define HAVE_UNAME 1\r\n\r\n/* Define to 1 if you have the <unistd.h> header file. */\r\n#define HAVE_UNISTD_H 1\r\n\r\n/* Define to 1 if you have the `utime' function. */\r\n#define HAVE_UTIME 1\r\n\r\n/* Define to 1 if you have the <utime.h> header file. */\r\n#define HAVE_UTIME_H 1\r\n\r\n/* Define to 1 if compiler supports C99 variadic macro style. */\r\n#define HAVE_VARIADIC_MACROS_C99 1\r\n\r\n/* Define to 1 if compiler supports old gcc variadic macro style. */\r\n/*#define HAVE_VARIADIC_MACROS_GCC 1*/\r\n\r\n/* Define to 1 if you have the winber.h header file. */\r\n/* #undef HAVE_WINBER_H */\r\n\r\n/* Define to 1 if you have the windows.h header file. */\r\n/* #undef HAVE_WINDOWS_H */\r\n\r\n/* Define to 1 if you have the winldap.h header file. */\r\n/* #undef HAVE_WINLDAP_H */\r\n\r\n/* Define to 1 if you have the winsock2.h header file. */\r\n/* #undef HAVE_WINSOCK2_H */\r\n\r\n/* Define to 1 if you have the winsock.h header file. */\r\n/* #undef HAVE_WINSOCK_H */\r\n\r\n/* Define this symbol if your OS supports changing the contents of argv */\r\n/*#define HAVE_WRITABLE_ARGV 1*/\r\n\r\n/* Define to 1 if you have the ws2tcpip.h header file. */\r\n/* #undef HAVE_WS2TCPIP_H */\r\n\r\n/* Define to 1 if you have the <x509.h> header file. */\r\n/* #undef HAVE_X509_H */\r\n\r\n/* Define to 1 if you need the lber.h header file even with ldap.h */\r\n/* #undef NEED_LBER_H */\r\n\r\n/* Define to 1 if you need the malloc.h header file even with stdlib.h */\r\n/* #undef NEED_MALLOC_H */\r\n\r\n/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */\r\n/* #undef NEED_REENTRANT */\r\n\r\n/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */\r\n/* #undef NEED_THREAD_SAFE */\r\n\r\n/* cpu-machine-OS */\r\n#ifdef __WINS__\r\n#define OS \"i386-pc-epoc32\"\r\n#elif __MARM__\r\n#define OS \"arm-unknown-epoc32\"\r\n#else\r\n/* This won't happen on any current Symbian version */\r\n#define OS \"unknown-unknown-epoc32\"\r\n#endif\r\n\r\n/* Name of package */\r\n/*#define PACKAGE \"curl\"*/\r\n\r\n/* Define to the address where bug reports for this package should be sent. */\r\n/*#define PACKAGE_BUGREPORT \"a suitable curl mailing list => http://curl.haxx.se/mail/\"*/\r\n\r\n/* Define to the full name of this package. */\r\n/*#define PACKAGE_NAME \"curl\"*/\r\n\r\n/* Define to the full name and version of this package. */\r\n/*#define PACKAGE_STRING \"curl -\"*/\r\n\r\n/* Define to the one symbol short name of this package. */\r\n/*#define PACKAGE_TARNAME \"curl\"*/\r\n\r\n/* Define to the version of this package. */\r\n/*#define PACKAGE_VERSION \"-\"*/\r\n\r\n/* a suitable file to read random data from */\r\n/*#define RANDOM_FILE \"/dev/urandom\"*/\r\n\r\n#define RECV_TYPE_ARG1 int\r\n#define RECV_TYPE_ARG2 void*\r\n#define RECV_TYPE_ARG3 size_t\r\n#define RECV_TYPE_ARG4 int\r\n#define RECV_TYPE_RETV ssize_t\r\n\r\n#define RECVFROM_TYPE_ARG1 int\r\n#define RECVFROM_TYPE_ARG2 void\r\n#define RECVFROM_TYPE_ARG3 size_t\r\n#define RECVFROM_TYPE_ARG4 int\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n#define RECVFROM_TYPE_ARG6 size_t\r\n#define RECVFROM_TYPE_RETV ssize_t\r\n#define RECVFROM_TYPE_ARG2_IS_VOID 1\r\n\r\n#define SEND_TYPE_ARG1 int\r\n#define SEND_QUAL_ARG2 const\r\n#define SEND_TYPE_ARG2 void*\r\n#define SEND_TYPE_ARG3 size_t\r\n#define SEND_TYPE_ARG4 int\r\n#define SEND_TYPE_RETV ssize_t\r\n\r\n\r\n/* Define as the return type of signal handlers (`int' or `void'). */\r\n/*#define RETSIGTYPE void*/\r\n\r\n/* Define to the type of arg 1 for `select'. */\r\n#define SELECT_TYPE_ARG1 int\r\n\r\n/* Define to the type of args 2, 3 and 4 for `select'. */\r\n#define SELECT_TYPE_ARG234 (fd_set *)\r\n\r\n/* Define to the type of arg 5 for `select'. */\r\n#define SELECT_TYPE_ARG5 (struct timeval *)\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT 4\r\n\r\n/* The size of `off_t', as computed by sizeof. */\r\n#define SIZEOF_OFF_T 8\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT 2\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#define SIZEOF_SIZE_T 4\r\n\r\n/* The size of `time_t', as computed by sizeof. */\r\n#define SIZEOF_TIME_T 4\r\n\r\n/* Define to 1 if you have the ANSI C header files. */\r\n#define STDC_HEADERS 1\r\n\r\n/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r\n#define TIME_WITH_SYS_TIME 1\r\n\r\n/* Define if you want to enable c-ares support */\r\n/* #undef USE_ARES */\r\n\r\n/* Define to disable non-blocking sockets */\r\n/* #undef USE_BLOCKING_SOCKETS */\r\n\r\n/* if GnuTLS is enabled */\r\n/* #undef USE_GNUTLS */\r\n\r\n/* if libSSH2 is in use */\r\n/*#define USE_LIBSSH2 1*/\r\n\r\n/* If you want to build curl with the built-in manual */\r\n/*#define USE_MANUAL 1*/\r\n\r\n/* if NSS is enabled */\r\n/* #undef USE_NSS */\r\n\r\n/* to enable SSPI support */\r\n/* #undef USE_WINDOWS_SSPI */\r\n\r\n/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */\r\n/* #undef USE_YASSLEMUL */\r\n\r\n/* Version number of package */\r\n/*#define VERSION \"7.18.2-CVS\"*/\r\n\r\n/* Define to avoid automatic inclusion of winsock.h */\r\n/* #undef WIN32_LEAN_AND_MEAN */\r\n\r\n/* Define to 1 if on AIX 3.\r\n   System headers sometimes define this.\r\n   We just want to avoid a redefinition error message.  */\r\n#ifndef _ALL_SOURCE\r\n/* # undef _ALL_SOURCE */\r\n#endif\r\n\r\n/* Number of bits in a file offset, on hosts where this is settable. */\r\n#define _FILE_OFFSET_BITS 64\r\n\r\n/* Define for large files, on AIX-style hosts. */\r\n/* #undef _LARGE_FILES */\r\n\r\n/* Define to empty if `const' does not conform to ANSI C. */\r\n/* #undef const */\r\n\r\n/* type to use in place of in_addr_t if not defined */\r\n/* #undef in_addr_t */\r\n\r\n/* Define to `__inline__' or `__inline' if that's what the C compiler\r\n   calls it, or to nothing if 'inline' is not supported under any name.  */\r\n#ifndef __cplusplus\r\n/* #undef inline */\r\n#endif\r\n\r\n/* Define to `unsigned int' if <sys/types.h> does not define. */\r\n/* #undef size_t */\r\n\r\n/* the signed version of size_t */\r\n/* #undef ssize_t */\r\n\r\n/* Enabling curl debug mode when building in Symbian debug mode would work */\r\n/* except that debug mode introduces new exports that must be frozen. */\r\n#ifdef _DEBUG\r\n/* #define CURLDEBUG */\r\n#endif\r\n\r\n/* sys/cdefs.h fails to define this for WINSCW prior to Symbian OS ver. 9.4 */\r\n#ifndef __LONG_LONG_SUPPORTED\r\n#define __LONG_LONG_SUPPORTED\r\n#endif\r\n\r\n/* Enable appropriate header only when zlib support is enabled */\r\n#ifdef HAVE_LIBZ\r\n#define HAVE_ZLIB_H 1\r\n#endif\r\n\r\n/* Enable appropriate definitions only when OpenSSL support is enabled */\r\n#ifdef USE_SSLEAY\r\n/* if OpenSSL is in use */\r\n#define USE_OPENSSL\r\n#endif\r\n\r\n#endif /* HEADER_CURL_CONFIG_SYMBIAN_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-tpf.h",
    "content": "#ifndef HEADER_CURL_CONFIG_TPF_H\r\n#define HEADER_CURL_CONFIG_TPF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*                 Hand crafted config file for TPF                 */\r\n/* ================================================================ */\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*            FEATURES, FUNCTIONS, and DEFINITIONS                  */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* NOTE: Refer also to the .mak file for some of the flags below */\r\n\r\n/* to disable cookies support */\r\n/* #undef CURL_DISABLE_COOKIES */\r\n\r\n/* to disable cryptographic authentication */\r\n/* #undef CURL_DISABLE_CRYPTO_AUTH */\r\n\r\n/* to disable DICT */\r\n/* #undef CURL_DISABLE_DICT */\r\n\r\n/* to disable FILE */\r\n/* #undef CURL_DISABLE_FILE */\r\n\r\n/* to disable FTP */\r\n/* #undef CURL_DISABLE_FTP */\r\n\r\n/* to disable HTTP */\r\n/* #undef CURL_DISABLE_HTTP */\r\n\r\n/* to disable LDAP */\r\n/* #undef CURL_DISABLE_LDAP */\r\n\r\n/* to disable TELNET */\r\n/* #undef CURL_DISABLE_TELNET */\r\n\r\n/* to disable TFTP */\r\n/* #undef CURL_DISABLE_TFTP */\r\n\r\n/* to disable verbose strings */\r\n/* #undef CURL_DISABLE_VERBOSE_STRINGS */\r\n\r\n/* lber dynamic library file */\r\n/* #undef DL_LBER_FILE */\r\n\r\n/* ldap dynamic library file */\r\n/* #undef DL_LDAP_FILE */\r\n\r\n/* your Entropy Gathering Daemon socket pathname */\r\n/* #undef EGD_SOCKET */\r\n\r\n/* Define if you want to enable IPv6 support */\r\n/* #undef ENABLE_IPV6 */\r\n\r\n/* Define if struct sockaddr_in6 has the sin6_scope_id member */\r\n/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG1 */\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG2 */\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG46 */\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG7 */\r\n\r\n/* Define to 1 if you have the alarm function. */\r\n#define HAVE_ALARM 1\r\n\r\n/* Define to 1 if you have the <arpa/inet.h> header file. */\r\n#define HAVE_ARPA_INET_H 1\r\n\r\n/* Define to 1 if you have the <arpa/tftp.h> header file. */\r\n/* #undef HAVE_ARPA_TFTP_H */\r\n\r\n/* Define to 1 if you have the <assert.h> header file. */\r\n#define HAVE_ASSERT_H 1\r\n\r\n/* Define to 1 if you have the `basename' function. */\r\n#define HAVE_BASENAME 1\r\n\r\n/* Define to 1 if you have the `closesocket' function. */\r\n/* #undef HAVE_CLOSESOCKET */\r\n\r\n/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */\r\n/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */\r\n#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1\r\n\r\n/* Define to 1 if you have the <crypto.h> header file. */\r\n/* #undef HAVE_CRYPTO_H */\r\n#define HAVE_CRYPTO_H 1\r\n\r\n/* Define to 1 if you have the <des.h> header file. */\r\n/* #undef HAVE_DES_H */\r\n#define HAVE_DES_H 1\r\n\r\n/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */\r\n/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */\r\n#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1\r\n\r\n/* Define to 1 if you have the <errno.h> header file. */\r\n#define HAVE_ERRNO_H 1\r\n\r\n/* Define to 1 if you have the <err.h> header file. */\r\n/* #undef HAVE_ERR_H */\r\n#define HAVE_ERR_H 1\r\n\r\n/* Define to 1 if you have the <fcntl.h> header file. */\r\n#define HAVE_FCNTL_H 1\r\n\r\n/* Define to 1 if you have the fcntl function. */\r\n#define HAVE_FCNTL 1\r\n\r\n/* Define to 1 if you have a working fcntl O_NONBLOCK function. */\r\n#define HAVE_FCNTL_O_NONBLOCK 1\r\n\r\n/* Define to 1 if you have the `fork' function. */\r\n/* #undef HAVE_FORK */\r\n#define HAVE_FORK 1\r\n\r\n/* Define to 1 if you have the `ftruncate' function. */\r\n#define HAVE_FTRUNCATE 1\r\n\r\n/* Define if getaddrinfo exists and works */\r\n/* #undef HAVE_GETADDRINFO */\r\n\r\n/* Define to 1 if you have the `geteuid' function. */\r\n#define HAVE_GETEUID 1\r\n\r\n/* Define to 1 if you have the `gethostbyaddr' function. */\r\n#define HAVE_GETHOSTBYADDR 1\r\n\r\n/* If you have gethostbyname */\r\n#define HAVE_GETHOSTBYNAME 1\r\n\r\n/* Define to 1 if you have the `gethostbyname_r' function. */\r\n/* #undef HAVE_GETHOSTBYNAME_R */\r\n\r\n/* gethostbyname_r() takes 3 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_3 */\r\n\r\n/* gethostbyname_r() takes 5 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_5 */\r\n\r\n/* gethostbyname_r() takes 6 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_6 1 */\r\n\r\n/* Define to 1 if you have the getnameinfo function. */\r\n/* #undef HAVE_GETNAMEINFO */\r\n\r\n/* Define to 1 if you have the `getpass_r' function. */\r\n/* #undef HAVE_GETPASS_R */\r\n\r\n/* Define to 1 if you have the `getprotobyname' function. */\r\n/* #undef HAVE_GETPROTOBYNAME */\r\n\r\n/* Define to 1 if you have the `getpwuid' function. */\r\n#define HAVE_GETPWUID 1\r\n\r\n/* Define to 1 if you have the `getrlimit' function. */\r\n/* #undef HAVE_GETRLIMIT */\r\n\r\n/* Define to 1 if you have the `gettimeofday' function. */\r\n#define HAVE_GETTIMEOFDAY 1\r\n\r\n/* we have a glibc-style strerror_r() */\r\n/* #undef HAVE_GLIBC_STRERROR_R */\r\n#define HAVE_GLIBC_STRERROR_R 1\r\n\r\n/* Define to 1 if you have the `gmtime_r' function. */\r\n#define HAVE_GMTIME_R 1\r\n\r\n/* if you have the gssapi libraries */\r\n/* #undef HAVE_GSSAPI */\r\n\r\n/* if you have the GNU gssapi libraries */\r\n/* #undef HAVE_GSSGNU */\r\n\r\n/* if you have the Heimdal gssapi libraries */\r\n/* #undef HAVE_GSSHEIMDAL */\r\n\r\n/* if you have the MIT gssapi libraries */\r\n/* #undef HAVE_GSSMIT */\r\n\r\n/* Define to 1 if you have the `iconv' functions. */\r\n#define HAVE_ICONV 1\r\n\r\n/* Define to 1 if you have the `idna_strerror' function. */\r\n/* #undef HAVE_IDNA_STRERROR */\r\n\r\n/* Define to 1 if you have the `idn_free' function. */\r\n/* #undef HAVE_IDN_FREE */\r\n\r\n/* Define to 1 if you have the <idn-free.h> header file. */\r\n/* #undef HAVE_IDN_FREE_H */\r\n\r\n/* Define to 1 if you have the `inet_addr' function. */\r\n#define HAVE_INET_ADDR 1\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_ntop function. */\r\n/* #undef HAVE_INET_NTOP */\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_pton function. */\r\n/* #undef HAVE_INET_PTON */\r\n\r\n/* Define to 1 if you have the <inttypes.h> header file. */\r\n#define HAVE_INTTYPES_H 1\r\n\r\n/* Define to 1 if you have the ioctl function. */\r\n#define HAVE_IOCTL 1\r\n\r\n/* Define to 1 if you have a working ioctl FIONBIO function. */\r\n#define HAVE_IOCTL_FIONBIO 1\r\n\r\n/* Define to 1 if you have the ioctlsocket function. */\r\n/* #undef HAVE_IOCTLSOCKET */\r\n\r\n/* Define to 1 if you have a working ioctlsocket FIONBIO function. */\r\n/* #undef HAVE_IOCTLSOCKET_FIONBIO */\r\n\r\n/* Define to 1 if you have the IoctlSocket camel case function. */\r\n/* #undef HAVE_IOCTLSOCKET_CAMEL */\r\n\r\n/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */\r\n/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */\r\n\r\n/* Define to 1 if you have the <io.h> header file. */\r\n/* #undef HAVE_IO_H */\r\n\r\n/* if you have the Kerberos4 libraries (including -ldes) */\r\n/* #undef HAVE_KRB4 */\r\n\r\n/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */\r\n/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */\r\n\r\n/* Define to 1 if you have the <krb.h> header file. */\r\n/* #undef HAVE_KRB_H */\r\n\r\n/* Define to 1 if you have the <libgen.h> header file. */\r\n/* #undef HAVE_LIBGEN_H 1 */\r\n\r\n/* Define to 1 if you have the `idn' library (-lidn). */\r\n/* #undef HAVE_LIBIDN */\r\n\r\n/* Define to 1 if you have the `resolv' library (-lresolv). */\r\n/* #undef HAVE_LIBRESOLV */\r\n\r\n/* Define to 1 if you have the `resolve' library (-lresolve). */\r\n/* #undef HAVE_LIBRESOLVE */\r\n\r\n/* Define to 1 if you have the `socket' library (-lsocket). */\r\n/* #undef HAVE_LIBSOCKET */\r\n\r\n/* Define to 1 if you have the `ssl' library (-lssl). */\r\n/* #undef HAVE_LIBSSL */\r\n#define HAVE_LIBSSL 1\r\n\r\n/* if zlib is available */\r\n/* #undef HAVE_LIBZ */\r\n\r\n/* Define to 1 if you have the <limits.h> header file. */\r\n#define HAVE_LIMITS_H 1\r\n\r\n/* if your compiler supports LL */\r\n#define HAVE_LL 1\r\n\r\n/* Define to 1 if you have the <locale.h> header file. */\r\n#define HAVE_LOCALE_H 1\r\n\r\n/* Define to 1 if you have the `localtime_r' function. */\r\n#define HAVE_LOCALTIME_R 1\r\n\r\n/* Define to 1 if the compiler supports the 'long long' data type. */\r\n#define HAVE_LONGLONG 1\r\n\r\n/* Define to 1 if you need the malloc.h header file even with stdlib.h  */\r\n/* #undef NEED_MALLOC_H */\r\n\r\n/* Define to 1 if you have the <memory.h> header file. */\r\n#define HAVE_MEMORY_H 1\r\n\r\n/* Define to 1 if you have the <netdb.h> header file. */\r\n#define HAVE_NETDB_H 1\r\n\r\n/* Define to 1 if you have the <netinet/in.h> header file. */\r\n#define HAVE_NETINET_IN_H 1\r\n\r\n/* Define to 1 if you have the <netinet/tcp.h> header file. */\r\n/* undef HAVE_NETINET_TCP_H */\r\n\r\n/* Define to 1 if you have the <net/if.h> header file. */\r\n#define HAVE_NET_IF_H 1\r\n\r\n/* Define if NI_WITHSCOPEID exists and works */\r\n/* #undef HAVE_NI_WITHSCOPEID */\r\n\r\n/* we have no strerror_r() proto */\r\n/* #undef HAVE_NO_STRERROR_R_DECL */\r\n\r\n/* Define to 1 if you have the <openssl/crypto.h> header file. */\r\n/* #undef HAVE_OPENSSL_CRYPTO_H */\r\n#define HAVE_OPENSSL_CRYPTO_H 1\r\n\r\n/* Define to 1 if you have the <openssl/engine.h> header file. */\r\n/* #undef HAVE_OPENSSL_ENGINE_H */\r\n#define HAVE_OPENSSL_ENGINE_H 1\r\n\r\n/* Define to 1 if you have the <openssl/err.h> header file. */\r\n/* #undef HAVE_OPENSSL_ERR_H */\r\n#define HAVE_OPENSSL_ERR_H 1\r\n\r\n/* Define to 1 if you have the <openssl/pem.h> header file. */\r\n/* #undef HAVE_OPENSSL_PEM_H */\r\n#define HAVE_OPENSSL_PEM_H 1\r\n\r\n/* Define to 1 if you have the <openssl/pkcs12.h> header file. */\r\n/* #undef HAVE_OPENSSL_PKCS12_H */\r\n#define HAVE_OPENSSL_PKCS12_H 1\r\n\r\n/* Define to 1 if you have the <openssl/rsa.h> header file. */\r\n/* #undef HAVE_OPENSSL_RSA_H */\r\n#define HAVE_OPENSSL_RSA_H 1\r\n\r\n/* Define to 1 if you have the <openssl/ssl.h> header file. */\r\n/* #undef HAVE_OPENSSL_SSL_H */\r\n#define HAVE_OPENSSL_SSL_H 1\r\n\r\n/* Define to 1 if you have the <openssl/x509.h> header file. */\r\n/* #undef HAVE_OPENSSL_X509_H */\r\n#define HAVE_OPENSSL_X509_H 1\r\n\r\n/* Define to 1 if you have the <pem.h> header file. */\r\n/* #undef HAVE_PEM_H */\r\n#define HAVE_PEM_H 1\r\n\r\n/* Define to 1 if you have the `perror' function. */\r\n#define HAVE_PERROR 1\r\n\r\n/* Define to 1 if you have the `pipe' function. */\r\n#define HAVE_PIPE 1\r\n\r\n/* Define to 1 if you have the `poll' function. */\r\n/* #undef HAVE_POLL */\r\n\r\n/* If you have a fine poll */\r\n/* #undef HAVE_POLL_FINE */\r\n\r\n/* we have a POSIX-style strerror_r() */\r\n/* #undef HAVE_POSIX_STRERROR_R */\r\n\r\n/* Define to 1 if you have the <pwd.h> header file. */\r\n#define HAVE_PWD_H 1\r\n\r\n/* Define to 1 if you have the `RAND_egd' function. */\r\n/* #undef HAVE_RAND_EGD */\r\n#define HAVE_RAND_EGD 1\r\n\r\n/* Define to 1 if you have the `RAND_screen' function. */\r\n/* #undef HAVE_RAND_SCREEN */\r\n\r\n/* Define to 1 if you have the `RAND_status' function. */\r\n/* #undef HAVE_RAND_STATUS */\r\n#define HAVE_RAND_STATUS 1\r\n\r\n/* Define to 1 if you have the <rsa.h> header file. */\r\n/* #undef HAVE_RSA_H */\r\n#define HAVE_RSA_H 1\r\n\r\n/* Define to 1 if you have the `select' function. */\r\n#define HAVE_SELECT 1\r\n\r\n/* Define to 1 if you have the <setjmp.h> header file. */\r\n#define HAVE_SETJMP_H 1\r\n\r\n/* Define to 1 if you have the `setlocale' function. */\r\n#define HAVE_SETLOCALE 1\r\n\r\n/* Define to 1 if you have the `setrlimit' function. */\r\n#define HAVE_SETRLIMIT 1\r\n\r\n/* Define to 1 if you have the setsockopt function. */\r\n/* #undef HAVE_SETSOCKOPT */\r\n\r\n/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */\r\n/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */\r\n\r\n/* Define to 1 if you have the <sgtty.h> header file. */\r\n/* #undef HAVE_SGTTY_H 1 */\r\n\r\n/* Define to 1 if you have the `sigaction' function. */\r\n#define HAVE_SIGACTION 1\r\n\r\n/* Define to 1 if you have the `siginterrupt' function. */\r\n/* #undef HAVE_SIGINTERRUPT */\r\n\r\n/* Define to 1 if you have the `signal' function. */\r\n#define HAVE_SIGNAL 1\r\n\r\n/* Define to 1 if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H 1\r\n\r\n/* Define to 1 if sig_atomic_t is an available typedef. */\r\n#define HAVE_SIG_ATOMIC_T 1\r\n\r\n/* Define to 1 if sig_atomic_t is already defined as volatile. */\r\n/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */\r\n\r\n/* If you have sigsetjmp */\r\n/* #undef HAVE_SIGSETJMP */\r\n\r\n/* Define to 1 if you have the `socket' function. */\r\n#define HAVE_SOCKET 1\r\n\r\n/* Define this if you have the SPNEGO library fbopenssl */\r\n/* #undef HAVE_SPNEGO */\r\n\r\n/* Define to 1 if you have the <ssl.h> header file. */\r\n/* #undef HAVE_SSL_H */\r\n#define HAVE_SSL_H 1\r\n\r\n/* Define to 1 if you have the <stdint.h> header file. */\r\n#define HAVE_STDINT_H 1\r\n\r\n/* Define to 1 if you have the <stdlib.h> header file. */\r\n#define HAVE_STDLIB_H 1\r\n\r\n/* Define to 1 if you have the `strcasecmp' function. */\r\n#define HAVE_STRCASECMP 1\r\n\r\n/* Define to 1 if you have the `strcmpi' function. */\r\n/* #undef HAVE_STRCMPI */\r\n\r\n/* Define to 1 if you have the `strdup' function. */\r\n#define HAVE_STRDUP 1\r\n\r\n/* Define to 1 if you have the `strerror_r' function. */\r\n#define HAVE_STRERROR_R 1\r\n\r\n/* Define to 1 if you have the `stricmp' function. */\r\n/* #undef HAVE_STRICMP */\r\n#define HAVE_STRICMP 1\r\n\r\n/* Define to 1 if you have the <strings.h> header file. */\r\n#define HAVE_STRINGS_H 1\r\n\r\n/* Define to 1 if you have the <string.h> header file. */\r\n#define HAVE_STRING_H 1\r\n\r\n/* Define to 1 if you have the `strlcat' function. */\r\n/* #undef HAVE_STRLCAT */\r\n\r\n/* Define to 1 if you have the `strlcpy' function. */\r\n/* #undef HAVE_STRLCPY */\r\n\r\n/* Define to 1 if you have the `strstr' function. */\r\n#define HAVE_STRSTR 1\r\n\r\n/* Define to 1 if you have the `strtok_r' function. */\r\n#define HAVE_STRTOK_R 1\r\n\r\n/* Define to 1 if you have the `strtoll' function. */\r\n#define HAVE_STRTOLL 1\r\n\r\n/* if struct sockaddr_storage is defined */\r\n/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */\r\n\r\n/* Define this if you have struct timeval */\r\n#define HAVE_STRUCT_TIMEVAL 1\r\n\r\n/* Define to 1 if you have the <sys/filio.h> header file. */\r\n#define HAVE_SYS_FILIO_H 1\r\n\r\n/* Define to 1 if you have the <sys/ioctl.h> header file. */\r\n#define HAVE_SYS_IOCTL_H 1\r\n\r\n/* Define to 1 if you have the <sys/param.h> header file. */\r\n#define HAVE_SYS_PARAM_H 1\r\n\r\n/* Define to 1 if you have the <sys/poll.h> header file. */\r\n/* #undef HAVE_SYS_POLL_H */\r\n\r\n/* Define to 1 if you have the <sys/resource.h> header file. */\r\n#define HAVE_SYS_RESOURCE_H 1\r\n\r\n/* Define to 1 if you have the <sys/select.h> header file. */\r\n#define HAVE_SYS_SELECT_H 1\r\n\r\n/* Define to 1 if you have the <sys/socket.h> header file. */\r\n#define HAVE_SYS_SOCKET_H 1\r\n\r\n/* Define to 1 if you have the <sys/sockio.h> header file. */\r\n/* #undef HAVE_SYS_SOCKIO_H */\r\n#define HAVE_SYS_SOCKIO_H 1\r\n\r\n/* Define to 1 if you have the <sys/stat.h> header file. */\r\n#define HAVE_SYS_STAT_H 1\r\n\r\n/* Define to 1 if you have the <sys/time.h> header file. */\r\n#define HAVE_SYS_TIME_H 1\r\n\r\n/* Define to 1 if you have the <sys/types.h> header file. */\r\n#define HAVE_SYS_TYPES_H 1\r\n\r\n/* Define to 1 if you have the <sys/utime.h> header file. */\r\n/* #undef HAVE_SYS_UTIME_H */\r\n\r\n/* Define to 1 if you have the <termios.h> header file. */\r\n/* #undef HAVE_TERMIOS_H */\r\n\r\n/* Define to 1 if you have the <termio.h> header file. */\r\n/* #undef HAVE_TERMIO_H */\r\n\r\n/* Define to 1 if you have the <time.h> header file. */\r\n#define HAVE_TIME_H 1\r\n\r\n/* Define to 1 if you have the <tld.h> header file. */\r\n/* #undef HAVE_TLD_H */\r\n\r\n/* Define to 1 if you have the `tld_strerror' function. */\r\n/* #undef HAVE_TLD_STRERROR */\r\n\r\n/* Define to 1 if you have the <unistd.h> header file. */\r\n#define HAVE_UNISTD_H 1\r\n\r\n/* Define to 1 if you have the `utime' function. */\r\n#define HAVE_UTIME 1\r\n\r\n/* Define to 1 if you have the <utime.h> header file. */\r\n#define HAVE_UTIME_H 1\r\n\r\n/* Define to 1 if you have the <winsock2.h> header file. */\r\n/* #undef HAVE_WINSOCK2_H */\r\n\r\n/* Define to 1 if you have the <winsock.h> header file. */\r\n/* #undef HAVE_WINSOCK_H */\r\n\r\n/* Define this symbol if your OS supports changing the contents of argv */\r\n/* #undef HAVE_WRITABLE_ARGV */\r\n\r\n/* Define to 1 if you have the ws2tcpip.h header file. */\r\n/* #undef HAVE_WS2TCPIP_H */\r\n\r\n/* Define to 1 if you have the <x509.h> header file. */\r\n/* #undef HAVE_X509_H */\r\n\r\n/* if you have the zlib.h header file */\r\n/* #undef HAVE_ZLIB_H */\r\n\r\n/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */\r\n/* #undef NEED_REENTRANT */\r\n\r\n/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */\r\n/* #undef NEED_THREAD_SAFE */\r\n\r\n/* cpu-machine-OS */\r\n#define OS \"s390x-ibm-tpf\"\r\n\r\n/* Name of package */\r\n#define PACKAGE \"curl\"\r\n\r\n/* Define to the address where bug reports for this package should be sent. */\r\n#define PACKAGE_BUGREPORT \"a suitable curl mailing list => http://curl.haxx.se/mail/\"\r\n\r\n/* Define to the full name of this package. */\r\n#define PACKAGE_NAME \"curl\"\r\n\r\n/* Define to the full name and version of this package. */\r\n#define PACKAGE_STRING \"curl -\"\r\n\r\n/* Define to the one symbol short name of this package. */\r\n#define PACKAGE_TARNAME \"curl\"\r\n\r\n/* Define to the version of this package. */\r\n#define PACKAGE_VERSION \"-\"\r\n\r\n/* a suitable file to read random data from */\r\n/* #undef RANDOM_FILE */\r\n\r\n/* Define as the return type of signal handlers (`int' or `void'). */\r\n#define RETSIGTYPE void\r\n\r\n/* Define to the type of arg 1 for `select'. */\r\n#define SELECT_TYPE_ARG1 int\r\n\r\n/* Define to the type of args 2, 3 and 4 for `select'. */\r\n#define SELECT_TYPE_ARG234 (fd_set *)\r\n\r\n/* Define to the type of arg 5 for `select'. */\r\n#define SELECT_TYPE_ARG5 (struct timeval *)\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT 4\r\n\r\n/* The size of `off_t', as computed by sizeof. */\r\n#define SIZEOF_OFF_T 8\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT 2\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#define SIZEOF_SIZE_T 8\r\n\r\n/* The size of `time_t', as computed by sizeof. */\r\n#define SIZEOF_TIME_T 8\r\n\r\n/* Define to 1 if you have the ANSI C header files. */\r\n#define STDC_HEADERS 1\r\n\r\n/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r\n#define TIME_WITH_SYS_TIME 1\r\n\r\n/* Define if you want to enable ares support */\r\n/* #undef USE_ARES */\r\n\r\n/* Define to disable non-blocking sockets */\r\n/* #undef USE_BLOCKING_SOCKETS */\r\n\r\n/* if GnuTLS is enabled */\r\n/* #undef USE_GNUTLS */\r\n\r\n/* If you want to build curl with the built-in manual */\r\n/* #undef USE_MANUAL */\r\n\r\n/* if OpenSSL is in use */\r\n/* #undef USE_OPENSSL */\r\n\r\n/* if SSL is enabled */\r\n/* #undef USE_SSLEAY */\r\n\r\n/* to enable SSPI support */\r\n/* #undef USE_WINDOWS_SSPI */\r\n\r\n/* Version number of package */\r\n#define VERSION \"not-used\"\r\n\r\n/* Define to avoid automatic inclusion of winsock.h */\r\n/* #undef WIN32_LEAN_AND_MEAN */\r\n\r\n/* Define to 1 if on AIX 3.\r\n   System headers sometimes define this.\r\n   We just want to avoid a redefinition error message.  */\r\n#ifndef _ALL_SOURCE\r\n/* # undef _ALL_SOURCE */\r\n#endif\r\n\r\n/* Number of bits in a file offset, on hosts where this is settable. */\r\n/* #undef _FILE_OFFSET_BITS */\r\n\r\n/* Define for large files, on AIX-style hosts. */\r\n/* #undef _LARGE_FILES */\r\n\r\n/* Define to empty if `const' does not conform to ANSI C. */\r\n/* #undef const */\r\n\r\n/* type to use in place of in_addr_t if not defined */\r\n/* #undef in_addr_t */\r\n\r\n/* Define to `unsigned' if <sys/types.h> does not define. */\r\n/* #undef size_t */\r\n\r\n/* the signed version of size_t */\r\n/* #undef ssize_t */\r\n\r\n/* Define to 1 if you have the getnameinfo function. */\r\n/* #undef HAVE_GETNAMEINFO 1 */\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n/* #undef GETNAMEINFO_QUAL_ARG1 const */\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG1 struct sockaddr * */\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG2 socklen_t */\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG46 size_t */\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n/* #undef GETNAMEINFO_TYPE_ARG7 int */\r\n\r\n/* Define to 1 if you have the recv function. */\r\n#define HAVE_RECV 1\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#define RECV_TYPE_ARG1 int\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#define RECV_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#define RECV_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#define RECV_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for recv. */\r\n#define RECV_TYPE_RETV int\r\n\r\n/* Define to 1 if you have the recvfrom function. */\r\n#define HAVE_RECVFROM 1\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG1 int\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG2 char\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG4 int\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG6 int\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#define RECVFROM_TYPE_RETV int\r\n\r\n/* Define to 1 if you have the send function. */\r\n#define HAVE_SEND 1\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#define SEND_TYPE_ARG1 int\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#define SEND_QUAL_ARG2 const\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#define SEND_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#define SEND_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#define SEND_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for send. */\r\n#define SEND_TYPE_RETV int\r\n\r\n#define CURL_DOES_CONVERSIONS\r\n#ifndef CURL_ICONV_CODESET_OF_HOST\r\n#define CURL_ICONV_CODESET_OF_HOST \"IBM-1047\"\r\n#endif\r\n\r\n\r\n#endif /* HEADER_CURL_CONFIG_TPF_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-vxworks.h",
    "content": "#ifndef HEADER_CURL_CONFIG_VXWORKS_H\r\n#define HEADER_CURL_CONFIG_VXWORKS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* =============================================================== */\r\n/*               Hand crafted config file for VxWorks              */\r\n/* =============================================================== */\r\n\r\n/* Location of default ca bundle */\r\n/* #undef CURL_CA_BUNDLE */\r\n\r\n/* Location of default ca path */\r\n/* #undef CURL_CA_PATH */\r\n\r\n/* to disable cookies support */\r\n/* #undef CURL_DISABLE_COOKIES */\r\n\r\n/* to disable cryptographic authentication */\r\n/* #undef CURL_DISABLE_CRYPTO_AUTH */\r\n\r\n/* to disable DICT */\r\n/* #undef CURL_DISABLE_DICT */\r\n\r\n/* to disable FILE */\r\n/* #undef CURL_DISABLE_FILE */\r\n\r\n/* to disable FTP */\r\n#define CURL_DISABLE_FTP 1\r\n\r\n/* to disable HTTP */\r\n/* #undef CURL_DISABLE_HTTP */\r\n\r\n/* to disable LDAP */\r\n#define CURL_DISABLE_LDAP 1\r\n\r\n/* to disable LDAPS */\r\n#define CURL_DISABLE_LDAPS 1\r\n\r\n/* to disable NTLM authentication */\r\n#define CURL_DISABLE_NTLM 1\r\n\r\n/* to disable proxies */\r\n/* #undef CURL_DISABLE_PROXY */\r\n\r\n/* to disable TELNET */\r\n#define CURL_DISABLE_TELNET 1\r\n\r\n/* to disable TFTP */\r\n#define CURL_DISABLE_TFTP 1\r\n\r\n/* to disable verbose strings */\r\n/* #undef CURL_DISABLE_VERBOSE_STRINGS */\r\n\r\n/* Definition to make a library symbol externally visible. */\r\n/* #undef CURL_EXTERN_SYMBOL */\r\n\r\n/* Use Windows LDAP implementation */\r\n/* #undef CURL_LDAP_WIN */\r\n\r\n/* your Entropy Gathering Daemon socket pathname */\r\n/* #undef EGD_SOCKET */\r\n\r\n/* Define if you want to enable IPv6 support */\r\n#define ENABLE_IPV6 1\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG46 size_t\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG7 unsigned int\r\n\r\n/* Specifies the number of arguments to getservbyport_r */\r\n#define GETSERVBYPORT_R_ARGS 6\r\n\r\n/* Specifies the size of the buffer to pass to getservbyport_r */\r\n#define GETSERVBYPORT_R_BUFSIZE 4096\r\n\r\n/* Define to 1 if you have the alarm function. */\r\n#define HAVE_ALARM 1\r\n\r\n/* Define to 1 if you have the <alloca.h> header file. */\r\n#define HAVE_ALLOCA_H 1\r\n\r\n/* Define to 1 if you have the <arpa/inet.h> header file. */\r\n#define HAVE_ARPA_INET_H 1\r\n\r\n/* Define to 1 if you have the <arpa/tftp.h> header file. */\r\n/* #undef HAVE_ARPA_TFTP_H */\r\n\r\n/* Define to 1 if you have the <assert.h> header file. */\r\n#define HAVE_ASSERT_H 1\r\n\r\n/* Define to 1 if you have the `basename' function. */\r\n/* #undef HAVE_BASENAME */\r\n\r\n/* Define to 1 if bool is an available type. */\r\n#define HAVE_BOOL_T 1\r\n\r\n/* Define to 1 if you have the clock_gettime function and monotonic timer. */\r\n/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */\r\n\r\n/* Define to 1 if you have the `closesocket' function. */\r\n/* #undef HAVE_CLOSESOCKET */\r\n\r\n/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */\r\n#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1\r\n\r\n/* Define to 1 if you have the <crypto.h> header file. */\r\n/* #undef HAVE_CRYPTO_H */\r\n\r\n/* Define to 1 if you have the <des.h> header file. */\r\n/* #undef HAVE_DES_H */\r\n\r\n/* Define to 1 if you have the <dlfcn.h> header file. */\r\n#define HAVE_DLFCN_H 1\r\n\r\n/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */\r\n#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1\r\n\r\n/* Define to 1 if you have the <errno.h> header file. */\r\n#define HAVE_ERRNO_H 1\r\n\r\n/* Define to 1 if you have the <err.h> header file. */\r\n/* #undef HAVE_ERR_H */\r\n\r\n/* Define to 1 if you have the fcntl function. */\r\n#define HAVE_FCNTL 1\r\n\r\n/* Define to 1 if you have the <fcntl.h> header file. */\r\n#define HAVE_FCNTL_H 1\r\n\r\n/* Define to 1 if you have a working fcntl O_NONBLOCK function. */\r\n#define HAVE_FCNTL_O_NONBLOCK 1\r\n\r\n/* Define to 1 if you have the fdopen function. */\r\n#define HAVE_FDOPEN 1\r\n\r\n/* Define to 1 if you have the `fork' function. */\r\n#define HAVE_FORK 1\r\n\r\n/* Define to 1 if you have the freeaddrinfo function. */\r\n#define HAVE_FREEADDRINFO 1\r\n\r\n/* Define to 1 if you have the freeifaddrs function. */\r\n#define HAVE_FREEIFADDRS 1\r\n\r\n/* Define to 1 if you have the ftruncate function. */\r\n#define HAVE_FTRUNCATE 1\r\n\r\n/* Define to 1 if you have a working getaddrinfo function. */\r\n#define HAVE_GETADDRINFO 1\r\n\r\n/* Define to 1 if you have the `geteuid' function. */\r\n/* #undef HAVE_GETEUID */\r\n\r\n/* Define to 1 if you have the gethostbyaddr function. */\r\n#define HAVE_GETHOSTBYADDR 1\r\n\r\n/* Define to 1 if you have the gethostbyaddr_r function. */\r\n#define HAVE_GETHOSTBYADDR_R 1\r\n\r\n/* gethostbyaddr_r() takes 5 args */\r\n/* #undef HAVE_GETHOSTBYADDR_R_5 */\r\n\r\n/* gethostbyaddr_r() takes 7 args */\r\n/* #undef HAVE_GETHOSTBYADDR_R_7 */\r\n\r\n/* gethostbyaddr_r() takes 8 args */\r\n#define HAVE_GETHOSTBYADDR_R_8 1\r\n\r\n/* Define to 1 if you have the gethostbyname function. */\r\n#define HAVE_GETHOSTBYNAME 1\r\n\r\n/* Define to 1 if you have the gethostbyname_r function. */\r\n/* #undef HAVE_GETHOSTBYNAME_R */\r\n\r\n/* gethostbyname_r() takes 3 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_3 */\r\n\r\n/* gethostbyname_r() takes 5 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_5 */\r\n\r\n/* gethostbyname_r() takes 6 args */\r\n/* #undef HAVE_GETHOSTBYNAME_R_6 */\r\n\r\n/* Define to 1 if you have the gethostname function. */\r\n#define HAVE_GETHOSTNAME 1\r\n\r\n/* Define to 1 if you have a working getifaddrs function. */\r\n/* #undef HAVE_GETIFADDRS */\r\n\r\n/* Define to 1 if you have the getnameinfo function. */\r\n#define HAVE_GETNAMEINFO 1\r\n\r\n/* Define to 1 if you have the `getpass_r' function. */\r\n/* #undef HAVE_GETPASS_R */\r\n\r\n/* Define to 1 if you have the `getppid' function. */\r\n#define HAVE_GETPPID 1\r\n\r\n/* Define to 1 if you have the `getprotobyname' function. */\r\n#define HAVE_GETPROTOBYNAME 1\r\n\r\n/* Define to 1 if you have the `getpwuid' function. */\r\n/* #undef HAVE_GETPWUID */\r\n\r\n/* Define to 1 if you have the `getrlimit' function. */\r\n#define HAVE_GETRLIMIT 1\r\n\r\n/* Define to 1 if you have the getservbyport_r function. */\r\n/* #undef HAVE_GETSERVBYPORT_R */\r\n\r\n/* Define to 1 if you have the `gettimeofday' function. */\r\n/* #undef HAVE_GETTIMEOFDAY */\r\n\r\n/* Define to 1 if you have a working glibc-style strerror_r function. */\r\n/* #undef HAVE_GLIBC_STRERROR_R */\r\n\r\n/* Define to 1 if you have a working gmtime_r function. */\r\n#define HAVE_GMTIME_R 1\r\n\r\n/* if you have the gssapi libraries */\r\n/* #undef HAVE_GSSAPI */\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */\r\n/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi.h> header file. */\r\n/* #undef HAVE_GSSAPI_GSSAPI_H */\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */\r\n/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */\r\n\r\n/* if you have the GNU gssapi libraries */\r\n/* #undef HAVE_GSSGNU */\r\n\r\n/* if you have the Heimdal gssapi libraries */\r\n/* #undef HAVE_GSSHEIMDAL */\r\n\r\n/* if you have the MIT gssapi libraries */\r\n/* #undef HAVE_GSSMIT */\r\n\r\n/* Define to 1 if you have the `idna_strerror' function. */\r\n/* #undef HAVE_IDNA_STRERROR */\r\n\r\n/* Define to 1 if you have the `idn_free' function. */\r\n/* #undef HAVE_IDN_FREE */\r\n\r\n/* Define to 1 if you have the <idn-free.h> header file. */\r\n/* #undef HAVE_IDN_FREE_H */\r\n\r\n/* Define to 1 if you have the <ifaddrs.h> header file. */\r\n/* #undef HAVE_IFADDRS_H */\r\n\r\n/* Define to 1 if you have the `inet_addr' function. */\r\n#define HAVE_INET_ADDR 1\r\n\r\n/* Define to 1 if you have the inet_ntoa_r function. */\r\n/* #undef HAVE_INET_NTOA_R */\r\n\r\n/* inet_ntoa_r() takes 2 args */\r\n/* #undef HAVE_INET_NTOA_R_2 */\r\n\r\n/* inet_ntoa_r() takes 3 args */\r\n/* #undef HAVE_INET_NTOA_R_3 */\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_ntop function. */\r\n/* #undef HAVE_INET_NTOP */\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_pton function. */\r\n/* #undef HAVE_INET_PTON */\r\n\r\n/* Define to 1 if you have the <inttypes.h> header file. */\r\n#define HAVE_INTTYPES_H 1\r\n\r\n/* Define to 1 if you have the ioctl function. */\r\n#define HAVE_IOCTL 1\r\n\r\n/* Define to 1 if you have the ioctlsocket function. */\r\n/* #undef HAVE_IOCTLSOCKET */\r\n\r\n/* Define to 1 if you have the IoctlSocket camel case function. */\r\n/* #undef HAVE_IOCTLSOCKET_CAMEL */\r\n\r\n/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.\r\n   */\r\n/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */\r\n\r\n/* Define to 1 if you have a working ioctlsocket FIONBIO function. */\r\n/* #undef HAVE_IOCTLSOCKET_FIONBIO */\r\n\r\n/* Define to 1 if you have a working ioctl FIONBIO function. */\r\n#define HAVE_IOCTL_FIONBIO 1\r\n\r\n/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */\r\n#define HAVE_IOCTL_SIOCGIFADDR 1\r\n\r\n/* Define to 1 if you have the <io.h> header file. */\r\n#define HAVE_IO_H 1\r\n\r\n/* if you have the Kerberos4 libraries (including -ldes) */\r\n/* #undef HAVE_KRB4 */\r\n\r\n/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */\r\n/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */\r\n\r\n/* Define to 1 if you have the <krb.h> header file. */\r\n/* #undef HAVE_KRB_H */\r\n\r\n/* Define to 1 if you have the lber.h header file. */\r\n/* #undef HAVE_LBER_H */\r\n\r\n/* Define to 1 if you have the ldapssl.h header file. */\r\n/* #undef HAVE_LDAPSSL_H */\r\n\r\n/* Define to 1 if you have the ldap.h header file. */\r\n/* #undef HAVE_LDAP_H */\r\n\r\n/* Use LDAPS implementation */\r\n/* #undef HAVE_LDAP_SSL */\r\n\r\n/* Define to 1 if you have the ldap_ssl.h header file. */\r\n/* #undef HAVE_LDAP_SSL_H */\r\n\r\n/* Define to 1 if you have the `ldap_url_parse' function. */\r\n/* #undef HAVE_LDAP_URL_PARSE */\r\n\r\n/* Define to 1 if you have the <libgen.h> header file. */\r\n/* #undef HAVE_LIBGEN_H */\r\n\r\n/* Define to 1 if you have the `idn' library (-lidn). */\r\n/* #undef HAVE_LIBIDN */\r\n\r\n/* Define to 1 if you have the `resolv' library (-lresolv). */\r\n/* #undef HAVE_LIBRESOLV */\r\n\r\n/* Define to 1 if you have the `resolve' library (-lresolve). */\r\n/* #undef HAVE_LIBRESOLVE */\r\n\r\n/* Define to 1 if you have the `socket' library (-lsocket). */\r\n/* #undef HAVE_LIBSOCKET */\r\n\r\n/* Define to 1 if you have the `ssh2' library (-lssh2). */\r\n/* #undef HAVE_LIBSSH2 */\r\n\r\n/* Define to 1 if you have the <libssh2.h> header file. */\r\n/* #undef HAVE_LIBSSH2_H */\r\n\r\n/* Define to 1 if you have the `libssh2_version' function. */\r\n/* #undef HAVE_LIBSSH2_VERSION */\r\n\r\n/* Define to 1 if you have the `ssl' library (-lssl). */\r\n#define HAVE_LIBSSL 1\r\n\r\n/* if zlib is available */\r\n#define HAVE_LIBZ 1\r\n\r\n/* Define to 1 if you have the <limits.h> header file. */\r\n#define HAVE_LIMITS_H 1\r\n\r\n/* if your compiler supports LL */\r\n#define HAVE_LL 1\r\n\r\n/* Define to 1 if you have the <locale.h> header file. */\r\n#define HAVE_LOCALE_H 1\r\n\r\n/* Define to 1 if you have a working localtime_r function. */\r\n#define HAVE_LOCALTIME_R 1\r\n\r\n/* Define to 1 if the compiler supports the 'long long' data type. */\r\n#define HAVE_LONGLONG 1\r\n\r\n/* Define to 1 if you have the malloc.h header file. */\r\n#define HAVE_MALLOC_H 1\r\n\r\n/* Define to 1 if you have the memory.h header file. */\r\n#define HAVE_MEMORY_H 1\r\n\r\n/* Define to 1 if you have the MSG_NOSIGNAL flag. */\r\n/* #undef HAVE_MSG_NOSIGNAL */\r\n\r\n/* Define to 1 if you have the <netdb.h> header file. */\r\n#define HAVE_NETDB_H 1\r\n\r\n/* Define to 1 if you have the <netinet/in.h> header file. */\r\n#define HAVE_NETINET_IN_H 1\r\n\r\n/* Define to 1 if you have the <netinet/tcp.h> header file. */\r\n#define HAVE_NETINET_TCP_H 1\r\n\r\n/* Define to 1 if you have the <net/if.h> header file. */\r\n#define HAVE_NET_IF_H 1\r\n\r\n/* Define to 1 if NI_WITHSCOPEID exists and works. */\r\n/* #undef HAVE_NI_WITHSCOPEID */\r\n\r\n/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE\r\n   */\r\n/* #undef HAVE_OLD_GSSMIT */\r\n\r\n/* Define to 1 if you have the <openssl/crypto.h> header file. */\r\n#define HAVE_OPENSSL_CRYPTO_H 1\r\n\r\n/* Define to 1 if you have the <openssl/engine.h> header file. */\r\n#define HAVE_OPENSSL_ENGINE_H 1\r\n\r\n/* Define to 1 if you have the <openssl/err.h> header file. */\r\n#define HAVE_OPENSSL_ERR_H 1\r\n\r\n/* Define to 1 if you have the <openssl/pem.h> header file. */\r\n#define HAVE_OPENSSL_PEM_H 1\r\n\r\n/* Define to 1 if you have the <openssl/pkcs12.h> header file. */\r\n#define HAVE_OPENSSL_PKCS12_H 1\r\n\r\n/* Define to 1 if you have the <openssl/rsa.h> header file. */\r\n#define HAVE_OPENSSL_RSA_H 1\r\n\r\n/* Define to 1 if you have the <openssl/ssl.h> header file. */\r\n#define HAVE_OPENSSL_SSL_H 1\r\n\r\n/* Define to 1 if you have the <openssl/x509.h> header file. */\r\n#define HAVE_OPENSSL_X509_H 1\r\n\r\n/* Define to 1 if you have the <pem.h> header file. */\r\n/* #undef HAVE_PEM_H */\r\n\r\n/* Define to 1 if you have the `perror' function. */\r\n#define HAVE_PERROR 1\r\n\r\n/* Define to 1 if you have the `pipe' function. */\r\n#define HAVE_PIPE 1\r\n\r\n/* Define to 1 if you have a working poll function. */\r\n/* #undef HAVE_POLL */\r\n\r\n/* If you have a fine poll */\r\n/* #undef HAVE_POLL_FINE */\r\n\r\n/* Define to 1 if you have the <poll.h> header file. */\r\n/* #undef HAVE_POLL_H */\r\n\r\n/* Define to 1 if you have a working POSIX-style strerror_r function. */\r\n/* #undef HAVE_POSIX_STRERROR_R */\r\n\r\n/* Define to 1 if you have the <pwd.h> header file. */\r\n/* #undef HAVE_PWD_H */\r\n\r\n/* Define to 1 if you have the `RAND_egd' function. */\r\n#define HAVE_RAND_EGD 1\r\n\r\n/* Define to 1 if you have the `RAND_screen' function. */\r\n/* #undef HAVE_RAND_SCREEN */\r\n\r\n/* Define to 1 if you have the `RAND_status' function. */\r\n#define HAVE_RAND_STATUS 1\r\n\r\n/* Define to 1 if you have the recv function. */\r\n#define HAVE_RECV 1\r\n\r\n/* Define to 1 if you have the recvfrom function. */\r\n#define HAVE_RECVFROM 1\r\n\r\n/* Define to 1 if you have the <rsa.h> header file. */\r\n/* #undef HAVE_RSA_H */\r\n\r\n/* Define to 1 if you have the select function. */\r\n#define HAVE_SELECT 1\r\n\r\n/* Define to 1 if you have the send function. */\r\n#define HAVE_SEND 1\r\n\r\n/* Define to 1 if you have the <setjmp.h> header file. */\r\n#define HAVE_SETJMP_H 1\r\n\r\n/* Define to 1 if you have the `setlocale' function. */\r\n#define HAVE_SETLOCALE 1\r\n\r\n/* Define to 1 if you have the `setmode' function. */\r\n#define HAVE_SETMODE 1\r\n\r\n/* Define to 1 if you have the `setrlimit' function. */\r\n#define HAVE_SETRLIMIT 1\r\n\r\n/* Define to 1 if you have the setsockopt function. */\r\n#define HAVE_SETSOCKOPT 1\r\n\r\n/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */\r\n/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */\r\n\r\n/* Define to 1 if you have the <sgtty.h> header file. */\r\n/* #undef HAVE_SGTTY_H */\r\n\r\n/* Define to 1 if you have the sigaction function. */\r\n#define HAVE_SIGACTION 1\r\n\r\n/* Define to 1 if you have the siginterrupt function. */\r\n#define HAVE_SIGINTERRUPT 1\r\n\r\n/* Define to 1 if you have the signal function. */\r\n#define HAVE_SIGNAL 1\r\n\r\n/* Define to 1 if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H 1\r\n\r\n/* Define to 1 if you have the sigsetjmp function or macro. */\r\n/* #undef HAVE_SIGSETJMP */\r\n\r\n/* Define to 1 if sig_atomic_t is an available typedef. */\r\n#define HAVE_SIG_ATOMIC_T 1\r\n\r\n/* Define to 1 if sig_atomic_t is already defined as volatile. */\r\n/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */\r\n\r\n/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */\r\n#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1\r\n\r\n/* Define to 1 if you have the `socket' function. */\r\n#define HAVE_SOCKET 1\r\n\r\n/* Define this if you have the SPNEGO library fbopenssl */\r\n/* #undef HAVE_SPNEGO */\r\n\r\n/* Define to 1 if you have the `SSL_get_shutdown' function. */\r\n#define HAVE_SSL_GET_SHUTDOWN 1\r\n\r\n/* Define to 1 if you have the <ssl.h> header file. */\r\n/* #undef HAVE_SSL_H */\r\n\r\n/* Define to 1 if you have the <stdbool.h> header file. */\r\n#define HAVE_STDBOOL_H 1\r\n\r\n/* Define to 1 if you have the <stdint.h> header file. */\r\n/* #undef HAVE_STDINT_H */\r\n\r\n/* Define to 1 if you have the <stdio.h> header file. */\r\n#define HAVE_STDIO_H 1\r\n\r\n/* Define to 1 if you have the <stdlib.h> header file. */\r\n#define HAVE_STDLIB_H 1\r\n\r\n/* Define to 1 if you have the strcasecmp function. */\r\n#define HAVE_STRCASECMP 1\r\n\r\n/* Define to 1 if you have the strcasestr function. */\r\n/* #undef HAVE_STRCASESTR */\r\n\r\n/* Define to 1 if you have the strcmpi function. */\r\n/* #undef HAVE_STRCMPI */\r\n\r\n/* Define to 1 if you have the strdup function. */\r\n#define HAVE_STRDUP 1\r\n\r\n/* Define to 1 if you have the strerror_r function. */\r\n#define HAVE_STRERROR_R 1\r\n\r\n/* Define to 1 if you have the stricmp function. */\r\n/* #undef HAVE_STRICMP */\r\n\r\n/* Define to 1 if you have the <strings.h> header file. */\r\n#define HAVE_STRINGS_H 1\r\n\r\n/* Define to 1 if you have the <string.h> header file. */\r\n#define HAVE_STRING_H 1\r\n\r\n/* Define to 1 if you have the strlcat function. */\r\n/* #undef HAVE_STRLCAT */\r\n\r\n/* Define to 1 if you have the `strlcpy' function. */\r\n/* #undef HAVE_STRLCPY */\r\n\r\n/* Define to 1 if you have the strncasecmp function. */\r\n#define HAVE_STRNCASECMP 1\r\n\r\n/* Define to 1 if you have the strncmpi function. */\r\n/* #undef HAVE_STRNCMPI */\r\n\r\n/* Define to 1 if you have the strnicmp function. */\r\n/* #undef HAVE_STRNICMP */\r\n\r\n/* Define to 1 if you have the <stropts.h> header file. */\r\n/* #undef HAVE_STROPTS_H */\r\n\r\n/* Define to 1 if you have the strstr function. */\r\n#define HAVE_STRSTR 1\r\n\r\n/* Define to 1 if you have the strtok_r function. */\r\n#define HAVE_STRTOK_R 1\r\n\r\n/* Define to 1 if you have the strtoll function. */\r\n/* #undef HAVE_STRTOLL */\r\n\r\n/* if struct sockaddr_storage is defined */\r\n#define HAVE_STRUCT_SOCKADDR_STORAGE 1\r\n\r\n/* Define to 1 if you have the timeval struct. */\r\n#define HAVE_STRUCT_TIMEVAL 1\r\n\r\n/* Define to 1 if you have the <sys/filio.h> header file. */\r\n/* #undef HAVE_SYS_FILIO_H */\r\n\r\n/* Define to 1 if you have the <sys/ioctl.h> header file. */\r\n#define HAVE_SYS_IOCTL_H 1\r\n\r\n/* Define to 1 if you have the <sys/param.h> header file. */\r\n/* #undef HAVE_SYS_PARAM_H */\r\n\r\n/* Define to 1 if you have the <sys/poll.h> header file. */\r\n/* #undef HAVE_SYS_POLL_H */\r\n\r\n/* Define to 1 if you have the <sys/resource.h> header file. */\r\n#define HAVE_SYS_RESOURCE_H 1\r\n\r\n/* Define to 1 if you have the <sys/select.h> header file. */\r\n/* #undef HAVE_SYS_SELECT_H */\r\n\r\n/* Define to 1 if you have the <sys/socket.h> header file. */\r\n#define HAVE_SYS_SOCKET_H 1\r\n\r\n/* Define to 1 if you have the <sys/sockio.h> header file. */\r\n/* #undef HAVE_SYS_SOCKIO_H */\r\n\r\n/* Define to 1 if you have the <sys/stat.h> header file. */\r\n#define HAVE_SYS_STAT_H 1\r\n\r\n/* Define to 1 if you have the <sys/time.h> header file. */\r\n/* #undef HAVE_SYS_TIME_H */\r\n\r\n/* Define to 1 if you have the <sys/types.h> header file. */\r\n#define HAVE_SYS_TYPES_H 1\r\n\r\n/* Define to 1 if you have the <sys/uio.h> header file. */\r\n#define HAVE_SYS_UIO_H 1\r\n\r\n/* Define to 1 if you have the <sys/un.h> header file. */\r\n#define HAVE_SYS_UN_H 1\r\n\r\n/* Define to 1 if you have the <sys/utime.h> header file. */\r\n#define HAVE_SYS_UTIME_H 1\r\n\r\n/* Define to 1 if you have the <termios.h> header file. */\r\n#define HAVE_TERMIOS_H 1\r\n\r\n/* Define to 1 if you have the <termio.h> header file. */\r\n#define HAVE_TERMIO_H 1\r\n\r\n/* Define to 1 if you have the <time.h> header file. */\r\n#define HAVE_TIME_H 1\r\n\r\n/* Define to 1 if you have the <tld.h> header file. */\r\n/* #undef HAVE_TLD_H */\r\n\r\n/* Define to 1 if you have the `tld_strerror' function. */\r\n/* #undef HAVE_TLD_STRERROR */\r\n\r\n/* Define to 1 if you have the `uname' function. */\r\n#define HAVE_UNAME 1\r\n\r\n/* Define to 1 if you have the <unistd.h> header file. */\r\n#define HAVE_UNISTD_H 1\r\n\r\n/* Define to 1 if you have the `utime' function. */\r\n#define HAVE_UTIME 1\r\n\r\n/* Define to 1 if you have the <utime.h> header file. */\r\n#define HAVE_UTIME_H 1\r\n\r\n/* Define to 1 if compiler supports C99 variadic macro style. */\r\n#define HAVE_VARIADIC_MACROS_C99 1\r\n\r\n/* Define to 1 if compiler supports old gcc variadic macro style. */\r\n#define HAVE_VARIADIC_MACROS_GCC 1\r\n\r\n/* Define to 1 if you have a working vxworks-style strerror_r function. */\r\n#define HAVE_VXWORKS_STRERROR_R 1\r\n\r\n/* Define to 1 if you have the winber.h header file. */\r\n/* #undef HAVE_WINBER_H */\r\n\r\n/* Define to 1 if you have the windows.h header file. */\r\n/* #undef HAVE_WINDOWS_H */\r\n\r\n/* Define to 1 if you have the winldap.h header file. */\r\n/* #undef HAVE_WINLDAP_H */\r\n\r\n/* Define to 1 if you have the winsock2.h header file. */\r\n/* #undef HAVE_WINSOCK2_H */\r\n\r\n/* Define to 1 if you have the winsock.h header file. */\r\n/* #undef HAVE_WINSOCK_H */\r\n\r\n/* Define this symbol if your OS supports changing the contents of argv */\r\n#define HAVE_WRITABLE_ARGV 1\r\n\r\n/* Define to 1 if you have the writev function. */\r\n#define HAVE_WRITEV 1\r\n\r\n/* Define to 1 if you have the ws2tcpip.h header file. */\r\n/* #undef HAVE_WS2TCPIP_H */\r\n\r\n/* Define to 1 if you have the <x509.h> header file. */\r\n/* #undef HAVE_X509_H */\r\n\r\n/* if you have the zlib.h header file */\r\n#define HAVE_ZLIB_H 1\r\n\r\n/* Define to 1 if you need the lber.h header file even with ldap.h */\r\n/* #undef NEED_LBER_H */\r\n\r\n/* Define to 1 if you need the malloc.h header file even with stdlib.h */\r\n/* #undef NEED_MALLOC_H */\r\n\r\n/* Define to 1 if you need the memory.h header file even with stdlib.h */\r\n/* #undef NEED_MEMORY_H */\r\n\r\n/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */\r\n/* #undef NEED_REENTRANT */\r\n\r\n/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */\r\n/* #undef NEED_THREAD_SAFE */\r\n\r\n/* Define to 1 if the open function requires three arguments. */\r\n#define OPEN_NEEDS_ARG3 1\r\n\r\n/* cpu-machine-OS */\r\n#define OS \"unknown-unknown-vxworks\"\r\n\r\n/* Name of package */\r\n#define PACKAGE \"curl\"\r\n\r\n/* a suitable file to read random data from */\r\n#define RANDOM_FILE \"/dev/urandom\"\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG1 int\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG2 void\r\n\r\n/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */\r\n#define RECVFROM_TYPE_ARG2_IS_VOID 1\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG3 size_t\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG4 int\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n\r\n/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */\r\n/* #undef RECVFROM_TYPE_ARG5_IS_VOID */\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG6 socklen_t\r\n\r\n/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */\r\n/* #undef RECVFROM_TYPE_ARG6_IS_VOID */\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#define RECVFROM_TYPE_RETV int\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#define RECV_TYPE_ARG1 int\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#define RECV_TYPE_ARG2 void *\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#define RECV_TYPE_ARG3 size_t\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#define RECV_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for recv. */\r\n#define RECV_TYPE_RETV int\r\n\r\n/* Define as the return type of signal handlers (`int' or `void'). */\r\n#define RETSIGTYPE void\r\n\r\n/* Define to the type qualifier of arg 5 for select. */\r\n#define SELECT_QUAL_ARG5\r\n\r\n/* Define to the type of arg 1 for select. */\r\n#define SELECT_TYPE_ARG1 int\r\n\r\n/* Define to the type of args 2, 3 and 4 for select. */\r\n#define SELECT_TYPE_ARG234 fd_set *\r\n\r\n/* Define to the type of arg 5 for select. */\r\n#define SELECT_TYPE_ARG5 struct timeval *\r\n\r\n/* Define to the function return type for select. */\r\n#define SELECT_TYPE_RETV int\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#define SEND_QUAL_ARG2 const\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#define SEND_TYPE_ARG1 int\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#define SEND_TYPE_ARG2 void *\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#define SEND_TYPE_ARG3 size_t\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#define SEND_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for send. */\r\n#define SEND_TYPE_RETV int\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT 4\r\n\r\n/* The size of `long', as computed by sizeof. */\r\n#define SIZEOF_LONG 4\r\n\r\n/* The size of `off_t', as computed by sizeof. */\r\n#define SIZEOF_OFF_T 8\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT 2\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#define SIZEOF_SIZE_T 4\r\n\r\n/* The size of `time_t', as computed by sizeof. */\r\n#define SIZEOF_TIME_T 4\r\n\r\n/* The size of `void*', as computed by sizeof. */\r\n#define SIZEOF_VOIDP 4\r\n\r\n/* Define to 1 if you have the ANSI C header files. */\r\n#define STDC_HEADERS 1\r\n\r\n/* Define to the type of arg 3 for strerror_r. */\r\n/* #undef STRERROR_R_TYPE_ARG3 */\r\n\r\n/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r\n/* #undef TIME_WITH_SYS_TIME */\r\n\r\n/* Define if you want to enable c-ares support */\r\n/* #undef USE_ARES */\r\n\r\n/* Define to disable non-blocking sockets. */\r\n/* #undef USE_BLOCKING_SOCKETS */\r\n\r\n/* if GnuTLS is enabled */\r\n/* #undef USE_GNUTLS */\r\n\r\n/* if libSSH2 is in use */\r\n/* #undef USE_LIBSSH2 */\r\n\r\n/* If you want to build curl with the built-in manual */\r\n#define USE_MANUAL 1\r\n\r\n/* if NSS is enabled */\r\n/* #undef USE_NSS */\r\n\r\n/* if OpenSSL is in use */\r\n#define USE_OPENSSL 1\r\n\r\n/* if SSL is enabled */\r\n#define USE_SSLEAY 1\r\n\r\n/* Define to 1 if you are building a Windows target without large file\r\n   support. */\r\n/* #undef USE_WIN32_LARGE_FILES */\r\n\r\n/* to enable SSPI support */\r\n/* #undef USE_WINDOWS_SSPI */\r\n\r\n/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */\r\n/* #undef USE_YASSLEMUL */\r\n\r\n/* Define to avoid automatic inclusion of winsock.h */\r\n/* #undef WIN32_LEAN_AND_MEAN */\r\n\r\n/* Define to 1 if OS is AIX. */\r\n#ifndef _ALL_SOURCE\r\n/* #  undef _ALL_SOURCE */\r\n#endif\r\n\r\n/* Number of bits in a file offset, on hosts where this is settable. */\r\n/* #undef _FILE_OFFSET_BITS */\r\n\r\n/* Define for large files, on AIX-style hosts. */\r\n/* #undef _LARGE_FILES */\r\n\r\n/* Define to empty if `const' does not conform to ANSI C. */\r\n/* #undef const */\r\n\r\n/* Type to use in place of in_addr_t when system does not provide it. */\r\n/* #undef in_addr_t */\r\n\r\n/* Define to `__inline__' or `__inline' if that's what the C compiler\r\n   calls it, or to nothing if 'inline' is not supported under any name.  */\r\n#ifndef __cplusplus\r\n/* #undef inline */\r\n#endif\r\n\r\n/* Define to `unsigned int' if <sys/types.h> does not define. */\r\n/* #undef size_t */\r\n\r\n/* the signed version of size_t */\r\n/* #undef ssize_t */\r\n\r\n#endif /* HEADER_CURL_CONFIG_VXWORKS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-win32.h",
    "content": "#ifndef HEADER_CURL_CONFIG_WIN32_H\r\n#define HEADER_CURL_CONFIG_WIN32_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               Hand crafted config file for Windows               */\r\n/* ================================================================ */\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                          HEADER FILES                            */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if you have the <arpa/inet.h> header file. */\r\n/* #define HAVE_ARPA_INET_H 1 */\r\n\r\n/* Define if you have the <assert.h> header file. */\r\n#define HAVE_ASSERT_H 1\r\n\r\n/* Define if you have the <crypto.h> header file. */\r\n/* #define HAVE_CRYPTO_H 1 */\r\n\r\n/* Define if you have the <errno.h> header file. */\r\n#define HAVE_ERRNO_H 1\r\n\r\n/* Define if you have the <err.h> header file. */\r\n/* #define HAVE_ERR_H 1 */\r\n\r\n/* Define if you have the <fcntl.h> header file. */\r\n#define HAVE_FCNTL_H 1\r\n\r\n/* Define if you have the <getopt.h> header file. */\r\n#if defined(__MINGW32__) || defined(__POCC__)\r\n#define HAVE_GETOPT_H 1\r\n#endif\r\n\r\n/* Define if you have the <io.h> header file. */\r\n#define HAVE_IO_H 1\r\n\r\n/* Define if you have the <limits.h> header file. */\r\n#define HAVE_LIMITS_H 1\r\n\r\n/* Define if you have the <locale.h> header file. */\r\n#define HAVE_LOCALE_H 1\r\n\r\n/* Define if you need <malloc.h> header even with <stdlib.h> header file. */\r\n#if !defined(__SALFORDC__) && !defined(__POCC__)\r\n#define NEED_MALLOC_H 1\r\n#endif\r\n\r\n/* Define if you have the <netdb.h> header file. */\r\n/* #define HAVE_NETDB_H 1 */\r\n\r\n/* Define if you have the <netinet/in.h> header file. */\r\n/* #define HAVE_NETINET_IN_H 1 */\r\n\r\n/* Define if you have the <process.h> header file. */\r\n#ifndef __SALFORDC__\r\n#define HAVE_PROCESS_H 1\r\n#endif\r\n\r\n/* Define if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H 1\r\n\r\n/* Define if you have the <sgtty.h> header file. */\r\n/* #define HAVE_SGTTY_H 1 */\r\n\r\n/* Define if you have the <ssl.h> header file. */\r\n/* #define HAVE_SSL_H 1 */\r\n\r\n/* Define if you have the <stdlib.h> header file. */\r\n#define HAVE_STDLIB_H 1\r\n\r\n/* Define if you have the <sys/param.h> header file. */\r\n/* #define HAVE_SYS_PARAM_H 1 */\r\n\r\n/* Define if you have the <sys/select.h> header file. */\r\n/* #define HAVE_SYS_SELECT_H 1 */\r\n\r\n/* Define if you have the <sys/socket.h> header file. */\r\n/* #define HAVE_SYS_SOCKET_H 1 */\r\n\r\n/* Define if you have the <sys/sockio.h> header file. */\r\n/* #define HAVE_SYS_SOCKIO_H 1 */\r\n\r\n/* Define if you have the <sys/stat.h> header file. */\r\n#define HAVE_SYS_STAT_H 1\r\n\r\n/* Define if you have the <sys/time.h> header file. */\r\n/* #define HAVE_SYS_TIME_H 1 */\r\n\r\n/* Define if you have the <sys/types.h> header file. */\r\n#define HAVE_SYS_TYPES_H 1\r\n\r\n/* Define if you have the <sys/utime.h> header file. */\r\n#ifndef __BORLANDC__\r\n#define HAVE_SYS_UTIME_H 1\r\n#endif\r\n\r\n/* Define if you have the <termio.h> header file. */\r\n/* #define HAVE_TERMIO_H 1 */\r\n\r\n/* Define if you have the <termios.h> header file. */\r\n/* #define HAVE_TERMIOS_H 1 */\r\n\r\n/* Define if you have the <time.h> header file. */\r\n#define HAVE_TIME_H 1\r\n\r\n/* Define if you have the <unistd.h> header file. */\r\n#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \\\r\n    defined(__POCC__)\r\n#define HAVE_UNISTD_H 1\r\n#endif\r\n\r\n/* Define if you have the <windows.h> header file. */\r\n#define HAVE_WINDOWS_H 1\r\n\r\n/* Define if you have the <winsock.h> header file. */\r\n#define HAVE_WINSOCK_H 1\r\n\r\n/* Define if you have the <winsock2.h> header file. */\r\n#ifndef __SALFORDC__\r\n#define HAVE_WINSOCK2_H 1\r\n#endif\r\n\r\n/* Define if you have the <ws2tcpip.h> header file. */\r\n#ifndef __SALFORDC__\r\n#define HAVE_WS2TCPIP_H 1\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        OTHER HEADER INFO                         */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if sig_atomic_t is an available typedef. */\r\n#define HAVE_SIG_ATOMIC_T 1\r\n\r\n/* Define if you have the ANSI C header files. */\r\n#define STDC_HEADERS 1\r\n\r\n/* Define if you can safely include both <sys/time.h> and <time.h>. */\r\n/* #define TIME_WITH_SYS_TIME 1 */\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                             FUNCTIONS                            */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if you have the closesocket function. */\r\n#define HAVE_CLOSESOCKET 1\r\n\r\n/* Define if you don't have vprintf but do have _doprnt. */\r\n/* #define HAVE_DOPRNT 1 */\r\n\r\n/* Define if you have the ftruncate function. */\r\n#define HAVE_FTRUNCATE 1\r\n\r\n/* Define if you have the gethostbyaddr function. */\r\n#define HAVE_GETHOSTBYADDR 1\r\n\r\n/* Define if you have the gethostname function. */\r\n#define HAVE_GETHOSTNAME 1\r\n\r\n/* Define if you have the getpass function. */\r\n/* #define HAVE_GETPASS 1 */\r\n\r\n/* Define if you have the getservbyname function. */\r\n#define HAVE_GETSERVBYNAME 1\r\n\r\n/* Define if you have the getprotobyname function. */\r\n#define HAVE_GETPROTOBYNAME\r\n\r\n/* Define if you have the gettimeofday function. */\r\n/* #define HAVE_GETTIMEOFDAY 1 */\r\n\r\n/* Define if you have the inet_addr function. */\r\n#define HAVE_INET_ADDR 1\r\n\r\n/* Define if you have the ioctlsocket function. */\r\n#define HAVE_IOCTLSOCKET 1\r\n\r\n/* Define if you have a working ioctlsocket FIONBIO function. */\r\n#define HAVE_IOCTLSOCKET_FIONBIO 1\r\n\r\n/* Define if you have the perror function. */\r\n#define HAVE_PERROR 1\r\n\r\n/* Define if you have the RAND_screen function when using SSL. */\r\n#define HAVE_RAND_SCREEN 1\r\n\r\n/* Define if you have the `RAND_status' function when using SSL. */\r\n#define HAVE_RAND_STATUS 1\r\n\r\n/* Define if you have the `CRYPTO_cleanup_all_ex_data' function.\r\n   This is present in OpenSSL versions after 0.9.6b */\r\n#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1\r\n\r\n/* Define if you have the select function. */\r\n#define HAVE_SELECT 1\r\n\r\n/* Define if you have the setlocale function. */\r\n#define HAVE_SETLOCALE 1\r\n\r\n/* Define if you have the setmode function. */\r\n#define HAVE_SETMODE 1\r\n\r\n/* Define if you have the setvbuf function. */\r\n#define HAVE_SETVBUF 1\r\n\r\n/* Define if you have the socket function. */\r\n#define HAVE_SOCKET 1\r\n\r\n/* Define if you have the strcasecmp function. */\r\n/* #define HAVE_STRCASECMP 1 */\r\n\r\n/* Define if you have the strdup function. */\r\n#define HAVE_STRDUP 1\r\n\r\n/* Define if you have the strftime function. */\r\n#define HAVE_STRFTIME 1\r\n\r\n/* Define if you have the stricmp function. */\r\n#define HAVE_STRICMP 1\r\n\r\n/* Define if you have the strncasecmp function. */\r\n/* #define HAVE_STRNCASECMP 1 */\r\n\r\n/* Define if you have the strnicmp function. */\r\n#define HAVE_STRNICMP 1\r\n\r\n/* Define if you have the strstr function. */\r\n#define HAVE_STRSTR 1\r\n\r\n/* Define if you have the strtoll function. */\r\n#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__POCC__)\r\n#define HAVE_STRTOLL 1\r\n#endif\r\n\r\n/* Define if you have the tcgetattr function. */\r\n/* #define HAVE_TCGETATTR 1 */\r\n\r\n/* Define if you have the tcsetattr function. */\r\n/* #define HAVE_TCSETATTR 1 */\r\n\r\n/* Define if you have the utime function. */\r\n#ifndef __BORLANDC__\r\n#define HAVE_UTIME 1\r\n#endif\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG46 DWORD\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n/* Define if you have the recv function. */\r\n#define HAVE_RECV 1\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#define RECV_TYPE_ARG1 SOCKET\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#define RECV_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#define RECV_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#define RECV_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for recv. */\r\n#define RECV_TYPE_RETV int\r\n\r\n/* Define if you have the recvfrom function. */\r\n#define HAVE_RECVFROM 1\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG1 SOCKET\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG2 char\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG4 int\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG6 int\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#define RECVFROM_TYPE_RETV int\r\n\r\n/* Define if you have the send function. */\r\n#define HAVE_SEND 1\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#define SEND_TYPE_ARG1 SOCKET\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#define SEND_QUAL_ARG2 const\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#define SEND_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#define SEND_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#define SEND_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for send. */\r\n#define SEND_TYPE_RETV int\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       TYPEDEF REPLACEMENTS                       */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if in_addr_t is not an available 'typedefed' type. */\r\n#define in_addr_t unsigned long\r\n\r\n/* Define to the return type of signal handlers (int or void). */\r\n#define RETSIGTYPE void\r\n\r\n/* Define if ssize_t is not an available 'typedefed' type. */\r\n#ifndef _SSIZE_T_DEFINED\r\n#  if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \\\r\n      defined(__POCC__) || \\\r\n      defined(__MINGW32__)\r\n#  elif defined(_WIN64)\r\n#    define _SSIZE_T_DEFINED\r\n#    define ssize_t __int64\r\n#  else\r\n#    define _SSIZE_T_DEFINED\r\n#    define ssize_t int\r\n#  endif\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                            TYPE SIZES                            */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define to the size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT 4\r\n\r\n/* Define to the size of `long double', as computed by sizeof. */\r\n#define SIZEOF_LONG_DOUBLE 16\r\n\r\n/* Define to the size of `long long', as computed by sizeof. */\r\n/* #define SIZEOF_LONG_LONG 8 */\r\n\r\n/* Define to the size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT 2\r\n\r\n/* Define to the size of `size_t', as computed by sizeof. */\r\n#if defined(_WIN64)\r\n#  define SIZEOF_SIZE_T 8\r\n#else\r\n#  define SIZEOF_SIZE_T 4\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                          STRUCT RELATED                          */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if you have struct sockaddr_storage. */\r\n#if !defined(__SALFORDC__) && !defined(__BORLANDC__)\r\n#define HAVE_STRUCT_SOCKADDR_STORAGE 1\r\n#endif\r\n\r\n/* Define if you have struct timeval. */\r\n#define HAVE_STRUCT_TIMEVAL 1\r\n\r\n/* Define if struct sockaddr_in6 has the sin6_scope_id member. */\r\n#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*               BSD-style lwIP TCP/IP stack SPECIFIC               */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define to use BSD-style lwIP TCP/IP stack. */\r\n/* #define USE_LWIPSOCK 1 */\r\n\r\n#ifdef USE_LWIPSOCK\r\n#  undef USE_WINSOCK\r\n#  undef HAVE_WINSOCK_H\r\n#  undef HAVE_WINSOCK2_H\r\n#  undef HAVE_WS2TCPIP_H\r\n#  undef HAVE_ERRNO_H\r\n#  undef HAVE_GETHOSTNAME\r\n#  undef HAVE_GETNAMEINFO\r\n#  undef LWIP_POSIX_SOCKETS_IO_NAMES\r\n#  undef RECV_TYPE_ARG1\r\n#  undef RECV_TYPE_ARG3\r\n#  undef SEND_TYPE_ARG1\r\n#  undef SEND_TYPE_ARG3\r\n#  define HAVE_FREEADDRINFO\r\n#  define HAVE_GETADDRINFO\r\n#  define HAVE_GETHOSTBYNAME\r\n#  define HAVE_GETHOSTBYNAME_R\r\n#  define HAVE_GETHOSTBYNAME_R_6\r\n#  define LWIP_POSIX_SOCKETS_IO_NAMES 0\r\n#  define RECV_TYPE_ARG1 int\r\n#  define RECV_TYPE_ARG3 size_t\r\n#  define SEND_TYPE_ARG1 int\r\n#  define SEND_TYPE_ARG3 size_t\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        Watt-32 tcp/ip SPECIFIC                   */\r\n/* ---------------------------------------------------------------- */\r\n\r\n#ifdef USE_WATT32\r\n  #include <tcp.h>\r\n  #undef byte\r\n  #undef word\r\n  #undef USE_WINSOCK\r\n  #undef HAVE_WINSOCK_H\r\n  #undef HAVE_WINSOCK2_H\r\n  #undef HAVE_WS2TCPIP_H\r\n  #define HAVE_GETADDRINFO\r\n  #define HAVE_GETNAMEINFO\r\n  #define HAVE_SYS_IOCTL_H\r\n  #define HAVE_SYS_SOCKET_H\r\n  #define HAVE_NETINET_IN_H\r\n  #define HAVE_NETDB_H\r\n  #define HAVE_ARPA_INET_H\r\n  #define HAVE_FREEADDRINFO\r\n  #define SOCKET int\r\n#endif\r\n\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        COMPILER SPECIFIC                         */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define to nothing if compiler does not support 'const' qualifier. */\r\n/* #define const */\r\n\r\n/* Define to nothing if compiler does not support 'volatile' qualifier. */\r\n/* #define volatile */\r\n\r\n/* Windows should not have HAVE_GMTIME_R defined */\r\n/* #undef HAVE_GMTIME_R */\r\n\r\n/* Define if the compiler supports C99 variadic macro style. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\r\n#define HAVE_VARIADIC_MACROS_C99 1\r\n#endif\r\n\r\n/* Define if the compiler supports the 'long long' data type. */\r\n#if defined(__MINGW32__) || defined(__WATCOMC__)\r\n#define HAVE_LONGLONG 1\r\n#endif\r\n\r\n/* Define to avoid VS2005 complaining about portable C functions. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\r\n#define _CRT_SECURE_NO_DEPRECATE 1\r\n#define _CRT_NONSTDC_NO_DEPRECATE 1\r\n#endif\r\n\r\n/* VS2005 and later dafault size for time_t is 64-bit, unless\r\n   _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\r\n#  ifndef _USE_32BIT_TIME_T\r\n#    define SIZEOF_TIME_T 8\r\n#  else\r\n#    define SIZEOF_TIME_T 4\r\n#  endif\r\n#endif\r\n\r\n/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows\r\n   2000 as a supported build target. VS2008 default installations provide\r\n   an embedded Windows SDK v6.0A along with the claim that Windows 2000 is\r\n   a valid build target for VS2008. Popular belief is that binaries built\r\n   with VS2008 using Windows SDK versions 6.X and Windows 2000 as a build\r\n   target are functional. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1500)\r\n#  define VS2008_MIN_TARGET 0x0500\r\n#endif\r\n\r\n/* When no build target is specified VS2008 default build target is Windows\r\n   Vista, which leaves out even Winsows XP. If no build target has been given\r\n   for VS2008 we will target the minimum Officially supported build target,\r\n   which happens to be Windows XP. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1500)\r\n#  define VS2008_DEF_TARGET  0x0501\r\n#endif\r\n\r\n/* VS2008 default target settings and minimum build target check. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1500)\r\n#  ifndef _WIN32_WINNT\r\n#    define _WIN32_WINNT VS2008_DEF_TARGET\r\n#  endif\r\n#  ifndef WINVER\r\n#    define WINVER VS2008_DEF_TARGET\r\n#  endif\r\n#  if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET)\r\n#    error VS2008 does not support Windows build targets prior to Windows 2000\r\n#  endif\r\n#endif\r\n\r\n/* When no build target is specified Pelles C 5.00 and later default build\r\n   target is Windows Vista. We override default target to be Windows 2000. */\r\n#if defined(__POCC__) && (__POCC__ >= 500)\r\n#  ifndef _WIN32_WINNT\r\n#    define _WIN32_WINNT 0x0500\r\n#  endif\r\n#  ifndef WINVER\r\n#    define WINVER 0x0500\r\n#  endif\r\n#endif\r\n\r\n/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is\r\n   quite convoluted, compiler dependent and even build target dependent. */\r\n#if defined(HAVE_WS2TCPIP_H)\r\n#  if defined(__POCC__)\r\n#    define HAVE_FREEADDRINFO           1\r\n#    define HAVE_GETADDRINFO            1\r\n#    define HAVE_GETADDRINFO_THREADSAFE 1\r\n#    define HAVE_GETNAMEINFO            1\r\n#  elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)\r\n#    define HAVE_FREEADDRINFO           1\r\n#    define HAVE_GETADDRINFO            1\r\n#    define HAVE_GETADDRINFO_THREADSAFE 1\r\n#    define HAVE_GETNAMEINFO            1\r\n#  elif defined(_MSC_VER) && (_MSC_VER >= 1200)\r\n#    define HAVE_FREEADDRINFO           1\r\n#    define HAVE_GETADDRINFO            1\r\n#    define HAVE_GETADDRINFO_THREADSAFE 1\r\n#    define HAVE_GETNAMEINFO            1\r\n#  endif\r\n#endif\r\n\r\n#if defined(__POCC__)\r\n#  ifndef _MSC_VER\r\n#    error Microsoft extensions /Ze compiler option is required\r\n#  endif\r\n#  ifndef __POCC__OLDNAMES\r\n#    error Compatibility names /Go compiler option is required\r\n#  endif\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        LARGE FILE SUPPORT                        */\r\n/* ---------------------------------------------------------------- */\r\n\r\n#if defined(_MSC_VER) && !defined(_WIN32_WCE)\r\n#  if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)\r\n#    define USE_WIN32_LARGE_FILES\r\n#  else\r\n#    define USE_WIN32_SMALL_FILES\r\n#  endif\r\n#endif\r\n\r\n#if defined(__MINGW32__) && !defined(USE_WIN32_LARGE_FILES)\r\n#  define USE_WIN32_LARGE_FILES\r\n#endif\r\n\r\n#if defined(__WATCOMC__) && !defined(USE_WIN32_LARGE_FILES)\r\n#  define USE_WIN32_LARGE_FILES\r\n#endif\r\n\r\n#if defined(__POCC__)\r\n#  undef USE_WIN32_LARGE_FILES\r\n#endif\r\n\r\n#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES)\r\n#  define USE_WIN32_SMALL_FILES\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       DNS RESOLVER SPECIALTY                     */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/*\r\n * Undefine both USE_ARES and USE_THREADS_WIN32 for synchronous DNS.\r\n */\r\n\r\n/* Define to enable c-ares asynchronous DNS lookups. */\r\n/* #define USE_ARES 1 */\r\n\r\n/* Define to enable threaded asynchronous DNS lookups. */\r\n#define USE_THREADS_WIN32 1\r\n\r\n#if defined(USE_ARES) && defined(USE_THREADS_WIN32)\r\n#  error \"Only one DNS lookup specialty may be defined at most\"\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                           LDAP SUPPORT                           */\r\n/* ---------------------------------------------------------------- */\r\n\r\n#if defined(CURL_HAS_NOVELL_LDAPSDK) || defined(CURL_HAS_MOZILLA_LDAPSDK)\r\n#undef CURL_LDAP_WIN\r\n#define HAVE_LDAP_SSL_H 1\r\n#define HAVE_LDAP_URL_PARSE 1\r\n#elif defined(CURL_HAS_OPENLDAP_LDAPSDK)\r\n#undef CURL_LDAP_WIN\r\n#define HAVE_LDAP_URL_PARSE 1\r\n#else\r\n#undef HAVE_LDAP_URL_PARSE\r\n#define CURL_LDAP_WIN 1\r\n#endif\r\n\r\n#if defined(__WATCOMC__) && defined(CURL_LDAP_WIN)\r\n#if __WATCOMC__ < 1280\r\n#define WINBERAPI  __declspec(cdecl)\r\n#define WINLDAPAPI __declspec(cdecl)\r\n#endif\r\n#endif\r\n\r\n#if defined(__POCC__) && defined(CURL_LDAP_WIN)\r\n#  define CURL_DISABLE_LDAP 1\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       ADDITIONAL DEFINITIONS                     */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define cpu-machine-OS */\r\n#undef OS\r\n#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */\r\n#define OS \"i386-pc-win32\"\r\n#elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (MSVC >=2005 or gcc) */\r\n#define OS \"x86_64-pc-win32\"\r\n#elif defined(_M_IA64) /* Itanium */\r\n#define OS \"ia64-pc-win32\"\r\n#else\r\n#define OS \"unknown-pc-win32\"\r\n#endif\r\n\r\n/* Name of package */\r\n#define PACKAGE \"curl\"\r\n\r\n/* If you want to build curl with the built-in manual */\r\n#define USE_MANUAL 1\r\n\r\n#if defined(__POCC__) || (USE_IPV6)\r\n#  define ENABLE_IPV6 1\r\n#endif\r\n\r\n#endif /* HEADER_CURL_CONFIG_WIN32_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/config-win32ce.h",
    "content": "#ifndef HEADER_CURL_CONFIG_WIN32CE_H\r\n#define HEADER_CURL_CONFIG_WIN32CE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*  lib/config-win32ce.h - Hand crafted config file for windows ce  */\r\n/* ================================================================ */\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                          HEADER FILES                            */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if you have the <arpa/inet.h> header file.  */\r\n/* #define HAVE_ARPA_INET_H 1 */\r\n\r\n/* Define if you have the <assert.h> header file.  */\r\n/* #define HAVE_ASSERT_H 1 */\r\n\r\n/* Define if you have the <crypto.h> header file.  */\r\n/* #define HAVE_CRYPTO_H 1 */\r\n\r\n/* Define if you have the <errno.h> header file.  */\r\n/* #define HAVE_ERRNO_H 1 */\r\n\r\n/* Define if you have the <err.h> header file.  */\r\n/* #define HAVE_ERR_H 1 */\r\n\r\n/* Define if you have the <fcntl.h> header file.  */\r\n#define HAVE_FCNTL_H 1\r\n\r\n/* Define if you have the <getopt.h> header file.  */\r\n/* #define HAVE_GETOPT_H 1 */\r\n\r\n/* Define if you have the <io.h> header file.  */\r\n#define HAVE_IO_H 1\r\n\r\n/* Define if you have the <limits.h> header file.  */\r\n#define HAVE_LIMITS_H 1\r\n\r\n/* Define if you need the malloc.h header header file even with stdlib.h  */\r\n#define NEED_MALLOC_H 1\r\n\r\n/* Define if you have the <netdb.h> header file.  */\r\n/* #define HAVE_NETDB_H 1 */\r\n\r\n/* Define if you have the <netinet/in.h> header file.  */\r\n/* #define HAVE_NETINET_IN_H 1 */\r\n\r\n/* Define if you have the <signal.h> header file. */\r\n#define HAVE_SIGNAL_H 1\r\n\r\n/* Define if you have the <sgtty.h> header file.  */\r\n/* #define HAVE_SGTTY_H 1 */\r\n\r\n/* Define if you have the <ssl.h> header file.  */\r\n/* #define HAVE_SSL_H 1 */\r\n\r\n/* Define if you have the <stdlib.h> header file.  */\r\n#define HAVE_STDLIB_H 1\r\n\r\n/* Define if you have the <process.h> header file.  */\r\n/* #define HAVE_PROCESS_H 1 */\r\n\r\n/* Define if you have the <sys/param.h> header file.  */\r\n/* #define HAVE_SYS_PARAM_H 1 */\r\n\r\n/* Define if you have the <sys/select.h> header file.  */\r\n/* #define HAVE_SYS_SELECT_H 1 */\r\n\r\n/* Define if you have the <sys/socket.h> header file.  */\r\n/* #define HAVE_SYS_SOCKET_H 1 */\r\n\r\n/* Define if you have the <sys/sockio.h> header file.  */\r\n/* #define HAVE_SYS_SOCKIO_H 1 */\r\n\r\n/* Define if you have the <sys/stat.h> header file.  */\r\n#define HAVE_SYS_STAT_H 1\r\n\r\n/* Define if you have the <sys/time.h> header file */\r\n/* #define HAVE_SYS_TIME_H 1 */\r\n\r\n/* Define if you have the <sys/types.h> header file.  */\r\n/* #define HAVE_SYS_TYPES_H 1 */\r\n\r\n/* Define if you have the <sys/utime.h> header file */\r\n#define HAVE_SYS_UTIME_H 1\r\n\r\n/* Define if you have the <termio.h> header file.  */\r\n/* #define HAVE_TERMIO_H 1 */\r\n\r\n/* Define if you have the <termios.h> header file.  */\r\n/* #define HAVE_TERMIOS_H 1 */\r\n\r\n/* Define if you have the <time.h> header file.  */\r\n#define HAVE_TIME_H 1\r\n\r\n/* Define if you have the <unistd.h> header file.  */\r\n#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__)\r\n#define HAVE_UNISTD_H 1\r\n#endif\r\n\r\n/* Define if you have the <windows.h> header file.  */\r\n#define HAVE_WINDOWS_H 1\r\n\r\n/* Define if you have the <winsock.h> header file.  */\r\n#define HAVE_WINSOCK_H 1\r\n\r\n/* Define if you have the <winsock2.h> header file.  */\r\n/* #define HAVE_WINSOCK2_H 1 */\r\n\r\n/* Define if you have the <ws2tcpip.h> header file.  */\r\n/* #define HAVE_WS2TCPIP_H 1 */\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        OTHER HEADER INFO                         */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if sig_atomic_t is an available typedef. */\r\n#define HAVE_SIG_ATOMIC_T 1\r\n\r\n/* Define if you have the ANSI C header files.  */\r\n#define STDC_HEADERS 1\r\n\r\n/* Define if you can safely include both <sys/time.h> and <time.h>.  */\r\n/* #define TIME_WITH_SYS_TIME 1 */\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                             FUNCTIONS                            */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define if you have the closesocket function.  */\r\n#define HAVE_CLOSESOCKET 1\r\n\r\n/* Define if you don't have vprintf but do have _doprnt.  */\r\n/* #define HAVE_DOPRNT 1 */\r\n\r\n/* Define if you have the gethostbyaddr function.  */\r\n#define HAVE_GETHOSTBYADDR 1\r\n\r\n/* Define if you have the gethostname function.  */\r\n#define HAVE_GETHOSTNAME 1\r\n\r\n/* Define if you have the getpass function.  */\r\n/* #define HAVE_GETPASS 1 */\r\n\r\n/* Define if you have the getservbyname function.  */\r\n#define HAVE_GETSERVBYNAME 1\r\n\r\n/* Define if you have the gettimeofday function.  */\r\n/*  #define HAVE_GETTIMEOFDAY 1 */\r\n\r\n/* Define if you have the inet_addr function.  */\r\n#define HAVE_INET_ADDR 1\r\n\r\n/* Define if you have the ioctlsocket function. */\r\n#define HAVE_IOCTLSOCKET 1\r\n\r\n/* Define if you have a working ioctlsocket FIONBIO function. */\r\n#define HAVE_IOCTLSOCKET_FIONBIO 1\r\n\r\n/* Define if you have the perror function.  */\r\n#define HAVE_PERROR 1\r\n\r\n/* Define if you have the RAND_screen function when using SSL  */\r\n#define HAVE_RAND_SCREEN 1\r\n\r\n/* Define if you have the `RAND_status' function when using SSL. */\r\n#define HAVE_RAND_STATUS 1\r\n\r\n/* Define if you have the select function.  */\r\n#define HAVE_SELECT 1\r\n\r\n/* Define if you have the setvbuf function.  */\r\n#define HAVE_SETVBUF 1\r\n\r\n/* Define if you have the socket function.  */\r\n#define HAVE_SOCKET 1\r\n\r\n/* Define if you have the strcasecmp function.  */\r\n/* #define HAVE_STRCASECMP 1 */\r\n\r\n/* Define if you have the strdup function.  */\r\n/* #define HAVE_STRDUP 1 */\r\n\r\n/* Define if you have the strftime function.  */\r\n/* #define HAVE_STRFTIME 1 */\r\n\r\n/* Define if you have the stricmp function. */\r\n/* #define HAVE_STRICMP 1 */\r\n\r\n/* Define if you have the strncasecmp function. */\r\n/* #define HAVE_STRNCASECMP 1 */\r\n\r\n/* Define if you have the strnicmp function. */\r\n/* #define HAVE_STRNICMP 1 */\r\n\r\n/* Define if you have the strstr function.  */\r\n#define HAVE_STRSTR 1\r\n\r\n/* Define if you have the strtoll function.  */\r\n#if defined(__MINGW32__) || defined(__WATCOMC__)\r\n#define HAVE_STRTOLL 1\r\n#endif\r\n\r\n/* Define if you have the tcgetattr function.  */\r\n/* #define HAVE_TCGETATTR 1 */\r\n\r\n/* Define if you have the tcsetattr function.  */\r\n/* #define HAVE_TCSETATTR 1 */\r\n\r\n/* Define if you have the utime function */\r\n#define HAVE_UTIME 1\r\n\r\n/* Define if you have the getnameinfo function. */\r\n#define HAVE_GETNAMEINFO 1\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_QUAL_ARG1 const\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG2 socklen_t\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG46 DWORD\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#define GETNAMEINFO_TYPE_ARG7 int\r\n\r\n/* Define if you have the recv function. */\r\n#define HAVE_RECV 1\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#define RECV_TYPE_ARG1 SOCKET\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#define RECV_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#define RECV_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#define RECV_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for recv. */\r\n#define RECV_TYPE_RETV int\r\n\r\n/* Define if you have the recvfrom function. */\r\n#define HAVE_RECVFROM 1\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG1 SOCKET\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG2 char\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG4 int\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG5 struct sockaddr\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#define RECVFROM_TYPE_ARG6 int\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#define RECVFROM_TYPE_RETV int\r\n\r\n/* Define if you have the send function. */\r\n#define HAVE_SEND 1\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#define SEND_TYPE_ARG1 SOCKET\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#define SEND_QUAL_ARG2 const\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#define SEND_TYPE_ARG2 char *\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#define SEND_TYPE_ARG3 int\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#define SEND_TYPE_ARG4 int\r\n\r\n/* Define to the function return type for send. */\r\n#define SEND_TYPE_RETV int\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       TYPEDEF REPLACEMENTS                       */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define this if in_addr_t is not an available 'typedefed' type */\r\n#define in_addr_t unsigned long\r\n\r\n/* Define as the return type of signal handlers (int or void).  */\r\n#define RETSIGTYPE void\r\n\r\n/* Define ssize_t if it is not an available 'typedefed' type */\r\n#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || defined(__POCC__)\r\n#elif defined(_WIN64)\r\n#define ssize_t __int64\r\n#else\r\n#define ssize_t int\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                            TYPE SIZES                            */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#define SIZEOF_INT 4\r\n\r\n/* The size of `long double', as computed by sizeof. */\r\n#define SIZEOF_LONG_DOUBLE 16\r\n\r\n/* The size of `long long', as computed by sizeof. */\r\n/* #define SIZEOF_LONG_LONG 8 */\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#define SIZEOF_SHORT 2\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#if defined(_WIN64)\r\n#  define SIZEOF_SIZE_T 8\r\n#else\r\n#  define SIZEOF_SIZE_T 4\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                          STRUCT RELATED                          */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define this if you have struct sockaddr_storage */\r\n/* #define HAVE_STRUCT_SOCKADDR_STORAGE 1 */\r\n\r\n/* Define this if you have struct timeval */\r\n#define HAVE_STRUCT_TIMEVAL 1\r\n\r\n/* Define this if struct sockaddr_in6 has the sin6_scope_id member */\r\n#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        COMPILER SPECIFIC                         */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Undef keyword 'const' if it does not work.  */\r\n/* #undef const */\r\n\r\n/* Define to avoid VS2005 complaining about portable C functions */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\r\n#define _CRT_SECURE_NO_DEPRECATE 1\r\n#define _CRT_NONSTDC_NO_DEPRECATE 1\r\n#endif\r\n\r\n/* VS2005 and later dafault size for time_t is 64-bit, unless */\r\n/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */\r\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\r\n#  ifndef _USE_32BIT_TIME_T\r\n#    define SIZEOF_TIME_T 8\r\n#  else\r\n#    define SIZEOF_TIME_T 4\r\n#  endif\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                        LARGE FILE SUPPORT                        */\r\n/* ---------------------------------------------------------------- */\r\n\r\n#if defined(_MSC_VER) && !defined(_WIN32_WCE)\r\n#  if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)\r\n#    define USE_WIN32_LARGE_FILES\r\n#  else\r\n#    define USE_WIN32_SMALL_FILES\r\n#  endif\r\n#endif\r\n\r\n#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES)\r\n#  define USE_WIN32_SMALL_FILES\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                           LDAP SUPPORT                           */\r\n/* ---------------------------------------------------------------- */\r\n\r\n#define CURL_LDAP_WIN 1\r\n#undef HAVE_LDAP_URL_PARSE\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       ADDITIONAL DEFINITIONS                     */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/* Define cpu-machine-OS */\r\n#undef OS\r\n#define OS \"i386-pc-win32ce\"\r\n\r\n/* Name of package */\r\n#define PACKAGE \"curl\"\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*                       WinCE                                      */\r\n/* ---------------------------------------------------------------- */\r\n\r\n#ifndef UNICODE\r\n#  define UNICODE\r\n#endif\r\n\r\n#ifndef _UNICODE\r\n#  define _UNICODE\r\n#endif\r\n\r\n#define CURL_DISABLE_FILE 1\r\n#define CURL_DISABLE_TELNET 1\r\n#define CURL_DISABLE_LDAP 1\r\n\r\n#define ENOSPC 1\r\n#define ENOMEM 2\r\n#define EAGAIN 3\r\n\r\nextern int stat(const char *path,struct stat *buffer );\r\n\r\n#endif /* HEADER_CURL_CONFIG_WIN32CE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/conncache.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, Linus Nielsen Feltzing, <linus@haxx.se>\r\n * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"url.h\"\r\n#include \"progress.h\"\r\n#include \"multiif.h\"\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n#include \"bundles.h\"\r\n#include \"conncache.h\"\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define CONNECTION_HASH_SIZE 97\r\n\r\nstatic void free_bundle_hash_entry(void *freethis)\r\n{\r\n  struct connectbundle *b = (struct connectbundle *) freethis;\r\n\r\n  Curl_bundle_destroy(b);\r\n}\r\n\r\nstruct conncache *Curl_conncache_init(void)\r\n{\r\n  struct conncache *connc;\r\n\r\n  connc = calloc(1, sizeof(struct conncache));\r\n  if(!connc)\r\n    return NULL;\r\n\r\n  connc->hash = Curl_hash_alloc(CONNECTION_HASH_SIZE, Curl_hash_str,\r\n                                Curl_str_key_compare, free_bundle_hash_entry);\r\n\r\n  if(!connc->hash) {\r\n    free(connc);\r\n    return NULL;\r\n  }\r\n\r\n  return connc;\r\n}\r\n\r\nvoid Curl_conncache_destroy(struct conncache *connc)\r\n{\r\n  if(connc) {\r\n    Curl_hash_destroy(connc->hash);\r\n    connc->hash = NULL;\r\n    free(connc);\r\n  }\r\n}\r\n\r\nstruct connectbundle *Curl_conncache_find_bundle(struct conncache *connc,\r\n                                                 char *hostname)\r\n{\r\n  struct connectbundle *bundle = NULL;\r\n\r\n  if(connc)\r\n    bundle = Curl_hash_pick(connc->hash, hostname, strlen(hostname)+1);\r\n\r\n  return bundle;\r\n}\r\n\r\nstatic bool conncache_add_bundle(struct conncache *connc,\r\n                                 char *hostname,\r\n                                 struct connectbundle *bundle)\r\n{\r\n  void *p;\r\n\r\n  p = Curl_hash_add(connc->hash, hostname, strlen(hostname)+1, bundle);\r\n\r\n  return p?TRUE:FALSE;\r\n}\r\n\r\nstatic void conncache_remove_bundle(struct conncache *connc,\r\n                                    struct connectbundle *bundle)\r\n{\r\n  struct curl_hash_iterator iter;\r\n  struct curl_hash_element *he;\r\n\r\n  if(!connc)\r\n    return;\r\n\r\n  Curl_hash_start_iterate(connc->hash, &iter);\r\n\r\n  he = Curl_hash_next_element(&iter);\r\n  while(he) {\r\n    if(he->ptr == bundle) {\r\n      /* The bundle is destroyed by the hash destructor function,\r\n         free_bundle_hash_entry() */\r\n      Curl_hash_delete(connc->hash, he->key, he->key_len);\r\n      return;\r\n    }\r\n\r\n    he = Curl_hash_next_element(&iter);\r\n  }\r\n}\r\n\r\nCURLcode Curl_conncache_add_conn(struct conncache *connc,\r\n                                 struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  struct connectbundle *bundle;\r\n  struct connectbundle *new_bundle = NULL;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  bundle = Curl_conncache_find_bundle(data->state.conn_cache,\r\n                                      conn->host.name);\r\n  if(!bundle) {\r\n    result = Curl_bundle_create(data, &new_bundle);\r\n    if(result != CURLE_OK)\r\n      return result;\r\n\r\n    if(!conncache_add_bundle(data->state.conn_cache,\r\n                             conn->host.name, new_bundle)) {\r\n      Curl_bundle_destroy(new_bundle);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    bundle = new_bundle;\r\n  }\r\n\r\n  result = Curl_bundle_add_conn(bundle, conn);\r\n  if(result != CURLE_OK) {\r\n    if(new_bundle)\r\n      conncache_remove_bundle(data->state.conn_cache, new_bundle);\r\n    return result;\r\n  }\r\n\r\n  connc->num_connections++;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid Curl_conncache_remove_conn(struct conncache *connc,\r\n                                struct connectdata *conn)\r\n{\r\n  struct connectbundle *bundle = conn->bundle;\r\n\r\n  /* The bundle pointer can be NULL, since this function can be called\r\n     due to a failed connection attempt, before being added to a bundle */\r\n  if(bundle) {\r\n    Curl_bundle_remove_conn(bundle, conn);\r\n    if(bundle->num_connections == 0) {\r\n      conncache_remove_bundle(connc, bundle);\r\n    }\r\n    connc->num_connections--;\r\n\r\n    DEBUGF(infof(conn->data, \"The cache now contains %d members\\n\",\r\n                 connc->num_connections));\r\n  }\r\n}\r\n\r\n/* This function iterates the entire connection cache and calls the\r\n   function func() with the connection pointer as the first argument\r\n   and the supplied 'param' argument as the other,\r\n\r\n   Return 0 from func() to continue the loop, return 1 to abort it.\r\n */\r\nvoid Curl_conncache_foreach(struct conncache *connc,\r\n                            void *param,\r\n                            int (*func)(struct connectdata *conn, void *param))\r\n{\r\n  struct curl_hash_iterator iter;\r\n  struct curl_llist_element *curr;\r\n  struct curl_hash_element *he;\r\n\r\n  if(!connc)\r\n    return;\r\n\r\n  Curl_hash_start_iterate(connc->hash, &iter);\r\n\r\n  he = Curl_hash_next_element(&iter);\r\n  while(he) {\r\n    struct connectbundle *bundle;\r\n    struct connectdata *conn;\r\n\r\n    bundle = he->ptr;\r\n\r\n    curr = bundle->conn_list->head;\r\n    while(curr) {\r\n      /* Yes, we need to update curr before calling func(), because func()\r\n         might decide to remove the connection */\r\n      conn = curr->ptr;\r\n      curr = curr->next;\r\n\r\n      if(1 == func(conn, param))\r\n        return;\r\n    }\r\n\r\n    he = Curl_hash_next_element(&iter);\r\n  }\r\n}\r\n\r\n/* Return the first connection found in the cache. Used when closing all\r\n   connections */\r\nstruct connectdata *\r\nCurl_conncache_find_first_connection(struct conncache *connc)\r\n{\r\n  struct curl_hash_iterator iter;\r\n  struct curl_llist_element *curr;\r\n  struct curl_hash_element *he;\r\n  struct connectbundle *bundle;\r\n\r\n  Curl_hash_start_iterate(connc->hash, &iter);\r\n\r\n  he = Curl_hash_next_element(&iter);\r\n  while(he) {\r\n    bundle = he->ptr;\r\n\r\n    curr = bundle->conn_list->head;\r\n    if(curr) {\r\n      return curr->ptr;\r\n    }\r\n\r\n    he = Curl_hash_next_element(&iter);\r\n  }\r\n\r\n  return NULL;\r\n}\r\n\r\n\r\n#if 0\r\n/* Useful for debugging the connection cache */\r\nvoid Curl_conncache_print(struct conncache *connc)\r\n{\r\n  struct curl_hash_iterator iter;\r\n  struct curl_llist_element *curr;\r\n  struct curl_hash_element *he;\r\n\r\n  if(!connc)\r\n    return;\r\n\r\n  fprintf(stderr, \"=Bundle cache=\\n\");\r\n\r\n  Curl_hash_start_iterate(connc->hash, &iter);\r\n\r\n  he = Curl_hash_next_element(&iter);\r\n  while(he) {\r\n    struct connectbundle *bundle;\r\n    struct connectdata *conn;\r\n\r\n    bundle = he->ptr;\r\n\r\n    fprintf(stderr, \"%s -\", he->key);\r\n    curr = bundle->conn_list->head;\r\n    while(curr) {\r\n      conn = curr->ptr;\r\n\r\n      fprintf(stderr, \" [%p %d]\", (void *)conn, conn->inuse);\r\n      curr = curr->next;\r\n    }\r\n    fprintf(stderr, \"\\n\");\r\n\r\n    he = Curl_hash_next_element(&iter);\r\n  }\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/conncache.h",
    "content": "#ifndef HEADER_CURL_CONNCACHE_H\r\n#define HEADER_CURL_CONNCACHE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, 2013, Linus Nielsen Feltzing, <linus@haxx.se>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nstruct conncache {\r\n  struct curl_hash *hash;\r\n  size_t num_connections;\r\n};\r\n\r\nstruct conncache *Curl_conncache_init(void);\r\n\r\nvoid Curl_conncache_destroy(struct conncache *connc);\r\n\r\nstruct connectbundle *Curl_conncache_find_bundle(struct conncache *connc,\r\n                                                 char *hostname);\r\n\r\nCURLcode Curl_conncache_add_conn(struct conncache *connc,\r\n                                 struct connectdata *conn);\r\n\r\nvoid Curl_conncache_remove_conn(struct conncache *connc,\r\n                                struct connectdata *conn);\r\n\r\nvoid Curl_conncache_foreach(struct conncache *connc,\r\n                            void *param,\r\n                            int (*func)(struct connectdata *conn,\r\n                                        void *param));\r\n\r\nstruct connectdata *\r\nCurl_conncache_find_first_connection(struct conncache *connc);\r\n\r\nvoid Curl_conncache_print(struct conncache *connc);\r\n\r\n#endif /* HEADER_CURL_CONNCACHE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/connect.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n// Disable Warnings\r\n// C4127 : conditional expression is constant\r\n#pragma warning( disable : 4127 )\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h> /* <netinet/tcp.h> may need it */\r\n#endif\r\n#ifdef HAVE_SYS_UN_H\r\n#include <sys/un.h> /* for sockaddr_un */\r\n#endif\r\n#ifdef HAVE_NETINET_TCP_H\r\n#include <netinet/tcp.h> /* for TCP_NODELAY */\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_FCNTL_H\r\n#include <fcntl.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n\r\n#if (defined(HAVE_IOCTL_FIONBIO) && defined(NETWARE))\r\n#include <sys/filio.h>\r\n#endif\r\n#ifdef NETWARE\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"if2ip.h\"\r\n#include \"strerror.h\"\r\n#include \"connect.h\"\r\n#include \"curl_memory.h\"\r\n#include \"select.h\"\r\n#include \"url.h\" /* for Curl_safefree() */\r\n#include \"multiif.h\"\r\n#include \"sockaddr.h\" /* required for Curl_sockaddr_storage */\r\n#include \"inet_ntop.h\"\r\n#include \"inet_pton.h\"\r\n#include \"sslgen.h\" /* for Curl_ssl_check_cxn() */\r\n#include \"progress.h\"\r\n#include \"warnless.h\"\r\n#include \"conncache.h\"\r\n#include \"multihandle.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef __SYMBIAN32__\r\n/* This isn't actually supported under Symbian OS */\r\n#undef SO_NOSIGPIPE\r\n#endif\r\n\r\nstatic bool verifyconnect(curl_socket_t sockfd, int *error);\r\n\r\n#ifdef __DragonFly__\r\n/* DragonFlyBSD uses millisecond as KEEPIDLE and KEEPINTVL units */\r\n#define KEEPALIVE_FACTOR(x) (x *= 1000)\r\n#else\r\n#define KEEPALIVE_FACTOR(x)\r\n#endif\r\n\r\nstatic void\r\ntcpkeepalive(struct SessionHandle *data,\r\n             curl_socket_t sockfd)\r\n{\r\n  int optval = data->set.tcp_keepalive?1:0;\r\n\r\n  /* only set IDLE and INTVL if setting KEEPALIVE is successful */\r\n  if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,\r\n        (void *)&optval, sizeof(optval)) < 0) {\r\n    infof(data, \"Failed to set SO_KEEPALIVE on fd %d\\n\", sockfd);\r\n  }\r\n  else {\r\n#ifdef TCP_KEEPIDLE\r\n    optval = curlx_sltosi(data->set.tcp_keepidle);\r\n    KEEPALIVE_FACTOR(optval);\r\n    if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,\r\n          (void *)&optval, sizeof(optval)) < 0) {\r\n      infof(data, \"Failed to set TCP_KEEPIDLE on fd %d\\n\", sockfd);\r\n    }\r\n#endif\r\n#ifdef TCP_KEEPINTVL\r\n    optval = curlx_sltosi(data->set.tcp_keepintvl);\r\n    KEEPALIVE_FACTOR(optval);\r\n    if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,\r\n          (void *)&optval, sizeof(optval)) < 0) {\r\n      infof(data, \"Failed to set TCP_KEEPINTVL on fd %d\\n\", sockfd);\r\n    }\r\n#endif\r\n  }\r\n}\r\n\r\nstatic CURLcode\r\nsingleipconnect(struct connectdata *conn,\r\n                const Curl_addrinfo *ai, /* start connecting to this */\r\n                curl_socket_t *sock,\r\n                bool *connected);\r\n\r\n/*\r\n * Curl_timeleft() returns the amount of milliseconds left allowed for the\r\n * transfer/connection. If the value is negative, the timeout time has already\r\n * elapsed.\r\n *\r\n * The start time is stored in progress.t_startsingle - as set with\r\n * Curl_pgrsTime(..., TIMER_STARTSINGLE);\r\n *\r\n * If 'nowp' is non-NULL, it points to the current time.\r\n * 'duringconnect' is FALSE if not during a connect, as then of course the\r\n * connect timeout is not taken into account!\r\n *\r\n * @unittest: 1303\r\n */\r\nlong Curl_timeleft(struct SessionHandle *data,\r\n                   struct timeval *nowp,\r\n                   bool duringconnect)\r\n{\r\n  int timeout_set = 0;\r\n  long timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;\r\n  struct timeval now;\r\n\r\n  /* if a timeout is set, use the most restrictive one */\r\n\r\n  if(data->set.timeout > 0)\r\n    timeout_set |= 1;\r\n  if(duringconnect && (data->set.connecttimeout > 0))\r\n    timeout_set |= 2;\r\n\r\n  switch (timeout_set) {\r\n  case 1:\r\n    timeout_ms = data->set.timeout;\r\n    break;\r\n  case 2:\r\n    timeout_ms = data->set.connecttimeout;\r\n    break;\r\n  case 3:\r\n    if(data->set.timeout < data->set.connecttimeout)\r\n      timeout_ms = data->set.timeout;\r\n    else\r\n      timeout_ms = data->set.connecttimeout;\r\n    break;\r\n  default:\r\n    /* use the default */\r\n    if(!duringconnect)\r\n      /* if we're not during connect, there's no default timeout so if we're\r\n         at zero we better just return zero and not make it a negative number\r\n         by the math below */\r\n      return 0;\r\n    break;\r\n  }\r\n\r\n  if(!nowp) {\r\n    now = Curl_tvnow();\r\n    nowp = &now;\r\n  }\r\n\r\n  /* subtract elapsed time */\r\n  timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle);\r\n  if(!timeout_ms)\r\n    /* avoid returning 0 as that means no timeout! */\r\n    return -1;\r\n\r\n  return timeout_ms;\r\n}\r\n\r\n/*\r\n * checkconnect() checks for a TCP connect on the given socket.\r\n * It returns:\r\n */\r\n\r\nenum chkconn_t {\r\n  CHKCONN_SELECT_ERROR = -1,\r\n  CHKCONN_CONNECTED    = 0,\r\n  CHKCONN_IDLE         = 1,\r\n  CHKCONN_FDSET_ERROR  = 2\r\n};\r\n\r\nstatic enum chkconn_t\r\ncheckconnect(curl_socket_t sockfd)\r\n{\r\n  int rc;\r\n#ifdef mpeix\r\n  /* Call this function once now, and ignore the results. We do this to\r\n     \"clear\" the error state on the socket so that we can later read it\r\n     reliably. This is reported necessary on the MPE/iX operating system. */\r\n  (void)verifyconnect(sockfd, NULL);\r\n#endif\r\n\r\n  rc = Curl_socket_ready(CURL_SOCKET_BAD, sockfd, 0);\r\n\r\n  if(-1 == rc)\r\n    /* error, no connect here, try next */\r\n    return CHKCONN_SELECT_ERROR;\r\n\r\n  else if(rc & CURL_CSELECT_ERR)\r\n    /* error condition caught */\r\n    return CHKCONN_FDSET_ERROR;\r\n\r\n  else if(rc)\r\n    return CHKCONN_CONNECTED;\r\n\r\n  return CHKCONN_IDLE;\r\n}\r\n\r\nstatic CURLcode bindlocal(struct connectdata *conn,\r\n                          curl_socket_t sockfd, int af)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  struct Curl_sockaddr_storage sa;\r\n  struct sockaddr *sock = (struct sockaddr *)&sa;  /* bind to this address */\r\n  curl_socklen_t sizeof_sa = 0; /* size of the data sock points to */\r\n  struct sockaddr_in *si4 = (struct sockaddr_in *)&sa;\r\n#ifdef ENABLE_IPV6\r\n  struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&sa;\r\n#endif\r\n\r\n  struct Curl_dns_entry *h=NULL;\r\n  unsigned short port = data->set.localport; /* use this port number, 0 for\r\n                                                \"random\" */\r\n  /* how many port numbers to try to bind to, increasing one at a time */\r\n  int portnum = data->set.localportrange;\r\n  const char *dev = data->set.str[STRING_DEVICE];\r\n  int error;\r\n  char myhost[256] = \"\";\r\n  int done = 0; /* -1 for error, 1 for address found */\r\n  bool is_interface = FALSE;\r\n  bool is_host = FALSE;\r\n  static const char *if_prefix = \"if!\";\r\n  static const char *host_prefix = \"host!\";\r\n\r\n  /*************************************************************\r\n   * Select device to bind socket to\r\n   *************************************************************/\r\n  if(!dev && !port)\r\n    /* no local kind of binding was requested */\r\n    return CURLE_OK;\r\n\r\n  memset(&sa, 0, sizeof(struct Curl_sockaddr_storage));\r\n\r\n  if(dev && (strlen(dev)<255) ) {\r\n    if(strncmp(if_prefix, dev, strlen(if_prefix)) == 0) {\r\n      dev += strlen(if_prefix);\r\n      is_interface = TRUE;\r\n    }\r\n    else if(strncmp(host_prefix, dev, strlen(host_prefix)) == 0) {\r\n      dev += strlen(host_prefix);\r\n      is_host = TRUE;\r\n    }\r\n\r\n    /* interface */\r\n    if(!is_host && (is_interface || Curl_if_is_interface_name(dev))) {\r\n      if(Curl_if2ip(af, dev, myhost, sizeof(myhost)) == NULL)\r\n        return CURLE_INTERFACE_FAILED;\r\n\r\n      /*\r\n       * We now have the numerical IP address in the 'myhost' buffer\r\n       */\r\n      infof(data, \"Local Interface %s is ip %s using address family %i\\n\",\r\n            dev, myhost, af);\r\n      done = 1;\r\n\r\n#ifdef SO_BINDTODEVICE\r\n      /* I am not sure any other OSs than Linux that provide this feature, and\r\n       * at the least I cannot test. --Ben\r\n       *\r\n       * This feature allows one to tightly bind the local socket to a\r\n       * particular interface.  This will force even requests to other local\r\n       * interfaces to go out the external interface.\r\n       *\r\n       *\r\n       * Only bind to the interface when specified as interface, not just as a\r\n       * hostname or ip address.\r\n       */\r\n      if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,\r\n                    dev, (curl_socklen_t)strlen(dev)+1) != 0) {\r\n        error = SOCKERRNO;\r\n        infof(data, \"SO_BINDTODEVICE %s failed with errno %d: %s;\"\r\n              \" will do regular bind\\n\",\r\n              dev, error, Curl_strerror(conn, error));\r\n        /* This is typically \"errno 1, error: Operation not permitted\" if\r\n           you're not running as root or another suitable privileged user */\r\n      }\r\n#endif\r\n    }\r\n    else {\r\n      /*\r\n       * This was not an interface, resolve the name as a host name\r\n       * or IP number\r\n       *\r\n       * Temporarily force name resolution to use only the address type\r\n       * of the connection. The resolve functions should really be changed\r\n       * to take a type parameter instead.\r\n       */\r\n      long ipver = conn->ip_version;\r\n      int rc;\r\n\r\n      if(af == AF_INET)\r\n        conn->ip_version = CURL_IPRESOLVE_V4;\r\n#ifdef ENABLE_IPV6\r\n      else if(af == AF_INET6)\r\n        conn->ip_version = CURL_IPRESOLVE_V6;\r\n#endif\r\n\r\n      rc = Curl_resolv(conn, dev, 0, &h);\r\n      if(rc == CURLRESOLV_PENDING)\r\n        (void)Curl_resolver_wait_resolv(conn, &h);\r\n      conn->ip_version = ipver;\r\n\r\n      if(h) {\r\n        /* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */\r\n        Curl_printable_address(h->addr, myhost, sizeof(myhost));\r\n        infof(data, \"Name '%s' family %i resolved to '%s' family %i\\n\",\r\n              dev, af, myhost, h->addr->ai_family);\r\n        Curl_resolv_unlock(data, h);\r\n        done = 1;\r\n      }\r\n      else {\r\n        /*\r\n         * provided dev was no interface (or interfaces are not supported\r\n         * e.g. solaris) no ip address and no domain we fail here\r\n         */\r\n        done = -1;\r\n      }\r\n    }\r\n\r\n    if(done > 0) {\r\n#ifdef ENABLE_IPV6\r\n      /* ipv6 address */\r\n      if((af == AF_INET6) &&\r\n         (Curl_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0)) {\r\n        si6->sin6_family = AF_INET6;\r\n        si6->sin6_port = htons(port);\r\n        sizeof_sa = sizeof(struct sockaddr_in6);\r\n      }\r\n      else\r\n#endif\r\n      /* ipv4 address */\r\n      if((af == AF_INET) &&\r\n         (Curl_inet_pton(AF_INET, myhost, &si4->sin_addr) > 0)) {\r\n        si4->sin_family = AF_INET;\r\n        si4->sin_port = htons(port);\r\n        sizeof_sa = sizeof(struct sockaddr_in);\r\n      }\r\n    }\r\n\r\n    if(done < 1) {\r\n      failf(data, \"Couldn't bind to '%s'\", dev);\r\n      return CURLE_INTERFACE_FAILED;\r\n    }\r\n  }\r\n  else {\r\n    /* no device was given, prepare sa to match af's needs */\r\n#ifdef ENABLE_IPV6\r\n    if(af == AF_INET6) {\r\n      si6->sin6_family = AF_INET6;\r\n      si6->sin6_port = htons(port);\r\n      sizeof_sa = sizeof(struct sockaddr_in6);\r\n    }\r\n    else\r\n#endif\r\n    if(af == AF_INET) {\r\n      si4->sin_family = AF_INET;\r\n      si4->sin_port = htons(port);\r\n      sizeof_sa = sizeof(struct sockaddr_in);\r\n    }\r\n  }\r\n\r\n  for(;;) {\r\n    if(bind(sockfd, sock, sizeof_sa) >= 0) {\r\n      /* we succeeded to bind */\r\n      struct Curl_sockaddr_storage add;\r\n      curl_socklen_t size = sizeof(add);\r\n      memset(&add, 0, sizeof(struct Curl_sockaddr_storage));\r\n      if(getsockname(sockfd, (struct sockaddr *) &add, &size) < 0) {\r\n        data->state.os_errno = error = SOCKERRNO;\r\n        failf(data, \"getsockname() failed with errno %d: %s\",\r\n              error, Curl_strerror(conn, error));\r\n        return CURLE_INTERFACE_FAILED;\r\n      }\r\n      infof(data, \"Local port: %hu\\n\", port);\r\n      conn->bits.bound = TRUE;\r\n      return CURLE_OK;\r\n    }\r\n\r\n    if(--portnum > 0) {\r\n      infof(data, \"Bind to local port %hu failed, trying next\\n\", port);\r\n      port++; /* try next port */\r\n      /* We re-use/clobber the port variable here below */\r\n      if(sock->sa_family == AF_INET)\r\n        si4->sin_port = ntohs(port);\r\n#ifdef ENABLE_IPV6\r\n      else\r\n        si6->sin6_port = ntohs(port);\r\n#endif\r\n    }\r\n    else\r\n      break;\r\n  }\r\n\r\n  data->state.os_errno = error = SOCKERRNO;\r\n  failf(data, \"bind failed with errno %d: %s\",\r\n        error, Curl_strerror(conn, error));\r\n\r\n  return CURLE_INTERFACE_FAILED;\r\n}\r\n\r\n/*\r\n * verifyconnect() returns TRUE if the connect really has happened.\r\n */\r\nstatic bool verifyconnect(curl_socket_t sockfd, int *error)\r\n{\r\n  bool rc = TRUE;\r\n#ifdef SO_ERROR\r\n  int err = 0;\r\n  curl_socklen_t errSize = sizeof(err);\r\n\r\n#ifdef WIN32\r\n  /*\r\n   * In October 2003 we effectively nullified this function on Windows due to\r\n   * problems with it using all CPU in multi-threaded cases.\r\n   *\r\n   * In May 2004, we bring it back to offer more info back on connect failures.\r\n   * Gisle Vanem could reproduce the former problems with this function, but\r\n   * could avoid them by adding this SleepEx() call below:\r\n   *\r\n   *    \"I don't have Rational Quantify, but the hint from his post was\r\n   *    ntdll::NtRemoveIoCompletion(). So I'd assume the SleepEx (or maybe\r\n   *    just Sleep(0) would be enough?) would release whatever\r\n   *    mutex/critical-section the ntdll call is waiting on.\r\n   *\r\n   *    Someone got to verify this on Win-NT 4.0, 2000.\"\r\n   */\r\n\r\n#ifdef _WIN32_WCE\r\n  Sleep(0);\r\n#else\r\n  SleepEx(0, FALSE);\r\n#endif\r\n\r\n#endif\r\n\r\n  if(0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))\r\n    err = SOCKERRNO;\r\n#ifdef _WIN32_WCE\r\n  /* Old WinCE versions don't support SO_ERROR */\r\n  if(WSAENOPROTOOPT == err) {\r\n    SET_SOCKERRNO(0);\r\n    err = 0;\r\n  }\r\n#endif\r\n#ifdef __minix\r\n  /* Minix 3.1.x doesn't support getsockopt on UDP sockets */\r\n  if(EBADIOCTL == err) {\r\n    SET_SOCKERRNO(0);\r\n    err = 0;\r\n  }\r\n#endif\r\n  if((0 == err) || (EISCONN == err))\r\n    /* we are connected, awesome! */\r\n    rc = TRUE;\r\n  else\r\n    /* This wasn't a successful connect */\r\n    rc = FALSE;\r\n  if(error)\r\n    *error = err;\r\n#else\r\n  (void)sockfd;\r\n  if(error)\r\n    *error = SOCKERRNO;\r\n#endif\r\n  return rc;\r\n}\r\n\r\n/* Used within the multi interface. Try next IP address, return TRUE if no\r\n   more address exists or error */\r\nstatic CURLcode trynextip(struct connectdata *conn,\r\n                          int sockindex,\r\n                          bool *connected)\r\n{\r\n  curl_socket_t sockfd;\r\n  Curl_addrinfo *ai;\r\n\r\n  /* First clean up after the failed socket.\r\n     Don't close it yet to ensure that the next IP's socket gets a different\r\n     file descriptor, which can prevent bugs when the curl_multi_socket_action\r\n     interface is used with certain select() replacements such as kqueue. */\r\n  curl_socket_t fd_to_close = conn->sock[sockindex];\r\n  conn->sock[sockindex] = CURL_SOCKET_BAD;\r\n  *connected = FALSE;\r\n\r\n  if(sockindex != FIRSTSOCKET) {\r\n    Curl_closesocket(conn, fd_to_close);\r\n    return CURLE_COULDNT_CONNECT; /* no next */\r\n  }\r\n\r\n  /* try the next address */\r\n  ai = conn->ip_addr->ai_next;\r\n\r\n  while(ai) {\r\n    CURLcode res = singleipconnect(conn, ai, &sockfd, connected);\r\n    if(res)\r\n      return res;\r\n    if(sockfd != CURL_SOCKET_BAD) {\r\n      /* store the new socket descriptor */\r\n      conn->sock[sockindex] = sockfd;\r\n      conn->ip_addr = ai;\r\n      Curl_closesocket(conn, fd_to_close);\r\n      return CURLE_OK;\r\n    }\r\n    ai = ai->ai_next;\r\n  }\r\n  Curl_closesocket(conn, fd_to_close);\r\n  return CURLE_COULDNT_CONNECT;\r\n}\r\n\r\n/* Copies connection info into the session handle to make it available\r\n   when the session handle is no longer associated with a connection. */\r\nvoid Curl_persistconninfo(struct connectdata *conn)\r\n{\r\n  memcpy(conn->data->info.conn_primary_ip, conn->primary_ip, MAX_IPADR_LEN);\r\n  memcpy(conn->data->info.conn_local_ip, conn->local_ip, MAX_IPADR_LEN);\r\n  conn->data->info.conn_primary_port = conn->primary_port;\r\n  conn->data->info.conn_local_port = conn->local_port;\r\n}\r\n\r\n/* retrieves ip address and port from a sockaddr structure */\r\nstatic bool getaddressinfo(struct sockaddr* sa, char* addr,\r\n                           long* port)\r\n{\r\n  unsigned short us_port;\r\n  struct sockaddr_in* si = NULL;\r\n#ifdef ENABLE_IPV6\r\n  struct sockaddr_in6* si6 = NULL;\r\n#endif\r\n#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)\r\n  struct sockaddr_un* su = NULL;\r\n#endif\r\n\r\n  switch (sa->sa_family) {\r\n    case AF_INET:\r\n      si = (struct sockaddr_in*) sa;\r\n      if(Curl_inet_ntop(sa->sa_family, &si->sin_addr,\r\n                        addr, MAX_IPADR_LEN)) {\r\n        us_port = ntohs(si->sin_port);\r\n        *port = us_port;\r\n        return TRUE;\r\n      }\r\n      break;\r\n#ifdef ENABLE_IPV6\r\n    case AF_INET6:\r\n      si6 = (struct sockaddr_in6*)sa;\r\n      if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr,\r\n                        addr, MAX_IPADR_LEN)) {\r\n        us_port = ntohs(si6->sin6_port);\r\n        *port = us_port;\r\n        return TRUE;\r\n      }\r\n      break;\r\n#endif\r\n#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)\r\n    case AF_UNIX:\r\n      su = (struct sockaddr_un*)sa;\r\n      snprintf(addr, MAX_IPADR_LEN, \"%s\", su->sun_path);\r\n      *port = 0;\r\n      return TRUE;\r\n#endif\r\n    default:\r\n      break;\r\n  }\r\n\r\n  addr[0] = '\\0';\r\n  *port = 0;\r\n\r\n  return FALSE;\r\n}\r\n\r\n/* retrieves the start/end point information of a socket of an established\r\n   connection */\r\nvoid Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd)\r\n{\r\n  int error;\r\n  curl_socklen_t len;\r\n  struct Curl_sockaddr_storage ssrem;\r\n  struct Curl_sockaddr_storage ssloc;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(!conn->bits.reuse) {\r\n\r\n    len = sizeof(struct Curl_sockaddr_storage);\r\n    if(getpeername(sockfd, (struct sockaddr*) &ssrem, &len)) {\r\n      error = SOCKERRNO;\r\n      failf(data, \"getpeername() failed with errno %d: %s\",\r\n            error, Curl_strerror(conn, error));\r\n      return;\r\n    }\r\n\r\n    len = sizeof(struct Curl_sockaddr_storage);\r\n    if(getsockname(sockfd, (struct sockaddr*) &ssloc, &len)) {\r\n      error = SOCKERRNO;\r\n      failf(data, \"getsockname() failed with errno %d: %s\",\r\n            error, Curl_strerror(conn, error));\r\n      return;\r\n    }\r\n\r\n    if(!getaddressinfo((struct sockaddr*)&ssrem,\r\n                        conn->primary_ip, &conn->primary_port)) {\r\n      error = ERRNO;\r\n      failf(data, \"ssrem inet_ntop() failed with errno %d: %s\",\r\n            error, Curl_strerror(conn, error));\r\n      return;\r\n    }\r\n\r\n    if(!getaddressinfo((struct sockaddr*)&ssloc,\r\n                       conn->local_ip, &conn->local_port)) {\r\n      error = ERRNO;\r\n      failf(data, \"ssloc inet_ntop() failed with errno %d: %s\",\r\n            error, Curl_strerror(conn, error));\r\n      return;\r\n    }\r\n\r\n  }\r\n\r\n  /* persist connection info in session handle */\r\n  Curl_persistconninfo(conn);\r\n}\r\n\r\n/*\r\n * Curl_is_connected() checks if the socket has connected.\r\n */\r\n\r\nCURLcode Curl_is_connected(struct connectdata *conn,\r\n                           int sockindex,\r\n                           bool *connected)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode code = CURLE_OK;\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long allow = DEFAULT_CONNECT_TIMEOUT;\r\n  int error = 0;\r\n  struct timeval now;\r\n  enum chkconn_t chk;\r\n\r\n  DEBUGASSERT(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET);\r\n\r\n  *connected = FALSE; /* a very negative world view is best */\r\n\r\n  if(conn->bits.tcpconnect[sockindex]) {\r\n    /* we are connected already! */\r\n    *connected = TRUE;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  now = Curl_tvnow();\r\n\r\n  /* figure out how long time we have left to connect */\r\n  allow = Curl_timeleft(data, &now, TRUE);\r\n\r\n  if(allow < 0) {\r\n    /* time-out, bail out, go home */\r\n    failf(data, \"Connection time-out\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  /* check socket for connect */\r\n  chk = checkconnect(sockfd);\r\n  if(CHKCONN_IDLE == chk) {\r\n    if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {\r\n      infof(data, \"After %ldms connect time, move on!\\n\",\r\n            conn->timeoutms_per_addr);\r\n      goto next;\r\n    }\r\n\r\n    /* not an error, but also no connection yet */\r\n    return code;\r\n  }\r\n\r\n  if(CHKCONN_CONNECTED == chk) {\r\n    if(verifyconnect(sockfd, &error)) {\r\n      /* we are connected with TCP, awesome! */\r\n\r\n      /* see if we need to do any proxy magic first once we connected */\r\n      code = Curl_connected_proxy(conn);\r\n      if(code)\r\n        return code;\r\n\r\n      conn->bits.tcpconnect[sockindex] = TRUE;\r\n\r\n      *connected = TRUE;\r\n      if(sockindex == FIRSTSOCKET)\r\n        Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */\r\n      Curl_verboseconnect(conn);\r\n      Curl_updateconninfo(conn, sockfd);\r\n\r\n      return CURLE_OK;\r\n    }\r\n    /* nope, not connected for real */\r\n  }\r\n  else {\r\n    /* nope, not connected  */\r\n    if(CHKCONN_FDSET_ERROR == chk) {\r\n      (void)verifyconnect(sockfd, &error);\r\n      infof(data, \"%s\\n\",Curl_strerror(conn, error));\r\n    }\r\n    else\r\n      infof(data, \"Connection failed\\n\");\r\n  }\r\n\r\n  /*\r\n   * The connection failed here, we should attempt to connect to the \"next\r\n   * address\" for the given host. But first remember the latest error.\r\n   */\r\n  if(error) {\r\n    data->state.os_errno = error;\r\n    SET_SOCKERRNO(error);\r\n  }\r\n  next:\r\n\r\n  conn->timeoutms_per_addr = conn->ip_addr->ai_next == NULL ?\r\n                             allow : allow / 2;\r\n  code = trynextip(conn, sockindex, connected);\r\n\r\n  if(code) {\r\n    error = SOCKERRNO;\r\n    data->state.os_errno = error;\r\n    failf(data, \"Failed connect to %s:%ld; %s\",\r\n          conn->host.name, conn->port, Curl_strerror(conn, error));\r\n  }\r\n\r\n  return code;\r\n}\r\n\r\nstatic void tcpnodelay(struct connectdata *conn,\r\n                       curl_socket_t sockfd)\r\n{\r\n#ifdef TCP_NODELAY\r\n  struct SessionHandle *data= conn->data;\r\n  curl_socklen_t onoff = (curl_socklen_t) data->set.tcp_nodelay;\r\n  int level = IPPROTO_TCP;\r\n\r\n#if 0\r\n  /* The use of getprotobyname() is disabled since it isn't thread-safe on\r\n     numerous systems. On these getprotobyname_r() should be used instead, but\r\n     that exists in at least one 4 arg version and one 5 arg version, and\r\n     since the proto number rarely changes anyway we now just use the hard\r\n     coded number. The \"proper\" fix would need a configure check for the\r\n     correct function much in the same style the gethostbyname_r versions are\r\n     detected. */\r\n  struct protoent *pe = getprotobyname(\"tcp\");\r\n  if(pe)\r\n    level = pe->p_proto;\r\n#endif\r\n\r\n  if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff,\r\n                sizeof(onoff)) < 0)\r\n    infof(data, \"Could not set TCP_NODELAY: %s\\n\",\r\n          Curl_strerror(conn, SOCKERRNO));\r\n  else\r\n    infof(data,\"TCP_NODELAY set\\n\");\r\n#else\r\n  (void)conn;\r\n  (void)sockfd;\r\n#endif\r\n}\r\n\r\n#ifdef SO_NOSIGPIPE\r\n/* The preferred method on Mac OS X (10.2 and later) to prevent SIGPIPEs when\r\n   sending data to a dead peer (instead of relying on the 4th argument to send\r\n   being MSG_NOSIGNAL). Possibly also existing and in use on other BSD\r\n   systems? */\r\nstatic void nosigpipe(struct connectdata *conn,\r\n                      curl_socket_t sockfd)\r\n{\r\n  struct SessionHandle *data= conn->data;\r\n  int onoff = 1;\r\n  if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff,\r\n                sizeof(onoff)) < 0)\r\n    infof(data, \"Could not set SO_NOSIGPIPE: %s\\n\",\r\n          Curl_strerror(conn, SOCKERRNO));\r\n}\r\n#else\r\n#define nosigpipe(x,y) Curl_nop_stmt\r\n#endif\r\n\r\n#ifdef USE_WINSOCK\r\n/* When you run a program that uses the Windows Sockets API, you may\r\n   experience slow performance when you copy data to a TCP server.\r\n\r\n   http://support.microsoft.com/kb/823764\r\n\r\n   Work-around: Make the Socket Send Buffer Size Larger Than the Program Send\r\n   Buffer Size\r\n\r\n*/\r\nvoid Curl_sndbufset(curl_socket_t sockfd)\r\n{\r\n  int val = CURL_MAX_WRITE_SIZE + 32;\r\n  int curval = 0;\r\n  int curlen = sizeof(curval);\r\n\r\n  if(getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&curval, &curlen) == 0)\r\n    if(curval > val)\r\n      return;\r\n\r\n  setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));\r\n}\r\n#endif\r\n\r\n\r\n/*\r\n * singleipconnect()\r\n *\r\n * Note that even on connect fail it returns CURLE_OK, but with 'sock' set to\r\n * CURL_SOCKET_BAD. Other errors will however return proper errors.\r\n *\r\n * singleipconnect() connects to the given IP only, and it may return without\r\n * having connected.\r\n */\r\nstatic CURLcode\r\nsingleipconnect(struct connectdata *conn,\r\n                const Curl_addrinfo *ai,\r\n                curl_socket_t *sockp,\r\n                bool *connected)\r\n{\r\n  struct Curl_sockaddr_ex addr;\r\n  int rc;\r\n  int error = 0;\r\n  bool isconnected = FALSE;\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sockfd;\r\n  CURLcode res = CURLE_OK;\r\n\r\n  *sockp = CURL_SOCKET_BAD;\r\n  *connected = FALSE; /* default is not connected */\r\n\r\n  res = Curl_socket(conn, ai, &addr, &sockfd);\r\n  if(res)\r\n    /* Failed to create the socket, but still return OK since we signal the\r\n       lack of socket as well. This allows the parent function to keep looping\r\n       over alternative addresses/socket families etc. */\r\n    return CURLE_OK;\r\n\r\n  /* store remote address and port used in this connection attempt */\r\n  if(!getaddressinfo((struct sockaddr*)&addr.sa_addr,\r\n                     conn->primary_ip, &conn->primary_port)) {\r\n    /* malformed address or bug in inet_ntop, try next address */\r\n    error = ERRNO;\r\n    failf(data, \"sa_addr inet_ntop() failed with errno %d: %s\",\r\n          error, Curl_strerror(conn, error));\r\n    Curl_closesocket(conn, sockfd);\r\n    return CURLE_OK;\r\n  }\r\n  memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);\r\n  infof(data, \"  Trying %s...\\n\", conn->ip_addr_str);\r\n\r\n  Curl_persistconninfo(conn);\r\n\r\n  if(data->set.tcp_nodelay)\r\n    tcpnodelay(conn, sockfd);\r\n\r\n  nosigpipe(conn, sockfd);\r\n\r\n  Curl_sndbufset(sockfd);\r\n\r\n  if(data->set.tcp_keepalive)\r\n    tcpkeepalive(data, sockfd);\r\n\r\n  if(data->set.fsockopt) {\r\n    /* activate callback for setting socket options */\r\n    error = data->set.fsockopt(data->set.sockopt_client,\r\n                               sockfd,\r\n                               CURLSOCKTYPE_IPCXN);\r\n\r\n    if(error == CURL_SOCKOPT_ALREADY_CONNECTED)\r\n      isconnected = TRUE;\r\n    else if(error) {\r\n      Curl_closesocket(conn, sockfd); /* close the socket and bail out */\r\n      return CURLE_ABORTED_BY_CALLBACK;\r\n    }\r\n  }\r\n\r\n  /* possibly bind the local end to an IP, interface or port */\r\n  res = bindlocal(conn, sockfd, addr.family);\r\n  if(res) {\r\n    Curl_closesocket(conn, sockfd); /* close socket and bail out */\r\n    return res;\r\n  }\r\n\r\n  /* set socket non-blocking */\r\n  curlx_nonblock(sockfd, TRUE);\r\n\r\n  conn->connecttime = Curl_tvnow();\r\n  if(conn->num_addr > 1)\r\n    Curl_expire(data, conn->timeoutms_per_addr);\r\n\r\n  /* Connect TCP sockets, bind UDP */\r\n  if(!isconnected && (conn->socktype == SOCK_STREAM)) {\r\n    rc = connect(sockfd, &addr.sa_addr, addr.addrlen);\r\n    if(-1 == rc)\r\n      error = SOCKERRNO;\r\n  }\r\n  else {\r\n    *sockp = sockfd;\r\n    return CURLE_OK;\r\n  }\r\n\r\n#ifdef ENABLE_IPV6\r\n  conn->bits.ipv6 = (addr.family == AF_INET6)?TRUE:FALSE;\r\n#endif\r\n\r\n  if(-1 == rc) {\r\n    switch (error) {\r\n    case EINPROGRESS:\r\n    case EWOULDBLOCK:\r\n#if defined(EAGAIN)\r\n#if (EAGAIN) != (EWOULDBLOCK)\r\n      /* On some platforms EAGAIN and EWOULDBLOCK are the\r\n       * same value, and on others they are different, hence\r\n       * the odd #if\r\n       */\r\n    case EAGAIN:\r\n#endif\r\n#endif\r\n      *sockp = sockfd;\r\n      return CURLE_OK;\r\n\r\n    default:\r\n      /* unknown error, fallthrough and try another address! */\r\n      failf(data, \"Failed to connect to %s: %s\",\r\n            conn->ip_addr_str, Curl_strerror(conn,error));\r\n      data->state.os_errno = error;\r\n\r\n      /* connect failed */\r\n      Curl_closesocket(conn, sockfd);\r\n\r\n      break;\r\n    }\r\n  }\r\n  else\r\n    *sockp = sockfd;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * TCP connect to the given host with timeout, proxy or remote doesn't matter.\r\n * There might be more than one IP address to try out. Fill in the passed\r\n * pointer with the connected socket.\r\n */\r\n\r\nCURLcode Curl_connecthost(struct connectdata *conn,  /* context */\r\n                          const struct Curl_dns_entry *remotehost,\r\n                          curl_socket_t *sockconn,   /* the connected socket */\r\n                          Curl_addrinfo **addr,      /* the one we used */\r\n                          bool *connected)           /* really connected? */\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sockfd = CURL_SOCKET_BAD;\r\n  Curl_addrinfo *ai;\r\n  Curl_addrinfo *curr_addr;\r\n\r\n  struct timeval after;\r\n  struct timeval before = Curl_tvnow();\r\n\r\n  /*************************************************************\r\n   * Figure out what maximum time we have left\r\n   *************************************************************/\r\n  long timeout_ms;\r\n\r\n  DEBUGASSERT(sockconn);\r\n  *connected = FALSE; /* default to not connected */\r\n\r\n  /* get the timeout left */\r\n  timeout_ms = Curl_timeleft(data, &before, TRUE);\r\n\r\n  if(timeout_ms < 0) {\r\n    /* a precaution, no need to continue if time already is up */\r\n    failf(data, \"Connection time-out\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  conn->num_addr = Curl_num_addresses(remotehost->addr);\r\n\r\n  ai = remotehost->addr;\r\n\r\n  /* Below is the loop that attempts to connect to all IP-addresses we\r\n   * know for the given host. One by one until one IP succeeds.\r\n   */\r\n\r\n  /*\r\n   * Connecting with a Curl_addrinfo chain\r\n   */\r\n  for(curr_addr = ai; curr_addr; curr_addr = curr_addr->ai_next) {\r\n    CURLcode res;\r\n\r\n    /* Max time for the next address */\r\n    conn->timeoutms_per_addr = curr_addr->ai_next == NULL ?\r\n                               timeout_ms : timeout_ms / 2;\r\n\r\n    /* start connecting to the IP curr_addr points to */\r\n    res = singleipconnect(conn, curr_addr,\r\n                          &sockfd, connected);\r\n    if(res)\r\n      return res;\r\n\r\n    if(sockfd != CURL_SOCKET_BAD)\r\n      break;\r\n\r\n    /* get a new timeout for next attempt */\r\n    after = Curl_tvnow();\r\n    timeout_ms -= Curl_tvdiff(after, before);\r\n    if(timeout_ms < 0) {\r\n      failf(data, \"connect() timed out!\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n    before = after;\r\n  }  /* end of connect-to-each-address loop */\r\n\r\n  *sockconn = sockfd;    /* the socket descriptor we've connected */\r\n\r\n  if(sockfd == CURL_SOCKET_BAD) {\r\n    /* no good connect was made */\r\n    failf(data, \"couldn't connect to %s at %s:%d\",\r\n          conn->bits.proxy?\"proxy\":\"host\",\r\n          conn->bits.proxy?conn->proxy.name:conn->host.name, conn->port);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  /* leave the socket in non-blocking mode */\r\n\r\n  /* store the address we use */\r\n  if(addr)\r\n    *addr = curr_addr;\r\n\r\n  data->info.numconnects++; /* to track the number of connections made */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstruct connfind {\r\n  struct connectdata *tofind;\r\n  bool found;\r\n};\r\n\r\nstatic int conn_is_conn(struct connectdata *conn, void *param)\r\n{\r\n  struct connfind *f = (struct connfind *)param;\r\n  if(conn == f->tofind) {\r\n    f->found = TRUE;\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n * Used to extract socket and connectdata struct for the most recent\r\n * transfer on the given SessionHandle.\r\n *\r\n * The returned socket will be CURL_SOCKET_BAD in case of failure!\r\n */\r\ncurl_socket_t Curl_getconnectinfo(struct SessionHandle *data,\r\n                                  struct connectdata **connp)\r\n{\r\n  curl_socket_t sockfd;\r\n\r\n  DEBUGASSERT(data);\r\n\r\n  /* this only works for an easy handle that has been used for\r\n     curl_easy_perform()! */\r\n  if(data->state.lastconnect && data->multi_easy) {\r\n    struct connectdata *c = data->state.lastconnect;\r\n    struct connfind find;\r\n    find.tofind = data->state.lastconnect;\r\n    find.found = FALSE;\r\n\r\n    Curl_conncache_foreach(data->multi_easy->conn_cache, &find, conn_is_conn);\r\n\r\n    if(!find.found) {\r\n      data->state.lastconnect = NULL;\r\n      return CURL_SOCKET_BAD;\r\n    }\r\n\r\n    if(connp)\r\n      /* only store this if the caller cares for it */\r\n      *connp = c;\r\n    sockfd = c->sock[FIRSTSOCKET];\r\n    /* we have a socket connected, let's determine if the server shut down */\r\n    /* determine if ssl */\r\n    if(c->ssl[FIRSTSOCKET].use) {\r\n      /* use the SSL context */\r\n      if(!Curl_ssl_check_cxn(c))\r\n        return CURL_SOCKET_BAD;   /* FIN received */\r\n    }\r\n/* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */\r\n#ifdef MSG_PEEK\r\n    else {\r\n      /* use the socket */\r\n      char buf;\r\n      if(recv((RECV_TYPE_ARG1)c->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf,\r\n              (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) {\r\n        return CURL_SOCKET_BAD;   /* FIN received */\r\n      }\r\n    }\r\n#endif\r\n  }\r\n  else\r\n    return CURL_SOCKET_BAD;\r\n\r\n  return sockfd;\r\n}\r\n\r\n/*\r\n * Close a socket.\r\n *\r\n * 'conn' can be NULL, beware!\r\n */\r\nint Curl_closesocket(struct connectdata *conn,\r\n                     curl_socket_t sock)\r\n{\r\n  if(conn && conn->fclosesocket) {\r\n    if((sock == conn->sock[SECONDARYSOCKET]) &&\r\n       conn->sock_accepted[SECONDARYSOCKET])\r\n      /* if this socket matches the second socket, and that was created with\r\n         accept, then we MUST NOT call the callback but clear the accepted\r\n         status */\r\n      conn->sock_accepted[SECONDARYSOCKET] = FALSE;\r\n    else\r\n      return conn->fclosesocket(conn->closesocket_client, sock);\r\n  }\r\n  return sclose(sock);\r\n}\r\n\r\n/*\r\n * Create a socket based on info from 'conn' and 'ai'.\r\n *\r\n * 'addr' should be a pointer to the correct struct to get data back, or NULL.\r\n * 'sockfd' must be a pointer to a socket descriptor.\r\n *\r\n * If the open socket callback is set, used that!\r\n *\r\n */\r\nCURLcode Curl_socket(struct connectdata *conn,\r\n                     const Curl_addrinfo *ai,\r\n                     struct Curl_sockaddr_ex *addr,\r\n                     curl_socket_t *sockfd)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct Curl_sockaddr_ex dummy;\r\n\r\n  if(!addr)\r\n    /* if the caller doesn't want info back, use a local temp copy */\r\n    addr = &dummy;\r\n\r\n  /*\r\n   * The Curl_sockaddr_ex structure is basically libcurl's external API\r\n   * curl_sockaddr structure with enough space available to directly hold\r\n   * any protocol-specific address structures. The variable declared here\r\n   * will be used to pass / receive data to/from the fopensocket callback\r\n   * if this has been set, before that, it is initialized from parameters.\r\n   */\r\n\r\n  addr->family = ai->ai_family;\r\n  addr->socktype = conn->socktype;\r\n  addr->protocol = conn->socktype==SOCK_DGRAM?IPPROTO_UDP:ai->ai_protocol;\r\n  addr->addrlen = ai->ai_addrlen;\r\n\r\n  if(addr->addrlen > sizeof(struct Curl_sockaddr_storage))\r\n     addr->addrlen = sizeof(struct Curl_sockaddr_storage);\r\n  memcpy(&addr->sa_addr, ai->ai_addr, addr->addrlen);\r\n\r\n  if(data->set.fopensocket)\r\n   /*\r\n    * If the opensocket callback is set, all the destination address\r\n    * information is passed to the callback. Depending on this information the\r\n    * callback may opt to abort the connection, this is indicated returning\r\n    * CURL_SOCKET_BAD; otherwise it will return a not-connected socket. When\r\n    * the callback returns a valid socket the destination address information\r\n    * might have been changed and this 'new' address will actually be used\r\n    * here to connect.\r\n    */\r\n    *sockfd = data->set.fopensocket(data->set.opensocket_client,\r\n                                    CURLSOCKTYPE_IPCXN,\r\n                                    (struct curl_sockaddr *)addr);\r\n  else\r\n    /* opensocket callback not set, so simply create the socket now */\r\n    *sockfd = socket(addr->family, addr->socktype, addr->protocol);\r\n\r\n  if(*sockfd == CURL_SOCKET_BAD)\r\n    /* no socket, no connection */\r\n    return CURLE_COULDNT_CONNECT;\r\n\r\n#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)\r\n  if(conn->scope && (addr->family == AF_INET6)) {\r\n    struct sockaddr_in6 * const sa6 = (void *)&addr->sa_addr;\r\n    sa6->sin6_scope_id = conn->scope;\r\n  }\r\n#endif\r\n\r\n  return CURLE_OK;\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/connect.h",
    "content": "#ifndef HEADER_CURL_CONNECT_H\r\n#define HEADER_CURL_CONNECT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#include \"nonblock.h\" /* for curlx_nonblock(), formerly Curl_nonblock() */\r\n#include \"sockaddr.h\"\r\n\r\nCURLcode Curl_is_connected(struct connectdata *conn,\r\n                           int sockindex,\r\n                           bool *connected);\r\n\r\nCURLcode Curl_connecthost(struct connectdata *conn,\r\n                          const struct Curl_dns_entry *host, /* connect to\r\n                                                                this */\r\n                          curl_socket_t *sockconn, /* not set if error */\r\n                          Curl_addrinfo **addr, /* the one we used */\r\n                          bool *connected); /* truly connected? */\r\n\r\n/* generic function that returns how much time there's left to run, according\r\n   to the timeouts set */\r\nlong Curl_timeleft(struct SessionHandle *data,\r\n                   struct timeval *nowp,\r\n                   bool duringconnect);\r\n\r\n#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */\r\n\r\n/*\r\n * Used to extract socket and connectdata struct for the most recent\r\n * transfer on the given SessionHandle.\r\n *\r\n * The returned socket will be CURL_SOCKET_BAD in case of failure!\r\n */\r\ncurl_socket_t Curl_getconnectinfo(struct SessionHandle *data,\r\n                                  struct connectdata **connp);\r\n\r\n#ifdef USE_WINSOCK\r\n/* When you run a program that uses the Windows Sockets API, you may\r\n   experience slow performance when you copy data to a TCP server.\r\n\r\n   http://support.microsoft.com/kb/823764\r\n\r\n   Work-around: Make the Socket Send Buffer Size Larger Than the Program Send\r\n   Buffer Size\r\n\r\n*/\r\nvoid Curl_sndbufset(curl_socket_t sockfd);\r\n#else\r\n#define Curl_sndbufset(y) Curl_nop_stmt\r\n#endif\r\n\r\nvoid Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd);\r\nvoid Curl_persistconninfo(struct connectdata *conn);\r\nint Curl_closesocket(struct connectdata *conn, curl_socket_t sock);\r\n\r\n/*\r\n * The Curl_sockaddr_ex structure is basically libcurl's external API\r\n * curl_sockaddr structure with enough space available to directly hold any\r\n * protocol-specific address structures. The variable declared here will be\r\n * used to pass / receive data to/from the fopensocket callback if this has\r\n * been set, before that, it is initialized from parameters.\r\n */\r\nstruct Curl_sockaddr_ex {\r\n  int family;\r\n  int socktype;\r\n  int protocol;\r\n  unsigned int addrlen;\r\n  union {\r\n    struct sockaddr addr;\r\n    struct Curl_sockaddr_storage buff;\r\n  } _sa_ex_u;\r\n};\r\n#define sa_addr _sa_ex_u.addr\r\n\r\n/*\r\n * Create a socket based on info from 'conn' and 'ai'.\r\n *\r\n * Fill in 'addr' and 'sockfd' accordingly if OK is returned. If the open\r\n * socket callback is set, used that!\r\n *\r\n */\r\nCURLcode Curl_socket(struct connectdata *conn,\r\n                     const Curl_addrinfo *ai,\r\n                     struct Curl_sockaddr_ex *addr,\r\n                     curl_socket_t *sockfd);\r\n\r\n#endif /* HEADER_CURL_CONNECT_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/content_encoding.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_LIBZ\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"sendf.h\"\r\n#include \"content_encoding.h\"\r\n#include \"curl_memory.h\"\r\n\r\n#include \"memdebug.h\"\r\n\r\n/* Comment this out if zlib is always going to be at least ver. 1.2.0.4\r\n   (doing so will reduce code size slightly). */\r\n#define OLD_ZLIB_SUPPORT 1\r\n\r\n#define DSIZ CURL_MAX_WRITE_SIZE /* buffer size for decompressed data */\r\n\r\n#define GZIP_MAGIC_0 0x1f\r\n#define GZIP_MAGIC_1 0x8b\r\n\r\n/* gzip flag byte */\r\n#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */\r\n#define HEAD_CRC     0x02 /* bit 1 set: header CRC present */\r\n#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */\r\n#define ORIG_NAME    0x08 /* bit 3 set: original file name present */\r\n#define COMMENT      0x10 /* bit 4 set: file comment present */\r\n#define RESERVED     0xE0 /* bits 5..7: reserved */\r\n\r\nstatic voidpf\r\nzalloc_cb(voidpf opaque, unsigned int items, unsigned int size)\r\n{\r\n  (void) opaque;\r\n  /* not a typo, keep it calloc() */\r\n  return (voidpf) calloc(items, size);\r\n}\r\n\r\nstatic void\r\nzfree_cb(voidpf opaque, voidpf ptr)\r\n{\r\n  (void) opaque;\r\n  free(ptr);\r\n}\r\n\r\nstatic CURLcode\r\nprocess_zlib_error(struct connectdata *conn, z_stream *z)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  if(z->msg)\r\n    failf (data, \"Error while processing content unencoding: %s\",\r\n           z->msg);\r\n  else\r\n    failf (data, \"Error while processing content unencoding: \"\r\n           \"Unknown failure within decompression software.\");\r\n\r\n  return CURLE_BAD_CONTENT_ENCODING;\r\n}\r\n\r\nstatic CURLcode\r\nexit_zlib(z_stream *z, zlibInitState *zlib_init, CURLcode result)\r\n{\r\n  inflateEnd(z);\r\n  *zlib_init = ZLIB_UNINIT;\r\n  return result;\r\n}\r\n\r\nstatic CURLcode\r\ninflate_stream(struct connectdata *conn,\r\n               struct SingleRequest *k)\r\n{\r\n  int allow_restart = 1;\r\n  z_stream *z = &k->z;          /* zlib state structure */\r\n  uInt nread = z->avail_in;\r\n  Bytef *orig_in = z->next_in;\r\n  int status;                   /* zlib status */\r\n  CURLcode result = CURLE_OK;   /* Curl_client_write status */\r\n  char *decomp;                 /* Put the decompressed data here. */\r\n\r\n  /* Dynamically allocate a buffer for decompression because it's uncommonly\r\n     large to hold on the stack */\r\n  decomp = malloc(DSIZ);\r\n  if(decomp == NULL) {\r\n    return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY);\r\n  }\r\n\r\n  /* because the buffer size is fixed, iteratively decompress and transfer to\r\n     the client via client_write. */\r\n  for(;;) {\r\n    /* (re)set buffer for decompressed output for every iteration */\r\n    z->next_out = (Bytef *)decomp;\r\n    z->avail_out = DSIZ;\r\n\r\n    status = inflate(z, Z_SYNC_FLUSH);\r\n    if(status == Z_OK || status == Z_STREAM_END) {\r\n      allow_restart = 0;\r\n      if((DSIZ - z->avail_out) && (!k->ignorebody)) {\r\n        result = Curl_client_write(conn, CLIENTWRITE_BODY, decomp,\r\n                                   DSIZ - z->avail_out);\r\n        /* if !CURLE_OK, clean up, return */\r\n        if(result) {\r\n          free(decomp);\r\n          return exit_zlib(z, &k->zlib_init, result);\r\n        }\r\n      }\r\n\r\n      /* Done? clean up, return */\r\n      if(status == Z_STREAM_END) {\r\n        free(decomp);\r\n        if(inflateEnd(z) == Z_OK)\r\n          return exit_zlib(z, &k->zlib_init, result);\r\n        else\r\n          return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));\r\n      }\r\n\r\n      /* Done with these bytes, exit */\r\n\r\n      /* status is always Z_OK at this point! */\r\n      if(z->avail_in == 0) {\r\n        free(decomp);\r\n        return result;\r\n      }\r\n    }\r\n    else if(allow_restart && status == Z_DATA_ERROR) {\r\n      /* some servers seem to not generate zlib headers, so this is an attempt\r\n         to fix and continue anyway */\r\n\r\n      (void) inflateEnd(z);     /* don't care about the return code */\r\n      if(inflateInit2(z, -MAX_WBITS) != Z_OK) {\r\n        free(decomp);\r\n        return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));\r\n      }\r\n      z->next_in = orig_in;\r\n      z->avail_in = nread;\r\n      allow_restart = 0;\r\n      continue;\r\n    }\r\n    else {                      /* Error; exit loop, handle below */\r\n      free(decomp);\r\n      return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));\r\n    }\r\n  }\r\n  /* Will never get here */\r\n}\r\n\r\nCURLcode\r\nCurl_unencode_deflate_write(struct connectdata *conn,\r\n                            struct SingleRequest *k,\r\n                            ssize_t nread)\r\n{\r\n  z_stream *z = &k->z;          /* zlib state structure */\r\n\r\n  /* Initialize zlib? */\r\n  if(k->zlib_init == ZLIB_UNINIT) {\r\n    memset(z, 0, sizeof(z_stream));\r\n    z->zalloc = (alloc_func)zalloc_cb;\r\n    z->zfree = (free_func)zfree_cb;\r\n\r\n    if(inflateInit(z) != Z_OK)\r\n      return process_zlib_error(conn, z);\r\n    k->zlib_init = ZLIB_INIT;\r\n  }\r\n\r\n  /* Set the compressed input when this function is called */\r\n  z->next_in = (Bytef *)k->str;\r\n  z->avail_in = (uInt)nread;\r\n\r\n  /* Now uncompress the data */\r\n  return inflate_stream(conn, k);\r\n}\r\n\r\n#ifdef OLD_ZLIB_SUPPORT\r\n/* Skip over the gzip header */\r\nstatic enum {\r\n  GZIP_OK,\r\n  GZIP_BAD,\r\n  GZIP_UNDERFLOW\r\n} check_gzip_header(unsigned char const *data, ssize_t len, ssize_t *headerlen)\r\n{\r\n  int method, flags;\r\n  const ssize_t totallen = len;\r\n\r\n  /* The shortest header is 10 bytes */\r\n  if(len < 10)\r\n    return GZIP_UNDERFLOW;\r\n\r\n  if((data[0] != GZIP_MAGIC_0) || (data[1] != GZIP_MAGIC_1))\r\n    return GZIP_BAD;\r\n\r\n  method = data[2];\r\n  flags = data[3];\r\n\r\n  if(method != Z_DEFLATED || (flags & RESERVED) != 0) {\r\n    /* Can't handle this compression method or unknown flag */\r\n    return GZIP_BAD;\r\n  }\r\n\r\n  /* Skip over time, xflags, OS code and all previous bytes */\r\n  len -= 10;\r\n  data += 10;\r\n\r\n  if(flags & EXTRA_FIELD) {\r\n    ssize_t extra_len;\r\n\r\n    if(len < 2)\r\n      return GZIP_UNDERFLOW;\r\n\r\n    extra_len = (data[1] << 8) | data[0];\r\n\r\n    if(len < (extra_len+2))\r\n      return GZIP_UNDERFLOW;\r\n\r\n    len -= (extra_len + 2);\r\n    data += (extra_len + 2);\r\n  }\r\n\r\n  if(flags & ORIG_NAME) {\r\n    /* Skip over NUL-terminated file name */\r\n    while(len && *data) {\r\n      --len;\r\n      ++data;\r\n    }\r\n    if(!len || *data)\r\n      return GZIP_UNDERFLOW;\r\n\r\n    /* Skip over the NUL */\r\n    --len;\r\n    ++data;\r\n  }\r\n\r\n  if(flags & COMMENT) {\r\n    /* Skip over NUL-terminated comment */\r\n    while(len && *data) {\r\n      --len;\r\n      ++data;\r\n    }\r\n    if(!len || *data)\r\n      return GZIP_UNDERFLOW;\r\n\r\n    /* Skip over the NUL */\r\n    --len;\r\n  }\r\n\r\n  if(flags & HEAD_CRC) {\r\n    if(len < 2)\r\n      return GZIP_UNDERFLOW;\r\n\r\n    len -= 2;\r\n  }\r\n\r\n  *headerlen = totallen - len;\r\n  return GZIP_OK;\r\n}\r\n#endif\r\n\r\nCURLcode\r\nCurl_unencode_gzip_write(struct connectdata *conn,\r\n                         struct SingleRequest *k,\r\n                         ssize_t nread)\r\n{\r\n  z_stream *z = &k->z;          /* zlib state structure */\r\n\r\n  /* Initialize zlib? */\r\n  if(k->zlib_init == ZLIB_UNINIT) {\r\n    memset(z, 0, sizeof(z_stream));\r\n    z->zalloc = (alloc_func)zalloc_cb;\r\n    z->zfree = (free_func)zfree_cb;\r\n\r\n    if(strcmp(zlibVersion(), \"1.2.0.4\") >= 0) {\r\n      /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */\r\n      if(inflateInit2(z, MAX_WBITS+32) != Z_OK) {\r\n        return process_zlib_error(conn, z);\r\n      }\r\n      k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */\r\n    }\r\n    else {\r\n      /* we must parse the gzip header ourselves */\r\n      if(inflateInit2(z, -MAX_WBITS) != Z_OK) {\r\n        return process_zlib_error(conn, z);\r\n      }\r\n      k->zlib_init = ZLIB_INIT;   /* Initial call state */\r\n    }\r\n  }\r\n\r\n  if(k->zlib_init == ZLIB_INIT_GZIP) {\r\n    /* Let zlib handle the gzip decompression entirely */\r\n    z->next_in = (Bytef *)k->str;\r\n    z->avail_in = (uInt)nread;\r\n    /* Now uncompress the data */\r\n    return inflate_stream(conn, k);\r\n  }\r\n\r\n#ifndef OLD_ZLIB_SUPPORT\r\n  /* Support for old zlib versions is compiled away and we are running with\r\n     an old version, so return an error. */\r\n  return exit_zlib(z, &k->zlib_init, CURLE_FUNCTION_NOT_FOUND);\r\n\r\n#else\r\n  /* This next mess is to get around the potential case where there isn't\r\n   * enough data passed in to skip over the gzip header.  If that happens, we\r\n   * malloc a block and copy what we have then wait for the next call.  If\r\n   * there still isn't enough (this is definitely a worst-case scenario), we\r\n   * make the block bigger, copy the next part in and keep waiting.\r\n   *\r\n   * This is only required with zlib versions < 1.2.0.4 as newer versions\r\n   * can handle the gzip header themselves.\r\n   */\r\n\r\n  switch (k->zlib_init) {\r\n  /* Skip over gzip header? */\r\n  case ZLIB_INIT:\r\n  {\r\n    /* Initial call state */\r\n    ssize_t hlen;\r\n\r\n    switch (check_gzip_header((unsigned char *)k->str, nread, &hlen)) {\r\n    case GZIP_OK:\r\n      z->next_in = (Bytef *)k->str + hlen;\r\n      z->avail_in = (uInt)(nread - hlen);\r\n      k->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */\r\n      break;\r\n\r\n    case GZIP_UNDERFLOW:\r\n      /* We need more data so we can find the end of the gzip header.  It's\r\n       * possible that the memory block we malloc here will never be freed if\r\n       * the transfer abruptly aborts after this point.  Since it's unlikely\r\n       * that circumstances will be right for this code path to be followed in\r\n       * the first place, and it's even more unlikely for a transfer to fail\r\n       * immediately afterwards, it should seldom be a problem.\r\n       */\r\n      z->avail_in = (uInt)nread;\r\n      z->next_in = malloc(z->avail_in);\r\n      if(z->next_in == NULL) {\r\n        return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY);\r\n      }\r\n      memcpy(z->next_in, k->str, z->avail_in);\r\n      k->zlib_init = ZLIB_GZIP_HEADER;   /* Need more gzip header data state */\r\n      /* We don't have any data to inflate yet */\r\n      return CURLE_OK;\r\n\r\n    case GZIP_BAD:\r\n    default:\r\n      return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));\r\n    }\r\n\r\n  }\r\n  break;\r\n\r\n  case ZLIB_GZIP_HEADER:\r\n  {\r\n    /* Need more gzip header data state */\r\n    ssize_t hlen;\r\n    unsigned char *oldblock = z->next_in;\r\n\r\n    z->avail_in += (uInt)nread;\r\n    z->next_in = realloc(z->next_in, z->avail_in);\r\n    if(z->next_in == NULL) {\r\n      free(oldblock);\r\n      return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY);\r\n    }\r\n    /* Append the new block of data to the previous one */\r\n    memcpy(z->next_in + z->avail_in - nread, k->str, nread);\r\n\r\n    switch (check_gzip_header(z->next_in, z->avail_in, &hlen)) {\r\n    case GZIP_OK:\r\n      /* This is the zlib stream data */\r\n      free(z->next_in);\r\n      /* Don't point into the malloced block since we just freed it */\r\n      z->next_in = (Bytef *)k->str + hlen + nread - z->avail_in;\r\n      z->avail_in = (uInt)(z->avail_in - hlen);\r\n      k->zlib_init = ZLIB_GZIP_INFLATING;   /* Inflating stream state */\r\n      break;\r\n\r\n    case GZIP_UNDERFLOW:\r\n      /* We still don't have any data to inflate! */\r\n      return CURLE_OK;\r\n\r\n    case GZIP_BAD:\r\n    default:\r\n      free(z->next_in);\r\n      return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));\r\n    }\r\n\r\n  }\r\n  break;\r\n\r\n  case ZLIB_GZIP_INFLATING:\r\n  default:\r\n    /* Inflating stream state */\r\n    z->next_in = (Bytef *)k->str;\r\n    z->avail_in = (uInt)nread;\r\n    break;\r\n  }\r\n\r\n  if(z->avail_in == 0) {\r\n    /* We don't have any data to inflate; wait until next time */\r\n    return CURLE_OK;\r\n  }\r\n\r\n  /* We've parsed the header, now uncompress the data */\r\n  return inflate_stream(conn, k);\r\n#endif\r\n}\r\n\r\nvoid Curl_unencode_cleanup(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct SingleRequest *k = &data->req;\r\n  z_stream *z = &k->z;\r\n  if(k->zlib_init != ZLIB_UNINIT)\r\n    (void) exit_zlib(z, &k->zlib_init, CURLE_OK);\r\n}\r\n\r\n#endif /* HAVE_LIBZ */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/content_encoding.h",
    "content": "#ifndef HEADER_CURL_CONTENT_ENCODING_H\r\n#define HEADER_CURL_CONTENT_ENCODING_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n/*\r\n * Comma-separated list all supported Content-Encodings ('identity' is implied)\r\n */\r\n#ifdef HAVE_LIBZ\r\n#define ALL_CONTENT_ENCODINGS \"deflate, gzip\"\r\n/* force a cleanup */\r\nvoid Curl_unencode_cleanup(struct connectdata *conn);\r\n#else\r\n#define ALL_CONTENT_ENCODINGS \"identity\"\r\n#define Curl_unencode_cleanup(x) Curl_nop_stmt\r\n#endif\r\n\r\nCURLcode Curl_unencode_deflate_write(struct connectdata *conn,\r\n                                     struct SingleRequest *req,\r\n                                     ssize_t nread);\r\n\r\nCURLcode\r\nCurl_unencode_gzip_write(struct connectdata *conn,\r\n                         struct SingleRequest *k,\r\n                         ssize_t nread);\r\n\r\n\r\n#endif /* HEADER_CURL_CONTENT_ENCODING_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/cookie.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/***\r\n\r\n\r\nRECEIVING COOKIE INFORMATION\r\n============================\r\n\r\nstruct CookieInfo *cookie_init(char *file);\r\n\r\n        Inits a cookie struct to store data in a local file. This is always\r\n        called before any cookies are set.\r\n\r\nint cookies_set(struct CookieInfo *cookie, char *cookie_line);\r\n\r\n        The 'cookie_line' parameter is a full \"Set-cookie:\" line as\r\n        received from a server.\r\n\r\n        The function need to replace previously stored lines that this new\r\n        line superceeds.\r\n\r\n        It may remove lines that are expired.\r\n\r\n        It should return an indication of success/error.\r\n\r\n\r\nSENDING COOKIE INFORMATION\r\n==========================\r\n\r\nstruct Cookies *cookie_getlist(struct CookieInfo *cookie,\r\n                               char *host, char *path, bool secure);\r\n\r\n        For a given host and path, return a linked list of cookies that\r\n        the client should send to the server if used now. The secure\r\n        boolean informs the cookie if a secure connection is achieved or\r\n        not.\r\n\r\n        It shall only return cookies that haven't expired.\r\n\r\n\r\nExample set of cookies:\r\n\r\n    Set-cookie: PRODUCTINFO=webxpress; domain=.fidelity.com; path=/; secure\r\n    Set-cookie: PERSONALIZE=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;\r\n    domain=.fidelity.com; path=/ftgw; secure\r\n    Set-cookie: FidHist=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;\r\n    domain=.fidelity.com; path=/; secure\r\n    Set-cookie: FidOrder=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;\r\n    domain=.fidelity.com; path=/; secure\r\n    Set-cookie: DisPend=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;\r\n    domain=.fidelity.com; path=/; secure\r\n    Set-cookie: FidDis=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;\r\n    domain=.fidelity.com; path=/; secure\r\n    Set-cookie:\r\n    Session_Key@6791a9e0-901a-11d0-a1c8-9b012c88aa77=none;expires=Monday,\r\n    13-Jun-1988 03:04:55 GMT; domain=.fidelity.com; path=/; secure\r\n****/\r\n\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n\r\n#define _MPRINTF_REPLACE\r\n#include <curl/mprintf.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"cookie.h\"\r\n#include \"strequal.h\"\r\n#include \"strtok.h\"\r\n#include \"sendf.h\"\r\n#include \"curl_memory.h\"\r\n#include \"share_curl.h\"\r\n#include \"strtoofft.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_memrchr.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic void freecookie(struct Cookie *co)\r\n{\r\n  if(co->expirestr)\r\n    free(co->expirestr);\r\n  if(co->domain)\r\n    free(co->domain);\r\n  if(co->path)\r\n    free(co->path);\r\n  if(co->name)\r\n    free(co->name);\r\n  if(co->value)\r\n    free(co->value);\r\n  if(co->maxage)\r\n    free(co->maxage);\r\n  if(co->version)\r\n    free(co->version);\r\n\r\n  free(co);\r\n}\r\n\r\nstatic bool tailmatch(const char *little, const char *bigone)\r\n{\r\n  size_t littlelen = strlen(little);\r\n  size_t biglen = strlen(bigone);\r\n\r\n  if(littlelen > biglen)\r\n    return FALSE;\r\n\r\n  return Curl_raw_equal(little, bigone+biglen-littlelen) ? TRUE : FALSE;\r\n}\r\n\r\n/*\r\n * Load cookies from all given cookie files (CURLOPT_COOKIEFILE).\r\n */\r\nvoid Curl_cookie_loadfiles(struct SessionHandle *data)\r\n{\r\n  struct curl_slist *list = data->change.cookielist;\r\n  if(list) {\r\n    Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);\r\n    while(list) {\r\n      data->cookies = Curl_cookie_init(data,\r\n                                       list->data,\r\n                                       data->cookies,\r\n                                       data->set.cookiesession);\r\n      list = list->next;\r\n    }\r\n    curl_slist_free_all(data->change.cookielist); /* clean up list */\r\n    data->change.cookielist = NULL; /* don't do this again! */\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);\r\n  }\r\n}\r\n\r\n/*\r\n * strstore() makes a strdup() on the 'newstr' and if '*str' is non-NULL\r\n * that will be freed before the allocated string is stored there.\r\n *\r\n * It is meant to easily replace strdup()\r\n */\r\nstatic void strstore(char **str, const char *newstr)\r\n{\r\n  if(*str)\r\n    free(*str);\r\n  *str = strdup(newstr);\r\n}\r\n\r\n\r\n/****************************************************************************\r\n *\r\n * Curl_cookie_add()\r\n *\r\n * Add a single cookie line to the cookie keeping object.\r\n *\r\n ***************************************************************************/\r\n\r\nstruct Cookie *\r\nCurl_cookie_add(struct SessionHandle *data,\r\n                /* The 'data' pointer here may be NULL at times, and thus\r\n                   must only be used very carefully for things that can deal\r\n                   with data being NULL. Such as infof() and similar */\r\n\r\n                struct CookieInfo *c,\r\n                bool httpheader, /* TRUE if HTTP header-style line */\r\n                char *lineptr,   /* first character of the line */\r\n                const char *domain, /* default domain */\r\n                const char *path)   /* full path used when this cookie is set,\r\n                                       used to get default path for the cookie\r\n                                       unless set */\r\n{\r\n  struct Cookie *clist;\r\n  char name[MAX_NAME];\r\n  struct Cookie *co;\r\n  struct Cookie *lastc=NULL;\r\n  time_t now = time(NULL);\r\n  bool replace_old = FALSE;\r\n  bool badcookie = FALSE; /* cookies are good by default. mmmmm yummy */\r\n\r\n#ifdef CURL_DISABLE_VERBOSE_STRINGS\r\n  (void)data;\r\n#endif\r\n\r\n  /* First, alloc and init a new struct for it */\r\n  co = calloc(1, sizeof(struct Cookie));\r\n  if(!co)\r\n    return NULL; /* bail out if we're this low on memory */\r\n\r\n  if(httpheader) {\r\n    /* This line was read off a HTTP-header */\r\n    const char *ptr;\r\n    const char *semiptr;\r\n    char *what;\r\n\r\n    what = malloc(MAX_COOKIE_LINE);\r\n    if(!what) {\r\n      free(co);\r\n      return NULL;\r\n    }\r\n\r\n    semiptr=strchr(lineptr, ';'); /* first, find a semicolon */\r\n\r\n    while(*lineptr && ISBLANK(*lineptr))\r\n      lineptr++;\r\n\r\n    ptr = lineptr;\r\n    do {\r\n      /* we have a <what>=<this> pair or a stand-alone word here */\r\n      name[0]=what[0]=0; /* init the buffers */\r\n      if(1 <= sscanf(ptr, \"%\" MAX_NAME_TXT \"[^;\\r\\n =]=%\"\r\n                     MAX_COOKIE_LINE_TXT \"[^;\\r\\n]\",\r\n                     name, what)) {\r\n        /* Use strstore() below to properly deal with received cookie\r\n           headers that have the same string property set more than once,\r\n           and then we use the last one. */\r\n        const char *whatptr;\r\n        bool done = FALSE;\r\n        bool sep;\r\n        size_t len=strlen(what);\r\n        const char *endofn = &ptr[ strlen(name) ];\r\n\r\n        /* skip trailing spaces in name */\r\n        while(*endofn && ISBLANK(*endofn))\r\n          endofn++;\r\n\r\n        /* name ends with a '=' ? */\r\n        sep = (*endofn == '=')?TRUE:FALSE;\r\n\r\n        /* Strip off trailing whitespace from the 'what' */\r\n        while(len && ISBLANK(what[len-1])) {\r\n          what[len-1]=0;\r\n          len--;\r\n        }\r\n\r\n        /* Skip leading whitespace from the 'what' */\r\n        whatptr=what;\r\n        while(*whatptr && ISBLANK(*whatptr))\r\n          whatptr++;\r\n\r\n        if(!len) {\r\n          /* this was a \"<name>=\" with no content, and we must allow\r\n             'secure' and 'httponly' specified this weirdly */\r\n          done = TRUE;\r\n          if(Curl_raw_equal(\"secure\", name))\r\n            co->secure = TRUE;\r\n          else if(Curl_raw_equal(\"httponly\", name))\r\n            co->httponly = TRUE;\r\n          else if(sep)\r\n            /* there was a '=' so we're not done parsing this field */\r\n            done = FALSE;\r\n        }\r\n        if(done)\r\n          ;\r\n        else if(Curl_raw_equal(\"path\", name)) {\r\n          strstore(&co->path, whatptr);\r\n          if(!co->path) {\r\n            badcookie = TRUE; /* out of memory bad */\r\n            break;\r\n          }\r\n        }\r\n        else if(Curl_raw_equal(\"domain\", name)) {\r\n          /* note that this name may or may not have a preceding dot, but\r\n             we don't care about that, we treat the names the same anyway */\r\n\r\n          const char *domptr=whatptr;\r\n          const char *nextptr;\r\n          int dotcount=1;\r\n\r\n          /* Count the dots, we need to make sure that there are enough\r\n             of them. */\r\n\r\n          if('.' == whatptr[0])\r\n            /* don't count the initial dot, assume it */\r\n            domptr++;\r\n\r\n          do {\r\n            nextptr = strchr(domptr, '.');\r\n            if(nextptr) {\r\n              if(domptr != nextptr)\r\n                dotcount++;\r\n              domptr = nextptr+1;\r\n            }\r\n          } while(nextptr);\r\n\r\n          /* The original Netscape cookie spec defined that this domain name\r\n             MUST have three dots (or two if one of the seven holy TLDs),\r\n             but it seems that these kinds of cookies are in use \"out there\"\r\n             so we cannot be that strict. I've therefore lowered the check\r\n             to not allow less than two dots. */\r\n\r\n          if(dotcount < 2) {\r\n            /* Received and skipped a cookie with a domain using too few\r\n               dots. */\r\n            badcookie=TRUE; /* mark this as a bad cookie */\r\n            infof(data, \"skipped cookie with illegal dotcount domain: %s\\n\",\r\n                  whatptr);\r\n          }\r\n          else {\r\n            /* Now, we make sure that our host is within the given domain,\r\n               or the given domain is not valid and thus cannot be set. */\r\n\r\n            if('.' == whatptr[0])\r\n              whatptr++; /* ignore preceding dot */\r\n\r\n            if(!domain || tailmatch(whatptr, domain)) {\r\n              const char *tailptr=whatptr;\r\n              if(tailptr[0] == '.')\r\n                tailptr++;\r\n              strstore(&co->domain, tailptr); /* don't prefix w/dots\r\n                                                 internally */\r\n              if(!co->domain) {\r\n                badcookie = TRUE;\r\n                break;\r\n              }\r\n              co->tailmatch=TRUE; /* we always do that if the domain name was\r\n                                     given */\r\n            }\r\n            else {\r\n              /* we did not get a tailmatch and then the attempted set domain\r\n                 is not a domain to which the current host belongs. Mark as\r\n                 bad. */\r\n              badcookie=TRUE;\r\n              infof(data, \"skipped cookie with bad tailmatch domain: %s\\n\",\r\n                    whatptr);\r\n            }\r\n          }\r\n        }\r\n        else if(Curl_raw_equal(\"version\", name)) {\r\n          strstore(&co->version, whatptr);\r\n          if(!co->version) {\r\n            badcookie = TRUE;\r\n            break;\r\n          }\r\n        }\r\n        else if(Curl_raw_equal(\"max-age\", name)) {\r\n          /* Defined in RFC2109:\r\n\r\n             Optional.  The Max-Age attribute defines the lifetime of the\r\n             cookie, in seconds.  The delta-seconds value is a decimal non-\r\n             negative integer.  After delta-seconds seconds elapse, the\r\n             client should discard the cookie.  A value of zero means the\r\n             cookie should be discarded immediately.\r\n\r\n          */\r\n          strstore(&co->maxage, whatptr);\r\n          if(!co->maxage) {\r\n            badcookie = TRUE;\r\n            break;\r\n          }\r\n          co->expires =\r\n            strtol((*co->maxage=='\\\"')?&co->maxage[1]:&co->maxage[0],NULL,10)\r\n            + (long)now;\r\n        }\r\n        else if(Curl_raw_equal(\"expires\", name)) {\r\n          strstore(&co->expirestr, whatptr);\r\n          if(!co->expirestr) {\r\n            badcookie = TRUE;\r\n            break;\r\n          }\r\n          /* Note that if the date couldn't get parsed for whatever reason,\r\n             the cookie will be treated as a session cookie */\r\n          co->expires = curl_getdate(what, &now);\r\n\r\n          /* Session cookies have expires set to 0 so if we get that back\r\n             from the date parser let's add a second to make it a\r\n             non-session cookie */\r\n          if(co->expires == 0)\r\n            co->expires = 1;\r\n          else if(co->expires < 0)\r\n            co->expires = 0;\r\n        }\r\n        else if(!co->name) {\r\n          co->name = strdup(name);\r\n          co->value = strdup(whatptr);\r\n          if(!co->name || !co->value) {\r\n            badcookie = TRUE;\r\n            break;\r\n          }\r\n        }\r\n        /*\r\n          else this is the second (or more) name we don't know\r\n          about! */\r\n      }\r\n      else {\r\n        /* this is an \"illegal\" <what>=<this> pair */\r\n      }\r\n\r\n      if(!semiptr || !*semiptr) {\r\n        /* we already know there are no more cookies */\r\n        semiptr = NULL;\r\n        continue;\r\n      }\r\n\r\n      ptr=semiptr+1;\r\n      while(*ptr && ISBLANK(*ptr))\r\n        ptr++;\r\n      semiptr=strchr(ptr, ';'); /* now, find the next semicolon */\r\n\r\n      if(!semiptr && *ptr)\r\n        /* There are no more semicolons, but there's a final name=value pair\r\n           coming up */\r\n        semiptr=strchr(ptr, '\\0');\r\n    } while(semiptr);\r\n\r\n    if(!badcookie && !co->domain) {\r\n      if(domain) {\r\n        /* no domain was given in the header line, set the default */\r\n        co->domain=strdup(domain);\r\n        if(!co->domain)\r\n          badcookie = TRUE;\r\n      }\r\n    }\r\n\r\n    if(!badcookie && !co->path && path) {\r\n      /* No path was given in the header line, set the default.\r\n         Note that the passed-in path to this function MAY have a '?' and\r\n         following part that MUST not be stored as part of the path. */\r\n      char *queryp = strchr(path, '?');\r\n\r\n      /* queryp is where the interesting part of the path ends, so now we\r\n         want to the find the last */\r\n      char *endslash;\r\n      if(!queryp)\r\n        endslash = strrchr(path, '/');\r\n      else\r\n        endslash = memrchr(path, '/', (size_t)(queryp - path));\r\n      if(endslash) {\r\n        size_t pathlen = (size_t)(endslash-path+1); /* include ending slash */\r\n        co->path=malloc(pathlen+1); /* one extra for the zero byte */\r\n        if(co->path) {\r\n          memcpy(co->path, path, pathlen);\r\n          co->path[pathlen]=0; /* zero terminate */\r\n        }\r\n        else\r\n          badcookie = TRUE;\r\n      }\r\n    }\r\n\r\n    free(what);\r\n\r\n    if(badcookie || !co->name) {\r\n      /* we didn't get a cookie name or a bad one,\r\n         this is an illegal line, bail out */\r\n      freecookie(co);\r\n      return NULL;\r\n    }\r\n\r\n  }\r\n  else {\r\n    /* This line is NOT a HTTP header style line, we do offer support for\r\n       reading the odd netscape cookies-file format here */\r\n    char *ptr;\r\n    char *firstptr;\r\n    char *tok_buf=NULL;\r\n    int fields;\r\n\r\n    /* IE introduced HTTP-only cookies to prevent XSS attacks. Cookies\r\n       marked with httpOnly after the domain name are not accessible\r\n       from javascripts, but since curl does not operate at javascript\r\n       level, we include them anyway. In Firefox's cookie files, these\r\n       lines are preceded with #HttpOnly_ and then everything is\r\n       as usual, so we skip 10 characters of the line..\r\n    */\r\n    if(strncmp(lineptr, \"#HttpOnly_\", 10) == 0) {\r\n      lineptr += 10;\r\n      co->httponly = TRUE;\r\n    }\r\n\r\n    if(lineptr[0]=='#') {\r\n      /* don't even try the comments */\r\n      free(co);\r\n      return NULL;\r\n    }\r\n    /* strip off the possible end-of-line characters */\r\n    ptr=strchr(lineptr, '\\r');\r\n    if(ptr)\r\n      *ptr=0; /* clear it */\r\n    ptr=strchr(lineptr, '\\n');\r\n    if(ptr)\r\n      *ptr=0; /* clear it */\r\n\r\n    firstptr=strtok_r(lineptr, \"\\t\", &tok_buf); /* tokenize it on the TAB */\r\n\r\n    /* Here's a quick check to eliminate normal HTTP-headers from this */\r\n    if(!firstptr || strchr(firstptr, ':')) {\r\n      free(co);\r\n      return NULL;\r\n    }\r\n\r\n    /* Now loop through the fields and init the struct we already have\r\n       allocated */\r\n    for(ptr=firstptr, fields=0; ptr && !badcookie;\r\n        ptr=strtok_r(NULL, \"\\t\", &tok_buf), fields++) {\r\n      switch(fields) {\r\n      case 0:\r\n        if(ptr[0]=='.') /* skip preceding dots */\r\n          ptr++;\r\n        co->domain = strdup(ptr);\r\n        if(!co->domain)\r\n          badcookie = TRUE;\r\n        break;\r\n      case 1:\r\n        /* This field got its explanation on the 23rd of May 2001 by\r\n           Andrs Garc}:\r\n\r\n           flag: A TRUE/FALSE value indicating if all machines within a given\r\n           domain can access the variable. This value is set automatically by\r\n           the browser, depending on the value you set for the domain.\r\n\r\n           As far as I can see, it is set to true when the cookie says\r\n           .domain.com and to false when the domain is complete www.domain.com\r\n        */\r\n        co->tailmatch = Curl_raw_equal(ptr, \"TRUE\")?TRUE:FALSE;\r\n        break;\r\n      case 2:\r\n        /* It turns out, that sometimes the file format allows the path\r\n           field to remain not filled in, we try to detect this and work\r\n           around it! Andrs Garc} made us aware of this... */\r\n        if(strcmp(\"TRUE\", ptr) && strcmp(\"FALSE\", ptr)) {\r\n          /* only if the path doesn't look like a boolean option! */\r\n          co->path = strdup(ptr);\r\n          if(!co->path)\r\n            badcookie = TRUE;\r\n          break;\r\n        }\r\n        /* this doesn't look like a path, make one up! */\r\n        co->path = strdup(\"/\");\r\n        if(!co->path)\r\n          badcookie = TRUE;\r\n        fields++; /* add a field and fall down to secure */\r\n        /* FALLTHROUGH */\r\n      case 3:\r\n        co->secure = Curl_raw_equal(ptr, \"TRUE\")?TRUE:FALSE;\r\n        break;\r\n      case 4:\r\n        co->expires = curlx_strtoofft(ptr, NULL, 10);\r\n        break;\r\n      case 5:\r\n        co->name = strdup(ptr);\r\n        if(!co->name)\r\n          badcookie = TRUE;\r\n        break;\r\n      case 6:\r\n        co->value = strdup(ptr);\r\n        if(!co->value)\r\n          badcookie = TRUE;\r\n        break;\r\n      }\r\n    }\r\n    if(6 == fields) {\r\n      /* we got a cookie with blank contents, fix it */\r\n      co->value = strdup(\"\");\r\n      if(!co->value)\r\n        badcookie = TRUE;\r\n      else\r\n        fields++;\r\n    }\r\n\r\n    if(!badcookie && (7 != fields))\r\n      /* we did not find the sufficient number of fields */\r\n      badcookie = TRUE;\r\n\r\n    if(badcookie) {\r\n      freecookie(co);\r\n      return NULL;\r\n    }\r\n\r\n  }\r\n\r\n  if(!c->running &&    /* read from a file */\r\n     c->newsession &&  /* clean session cookies */\r\n     !co->expires) {   /* this is a session cookie since it doesn't expire! */\r\n    freecookie(co);\r\n    return NULL;\r\n  }\r\n\r\n  co->livecookie = c->running;\r\n\r\n  /* now, we have parsed the incoming line, we must now check if this\r\n     superceeds an already existing cookie, which it may if the previous have\r\n     the same domain and path as this */\r\n\r\n  clist = c->cookies;\r\n  replace_old = FALSE;\r\n  while(clist) {\r\n    if(Curl_raw_equal(clist->name, co->name)) {\r\n      /* the names are identical */\r\n\r\n      if(clist->domain && co->domain) {\r\n        if(Curl_raw_equal(clist->domain, co->domain))\r\n          /* The domains are identical */\r\n          replace_old=TRUE;\r\n      }\r\n      else if(!clist->domain && !co->domain)\r\n        replace_old = TRUE;\r\n\r\n      if(replace_old) {\r\n        /* the domains were identical */\r\n\r\n        if(clist->path && co->path) {\r\n          if(Curl_raw_equal(clist->path, co->path)) {\r\n            replace_old = TRUE;\r\n          }\r\n          else\r\n            replace_old = FALSE;\r\n        }\r\n        else if(!clist->path && !co->path)\r\n          replace_old = TRUE;\r\n        else\r\n          replace_old = FALSE;\r\n\r\n      }\r\n\r\n      if(replace_old && !co->livecookie && clist->livecookie) {\r\n        /* Both cookies matched fine, except that the already present\r\n           cookie is \"live\", which means it was set from a header, while\r\n           the new one isn't \"live\" and thus only read from a file. We let\r\n           live cookies stay alive */\r\n\r\n        /* Free the newcomer and get out of here! */\r\n        freecookie(co);\r\n        return NULL;\r\n      }\r\n\r\n      if(replace_old) {\r\n        co->next = clist->next; /* get the next-pointer first */\r\n\r\n        /* then free all the old pointers */\r\n        free(clist->name);\r\n        if(clist->value)\r\n          free(clist->value);\r\n        if(clist->domain)\r\n          free(clist->domain);\r\n        if(clist->path)\r\n          free(clist->path);\r\n        if(clist->expirestr)\r\n          free(clist->expirestr);\r\n\r\n        if(clist->version)\r\n          free(clist->version);\r\n        if(clist->maxage)\r\n          free(clist->maxage);\r\n\r\n        *clist = *co;  /* then store all the new data */\r\n\r\n        free(co);   /* free the newly alloced memory */\r\n        co = clist; /* point to the previous struct instead */\r\n\r\n        /* We have replaced a cookie, now skip the rest of the list but\r\n           make sure the 'lastc' pointer is properly set */\r\n        do {\r\n          lastc = clist;\r\n          clist = clist->next;\r\n        } while(clist);\r\n        break;\r\n      }\r\n    }\r\n    lastc = clist;\r\n    clist = clist->next;\r\n  }\r\n\r\n  if(c->running)\r\n    /* Only show this when NOT reading the cookies from a file */\r\n    infof(data, \"%s cookie %s=\\\"%s\\\" for domain %s, path %s, \"\r\n          \"expire %\" FORMAT_OFF_T \"\\n\",\r\n          replace_old?\"Replaced\":\"Added\", co->name, co->value,\r\n          co->domain, co->path, co->expires);\r\n\r\n  if(!replace_old) {\r\n    /* then make the last item point on this new one */\r\n    if(lastc)\r\n      lastc->next = co;\r\n    else\r\n      c->cookies = co;\r\n  }\r\n\r\n  c->numcookies++; /* one more cookie in the jar */\r\n  return co;\r\n}\r\n\r\n/*****************************************************************************\r\n *\r\n * Curl_cookie_init()\r\n *\r\n * Inits a cookie struct to read data from a local file. This is always\r\n * called before any cookies are set. File may be NULL.\r\n *\r\n * If 'newsession' is TRUE, discard all \"session cookies\" on read from file.\r\n *\r\n ****************************************************************************/\r\nstruct CookieInfo *Curl_cookie_init(struct SessionHandle *data,\r\n                                    const char *file,\r\n                                    struct CookieInfo *inc,\r\n                                    bool newsession)\r\n{\r\n  struct CookieInfo *c;\r\n  FILE *fp;\r\n  bool fromfile=TRUE;\r\n\r\n  if(NULL == inc) {\r\n    /* we didn't get a struct, create one */\r\n    c = calloc(1, sizeof(struct CookieInfo));\r\n    if(!c)\r\n      return NULL; /* failed to get memory */\r\n    c->filename = strdup(file?file:\"none\"); /* copy the name just in case */\r\n  }\r\n  else {\r\n    /* we got an already existing one, use that */\r\n    c = inc;\r\n  }\r\n  c->running = FALSE; /* this is not running, this is init */\r\n\r\n  if(file && strequal(file, \"-\")) {\r\n    fp = stdin;\r\n    fromfile=FALSE;\r\n  }\r\n  else if(file && !*file) {\r\n    /* points to a \"\" string */\r\n    fp = NULL;\r\n  }\r\n  else\r\n    fp = file?fopen(file, \"r\"):NULL;\r\n\r\n  c->newsession = newsession; /* new session? */\r\n\r\n  if(fp) {\r\n    char *lineptr;\r\n    bool headerline;\r\n\r\n    char *line = malloc(MAX_COOKIE_LINE);\r\n    if(line) {\r\n      while(fgets(line, MAX_COOKIE_LINE, fp)) {\r\n        if(checkprefix(\"Set-Cookie:\", line)) {\r\n          /* This is a cookie line, get it! */\r\n          lineptr=&line[11];\r\n          headerline=TRUE;\r\n        }\r\n        else {\r\n          lineptr=line;\r\n          headerline=FALSE;\r\n        }\r\n        while(*lineptr && ISBLANK(*lineptr))\r\n          lineptr++;\r\n\r\n        Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL);\r\n      }\r\n      free(line); /* free the line buffer */\r\n    }\r\n    if(fromfile)\r\n      fclose(fp);\r\n  }\r\n\r\n  c->running = TRUE;          /* now, we're running */\r\n\r\n  return c;\r\n}\r\n\r\n/* sort this so that the longest path gets before the shorter path */\r\nstatic int cookie_sort(const void *p1, const void *p2)\r\n{\r\n  struct Cookie *c1 = *(struct Cookie **)p1;\r\n  struct Cookie *c2 = *(struct Cookie **)p2;\r\n\r\n  size_t l1 = c1->path?strlen(c1->path):0;\r\n  size_t l2 = c2->path?strlen(c2->path):0;\r\n\r\n  return (l2 > l1) ? 1 : (l2 < l1) ? -1 : 0 ;\r\n}\r\n\r\n/*****************************************************************************\r\n *\r\n * Curl_cookie_getlist()\r\n *\r\n * For a given host and path, return a linked list of cookies that the\r\n * client should send to the server if used now. The secure boolean informs\r\n * the cookie if a secure connection is achieved or not.\r\n *\r\n * It shall only return cookies that haven't expired.\r\n *\r\n ****************************************************************************/\r\n\r\nstruct Cookie *Curl_cookie_getlist(struct CookieInfo *c,\r\n                                   const char *host, const char *path,\r\n                                   bool secure)\r\n{\r\n  struct Cookie *newco;\r\n  struct Cookie *co;\r\n  time_t now = time(NULL);\r\n  struct Cookie *mainco=NULL;\r\n  size_t matches = 0;\r\n\r\n  if(!c || !c->cookies)\r\n    return NULL; /* no cookie struct or no cookies in the struct */\r\n\r\n  co = c->cookies;\r\n\r\n  while(co) {\r\n    /* only process this cookie if it is not expired or had no expire\r\n       date AND that if the cookie requires we're secure we must only\r\n       continue if we are! */\r\n    if((!co->expires || (co->expires > now)) &&\r\n       (co->secure?secure:TRUE)) {\r\n\r\n      /* now check if the domain is correct */\r\n      if(!co->domain ||\r\n         (co->tailmatch && tailmatch(co->domain, host)) ||\r\n         (!co->tailmatch && Curl_raw_equal(host, co->domain)) ) {\r\n        /* the right part of the host matches the domain stuff in the\r\n           cookie data */\r\n\r\n        /* now check the left part of the path with the cookies path\r\n           requirement */\r\n        if(!co->path ||\r\n           /* not using checkprefix() because matching should be\r\n              case-sensitive */\r\n           !strncmp(co->path, path, strlen(co->path)) ) {\r\n\r\n          /* and now, we know this is a match and we should create an\r\n             entry for the return-linked-list */\r\n\r\n          newco = malloc(sizeof(struct Cookie));\r\n          if(newco) {\r\n            /* first, copy the whole source cookie: */\r\n            memcpy(newco, co, sizeof(struct Cookie));\r\n\r\n            /* then modify our next */\r\n            newco->next = mainco;\r\n\r\n            /* point the main to us */\r\n            mainco = newco;\r\n\r\n            matches++;\r\n          }\r\n          else {\r\n            fail:\r\n            /* failure, clear up the allocated chain and return NULL */\r\n            while(mainco) {\r\n              co = mainco->next;\r\n              free(mainco);\r\n              mainco = co;\r\n            }\r\n\r\n            return NULL;\r\n          }\r\n        }\r\n      }\r\n    }\r\n    co = co->next;\r\n  }\r\n\r\n  if(matches) {\r\n    /* Now we need to make sure that if there is a name appearing more than\r\n       once, the longest specified path version comes first. To make this\r\n       the swiftest way, we just sort them all based on path length. */\r\n    struct Cookie **array;\r\n    size_t i;\r\n\r\n    /* alloc an array and store all cookie pointers */\r\n    array = malloc(sizeof(struct Cookie *) * matches);\r\n    if(!array)\r\n      goto fail;\r\n\r\n    co = mainco;\r\n\r\n    for(i=0; co; co = co->next)\r\n      array[i++] = co;\r\n\r\n    /* now sort the cookie pointers in path length order */\r\n    qsort(array, matches, sizeof(struct Cookie *), cookie_sort);\r\n\r\n    /* remake the linked list order according to the new order */\r\n\r\n    mainco = array[0]; /* start here */\r\n    for(i=0; i<matches-1; i++)\r\n      array[i]->next = array[i+1];\r\n    array[matches-1]->next = NULL; /* terminate the list */\r\n\r\n    free(array); /* remove the temporary data again */\r\n  }\r\n\r\n  return mainco; /* return the new list */\r\n}\r\n\r\n/*****************************************************************************\r\n *\r\n * Curl_cookie_clearall()\r\n *\r\n * Clear all existing cookies and reset the counter.\r\n *\r\n ****************************************************************************/\r\nvoid Curl_cookie_clearall(struct CookieInfo *cookies)\r\n{\r\n  if(cookies) {\r\n    Curl_cookie_freelist(cookies->cookies, TRUE);\r\n    cookies->cookies = NULL;\r\n    cookies->numcookies = 0;\r\n  }\r\n}\r\n\r\n/*****************************************************************************\r\n *\r\n * Curl_cookie_freelist()\r\n *\r\n * Free a list of cookies previously returned by Curl_cookie_getlist();\r\n *\r\n * The 'cookiestoo' argument tells this function whether to just free the\r\n * list or actually also free all cookies within the list as well.\r\n *\r\n ****************************************************************************/\r\n\r\nvoid Curl_cookie_freelist(struct Cookie *co, bool cookiestoo)\r\n{\r\n  struct Cookie *next;\r\n  if(co) {\r\n    while(co) {\r\n      next = co->next;\r\n      if(cookiestoo)\r\n        freecookie(co);\r\n      else\r\n        free(co); /* we only free the struct since the \"members\" are all just\r\n                     pointed out in the main cookie list! */\r\n      co = next;\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*****************************************************************************\r\n *\r\n * Curl_cookie_clearsess()\r\n *\r\n * Free all session cookies in the cookies list.\r\n *\r\n ****************************************************************************/\r\nvoid Curl_cookie_clearsess(struct CookieInfo *cookies)\r\n{\r\n  struct Cookie *first, *curr, *next, *prev = NULL;\r\n\r\n  if(!cookies || !cookies->cookies)\r\n    return;\r\n\r\n  first = curr = prev = cookies->cookies;\r\n\r\n  for(; curr; curr = next) {\r\n    next = curr->next;\r\n    if(!curr->expires) {\r\n      if(first == curr)\r\n        first = next;\r\n\r\n      if(prev == curr)\r\n        prev = next;\r\n      else\r\n        prev->next = next;\r\n\r\n      freecookie(curr);\r\n      cookies->numcookies--;\r\n    }\r\n    else\r\n      prev = curr;\r\n  }\r\n\r\n  cookies->cookies = first;\r\n}\r\n\r\n\r\n/*****************************************************************************\r\n *\r\n * Curl_cookie_cleanup()\r\n *\r\n * Free a \"cookie object\" previous created with cookie_init().\r\n *\r\n ****************************************************************************/\r\nvoid Curl_cookie_cleanup(struct CookieInfo *c)\r\n{\r\n  struct Cookie *co;\r\n  struct Cookie *next;\r\n  if(c) {\r\n    if(c->filename)\r\n      free(c->filename);\r\n    co = c->cookies;\r\n\r\n    while(co) {\r\n      next = co->next;\r\n      freecookie(co);\r\n      co = next;\r\n    }\r\n    free(c); /* free the base struct as well */\r\n  }\r\n}\r\n\r\n/* get_netscape_format()\r\n *\r\n * Formats a string for Netscape output file, w/o a newline at the end.\r\n *\r\n * Function returns a char * to a formatted line. Has to be free()d\r\n*/\r\nstatic char *get_netscape_format(const struct Cookie *co)\r\n{\r\n  return aprintf(\r\n    \"%s\"     /* httponly preamble */\r\n    \"%s%s\\t\" /* domain */\r\n    \"%s\\t\"   /* tailmatch */\r\n    \"%s\\t\"   /* path */\r\n    \"%s\\t\"   /* secure */\r\n    \"%\" FORMAT_OFF_T \"\\t\"   /* expires */\r\n    \"%s\\t\"   /* name */\r\n    \"%s\",    /* value */\r\n    co->httponly?\"#HttpOnly_\":\"\",\r\n    /* Make sure all domains are prefixed with a dot if they allow\r\n       tailmatching. This is Mozilla-style. */\r\n    (co->tailmatch && co->domain && co->domain[0] != '.')? \".\":\"\",\r\n    co->domain?co->domain:\"unknown\",\r\n    co->tailmatch?\"TRUE\":\"FALSE\",\r\n    co->path?co->path:\"/\",\r\n    co->secure?\"TRUE\":\"FALSE\",\r\n    co->expires,\r\n    co->name,\r\n    co->value?co->value:\"\");\r\n}\r\n\r\n/*\r\n * cookie_output()\r\n *\r\n * Writes all internally known cookies to the specified file. Specify\r\n * \"-\" as file name to write to stdout.\r\n *\r\n * The function returns non-zero on write failure.\r\n */\r\nstatic int cookie_output(struct CookieInfo *c, const char *dumphere)\r\n{\r\n  struct Cookie *co;\r\n  FILE *out;\r\n  bool use_stdout=FALSE;\r\n\r\n  if((NULL == c) || (0 == c->numcookies))\r\n    /* If there are no known cookies, we don't write or even create any\r\n       destination file */\r\n    return 0;\r\n\r\n  if(strequal(\"-\", dumphere)) {\r\n    /* use stdout */\r\n    out = stdout;\r\n    use_stdout=TRUE;\r\n  }\r\n  else {\r\n    out = fopen(dumphere, \"w\");\r\n    if(!out)\r\n      return 1; /* failure */\r\n  }\r\n\r\n  if(c) {\r\n    char *format_ptr;\r\n\r\n    fputs(\"# Netscape HTTP Cookie File\\n\"\r\n          \"# http://curl.haxx.se/docs/http-cookies.html\\n\"\r\n          \"# This file was generated by libcurl! Edit at your own risk.\\n\\n\",\r\n          out);\r\n    co = c->cookies;\r\n\r\n    while(co) {\r\n      format_ptr = get_netscape_format(co);\r\n      if(format_ptr == NULL) {\r\n        fprintf(out, \"#\\n# Fatal libcurl error\\n\");\r\n        if(!use_stdout)\r\n          fclose(out);\r\n        return 1;\r\n      }\r\n      fprintf(out, \"%s\\n\", format_ptr);\r\n      free(format_ptr);\r\n      co=co->next;\r\n    }\r\n  }\r\n\r\n  if(!use_stdout)\r\n    fclose(out);\r\n\r\n  return 0;\r\n}\r\n\r\nstruct curl_slist *Curl_cookie_list(struct SessionHandle *data)\r\n{\r\n  struct curl_slist *list = NULL;\r\n  struct curl_slist *beg;\r\n  struct Cookie *c;\r\n  char *line;\r\n\r\n  if((data->cookies == NULL) ||\r\n      (data->cookies->numcookies == 0))\r\n    return NULL;\r\n\r\n  c = data->cookies->cookies;\r\n\r\n  while(c) {\r\n    /* fill the list with _all_ the cookies we know */\r\n    line = get_netscape_format(c);\r\n    if(!line) {\r\n      curl_slist_free_all(list);\r\n      return NULL;\r\n    }\r\n    beg = curl_slist_append(list, line);\r\n    free(line);\r\n    if(!beg) {\r\n      curl_slist_free_all(list);\r\n      return NULL;\r\n    }\r\n    list = beg;\r\n    c = c->next;\r\n  }\r\n\r\n  return list;\r\n}\r\n\r\nvoid Curl_flush_cookies(struct SessionHandle *data, int cleanup)\r\n{\r\n  if(data->set.str[STRING_COOKIEJAR]) {\r\n    if(data->change.cookielist) {\r\n      /* If there is a list of cookie files to read, do it first so that\r\n         we have all the told files read before we write the new jar.\r\n         Curl_cookie_loadfiles() LOCKS and UNLOCKS the share itself! */\r\n      Curl_cookie_loadfiles(data);\r\n    }\r\n\r\n    Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n    /* if we have a destination file for all the cookies to get dumped to */\r\n    if(cookie_output(data->cookies, data->set.str[STRING_COOKIEJAR]))\r\n      infof(data, \"WARNING: failed to save cookies in %s\\n\",\r\n            data->set.str[STRING_COOKIEJAR]);\r\n  }\r\n  else {\r\n    if(cleanup && data->change.cookielist) {\r\n      /* since nothing is written, we can just free the list of cookie file\r\n         names */\r\n      curl_slist_free_all(data->change.cookielist); /* clean up list */\r\n      data->change.cookielist = NULL;\r\n    }\r\n    Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);\r\n  }\r\n\r\n  if(cleanup && (!data->share || (data->cookies != data->share->cookies))) {\r\n    Curl_cookie_cleanup(data->cookies);\r\n  }\r\n  Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);\r\n}\r\n\r\n#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_COOKIES */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/cookie.h",
    "content": "#ifndef HEADER_CURL_COOKIE_H\r\n#define HEADER_CURL_COOKIE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\nstruct Cookie {\r\n  struct Cookie *next; /* next in the chain */\r\n  char *name;        /* <this> = value */\r\n  char *value;       /* name = <this> */\r\n  char *path;         /* path = <this> */\r\n  char *domain;      /* domain = <this> */\r\n  curl_off_t expires;  /* expires = <this> */\r\n  char *expirestr;   /* the plain text version */\r\n  bool tailmatch;    /* weather we do tail-matchning of the domain name */\r\n\r\n  /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */\r\n  char *version;     /* Version = <value> */\r\n  char *maxage;      /* Max-Age = <value> */\r\n\r\n  bool secure;       /* whether the 'secure' keyword was used */\r\n  bool livecookie;   /* updated from a server, not a stored file */\r\n  bool httponly;     /* true if the httponly directive is present */\r\n};\r\n\r\nstruct CookieInfo {\r\n  /* linked list of cookies we know of */\r\n  struct Cookie *cookies;\r\n\r\n  char *filename;  /* file we read from/write to */\r\n  bool running;    /* state info, for cookie adding information */\r\n  long numcookies; /* number of cookies in the \"jar\" */\r\n  bool newsession; /* new session, discard session cookies on load */\r\n};\r\n\r\n/* This is the maximum line length we accept for a cookie line. RFC 2109\r\n   section 6.3 says:\r\n\r\n   \"at least 4096 bytes per cookie (as measured by the size of the characters\r\n   that comprise the cookie non-terminal in the syntax description of the\r\n   Set-Cookie header)\"\r\n\r\n*/\r\n#define MAX_COOKIE_LINE 5000\r\n#define MAX_COOKIE_LINE_TXT \"4999\"\r\n\r\n/* This is the maximum length of a cookie name we deal with: */\r\n#define MAX_NAME 1024\r\n#define MAX_NAME_TXT \"1023\"\r\n\r\nstruct SessionHandle;\r\n/*\r\n * Add a cookie to the internal list of cookies. The domain and path arguments\r\n * are only used if the header boolean is TRUE.\r\n */\r\n\r\nstruct Cookie *Curl_cookie_add(struct SessionHandle *data,\r\n                               struct CookieInfo *, bool header, char *lineptr,\r\n                               const char *domain, const char *path);\r\n\r\nstruct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *,\r\n                                   const char *, bool);\r\nvoid Curl_cookie_freelist(struct Cookie *cookies, bool cookiestoo);\r\nvoid Curl_cookie_clearall(struct CookieInfo *cookies);\r\nvoid Curl_cookie_clearsess(struct CookieInfo *cookies);\r\n\r\n#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)\r\n#define Curl_cookie_list(x) NULL\r\n#define Curl_cookie_loadfiles(x) Curl_nop_stmt\r\n#define Curl_cookie_init(x,y,z,w) NULL\r\n#define Curl_cookie_cleanup(x) Curl_nop_stmt\r\n#define Curl_flush_cookies(x,y) Curl_nop_stmt\r\n#else\r\nvoid Curl_flush_cookies(struct SessionHandle *data, int cleanup);\r\nvoid Curl_cookie_cleanup(struct CookieInfo *);\r\nstruct CookieInfo *Curl_cookie_init(struct SessionHandle *data,\r\n                                    const char *, struct CookieInfo *, bool);\r\nstruct curl_slist *Curl_cookie_list(struct SessionHandle *data);\r\nvoid Curl_cookie_loadfiles(struct SessionHandle *data);\r\n#endif\r\n\r\n#endif /* HEADER_CURL_COOKIE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_addrinfo.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#  include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#  include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#  include <arpa/inet.h>\r\n#endif\r\n\r\n#ifdef __VMS\r\n#  include <in.h>\r\n#  include <inet.h>\r\n#endif\r\n\r\n#if defined(NETWARE) && defined(__NOVELL_LIBC__)\r\n#  undef  in_addr_t\r\n#  define in_addr_t unsigned long\r\n#endif\r\n\r\n#include \"curl_addrinfo.h\"\r\n#include \"inet_pton.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n\r\n/*\r\n * Curl_freeaddrinfo()\r\n *\r\n * This is used to free a linked list of Curl_addrinfo structs along\r\n * with all its associated allocated storage. This function should be\r\n * called once for each successful call to Curl_getaddrinfo_ex() or to\r\n * any function call which actually allocates a Curl_addrinfo struct.\r\n */\r\n\r\n#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \\\r\n    defined(__OPTIMIZE__) && defined(__unix__) &&  defined(__i386__)\r\n  /* workaround icc 9.1 optimizer issue */\r\n# define vqualifier volatile\r\n#else\r\n# define vqualifier\r\n#endif\r\n\r\nvoid\r\nCurl_freeaddrinfo(Curl_addrinfo *cahead)\r\n{\r\n  Curl_addrinfo *vqualifier canext;\r\n  Curl_addrinfo *ca;\r\n\r\n  for(ca = cahead; ca != NULL; ca = canext) {\r\n\r\n    if(ca->ai_addr)\r\n      free(ca->ai_addr);\r\n\r\n    if(ca->ai_canonname)\r\n      free(ca->ai_canonname);\r\n\r\n    canext = ca->ai_next;\r\n\r\n    free(ca);\r\n  }\r\n}\r\n\r\n\r\n#ifdef HAVE_GETADDRINFO\r\n/*\r\n * Curl_getaddrinfo_ex()\r\n *\r\n * This is a wrapper function around system's getaddrinfo(), with\r\n * the only difference that instead of returning a linked list of\r\n * addrinfo structs this one returns a linked list of Curl_addrinfo\r\n * ones. The memory allocated by this function *MUST* be free'd with\r\n * Curl_freeaddrinfo().  For each successful call to this function\r\n * there must be an associated call later to Curl_freeaddrinfo().\r\n *\r\n * There should be no single call to system's getaddrinfo() in the\r\n * whole library, any such call should be 'routed' through this one.\r\n */\r\n\r\nint\r\nCurl_getaddrinfo_ex(const char *nodename,\r\n                    const char *servname,\r\n                    const struct addrinfo *hints,\r\n                    Curl_addrinfo **result)\r\n{\r\n  const struct addrinfo *ai;\r\n  struct addrinfo *aihead;\r\n  Curl_addrinfo *cafirst = NULL;\r\n  Curl_addrinfo *calast = NULL;\r\n  Curl_addrinfo *ca;\r\n  size_t ss_size;\r\n  int error;\r\n\r\n  *result = NULL; /* assume failure */\r\n\r\n  error = getaddrinfo(nodename, servname, hints, &aihead);\r\n  if(error)\r\n    return error;\r\n\r\n  /* traverse the addrinfo list */\r\n\r\n  for(ai = aihead; ai != NULL; ai = ai->ai_next) {\r\n\r\n    /* ignore elements with unsupported address family, */\r\n    /* settle family-specific sockaddr structure size.  */\r\n    if(ai->ai_family == AF_INET)\r\n      ss_size = sizeof(struct sockaddr_in);\r\n#ifdef ENABLE_IPV6\r\n    else if(ai->ai_family == AF_INET6)\r\n      ss_size = sizeof(struct sockaddr_in6);\r\n#endif\r\n    else\r\n      continue;\r\n\r\n    /* ignore elements without required address info */\r\n    if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0))\r\n      continue;\r\n\r\n    /* ignore elements with bogus address size */\r\n    if((size_t)ai->ai_addrlen < ss_size)\r\n      continue;\r\n\r\n    if((ca = malloc(sizeof(Curl_addrinfo))) == NULL) {\r\n      error = EAI_MEMORY;\r\n      break;\r\n    }\r\n\r\n    /* copy each structure member individually, member ordering, */\r\n    /* size, or padding might be different for each platform.    */\r\n\r\n    ca->ai_flags     = ai->ai_flags;\r\n    ca->ai_family    = ai->ai_family;\r\n    ca->ai_socktype  = ai->ai_socktype;\r\n    ca->ai_protocol  = ai->ai_protocol;\r\n    ca->ai_addrlen   = (curl_socklen_t)ss_size;\r\n    ca->ai_addr      = NULL;\r\n    ca->ai_canonname = NULL;\r\n    ca->ai_next      = NULL;\r\n\r\n    if((ca->ai_addr = malloc(ss_size)) == NULL) {\r\n      error = EAI_MEMORY;\r\n      free(ca);\r\n      break;\r\n    }\r\n    memcpy(ca->ai_addr, ai->ai_addr, ss_size);\r\n\r\n    if(ai->ai_canonname != NULL) {\r\n      if((ca->ai_canonname = strdup(ai->ai_canonname)) == NULL) {\r\n        error = EAI_MEMORY;\r\n        free(ca->ai_addr);\r\n        free(ca);\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* if the return list is empty, this becomes the first element */\r\n    if(!cafirst)\r\n      cafirst = ca;\r\n\r\n    /* add this element last in the return list */\r\n    if(calast)\r\n      calast->ai_next = ca;\r\n    calast = ca;\r\n\r\n  }\r\n\r\n  /* destroy the addrinfo list */\r\n  if(aihead)\r\n    freeaddrinfo(aihead);\r\n\r\n  /* if we failed, also destroy the Curl_addrinfo list */\r\n  if(error) {\r\n    Curl_freeaddrinfo(cafirst);\r\n    cafirst = NULL;\r\n  }\r\n  else if(!cafirst) {\r\n#ifdef EAI_NONAME\r\n    /* rfc3493 conformant */\r\n    error = EAI_NONAME;\r\n#else\r\n    /* rfc3493 obsoleted */\r\n    error = EAI_NODATA;\r\n#endif\r\n#ifdef USE_WINSOCK\r\n    SET_SOCKERRNO(error);\r\n#endif\r\n  }\r\n\r\n  *result = cafirst;\r\n\r\n  /* This is not a CURLcode */\r\n  return error;\r\n}\r\n#endif /* HAVE_GETADDRINFO */\r\n\r\n\r\n/*\r\n * Curl_he2ai()\r\n *\r\n * This function returns a pointer to the first element of a newly allocated\r\n * Curl_addrinfo struct linked list filled with the data of a given hostent.\r\n * Curl_addrinfo is meant to work like the addrinfo struct does for a IPv6\r\n * stack, but usable also for IPv4, all hosts and environments.\r\n *\r\n * The memory allocated by this function *MUST* be free'd later on calling\r\n * Curl_freeaddrinfo().  For each successful call to this function there\r\n * must be an associated call later to Curl_freeaddrinfo().\r\n *\r\n *   Curl_addrinfo defined in \"lib/curl_addrinfo.h\"\r\n *\r\n *     struct Curl_addrinfo {\r\n *       int                   ai_flags;\r\n *       int                   ai_family;\r\n *       int                   ai_socktype;\r\n *       int                   ai_protocol;\r\n *       curl_socklen_t        ai_addrlen;   * Follow rfc3493 struct addrinfo *\r\n *       char                 *ai_canonname;\r\n *       struct sockaddr      *ai_addr;\r\n *       struct Curl_addrinfo *ai_next;\r\n *     };\r\n *     typedef struct Curl_addrinfo Curl_addrinfo;\r\n *\r\n *   hostent defined in <netdb.h>\r\n *\r\n *     struct hostent {\r\n *       char    *h_name;\r\n *       char    **h_aliases;\r\n *       int     h_addrtype;\r\n *       int     h_length;\r\n *       char    **h_addr_list;\r\n *     };\r\n *\r\n *   for backward compatibility:\r\n *\r\n *     #define h_addr  h_addr_list[0]\r\n */\r\n\r\nCurl_addrinfo *\r\nCurl_he2ai(const struct hostent *he, int port)\r\n{\r\n  Curl_addrinfo *ai;\r\n  Curl_addrinfo *prevai = NULL;\r\n  Curl_addrinfo *firstai = NULL;\r\n  struct sockaddr_in *addr;\r\n#ifdef ENABLE_IPV6\r\n  struct sockaddr_in6 *addr6;\r\n#endif\r\n  CURLcode result = CURLE_OK;\r\n  int i;\r\n  char *curr;\r\n\r\n  if(!he)\r\n    /* no input == no output! */\r\n    return NULL;\r\n\r\n  DEBUGASSERT((he->h_name != NULL) && (he->h_addr_list != NULL));\r\n\r\n  for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) {\r\n\r\n    size_t ss_size;\r\n#ifdef ENABLE_IPV6\r\n    if(he->h_addrtype == AF_INET6)\r\n      ss_size = sizeof (struct sockaddr_in6);\r\n    else\r\n#endif\r\n      ss_size = sizeof (struct sockaddr_in);\r\n\r\n    if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) {\r\n      result = CURLE_OUT_OF_MEMORY;\r\n      break;\r\n    }\r\n    if((ai->ai_canonname = strdup(he->h_name)) == NULL) {\r\n      result = CURLE_OUT_OF_MEMORY;\r\n      free(ai);\r\n      break;\r\n    }\r\n    if((ai->ai_addr = calloc(1, ss_size)) == NULL) {\r\n      result = CURLE_OUT_OF_MEMORY;\r\n      free(ai->ai_canonname);\r\n      free(ai);\r\n      break;\r\n    }\r\n\r\n    if(!firstai)\r\n      /* store the pointer we want to return from this function */\r\n      firstai = ai;\r\n\r\n    if(prevai)\r\n      /* make the previous entry point to this */\r\n      prevai->ai_next = ai;\r\n\r\n    ai->ai_family = he->h_addrtype;\r\n\r\n    /* we return all names as STREAM, so when using this address for TFTP\r\n       the type must be ignored and conn->socktype be used instead! */\r\n    ai->ai_socktype = SOCK_STREAM;\r\n\r\n    ai->ai_addrlen = (curl_socklen_t)ss_size;\r\n\r\n    /* leave the rest of the struct filled with zero */\r\n\r\n    switch (ai->ai_family) {\r\n    case AF_INET:\r\n      addr = (void *)ai->ai_addr; /* storage area for this info */\r\n\r\n      memcpy(&addr->sin_addr, curr, sizeof(struct in_addr));\r\n      addr->sin_family = (unsigned short)(he->h_addrtype);\r\n      addr->sin_port = htons((unsigned short)port);\r\n      break;\r\n\r\n#ifdef ENABLE_IPV6\r\n    case AF_INET6:\r\n      addr6 = (void *)ai->ai_addr; /* storage area for this info */\r\n\r\n      memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr));\r\n      addr6->sin6_family = (unsigned short)(he->h_addrtype);\r\n      addr6->sin6_port = htons((unsigned short)port);\r\n      break;\r\n#endif\r\n    }\r\n\r\n    prevai = ai;\r\n  }\r\n\r\n  if(result != CURLE_OK) {\r\n    Curl_freeaddrinfo(firstai);\r\n    firstai = NULL;\r\n  }\r\n\r\n  return firstai;\r\n}\r\n\r\n\r\nstruct namebuff {\r\n  struct hostent hostentry;\r\n  union {\r\n    struct in_addr  ina4;\r\n#ifdef ENABLE_IPV6\r\n    struct in6_addr ina6;\r\n#endif\r\n  } addrentry;\r\n  char *h_addr_list[2];\r\n};\r\n\r\n\r\n/*\r\n * Curl_ip2addr()\r\n *\r\n * This function takes an internet address, in binary form, as input parameter\r\n * along with its address family and the string version of the address, and it\r\n * returns a Curl_addrinfo chain filled in correctly with information for the\r\n * given address/host\r\n */\r\n\r\nCurl_addrinfo *\r\nCurl_ip2addr(int af, const void *inaddr, const char *hostname, int port)\r\n{\r\n  Curl_addrinfo *ai;\r\n\r\n#if defined(__VMS) && \\\r\n    defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)\r\n#pragma pointer_size save\r\n#pragma pointer_size short\r\n#pragma message disable PTRMISMATCH\r\n#endif\r\n\r\n  struct hostent  *h;\r\n  struct namebuff *buf;\r\n  char  *addrentry;\r\n  char  *hoststr;\r\n  size_t addrsize;\r\n\r\n  DEBUGASSERT(inaddr && hostname);\r\n\r\n  buf = malloc(sizeof(struct namebuff));\r\n  if(!buf)\r\n    return NULL;\r\n\r\n  hoststr = strdup(hostname);\r\n  if(!hoststr) {\r\n    free(buf);\r\n    return NULL;\r\n  }\r\n\r\n  switch(af) {\r\n  case AF_INET:\r\n    addrsize = sizeof(struct in_addr);\r\n    addrentry = (void *)&buf->addrentry.ina4;\r\n    memcpy(addrentry, inaddr, sizeof(struct in_addr));\r\n    break;\r\n#ifdef ENABLE_IPV6\r\n  case AF_INET6:\r\n    addrsize = sizeof(struct in6_addr);\r\n    addrentry = (void *)&buf->addrentry.ina6;\r\n    memcpy(addrentry, inaddr, sizeof(struct in6_addr));\r\n    break;\r\n#endif\r\n  default:\r\n    free(hoststr);\r\n    free(buf);\r\n    return NULL;\r\n  }\r\n\r\n  h = &buf->hostentry;\r\n  h->h_name = hoststr;\r\n  h->h_aliases = NULL;\r\n  h->h_addrtype = (short)af;\r\n  h->h_length = (short)addrsize;\r\n  h->h_addr_list = &buf->h_addr_list[0];\r\n  h->h_addr_list[0] = addrentry;\r\n  h->h_addr_list[1] = NULL; /* terminate list of entries */\r\n\r\n#if defined(__VMS) && \\\r\n    defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)\r\n#pragma pointer_size restore\r\n#pragma message enable PTRMISMATCH\r\n#endif\r\n\r\n  ai = Curl_he2ai(h, port);\r\n\r\n  free(hoststr);\r\n  free(buf);\r\n\r\n  return ai;\r\n}\r\n\r\n/*\r\n * Given an IPv4 or IPv6 dotted string address, this converts it to a proper\r\n * allocated Curl_addrinfo struct and returns it.\r\n */\r\nCurl_addrinfo *Curl_str2addr(char *address, int port)\r\n{\r\n  struct in_addr in;\r\n  if(Curl_inet_pton(AF_INET, address, &in) > 0)\r\n    /* This is a dotted IP address 123.123.123.123-style */\r\n    return Curl_ip2addr(AF_INET, &in, address, port);\r\n#ifdef ENABLE_IPV6\r\n  else {\r\n    struct in6_addr in6;\r\n    if(Curl_inet_pton(AF_INET6, address, &in6) > 0)\r\n      /* This is a dotted IPv6 address ::1-style */\r\n      return Curl_ip2addr(AF_INET6, &in6, address, port);\r\n  }\r\n#endif\r\n  return NULL; /* bad input format */\r\n}\r\n\r\n#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO)\r\n/*\r\n * curl_dofreeaddrinfo()\r\n *\r\n * This is strictly for memory tracing and are using the same style as the\r\n * family otherwise present in memdebug.c. I put these ones here since they\r\n * require a bunch of structs I didn't want to include in memdebug.c\r\n */\r\n\r\nvoid\r\ncurl_dofreeaddrinfo(struct addrinfo *freethis,\r\n                    int line, const char *source)\r\n{\r\n  (freeaddrinfo)(freethis);\r\n  curl_memlog(\"ADDR %s:%d freeaddrinfo(%p)\\n\",\r\n              source, line, (void *)freethis);\r\n}\r\n#endif /* defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) */\r\n\r\n\r\n#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)\r\n/*\r\n * curl_dogetaddrinfo()\r\n *\r\n * This is strictly for memory tracing and are using the same style as the\r\n * family otherwise present in memdebug.c. I put these ones here since they\r\n * require a bunch of structs I didn't want to include in memdebug.c\r\n */\r\n\r\nint\r\ncurl_dogetaddrinfo(const char *hostname,\r\n                   const char *service,\r\n                   const struct addrinfo *hints,\r\n                   struct addrinfo **result,\r\n                   int line, const char *source)\r\n{\r\n  int res=(getaddrinfo)(hostname, service, hints, result);\r\n  if(0 == res)\r\n    /* success */\r\n    curl_memlog(\"ADDR %s:%d getaddrinfo() = %p\\n\",\r\n                source, line, (void *)*result);\r\n  else\r\n    curl_memlog(\"ADDR %s:%d getaddrinfo() failed\\n\",\r\n                source, line);\r\n  return res;\r\n}\r\n#endif /* defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_addrinfo.h",
    "content": "#ifndef HEADER_CURL_ADDRINFO_H\r\n#define HEADER_CURL_ADDRINFO_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#  include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#  include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#  include <arpa/inet.h>\r\n#endif\r\n\r\n#ifdef __VMS\r\n#  include <in.h>\r\n#  include <inet.h>\r\n#  include <stdlib.h>\r\n#endif\r\n\r\n\r\n/*\r\n * Curl_addrinfo is our internal struct definition that we use to allow\r\n * consistent internal handling of this data. We use this even when the\r\n * system provides an addrinfo structure definition. And we use this for\r\n * all sorts of IPv4 and IPV6 builds.\r\n */\r\n\r\nstruct Curl_addrinfo {\r\n  int                   ai_flags;\r\n  int                   ai_family;\r\n  int                   ai_socktype;\r\n  int                   ai_protocol;\r\n  curl_socklen_t        ai_addrlen;   /* Follow rfc3493 struct addrinfo */\r\n  char                 *ai_canonname;\r\n  struct sockaddr      *ai_addr;\r\n  struct Curl_addrinfo *ai_next;\r\n};\r\ntypedef struct Curl_addrinfo Curl_addrinfo;\r\n\r\nvoid\r\nCurl_freeaddrinfo(Curl_addrinfo *cahead);\r\n\r\n#ifdef HAVE_GETADDRINFO\r\nint\r\nCurl_getaddrinfo_ex(const char *nodename,\r\n                    const char *servname,\r\n                    const struct addrinfo *hints,\r\n                    Curl_addrinfo **result);\r\n#endif\r\n\r\nCurl_addrinfo *\r\nCurl_he2ai(const struct hostent *he, int port);\r\n\r\nCurl_addrinfo *\r\nCurl_ip2addr(int af, const void *inaddr, const char *hostname, int port);\r\n\r\nCurl_addrinfo *Curl_str2addr(char *dotted, int port);\r\n\r\n#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO)\r\nvoid\r\ncurl_dofreeaddrinfo(struct addrinfo *freethis,\r\n                    int line, const char *source);\r\n#endif\r\n\r\n#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)\r\nint\r\ncurl_dogetaddrinfo(const char *hostname,\r\n                   const char *service,\r\n                   const struct addrinfo *hints,\r\n                   struct addrinfo **result,\r\n                   int line, const char *source);\r\n#endif\r\n\r\n#endif /* HEADER_CURL_ADDRINFO_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_base64.h",
    "content": "#ifndef HEADER_CURL_BASE64_H\r\n#define HEADER_CURL_BASE64_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nCURLcode Curl_base64_encode(struct SessionHandle *data,\r\n                            const char *inputbuff, size_t insize,\r\n                            char **outptr, size_t *outlen);\r\n\r\nCURLcode Curl_base64_decode(const char *src,\r\n                            unsigned char **outptr, size_t *outlen);\r\n\r\n#endif /* HEADER_CURL_BASE64_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_config.h.in",
    "content": "/* lib/curl_config.h.in.  Generated from configure.ac by autoheader.  */\r\n\r\n/* Location of default ca bundle */\r\n#undef CURL_CA_BUNDLE\r\n\r\n/* Location of default ca path */\r\n#undef CURL_CA_PATH\r\n\r\n/* to disable cookies support */\r\n#undef CURL_DISABLE_COOKIES\r\n\r\n/* to disable cryptographic authentication */\r\n#undef CURL_DISABLE_CRYPTO_AUTH\r\n\r\n/* to disable DICT */\r\n#undef CURL_DISABLE_DICT\r\n\r\n/* to disable FILE */\r\n#undef CURL_DISABLE_FILE\r\n\r\n/* to disable FTP */\r\n#undef CURL_DISABLE_FTP\r\n\r\n/* to disable Gopher */\r\n#undef CURL_DISABLE_GOPHER\r\n\r\n/* to disable HTTP */\r\n#undef CURL_DISABLE_HTTP\r\n\r\n/* to disable IMAP */\r\n#undef CURL_DISABLE_IMAP\r\n\r\n/* to disable LDAP */\r\n#undef CURL_DISABLE_LDAP\r\n\r\n/* to disable LDAPS */\r\n#undef CURL_DISABLE_LDAPS\r\n\r\n/* to disable --libcurl C code generation option */\r\n#undef CURL_DISABLE_LIBCURL_OPTION\r\n\r\n/* to disable POP3 */\r\n#undef CURL_DISABLE_POP3\r\n\r\n/* to disable proxies */\r\n#undef CURL_DISABLE_PROXY\r\n\r\n/* to disable RTSP */\r\n#undef CURL_DISABLE_RTSP\r\n\r\n/* to disable SMTP */\r\n#undef CURL_DISABLE_SMTP\r\n\r\n/* to disable TELNET */\r\n#undef CURL_DISABLE_TELNET\r\n\r\n/* to disable TFTP */\r\n#undef CURL_DISABLE_TFTP\r\n\r\n/* to disable TLS-SRP authentication */\r\n#undef CURL_DISABLE_TLS_SRP\r\n\r\n/* to disable verbose strings */\r\n#undef CURL_DISABLE_VERBOSE_STRINGS\r\n\r\n/* Definition to make a library symbol externally visible. */\r\n#undef CURL_EXTERN_SYMBOL\r\n\r\n/* Use Windows LDAP implementation */\r\n#undef CURL_LDAP_WIN\r\n\r\n/* your Entropy Gathering Daemon socket pathname */\r\n#undef EGD_SOCKET\r\n\r\n/* Define if you want to enable IPv6 support */\r\n#undef ENABLE_IPV6\r\n\r\n/* Define to the type of arg 2 for gethostname. */\r\n#undef GETHOSTNAME_TYPE_ARG2\r\n\r\n/* Define to the type qualifier of arg 1 for getnameinfo. */\r\n#undef GETNAMEINFO_QUAL_ARG1\r\n\r\n/* Define to the type of arg 1 for getnameinfo. */\r\n#undef GETNAMEINFO_TYPE_ARG1\r\n\r\n/* Define to the type of arg 2 for getnameinfo. */\r\n#undef GETNAMEINFO_TYPE_ARG2\r\n\r\n/* Define to the type of args 4 and 6 for getnameinfo. */\r\n#undef GETNAMEINFO_TYPE_ARG46\r\n\r\n/* Define to the type of arg 7 for getnameinfo. */\r\n#undef GETNAMEINFO_TYPE_ARG7\r\n\r\n/* Specifies the number of arguments to getservbyport_r */\r\n#undef GETSERVBYPORT_R_ARGS\r\n\r\n/* Specifies the size of the buffer to pass to getservbyport_r */\r\n#undef GETSERVBYPORT_R_BUFSIZE\r\n\r\n/* Define to 1 if you have the alarm function. */\r\n#undef HAVE_ALARM\r\n\r\n/* Define to 1 if you have the <alloca.h> header file. */\r\n#undef HAVE_ALLOCA_H\r\n\r\n/* Define to 1 if you have the <arpa/inet.h> header file. */\r\n#undef HAVE_ARPA_INET_H\r\n\r\n/* Define to 1 if you have the <arpa/tftp.h> header file. */\r\n#undef HAVE_ARPA_TFTP_H\r\n\r\n/* Define to 1 if you have the <assert.h> header file. */\r\n#undef HAVE_ASSERT_H\r\n\r\n/* Define to 1 if you have the basename function. */\r\n#undef HAVE_BASENAME\r\n\r\n/* Define to 1 if bool is an available type. */\r\n#undef HAVE_BOOL_T\r\n\r\n/* Define to 1 if you have the clock_gettime function and monotonic timer. */\r\n#undef HAVE_CLOCK_GETTIME_MONOTONIC\r\n\r\n/* Define to 1 if you have the closesocket function. */\r\n#undef HAVE_CLOSESOCKET\r\n\r\n/* Define to 1 if you have the CloseSocket camel case function. */\r\n#undef HAVE_CLOSESOCKET_CAMEL\r\n\r\n/* Define to 1 if you have the connect function. */\r\n#undef HAVE_CONNECT\r\n\r\n/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */\r\n#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA\r\n\r\n/* Define to 1 if you have the <crypto.h> header file. */\r\n#undef HAVE_CRYPTO_H\r\n\r\n/* Define to 1 if you have the <des.h> header file. */\r\n#undef HAVE_DES_H\r\n\r\n/* Define to 1 if you have the <dlfcn.h> header file. */\r\n#undef HAVE_DLFCN_H\r\n\r\n/* Define to 1 if you have the `ENGINE_cleanup' function. */\r\n#undef HAVE_ENGINE_CLEANUP\r\n\r\n/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */\r\n#undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES\r\n\r\n/* Define to 1 if you have the <errno.h> header file. */\r\n#undef HAVE_ERRNO_H\r\n\r\n/* Define to 1 if you have the <err.h> header file. */\r\n#undef HAVE_ERR_H\r\n\r\n/* Define to 1 if you have the fcntl function. */\r\n#undef HAVE_FCNTL\r\n\r\n/* Define to 1 if you have the <fcntl.h> header file. */\r\n#undef HAVE_FCNTL_H\r\n\r\n/* Define to 1 if you have a working fcntl O_NONBLOCK function. */\r\n#undef HAVE_FCNTL_O_NONBLOCK\r\n\r\n/* Define to 1 if you have the fdopen function. */\r\n#undef HAVE_FDOPEN\r\n\r\n/* Define to 1 if you have the `fork' function. */\r\n#undef HAVE_FORK\r\n\r\n/* Define to 1 if you have the freeaddrinfo function. */\r\n#undef HAVE_FREEADDRINFO\r\n\r\n/* Define to 1 if you have the freeifaddrs function. */\r\n#undef HAVE_FREEIFADDRS\r\n\r\n/* Define to 1 if you have the fsetxattr function. */\r\n#undef HAVE_FSETXATTR\r\n\r\n/* fsetxattr() takes 5 args */\r\n#undef HAVE_FSETXATTR_5\r\n\r\n/* fsetxattr() takes 6 args */\r\n#undef HAVE_FSETXATTR_6\r\n\r\n/* Define to 1 if you have the ftruncate function. */\r\n#undef HAVE_FTRUNCATE\r\n\r\n/* Define to 1 if you have the gai_strerror function. */\r\n#undef HAVE_GAI_STRERROR\r\n\r\n/* Define to 1 if you have a working getaddrinfo function. */\r\n#undef HAVE_GETADDRINFO\r\n\r\n/* Define to 1 if the getaddrinfo function is threadsafe. */\r\n#undef HAVE_GETADDRINFO_THREADSAFE\r\n\r\n/* Define to 1 if you have the `geteuid' function. */\r\n#undef HAVE_GETEUID\r\n\r\n/* Define to 1 if you have the gethostbyaddr function. */\r\n#undef HAVE_GETHOSTBYADDR\r\n\r\n/* Define to 1 if you have the gethostbyaddr_r function. */\r\n#undef HAVE_GETHOSTBYADDR_R\r\n\r\n/* gethostbyaddr_r() takes 5 args */\r\n#undef HAVE_GETHOSTBYADDR_R_5\r\n\r\n/* gethostbyaddr_r() takes 7 args */\r\n#undef HAVE_GETHOSTBYADDR_R_7\r\n\r\n/* gethostbyaddr_r() takes 8 args */\r\n#undef HAVE_GETHOSTBYADDR_R_8\r\n\r\n/* Define to 1 if you have the gethostbyname function. */\r\n#undef HAVE_GETHOSTBYNAME\r\n\r\n/* Define to 1 if you have the gethostbyname_r function. */\r\n#undef HAVE_GETHOSTBYNAME_R\r\n\r\n/* gethostbyname_r() takes 3 args */\r\n#undef HAVE_GETHOSTBYNAME_R_3\r\n\r\n/* gethostbyname_r() takes 5 args */\r\n#undef HAVE_GETHOSTBYNAME_R_5\r\n\r\n/* gethostbyname_r() takes 6 args */\r\n#undef HAVE_GETHOSTBYNAME_R_6\r\n\r\n/* Define to 1 if you have the gethostname function. */\r\n#undef HAVE_GETHOSTNAME\r\n\r\n/* Define to 1 if you have a working getifaddrs function. */\r\n#undef HAVE_GETIFADDRS\r\n\r\n/* Define to 1 if you have the getnameinfo function. */\r\n#undef HAVE_GETNAMEINFO\r\n\r\n/* Define to 1 if you have the `getpass_r' function. */\r\n#undef HAVE_GETPASS_R\r\n\r\n/* Define to 1 if you have the `getppid' function. */\r\n#undef HAVE_GETPPID\r\n\r\n/* Define to 1 if you have the `getprotobyname' function. */\r\n#undef HAVE_GETPROTOBYNAME\r\n\r\n/* Define to 1 if you have the `getpwuid' function. */\r\n#undef HAVE_GETPWUID\r\n\r\n/* Define to 1 if you have the `getrlimit' function. */\r\n#undef HAVE_GETRLIMIT\r\n\r\n/* Define to 1 if you have the getservbyport_r function. */\r\n#undef HAVE_GETSERVBYPORT_R\r\n\r\n/* Define to 1 if you have the `gettimeofday' function. */\r\n#undef HAVE_GETTIMEOFDAY\r\n\r\n/* Define to 1 if you have a working glibc-style strerror_r function. */\r\n#undef HAVE_GLIBC_STRERROR_R\r\n\r\n/* Define to 1 if you have a working gmtime_r function. */\r\n#undef HAVE_GMTIME_R\r\n\r\n/* if you have the function gnutls_srp_verifier */\r\n#undef HAVE_GNUTLS_SRP\r\n\r\n/* if you have the gssapi libraries */\r\n#undef HAVE_GSSAPI\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */\r\n#undef HAVE_GSSAPI_GSSAPI_GENERIC_H\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi.h> header file. */\r\n#undef HAVE_GSSAPI_GSSAPI_H\r\n\r\n/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */\r\n#undef HAVE_GSSAPI_GSSAPI_KRB5_H\r\n\r\n/* if you have the GNU gssapi libraries */\r\n#undef HAVE_GSSGNU\r\n\r\n/* if you have the Heimdal gssapi libraries */\r\n#undef HAVE_GSSHEIMDAL\r\n\r\n/* if you have the MIT gssapi libraries */\r\n#undef HAVE_GSSMIT\r\n\r\n/* Define to 1 if you have the `idna_strerror' function. */\r\n#undef HAVE_IDNA_STRERROR\r\n\r\n/* Define to 1 if you have the `idn_free' function. */\r\n#undef HAVE_IDN_FREE\r\n\r\n/* Define to 1 if you have the <idn-free.h> header file. */\r\n#undef HAVE_IDN_FREE_H\r\n\r\n/* Define to 1 if you have the <ifaddrs.h> header file. */\r\n#undef HAVE_IFADDRS_H\r\n\r\n/* Define to 1 if you have the `inet_addr' function. */\r\n#undef HAVE_INET_ADDR\r\n\r\n/* Define to 1 if you have the inet_ntoa_r function. */\r\n#undef HAVE_INET_NTOA_R\r\n\r\n/* inet_ntoa_r() takes 2 args */\r\n#undef HAVE_INET_NTOA_R_2\r\n\r\n/* inet_ntoa_r() takes 3 args */\r\n#undef HAVE_INET_NTOA_R_3\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_ntop function. */\r\n#undef HAVE_INET_NTOP\r\n\r\n/* Define to 1 if you have a IPv6 capable working inet_pton function. */\r\n#undef HAVE_INET_PTON\r\n\r\n/* Define to 1 if you have the <inttypes.h> header file. */\r\n#undef HAVE_INTTYPES_H\r\n\r\n/* Define to 1 if you have the ioctl function. */\r\n#undef HAVE_IOCTL\r\n\r\n/* Define to 1 if you have the ioctlsocket function. */\r\n#undef HAVE_IOCTLSOCKET\r\n\r\n/* Define to 1 if you have the IoctlSocket camel case function. */\r\n#undef HAVE_IOCTLSOCKET_CAMEL\r\n\r\n/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.\r\n   */\r\n#undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO\r\n\r\n/* Define to 1 if you have a working ioctlsocket FIONBIO function. */\r\n#undef HAVE_IOCTLSOCKET_FIONBIO\r\n\r\n/* Define to 1 if you have a working ioctl FIONBIO function. */\r\n#undef HAVE_IOCTL_FIONBIO\r\n\r\n/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */\r\n#undef HAVE_IOCTL_SIOCGIFADDR\r\n\r\n/* Define to 1 if you have the <io.h> header file. */\r\n#undef HAVE_IO_H\r\n\r\n/* if you have the Kerberos4 libraries (including -ldes) */\r\n#undef HAVE_KRB4\r\n\r\n/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */\r\n#undef HAVE_KRB_GET_OUR_IP_FOR_REALM\r\n\r\n/* Define to 1 if you have the <krb.h> header file. */\r\n#undef HAVE_KRB_H\r\n\r\n/* Define to 1 if you have the lber.h header file. */\r\n#undef HAVE_LBER_H\r\n\r\n/* Define to 1 if you have the ldapssl.h header file. */\r\n#undef HAVE_LDAPSSL_H\r\n\r\n/* Define to 1 if you have the ldap.h header file. */\r\n#undef HAVE_LDAP_H\r\n\r\n/* Define to 1 if you have the `ldap_init_fd' function. */\r\n#undef HAVE_LDAP_INIT_FD\r\n\r\n/* Use LDAPS implementation */\r\n#undef HAVE_LDAP_SSL\r\n\r\n/* Define to 1 if you have the ldap_ssl.h header file. */\r\n#undef HAVE_LDAP_SSL_H\r\n\r\n/* Define to 1 if you have the `ldap_url_parse' function. */\r\n#undef HAVE_LDAP_URL_PARSE\r\n\r\n/* Define to 1 if you have the <libgen.h> header file. */\r\n#undef HAVE_LIBGEN_H\r\n\r\n/* Define to 1 if you have the `idn' library (-lidn). */\r\n#undef HAVE_LIBIDN\r\n\r\n/* Define to 1 if you have the `resolv' library (-lresolv). */\r\n#undef HAVE_LIBRESOLV\r\n\r\n/* Define to 1 if you have the `resolve' library (-lresolve). */\r\n#undef HAVE_LIBRESOLVE\r\n\r\n/* Define to 1 if you have the <librtmp/rtmp.h> header file. */\r\n#undef HAVE_LIBRTMP_RTMP_H\r\n\r\n/* Define to 1 if you have the `ssh2' library (-lssh2). */\r\n#undef HAVE_LIBSSH2\r\n\r\n/* Define to 1 if you have the `libssh2_exit' function. */\r\n#undef HAVE_LIBSSH2_EXIT\r\n\r\n/* Define to 1 if you have the <libssh2.h> header file. */\r\n#undef HAVE_LIBSSH2_H\r\n\r\n/* Define to 1 if you have the `libssh2_init' function. */\r\n#undef HAVE_LIBSSH2_INIT\r\n\r\n/* Define to 1 if you have the `libssh2_scp_send64' function. */\r\n#undef HAVE_LIBSSH2_SCP_SEND64\r\n\r\n/* Define to 1 if you have the `libssh2_session_handshake' function. */\r\n#undef HAVE_LIBSSH2_SESSION_HANDSHAKE\r\n\r\n/* Define to 1 if you have the `libssh2_version' function. */\r\n#undef HAVE_LIBSSH2_VERSION\r\n\r\n/* Define to 1 if you have the `ssl' library (-lssl). */\r\n#undef HAVE_LIBSSL\r\n\r\n/* if zlib is available */\r\n#undef HAVE_LIBZ\r\n\r\n/* Define to 1 if you have the <limits.h> header file. */\r\n#undef HAVE_LIMITS_H\r\n\r\n/* if your compiler supports LL */\r\n#undef HAVE_LL\r\n\r\n/* Define to 1 if you have the <locale.h> header file. */\r\n#undef HAVE_LOCALE_H\r\n\r\n/* Define to 1 if you have a working localtime_r function. */\r\n#undef HAVE_LOCALTIME_R\r\n\r\n/* Define to 1 if the compiler supports the 'long long' data type. */\r\n#undef HAVE_LONGLONG\r\n\r\n/* Define to 1 if you have the malloc.h header file. */\r\n#undef HAVE_MALLOC_H\r\n\r\n/* Define to 1 if you have the memory.h header file. */\r\n#undef HAVE_MEMORY_H\r\n\r\n/* Define to 1 if you have the memrchr function or macro. */\r\n#undef HAVE_MEMRCHR\r\n\r\n/* Define to 1 if you have the MSG_NOSIGNAL flag. */\r\n#undef HAVE_MSG_NOSIGNAL\r\n\r\n/* Define to 1 if you have the <netdb.h> header file. */\r\n#undef HAVE_NETDB_H\r\n\r\n/* Define to 1 if you have the <netinet/in.h> header file. */\r\n#undef HAVE_NETINET_IN_H\r\n\r\n/* Define to 1 if you have the <netinet/tcp.h> header file. */\r\n#undef HAVE_NETINET_TCP_H\r\n\r\n/* Define to 1 if you have the <net/if.h> header file. */\r\n#undef HAVE_NET_IF_H\r\n\r\n/* Define to 1 if NI_WITHSCOPEID exists and works. */\r\n#undef HAVE_NI_WITHSCOPEID\r\n\r\n/* if you have the NSS_InitContext function */\r\n#undef HAVE_NSS_INITCONTEXT\r\n\r\n/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE\r\n   */\r\n#undef HAVE_OLD_GSSMIT\r\n\r\n/* Define to 1 if you have the <openssl/crypto.h> header file. */\r\n#undef HAVE_OPENSSL_CRYPTO_H\r\n\r\n/* Define to 1 if you have the <openssl/engine.h> header file. */\r\n#undef HAVE_OPENSSL_ENGINE_H\r\n\r\n/* Define to 1 if you have the <openssl/err.h> header file. */\r\n#undef HAVE_OPENSSL_ERR_H\r\n\r\n/* Define to 1 if you have the <openssl/pem.h> header file. */\r\n#undef HAVE_OPENSSL_PEM_H\r\n\r\n/* Define to 1 if you have the <openssl/pkcs12.h> header file. */\r\n#undef HAVE_OPENSSL_PKCS12_H\r\n\r\n/* Define to 1 if you have the <openssl/rsa.h> header file. */\r\n#undef HAVE_OPENSSL_RSA_H\r\n\r\n/* Define to 1 if you have the <openssl/ssl.h> header file. */\r\n#undef HAVE_OPENSSL_SSL_H\r\n\r\n/* Define to 1 if you have the <openssl/x509.h> header file. */\r\n#undef HAVE_OPENSSL_X509_H\r\n\r\n/* Define to 1 if you have the <pem.h> header file. */\r\n#undef HAVE_PEM_H\r\n\r\n/* Define to 1 if you have the `perror' function. */\r\n#undef HAVE_PERROR\r\n\r\n/* Define to 1 if you have the `pipe' function. */\r\n#undef HAVE_PIPE\r\n\r\n/* Define to 1 if you have a working poll function. */\r\n#undef HAVE_POLL\r\n\r\n/* If you have a fine poll */\r\n#undef HAVE_POLL_FINE\r\n\r\n/* Define to 1 if you have the <poll.h> header file. */\r\n#undef HAVE_POLL_H\r\n\r\n/* Define to 1 if you have a working POSIX-style strerror_r function. */\r\n#undef HAVE_POSIX_STRERROR_R\r\n\r\n/* if you have <pthread.h> */\r\n#undef HAVE_PTHREAD_H\r\n\r\n/* Define to 1 if you have the <pwd.h> header file. */\r\n#undef HAVE_PWD_H\r\n\r\n/* Define to 1 if you have the `RAND_egd' function. */\r\n#undef HAVE_RAND_EGD\r\n\r\n/* Define to 1 if you have the `RAND_screen' function. */\r\n#undef HAVE_RAND_SCREEN\r\n\r\n/* Define to 1 if you have the `RAND_status' function. */\r\n#undef HAVE_RAND_STATUS\r\n\r\n/* Define to 1 if you have the recv function. */\r\n#undef HAVE_RECV\r\n\r\n/* Define to 1 if you have the recvfrom function. */\r\n#undef HAVE_RECVFROM\r\n\r\n/* Define to 1 if you have the <rsa.h> header file. */\r\n#undef HAVE_RSA_H\r\n\r\n/* Define to 1 if you have the select function. */\r\n#undef HAVE_SELECT\r\n\r\n/* Define to 1 if you have the send function. */\r\n#undef HAVE_SEND\r\n\r\n/* Define to 1 if you have the <setjmp.h> header file. */\r\n#undef HAVE_SETJMP_H\r\n\r\n/* Define to 1 if you have the `setlocale' function. */\r\n#undef HAVE_SETLOCALE\r\n\r\n/* Define to 1 if you have the `setmode' function. */\r\n#undef HAVE_SETMODE\r\n\r\n/* Define to 1 if you have the `setrlimit' function. */\r\n#undef HAVE_SETRLIMIT\r\n\r\n/* Define to 1 if you have the setsockopt function. */\r\n#undef HAVE_SETSOCKOPT\r\n\r\n/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */\r\n#undef HAVE_SETSOCKOPT_SO_NONBLOCK\r\n\r\n/* Define to 1 if you have the <sgtty.h> header file. */\r\n#undef HAVE_SGTTY_H\r\n\r\n/* Define to 1 if you have the sigaction function. */\r\n#undef HAVE_SIGACTION\r\n\r\n/* Define to 1 if you have the siginterrupt function. */\r\n#undef HAVE_SIGINTERRUPT\r\n\r\n/* Define to 1 if you have the signal function. */\r\n#undef HAVE_SIGNAL\r\n\r\n/* Define to 1 if you have the <signal.h> header file. */\r\n#undef HAVE_SIGNAL_H\r\n\r\n/* Define to 1 if you have the sigsetjmp function or macro. */\r\n#undef HAVE_SIGSETJMP\r\n\r\n/* Define to 1 if sig_atomic_t is an available typedef. */\r\n#undef HAVE_SIG_ATOMIC_T\r\n\r\n/* Define to 1 if sig_atomic_t is already defined as volatile. */\r\n#undef HAVE_SIG_ATOMIC_T_VOLATILE\r\n\r\n/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */\r\n#undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID\r\n\r\n/* Define to 1 if you have the socket function. */\r\n#undef HAVE_SOCKET\r\n\r\n/* Define to 1 if you have the socketpair function. */\r\n#undef HAVE_SOCKETPAIR\r\n\r\n/* Define to 1 if you have the <socket.h> header file. */\r\n#undef HAVE_SOCKET_H\r\n\r\n/* Define this if you have the SPNEGO library fbopenssl */\r\n#undef HAVE_SPNEGO\r\n\r\n/* if you have the function SRP_Calc_client_key */\r\n#undef HAVE_SSLEAY_SRP\r\n\r\n/* Define to 1 if you have the `SSLv2_client_method' function. */\r\n#undef HAVE_SSLV2_CLIENT_METHOD\r\n\r\n/* Define to 1 if you have the `SSL_get_shutdown' function. */\r\n#undef HAVE_SSL_GET_SHUTDOWN\r\n\r\n/* Define to 1 if you have the <ssl.h> header file. */\r\n#undef HAVE_SSL_H\r\n\r\n/* Define to 1 if you have the <stdbool.h> header file. */\r\n#undef HAVE_STDBOOL_H\r\n\r\n/* Define to 1 if you have the <stdint.h> header file. */\r\n#undef HAVE_STDINT_H\r\n\r\n/* Define to 1 if you have the <stdio.h> header file. */\r\n#undef HAVE_STDIO_H\r\n\r\n/* Define to 1 if you have the <stdlib.h> header file. */\r\n#undef HAVE_STDLIB_H\r\n\r\n/* Define to 1 if you have the strcasecmp function. */\r\n#undef HAVE_STRCASECMP\r\n\r\n/* Define to 1 if you have the strcasestr function. */\r\n#undef HAVE_STRCASESTR\r\n\r\n/* Define to 1 if you have the strcmpi function. */\r\n#undef HAVE_STRCMPI\r\n\r\n/* Define to 1 if you have the strdup function. */\r\n#undef HAVE_STRDUP\r\n\r\n/* Define to 1 if you have the strerror_r function. */\r\n#undef HAVE_STRERROR_R\r\n\r\n/* Define to 1 if you have the stricmp function. */\r\n#undef HAVE_STRICMP\r\n\r\n/* Define to 1 if you have the <strings.h> header file. */\r\n#undef HAVE_STRINGS_H\r\n\r\n/* Define to 1 if you have the <string.h> header file. */\r\n#undef HAVE_STRING_H\r\n\r\n/* Define to 1 if you have the strlcat function. */\r\n#undef HAVE_STRLCAT\r\n\r\n/* Define to 1 if you have the `strlcpy' function. */\r\n#undef HAVE_STRLCPY\r\n\r\n/* Define to 1 if you have the strncasecmp function. */\r\n#undef HAVE_STRNCASECMP\r\n\r\n/* Define to 1 if you have the strncmpi function. */\r\n#undef HAVE_STRNCMPI\r\n\r\n/* Define to 1 if you have the strnicmp function. */\r\n#undef HAVE_STRNICMP\r\n\r\n/* Define to 1 if you have the <stropts.h> header file. */\r\n#undef HAVE_STROPTS_H\r\n\r\n/* Define to 1 if you have the strstr function. */\r\n#undef HAVE_STRSTR\r\n\r\n/* Define to 1 if you have the strtok_r function. */\r\n#undef HAVE_STRTOK_R\r\n\r\n/* Define to 1 if you have the strtoll function. */\r\n#undef HAVE_STRTOLL\r\n\r\n/* if struct sockaddr_storage is defined */\r\n#undef HAVE_STRUCT_SOCKADDR_STORAGE\r\n\r\n/* Define to 1 if you have the timeval struct. */\r\n#undef HAVE_STRUCT_TIMEVAL\r\n\r\n/* Define to 1 if you have the <sys/filio.h> header file. */\r\n#undef HAVE_SYS_FILIO_H\r\n\r\n/* Define to 1 if you have the <sys/ioctl.h> header file. */\r\n#undef HAVE_SYS_IOCTL_H\r\n\r\n/* Define to 1 if you have the <sys/param.h> header file. */\r\n#undef HAVE_SYS_PARAM_H\r\n\r\n/* Define to 1 if you have the <sys/poll.h> header file. */\r\n#undef HAVE_SYS_POLL_H\r\n\r\n/* Define to 1 if you have the <sys/resource.h> header file. */\r\n#undef HAVE_SYS_RESOURCE_H\r\n\r\n/* Define to 1 if you have the <sys/select.h> header file. */\r\n#undef HAVE_SYS_SELECT_H\r\n\r\n/* Define to 1 if you have the <sys/socket.h> header file. */\r\n#undef HAVE_SYS_SOCKET_H\r\n\r\n/* Define to 1 if you have the <sys/sockio.h> header file. */\r\n#undef HAVE_SYS_SOCKIO_H\r\n\r\n/* Define to 1 if you have the <sys/stat.h> header file. */\r\n#undef HAVE_SYS_STAT_H\r\n\r\n/* Define to 1 if you have the <sys/time.h> header file. */\r\n#undef HAVE_SYS_TIME_H\r\n\r\n/* Define to 1 if you have the <sys/types.h> header file. */\r\n#undef HAVE_SYS_TYPES_H\r\n\r\n/* Define to 1 if you have the <sys/uio.h> header file. */\r\n#undef HAVE_SYS_UIO_H\r\n\r\n/* Define to 1 if you have the <sys/un.h> header file. */\r\n#undef HAVE_SYS_UN_H\r\n\r\n/* Define to 1 if you have the <sys/utime.h> header file. */\r\n#undef HAVE_SYS_UTIME_H\r\n\r\n/* Define to 1 if you have the <sys/wait.h> header file. */\r\n#undef HAVE_SYS_WAIT_H\r\n\r\n/* Define to 1 if you have the <sys/xattr.h> header file. */\r\n#undef HAVE_SYS_XATTR_H\r\n\r\n/* Define to 1 if you have the <termios.h> header file. */\r\n#undef HAVE_TERMIOS_H\r\n\r\n/* Define to 1 if you have the <termio.h> header file. */\r\n#undef HAVE_TERMIO_H\r\n\r\n/* Define to 1 if you have the <time.h> header file. */\r\n#undef HAVE_TIME_H\r\n\r\n/* Define to 1 if you have the <tld.h> header file. */\r\n#undef HAVE_TLD_H\r\n\r\n/* Define to 1 if you have the `tld_strerror' function. */\r\n#undef HAVE_TLD_STRERROR\r\n\r\n/* Define to 1 if you have the `uname' function. */\r\n#undef HAVE_UNAME\r\n\r\n/* Define to 1 if you have the <unistd.h> header file. */\r\n#undef HAVE_UNISTD_H\r\n\r\n/* Define to 1 if you have the `utime' function. */\r\n#undef HAVE_UTIME\r\n\r\n/* Define to 1 if you have the <utime.h> header file. */\r\n#undef HAVE_UTIME_H\r\n\r\n/* Define to 1 if compiler supports C99 variadic macro style. */\r\n#undef HAVE_VARIADIC_MACROS_C99\r\n\r\n/* Define to 1 if compiler supports old gcc variadic macro style. */\r\n#undef HAVE_VARIADIC_MACROS_GCC\r\n\r\n/* Define to 1 if you have the winber.h header file. */\r\n#undef HAVE_WINBER_H\r\n\r\n/* Define to 1 if you have the windows.h header file. */\r\n#undef HAVE_WINDOWS_H\r\n\r\n/* Define to 1 if you have the winldap.h header file. */\r\n#undef HAVE_WINLDAP_H\r\n\r\n/* Define to 1 if you have the winsock2.h header file. */\r\n#undef HAVE_WINSOCK2_H\r\n\r\n/* Define to 1 if you have the winsock.h header file. */\r\n#undef HAVE_WINSOCK_H\r\n\r\n/* Define this symbol if your OS supports changing the contents of argv */\r\n#undef HAVE_WRITABLE_ARGV\r\n\r\n/* Define to 1 if you have the writev function. */\r\n#undef HAVE_WRITEV\r\n\r\n/* Define to 1 if you have the ws2tcpip.h header file. */\r\n#undef HAVE_WS2TCPIP_H\r\n\r\n/* Define to 1 if you have the <x509.h> header file. */\r\n#undef HAVE_X509_H\r\n\r\n/* if you have the zlib.h header file */\r\n#undef HAVE_ZLIB_H\r\n\r\n/* Define to the sub-directory in which libtool stores uninstalled libraries.\r\n   */\r\n#undef LT_OBJDIR\r\n\r\n/* Define to 1 if you need the lber.h header file even with ldap.h */\r\n#undef NEED_LBER_H\r\n\r\n/* Define to 1 if you need the malloc.h header file even with stdlib.h */\r\n#undef NEED_MALLOC_H\r\n\r\n/* Define to 1 if you need the memory.h header file even with stdlib.h */\r\n#undef NEED_MEMORY_H\r\n\r\n/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */\r\n#undef NEED_REENTRANT\r\n\r\n/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */\r\n#undef NEED_THREAD_SAFE\r\n\r\n/* Define to 1 if your C compiler doesn't accept -c and -o together. */\r\n#undef NO_MINUS_C_MINUS_O\r\n\r\n/* Define to enable NTLM delegation to winbind's ntlm_auth helper. */\r\n#undef NTLM_WB_ENABLED\r\n\r\n/* Define absolute filename for winbind's ntlm_auth helper. */\r\n#undef NTLM_WB_FILE\r\n\r\n/* cpu-machine-OS */\r\n#undef OS\r\n\r\n/* Name of package */\r\n#undef PACKAGE\r\n\r\n/* Define to the address where bug reports for this package should be sent. */\r\n#undef PACKAGE_BUGREPORT\r\n\r\n/* Define to the full name of this package. */\r\n#undef PACKAGE_NAME\r\n\r\n/* Define to the full name and version of this package. */\r\n#undef PACKAGE_STRING\r\n\r\n/* Define to the one symbol short name of this package. */\r\n#undef PACKAGE_TARNAME\r\n\r\n/* Define to the home page for this package. */\r\n#undef PACKAGE_URL\r\n\r\n/* Define to the version of this package. */\r\n#undef PACKAGE_VERSION\r\n\r\n/* a suitable file to read random data from */\r\n#undef RANDOM_FILE\r\n\r\n/* Define to the type qualifier pointed by arg 5 for recvfrom. */\r\n#undef RECVFROM_QUAL_ARG5\r\n\r\n/* Define to the type of arg 1 for recvfrom. */\r\n#undef RECVFROM_TYPE_ARG1\r\n\r\n/* Define to the type pointed by arg 2 for recvfrom. */\r\n#undef RECVFROM_TYPE_ARG2\r\n\r\n/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */\r\n#undef RECVFROM_TYPE_ARG2_IS_VOID\r\n\r\n/* Define to the type of arg 3 for recvfrom. */\r\n#undef RECVFROM_TYPE_ARG3\r\n\r\n/* Define to the type of arg 4 for recvfrom. */\r\n#undef RECVFROM_TYPE_ARG4\r\n\r\n/* Define to the type pointed by arg 5 for recvfrom. */\r\n#undef RECVFROM_TYPE_ARG5\r\n\r\n/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */\r\n#undef RECVFROM_TYPE_ARG5_IS_VOID\r\n\r\n/* Define to the type pointed by arg 6 for recvfrom. */\r\n#undef RECVFROM_TYPE_ARG6\r\n\r\n/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */\r\n#undef RECVFROM_TYPE_ARG6_IS_VOID\r\n\r\n/* Define to the function return type for recvfrom. */\r\n#undef RECVFROM_TYPE_RETV\r\n\r\n/* Define to the type of arg 1 for recv. */\r\n#undef RECV_TYPE_ARG1\r\n\r\n/* Define to the type of arg 2 for recv. */\r\n#undef RECV_TYPE_ARG2\r\n\r\n/* Define to the type of arg 3 for recv. */\r\n#undef RECV_TYPE_ARG3\r\n\r\n/* Define to the type of arg 4 for recv. */\r\n#undef RECV_TYPE_ARG4\r\n\r\n/* Define to the function return type for recv. */\r\n#undef RECV_TYPE_RETV\r\n\r\n/* Define as the return type of signal handlers (`int' or `void'). */\r\n#undef RETSIGTYPE\r\n\r\n/* Define to the type qualifier of arg 5 for select. */\r\n#undef SELECT_QUAL_ARG5\r\n\r\n/* Define to the type of arg 1 for select. */\r\n#undef SELECT_TYPE_ARG1\r\n\r\n/* Define to the type of args 2, 3 and 4 for select. */\r\n#undef SELECT_TYPE_ARG234\r\n\r\n/* Define to the type of arg 5 for select. */\r\n#undef SELECT_TYPE_ARG5\r\n\r\n/* Define to the function return type for select. */\r\n#undef SELECT_TYPE_RETV\r\n\r\n/* Define to the type qualifier of arg 2 for send. */\r\n#undef SEND_QUAL_ARG2\r\n\r\n/* Define to the type of arg 1 for send. */\r\n#undef SEND_TYPE_ARG1\r\n\r\n/* Define to the type of arg 2 for send. */\r\n#undef SEND_TYPE_ARG2\r\n\r\n/* Define to the type of arg 3 for send. */\r\n#undef SEND_TYPE_ARG3\r\n\r\n/* Define to the type of arg 4 for send. */\r\n#undef SEND_TYPE_ARG4\r\n\r\n/* Define to the function return type for send. */\r\n#undef SEND_TYPE_RETV\r\n\r\n/* The size of `int', as computed by sizeof. */\r\n#undef SIZEOF_INT\r\n\r\n/* The size of `long', as computed by sizeof. */\r\n#undef SIZEOF_LONG\r\n\r\n/* The size of `off_t', as computed by sizeof. */\r\n#undef SIZEOF_OFF_T\r\n\r\n/* The size of `short', as computed by sizeof. */\r\n#undef SIZEOF_SHORT\r\n\r\n/* The size of `size_t', as computed by sizeof. */\r\n#undef SIZEOF_SIZE_T\r\n\r\n/* The size of `time_t', as computed by sizeof. */\r\n#undef SIZEOF_TIME_T\r\n\r\n/* The size of `void*', as computed by sizeof. */\r\n#undef SIZEOF_VOIDP\r\n\r\n/* Define to 1 if you have the ANSI C header files. */\r\n#undef STDC_HEADERS\r\n\r\n/* Define to the type of arg 3 for strerror_r. */\r\n#undef STRERROR_R_TYPE_ARG3\r\n\r\n/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r\n#undef TIME_WITH_SYS_TIME\r\n\r\n/* Define to enable c-ares support */\r\n#undef USE_ARES\r\n\r\n/* if axTLS is enabled */\r\n#undef USE_AXTLS\r\n\r\n/* if CyaSSL is enabled */\r\n#undef USE_CYASSL\r\n\r\n/* to enable iOS/Mac OS X native SSL/TLS support */\r\n#undef USE_DARWINSSL\r\n\r\n/* if GnuTLS is enabled */\r\n#undef USE_GNUTLS\r\n\r\n/* if GnuTLS uses nettle as crypto backend */\r\n#undef USE_GNUTLS_NETTLE\r\n\r\n/* if librtmp is in use */\r\n#undef USE_LIBRTMP\r\n\r\n/* if libSSH2 is in use */\r\n#undef USE_LIBSSH2\r\n\r\n/* If you want to build curl with the built-in manual */\r\n#undef USE_MANUAL\r\n\r\n/* Define to enable metalink support */\r\n#undef USE_METALINK\r\n\r\n/* if NSS is enabled */\r\n#undef USE_NSS\r\n\r\n/* Use OpenLDAP-specific code */\r\n#undef USE_OPENLDAP\r\n\r\n/* if OpenSSL is in use */\r\n#undef USE_OPENSSL\r\n\r\n/* if PolarSSL is enabled */\r\n#undef USE_POLARSSL\r\n\r\n/* to enable Windows native SSL/TLS support */\r\n#undef USE_SCHANNEL\r\n\r\n/* if SSL is enabled */\r\n#undef USE_SSLEAY\r\n\r\n/* if you want POSIX threaded DNS lookup */\r\n#undef USE_THREADS_POSIX\r\n\r\n/* Use TLS-SRP authentication */\r\n#undef USE_TLS_SRP\r\n\r\n/* Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz). */\r\n#undef USE_WIN32_IDN\r\n\r\n/* Define to 1 if you are building a Windows target with large file support.\r\n   */\r\n#undef USE_WIN32_LARGE_FILES\r\n\r\n/* Define to 1 if you are building a Windows target without large file\r\n   support. */\r\n#undef USE_WIN32_SMALL_FILES\r\n\r\n/* to enable SSPI support */\r\n#undef USE_WINDOWS_SSPI\r\n\r\n/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */\r\n#undef USE_YASSLEMUL\r\n\r\n/* Version number of package */\r\n#undef VERSION\r\n\r\n/* Define to 1 to provide own prototypes. */\r\n#undef WANT_IDN_PROTOTYPES\r\n\r\n/* Define to avoid automatic inclusion of winsock.h */\r\n#undef WIN32_LEAN_AND_MEAN\r\n\r\n/* Define to 1 if OS is AIX. */\r\n#ifndef _ALL_SOURCE\r\n#  undef _ALL_SOURCE\r\n#endif\r\n\r\n/* Enable large inode numbers on Mac OS X 10.5.  */\r\n#ifndef _DARWIN_USE_64_BIT_INODE\r\n# define _DARWIN_USE_64_BIT_INODE 1\r\n#endif\r\n\r\n/* Number of bits in a file offset, on hosts where this is settable. */\r\n#undef _FILE_OFFSET_BITS\r\n\r\n/* Define for large files, on AIX-style hosts. */\r\n#undef _LARGE_FILES\r\n\r\n/* Define to empty if `const' does not conform to ANSI C. */\r\n#undef const\r\n\r\n/* Type to use in place of in_addr_t when system does not provide it. */\r\n#undef in_addr_t\r\n\r\n/* Define to `__inline__' or `__inline' if that's what the C compiler\r\n   calls it, or to nothing if 'inline' is not supported under any name.  */\r\n#ifndef __cplusplus\r\n#undef inline\r\n#endif\r\n\r\n/* Define to `unsigned int' if <sys/types.h> does not define. */\r\n#undef size_t\r\n\r\n/* the signed version of size_t */\r\n#undef ssize_t\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_darwinssl.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012-2013, Nick Zitzmann, <nickzman@gmail.com>.\r\n * Copyright (C) 2012-2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all iOS and Mac OS X SecureTransport-specific code for the\r\n * TLS/SSL layer. No code but sslgen.c should ever call or use these functions.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_DARWINSSL\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n\r\n#include <Security/Security.h>\r\n#include <Security/SecureTransport.h>\r\n#include <CoreFoundation/CoreFoundation.h>\r\n#include <CommonCrypto/CommonDigest.h>\r\n#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))\r\n#include <sys/sysctl.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"inet_pton.h\"\r\n#include \"connect.h\"\r\n#include \"select.h\"\r\n#include \"sslgen.h\"\r\n#include \"curl_darwinssl.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* From MacTypes.h (which we can't include because it isn't present in iOS: */\r\n#define ioErr -36\r\n\r\n/* In Mountain Lion and iOS 5, Apple made some changes to the API. They\r\n   added TLS 1.1 and 1.2 support, and deprecated and replaced some\r\n   functions. You need to build against the Mountain Lion or iOS 5 SDK\r\n   or later to get TLS 1.1 or 1.2 support working in cURL. We'll weak-link\r\n   to the newer functions and use them if present in the user's OS.\r\n\r\n   Builders: If you want TLS 1.1 and 1.2 but still want to retain support\r\n   for older cats, don't forget to set the MACOSX_DEPLOYMENT_TARGET\r\n   environmental variable prior to building cURL. */\r\n\r\n/* The following two functions were ripped from Apple sample code,\r\n * with some modifications: */\r\nstatic OSStatus SocketRead(SSLConnectionRef connection,\r\n                           void *data,          /* owned by\r\n                                                 * caller, data\r\n                                                 * RETURNED */\r\n                           size_t *dataLength)  /* IN/OUT */\r\n{\r\n  size_t bytesToGo = *dataLength;\r\n  size_t initLen = bytesToGo;\r\n  UInt8 *currData = (UInt8 *)data;\r\n  /*int sock = *(int *)connection;*/\r\n  struct ssl_connect_data *connssl = (struct ssl_connect_data *)connection;\r\n  int sock = connssl->ssl_sockfd;\r\n  OSStatus rtn = noErr;\r\n  size_t bytesRead;\r\n  ssize_t rrtn;\r\n  int theErr;\r\n\r\n  *dataLength = 0;\r\n\r\n  for(;;) {\r\n    bytesRead = 0;\r\n    rrtn = read(sock, currData, bytesToGo);\r\n    if(rrtn <= 0) {\r\n      /* this is guesswork... */\r\n      theErr = errno;\r\n      if((rrtn == 0) && (theErr == 0)) {\r\n        /* try fix for iSync */\r\n        rtn = errSSLClosedGraceful;\r\n      }\r\n      else /* do the switch */\r\n        switch(theErr) {\r\n          case ENOENT:\r\n            /* connection closed */\r\n            rtn = errSSLClosedGraceful;\r\n            break;\r\n          case ECONNRESET:\r\n            rtn = errSSLClosedAbort;\r\n            break;\r\n          case EAGAIN:\r\n            rtn = errSSLWouldBlock;\r\n            connssl->ssl_direction = false;\r\n            break;\r\n          default:\r\n            rtn = ioErr;\r\n            break;\r\n        }\r\n      break;\r\n    }\r\n    else {\r\n      bytesRead = rrtn;\r\n    }\r\n    bytesToGo -= bytesRead;\r\n    currData  += bytesRead;\r\n\r\n    if(bytesToGo == 0) {\r\n      /* filled buffer with incoming data, done */\r\n      break;\r\n    }\r\n  }\r\n  *dataLength = initLen - bytesToGo;\r\n\r\n  return rtn;\r\n}\r\n\r\nstatic OSStatus SocketWrite(SSLConnectionRef connection,\r\n                            const void *data,\r\n                            size_t *dataLength)  /* IN/OUT */\r\n{\r\n  size_t bytesSent = 0;\r\n  /*int sock = *(int *)connection;*/\r\n  struct ssl_connect_data *connssl = (struct ssl_connect_data *)connection;\r\n  int sock = connssl->ssl_sockfd;\r\n  ssize_t length;\r\n  size_t dataLen = *dataLength;\r\n  const UInt8 *dataPtr = (UInt8 *)data;\r\n  OSStatus ortn;\r\n  int theErr;\r\n\r\n  *dataLength = 0;\r\n\r\n  do {\r\n    length = write(sock,\r\n                   (char*)dataPtr + bytesSent,\r\n                   dataLen - bytesSent);\r\n  } while((length > 0) &&\r\n           ( (bytesSent += length) < dataLen) );\r\n\r\n  if(length <= 0) {\r\n    theErr = errno;\r\n    if(theErr == EAGAIN) {\r\n      ortn = errSSLWouldBlock;\r\n      connssl->ssl_direction = true;\r\n    }\r\n    else {\r\n      ortn = ioErr;\r\n    }\r\n  }\r\n  else {\r\n    ortn = noErr;\r\n  }\r\n  *dataLength = bytesSent;\r\n  return ortn;\r\n}\r\n\r\nCF_INLINE const char *SSLCipherNameForNumber(SSLCipherSuite cipher) {\r\n  switch (cipher) {\r\n    /* SSL version 3.0 */\r\n    case SSL_RSA_WITH_NULL_MD5:\r\n      return \"SSL_RSA_WITH_NULL_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_NULL_SHA:\r\n      return \"SSL_RSA_WITH_NULL_SHA\";\r\n      break;\r\n    case SSL_RSA_EXPORT_WITH_RC4_40_MD5:\r\n      return \"SSL_RSA_EXPORT_WITH_RC4_40_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_RC4_128_MD5:\r\n      return \"SSL_RSA_WITH_RC4_128_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_RC4_128_SHA:\r\n      return \"SSL_RSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5:\r\n      return \"SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_IDEA_CBC_SHA:\r\n      return \"SSL_RSA_WITH_IDEA_CBC_SHA\";\r\n      break;\r\n    case SSL_RSA_EXPORT_WITH_DES40_CBC_SHA:\r\n      return \"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA\";\r\n      break;\r\n    case SSL_RSA_WITH_DES_CBC_SHA:\r\n      return \"SSL_RSA_WITH_DES_CBC_SHA\";\r\n      break;\r\n    case SSL_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"SSL_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA:\r\n      return \"SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_DSS_WITH_DES_CBC_SHA:\r\n      return \"SSL_DH_DSS_WITH_DES_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA:\r\n      return \"SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA:\r\n      return \"SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_RSA_WITH_DES_CBC_SHA:\r\n      return \"SSL_DH_RSA_WITH_DES_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA:\r\n      return \"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA\";\r\n      break;\r\n    case SSL_DHE_DSS_WITH_DES_CBC_SHA:\r\n      return \"SSL_DHE_DSS_WITH_DES_CBC_SHA\";\r\n      break;\r\n    case SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA:\r\n      return \"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA:\r\n      return \"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA\";\r\n      break;\r\n    case SSL_DHE_RSA_WITH_DES_CBC_SHA:\r\n      return \"SSL_DHE_RSA_WITH_DES_CBC_SHA\";\r\n      break;\r\n    case SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_anon_EXPORT_WITH_RC4_40_MD5:\r\n      return \"SSL_DH_anon_EXPORT_WITH_RC4_40_MD5\";\r\n      break;\r\n    case SSL_DH_anon_WITH_RC4_128_MD5:\r\n      return \"SSL_DH_anon_WITH_RC4_128_MD5\";\r\n      break;\r\n    case SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA:\r\n      return \"SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_anon_WITH_DES_CBC_SHA:\r\n      return \"SSL_DH_anon_WITH_DES_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_anon_WITH_3DES_EDE_CBC_SHA:\r\n      return \"SSL_DH_anon_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_FORTEZZA_DMS_WITH_NULL_SHA:\r\n      return \"SSL_FORTEZZA_DMS_WITH_NULL_SHA\";\r\n      break;\r\n    case SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA:\r\n      return \"SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA\";\r\n      break;\r\n    /* TLS 1.0 with AES (RFC 3268)\r\n       (Apparently these are used in SSLv3 implementations as well.) */\r\n    case TLS_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DH_DSS_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DH_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DHE_DSS_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DHE_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DH_anon_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DH_DSS_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DH_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DHE_DSS_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DHE_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DH_anon_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    /* SSL version 2.0 */\r\n    case SSL_RSA_WITH_RC2_CBC_MD5:\r\n      return \"SSL_RSA_WITH_RC2_CBC_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_IDEA_CBC_MD5:\r\n      return \"SSL_RSA_WITH_IDEA_CBC_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_DES_CBC_MD5:\r\n      return \"SSL_RSA_WITH_DES_CBC_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_3DES_EDE_CBC_MD5:\r\n      return \"SSL_RSA_WITH_3DES_EDE_CBC_MD5\";\r\n      break;\r\n  }\r\n  return \"SSL_NULL_WITH_NULL_NULL\";\r\n}\r\n\r\nCF_INLINE const char *TLSCipherNameForNumber(SSLCipherSuite cipher) {\r\n  switch(cipher) {\r\n    /* TLS 1.0 with AES (RFC 3268) */\r\n    case TLS_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DH_DSS_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DH_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DHE_DSS_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DHE_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_DH_anon_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DH_DSS_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DH_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DHE_DSS_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DHE_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_DH_anon_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    /* TLS 1.0 with ECDSA (RFC 4492) */\r\n    case TLS_ECDH_ECDSA_WITH_NULL_SHA:\r\n      return \"TLS_ECDH_ECDSA_WITH_NULL_SHA\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_RC4_128_SHA:\r\n      return \"TLS_ECDH_ECDSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_NULL_SHA:\r\n      return \"TLS_ECDHE_ECDSA_WITH_NULL_SHA\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:\r\n      return \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_NULL_SHA:\r\n      return \"TLS_ECDH_RSA_WITH_NULL_SHA\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_RC4_128_SHA:\r\n      return \"TLS_ECDH_RSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_NULL_SHA:\r\n      return \"TLS_ECDHE_RSA_WITH_NULL_SHA\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_RC4_128_SHA:\r\n      return \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_anon_WITH_NULL_SHA:\r\n      return \"TLS_ECDH_anon_WITH_NULL_SHA\";\r\n      break;\r\n    case TLS_ECDH_anon_WITH_RC4_128_SHA:\r\n      return \"TLS_ECDH_anon_WITH_RC4_128_SHA\";\r\n      break;\r\n    case TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_anon_WITH_AES_128_CBC_SHA:\r\n      return \"TLS_ECDH_anon_WITH_AES_128_CBC_SHA\";\r\n      break;\r\n    case TLS_ECDH_anon_WITH_AES_256_CBC_SHA:\r\n      return \"TLS_ECDH_anon_WITH_AES_256_CBC_SHA\";\r\n      break;\r\n#if defined(__MAC_10_8) || defined(__IPHONE_5_0)\r\n    /* TLS 1.2 (RFC 5246) */\r\n    case TLS_RSA_WITH_NULL_MD5:\r\n      return \"TLS_RSA_WITH_NULL_MD5\";\r\n      break;\r\n    case TLS_RSA_WITH_NULL_SHA:\r\n      return \"TLS_RSA_WITH_NULL_SHA\";\r\n      break;\r\n    case TLS_RSA_WITH_RC4_128_MD5:\r\n      return \"TLS_RSA_WITH_RC4_128_MD5\";\r\n      break;\r\n    case TLS_RSA_WITH_RC4_128_SHA:\r\n      return \"TLS_RSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case TLS_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_RSA_WITH_NULL_SHA256:\r\n      return \"TLS_RSA_WITH_NULL_SHA256\";\r\n      break;\r\n    case TLS_RSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_RSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_RSA_WITH_AES_256_CBC_SHA256:\r\n      return \"TLS_RSA_WITH_AES_256_CBC_SHA256\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_DH_DSS_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_DH_RSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_256_CBC_SHA256:\r\n      return \"TLS_DH_DSS_WITH_AES_256_CBC_SHA256\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_256_CBC_SHA256:\r\n      return \"TLS_DH_RSA_WITH_AES_256_CBC_SHA256\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_256_CBC_SHA256:\r\n      return \"TLS_DHE_DSS_WITH_AES_256_CBC_SHA256\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:\r\n      return \"TLS_DHE_RSA_WITH_AES_256_CBC_SHA256\";\r\n      break;\r\n    case TLS_DH_anon_WITH_RC4_128_MD5:\r\n      return \"TLS_DH_anon_WITH_RC4_128_MD5\";\r\n      break;\r\n    case TLS_DH_anon_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_DH_anon_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_DH_anon_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_256_CBC_SHA256:\r\n      return \"TLS_DH_anon_WITH_AES_256_CBC_SHA256\";\r\n      break;\r\n    /* TLS 1.2 with AES GCM (RFC 5288) */\r\n    case TLS_RSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_RSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_RSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_RSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_DHE_RSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_DH_RSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_DH_RSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_DH_RSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_DHE_DSS_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_DHE_DSS_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_DHE_DSS_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_DH_DSS_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_DH_DSS_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_DH_DSS_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_DH_anon_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_DH_anon_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_DH_anon_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    /* TLS 1.2 with elliptic curve ciphers (RFC 5289) */\r\n    case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:\r\n      return \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384:\r\n      return \"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384:\r\n      return \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256:\r\n      return \"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384:\r\n      return \"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256:\r\n      return \"TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256\";\r\n      break;\r\n    case TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384:\r\n      return \"TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384\";\r\n      break;\r\n    case TLS_EMPTY_RENEGOTIATION_INFO_SCSV:\r\n      return \"TLS_EMPTY_RENEGOTIATION_INFO_SCSV\";\r\n      break;\r\n#else\r\n    case SSL_RSA_WITH_NULL_MD5:\r\n      return \"TLS_RSA_WITH_NULL_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_NULL_SHA:\r\n      return \"TLS_RSA_WITH_NULL_SHA\";\r\n      break;\r\n    case SSL_RSA_WITH_RC4_128_MD5:\r\n      return \"TLS_RSA_WITH_RC4_128_MD5\";\r\n      break;\r\n    case SSL_RSA_WITH_RC4_128_SHA:\r\n      return \"TLS_RSA_WITH_RC4_128_SHA\";\r\n      break;\r\n    case SSL_RSA_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n    case SSL_DH_anon_WITH_RC4_128_MD5:\r\n      return \"TLS_DH_anon_WITH_RC4_128_MD5\";\r\n      break;\r\n    case SSL_DH_anon_WITH_3DES_EDE_CBC_SHA:\r\n      return \"TLS_DH_anon_WITH_3DES_EDE_CBC_SHA\";\r\n      break;\r\n#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */\r\n  }\r\n  return \"TLS_NULL_WITH_NULL_NULL\";\r\n}\r\n\r\nCF_INLINE bool IsRunningMountainLionOrLater(void)\r\n{\r\n#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))\r\n  int mib[2];\r\n  char *os_version;\r\n  size_t os_version_len;\r\n  char *os_version_major/*, *os_version_minor, *os_version_point*/;\r\n  int os_version_major_int;\r\n\r\n  /* Get the Darwin kernel version from the kernel using sysctl(): */\r\n  mib[0] = CTL_KERN;\r\n  mib[1] = KERN_OSRELEASE;\r\n  if(sysctl(mib, 2, NULL, &os_version_len, NULL, 0) == -1)\r\n    return false;\r\n  os_version = malloc(os_version_len*sizeof(char));\r\n  if(!os_version)\r\n    return false;\r\n  if(sysctl(mib, 2, os_version, &os_version_len, NULL, 0) == -1) {\r\n    free(os_version);\r\n    return false;\r\n  }\r\n\r\n  /* Parse the version. If it's version 12.0.0 or later, then this user is\r\n     using Mountain Lion. */\r\n  os_version_major = strtok(os_version, \".\");\r\n  /*os_version_minor = strtok(NULL, \".\");\r\n  os_version_point = strtok(NULL, \".\");*/\r\n  os_version_major_int = atoi(os_version_major);\r\n  free(os_version);\r\n  return os_version_major_int >= 12;\r\n#else\r\n  return true;  /* iOS users: this doesn't concern you */\r\n#endif\r\n}\r\n\r\nstatic CURLcode darwinssl_connect_step1(struct connectdata *conn,\r\n                                        int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n#ifdef ENABLE_IPV6\r\n  struct in6_addr addr;\r\n#else\r\n  struct in_addr addr;\r\n#endif\r\n  /*SSLConnectionRef ssl_connection;*/\r\n  OSStatus err = noErr;\r\n\r\n#if defined(__MAC_10_8) || defined(__IPHONE_5_0)\r\n  if(SSLCreateContext != NULL) {  /* use the newer API if avaialble */\r\n    if(connssl->ssl_ctx)\r\n      CFRelease(connssl->ssl_ctx);\r\n    connssl->ssl_ctx = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);\r\n    if(!connssl->ssl_ctx) {\r\n      failf(data, \"SSL: couldn't create a context!\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n  else {\r\n  /* The old ST API does not exist under iOS, so don't compile it: */\r\n#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))\r\n    if(connssl->ssl_ctx)\r\n      (void)SSLDisposeContext(connssl->ssl_ctx);\r\n    err = SSLNewContext(false, &(connssl->ssl_ctx));\r\n    if(err != noErr) {\r\n      failf(data, \"SSL: couldn't create a context: OSStatus %d\", err);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */\r\n  }\r\n#else\r\n  if(connssl->ssl_ctx)\r\n    (void)SSLDisposeContext(connssl->ssl_ctx);\r\n  err = SSLNewContext(false, &(connssl->ssl_ctx));\r\n  if(err != noErr) {\r\n    failf(data, \"SSL: couldn't create a context: OSStatus %d\", err);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */\r\n\r\n  /* check to see if we've been told to use an explicit SSL/TLS version */\r\n#if defined(__MAC_10_8) || defined(__IPHONE_5_0)\r\n  if(SSLSetProtocolVersionMax != NULL) {\r\n    switch(data->set.ssl.version) {\r\n      case CURL_SSLVERSION_DEFAULT: default:\r\n        (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kSSLProtocol3);\r\n        (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kTLSProtocol12);\r\n        break;\r\n      case CURL_SSLVERSION_TLSv1:\r\n        (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kTLSProtocol1);\r\n        (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kTLSProtocol12);\r\n        break;\r\n      case CURL_SSLVERSION_SSLv3:\r\n        (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kSSLProtocol3);\r\n        (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kSSLProtocol3);\r\n        break;\r\n      case CURL_SSLVERSION_SSLv2:\r\n        (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kSSLProtocol2);\r\n        (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kSSLProtocol2);\r\n    }\r\n  }\r\n  else {\r\n#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))\r\n    (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                       kSSLProtocolAll,\r\n                                       false);\r\n    switch (data->set.ssl.version) {\r\n      case CURL_SSLVERSION_DEFAULT: default:\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kSSLProtocol3,\r\n                                           true);\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kTLSProtocol1,\r\n                                           true);\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kTLSProtocol11,\r\n                                           true);\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kTLSProtocol12,\r\n                                           true);\r\n        break;\r\n      case CURL_SSLVERSION_TLSv1:\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kTLSProtocol1,\r\n                                           true);\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kTLSProtocol11,\r\n                                           true);\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kTLSProtocol12,\r\n                                           true);\r\n        break;\r\n      case CURL_SSLVERSION_SSLv3:\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kSSLProtocol3,\r\n                                           true);\r\n        break;\r\n      case CURL_SSLVERSION_SSLv2:\r\n        (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                           kSSLProtocol2,\r\n                                           true);\r\n        break;\r\n    }\r\n#endif  /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */\r\n  }\r\n#else\r\n  (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, kSSLProtocolAll, false);\r\n  switch(data->set.ssl.version) {\r\n    default:\r\n    case CURL_SSLVERSION_DEFAULT:\r\n      (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                         kSSLProtocol3,\r\n                                         true);\r\n      (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                         kTLSProtocol1,\r\n                                         true);\r\n      break;\r\n    case CURL_SSLVERSION_TLSv1:\r\n      (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                         kTLSProtocol1,\r\n                                         true);\r\n      break;\r\n    case CURL_SSLVERSION_SSLv2:\r\n      (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                         kSSLProtocol2,\r\n                                         true);\r\n      break;\r\n    case CURL_SSLVERSION_SSLv3:\r\n      (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,\r\n                                         kSSLProtocol3,\r\n                                         true);\r\n      break;\r\n  }\r\n#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */\r\n\r\n  /* No need to load certificates here. SecureTransport uses the Keychain\r\n   * (which is also part of the Security framework) to evaluate trust. */\r\n\r\n  /* SSL always tries to verify the peer, this only says whether it should\r\n   * fail to connect if the verification fails, or if it should continue\r\n   * anyway. In the latter case the result of the verification is checked with\r\n   * SSL_get_verify_result() below. */\r\n#if defined(__MAC_10_6) || defined(__IPHONE_5_0)\r\n  /* Snow Leopard introduced the SSLSetSessionOption() function, but due to\r\n     a library bug with the way the kSSLSessionOptionBreakOnServerAuth flag\r\n     works, it doesn't work as expected under Snow Leopard or Lion.\r\n     So we need to call SSLSetEnableCertVerify() on those older cats in order\r\n     to disable certificate validation if the user turned that off.\r\n     (SecureTransport will always validate the certificate chain by\r\n     default.) */\r\n  if(SSLSetSessionOption != NULL && IsRunningMountainLionOrLater()) {\r\n    err = SSLSetSessionOption(connssl->ssl_ctx,\r\n                              kSSLSessionOptionBreakOnServerAuth,\r\n                              data->set.ssl.verifypeer?false:true);\r\n    if(err != noErr) {\r\n      failf(data, \"SSL: SSLSetSessionOption() failed: OSStatus %d\", err);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n  else {\r\n#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))\r\n    err = SSLSetEnableCertVerify(connssl->ssl_ctx,\r\n                                 data->set.ssl.verifypeer?true:false);\r\n    if(err != noErr) {\r\n      failf(data, \"SSL: SSLSetEnableCertVerify() failed: OSStatus %d\", err);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */\r\n  }\r\n#else\r\n  err = SSLSetEnableCertVerify(connssl->ssl_ctx,\r\n                               data->set.ssl.verifypeer?true:false);\r\n  if(err != noErr) {\r\n    failf(data, \"SSL: SSLSetEnableCertVerify() failed: OSStatus %d\", err);\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n#endif /* defined(__MAC_10_6) || defined(__IPHONE_5_0) */\r\n\r\n  /* If this is a domain name and not an IP address, then configure SNI.\r\n   * Also: the verifyhost setting influences SNI usage */\r\n  /* If this is a domain name and not an IP address, then configure SNI: */\r\n  if((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) &&\r\n#ifdef ENABLE_IPV6\r\n     (0 == Curl_inet_pton(AF_INET6, conn->host.name, &addr)) &&\r\n#endif\r\n     data->set.ssl.verifyhost) {\r\n    err = SSLSetPeerDomainName(connssl->ssl_ctx, conn->host.name,\r\n                               strlen(conn->host.name));\r\n    if(err != noErr) {\r\n      infof(data, \"WARNING: SSL: SSLSetPeerDomainName() failed: OSStatus %d\",\r\n            err);\r\n    }\r\n  }\r\n\r\n  err = SSLSetIOFuncs(connssl->ssl_ctx, SocketRead, SocketWrite);\r\n  if(err != noErr) {\r\n    failf(data, \"SSL: SSLSetIOFuncs() failed: OSStatus %d\", err);\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  /* pass the raw socket into the SSL layers */\r\n  /* We need to store the FD in a constant memory address, because\r\n   * SSLSetConnection() will not copy that address. I've found that\r\n   * conn->sock[sockindex] may change on its own. */\r\n  connssl->ssl_sockfd = sockfd;\r\n  /*ssl_connection = &(connssl->ssl_sockfd);\r\n  err = SSLSetConnection(connssl->ssl_ctx, ssl_connection);*/\r\n  err = SSLSetConnection(connssl->ssl_ctx, connssl);\r\n  if(err != noErr) {\r\n    failf(data, \"SSL: SSLSetConnection() failed: %d\", err);\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  connssl->connecting_state = ssl_connect_2;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\ndarwinssl_connect_step2(struct connectdata *conn, int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  OSStatus err;\r\n  SSLCipherSuite cipher;\r\n  SSLProtocol protocol = 0;\r\n\r\n  DEBUGASSERT(ssl_connect_2 == connssl->connecting_state\r\n              || ssl_connect_2_reading == connssl->connecting_state\r\n              || ssl_connect_2_writing == connssl->connecting_state);\r\n\r\n  /* Here goes nothing: */\r\n  err = SSLHandshake(connssl->ssl_ctx);\r\n\r\n  if(err != noErr) {\r\n    switch (err) {\r\n      case errSSLWouldBlock:  /* they're not done with us yet */\r\n        connssl->connecting_state = connssl->ssl_direction ?\r\n            ssl_connect_2_writing : ssl_connect_2_reading;\r\n        return CURLE_OK;\r\n\r\n      case errSSLServerAuthCompleted:\r\n        /* the documentation says we need to call SSLHandshake() again */\r\n        return darwinssl_connect_step2(conn, sockindex);\r\n\r\n      case errSSLXCertChainInvalid:\r\n      case errSSLUnknownRootCert:\r\n      case errSSLNoRootCert:\r\n      case errSSLCertExpired:\r\n        failf(data, \"SSL certificate problem: OSStatus %d\", err);\r\n        return CURLE_SSL_CACERT;\r\n\r\n      case errSSLHostNameMismatch:\r\n        failf(data, \"SSL certificate peer verification failed, the \"\r\n              \"certificate did not match \\\"%s\\\"\\n\", conn->host.dispname);\r\n        return CURLE_PEER_FAILED_VERIFICATION;\r\n\r\n      default:\r\n        failf(data, \"Unknown SSL protocol error in connection to %s:%d\",\r\n              conn->host.name, err);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n  else {\r\n    /* we have been connected fine, we're not waiting for anything else. */\r\n    connssl->connecting_state = ssl_connect_3;\r\n\r\n    /* Informational message */\r\n    (void)SSLGetNegotiatedCipher(connssl->ssl_ctx, &cipher);\r\n    (void)SSLGetNegotiatedProtocolVersion(connssl->ssl_ctx, &protocol);\r\n    switch (protocol) {\r\n      case kSSLProtocol2:\r\n        infof(data, \"SSL 2.0 connection using %s\\n\",\r\n              SSLCipherNameForNumber(cipher));\r\n        break;\r\n      case kSSLProtocol3:\r\n        infof(data, \"SSL 3.0 connection using %s\\n\",\r\n              SSLCipherNameForNumber(cipher));\r\n        break;\r\n      case kTLSProtocol1:\r\n        infof(data, \"TLS 1.0 connection using %s\\n\",\r\n              TLSCipherNameForNumber(cipher));\r\n        break;\r\n#if defined(__MAC_10_8) || defined(__IPHONE_5_0)\r\n      case kTLSProtocol11:\r\n        infof(data, \"TLS 1.1 connection using %s\\n\",\r\n              TLSCipherNameForNumber(cipher));\r\n        break;\r\n      case kTLSProtocol12:\r\n        infof(data, \"TLS 1.2 connection using %s\\n\",\r\n              TLSCipherNameForNumber(cipher));\r\n        break;\r\n#endif\r\n      default:\r\n        infof(data, \"Unknown protocol connection\\n\");\r\n        break;\r\n    }\r\n\r\n    return CURLE_OK;\r\n  }\r\n}\r\n\r\nstatic CURLcode\r\ndarwinssl_connect_step3(struct connectdata *conn,\r\n                        int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  CFStringRef server_cert_summary;\r\n  char server_cert_summary_c[128];\r\n  CFArrayRef server_certs;\r\n  SecCertificateRef server_cert;\r\n  OSStatus err;\r\n  CFIndex i, count;\r\n  SecTrustRef trust;\r\n\r\n  /* There is no step 3!\r\n   * Well, okay, if verbose mode is on, let's print the details of the\r\n   * server certificates. */\r\n#if defined(__MAC_10_7) || defined(__IPHONE_5_0)\r\n#if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)\r\n#pragma unused(server_certs)\r\n  err = SSLCopyPeerTrust(connssl->ssl_ctx, &trust);\r\n  if(err == noErr) {\r\n    count = SecTrustGetCertificateCount(trust);\r\n    for(i = 0L ; i < count ; i++) {\r\n      server_cert = SecTrustGetCertificateAtIndex(trust, i);\r\n      server_cert_summary = SecCertificateCopySubjectSummary(server_cert);\r\n      memset(server_cert_summary_c, 0, 128);\r\n      if(CFStringGetCString(server_cert_summary,\r\n                            server_cert_summary_c,\r\n                            128,\r\n                            kCFStringEncodingUTF8)) {\r\n        infof(data, \"Server certificate: %s\\n\", server_cert_summary_c);\r\n      }\r\n      CFRelease(server_cert_summary);\r\n    }\r\n    CFRelease(trust);\r\n  }\r\n#else\r\n  /* SSLCopyPeerCertificates() is deprecated as of Mountain Lion.\r\n     The function SecTrustGetCertificateAtIndex() is officially present\r\n     in Lion, but it is unfortunately also present in Snow Leopard as\r\n     private API and doesn't work as expected. So we have to look for\r\n     a different symbol to make sure this code is only executed under\r\n     Lion or later. */\r\n  if(SecTrustEvaluateAsync != NULL) {\r\n#pragma unused(server_certs)\r\n    err = SSLCopyPeerTrust(connssl->ssl_ctx, &trust);\r\n    if(err == noErr) {\r\n      count = SecTrustGetCertificateCount(trust);\r\n      for(i = 0L ; i < count ; i++) {\r\n        server_cert = SecTrustGetCertificateAtIndex(trust, i);\r\n        server_cert_summary =\r\n          SecCertificateCopyLongDescription(NULL, server_cert, NULL);\r\n        memset(server_cert_summary_c, 0, 128);\r\n        if(CFStringGetCString(server_cert_summary,\r\n                              server_cert_summary_c,\r\n                              128,\r\n                              kCFStringEncodingUTF8)) {\r\n          infof(data, \"Server certificate: %s\\n\", server_cert_summary_c);\r\n        }\r\n        CFRelease(server_cert_summary);\r\n      }\r\n      CFRelease(trust);\r\n    }\r\n  }\r\n  else {\r\n    err = SSLCopyPeerCertificates(connssl->ssl_ctx, &server_certs);\r\n    if(err == noErr) {\r\n      count = CFArrayGetCount(server_certs);\r\n      for(i = 0L ; i < count ; i++) {\r\n        server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs,\r\n                                                                i);\r\n\r\n        server_cert_summary = SecCertificateCopySubjectSummary(server_cert);\r\n        memset(server_cert_summary_c, 0, 128);\r\n        if(CFStringGetCString(server_cert_summary,\r\n                              server_cert_summary_c,\r\n                              128,\r\n                              kCFStringEncodingUTF8)) {\r\n          infof(data, \"Server certificate: %s\\n\", server_cert_summary_c);\r\n        }\r\n        CFRelease(server_cert_summary);\r\n      }\r\n      CFRelease(server_certs);\r\n    }\r\n  }\r\n#endif /* (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) */\r\n#else\r\n#pragma unused(trust)\r\n  err = SSLCopyPeerCertificates(connssl->ssl_ctx, &server_certs);\r\n  if(err == noErr) {\r\n    count = CFArrayGetCount(server_certs);\r\n    for(i = 0L ; i < count ; i++) {\r\n      server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs, i);\r\n\r\n      server_cert_summary = SecCertificateCopySubjectSummary(server_cert);\r\n      memset(server_cert_summary_c, 0, 128);\r\n      if(CFStringGetCString(server_cert_summary,\r\n                            server_cert_summary_c,\r\n                            128,\r\n                            kCFStringEncodingUTF8)) {\r\n        infof(data, \"Server certificate: %s\\n\", server_cert_summary_c);\r\n      }\r\n      CFRelease(server_cert_summary);\r\n    }\r\n    CFRelease(server_certs);\r\n  }\r\n#endif /* defined(__MAC_10_7) || defined(__IPHONE_5_0) */\r\n\r\n  connssl->connecting_state = ssl_connect_done;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic Curl_recv darwinssl_recv;\r\nstatic Curl_send darwinssl_send;\r\n\r\nstatic CURLcode\r\ndarwinssl_connect_common(struct connectdata *conn,\r\n                         int sockindex,\r\n                         bool nonblocking,\r\n                         bool *done)\r\n{\r\n  CURLcode retcode;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long timeout_ms;\r\n  int what;\r\n\r\n  /* check if the connection has already been established */\r\n  if(ssl_connection_complete == connssl->state) {\r\n    *done = TRUE;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(ssl_connect_1==connssl->connecting_state) {\r\n    /* Find out how much more time we're allowed */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n    retcode = darwinssl_connect_step1(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  while(ssl_connect_2 == connssl->connecting_state ||\r\n        ssl_connect_2_reading == connssl->connecting_state ||\r\n        ssl_connect_2_writing == connssl->connecting_state) {\r\n\r\n    /* check allowed time left */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    /* if ssl is expecting something, check if it's available. */\r\n    if(connssl->connecting_state == ssl_connect_2_reading\r\n       || connssl->connecting_state == ssl_connect_2_writing) {\r\n\r\n      curl_socket_t writefd = ssl_connect_2_writing ==\r\n      connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n      curl_socket_t readfd = ssl_connect_2_reading ==\r\n      connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n\r\n      what = Curl_socket_ready(readfd, writefd, nonblocking?0:timeout_ms);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n      else if(0 == what) {\r\n        if(nonblocking) {\r\n          *done = FALSE;\r\n          return CURLE_OK;\r\n        }\r\n        else {\r\n          /* timeout */\r\n          failf(data, \"SSL connection timeout\");\r\n          return CURLE_OPERATION_TIMEDOUT;\r\n        }\r\n      }\r\n      /* socket is readable or writable */\r\n    }\r\n\r\n    /* Run transaction, and return to the caller if it failed or if this\r\n     * connection is done nonblocking and this loop would execute again. This\r\n     * permits the owner of a multi handle to abort a connection attempt\r\n     * before step2 has completed while ensuring that a client using select()\r\n     * or epoll() will always have a valid fdset to wait on.\r\n     */\r\n    retcode = darwinssl_connect_step2(conn, sockindex);\r\n    if(retcode || (nonblocking &&\r\n                   (ssl_connect_2 == connssl->connecting_state ||\r\n                    ssl_connect_2_reading == connssl->connecting_state ||\r\n                    ssl_connect_2_writing == connssl->connecting_state)))\r\n      return retcode;\r\n\r\n  } /* repeat step2 until all transactions are done. */\r\n\r\n\r\n  if(ssl_connect_3==connssl->connecting_state) {\r\n    retcode = darwinssl_connect_step3(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  if(ssl_connect_done==connssl->connecting_state) {\r\n    connssl->state = ssl_connection_complete;\r\n    conn->recv[sockindex] = darwinssl_recv;\r\n    conn->send[sockindex] = darwinssl_send;\r\n    *done = TRUE;\r\n  }\r\n  else\r\n    *done = FALSE;\r\n\r\n  /* Reset our connect state machine */\r\n  connssl->connecting_state = ssl_connect_1;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode\r\nCurl_darwinssl_connect_nonblocking(struct connectdata *conn,\r\n                                   int sockindex,\r\n                                   bool *done)\r\n{\r\n  return darwinssl_connect_common(conn, sockindex, TRUE, done);\r\n}\r\n\r\nCURLcode\r\nCurl_darwinssl_connect(struct connectdata *conn,\r\n                       int sockindex)\r\n{\r\n  CURLcode retcode;\r\n  bool done = FALSE;\r\n\r\n  retcode = darwinssl_connect_common(conn, sockindex, FALSE, &done);\r\n\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  DEBUGASSERT(done);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid Curl_darwinssl_close(struct connectdata *conn, int sockindex)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  if(connssl->ssl_ctx) {\r\n    (void)SSLClose(connssl->ssl_ctx);\r\n#if defined(__MAC_10_8) || defined(__IPHONE_5_0)\r\n    if(SSLCreateContext != NULL)\r\n      CFRelease(connssl->ssl_ctx);\r\n#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))\r\n    else\r\n      (void)SSLDisposeContext(connssl->ssl_ctx);\r\n#endif  /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */\r\n#else\r\n    (void)SSLDisposeContext(connssl->ssl_ctx);\r\n#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */\r\n    connssl->ssl_ctx = NULL;\r\n  }\r\n  connssl->ssl_sockfd = 0;\r\n}\r\n\r\nvoid Curl_darwinssl_close_all(struct SessionHandle *data)\r\n{\r\n  /* SecureTransport doesn't separate sessions from contexts, so... */\r\n  (void)data;\r\n}\r\n\r\nint Curl_darwinssl_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n  ssize_t nread;\r\n  int what;\r\n  int rc;\r\n  char buf[120];\r\n\r\n  if(!connssl->ssl_ctx)\r\n    return 0;\r\n\r\n  if(data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE)\r\n    return 0;\r\n\r\n  Curl_darwinssl_close(conn, sockindex);\r\n\r\n  rc = 0;\r\n\r\n  what = Curl_socket_ready(conn->sock[sockindex],\r\n                           CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);\r\n\r\n  for(;;) {\r\n    if(what < 0) {\r\n      /* anything that gets here is fatally bad */\r\n      failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n      rc = -1;\r\n      break;\r\n    }\r\n\r\n    if(!what) {                                /* timeout */\r\n      failf(data, \"SSL shutdown timeout\");\r\n      break;\r\n    }\r\n\r\n    /* Something to read, let's do it and hope that it is the close\r\n     notify alert from the server. No way to SSL_Read now, so use read(). */\r\n\r\n    nread = read(conn->sock[sockindex], buf, sizeof(buf));\r\n\r\n    if(nread < 0) {\r\n      failf(data, \"read: %s\", strerror(errno));\r\n      rc = -1;\r\n    }\r\n\r\n    if(nread <= 0)\r\n      break;\r\n\r\n    what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, 0);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\nsize_t Curl_darwinssl_version(char *buffer, size_t size)\r\n{\r\n  return snprintf(buffer, size, \"SecureTransport\");\r\n}\r\n\r\n/*\r\n * This function uses SSLGetSessionState to determine connection status.\r\n *\r\n * Return codes:\r\n *     1 means the connection is still in place\r\n *     0 means the connection has been closed\r\n *    -1 means the connection status is unknown\r\n */\r\nint Curl_darwinssl_check_cxn(struct connectdata *conn)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];\r\n  OSStatus err;\r\n  SSLSessionState state;\r\n\r\n  if(connssl->ssl_ctx) {\r\n    err = SSLGetSessionState(connssl->ssl_ctx, &state);\r\n    if(err == noErr)\r\n      return state == kSSLConnected || state == kSSLHandshake;\r\n    return -1;\r\n  }\r\n  return 0;\r\n}\r\n\r\nbool Curl_darwinssl_data_pending(const struct connectdata *conn,\r\n                                 int connindex)\r\n{\r\n  const struct ssl_connect_data *connssl = &conn->ssl[connindex];\r\n  OSStatus err;\r\n  size_t buffer;\r\n\r\n  if(connssl->ssl_ctx) {  /* SSL is in use */\r\n    err = SSLGetBufferedReadSize(connssl->ssl_ctx, &buffer);\r\n    if(err == noErr)\r\n      return buffer > 0UL;\r\n    return false;\r\n  }\r\n  else\r\n    return false;\r\n}\r\n\r\nvoid Curl_darwinssl_random(struct SessionHandle *data,\r\n                           unsigned char *entropy,\r\n                           size_t length)\r\n{\r\n  /* arc4random_buf() isn't available on cats older than Lion, so let's\r\n     do this manually for the benefit of the older cats. */\r\n  size_t i;\r\n  u_int32_t random_number = 0;\r\n\r\n  for(i = 0 ; i < length ; i++) {\r\n    if(i % sizeof(u_int32_t) == 0)\r\n      random_number = arc4random();\r\n    entropy[i] = random_number & 0xFF;\r\n    random_number >>= 8;\r\n  }\r\n  i = random_number = 0;\r\n  (void)data;\r\n}\r\n\r\nvoid Curl_darwinssl_md5sum(unsigned char *tmp, /* input */\r\n                           size_t tmplen,\r\n                           unsigned char *md5sum, /* output */\r\n                           size_t md5len)\r\n{\r\n  (void)md5len;\r\n  (void)CC_MD5(tmp, (CC_LONG)tmplen, md5sum);\r\n}\r\n\r\nstatic ssize_t darwinssl_send(struct connectdata *conn,\r\n                              int sockindex,\r\n                              const void *mem,\r\n                              size_t len,\r\n                              CURLcode *curlcode)\r\n{\r\n  /*struct SessionHandle *data = conn->data;*/\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  size_t processed = 0UL;\r\n  OSStatus err = SSLWrite(connssl->ssl_ctx, mem, len, &processed);\r\n\r\n  if(err != noErr) {\r\n    switch (err) {\r\n      case errSSLWouldBlock:  /* return how much we sent (if anything) */\r\n        if(processed)\r\n          return (ssize_t)processed;\r\n        *curlcode = CURLE_AGAIN;\r\n        return -1;\r\n        break;\r\n\r\n      default:\r\n        failf(conn->data, \"SSLWrite() return error %d\", err);\r\n        *curlcode = CURLE_SEND_ERROR;\r\n        return -1;\r\n        break;\r\n    }\r\n  }\r\n  return (ssize_t)processed;\r\n}\r\n\r\nstatic ssize_t darwinssl_recv(struct connectdata *conn,\r\n                              int num,\r\n                              char *buf,\r\n                              size_t buffersize,\r\n                              CURLcode *curlcode)\r\n{\r\n  /*struct SessionHandle *data = conn->data;*/\r\n  struct ssl_connect_data *connssl = &conn->ssl[num];\r\n  size_t processed = 0UL;\r\n  OSStatus err = SSLRead(connssl->ssl_ctx, buf, buffersize, &processed);\r\n\r\n  if(err != noErr) {\r\n    switch (err) {\r\n      case errSSLWouldBlock:  /* return how much we read (if anything) */\r\n        if(processed)\r\n          return (ssize_t)processed;\r\n        *curlcode = CURLE_AGAIN;\r\n        return -1;\r\n        break;\r\n\r\n      case errSSLClosedGraceful: /* they're done; fail gracefully */\r\n        *curlcode = CURLE_OK;\r\n        return -1;\r\n        break;\r\n\r\n      default:\r\n        failf(conn->data, \"SSLRead() return error %d\", err);\r\n        *curlcode = CURLE_RECV_ERROR;\r\n        return -1;\r\n        break;\r\n    }\r\n  }\r\n  return (ssize_t)processed;\r\n}\r\n\r\n#endif /* USE_DARWINSSL */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_darwinssl.h",
    "content": "#ifndef HEADER_CURL_DARWINSSL_H\r\n#define HEADER_CURL_DARWINSSL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, Nick Zitzmann, <nickzman@gmail.com>.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_DARWINSSL\r\n\r\nCURLcode Curl_darwinssl_connect(struct connectdata *conn, int sockindex);\r\n\r\nCURLcode Curl_darwinssl_connect_nonblocking(struct connectdata *conn,\r\n                                            int sockindex,\r\n                                            bool *done);\r\n\r\n/* this function doesn't actually do anything */\r\nvoid Curl_darwinssl_close_all(struct SessionHandle *data);\r\n\r\n/* close a SSL connection */\r\nvoid Curl_darwinssl_close(struct connectdata *conn, int sockindex);\r\n\r\nsize_t Curl_darwinssl_version(char *buffer, size_t size);\r\nint Curl_darwinssl_shutdown(struct connectdata *conn, int sockindex);\r\nint Curl_darwinssl_check_cxn(struct connectdata *conn);\r\nbool Curl_darwinssl_data_pending(const struct connectdata *conn,\r\n                                 int connindex);\r\n\r\nvoid Curl_darwinssl_random(struct SessionHandle *data,\r\n                           unsigned char *entropy,\r\n                           size_t length);\r\nvoid Curl_darwinssl_md5sum(unsigned char *tmp, /* input */\r\n                           size_t tmplen,\r\n                           unsigned char *md5sum, /* output */\r\n                           size_t md5len);\r\n\r\n/* API setup for SecureTransport */\r\n#define curlssl_init() (1)\r\n#define curlssl_cleanup() Curl_nop_stmt\r\n#define curlssl_connect Curl_darwinssl_connect\r\n#define curlssl_connect_nonblocking Curl_darwinssl_connect_nonblocking\r\n#define curlssl_session_free(x) Curl_nop_stmt\r\n#define curlssl_close_all Curl_darwinssl_close_all\r\n#define curlssl_close Curl_darwinssl_close\r\n#define curlssl_shutdown(x,y) 0\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_darwinssl_version\r\n#define curlssl_check_cxn Curl_darwinssl_check_cxn\r\n#define curlssl_data_pending(x,y) Curl_darwinssl_data_pending(x, y)\r\n#define curlssl_random(x,y,z) Curl_darwinssl_random(x,y,z)\r\n#define curlssl_md5sum(a,b,c,d) Curl_darwinssl_md5sum(a,b,c,d)\r\n\r\n#endif /* USE_DARWINSSL */\r\n#endif /* HEADER_CURL_DARWINSSL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_fnmatch.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"curl_fnmatch.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define CURLFNM_CHARSET_LEN (sizeof(char) * 256)\r\n#define CURLFNM_CHSET_SIZE (CURLFNM_CHARSET_LEN + 15)\r\n\r\n#define CURLFNM_NEGATE  CURLFNM_CHARSET_LEN\r\n\r\n#define CURLFNM_ALNUM   (CURLFNM_CHARSET_LEN + 1)\r\n#define CURLFNM_DIGIT   (CURLFNM_CHARSET_LEN + 2)\r\n#define CURLFNM_XDIGIT  (CURLFNM_CHARSET_LEN + 3)\r\n#define CURLFNM_ALPHA   (CURLFNM_CHARSET_LEN + 4)\r\n#define CURLFNM_PRINT   (CURLFNM_CHARSET_LEN + 5)\r\n#define CURLFNM_BLANK   (CURLFNM_CHARSET_LEN + 6)\r\n#define CURLFNM_LOWER   (CURLFNM_CHARSET_LEN + 7)\r\n#define CURLFNM_GRAPH   (CURLFNM_CHARSET_LEN + 8)\r\n#define CURLFNM_SPACE   (CURLFNM_CHARSET_LEN + 9)\r\n#define CURLFNM_UPPER   (CURLFNM_CHARSET_LEN + 10)\r\n\r\ntypedef enum {\r\n  CURLFNM_LOOP_DEFAULT = 0,\r\n  CURLFNM_LOOP_BACKSLASH\r\n} loop_state;\r\n\r\ntypedef enum {\r\n  CURLFNM_SCHS_DEFAULT = 0,\r\n  CURLFNM_SCHS_MAYRANGE,\r\n  CURLFNM_SCHS_MAYRANGE2,\r\n  CURLFNM_SCHS_RIGHTBR,\r\n  CURLFNM_SCHS_RIGHTBRLEFTBR\r\n} setcharset_state;\r\n\r\ntypedef enum {\r\n  CURLFNM_PKW_INIT = 0,\r\n  CURLFNM_PKW_DDOT\r\n} parsekey_state;\r\n\r\n#define SETCHARSET_OK     1\r\n#define SETCHARSET_FAIL   0\r\n\r\nstatic int parsekeyword(unsigned char **pattern, unsigned char *charset)\r\n{\r\n  parsekey_state state = CURLFNM_PKW_INIT;\r\n#define KEYLEN 10\r\n  char keyword[KEYLEN] = { 0 };\r\n  int found = FALSE;\r\n  int i;\r\n  unsigned char *p = *pattern;\r\n  for(i = 0; !found; i++) {\r\n    char c = *p++;\r\n    if(i >= KEYLEN)\r\n      return SETCHARSET_FAIL;\r\n    switch(state) {\r\n    case CURLFNM_PKW_INIT:\r\n      if(ISALPHA(c) && ISLOWER(c))\r\n        keyword[i] = c;\r\n      else if(c == ':')\r\n        state = CURLFNM_PKW_DDOT;\r\n      else\r\n        return 0;\r\n      break;\r\n    case CURLFNM_PKW_DDOT:\r\n      if(c == ']')\r\n        found = TRUE;\r\n      else\r\n        return SETCHARSET_FAIL;\r\n    }\r\n  }\r\n#undef KEYLEN\r\n\r\n  *pattern = p; /* move caller's pattern pointer */\r\n  if(strcmp(keyword, \"digit\") == 0)\r\n    charset[CURLFNM_DIGIT] = 1;\r\n  else if(strcmp(keyword, \"alnum\") == 0)\r\n    charset[CURLFNM_ALNUM] = 1;\r\n  else if(strcmp(keyword, \"alpha\") == 0)\r\n    charset[CURLFNM_ALPHA] = 1;\r\n  else if(strcmp(keyword, \"xdigit\") == 0)\r\n    charset[CURLFNM_XDIGIT] = 1;\r\n  else if(strcmp(keyword, \"print\") == 0)\r\n    charset[CURLFNM_PRINT] = 1;\r\n  else if(strcmp(keyword, \"graph\") == 0)\r\n    charset[CURLFNM_GRAPH] = 1;\r\n  else if(strcmp(keyword, \"space\") == 0)\r\n    charset[CURLFNM_SPACE] = 1;\r\n  else if(strcmp(keyword, \"blank\") == 0)\r\n    charset[CURLFNM_BLANK] = 1;\r\n  else if(strcmp(keyword, \"upper\") == 0)\r\n    charset[CURLFNM_UPPER] = 1;\r\n  else if(strcmp(keyword, \"lower\") == 0)\r\n    charset[CURLFNM_LOWER] = 1;\r\n  else\r\n    return SETCHARSET_FAIL;\r\n  return SETCHARSET_OK;\r\n}\r\n\r\n/* returns 1 (true) if pattern is OK, 0 if is bad (\"p\" is pattern pointer) */\r\nstatic int setcharset(unsigned char **p, unsigned char *charset)\r\n{\r\n  setcharset_state state = CURLFNM_SCHS_DEFAULT;\r\n  unsigned char rangestart = 0;\r\n  unsigned char lastchar   = 0;\r\n  bool something_found = FALSE;\r\n  unsigned char c;\r\n  for(;;) {\r\n    c = **p;\r\n    switch(state) {\r\n    case CURLFNM_SCHS_DEFAULT:\r\n      if(ISALNUM(c)) { /* ASCII value */\r\n        rangestart = c;\r\n        charset[c] = 1;\r\n        (*p)++;\r\n        state = CURLFNM_SCHS_MAYRANGE;\r\n        something_found = TRUE;\r\n      }\r\n      else if(c == ']') {\r\n        if(something_found)\r\n          return SETCHARSET_OK;\r\n        else\r\n          something_found = TRUE;\r\n        state = CURLFNM_SCHS_RIGHTBR;\r\n        charset[c] = 1;\r\n        (*p)++;\r\n      }\r\n      else if(c == '[') {\r\n        char c2 = *((*p)+1);\r\n        if(c2 == ':') { /* there has to be a keyword */\r\n          (*p) += 2;\r\n          if(parsekeyword(p, charset)) {\r\n            state = CURLFNM_SCHS_DEFAULT;\r\n          }\r\n          else\r\n            return SETCHARSET_FAIL;\r\n        }\r\n        else {\r\n          charset[c] = 1;\r\n          (*p)++;\r\n        }\r\n        something_found = TRUE;\r\n      }\r\n      else if(c == '?' || c == '*') {\r\n        something_found = TRUE;\r\n        charset[c] = 1;\r\n        (*p)++;\r\n      }\r\n      else if(c == '^' || c == '!') {\r\n        if(!something_found) {\r\n          if(charset[CURLFNM_NEGATE]) {\r\n            charset[c] = 1;\r\n            something_found = TRUE;\r\n          }\r\n          else\r\n            charset[CURLFNM_NEGATE] = 1; /* negate charset */\r\n        }\r\n        else\r\n          charset[c] = 1;\r\n        (*p)++;\r\n      }\r\n      else if(c == '\\\\') {\r\n        c = *(++(*p));\r\n        if(ISPRINT((c))) {\r\n          something_found = TRUE;\r\n          state = CURLFNM_SCHS_MAYRANGE;\r\n          charset[c] = 1;\r\n          rangestart = c;\r\n          (*p)++;\r\n        }\r\n        else\r\n          return SETCHARSET_FAIL;\r\n      }\r\n      else if(c == '\\0') {\r\n        return SETCHARSET_FAIL;\r\n      }\r\n      else {\r\n        charset[c] = 1;\r\n        (*p)++;\r\n        something_found = TRUE;\r\n      }\r\n      break;\r\n    case CURLFNM_SCHS_MAYRANGE:\r\n      if(c == '-') {\r\n        charset[c] = 1;\r\n        (*p)++;\r\n        lastchar = '-';\r\n        state = CURLFNM_SCHS_MAYRANGE2;\r\n      }\r\n      else if(c == '[') {\r\n        state = CURLFNM_SCHS_DEFAULT;\r\n      }\r\n      else if(ISALNUM(c)) {\r\n        charset[c] = 1;\r\n        (*p)++;\r\n      }\r\n      else if(c == '\\\\') {\r\n        c = *(++(*p));\r\n        if(ISPRINT(c)) {\r\n          charset[c] = 1;\r\n          (*p)++;\r\n        }\r\n        else\r\n          return SETCHARSET_FAIL;\r\n      }\r\n      else if(c == ']') {\r\n        return SETCHARSET_OK;\r\n      }\r\n      else\r\n        return SETCHARSET_FAIL;\r\n      break;\r\n    case CURLFNM_SCHS_MAYRANGE2:\r\n      if(c == '\\\\') {\r\n        c = *(++(*p));\r\n        if(!ISPRINT(c))\r\n          return SETCHARSET_FAIL;\r\n      }\r\n      if(c == ']') {\r\n        return SETCHARSET_OK;\r\n      }\r\n      else if(c == '\\\\') {\r\n        c = *(++(*p));\r\n        if(ISPRINT(c)) {\r\n          charset[c] = 1;\r\n          state = CURLFNM_SCHS_DEFAULT;\r\n          (*p)++;\r\n        }\r\n        else\r\n          return SETCHARSET_FAIL;\r\n      }\r\n      if(c >= rangestart) {\r\n        if((ISLOWER(c) && ISLOWER(rangestart)) ||\r\n           (ISDIGIT(c) && ISDIGIT(rangestart)) ||\r\n           (ISUPPER(c) && ISUPPER(rangestart))) {\r\n          charset[lastchar] = 0;\r\n          rangestart++;\r\n          while(rangestart++ <= c)\r\n            charset[rangestart-1] = 1;\r\n          (*p)++;\r\n          state = CURLFNM_SCHS_DEFAULT;\r\n        }\r\n        else\r\n          return SETCHARSET_FAIL;\r\n      }\r\n      break;\r\n    case CURLFNM_SCHS_RIGHTBR:\r\n      if(c == '[') {\r\n        state = CURLFNM_SCHS_RIGHTBRLEFTBR;\r\n        charset[c] = 1;\r\n        (*p)++;\r\n      }\r\n      else if(c == ']') {\r\n        return SETCHARSET_OK;\r\n      }\r\n      else if(c == '\\0') {\r\n        return SETCHARSET_FAIL;\r\n      }\r\n      else if(ISPRINT(c)) {\r\n        charset[c] = 1;\r\n        (*p)++;\r\n        state = CURLFNM_SCHS_DEFAULT;\r\n      }\r\n      else\r\n        /* used 'goto fail' instead of 'return SETCHARSET_FAIL' to avoid a\r\n         * nonsense warning 'statement not reached' at end of the fnc when\r\n         * compiling on Solaris */\r\n        goto fail;\r\n      break;\r\n    case CURLFNM_SCHS_RIGHTBRLEFTBR:\r\n      if(c == ']') {\r\n        return SETCHARSET_OK;\r\n      }\r\n      else {\r\n        state  = CURLFNM_SCHS_DEFAULT;\r\n        charset[c] = 1;\r\n        (*p)++;\r\n      }\r\n      break;\r\n    }\r\n  }\r\nfail:\r\n  return SETCHARSET_FAIL;\r\n}\r\n\r\nstatic int loop(const unsigned char *pattern, const unsigned char *string)\r\n{\r\n  loop_state state = CURLFNM_LOOP_DEFAULT;\r\n  unsigned char *p = (unsigned char *)pattern;\r\n  unsigned char *s = (unsigned char *)string;\r\n  unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 };\r\n  int rc = 0;\r\n\r\n  for(;;) {\r\n    switch(state) {\r\n    case CURLFNM_LOOP_DEFAULT:\r\n      if(*p == '*') {\r\n        while(*(p+1) == '*') /* eliminate multiple stars */\r\n          p++;\r\n        if(*s == '\\0' && *(p+1) == '\\0')\r\n          return CURL_FNMATCH_MATCH;\r\n        rc = loop(p + 1, s); /* *.txt matches .txt <=> .txt matches .txt */\r\n        if(rc == CURL_FNMATCH_MATCH)\r\n          return CURL_FNMATCH_MATCH;\r\n        if(*s) /* let the star eat up one character */\r\n          s++;\r\n        else\r\n          return CURL_FNMATCH_NOMATCH;\r\n      }\r\n      else if(*p == '?') {\r\n        if(ISPRINT(*s)) {\r\n          s++;\r\n          p++;\r\n        }\r\n        else if(*s == '\\0')\r\n          return CURL_FNMATCH_NOMATCH;\r\n        else\r\n          return CURL_FNMATCH_FAIL; /* cannot deal with other character */\r\n      }\r\n      else if(*p == '\\0') {\r\n        if(*s == '\\0')\r\n          return CURL_FNMATCH_MATCH;\r\n        else\r\n          return CURL_FNMATCH_NOMATCH;\r\n      }\r\n      else if(*p == '\\\\') {\r\n        state = CURLFNM_LOOP_BACKSLASH;\r\n        p++;\r\n      }\r\n      else if(*p == '[') {\r\n        unsigned char *pp = p+1; /* cannot handle with pointer to register */\r\n        if(setcharset(&pp, charset)) {\r\n          int found = FALSE;\r\n          if(charset[(unsigned int)*s])\r\n            found = TRUE;\r\n          else if(charset[CURLFNM_ALNUM])\r\n            found = ISALNUM(*s);\r\n          else if(charset[CURLFNM_ALPHA])\r\n            found = ISALPHA(*s);\r\n          else if(charset[CURLFNM_DIGIT])\r\n            found = ISDIGIT(*s);\r\n          else if(charset[CURLFNM_XDIGIT])\r\n            found = ISXDIGIT(*s);\r\n          else if(charset[CURLFNM_PRINT])\r\n            found = ISPRINT(*s);\r\n          else if(charset[CURLFNM_SPACE])\r\n            found = ISSPACE(*s);\r\n          else if(charset[CURLFNM_UPPER])\r\n            found = ISUPPER(*s);\r\n          else if(charset[CURLFNM_LOWER])\r\n            found = ISLOWER(*s);\r\n          else if(charset[CURLFNM_BLANK])\r\n            found = ISBLANK(*s);\r\n          else if(charset[CURLFNM_GRAPH])\r\n            found = ISGRAPH(*s);\r\n\r\n          if(charset[CURLFNM_NEGATE])\r\n            found = !found;\r\n\r\n          if(found) {\r\n            p = pp+1;\r\n            s++;\r\n            memset(charset, 0, CURLFNM_CHSET_SIZE);\r\n          }\r\n          else\r\n            return CURL_FNMATCH_NOMATCH;\r\n        }\r\n        else\r\n          return CURL_FNMATCH_FAIL;\r\n      }\r\n      else {\r\n        if(*p++ != *s++)\r\n          return CURL_FNMATCH_NOMATCH;\r\n      }\r\n      break;\r\n    case CURLFNM_LOOP_BACKSLASH:\r\n      if(ISPRINT(*p)) {\r\n        if(*p++ == *s++)\r\n          state = CURLFNM_LOOP_DEFAULT;\r\n        else\r\n          return CURL_FNMATCH_NOMATCH;\r\n      }\r\n      else\r\n        return CURL_FNMATCH_FAIL;\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n * @unittest: 1307\r\n */\r\nint Curl_fnmatch(void *ptr, const char *pattern, const char *string)\r\n{\r\n  (void)ptr; /* the argument is specified by the curl_fnmatch_callback\r\n                prototype, but not used by Curl_fnmatch() */\r\n  if(!pattern || !string) {\r\n    return CURL_FNMATCH_FAIL;\r\n  }\r\n  return loop((unsigned char *)pattern, (unsigned char *)string);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_fnmatch.h",
    "content": "#ifndef HEADER_CURL_FNMATCH_H\r\n#define HEADER_CURL_FNMATCH_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#define CURL_FNMATCH_MATCH    0\r\n#define CURL_FNMATCH_NOMATCH  1\r\n#define CURL_FNMATCH_FAIL     2\r\n\r\n/* default pattern matching function\r\n * =================================\r\n * Implemented with recursive backtracking, if you want to use Curl_fnmatch,\r\n * please note that there is not implemented UTF/UNICODE support.\r\n *\r\n * Implemented features:\r\n * '?' notation, does not match UTF characters\r\n * '*' can also work with UTF string\r\n * [a-zA-Z0-9] enumeration support\r\n *\r\n * keywords: alnum, digit, xdigit, alpha, print, blank, lower, graph, space\r\n *           and upper (use as \"[[:alnum:]]\")\r\n */\r\nint Curl_fnmatch(void *ptr, const char *pattern, const char *string);\r\n\r\n#endif /* HEADER_CURL_FNMATCH_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_gethostname.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"curl_gethostname.h\"\r\n\r\n/*\r\n * Curl_gethostname() is a wrapper around gethostname() which allows\r\n * overriding the host name that the function would normally return.\r\n * This capability is used by the test suite to verify exact matching\r\n * of NTLM authentication, which exercises libcurl's MD4 and DES code\r\n * as well as by the SMTP module when a hostname is not provided.\r\n *\r\n * For libcurl debug enabled builds host name overriding takes place\r\n * when environment variable CURL_GETHOSTNAME is set, using the value\r\n * held by the variable to override returned host name.\r\n *\r\n * Note: The function always returns the un-qualified hostname rather\r\n * than being provider dependent.\r\n *\r\n * For libcurl shared library release builds the test suite preloads\r\n * another shared library named libhostname using the LD_PRELOAD\r\n * mechanism which intercepts, and might override, the gethostname()\r\n * function call. In this case a given platform must support the\r\n * LD_PRELOAD mechanism and additionally have environment variable\r\n * CURL_GETHOSTNAME set in order to override the returned host name.\r\n *\r\n * For libcurl static library release builds no overriding takes place.\r\n */\r\n\r\nint Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) {\r\n\r\n#ifndef HAVE_GETHOSTNAME\r\n\r\n  /* Allow compilation and return failure when unavailable */\r\n  (void) name;\r\n  (void) namelen;\r\n  return -1;\r\n\r\n#else\r\n  int err;\r\n  char* dot;\r\n\r\n#ifdef DEBUGBUILD\r\n\r\n  /* Override host name when environment variable CURL_GETHOSTNAME is set */\r\n  const char *force_hostname = getenv(\"CURL_GETHOSTNAME\");\r\n  if(force_hostname) {\r\n    strncpy(name, force_hostname, namelen);\r\n    err = 0;\r\n  }\r\n  else {\r\n    name[0] = '\\0';\r\n    err = gethostname(name, namelen);\r\n  }\r\n\r\n#else /* DEBUGBUILD */\r\n\r\n  /* The call to system's gethostname() might get intercepted by the\r\n     libhostname library when libcurl is built as a non-debug shared\r\n     library when running the test suite. */\r\n  name[0] = '\\0';\r\n  err = gethostname(name, namelen);\r\n\r\n#endif\r\n\r\n  name[namelen - 1] = '\\0';\r\n\r\n  if(err)\r\n    return err;\r\n\r\n  /* Truncate domain, leave only machine name */\r\n  dot = strchr(name, '.');\r\n  if(dot)\r\n    *dot = '\\0';\r\n\r\n  return 0;\r\n#endif\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_gethostname.h",
    "content": "#ifndef HEADER_CURL_GETHOSTNAME_H\r\n#define HEADER_CURL_GETHOSTNAME_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* Hostname buffer size */\r\n#define HOSTNAME_MAX 1024\r\n\r\n/* This returns the local machine's un-qualified hostname */\r\nint Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen);\r\n\r\n#endif /* HEADER_CURL_GETHOSTNAME_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_gssapi.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_GSSAPI\r\n\r\n#include \"curl_gssapi.h\"\r\n#include \"sendf.h\"\r\n\r\nOM_uint32 Curl_gss_init_sec_context(\r\n    struct SessionHandle *data,\r\n    OM_uint32 * minor_status,\r\n    gss_ctx_id_t * context,\r\n    gss_name_t target_name,\r\n    gss_channel_bindings_t input_chan_bindings,\r\n    gss_buffer_t input_token,\r\n    gss_buffer_t output_token,\r\n    OM_uint32 * ret_flags)\r\n{\r\n  OM_uint32 req_flags = GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG;\r\n\r\n  if(data->set.gssapi_delegation & CURLGSSAPI_DELEGATION_POLICY_FLAG) {\r\n#ifdef GSS_C_DELEG_POLICY_FLAG\r\n    req_flags |= GSS_C_DELEG_POLICY_FLAG;\r\n#else\r\n    infof(data, \"warning: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not \"\r\n        \"compiled in\\n\");\r\n#endif\r\n  }\r\n\r\n  if(data->set.gssapi_delegation & CURLGSSAPI_DELEGATION_FLAG)\r\n    req_flags |= GSS_C_DELEG_FLAG;\r\n\r\n  return gss_init_sec_context(minor_status,\r\n                              GSS_C_NO_CREDENTIAL, /* cred_handle */\r\n                              context,\r\n                              target_name,\r\n                              GSS_C_NO_OID, /* mech_type */\r\n                              req_flags,\r\n                              0, /* time_req */\r\n                              input_chan_bindings,\r\n                              input_token,\r\n                              NULL, /* actual_mech_type */\r\n                              output_token,\r\n                              ret_flags,\r\n                              NULL /* time_rec */);\r\n}\r\n\r\n#endif /* HAVE_GSSAPI */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_gssapi.h",
    "content": "#ifndef HEADER_CURL_GSSAPI_H\r\n#define HEADER_CURL_GSSAPI_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n#include \"urldata.h\"\r\n\r\n#ifdef HAVE_GSSAPI\r\n\r\n#ifdef HAVE_GSSGNU\r\n#  include <gss.h>\r\n#elif defined HAVE_GSSMIT\r\n   /* MIT style */\r\n#  include <gssapi/gssapi.h>\r\n#  include <gssapi/gssapi_generic.h>\r\n#  include <gssapi/gssapi_krb5.h>\r\n#else\r\n   /* Heimdal-style */\r\n#  include <gssapi.h>\r\n#endif\r\n\r\n\r\n/* Common method for using gss api */\r\n\r\nOM_uint32 Curl_gss_init_sec_context(\r\n    struct SessionHandle *data,\r\n    OM_uint32 * minor_status,\r\n    gss_ctx_id_t * context,\r\n    gss_name_t target_name,\r\n    gss_channel_bindings_t input_chan_bindings,\r\n    gss_buffer_t input_token,\r\n    gss_buffer_t output_token,\r\n    OM_uint32 * ret_flags);\r\n\r\n#endif /* HAVE_GSSAPI */\r\n\r\n#endif /* HEADER_CURL_GSSAPI_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_hmac.h",
    "content": "#ifndef HEADER_CURL_HMAC_H\r\n#define HEADER_CURL_HMAC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n\r\ntypedef void    (* HMAC_hinit_func)(void * context);\r\ntypedef void    (* HMAC_hupdate_func)(void * context,\r\n                                      const unsigned char * data,\r\n                                      unsigned int len);\r\ntypedef void    (* HMAC_hfinal_func)(unsigned char * result, void * context);\r\n\r\n\r\n/* Per-hash function HMAC parameters. */\r\n\r\ntypedef struct {\r\n  HMAC_hinit_func       hmac_hinit;     /* Initialize context procedure. */\r\n  HMAC_hupdate_func     hmac_hupdate;   /* Update context with data. */\r\n  HMAC_hfinal_func      hmac_hfinal;    /* Get final result procedure. */\r\n  unsigned int          hmac_ctxtsize;  /* Context structure size. */\r\n  unsigned int          hmac_maxkeylen; /* Maximum key length (bytes). */\r\n  unsigned int          hmac_resultlen; /* Result length (bytes). */\r\n} HMAC_params;\r\n\r\n\r\n/* HMAC computation context. */\r\n\r\ntypedef struct {\r\n  const HMAC_params *   hmac_hash;      /* Hash function definition. */\r\n  void *                hmac_hashctxt1; /* Hash function context 1. */\r\n  void *                hmac_hashctxt2; /* Hash function context 2. */\r\n} HMAC_context;\r\n\r\n\r\n/* Prototypes. */\r\n\r\nHMAC_context * Curl_HMAC_init(const HMAC_params * hashparams,\r\n                              const unsigned char * key,\r\n                              unsigned int keylen);\r\nint Curl_HMAC_update(HMAC_context * context,\r\n                     const unsigned char * data,\r\n                     unsigned int len);\r\nint Curl_HMAC_final(HMAC_context * context, unsigned char * result);\r\n\r\n#endif\r\n\r\n#endif /* HEADER_CURL_HMAC_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ldap.h",
    "content": "#ifndef HEADER_CURL_LDAP_H\r\n#define HEADER_CURL_LDAP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifndef CURL_DISABLE_LDAP\r\nextern const struct Curl_handler Curl_handler_ldap;\r\n\r\n#if !defined(CURL_DISABLE_LDAPS) && \\\r\n    ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \\\r\n     (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))\r\nextern const struct Curl_handler Curl_handler_ldaps;\r\n#endif\r\n\r\n#endif\r\n#endif /* HEADER_CURL_LDAP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_md4.h",
    "content": "#ifndef HEADER_CURL_MD4_H\r\n#define HEADER_CURL_MD4_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n/* NSS crypto library does not provide the MD4 hash algorithm, so that we have\r\n * a local implementation of it */\r\n#ifdef USE_NSS\r\nvoid Curl_md4it(unsigned char *output, const unsigned char *input, size_t len);\r\n#endif /* USE_NSS */\r\n\r\n#endif /* HEADER_CURL_MD4_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_md5.h",
    "content": "#ifndef HEADER_CURL_MD5_H\r\n#define HEADER_CURL_MD5_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n#include \"curl_hmac.h\"\r\n\r\n#define MD5_DIGEST_LEN  16\r\n\r\ntypedef void (* Curl_MD5_init_func)(void *context);\r\ntypedef void (* Curl_MD5_update_func)(void *context,\r\n                                      const unsigned char *data,\r\n                                      unsigned int len);\r\ntypedef void (* Curl_MD5_final_func)(unsigned char *result, void *context);\r\n\r\ntypedef struct {\r\n  Curl_MD5_init_func     md5_init_func;   /* Initialize context procedure */\r\n  Curl_MD5_update_func   md5_update_func; /* Update context with data */\r\n  Curl_MD5_final_func    md5_final_func;  /* Get final result procedure */\r\n  unsigned int           md5_ctxtsize;  /* Context structure size */\r\n  unsigned int           md5_resultlen; /* Result length (bytes) */\r\n} MD5_params;\r\n\r\ntypedef struct {\r\n  const MD5_params      *md5_hash;      /* Hash function definition */\r\n  void                  *md5_hashctx;   /* Hash function context */\r\n} MD5_context;\r\n\r\nextern const MD5_params Curl_DIGEST_MD5[1];\r\nextern const HMAC_params Curl_HMAC_MD5[1];\r\n\r\nvoid Curl_md5it(unsigned char *output,\r\n                const unsigned char *input);\r\n\r\nMD5_context * Curl_MD5_init(const MD5_params *md5params);\r\nint Curl_MD5_update(MD5_context *context,\r\n                    const unsigned char *data,\r\n                    unsigned int len);\r\nint Curl_MD5_final(MD5_context *context, unsigned char *result);\r\n\r\n#endif\r\n\r\n#endif /* HEADER_CURL_MD5_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_memory.h",
    "content": "#ifndef HEADER_CURL_MEMORY_H\r\n#define HEADER_CURL_MEMORY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h> /* for the typedefs */\r\n\r\nextern curl_malloc_callback Curl_cmalloc;\r\nextern curl_free_callback Curl_cfree;\r\nextern curl_realloc_callback Curl_crealloc;\r\nextern curl_strdup_callback Curl_cstrdup;\r\nextern curl_calloc_callback Curl_ccalloc;\r\n\r\n#ifndef CURLDEBUG\r\n/* Only do this define-mania if we're not using the memdebug system, as that\r\n   has preference on this magic. */\r\n#undef strdup\r\n#define strdup(ptr) Curl_cstrdup(ptr)\r\n#undef malloc\r\n#define malloc(size) Curl_cmalloc(size)\r\n#undef calloc\r\n#define calloc(nbelem,size) Curl_ccalloc(nbelem, size)\r\n#undef realloc\r\n#define realloc(ptr,size) Curl_crealloc(ptr, size)\r\n#undef free\r\n#define free(ptr) Curl_cfree(ptr)\r\n\r\n#endif\r\n\r\n#endif /* HEADER_CURL_MEMORY_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_memrchr.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"curl_memrchr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifndef HAVE_MEMRCHR\r\n\r\n/*\r\n * Curl_memrchr()\r\n *\r\n * Our memrchr() function clone for systems which lack this function. The\r\n * memrchr() function is like the memchr() function, except that it searches\r\n * backwards from the end of the n bytes pointed to by s instead of forward\r\n * from the beginning.\r\n */\r\n\r\nvoid *\r\nCurl_memrchr(const void *s, int c, size_t n)\r\n{\r\n  const unsigned char *p = s;\r\n  const unsigned char *q = s;\r\n\r\n  p += n - 1;\r\n\r\n  while(p >= q) {\r\n    if(*p == (unsigned char)c)\r\n      return (void *)p;\r\n    p--;\r\n  }\r\n\r\n  return NULL;\r\n}\r\n\r\n#endif /* HAVE_MEMRCHR */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_memrchr.h",
    "content": "#ifndef HEADER_CURL_MEMRCHR_H\r\n#define HEADER_CURL_MEMRCHR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_MEMRCHR\r\n\r\n#ifdef HAVE_STRING_H\r\n#  include <string.h>\r\n#endif\r\n#ifdef HAVE_STRINGS_H\r\n#  include <strings.h>\r\n#endif\r\n\r\n#else /* HAVE_MEMRCHR */\r\n\r\nvoid *Curl_memrchr(const void *s, int c, size_t n);\r\n\r\n#define memrchr(x,y,z) Curl_memrchr((x),(y),(z))\r\n\r\n#endif /* HAVE_MEMRCHR */\r\n\r\n#endif /* HEADER_CURL_MEMRCHR_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_multibyte.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_WIN32_IDN) || (defined(USE_WINDOWS_SSPI) && defined(UNICODE))\r\n\r\n /*\r\n  * MultiByte conversions using Windows kernel32 library.\r\n  */\r\n\r\n#include \"curl_multibyte.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nwchar_t *Curl_convert_UTF8_to_wchar(const char *str_utf8)\r\n{\r\n  wchar_t *str_w = NULL;\r\n\r\n  if(str_utf8) {\r\n    int str_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,\r\n                                        str_utf8, -1, NULL, 0);\r\n    if(str_w_len > 0) {\r\n      str_w = malloc(str_w_len * sizeof(wchar_t));\r\n      if(str_w) {\r\n        if(MultiByteToWideChar(CP_UTF8, 0, str_utf8, -1, str_w,\r\n                               str_w_len) == 0) {\r\n          Curl_safefree(str_w);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  return str_w;\r\n}\r\n\r\nchar *Curl_convert_wchar_to_UTF8(const wchar_t *str_w)\r\n{\r\n  char *str_utf8 = NULL;\r\n\r\n  if(str_w) {\r\n    int str_utf8_len = WideCharToMultiByte(CP_UTF8, 0, str_w, -1, NULL,\r\n                                           0, NULL, NULL);\r\n    if(str_utf8_len > 0) {\r\n      str_utf8 = malloc(str_utf8_len * sizeof(wchar_t));\r\n      if(str_utf8) {\r\n        if(WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, str_utf8_len,\r\n                               NULL, FALSE) == 0) {\r\n          Curl_safefree(str_utf8);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  return str_utf8;\r\n}\r\n\r\n#endif /* USE_WIN32_IDN || (USE_WINDOWS_SSPI && UNICODE) */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_multibyte.h",
    "content": "#ifndef HEADER_CURL_MULTIBYTE_H\r\n#define HEADER_CURL_MULTIBYTE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_WIN32_IDN) || (defined(USE_WINDOWS_SSPI) && defined(UNICODE))\r\n\r\n /*\r\n  * MultiByte conversions using Windows kernel32 library.\r\n  */\r\n\r\nwchar_t *Curl_convert_UTF8_to_wchar(const char *str_utf8);\r\nchar *Curl_convert_wchar_to_UTF8(const wchar_t *str_w);\r\n\r\n#endif /* USE_WIN32_IDN || (USE_WINDOWS_SSPI && UNICODE) */\r\n\r\n\r\n#if defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI)\r\n\r\n/*\r\n * Macros Curl_convert_UTF8_to_tchar(), Curl_convert_tchar_to_UTF8()\r\n * and Curl_unicodefree() main purpose is to minimize the number of\r\n * preprocessor conditional directives needed by code using these\r\n * to differentiate UNICODE from non-UNICODE builds.\r\n *\r\n * When building with UNICODE defined, this two macros\r\n * Curl_convert_UTF8_to_tchar() and Curl_convert_tchar_to_UTF8()\r\n * return a pointer to a newly allocated memory area holding result.\r\n * When the result is no longer needed, allocated memory is intended\r\n * to be free'ed with Curl_unicodefree().\r\n *\r\n * When building without UNICODE defined, this macros\r\n * Curl_convert_UTF8_to_tchar() and Curl_convert_tchar_to_UTF8()\r\n * return the pointer received as argument. Curl_unicodefree() does\r\n * no actual free'ing of this pointer it is simply set to NULL.\r\n */\r\n\r\n#ifdef UNICODE\r\n\r\n#define Curl_convert_UTF8_to_tchar(ptr) Curl_convert_UTF8_to_wchar((ptr))\r\n#define Curl_convert_tchar_to_UTF8(ptr) Curl_convert_wchar_to_UTF8((ptr))\r\n#define Curl_unicodefree(ptr) \\\r\n  do {if((ptr)) {free((ptr)); (ptr) = NULL;}} WHILE_FALSE\r\n\r\ntypedef union {\r\n  unsigned short       *tchar_ptr;\r\n  const unsigned short *const_tchar_ptr;\r\n  unsigned short       *tbyte_ptr;\r\n  const unsigned short *const_tbyte_ptr;\r\n} xcharp_u;\r\n\r\n#else\r\n\r\n#define Curl_convert_UTF8_to_tchar(ptr) (ptr)\r\n#define Curl_convert_tchar_to_UTF8(ptr) (ptr)\r\n#define Curl_unicodefree(ptr) \\\r\n  do {(ptr) = NULL;} WHILE_FALSE\r\n\r\ntypedef union {\r\n  char                *tchar_ptr;\r\n  const char          *const_tchar_ptr;\r\n  unsigned char       *tbyte_ptr;\r\n  const unsigned char *const_tbyte_ptr;\r\n} xcharp_u;\r\n\r\n#endif /* UNICODE */\r\n\r\n#endif /* USE_WIN32_IDN || USE_WINDOWS_SSPI */\r\n\r\n#endif /* HEADER_CURL_MULTIBYTE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_NTLM\r\n\r\n/*\r\n * NTLM details:\r\n *\r\n * http://davenport.sourceforge.net/ntlm.html\r\n * http://www.innovation.ch/java/ntlm.html\r\n */\r\n\r\n#define DEBUG_ME 0\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_ntlm.h\"\r\n#include \"curl_ntlm_msgs.h\"\r\n#include \"curl_ntlm_wb.h\"\r\n#include \"url.h\"\r\n#include \"curl_memory.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#if defined(USE_NSS)\r\n#include \"nssg.h\"\r\n#elif defined(USE_WINDOWS_SSPI)\r\n#include \"curl_sspi.h\"\r\n#endif\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#if DEBUG_ME\r\n# define DEBUG_OUT(x) x\r\n#else\r\n# define DEBUG_OUT(x) Curl_nop_stmt\r\n#endif\r\n\r\nCURLcode Curl_input_ntlm(struct connectdata *conn,\r\n                         bool proxy,         /* if proxy or not */\r\n                         const char *header) /* rest of the www-authenticate:\r\n                                                header */\r\n{\r\n  /* point to the correct struct with this */\r\n  struct ntlmdata *ntlm;\r\n  CURLcode result = CURLE_OK;\r\n\r\n#ifdef USE_NSS\r\n  result = Curl_nss_force_init(conn->data);\r\n  if(result)\r\n    return result;\r\n#endif\r\n\r\n  ntlm = proxy ? &conn->proxyntlm : &conn->ntlm;\r\n\r\n  /* skip initial whitespaces */\r\n  while(*header && ISSPACE(*header))\r\n    header++;\r\n\r\n  if(checkprefix(\"NTLM\", header)) {\r\n    header += strlen(\"NTLM\");\r\n\r\n    while(*header && ISSPACE(*header))\r\n      header++;\r\n\r\n    if(*header) {\r\n      result = Curl_ntlm_decode_type2_message(conn->data, header, ntlm);\r\n      if(CURLE_OK != result)\r\n        return result;\r\n\r\n      ntlm->state = NTLMSTATE_TYPE2; /* We got a type-2 message */\r\n    }\r\n    else {\r\n      if(ntlm->state == NTLMSTATE_TYPE3) {\r\n        infof(conn->data, \"NTLM handshake rejected\\n\");\r\n        Curl_http_ntlm_cleanup(conn);\r\n        ntlm->state = NTLMSTATE_NONE;\r\n        return CURLE_REMOTE_ACCESS_DENIED;\r\n      }\r\n      else if(ntlm->state >= NTLMSTATE_TYPE1) {\r\n        infof(conn->data, \"NTLM handshake failure (internal error)\\n\");\r\n        return CURLE_REMOTE_ACCESS_DENIED;\r\n      }\r\n\r\n      ntlm->state = NTLMSTATE_TYPE1; /* We should send away a type-1 */\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * This is for creating ntlm header output\r\n */\r\nCURLcode Curl_output_ntlm(struct connectdata *conn,\r\n                          bool proxy)\r\n{\r\n  char *base64 = NULL;\r\n  size_t len = 0;\r\n  CURLcode error;\r\n\r\n  /* point to the address of the pointer that holds the string to send to the\r\n     server, which is for a plain host or for a HTTP proxy */\r\n  char **allocuserpwd;\r\n\r\n  /* point to the name and password for this */\r\n  const char *userp;\r\n  const char *passwdp;\r\n\r\n  /* point to the correct struct with this */\r\n  struct ntlmdata *ntlm;\r\n  struct auth *authp;\r\n\r\n  DEBUGASSERT(conn);\r\n  DEBUGASSERT(conn->data);\r\n\r\n#ifdef USE_NSS\r\n  if(CURLE_OK != Curl_nss_force_init(conn->data))\r\n    return CURLE_OUT_OF_MEMORY;\r\n#endif\r\n\r\n  if(proxy) {\r\n    allocuserpwd = &conn->allocptr.proxyuserpwd;\r\n    userp = conn->proxyuser;\r\n    passwdp = conn->proxypasswd;\r\n    ntlm = &conn->proxyntlm;\r\n    authp = &conn->data->state.authproxy;\r\n  }\r\n  else {\r\n    allocuserpwd = &conn->allocptr.userpwd;\r\n    userp = conn->user;\r\n    passwdp = conn->passwd;\r\n    ntlm = &conn->ntlm;\r\n    authp = &conn->data->state.authhost;\r\n  }\r\n  authp->done = FALSE;\r\n\r\n  /* not set means empty */\r\n  if(!userp)\r\n    userp = \"\";\r\n\r\n  if(!passwdp)\r\n    passwdp = \"\";\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n  if(s_hSecDll == NULL) {\r\n    /* not thread safe and leaks - use curl_global_init() to avoid */\r\n    CURLcode err = Curl_sspi_global_init();\r\n    if(s_hSecDll == NULL)\r\n      return err;\r\n  }\r\n#endif\r\n\r\n  switch(ntlm->state) {\r\n  case NTLMSTATE_TYPE1:\r\n  default: /* for the weird cases we (re)start here */\r\n    /* Create a type-1 message */\r\n    error = Curl_ntlm_create_type1_message(userp, passwdp, ntlm, &base64,\r\n                                           &len);\r\n\r\n    if(error)\r\n      return error;\r\n\r\n    if(base64) {\r\n      Curl_safefree(*allocuserpwd);\r\n      *allocuserpwd = aprintf(\"%sAuthorization: NTLM %s\\r\\n\",\r\n                              proxy ? \"Proxy-\" : \"\",\r\n                              base64);\r\n      DEBUG_OUT(fprintf(stderr, \"**** Header %s\\n \", *allocuserpwd));\r\n      free(base64);\r\n    }\r\n    break;\r\n\r\n  case NTLMSTATE_TYPE2:\r\n    /* We already received the type-2 message, create a type-3 message */\r\n    error = Curl_ntlm_create_type3_message(conn->data, userp, passwdp,\r\n                                           ntlm, &base64, &len);\r\n    if(error)\r\n      return error;\r\n\r\n    if(base64) {\r\n      Curl_safefree(*allocuserpwd);\r\n      *allocuserpwd = aprintf(\"%sAuthorization: NTLM %s\\r\\n\",\r\n                              proxy ? \"Proxy-\" : \"\",\r\n                              base64);\r\n      DEBUG_OUT(fprintf(stderr, \"**** %s\\n \", *allocuserpwd));\r\n      free(base64);\r\n\r\n      ntlm->state = NTLMSTATE_TYPE3; /* we send a type-3 */\r\n      authp->done = TRUE;\r\n    }\r\n    break;\r\n\r\n  case NTLMSTATE_TYPE3:\r\n    /* connection is already authenticated,\r\n     * don't send a header in future requests */\r\n    if(*allocuserpwd) {\r\n      free(*allocuserpwd);\r\n      *allocuserpwd = NULL;\r\n    }\r\n    authp->done = TRUE;\r\n    break;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid Curl_http_ntlm_cleanup(struct connectdata *conn)\r\n{\r\n#ifdef USE_WINDOWS_SSPI\r\n  Curl_ntlm_sspi_cleanup(&conn->ntlm);\r\n  Curl_ntlm_sspi_cleanup(&conn->proxyntlm);\r\n#elif defined(NTLM_WB_ENABLED)\r\n  Curl_ntlm_wb_cleanup(conn);\r\n#else\r\n  (void)conn;\r\n#endif\r\n}\r\n\r\n#endif /* USE_NTLM */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm.h",
    "content": "#ifndef HEADER_CURL_NTLM_H\r\n#define HEADER_CURL_NTLM_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_NTLM\r\n\r\n/* this is for ntlm header input */\r\nCURLcode Curl_input_ntlm(struct connectdata *conn, bool proxy,\r\n                         const char *header);\r\n\r\n/* this is for creating ntlm header output */\r\nCURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);\r\n\r\nvoid Curl_http_ntlm_cleanup(struct connectdata *conn);\r\n\r\n#else\r\n\r\n#define Curl_http_ntlm_cleanup(a) Curl_nop_stmt\r\n\r\n#endif\r\n\r\n#endif /* HEADER_CURL_NTLM_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm_core.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_NTLM) && !defined(USE_WINDOWS_SSPI)\r\n\r\n/*\r\n * NTLM details:\r\n *\r\n * http://davenport.sourceforge.net/ntlm.html\r\n * http://www.innovation.ch/java/ntlm.html\r\n */\r\n\r\n#ifdef USE_SSLEAY\r\n\r\n#  ifdef USE_OPENSSL\r\n#    include <openssl/des.h>\r\n#    ifndef OPENSSL_NO_MD4\r\n#      include <openssl/md4.h>\r\n#    endif\r\n#    include <openssl/md5.h>\r\n#    include <openssl/ssl.h>\r\n#    include <openssl/rand.h>\r\n#  else\r\n#    include <des.h>\r\n#    ifndef OPENSSL_NO_MD4\r\n#      include <md4.h>\r\n#    endif\r\n#    include <md5.h>\r\n#    include <ssl.h>\r\n#    include <rand.h>\r\n#  endif\r\n#  if (OPENSSL_VERSION_NUMBER < 0x00907001L)\r\n#    define DES_key_schedule des_key_schedule\r\n#    define DES_cblock des_cblock\r\n#    define DES_set_odd_parity des_set_odd_parity\r\n#    define DES_set_key des_set_key\r\n#    define DES_ecb_encrypt des_ecb_encrypt\r\n#    define DESKEY(x) x\r\n#    define DESKEYARG(x) x\r\n#  else\r\n#    define DESKEYARG(x) *x\r\n#    define DESKEY(x) &x\r\n#  endif\r\n\r\n#elif defined(USE_GNUTLS_NETTLE)\r\n\r\n#  include <nettle/des.h>\r\n#  include <nettle/md4.h>\r\n\r\n#elif defined(USE_GNUTLS)\r\n\r\n#  include <gcrypt.h>\r\n#  define MD5_DIGEST_LENGTH 16\r\n#  define MD4_DIGEST_LENGTH 16\r\n\r\n#elif defined(USE_NSS)\r\n\r\n#  include <nss.h>\r\n#  include <pk11pub.h>\r\n#  include <hasht.h>\r\n#  include \"curl_md4.h\"\r\n#  define MD5_DIGEST_LENGTH MD5_LENGTH\r\n\r\n#elif defined(USE_DARWINSSL)\r\n\r\n#  include <CommonCrypto/CommonCryptor.h>\r\n#  include <CommonCrypto/CommonDigest.h>\r\n\r\n#else\r\n#  error \"Can't compile NTLM support without a crypto library.\"\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"non-ascii.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_memory.h\"\r\n#include \"curl_ntlm_core.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef USE_SSLEAY\r\n/*\r\n * Turns a 56 bit key into the 64 bit, odd parity key and sets the key.  The\r\n * key schedule ks is also set.\r\n */\r\nstatic void setup_des_key(const unsigned char *key_56,\r\n                          DES_key_schedule DESKEYARG(ks))\r\n{\r\n  DES_cblock key;\r\n\r\n  key[0] = key_56[0];\r\n  key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1));\r\n  key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2));\r\n  key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3));\r\n  key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4));\r\n  key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5));\r\n  key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6));\r\n  key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF);\r\n\r\n  DES_set_odd_parity(&key);\r\n  DES_set_key(&key, ks);\r\n}\r\n\r\n#else /* defined(USE_SSLEAY) */\r\n\r\n/*\r\n * Turns a 56 bit key into the 64 bit, odd parity key.  Used by GnuTLS and NSS.\r\n */\r\nstatic void extend_key_56_to_64(const unsigned char *key_56, char *key)\r\n{\r\n  key[0] = key_56[0];\r\n  key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1));\r\n  key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2));\r\n  key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3));\r\n  key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4));\r\n  key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5));\r\n  key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6));\r\n  key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF);\r\n}\r\n\r\n#if defined(USE_GNUTLS_NETTLE)\r\n\r\nstatic void setup_des_key(const unsigned char *key_56,\r\n                          struct des_ctx *des)\r\n{\r\n  char key[8];\r\n  extend_key_56_to_64(key_56, key);\r\n  des_set_key(des, (const uint8_t*)key);\r\n}\r\n\r\n#elif defined(USE_GNUTLS)\r\n\r\n/*\r\n * Turns a 56 bit key into the 64 bit, odd parity key and sets the key.\r\n */\r\nstatic void setup_des_key(const unsigned char *key_56,\r\n                          gcry_cipher_hd_t *des)\r\n{\r\n  char key[8];\r\n  extend_key_56_to_64(key_56, key);\r\n  gcry_cipher_setkey(*des, key, 8);\r\n}\r\n\r\n#elif defined(USE_NSS)\r\n\r\n/*\r\n * Expands a 56 bit key KEY_56 to 64 bit and encrypts 64 bit of data, using\r\n * the expanded key.  The caller is responsible for giving 64 bit of valid\r\n * data is IN and (at least) 64 bit large buffer as OUT.\r\n */\r\nstatic bool encrypt_des(const unsigned char *in, unsigned char *out,\r\n                        const unsigned char *key_56)\r\n{\r\n  const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */\r\n  PK11SlotInfo *slot = NULL;\r\n  char key[8];                                /* expanded 64 bit key */\r\n  SECItem key_item;\r\n  PK11SymKey *symkey = NULL;\r\n  SECItem *param = NULL;\r\n  PK11Context *ctx = NULL;\r\n  int out_len;                                /* not used, required by NSS */\r\n  bool rv = FALSE;\r\n\r\n  /* use internal slot for DES encryption (requires NSS to be initialized) */\r\n  slot = PK11_GetInternalKeySlot();\r\n  if(!slot)\r\n    return FALSE;\r\n\r\n  /* expand the 56 bit key to 64 bit and wrap by NSS */\r\n  extend_key_56_to_64(key_56, key);\r\n  key_item.data = (unsigned char *)key;\r\n  key_item.len = /* hard-wired */ 8;\r\n  symkey = PK11_ImportSymKey(slot, mech, PK11_OriginUnwrap, CKA_ENCRYPT,\r\n                             &key_item, NULL);\r\n  if(!symkey)\r\n    goto fail;\r\n\r\n  /* create DES encryption context */\r\n  param = PK11_ParamFromIV(mech, /* no IV in ECB mode */ NULL);\r\n  if(!param)\r\n    goto fail;\r\n  ctx = PK11_CreateContextBySymKey(mech, CKA_ENCRYPT, symkey, param);\r\n  if(!ctx)\r\n    goto fail;\r\n\r\n  /* perform the encryption */\r\n  if(SECSuccess == PK11_CipherOp(ctx, out, &out_len, /* outbuflen */ 8,\r\n                                 (unsigned char *)in, /* inbuflen */ 8)\r\n      && SECSuccess == PK11_Finalize(ctx))\r\n    rv = /* all OK */ TRUE;\r\n\r\nfail:\r\n  /* cleanup */\r\n  if(ctx)\r\n    PK11_DestroyContext(ctx, PR_TRUE);\r\n  if(symkey)\r\n    PK11_FreeSymKey(symkey);\r\n  if(param)\r\n    SECITEM_FreeItem(param, PR_TRUE);\r\n  PK11_FreeSlot(slot);\r\n  return rv;\r\n}\r\n\r\n#elif defined(USE_DARWINSSL)\r\n\r\nstatic bool encrypt_des(const unsigned char *in, unsigned char *out,\r\n                        const unsigned char *key_56)\r\n{\r\n  char key[8];\r\n  size_t out_len;\r\n  CCCryptorStatus err;\r\n\r\n  extend_key_56_to_64(key_56, key);\r\n  err = CCCrypt(kCCEncrypt, kCCAlgorithmDES, kCCOptionECBMode, key,\r\n                kCCKeySizeDES, NULL, in, 8 /* inbuflen */, out,\r\n                8 /* outbuflen */, &out_len);\r\n  return err == kCCSuccess;\r\n}\r\n\r\n#endif /* defined(USE_DARWINSSL) */\r\n\r\n#endif /* defined(USE_SSLEAY) */\r\n\r\n /*\r\n  * takes a 21 byte array and treats it as 3 56-bit DES keys. The\r\n  * 8 byte plaintext is encrypted with each key and the resulting 24\r\n  * bytes are stored in the results array.\r\n  */\r\nvoid Curl_ntlm_core_lm_resp(const unsigned char *keys,\r\n                            const unsigned char *plaintext,\r\n                            unsigned char *results)\r\n{\r\n#ifdef USE_SSLEAY\r\n  DES_key_schedule ks;\r\n\r\n  setup_des_key(keys, DESKEY(ks));\r\n  DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) results,\r\n                  DESKEY(ks), DES_ENCRYPT);\r\n\r\n  setup_des_key(keys + 7, DESKEY(ks));\r\n  DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 8),\r\n                  DESKEY(ks), DES_ENCRYPT);\r\n\r\n  setup_des_key(keys + 14, DESKEY(ks));\r\n  DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 16),\r\n                  DESKEY(ks), DES_ENCRYPT);\r\n#elif defined(USE_GNUTLS_NETTLE)\r\n  struct des_ctx des;\r\n  setup_des_key(keys, &des);\r\n  des_encrypt(&des, 8, results, plaintext);\r\n  setup_des_key(keys + 7, &des);\r\n  des_encrypt(&des, 8, results + 8, plaintext);\r\n  setup_des_key(keys + 14, &des);\r\n  des_encrypt(&des, 8, results + 16, plaintext);\r\n#elif defined(USE_GNUTLS)\r\n  gcry_cipher_hd_t des;\r\n\r\n  gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);\r\n  setup_des_key(keys, &des);\r\n  gcry_cipher_encrypt(des, results, 8, plaintext, 8);\r\n  gcry_cipher_close(des);\r\n\r\n  gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);\r\n  setup_des_key(keys + 7, &des);\r\n  gcry_cipher_encrypt(des, results + 8, 8, plaintext, 8);\r\n  gcry_cipher_close(des);\r\n\r\n  gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);\r\n  setup_des_key(keys + 14, &des);\r\n  gcry_cipher_encrypt(des, results + 16, 8, plaintext, 8);\r\n  gcry_cipher_close(des);\r\n#elif defined(USE_NSS) || defined(USE_DARWINSSL)\r\n  encrypt_des(plaintext, results, keys);\r\n  encrypt_des(plaintext, results + 8, keys + 7);\r\n  encrypt_des(plaintext, results + 16, keys + 14);\r\n#endif\r\n}\r\n\r\n/*\r\n * Set up lanmanager hashed password\r\n */\r\nvoid Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,\r\n                               const char *password,\r\n                               unsigned char *lmbuffer /* 21 bytes */)\r\n{\r\n  CURLcode res;\r\n  unsigned char pw[14];\r\n  static const unsigned char magic[] = {\r\n    0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 /* i.e. KGS!@#$% */\r\n  };\r\n  size_t len = CURLMIN(strlen(password), 14);\r\n\r\n  Curl_strntoupper((char *)pw, password, len);\r\n  memset(&pw[len], 0, 14 - len);\r\n\r\n  /*\r\n   * The LanManager hashed password needs to be created using the\r\n   * password in the network encoding not the host encoding.\r\n   */\r\n  res = Curl_convert_to_network(data, (char *)pw, 14);\r\n  if(res)\r\n    return;\r\n\r\n  {\r\n    /* Create LanManager hashed password. */\r\n\r\n#ifdef USE_SSLEAY\r\n    DES_key_schedule ks;\r\n\r\n    setup_des_key(pw, DESKEY(ks));\r\n    DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)lmbuffer,\r\n                    DESKEY(ks), DES_ENCRYPT);\r\n\r\n    setup_des_key(pw + 7, DESKEY(ks));\r\n    DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)(lmbuffer + 8),\r\n                    DESKEY(ks), DES_ENCRYPT);\r\n#elif defined(USE_GNUTLS_NETTLE)\r\n    struct des_ctx des;\r\n    setup_des_key(pw, &des);\r\n    des_encrypt(&des, 8, lmbuffer, magic);\r\n    setup_des_key(pw + 7, &des);\r\n    des_encrypt(&des, 8, lmbuffer + 8, magic);\r\n#elif defined(USE_GNUTLS)\r\n    gcry_cipher_hd_t des;\r\n\r\n    gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);\r\n    setup_des_key(pw, &des);\r\n    gcry_cipher_encrypt(des, lmbuffer, 8, magic, 8);\r\n    gcry_cipher_close(des);\r\n\r\n    gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);\r\n    setup_des_key(pw + 7, &des);\r\n    gcry_cipher_encrypt(des, lmbuffer + 8, 8, magic, 8);\r\n    gcry_cipher_close(des);\r\n#elif defined(USE_NSS) || defined(USE_DARWINSSL)\r\n    encrypt_des(magic, lmbuffer, pw);\r\n    encrypt_des(magic, lmbuffer + 8, pw + 7);\r\n#endif\r\n\r\n    memset(lmbuffer + 16, 0, 21 - 16);\r\n  }\r\n}\r\n\r\n#if USE_NTRESPONSES\r\nstatic void ascii_to_unicode_le(unsigned char *dest, const char *src,\r\n                                size_t srclen)\r\n{\r\n  size_t i;\r\n  for(i = 0; i < srclen; i++) {\r\n    dest[2 * i] = (unsigned char)src[i];\r\n    dest[2 * i + 1] = '\\0';\r\n  }\r\n}\r\n\r\n/*\r\n * Set up nt hashed passwords\r\n */\r\nCURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data,\r\n                                   const char *password,\r\n                                   unsigned char *ntbuffer /* 21 bytes */)\r\n{\r\n  size_t len = strlen(password);\r\n  unsigned char *pw = malloc(len * 2);\r\n  CURLcode result;\r\n  if(!pw)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  ascii_to_unicode_le(pw, password, len);\r\n\r\n  /*\r\n   * The NT hashed password needs to be created using the password in the\r\n   * network encoding not the host encoding.\r\n   */\r\n  result = Curl_convert_to_network(data, (char *)pw, len * 2);\r\n  if(result)\r\n    return result;\r\n\r\n  {\r\n    /* Create NT hashed password. */\r\n#ifdef USE_SSLEAY\r\n    MD4_CTX MD4pw;\r\n    MD4_Init(&MD4pw);\r\n    MD4_Update(&MD4pw, pw, 2 * len);\r\n    MD4_Final(ntbuffer, &MD4pw);\r\n#elif defined(USE_GNUTLS_NETTLE)\r\n    struct md4_ctx MD4pw;\r\n    md4_init(&MD4pw);\r\n    md4_update(&MD4pw, (unsigned int)(2 * len), pw);\r\n    md4_digest(&MD4pw, MD4_DIGEST_SIZE, ntbuffer);\r\n#elif defined(USE_GNUTLS)\r\n    gcry_md_hd_t MD4pw;\r\n    gcry_md_open(&MD4pw, GCRY_MD_MD4, 0);\r\n    gcry_md_write(MD4pw, pw, 2 * len);\r\n    memcpy (ntbuffer, gcry_md_read (MD4pw, 0), MD4_DIGEST_LENGTH);\r\n    gcry_md_close(MD4pw);\r\n#elif defined(USE_NSS)\r\n    Curl_md4it(ntbuffer, pw, 2 * len);\r\n#elif defined(USE_DARWINSSL)\r\n    (void)CC_MD4(pw, 2 * len, ntbuffer);\r\n#endif\r\n\r\n    memset(ntbuffer + 16, 0, 21 - 16);\r\n  }\r\n\r\n  free(pw);\r\n\r\n  return CURLE_OK;\r\n}\r\n#endif /* USE_NTRESPONSES */\r\n\r\n#endif /* USE_NTLM && !USE_WINDOWS_SSPI */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm_core.h",
    "content": "#ifndef HEADER_CURL_NTLM_CORE_H\r\n#define HEADER_CURL_NTLM_CORE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_NTLM) && !defined(USE_WINDOWS_SSPI)\r\n\r\n#ifdef USE_SSLEAY\r\n#  if !defined(OPENSSL_VERSION_NUMBER) && \\\r\n      !defined(HEADER_SSL_H) && !defined(HEADER_MD5_H)\r\n#    error \"curl_ntlm_core.h shall not be included before OpenSSL headers.\"\r\n#  endif\r\n#  ifdef OPENSSL_NO_MD4\r\n#    define USE_NTRESPONSES 0\r\n#    define USE_NTLM2SESSION 0\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Define USE_NTRESPONSES to 1 in order to make the type-3 message include\r\n * the NT response message. Define USE_NTLM2SESSION to 1 in order to make\r\n * the type-3 message include the NTLM2Session response message, requires\r\n * USE_NTRESPONSES defined to 1.\r\n */\r\n\r\n#ifndef USE_NTRESPONSES\r\n#  define USE_NTRESPONSES 1\r\n#  define USE_NTLM2SESSION 1\r\n#endif\r\n\r\nvoid Curl_ntlm_core_lm_resp(const unsigned char *keys,\r\n                            const unsigned char *plaintext,\r\n                            unsigned char *results);\r\n\r\nvoid Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,\r\n                               const char *password,\r\n                               unsigned char *lmbuffer /* 21 bytes */);\r\n\r\n#if USE_NTRESPONSES\r\nCURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data,\r\n                                   const char *password,\r\n                                   unsigned char *ntbuffer /* 21 bytes */);\r\n#endif\r\n\r\n#endif /* USE_NTLM && !USE_WINDOWS_SSPI */\r\n\r\n#endif /* HEADER_CURL_NTLM_CORE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm_msgs.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_NTLM\r\n\r\n/*\r\n * NTLM details:\r\n *\r\n * http://davenport.sourceforge.net/ntlm.html\r\n * http://www.innovation.ch/java/ntlm.html\r\n */\r\n\r\n#define DEBUG_ME 0\r\n\r\n#include \"urldata.h\"\r\n#include \"non-ascii.h\"\r\n#include \"sendf.h\"\r\n#include \"curl_base64.h\"\r\n#include \"curl_ntlm_core.h\"\r\n#include \"curl_gethostname.h\"\r\n#include \"curl_multibyte.h\"\r\n#include \"warnless.h\"\r\n#include \"curl_memory.h\"\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n#  include \"curl_sspi.h\"\r\n#endif\r\n\r\n#include \"sslgen.h\"\r\n\r\n#define BUILDING_CURL_NTLM_MSGS_C\r\n#include \"curl_ntlm_msgs.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* \"NTLMSSP\" signature is always in ASCII regardless of the platform */\r\n#define NTLMSSP_SIGNATURE \"\\x4e\\x54\\x4c\\x4d\\x53\\x53\\x50\"\r\n\r\n#define SHORTPAIR(x) ((x) & 0xff), (((x) >> 8) & 0xff)\r\n#define LONGQUARTET(x) ((x) & 0xff), (((x) >> 8) & 0xff), \\\r\n  (((x) >> 16) & 0xff), (((x) >> 24) & 0xff)\r\n\r\n#if DEBUG_ME\r\n# define DEBUG_OUT(x) x\r\nstatic void ntlm_print_flags(FILE *handle, unsigned long flags)\r\n{\r\n  if(flags & NTLMFLAG_NEGOTIATE_UNICODE)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_UNICODE \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_OEM)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_OEM \");\r\n  if(flags & NTLMFLAG_REQUEST_TARGET)\r\n    fprintf(handle, \"NTLMFLAG_REQUEST_TARGET \");\r\n  if(flags & (1<<3))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_3 \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_SIGN)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_SIGN \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_SEAL)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_SEAL \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_LM_KEY)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_LM_KEY \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_NETWARE)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_NETWARE \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_NTLM_KEY)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_NTLM_KEY \");\r\n  if(flags & (1<<10))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_10 \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_ANONYMOUS)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_ANONYMOUS \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_LOCAL_CALL)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_LOCAL_CALL \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_ALWAYS_SIGN)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_ALWAYS_SIGN \");\r\n  if(flags & NTLMFLAG_TARGET_TYPE_DOMAIN)\r\n    fprintf(handle, \"NTLMFLAG_TARGET_TYPE_DOMAIN \");\r\n  if(flags & NTLMFLAG_TARGET_TYPE_SERVER)\r\n    fprintf(handle, \"NTLMFLAG_TARGET_TYPE_SERVER \");\r\n  if(flags & NTLMFLAG_TARGET_TYPE_SHARE)\r\n    fprintf(handle, \"NTLMFLAG_TARGET_TYPE_SHARE \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_NTLM2_KEY \");\r\n  if(flags & NTLMFLAG_REQUEST_INIT_RESPONSE)\r\n    fprintf(handle, \"NTLMFLAG_REQUEST_INIT_RESPONSE \");\r\n  if(flags & NTLMFLAG_REQUEST_ACCEPT_RESPONSE)\r\n    fprintf(handle, \"NTLMFLAG_REQUEST_ACCEPT_RESPONSE \");\r\n  if(flags & NTLMFLAG_REQUEST_NONNT_SESSION_KEY)\r\n    fprintf(handle, \"NTLMFLAG_REQUEST_NONNT_SESSION_KEY \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_TARGET_INFO)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_TARGET_INFO \");\r\n  if(flags & (1<<24))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_24 \");\r\n  if(flags & (1<<25))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_25 \");\r\n  if(flags & (1<<26))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_26 \");\r\n  if(flags & (1<<27))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_27 \");\r\n  if(flags & (1<<28))\r\n    fprintf(handle, \"NTLMFLAG_UNKNOWN_28 \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_128)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_128 \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_KEY_EXCHANGE)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_KEY_EXCHANGE \");\r\n  if(flags & NTLMFLAG_NEGOTIATE_56)\r\n    fprintf(handle, \"NTLMFLAG_NEGOTIATE_56 \");\r\n}\r\n\r\nstatic void ntlm_print_hex(FILE *handle, const char *buf, size_t len)\r\n{\r\n  const char *p = buf;\r\n  (void)handle;\r\n  fprintf(stderr, \"0x\");\r\n  while(len-- > 0)\r\n    fprintf(stderr, \"%02.2x\", (unsigned int)*p++);\r\n}\r\n#else\r\n# define DEBUG_OUT(x) Curl_nop_stmt\r\n#endif\r\n\r\n#ifndef USE_WINDOWS_SSPI\r\n/*\r\n * This function converts from the little endian format used in the\r\n * incoming package to whatever endian format we're using natively.\r\n * Argument is a pointer to a 4 byte buffer.\r\n */\r\nstatic unsigned int readint_le(unsigned char *buf)\r\n{\r\n  return ((unsigned int)buf[0]) | ((unsigned int)buf[1] << 8) |\r\n    ((unsigned int)buf[2] << 16) | ((unsigned int)buf[3] << 24);\r\n}\r\n#endif\r\n\r\n/*\r\n  NTLM message structure notes:\r\n\r\n  A 'short' is a 'network short', a little-endian 16-bit unsigned value.\r\n\r\n  A 'long' is a 'network long', a little-endian, 32-bit unsigned value.\r\n\r\n  A 'security buffer' represents a triplet used to point to a buffer,\r\n  consisting of two shorts and one long:\r\n\r\n    1. A 'short' containing the length of the buffer content in bytes.\r\n    2. A 'short' containing the allocated space for the buffer in bytes.\r\n    3. A 'long' containing the offset to the start of the buffer in bytes,\r\n       from the beginning of the NTLM message.\r\n*/\r\n\r\n/*\r\n * Curl_ntlm_decode_type2_message()\r\n *\r\n * This is used to decode a ntlm type-2 message received from a: HTTP, SMTP\r\n * or POP3 server. The message is first decoded from a base64 string into a\r\n * raw ntlm message and checked for validity before the appropriate data for\r\n * creating a type-3 message is written to the given ntlm data structure.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - Pointer to session handle.\r\n * header  [in]     - Pointer to the input buffer.\r\n * ntlm    [in]     - Pointer to ntlm data struct being used and modified.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data,\r\n                                        const char* header,\r\n                                        struct ntlmdata* ntlm)\r\n{\r\n#ifndef USE_WINDOWS_SSPI\r\n  static const char type2_marker[] = { 0x02, 0x00, 0x00, 0x00 };\r\n#endif\r\n\r\n  /* NTLM type-2 message structure:\r\n\r\n          Index  Description            Content\r\n            0    NTLMSSP Signature      Null-terminated ASCII \"NTLMSSP\"\r\n                                        (0x4e544c4d53535000)\r\n            8    NTLM Message Type      long (0x02000000)\r\n           12    Target Name            security buffer\r\n           20    Flags                  long\r\n           24    Challenge              8 bytes\r\n          (32)   Context                8 bytes (two consecutive longs) (*)\r\n          (40)   Target Information     security buffer (*)\r\n          (48)   OS Version Structure   8 bytes (*)\r\n  32 (48) (56)   Start of data block    (*)\r\n                                        (*) -> Optional\r\n  */\r\n\r\n  size_t size = 0;\r\n  unsigned char *buffer = NULL;\r\n  CURLcode error;\r\n\r\n#if defined(CURL_DISABLE_VERBOSE_STRINGS) || defined(USE_WINDOWS_SSPI)\r\n  (void)data;\r\n#endif\r\n\r\n  error = Curl_base64_decode(header, &buffer, &size);\r\n  if(error)\r\n    return error;\r\n\r\n  if(!buffer) {\r\n    infof(data, \"NTLM handshake failure (unhandled condition)\\n\");\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n  }\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n  ntlm->type_2 = malloc(size + 1);\r\n  if(ntlm->type_2 == NULL) {\r\n    free(buffer);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  ntlm->n_type_2 = curlx_uztoul(size);\r\n  memcpy(ntlm->type_2, buffer, size);\r\n#else\r\n  ntlm->flags = 0;\r\n\r\n  if((size < 32) ||\r\n     (memcmp(buffer, NTLMSSP_SIGNATURE, 8) != 0) ||\r\n     (memcmp(buffer + 8, type2_marker, sizeof(type2_marker)) != 0)) {\r\n    /* This was not a good enough type-2 message */\r\n    free(buffer);\r\n    infof(data, \"NTLM handshake failure (bad type-2 message)\\n\");\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n  }\r\n\r\n  ntlm->flags = readint_le(&buffer[20]);\r\n  memcpy(ntlm->nonce, &buffer[24], 8);\r\n\r\n  DEBUG_OUT({\r\n    fprintf(stderr, \"**** TYPE2 header flags=0x%08.8lx \", ntlm->flags);\r\n    ntlm_print_flags(stderr, ntlm->flags);\r\n    fprintf(stderr, \"\\n                  nonce=\");\r\n    ntlm_print_hex(stderr, (char *)ntlm->nonce, 8);\r\n    fprintf(stderr, \"\\n****\\n\");\r\n    fprintf(stderr, \"**** Header %s\\n \", header);\r\n  });\r\n#endif\r\n  free(buffer);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\nvoid Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm)\r\n{\r\n  Curl_safefree(ntlm->type_2);\r\n  if(ntlm->has_handles) {\r\n    s_pSecFn->DeleteSecurityContext(&ntlm->c_handle);\r\n    s_pSecFn->FreeCredentialsHandle(&ntlm->handle);\r\n    ntlm->has_handles = 0;\r\n  }\r\n  if(ntlm->p_identity) {\r\n    Curl_safefree(ntlm->identity.User);\r\n    Curl_safefree(ntlm->identity.Password);\r\n    Curl_safefree(ntlm->identity.Domain);\r\n    ntlm->p_identity = NULL;\r\n  }\r\n}\r\n#endif\r\n\r\n#ifndef USE_WINDOWS_SSPI\r\n/* copy the source to the destination and fill in zeroes in every\r\n   other destination byte! */\r\nstatic void unicodecpy(unsigned char *dest,\r\n                       const char *src, size_t length)\r\n{\r\n  size_t i;\r\n  for(i = 0; i < length; i++) {\r\n    dest[2 * i] = (unsigned char)src[i];\r\n    dest[2 * i + 1] = '\\0';\r\n  }\r\n}\r\n#endif\r\n\r\n/*\r\n * Curl_ntlm_create_type1_message()\r\n *\r\n * This is used to generate an already encoded NTLM type-1 message ready\r\n * for sending to the recipient, be it a: HTTP, SMTP or POP3 server,\r\n * using the appropriate compile time crypo API.\r\n *\r\n * Parameters:\r\n *\r\n * userp   [in]     - The user name in the format User or Domain\\User.\r\n * passdwp [in]     - The user's password.\r\n * ntlm    [in/out] - The ntlm data struct being used and modified.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_ntlm_create_type1_message(const char *userp,\r\n                                        const char *passwdp,\r\n                                        struct ntlmdata *ntlm,\r\n                                        char **outptr,\r\n                                        size_t *outlen)\r\n{\r\n  /* NTLM type-1 message structure:\r\n\r\n       Index  Description            Content\r\n         0    NTLMSSP Signature      Null-terminated ASCII \"NTLMSSP\"\r\n                                     (0x4e544c4d53535000)\r\n         8    NTLM Message Type      long (0x01000000)\r\n        12    Flags                  long\r\n       (16)   Supplied Domain        security buffer (*)\r\n       (24)   Supplied Workstation   security buffer (*)\r\n       (32)   OS Version Structure   8 bytes (*)\r\n  (32) (40)   Start of data block    (*)\r\n                                     (*) -> Optional\r\n  */\r\n\r\n  unsigned char ntlmbuf[NTLM_BUFSIZE];\r\n  size_t size;\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n\r\n  SecBuffer buf;\r\n  SecBufferDesc desc;\r\n  SECURITY_STATUS status;\r\n  unsigned long attrs;\r\n  xcharp_u useranddomain;\r\n  xcharp_u user, dup_user;\r\n  xcharp_u domain, dup_domain;\r\n  xcharp_u passwd, dup_passwd;\r\n  size_t domlen = 0;\r\n  TimeStamp tsDummy; /* For Windows 9x compatibility of SSPI calls */\r\n\r\n  domain.const_tchar_ptr = TEXT(\"\");\r\n\r\n  Curl_ntlm_sspi_cleanup(ntlm);\r\n\r\n  if(userp && *userp) {\r\n\r\n    /* null initialize ntlm identity's data to allow proper cleanup */\r\n    ntlm->p_identity = &ntlm->identity;\r\n    memset(ntlm->p_identity, 0, sizeof(*ntlm->p_identity));\r\n\r\n    useranddomain.tchar_ptr = Curl_convert_UTF8_to_tchar((char *)userp);\r\n    if(!useranddomain.tchar_ptr)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    user.const_tchar_ptr = _tcschr(useranddomain.const_tchar_ptr, TEXT('\\\\'));\r\n    if(!user.const_tchar_ptr)\r\n      user.const_tchar_ptr = _tcschr(useranddomain.const_tchar_ptr, TEXT('/'));\r\n\r\n    if(user.tchar_ptr) {\r\n      domain.tchar_ptr = useranddomain.tchar_ptr;\r\n      domlen = user.tchar_ptr - useranddomain.tchar_ptr;\r\n      user.tchar_ptr++;\r\n    }\r\n    else {\r\n      user.tchar_ptr = useranddomain.tchar_ptr;\r\n      domain.const_tchar_ptr = TEXT(\"\");\r\n      domlen = 0;\r\n    }\r\n\r\n    /* setup ntlm identity's user and length */\r\n    dup_user.tchar_ptr = _tcsdup(user.tchar_ptr);\r\n    if(!dup_user.tchar_ptr) {\r\n      Curl_unicodefree(useranddomain.tchar_ptr);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    ntlm->identity.User = dup_user.tbyte_ptr;\r\n    ntlm->identity.UserLength = curlx_uztoul(_tcslen(dup_user.tchar_ptr));\r\n    dup_user.tchar_ptr = NULL;\r\n\r\n    /* setup ntlm identity's domain and length */\r\n    dup_domain.tchar_ptr = malloc(sizeof(TCHAR) * (domlen + 1));\r\n    if(!dup_domain.tchar_ptr) {\r\n      Curl_unicodefree(useranddomain.tchar_ptr);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    _tcsncpy(dup_domain.tchar_ptr, domain.tchar_ptr, domlen);\r\n    *(dup_domain.tchar_ptr + domlen) = TEXT('\\0');\r\n    ntlm->identity.Domain = dup_domain.tbyte_ptr;\r\n    ntlm->identity.DomainLength = curlx_uztoul(domlen);\r\n    dup_domain.tchar_ptr = NULL;\r\n\r\n    Curl_unicodefree(useranddomain.tchar_ptr);\r\n\r\n    /* setup ntlm identity's password and length */\r\n    passwd.tchar_ptr = Curl_convert_UTF8_to_tchar((char *)passwdp);\r\n    if(!passwd.tchar_ptr)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    dup_passwd.tchar_ptr = _tcsdup(passwd.tchar_ptr);\r\n    if(!dup_passwd.tchar_ptr) {\r\n      Curl_unicodefree(passwd.tchar_ptr);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    ntlm->identity.Password = dup_passwd.tbyte_ptr;\r\n    ntlm->identity.PasswordLength =\r\n      curlx_uztoul(_tcslen(dup_passwd.tchar_ptr));\r\n    dup_passwd.tchar_ptr = NULL;\r\n\r\n    Curl_unicodefree(passwd.tchar_ptr);\r\n\r\n    /* setup ntlm identity's flags */\r\n    ntlm->identity.Flags = SECFLAG_WINNT_AUTH_IDENTITY;\r\n  }\r\n  else\r\n    ntlm->p_identity = NULL;\r\n\r\n  status = s_pSecFn->AcquireCredentialsHandle(NULL,\r\n                                              (TCHAR *) TEXT(\"NTLM\"),\r\n                                              SECPKG_CRED_OUTBOUND, NULL,\r\n                                              ntlm->p_identity, NULL, NULL,\r\n                                              &ntlm->handle, &tsDummy);\r\n  if(status != SEC_E_OK)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  desc.ulVersion = SECBUFFER_VERSION;\r\n  desc.cBuffers  = 1;\r\n  desc.pBuffers  = &buf;\r\n  buf.cbBuffer   = NTLM_BUFSIZE;\r\n  buf.BufferType = SECBUFFER_TOKEN;\r\n  buf.pvBuffer   = ntlmbuf;\r\n\r\n  status = s_pSecFn->InitializeSecurityContext(&ntlm->handle, NULL,\r\n                                               (TCHAR *) TEXT(\"\"),\r\n                                               ISC_REQ_CONFIDENTIALITY |\r\n                                               ISC_REQ_REPLAY_DETECT |\r\n                                               ISC_REQ_CONNECTION,\r\n                                               0, SECURITY_NETWORK_DREP,\r\n                                               NULL, 0,\r\n                                               &ntlm->c_handle, &desc,\r\n                                               &attrs, &tsDummy);\r\n\r\n  if(status == SEC_I_COMPLETE_AND_CONTINUE ||\r\n     status == SEC_I_CONTINUE_NEEDED)\r\n    s_pSecFn->CompleteAuthToken(&ntlm->c_handle, &desc);\r\n  else if(status != SEC_E_OK) {\r\n    s_pSecFn->FreeCredentialsHandle(&ntlm->handle);\r\n    return CURLE_RECV_ERROR;\r\n  }\r\n\r\n  ntlm->has_handles = 1;\r\n  size = buf.cbBuffer;\r\n\r\n#else\r\n\r\n  const char *host = \"\";              /* empty */\r\n  const char *domain = \"\";            /* empty */\r\n  size_t hostlen = 0;\r\n  size_t domlen = 0;\r\n  size_t hostoff = 0;\r\n  size_t domoff = hostoff + hostlen;  /* This is 0: remember that host and\r\n                                         domain are empty */\r\n  (void)userp;\r\n  (void)passwdp;\r\n  (void)ntlm;\r\n\r\n#if USE_NTLM2SESSION\r\n#define NTLM2FLAG NTLMFLAG_NEGOTIATE_NTLM2_KEY\r\n#else\r\n#define NTLM2FLAG 0\r\n#endif\r\n  snprintf((char *)ntlmbuf, NTLM_BUFSIZE,\r\n           NTLMSSP_SIGNATURE \"%c\"\r\n           \"\\x01%c%c%c\" /* 32-bit type = 1 */\r\n           \"%c%c%c%c\"   /* 32-bit NTLM flag field */\r\n           \"%c%c\"       /* domain length */\r\n           \"%c%c\"       /* domain allocated space */\r\n           \"%c%c\"       /* domain name offset */\r\n           \"%c%c\"       /* 2 zeroes */\r\n           \"%c%c\"       /* host length */\r\n           \"%c%c\"       /* host allocated space */\r\n           \"%c%c\"       /* host name offset */\r\n           \"%c%c\"       /* 2 zeroes */\r\n           \"%s\"         /* host name */\r\n           \"%s\",        /* domain string */\r\n           0,           /* trailing zero */\r\n           0, 0, 0,     /* part of type-1 long */\r\n\r\n           LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |\r\n                       NTLMFLAG_REQUEST_TARGET |\r\n                       NTLMFLAG_NEGOTIATE_NTLM_KEY |\r\n                       NTLM2FLAG |\r\n                       NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),\r\n           SHORTPAIR(domlen),\r\n           SHORTPAIR(domlen),\r\n           SHORTPAIR(domoff),\r\n           0, 0,\r\n           SHORTPAIR(hostlen),\r\n           SHORTPAIR(hostlen),\r\n           SHORTPAIR(hostoff),\r\n           0, 0,\r\n           host,  /* this is empty */\r\n           domain /* this is empty */);\r\n\r\n  /* Initial packet length */\r\n  size = 32 + hostlen + domlen;\r\n\r\n#endif\r\n\r\n  DEBUG_OUT({\r\n    fprintf(stderr, \"* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x \"\r\n            \"0x%08.8x \",\r\n            LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |\r\n                        NTLMFLAG_REQUEST_TARGET |\r\n                        NTLMFLAG_NEGOTIATE_NTLM_KEY |\r\n                        NTLM2FLAG |\r\n                        NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),\r\n            NTLMFLAG_NEGOTIATE_OEM |\r\n            NTLMFLAG_REQUEST_TARGET |\r\n            NTLMFLAG_NEGOTIATE_NTLM_KEY |\r\n            NTLM2FLAG |\r\n            NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);\r\n    ntlm_print_flags(stderr,\r\n                     NTLMFLAG_NEGOTIATE_OEM |\r\n                     NTLMFLAG_REQUEST_TARGET |\r\n                     NTLMFLAG_NEGOTIATE_NTLM_KEY |\r\n                     NTLM2FLAG |\r\n                     NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);\r\n    fprintf(stderr, \"\\n****\\n\");\r\n  });\r\n\r\n  /* Return with binary blob encoded into base64 */\r\n  return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, outlen);\r\n}\r\n\r\n/*\r\n * Curl_ntlm_create_type3_message()\r\n *\r\n * This is used to generate an already encoded NTLM type-3 message ready\r\n * for sending to the recipient, be it a: HTTP, SMTP or POP3 server,\r\n * using the appropriate compile time crypo API.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - The session handle.\r\n * userp   [in]     - The user name in the format User or Domain\\User.\r\n * passdwp [in]     - The user's password.\r\n * ntlm    [in/out] - The ntlm data struct being used and modified.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,\r\n                                        const char *userp,\r\n                                        const char *passwdp,\r\n                                        struct ntlmdata *ntlm,\r\n                                        char **outptr,\r\n                                        size_t *outlen)\r\n{\r\n  /* NTLM type-3 message structure:\r\n\r\n          Index  Description            Content\r\n            0    NTLMSSP Signature      Null-terminated ASCII \"NTLMSSP\"\r\n                                        (0x4e544c4d53535000)\r\n            8    NTLM Message Type      long (0x03000000)\r\n           12    LM/LMv2 Response       security buffer\r\n           20    NTLM/NTLMv2 Response   security buffer\r\n           28    Target Name            security buffer\r\n           36    User Name              security buffer\r\n           44    Workstation Name       security buffer\r\n          (52)   Session Key            security buffer (*)\r\n          (60)   Flags                  long (*)\r\n          (64)   OS Version Structure   8 bytes (*)\r\n  52 (64) (72)   Start of data block\r\n                                          (*) -> Optional\r\n  */\r\n\r\n  unsigned char ntlmbuf[NTLM_BUFSIZE];\r\n  size_t size;\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n  SecBuffer type_2;\r\n  SecBuffer type_3;\r\n  SecBufferDesc type_2_desc;\r\n  SecBufferDesc type_3_desc;\r\n  SECURITY_STATUS status;\r\n  unsigned long attrs;\r\n  TimeStamp tsDummy; /* For Windows 9x compatibility of SSPI calls */\r\n\r\n  (void)passwdp;\r\n  (void)userp;\r\n  (void)data;\r\n\r\n  type_2_desc.ulVersion = type_3_desc.ulVersion  = SECBUFFER_VERSION;\r\n  type_2_desc.cBuffers  = type_3_desc.cBuffers   = 1;\r\n  type_2_desc.pBuffers  = &type_2;\r\n  type_3_desc.pBuffers  = &type_3;\r\n\r\n  type_2.BufferType = SECBUFFER_TOKEN;\r\n  type_2.pvBuffer   = ntlm->type_2;\r\n  type_2.cbBuffer   = ntlm->n_type_2;\r\n  type_3.BufferType = SECBUFFER_TOKEN;\r\n  type_3.pvBuffer   = ntlmbuf;\r\n  type_3.cbBuffer   = NTLM_BUFSIZE;\r\n\r\n  status = s_pSecFn->InitializeSecurityContext(&ntlm->handle,\r\n                                               &ntlm->c_handle,\r\n                                               (TCHAR *) TEXT(\"\"),\r\n                                               ISC_REQ_CONFIDENTIALITY |\r\n                                               ISC_REQ_REPLAY_DETECT |\r\n                                               ISC_REQ_CONNECTION,\r\n                                               0, SECURITY_NETWORK_DREP,\r\n                                               &type_2_desc,\r\n                                               0, &ntlm->c_handle,\r\n                                               &type_3_desc,\r\n                                               &attrs, &tsDummy);\r\n  if(status != SEC_E_OK)\r\n    return CURLE_RECV_ERROR;\r\n\r\n  size = type_3.cbBuffer;\r\n\r\n  Curl_ntlm_sspi_cleanup(ntlm);\r\n\r\n#else\r\n  int lmrespoff;\r\n  unsigned char lmresp[24]; /* fixed-size */\r\n#if USE_NTRESPONSES\r\n  int ntrespoff;\r\n  unsigned char ntresp[24]; /* fixed-size */\r\n#endif\r\n  bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE) ? TRUE : FALSE;\r\n  char host[HOSTNAME_MAX + 1] = \"\";\r\n  const char *user;\r\n  const char *domain = \"\";\r\n  size_t hostoff = 0;\r\n  size_t useroff = 0;\r\n  size_t domoff = 0;\r\n  size_t hostlen = 0;\r\n  size_t userlen = 0;\r\n  size_t domlen = 0;\r\n  CURLcode res;\r\n\r\n  user = strchr(userp, '\\\\');\r\n  if(!user)\r\n    user = strchr(userp, '/');\r\n\r\n  if(user) {\r\n    domain = userp;\r\n    domlen = (user - domain);\r\n    user++;\r\n  }\r\n  else\r\n    user = userp;\r\n\r\n  if(user)\r\n    userlen = strlen(user);\r\n\r\n  /* Get the machine's un-qualified host name as NTLM doesn't like the fully\r\n     qualified domain name */\r\n  if(Curl_gethostname(host, sizeof(host))) {\r\n    infof(data, \"gethostname() failed, continuing without!\\n\");\r\n    hostlen = 0;\r\n  }\r\n  else {\r\n    hostlen = strlen(host);\r\n  }\r\n\r\n  if(unicode) {\r\n    domlen = domlen * 2;\r\n    userlen = userlen * 2;\r\n    hostlen = hostlen * 2;\r\n  }\r\n\r\n#if USE_NTLM2SESSION\r\n  /* We don't support NTLM2 if we don't have USE_NTRESPONSES */\r\n  if(ntlm->flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY) {\r\n    unsigned char ntbuffer[0x18];\r\n    unsigned char tmp[0x18];\r\n    unsigned char md5sum[MD5_DIGEST_LENGTH];\r\n    unsigned char entropy[8];\r\n\r\n    /* Need to create 8 bytes random data */\r\n    Curl_ssl_random(data, entropy, sizeof(entropy));\r\n\r\n    /* 8 bytes random data as challenge in lmresp */\r\n    memcpy(lmresp, entropy, 8);\r\n\r\n    /* Pad with zeros */\r\n    memset(lmresp + 8, 0, 0x10);\r\n\r\n    /* Fill tmp with challenge(nonce?) + entropy */\r\n    memcpy(tmp, &ntlm->nonce[0], 8);\r\n    memcpy(tmp + 8, entropy, 8);\r\n\r\n    Curl_ssl_md5sum(tmp, 16, md5sum, MD5_DIGEST_LENGTH);\r\n\r\n    /* We shall only use the first 8 bytes of md5sum, but the des\r\n       code in Curl_ntlm_core_lm_resp only encrypt the first 8 bytes */\r\n    if(CURLE_OUT_OF_MEMORY ==\r\n       Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer))\r\n      return CURLE_OUT_OF_MEMORY;\r\n    Curl_ntlm_core_lm_resp(ntbuffer, md5sum, ntresp);\r\n\r\n    /* End of NTLM2 Session code */\r\n  }\r\n  else\r\n#endif\r\n  {\r\n\r\n#if USE_NTRESPONSES\r\n    unsigned char ntbuffer[0x18];\r\n#endif\r\n    unsigned char lmbuffer[0x18];\r\n\r\n#if USE_NTRESPONSES\r\n    if(CURLE_OUT_OF_MEMORY ==\r\n       Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer))\r\n      return CURLE_OUT_OF_MEMORY;\r\n    Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], ntresp);\r\n#endif\r\n\r\n    Curl_ntlm_core_mk_lm_hash(data, passwdp, lmbuffer);\r\n    Curl_ntlm_core_lm_resp(lmbuffer, &ntlm->nonce[0], lmresp);\r\n    /* A safer but less compatible alternative is:\r\n     *   Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], lmresp);\r\n     * See http://davenport.sourceforge.net/ntlm.html#ntlmVersion2 */\r\n  }\r\n\r\n  lmrespoff = 64; /* size of the message header */\r\n#if USE_NTRESPONSES\r\n  ntrespoff = lmrespoff + 0x18;\r\n  domoff = ntrespoff + 0x18;\r\n#else\r\n  domoff = lmrespoff + 0x18;\r\n#endif\r\n  useroff = domoff + domlen;\r\n  hostoff = useroff + userlen;\r\n\r\n  /* Create the big type-3 message binary blob */\r\n  size = snprintf((char *)ntlmbuf, NTLM_BUFSIZE,\r\n                  NTLMSSP_SIGNATURE \"%c\"\r\n                  \"\\x03%c%c%c\"  /* 32-bit type = 3 */\r\n\r\n                  \"%c%c\"  /* LanManager length */\r\n                  \"%c%c\"  /* LanManager allocated space */\r\n                  \"%c%c\"  /* LanManager offset */\r\n                  \"%c%c\"  /* 2 zeroes */\r\n\r\n                  \"%c%c\"  /* NT-response length */\r\n                  \"%c%c\"  /* NT-response allocated space */\r\n                  \"%c%c\"  /* NT-response offset */\r\n                  \"%c%c\"  /* 2 zeroes */\r\n\r\n                  \"%c%c\"  /* domain length */\r\n                  \"%c%c\"  /* domain allocated space */\r\n                  \"%c%c\"  /* domain name offset */\r\n                  \"%c%c\"  /* 2 zeroes */\r\n\r\n                  \"%c%c\"  /* user length */\r\n                  \"%c%c\"  /* user allocated space */\r\n                  \"%c%c\"  /* user offset */\r\n                  \"%c%c\"  /* 2 zeroes */\r\n\r\n                  \"%c%c\"  /* host length */\r\n                  \"%c%c\"  /* host allocated space */\r\n                  \"%c%c\"  /* host offset */\r\n                  \"%c%c\"  /* 2 zeroes */\r\n\r\n                  \"%c%c\"  /* session key length (unknown purpose) */\r\n                  \"%c%c\"  /* session key allocated space (unknown purpose) */\r\n                  \"%c%c\"  /* session key offset (unknown purpose) */\r\n                  \"%c%c\"  /* 2 zeroes */\r\n\r\n                  \"%c%c%c%c\",  /* flags */\r\n\r\n                  /* domain string */\r\n                  /* user string */\r\n                  /* host string */\r\n                  /* LanManager response */\r\n                  /* NT response */\r\n\r\n                  0,                /* zero termination */\r\n                  0, 0, 0,          /* type-3 long, the 24 upper bits */\r\n\r\n                  SHORTPAIR(0x18),  /* LanManager response length, twice */\r\n                  SHORTPAIR(0x18),\r\n                  SHORTPAIR(lmrespoff),\r\n                  0x0, 0x0,\r\n\r\n#if USE_NTRESPONSES\r\n                  SHORTPAIR(0x18),  /* NT-response length, twice */\r\n                  SHORTPAIR(0x18),\r\n                  SHORTPAIR(ntrespoff),\r\n                  0x0, 0x0,\r\n#else\r\n                  0x0, 0x0,\r\n                  0x0, 0x0,\r\n                  0x0, 0x0,\r\n                  0x0, 0x0,\r\n#endif\r\n                  SHORTPAIR(domlen),\r\n                  SHORTPAIR(domlen),\r\n                  SHORTPAIR(domoff),\r\n                  0x0, 0x0,\r\n\r\n                  SHORTPAIR(userlen),\r\n                  SHORTPAIR(userlen),\r\n                  SHORTPAIR(useroff),\r\n                  0x0, 0x0,\r\n\r\n                  SHORTPAIR(hostlen),\r\n                  SHORTPAIR(hostlen),\r\n                  SHORTPAIR(hostoff),\r\n                  0x0, 0x0,\r\n\r\n                  0x0, 0x0,\r\n                  0x0, 0x0,\r\n                  0x0, 0x0,\r\n                  0x0, 0x0,\r\n\r\n                  LONGQUARTET(ntlm->flags));\r\n\r\n  DEBUGASSERT(size == 64);\r\n  DEBUGASSERT(size == (size_t)lmrespoff);\r\n\r\n  /* We append the binary hashes */\r\n  if(size < (NTLM_BUFSIZE - 0x18)) {\r\n    memcpy(&ntlmbuf[size], lmresp, 0x18);\r\n    size += 0x18;\r\n  }\r\n\r\n  DEBUG_OUT({\r\n    fprintf(stderr, \"**** TYPE3 header lmresp=\");\r\n    ntlm_print_hex(stderr, (char *)&ntlmbuf[lmrespoff], 0x18);\r\n  });\r\n\r\n#if USE_NTRESPONSES\r\n  if(size < (NTLM_BUFSIZE - 0x18)) {\r\n    DEBUGASSERT(size == (size_t)ntrespoff);\r\n    memcpy(&ntlmbuf[size], ntresp, 0x18);\r\n    size += 0x18;\r\n  }\r\n\r\n  DEBUG_OUT({\r\n    fprintf(stderr, \"\\n   ntresp=\");\r\n    ntlm_print_hex(stderr, (char *)&ntlmbuf[ntrespoff], 0x18);\r\n  });\r\n\r\n#endif\r\n\r\n  DEBUG_OUT({\r\n    fprintf(stderr, \"\\n   flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x \",\r\n            LONGQUARTET(ntlm->flags), ntlm->flags);\r\n    ntlm_print_flags(stderr, ntlm->flags);\r\n    fprintf(stderr, \"\\n****\\n\");\r\n  });\r\n\r\n  /* Make sure that the domain, user and host strings fit in the\r\n     buffer before we copy them there. */\r\n  if(size + userlen + domlen + hostlen >= NTLM_BUFSIZE) {\r\n    failf(data, \"user + domain + host name too big\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  DEBUGASSERT(size == domoff);\r\n  if(unicode)\r\n    unicodecpy(&ntlmbuf[size], domain, domlen / 2);\r\n  else\r\n    memcpy(&ntlmbuf[size], domain, domlen);\r\n\r\n  size += domlen;\r\n\r\n  DEBUGASSERT(size == useroff);\r\n  if(unicode)\r\n    unicodecpy(&ntlmbuf[size], user, userlen / 2);\r\n  else\r\n    memcpy(&ntlmbuf[size], user, userlen);\r\n\r\n  size += userlen;\r\n\r\n  DEBUGASSERT(size == hostoff);\r\n  if(unicode)\r\n    unicodecpy(&ntlmbuf[size], host, hostlen / 2);\r\n  else\r\n    memcpy(&ntlmbuf[size], host, hostlen);\r\n\r\n  size += hostlen;\r\n\r\n  /* Convert domain, user, and host to ASCII but leave the rest as-is */\r\n  res = Curl_convert_to_network(data, (char *)&ntlmbuf[domoff],\r\n                                size - domoff);\r\n  if(res)\r\n    return CURLE_CONV_FAILED;\r\n\r\n#endif\r\n\r\n  /* Return with binary blob encoded into base64 */\r\n  return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, outlen);\r\n}\r\n\r\n#endif /* USE_NTLM */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm_msgs.h",
    "content": "#ifndef HEADER_CURL_NTLM_MSGS_H\r\n#define HEADER_CURL_NTLM_MSGS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_NTLM\r\n\r\n/* This is to generate a base64 encoded NTLM type-1 message */\r\nCURLcode Curl_ntlm_create_type1_message(const char *userp,\r\n                                        const char *passwdp,\r\n                                        struct ntlmdata *ntlm,\r\n                                        char **outptr,\r\n                                        size_t *outlen);\r\n\r\n/* This is to generate a base64 encoded NTLM type-3 message */\r\nCURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,\r\n                                        const char *userp,\r\n                                        const char *passwdp,\r\n                                        struct ntlmdata *ntlm,\r\n                                        char **outptr,\r\n                                        size_t *outlen);\r\n\r\n/* This is to decode a NTLM type-2 message */\r\nCURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data,\r\n                                        const char* header,\r\n                                        struct ntlmdata* ntlm);\r\n\r\n/* This is to clean up the ntlm data structure */\r\n#ifdef USE_WINDOWS_SSPI\r\nvoid Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm);\r\n#else\r\n#define Curl_ntlm_sspi_cleanup(x)\r\n#endif\r\n\r\n/* NTLM buffer fixed size, large enough for long user + host + domain */\r\n#define NTLM_BUFSIZE 1024\r\n\r\n/* Stuff only required for curl_ntlm_msgs.c */\r\n#ifdef BUILDING_CURL_NTLM_MSGS_C\r\n\r\n/* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */\r\n\r\n#define NTLMFLAG_NEGOTIATE_UNICODE               (1<<0)\r\n/* Indicates that Unicode strings are supported for use in security buffer\r\n   data. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_OEM                   (1<<1)\r\n/* Indicates that OEM strings are supported for use in security buffer data. */\r\n\r\n#define NTLMFLAG_REQUEST_TARGET                  (1<<2)\r\n/* Requests that the server's authentication realm be included in the Type 2\r\n   message. */\r\n\r\n/* unknown (1<<3) */\r\n#define NTLMFLAG_NEGOTIATE_SIGN                  (1<<4)\r\n/* Specifies that authenticated communication between the client and server\r\n   should carry a digital signature (message integrity). */\r\n\r\n#define NTLMFLAG_NEGOTIATE_SEAL                  (1<<5)\r\n/* Specifies that authenticated communication between the client and server\r\n   should be encrypted (message confidentiality). */\r\n\r\n#define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE        (1<<6)\r\n/* Indicates that datagram authentication is being used. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_LM_KEY                (1<<7)\r\n/* Indicates that the LAN Manager session key should be used for signing and\r\n   sealing authenticated communications. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_NETWARE               (1<<8)\r\n/* unknown purpose */\r\n\r\n#define NTLMFLAG_NEGOTIATE_NTLM_KEY              (1<<9)\r\n/* Indicates that NTLM authentication is being used. */\r\n\r\n/* unknown (1<<10) */\r\n\r\n#define NTLMFLAG_NEGOTIATE_ANONYMOUS             (1<<11)\r\n/* Sent by the client in the Type 3 message to indicate that an anonymous\r\n   context has been established. This also affects the response fields. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED       (1<<12)\r\n/* Sent by the client in the Type 1 message to indicate that a desired\r\n   authentication realm is included in the message. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED  (1<<13)\r\n/* Sent by the client in the Type 1 message to indicate that the client\r\n   workstation's name is included in the message. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_LOCAL_CALL            (1<<14)\r\n/* Sent by the server to indicate that the server and client are on the same\r\n   machine. Implies that the client may use a pre-established local security\r\n   context rather than responding to the challenge. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN           (1<<15)\r\n/* Indicates that authenticated communication between the client and server\r\n   should be signed with a \"dummy\" signature. */\r\n\r\n#define NTLMFLAG_TARGET_TYPE_DOMAIN              (1<<16)\r\n/* Sent by the server in the Type 2 message to indicate that the target\r\n   authentication realm is a domain. */\r\n\r\n#define NTLMFLAG_TARGET_TYPE_SERVER              (1<<17)\r\n/* Sent by the server in the Type 2 message to indicate that the target\r\n   authentication realm is a server. */\r\n\r\n#define NTLMFLAG_TARGET_TYPE_SHARE               (1<<18)\r\n/* Sent by the server in the Type 2 message to indicate that the target\r\n   authentication realm is a share. Presumably, this is for share-level\r\n   authentication. Usage is unclear. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_NTLM2_KEY             (1<<19)\r\n/* Indicates that the NTLM2 signing and sealing scheme should be used for\r\n   protecting authenticated communications. */\r\n\r\n#define NTLMFLAG_REQUEST_INIT_RESPONSE           (1<<20)\r\n/* unknown purpose */\r\n\r\n#define NTLMFLAG_REQUEST_ACCEPT_RESPONSE         (1<<21)\r\n/* unknown purpose */\r\n\r\n#define NTLMFLAG_REQUEST_NONNT_SESSION_KEY       (1<<22)\r\n/* unknown purpose */\r\n\r\n#define NTLMFLAG_NEGOTIATE_TARGET_INFO           (1<<23)\r\n/* Sent by the server in the Type 2 message to indicate that it is including a\r\n   Target Information block in the message. */\r\n\r\n/* unknown (1<24) */\r\n/* unknown (1<25) */\r\n/* unknown (1<26) */\r\n/* unknown (1<27) */\r\n/* unknown (1<28) */\r\n\r\n#define NTLMFLAG_NEGOTIATE_128                   (1<<29)\r\n/* Indicates that 128-bit encryption is supported. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE          (1<<30)\r\n/* Indicates that the client will provide an encrypted master key in\r\n   the \"Session Key\" field of the Type 3 message. */\r\n\r\n#define NTLMFLAG_NEGOTIATE_56                    (1<<31)\r\n/* Indicates that 56-bit encryption is supported. */\r\n\r\n#ifdef UNICODE\r\n#  define SECFLAG_WINNT_AUTH_IDENTITY \\\r\n     (unsigned long)SEC_WINNT_AUTH_IDENTITY_UNICODE\r\n#else\r\n#  define SECFLAG_WINNT_AUTH_IDENTITY \\\r\n     (unsigned long)SEC_WINNT_AUTH_IDENTITY_ANSI\r\n#endif\r\n\r\n#endif /* BUILDING_CURL_NTLM_MSGS_C */\r\n\r\n#endif /* USE_NTLM */\r\n\r\n#endif /* HEADER_CURL_NTLM_MSGS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm_wb.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n\r\n/*\r\n * NTLM details:\r\n *\r\n * http://davenport.sourceforge.net/ntlm.html\r\n * http://www.innovation.ch/java/ntlm.html\r\n */\r\n\r\n#define DEBUG_ME 0\r\n\r\n#ifdef HAVE_SYS_WAIT_H\r\n#include <sys/wait.h>\r\n#endif\r\n#ifdef HAVE_SIGNAL_H\r\n#include <signal.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"select.h\"\r\n#include \"curl_ntlm_wb.h\"\r\n#include \"url.h\"\r\n#include \"strerror.h\"\r\n#include \"curl_memory.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#if DEBUG_ME\r\n# define DEBUG_OUT(x) x\r\n#else\r\n# define DEBUG_OUT(x) Curl_nop_stmt\r\n#endif\r\n\r\n/* Portable 'sclose_nolog' used only in child process instead of 'sclose'\r\n   to avoid fooling the socket leak detector */\r\n#if defined(HAVE_CLOSESOCKET)\r\n#  define sclose_nolog(x)  closesocket((x))\r\n#elif defined(HAVE_CLOSESOCKET_CAMEL)\r\n#  define sclose_nolog(x)  CloseSocket((x))\r\n#else\r\n#  define sclose_nolog(x)  close((x))\r\n#endif\r\n\r\nvoid Curl_ntlm_wb_cleanup(struct connectdata *conn)\r\n{\r\n  if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) {\r\n    sclose(conn->ntlm_auth_hlpr_socket);\r\n    conn->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;\r\n  }\r\n\r\n  if(conn->ntlm_auth_hlpr_pid) {\r\n    int i;\r\n    for(i = 0; i < 4; i++) {\r\n      pid_t ret = waitpid(conn->ntlm_auth_hlpr_pid, NULL, WNOHANG);\r\n      if(ret == conn->ntlm_auth_hlpr_pid || errno == ECHILD)\r\n        break;\r\n      switch(i) {\r\n      case 0:\r\n        kill(conn->ntlm_auth_hlpr_pid, SIGTERM);\r\n        break;\r\n      case 1:\r\n        /* Give the process another moment to shut down cleanly before\r\n           bringing down the axe */\r\n        Curl_wait_ms(1);\r\n        break;\r\n      case 2:\r\n        kill(conn->ntlm_auth_hlpr_pid, SIGKILL);\r\n        break;\r\n      case 3:\r\n        break;\r\n      }\r\n    }\r\n    conn->ntlm_auth_hlpr_pid = 0;\r\n  }\r\n\r\n  Curl_safefree(conn->challenge_header);\r\n  conn->challenge_header = NULL;\r\n  Curl_safefree(conn->response_header);\r\n  conn->response_header = NULL;\r\n}\r\n\r\nstatic CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)\r\n{\r\n  curl_socket_t sockfds[2];\r\n  pid_t child_pid;\r\n  const char *username;\r\n  char *slash, *domain = NULL;\r\n  const char *ntlm_auth = NULL;\r\n  char *ntlm_auth_alloc = NULL;\r\n  int error;\r\n\r\n  /* Return if communication with ntlm_auth already set up */\r\n  if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD ||\r\n     conn->ntlm_auth_hlpr_pid)\r\n    return CURLE_OK;\r\n\r\n  username = userp;\r\n  slash = strpbrk(username, \"\\\\/\");\r\n  if(slash) {\r\n    if((domain = strdup(username)) == NULL)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    slash = domain + (slash - username);\r\n    *slash = '\\0';\r\n    username = username + (slash - domain) + 1;\r\n  }\r\n\r\n  /* For testing purposes, when DEBUGBUILD is defined and environment\r\n     variable CURL_NTLM_WB_FILE is set a fake_ntlm is used to perform\r\n     NTLM challenge/response which only accepts commands and output\r\n     strings pre-written in test case definitions */\r\n#ifdef DEBUGBUILD\r\n  ntlm_auth_alloc = curl_getenv(\"CURL_NTLM_WB_FILE\");\r\n  if(ntlm_auth_alloc)\r\n    ntlm_auth = ntlm_auth_alloc;\r\n  else\r\n#endif\r\n    ntlm_auth = NTLM_WB_FILE;\r\n\r\n  if(access(ntlm_auth, X_OK) != 0) {\r\n    error = ERRNO;\r\n    failf(conn->data, \"Could not access ntlm_auth: %s errno %d: %s\",\r\n          ntlm_auth, error, Curl_strerror(conn, error));\r\n    goto done;\r\n  }\r\n\r\n  if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {\r\n    error = ERRNO;\r\n    failf(conn->data, \"Could not open socket pair. errno %d: %s\",\r\n          error, Curl_strerror(conn, error));\r\n    goto done;\r\n  }\r\n\r\n  child_pid = fork();\r\n  if(child_pid == -1) {\r\n    error = ERRNO;\r\n    sclose(sockfds[0]);\r\n    sclose(sockfds[1]);\r\n    failf(conn->data, \"Could not fork. errno %d: %s\",\r\n          error, Curl_strerror(conn, error));\r\n    goto done;\r\n  }\r\n  else if(!child_pid) {\r\n    /*\r\n     * child process\r\n     */\r\n\r\n    /* Don't use sclose in the child since it fools the socket leak detector */\r\n    sclose_nolog(sockfds[0]);\r\n    if(dup2(sockfds[1], STDIN_FILENO) == -1) {\r\n      error = ERRNO;\r\n      failf(conn->data, \"Could not redirect child stdin. errno %d: %s\",\r\n            error, Curl_strerror(conn, error));\r\n      exit(1);\r\n    }\r\n\r\n    if(dup2(sockfds[1], STDOUT_FILENO) == -1) {\r\n      error = ERRNO;\r\n      failf(conn->data, \"Could not redirect child stdout. errno %d: %s\",\r\n            error, Curl_strerror(conn, error));\r\n      exit(1);\r\n    }\r\n\r\n    if(domain)\r\n      execl(ntlm_auth, ntlm_auth,\r\n            \"--helper-protocol\", \"ntlmssp-client-1\",\r\n            \"--use-cached-creds\",\r\n            \"--username\", username,\r\n            \"--domain\", domain,\r\n            NULL);\r\n    else\r\n      execl(ntlm_auth, ntlm_auth,\r\n            \"--helper-protocol\", \"ntlmssp-client-1\",\r\n            \"--use-cached-creds\",\r\n            \"--username\", username,\r\n            NULL);\r\n\r\n    error = ERRNO;\r\n    sclose_nolog(sockfds[1]);\r\n    failf(conn->data, \"Could not execl(). errno %d: %s\",\r\n          error, Curl_strerror(conn, error));\r\n    exit(1);\r\n  }\r\n\r\n  sclose(sockfds[1]);\r\n  conn->ntlm_auth_hlpr_socket = sockfds[0];\r\n  conn->ntlm_auth_hlpr_pid = child_pid;\r\n  Curl_safefree(domain);\r\n  Curl_safefree(ntlm_auth_alloc);\r\n  return CURLE_OK;\r\n\r\ndone:\r\n  Curl_safefree(domain);\r\n  Curl_safefree(ntlm_auth_alloc);\r\n  return CURLE_REMOTE_ACCESS_DENIED;\r\n}\r\n\r\nstatic CURLcode ntlm_wb_response(struct connectdata *conn,\r\n                                 const char *input, curlntlm state)\r\n{\r\n  ssize_t size;\r\n  char buf[200]; /* enough, type 1, 3 message length is less then 200 */\r\n  char *tmpbuf = buf;\r\n  size_t len_in = strlen(input), len_out = sizeof(buf);\r\n\r\n  while(len_in > 0) {\r\n    ssize_t written = swrite(conn->ntlm_auth_hlpr_socket, input, len_in);\r\n    if(written == -1) {\r\n      /* Interrupted by a signal, retry it */\r\n      if(errno == EINTR)\r\n        continue;\r\n      /* write failed if other errors happen */\r\n      goto done;\r\n    }\r\n    input += written;\r\n    len_in -= written;\r\n  }\r\n  /* Read one line */\r\n  while(len_out > 0) {\r\n    size = sread(conn->ntlm_auth_hlpr_socket, tmpbuf, len_out);\r\n    if(size == -1) {\r\n      if(errno == EINTR)\r\n        continue;\r\n      goto done;\r\n    }\r\n    else if(size == 0)\r\n      goto done;\r\n    else if(tmpbuf[size - 1] == '\\n') {\r\n      tmpbuf[size - 1] = '\\0';\r\n      goto wrfinish;\r\n    }\r\n    tmpbuf += size;\r\n    len_out -= size;\r\n  }\r\n  goto done;\r\nwrfinish:\r\n  /* Samba/winbind installed but not configured */\r\n  if(state == NTLMSTATE_TYPE1 &&\r\n     size == 3 &&\r\n     buf[0] == 'P' && buf[1] == 'W')\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n  /* invalid response */\r\n  if(size < 4)\r\n    goto done;\r\n  if(state == NTLMSTATE_TYPE1 &&\r\n     (buf[0]!='Y' || buf[1]!='R' || buf[2]!=' '))\r\n    goto done;\r\n  if(state == NTLMSTATE_TYPE2 &&\r\n     (buf[0]!='K' || buf[1]!='K' || buf[2]!=' ') &&\r\n     (buf[0]!='A' || buf[1]!='F' || buf[2]!=' '))\r\n    goto done;\r\n\r\n  conn->response_header = aprintf(\"NTLM %.*s\", size - 4, buf + 3);\r\n  return CURLE_OK;\r\ndone:\r\n  return CURLE_REMOTE_ACCESS_DENIED;\r\n}\r\n\r\n/*\r\n * This is for creating ntlm header output by delegating challenge/response\r\n * to Samba's winbind daemon helper ntlm_auth.\r\n */\r\nCURLcode Curl_output_ntlm_wb(struct connectdata *conn,\r\n                              bool proxy)\r\n{\r\n  /* point to the address of the pointer that holds the string to send to the\r\n     server, which is for a plain host or for a HTTP proxy */\r\n  char **allocuserpwd;\r\n  /* point to the name and password for this */\r\n  const char *userp;\r\n  /* point to the correct struct with this */\r\n  struct ntlmdata *ntlm;\r\n  struct auth *authp;\r\n\r\n  CURLcode res = CURLE_OK;\r\n  char *input;\r\n\r\n  DEBUGASSERT(conn);\r\n  DEBUGASSERT(conn->data);\r\n\r\n  if(proxy) {\r\n    allocuserpwd = &conn->allocptr.proxyuserpwd;\r\n    userp = conn->proxyuser;\r\n    ntlm = &conn->proxyntlm;\r\n    authp = &conn->data->state.authproxy;\r\n  }\r\n  else {\r\n    allocuserpwd = &conn->allocptr.userpwd;\r\n    userp = conn->user;\r\n    ntlm = &conn->ntlm;\r\n    authp = &conn->data->state.authhost;\r\n  }\r\n  authp->done = FALSE;\r\n\r\n  /* not set means empty */\r\n  if(!userp)\r\n    userp=\"\";\r\n\r\n  switch(ntlm->state) {\r\n  case NTLMSTATE_TYPE1:\r\n  default:\r\n    /* Use Samba's 'winbind' daemon to support NTLM authentication,\r\n     * by delegating the NTLM challenge/response protocal to a helper\r\n     * in ntlm_auth.\r\n     * http://devel.squid-cache.org/ntlm/squid_helper_protocol.html\r\n     * http://www.samba.org/samba/docs/man/manpages-3/winbindd.8.html\r\n     * http://www.samba.org/samba/docs/man/manpages-3/ntlm_auth.1.html\r\n     * Preprocessor symbol 'NTLM_WB_ENABLED' is defined when this\r\n     * feature is enabled and 'NTLM_WB_FILE' symbol holds absolute\r\n     * filename of ntlm_auth helper.\r\n     * If NTLM authentication using winbind fails, go back to original\r\n     * request handling process.\r\n     */\r\n    /* Create communication with ntlm_auth */\r\n    res = ntlm_wb_init(conn, userp);\r\n    if(res)\r\n      return res;\r\n    res = ntlm_wb_response(conn, \"YR\\n\", ntlm->state);\r\n    if(res)\r\n      return res;\r\n\r\n    Curl_safefree(*allocuserpwd);\r\n    *allocuserpwd = aprintf(\"%sAuthorization: %s\\r\\n\",\r\n                            proxy ? \"Proxy-\" : \"\",\r\n                            conn->response_header);\r\n    DEBUG_OUT(fprintf(stderr, \"**** Header %s\\n \", *allocuserpwd));\r\n    Curl_safefree(conn->response_header);\r\n    conn->response_header = NULL;\r\n    break;\r\n  case NTLMSTATE_TYPE2:\r\n    input = aprintf(\"TT %s\", conn->challenge_header);\r\n    if(!input)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    res = ntlm_wb_response(conn, input, ntlm->state);\r\n    free(input);\r\n    input = NULL;\r\n    if(res)\r\n      return res;\r\n\r\n    Curl_safefree(*allocuserpwd);\r\n    *allocuserpwd = aprintf(\"%sAuthorization: %s\\r\\n\",\r\n                            proxy ? \"Proxy-\" : \"\",\r\n                            conn->response_header);\r\n    DEBUG_OUT(fprintf(stderr, \"**** %s\\n \", *allocuserpwd));\r\n    ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */\r\n    authp->done = TRUE;\r\n    Curl_ntlm_wb_cleanup(conn);\r\n    break;\r\n  case NTLMSTATE_TYPE3:\r\n    /* connection is already authenticated,\r\n     * don't send a header in future requests */\r\n    if(*allocuserpwd) {\r\n      free(*allocuserpwd);\r\n      *allocuserpwd=NULL;\r\n    }\r\n    authp->done = TRUE;\r\n    break;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* USE_NTLM && NTLM_WB_ENABLED */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_ntlm_wb.h",
    "content": "#ifndef HEADER_CURL_NTLM_WB_H\r\n#define HEADER_CURL_NTLM_WB_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n\r\n/* this is for creating ntlm header output by delegating challenge/response\r\n   to Samba's winbind daemon helper ntlm_auth */\r\nCURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy);\r\n\r\nvoid Curl_ntlm_wb_cleanup(struct connectdata *conn);\r\n\r\n#endif /* USE_NTLM && NTLM_WB_ENABLED */\r\n\r\n#endif /* HEADER_CURL_NTLM_WB_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_rand.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"curl_rand.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Private pseudo-random number seed. Unsigned integer >= 32bit. Threads\r\n   mutual exclusion is not implemented to acess it since we do not require\r\n   high quality random numbers (only used in form boudary generation). */\r\n\r\nstatic unsigned int randseed;\r\n\r\n/* Pseudo-random number support. */\r\n\r\nunsigned int Curl_rand(void)\r\n{\r\n  unsigned int r;\r\n  /* Return an unsigned 32-bit pseudo-random number. */\r\n  r = randseed = randseed * 1103515245 + 12345;\r\n  return (r << 16) | ((r >> 16) & 0xFFFF);\r\n}\r\n\r\nvoid Curl_srand(void)\r\n{\r\n  /* Randomize pseudo-random number sequence. */\r\n\r\n  randseed = (unsigned int) time(NULL);\r\n  Curl_rand();\r\n  Curl_rand();\r\n  Curl_rand();\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_rand.h",
    "content": "#ifndef HEADER_CURL_RAND_H\r\n#define HEADER_CURL_RAND_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nvoid Curl_srand(void);\r\n\r\nunsigned int Curl_rand(void);\r\n\r\n#endif /* HEADER_CURL_RAND_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_rtmp.c",
    "content": "/***************************************************************************\r\n *                      _   _ ____  _\r\n *  Project         ___| | | |  _ \\| |\r\n *                 / __| | | | |_) | |\r\n *                | (__| |_| |  _ <| |___\r\n *                 \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_LIBRTMP\r\n\r\n#include \"urldata.h\"\r\n#include \"nonblock.h\" /* for curlx_nonblock */\r\n#include \"progress.h\" /* for Curl_pgrsSetUploadSize */\r\n#include \"transfer.h\"\r\n#include \"warnless.h\"\r\n#include <curl/curl.h>\r\n#include <librtmp/rtmp.h>\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef _WIN32\r\n#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e)\r\n#define SET_RCVTIMEO(tv,s)   int tv = s*1000\r\n#else\r\n#define SET_RCVTIMEO(tv,s)   struct timeval tv = {s,0}\r\n#endif\r\n\r\n#define DEF_BUFTIME    (2*60*60*1000)    /* 2 hours */\r\n\r\nstatic CURLcode rtmp_setup(struct connectdata *conn);\r\nstatic CURLcode rtmp_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode rtmp_done(struct connectdata *conn, CURLcode, bool premature);\r\nstatic CURLcode rtmp_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode rtmp_disconnect(struct connectdata *conn, bool dead);\r\n\r\nstatic Curl_recv rtmp_recv;\r\nstatic Curl_send rtmp_send;\r\n\r\n/*\r\n * RTMP protocol handler.h, based on http://rtmpdump.mplayerhq.hu\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_rtmp = {\r\n  \"RTMP\",                               /* scheme */\r\n  rtmp_setup,                           /* setup_connection */\r\n  rtmp_do,                              /* do_it */\r\n  rtmp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtmp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtmp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_RTMP,                            /* defport */\r\n  CURLPROTO_RTMP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags*/\r\n};\r\n\r\nconst struct Curl_handler Curl_handler_rtmpt = {\r\n  \"RTMPT\",                              /* scheme */\r\n  rtmp_setup,                           /* setup_connection */\r\n  rtmp_do,                              /* do_it */\r\n  rtmp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtmp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtmp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_RTMPT,                           /* defport */\r\n  CURLPROTO_RTMPT,                      /* protocol */\r\n  PROTOPT_NONE                          /* flags*/\r\n};\r\n\r\nconst struct Curl_handler Curl_handler_rtmpe = {\r\n  \"RTMPE\",                              /* scheme */\r\n  rtmp_setup,                           /* setup_connection */\r\n  rtmp_do,                              /* do_it */\r\n  rtmp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtmp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtmp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_RTMP,                            /* defport */\r\n  CURLPROTO_RTMPE,                      /* protocol */\r\n  PROTOPT_NONE                          /* flags*/\r\n};\r\n\r\nconst struct Curl_handler Curl_handler_rtmpte = {\r\n  \"RTMPTE\",                             /* scheme */\r\n  rtmp_setup,                           /* setup_connection */\r\n  rtmp_do,                              /* do_it */\r\n  rtmp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtmp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtmp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_RTMPT,                           /* defport */\r\n  CURLPROTO_RTMPTE,                     /* protocol */\r\n  PROTOPT_NONE                          /* flags*/\r\n};\r\n\r\nconst struct Curl_handler Curl_handler_rtmps = {\r\n  \"RTMPS\",                              /* scheme */\r\n  rtmp_setup,                           /* setup_connection */\r\n  rtmp_do,                              /* do_it */\r\n  rtmp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtmp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtmp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_RTMPS,                           /* defport */\r\n  CURLPROTO_RTMPS,                      /* protocol */\r\n  PROTOPT_NONE                          /* flags*/\r\n};\r\n\r\nconst struct Curl_handler Curl_handler_rtmpts = {\r\n  \"RTMPTS\",                             /* scheme */\r\n  rtmp_setup,                           /* setup_connection */\r\n  rtmp_do,                              /* do_it */\r\n  rtmp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtmp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtmp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_RTMPS,                           /* defport */\r\n  CURLPROTO_RTMPTS,                     /* protocol */\r\n  PROTOPT_NONE                          /* flags*/\r\n};\r\n\r\nstatic CURLcode rtmp_setup(struct connectdata *conn)\r\n{\r\n  RTMP *r = RTMP_Alloc();\r\n\r\n  if(!r)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  RTMP_Init(r);\r\n  RTMP_SetBufferMS(r, DEF_BUFTIME);\r\n  if(!RTMP_SetupURL(r, conn->data->change.url)) {\r\n    RTMP_Free(r);\r\n    return CURLE_URL_MALFORMAT;\r\n  }\r\n  conn->proto.generic = r;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode rtmp_connect(struct connectdata *conn, bool *done)\r\n{\r\n  RTMP *r = conn->proto.generic;\r\n  SET_RCVTIMEO(tv,10);\r\n\r\n  r->m_sb.sb_socket = conn->sock[FIRSTSOCKET];\r\n\r\n  /* We have to know if it's a write before we send the\r\n   * connect request packet\r\n   */\r\n  if(conn->data->set.upload)\r\n    r->Link.protocol |= RTMP_FEATURE_WRITE;\r\n\r\n  /* For plain streams, use the buffer toggle trick to keep data flowing */\r\n  if(!(r->Link.lFlags & RTMP_LF_LIVE) &&\r\n     !(r->Link.protocol & RTMP_FEATURE_HTTP))\r\n    r->Link.lFlags |= RTMP_LF_BUFX;\r\n\r\n  curlx_nonblock(r->m_sb.sb_socket, FALSE);\r\n  setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO,\r\n             (char *)&tv, sizeof(tv));\r\n\r\n  if(!RTMP_Connect1(r, NULL))\r\n    return CURLE_FAILED_INIT;\r\n\r\n  /* Clients must send a periodic BytesReceived report to the server */\r\n  r->m_bSendCounter = true;\r\n\r\n  *done = TRUE;\r\n  conn->recv[FIRSTSOCKET] = rtmp_recv;\r\n  conn->send[FIRSTSOCKET] = rtmp_send;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode rtmp_do(struct connectdata *conn, bool *done)\r\n{\r\n  RTMP *r = conn->proto.generic;\r\n\r\n  if(!RTMP_ConnectStream(r, 0))\r\n    return CURLE_FAILED_INIT;\r\n\r\n  if(conn->data->set.upload) {\r\n    Curl_pgrsSetUploadSize(conn->data, conn->data->set.infilesize);\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);\r\n  }\r\n  else\r\n    Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL);\r\n  *done = TRUE;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode rtmp_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature)\r\n{\r\n  (void)conn; /* unused */\r\n  (void)status; /* unused */\r\n  (void)premature; /* unused */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode rtmp_disconnect(struct connectdata *conn,\r\n                                bool dead_connection)\r\n{\r\n  RTMP *r = conn->proto.generic;\r\n  (void)dead_connection;\r\n  if(r) {\r\n    conn->proto.generic = NULL;\r\n    RTMP_Close(r);\r\n    RTMP_Free(r);\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic ssize_t rtmp_recv(struct connectdata *conn, int sockindex, char *buf,\r\n                         size_t len, CURLcode *err)\r\n{\r\n  RTMP *r = conn->proto.generic;\r\n  ssize_t nread;\r\n\r\n  (void)sockindex; /* unused */\r\n\r\n  nread = RTMP_Read(r, buf, curlx_uztosi(len));\r\n  if(nread < 0) {\r\n    if(r->m_read.status == RTMP_READ_COMPLETE ||\r\n        r->m_read.status == RTMP_READ_EOF) {\r\n      conn->data->req.size = conn->data->req.bytecount;\r\n      nread = 0;\r\n    }\r\n    else\r\n      *err = CURLE_RECV_ERROR;\r\n  }\r\n  return nread;\r\n}\r\n\r\nstatic ssize_t rtmp_send(struct connectdata *conn, int sockindex,\r\n                         const void *buf, size_t len, CURLcode *err)\r\n{\r\n  RTMP *r = conn->proto.generic;\r\n  ssize_t num;\r\n\r\n  (void)sockindex; /* unused */\r\n\r\n  num = RTMP_Write(r, (char *)buf, curlx_uztosi(len));\r\n  if(num < 0)\r\n    *err = CURLE_SEND_ERROR;\r\n\r\n  return num;\r\n}\r\n#endif  /* USE_LIBRTMP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_rtmp.h",
    "content": "#ifndef HEADER_CURL_RTMP_H\r\n#define HEADER_CURL_RTMP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifdef USE_LIBRTMP\r\nextern const struct Curl_handler Curl_handler_rtmp;\r\nextern const struct Curl_handler Curl_handler_rtmpt;\r\nextern const struct Curl_handler Curl_handler_rtmpe;\r\nextern const struct Curl_handler Curl_handler_rtmpte;\r\nextern const struct Curl_handler Curl_handler_rtmps;\r\nextern const struct Curl_handler Curl_handler_rtmpts;\r\n#endif\r\n\r\n#endif /* HEADER_CURL_RTMP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_sasl.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012-2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n * RFC2195 CRAM-MD5 authentication\r\n * RFC2831 DIGEST-MD5 authentication\r\n * RFC4422 Simple Authentication and Security Layer (SASL)\r\n * RFC4616 PLAIN authentication\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n\r\n#include \"curl_base64.h\"\r\n#include \"curl_md5.h\"\r\n#include \"curl_rand.h\"\r\n#include \"curl_hmac.h\"\r\n#include \"curl_ntlm_msgs.h\"\r\n#include \"curl_sasl.h\"\r\n#include \"warnless.h\"\r\n#include \"curl_memory.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n/* Retrieves the value for a corresponding key from the challenge string\r\n * returns TRUE if the key could be found, FALSE if it does not exists\r\n */\r\nstatic bool sasl_digest_get_key_value(const unsigned char *chlg,\r\n                                      const char *key,\r\n                                      char *value,\r\n                                      size_t max_val_len,\r\n                                      char end_char)\r\n{\r\n  char *find_pos;\r\n  size_t i;\r\n\r\n  find_pos = strstr((const char *) chlg, key);\r\n  if(!find_pos)\r\n    return FALSE;\r\n\r\n  find_pos += strlen(key);\r\n\r\n  for(i = 0; *find_pos && *find_pos != end_char && i < max_val_len - 1; ++i)\r\n    value[i] = *find_pos++;\r\n  value[i] = '\\0';\r\n\r\n  return TRUE;\r\n}\r\n#endif\r\n\r\n/*\r\n * Curl_sasl_create_plain_message()\r\n *\r\n * This is used to generate an already encoded PLAIN message ready\r\n * for sending to the recipient.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - The session handle.\r\n * userp   [in]     - The user name.\r\n * passdwp [in]     - The user's password.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,\r\n                                        const char* userp,\r\n                                        const char* passwdp,\r\n                                        char **outptr, size_t *outlen)\r\n{\r\n  char plainauth[2 * MAX_CURL_USER_LENGTH + MAX_CURL_PASSWORD_LENGTH];\r\n  size_t ulen;\r\n  size_t plen;\r\n\r\n  ulen = strlen(userp);\r\n  plen = strlen(passwdp);\r\n\r\n  if(2 * ulen + plen + 2 > sizeof(plainauth)) {\r\n    *outlen = 0;\r\n    *outptr = NULL;\r\n\r\n    /* Plainauth too small */\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Calculate the reply */\r\n  memcpy(plainauth, userp, ulen);\r\n  plainauth[ulen] = '\\0';\r\n  memcpy(plainauth + ulen + 1, userp, ulen);\r\n  plainauth[2 * ulen + 1] = '\\0';\r\n  memcpy(plainauth + 2 * ulen + 2, passwdp, plen);\r\n\r\n  /* Base64 encode the reply */\r\n  return Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr,\r\n                            outlen);\r\n}\r\n\r\n/*\r\n * Curl_sasl_create_login_message()\r\n *\r\n * This is used to generate an already encoded LOGIN message containing the\r\n * user name or password ready for sending to the recipient.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - The session handle.\r\n * valuep  [in]     - The user name or user's password.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_sasl_create_login_message(struct SessionHandle *data,\r\n                                        const char* valuep, char **outptr,\r\n                                        size_t *outlen)\r\n{\r\n  size_t vlen = strlen(valuep);\r\n\r\n  if(!vlen) {\r\n    /* Calculate an empty reply */\r\n    *outptr = strdup(\"=\");\r\n    if(*outptr) {\r\n      *outlen = (size_t) 1;\r\n      return CURLE_OK;\r\n    }\r\n\r\n    *outlen = 0;\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Base64 encode the value */\r\n  return Curl_base64_encode(data, valuep, vlen, outptr, outlen);\r\n}\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n/*\r\n * Curl_sasl_create_cram_md5_message()\r\n *\r\n * This is used to generate an already encoded CRAM-MD5 response message ready\r\n * for sending to the recipient.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - The session handle.\r\n * chlg64  [in]     - Pointer to the base64 encoded challenge buffer.\r\n * userp   [in]     - The user name.\r\n * passdwp [in]     - The user's password.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,\r\n                                           const char* chlg64,\r\n                                           const char* userp,\r\n                                           const char* passwdp,\r\n                                           char **outptr, size_t *outlen)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  size_t chlg64len = strlen(chlg64);\r\n  unsigned char *chlg = (unsigned char *) NULL;\r\n  size_t chlglen = 0;\r\n  HMAC_context *ctxt;\r\n  unsigned char digest[MD5_DIGEST_LEN];\r\n  char response[MAX_CURL_USER_LENGTH + 2 * MD5_DIGEST_LEN + 1];\r\n\r\n  /* Decode the challenge if necessary */\r\n  if(chlg64len && *chlg64 != '=') {\r\n    result = Curl_base64_decode(chlg64, &chlg, &chlglen);\r\n\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  /* Compute the digest using the password as the key */\r\n  ctxt = Curl_HMAC_init(Curl_HMAC_MD5,\r\n                        (const unsigned char *) passwdp,\r\n                        curlx_uztoui(strlen(passwdp)));\r\n\r\n  if(!ctxt) {\r\n    Curl_safefree(chlg);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Update the digest with the given challenge */\r\n  if(chlglen > 0)\r\n    Curl_HMAC_update(ctxt, chlg, curlx_uztoui(chlglen));\r\n\r\n  Curl_safefree(chlg);\r\n\r\n  /* Finalise the digest */\r\n  Curl_HMAC_final(ctxt, digest);\r\n\r\n  /* Prepare the response */\r\n  snprintf(response, sizeof(response),\r\n      \"%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\",\r\n           userp, digest[0], digest[1], digest[2], digest[3], digest[4],\r\n           digest[5], digest[6], digest[7], digest[8], digest[9], digest[10],\r\n           digest[11], digest[12], digest[13], digest[14], digest[15]);\r\n\r\n  /* Base64 encode the reply */\r\n  return Curl_base64_encode(data, response, 0, outptr, outlen);\r\n}\r\n\r\n/*\r\n * Curl_sasl_create_digest_md5_message()\r\n *\r\n * This is used to generate an already encoded DIGEST-MD5 response message\r\n * ready for sending to the recipient.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - The session handle.\r\n * chlg64  [in]     - Pointer to the base64 encoded challenge buffer.\r\n * userp   [in]     - The user name.\r\n * passdwp [in]     - The user's password.\r\n * service [in]     - The service type such as www, smtp or pop\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,\r\n                                             const char* chlg64,\r\n                                             const char* userp,\r\n                                             const char* passwdp,\r\n                                             const char* service,\r\n                                             char **outptr, size_t *outlen)\r\n{\r\n  static const char table16[] = \"0123456789abcdef\";\r\n\r\n  CURLcode result = CURLE_OK;\r\n  unsigned char *chlg = (unsigned char *) NULL;\r\n  size_t chlglen = 0;\r\n  size_t i;\r\n  MD5_context *ctxt;\r\n  unsigned char digest[MD5_DIGEST_LEN];\r\n  char HA1_hex[2 * MD5_DIGEST_LEN + 1];\r\n  char HA2_hex[2 * MD5_DIGEST_LEN + 1];\r\n  char resp_hash_hex[2 * MD5_DIGEST_LEN + 1];\r\n\r\n  char nonce[64];\r\n  char realm[128];\r\n  char alg[64];\r\n  char nonceCount[] = \"00000001\";\r\n  char cnonce[]     = \"12345678\"; /* will be changed */\r\n  char method[]     = \"AUTHENTICATE\";\r\n  char qop[]        = \"auth\";\r\n  char uri[128];\r\n  char response[512];\r\n\r\n  result = Curl_base64_decode(chlg64, &chlg, &chlglen);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  /* Retrieve nonce string from the challenge */\r\n  if(!sasl_digest_get_key_value(chlg, \"nonce=\\\"\", nonce,\r\n                                sizeof(nonce), '\\\"')) {\r\n    Curl_safefree(chlg);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Retrieve realm string from the challenge */\r\n  if(!sasl_digest_get_key_value(chlg, \"realm=\\\"\", realm,\r\n                                sizeof(realm), '\\\"')) {\r\n    /* Challenge does not have a realm, set empty string [RFC2831] page 6 */\r\n    strcpy(realm, \"\");\r\n  }\r\n\r\n  /* Retrieve algorithm string from the challenge */\r\n  if(!sasl_digest_get_key_value(chlg, \"algorithm=\", alg, sizeof(alg), ',')) {\r\n    Curl_safefree(chlg);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  Curl_safefree(chlg);\r\n\r\n  /* We do not support other algorithms */\r\n  if(strcmp(alg, \"md5-sess\") != 0)\r\n    return CURLE_LOGIN_DENIED;\r\n\r\n  /* Generate 64 bits of random data */\r\n  for(i = 0; i < 8; i++)\r\n    cnonce[i] = table16[Curl_rand()%16];\r\n\r\n  /* So far so good, now calculate A1 and H(A1) according to RFC 2831 */\r\n  ctxt = Curl_MD5_init(Curl_DIGEST_MD5);\r\n  if(!ctxt)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) userp,\r\n                  curlx_uztoui(strlen(userp)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) realm,\r\n                  curlx_uztoui(strlen(realm)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) passwdp,\r\n                  curlx_uztoui(strlen(passwdp)));\r\n  Curl_MD5_final(ctxt, digest);\r\n\r\n  ctxt = Curl_MD5_init(Curl_DIGEST_MD5);\r\n  if(!ctxt)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) digest, MD5_DIGEST_LEN);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) nonce,\r\n                  curlx_uztoui(strlen(nonce)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) cnonce,\r\n                  curlx_uztoui(strlen(cnonce)));\r\n  Curl_MD5_final(ctxt, digest);\r\n\r\n  /* Convert calculated 16 octet hex into 32 bytes string */\r\n  for(i = 0; i < MD5_DIGEST_LEN; i++)\r\n    snprintf(&HA1_hex[2 * i], 3, \"%02x\", digest[i]);\r\n\r\n  /* Prepare the URL string */\r\n  snprintf(uri, sizeof(uri), \"%s/%s\", service, realm);\r\n\r\n  /* Calculate H(A2) */\r\n  ctxt = Curl_MD5_init(Curl_DIGEST_MD5);\r\n  if(!ctxt)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) method,\r\n                  curlx_uztoui(strlen(method)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) uri,\r\n                  curlx_uztoui(strlen(uri)));\r\n  Curl_MD5_final(ctxt, digest);\r\n\r\n  for(i = 0; i < MD5_DIGEST_LEN; i++)\r\n    snprintf(&HA2_hex[2 * i], 3, \"%02x\", digest[i]);\r\n\r\n  /* Now calculate the response hash */\r\n  ctxt = Curl_MD5_init(Curl_DIGEST_MD5);\r\n  if(!ctxt)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) HA1_hex, 2 * MD5_DIGEST_LEN);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) nonce,\r\n                  curlx_uztoui(strlen(nonce)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) nonceCount,\r\n                  curlx_uztoui(strlen(nonceCount)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) cnonce,\r\n                  curlx_uztoui(strlen(cnonce)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n  Curl_MD5_update(ctxt, (const unsigned char *) qop,\r\n                  curlx_uztoui(strlen(qop)));\r\n  Curl_MD5_update(ctxt, (const unsigned char *) \":\", 1);\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) HA2_hex, 2 * MD5_DIGEST_LEN);\r\n  Curl_MD5_final(ctxt, digest);\r\n\r\n  for(i = 0; i < MD5_DIGEST_LEN; i++)\r\n    snprintf(&resp_hash_hex[2 * i], 3, \"%02x\", digest[i]);\r\n\r\n  snprintf(response, sizeof(response),\r\n           \"username=\\\"%s\\\",realm=\\\"%s\\\",nonce=\\\"%s\\\",\"\r\n           \"cnonce=\\\"%s\\\",nc=\\\"%s\\\",digest-uri=\\\"%s\\\",response=%s\",\r\n           userp, realm, nonce,\r\n           cnonce, nonceCount, uri, resp_hash_hex);\r\n\r\n  /* Base64 encode the reply */\r\n  return Curl_base64_encode(data, response, 0, outptr, outlen);\r\n}\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n/*\r\n * Curl_sasl_create_ntlm_type1_message()\r\n *\r\n * This is used to generate an already encoded NTLM type-1 message ready for\r\n * sending to the recipient.\r\n *\r\n * Note: This is a simple wrapper of the NTLM function which means that any\r\n * SASL based protocols don't have to include the NTLM functions directly.\r\n *\r\n * Parameters:\r\n *\r\n * userp   [in]     - The user name in the format User or Domain\\User.\r\n * passdwp [in]     - The user's password.\r\n * ntlm    [in/out] - The ntlm data struct being used and modified.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,\r\n                                             const char *passwdp,\r\n                                             struct ntlmdata *ntlm,\r\n                                             char **outptr, size_t *outlen)\r\n{\r\n  return Curl_ntlm_create_type1_message(userp, passwdp, ntlm, outptr,\r\n                                        outlen);\r\n}\r\n\r\n/*\r\n * Curl_sasl_create_ntlm_type3_message()\r\n *\r\n * This is used to generate an already encoded NTLM type-3 message ready for\r\n * sending to the recipient.\r\n *\r\n * Parameters:\r\n *\r\n * data    [in]     - Pointer to session handle.\r\n * header  [in]     - Pointer to the base64 encoded type-2 message buffer.\r\n * userp   [in]     - The user name in the format User or Domain\\User.\r\n * passdwp [in]     - The user's password.\r\n * ntlm    [in/out] - The ntlm data struct being used and modified.\r\n * outptr  [in/out] - The address where a pointer to newly allocated memory\r\n *                    holding the result will be stored upon completion.\r\n * outlen  [out]    - The length of the output message.\r\n *\r\n * Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,\r\n                                             const char *header,\r\n                                             const char *userp,\r\n                                             const char *passwdp,\r\n                                             struct ntlmdata *ntlm,\r\n                                             char **outptr, size_t *outlen)\r\n{\r\n  CURLcode result = Curl_ntlm_decode_type2_message(data, header, ntlm);\r\n\r\n  if(!result)\r\n    result = Curl_ntlm_create_type3_message(data, userp, passwdp, ntlm,\r\n                                            outptr, outlen);\r\n\r\n  return result;\r\n}\r\n#endif /* USE_NTLM */\r\n\r\n/*\r\n * Curl_sasl_cleanup()\r\n *\r\n * This is used to cleanup any libraries or curl modules used by the sasl\r\n * functions.\r\n *\r\n * Parameters:\r\n *\r\n * conn     [in]     - Pointer to the connection data.\r\n * authused [in]     - The authentication mechanism used.\r\n */\r\nvoid Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused)\r\n{\r\n#ifdef USE_NTLM\r\n  /* Cleanup the ntlm structure */\r\n  if(authused == SASL_MECH_NTLM) {\r\n    Curl_ntlm_sspi_cleanup(&conn->ntlm);\r\n  }\r\n  (void)conn;\r\n#else\r\n  /* Reserved for future use */\r\n  (void)conn;\r\n  (void)authused;\r\n#endif\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_sasl.h",
    "content": "#ifndef HEADER_CURL_SASL_H\r\n#define HEADER_CURL_SASL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"pingpong.h\"\r\n\r\n/* Authentication mechanism flags */\r\n#define SASL_MECH_LOGIN         0x0001\r\n#define SASL_MECH_PLAIN         0x0002\r\n#define SASL_MECH_CRAM_MD5      0x0004\r\n#define SASL_MECH_DIGEST_MD5    0x0008\r\n#define SASL_MECH_GSSAPI        0x0010\r\n#define SASL_MECH_EXTERNAL      0x0020\r\n#define SASL_MECH_NTLM          0x0040\r\n\r\n/* This is used to generate a base64 encoded PLAIN authentication message */\r\nCURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,\r\n                                        const char* userp,\r\n                                        const char* passwdp,\r\n                                        char **outptr, size_t *outlen);\r\n\r\n/* This is used to generate a base64 encoded LOGIN authentication message\r\n   containing either the user name or password details */\r\nCURLcode Curl_sasl_create_login_message(struct SessionHandle *data,\r\n                                        const char* valuep, char **outptr,\r\n                                        size_t *outlen);\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n/* This is used to generate a base64 encoded CRAM-MD5 response message */\r\nCURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,\r\n                                           const char* chlg64,\r\n                                           const char* user,\r\n                                           const char* passwdp,\r\n                                           char **outptr, size_t *outlen);\r\n\r\n/* This is used to generate a base64 encoded DIGEST-MD5 response message */\r\nCURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,\r\n                                             const char* chlg64,\r\n                                             const char* user,\r\n                                             const char* passwdp,\r\n                                             const char* service,\r\n                                             char **outptr, size_t *outlen);\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n/* This is used to generate a base64 encoded NTLM type-1 message */\r\nCURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,\r\n                                             const char *passwdp,\r\n                                             struct ntlmdata *ntlm,\r\n                                             char **outptr,\r\n                                             size_t *outlen);\r\n\r\n/* This is used to decode an incoming NTLM type-2 message and generate a\r\n   base64 encoded type-3 response */\r\nCURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,\r\n                                             const char *header,\r\n                                             const char *userp,\r\n                                             const char *passwdp,\r\n                                             struct ntlmdata *ntlm,\r\n                                             char **outptr, size_t *outlen);\r\n\r\n#endif /* USE_NTLM */\r\n\r\n/* This is used to cleanup any libraries or curl modules used by the sasl\r\n   functions */\r\nvoid Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused);\r\n\r\n#endif /* HEADER_CURL_SASL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_schannel.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012 - 2013, Marc Hoersken, <info@marc-hoersken.de>\r\n * Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com>\r\n * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all SChannel-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n *\r\n */\r\n\r\n/*\r\n * Based upon the PolarSSL implementation in polarssl.c and polarssl.h:\r\n *   Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>\r\n *\r\n * Based upon the CyaSSL implementation in cyassl.c and cyassl.h:\r\n *   Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * Thanks for code and inspiration!\r\n */\r\n\r\n/*\r\n * TODO list for TLS/SSL implementation:\r\n * - implement client certificate authentication\r\n * - implement custom server certificate validation\r\n * - implement cipher/algorithm option\r\n *\r\n * Related articles on MSDN:\r\n * - Getting a Certificate for Schannel\r\n *   http://msdn.microsoft.com/en-us/library/windows/desktop/aa375447.aspx\r\n * - Specifying Schannel Ciphers and Cipher Strengths\r\n *   http://msdn.microsoft.com/en-us/library/windows/desktop/aa380161.aspx\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_SCHANNEL\r\n\r\n#ifndef USE_WINDOWS_SSPI\r\n#  error \"Can't compile SCHANNEL support without SSPI.\"\r\n#endif\r\n\r\n#include \"curl_sspi.h\"\r\n#include \"curl_schannel.h\"\r\n#include \"sslgen.h\"\r\n#include \"sendf.h\"\r\n#include \"connect.h\" /* for the connect timeout */\r\n#include \"strerror.h\"\r\n#include \"select.h\" /* for the socket readyness */\r\n#include \"inet_pton.h\" /* for IP addr SNI check */\r\n#include \"curl_multibyte.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Uncomment to force verbose output\r\n * #define infof(x, y, ...) printf(y, __VA_ARGS__)\r\n * #define failf(x, y, ...) printf(y, __VA_ARGS__)\r\n */\r\n\r\nstatic Curl_recv schannel_recv;\r\nstatic Curl_send schannel_send;\r\n\r\n#ifdef _WIN32_WCE\r\nstatic CURLcode verify_certificate(struct connectdata *conn, int sockindex);\r\n#endif\r\n\r\nstatic void InitSecBuffer(SecBuffer *buffer, unsigned long BufType,\r\n                          void *BufDataPtr, unsigned long BufByteSize)\r\n{\r\n  buffer->cbBuffer = BufByteSize;\r\n  buffer->BufferType = BufType;\r\n  buffer->pvBuffer = BufDataPtr;\r\n}\r\n\r\nstatic void InitSecBufferDesc(SecBufferDesc *desc, SecBuffer *BufArr,\r\n                              unsigned long NumArrElem)\r\n{\r\n  desc->ulVersion = SECBUFFER_VERSION;\r\n  desc->pBuffers = BufArr;\r\n  desc->cBuffers = NumArrElem;\r\n}\r\n\r\nstatic CURLcode\r\nschannel_connect_step1(struct connectdata *conn, int sockindex)\r\n{\r\n  ssize_t written = -1;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  SecBuffer outbuf;\r\n  SecBufferDesc outbuf_desc;\r\n  SCHANNEL_CRED schannel_cred;\r\n  SECURITY_STATUS sspi_status = SEC_E_OK;\r\n  struct curl_schannel_cred *old_cred = NULL;\r\n  struct in_addr addr;\r\n#ifdef ENABLE_IPV6\r\n  struct in6_addr addr6;\r\n#endif\r\n  TCHAR *host_name;\r\n  CURLcode code;\r\n\r\n  infof(data, \"schannel: SSL/TLS connection with %s port %hu (step 1/3)\\n\",\r\n        conn->host.name, conn->remote_port);\r\n\r\n  /* check for an existing re-usable credential handle */\r\n  if(!Curl_ssl_getsessionid(conn, (void**)&old_cred, NULL)) {\r\n    connssl->cred = old_cred;\r\n    infof(data, \"schannel: re-using existing credential handle\\n\");\r\n  }\r\n  else {\r\n    /* setup Schannel API options */\r\n    memset(&schannel_cred, 0, sizeof(schannel_cred));\r\n    schannel_cred.dwVersion = SCHANNEL_CRED_VERSION;\r\n\r\n    if(data->set.ssl.verifypeer) {\r\n#ifdef _WIN32_WCE\r\n      /* certificate validation on CE doesn't seem to work right; we'll\r\n         do it following a more manual process. */\r\n      schannel_cred.dwFlags = SCH_CRED_MANUAL_CRED_VALIDATION |\r\n                              SCH_CRED_IGNORE_NO_REVOCATION_CHECK |\r\n                              SCH_CRED_IGNORE_REVOCATION_OFFLINE;\r\n#else\r\n      schannel_cred.dwFlags = SCH_CRED_AUTO_CRED_VALIDATION |\r\n                              SCH_CRED_REVOCATION_CHECK_CHAIN;\r\n#endif\r\n      infof(data, \"schannel: checking server certificate revocation\\n\");\r\n    }\r\n    else {\r\n      schannel_cred.dwFlags = SCH_CRED_MANUAL_CRED_VALIDATION |\r\n                              SCH_CRED_IGNORE_NO_REVOCATION_CHECK |\r\n                              SCH_CRED_IGNORE_REVOCATION_OFFLINE;\r\n      infof(data, \"schannel: disable server certificate revocation checks\\n\");\r\n    }\r\n\r\n    if(Curl_inet_pton(AF_INET, conn->host.name, &addr)\r\n#ifdef ENABLE_IPV6\r\n       || Curl_inet_pton(AF_INET6, conn->host.name, &addr6)\r\n#endif\r\n      ) {\r\n      schannel_cred.dwFlags |= SCH_CRED_NO_SERVERNAME_CHECK;\r\n      infof(data, \"schannel: using IP address, SNI is being disabled by \"\r\n                  \"disabling the servername check against the \"\r\n                  \"subject names in server certificates.\\n\");\r\n    }\r\n\r\n    if(!data->set.ssl.verifyhost) {\r\n      schannel_cred.dwFlags |= SCH_CRED_NO_SERVERNAME_CHECK;\r\n      infof(data, \"schannel: verifyhost setting prevents Schannel from \"\r\n                  \"comparing the supplied target name with the subject \"\r\n                  \"names in server certificates. Also disables SNI.\\n\");\r\n    }\r\n\r\n    switch(data->set.ssl.version) {\r\n      case CURL_SSLVERSION_TLSv1:\r\n        schannel_cred.grbitEnabledProtocols = SP_PROT_TLS1_0_CLIENT |\r\n                                              SP_PROT_TLS1_1_CLIENT |\r\n                                              SP_PROT_TLS1_2_CLIENT;\r\n        break;\r\n      case CURL_SSLVERSION_SSLv3:\r\n        schannel_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT;\r\n        break;\r\n      case CURL_SSLVERSION_SSLv2:\r\n        schannel_cred.grbitEnabledProtocols = SP_PROT_SSL2_CLIENT;\r\n        break;\r\n    }\r\n\r\n    /* allocate memory for the re-usable credential handle */\r\n    connssl->cred = malloc(sizeof(struct curl_schannel_cred));\r\n    if(!connssl->cred) {\r\n      failf(data, \"schannel: unable to allocate memory\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    memset(connssl->cred, 0, sizeof(struct curl_schannel_cred));\r\n\r\n    /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa374716.aspx */\r\n    sspi_status = s_pSecFn->AcquireCredentialsHandle(NULL, (TCHAR *)UNISP_NAME,\r\n      SECPKG_CRED_OUTBOUND, NULL, &schannel_cred, NULL, NULL,\r\n      &connssl->cred->cred_handle, &connssl->cred->time_stamp);\r\n\r\n    if(sspi_status != SEC_E_OK) {\r\n      if(sspi_status == SEC_E_WRONG_PRINCIPAL)\r\n        failf(data, \"schannel: SNI or certificate check failed: %s\",\r\n              Curl_sspi_strerror(conn, sspi_status));\r\n      else\r\n        failf(data, \"schannel: AcquireCredentialsHandle failed: %s\",\r\n              Curl_sspi_strerror(conn, sspi_status));\r\n      Curl_safefree(connssl->cred);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n\r\n  /* setup output buffer */\r\n  InitSecBuffer(&outbuf, SECBUFFER_EMPTY, NULL, 0);\r\n  InitSecBufferDesc(&outbuf_desc, &outbuf, 1);\r\n\r\n  /* setup request flags */\r\n  connssl->req_flags = ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |\r\n                       ISC_REQ_CONFIDENTIALITY | ISC_REQ_ALLOCATE_MEMORY |\r\n                       ISC_REQ_STREAM;\r\n\r\n  /* allocate memory for the security context handle */\r\n  connssl->ctxt = malloc(sizeof(struct curl_schannel_ctxt));\r\n  if(!connssl->ctxt) {\r\n    failf(data, \"schannel: unable to allocate memory\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  memset(connssl->ctxt, 0, sizeof(struct curl_schannel_ctxt));\r\n\r\n  host_name = Curl_convert_UTF8_to_tchar(conn->host.name);\r\n  if(!host_name)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375924.aspx */\r\n\r\n  sspi_status = s_pSecFn->InitializeSecurityContext(\r\n    &connssl->cred->cred_handle, NULL, host_name,\r\n    connssl->req_flags, 0, 0, NULL, 0, &connssl->ctxt->ctxt_handle,\r\n    &outbuf_desc, &connssl->ret_flags, &connssl->ctxt->time_stamp);\r\n\r\n  Curl_unicodefree(host_name);\r\n\r\n  if(sspi_status != SEC_I_CONTINUE_NEEDED) {\r\n    if(sspi_status == SEC_E_WRONG_PRINCIPAL)\r\n      failf(data, \"schannel: SNI or certificate check failed: %s\",\r\n            Curl_sspi_strerror(conn, sspi_status));\r\n    else\r\n      failf(data, \"schannel: initial InitializeSecurityContext failed: %s\",\r\n            Curl_sspi_strerror(conn, sspi_status));\r\n    Curl_safefree(connssl->ctxt);\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  infof(data, \"schannel: sending initial handshake data: \"\r\n        \"sending %lu bytes...\\n\", outbuf.cbBuffer);\r\n\r\n  /* send initial handshake data which is now stored in output buffer */\r\n  code = Curl_write_plain(conn, conn->sock[sockindex], outbuf.pvBuffer,\r\n                          outbuf.cbBuffer, &written);\r\n  s_pSecFn->FreeContextBuffer(outbuf.pvBuffer);\r\n  if((code != CURLE_OK) || (outbuf.cbBuffer != (size_t)written)) {\r\n    failf(data, \"schannel: failed to send initial handshake data: \"\r\n          \"sent %zd of %lu bytes\", written, outbuf.cbBuffer);\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  infof(data, \"schannel: sent initial handshake data: \"\r\n        \"sent %zd bytes\\n\", written);\r\n\r\n  /* continue to second handshake step */\r\n  connssl->connecting_state = ssl_connect_2;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\nschannel_connect_step2(struct connectdata *conn, int sockindex)\r\n{\r\n  int i;\r\n  ssize_t nread = -1, written = -1;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  SecBuffer outbuf[2];\r\n  SecBufferDesc outbuf_desc;\r\n  SecBuffer inbuf[2];\r\n  SecBufferDesc inbuf_desc;\r\n  SECURITY_STATUS sspi_status = SEC_E_OK;\r\n  TCHAR *host_name;\r\n  CURLcode code;\r\n  bool doread;\r\n\r\n  doread = (connssl->connecting_state != ssl_connect_2_writing) ? TRUE : FALSE;\r\n\r\n  infof(data, \"schannel: SSL/TLS connection with %s port %hu (step 2/3)\\n\",\r\n        conn->host.name, conn->remote_port);\r\n\r\n  /* buffer to store previously received and encrypted data */\r\n  if(connssl->encdata_buffer == NULL) {\r\n    connssl->encdata_offset = 0;\r\n    connssl->encdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;\r\n    connssl->encdata_buffer = malloc(connssl->encdata_length);\r\n    if(connssl->encdata_buffer == NULL) {\r\n      failf(data, \"schannel: unable to allocate memory\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* if we need a bigger buffer to read a full message, increase buffer now */\r\n  if(connssl->encdata_length - connssl->encdata_offset <\r\n     CURL_SCHANNEL_BUFFER_FREE_SIZE) {\r\n    /* increase internal encrypted data buffer */\r\n    connssl->encdata_length *= CURL_SCHANNEL_BUFFER_STEP_FACTOR;\r\n    connssl->encdata_buffer = realloc(connssl->encdata_buffer,\r\n                                      connssl->encdata_length);\r\n\r\n    if(connssl->encdata_buffer == NULL) {\r\n      failf(data, \"schannel: unable to re-allocate memory\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  for(;;) {\r\n    if(doread) {\r\n      /* read encrypted handshake data from socket */\r\n      code = Curl_read_plain(conn->sock[sockindex],\r\n                (char *) (connssl->encdata_buffer + connssl->encdata_offset),\r\n                          connssl->encdata_length - connssl->encdata_offset,\r\n                          &nread);\r\n      if(code == CURLE_AGAIN) {\r\n        if(connssl->connecting_state != ssl_connect_2_writing)\r\n          connssl->connecting_state = ssl_connect_2_reading;\r\n        infof(data, \"schannel: failed to receive handshake, \"\r\n              \"need more data\\n\");\r\n        return CURLE_OK;\r\n      }\r\n      else if((code != CURLE_OK) || (nread == 0)) {\r\n        failf(data, \"schannel: failed to receive handshake, \"\r\n              \"SSL/TLS connection failed\");\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n\r\n      /* increase encrypted data buffer offset */\r\n      connssl->encdata_offset += nread;\r\n    }\r\n\r\n    infof(data, \"schannel: encrypted data buffer: offset %zu length %zu\\n\",\r\n        connssl->encdata_offset, connssl->encdata_length);\r\n\r\n    /* setup input buffers */\r\n    InitSecBuffer(&inbuf[0], SECBUFFER_TOKEN, malloc(connssl->encdata_offset),\r\n                  curlx_uztoul(connssl->encdata_offset));\r\n    InitSecBuffer(&inbuf[1], SECBUFFER_EMPTY, NULL, 0);\r\n    InitSecBufferDesc(&inbuf_desc, inbuf, 2);\r\n\r\n    /* setup output buffers */\r\n    InitSecBuffer(&outbuf[0], SECBUFFER_TOKEN, NULL, 0);\r\n    InitSecBuffer(&outbuf[1], SECBUFFER_ALERT, NULL, 0);\r\n    InitSecBufferDesc(&outbuf_desc, outbuf, 2);\r\n\r\n    if(inbuf[0].pvBuffer == NULL) {\r\n      failf(data, \"schannel: unable to allocate memory\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    /* copy received handshake data into input buffer */\r\n    memcpy(inbuf[0].pvBuffer, connssl->encdata_buffer,\r\n           connssl->encdata_offset);\r\n\r\n    host_name = Curl_convert_UTF8_to_tchar(conn->host.name);\r\n    if(!host_name)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375924.aspx */\r\n\r\n    sspi_status = s_pSecFn->InitializeSecurityContext(\r\n      &connssl->cred->cred_handle, &connssl->ctxt->ctxt_handle,\r\n      host_name, connssl->req_flags, 0, 0, &inbuf_desc, 0, NULL,\r\n      &outbuf_desc, &connssl->ret_flags, &connssl->ctxt->time_stamp);\r\n\r\n    Curl_unicodefree(host_name);\r\n\r\n    /* free buffer for received handshake data */\r\n    Curl_safefree(inbuf[0].pvBuffer);\r\n\r\n    /* check if the handshake was incomplete */\r\n    if(sspi_status == SEC_E_INCOMPLETE_MESSAGE) {\r\n      connssl->connecting_state = ssl_connect_2_reading;\r\n      infof(data, \"schannel: received incomplete message, need more data\\n\");\r\n      return CURLE_OK;\r\n    }\r\n\r\n    /* check if the handshake needs to be continued */\r\n    if(sspi_status == SEC_I_CONTINUE_NEEDED || sspi_status == SEC_E_OK) {\r\n      for(i = 0; i < 2; i++) {\r\n        /* search for handshake tokens that need to be send */\r\n        if(outbuf[i].BufferType == SECBUFFER_TOKEN && outbuf[i].cbBuffer > 0) {\r\n          infof(data, \"schannel: sending next handshake data: \"\r\n                \"sending %lu bytes...\\n\", outbuf[i].cbBuffer);\r\n\r\n          /* send handshake token to server */\r\n          code = Curl_write_plain(conn, conn->sock[sockindex],\r\n                                  outbuf[i].pvBuffer, outbuf[i].cbBuffer,\r\n                                  &written);\r\n          if((code != CURLE_OK) || (outbuf[i].cbBuffer != (size_t)written)) {\r\n            failf(data, \"schannel: failed to send next handshake data: \"\r\n                  \"sent %zd of %lu bytes\", written, outbuf[i].cbBuffer);\r\n            return CURLE_SSL_CONNECT_ERROR;\r\n          }\r\n        }\r\n\r\n        /* free obsolete buffer */\r\n        if(outbuf[i].pvBuffer != NULL) {\r\n          s_pSecFn->FreeContextBuffer(outbuf[i].pvBuffer);\r\n        }\r\n      }\r\n    }\r\n    else {\r\n      if(sspi_status == SEC_E_WRONG_PRINCIPAL)\r\n        failf(data, \"schannel: SNI or certificate check failed: %s\",\r\n              Curl_sspi_strerror(conn, sspi_status));\r\n      else\r\n        failf(data, \"schannel: next InitializeSecurityContext failed: %s\",\r\n              Curl_sspi_strerror(conn, sspi_status));\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n\r\n    /* check if there was additional remaining encrypted data */\r\n    if(inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) {\r\n      infof(data, \"schannel: encrypted data length: %lu\\n\", inbuf[1].cbBuffer);\r\n      /*\r\n         There are two cases where we could be getting extra data here:\r\n         1) If we're renegotiating a connection and the handshake is already\r\n            complete (from the server perspective), it can encrypted app data\r\n            (not handshake data) in an extra buffer at this point.\r\n         2) (sspi_status == SEC_I_CONTINUE_NEEDED) We are negotiating a\r\n            connection and this extra data is part of the handshake.\r\n            We should process the data immediately; waiting for the socket to\r\n            be ready may fail since the server is done sending handshake data.\r\n       */\r\n      /* check if the remaining data is less than the total amount\r\n         and therefore begins after the already processed data */\r\n      if(connssl->encdata_offset > inbuf[1].cbBuffer) {\r\n        memmove(connssl->encdata_buffer,\r\n                (connssl->encdata_buffer + connssl->encdata_offset) -\r\n                  inbuf[1].cbBuffer, inbuf[1].cbBuffer);\r\n        connssl->encdata_offset = inbuf[1].cbBuffer;\r\n        if(sspi_status == SEC_I_CONTINUE_NEEDED) {\r\n          doread = FALSE;\r\n          continue;\r\n        }\r\n      }\r\n    }\r\n    else {\r\n      connssl->encdata_offset = 0;\r\n    }\r\n    break;\r\n  }\r\n\r\n  /* check if the handshake needs to be continued */\r\n  if(sspi_status == SEC_I_CONTINUE_NEEDED) {\r\n    connssl->connecting_state = ssl_connect_2_reading;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  /* check if the handshake is complete */\r\n  if(sspi_status == SEC_E_OK) {\r\n    connssl->connecting_state = ssl_connect_3;\r\n    infof(data, \"schannel: SSL/TLS handshake complete\\n\");\r\n  }\r\n\r\n#ifdef _WIN32_WCE\r\n  /* Windows CE doesn't do any server certificate validation.\r\n     We have to do it manually. */\r\n  if(data->set.ssl.verifypeer)\r\n    return verify_certificate(conn, sockindex);\r\n#endif\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\nschannel_connect_step3(struct connectdata *conn, int sockindex)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  struct curl_schannel_cred *old_cred = NULL;\r\n  int incache;\r\n\r\n  DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);\r\n\r\n  infof(data, \"schannel: SSL/TLS connection with %s port %hu (step 3/3)\\n\",\r\n        conn->host.name, conn->remote_port);\r\n\r\n  /* check if the required context attributes are met */\r\n  if(connssl->ret_flags != connssl->req_flags) {\r\n    if(!(connssl->ret_flags & ISC_RET_SEQUENCE_DETECT))\r\n      failf(data, \"schannel: failed to setup sequence detection\");\r\n    if(!(connssl->ret_flags & ISC_RET_REPLAY_DETECT))\r\n      failf(data, \"schannel: failed to setup replay detection\");\r\n    if(!(connssl->ret_flags & ISC_RET_CONFIDENTIALITY))\r\n      failf(data, \"schannel: failed to setup confidentiality\");\r\n    if(!(connssl->ret_flags & ISC_RET_ALLOCATED_MEMORY))\r\n      failf(data, \"schannel: failed to setup memory allocation\");\r\n    if(!(connssl->ret_flags & ISC_RET_STREAM))\r\n      failf(data, \"schannel: failed to setup stream orientation\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  /* increment the reference counter of the credential/session handle */\r\n  if(connssl->cred && connssl->ctxt) {\r\n    connssl->cred->refcount++;\r\n    infof(data, \"schannel: incremented credential handle refcount = %d\\n\",\r\n          connssl->cred->refcount);\r\n  }\r\n\r\n  /* save the current session data for possible re-use */\r\n  incache = !(Curl_ssl_getsessionid(conn, (void**)&old_cred, NULL));\r\n  if(incache) {\r\n    if(old_cred != connssl->cred) {\r\n      infof(data, \"schannel: old credential handle is stale, removing\\n\");\r\n      Curl_ssl_delsessionid(conn, (void*)old_cred);\r\n      incache = FALSE;\r\n    }\r\n  }\r\n  if(!incache) {\r\n    retcode = Curl_ssl_addsessionid(conn, (void*)connssl->cred,\r\n                                    sizeof(struct curl_schannel_cred));\r\n    if(retcode) {\r\n      failf(data, \"schannel: failed to store credential handle\");\r\n      return retcode;\r\n    }\r\n    else {\r\n      infof(data, \"schannel: stored credential handle in session cache\\n\");\r\n    }\r\n  }\r\n\r\n  connssl->connecting_state = ssl_connect_done;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\nschannel_connect_common(struct connectdata *conn, int sockindex,\r\n                        bool nonblocking, bool *done)\r\n{\r\n  CURLcode retcode;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long timeout_ms;\r\n  int what;\r\n\r\n  /* check if the connection has already been established */\r\n  if(ssl_connection_complete == connssl->state) {\r\n    *done = TRUE;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(ssl_connect_1 == connssl->connecting_state) {\r\n    /* check out how much more time we're allowed */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL/TLS connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    retcode = schannel_connect_step1(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  while(ssl_connect_2 == connssl->connecting_state ||\r\n        ssl_connect_2_reading == connssl->connecting_state ||\r\n        ssl_connect_2_writing == connssl->connecting_state) {\r\n\r\n    /* check out how much more time we're allowed */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL/TLS connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    /* if ssl is expecting something, check if it's available. */\r\n    if(connssl->connecting_state == ssl_connect_2_reading\r\n       || connssl->connecting_state == ssl_connect_2_writing) {\r\n\r\n      curl_socket_t writefd = ssl_connect_2_writing ==\r\n        connssl->connecting_state ? sockfd : CURL_SOCKET_BAD;\r\n      curl_socket_t readfd = ssl_connect_2_reading ==\r\n        connssl->connecting_state ? sockfd : CURL_SOCKET_BAD;\r\n\r\n      what = Curl_socket_ready(readfd, writefd, nonblocking ? 0 : timeout_ms);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(data, \"select/poll on SSL/TLS socket, errno: %d\", SOCKERRNO);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n      else if(0 == what) {\r\n        if(nonblocking) {\r\n          *done = FALSE;\r\n          return CURLE_OK;\r\n        }\r\n        else {\r\n          /* timeout */\r\n          failf(data, \"SSL/TLS connection timeout\");\r\n          return CURLE_OPERATION_TIMEDOUT;\r\n        }\r\n      }\r\n      /* socket is readable or writable */\r\n    }\r\n\r\n    /* Run transaction, and return to the caller if it failed or if\r\n     * this connection is part of a multi handle and this loop would\r\n     * execute again. This permits the owner of a multi handle to\r\n     * abort a connection attempt before step2 has completed while\r\n     * ensuring that a client using select() or epoll() will always\r\n     * have a valid fdset to wait on.\r\n     */\r\n    retcode = schannel_connect_step2(conn, sockindex);\r\n    if(retcode || (nonblocking &&\r\n                   (ssl_connect_2 == connssl->connecting_state ||\r\n                    ssl_connect_2_reading == connssl->connecting_state ||\r\n                    ssl_connect_2_writing == connssl->connecting_state)))\r\n      return retcode;\r\n\r\n  } /* repeat step2 until all transactions are done. */\r\n\r\n  if(ssl_connect_3 == connssl->connecting_state) {\r\n    retcode = schannel_connect_step3(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  if(ssl_connect_done == connssl->connecting_state) {\r\n    connssl->state = ssl_connection_complete;\r\n    conn->recv[sockindex] = schannel_recv;\r\n    conn->send[sockindex] = schannel_send;\r\n    *done = TRUE;\r\n  }\r\n  else\r\n    *done = FALSE;\r\n\r\n  /* reset our connection state machine */\r\n  connssl->connecting_state = ssl_connect_1;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic ssize_t\r\nschannel_send(struct connectdata *conn, int sockindex,\r\n              const void *buf, size_t len, CURLcode *err)\r\n{\r\n  ssize_t written = -1;\r\n  size_t data_len = 0;\r\n  unsigned char *data = NULL;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  SecBuffer outbuf[4];\r\n  SecBufferDesc outbuf_desc;\r\n  SECURITY_STATUS sspi_status = SEC_E_OK;\r\n  CURLcode code;\r\n\r\n  /* check if the maximum stream sizes were queried */\r\n  if(connssl->stream_sizes.cbMaximumMessage == 0) {\r\n    sspi_status = s_pSecFn->QueryContextAttributes(\r\n                              &connssl->ctxt->ctxt_handle,\r\n                              SECPKG_ATTR_STREAM_SIZES,\r\n                              &connssl->stream_sizes);\r\n    if(sspi_status != SEC_E_OK) {\r\n      *err = CURLE_SEND_ERROR;\r\n      return -1;\r\n    }\r\n  }\r\n\r\n  /* check if the buffer is longer than the maximum message length */\r\n  if(len > connssl->stream_sizes.cbMaximumMessage) {\r\n    *err = CURLE_SEND_ERROR;\r\n    return -1;\r\n  }\r\n\r\n  /* calculate the complete message length and allocate a buffer for it */\r\n  data_len = connssl->stream_sizes.cbHeader + len +\r\n              connssl->stream_sizes.cbTrailer;\r\n  data = (unsigned char*) malloc(data_len);\r\n  if(data == NULL) {\r\n    *err = CURLE_OUT_OF_MEMORY;\r\n    return -1;\r\n  }\r\n\r\n  /* setup output buffers (header, data, trailer, empty) */\r\n  InitSecBuffer(&outbuf[0], SECBUFFER_STREAM_HEADER,\r\n                data, connssl->stream_sizes.cbHeader);\r\n  InitSecBuffer(&outbuf[1], SECBUFFER_DATA,\r\n                data + connssl->stream_sizes.cbHeader, curlx_uztoul(len));\r\n  InitSecBuffer(&outbuf[2], SECBUFFER_STREAM_TRAILER,\r\n                data + connssl->stream_sizes.cbHeader + len,\r\n                connssl->stream_sizes.cbTrailer);\r\n  InitSecBuffer(&outbuf[3], SECBUFFER_EMPTY, NULL, 0);\r\n  InitSecBufferDesc(&outbuf_desc, outbuf, 4);\r\n\r\n  /* copy data into output buffer */\r\n  memcpy(outbuf[1].pvBuffer, buf, len);\r\n\r\n  /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375390.aspx */\r\n  sspi_status = s_pSecFn->EncryptMessage(&connssl->ctxt->ctxt_handle, 0,\r\n                                         &outbuf_desc, 0);\r\n\r\n  /* check if the message was encrypted */\r\n  if(sspi_status == SEC_E_OK) {\r\n    written = 0;\r\n\r\n    /* send the encrypted message including header, data and trailer */\r\n    len = outbuf[0].cbBuffer + outbuf[1].cbBuffer + outbuf[2].cbBuffer;\r\n\r\n    /*\r\n       It's important to send the full message which includes the header,\r\n       encrypted payload, and trailer.  Until the client receives all the\r\n       data a coherent message has not been delivered and the client\r\n       can't read any of it.\r\n\r\n       If we wanted to buffer the unwritten encrypted bytes, we would\r\n       tell the client that all data it has requested to be sent has been\r\n       sent. The unwritten encrypted bytes would be the first bytes to\r\n       send on the next invocation.\r\n       Here's the catch with this - if we tell the client that all the\r\n       bytes have been sent, will the client call this method again to\r\n       send the buffered data?  Looking at who calls this function, it\r\n       seems the answer is NO.\r\n    */\r\n\r\n    /* send entire message or fail */\r\n    while(len > (size_t)written) {\r\n      ssize_t this_write;\r\n      long timeleft;\r\n      int what;\r\n\r\n      this_write = 0;\r\n\r\n      timeleft = Curl_timeleft(conn->data, NULL, TRUE);\r\n      if(timeleft < 0) {\r\n        /* we already got the timeout */\r\n        failf(conn->data, \"schannel: timed out sending data \"\r\n              \"(bytes sent: %zd)\", written);\r\n        *err = CURLE_OPERATION_TIMEDOUT;\r\n        written = -1;\r\n        break;\r\n      }\r\n\r\n      what = Curl_socket_ready(CURL_SOCKET_BAD, conn->sock[sockindex],\r\n                               timeleft);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(conn->data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        *err = CURLE_SEND_ERROR;\r\n        written = -1;\r\n        break;\r\n      }\r\n      else if(0 == what) {\r\n        failf(conn->data, \"schannel: timed out sending data \"\r\n              \"(bytes sent: %zd)\", written);\r\n        *err = CURLE_OPERATION_TIMEDOUT;\r\n        written = -1;\r\n        break;\r\n      }\r\n      /* socket is writable */\r\n\r\n      code = Curl_write_plain(conn, conn->sock[sockindex], data + written,\r\n                              len - written, &this_write);\r\n      if(code == CURLE_AGAIN)\r\n        continue;\r\n      else if(code != CURLE_OK) {\r\n        *err = code;\r\n        written = -1;\r\n        break;\r\n      }\r\n\r\n      written += this_write;\r\n    }\r\n  }\r\n  else if(sspi_status == SEC_E_INSUFFICIENT_MEMORY) {\r\n    *err = CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else{\r\n    *err = CURLE_SEND_ERROR;\r\n  }\r\n\r\n  Curl_safefree(data);\r\n\r\n  if(len == (size_t)written)\r\n    /* Encrypted message including header, data and trailer entirely sent.\r\n       The return value is the number of unencrypted bytes that were sent. */\r\n    written = outbuf[1].cbBuffer;\r\n\r\n  return written;\r\n}\r\n\r\nstatic ssize_t\r\nschannel_recv(struct connectdata *conn, int sockindex,\r\n              char *buf, size_t len, CURLcode *err)\r\n{\r\n  size_t size = 0;\r\n  ssize_t nread = 0, ret = -1;\r\n  CURLcode retcode;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  bool done = FALSE;\r\n  SecBuffer inbuf[4];\r\n  SecBufferDesc inbuf_desc;\r\n  SECURITY_STATUS sspi_status = SEC_E_OK;\r\n\r\n  infof(data, \"schannel: client wants to read %zu bytes\\n\", len);\r\n  *err = CURLE_OK;\r\n\r\n  /* buffer to store previously received and decrypted data */\r\n  if(connssl->decdata_buffer == NULL) {\r\n    connssl->decdata_offset = 0;\r\n    connssl->decdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;\r\n    connssl->decdata_buffer = malloc(connssl->decdata_length);\r\n    if(connssl->decdata_buffer == NULL) {\r\n      failf(data, \"schannel: unable to allocate memory\");\r\n      *err = CURLE_OUT_OF_MEMORY;\r\n      return -1;\r\n    }\r\n  }\r\n\r\n  /* increase buffer in order to fit the requested amount of data */\r\n  while(connssl->encdata_length - connssl->encdata_offset <\r\n        CURL_SCHANNEL_BUFFER_FREE_SIZE || connssl->encdata_length < len) {\r\n    /* increase internal encrypted data buffer */\r\n    connssl->encdata_length *= CURL_SCHANNEL_BUFFER_STEP_FACTOR;\r\n    connssl->encdata_buffer = realloc(connssl->encdata_buffer,\r\n                                      connssl->encdata_length);\r\n\r\n    if(connssl->encdata_buffer == NULL) {\r\n      failf(data, \"schannel: unable to re-allocate memory\");\r\n      *err = CURLE_OUT_OF_MEMORY;\r\n      return -1;\r\n    }\r\n  }\r\n\r\n  /* read encrypted data from socket */\r\n  infof(data, \"schannel: encrypted data buffer: offset %zu length %zu\\n\",\r\n        connssl->encdata_offset, connssl->encdata_length);\r\n  size = connssl->encdata_length - connssl->encdata_offset;\r\n  if(size > 0) {\r\n    *err = Curl_read_plain(conn->sock[sockindex],\r\n                  (char *) (connssl->encdata_buffer + connssl->encdata_offset),\r\n                           size, &nread);\r\n    /* check for received data */\r\n    if(*err != CURLE_OK)\r\n      ret = -1;\r\n    else {\r\n      if(nread > 0)\r\n        /* increase encrypted data buffer offset */\r\n        connssl->encdata_offset += nread;\r\n      ret = nread;\r\n    }\r\n    infof(data, \"schannel: encrypted data got %zd\\n\", ret);\r\n  }\r\n\r\n  infof(data, \"schannel: encrypted data buffer: offset %zu length %zu\\n\",\r\n        connssl->encdata_offset, connssl->encdata_length);\r\n\r\n  /* check if we still have some data in our buffers */\r\n  while(connssl->encdata_offset > 0 && sspi_status == SEC_E_OK &&\r\n        connssl->decdata_offset < len) {\r\n    /* prepare data buffer for DecryptMessage call */\r\n    InitSecBuffer(&inbuf[0], SECBUFFER_DATA, connssl->encdata_buffer,\r\n                  curlx_uztoul(connssl->encdata_offset));\r\n\r\n    /* we need 3 more empty input buffers for possible output */\r\n    InitSecBuffer(&inbuf[1], SECBUFFER_EMPTY, NULL, 0);\r\n    InitSecBuffer(&inbuf[2], SECBUFFER_EMPTY, NULL, 0);\r\n    InitSecBuffer(&inbuf[3], SECBUFFER_EMPTY, NULL, 0);\r\n\r\n    InitSecBufferDesc(&inbuf_desc, inbuf, 4);\r\n\r\n    /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375348.aspx */\r\n    sspi_status = s_pSecFn->DecryptMessage(&connssl->ctxt->ctxt_handle,\r\n                                           &inbuf_desc, 0, NULL);\r\n\r\n    /* check if we need more data */\r\n    if(sspi_status == SEC_E_INCOMPLETE_MESSAGE) {\r\n      infof(data, \"schannel: failed to decrypt data, need more data\\n\");\r\n      *err = CURLE_AGAIN;\r\n      return -1;\r\n    }\r\n\r\n    /* check if everything went fine (server may want to renegotiate\r\n       context) */\r\n    if(sspi_status == SEC_E_OK || sspi_status == SEC_I_RENEGOTIATE ||\r\n                                  sspi_status == SEC_I_CONTEXT_EXPIRED) {\r\n      /* check for successfully decrypted data */\r\n      if(inbuf[1].BufferType == SECBUFFER_DATA) {\r\n        infof(data, \"schannel: decrypted data length: %lu\\n\",\r\n              inbuf[1].cbBuffer);\r\n\r\n        /* increase buffer in order to fit the received amount of data */\r\n        size = inbuf[1].cbBuffer > CURL_SCHANNEL_BUFFER_FREE_SIZE ?\r\n               inbuf[1].cbBuffer : CURL_SCHANNEL_BUFFER_FREE_SIZE;\r\n        while(connssl->decdata_length - connssl->decdata_offset < size ||\r\n              connssl->decdata_length < len) {\r\n          /* increase internal decrypted data buffer */\r\n          connssl->decdata_length *= CURL_SCHANNEL_BUFFER_STEP_FACTOR;\r\n          connssl->decdata_buffer = realloc(connssl->decdata_buffer,\r\n                                            connssl->decdata_length);\r\n\r\n          if(connssl->decdata_buffer == NULL) {\r\n            failf(data, \"schannel: unable to re-allocate memory\");\r\n            *err = CURLE_OUT_OF_MEMORY;\r\n            return -1;\r\n          }\r\n        }\r\n\r\n        /* copy decrypted data to internal buffer */\r\n        size = inbuf[1].cbBuffer;\r\n        if(size > 0) {\r\n          memcpy(connssl->decdata_buffer + connssl->decdata_offset,\r\n                 inbuf[1].pvBuffer, size);\r\n          connssl->decdata_offset += size;\r\n        }\r\n\r\n        infof(data, \"schannel: decrypted data added: %zu\\n\", size);\r\n        infof(data, \"schannel: decrypted data cached: offset %zu length %zu\\n\",\r\n              connssl->decdata_offset, connssl->decdata_length);\r\n      }\r\n\r\n      /* check for remaining encrypted data */\r\n      if(inbuf[3].BufferType == SECBUFFER_EXTRA && inbuf[3].cbBuffer > 0) {\r\n        infof(data, \"schannel: encrypted data length: %lu\\n\",\r\n              inbuf[3].cbBuffer);\r\n\r\n        /* check if the remaining data is less than the total amount\r\n         * and therefore begins after the already processed data\r\n        */\r\n        if(connssl->encdata_offset > inbuf[3].cbBuffer) {\r\n          /* move remaining encrypted data forward to the beginning of\r\n             buffer */\r\n          memmove(connssl->encdata_buffer,\r\n                  (connssl->encdata_buffer + connssl->encdata_offset) -\r\n                    inbuf[3].cbBuffer, inbuf[3].cbBuffer);\r\n          connssl->encdata_offset = inbuf[3].cbBuffer;\r\n        }\r\n\r\n        infof(data, \"schannel: encrypted data cached: offset %zu length %zu\\n\",\r\n              connssl->encdata_offset, connssl->encdata_length);\r\n      }\r\n      else{\r\n        /* reset encrypted buffer offset, because there is no data remaining */\r\n        connssl->encdata_offset = 0;\r\n      }\r\n    }\r\n\r\n    /* check if server wants to renegotiate the connection context */\r\n    if(sspi_status == SEC_I_RENEGOTIATE) {\r\n      infof(data, \"schannel: remote party requests SSL/TLS renegotiation\\n\");\r\n\r\n      /* begin renegotiation */\r\n      infof(data, \"schannel: renegotiating SSL/TLS connection\\n\");\r\n      connssl->state = ssl_connection_negotiating;\r\n      connssl->connecting_state = ssl_connect_2_writing;\r\n      retcode = schannel_connect_common(conn, sockindex, FALSE, &done);\r\n      if(retcode)\r\n        *err = retcode;\r\n      else {\r\n        infof(data, \"schannel: SSL/TLS connection renegotiated\\n\");\r\n        /* now retry receiving data */\r\n        return schannel_recv(conn, sockindex, buf, len, err);\r\n      }\r\n    }\r\n  }\r\n\r\n  infof(data, \"schannel: decrypted data buffer: offset %zu length %zu\\n\",\r\n        connssl->decdata_offset, connssl->decdata_length);\r\n\r\n  /* copy requested decrypted data to supplied buffer */\r\n  size = len < connssl->decdata_offset ? len : connssl->decdata_offset;\r\n  if(size > 0) {\r\n    memcpy(buf, connssl->decdata_buffer, size);\r\n    ret = size;\r\n\r\n    /* move remaining decrypted data forward to the beginning of buffer */\r\n    memmove(connssl->decdata_buffer, connssl->decdata_buffer + size,\r\n            connssl->decdata_offset - size);\r\n    connssl->decdata_offset -= size;\r\n\r\n    infof(data, \"schannel: decrypted data returned %zd\\n\", size);\r\n    infof(data, \"schannel: decrypted data buffer: offset %zu length %zu\\n\",\r\n          connssl->decdata_offset, connssl->decdata_length);\r\n  }\r\n\r\n  /* check if the server closed the connection */\r\n  if(ret <= 0 && ( /* special check for Windows 2000 Professional */\r\n      sspi_status == SEC_I_CONTEXT_EXPIRED || (sspi_status == SEC_E_OK &&\r\n        connssl->encdata_offset > 0 && connssl->encdata_buffer[0] == 0x15))) {\r\n    infof(data, \"schannel: server closed the connection\\n\");\r\n    *err = CURLE_OK;\r\n    return 0;\r\n  }\r\n\r\n  /* check if something went wrong and we need to return an error */\r\n  if(ret < 0 && sspi_status != SEC_E_OK) {\r\n    infof(data, \"schannel: failed to read data from server: %s\\n\",\r\n          Curl_sspi_strerror(conn, sspi_status));\r\n    *err = CURLE_RECV_ERROR;\r\n    return -1;\r\n  }\r\n\r\n  return ret;\r\n}\r\n\r\nCURLcode\r\nCurl_schannel_connect_nonblocking(struct connectdata *conn, int sockindex,\r\n                                  bool *done)\r\n{\r\n  return schannel_connect_common(conn, sockindex, TRUE, done);\r\n}\r\n\r\nCURLcode\r\nCurl_schannel_connect(struct connectdata *conn, int sockindex)\r\n{\r\n  CURLcode retcode;\r\n  bool done = FALSE;\r\n\r\n  retcode = schannel_connect_common(conn, sockindex, FALSE, &done);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  DEBUGASSERT(done);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nbool Curl_schannel_data_pending(const struct connectdata *conn, int sockindex)\r\n{\r\n  const struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  if(connssl->use) /* SSL/TLS is in use */\r\n    return (connssl->encdata_offset > 0 ||\r\n            connssl->decdata_offset > 0 ) ? TRUE : FALSE;\r\n  else\r\n    return FALSE;\r\n}\r\n\r\nvoid Curl_schannel_close(struct connectdata *conn, int sockindex)\r\n{\r\n  if(conn->ssl[sockindex].use)\r\n    /* if the SSL/TLS channel hasn't been shut down yet, do that now. */\r\n    Curl_ssl_shutdown(conn, sockindex);\r\n}\r\n\r\nint Curl_schannel_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  /* See http://msdn.microsoft.com/en-us/library/windows/desktop/aa380138.aspx\r\n   * Shutting Down an Schannel Connection\r\n   */\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  infof(data, \"schannel: shutting down SSL/TLS connection with %s port %hu\\n\",\r\n        conn->host.name, conn->remote_port);\r\n\r\n  if(connssl->cred && connssl->ctxt) {\r\n    SecBufferDesc BuffDesc;\r\n    SecBuffer Buffer;\r\n    SECURITY_STATUS sspi_status;\r\n    SecBuffer outbuf;\r\n    SecBufferDesc outbuf_desc;\r\n    CURLcode code;\r\n    TCHAR *host_name;\r\n    DWORD dwshut = SCHANNEL_SHUTDOWN;\r\n\r\n    InitSecBuffer(&Buffer, SECBUFFER_TOKEN, &dwshut, sizeof(dwshut));\r\n    InitSecBufferDesc(&BuffDesc, &Buffer, 1);\r\n\r\n    sspi_status = s_pSecFn->ApplyControlToken(&connssl->ctxt->ctxt_handle,\r\n                                              &BuffDesc);\r\n\r\n    if(sspi_status != SEC_E_OK)\r\n      failf(data, \"schannel: ApplyControlToken failure: %s\",\r\n            Curl_sspi_strerror(conn, sspi_status));\r\n\r\n    host_name = Curl_convert_UTF8_to_tchar(conn->host.name);\r\n    if(!host_name)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    /* setup output buffer */\r\n    InitSecBuffer(&outbuf, SECBUFFER_EMPTY, NULL, 0);\r\n    InitSecBufferDesc(&outbuf_desc, &outbuf, 1);\r\n\r\n    sspi_status = s_pSecFn->InitializeSecurityContext(\r\n         &connssl->cred->cred_handle,\r\n         &connssl->ctxt->ctxt_handle,\r\n         host_name,\r\n         connssl->req_flags,\r\n         0,\r\n         0,\r\n         NULL,\r\n         0,\r\n         &connssl->ctxt->ctxt_handle,\r\n         &outbuf_desc,\r\n         &connssl->ret_flags,\r\n         &connssl->ctxt->time_stamp);\r\n\r\n    Curl_unicodefree(host_name);\r\n\r\n    if((sspi_status == SEC_E_OK) || (sspi_status == SEC_I_CONTEXT_EXPIRED)) {\r\n      /* send close message which is in output buffer */\r\n      ssize_t written;\r\n      code = Curl_write_plain(conn, conn->sock[sockindex], outbuf.pvBuffer,\r\n                              outbuf.cbBuffer, &written);\r\n\r\n      s_pSecFn->FreeContextBuffer(outbuf.pvBuffer);\r\n      if((code != CURLE_OK) || (outbuf.cbBuffer != (size_t)written)) {\r\n        infof(data, \"schannel: failed to send close msg: %s\"\r\n              \" (bytes written: %zd)\\n\", curl_easy_strerror(code), written);\r\n      }\r\n    }\r\n\r\n    /* free SSPI Schannel API security context handle */\r\n    if(connssl->ctxt) {\r\n      s_pSecFn->DeleteSecurityContext(&connssl->ctxt->ctxt_handle);\r\n      Curl_safefree(connssl->ctxt);\r\n    }\r\n\r\n    /* decrement the reference counter of the credential/session handle */\r\n    if(connssl->cred && connssl->cred->refcount > 0) {\r\n      connssl->cred->refcount--;\r\n      infof(data, \"schannel: decremented credential handle refcount = %d\\n\",\r\n            connssl->cred->refcount);\r\n    }\r\n  }\r\n\r\n  /* free internal buffer for received encrypted data */\r\n  if(connssl->encdata_buffer != NULL) {\r\n    Curl_safefree(connssl->encdata_buffer);\r\n    connssl->encdata_length = 0;\r\n    connssl->encdata_offset = 0;\r\n  }\r\n\r\n  /* free internal buffer for received decrypted data */\r\n  if(connssl->decdata_buffer != NULL) {\r\n    Curl_safefree(connssl->decdata_buffer);\r\n    connssl->decdata_length = 0;\r\n    connssl->decdata_offset = 0;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid Curl_schannel_session_free(void *ptr)\r\n{\r\n  struct curl_schannel_cred *cred = ptr;\r\n\r\n  if(cred && cred->refcount == 0) {\r\n    s_pSecFn->FreeCredentialsHandle(&cred->cred_handle);\r\n    Curl_safefree(cred);\r\n  }\r\n}\r\n\r\nint Curl_schannel_init(void)\r\n{\r\n  return (Curl_sspi_global_init() == CURLE_OK ? 1 : 0);\r\n}\r\n\r\nvoid Curl_schannel_cleanup(void)\r\n{\r\n  Curl_sspi_global_cleanup();\r\n}\r\n\r\nsize_t Curl_schannel_version(char *buffer, size_t size)\r\n{\r\n  size = snprintf(buffer, size, \"WinSSL\");\r\n\r\n  return size;\r\n}\r\n\r\n#ifdef _WIN32_WCE\r\nstatic CURLcode verify_certificate(struct connectdata *conn, int sockindex)\r\n{\r\n  SECURITY_STATUS status;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  CURLcode result = CURLE_OK;\r\n  CERT_CONTEXT *pCertContextServer = NULL;\r\n  const CERT_CHAIN_CONTEXT *pChainContext = NULL;\r\n\r\n  status = s_pSecFn->QueryContextAttributes(&connssl->ctxt->ctxt_handle,\r\n                                            SECPKG_ATTR_REMOTE_CERT_CONTEXT,\r\n                                            &pCertContextServer);\r\n\r\n  if((status != SEC_E_OK) || (pCertContextServer == NULL)) {\r\n    failf(data, \"schannel: Failed to read remote certificate context: %s\",\r\n          Curl_sspi_strerror(conn, status));\r\n    result = CURLE_PEER_FAILED_VERIFICATION;\r\n  }\r\n\r\n  if(result == CURLE_OK) {\r\n    CERT_CHAIN_PARA ChainPara;\r\n    memset(&ChainPara, 0, sizeof(ChainPara));\r\n    ChainPara.cbSize = sizeof(ChainPara);\r\n\r\n    if(!CertGetCertificateChain(NULL,\r\n                                pCertContextServer,\r\n                                NULL,\r\n                                pCertContextServer->hCertStore,\r\n                                &ChainPara,\r\n                                0,\r\n                                NULL,\r\n                                &pChainContext)) {\r\n      failf(data, \"schannel: CertGetCertificateChain failed: %s\",\r\n            Curl_sspi_strerror(conn, GetLastError()));\r\n      pChainContext = NULL;\r\n      result = CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n\r\n    if(result == CURLE_OK) {\r\n      CERT_SIMPLE_CHAIN *pSimpleChain = pChainContext->rgpChain[0];\r\n      DWORD dwTrustErrorMask = ~(DWORD)(CERT_TRUST_IS_NOT_TIME_NESTED|\r\n                                 CERT_TRUST_REVOCATION_STATUS_UNKNOWN);\r\n      dwTrustErrorMask &= pSimpleChain->TrustStatus.dwErrorStatus;\r\n      if(dwTrustErrorMask) {\r\n        if(dwTrustErrorMask & CERT_TRUST_IS_PARTIAL_CHAIN)\r\n          failf(data, \"schannel: CertGetCertificateChain trust error\"\r\n                      \" CERT_TRUST_IS_PARTIAL_CHAIN\");\r\n        if(dwTrustErrorMask & CERT_TRUST_IS_UNTRUSTED_ROOT)\r\n          failf(data, \"schannel: CertGetCertificateChain trust error\"\r\n                      \" CERT_TRUST_IS_UNTRUSTED_ROOT\");\r\n        if(dwTrustErrorMask & CERT_TRUST_IS_NOT_TIME_VALID)\r\n          failf(data, \"schannel: CertGetCertificateChain trust error\"\r\n                      \" CERT_TRUST_IS_NOT_TIME_VALID\");\r\n        failf(data, \"schannel: CertGetCertificateChain error mask: 0x%08x\",\r\n              dwTrustErrorMask);\r\n        result = CURLE_PEER_FAILED_VERIFICATION;\r\n      }\r\n    }\r\n  }\r\n\r\n  if(result == CURLE_OK) {\r\n    if(data->set.ssl.verifyhost) {\r\n      TCHAR cert_hostname_buff[128];\r\n      xcharp_u hostname;\r\n      xcharp_u cert_hostname;\r\n      DWORD len;\r\n\r\n      cert_hostname.const_tchar_ptr = cert_hostname_buff;\r\n      hostname.tchar_ptr = Curl_convert_UTF8_to_tchar(conn->host.name);\r\n\r\n      len = CertGetNameString(pCertContextServer,\r\n                              CERT_NAME_DNS_TYPE,\r\n                              0,\r\n                              NULL,\r\n                              cert_hostname.tchar_ptr,\r\n                              128);\r\n      if(len > 0 && *cert_hostname.tchar_ptr == '*') {\r\n        /* this is a wildcard cert.  try matching the last len - 1 chars */\r\n        int hostname_len = strlen(conn->host.name);\r\n        cert_hostname.tchar_ptr++;\r\n        if(_tcsicmp(cert_hostname.const_tchar_ptr,\r\n                    hostname.const_tchar_ptr + hostname_len - len + 2) != 0)\r\n          result = CURLE_PEER_FAILED_VERIFICATION;\r\n      }\r\n      else if(len == 0 || _tcsicmp(hostname.const_tchar_ptr,\r\n                                   cert_hostname.const_tchar_ptr) != 0) {\r\n        result = CURLE_PEER_FAILED_VERIFICATION;\r\n      }\r\n      if(result == CURLE_PEER_FAILED_VERIFICATION) {\r\n        char *_cert_hostname;\r\n        _cert_hostname = Curl_convert_tchar_to_UTF8(cert_hostname.tchar_ptr);\r\n        failf(data, \"schannel: CertGetNameString() certificate hostname \"\r\n              \"(%s) did not match connection (%s)\",\r\n              _cert_hostname, conn->host.name);\r\n        Curl_unicodefree(_cert_hostname);\r\n      }\r\n      Curl_unicodefree(hostname.tchar_ptr);\r\n    }\r\n  }\r\n\r\n  if(pChainContext)\r\n    CertFreeCertificateChain(pChainContext);\r\n\r\n  if(pCertContextServer)\r\n    CertFreeCertificateContext(pCertContextServer);\r\n\r\n  return result;\r\n}\r\n#endif /* _WIN32_WCE */\r\n\r\n#endif /* USE_SCHANNEL */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_schannel.h",
    "content": "#ifndef HEADER_CURL_SCHANNEL_H\r\n#define HEADER_CURL_SCHANNEL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2012, Marc Hoersken, <info@marc-hoersken.de>, et al.\r\n * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_SCHANNEL\r\n\r\n#include \"urldata.h\"\r\n\r\n#ifndef UNISP_NAME_A\r\n#define UNISP_NAME_A \"Microsoft Unified Security Protocol Provider\"\r\n#endif\r\n\r\n#ifndef UNISP_NAME_W\r\n#define UNISP_NAME_W L\"Microsoft Unified Security Protocol Provider\"\r\n#endif\r\n\r\n#ifndef UNISP_NAME\r\n#ifdef UNICODE\r\n#define UNISP_NAME  UNISP_NAME_W\r\n#else\r\n#define UNISP_NAME  UNISP_NAME_A\r\n#endif\r\n#endif\r\n\r\n#ifndef SP_PROT_SSL2_CLIENT\r\n#define SP_PROT_SSL2_CLIENT             0x00000008\r\n#endif\r\n\r\n#ifndef SP_PROT_SSL3_CLIENT\r\n#define SP_PROT_SSL3_CLIENT             0x00000008\r\n#endif\r\n\r\n#ifndef SP_PROT_TLS1_CLIENT\r\n#define SP_PROT_TLS1_CLIENT             0x00000080\r\n#endif\r\n\r\n#ifndef SP_PROT_TLS1_0_CLIENT\r\n#define SP_PROT_TLS1_0_CLIENT           SP_PROT_TLS1_CLIENT\r\n#endif\r\n\r\n#ifndef SP_PROT_TLS1_1_CLIENT\r\n#define SP_PROT_TLS1_1_CLIENT           0x00000200\r\n#endif\r\n\r\n#ifndef SP_PROT_TLS1_2_CLIENT\r\n#define SP_PROT_TLS1_2_CLIENT           0x00000800\r\n#endif\r\n\r\n#ifndef SECBUFFER_ALERT\r\n#define SECBUFFER_ALERT                 17\r\n#endif\r\n\r\n#ifndef ISC_RET_REPLAY_DETECT\r\n#define ISC_RET_REPLAY_DETECT           0x00000004\r\n#endif\r\n\r\n#ifndef ISC_RET_SEQUENCE_DETECT\r\n#define ISC_RET_SEQUENCE_DETECT         0x00000008\r\n#endif\r\n\r\n#ifndef ISC_RET_CONFIDENTIALITY\r\n#define ISC_RET_CONFIDENTIALITY         0x00000010\r\n#endif\r\n\r\n#ifndef ISC_RET_ALLOCATED_MEMORY\r\n#define ISC_RET_ALLOCATED_MEMORY        0x00000100\r\n#endif\r\n\r\n#ifndef ISC_RET_STREAM\r\n#define ISC_RET_STREAM                  0x00008000\r\n#endif\r\n\r\n\r\n#define CURL_SCHANNEL_BUFFER_INIT_SIZE   4096\r\n#define CURL_SCHANNEL_BUFFER_FREE_SIZE   1024\r\n#define CURL_SCHANNEL_BUFFER_STEP_FACTOR 2\r\n\r\n\r\nCURLcode Curl_schannel_connect(struct connectdata *conn, int sockindex);\r\n\r\nCURLcode Curl_schannel_connect_nonblocking(struct connectdata *conn,\r\n                                           int sockindex,\r\n                                           bool *done);\r\n\r\nbool Curl_schannel_data_pending(const struct connectdata *conn, int sockindex);\r\nvoid Curl_schannel_close(struct connectdata *conn, int sockindex);\r\nint Curl_schannel_shutdown(struct connectdata *conn, int sockindex);\r\nvoid Curl_schannel_session_free(void *ptr);\r\n\r\nint Curl_schannel_init(void);\r\nvoid Curl_schannel_cleanup(void);\r\nsize_t Curl_schannel_version(char *buffer, size_t size);\r\n\r\n/* API setup for Schannel */\r\n#define curlssl_init Curl_schannel_init\r\n#define curlssl_cleanup Curl_schannel_cleanup\r\n#define curlssl_connect Curl_schannel_connect\r\n#define curlssl_connect_nonblocking Curl_schannel_connect_nonblocking\r\n#define curlssl_session_free Curl_schannel_session_free\r\n#define curlssl_close_all(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_close Curl_schannel_close\r\n#define curlssl_shutdown Curl_schannel_shutdown\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_schannel_version\r\n#define curlssl_check_cxn(x) (x=x, -1)\r\n#define curlssl_data_pending Curl_schannel_data_pending\r\n#endif /* USE_SCHANNEL */\r\n#endif /* HEADER_CURL_SCHANNEL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_setup.h",
    "content": "#ifndef HEADER_CURL_SETUP_H\r\n#define HEADER_CURL_SETUP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Define WIN32 when build target is Win32 API\r\n */\r\n\r\n#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && \\\r\n    !defined(__SYMBIAN32__)\r\n#define WIN32\r\n#endif\r\n\r\n/*\r\n * Include configuration script results or hand-crafted\r\n * configuration file for platforms which lack config tool.\r\n */\r\n\r\n#ifdef HAVE_CONFIG_H\r\n\r\n#include \"curl_config.h\"\r\n\r\n#else /* HAVE_CONFIG_H */\r\n\r\n#ifdef _WIN32_WCE\r\n#  include \"config-win32ce.h\"\r\n#else\r\n#  ifdef WIN32\r\n#    include \"config-win32.h\"\r\n#  endif\r\n#endif\r\n\r\n#if defined(macintosh) && defined(__MRC__)\r\n#  include \"config-mac.h\"\r\n#endif\r\n\r\n#ifdef __riscos__\r\n#  include \"config-riscos.h\"\r\n#endif\r\n\r\n#ifdef __AMIGA__\r\n#  include \"config-amigaos.h\"\r\n#endif\r\n\r\n#ifdef __SYMBIAN32__\r\n#  include \"config-symbian.h\"\r\n#endif\r\n\r\n#ifdef __OS400__\r\n#  include \"config-os400.h\"\r\n#endif\r\n\r\n#ifdef TPF\r\n#  include \"config-tpf.h\"\r\n#endif\r\n\r\n#ifdef __VXWORKS__\r\n#  include \"config-vxworks.h\"\r\n#endif\r\n\r\n#endif /* HAVE_CONFIG_H */\r\n\r\n/* ================================================================ */\r\n/* Definition of preprocessor macros/symbols which modify compiler  */\r\n/* behavior or generated code characteristics must be done here,   */\r\n/* as appropriate, before any system header file is included. It is */\r\n/* also possible to have them defined in the config file included   */\r\n/* before this point. As a result of all this we frown inclusion of */\r\n/* system header files in our config files, avoid this at any cost. */\r\n/* ================================================================ */\r\n\r\n/*\r\n * AIX 4.3 and newer needs _THREAD_SAFE defined to build\r\n * proper reentrant code. Others may also need it.\r\n */\r\n\r\n#ifdef NEED_THREAD_SAFE\r\n#  ifndef _THREAD_SAFE\r\n#    define _THREAD_SAFE\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Tru64 needs _REENTRANT set for a few function prototypes and\r\n * things to appear in the system header files. Unixware needs it\r\n * to build proper reentrant code. Others may also need it.\r\n */\r\n\r\n#ifdef NEED_REENTRANT\r\n#  ifndef _REENTRANT\r\n#    define _REENTRANT\r\n#  endif\r\n#endif\r\n\r\n/* ================================================================ */\r\n/*  If you need to include a system header file for your platform,  */\r\n/*  please, do it beyond the point further indicated in this file.  */\r\n/* ================================================================ */\r\n\r\n/*\r\n * libcurl's external interface definitions are also used internally,\r\n * and might also include required system header files to define them.\r\n */\r\n\r\n#include <curl/curlbuild.h>\r\n\r\n/*\r\n * Compile time sanity checks must also be done when building the library.\r\n */\r\n\r\n#include <curl/curlrules.h>\r\n\r\n/*\r\n * Ensure that no one is using the old SIZEOF_CURL_OFF_T macro\r\n */\r\n\r\n#ifdef SIZEOF_CURL_OFF_T\r\n#  error \"SIZEOF_CURL_OFF_T shall not be defined!\"\r\n   Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined\r\n#endif\r\n\r\n/*\r\n * Set up internal curl_off_t formatting string directives for\r\n * exclusive use with libcurl's internal *printf functions.\r\n */\r\n\r\n#ifdef FORMAT_OFF_T\r\n#  error \"FORMAT_OFF_T shall not be defined before this point!\"\r\n   Error Compilation_aborted_FORMAT_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef FORMAT_OFF_TU\r\n#  error \"FORMAT_OFF_TU shall not be defined before this point!\"\r\n   Error Compilation_aborted_FORMAT_OFF_TU_already_defined\r\n#endif\r\n\r\n#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)\r\n#  define FORMAT_OFF_T  \"lld\"\r\n#  define FORMAT_OFF_TU \"llu\"\r\n#else\r\n#  define FORMAT_OFF_T  \"ld\"\r\n#  define FORMAT_OFF_TU \"lu\"\r\n#endif\r\n\r\n/*\r\n * Disable other protocols when http is the only one desired.\r\n */\r\n\r\n#ifdef HTTP_ONLY\r\n#  ifndef CURL_DISABLE_TFTP\r\n#    define CURL_DISABLE_TFTP\r\n#  endif\r\n#  ifndef CURL_DISABLE_FTP\r\n#    define CURL_DISABLE_FTP\r\n#  endif\r\n#  ifndef CURL_DISABLE_LDAP\r\n#    define CURL_DISABLE_LDAP\r\n#  endif\r\n#  ifndef CURL_DISABLE_TELNET\r\n#    define CURL_DISABLE_TELNET\r\n#  endif\r\n#  ifndef CURL_DISABLE_DICT\r\n#    define CURL_DISABLE_DICT\r\n#  endif\r\n#  ifndef CURL_DISABLE_FILE\r\n#    define CURL_DISABLE_FILE\r\n#  endif\r\n#  ifndef CURL_DISABLE_RTSP\r\n#    define CURL_DISABLE_RTSP\r\n#  endif\r\n#  ifndef CURL_DISABLE_POP3\r\n#    define CURL_DISABLE_POP3\r\n#  endif\r\n#  ifndef CURL_DISABLE_IMAP\r\n#    define CURL_DISABLE_IMAP\r\n#  endif\r\n#  ifndef CURL_DISABLE_SMTP\r\n#    define CURL_DISABLE_SMTP\r\n#  endif\r\n#  ifndef CURL_DISABLE_RTSP\r\n#    define CURL_DISABLE_RTSP\r\n#  endif\r\n#  ifndef CURL_DISABLE_RTMP\r\n#    define CURL_DISABLE_RTMP\r\n#  endif\r\n#  ifndef CURL_DISABLE_GOPHER\r\n#    define CURL_DISABLE_GOPHER\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * When http is disabled rtsp is not supported.\r\n */\r\n\r\n#if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)\r\n#  define CURL_DISABLE_RTSP\r\n#endif\r\n\r\n/* ================================================================ */\r\n/* No system header file shall be included in this file before this */\r\n/* point. The only allowed ones are those included from curlbuild.h */\r\n/* ================================================================ */\r\n\r\n/*\r\n * OS/400 setup file includes some system headers.\r\n */\r\n\r\n#ifdef __OS400__\r\n#  include \"setup-os400.h\"\r\n#endif\r\n\r\n/*\r\n * VMS setup file includes some system headers.\r\n */\r\n\r\n#ifdef __VMS\r\n#  include \"setup-vms.h\"\r\n#endif\r\n\r\n/*\r\n * Include header files for windows builds before redefining anything.\r\n * Use this preprocessor block only to include or exclude windows.h,\r\n * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs\r\n * to any other further and independent block.  Under Cygwin things work\r\n * just as under linux (e.g. <sys/socket.h>) and the winsock headers should\r\n * never be included when __CYGWIN__ is defined.  configure script takes\r\n * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,\r\n * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.\r\n */\r\n\r\n#ifdef HAVE_WINDOWS_H\r\n#  if defined(UNICODE) && !defined(_UNICODE)\r\n#    define _UNICODE\r\n#  endif\r\n#  if defined(_UNICODE) && !defined(UNICODE)\r\n#    define UNICODE\r\n#  endif\r\n#  ifndef WIN32_LEAN_AND_MEAN\r\n#    define WIN32_LEAN_AND_MEAN\r\n#  endif\r\n#  include <windows.h>\r\n#  ifdef HAVE_WINSOCK2_H\r\n#    include <winsock2.h>\r\n#    ifdef HAVE_WS2TCPIP_H\r\n#       include <ws2tcpip.h>\r\n#    endif\r\n#  else\r\n#    ifdef HAVE_WINSOCK_H\r\n#      include <winsock.h>\r\n#    endif\r\n#  endif\r\n#  include <tchar.h>\r\n#endif\r\n\r\n/*\r\n * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else\r\n * define USE_WINSOCK to 1 if we have and use WINSOCK  API, else\r\n * undefine USE_WINSOCK.\r\n */\r\n\r\n#undef USE_WINSOCK\r\n\r\n#ifdef HAVE_WINSOCK2_H\r\n#  define USE_WINSOCK 2\r\n#else\r\n#  ifdef HAVE_WINSOCK_H\r\n#    define USE_WINSOCK 1\r\n#  endif\r\n#endif\r\n\r\n#ifdef USE_LWIPSOCK\r\n#  include <lwip/init.h>\r\n#  include <lwip/sockets.h>\r\n#  include <lwip/netdb.h>\r\n#endif\r\n\r\n#ifdef HAVE_EXTRA_STRICMP_H\r\n#  include <extra/stricmp.h>\r\n#endif\r\n\r\n#ifdef HAVE_EXTRA_STRDUP_H\r\n#  include <extra/strdup.h>\r\n#endif\r\n\r\n#ifdef TPF\r\n#  include <strings.h>    /* for bzero, strcasecmp, and strncasecmp */\r\n#  include <string.h>     /* for strcpy and strlen */\r\n#  include <stdlib.h>     /* for rand and srand */\r\n#  include <sys/socket.h> /* for select and ioctl*/\r\n#  include <netdb.h>      /* for in_addr_t definition */\r\n#  include <tpf/sysapi.h> /* for tpf_process_signals */\r\n   /* change which select is used for libcurl */\r\n#  define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)\r\n#endif\r\n\r\n#ifdef __VXWORKS__\r\n#  include <sockLib.h>    /* for generic BSD socket functions */\r\n#  include <ioLib.h>      /* for basic I/O interface functions */\r\n#endif\r\n\r\n#ifdef __AMIGA__\r\n#  ifndef __ixemul__\r\n#    include <exec/types.h>\r\n#    include <exec/execbase.h>\r\n#    include <proto/exec.h>\r\n#    include <proto/dos.h>\r\n#    define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)\r\n#  endif\r\n#endif\r\n\r\n#include <stdio.h>\r\n#ifdef HAVE_ASSERT_H\r\n#include <assert.h>\r\n#endif\r\n\r\n#ifdef __TANDEM /* for nsr-tandem-nsk systems */\r\n#include <floss.h>\r\n#endif\r\n\r\n#ifndef STDC_HEADERS /* no standard C headers! */\r\n#include <curl/stdcheaders.h>\r\n#endif\r\n\r\n#ifdef __POCC__\r\n#  include <sys/types.h>\r\n#  include <unistd.h>\r\n#  define sys_nerr EILSEQ\r\n#endif\r\n\r\n/*\r\n * Salford-C kludge section (mostly borrowed from wxWidgets).\r\n */\r\n#ifdef __SALFORDC__\r\n  #pragma suppress 353             /* Possible nested comments */\r\n  #pragma suppress 593             /* Define not used */\r\n  #pragma suppress 61              /* enum has no name */\r\n  #pragma suppress 106             /* unnamed, unused parameter */\r\n  #include <clib.h>\r\n#endif\r\n\r\n/*\r\n * Large file (>2Gb) support using WIN32 functions.\r\n */\r\n\r\n#ifdef USE_WIN32_LARGE_FILES\r\n#  include <io.h>\r\n#  include <sys/types.h>\r\n#  include <sys/stat.h>\r\n#  undef  lseek\r\n#  define lseek(fdes,offset,whence)  _lseeki64(fdes, offset, whence)\r\n#  define fstat(fdes,stp)            _fstati64(fdes, stp)\r\n#  define stat(fname,stp)            _stati64(fname, stp)\r\n#  define struct_stat                struct _stati64\r\n#  define LSEEK_ERROR                (__int64)-1\r\n#endif\r\n\r\n/*\r\n * Small file (<2Gb) support using WIN32 functions.\r\n */\r\n\r\n#ifdef USE_WIN32_SMALL_FILES\r\n#  include <io.h>\r\n#  include <sys/types.h>\r\n#  include <sys/stat.h>\r\n#  ifndef _WIN32_WCE\r\n#    undef  lseek\r\n#    define lseek(fdes,offset,whence)  _lseek(fdes, (long)offset, whence)\r\n#    define fstat(fdes,stp)            _fstat(fdes, stp)\r\n#    define stat(fname,stp)            _stat(fname, stp)\r\n#    define struct_stat                struct _stat\r\n#  endif\r\n#  define LSEEK_ERROR                (long)-1\r\n#endif\r\n\r\n#ifndef struct_stat\r\n#  define struct_stat struct stat\r\n#endif\r\n\r\n#ifndef LSEEK_ERROR\r\n#  define LSEEK_ERROR (off_t)-1\r\n#endif\r\n\r\n/*\r\n * Default sizeof(off_t) in case it hasn't been defined in config file.\r\n */\r\n\r\n#ifndef SIZEOF_OFF_T\r\n#  if defined(__VMS) && !defined(__VAX)\r\n#    if defined(_LARGEFILE)\r\n#      define SIZEOF_OFF_T 8\r\n#    endif\r\n#  elif defined(__OS400__) && defined(__ILEC400__)\r\n#    if defined(_LARGE_FILES)\r\n#      define SIZEOF_OFF_T 8\r\n#    endif\r\n#  elif defined(__MVS__) && defined(__IBMC__)\r\n#    if defined(_LP64) || defined(_LARGE_FILES)\r\n#      define SIZEOF_OFF_T 8\r\n#    endif\r\n#  elif defined(__370__) && defined(__IBMC__)\r\n#    if defined(_LP64) || defined(_LARGE_FILES)\r\n#      define SIZEOF_OFF_T 8\r\n#    endif\r\n#  endif\r\n#  ifndef SIZEOF_OFF_T\r\n#    define SIZEOF_OFF_T 4\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Arg 2 type for gethostname in case it hasn't been defined in config file.\r\n */\r\n\r\n#ifndef GETHOSTNAME_TYPE_ARG2\r\n#  ifdef USE_WINSOCK\r\n#    define GETHOSTNAME_TYPE_ARG2 int\r\n#  else\r\n#    define GETHOSTNAME_TYPE_ARG2 size_t\r\n#  endif\r\n#endif\r\n\r\n/* Below we define some functions. They should\r\n\r\n   4. set the SIGALRM signal timeout\r\n   5. set dir/file naming defines\r\n   */\r\n\r\n#ifdef WIN32\r\n\r\n#  define DIR_CHAR      \"\\\\\"\r\n#  define DOT_CHAR      \"_\"\r\n\r\n#else /* WIN32 */\r\n\r\n#  ifdef MSDOS  /* Watt-32 */\r\n\r\n#    include <sys/ioctl.h>\r\n#    define select(n,r,w,x,t) select_s(n,r,w,x,t)\r\n#    define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))\r\n#    include <tcp.h>\r\n#    ifdef word\r\n#      undef word\r\n#    endif\r\n#    ifdef byte\r\n#      undef byte\r\n#    endif\r\n\r\n#  endif /* MSDOS */\r\n\r\n#  ifdef __minix\r\n     /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */\r\n     extern char * strtok_r(char *s, const char *delim, char **last);\r\n     extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);\r\n#  endif\r\n\r\n#  define DIR_CHAR      \"/\"\r\n#  ifndef DOT_CHAR\r\n#    define DOT_CHAR      \".\"\r\n#  endif\r\n\r\n#  ifdef MSDOS\r\n#    undef DOT_CHAR\r\n#    define DOT_CHAR      \"_\"\r\n#  endif\r\n\r\n#  ifndef fileno /* sunos 4 have this as a macro! */\r\n     int fileno( FILE *stream);\r\n#  endif\r\n\r\n#endif /* WIN32 */\r\n\r\n/*\r\n * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN\r\n * defined in ws2tcpip.h as well as to provide IPv6 support.\r\n */\r\n\r\n#if defined(_MSC_VER) && !defined(__POCC__)\r\n#  if !defined(HAVE_WS2TCPIP_H) || \\\r\n     ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))\r\n#    undef HAVE_GETADDRINFO_THREADSAFE\r\n#    undef HAVE_FREEADDRINFO\r\n#    undef HAVE_GETADDRINFO\r\n#    undef HAVE_GETNAMEINFO\r\n#    undef ENABLE_IPV6\r\n#  endif\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n/*             resolver specialty compile-time defines              */\r\n/*         CURLRES_* defines to use in the host*.c sources          */\r\n/* ---------------------------------------------------------------- */\r\n\r\n/*\r\n * lcc-win32 doesn't have _beginthreadex(), lacks threads support.\r\n */\r\n\r\n#if defined(__LCC__) && defined(WIN32)\r\n#  undef USE_THREADS_POSIX\r\n#  undef USE_THREADS_WIN32\r\n#endif\r\n\r\n/*\r\n * MSVC threads support requires a multi-threaded runtime library.\r\n * _beginthreadex() is not available in single-threaded ones.\r\n */\r\n\r\n#if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT)\r\n#  undef USE_THREADS_POSIX\r\n#  undef USE_THREADS_WIN32\r\n#endif\r\n\r\n/*\r\n * Mutually exclusive CURLRES_* definitions.\r\n */\r\n\r\n#ifdef USE_ARES\r\n#  define CURLRES_ASYNCH\r\n#  define CURLRES_ARES\r\n/* now undef the stock libc functions just to avoid them being used */\r\n#  undef HAVE_GETADDRINFO\r\n#  undef HAVE_GETHOSTBYNAME\r\n#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)\r\n#  define CURLRES_ASYNCH\r\n#  define CURLRES_THREADED\r\n#else\r\n#  define CURLRES_SYNCH\r\n#endif\r\n\r\n#ifdef ENABLE_IPV6\r\n#  define CURLRES_IPV6\r\n#else\r\n#  define CURLRES_IPV4\r\n#endif\r\n\r\n/* ---------------------------------------------------------------- */\r\n\r\n/*\r\n * When using WINSOCK, TELNET protocol requires WINSOCK2 API.\r\n */\r\n\r\n#if defined(USE_WINSOCK) && (USE_WINSOCK != 2)\r\n#  define CURL_DISABLE_TELNET 1\r\n#endif\r\n\r\n/*\r\n * msvc 6.0 does not have struct sockaddr_storage and\r\n * does not define IPPROTO_ESP in winsock2.h. But both\r\n * are available if PSDK is properly installed.\r\n */\r\n\r\n#if defined(_MSC_VER) && !defined(__POCC__)\r\n#  if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))\r\n#    undef HAVE_STRUCT_SOCKADDR_STORAGE\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Intentionally fail to build when using msvc 6.0 without PSDK installed.\r\n * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK\r\n * in lib/config-win32.h although absolutely discouraged and unsupported.\r\n */\r\n\r\n#if defined(_MSC_VER) && !defined(__POCC__)\r\n#  if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_))\r\n#    if !defined(ALLOW_MSVC6_WITHOUT_PSDK)\r\n#      error MSVC 6.0 requires \"February 2003 Platform SDK\" a.k.a. \\\r\n             \"Windows Server 2003 PSDK\"\r\n#    else\r\n#      define CURL_DISABLE_LDAP 1\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#ifdef NETWARE\r\nint netware_init(void);\r\n#ifndef __NOVELL_LIBC__\r\n#include <sys/bsdskt.h>\r\n#include <sys/timeval.h>\r\n#endif\r\n#endif\r\n\r\n#if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)\r\n/* The lib was present and the tld.h header (which is missing in libidn 0.3.X\r\n   but we only work with libidn 0.4.1 or later) */\r\n#define USE_LIBIDN\r\n#endif\r\n\r\n#ifndef SIZEOF_TIME_T\r\n/* assume default size of time_t to be 32 bit */\r\n#define SIZEOF_TIME_T 4\r\n#endif\r\n\r\n#define LIBIDN_REQUIRED_VERSION \"0.4.1\"\r\n\r\n#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || \\\r\n    defined(USE_QSOSSL) || defined(USE_POLARSSL) || defined(USE_AXTLS) || \\\r\n    defined(USE_CYASSL) || defined(USE_SCHANNEL) || \\\r\n    defined(USE_DARWINSSL)\r\n#define USE_SSL    /* SSL support has been enabled */\r\n#endif\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n#define USE_HTTP_NEGOTIATE\r\n#endif\r\n\r\n/* Single point where USE_NTLM definition might be done */\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)\r\n#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || \\\r\n    defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_DARWINSSL)\r\n#define USE_NTLM\r\n#endif\r\n#endif\r\n\r\n/* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */\r\n#if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)\r\n#define CURL_CA_BUNDLE getenv(\"CURL_CA_BUNDLE\")\r\n#endif\r\n\r\n/*\r\n * Provide a mechanism to silence picky compilers, such as gcc 4.6+.\r\n * Parameters should of course normally not be unused, but for example when\r\n * we have multiple implementations of the same interface it may happen.\r\n */\r\n\r\n#if defined(__GNUC__) && ((__GNUC__ >= 3) || \\\r\n  ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))\r\n#  define UNUSED_PARAM __attribute__((__unused__))\r\n#else\r\n#  define UNUSED_PARAM /*NOTHING*/\r\n#endif\r\n\r\n/*\r\n * Include macros and defines that should only be processed once.\r\n */\r\n\r\n#ifndef HEADER_CURL_SETUP_ONCE_H\r\n#include \"curl_setup_once.h\"\r\n#endif\r\n\r\n/*\r\n * Definition of our NOP statement Object-like macro\r\n */\r\n\r\n#ifndef Curl_nop_stmt\r\n#  define Curl_nop_stmt do { } WHILE_FALSE\r\n#endif\r\n\r\n/*\r\n * Ensure that Winsock and lwIP TCP/IP stacks are not mixed.\r\n */\r\n\r\n#if defined(__LWIP_OPT_H__)\r\n#  if defined(SOCKET) || \\\r\n     defined(USE_WINSOCK) || \\\r\n     defined(HAVE_WINSOCK_H) || \\\r\n     defined(HAVE_WINSOCK2_H) || \\\r\n     defined(HAVE_WS2TCPIP_H)\r\n#    error \"Winsock and lwIP TCP/IP stack definitions shall not coexist!\"\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Portable symbolic names for Winsock shutdown() mode flags.\r\n */\r\n\r\n#ifdef USE_WINSOCK\r\n#  define SHUT_RD   0x00\r\n#  define SHUT_WR   0x01\r\n#  define SHUT_RDWR 0x02\r\n#endif\r\n\r\n/* Define S_ISREG if not defined by system headers, f.e. MSVC */\r\n#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)\r\n#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)\r\n#endif\r\n\r\n#endif /* HEADER_CURL_SETUP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_setup_once.h",
    "content": "#ifndef HEADER_CURL_SETUP_ONCE_H\r\n#define HEADER_CURL_SETUP_ONCE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n\r\n/*\r\n * Inclusion of common header files.\r\n */\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <stdarg.h>\r\n#include <ctype.h>\r\n\r\n#ifdef HAVE_ERRNO_H\r\n#include <errno.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_TYPES_H\r\n#include <sys/types.h>\r\n#endif\r\n\r\n#ifdef NEED_MALLOC_H\r\n#include <malloc.h>\r\n#endif\r\n\r\n#ifdef NEED_MEMORY_H\r\n#include <memory.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_STAT_H\r\n#include <sys/stat.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_TIME_H\r\n#include <sys/time.h>\r\n#ifdef TIME_WITH_SYS_TIME\r\n#include <time.h>\r\n#endif\r\n#else\r\n#ifdef HAVE_TIME_H\r\n#include <time.h>\r\n#endif\r\n#endif\r\n\r\n#ifdef WIN32\r\n#include <io.h>\r\n#include <fcntl.h>\r\n#endif\r\n\r\n#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T)\r\n#include <stdbool.h>\r\n#endif\r\n\r\n#ifdef HAVE_UNISTD_H\r\n#include <unistd.h>\r\n#endif\r\n\r\n#ifdef __hpux\r\n#  if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)\r\n#    ifdef _APP32_64BIT_OFF_T\r\n#      define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T\r\n#      undef _APP32_64BIT_OFF_T\r\n#    else\r\n#      undef OLD_APP32_64BIT_OFF_T\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#ifdef HAVE_SYS_SOCKET_H\r\n#include <sys/socket.h>\r\n#endif\r\n\r\n#ifdef __hpux\r\n#  if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)\r\n#    ifdef OLD_APP32_64BIT_OFF_T\r\n#      define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T\r\n#      undef OLD_APP32_64BIT_OFF_T\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n\r\n/*\r\n * Definition of timeval struct for platforms that don't have it.\r\n */\r\n\r\n#ifndef HAVE_STRUCT_TIMEVAL\r\nstruct timeval {\r\n long tv_sec;\r\n long tv_usec;\r\n};\r\n#endif\r\n\r\n\r\n/*\r\n * If we have the MSG_NOSIGNAL define, make sure we use\r\n * it as the fourth argument of function send()\r\n */\r\n\r\n#ifdef HAVE_MSG_NOSIGNAL\r\n#define SEND_4TH_ARG MSG_NOSIGNAL\r\n#else\r\n#define SEND_4TH_ARG 0\r\n#endif\r\n\r\n\r\n#if defined(__minix)\r\n/* Minix doesn't support recv on TCP sockets */\r\n#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \\\r\n                                   (RECV_TYPE_ARG2)(y), \\\r\n                                   (RECV_TYPE_ARG3)(z))\r\n\r\n#elif defined(HAVE_RECV)\r\n/*\r\n * The definitions for the return type and arguments types\r\n * of functions recv() and send() belong and come from the\r\n * configuration file. Do not define them in any other place.\r\n *\r\n * HAVE_RECV is defined if you have a function named recv()\r\n * which is used to read incoming data from sockets. If your\r\n * function has another name then don't define HAVE_RECV.\r\n *\r\n * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,\r\n * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also\r\n * be defined.\r\n *\r\n * HAVE_SEND is defined if you have a function named send()\r\n * which is used to write outgoing data on a connected socket.\r\n * If yours has another name then don't define HAVE_SEND.\r\n *\r\n * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,\r\n * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and\r\n * SEND_TYPE_RETV must also be defined.\r\n */\r\n\r\n#if !defined(RECV_TYPE_ARG1) || \\\r\n    !defined(RECV_TYPE_ARG2) || \\\r\n    !defined(RECV_TYPE_ARG3) || \\\r\n    !defined(RECV_TYPE_ARG4) || \\\r\n    !defined(RECV_TYPE_RETV)\r\n  /* */\r\n  Error Missing_definition_of_return_and_arguments_types_of_recv\r\n  /* */\r\n#else\r\n#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \\\r\n                                   (RECV_TYPE_ARG2)(y), \\\r\n                                   (RECV_TYPE_ARG3)(z), \\\r\n                                   (RECV_TYPE_ARG4)(0))\r\n#endif\r\n#else /* HAVE_RECV */\r\n#ifndef sread\r\n  /* */\r\n  Error Missing_definition_of_macro_sread\r\n  /* */\r\n#endif\r\n#endif /* HAVE_RECV */\r\n\r\n\r\n#if defined(__minix)\r\n/* Minix doesn't support send on TCP sockets */\r\n#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \\\r\n                                    (SEND_TYPE_ARG2)(y), \\\r\n                                    (SEND_TYPE_ARG3)(z))\r\n\r\n#elif defined(HAVE_SEND)\r\n#if !defined(SEND_TYPE_ARG1) || \\\r\n    !defined(SEND_QUAL_ARG2) || \\\r\n    !defined(SEND_TYPE_ARG2) || \\\r\n    !defined(SEND_TYPE_ARG3) || \\\r\n    !defined(SEND_TYPE_ARG4) || \\\r\n    !defined(SEND_TYPE_RETV)\r\n  /* */\r\n  Error Missing_definition_of_return_and_arguments_types_of_send\r\n  /* */\r\n#else\r\n#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \\\r\n                                    (SEND_TYPE_ARG2)(y), \\\r\n                                    (SEND_TYPE_ARG3)(z), \\\r\n                                    (SEND_TYPE_ARG4)(SEND_4TH_ARG))\r\n#endif\r\n#else /* HAVE_SEND */\r\n#ifndef swrite\r\n  /* */\r\n  Error Missing_definition_of_macro_swrite\r\n  /* */\r\n#endif\r\n#endif /* HAVE_SEND */\r\n\r\n\r\n#if 0\r\n#if defined(HAVE_RECVFROM)\r\n/*\r\n * Currently recvfrom is only used on udp sockets.\r\n */\r\n#if !defined(RECVFROM_TYPE_ARG1) || \\\r\n    !defined(RECVFROM_TYPE_ARG2) || \\\r\n    !defined(RECVFROM_TYPE_ARG3) || \\\r\n    !defined(RECVFROM_TYPE_ARG4) || \\\r\n    !defined(RECVFROM_TYPE_ARG5) || \\\r\n    !defined(RECVFROM_TYPE_ARG6) || \\\r\n    !defined(RECVFROM_TYPE_RETV)\r\n  /* */\r\n  Error Missing_definition_of_return_and_arguments_types_of_recvfrom\r\n  /* */\r\n#else\r\n#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1)  (s),  \\\r\n                                                 (RECVFROM_TYPE_ARG2 *)(b),  \\\r\n                                                 (RECVFROM_TYPE_ARG3)  (bl), \\\r\n                                                 (RECVFROM_TYPE_ARG4)  (0),  \\\r\n                                                 (RECVFROM_TYPE_ARG5 *)(f),  \\\r\n                                                 (RECVFROM_TYPE_ARG6 *)(fl))\r\n#endif\r\n#else /* HAVE_RECVFROM */\r\n#ifndef sreadfrom\r\n  /* */\r\n  Error Missing_definition_of_macro_sreadfrom\r\n  /* */\r\n#endif\r\n#endif /* HAVE_RECVFROM */\r\n\r\n\r\n#ifdef RECVFROM_TYPE_ARG6_IS_VOID\r\n#  define RECVFROM_ARG6_T int\r\n#else\r\n#  define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6\r\n#endif\r\n#endif /* if 0 */\r\n\r\n\r\n/*\r\n * Function-like macro definition used to close a socket.\r\n */\r\n\r\n#if defined(HAVE_CLOSESOCKET)\r\n#  define sclose(x)  closesocket((x))\r\n#elif defined(HAVE_CLOSESOCKET_CAMEL)\r\n#  define sclose(x)  CloseSocket((x))\r\n#elif defined(USE_LWIPSOCK)\r\n#  define sclose(x)  lwip_close((x))\r\n#else\r\n#  define sclose(x)  close((x))\r\n#endif\r\n\r\n/*\r\n * Stack-independent version of fcntl() on sockets:\r\n */\r\n#if defined(USE_LWIPSOCK)\r\n#  define sfcntl  lwip_fcntl\r\n#else\r\n#  define sfcntl  fcntl\r\n#endif\r\n\r\n/*\r\n * Uppercase macro versions of ANSI/ISO is*() functions/macros which\r\n * avoid negative number inputs with argument byte codes > 127.\r\n */\r\n\r\n#define ISSPACE(x)  (isspace((int)  ((unsigned char)x)))\r\n#define ISDIGIT(x)  (isdigit((int)  ((unsigned char)x)))\r\n#define ISALNUM(x)  (isalnum((int)  ((unsigned char)x)))\r\n#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))\r\n#define ISGRAPH(x)  (isgraph((int)  ((unsigned char)x)))\r\n#define ISALPHA(x)  (isalpha((int)  ((unsigned char)x)))\r\n#define ISPRINT(x)  (isprint((int)  ((unsigned char)x)))\r\n#define ISUPPER(x)  (isupper((int)  ((unsigned char)x)))\r\n#define ISLOWER(x)  (islower((int)  ((unsigned char)x)))\r\n#define ISASCII(x)  (isascii((int)  ((unsigned char)x)))\r\n\r\n#define ISBLANK(x)  (int)((((unsigned char)x) == ' ') || \\\r\n                          (((unsigned char)x) == '\\t'))\r\n\r\n#define TOLOWER(x)  (tolower((int)  ((unsigned char)x)))\r\n\r\n\r\n/*\r\n * 'bool' stuff compatible with HP-UX headers.\r\n */\r\n\r\n#if defined(__hpux) && !defined(HAVE_BOOL_T)\r\n   typedef int bool;\r\n#  define false 0\r\n#  define true 1\r\n#  define HAVE_BOOL_T\r\n#endif\r\n\r\n\r\n/*\r\n * 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.\r\n * On non-C99 platforms there's no bool, so define an enum for that.\r\n * On C99 platforms 'false' and 'true' also exist. Enum uses a\r\n * global namespace though, so use bool_false and bool_true.\r\n */\r\n\r\n#ifndef HAVE_BOOL_T\r\n  typedef enum {\r\n      bool_false = 0,\r\n      bool_true  = 1\r\n  } bool;\r\n\r\n/*\r\n * Use a define to let 'true' and 'false' use those enums.  There\r\n * are currently no use of true and false in libcurl proper, but\r\n * there are some in the examples. This will cater for any later\r\n * code happening to use true and false.\r\n */\r\n#  define false bool_false\r\n#  define true  bool_true\r\n#  define HAVE_BOOL_T\r\n#endif\r\n\r\n\r\n/*\r\n * Redefine TRUE and FALSE too, to catch current use. With this\r\n * change, 'bool found = 1' will give a warning on MIPSPro, but\r\n * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro,\r\n * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too.\r\n */\r\n\r\n#ifndef TRUE\r\n#define TRUE true\r\n#endif\r\n#ifndef FALSE\r\n#define FALSE false\r\n#endif\r\n\r\n\r\n/*\r\n * Macro WHILE_FALSE may be used to build single-iteration do-while loops,\r\n * avoiding compiler warnings. Mostly intended for other macro definitions.\r\n */\r\n\r\n#define WHILE_FALSE  while(0)\r\n\r\n#if defined(_MSC_VER) && !defined(__POCC__)\r\n#  undef WHILE_FALSE\r\n#  if (_MSC_VER < 1500)\r\n#    define WHILE_FALSE  while(1, 0)\r\n#  else\r\n#    define WHILE_FALSE \\\r\n__pragma(warning(push)) \\\r\n__pragma(warning(disable:4127)) \\\r\nwhile(0) \\\r\n__pragma(warning(pop))\r\n#  endif\r\n#endif\r\n\r\n\r\n/*\r\n * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.\r\n */\r\n\r\n#ifndef HAVE_SIG_ATOMIC_T\r\ntypedef int sig_atomic_t;\r\n#define HAVE_SIG_ATOMIC_T\r\n#endif\r\n\r\n\r\n/*\r\n * Convenience SIG_ATOMIC_T definition\r\n */\r\n\r\n#ifdef HAVE_SIG_ATOMIC_T_VOLATILE\r\n#define SIG_ATOMIC_T static sig_atomic_t\r\n#else\r\n#define SIG_ATOMIC_T static volatile sig_atomic_t\r\n#endif\r\n\r\n\r\n/*\r\n * Default return type for signal handlers.\r\n */\r\n\r\n#ifndef RETSIGTYPE\r\n#define RETSIGTYPE void\r\n#endif\r\n\r\n\r\n/*\r\n * Macro used to include code only in debug builds.\r\n */\r\n\r\n#ifdef DEBUGBUILD\r\n#define DEBUGF(x) x\r\n#else\r\n#define DEBUGF(x) do { } WHILE_FALSE\r\n#endif\r\n\r\n\r\n/*\r\n * Macro used to include assertion code only in debug builds.\r\n */\r\n\r\n#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)\r\n#define DEBUGASSERT(x) assert(x)\r\n#else\r\n#define DEBUGASSERT(x) do { } WHILE_FALSE\r\n#endif\r\n\r\n\r\n/*\r\n * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno\r\n * (or equivalent) on this platform to hide platform details to code using it.\r\n */\r\n\r\n#ifdef USE_WINSOCK\r\n#define SOCKERRNO         ((int)WSAGetLastError())\r\n#define SET_SOCKERRNO(x)  (WSASetLastError((int)(x)))\r\n#else\r\n#define SOCKERRNO         (errno)\r\n#define SET_SOCKERRNO(x)  (errno = (x))\r\n#endif\r\n\r\n\r\n/*\r\n * Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno\r\n * (or equivalent) on this platform to hide platform details to code using it.\r\n */\r\n\r\n#ifdef WIN32\r\n#define ERRNO         ((int)GetLastError())\r\n#define SET_ERRNO(x)  (SetLastError((DWORD)(x)))\r\n#else\r\n#define ERRNO         (errno)\r\n#define SET_ERRNO(x)  (errno = (x))\r\n#endif\r\n\r\n\r\n/*\r\n * Portable error number symbolic names defined to Winsock error codes.\r\n */\r\n\r\n#ifdef USE_WINSOCK\r\n#undef  EBADF            /* override definition in errno.h */\r\n#define EBADF            WSAEBADF\r\n#undef  EINTR            /* override definition in errno.h */\r\n#define EINTR            WSAEINTR\r\n#undef  EINVAL           /* override definition in errno.h */\r\n#define EINVAL           WSAEINVAL\r\n#undef  EWOULDBLOCK      /* override definition in errno.h */\r\n#define EWOULDBLOCK      WSAEWOULDBLOCK\r\n#undef  EINPROGRESS      /* override definition in errno.h */\r\n#define EINPROGRESS      WSAEINPROGRESS\r\n#undef  EALREADY         /* override definition in errno.h */\r\n#define EALREADY         WSAEALREADY\r\n#undef  ENOTSOCK         /* override definition in errno.h */\r\n#define ENOTSOCK         WSAENOTSOCK\r\n#undef  EDESTADDRREQ     /* override definition in errno.h */\r\n#define EDESTADDRREQ     WSAEDESTADDRREQ\r\n#undef  EMSGSIZE         /* override definition in errno.h */\r\n#define EMSGSIZE         WSAEMSGSIZE\r\n#undef  EPROTOTYPE       /* override definition in errno.h */\r\n#define EPROTOTYPE       WSAEPROTOTYPE\r\n#undef  ENOPROTOOPT      /* override definition in errno.h */\r\n#define ENOPROTOOPT      WSAENOPROTOOPT\r\n#undef  EPROTONOSUPPORT  /* override definition in errno.h */\r\n#define EPROTONOSUPPORT  WSAEPROTONOSUPPORT\r\n#define ESOCKTNOSUPPORT  WSAESOCKTNOSUPPORT\r\n#undef  EOPNOTSUPP       /* override definition in errno.h */\r\n#define EOPNOTSUPP       WSAEOPNOTSUPP\r\n#define EPFNOSUPPORT     WSAEPFNOSUPPORT\r\n#undef  EAFNOSUPPORT     /* override definition in errno.h */\r\n#define EAFNOSUPPORT     WSAEAFNOSUPPORT\r\n#undef  EADDRINUSE       /* override definition in errno.h */\r\n#define EADDRINUSE       WSAEADDRINUSE\r\n#undef  EADDRNOTAVAIL    /* override definition in errno.h */\r\n#define EADDRNOTAVAIL    WSAEADDRNOTAVAIL\r\n#undef  ENETDOWN         /* override definition in errno.h */\r\n#define ENETDOWN         WSAENETDOWN\r\n#undef  ENETUNREACH      /* override definition in errno.h */\r\n#define ENETUNREACH      WSAENETUNREACH\r\n#undef  ENETRESET        /* override definition in errno.h */\r\n#define ENETRESET        WSAENETRESET\r\n#undef  ECONNABORTED     /* override definition in errno.h */\r\n#define ECONNABORTED     WSAECONNABORTED\r\n#undef  ECONNRESET       /* override definition in errno.h */\r\n#define ECONNRESET       WSAECONNRESET\r\n#undef  ENOBUFS          /* override definition in errno.h */\r\n#define ENOBUFS          WSAENOBUFS\r\n#undef  EISCONN          /* override definition in errno.h */\r\n#define EISCONN          WSAEISCONN\r\n#undef  ENOTCONN         /* override definition in errno.h */\r\n#define ENOTCONN         WSAENOTCONN\r\n#define ESHUTDOWN        WSAESHUTDOWN\r\n#define ETOOMANYREFS     WSAETOOMANYREFS\r\n#undef  ETIMEDOUT        /* override definition in errno.h */\r\n#define ETIMEDOUT        WSAETIMEDOUT\r\n#undef  ECONNREFUSED     /* override definition in errno.h */\r\n#define ECONNREFUSED     WSAECONNREFUSED\r\n#undef  ELOOP            /* override definition in errno.h */\r\n#define ELOOP            WSAELOOP\r\n#ifndef ENAMETOOLONG     /* possible previous definition in errno.h */\r\n#define ENAMETOOLONG     WSAENAMETOOLONG\r\n#endif\r\n#define EHOSTDOWN        WSAEHOSTDOWN\r\n#undef  EHOSTUNREACH     /* override definition in errno.h */\r\n#define EHOSTUNREACH     WSAEHOSTUNREACH\r\n#ifndef ENOTEMPTY        /* possible previous definition in errno.h */\r\n#define ENOTEMPTY        WSAENOTEMPTY\r\n#endif\r\n#define EPROCLIM         WSAEPROCLIM\r\n#define EUSERS           WSAEUSERS\r\n#define EDQUOT           WSAEDQUOT\r\n#define ESTALE           WSAESTALE\r\n#define EREMOTE          WSAEREMOTE\r\n#endif\r\n\r\n/*\r\n * Macro argv_item_t hides platform details to code using it.\r\n */\r\n\r\n#ifdef __VMS\r\n#define argv_item_t  __char_ptr32\r\n#else\r\n#define argv_item_t  char *\r\n#endif\r\n\r\n\r\n/*\r\n * We use this ZERO_NULL to avoid picky compiler warnings,\r\n * when assigning a NULL pointer to a function pointer var.\r\n */\r\n\r\n#define ZERO_NULL 0\r\n\r\n\r\n#endif /* HEADER_CURL_SETUP_ONCE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_sspi.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"curl_sspi.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* We use our own typedef here since some headers might lack these */\r\ntypedef PSecurityFunctionTable (APIENTRY *INITSECURITYINTERFACE_FN)(VOID);\r\n\r\n/* See definition of SECURITY_ENTRYPOINT in sspi.h */\r\n#ifdef UNICODE\r\n#  ifdef _WIN32_WCE\r\n#    define SECURITYENTRYPOINT L\"InitSecurityInterfaceW\"\r\n#  else\r\n#    define SECURITYENTRYPOINT \"InitSecurityInterfaceW\"\r\n#  endif\r\n#else\r\n#  define SECURITYENTRYPOINT \"InitSecurityInterfaceA\"\r\n#endif\r\n\r\n/* Handle of security.dll or secur32.dll, depending on Windows version */\r\nHMODULE s_hSecDll = NULL;\r\n\r\n/* Pointer to SSPI dispatch table */\r\nPSecurityFunctionTable s_pSecFn = NULL;\r\n\r\n/*\r\n * Curl_sspi_global_init()\r\n *\r\n * This is used to load the Security Service Provider Interface (SSPI)\r\n * dynamic link library portably across all Windows versions, without\r\n * the need to directly link libcurl, nor the application using it, at\r\n * build time.\r\n *\r\n * Once this function has been executed, Windows SSPI functions can be\r\n * called through the Security Service Provider Interface dispatch table.\r\n */\r\nCURLcode Curl_sspi_global_init(void)\r\n{\r\n  OSVERSIONINFO osver;\r\n  INITSECURITYINTERFACE_FN pInitSecurityInterface;\r\n\r\n  /* If security interface is not yet initialized try to do this */\r\n  if(!s_hSecDll) {\r\n\r\n    /* Find out Windows version */\r\n    memset(&osver, 0, sizeof(osver));\r\n    osver.dwOSVersionInfoSize = sizeof(osver);\r\n    if(!GetVersionEx(&osver))\r\n      return CURLE_FAILED_INIT;\r\n\r\n    /* Security Service Provider Interface (SSPI) functions are located in\r\n     * security.dll on WinNT 4.0 and in secur32.dll on Win9x. Win2K and XP\r\n     * have both these DLLs (security.dll forwards calls to secur32.dll) */\r\n\r\n    /* Load SSPI dll into the address space of the calling process */\r\n    if(osver.dwPlatformId == VER_PLATFORM_WIN32_NT\r\n      && osver.dwMajorVersion == 4)\r\n      s_hSecDll = LoadLibrary(TEXT(\"security.dll\"));\r\n    else\r\n      s_hSecDll = LoadLibrary(TEXT(\"secur32.dll\"));\r\n    if(!s_hSecDll)\r\n      return CURLE_FAILED_INIT;\r\n\r\n    /* Get address of the InitSecurityInterfaceA function from the SSPI dll */\r\n    pInitSecurityInterface = (INITSECURITYINTERFACE_FN)\r\n      GetProcAddress(s_hSecDll, SECURITYENTRYPOINT);\r\n    if(!pInitSecurityInterface)\r\n      return CURLE_FAILED_INIT;\r\n\r\n    /* Get pointer to Security Service Provider Interface dispatch table */\r\n    s_pSecFn = pInitSecurityInterface();\r\n    if(!s_pSecFn)\r\n      return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_sspi_global_cleanup()\r\n *\r\n * This deinitializes the Security Service Provider Interface from libcurl.\r\n */\r\n\r\nvoid Curl_sspi_global_cleanup(void)\r\n{\r\n  if(s_hSecDll) {\r\n    FreeLibrary(s_hSecDll);\r\n    s_hSecDll = NULL;\r\n    s_pSecFn = NULL;\r\n  }\r\n}\r\n\r\n#endif /* USE_WINDOWS_SSPI */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_sspi.h",
    "content": "#ifndef HEADER_CURL_SSPI_H\r\n#define HEADER_CURL_SSPI_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n\r\n#include <curl/curl.h>\r\n\r\n/*\r\n * When including the following three headers, it is mandatory to define either\r\n * SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code.\r\n */\r\n\r\n#undef SECURITY_WIN32\r\n#undef SECURITY_KERNEL\r\n#define SECURITY_WIN32 1\r\n#include <security.h>\r\n#include <sspi.h>\r\n#include <rpc.h>\r\n\r\nCURLcode Curl_sspi_global_init(void);\r\nvoid Curl_sspi_global_cleanup(void);\r\n\r\n/* Forward-declaration of global variables defined in curl_sspi.c */\r\n\r\nextern HMODULE s_hSecDll;\r\nextern PSecurityFunctionTable s_pSecFn;\r\n\r\n/* Provide some definitions missing in old headers */\r\n\r\n#ifndef SEC_E_INSUFFICIENT_MEMORY\r\n# define SEC_E_INSUFFICIENT_MEMORY             ((HRESULT)0x80090300L)\r\n#endif\r\n#ifndef SEC_E_INVALID_HANDLE\r\n# define SEC_E_INVALID_HANDLE                  ((HRESULT)0x80090301L)\r\n#endif\r\n#ifndef SEC_E_UNSUPPORTED_FUNCTION\r\n# define SEC_E_UNSUPPORTED_FUNCTION            ((HRESULT)0x80090302L)\r\n#endif\r\n#ifndef SEC_E_TARGET_UNKNOWN\r\n# define SEC_E_TARGET_UNKNOWN                  ((HRESULT)0x80090303L)\r\n#endif\r\n#ifndef SEC_E_INTERNAL_ERROR\r\n# define SEC_E_INTERNAL_ERROR                  ((HRESULT)0x80090304L)\r\n#endif\r\n#ifndef SEC_E_SECPKG_NOT_FOUND\r\n# define SEC_E_SECPKG_NOT_FOUND                ((HRESULT)0x80090305L)\r\n#endif\r\n#ifndef SEC_E_NOT_OWNER\r\n# define SEC_E_NOT_OWNER                       ((HRESULT)0x80090306L)\r\n#endif\r\n#ifndef SEC_E_CANNOT_INSTALL\r\n# define SEC_E_CANNOT_INSTALL                  ((HRESULT)0x80090307L)\r\n#endif\r\n#ifndef SEC_E_INVALID_TOKEN\r\n# define SEC_E_INVALID_TOKEN                   ((HRESULT)0x80090308L)\r\n#endif\r\n#ifndef SEC_E_CANNOT_PACK\r\n# define SEC_E_CANNOT_PACK                     ((HRESULT)0x80090309L)\r\n#endif\r\n#ifndef SEC_E_QOP_NOT_SUPPORTED\r\n# define SEC_E_QOP_NOT_SUPPORTED               ((HRESULT)0x8009030AL)\r\n#endif\r\n#ifndef SEC_E_NO_IMPERSONATION\r\n# define SEC_E_NO_IMPERSONATION                ((HRESULT)0x8009030BL)\r\n#endif\r\n#ifndef SEC_E_LOGON_DENIED\r\n# define SEC_E_LOGON_DENIED                    ((HRESULT)0x8009030CL)\r\n#endif\r\n#ifndef SEC_E_UNKNOWN_CREDENTIALS\r\n# define SEC_E_UNKNOWN_CREDENTIALS             ((HRESULT)0x8009030DL)\r\n#endif\r\n#ifndef SEC_E_NO_CREDENTIALS\r\n# define SEC_E_NO_CREDENTIALS                  ((HRESULT)0x8009030EL)\r\n#endif\r\n#ifndef SEC_E_MESSAGE_ALTERED\r\n# define SEC_E_MESSAGE_ALTERED                 ((HRESULT)0x8009030FL)\r\n#endif\r\n#ifndef SEC_E_OUT_OF_SEQUENCE\r\n# define SEC_E_OUT_OF_SEQUENCE                 ((HRESULT)0x80090310L)\r\n#endif\r\n#ifndef SEC_E_NO_AUTHENTICATING_AUTHORITY\r\n# define SEC_E_NO_AUTHENTICATING_AUTHORITY     ((HRESULT)0x80090311L)\r\n#endif\r\n#ifndef SEC_E_BAD_PKGID\r\n# define SEC_E_BAD_PKGID                       ((HRESULT)0x80090316L)\r\n#endif\r\n#ifndef SEC_E_CONTEXT_EXPIRED\r\n# define SEC_E_CONTEXT_EXPIRED                 ((HRESULT)0x80090317L)\r\n#endif\r\n#ifndef SEC_E_INCOMPLETE_MESSAGE\r\n# define SEC_E_INCOMPLETE_MESSAGE              ((HRESULT)0x80090318L)\r\n#endif\r\n#ifndef SEC_E_INCOMPLETE_CREDENTIALS\r\n# define SEC_E_INCOMPLETE_CREDENTIALS          ((HRESULT)0x80090320L)\r\n#endif\r\n#ifndef SEC_E_BUFFER_TOO_SMALL\r\n# define SEC_E_BUFFER_TOO_SMALL                ((HRESULT)0x80090321L)\r\n#endif\r\n#ifndef SEC_E_WRONG_PRINCIPAL\r\n# define SEC_E_WRONG_PRINCIPAL                 ((HRESULT)0x80090322L)\r\n#endif\r\n#ifndef SEC_E_TIME_SKEW\r\n# define SEC_E_TIME_SKEW                       ((HRESULT)0x80090324L)\r\n#endif\r\n#ifndef SEC_E_UNTRUSTED_ROOT\r\n# define SEC_E_UNTRUSTED_ROOT                  ((HRESULT)0x80090325L)\r\n#endif\r\n#ifndef SEC_E_ILLEGAL_MESSAGE\r\n# define SEC_E_ILLEGAL_MESSAGE                 ((HRESULT)0x80090326L)\r\n#endif\r\n#ifndef SEC_E_CERT_UNKNOWN\r\n# define SEC_E_CERT_UNKNOWN                    ((HRESULT)0x80090327L)\r\n#endif\r\n#ifndef SEC_E_CERT_EXPIRED\r\n# define SEC_E_CERT_EXPIRED                    ((HRESULT)0x80090328L)\r\n#endif\r\n#ifndef SEC_E_ENCRYPT_FAILURE\r\n# define SEC_E_ENCRYPT_FAILURE                 ((HRESULT)0x80090329L)\r\n#endif\r\n#ifndef SEC_E_DECRYPT_FAILURE\r\n# define SEC_E_DECRYPT_FAILURE                 ((HRESULT)0x80090330L)\r\n#endif\r\n#ifndef SEC_E_ALGORITHM_MISMATCH\r\n# define SEC_E_ALGORITHM_MISMATCH              ((HRESULT)0x80090331L)\r\n#endif\r\n#ifndef SEC_E_SECURITY_QOS_FAILED\r\n# define SEC_E_SECURITY_QOS_FAILED             ((HRESULT)0x80090332L)\r\n#endif\r\n#ifndef SEC_E_UNFINISHED_CONTEXT_DELETED\r\n# define SEC_E_UNFINISHED_CONTEXT_DELETED      ((HRESULT)0x80090333L)\r\n#endif\r\n#ifndef SEC_E_NO_TGT_REPLY\r\n# define SEC_E_NO_TGT_REPLY                    ((HRESULT)0x80090334L)\r\n#endif\r\n#ifndef SEC_E_NO_IP_ADDRESSES\r\n# define SEC_E_NO_IP_ADDRESSES                 ((HRESULT)0x80090335L)\r\n#endif\r\n#ifndef SEC_E_WRONG_CREDENTIAL_HANDLE\r\n# define SEC_E_WRONG_CREDENTIAL_HANDLE         ((HRESULT)0x80090336L)\r\n#endif\r\n#ifndef SEC_E_CRYPTO_SYSTEM_INVALID\r\n# define SEC_E_CRYPTO_SYSTEM_INVALID           ((HRESULT)0x80090337L)\r\n#endif\r\n#ifndef SEC_E_MAX_REFERRALS_EXCEEDED\r\n# define SEC_E_MAX_REFERRALS_EXCEEDED          ((HRESULT)0x80090338L)\r\n#endif\r\n#ifndef SEC_E_MUST_BE_KDC\r\n# define SEC_E_MUST_BE_KDC                     ((HRESULT)0x80090339L)\r\n#endif\r\n#ifndef SEC_E_STRONG_CRYPTO_NOT_SUPPORTED\r\n# define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED     ((HRESULT)0x8009033AL)\r\n#endif\r\n#ifndef SEC_E_TOO_MANY_PRINCIPALS\r\n# define SEC_E_TOO_MANY_PRINCIPALS             ((HRESULT)0x8009033BL)\r\n#endif\r\n#ifndef SEC_E_NO_PA_DATA\r\n# define SEC_E_NO_PA_DATA                      ((HRESULT)0x8009033CL)\r\n#endif\r\n#ifndef SEC_E_PKINIT_NAME_MISMATCH\r\n# define SEC_E_PKINIT_NAME_MISMATCH            ((HRESULT)0x8009033DL)\r\n#endif\r\n#ifndef SEC_E_SMARTCARD_LOGON_REQUIRED\r\n# define SEC_E_SMARTCARD_LOGON_REQUIRED        ((HRESULT)0x8009033EL)\r\n#endif\r\n#ifndef SEC_E_SHUTDOWN_IN_PROGRESS\r\n# define SEC_E_SHUTDOWN_IN_PROGRESS            ((HRESULT)0x8009033FL)\r\n#endif\r\n#ifndef SEC_E_KDC_INVALID_REQUEST\r\n# define SEC_E_KDC_INVALID_REQUEST             ((HRESULT)0x80090340L)\r\n#endif\r\n#ifndef SEC_E_KDC_UNABLE_TO_REFER\r\n# define SEC_E_KDC_UNABLE_TO_REFER             ((HRESULT)0x80090341L)\r\n#endif\r\n#ifndef SEC_E_KDC_UNKNOWN_ETYPE\r\n# define SEC_E_KDC_UNKNOWN_ETYPE               ((HRESULT)0x80090342L)\r\n#endif\r\n#ifndef SEC_E_UNSUPPORTED_PREAUTH\r\n# define SEC_E_UNSUPPORTED_PREAUTH             ((HRESULT)0x80090343L)\r\n#endif\r\n#ifndef SEC_E_DELEGATION_REQUIRED\r\n# define SEC_E_DELEGATION_REQUIRED             ((HRESULT)0x80090345L)\r\n#endif\r\n#ifndef SEC_E_BAD_BINDINGS\r\n# define SEC_E_BAD_BINDINGS                    ((HRESULT)0x80090346L)\r\n#endif\r\n#ifndef SEC_E_MULTIPLE_ACCOUNTS\r\n# define SEC_E_MULTIPLE_ACCOUNTS               ((HRESULT)0x80090347L)\r\n#endif\r\n#ifndef SEC_E_NO_KERB_KEY\r\n# define SEC_E_NO_KERB_KEY                     ((HRESULT)0x80090348L)\r\n#endif\r\n#ifndef SEC_E_CERT_WRONG_USAGE\r\n# define SEC_E_CERT_WRONG_USAGE                ((HRESULT)0x80090349L)\r\n#endif\r\n#ifndef SEC_E_DOWNGRADE_DETECTED\r\n# define SEC_E_DOWNGRADE_DETECTED              ((HRESULT)0x80090350L)\r\n#endif\r\n#ifndef SEC_E_SMARTCARD_CERT_REVOKED\r\n# define SEC_E_SMARTCARD_CERT_REVOKED          ((HRESULT)0x80090351L)\r\n#endif\r\n#ifndef SEC_E_ISSUING_CA_UNTRUSTED\r\n# define SEC_E_ISSUING_CA_UNTRUSTED            ((HRESULT)0x80090352L)\r\n#endif\r\n#ifndef SEC_E_REVOCATION_OFFLINE_C\r\n# define SEC_E_REVOCATION_OFFLINE_C            ((HRESULT)0x80090353L)\r\n#endif\r\n#ifndef SEC_E_PKINIT_CLIENT_FAILURE\r\n# define SEC_E_PKINIT_CLIENT_FAILURE           ((HRESULT)0x80090354L)\r\n#endif\r\n#ifndef SEC_E_SMARTCARD_CERT_EXPIRED\r\n# define SEC_E_SMARTCARD_CERT_EXPIRED          ((HRESULT)0x80090355L)\r\n#endif\r\n#ifndef SEC_E_NO_S4U_PROT_SUPPORT\r\n# define SEC_E_NO_S4U_PROT_SUPPORT             ((HRESULT)0x80090356L)\r\n#endif\r\n#ifndef SEC_E_CROSSREALM_DELEGATION_FAILURE\r\n# define SEC_E_CROSSREALM_DELEGATION_FAILURE   ((HRESULT)0x80090357L)\r\n#endif\r\n#ifndef SEC_E_REVOCATION_OFFLINE_KDC\r\n# define SEC_E_REVOCATION_OFFLINE_KDC          ((HRESULT)0x80090358L)\r\n#endif\r\n#ifndef SEC_E_ISSUING_CA_UNTRUSTED_KDC\r\n# define SEC_E_ISSUING_CA_UNTRUSTED_KDC        ((HRESULT)0x80090359L)\r\n#endif\r\n#ifndef SEC_E_KDC_CERT_EXPIRED\r\n# define SEC_E_KDC_CERT_EXPIRED                ((HRESULT)0x8009035AL)\r\n#endif\r\n#ifndef SEC_E_KDC_CERT_REVOKED\r\n# define SEC_E_KDC_CERT_REVOKED                ((HRESULT)0x8009035BL)\r\n#endif\r\n#ifndef SEC_E_INVALID_PARAMETER\r\n# define SEC_E_INVALID_PARAMETER               ((HRESULT)0x8009035DL)\r\n#endif\r\n#ifndef SEC_E_DELEGATION_POLICY\r\n# define SEC_E_DELEGATION_POLICY               ((HRESULT)0x8009035EL)\r\n#endif\r\n#ifndef SEC_E_POLICY_NLTM_ONLY\r\n# define SEC_E_POLICY_NLTM_ONLY                ((HRESULT)0x8009035FL)\r\n#endif\r\n\r\n#ifndef SEC_I_CONTINUE_NEEDED\r\n# define SEC_I_CONTINUE_NEEDED                 ((HRESULT)0x00090312L)\r\n#endif\r\n#ifndef SEC_I_COMPLETE_NEEDED\r\n# define SEC_I_COMPLETE_NEEDED                 ((HRESULT)0x00090313L)\r\n#endif\r\n#ifndef SEC_I_COMPLETE_AND_CONTINUE\r\n# define SEC_I_COMPLETE_AND_CONTINUE           ((HRESULT)0x00090314L)\r\n#endif\r\n#ifndef SEC_I_LOCAL_LOGON\r\n# define SEC_I_LOCAL_LOGON                     ((HRESULT)0x00090315L)\r\n#endif\r\n#ifndef SEC_I_CONTEXT_EXPIRED\r\n# define SEC_I_CONTEXT_EXPIRED                 ((HRESULT)0x00090317L)\r\n#endif\r\n#ifndef SEC_I_INCOMPLETE_CREDENTIALS\r\n# define SEC_I_INCOMPLETE_CREDENTIALS          ((HRESULT)0x00090320L)\r\n#endif\r\n#ifndef SEC_I_RENEGOTIATE\r\n# define SEC_I_RENEGOTIATE                     ((HRESULT)0x00090321L)\r\n#endif\r\n#ifndef SEC_I_NO_LSA_CONTEXT\r\n# define SEC_I_NO_LSA_CONTEXT                  ((HRESULT)0x00090323L)\r\n#endif\r\n#ifndef SEC_I_SIGNATURE_NEEDED\r\n# define SEC_I_SIGNATURE_NEEDED                ((HRESULT)0x0009035CL)\r\n#endif\r\n\r\n#endif /* USE_WINDOWS_SSPI */\r\n#endif /* HEADER_CURL_SSPI_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_threads.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_THREADS_POSIX)\r\n#  ifdef HAVE_PTHREAD_H\r\n#    include <pthread.h>\r\n#  endif\r\n#elif defined(USE_THREADS_WIN32)\r\n#  ifdef HAVE_PROCESS_H\r\n#    include <process.h>\r\n#  endif\r\n#endif\r\n\r\n#include \"curl_threads.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#if defined(USE_THREADS_POSIX)\r\n\r\nstruct curl_actual_call {\r\n  unsigned int (*func)(void *);\r\n  void *arg;\r\n};\r\n\r\nstatic void *curl_thread_create_thunk(void *arg)\r\n{\r\n  struct curl_actual_call * ac = arg;\r\n  unsigned int (*func)(void *) = ac->func;\r\n  void *real_arg = ac->arg;\r\n\r\n  free(ac);\r\n\r\n  (*func)(real_arg);\r\n\r\n  return 0;\r\n}\r\n\r\ncurl_thread_t Curl_thread_create(unsigned int (*func) (void*), void *arg)\r\n{\r\n  curl_thread_t t;\r\n  struct curl_actual_call *ac = malloc(sizeof(struct curl_actual_call));\r\n  if(!ac)\r\n    return curl_thread_t_null;\r\n\r\n  ac->func = func;\r\n  ac->arg = arg;\r\n\r\n  if(pthread_create(&t, NULL, curl_thread_create_thunk, ac) != 0) {\r\n    free(ac);\r\n    return curl_thread_t_null;\r\n  }\r\n\r\n  return t;\r\n}\r\n\r\nvoid Curl_thread_destroy(curl_thread_t hnd)\r\n{\r\n  if(hnd != curl_thread_t_null)\r\n    pthread_detach(hnd);\r\n}\r\n\r\nint Curl_thread_join(curl_thread_t *hnd)\r\n{\r\n  int ret = (pthread_join(*hnd, NULL) == 0);\r\n\r\n  *hnd = curl_thread_t_null;\r\n\r\n  return ret;\r\n}\r\n\r\n#elif defined(USE_THREADS_WIN32)\r\n\r\ncurl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*),\r\n                                 void *arg)\r\n{\r\n#ifdef _WIN32_WCE\r\n  return CreateThread(NULL, 0, func, arg, 0, NULL);\r\n#else\r\n  curl_thread_t t;\r\n  t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL);\r\n  if((t == 0) || (t == (curl_thread_t)-1L))\r\n    return curl_thread_t_null;\r\n  return t;\r\n#endif\r\n}\r\n\r\nvoid Curl_thread_destroy(curl_thread_t hnd)\r\n{\r\n  CloseHandle(hnd);\r\n}\r\n\r\nint Curl_thread_join(curl_thread_t *hnd)\r\n{\r\n  int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0);\r\n\r\n  Curl_thread_destroy(*hnd);\r\n\r\n  *hnd = curl_thread_t_null;\r\n\r\n  return ret;\r\n}\r\n\r\n#endif /* USE_THREADS_* */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curl_threads.h",
    "content": "#ifndef HEADER_CURL_THREADS_H\r\n#define HEADER_CURL_THREADS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_THREADS_POSIX)\r\n#  define CURL_STDCALL\r\n#  define curl_mutex_t           pthread_mutex_t\r\n#  define curl_thread_t          pthread_t\r\n#  define curl_thread_t_null     (pthread_t)0\r\n#  define Curl_mutex_init(m)     pthread_mutex_init(m, NULL)\r\n#  define Curl_mutex_acquire(m)  pthread_mutex_lock(m)\r\n#  define Curl_mutex_release(m)  pthread_mutex_unlock(m)\r\n#  define Curl_mutex_destroy(m)  pthread_mutex_destroy(m)\r\n#elif defined(USE_THREADS_WIN32)\r\n#  define CURL_STDCALL           __stdcall\r\n#  define curl_mutex_t           CRITICAL_SECTION\r\n#  define curl_thread_t          HANDLE\r\n#  define curl_thread_t_null     (HANDLE)0\r\n#  define Curl_mutex_init(m)     InitializeCriticalSection(m)\r\n#  define Curl_mutex_acquire(m)  EnterCriticalSection(m)\r\n#  define Curl_mutex_release(m)  LeaveCriticalSection(m)\r\n#  define Curl_mutex_destroy(m)  DeleteCriticalSection(m)\r\n#endif\r\n\r\n#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)\r\n\r\ncurl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*),\r\n                                 void *arg);\r\n\r\nvoid Curl_thread_destroy(curl_thread_t hnd);\r\n\r\nint Curl_thread_join(curl_thread_t *hnd);\r\n\r\n#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */\r\n\r\n#endif /* HEADER_CURL_THREADS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/curlx.h",
    "content": "#ifndef HEADER_CURL_CURLX_H\r\n#define HEADER_CURL_CURLX_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Defines protos and includes all header files that provide the curlx_*\r\n * functions. The curlx_* functions are not part of the libcurl API, but are\r\n * stand-alone functions whose sources can be built and linked by apps if need\r\n * be.\r\n */\r\n\r\n#include <curl/mprintf.h>\r\n/* this is still a public header file that provides the curl_mprintf()\r\n   functions while they still are offered publicly. They will be made library-\r\n   private one day */\r\n\r\n#include \"strequal.h\"\r\n/* \"strequal.h\" provides the strequal protos */\r\n\r\n#include \"strtoofft.h\"\r\n/* \"strtoofft.h\" provides this function: curlx_strtoofft(), returns a\r\n   curl_off_t number from a given string.\r\n*/\r\n\r\n#include \"timeval.h\"\r\n/*\r\n  \"timeval.h\" sets up a 'struct timeval' even for platforms that otherwise\r\n  don't have one and has protos for these functions:\r\n\r\n  curlx_tvnow()\r\n  curlx_tvdiff()\r\n  curlx_tvdiff_secs()\r\n*/\r\n\r\n#include \"nonblock.h\"\r\n/* \"nonblock.h\" provides curlx_nonblock() */\r\n\r\n#include \"warnless.h\"\r\n/* \"warnless.h\" provides functions:\r\n\r\n  curlx_ultous()\r\n  curlx_ultouc()\r\n  curlx_uztosi()\r\n*/\r\n\r\n/* Now setup curlx_ * names for the functions that are to become curlx_ and\r\n   be removed from a future libcurl official API:\r\n   curlx_getenv\r\n   curlx_mprintf (and its variations)\r\n   curlx_strequal\r\n   curlx_strnequal\r\n\r\n*/\r\n\r\n#define curlx_getenv curl_getenv\r\n#define curlx_strequal curl_strequal\r\n#define curlx_strnequal curl_strnequal\r\n#define curlx_raw_equal Curl_raw_equal\r\n#define curlx_mvsnprintf curl_mvsnprintf\r\n#define curlx_msnprintf curl_msnprintf\r\n#define curlx_maprintf curl_maprintf\r\n#define curlx_mvaprintf curl_mvaprintf\r\n#define curlx_msprintf curl_msprintf\r\n#define curlx_mprintf curl_mprintf\r\n#define curlx_mfprintf curl_mfprintf\r\n#define curlx_mvsprintf curl_mvsprintf\r\n#define curlx_mvprintf curl_mvprintf\r\n#define curlx_mvfprintf curl_mvfprintf\r\n\r\n#ifdef ENABLE_CURLX_PRINTF\r\n/* If this define is set, we define all \"standard\" printf() functions to use\r\n   the curlx_* version instead. It makes the source code transparent and\r\n   easier to understand/patch. Undefine them first in case _MPRINTF_REPLACE\r\n   is set. */\r\n# undef printf\r\n# undef fprintf\r\n# undef sprintf\r\n# undef snprintf\r\n# undef vprintf\r\n# undef vfprintf\r\n# undef vsprintf\r\n# undef vsnprintf\r\n# undef aprintf\r\n# undef vaprintf\r\n\r\n# define printf curlx_mprintf\r\n# define fprintf curlx_mfprintf\r\n# define sprintf curlx_msprintf\r\n# define snprintf curlx_msnprintf\r\n# define vprintf curlx_mvprintf\r\n# define vfprintf curlx_mvfprintf\r\n# define vsprintf curlx_mvsprintf\r\n# define vsnprintf curlx_mvsnprintf\r\n# define aprintf curlx_maprintf\r\n# define vaprintf curlx_mvaprintf\r\n#endif /* ENABLE_CURLX_PRINTF */\r\n\r\n#endif /* HEADER_CURL_CURLX_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/cyassl.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all CyaSSL-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n *\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_CYASSL\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"inet_pton.h\"\r\n#include \"cyassl.h\"\r\n#include \"sslgen.h\"\r\n#include \"parsedate.h\"\r\n#include \"connect.h\" /* for the connect timeout */\r\n#include \"select.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n#include <cyassl/ssl.h>\r\n#include <cyassl/error.h>\r\n\r\n\r\nstatic Curl_recv cyassl_recv;\r\nstatic Curl_send cyassl_send;\r\n\r\n\r\nstatic int do_file_type(const char *type)\r\n{\r\n  if(!type || !type[0])\r\n    return SSL_FILETYPE_PEM;\r\n  if(Curl_raw_equal(type, \"PEM\"))\r\n    return SSL_FILETYPE_PEM;\r\n  if(Curl_raw_equal(type, \"DER\"))\r\n    return SSL_FILETYPE_ASN1;\r\n  return -1;\r\n}\r\n\r\n/*\r\n * This function loads all the client/CA certificates and CRLs. Setup the TLS\r\n * layer and do all necessary magic.\r\n */\r\nstatic CURLcode\r\ncyassl_connect_step1(struct connectdata *conn,\r\n                     int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data* conssl = &conn->ssl[sockindex];\r\n  SSL_METHOD* req_method = NULL;\r\n  void* ssl_sessionid = NULL;\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n\r\n  if(conssl->state == ssl_connection_complete)\r\n    return CURLE_OK;\r\n\r\n  /* CyaSSL doesn't support SSLv2 */\r\n  if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) {\r\n    failf(data, \"CyaSSL does not support SSLv2\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  /* check to see if we've been told to use an explicit SSL/TLS version */\r\n  switch(data->set.ssl.version) {\r\n  case CURL_SSLVERSION_DEFAULT:\r\n    /* we try to figure out version */\r\n    req_method = SSLv23_client_method();\r\n    break;\r\n  case CURL_SSLVERSION_TLSv1:\r\n    req_method = TLSv1_client_method();\r\n    break;\r\n  case CURL_SSLVERSION_SSLv3:\r\n    req_method = SSLv3_client_method();\r\n    break;\r\n  default:\r\n    req_method = TLSv1_client_method();\r\n  }\r\n\r\n  if(!req_method) {\r\n    failf(data, \"SSL: couldn't create a method!\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  if(conssl->ctx)\r\n    SSL_CTX_free(conssl->ctx);\r\n  conssl->ctx = SSL_CTX_new(req_method);\r\n\r\n  if(!conssl->ctx) {\r\n    failf(data, \"SSL: couldn't create a context!\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n#ifndef NO_FILESYSTEM\r\n  /* load trusted cacert */\r\n  if(data->set.str[STRING_SSL_CAFILE]) {\r\n    if(!SSL_CTX_load_verify_locations(conssl->ctx,\r\n                                      data->set.str[STRING_SSL_CAFILE],\r\n                                      data->set.str[STRING_SSL_CAPATH])) {\r\n      if(data->set.ssl.verifypeer) {\r\n        /* Fail if we insiste on successfully verifying the server. */\r\n        failf(data,\"error setting certificate verify locations:\\n\"\r\n              \"  CAfile: %s\\n  CApath: %s\",\r\n              data->set.str[STRING_SSL_CAFILE]?\r\n              data->set.str[STRING_SSL_CAFILE]: \"none\",\r\n              data->set.str[STRING_SSL_CAPATH]?\r\n              data->set.str[STRING_SSL_CAPATH] : \"none\");\r\n        return CURLE_SSL_CACERT_BADFILE;\r\n      }\r\n      else {\r\n        /* Just continue with a warning if no strict  certificate\r\n           verification is required. */\r\n        infof(data, \"error setting certificate verify locations,\"\r\n              \" continuing anyway:\\n\");\r\n      }\r\n    }\r\n    else {\r\n      /* Everything is fine. */\r\n      infof(data, \"successfully set certificate verify locations:\\n\");\r\n    }\r\n    infof(data,\r\n          \"  CAfile: %s\\n\"\r\n          \"  CApath: %s\\n\",\r\n          data->set.str[STRING_SSL_CAFILE] ? data->set.str[STRING_SSL_CAFILE]:\r\n          \"none\",\r\n          data->set.str[STRING_SSL_CAPATH] ? data->set.str[STRING_SSL_CAPATH]:\r\n          \"none\");\r\n  }\r\n\r\n  /* Load the client certificate, and private key */\r\n  if(data->set.str[STRING_CERT] && data->set.str[STRING_KEY]) {\r\n    int file_type = do_file_type(data->set.str[STRING_CERT_TYPE]);\r\n\r\n    if(SSL_CTX_use_certificate_file(conssl->ctx, data->set.str[STRING_CERT],\r\n                                     file_type) != 1) {\r\n      failf(data, \"unable to use client certificate (no key or wrong pass\"\r\n            \" phrase?)\");\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n\r\n    file_type = do_file_type(data->set.str[STRING_KEY_TYPE]);\r\n    if(SSL_CTX_use_PrivateKey_file(conssl->ctx, data->set.str[STRING_KEY],\r\n                                    file_type) != 1) {\r\n      failf(data, \"unable to set private key\");\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n#else\r\n  if(CyaSSL_no_filesystem_verify(conssl->ctx)!= SSL_SUCCESS) {\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n#endif /* NO_FILESYSTEM */\r\n\r\n  /* SSL always tries to verify the peer, this only says whether it should\r\n   * fail to connect if the verification fails, or if it should continue\r\n   * anyway. In the latter case the result of the verification is checked with\r\n   * SSL_get_verify_result() below. */\r\n  SSL_CTX_set_verify(conssl->ctx,\r\n                     data->set.ssl.verifypeer?SSL_VERIFY_PEER:SSL_VERIFY_NONE,\r\n                     NULL);\r\n\r\n  /* Let's make an SSL structure */\r\n  if(conssl->handle)\r\n    SSL_free(conssl->handle);\r\n  conssl->handle = SSL_new(conssl->ctx);\r\n  if(!conssl->handle) {\r\n    failf(data, \"SSL: couldn't create a context (handle)!\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Check if there's a cached ID we can/should use here! */\r\n  if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL)) {\r\n    /* we got a session id, use it! */\r\n    if(!SSL_set_session(conssl->handle, ssl_sessionid)) {\r\n      failf(data, \"SSL: SSL_set_session failed: %s\",\r\n            ERR_error_string(SSL_get_error(conssl->handle, 0),NULL));\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n    /* Informational message */\r\n    infof (data, \"SSL re-using session ID\\n\");\r\n  }\r\n\r\n  /* pass the raw socket into the SSL layer */\r\n  if(!SSL_set_fd(conssl->handle, (int)sockfd)) {\r\n    failf(data, \"SSL: SSL_set_fd failed\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  conssl->connecting_state = ssl_connect_2;\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nstatic CURLcode\r\ncyassl_connect_step2(struct connectdata *conn,\r\n                     int sockindex)\r\n{\r\n  int ret = -1;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data* conssl = &conn->ssl[sockindex];\r\n\r\n  infof(data, \"CyaSSL: Connecting to %s:%d\\n\",\r\n        conn->host.name, conn->remote_port);\r\n\r\n  conn->recv[sockindex] = cyassl_recv;\r\n  conn->send[sockindex] = cyassl_send;\r\n\r\n  /* Enable RFC2818 checks */\r\n  if(data->set.ssl.verifyhost) {\r\n    ret = CyaSSL_check_domain_name(conssl->handle, conn->host.name);\r\n    if(ret == SSL_FAILURE)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  ret = SSL_connect(conssl->handle);\r\n  if(ret != 1) {\r\n    char error_buffer[80];\r\n    int  detail = SSL_get_error(conssl->handle, ret);\r\n\r\n    if(SSL_ERROR_WANT_READ == detail) {\r\n      conssl->connecting_state = ssl_connect_2_reading;\r\n      return CURLE_OK;\r\n    }\r\n    else if(SSL_ERROR_WANT_WRITE == detail) {\r\n      conssl->connecting_state = ssl_connect_2_writing;\r\n      return CURLE_OK;\r\n    }\r\n    /* There is no easy way to override only the CN matching.\r\n     * This will enable the override of both mismatching SubjectAltNames\r\n     * as also mismatching CN fields */\r\n    else if(DOMAIN_NAME_MISMATCH == detail) {\r\n#if 1\r\n      failf(data, \"\\tsubject alt name(s) or common name do not match \\\"%s\\\"\\n\",\r\n            conn->host.dispname);\r\n      return CURLE_PEER_FAILED_VERIFICATION;\r\n#else\r\n      /* When the CyaSSL_check_domain_name() is used and you desire to continue\r\n       * on a DOMAIN_NAME_MISMATCH, i.e. 'data->set.ssl.verifyhost == 0',\r\n       * CyaSSL version 2.4.0 will fail with an INCOMPLETE_DATA error. The only\r\n       * way to do this is currently to switch the CyaSSL_check_domain_name()\r\n       * in and out based on the 'data->set.ssl.verifyhost' value. */\r\n      if(data->set.ssl.verifyhost) {\r\n        failf(data,\r\n              \"\\tsubject alt name(s) or common name do not match \\\"%s\\\"\\n\",\r\n              conn->host.dispname);\r\n        return CURLE_PEER_FAILED_VERIFICATION;\r\n      }\r\n      else {\r\n        infof(data,\r\n              \"\\tsubject alt name(s) and/or common name do not match \\\"%s\\\"\\n\",\r\n              conn->host.dispname);\r\n        return CURLE_OK;\r\n      }\r\n#endif\r\n    }\r\n    else {\r\n      failf(data, \"SSL_connect failed with error %d: %s\", detail,\r\n          ERR_error_string(detail, error_buffer));\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n\r\n  conssl->connecting_state = ssl_connect_3;\r\n  infof(data, \"SSL connected\\n\");\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nstatic CURLcode\r\ncyassl_connect_step3(struct connectdata *conn,\r\n                     int sockindex)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n  void *old_ssl_sessionid=NULL;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  int incache;\r\n  SSL_SESSION *our_ssl_sessionid;\r\n\r\n  DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);\r\n\r\n  our_ssl_sessionid = SSL_get_session(connssl->handle);\r\n\r\n  incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL));\r\n  if(incache) {\r\n    if(old_ssl_sessionid != our_ssl_sessionid) {\r\n      infof(data, \"old SSL session ID is stale, removing\\n\");\r\n      Curl_ssl_delsessionid(conn, old_ssl_sessionid);\r\n      incache = FALSE;\r\n    }\r\n  }\r\n  if(!incache) {\r\n    retcode = Curl_ssl_addsessionid(conn, our_ssl_sessionid,\r\n                                    0 /* unknown size */);\r\n    if(retcode) {\r\n      failf(data, \"failed to store ssl session\");\r\n      return retcode;\r\n    }\r\n  }\r\n\r\n  connssl->connecting_state = ssl_connect_done;\r\n\r\n  return retcode;\r\n}\r\n\r\n\r\nstatic ssize_t cyassl_send(struct connectdata *conn,\r\n                           int sockindex,\r\n                           const void *mem,\r\n                           size_t len,\r\n                           CURLcode *curlcode)\r\n{\r\n  char error_buffer[80];\r\n  int  memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len;\r\n  int  rc     = SSL_write(conn->ssl[sockindex].handle, mem, memlen);\r\n\r\n  if(rc < 0) {\r\n    int err = SSL_get_error(conn->ssl[sockindex].handle, rc);\r\n\r\n    switch(err) {\r\n    case SSL_ERROR_WANT_READ:\r\n    case SSL_ERROR_WANT_WRITE:\r\n      /* there's data pending, re-invoke SSL_write() */\r\n      *curlcode = CURLE_AGAIN;\r\n      return -1;\r\n    default:\r\n      failf(conn->data, \"SSL write: %s, errno %d\",\r\n            ERR_error_string(err, error_buffer),\r\n            SOCKERRNO);\r\n      *curlcode = CURLE_SEND_ERROR;\r\n      return -1;\r\n    }\r\n  }\r\n  return rc;\r\n}\r\n\r\nvoid Curl_cyassl_close_all(struct SessionHandle *data)\r\n{\r\n  (void)data;\r\n}\r\n\r\nvoid Curl_cyassl_close(struct connectdata *conn, int sockindex)\r\n{\r\n  struct ssl_connect_data *conssl = &conn->ssl[sockindex];\r\n\r\n  if(conssl->handle) {\r\n    (void)SSL_shutdown(conssl->handle);\r\n    SSL_free (conssl->handle);\r\n    conssl->handle = NULL;\r\n  }\r\n  if(conssl->ctx) {\r\n    SSL_CTX_free (conssl->ctx);\r\n    conssl->ctx = NULL;\r\n  }\r\n}\r\n\r\nstatic ssize_t cyassl_recv(struct connectdata *conn,\r\n                           int num,\r\n                           char *buf,\r\n                           size_t buffersize,\r\n                           CURLcode *curlcode)\r\n{\r\n  char error_buffer[80];\r\n  int  buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;\r\n  int  nread    = SSL_read(conn->ssl[num].handle, buf, buffsize);\r\n\r\n  if(nread < 0) {\r\n    int err = SSL_get_error(conn->ssl[num].handle, nread);\r\n\r\n    switch(err) {\r\n    case SSL_ERROR_ZERO_RETURN: /* no more data */\r\n      break;\r\n    case SSL_ERROR_WANT_READ:\r\n    case SSL_ERROR_WANT_WRITE:\r\n      /* there's data pending, re-invoke SSL_read() */\r\n      *curlcode = CURLE_AGAIN;\r\n      return -1;\r\n    default:\r\n      failf(conn->data, \"SSL read: %s, errno %d\",\r\n            ERR_error_string(err, error_buffer),\r\n            SOCKERRNO);\r\n      *curlcode = CURLE_RECV_ERROR;\r\n      return -1;\r\n    }\r\n  }\r\n  return nread;\r\n}\r\n\r\n\r\nvoid Curl_cyassl_session_free(void *ptr)\r\n{\r\n  (void)ptr;\r\n  /* CyaSSL reuses sessions on own, no free */\r\n}\r\n\r\n\r\nsize_t Curl_cyassl_version(char *buffer, size_t size)\r\n{\r\n#ifdef CYASSL_VERSION\r\n  return snprintf(buffer, size, \"CyaSSL/%s\", CYASSL_VERSION);\r\n#else\r\n  return snprintf(buffer, size, \"CyaSSL/%s\", \"<1.8.8\");\r\n#endif\r\n}\r\n\r\n\r\nint Curl_cyassl_init(void)\r\n{\r\n  if(CyaSSL_Init() == 0)\r\n    return 1;\r\n\r\n  return -1;\r\n}\r\n\r\n\r\nbool Curl_cyassl_data_pending(const struct connectdata* conn, int connindex)\r\n{\r\n  if(conn->ssl[connindex].handle)   /* SSL is in use */\r\n    return (0 != SSL_pending(conn->ssl[connindex].handle)) ? TRUE : FALSE;\r\n  else\r\n    return FALSE;\r\n}\r\n\r\n\r\n/*\r\n * This function is called to shut down the SSL layer but keep the\r\n * socket open (CCC - Clear Command Channel)\r\n */\r\nint Curl_cyassl_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  int retval = 0;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  if(connssl->handle) {\r\n    SSL_free (connssl->handle);\r\n    connssl->handle = NULL;\r\n  }\r\n  return retval;\r\n}\r\n\r\n\r\nstatic CURLcode\r\ncyassl_connect_common(struct connectdata *conn,\r\n                      int sockindex,\r\n                      bool nonblocking,\r\n                      bool *done)\r\n{\r\n  CURLcode retcode;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long timeout_ms;\r\n  int what;\r\n\r\n  /* check if the connection has already been established */\r\n  if(ssl_connection_complete == connssl->state) {\r\n    *done = TRUE;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(ssl_connect_1==connssl->connecting_state) {\r\n    /* Find out how much more time we're allowed */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n    retcode = cyassl_connect_step1(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  while(ssl_connect_2 == connssl->connecting_state ||\r\n        ssl_connect_2_reading == connssl->connecting_state ||\r\n        ssl_connect_2_writing == connssl->connecting_state) {\r\n\r\n    /* check allowed time left */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    /* if ssl is expecting something, check if it's available. */\r\n    if(connssl->connecting_state == ssl_connect_2_reading\r\n       || connssl->connecting_state == ssl_connect_2_writing) {\r\n\r\n      curl_socket_t writefd = ssl_connect_2_writing==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n      curl_socket_t readfd = ssl_connect_2_reading==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n\r\n      what = Curl_socket_ready(readfd, writefd, nonblocking?0:timeout_ms);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n      else if(0 == what) {\r\n        if(nonblocking) {\r\n          *done = FALSE;\r\n          return CURLE_OK;\r\n        }\r\n        else {\r\n          /* timeout */\r\n          failf(data, \"SSL connection timeout\");\r\n          return CURLE_OPERATION_TIMEDOUT;\r\n        }\r\n      }\r\n      /* socket is readable or writable */\r\n    }\r\n\r\n    /* Run transaction, and return to the caller if it failed or if\r\n     * this connection is part of a multi handle and this loop would\r\n     * execute again. This permits the owner of a multi handle to\r\n     * abort a connection attempt before step2 has completed while\r\n     * ensuring that a client using select() or epoll() will always\r\n     * have a valid fdset to wait on.\r\n     */\r\n    retcode = cyassl_connect_step2(conn, sockindex);\r\n    if(retcode || (nonblocking &&\r\n                   (ssl_connect_2 == connssl->connecting_state ||\r\n                    ssl_connect_2_reading == connssl->connecting_state ||\r\n                    ssl_connect_2_writing == connssl->connecting_state)))\r\n      return retcode;\r\n\r\n  } /* repeat step2 until all transactions are done. */\r\n\r\n  if(ssl_connect_3==connssl->connecting_state) {\r\n    retcode = cyassl_connect_step3(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  if(ssl_connect_done==connssl->connecting_state) {\r\n    connssl->state = ssl_connection_complete;\r\n    conn->recv[sockindex] = cyassl_recv;\r\n    conn->send[sockindex] = cyassl_send;\r\n    *done = TRUE;\r\n  }\r\n  else\r\n    *done = FALSE;\r\n\r\n  /* Reset our connect state machine */\r\n  connssl->connecting_state = ssl_connect_1;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nCURLcode\r\nCurl_cyassl_connect_nonblocking(struct connectdata *conn,\r\n                                int sockindex,\r\n                                bool *done)\r\n{\r\n  return cyassl_connect_common(conn, sockindex, TRUE, done);\r\n}\r\n\r\n\r\nCURLcode\r\nCurl_cyassl_connect(struct connectdata *conn,\r\n                    int sockindex)\r\n{\r\n  CURLcode retcode;\r\n  bool done = FALSE;\r\n\r\n  retcode = cyassl_connect_common(conn, sockindex, FALSE, &done);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  DEBUGASSERT(done);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/cyassl.h",
    "content": "#ifndef HEADER_CURL_CYASSL_H\r\n#define HEADER_CURL_CYASSL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_CYASSL\r\n\r\nCURLcode Curl_cyassl_connect(struct connectdata *conn, int sockindex);\r\nbool Curl_cyassl_data_pending(const struct connectdata* conn,int connindex);\r\nint Curl_cyassl_shutdown(struct connectdata* conn, int sockindex);\r\n\r\n/* tell CyaSSL to close down all open information regarding connections (and\r\n   thus session ID caching etc) */\r\nvoid Curl_cyassl_close_all(struct SessionHandle *data);\r\n\r\n /* close a SSL connection */\r\nvoid Curl_cyassl_close(struct connectdata *conn, int sockindex);\r\n\r\nvoid Curl_cyassl_session_free(void *ptr);\r\nsize_t Curl_cyassl_version(char *buffer, size_t size);\r\nint Curl_cyassl_shutdown(struct connectdata *conn, int sockindex);\r\nint Curl_cyassl_init(void);\r\nCURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,\r\n                                         int sockindex,\r\n                                         bool *done);\r\n\r\n/* API setup for CyaSSL */\r\n#define curlssl_init Curl_cyassl_init\r\n#define curlssl_cleanup() Curl_nop_stmt\r\n#define curlssl_connect Curl_cyassl_connect\r\n#define curlssl_connect_nonblocking Curl_cyassl_connect_nonblocking\r\n#define curlssl_session_free(x)  Curl_cyassl_session_free(x)\r\n#define curlssl_close_all Curl_cyassl_close_all\r\n#define curlssl_close Curl_cyassl_close\r\n#define curlssl_shutdown(x,y) Curl_cyassl_shutdown(x,y)\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_cyassl_version\r\n#define curlssl_check_cxn(x) (x=x, -1)\r\n#define curlssl_data_pending(x,y) Curl_cyassl_data_pending(x,y)\r\n\r\n#endif /* USE_CYASSL */\r\n#endif /* HEADER_CURL_CYASSL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/dict.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_DICT\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_SELECT_H\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n\r\n#include \"progress.h\"\r\n#include \"strequal.h\"\r\n#include \"dict.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Forward declarations.\r\n */\r\n\r\nstatic CURLcode dict_do(struct connectdata *conn, bool *done);\r\n\r\n/*\r\n * DICT protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_dict = {\r\n  \"DICT\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  dict_do,                              /* do_it */\r\n  ZERO_NULL,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_DICT,                            /* defport */\r\n  CURLPROTO_DICT,                       /* protocol */\r\n  PROTOPT_NONE | PROTOPT_NOURLQUERY      /* flags */\r\n};\r\n\r\nstatic char *unescape_word(struct SessionHandle *data, const char *inputbuff)\r\n{\r\n  char *newp;\r\n  char *dictp;\r\n  char *ptr;\r\n  int len;\r\n  char byte;\r\n  int olen=0;\r\n\r\n  newp = curl_easy_unescape(data, inputbuff, 0, &len);\r\n  if(!newp)\r\n    return NULL;\r\n\r\n  dictp = malloc(((size_t)len)*2 + 1); /* add one for terminating zero */\r\n  if(dictp) {\r\n    /* According to RFC2229 section 2.2, these letters need to be escaped with\r\n       \\[letter] */\r\n    for(ptr = newp;\r\n        (byte = *ptr) != 0;\r\n        ptr++) {\r\n      if((byte <= 32) || (byte == 127) ||\r\n          (byte == '\\'') || (byte == '\\\"') || (byte == '\\\\')) {\r\n        dictp[olen++] = '\\\\';\r\n      }\r\n      dictp[olen++] = byte;\r\n    }\r\n    dictp[olen]=0;\r\n\r\n    free(newp);\r\n  }\r\n  return dictp;\r\n}\r\n\r\nstatic CURLcode dict_do(struct connectdata *conn, bool *done)\r\n{\r\n  char *word;\r\n  char *eword;\r\n  char *ppath;\r\n  char *database = NULL;\r\n  char *strategy = NULL;\r\n  char *nthdef = NULL; /* This is not part of the protocol, but required\r\n                          by RFC 2229 */\r\n  CURLcode result=CURLE_OK;\r\n  struct SessionHandle *data=conn->data;\r\n  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];\r\n\r\n  char *path = data->state.path;\r\n  curl_off_t *bytecount = &data->req.bytecount;\r\n\r\n  *done = TRUE; /* unconditionally */\r\n\r\n  if(conn->bits.user_passwd) {\r\n    /* AUTH is missing */\r\n  }\r\n\r\n  if(Curl_raw_nequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||\r\n      Curl_raw_nequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||\r\n      Curl_raw_nequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {\r\n\r\n    word = strchr(path, ':');\r\n    if(word) {\r\n      word++;\r\n      database = strchr(word, ':');\r\n      if(database) {\r\n        *database++ = (char)0;\r\n        strategy = strchr(database, ':');\r\n        if(strategy) {\r\n          *strategy++ = (char)0;\r\n          nthdef = strchr(strategy, ':');\r\n          if(nthdef) {\r\n            *nthdef = (char)0;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    if((word == NULL) || (*word == (char)0)) {\r\n      infof(data, \"lookup word is missing\\n\");\r\n      word=(char *)\"default\";\r\n    }\r\n    if((database == NULL) || (*database == (char)0)) {\r\n      database = (char *)\"!\";\r\n    }\r\n    if((strategy == NULL) || (*strategy == (char)0)) {\r\n      strategy = (char *)\".\";\r\n    }\r\n\r\n    eword = unescape_word(data, word);\r\n    if(!eword)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    result = Curl_sendf(sockfd, conn,\r\n                        \"CLIENT \" LIBCURL_NAME \" \" LIBCURL_VERSION \"\\r\\n\"\r\n                        \"MATCH \"\r\n                        \"%s \"    /* database */\r\n                        \"%s \"    /* strategy */\r\n                        \"%s\\r\\n\" /* word */\r\n                        \"QUIT\\r\\n\",\r\n\r\n                        database,\r\n                        strategy,\r\n                        eword\r\n                        );\r\n\r\n    free(eword);\r\n\r\n    if(result) {\r\n      failf(data, \"Failed sending DICT request\");\r\n      return result;\r\n    }\r\n    Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,\r\n                        -1, NULL); /* no upload */\r\n  }\r\n  else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||\r\n           Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||\r\n           Curl_raw_nequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {\r\n\r\n    word = strchr(path, ':');\r\n    if(word) {\r\n      word++;\r\n      database = strchr(word, ':');\r\n      if(database) {\r\n        *database++ = (char)0;\r\n        nthdef = strchr(database, ':');\r\n        if(nthdef) {\r\n          *nthdef = (char)0;\r\n        }\r\n      }\r\n    }\r\n\r\n    if((word == NULL) || (*word == (char)0)) {\r\n      infof(data, \"lookup word is missing\\n\");\r\n      word=(char *)\"default\";\r\n    }\r\n    if((database == NULL) || (*database == (char)0)) {\r\n      database = (char *)\"!\";\r\n    }\r\n\r\n    eword = unescape_word(data, word);\r\n    if(!eword)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    result = Curl_sendf(sockfd, conn,\r\n                        \"CLIENT \" LIBCURL_NAME \" \" LIBCURL_VERSION \"\\r\\n\"\r\n                        \"DEFINE \"\r\n                        \"%s \"     /* database */\r\n                        \"%s\\r\\n\"  /* word */\r\n                        \"QUIT\\r\\n\",\r\n                        database,\r\n                        eword);\r\n\r\n    free(eword);\r\n\r\n    if(result) {\r\n      failf(data, \"Failed sending DICT request\");\r\n      return result;\r\n    }\r\n    Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,\r\n                        -1, NULL); /* no upload */\r\n  }\r\n  else {\r\n\r\n    ppath = strchr(path, '/');\r\n    if(ppath) {\r\n      int i;\r\n\r\n      ppath++;\r\n      for(i = 0; ppath[i]; i++) {\r\n        if(ppath[i] == ':')\r\n          ppath[i] = ' ';\r\n      }\r\n      result = Curl_sendf(sockfd, conn,\r\n                          \"CLIENT \" LIBCURL_NAME \" \" LIBCURL_VERSION \"\\r\\n\"\r\n                          \"%s\\r\\n\"\r\n                          \"QUIT\\r\\n\", ppath);\r\n      if(result) {\r\n        failf(data, \"Failed sending DICT request\");\r\n        return result;\r\n      }\r\n\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL);\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n#endif /*CURL_DISABLE_DICT*/\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/dict.h",
    "content": "#ifndef HEADER_CURL_DICT_H\r\n#define HEADER_CURL_DICT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifndef CURL_DISABLE_DICT\r\nextern const struct Curl_handler Curl_handler_dict;\r\n#endif\r\n\r\n#endif /* HEADER_CURL_DICT_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/easy.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4127 : conditional expression is constant\r\n// C4701 : Potentially uninitialized local variable 'name' used\r\n#pragma warning( disable : 4127 )\r\n#pragma warning( disable : 4701 )\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#include \"strequal.h\"\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sslgen.h\"\r\n#include \"url.h\"\r\n#include \"getinfo.h\"\r\n#include \"hostip.h\"\r\n#include \"share_curl.h\"\r\n#include \"strdup.h\"\r\n#include \"curl_memory.h\"\r\n#include \"progress.h\"\r\n#include \"easyif.h\"\r\n#include \"select.h\"\r\n#include \"sendf.h\" /* for failf function prototype */\r\n#include \"curl_ntlm.h\"\r\n#include \"connect.h\" /* for Curl_getconnectinfo */\r\n#include \"slist.h\"\r\n#include \"amigaos.h\"\r\n#include \"curl_rand.h\"\r\n#include \"non-ascii.h\"\r\n#include \"warnless.h\"\r\n#include \"conncache.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* win32_cleanup() is for win32 socket cleanup functionality, the opposite\r\n   of win32_init() */\r\nstatic void win32_cleanup(void)\r\n{\r\n#ifdef USE_WINSOCK\r\n  WSACleanup();\r\n#endif\r\n#ifdef USE_WINDOWS_SSPI\r\n  Curl_sspi_global_cleanup();\r\n#endif\r\n}\r\n\r\n/* win32_init() performs win32 socket initialization to properly setup the\r\n   stack to allow networking */\r\nstatic CURLcode win32_init(void)\r\n{\r\n#ifdef USE_WINSOCK\r\n  WORD wVersionRequested;\r\n  WSADATA wsaData;\r\n  int res;\r\n\r\n#if defined(ENABLE_IPV6) && (USE_WINSOCK < 2)\r\n  Error IPV6_requires_winsock2\r\n#endif\r\n\r\n  wVersionRequested = MAKEWORD(USE_WINSOCK, USE_WINSOCK);\r\n\r\n  res = WSAStartup(wVersionRequested, &wsaData);\r\n\r\n  if(res != 0)\r\n    /* Tell the user that we couldn't find a useable */\r\n    /* winsock.dll.     */\r\n    return CURLE_FAILED_INIT;\r\n\r\n  /* Confirm that the Windows Sockets DLL supports what we need.*/\r\n  /* Note that if the DLL supports versions greater */\r\n  /* than wVersionRequested, it will still return */\r\n  /* wVersionRequested in wVersion. wHighVersion contains the */\r\n  /* highest supported version. */\r\n\r\n  if(LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||\r\n     HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {\r\n    /* Tell the user that we couldn't find a useable */\r\n\r\n    /* winsock.dll. */\r\n    WSACleanup();\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n  /* The Windows Sockets DLL is acceptable. Proceed. */\r\n#elif defined(USE_LWIPSOCK)\r\n  lwip_init();\r\n#endif\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n  {\r\n    CURLcode err = Curl_sspi_global_init();\r\n    if(err != CURLE_OK)\r\n      return err;\r\n  }\r\n#endif\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifdef USE_LIBIDN\r\n/*\r\n * Initialise use of IDNA library.\r\n * It falls back to ASCII if $CHARSET isn't defined. This doesn't work for\r\n * idna_to_ascii_lz().\r\n */\r\nstatic void idna_init (void)\r\n{\r\n#ifdef WIN32\r\n  char buf[60];\r\n  UINT cp = GetACP();\r\n\r\n  if(!getenv(\"CHARSET\") && cp > 0) {\r\n    snprintf(buf, sizeof(buf), \"CHARSET=cp%u\", cp);\r\n    putenv(buf);\r\n  }\r\n#else\r\n  /* to do? */\r\n#endif\r\n}\r\n#endif  /* USE_LIBIDN */\r\n\r\n/* true globals -- for curl_global_init() and curl_global_cleanup() */\r\nstatic unsigned int  initialized;\r\nstatic long          init_flags;\r\n\r\n/*\r\n * strdup (and other memory functions) is redefined in complicated\r\n * ways, but at this point it must be defined as the system-supplied strdup\r\n * so the callback pointer is initialized correctly.\r\n */\r\n#if defined(_WIN32_WCE)\r\n#define system_strdup _strdup\r\n#elif !defined(HAVE_STRDUP)\r\n#define system_strdup curlx_strdup\r\n#else\r\n#define system_strdup strdup\r\n#endif\r\n\r\n#if defined(_MSC_VER) && defined(_DLL) && !defined(__POCC__)\r\n#  pragma warning(disable:4232) /* MSVC extension, dllimport identity */\r\n#endif\r\n\r\n#ifndef __SYMBIAN32__\r\n/*\r\n * If a memory-using function (like curl_getenv) is used before\r\n * curl_global_init() is called, we need to have these pointers set already.\r\n */\r\ncurl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc;\r\ncurl_free_callback Curl_cfree = (curl_free_callback)free;\r\ncurl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;\r\ncurl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup;\r\ncurl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;\r\n#else\r\n/*\r\n * Symbian OS doesn't support initialization to code in writeable static data.\r\n * Initialization will occur in the curl_global_init() call.\r\n */\r\ncurl_malloc_callback Curl_cmalloc;\r\ncurl_free_callback Curl_cfree;\r\ncurl_realloc_callback Curl_crealloc;\r\ncurl_strdup_callback Curl_cstrdup;\r\ncurl_calloc_callback Curl_ccalloc;\r\n#endif\r\n\r\n#if defined(_MSC_VER) && defined(_DLL) && !defined(__POCC__)\r\n#  pragma warning(default:4232) /* MSVC extension, dllimport identity */\r\n#endif\r\n\r\n/**\r\n * curl_global_init() globally initializes cURL given a bitwise set of the\r\n * different features of what to initialize.\r\n */\r\nCURLcode curl_global_init(long flags)\r\n{\r\n  if(initialized++)\r\n    return CURLE_OK;\r\n\r\n  /* Setup the default memory functions here (again) */\r\n  Curl_cmalloc = (curl_malloc_callback)malloc;\r\n  Curl_cfree = (curl_free_callback)free;\r\n  Curl_crealloc = (curl_realloc_callback)realloc;\r\n  Curl_cstrdup = (curl_strdup_callback)system_strdup;\r\n  Curl_ccalloc = (curl_calloc_callback)calloc;\r\n\r\n  if(flags & CURL_GLOBAL_SSL)\r\n    if(!Curl_ssl_init()) {\r\n      DEBUGF(fprintf(stderr, \"Error: Curl_ssl_init failed\\n\"));\r\n      return CURLE_FAILED_INIT;\r\n    }\r\n\r\n  if(flags & CURL_GLOBAL_WIN32)\r\n    if(win32_init() != CURLE_OK) {\r\n      DEBUGF(fprintf(stderr, \"Error: win32_init failed\\n\"));\r\n      return CURLE_FAILED_INIT;\r\n    }\r\n\r\n#ifdef __AMIGA__\r\n  if(!Curl_amiga_init()) {\r\n    DEBUGF(fprintf(stderr, \"Error: Curl_amiga_init failed\\n\"));\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n#endif\r\n\r\n#ifdef NETWARE\r\n  if(netware_init()) {\r\n    DEBUGF(fprintf(stderr, \"Warning: LONG namespace not available\\n\"));\r\n  }\r\n#endif\r\n\r\n#ifdef USE_LIBIDN\r\n  idna_init();\r\n#endif\r\n\r\n  if(Curl_resolver_global_init() != CURLE_OK) {\r\n    DEBUGF(fprintf(stderr, \"Error: resolver_global_init failed\\n\"));\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT)\r\n  if(libssh2_init(0)) {\r\n    DEBUGF(fprintf(stderr, \"Error: libssh2_init failed\\n\"));\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n#endif\r\n\r\n  init_flags  = flags;\r\n\r\n  /* Preset pseudo-random number sequence. */\r\n\r\n  Curl_srand();\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * curl_global_init_mem() globally initializes cURL and also registers the\r\n * user provided callback routines.\r\n */\r\nCURLcode curl_global_init_mem(long flags, curl_malloc_callback m,\r\n                              curl_free_callback f, curl_realloc_callback r,\r\n                              curl_strdup_callback s, curl_calloc_callback c)\r\n{\r\n  CURLcode code = CURLE_OK;\r\n\r\n  /* Invalid input, return immediately */\r\n  if(!m || !f || !r || !s || !c)\r\n    return CURLE_FAILED_INIT;\r\n\r\n  /* Already initialized, don't do it again */\r\n  if(initialized)\r\n    return CURLE_OK;\r\n\r\n  /* Call the actual init function first */\r\n  code = curl_global_init(flags);\r\n  if(code == CURLE_OK) {\r\n    Curl_cmalloc = m;\r\n    Curl_cfree = f;\r\n    Curl_cstrdup = s;\r\n    Curl_crealloc = r;\r\n    Curl_ccalloc = c;\r\n  }\r\n\r\n  return code;\r\n}\r\n\r\n/**\r\n * curl_global_cleanup() globally cleanups cURL, uses the value of\r\n * \"init_flags\" to determine what needs to be cleaned up and what doesn't.\r\n */\r\nvoid curl_global_cleanup(void)\r\n{\r\n  if(!initialized)\r\n    return;\r\n\r\n  if(--initialized)\r\n    return;\r\n\r\n  Curl_global_host_cache_dtor();\r\n\r\n  if(init_flags & CURL_GLOBAL_SSL)\r\n    Curl_ssl_cleanup();\r\n\r\n  Curl_resolver_global_cleanup();\r\n\r\n  if(init_flags & CURL_GLOBAL_WIN32)\r\n    win32_cleanup();\r\n\r\n  Curl_amiga_cleanup();\r\n\r\n#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_EXIT)\r\n  (void)libssh2_exit();\r\n#endif\r\n\r\n  init_flags  = 0;\r\n}\r\n\r\n/*\r\n * curl_easy_init() is the external interface to alloc, setup and init an\r\n * easy handle that is returned. If anything goes wrong, NULL is returned.\r\n */\r\nCURL *curl_easy_init(void)\r\n{\r\n  CURLcode res;\r\n  struct SessionHandle *data;\r\n\r\n  /* Make sure we inited the global SSL stuff */\r\n  if(!initialized) {\r\n    res = curl_global_init(CURL_GLOBAL_DEFAULT);\r\n    if(res) {\r\n      /* something in the global init failed, return nothing */\r\n      DEBUGF(fprintf(stderr, \"Error: curl_global_init failed\\n\"));\r\n      return NULL;\r\n    }\r\n  }\r\n\r\n  /* We use curl_open() with undefined URL so far */\r\n  res = Curl_open(&data);\r\n  if(res != CURLE_OK) {\r\n    DEBUGF(fprintf(stderr, \"Error: Curl_open failed\\n\"));\r\n    return NULL;\r\n  }\r\n\r\n  return data;\r\n}\r\n\r\n/*\r\n * curl_easy_setopt() is the external interface for setting options on an\r\n * easy handle.\r\n */\r\n\r\n#undef curl_easy_setopt\r\nCURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)\r\n{\r\n  va_list arg;\r\n  struct SessionHandle *data = curl;\r\n  CURLcode ret;\r\n\r\n  if(!curl)\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n\r\n  va_start(arg, tag);\r\n\r\n  ret = Curl_setopt(data, tag, arg);\r\n\r\n  va_end(arg);\r\n  return ret;\r\n}\r\n\r\n/*\r\n * curl_easy_perform() is the external interface that performs a blocking\r\n * transfer as previously setup.\r\n *\r\n * CONCEPT: This function creates a multi handle, adds the easy handle to it,\r\n * runs curl_multi_perform() until the transfer is done, then detaches the\r\n * easy handle, destroys the multi handle and returns the easy handle's return\r\n * code.\r\n *\r\n * REALITY: it can't just create and destroy the multi handle that easily. It\r\n * needs to keep it around since if this easy handle is used again by this\r\n * function, the same multi handle must be re-used so that the same pools and\r\n * caches can be used.\r\n */\r\nCURLcode curl_easy_perform(CURL *easy)\r\n{\r\n  CURLM *multi;\r\n  CURLMcode mcode;\r\n  CURLcode code = CURLE_OK;\r\n  CURLMsg *msg;\r\n  bool done = FALSE;\r\n  int rc;\r\n  struct SessionHandle *data = easy;\r\n\r\n  if(!easy)\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n\r\n  if(data->multi) {\r\n    failf(data, \"easy handled already used in multi handle\");\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  if(data->multi_easy)\r\n    multi = data->multi_easy;\r\n  else {\r\n    multi = curl_multi_init();\r\n    if(!multi)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    data->multi_easy = multi;\r\n  }\r\n\r\n  mcode = curl_multi_add_handle(multi, easy);\r\n  if(mcode) {\r\n    curl_multi_cleanup(multi);\r\n    if(mcode == CURLM_OUT_OF_MEMORY)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    else\r\n      return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* assign this after curl_multi_add_handle() since that function checks for\r\n     it and rejects this handle otherwise */\r\n  data->multi = multi;\r\n\r\n  while(!done && !mcode) {\r\n    int still_running;\r\n\r\n    mcode = curl_multi_wait(multi, NULL, 0, 1000, NULL);\r\n\r\n    if(mcode == CURLM_OK)\r\n      mcode = curl_multi_perform(multi, &still_running);\r\n\r\n    /* only read 'still_running' if curl_multi_perform() return OK */\r\n    if((mcode == CURLM_OK) && !still_running) {\r\n      msg = curl_multi_info_read(multi, &rc);\r\n      if(msg) {\r\n        code = msg->data.result;\r\n        done = TRUE;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* ignoring the return code isn't nice, but atm we can't really handle\r\n     a failure here, room for future improvement! */\r\n  (void)curl_multi_remove_handle(multi, easy);\r\n\r\n  /* The multi handle is kept alive, owned by the easy handle */\r\n  return code;\r\n}\r\n\r\n/*\r\n * curl_easy_cleanup() is the external interface to cleaning/freeing the given\r\n * easy handle.\r\n */\r\nvoid curl_easy_cleanup(CURL *curl)\r\n{\r\n  struct SessionHandle *data = (struct SessionHandle *)curl;\r\n\r\n  if(!data)\r\n    return;\r\n\r\n  Curl_close(data);\r\n}\r\n\r\n/*\r\n * Store a pointed to the multi handle within the easy handle's data struct.\r\n */\r\nvoid Curl_easy_addmulti(struct SessionHandle *data,\r\n                        void *multi)\r\n{\r\n  data->multi = multi;\r\n}\r\n\r\nvoid Curl_easy_initHandleData(struct SessionHandle *data)\r\n{\r\n    memset(&data->req, 0, sizeof(struct SingleRequest));\r\n\r\n    data->req.maxdownload = -1;\r\n}\r\n\r\n/*\r\n * curl_easy_getinfo() is an external interface that allows an app to retrieve\r\n * information from a performed transfer and similar.\r\n */\r\n#undef curl_easy_getinfo\r\nCURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)\r\n{\r\n  va_list arg;\r\n  void *paramp;\r\n  struct SessionHandle *data = (struct SessionHandle *)curl;\r\n\r\n  va_start(arg, info);\r\n  paramp = va_arg(arg, void *);\r\n\r\n  return Curl_getinfo(data, info, paramp);\r\n}\r\n\r\n/*\r\n * curl_easy_duphandle() is an external interface to allow duplication of a\r\n * given input easy handle. The returned handle will be a new working handle\r\n * with all options set exactly as the input source handle.\r\n */\r\nCURL *curl_easy_duphandle(CURL *incurl)\r\n{\r\n  struct SessionHandle *data=(struct SessionHandle *)incurl;\r\n\r\n  struct SessionHandle *outcurl = calloc(1, sizeof(struct SessionHandle));\r\n  if(NULL == outcurl)\r\n    goto fail;\r\n\r\n  /*\r\n   * We setup a few buffers we need. We should probably make them\r\n   * get setup on-demand in the code, as that would probably decrease\r\n   * the likeliness of us forgetting to init a buffer here in the future.\r\n   */\r\n  outcurl->state.headerbuff = malloc(HEADERSIZE);\r\n  if(!outcurl->state.headerbuff)\r\n    goto fail;\r\n  outcurl->state.headersize = HEADERSIZE;\r\n\r\n  /* copy all userdefined values */\r\n  if(Curl_dupset(outcurl, data) != CURLE_OK)\r\n    goto fail;\r\n\r\n  /* the connection cache is setup on demand */\r\n  outcurl->state.conn_cache = NULL;\r\n\r\n  outcurl->state.lastconnect = NULL;\r\n\r\n  outcurl->progress.flags    = data->progress.flags;\r\n  outcurl->progress.callback = data->progress.callback;\r\n\r\n  if(data->cookies) {\r\n    /* If cookies are enabled in the parent handle, we enable them\r\n       in the clone as well! */\r\n    outcurl->cookies = Curl_cookie_init(data,\r\n                                        data->cookies->filename,\r\n                                        outcurl->cookies,\r\n                                        data->set.cookiesession);\r\n    if(!outcurl->cookies)\r\n      goto fail;\r\n  }\r\n\r\n  /* duplicate all values in 'change' */\r\n  if(data->change.cookielist) {\r\n    outcurl->change.cookielist =\r\n      Curl_slist_duplicate(data->change.cookielist);\r\n    if(!outcurl->change.cookielist)\r\n      goto fail;\r\n  }\r\n\r\n  if(data->change.url) {\r\n    outcurl->change.url = strdup(data->change.url);\r\n    if(!outcurl->change.url)\r\n      goto fail;\r\n    outcurl->change.url_alloc = TRUE;\r\n  }\r\n\r\n  if(data->change.referer) {\r\n    outcurl->change.referer = strdup(data->change.referer);\r\n    if(!outcurl->change.referer)\r\n      goto fail;\r\n    outcurl->change.referer_alloc = TRUE;\r\n  }\r\n\r\n  /* Clone the resolver handle, if present, for the new handle */\r\n  if(Curl_resolver_duphandle(&outcurl->state.resolver,\r\n                             data->state.resolver) != CURLE_OK)\r\n    goto fail;\r\n\r\n  Curl_convert_setup(outcurl);\r\n\r\n  Curl_easy_initHandleData(outcurl);\r\n\r\n  outcurl->magic = CURLEASY_MAGIC_NUMBER;\r\n\r\n  /* we reach this point and thus we are OK */\r\n\r\n  return outcurl;\r\n\r\n  fail:\r\n\r\n  if(outcurl) {\r\n    curl_slist_free_all(outcurl->change.cookielist);\r\n    outcurl->change.cookielist = NULL;\r\n    Curl_safefree(outcurl->state.headerbuff);\r\n    Curl_safefree(outcurl->change.url);\r\n    Curl_safefree(outcurl->change.referer);\r\n    Curl_freeset(outcurl);\r\n    free(outcurl);\r\n  }\r\n\r\n  return NULL;\r\n}\r\n\r\n/*\r\n * curl_easy_reset() is an external interface that allows an app to re-\r\n * initialize a session handle to the default values.\r\n */\r\nvoid curl_easy_reset(CURL *curl)\r\n{\r\n  struct SessionHandle *data = (struct SessionHandle *)curl;\r\n\r\n  Curl_safefree(data->state.pathbuffer);\r\n\r\n  data->state.path = NULL;\r\n\r\n  Curl_safefree(data->state.proto.generic);\r\n\r\n  /* zero out UserDefined data: */\r\n  Curl_freeset(data);\r\n  memset(&data->set, 0, sizeof(struct UserDefined));\r\n  (void)Curl_init_userdefined(&data->set);\r\n\r\n  /* zero out Progress data: */\r\n  memset(&data->progress, 0, sizeof(struct Progress));\r\n\r\n  /* init Handle data */\r\n  Curl_easy_initHandleData(data);\r\n\r\n  data->progress.flags |= PGRS_HIDE;\r\n  data->state.current_speed = -1; /* init to negative == impossible */\r\n}\r\n\r\n/*\r\n * curl_easy_pause() allows an application to pause or unpause a specific\r\n * transfer and direction. This function sets the full new state for the\r\n * current connection this easy handle operates on.\r\n *\r\n * NOTE: if you have the receiving paused and you call this function to remove\r\n * the pausing, you may get your write callback called at this point.\r\n *\r\n * Action is a bitmask consisting of CURLPAUSE_* bits in curl/curl.h\r\n */\r\nCURLcode curl_easy_pause(CURL *curl, int action)\r\n{\r\n  struct SessionHandle *data = (struct SessionHandle *)curl;\r\n  struct SingleRequest *k = &data->req;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  /* first switch off both pause bits */\r\n  int newstate = k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);\r\n\r\n  /* set the new desired pause bits */\r\n  newstate |= ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |\r\n    ((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0);\r\n\r\n  /* put it back in the keepon */\r\n  k->keepon = newstate;\r\n\r\n  if(!(newstate & KEEP_RECV_PAUSE) && data->state.tempwrite) {\r\n    /* we have a buffer for sending that we now seem to be able to deliver\r\n       since the receive pausing is lifted! */\r\n\r\n    /* get the pointer, type and length in local copies since the function may\r\n       return PAUSE again and then we'll get a new copy allocted and stored in\r\n       the tempwrite variables */\r\n    char *tempwrite = data->state.tempwrite;\r\n    char *freewrite = tempwrite; /* store this pointer to free it later */\r\n    size_t tempsize = data->state.tempwritesize;\r\n    int temptype = data->state.tempwritetype;\r\n    size_t chunklen;\r\n\r\n    /* clear tempwrite here just to make sure it gets cleared if there's no\r\n       further use of it, and make sure we don't clear it after the function\r\n       invoke as it may have been set to a new value by then */\r\n    data->state.tempwrite = NULL;\r\n\r\n    /* since the write callback API is define to never exceed\r\n       CURL_MAX_WRITE_SIZE bytes in a single call, and since we may in fact\r\n       have more data than that in our buffer here, we must loop sending the\r\n       data in multiple calls until there's no data left or we get another\r\n       pause returned.\r\n\r\n       A tricky part is that the function we call will \"buffer\" the data\r\n       itself when it pauses on a particular buffer, so we may need to do some\r\n       extra trickery if we get a pause return here.\r\n    */\r\n    do {\r\n      chunklen = (tempsize > CURL_MAX_WRITE_SIZE)?CURL_MAX_WRITE_SIZE:tempsize;\r\n\r\n      result = Curl_client_write(data->state.current_conn,\r\n                                 temptype, tempwrite, chunklen);\r\n      if(result)\r\n        /* failures abort the loop at once */\r\n        break;\r\n\r\n      if(data->state.tempwrite && (tempsize - chunklen)) {\r\n        /* Ouch, the reading is again paused and the block we send is now\r\n           \"cached\". If this is the final chunk we can leave it like this, but\r\n           if we have more chunks that are cached after this, we need to free\r\n           the newly cached one and put back a version that is truly the entire\r\n           contents that is saved for later\r\n        */\r\n        char *newptr;\r\n\r\n        /* note that tempsize is still the size as before the callback was\r\n           used, and thus the whole piece of data to keep */\r\n        newptr = realloc(data->state.tempwrite, tempsize);\r\n\r\n        if(!newptr) {\r\n          free(data->state.tempwrite); /* free old area */\r\n          data->state.tempwrite = NULL;\r\n          result = CURLE_OUT_OF_MEMORY;\r\n          /* tempwrite will be freed further down */\r\n          break;\r\n        }\r\n        data->state.tempwrite = newptr; /* store new pointer */\r\n        memcpy(newptr, tempwrite, tempsize);\r\n        data->state.tempwritesize = tempsize; /* store new size */\r\n        /* tempwrite will be freed further down */\r\n        break; /* go back to pausing until further notice */\r\n      }\r\n      else {\r\n        tempsize -= chunklen;  /* left after the call above */\r\n        tempwrite += chunklen; /* advance the pointer */\r\n      }\r\n\r\n    } while((result == CURLE_OK) && tempsize);\r\n\r\n    free(freewrite); /* this is unconditionally no longer used */\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n\r\nstatic CURLcode easy_connection(struct SessionHandle *data,\r\n                                curl_socket_t *sfd,\r\n                                struct connectdata **connp)\r\n{\r\n  if(data == NULL)\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n\r\n  /* only allow these to be called on handles with CURLOPT_CONNECT_ONLY */\r\n  if(!data->set.connect_only) {\r\n    failf(data, \"CONNECT_ONLY is required!\");\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n  }\r\n\r\n  *sfd = Curl_getconnectinfo(data, connp);\r\n\r\n  if(*sfd == CURL_SOCKET_BAD) {\r\n    failf(data, \"Failed to get recent socket\");\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Receives data from the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n * Returns CURLE_OK on success, error code on error.\r\n */\r\nCURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n)\r\n{\r\n  curl_socket_t sfd;\r\n  CURLcode ret;\r\n  ssize_t n1;\r\n  struct connectdata *c;\r\n  struct SessionHandle *data = (struct SessionHandle *)curl;\r\n\r\n  ret = easy_connection(data, &sfd, &c);\r\n  if(ret)\r\n    return ret;\r\n\r\n  *n = 0;\r\n  ret = Curl_read(c, sfd, buffer, buflen, &n1);\r\n\r\n  if(ret != CURLE_OK)\r\n    return ret;\r\n\r\n  *n = (size_t)n1;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Sends data over the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURLcode curl_easy_send(CURL *curl, const void *buffer, size_t buflen,\r\n                        size_t *n)\r\n{\r\n  curl_socket_t sfd;\r\n  CURLcode ret;\r\n  ssize_t n1;\r\n  struct connectdata *c = NULL;\r\n  struct SessionHandle *data = (struct SessionHandle *)curl;\r\n\r\n  ret = easy_connection(data, &sfd, &c);\r\n  if(ret)\r\n    return ret;\r\n\r\n  *n = 0;\r\n  ret = Curl_write(c, sfd, buffer, buflen, &n1);\r\n\r\n  if(n1 == -1)\r\n    return CURLE_SEND_ERROR;\r\n\r\n  /* detect EAGAIN */\r\n  if((CURLE_OK == ret) && (0 == n1))\r\n    return CURLE_AGAIN;\r\n\r\n  *n = (size_t)n1;\r\n\r\n  return ret;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/easyif.h",
    "content": "#ifndef HEADER_CURL_EASYIF_H\r\n#define HEADER_CURL_EASYIF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Prototypes for library-wide functions provided by easy.c\r\n */\r\nvoid Curl_easy_addmulti(struct SessionHandle *data, void *multi);\r\n\r\nvoid Curl_easy_initHandleData(struct SessionHandle *data);\r\n\r\n#endif /* HEADER_CURL_EASYIF_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/escape.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* Escape and unescape URL encoding in strings. The functions return a new\r\n * allocated string or NULL if an error occurred.  */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"curl_memory.h\"\r\n#include \"urldata.h\"\r\n#include \"warnless.h\"\r\n#include \"non-ascii.h\"\r\n#include \"escape.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Portable character check (remember EBCDIC). Do not use isalnum() because\r\n   its behavior is altered by the current locale.\r\n   See http://tools.ietf.org/html/rfc3986#section-2.3\r\n*/\r\nstatic bool Curl_isunreserved(unsigned char in)\r\n{\r\n  switch (in) {\r\n    case '0': case '1': case '2': case '3': case '4':\r\n    case '5': case '6': case '7': case '8': case '9':\r\n    case 'a': case 'b': case 'c': case 'd': case 'e':\r\n    case 'f': case 'g': case 'h': case 'i': case 'j':\r\n    case 'k': case 'l': case 'm': case 'n': case 'o':\r\n    case 'p': case 'q': case 'r': case 's': case 't':\r\n    case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':\r\n    case 'A': case 'B': case 'C': case 'D': case 'E':\r\n    case 'F': case 'G': case 'H': case 'I': case 'J':\r\n    case 'K': case 'L': case 'M': case 'N': case 'O':\r\n    case 'P': case 'Q': case 'R': case 'S': case 'T':\r\n    case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':\r\n    case '-': case '.': case '_': case '~':\r\n      return TRUE;\r\n    default:\r\n      break;\r\n  }\r\n  return FALSE;\r\n}\r\n\r\n/* for ABI-compatibility with previous versions */\r\nchar *curl_escape(const char *string, int inlength)\r\n{\r\n  return curl_easy_escape(NULL, string, inlength);\r\n}\r\n\r\n/* for ABI-compatibility with previous versions */\r\nchar *curl_unescape(const char *string, int length)\r\n{\r\n  return curl_easy_unescape(NULL, string, length, NULL);\r\n}\r\n\r\nchar *curl_easy_escape(CURL *handle, const char *string, int inlength)\r\n{\r\n  size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;\r\n  char *ns;\r\n  char *testing_ptr = NULL;\r\n  unsigned char in; /* we need to treat the characters unsigned */\r\n  size_t newlen = alloc;\r\n  size_t strindex=0;\r\n  size_t length;\r\n  CURLcode res;\r\n\r\n  ns = malloc(alloc);\r\n  if(!ns)\r\n    return NULL;\r\n\r\n  length = alloc-1;\r\n  while(length--) {\r\n    in = *string;\r\n\r\n    if(Curl_isunreserved(in))\r\n      /* just copy this */\r\n      ns[strindex++]=in;\r\n    else {\r\n      /* encode it */\r\n      newlen += 2; /* the size grows with two, since this'll become a %XX */\r\n      if(newlen > alloc) {\r\n        alloc *= 2;\r\n        testing_ptr = realloc(ns, alloc);\r\n        if(!testing_ptr) {\r\n          free( ns );\r\n          return NULL;\r\n        }\r\n        else {\r\n          ns = testing_ptr;\r\n        }\r\n      }\r\n\r\n      res = Curl_convert_to_network(handle, &in, 1);\r\n      if(res) {\r\n        /* Curl_convert_to_network calls failf if unsuccessful */\r\n        free(ns);\r\n        return NULL;\r\n      }\r\n\r\n      snprintf(&ns[strindex], 4, \"%%%02X\", in);\r\n\r\n      strindex+=3;\r\n    }\r\n    string++;\r\n  }\r\n  ns[strindex]=0; /* terminate it */\r\n  return ns;\r\n}\r\n\r\n/*\r\n * Curl_urldecode() URL decodes the given string.\r\n *\r\n * Optionally detects control characters (byte codes lower than 32) in the\r\n * data and rejects such data.\r\n *\r\n * Returns a pointer to a malloced string in *ostring with length given in\r\n * *olen. If length == 0, the length is assumed to be strlen(string).\r\n *\r\n */\r\nCURLcode Curl_urldecode(struct SessionHandle *data,\r\n                        const char *string, size_t length,\r\n                        char **ostring, size_t *olen,\r\n                        bool reject_ctrl)\r\n{\r\n  size_t alloc = (length?length:strlen(string))+1;\r\n  char *ns = malloc(alloc);\r\n  unsigned char in;\r\n  size_t strindex=0;\r\n  unsigned long hex;\r\n  CURLcode res;\r\n\r\n  if(!ns)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  while(--alloc > 0) {\r\n    in = *string;\r\n    if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {\r\n      /* this is two hexadecimal digits following a '%' */\r\n      char hexstr[3];\r\n      char *ptr;\r\n      hexstr[0] = string[1];\r\n      hexstr[1] = string[2];\r\n      hexstr[2] = 0;\r\n\r\n      hex = strtoul(hexstr, &ptr, 16);\r\n\r\n      in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */\r\n\r\n      res = Curl_convert_from_network(data, &in, 1);\r\n      if(res) {\r\n        /* Curl_convert_from_network calls failf if unsuccessful */\r\n        free(ns);\r\n        return res;\r\n      }\r\n\r\n      string+=2;\r\n      alloc-=2;\r\n    }\r\n    if(reject_ctrl && (in < 0x20)) {\r\n      free(ns);\r\n      return CURLE_URL_MALFORMAT;\r\n    }\r\n\r\n    ns[strindex++] = in;\r\n    string++;\r\n  }\r\n  ns[strindex]=0; /* terminate it */\r\n\r\n  if(olen)\r\n    /* store output size */\r\n    *olen = strindex;\r\n\r\n  if(ostring)\r\n    /* store output string */\r\n    *ostring = ns;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Unescapes the given URL escaped string of given length. Returns a\r\n * pointer to a malloced string with length given in *olen.\r\n * If length == 0, the length is assumed to be strlen(string).\r\n * If olen == NULL, no output length is stored.\r\n */\r\nchar *curl_easy_unescape(CURL *handle, const char *string, int length,\r\n                         int *olen)\r\n{\r\n  char *str = NULL;\r\n  size_t inputlen = length;\r\n  size_t outputlen;\r\n  CURLcode res = Curl_urldecode(handle, string, inputlen, &str, &outputlen,\r\n                                FALSE);\r\n  if(res)\r\n    return NULL;\r\n  if(olen)\r\n    *olen = curlx_uztosi(outputlen);\r\n  return str;\r\n}\r\n\r\n/* For operating systems/environments that use different malloc/free\r\n   systems for the app and for this library, we provide a free that uses\r\n   the library's memory system */\r\nvoid curl_free(void *p)\r\n{\r\n  if(p)\r\n    free(p);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/escape.h",
    "content": "#ifndef HEADER_CURL_ESCAPE_H\r\n#define HEADER_CURL_ESCAPE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/* Escape and unescape URL encoding in strings. The functions return a new\r\n * allocated string or NULL if an error occurred.  */\r\n\r\nCURLcode Curl_urldecode(struct SessionHandle *data,\r\n                        const char *string, size_t length,\r\n                        char **ostring, size_t *olen,\r\n                        bool reject_crlf);\r\n\r\n#endif /* HEADER_CURL_ESCAPE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/file.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FILE\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#ifdef HAVE_FCNTL_H\r\n#include <fcntl.h>\r\n#endif\r\n\r\n#include \"strtoofft.h\"\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"progress.h\"\r\n#include \"sendf.h\"\r\n#include \"escape.h\"\r\n#include \"file.h\"\r\n#include \"speedcheck.h\"\r\n#include \"getinfo.h\"\r\n#include \"transfer.h\"\r\n#include \"url.h\"\r\n#include \"curl_memory.h\"\r\n#include \"parsedate.h\" /* for the week day and month names */\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || \\\r\n  defined(__SYMBIAN32__)\r\n#define DOS_FILESYSTEM 1\r\n#endif\r\n\r\n#ifdef OPEN_NEEDS_ARG3\r\n#  define open_readonly(p,f) open((p),(f),(0))\r\n#else\r\n#  define open_readonly(p,f) open((p),(f))\r\n#endif\r\n\r\n/*\r\n * Forward declarations.\r\n */\r\n\r\nstatic CURLcode file_do(struct connectdata *, bool *done);\r\nstatic CURLcode file_done(struct connectdata *conn,\r\n                          CURLcode status, bool premature);\r\nstatic CURLcode file_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode file_disconnect(struct connectdata *conn,\r\n                                bool dead_connection);\r\n\r\n\r\n/*\r\n * FILE scheme handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_file = {\r\n  \"FILE\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  file_do,                              /* do_it */\r\n  file_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  file_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  file_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  0,                                    /* defport */\r\n  CURLPROTO_FILE,                       /* protocol */\r\n  PROTOPT_NONETWORK | PROTOPT_NOURLQUERY /* flags */\r\n};\r\n\r\n\r\n /*\r\n  Check if this is a range download, and if so, set the internal variables\r\n  properly. This code is copied from the FTP implementation and might as\r\n  well be factored out.\r\n */\r\nstatic CURLcode file_range(struct connectdata *conn)\r\n{\r\n  curl_off_t from, to;\r\n  curl_off_t totalsize=-1;\r\n  char *ptr;\r\n  char *ptr2;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(data->state.use_range && data->state.range) {\r\n    from=curlx_strtoofft(data->state.range, &ptr, 0);\r\n    while(*ptr && (ISSPACE(*ptr) || (*ptr=='-')))\r\n      ptr++;\r\n    to=curlx_strtoofft(ptr, &ptr2, 0);\r\n    if(ptr == ptr2) {\r\n      /* we didn't get any digit */\r\n      to=-1;\r\n    }\r\n    if((-1 == to) && (from>=0)) {\r\n      /* X - */\r\n      data->state.resume_from = from;\r\n      DEBUGF(infof(data, \"RANGE %\" FORMAT_OFF_T \" to end of file\\n\",\r\n                   from));\r\n    }\r\n    else if(from < 0) {\r\n      /* -Y */\r\n      data->req.maxdownload = -from;\r\n      data->state.resume_from = from;\r\n      DEBUGF(infof(data, \"RANGE the last %\" FORMAT_OFF_T \" bytes\\n\",\r\n                   -from));\r\n    }\r\n    else {\r\n      /* X-Y */\r\n      totalsize = to-from;\r\n      data->req.maxdownload = totalsize+1; /* include last byte */\r\n      data->state.resume_from = from;\r\n      DEBUGF(infof(data, \"RANGE from %\" FORMAT_OFF_T\r\n                   \" getting %\" FORMAT_OFF_T \" bytes\\n\",\r\n                   from, data->req.maxdownload));\r\n    }\r\n    DEBUGF(infof(data, \"range-download from %\" FORMAT_OFF_T\r\n                 \" to %\" FORMAT_OFF_T \", totally %\" FORMAT_OFF_T \" bytes\\n\",\r\n                 from, to, data->req.maxdownload));\r\n  }\r\n  else\r\n    data->req.maxdownload = -1;\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * file_connect() gets called from Curl_protocol_connect() to allow us to\r\n * do protocol-specific actions at connect-time.  We emulate a\r\n * connect-then-transfer protocol and \"connect\" to the file here\r\n */\r\nstatic CURLcode file_connect(struct connectdata *conn, bool *done)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  char *real_path;\r\n  struct FILEPROTO *file;\r\n  int fd;\r\n#ifdef DOS_FILESYSTEM\r\n  int i;\r\n  char *actual_path;\r\n#endif\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  real_path = curl_easy_unescape(data, data->state.path, 0, NULL);\r\n  if(!real_path)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  if(!data->state.proto.file) {\r\n    file = calloc(1, sizeof(struct FILEPROTO));\r\n    if(!file) {\r\n      free(real_path);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    data->state.proto.file = file;\r\n  }\r\n  else {\r\n    /* file is not a protocol that can deal with \"persistancy\" */\r\n    file = data->state.proto.file;\r\n    Curl_safefree(file->freepath);\r\n    file->path = NULL;\r\n    if(file->fd != -1)\r\n      close(file->fd);\r\n    file->fd = -1;\r\n  }\r\n\r\n#ifdef DOS_FILESYSTEM\r\n  /* If the first character is a slash, and there's\r\n     something that looks like a drive at the beginning of\r\n     the path, skip the slash.  If we remove the initial\r\n     slash in all cases, paths without drive letters end up\r\n     relative to the current directory which isn't how\r\n     browsers work.\r\n\r\n     Some browsers accept | instead of : as the drive letter\r\n     separator, so we do too.\r\n\r\n     On other platforms, we need the slash to indicate an\r\n     absolute pathname.  On Windows, absolute paths start\r\n     with a drive letter.\r\n  */\r\n  actual_path = real_path;\r\n  if((actual_path[0] == '/') &&\r\n      actual_path[1] &&\r\n     (actual_path[2] == ':' || actual_path[2] == '|')) {\r\n    actual_path[2] = ':';\r\n    actual_path++;\r\n  }\r\n\r\n  /* change path separators from '/' to '\\\\' for DOS, Windows and OS/2 */\r\n  for(i=0; actual_path[i] != '\\0'; ++i)\r\n    if(actual_path[i] == '/')\r\n      actual_path[i] = '\\\\';\r\n\r\n  fd = open_readonly(actual_path, O_RDONLY|O_BINARY);\r\n  file->path = actual_path;\r\n#else\r\n  fd = open_readonly(real_path, O_RDONLY);\r\n  file->path = real_path;\r\n#endif\r\n  file->freepath = real_path; /* free this when done */\r\n\r\n  file->fd = fd;\r\n  if(!data->set.upload && (fd == -1)) {\r\n    failf(data, \"Couldn't open file %s\", data->state.path);\r\n    file_done(conn, CURLE_FILE_COULDNT_READ_FILE, FALSE);\r\n    return CURLE_FILE_COULDNT_READ_FILE;\r\n  }\r\n  *done = TRUE;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode file_done(struct connectdata *conn,\r\n                               CURLcode status, bool premature)\r\n{\r\n  struct FILEPROTO *file = conn->data->state.proto.file;\r\n  (void)status; /* not used */\r\n  (void)premature; /* not used */\r\n\r\n  if(file) {\r\n    Curl_safefree(file->freepath);\r\n    file->path = NULL;\r\n    if(file->fd != -1)\r\n      close(file->fd);\r\n    file->fd = -1;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode file_disconnect(struct connectdata *conn,\r\n                                bool dead_connection)\r\n{\r\n  struct FILEPROTO *file = conn->data->state.proto.file;\r\n  (void)dead_connection; /* not used */\r\n\r\n  if(file) {\r\n    Curl_safefree(file->freepath);\r\n    file->path = NULL;\r\n    if(file->fd != -1)\r\n      close(file->fd);\r\n    file->fd = -1;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifdef DOS_FILESYSTEM\r\n#define DIRSEP '\\\\'\r\n#else\r\n#define DIRSEP '/'\r\n#endif\r\n\r\nstatic CURLcode file_upload(struct connectdata *conn)\r\n{\r\n  struct FILEPROTO *file = conn->data->state.proto.file;\r\n  const char *dir = strchr(file->path, DIRSEP);\r\n  int fd;\r\n  int mode;\r\n  CURLcode res=CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *buf = data->state.buffer;\r\n  size_t nread;\r\n  size_t nwrite;\r\n  curl_off_t bytecount = 0;\r\n  struct timeval now = Curl_tvnow();\r\n  struct_stat file_stat;\r\n  const char* buf2;\r\n\r\n  /*\r\n   * Since FILE: doesn't do the full init, we need to provide some extra\r\n   * assignments here.\r\n   */\r\n  conn->fread_func = data->set.fread_func;\r\n  conn->fread_in = data->set.in;\r\n  conn->data->req.upload_fromhere = buf;\r\n\r\n  if(!dir)\r\n    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */\r\n\r\n  if(!dir[1])\r\n    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */\r\n\r\n#ifdef O_BINARY\r\n#define MODE_DEFAULT O_WRONLY|O_CREAT|O_BINARY\r\n#else\r\n#define MODE_DEFAULT O_WRONLY|O_CREAT\r\n#endif\r\n\r\n  if(data->state.resume_from)\r\n    mode = MODE_DEFAULT|O_APPEND;\r\n  else\r\n    mode = MODE_DEFAULT|O_TRUNC;\r\n\r\n  fd = open(file->path, mode, conn->data->set.new_file_perms);\r\n  if(fd < 0) {\r\n    failf(data, \"Can't open %s for writing\", file->path);\r\n    return CURLE_WRITE_ERROR;\r\n  }\r\n\r\n  if(-1 != data->set.infilesize)\r\n    /* known size of data to \"upload\" */\r\n    Curl_pgrsSetUploadSize(data, data->set.infilesize);\r\n\r\n  /* treat the negative resume offset value as the case of \"-\" */\r\n  if(data->state.resume_from < 0) {\r\n    if(fstat(fd, &file_stat)) {\r\n      close(fd);\r\n      failf(data, \"Can't get the size of %s\", file->path);\r\n      return CURLE_WRITE_ERROR;\r\n    }\r\n    else\r\n      data->state.resume_from = (curl_off_t)file_stat.st_size;\r\n  }\r\n\r\n  while(res == CURLE_OK) {\r\n    int readcount;\r\n    res = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);\r\n    if(res)\r\n      break;\r\n\r\n    if(readcount <= 0)  /* fix questionable compare error. curlvms */\r\n      break;\r\n\r\n    nread = (size_t)readcount;\r\n\r\n    /*skip bytes before resume point*/\r\n    if(data->state.resume_from) {\r\n      if((curl_off_t)nread <= data->state.resume_from ) {\r\n        data->state.resume_from -= nread;\r\n        nread = 0;\r\n        buf2 = buf;\r\n      }\r\n      else {\r\n        buf2 = buf + data->state.resume_from;\r\n        nread -= (size_t)data->state.resume_from;\r\n        data->state.resume_from = 0;\r\n      }\r\n    }\r\n    else\r\n      buf2 = buf;\r\n\r\n    /* write the data to the target */\r\n    nwrite = write(fd, buf2, nread);\r\n    if(nwrite != nread) {\r\n      res = CURLE_SEND_ERROR;\r\n      break;\r\n    }\r\n\r\n    bytecount += nread;\r\n\r\n    Curl_pgrsSetUploadCounter(data, bytecount);\r\n\r\n    if(Curl_pgrsUpdate(conn))\r\n      res = CURLE_ABORTED_BY_CALLBACK;\r\n    else\r\n      res = Curl_speedcheck(data, now);\r\n  }\r\n  if(!res && Curl_pgrsUpdate(conn))\r\n    res = CURLE_ABORTED_BY_CALLBACK;\r\n\r\n  close(fd);\r\n\r\n  return res;\r\n}\r\n\r\n/*\r\n * file_do() is the protocol-specific function for the do-phase, separated\r\n * from the connect-phase above. Other protocols merely setup the transfer in\r\n * the do-phase, to have it done in the main transfer loop but since some\r\n * platforms we support don't allow select()ing etc on file handles (as\r\n * opposed to sockets) we instead perform the whole do-operation in this\r\n * function.\r\n */\r\nstatic CURLcode file_do(struct connectdata *conn, bool *done)\r\n{\r\n  /* This implementation ignores the host name in conformance with\r\n     RFC 1738. Only local files (reachable via the standard file system)\r\n     are supported. This means that files on remotely mounted directories\r\n     (via NFS, Samba, NT sharing) can be accessed through a file:// URL\r\n  */\r\n  CURLcode res = CURLE_OK;\r\n  struct_stat statbuf; /* struct_stat instead of struct stat just to allow the\r\n                          Windows version to have a different struct without\r\n                          having to redefine the simple word 'stat' */\r\n  curl_off_t expected_size=0;\r\n  bool fstated=FALSE;\r\n  ssize_t nread;\r\n  struct SessionHandle *data = conn->data;\r\n  char *buf = data->state.buffer;\r\n  curl_off_t bytecount = 0;\r\n  int fd;\r\n  struct timeval now = Curl_tvnow();\r\n\r\n  *done = TRUE; /* unconditionally */\r\n\r\n  Curl_initinfo(data);\r\n  Curl_pgrsStartNow(data);\r\n\r\n  if(data->set.upload)\r\n    return file_upload(conn);\r\n\r\n  /* get the fd from the connection phase */\r\n  fd = conn->data->state.proto.file->fd;\r\n\r\n  /* VMS: This only works reliable for STREAMLF files */\r\n  if(-1 != fstat(fd, &statbuf)) {\r\n    /* we could stat it, then read out the size */\r\n    expected_size = statbuf.st_size;\r\n    /* and store the modification time */\r\n    data->info.filetime = (long)statbuf.st_mtime;\r\n    fstated = TRUE;\r\n  }\r\n\r\n  if(fstated && !data->state.range && data->set.timecondition) {\r\n    if(!Curl_meets_timecondition(data, (time_t)data->info.filetime)) {\r\n      *done = TRUE;\r\n      return CURLE_OK;\r\n    }\r\n  }\r\n\r\n  /* If we have selected NOBODY and HEADER, it means that we only want file\r\n     information. Which for FILE can't be much more than the file size and\r\n     date. */\r\n  if(data->set.opt_no_body && data->set.include_header && fstated) {\r\n    CURLcode result;\r\n    snprintf(buf, sizeof(data->state.buffer),\r\n             \"Content-Length: %\" FORMAT_OFF_T \"\\r\\n\", expected_size);\r\n    result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);\r\n    if(result)\r\n      return result;\r\n\r\n    result = Curl_client_write(conn, CLIENTWRITE_BOTH,\r\n                               (char *)\"Accept-ranges: bytes\\r\\n\", 0);\r\n    if(result)\r\n      return result;\r\n\r\n    if(fstated) {\r\n      time_t filetime = (time_t)statbuf.st_mtime;\r\n      struct tm buffer;\r\n      const struct tm *tm = &buffer;\r\n      result = Curl_gmtime(filetime, &buffer);\r\n      if(result)\r\n        return result;\r\n\r\n      /* format: \"Tue, 15 Nov 1994 12:45:26 GMT\" */\r\n      snprintf(buf, BUFSIZE-1,\r\n               \"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\\r\\n\",\r\n               Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],\r\n               tm->tm_mday,\r\n               Curl_month[tm->tm_mon],\r\n               tm->tm_year + 1900,\r\n               tm->tm_hour,\r\n               tm->tm_min,\r\n               tm->tm_sec);\r\n      result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);\r\n    }\r\n    /* if we fstat()ed the file, set the file size to make it available post-\r\n       transfer */\r\n    if(fstated)\r\n      Curl_pgrsSetDownloadSize(data, expected_size);\r\n    return result;\r\n  }\r\n\r\n  /* Check whether file range has been specified */\r\n  file_range(conn);\r\n\r\n  /* Adjust the start offset in case we want to get the N last bytes\r\n   * of the stream iff the filesize could be determined */\r\n  if(data->state.resume_from < 0) {\r\n    if(!fstated) {\r\n      failf(data, \"Can't get the size of file.\");\r\n      return CURLE_READ_ERROR;\r\n    }\r\n    else\r\n      data->state.resume_from += (curl_off_t)statbuf.st_size;\r\n  }\r\n\r\n  if(data->state.resume_from <= expected_size)\r\n    expected_size -= data->state.resume_from;\r\n  else {\r\n    failf(data, \"failed to resume file:// transfer\");\r\n    return CURLE_BAD_DOWNLOAD_RESUME;\r\n  }\r\n\r\n  /* A high water mark has been specified so we obey... */\r\n  if(data->req.maxdownload > 0)\r\n    expected_size = data->req.maxdownload;\r\n\r\n  if(fstated && (expected_size == 0))\r\n    return CURLE_OK;\r\n\r\n  /* The following is a shortcut implementation of file reading\r\n     this is both more efficient than the former call to download() and\r\n     it avoids problems with select() and recv() on file descriptors\r\n     in Winsock */\r\n  if(fstated)\r\n    Curl_pgrsSetDownloadSize(data, expected_size);\r\n\r\n  if(data->state.resume_from) {\r\n    if(data->state.resume_from !=\r\n       lseek(fd, data->state.resume_from, SEEK_SET))\r\n      return CURLE_BAD_DOWNLOAD_RESUME;\r\n  }\r\n\r\n  Curl_pgrsTime(data, TIMER_STARTTRANSFER);\r\n\r\n  while(res == CURLE_OK) {\r\n    /* Don't fill a whole buffer if we want less than all data */\r\n    size_t bytestoread =\r\n      (expected_size < CURL_OFF_T_C(BUFSIZE) - CURL_OFF_T_C(1)) ?\r\n      curlx_sotouz(expected_size) : BUFSIZE - 1;\r\n\r\n    nread = read(fd, buf, bytestoread);\r\n\r\n    if(nread > 0)\r\n      buf[nread] = 0;\r\n\r\n    if(nread <= 0 || expected_size == 0)\r\n      break;\r\n\r\n    bytecount += nread;\r\n    expected_size -= nread;\r\n\r\n    res = Curl_client_write(conn, CLIENTWRITE_BODY, buf, nread);\r\n    if(res)\r\n      return res;\r\n\r\n    Curl_pgrsSetDownloadCounter(data, bytecount);\r\n\r\n    if(Curl_pgrsUpdate(conn))\r\n      res = CURLE_ABORTED_BY_CALLBACK;\r\n    else\r\n      res = Curl_speedcheck(data, now);\r\n  }\r\n  if(Curl_pgrsUpdate(conn))\r\n    res = CURLE_ABORTED_BY_CALLBACK;\r\n\r\n  return res;\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/file.h",
    "content": "#ifndef HEADER_CURL_FILE_H\r\n#define HEADER_CURL_FILE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n\r\n/****************************************************************************\r\n * FILE unique setup\r\n ***************************************************************************/\r\nstruct FILEPROTO {\r\n  char *path; /* the path we operate on */\r\n  char *freepath; /* pointer to the allocated block we must free, this might\r\n                     differ from the 'path' pointer */\r\n  int fd;     /* open file descriptor to read from! */\r\n};\r\n\r\n#ifndef CURL_DISABLE_FILE\r\nextern const struct Curl_handler Curl_handler_file;\r\n#endif\r\n\r\n#endif /* HEADER_CURL_FILE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/fileinfo.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010-2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"strdup.h\"\r\n#include \"fileinfo.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstruct curl_fileinfo *Curl_fileinfo_alloc(void)\r\n{\r\n  struct curl_fileinfo *tmp = malloc(sizeof(struct curl_fileinfo));\r\n  if(!tmp)\r\n    return NULL;\r\n  memset(tmp, 0, sizeof(struct curl_fileinfo));\r\n  return tmp;\r\n}\r\n\r\nvoid Curl_fileinfo_dtor(void *user, void *element)\r\n{\r\n  struct curl_fileinfo *finfo = element;\r\n  (void) user;\r\n  if(!finfo)\r\n    return;\r\n\r\n  Curl_safefree(finfo->b_data);\r\n\r\n  free(finfo);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/fileinfo.h",
    "content": "#ifndef HEADER_CURL_FILEINFO_H\r\n#define HEADER_CURL_FILEINFO_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h>\r\n\r\nstruct curl_fileinfo *Curl_fileinfo_alloc(void);\r\n\r\nvoid Curl_fileinfo_dtor(void *, void *);\r\n\r\nstruct curl_fileinfo *Curl_fileinfo_dup(const struct curl_fileinfo *src);\r\n\r\n#endif /* HEADER_CURL_FILEINFO_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/formdata.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n/* Length of the random boundary string. */\r\n#define BOUNDARY_LENGTH 40\r\n\r\n#if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY)\r\n\r\n#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME)\r\n#include <libgen.h>\r\n#endif\r\n\r\n#include \"urldata.h\" /* for struct SessionHandle */\r\n#include \"formdata.h\"\r\n#include \"curl_rand.h\"\r\n#include \"strequal.h\"\r\n#include \"curl_memory.h\"\r\n#include \"sendf.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#endif  /* !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) */\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n\r\n#ifndef HAVE_BASENAME\r\nstatic char *Curl_basename(char *path);\r\n#define basename(x)  Curl_basename((x))\r\n#endif\r\n\r\nstatic size_t readfromfile(struct Form *form, char *buffer, size_t size);\r\n\r\n/* What kind of Content-Type to use on un-specified files with unrecognized\r\n   extensions. */\r\n#define HTTPPOST_CONTENTTYPE_DEFAULT \"application/octet-stream\"\r\n\r\n#define FORM_FILE_SEPARATOR ','\r\n#define FORM_TYPE_SEPARATOR ';'\r\n\r\n/***************************************************************************\r\n *\r\n * AddHttpPost()\r\n *\r\n * Adds a HttpPost structure to the list, if parent_post is given becomes\r\n * a subpost of parent_post instead of a direct list element.\r\n *\r\n * Returns newly allocated HttpPost on success and NULL if malloc failed.\r\n *\r\n ***************************************************************************/\r\nstatic struct curl_httppost *\r\nAddHttpPost(char *name, size_t namelength,\r\n            char *value, size_t contentslength,\r\n            char *buffer, size_t bufferlength,\r\n            char *contenttype,\r\n            long flags,\r\n            struct curl_slist* contentHeader,\r\n            char *showfilename, char *userp,\r\n            struct curl_httppost *parent_post,\r\n            struct curl_httppost **httppost,\r\n            struct curl_httppost **last_post)\r\n{\r\n  struct curl_httppost *post;\r\n  post = calloc(1, sizeof(struct curl_httppost));\r\n  if(post) {\r\n    post->name = name;\r\n    post->namelength = (long)(name?(namelength?namelength:strlen(name)):0);\r\n    post->contents = value;\r\n    post->contentslength = (long)contentslength;\r\n    post->buffer = buffer;\r\n    post->bufferlength = (long)bufferlength;\r\n    post->contenttype = contenttype;\r\n    post->contentheader = contentHeader;\r\n    post->showfilename = showfilename;\r\n    post->userp = userp,\r\n    post->flags = flags;\r\n  }\r\n  else\r\n    return NULL;\r\n\r\n  if(parent_post) {\r\n    /* now, point our 'more' to the original 'more' */\r\n    post->more = parent_post->more;\r\n\r\n    /* then move the original 'more' to point to ourselves */\r\n    parent_post->more = post;\r\n  }\r\n  else {\r\n    /* make the previous point to this */\r\n    if(*last_post)\r\n      (*last_post)->next = post;\r\n    else\r\n      (*httppost) = post;\r\n\r\n    (*last_post) = post;\r\n  }\r\n  return post;\r\n}\r\n\r\n/***************************************************************************\r\n *\r\n * AddFormInfo()\r\n *\r\n * Adds a FormInfo structure to the list presented by parent_form_info.\r\n *\r\n * Returns newly allocated FormInfo on success and NULL if malloc failed/\r\n * parent_form_info is NULL.\r\n *\r\n ***************************************************************************/\r\nstatic FormInfo * AddFormInfo(char *value,\r\n                              char *contenttype,\r\n                              FormInfo *parent_form_info)\r\n{\r\n  FormInfo *form_info;\r\n  form_info = calloc(1, sizeof(struct FormInfo));\r\n  if(form_info) {\r\n    if(value)\r\n      form_info->value = value;\r\n    if(contenttype)\r\n      form_info->contenttype = contenttype;\r\n    form_info->flags = HTTPPOST_FILENAME;\r\n  }\r\n  else\r\n    return NULL;\r\n\r\n  if(parent_form_info) {\r\n    /* now, point our 'more' to the original 'more' */\r\n    form_info->more = parent_form_info->more;\r\n\r\n    /* then move the original 'more' to point to ourselves */\r\n    parent_form_info->more = form_info;\r\n  }\r\n\r\n  return form_info;\r\n}\r\n\r\n/***************************************************************************\r\n *\r\n * ContentTypeForFilename()\r\n *\r\n * Provides content type for filename if one of the known types (else\r\n * (either the prevtype or the default is returned).\r\n *\r\n * Returns some valid contenttype for filename.\r\n *\r\n ***************************************************************************/\r\nstatic const char * ContentTypeForFilename (const char *filename,\r\n                                            const char *prevtype)\r\n{\r\n  const char *contenttype = NULL;\r\n  unsigned int i;\r\n  /*\r\n   * No type was specified, we scan through a few well-known\r\n   * extensions and pick the first we match!\r\n   */\r\n  struct ContentType {\r\n    char extension[6];\r\n    const char *type;\r\n  };\r\n  static const struct ContentType ctts[]={\r\n    {\".gif\",  \"image/gif\"},\r\n    {\".jpg\",  \"image/jpeg\"},\r\n    {\".jpeg\", \"image/jpeg\"},\r\n    {\".txt\",  \"text/plain\"},\r\n    {\".html\", \"text/html\"},\r\n    {\".xml\", \"application/xml\"}\r\n  };\r\n\r\n  if(prevtype)\r\n    /* default to the previously set/used! */\r\n    contenttype = prevtype;\r\n  else\r\n    contenttype = HTTPPOST_CONTENTTYPE_DEFAULT;\r\n\r\n  if(filename) { /* in case a NULL was passed in */\r\n    for(i=0; i<sizeof(ctts)/sizeof(ctts[0]); i++) {\r\n      if(strlen(filename) >= strlen(ctts[i].extension)) {\r\n        if(strequal(filename +\r\n                    strlen(filename) - strlen(ctts[i].extension),\r\n                    ctts[i].extension)) {\r\n          contenttype = ctts[i].type;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  /* we have a contenttype by now */\r\n  return contenttype;\r\n}\r\n\r\n/***************************************************************************\r\n *\r\n * memdup()\r\n *\r\n * Copies the 'source' data to a newly allocated buffer buffer (that is\r\n * returned). Uses buffer_length if not null, else uses strlen to determine\r\n * the length of the buffer to be copied\r\n *\r\n * Returns the new pointer or NULL on failure.\r\n *\r\n ***************************************************************************/\r\nstatic char *memdup(const char *src, size_t buffer_length)\r\n{\r\n  size_t length;\r\n  bool add = FALSE;\r\n  char *buffer;\r\n\r\n  if(buffer_length)\r\n    length = buffer_length;\r\n  else if(src) {\r\n    length = strlen(src);\r\n    add = TRUE;\r\n  }\r\n  else\r\n    /* no length and a NULL src pointer! */\r\n    return strdup(\"\");\r\n\r\n  buffer = malloc(length+add);\r\n  if(!buffer)\r\n    return NULL; /* fail */\r\n\r\n  memcpy(buffer, src, length);\r\n\r\n  /* if length unknown do null termination */\r\n  if(add)\r\n    buffer[length] = '\\0';\r\n\r\n  return buffer;\r\n}\r\n\r\n/***************************************************************************\r\n *\r\n * FormAdd()\r\n *\r\n * Stores a formpost parameter and builds the appropriate linked list.\r\n *\r\n * Has two principal functionalities: using files and byte arrays as\r\n * post parts. Byte arrays are either copied or just the pointer is stored\r\n * (as the user requests) while for files only the filename and not the\r\n * content is stored.\r\n *\r\n * While you may have only one byte array for each name, multiple filenames\r\n * are allowed (and because of this feature CURLFORM_END is needed after\r\n * using CURLFORM_FILE).\r\n *\r\n * Examples:\r\n *\r\n * Simple name/value pair with copied contents:\r\n * curl_formadd (&post, &last, CURLFORM_COPYNAME, \"name\",\r\n * CURLFORM_COPYCONTENTS, \"value\", CURLFORM_END);\r\n *\r\n * name/value pair where only the content pointer is remembered:\r\n * curl_formadd (&post, &last, CURLFORM_COPYNAME, \"name\",\r\n * CURLFORM_PTRCONTENTS, ptr, CURLFORM_CONTENTSLENGTH, 10, CURLFORM_END);\r\n * (if CURLFORM_CONTENTSLENGTH is missing strlen () is used)\r\n *\r\n * storing a filename (CONTENTTYPE is optional!):\r\n * curl_formadd (&post, &last, CURLFORM_COPYNAME, \"name\",\r\n * CURLFORM_FILE, \"filename1\", CURLFORM_CONTENTTYPE, \"plain/text\",\r\n * CURLFORM_END);\r\n *\r\n * storing multiple filenames:\r\n * curl_formadd (&post, &last, CURLFORM_COPYNAME, \"name\",\r\n * CURLFORM_FILE, \"filename1\", CURLFORM_FILE, \"filename2\", CURLFORM_END);\r\n *\r\n * Returns:\r\n * CURL_FORMADD_OK             on success\r\n * CURL_FORMADD_MEMORY         if the FormInfo allocation fails\r\n * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form\r\n * CURL_FORMADD_NULL           if a null pointer was given for a char\r\n * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed\r\n * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used\r\n * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)\r\n * CURL_FORMADD_MEMORY         if a HttpPost struct cannot be allocated\r\n * CURL_FORMADD_MEMORY         if some allocation for string copying failed.\r\n * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array\r\n *\r\n ***************************************************************************/\r\n\r\nstatic\r\nCURLFORMcode FormAdd(struct curl_httppost **httppost,\r\n                     struct curl_httppost **last_post,\r\n                     va_list params)\r\n{\r\n  FormInfo *first_form, *current_form, *form = NULL;\r\n  CURLFORMcode return_value = CURL_FORMADD_OK;\r\n  const char *prevtype = NULL;\r\n  struct curl_httppost *post = NULL;\r\n  CURLformoption option;\r\n  struct curl_forms *forms = NULL;\r\n  char *array_value=NULL; /* value read from an array */\r\n\r\n  /* This is a state variable, that if TRUE means that we're parsing an\r\n     array that we got passed to us. If FALSE we're parsing the input\r\n     va_list arguments. */\r\n  bool array_state = FALSE;\r\n\r\n  /*\r\n   * We need to allocate the first struct to fill in.\r\n   */\r\n  first_form = calloc(1, sizeof(struct FormInfo));\r\n  if(!first_form)\r\n    return CURL_FORMADD_MEMORY;\r\n\r\n  current_form = first_form;\r\n\r\n  /*\r\n   * Loop through all the options set. Break if we have an error to report.\r\n   */\r\n  while(return_value == CURL_FORMADD_OK) {\r\n\r\n    /* first see if we have more parts of the array param */\r\n    if(array_state && forms) {\r\n      /* get the upcoming option from the given array */\r\n      option = forms->option;\r\n      array_value = (char *)forms->value;\r\n\r\n      forms++; /* advance this to next entry */\r\n      if(CURLFORM_END == option) {\r\n        /* end of array state */\r\n        array_state = FALSE;\r\n        continue;\r\n      }\r\n    }\r\n    else {\r\n      /* This is not array-state, get next option */\r\n      option = va_arg(params, CURLformoption);\r\n      if(CURLFORM_END == option)\r\n        break;\r\n    }\r\n\r\n    switch (option) {\r\n    case CURLFORM_ARRAY:\r\n      if(array_state)\r\n        /* we don't support an array from within an array */\r\n        return_value = CURL_FORMADD_ILLEGAL_ARRAY;\r\n      else {\r\n        forms = va_arg(params, struct curl_forms *);\r\n        if(forms)\r\n          array_state = TRUE;\r\n        else\r\n          return_value = CURL_FORMADD_NULL;\r\n      }\r\n      break;\r\n\r\n      /*\r\n       * Set the Name property.\r\n       */\r\n    case CURLFORM_PTRNAME:\r\n#ifdef CURL_DOES_CONVERSIONS\r\n      /* Treat CURLFORM_PTR like CURLFORM_COPYNAME so that libcurl will copy\r\n       * the data in all cases so that we'll have safe memory for the eventual\r\n       * conversion.\r\n       */\r\n#else\r\n      current_form->flags |= HTTPPOST_PTRNAME; /* fall through */\r\n#endif\r\n    case CURLFORM_COPYNAME:\r\n      if(current_form->name)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else {\r\n        char *name = array_state?\r\n          array_value:va_arg(params, char *);\r\n        if(name)\r\n          current_form->name = name; /* store for the moment */\r\n        else\r\n          return_value = CURL_FORMADD_NULL;\r\n      }\r\n      break;\r\n    case CURLFORM_NAMELENGTH:\r\n      if(current_form->namelength)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else\r\n        current_form->namelength =\r\n          array_state?(size_t)array_value:(size_t)va_arg(params, long);\r\n      break;\r\n\r\n      /*\r\n       * Set the contents property.\r\n       */\r\n    case CURLFORM_PTRCONTENTS:\r\n      current_form->flags |= HTTPPOST_PTRCONTENTS; /* fall through */\r\n    case CURLFORM_COPYCONTENTS:\r\n      if(current_form->value)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else {\r\n        char *value =\r\n          array_state?array_value:va_arg(params, char *);\r\n        if(value)\r\n          current_form->value = value; /* store for the moment */\r\n        else\r\n          return_value = CURL_FORMADD_NULL;\r\n      }\r\n      break;\r\n    case CURLFORM_CONTENTSLENGTH:\r\n      if(current_form->contentslength)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else\r\n        current_form->contentslength =\r\n          array_state?(size_t)array_value:(size_t)va_arg(params, long);\r\n      break;\r\n\r\n      /* Get contents from a given file name */\r\n    case CURLFORM_FILECONTENT:\r\n      if(current_form->flags != 0)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else {\r\n        const char *filename = array_state?\r\n          array_value:va_arg(params, char *);\r\n        if(filename) {\r\n          current_form->value = strdup(filename);\r\n          if(!current_form->value)\r\n            return_value = CURL_FORMADD_MEMORY;\r\n          else {\r\n            current_form->flags |= HTTPPOST_READFILE;\r\n            current_form->value_alloc = TRUE;\r\n          }\r\n        }\r\n        else\r\n          return_value = CURL_FORMADD_NULL;\r\n      }\r\n      break;\r\n\r\n      /* We upload a file */\r\n    case CURLFORM_FILE:\r\n      {\r\n        const char *filename = array_state?array_value:\r\n          va_arg(params, char *);\r\n\r\n        if(current_form->value) {\r\n          if(current_form->flags & HTTPPOST_FILENAME) {\r\n            if(filename) {\r\n              char *fname = strdup(filename);\r\n              if(!fname)\r\n                return_value = CURL_FORMADD_MEMORY;\r\n              else {\r\n                form = AddFormInfo(fname, NULL, current_form);\r\n                if(!form) {\r\n                  Curl_safefree(fname);\r\n                  return_value = CURL_FORMADD_MEMORY;\r\n                }\r\n                else {\r\n                  form->value_alloc = TRUE;\r\n                  current_form = form;\r\n                  form = NULL;\r\n                }\r\n              }\r\n            }\r\n            else\r\n              return_value = CURL_FORMADD_NULL;\r\n          }\r\n          else\r\n            return_value = CURL_FORMADD_OPTION_TWICE;\r\n        }\r\n        else {\r\n          if(filename) {\r\n            current_form->value = strdup(filename);\r\n            if(!current_form->value)\r\n              return_value = CURL_FORMADD_MEMORY;\r\n            else {\r\n              current_form->flags |= HTTPPOST_FILENAME;\r\n              current_form->value_alloc = TRUE;\r\n            }\r\n          }\r\n          else\r\n            return_value = CURL_FORMADD_NULL;\r\n        }\r\n        break;\r\n      }\r\n\r\n    case CURLFORM_BUFFERPTR:\r\n      current_form->flags |= HTTPPOST_PTRBUFFER|HTTPPOST_BUFFER;\r\n      if(current_form->buffer)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else {\r\n        char *buffer =\r\n          array_state?array_value:va_arg(params, char *);\r\n        if(buffer) {\r\n          current_form->buffer = buffer; /* store for the moment */\r\n          current_form->value = buffer; /* make it non-NULL to be accepted\r\n                                           as fine */\r\n        }\r\n        else\r\n          return_value = CURL_FORMADD_NULL;\r\n      }\r\n      break;\r\n\r\n    case CURLFORM_BUFFERLENGTH:\r\n      if(current_form->bufferlength)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else\r\n        current_form->bufferlength =\r\n          array_state?(size_t)array_value:(size_t)va_arg(params, long);\r\n      break;\r\n\r\n    case CURLFORM_STREAM:\r\n      current_form->flags |= HTTPPOST_CALLBACK;\r\n      if(current_form->userp)\r\n        return_value = CURL_FORMADD_OPTION_TWICE;\r\n      else {\r\n        char *userp =\r\n          array_state?array_value:va_arg(params, char *);\r\n        if(userp) {\r\n          current_form->userp = userp;\r\n          current_form->value = userp; /* this isn't strictly true but we\r\n                                          derive a value from this later on\r\n                                          and we need this non-NULL to be\r\n                                          accepted as a fine form part */\r\n        }\r\n        else\r\n          return_value = CURL_FORMADD_NULL;\r\n      }\r\n      break;\r\n\r\n    case CURLFORM_CONTENTTYPE:\r\n      {\r\n        const char *contenttype =\r\n          array_state?array_value:va_arg(params, char *);\r\n        if(current_form->contenttype) {\r\n          if(current_form->flags & HTTPPOST_FILENAME) {\r\n            if(contenttype) {\r\n              char *type = strdup(contenttype);\r\n              if(!type)\r\n                return_value = CURL_FORMADD_MEMORY;\r\n              else {\r\n                form = AddFormInfo(NULL, type, current_form);\r\n                if(!form) {\r\n                  Curl_safefree(type);\r\n                  return_value = CURL_FORMADD_MEMORY;\r\n                }\r\n                else {\r\n                  form->contenttype_alloc = TRUE;\r\n                  current_form = form;\r\n                  form = NULL;\r\n                }\r\n              }\r\n            }\r\n            else\r\n              return_value = CURL_FORMADD_NULL;\r\n          }\r\n          else\r\n            return_value = CURL_FORMADD_OPTION_TWICE;\r\n        }\r\n        else {\r\n          if(contenttype) {\r\n            current_form->contenttype = strdup(contenttype);\r\n            if(!current_form->contenttype)\r\n              return_value = CURL_FORMADD_MEMORY;\r\n            else\r\n              current_form->contenttype_alloc = TRUE;\r\n          }\r\n          else\r\n            return_value = CURL_FORMADD_NULL;\r\n        }\r\n        break;\r\n      }\r\n    case CURLFORM_CONTENTHEADER:\r\n      {\r\n        /* this \"cast increases required alignment of target type\" but\r\n           we consider it OK anyway */\r\n        struct curl_slist* list = array_state?\r\n          (struct curl_slist*)array_value:\r\n          va_arg(params, struct curl_slist*);\r\n\r\n        if(current_form->contentheader)\r\n          return_value = CURL_FORMADD_OPTION_TWICE;\r\n        else\r\n          current_form->contentheader = list;\r\n\r\n        break;\r\n      }\r\n    case CURLFORM_FILENAME:\r\n    case CURLFORM_BUFFER:\r\n      {\r\n        const char *filename = array_state?array_value:\r\n          va_arg(params, char *);\r\n        if(current_form->showfilename)\r\n          return_value = CURL_FORMADD_OPTION_TWICE;\r\n        else {\r\n          current_form->showfilename = strdup(filename);\r\n          if(!current_form->showfilename)\r\n            return_value = CURL_FORMADD_MEMORY;\r\n          else\r\n            current_form->showfilename_alloc = TRUE;\r\n        }\r\n        break;\r\n      }\r\n    default:\r\n      return_value = CURL_FORMADD_UNKNOWN_OPTION;\r\n      break;\r\n    }\r\n  }\r\n\r\n  if(CURL_FORMADD_OK != return_value) {\r\n    /* On error, free allocated fields for all nodes of the FormInfo linked\r\n       list without deallocating nodes. List nodes are deallocated later on */\r\n    FormInfo *ptr;\r\n    for(ptr = first_form; ptr != NULL; ptr = ptr->more) {\r\n      if(ptr->name_alloc) {\r\n        Curl_safefree(ptr->name);\r\n        ptr->name_alloc = FALSE;\r\n      }\r\n      if(ptr->value_alloc) {\r\n        Curl_safefree(ptr->value);\r\n        ptr->value_alloc = FALSE;\r\n      }\r\n      if(ptr->contenttype_alloc) {\r\n        Curl_safefree(ptr->contenttype);\r\n        ptr->contenttype_alloc = FALSE;\r\n      }\r\n      if(ptr->showfilename_alloc) {\r\n        Curl_safefree(ptr->showfilename);\r\n        ptr->showfilename_alloc = FALSE;\r\n      }\r\n    }\r\n  }\r\n\r\n  if(CURL_FORMADD_OK == return_value) {\r\n    /* go through the list, check for completeness and if everything is\r\n     * alright add the HttpPost item otherwise set return_value accordingly */\r\n\r\n    post = NULL;\r\n    for(form = first_form;\r\n        form != NULL;\r\n        form = form->more) {\r\n      if(((!form->name || !form->value) && !post) ||\r\n         ( (form->contentslength) &&\r\n           (form->flags & HTTPPOST_FILENAME) ) ||\r\n         ( (form->flags & HTTPPOST_FILENAME) &&\r\n           (form->flags & HTTPPOST_PTRCONTENTS) ) ||\r\n\r\n         ( (!form->buffer) &&\r\n           (form->flags & HTTPPOST_BUFFER) &&\r\n           (form->flags & HTTPPOST_PTRBUFFER) ) ||\r\n\r\n         ( (form->flags & HTTPPOST_READFILE) &&\r\n           (form->flags & HTTPPOST_PTRCONTENTS) )\r\n        ) {\r\n        return_value = CURL_FORMADD_INCOMPLETE;\r\n        break;\r\n      }\r\n      else {\r\n        if(((form->flags & HTTPPOST_FILENAME) ||\r\n            (form->flags & HTTPPOST_BUFFER)) &&\r\n           !form->contenttype ) {\r\n          /* our contenttype is missing */\r\n          form->contenttype\r\n            = strdup(ContentTypeForFilename(form->value, prevtype));\r\n          if(!form->contenttype) {\r\n            return_value = CURL_FORMADD_MEMORY;\r\n            break;\r\n          }\r\n          form->contenttype_alloc = TRUE;\r\n        }\r\n        if(!(form->flags & HTTPPOST_PTRNAME) &&\r\n           (form == first_form) ) {\r\n          /* Note that there's small risk that form->name is NULL here if the\r\n             app passed in a bad combo, so we better check for that first. */\r\n          if(form->name)\r\n            /* copy name (without strdup; possibly contains null characters) */\r\n            form->name = memdup(form->name, form->namelength);\r\n          if(!form->name) {\r\n            return_value = CURL_FORMADD_MEMORY;\r\n            break;\r\n          }\r\n          form->name_alloc = TRUE;\r\n        }\r\n        if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |\r\n                            HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |\r\n                            HTTPPOST_CALLBACK)) ) {\r\n          /* copy value (without strdup; possibly contains null characters) */\r\n          form->value = memdup(form->value, form->contentslength);\r\n          if(!form->value) {\r\n            return_value = CURL_FORMADD_MEMORY;\r\n            break;\r\n          }\r\n          form->value_alloc = TRUE;\r\n        }\r\n        post = AddHttpPost(form->name, form->namelength,\r\n                           form->value, form->contentslength,\r\n                           form->buffer, form->bufferlength,\r\n                           form->contenttype, form->flags,\r\n                           form->contentheader, form->showfilename,\r\n                           form->userp,\r\n                           post, httppost,\r\n                           last_post);\r\n\r\n        if(!post) {\r\n          return_value = CURL_FORMADD_MEMORY;\r\n          break;\r\n        }\r\n\r\n        if(form->contenttype)\r\n          prevtype = form->contenttype;\r\n      }\r\n    }\r\n    if(CURL_FORMADD_OK != return_value) {\r\n      /* On error, free allocated fields for nodes of the FormInfo linked\r\n         list which are not already owned by the httppost linked list\r\n         without deallocating nodes. List nodes are deallocated later on */\r\n      FormInfo *ptr;\r\n      for(ptr = form; ptr != NULL; ptr = ptr->more) {\r\n        if(ptr->name_alloc) {\r\n          Curl_safefree(ptr->name);\r\n          ptr->name_alloc = FALSE;\r\n        }\r\n        if(ptr->value_alloc) {\r\n          Curl_safefree(ptr->value);\r\n          ptr->value_alloc = FALSE;\r\n        }\r\n        if(ptr->contenttype_alloc) {\r\n          Curl_safefree(ptr->contenttype);\r\n          ptr->contenttype_alloc = FALSE;\r\n        }\r\n        if(ptr->showfilename_alloc) {\r\n          Curl_safefree(ptr->showfilename);\r\n          ptr->showfilename_alloc = FALSE;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Always deallocate FormInfo linked list nodes without touching node\r\n     fields given that these have either been deallocated or are owned\r\n     now by the httppost linked list */\r\n  while(first_form) {\r\n    FormInfo *ptr = first_form->more;\r\n    Curl_safefree(first_form);\r\n    first_form = ptr;\r\n  }\r\n\r\n  return return_value;\r\n}\r\n\r\n/*\r\n * curl_formadd() is a public API to add a section to the multipart formpost.\r\n *\r\n * @unittest: 1308\r\n */\r\n\r\nCURLFORMcode curl_formadd(struct curl_httppost **httppost,\r\n                          struct curl_httppost **last_post,\r\n                          ...)\r\n{\r\n  va_list arg;\r\n  CURLFORMcode result;\r\n  va_start(arg, last_post);\r\n  result = FormAdd(httppost, last_post, arg);\r\n  va_end(arg);\r\n  return result;\r\n}\r\n\r\n/*\r\n * AddFormData() adds a chunk of data to the FormData linked list.\r\n *\r\n * size is incremented by the chunk length, unless it is NULL\r\n */\r\nstatic CURLcode AddFormData(struct FormData **formp,\r\n                            enum formtype type,\r\n                            const void *line,\r\n                            size_t length,\r\n                            curl_off_t *size)\r\n{\r\n  struct FormData *newform = malloc(sizeof(struct FormData));\r\n  if(!newform)\r\n    return CURLE_OUT_OF_MEMORY;\r\n  newform->next = NULL;\r\n\r\n  if(type <= FORM_CONTENT) {\r\n    /* we make it easier for plain strings: */\r\n    if(!length)\r\n      length = strlen((char *)line);\r\n\r\n    newform->line = malloc(length+1);\r\n    if(!newform->line) {\r\n      free(newform);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    memcpy(newform->line, line, length);\r\n    newform->length = length;\r\n    newform->line[length]=0; /* zero terminate for easier debugging */\r\n  }\r\n  else\r\n    /* For callbacks and files we don't have any actual data so we just keep a\r\n       pointer to whatever this points to */\r\n    newform->line = (char *)line;\r\n\r\n  newform->type = type;\r\n\r\n  if(*formp) {\r\n    (*formp)->next = newform;\r\n    *formp = newform;\r\n  }\r\n  else\r\n    *formp = newform;\r\n\r\n  if(size) {\r\n    if(type != FORM_FILE)\r\n      /* for static content as well as callback data we add the size given\r\n         as input argument */\r\n      *size += length;\r\n    else {\r\n      /* Since this is a file to be uploaded here, add the size of the actual\r\n         file */\r\n      if(!strequal(\"-\", newform->line)) {\r\n        struct_stat file;\r\n        if(!stat(newform->line, &file) && S_ISREG(file.st_mode))\r\n          *size += file.st_size;\r\n        else\r\n          return CURLE_BAD_FUNCTION_ARGUMENT;\r\n      }\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * AddFormDataf() adds printf()-style formatted data to the formdata chain.\r\n */\r\n\r\nstatic CURLcode AddFormDataf(struct FormData **formp,\r\n                             curl_off_t *size,\r\n                             const char *fmt, ...)\r\n{\r\n  char s[4096];\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n  vsnprintf(s, sizeof(s), fmt, ap);\r\n  va_end(ap);\r\n\r\n  return AddFormData(formp, FORM_DATA, s, 0, size);\r\n}\r\n\r\n/*\r\n * Curl_formclean() is used from http.c, this cleans a built FormData linked\r\n * list\r\n */\r\nvoid Curl_formclean(struct FormData **form_ptr)\r\n{\r\n  struct FormData *next, *form;\r\n\r\n  form = *form_ptr;\r\n  if(!form)\r\n    return;\r\n\r\n  do {\r\n    next=form->next;  /* the following form line */\r\n    if(form->type <= FORM_CONTENT)\r\n      free(form->line); /* free the line */\r\n    free(form);       /* free the struct */\r\n\r\n  } while((form = next) != NULL); /* continue */\r\n\r\n  *form_ptr = NULL;\r\n}\r\n\r\n/*\r\n * curl_formget()\r\n * Serialize a curl_httppost struct.\r\n * Returns 0 on success.\r\n *\r\n * @unittest: 1308\r\n */\r\nint curl_formget(struct curl_httppost *form, void *arg,\r\n                 curl_formget_callback append)\r\n{\r\n  CURLcode rc;\r\n  curl_off_t size;\r\n  struct FormData *data, *ptr;\r\n\r\n  rc = Curl_getformdata(NULL, &data, form, NULL, &size);\r\n  if(rc != CURLE_OK)\r\n    return (int)rc;\r\n\r\n  for(ptr = data; ptr; ptr = ptr->next) {\r\n    if((ptr->type == FORM_FILE) || (ptr->type == FORM_CALLBACK)) {\r\n      char buffer[8192];\r\n      size_t nread;\r\n      struct Form temp;\r\n\r\n      Curl_FormInit(&temp, ptr);\r\n\r\n      do {\r\n        nread = readfromfile(&temp, buffer, sizeof(buffer));\r\n        if((nread == (size_t) -1) ||\r\n           (nread > sizeof(buffer)) ||\r\n           (nread != append(arg, buffer, nread))) {\r\n          if(temp.fp)\r\n            fclose(temp.fp);\r\n          Curl_formclean(&data);\r\n          return -1;\r\n        }\r\n      } while(nread);\r\n    }\r\n    else {\r\n      if(ptr->length != append(arg, ptr->line, ptr->length)) {\r\n        Curl_formclean(&data);\r\n        return -1;\r\n      }\r\n    }\r\n  }\r\n  Curl_formclean(&data);\r\n  return 0;\r\n}\r\n\r\n/*\r\n * curl_formfree() is an external function to free up a whole form post\r\n * chain\r\n */\r\nvoid curl_formfree(struct curl_httppost *form)\r\n{\r\n  struct curl_httppost *next;\r\n\r\n  if(!form)\r\n    /* no form to free, just get out of this */\r\n    return;\r\n\r\n  do {\r\n    next=form->next;  /* the following form line */\r\n\r\n    /* recurse to sub-contents */\r\n    if(form->more)\r\n      curl_formfree(form->more);\r\n\r\n    if(!(form->flags & HTTPPOST_PTRNAME) && form->name)\r\n      free(form->name); /* free the name */\r\n    if(!(form->flags &\r\n         (HTTPPOST_PTRCONTENTS|HTTPPOST_BUFFER|HTTPPOST_CALLBACK)) &&\r\n       form->contents)\r\n      free(form->contents); /* free the contents */\r\n    if(form->contenttype)\r\n      free(form->contenttype); /* free the content type */\r\n    if(form->showfilename)\r\n      free(form->showfilename); /* free the faked file name */\r\n    free(form);       /* free the struct */\r\n\r\n  } while((form = next) != NULL); /* continue */\r\n}\r\n\r\n#ifndef HAVE_BASENAME\r\n/*\r\n  (Quote from The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004\r\n  Edition)\r\n\r\n  The basename() function shall take the pathname pointed to by path and\r\n  return a pointer to the final component of the pathname, deleting any\r\n  trailing '/' characters.\r\n\r\n  If the string pointed to by path consists entirely of the '/' character,\r\n  basename() shall return a pointer to the string \"/\". If the string pointed\r\n  to by path is exactly \"//\", it is implementation-defined whether '/' or \"//\"\r\n  is returned.\r\n\r\n  If path is a null pointer or points to an empty string, basename() shall\r\n  return a pointer to the string \".\".\r\n\r\n  The basename() function may modify the string pointed to by path, and may\r\n  return a pointer to static storage that may then be overwritten by a\r\n  subsequent call to basename().\r\n\r\n  The basename() function need not be reentrant. A function that is not\r\n  required to be reentrant is not required to be thread-safe.\r\n\r\n*/\r\nstatic char *Curl_basename(char *path)\r\n{\r\n  /* Ignore all the details above for now and make a quick and simple\r\n     implementaion here */\r\n  char *s1;\r\n  char *s2;\r\n\r\n  s1=strrchr(path, '/');\r\n  s2=strrchr(path, '\\\\');\r\n\r\n  if(s1 && s2) {\r\n    path = (s1 > s2? s1 : s2)+1;\r\n  }\r\n  else if(s1)\r\n    path = s1 + 1;\r\n  else if(s2)\r\n    path = s2 + 1;\r\n\r\n  return path;\r\n}\r\n#endif\r\n\r\nstatic char *strippath(const char *fullfile)\r\n{\r\n  char *filename;\r\n  char *base;\r\n  filename = strdup(fullfile); /* duplicate since basename() may ruin the\r\n                                  buffer it works on */\r\n  if(!filename)\r\n    return NULL;\r\n  base = strdup(basename(filename));\r\n\r\n  free(filename); /* free temporary buffer */\r\n\r\n  return base; /* returns an allocated string or NULL ! */\r\n}\r\n\r\nstatic CURLcode formdata_add_filename(const struct curl_httppost *file,\r\n                                      struct FormData **form,\r\n                                      curl_off_t *size)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  char *filename = file->showfilename;\r\n  char *filebasename = NULL;\r\n  char *filename_escaped = NULL;\r\n\r\n  if(!filename) {\r\n    filebasename = strippath(file->contents);\r\n    if(!filebasename)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    filename = filebasename;\r\n  }\r\n\r\n  if(strchr(filename, '\\\\') || strchr(filename, '\"')) {\r\n    char *p0, *p1;\r\n\r\n    /* filename need be escaped */\r\n    filename_escaped = malloc(strlen(filename)*2+1);\r\n    if(!filename_escaped)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    p0 = filename_escaped;\r\n    p1 = filename;\r\n    while(*p1) {\r\n      if(*p1 == '\\\\' || *p1 == '\"')\r\n        *p0++ = '\\\\';\r\n      *p0++ = *p1++;\r\n    }\r\n    *p0 = '\\0';\r\n    filename = filename_escaped;\r\n  }\r\n  result = AddFormDataf(form, size,\r\n                        \"; filename=\\\"%s\\\"\",\r\n                        filename);\r\n  Curl_safefree(filename_escaped);\r\n  Curl_safefree(filebasename);\r\n  return result;\r\n}\r\n\r\n/*\r\n * Curl_getformdata() converts a linked list of \"meta data\" into a complete\r\n * (possibly huge) multipart formdata. The input list is in 'post', while the\r\n * output resulting linked lists gets stored in '*finalform'. *sizep will get\r\n * the total size of the whole POST.\r\n * A multipart/form_data content-type is built, unless a custom content-type\r\n * is passed in 'custom_content_type'.\r\n *\r\n * This function will not do a failf() for the potential memory failures but\r\n * should for all other errors it spots. Just note that this function MAY get\r\n * a NULL pointer in the 'data' argument.\r\n */\r\n\r\nCURLcode Curl_getformdata(struct SessionHandle *data,\r\n                          struct FormData **finalform,\r\n                          struct curl_httppost *post,\r\n                          const char *custom_content_type,\r\n                          curl_off_t *sizep)\r\n{\r\n  struct FormData *form = NULL;\r\n  struct FormData *firstform;\r\n  struct curl_httppost *file;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  curl_off_t size = 0; /* support potentially ENORMOUS formposts */\r\n  char *boundary;\r\n  char *fileboundary = NULL;\r\n  struct curl_slist* curList;\r\n\r\n  *finalform = NULL; /* default form is empty */\r\n\r\n  if(!post)\r\n    return result; /* no input => no output! */\r\n\r\n  boundary = Curl_FormBoundary();\r\n  if(!boundary)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* Make the first line of the output */\r\n  result = AddFormDataf(&form, NULL,\r\n                        \"%s; boundary=%s\\r\\n\",\r\n                        custom_content_type?custom_content_type:\r\n                        \"Content-Type: multipart/form-data\",\r\n                        boundary);\r\n\r\n  if(result) {\r\n    Curl_safefree(boundary);\r\n    return result;\r\n  }\r\n  /* we DO NOT include that line in the total size of the POST, since it'll be\r\n     part of the header! */\r\n\r\n  firstform = form;\r\n\r\n  do {\r\n\r\n    if(size) {\r\n      result = AddFormDataf(&form, &size, \"\\r\\n\");\r\n      if(result)\r\n        break;\r\n    }\r\n\r\n    /* boundary */\r\n    result = AddFormDataf(&form, &size, \"--%s\\r\\n\", boundary);\r\n    if(result)\r\n      break;\r\n\r\n    /* Maybe later this should be disabled when a custom_content_type is\r\n       passed, since Content-Disposition is not meaningful for all multipart\r\n       types.\r\n    */\r\n    result = AddFormDataf(&form, &size,\r\n                          \"Content-Disposition: form-data; name=\\\"\");\r\n    if(result)\r\n      break;\r\n\r\n    result = AddFormData(&form, FORM_DATA, post->name, post->namelength,\r\n                         &size);\r\n    if(result)\r\n      break;\r\n\r\n    result = AddFormDataf(&form, &size, \"\\\"\");\r\n    if(result)\r\n      break;\r\n\r\n    if(post->more) {\r\n      /* If used, this is a link to more file names, we must then do\r\n         the magic to include several files with the same field name */\r\n\r\n      Curl_safefree(fileboundary);\r\n      fileboundary = Curl_FormBoundary();\r\n      if(!fileboundary) {\r\n        result = CURLE_OUT_OF_MEMORY;\r\n        break;\r\n      }\r\n\r\n      result = AddFormDataf(&form, &size,\r\n                            \"\\r\\nContent-Type: multipart/mixed,\"\r\n                            \" boundary=%s\\r\\n\",\r\n                            fileboundary);\r\n      if(result)\r\n        break;\r\n    }\r\n\r\n    file = post;\r\n\r\n    do {\r\n\r\n      /* If 'showfilename' is set, that is a faked name passed on to us\r\n         to use to in the formpost. If that is not set, the actually used\r\n         local file name should be added. */\r\n\r\n      if(post->more) {\r\n        /* if multiple-file */\r\n        result = AddFormDataf(&form, &size,\r\n                              \"\\r\\n--%s\\r\\nContent-Disposition: \"\r\n                              \"attachment\",\r\n                              fileboundary);\r\n        if(result)\r\n          break;\r\n        result = formdata_add_filename(file, &form, &size);\r\n        if(result)\r\n          break;\r\n      }\r\n      else if(post->flags & (HTTPPOST_FILENAME|HTTPPOST_BUFFER|\r\n                             HTTPPOST_CALLBACK)) {\r\n        /* it should be noted that for the HTTPPOST_FILENAME and\r\n           HTTPPOST_CALLBACK cases the ->showfilename struct member is always\r\n           assigned at this point */\r\n        if(post->showfilename || (post->flags & HTTPPOST_FILENAME)) {\r\n          result = formdata_add_filename(post, &form, &size);\r\n        }\r\n\r\n        if(result)\r\n          break;\r\n      }\r\n\r\n      if(file->contenttype) {\r\n        /* we have a specified type */\r\n        result = AddFormDataf(&form, &size,\r\n                              \"\\r\\nContent-Type: %s\",\r\n                              file->contenttype);\r\n        if(result)\r\n          break;\r\n      }\r\n\r\n      curList = file->contentheader;\r\n      while(curList) {\r\n        /* Process the additional headers specified for this form */\r\n        result = AddFormDataf( &form, &size, \"\\r\\n%s\", curList->data );\r\n        if(result)\r\n          break;\r\n        curList = curList->next;\r\n      }\r\n      if(result)\r\n        break;\r\n\r\n      result = AddFormDataf(&form, &size, \"\\r\\n\\r\\n\");\r\n      if(result)\r\n        break;\r\n\r\n      if((post->flags & HTTPPOST_FILENAME) ||\r\n         (post->flags & HTTPPOST_READFILE)) {\r\n        /* we should include the contents from the specified file */\r\n        FILE *fileread;\r\n\r\n        fileread = strequal(\"-\", file->contents)?\r\n          stdin:fopen(file->contents, \"rb\"); /* binary read for win32  */\r\n\r\n        /*\r\n         * VMS: This only allows for stream files on VMS.  Stream files are\r\n         * OK, as are FIXED & VAR files WITHOUT implied CC For implied CC,\r\n         * every record needs to have a \\n appended & 1 added to SIZE\r\n         */\r\n\r\n        if(fileread) {\r\n          if(fileread != stdin) {\r\n            /* close the file */\r\n            fclose(fileread);\r\n            /* add the file name only - for later reading from this */\r\n            result = AddFormData(&form, FORM_FILE, file->contents, 0, &size);\r\n          }\r\n          else {\r\n            /* When uploading from stdin, we can't know the size of the file,\r\n             * thus must read the full file as before. We *could* use chunked\r\n             * transfer-encoding, but that only works for HTTP 1.1 and we\r\n             * can't be sure we work with such a server.\r\n             */\r\n            size_t nread;\r\n            char buffer[512];\r\n            while((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) {\r\n              result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size);\r\n              if(result)\r\n                break;\r\n            }\r\n          }\r\n        }\r\n        else {\r\n          if(data)\r\n            failf(data, \"couldn't open file \\\"%s\\\"\", file->contents);\r\n          *finalform = NULL;\r\n          result = CURLE_READ_ERROR;\r\n        }\r\n      }\r\n      else if(post->flags & HTTPPOST_BUFFER)\r\n        /* include contents of buffer */\r\n        result = AddFormData(&form, FORM_CONTENT, post->buffer,\r\n                             post->bufferlength, &size);\r\n      else if(post->flags & HTTPPOST_CALLBACK)\r\n        /* the contents should be read with the callback and the size\r\n           is set with the contentslength */\r\n        result = AddFormData(&form, FORM_CALLBACK, post->userp,\r\n                             post->contentslength, &size);\r\n      else\r\n        /* include the contents we got */\r\n        result = AddFormData(&form, FORM_CONTENT, post->contents,\r\n                             post->contentslength, &size);\r\n\r\n      file = file->more;\r\n    } while(file && !result); /* for each specified file for this field */\r\n\r\n    if(result)\r\n      break;\r\n\r\n    if(post->more) {\r\n      /* this was a multiple-file inclusion, make a termination file\r\n         boundary: */\r\n      result = AddFormDataf(&form, &size,\r\n                           \"\\r\\n--%s--\",\r\n                           fileboundary);\r\n      if(result)\r\n        break;\r\n    }\r\n\r\n  } while((post = post->next) != NULL); /* for each field */\r\n\r\n  /* end-boundary for everything */\r\n  if(CURLE_OK == result)\r\n    result = AddFormDataf(&form, &size,\r\n                          \"\\r\\n--%s--\\r\\n\",\r\n                          boundary);\r\n\r\n  if(result) {\r\n    Curl_formclean(&firstform);\r\n    Curl_safefree(fileboundary);\r\n    Curl_safefree(boundary);\r\n    return result;\r\n  }\r\n\r\n  *sizep = size;\r\n\r\n  Curl_safefree(fileboundary);\r\n  Curl_safefree(boundary);\r\n\r\n  *finalform = firstform;\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * Curl_FormInit() inits the struct 'form' points to with the 'formdata'\r\n * and resets the 'sent' counter.\r\n */\r\nint Curl_FormInit(struct Form *form, struct FormData *formdata )\r\n{\r\n  if(!formdata)\r\n    return 1; /* error */\r\n\r\n  form->data = formdata;\r\n  form->sent = 0;\r\n  form->fp = NULL;\r\n  form->fread_func = ZERO_NULL;\r\n\r\n  return 0;\r\n}\r\n\r\n/*\r\n * readfromfile()\r\n *\r\n * The read callback that this function may use can return a value larger than\r\n * 'size' (which then this function returns) that indicates a problem and it\r\n * must be properly dealt with\r\n */\r\nstatic size_t readfromfile(struct Form *form, char *buffer,\r\n                           size_t size)\r\n{\r\n  size_t nread;\r\n  bool callback = (form->data->type == FORM_CALLBACK)?TRUE:FALSE;\r\n\r\n  if(callback) {\r\n    if(form->fread_func == ZERO_NULL)\r\n      return 0;\r\n    else\r\n      nread = form->fread_func(buffer, 1, size, form->data->line);\r\n  }\r\n  else {\r\n    if(!form->fp) {\r\n      /* this file hasn't yet been opened */\r\n      form->fp = fopen(form->data->line, \"rb\"); /* b is for binary */\r\n      if(!form->fp)\r\n        return (size_t)-1; /* failure */\r\n    }\r\n    nread = fread(buffer, 1, size, form->fp);\r\n  }\r\n  if(!nread) {\r\n    /* this is the last chunk from the file, move on */\r\n    if(form->fp) {\r\n      fclose(form->fp);\r\n      form->fp = NULL;\r\n    }\r\n    form->data = form->data->next;\r\n  }\r\n\r\n  return nread;\r\n}\r\n\r\n/*\r\n * Curl_FormReader() is the fread() emulation function that will be used to\r\n * deliver the formdata to the transfer loop and then sent away to the peer.\r\n */\r\nsize_t Curl_FormReader(char *buffer,\r\n                       size_t size,\r\n                       size_t nitems,\r\n                       FILE *mydata)\r\n{\r\n  struct Form *form;\r\n  size_t wantedsize;\r\n  size_t gotsize = 0;\r\n\r\n  form=(struct Form *)mydata;\r\n\r\n  wantedsize = size * nitems;\r\n\r\n  if(!form->data)\r\n    return 0; /* nothing, error, empty */\r\n\r\n  if((form->data->type == FORM_FILE) ||\r\n     (form->data->type == FORM_CALLBACK)) {\r\n    gotsize = readfromfile(form, buffer, wantedsize);\r\n\r\n    if(gotsize)\r\n      /* If positive or -1, return. If zero, continue! */\r\n      return gotsize;\r\n  }\r\n  do {\r\n\r\n    if((form->data->length - form->sent ) > wantedsize - gotsize) {\r\n\r\n      memcpy(buffer + gotsize , form->data->line + form->sent,\r\n             wantedsize - gotsize);\r\n\r\n      form->sent += wantedsize-gotsize;\r\n\r\n      return wantedsize;\r\n    }\r\n\r\n    memcpy(buffer+gotsize,\r\n           form->data->line + form->sent,\r\n           (form->data->length - form->sent) );\r\n    gotsize += form->data->length - form->sent;\r\n\r\n    form->sent = 0;\r\n\r\n    form->data = form->data->next; /* advance */\r\n\r\n  } while(form->data && (form->data->type < FORM_CALLBACK));\r\n  /* If we got an empty line and we have more data, we proceed to the next\r\n     line immediately to avoid returning zero before we've reached the end. */\r\n\r\n  return gotsize;\r\n}\r\n\r\n/*\r\n * Curl_formpostheader() returns the first line of the formpost, the\r\n * request-header part (which is not part of the request-body like the rest of\r\n * the post).\r\n */\r\nchar *Curl_formpostheader(void *formp, size_t *len)\r\n{\r\n  char *header;\r\n  struct Form *form=(struct Form *)formp;\r\n\r\n  if(!form->data)\r\n    return 0; /* nothing, ERROR! */\r\n\r\n  header = form->data->line;\r\n  *len = form->data->length;\r\n\r\n  form->data = form->data->next; /* advance */\r\n\r\n  return header;\r\n}\r\n\r\n#else  /* CURL_DISABLE_HTTP */\r\nCURLFORMcode curl_formadd(struct curl_httppost **httppost,\r\n                          struct curl_httppost **last_post,\r\n                          ...)\r\n{\r\n  (void)httppost;\r\n  (void)last_post;\r\n  return CURL_FORMADD_DISABLED;\r\n}\r\n\r\nint curl_formget(struct curl_httppost *form, void *arg,\r\n                 curl_formget_callback append)\r\n{\r\n  (void) form;\r\n  (void) arg;\r\n  (void) append;\r\n  return CURL_FORMADD_DISABLED;\r\n}\r\n\r\nvoid curl_formfree(struct curl_httppost *form)\r\n{\r\n  (void)form;\r\n  /* does nothing HTTP is disabled */\r\n}\r\n\r\n#endif  /* CURL_DISABLE_HTTP */\r\n\r\n#if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY)\r\n\r\n/*\r\n * Curl_FormBoundary() creates a suitable boundary string and returns an\r\n * allocated one. This is also used by SSL-code so it must be present even\r\n * if HTTP is disabled!\r\n */\r\nchar *Curl_FormBoundary(void)\r\n{\r\n  char *retstring;\r\n  size_t i;\r\n\r\n  static const char table16[]=\"0123456789abcdef\";\r\n\r\n  retstring = malloc(BOUNDARY_LENGTH+1);\r\n\r\n  if(!retstring)\r\n    return NULL; /* failed */\r\n\r\n  strcpy(retstring, \"----------------------------\");\r\n\r\n  for(i=strlen(retstring); i<BOUNDARY_LENGTH; i++)\r\n    retstring[i] = table16[Curl_rand()%16];\r\n\r\n  /* 28 dashes and 12 hexadecimal digits makes 12^16 (184884258895036416)\r\n     combinations */\r\n  retstring[BOUNDARY_LENGTH]=0; /* zero terminate */\r\n\r\n  return retstring;\r\n}\r\n\r\n#endif  /* !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/formdata.h",
    "content": "#ifndef HEADER_CURL_FORMDATA_H\r\n#define HEADER_CURL_FORMDATA_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nenum formtype {\r\n  FORM_DATA,    /* form metadata (convert to network encoding if necessary) */\r\n  FORM_CONTENT, /* form content  (never convert) */\r\n  FORM_CALLBACK, /* 'line' points to the custom pointer we pass to the callback\r\n                  */\r\n  FORM_FILE     /* 'line' points to a file name we should read from\r\n                   to create the form data (never convert) */\r\n};\r\n\r\n/* plain and simple linked list with lines to send */\r\nstruct FormData {\r\n  struct FormData *next;\r\n  enum formtype type;\r\n  char *line;\r\n  size_t length;\r\n};\r\n\r\nstruct Form {\r\n  struct FormData *data; /* current form line to send */\r\n  size_t sent;           /* number of bytes of the current line that has\r\n                            already been sent in a previous invoke */\r\n  FILE *fp;              /* file to read from */\r\n  curl_read_callback fread_func; /* fread callback pointer */\r\n};\r\n\r\n/* used by FormAdd for temporary storage */\r\ntypedef struct FormInfo {\r\n  char *name;\r\n  bool name_alloc;\r\n  size_t namelength;\r\n  char *value;\r\n  bool value_alloc;\r\n  size_t contentslength;\r\n  char *contenttype;\r\n  bool contenttype_alloc;\r\n  long flags;\r\n  char *buffer;      /* pointer to existing buffer used for file upload */\r\n  size_t bufferlength;\r\n  char *showfilename; /* The file name to show. If not set, the actual\r\n                         file name will be used */\r\n  bool showfilename_alloc;\r\n  char *userp;        /* pointer for the read callback */\r\n  struct curl_slist* contentheader;\r\n  struct FormInfo *more;\r\n} FormInfo;\r\n\r\nint Curl_FormInit(struct Form *form, struct FormData *formdata );\r\n\r\nCURLcode Curl_getformdata(struct SessionHandle *data,\r\n                          struct FormData **,\r\n                          struct curl_httppost *post,\r\n                          const char *custom_contenttype,\r\n                          curl_off_t *size);\r\n\r\n/* fread() emulation */\r\nsize_t Curl_FormReader(char *buffer,\r\n                       size_t size,\r\n                       size_t nitems,\r\n                       FILE *mydata);\r\n\r\n/*\r\n * Curl_formpostheader() returns the first line of the formpost, the\r\n * request-header part (which is not part of the request-body like the rest of\r\n * the post).\r\n */\r\nchar *Curl_formpostheader(void *formp, size_t *len);\r\n\r\nchar *Curl_FormBoundary(void);\r\n\r\nvoid Curl_formclean(struct FormData **);\r\n\r\nCURLcode Curl_formconvert(struct SessionHandle *, struct FormData *);\r\n\r\n#endif /* HEADER_CURL_FORMDATA_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ftp.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_UTSNAME_H\r\n#include <sys/utsname.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"if2ip.h\"\r\n#include \"hostip.h\"\r\n#include \"progress.h\"\r\n#include \"transfer.h\"\r\n#include \"escape.h\"\r\n#include \"http.h\" /* for HTTP proxy tunnel stuff */\r\n#include \"socks.h\"\r\n#include \"ftp.h\"\r\n#include \"fileinfo.h\"\r\n#include \"ftplistparser.h\"\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n#include \"krb4.h\"\r\n#endif\r\n\r\n#include \"strtoofft.h\"\r\n#include \"strequal.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"inet_ntop.h\"\r\n#include \"inet_pton.h\"\r\n#include \"select.h\"\r\n#include \"parsedate.h\" /* for the week day and month names */\r\n#include \"sockaddr.h\" /* required for Curl_sockaddr_storage */\r\n#include \"multiif.h\"\r\n#include \"url.h\"\r\n#include \"rawstr.h\"\r\n#include \"speedcheck.h\"\r\n#include \"warnless.h\"\r\n#include \"http_proxy.h\"\r\n#include \"non-ascii.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifndef NI_MAXHOST\r\n#define NI_MAXHOST 1025\r\n#endif\r\n#ifndef INET_ADDRSTRLEN\r\n#define INET_ADDRSTRLEN 16\r\n#endif\r\n\r\n#ifdef CURL_DISABLE_VERBOSE_STRINGS\r\n#define ftp_pasv_verbose(a,b,c,d)  Curl_nop_stmt\r\n#endif\r\n\r\n/* Local API functions */\r\n#ifndef DEBUGBUILD\r\nstatic void _state(struct connectdata *conn,\r\n                   ftpstate newstate);\r\n#define state(x,y) _state(x,y)\r\n#else\r\nstatic void _state(struct connectdata *conn,\r\n                   ftpstate newstate,\r\n                   int lineno);\r\n#define state(x,y) _state(x,y,__LINE__)\r\n#endif\r\n\r\nstatic CURLcode ftp_sendquote(struct connectdata *conn,\r\n                              struct curl_slist *quote);\r\nstatic CURLcode ftp_quit(struct connectdata *conn);\r\nstatic CURLcode ftp_parse_url_path(struct connectdata *conn);\r\nstatic CURLcode ftp_regular_transfer(struct connectdata *conn, bool *done);\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\nstatic void ftp_pasv_verbose(struct connectdata *conn,\r\n                             Curl_addrinfo *ai,\r\n                             char *newhost, /* ascii version */\r\n                             int port);\r\n#endif\r\nstatic CURLcode ftp_state_post_rest(struct connectdata *conn);\r\nstatic CURLcode ftp_state_post_cwd(struct connectdata *conn);\r\nstatic CURLcode ftp_state_quote(struct connectdata *conn,\r\n                                bool init, ftpstate instate);\r\nstatic CURLcode ftp_nb_type(struct connectdata *conn,\r\n                            bool ascii, ftpstate newstate);\r\nstatic int ftp_need_type(struct connectdata *conn,\r\n                         bool ascii);\r\nstatic CURLcode ftp_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode ftp_done(struct connectdata *conn,\r\n                         CURLcode, bool premature);\r\nstatic CURLcode ftp_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection);\r\nstatic CURLcode ftp_do_more(struct connectdata *conn, bool *completed);\r\nstatic CURLcode ftp_multi_statemach(struct connectdata *conn, bool *done);\r\nstatic int ftp_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                       int numsocks);\r\nstatic int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                              int numsocks);\r\nstatic CURLcode ftp_doing(struct connectdata *conn,\r\n                          bool *dophase_done);\r\nstatic CURLcode ftp_setup_connection(struct connectdata * conn);\r\n\r\nstatic CURLcode init_wc_data(struct connectdata *conn);\r\nstatic CURLcode wc_statemach(struct connectdata *conn);\r\n\r\nstatic void wc_data_dtor(void *ptr);\r\n\r\nstatic CURLcode ftp_state_post_retr_size(struct connectdata *conn,\r\n                                         curl_off_t filesize);\r\n\r\nstatic CURLcode ftp_readresp(curl_socket_t sockfd,\r\n                             struct pingpong *pp,\r\n                             int *ftpcode,\r\n                             size_t *size);\r\nstatic CURLcode ftp_dophase_done(struct connectdata *conn,\r\n                                 bool connected);\r\n\r\n/* easy-to-use macro: */\r\n#define FTPSENDF(x,y,z)    if((result = Curl_ftpsendf(x,y,z)) != CURLE_OK) \\\r\n                              return result\r\n#define PPSENDF(x,y,z)  if((result = Curl_pp_sendf(x,y,z)) != CURLE_OK) \\\r\n                              return result\r\n\r\n\r\n/*\r\n * FTP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_ftp = {\r\n  \"FTP\",                           /* scheme */\r\n  ftp_setup_connection,            /* setup_connection */\r\n  ftp_do,                          /* do_it */\r\n  ftp_done,                        /* done */\r\n  ftp_do_more,                     /* do_more */\r\n  ftp_connect,                     /* connect_it */\r\n  ftp_multi_statemach,             /* connecting */\r\n  ftp_doing,                       /* doing */\r\n  ftp_getsock,                     /* proto_getsock */\r\n  ftp_getsock,                     /* doing_getsock */\r\n  ftp_domore_getsock,              /* domore_getsock */\r\n  ZERO_NULL,                       /* perform_getsock */\r\n  ftp_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                       /* readwrite */\r\n  PORT_FTP,                        /* defport */\r\n  CURLPROTO_FTP,                   /* protocol */\r\n  PROTOPT_DUAL | PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD\r\n  | PROTOPT_NOURLQUERY /* flags */\r\n};\r\n\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * FTPS protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_ftps = {\r\n  \"FTPS\",                          /* scheme */\r\n  ftp_setup_connection,            /* setup_connection */\r\n  ftp_do,                          /* do_it */\r\n  ftp_done,                        /* done */\r\n  ftp_do_more,                     /* do_more */\r\n  ftp_connect,                     /* connect_it */\r\n  ftp_multi_statemach,             /* connecting */\r\n  ftp_doing,                       /* doing */\r\n  ftp_getsock,                     /* proto_getsock */\r\n  ftp_getsock,                     /* doing_getsock */\r\n  ftp_domore_getsock,              /* domore_getsock */\r\n  ZERO_NULL,                       /* perform_getsock */\r\n  ftp_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                       /* readwrite */\r\n  PORT_FTPS,                       /* defport */\r\n  CURLPROTO_FTP | CURLPROTO_FTPS,  /* protocol */\r\n  PROTOPT_SSL | PROTOPT_DUAL | PROTOPT_CLOSEACTION |\r\n  PROTOPT_NEEDSPWD | PROTOPT_NOURLQUERY /* flags */\r\n};\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n/*\r\n * HTTP-proxyed FTP protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_ftp_proxy = {\r\n  \"FTP\",                                /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_FTP,                             /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * HTTP-proxyed FTPS protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_ftps_proxy = {\r\n  \"FTPS\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_FTPS,                            /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n#endif\r\n#endif\r\n\r\n\r\n/*\r\n * NOTE: back in the old days, we added code in the FTP code that made NOBODY\r\n * requests on files respond with headers passed to the client/stdout that\r\n * looked like HTTP ones.\r\n *\r\n * This approach is not very elegant, it causes confusion and is error-prone.\r\n * It is subject for removal at the next (or at least a future) soname bump.\r\n * Until then you can test the effects of the removal by undefining the\r\n * following define named CURL_FTP_HTTPSTYLE_HEAD.\r\n */\r\n#define CURL_FTP_HTTPSTYLE_HEAD 1\r\n\r\nstatic void freedirs(struct ftp_conn *ftpc)\r\n{\r\n  int i;\r\n  if(ftpc->dirs) {\r\n    for(i=0; i < ftpc->dirdepth; i++) {\r\n      if(ftpc->dirs[i]) {\r\n        free(ftpc->dirs[i]);\r\n        ftpc->dirs[i]=NULL;\r\n      }\r\n    }\r\n    free(ftpc->dirs);\r\n    ftpc->dirs = NULL;\r\n    ftpc->dirdepth = 0;\r\n  }\r\n  if(ftpc->file) {\r\n    free(ftpc->file);\r\n    ftpc->file = NULL;\r\n  }\r\n}\r\n\r\n/* Returns non-zero if the given string contains CR (\\r) or LF (\\n),\r\n   which are not allowed within RFC 959 <string>.\r\n   Note: The input string is in the client's encoding which might\r\n   not be ASCII, so escape sequences \\r & \\n must be used instead\r\n   of hex values 0x0d & 0x0a.\r\n*/\r\nstatic bool isBadFtpString(const char *string)\r\n{\r\n  return ((NULL != strchr(string, '\\r')) ||\r\n          (NULL != strchr(string, '\\n'))) ? TRUE : FALSE;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * AcceptServerConnect()\r\n *\r\n * After connection request is received from the server this function is\r\n * called to accept the connection and close the listening socket\r\n *\r\n */\r\nstatic CURLcode AcceptServerConnect(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sock = conn->sock[SECONDARYSOCKET];\r\n  curl_socket_t s = CURL_SOCKET_BAD;\r\n#ifdef ENABLE_IPV6\r\n  struct Curl_sockaddr_storage add;\r\n#else\r\n  struct sockaddr_in add;\r\n#endif\r\n  curl_socklen_t size = (curl_socklen_t) sizeof(add);\r\n\r\n  if(0 == getsockname(sock, (struct sockaddr *) &add, &size)) {\r\n    size = sizeof(add);\r\n\r\n    s=accept(sock, (struct sockaddr *) &add, &size);\r\n  }\r\n  Curl_closesocket(conn, sock); /* close the first socket */\r\n\r\n  if(CURL_SOCKET_BAD == s) {\r\n    failf(data, \"Error accept()ing server connect\");\r\n    return CURLE_FTP_PORT_FAILED;\r\n  }\r\n  infof(data, \"Connection accepted from server\\n\");\r\n\r\n  conn->sock[SECONDARYSOCKET] = s;\r\n  curlx_nonblock(s, TRUE); /* enable non-blocking */\r\n  conn->sock_accepted[SECONDARYSOCKET] = TRUE;\r\n\r\n  if(data->set.fsockopt) {\r\n    int error = 0;\r\n\r\n    /* activate callback for setting socket options */\r\n    error = data->set.fsockopt(data->set.sockopt_client,\r\n                               s,\r\n                               CURLSOCKTYPE_ACCEPT);\r\n\r\n    if(error) {\r\n      Curl_closesocket(conn, s); /* close the socket and bail out */\r\n      conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;\r\n      return CURLE_ABORTED_BY_CALLBACK;\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n\r\n}\r\n\r\n/*\r\n * ftp_timeleft_accept() returns the amount of milliseconds left allowed for\r\n * waiting server to connect. If the value is negative, the timeout time has\r\n * already elapsed.\r\n *\r\n * The start time is stored in progress.t_acceptdata - as set with\r\n * Curl_pgrsTime(..., TIMER_STARTACCEPT);\r\n *\r\n */\r\nstatic long ftp_timeleft_accept(struct SessionHandle *data)\r\n{\r\n  long timeout_ms = DEFAULT_ACCEPT_TIMEOUT;\r\n  long other;\r\n  struct timeval now;\r\n\r\n  if(data->set.accepttimeout > 0)\r\n    timeout_ms = data->set.accepttimeout;\r\n\r\n  now = Curl_tvnow();\r\n\r\n  /* check if the generic timeout possibly is set shorter */\r\n  other =  Curl_timeleft(data, &now, FALSE);\r\n  if(other && (other < timeout_ms))\r\n    /* note that this also works fine for when other happens to be negative\r\n       due to it already having elapsed */\r\n    timeout_ms = other;\r\n  else {\r\n    /* subtract elapsed time */\r\n    timeout_ms -= Curl_tvdiff(now, data->progress.t_acceptdata);\r\n    if(!timeout_ms)\r\n      /* avoid returning 0 as that means no timeout! */\r\n      return -1;\r\n  }\r\n\r\n  return timeout_ms;\r\n}\r\n\r\n\r\n/***********************************************************************\r\n *\r\n * ReceivedServerConnect()\r\n *\r\n * After allowing server to connect to us from data port, this function\r\n * checks both data connection for connection establishment and ctrl\r\n * connection for a negative response regarding a failure in connecting\r\n *\r\n */\r\nstatic CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t ctrl_sock = conn->sock[FIRSTSOCKET];\r\n  curl_socket_t data_sock = conn->sock[SECONDARYSOCKET];\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n  int result;\r\n  long timeout_ms;\r\n  ssize_t nread;\r\n  int ftpcode;\r\n\r\n  *received = FALSE;\r\n\r\n  timeout_ms = ftp_timeleft_accept(data);\r\n  infof(data, \"Checking for server connect\\n\");\r\n  if(timeout_ms < 0) {\r\n    /* if a timeout was already reached, bail out */\r\n    failf(data, \"Accept timeout occurred while waiting server connect\");\r\n    return CURLE_FTP_ACCEPT_TIMEOUT;\r\n  }\r\n\r\n  /* First check whether there is a cached response from server */\r\n  if(pp->cache_size && pp->cache && pp->cache[0] > '3') {\r\n    /* Data connection could not be established, let's return */\r\n    infof(data, \"There is negative response in cache while serv connect\\n\");\r\n    Curl_GetFTPResponse(&nread, conn, &ftpcode);\r\n    return CURLE_FTP_ACCEPT_FAILED;\r\n  }\r\n\r\n  result = Curl_socket_check(ctrl_sock, data_sock, CURL_SOCKET_BAD, 0);\r\n\r\n  /* see if the connection request is already here */\r\n  switch (result) {\r\n  case -1: /* error */\r\n    /* let's die here */\r\n    failf(data, \"Error while waiting for server connect\");\r\n    return CURLE_FTP_ACCEPT_FAILED;\r\n  case 0:  /* Server connect is not received yet */\r\n    break; /* loop */\r\n  default:\r\n\r\n    if(result & CURL_CSELECT_IN2) {\r\n      infof(data, \"Ready to accept data connection from server\\n\");\r\n      *received = TRUE;\r\n    }\r\n    else if(result & CURL_CSELECT_IN) {\r\n      infof(data, \"Ctrl conn has data while waiting for data conn\\n\");\r\n      Curl_GetFTPResponse(&nread, conn, &ftpcode);\r\n\r\n      if(ftpcode/100 > 3)\r\n        return CURLE_FTP_ACCEPT_FAILED;\r\n\r\n      return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n    }\r\n\r\n    break;\r\n  } /* switch() */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/***********************************************************************\r\n *\r\n * InitiateTransfer()\r\n *\r\n * After connection from server is accepted this function is called to\r\n * setup transfer parameters and initiate the data transfer.\r\n *\r\n */\r\nstatic CURLcode InitiateTransfer(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  if(conn->ssl[SECONDARYSOCKET].use) {\r\n    /* since we only have a plaintext TCP connection here, we must now\r\n     * do the TLS stuff */\r\n    infof(data, \"Doing the SSL/TLS handshake on the data stream\\n\");\r\n    result = Curl_ssl_connect(conn, SECONDARYSOCKET);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  if(conn->proto.ftpc.state_saved == FTP_STOR) {\r\n    *(ftp->bytecountp)=0;\r\n\r\n    /* When we know we're uploading a specified file, we can get the file\r\n       size prior to the actual upload. */\r\n\r\n    Curl_pgrsSetUploadSize(data, data->set.infilesize);\r\n\r\n    /* set the SO_SNDBUF for the secondary socket for those who need it */\r\n    Curl_sndbufset(conn->sock[SECONDARYSOCKET]);\r\n\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */\r\n                        SECONDARYSOCKET, ftp->bytecountp);\r\n  }\r\n  else {\r\n    /* FTP download: */\r\n    Curl_setup_transfer(conn, SECONDARYSOCKET,\r\n                        conn->proto.ftpc.retr_size_saved, FALSE,\r\n                        ftp->bytecountp, -1, NULL); /* no upload here */\r\n  }\r\n\r\n  conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */\r\n  state(conn, FTP_STOP);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * AllowServerConnect()\r\n *\r\n * When we've issue the PORT command, we have told the server to connect to\r\n * us. This function checks whether data connection is established if so it is\r\n * accepted.\r\n *\r\n */\r\nstatic CURLcode AllowServerConnect(struct connectdata *conn, bool *connected)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  long timeout_ms;\r\n  CURLcode ret = CURLE_OK;\r\n\r\n  *connected = FALSE;\r\n  infof(data, \"Preparing for accepting server on data port\\n\");\r\n\r\n  /* Save the time we start accepting server connect */\r\n  Curl_pgrsTime(data, TIMER_STARTACCEPT);\r\n\r\n  timeout_ms = ftp_timeleft_accept(data);\r\n  if(timeout_ms < 0) {\r\n    /* if a timeout was already reached, bail out */\r\n    failf(data, \"Accept timeout occurred while waiting server connect\");\r\n    return CURLE_FTP_ACCEPT_TIMEOUT;\r\n  }\r\n\r\n  /* see if the connection request is already here */\r\n  ret = ReceivedServerConnect(conn, connected);\r\n  if(ret)\r\n    return ret;\r\n\r\n  if(*connected) {\r\n    ret = AcceptServerConnect(conn);\r\n    if(ret)\r\n      return ret;\r\n\r\n    ret = InitiateTransfer(conn);\r\n    if(ret)\r\n      return ret;\r\n  }\r\n  else {\r\n    /* Add timeout to multi handle and break out of the loop */\r\n    if(ret == CURLE_OK && *connected == FALSE) {\r\n      if(data->set.accepttimeout > 0)\r\n        Curl_expire(data, data->set.accepttimeout);\r\n      else\r\n        Curl_expire(data, DEFAULT_ACCEPT_TIMEOUT);\r\n    }\r\n  }\r\n\r\n  return ret;\r\n}\r\n\r\n/* macro to check for a three-digit ftp status code at the start of the\r\n   given string */\r\n#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) &&       \\\r\n                          ISDIGIT(line[2]))\r\n\r\n/* macro to check for the last line in an FTP server response */\r\n#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3]))\r\n\r\nstatic int ftp_endofresp(struct pingpong *pp,\r\n                         int *code)\r\n{\r\n  char *line = pp->linestart_resp;\r\n  size_t len = pp->nread_resp;\r\n\r\n  if((len > 3) && LASTLINE(line)) {\r\n    *code = curlx_sltosi(strtol(line, NULL, 10));\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\nstatic CURLcode ftp_readresp(curl_socket_t sockfd,\r\n                             struct pingpong *pp,\r\n                             int *ftpcode, /* return the ftp-code if done */\r\n                             size_t *size) /* size of the response */\r\n{\r\n  struct connectdata *conn = pp->conn;\r\n  struct SessionHandle *data = conn->data;\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  char * const buf = data->state.buffer;\r\n#endif\r\n  CURLcode result = CURLE_OK;\r\n  int code;\r\n\r\n  result = Curl_pp_readresp(sockfd, pp, &code, size);\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  /* handle the security-oriented responses 6xx ***/\r\n  /* FIXME: some errorchecking perhaps... ***/\r\n  switch(code) {\r\n  case 631:\r\n    code = Curl_sec_read_msg(conn, buf, PROT_SAFE);\r\n    break;\r\n  case 632:\r\n    code = Curl_sec_read_msg(conn, buf, PROT_PRIVATE);\r\n    break;\r\n  case 633:\r\n    code = Curl_sec_read_msg(conn, buf, PROT_CONFIDENTIAL);\r\n    break;\r\n  default:\r\n    /* normal ftp stuff we pass through! */\r\n    break;\r\n  }\r\n#endif\r\n\r\n  /* store the latest code for later retrieval */\r\n  data->info.httpcode=code;\r\n\r\n  if(ftpcode)\r\n    *ftpcode = code;\r\n\r\n  if(421 == code) {\r\n    /* 421 means \"Service not available, closing control connection.\" and FTP\r\n     * servers use it to signal that idle session timeout has been exceeded.\r\n     * If we ignored the response, it could end up hanging in some cases.\r\n     *\r\n     * This response code can come at any point so having it treated\r\n     * generically is a good idea.\r\n     */\r\n    infof(data, \"We got a 421 - timeout!\\n\");\r\n    state(conn, FTP_STOP);\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* --- parse FTP server responses --- */\r\n\r\n/*\r\n * Curl_GetFTPResponse() is a BLOCKING function to read the full response\r\n * from a server after a command.\r\n *\r\n */\r\n\r\nCURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */\r\n                             struct connectdata *conn,\r\n                             int *ftpcode) /* return the ftp-code */\r\n{\r\n  /*\r\n   * We cannot read just one byte per read() and then go back to select() as\r\n   * the OpenSSL read() doesn't grok that properly.\r\n   *\r\n   * Alas, read as much as possible, split up into lines, use the ending\r\n   * line in a response or continue reading.  */\r\n\r\n  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];\r\n  long timeout;              /* timeout in milliseconds */\r\n  long interval_ms;\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode result = CURLE_OK;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n  size_t nread;\r\n  int cache_skip=0;\r\n  int value_to_be_ignored=0;\r\n\r\n  if(ftpcode)\r\n    *ftpcode = 0; /* 0 for errors */\r\n  else\r\n    /* make the pointer point to something for the rest of this function */\r\n    ftpcode = &value_to_be_ignored;\r\n\r\n  *nreadp=0;\r\n\r\n  while(!*ftpcode && !result) {\r\n    /* check and reset timeout value every lap */\r\n    timeout = Curl_pp_state_timeout(pp);\r\n\r\n    if(timeout <=0 ) {\r\n      failf(data, \"FTP response timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT; /* already too little time */\r\n    }\r\n\r\n    interval_ms = 1000;  /* use 1 second timeout intervals */\r\n    if(timeout < interval_ms)\r\n      interval_ms = timeout;\r\n\r\n    /*\r\n     * Since this function is blocking, we need to wait here for input on the\r\n     * connection and only then we call the response reading function. We do\r\n     * timeout at least every second to make the timeout check run.\r\n     *\r\n     * A caution here is that the ftp_readresp() function has a cache that may\r\n     * contain pieces of a response from the previous invoke and we need to\r\n     * make sure we don't just wait for input while there is unhandled data in\r\n     * that cache. But also, if the cache is there, we call ftp_readresp() and\r\n     * the cache wasn't good enough to continue we must not just busy-loop\r\n     * around this function.\r\n     *\r\n     */\r\n\r\n    if(pp->cache && (cache_skip < 2)) {\r\n      /*\r\n       * There's a cache left since before. We then skipping the wait for\r\n       * socket action, unless this is the same cache like the previous round\r\n       * as then the cache was deemed not enough to act on and we then need to\r\n       * wait for more data anyway.\r\n       */\r\n    }\r\n    else {\r\n      switch (Curl_socket_ready(sockfd, CURL_SOCKET_BAD, interval_ms)) {\r\n      case -1: /* select() error, stop reading */\r\n        failf(data, \"FTP response aborted due to select/poll error: %d\",\r\n              SOCKERRNO);\r\n        return CURLE_RECV_ERROR;\r\n\r\n      case 0: /* timeout */\r\n        if(Curl_pgrsUpdate(conn))\r\n          return CURLE_ABORTED_BY_CALLBACK;\r\n        continue; /* just continue in our loop for the timeout duration */\r\n\r\n      default: /* for clarity */\r\n        break;\r\n      }\r\n    }\r\n    result = ftp_readresp(sockfd, pp, ftpcode, &nread);\r\n    if(result)\r\n      break;\r\n\r\n    if(!nread && pp->cache)\r\n      /* bump cache skip counter as on repeated skips we must wait for more\r\n         data */\r\n      cache_skip++;\r\n    else\r\n      /* when we got data or there is no cache left, we reset the cache skip\r\n         counter */\r\n      cache_skip=0;\r\n\r\n    *nreadp += nread;\r\n\r\n  } /* while there's buffer left and loop is requested */\r\n\r\n  pp->pending_resp = FALSE;\r\n\r\n  return result;\r\n}\r\n\r\n/* This is the ONLY way to change FTP state! */\r\nstatic void _state(struct connectdata *conn,\r\n                   ftpstate newstate\r\n#ifdef DEBUGBUILD\r\n                   , int lineno\r\n#endif\r\n  )\r\n{\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  /* for debug purposes */\r\n  static const char * const names[]={\r\n    \"STOP\",\r\n    \"WAIT220\",\r\n    \"AUTH\",\r\n    \"USER\",\r\n    \"PASS\",\r\n    \"ACCT\",\r\n    \"PBSZ\",\r\n    \"PROT\",\r\n    \"CCC\",\r\n    \"PWD\",\r\n    \"SYST\",\r\n    \"NAMEFMT\",\r\n    \"QUOTE\",\r\n    \"RETR_PREQUOTE\",\r\n    \"STOR_PREQUOTE\",\r\n    \"POSTQUOTE\",\r\n    \"CWD\",\r\n    \"MKD\",\r\n    \"MDTM\",\r\n    \"TYPE\",\r\n    \"LIST_TYPE\",\r\n    \"RETR_TYPE\",\r\n    \"STOR_TYPE\",\r\n    \"SIZE\",\r\n    \"RETR_SIZE\",\r\n    \"STOR_SIZE\",\r\n    \"REST\",\r\n    \"RETR_REST\",\r\n    \"PORT\",\r\n    \"PRET\",\r\n    \"PASV\",\r\n    \"LIST\",\r\n    \"RETR\",\r\n    \"STOR\",\r\n    \"QUIT\"\r\n  };\r\n#endif\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  if(ftpc->state != newstate)\r\n    infof(conn->data, \"FTP %p (line %d) state change from %s to %s\\n\",\r\n          ftpc, lineno, names[ftpc->state], names[newstate]);\r\n#endif\r\n  ftpc->state = newstate;\r\n}\r\n\r\nstatic CURLcode ftp_state_user(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  /* send USER */\r\n  PPSENDF(&conn->proto.ftpc.pp, \"USER %s\", ftp->user?ftp->user:\"\");\r\n\r\n  state(conn, FTP_USER);\r\n  conn->data->state.ftp_trying_alternative = FALSE;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode ftp_state_pwd(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n\r\n  /* send PWD to discover our entry point */\r\n  PPSENDF(&conn->proto.ftpc.pp, \"PWD\", NULL);\r\n  state(conn, FTP_PWD);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* For the FTP \"protocol connect\" and \"doing\" phases only */\r\nstatic int ftp_getsock(struct connectdata *conn,\r\n                       curl_socket_t *socks,\r\n                       int numsocks)\r\n{\r\n  return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);\r\n}\r\n\r\n/* For the FTP \"DO_MORE\" phase only */\r\nstatic int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                              int numsocks)\r\n{\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if(!numsocks)\r\n    return GETSOCK_BLANK;\r\n\r\n  /* When in DO_MORE state, we could be either waiting for us to connect to a\r\n     remote site, or we could wait for that site to connect to us. Or just\r\n     handle ordinary commands.\r\n\r\n     When waiting for a connect, we will be in FTP_STOP state and then we wait\r\n     for the secondary socket to become writeable. If we're in another state,\r\n     we're still handling commands on the control (primary) connection.\r\n\r\n  */\r\n\r\n  switch(ftpc->state) {\r\n  case FTP_STOP:\r\n    break;\r\n  default:\r\n    return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);\r\n  }\r\n\r\n  socks[0] = conn->sock[SECONDARYSOCKET];\r\n  if(ftpc->wait_data_conn) {\r\n    socks[1] = conn->sock[FIRSTSOCKET];\r\n    return GETSOCK_READSOCK(0) | GETSOCK_READSOCK(1);\r\n  }\r\n\r\n  return GETSOCK_READSOCK(0);\r\n}\r\n\r\n/* This is called after the FTP_QUOTE state is passed.\r\n\r\n   ftp_state_cwd() sends the range of CWD commands to the server to change to\r\n   the correct directory. It may also need to send MKD commands to create\r\n   missing ones, if that option is enabled.\r\n*/\r\nstatic CURLcode ftp_state_cwd(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if(ftpc->cwddone)\r\n    /* already done and fine */\r\n    result = ftp_state_post_cwd(conn);\r\n  else {\r\n    ftpc->count2 = 0; /* count2 counts failed CWDs */\r\n\r\n    /* count3 is set to allow a MKD to fail once. In the case when first CWD\r\n       fails and then MKD fails (due to another session raced it to create the\r\n       dir) this then allows for a second try to CWD to it */\r\n    ftpc->count3 = (conn->data->set.ftp_create_missing_dirs==2)?1:0;\r\n\r\n    if(conn->bits.reuse && ftpc->entrypath) {\r\n      /* This is a re-used connection. Since we change directory to where the\r\n         transfer is taking place, we must first get back to the original dir\r\n         where we ended up after login: */\r\n      ftpc->count1 = 0; /* we count this as the first path, then we add one\r\n                          for all upcoming ones in the ftp->dirs[] array */\r\n      PPSENDF(&conn->proto.ftpc.pp, \"CWD %s\", ftpc->entrypath);\r\n      state(conn, FTP_CWD);\r\n    }\r\n    else {\r\n      if(ftpc->dirdepth) {\r\n        ftpc->count1 = 1;\r\n        /* issue the first CWD, the rest is sent when the CWD responses are\r\n           received... */\r\n        PPSENDF(&conn->proto.ftpc.pp, \"CWD %s\", ftpc->dirs[ftpc->count1 -1]);\r\n        state(conn, FTP_CWD);\r\n      }\r\n      else {\r\n        /* No CWD necessary */\r\n        result = ftp_state_post_cwd(conn);\r\n      }\r\n    }\r\n  }\r\n  return result;\r\n}\r\n\r\ntypedef enum {\r\n  EPRT,\r\n  PORT,\r\n  DONE\r\n} ftpport;\r\n\r\nstatic CURLcode ftp_state_use_port(struct connectdata *conn,\r\n                                   ftpport fcmd) /* start with this */\r\n\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct SessionHandle *data=conn->data;\r\n  curl_socket_t portsock= CURL_SOCKET_BAD;\r\n  char myhost[256] = \"\";\r\n\r\n  struct Curl_sockaddr_storage ss;\r\n  Curl_addrinfo *res, *ai;\r\n  curl_socklen_t sslen;\r\n  char hbuf[NI_MAXHOST];\r\n  struct sockaddr *sa=(struct sockaddr *)&ss;\r\n  struct sockaddr_in * const sa4 = (void *)sa;\r\n#ifdef ENABLE_IPV6\r\n  struct sockaddr_in6 * const sa6 = (void *)sa;\r\n#endif\r\n  char tmp[1024];\r\n  static const char mode[][5] = { \"EPRT\", \"PORT\" };\r\n  int rc;\r\n  int error;\r\n  char *host = NULL;\r\n  char *string_ftpport = data->set.str[STRING_FTPPORT];\r\n  struct Curl_dns_entry *h=NULL;\r\n  unsigned short port_min = 0;\r\n  unsigned short port_max = 0;\r\n  unsigned short port;\r\n  bool possibly_non_local = TRUE;\r\n\r\n  char *addr = NULL;\r\n\r\n  /* Step 1, figure out what is requested,\r\n   * accepted format :\r\n   * (ipv4|ipv6|domain|interface)?(:port(-range)?)?\r\n   */\r\n\r\n  if(data->set.str[STRING_FTPPORT] &&\r\n     (strlen(data->set.str[STRING_FTPPORT]) > 1)) {\r\n\r\n#ifdef ENABLE_IPV6\r\n    size_t addrlen = INET6_ADDRSTRLEN > strlen(string_ftpport) ?\r\n      INET6_ADDRSTRLEN : strlen(string_ftpport);\r\n#else\r\n    size_t addrlen = INET_ADDRSTRLEN > strlen(string_ftpport) ?\r\n      INET_ADDRSTRLEN : strlen(string_ftpport);\r\n#endif\r\n    char *ip_start = string_ftpport;\r\n    char *ip_end = NULL;\r\n    char *port_start = NULL;\r\n    char *port_sep = NULL;\r\n\r\n    addr = calloc(addrlen+1, 1);\r\n    if(!addr)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n#ifdef ENABLE_IPV6\r\n    if(*string_ftpport == '[') {\r\n      /* [ipv6]:port(-range) */\r\n      ip_start = string_ftpport + 1;\r\n      if((ip_end = strchr(string_ftpport, ']')) != NULL )\r\n        strncpy(addr, ip_start, ip_end - ip_start);\r\n    }\r\n    else\r\n#endif\r\n      if(*string_ftpport == ':') {\r\n        /* :port */\r\n        ip_end = string_ftpport;\r\n    }\r\n    else if((ip_end = strchr(string_ftpport, ':')) != NULL) {\r\n        /* either ipv6 or (ipv4|domain|interface):port(-range) */\r\n#ifdef ENABLE_IPV6\r\n      if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {\r\n        /* ipv6 */\r\n        port_min = port_max = 0;\r\n        strcpy(addr, string_ftpport);\r\n        ip_end = NULL; /* this got no port ! */\r\n      }\r\n      else\r\n#endif\r\n        /* (ipv4|domain|interface):port(-range) */\r\n        strncpy(addr, string_ftpport, ip_end - ip_start );\r\n    }\r\n    else\r\n      /* ipv4|interface */\r\n      strcpy(addr, string_ftpport);\r\n\r\n    /* parse the port */\r\n    if(ip_end != NULL) {\r\n      if((port_start = strchr(ip_end, ':')) != NULL) {\r\n        port_min = curlx_ultous(strtoul(port_start+1, NULL, 10));\r\n        if((port_sep = strchr(port_start, '-')) != NULL) {\r\n          port_max = curlx_ultous(strtoul(port_sep + 1, NULL, 10));\r\n        }\r\n        else\r\n          port_max = port_min;\r\n      }\r\n    }\r\n\r\n    /* correct errors like:\r\n     *  :1234-1230\r\n     *  :-4711 , in this case port_min is (unsigned)-1,\r\n     *           therefore port_min > port_max for all cases\r\n     *           but port_max = (unsigned)-1\r\n     */\r\n    if(port_min > port_max )\r\n      port_min = port_max = 0;\r\n\r\n\r\n    if(*addr != '\\0') {\r\n      /* attempt to get the address of the given interface name */\r\n      if(!Curl_if2ip(conn->ip_addr->ai_family, addr,\r\n                     hbuf, sizeof(hbuf)))\r\n        /* not an interface, use the given string as host name instead */\r\n        host = addr;\r\n      else\r\n        host = hbuf; /* use the hbuf for host name */\r\n    }\r\n    else\r\n      /* there was only a port(-range) given, default the host */\r\n      host = NULL;\r\n  } /* data->set.ftpport */\r\n\r\n  if(!host) {\r\n    /* not an interface and not a host name, get default by extracting\r\n       the IP from the control connection */\r\n\r\n    sslen = sizeof(ss);\r\n    if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) {\r\n      failf(data, \"getsockname() failed: %s\",\r\n          Curl_strerror(conn, SOCKERRNO) );\r\n      Curl_safefree(addr);\r\n      return CURLE_FTP_PORT_FAILED;\r\n    }\r\n    switch(sa->sa_family) {\r\n#ifdef ENABLE_IPV6\r\n    case AF_INET6:\r\n      Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));\r\n      break;\r\n#endif\r\n    default:\r\n      Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf));\r\n      break;\r\n    }\r\n    host = hbuf; /* use this host name */\r\n    possibly_non_local = FALSE; /* we know it is local now */\r\n  }\r\n\r\n  /* resolv ip/host to ip */\r\n  rc = Curl_resolv(conn, host, 0, &h);\r\n  if(rc == CURLRESOLV_PENDING)\r\n    (void)Curl_resolver_wait_resolv(conn, &h);\r\n  if(h) {\r\n    res = h->addr;\r\n    /* when we return from this function, we can forget about this entry\r\n       to we can unlock it now already */\r\n    Curl_resolv_unlock(data, h);\r\n  } /* (h) */\r\n  else\r\n    res = NULL; /* failure! */\r\n\r\n  if(res == NULL) {\r\n    failf(data, \"failed to resolve the address provided to PORT: %s\", host);\r\n    Curl_safefree(addr);\r\n    return CURLE_FTP_PORT_FAILED;\r\n  }\r\n\r\n  Curl_safefree(addr);\r\n  host = NULL;\r\n\r\n  /* step 2, create a socket for the requested address */\r\n\r\n  portsock = CURL_SOCKET_BAD;\r\n  error = 0;\r\n  for(ai = res; ai; ai = ai->ai_next) {\r\n    result = Curl_socket(conn, ai, NULL, &portsock);\r\n    if(result) {\r\n      error = SOCKERRNO;\r\n      continue;\r\n    }\r\n    break;\r\n  }\r\n  if(!ai) {\r\n    failf(data, \"socket failure: %s\", Curl_strerror(conn, error));\r\n    return CURLE_FTP_PORT_FAILED;\r\n  }\r\n\r\n  /* step 3, bind to a suitable local address */\r\n\r\n  memcpy(sa, ai->ai_addr, ai->ai_addrlen);\r\n  sslen = ai->ai_addrlen;\r\n\r\n  for(port = port_min; port <= port_max;) {\r\n    if(sa->sa_family == AF_INET)\r\n      sa4->sin_port = htons(port);\r\n#ifdef ENABLE_IPV6\r\n    else\r\n      sa6->sin6_port = htons(port);\r\n#endif\r\n    /* Try binding the given address. */\r\n    if(bind(portsock, sa, sslen) ) {\r\n      /* It failed. */\r\n      error = SOCKERRNO;\r\n      if(possibly_non_local && (error == EADDRNOTAVAIL)) {\r\n        /* The requested bind address is not local.  Use the address used for\r\n         * the control connection instead and restart the port loop\r\n         */\r\n\r\n        infof(data, \"bind(port=%hu) on non-local address failed: %s\\n\", port,\r\n              Curl_strerror(conn, error) );\r\n\r\n        sslen = sizeof(ss);\r\n        if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) {\r\n          failf(data, \"getsockname() failed: %s\",\r\n                Curl_strerror(conn, SOCKERRNO) );\r\n          Curl_closesocket(conn, portsock);\r\n          return CURLE_FTP_PORT_FAILED;\r\n        }\r\n        port = port_min;\r\n        possibly_non_local = FALSE; /* don't try this again */\r\n        continue;\r\n      }\r\n      else if(error != EADDRINUSE && error != EACCES) {\r\n        failf(data, \"bind(port=%hu) failed: %s\", port,\r\n              Curl_strerror(conn, error) );\r\n        Curl_closesocket(conn, portsock);\r\n        return CURLE_FTP_PORT_FAILED;\r\n      }\r\n    }\r\n    else\r\n      break;\r\n\r\n    port++;\r\n  }\r\n\r\n  /* maybe all ports were in use already*/\r\n  if(port > port_max) {\r\n    failf(data, \"bind() failed, we ran out of ports!\");\r\n    Curl_closesocket(conn, portsock);\r\n    return CURLE_FTP_PORT_FAILED;\r\n  }\r\n\r\n  /* get the name again after the bind() so that we can extract the\r\n     port number it uses now */\r\n  sslen = sizeof(ss);\r\n  if(getsockname(portsock, (struct sockaddr *)sa, &sslen)) {\r\n    failf(data, \"getsockname() failed: %s\",\r\n          Curl_strerror(conn, SOCKERRNO) );\r\n    Curl_closesocket(conn, portsock);\r\n    return CURLE_FTP_PORT_FAILED;\r\n  }\r\n\r\n  /* step 4, listen on the socket */\r\n\r\n  if(listen(portsock, 1)) {\r\n    failf(data, \"socket failure: %s\", Curl_strerror(conn, SOCKERRNO));\r\n    Curl_closesocket(conn, portsock);\r\n    return CURLE_FTP_PORT_FAILED;\r\n  }\r\n\r\n  /* step 5, send the proper FTP command */\r\n\r\n  /* get a plain printable version of the numerical address to work with\r\n     below */\r\n  Curl_printable_address(ai, myhost, sizeof(myhost));\r\n\r\n#ifdef ENABLE_IPV6\r\n  if(!conn->bits.ftp_use_eprt && conn->bits.ipv6)\r\n    /* EPRT is disabled but we are connected to a IPv6 host, so we ignore the\r\n       request and enable EPRT again! */\r\n    conn->bits.ftp_use_eprt = TRUE;\r\n#endif\r\n\r\n  for(; fcmd != DONE; fcmd++) {\r\n\r\n    if(!conn->bits.ftp_use_eprt && (EPRT == fcmd))\r\n      /* if disabled, goto next */\r\n      continue;\r\n\r\n    if((PORT == fcmd) && sa->sa_family != AF_INET)\r\n      /* PORT is ipv4 only */\r\n      continue;\r\n\r\n    switch (sa->sa_family) {\r\n    case AF_INET:\r\n      port = ntohs(sa4->sin_port);\r\n      break;\r\n#ifdef ENABLE_IPV6\r\n    case AF_INET6:\r\n      port = ntohs(sa6->sin6_port);\r\n      break;\r\n#endif\r\n    default:\r\n      continue; /* might as well skip this */\r\n    }\r\n\r\n    if(EPRT == fcmd) {\r\n      /*\r\n       * Two fine examples from RFC2428;\r\n       *\r\n       * EPRT |1|132.235.1.2|6275|\r\n       *\r\n       * EPRT |2|1080::8:800:200C:417A|5282|\r\n       */\r\n\r\n      result = Curl_pp_sendf(&ftpc->pp, \"%s |%d|%s|%hu|\", mode[fcmd],\r\n                             sa->sa_family == AF_INET?1:2,\r\n                             myhost, port);\r\n      if(result) {\r\n        failf(data, \"Failure sending EPRT command: %s\",\r\n              curl_easy_strerror(result));\r\n        Curl_closesocket(conn, portsock);\r\n        /* don't retry using PORT */\r\n        ftpc->count1 = PORT;\r\n        /* bail out */\r\n        state(conn, FTP_STOP);\r\n        return result;\r\n      }\r\n      break;\r\n    }\r\n    else if(PORT == fcmd) {\r\n      char *source = myhost;\r\n      char *dest = tmp;\r\n\r\n      /* translate x.x.x.x to x,x,x,x */\r\n      while(source && *source) {\r\n        if(*source == '.')\r\n          *dest=',';\r\n        else\r\n          *dest = *source;\r\n        dest++;\r\n        source++;\r\n      }\r\n      *dest = 0;\r\n      snprintf(dest, 20, \",%d,%d\", (int)(port>>8), (int)(port&0xff));\r\n\r\n      result = Curl_pp_sendf(&ftpc->pp, \"%s %s\", mode[fcmd], tmp);\r\n      if(result) {\r\n        failf(data, \"Failure sending PORT command: %s\",\r\n              curl_easy_strerror(result));\r\n        Curl_closesocket(conn, portsock);\r\n        /* bail out */\r\n        state(conn, FTP_STOP);\r\n        return result;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* store which command was sent */\r\n  ftpc->count1 = fcmd;\r\n\r\n  /* we set the secondary socket variable to this for now, it is only so that\r\n     the cleanup function will close it in case we fail before the true\r\n     secondary stuff is made */\r\n  if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET])\r\n    Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]);\r\n  conn->sock[SECONDARYSOCKET] = portsock;\r\n\r\n  /* this tcpconnect assignment below is a hackish work-around to make the\r\n     multi interface with active FTP work - as it will not wait for a\r\n     (passive) connect in Curl_is_connected().\r\n\r\n     The *proper* fix is to make sure that the active connection from the\r\n     server is done in a non-blocking way. Currently, it is still BLOCKING.\r\n  */\r\n  conn->bits.tcpconnect[SECONDARYSOCKET] = TRUE;\r\n\r\n  state(conn, FTP_PORT);\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_use_pasv(struct connectdata *conn)\r\n{\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  CURLcode result = CURLE_OK;\r\n  /*\r\n    Here's the excecutive summary on what to do:\r\n\r\n    PASV is RFC959, expect:\r\n    227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)\r\n\r\n    LPSV is RFC1639, expect:\r\n    228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2)\r\n\r\n    EPSV is RFC2428, expect:\r\n    229 Entering Extended Passive Mode (|||port|)\r\n\r\n  */\r\n\r\n  static const char mode[][5] = { \"EPSV\", \"PASV\" };\r\n  int modeoff;\r\n\r\n#ifdef PF_INET6\r\n  if(!conn->bits.ftp_use_epsv && conn->bits.ipv6)\r\n    /* EPSV is disabled but we are connected to a IPv6 host, so we ignore the\r\n       request and enable EPSV again! */\r\n    conn->bits.ftp_use_epsv = TRUE;\r\n#endif\r\n\r\n  modeoff = conn->bits.ftp_use_epsv?0:1;\r\n\r\n  PPSENDF(&ftpc->pp, \"%s\", mode[modeoff]);\r\n\r\n  ftpc->count1 = modeoff;\r\n  state(conn, FTP_PASV);\r\n  infof(conn->data, \"Connect data stream passively\\n\");\r\n\r\n  return result;\r\n}\r\n\r\n/* REST is the last command in the chain of commands when a \"head\"-like\r\n   request is made. Thus, if an actual transfer is to be made this is where\r\n   we take off for real. */\r\nstatic CURLcode ftp_state_post_rest(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(ftp->transfer != FTPTRANSFER_BODY) {\r\n    /* doesn't transfer any data */\r\n\r\n    /* still possibly do PRE QUOTE jobs */\r\n    state(conn, FTP_RETR_PREQUOTE);\r\n    result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE);\r\n  }\r\n  else if(data->set.ftp_use_port) {\r\n    /* We have chosen to use the PORT (or similar) command */\r\n    result = ftp_state_use_port(conn, EPRT);\r\n  }\r\n  else {\r\n    /* We have chosen (this is default) to use the PASV (or similar) command */\r\n    if(data->set.ftp_use_pret) {\r\n      /* The user has requested that we send a PRET command\r\n         to prepare the server for the upcoming PASV */\r\n      if(!conn->proto.ftpc.file) {\r\n        PPSENDF(&conn->proto.ftpc.pp, \"PRET %s\",\r\n                data->set.str[STRING_CUSTOMREQUEST]?\r\n                data->set.str[STRING_CUSTOMREQUEST]:\r\n                (data->set.ftp_list_only?\"NLST\":\"LIST\"));\r\n      }\r\n      else if(data->set.upload) {\r\n        PPSENDF(&conn->proto.ftpc.pp, \"PRET STOR %s\", conn->proto.ftpc.file);\r\n      }\r\n      else {\r\n        PPSENDF(&conn->proto.ftpc.pp, \"PRET RETR %s\", conn->proto.ftpc.file);\r\n      }\r\n      state(conn, FTP_PRET);\r\n    }\r\n    else {\r\n      result = ftp_state_use_pasv(conn);\r\n    }\r\n  }\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_size(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {\r\n    /* if a \"head\"-like request is being made (on a file) */\r\n\r\n    /* Determine if server can respond to REST command and therefore\r\n       whether it supports range */\r\n    PPSENDF(&conn->proto.ftpc.pp, \"REST %d\", 0);\r\n\r\n    state(conn, FTP_REST);\r\n  }\r\n  else\r\n    result = ftp_state_post_rest(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_type(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {\r\n    /* if a \"head\"-like request is being made (on a file) */\r\n\r\n    /* we know ftpc->file is a valid pointer to a file name */\r\n    PPSENDF(&ftpc->pp, \"SIZE %s\", ftpc->file);\r\n\r\n    state(conn, FTP_SIZE);\r\n  }\r\n  else\r\n    result = ftp_state_post_size(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_listtype(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* If this output is to be machine-parsed, the NLST command might be better\r\n     to use, since the LIST command output is not specified or standard in any\r\n     way. It has turned out that the NLST list output is not the same on all\r\n     servers either... */\r\n\r\n  /*\r\n     if FTPFILE_NOCWD was specified, we are currently in\r\n     the user's home directory, so we should add the path\r\n     as argument for the LIST / NLST / or custom command.\r\n     Whether the server will support this, is uncertain.\r\n\r\n     The other ftp_filemethods will CWD into dir/dir/ first and\r\n     then just do LIST (in that case: nothing to do here)\r\n  */\r\n  char *cmd,*lstArg,*slashPos;\r\n\r\n  lstArg = NULL;\r\n  if((data->set.ftp_filemethod == FTPFILE_NOCWD) &&\r\n     data->state.path &&\r\n     data->state.path[0] &&\r\n     strchr(data->state.path,'/')) {\r\n\r\n    lstArg = strdup(data->state.path);\r\n    if(!lstArg)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    /* Check if path does not end with /, as then we cut off the file part */\r\n    if(lstArg[strlen(lstArg) - 1] != '/')  {\r\n\r\n      /* chop off the file part if format is dir/dir/file */\r\n      slashPos = strrchr(lstArg,'/');\r\n      if(slashPos)\r\n        *(slashPos+1) = '\\0';\r\n    }\r\n  }\r\n\r\n  cmd = aprintf( \"%s%s%s\",\r\n                 data->set.str[STRING_CUSTOMREQUEST]?\r\n                 data->set.str[STRING_CUSTOMREQUEST]:\r\n                 (data->set.ftp_list_only?\"NLST\":\"LIST\"),\r\n                 lstArg? \" \": \"\",\r\n                 lstArg? lstArg: \"\" );\r\n\r\n  if(!cmd) {\r\n    if(lstArg)\r\n      free(lstArg);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  result = Curl_pp_sendf(&conn->proto.ftpc.pp, \"%s\", cmd);\r\n\r\n  if(lstArg)\r\n    free(lstArg);\r\n\r\n  free(cmd);\r\n\r\n  if(result != CURLE_OK)\r\n    return result;\r\n\r\n  state(conn, FTP_LIST);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_retrtype(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  /* We've sent the TYPE, now we must send the list of prequote strings */\r\n\r\n  result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_stortype(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  /* We've sent the TYPE, now we must send the list of prequote strings */\r\n\r\n  result = ftp_state_quote(conn, TRUE, FTP_STOR_PREQUOTE);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_mdtm(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  /* If we have selected NOBODY and HEADER, it means that we only want file\r\n     information. Which in FTP can't be much more than the file size and\r\n     date. */\r\n  if(data->set.opt_no_body && ftpc->file &&\r\n     ftp_need_type(conn, data->set.prefer_ascii)) {\r\n    /* The SIZE command is _not_ RFC 959 specified, and therefor many servers\r\n       may not support it! It is however the only way we have to get a file's\r\n       size! */\r\n\r\n    ftp->transfer = FTPTRANSFER_INFO;\r\n    /* this means no actual transfer will be made */\r\n\r\n    /* Some servers return different sizes for different modes, and thus we\r\n       must set the proper type before we check the size */\r\n    result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_TYPE);\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n    result = ftp_state_post_type(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* This is called after the CWD commands have been done in the beginning of\r\n   the DO phase */\r\nstatic CURLcode ftp_state_post_cwd(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  /* Requested time of file or time-depended transfer? */\r\n  if((data->set.get_filetime || data->set.timecondition) && ftpc->file) {\r\n\r\n    /* we have requested to get the modified-time of the file, this is a white\r\n       spot as the MDTM is not mentioned in RFC959 */\r\n    PPSENDF(&ftpc->pp, \"MDTM %s\", ftpc->file);\r\n\r\n    state(conn, FTP_MDTM);\r\n  }\r\n  else\r\n    result = ftp_state_post_mdtm(conn);\r\n\r\n  return result;\r\n}\r\n\r\n\r\n/* This is called after the TYPE and possible quote commands have been sent */\r\nstatic CURLcode ftp_state_ul_setup(struct connectdata *conn,\r\n                                   bool sizechecked)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  int seekerr = CURL_SEEKFUNC_OK;\r\n\r\n  if((data->state.resume_from && !sizechecked) ||\r\n     ((data->state.resume_from > 0) && sizechecked)) {\r\n    /* we're about to continue the uploading of a file */\r\n    /* 1. get already existing file's size. We use the SIZE command for this\r\n       which may not exist in the server!  The SIZE command is not in\r\n       RFC959. */\r\n\r\n    /* 2. This used to set REST. But since we can do append, we\r\n       don't another ftp command. We just skip the source file\r\n       offset and then we APPEND the rest on the file instead */\r\n\r\n    /* 3. pass file-size number of bytes in the source file */\r\n    /* 4. lower the infilesize counter */\r\n    /* => transfer as usual */\r\n\r\n    if(data->state.resume_from < 0 ) {\r\n      /* Got no given size to start from, figure it out */\r\n      PPSENDF(&ftpc->pp, \"SIZE %s\", ftpc->file);\r\n      state(conn, FTP_STOR_SIZE);\r\n      return result;\r\n    }\r\n\r\n    /* enable append */\r\n    data->set.ftp_append = TRUE;\r\n\r\n    /* Let's read off the proper amount of bytes from the input. */\r\n    if(conn->seek_func) {\r\n      seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,\r\n                                SEEK_SET);\r\n    }\r\n\r\n    if(seekerr != CURL_SEEKFUNC_OK) {\r\n      if(seekerr != CURL_SEEKFUNC_CANTSEEK) {\r\n        failf(data, \"Could not seek stream\");\r\n        return CURLE_FTP_COULDNT_USE_REST;\r\n      }\r\n      /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */\r\n      else {\r\n        curl_off_t passed=0;\r\n        do {\r\n          size_t readthisamountnow =\r\n            (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?\r\n            BUFSIZE : curlx_sotouz(data->state.resume_from - passed);\r\n\r\n          size_t actuallyread =\r\n            conn->fread_func(data->state.buffer, 1, readthisamountnow,\r\n                             conn->fread_in);\r\n\r\n          passed += actuallyread;\r\n          if((actuallyread == 0) || (actuallyread > readthisamountnow)) {\r\n            /* this checks for greater-than only to make sure that the\r\n               CURL_READFUNC_ABORT return code still aborts */\r\n            failf(data, \"Failed to read data\");\r\n            return CURLE_FTP_COULDNT_USE_REST;\r\n          }\r\n        } while(passed < data->state.resume_from);\r\n      }\r\n    }\r\n    /* now, decrease the size of the read */\r\n    if(data->set.infilesize>0) {\r\n      data->set.infilesize -= data->state.resume_from;\r\n\r\n      if(data->set.infilesize <= 0) {\r\n        infof(data, \"File already completely uploaded\\n\");\r\n\r\n        /* no data to transfer */\r\n        Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n\r\n        /* Set ->transfer so that we won't get any error in\r\n         * ftp_done() because we didn't transfer anything! */\r\n        ftp->transfer = FTPTRANSFER_NONE;\r\n\r\n        state(conn, FTP_STOP);\r\n        return CURLE_OK;\r\n      }\r\n    }\r\n    /* we've passed, proceed as normal */\r\n  } /* resume_from */\r\n\r\n  PPSENDF(&ftpc->pp, data->set.ftp_append?\"APPE %s\":\"STOR %s\",\r\n          ftpc->file);\r\n\r\n  state(conn, FTP_STOR);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_quote(struct connectdata *conn,\r\n                                bool init,\r\n                                ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  bool quote=FALSE;\r\n  struct curl_slist *item;\r\n\r\n  switch(instate) {\r\n  case FTP_QUOTE:\r\n  default:\r\n    item = data->set.quote;\r\n    break;\r\n  case FTP_RETR_PREQUOTE:\r\n  case FTP_STOR_PREQUOTE:\r\n    item = data->set.prequote;\r\n    break;\r\n  case FTP_POSTQUOTE:\r\n    item = data->set.postquote;\r\n    break;\r\n  }\r\n\r\n  /*\r\n   * This state uses:\r\n   * 'count1' to iterate over the commands to send\r\n   * 'count2' to store wether to allow commands to fail\r\n   */\r\n\r\n  if(init)\r\n    ftpc->count1 = 0;\r\n  else\r\n    ftpc->count1++;\r\n\r\n  if(item) {\r\n    int i = 0;\r\n\r\n    /* Skip count1 items in the linked list */\r\n    while((i< ftpc->count1) && item) {\r\n      item = item->next;\r\n      i++;\r\n    }\r\n    if(item) {\r\n      char *cmd = item->data;\r\n      if(cmd[0] == '*') {\r\n        cmd++;\r\n        ftpc->count2 = 1; /* the sent command is allowed to fail */\r\n      }\r\n      else\r\n        ftpc->count2 = 0; /* failure means cancel operation */\r\n\r\n      PPSENDF(&ftpc->pp, \"%s\", cmd);\r\n      state(conn, instate);\r\n      quote = TRUE;\r\n    }\r\n  }\r\n\r\n  if(!quote) {\r\n    /* No more quote to send, continue to ... */\r\n    switch(instate) {\r\n    case FTP_QUOTE:\r\n    default:\r\n      result = ftp_state_cwd(conn);\r\n      break;\r\n    case FTP_RETR_PREQUOTE:\r\n      if(ftp->transfer != FTPTRANSFER_BODY)\r\n        state(conn, FTP_STOP);\r\n      else {\r\n        if(ftpc->known_filesize != -1) {\r\n          Curl_pgrsSetDownloadSize(data, ftpc->known_filesize);\r\n          result = ftp_state_post_retr_size(conn, ftpc->known_filesize);\r\n        }\r\n        else {\r\n          PPSENDF(&ftpc->pp, \"SIZE %s\", ftpc->file);\r\n          state(conn, FTP_RETR_SIZE);\r\n        }\r\n      }\r\n      break;\r\n    case FTP_STOR_PREQUOTE:\r\n      result = ftp_state_ul_setup(conn, FALSE);\r\n      break;\r\n    case FTP_POSTQUOTE:\r\n      break;\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* called from ftp_state_pasv_resp to switch to PASV in case of EPSV\r\n   problems */\r\nstatic CURLcode ftp_epsv_disable(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  infof(conn->data, \"got positive EPSV response, but can't connect. \"\r\n        \"Disabling EPSV\\n\");\r\n  /* disable it for next transfer */\r\n  conn->bits.ftp_use_epsv = FALSE;\r\n  conn->data->state.errorbuf = FALSE; /* allow error message to get\r\n                                         rewritten */\r\n  PPSENDF(&conn->proto.ftpc.pp, \"PASV\", NULL);\r\n  conn->proto.ftpc.count1++;\r\n  /* remain in the FTP_PASV state */\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_pasv_resp(struct connectdata *conn,\r\n                                    int ftpcode)\r\n{\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  CURLcode result;\r\n  struct SessionHandle *data=conn->data;\r\n  Curl_addrinfo *conninfo;\r\n  struct Curl_dns_entry *addr=NULL;\r\n  int rc;\r\n  unsigned short connectport; /* the local port connect() should use! */\r\n  unsigned short newport=0; /* remote port */\r\n  bool connected;\r\n\r\n  /* newhost must be able to hold a full IP-style address in ASCII, which\r\n     in the IPv6 case means 5*8-1 = 39 letters */\r\n#define NEWHOST_BUFSIZE 48\r\n  char newhost[NEWHOST_BUFSIZE];\r\n  char *str=&data->state.buffer[4];  /* start on the first letter */\r\n\r\n  if((ftpc->count1 == 0) &&\r\n     (ftpcode == 229)) {\r\n    /* positive EPSV response */\r\n    char *ptr = strchr(str, '(');\r\n    if(ptr) {\r\n      unsigned int num;\r\n      char separator[4];\r\n      ptr++;\r\n      if(5  == sscanf(ptr, \"%c%c%c%u%c\",\r\n                      &separator[0],\r\n                      &separator[1],\r\n                      &separator[2],\r\n                      &num,\r\n                      &separator[3])) {\r\n        const char sep1 = separator[0];\r\n        int i;\r\n\r\n        /* The four separators should be identical, or else this is an oddly\r\n           formatted reply and we bail out immediately. */\r\n        for(i=1; i<4; i++) {\r\n          if(separator[i] != sep1) {\r\n            ptr=NULL; /* set to NULL to signal error */\r\n            break;\r\n          }\r\n        }\r\n        if(num > 0xffff) {\r\n          failf(data, \"Illegal port number in EPSV reply\");\r\n          return CURLE_FTP_WEIRD_PASV_REPLY;\r\n        }\r\n        if(ptr) {\r\n          newport = (unsigned short)(num & 0xffff);\r\n\r\n          if(conn->bits.tunnel_proxy ||\r\n             conn->proxytype == CURLPROXY_SOCKS5 ||\r\n             conn->proxytype == CURLPROXY_SOCKS5_HOSTNAME ||\r\n             conn->proxytype == CURLPROXY_SOCKS4 ||\r\n             conn->proxytype == CURLPROXY_SOCKS4A)\r\n            /* proxy tunnel -> use other host info because ip_addr_str is the\r\n               proxy address not the ftp host */\r\n            snprintf(newhost, sizeof(newhost), \"%s\", conn->host.name);\r\n          else\r\n            /* use the same IP we are already connected to */\r\n            snprintf(newhost, NEWHOST_BUFSIZE, \"%s\", conn->ip_addr_str);\r\n        }\r\n      }\r\n      else\r\n        ptr=NULL;\r\n    }\r\n    if(!ptr) {\r\n      failf(data, \"Weirdly formatted EPSV reply\");\r\n      return CURLE_FTP_WEIRD_PASV_REPLY;\r\n    }\r\n  }\r\n  else if((ftpc->count1 == 1) &&\r\n          (ftpcode == 227)) {\r\n    /* positive PASV response */\r\n    int ip[4];\r\n    int port[2];\r\n\r\n    /*\r\n     * Scan for a sequence of six comma-separated numbers and use them as\r\n     * IP+port indicators.\r\n     *\r\n     * Found reply-strings include:\r\n     * \"227 Entering Passive Mode (127,0,0,1,4,51)\"\r\n     * \"227 Data transfer will passively listen to 127,0,0,1,4,51\"\r\n     * \"227 Entering passive mode. 127,0,0,1,4,51\"\r\n     */\r\n    while(*str) {\r\n      if(6 == sscanf(str, \"%d,%d,%d,%d,%d,%d\",\r\n                      &ip[0], &ip[1], &ip[2], &ip[3],\r\n                      &port[0], &port[1]))\r\n        break;\r\n      str++;\r\n    }\r\n\r\n    if(!*str) {\r\n      failf(data, \"Couldn't interpret the 227-response\");\r\n      return CURLE_FTP_WEIRD_227_FORMAT;\r\n    }\r\n\r\n    /* we got OK from server */\r\n    if(data->set.ftp_skip_ip) {\r\n      /* told to ignore the remotely given IP but instead use the one we used\r\n         for the control connection */\r\n      infof(data, \"Skips %d.%d.%d.%d for data connection, uses %s instead\\n\",\r\n            ip[0], ip[1], ip[2], ip[3],\r\n            conn->ip_addr_str);\r\n      if(conn->bits.tunnel_proxy ||\r\n         conn->proxytype == CURLPROXY_SOCKS5 ||\r\n         conn->proxytype == CURLPROXY_SOCKS5_HOSTNAME ||\r\n         conn->proxytype == CURLPROXY_SOCKS4 ||\r\n         conn->proxytype == CURLPROXY_SOCKS4A)\r\n        /* proxy tunnel -> use other host info because ip_addr_str is the\r\n           proxy address not the ftp host */\r\n        snprintf(newhost, sizeof(newhost), \"%s\", conn->host.name);\r\n      else\r\n        snprintf(newhost, sizeof(newhost), \"%s\", conn->ip_addr_str);\r\n    }\r\n    else\r\n      snprintf(newhost, sizeof(newhost),\r\n               \"%d.%d.%d.%d\", ip[0], ip[1], ip[2], ip[3]);\r\n    newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff);\r\n  }\r\n  else if(ftpc->count1 == 0) {\r\n    /* EPSV failed, move on to PASV */\r\n\r\n    /* disable it for next transfer */\r\n    conn->bits.ftp_use_epsv = FALSE;\r\n    infof(data, \"disabling EPSV usage\\n\");\r\n\r\n    PPSENDF(&ftpc->pp, \"PASV\", NULL);\r\n    ftpc->count1++;\r\n    /* remain in the FTP_PASV state */\r\n    return result;\r\n  }\r\n  else {\r\n    failf(data, \"Bad PASV/EPSV response: %03d\", ftpcode);\r\n    return CURLE_FTP_WEIRD_PASV_REPLY;\r\n  }\r\n\r\n  if(data->set.str[STRING_PROXY] && *data->set.str[STRING_PROXY]) {\r\n    /*\r\n     * This is a tunnel through a http proxy and we need to connect to the\r\n     * proxy again here.\r\n     *\r\n     * We don't want to rely on a former host lookup that might've expired\r\n     * now, instead we remake the lookup here and now!\r\n     */\r\n    rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr);\r\n    if(rc == CURLRESOLV_PENDING)\r\n      /* BLOCKING, ignores the return code but 'addr' will be NULL in\r\n         case of failure */\r\n      (void)Curl_resolver_wait_resolv(conn, &addr);\r\n\r\n    connectport =\r\n      (unsigned short)conn->port; /* we connect to the proxy's port */\r\n\r\n    if(!addr) {\r\n      failf(data, \"Can't resolve proxy host %s:%hu\",\r\n            conn->proxy.name, connectport);\r\n      return CURLE_FTP_CANT_GET_HOST;\r\n    }\r\n  }\r\n  else {\r\n    /* normal, direct, ftp connection */\r\n    rc = Curl_resolv(conn, newhost, newport, &addr);\r\n    if(rc == CURLRESOLV_PENDING)\r\n      /* BLOCKING */\r\n      (void)Curl_resolver_wait_resolv(conn, &addr);\r\n\r\n    connectport = newport; /* we connect to the remote port */\r\n\r\n    if(!addr) {\r\n      failf(data, \"Can't resolve new host %s:%hu\", newhost, connectport);\r\n      return CURLE_FTP_CANT_GET_HOST;\r\n    }\r\n  }\r\n\r\n  result = Curl_connecthost(conn,\r\n                            addr,\r\n                            &conn->sock[SECONDARYSOCKET],\r\n                            &conninfo,\r\n                            &connected);\r\n\r\n  Curl_resolv_unlock(data, addr); /* we're done using this address */\r\n\r\n  if(result) {\r\n    if(ftpc->count1 == 0 && ftpcode == 229)\r\n      return ftp_epsv_disable(conn);\r\n\r\n    return result;\r\n  }\r\n\r\n  conn->bits.tcpconnect[SECONDARYSOCKET] = connected;\r\n\r\n  /*\r\n   * When this is used from the multi interface, this might've returned with\r\n   * the 'connected' set to FALSE and thus we are now awaiting a non-blocking\r\n   * connect to connect and we should not be \"hanging\" here waiting.\r\n   */\r\n\r\n  if(data->set.verbose)\r\n    /* this just dumps information about this second connection */\r\n    ftp_pasv_verbose(conn, conninfo, newhost, connectport);\r\n\r\n  switch(conn->proxytype) {\r\n    /* FIX: this MUST wait for a proper connect first if 'connected' is\r\n     * FALSE */\r\n  case CURLPROXY_SOCKS5:\r\n  case CURLPROXY_SOCKS5_HOSTNAME:\r\n    result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, newhost, newport,\r\n                         SECONDARYSOCKET, conn);\r\n    break;\r\n  case CURLPROXY_SOCKS4:\r\n    result = Curl_SOCKS4(conn->proxyuser, newhost, newport,\r\n                         SECONDARYSOCKET, conn, FALSE);\r\n    break;\r\n  case CURLPROXY_SOCKS4A:\r\n    result = Curl_SOCKS4(conn->proxyuser, newhost, newport,\r\n                         SECONDARYSOCKET, conn, TRUE);\r\n    break;\r\n  case CURLPROXY_HTTP:\r\n  case CURLPROXY_HTTP_1_0:\r\n    /* do nothing here. handled later. */\r\n    break;\r\n  default:\r\n    failf(data, \"unknown proxytype option given\");\r\n    result = CURLE_COULDNT_CONNECT;\r\n    break;\r\n  }\r\n\r\n  if(result) {\r\n    if(ftpc->count1 == 0 && ftpcode == 229)\r\n      return ftp_epsv_disable(conn);\r\n    return result;\r\n  }\r\n\r\n  if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {\r\n    /* FIX: this MUST wait for a proper connect first if 'connected' is\r\n     * FALSE */\r\n\r\n    /* BLOCKING */\r\n    /* We want \"seamless\" FTP operations through HTTP proxy tunnel */\r\n\r\n    /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member\r\n     * conn->proto.http; we want FTP through HTTP and we have to change the\r\n     * member temporarily for connecting to the HTTP proxy. After\r\n     * Curl_proxyCONNECT we have to set back the member to the original struct\r\n     * FTP pointer\r\n     */\r\n    struct HTTP http_proxy;\r\n    struct FTP *ftp_save = data->state.proto.ftp;\r\n    memset(&http_proxy, 0, sizeof(http_proxy));\r\n    data->state.proto.http = &http_proxy;\r\n\r\n    result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, newhost, newport);\r\n\r\n    data->state.proto.ftp = ftp_save;\r\n\r\n    if(result)\r\n      return result;\r\n\r\n    if(conn->tunnel_state[SECONDARYSOCKET] != TUNNEL_COMPLETE) {\r\n      /* the CONNECT procedure is not complete, the tunnel is not yet up */\r\n      state(conn, FTP_STOP); /* this phase is completed */\r\n      conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE;\r\n\r\n      return result;\r\n    }\r\n  }\r\n\r\n  conn->bits.tcpconnect[SECONDARYSOCKET] = TRUE;\r\n\r\n  conn->bits.do_more = TRUE;\r\n  state(conn, FTP_STOP); /* this phase is completed */\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_port_resp(struct connectdata *conn,\r\n                                    int ftpcode)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  ftpport fcmd = (ftpport)ftpc->count1;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  if(ftpcode != 200) {\r\n    /* the command failed */\r\n\r\n    if(EPRT == fcmd) {\r\n      infof(data, \"disabling EPRT usage\\n\");\r\n      conn->bits.ftp_use_eprt = FALSE;\r\n    }\r\n    fcmd++;\r\n\r\n    if(fcmd == DONE) {\r\n      failf(data, \"Failed to do PORT\");\r\n      result = CURLE_FTP_PORT_FAILED;\r\n    }\r\n    else\r\n      /* try next */\r\n      result = ftp_state_use_port(conn, fcmd);\r\n  }\r\n  else {\r\n    infof(data, \"Connect data stream actively\\n\");\r\n    state(conn, FTP_STOP); /* end of DO phase */\r\n    result = ftp_dophase_done(conn, FALSE);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_mdtm_resp(struct connectdata *conn,\r\n                                    int ftpcode)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data=conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  switch(ftpcode) {\r\n  case 213:\r\n    {\r\n      /* we got a time. Format should be: \"YYYYMMDDHHMMSS[.sss]\" where the\r\n         last .sss part is optional and means fractions of a second */\r\n      int year, month, day, hour, minute, second;\r\n      char *buf = data->state.buffer;\r\n      if(6 == sscanf(buf+4, \"%04d%02d%02d%02d%02d%02d\",\r\n                     &year, &month, &day, &hour, &minute, &second)) {\r\n        /* we have a time, reformat it */\r\n        time_t secs=time(NULL);\r\n        /* using the good old yacc/bison yuck */\r\n        snprintf(buf, sizeof(conn->data->state.buffer),\r\n                 \"%04d%02d%02d %02d:%02d:%02d GMT\",\r\n                 year, month, day, hour, minute, second);\r\n        /* now, convert this into a time() value: */\r\n        data->info.filetime = (long)curl_getdate(buf, &secs);\r\n      }\r\n\r\n#ifdef CURL_FTP_HTTPSTYLE_HEAD\r\n      /* If we asked for a time of the file and we actually got one as well,\r\n         we \"emulate\" a HTTP-style header in our output. */\r\n\r\n      if(data->set.opt_no_body &&\r\n         ftpc->file &&\r\n         data->set.get_filetime &&\r\n         (data->info.filetime>=0) ) {\r\n        time_t filetime = (time_t)data->info.filetime;\r\n        struct tm buffer;\r\n        const struct tm *tm = &buffer;\r\n\r\n        result = Curl_gmtime(filetime, &buffer);\r\n        if(result)\r\n          return result;\r\n\r\n        /* format: \"Tue, 15 Nov 1994 12:45:26\" */\r\n        snprintf(buf, BUFSIZE-1,\r\n                 \"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\\r\\n\",\r\n                 Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],\r\n                 tm->tm_mday,\r\n                 Curl_month[tm->tm_mon],\r\n                 tm->tm_year + 1900,\r\n                 tm->tm_hour,\r\n                 tm->tm_min,\r\n                 tm->tm_sec);\r\n        result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);\r\n        if(result)\r\n          return result;\r\n      } /* end of a ridiculous amount of conditionals */\r\n#endif\r\n    }\r\n    break;\r\n  default:\r\n    infof(data, \"unsupported MDTM reply format\\n\");\r\n    break;\r\n  case 550: /* \"No such file or directory\" */\r\n    failf(data, \"Given file does not exist\");\r\n    result = CURLE_FTP_COULDNT_RETR_FILE;\r\n    break;\r\n  }\r\n\r\n  if(data->set.timecondition) {\r\n    if((data->info.filetime > 0) && (data->set.timevalue > 0)) {\r\n      switch(data->set.timecondition) {\r\n      case CURL_TIMECOND_IFMODSINCE:\r\n      default:\r\n        if(data->info.filetime <= data->set.timevalue) {\r\n          infof(data, \"The requested document is not new enough\\n\");\r\n          ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */\r\n          data->info.timecond = TRUE;\r\n          state(conn, FTP_STOP);\r\n          return CURLE_OK;\r\n        }\r\n        break;\r\n      case CURL_TIMECOND_IFUNMODSINCE:\r\n        if(data->info.filetime > data->set.timevalue) {\r\n          infof(data, \"The requested document is not old enough\\n\");\r\n          ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */\r\n          data->info.timecond = TRUE;\r\n          state(conn, FTP_STOP);\r\n          return CURLE_OK;\r\n        }\r\n        break;\r\n      } /* switch */\r\n    }\r\n    else {\r\n      infof(data, \"Skipping time comparison\\n\");\r\n    }\r\n  }\r\n\r\n  if(!result)\r\n    result = ftp_state_post_mdtm(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_type_resp(struct connectdata *conn,\r\n                                    int ftpcode,\r\n                                    ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data=conn->data;\r\n\r\n  if(ftpcode/100 != 2) {\r\n    /* \"sasserftpd\" and \"(u)r(x)bot ftpd\" both responds with 226 after a\r\n       successful 'TYPE I'. While that is not as RFC959 says, it is still a\r\n       positive response code and we allow that. */\r\n    failf(data, \"Couldn't set desired mode\");\r\n    return CURLE_FTP_COULDNT_SET_TYPE;\r\n  }\r\n  if(ftpcode != 200)\r\n    infof(data, \"Got a %03d response code instead of the assumed 200\\n\",\r\n          ftpcode);\r\n\r\n  if(instate == FTP_TYPE)\r\n    result = ftp_state_post_type(conn);\r\n  else if(instate == FTP_LIST_TYPE)\r\n    result = ftp_state_post_listtype(conn);\r\n  else if(instate == FTP_RETR_TYPE)\r\n    result = ftp_state_post_retrtype(conn);\r\n  else if(instate == FTP_STOR_TYPE)\r\n    result = ftp_state_post_stortype(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_post_retr_size(struct connectdata *conn,\r\n                                         curl_off_t filesize)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data=conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if(data->set.max_filesize && (filesize > data->set.max_filesize)) {\r\n    failf(data, \"Maximum file size exceeded\");\r\n    return CURLE_FILESIZE_EXCEEDED;\r\n  }\r\n  ftp->downloadsize = filesize;\r\n\r\n  if(data->state.resume_from) {\r\n    /* We always (attempt to) get the size of downloads, so it is done before\r\n       this even when not doing resumes. */\r\n    if(filesize == -1) {\r\n      infof(data, \"ftp server doesn't support SIZE\\n\");\r\n      /* We couldn't get the size and therefore we can't know if there really\r\n         is a part of the file left to get, although the server will just\r\n         close the connection when we start the connection so it won't cause\r\n         us any harm, just not make us exit as nicely. */\r\n    }\r\n    else {\r\n      /* We got a file size report, so we check that there actually is a\r\n         part of the file left to get, or else we go home.  */\r\n      if(data->state.resume_from< 0) {\r\n        /* We're supposed to download the last abs(from) bytes */\r\n        if(filesize < -data->state.resume_from) {\r\n          failf(data, \"Offset (%\" FORMAT_OFF_T\r\n                \") was beyond file size (%\" FORMAT_OFF_T \")\",\r\n                data->state.resume_from, filesize);\r\n          return CURLE_BAD_DOWNLOAD_RESUME;\r\n        }\r\n        /* convert to size to download */\r\n        ftp->downloadsize = -data->state.resume_from;\r\n        /* download from where? */\r\n        data->state.resume_from = filesize - ftp->downloadsize;\r\n      }\r\n      else {\r\n        if(filesize < data->state.resume_from) {\r\n          failf(data, \"Offset (%\" FORMAT_OFF_T\r\n                \") was beyond file size (%\" FORMAT_OFF_T \")\",\r\n                data->state.resume_from, filesize);\r\n          return CURLE_BAD_DOWNLOAD_RESUME;\r\n        }\r\n        /* Now store the number of bytes we are expected to download */\r\n        ftp->downloadsize = filesize-data->state.resume_from;\r\n      }\r\n    }\r\n\r\n    if(ftp->downloadsize == 0) {\r\n      /* no data to transfer */\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n      infof(data, \"File already completely downloaded\\n\");\r\n\r\n      /* Set ->transfer so that we won't get any error in ftp_done()\r\n       * because we didn't transfer the any file */\r\n      ftp->transfer = FTPTRANSFER_NONE;\r\n      state(conn, FTP_STOP);\r\n      return CURLE_OK;\r\n    }\r\n\r\n    /* Set resume file transfer offset */\r\n    infof(data, \"Instructs server to resume from offset %\" FORMAT_OFF_T\r\n          \"\\n\", data->state.resume_from);\r\n\r\n    PPSENDF(&ftpc->pp, \"REST %\" FORMAT_OFF_T, data->state.resume_from);\r\n\r\n    state(conn, FTP_RETR_REST);\r\n\r\n  }\r\n  else {\r\n    /* no resume */\r\n    PPSENDF(&ftpc->pp, \"RETR %s\", ftpc->file);\r\n    state(conn, FTP_RETR);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_size_resp(struct connectdata *conn,\r\n                                    int ftpcode,\r\n                                    ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data=conn->data;\r\n  curl_off_t filesize;\r\n  char *buf = data->state.buffer;\r\n\r\n  /* get the size from the ascii string: */\r\n  filesize = (ftpcode == 213)?curlx_strtoofft(buf+4, NULL, 0):-1;\r\n\r\n  if(instate == FTP_SIZE) {\r\n#ifdef CURL_FTP_HTTPSTYLE_HEAD\r\n    if(-1 != filesize) {\r\n      snprintf(buf, sizeof(data->state.buffer),\r\n               \"Content-Length: %\" FORMAT_OFF_T \"\\r\\n\", filesize);\r\n      result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);\r\n      if(result)\r\n        return result;\r\n    }\r\n#endif\r\n    Curl_pgrsSetDownloadSize(data, filesize);\r\n    result = ftp_state_post_size(conn);\r\n  }\r\n  else if(instate == FTP_RETR_SIZE) {\r\n    Curl_pgrsSetDownloadSize(data, filesize);\r\n    result = ftp_state_post_retr_size(conn, filesize);\r\n  }\r\n  else if(instate == FTP_STOR_SIZE) {\r\n    data->state.resume_from = filesize;\r\n    result = ftp_state_ul_setup(conn, TRUE);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_rest_resp(struct connectdata *conn,\r\n                                    int ftpcode,\r\n                                    ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  switch(instate) {\r\n  case FTP_REST:\r\n  default:\r\n#ifdef CURL_FTP_HTTPSTYLE_HEAD\r\n    if(ftpcode == 350) {\r\n      char buffer[24]= { \"Accept-ranges: bytes\\r\\n\" };\r\n      result = Curl_client_write(conn, CLIENTWRITE_BOTH, buffer, 0);\r\n      if(result)\r\n        return result;\r\n    }\r\n#endif\r\n    result = ftp_state_post_rest(conn);\r\n    break;\r\n\r\n  case FTP_RETR_REST:\r\n    if(ftpcode != 350) {\r\n      failf(conn->data, \"Couldn't use REST\");\r\n      result = CURLE_FTP_COULDNT_USE_REST;\r\n    }\r\n    else {\r\n      PPSENDF(&ftpc->pp, \"RETR %s\", ftpc->file);\r\n      state(conn, FTP_RETR);\r\n    }\r\n    break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_state_stor_resp(struct connectdata *conn,\r\n                                    int ftpcode, ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(ftpcode>=400) {\r\n    failf(data, \"Failed FTP upload: %0d\", ftpcode);\r\n    state(conn, FTP_STOP);\r\n    /* oops, we never close the sockets! */\r\n    return CURLE_UPLOAD_FAILED;\r\n  }\r\n\r\n  conn->proto.ftpc.state_saved = instate;\r\n\r\n  /* PORT means we are now awaiting the server to connect to us. */\r\n  if(data->set.ftp_use_port) {\r\n    bool connected;\r\n\r\n    result = AllowServerConnect(conn, &connected);\r\n    if(result)\r\n      return result;\r\n\r\n    if(!connected) {\r\n      struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n      infof(data, \"Data conn was not available immediately\\n\");\r\n      ftpc->wait_data_conn = TRUE;\r\n    }\r\n\r\n    return CURLE_OK;\r\n  }\r\n  else\r\n    return InitiateTransfer(conn);\r\n}\r\n\r\n/* for LIST and RETR responses */\r\nstatic CURLcode ftp_state_get_resp(struct connectdata *conn,\r\n                                    int ftpcode,\r\n                                    ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  char *buf = data->state.buffer;\r\n\r\n  if((ftpcode == 150) || (ftpcode == 125)) {\r\n\r\n    /*\r\n      A;\r\n      150 Opening BINARY mode data connection for /etc/passwd (2241\r\n      bytes).  (ok, the file is being transferred)\r\n\r\n      B:\r\n      150 Opening ASCII mode data connection for /bin/ls\r\n\r\n      C:\r\n      150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes).\r\n\r\n      D:\r\n      150 Opening ASCII mode data connection for [file] (0.0.0.0,0) (545 bytes)\r\n\r\n      E:\r\n      125 Data connection already open; Transfer starting. */\r\n\r\n    curl_off_t size=-1; /* default unknown size */\r\n\r\n\r\n    /*\r\n     * It appears that there are FTP-servers that return size 0 for files when\r\n     * SIZE is used on the file while being in BINARY mode. To work around\r\n     * that (stupid) behavior, we attempt to parse the RETR response even if\r\n     * the SIZE returned size zero.\r\n     *\r\n     * Debugging help from Salvatore Sorrentino on February 26, 2003.\r\n     */\r\n\r\n    if((instate != FTP_LIST) &&\r\n       !data->set.prefer_ascii &&\r\n       (ftp->downloadsize < 1)) {\r\n      /*\r\n       * It seems directory listings either don't show the size or very\r\n       * often uses size 0 anyway. ASCII transfers may very well turn out\r\n       * that the transferred amount of data is not the same as this line\r\n       * tells, why using this number in those cases only confuses us.\r\n       *\r\n       * Example D above makes this parsing a little tricky */\r\n      char *bytes;\r\n      bytes=strstr(buf, \" bytes\");\r\n      if(bytes--) {\r\n        long in=(long)(bytes-buf);\r\n        /* this is a hint there is size information in there! ;-) */\r\n        while(--in) {\r\n          /* scan for the left parenthesis and break there */\r\n          if('(' == *bytes)\r\n            break;\r\n          /* skip only digits */\r\n          if(!ISDIGIT(*bytes)) {\r\n            bytes=NULL;\r\n            break;\r\n          }\r\n          /* one more estep backwards */\r\n          bytes--;\r\n        }\r\n        /* if we have nothing but digits: */\r\n        if(bytes++) {\r\n          /* get the number! */\r\n          size = curlx_strtoofft(bytes, NULL, 0);\r\n        }\r\n      }\r\n    }\r\n    else if(ftp->downloadsize > -1)\r\n      size = ftp->downloadsize;\r\n\r\n    if(size > data->req.maxdownload && data->req.maxdownload > 0)\r\n      size = data->req.size = data->req.maxdownload;\r\n    else if((instate != FTP_LIST) && (data->set.prefer_ascii))\r\n      size = -1; /* kludge for servers that understate ASCII mode file size */\r\n\r\n    infof(data, \"Maxdownload = %\" FORMAT_OFF_T \"\\n\", data->req.maxdownload);\r\n\r\n    if(instate != FTP_LIST)\r\n      infof(data, \"Getting file with size: %\" FORMAT_OFF_T \"\\n\", size);\r\n\r\n    /* FTP download: */\r\n    conn->proto.ftpc.state_saved = instate;\r\n    conn->proto.ftpc.retr_size_saved = size;\r\n\r\n    if(data->set.ftp_use_port) {\r\n      bool connected;\r\n\r\n      result = AllowServerConnect(conn, &connected);\r\n      if(result)\r\n        return result;\r\n\r\n      if(!connected) {\r\n        struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n        infof(data, \"Data conn was not available immediately\\n\");\r\n        state(conn, FTP_STOP);\r\n        ftpc->wait_data_conn = TRUE;\r\n      }\r\n    }\r\n    else\r\n      return InitiateTransfer(conn);\r\n  }\r\n  else {\r\n    if((instate == FTP_LIST) && (ftpcode == 450)) {\r\n      /* simply no matching files in the dir listing */\r\n      ftp->transfer = FTPTRANSFER_NONE; /* don't download anything */\r\n      state(conn, FTP_STOP); /* this phase is over */\r\n    }\r\n    else {\r\n      failf(data, \"RETR response: %03d\", ftpcode);\r\n      return instate == FTP_RETR && ftpcode == 550?\r\n        CURLE_REMOTE_FILE_NOT_FOUND:\r\n        CURLE_FTP_COULDNT_RETR_FILE;\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* after USER, PASS and ACCT */\r\nstatic CURLcode ftp_state_loggedin(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n#ifdef HAVE_KRB4\r\n  if(conn->data->set.krb) {\r\n    /* We may need to issue a KAUTH here to have access to the files\r\n     * do it if user supplied a password\r\n     */\r\n    if(conn->passwd && *conn->passwd) {\r\n      /* BLOCKING */\r\n      result = Curl_krb_kauth(conn);\r\n      if(result)\r\n        return result;\r\n    }\r\n  }\r\n#endif\r\n  if(conn->ssl[FIRSTSOCKET].use) {\r\n    /* PBSZ = PROTECTION BUFFER SIZE.\r\n\r\n    The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says:\r\n\r\n    Specifically, the PROT command MUST be preceded by a PBSZ\r\n    command and a PBSZ command MUST be preceded by a successful\r\n    security data exchange (the TLS negotiation in this case)\r\n\r\n    ... (and on page 8):\r\n\r\n    Thus the PBSZ command must still be issued, but must have a\r\n    parameter of '0' to indicate that no buffering is taking place\r\n    and the data connection should not be encapsulated.\r\n    */\r\n    PPSENDF(&conn->proto.ftpc.pp, \"PBSZ %d\", 0);\r\n    state(conn, FTP_PBSZ);\r\n  }\r\n  else {\r\n    result = ftp_state_pwd(conn);\r\n  }\r\n  return result;\r\n}\r\n\r\n/* for USER and PASS responses */\r\nstatic CURLcode ftp_state_user_resp(struct connectdata *conn,\r\n                                    int ftpcode,\r\n                                    ftpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  (void)instate; /* no use for this yet */\r\n\r\n  /* some need password anyway, and others just return 2xx ignored */\r\n  if((ftpcode == 331) && (ftpc->state == FTP_USER)) {\r\n    /* 331 Password required for ...\r\n       (the server requires to send the user's password too) */\r\n    PPSENDF(&ftpc->pp, \"PASS %s\", ftp->passwd?ftp->passwd:\"\");\r\n    state(conn, FTP_PASS);\r\n  }\r\n  else if(ftpcode/100 == 2) {\r\n    /* 230 User ... logged in.\r\n       (the user logged in with or without password) */\r\n    result = ftp_state_loggedin(conn);\r\n  }\r\n  else if(ftpcode == 332) {\r\n    if(data->set.str[STRING_FTP_ACCOUNT]) {\r\n      PPSENDF(&ftpc->pp, \"ACCT %s\", data->set.str[STRING_FTP_ACCOUNT]);\r\n      state(conn, FTP_ACCT);\r\n    }\r\n    else {\r\n      failf(data, \"ACCT requested but none available\");\r\n      result = CURLE_LOGIN_DENIED;\r\n    }\r\n  }\r\n  else {\r\n    /* All other response codes, like:\r\n\r\n    530 User ... access denied\r\n    (the server denies to log the specified user) */\r\n\r\n    if(conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] &&\r\n        !conn->data->state.ftp_trying_alternative) {\r\n      /* Ok, USER failed.  Let's try the supplied command. */\r\n      PPSENDF(&conn->proto.ftpc.pp, \"%s\",\r\n              conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]);\r\n      conn->data->state.ftp_trying_alternative = TRUE;\r\n      state(conn, FTP_USER);\r\n      result = CURLE_OK;\r\n    }\r\n    else {\r\n      failf(data, \"Access denied: %03d\", ftpcode);\r\n      result = CURLE_LOGIN_DENIED;\r\n    }\r\n  }\r\n  return result;\r\n}\r\n\r\n/* for ACCT response */\r\nstatic CURLcode ftp_state_acct_resp(struct connectdata *conn,\r\n                                    int ftpcode)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  if(ftpcode != 230) {\r\n    failf(data, \"ACCT rejected by server: %03d\", ftpcode);\r\n    result = CURLE_FTP_WEIRD_PASS_REPLY; /* FIX */\r\n  }\r\n  else\r\n    result = ftp_state_loggedin(conn);\r\n\r\n  return result;\r\n}\r\n\r\n\r\nstatic CURLcode ftp_statemach_act(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  struct SessionHandle *data=conn->data;\r\n  int ftpcode;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n  static const char ftpauth[][4]  = { \"SSL\", \"TLS\" };\r\n  size_t nread = 0;\r\n\r\n  if(pp->sendleft)\r\n    return Curl_pp_flushsend(pp);\r\n\r\n  result = ftp_readresp(sock, pp, &ftpcode, &nread);\r\n  if(result)\r\n    return result;\r\n\r\n  if(ftpcode) {\r\n    /* we have now received a full FTP server response */\r\n    switch(ftpc->state) {\r\n    case FTP_WAIT220:\r\n      if(ftpcode != 220) {\r\n        failf(data, \"Got a %03d ftp-server response when 220 was expected\",\r\n              ftpcode);\r\n        return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n      }\r\n\r\n      /* We have received a 220 response fine, now we proceed. */\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n      if(data->set.krb) {\r\n        /* If not anonymous login, try a secure login. Note that this\r\n           procedure is still BLOCKING. */\r\n\r\n        Curl_sec_request_prot(conn, \"private\");\r\n        /* We set private first as default, in case the line below fails to\r\n           set a valid level */\r\n        Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]);\r\n\r\n        if(Curl_sec_login(conn) != CURLE_OK)\r\n          infof(data, \"Logging in with password in cleartext!\\n\");\r\n        else\r\n          infof(data, \"Authentication successful\\n\");\r\n      }\r\n#endif\r\n\r\n      if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {\r\n        /* We don't have a SSL/TLS connection yet, but FTPS is\r\n           requested. Try a FTPS connection now */\r\n\r\n        ftpc->count3=0;\r\n        switch(data->set.ftpsslauth) {\r\n        case CURLFTPAUTH_DEFAULT:\r\n        case CURLFTPAUTH_SSL:\r\n          ftpc->count2 = 1; /* add one to get next */\r\n          ftpc->count1 = 0;\r\n          break;\r\n        case CURLFTPAUTH_TLS:\r\n          ftpc->count2 = -1; /* subtract one to get next */\r\n          ftpc->count1 = 1;\r\n          break;\r\n        default:\r\n          failf(data, \"unsupported parameter to CURLOPT_FTPSSLAUTH: %d\",\r\n                (int)data->set.ftpsslauth);\r\n          return CURLE_UNKNOWN_OPTION; /* we don't know what to do */\r\n        }\r\n        PPSENDF(&ftpc->pp, \"AUTH %s\", ftpauth[ftpc->count1]);\r\n        state(conn, FTP_AUTH);\r\n      }\r\n      else {\r\n        result = ftp_state_user(conn);\r\n        if(result)\r\n          return result;\r\n      }\r\n\r\n      break;\r\n\r\n    case FTP_AUTH:\r\n      /* we have gotten the response to a previous AUTH command */\r\n\r\n      /* RFC2228 (page 5) says:\r\n       *\r\n       * If the server is willing to accept the named security mechanism,\r\n       * and does not require any security data, it must respond with\r\n       * reply code 234/334.\r\n       */\r\n\r\n      if((ftpcode == 234) || (ftpcode == 334)) {\r\n        /* Curl_ssl_connect is BLOCKING */\r\n        result = Curl_ssl_connect(conn, FIRSTSOCKET);\r\n        if(CURLE_OK == result) {\r\n          conn->ssl[SECONDARYSOCKET].use = FALSE; /* clear-text data */\r\n          result = ftp_state_user(conn);\r\n        }\r\n      }\r\n      else if(ftpc->count3 < 1) {\r\n        ftpc->count3++;\r\n        ftpc->count1 += ftpc->count2; /* get next attempt */\r\n        result = Curl_pp_sendf(&ftpc->pp, \"AUTH %s\", ftpauth[ftpc->count1]);\r\n        /* remain in this same state */\r\n      }\r\n      else {\r\n        if(data->set.use_ssl > CURLUSESSL_TRY)\r\n          /* we failed and CURLUSESSL_CONTROL or CURLUSESSL_ALL is set */\r\n          result = CURLE_USE_SSL_FAILED;\r\n        else\r\n          /* ignore the failure and continue */\r\n          result = ftp_state_user(conn);\r\n      }\r\n\r\n      if(result)\r\n        return result;\r\n      break;\r\n\r\n    case FTP_USER:\r\n    case FTP_PASS:\r\n      result = ftp_state_user_resp(conn, ftpcode, ftpc->state);\r\n      break;\r\n\r\n    case FTP_ACCT:\r\n      result = ftp_state_acct_resp(conn, ftpcode);\r\n      break;\r\n\r\n    case FTP_PBSZ:\r\n      PPSENDF(&ftpc->pp, \"PROT %c\",\r\n              data->set.use_ssl == CURLUSESSL_CONTROL ? 'C' : 'P');\r\n      state(conn, FTP_PROT);\r\n\r\n      break;\r\n\r\n    case FTP_PROT:\r\n      if(ftpcode/100 == 2)\r\n        /* We have enabled SSL for the data connection! */\r\n        conn->ssl[SECONDARYSOCKET].use =\r\n          (data->set.use_ssl != CURLUSESSL_CONTROL) ? TRUE : FALSE;\r\n      /* FTP servers typically responds with 500 if they decide to reject\r\n         our 'P' request */\r\n      else if(data->set.use_ssl > CURLUSESSL_CONTROL)\r\n        /* we failed and bails out */\r\n        return CURLE_USE_SSL_FAILED;\r\n\r\n      if(data->set.ftp_ccc) {\r\n        /* CCC - Clear Command Channel\r\n         */\r\n        PPSENDF(&ftpc->pp, \"CCC\", NULL);\r\n        state(conn, FTP_CCC);\r\n      }\r\n      else {\r\n        result = ftp_state_pwd(conn);\r\n        if(result)\r\n          return result;\r\n      }\r\n      break;\r\n\r\n    case FTP_CCC:\r\n      if(ftpcode < 500) {\r\n        /* First shut down the SSL layer (note: this call will block) */\r\n        result = Curl_ssl_shutdown(conn, FIRSTSOCKET);\r\n\r\n        if(result) {\r\n          failf(conn->data, \"Failed to clear the command channel (CCC)\");\r\n          return result;\r\n        }\r\n      }\r\n\r\n      /* Then continue as normal */\r\n      result = ftp_state_pwd(conn);\r\n      if(result)\r\n        return result;\r\n      break;\r\n\r\n    case FTP_PWD:\r\n      if(ftpcode == 257) {\r\n        char *ptr=&data->state.buffer[4];  /* start on the first letter */\r\n        char *dir;\r\n        char *store;\r\n\r\n        dir = malloc(nread + 1);\r\n        if(!dir)\r\n          return CURLE_OUT_OF_MEMORY;\r\n\r\n        /* Reply format is like\r\n           257<space>\"<directory-name>\"<space><commentary> and the RFC959\r\n           says\r\n\r\n           The directory name can contain any character; embedded\r\n           double-quotes should be escaped by double-quotes (the\r\n           \"quote-doubling\" convention).\r\n        */\r\n        if('\\\"' == *ptr) {\r\n          /* it started good */\r\n          ptr++;\r\n          for(store = dir; *ptr;) {\r\n            if('\\\"' == *ptr) {\r\n              if('\\\"' == ptr[1]) {\r\n                /* \"quote-doubling\" */\r\n                *store = ptr[1];\r\n                ptr++;\r\n              }\r\n              else {\r\n                /* end of path */\r\n                *store = '\\0'; /* zero terminate */\r\n                break; /* get out of this loop */\r\n              }\r\n            }\r\n            else\r\n              *store = *ptr;\r\n            store++;\r\n            ptr++;\r\n          }\r\n\r\n          /* If the path name does not look like an absolute path (i.e.: it\r\n             does not start with a '/'), we probably need some server-dependent\r\n             adjustments. For example, this is the case when connecting to\r\n             an OS400 FTP server: this server supports two name syntaxes,\r\n             the default one being incompatible with standard pathes. In\r\n             addition, this server switches automatically to the regular path\r\n             syntax when one is encountered in a command: this results in\r\n             having an entrypath in the wrong syntax when later used in CWD.\r\n               The method used here is to check the server OS: we do it only\r\n             if the path name looks strange to minimize overhead on other\r\n             systems. */\r\n\r\n          if(!ftpc->server_os && dir[0] != '/') {\r\n\r\n            result = Curl_pp_sendf(&ftpc->pp, \"SYST\", NULL);\r\n            if(result != CURLE_OK) {\r\n              free(dir);\r\n              return result;\r\n            }\r\n            Curl_safefree(ftpc->entrypath);\r\n            ftpc->entrypath = dir; /* remember this */\r\n            infof(data, \"Entry path is '%s'\\n\", ftpc->entrypath);\r\n            /* also save it where getinfo can access it: */\r\n            data->state.most_recent_ftp_entrypath = ftpc->entrypath;\r\n            state(conn, FTP_SYST);\r\n            break;\r\n          }\r\n\r\n          Curl_safefree(ftpc->entrypath);\r\n          ftpc->entrypath = dir; /* remember this */\r\n          infof(data, \"Entry path is '%s'\\n\", ftpc->entrypath);\r\n          /* also save it where getinfo can access it: */\r\n          data->state.most_recent_ftp_entrypath = ftpc->entrypath;\r\n        }\r\n        else {\r\n          /* couldn't get the path */\r\n          free(dir);\r\n          infof(data, \"Failed to figure out path\\n\");\r\n        }\r\n      }\r\n      state(conn, FTP_STOP); /* we are done with the CONNECT phase! */\r\n      DEBUGF(infof(data, \"protocol connect phase DONE\\n\"));\r\n      break;\r\n\r\n    case FTP_SYST:\r\n      if(ftpcode == 215) {\r\n        char *ptr=&data->state.buffer[4];  /* start on the first letter */\r\n        char *os;\r\n        char *store;\r\n\r\n        os = malloc(nread + 1);\r\n        if(!os)\r\n          return CURLE_OUT_OF_MEMORY;\r\n\r\n        /* Reply format is like\r\n           215<space><OS-name><space><commentary>\r\n        */\r\n        while(*ptr == ' ')\r\n          ptr++;\r\n        for(store = os; *ptr && *ptr != ' ';)\r\n          *store++ = *ptr++;\r\n        *store = '\\0'; /* zero terminate */\r\n\r\n        /* Check for special servers here. */\r\n\r\n        if(strequal(os, \"OS/400\")) {\r\n          /* Force OS400 name format 1. */\r\n          result = Curl_pp_sendf(&ftpc->pp, \"SITE NAMEFMT 1\", NULL);\r\n          if(result != CURLE_OK) {\r\n            free(os);\r\n            return result;\r\n          }\r\n          /* remember target server OS */\r\n          Curl_safefree(ftpc->server_os);\r\n          ftpc->server_os = os;\r\n          state(conn, FTP_NAMEFMT);\r\n          break;\r\n        }\r\n        else {\r\n          /* Nothing special for the target server. */\r\n          /* remember target server OS */\r\n          Curl_safefree(ftpc->server_os);\r\n          ftpc->server_os = os;\r\n        }\r\n      }\r\n      else {\r\n        /* Cannot identify server OS. Continue anyway and cross fingers. */\r\n      }\r\n\r\n      state(conn, FTP_STOP); /* we are done with the CONNECT phase! */\r\n      DEBUGF(infof(data, \"protocol connect phase DONE\\n\"));\r\n      break;\r\n\r\n    case FTP_NAMEFMT:\r\n      if(ftpcode == 250) {\r\n        /* Name format change successful: reload initial path. */\r\n        ftp_state_pwd(conn);\r\n        break;\r\n      }\r\n\r\n      state(conn, FTP_STOP); /* we are done with the CONNECT phase! */\r\n      DEBUGF(infof(data, \"protocol connect phase DONE\\n\"));\r\n      break;\r\n\r\n    case FTP_QUOTE:\r\n    case FTP_POSTQUOTE:\r\n    case FTP_RETR_PREQUOTE:\r\n    case FTP_STOR_PREQUOTE:\r\n      if((ftpcode >= 400) && !ftpc->count2) {\r\n        /* failure response code, and not allowed to fail */\r\n        failf(conn->data, \"QUOT command failed with %03d\", ftpcode);\r\n        return CURLE_QUOTE_ERROR;\r\n      }\r\n      result = ftp_state_quote(conn, FALSE, ftpc->state);\r\n      if(result)\r\n        return result;\r\n\r\n      break;\r\n\r\n    case FTP_CWD:\r\n      if(ftpcode/100 != 2) {\r\n        /* failure to CWD there */\r\n        if(conn->data->set.ftp_create_missing_dirs &&\r\n           ftpc->count1 && !ftpc->count2) {\r\n          /* try making it */\r\n          ftpc->count2++; /* counter to prevent CWD-MKD loops */\r\n          PPSENDF(&ftpc->pp, \"MKD %s\", ftpc->dirs[ftpc->count1 - 1]);\r\n          state(conn, FTP_MKD);\r\n        }\r\n        else {\r\n          /* return failure */\r\n          failf(data, \"Server denied you to change to the given directory\");\r\n          ftpc->cwdfail = TRUE; /* don't remember this path as we failed\r\n                                   to enter it */\r\n          return CURLE_REMOTE_ACCESS_DENIED;\r\n        }\r\n      }\r\n      else {\r\n        /* success */\r\n        ftpc->count2=0;\r\n        if(++ftpc->count1 <= ftpc->dirdepth) {\r\n          /* send next CWD */\r\n          PPSENDF(&ftpc->pp, \"CWD %s\", ftpc->dirs[ftpc->count1 - 1]);\r\n        }\r\n        else {\r\n          result = ftp_state_post_cwd(conn);\r\n          if(result)\r\n            return result;\r\n        }\r\n      }\r\n      break;\r\n\r\n    case FTP_MKD:\r\n      if((ftpcode/100 != 2) && !ftpc->count3--) {\r\n        /* failure to MKD the dir */\r\n        failf(data, \"Failed to MKD dir: %03d\", ftpcode);\r\n        return CURLE_REMOTE_ACCESS_DENIED;\r\n      }\r\n      state(conn, FTP_CWD);\r\n      /* send CWD */\r\n      PPSENDF(&ftpc->pp, \"CWD %s\", ftpc->dirs[ftpc->count1 - 1]);\r\n      break;\r\n\r\n    case FTP_MDTM:\r\n      result = ftp_state_mdtm_resp(conn, ftpcode);\r\n      break;\r\n\r\n    case FTP_TYPE:\r\n    case FTP_LIST_TYPE:\r\n    case FTP_RETR_TYPE:\r\n    case FTP_STOR_TYPE:\r\n      result = ftp_state_type_resp(conn, ftpcode, ftpc->state);\r\n      break;\r\n\r\n    case FTP_SIZE:\r\n    case FTP_RETR_SIZE:\r\n    case FTP_STOR_SIZE:\r\n      result = ftp_state_size_resp(conn, ftpcode, ftpc->state);\r\n      break;\r\n\r\n    case FTP_REST:\r\n    case FTP_RETR_REST:\r\n      result = ftp_state_rest_resp(conn, ftpcode, ftpc->state);\r\n      break;\r\n\r\n    case FTP_PRET:\r\n      if(ftpcode != 200) {\r\n        /* there only is this one standard OK return code. */\r\n        failf(data, \"PRET command not accepted: %03d\", ftpcode);\r\n        return CURLE_FTP_PRET_FAILED;\r\n      }\r\n      result = ftp_state_use_pasv(conn);\r\n      break;\r\n\r\n    case FTP_PASV:\r\n      result = ftp_state_pasv_resp(conn, ftpcode);\r\n      break;\r\n\r\n    case FTP_PORT:\r\n      result = ftp_state_port_resp(conn, ftpcode);\r\n      break;\r\n\r\n    case FTP_LIST:\r\n    case FTP_RETR:\r\n      result = ftp_state_get_resp(conn, ftpcode, ftpc->state);\r\n      break;\r\n\r\n    case FTP_STOR:\r\n      result = ftp_state_stor_resp(conn, ftpcode, ftpc->state);\r\n      break;\r\n\r\n    case FTP_QUIT:\r\n      /* fallthrough, just stop! */\r\n    default:\r\n      /* internal error */\r\n      state(conn, FTP_STOP);\r\n      break;\r\n    }\r\n  } /* if(ftpcode) */\r\n\r\n  return result;\r\n}\r\n\r\n\r\n/* called repeatedly until done from multi.c */\r\nstatic CURLcode ftp_multi_statemach(struct connectdata *conn,\r\n                                    bool *done)\r\n{\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  CURLcode result = Curl_pp_multi_statemach(&ftpc->pp);\r\n\r\n  /* Check for the state outside of the Curl_socket_ready() return code checks\r\n     since at times we are in fact already in this state when this function\r\n     gets called. */\r\n  *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE;\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_easy_statemach(struct connectdata *conn)\r\n{\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  while(ftpc->state != FTP_STOP) {\r\n    result = Curl_pp_easy_statemach(pp);\r\n    if(result)\r\n      break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * Allocate and initialize the struct FTP for the current SessionHandle.  If\r\n * need be.\r\n */\r\n\r\n#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \\\r\n    defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__)\r\n  /* workaround icc 9.1 optimizer issue */\r\n#pragma optimize(\"\", off)\r\n#endif\r\n\r\nstatic CURLcode ftp_init(struct connectdata *conn)\r\n{\r\n  struct FTP *ftp;\r\n\r\n  if(NULL == conn->data->state.proto.ftp) {\r\n    conn->data->state.proto.ftp = malloc(sizeof(struct FTP));\r\n    if(NULL == conn->data->state.proto.ftp)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  ftp = conn->data->state.proto.ftp;\r\n\r\n  /* get some initial data into the ftp struct */\r\n  ftp->bytecountp = &conn->data->req.bytecount;\r\n  ftp->transfer = FTPTRANSFER_BODY;\r\n  ftp->downloadsize = 0;\r\n\r\n  /* No need to duplicate user+password, the connectdata struct won't change\r\n     during a session, but we re-init them here since on subsequent inits\r\n     since the conn struct may have changed or been replaced.\r\n  */\r\n  ftp->user = conn->user;\r\n  ftp->passwd = conn->passwd;\r\n  if(isBadFtpString(ftp->user))\r\n    return CURLE_URL_MALFORMAT;\r\n  if(isBadFtpString(ftp->passwd))\r\n    return CURLE_URL_MALFORMAT;\r\n\r\n  conn->proto.ftpc.known_filesize = -1; /* unknown size for now */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \\\r\n    defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__)\r\n  /* workaround icc 9.1 optimizer issue */\r\n#pragma optimize(\"\", on)\r\n#endif\r\n\r\n/*\r\n * ftp_connect() should do everything that is to be considered a part of\r\n * the connection phase.\r\n *\r\n * The variable 'done' points to will be TRUE if the protocol-layer connect\r\n * phase is done when this function returns, or FALSE is not. When called as\r\n * a part of the easy interface, it will always be TRUE.\r\n */\r\nstatic CURLcode ftp_connect(struct connectdata *conn,\r\n                                 bool *done) /* see description above */\r\n{\r\n  CURLcode result;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n\r\n  *done = FALSE; /* default to not done yet */\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  result = ftp_init(conn);\r\n  if(CURLE_OK != result)\r\n    return result;\r\n\r\n  /* We always support persistent connections on ftp */\r\n  conn->bits.close = FALSE;\r\n\r\n  pp->response_time = RESP_TIMEOUT; /* set default response time-out */\r\n  pp->statemach_act = ftp_statemach_act;\r\n  pp->endofresp = ftp_endofresp;\r\n  pp->conn = conn;\r\n\r\n  if(conn->handler->flags & PROTOPT_SSL) {\r\n    /* BLOCKING */\r\n    result = Curl_ssl_connect(conn, FIRSTSOCKET);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  Curl_pp_init(pp); /* init the generic pingpong data */\r\n\r\n  /* When we connect, we start in the state where we await the 220\r\n     response */\r\n  state(conn, FTP_WAIT220);\r\n\r\n  result = ftp_multi_statemach(conn, done);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_done()\r\n *\r\n * The DONE function. This does what needs to be done after a single DO has\r\n * performed.\r\n *\r\n * Input argument is already checked for validity.\r\n */\r\nstatic CURLcode ftp_done(struct connectdata *conn, CURLcode status,\r\n                              bool premature)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n  ssize_t nread;\r\n  int ftpcode;\r\n  CURLcode result = CURLE_OK;\r\n  bool was_ctl_valid = ftpc->ctl_valid;\r\n  char *path;\r\n  const char *path_to_use = data->state.path;\r\n\r\n  if(!ftp)\r\n    /* When the easy handle is removed from the multi while libcurl is still\r\n     * trying to resolve the host name, it seems that the ftp struct is not\r\n     * yet initialized, but the removal action calls Curl_done() which calls\r\n     * this function. So we simply return success if no ftp pointer is set.\r\n     */\r\n    return CURLE_OK;\r\n\r\n  switch(status) {\r\n  case CURLE_BAD_DOWNLOAD_RESUME:\r\n  case CURLE_FTP_WEIRD_PASV_REPLY:\r\n  case CURLE_FTP_PORT_FAILED:\r\n  case CURLE_FTP_ACCEPT_FAILED:\r\n  case CURLE_FTP_ACCEPT_TIMEOUT:\r\n  case CURLE_FTP_COULDNT_SET_TYPE:\r\n  case CURLE_FTP_COULDNT_RETR_FILE:\r\n  case CURLE_PARTIAL_FILE:\r\n  case CURLE_UPLOAD_FAILED:\r\n  case CURLE_REMOTE_ACCESS_DENIED:\r\n  case CURLE_FILESIZE_EXCEEDED:\r\n  case CURLE_REMOTE_FILE_NOT_FOUND:\r\n  case CURLE_WRITE_ERROR:\r\n    /* the connection stays alive fine even though this happened */\r\n    /* fall-through */\r\n  case CURLE_OK: /* doesn't affect the control connection's status */\r\n    if(!premature) {\r\n      ftpc->ctl_valid = was_ctl_valid;\r\n      break;\r\n    }\r\n    /* until we cope better with prematurely ended requests, let them\r\n     * fallback as if in complete failure */\r\n  default:       /* by default, an error means the control connection is\r\n                    wedged and should not be used anymore */\r\n    ftpc->ctl_valid = FALSE;\r\n    ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the\r\n                             current path, as this connection is going */\r\n    conn->bits.close = TRUE; /* marked for closure */\r\n    result = status;      /* use the already set error code */\r\n    break;\r\n  }\r\n\r\n  /* now store a copy of the directory we are in */\r\n  if(ftpc->prevpath)\r\n    free(ftpc->prevpath);\r\n\r\n  if(data->set.wildcardmatch) {\r\n    if(data->set.chunk_end && ftpc->file) {\r\n      data->set.chunk_end(data->wildcard.customptr);\r\n    }\r\n    ftpc->known_filesize = -1;\r\n  }\r\n\r\n  /* get the \"raw\" path */\r\n  path = curl_easy_unescape(data, path_to_use, 0, NULL);\r\n  if(!path) {\r\n    /* out of memory, but we can limp along anyway (and should try to\r\n     * since we may already be in the out of memory cleanup path) */\r\n    if(!result)\r\n      result = CURLE_OUT_OF_MEMORY;\r\n    ftpc->ctl_valid = FALSE; /* mark control connection as bad */\r\n    conn->bits.close = TRUE; /* mark for connection closure */\r\n    ftpc->prevpath = NULL; /* no path remembering */\r\n  }\r\n  else {\r\n    size_t flen = ftpc->file?strlen(ftpc->file):0; /* file is \"raw\" already */\r\n    size_t dlen = strlen(path)-flen;\r\n    if(!ftpc->cwdfail) {\r\n      if(dlen && (data->set.ftp_filemethod != FTPFILE_NOCWD)) {\r\n        ftpc->prevpath = path;\r\n        if(flen)\r\n          /* if 'path' is not the whole string */\r\n          ftpc->prevpath[dlen]=0; /* terminate */\r\n      }\r\n      else {\r\n        /* we never changed dir */\r\n        ftpc->prevpath=strdup(\"\");\r\n        free(path);\r\n      }\r\n      if(ftpc->prevpath)\r\n        infof(data, \"Remembering we are in dir \\\"%s\\\"\\n\", ftpc->prevpath);\r\n    }\r\n    else {\r\n      ftpc->prevpath = NULL; /* no path */\r\n      free(path);\r\n    }\r\n  }\r\n  /* free the dir tree and file parts */\r\n  freedirs(ftpc);\r\n\r\n  /* shut down the socket to inform the server we're done */\r\n\r\n#ifdef _WIN32_WCE\r\n  shutdown(conn->sock[SECONDARYSOCKET],2);  /* SD_BOTH */\r\n#endif\r\n\r\n  if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {\r\n    if(!result && ftpc->dont_check && data->req.maxdownload > 0)\r\n      /* partial download completed */\r\n      result = Curl_pp_sendf(pp, \"ABOR\");\r\n      if(result) {\r\n        failf(data, \"Failure sending ABOR command: %s\",\r\n              curl_easy_strerror(result));\r\n        ftpc->ctl_valid = FALSE; /* mark control connection as bad */\r\n        conn->bits.close = TRUE; /* mark for connection closure */\r\n      }\r\n\r\n    if(conn->ssl[SECONDARYSOCKET].use) {\r\n      /* The secondary socket is using SSL so we must close down that part\r\n         first before we close the socket for real */\r\n      Curl_ssl_close(conn, SECONDARYSOCKET);\r\n\r\n      /* Note that we keep \"use\" set to TRUE since that (next) connection is\r\n         still requested to use SSL */\r\n    }\r\n    if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) {\r\n      Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]);\r\n      conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;\r\n      conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE;\r\n    }\r\n  }\r\n\r\n  if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&\r\n     pp->pending_resp && !premature) {\r\n    /*\r\n     * Let's see what the server says about the transfer we just performed,\r\n     * but lower the timeout as sometimes this connection has died while the\r\n     * data has been transferred. This happens when doing through NATs etc that\r\n     * abandon old silent connections.\r\n     */\r\n    long old_time = pp->response_time;\r\n\r\n    pp->response_time = 60*1000; /* give it only a minute for now */\r\n    pp->response = Curl_tvnow(); /* timeout relative now */\r\n\r\n    result = Curl_GetFTPResponse(&nread, conn, &ftpcode);\r\n\r\n    pp->response_time = old_time; /* set this back to previous value */\r\n\r\n    if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) {\r\n      failf(data, \"control connection looks dead\");\r\n      ftpc->ctl_valid = FALSE; /* mark control connection as bad */\r\n      conn->bits.close = TRUE; /* mark for closure */\r\n    }\r\n\r\n    if(result)\r\n      return result;\r\n\r\n    if(ftpc->dont_check && data->req.maxdownload > 0) {\r\n      /* we have just sent ABOR and there is no reliable way to check if it was\r\n       * successful or not; we have to close the connection now */\r\n      infof(data, \"partial download completed, closing connection\\n\");\r\n      conn->bits.close = TRUE; /* mark for closure */\r\n      return result;\r\n    }\r\n\r\n    if(!ftpc->dont_check) {\r\n      /* 226 Transfer complete, 250 Requested file action okay, completed. */\r\n      if((ftpcode != 226) && (ftpcode != 250)) {\r\n        failf(data, \"server did not report OK, got %d\", ftpcode);\r\n        result = CURLE_PARTIAL_FILE;\r\n      }\r\n    }\r\n  }\r\n\r\n  if(result || premature)\r\n    /* the response code from the transfer showed an error already so no\r\n       use checking further */\r\n    ;\r\n  else if(data->set.upload) {\r\n    if((-1 != data->set.infilesize) &&\r\n       (data->set.infilesize != *ftp->bytecountp) &&\r\n       !data->set.crlf &&\r\n       (ftp->transfer == FTPTRANSFER_BODY)) {\r\n      failf(data, \"Uploaded unaligned file size (%\" FORMAT_OFF_T\r\n            \" out of %\" FORMAT_OFF_T \" bytes)\",\r\n            *ftp->bytecountp, data->set.infilesize);\r\n      result = CURLE_PARTIAL_FILE;\r\n    }\r\n  }\r\n  else {\r\n    if((-1 != data->req.size) &&\r\n       (data->req.size != *ftp->bytecountp) &&\r\n#ifdef CURL_DO_LINEEND_CONV\r\n       /* Most FTP servers don't adjust their file SIZE response for CRLFs, so\r\n        * we'll check to see if the discrepancy can be explained by the number\r\n        * of CRLFs we've changed to LFs.\r\n        */\r\n       ((data->req.size + data->state.crlf_conversions) !=\r\n        *ftp->bytecountp) &&\r\n#endif /* CURL_DO_LINEEND_CONV */\r\n       (data->req.maxdownload != *ftp->bytecountp)) {\r\n      failf(data, \"Received only partial file: %\" FORMAT_OFF_T \" bytes\",\r\n            *ftp->bytecountp);\r\n      result = CURLE_PARTIAL_FILE;\r\n    }\r\n    else if(!ftpc->dont_check &&\r\n            !*ftp->bytecountp &&\r\n            (data->req.size>0)) {\r\n      failf(data, \"No data was received!\");\r\n      result = CURLE_FTP_COULDNT_RETR_FILE;\r\n    }\r\n  }\r\n\r\n  /* clear these for next connection */\r\n  ftp->transfer = FTPTRANSFER_BODY;\r\n  ftpc->dont_check = FALSE;\r\n\r\n  /* Send any post-transfer QUOTE strings? */\r\n  if(!status && !result && !premature && data->set.postquote)\r\n    result = ftp_sendquote(conn, data->set.postquote);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_sendquote()\r\n *\r\n * Where a 'quote' means a list of custom commands to send to the server.\r\n * The quote list is passed as an argument.\r\n *\r\n * BLOCKING\r\n */\r\n\r\nstatic\r\nCURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)\r\n{\r\n  struct curl_slist *item;\r\n  ssize_t nread;\r\n  int ftpcode;\r\n  CURLcode result;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n\r\n  item = quote;\r\n  while(item) {\r\n    if(item->data) {\r\n      char *cmd = item->data;\r\n      bool acceptfail = FALSE;\r\n\r\n      /* if a command starts with an asterisk, which a legal FTP command never\r\n         can, the command will be allowed to fail without it causing any\r\n         aborts or cancels etc. It will cause libcurl to act as if the command\r\n         is successful, whatever the server reponds. */\r\n\r\n      if(cmd[0] == '*') {\r\n        cmd++;\r\n        acceptfail = TRUE;\r\n      }\r\n\r\n      FTPSENDF(conn, \"%s\", cmd);\r\n\r\n      pp->response = Curl_tvnow(); /* timeout relative now */\r\n\r\n      result = Curl_GetFTPResponse(&nread, conn, &ftpcode);\r\n      if(result)\r\n        return result;\r\n\r\n      if(!acceptfail && (ftpcode >= 400)) {\r\n        failf(conn->data, \"QUOT string not accepted: %s\", cmd);\r\n        return CURLE_QUOTE_ERROR;\r\n      }\r\n    }\r\n\r\n    item = item->next;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_need_type()\r\n *\r\n * Returns TRUE if we in the current situation should send TYPE\r\n */\r\nstatic int ftp_need_type(struct connectdata *conn,\r\n                         bool ascii_wanted)\r\n{\r\n  return conn->proto.ftpc.transfertype != (ascii_wanted?'A':'I');\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_nb_type()\r\n *\r\n * Set TYPE. We only deal with ASCII or BINARY so this function\r\n * sets one of them.\r\n * If the transfer type is not sent, simulate on OK response in newstate\r\n */\r\nstatic CURLcode ftp_nb_type(struct connectdata *conn,\r\n                            bool ascii, ftpstate newstate)\r\n{\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  CURLcode result;\r\n  char want = (char)(ascii?'A':'I');\r\n\r\n  if(ftpc->transfertype == want) {\r\n    state(conn, newstate);\r\n    return ftp_state_type_resp(conn, 200, newstate);\r\n  }\r\n\r\n  PPSENDF(&ftpc->pp, \"TYPE %c\", want);\r\n  state(conn, newstate);\r\n\r\n  /* keep track of our current transfer type */\r\n  ftpc->transfertype = want;\r\n  return CURLE_OK;\r\n}\r\n\r\n/***************************************************************************\r\n *\r\n * ftp_pasv_verbose()\r\n *\r\n * This function only outputs some informationals about this second connection\r\n * when we've issued a PASV command before and thus we have connected to a\r\n * possibly new IP address.\r\n *\r\n */\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\nstatic void\r\nftp_pasv_verbose(struct connectdata *conn,\r\n                 Curl_addrinfo *ai,\r\n                 char *newhost, /* ascii version */\r\n                 int port)\r\n{\r\n  char buf[256];\r\n  Curl_printable_address(ai, buf, sizeof(buf));\r\n  infof(conn->data, \"Connecting to %s (%s) port %d\\n\", newhost, buf, port);\r\n}\r\n#endif\r\n\r\n/*\r\n  Check if this is a range download, and if so, set the internal variables\r\n  properly.\r\n */\r\n\r\nstatic CURLcode ftp_range(struct connectdata *conn)\r\n{\r\n  curl_off_t from, to;\r\n  char *ptr;\r\n  char *ptr2;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if(data->state.use_range && data->state.range) {\r\n    from=curlx_strtoofft(data->state.range, &ptr, 0);\r\n    while(*ptr && (ISSPACE(*ptr) || (*ptr=='-')))\r\n      ptr++;\r\n    to=curlx_strtoofft(ptr, &ptr2, 0);\r\n    if(ptr == ptr2) {\r\n      /* we didn't get any digit */\r\n      to=-1;\r\n    }\r\n    if((-1 == to) && (from>=0)) {\r\n      /* X - */\r\n      data->state.resume_from = from;\r\n      DEBUGF(infof(conn->data, \"FTP RANGE %\" FORMAT_OFF_T \" to end of file\\n\",\r\n                   from));\r\n    }\r\n    else if(from < 0) {\r\n      /* -Y */\r\n      data->req.maxdownload = -from;\r\n      data->state.resume_from = from;\r\n      DEBUGF(infof(conn->data, \"FTP RANGE the last %\" FORMAT_OFF_T \" bytes\\n\",\r\n                   -from));\r\n    }\r\n    else {\r\n      /* X-Y */\r\n      data->req.maxdownload = (to-from)+1; /* include last byte */\r\n      data->state.resume_from = from;\r\n      DEBUGF(infof(conn->data, \"FTP RANGE from %\" FORMAT_OFF_T\r\n                   \" getting %\" FORMAT_OFF_T \" bytes\\n\",\r\n                   from, data->req.maxdownload));\r\n    }\r\n    DEBUGF(infof(conn->data, \"range-download from %\" FORMAT_OFF_T\r\n                 \" to %\" FORMAT_OFF_T \", totally %\" FORMAT_OFF_T \" bytes\\n\",\r\n                 from, to, data->req.maxdownload));\r\n    ftpc->dont_check = TRUE; /* dont check for successful transfer */\r\n  }\r\n  else\r\n    data->req.maxdownload = -1;\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/*\r\n * ftp_do_more()\r\n *\r\n * This function shall be called when the second FTP (data) connection is\r\n * connected.\r\n */\r\n\r\nstatic CURLcode ftp_do_more(struct connectdata *conn, bool *complete)\r\n{\r\n  struct SessionHandle *data=conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  CURLcode result = CURLE_OK;\r\n  bool connected = FALSE;\r\n\r\n  /* the ftp struct is inited in ftp_connect() */\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n\r\n  *complete = FALSE;\r\n\r\n  /* if the second connection isn't done yet, wait for it */\r\n  if(!conn->bits.tcpconnect[SECONDARYSOCKET]) {\r\n    if(conn->tunnel_state[SECONDARYSOCKET] == TUNNEL_CONNECT) {\r\n      /* As we're in TUNNEL_CONNECT state now, we know the proxy name and port\r\n         aren't used so we blank their arguments. TODO: make this nicer */\r\n      result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, NULL, 0);\r\n\r\n      return result;\r\n    }\r\n\r\n    result = Curl_is_connected(conn, SECONDARYSOCKET, &connected);\r\n\r\n    /* Ready to do more? */\r\n    if(connected) {\r\n      DEBUGF(infof(data, \"DO-MORE connected phase starts\\n\"));\r\n    }\r\n    else\r\n      return result;\r\n  }\r\n\r\n  if(ftpc->state) {\r\n    /* already in a state so skip the intial commands.\r\n       They are only done to kickstart the do_more state */\r\n    result = ftp_multi_statemach(conn, complete);\r\n\r\n    /* if we got an error or if we don't wait for a data connection return\r\n       immediately */\r\n    if(result || (ftpc->wait_data_conn != TRUE))\r\n      return result;\r\n\r\n    if(ftpc->wait_data_conn)\r\n      /* if we reach the end of the FTP state machine here, *complete will be\r\n         TRUE but so is ftpc->wait_data_conn, which says we need to wait for\r\n         the data connection and therefore we're not actually complete */\r\n      *complete = FALSE;\r\n  }\r\n\r\n  if(ftp->transfer <= FTPTRANSFER_INFO) {\r\n    /* a transfer is about to take place, or if not a file name was given\r\n       so we'll do a SIZE on it later and then we need the right TYPE first */\r\n\r\n    if(ftpc->wait_data_conn == TRUE) {\r\n      bool serv_conned;\r\n\r\n      result = ReceivedServerConnect(conn, &serv_conned);\r\n      if(result)\r\n        return result; /* Failed to accept data connection */\r\n\r\n      if(serv_conned) {\r\n        /* It looks data connection is established */\r\n        result = AcceptServerConnect(conn);\r\n        ftpc->wait_data_conn = FALSE;\r\n        if(!result)\r\n          result = InitiateTransfer(conn);\r\n\r\n        if(result)\r\n          return result;\r\n      }\r\n    }\r\n    else if(data->set.upload) {\r\n      result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_STOR_TYPE);\r\n      if(result)\r\n        return result;\r\n\r\n      result = ftp_multi_statemach(conn, complete);\r\n    }\r\n    else {\r\n      /* download */\r\n      ftp->downloadsize = -1; /* unknown as of yet */\r\n\r\n      result = ftp_range(conn);\r\n      if(result)\r\n        ;\r\n      else if(data->set.ftp_list_only || !ftpc->file) {\r\n        /* The specified path ends with a slash, and therefore we think this\r\n           is a directory that is requested, use LIST. But before that we\r\n           need to set ASCII transfer mode. */\r\n\r\n        /* But only if a body transfer was requested. */\r\n        if(ftp->transfer == FTPTRANSFER_BODY) {\r\n          result = ftp_nb_type(conn, TRUE, FTP_LIST_TYPE);\r\n          if(result)\r\n            return result;\r\n        }\r\n        /* otherwise just fall through */\r\n      }\r\n      else {\r\n        result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_RETR_TYPE);\r\n        if(result)\r\n          return result;\r\n      }\r\n\r\n      result = ftp_multi_statemach(conn, complete);\r\n    }\r\n    return result;\r\n  }\r\n\r\n  if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY))\r\n    /* no data to transfer. FIX: it feels like a kludge to have this here\r\n       too! */\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n\r\n  if(!ftpc->wait_data_conn) {\r\n    /* no waiting for the data connection so this is now complete */\r\n    *complete = TRUE;\r\n    DEBUGF(infof(data, \"DO-MORE phase ends with %d\\n\", (int)result));\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_perform()\r\n *\r\n * This is the actual DO function for FTP. Get a file/directory according to\r\n * the options previously setup.\r\n */\r\n\r\nstatic\r\nCURLcode ftp_perform(struct connectdata *conn,\r\n                     bool *connected,  /* connect status after PASV / PORT */\r\n                     bool *dophase_done)\r\n{\r\n  /* this is FTP and no proxy */\r\n  CURLcode result=CURLE_OK;\r\n\r\n  DEBUGF(infof(conn->data, \"DO phase starts\\n\"));\r\n\r\n  if(conn->data->set.opt_no_body) {\r\n    /* requested no body means no transfer... */\r\n    struct FTP *ftp = conn->data->state.proto.ftp;\r\n    ftp->transfer = FTPTRANSFER_INFO;\r\n  }\r\n\r\n  *dophase_done = FALSE; /* not done yet */\r\n\r\n  /* start the first command in the DO phase */\r\n  result = ftp_state_quote(conn, TRUE, FTP_QUOTE);\r\n  if(result)\r\n    return result;\r\n\r\n  /* run the state-machine */\r\n  result = ftp_multi_statemach(conn, dophase_done);\r\n\r\n  *connected = conn->bits.tcpconnect[FIRSTSOCKET];\r\n\r\n  if(*dophase_done)\r\n    DEBUGF(infof(conn->data, \"DO phase is complete1\\n\"));\r\n\r\n  return result;\r\n}\r\n\r\nstatic void wc_data_dtor(void *ptr)\r\n{\r\n  struct ftp_wc_tmpdata *tmp = ptr;\r\n  if(tmp)\r\n    Curl_ftp_parselist_data_free(&tmp->parser);\r\n  Curl_safefree(tmp);\r\n}\r\n\r\nstatic CURLcode init_wc_data(struct connectdata *conn)\r\n{\r\n  char *last_slash;\r\n  char *path = conn->data->state.path;\r\n  struct WildcardData *wildcard = &(conn->data->wildcard);\r\n  CURLcode ret = CURLE_OK;\r\n  struct ftp_wc_tmpdata *ftp_tmp;\r\n\r\n  last_slash = strrchr(conn->data->state.path, '/');\r\n  if(last_slash) {\r\n    last_slash++;\r\n    if(last_slash[0] == '\\0') {\r\n      wildcard->state = CURLWC_CLEAN;\r\n      ret = ftp_parse_url_path(conn);\r\n      return ret;\r\n    }\r\n    else {\r\n      wildcard->pattern = strdup(last_slash);\r\n      if(!wildcard->pattern)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      last_slash[0] = '\\0'; /* cut file from path */\r\n    }\r\n  }\r\n  else { /* there is only 'wildcard pattern' or nothing */\r\n    if(path[0]) {\r\n      wildcard->pattern = strdup(path);\r\n      if(!wildcard->pattern)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      path[0] = '\\0';\r\n    }\r\n    else { /* only list */\r\n      wildcard->state = CURLWC_CLEAN;\r\n      ret = ftp_parse_url_path(conn);\r\n      return ret;\r\n    }\r\n  }\r\n\r\n  /* program continues only if URL is not ending with slash, allocate needed\r\n     resources for wildcard transfer */\r\n\r\n  /* allocate ftp protocol specific temporary wildcard data */\r\n  ftp_tmp = calloc(1, sizeof(struct ftp_wc_tmpdata));\r\n  if(!ftp_tmp) {\r\n    Curl_safefree(wildcard->pattern);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* INITIALIZE parselist structure */\r\n  ftp_tmp->parser = Curl_ftp_parselist_data_alloc();\r\n  if(!ftp_tmp->parser) {\r\n    Curl_safefree(wildcard->pattern);\r\n    Curl_safefree(ftp_tmp);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  wildcard->tmp = ftp_tmp; /* put it to the WildcardData tmp pointer */\r\n  wildcard->tmp_dtor = wc_data_dtor;\r\n\r\n  /* wildcard does not support NOCWD option (assert it?) */\r\n  if(conn->data->set.ftp_filemethod == FTPFILE_NOCWD)\r\n    conn->data->set.ftp_filemethod = FTPFILE_MULTICWD;\r\n\r\n  /* try to parse ftp url */\r\n  ret = ftp_parse_url_path(conn);\r\n  if(ret) {\r\n    Curl_safefree(wildcard->pattern);\r\n    wildcard->tmp_dtor(wildcard->tmp);\r\n    wildcard->tmp_dtor = ZERO_NULL;\r\n    wildcard->tmp = NULL;\r\n    return ret;\r\n  }\r\n\r\n  wildcard->path = strdup(conn->data->state.path);\r\n  if(!wildcard->path) {\r\n    Curl_safefree(wildcard->pattern);\r\n    wildcard->tmp_dtor(wildcard->tmp);\r\n    wildcard->tmp_dtor = ZERO_NULL;\r\n    wildcard->tmp = NULL;\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* backup old write_function */\r\n  ftp_tmp->backup.write_function = conn->data->set.fwrite_func;\r\n  /* parsing write function */\r\n  conn->data->set.fwrite_func = Curl_ftp_parselist;\r\n  /* backup old file descriptor */\r\n  ftp_tmp->backup.file_descriptor = conn->data->set.out;\r\n  /* let the writefunc callback know what curl pointer is working with */\r\n  conn->data->set.out = conn;\r\n\r\n  infof(conn->data, \"Wildcard - Parsing started\\n\");\r\n  return CURLE_OK;\r\n}\r\n\r\n/* This is called recursively */\r\nstatic CURLcode wc_statemach(struct connectdata *conn)\r\n{\r\n  struct WildcardData * const wildcard = &(conn->data->wildcard);\r\n  CURLcode ret = CURLE_OK;\r\n\r\n  switch (wildcard->state) {\r\n  case CURLWC_INIT:\r\n    ret = init_wc_data(conn);\r\n    if(wildcard->state == CURLWC_CLEAN)\r\n      /* only listing! */\r\n      break;\r\n    else\r\n      wildcard->state = ret ? CURLWC_ERROR : CURLWC_MATCHING;\r\n    break;\r\n\r\n  case CURLWC_MATCHING: {\r\n    /* In this state is LIST response successfully parsed, so lets restore\r\n       previous WRITEFUNCTION callback and WRITEDATA pointer */\r\n    struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp;\r\n    conn->data->set.fwrite_func = ftp_tmp->backup.write_function;\r\n    conn->data->set.out = ftp_tmp->backup.file_descriptor;\r\n    ftp_tmp->backup.write_function = ZERO_NULL;\r\n    ftp_tmp->backup.file_descriptor = NULL;\r\n    wildcard->state = CURLWC_DOWNLOADING;\r\n\r\n    if(Curl_ftp_parselist_geterror(ftp_tmp->parser)) {\r\n      /* error found in LIST parsing */\r\n      wildcard->state = CURLWC_CLEAN;\r\n      return wc_statemach(conn);\r\n    }\r\n    else if(wildcard->filelist->size == 0) {\r\n      /* no corresponding file */\r\n      wildcard->state = CURLWC_CLEAN;\r\n      return CURLE_REMOTE_FILE_NOT_FOUND;\r\n    }\r\n    return wc_statemach(conn);\r\n  }\r\n\r\n  case CURLWC_DOWNLOADING: {\r\n    /* filelist has at least one file, lets get first one */\r\n    struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n    struct curl_fileinfo *finfo = wildcard->filelist->head->ptr;\r\n    char *tmp_path = malloc(strlen(conn->data->state.path) +\r\n                      strlen(finfo->filename) + 1);\r\n    if(!tmp_path) {\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    tmp_path[0] = 0;\r\n    /* make full path to matched file */\r\n    strcat(tmp_path, wildcard->path);\r\n    strcat(tmp_path, finfo->filename);\r\n    /* switch default \"state.pathbuffer\" and tmp_path, good to see\r\n       ftp_parse_url_path function to understand this trick */\r\n    Curl_safefree(conn->data->state.pathbuffer);\r\n    conn->data->state.pathbuffer = tmp_path;\r\n    conn->data->state.path = tmp_path;\r\n\r\n    infof(conn->data, \"Wildcard - START of \\\"%s\\\"\\n\", finfo->filename);\r\n    if(conn->data->set.chunk_bgn) {\r\n      long userresponse = conn->data->set.chunk_bgn(\r\n          finfo, wildcard->customptr, (int)wildcard->filelist->size);\r\n      switch(userresponse) {\r\n      case CURL_CHUNK_BGN_FUNC_SKIP:\r\n        infof(conn->data, \"Wildcard - \\\"%s\\\" skipped by user\\n\",\r\n              finfo->filename);\r\n        wildcard->state = CURLWC_SKIP;\r\n        return wc_statemach(conn);\r\n      case CURL_CHUNK_BGN_FUNC_FAIL:\r\n        return CURLE_CHUNK_FAILED;\r\n      }\r\n    }\r\n\r\n    if(finfo->filetype != CURLFILETYPE_FILE) {\r\n      wildcard->state = CURLWC_SKIP;\r\n      return wc_statemach(conn);\r\n    }\r\n\r\n    if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE)\r\n      ftpc->known_filesize = finfo->size;\r\n\r\n    ret = ftp_parse_url_path(conn);\r\n    if(ret) {\r\n      return ret;\r\n    }\r\n\r\n    /* we don't need the Curl_fileinfo of first file anymore */\r\n    Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL);\r\n\r\n    if(wildcard->filelist->size == 0) { /* remains only one file to down. */\r\n      wildcard->state = CURLWC_CLEAN;\r\n      /* after that will be ftp_do called once again and no transfer\r\n         will be done because of CURLWC_CLEAN state */\r\n      return CURLE_OK;\r\n    }\r\n  } break;\r\n\r\n  case CURLWC_SKIP: {\r\n    if(conn->data->set.chunk_end)\r\n      conn->data->set.chunk_end(conn->data->wildcard.customptr);\r\n    Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL);\r\n    wildcard->state = (wildcard->filelist->size == 0) ?\r\n                      CURLWC_CLEAN : CURLWC_DOWNLOADING;\r\n    return wc_statemach(conn);\r\n  }\r\n\r\n  case CURLWC_CLEAN: {\r\n    struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp;\r\n    ret = CURLE_OK;\r\n    if(ftp_tmp) {\r\n      ret = Curl_ftp_parselist_geterror(ftp_tmp->parser);\r\n    }\r\n    wildcard->state = ret ? CURLWC_ERROR : CURLWC_DONE;\r\n  } break;\r\n\r\n  case CURLWC_DONE:\r\n  case CURLWC_ERROR:\r\n    break;\r\n  }\r\n\r\n  return ret;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_do()\r\n *\r\n * This function is registered as 'curl_do' function. It decodes the path\r\n * parts etc as a wrapper to the actual DO function (ftp_perform).\r\n *\r\n * The input argument is already checked for validity.\r\n */\r\nstatic CURLcode ftp_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  *done = FALSE; /* default to false */\r\n  ftpc->wait_data_conn = FALSE; /* default to no such wait */\r\n\r\n  /*\r\n    Since connections can be re-used between SessionHandles, this might be a\r\n    connection already existing but on a fresh SessionHandle struct so we must\r\n    make sure we have a good 'struct FTP' to play with. For new connections,\r\n    the struct FTP is allocated and setup in the ftp_connect() function.\r\n  */\r\n  Curl_reset_reqproto(conn);\r\n  retcode = ftp_init(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  if(conn->data->set.wildcardmatch) {\r\n    retcode = wc_statemach(conn);\r\n    if(conn->data->wildcard.state == CURLWC_SKIP ||\r\n      conn->data->wildcard.state == CURLWC_DONE) {\r\n      /* do not call ftp_regular_transfer */\r\n      return CURLE_OK;\r\n    }\r\n    if(retcode) /* error, loop or skipping the file */\r\n      return retcode;\r\n  }\r\n  else { /* no wildcard FSM needed */\r\n    retcode = ftp_parse_url_path(conn);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  retcode = ftp_regular_transfer(conn, done);\r\n\r\n  return retcode;\r\n}\r\n\r\n\r\nCURLcode Curl_ftpsendf(struct connectdata *conn,\r\n                       const char *fmt, ...)\r\n{\r\n  ssize_t bytes_written;\r\n#define SBUF_SIZE 1024\r\n  char s[SBUF_SIZE];\r\n  size_t write_len;\r\n  char *sptr=s;\r\n  CURLcode res = CURLE_OK;\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  enum protection_level data_sec = conn->data_prot;\r\n#endif\r\n\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n  vsnprintf(s, SBUF_SIZE-3, fmt, ap);\r\n  va_end(ap);\r\n\r\n  strcat(s, \"\\r\\n\"); /* append a trailing CRLF */\r\n\r\n  bytes_written=0;\r\n  write_len = strlen(s);\r\n\r\n  res = Curl_convert_to_network(conn->data, s, write_len);\r\n  /* Curl_convert_to_network calls failf if unsuccessful */\r\n  if(res)\r\n    return(res);\r\n\r\n  for(;;) {\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n    conn->data_prot = PROT_CMD;\r\n#endif\r\n    res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,\r\n                     &bytes_written);\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n    DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);\r\n    conn->data_prot = data_sec;\r\n#endif\r\n\r\n    if(CURLE_OK != res)\r\n      break;\r\n\r\n    if(conn->data->set.verbose)\r\n      Curl_debug(conn->data, CURLINFO_HEADER_OUT,\r\n                 sptr, (size_t)bytes_written, conn);\r\n\r\n    if(bytes_written != (ssize_t)write_len) {\r\n      write_len -= bytes_written;\r\n      sptr += bytes_written;\r\n    }\r\n    else\r\n      break;\r\n  }\r\n\r\n  return res;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_quit()\r\n *\r\n * This should be called before calling sclose() on an ftp control connection\r\n * (not data connections). We should then wait for the response from the\r\n * server before returning. The calling code should then try to close the\r\n * connection.\r\n *\r\n */\r\nstatic CURLcode ftp_quit(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  if(conn->proto.ftpc.ctl_valid) {\r\n    result = Curl_pp_sendf(&conn->proto.ftpc.pp, \"QUIT\", NULL);\r\n    if(result) {\r\n      failf(conn->data, \"Failure sending QUIT command: %s\",\r\n            curl_easy_strerror(result));\r\n      conn->proto.ftpc.ctl_valid = FALSE; /* mark control connection as bad */\r\n      conn->bits.close = TRUE; /* mark for connection closure */\r\n      state(conn, FTP_STOP);\r\n      return result;\r\n    }\r\n\r\n    state(conn, FTP_QUIT);\r\n\r\n    result = ftp_easy_statemach(conn);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_disconnect()\r\n *\r\n * Disconnect from an FTP server. Cleanup protocol-specific per-connection\r\n * resources. BLOCKING.\r\n */\r\nstatic CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  struct ftp_conn *ftpc= &conn->proto.ftpc;\r\n  struct pingpong *pp = &ftpc->pp;\r\n\r\n  /* We cannot send quit unconditionally. If this connection is stale or\r\n     bad in any way, sending quit and waiting around here will make the\r\n     disconnect wait in vain and cause more problems than we need to.\r\n\r\n     ftp_quit() will check the state of ftp->ctl_valid. If it's ok it\r\n     will try to send the QUIT command, otherwise it will just return.\r\n  */\r\n  if(dead_connection)\r\n    ftpc->ctl_valid = FALSE;\r\n\r\n  /* The FTP session may or may not have been allocated/setup at this point! */\r\n  (void)ftp_quit(conn); /* ignore errors on the QUIT */\r\n\r\n  if(ftpc->entrypath) {\r\n    struct SessionHandle *data = conn->data;\r\n    if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) {\r\n      data->state.most_recent_ftp_entrypath = NULL;\r\n    }\r\n    free(ftpc->entrypath);\r\n    ftpc->entrypath = NULL;\r\n  }\r\n\r\n  freedirs(ftpc);\r\n  if(ftpc->prevpath) {\r\n    free(ftpc->prevpath);\r\n    ftpc->prevpath = NULL;\r\n  }\r\n  if(ftpc->server_os) {\r\n    free(ftpc->server_os);\r\n    ftpc->server_os = NULL;\r\n  }\r\n\r\n  Curl_pp_disconnect(pp);\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  Curl_sec_end(conn);\r\n#endif\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_parse_url_path()\r\n *\r\n * Parse the URL path into separate path components.\r\n *\r\n */\r\nstatic\r\nCURLcode ftp_parse_url_path(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  /* the ftp struct is already inited in ftp_connect() */\r\n  struct FTP *ftp = data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  const char *slash_pos;  /* position of the first '/' char in curpos */\r\n  const char *path_to_use = data->state.path;\r\n  const char *cur_pos;\r\n  const char *filename = NULL;\r\n\r\n  cur_pos = path_to_use; /* current position in path. point at the begin\r\n                            of next path component */\r\n\r\n  ftpc->ctl_valid = FALSE;\r\n  ftpc->cwdfail = FALSE;\r\n\r\n  switch(data->set.ftp_filemethod) {\r\n  case FTPFILE_NOCWD:\r\n    /* fastest, but less standard-compliant */\r\n\r\n    /*\r\n      The best time to check whether the path is a file or directory is right\r\n      here. so:\r\n\r\n      the first condition in the if() right here, is there just in case\r\n      someone decides to set path to NULL one day\r\n   */\r\n    if(data->state.path &&\r\n       data->state.path[0] &&\r\n       (data->state.path[strlen(data->state.path) - 1] != '/') )\r\n      filename = data->state.path;  /* this is a full file path */\r\n      /*\r\n        ftpc->file is not used anywhere other than for operations on a file.\r\n        In other words, never for directory operations.\r\n        So we can safely leave filename as NULL here and use it as a\r\n        argument in dir/file decisions.\r\n      */\r\n    break;\r\n\r\n  case FTPFILE_SINGLECWD:\r\n    /* get the last slash */\r\n    if(!path_to_use[0]) {\r\n      /* no dir, no file */\r\n      ftpc->dirdepth = 0;\r\n      break;\r\n    }\r\n    slash_pos=strrchr(cur_pos, '/');\r\n    if(slash_pos || !*cur_pos) {\r\n      ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));\r\n      if(!ftpc->dirs)\r\n        return CURLE_OUT_OF_MEMORY;\r\n\r\n      ftpc->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : \"/\",\r\n                                         slash_pos ?\r\n                                         curlx_sztosi(slash_pos-cur_pos) : 1,\r\n                                         NULL);\r\n      if(!ftpc->dirs[0]) {\r\n        freedirs(ftpc);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      ftpc->dirdepth = 1; /* we consider it to be a single dir */\r\n      filename = slash_pos ? slash_pos+1 : cur_pos; /* rest is file name */\r\n    }\r\n    else\r\n      filename = cur_pos;  /* this is a file name only */\r\n    break;\r\n\r\n  default: /* allow pretty much anything */\r\n  case FTPFILE_MULTICWD:\r\n    ftpc->dirdepth = 0;\r\n    ftpc->diralloc = 5; /* default dir depth to allocate */\r\n    ftpc->dirs = calloc(ftpc->diralloc, sizeof(ftpc->dirs[0]));\r\n    if(!ftpc->dirs)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    /* we have a special case for listing the root dir only */\r\n    if(strequal(path_to_use, \"/\")) {\r\n      cur_pos++; /* make it point to the zero byte */\r\n      ftpc->dirs[0] = strdup(\"/\");\r\n      ftpc->dirdepth++;\r\n    }\r\n    else {\r\n      /* parse the URL path into separate path components */\r\n      while((slash_pos = strchr(cur_pos, '/')) != NULL) {\r\n        /* 1 or 0 pointer offset to indicate absolute directory */\r\n        ssize_t absolute_dir = ((cur_pos - data->state.path > 0) &&\r\n                                (ftpc->dirdepth == 0))?1:0;\r\n\r\n        /* seek out the next path component */\r\n        if(slash_pos-cur_pos) {\r\n          /* we skip empty path components, like \"x//y\" since the FTP command\r\n             CWD requires a parameter and a non-existent parameter a) doesn't\r\n             work on many servers and b) has no effect on the others. */\r\n          int len = curlx_sztosi(slash_pos - cur_pos + absolute_dir);\r\n          ftpc->dirs[ftpc->dirdepth] =\r\n            curl_easy_unescape(conn->data, cur_pos - absolute_dir, len, NULL);\r\n          if(!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */\r\n            failf(data, \"no memory\");\r\n            freedirs(ftpc);\r\n            return CURLE_OUT_OF_MEMORY;\r\n          }\r\n          if(isBadFtpString(ftpc->dirs[ftpc->dirdepth])) {\r\n            free(ftpc->dirs[ftpc->dirdepth]);\r\n            freedirs(ftpc);\r\n            return CURLE_URL_MALFORMAT;\r\n          }\r\n        }\r\n        else {\r\n          cur_pos = slash_pos + 1; /* jump to the rest of the string */\r\n          continue;\r\n        }\r\n\r\n        cur_pos = slash_pos + 1; /* jump to the rest of the string */\r\n        if(++ftpc->dirdepth >= ftpc->diralloc) {\r\n          /* enlarge array */\r\n          char **bigger;\r\n          ftpc->diralloc *= 2; /* double the size each time */\r\n          bigger = realloc(ftpc->dirs, ftpc->diralloc * sizeof(ftpc->dirs[0]));\r\n          if(!bigger) {\r\n            freedirs(ftpc);\r\n            return CURLE_OUT_OF_MEMORY;\r\n          }\r\n          ftpc->dirs = bigger;\r\n        }\r\n      }\r\n    }\r\n    filename = cur_pos;  /* the rest is the file name */\r\n    break;\r\n  } /* switch */\r\n\r\n  if(filename && *filename) {\r\n    ftpc->file = curl_easy_unescape(conn->data, filename, 0, NULL);\r\n    if(NULL == ftpc->file) {\r\n      freedirs(ftpc);\r\n      failf(data, \"no memory\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    if(isBadFtpString(ftpc->file)) {\r\n      freedirs(ftpc);\r\n      return CURLE_URL_MALFORMAT;\r\n    }\r\n  }\r\n  else\r\n    ftpc->file=NULL; /* instead of point to a zero byte, we make it a NULL\r\n                       pointer */\r\n\r\n  if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {\r\n    /* We need a file name when uploading. Return error! */\r\n    failf(data, \"Uploading to a URL without a file name!\");\r\n    return CURLE_URL_MALFORMAT;\r\n  }\r\n\r\n  ftpc->cwddone = FALSE; /* default to not done */\r\n\r\n  if(ftpc->prevpath) {\r\n    /* prevpath is \"raw\" so we convert the input path before we compare the\r\n       strings */\r\n    int dlen;\r\n    char *path = curl_easy_unescape(conn->data, data->state.path, 0, &dlen);\r\n    if(!path) {\r\n      freedirs(ftpc);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    dlen -= ftpc->file?curlx_uztosi(strlen(ftpc->file)):0;\r\n    if((dlen == curlx_uztosi(strlen(ftpc->prevpath))) &&\r\n       strnequal(path, ftpc->prevpath, dlen)) {\r\n      infof(data, \"Request has same path as previous transfer\\n\");\r\n      ftpc->cwddone = TRUE;\r\n    }\r\n    free(path);\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* call this when the DO phase has completed */\r\nstatic CURLcode ftp_dophase_done(struct connectdata *conn,\r\n                                 bool connected)\r\n{\r\n  struct FTP *ftp = conn->data->state.proto.ftp;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n\r\n  if(connected) {\r\n    bool completed;\r\n    CURLcode result = ftp_do_more(conn, &completed);\r\n\r\n    if(result) {\r\n      if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {\r\n        /* close the second socket if it was created already */\r\n        Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]);\r\n        conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;\r\n      }\r\n      return result;\r\n    }\r\n  }\r\n\r\n  if(ftp->transfer != FTPTRANSFER_BODY)\r\n    /* no data to transfer */\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n  else if(!connected)\r\n    /* since we didn't connect now, we want do_more to get called */\r\n    conn->bits.do_more = TRUE;\r\n\r\n  ftpc->ctl_valid = TRUE; /* seems good */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* called from multi.c while DOing */\r\nstatic CURLcode ftp_doing(struct connectdata *conn,\r\n                          bool *dophase_done)\r\n{\r\n  CURLcode result = ftp_multi_statemach(conn, dophase_done);\r\n\r\n  if(result)\r\n    DEBUGF(infof(conn->data, \"DO phase failed\\n\"));\r\n  else if(*dophase_done) {\r\n    result = ftp_dophase_done(conn, FALSE /* not connected */);\r\n\r\n    DEBUGF(infof(conn->data, \"DO phase is complete2\\n\"));\r\n  }\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * ftp_regular_transfer()\r\n *\r\n * The input argument is already checked for validity.\r\n *\r\n * Performs all commands done before a regular transfer between a local and a\r\n * remote host.\r\n *\r\n * ftp->ctl_valid starts out as FALSE, and gets set to TRUE if we reach the\r\n * ftp_done() function without finding any major problem.\r\n */\r\nstatic\r\nCURLcode ftp_regular_transfer(struct connectdata *conn,\r\n                              bool *dophase_done)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n  bool connected=FALSE;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ftp_conn *ftpc = &conn->proto.ftpc;\r\n  data->req.size = -1; /* make sure this is unknown at this point */\r\n\r\n  Curl_pgrsSetUploadCounter(data, 0);\r\n  Curl_pgrsSetDownloadCounter(data, 0);\r\n  Curl_pgrsSetUploadSize(data, 0);\r\n  Curl_pgrsSetDownloadSize(data, 0);\r\n\r\n  ftpc->ctl_valid = TRUE; /* starts good */\r\n\r\n  result = ftp_perform(conn,\r\n                       &connected, /* have we connected after PASV/PORT */\r\n                       dophase_done); /* all commands in the DO-phase done? */\r\n\r\n  if(CURLE_OK == result) {\r\n\r\n    if(!*dophase_done)\r\n      /* the DO phase has not completed yet */\r\n      return CURLE_OK;\r\n\r\n    result = ftp_dophase_done(conn, connected);\r\n\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n    freedirs(ftpc);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ftp_setup_connection(struct connectdata * conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  char * type;\r\n  char command;\r\n\r\n  if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) {\r\n    /* Unless we have asked to tunnel ftp operations through the proxy, we\r\n       switch and use HTTP operations only */\r\n#ifndef CURL_DISABLE_HTTP\r\n    if(conn->handler == &Curl_handler_ftp)\r\n      conn->handler = &Curl_handler_ftp_proxy;\r\n    else {\r\n#ifdef USE_SSL\r\n      conn->handler = &Curl_handler_ftps_proxy;\r\n#else\r\n      failf(data, \"FTPS not supported!\");\r\n      return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n    }\r\n    /*\r\n     * We explicitly mark this connection as persistent here as we're doing\r\n     * FTP over HTTP and thus we accidentally avoid setting this value\r\n     * otherwise.\r\n     */\r\n    conn->bits.close = FALSE;\r\n#else\r\n    failf(data, \"FTP over http proxy requires HTTP support built-in!\");\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n  }\r\n\r\n  data->state.path++;   /* don't include the initial slash */\r\n  data->state.slash_removed = TRUE; /* we've skipped the slash */\r\n\r\n  /* FTP URLs support an extension like \";type=<typecode>\" that\r\n   * we'll try to get now! */\r\n  type = strstr(data->state.path, \";type=\");\r\n\r\n  if(!type)\r\n    type = strstr(conn->host.rawalloc, \";type=\");\r\n\r\n  if(type) {\r\n    *type = 0;                     /* it was in the middle of the hostname */\r\n    command = Curl_raw_toupper(type[6]);\r\n    conn->bits.type_set = TRUE;\r\n\r\n    switch (command) {\r\n    case 'A': /* ASCII mode */\r\n      data->set.prefer_ascii = TRUE;\r\n      break;\r\n\r\n    case 'D': /* directory mode */\r\n      data->set.ftp_list_only = TRUE;\r\n      break;\r\n\r\n    case 'I': /* binary mode */\r\n    default:\r\n      /* switch off ASCII */\r\n      data->set.prefer_ascii = FALSE;\r\n      break;\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* CURL_DISABLE_FTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ftp.h",
    "content": "#ifndef HEADER_CURL_FTP_H\r\n#define HEADER_CURL_FTP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"pingpong.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\nextern const struct Curl_handler Curl_handler_ftp;\r\n\r\n#ifdef USE_SSL\r\nextern const struct Curl_handler Curl_handler_ftps;\r\n#endif\r\n\r\nCURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...);\r\nCURLcode Curl_GetFTPResponse(ssize_t *nread, struct connectdata *conn,\r\n                             int *ftpcode);\r\n#endif /* CURL_DISABLE_FTP */\r\n\r\n/****************************************************************************\r\n * FTP unique setup\r\n ***************************************************************************/\r\ntypedef enum {\r\n  FTP_STOP,    /* do nothing state, stops the state machine */\r\n  FTP_WAIT220, /* waiting for the initial 220 response immediately after\r\n                  a connect */\r\n  FTP_AUTH,\r\n  FTP_USER,\r\n  FTP_PASS,\r\n  FTP_ACCT,\r\n  FTP_PBSZ,\r\n  FTP_PROT,\r\n  FTP_CCC,\r\n  FTP_PWD,\r\n  FTP_SYST,\r\n  FTP_NAMEFMT,\r\n  FTP_QUOTE, /* waiting for a response to a command sent in a quote list */\r\n  FTP_RETR_PREQUOTE,\r\n  FTP_STOR_PREQUOTE,\r\n  FTP_POSTQUOTE,\r\n  FTP_CWD,  /* change dir */\r\n  FTP_MKD,  /* if the dir didn't exist */\r\n  FTP_MDTM, /* to figure out the datestamp */\r\n  FTP_TYPE, /* to set type when doing a head-like request */\r\n  FTP_LIST_TYPE, /* set type when about to do a dir list */\r\n  FTP_RETR_TYPE, /* set type when about to RETR a file */\r\n  FTP_STOR_TYPE, /* set type when about to STOR a file */\r\n  FTP_SIZE, /* get the remote file's size for head-like request */\r\n  FTP_RETR_SIZE, /* get the remote file's size for RETR */\r\n  FTP_STOR_SIZE, /* get the size for STOR */\r\n  FTP_REST, /* when used to check if the server supports it in head-like */\r\n  FTP_RETR_REST, /* when asking for \"resume\" in for RETR */\r\n  FTP_PORT, /* generic state for PORT, LPRT and EPRT, check count1 */\r\n  FTP_PRET, /* generic state for PRET RETR, PRET STOR and PRET LIST/NLST */\r\n  FTP_PASV, /* generic state for PASV and EPSV, check count1 */\r\n  FTP_LIST, /* generic state for LIST, NLST or a custom list command */\r\n  FTP_RETR,\r\n  FTP_STOR, /* generic state for STOR and APPE */\r\n  FTP_QUIT,\r\n  FTP_LAST  /* never used */\r\n} ftpstate;\r\n\r\nstruct ftp_parselist_data; /* defined later in ftplistparser.c */\r\n\r\nstruct ftp_wc_tmpdata {\r\n  struct ftp_parselist_data *parser;\r\n\r\n  struct {\r\n    curl_write_callback write_function;\r\n    FILE *file_descriptor;\r\n  } backup;\r\n};\r\n\r\ntypedef enum {\r\n  FTPFILE_MULTICWD  = 1, /* as defined by RFC1738 */\r\n  FTPFILE_NOCWD     = 2, /* use SIZE / RETR / STOR on the full path */\r\n  FTPFILE_SINGLECWD = 3  /* make one CWD, then SIZE / RETR / STOR on the\r\n                            file */\r\n} curl_ftpfile;\r\n\r\ntypedef enum {\r\n  FTPTRANSFER_BODY, /* yes do transfer a body */\r\n  FTPTRANSFER_INFO, /* do still go through to get info/headers */\r\n  FTPTRANSFER_NONE, /* don't get anything and don't get info */\r\n  FTPTRANSFER_LAST  /* end of list marker, never used */\r\n} curl_ftptransfer;\r\n\r\n/* This FTP struct is used in the SessionHandle. All FTP data that is\r\n   connection-oriented must be in FTP_conn to properly deal with the fact that\r\n   perhaps the SessionHandle is changed between the times the connection is\r\n   used. */\r\nstruct FTP {\r\n  curl_off_t *bytecountp;\r\n  char *user;    /* user name string */\r\n  char *passwd;  /* password string */\r\n\r\n  /* transfer a file/body or not, done as a typedefed enum just to make\r\n     debuggers display the full symbol and not just the numerical value */\r\n  curl_ftptransfer transfer;\r\n  curl_off_t downloadsize;\r\n};\r\n\r\n\r\n/* ftp_conn is used for struct connection-oriented data in the connectdata\r\n   struct */\r\nstruct ftp_conn {\r\n  struct pingpong pp;\r\n  char *entrypath; /* the PWD reply when we logged on */\r\n  char **dirs;   /* realloc()ed array for path components */\r\n  int dirdepth;  /* number of entries used in the 'dirs' array */\r\n  int diralloc;  /* number of entries allocated for the 'dirs' array */\r\n  char *file;    /* decoded file */\r\n  bool dont_check;  /* Set to TRUE to prevent the final (post-transfer)\r\n                       file size and 226/250 status check. It should still\r\n                       read the line, just ignore the result. */\r\n  bool ctl_valid;   /* Tells Curl_ftp_quit() whether or not to do anything. If\r\n                       the connection has timed out or been closed, this\r\n                       should be FALSE when it gets to Curl_ftp_quit() */\r\n  bool cwddone;     /* if it has been determined that the proper CWD combo\r\n                       already has been done */\r\n  bool cwdfail;     /* set TRUE if a CWD command fails, as then we must prevent\r\n                       caching the current directory */\r\n  bool wait_data_conn; /* this is set TRUE if data connection is waited */\r\n  char *prevpath;   /* conn->path from the previous transfer */\r\n  char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a\r\n                        and others (A/I or zero) */\r\n  int count1; /* general purpose counter for the state machine */\r\n  int count2; /* general purpose counter for the state machine */\r\n  int count3; /* general purpose counter for the state machine */\r\n  ftpstate state; /* always use ftp.c:state() to change state! */\r\n  ftpstate state_saved; /* transfer type saved to be reloaded after\r\n                           data connection is established */\r\n  curl_off_t retr_size_saved; /* Size of retrieved file saved */\r\n  char * server_os;     /* The target server operating system. */\r\n  curl_off_t known_filesize; /* file size is different from -1, if wildcard\r\n                                LIST parsing was done and wc_statemach set\r\n                                it */\r\n};\r\n\r\n#define DEFAULT_ACCEPT_TIMEOUT   60000 /* milliseconds == one minute */\r\n\r\n#endif /* HEADER_CURL_FTP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ftplistparser.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/**\r\n * Now implemented:\r\n *\r\n * 1) UNIX version 1\r\n * drwxr-xr-x 1 user01 ftp  512 Jan 29 23:32 prog\r\n * 2) UNIX version 2\r\n * drwxr-xr-x 1 user01 ftp  512 Jan 29 1997  prog\r\n * 3) UNIX version 3\r\n * drwxr-xr-x 1      1   1  512 Jan 29 23:32 prog\r\n * 4) UNIX symlink\r\n * lrwxr-xr-x 1 user01 ftp  512 Jan 29 23:32 prog -> prog2000\r\n * 5) DOS style\r\n * 01-29-97 11:32PM <DIR> prog\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"fileinfo.h\"\r\n#include \"llist.h\"\r\n#include \"strtoofft.h\"\r\n#include \"rawstr.h\"\r\n#include \"ftp.h\"\r\n#include \"ftplistparser.h\"\r\n#include \"curl_fnmatch.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* allocs buffer which will contain one line of LIST command response */\r\n#define FTP_BUFFER_ALLOCSIZE 160\r\n\r\ntypedef enum {\r\n  PL_UNIX_TOTALSIZE = 0,\r\n  PL_UNIX_FILETYPE,\r\n  PL_UNIX_PERMISSION,\r\n  PL_UNIX_HLINKS,\r\n  PL_UNIX_USER,\r\n  PL_UNIX_GROUP,\r\n  PL_UNIX_SIZE,\r\n  PL_UNIX_TIME,\r\n  PL_UNIX_FILENAME,\r\n  PL_UNIX_SYMLINK\r\n} pl_unix_mainstate;\r\n\r\ntypedef union {\r\n  enum {\r\n    PL_UNIX_TOTALSIZE_INIT = 0,\r\n    PL_UNIX_TOTALSIZE_READING\r\n  } total_dirsize;\r\n\r\n  enum {\r\n    PL_UNIX_HLINKS_PRESPACE = 0,\r\n    PL_UNIX_HLINKS_NUMBER\r\n  } hlinks;\r\n\r\n  enum {\r\n    PL_UNIX_USER_PRESPACE = 0,\r\n    PL_UNIX_USER_PARSING\r\n  } user;\r\n\r\n  enum {\r\n    PL_UNIX_GROUP_PRESPACE = 0,\r\n    PL_UNIX_GROUP_NAME\r\n  } group;\r\n\r\n  enum {\r\n    PL_UNIX_SIZE_PRESPACE = 0,\r\n    PL_UNIX_SIZE_NUMBER\r\n  } size;\r\n\r\n  enum {\r\n    PL_UNIX_TIME_PREPART1 = 0,\r\n    PL_UNIX_TIME_PART1,\r\n    PL_UNIX_TIME_PREPART2,\r\n    PL_UNIX_TIME_PART2,\r\n    PL_UNIX_TIME_PREPART3,\r\n    PL_UNIX_TIME_PART3\r\n  } time;\r\n\r\n  enum {\r\n    PL_UNIX_FILENAME_PRESPACE = 0,\r\n    PL_UNIX_FILENAME_NAME,\r\n    PL_UNIX_FILENAME_WINDOWSEOL\r\n  } filename;\r\n\r\n  enum {\r\n    PL_UNIX_SYMLINK_PRESPACE = 0,\r\n    PL_UNIX_SYMLINK_NAME,\r\n    PL_UNIX_SYMLINK_PRETARGET1,\r\n    PL_UNIX_SYMLINK_PRETARGET2,\r\n    PL_UNIX_SYMLINK_PRETARGET3,\r\n    PL_UNIX_SYMLINK_PRETARGET4,\r\n    PL_UNIX_SYMLINK_TARGET,\r\n    PL_UNIX_SYMLINK_WINDOWSEOL\r\n  } symlink;\r\n} pl_unix_substate;\r\n\r\ntypedef enum {\r\n  PL_WINNT_DATE = 0,\r\n  PL_WINNT_TIME,\r\n  PL_WINNT_DIRORSIZE,\r\n  PL_WINNT_FILENAME\r\n} pl_winNT_mainstate;\r\n\r\ntypedef union {\r\n  enum {\r\n    PL_WINNT_TIME_PRESPACE = 0,\r\n    PL_WINNT_TIME_TIME\r\n  } time;\r\n  enum {\r\n    PL_WINNT_DIRORSIZE_PRESPACE = 0,\r\n    PL_WINNT_DIRORSIZE_CONTENT\r\n  } dirorsize;\r\n  enum {\r\n    PL_WINNT_FILENAME_PRESPACE = 0,\r\n    PL_WINNT_FILENAME_CONTENT,\r\n    PL_WINNT_FILENAME_WINEOL\r\n  } filename;\r\n} pl_winNT_substate;\r\n\r\n/* This struct is used in wildcard downloading - for parsing LIST response */\r\nstruct ftp_parselist_data {\r\n  enum {\r\n    OS_TYPE_UNKNOWN = 0,\r\n    OS_TYPE_UNIX,\r\n    OS_TYPE_WIN_NT\r\n  } os_type;\r\n\r\n  union {\r\n    struct {\r\n      pl_unix_mainstate main;\r\n      pl_unix_substate sub;\r\n    } UNIX;\r\n\r\n    struct {\r\n      pl_winNT_mainstate main;\r\n      pl_winNT_substate sub;\r\n    } NT;\r\n  } state;\r\n\r\n  CURLcode error;\r\n  struct curl_fileinfo *file_data;\r\n  unsigned int item_length;\r\n  size_t item_offset;\r\n  struct {\r\n    size_t filename;\r\n    size_t user;\r\n    size_t group;\r\n    size_t time;\r\n    size_t perm;\r\n    size_t symlink_target;\r\n  } offsets;\r\n};\r\n\r\nstruct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void)\r\n{\r\n  return calloc(1, sizeof(struct ftp_parselist_data));\r\n}\r\n\r\n\r\nvoid Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data)\r\n{\r\n  if(*pl_data)\r\n    free(*pl_data);\r\n  *pl_data = NULL;\r\n}\r\n\r\n\r\nCURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data)\r\n{\r\n  return pl_data->error;\r\n}\r\n\r\n\r\n#define FTP_LP_MALFORMATED_PERM 0x01000000\r\n\r\nstatic int ftp_pl_get_permission(const char *str)\r\n{\r\n  int permissions = 0;\r\n  /* USER */\r\n  if(str[0] == 'r')\r\n    permissions |= 1 << 8;\r\n  else if(str[0] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n  if(str[1] == 'w')\r\n    permissions |= 1 << 7;\r\n  else if(str[1] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n\r\n  if(str[2] == 'x')\r\n    permissions |= 1 << 6;\r\n  else if(str[2] == 's') {\r\n    permissions |= 1 << 6;\r\n    permissions |= 1 << 11;\r\n  }\r\n  else if(str[2] == 'S')\r\n    permissions |= 1 << 11;\r\n  else if(str[2] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n  /* GROUP */\r\n  if(str[3] == 'r')\r\n    permissions |= 1 << 5;\r\n  else if(str[3] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n  if(str[4] == 'w')\r\n    permissions |= 1 << 4;\r\n  else if(str[4] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n  if(str[5] == 'x')\r\n    permissions |= 1 << 3;\r\n  else if(str[5] == 's') {\r\n    permissions |= 1 << 3;\r\n    permissions |= 1 << 10;\r\n  }\r\n  else if(str[5] == 'S')\r\n    permissions |= 1 << 10;\r\n  else if(str[5] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n  /* others */\r\n  if(str[6] == 'r')\r\n    permissions |= 1 << 2;\r\n  else if(str[6] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n  if(str[7] == 'w')\r\n    permissions |= 1 << 1;\r\n  else if(str[7] != '-')\r\n      permissions |= FTP_LP_MALFORMATED_PERM;\r\n  if(str[8] == 'x')\r\n    permissions |= 1;\r\n  else if(str[8] == 't') {\r\n    permissions |= 1;\r\n    permissions |= 1 << 9;\r\n  }\r\n  else if(str[8] == 'T')\r\n    permissions |= 1 << 9;\r\n  else if(str[8] != '-')\r\n    permissions |= FTP_LP_MALFORMATED_PERM;\r\n\r\n  return permissions;\r\n}\r\n\r\nstatic void PL_ERROR(struct connectdata *conn, CURLcode err)\r\n{\r\n  struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp;\r\n  struct ftp_parselist_data *parser = tmpdata->parser;\r\n  if(parser->file_data)\r\n    Curl_fileinfo_dtor(NULL, parser->file_data);\r\n  parser->file_data = NULL;\r\n  parser->error = err;\r\n}\r\n\r\nstatic bool ftp_pl_gettime(struct ftp_parselist_data *parser, char *string)\r\n{\r\n  (void)parser;\r\n  (void)string;\r\n  /* TODO\r\n   * There could be possible parse timestamp from server. Leaving unimplemented\r\n   * for now.\r\n   * If you want implement this, please add CURLFINFOFLAG_KNOWN_TIME flag to\r\n   * parser->file_data->flags\r\n   *\r\n   * Ftp servers are giving usually these formats:\r\n   *  Apr 11  1998 (unknown time.. set it to 00:00:00?)\r\n   *  Apr 11 12:21 (unknown year -> set it to NOW() time?)\r\n   *  08-05-09  02:49PM  (ms-dos format)\r\n   *  20100421092538 -> for MLST/MLSD response\r\n   */\r\n\r\n  return FALSE;\r\n}\r\n\r\nstatic CURLcode ftp_pl_insert_finfo(struct connectdata *conn,\r\n                                    struct curl_fileinfo *finfo)\r\n{\r\n  curl_fnmatch_callback compare;\r\n  struct WildcardData *wc = &conn->data->wildcard;\r\n  struct ftp_wc_tmpdata *tmpdata = wc->tmp;\r\n  struct curl_llist *llist = wc->filelist;\r\n  struct ftp_parselist_data *parser = tmpdata->parser;\r\n  bool add = TRUE;\r\n\r\n  /* move finfo pointers to b_data */\r\n  char *str = finfo->b_data;\r\n  finfo->filename       = str + parser->offsets.filename;\r\n  finfo->strings.group  = parser->offsets.group ?\r\n                          str + parser->offsets.group : NULL;\r\n  finfo->strings.perm   = parser->offsets.perm ?\r\n                          str + parser->offsets.perm : NULL;\r\n  finfo->strings.target = parser->offsets.symlink_target ?\r\n                          str + parser->offsets.symlink_target : NULL;\r\n  finfo->strings.time   = str + parser->offsets.time;\r\n  finfo->strings.user   = parser->offsets.user ?\r\n                          str + parser->offsets.user : NULL;\r\n\r\n  /* get correct fnmatch callback */\r\n  compare = conn->data->set.fnmatch;\r\n  if(!compare)\r\n    compare = Curl_fnmatch;\r\n\r\n  /* filter pattern-corresponding filenames */\r\n  if(compare(conn->data->set.fnmatch_data, wc->pattern,\r\n             finfo->filename) == 0) {\r\n    /* discard symlink which is containing multiple \" -> \" */\r\n    if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target &&\r\n       (strstr(finfo->strings.target, \" -> \"))) {\r\n      add = FALSE;\r\n    }\r\n  }\r\n  else {\r\n    add = FALSE;\r\n  }\r\n\r\n  if(add) {\r\n    if(!Curl_llist_insert_next(llist, llist->tail, finfo)) {\r\n      Curl_fileinfo_dtor(NULL, finfo);\r\n      tmpdata->parser->file_data = NULL;\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n  else {\r\n    Curl_fileinfo_dtor(NULL, finfo);\r\n  }\r\n\r\n  tmpdata->parser->file_data = NULL;\r\n  return CURLE_OK;\r\n}\r\n\r\nsize_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,\r\n                          void *connptr)\r\n{\r\n  size_t bufflen = size*nmemb;\r\n  struct connectdata *conn = (struct connectdata *)connptr;\r\n  struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp;\r\n  struct ftp_parselist_data *parser = tmpdata->parser;\r\n  struct curl_fileinfo *finfo;\r\n  unsigned long i = 0;\r\n  CURLcode rc;\r\n\r\n  if(parser->error) { /* error in previous call */\r\n    /* scenario:\r\n     * 1. call => OK..\r\n     * 2. call => OUT_OF_MEMORY (or other error)\r\n     * 3. (last) call => is skipped RIGHT HERE and the error is hadled later\r\n     *    in wc_statemach()\r\n     */\r\n    return bufflen;\r\n  }\r\n\r\n  if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) {\r\n    /* considering info about FILE response format */\r\n    parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ?\r\n                       OS_TYPE_WIN_NT : OS_TYPE_UNIX;\r\n  }\r\n\r\n  while(i < bufflen) { /* FSM */\r\n\r\n    char c = buffer[i];\r\n    if(!parser->file_data) { /* tmp file data is not allocated yet */\r\n      parser->file_data = Curl_fileinfo_alloc();\r\n      if(!parser->file_data) {\r\n        parser->error = CURLE_OUT_OF_MEMORY;\r\n        return bufflen;\r\n      }\r\n      parser->file_data->b_data = malloc(FTP_BUFFER_ALLOCSIZE);\r\n      if(!parser->file_data->b_data) {\r\n        PL_ERROR(conn, CURLE_OUT_OF_MEMORY);\r\n        return bufflen;\r\n      }\r\n      parser->file_data->b_size = FTP_BUFFER_ALLOCSIZE;\r\n      parser->item_offset = 0;\r\n      parser->item_length = 0;\r\n    }\r\n\r\n    finfo = parser->file_data;\r\n    finfo->b_data[finfo->b_used++] = c;\r\n\r\n    if(finfo->b_used >= finfo->b_size - 1) {\r\n      /* if it is important, extend buffer space for file data */\r\n      char *tmp = realloc(finfo->b_data,\r\n                          finfo->b_size + FTP_BUFFER_ALLOCSIZE);\r\n      if(tmp) {\r\n        finfo->b_size += FTP_BUFFER_ALLOCSIZE;\r\n        finfo->b_data = tmp;\r\n      }\r\n      else {\r\n        Curl_fileinfo_dtor(NULL, parser->file_data);\r\n        parser->file_data = NULL;\r\n        parser->error = CURLE_OUT_OF_MEMORY;\r\n        PL_ERROR(conn, CURLE_OUT_OF_MEMORY);\r\n        return bufflen;\r\n      }\r\n    }\r\n\r\n    switch (parser->os_type) {\r\n    case OS_TYPE_UNIX:\r\n      switch (parser->state.UNIX.main) {\r\n      case PL_UNIX_TOTALSIZE:\r\n        switch(parser->state.UNIX.sub.total_dirsize) {\r\n        case PL_UNIX_TOTALSIZE_INIT:\r\n          if(c == 't') {\r\n            parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING;\r\n            parser->item_length++;\r\n          }\r\n          else {\r\n            parser->state.UNIX.main = PL_UNIX_FILETYPE;\r\n            /* start FSM again not considering size of directory */\r\n            finfo->b_used = 0;\r\n            i--;\r\n          }\r\n          break;\r\n        case PL_UNIX_TOTALSIZE_READING:\r\n          parser->item_length++;\r\n          if(c == '\\r') {\r\n            parser->item_length--;\r\n            finfo->b_used--;\r\n          }\r\n          else if(c == '\\n') {\r\n            finfo->b_data[parser->item_length - 1] = 0;\r\n            if(strncmp(\"total \", finfo->b_data, 6) == 0) {\r\n              char *endptr = finfo->b_data+6;\r\n              /* here we can deal with directory size */\r\n              while(ISSPACE(*endptr))\r\n                endptr++;\r\n              if(*endptr != 0) {\r\n                PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n                return bufflen;\r\n              }\r\n              else {\r\n                parser->state.UNIX.main = PL_UNIX_FILETYPE;\r\n                finfo->b_used = 0;\r\n              }\r\n            }\r\n            else {\r\n              PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_FILETYPE:\r\n        switch (c) {\r\n        case '-':\r\n          finfo->filetype = CURLFILETYPE_FILE;\r\n          break;\r\n        case 'd':\r\n          finfo->filetype = CURLFILETYPE_DIRECTORY;\r\n          break;\r\n        case 'l':\r\n          finfo->filetype = CURLFILETYPE_SYMLINK;\r\n          break;\r\n        case 'p':\r\n          finfo->filetype = CURLFILETYPE_NAMEDPIPE;\r\n          break;\r\n        case 's':\r\n          finfo->filetype = CURLFILETYPE_SOCKET;\r\n          break;\r\n        case 'c':\r\n          finfo->filetype = CURLFILETYPE_DEVICE_CHAR;\r\n          break;\r\n        case 'b':\r\n          finfo->filetype = CURLFILETYPE_DEVICE_BLOCK;\r\n          break;\r\n        case 'D':\r\n          finfo->filetype = CURLFILETYPE_DOOR;\r\n          break;\r\n        default:\r\n          PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n          return bufflen;\r\n        }\r\n        parser->state.UNIX.main = PL_UNIX_PERMISSION;\r\n        parser->item_length = 0;\r\n        parser->item_offset = 1;\r\n        break;\r\n      case PL_UNIX_PERMISSION:\r\n        parser->item_length++;\r\n        if(parser->item_length <= 9) {\r\n          if(!strchr(\"rwx-tTsS\", c)) {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n        }\r\n        else if(parser->item_length == 10) {\r\n          unsigned int perm;\r\n          if(c != ' ') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          finfo->b_data[10] = 0; /* terminate permissions */\r\n          perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset);\r\n          if(perm & FTP_LP_MALFORMATED_PERM) {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          parser->file_data->flags |= CURLFINFOFLAG_KNOWN_PERM;\r\n          parser->file_data->perm = perm;\r\n          parser->offsets.perm = parser->item_offset;\r\n\r\n          parser->item_length = 0;\r\n          parser->state.UNIX.main = PL_UNIX_HLINKS;\r\n          parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE;\r\n        }\r\n        break;\r\n      case PL_UNIX_HLINKS:\r\n        switch(parser->state.UNIX.sub.hlinks) {\r\n        case PL_UNIX_HLINKS_PRESPACE:\r\n          if(c != ' ') {\r\n            if(c >= '0' && c <= '9') {\r\n              parser->item_offset = finfo->b_used - 1;\r\n              parser->item_length = 1;\r\n              parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER;\r\n            }\r\n            else {\r\n              PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        case PL_UNIX_HLINKS_NUMBER:\r\n          parser->item_length ++;\r\n          if(c == ' ') {\r\n            char *p;\r\n            long int hlinks;\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10);\r\n            if(p[0] == '\\0' && hlinks != LONG_MAX && hlinks != LONG_MIN) {\r\n              parser->file_data->flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT;\r\n              parser->file_data->hardlinks = hlinks;\r\n            }\r\n            parser->item_length = 0;\r\n            parser->item_offset = 0;\r\n            parser->state.UNIX.main = PL_UNIX_USER;\r\n            parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE;\r\n          }\r\n          else if(c < '0' || c > '9') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_USER:\r\n        switch(parser->state.UNIX.sub.user) {\r\n        case PL_UNIX_USER_PRESPACE:\r\n          if(c != ' ') {\r\n            parser->item_offset = finfo->b_used - 1;\r\n            parser->item_length = 1;\r\n            parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING;\r\n          }\r\n          break;\r\n        case PL_UNIX_USER_PARSING:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            parser->offsets.user = parser->item_offset;\r\n            parser->state.UNIX.main = PL_UNIX_GROUP;\r\n            parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE;\r\n            parser->item_offset = 0;\r\n            parser->item_length = 0;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_GROUP:\r\n        switch(parser->state.UNIX.sub.group) {\r\n        case PL_UNIX_GROUP_PRESPACE:\r\n          if(c != ' ') {\r\n            parser->item_offset = finfo->b_used - 1;\r\n            parser->item_length = 1;\r\n            parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME;\r\n          }\r\n          break;\r\n        case PL_UNIX_GROUP_NAME:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            parser->offsets.group = parser->item_offset;\r\n            parser->state.UNIX.main = PL_UNIX_SIZE;\r\n            parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE;\r\n            parser->item_offset = 0;\r\n            parser->item_length = 0;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_SIZE:\r\n        switch(parser->state.UNIX.sub.size) {\r\n        case PL_UNIX_SIZE_PRESPACE:\r\n          if(c != ' ') {\r\n            if(c >= '0' && c <= '9') {\r\n              parser->item_offset = finfo->b_used - 1;\r\n              parser->item_length = 1;\r\n              parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER;\r\n            }\r\n            else {\r\n              PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        case PL_UNIX_SIZE_NUMBER:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            char *p;\r\n            curl_off_t fsize;\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            fsize = curlx_strtoofft(finfo->b_data+parser->item_offset, &p, 10);\r\n            if(p[0] == '\\0' && fsize != CURL_OFF_T_MAX &&\r\n                               fsize != CURL_OFF_T_MIN) {\r\n              parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE;\r\n              parser->file_data->size = fsize;\r\n            }\r\n            parser->item_length = 0;\r\n            parser->item_offset = 0;\r\n            parser->state.UNIX.main = PL_UNIX_TIME;\r\n            parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1;\r\n          }\r\n          else if(!ISDIGIT(c)) {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_TIME:\r\n        switch(parser->state.UNIX.sub.time) {\r\n        case PL_UNIX_TIME_PREPART1:\r\n          if(c != ' ') {\r\n            if(ISALNUM(c)) {\r\n              parser->item_offset = finfo->b_used -1;\r\n              parser->item_length = 1;\r\n              parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1;\r\n            }\r\n            else {\r\n              PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        case PL_UNIX_TIME_PART1:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2;\r\n          }\r\n          else if(!ISALNUM(c) && c != '.') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        case PL_UNIX_TIME_PREPART2:\r\n          parser->item_length++;\r\n          if(c != ' ') {\r\n            if(ISALNUM(c)) {\r\n              parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2;\r\n            }\r\n            else {\r\n              PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        case PL_UNIX_TIME_PART2:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3;\r\n          }\r\n          else if(!ISALNUM(c) && c != '.') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        case PL_UNIX_TIME_PREPART3:\r\n          parser->item_length++;\r\n          if(c != ' ') {\r\n            if(ISALNUM(c)) {\r\n              parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3;\r\n            }\r\n            else {\r\n              PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        case PL_UNIX_TIME_PART3:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            finfo->b_data[parser->item_offset + parser->item_length -1] = 0;\r\n            parser->offsets.time = parser->item_offset;\r\n            if(ftp_pl_gettime(parser, finfo->b_data + parser->item_offset)) {\r\n              parser->file_data->flags |= CURLFINFOFLAG_KNOWN_TIME;\r\n            }\r\n            if(finfo->filetype == CURLFILETYPE_SYMLINK) {\r\n              parser->state.UNIX.main = PL_UNIX_SYMLINK;\r\n              parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE;\r\n            }\r\n            else {\r\n              parser->state.UNIX.main = PL_UNIX_FILENAME;\r\n              parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE;\r\n            }\r\n          }\r\n          else if(!ISALNUM(c) && c != '.' && c != ':') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_FILENAME:\r\n        switch(parser->state.UNIX.sub.filename) {\r\n        case PL_UNIX_FILENAME_PRESPACE:\r\n          if(c != ' ') {\r\n            parser->item_offset = finfo->b_used - 1;\r\n            parser->item_length = 1;\r\n            parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME;\r\n          }\r\n          break;\r\n        case PL_UNIX_FILENAME_NAME:\r\n          parser->item_length++;\r\n          if(c == '\\r') {\r\n            parser->item_length--;\r\n            parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL;\r\n          }\r\n          else if(c == '\\n') {\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            parser->offsets.filename = parser->item_offset;\r\n            parser->state.UNIX.main = PL_UNIX_FILETYPE;\r\n            rc = ftp_pl_insert_finfo(conn, finfo);\r\n            if(rc) {\r\n              PL_ERROR(conn, rc);\r\n              return bufflen;\r\n            }\r\n          }\r\n          break;\r\n        case PL_UNIX_FILENAME_WINDOWSEOL:\r\n          if(c == '\\n') {\r\n            finfo->b_data[parser->item_offset + parser->item_length] = 0;\r\n            parser->offsets.filename = parser->item_offset;\r\n            parser->state.UNIX.main = PL_UNIX_FILETYPE;\r\n            rc = ftp_pl_insert_finfo(conn, finfo);\r\n            if(rc) {\r\n              PL_ERROR(conn, rc);\r\n              return bufflen;\r\n            }\r\n          }\r\n          else {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_UNIX_SYMLINK:\r\n        switch(parser->state.UNIX.sub.symlink) {\r\n        case PL_UNIX_SYMLINK_PRESPACE:\r\n          if(c != ' ') {\r\n            parser->item_offset = finfo->b_used - 1;\r\n            parser->item_length = 1;\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_NAME:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1;\r\n          }\r\n          else if(c == '\\r' || c == '\\n') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_PRETARGET1:\r\n          parser->item_length++;\r\n          if(c == '-') {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2;\r\n          }\r\n          else if(c == '\\r' || c == '\\n') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          else {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_PRETARGET2:\r\n          parser->item_length++;\r\n          if(c == '>') {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3;\r\n          }\r\n          else if(c == '\\r' || c == '\\n') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          else {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_PRETARGET3:\r\n          parser->item_length++;\r\n          if(c == ' ') {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4;\r\n            /* now place where is symlink following */\r\n            finfo->b_data[parser->item_offset + parser->item_length - 4] = 0;\r\n            parser->offsets.filename = parser->item_offset;\r\n            parser->item_length = 0;\r\n            parser->item_offset = 0;\r\n          }\r\n          else if(c == '\\r' || c == '\\n') {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          else {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_PRETARGET4:\r\n          if(c != '\\r' && c != '\\n') {\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET;\r\n            parser->item_offset = finfo->b_used - 1;\r\n            parser->item_length = 1;\r\n          }\r\n          else {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_TARGET:\r\n          parser->item_length ++;\r\n          if(c == '\\r') {\r\n            parser->item_length --;\r\n            parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL;\r\n          }\r\n          else if(c == '\\n') {\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            parser->offsets.symlink_target = parser->item_offset;\r\n            rc = ftp_pl_insert_finfo(conn, finfo);\r\n            if(rc) {\r\n              PL_ERROR(conn, rc);\r\n              return bufflen;\r\n            }\r\n            parser->state.UNIX.main = PL_UNIX_FILETYPE;\r\n          }\r\n          break;\r\n        case PL_UNIX_SYMLINK_WINDOWSEOL:\r\n          if(c == '\\n') {\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            parser->offsets.symlink_target = parser->item_offset;\r\n            rc = ftp_pl_insert_finfo(conn, finfo);\r\n            if(rc) {\r\n              PL_ERROR(conn, rc);\r\n              return bufflen;\r\n            }\r\n            parser->state.UNIX.main = PL_UNIX_FILETYPE;\r\n          }\r\n          else {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      }\r\n      break;\r\n    case OS_TYPE_WIN_NT:\r\n      switch(parser->state.NT.main) {\r\n      case PL_WINNT_DATE:\r\n        parser->item_length++;\r\n        if(parser->item_length < 9) {\r\n          if(!strchr(\"0123456789-\", c)) { /* only simple control */\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n        }\r\n        else if(parser->item_length == 9) {\r\n          if(c == ' ') {\r\n            parser->state.NT.main = PL_WINNT_TIME;\r\n            parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE;\r\n          }\r\n          else {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n        }\r\n        else {\r\n          PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n          return bufflen;\r\n        }\r\n        break;\r\n      case PL_WINNT_TIME:\r\n        parser->item_length++;\r\n        switch(parser->state.NT.sub.time) {\r\n        case PL_WINNT_TIME_PRESPACE:\r\n          if(!ISSPACE(c)) {\r\n            parser->state.NT.sub.time = PL_WINNT_TIME_TIME;\r\n          }\r\n          break;\r\n        case PL_WINNT_TIME_TIME:\r\n          if(c == ' ') {\r\n            parser->offsets.time = parser->item_offset;\r\n            finfo->b_data[parser->item_offset + parser->item_length -1] = 0;\r\n            parser->state.NT.main = PL_WINNT_DIRORSIZE;\r\n            parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE;\r\n            parser->item_length = 0;\r\n          }\r\n          else if(!strchr(\"APM0123456789:\", c)) {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_WINNT_DIRORSIZE:\r\n        switch(parser->state.NT.sub.dirorsize) {\r\n        case PL_WINNT_DIRORSIZE_PRESPACE:\r\n          if(c == ' ') {\r\n\r\n          }\r\n          else {\r\n            parser->item_offset = finfo->b_used - 1;\r\n            parser->item_length = 1;\r\n            parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT;\r\n          }\r\n          break;\r\n        case PL_WINNT_DIRORSIZE_CONTENT:\r\n          parser->item_length ++;\r\n          if(c == ' ') {\r\n            finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;\r\n            if(strcmp(\"<DIR>\", finfo->b_data + parser->item_offset) == 0) {\r\n              finfo->filetype = CURLFILETYPE_DIRECTORY;\r\n              finfo->size = 0;\r\n            }\r\n            else {\r\n              char *endptr;\r\n              finfo->size = curlx_strtoofft(finfo->b_data +\r\n                                            parser->item_offset,\r\n                                            &endptr, 10);\r\n              if(!*endptr) {\r\n                if(finfo->size == CURL_OFF_T_MAX ||\r\n                   finfo->size == CURL_OFF_T_MIN) {\r\n                  if(errno == ERANGE) {\r\n                    PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n                    return bufflen;\r\n                  }\r\n                }\r\n              }\r\n              else {\r\n                PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n                return bufflen;\r\n              }\r\n              /* correct file type */\r\n              parser->file_data->filetype = CURLFILETYPE_FILE;\r\n            }\r\n\r\n            parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE;\r\n            parser->item_length = 0;\r\n            parser->state.NT.main = PL_WINNT_FILENAME;\r\n            parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      case PL_WINNT_FILENAME:\r\n        switch (parser->state.NT.sub.filename) {\r\n        case PL_WINNT_FILENAME_PRESPACE:\r\n          if(c != ' ') {\r\n            parser->item_offset = finfo->b_used -1;\r\n            parser->item_length = 1;\r\n            parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT;\r\n          }\r\n          break;\r\n        case PL_WINNT_FILENAME_CONTENT:\r\n          parser->item_length++;\r\n          if(c == '\\r') {\r\n            parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL;\r\n            finfo->b_data[finfo->b_used - 1] = 0;\r\n          }\r\n          else if(c == '\\n') {\r\n            parser->offsets.filename = parser->item_offset;\r\n            finfo->b_data[finfo->b_used - 1] = 0;\r\n            parser->offsets.filename = parser->item_offset;\r\n            rc = ftp_pl_insert_finfo(conn, finfo);\r\n            if(rc) {\r\n              PL_ERROR(conn, rc);\r\n              return bufflen;\r\n            }\r\n            parser->state.NT.main = PL_WINNT_DATE;\r\n            parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;\r\n          }\r\n          break;\r\n        case PL_WINNT_FILENAME_WINEOL:\r\n          if(c == '\\n') {\r\n            parser->offsets.filename = parser->item_offset;\r\n            rc = ftp_pl_insert_finfo(conn, finfo);\r\n            if(rc) {\r\n              PL_ERROR(conn, rc);\r\n              return bufflen;\r\n            }\r\n            parser->state.NT.main = PL_WINNT_DATE;\r\n            parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;\r\n          }\r\n          else {\r\n            PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);\r\n            return bufflen;\r\n          }\r\n          break;\r\n        }\r\n        break;\r\n      }\r\n      break;\r\n    default:\r\n      return bufflen+1;\r\n    }\r\n\r\n    i++;\r\n  }\r\n\r\n  return bufflen;\r\n}\r\n\r\n#endif /* CURL_DISABLE_FTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ftplistparser.h",
    "content": "#ifndef HEADER_CURL_FTPLISTPARSER_H\r\n#define HEADER_CURL_FTPLISTPARSER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n\r\n/* WRITEFUNCTION callback for parsing LIST responses */\r\nsize_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,\r\n                          void *connptr);\r\n\r\nstruct ftp_parselist_data; /* defined inside ftplibparser.c */\r\n\r\nCURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data);\r\n\r\nstruct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void);\r\n\r\nvoid Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data);\r\n\r\n#endif /* CURL_DISABLE_FTP */\r\n#endif /* HEADER_CURL_FTPLISTPARSER_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/getenv.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n#include \"curl_memory.h\"\r\n\r\n#include \"memdebug.h\"\r\n\r\nstatic\r\nchar *GetEnv(const char *variable)\r\n{\r\n#ifdef _WIN32_WCE\r\n  return NULL;\r\n#else\r\n#ifdef WIN32\r\n  char env[MAX_PATH]; /* MAX_PATH is from windef.h */\r\n  char *temp = getenv(variable);\r\n  env[0] = '\\0';\r\n  if(temp != NULL)\r\n    ExpandEnvironmentStringsA(temp, env, sizeof(env));\r\n  return (env[0] != '\\0')?strdup(env):NULL;\r\n#else\r\n  char *env = getenv(variable);\r\n  return (env && env[0])?strdup(env):NULL;\r\n#endif\r\n#endif\r\n}\r\n\r\nchar *curl_getenv(const char *v)\r\n{\r\n  return GetEnv(v);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/getinfo.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"getinfo.h\"\r\n\r\n#include \"curl_memory.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\" /* Curl_getconnectinfo() */\r\n#include \"progress.h\"\r\n\r\n/* Make this the last #include */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * This is supposed to be called in the beginning of a perform() session\r\n * and should reset all session-info variables\r\n */\r\nCURLcode Curl_initinfo(struct SessionHandle *data)\r\n{\r\n  struct Progress *pro = &data->progress;\r\n  struct PureInfo *info =&data->info;\r\n\r\n  pro->t_nslookup = 0;\r\n  pro->t_connect = 0;\r\n  pro->t_appconnect = 0;\r\n  pro->t_pretransfer = 0;\r\n  pro->t_starttransfer = 0;\r\n  pro->timespent = 0;\r\n  pro->t_redirect = 0;\r\n\r\n  info->httpcode = 0;\r\n  info->httpversion=0;\r\n  info->filetime=-1; /* -1 is an illegal time and thus means unknown */\r\n\r\n  if(info->contenttype)\r\n    free(info->contenttype);\r\n  info->contenttype = NULL;\r\n\r\n  info->header_size = 0;\r\n  info->request_size = 0;\r\n  info->numconnects = 0;\r\n\r\n  info->conn_primary_ip[0] = '\\0';\r\n  info->conn_local_ip[0] = '\\0';\r\n  info->conn_primary_port = 0;\r\n  info->conn_local_port = 0;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info,\r\n                             char **param_charp)\r\n{\r\n  switch(info) {\r\n  case CURLINFO_EFFECTIVE_URL:\r\n    *param_charp = data->change.url?data->change.url:(char *)\"\";\r\n    break;\r\n  case CURLINFO_CONTENT_TYPE:\r\n    *param_charp = data->info.contenttype;\r\n    break;\r\n  case CURLINFO_PRIVATE:\r\n    *param_charp = (char *) data->set.private_data;\r\n    break;\r\n  case CURLINFO_FTP_ENTRY_PATH:\r\n    /* Return the entrypath string from the most recent connection.\r\n       This pointer was copied from the connectdata structure by FTP.\r\n       The actual string may be free()ed by subsequent libcurl calls so\r\n       it must be copied to a safer area before the next libcurl call.\r\n       Callers must never free it themselves. */\r\n    *param_charp = data->state.most_recent_ftp_entrypath;\r\n    break;\r\n  case CURLINFO_REDIRECT_URL:\r\n    /* Return the URL this request would have been redirected to if that\r\n       option had been enabled! */\r\n    *param_charp = data->info.wouldredirect;\r\n    break;\r\n  case CURLINFO_PRIMARY_IP:\r\n    /* Return the ip address of the most recent (primary) connection */\r\n    *param_charp = data->info.conn_primary_ip;\r\n    break;\r\n  case CURLINFO_LOCAL_IP:\r\n    /* Return the source/local ip address of the most recent (primary)\r\n       connection */\r\n    *param_charp = data->info.conn_local_ip;\r\n    break;\r\n  case CURLINFO_RTSP_SESSION_ID:\r\n    *param_charp = data->set.str[STRING_RTSP_SESSION_ID];\r\n    break;\r\n\r\n  default:\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,\r\n                             long *param_longp)\r\n{\r\n  curl_socket_t sockfd;\r\n\r\n  union {\r\n    unsigned long *to_ulong;\r\n    long          *to_long;\r\n  } lptr;\r\n\r\n  switch(info) {\r\n  case CURLINFO_RESPONSE_CODE:\r\n    *param_longp = data->info.httpcode;\r\n    break;\r\n  case CURLINFO_HTTP_CONNECTCODE:\r\n    *param_longp = data->info.httpproxycode;\r\n    break;\r\n  case CURLINFO_FILETIME:\r\n    *param_longp = data->info.filetime;\r\n    break;\r\n  case CURLINFO_HEADER_SIZE:\r\n    *param_longp = data->info.header_size;\r\n    break;\r\n  case CURLINFO_REQUEST_SIZE:\r\n    *param_longp = data->info.request_size;\r\n    break;\r\n  case CURLINFO_SSL_VERIFYRESULT:\r\n    *param_longp = data->set.ssl.certverifyresult;\r\n    break;\r\n  case CURLINFO_REDIRECT_COUNT:\r\n    *param_longp = data->set.followlocation;\r\n    break;\r\n  case CURLINFO_HTTPAUTH_AVAIL:\r\n    lptr.to_long = param_longp;\r\n    *lptr.to_ulong = data->info.httpauthavail;\r\n    break;\r\n  case CURLINFO_PROXYAUTH_AVAIL:\r\n    lptr.to_long = param_longp;\r\n    *lptr.to_ulong = data->info.proxyauthavail;\r\n    break;\r\n  case CURLINFO_OS_ERRNO:\r\n    *param_longp = data->state.os_errno;\r\n    break;\r\n  case CURLINFO_NUM_CONNECTS:\r\n    *param_longp = data->info.numconnects;\r\n    break;\r\n  case CURLINFO_LASTSOCKET:\r\n    sockfd = Curl_getconnectinfo(data, NULL);\r\n\r\n    /* note: this is not a good conversion for systems with 64 bit sockets and\r\n       32 bit longs */\r\n    if(sockfd != CURL_SOCKET_BAD)\r\n      *param_longp = (long)sockfd;\r\n    else\r\n      /* this interface is documented to return -1 in case of badness, which\r\n         may not be the same as the CURL_SOCKET_BAD value */\r\n      *param_longp = -1;\r\n    break;\r\n  case CURLINFO_PRIMARY_PORT:\r\n    /* Return the (remote) port of the most recent (primary) connection */\r\n    *param_longp = data->info.conn_primary_port;\r\n    break;\r\n  case CURLINFO_LOCAL_PORT:\r\n    /* Return the local port of the most recent (primary) connection */\r\n    *param_longp = data->info.conn_local_port;\r\n    break;\r\n  case CURLINFO_CONDITION_UNMET:\r\n    /* return if the condition prevented the document to get transferred */\r\n    *param_longp = data->info.timecond;\r\n    break;\r\n  case CURLINFO_RTSP_CLIENT_CSEQ:\r\n    *param_longp = data->state.rtsp_next_client_CSeq;\r\n    break;\r\n  case CURLINFO_RTSP_SERVER_CSEQ:\r\n    *param_longp = data->state.rtsp_next_server_CSeq;\r\n    break;\r\n  case CURLINFO_RTSP_CSEQ_RECV:\r\n    *param_longp = data->state.rtsp_CSeq_recv;\r\n    break;\r\n\r\n  default:\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info,\r\n                               double *param_doublep)\r\n{\r\n  switch(info) {\r\n  case CURLINFO_TOTAL_TIME:\r\n    *param_doublep = data->progress.timespent;\r\n    break;\r\n  case CURLINFO_NAMELOOKUP_TIME:\r\n    *param_doublep = data->progress.t_nslookup;\r\n    break;\r\n  case CURLINFO_CONNECT_TIME:\r\n    *param_doublep = data->progress.t_connect;\r\n    break;\r\n  case CURLINFO_APPCONNECT_TIME:\r\n    *param_doublep = data->progress.t_appconnect;\r\n    break;\r\n  case CURLINFO_PRETRANSFER_TIME:\r\n    *param_doublep =  data->progress.t_pretransfer;\r\n    break;\r\n  case CURLINFO_STARTTRANSFER_TIME:\r\n    *param_doublep = data->progress.t_starttransfer;\r\n    break;\r\n  case CURLINFO_SIZE_UPLOAD:\r\n    *param_doublep =  (double)data->progress.uploaded;\r\n    break;\r\n  case CURLINFO_SIZE_DOWNLOAD:\r\n    *param_doublep = (double)data->progress.downloaded;\r\n    break;\r\n  case CURLINFO_SPEED_DOWNLOAD:\r\n    *param_doublep =  (double)data->progress.dlspeed;\r\n    break;\r\n  case CURLINFO_SPEED_UPLOAD:\r\n    *param_doublep = (double)data->progress.ulspeed;\r\n    break;\r\n  case CURLINFO_CONTENT_LENGTH_DOWNLOAD:\r\n    *param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?\r\n      (double)data->progress.size_dl:-1;\r\n    break;\r\n  case CURLINFO_CONTENT_LENGTH_UPLOAD:\r\n    *param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?\r\n      (double)data->progress.size_ul:-1;\r\n    break;\r\n  case CURLINFO_REDIRECT_TIME:\r\n    *param_doublep =  data->progress.t_redirect;\r\n    break;\r\n\r\n  default:\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,\r\n                              struct curl_slist **param_slistp)\r\n{\r\n  union {\r\n    struct curl_certinfo * to_certinfo;\r\n    struct curl_slist    * to_slist;\r\n  } ptr;\r\n\r\n  switch(info) {\r\n  case CURLINFO_SSL_ENGINES:\r\n    *param_slistp = Curl_ssl_engines_list(data);\r\n    break;\r\n  case CURLINFO_COOKIELIST:\r\n    *param_slistp = Curl_cookie_list(data);\r\n    break;\r\n  case CURLINFO_CERTINFO:\r\n    /* Return the a pointer to the certinfo struct. Not really an slist\r\n       pointer but we can pretend it is here */\r\n    ptr.to_certinfo = &data->info.certs;\r\n    *param_slistp = ptr.to_slist;\r\n    break;\r\n\r\n  default:\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)\r\n{\r\n  va_list arg;\r\n  long *param_longp=NULL;\r\n  double *param_doublep=NULL;\r\n  char **param_charp=NULL;\r\n  struct curl_slist **param_slistp=NULL;\r\n  int type;\r\n  /* default return code is to error out! */\r\n  CURLcode ret = CURLE_BAD_FUNCTION_ARGUMENT;\r\n\r\n  if(!data)\r\n    return ret;\r\n\r\n  va_start(arg, info);\r\n\r\n  type = CURLINFO_TYPEMASK & (int)info;\r\n  switch(type) {\r\n  case CURLINFO_STRING:\r\n    param_charp = va_arg(arg, char **);\r\n    if(NULL != param_charp)\r\n      ret = getinfo_char(data, info, param_charp);\r\n    break;\r\n  case CURLINFO_LONG:\r\n    param_longp = va_arg(arg, long *);\r\n    if(NULL != param_longp)\r\n      ret = getinfo_long(data, info, param_longp);\r\n    break;\r\n  case CURLINFO_DOUBLE:\r\n    param_doublep = va_arg(arg, double *);\r\n    if(NULL != param_doublep)\r\n      ret = getinfo_double(data, info, param_doublep);\r\n    break;\r\n  case CURLINFO_SLIST:\r\n    param_slistp = va_arg(arg, struct curl_slist **);\r\n    if(NULL != param_slistp)\r\n      ret = getinfo_slist(data, info, param_slistp);\r\n    break;\r\n  default:\r\n    break;\r\n  }\r\n\r\n  va_end(arg);\r\n  return ret;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/getinfo.h",
    "content": "#ifndef HEADER_CURL_GETINFO_H\r\n#define HEADER_CURL_GETINFO_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\nCURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...);\r\nCURLcode Curl_initinfo(struct SessionHandle *data);\r\n\r\n#endif /* HEADER_CURL_GETINFO_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/gopher.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_GOPHER\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n\r\n#include \"progress.h\"\r\n#include \"strequal.h\"\r\n#include \"gopher.h\"\r\n#include \"rawstr.h\"\r\n#include \"select.h\"\r\n#include \"url.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Forward declarations.\r\n */\r\n\r\nstatic CURLcode gopher_do(struct connectdata *conn, bool *done);\r\n\r\n/*\r\n * Gopher protocol handler.\r\n * This is also a nice simple template to build off for simple\r\n * connect-command-download protocols.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_gopher = {\r\n  \"GOPHER\",                             /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  gopher_do,                            /* do_it */\r\n  ZERO_NULL,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_GOPHER,                          /* defport */\r\n  CURLPROTO_GOPHER,                     /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\nstatic CURLcode gopher_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n  struct SessionHandle *data=conn->data;\r\n  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];\r\n\r\n  curl_off_t *bytecount = &data->req.bytecount;\r\n  char *path = data->state.path;\r\n  char *sel;\r\n  char *sel_org = NULL;\r\n  ssize_t amount, k;\r\n\r\n  *done = TRUE; /* unconditionally */\r\n\r\n  /* Create selector. Degenerate cases: / and /1 => convert to \"\" */\r\n  if(strlen(path) <= 2)\r\n    sel = (char *)\"\";\r\n  else {\r\n    char *newp;\r\n    size_t j, i;\r\n    int len;\r\n\r\n    /* Otherwise, drop / and the first character (i.e., item type) ... */\r\n    newp = path;\r\n    newp+=2;\r\n\r\n    /* ... then turn ? into TAB for search servers, Veronica, etc. ... */\r\n    j = strlen(newp);\r\n    for(i=0; i<j; i++)\r\n      if(newp[i] == '?')\r\n        newp[i] = '\\x09';\r\n\r\n    /* ... and finally unescape */\r\n    sel = curl_easy_unescape(data, newp, 0, &len);\r\n    if(!sel)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    sel_org = sel;\r\n  }\r\n\r\n  /* We use Curl_write instead of Curl_sendf to make sure the entire buffer is\r\n     sent, which could be sizeable with long selectors. */\r\n  k = curlx_uztosz(strlen(sel));\r\n\r\n  for(;;) {\r\n    result = Curl_write(conn, sockfd, sel, k, &amount);\r\n    if(CURLE_OK == result) { /* Which may not have written it all! */\r\n      result = Curl_client_write(conn, CLIENTWRITE_HEADER, sel, amount);\r\n      if(result) {\r\n        Curl_safefree(sel_org);\r\n        return result;\r\n      }\r\n      k -= amount;\r\n      sel += amount;\r\n      if(k < 1)\r\n        break; /* but it did write it all */\r\n    }\r\n    else {\r\n      failf(data, \"Failed sending Gopher request\");\r\n      Curl_safefree(sel_org);\r\n      return result;\r\n    }\r\n    /* Don't busyloop. The entire loop thing is a work-around as it causes a\r\n       BLOCKING behavior which is a NO-NO. This function should rather be\r\n       split up in a do and a doing piece where the pieces that aren't\r\n       possible to send now will be sent in the doing function repeatedly\r\n       until the entire request is sent.\r\n\r\n       Wait a while for the socket to be writable. Note that this doesn't\r\n       acknowledge the timeout.\r\n    */\r\n    Curl_socket_ready(CURL_SOCKET_BAD, sockfd, 100);\r\n  }\r\n\r\n  Curl_safefree(sel_org);\r\n\r\n  /* We can use Curl_sendf to send the terminal \\r\\n relatively safely and\r\n     save allocing another string/doing another _write loop. */\r\n  result = Curl_sendf(sockfd, conn, \"\\r\\n\");\r\n  if(result != CURLE_OK) {\r\n    failf(data, \"Failed sending Gopher request\");\r\n    return result;\r\n  }\r\n  result = Curl_client_write(conn, CLIENTWRITE_HEADER, (char *)\"\\r\\n\", 2);\r\n  if(result)\r\n    return result;\r\n\r\n  Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,\r\n                      -1, NULL); /* no upload */\r\n  return CURLE_OK;\r\n}\r\n#endif /*CURL_DISABLE_GOPHER*/\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/gopher.h",
    "content": "#ifndef HEADER_CURL_GOPHER_H\r\n#define HEADER_CURL_GOPHER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifndef CURL_DISABLE_GOPHER\r\nextern const struct Curl_handler Curl_handler_gopher;\r\n#endif\r\n\r\n#endif /* HEADER_CURL_GOPHER_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/gtls.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all GnuTLS-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n *\r\n * Note: don't use the GnuTLS' *_t variable type names in this source code,\r\n * since they were not present in 1.0.X.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_GNUTLS\r\n\r\n#include <gnutls/gnutls.h>\r\n#include <gnutls/x509.h>\r\n\r\n#ifdef USE_GNUTLS_NETTLE\r\n#include <gnutls/crypto.h>\r\n#include <nettle/md5.h>\r\n#else\r\n#include <gcrypt.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"inet_pton.h\"\r\n#include \"gtls.h\"\r\n#include \"sslgen.h\"\r\n#include \"parsedate.h\"\r\n#include \"connect.h\" /* for the connect timeout */\r\n#include \"select.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n Some hackish cast macros based on:\r\n http://library.gnome.org/devel/glib/unstable/glib-Type-Conversion-Macros.html\r\n*/\r\n#ifndef GNUTLS_POINTER_TO_INT_CAST\r\n#define GNUTLS_POINTER_TO_INT_CAST(p) ((int) (long) (p))\r\n#endif\r\n#ifndef GNUTLS_INT_TO_POINTER_CAST\r\n#define GNUTLS_INT_TO_POINTER_CAST(i) ((void*) (long) (i))\r\n#endif\r\n\r\n/* Enable GnuTLS debugging by defining GTLSDEBUG */\r\n/*#define GTLSDEBUG */\r\n\r\n#ifdef GTLSDEBUG\r\nstatic void tls_log_func(int level, const char *str)\r\n{\r\n    fprintf(stderr, \"|<%d>| %s\", level, str);\r\n}\r\n#endif\r\nstatic bool gtls_inited = FALSE;\r\n\r\n#if defined(GNUTLS_VERSION_NUMBER)\r\n#  if (GNUTLS_VERSION_NUMBER >= 0x020c00)\r\n#    undef gnutls_transport_set_lowat\r\n#    define gnutls_transport_set_lowat(A,B) Curl_nop_stmt\r\n#    define USE_GNUTLS_PRIORITY_SET_DIRECT 1\r\n#  endif\r\n#  if (GNUTLS_VERSION_NUMBER >= 0x020c03)\r\n#    define GNUTLS_MAPS_WINSOCK_ERRORS 1\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Custom push and pull callback functions used by GNU TLS to read and write\r\n * to the socket.  These functions are simple wrappers to send() and recv()\r\n * (although here using the sread/swrite macros as defined by\r\n * curl_setup_once.h).\r\n * We use custom functions rather than the GNU TLS defaults because it allows\r\n * us to get specific about the fourth \"flags\" argument, and to use arbitrary\r\n * private data with gnutls_transport_set_ptr if we wish.\r\n *\r\n * When these custom push and pull callbacks fail, GNU TLS checks its own\r\n * session-specific error variable, and when not set also its own global\r\n * errno variable, in order to take appropriate action. GNU TLS does not\r\n * require that the transport is actually a socket. This implies that for\r\n * Windows builds these callbacks should ideally set the session-specific\r\n * error variable using function gnutls_transport_set_errno or as a last\r\n * resort global errno variable using gnutls_transport_set_global_errno,\r\n * with a transport agnostic error value. This implies that some winsock\r\n * error translation must take place in these callbacks.\r\n *\r\n * Paragraph above applies to GNU TLS versions older than 2.12.3, since\r\n * this version GNU TLS does its own internal winsock error translation\r\n * using system_errno() function.\r\n */\r\n\r\n#if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)\r\n#  define gtls_EINTR  4\r\n#  define gtls_EIO    5\r\n#  define gtls_EAGAIN 11\r\nstatic int gtls_mapped_sockerrno(void)\r\n{\r\n  switch(SOCKERRNO) {\r\n  case WSAEWOULDBLOCK:\r\n    return gtls_EAGAIN;\r\n  case WSAEINTR:\r\n    return gtls_EINTR;\r\n  default:\r\n    break;\r\n  }\r\n  return gtls_EIO;\r\n}\r\n#endif\r\n\r\nstatic ssize_t Curl_gtls_push(void *s, const void *buf, size_t len)\r\n{\r\n  ssize_t ret = swrite(GNUTLS_POINTER_TO_INT_CAST(s), buf, len);\r\n#if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)\r\n  if(ret < 0)\r\n    gnutls_transport_set_global_errno(gtls_mapped_sockerrno());\r\n#endif\r\n  return ret;\r\n}\r\n\r\nstatic ssize_t Curl_gtls_pull(void *s, void *buf, size_t len)\r\n{\r\n  ssize_t ret = sread(GNUTLS_POINTER_TO_INT_CAST(s), buf, len);\r\n#if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)\r\n  if(ret < 0)\r\n    gnutls_transport_set_global_errno(gtls_mapped_sockerrno());\r\n#endif\r\n  return ret;\r\n}\r\n\r\n/* Curl_gtls_init()\r\n *\r\n * Global GnuTLS init, called from Curl_ssl_init(). This calls functions that\r\n * are not thread-safe and thus this function itself is not thread-safe and\r\n * must only be called from within curl_global_init() to keep the thread\r\n * situation under control!\r\n */\r\nint Curl_gtls_init(void)\r\n{\r\n  int ret = 1;\r\n  if(!gtls_inited) {\r\n    ret = gnutls_global_init()?0:1;\r\n#ifdef GTLSDEBUG\r\n    gnutls_global_set_log_function(tls_log_func);\r\n    gnutls_global_set_log_level(2);\r\n#endif\r\n    gtls_inited = TRUE;\r\n  }\r\n  return ret;\r\n}\r\n\r\nint Curl_gtls_cleanup(void)\r\n{\r\n  if(gtls_inited) {\r\n    gnutls_global_deinit();\r\n    gtls_inited = FALSE;\r\n  }\r\n  return 1;\r\n}\r\n\r\nstatic void showtime(struct SessionHandle *data,\r\n                     const char *text,\r\n                     time_t stamp)\r\n{\r\n  struct tm buffer;\r\n  const struct tm *tm = &buffer;\r\n  CURLcode result = Curl_gmtime(stamp, &buffer);\r\n  if(result)\r\n    return;\r\n\r\n  snprintf(data->state.buffer,\r\n           BUFSIZE,\r\n           \"\\t %s: %s, %02d %s %4d %02d:%02d:%02d GMT\\n\",\r\n           text,\r\n           Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],\r\n           tm->tm_mday,\r\n           Curl_month[tm->tm_mon],\r\n           tm->tm_year + 1900,\r\n           tm->tm_hour,\r\n           tm->tm_min,\r\n           tm->tm_sec);\r\n  infof(data, \"%s\\n\", data->state.buffer);\r\n}\r\n\r\nstatic gnutls_datum load_file (const char *file)\r\n{\r\n  FILE *f;\r\n  gnutls_datum loaded_file = { NULL, 0 };\r\n  long filelen;\r\n  void *ptr;\r\n\r\n  if(!(f = fopen(file, \"r\")))\r\n    return loaded_file;\r\n  if(fseek(f, 0, SEEK_END) != 0\r\n     || (filelen = ftell(f)) < 0\r\n     || fseek(f, 0, SEEK_SET) != 0\r\n     || !(ptr = malloc((size_t)filelen)))\r\n    goto out;\r\n  if(fread(ptr, 1, (size_t)filelen, f) < (size_t)filelen) {\r\n    free(ptr);\r\n    goto out;\r\n  }\r\n\r\n  loaded_file.data = ptr;\r\n  loaded_file.size = (unsigned int)filelen;\r\nout:\r\n  fclose(f);\r\n  return loaded_file;\r\n}\r\n\r\nstatic void unload_file(gnutls_datum data) {\r\n  free(data.data);\r\n}\r\n\r\n\r\n/* this function does a SSL/TLS (re-)handshake */\r\nstatic CURLcode handshake(struct connectdata *conn,\r\n                          int sockindex,\r\n                          bool duringconnect,\r\n                          bool nonblocking)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  gnutls_session session = conn->ssl[sockindex].session;\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long timeout_ms;\r\n  int rc;\r\n  int what;\r\n\r\n  for(;;) {\r\n    /* check allowed time left */\r\n    timeout_ms = Curl_timeleft(data, NULL, duringconnect);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    /* if ssl is expecting something, check if it's available. */\r\n    if(connssl->connecting_state == ssl_connect_2_reading\r\n       || connssl->connecting_state == ssl_connect_2_writing) {\r\n\r\n      curl_socket_t writefd = ssl_connect_2_writing==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n      curl_socket_t readfd = ssl_connect_2_reading==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n\r\n      what = Curl_socket_ready(readfd, writefd,\r\n                               nonblocking?0:\r\n                               timeout_ms?timeout_ms:1000);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n      else if(0 == what) {\r\n        if(nonblocking)\r\n          return CURLE_OK;\r\n        else if(timeout_ms) {\r\n          /* timeout */\r\n          failf(data, \"SSL connection timeout at %ld\", timeout_ms);\r\n          return CURLE_OPERATION_TIMEDOUT;\r\n        }\r\n      }\r\n      /* socket is readable or writable */\r\n    }\r\n\r\n    rc = gnutls_handshake(session);\r\n\r\n    if((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)) {\r\n      connssl->connecting_state =\r\n        gnutls_record_get_direction(session)?\r\n        ssl_connect_2_writing:ssl_connect_2_reading;\r\n      continue;\r\n      if(nonblocking)\r\n        return CURLE_OK;\r\n    }\r\n    else if((rc < 0) && !gnutls_error_is_fatal(rc)) {\r\n      const char *strerr = NULL;\r\n\r\n      if(rc == GNUTLS_E_WARNING_ALERT_RECEIVED) {\r\n        int alert = gnutls_alert_get(session);\r\n        strerr = gnutls_alert_get_name(alert);\r\n      }\r\n\r\n      if(strerr == NULL)\r\n        strerr = gnutls_strerror(rc);\r\n\r\n      failf(data, \"gnutls_handshake() warning: %s\", strerr);\r\n    }\r\n    else if(rc < 0) {\r\n      const char *strerr = NULL;\r\n\r\n      if(rc == GNUTLS_E_FATAL_ALERT_RECEIVED) {\r\n        int alert = gnutls_alert_get(session);\r\n        strerr = gnutls_alert_get_name(alert);\r\n      }\r\n\r\n      if(strerr == NULL)\r\n        strerr = gnutls_strerror(rc);\r\n\r\n      failf(data, \"gnutls_handshake() failed: %s\", strerr);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n\r\n    /* Reset our connect state machine */\r\n    connssl->connecting_state = ssl_connect_1;\r\n    return CURLE_OK;\r\n  }\r\n}\r\n\r\nstatic gnutls_x509_crt_fmt do_file_type(const char *type)\r\n{\r\n  if(!type || !type[0])\r\n    return GNUTLS_X509_FMT_PEM;\r\n  if(Curl_raw_equal(type, \"PEM\"))\r\n    return GNUTLS_X509_FMT_PEM;\r\n  if(Curl_raw_equal(type, \"DER\"))\r\n    return GNUTLS_X509_FMT_DER;\r\n  return -1;\r\n}\r\n\r\nstatic CURLcode\r\ngtls_connect_step1(struct connectdata *conn,\r\n                   int sockindex)\r\n{\r\n#ifndef USE_GNUTLS_PRIORITY_SET_DIRECT\r\n  static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };\r\n#endif\r\n  struct SessionHandle *data = conn->data;\r\n  gnutls_session session;\r\n  int rc;\r\n  void *ssl_sessionid;\r\n  size_t ssl_idsize;\r\n  bool sni = TRUE; /* default is SNI enabled */\r\n#ifdef ENABLE_IPV6\r\n  struct in6_addr addr;\r\n#else\r\n  struct in_addr addr;\r\n#endif\r\n\r\n  if(conn->ssl[sockindex].state == ssl_connection_complete)\r\n    /* to make us tolerant against being called more than once for the\r\n       same connection */\r\n    return CURLE_OK;\r\n\r\n  if(!gtls_inited)\r\n    Curl_gtls_init();\r\n\r\n  /* GnuTLS only supports SSLv3 and TLSv1 */\r\n  if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) {\r\n    failf(data, \"GnuTLS does not support SSLv2\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n  else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3)\r\n    sni = FALSE; /* SSLv3 has no SNI */\r\n\r\n  /* allocate a cred struct */\r\n  rc = gnutls_certificate_allocate_credentials(&conn->ssl[sockindex].cred);\r\n  if(rc != GNUTLS_E_SUCCESS) {\r\n    failf(data, \"gnutls_cert_all_cred() failed: %s\", gnutls_strerror(rc));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n#ifdef USE_TLS_SRP\r\n  if(data->set.ssl.authtype == CURL_TLSAUTH_SRP) {\r\n    infof(data, \"Using TLS-SRP username: %s\\n\", data->set.ssl.username);\r\n\r\n    rc = gnutls_srp_allocate_client_credentials(\r\n           &conn->ssl[sockindex].srp_client_cred);\r\n    if(rc != GNUTLS_E_SUCCESS) {\r\n      failf(data, \"gnutls_srp_allocate_client_cred() failed: %s\",\r\n            gnutls_strerror(rc));\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    rc = gnutls_srp_set_client_credentials(conn->ssl[sockindex].\r\n                                           srp_client_cred,\r\n                                           data->set.ssl.username,\r\n                                           data->set.ssl.password);\r\n    if(rc != GNUTLS_E_SUCCESS) {\r\n      failf(data, \"gnutls_srp_set_client_cred() failed: %s\",\r\n            gnutls_strerror(rc));\r\n      return CURLE_BAD_FUNCTION_ARGUMENT;\r\n    }\r\n  }\r\n#endif\r\n\r\n  if(data->set.ssl.CAfile) {\r\n    /* set the trusted CA cert bundle file */\r\n    gnutls_certificate_set_verify_flags(conn->ssl[sockindex].cred,\r\n                                        GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);\r\n\r\n    rc = gnutls_certificate_set_x509_trust_file(conn->ssl[sockindex].cred,\r\n                                                data->set.ssl.CAfile,\r\n                                                GNUTLS_X509_FMT_PEM);\r\n    if(rc < 0) {\r\n      infof(data, \"error reading ca cert file %s (%s)\\n\",\r\n            data->set.ssl.CAfile, gnutls_strerror(rc));\r\n      if(data->set.ssl.verifypeer)\r\n        return CURLE_SSL_CACERT_BADFILE;\r\n    }\r\n    else\r\n      infof(data, \"found %d certificates in %s\\n\",\r\n            rc, data->set.ssl.CAfile);\r\n  }\r\n\r\n  if(data->set.ssl.CRLfile) {\r\n    /* set the CRL list file */\r\n    rc = gnutls_certificate_set_x509_crl_file(conn->ssl[sockindex].cred,\r\n                                              data->set.ssl.CRLfile,\r\n                                              GNUTLS_X509_FMT_PEM);\r\n    if(rc < 0) {\r\n      failf(data, \"error reading crl file %s (%s)\",\r\n            data->set.ssl.CRLfile, gnutls_strerror(rc));\r\n      return CURLE_SSL_CRL_BADFILE;\r\n    }\r\n    else\r\n      infof(data, \"found %d CRL in %s\\n\",\r\n            rc, data->set.ssl.CRLfile);\r\n  }\r\n\r\n  /* Initialize TLS session as a client */\r\n  rc = gnutls_init(&conn->ssl[sockindex].session, GNUTLS_CLIENT);\r\n  if(rc != GNUTLS_E_SUCCESS) {\r\n    failf(data, \"gnutls_init() failed: %d\", rc);\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  /* convenient assign */\r\n  session = conn->ssl[sockindex].session;\r\n\r\n  if((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) &&\r\n#ifdef ENABLE_IPV6\r\n     (0 == Curl_inet_pton(AF_INET6, conn->host.name, &addr)) &&\r\n#endif\r\n     sni &&\r\n     (gnutls_server_name_set(session, GNUTLS_NAME_DNS, conn->host.name,\r\n                             strlen(conn->host.name)) < 0))\r\n    infof(data, \"WARNING: failed to configure server name indication (SNI) \"\r\n          \"TLS extension\\n\");\r\n\r\n  /* Use default priorities */\r\n  rc = gnutls_set_default_priority(session);\r\n  if(rc != GNUTLS_E_SUCCESS)\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n\r\n  if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) {\r\n#ifndef USE_GNUTLS_PRIORITY_SET_DIRECT\r\n    static const int protocol_priority[] = { GNUTLS_SSL3, 0 };\r\n    rc = gnutls_protocol_set_priority(session, protocol_priority);\r\n#else\r\n    const char *err;\r\n    /* the combination of the cipher ARCFOUR with SSL 3.0 and TLS 1.0 is not\r\n       vulnerable to attacks such as the BEAST, why this code now explicitly\r\n       asks for that\r\n    */\r\n    rc = gnutls_priority_set_direct(session,\r\n                                    \"NORMAL:-VERS-TLS-ALL:+VERS-SSL3.0:\"\r\n                                    \"-CIPHER-ALL:+ARCFOUR-128\",\r\n                                    &err);\r\n#endif\r\n    if(rc != GNUTLS_E_SUCCESS)\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n#ifndef USE_GNUTLS_PRIORITY_SET_DIRECT\r\n  /* Sets the priority on the certificate types supported by gnutls. Priority\r\n     is higher for types specified before others. After specifying the types\r\n     you want, you must append a 0. */\r\n  rc = gnutls_certificate_type_set_priority(session, cert_type_priority);\r\n  if(rc != GNUTLS_E_SUCCESS)\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n#endif\r\n\r\n  if(data->set.str[STRING_CERT]) {\r\n    if(gnutls_certificate_set_x509_key_file(\r\n         conn->ssl[sockindex].cred,\r\n         data->set.str[STRING_CERT],\r\n         data->set.str[STRING_KEY] ?\r\n         data->set.str[STRING_KEY] : data->set.str[STRING_CERT],\r\n         do_file_type(data->set.str[STRING_CERT_TYPE]) ) !=\r\n       GNUTLS_E_SUCCESS) {\r\n      failf(data, \"error reading X.509 key or certificate file\");\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n  }\r\n\r\n#ifdef USE_TLS_SRP\r\n  /* put the credentials to the current session */\r\n  if(data->set.ssl.authtype == CURL_TLSAUTH_SRP) {\r\n    rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP,\r\n                                conn->ssl[sockindex].srp_client_cred);\r\n    if(rc != GNUTLS_E_SUCCESS)\r\n      failf(data, \"gnutls_credentials_set() failed: %s\", gnutls_strerror(rc));\r\n  }\r\n  else\r\n#endif\r\n    rc = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,\r\n                                conn->ssl[sockindex].cred);\r\n\r\n  /* set the connection handle (file descriptor for the socket) */\r\n  gnutls_transport_set_ptr(session,\r\n                           GNUTLS_INT_TO_POINTER_CAST(conn->sock[sockindex]));\r\n\r\n  /* register callback functions to send and receive data. */\r\n  gnutls_transport_set_push_function(session, Curl_gtls_push);\r\n  gnutls_transport_set_pull_function(session, Curl_gtls_pull);\r\n\r\n  /* lowat must be set to zero when using custom push and pull functions. */\r\n  gnutls_transport_set_lowat(session, 0);\r\n\r\n  /* This might be a reconnect, so we check for a session ID in the cache\r\n     to speed up things */\r\n\r\n  if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, &ssl_idsize)) {\r\n    /* we got a session id, use it! */\r\n    gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);\r\n\r\n    /* Informational message */\r\n    infof (data, \"SSL re-using session ID\\n\");\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic Curl_recv gtls_recv;\r\nstatic Curl_send gtls_send;\r\n\r\nstatic CURLcode\r\ngtls_connect_step3(struct connectdata *conn,\r\n                   int sockindex)\r\n{\r\n  unsigned int cert_list_size;\r\n  const gnutls_datum *chainp;\r\n  unsigned int verify_status;\r\n  gnutls_x509_crt x509_cert,x509_issuer;\r\n  gnutls_datum issuerp;\r\n  char certbuf[256]; /* big enough? */\r\n  size_t size;\r\n  unsigned int algo;\r\n  unsigned int bits;\r\n  time_t certclock;\r\n  const char *ptr;\r\n  struct SessionHandle *data = conn->data;\r\n  gnutls_session session = conn->ssl[sockindex].session;\r\n  int rc;\r\n  int incache;\r\n  void *ssl_sessionid;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  /* This function will return the peer's raw certificate (chain) as sent by\r\n     the peer. These certificates are in raw format (DER encoded for\r\n     X.509). In case of a X.509 then a certificate list may be present. The\r\n     first certificate in the list is the peer's certificate, following the\r\n     issuer's certificate, then the issuer's issuer etc. */\r\n\r\n  chainp = gnutls_certificate_get_peers(session, &cert_list_size);\r\n  if(!chainp) {\r\n    if(data->set.ssl.verifypeer ||\r\n       data->set.ssl.verifyhost ||\r\n       data->set.ssl.issuercert) {\r\n#ifdef USE_TLS_SRP\r\n      if(data->set.ssl.authtype == CURL_TLSAUTH_SRP\r\n         && data->set.ssl.username != NULL\r\n         && !data->set.ssl.verifypeer\r\n         && gnutls_cipher_get(session)) {\r\n        /* no peer cert, but auth is ok if we have SRP user and cipher and no\r\n           peer verify */\r\n      }\r\n      else {\r\n#endif\r\n        failf(data, \"failed to get server cert\");\r\n        return CURLE_PEER_FAILED_VERIFICATION;\r\n#ifdef USE_TLS_SRP\r\n      }\r\n#endif\r\n    }\r\n    infof(data, \"\\t common name: WARNING couldn't obtain\\n\");\r\n  }\r\n\r\n  if(data->set.ssl.verifypeer) {\r\n    /* This function will try to verify the peer's certificate and return its\r\n       status (trusted, invalid etc.). The value of status should be one or\r\n       more of the gnutls_certificate_status_t enumerated elements bitwise\r\n       or'd. To avoid denial of service attacks some default upper limits\r\n       regarding the certificate key size and chain size are set. To override\r\n       them use gnutls_certificate_set_verify_limits(). */\r\n\r\n    rc = gnutls_certificate_verify_peers2(session, &verify_status);\r\n    if(rc < 0) {\r\n      failf(data, \"server cert verify failed: %d\", rc);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n\r\n    /* verify_status is a bitmask of gnutls_certificate_status bits */\r\n    if(verify_status & GNUTLS_CERT_INVALID) {\r\n      if(data->set.ssl.verifypeer) {\r\n        failf(data, \"server certificate verification failed. CAfile: %s \"\r\n              \"CRLfile: %s\", data->set.ssl.CAfile?data->set.ssl.CAfile:\"none\",\r\n              data->set.ssl.CRLfile?data->set.ssl.CRLfile:\"none\");\r\n        return CURLE_SSL_CACERT;\r\n      }\r\n      else\r\n        infof(data, \"\\t server certificate verification FAILED\\n\");\r\n    }\r\n    else\r\n      infof(data, \"\\t server certificate verification OK\\n\");\r\n  }\r\n  else {\r\n    infof(data, \"\\t server certificate verification SKIPPED\\n\");\r\n    goto after_server_cert_verification;\r\n  }\r\n\r\n  /* initialize an X.509 certificate structure. */\r\n  gnutls_x509_crt_init(&x509_cert);\r\n\r\n  /* convert the given DER or PEM encoded Certificate to the native\r\n     gnutls_x509_crt_t format */\r\n  gnutls_x509_crt_import(x509_cert, chainp, GNUTLS_X509_FMT_DER);\r\n\r\n  if(data->set.ssl.issuercert) {\r\n    gnutls_x509_crt_init(&x509_issuer);\r\n    issuerp = load_file(data->set.ssl.issuercert);\r\n    gnutls_x509_crt_import(x509_issuer, &issuerp, GNUTLS_X509_FMT_PEM);\r\n    rc = gnutls_x509_crt_check_issuer(x509_cert,x509_issuer);\r\n    unload_file(issuerp);\r\n    if(rc <= 0) {\r\n      failf(data, \"server certificate issuer check failed (IssuerCert: %s)\",\r\n            data->set.ssl.issuercert?data->set.ssl.issuercert:\"none\");\r\n      return CURLE_SSL_ISSUER_ERROR;\r\n    }\r\n    infof(data,\"\\t server certificate issuer check OK (Issuer Cert: %s)\\n\",\r\n          data->set.ssl.issuercert?data->set.ssl.issuercert:\"none\");\r\n  }\r\n\r\n  size=sizeof(certbuf);\r\n  rc = gnutls_x509_crt_get_dn_by_oid(x509_cert, GNUTLS_OID_X520_COMMON_NAME,\r\n                                     0, /* the first and only one */\r\n                                     FALSE,\r\n                                     certbuf,\r\n                                     &size);\r\n  if(rc) {\r\n    infof(data, \"error fetching CN from cert:%s\\n\",\r\n          gnutls_strerror(rc));\r\n  }\r\n\r\n  /* This function will check if the given certificate's subject matches the\r\n     given hostname. This is a basic implementation of the matching described\r\n     in RFC2818 (HTTPS), which takes into account wildcards, and the subject\r\n     alternative name PKIX extension. Returns non zero on success, and zero on\r\n     failure. */\r\n  rc = gnutls_x509_crt_check_hostname(x509_cert, conn->host.name);\r\n\r\n  if(!rc) {\r\n    if(data->set.ssl.verifyhost) {\r\n      failf(data, \"SSL: certificate subject name (%s) does not match \"\r\n            \"target host name '%s'\", certbuf, conn->host.dispname);\r\n      gnutls_x509_crt_deinit(x509_cert);\r\n      return CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n    else\r\n      infof(data, \"\\t common name: %s (does not match '%s')\\n\",\r\n            certbuf, conn->host.dispname);\r\n  }\r\n  else\r\n    infof(data, \"\\t common name: %s (matched)\\n\", certbuf);\r\n\r\n  /* Check for time-based validity */\r\n  certclock = gnutls_x509_crt_get_expiration_time(x509_cert);\r\n\r\n  if(certclock == (time_t)-1) {\r\n    failf(data, \"server cert expiration date verify failed\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  if(certclock < time(NULL)) {\r\n    if(data->set.ssl.verifypeer) {\r\n      failf(data, \"server certificate expiration date has passed.\");\r\n      return CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n    else\r\n      infof(data, \"\\t server certificate expiration date FAILED\\n\");\r\n  }\r\n  else\r\n    infof(data, \"\\t server certificate expiration date OK\\n\");\r\n\r\n  certclock = gnutls_x509_crt_get_activation_time(x509_cert);\r\n\r\n  if(certclock == (time_t)-1) {\r\n    failf(data, \"server cert activation date verify failed\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  if(certclock > time(NULL)) {\r\n    if(data->set.ssl.verifypeer) {\r\n      failf(data, \"server certificate not activated yet.\");\r\n      return CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n    else\r\n      infof(data, \"\\t server certificate activation date FAILED\\n\");\r\n  }\r\n  else\r\n    infof(data, \"\\t server certificate activation date OK\\n\");\r\n\r\n  /* Show:\r\n\r\n  - ciphers used\r\n  - subject\r\n  - start date\r\n  - expire date\r\n  - common name\r\n  - issuer\r\n\r\n  */\r\n\r\n  /* public key algorithm's parameters */\r\n  algo = gnutls_x509_crt_get_pk_algorithm(x509_cert, &bits);\r\n  infof(data, \"\\t certificate public key: %s\\n\",\r\n        gnutls_pk_algorithm_get_name(algo));\r\n\r\n  /* version of the X.509 certificate. */\r\n  infof(data, \"\\t certificate version: #%d\\n\",\r\n        gnutls_x509_crt_get_version(x509_cert));\r\n\r\n\r\n  size = sizeof(certbuf);\r\n  gnutls_x509_crt_get_dn(x509_cert, certbuf, &size);\r\n  infof(data, \"\\t subject: %s\\n\", certbuf);\r\n\r\n  certclock = gnutls_x509_crt_get_activation_time(x509_cert);\r\n  showtime(data, \"start date\", certclock);\r\n\r\n  certclock = gnutls_x509_crt_get_expiration_time(x509_cert);\r\n  showtime(data, \"expire date\", certclock);\r\n\r\n  size = sizeof(certbuf);\r\n  gnutls_x509_crt_get_issuer_dn(x509_cert, certbuf, &size);\r\n  infof(data, \"\\t issuer: %s\\n\", certbuf);\r\n\r\n  gnutls_x509_crt_deinit(x509_cert);\r\n\r\nafter_server_cert_verification:\r\n\r\n  /* compression algorithm (if any) */\r\n  ptr = gnutls_compression_get_name(gnutls_compression_get(session));\r\n  /* the *_get_name() says \"NULL\" if GNUTLS_COMP_NULL is returned */\r\n  infof(data, \"\\t compression: %s\\n\", ptr);\r\n\r\n  /* the name of the cipher used. ie 3DES. */\r\n  ptr = gnutls_cipher_get_name(gnutls_cipher_get(session));\r\n  infof(data, \"\\t cipher: %s\\n\", ptr);\r\n\r\n  /* the MAC algorithms name. ie SHA1 */\r\n  ptr = gnutls_mac_get_name(gnutls_mac_get(session));\r\n  infof(data, \"\\t MAC: %s\\n\", ptr);\r\n\r\n  conn->ssl[sockindex].state = ssl_connection_complete;\r\n  conn->recv[sockindex] = gtls_recv;\r\n  conn->send[sockindex] = gtls_send;\r\n\r\n  {\r\n    /* we always unconditionally get the session id here, as even if we\r\n       already got it from the cache and asked to use it in the connection, it\r\n       might've been rejected and then a new one is in use now and we need to\r\n       detect that. */\r\n    void *connect_sessionid;\r\n    size_t connect_idsize;\r\n\r\n    /* get the session ID data size */\r\n    gnutls_session_get_data(session, NULL, &connect_idsize);\r\n    connect_sessionid = malloc(connect_idsize); /* get a buffer for it */\r\n\r\n    if(connect_sessionid) {\r\n      /* extract session ID to the allocated buffer */\r\n      gnutls_session_get_data(session, connect_sessionid, &connect_idsize);\r\n\r\n      incache = !(Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL));\r\n      if(incache) {\r\n        /* there was one before in the cache, so instead of risking that the\r\n           previous one was rejected, we just kill that and store the new */\r\n        Curl_ssl_delsessionid(conn, ssl_sessionid);\r\n      }\r\n\r\n      /* store this session id */\r\n      result = Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize);\r\n      if(result) {\r\n        free(connect_sessionid);\r\n        result = CURLE_OUT_OF_MEMORY;\r\n      }\r\n    }\r\n    else\r\n      result = CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n\r\n/*\r\n * This function is called after the TCP connect has completed. Setup the TLS\r\n * layer and do all necessary magic.\r\n */\r\n/* We use connssl->connecting_state to keep track of the connection status;\r\n   there are three states: 'ssl_connect_1' (not started yet or complete),\r\n   'ssl_connect_2_reading' (waiting for data from server), and\r\n   'ssl_connect_2_writing' (waiting to be able to write).\r\n */\r\nstatic CURLcode\r\ngtls_connect_common(struct connectdata *conn,\r\n                    int sockindex,\r\n                    bool nonblocking,\r\n                    bool *done)\r\n{\r\n  int rc;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  /* Initiate the connection, if not already done */\r\n  if(ssl_connect_1==connssl->connecting_state) {\r\n    rc = gtls_connect_step1 (conn, sockindex);\r\n    if(rc)\r\n      return rc;\r\n  }\r\n\r\n  rc = handshake(conn, sockindex, TRUE, nonblocking);\r\n  if(rc)\r\n    /* handshake() sets its own error message with failf() */\r\n    return rc;\r\n\r\n  /* Finish connecting once the handshake is done */\r\n  if(ssl_connect_1==connssl->connecting_state) {\r\n    rc = gtls_connect_step3(conn, sockindex);\r\n    if(rc)\r\n      return rc;\r\n  }\r\n\r\n  *done = ssl_connect_1==connssl->connecting_state;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode\r\nCurl_gtls_connect_nonblocking(struct connectdata *conn,\r\n                              int sockindex,\r\n                              bool *done)\r\n{\r\n  return gtls_connect_common(conn, sockindex, TRUE, done);\r\n}\r\n\r\nCURLcode\r\nCurl_gtls_connect(struct connectdata *conn,\r\n                  int sockindex)\r\n\r\n{\r\n  CURLcode retcode;\r\n  bool done = FALSE;\r\n\r\n  retcode = gtls_connect_common(conn, sockindex, FALSE, &done);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  DEBUGASSERT(done);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic ssize_t gtls_send(struct connectdata *conn,\r\n                         int sockindex,\r\n                         const void *mem,\r\n                         size_t len,\r\n                         CURLcode *curlcode)\r\n{\r\n  ssize_t rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len);\r\n\r\n  if(rc < 0 ) {\r\n    *curlcode = (rc == GNUTLS_E_AGAIN)\r\n      ? CURLE_AGAIN\r\n      : CURLE_SEND_ERROR;\r\n\r\n    rc = -1;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\nvoid Curl_gtls_close_all(struct SessionHandle *data)\r\n{\r\n  /* FIX: make the OpenSSL code more generic and use parts of it here */\r\n  (void)data;\r\n}\r\n\r\nstatic void close_one(struct connectdata *conn,\r\n                      int idx)\r\n{\r\n  if(conn->ssl[idx].session) {\r\n    gnutls_bye(conn->ssl[idx].session, GNUTLS_SHUT_RDWR);\r\n    gnutls_deinit(conn->ssl[idx].session);\r\n    conn->ssl[idx].session = NULL;\r\n  }\r\n  if(conn->ssl[idx].cred) {\r\n    gnutls_certificate_free_credentials(conn->ssl[idx].cred);\r\n    conn->ssl[idx].cred = NULL;\r\n  }\r\n#ifdef USE_TLS_SRP\r\n  if(conn->ssl[idx].srp_client_cred) {\r\n    gnutls_srp_free_client_credentials(conn->ssl[idx].srp_client_cred);\r\n    conn->ssl[idx].srp_client_cred = NULL;\r\n  }\r\n#endif\r\n}\r\n\r\nvoid Curl_gtls_close(struct connectdata *conn, int sockindex)\r\n{\r\n  close_one(conn, sockindex);\r\n}\r\n\r\n/*\r\n * This function is called to shut down the SSL layer but keep the\r\n * socket open (CCC - Clear Command Channel)\r\n */\r\nint Curl_gtls_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  ssize_t result;\r\n  int retval = 0;\r\n  struct SessionHandle *data = conn->data;\r\n  int done = 0;\r\n  char buf[120];\r\n\r\n  /* This has only been tested on the proftpd server, and the mod_tls code\r\n     sends a close notify alert without waiting for a close notify alert in\r\n     response. Thus we wait for a close notify alert from the server, but\r\n     we do not send one. Let's hope other servers do the same... */\r\n\r\n  if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE)\r\n      gnutls_bye(conn->ssl[sockindex].session, GNUTLS_SHUT_WR);\r\n\r\n  if(conn->ssl[sockindex].session) {\r\n    while(!done) {\r\n      int what = Curl_socket_ready(conn->sock[sockindex],\r\n                                   CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);\r\n      if(what > 0) {\r\n        /* Something to read, let's do it and hope that it is the close\r\n           notify alert from the server */\r\n        result = gnutls_record_recv(conn->ssl[sockindex].session,\r\n                                    buf, sizeof(buf));\r\n        switch(result) {\r\n        case 0:\r\n          /* This is the expected response. There was no data but only\r\n             the close notify alert */\r\n          done = 1;\r\n          break;\r\n        case GNUTLS_E_AGAIN:\r\n        case GNUTLS_E_INTERRUPTED:\r\n          infof(data, \"GNUTLS_E_AGAIN || GNUTLS_E_INTERRUPTED\\n\");\r\n          break;\r\n        default:\r\n          retval = -1;\r\n          done = 1;\r\n          break;\r\n        }\r\n      }\r\n      else if(0 == what) {\r\n        /* timeout */\r\n        failf(data, \"SSL shutdown timeout\");\r\n        done = 1;\r\n        break;\r\n      }\r\n      else {\r\n        /* anything that gets here is fatally bad */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        retval = -1;\r\n        done = 1;\r\n      }\r\n    }\r\n    gnutls_deinit(conn->ssl[sockindex].session);\r\n  }\r\n  gnutls_certificate_free_credentials(conn->ssl[sockindex].cred);\r\n\r\n#ifdef USE_TLS_SRP\r\n  if(data->set.ssl.authtype == CURL_TLSAUTH_SRP\r\n     && data->set.ssl.username != NULL)\r\n    gnutls_srp_free_client_credentials(conn->ssl[sockindex].srp_client_cred);\r\n#endif\r\n\r\n  conn->ssl[sockindex].cred = NULL;\r\n  conn->ssl[sockindex].session = NULL;\r\n\r\n  return retval;\r\n}\r\n\r\nstatic ssize_t gtls_recv(struct connectdata *conn, /* connection data */\r\n                         int num,                  /* socketindex */\r\n                         char *buf,                /* store read data here */\r\n                         size_t buffersize,        /* max amount to read */\r\n                         CURLcode *curlcode)\r\n{\r\n  ssize_t ret;\r\n\r\n  ret = gnutls_record_recv(conn->ssl[num].session, buf, buffersize);\r\n  if((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)) {\r\n    *curlcode = CURLE_AGAIN;\r\n    return -1;\r\n  }\r\n\r\n  if(ret == GNUTLS_E_REHANDSHAKE) {\r\n    /* BLOCKING call, this is bad but a work-around for now. Fixing this \"the\r\n       proper way\" takes a whole lot of work. */\r\n    CURLcode rc = handshake(conn, num, FALSE, FALSE);\r\n    if(rc)\r\n      /* handshake() writes error message on its own */\r\n      *curlcode = rc;\r\n    else\r\n      *curlcode = CURLE_AGAIN; /* then return as if this was a wouldblock */\r\n    return -1;\r\n  }\r\n\r\n  if(ret < 0) {\r\n    failf(conn->data, \"GnuTLS recv error (%d): %s\",\r\n          (int)ret, gnutls_strerror((int)ret));\r\n    *curlcode = CURLE_RECV_ERROR;\r\n    return -1;\r\n  }\r\n\r\n  return ret;\r\n}\r\n\r\nvoid Curl_gtls_session_free(void *ptr)\r\n{\r\n  free(ptr);\r\n}\r\n\r\nsize_t Curl_gtls_version(char *buffer, size_t size)\r\n{\r\n  return snprintf(buffer, size, \"GnuTLS/%s\", gnutls_check_version(NULL));\r\n}\r\n\r\nint Curl_gtls_seed(struct SessionHandle *data)\r\n{\r\n  /* we have the \"SSL is seeded\" boolean static to prevent multiple\r\n     time-consuming seedings in vain */\r\n  static bool ssl_seeded = FALSE;\r\n\r\n  /* Quickly add a bit of entropy */\r\n#ifndef USE_GNUTLS_NETTLE\r\n  gcry_fast_random_poll();\r\n#endif\r\n\r\n  if(!ssl_seeded || data->set.str[STRING_SSL_RANDOM_FILE] ||\r\n     data->set.str[STRING_SSL_EGDSOCKET]) {\r\n\r\n    /* TODO: to a good job seeding the RNG\r\n       This may involve the gcry_control function and these options:\r\n       GCRYCTL_SET_RANDOM_SEED_FILE\r\n       GCRYCTL_SET_RNDEGD_SOCKET\r\n    */\r\n    ssl_seeded = TRUE;\r\n  }\r\n  return 0;\r\n}\r\n\r\nvoid Curl_gtls_random(struct SessionHandle *data,\r\n                      unsigned char *entropy,\r\n                      size_t length)\r\n{\r\n#if defined(USE_GNUTLS_NETTLE)\r\n  (void)data;\r\n  gnutls_rnd(GNUTLS_RND_RANDOM, entropy, length);\r\n#elif defined(USE_GNUTLS)\r\n  Curl_gtls_seed(data); /* Initiate the seed if not already done */\r\n  gcry_randomize(entropy, length, GCRY_STRONG_RANDOM);\r\n#endif\r\n}\r\n\r\nvoid Curl_gtls_md5sum(unsigned char *tmp, /* input */\r\n                      size_t tmplen,\r\n                      unsigned char *md5sum, /* output */\r\n                      size_t md5len)\r\n{\r\n#if defined(USE_GNUTLS_NETTLE)\r\n  struct md5_ctx MD5pw;\r\n  md5_init(&MD5pw);\r\n  md5_update(&MD5pw, tmplen, tmp);\r\n  md5_digest(&MD5pw, md5len, md5sum);\r\n#elif defined(USE_GNUTLS)\r\n  gcry_md_hd_t MD5pw;\r\n  gcry_md_open(&MD5pw, GCRY_MD_MD5, 0);\r\n  gcry_md_write(MD5pw, tmp, tmplen);\r\n  memcpy(md5sum, gcry_md_read (MD5pw, 0), md5len);\r\n  gcry_md_close(MD5pw);\r\n#endif\r\n}\r\n\r\n#endif /* USE_GNUTLS */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/gtls.h",
    "content": "#ifndef HEADER_CURL_GTLS_H\r\n#define HEADER_CURL_GTLS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_GNUTLS\r\n\r\n#include \"urldata.h\"\r\n\r\nint Curl_gtls_init(void);\r\nint Curl_gtls_cleanup(void);\r\nCURLcode Curl_gtls_connect(struct connectdata *conn, int sockindex);\r\nCURLcode Curl_gtls_connect_nonblocking(struct connectdata *conn,\r\n                                       int sockindex,\r\n                                       bool *done);\r\n\r\n/* tell GnuTLS to close down all open information regarding connections (and\r\n   thus session ID caching etc) */\r\nvoid Curl_gtls_close_all(struct SessionHandle *data);\r\n\r\n /* close a SSL connection */\r\nvoid Curl_gtls_close(struct connectdata *conn, int sockindex);\r\n\r\nvoid Curl_gtls_session_free(void *ptr);\r\nsize_t Curl_gtls_version(char *buffer, size_t size);\r\nint Curl_gtls_shutdown(struct connectdata *conn, int sockindex);\r\nint Curl_gtls_seed(struct SessionHandle *data);\r\n\r\nvoid Curl_gtls_random(struct SessionHandle *data,\r\n                      unsigned char *entropy,\r\n                      size_t length);\r\nvoid Curl_gtls_md5sum(unsigned char *tmp, /* input */\r\n                      size_t tmplen,\r\n                      unsigned char *md5sum, /* output */\r\n                      size_t md5len);\r\n\r\n/* API setup for GnuTLS */\r\n#define curlssl_init Curl_gtls_init\r\n#define curlssl_cleanup Curl_gtls_cleanup\r\n#define curlssl_connect Curl_gtls_connect\r\n#define curlssl_connect_nonblocking Curl_gtls_connect_nonblocking\r\n#define curlssl_session_free(x)  Curl_gtls_session_free(x)\r\n#define curlssl_close_all Curl_gtls_close_all\r\n#define curlssl_close Curl_gtls_close\r\n#define curlssl_shutdown(x,y) Curl_gtls_shutdown(x,y)\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_gtls_version\r\n#define curlssl_check_cxn(x) (x=x, -1)\r\n#define curlssl_data_pending(x,y) (x=x, y=y, 0)\r\n#define curlssl_random(x,y,z) Curl_gtls_random(x,y,z)\r\n#define curlssl_md5sum(a,b,c,d) Curl_gtls_md5sum(a,b,c,d)\r\n\r\n#endif /* USE_GNUTLS */\r\n#endif /* HEADER_CURL_GTLS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hash.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"hash.h\"\r\n#include \"llist.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic void\r\nhash_element_dtor(void *user, void *element)\r\n{\r\n  struct curl_hash *h = (struct curl_hash *) user;\r\n  struct curl_hash_element *e = (struct curl_hash_element *) element;\r\n\r\n  Curl_safefree(e->key);\r\n\r\n  if(e->ptr) {\r\n    h->dtor(e->ptr);\r\n    e->ptr = NULL;\r\n  }\r\n\r\n  e->key_len = 0;\r\n\r\n  free(e);\r\n}\r\n\r\n/* return 1 on error, 0 is fine */\r\nint\r\nCurl_hash_init(struct curl_hash *h,\r\n               int slots,\r\n               hash_function hfunc,\r\n               comp_function comparator,\r\n               curl_hash_dtor dtor)\r\n{\r\n  int i;\r\n\r\n  if(!slots || !hfunc || !comparator ||!dtor) {\r\n    return 1; /* failure */\r\n  }\r\n\r\n  h->hash_func = hfunc;\r\n  h->comp_func = comparator;\r\n  h->dtor = dtor;\r\n  h->size = 0;\r\n  h->slots = slots;\r\n\r\n  h->table = malloc(slots * sizeof(struct curl_llist *));\r\n  if(h->table) {\r\n    for(i = 0; i < slots; ++i) {\r\n      h->table[i] = Curl_llist_alloc((curl_llist_dtor) hash_element_dtor);\r\n      if(!h->table[i]) {\r\n        while(i--) {\r\n          Curl_llist_destroy(h->table[i], NULL);\r\n          h->table[i] = NULL;\r\n        }\r\n        free(h->table);\r\n        h->table = NULL;\r\n        h->slots = 0;\r\n        return 1; /* failure */\r\n      }\r\n    }\r\n    return 0; /* fine */\r\n  }\r\n  else {\r\n    h->slots = 0;\r\n    return 1; /* failure */\r\n  }\r\n}\r\n\r\nstruct curl_hash *\r\nCurl_hash_alloc(int slots,\r\n                hash_function hfunc,\r\n                comp_function comparator,\r\n                curl_hash_dtor dtor)\r\n{\r\n  struct curl_hash *h;\r\n\r\n  if(!slots || !hfunc || !comparator ||!dtor) {\r\n    return NULL; /* failure */\r\n  }\r\n\r\n  h = malloc(sizeof(struct curl_hash));\r\n  if(h) {\r\n    if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) {\r\n      /* failure */\r\n      free(h);\r\n      h = NULL;\r\n    }\r\n  }\r\n\r\n  return h;\r\n}\r\n\r\n\r\n\r\nstatic struct curl_hash_element *\r\nmk_hash_element(const void *key, size_t key_len, const void *p)\r\n{\r\n  struct curl_hash_element *he = malloc(sizeof(struct curl_hash_element));\r\n\r\n  if(he) {\r\n    void *dupkey = malloc(key_len);\r\n    if(dupkey) {\r\n      /* copy the key */\r\n      memcpy(dupkey, key, key_len);\r\n\r\n      he->key = dupkey;\r\n      he->key_len = key_len;\r\n      he->ptr = (void *) p;\r\n    }\r\n    else {\r\n      /* failed to duplicate the key, free memory and fail */\r\n      free(he);\r\n      he = NULL;\r\n    }\r\n  }\r\n  return he;\r\n}\r\n\r\n#define FETCH_LIST(x,y,z) x->table[x->hash_func(y, z, x->slots)]\r\n\r\n/* Insert the data in the hash. If there already was a match in the hash,\r\n * that data is replaced.\r\n *\r\n * @unittest: 1305\r\n */\r\nvoid *\r\nCurl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)\r\n{\r\n  struct curl_hash_element  *he;\r\n  struct curl_llist_element *le;\r\n  struct curl_llist *l = FETCH_LIST (h, key, key_len);\r\n\r\n  for(le = l->head; le; le = le->next) {\r\n    he = (struct curl_hash_element *) le->ptr;\r\n    if(h->comp_func(he->key, he->key_len, key, key_len)) {\r\n      Curl_llist_remove(l, le, (void *)h);\r\n      --h->size;\r\n      break;\r\n    }\r\n  }\r\n\r\n  he = mk_hash_element(key, key_len, p);\r\n  if(he) {\r\n    if(Curl_llist_insert_next(l, l->tail, he)) {\r\n      ++h->size;\r\n      return p; /* return the new entry */\r\n    }\r\n    /*\r\n     * Couldn't insert it, destroy the 'he' element and the key again. We\r\n     * don't call hash_element_dtor() since that would also call the\r\n     * \"destructor\" for the actual data 'p'. When we fail, we shall not touch\r\n     * that data.\r\n     */\r\n    free(he->key);\r\n    free(he);\r\n  }\r\n\r\n  return NULL; /* failure */\r\n}\r\n\r\n/* remove the identified hash entry, returns non-zero on failure */\r\nint Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len)\r\n{\r\n  struct curl_llist_element *le;\r\n  struct curl_hash_element  *he;\r\n  struct curl_llist *l = FETCH_LIST(h, key, key_len);\r\n\r\n  for(le = l->head; le; le = le->next) {\r\n    he = le->ptr;\r\n    if(h->comp_func(he->key, he->key_len, key, key_len)) {\r\n      Curl_llist_remove(l, le, (void *) h);\r\n      --h->size;\r\n      return 0;\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n\r\nvoid *\r\nCurl_hash_pick(struct curl_hash *h, void *key, size_t key_len)\r\n{\r\n  struct curl_llist_element *le;\r\n  struct curl_hash_element  *he;\r\n  struct curl_llist *l;\r\n\r\n  if(h) {\r\n    l = FETCH_LIST(h, key, key_len);\r\n    for(le = l->head; le; le = le->next) {\r\n      he = le->ptr;\r\n      if(h->comp_func(he->key, he->key_len, key, key_len)) {\r\n        return he->ptr;\r\n      }\r\n    }\r\n  }\r\n\r\n  return NULL;\r\n}\r\n\r\n#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST)\r\nvoid\r\nCurl_hash_apply(curl_hash *h, void *user,\r\n                void (*cb)(void *user, void *ptr))\r\n{\r\n  struct curl_llist_element  *le;\r\n  int                  i;\r\n\r\n  for(i = 0; i < h->slots; ++i) {\r\n    for(le = (h->table[i])->head;\r\n        le;\r\n        le = le->next) {\r\n      curl_hash_element *el = le->ptr;\r\n      cb(user, el->ptr);\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\nvoid\r\nCurl_hash_clean(struct curl_hash *h)\r\n{\r\n  int i;\r\n\r\n  for(i = 0; i < h->slots; ++i) {\r\n    Curl_llist_destroy(h->table[i], (void *) h);\r\n    h->table[i] = NULL;\r\n  }\r\n\r\n  Curl_safefree(h->table);\r\n  h->size = 0;\r\n  h->slots = 0;\r\n}\r\n\r\nvoid\r\nCurl_hash_clean_with_criterium(struct curl_hash *h, void *user,\r\n                               int (*comp)(void *, void *))\r\n{\r\n  struct curl_llist_element *le;\r\n  struct curl_llist_element *lnext;\r\n  struct curl_llist *list;\r\n  int i;\r\n\r\n  if(!h)\r\n    return;\r\n\r\n  for(i = 0; i < h->slots; ++i) {\r\n    list = h->table[i];\r\n    le = list->head; /* get first list entry */\r\n    while(le) {\r\n      struct curl_hash_element *he = le->ptr;\r\n      lnext = le->next;\r\n      /* ask the callback function if we shall remove this entry or not */\r\n      if(comp(user, he->ptr)) {\r\n        Curl_llist_remove(list, le, (void *) h);\r\n        --h->size; /* one less entry in the hash now */\r\n      }\r\n      le = lnext;\r\n    }\r\n  }\r\n}\r\n\r\nvoid\r\nCurl_hash_destroy(struct curl_hash *h)\r\n{\r\n  if(!h)\r\n    return;\r\n\r\n  Curl_hash_clean(h);\r\n\r\n  free(h);\r\n}\r\n\r\nsize_t Curl_hash_str(void* key, size_t key_length, size_t slots_num)\r\n{\r\n  const char* key_str = (const char *) key;\r\n  const char *end = key_str + key_length;\r\n  unsigned long h = 5381;\r\n\r\n  while(key_str < end) {\r\n    h += h << 5;\r\n    h ^= (unsigned long) *key_str++;\r\n  }\r\n\r\n  return (h % slots_num);\r\n}\r\n\r\nsize_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len)\r\n{\r\n  char *key1 = (char *)k1;\r\n  char *key2 = (char *)k2;\r\n\r\n  if(key1_len == key2_len &&\r\n      *key1 == *key2 &&\r\n      memcmp(key1, key2, key1_len) == 0) {\r\n    return 1;\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\nvoid Curl_hash_start_iterate(struct curl_hash *hash,\r\n                             struct curl_hash_iterator *iter)\r\n{\r\n  iter->hash = hash;\r\n  iter->slot_index = 0;\r\n  iter->current_element = NULL;\r\n}\r\n\r\nstruct curl_hash_element *\r\nCurl_hash_next_element(struct curl_hash_iterator *iter)\r\n{\r\n  int i;\r\n  struct curl_hash *h = iter->hash;\r\n\r\n  /* Get the next element in the current list, if any */\r\n  if(iter->current_element)\r\n    iter->current_element = iter->current_element->next;\r\n\r\n  /* If we have reached the end of the list, find the next one */\r\n  if(!iter->current_element) {\r\n    for(i = iter->slot_index;i < h->slots;i++) {\r\n      if(h->table[i]->head) {\r\n        iter->current_element = h->table[i]->head;\r\n        iter->slot_index = i+1;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n  if(iter->current_element) {\r\n    struct curl_hash_element *he = iter->current_element->ptr;\r\n    return he;\r\n  }\r\n  else {\r\n    iter->current_element = NULL;\r\n    return NULL;\r\n  }\r\n}\r\n\r\n#if 0 /* useful function for debugging hashes and their contents */\r\nvoid Curl_hash_print(struct curl_hash *h,\r\n                     void (*func)(void *))\r\n{\r\n  struct curl_hash_iterator iter;\r\n  struct curl_hash_element *he;\r\n  int last_index = -1;\r\n\r\n  if(!h)\r\n    return;\r\n\r\n  fprintf(stderr, \"=Hash dump=\\n\");\r\n\r\n  Curl_hash_start_iterate(h, &iter);\r\n\r\n  he = Curl_hash_next_element(&iter);\r\n  while(he) {\r\n    if(iter.slot_index != last_index) {\r\n      fprintf(stderr, \"index %d:\", iter.slot_index);\r\n      if(last_index >= 0) {\r\n        fprintf(stderr, \"\\n\");\r\n      }\r\n      last_index = iter.slot_index;\r\n    }\r\n\r\n    if(func)\r\n      func(he->ptr);\r\n    else\r\n      fprintf(stderr, \" [%p]\", he->ptr);\r\n\r\n    he = Curl_hash_next_element(&iter);\r\n  }\r\n  fprintf(stderr, \"\\n\");\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hash.h",
    "content": "#ifndef HEADER_CURL_HASH_H\r\n#define HEADER_CURL_HASH_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <stddef.h>\r\n\r\n#include \"llist.h\"\r\n\r\n/* Hash function prototype */\r\ntypedef size_t (*hash_function) (void* key,\r\n                                 size_t key_length,\r\n                                 size_t slots_num);\r\n\r\n/*\r\n   Comparator function prototype. Compares two keys.\r\n*/\r\ntypedef size_t (*comp_function) (void* key1,\r\n                                 size_t key1_len,\r\n                                 void*key2,\r\n                                 size_t key2_len);\r\n\r\ntypedef void (*curl_hash_dtor)(void *);\r\n\r\nstruct curl_hash {\r\n  struct curl_llist **table;\r\n\r\n  /* Hash function to be used for this hash table */\r\n  hash_function hash_func;\r\n\r\n  /* Comparator function to compare keys */\r\n  comp_function comp_func;\r\n  curl_hash_dtor   dtor;\r\n  int slots;\r\n  size_t size;\r\n};\r\n\r\nstruct curl_hash_element {\r\n  void   *ptr;\r\n  char   *key;\r\n  size_t key_len;\r\n};\r\n\r\nstruct curl_hash_iterator {\r\n  struct curl_hash *hash;\r\n  int slot_index;\r\n  struct curl_llist_element *current_element;\r\n};\r\n\r\nint Curl_hash_init(struct curl_hash *h,\r\n                   int slots,\r\n                   hash_function hfunc,\r\n                   comp_function comparator,\r\n                   curl_hash_dtor dtor);\r\n\r\nstruct curl_hash *Curl_hash_alloc(int slots,\r\n                                  hash_function hfunc,\r\n                                  comp_function comparator,\r\n                                  curl_hash_dtor dtor);\r\n\r\nvoid *Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p);\r\nint Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len);\r\nvoid *Curl_hash_pick(struct curl_hash *, void * key, size_t key_len);\r\nvoid Curl_hash_apply(struct curl_hash *h, void *user,\r\n                     void (*cb)(void *user, void *ptr));\r\nint Curl_hash_count(struct curl_hash *h);\r\nvoid Curl_hash_clean(struct curl_hash *h);\r\nvoid Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,\r\n                                    int (*comp)(void *, void *));\r\nvoid Curl_hash_destroy(struct curl_hash *h);\r\n\r\nsize_t Curl_hash_str(void* key, size_t key_length, size_t slots_num);\r\nsize_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2,\r\n                            size_t key2_len);\r\n\r\nvoid Curl_hash_start_iterate(struct curl_hash *hash,\r\n                             struct curl_hash_iterator *iter);\r\nstruct curl_hash_element *\r\nCurl_hash_next_element(struct curl_hash_iterator *iter);\r\n\r\nvoid Curl_hash_print(struct curl_hash *h,\r\n                     void (*func)(void *));\r\n\r\n\r\n#endif /* HEADER_CURL_HASH_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hmac.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n * RFC2104 Keyed-Hashing for Message Authentication\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n\r\n#include \"curl_hmac.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Generic HMAC algorithm.\r\n *\r\n *   This module computes HMAC digests based on any hash function. Parameters\r\n * and computing procedures are set-up dynamically at HMAC computation\r\n * context initialisation.\r\n */\r\n\r\nstatic const unsigned char hmac_ipad = 0x36;\r\nstatic const unsigned char hmac_opad = 0x5C;\r\n\r\n\r\n\r\nHMAC_context *\r\nCurl_HMAC_init(const HMAC_params * hashparams,\r\n               const unsigned char * key,\r\n               unsigned int keylen)\r\n{\r\n  size_t i;\r\n  HMAC_context * ctxt;\r\n  unsigned char * hkey;\r\n  unsigned char b;\r\n\r\n  /* Create HMAC context. */\r\n  i = sizeof *ctxt + 2 * hashparams->hmac_ctxtsize +\r\n    hashparams->hmac_resultlen;\r\n  ctxt = malloc(i);\r\n\r\n  if(!ctxt)\r\n    return ctxt;\r\n\r\n  ctxt->hmac_hash = hashparams;\r\n  ctxt->hmac_hashctxt1 = (void *) (ctxt + 1);\r\n  ctxt->hmac_hashctxt2 = (void *) ((char *) ctxt->hmac_hashctxt1 +\r\n      hashparams->hmac_ctxtsize);\r\n\r\n  /* If the key is too long, replace it by its hash digest. */\r\n  if(keylen > hashparams->hmac_maxkeylen) {\r\n    (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt1);\r\n    (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, key, keylen);\r\n    hkey = (unsigned char *) ctxt->hmac_hashctxt2 + hashparams->hmac_ctxtsize;\r\n    (*hashparams->hmac_hfinal)(hkey, ctxt->hmac_hashctxt1);\r\n    key = hkey;\r\n    keylen = hashparams->hmac_resultlen;\r\n  }\r\n\r\n  /* Prime the two hash contexts with the modified key. */\r\n  (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt1);\r\n  (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt2);\r\n\r\n  for(i = 0; i < keylen; i++) {\r\n    b = (unsigned char)(*key ^ hmac_ipad);\r\n    (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &b, 1);\r\n    b = (unsigned char)(*key++ ^ hmac_opad);\r\n    (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &b, 1);\r\n  }\r\n\r\n  for(; i < hashparams->hmac_maxkeylen; i++) {\r\n    (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &hmac_ipad, 1);\r\n    (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &hmac_opad, 1);\r\n  }\r\n\r\n  /* Done, return pointer to HMAC context. */\r\n  return ctxt;\r\n}\r\n\r\nint Curl_HMAC_update(HMAC_context * ctxt,\r\n                     const unsigned char * data,\r\n                     unsigned int len)\r\n{\r\n  /* Update first hash calculation. */\r\n  (*ctxt->hmac_hash->hmac_hupdate)(ctxt->hmac_hashctxt1, data, len);\r\n  return 0;\r\n}\r\n\r\n\r\nint Curl_HMAC_final(HMAC_context * ctxt, unsigned char * result)\r\n{\r\n  const HMAC_params * hashparams = ctxt->hmac_hash;\r\n\r\n  /* Do not get result if called with a null parameter: only release\r\n     storage. */\r\n\r\n  if(!result)\r\n    result = (unsigned char *) ctxt->hmac_hashctxt2 +\r\n     ctxt->hmac_hash->hmac_ctxtsize;\r\n\r\n  (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt1);\r\n  (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2,\r\n   result, hashparams->hmac_resultlen);\r\n  (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt2);\r\n  free((char *) ctxt);\r\n  return 0;\r\n}\r\n\r\n#endif /* CURL_DISABLE_CRYPTO_AUTH */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostasyn.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifdef HAVE_PROCESS_H\r\n#include <process.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/***********************************************************************\r\n * Only for builds using asynchronous name resolves\r\n **********************************************************************/\r\n#ifdef CURLRES_ASYNCH\r\n\r\n/*\r\n * Curl_addrinfo_callback() gets called by ares, gethostbyname_thread()\r\n * or getaddrinfo_thread() when we got the name resolved (or not!).\r\n *\r\n * If the status argument is CURL_ASYNC_SUCCESS, this function takes\r\n * ownership of the Curl_addrinfo passed, storing the resolved data\r\n * in the DNS cache.\r\n *\r\n * The storage operation locks and unlocks the DNS cache.\r\n */\r\nCURLcode Curl_addrinfo_callback(struct connectdata *conn,\r\n                                int status,\r\n                                struct Curl_addrinfo *ai)\r\n{\r\n  struct Curl_dns_entry *dns = NULL;\r\n  CURLcode rc = CURLE_OK;\r\n\r\n  conn->async.status = status;\r\n\r\n  if(CURL_ASYNC_SUCCESS == status) {\r\n    if(ai) {\r\n      struct SessionHandle *data = conn->data;\r\n\r\n      if(data->share)\r\n        Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n      dns = Curl_cache_addr(data, ai,\r\n                            conn->async.hostname,\r\n                            conn->async.port);\r\n      if(!dns) {\r\n        /* failed to store, cleanup and return error */\r\n        Curl_freeaddrinfo(ai);\r\n        rc = CURLE_OUT_OF_MEMORY;\r\n      }\r\n\r\n      if(data->share)\r\n        Curl_share_unlock(data, CURL_LOCK_DATA_DNS);\r\n    }\r\n    else {\r\n      rc = CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  conn->async.dns = dns;\r\n\r\n /* Set async.done TRUE last in this function since it may be used multi-\r\n    threaded and once this is TRUE the other thread may read fields from the\r\n    async struct */\r\n  conn->async.done = TRUE;\r\n\r\n  /* ipv4: The input hostent struct will be freed by ares when we return from\r\n     this function */\r\n  return rc;\r\n}\r\n\r\n/* Call this function after Curl_connect() has returned async=TRUE and\r\n   then a successful name resolve has been received.\r\n\r\n   Note: this function disconnects and frees the conn data in case of\r\n   resolve failure */\r\nCURLcode Curl_async_resolved(struct connectdata *conn,\r\n                             bool *protocol_done)\r\n{\r\n  CURLcode code;\r\n\r\n  if(conn->async.dns) {\r\n    conn->dns_entry = conn->async.dns;\r\n    conn->async.dns = NULL;\r\n  }\r\n\r\n  code = Curl_setup_conn(conn, protocol_done);\r\n\r\n  if(code)\r\n    /* We're not allowed to return failure with memory left allocated\r\n       in the connectdata struct, free those here */\r\n    Curl_disconnect(conn, FALSE); /* close the connection */\r\n\r\n  return code;\r\n}\r\n\r\n/*\r\n * Curl_getaddrinfo() is the generic low-level name resolve API within this\r\n * source file. There are several versions of this function - for different\r\n * name resolve layers (selected at build-time). They all take this same set\r\n * of arguments\r\n */\r\nCurl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,\r\n                                const char *hostname,\r\n                                int port,\r\n                                int *waitp)\r\n{\r\n  return Curl_resolver_getaddrinfo(conn, hostname, port, waitp);\r\n}\r\n\r\n#endif /* CURLRES_ASYNCH */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostcheck.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_SSLEAY) || defined(USE_AXTLS)\r\n/* these two backends use functions from this file */\r\n\r\n#include \"hostcheck.h\"\r\n#include \"rawstr.h\"\r\n\r\n/*\r\n * Match a hostname against a wildcard pattern.\r\n * E.g.\r\n *  \"foo.host.com\" matches \"*.host.com\".\r\n *\r\n * We use the matching rule described in RFC6125, section 6.4.3.\r\n * http://tools.ietf.org/html/rfc6125#section-6.4.3\r\n */\r\n\r\nstatic int hostmatch(const char *hostname, const char *pattern)\r\n{\r\n  const char *pattern_label_end, *pattern_wildcard, *hostname_label_end;\r\n  int wildcard_enabled;\r\n  size_t prefixlen, suffixlen;\r\n  pattern_wildcard = strchr(pattern, '*');\r\n  if(pattern_wildcard == NULL)\r\n    return Curl_raw_equal(pattern, hostname) ?\r\n      CURL_HOST_MATCH : CURL_HOST_NOMATCH;\r\n\r\n  /* We require at least 2 dots in pattern to avoid too wide wildcard\r\n     match. */\r\n  wildcard_enabled = 1;\r\n  pattern_label_end = strchr(pattern, '.');\r\n  if(pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL ||\r\n     pattern_wildcard > pattern_label_end ||\r\n     Curl_raw_nequal(pattern, \"xn--\", 4)) {\r\n    wildcard_enabled = 0;\r\n  }\r\n  if(!wildcard_enabled)\r\n    return Curl_raw_equal(pattern, hostname) ?\r\n      CURL_HOST_MATCH : CURL_HOST_NOMATCH;\r\n\r\n  hostname_label_end = strchr(hostname, '.');\r\n  if(hostname_label_end == NULL ||\r\n     !Curl_raw_equal(pattern_label_end, hostname_label_end))\r\n    return CURL_HOST_NOMATCH;\r\n\r\n  /* The wildcard must match at least one character, so the left-most\r\n     label of the hostname is at least as large as the left-most label\r\n     of the pattern. */\r\n  if(hostname_label_end - hostname < pattern_label_end - pattern)\r\n    return CURL_HOST_NOMATCH;\r\n\r\n  prefixlen = pattern_wildcard - pattern;\r\n  suffixlen = pattern_label_end - (pattern_wildcard+1);\r\n  return Curl_raw_nequal(pattern, hostname, prefixlen) &&\r\n    Curl_raw_nequal(pattern_wildcard+1, hostname_label_end - suffixlen,\r\n                    suffixlen) ?\r\n    CURL_HOST_MATCH : CURL_HOST_NOMATCH;\r\n}\r\n\r\nint Curl_cert_hostcheck(const char *match_pattern, const char *hostname)\r\n{\r\n  if(!match_pattern || !*match_pattern ||\r\n      !hostname || !*hostname) /* sanity check */\r\n    return 0;\r\n\r\n  if(Curl_raw_equal(hostname, match_pattern)) /* trivial case */\r\n    return 1;\r\n\r\n  if(hostmatch(hostname,match_pattern) == CURL_HOST_MATCH)\r\n    return 1;\r\n  return 0;\r\n}\r\n\r\n#endif /* SSLEAY or AXTLS */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostcheck.h",
    "content": "#ifndef HEADER_CURL_HOSTCHECK_H\r\n#define HEADER_CURL_HOSTCHECK_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h>\r\n\r\n#define CURL_HOST_NOMATCH 0\r\n#define CURL_HOST_MATCH   1\r\nint Curl_cert_hostcheck(const char *match_pattern, const char *hostname);\r\n\r\n#endif /* HEADER_CURL_HOSTCHECK_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostip.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifdef HAVE_SETJMP_H\r\n#include <setjmp.h>\r\n#endif\r\n#ifdef HAVE_SIGNAL_H\r\n#include <signal.h>\r\n#endif\r\n\r\n#ifdef HAVE_PROCESS_H\r\n#include <process.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n#include \"inet_ntop.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#if defined(CURLRES_SYNCH) && \\\r\n    defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP)\r\n/* alarm-based timeouts can only be used with all the dependencies satisfied */\r\n#define USE_ALARM_TIMEOUT\r\n#endif\r\n\r\n/*\r\n * hostip.c explained\r\n * ==================\r\n *\r\n * The main COMPILE-TIME DEFINES to keep in mind when reading the host*.c\r\n * source file are these:\r\n *\r\n * CURLRES_IPV6 - this host has getaddrinfo() and family, and thus we use\r\n * that. The host may not be able to resolve IPv6, but we don't really have to\r\n * take that into account. Hosts that aren't IPv6-enabled have CURLRES_IPV4\r\n * defined.\r\n *\r\n * CURLRES_ARES - is defined if libcurl is built to use c-ares for\r\n * asynchronous name resolves. This can be Windows or *nix.\r\n *\r\n * CURLRES_THREADED - is defined if libcurl is built to run under (native)\r\n * Windows, and then the name resolve will be done in a new thread, and the\r\n * supported API will be the same as for ares-builds.\r\n *\r\n * If any of the two previous are defined, CURLRES_ASYNCH is defined too. If\r\n * libcurl is not built to use an asynchronous resolver, CURLRES_SYNCH is\r\n * defined.\r\n *\r\n * The host*.c sources files are split up like this:\r\n *\r\n * hostip.c   - method-independent resolver functions and utility functions\r\n * hostasyn.c - functions for asynchronous name resolves\r\n * hostsyn.c  - functions for synchronous name resolves\r\n * hostip4.c  - ipv4-specific functions\r\n * hostip6.c  - ipv6-specific functions\r\n *\r\n * The two asynchronous name resolver backends are implemented in:\r\n * asyn-ares.c   - functions for ares-using name resolves\r\n * asyn-thread.c - functions for threaded name resolves\r\n\r\n * The hostip.h is the united header file for all this. It defines the\r\n * CURLRES_* defines based on the config*.h and curl_setup.h defines.\r\n */\r\n\r\n/* These two symbols are for the global DNS cache */\r\nstatic struct curl_hash hostname_cache;\r\nstatic int host_cache_initialized;\r\n\r\nstatic void freednsentry(void *freethis);\r\n\r\n/*\r\n * Curl_global_host_cache_init() initializes and sets up a global DNS cache.\r\n * Global DNS cache is general badness. Do not use. This will be removed in\r\n * a future version. Use the share interface instead!\r\n *\r\n * Returns a struct curl_hash pointer on success, NULL on failure.\r\n */\r\nstruct curl_hash *Curl_global_host_cache_init(void)\r\n{\r\n  int rc = 0;\r\n  if(!host_cache_initialized) {\r\n    rc = Curl_hash_init(&hostname_cache, 7, Curl_hash_str,\r\n                        Curl_str_key_compare, freednsentry);\r\n    if(!rc)\r\n      host_cache_initialized = 1;\r\n  }\r\n  return rc?NULL:&hostname_cache;\r\n}\r\n\r\n/*\r\n * Destroy and cleanup the global DNS cache\r\n */\r\nvoid Curl_global_host_cache_dtor(void)\r\n{\r\n  if(host_cache_initialized) {\r\n    Curl_hash_clean(&hostname_cache);\r\n    host_cache_initialized = 0;\r\n  }\r\n}\r\n\r\n/*\r\n * Return # of adresses in a Curl_addrinfo struct\r\n */\r\nint Curl_num_addresses(const Curl_addrinfo *addr)\r\n{\r\n  int i = 0;\r\n  while(addr) {\r\n    addr = addr->ai_next;\r\n    i++;\r\n  }\r\n  return i;\r\n}\r\n\r\n/*\r\n * Curl_printable_address() returns a printable version of the 1st address\r\n * given in the 'ai' argument. The result will be stored in the buf that is\r\n * bufsize bytes big.\r\n *\r\n * If the conversion fails, it returns NULL.\r\n */\r\nconst char *\r\nCurl_printable_address(const Curl_addrinfo *ai, char *buf, size_t bufsize)\r\n{\r\n  const struct sockaddr_in *sa4;\r\n  const struct in_addr *ipaddr4;\r\n#ifdef ENABLE_IPV6\r\n  const struct sockaddr_in6 *sa6;\r\n  const struct in6_addr *ipaddr6;\r\n#endif\r\n\r\n  switch (ai->ai_family) {\r\n    case AF_INET:\r\n      sa4 = (const void *)ai->ai_addr;\r\n      ipaddr4 = &sa4->sin_addr;\r\n      return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf,\r\n                            bufsize);\r\n#ifdef ENABLE_IPV6\r\n    case AF_INET6:\r\n      sa6 = (const void *)ai->ai_addr;\r\n      ipaddr6 = &sa6->sin6_addr;\r\n      return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf,\r\n                            bufsize);\r\n#endif\r\n    default:\r\n      break;\r\n  }\r\n  return NULL;\r\n}\r\n\r\n/*\r\n * Return a hostcache id string for the provided host + port, to be used by\r\n * the DNS caching.\r\n */\r\nstatic char *\r\ncreate_hostcache_id(const char *name, int port)\r\n{\r\n  /* create and return the new allocated entry */\r\n  char *id = aprintf(\"%s:%d\", name, port);\r\n  char *ptr = id;\r\n  if(ptr) {\r\n    /* lower case the name part */\r\n    while(*ptr && (*ptr != ':')) {\r\n      *ptr = (char)TOLOWER(*ptr);\r\n      ptr++;\r\n    }\r\n  }\r\n  return id;\r\n}\r\n\r\nstruct hostcache_prune_data {\r\n  long cache_timeout;\r\n  time_t now;\r\n};\r\n\r\n/*\r\n * This function is set as a callback to be called for every entry in the DNS\r\n * cache when we want to prune old unused entries.\r\n *\r\n * Returning non-zero means remove the entry, return 0 to keep it in the\r\n * cache.\r\n */\r\nstatic int\r\nhostcache_timestamp_remove(void *datap, void *hc)\r\n{\r\n  struct hostcache_prune_data *data =\r\n    (struct hostcache_prune_data *) datap;\r\n  struct Curl_dns_entry *c = (struct Curl_dns_entry *) hc;\r\n\r\n  return (data->now - c->timestamp >= data->cache_timeout);\r\n}\r\n\r\n/*\r\n * Prune the DNS cache. This assumes that a lock has already been taken.\r\n */\r\nstatic void\r\nhostcache_prune(struct curl_hash *hostcache, long cache_timeout, time_t now)\r\n{\r\n  struct hostcache_prune_data user;\r\n\r\n  user.cache_timeout = cache_timeout;\r\n  user.now = now;\r\n\r\n  Curl_hash_clean_with_criterium(hostcache,\r\n                                 (void *) &user,\r\n                                 hostcache_timestamp_remove);\r\n}\r\n\r\n/*\r\n * Library-wide function for pruning the DNS cache. This function takes and\r\n * returns the appropriate locks.\r\n */\r\nvoid Curl_hostcache_prune(struct SessionHandle *data)\r\n{\r\n  time_t now;\r\n\r\n  if((data->set.dns_cache_timeout == -1) || !data->dns.hostcache)\r\n    /* cache forever means never prune, and NULL hostcache means\r\n       we can't do it */\r\n    return;\r\n\r\n  if(data->share)\r\n    Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n  time(&now);\r\n\r\n  /* Remove outdated and unused entries from the hostcache */\r\n  hostcache_prune(data->dns.hostcache,\r\n                  data->set.dns_cache_timeout,\r\n                  now);\r\n\r\n  if(data->share)\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_DNS);\r\n}\r\n\r\n/*\r\n * Check if the entry should be pruned. Assumes a locked cache.\r\n */\r\nstatic int\r\nremove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)\r\n{\r\n  struct hostcache_prune_data user;\r\n\r\n  if(!dns || (data->set.dns_cache_timeout == -1) || !data->dns.hostcache)\r\n    /* cache forever means never prune, and NULL hostcache means\r\n       we can't do it */\r\n    return 0;\r\n\r\n  time(&user.now);\r\n  user.cache_timeout = data->set.dns_cache_timeout;\r\n\r\n  if(!hostcache_timestamp_remove(&user,dns) )\r\n    return 0;\r\n\r\n  Curl_hash_clean_with_criterium(data->dns.hostcache,\r\n                                 (void *) &user,\r\n                                 hostcache_timestamp_remove);\r\n\r\n  return 1;\r\n}\r\n\r\n\r\n#ifdef HAVE_SIGSETJMP\r\n/* Beware this is a global and unique instance. This is used to store the\r\n   return address that we can jump back to from inside a signal handler. This\r\n   is not thread-safe stuff. */\r\nsigjmp_buf curl_jmpenv;\r\n#endif\r\n\r\n\r\n/*\r\n * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache.\r\n *\r\n * When calling Curl_resolv() has resulted in a response with a returned\r\n * address, we call this function to store the information in the dns\r\n * cache etc\r\n *\r\n * Returns the Curl_dns_entry entry pointer or NULL if the storage failed.\r\n */\r\nstruct Curl_dns_entry *\r\nCurl_cache_addr(struct SessionHandle *data,\r\n                Curl_addrinfo *addr,\r\n                const char *hostname,\r\n                int port)\r\n{\r\n  char *entry_id;\r\n  size_t entry_len;\r\n  struct Curl_dns_entry *dns;\r\n  struct Curl_dns_entry *dns2;\r\n\r\n  /* Create an entry id, based upon the hostname and port */\r\n  entry_id = create_hostcache_id(hostname, port);\r\n  /* If we can't create the entry id, fail */\r\n  if(!entry_id)\r\n    return NULL;\r\n  entry_len = strlen(entry_id);\r\n\r\n  /* Create a new cache entry */\r\n  dns = calloc(1, sizeof(struct Curl_dns_entry));\r\n  if(!dns) {\r\n    free(entry_id);\r\n    return NULL;\r\n  }\r\n\r\n  dns->inuse = 0;   /* init to not used */\r\n  dns->addr = addr; /* this is the address(es) */\r\n  time(&dns->timestamp);\r\n  if(dns->timestamp == 0)\r\n    dns->timestamp = 1;   /* zero indicates that entry isn't in hash table */\r\n\r\n  /* Store the resolved data in our DNS cache. */\r\n  dns2 = Curl_hash_add(data->dns.hostcache, entry_id, entry_len+1,\r\n                       (void *)dns);\r\n  if(!dns2) {\r\n    free(dns);\r\n    free(entry_id);\r\n    return NULL;\r\n  }\r\n\r\n  dns = dns2;\r\n  dns->inuse++;         /* mark entry as in-use */\r\n\r\n  /* free the allocated entry_id */\r\n  free(entry_id);\r\n\r\n  return dns;\r\n}\r\n\r\n/*\r\n * Curl_resolv() is the main name resolve function within libcurl. It resolves\r\n * a name and returns a pointer to the entry in the 'entry' argument (if one\r\n * is provided). This function might return immediately if we're using asynch\r\n * resolves. See the return codes.\r\n *\r\n * The cache entry we return will get its 'inuse' counter increased when this\r\n * function is used. You MUST call Curl_resolv_unlock() later (when you're\r\n * done using this struct) to decrease the counter again.\r\n *\r\n * In debug mode, we specifically test for an interface name \"LocalHost\"\r\n * and resolve \"localhost\" instead as a means to permit test cases\r\n * to connect to a local test server with any host name.\r\n *\r\n * Return codes:\r\n *\r\n * CURLRESOLV_ERROR   (-1) = error, no pointer\r\n * CURLRESOLV_RESOLVED (0) = OK, pointer provided\r\n * CURLRESOLV_PENDING  (1) = waiting for response, no pointer\r\n */\r\n\r\nint Curl_resolv(struct connectdata *conn,\r\n                const char *hostname,\r\n                int port,\r\n                struct Curl_dns_entry **entry)\r\n{\r\n  char *entry_id = NULL;\r\n  struct Curl_dns_entry *dns = NULL;\r\n  size_t entry_len;\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode result;\r\n  int rc = CURLRESOLV_ERROR; /* default to failure */\r\n\r\n  *entry = NULL;\r\n\r\n  /* Create an entry id, based upon the hostname and port */\r\n  entry_id = create_hostcache_id(hostname, port);\r\n  /* If we can't create the entry id, fail */\r\n  if(!entry_id)\r\n    return rc;\r\n\r\n  entry_len = strlen(entry_id);\r\n\r\n  if(data->share)\r\n    Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n  /* See if its already in our dns cache */\r\n  dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1);\r\n\r\n  /* free the allocated entry_id again */\r\n  free(entry_id);\r\n\r\n  /* See whether the returned entry is stale. Done before we release lock */\r\n  if(remove_entry_if_stale(data, dns))\r\n    dns = NULL; /* the memory deallocation is being handled by the hash */\r\n\r\n  if(dns) {\r\n    dns->inuse++; /* we use it! */\r\n    rc = CURLRESOLV_RESOLVED;\r\n  }\r\n\r\n  if(data->share)\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_DNS);\r\n\r\n  if(!dns) {\r\n    /* The entry was not in the cache. Resolve it to IP address */\r\n\r\n    Curl_addrinfo *addr;\r\n    int respwait;\r\n\r\n    /* Check what IP specifics the app has requested and if we can provide it.\r\n     * If not, bail out. */\r\n    if(!Curl_ipvalid(conn))\r\n      return CURLRESOLV_ERROR;\r\n\r\n    /* If Curl_getaddrinfo() returns NULL, 'respwait' might be set to a\r\n       non-zero value indicating that we need to wait for the response to the\r\n       resolve call */\r\n    addr = Curl_getaddrinfo(conn,\r\n#ifdef DEBUGBUILD\r\n                            (data->set.str[STRING_DEVICE]\r\n                             && !strcmp(data->set.str[STRING_DEVICE],\r\n                                        \"LocalHost\"))?\"localhost\":\r\n#endif\r\n                            hostname, port, &respwait);\r\n\r\n    if(!addr) {\r\n      if(respwait) {\r\n        /* the response to our resolve call will come asynchronously at\r\n           a later time, good or bad */\r\n        /* First, check that we haven't received the info by now */\r\n        result = Curl_resolver_is_resolved(conn, &dns);\r\n        if(result) /* error detected */\r\n          return CURLRESOLV_ERROR;\r\n        if(dns)\r\n          rc = CURLRESOLV_RESOLVED; /* pointer provided */\r\n        else\r\n          rc = CURLRESOLV_PENDING; /* no info yet */\r\n      }\r\n    }\r\n    else {\r\n      if(data->share)\r\n        Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n      /* we got a response, store it in the cache */\r\n      dns = Curl_cache_addr(data, addr, hostname, port);\r\n\r\n      if(data->share)\r\n        Curl_share_unlock(data, CURL_LOCK_DATA_DNS);\r\n\r\n      if(!dns)\r\n        /* returned failure, bail out nicely */\r\n        Curl_freeaddrinfo(addr);\r\n      else\r\n        rc = CURLRESOLV_RESOLVED;\r\n    }\r\n  }\r\n\r\n  *entry = dns;\r\n\r\n  return rc;\r\n}\r\n\r\n#ifdef USE_ALARM_TIMEOUT\r\n/*\r\n * This signal handler jumps back into the main libcurl code and continues\r\n * execution.  This effectively causes the remainder of the application to run\r\n * within a signal handler which is nonportable and could lead to problems.\r\n */\r\nstatic\r\nRETSIGTYPE alarmfunc(int sig)\r\n{\r\n  /* this is for \"-ansi -Wall -pedantic\" to stop complaining!   (rabe) */\r\n  (void)sig;\r\n  siglongjmp(curl_jmpenv, 1);\r\n  return;\r\n}\r\n#endif /* USE_ALARM_TIMEOUT */\r\n\r\n/*\r\n * Curl_resolv_timeout() is the same as Curl_resolv() but specifies a\r\n * timeout.  This function might return immediately if we're using asynch\r\n * resolves. See the return codes.\r\n *\r\n * The cache entry we return will get its 'inuse' counter increased when this\r\n * function is used. You MUST call Curl_resolv_unlock() later (when you're\r\n * done using this struct) to decrease the counter again.\r\n *\r\n * If built with a synchronous resolver and use of signals is not\r\n * disabled by the application, then a nonzero timeout will cause a\r\n * timeout after the specified number of milliseconds. Otherwise, timeout\r\n * is ignored.\r\n *\r\n * Return codes:\r\n *\r\n * CURLRESOLV_TIMEDOUT(-2) = warning, time too short or previous alarm expired\r\n * CURLRESOLV_ERROR   (-1) = error, no pointer\r\n * CURLRESOLV_RESOLVED (0) = OK, pointer provided\r\n * CURLRESOLV_PENDING  (1) = waiting for response, no pointer\r\n */\r\n\r\nint Curl_resolv_timeout(struct connectdata *conn,\r\n                        const char *hostname,\r\n                        int port,\r\n                        struct Curl_dns_entry **entry,\r\n                        long timeoutms)\r\n{\r\n#ifdef USE_ALARM_TIMEOUT\r\n#ifdef HAVE_SIGACTION\r\n  struct sigaction keep_sigact;   /* store the old struct here */\r\n  volatile bool keep_copysig = FALSE; /* wether old sigact has been saved */\r\n  struct sigaction sigact;\r\n#else\r\n#ifdef HAVE_SIGNAL\r\n  void (*keep_sigact)(int);       /* store the old handler here */\r\n#endif /* HAVE_SIGNAL */\r\n#endif /* HAVE_SIGACTION */\r\n  volatile long timeout;\r\n  volatile unsigned int prev_alarm = 0;\r\n  struct SessionHandle *data = conn->data;\r\n#endif /* USE_ALARM_TIMEOUT */\r\n  int rc;\r\n\r\n  *entry = NULL;\r\n\r\n  if(timeoutms < 0)\r\n    /* got an already expired timeout */\r\n    return CURLRESOLV_TIMEDOUT;\r\n\r\n#ifdef USE_ALARM_TIMEOUT\r\n  if(data->set.no_signal)\r\n    /* Ignore the timeout when signals are disabled */\r\n    timeout = 0;\r\n  else\r\n    timeout = timeoutms;\r\n\r\n  if(!timeout)\r\n    /* USE_ALARM_TIMEOUT defined, but no timeout actually requested */\r\n    return Curl_resolv(conn, hostname, port, entry);\r\n\r\n  if(timeout < 1000)\r\n    /* The alarm() function only provides integer second resolution, so if\r\n       we want to wait less than one second we must bail out already now. */\r\n    return CURLRESOLV_TIMEDOUT;\r\n\r\n  /*************************************************************\r\n   * Set signal handler to catch SIGALRM\r\n   * Store the old value to be able to set it back later!\r\n   *************************************************************/\r\n#ifdef HAVE_SIGACTION\r\n  sigaction(SIGALRM, NULL, &sigact);\r\n  keep_sigact = sigact;\r\n  keep_copysig = TRUE; /* yes, we have a copy */\r\n  sigact.sa_handler = alarmfunc;\r\n#ifdef SA_RESTART\r\n  /* HPUX doesn't have SA_RESTART but defaults to that behaviour! */\r\n  sigact.sa_flags &= ~SA_RESTART;\r\n#endif\r\n  /* now set the new struct */\r\n  sigaction(SIGALRM, &sigact, NULL);\r\n#else /* HAVE_SIGACTION */\r\n  /* no sigaction(), revert to the much lamer signal() */\r\n#ifdef HAVE_SIGNAL\r\n  keep_sigact = signal(SIGALRM, alarmfunc);\r\n#endif\r\n#endif /* HAVE_SIGACTION */\r\n\r\n  /* alarm() makes a signal get sent when the timeout fires off, and that\r\n     will abort system calls */\r\n  prev_alarm = alarm(curlx_sltoui(timeout/1000L));\r\n\r\n  /* This allows us to time-out from the name resolver, as the timeout\r\n     will generate a signal and we will siglongjmp() from that here.\r\n     This technique has problems (see alarmfunc).\r\n     This should be the last thing we do before calling Curl_resolv(),\r\n     as otherwise we'd have to worry about variables that get modified\r\n     before we invoke Curl_resolv() (and thus use \"volatile\"). */\r\n  if(sigsetjmp(curl_jmpenv, 1)) {\r\n    /* this is coming from a siglongjmp() after an alarm signal */\r\n    failf(data, \"name lookup timed out\");\r\n    rc = CURLRESOLV_ERROR;\r\n    goto clean_up;\r\n  }\r\n\r\n#else\r\n#ifndef CURLRES_ASYNCH\r\n  if(timeoutms)\r\n    infof(conn->data, \"timeout on name lookup is not supported\\n\");\r\n#else\r\n  (void)timeoutms; /* timeoutms not used with an async resolver */\r\n#endif\r\n#endif /* USE_ALARM_TIMEOUT */\r\n\r\n  /* Perform the actual name resolution. This might be interrupted by an\r\n   * alarm if it takes too long.\r\n   */\r\n  rc = Curl_resolv(conn, hostname, port, entry);\r\n\r\n#ifdef USE_ALARM_TIMEOUT\r\nclean_up:\r\n\r\n  if(!prev_alarm)\r\n    /* deactivate a possibly active alarm before uninstalling the handler */\r\n    alarm(0);\r\n\r\n#ifdef HAVE_SIGACTION\r\n  if(keep_copysig) {\r\n    /* we got a struct as it looked before, now put that one back nice\r\n       and clean */\r\n    sigaction(SIGALRM, &keep_sigact, NULL); /* put it back */\r\n  }\r\n#else\r\n#ifdef HAVE_SIGNAL\r\n  /* restore the previous SIGALRM handler */\r\n  signal(SIGALRM, keep_sigact);\r\n#endif\r\n#endif /* HAVE_SIGACTION */\r\n\r\n  /* switch back the alarm() to either zero or to what it was before minus\r\n     the time we spent until now! */\r\n  if(prev_alarm) {\r\n    /* there was an alarm() set before us, now put it back */\r\n    unsigned long elapsed_ms = Curl_tvdiff(Curl_tvnow(), conn->created);\r\n\r\n    /* the alarm period is counted in even number of seconds */\r\n    unsigned long alarm_set = prev_alarm - elapsed_ms/1000;\r\n\r\n    if(!alarm_set ||\r\n       ((alarm_set >= 0x80000000) && (prev_alarm < 0x80000000)) ) {\r\n      /* if the alarm time-left reached zero or turned \"negative\" (counted\r\n         with unsigned values), we should fire off a SIGALRM here, but we\r\n         won't, and zero would be to switch it off so we never set it to\r\n         less than 1! */\r\n      alarm(1);\r\n      rc = CURLRESOLV_TIMEDOUT;\r\n      failf(data, \"Previous alarm fired off!\");\r\n    }\r\n    else\r\n      alarm((unsigned int)alarm_set);\r\n  }\r\n#endif /* USE_ALARM_TIMEOUT */\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n * Curl_resolv_unlock() unlocks the given cached DNS entry. When this has been\r\n * made, the struct may be destroyed due to pruning. It is important that only\r\n * one unlock is made for each Curl_resolv() call.\r\n */\r\nvoid Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns)\r\n{\r\n  DEBUGASSERT(dns && (dns->inuse>0));\r\n\r\n  if(data->share)\r\n    Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n  dns->inuse--;\r\n  /* only free if nobody is using AND it is not in hostcache (timestamp ==\r\n     0) */\r\n  if(dns->inuse == 0 && dns->timestamp == 0) {\r\n    Curl_freeaddrinfo(dns->addr);\r\n    free(dns);\r\n  }\r\n\r\n  if(data->share)\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_DNS);\r\n}\r\n\r\n/*\r\n * File-internal: free a cache dns entry.\r\n */\r\nstatic void freednsentry(void *freethis)\r\n{\r\n  struct Curl_dns_entry *p = (struct Curl_dns_entry *) freethis;\r\n\r\n  /* mark the entry as not in hostcache */\r\n  p->timestamp = 0;\r\n  if(p->inuse == 0) {\r\n    Curl_freeaddrinfo(p->addr);\r\n    free(p);\r\n  }\r\n}\r\n\r\n/*\r\n * Curl_mk_dnscache() creates a new DNS cache and returns the handle for it.\r\n */\r\nstruct curl_hash *Curl_mk_dnscache(void)\r\n{\r\n  return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry);\r\n}\r\n\r\nstatic int hostcache_inuse(void *data, void *hc)\r\n{\r\n  struct Curl_dns_entry *c = (struct Curl_dns_entry *) hc;\r\n\r\n  if(c->inuse == 1)\r\n    Curl_resolv_unlock(data, c);\r\n\r\n  return 1; /* free all entries */\r\n}\r\n\r\nvoid Curl_hostcache_clean(struct SessionHandle *data)\r\n{\r\n  /* Entries added to the hostcache with the CURLOPT_RESOLVE function are\r\n   * still present in the cache with the inuse counter set to 1. Detect them\r\n   * and cleanup!\r\n   */\r\n  Curl_hash_clean_with_criterium(data->dns.hostcache, data, hostcache_inuse);\r\n}\r\n\r\nvoid Curl_hostcache_destroy(struct SessionHandle *data)\r\n{\r\n  Curl_hostcache_clean(data);\r\n  Curl_hash_destroy(data->dns.hostcache);\r\n  data->dns.hostcachetype = HCACHE_NONE;\r\n  data->dns.hostcache = NULL;\r\n}\r\n\r\nCURLcode Curl_loadhostpairs(struct SessionHandle *data)\r\n{\r\n  struct curl_slist *hostp;\r\n  char hostname[256];\r\n  char address[256];\r\n  int port;\r\n\r\n  for(hostp = data->change.resolve; hostp; hostp = hostp->next ) {\r\n    if(!hostp->data)\r\n      continue;\r\n    if(hostp->data[0] == '-') {\r\n      /* TODO: mark an entry for removal */\r\n    }\r\n    else if(3 == sscanf(hostp->data, \"%255[^:]:%d:%255s\", hostname, &port,\r\n                        address)) {\r\n      struct Curl_dns_entry *dns;\r\n      Curl_addrinfo *addr;\r\n      char *entry_id;\r\n      size_t entry_len;\r\n\r\n      addr = Curl_str2addr(address, port);\r\n      if(!addr) {\r\n        infof(data, \"Resolve %s found illegal!\\n\", hostp->data);\r\n        continue;\r\n      }\r\n\r\n      /* Create an entry id, based upon the hostname and port */\r\n      entry_id = create_hostcache_id(hostname, port);\r\n      /* If we can't create the entry id, fail */\r\n      if(!entry_id) {\r\n        Curl_freeaddrinfo(addr);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n\r\n      entry_len = strlen(entry_id);\r\n\r\n      if(data->share)\r\n        Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n      /* See if its already in our dns cache */\r\n      dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1);\r\n\r\n      /* free the allocated entry_id again */\r\n      free(entry_id);\r\n\r\n      if(!dns)\r\n        /* if not in the cache already, put this host in the cache */\r\n        dns = Curl_cache_addr(data, addr, hostname, port);\r\n      else\r\n        /* this is a duplicate, free it again */\r\n        Curl_freeaddrinfo(addr);\r\n\r\n      if(data->share)\r\n        Curl_share_unlock(data, CURL_LOCK_DATA_DNS);\r\n\r\n      if(!dns) {\r\n        Curl_freeaddrinfo(addr);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      infof(data, \"Added %s:%d:%s to DNS cache\\n\",\r\n            hostname, port, address);\r\n    }\r\n  }\r\n  data->change.resolve = NULL; /* dealt with now */\r\n\r\n  return CURLE_OK;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostip.h",
    "content": "#ifndef HEADER_CURL_HOSTIP_H\r\n#define HEADER_CURL_HOSTIP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n#include \"hash.h\"\r\n#include \"curl_addrinfo.h\"\r\n#include \"asyn.h\"\r\n\r\n#ifdef HAVE_SETJMP_H\r\n#include <setjmp.h>\r\n#endif\r\n\r\n#ifdef NETWARE\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n/* Allocate enough memory to hold the full name information structs and\r\n * everything. OSF1 is known to require at least 8872 bytes. The buffer\r\n * required for storing all possible aliases and IP numbers is according to\r\n * Stevens' Unix Network Programming 2nd edition, p. 304: 8192 bytes!\r\n */\r\n#define CURL_HOSTENT_SIZE 9000\r\n\r\n#define CURL_TIMEOUT_RESOLVE 300 /* when using asynch methods, we allow this\r\n                                    many seconds for a name resolve */\r\n\r\n#define CURL_ASYNC_SUCCESS CURLE_OK\r\n\r\nstruct addrinfo;\r\nstruct hostent;\r\nstruct SessionHandle;\r\nstruct connectdata;\r\n\r\n/*\r\n * Curl_global_host_cache_init() initializes and sets up a global DNS cache.\r\n * Global DNS cache is general badness. Do not use. This will be removed in\r\n * a future version. Use the share interface instead!\r\n *\r\n * Returns a struct curl_hash pointer on success, NULL on failure.\r\n */\r\nstruct curl_hash *Curl_global_host_cache_init(void);\r\nvoid Curl_global_host_cache_dtor(void);\r\n\r\nstruct Curl_dns_entry {\r\n  Curl_addrinfo *addr;\r\n  /* timestamp == 0 -- entry not in hostcache\r\n     timestamp != 0 -- entry is in hostcache */\r\n  time_t timestamp;\r\n  long inuse;      /* use-counter, make very sure you decrease this\r\n                      when you're done using the address you received */\r\n};\r\n\r\n/*\r\n * Curl_resolv() returns an entry with the info for the specified host\r\n * and port.\r\n *\r\n * The returned data *MUST* be \"unlocked\" with Curl_resolv_unlock() after\r\n * use, or we'll leak memory!\r\n */\r\n/* return codes */\r\n#define CURLRESOLV_TIMEDOUT -2\r\n#define CURLRESOLV_ERROR    -1\r\n#define CURLRESOLV_RESOLVED  0\r\n#define CURLRESOLV_PENDING   1\r\nint Curl_resolv(struct connectdata *conn, const char *hostname,\r\n                int port, struct Curl_dns_entry **dnsentry);\r\nint Curl_resolv_timeout(struct connectdata *conn, const char *hostname,\r\n                        int port, struct Curl_dns_entry **dnsentry,\r\n                        long timeoutms);\r\n\r\n#ifdef CURLRES_IPV6\r\n/*\r\n * Curl_ipv6works() returns TRUE if ipv6 seems to work.\r\n */\r\nbool Curl_ipv6works(void);\r\n#else\r\n#define Curl_ipv6works() FALSE\r\n#endif\r\n\r\n/*\r\n * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've\r\n * been set and returns TRUE if they are OK.\r\n */\r\nbool Curl_ipvalid(struct connectdata *conn);\r\n\r\n\r\n/*\r\n * Curl_getaddrinfo() is the generic low-level name resolve API within this\r\n * source file. There are several versions of this function - for different\r\n * name resolve layers (selected at build-time). They all take this same set\r\n * of arguments\r\n */\r\nCurl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,\r\n                                const char *hostname,\r\n                                int port,\r\n                                int *waitp);\r\n\r\n\r\n/* unlock a previously resolved dns entry */\r\nvoid Curl_resolv_unlock(struct SessionHandle *data,\r\n                        struct Curl_dns_entry *dns);\r\n\r\n/* for debugging purposes only: */\r\nvoid Curl_scan_cache_used(void *user, void *ptr);\r\n\r\n/* make a new dns cache and return the handle */\r\nstruct curl_hash *Curl_mk_dnscache(void);\r\n\r\n/* prune old entries from the DNS cache */\r\nvoid Curl_hostcache_prune(struct SessionHandle *data);\r\n\r\n/* Return # of adresses in a Curl_addrinfo struct */\r\nint Curl_num_addresses (const Curl_addrinfo *addr);\r\n\r\n#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)\r\nint curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,\r\n                       GETNAMEINFO_TYPE_ARG2 salen,\r\n                       char *host, GETNAMEINFO_TYPE_ARG46 hostlen,\r\n                       char *serv, GETNAMEINFO_TYPE_ARG46 servlen,\r\n                       GETNAMEINFO_TYPE_ARG7 flags,\r\n                       int line, const char *source);\r\n#endif\r\n\r\n/* IPv4 threadsafe resolve function used for synch and asynch builds */\r\nCurl_addrinfo *Curl_ipv4_resolve_r(const char * hostname, int port);\r\n\r\nCURLcode Curl_async_resolved(struct connectdata *conn,\r\n                             bool *protocol_connect);\r\n\r\n#ifndef CURLRES_ASYNCH\r\n#define Curl_async_resolved(x,y) CURLE_OK\r\n#endif\r\n\r\n/*\r\n * Curl_addrinfo_callback() is used when we build with any asynch specialty.\r\n * Handles end of async request processing. Inserts ai into hostcache when\r\n * status is CURL_ASYNC_SUCCESS. Twiddles fields in conn to indicate async\r\n * request completed whether successful or failed.\r\n */\r\nCURLcode Curl_addrinfo_callback(struct connectdata *conn,\r\n                                int status,\r\n                                Curl_addrinfo *ai);\r\n\r\n/*\r\n * Curl_printable_address() returns a printable version of the 1st address\r\n * given in the 'ip' argument. The result will be stored in the buf that is\r\n * bufsize bytes big.\r\n */\r\nconst char *Curl_printable_address(const Curl_addrinfo *ip,\r\n                                   char *buf, size_t bufsize);\r\n\r\n/*\r\n * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache.\r\n *\r\n * Returns the Curl_dns_entry entry pointer or NULL if the storage failed.\r\n */\r\nstruct Curl_dns_entry *\r\nCurl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr,\r\n                const char *hostname, int port);\r\n\r\n#ifndef INADDR_NONE\r\n#define CURL_INADDR_NONE (in_addr_t) ~0\r\n#else\r\n#define CURL_INADDR_NONE INADDR_NONE\r\n#endif\r\n\r\n#ifdef HAVE_SIGSETJMP\r\n/* Forward-declaration of variable defined in hostip.c. Beware this\r\n * is a global and unique instance. This is used to store the return\r\n * address that we can jump back to from inside a signal handler.\r\n * This is not thread-safe stuff.\r\n */\r\nextern sigjmp_buf curl_jmpenv;\r\n#endif\r\n\r\n/*\r\n * Function provided by the resolver backend to set DNS servers to use.\r\n */\r\nCURLcode Curl_set_dns_servers(struct SessionHandle *data, char *servers);\r\n\r\n/*\r\n * Clean off entries from the cache\r\n */\r\nvoid Curl_hostcache_clean(struct SessionHandle *data);\r\n\r\n/*\r\n * Destroy the hostcache of this handle.\r\n */\r\nvoid Curl_hostcache_destroy(struct SessionHandle *data);\r\n\r\n/*\r\n * Populate the cache with specified entries from CURLOPT_RESOLVE.\r\n */\r\nCURLcode Curl_loadhostpairs(struct SessionHandle *data);\r\n\r\n#endif /* HEADER_CURL_HOSTIP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostip4.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifdef HAVE_PROCESS_H\r\n#include <process.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n#include \"inet_pton.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/***********************************************************************\r\n * Only for plain-ipv4 builds\r\n **********************************************************************/\r\n#ifdef CURLRES_IPV4 /* plain ipv4 code coming up */\r\n/*\r\n * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've\r\n * been set and returns TRUE if they are OK.\r\n */\r\nbool Curl_ipvalid(struct connectdata *conn)\r\n{\r\n  if(conn->ip_version == CURL_IPRESOLVE_V6)\r\n    /* an ipv6 address was requested and we can't get/use one */\r\n    return FALSE;\r\n\r\n  return TRUE; /* OK, proceed */\r\n}\r\n\r\n#ifdef CURLRES_SYNCH\r\n\r\n/*\r\n * Curl_getaddrinfo() - the ipv4 synchronous version.\r\n *\r\n * The original code to this function was from the Dancer source code, written\r\n * by Bjorn Reese, it has since been patched and modified considerably.\r\n *\r\n * gethostbyname_r() is the thread-safe version of the gethostbyname()\r\n * function. When we build for plain IPv4, we attempt to use this\r\n * function. There are _three_ different gethostbyname_r() versions, and we\r\n * detect which one this platform supports in the configure script and set up\r\n * the HAVE_GETHOSTBYNAME_R_3, HAVE_GETHOSTBYNAME_R_5 or\r\n * HAVE_GETHOSTBYNAME_R_6 defines accordingly. Note that HAVE_GETADDRBYNAME\r\n * has the corresponding rules. This is primarily on *nix. Note that some unix\r\n * flavours have thread-safe versions of the plain gethostbyname() etc.\r\n *\r\n */\r\nCurl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,\r\n                                const char *hostname,\r\n                                int port,\r\n                                int *waitp)\r\n{\r\n  Curl_addrinfo *ai = NULL;\r\n\r\n#ifdef CURL_DISABLE_VERBOSE_STRINGS\r\n  (void)conn;\r\n#endif\r\n\r\n  *waitp = 0; /* synchronous response only */\r\n\r\n  ai = Curl_ipv4_resolve_r(hostname, port);\r\n  if(!ai)\r\n    infof(conn->data, \"Curl_ipv4_resolve_r failed for %s\\n\", hostname);\r\n\r\n  return ai;\r\n}\r\n#endif /* CURLRES_SYNCH */\r\n#endif /* CURLRES_IPV4 */\r\n\r\n#if defined(CURLRES_IPV4) && !defined(CURLRES_ARES)\r\n\r\n/*\r\n * Curl_ipv4_resolve_r() - ipv4 threadsafe resolver function.\r\n *\r\n * This is used for both synchronous and asynchronous resolver builds,\r\n * implying that only threadsafe code and function calls may be used.\r\n *\r\n */\r\nCurl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,\r\n                                   int port)\r\n{\r\n#if !defined(HAVE_GETADDRINFO_THREADSAFE) && defined(HAVE_GETHOSTBYNAME_R_3)\r\n  int res;\r\n#endif\r\n  Curl_addrinfo *ai = NULL;\r\n  struct hostent *h = NULL;\r\n  struct in_addr in;\r\n  struct hostent *buf = NULL;\r\n\r\n  if(Curl_inet_pton(AF_INET, hostname, &in) > 0)\r\n    /* This is a dotted IP address 123.123.123.123-style */\r\n    return Curl_ip2addr(AF_INET, &in, hostname, port);\r\n\r\n#if defined(HAVE_GETADDRINFO_THREADSAFE)\r\n  else {\r\n    struct addrinfo hints;\r\n    char sbuf[NI_MAXSERV];\r\n    char *sbufptr = NULL;\r\n\r\n    memset(&hints, 0, sizeof(hints));\r\n    hints.ai_family = PF_INET;\r\n    hints.ai_socktype = SOCK_STREAM;\r\n    if(port) {\r\n      snprintf(sbuf, sizeof(sbuf), \"%d\", port);\r\n      sbufptr = sbuf;\r\n    }\r\n\r\n    (void)Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai);\r\n\r\n#elif defined(HAVE_GETHOSTBYNAME_R)\r\n  /*\r\n   * gethostbyname_r() is the preferred resolve function for many platforms.\r\n   * Since there are three different versions of it, the following code is\r\n   * somewhat #ifdef-ridden.\r\n   */\r\n  else {\r\n    int h_errnop;\r\n\r\n    buf = calloc(1, CURL_HOSTENT_SIZE);\r\n    if(!buf)\r\n      return NULL; /* major failure */\r\n    /*\r\n     * The clearing of the buffer is a workaround for a gethostbyname_r bug in\r\n     * qnx nto and it is also _required_ for some of these functions on some\r\n     * platforms.\r\n     */\r\n\r\n#if defined(HAVE_GETHOSTBYNAME_R_5)\r\n    /* Solaris, IRIX and more */\r\n    h = gethostbyname_r(hostname,\r\n                        (struct hostent *)buf,\r\n                        (char *)buf + sizeof(struct hostent),\r\n                        CURL_HOSTENT_SIZE - sizeof(struct hostent),\r\n                        &h_errnop);\r\n\r\n    /* If the buffer is too small, it returns NULL and sets errno to\r\n     * ERANGE. The errno is thread safe if this is compiled with\r\n     * -D_REENTRANT as then the 'errno' variable is a macro defined to get\r\n     * used properly for threads.\r\n     */\r\n\r\n    if(h) {\r\n      ;\r\n    }\r\n    else\r\n#elif defined(HAVE_GETHOSTBYNAME_R_6)\r\n    /* Linux */\r\n\r\n    (void)gethostbyname_r(hostname,\r\n                        (struct hostent *)buf,\r\n                        (char *)buf + sizeof(struct hostent),\r\n                        CURL_HOSTENT_SIZE - sizeof(struct hostent),\r\n                        &h, /* DIFFERENCE */\r\n                        &h_errnop);\r\n    /* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a\r\n     * sudden this function returns EAGAIN if the given buffer size is too\r\n     * small. Previous versions are known to return ERANGE for the same\r\n     * problem.\r\n     *\r\n     * This wouldn't be such a big problem if older versions wouldn't\r\n     * sometimes return EAGAIN on a common failure case. Alas, we can't\r\n     * assume that EAGAIN *or* ERANGE means ERANGE for any given version of\r\n     * glibc.\r\n     *\r\n     * For now, we do that and thus we may call the function repeatedly and\r\n     * fail for older glibc versions that return EAGAIN, until we run out of\r\n     * buffer size (step_size grows beyond CURL_HOSTENT_SIZE).\r\n     *\r\n     * If anyone has a better fix, please tell us!\r\n     *\r\n     * -------------------------------------------------------------------\r\n     *\r\n     * On October 23rd 2003, Dan C dug up more details on the mysteries of\r\n     * gethostbyname_r() in glibc:\r\n     *\r\n     * In glibc 2.2.5 the interface is different (this has also been\r\n     * discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't\r\n     * explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32\r\n     * (shipped/upgraded by Redhat 7.2) don't show this behavior!\r\n     *\r\n     * In this \"buggy\" version, the return code is -1 on error and 'errno'\r\n     * is set to the ERANGE or EAGAIN code. Note that 'errno' is not a\r\n     * thread-safe variable.\r\n     */\r\n\r\n    if(!h) /* failure */\r\n#elif defined(HAVE_GETHOSTBYNAME_R_3)\r\n    /* AIX, Digital Unix/Tru64, HPUX 10, more? */\r\n\r\n    /* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of\r\n     * the plain fact that it does not return unique full buffers on each\r\n     * call, but instead several of the pointers in the hostent structs will\r\n     * point to the same actual data! This have the unfortunate down-side that\r\n     * our caching system breaks down horribly. Luckily for us though, AIX 4.3\r\n     * and more recent versions have a \"completely thread-safe\"[*] libc where\r\n     * all the data is stored in thread-specific memory areas making calls to\r\n     * the plain old gethostbyname() work fine even for multi-threaded\r\n     * programs.\r\n     *\r\n     * This AIX 4.3 or later detection is all made in the configure script.\r\n     *\r\n     * Troels Walsted Hansen helped us work this out on March 3rd, 2003.\r\n     *\r\n     * [*] = much later we've found out that it isn't at all \"completely\r\n     * thread-safe\", but at least the gethostbyname() function is.\r\n     */\r\n\r\n    if(CURL_HOSTENT_SIZE >=\r\n       (sizeof(struct hostent)+sizeof(struct hostent_data))) {\r\n\r\n      /* August 22nd, 2000: Albert Chin-A-Young brought an updated version\r\n       * that should work! September 20: Richard Prescott worked on the buffer\r\n       * size dilemma.\r\n       */\r\n\r\n      res = gethostbyname_r(hostname,\r\n                            (struct hostent *)buf,\r\n                            (struct hostent_data *)((char *)buf +\r\n                                                    sizeof(struct hostent)));\r\n      h_errnop = SOCKERRNO; /* we don't deal with this, but set it anyway */\r\n    }\r\n    else\r\n      res = -1; /* failure, too smallish buffer size */\r\n\r\n    if(!res) { /* success */\r\n\r\n      h = buf; /* result expected in h */\r\n\r\n      /* This is the worst kind of the different gethostbyname_r() interfaces.\r\n       * Since we don't know how big buffer this particular lookup required,\r\n       * we can't realloc down the huge alloc without doing closer analysis of\r\n       * the returned data. Thus, we always use CURL_HOSTENT_SIZE for every\r\n       * name lookup. Fixing this would require an extra malloc() and then\r\n       * calling Curl_addrinfo_copy() that subsequent realloc()s down the new\r\n       * memory area to the actually used amount.\r\n       */\r\n    }\r\n    else\r\n#endif /* HAVE_...BYNAME_R_5 || HAVE_...BYNAME_R_6 || HAVE_...BYNAME_R_3 */\r\n    {\r\n      h = NULL; /* set return code to NULL */\r\n      free(buf);\r\n    }\r\n#else /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */\r\n    /*\r\n     * Here is code for platforms that don't have a thread safe\r\n     * getaddrinfo() nor gethostbyname_r() function or for which\r\n     * gethostbyname() is the preferred one.\r\n     */\r\n  else {\r\n    h = gethostbyname((void*)hostname);\r\n#endif /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */\r\n  }\r\n\r\n  if(h) {\r\n    ai = Curl_he2ai(h, port);\r\n\r\n    if(buf) /* used a *_r() function */\r\n      free(buf);\r\n  }\r\n\r\n  return ai;\r\n}\r\n#endif /* defined(CURLRES_IPV4) && !defined(CURLRES_ARES) */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostip6.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifdef HAVE_PROCESS_H\r\n#include <process.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n#include \"inet_pton.h\"\r\n#include \"connect.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/***********************************************************************\r\n * Only for ipv6-enabled builds\r\n **********************************************************************/\r\n#ifdef CURLRES_IPV6\r\n\r\n\r\n#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)\r\n/* These are strictly for memory tracing and are using the same style as the\r\n * family otherwise present in memdebug.c. I put these ones here since they\r\n * require a bunch of structs I didn't want to include in memdebug.c\r\n */\r\n\r\n/*\r\n * For CURLRES_ARS, this should be written using ares_gethostbyaddr()\r\n * (ignoring the fact c-ares doesn't return 'serv').\r\n */\r\n\r\nint curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,\r\n                       GETNAMEINFO_TYPE_ARG2 salen,\r\n                       char *host, GETNAMEINFO_TYPE_ARG46 hostlen,\r\n                       char *serv, GETNAMEINFO_TYPE_ARG46 servlen,\r\n                       GETNAMEINFO_TYPE_ARG7 flags,\r\n                       int line, const char *source)\r\n{\r\n  int res = (getnameinfo)(sa, salen,\r\n                          host, hostlen,\r\n                          serv, servlen,\r\n                          flags);\r\n  if(0 == res)\r\n    /* success */\r\n    curl_memlog(\"GETNAME %s:%d getnameinfo()\\n\",\r\n                source, line);\r\n  else\r\n    curl_memlog(\"GETNAME %s:%d getnameinfo() failed = %d\\n\",\r\n                source, line, res);\r\n  return res;\r\n}\r\n#endif /* defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO) */\r\n\r\n/*\r\n * Curl_ipv6works() returns TRUE if ipv6 seems to work.\r\n */\r\nbool Curl_ipv6works(void)\r\n{\r\n  /* the nature of most system is that IPv6 status doesn't come and go\r\n     during a program's lifetime so we only probe the first time and then we\r\n     have the info kept for fast re-use */\r\n  static int ipv6_works = -1;\r\n  if(-1 == ipv6_works) {\r\n    /* probe to see if we have a working IPv6 stack */\r\n    curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);\r\n    if(s == CURL_SOCKET_BAD)\r\n      /* an ipv6 address was requested but we can't get/use one */\r\n      ipv6_works = 0;\r\n    else {\r\n      ipv6_works = 1;\r\n      Curl_closesocket(NULL, s);\r\n    }\r\n  }\r\n  return (ipv6_works>0)?TRUE:FALSE;\r\n}\r\n\r\n/*\r\n * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've\r\n * been set and returns TRUE if they are OK.\r\n */\r\nbool Curl_ipvalid(struct connectdata *conn)\r\n{\r\n  if(conn->ip_version == CURL_IPRESOLVE_V6)\r\n    return Curl_ipv6works();\r\n  return TRUE;\r\n}\r\n\r\n#if defined(CURLRES_SYNCH)\r\n\r\n#ifdef DEBUG_ADDRINFO\r\nstatic void dump_addrinfo(struct connectdata *conn, const Curl_addrinfo *ai)\r\n{\r\n  printf(\"dump_addrinfo:\\n\");\r\n  for(; ai; ai = ai->ai_next) {\r\n    char  buf[INET6_ADDRSTRLEN];\r\n\r\n    printf(\"    fam %2d, CNAME %s, \",\r\n           ai->ai_family, ai->ai_canonname ? ai->ai_canonname : \"<none>\");\r\n    if(Curl_printable_address(ai, buf, sizeof(buf)))\r\n      printf(\"%s\\n\", buf);\r\n    else\r\n      printf(\"failed; %s\\n\", Curl_strerror(conn, SOCKERRNO));\r\n  }\r\n}\r\n#else\r\n#define dump_addrinfo(x,y) Curl_nop_stmt\r\n#endif\r\n\r\n/*\r\n * Curl_getaddrinfo() when built ipv6-enabled (non-threading and\r\n * non-ares version).\r\n *\r\n * Returns name information about the given hostname and port number. If\r\n * successful, the 'addrinfo' is returned and the forth argument will point to\r\n * memory we need to free after use. That memory *MUST* be freed with\r\n * Curl_freeaddrinfo(), nothing else.\r\n */\r\nCurl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,\r\n                                const char *hostname,\r\n                                int port,\r\n                                int *waitp)\r\n{\r\n  struct addrinfo hints;\r\n  Curl_addrinfo *res;\r\n  int error;\r\n  char sbuf[NI_MAXSERV];\r\n  char *sbufptr = NULL;\r\n  char addrbuf[128];\r\n  int pf;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  *waitp = 0; /* synchronous response only */\r\n\r\n  /*\r\n   * Check if a limited name resolve has been requested.\r\n   */\r\n  switch(conn->ip_version) {\r\n  case CURL_IPRESOLVE_V4:\r\n    pf = PF_INET;\r\n    break;\r\n  case CURL_IPRESOLVE_V6:\r\n    pf = PF_INET6;\r\n    break;\r\n  default:\r\n    pf = PF_UNSPEC;\r\n    break;\r\n  }\r\n\r\n  if((pf != PF_INET) && !Curl_ipv6works())\r\n    /* the stack seems to be a non-ipv6 one */\r\n    pf = PF_INET;\r\n\r\n  memset(&hints, 0, sizeof(hints));\r\n  hints.ai_family = pf;\r\n  hints.ai_socktype = conn->socktype;\r\n\r\n  if((1 == Curl_inet_pton(AF_INET, hostname, addrbuf)) ||\r\n     (1 == Curl_inet_pton(AF_INET6, hostname, addrbuf))) {\r\n    /* the given address is numerical only, prevent a reverse lookup */\r\n    hints.ai_flags = AI_NUMERICHOST;\r\n  }\r\n\r\n  if(port) {\r\n    snprintf(sbuf, sizeof(sbuf), \"%d\", port);\r\n    sbufptr=sbuf;\r\n  }\r\n  error = Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &res);\r\n  if(error) {\r\n    infof(data, \"getaddrinfo(3) failed for %s:%d\\n\", hostname, port);\r\n    return NULL;\r\n  }\r\n\r\n  dump_addrinfo(conn, res);\r\n\r\n  return res;\r\n}\r\n#endif /* CURLRES_SYNCH */\r\n#endif /* CURLRES_IPV6 */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/hostsyn.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifdef HAVE_PROCESS_H\r\n#include <process.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"share_curl.h\"\r\n#include \"strerror.h\"\r\n#include \"url.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/***********************************************************************\r\n * Only for builds using synchronous name resolves\r\n **********************************************************************/\r\n#ifdef CURLRES_SYNCH\r\n\r\n/*\r\n * Function provided by the resolver backend to set DNS servers to use.\r\n */\r\nCURLcode Curl_set_dns_servers(struct SessionHandle *data,\r\n                              char *servers)\r\n{\r\n  (void)data;\r\n  (void)servers;\r\n  return CURLE_NOT_BUILT_IN;\r\n\r\n}\r\n\r\n#endif /* truly sync */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n#include \"formdata.h\"\r\n#include \"progress.h\"\r\n#include \"curl_base64.h\"\r\n#include \"cookie.h\"\r\n#include \"strequal.h\"\r\n#include \"sslgen.h\"\r\n#include \"http_digest.h\"\r\n#include \"curl_ntlm.h\"\r\n#include \"curl_ntlm_wb.h\"\r\n#include \"http_negotiate.h\"\r\n#include \"url.h\"\r\n#include \"share_curl.h\"\r\n#include \"hostip.h\"\r\n#include \"http.h\"\r\n#include \"curl_memory.h\"\r\n#include \"select.h\"\r\n#include \"parsedate.h\" /* for the week day and month names */\r\n#include \"strtoofft.h\"\r\n#include \"multiif.h\"\r\n#include \"rawstr.h\"\r\n#include \"content_encoding.h\"\r\n#include \"http_proxy.h\"\r\n#include \"warnless.h\"\r\n#include \"non-ascii.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Forward declarations.\r\n */\r\n\r\nstatic int http_getsock_do(struct connectdata *conn,\r\n                           curl_socket_t *socks,\r\n                           int numsocks);\r\nstatic int http_should_fail(struct connectdata *conn);\r\n\r\n#ifdef USE_SSL\r\nstatic CURLcode https_connecting(struct connectdata *conn, bool *done);\r\nstatic int https_getsock(struct connectdata *conn,\r\n                         curl_socket_t *socks,\r\n                         int numsocks);\r\n#else\r\n#define https_connecting(x,y) CURLE_COULDNT_CONNECT\r\n#endif\r\n\r\n/*\r\n * HTTP handler interface.\r\n */\r\nconst struct Curl_handler Curl_handler_http = {\r\n  \"HTTP\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  Curl_http_connect,                    /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  http_getsock_do,                      /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_HTTP,                            /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * HTTPS handler interface.\r\n */\r\nconst struct Curl_handler Curl_handler_https = {\r\n  \"HTTPS\",                              /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  Curl_http_connect,                    /* connect_it */\r\n  https_connecting,                     /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  https_getsock,                        /* proto_getsock */\r\n  http_getsock_do,                      /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_HTTPS,                           /* defport */\r\n  CURLPROTO_HTTP | CURLPROTO_HTTPS,     /* protocol */\r\n  PROTOPT_SSL                           /* flags */\r\n};\r\n#endif\r\n\r\n\r\n/*\r\n * checkheaders() checks the linked list of custom HTTP headers for a\r\n * particular header (prefix).\r\n *\r\n * Returns a pointer to the first matching header or NULL if none matched.\r\n */\r\nchar *Curl_checkheaders(struct SessionHandle *data, const char *thisheader)\r\n{\r\n  struct curl_slist *head;\r\n  size_t thislen = strlen(thisheader);\r\n\r\n  for(head = data->set.headers; head; head=head->next) {\r\n    if(Curl_raw_nequal(head->data, thisheader, thislen))\r\n      return head->data;\r\n  }\r\n  return NULL;\r\n}\r\n\r\n/*\r\n * Strip off leading and trailing whitespace from the value in the\r\n * given HTTP header line and return a strdupped copy. Returns NULL in\r\n * case of allocation failure. Returns an empty string if the header value\r\n * consists entirely of whitespace.\r\n */\r\nstatic char *copy_header_value(const char *h)\r\n{\r\n  const char *start;\r\n  const char *end;\r\n  char *value;\r\n  size_t len;\r\n\r\n  DEBUGASSERT(h);\r\n\r\n  /* Find the end of the header name */\r\n  while(*h && (*h != ':'))\r\n    ++h;\r\n\r\n  if(*h)\r\n    /* Skip over colon */\r\n    ++h;\r\n\r\n  /* Find the first non-space letter */\r\n  start = h;\r\n  while(*start && ISSPACE(*start))\r\n    start++;\r\n\r\n  /* data is in the host encoding so\r\n     use '\\r' and '\\n' instead of 0x0d and 0x0a */\r\n  end = strchr(start, '\\r');\r\n  if(!end)\r\n    end = strchr(start, '\\n');\r\n  if(!end)\r\n    end = strchr(start, '\\0');\r\n  if(!end)\r\n    return NULL;\r\n\r\n  /* skip all trailing space letters */\r\n  while((end > start) && ISSPACE(*end))\r\n    end--;\r\n\r\n  /* get length of the type */\r\n  len = end-start+1;\r\n\r\n  value = malloc(len + 1);\r\n  if(!value)\r\n    return NULL;\r\n\r\n  memcpy(value, start, len);\r\n  value[len] = 0; /* zero terminate */\r\n\r\n  return value;\r\n}\r\n\r\n/*\r\n * http_output_basic() sets up an Authorization: header (or the proxy version)\r\n * for HTTP Basic authentication.\r\n *\r\n * Returns CURLcode.\r\n */\r\nstatic CURLcode http_output_basic(struct connectdata *conn, bool proxy)\r\n{\r\n  size_t size = 0;\r\n  char *authorization = NULL;\r\n  struct SessionHandle *data = conn->data;\r\n  char **userp;\r\n  const char *user;\r\n  const char *pwd;\r\n  CURLcode error;\r\n\r\n  if(proxy) {\r\n    userp = &conn->allocptr.proxyuserpwd;\r\n    user = conn->proxyuser;\r\n    pwd = conn->proxypasswd;\r\n  }\r\n  else {\r\n    userp = &conn->allocptr.userpwd;\r\n    user = conn->user;\r\n    pwd = conn->passwd;\r\n  }\r\n\r\n  snprintf(data->state.buffer, sizeof(data->state.buffer), \"%s:%s\", user, pwd);\r\n\r\n  error = Curl_base64_encode(data,\r\n                             data->state.buffer, strlen(data->state.buffer),\r\n                             &authorization, &size);\r\n  if(error)\r\n    return error;\r\n\r\n  if(!authorization)\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n\r\n  Curl_safefree(*userp);\r\n  *userp = aprintf(\"%sAuthorization: Basic %s\\r\\n\",\r\n                   proxy?\"Proxy-\":\"\",\r\n                   authorization);\r\n  free(authorization);\r\n  if(!*userp)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* pickoneauth() selects the most favourable authentication method from the\r\n * ones available and the ones we want.\r\n *\r\n * return TRUE if one was picked\r\n */\r\nstatic bool pickoneauth(struct auth *pick)\r\n{\r\n  bool picked;\r\n  /* only deal with authentication we want */\r\n  unsigned long avail = pick->avail & pick->want;\r\n  picked = TRUE;\r\n\r\n  /* The order of these checks is highly relevant, as this will be the order\r\n     of preference in case of the existence of multiple accepted types. */\r\n  if(avail & CURLAUTH_GSSNEGOTIATE)\r\n    pick->picked = CURLAUTH_GSSNEGOTIATE;\r\n  else if(avail & CURLAUTH_DIGEST)\r\n    pick->picked = CURLAUTH_DIGEST;\r\n  else if(avail & CURLAUTH_NTLM)\r\n    pick->picked = CURLAUTH_NTLM;\r\n  else if(avail & CURLAUTH_NTLM_WB)\r\n    pick->picked = CURLAUTH_NTLM_WB;\r\n  else if(avail & CURLAUTH_BASIC)\r\n    pick->picked = CURLAUTH_BASIC;\r\n  else {\r\n    pick->picked = CURLAUTH_PICKNONE; /* we select to use nothing */\r\n    picked = FALSE;\r\n  }\r\n  pick->avail = CURLAUTH_NONE; /* clear it here */\r\n\r\n  return picked;\r\n}\r\n\r\n/*\r\n * Curl_http_perhapsrewind()\r\n *\r\n * If we are doing POST or PUT {\r\n *   If we have more data to send {\r\n *     If we are doing NTLM {\r\n *       Keep sending since we must not disconnect\r\n *     }\r\n *     else {\r\n *       If there is more than just a little data left to send, close\r\n *       the current connection by force.\r\n *     }\r\n *   }\r\n *   If we have sent any data {\r\n *     If we don't have track of all the data {\r\n *       call app to tell it to rewind\r\n *     }\r\n *     else {\r\n *       rewind internally so that the operation can restart fine\r\n *     }\r\n *   }\r\n * }\r\n */\r\nstatic CURLcode http_perhapsrewind(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct HTTP *http = data->state.proto.http;\r\n  curl_off_t bytessent;\r\n  curl_off_t expectsend = -1; /* default is unknown */\r\n\r\n  if(!http)\r\n    /* If this is still NULL, we have not reach very far and we can safely\r\n       skip this rewinding stuff */\r\n    return CURLE_OK;\r\n\r\n  switch(data->set.httpreq) {\r\n  case HTTPREQ_GET:\r\n  case HTTPREQ_HEAD:\r\n    return CURLE_OK;\r\n  default:\r\n    break;\r\n  }\r\n\r\n  bytessent = http->writebytecount;\r\n\r\n  if(conn->bits.authneg)\r\n    /* This is a state where we are known to be negotiating and we don't send\r\n       any data then. */\r\n    expectsend = 0;\r\n  else {\r\n    /* figure out how much data we are expected to send */\r\n    switch(data->set.httpreq) {\r\n    case HTTPREQ_POST:\r\n      if(data->set.postfieldsize != -1)\r\n        expectsend = data->set.postfieldsize;\r\n      else if(data->set.postfields)\r\n        expectsend = (curl_off_t)strlen(data->set.postfields);\r\n      break;\r\n    case HTTPREQ_PUT:\r\n      if(data->set.infilesize != -1)\r\n        expectsend = data->set.infilesize;\r\n      break;\r\n    case HTTPREQ_POST_FORM:\r\n      expectsend = http->postsize;\r\n      break;\r\n    default:\r\n      break;\r\n    }\r\n  }\r\n\r\n  conn->bits.rewindaftersend = FALSE; /* default */\r\n\r\n  if((expectsend == -1) || (expectsend > bytessent)) {\r\n    /* There is still data left to send */\r\n    if((data->state.authproxy.picked == CURLAUTH_NTLM) ||\r\n       (data->state.authhost.picked == CURLAUTH_NTLM) ||\r\n       (data->state.authproxy.picked == CURLAUTH_NTLM_WB) ||\r\n       (data->state.authhost.picked == CURLAUTH_NTLM_WB)) {\r\n      if(((expectsend - bytessent) < 2000) ||\r\n         (conn->ntlm.state != NTLMSTATE_NONE) ||\r\n         (conn->proxyntlm.state != NTLMSTATE_NONE)) {\r\n        /* The NTLM-negotiation has started *OR* there is just a little (<2K)\r\n           data left to send, keep on sending. */\r\n\r\n        /* rewind data when completely done sending! */\r\n        if(!conn->bits.authneg) {\r\n          conn->bits.rewindaftersend = TRUE;\r\n          infof(data, \"Rewind stream after send\\n\");\r\n        }\r\n\r\n        return CURLE_OK;\r\n      }\r\n      if(conn->bits.close)\r\n        /* this is already marked to get closed */\r\n        return CURLE_OK;\r\n\r\n      infof(data, \"NTLM send, close instead of sending %\" FORMAT_OFF_T\r\n            \" bytes\\n\", (curl_off_t)(expectsend - bytessent));\r\n    }\r\n\r\n    /* This is not NTLM or many bytes left to send: close\r\n     */\r\n    conn->bits.close = TRUE;\r\n    data->req.size = 0; /* don't download any more than 0 bytes */\r\n\r\n    /* There still is data left to send, but this connection is marked for\r\n       closure so we can safely do the rewind right now */\r\n  }\r\n\r\n  if(bytessent)\r\n    /* we rewind now at once since if we already sent something */\r\n    return Curl_readrewind(conn);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_http_auth_act() gets called when all HTTP headers have been received\r\n * and it checks what authentication methods that are available and decides\r\n * which one (if any) to use. It will set 'newurl' if an auth method was\r\n * picked.\r\n */\r\n\r\nCURLcode Curl_http_auth_act(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  bool pickhost = FALSE;\r\n  bool pickproxy = FALSE;\r\n  CURLcode code = CURLE_OK;\r\n\r\n  if(100 <= data->req.httpcode && 199 >= data->req.httpcode)\r\n    /* this is a transient response code, ignore */\r\n    return CURLE_OK;\r\n\r\n  if(data->state.authproblem)\r\n    return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK;\r\n\r\n  if(conn->bits.user_passwd &&\r\n     ((data->req.httpcode == 401) ||\r\n      (conn->bits.authneg && data->req.httpcode < 300))) {\r\n    pickhost = pickoneauth(&data->state.authhost);\r\n    if(!pickhost)\r\n      data->state.authproblem = TRUE;\r\n  }\r\n  if(conn->bits.proxy_user_passwd &&\r\n     ((data->req.httpcode == 407) ||\r\n      (conn->bits.authneg && data->req.httpcode < 300))) {\r\n    pickproxy = pickoneauth(&data->state.authproxy);\r\n    if(!pickproxy)\r\n      data->state.authproblem = TRUE;\r\n  }\r\n\r\n  if(pickhost || pickproxy) {\r\n    /* In case this is GSS auth, the newurl field is already allocated so\r\n       we must make sure to free it before allocating a new one. As figured\r\n       out in bug #2284386 */\r\n    Curl_safefree(data->req.newurl);\r\n    data->req.newurl = strdup(data->change.url); /* clone URL */\r\n    if(!data->req.newurl)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    if((data->set.httpreq != HTTPREQ_GET) &&\r\n       (data->set.httpreq != HTTPREQ_HEAD) &&\r\n       !conn->bits.rewindaftersend) {\r\n      code = http_perhapsrewind(conn);\r\n      if(code)\r\n        return code;\r\n    }\r\n  }\r\n\r\n  else if((data->req.httpcode < 300) &&\r\n          (!data->state.authhost.done) &&\r\n          conn->bits.authneg) {\r\n    /* no (known) authentication available,\r\n       authentication is not \"done\" yet and\r\n       no authentication seems to be required and\r\n       we didn't try HEAD or GET */\r\n    if((data->set.httpreq != HTTPREQ_GET) &&\r\n       (data->set.httpreq != HTTPREQ_HEAD)) {\r\n      data->req.newurl = strdup(data->change.url); /* clone URL */\r\n      if(!data->req.newurl)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      data->state.authhost.done = TRUE;\r\n    }\r\n  }\r\n  if(http_should_fail(conn)) {\r\n    failf (data, \"The requested URL returned error: %d\",\r\n           data->req.httpcode);\r\n    code = CURLE_HTTP_RETURNED_ERROR;\r\n  }\r\n\r\n  return code;\r\n}\r\n\r\n\r\n/*\r\n * Output the correct authentication header depending on the auth type\r\n * and whether or not it is to a proxy.\r\n */\r\nstatic CURLcode\r\noutput_auth_headers(struct connectdata *conn,\r\n                    struct auth *authstatus,\r\n                    const char *request,\r\n                    const char *path,\r\n                    bool proxy)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  const char *auth=NULL;\r\n  CURLcode result = CURLE_OK;\r\n#ifdef USE_HTTP_NEGOTIATE\r\n  struct negotiatedata *negdata = proxy?\r\n    &data->state.proxyneg:&data->state.negotiate;\r\n#endif\r\n\r\n#ifdef CURL_DISABLE_CRYPTO_AUTH\r\n  (void)request;\r\n  (void)path;\r\n#endif\r\n\r\n#ifdef USE_HTTP_NEGOTIATE\r\n  negdata->state = GSS_AUTHNONE;\r\n  if((authstatus->picked == CURLAUTH_GSSNEGOTIATE) &&\r\n     negdata->context && !GSS_ERROR(negdata->status)) {\r\n    auth=\"GSS-Negotiate\";\r\n    result = Curl_output_negotiate(conn, proxy);\r\n    if(result)\r\n      return result;\r\n    authstatus->done = TRUE;\r\n    negdata->state = GSS_AUTHSENT;\r\n  }\r\n  else\r\n#endif\r\n#ifdef USE_NTLM\r\n  if(authstatus->picked == CURLAUTH_NTLM) {\r\n    auth=\"NTLM\";\r\n    result = Curl_output_ntlm(conn, proxy);\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n#endif\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n  if(authstatus->picked == CURLAUTH_NTLM_WB) {\r\n    auth=\"NTLM_WB\";\r\n    result = Curl_output_ntlm_wb(conn, proxy);\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n#endif\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n  if(authstatus->picked == CURLAUTH_DIGEST) {\r\n    auth=\"Digest\";\r\n    result = Curl_output_digest(conn,\r\n                                proxy,\r\n                                (const unsigned char *)request,\r\n                                (const unsigned char *)path);\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n#endif\r\n  if(authstatus->picked == CURLAUTH_BASIC) {\r\n    /* Basic */\r\n    if((proxy && conn->bits.proxy_user_passwd &&\r\n       !Curl_checkheaders(data, \"Proxy-authorization:\")) ||\r\n       (!proxy && conn->bits.user_passwd &&\r\n       !Curl_checkheaders(data, \"Authorization:\"))) {\r\n      auth=\"Basic\";\r\n      result = http_output_basic(conn, proxy);\r\n      if(result)\r\n        return result;\r\n    }\r\n    /* NOTE: this function should set 'done' TRUE, as the other auth\r\n       functions work that way */\r\n    authstatus->done = TRUE;\r\n  }\r\n\r\n  if(auth) {\r\n    infof(data, \"%s auth using %s with user '%s'\\n\",\r\n          proxy?\"Proxy\":\"Server\", auth,\r\n          proxy?(conn->proxyuser?conn->proxyuser:\"\"):\r\n                (conn->user?conn->user:\"\"));\r\n    authstatus->multi = (!authstatus->done) ? TRUE : FALSE;\r\n  }\r\n  else\r\n    authstatus->multi = FALSE;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/**\r\n * Curl_http_output_auth() setups the authentication headers for the\r\n * host/proxy and the correct authentication\r\n * method. conn->data->state.authdone is set to TRUE when authentication is\r\n * done.\r\n *\r\n * @param conn all information about the current connection\r\n * @param request pointer to the request keyword\r\n * @param path pointer to the requested path\r\n * @param proxytunnel boolean if this is the request setting up a \"proxy\r\n * tunnel\"\r\n *\r\n * @returns CURLcode\r\n */\r\nCURLcode\r\nCurl_http_output_auth(struct connectdata *conn,\r\n                      const char *request,\r\n                      const char *path,\r\n                      bool proxytunnel) /* TRUE if this is the request setting\r\n                                           up the proxy tunnel */\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct auth *authhost;\r\n  struct auth *authproxy;\r\n\r\n  DEBUGASSERT(data);\r\n\r\n  authhost = &data->state.authhost;\r\n  authproxy = &data->state.authproxy;\r\n\r\n  if((conn->bits.httpproxy && conn->bits.proxy_user_passwd) ||\r\n     conn->bits.user_passwd)\r\n    /* continue please */ ;\r\n  else {\r\n    authhost->done = TRUE;\r\n    authproxy->done = TRUE;\r\n    return CURLE_OK; /* no authentication with no user or password */\r\n  }\r\n\r\n  if(authhost->want && !authhost->picked)\r\n    /* The app has selected one or more methods, but none has been picked\r\n       so far by a server round-trip. Then we set the picked one to the\r\n       want one, and if this is one single bit it'll be used instantly. */\r\n    authhost->picked = authhost->want;\r\n\r\n  if(authproxy->want && !authproxy->picked)\r\n    /* The app has selected one or more methods, but none has been picked so\r\n       far by a proxy round-trip. Then we set the picked one to the want one,\r\n       and if this is one single bit it'll be used instantly. */\r\n    authproxy->picked = authproxy->want;\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n  /* Send proxy authentication header if needed */\r\n  if(conn->bits.httpproxy &&\r\n      (conn->bits.tunnel_proxy == proxytunnel)) {\r\n    result = output_auth_headers(conn, authproxy, request, path, TRUE);\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n#else\r\n  (void)proxytunnel;\r\n#endif /* CURL_DISABLE_PROXY */\r\n    /* we have no proxy so let's pretend we're done authenticating\r\n       with it */\r\n    authproxy->done = TRUE;\r\n\r\n  /* To prevent the user+password to get sent to other than the original\r\n     host due to a location-follow, we do some weirdo checks here */\r\n  if(!data->state.this_is_a_follow ||\r\n     conn->bits.netrc ||\r\n     !data->state.first_host ||\r\n     data->set.http_disable_hostname_check_before_authentication ||\r\n     Curl_raw_equal(data->state.first_host, conn->host.name)) {\r\n    result = output_auth_headers(conn, authhost, request, path, FALSE);\r\n  }\r\n  else\r\n    authhost->done = TRUE;\r\n\r\n  return result;\r\n}\r\n\r\n\r\n/*\r\n * Curl_http_input_auth() deals with Proxy-Authenticate: and WWW-Authenticate:\r\n * headers. They are dealt with both in the transfer.c main loop and in the\r\n * proxy CONNECT loop.\r\n */\r\n\r\nCURLcode Curl_http_input_auth(struct connectdata *conn,\r\n                              int httpcode,\r\n                              const char *header) /* the first non-space */\r\n{\r\n  /*\r\n   * This resource requires authentication\r\n   */\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  unsigned long *availp;\r\n  const char *start;\r\n  struct auth *authp;\r\n\r\n  if(httpcode == 407) {\r\n    start = header+strlen(\"Proxy-authenticate:\");\r\n    availp = &data->info.proxyauthavail;\r\n    authp = &data->state.authproxy;\r\n  }\r\n  else {\r\n    start = header+strlen(\"WWW-Authenticate:\");\r\n    availp = &data->info.httpauthavail;\r\n    authp = &data->state.authhost;\r\n  }\r\n\r\n  /* pass all white spaces */\r\n  while(*start && ISSPACE(*start))\r\n    start++;\r\n\r\n  /*\r\n   * Here we check if we want the specific single authentication (using ==) and\r\n   * if we do, we initiate usage of it.\r\n   *\r\n   * If the provided authentication is wanted as one out of several accepted\r\n   * types (using &), we OR this authentication type to the authavail\r\n   * variable.\r\n   *\r\n   * Note:\r\n   *\r\n   * ->picked is first set to the 'want' value (one or more bits) before the\r\n   * request is sent, and then it is again set _after_ all response 401/407\r\n   * headers have been received but then only to a single preferred method\r\n   * (bit).\r\n   *\r\n   */\r\n\r\n  while(*start) {\r\n#ifdef USE_HTTP_NEGOTIATE\r\n    if(checkprefix(\"GSS-Negotiate\", start) ||\r\n       checkprefix(\"Negotiate\", start)) {\r\n      int neg;\r\n      *availp |= CURLAUTH_GSSNEGOTIATE;\r\n      authp->avail |= CURLAUTH_GSSNEGOTIATE;\r\n\r\n      if(authp->picked == CURLAUTH_GSSNEGOTIATE) {\r\n        if(data->state.negotiate.state == GSS_AUTHSENT) {\r\n          /* if we sent GSS authentication in the outgoing request and we get\r\n             this back, we're in trouble */\r\n          infof(data, \"Authentication problem. Ignoring this.\\n\");\r\n          data->state.authproblem = TRUE;\r\n        }\r\n        else {\r\n          neg = Curl_input_negotiate(conn, (bool)(httpcode == 407), start);\r\n          if(neg == 0) {\r\n            DEBUGASSERT(!data->req.newurl);\r\n            data->req.newurl = strdup(data->change.url);\r\n            if(!data->req.newurl)\r\n              return CURLE_OUT_OF_MEMORY;\r\n            data->state.authproblem = FALSE;\r\n            /* we received GSS auth info and we dealt with it fine */\r\n            data->state.negotiate.state = GSS_AUTHRECV;\r\n          }\r\n          else\r\n            data->state.authproblem = TRUE;\r\n        }\r\n      }\r\n    }\r\n    else\r\n#endif\r\n#ifdef USE_NTLM\r\n      /* NTLM support requires the SSL crypto libs */\r\n      if(checkprefix(\"NTLM\", start)) {\r\n        *availp |= CURLAUTH_NTLM;\r\n        authp->avail |= CURLAUTH_NTLM;\r\n        if(authp->picked == CURLAUTH_NTLM ||\r\n           authp->picked == CURLAUTH_NTLM_WB) {\r\n          /* NTLM authentication is picked and activated */\r\n          CURLcode ntlm =\r\n            Curl_input_ntlm(conn, (httpcode == 407)?TRUE:FALSE, start);\r\n          if(CURLE_OK == ntlm) {\r\n            data->state.authproblem = FALSE;\r\n#ifdef NTLM_WB_ENABLED\r\n            if(authp->picked == CURLAUTH_NTLM_WB) {\r\n              *availp &= ~CURLAUTH_NTLM;\r\n              authp->avail &= ~CURLAUTH_NTLM;\r\n              *availp |= CURLAUTH_NTLM_WB;\r\n              authp->avail |= CURLAUTH_NTLM_WB;\r\n\r\n              /* Get the challenge-message which will be passed to\r\n               * ntlm_auth for generating the type 3 message later */\r\n              while(*start && ISSPACE(*start))\r\n                start++;\r\n              if(checkprefix(\"NTLM\", start)) {\r\n                start += strlen(\"NTLM\");\r\n                while(*start && ISSPACE(*start))\r\n                  start++;\r\n                if(*start)\r\n                  if((conn->challenge_header = strdup(start)) == NULL)\r\n                    return CURLE_OUT_OF_MEMORY;\r\n              }\r\n            }\r\n#endif\r\n          }\r\n          else {\r\n            infof(data, \"Authentication problem. Ignoring this.\\n\");\r\n            data->state.authproblem = TRUE;\r\n          }\r\n        }\r\n      }\r\n      else\r\n#endif\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n        if(checkprefix(\"Digest\", start)) {\r\n          if((authp->avail & CURLAUTH_DIGEST) != 0) {\r\n            infof(data, \"Ignoring duplicate digest auth header.\\n\");\r\n          }\r\n          else {\r\n            CURLdigest dig;\r\n            *availp |= CURLAUTH_DIGEST;\r\n            authp->avail |= CURLAUTH_DIGEST;\r\n\r\n            /* We call this function on input Digest headers even if Digest\r\n             * authentication isn't activated yet, as we need to store the\r\n             * incoming data from this header in case we are gonna use\r\n             * Digest. */\r\n            dig = Curl_input_digest(conn, (httpcode == 407)?TRUE:FALSE, start);\r\n\r\n            if(CURLDIGEST_FINE != dig) {\r\n              infof(data, \"Authentication problem. Ignoring this.\\n\");\r\n              data->state.authproblem = TRUE;\r\n            }\r\n          }\r\n        }\r\n        else\r\n#endif\r\n          if(checkprefix(\"Basic\", start)) {\r\n            *availp |= CURLAUTH_BASIC;\r\n            authp->avail |= CURLAUTH_BASIC;\r\n            if(authp->picked == CURLAUTH_BASIC) {\r\n              /* We asked for Basic authentication but got a 40X back\r\n                 anyway, which basically means our name+password isn't\r\n                 valid. */\r\n              authp->avail = CURLAUTH_NONE;\r\n              infof(data, \"Authentication problem. Ignoring this.\\n\");\r\n              data->state.authproblem = TRUE;\r\n            }\r\n          }\r\n\r\n    /* there may be multiple methods on one line, so keep reading */\r\n    while(*start && *start != ',') /* read up to the next comma */\r\n      start++;\r\n    if(*start == ',') /* if we're on a comma, skip it */\r\n      start++;\r\n    while(*start && ISSPACE(*start))\r\n      start++;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n/**\r\n * http_should_fail() determines whether an HTTP response has gotten us\r\n * into an error state or not.\r\n *\r\n * @param conn all information about the current connection\r\n *\r\n * @retval 0 communications should continue\r\n *\r\n * @retval 1 communications should not continue\r\n */\r\nstatic int http_should_fail(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data;\r\n  int httpcode;\r\n\r\n  DEBUGASSERT(conn);\r\n  data = conn->data;\r\n  DEBUGASSERT(data);\r\n\r\n  httpcode = data->req.httpcode;\r\n\r\n  /*\r\n  ** If we haven't been asked to fail on error,\r\n  ** don't fail.\r\n  */\r\n  if(!data->set.http_fail_on_error)\r\n    return 0;\r\n\r\n  /*\r\n  ** Any code < 400 is never terminal.\r\n  */\r\n  if(httpcode < 400)\r\n    return 0;\r\n\r\n  if(data->state.resume_from &&\r\n     (data->set.httpreq==HTTPREQ_GET) &&\r\n     (httpcode == 416)) {\r\n    /* \"Requested Range Not Satisfiable\", just proceed and\r\n       pretend this is no error */\r\n    return 0;\r\n  }\r\n\r\n  /*\r\n  ** Any code >= 400 that's not 401 or 407 is always\r\n  ** a terminal error\r\n  */\r\n  if((httpcode != 401) &&\r\n      (httpcode != 407))\r\n    return 1;\r\n\r\n  /*\r\n  ** All we have left to deal with is 401 and 407\r\n  */\r\n  DEBUGASSERT((httpcode == 401) || (httpcode == 407));\r\n\r\n  /*\r\n  ** Examine the current authentication state to see if this\r\n  ** is an error.  The idea is for this function to get\r\n  ** called after processing all the headers in a response\r\n  ** message.  So, if we've been to asked to authenticate a\r\n  ** particular stage, and we've done it, we're OK.  But, if\r\n  ** we're already completely authenticated, it's not OK to\r\n  ** get another 401 or 407.\r\n  **\r\n  ** It is possible for authentication to go stale such that\r\n  ** the client needs to reauthenticate.  Once that info is\r\n  ** available, use it here.\r\n  */\r\n\r\n  /*\r\n  ** Either we're not authenticating, or we're supposed to\r\n  ** be authenticating something else.  This is an error.\r\n  */\r\n  if((httpcode == 401) && !conn->bits.user_passwd)\r\n    return TRUE;\r\n  if((httpcode == 407) && !conn->bits.proxy_user_passwd)\r\n    return TRUE;\r\n\r\n  return data->state.authproblem;\r\n}\r\n\r\n/*\r\n * readmoredata() is a \"fread() emulation\" to provide POST and/or request\r\n * data. It is used when a huge POST is to be made and the entire chunk wasn't\r\n * sent in the first send(). This function will then be called from the\r\n * transfer.c loop when more data is to be sent to the peer.\r\n *\r\n * Returns the amount of bytes it filled the buffer with.\r\n */\r\nstatic size_t readmoredata(char *buffer,\r\n                           size_t size,\r\n                           size_t nitems,\r\n                           void *userp)\r\n{\r\n  struct connectdata *conn = (struct connectdata *)userp;\r\n  struct HTTP *http = conn->data->state.proto.http;\r\n  size_t fullsize = size * nitems;\r\n\r\n  if(0 == http->postsize)\r\n    /* nothing to return */\r\n    return 0;\r\n\r\n  /* make sure that a HTTP request is never sent away chunked! */\r\n  conn->data->req.forbidchunk = (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE;\r\n\r\n  if(http->postsize <= (curl_off_t)fullsize) {\r\n    memcpy(buffer, http->postdata, (size_t)http->postsize);\r\n    fullsize = (size_t)http->postsize;\r\n\r\n    if(http->backup.postsize) {\r\n      /* move backup data into focus and continue on that */\r\n      http->postdata = http->backup.postdata;\r\n      http->postsize = http->backup.postsize;\r\n      conn->fread_func = http->backup.fread_func;\r\n      conn->fread_in = http->backup.fread_in;\r\n\r\n      http->sending++; /* move one step up */\r\n\r\n      http->backup.postsize=0;\r\n    }\r\n    else\r\n      http->postsize = 0;\r\n\r\n    return fullsize;\r\n  }\r\n\r\n  memcpy(buffer, http->postdata, fullsize);\r\n  http->postdata += fullsize;\r\n  http->postsize -= fullsize;\r\n\r\n  return fullsize;\r\n}\r\n\r\n/* ------------------------------------------------------------------------- */\r\n/* add_buffer functions */\r\n\r\n/*\r\n * Curl_add_buffer_init() sets up and returns a fine buffer struct\r\n */\r\nCurl_send_buffer *Curl_add_buffer_init(void)\r\n{\r\n  return calloc(1, sizeof(Curl_send_buffer));\r\n}\r\n\r\n/*\r\n * Curl_add_buffer_send() sends a header buffer and frees all associated\r\n * memory.  Body data may be appended to the header data if desired.\r\n *\r\n * Returns CURLcode\r\n */\r\nCURLcode Curl_add_buffer_send(Curl_send_buffer *in,\r\n                              struct connectdata *conn,\r\n\r\n                               /* add the number of sent bytes to this\r\n                                  counter */\r\n                              long *bytes_written,\r\n\r\n                               /* how much of the buffer contains body data */\r\n                              size_t included_body_bytes,\r\n                              int socketindex)\r\n\r\n{\r\n  ssize_t amount;\r\n  CURLcode res;\r\n  char *ptr;\r\n  size_t size;\r\n  struct HTTP *http = conn->data->state.proto.http;\r\n  size_t sendsize;\r\n  curl_socket_t sockfd;\r\n  size_t headersize;\r\n\r\n  DEBUGASSERT(socketindex <= SECONDARYSOCKET);\r\n\r\n  sockfd = conn->sock[socketindex];\r\n\r\n  /* The looping below is required since we use non-blocking sockets, but due\r\n     to the circumstances we will just loop and try again and again etc */\r\n\r\n  ptr = in->buffer;\r\n  size = in->size_used;\r\n\r\n  headersize = size - included_body_bytes; /* the initial part that isn't body\r\n                                              is header */\r\n\r\n  DEBUGASSERT(size > included_body_bytes);\r\n\r\n  res = Curl_convert_to_network(conn->data, ptr, headersize);\r\n  /* Curl_convert_to_network calls failf if unsuccessful */\r\n  if(res) {\r\n    /* conversion failed, free memory and return to the caller */\r\n    if(in->buffer)\r\n      free(in->buffer);\r\n    free(in);\r\n    return res;\r\n  }\r\n\r\n  if(conn->handler->flags & PROTOPT_SSL) {\r\n    /* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk\r\n       when we speak HTTPS, as if only a fraction of it is sent now, this data\r\n       needs to fit into the normal read-callback buffer later on and that\r\n       buffer is using this size.\r\n    */\r\n\r\n    sendsize= (size > CURL_MAX_WRITE_SIZE)?CURL_MAX_WRITE_SIZE:size;\r\n\r\n    /* OpenSSL is very picky and we must send the SAME buffer pointer to the\r\n       library when we attempt to re-send this buffer. Sending the same data\r\n       is not enough, we must use the exact same address. For this reason, we\r\n       must copy the data to the uploadbuffer first, since that is the buffer\r\n       we will be using if this send is retried later.\r\n    */\r\n    memcpy(conn->data->state.uploadbuffer, ptr, sendsize);\r\n    ptr = conn->data->state.uploadbuffer;\r\n  }\r\n  else\r\n    sendsize = size;\r\n\r\n  res = Curl_write(conn, sockfd, ptr, sendsize, &amount);\r\n\r\n  if(CURLE_OK == res) {\r\n    /*\r\n     * Note that we may not send the entire chunk at once, and we have a set\r\n     * number of data bytes at the end of the big buffer (out of which we may\r\n     * only send away a part).\r\n     */\r\n    /* how much of the header that was sent */\r\n    size_t headlen = (size_t)amount>headersize?headersize:(size_t)amount;\r\n    size_t bodylen = amount - headlen;\r\n\r\n    if(conn->data->set.verbose) {\r\n      /* this data _may_ contain binary stuff */\r\n      Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, headlen, conn);\r\n      if(bodylen) {\r\n        /* there was body data sent beyond the initial header part, pass that\r\n           on to the debug callback too */\r\n        Curl_debug(conn->data, CURLINFO_DATA_OUT,\r\n                   ptr+headlen, bodylen, conn);\r\n      }\r\n    }\r\n    if(bodylen)\r\n      /* since we sent a piece of the body here, up the byte counter for it\r\n         accordingly */\r\n      http->writebytecount += bodylen;\r\n\r\n    /* 'amount' can never be a very large value here so typecasting it so a\r\n       signed 31 bit value should not cause problems even if ssize_t is\r\n       64bit */\r\n    *bytes_written += (long)amount;\r\n\r\n    if(http) {\r\n      if((size_t)amount != size) {\r\n        /* The whole request could not be sent in one system call. We must\r\n           queue it up and send it later when we get the chance. We must not\r\n           loop here and wait until it might work again. */\r\n\r\n        size -= amount;\r\n\r\n        ptr = in->buffer + amount;\r\n\r\n        /* backup the currently set pointers */\r\n        http->backup.fread_func = conn->fread_func;\r\n        http->backup.fread_in = conn->fread_in;\r\n        http->backup.postdata = http->postdata;\r\n        http->backup.postsize = http->postsize;\r\n\r\n        /* set the new pointers for the request-sending */\r\n        conn->fread_func = (curl_read_callback)readmoredata;\r\n        conn->fread_in = (void *)conn;\r\n        http->postdata = ptr;\r\n        http->postsize = (curl_off_t)size;\r\n\r\n        http->send_buffer = in;\r\n        http->sending = HTTPSEND_REQUEST;\r\n\r\n        return CURLE_OK;\r\n      }\r\n      http->sending = HTTPSEND_BODY;\r\n      /* the full buffer was sent, clean up and return */\r\n    }\r\n    else {\r\n      if((size_t)amount != size)\r\n        /* We have no continue-send mechanism now, fail. This can only happen\r\n           when this function is used from the CONNECT sending function. We\r\n           currently (stupidly) assume that the whole request is always sent\r\n           away in the first single chunk.\r\n\r\n           This needs FIXing.\r\n        */\r\n        return CURLE_SEND_ERROR;\r\n      else\r\n        conn->writechannel_inuse = FALSE;\r\n    }\r\n  }\r\n  if(in->buffer)\r\n    free(in->buffer);\r\n  free(in);\r\n\r\n  return res;\r\n}\r\n\r\n\r\n/*\r\n * add_bufferf() add the formatted input to the buffer.\r\n */\r\nCURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...)\r\n{\r\n  char *s;\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n  s = vaprintf(fmt, ap); /* this allocs a new string to append */\r\n  va_end(ap);\r\n\r\n  if(s) {\r\n    CURLcode result = Curl_add_buffer(in, s, strlen(s));\r\n    free(s);\r\n    return result;\r\n  }\r\n  /* If we failed, we cleanup the whole buffer and return error */\r\n  if(in->buffer)\r\n    free(in->buffer);\r\n  free(in);\r\n  return CURLE_OUT_OF_MEMORY;\r\n}\r\n\r\n/*\r\n * add_buffer() appends a memory chunk to the existing buffer\r\n */\r\nCURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size)\r\n{\r\n  char *new_rb;\r\n  size_t new_size;\r\n\r\n  if(~size < in->size_used) {\r\n    /* If resulting used size of send buffer would wrap size_t, cleanup\r\n       the whole buffer and return error. Otherwise the required buffer\r\n       size will fit into a single allocatable memory chunk */\r\n    Curl_safefree(in->buffer);\r\n    free(in);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  if(!in->buffer ||\r\n     ((in->size_used + size) > (in->size_max - 1))) {\r\n\r\n    /* If current buffer size isn't enough to hold the result, use a\r\n       buffer size that doubles the required size. If this new size\r\n       would wrap size_t, then just use the largest possible one */\r\n\r\n    if((size > (size_t)-1/2) || (in->size_used > (size_t)-1/2) ||\r\n       (~(size*2) < (in->size_used*2)))\r\n      new_size = (size_t)-1;\r\n    else\r\n      new_size = (in->size_used+size)*2;\r\n\r\n    if(in->buffer)\r\n      /* we have a buffer, enlarge the existing one */\r\n      new_rb = realloc(in->buffer, new_size);\r\n    else\r\n      /* create a new buffer */\r\n      new_rb = malloc(new_size);\r\n\r\n    if(!new_rb) {\r\n      /* If we failed, we cleanup the whole buffer and return error */\r\n      Curl_safefree(in->buffer);\r\n      free(in);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    in->buffer = new_rb;\r\n    in->size_max = new_size;\r\n  }\r\n  memcpy(&in->buffer[in->size_used], inptr, size);\r\n\r\n  in->size_used += size;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* end of the add_buffer functions */\r\n/* ------------------------------------------------------------------------- */\r\n\r\n\r\n\r\n/*\r\n * Curl_compareheader()\r\n *\r\n * Returns TRUE if 'headerline' contains the 'header' with given 'content'.\r\n * Pass headers WITH the colon.\r\n */\r\nbool\r\nCurl_compareheader(const char *headerline, /* line to check */\r\n                   const char *header,  /* header keyword _with_ colon */\r\n                   const char *content) /* content string to find */\r\n{\r\n  /* RFC2616, section 4.2 says: \"Each header field consists of a name followed\r\n   * by a colon (\":\") and the field value. Field names are case-insensitive.\r\n   * The field value MAY be preceded by any amount of LWS, though a single SP\r\n   * is preferred.\" */\r\n\r\n  size_t hlen = strlen(header);\r\n  size_t clen;\r\n  size_t len;\r\n  const char *start;\r\n  const char *end;\r\n\r\n  if(!Curl_raw_nequal(headerline, header, hlen))\r\n    return FALSE; /* doesn't start with header */\r\n\r\n  /* pass the header */\r\n  start = &headerline[hlen];\r\n\r\n  /* pass all white spaces */\r\n  while(*start && ISSPACE(*start))\r\n    start++;\r\n\r\n  /* find the end of the header line */\r\n  end = strchr(start, '\\r'); /* lines end with CRLF */\r\n  if(!end) {\r\n    /* in case there's a non-standard compliant line here */\r\n    end = strchr(start, '\\n');\r\n\r\n    if(!end)\r\n      /* hm, there's no line ending here, use the zero byte! */\r\n      end = strchr(start, '\\0');\r\n  }\r\n\r\n  len = end-start; /* length of the content part of the input line */\r\n  clen = strlen(content); /* length of the word to find */\r\n\r\n  /* find the content string in the rest of the line */\r\n  for(;len>=clen;len--, start++) {\r\n    if(Curl_raw_nequal(start, content, clen))\r\n      return TRUE; /* match! */\r\n  }\r\n\r\n  return FALSE; /* no match */\r\n}\r\n\r\n/*\r\n * Curl_http_connect() performs HTTP stuff to do at connect-time, called from\r\n * the generic Curl_connect().\r\n */\r\nCURLcode Curl_http_connect(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result;\r\n\r\n  /* We default to persistent connections. We set this already in this connect\r\n     function to make the re-use checks properly be able to check this bit. */\r\n  conn->bits.close = FALSE;\r\n\r\n  /* the CONNECT procedure might not have been completed */\r\n  result = Curl_proxy_connect(conn);\r\n  if(result)\r\n    return result;\r\n\r\n  if(conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)\r\n    /* nothing else to do except wait right now - we're not done here. */\r\n    return CURLE_OK;\r\n\r\n  if(conn->given->flags & PROTOPT_SSL) {\r\n    /* perform SSL initialization */\r\n    result = https_connecting(conn, done);\r\n    if(result)\r\n      return result;\r\n  }\r\n  else\r\n    *done = TRUE;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* this returns the socket to wait for in the DO and DOING state for the multi\r\n   interface and then we're always _sending_ a request and thus we wait for\r\n   the single socket to become writable only */\r\nstatic int http_getsock_do(struct connectdata *conn,\r\n                           curl_socket_t *socks,\r\n                           int numsocks)\r\n{\r\n  /* write mode */\r\n  (void)numsocks; /* unused, we trust it to be at least 1 */\r\n  socks[0] = conn->sock[FIRSTSOCKET];\r\n  return GETSOCK_WRITESOCK(0);\r\n}\r\n\r\n#ifdef USE_SSL\r\nstatic CURLcode https_connecting(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result;\r\n  DEBUGASSERT((conn) && (conn->handler->flags & PROTOPT_SSL));\r\n\r\n  /* perform SSL initialization for this socket */\r\n  result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, done);\r\n  if(result)\r\n    conn->bits.close = TRUE; /* a failed connection is marked for closure\r\n                                to prevent (bad) re-use or similar */\r\n  return result;\r\n}\r\n#endif\r\n\r\n#if defined(USE_SSLEAY) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \\\r\n    defined(USE_DARWINSSL)\r\n/* This function is for OpenSSL, GnuTLS, darwinssl, and schannel only.\r\n   It should be made to query the generic SSL layer instead. */\r\nstatic int https_getsock(struct connectdata *conn,\r\n                         curl_socket_t *socks,\r\n                         int numsocks)\r\n{\r\n  if(conn->handler->flags & PROTOPT_SSL) {\r\n    struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];\r\n\r\n    if(!numsocks)\r\n      return GETSOCK_BLANK;\r\n\r\n    if(connssl->connecting_state == ssl_connect_2_writing) {\r\n      /* write mode */\r\n      socks[0] = conn->sock[FIRSTSOCKET];\r\n      return GETSOCK_WRITESOCK(0);\r\n    }\r\n    else if(connssl->connecting_state == ssl_connect_2_reading) {\r\n      /* read mode */\r\n      socks[0] = conn->sock[FIRSTSOCKET];\r\n      return GETSOCK_READSOCK(0);\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n#else\r\n#ifdef USE_SSL\r\nstatic int https_getsock(struct connectdata *conn,\r\n                         curl_socket_t *socks,\r\n                         int numsocks)\r\n{\r\n  (void)conn;\r\n  (void)socks;\r\n  (void)numsocks;\r\n  return GETSOCK_BLANK;\r\n}\r\n#endif /* USE_SSL */\r\n#endif /* USE_SSLEAY || USE_GNUTLS || USE_SCHANNEL */\r\n\r\n/*\r\n * Curl_http_done() gets called from Curl_done() after a single HTTP request\r\n * has been performed.\r\n */\r\n\r\nCURLcode Curl_http_done(struct connectdata *conn,\r\n                        CURLcode status, bool premature)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct HTTP *http =data->state.proto.http;\r\n\r\n  Curl_unencode_cleanup(conn);\r\n\r\n  /* set the proper values (possibly modified on POST) */\r\n  conn->fread_func = data->set.fread_func; /* restore */\r\n  conn->fread_in = data->set.in; /* restore */\r\n  conn->seek_func = data->set.seek_func; /* restore */\r\n  conn->seek_client = data->set.seek_client; /* restore */\r\n\r\n  if(http == NULL)\r\n    return CURLE_OK;\r\n\r\n  if(http->send_buffer) {\r\n    Curl_send_buffer *buff = http->send_buffer;\r\n\r\n    free(buff->buffer);\r\n    free(buff);\r\n    http->send_buffer = NULL; /* clear the pointer */\r\n  }\r\n\r\n  if(HTTPREQ_POST_FORM == data->set.httpreq) {\r\n    data->req.bytecount = http->readbytecount + http->writebytecount;\r\n\r\n    Curl_formclean(&http->sendit); /* Now free that whole lot */\r\n    if(http->form.fp) {\r\n      /* a file being uploaded was left opened, close it! */\r\n      fclose(http->form.fp);\r\n      http->form.fp = NULL;\r\n    }\r\n  }\r\n  else if(HTTPREQ_PUT == data->set.httpreq)\r\n    data->req.bytecount = http->readbytecount + http->writebytecount;\r\n\r\n  if(status != CURLE_OK)\r\n    return (status);\r\n\r\n  if(!premature && /* this check is pointless when DONE is called before the\r\n                      entire operation is complete */\r\n     !conn->bits.retry &&\r\n     ((http->readbytecount +\r\n       data->req.headerbytecount -\r\n       data->req.deductheadercount)) <= 0) {\r\n    /* If this connection isn't simply closed to be retried, AND nothing was\r\n       read from the HTTP server (that counts), this can't be right so we\r\n       return an error here */\r\n    failf(data, \"Empty reply from server\");\r\n    return CURLE_GOT_NOTHING;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/* Determine if we should use HTTP 1.1 for this request. Reasons to avoid it\r\n   are if the user specifically requested HTTP 1.0, if the server we are\r\n   connected to only supports 1.0, or if any server previously contacted to\r\n   handle this request only supports 1.0. */\r\nstatic bool use_http_1_1(const struct SessionHandle *data,\r\n                         const struct connectdata *conn)\r\n{\r\n  return ((data->set.httpversion == CURL_HTTP_VERSION_1_1) ||\r\n         ((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&\r\n          ((conn->httpversion == 11) ||\r\n           ((conn->httpversion != 10) &&\r\n            (data->state.httpversion != 10))))) ? TRUE : FALSE;\r\n}\r\n\r\n/* check and possibly add an Expect: header */\r\nstatic CURLcode expect100(struct SessionHandle *data,\r\n                          struct connectdata *conn,\r\n                          Curl_send_buffer *req_buffer)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  const char *ptr;\r\n  data->state.expect100header = FALSE; /* default to false unless it is set\r\n                                          to TRUE below */\r\n  if(use_http_1_1(data, conn)) {\r\n    /* if not doing HTTP 1.0 or disabled explicitly, we add a Expect:\r\n       100-continue to the headers which actually speeds up post operations\r\n       (as there is one packet coming back from the web server) */\r\n    ptr = Curl_checkheaders(data, \"Expect:\");\r\n    if(ptr) {\r\n      data->state.expect100header =\r\n        Curl_compareheader(ptr, \"Expect:\", \"100-continue\");\r\n    }\r\n    else {\r\n      result = Curl_add_bufferf(req_buffer,\r\n                         \"Expect: 100-continue\\r\\n\");\r\n      if(result == CURLE_OK)\r\n        data->state.expect100header = TRUE;\r\n    }\r\n  }\r\n  return result;\r\n}\r\n\r\nCURLcode Curl_add_custom_headers(struct connectdata *conn,\r\n                                   Curl_send_buffer *req_buffer)\r\n{\r\n  char *ptr;\r\n  struct curl_slist *headers=conn->data->set.headers;\r\n\r\n  while(headers) {\r\n    ptr = strchr(headers->data, ':');\r\n    if(ptr) {\r\n      /* we require a colon for this to be a true header */\r\n\r\n      ptr++; /* pass the colon */\r\n      while(*ptr && ISSPACE(*ptr))\r\n        ptr++;\r\n\r\n      if(*ptr) {\r\n        /* only send this if the contents was non-blank */\r\n\r\n        if(conn->allocptr.host &&\r\n           /* a Host: header was sent already, don't pass on any custom Host:\r\n              header as that will produce *two* in the same request! */\r\n           checkprefix(\"Host:\", headers->data))\r\n          ;\r\n        else if(conn->data->set.httpreq == HTTPREQ_POST_FORM &&\r\n                /* this header (extended by formdata.c) is sent later */\r\n                checkprefix(\"Content-Type:\", headers->data))\r\n          ;\r\n        else if(conn->bits.authneg &&\r\n                /* while doing auth neg, don't allow the custom length since\r\n                   we will force length zero then */\r\n                checkprefix(\"Content-Length\", headers->data))\r\n          ;\r\n        else if(conn->allocptr.te &&\r\n                /* when asking for Transfer-Encoding, don't pass on a custom\r\n                   Connection: */\r\n                checkprefix(\"Connection\", headers->data))\r\n          ;\r\n        else {\r\n          CURLcode result = Curl_add_bufferf(req_buffer, \"%s\\r\\n\",\r\n                                             headers->data);\r\n          if(result)\r\n            return result;\r\n        }\r\n      }\r\n    }\r\n    else {\r\n      ptr = strchr(headers->data, ';');\r\n      if(ptr) {\r\n\r\n        ptr++; /* pass the semicolon */\r\n        while(*ptr && ISSPACE(*ptr))\r\n          ptr++;\r\n\r\n        if(*ptr) {\r\n          /* this may be used for something else in the future */\r\n        }\r\n        else {\r\n          if(*(--ptr) == ';') {\r\n            CURLcode result;\r\n\r\n            /* send no-value custom header if terminated by semicolon */\r\n            *ptr = ':';\r\n            result = Curl_add_bufferf(req_buffer, \"%s\\r\\n\",\r\n                                             headers->data);\r\n            if(result)\r\n              return result;\r\n          }\r\n        }\r\n      }\r\n    }\r\n    headers = headers->next;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_add_timecondition(struct SessionHandle *data,\r\n                                Curl_send_buffer *req_buffer)\r\n{\r\n  const struct tm *tm;\r\n  char *buf = data->state.buffer;\r\n  CURLcode result = CURLE_OK;\r\n  struct tm keeptime;\r\n\r\n  result = Curl_gmtime(data->set.timevalue, &keeptime);\r\n  if(result) {\r\n    failf(data, \"Invalid TIMEVALUE\");\r\n    return result;\r\n  }\r\n  tm = &keeptime;\r\n\r\n  /* The If-Modified-Since header family should have their times set in\r\n   * GMT as RFC2616 defines: \"All HTTP date/time stamps MUST be\r\n   * represented in Greenwich Mean Time (GMT), without exception. For the\r\n   * purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal\r\n   * Time).\" (see page 20 of RFC2616).\r\n   */\r\n\r\n  /* format: \"Tue, 15 Nov 1994 12:45:26 GMT\" */\r\n  snprintf(buf, BUFSIZE-1,\r\n           \"%s, %02d %s %4d %02d:%02d:%02d GMT\",\r\n           Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],\r\n           tm->tm_mday,\r\n           Curl_month[tm->tm_mon],\r\n           tm->tm_year + 1900,\r\n           tm->tm_hour,\r\n           tm->tm_min,\r\n           tm->tm_sec);\r\n\r\n  switch(data->set.timecondition) {\r\n  case CURL_TIMECOND_IFMODSINCE:\r\n  default:\r\n    result = Curl_add_bufferf(req_buffer,\r\n                              \"If-Modified-Since: %s\\r\\n\", buf);\r\n    break;\r\n  case CURL_TIMECOND_IFUNMODSINCE:\r\n    result = Curl_add_bufferf(req_buffer,\r\n                              \"If-Unmodified-Since: %s\\r\\n\", buf);\r\n    break;\r\n  case CURL_TIMECOND_LASTMOD:\r\n    result = Curl_add_bufferf(req_buffer,\r\n                              \"Last-Modified: %s\\r\\n\", buf);\r\n    break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * Curl_http() gets called from the generic Curl_do() function when a HTTP\r\n * request is to be performed. This creates and sends a properly constructed\r\n * HTTP request.\r\n */\r\nCURLcode Curl_http(struct connectdata *conn, bool *done)\r\n{\r\n  struct SessionHandle *data=conn->data;\r\n  CURLcode result=CURLE_OK;\r\n  struct HTTP *http;\r\n  const char *ppath = data->state.path;\r\n  bool paste_ftp_userpwd = FALSE;\r\n  char ftp_typecode[sizeof(\"/;type=?\")] = \"\";\r\n  const char *host = conn->host.name;\r\n  const char *te = \"\"; /* transfer-encoding */\r\n  const char *ptr;\r\n  const char *request;\r\n  Curl_HttpReq httpreq = data->set.httpreq;\r\n  char *addcookies = NULL;\r\n  curl_off_t included_body = 0;\r\n  const char *httpstring;\r\n  Curl_send_buffer *req_buffer;\r\n  curl_off_t postsize = 0; /* curl_off_t to handle large file sizes */\r\n  int seekerr = CURL_SEEKFUNC_OK;\r\n\r\n  /* Always consider the DO phase done after this function call, even if there\r\n     may be parts of the request that is not yet sent, since we can deal with\r\n     the rest of the request in the PERFORM phase. */\r\n  *done = TRUE;\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  if(!data->state.proto.http) {\r\n    /* Only allocate this struct if we don't already have it! */\r\n\r\n    http = calloc(1, sizeof(struct HTTP));\r\n    if(!http)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    data->state.proto.http = http;\r\n  }\r\n  else\r\n    http = data->state.proto.http;\r\n\r\n  if(!data->state.this_is_a_follow) {\r\n    /* this is not a followed location, get the original host name */\r\n    if(data->state.first_host)\r\n      /* Free to avoid leaking memory on multiple requests*/\r\n      free(data->state.first_host);\r\n\r\n    data->state.first_host = strdup(conn->host.name);\r\n    if(!data->state.first_host)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  http->writebytecount = http->readbytecount = 0;\r\n\r\n  if((conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_FTP)) &&\r\n     data->set.upload) {\r\n    httpreq = HTTPREQ_PUT;\r\n  }\r\n\r\n  /* Now set the 'request' pointer to the proper request string */\r\n  if(data->set.str[STRING_CUSTOMREQUEST])\r\n    request = data->set.str[STRING_CUSTOMREQUEST];\r\n  else {\r\n    if(data->set.opt_no_body)\r\n      request = \"HEAD\";\r\n    else {\r\n      DEBUGASSERT((httpreq > HTTPREQ_NONE) && (httpreq < HTTPREQ_LAST));\r\n      switch(httpreq) {\r\n      case HTTPREQ_POST:\r\n      case HTTPREQ_POST_FORM:\r\n        request = \"POST\";\r\n        break;\r\n      case HTTPREQ_PUT:\r\n        request = \"PUT\";\r\n        break;\r\n      default: /* this should never happen */\r\n      case HTTPREQ_GET:\r\n        request = \"GET\";\r\n        break;\r\n      case HTTPREQ_HEAD:\r\n        request = \"HEAD\";\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* The User-Agent string might have been allocated in url.c already, because\r\n     it might have been used in the proxy connect, but if we have got a header\r\n     with the user-agent string specified, we erase the previously made string\r\n     here. */\r\n  if(Curl_checkheaders(data, \"User-Agent:\") && conn->allocptr.uagent) {\r\n    free(conn->allocptr.uagent);\r\n    conn->allocptr.uagent=NULL;\r\n  }\r\n\r\n  /* setup the authentication headers */\r\n  result = Curl_http_output_auth(conn, request, ppath, FALSE);\r\n  if(result)\r\n    return result;\r\n\r\n  if((data->state.authhost.multi || data->state.authproxy.multi) &&\r\n     (httpreq != HTTPREQ_GET) &&\r\n     (httpreq != HTTPREQ_HEAD)) {\r\n    /* Auth is required and we are not authenticated yet. Make a PUT or POST\r\n       with content-length zero as a \"probe\". */\r\n    conn->bits.authneg = TRUE;\r\n  }\r\n  else\r\n    conn->bits.authneg = FALSE;\r\n\r\n  Curl_safefree(conn->allocptr.ref);\r\n  if(data->change.referer && !Curl_checkheaders(data, \"Referer:\"))\r\n    conn->allocptr.ref = aprintf(\"Referer: %s\\r\\n\", data->change.referer);\r\n  else\r\n    conn->allocptr.ref = NULL;\r\n\r\n  if(data->set.str[STRING_COOKIE] && !Curl_checkheaders(data, \"Cookie:\"))\r\n    addcookies = data->set.str[STRING_COOKIE];\r\n\r\n  if(!Curl_checkheaders(data, \"Accept-Encoding:\") &&\r\n     data->set.str[STRING_ENCODING]) {\r\n    Curl_safefree(conn->allocptr.accept_encoding);\r\n    conn->allocptr.accept_encoding =\r\n      aprintf(\"Accept-Encoding: %s\\r\\n\", data->set.str[STRING_ENCODING]);\r\n    if(!conn->allocptr.accept_encoding)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n#ifdef HAVE_LIBZ\r\n  /* we only consider transfer-encoding magic if libz support is built-in */\r\n\r\n  if(!Curl_checkheaders(data, \"TE:\") && data->set.http_transfer_encoding) {\r\n    /* When we are to insert a TE: header in the request, we must also insert\r\n       TE in a Connection: header, so we need to merge the custom provided\r\n       Connection: header and prevent the original to get sent. Note that if\r\n       the user has inserted his/hers own TE: header we don't do this magic\r\n       but then assume that the user will handle it all! */\r\n    char *cptr = Curl_checkheaders(data, \"Connection:\");\r\n#define TE_HEADER \"TE: gzip\\r\\n\"\r\n\r\n    Curl_safefree(conn->allocptr.te);\r\n\r\n    /* Create the (updated) Connection: header */\r\n    conn->allocptr.te = cptr? aprintf(\"%s, TE\\r\\n\" TE_HEADER, cptr):\r\n      strdup(\"Connection: TE\\r\\n\" TE_HEADER);\r\n\r\n    if(!conn->allocptr.te)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n#endif\r\n\r\n  ptr = Curl_checkheaders(data, \"Transfer-Encoding:\");\r\n  if(ptr) {\r\n    /* Some kind of TE is requested, check if 'chunked' is chosen */\r\n    data->req.upload_chunky =\r\n      Curl_compareheader(ptr, \"Transfer-Encoding:\", \"chunked\");\r\n  }\r\n  else {\r\n    if((conn->handler->protocol&CURLPROTO_HTTP) &&\r\n       data->set.upload &&\r\n       (data->set.infilesize == -1)) {\r\n      if(conn->bits.authneg)\r\n        /* don't enable chunked during auth neg */\r\n        ;\r\n      else if(use_http_1_1(data, conn)) {\r\n        /* HTTP, upload, unknown file size and not HTTP 1.0 */\r\n        data->req.upload_chunky = TRUE;\r\n      }\r\n      else {\r\n        failf(data, \"Chunky upload is not supported by HTTP 1.0\");\r\n        return CURLE_UPLOAD_FAILED;\r\n      }\r\n    }\r\n    else {\r\n      /* else, no chunky upload */\r\n      data->req.upload_chunky = FALSE;\r\n    }\r\n\r\n    if(data->req.upload_chunky)\r\n      te = \"Transfer-Encoding: chunked\\r\\n\";\r\n  }\r\n\r\n  Curl_safefree(conn->allocptr.host);\r\n\r\n  ptr = Curl_checkheaders(data, \"Host:\");\r\n  if(ptr && (!data->state.this_is_a_follow ||\r\n             Curl_raw_equal(data->state.first_host, conn->host.name))) {\r\n#if !defined(CURL_DISABLE_COOKIES)\r\n    /* If we have a given custom Host: header, we extract the host name in\r\n       order to possibly use it for cookie reasons later on. We only allow the\r\n       custom Host: header if this is NOT a redirect, as setting Host: in the\r\n       redirected request is being out on thin ice. Except if the host name\r\n       is the same as the first one! */\r\n    char *cookiehost = copy_header_value(ptr);\r\n    if(!cookiehost)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    if(!*cookiehost)\r\n      /* ignore empty data */\r\n      free(cookiehost);\r\n    else {\r\n      /* If the host begins with '[', we start searching for the port after\r\n         the bracket has been closed */\r\n      int startsearch = 0;\r\n      if(*cookiehost == '[') {\r\n        char *closingbracket;\r\n        /* since the 'cookiehost' is an allocated memory area that will be\r\n           freed later we cannot simply increment the pointer */\r\n        memmove(cookiehost, cookiehost + 1, strlen(cookiehost) - 1);\r\n        closingbracket = strchr(cookiehost, ']');\r\n        if(closingbracket)\r\n          *closingbracket = 0;\r\n      }\r\n      else {\r\n        char *colon = strchr(cookiehost + startsearch, ':');\r\n        if(colon)\r\n          *colon = 0; /* The host must not include an embedded port number */\r\n      }\r\n      Curl_safefree(conn->allocptr.cookiehost);\r\n      conn->allocptr.cookiehost = cookiehost;\r\n    }\r\n#endif\r\n\r\n    conn->allocptr.host = NULL;\r\n  }\r\n  else {\r\n    /* When building Host: headers, we must put the host name within\r\n       [brackets] if the host name is a plain IPv6-address. RFC2732-style. */\r\n\r\n    if(((conn->given->protocol&CURLPROTO_HTTPS) &&\r\n        (conn->remote_port == PORT_HTTPS)) ||\r\n       ((conn->given->protocol&CURLPROTO_HTTP) &&\r\n        (conn->remote_port == PORT_HTTP)) )\r\n      /* if(HTTPS on port 443) OR (HTTP on port 80) then don't include\r\n         the port number in the host string */\r\n      conn->allocptr.host = aprintf(\"Host: %s%s%s\\r\\n\",\r\n                                    conn->bits.ipv6_ip?\"[\":\"\",\r\n                                    host,\r\n                                    conn->bits.ipv6_ip?\"]\":\"\");\r\n    else\r\n      conn->allocptr.host = aprintf(\"Host: %s%s%s:%hu\\r\\n\",\r\n                                    conn->bits.ipv6_ip?\"[\":\"\",\r\n                                    host,\r\n                                    conn->bits.ipv6_ip?\"]\":\"\",\r\n                                    conn->remote_port);\r\n\r\n    if(!conn->allocptr.host)\r\n      /* without Host: we can't make a nice request */\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n  if(conn->bits.httpproxy && !conn->bits.tunnel_proxy)  {\r\n    /* Using a proxy but does not tunnel through it */\r\n\r\n    /* The path sent to the proxy is in fact the entire URL. But if the remote\r\n       host is a IDN-name, we must make sure that the request we produce only\r\n       uses the encoded host name! */\r\n    if(conn->host.dispname != conn->host.name) {\r\n      char *url = data->change.url;\r\n      ptr = strstr(url, conn->host.dispname);\r\n      if(ptr) {\r\n        /* This is where the display name starts in the URL, now replace this\r\n           part with the encoded name. TODO: This method of replacing the host\r\n           name is rather crude as I believe there's a slight risk that the\r\n           user has entered a user name or password that contain the host name\r\n           string. */\r\n        size_t currlen = strlen(conn->host.dispname);\r\n        size_t newlen = strlen(conn->host.name);\r\n        size_t urllen = strlen(url);\r\n\r\n        char *newurl;\r\n\r\n        newurl = malloc(urllen + newlen - currlen + 1);\r\n        if(newurl) {\r\n          /* copy the part before the host name */\r\n          memcpy(newurl, url, ptr - url);\r\n          /* append the new host name instead of the old */\r\n          memcpy(newurl + (ptr - url), conn->host.name, newlen);\r\n          /* append the piece after the host name */\r\n          memcpy(newurl + newlen + (ptr - url),\r\n                 ptr + currlen, /* copy the trailing zero byte too */\r\n                 urllen - (ptr-url) - currlen + 1);\r\n          if(data->change.url_alloc) {\r\n            Curl_safefree(data->change.url);\r\n            data->change.url_alloc = FALSE;\r\n          }\r\n          data->change.url = newurl;\r\n          data->change.url_alloc = TRUE;\r\n        }\r\n        else\r\n          return CURLE_OUT_OF_MEMORY;\r\n      }\r\n    }\r\n    ppath = data->change.url;\r\n    if(checkprefix(\"ftp://\", ppath)) {\r\n      if(data->set.proxy_transfer_mode) {\r\n        /* when doing ftp, append ;type=<a|i> if not present */\r\n        char *type = strstr(ppath, \";type=\");\r\n        if(type && type[6] && type[7] == 0) {\r\n          switch (Curl_raw_toupper(type[6])) {\r\n          case 'A':\r\n          case 'D':\r\n          case 'I':\r\n            break;\r\n          default:\r\n            type = NULL;\r\n          }\r\n        }\r\n        if(!type) {\r\n          char *p = ftp_typecode;\r\n          /* avoid sending invalid URLs like ftp://example.com;type=i if the\r\n           * user specified ftp://example.com without the slash */\r\n          if(!*data->state.path && ppath[strlen(ppath) - 1] != '/') {\r\n            *p++ = '/';\r\n          }\r\n          snprintf(p, sizeof(ftp_typecode) - 1, \";type=%c\",\r\n                   data->set.prefer_ascii ? 'a' : 'i');\r\n        }\r\n      }\r\n      if(conn->bits.user_passwd && !conn->bits.userpwd_in_url)\r\n        paste_ftp_userpwd = TRUE;\r\n    }\r\n  }\r\n#endif /* CURL_DISABLE_PROXY */\r\n\r\n  if(HTTPREQ_POST_FORM == httpreq) {\r\n    /* we must build the whole post sequence first, so that we have a size of\r\n       the whole transfer before we start to send it */\r\n    result = Curl_getformdata(data, &http->sendit, data->set.httppost,\r\n                              Curl_checkheaders(data, \"Content-Type:\"),\r\n                              &http->postsize);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  http->p_accept = Curl_checkheaders(data, \"Accept:\")?NULL:\"Accept: */*\\r\\n\";\r\n\r\n  if(( (HTTPREQ_POST == httpreq) ||\r\n       (HTTPREQ_POST_FORM == httpreq) ||\r\n       (HTTPREQ_PUT == httpreq) ) &&\r\n     data->state.resume_from) {\r\n    /**********************************************************************\r\n     * Resuming upload in HTTP means that we PUT or POST and that we have\r\n     * got a resume_from value set. The resume value has already created\r\n     * a Range: header that will be passed along. We need to \"fast forward\"\r\n     * the file the given number of bytes and decrease the assume upload\r\n     * file size before we continue this venture in the dark lands of HTTP.\r\n     *********************************************************************/\r\n\r\n    if(data->state.resume_from < 0 ) {\r\n      /*\r\n       * This is meant to get the size of the present remote-file by itself.\r\n       * We don't support this now. Bail out!\r\n       */\r\n      data->state.resume_from = 0;\r\n    }\r\n\r\n    if(data->state.resume_from && !data->state.this_is_a_follow) {\r\n      /* do we still game? */\r\n\r\n      /* Now, let's read off the proper amount of bytes from the\r\n         input. */\r\n      if(conn->seek_func) {\r\n        seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,\r\n                                  SEEK_SET);\r\n      }\r\n\r\n      if(seekerr != CURL_SEEKFUNC_OK) {\r\n        if(seekerr != CURL_SEEKFUNC_CANTSEEK) {\r\n          failf(data, \"Could not seek stream\");\r\n          return CURLE_READ_ERROR;\r\n        }\r\n        /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */\r\n        else {\r\n          curl_off_t passed=0;\r\n          do {\r\n            size_t readthisamountnow =\r\n              (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?\r\n              BUFSIZE : curlx_sotouz(data->state.resume_from - passed);\r\n\r\n            size_t actuallyread =\r\n              data->set.fread_func(data->state.buffer, 1, readthisamountnow,\r\n                                   data->set.in);\r\n\r\n            passed += actuallyread;\r\n            if((actuallyread == 0) || (actuallyread > readthisamountnow)) {\r\n              /* this checks for greater-than only to make sure that the\r\n                 CURL_READFUNC_ABORT return code still aborts */\r\n              failf(data, \"Could only read %\" FORMAT_OFF_T\r\n                    \" bytes from the input\",\r\n                    passed);\r\n              return CURLE_READ_ERROR;\r\n            }\r\n          } while(passed < data->state.resume_from);\r\n        }\r\n      }\r\n\r\n      /* now, decrease the size of the read */\r\n      if(data->set.infilesize>0) {\r\n        data->set.infilesize -= data->state.resume_from;\r\n\r\n        if(data->set.infilesize <= 0) {\r\n          failf(data, \"File already completely uploaded\");\r\n          return CURLE_PARTIAL_FILE;\r\n        }\r\n      }\r\n      /* we've passed, proceed as normal */\r\n    }\r\n  }\r\n  if(data->state.use_range) {\r\n    /*\r\n     * A range is selected. We use different headers whether we're downloading\r\n     * or uploading and we always let customized headers override our internal\r\n     * ones if any such are specified.\r\n     */\r\n    if(((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) &&\r\n       !Curl_checkheaders(data, \"Range:\")) {\r\n      /* if a line like this was already allocated, free the previous one */\r\n      if(conn->allocptr.rangeline)\r\n        free(conn->allocptr.rangeline);\r\n      conn->allocptr.rangeline = aprintf(\"Range: bytes=%s\\r\\n\",\r\n                                         data->state.range);\r\n    }\r\n    else if((httpreq != HTTPREQ_GET) &&\r\n            !Curl_checkheaders(data, \"Content-Range:\")) {\r\n\r\n      /* if a line like this was already allocated, free the previous one */\r\n      if(conn->allocptr.rangeline)\r\n        free(conn->allocptr.rangeline);\r\n\r\n      if(data->set.set_resume_from < 0) {\r\n        /* Upload resume was asked for, but we don't know the size of the\r\n           remote part so we tell the server (and act accordingly) that we\r\n           upload the whole file (again) */\r\n        conn->allocptr.rangeline =\r\n          aprintf(\"Content-Range: bytes 0-%\" FORMAT_OFF_T\r\n                  \"/%\" FORMAT_OFF_T \"\\r\\n\",\r\n                  data->set.infilesize - 1, data->set.infilesize);\r\n\r\n      }\r\n      else if(data->state.resume_from) {\r\n        /* This is because \"resume\" was selected */\r\n        curl_off_t total_expected_size=\r\n          data->state.resume_from + data->set.infilesize;\r\n        conn->allocptr.rangeline =\r\n          aprintf(\"Content-Range: bytes %s%\" FORMAT_OFF_T\r\n                  \"/%\" FORMAT_OFF_T \"\\r\\n\",\r\n                  data->state.range, total_expected_size-1,\r\n                  total_expected_size);\r\n      }\r\n      else {\r\n        /* Range was selected and then we just pass the incoming range and\r\n           append total size */\r\n        conn->allocptr.rangeline =\r\n          aprintf(\"Content-Range: bytes %s/%\" FORMAT_OFF_T \"\\r\\n\",\r\n                  data->state.range, data->set.infilesize);\r\n      }\r\n      if(!conn->allocptr.rangeline)\r\n        return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* Use 1.1 unless the user specifically asked for 1.0 or the server only\r\n     supports 1.0 */\r\n  httpstring= use_http_1_1(data, conn)?\"1.1\":\"1.0\";\r\n\r\n  /* initialize a dynamic send-buffer */\r\n  req_buffer = Curl_add_buffer_init();\r\n\r\n  if(!req_buffer)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* add the main request stuff */\r\n  /* GET/HEAD/POST/PUT */\r\n  result = Curl_add_bufferf(req_buffer, \"%s \", request);\r\n  if(result)\r\n    return result;\r\n\r\n  /* url */\r\n  if(paste_ftp_userpwd)\r\n    result = Curl_add_bufferf(req_buffer, \"ftp://%s:%s@%s\",\r\n                              conn->user, conn->passwd,\r\n                              ppath + sizeof(\"ftp://\") - 1);\r\n  else\r\n    result = Curl_add_buffer(req_buffer, ppath, strlen(ppath));\r\n  if(result)\r\n    return result;\r\n\r\n  result =\r\n    Curl_add_bufferf(req_buffer,\r\n                     \"%s\" /* ftp typecode (;type=x) */\r\n                     \" HTTP/%s\\r\\n\" /* HTTP version */\r\n                     \"%s\" /* proxyuserpwd */\r\n                     \"%s\" /* userpwd */\r\n                     \"%s\" /* range */\r\n                     \"%s\" /* user agent */\r\n                     \"%s\" /* host */\r\n                     \"%s\" /* accept */\r\n                     \"%s\" /* TE: */\r\n                     \"%s\" /* accept-encoding */\r\n                     \"%s\" /* referer */\r\n                     \"%s\" /* Proxy-Connection */\r\n                     \"%s\",/* transfer-encoding */\r\n\r\n                     ftp_typecode,\r\n                     httpstring,\r\n                     conn->allocptr.proxyuserpwd?\r\n                     conn->allocptr.proxyuserpwd:\"\",\r\n                     conn->allocptr.userpwd?conn->allocptr.userpwd:\"\",\r\n                     (data->state.use_range && conn->allocptr.rangeline)?\r\n                     conn->allocptr.rangeline:\"\",\r\n                     (data->set.str[STRING_USERAGENT] &&\r\n                      *data->set.str[STRING_USERAGENT] &&\r\n                      conn->allocptr.uagent)?\r\n                     conn->allocptr.uagent:\"\",\r\n                     (conn->allocptr.host?conn->allocptr.host:\"\"),\r\n                     http->p_accept?http->p_accept:\"\",\r\n                     conn->allocptr.te?conn->allocptr.te:\"\",\r\n                     (data->set.str[STRING_ENCODING] &&\r\n                      *data->set.str[STRING_ENCODING] &&\r\n                      conn->allocptr.accept_encoding)?\r\n                     conn->allocptr.accept_encoding:\"\",\r\n                     (data->change.referer && conn->allocptr.ref)?\r\n                     conn->allocptr.ref:\"\" /* Referer: <data> */,\r\n                     (conn->bits.httpproxy &&\r\n                      !conn->bits.tunnel_proxy &&\r\n                      !Curl_checkheaders(data, \"Proxy-Connection:\"))?\r\n                     \"Proxy-Connection: Keep-Alive\\r\\n\":\"\",\r\n                     te\r\n      );\r\n\r\n  /*\r\n   * Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM\r\n   * with basic and digest, it will be freed anyway by the next request\r\n   */\r\n\r\n  Curl_safefree (conn->allocptr.userpwd);\r\n  conn->allocptr.userpwd = NULL;\r\n\r\n  if(result)\r\n    return result;\r\n\r\n#if !defined(CURL_DISABLE_COOKIES)\r\n  if(data->cookies || addcookies) {\r\n    struct Cookie *co=NULL; /* no cookies from start */\r\n    int count=0;\r\n\r\n    if(data->cookies) {\r\n      Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);\r\n      co = Curl_cookie_getlist(data->cookies,\r\n                               conn->allocptr.cookiehost?\r\n                               conn->allocptr.cookiehost:host,\r\n                               data->state.path,\r\n                               (conn->handler->protocol&CURLPROTO_HTTPS)?\r\n                               TRUE:FALSE);\r\n      Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);\r\n    }\r\n    if(co) {\r\n      struct Cookie *store=co;\r\n      /* now loop through all cookies that matched */\r\n      while(co) {\r\n        if(co->value) {\r\n          if(0 == count) {\r\n            result = Curl_add_bufferf(req_buffer, \"Cookie: \");\r\n            if(result)\r\n              break;\r\n          }\r\n          result = Curl_add_bufferf(req_buffer,\r\n                                    \"%s%s=%s\", count?\"; \":\"\",\r\n                                    co->name, co->value);\r\n          if(result)\r\n            break;\r\n          count++;\r\n        }\r\n        co = co->next; /* next cookie please */\r\n      }\r\n      Curl_cookie_freelist(store, FALSE); /* free the cookie list */\r\n    }\r\n    if(addcookies && (CURLE_OK == result)) {\r\n      if(!count)\r\n        result = Curl_add_bufferf(req_buffer, \"Cookie: \");\r\n      if(CURLE_OK == result) {\r\n        result = Curl_add_bufferf(req_buffer, \"%s%s\",\r\n                                  count?\"; \":\"\",\r\n                                  addcookies);\r\n        count++;\r\n      }\r\n    }\r\n    if(count && (CURLE_OK == result))\r\n      result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2);\r\n\r\n    if(result)\r\n      return result;\r\n  }\r\n#endif\r\n\r\n  if(data->set.timecondition) {\r\n    result = Curl_add_timecondition(data, req_buffer);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  result = Curl_add_custom_headers(conn, req_buffer);\r\n  if(result)\r\n    return result;\r\n\r\n  http->postdata = NULL;  /* nothing to post at this point */\r\n  Curl_pgrsSetUploadSize(data, 0); /* upload size is 0 atm */\r\n\r\n  /* If 'authdone' is FALSE, we must not set the write socket index to the\r\n     Curl_transfer() call below, as we're not ready to actually upload any\r\n     data yet. */\r\n\r\n  switch(httpreq) {\r\n\r\n  case HTTPREQ_POST_FORM:\r\n    if(!http->sendit || conn->bits.authneg) {\r\n      /* nothing to post! */\r\n      result = Curl_add_bufferf(req_buffer, \"Content-Length: 0\\r\\n\\r\\n\");\r\n      if(result)\r\n        return result;\r\n\r\n      result = Curl_add_buffer_send(req_buffer, conn,\r\n                                    &data->info.request_size, 0, FIRSTSOCKET);\r\n      if(result)\r\n        failf(data, \"Failed sending POST request\");\r\n      else\r\n        /* setup variables for the upcoming transfer */\r\n        Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,\r\n                            -1, NULL);\r\n      break;\r\n    }\r\n\r\n    if(Curl_FormInit(&http->form, http->sendit)) {\r\n      failf(data, \"Internal HTTP POST error!\");\r\n      return CURLE_HTTP_POST_ERROR;\r\n    }\r\n\r\n    /* Get the currently set callback function pointer and store that in the\r\n       form struct since we might want the actual user-provided callback later\r\n       on. The conn->fread_func pointer itself will be changed for the\r\n       multipart case to the function that returns a multipart formatted\r\n       stream. */\r\n    http->form.fread_func = conn->fread_func;\r\n\r\n    /* Set the read function to read from the generated form data */\r\n    conn->fread_func = (curl_read_callback)Curl_FormReader;\r\n    conn->fread_in = &http->form;\r\n\r\n    http->sending = HTTPSEND_BODY;\r\n\r\n    if(!data->req.upload_chunky &&\r\n       !Curl_checkheaders(data, \"Content-Length:\")) {\r\n      /* only add Content-Length if not uploading chunked */\r\n      result = Curl_add_bufferf(req_buffer,\r\n                                \"Content-Length: %\" FORMAT_OFF_T \"\\r\\n\",\r\n                                http->postsize);\r\n      if(result)\r\n        return result;\r\n    }\r\n\r\n    result = expect100(data, conn, req_buffer);\r\n    if(result)\r\n      return result;\r\n\r\n    {\r\n\r\n      /* Get Content-Type: line from Curl_formpostheader.\r\n       */\r\n      char *contentType;\r\n      size_t linelength=0;\r\n      contentType = Curl_formpostheader((void *)&http->form,\r\n                                        &linelength);\r\n      if(!contentType) {\r\n        failf(data, \"Could not get Content-Type header line!\");\r\n        return CURLE_HTTP_POST_ERROR;\r\n      }\r\n\r\n      result = Curl_add_buffer(req_buffer, contentType, linelength);\r\n      if(result)\r\n        return result;\r\n    }\r\n\r\n    /* make the request end in a true CRLF */\r\n    result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2);\r\n    if(result)\r\n      return result;\r\n\r\n    /* set upload size to the progress meter */\r\n    Curl_pgrsSetUploadSize(data, http->postsize);\r\n\r\n    /* fire away the whole request to the server */\r\n    result = Curl_add_buffer_send(req_buffer, conn,\r\n                                  &data->info.request_size, 0, FIRSTSOCKET);\r\n    if(result)\r\n      failf(data, \"Failed sending POST request\");\r\n    else\r\n      /* setup variables for the upcoming transfer */\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,\r\n                          &http->readbytecount, FIRSTSOCKET,\r\n                          &http->writebytecount);\r\n\r\n    if(result) {\r\n      Curl_formclean(&http->sendit); /* free that whole lot */\r\n      return result;\r\n    }\r\n\r\n    /* convert the form data */\r\n    result = Curl_convert_form(data, http->sendit);\r\n    if(result) {\r\n      Curl_formclean(&http->sendit); /* free that whole lot */\r\n      return result;\r\n    }\r\n\r\n    break;\r\n\r\n  case HTTPREQ_PUT: /* Let's PUT the data to the server! */\r\n\r\n    if(conn->bits.authneg)\r\n      postsize = 0;\r\n    else\r\n      postsize = data->set.infilesize;\r\n\r\n    if((postsize != -1) && !data->req.upload_chunky &&\r\n       !Curl_checkheaders(data, \"Content-Length:\")) {\r\n      /* only add Content-Length if not uploading chunked */\r\n      result = Curl_add_bufferf(req_buffer,\r\n                                \"Content-Length: %\" FORMAT_OFF_T \"\\r\\n\",\r\n                                postsize );\r\n      if(result)\r\n        return result;\r\n    }\r\n\r\n    result = expect100(data, conn, req_buffer);\r\n    if(result)\r\n      return result;\r\n\r\n    result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2); /* end of headers */\r\n    if(result)\r\n      return result;\r\n\r\n    /* set the upload size to the progress meter */\r\n    Curl_pgrsSetUploadSize(data, postsize);\r\n\r\n    /* this sends the buffer and frees all the buffer resources */\r\n    result = Curl_add_buffer_send(req_buffer, conn,\r\n                                  &data->info.request_size, 0, FIRSTSOCKET);\r\n    if(result)\r\n      failf(data, \"Failed sending PUT request\");\r\n    else\r\n      /* prepare for transfer */\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,\r\n                          &http->readbytecount, postsize?FIRSTSOCKET:-1,\r\n                          postsize?&http->writebytecount:NULL);\r\n    if(result)\r\n      return result;\r\n    break;\r\n\r\n  case HTTPREQ_POST:\r\n    /* this is the simple POST, using x-www-form-urlencoded style */\r\n\r\n    if(conn->bits.authneg)\r\n      postsize = 0;\r\n    else {\r\n      /* figure out the size of the postfields */\r\n      postsize = (data->set.postfieldsize != -1)?\r\n        data->set.postfieldsize:\r\n        (data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1);\r\n    }\r\n    if(!data->req.upload_chunky) {\r\n      /* We only set Content-Length and allow a custom Content-Length if\r\n         we don't upload data chunked, as RFC2616 forbids us to set both\r\n         kinds of headers (Transfer-Encoding: chunked and Content-Length) */\r\n\r\n      if(conn->bits.authneg || !Curl_checkheaders(data, \"Content-Length:\")) {\r\n        /* we allow replacing this header if not during auth negotiation,\r\n           although it isn't very wise to actually set your own */\r\n        result = Curl_add_bufferf(req_buffer,\r\n                                  \"Content-Length: %\" FORMAT_OFF_T\"\\r\\n\",\r\n                                  postsize);\r\n        if(result)\r\n          return result;\r\n      }\r\n    }\r\n\r\n    if(!Curl_checkheaders(data, \"Content-Type:\")) {\r\n      result = Curl_add_bufferf(req_buffer,\r\n                                \"Content-Type: application/\"\r\n                                \"x-www-form-urlencoded\\r\\n\");\r\n      if(result)\r\n        return result;\r\n    }\r\n\r\n    /* For really small posts we don't use Expect: headers at all, and for\r\n       the somewhat bigger ones we allow the app to disable it. Just make\r\n       sure that the expect100header is always set to the preferred value\r\n       here. */\r\n    ptr = Curl_checkheaders(data, \"Expect:\");\r\n    if(ptr) {\r\n      data->state.expect100header =\r\n        Curl_compareheader(ptr, \"Expect:\", \"100-continue\");\r\n    }\r\n    else if(postsize > TINY_INITIAL_POST_SIZE || postsize < 0) {\r\n      result = expect100(data, conn, req_buffer);\r\n      if(result)\r\n        return result;\r\n    }\r\n    else\r\n      data->state.expect100header = FALSE;\r\n\r\n    if(data->set.postfields) {\r\n\r\n      if(!data->state.expect100header &&\r\n         (postsize < MAX_INITIAL_POST_SIZE))  {\r\n        /* if we don't use expect: 100  AND\r\n           postsize is less than MAX_INITIAL_POST_SIZE\r\n\r\n           then append the post data to the HTTP request header. This limit\r\n           is no magic limit but only set to prevent really huge POSTs to\r\n           get the data duplicated with malloc() and family. */\r\n\r\n        result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2); /* end of headers! */\r\n        if(result)\r\n          return result;\r\n\r\n        if(!data->req.upload_chunky) {\r\n          /* We're not sending it 'chunked', append it to the request\r\n             already now to reduce the number if send() calls */\r\n          result = Curl_add_buffer(req_buffer, data->set.postfields,\r\n                                   (size_t)postsize);\r\n          included_body = postsize;\r\n        }\r\n        else {\r\n          if(postsize) {\r\n            /* Append the POST data chunky-style */\r\n            result = Curl_add_bufferf(req_buffer, \"%x\\r\\n\", (int)postsize);\r\n            if(CURLE_OK == result) {\r\n              result = Curl_add_buffer(req_buffer, data->set.postfields,\r\n                                       (size_t)postsize);\r\n              if(CURLE_OK == result)\r\n                 result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2);\r\n              included_body = postsize + 2;\r\n            }\r\n          }\r\n          if(CURLE_OK == result)\r\n            result = Curl_add_buffer(req_buffer,\r\n                                     \"\\x30\\x0d\\x0a\\x0d\\x0a\", 5);\r\n          /* 0  CR  LF  CR  LF */\r\n          included_body += 5;\r\n        }\r\n        if(result)\r\n          return result;\r\n        /* Make sure the progress information is accurate */\r\n        Curl_pgrsSetUploadSize(data, postsize);\r\n      }\r\n      else {\r\n        /* A huge POST coming up, do data separate from the request */\r\n        http->postsize = postsize;\r\n        http->postdata = data->set.postfields;\r\n\r\n        http->sending = HTTPSEND_BODY;\r\n\r\n        conn->fread_func = (curl_read_callback)readmoredata;\r\n        conn->fread_in = (void *)conn;\r\n\r\n        /* set the upload size to the progress meter */\r\n        Curl_pgrsSetUploadSize(data, http->postsize);\r\n\r\n        result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2); /* end of headers! */\r\n        if(result)\r\n          return result;\r\n      }\r\n    }\r\n    else {\r\n      result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2); /* end of headers! */\r\n      if(result)\r\n        return result;\r\n\r\n      if(data->req.upload_chunky && conn->bits.authneg) {\r\n        /* Chunky upload is selected and we're negotiating auth still, send\r\n           end-of-data only */\r\n        result = Curl_add_buffer(req_buffer,\r\n                                 \"\\x30\\x0d\\x0a\\x0d\\x0a\", 5);\r\n        /* 0  CR  LF  CR  LF */\r\n        if(result)\r\n          return result;\r\n      }\r\n\r\n      else if(data->set.postfieldsize) {\r\n        /* set the upload size to the progress meter */\r\n        Curl_pgrsSetUploadSize(data, postsize?postsize:-1);\r\n\r\n        /* set the pointer to mark that we will send the post body using the\r\n           read callback, but only if we're not in authenticate\r\n           negotiation  */\r\n        if(!conn->bits.authneg) {\r\n          http->postdata = (char *)&http->postdata;\r\n          http->postsize = postsize;\r\n        }\r\n      }\r\n    }\r\n    /* issue the request */\r\n    result = Curl_add_buffer_send(req_buffer, conn, &data->info.request_size,\r\n                                  (size_t)included_body, FIRSTSOCKET);\r\n\r\n    if(result)\r\n      failf(data, \"Failed sending HTTP POST request\");\r\n    else\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,\r\n                          &http->readbytecount, http->postdata?FIRSTSOCKET:-1,\r\n                          http->postdata?&http->writebytecount:NULL);\r\n    break;\r\n\r\n  default:\r\n    result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2);\r\n    if(result)\r\n      return result;\r\n\r\n    /* issue the request */\r\n    result = Curl_add_buffer_send(req_buffer, conn,\r\n                                  &data->info.request_size, 0, FIRSTSOCKET);\r\n\r\n    if(result)\r\n      failf(data, \"Failed sending HTTP request\");\r\n    else\r\n      /* HTTP GET/HEAD download: */\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,\r\n                          http->postdata?FIRSTSOCKET:-1,\r\n                          http->postdata?&http->writebytecount:NULL);\r\n  }\r\n  if(result)\r\n    return result;\r\n\r\n  if(http->writebytecount) {\r\n    /* if a request-body has been sent off, we make sure this progress is noted\r\n       properly */\r\n    Curl_pgrsSetUploadCounter(data, http->writebytecount);\r\n    if(Curl_pgrsUpdate(conn))\r\n      result = CURLE_ABORTED_BY_CALLBACK;\r\n\r\n    if(http->writebytecount >= postsize) {\r\n      /* already sent the entire request body, mark the \"upload\" as\r\n         complete */\r\n      infof(data, \"upload completely sent off: %\" FORMAT_OFF_T \" out of \"\r\n            \"%\" FORMAT_OFF_T \" bytes\\n\",\r\n            http->writebytecount, postsize);\r\n      data->req.upload_done = TRUE;\r\n      data->req.keepon &= ~KEEP_SEND; /* we're done writing */\r\n      data->req.exp100 = EXP100_SEND_DATA; /* already sent */\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * checkhttpprefix()\r\n *\r\n * Returns TRUE if member of the list matches prefix of string\r\n */\r\nstatic bool\r\ncheckhttpprefix(struct SessionHandle *data,\r\n                const char *s)\r\n{\r\n  struct curl_slist *head = data->set.http200aliases;\r\n  bool rc = FALSE;\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  /* convert from the network encoding using a scratch area */\r\n  char *scratch = strdup(s);\r\n  if(NULL == scratch) {\r\n    failf (data, \"Failed to allocate memory for conversion!\");\r\n    return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */\r\n  }\r\n  if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {\r\n    /* Curl_convert_from_network calls failf if unsuccessful */\r\n    free(scratch);\r\n    return FALSE; /* can't return CURLE_foobar so return FALSE */\r\n  }\r\n  s = scratch;\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n  while(head) {\r\n    if(checkprefix(head->data, s)) {\r\n      rc = TRUE;\r\n      break;\r\n    }\r\n    head = head->next;\r\n  }\r\n\r\n  if(!rc && (checkprefix(\"HTTP/\", s)))\r\n    rc = TRUE;\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  free(scratch);\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n  return rc;\r\n}\r\n\r\n#ifndef CURL_DISABLE_RTSP\r\nstatic bool\r\ncheckrtspprefix(struct SessionHandle *data,\r\n                const char *s)\r\n{\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  /* convert from the network encoding using a scratch area */\r\n  char *scratch = strdup(s);\r\n  if(NULL == scratch) {\r\n    failf (data, \"Failed to allocate memory for conversion!\");\r\n    return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */\r\n  }\r\n  if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {\r\n    /* Curl_convert_from_network calls failf if unsuccessful */\r\n    free(scratch);\r\n    return FALSE; /* can't return CURLE_foobar so return FALSE */\r\n  }\r\n  s = scratch;\r\n#else\r\n  (void)data; /* unused */\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n  if(checkprefix(\"RTSP/\", s))\r\n    return TRUE;\r\n  else\r\n    return FALSE;\r\n}\r\n#endif /* CURL_DISABLE_RTSP */\r\n\r\nstatic bool\r\ncheckprotoprefix(struct SessionHandle *data, struct connectdata *conn,\r\n                 const char *s)\r\n{\r\n#ifndef CURL_DISABLE_RTSP\r\n  if(conn->handler->protocol & CURLPROTO_RTSP)\r\n    return checkrtspprefix(data, s);\r\n#else\r\n  (void)conn;\r\n#endif /* CURL_DISABLE_RTSP */\r\n\r\n  return checkhttpprefix(data, s);\r\n}\r\n\r\n/*\r\n * header_append() copies a chunk of data to the end of the already received\r\n * header. We make sure that the full string fit in the allocated header\r\n * buffer, or else we enlarge it.\r\n */\r\nstatic CURLcode header_append(struct SessionHandle *data,\r\n                              struct SingleRequest *k,\r\n                              size_t length)\r\n{\r\n  if(k->hbuflen + length >= data->state.headersize) {\r\n    /* We enlarge the header buffer as it is too small */\r\n    char *newbuff;\r\n    size_t hbufp_index;\r\n    size_t newsize;\r\n\r\n    if(k->hbuflen + length > CURL_MAX_HTTP_HEADER) {\r\n      /* The reason to have a max limit for this is to avoid the risk of a bad\r\n         server feeding libcurl with a never-ending header that will cause\r\n         reallocs infinitely */\r\n      failf (data, \"Avoided giant realloc for header (max is %d)!\",\r\n             CURL_MAX_HTTP_HEADER);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    newsize=CURLMAX((k->hbuflen+ length)*3/2, data->state.headersize*2);\r\n    hbufp_index = k->hbufp - data->state.headerbuff;\r\n    newbuff = realloc(data->state.headerbuff, newsize);\r\n    if(!newbuff) {\r\n      failf (data, \"Failed to alloc memory for big header!\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    data->state.headersize=newsize;\r\n    data->state.headerbuff = newbuff;\r\n    k->hbufp = data->state.headerbuff + hbufp_index;\r\n  }\r\n  memcpy(k->hbufp, k->str_start, length);\r\n  k->hbufp += length;\r\n  k->hbuflen += length;\r\n  *k->hbufp = 0;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic void print_http_error(struct SessionHandle *data)\r\n{\r\n  struct SingleRequest *k = &data->req;\r\n  char *beg = k->p;\r\n\r\n  /* make sure that data->req.p points to the HTTP status line */\r\n  if(!strncmp(beg, \"HTTP\", 4)) {\r\n\r\n    /* skip to HTTP status code */\r\n    beg = strchr(beg, ' ');\r\n    if(beg && *++beg) {\r\n\r\n      /* find trailing CR */\r\n      char end_char = '\\r';\r\n      char *end = strchr(beg, end_char);\r\n      if(!end) {\r\n        /* try to find LF (workaround for non-compliant HTTP servers) */\r\n        end_char = '\\n';\r\n        end = strchr(beg, end_char);\r\n      }\r\n\r\n      if(end) {\r\n        /* temporarily replace CR or LF by NUL and print the error message */\r\n        *end = '\\0';\r\n        failf(data, \"The requested URL returned error: %s\", beg);\r\n\r\n        /* restore the previously replaced CR or LF */\r\n        *end = end_char;\r\n        return;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* fall-back to printing the HTTP status code only */\r\n  failf(data, \"The requested URL returned error: %d\", k->httpcode);\r\n}\r\n\r\n/*\r\n * Read any HTTP header lines from the server and pass them to the client app.\r\n */\r\nCURLcode Curl_http_readwrite_headers(struct SessionHandle *data,\r\n                                       struct connectdata *conn,\r\n                                       ssize_t *nread,\r\n                                       bool *stop_reading)\r\n{\r\n  CURLcode result;\r\n  struct SingleRequest *k = &data->req;\r\n\r\n  /* header line within buffer loop */\r\n  do {\r\n    size_t rest_length;\r\n    size_t full_length;\r\n    int writetype;\r\n\r\n    /* str_start is start of line within buf */\r\n    k->str_start = k->str;\r\n\r\n    /* data is in network encoding so use 0x0a instead of '\\n' */\r\n    k->end_ptr = memchr(k->str_start, 0x0a, *nread);\r\n\r\n    if(!k->end_ptr) {\r\n      /* Not a complete header line within buffer, append the data to\r\n         the end of the headerbuff. */\r\n      result = header_append(data, k, *nread);\r\n      if(result)\r\n        return result;\r\n\r\n      if(!k->headerline && (k->hbuflen>5)) {\r\n        /* make a first check that this looks like a protocol header */\r\n        if(!checkprotoprefix(data, conn, data->state.headerbuff)) {\r\n          /* this is not the beginning of a protocol first header line */\r\n          k->header = FALSE;\r\n          k->badheader = HEADER_ALLBAD;\r\n          break;\r\n        }\r\n      }\r\n\r\n      break; /* read more and try again */\r\n    }\r\n\r\n    /* decrease the size of the remaining (supposed) header line */\r\n    rest_length = (k->end_ptr - k->str)+1;\r\n    *nread -= (ssize_t)rest_length;\r\n\r\n    k->str = k->end_ptr + 1; /* move past new line */\r\n\r\n    full_length = k->str - k->str_start;\r\n\r\n    result = header_append(data, k, full_length);\r\n    if(result)\r\n      return result;\r\n\r\n    k->end_ptr = k->hbufp;\r\n    k->p = data->state.headerbuff;\r\n\r\n    /****\r\n     * We now have a FULL header line that p points to\r\n     *****/\r\n\r\n    if(!k->headerline) {\r\n      /* the first read header */\r\n      if((k->hbuflen>5) &&\r\n         !checkprotoprefix(data, conn, data->state.headerbuff)) {\r\n        /* this is not the beginning of a protocol first header line */\r\n        k->header = FALSE;\r\n        if(*nread)\r\n          /* since there's more, this is a partial bad header */\r\n          k->badheader = HEADER_PARTHEADER;\r\n        else {\r\n          /* this was all we read so it's all a bad header */\r\n          k->badheader = HEADER_ALLBAD;\r\n          *nread = (ssize_t)rest_length;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* headers are in network encoding so\r\n       use 0x0a and 0x0d instead of '\\n' and '\\r' */\r\n    if((0x0a == *k->p) || (0x0d == *k->p)) {\r\n      size_t headerlen;\r\n      /* Zero-length header line means end of headers! */\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n      if(0x0d == *k->p) {\r\n        *k->p = '\\r'; /* replace with CR in host encoding */\r\n        k->p++;       /* pass the CR byte */\r\n      }\r\n      if(0x0a == *k->p) {\r\n        *k->p = '\\n'; /* replace with LF in host encoding */\r\n        k->p++;       /* pass the LF byte */\r\n      }\r\n#else\r\n      if('\\r' == *k->p)\r\n        k->p++; /* pass the \\r byte */\r\n      if('\\n' == *k->p)\r\n        k->p++; /* pass the \\n byte */\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n      if(100 <= k->httpcode && 199 >= k->httpcode) {\r\n        /*\r\n         * We have made a HTTP PUT or POST and this is 1.1-lingo\r\n         * that tells us that the server is OK with this and ready\r\n         * to receive the data.\r\n         * However, we'll get more headers now so we must get\r\n         * back into the header-parsing state!\r\n         */\r\n        k->header = TRUE;\r\n        k->headerline = 0; /* restart the header line counter */\r\n\r\n        /* if we did wait for this do enable write now! */\r\n        if(k->exp100) {\r\n          k->exp100 = EXP100_SEND_DATA;\r\n          k->keepon |= KEEP_SEND;\r\n        }\r\n      }\r\n      else {\r\n        k->header = FALSE; /* no more header to parse! */\r\n\r\n        if((k->size == -1) && !k->chunk && !conn->bits.close &&\r\n           (conn->httpversion >= 11) &&\r\n           !(conn->handler->protocol & CURLPROTO_RTSP) &&\r\n           data->set.httpreq != HTTPREQ_HEAD) {\r\n          /* On HTTP 1.1, when connection is not to get closed, but no\r\n             Content-Length nor Content-Encoding chunked have been\r\n             received, according to RFC2616 section 4.4 point 5, we\r\n             assume that the server will close the connection to\r\n             signal the end of the document. */\r\n          infof(data, \"no chunk, no close, no size. Assume close to \"\r\n                \"signal end\\n\");\r\n          conn->bits.close = TRUE;\r\n        }\r\n      }\r\n\r\n      /*\r\n       * When all the headers have been parsed, see if we should give\r\n       * up and return an error.\r\n       */\r\n      if(http_should_fail(conn)) {\r\n        failf (data, \"The requested URL returned error: %d\",\r\n               k->httpcode);\r\n        return CURLE_HTTP_RETURNED_ERROR;\r\n      }\r\n\r\n      /* now, only output this if the header AND body are requested:\r\n       */\r\n      writetype = CLIENTWRITE_HEADER;\r\n      if(data->set.include_header)\r\n        writetype |= CLIENTWRITE_BODY;\r\n\r\n      headerlen = k->p - data->state.headerbuff;\r\n\r\n      result = Curl_client_write(conn, writetype,\r\n                                 data->state.headerbuff,\r\n                                 headerlen);\r\n      if(result)\r\n        return result;\r\n\r\n      data->info.header_size += (long)headerlen;\r\n      data->req.headerbytecount += (long)headerlen;\r\n\r\n      data->req.deductheadercount =\r\n        (100 <= k->httpcode && 199 >= k->httpcode)?data->req.headerbytecount:0;\r\n\r\n      if(!*stop_reading) {\r\n        /* Curl_http_auth_act() checks what authentication methods\r\n         * that are available and decides which one (if any) to\r\n         * use. It will set 'newurl' if an auth method was picked. */\r\n        result = Curl_http_auth_act(conn);\r\n\r\n        if(result)\r\n          return result;\r\n\r\n        if(k->httpcode >= 300) {\r\n          if((!conn->bits.authneg) && !conn->bits.close &&\r\n             !conn->bits.rewindaftersend) {\r\n            /*\r\n             * General treatment of errors when about to send data. Including :\r\n             * \"417 Expectation Failed\", while waiting for 100-continue.\r\n             *\r\n             * The check for close above is done simply because of something\r\n             * else has already deemed the connection to get closed then\r\n             * something else should've considered the big picture and we\r\n             * avoid this check.\r\n             *\r\n             * rewindaftersend indicates that something has told libcurl to\r\n             * continue sending even if it gets discarded\r\n             */\r\n\r\n            switch(data->set.httpreq) {\r\n            case HTTPREQ_PUT:\r\n            case HTTPREQ_POST:\r\n            case HTTPREQ_POST_FORM:\r\n              /* We got an error response. If this happened before the whole\r\n               * request body has been sent we stop sending and mark the\r\n               * connection for closure after we've read the entire response.\r\n               */\r\n              if(!k->upload_done) {\r\n                infof(data, \"HTTP error before end of send, stop sending\\n\");\r\n                conn->bits.close = TRUE; /* close after this */\r\n                k->upload_done = TRUE;\r\n                k->keepon &= ~KEEP_SEND; /* don't send */\r\n                if(data->state.expect100header)\r\n                  k->exp100 = EXP100_FAILED;\r\n              }\r\n              break;\r\n\r\n            default: /* default label present to avoid compiler warnings */\r\n              break;\r\n            }\r\n          }\r\n        }\r\n\r\n        if(conn->bits.rewindaftersend) {\r\n          /* We rewind after a complete send, so thus we continue\r\n             sending now */\r\n          infof(data, \"Keep sending data to get tossed away!\\n\");\r\n          k->keepon |= KEEP_SEND;\r\n        }\r\n      }\r\n\r\n      if(!k->header) {\r\n        /*\r\n         * really end-of-headers.\r\n         *\r\n         * If we requested a \"no body\", this is a good time to get\r\n         * out and return home.\r\n         */\r\n        if(data->set.opt_no_body)\r\n          *stop_reading = TRUE;\r\n        else {\r\n          /* If we know the expected size of this document, we set the\r\n             maximum download size to the size of the expected\r\n             document or else, we won't know when to stop reading!\r\n\r\n             Note that we set the download maximum even if we read a\r\n             \"Connection: close\" header, to make sure that\r\n             \"Content-Length: 0\" still prevents us from attempting to\r\n             read the (missing) response-body.\r\n          */\r\n          /* According to RFC2616 section 4.4, we MUST ignore\r\n             Content-Length: headers if we are now receiving data\r\n             using chunked Transfer-Encoding.\r\n          */\r\n          if(k->chunk)\r\n            k->maxdownload = k->size = -1;\r\n        }\r\n        if(-1 != k->size) {\r\n          /* We do this operation even if no_body is true, since this\r\n             data might be retrieved later with curl_easy_getinfo()\r\n             and its CURLINFO_CONTENT_LENGTH_DOWNLOAD option. */\r\n\r\n          Curl_pgrsSetDownloadSize(data, k->size);\r\n          k->maxdownload = k->size;\r\n        }\r\n\r\n        /* If max download size is *zero* (nothing) we already\r\n           have nothing and can safely return ok now! */\r\n        if(0 == k->maxdownload)\r\n          *stop_reading = TRUE;\r\n\r\n        if(*stop_reading) {\r\n          /* we make sure that this socket isn't read more now */\r\n          k->keepon &= ~KEEP_RECV;\r\n        }\r\n\r\n        if(data->set.verbose)\r\n          Curl_debug(data, CURLINFO_HEADER_IN,\r\n                     k->str_start, headerlen, conn);\r\n        break;          /* exit header line loop */\r\n      }\r\n\r\n      /* We continue reading headers, so reset the line-based\r\n         header parsing variables hbufp && hbuflen */\r\n      k->hbufp = data->state.headerbuff;\r\n      k->hbuflen = 0;\r\n      continue;\r\n    }\r\n\r\n    /*\r\n     * Checks for special headers coming up.\r\n     */\r\n\r\n    if(!k->headerline++) {\r\n      /* This is the first header, it MUST be the error code line\r\n         or else we consider this to be the body right away! */\r\n      int httpversion_major;\r\n      int rtspversion_major;\r\n      int nc = 0;\r\n#ifdef CURL_DOES_CONVERSIONS\r\n#define HEADER1 scratch\r\n#define SCRATCHSIZE 21\r\n      CURLcode res;\r\n      char scratch[SCRATCHSIZE+1]; /* \"HTTP/major.minor 123\" */\r\n      /* We can't really convert this yet because we\r\n         don't know if it's the 1st header line or the body.\r\n         So we do a partial conversion into a scratch area,\r\n         leaving the data at k->p as-is.\r\n      */\r\n      strncpy(&scratch[0], k->p, SCRATCHSIZE);\r\n      scratch[SCRATCHSIZE] = 0; /* null terminate */\r\n      res = Curl_convert_from_network(data,\r\n                                      &scratch[0],\r\n                                      SCRATCHSIZE);\r\n      if(res)\r\n        /* Curl_convert_from_network calls failf if unsuccessful */\r\n        return res;\r\n#else\r\n#define HEADER1 k->p /* no conversion needed, just use k->p */\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n      if(conn->handler->protocol & CURLPROTO_HTTP) {\r\n        nc = sscanf(HEADER1,\r\n                    \" HTTP/%d.%d %3d\",\r\n                    &httpversion_major,\r\n                    &conn->httpversion,\r\n                    &k->httpcode);\r\n        if(nc==3) {\r\n          conn->httpversion += 10 * httpversion_major;\r\n        }\r\n        else {\r\n          /* this is the real world, not a Nirvana\r\n             NCSA 1.5.x returns this crap when asked for HTTP/1.1\r\n          */\r\n          nc=sscanf(HEADER1, \" HTTP %3d\", &k->httpcode);\r\n          conn->httpversion = 10;\r\n\r\n          /* If user has set option HTTP200ALIASES,\r\n             compare header line against list of aliases\r\n          */\r\n          if(!nc) {\r\n            if(checkhttpprefix(data, k->p)) {\r\n              nc = 1;\r\n              k->httpcode = 200;\r\n              conn->httpversion = 10;\r\n            }\r\n          }\r\n        }\r\n      }\r\n      else if(conn->handler->protocol & CURLPROTO_RTSP) {\r\n        nc = sscanf(HEADER1,\r\n                    \" RTSP/%d.%d %3d\",\r\n                    &rtspversion_major,\r\n                    &conn->rtspversion,\r\n                    &k->httpcode);\r\n        if(nc==3) {\r\n          conn->rtspversion += 10 * rtspversion_major;\r\n          conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */\r\n        }\r\n        else {\r\n          /* TODO: do we care about the other cases here? */\r\n          nc = 0;\r\n        }\r\n      }\r\n\r\n      if(nc) {\r\n        data->info.httpcode = k->httpcode;\r\n\r\n        data->info.httpversion = conn->httpversion;\r\n        if(!data->state.httpversion ||\r\n           data->state.httpversion > conn->httpversion)\r\n          /* store the lowest server version we encounter */\r\n          data->state.httpversion = conn->httpversion;\r\n\r\n        /*\r\n         * This code executes as part of processing the header.  As a\r\n         * result, it's not totally clear how to interpret the\r\n         * response code yet as that depends on what other headers may\r\n         * be present.  401 and 407 may be errors, but may be OK\r\n         * depending on how authentication is working.  Other codes\r\n         * are definitely errors, so give up here.\r\n         */\r\n        if(data->set.http_fail_on_error && (k->httpcode >= 400) &&\r\n           ((k->httpcode != 401) || !conn->bits.user_passwd) &&\r\n           ((k->httpcode != 407) || !conn->bits.proxy_user_passwd) ) {\r\n\r\n          if(data->state.resume_from &&\r\n             (data->set.httpreq==HTTPREQ_GET) &&\r\n             (k->httpcode == 416)) {\r\n            /* \"Requested Range Not Satisfiable\", just proceed and\r\n               pretend this is no error */\r\n          }\r\n          else {\r\n            /* serious error, go home! */\r\n            print_http_error(data);\r\n            return CURLE_HTTP_RETURNED_ERROR;\r\n          }\r\n        }\r\n\r\n        if(conn->httpversion == 10) {\r\n          /* Default action for HTTP/1.0 must be to close, unless\r\n             we get one of those fancy headers that tell us the\r\n             server keeps it open for us! */\r\n          infof(data, \"HTTP 1.0, assume close after body\\n\");\r\n          conn->bits.close = TRUE;\r\n        }\r\n        else if(conn->httpversion >= 11 &&\r\n                !conn->bits.close) {\r\n\r\n          /* If HTTP version is >= 1.1 and connection is persistent\r\n             server supports pipelining. */\r\n          DEBUGF(infof(data,\r\n                       \"HTTP 1.1 or later with persistent connection, \"\r\n                       \"pipelining supported\\n\"));\r\n          conn->server_supports_pipelining = TRUE;\r\n        }\r\n\r\n        switch(k->httpcode) {\r\n        case 204:\r\n          /* (quote from RFC2616, section 10.2.5): The server has\r\n           * fulfilled the request but does not need to return an\r\n           * entity-body ... The 204 response MUST NOT include a\r\n           * message-body, and thus is always terminated by the first\r\n           * empty line after the header fields. */\r\n          /* FALLTHROUGH */\r\n        case 304:\r\n          /* (quote from RFC2616, section 10.3.5): The 304 response\r\n           * MUST NOT contain a message-body, and thus is always\r\n           * terminated by the first empty line after the header\r\n           * fields.  */\r\n          if(data->set.timecondition)\r\n            data->info.timecond = TRUE;\r\n          k->size=0;\r\n          k->maxdownload=0;\r\n          k->ignorecl = TRUE; /* ignore Content-Length headers */\r\n          break;\r\n        default:\r\n          /* nothing */\r\n          break;\r\n        }\r\n      }\r\n      else {\r\n        k->header = FALSE;   /* this is not a header line */\r\n        break;\r\n      }\r\n    }\r\n\r\n    result = Curl_convert_from_network(data, k->p, strlen(k->p));\r\n    /* Curl_convert_from_network calls failf if unsuccessful */\r\n    if(result)\r\n      return result;\r\n\r\n    /* Check for Content-Length: header lines to get size */\r\n    if(!k->ignorecl && !data->set.ignorecl &&\r\n       checkprefix(\"Content-Length:\", k->p)) {\r\n      curl_off_t contentlength = curlx_strtoofft(k->p+15, NULL, 10);\r\n      if(data->set.max_filesize &&\r\n         contentlength > data->set.max_filesize) {\r\n        failf(data, \"Maximum file size exceeded\");\r\n        return CURLE_FILESIZE_EXCEEDED;\r\n      }\r\n      if(contentlength >= 0) {\r\n        k->size = contentlength;\r\n        k->maxdownload = k->size;\r\n        /* we set the progress download size already at this point\r\n           just to make it easier for apps/callbacks to extract this\r\n           info as soon as possible */\r\n        Curl_pgrsSetDownloadSize(data, k->size);\r\n      }\r\n      else {\r\n        /* Negative Content-Length is really odd, and we know it\r\n           happens for example when older Apache servers send large\r\n           files */\r\n        conn->bits.close = TRUE;\r\n        infof(data, \"Negative content-length: %\" FORMAT_OFF_T\r\n              \", closing after transfer\\n\", contentlength);\r\n      }\r\n    }\r\n    /* check for Content-Type: header lines to get the MIME-type */\r\n    else if(checkprefix(\"Content-Type:\", k->p)) {\r\n      char *contenttype = copy_header_value(k->p);\r\n      if(!contenttype)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      if(!*contenttype)\r\n        /* ignore empty data */\r\n        free(contenttype);\r\n      else {\r\n        Curl_safefree(data->info.contenttype);\r\n        data->info.contenttype = contenttype;\r\n      }\r\n    }\r\n    else if((conn->httpversion == 10) &&\r\n            conn->bits.httpproxy &&\r\n            Curl_compareheader(k->p,\r\n                               \"Proxy-Connection:\", \"keep-alive\")) {\r\n      /*\r\n       * When a HTTP/1.0 reply comes when using a proxy, the\r\n       * 'Proxy-Connection: keep-alive' line tells us the\r\n       * connection will be kept alive for our pleasure.\r\n       * Default action for 1.0 is to close.\r\n       */\r\n      conn->bits.close = FALSE; /* don't close when done */\r\n      infof(data, \"HTTP/1.0 proxy connection set to keep alive!\\n\");\r\n    }\r\n    else if((conn->httpversion == 11) &&\r\n            conn->bits.httpproxy &&\r\n            Curl_compareheader(k->p,\r\n                               \"Proxy-Connection:\", \"close\")) {\r\n      /*\r\n       * We get a HTTP/1.1 response from a proxy and it says it'll\r\n       * close down after this transfer.\r\n       */\r\n      conn->bits.close = TRUE; /* close when done */\r\n      infof(data, \"HTTP/1.1 proxy connection set close!\\n\");\r\n    }\r\n    else if((conn->httpversion == 10) &&\r\n            Curl_compareheader(k->p, \"Connection:\", \"keep-alive\")) {\r\n      /*\r\n       * A HTTP/1.0 reply with the 'Connection: keep-alive' line\r\n       * tells us the connection will be kept alive for our\r\n       * pleasure.  Default action for 1.0 is to close.\r\n       *\r\n       * [RFC2068, section 19.7.1] */\r\n      conn->bits.close = FALSE; /* don't close when done */\r\n      infof(data, \"HTTP/1.0 connection set to keep alive!\\n\");\r\n    }\r\n    else if(Curl_compareheader(k->p, \"Connection:\", \"close\")) {\r\n      /*\r\n       * [RFC 2616, section 8.1.2.1]\r\n       * \"Connection: close\" is HTTP/1.1 language and means that\r\n       * the connection will close when this request has been\r\n       * served.\r\n       */\r\n      conn->bits.close = TRUE; /* close when done */\r\n    }\r\n    else if(checkprefix(\"Transfer-Encoding:\", k->p)) {\r\n      /* One or more encodings. We check for chunked and/or a compression\r\n         algorithm. */\r\n      /*\r\n       * [RFC 2616, section 3.6.1] A 'chunked' transfer encoding\r\n       * means that the server will send a series of \"chunks\". Each\r\n       * chunk starts with line with info (including size of the\r\n       * coming block) (terminated with CRLF), then a block of data\r\n       * with the previously mentioned size. There can be any amount\r\n       * of chunks, and a chunk-data set to zero signals the\r\n       * end-of-chunks. */\r\n\r\n      char *start;\r\n\r\n      /* Find the first non-space letter */\r\n      start = k->p + 18;\r\n\r\n      for(;;) {\r\n        /* skip whitespaces and commas */\r\n        while(*start && (ISSPACE(*start) || (*start == ',')))\r\n          start++;\r\n\r\n        if(checkprefix(\"chunked\", start)) {\r\n          k->chunk = TRUE; /* chunks coming our way */\r\n\r\n          /* init our chunky engine */\r\n          Curl_httpchunk_init(conn);\r\n\r\n          start += 7;\r\n        }\r\n\r\n        if(k->auto_decoding)\r\n          /* TODO: we only support the first mentioned compression for now */\r\n          break;\r\n\r\n        if(checkprefix(\"identity\", start)) {\r\n          k->auto_decoding = IDENTITY;\r\n          start += 8;\r\n        }\r\n        else if(checkprefix(\"deflate\", start)) {\r\n          k->auto_decoding = DEFLATE;\r\n          start += 7;\r\n        }\r\n        else if(checkprefix(\"gzip\", start)) {\r\n          k->auto_decoding = GZIP;\r\n          start += 4;\r\n        }\r\n        else if(checkprefix(\"x-gzip\", start)) {\r\n          k->auto_decoding = GZIP;\r\n          start += 6;\r\n        }\r\n        else if(checkprefix(\"compress\", start)) {\r\n          k->auto_decoding = COMPRESS;\r\n          start += 8;\r\n        }\r\n        else if(checkprefix(\"x-compress\", start)) {\r\n          k->auto_decoding = COMPRESS;\r\n          start += 10;\r\n        }\r\n        else\r\n          /* unknown! */\r\n          break;\r\n\r\n      }\r\n\r\n    }\r\n    else if(checkprefix(\"Content-Encoding:\", k->p) &&\r\n            data->set.str[STRING_ENCODING]) {\r\n      /*\r\n       * Process Content-Encoding. Look for the values: identity,\r\n       * gzip, deflate, compress, x-gzip and x-compress. x-gzip and\r\n       * x-compress are the same as gzip and compress. (Sec 3.5 RFC\r\n       * 2616). zlib cannot handle compress.  However, errors are\r\n       * handled further down when the response body is processed\r\n       */\r\n      char *start;\r\n\r\n      /* Find the first non-space letter */\r\n      start = k->p + 17;\r\n      while(*start && ISSPACE(*start))\r\n        start++;\r\n\r\n      /* Record the content-encoding for later use */\r\n      if(checkprefix(\"identity\", start))\r\n        k->auto_decoding = IDENTITY;\r\n      else if(checkprefix(\"deflate\", start))\r\n        k->auto_decoding = DEFLATE;\r\n      else if(checkprefix(\"gzip\", start)\r\n              || checkprefix(\"x-gzip\", start))\r\n        k->auto_decoding = GZIP;\r\n      else if(checkprefix(\"compress\", start)\r\n              || checkprefix(\"x-compress\", start))\r\n        k->auto_decoding = COMPRESS;\r\n    }\r\n    else if(checkprefix(\"Content-Range:\", k->p)) {\r\n      /* Content-Range: bytes [num]-\r\n         Content-Range: bytes: [num]-\r\n         Content-Range: [num]-\r\n\r\n         The second format was added since Sun's webserver\r\n         JavaWebServer/1.1.1 obviously sends the header this way!\r\n         The third added since some servers use that!\r\n      */\r\n\r\n      char *ptr = k->p + 14;\r\n\r\n      /* Move forward until first digit */\r\n      while(*ptr && !ISDIGIT(*ptr))\r\n        ptr++;\r\n\r\n      k->offset = curlx_strtoofft(ptr, NULL, 10);\r\n\r\n      if(data->state.resume_from == k->offset)\r\n        /* we asked for a resume and we got it */\r\n        k->content_range = TRUE;\r\n    }\r\n#if !defined(CURL_DISABLE_COOKIES)\r\n    else if(data->cookies &&\r\n            checkprefix(\"Set-Cookie:\", k->p)) {\r\n      Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,\r\n                      CURL_LOCK_ACCESS_SINGLE);\r\n      Curl_cookie_add(data,\r\n                      data->cookies, TRUE, k->p+11,\r\n                      /* If there is a custom-set Host: name, use it\r\n                         here, or else use real peer host name. */\r\n                      conn->allocptr.cookiehost?\r\n                      conn->allocptr.cookiehost:conn->host.name,\r\n                      data->state.path);\r\n      Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);\r\n    }\r\n#endif\r\n    else if(checkprefix(\"Last-Modified:\", k->p) &&\r\n            (data->set.timecondition || data->set.get_filetime) ) {\r\n      time_t secs=time(NULL);\r\n      k->timeofdoc = curl_getdate(k->p+strlen(\"Last-Modified:\"),\r\n                                  &secs);\r\n      if(data->set.get_filetime)\r\n        data->info.filetime = (long)k->timeofdoc;\r\n    }\r\n    else if((checkprefix(\"WWW-Authenticate:\", k->p) &&\r\n             (401 == k->httpcode)) ||\r\n            (checkprefix(\"Proxy-authenticate:\", k->p) &&\r\n             (407 == k->httpcode))) {\r\n      result = Curl_http_input_auth(conn, k->httpcode, k->p);\r\n      if(result)\r\n        return result;\r\n    }\r\n    else if((k->httpcode >= 300 && k->httpcode < 400) &&\r\n            checkprefix(\"Location:\", k->p) &&\r\n            !data->req.location) {\r\n      /* this is the URL that the server advises us to use instead */\r\n      char *location = copy_header_value(k->p);\r\n      if(!location)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      if(!*location)\r\n        /* ignore empty data */\r\n        free(location);\r\n      else {\r\n        data->req.location = location;\r\n\r\n        if(data->set.http_follow_location) {\r\n          DEBUGASSERT(!data->req.newurl);\r\n          data->req.newurl = strdup(data->req.location); /* clone */\r\n          if(!data->req.newurl)\r\n            return CURLE_OUT_OF_MEMORY;\r\n\r\n          /* some cases of POST and PUT etc needs to rewind the data\r\n             stream at this point */\r\n          result = http_perhapsrewind(conn);\r\n          if(result)\r\n            return result;\r\n        }\r\n      }\r\n    }\r\n    else if(conn->handler->protocol & CURLPROTO_RTSP) {\r\n      result = Curl_rtsp_parseheader(conn, k->p);\r\n      if(result)\r\n        return result;\r\n    }\r\n\r\n    /*\r\n     * End of header-checks. Write them to the client.\r\n     */\r\n\r\n    writetype = CLIENTWRITE_HEADER;\r\n    if(data->set.include_header)\r\n      writetype |= CLIENTWRITE_BODY;\r\n\r\n    if(data->set.verbose)\r\n      Curl_debug(data, CURLINFO_HEADER_IN,\r\n                 k->p, (size_t)k->hbuflen, conn);\r\n\r\n    result = Curl_client_write(conn, writetype, k->p, k->hbuflen);\r\n    if(result)\r\n      return result;\r\n\r\n    data->info.header_size += (long)k->hbuflen;\r\n    data->req.headerbytecount += (long)k->hbuflen;\r\n\r\n    /* reset hbufp pointer && hbuflen */\r\n    k->hbufp = data->state.headerbuff;\r\n    k->hbuflen = 0;\r\n  }\r\n  while(!*stop_reading && *k->str); /* header line within buffer */\r\n\r\n  /* We might have reached the end of the header part here, but\r\n     there might be a non-header part left in the end of the read\r\n     buffer. */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* CURL_DISABLE_HTTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http.h",
    "content": "#ifndef HEADER_CURL_HTTP_H\r\n#define HEADER_CURL_HTTP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifndef CURL_DISABLE_HTTP\r\n\r\nextern const struct Curl_handler Curl_handler_http;\r\n\r\n#ifdef USE_SSL\r\nextern const struct Curl_handler Curl_handler_https;\r\n#endif\r\n\r\nbool Curl_compareheader(const char *headerline,  /* line to check */\r\n                        const char *header,   /* header keyword _with_ colon */\r\n                        const char *content); /* content string to find */\r\n\r\nchar *Curl_checkheaders(struct SessionHandle *data, const char *thisheader);\r\n\r\n/* ------------------------------------------------------------------------- */\r\n/*\r\n * The add_buffer series of functions are used to build one large memory chunk\r\n * from repeated function invokes. Used so that the entire HTTP request can\r\n * be sent in one go.\r\n */\r\nstruct Curl_send_buffer {\r\n  char *buffer;\r\n  size_t size_max;\r\n  size_t size_used;\r\n};\r\ntypedef struct Curl_send_buffer Curl_send_buffer;\r\n\r\nCurl_send_buffer *Curl_add_buffer_init(void);\r\nCURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...);\r\nCURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size);\r\nCURLcode Curl_add_buffer_send(Curl_send_buffer *in,\r\n                              struct connectdata *conn,\r\n                              long *bytes_written,\r\n                              size_t included_body_bytes,\r\n                              int socketindex);\r\n\r\nCURLcode Curl_add_timecondition(struct SessionHandle *data,\r\n                                Curl_send_buffer *buf);\r\nCURLcode Curl_add_custom_headers(struct connectdata *conn,\r\n                                   Curl_send_buffer *req_buffer);\r\n\r\n/* protocol-specific functions set up to be called by the main engine */\r\nCURLcode Curl_http(struct connectdata *conn, bool *done);\r\nCURLcode Curl_http_done(struct connectdata *, CURLcode, bool premature);\r\nCURLcode Curl_http_connect(struct connectdata *conn, bool *done);\r\n\r\n/* The following functions are defined in http_chunks.c */\r\nvoid Curl_httpchunk_init(struct connectdata *conn);\r\nCHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,\r\n                              ssize_t length, ssize_t *wrote);\r\n\r\n/* These functions are in http.c */\r\nvoid Curl_http_auth_stage(struct SessionHandle *data, int stage);\r\nCURLcode Curl_http_input_auth(struct connectdata *conn,\r\n                              int httpcode, const char *header);\r\nCURLcode Curl_http_auth_act(struct connectdata *conn);\r\nCURLcode Curl_http_perhapsrewind(struct connectdata *conn);\r\n\r\n/* If only the PICKNONE bit is set, there has been a round-trip and we\r\n   selected to use no auth at all. Ie, we actively select no auth, as opposed\r\n   to not having one selected. The other CURLAUTH_* defines are present in the\r\n   public curl/curl.h header. */\r\n#define CURLAUTH_PICKNONE (1<<30) /* don't use auth */\r\n\r\n/* MAX_INITIAL_POST_SIZE indicates the number of bytes that will make the POST\r\n   data get included in the initial data chunk sent to the server. If the\r\n   data is larger than this, it will automatically get split up in multiple\r\n   system calls.\r\n\r\n   This value used to be fairly big (100K), but we must take into account that\r\n   if the server rejects the POST due for authentication reasons, this data\r\n   will always be uncondtionally sent and thus it may not be larger than can\r\n   always be afforded to send twice.\r\n\r\n   It must not be greater than 64K to work on VMS.\r\n*/\r\n#ifndef MAX_INITIAL_POST_SIZE\r\n#define MAX_INITIAL_POST_SIZE (64*1024)\r\n#endif\r\n\r\n#ifndef TINY_INITIAL_POST_SIZE\r\n#define TINY_INITIAL_POST_SIZE 1024\r\n#endif\r\n\r\n#endif /* CURL_DISABLE_HTTP */\r\n\r\n/****************************************************************************\r\n * HTTP unique setup\r\n ***************************************************************************/\r\nstruct HTTP {\r\n  struct FormData *sendit;\r\n  curl_off_t postsize; /* off_t to handle large file sizes */\r\n  const char *postdata;\r\n\r\n  const char *p_pragma;      /* Pragma: string */\r\n  const char *p_accept;      /* Accept: string */\r\n  curl_off_t readbytecount;\r\n  curl_off_t writebytecount;\r\n\r\n  /* For FORM posting */\r\n  struct Form form;\r\n\r\n  struct back {\r\n    curl_read_callback fread_func; /* backup storage for fread pointer */\r\n    void *fread_in;           /* backup storage for fread_in pointer */\r\n    const char *postdata;\r\n    curl_off_t postsize;\r\n  } backup;\r\n\r\n  enum {\r\n    HTTPSEND_NADA,    /* init */\r\n    HTTPSEND_REQUEST, /* sending a request */\r\n    HTTPSEND_BODY,    /* sending body */\r\n    HTTPSEND_LAST     /* never use this */\r\n  } sending;\r\n\r\n  void *send_buffer; /* used if the request couldn't be sent in one chunk,\r\n                        points to an allocated send_buffer struct */\r\n};\r\n\r\nCURLcode Curl_http_readwrite_headers(struct SessionHandle *data,\r\n                                     struct connectdata *conn,\r\n                                     ssize_t *nread,\r\n                                     bool *stop_reading);\r\n\r\n/**\r\n * Curl_http_output_auth() setups the authentication headers for the\r\n * host/proxy and the correct authentication\r\n * method. conn->data->state.authdone is set to TRUE when authentication is\r\n * done.\r\n *\r\n * @param conn all information about the current connection\r\n * @param request pointer to the request keyword\r\n * @param path pointer to the requested path\r\n * @param proxytunnel boolean if this is the request setting up a \"proxy\r\n * tunnel\"\r\n *\r\n * @returns CURLcode\r\n */\r\nCURLcode\r\nCurl_http_output_auth(struct connectdata *conn,\r\n                      const char *request,\r\n                      const char *path,\r\n                      bool proxytunnel); /* TRUE if this is the request setting\r\n                                            up the proxy tunnel */\r\n\r\n#endif /* HEADER_CURL_HTTP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_chunks.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n\r\n#include \"urldata.h\" /* it includes http_chunks.h */\r\n#include \"sendf.h\"   /* for the client write stuff */\r\n\r\n#include \"content_encoding.h\"\r\n#include \"http.h\"\r\n#include \"curl_memory.h\"\r\n#include \"non-ascii.h\" /* for Curl_convert_to_network prototype */\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Chunk format (simplified):\r\n *\r\n * <HEX SIZE>[ chunk extension ] CRLF\r\n * <DATA> CRLF\r\n *\r\n * Highlights from RFC2616 section 3.6 say:\r\n\r\n   The chunked encoding modifies the body of a message in order to\r\n   transfer it as a series of chunks, each with its own size indicator,\r\n   followed by an OPTIONAL trailer containing entity-header fields. This\r\n   allows dynamically produced content to be transferred along with the\r\n   information necessary for the recipient to verify that it has\r\n   received the full message.\r\n\r\n       Chunked-Body   = *chunk\r\n                        last-chunk\r\n                        trailer\r\n                        CRLF\r\n\r\n       chunk          = chunk-size [ chunk-extension ] CRLF\r\n                        chunk-data CRLF\r\n       chunk-size     = 1*HEX\r\n       last-chunk     = 1*(\"0\") [ chunk-extension ] CRLF\r\n\r\n       chunk-extension= *( \";\" chunk-ext-name [ \"=\" chunk-ext-val ] )\r\n       chunk-ext-name = token\r\n       chunk-ext-val  = token | quoted-string\r\n       chunk-data     = chunk-size(OCTET)\r\n       trailer        = *(entity-header CRLF)\r\n\r\n   The chunk-size field is a string of hex digits indicating the size of\r\n   the chunk. The chunked encoding is ended by any chunk whose size is\r\n   zero, followed by the trailer, which is terminated by an empty line.\r\n\r\n */\r\n\r\n/* Check for an ASCII hex digit.\r\n We avoid the use of isxdigit to accommodate non-ASCII hosts. */\r\nstatic bool Curl_isxdigit(char digit)\r\n{\r\n  return ( (digit >= 0x30 && digit <= 0x39) /* 0-9 */\r\n        || (digit >= 0x41 && digit <= 0x46) /* A-F */\r\n        || (digit >= 0x61 && digit <= 0x66) /* a-f */ ) ? TRUE : FALSE;\r\n}\r\n\r\nvoid Curl_httpchunk_init(struct connectdata *conn)\r\n{\r\n  struct Curl_chunker *chunk = &conn->chunk;\r\n  chunk->hexindex=0; /* start at 0 */\r\n  chunk->dataleft=0; /* no data left yet! */\r\n  chunk->state = CHUNK_HEX; /* we get hex first! */\r\n}\r\n\r\n/*\r\n * chunk_read() returns a OK for normal operations, or a positive return code\r\n * for errors. STOP means this sequence of chunks is complete.  The 'wrote'\r\n * argument is set to tell the caller how many bytes we actually passed to the\r\n * client (for byte-counting and whatever).\r\n *\r\n * The states and the state-machine is further explained in the header file.\r\n *\r\n * This function always uses ASCII hex values to accommodate non-ASCII hosts.\r\n * For example, 0x0d and 0x0a are used instead of '\\r' and '\\n'.\r\n */\r\nCHUNKcode Curl_httpchunk_read(struct connectdata *conn,\r\n                              char *datap,\r\n                              ssize_t datalen,\r\n                              ssize_t *wrotep)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct Curl_chunker *ch = &conn->chunk;\r\n  struct SingleRequest *k = &data->req;\r\n  size_t piece;\r\n  size_t length = (size_t)datalen;\r\n  size_t *wrote = (size_t *)wrotep;\r\n\r\n  *wrote = 0; /* nothing's written yet */\r\n\r\n  /* the original data is written to the client, but we go on with the\r\n     chunk read process, to properly calculate the content length*/\r\n  if(data->set.http_te_skip && !k->ignorebody) {\r\n    result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, datalen);\r\n    if(result)\r\n      return CHUNKE_WRITE_ERROR;\r\n  }\r\n\r\n  while(length) {\r\n    switch(ch->state) {\r\n    case CHUNK_HEX:\r\n      if(Curl_isxdigit(*datap)) {\r\n        if(ch->hexindex < MAXNUM_SIZE) {\r\n          ch->hexbuffer[ch->hexindex] = *datap;\r\n          datap++;\r\n          length--;\r\n          ch->hexindex++;\r\n        }\r\n        else {\r\n          return CHUNKE_TOO_LONG_HEX; /* longer hex than we support */\r\n        }\r\n      }\r\n      else {\r\n        if(0 == ch->hexindex) {\r\n          /* This is illegal data, we received junk where we expected\r\n             a hexadecimal digit. */\r\n          return CHUNKE_ILLEGAL_HEX;\r\n        }\r\n        /* length and datap are unmodified */\r\n        ch->hexbuffer[ch->hexindex]=0;\r\n\r\n        /* convert to host encoding before calling strtoul */\r\n        result = Curl_convert_from_network(conn->data, ch->hexbuffer,\r\n                                           ch->hexindex);\r\n        if(result) {\r\n          /* Curl_convert_from_network calls failf if unsuccessful */\r\n          /* Treat it as a bad hex character */\r\n          return(CHUNKE_ILLEGAL_HEX);\r\n        }\r\n\r\n        ch->datasize=strtoul(ch->hexbuffer, NULL, 16);\r\n        ch->state = CHUNK_POSTHEX;\r\n      }\r\n      break;\r\n\r\n    case CHUNK_POSTHEX:\r\n      /* In this state, we're waiting for CRLF to arrive. We support\r\n         this to allow so called chunk-extensions to show up here\r\n         before the CRLF comes. */\r\n      if(*datap == 0x0d)\r\n        ch->state = CHUNK_CR;\r\n      length--;\r\n      datap++;\r\n      break;\r\n\r\n    case CHUNK_CR:\r\n      /* waiting for the LF */\r\n      if(*datap == 0x0a) {\r\n        /* we're now expecting data to come, unless size was zero! */\r\n        if(0 == ch->datasize) {\r\n          ch->state = CHUNK_TRAILER; /* now check for trailers */\r\n          conn->trlPos=0;\r\n        }\r\n        else {\r\n          ch->state = CHUNK_DATA;\r\n        }\r\n      }\r\n      else\r\n        /* previously we got a fake CR, go back to CR waiting! */\r\n        ch->state = CHUNK_CR;\r\n      datap++;\r\n      length--;\r\n      break;\r\n\r\n    case CHUNK_DATA:\r\n      /* we get pure and fine data\r\n\r\n         We expect another 'datasize' of data. We have 'length' right now,\r\n         it can be more or less than 'datasize'. Get the smallest piece.\r\n      */\r\n      piece = (ch->datasize >= length)?length:ch->datasize;\r\n\r\n      /* Write the data portion available */\r\n#ifdef HAVE_LIBZ\r\n      switch (conn->data->set.http_ce_skip?\r\n              IDENTITY : data->req.auto_decoding) {\r\n      case IDENTITY:\r\n#endif\r\n        if(!k->ignorebody) {\r\n          if(!data->set.http_te_skip)\r\n            result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,\r\n                                       piece);\r\n          else\r\n            result = CURLE_OK;\r\n        }\r\n#ifdef HAVE_LIBZ\r\n        break;\r\n\r\n      case DEFLATE:\r\n        /* update data->req.keep.str to point to the chunk data. */\r\n        data->req.str = datap;\r\n        result = Curl_unencode_deflate_write(conn, &data->req,\r\n                                             (ssize_t)piece);\r\n        break;\r\n\r\n      case GZIP:\r\n        /* update data->req.keep.str to point to the chunk data. */\r\n        data->req.str = datap;\r\n        result = Curl_unencode_gzip_write(conn, &data->req,\r\n                                          (ssize_t)piece);\r\n        break;\r\n\r\n      case COMPRESS:\r\n      default:\r\n        failf (conn->data,\r\n               \"Unrecognized content encoding type. \"\r\n               \"libcurl understands `identity', `deflate' and `gzip' \"\r\n               \"content encodings.\");\r\n        return CHUNKE_BAD_ENCODING;\r\n      }\r\n#endif\r\n\r\n      if(result)\r\n        return CHUNKE_WRITE_ERROR;\r\n\r\n      *wrote += piece;\r\n\r\n      ch->datasize -= piece; /* decrease amount left to expect */\r\n      datap += piece;    /* move read pointer forward */\r\n      length -= piece;   /* decrease space left in this round */\r\n\r\n      if(0 == ch->datasize)\r\n        /* end of data this round, we now expect a trailing CRLF */\r\n        ch->state = CHUNK_POSTCR;\r\n      break;\r\n\r\n    case CHUNK_POSTCR:\r\n      if(*datap == 0x0d) {\r\n        ch->state = CHUNK_POSTLF;\r\n        datap++;\r\n        length--;\r\n      }\r\n      else\r\n        return CHUNKE_BAD_CHUNK;\r\n\r\n      break;\r\n\r\n    case CHUNK_POSTLF:\r\n      if(*datap == 0x0a) {\r\n        /*\r\n         * The last one before we go back to hex state and start all\r\n         * over.\r\n         */\r\n        Curl_httpchunk_init(conn);\r\n        datap++;\r\n        length--;\r\n      }\r\n      else\r\n        return CHUNKE_BAD_CHUNK;\r\n\r\n      break;\r\n\r\n    case CHUNK_TRAILER:\r\n      if(*datap == 0x0d) {\r\n        /* this is the end of a trailer, but if the trailer was zero bytes\r\n           there was no trailer and we move on */\r\n\r\n        if(conn->trlPos) {\r\n          /* we allocate trailer with 3 bytes extra room to fit this */\r\n          conn->trailer[conn->trlPos++]=0x0d;\r\n          conn->trailer[conn->trlPos++]=0x0a;\r\n          conn->trailer[conn->trlPos]=0;\r\n\r\n          /* Convert to host encoding before calling Curl_client_write */\r\n          result = Curl_convert_from_network(conn->data, conn->trailer,\r\n                                             conn->trlPos);\r\n          if(result)\r\n            /* Curl_convert_from_network calls failf if unsuccessful */\r\n            /* Treat it as a bad chunk */\r\n            return CHUNKE_BAD_CHUNK;\r\n\r\n          if(!data->set.http_te_skip) {\r\n            result = Curl_client_write(conn, CLIENTWRITE_HEADER,\r\n                                       conn->trailer, conn->trlPos);\r\n            if(result)\r\n              return CHUNKE_WRITE_ERROR;\r\n          }\r\n          conn->trlPos=0;\r\n          ch->state = CHUNK_TRAILER_CR;\r\n        }\r\n        else {\r\n          /* no trailer, we're on the final CRLF pair */\r\n          ch->state = CHUNK_TRAILER_POSTCR;\r\n          break; /* don't advance the pointer */\r\n        }\r\n      }\r\n      else {\r\n        /* conn->trailer is assumed to be freed in url.c on a\r\n           connection basis */\r\n        if(conn->trlPos >= conn->trlMax) {\r\n          /* we always allocate three extra bytes, just because when the full\r\n             header has been received we append CRLF\\0 */\r\n          char *ptr;\r\n          if(conn->trlMax) {\r\n            conn->trlMax *= 2;\r\n            ptr = realloc(conn->trailer, conn->trlMax + 3);\r\n          }\r\n          else {\r\n            conn->trlMax=128;\r\n            ptr = malloc(conn->trlMax + 3);\r\n          }\r\n          if(!ptr)\r\n            return CHUNKE_OUT_OF_MEMORY;\r\n          conn->trailer = ptr;\r\n        }\r\n        conn->trailer[conn->trlPos++]=*datap;\r\n      }\r\n      datap++;\r\n      length--;\r\n      break;\r\n\r\n    case CHUNK_TRAILER_CR:\r\n      if(*datap == 0x0a) {\r\n        ch->state = CHUNK_TRAILER_POSTCR;\r\n        datap++;\r\n        length--;\r\n      }\r\n      else\r\n        return CHUNKE_BAD_CHUNK;\r\n      break;\r\n\r\n    case CHUNK_TRAILER_POSTCR:\r\n      /* We enter this state when a CR should arrive so we expect to\r\n         have to first pass a CR before we wait for LF */\r\n      if(*datap != 0x0d) {\r\n        /* not a CR then it must be another header in the trailer */\r\n        ch->state = CHUNK_TRAILER;\r\n        break;\r\n      }\r\n      datap++;\r\n      length--;\r\n      /* now wait for the final LF */\r\n      ch->state = CHUNK_STOP;\r\n      break;\r\n\r\n    case CHUNK_STOPCR:\r\n      /* Read the final CRLF that ends all chunk bodies */\r\n\r\n      if(*datap == 0x0d) {\r\n        ch->state = CHUNK_STOP;\r\n        datap++;\r\n        length--;\r\n      }\r\n      else\r\n        return CHUNKE_BAD_CHUNK;\r\n      break;\r\n\r\n    case CHUNK_STOP:\r\n      if(*datap == 0x0a) {\r\n        length--;\r\n\r\n        /* Record the length of any data left in the end of the buffer\r\n           even if there's no more chunks to read */\r\n\r\n        ch->dataleft = length;\r\n        return CHUNKE_STOP; /* return stop */\r\n      }\r\n      else\r\n        return CHUNKE_BAD_CHUNK;\r\n\r\n    default:\r\n      return CHUNKE_STATE_ERROR;\r\n    }\r\n  }\r\n  return CHUNKE_OK;\r\n}\r\n#endif /* CURL_DISABLE_HTTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_chunks.h",
    "content": "#ifndef HEADER_CURL_HTTP_CHUNKS_H\r\n#define HEADER_CURL_HTTP_CHUNKS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n * The longest possible hexadecimal number we support in a chunked transfer.\r\n * Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()\r\n * to convert it, we \"only\" support 2^32 bytes chunk data.\r\n */\r\n#define MAXNUM_SIZE 16\r\n\r\ntypedef enum {\r\n  CHUNK_FIRST, /* never use */\r\n\r\n  /* In this we await and buffer all hexadecimal digits until we get one\r\n     that isn't a hexadecimal digit. When done, we go POSTHEX */\r\n  CHUNK_HEX,\r\n\r\n  /* We have received the hexadecimal digit and we eat all characters until\r\n     we get a CRLF pair. When we see a CR we go to the CR state. */\r\n  CHUNK_POSTHEX,\r\n\r\n  /* A single CR has been found and we should get a LF right away in this\r\n     state or we go back to POSTHEX. When LF is received, we go to DATA.\r\n     If the size given was zero, we set state to STOP and return. */\r\n  CHUNK_CR,\r\n\r\n  /* We eat the amount of data specified. When done, we move on to the\r\n     POST_CR state. */\r\n  CHUNK_DATA,\r\n\r\n  /* POSTCR should get a CR and nothing else, then move to POSTLF */\r\n  CHUNK_POSTCR,\r\n\r\n  /* POSTLF should get a LF and nothing else, then move back to HEX as the\r\n     CRLF combination marks the end of a chunk */\r\n  CHUNK_POSTLF,\r\n\r\n  /* Each Chunk body should end with a CRLF.  Read a CR and nothing else,\r\n     then move to CHUNK_STOP */\r\n  CHUNK_STOPCR,\r\n\r\n  /* This is mainly used to really mark that we're out of the game.\r\n     NOTE: that there's a 'dataleft' field in the struct that will tell how\r\n     many bytes that were not passed to the client in the end of the last\r\n     buffer! */\r\n  CHUNK_STOP,\r\n\r\n  /* At this point optional trailer headers can be found, unless the next line\r\n     is CRLF */\r\n  CHUNK_TRAILER,\r\n\r\n  /* A trailer CR has been found - next state is CHUNK_TRAILER_POSTCR.\r\n     Next char must be a LF */\r\n  CHUNK_TRAILER_CR,\r\n\r\n  /* A trailer LF must be found now, otherwise CHUNKE_BAD_CHUNK will be\r\n     signalled If this is an empty trailer CHUNKE_STOP will be signalled.\r\n     Otherwise the trailer will be broadcasted via Curl_client_write() and the\r\n     next state will be CHUNK_TRAILER */\r\n  CHUNK_TRAILER_POSTCR,\r\n\r\n  CHUNK_LAST /* never use */\r\n\r\n} ChunkyState;\r\n\r\ntypedef enum {\r\n  CHUNKE_STOP = -1,\r\n  CHUNKE_OK = 0,\r\n  CHUNKE_TOO_LONG_HEX = 1,\r\n  CHUNKE_ILLEGAL_HEX,\r\n  CHUNKE_BAD_CHUNK,\r\n  CHUNKE_WRITE_ERROR,\r\n  CHUNKE_STATE_ERROR,\r\n  CHUNKE_BAD_ENCODING,\r\n  CHUNKE_OUT_OF_MEMORY,\r\n  CHUNKE_LAST\r\n} CHUNKcode;\r\n\r\nstruct Curl_chunker {\r\n  char hexbuffer[ MAXNUM_SIZE + 1];\r\n  int hexindex;\r\n  ChunkyState state;\r\n  size_t datasize;\r\n  size_t dataleft; /* untouched data amount at the end of the last buffer */\r\n};\r\n\r\n#endif /* HEADER_CURL_HTTP_CHUNKS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_digest.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_base64.h\"\r\n#include \"curl_md5.h\"\r\n#include \"http_digest.h\"\r\n#include \"strtok.h\"\r\n#include \"url.h\" /* for Curl_safefree() */\r\n#include \"curl_memory.h\"\r\n#include \"non-ascii.h\" /* included for Curl_convert_... prototypes */\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define MAX_VALUE_LENGTH 256\r\n#define MAX_CONTENT_LENGTH 1024\r\n\r\nstatic void digest_cleanup_one(struct digestdata *dig);\r\n\r\n/*\r\n * Return 0 on success and then the buffers are filled in fine.\r\n *\r\n * Non-zero means failure to parse.\r\n */\r\nstatic int get_pair(const char *str, char *value, char *content,\r\n                    const char **endptr)\r\n{\r\n  int c;\r\n  bool starts_with_quote = FALSE;\r\n  bool escape = FALSE;\r\n\r\n  for(c=MAX_VALUE_LENGTH-1; (*str && (*str != '=') && c--); )\r\n    *value++ = *str++;\r\n  *value=0;\r\n\r\n  if('=' != *str++)\r\n    /* eek, no match */\r\n    return 1;\r\n\r\n  if('\\\"' == *str) {\r\n    /* this starts with a quote so it must end with one as well! */\r\n    str++;\r\n    starts_with_quote = TRUE;\r\n  }\r\n\r\n  for(c=MAX_CONTENT_LENGTH-1; *str && c--; str++) {\r\n    switch(*str) {\r\n    case '\\\\':\r\n      if(!escape) {\r\n        /* possibly the start of an escaped quote */\r\n        escape = TRUE;\r\n        *content++ = '\\\\'; /* even though this is an escape character, we still\r\n                              store it as-is in the target buffer */\r\n        continue;\r\n      }\r\n      break;\r\n    case ',':\r\n      if(!starts_with_quote) {\r\n        /* this signals the end of the content if we didn't get a starting\r\n           quote and then we do \"sloppy\" parsing */\r\n        c=0; /* the end */\r\n        continue;\r\n      }\r\n      break;\r\n    case '\\r':\r\n    case '\\n':\r\n      /* end of string */\r\n      c=0;\r\n      continue;\r\n    case '\\\"':\r\n      if(!escape && starts_with_quote) {\r\n        /* end of string */\r\n        c=0;\r\n        continue;\r\n      }\r\n      break;\r\n    }\r\n    escape = FALSE;\r\n    *content++ = *str;\r\n  }\r\n  *content=0;\r\n\r\n  *endptr = str;\r\n\r\n  return 0; /* all is fine! */\r\n}\r\n\r\n/* Test example headers:\r\n\r\nWWW-Authenticate: Digest realm=\"testrealm\", nonce=\"1053604598\"\r\nProxy-Authenticate: Digest realm=\"testrealm\", nonce=\"1053604598\"\r\n\r\n*/\r\n\r\nCURLdigest Curl_input_digest(struct connectdata *conn,\r\n                             bool proxy,\r\n                             const char *header) /* rest of the *-authenticate:\r\n                                                    header */\r\n{\r\n  char *token = NULL;\r\n  char *tmp = NULL;\r\n  bool foundAuth = FALSE;\r\n  bool foundAuthInt = FALSE;\r\n  struct SessionHandle *data=conn->data;\r\n  bool before = FALSE; /* got a nonce before */\r\n  struct digestdata *d;\r\n\r\n  if(proxy) {\r\n    d = &data->state.proxydigest;\r\n  }\r\n  else {\r\n    d = &data->state.digest;\r\n  }\r\n\r\n  /* skip initial whitespaces */\r\n  while(*header && ISSPACE(*header))\r\n    header++;\r\n\r\n  if(checkprefix(\"Digest\", header)) {\r\n    header += strlen(\"Digest\");\r\n\r\n    /* If we already have received a nonce, keep that in mind */\r\n    if(d->nonce)\r\n      before = TRUE;\r\n\r\n    /* clear off any former leftovers and init to defaults */\r\n    digest_cleanup_one(d);\r\n\r\n    for(;;) {\r\n      char value[MAX_VALUE_LENGTH];\r\n      char content[MAX_CONTENT_LENGTH];\r\n\r\n      while(*header && ISSPACE(*header))\r\n        header++;\r\n\r\n      /* extract a value=content pair */\r\n      if(!get_pair(header, value, content, &header)) {\r\n        if(Curl_raw_equal(value, \"nonce\")) {\r\n          d->nonce = strdup(content);\r\n          if(!d->nonce)\r\n            return CURLDIGEST_NOMEM;\r\n        }\r\n        else if(Curl_raw_equal(value, \"stale\")) {\r\n          if(Curl_raw_equal(content, \"true\")) {\r\n            d->stale = TRUE;\r\n            d->nc = 1; /* we make a new nonce now */\r\n          }\r\n        }\r\n        else if(Curl_raw_equal(value, \"realm\")) {\r\n          d->realm = strdup(content);\r\n          if(!d->realm)\r\n            return CURLDIGEST_NOMEM;\r\n        }\r\n        else if(Curl_raw_equal(value, \"opaque\")) {\r\n          d->opaque = strdup(content);\r\n          if(!d->opaque)\r\n            return CURLDIGEST_NOMEM;\r\n        }\r\n        else if(Curl_raw_equal(value, \"qop\")) {\r\n          char *tok_buf;\r\n          /* tokenize the list and choose auth if possible, use a temporary\r\n             clone of the buffer since strtok_r() ruins it */\r\n          tmp = strdup(content);\r\n          if(!tmp)\r\n            return CURLDIGEST_NOMEM;\r\n          token = strtok_r(tmp, \",\", &tok_buf);\r\n          while(token != NULL) {\r\n            if(Curl_raw_equal(token, \"auth\")) {\r\n              foundAuth = TRUE;\r\n            }\r\n            else if(Curl_raw_equal(token, \"auth-int\")) {\r\n              foundAuthInt = TRUE;\r\n            }\r\n            token = strtok_r(NULL, \",\", &tok_buf);\r\n          }\r\n          free(tmp);\r\n          /*select only auth o auth-int. Otherwise, ignore*/\r\n          if(foundAuth) {\r\n            d->qop = strdup(\"auth\");\r\n            if(!d->qop)\r\n              return CURLDIGEST_NOMEM;\r\n          }\r\n          else if(foundAuthInt) {\r\n            d->qop = strdup(\"auth-int\");\r\n            if(!d->qop)\r\n              return CURLDIGEST_NOMEM;\r\n          }\r\n        }\r\n        else if(Curl_raw_equal(value, \"algorithm\")) {\r\n          d->algorithm = strdup(content);\r\n          if(!d->algorithm)\r\n            return CURLDIGEST_NOMEM;\r\n          if(Curl_raw_equal(content, \"MD5-sess\"))\r\n            d->algo = CURLDIGESTALGO_MD5SESS;\r\n          else if(Curl_raw_equal(content, \"MD5\"))\r\n            d->algo = CURLDIGESTALGO_MD5;\r\n          else\r\n            return CURLDIGEST_BADALGO;\r\n        }\r\n        else {\r\n          /* unknown specifier, ignore it! */\r\n        }\r\n      }\r\n      else\r\n        break; /* we're done here */\r\n\r\n      /* pass all additional spaces here */\r\n      while(*header && ISSPACE(*header))\r\n        header++;\r\n      if(',' == *header)\r\n        /* allow the list to be comma-separated */\r\n        header++;\r\n    }\r\n    /* We had a nonce since before, and we got another one now without\r\n       'stale=true'. This means we provided bad credentials in the previous\r\n       request */\r\n    if(before && !d->stale)\r\n      return CURLDIGEST_BAD;\r\n\r\n    /* We got this header without a nonce, that's a bad Digest line! */\r\n    if(!d->nonce)\r\n      return CURLDIGEST_BAD;\r\n  }\r\n  else\r\n    /* else not a digest, get out */\r\n    return CURLDIGEST_NONE;\r\n\r\n  return CURLDIGEST_FINE;\r\n}\r\n\r\n/* convert md5 chunk to RFC2617 (section 3.1.3) -suitable ascii string*/\r\nstatic void md5_to_ascii(unsigned char *source, /* 16 bytes */\r\n                         unsigned char *dest) /* 33 bytes */\r\n{\r\n  int i;\r\n  for(i=0; i<16; i++)\r\n    snprintf((char *)&dest[i*2], 3, \"%02x\", source[i]);\r\n}\r\n\r\nCURLcode Curl_output_digest(struct connectdata *conn,\r\n                            bool proxy,\r\n                            const unsigned char *request,\r\n                            const unsigned char *uripath)\r\n{\r\n  /* We have a Digest setup for this, use it!  Now, to get all the details for\r\n     this sorted out, I must urge you dear friend to read up on the RFC2617\r\n     section 3.2.2, */\r\n  unsigned char md5buf[16]; /* 16 bytes/128 bits */\r\n  unsigned char request_digest[33];\r\n  unsigned char *md5this;\r\n  unsigned char *ha1;\r\n  unsigned char ha2[33];/* 32 digits and 1 zero byte */\r\n  char cnoncebuf[33];\r\n  char *cnonce = NULL;\r\n  size_t cnonce_sz = 0;\r\n  char *tmp = NULL;\r\n  struct timeval now;\r\n\r\n  char **allocuserpwd;\r\n  const char *userp;\r\n  const char *passwdp;\r\n  struct auth *authp;\r\n\r\n  struct SessionHandle *data = conn->data;\r\n  struct digestdata *d;\r\n  CURLcode rc;\r\n/* The CURL_OUTPUT_DIGEST_CONV macro below is for non-ASCII machines.\r\n   It converts digest text to ASCII so the MD5 will be correct for\r\n   what ultimately goes over the network.\r\n*/\r\n#define CURL_OUTPUT_DIGEST_CONV(a, b) \\\r\n  rc = Curl_convert_to_network(a, (char *)b, strlen((const char*)b)); \\\r\n  if(rc != CURLE_OK) { \\\r\n    free(b); \\\r\n    return rc; \\\r\n  }\r\n\r\n  if(proxy) {\r\n    d = &data->state.proxydigest;\r\n    allocuserpwd = &conn->allocptr.proxyuserpwd;\r\n    userp = conn->proxyuser;\r\n    passwdp = conn->proxypasswd;\r\n    authp = &data->state.authproxy;\r\n  }\r\n  else {\r\n    d = &data->state.digest;\r\n    allocuserpwd = &conn->allocptr.userpwd;\r\n    userp = conn->user;\r\n    passwdp = conn->passwd;\r\n    authp = &data->state.authhost;\r\n  }\r\n\r\n  if(*allocuserpwd) {\r\n    Curl_safefree(*allocuserpwd);\r\n    *allocuserpwd = NULL;\r\n  }\r\n\r\n  /* not set means empty */\r\n  if(!userp)\r\n    userp=\"\";\r\n\r\n  if(!passwdp)\r\n    passwdp=\"\";\r\n\r\n  if(!d->nonce) {\r\n    authp->done = FALSE;\r\n    return CURLE_OK;\r\n  }\r\n  authp->done = TRUE;\r\n\r\n  if(!d->nc)\r\n    d->nc = 1;\r\n\r\n  if(!d->cnonce) {\r\n    /* Generate a cnonce */\r\n    now = Curl_tvnow();\r\n    snprintf(cnoncebuf, sizeof(cnoncebuf), \"%32ld\",\r\n             (long)now.tv_sec + now.tv_usec);\r\n\r\n    rc = Curl_base64_encode(data, cnoncebuf, strlen(cnoncebuf),\r\n                            &cnonce, &cnonce_sz);\r\n    if(rc)\r\n      return rc;\r\n    d->cnonce = cnonce;\r\n  }\r\n\r\n  /*\r\n    if the algorithm is \"MD5\" or unspecified (which then defaults to MD5):\r\n\r\n    A1 = unq(username-value) \":\" unq(realm-value) \":\" passwd\r\n\r\n    if the algorithm is \"MD5-sess\" then:\r\n\r\n    A1 = H( unq(username-value) \":\" unq(realm-value) \":\" passwd )\r\n         \":\" unq(nonce-value) \":\" unq(cnonce-value)\r\n  */\r\n\r\n  md5this = (unsigned char *)\r\n    aprintf(\"%s:%s:%s\", userp, d->realm, passwdp);\r\n  if(!md5this)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */\r\n  Curl_md5it(md5buf, md5this);\r\n  free(md5this); /* free this again */\r\n\r\n  ha1 = malloc(33); /* 32 digits and 1 zero byte */\r\n  if(!ha1)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  md5_to_ascii(md5buf, ha1);\r\n\r\n  if(d->algo == CURLDIGESTALGO_MD5SESS) {\r\n    /* nonce and cnonce are OUTSIDE the hash */\r\n    tmp = aprintf(\"%s:%s:%s\", ha1, d->nonce, d->cnonce);\r\n    if(!tmp)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    CURL_OUTPUT_DIGEST_CONV(data, tmp); /* convert on non-ASCII machines */\r\n    Curl_md5it(md5buf, (unsigned char *)tmp);\r\n    free(tmp); /* free this again */\r\n    md5_to_ascii(md5buf, ha1);\r\n  }\r\n\r\n  /*\r\n    If the \"qop\" directive's value is \"auth\" or is unspecified, then A2 is:\r\n\r\n      A2       = Method \":\" digest-uri-value\r\n\r\n          If the \"qop\" value is \"auth-int\", then A2 is:\r\n\r\n      A2       = Method \":\" digest-uri-value \":\" H(entity-body)\r\n\r\n    (The \"Method\" value is the HTTP request method as specified in section\r\n    5.1.1 of RFC 2616)\r\n  */\r\n\r\n  /* So IE browsers < v7 cut off the URI part at the query part when they\r\n     evaluate the MD5 and some (IIS?) servers work with them so we may need to\r\n     do the Digest IE-style. Note that the different ways cause different MD5\r\n     sums to get sent.\r\n\r\n     Apache servers can be set to do the Digest IE-style automatically using\r\n     the BrowserMatch feature:\r\n     http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#msie\r\n\r\n     Further details on Digest implementation differences:\r\n     http://www.fngtps.com/2006/09/http-authentication\r\n  */\r\n  if(authp->iestyle && ((tmp = strchr((char *)uripath, '?')) != NULL)) {\r\n    md5this = (unsigned char *)aprintf(\"%s:%.*s\", request,\r\n                                       curlx_sztosi(tmp - (char *)uripath),\r\n                                       uripath);\r\n  }\r\n  else\r\n    md5this = (unsigned char *)aprintf(\"%s:%s\", request, uripath);\r\n\r\n  if(!md5this) {\r\n    free(ha1);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  if(d->qop && Curl_raw_equal(d->qop, \"auth-int\")) {\r\n    /* We don't support auth-int at the moment. I can't see a easy way to get\r\n       entity-body here */\r\n    /* TODO: Append H(entity-body)*/\r\n  }\r\n  CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */\r\n  Curl_md5it(md5buf, md5this);\r\n  free(md5this); /* free this again */\r\n  md5_to_ascii(md5buf, ha2);\r\n\r\n  if(d->qop) {\r\n    md5this = (unsigned char *)aprintf(\"%s:%s:%08x:%s:%s:%s\",\r\n                                       ha1,\r\n                                       d->nonce,\r\n                                       d->nc,\r\n                                       d->cnonce,\r\n                                       d->qop,\r\n                                       ha2);\r\n  }\r\n  else {\r\n    md5this = (unsigned char *)aprintf(\"%s:%s:%s\",\r\n                                       ha1,\r\n                                       d->nonce,\r\n                                       ha2);\r\n  }\r\n  free(ha1);\r\n  if(!md5this)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */\r\n  Curl_md5it(md5buf, md5this);\r\n  free(md5this); /* free this again */\r\n  md5_to_ascii(md5buf, request_digest);\r\n\r\n  /* for test case 64 (snooped from a Mozilla 1.3a request)\r\n\r\n    Authorization: Digest username=\"testuser\", realm=\"testrealm\", \\\r\n    nonce=\"1053604145\", uri=\"/64\", response=\"c55f7f30d83d774a3d2dcacf725abaca\"\r\n  */\r\n\r\n  if(d->qop) {\r\n    *allocuserpwd =\r\n      aprintf( \"%sAuthorization: Digest \"\r\n               \"username=\\\"%s\\\", \"\r\n               \"realm=\\\"%s\\\", \"\r\n               \"nonce=\\\"%s\\\", \"\r\n               \"uri=\\\"%s\\\", \"\r\n               \"cnonce=\\\"%s\\\", \"\r\n               \"nc=%08x, \"\r\n               \"qop=%s, \"\r\n               \"response=\\\"%s\\\"\",\r\n               proxy?\"Proxy-\":\"\",\r\n               userp,\r\n               d->realm,\r\n               d->nonce,\r\n               uripath, /* this is the PATH part of the URL */\r\n               d->cnonce,\r\n               d->nc,\r\n               d->qop,\r\n               request_digest);\r\n\r\n    if(Curl_raw_equal(d->qop, \"auth\"))\r\n      d->nc++; /* The nc (from RFC) has to be a 8 hex digit number 0 padded\r\n                  which tells to the server how many times you are using the\r\n                  same nonce in the qop=auth mode. */\r\n  }\r\n  else {\r\n    *allocuserpwd =\r\n      aprintf( \"%sAuthorization: Digest \"\r\n               \"username=\\\"%s\\\", \"\r\n               \"realm=\\\"%s\\\", \"\r\n               \"nonce=\\\"%s\\\", \"\r\n               \"uri=\\\"%s\\\", \"\r\n               \"response=\\\"%s\\\"\",\r\n               proxy?\"Proxy-\":\"\",\r\n               userp,\r\n               d->realm,\r\n               d->nonce,\r\n               uripath, /* this is the PATH part of the URL */\r\n               request_digest);\r\n  }\r\n  if(!*allocuserpwd)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* Add optional fields */\r\n  if(d->opaque) {\r\n    /* append opaque */\r\n    tmp = aprintf(\"%s, opaque=\\\"%s\\\"\", *allocuserpwd, d->opaque);\r\n    if(!tmp)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    free(*allocuserpwd);\r\n    *allocuserpwd = tmp;\r\n  }\r\n\r\n  if(d->algorithm) {\r\n    /* append algorithm */\r\n    tmp = aprintf(\"%s, algorithm=\\\"%s\\\"\", *allocuserpwd, d->algorithm);\r\n    if(!tmp)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    free(*allocuserpwd);\r\n    *allocuserpwd = tmp;\r\n  }\r\n\r\n  /* append CRLF + zero (3 bytes) to the userpwd header */\r\n  tmp = realloc(*allocuserpwd, strlen(*allocuserpwd) + 3);\r\n  if(!tmp)\r\n    return CURLE_OUT_OF_MEMORY;\r\n  strcat(tmp, \"\\r\\n\");\r\n  *allocuserpwd = tmp;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic void digest_cleanup_one(struct digestdata *d)\r\n{\r\n  if(d->nonce)\r\n    free(d->nonce);\r\n  d->nonce = NULL;\r\n\r\n  if(d->cnonce)\r\n    free(d->cnonce);\r\n  d->cnonce = NULL;\r\n\r\n  if(d->realm)\r\n    free(d->realm);\r\n  d->realm = NULL;\r\n\r\n  if(d->opaque)\r\n    free(d->opaque);\r\n  d->opaque = NULL;\r\n\r\n  if(d->qop)\r\n    free(d->qop);\r\n  d->qop = NULL;\r\n\r\n  if(d->algorithm)\r\n    free(d->algorithm);\r\n  d->algorithm = NULL;\r\n\r\n  d->nc = 0;\r\n  d->algo = CURLDIGESTALGO_MD5; /* default algorithm */\r\n  d->stale = FALSE; /* default means normal, not stale */\r\n}\r\n\r\n\r\nvoid Curl_digest_cleanup(struct SessionHandle *data)\r\n{\r\n  digest_cleanup_one(&data->state.digest);\r\n  digest_cleanup_one(&data->state.proxydigest);\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_digest.h",
    "content": "#ifndef HEADER_CURL_HTTP_DIGEST_H\r\n#define HEADER_CURL_HTTP_DIGEST_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\ntypedef enum {\r\n  CURLDIGEST_NONE, /* not a digest */\r\n  CURLDIGEST_BAD,  /* a digest, but one we don't like */\r\n  CURLDIGEST_BADALGO, /* unsupported algorithm requested */\r\n  CURLDIGEST_NOMEM,\r\n  CURLDIGEST_FINE, /* a digest we act on */\r\n\r\n  CURLDIGEST_LAST  /* last entry in this enum, don't use */\r\n} CURLdigest;\r\n\r\nenum {\r\n  CURLDIGESTALGO_MD5,\r\n  CURLDIGESTALGO_MD5SESS\r\n};\r\n\r\n/* this is for digest header input */\r\nCURLdigest Curl_input_digest(struct connectdata *conn,\r\n                             bool proxy, const char *header);\r\n\r\n/* this is for creating digest header output */\r\nCURLcode Curl_output_digest(struct connectdata *conn,\r\n                            bool proxy,\r\n                            const unsigned char *request,\r\n                            const unsigned char *uripath);\r\n\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)\r\nvoid Curl_digest_cleanup(struct SessionHandle *data);\r\n#else\r\n#define Curl_digest_cleanup(x) Curl_nop_stmt\r\n#endif\r\n\r\n#endif /* HEADER_CURL_HTTP_DIGEST_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_negotiate.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_GSSAPI\r\n#ifdef HAVE_OLD_GSSMIT\r\n#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name\r\n#define NCOMPAT 1\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"curl_gssapi.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_base64.h\"\r\n#include \"http_negotiate.h\"\r\n#include \"curl_memory.h\"\r\n#include \"url.h\"\r\n\r\n#ifdef HAVE_SPNEGO\r\n#  include <spnegohelp.h>\r\n#  ifdef USE_SSLEAY\r\n#    ifdef USE_OPENSSL\r\n#      include <openssl/objects.h>\r\n#    else\r\n#      include <objects.h>\r\n#    endif\r\n#  else\r\n#    error \"Can't compile SPNEGO support without OpenSSL.\"\r\n#  endif\r\n#endif\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic int\r\nget_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server)\r\n{\r\n  struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:\r\n    &conn->data->state.negotiate;\r\n  OM_uint32 major_status, minor_status;\r\n  gss_buffer_desc token = GSS_C_EMPTY_BUFFER;\r\n  char name[2048];\r\n  const char* service;\r\n\r\n  /* GSSAPI implementation by Globus (known as GSI) requires the name to be\r\n     of form \"<service>/<fqdn>\" instead of <service>@<fqdn> (ie. slash instead\r\n     of at-sign). Also GSI servers are often identified as 'host' not 'khttp'.\r\n     Change following lines if you want to use GSI */\r\n\r\n  /* IIS uses the <service>@<fqdn> form but uses 'http' as the service name */\r\n\r\n  if(neg_ctx->gss)\r\n    service = \"KHTTP\";\r\n  else\r\n    service = \"HTTP\";\r\n\r\n  token.length = strlen(service) + 1 + strlen(proxy ? conn->proxy.name :\r\n                                              conn->host.name) + 1;\r\n  if(token.length + 1 > sizeof(name))\r\n    return EMSGSIZE;\r\n\r\n  snprintf(name, sizeof(name), \"%s@%s\", service, proxy ? conn->proxy.name :\r\n           conn->host.name);\r\n\r\n  token.value = (void *) name;\r\n  major_status = gss_import_name(&minor_status,\r\n                                 &token,\r\n                                 GSS_C_NT_HOSTBASED_SERVICE,\r\n                                 server);\r\n\r\n  return GSS_ERROR(major_status) ? -1 : 0;\r\n}\r\n\r\nstatic void\r\nlog_gss_error(struct connectdata *conn, OM_uint32 error_status,\r\n              const char *prefix)\r\n{\r\n  OM_uint32 maj_stat, min_stat;\r\n  OM_uint32 msg_ctx = 0;\r\n  gss_buffer_desc status_string;\r\n  char buf[1024];\r\n  size_t len;\r\n\r\n  snprintf(buf, sizeof(buf), \"%s\", prefix);\r\n  len = strlen(buf);\r\n  do {\r\n    maj_stat = gss_display_status(&min_stat,\r\n                                  error_status,\r\n                                  GSS_C_MECH_CODE,\r\n                                  GSS_C_NO_OID,\r\n                                  &msg_ctx,\r\n                                  &status_string);\r\n      if(sizeof(buf) > len + status_string.length + 1) {\r\n        snprintf(buf + len, sizeof(buf) - len,\r\n                 \": %s\", (char*) status_string.value);\r\n      len += status_string.length;\r\n    }\r\n    gss_release_buffer(&min_stat, &status_string);\r\n  } while(!GSS_ERROR(maj_stat) && msg_ctx != 0);\r\n\r\n  infof(conn->data, \"%s\\n\", buf);\r\n}\r\n\r\n/* returning zero (0) means success, everything else is treated as \"failure\"\r\n   with no care exactly what the failure was */\r\nint Curl_input_negotiate(struct connectdata *conn, bool proxy,\r\n                         const char *header)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct negotiatedata *neg_ctx = proxy?&data->state.proxyneg:\r\n    &data->state.negotiate;\r\n  OM_uint32 major_status, minor_status, minor_status2;\r\n  gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;\r\n  gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;\r\n  int ret;\r\n  size_t len;\r\n  size_t rawlen = 0;\r\n  bool gss;\r\n  const char* protocol;\r\n  CURLcode error;\r\n\r\n  while(*header && ISSPACE(*header))\r\n    header++;\r\n  if(checkprefix(\"GSS-Negotiate\", header)) {\r\n    protocol = \"GSS-Negotiate\";\r\n    gss = TRUE;\r\n  }\r\n  else if(checkprefix(\"Negotiate\", header)) {\r\n    protocol = \"Negotiate\";\r\n    gss = FALSE;\r\n  }\r\n  else\r\n    return -1;\r\n\r\n  if(neg_ctx->context) {\r\n    if(neg_ctx->gss != gss) {\r\n      return -1;\r\n    }\r\n  }\r\n  else {\r\n    neg_ctx->protocol = protocol;\r\n    neg_ctx->gss = gss;\r\n  }\r\n\r\n  if(neg_ctx->context && neg_ctx->status == GSS_S_COMPLETE) {\r\n    /* We finished successfully our part of authentication, but server\r\n     * rejected it (since we're again here). Exit with an error since we\r\n     * can't invent anything better */\r\n    Curl_cleanup_negotiate(data);\r\n    return -1;\r\n  }\r\n\r\n  if(neg_ctx->server_name == NULL &&\r\n      (ret = get_gss_name(conn, proxy, &neg_ctx->server_name)))\r\n    return ret;\r\n\r\n  header += strlen(neg_ctx->protocol);\r\n  while(*header && ISSPACE(*header))\r\n    header++;\r\n\r\n  len = strlen(header);\r\n  if(len > 0) {\r\n    error = Curl_base64_decode(header,\r\n                               (unsigned char **)&input_token.value, &rawlen);\r\n    if(error || rawlen == 0)\r\n      return -1;\r\n    input_token.length = rawlen;\r\n\r\n#ifdef HAVE_SPNEGO /* Handle SPNEGO */\r\n    if(checkprefix(\"Negotiate\", header)) {\r\n      ASN1_OBJECT *   object            = NULL;\r\n      unsigned char * spnegoToken       = NULL;\r\n      size_t          spnegoTokenLength = 0;\r\n      unsigned char * mechToken         = NULL;\r\n      size_t          mechTokenLength   = 0;\r\n\r\n      if(input_token.value == NULL)\r\n        return CURLE_OUT_OF_MEMORY;\r\n\r\n      spnegoToken = malloc(input_token.length);\r\n      if(spnegoToken == NULL)\r\n        return CURLE_OUT_OF_MEMORY;\r\n\r\n      spnegoTokenLength = input_token.length;\r\n\r\n      object = OBJ_txt2obj (\"1.2.840.113554.1.2.2\", 1);\r\n      if(!parseSpnegoTargetToken(spnegoToken,\r\n                                 spnegoTokenLength,\r\n                                 NULL,\r\n                                 NULL,\r\n                                 &mechToken,\r\n                                 &mechTokenLength,\r\n                                 NULL,\r\n                                 NULL)) {\r\n        free(spnegoToken);\r\n        spnegoToken = NULL;\r\n        infof(data, \"Parse SPNEGO Target Token failed\\n\");\r\n      }\r\n      else {\r\n        free(input_token.value);\r\n        input_token.value = malloc(mechTokenLength);\r\n        if(input_token.value == NULL)\r\n          return CURLE_OUT_OF_MEMORY;\r\n\r\n        memcpy(input_token.value, mechToken,mechTokenLength);\r\n        input_token.length = mechTokenLength;\r\n        free(mechToken);\r\n        mechToken = NULL;\r\n        infof(data, \"Parse SPNEGO Target Token succeeded\\n\");\r\n      }\r\n    }\r\n#endif\r\n  }\r\n\r\n  major_status = Curl_gss_init_sec_context(data,\r\n                                           &minor_status,\r\n                                           &neg_ctx->context,\r\n                                           neg_ctx->server_name,\r\n                                           GSS_C_NO_CHANNEL_BINDINGS,\r\n                                           &input_token,\r\n                                           &output_token,\r\n                                           NULL);\r\n  if(input_token.length > 0)\r\n    gss_release_buffer(&minor_status2, &input_token);\r\n  neg_ctx->status = major_status;\r\n  if(GSS_ERROR(major_status)) {\r\n    /* Curl_cleanup_negotiate(data) ??? */\r\n    log_gss_error(conn, minor_status,\r\n                  \"gss_init_sec_context() failed: \");\r\n    return -1;\r\n  }\r\n\r\n  if(output_token.length == 0) {\r\n    return -1;\r\n  }\r\n\r\n  neg_ctx->output_token = output_token;\r\n  /* conn->bits.close = FALSE; */\r\n\r\n  return 0;\r\n}\r\n\r\n\r\nCURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)\r\n{\r\n  struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:\r\n    &conn->data->state.negotiate;\r\n  char *encoded = NULL;\r\n  size_t len = 0;\r\n  char *userp;\r\n  CURLcode error;\r\n\r\n#ifdef HAVE_SPNEGO /* Handle SPNEGO */\r\n  if(checkprefix(\"Negotiate\", neg_ctx->protocol)) {\r\n    ASN1_OBJECT *   object            = NULL;\r\n    unsigned char * spnegoToken       = NULL;\r\n    size_t          spnegoTokenLength = 0;\r\n    unsigned char * responseToken       = NULL;\r\n    size_t          responseTokenLength = 0;\r\n\r\n    responseToken = malloc(neg_ctx->output_token.length);\r\n    if(responseToken == NULL)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    memcpy(responseToken, neg_ctx->output_token.value,\r\n           neg_ctx->output_token.length);\r\n    responseTokenLength = neg_ctx->output_token.length;\r\n\r\n    object=OBJ_txt2obj (\"1.2.840.113554.1.2.2\", 1);\r\n    if(!makeSpnegoInitialToken (object,\r\n                                 responseToken,\r\n                                 responseTokenLength,\r\n                                 &spnegoToken,\r\n                                 &spnegoTokenLength)) {\r\n      free(responseToken);\r\n      responseToken = NULL;\r\n      infof(conn->data, \"Make SPNEGO Initial Token failed\\n\");\r\n    }\r\n    else {\r\n      free(responseToken);\r\n      responseToken = NULL;\r\n      free(neg_ctx->output_token.value);\r\n      neg_ctx->output_token.value = malloc(spnegoTokenLength);\r\n      if(neg_ctx->output_token.value == NULL) {\r\n        free(spnegoToken);\r\n        spnegoToken = NULL;\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      memcpy(neg_ctx->output_token.value, spnegoToken,spnegoTokenLength);\r\n      neg_ctx->output_token.length = spnegoTokenLength;\r\n      free(spnegoToken);\r\n      spnegoToken = NULL;\r\n      infof(conn->data, \"Make SPNEGO Initial Token succeeded\\n\");\r\n    }\r\n  }\r\n#endif\r\n  error = Curl_base64_encode(conn->data,\r\n                             neg_ctx->output_token.value,\r\n                             neg_ctx->output_token.length,\r\n                             &encoded, &len);\r\n  if(error) {\r\n    Curl_safefree(neg_ctx->output_token.value);\r\n    neg_ctx->output_token.value = NULL;\r\n    return error;\r\n  }\r\n\r\n  if(len == 0) {\r\n    Curl_safefree(neg_ctx->output_token.value);\r\n    neg_ctx->output_token.value = NULL;\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n  }\r\n\r\n  userp = aprintf(\"%sAuthorization: %s %s\\r\\n\", proxy ? \"Proxy-\" : \"\",\r\n                  neg_ctx->protocol, encoded);\r\n\r\n  if(proxy)\r\n    conn->allocptr.proxyuserpwd = userp;\r\n  else\r\n    conn->allocptr.userpwd = userp;\r\n  free(encoded);\r\n  Curl_cleanup_negotiate (conn->data);\r\n  return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;\r\n}\r\n\r\nstatic void cleanup(struct negotiatedata *neg_ctx)\r\n{\r\n  OM_uint32 minor_status;\r\n  if(neg_ctx->context != GSS_C_NO_CONTEXT)\r\n    gss_delete_sec_context(&minor_status, &neg_ctx->context, GSS_C_NO_BUFFER);\r\n\r\n  if(neg_ctx->output_token.length != 0)\r\n    gss_release_buffer(&minor_status, &neg_ctx->output_token);\r\n\r\n  if(neg_ctx->server_name != GSS_C_NO_NAME)\r\n    gss_release_name(&minor_status, &neg_ctx->server_name);\r\n\r\n  memset(neg_ctx, 0, sizeof(*neg_ctx));\r\n}\r\n\r\nvoid Curl_cleanup_negotiate(struct SessionHandle *data)\r\n{\r\n  cleanup(&data->state.negotiate);\r\n  cleanup(&data->state.proxyneg);\r\n}\r\n\r\n\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_negotiate.h",
    "content": "#ifndef HEADER_CURL_HTTP_NEGOTIATE_H\r\n#define HEADER_CURL_HTTP_NEGOTIATE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifdef USE_HTTP_NEGOTIATE\r\n\r\n/* this is for Negotiate header input */\r\nint Curl_input_negotiate(struct connectdata *conn, bool proxy,\r\n                         const char *header);\r\n\r\n/* this is for creating Negotiate header output */\r\nCURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy);\r\n\r\nvoid Curl_cleanup_negotiate(struct SessionHandle *data);\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n#define GSS_ERROR(status) (status & 0x80000000)\r\n#endif\r\n\r\n#endif /* USE_HTTP_NEGOTIATE */\r\n\r\n#endif /* HEADER_CURL_HTTP_NEGOTIATE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_negotiate_sspi.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n#include \"warnless.h\"\r\n#include \"curl_base64.h\"\r\n#include \"http_negotiate.h\"\r\n#include \"curl_memory.h\"\r\n#include \"curl_multibyte.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic int\r\nget_gss_name(struct connectdata *conn, bool proxy,\r\n             struct negotiatedata *neg_ctx)\r\n{\r\n  const char* service;\r\n  size_t length;\r\n\r\n  if(proxy && !conn->proxy.name)\r\n    /* proxy auth requested but no given proxy name, error out! */\r\n    return -1;\r\n\r\n  /* GSSAPI implementation by Globus (known as GSI) requires the name to be\r\n     of form \"<service>/<fqdn>\" instead of <service>@<fqdn> (ie. slash instead\r\n     of at-sign). Also GSI servers are often identified as 'host' not 'khttp'.\r\n     Change following lines if you want to use GSI */\r\n\r\n  /* IIS uses the <service>@<fqdn> form but uses 'http' as the service name,\r\n     and SSPI then generates an NTLM token. When using <service>/<fqdn> a\r\n     Kerberos token is generated. */\r\n\r\n  if(neg_ctx->gss)\r\n    service = \"KHTTP\";\r\n  else\r\n    service = \"HTTP\";\r\n\r\n  length = strlen(service) + 1 + strlen(proxy ? conn->proxy.name :\r\n                                        conn->host.name) + 1;\r\n  if(length + 1 > sizeof(neg_ctx->server_name))\r\n    return EMSGSIZE;\r\n\r\n  snprintf(neg_ctx->server_name, sizeof(neg_ctx->server_name), \"%s/%s\",\r\n           service, proxy ? conn->proxy.name : conn->host.name);\r\n\r\n  return 0;\r\n}\r\n\r\n/* returning zero (0) means success, everything else is treated as \"failure\"\r\n   with no care exactly what the failure was */\r\nint Curl_input_negotiate(struct connectdata *conn, bool proxy,\r\n                         const char *header)\r\n{\r\n  struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:\r\n    &conn->data->state.negotiate;\r\n  BYTE              *input_token = 0;\r\n  SecBufferDesc     out_buff_desc;\r\n  SecBuffer         out_sec_buff;\r\n  SecBufferDesc     in_buff_desc;\r\n  SecBuffer         in_sec_buff;\r\n  unsigned long     context_attributes;\r\n  TimeStamp         lifetime;\r\n  TCHAR             *sname;\r\n  int ret;\r\n  size_t len = 0, input_token_len = 0;\r\n  bool gss = FALSE;\r\n  const char* protocol;\r\n  CURLcode error;\r\n\r\n  while(*header && ISSPACE(*header))\r\n    header++;\r\n\r\n  if(checkprefix(\"GSS-Negotiate\", header)) {\r\n    protocol = \"GSS-Negotiate\";\r\n    gss = TRUE;\r\n  }\r\n  else if(checkprefix(\"Negotiate\", header)) {\r\n    protocol = \"Negotiate\";\r\n    gss = FALSE;\r\n  }\r\n  else\r\n    return -1;\r\n\r\n  if(neg_ctx->context) {\r\n    if(neg_ctx->gss != gss) {\r\n      return -1;\r\n    }\r\n  }\r\n  else {\r\n    neg_ctx->protocol = protocol;\r\n    neg_ctx->gss = gss;\r\n  }\r\n\r\n  if(neg_ctx->context && neg_ctx->status == SEC_E_OK) {\r\n    /* We finished successfully our part of authentication, but server\r\n     * rejected it (since we're again here). Exit with an error since we\r\n     * can't invent anything better */\r\n    Curl_cleanup_negotiate(conn->data);\r\n    return -1;\r\n  }\r\n\r\n  if(0 == strlen(neg_ctx->server_name)) {\r\n    ret = get_gss_name(conn, proxy, neg_ctx);\r\n    if(ret)\r\n      return ret;\r\n  }\r\n\r\n  if(!neg_ctx->output_token) {\r\n    PSecPkgInfo SecurityPackage;\r\n    ret = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(\"Negotiate\"),\r\n                                             &SecurityPackage);\r\n    if(ret != SEC_E_OK)\r\n      return -1;\r\n\r\n    /* Allocate input and output buffers according to the max token size\r\n       as indicated by the security package */\r\n    neg_ctx->max_token_length = SecurityPackage->cbMaxToken;\r\n    neg_ctx->output_token = malloc(neg_ctx->max_token_length);\r\n    s_pSecFn->FreeContextBuffer(SecurityPackage);\r\n  }\r\n\r\n  /* Obtain the input token, if any */\r\n  header += strlen(neg_ctx->protocol);\r\n  while(*header && ISSPACE(*header))\r\n    header++;\r\n\r\n  len = strlen(header);\r\n  if(!len) {\r\n    /* first call in a new negotation, we have to acquire credentials,\r\n       and allocate memory for the context */\r\n\r\n    neg_ctx->credentials = malloc(sizeof(CredHandle));\r\n    neg_ctx->context = malloc(sizeof(CtxtHandle));\r\n\r\n    if(!neg_ctx->credentials || !neg_ctx->context)\r\n      return -1;\r\n\r\n    neg_ctx->status =\r\n      s_pSecFn->AcquireCredentialsHandle(NULL,\r\n                                         (TCHAR *) TEXT(\"Negotiate\"),\r\n                                         SECPKG_CRED_OUTBOUND, NULL, NULL,\r\n                                         NULL, NULL, neg_ctx->credentials,\r\n                                         &lifetime);\r\n    if(neg_ctx->status != SEC_E_OK)\r\n      return -1;\r\n  }\r\n  else {\r\n    input_token = malloc(neg_ctx->max_token_length);\r\n    if(!input_token)\r\n      return -1;\r\n\r\n    error = Curl_base64_decode(header,\r\n                               (unsigned char **)&input_token,\r\n                               &input_token_len);\r\n    if(error || input_token_len == 0)\r\n      return -1;\r\n  }\r\n\r\n  /* prepare the output buffers, and input buffers if present */\r\n  out_buff_desc.ulVersion = 0;\r\n  out_buff_desc.cBuffers  = 1;\r\n  out_buff_desc.pBuffers  = &out_sec_buff;\r\n\r\n  out_sec_buff.cbBuffer   = curlx_uztoul(neg_ctx->max_token_length);\r\n  out_sec_buff.BufferType = SECBUFFER_TOKEN;\r\n  out_sec_buff.pvBuffer   = neg_ctx->output_token;\r\n\r\n\r\n  if(input_token) {\r\n    in_buff_desc.ulVersion = 0;\r\n    in_buff_desc.cBuffers  = 1;\r\n    in_buff_desc.pBuffers  = &in_sec_buff;\r\n\r\n    in_sec_buff.cbBuffer   = curlx_uztoul(input_token_len);\r\n    in_sec_buff.BufferType = SECBUFFER_TOKEN;\r\n    in_sec_buff.pvBuffer   = input_token;\r\n  }\r\n\r\n  sname = Curl_convert_UTF8_to_tchar(neg_ctx->server_name);\r\n  if(!sname)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  neg_ctx->status = s_pSecFn->InitializeSecurityContext(\r\n    neg_ctx->credentials,\r\n    input_token ? neg_ctx->context : 0,\r\n    sname,\r\n    ISC_REQ_CONFIDENTIALITY,\r\n    0,\r\n    SECURITY_NATIVE_DREP,\r\n    input_token ? &in_buff_desc : 0,\r\n    0,\r\n    neg_ctx->context,\r\n    &out_buff_desc,\r\n    &context_attributes,\r\n    &lifetime);\r\n\r\n  Curl_unicodefree(sname);\r\n\r\n  if(GSS_ERROR(neg_ctx->status))\r\n    return -1;\r\n\r\n  if(neg_ctx->status == SEC_I_COMPLETE_NEEDED ||\r\n     neg_ctx->status == SEC_I_COMPLETE_AND_CONTINUE) {\r\n    neg_ctx->status = s_pSecFn->CompleteAuthToken(neg_ctx->context,\r\n                                                  &out_buff_desc);\r\n    if(GSS_ERROR(neg_ctx->status))\r\n      return -1;\r\n  }\r\n\r\n  neg_ctx->output_token_length = out_sec_buff.cbBuffer;\r\n\r\n  return 0;\r\n}\r\n\r\n\r\nCURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)\r\n{\r\n  struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:\r\n    &conn->data->state.negotiate;\r\n  char *encoded = NULL;\r\n  size_t len = 0;\r\n  char *userp;\r\n  CURLcode error;\r\n\r\n  error = Curl_base64_encode(conn->data,\r\n                             (const char*)neg_ctx->output_token,\r\n                             neg_ctx->output_token_length,\r\n                             &encoded, &len);\r\n  if(error)\r\n    return error;\r\n\r\n  if(len == 0)\r\n    return CURLE_REMOTE_ACCESS_DENIED;\r\n\r\n  userp = aprintf(\"%sAuthorization: %s %s\\r\\n\", proxy ? \"Proxy-\" : \"\",\r\n                  neg_ctx->protocol, encoded);\r\n\r\n  if(proxy)\r\n    conn->allocptr.proxyuserpwd = userp;\r\n  else\r\n    conn->allocptr.userpwd = userp;\r\n  free(encoded);\r\n  Curl_cleanup_negotiate (conn->data);\r\n  return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;\r\n}\r\n\r\nstatic void cleanup(struct negotiatedata *neg_ctx)\r\n{\r\n  if(neg_ctx->context) {\r\n    s_pSecFn->DeleteSecurityContext(neg_ctx->context);\r\n    free(neg_ctx->context);\r\n    neg_ctx->context = 0;\r\n  }\r\n\r\n  if(neg_ctx->credentials) {\r\n    s_pSecFn->FreeCredentialsHandle(neg_ctx->credentials);\r\n    free(neg_ctx->credentials);\r\n    neg_ctx->credentials = 0;\r\n  }\r\n\r\n  if(neg_ctx->output_token) {\r\n    free(neg_ctx->output_token);\r\n    neg_ctx->output_token = 0;\r\n  }\r\n\r\n  neg_ctx->max_token_length = 0;\r\n}\r\n\r\nvoid Curl_cleanup_negotiate(struct SessionHandle *data)\r\n{\r\n  cleanup(&data->state.negotiate);\r\n  cleanup(&data->state.proxyneg);\r\n}\r\n\r\n\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_proxy.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP)\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"http_proxy.h\"\r\n#include \"sendf.h\"\r\n#include \"http.h\"\r\n#include \"url.h\"\r\n#include \"select.h\"\r\n#include \"rawstr.h\"\r\n#include \"progress.h\"\r\n#include \"non-ascii.h\"\r\n#include \"connect.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curlx.h\"\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nCURLcode Curl_proxy_connect(struct connectdata *conn)\r\n{\r\n  if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {\r\n#ifndef CURL_DISABLE_PROXY\r\n    /* for [protocol] tunneled through HTTP proxy */\r\n    struct HTTP http_proxy;\r\n    void *prot_save;\r\n    CURLcode result;\r\n\r\n    /* BLOCKING */\r\n    /* We want \"seamless\" operations through HTTP proxy tunnel */\r\n\r\n    /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the\r\n     * member conn->proto.http; we want [protocol] through HTTP and we have\r\n     * to change the member temporarily for connecting to the HTTP\r\n     * proxy. After Curl_proxyCONNECT we have to set back the member to the\r\n     * original pointer\r\n     *\r\n     * This function might be called several times in the multi interface case\r\n     * if the proxy's CONNTECT response is not instant.\r\n     */\r\n    prot_save = conn->data->state.proto.generic;\r\n    memset(&http_proxy, 0, sizeof(http_proxy));\r\n    conn->data->state.proto.http = &http_proxy;\r\n    conn->bits.close = FALSE;\r\n    result = Curl_proxyCONNECT(conn, FIRSTSOCKET,\r\n                               conn->host.name, conn->remote_port);\r\n    conn->data->state.proto.generic = prot_save;\r\n    if(CURLE_OK != result)\r\n      return result;\r\n#else\r\n    return CURLE_NOT_BUILT_IN;\r\n#endif\r\n  }\r\n  /* no HTTP tunnel proxy, just return */\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This\r\n * function will issue the necessary commands to get a seamless tunnel through\r\n * this proxy. After that, the socket can be used just as a normal socket.\r\n */\r\n\r\nCURLcode Curl_proxyCONNECT(struct connectdata *conn,\r\n                           int sockindex,\r\n                           const char *hostname,\r\n                           unsigned short remote_port)\r\n{\r\n  int subversion=0;\r\n  struct SessionHandle *data=conn->data;\r\n  struct SingleRequest *k = &data->req;\r\n  CURLcode result;\r\n  long timeout =\r\n    data->set.timeout?data->set.timeout:PROXY_TIMEOUT; /* in milliseconds */\r\n  curl_socket_t tunnelsocket = conn->sock[sockindex];\r\n  curl_off_t cl=0;\r\n  bool closeConnection = FALSE;\r\n  bool chunked_encoding = FALSE;\r\n  long check;\r\n\r\n#define SELECT_OK      0\r\n#define SELECT_ERROR   1\r\n#define SELECT_TIMEOUT 2\r\n  int error = SELECT_OK;\r\n\r\n  if(conn->tunnel_state[sockindex] == TUNNEL_COMPLETE)\r\n    return CURLE_OK; /* CONNECT is already completed */\r\n\r\n  conn->bits.proxy_connect_closed = FALSE;\r\n\r\n  do {\r\n    if(TUNNEL_INIT == conn->tunnel_state[sockindex]) {\r\n      /* BEGIN CONNECT PHASE */\r\n      char *host_port;\r\n      Curl_send_buffer *req_buffer;\r\n\r\n      infof(data, \"Establish HTTP proxy tunnel to %s:%hu\\n\",\r\n            hostname, remote_port);\r\n\r\n      if(data->req.newurl) {\r\n        /* This only happens if we've looped here due to authentication\r\n           reasons, and we don't really use the newly cloned URL here\r\n           then. Just free() it. */\r\n        free(data->req.newurl);\r\n        data->req.newurl = NULL;\r\n      }\r\n\r\n      /* initialize a dynamic send-buffer */\r\n      req_buffer = Curl_add_buffer_init();\r\n\r\n      if(!req_buffer)\r\n        return CURLE_OUT_OF_MEMORY;\r\n\r\n      host_port = aprintf(\"%s:%hu\", hostname, remote_port);\r\n      if(!host_port) {\r\n        free(req_buffer);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n\r\n      /* Setup the proxy-authorization header, if any */\r\n      result = Curl_http_output_auth(conn, \"CONNECT\", host_port, TRUE);\r\n\r\n      free(host_port);\r\n\r\n      if(CURLE_OK == result) {\r\n        char *host=(char *)\"\";\r\n        const char *proxyconn=\"\";\r\n        const char *useragent=\"\";\r\n        const char *http = (conn->proxytype == CURLPROXY_HTTP_1_0) ?\r\n          \"1.0\" : \"1.1\";\r\n        char *hostheader= /* host:port with IPv6 support */\r\n          aprintf(\"%s%s%s:%hu\", conn->bits.ipv6_ip?\"[\":\"\",\r\n                  hostname, conn->bits.ipv6_ip?\"]\":\"\",\r\n                  remote_port);\r\n        if(!hostheader) {\r\n          free(req_buffer);\r\n          return CURLE_OUT_OF_MEMORY;\r\n        }\r\n\r\n        if(!Curl_checkheaders(data, \"Host:\")) {\r\n          host = aprintf(\"Host: %s\\r\\n\", hostheader);\r\n          if(!host) {\r\n            free(hostheader);\r\n            free(req_buffer);\r\n            return CURLE_OUT_OF_MEMORY;\r\n          }\r\n        }\r\n        if(!Curl_checkheaders(data, \"Proxy-Connection:\"))\r\n          proxyconn = \"Proxy-Connection: Keep-Alive\\r\\n\";\r\n\r\n        if(!Curl_checkheaders(data, \"User-Agent:\") &&\r\n           data->set.str[STRING_USERAGENT])\r\n          useragent = conn->allocptr.uagent;\r\n\r\n        result =\r\n          Curl_add_bufferf(req_buffer,\r\n                           \"CONNECT %s HTTP/%s\\r\\n\"\r\n                           \"%s\"  /* Host: */\r\n                           \"%s\"  /* Proxy-Authorization */\r\n                           \"%s\"  /* User-Agent */\r\n                           \"%s\", /* Proxy-Connection */\r\n                           hostheader,\r\n                           http,\r\n                           host,\r\n                           conn->allocptr.proxyuserpwd?\r\n                           conn->allocptr.proxyuserpwd:\"\",\r\n                           useragent,\r\n                           proxyconn);\r\n\r\n        if(host && *host)\r\n          free(host);\r\n        free(hostheader);\r\n\r\n        if(CURLE_OK == result)\r\n          result = Curl_add_custom_headers(conn, req_buffer);\r\n\r\n        if(CURLE_OK == result)\r\n          /* CRLF terminate the request */\r\n          result = Curl_add_bufferf(req_buffer, \"\\r\\n\");\r\n\r\n        if(CURLE_OK == result) {\r\n          /* Send the connect request to the proxy */\r\n          /* BLOCKING */\r\n          result =\r\n            Curl_add_buffer_send(req_buffer, conn,\r\n                                 &data->info.request_size, 0, sockindex);\r\n        }\r\n        req_buffer = NULL;\r\n        if(result)\r\n          failf(data, \"Failed sending CONNECT to proxy\");\r\n      }\r\n\r\n      Curl_safefree(req_buffer);\r\n      if(result)\r\n        return result;\r\n\r\n      conn->tunnel_state[sockindex] = TUNNEL_CONNECT;\r\n\r\n      /* now we've issued the CONNECT and we're waiting to hear back, return\r\n         and get called again polling-style */\r\n      return CURLE_OK;\r\n\r\n    } /* END CONNECT PHASE */\r\n\r\n    { /* BEGIN NEGOTIATION PHASE */\r\n      size_t nread;   /* total size read */\r\n      int perline; /* count bytes per line */\r\n      int keepon=TRUE;\r\n      ssize_t gotbytes;\r\n      char *ptr;\r\n      char *line_start;\r\n\r\n      ptr=data->state.buffer;\r\n      line_start = ptr;\r\n\r\n      nread=0;\r\n      perline=0;\r\n      keepon=TRUE;\r\n\r\n      while((nread<BUFSIZE) && (keepon && !error)) {\r\n\r\n        /* if timeout is requested, find out how much remaining time we have */\r\n        check = timeout - /* timeout time */\r\n          Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */\r\n        if(check <= 0) {\r\n          failf(data, \"Proxy CONNECT aborted due to timeout\");\r\n          error = SELECT_TIMEOUT; /* already too little time */\r\n          break;\r\n        }\r\n\r\n        /* loop every second at least, less if the timeout is near */\r\n        switch (Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD,\r\n                                  check<1000L?check:1000)) {\r\n        case -1: /* select() error, stop reading */\r\n          error = SELECT_ERROR;\r\n          failf(data, \"Proxy CONNECT aborted due to select/poll error\");\r\n          break;\r\n        case 0: /* timeout */\r\n          break;\r\n        default:\r\n          DEBUGASSERT(ptr+BUFSIZE-nread <= data->state.buffer+BUFSIZE+1);\r\n          result = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread,\r\n                             &gotbytes);\r\n          if(result==CURLE_AGAIN)\r\n            continue; /* go loop yourself */\r\n          else if(result)\r\n            keepon = FALSE;\r\n          else if(gotbytes <= 0) {\r\n            keepon = FALSE;\r\n            if(data->set.proxyauth && data->state.authproxy.avail) {\r\n              /* proxy auth was requested and there was proxy auth available,\r\n                 then deem this as \"mere\" proxy disconnect */\r\n              conn->bits.proxy_connect_closed = TRUE;\r\n            }\r\n            else {\r\n              error = SELECT_ERROR;\r\n              failf(data, \"Proxy CONNECT aborted\");\r\n            }\r\n          }\r\n          else {\r\n            /*\r\n             * We got a whole chunk of data, which can be anything from one\r\n             * byte to a set of lines and possibly just a piece of the last\r\n             * line.\r\n             */\r\n            int i;\r\n\r\n            nread += gotbytes;\r\n\r\n            if(keepon > TRUE) {\r\n              /* This means we are currently ignoring a response-body */\r\n\r\n              nread = 0; /* make next read start over in the read buffer */\r\n              ptr=data->state.buffer;\r\n              if(cl) {\r\n                /* A Content-Length based body: simply count down the counter\r\n                   and make sure to break out of the loop when we're done! */\r\n                cl -= gotbytes;\r\n                if(cl<=0) {\r\n                  keepon = FALSE;\r\n                  break;\r\n                }\r\n              }\r\n              else {\r\n                /* chunked-encoded body, so we need to do the chunked dance\r\n                   properly to know when the end of the body is reached */\r\n                CHUNKcode r;\r\n                ssize_t tookcareof=0;\r\n\r\n                /* now parse the chunked piece of data so that we can\r\n                   properly tell when the stream ends */\r\n                r = Curl_httpchunk_read(conn, ptr, gotbytes, &tookcareof);\r\n                if(r == CHUNKE_STOP) {\r\n                  /* we're done reading chunks! */\r\n                  infof(data, \"chunk reading DONE\\n\");\r\n                  keepon = FALSE;\r\n                  /* we did the full CONNECT treatment, go COMPLETE */\r\n                  conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;\r\n                }\r\n                else\r\n                  infof(data, \"Read %zd bytes of chunk, continue\\n\",\r\n                        tookcareof);\r\n              }\r\n            }\r\n            else\r\n              for(i = 0; i < gotbytes; ptr++, i++) {\r\n                perline++; /* amount of bytes in this line so far */\r\n                if(*ptr == 0x0a) {\r\n                  char letter;\r\n                  int writetype;\r\n\r\n                  /* convert from the network encoding */\r\n                  result = Curl_convert_from_network(data, line_start,\r\n                                                     perline);\r\n                  /* Curl_convert_from_network calls failf if unsuccessful */\r\n                  if(result)\r\n                    return result;\r\n\r\n                  /* output debug if that is requested */\r\n                  if(data->set.verbose)\r\n                    Curl_debug(data, CURLINFO_HEADER_IN,\r\n                               line_start, (size_t)perline, conn);\r\n\r\n                  /* send the header to the callback */\r\n                  writetype = CLIENTWRITE_HEADER;\r\n                  if(data->set.include_header)\r\n                    writetype |= CLIENTWRITE_BODY;\r\n\r\n                  result = Curl_client_write(conn, writetype, line_start,\r\n                                             perline);\r\n                  if(result)\r\n                    return result;\r\n\r\n                  /* Newlines are CRLF, so the CR is ignored as the line isn't\r\n                     really terminated until the LF comes. Treat a following CR\r\n                     as end-of-headers as well.*/\r\n\r\n                  if(('\\r' == line_start[0]) ||\r\n                     ('\\n' == line_start[0])) {\r\n                    /* end of response-headers from the proxy */\r\n                    nread = 0; /* make next read start over in the read\r\n                                  buffer */\r\n                    ptr=data->state.buffer;\r\n                    if((407 == k->httpcode) && !data->state.authproblem) {\r\n                      /* If we get a 407 response code with content length\r\n                         when we have no auth problem, we must ignore the\r\n                         whole response-body */\r\n                      keepon = 2;\r\n\r\n                      if(cl) {\r\n\r\n                        infof(data, \"Ignore %\" FORMAT_OFF_T\r\n                              \" bytes of response-body\\n\", cl);\r\n                        /* remove the remaining chunk of what we already\r\n                           read */\r\n                        cl -= (gotbytes - i);\r\n\r\n                        if(cl<=0)\r\n                          /* if the whole thing was already read, we are done!\r\n                           */\r\n                          keepon=FALSE;\r\n                      }\r\n                      else if(chunked_encoding) {\r\n                        CHUNKcode r;\r\n                        /* We set ignorebody true here since the chunked\r\n                           decoder function will acknowledge that. Pay\r\n                           attention so that this is cleared again when this\r\n                           function returns! */\r\n                        k->ignorebody = TRUE;\r\n                        infof(data, \"%zd bytes of chunk left\\n\", gotbytes-i);\r\n\r\n                        if(line_start[1] == '\\n') {\r\n                          /* this can only be a LF if the letter at index 0\r\n                             was a CR */\r\n                          line_start++;\r\n                          i++;\r\n                        }\r\n\r\n                        /* now parse the chunked piece of data so that we can\r\n                           properly tell when the stream ends */\r\n                        r = Curl_httpchunk_read(conn, line_start+1,\r\n                                                  gotbytes -i, &gotbytes);\r\n                        if(r == CHUNKE_STOP) {\r\n                          /* we're done reading chunks! */\r\n                          infof(data, \"chunk reading DONE\\n\");\r\n                          keepon = FALSE;\r\n                          /* we did the full CONNECT treatment, go to\r\n                             COMPLETE */\r\n                          conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;\r\n                        }\r\n                        else\r\n                          infof(data, \"Read %zd bytes of chunk, continue\\n\",\r\n                                gotbytes);\r\n                      }\r\n                      else {\r\n                        /* without content-length or chunked encoding, we\r\n                           can't keep the connection alive since the close is\r\n                           the end signal so we bail out at once instead */\r\n                        keepon=FALSE;\r\n                      }\r\n                    }\r\n                    else {\r\n                      keepon = FALSE;\r\n                      if(200 == data->info.httpproxycode) {\r\n                        if(gotbytes - (i+1))\r\n                          failf(data, \"Proxy CONNECT followed by %zd bytes \"\r\n                                \"of opaque data. Data ignored (known bug #39)\",\r\n                                gotbytes - (i+1));\r\n                      }\r\n                    }\r\n                    /* we did the full CONNECT treatment, go to COMPLETE */\r\n                    conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;\r\n                    break; /* breaks out of for-loop, not switch() */\r\n                  }\r\n\r\n                  /* keep a backup of the position we are about to blank */\r\n                  letter = line_start[perline];\r\n                  line_start[perline]=0; /* zero terminate the buffer */\r\n                  if((checkprefix(\"WWW-Authenticate:\", line_start) &&\r\n                      (401 == k->httpcode)) ||\r\n                     (checkprefix(\"Proxy-authenticate:\", line_start) &&\r\n                      (407 == k->httpcode))) {\r\n                    result = Curl_http_input_auth(conn, k->httpcode,\r\n                                                  line_start);\r\n                    if(result)\r\n                      return result;\r\n                  }\r\n                  else if(checkprefix(\"Content-Length:\", line_start)) {\r\n                    cl = curlx_strtoofft(line_start +\r\n                                         strlen(\"Content-Length:\"), NULL, 10);\r\n                  }\r\n                  else if(Curl_compareheader(line_start,\r\n                                             \"Connection:\", \"close\"))\r\n                    closeConnection = TRUE;\r\n                  else if(Curl_compareheader(line_start,\r\n                                             \"Transfer-Encoding:\",\r\n                                             \"chunked\")) {\r\n                    infof(data, \"CONNECT responded chunked\\n\");\r\n                    chunked_encoding = TRUE;\r\n                    /* init our chunky engine */\r\n                    Curl_httpchunk_init(conn);\r\n                  }\r\n                  else if(Curl_compareheader(line_start,\r\n                                             \"Proxy-Connection:\", \"close\"))\r\n                    closeConnection = TRUE;\r\n                  else if(2 == sscanf(line_start, \"HTTP/1.%d %d\",\r\n                                      &subversion,\r\n                                      &k->httpcode)) {\r\n                    /* store the HTTP code from the proxy */\r\n                    data->info.httpproxycode = k->httpcode;\r\n                  }\r\n                  /* put back the letter we blanked out before */\r\n                  line_start[perline]= letter;\r\n\r\n                  perline=0; /* line starts over here */\r\n                  line_start = ptr+1; /* this skips the zero byte we wrote */\r\n                }\r\n              }\r\n          }\r\n          break;\r\n        } /* switch */\r\n        if(Curl_pgrsUpdate(conn))\r\n          return CURLE_ABORTED_BY_CALLBACK;\r\n      } /* while there's buffer left and loop is requested */\r\n\r\n      if(error)\r\n        return CURLE_RECV_ERROR;\r\n\r\n      if(data->info.httpproxycode != 200) {\r\n        /* Deal with the possibly already received authenticate\r\n           headers. 'newurl' is set to a new URL if we must loop. */\r\n        result = Curl_http_auth_act(conn);\r\n        if(result)\r\n          return result;\r\n\r\n        if(conn->bits.close)\r\n          /* the connection has been marked for closure, most likely in the\r\n             Curl_http_auth_act() function and thus we can kill it at once\r\n             below\r\n          */\r\n          closeConnection = TRUE;\r\n      }\r\n\r\n      if(closeConnection && data->req.newurl) {\r\n        /* Connection closed by server. Don't use it anymore */\r\n        Curl_closesocket(conn, conn->sock[sockindex]);\r\n        conn->sock[sockindex] = CURL_SOCKET_BAD;\r\n        break;\r\n      }\r\n    } /* END NEGOTIATION PHASE */\r\n\r\n    /* If we are supposed to continue and request a new URL, which basically\r\n     * means the HTTP authentication is still going on so if the tunnel\r\n     * is complete we start over in INIT state */\r\n    if(data->req.newurl &&\r\n       (TUNNEL_COMPLETE == conn->tunnel_state[sockindex])) {\r\n      conn->tunnel_state[sockindex] = TUNNEL_INIT;\r\n      infof(data, \"TUNNEL_STATE switched to: %d\\n\",\r\n            conn->tunnel_state[sockindex]);\r\n    }\r\n\r\n  } while(data->req.newurl);\r\n\r\n  if(200 != data->req.httpcode) {\r\n    failf(data, \"Received HTTP code %d from proxy after CONNECT\",\r\n          data->req.httpcode);\r\n\r\n    if(closeConnection && data->req.newurl)\r\n      conn->bits.proxy_connect_closed = TRUE;\r\n\r\n    if(data->req.newurl) {\r\n      /* this won't be used anymore for the CONNECT so free it now */\r\n      free(data->req.newurl);\r\n      data->req.newurl = NULL;\r\n    }\r\n\r\n    /* to back to init state */\r\n    conn->tunnel_state[sockindex] = TUNNEL_INIT;\r\n\r\n    return CURLE_RECV_ERROR;\r\n  }\r\n\r\n  conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;\r\n\r\n  /* If a proxy-authorization header was used for the proxy, then we should\r\n     make sure that it isn't accidentally used for the document request\r\n     after we've connected. So let's free and clear it here. */\r\n  Curl_safefree(conn->allocptr.proxyuserpwd);\r\n  conn->allocptr.proxyuserpwd = NULL;\r\n\r\n  data->state.authproxy.done = TRUE;\r\n\r\n  infof (data, \"Proxy replied OK to CONNECT request\\n\");\r\n  data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */\r\n  return CURLE_OK;\r\n}\r\n#endif /* CURL_DISABLE_PROXY */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/http_proxy.h",
    "content": "#ifndef HEADER_CURL_HTTP_PROXY_H\r\n#define HEADER_CURL_HTTP_PROXY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP)\r\n/* ftp can use this as well */\r\nCURLcode Curl_proxyCONNECT(struct connectdata *conn,\r\n                           int tunnelsocket,\r\n                           const char *hostname, unsigned short remote_port);\r\n\r\n/* Default proxy timeout in milliseconds */\r\n#define PROXY_TIMEOUT (3600*1000)\r\n\r\nCURLcode Curl_proxy_connect(struct connectdata *conn);\r\n\r\n#else\r\n#define Curl_proxyCONNECT(x,y,z,w) CURLE_NOT_BUILT_IN\r\n#define Curl_proxy_connect(x) CURLE_OK\r\n#endif\r\n\r\n#endif /* HEADER_CURL_HTTP_PROXY_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/idn_win32.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n /*\r\n  * IDN conversions using Windows kernel32 and normaliz libraries.\r\n  */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_WIN32_IDN\r\n\r\n#include \"curl_multibyte.h\"\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef WANT_IDN_PROTOTYPES\r\nWINBASEAPI int WINAPI IdnToAscii(DWORD, const WCHAR *, int, WCHAR *, int);\r\nWINBASEAPI int WINAPI IdnToUnicode(DWORD, const WCHAR *, int, WCHAR *, int);\r\n#endif\r\n\r\n#define IDN_MAX_LENGTH 255\r\n\r\nint curl_win32_idn_to_ascii(const char *in, char **out);\r\nint curl_win32_ascii_to_idn(const char *in, size_t in_len, char **out_utf8);\r\n\r\nint curl_win32_idn_to_ascii(const char *in, char **out)\r\n{\r\n  wchar_t *in_w = Curl_convert_UTF8_to_wchar(in);\r\n  if(in_w) {\r\n    wchar_t punycode[IDN_MAX_LENGTH];\r\n    if(IdnToAscii(0, in_w, -1, punycode, IDN_MAX_LENGTH) == 0) {\r\n      wprintf(L\"ERROR %d converting to Punycode\\n\", GetLastError());\r\n      free(in_w);\r\n      return 0;\r\n    }\r\n    free(in_w);\r\n\r\n    *out = Curl_convert_wchar_to_UTF8(punycode);\r\n    if(!*out)\r\n      return 0;\r\n  }\r\n  return 1;\r\n}\r\n\r\nint curl_win32_ascii_to_idn(const char *in, size_t in_len, char **out_utf8)\r\n{\r\n  (void)in_len; /* unused */\r\n  if(in) {\r\n    WCHAR unicode[IDN_MAX_LENGTH];\r\n\r\n    if(IdnToUnicode(0, (wchar_t *)in, -1, unicode, IDN_MAX_LENGTH) == 0) {\r\n      wprintf(L\"ERROR %d converting to Punycode\\n\", GetLastError());\r\n      return 0;\r\n    }\r\n    else {\r\n      *out_utf8 = Curl_convert_wchar_to_UTF8(unicode);\r\n      if(!*out_utf8)\r\n        return 0;\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n\r\n#endif /* USE_WIN32_IDN */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/if2ip.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#  include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#  include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#  include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#  include <sys/ioctl.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#  include <netdb.h>\r\n#endif\r\n#ifdef HAVE_SYS_SOCKIO_H\r\n#  include <sys/sockio.h>\r\n#endif\r\n#ifdef HAVE_IFADDRS_H\r\n#  include <ifaddrs.h>\r\n#endif\r\n#ifdef HAVE_STROPTS_H\r\n#  include <stropts.h>\r\n#endif\r\n#ifdef __VMS\r\n#  include <inet.h>\r\n#endif\r\n\r\n#include \"inet_ntop.h\"\r\n#include \"strequal.h\"\r\n#include \"if2ip.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* ------------------------------------------------------------------ */\r\n\r\n#if defined(HAVE_GETIFADDRS)\r\n\r\nbool Curl_if_is_interface_name(const char *interf)\r\n{\r\n  bool result = FALSE;\r\n\r\n  struct ifaddrs *iface, *head;\r\n\r\n  if(getifaddrs(&head) >= 0) {\r\n    for(iface=head; iface != NULL; iface=iface->ifa_next) {\r\n      if(curl_strequal(iface->ifa_name, interf)) {\r\n        result = TRUE;\r\n        break;\r\n      }\r\n    }\r\n    freeifaddrs(head);\r\n  }\r\n  return result;\r\n}\r\n\r\nchar *Curl_if2ip(int af, const char *interf, char *buf, int buf_size)\r\n{\r\n  struct ifaddrs *iface, *head;\r\n  char *ip = NULL;\r\n\r\n  if(getifaddrs(&head) >= 0) {\r\n    for(iface=head; iface != NULL; iface=iface->ifa_next) {\r\n      if((iface->ifa_addr != NULL) &&\r\n         (iface->ifa_addr->sa_family == af) &&\r\n         curl_strequal(iface->ifa_name, interf)) {\r\n        void *addr;\r\n        char scope[12]=\"\";\r\n#ifdef ENABLE_IPV6\r\n        if(af == AF_INET6) {\r\n          unsigned int scopeid = 0;\r\n          addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr;\r\n#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID\r\n          /* Include the scope of this interface as part of the address */\r\n          scopeid = ((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id;\r\n#endif\r\n          if(scopeid)\r\n            snprintf(scope, sizeof(scope), \"%%%u\", scopeid);\r\n        }\r\n        else\r\n#endif\r\n          addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr;\r\n        ip = (char *) Curl_inet_ntop(af, addr, buf, buf_size);\r\n        strlcat(buf, scope, buf_size);\r\n        break;\r\n      }\r\n    }\r\n    freeifaddrs(head);\r\n  }\r\n  return ip;\r\n}\r\n\r\n#elif defined(HAVE_IOCTL_SIOCGIFADDR)\r\n\r\nbool Curl_if_is_interface_name(const char *interf)\r\n{\r\n  /* This is here just to support the old interfaces */\r\n  char buf[256];\r\n\r\n  char *ip = Curl_if2ip(AF_INET, interf, buf, sizeof(buf));\r\n\r\n  return (ip != NULL) ? TRUE : FALSE;\r\n}\r\n\r\nchar *Curl_if2ip(int af, const char *interf, char *buf, int buf_size)\r\n{\r\n  struct ifreq req;\r\n  struct in_addr in;\r\n  struct sockaddr_in *s;\r\n  curl_socket_t dummy;\r\n  size_t len;\r\n  char *ip;\r\n\r\n  if(!interf || (af != AF_INET))\r\n    return NULL;\r\n\r\n  len = strlen(interf);\r\n  if(len >= sizeof(req.ifr_name))\r\n    return NULL;\r\n\r\n  dummy = socket(AF_INET, SOCK_STREAM, 0);\r\n  if(CURL_SOCKET_BAD == dummy)\r\n    return NULL;\r\n\r\n  memset(&req, 0, sizeof(req));\r\n  memcpy(req.ifr_name, interf, len+1);\r\n  req.ifr_addr.sa_family = AF_INET;\r\n\r\n  if(ioctl(dummy, SIOCGIFADDR, &req) < 0) {\r\n    sclose(dummy);\r\n    return NULL;\r\n  }\r\n\r\n  s = (struct sockaddr_in *)&req.ifr_addr;\r\n  memcpy(&in, &s->sin_addr, sizeof(in));\r\n  ip = (char *) Curl_inet_ntop(s->sin_family, &in, buf, buf_size);\r\n\r\n  sclose(dummy);\r\n  return ip;\r\n}\r\n\r\n#else\r\n\r\nbool Curl_if_is_interface_name(const char *interf)\r\n{\r\n  (void) interf;\r\n\r\n  return FALSE;\r\n}\r\n\r\nchar *Curl_if2ip(int af, const char *interf, char *buf, int buf_size)\r\n{\r\n    (void) af;\r\n    (void) interf;\r\n    (void) buf;\r\n    (void) buf_size;\r\n    return NULL;\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/if2ip.h",
    "content": "#ifndef HEADER_CURL_IF2IP_H\r\n#define HEADER_CURL_IF2IP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\nbool Curl_if_is_interface_name(const char *interf);\r\nchar *Curl_if2ip(int af, const char *interf, char *buf, int buf_size);\r\n\r\n#ifdef __INTERIX\r\n\r\n/* Nedelcho Stanev's work-around for SFU 3.0 */\r\nstruct ifreq {\r\n#define IFNAMSIZ 16\r\n#define IFHWADDRLEN 6\r\n  union {\r\n    char ifrn_name[IFNAMSIZ]; /* if name, e.g. \"en0\" */\r\n  } ifr_ifrn;\r\n\r\n union {\r\n   struct sockaddr ifru_addr;\r\n   struct sockaddr ifru_broadaddr;\r\n   struct sockaddr ifru_netmask;\r\n   struct sockaddr ifru_hwaddr;\r\n   short ifru_flags;\r\n   int ifru_metric;\r\n   int ifru_mtu;\r\n } ifr_ifru;\r\n};\r\n\r\n/* This define was added by Daniel to avoid an extra #ifdef INTERIX in the\r\n   C code. */\r\n\r\n#define ifr_name ifr_ifrn.ifrn_name /* interface name */\r\n#define ifr_addr ifr_ifru.ifru_addr /* address */\r\n#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */\r\n#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */\r\n#define ifr_flags ifr_ifru.ifru_flags /* flags */\r\n#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */\r\n#define ifr_metric ifr_ifru.ifru_metric /* metric */\r\n#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */\r\n\r\n#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */\r\n\r\n#endif /* __INTERIX */\r\n\r\n#endif /* HEADER_CURL_IF2IP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/imap.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n * RFC2195 CRAM-MD5 authentication\r\n * RFC2595 Using TLS with IMAP, POP3 and ACAP\r\n * RFC2831 DIGEST-MD5 authentication\r\n * RFC3501 IMAPv4 protocol\r\n * RFC4422 Simple Authentication and Security Layer (SASL)\r\n * RFC4616 PLAIN authentication\r\n * RFC5092 IMAP URL Scheme\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_IMAP\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_UTSNAME_H\r\n#include <sys/utsname.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"if2ip.h\"\r\n#include \"hostip.h\"\r\n#include \"progress.h\"\r\n#include \"transfer.h\"\r\n#include \"escape.h\"\r\n#include \"http.h\" /* for HTTP proxy tunnel stuff */\r\n#include \"socks.h\"\r\n#include \"imap.h\"\r\n\r\n#include \"strtoofft.h\"\r\n#include \"strequal.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"select.h\"\r\n#include \"multiif.h\"\r\n#include \"url.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_sasl.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Local API functions */\r\nstatic CURLcode imap_parse_url_path(struct connectdata *conn);\r\nstatic CURLcode imap_regular_transfer(struct connectdata *conn, bool *done);\r\nstatic CURLcode imap_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode imap_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature);\r\nstatic CURLcode imap_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode imap_disconnect(struct connectdata *conn, bool dead);\r\nstatic CURLcode imap_multi_statemach(struct connectdata *conn, bool *done);\r\nstatic int imap_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks);\r\nstatic CURLcode imap_doing(struct connectdata *conn, bool *dophase_done);\r\nstatic CURLcode imap_setup_connection(struct connectdata *conn);\r\nstatic CURLcode imap_state_upgrade_tls(struct connectdata *conn);\r\n\r\n/*\r\n * IMAP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_imap = {\r\n  \"IMAP\",                           /* scheme */\r\n  imap_setup_connection,            /* setup_connection */\r\n  imap_do,                          /* do_it */\r\n  imap_done,                        /* done */\r\n  ZERO_NULL,                        /* do_more */\r\n  imap_connect,                     /* connect_it */\r\n  imap_multi_statemach,             /* connecting */\r\n  imap_doing,                       /* doing */\r\n  imap_getsock,                     /* proto_getsock */\r\n  imap_getsock,                     /* doing_getsock */\r\n  ZERO_NULL,                        /* domore_getsock */\r\n  ZERO_NULL,                        /* perform_getsock */\r\n  imap_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                        /* readwrite */\r\n  PORT_IMAP,                        /* defport */\r\n  CURLPROTO_IMAP,                   /* protocol */\r\n  PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD\r\n  | PROTOPT_NOURLQUERY              /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * IMAPS protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_imaps = {\r\n  \"IMAPS\",                          /* scheme */\r\n  imap_setup_connection,            /* setup_connection */\r\n  imap_do,                          /* do_it */\r\n  imap_done,                        /* done */\r\n  ZERO_NULL,                        /* do_more */\r\n  imap_connect,                     /* connect_it */\r\n  imap_multi_statemach,             /* connecting */\r\n  imap_doing,                       /* doing */\r\n  imap_getsock,                     /* proto_getsock */\r\n  imap_getsock,                     /* doing_getsock */\r\n  ZERO_NULL,                        /* domore_getsock */\r\n  ZERO_NULL,                        /* perform_getsock */\r\n  imap_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                        /* readwrite */\r\n  PORT_IMAPS,                       /* defport */\r\n  CURLPROTO_IMAP | CURLPROTO_IMAPS, /* protocol */\r\n  PROTOPT_CLOSEACTION | PROTOPT_SSL | PROTOPT_NEEDSPWD\r\n  | PROTOPT_NOURLQUERY              /* flags */\r\n};\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n/*\r\n * HTTP-proxyed IMAP protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_imap_proxy = {\r\n  \"IMAP\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_IMAP,                            /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * HTTP-proxyed IMAPS protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_imaps_proxy = {\r\n  \"IMAPS\",                              /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_IMAPS,                           /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n#endif\r\n#endif\r\n\r\n/***********************************************************************\r\n *\r\n * imap_sendf()\r\n *\r\n * Sends the formated string as an IMAP command to the server.\r\n *\r\n * Designed to never block.\r\n */\r\nstatic CURLcode imap_sendf(struct connectdata *conn,\r\n                           const char *idstr, /* command id to wait for */\r\n                           const char *fmt, ...)\r\n{\r\n  CURLcode res;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n\r\n  imapc->idstr = idstr;\r\n\r\n  res = Curl_pp_vsendf(&imapc->pp, fmt, ap);\r\n\r\n  va_end(ap);\r\n\r\n  return res;\r\n}\r\n\r\nstatic const char *getcmdid(struct connectdata *conn)\r\n{\r\n  static const char * const ids[]= {\r\n    \"A\",\r\n    \"B\",\r\n    \"C\",\r\n    \"D\"\r\n  };\r\n\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n\r\n  /* Get the next id, but wrap at end of table */\r\n  imapc->cmdid = (int)((imapc->cmdid + 1) % (sizeof(ids) / sizeof(ids[0])));\r\n\r\n  return ids[imapc->cmdid];\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_atom()\r\n *\r\n * Checks the input string for characters that need escaping and returns an\r\n * atom ready for sending to the server.\r\n *\r\n * The returned string needs to be freed.\r\n *\r\n */\r\nstatic char* imap_atom(const char* str)\r\n{\r\n  const char *p1;\r\n  char *p2;\r\n  size_t backsp_count = 0;\r\n  size_t quote_count = 0;\r\n  bool space_exists = FALSE;\r\n  size_t newlen = 0;\r\n  char *newstr = NULL;\r\n\r\n  if(!str)\r\n    return NULL;\r\n\r\n  /* Count any unescapped characters */\r\n  p1 = str;\r\n  while(*p1) {\r\n    if(*p1 == '\\\\')\r\n      backsp_count++;\r\n    else if(*p1 == '\"')\r\n      quote_count++;\r\n    else if(*p1 == ' ')\r\n      space_exists = TRUE;\r\n\r\n    p1++;\r\n  }\r\n\r\n  /* Does the input contain any unescapped characters? */\r\n  if(!backsp_count && !quote_count && !space_exists)\r\n    return strdup(str);\r\n\r\n  /* Calculate the new string length */\r\n  newlen = strlen(str) + backsp_count + quote_count + (space_exists ? 2 : 0);\r\n\r\n  /* Allocate the new string */\r\n  newstr = (char *) malloc((newlen + 1) * sizeof(char));\r\n  if(!newstr)\r\n    return NULL;\r\n\r\n  /* Surround the string in quotes if necessary */\r\n  p2 = newstr;\r\n  if(space_exists) {\r\n    newstr[0] = '\"';\r\n    newstr[newlen - 1] = '\"';\r\n    p2++;\r\n  }\r\n\r\n  /* Copy the string, escaping backslash and quote characters along the way */\r\n  p1 = str;\r\n  while(*p1) {\r\n    if(*p1 == '\\\\' || *p1 == '\"') {\r\n      *p2 = '\\\\';\r\n      p2++;\r\n    }\r\n\r\n   *p2 = *p1;\r\n\r\n    p1++;\r\n    p2++;\r\n  }\r\n\r\n  /* Terminate the string */\r\n  newstr[newlen] = '\\0';\r\n\r\n  return newstr;\r\n}\r\n\r\n/* Function that checks for an ending imap status code at the start of the\r\n   given string but also detects the supported authentication mechanisms from\r\n   the CAPABILITY response. */\r\nstatic int imap_endofresp(struct pingpong *pp, int *resp)\r\n{\r\n  char *line = pp->linestart_resp;\r\n  size_t len = pp->nread_resp;\r\n  struct imap_conn *imapc = &pp->conn->proto.imapc;\r\n  const char *id = imapc->idstr;\r\n  size_t id_len = strlen(id);\r\n  size_t wordlen;\r\n\r\n  /* Do we have a generic command response? */\r\n  if(len >= id_len + 3) {\r\n    if(!memcmp(id, line, id_len) && line[id_len] == ' ') {\r\n      *resp = line[id_len + 1]; /* O, N or B */\r\n      return TRUE;\r\n    }\r\n  }\r\n\r\n  /* Do we have a generic continuation response? */\r\n  if((len == 3 && !memcmp(\"+\", line, 1)) ||\r\n     (len >= 2 && !memcmp(\"+ \", line, 2))) {\r\n    *resp = '+';\r\n    return TRUE;\r\n  }\r\n\r\n  /* Are we processing CAPABILITY command responses? */\r\n  if(imapc->state == IMAP_CAPABILITY) {\r\n    /* Do we have a valid response? */\r\n    if(len >= 2 && !memcmp(\"* \", line, 2)) {\r\n      line += 2;\r\n      len -= 2;\r\n\r\n      /* Loop through the data line */\r\n      for(;;) {\r\n        while(len &&\r\n              (*line == ' ' || *line == '\\t' ||\r\n               *line == '\\r' || *line == '\\n')) {\r\n\r\n          if(*line == '\\n')\r\n            return FALSE;\r\n\r\n          line++;\r\n          len--;\r\n        }\r\n\r\n        if(!len)\r\n          break;\r\n\r\n        /* Extract the word */\r\n        for(wordlen = 0; wordlen < len && line[wordlen] != ' ' &&\r\n              line[wordlen] != '\\t' && line[wordlen] != '\\r' &&\r\n              line[wordlen] != '\\n';)\r\n          wordlen++;\r\n\r\n        /* Has the server explicitly disabled clear text authentication? */\r\n        if(wordlen == 13 && !memcmp(line, \"LOGINDISABLED\", 13))\r\n          imapc->login_disabled = TRUE;\r\n\r\n        /* Do we have a SASL based authentication mechanism? */\r\n        else if(wordlen > 5 && !memcmp(line, \"AUTH=\", 5)) {\r\n          line += 5;\r\n          len -= 5;\r\n          wordlen -= 5;\r\n\r\n          /* Test the word for a matching authentication mechanism */\r\n          if(wordlen == 5 && !memcmp(line, \"LOGIN\", 5))\r\n            imapc->authmechs |= SASL_MECH_LOGIN;\r\n          if(wordlen == 5 && !memcmp(line, \"PLAIN\", 5))\r\n            imapc->authmechs |= SASL_MECH_PLAIN;\r\n          else if(wordlen == 8 && !memcmp(line, \"CRAM-MD5\", 8))\r\n            imapc->authmechs |= SASL_MECH_CRAM_MD5;\r\n          else if(wordlen == 10 && !memcmp(line, \"DIGEST-MD5\", 10))\r\n            imapc->authmechs |= SASL_MECH_DIGEST_MD5;\r\n          else if(wordlen == 6 && !memcmp(line, \"GSSAPI\", 6))\r\n            imapc->authmechs |= SASL_MECH_GSSAPI;\r\n          else if(wordlen == 8 && !memcmp(line, \"EXTERNAL\", 8))\r\n            imapc->authmechs |= SASL_MECH_EXTERNAL;\r\n          else if(wordlen == 4 && !memcmp(line, \"NTLM\", 4))\r\n            imapc->authmechs |= SASL_MECH_NTLM;\r\n        }\r\n\r\n        line += wordlen;\r\n        len -= wordlen;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* Are we processing FETCH command responses? */\r\n  if(imapc->state == IMAP_FETCH) {\r\n    /* Do we have a valid response? */\r\n    if(len >= 2 && !memcmp(\"* \", line, 2)) {\r\n      *resp = '*';\r\n      return TRUE;\r\n    }\r\n  }\r\n\r\n  return FALSE; /* Nothing for us */\r\n}\r\n\r\n/* This is the ONLY way to change IMAP state! */\r\nstatic void state(struct connectdata *conn, imapstate newstate)\r\n{\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  /* for debug purposes */\r\n  static const char * const names[]={\r\n    \"STOP\",\r\n    \"SERVERGREET\",\r\n    \"STARTTLS\",\r\n    \"UPGRADETLS\",\r\n    \"CAPABILITY\",\r\n    \"AUTHENTICATE_PLAIN\",\r\n    \"AUTHENTICATE_LOGIN\",\r\n    \"AUTHENTICATE_LOGIN_PASSWD\",\r\n    \"AUTHENTICATE_CRAMMD5\",\r\n    \"AUTHENTICATE_DIGESTMD5\",\r\n    \"AUTHENTICATE_DIGESTMD5_RESP\",\r\n    \"AUTHENTICATE_NTLM\",\r\n    \"AUTHENTICATE_NTLM_TYPE2MSG\",\r\n    \"AUTHENTICATE\",\r\n    \"LOGIN\",\r\n    \"SELECT\",\r\n    \"FETCH\",\r\n    \"LOGOUT\",\r\n    /* LAST */\r\n  };\r\n\r\n  if(imapc->state != newstate)\r\n    infof(conn->data, \"IMAP %p state change from %s to %s\\n\",\r\n          imapc, names[imapc->state], names[newstate]);\r\n#endif\r\n\r\n  imapc->state = newstate;\r\n}\r\n\r\nstatic CURLcode imap_state_capability(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  const char *str;\r\n\r\n  imapc->authmechs = 0;         /* No known authentication mechanisms yet */\r\n  imapc->authused = 0;          /* Clear the authentication mechanism used */\r\n\r\n  /* Check we have a username and password to authenticate with and end the\r\n     connect phase if we don't */\r\n  if(!conn->bits.user_passwd) {\r\n    state(conn, IMAP_STOP);\r\n\r\n    return result;\r\n  }\r\n\r\n  str = getcmdid(conn);\r\n\r\n  /* Send the CAPABILITY command */\r\n  result = imap_sendf(conn, str, \"%s CAPABILITY\", str);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, IMAP_CAPABILITY);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode imap_state_login(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  struct FTP *imap = conn->data->state.proto.imap;\r\n  const char *str = getcmdid(conn);\r\n  char *user = imap_atom(imap->user);\r\n  char *passwd = imap_atom(imap->passwd);\r\n\r\n  /* send USER and password */\r\n  result = imap_sendf(conn, str, \"%s LOGIN %s %s\", str,\r\n                      user ? user : \"\", passwd ? passwd : \"\");\r\n\r\n  Curl_safefree(user);\r\n  Curl_safefree(passwd);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, IMAP_LOGIN);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode imap_authenticate(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  const char *mech = NULL;\r\n  imapstate authstate = IMAP_STOP;\r\n\r\n  /* Calculate the supported authentication mechanism by decreasing order of\r\n     security */\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n  if(imapc->authmechs & SASL_MECH_DIGEST_MD5) {\r\n    mech = \"DIGEST-MD5\";\r\n    authstate = IMAP_AUTHENTICATE_DIGESTMD5;\r\n    imapc->authused = SASL_MECH_DIGEST_MD5;\r\n  }\r\n  else if(imapc->authmechs & SASL_MECH_CRAM_MD5) {\r\n    mech = \"CRAM-MD5\";\r\n    authstate = IMAP_AUTHENTICATE_CRAMMD5;\r\n    imapc->authused = SASL_MECH_CRAM_MD5;\r\n  }\r\n  else\r\n#endif\r\n#ifdef USE_NTLM\r\n  if(imapc->authmechs & SASL_MECH_NTLM) {\r\n    mech = \"NTLM\";\r\n    authstate = IMAP_AUTHENTICATE_NTLM;\r\n    imapc->authused = SASL_MECH_NTLM;\r\n  }\r\n  else\r\n#endif\r\n  if(imapc->authmechs & SASL_MECH_LOGIN) {\r\n    mech = \"LOGIN\";\r\n    authstate = IMAP_AUTHENTICATE_LOGIN;\r\n    imapc->authused = SASL_MECH_LOGIN;\r\n  }\r\n  else if(imapc->authmechs & SASL_MECH_PLAIN) {\r\n    mech = \"PLAIN\";\r\n    authstate = IMAP_AUTHENTICATE_PLAIN;\r\n    imapc->authused = SASL_MECH_PLAIN;\r\n  }\r\n\r\n  if(mech) {\r\n    /* Perform SASL based authentication */\r\n    const char *str = getcmdid(conn);\r\n\r\n    result = imap_sendf(conn, str, \"%s AUTHENTICATE %s\", str, mech);\r\n\r\n    if(!result)\r\n      state(conn, authstate);\r\n  }\r\n  else if(!imapc->login_disabled)\r\n    /* Perform clear text authentication */\r\n    result = imap_state_login(conn);\r\n  else {\r\n    /* Other mechanisms not supported */\r\n    infof(conn->data, \"No known authentication mechanisms supported!\\n\");\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For the IMAP \"protocol connect\" and \"doing\" phases only */\r\nstatic int imap_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks)\r\n{\r\n  return Curl_pp_getsock(&conn->proto.imapc.pp, socks, numsocks);\r\n}\r\n\r\n#ifdef USE_SSL\r\nstatic void imap_to_imaps(struct connectdata *conn)\r\n{\r\n  conn->handler = &Curl_handler_imaps;\r\n}\r\n#else\r\n#define imap_to_imaps(x) Curl_nop_stmt\r\n#endif\r\n\r\n/* For the initial server greeting */\r\nstatic CURLcode imap_state_servergreet_resp(struct connectdata *conn,\r\n                                            int imapcode,\r\n                                            imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != 'O') {\r\n    failf(data, \"Got unexpected imap-server response\");\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n\r\n  if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {\r\n    /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch\r\n       to TLS connection now */\r\n    const char *str = getcmdid(conn);\r\n    result = imap_sendf(conn, str, \"%s STARTTLS\", str);\r\n    if(!result)\r\n      state(conn, IMAP_STARTTLS);\r\n  }\r\n  else\r\n    result = imap_state_capability(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For STARTTLS responses */\r\nstatic CURLcode imap_state_starttls_resp(struct connectdata *conn,\r\n                                         int imapcode,\r\n                                         imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != 'O') {\r\n    if(data->set.use_ssl != CURLUSESSL_TRY) {\r\n      failf(data, \"STARTTLS denied. %c\", imapcode);\r\n      result = CURLE_USE_SSL_FAILED;\r\n    }\r\n    else\r\n      result = imap_state_capability(conn);\r\n  }\r\n  else\r\n    result = imap_state_upgrade_tls(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode imap_state_upgrade_tls(struct connectdata *conn)\r\n{\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  CURLcode result;\r\n\r\n  result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone);\r\n\r\n  if(!result) {\r\n    if(imapc->state != IMAP_UPGRADETLS)\r\n      state(conn, IMAP_UPGRADETLS);\r\n\r\n    if(imapc->ssldone) {\r\n      imap_to_imaps(conn);\r\n      result = imap_state_capability(conn);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For CAPABILITY responses */\r\nstatic CURLcode imap_state_capability_resp(struct connectdata *conn,\r\n                                           int imapcode,\r\n                                           imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode == 'O')\r\n    result = imap_authenticate(conn);\r\n  else\r\n    result = imap_state_login(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTHENTICATE PLAIN responses */\r\nstatic CURLcode imap_state_auth_plain_resp(struct connectdata *conn,\r\n                                           int imapcode,\r\n                                           imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *plainauth = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied. %c\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the authorisation message */\r\n    result = Curl_sasl_create_plain_message(data, conn->user, conn->passwd,\r\n                                            &plainauth, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(plainauth) {\r\n        result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", plainauth);\r\n\r\n        if(!result)\r\n          state(conn, IMAP_AUTHENTICATE);\r\n      }\r\n\r\n      Curl_safefree(plainauth);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTHENTICATE LOGIN responses */\r\nstatic CURLcode imap_state_auth_login_resp(struct connectdata *conn,\r\n                                           int imapcode,\r\n                                           imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *authuser = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied: %d\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the user message */\r\n    result = Curl_sasl_create_login_message(data, conn->user,\r\n                                            &authuser, &len);\r\n\r\n    /* Send the user */\r\n    if(!result) {\r\n      if(authuser) {\r\n        result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", authuser);\r\n\r\n        if(!result)\r\n          state(conn, IMAP_AUTHENTICATE_LOGIN_PASSWD);\r\n      }\r\n\r\n      Curl_safefree(authuser);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTHENTICATE LOGIN user entry responses */\r\nstatic CURLcode imap_state_auth_login_password_resp(struct connectdata *conn,\r\n                                                    int imapcode,\r\n                                                    imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *authpasswd = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied: %d\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the password message */\r\n    result = Curl_sasl_create_login_message(data, conn->passwd,\r\n                                            &authpasswd, &len);\r\n\r\n    /* Send the password */\r\n    if(!result) {\r\n      if(authpasswd) {\r\n        result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", authpasswd);\r\n\r\n        if(!result)\r\n          state(conn, IMAP_AUTHENTICATE);\r\n      }\r\n\r\n      Curl_safefree(authpasswd);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n/* For AUTHENTICATE CRAM-MD5 responses */\r\nstatic CURLcode imap_state_auth_cram_resp(struct connectdata *conn,\r\n                                          int imapcode,\r\n                                          imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *chlg64 = data->state.buffer;\r\n  size_t len = 0;\r\n  char *rplyb64 = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied: %d\", imapcode);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Get the challenge */\r\n  for(chlg64 += 2; *chlg64 == ' ' || *chlg64 == '\\t'; chlg64++)\r\n    ;\r\n\r\n  /* Terminate the challenge */\r\n  if(*chlg64 != '=') {\r\n    for(len = strlen(chlg64); len--;)\r\n      if(chlg64[len] != '\\r' && chlg64[len] != '\\n' && chlg64[len] != ' ' &&\r\n         chlg64[len] != '\\t')\r\n        break;\r\n\r\n    if(++len) {\r\n      chlg64[len] = '\\0';\r\n    }\r\n  }\r\n\r\n  /* Create the response message */\r\n  result = Curl_sasl_create_cram_md5_message(data, chlg64, conn->user,\r\n                                             conn->passwd, &rplyb64, &len);\r\n\r\n  /* Send the response */\r\n  if(!result) {\r\n    if(rplyb64) {\r\n      result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", rplyb64);\r\n\r\n      if(!result)\r\n        state(conn, IMAP_AUTHENTICATE);\r\n    }\r\n\r\n    Curl_safefree(rplyb64);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTHENTICATE DIGEST-MD5 challenge responses */\r\nstatic CURLcode imap_state_auth_digest_resp(struct connectdata *conn,\r\n                                            int imapcode,\r\n                                            imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *chlg64 = data->state.buffer;\r\n  size_t len = 0;\r\n  char *rplyb64 = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied: %d\", imapcode);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Get the challenge */\r\n  for(chlg64 += 2; *chlg64 == ' ' || *chlg64 == '\\t'; chlg64++)\r\n    ;\r\n\r\n  /* Create the response message */\r\n  result = Curl_sasl_create_digest_md5_message(data, chlg64, conn->user,\r\n                                               conn->passwd, \"imap\",\r\n                                               &rplyb64, &len);\r\n\r\n  /* Send the response */\r\n  if(!result) {\r\n    if(rplyb64) {\r\n      result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", rplyb64);\r\n\r\n      if(!result)\r\n        state(conn, IMAP_AUTHENTICATE_DIGESTMD5_RESP);\r\n    }\r\n\r\n    Curl_safefree(rplyb64);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTHENTICATE DIGEST-MD5 challenge-response responses */\r\nstatic CURLcode imap_state_auth_digest_resp_resp(struct connectdata *conn,\r\n                                                 int imapcode,\r\n                                                 imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Authentication failed: %d\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Send an empty response */\r\n    result = Curl_pp_sendf(&conn->proto.imapc.pp, \"\");\r\n\r\n    if(!result)\r\n      state(conn, IMAP_AUTHENTICATE);\r\n  }\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n/* For AUTHENTICATE NTLM responses */\r\nstatic CURLcode imap_state_auth_ntlm_resp(struct connectdata *conn,\r\n                                          int imapcode,\r\n                                          imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *type1msg = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied: %d\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the type-1 message */\r\n    result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &type1msg, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(type1msg) {\r\n        result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", type1msg);\r\n\r\n        if(!result)\r\n          state(conn, IMAP_AUTHENTICATE_NTLM_TYPE2MSG);\r\n      }\r\n\r\n      Curl_safefree(type1msg);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For NTLM type-2 responses (sent in reponse to our type-1 message) */\r\nstatic CURLcode imap_state_auth_ntlm_type2msg_resp(struct connectdata *conn,\r\n                                                   int imapcode,\r\n                                                   imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *type3msg = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != '+') {\r\n    failf(data, \"Access denied: %d\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the type-3 message */\r\n    result = Curl_sasl_create_ntlm_type3_message(data,\r\n                                                 data->state.buffer + 2,\r\n                                                 conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &type3msg, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(type3msg) {\r\n        result = Curl_pp_sendf(&conn->proto.imapc.pp, \"%s\", type3msg);\r\n\r\n        if(!result)\r\n          state(conn, IMAP_AUTHENTICATE);\r\n      }\r\n\r\n      Curl_safefree(type3msg);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\n/* For final responses to the AUTHENTICATE sequence */\r\nstatic CURLcode imap_state_auth_final_resp(struct connectdata *conn,\r\n                                           int imapcode,\r\n                                           imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != 'O') {\r\n    failf(data, \"Authentication failed: %d\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* End of connect phase */\r\n  state(conn, IMAP_STOP);\r\n\r\n  return result;\r\n}\r\n\r\n/* For LOGIN responses */\r\nstatic CURLcode imap_state_login_resp(struct connectdata *conn,\r\n                                      int imapcode,\r\n                                      imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != 'O') {\r\n    failf(data, \"Access denied. %c\", imapcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else\r\n    /* End of connect phase */\r\n    state(conn, IMAP_STOP);\r\n\r\n  return result;\r\n}\r\n\r\n/* Start the DO phase */\r\nstatic CURLcode imap_select(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  const char *str = getcmdid(conn);\r\n\r\n  result = imap_sendf(conn, str, \"%s SELECT %s\", str,\r\n                      imapc->mailbox?imapc->mailbox:\"\");\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, IMAP_SELECT);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode imap_fetch(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  const char *str = getcmdid(conn);\r\n\r\n  /* TODO: make this select the correct mail\r\n   * Use \"1 body[text]\" to get the full mail body of mail 1\r\n   */\r\n  result = imap_sendf(conn, str, \"%s FETCH 1 BODY[TEXT]\", str);\r\n  if(result)\r\n    return result;\r\n\r\n  /*\r\n   * When issued, the server will respond with a single line similar to\r\n   * '* 1 FETCH (BODY[TEXT] {2021}'\r\n   *\r\n   * Identifying the fetch and how many bytes of contents we can expect. We\r\n   * must extract that number before continuing to \"download as usual\".\r\n   */\r\n\r\n  state(conn, IMAP_FETCH);\r\n\r\n  return result;\r\n}\r\n\r\n/* For SELECT responses */\r\nstatic CURLcode imap_state_select_resp(struct connectdata *conn,\r\n                                       int imapcode,\r\n                                       imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(imapcode != 'O') {\r\n    failf(data, \"Select failed\");\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else\r\n    result = imap_fetch(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For the (first line of) FETCH BODY[TEXT] response */\r\nstatic CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,\r\n                                      imapstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  struct FTP *imap = data->state.proto.imap;\r\n  struct pingpong *pp = &imapc->pp;\r\n  const char *ptr = data->state.buffer;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if('*' != imapcode) {\r\n    Curl_pgrsSetDownloadSize(data, 0);\r\n    state(conn, IMAP_STOP);\r\n    return CURLE_OK;\r\n  }\r\n\r\n  /* Something like this comes \"* 1 FETCH (BODY[TEXT] {2021}\\r\" */\r\n  while(*ptr && (*ptr != '{'))\r\n    ptr++;\r\n\r\n  if(*ptr == '{') {\r\n    curl_off_t filesize = curlx_strtoofft(ptr + 1, NULL, 10);\r\n    if(filesize)\r\n      Curl_pgrsSetDownloadSize(data, filesize);\r\n\r\n    infof(data, \"Found %\" FORMAT_OFF_TU \" bytes to download\\n\", filesize);\r\n\r\n    if(pp->cache) {\r\n      /* At this point there is a bunch of data in the header \"cache\" that is\r\n         actually body content, send it as body and then skip it. Do note\r\n         that there may even be additional \"headers\" after the body. */\r\n      size_t chunk = pp->cache_size;\r\n\r\n      if(chunk > (size_t)filesize)\r\n        /* the conversion from curl_off_t to size_t is always fine here */\r\n        chunk = (size_t)filesize;\r\n\r\n      result = Curl_client_write(conn, CLIENTWRITE_BODY, pp->cache, chunk);\r\n      if(result)\r\n        return result;\r\n\r\n      filesize -= chunk;\r\n\r\n      /* we've now used parts of or the entire cache */\r\n      if(pp->cache_size > chunk) {\r\n        /* part of, move the trailing data to the start and reduce the size */\r\n        memmove(pp->cache, pp->cache+chunk,\r\n                pp->cache_size - chunk);\r\n        pp->cache_size -= chunk;\r\n      }\r\n      else {\r\n        /* cache is drained */\r\n        Curl_safefree(pp->cache);\r\n        pp->cache = NULL;\r\n        pp->cache_size = 0;\r\n      }\r\n    }\r\n\r\n    infof(data, \"Filesize left: %\" FORMAT_OFF_T \"\\n\", filesize);\r\n\r\n    if(!filesize)\r\n      /* the entire data is already transferred! */\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n    else\r\n      /* IMAP download */\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE,\r\n                          imap->bytecountp, -1, NULL); /* no upload here */\r\n\r\n    data->req.maxdownload = filesize;\r\n  }\r\n  else\r\n    /* We don't know how to parse this line */\r\n    result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */\r\n\r\n  /* End of do phase */\r\n  state(conn, IMAP_STOP);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode imap_statemach_act(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  int imapcode;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  struct pingpong *pp = &imapc->pp;\r\n  size_t nread = 0;\r\n\r\n  /* Busy upgrading the connection; right now all I/O is SSL/TLS, not IMAP */\r\n  if(imapc->state == IMAP_UPGRADETLS)\r\n    return imap_state_upgrade_tls(conn);\r\n\r\n  /* Flush any data that needs to be sent */\r\n  if(pp->sendleft)\r\n    return Curl_pp_flushsend(pp);\r\n\r\n  /* Read the response from the server */\r\n  result = Curl_pp_readresp(sock, pp, &imapcode, &nread);\r\n  if(result)\r\n    return result;\r\n\r\n  if(imapcode) {\r\n    /* We have now received a full IMAP server response */\r\n    switch(imapc->state) {\r\n    case IMAP_SERVERGREET:\r\n      result = imap_state_servergreet_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_STARTTLS:\r\n      result = imap_state_starttls_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_CAPABILITY:\r\n      result = imap_state_capability_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_AUTHENTICATE_PLAIN:\r\n      result = imap_state_auth_plain_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_AUTHENTICATE_LOGIN:\r\n      result = imap_state_auth_login_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_AUTHENTICATE_LOGIN_PASSWD:\r\n      result = imap_state_auth_login_password_resp(conn, imapcode,\r\n                                                   imapc->state);\r\n      break;\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n    case IMAP_AUTHENTICATE_CRAMMD5:\r\n      result = imap_state_auth_cram_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_AUTHENTICATE_DIGESTMD5:\r\n      result = imap_state_auth_digest_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_AUTHENTICATE_DIGESTMD5_RESP:\r\n      result = imap_state_auth_digest_resp_resp(conn, imapcode, imapc->state);\r\n      break;\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n    case IMAP_AUTHENTICATE_NTLM:\r\n      result = imap_state_auth_ntlm_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_AUTHENTICATE_NTLM_TYPE2MSG:\r\n      result = imap_state_auth_ntlm_type2msg_resp(conn, imapcode,\r\n                                                  imapc->state);\r\n      break;\r\n#endif\r\n\r\n    case IMAP_AUTHENTICATE:\r\n      result = imap_state_auth_final_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_LOGIN:\r\n      result = imap_state_login_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_FETCH:\r\n      result = imap_state_fetch_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_SELECT:\r\n      result = imap_state_select_resp(conn, imapcode, imapc->state);\r\n      break;\r\n\r\n    case IMAP_LOGOUT:\r\n      /* fallthrough, just stop! */\r\n    default:\r\n      /* internal error */\r\n      state(conn, IMAP_STOP);\r\n      break;\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Called repeatedly until done from multi.c */\r\nstatic CURLcode imap_multi_statemach(struct connectdata *conn, bool *done)\r\n{\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  CURLcode result;\r\n\r\n  if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone)\r\n    result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone);\r\n  else\r\n    result = Curl_pp_multi_statemach(&imapc->pp);\r\n\r\n  *done = (imapc->state == IMAP_STOP) ? TRUE : FALSE;\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode imap_easy_statemach(struct connectdata *conn)\r\n{\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  struct pingpong *pp = &imapc->pp;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  while(imapc->state != IMAP_STOP) {\r\n    result = Curl_pp_easy_statemach(pp);\r\n    if(result)\r\n      break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Allocate and initialize the struct IMAP for the current SessionHandle if\r\n   required */\r\nstatic CURLcode imap_init(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *imap = data->state.proto.imap;\r\n\r\n  if(!imap) {\r\n    imap = data->state.proto.imap = calloc(sizeof(struct FTP), 1);\r\n    if(!imap)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Get some initial data into the imap struct */\r\n  imap->bytecountp = &data->req.bytecount;\r\n\r\n  /* No need to duplicate user+password, the connectdata struct won't change\r\n     during a session, but we re-init them here since on subsequent inits\r\n     since the conn struct may have changed or been replaced.\r\n  */\r\n  imap->user = conn->user;\r\n  imap->passwd = conn->passwd;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_connect() should do everything that is to be considered a part of\r\n * the connection phase.\r\n *\r\n * The variable 'done' points to will be TRUE if the protocol-layer connect\r\n * phase is done when this function returns, or FALSE is not. When called as\r\n * a part of the easy interface, it will always be TRUE.\r\n */\r\nstatic CURLcode imap_connect(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result;\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  struct pingpong *pp = &imapc->pp;\r\n\r\n  *done = FALSE; /* default to not done yet */\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  result = imap_init(conn);\r\n  if(CURLE_OK != result)\r\n    return result;\r\n\r\n  /* We always support persistent connections on imap */\r\n  conn->bits.close = FALSE;\r\n\r\n  pp->response_time = RESP_TIMEOUT; /* set default response time-out */\r\n  pp->statemach_act = imap_statemach_act;\r\n  pp->endofresp = imap_endofresp;\r\n  pp->conn = conn;\r\n\r\n  Curl_pp_init(pp); /* init generic pingpong data */\r\n\r\n  /* Start off waiting for the server greeting response */\r\n  state(conn, IMAP_SERVERGREET);\r\n\r\n  /* Start off with an id of '*' */\r\n  imapc->idstr = \"*\";\r\n\r\n  result = imap_multi_statemach(conn, done);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_done()\r\n *\r\n * The DONE function. This does what needs to be done after a single DO has\r\n * performed.\r\n *\r\n * Input argument is already checked for validity.\r\n */\r\nstatic CURLcode imap_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *imap = data->state.proto.imap;\r\n  CURLcode result=CURLE_OK;\r\n\r\n  (void)premature;\r\n\r\n  if(!imap)\r\n    /* When the easy handle is removed from the multi while libcurl is still\r\n     * trying to resolve the host name, it seems that the imap struct is not\r\n     * yet initialized, but the removal action calls Curl_done() which calls\r\n     * this function. So we simply return success if no imap pointer is set.\r\n     */\r\n    return CURLE_OK;\r\n\r\n  if(status) {\r\n    conn->bits.close = TRUE; /* marked for closure */\r\n    result = status;         /* use the already set error code */\r\n  }\r\n\r\n  /* Clear the transfer mode for the next connection */\r\n  imap->transfer = FTPTRANSFER_BODY;\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_perform()\r\n *\r\n * This is the actual DO function for IMAP. Get a file/directory according to\r\n * the options previously setup.\r\n */\r\nstatic CURLcode imap_perform(struct connectdata *conn, bool *connected,\r\n                             bool *dophase_done)\r\n{\r\n  /* This is IMAP and no proxy */\r\n  CURLcode result = CURLE_OK;\r\n\r\n  DEBUGF(infof(conn->data, \"DO phase starts\\n\"));\r\n\r\n  if(conn->data->set.opt_no_body) {\r\n    /* Requested no body means no transfer */\r\n    struct FTP *imap = conn->data->state.proto.imap;\r\n    imap->transfer = FTPTRANSFER_INFO;\r\n  }\r\n\r\n  *dophase_done = FALSE; /* not done yet */\r\n\r\n  /* Start the first command in the DO phase */\r\n  result = imap_select(conn);\r\n  if(result)\r\n    return result;\r\n\r\n  /* run the state-machine */\r\n  result = imap_multi_statemach(conn, dophase_done);\r\n\r\n  *connected = conn->bits.tcpconnect[FIRSTSOCKET];\r\n\r\n  if(*dophase_done)\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_do()\r\n *\r\n * This function is registered as 'curl_do' function. It decodes the path\r\n * parts etc as a wrapper to the actual DO function (imap_perform).\r\n *\r\n * The input argument is already checked for validity.\r\n */\r\nstatic CURLcode imap_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n\r\n  *done = FALSE; /* default to false */\r\n\r\n  /*\r\n    Since connections can be re-used between SessionHandles, this might be a\r\n    connection already existing but on a fresh SessionHandle struct so we must\r\n    make sure we have a good 'struct IMAP' to play with. For new connections,\r\n    the struct IMAP is allocated and setup in the imap_connect() function.\r\n  */\r\n  Curl_reset_reqproto(conn);\r\n  retcode = imap_init(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  /* Parse the URL path */\r\n  retcode = imap_parse_url_path(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  retcode = imap_regular_transfer(conn, done);\r\n\r\n  return retcode;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_logout()\r\n *\r\n * This should be called before calling sclose().  We should then wait for the\r\n * response from the server before returning. The calling code should then try\r\n * to close the connection.\r\n *\r\n */\r\nstatic CURLcode imap_logout(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  const char *str = getcmdid(conn);\r\n\r\n  result = imap_sendf(conn, str, \"%s LOGOUT\", str, NULL);\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, IMAP_LOGOUT);\r\n\r\n  result = imap_easy_statemach(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_disconnect()\r\n *\r\n * Disconnect from an IMAP server. Cleanup protocol-specific per-connection\r\n * resources. BLOCKING.\r\n */\r\nstatic CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  struct imap_conn *imapc= &conn->proto.imapc;\r\n\r\n  /* We cannot send quit unconditionally. If this connection is stale or\r\n     bad in any way, sending quit and waiting around here will make the\r\n     disconnect wait in vain and cause more problems than we need to */\r\n\r\n  /* The IMAP session may or may not have been allocated/setup at this\r\n     point! */\r\n  if(!dead_connection && imapc->pp.conn)\r\n    (void)imap_logout(conn); /* ignore errors on the LOGOUT */\r\n\r\n  /* Disconnect from the server */\r\n  Curl_pp_disconnect(&imapc->pp);\r\n\r\n  /* Cleanup the SASL module */\r\n  Curl_sasl_cleanup(conn, imapc->authused);\r\n\r\n  /* Cleanup our connection based variables */\r\n  Curl_safefree(imapc->mailbox);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_parse_url_path()\r\n *\r\n * Parse the URL path into separate path components.\r\n *\r\n */\r\nstatic CURLcode imap_parse_url_path(struct connectdata *conn)\r\n{\r\n  /* The imap struct is already inited in imap_connect() */\r\n  struct imap_conn *imapc = &conn->proto.imapc;\r\n  struct SessionHandle *data = conn->data;\r\n  const char *path = data->state.path;\r\n\r\n  if(!*path)\r\n    path = \"INBOX\";\r\n\r\n  /* URL decode the path and use this mailbox */\r\n  return Curl_urldecode(data, path, 0, &imapc->mailbox, NULL, TRUE);\r\n}\r\n\r\n/* Call this when the DO phase has completed */\r\nstatic CURLcode imap_dophase_done(struct connectdata *conn, bool connected)\r\n{\r\n  struct FTP *imap = conn->data->state.proto.imap;\r\n\r\n  (void)connected;\r\n\r\n  if(imap->transfer != FTPTRANSFER_BODY)\r\n    /* no data to transfer */\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Called from multi.c while DOing */\r\nstatic CURLcode imap_doing(struct connectdata *conn, bool *dophase_done)\r\n{\r\n  CURLcode result = imap_multi_statemach(conn, dophase_done);\r\n\r\n  if(result)\r\n    DEBUGF(infof(conn->data, \"DO phase failed\\n\"));\r\n  else {\r\n    if(*dophase_done) {\r\n      result = imap_dophase_done(conn, FALSE /* not connected */);\r\n\r\n      DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * imap_regular_transfer()\r\n *\r\n * The input argument is already checked for validity.\r\n *\r\n * Performs all commands done before a regular transfer between a local and a\r\n * remote host.\r\n */\r\nstatic CURLcode imap_regular_transfer(struct connectdata *conn,\r\n                                      bool *dophase_done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  bool connected = FALSE;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* Make sure size is unknown at this point */\r\n  data->req.size = -1;\r\n\r\n  Curl_pgrsSetUploadCounter(data, 0);\r\n  Curl_pgrsSetDownloadCounter(data, 0);\r\n  Curl_pgrsSetUploadSize(data, 0);\r\n  Curl_pgrsSetDownloadSize(data, 0);\r\n\r\n  result = imap_perform(conn, &connected, dophase_done);\r\n\r\n  if(CURLE_OK == result) {\r\n    if(!*dophase_done)\r\n      /* The DO phase has not completed yet */\r\n      return CURLE_OK;\r\n\r\n    result = imap_dophase_done(conn, connected);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode imap_setup_connection(struct connectdata * conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) {\r\n    /* Unless we have asked to tunnel imap operations through the proxy, we\r\n       switch and use HTTP operations only */\r\n#ifndef CURL_DISABLE_HTTP\r\n    if(conn->handler == &Curl_handler_imap)\r\n      conn->handler = &Curl_handler_imap_proxy;\r\n    else {\r\n#ifdef USE_SSL\r\n      conn->handler = &Curl_handler_imaps_proxy;\r\n#else\r\n      failf(data, \"IMAPS not supported!\");\r\n      return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n    }\r\n\r\n    /* We explicitly mark this connection as persistent here as we're doing\r\n       IMAP over HTTP and thus we accidentally avoid setting this value\r\n       otherwise */\r\n    conn->bits.close = FALSE;\r\n#else\r\n    failf(data, \"IMAP over http proxy requires HTTP support built-in!\");\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n  }\r\n\r\n  data->state.path++;   /* don't include the initial slash */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* CURL_DISABLE_IMAP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/imap.h",
    "content": "#ifndef HEADER_CURL_IMAP_H\r\n#define HEADER_CURL_IMAP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2009 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"pingpong.h\"\r\n\r\n/****************************************************************************\r\n * IMAP unique setup\r\n ***************************************************************************/\r\ntypedef enum {\r\n  IMAP_STOP,         /* do nothing state, stops the state machine */\r\n  IMAP_SERVERGREET,  /* waiting for the initial greeting immediately after\r\n                        a connect */\r\n  IMAP_STARTTLS,\r\n  IMAP_UPGRADETLS,   /* asynchronously upgrade the connection to SSL/TLS\r\n                       (multi mode only) */\r\n  IMAP_CAPABILITY,\r\n  IMAP_AUTHENTICATE_PLAIN,\r\n  IMAP_AUTHENTICATE_LOGIN,\r\n  IMAP_AUTHENTICATE_LOGIN_PASSWD,\r\n  IMAP_AUTHENTICATE_CRAMMD5,\r\n  IMAP_AUTHENTICATE_DIGESTMD5,\r\n  IMAP_AUTHENTICATE_DIGESTMD5_RESP,\r\n  IMAP_AUTHENTICATE_NTLM,\r\n  IMAP_AUTHENTICATE_NTLM_TYPE2MSG,\r\n  IMAP_AUTHENTICATE,\r\n  IMAP_LOGIN,\r\n  IMAP_SELECT,\r\n  IMAP_FETCH,\r\n  IMAP_LOGOUT,\r\n  IMAP_LAST          /* never used */\r\n} imapstate;\r\n\r\n/* imap_conn is used for struct connection-oriented data in the connectdata\r\n   struct */\r\nstruct imap_conn {\r\n  struct pingpong pp;\r\n  char *mailbox;          /* Mailbox to select */\r\n  unsigned int authmechs; /* Accepted authentication mechanisms */\r\n  unsigned int authused;  /* Auth mechanism used for the connection */\r\n  imapstate state;        /* Always use imap.c:state() to change state! */\r\n  int cmdid;              /* Next command ID */\r\n  const char *idstr;      /* String based response ID to wait for */\r\n  bool ssldone;           /* Is connect() over SSL done? */\r\n  bool login_disabled;    /* LOGIN command explicitly disabled by server */\r\n};\r\n\r\nextern const struct Curl_handler Curl_handler_imap;\r\nextern const struct Curl_handler Curl_handler_imaps;\r\n\r\n#endif /* HEADER_CURL_IMAP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/inet_ntop.c",
    "content": "/*\r\n * Copyright (C) 1996-2001  Internet Software Consortium.\r\n *\r\n * Permission to use, copy, modify, and distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND INTERNET SOFTWARE CONSORTIUM\r\n * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL\r\n * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,\r\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING\r\n * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\r\n * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION\r\n * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n/*\r\n * Original code by Paul Vixie. \"curlified\" by Gisle Vanem.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef HAVE_INET_NTOP\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"inet_ntop.h\"\r\n\r\n#define IN6ADDRSZ       16\r\n#define INADDRSZ         4\r\n#define INT16SZ          2\r\n\r\n/*\r\n * Format an IPv4 address, more or less like inet_ntoa().\r\n *\r\n * Returns `dst' (as a const)\r\n * Note:\r\n *  - uses no statics\r\n *  - takes a unsigned char* not an in_addr as input\r\n */\r\nstatic char *inet_ntop4 (const unsigned char *src, char *dst, size_t size)\r\n{\r\n  char tmp[sizeof \"255.255.255.255\"];\r\n  size_t len;\r\n\r\n  DEBUGASSERT(size >= 16);\r\n\r\n  tmp[0] = '\\0';\r\n  (void)snprintf(tmp, sizeof(tmp), \"%d.%d.%d.%d\",\r\n          ((int)((unsigned char)src[0])) & 0xff,\r\n          ((int)((unsigned char)src[1])) & 0xff,\r\n          ((int)((unsigned char)src[2])) & 0xff,\r\n          ((int)((unsigned char)src[3])) & 0xff);\r\n\r\n  len = strlen(tmp);\r\n  if(len == 0 || len >= size) {\r\n    SET_ERRNO(ENOSPC);\r\n    return (NULL);\r\n  }\r\n  strcpy(dst, tmp);\r\n  return dst;\r\n}\r\n\r\n#ifdef ENABLE_IPV6\r\n/*\r\n * Convert IPv6 binary address into presentation (printable) format.\r\n */\r\nstatic char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)\r\n{\r\n  /*\r\n   * Note that int32_t and int16_t need only be \"at least\" large enough\r\n   * to contain a value of the specified size.  On some systems, like\r\n   * Crays, there is no such thing as an integer variable with 16 bits.\r\n   * Keep this in mind if you think this function should have been coded\r\n   * to use pointer overlays.  All the world's not a VAX.\r\n   */\r\n  char tmp[sizeof(\"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255\")];\r\n  char *tp;\r\n  struct {\r\n    long base;\r\n    long len;\r\n  } best, cur;\r\n  unsigned long words[IN6ADDRSZ / INT16SZ];\r\n  int i;\r\n\r\n  /* Preprocess:\r\n   *  Copy the input (bytewise) array into a wordwise array.\r\n   *  Find the longest run of 0x00's in src[] for :: shorthanding.\r\n   */\r\n  memset(words, '\\0', sizeof(words));\r\n  for(i = 0; i < IN6ADDRSZ; i++)\r\n    words[i/2] |= (src[i] << ((1 - (i % 2)) << 3));\r\n\r\n  best.base = -1;\r\n  cur.base  = -1;\r\n  best.len = 0;\r\n  cur.len = 0;\r\n\r\n  for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {\r\n    if(words[i] == 0) {\r\n      if(cur.base == -1)\r\n        cur.base = i, cur.len = 1;\r\n      else\r\n        cur.len++;\r\n    }\r\n    else if(cur.base != -1) {\r\n      if(best.base == -1 || cur.len > best.len)\r\n        best = cur;\r\n      cur.base = -1;\r\n    }\r\n  }\r\n  if((cur.base != -1) && (best.base == -1 || cur.len > best.len))\r\n    best = cur;\r\n  if(best.base != -1 && best.len < 2)\r\n    best.base = -1;\r\n  /* Format the result. */\r\n  tp = tmp;\r\n  for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {\r\n    /* Are we inside the best run of 0x00's? */\r\n    if(best.base != -1 && i >= best.base && i < (best.base + best.len)) {\r\n      if(i == best.base)\r\n        *tp++ = ':';\r\n      continue;\r\n    }\r\n\r\n    /* Are we following an initial run of 0x00s or any real hex?\r\n     */\r\n    if(i != 0)\r\n      *tp++ = ':';\r\n\r\n    /* Is this address an encapsulated IPv4?\r\n     */\r\n    if(i == 6 && best.base == 0 &&\r\n        (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {\r\n      if(!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp))) {\r\n        SET_ERRNO(ENOSPC);\r\n        return (NULL);\r\n      }\r\n      tp += strlen(tp);\r\n      break;\r\n    }\r\n    tp += snprintf(tp, 5, \"%lx\", words[i]);\r\n  }\r\n\r\n  /* Was it a trailing run of 0x00's?\r\n   */\r\n  if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))\r\n     *tp++ = ':';\r\n  *tp++ = '\\0';\r\n\r\n  /* Check for overflow, copy, and we're done.\r\n   */\r\n  if((size_t)(tp - tmp) > size) {\r\n    SET_ERRNO(ENOSPC);\r\n    return (NULL);\r\n  }\r\n  strcpy(dst, tmp);\r\n  return dst;\r\n}\r\n#endif  /* ENABLE_IPV6 */\r\n\r\n/*\r\n * Convert a network format address to presentation format.\r\n *\r\n * Returns pointer to presentation format address (`buf').\r\n * Returns NULL on error and errno set with the specific\r\n * error, EAFNOSUPPORT or ENOSPC.\r\n *\r\n * On Windows we store the error in the thread errno, not\r\n * in the winsock error code. This is to avoid losing the\r\n * actual last winsock error. So use macro ERRNO to fetch the\r\n * errno this function sets when returning NULL, not SOCKERRNO.\r\n */\r\nchar *Curl_inet_ntop(int af, const void *src, char *buf, size_t size)\r\n{\r\n  switch (af) {\r\n  case AF_INET:\r\n    return inet_ntop4((const unsigned char*)src, buf, size);\r\n#ifdef ENABLE_IPV6\r\n  case AF_INET6:\r\n    return inet_ntop6((const unsigned char*)src, buf, size);\r\n#endif\r\n  default:\r\n    SET_ERRNO(EAFNOSUPPORT);\r\n    return NULL;\r\n  }\r\n}\r\n#endif  /* HAVE_INET_NTOP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/inet_ntop.h",
    "content": "#ifndef HEADER_CURL_INET_NTOP_H\r\n#define HEADER_CURL_INET_NTOP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\nchar *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);\r\n\r\n#ifdef HAVE_INET_NTOP\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#define Curl_inet_ntop(af,addr,buf,size) \\\r\n        inet_ntop(af,addr,buf,(curl_socklen_t)size)\r\n#endif\r\n\r\n#endif /* HEADER_CURL_INET_NTOP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/inet_pton.c",
    "content": "/* This is from the BIND 4.9.4 release, modified to compile by itself */\r\n\r\n/* Copyright (c) 1996 by Internet Software Consortium.\r\n *\r\n * Permission to use, copy, modify, and distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS\r\n * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES\r\n * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE\r\n * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\r\n * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\r\n * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r\n * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r\n * SOFTWARE.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef HAVE_INET_PTON\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n\r\n#include \"inet_pton.h\"\r\n\r\n#define IN6ADDRSZ       16\r\n#define INADDRSZ         4\r\n#define INT16SZ          2\r\n\r\n/*\r\n * WARNING: Don't even consider trying to compile this on a system where\r\n * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.\r\n */\r\n\r\nstatic int      inet_pton4(const char *src, unsigned char *dst);\r\n#ifdef ENABLE_IPV6\r\nstatic int      inet_pton6(const char *src, unsigned char *dst);\r\n#endif\r\n\r\n/* int\r\n * inet_pton(af, src, dst)\r\n *      convert from presentation format (which usually means ASCII printable)\r\n *      to network format (which is usually some kind of binary format).\r\n * return:\r\n *      1 if the address was valid for the specified address family\r\n *      0 if the address wasn't valid (`dst' is untouched in this case)\r\n *      -1 if some other error occurred (`dst' is untouched in this case, too)\r\n * notice:\r\n *      On Windows we store the error in the thread errno, not\r\n *      in the winsock error code. This is to avoid losing the\r\n *      actual last winsock error. So use macro ERRNO to fetch the\r\n *      errno this function sets when returning (-1), not SOCKERRNO.\r\n * author:\r\n *      Paul Vixie, 1996.\r\n */\r\nint\r\nCurl_inet_pton(int af, const char *src, void *dst)\r\n{\r\n  switch (af) {\r\n  case AF_INET:\r\n    return (inet_pton4(src, (unsigned char *)dst));\r\n#ifdef ENABLE_IPV6\r\n  case AF_INET6:\r\n    return (inet_pton6(src, (unsigned char *)dst));\r\n#endif\r\n  default:\r\n    SET_ERRNO(EAFNOSUPPORT);\r\n    return (-1);\r\n  }\r\n  /* NOTREACHED */\r\n}\r\n\r\n/* int\r\n * inet_pton4(src, dst)\r\n *      like inet_aton() but without all the hexadecimal and shorthand.\r\n * return:\r\n *      1 if `src' is a valid dotted quad, else 0.\r\n * notice:\r\n *      does not touch `dst' unless it's returning 1.\r\n * author:\r\n *      Paul Vixie, 1996.\r\n */\r\nstatic int\r\ninet_pton4(const char *src, unsigned char *dst)\r\n{\r\n  static const char digits[] = \"0123456789\";\r\n  int saw_digit, octets, ch;\r\n  unsigned char tmp[INADDRSZ], *tp;\r\n\r\n  saw_digit = 0;\r\n  octets = 0;\r\n  tp = tmp;\r\n  *tp = 0;\r\n  while((ch = *src++) != '\\0') {\r\n    const char *pch;\r\n\r\n    if((pch = strchr(digits, ch)) != NULL) {\r\n      unsigned int val = *tp * 10 + (unsigned int)(pch - digits);\r\n\r\n      if(saw_digit && *tp == 0)\r\n        return (0);\r\n      if(val > 255)\r\n        return (0);\r\n      *tp = (unsigned char)val;\r\n      if(! saw_digit) {\r\n        if(++octets > 4)\r\n          return (0);\r\n        saw_digit = 1;\r\n      }\r\n    }\r\n    else if(ch == '.' && saw_digit) {\r\n      if(octets == 4)\r\n        return (0);\r\n      *++tp = 0;\r\n      saw_digit = 0;\r\n    }\r\n    else\r\n      return (0);\r\n  }\r\n  if(octets < 4)\r\n    return (0);\r\n  memcpy(dst, tmp, INADDRSZ);\r\n  return (1);\r\n}\r\n\r\n#ifdef ENABLE_IPV6\r\n/* int\r\n * inet_pton6(src, dst)\r\n *      convert presentation level address to network order binary form.\r\n * return:\r\n *      1 if `src' is a valid [RFC1884 2.2] address, else 0.\r\n * notice:\r\n *      (1) does not touch `dst' unless it's returning 1.\r\n *      (2) :: in a full address is silently ignored.\r\n * credit:\r\n *      inspired by Mark Andrews.\r\n * author:\r\n *      Paul Vixie, 1996.\r\n */\r\nstatic int\r\ninet_pton6(const char *src, unsigned char *dst)\r\n{\r\n  static const char xdigits_l[] = \"0123456789abcdef\",\r\n    xdigits_u[] = \"0123456789ABCDEF\";\r\n  unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;\r\n  const char *xdigits, *curtok;\r\n  int ch, saw_xdigit;\r\n  size_t val;\r\n\r\n  memset((tp = tmp), 0, IN6ADDRSZ);\r\n  endp = tp + IN6ADDRSZ;\r\n  colonp = NULL;\r\n  /* Leading :: requires some special handling. */\r\n  if(*src == ':')\r\n    if(*++src != ':')\r\n      return (0);\r\n  curtok = src;\r\n  saw_xdigit = 0;\r\n  val = 0;\r\n  while((ch = *src++) != '\\0') {\r\n    const char *pch;\r\n\r\n    if((pch = strchr((xdigits = xdigits_l), ch)) == NULL)\r\n      pch = strchr((xdigits = xdigits_u), ch);\r\n    if(pch != NULL) {\r\n      val <<= 4;\r\n      val |= (pch - xdigits);\r\n      if(++saw_xdigit > 4)\r\n        return (0);\r\n      continue;\r\n    }\r\n    if(ch == ':') {\r\n      curtok = src;\r\n      if(!saw_xdigit) {\r\n        if(colonp)\r\n          return (0);\r\n        colonp = tp;\r\n        continue;\r\n      }\r\n      if(tp + INT16SZ > endp)\r\n        return (0);\r\n      *tp++ = (unsigned char) (val >> 8) & 0xff;\r\n      *tp++ = (unsigned char) val & 0xff;\r\n      saw_xdigit = 0;\r\n      val = 0;\r\n      continue;\r\n    }\r\n    if(ch == '.' && ((tp + INADDRSZ) <= endp) &&\r\n        inet_pton4(curtok, tp) > 0) {\r\n      tp += INADDRSZ;\r\n      saw_xdigit = 0;\r\n      break;    /* '\\0' was seen by inet_pton4(). */\r\n    }\r\n    return (0);\r\n  }\r\n  if(saw_xdigit) {\r\n    if(tp + INT16SZ > endp)\r\n      return (0);\r\n    *tp++ = (unsigned char) (val >> 8) & 0xff;\r\n    *tp++ = (unsigned char) val & 0xff;\r\n  }\r\n  if(colonp != NULL) {\r\n    /*\r\n     * Since some memmove()'s erroneously fail to handle\r\n     * overlapping regions, we'll do the shift by hand.\r\n     */\r\n    const ssize_t n = tp - colonp;\r\n    ssize_t i;\r\n\r\n    if(tp == endp)\r\n      return (0);\r\n    for(i = 1; i <= n; i++) {\r\n      *(endp - i) = *(colonp + n - i);\r\n      *(colonp + n - i) = 0;\r\n    }\r\n    tp = endp;\r\n  }\r\n  if(tp != endp)\r\n    return (0);\r\n  memcpy(dst, tmp, IN6ADDRSZ);\r\n  return (1);\r\n}\r\n#endif /* ENABLE_IPV6 */\r\n\r\n#endif /* HAVE_INET_PTON */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/inet_pton.h",
    "content": "#ifndef HEADER_CURL_INET_PTON_H\r\n#define HEADER_CURL_INET_PTON_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\nint Curl_inet_pton(int, const char *, void *);\r\n\r\n#ifdef HAVE_INET_PTON\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#define Curl_inet_pton(x,y,z) inet_pton(x,y,z)\r\n#endif\r\n\r\n#endif /* HEADER_CURL_INET_PTON_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/krb4.c",
    "content": "/* This source code was modified by Martin Hedenfalk <mhe@stacken.kth.se> for\r\n * use in Curl. Martin's latest changes were done 2000-09-18.\r\n *\r\n * It has since been patched away like a madman by Daniel Stenberg to make it\r\n * better applied to curl conditions, and to make it not use globals, pollute\r\n * name space and more.\r\n *\r\n * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan\r\n * (Royal Institute of Technology, Stockholm, Sweden).\r\n * Copyright (c) 2004 - 2011 Daniel Stenberg\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the Institute nor the names of its contributors\r\n *    may be used to endorse or promote products derived from this software\r\n *    without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n *\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n#ifdef HAVE_KRB4\r\n\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#include <krb.h>\r\n#include <des.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"curl_base64.h\"\r\n#include \"ftp.h\"\r\n#include \"sendf.h\"\r\n#include \"krb4.h\"\r\n#include \"inet_ntop.h\"\r\n#include \"curl_memory.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define LOCAL_ADDR (&conn->local_addr)\r\n#define REMOTE_ADDR conn->ip_addr->ai_addr\r\n#define myctladdr LOCAL_ADDR\r\n#define hisctladdr REMOTE_ADDR\r\n\r\nstruct krb4_data {\r\n  des_cblock key;\r\n  des_key_schedule schedule;\r\n  char name[ANAME_SZ];\r\n  char instance[INST_SZ];\r\n  char realm[REALM_SZ];\r\n};\r\n\r\n#ifndef HAVE_STRLCPY\r\n/* if it ever goes non-static, make it Curl_ prefixed! */\r\nstatic size_t\r\nstrlcpy (char *dst, const char *src, size_t dst_sz)\r\n{\r\n  size_t n;\r\n  char *p;\r\n\r\n  for(p = dst, n = 0;\r\n      n + 1 < dst_sz && *src != '\\0';\r\n      ++p, ++src, ++n)\r\n    *p = *src;\r\n  *p = '\\0';\r\n  if(*src == '\\0')\r\n    return n;\r\n  else\r\n    return n + strlen (src);\r\n}\r\n#else\r\nsize_t strlcpy (char *dst, const char *src, size_t dst_sz);\r\n#endif\r\n\r\nstatic int\r\nkrb4_check_prot(void *app_data, int level)\r\n{\r\n  app_data = NULL; /* prevent compiler warning */\r\n  if(level == PROT_CONFIDENTIAL)\r\n    return -1;\r\n  return 0;\r\n}\r\n\r\nstatic int\r\nkrb4_decode(void *app_data, void *buf, int len, int level,\r\n            struct connectdata *conn)\r\n{\r\n  MSG_DAT m;\r\n  int e;\r\n  struct krb4_data *d = app_data;\r\n\r\n  if(level == PROT_SAFE)\r\n    e = krb_rd_safe(buf, len, &d->key,\r\n                    (struct sockaddr_in *)REMOTE_ADDR,\r\n                    (struct sockaddr_in *)LOCAL_ADDR, &m);\r\n  else\r\n    e = krb_rd_priv(buf, len, d->schedule, &d->key,\r\n                    (struct sockaddr_in *)REMOTE_ADDR,\r\n                    (struct sockaddr_in *)LOCAL_ADDR, &m);\r\n  if(e) {\r\n    struct SessionHandle *data = conn->data;\r\n    infof(data, \"krb4_decode: %s\\n\", krb_get_err_text(e));\r\n    return -1;\r\n  }\r\n  memmove(buf, m.app_data, m.app_length);\r\n  return m.app_length;\r\n}\r\n\r\nstatic int\r\nkrb4_overhead(void *app_data, int level, int len)\r\n{\r\n  /* no arguments are used, just init them to prevent compiler warnings */\r\n  app_data = NULL;\r\n  level = 0;\r\n  len = 0;\r\n  return 31;\r\n}\r\n\r\nstatic int\r\nkrb4_encode(void *app_data, const void *from, int length, int level, void **to,\r\n            struct connectdata *conn)\r\n{\r\n  struct krb4_data *d = app_data;\r\n  *to = malloc(length + 31);\r\n  if(!*to)\r\n    return -1;\r\n  if(level == PROT_SAFE)\r\n    /* NOTE that the void* cast is safe, krb_mk_safe/priv don't modify the\r\n     * input buffer\r\n     */\r\n    return krb_mk_safe((void*)from, *to, length, &d->key,\r\n                       (struct sockaddr_in *)LOCAL_ADDR,\r\n                       (struct sockaddr_in *)REMOTE_ADDR);\r\n  else if(level == PROT_PRIVATE)\r\n    return krb_mk_priv((void*)from, *to, length, d->schedule, &d->key,\r\n                       (struct sockaddr_in *)LOCAL_ADDR,\r\n                       (struct sockaddr_in *)REMOTE_ADDR);\r\n  else\r\n    return -1;\r\n}\r\n\r\nstatic int\r\nmk_auth(struct krb4_data *d, KTEXT adat,\r\n        const char *service, char *host, int checksum)\r\n{\r\n  int ret;\r\n  CREDENTIALS cred;\r\n  char sname[SNAME_SZ], inst[INST_SZ], realm[REALM_SZ];\r\n\r\n  strlcpy(sname, service, sizeof(sname));\r\n  strlcpy(inst, krb_get_phost(host), sizeof(inst));\r\n  strlcpy(realm, krb_realmofhost(host), sizeof(realm));\r\n  ret = krb_mk_req(adat, sname, inst, realm, checksum);\r\n  if(ret)\r\n    return ret;\r\n  strlcpy(sname, service, sizeof(sname));\r\n  strlcpy(inst, krb_get_phost(host), sizeof(inst));\r\n  strlcpy(realm, krb_realmofhost(host), sizeof(realm));\r\n  ret = krb_get_cred(sname, inst, realm, &cred);\r\n  memmove(&d->key, &cred.session, sizeof(des_cblock));\r\n  des_key_sched(&d->key, d->schedule);\r\n  memset(&cred, 0, sizeof(cred));\r\n  return ret;\r\n}\r\n\r\n#ifdef HAVE_KRB_GET_OUR_IP_FOR_REALM\r\nint krb_get_our_ip_for_realm(char *, struct in_addr *);\r\n#endif\r\n\r\nstatic int\r\nkrb4_auth(void *app_data, struct connectdata *conn)\r\n{\r\n  int ret;\r\n  char *p;\r\n  unsigned char *ptr;\r\n  size_t len = 0;\r\n  KTEXT_ST adat;\r\n  MSG_DAT msg_data;\r\n  int checksum;\r\n  u_int32_t cs;\r\n  struct krb4_data *d = app_data;\r\n  char *host = conn->host.name;\r\n  ssize_t nread;\r\n  int l = sizeof(conn->local_addr);\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode result;\r\n  size_t base64_sz = 0;\r\n\r\n  if(getsockname(conn->sock[FIRSTSOCKET],\r\n                 (struct sockaddr *)LOCAL_ADDR, &l) < 0)\r\n    perror(\"getsockname()\");\r\n\r\n  checksum = getpid();\r\n  ret = mk_auth(d, &adat, \"ftp\", host, checksum);\r\n  if(ret == KDC_PR_UNKNOWN)\r\n    ret = mk_auth(d, &adat, \"rcmd\", host, checksum);\r\n  if(ret) {\r\n    infof(data, \"%s\\n\", krb_get_err_text(ret));\r\n    return AUTH_CONTINUE;\r\n  }\r\n\r\n#ifdef HAVE_KRB_GET_OUR_IP_FOR_REALM\r\n  if(krb_get_config_bool(\"nat_in_use\")) {\r\n    struct sockaddr_in *localaddr  = (struct sockaddr_in *)LOCAL_ADDR;\r\n    struct in_addr natAddr;\r\n\r\n    if(krb_get_our_ip_for_realm(krb_realmofhost(host),\r\n                                 &natAddr) != KSUCCESS\r\n        && krb_get_our_ip_for_realm(NULL, &natAddr) != KSUCCESS)\r\n      infof(data, \"Can't get address for realm %s\\n\",\r\n                 krb_realmofhost(host));\r\n    else {\r\n      if(natAddr.s_addr != localaddr->sin_addr.s_addr) {\r\n        char addr_buf[128];\r\n        if(Curl_inet_ntop(AF_INET, natAddr, addr_buf, sizeof(addr_buf)))\r\n          infof(data, \"Using NAT IP address (%s) for kerberos 4\\n\", addr_buf);\r\n        localaddr->sin_addr = natAddr;\r\n      }\r\n    }\r\n  }\r\n#endif\r\n\r\n  result = Curl_base64_encode(conn->data, (char *)adat.dat, adat.length,\r\n                              &p, &base64_sz);\r\n  if(result) {\r\n    Curl_failf(data, \"base64-encoding: %s\", curl_easy_strerror(result));\r\n    return AUTH_CONTINUE;\r\n  }\r\n\r\n  result = Curl_ftpsendf(conn, \"ADAT %s\", p);\r\n\r\n  free(p);\r\n\r\n  if(result)\r\n    return -2;\r\n\r\n  if(Curl_GetFTPResponse(&nread, conn, NULL))\r\n    return -1;\r\n\r\n  if(data->state.buffer[0] != '2') {\r\n    Curl_failf(data, \"Server didn't accept auth data\");\r\n    return AUTH_ERROR;\r\n  }\r\n\r\n  p = strstr(data->state.buffer, \"ADAT=\");\r\n  if(!p) {\r\n    Curl_failf(data, \"Remote host didn't send adat reply\");\r\n    return AUTH_ERROR;\r\n  }\r\n  p += 5;\r\n  result = Curl_base64_decode(p, &ptr, &len);\r\n  if(result) {\r\n    Curl_failf(data, \"base64-decoding: %s\", curl_easy_strerror(result));\r\n    return AUTH_ERROR;\r\n  }\r\n  if(len > sizeof(adat.dat)-1) {\r\n    free(ptr);\r\n    ptr = NULL;\r\n    len = 0;\r\n  }\r\n  if(!len || !ptr) {\r\n    Curl_failf(data, \"Failed to decode base64 from server\");\r\n    return AUTH_ERROR;\r\n  }\r\n  memcpy((char *)adat.dat, ptr, len);\r\n  free(ptr);\r\n  adat.length = len;\r\n  ret = krb_rd_safe(adat.dat, adat.length, &d->key,\r\n                    (struct sockaddr_in *)hisctladdr,\r\n                    (struct sockaddr_in *)myctladdr, &msg_data);\r\n  if(ret) {\r\n    Curl_failf(data, \"Error reading reply from server: %s\",\r\n               krb_get_err_text(ret));\r\n    return AUTH_ERROR;\r\n  }\r\n  krb_get_int(msg_data.app_data, &cs, 4, 0);\r\n  if(cs - checksum != 1) {\r\n    Curl_failf(data, \"Bad checksum returned from server\");\r\n    return AUTH_ERROR;\r\n  }\r\n  return AUTH_OK;\r\n}\r\n\r\nstruct Curl_sec_client_mech Curl_krb4_client_mech = {\r\n    \"KERBEROS_V4\",\r\n    sizeof(struct krb4_data),\r\n    NULL, /* init */\r\n    krb4_auth,\r\n    NULL, /* end */\r\n    krb4_check_prot,\r\n    krb4_overhead,\r\n    krb4_encode,\r\n    krb4_decode\r\n};\r\n\r\nstatic enum protection_level\r\nkrb4_set_command_prot(struct connectdata *conn, enum protection_level level)\r\n{\r\n  enum protection_level old = conn->command_prot;\r\n  DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);\r\n  conn->command_prot = level;\r\n  return old;\r\n}\r\n\r\nCURLcode Curl_krb_kauth(struct connectdata *conn)\r\n{\r\n  des_cblock key;\r\n  des_key_schedule schedule;\r\n  KTEXT_ST tkt, tktcopy;\r\n  char *name;\r\n  char *p;\r\n  char passwd[100];\r\n  size_t tmp = 0;\r\n  ssize_t nread;\r\n  enum protection_level save;\r\n  CURLcode result;\r\n  unsigned char *ptr;\r\n  size_t base64_sz = 0;\r\n\r\n  save = krb4_set_command_prot(conn, PROT_PRIVATE);\r\n\r\n  result = Curl_ftpsendf(conn, \"SITE KAUTH %s\", conn->user);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  result = Curl_GetFTPResponse(&nread, conn, NULL);\r\n  if(result)\r\n    return result;\r\n\r\n  if(conn->data->state.buffer[0] != '3') {\r\n    krb4_set_command_prot(conn, save);\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n\r\n  p = strstr(conn->data->state.buffer, \"T=\");\r\n  if(!p) {\r\n    Curl_failf(conn->data, \"Bad reply from server\");\r\n    krb4_set_command_prot(conn, save);\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n\r\n  p += 2;\r\n  result = Curl_base64_decode(p, &ptr, &tmp);\r\n  if(result) {\r\n    Curl_failf(conn->data, \"base64-decoding: %s\", curl_easy_strerror(result));\r\n    return result;\r\n  }\r\n  if(tmp >= sizeof(tkt.dat)) {\r\n    free(ptr);\r\n    ptr = NULL;\r\n    tmp = 0;\r\n  }\r\n  if(!tmp || !ptr) {\r\n    Curl_failf(conn->data, \"Failed to decode base64 in reply\");\r\n    krb4_set_command_prot(conn, save);\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n  memcpy((char *)tkt.dat, ptr, tmp);\r\n  free(ptr);\r\n  tkt.length = tmp;\r\n  tktcopy.length = tkt.length;\r\n\r\n  p = strstr(conn->data->state.buffer, \"P=\");\r\n  if(!p) {\r\n    Curl_failf(conn->data, \"Bad reply from server\");\r\n    krb4_set_command_prot(conn, save);\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n  name = p + 2;\r\n  for(; *p && *p != ' ' && *p != '\\r' && *p != '\\n'; p++);\r\n  *p = 0;\r\n\r\n  des_string_to_key (conn->passwd, &key);\r\n  des_key_sched(&key, schedule);\r\n\r\n  des_pcbc_encrypt((void *)tkt.dat, (void *)tktcopy.dat,\r\n                   tkt.length,\r\n                   schedule, &key, DES_DECRYPT);\r\n  if(strcmp ((char*)tktcopy.dat + 8,\r\n              KRB_TICKET_GRANTING_TICKET) != 0) {\r\n    afs_string_to_key(passwd,\r\n                      krb_realmofhost(conn->host.name),\r\n                      &key);\r\n    des_key_sched(&key, schedule);\r\n    des_pcbc_encrypt((void *)tkt.dat, (void *)tktcopy.dat,\r\n                     tkt.length,\r\n                     schedule, &key, DES_DECRYPT);\r\n  }\r\n  memset(key, 0, sizeof(key));\r\n  memset(schedule, 0, sizeof(schedule));\r\n  memset(passwd, 0, sizeof(passwd));\r\n  result = Curl_base64_encode(conn->data, (char *)tktcopy.dat, tktcopy.length,\r\n                              &p, &base64_sz);\r\n  if(result) {\r\n    Curl_failf(conn->data, \"base64-encoding: %s\", curl_easy_strerror(result));\r\n    krb4_set_command_prot(conn, save);\r\n    return result;\r\n  }\r\n  memset (tktcopy.dat, 0, tktcopy.length);\r\n\r\n  result = Curl_ftpsendf(conn, \"SITE KAUTH %s %s\", name, p);\r\n  free(p);\r\n  if(result)\r\n    return result;\r\n\r\n  result = Curl_GetFTPResponse(&nread, conn, NULL);\r\n  if(result)\r\n    return result;\r\n  krb4_set_command_prot(conn, save);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* HAVE_KRB4 */\r\n#endif /* CURL_DISABLE_FTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/krb4.h",
    "content": "#ifndef HEADER_CURL_KRB4_H\r\n#define HEADER_CURL_KRB4_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nstruct Curl_sec_client_mech {\r\n  const char *name;\r\n  size_t size;\r\n  int (*init)(void *);\r\n  int (*auth)(void *, struct connectdata *);\r\n  void (*end)(void *);\r\n  int (*check_prot)(void *, int);\r\n  int (*overhead)(void *, int, int);\r\n  int (*encode)(void *, const void*, int, int, void**, struct connectdata *);\r\n  int (*decode)(void *, void*, int, int, struct connectdata *);\r\n};\r\n\r\n\r\n#define AUTH_OK         0\r\n#define AUTH_CONTINUE   1\r\n#define AUTH_ERROR      2\r\n\r\n#ifdef HAVE_KRB4\r\nextern struct Curl_sec_client_mech Curl_krb4_client_mech;\r\n#endif\r\n#ifdef HAVE_GSSAPI\r\nextern struct Curl_sec_client_mech Curl_krb5_client_mech;\r\n#endif\r\n\r\nCURLcode Curl_krb_kauth(struct connectdata *conn);\r\nint Curl_sec_read_msg (struct connectdata *conn, char *,\r\n                       enum protection_level);\r\nvoid Curl_sec_end (struct connectdata *);\r\nCURLcode Curl_sec_login (struct connectdata *);\r\nint Curl_sec_request_prot (struct connectdata *conn, const char *level);\r\n\r\n#endif /* HEADER_CURL_KRB4_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/krb5.c",
    "content": "/* GSSAPI/krb5 support for FTP - loosely based on old krb4.c\r\n *\r\n * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan\r\n * (Royal Institute of Technology, Stockholm, Sweden).\r\n * Copyright (c) 2004 - 2012 Daniel Stenberg\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the Institute nor the names of its contributors\r\n *    may be used to endorse or promote products derived from this software\r\n *    without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.  */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n#ifdef HAVE_GSSAPI\r\n\r\n#ifdef HAVE_OLD_GSSMIT\r\n#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name\r\n#define NCOMPAT 1\r\n#endif\r\n\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"curl_base64.h\"\r\n#include \"ftp.h\"\r\n#include \"curl_gssapi.h\"\r\n#include \"sendf.h\"\r\n#include \"krb4.h\"\r\n#include \"curl_memory.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define LOCAL_ADDR (&conn->local_addr)\r\n#define REMOTE_ADDR conn->ip_addr->ai_addr\r\n\r\nstatic int\r\nkrb5_init(void *app_data)\r\n{\r\n  gss_ctx_id_t *context = app_data;\r\n  /* Make sure our context is initialized for krb5_end. */\r\n  *context = GSS_C_NO_CONTEXT;\r\n  return 0;\r\n}\r\n\r\nstatic int\r\nkrb5_check_prot(void *app_data, int level)\r\n{\r\n  (void)app_data; /* unused */\r\n  if(level == PROT_CONFIDENTIAL)\r\n    return -1;\r\n  return 0;\r\n}\r\n\r\nstatic int\r\nkrb5_decode(void *app_data, void *buf, int len,\r\n            int level UNUSED_PARAM,\r\n            struct connectdata *conn UNUSED_PARAM)\r\n{\r\n  gss_ctx_id_t *context = app_data;\r\n  OM_uint32 maj, min;\r\n  gss_buffer_desc enc, dec;\r\n\r\n  (void)level;\r\n  (void)conn;\r\n\r\n  enc.value = buf;\r\n  enc.length = len;\r\n  maj = gss_unseal(&min, *context, &enc, &dec, NULL, NULL);\r\n  if(maj != GSS_S_COMPLETE) {\r\n    if(len >= 4)\r\n      strcpy(buf, \"599 \");\r\n    return -1;\r\n  }\r\n\r\n  memcpy(buf, dec.value, dec.length);\r\n  len = curlx_uztosi(dec.length);\r\n  gss_release_buffer(&min, &dec);\r\n\r\n  return len;\r\n}\r\n\r\nstatic int\r\nkrb5_overhead(void *app_data, int level, int len)\r\n{\r\n  /* no arguments are used */\r\n  (void)app_data;\r\n  (void)level;\r\n  (void)len;\r\n  return 0;\r\n}\r\n\r\nstatic int\r\nkrb5_encode(void *app_data, const void *from, int length, int level, void **to,\r\n            struct connectdata *conn UNUSED_PARAM)\r\n{\r\n  gss_ctx_id_t *context = app_data;\r\n  gss_buffer_desc dec, enc;\r\n  OM_uint32 maj, min;\r\n  int state;\r\n  int len;\r\n\r\n  /* shut gcc up */\r\n  conn = NULL;\r\n\r\n  /* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal\r\n   * libraries modify the input buffer in gss_seal()\r\n   */\r\n  dec.value = (void*)from;\r\n  dec.length = length;\r\n  maj = gss_seal(&min, *context,\r\n                 level == PROT_PRIVATE,\r\n                 GSS_C_QOP_DEFAULT,\r\n                 &dec, &state, &enc);\r\n\r\n  if(maj != GSS_S_COMPLETE)\r\n    return -1;\r\n\r\n  /* malloc a new buffer, in case gss_release_buffer doesn't work as\r\n     expected */\r\n  *to = malloc(enc.length);\r\n  if(!*to)\r\n    return -1;\r\n  memcpy(*to, enc.value, enc.length);\r\n  len = curlx_uztosi(enc.length);\r\n  gss_release_buffer(&min, &enc);\r\n  return len;\r\n}\r\n\r\nstatic int\r\nkrb5_auth(void *app_data, struct connectdata *conn)\r\n{\r\n  int ret = AUTH_OK;\r\n  char *p;\r\n  const char *host = conn->host.name;\r\n  ssize_t nread;\r\n  curl_socklen_t l = sizeof(conn->local_addr);\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode result;\r\n  const char *service = \"ftp\", *srv_host = \"host\";\r\n  gss_buffer_desc input_buffer, output_buffer, _gssresp, *gssresp;\r\n  OM_uint32 maj, min;\r\n  gss_name_t gssname;\r\n  gss_ctx_id_t *context = app_data;\r\n  struct gss_channel_bindings_struct chan;\r\n  size_t base64_sz = 0;\r\n\r\n  if(getsockname(conn->sock[FIRSTSOCKET],\r\n                 (struct sockaddr *)LOCAL_ADDR, &l) < 0)\r\n    perror(\"getsockname()\");\r\n\r\n  chan.initiator_addrtype = GSS_C_AF_INET;\r\n  chan.initiator_address.length = l - 4;\r\n  chan.initiator_address.value =\r\n    &((struct sockaddr_in *)LOCAL_ADDR)->sin_addr.s_addr;\r\n  chan.acceptor_addrtype = GSS_C_AF_INET;\r\n  chan.acceptor_address.length = l - 4;\r\n  chan.acceptor_address.value =\r\n    &((struct sockaddr_in *)REMOTE_ADDR)->sin_addr.s_addr;\r\n  chan.application_data.length = 0;\r\n  chan.application_data.value = NULL;\r\n\r\n  /* this loop will execute twice (once for service, once for host) */\r\n  for(;;) {\r\n    /* this really shouldn't be repeated here, but can't help it */\r\n    if(service == srv_host) {\r\n      result = Curl_ftpsendf(conn, \"AUTH GSSAPI\");\r\n\r\n      if(result)\r\n        return -2;\r\n      if(Curl_GetFTPResponse(&nread, conn, NULL))\r\n        return -1;\r\n\r\n      if(data->state.buffer[0] != '3')\r\n        return -1;\r\n    }\r\n\r\n    input_buffer.value = data->state.buffer;\r\n    input_buffer.length = snprintf(input_buffer.value, BUFSIZE, \"%s@%s\",\r\n                                   service, host);\r\n    maj = gss_import_name(&min, &input_buffer, GSS_C_NT_HOSTBASED_SERVICE,\r\n                          &gssname);\r\n    if(maj != GSS_S_COMPLETE) {\r\n      gss_release_name(&min, &gssname);\r\n      if(service == srv_host) {\r\n        Curl_failf(data, \"Error importing service name %s\",\r\n                   input_buffer.value);\r\n        return AUTH_ERROR;\r\n      }\r\n      service = srv_host;\r\n      continue;\r\n    }\r\n    /* We pass NULL as |output_name_type| to avoid a leak. */\r\n    gss_display_name(&min, gssname, &output_buffer, NULL);\r\n    Curl_infof(data, \"Trying against %s\\n\", output_buffer.value);\r\n    gssresp = GSS_C_NO_BUFFER;\r\n    *context = GSS_C_NO_CONTEXT;\r\n\r\n    do {\r\n      /* Release the buffer at each iteration to avoid leaking: the first time\r\n         we are releasing the memory from gss_display_name. The last item is\r\n         taken care by a final gss_release_buffer. */\r\n      gss_release_buffer(&min, &output_buffer);\r\n      ret = AUTH_OK;\r\n      maj = Curl_gss_init_sec_context(data,\r\n                                      &min,\r\n                                      context,\r\n                                      gssname,\r\n                                      &chan,\r\n                                      gssresp,\r\n                                      &output_buffer,\r\n                                      NULL);\r\n\r\n      if(gssresp) {\r\n        free(_gssresp.value);\r\n        gssresp = NULL;\r\n      }\r\n\r\n      if(GSS_ERROR(maj)) {\r\n        Curl_infof(data, \"Error creating security context\\n\");\r\n        ret = AUTH_ERROR;\r\n        break;\r\n      }\r\n\r\n      if(output_buffer.length != 0) {\r\n        result = Curl_base64_encode(data, (char *)output_buffer.value,\r\n                                    output_buffer.length, &p, &base64_sz);\r\n        if(result) {\r\n          Curl_infof(data,\"base64-encoding: %s\\n\", curl_easy_strerror(result));\r\n          ret = AUTH_CONTINUE;\r\n          break;\r\n        }\r\n\r\n        result = Curl_ftpsendf(conn, \"ADAT %s\", p);\r\n\r\n        free(p);\r\n\r\n        if(result) {\r\n          ret = -2;\r\n          break;\r\n        }\r\n\r\n        if(Curl_GetFTPResponse(&nread, conn, NULL)) {\r\n          ret = -1;\r\n          break;\r\n        }\r\n\r\n        if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3') {\r\n          Curl_infof(data, \"Server didn't accept auth data\\n\");\r\n          ret = AUTH_ERROR;\r\n          break;\r\n        }\r\n\r\n        p = data->state.buffer + 4;\r\n        p = strstr(p, \"ADAT=\");\r\n        if(p) {\r\n          result = Curl_base64_decode(p + 5,\r\n                                      (unsigned char **)&_gssresp.value,\r\n                                      &_gssresp.length);\r\n          if(result) {\r\n            Curl_failf(data,\"base64-decoding: %s\", curl_easy_strerror(result));\r\n            ret = AUTH_CONTINUE;\r\n            break;\r\n          }\r\n        }\r\n\r\n        gssresp = &_gssresp;\r\n      }\r\n    } while(maj == GSS_S_CONTINUE_NEEDED);\r\n\r\n    gss_release_name(&min, &gssname);\r\n    gss_release_buffer(&min, &output_buffer);\r\n\r\n    if(gssresp)\r\n      free(_gssresp.value);\r\n\r\n    if(ret == AUTH_OK || service == srv_host)\r\n      return ret;\r\n\r\n    service = srv_host;\r\n  }\r\n  return ret;\r\n}\r\n\r\nstatic void krb5_end(void *app_data)\r\n{\r\n    OM_uint32 min;\r\n    gss_ctx_id_t *context = app_data;\r\n    if(*context != GSS_C_NO_CONTEXT) {\r\n#ifdef DEBUGBUILD\r\n      OM_uint32 maj =\r\n#endif\r\n      gss_delete_sec_context(&min, context, GSS_C_NO_BUFFER);\r\n      DEBUGASSERT(maj == GSS_S_COMPLETE);\r\n    }\r\n}\r\n\r\nstruct Curl_sec_client_mech Curl_krb5_client_mech = {\r\n    \"GSSAPI\",\r\n    sizeof(gss_ctx_id_t),\r\n    krb5_init,\r\n    krb5_auth,\r\n    krb5_end,\r\n    krb5_check_prot,\r\n    krb5_overhead,\r\n    krb5_encode,\r\n    krb5_decode\r\n};\r\n\r\n#endif /* HAVE_GSSAPI */\r\n#endif /* CURL_DISABLE_FTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ldap.c",
    "content": "/***************************************************************************\r\n *                      _   _ ____  _\r\n *  Project         ___| | | |  _ \\| |\r\n *                 / __| | | | |_) | |\r\n *                | (__| |_| |  _ <| |___\r\n *                 \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP)\r\n\r\n/*\r\n * Notice that USE_OPENLDAP is only a source code selection switch. When\r\n * libcurl is built with USE_OPENLDAP defined the libcurl source code that\r\n * gets compiled is the code from openldap.c, otherwise the code that gets\r\n * compiled is the code from ldap.c.\r\n *\r\n * When USE_OPENLDAP is defined a recent version of the OpenLDAP library\r\n * might be required for compilation and runtime. In order to use ancient\r\n * OpenLDAP library versions, USE_OPENLDAP shall not be defined.\r\n */\r\n\r\n#ifdef CURL_LDAP_WIN            /* Use Windows LDAP implementation. */\r\n# include <winldap.h>\r\n# ifndef LDAP_VENDOR_NAME\r\n#  error Your Platform SDK is NOT sufficient for LDAP support! \\\r\n         Update your Platform SDK, or disable LDAP support!\r\n# else\r\n#  include <winber.h>\r\n# endif\r\n#else\r\n# define LDAP_DEPRECATED 1      /* Be sure ldap_init() is defined. */\r\n# ifdef HAVE_LBER_H\r\n#  include <lber.h>\r\n# endif\r\n# include <ldap.h>\r\n# if (defined(HAVE_LDAP_SSL) && defined(HAVE_LDAP_SSL_H))\r\n#  include <ldap_ssl.h>\r\n# endif /* HAVE_LDAP_SSL && HAVE_LDAP_SSL_H */\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"sendf.h\"\r\n#include \"escape.h\"\r\n#include \"progress.h\"\r\n#include \"transfer.h\"\r\n#include \"strequal.h\"\r\n#include \"strtok.h\"\r\n#include \"curl_ldap.h\"\r\n#include \"curl_memory.h\"\r\n#include \"curl_base64.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"memdebug.h\"\r\n\r\n#ifndef HAVE_LDAP_URL_PARSE\r\n\r\n/* Use our own implementation. */\r\n\r\ntypedef struct {\r\n    char   *lud_host;\r\n    int     lud_port;\r\n    char   *lud_dn;\r\n    char  **lud_attrs;\r\n    int     lud_scope;\r\n    char   *lud_filter;\r\n    char  **lud_exts;\r\n} CURL_LDAPURLDesc;\r\n\r\n#undef LDAPURLDesc\r\n#define LDAPURLDesc             CURL_LDAPURLDesc\r\n\r\nstatic int  _ldap_url_parse (const struct connectdata *conn,\r\n                             LDAPURLDesc **ludp);\r\nstatic void _ldap_free_urldesc (LDAPURLDesc *ludp);\r\n\r\n#undef ldap_free_urldesc\r\n#define ldap_free_urldesc       _ldap_free_urldesc\r\n#endif\r\n\r\n#ifdef DEBUG_LDAP\r\n  #define LDAP_TRACE(x)   do { \\\r\n                            _ldap_trace (\"%u: \", __LINE__); \\\r\n                            _ldap_trace x; \\\r\n                          } WHILE_FALSE\r\n\r\n  static void _ldap_trace (const char *fmt, ...);\r\n#else\r\n  #define LDAP_TRACE(x)   Curl_nop_stmt\r\n#endif\r\n\r\n\r\nstatic CURLcode Curl_ldap(struct connectdata *conn, bool *done);\r\n\r\n/*\r\n * LDAP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_ldap = {\r\n  \"LDAP\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_ldap,                            /* do_it */\r\n  ZERO_NULL,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_LDAP,                            /* defport */\r\n  CURLPROTO_LDAP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n#ifdef HAVE_LDAP_SSL\r\n/*\r\n * LDAPS protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_ldaps = {\r\n  \"LDAPS\",                              /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_ldap,                            /* do_it */\r\n  ZERO_NULL,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_LDAPS,                           /* defport */\r\n  CURLPROTO_LDAP | CURLPROTO_LDAPS,     /* protocol */\r\n  PROTOPT_SSL                           /* flags */\r\n};\r\n#endif\r\n\r\n\r\nstatic CURLcode Curl_ldap(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode status = CURLE_OK;\r\n  int rc = 0;\r\n  LDAP *server = NULL;\r\n  LDAPURLDesc *ludp = NULL;\r\n  LDAPMessage *result = NULL;\r\n  LDAPMessage *entryIterator;\r\n  int num = 0;\r\n  struct SessionHandle *data=conn->data;\r\n  int ldap_proto = LDAP_VERSION3;\r\n  int ldap_ssl = 0;\r\n  char *val_b64 = NULL;\r\n  size_t val_b64_sz = 0;\r\n  curl_off_t dlsize = 0;\r\n#ifdef LDAP_OPT_NETWORK_TIMEOUT\r\n  struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */\r\n#endif\r\n\r\n  *done = TRUE; /* unconditionally */\r\n  infof(data, \"LDAP local: LDAP Vendor = %s ; LDAP Version = %d\\n\",\r\n          LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION);\r\n  infof(data, \"LDAP local: %s\\n\", data->change.url);\r\n\r\n#ifdef HAVE_LDAP_URL_PARSE\r\n  rc = ldap_url_parse(data->change.url, &ludp);\r\n#else\r\n  rc = _ldap_url_parse(conn, &ludp);\r\n#endif\r\n  if(rc != 0) {\r\n    failf(data, \"LDAP local: %s\", ldap_err2string(rc));\r\n    status = CURLE_LDAP_INVALID_URL;\r\n    goto quit;\r\n  }\r\n\r\n  /* Get the URL scheme ( either ldap or ldaps ) */\r\n  if(conn->given->flags & PROTOPT_SSL)\r\n    ldap_ssl = 1;\r\n  infof(data, \"LDAP local: trying to establish %s connection\\n\",\r\n          ldap_ssl ? \"encrypted\" : \"cleartext\");\r\n\r\n#ifdef LDAP_OPT_NETWORK_TIMEOUT\r\n  ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &ldap_timeout);\r\n#endif\r\n  ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);\r\n\r\n  if(ldap_ssl) {\r\n#ifdef HAVE_LDAP_SSL\r\n#ifdef CURL_LDAP_WIN\r\n    /* Win32 LDAP SDK doesn't support insecure mode without CA! */\r\n    server = ldap_sslinit(conn->host.name, (int)conn->port, 1);\r\n    ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON);\r\n#else\r\n    int ldap_option;\r\n    char* ldap_ca = data->set.str[STRING_SSL_CAFILE];\r\n#if defined(CURL_HAS_NOVELL_LDAPSDK)\r\n    rc = ldapssl_client_init(NULL, NULL);\r\n    if(rc != LDAP_SUCCESS) {\r\n      failf(data, \"LDAP local: ldapssl_client_init %s\", ldap_err2string(rc));\r\n      status = CURLE_SSL_CERTPROBLEM;\r\n      goto quit;\r\n    }\r\n    if(data->set.ssl.verifypeer) {\r\n      /* Novell SDK supports DER or BASE64 files. */\r\n      int cert_type = LDAPSSL_CERT_FILETYPE_B64;\r\n      if((data->set.str[STRING_CERT_TYPE]) &&\r\n         (Curl_raw_equal(data->set.str[STRING_CERT_TYPE], \"DER\")))\r\n        cert_type = LDAPSSL_CERT_FILETYPE_DER;\r\n      if(!ldap_ca) {\r\n        failf(data, \"LDAP local: ERROR %s CA cert not set!\",\r\n              (cert_type == LDAPSSL_CERT_FILETYPE_DER ? \"DER\" : \"PEM\"));\r\n        status = CURLE_SSL_CERTPROBLEM;\r\n        goto quit;\r\n      }\r\n      infof(data, \"LDAP local: using %s CA cert '%s'\\n\",\r\n              (cert_type == LDAPSSL_CERT_FILETYPE_DER ? \"DER\" : \"PEM\"),\r\n              ldap_ca);\r\n      rc = ldapssl_add_trusted_cert(ldap_ca, cert_type);\r\n      if(rc != LDAP_SUCCESS) {\r\n        failf(data, \"LDAP local: ERROR setting %s CA cert: %s\",\r\n                (cert_type == LDAPSSL_CERT_FILETYPE_DER ? \"DER\" : \"PEM\"),\r\n                ldap_err2string(rc));\r\n        status = CURLE_SSL_CERTPROBLEM;\r\n        goto quit;\r\n      }\r\n      ldap_option = LDAPSSL_VERIFY_SERVER;\r\n    }\r\n    else\r\n      ldap_option = LDAPSSL_VERIFY_NONE;\r\n    rc = ldapssl_set_verify_mode(ldap_option);\r\n    if(rc != LDAP_SUCCESS) {\r\n      failf(data, \"LDAP local: ERROR setting cert verify mode: %s\",\r\n              ldap_err2string(rc));\r\n      status = CURLE_SSL_CERTPROBLEM;\r\n      goto quit;\r\n    }\r\n    server = ldapssl_init(conn->host.name, (int)conn->port, 1);\r\n    if(server == NULL) {\r\n      failf(data, \"LDAP local: Cannot connect to %s:%hu\",\r\n              conn->host.name, conn->port);\r\n      status = CURLE_COULDNT_CONNECT;\r\n      goto quit;\r\n    }\r\n#elif defined(LDAP_OPT_X_TLS)\r\n    if(data->set.ssl.verifypeer) {\r\n      /* OpenLDAP SDK supports BASE64 files. */\r\n      if((data->set.str[STRING_CERT_TYPE]) &&\r\n         (!Curl_raw_equal(data->set.str[STRING_CERT_TYPE], \"PEM\"))) {\r\n        failf(data, \"LDAP local: ERROR OpenLDAP only supports PEM cert-type!\");\r\n        status = CURLE_SSL_CERTPROBLEM;\r\n        goto quit;\r\n      }\r\n      if(!ldap_ca) {\r\n        failf(data, \"LDAP local: ERROR PEM CA cert not set!\");\r\n        status = CURLE_SSL_CERTPROBLEM;\r\n        goto quit;\r\n      }\r\n      infof(data, \"LDAP local: using PEM CA cert: %s\\n\", ldap_ca);\r\n      rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca);\r\n      if(rc != LDAP_SUCCESS) {\r\n        failf(data, \"LDAP local: ERROR setting PEM CA cert: %s\",\r\n                ldap_err2string(rc));\r\n        status = CURLE_SSL_CERTPROBLEM;\r\n        goto quit;\r\n      }\r\n      ldap_option = LDAP_OPT_X_TLS_DEMAND;\r\n    }\r\n    else\r\n      ldap_option = LDAP_OPT_X_TLS_NEVER;\r\n\r\n    rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option);\r\n    if(rc != LDAP_SUCCESS) {\r\n      failf(data, \"LDAP local: ERROR setting cert verify mode: %s\",\r\n              ldap_err2string(rc));\r\n      status = CURLE_SSL_CERTPROBLEM;\r\n      goto quit;\r\n    }\r\n    server = ldap_init(conn->host.name, (int)conn->port);\r\n    if(server == NULL) {\r\n      failf(data, \"LDAP local: Cannot connect to %s:%hu\",\r\n              conn->host.name, conn->port);\r\n      status = CURLE_COULDNT_CONNECT;\r\n      goto quit;\r\n    }\r\n    ldap_option = LDAP_OPT_X_TLS_HARD;\r\n    rc = ldap_set_option(server, LDAP_OPT_X_TLS, &ldap_option);\r\n    if(rc != LDAP_SUCCESS) {\r\n      failf(data, \"LDAP local: ERROR setting SSL/TLS mode: %s\",\r\n              ldap_err2string(rc));\r\n      status = CURLE_SSL_CERTPROBLEM;\r\n      goto quit;\r\n    }\r\n/*\r\n    rc = ldap_start_tls_s(server, NULL, NULL);\r\n    if(rc != LDAP_SUCCESS) {\r\n      failf(data, \"LDAP local: ERROR starting SSL/TLS mode: %s\",\r\n              ldap_err2string(rc));\r\n      status = CURLE_SSL_CERTPROBLEM;\r\n      goto quit;\r\n    }\r\n*/\r\n#else\r\n    /* we should probably never come up to here since configure\r\n       should check in first place if we can support LDAP SSL/TLS */\r\n    failf(data, \"LDAP local: SSL/TLS not supported with this version \"\r\n            \"of the OpenLDAP toolkit\\n\");\r\n    status = CURLE_SSL_CERTPROBLEM;\r\n    goto quit;\r\n#endif\r\n#endif\r\n#endif /* CURL_LDAP_USE_SSL */\r\n  }\r\n  else {\r\n    server = ldap_init(conn->host.name, (int)conn->port);\r\n    if(server == NULL) {\r\n      failf(data, \"LDAP local: Cannot connect to %s:%hu\",\r\n              conn->host.name, conn->port);\r\n      status = CURLE_COULDNT_CONNECT;\r\n      goto quit;\r\n    }\r\n  }\r\n#ifdef CURL_LDAP_WIN\r\n  ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);\r\n#endif\r\n\r\n  rc = ldap_simple_bind_s(server,\r\n                          conn->bits.user_passwd ? conn->user : NULL,\r\n                          conn->bits.user_passwd ? conn->passwd : NULL);\r\n  if(!ldap_ssl && rc != 0) {\r\n    ldap_proto = LDAP_VERSION2;\r\n    ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);\r\n    rc = ldap_simple_bind_s(server,\r\n                            conn->bits.user_passwd ? conn->user : NULL,\r\n                            conn->bits.user_passwd ? conn->passwd : NULL);\r\n  }\r\n  if(rc != 0) {\r\n    failf(data, \"LDAP local: ldap_simple_bind_s %s\", ldap_err2string(rc));\r\n    status = CURLE_LDAP_CANNOT_BIND;\r\n    goto quit;\r\n  }\r\n\r\n  rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,\r\n                     ludp->lud_filter, ludp->lud_attrs, 0, &result);\r\n\r\n  if(rc != 0 && rc != LDAP_SIZELIMIT_EXCEEDED) {\r\n    failf(data, \"LDAP remote: %s\", ldap_err2string(rc));\r\n    status = CURLE_LDAP_SEARCH_FAILED;\r\n    goto quit;\r\n  }\r\n\r\n  for(num = 0, entryIterator = ldap_first_entry(server, result);\r\n      entryIterator;\r\n      entryIterator = ldap_next_entry(server, entryIterator), num++) {\r\n    BerElement *ber = NULL;\r\n    char  *attribute;       /*! suspicious that this isn't 'const' */\r\n    char  *dn = ldap_get_dn(server, entryIterator);\r\n    int i;\r\n\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"DN: \", 4);\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)dn, 0);\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 1);\r\n\r\n    dlsize += strlen(dn)+5;\r\n\r\n    for(attribute = ldap_first_attribute(server, entryIterator, &ber);\r\n        attribute;\r\n        attribute = ldap_next_attribute(server, entryIterator, ber)) {\r\n      BerValue **vals = ldap_get_values_len(server, entryIterator, attribute);\r\n\r\n      if(vals != NULL) {\r\n        for(i = 0; (vals[i] != NULL); i++) {\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\t\", 1);\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, (char *) attribute, 0);\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\": \", 2);\r\n          dlsize += strlen(attribute)+3;\r\n\r\n          if((strlen(attribute) > 7) &&\r\n              (strcmp(\";binary\",\r\n                      (char *)attribute +\r\n                      (strlen((char *)attribute) - 7)) == 0)) {\r\n            /* Binary attribute, encode to base64. */\r\n            CURLcode error = Curl_base64_encode(data,\r\n                                                vals[i]->bv_val,\r\n                                                vals[i]->bv_len,\r\n                                                &val_b64,\r\n                                                &val_b64_sz);\r\n            if(error) {\r\n              ldap_value_free_len(vals);\r\n              ldap_memfree(attribute);\r\n              ldap_memfree(dn);\r\n              if(ber)\r\n                ber_free(ber, 0);\r\n              status = error;\r\n              goto quit;\r\n            }\r\n            if(val_b64_sz > 0) {\r\n              Curl_client_write(conn, CLIENTWRITE_BODY, val_b64, val_b64_sz);\r\n              free(val_b64);\r\n              dlsize += val_b64_sz;\r\n            }\r\n          }\r\n          else {\r\n            Curl_client_write(conn, CLIENTWRITE_BODY, vals[i]->bv_val,\r\n                              vals[i]->bv_len);\r\n            dlsize += vals[i]->bv_len;\r\n          }\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 0);\r\n          dlsize++;\r\n        }\r\n\r\n        /* Free memory used to store values */\r\n        ldap_value_free_len(vals);\r\n      }\r\n      Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 1);\r\n      dlsize++;\r\n      Curl_pgrsSetDownloadCounter(data, dlsize);\r\n      ldap_memfree(attribute);\r\n    }\r\n    ldap_memfree(dn);\r\n    if(ber)\r\n       ber_free(ber, 0);\r\n  }\r\n\r\nquit:\r\n  if(result) {\r\n    ldap_msgfree(result);\r\n    LDAP_TRACE ((\"Received %d entries\\n\", num));\r\n  }\r\n  if(rc == LDAP_SIZELIMIT_EXCEEDED)\r\n    infof(data, \"There are more than %d entries\\n\", num);\r\n  if(ludp)\r\n    ldap_free_urldesc(ludp);\r\n  if(server)\r\n    ldap_unbind_s(server);\r\n#if defined(HAVE_LDAP_SSL) && defined(CURL_HAS_NOVELL_LDAPSDK)\r\n  if(ldap_ssl)\r\n    ldapssl_client_deinit();\r\n#endif /* HAVE_LDAP_SSL && CURL_HAS_NOVELL_LDAPSDK */\r\n\r\n  /* no data to transfer */\r\n  Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n  conn->bits.close = TRUE;\r\n\r\n  return status;\r\n}\r\n\r\n#ifdef DEBUG_LDAP\r\nstatic void _ldap_trace (const char *fmt, ...)\r\n{\r\n  static int do_trace = -1;\r\n  va_list args;\r\n\r\n  if(do_trace == -1) {\r\n    const char *env = getenv(\"CURL_TRACE\");\r\n    do_trace = (env && strtol(env, NULL, 10) > 0);\r\n  }\r\n  if(!do_trace)\r\n    return;\r\n\r\n  va_start (args, fmt);\r\n  vfprintf (stderr, fmt, args);\r\n  va_end (args);\r\n}\r\n#endif\r\n\r\n#ifndef HAVE_LDAP_URL_PARSE\r\n\r\n/*\r\n * Return scope-value for a scope-string.\r\n */\r\nstatic int str2scope (const char *p)\r\n{\r\n  if(strequal(p, \"one\"))\r\n     return LDAP_SCOPE_ONELEVEL;\r\n  if(strequal(p, \"onetree\"))\r\n     return LDAP_SCOPE_ONELEVEL;\r\n  if(strequal(p, \"base\"))\r\n     return LDAP_SCOPE_BASE;\r\n  if(strequal(p, \"sub\"))\r\n     return LDAP_SCOPE_SUBTREE;\r\n  if(strequal( p, \"subtree\"))\r\n     return LDAP_SCOPE_SUBTREE;\r\n  return (-1);\r\n}\r\n\r\n/*\r\n * Split 'str' into strings separated by commas.\r\n * Note: res[] points into 'str'.\r\n */\r\nstatic char **split_str (char *str)\r\n{\r\n  char **res, *lasts, *s;\r\n  int  i;\r\n\r\n  for(i = 2, s = strchr(str,','); s; i++)\r\n    s = strchr(++s,',');\r\n\r\n  res = calloc(i, sizeof(char*));\r\n  if(!res)\r\n    return NULL;\r\n\r\n  for(i = 0, s = strtok_r(str, \",\", &lasts); s;\r\n      s = strtok_r(NULL, \",\", &lasts), i++)\r\n    res[i] = s;\r\n  return res;\r\n}\r\n\r\n/*\r\n * Unescape the LDAP-URL components\r\n */\r\nstatic bool unescape_elements (void *data, LDAPURLDesc *ludp)\r\n{\r\n  int i;\r\n\r\n  if(ludp->lud_filter) {\r\n    ludp->lud_filter = curl_easy_unescape(data, ludp->lud_filter, 0, NULL);\r\n    if(!ludp->lud_filter)\r\n       return (FALSE);\r\n  }\r\n\r\n  for(i = 0; ludp->lud_attrs && ludp->lud_attrs[i]; i++) {\r\n    ludp->lud_attrs[i] = curl_easy_unescape(data, ludp->lud_attrs[i], 0, NULL);\r\n    if(!ludp->lud_attrs[i])\r\n      return (FALSE);\r\n  }\r\n\r\n  for(i = 0; ludp->lud_exts && ludp->lud_exts[i]; i++) {\r\n    ludp->lud_exts[i] = curl_easy_unescape(data, ludp->lud_exts[i], 0, NULL);\r\n    if(!ludp->lud_exts[i])\r\n      return (FALSE);\r\n  }\r\n\r\n  if(ludp->lud_dn) {\r\n    char *dn = ludp->lud_dn;\r\n    char *new_dn = curl_easy_unescape(data, dn, 0, NULL);\r\n\r\n    free(dn);\r\n    ludp->lud_dn = new_dn;\r\n    if(!new_dn)\r\n       return (FALSE);\r\n  }\r\n  return (TRUE);\r\n}\r\n\r\n/*\r\n * Break apart the pieces of an LDAP URL.\r\n * Syntax:\r\n *   ldap://<hostname>:<port>/<base_dn>?<attributes>?<scope>?<filter>?<ext>\r\n *\r\n * <hostname> already known from 'conn->host.name'.\r\n * <port>     already known from 'conn->remote_port'.\r\n * extract the rest from 'conn->data->state.path+1'. All fields are optional.\r\n * e.g.\r\n *   ldap://<hostname>:<port>/?<attributes>?<scope>?<filter>\r\n * yields ludp->lud_dn = \"\".\r\n *\r\n * Defined in RFC4516 section 2.\r\n */\r\nstatic int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)\r\n{\r\n  char *p, *q;\r\n  int i;\r\n\r\n  if(!conn->data ||\r\n      !conn->data->state.path ||\r\n      conn->data->state.path[0] != '/' ||\r\n      !checkprefix(\"LDAP\", conn->data->change.url))\r\n    return LDAP_INVALID_SYNTAX;\r\n\r\n  ludp->lud_scope = LDAP_SCOPE_BASE;\r\n  ludp->lud_port  = conn->remote_port;\r\n  ludp->lud_host  = conn->host.name;\r\n\r\n  /* parse DN (Distinguished Name).\r\n   */\r\n  ludp->lud_dn = strdup(conn->data->state.path+1);\r\n  if(!ludp->lud_dn)\r\n    return LDAP_NO_MEMORY;\r\n\r\n  p = strchr(ludp->lud_dn, '?');\r\n  LDAP_TRACE ((\"DN '%.*s'\\n\", p ? (size_t)(p-ludp->lud_dn) :\r\n               strlen(ludp->lud_dn), ludp->lud_dn));\r\n\r\n  if(!p)\r\n    goto success;\r\n\r\n  *p++ = '\\0';\r\n\r\n  /* parse attributes. skip \"??\".\r\n   */\r\n  q = strchr(p, '?');\r\n  if(q)\r\n    *q++ = '\\0';\r\n\r\n  if(*p && *p != '?') {\r\n    ludp->lud_attrs = split_str(p);\r\n    if(!ludp->lud_attrs)\r\n      return LDAP_NO_MEMORY;\r\n\r\n    for(i = 0; ludp->lud_attrs[i]; i++)\r\n      LDAP_TRACE ((\"attr[%d] '%s'\\n\", i, ludp->lud_attrs[i]));\r\n  }\r\n\r\n  p = q;\r\n  if(!p)\r\n    goto success;\r\n\r\n  /* parse scope. skip \"??\"\r\n   */\r\n  q = strchr(p, '?');\r\n  if(q)\r\n    *q++ = '\\0';\r\n\r\n  if(*p && *p != '?') {\r\n    ludp->lud_scope = str2scope(p);\r\n    if(ludp->lud_scope == -1)\r\n      return LDAP_INVALID_SYNTAX;\r\n    LDAP_TRACE ((\"scope %d\\n\", ludp->lud_scope));\r\n  }\r\n\r\n  p = q;\r\n  if(!p)\r\n    goto success;\r\n\r\n  /* parse filter\r\n   */\r\n  q = strchr(p, '?');\r\n  if(q)\r\n    *q++ = '\\0';\r\n  if(!*p)\r\n    return LDAP_INVALID_SYNTAX;\r\n\r\n  ludp->lud_filter = p;\r\n  LDAP_TRACE ((\"filter '%s'\\n\", ludp->lud_filter));\r\n\r\n  p = q;\r\n  if(!p)\r\n    goto success;\r\n\r\n  /* parse extensions\r\n   */\r\n  ludp->lud_exts = split_str(p);\r\n  if(!ludp->lud_exts)\r\n    return LDAP_NO_MEMORY;\r\n\r\n  for(i = 0; ludp->lud_exts[i]; i++)\r\n    LDAP_TRACE ((\"exts[%d] '%s'\\n\", i, ludp->lud_exts[i]));\r\n\r\n  success:\r\n  if(!unescape_elements(conn->data, ludp))\r\n    return LDAP_NO_MEMORY;\r\n  return LDAP_SUCCESS;\r\n}\r\n\r\nstatic int _ldap_url_parse (const struct connectdata *conn,\r\n                            LDAPURLDesc **ludpp)\r\n{\r\n  LDAPURLDesc *ludp = calloc(1, sizeof(*ludp));\r\n  int rc;\r\n\r\n  *ludpp = NULL;\r\n  if(!ludp)\r\n     return LDAP_NO_MEMORY;\r\n\r\n  rc = _ldap_url_parse2 (conn, ludp);\r\n  if(rc != LDAP_SUCCESS) {\r\n    _ldap_free_urldesc(ludp);\r\n    ludp = NULL;\r\n  }\r\n  *ludpp = ludp;\r\n  return (rc);\r\n}\r\n\r\nstatic void _ldap_free_urldesc (LDAPURLDesc *ludp)\r\n{\r\n  int i;\r\n\r\n  if(!ludp)\r\n    return;\r\n\r\n  if(ludp->lud_dn)\r\n    free(ludp->lud_dn);\r\n\r\n  if(ludp->lud_filter)\r\n    free(ludp->lud_filter);\r\n\r\n  if(ludp->lud_attrs) {\r\n    for(i = 0; ludp->lud_attrs[i]; i++)\r\n      free(ludp->lud_attrs[i]);\r\n    free(ludp->lud_attrs);\r\n  }\r\n\r\n  if(ludp->lud_exts) {\r\n    for(i = 0; ludp->lud_exts[i]; i++)\r\n      free(ludp->lud_exts[i]);\r\n    free(ludp->lud_exts);\r\n  }\r\n  free (ludp);\r\n}\r\n#endif  /* !HAVE_LDAP_URL_PARSE */\r\n#endif  /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/libcurl.vers.in",
    "content": "HIDDEN\r\n{\r\n  local:\r\n    __*;\r\n    _rest*;\r\n    _save*;\r\n};\r\n\r\nCURL_@VERSIONED_FLAVOUR@4\r\n{\r\n  global: curl_*;\r\n  local: *;\r\n};\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/llist.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"llist.h\"\r\n#include \"curl_memory.h\"\r\n\r\n/* this must be the last include file */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * @unittest: 1300\r\n */\r\nstatic void\r\nllist_init(struct curl_llist *l, curl_llist_dtor dtor)\r\n{\r\n  l->size = 0;\r\n  l->dtor = dtor;\r\n  l->head = NULL;\r\n  l->tail = NULL;\r\n}\r\n\r\nstruct curl_llist *\r\nCurl_llist_alloc(curl_llist_dtor dtor)\r\n{\r\n  struct curl_llist *list;\r\n\r\n  list = malloc(sizeof(struct curl_llist));\r\n  if(!list)\r\n    return NULL;\r\n\r\n  llist_init(list, dtor);\r\n\r\n  return list;\r\n}\r\n\r\n/*\r\n * Curl_llist_insert_next()\r\n *\r\n * Inserts a new list element after the given one 'e'. If the given existing\r\n * entry is NULL and the list already has elements, the new one will be\r\n * inserted first in the list.\r\n *\r\n * Returns: 1 on success and 0 on failure.\r\n *\r\n * @unittest: 1300\r\n */\r\nint\r\nCurl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,\r\n                       const void *p)\r\n{\r\n  struct curl_llist_element *ne = malloc(sizeof(struct curl_llist_element));\r\n  if(!ne)\r\n    return 0;\r\n\r\n  ne->ptr = (void *) p;\r\n  if(list->size == 0) {\r\n    list->head = ne;\r\n    list->head->prev = NULL;\r\n    list->head->next = NULL;\r\n    list->tail = ne;\r\n  }\r\n  else {\r\n    /* if 'e' is NULL here, we insert the new element first in the list */\r\n    ne->next = e?e->next:list->head;\r\n    ne->prev = e;\r\n    if(!e) {\r\n      list->head->prev = ne;\r\n      list->head = ne;\r\n    }\r\n    else if(e->next) {\r\n      e->next->prev = ne;\r\n    }\r\n    else {\r\n      list->tail = ne;\r\n    }\r\n    if(e)\r\n      e->next = ne;\r\n  }\r\n\r\n  ++list->size;\r\n\r\n  return 1;\r\n}\r\n\r\n/*\r\n * @unittest: 1300\r\n */\r\nint\r\nCurl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,\r\n                  void *user)\r\n{\r\n  if(e == NULL || list->size == 0)\r\n    return 1;\r\n\r\n  if(e == list->head) {\r\n    list->head = e->next;\r\n\r\n    if(list->head == NULL)\r\n      list->tail = NULL;\r\n    else\r\n      e->next->prev = NULL;\r\n  }\r\n  else {\r\n    e->prev->next = e->next;\r\n    if(!e->next)\r\n      list->tail = e->prev;\r\n    else\r\n      e->next->prev = e->prev;\r\n  }\r\n\r\n  list->dtor(user, e->ptr);\r\n\r\n  e->ptr  = NULL;\r\n  e->prev = NULL;\r\n  e->next = NULL;\r\n\r\n  free(e);\r\n  --list->size;\r\n\r\n  return 1;\r\n}\r\n\r\nvoid\r\nCurl_llist_destroy(struct curl_llist *list, void *user)\r\n{\r\n  if(list) {\r\n    while(list->size > 0)\r\n      Curl_llist_remove(list, list->tail, user);\r\n\r\n    free(list);\r\n  }\r\n}\r\n\r\nsize_t\r\nCurl_llist_count(struct curl_llist *list)\r\n{\r\n  return list->size;\r\n}\r\n\r\n/*\r\n * @unittest: 1300\r\n */\r\nint Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e,\r\n                    struct curl_llist *to_list,\r\n                    struct curl_llist_element *to_e)\r\n{\r\n  /* Remove element from list */\r\n  if(e == NULL || list->size == 0)\r\n    return 0;\r\n\r\n  if(e == list->head) {\r\n    list->head = e->next;\r\n\r\n    if(list->head == NULL)\r\n      list->tail = NULL;\r\n    else\r\n      e->next->prev = NULL;\r\n  }\r\n  else {\r\n    e->prev->next = e->next;\r\n    if(!e->next)\r\n      list->tail = e->prev;\r\n    else\r\n      e->next->prev = e->prev;\r\n  }\r\n\r\n  --list->size;\r\n\r\n  /* Add element to to_list after to_e */\r\n  if(to_list->size == 0) {\r\n    to_list->head = e;\r\n    to_list->head->prev = NULL;\r\n    to_list->head->next = NULL;\r\n    to_list->tail = e;\r\n  }\r\n  else {\r\n    e->next = to_e->next;\r\n    e->prev = to_e;\r\n    if(to_e->next) {\r\n      to_e->next->prev = e;\r\n    }\r\n    else {\r\n      to_list->tail = e;\r\n    }\r\n    to_e->next = e;\r\n  }\r\n\r\n  ++to_list->size;\r\n\r\n  return 1;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/llist.h",
    "content": "#ifndef HEADER_CURL_LLIST_H\r\n#define HEADER_CURL_LLIST_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n#include <stddef.h>\r\n\r\ntypedef void (*curl_llist_dtor)(void *, void *);\r\n\r\nstruct curl_llist_element {\r\n  void *ptr;\r\n\r\n  struct curl_llist_element *prev;\r\n  struct curl_llist_element *next;\r\n};\r\n\r\nstruct curl_llist {\r\n  struct curl_llist_element *head;\r\n  struct curl_llist_element *tail;\r\n\r\n  curl_llist_dtor dtor;\r\n\r\n  size_t size;\r\n};\r\n\r\nstruct curl_llist *Curl_llist_alloc(curl_llist_dtor);\r\nint Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *,\r\n                           const void *);\r\nint Curl_llist_remove(struct curl_llist *, struct curl_llist_element *,\r\n                      void *);\r\nsize_t Curl_llist_count(struct curl_llist *);\r\nvoid Curl_llist_destroy(struct curl_llist *, void *);\r\nint Curl_llist_move(struct curl_llist *, struct curl_llist_element *,\r\n                    struct curl_llist *, struct curl_llist_element *);\r\n\r\n#endif /* HEADER_CURL_LLIST_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/md4.c",
    "content": "/*-\r\n   Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved.\r\n\r\n   License to copy and use this software is granted provided that it\r\n   is identified as the \"RSA Data Security, Inc. MD4 Message-Digest\r\n   Algorithm\" in all material mentioning or referencing this software\r\n   or this function.\r\n\r\n   License is also granted to make and use derivative works provided\r\n   that such works are identified as \"derived from the RSA Data\r\n   Security, Inc. MD4 Message-Digest Algorithm\" in all material\r\n   mentioning or referencing the derived work.\r\n\r\n   RSA Data Security, Inc. makes no representations concerning either\r\n   the merchantability of this software or the suitability of this\r\n   software for any particular purpose. It is provided \"as is\"\r\n   without express or implied warranty of any kind.\r\n\r\n   These notices must be retained in any copies of any part of this\r\n   documentation and/or software.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n/* NSS crypto library does not provide the MD4 hash algorithm, so that we have\r\n * a local implementation of it */\r\n#ifdef USE_NSS\r\n\r\n#include \"curl_md4.h\"\r\n#include \"warnless.h\"\r\n\r\ntypedef unsigned int UINT4;\r\n\r\ntypedef struct MD4Context {\r\n  UINT4 state[4];               /* state (ABCD) */\r\n  UINT4 count[2];               /* number of bits, modulo 2^64 (lsb first) */\r\n  unsigned char buffer[64];     /* input buffer */\r\n} MD4_CTX;\r\n\r\n/* Constants for MD4Transform routine.\r\n */\r\n#define S11 3\r\n#define S12 7\r\n#define S13 11\r\n#define S14 19\r\n#define S21 3\r\n#define S22 5\r\n#define S23 9\r\n#define S24 13\r\n#define S31 3\r\n#define S32 9\r\n#define S33 11\r\n#define S34 15\r\n\r\nstatic void MD4Transform(UINT4 [4], const unsigned char [64]);\r\nstatic void Encode(unsigned char *, UINT4 *, unsigned int);\r\nstatic void Decode(UINT4 *, const unsigned char *, unsigned int);\r\n\r\nstatic unsigned char PADDING[64] = {\r\n  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\r\n};\r\n\r\n/* F, G and H are basic MD4 functions.\r\n */\r\n#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))\r\n#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))\r\n#define H(x, y, z) ((x) ^ (y) ^ (z))\r\n\r\n/* ROTATE_LEFT rotates x left n bits.\r\n */\r\n#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))\r\n\r\n/* FF, GG and HH are transformations for rounds 1, 2 and 3 */\r\n/* Rotation is separate from addition to prevent recomputation */\r\n#define FF(a, b, c, d, x, s) { \\\r\n    (a) += F ((b), (c), (d)) + (x); \\\r\n    (a) = ROTATE_LEFT ((a), (s)); \\\r\n  }\r\n#define GG(a, b, c, d, x, s) { \\\r\n    (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \\\r\n    (a) = ROTATE_LEFT ((a), (s)); \\\r\n  }\r\n#define HH(a, b, c, d, x, s) { \\\r\n    (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \\\r\n    (a) = ROTATE_LEFT ((a), (s)); \\\r\n  }\r\n\r\n/* MD4 initialization. Begins an MD4 operation, writing a new context.\r\n */\r\nstatic void MD4Init(MD4_CTX *context)\r\n{\r\n  context->count[0] = context->count[1] = 0;\r\n\r\n  /* Load magic initialization constants.\r\n   */\r\n  context->state[0] = 0x67452301;\r\n  context->state[1] = 0xefcdab89;\r\n  context->state[2] = 0x98badcfe;\r\n  context->state[3] = 0x10325476;\r\n}\r\n\r\n/* MD4 block update operation. Continues an MD4 message-digest\r\n     operation, processing another message block, and updating the\r\n     context.\r\n */\r\nstatic void MD4Update(MD4_CTX *context, const unsigned char *input,\r\n                      unsigned int inputLen)\r\n{\r\n  unsigned int i, bufindex, partLen;\r\n\r\n  /* Compute number of bytes mod 64 */\r\n  bufindex = (unsigned int)((context->count[0] >> 3) & 0x3F);\r\n  /* Update number of bits */\r\n  if((context->count[0] += ((UINT4)inputLen << 3))\r\n     < ((UINT4)inputLen << 3))\r\n    context->count[1]++;\r\n  context->count[1] += ((UINT4)inputLen >> 29);\r\n\r\n  partLen = 64 - bufindex;\r\n  /* Transform as many times as possible.\r\n   */\r\n  if(inputLen >= partLen) {\r\n    memcpy(&context->buffer[bufindex], input, partLen);\r\n    MD4Transform (context->state, context->buffer);\r\n\r\n    for(i = partLen; i + 63 < inputLen; i += 64)\r\n      MD4Transform (context->state, &input[i]);\r\n\r\n    bufindex = 0;\r\n  }\r\n  else\r\n    i = 0;\r\n\r\n  /* Buffer remaining input */\r\n  memcpy(&context->buffer[bufindex], &input[i], inputLen-i);\r\n}\r\n\r\n/* MD4 padding. */\r\nstatic void MD4Pad(MD4_CTX *context)\r\n{\r\n  unsigned char bits[8];\r\n  unsigned int bufindex, padLen;\r\n\r\n  /* Save number of bits */\r\n  Encode (bits, context->count, 8);\r\n\r\n  /* Pad out to 56 mod 64.\r\n   */\r\n  bufindex = (unsigned int)((context->count[0] >> 3) & 0x3f);\r\n  padLen = (bufindex < 56) ? (56 - bufindex) : (120 - bufindex);\r\n  MD4Update (context, PADDING, padLen);\r\n\r\n  /* Append length (before padding) */\r\n  MD4Update (context, bits, 8);\r\n}\r\n\r\n/* MD4 finalization. Ends an MD4 message-digest operation, writing the\r\n     the message digest and zeroizing the context.\r\n */\r\nstatic void MD4Final (unsigned char digest[16], MD4_CTX *context)\r\n{\r\n  /* Do padding */\r\n  MD4Pad (context);\r\n\r\n  /* Store state in digest */\r\n  Encode (digest, context->state, 16);\r\n\r\n  /* Zeroize sensitive information.\r\n   */\r\n  memset(context, 0, sizeof(*context));\r\n}\r\n\r\n/* MD4 basic transformation. Transforms state based on block.\r\n */\r\nstatic void MD4Transform (UINT4 state[4], const unsigned char block[64])\r\n{\r\n  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];\r\n\r\n  Decode (x, block, 64);\r\n\r\n  /* Round 1 */\r\n  FF (a, b, c, d, x[ 0], S11); /* 1 */\r\n  FF (d, a, b, c, x[ 1], S12); /* 2 */\r\n  FF (c, d, a, b, x[ 2], S13); /* 3 */\r\n  FF (b, c, d, a, x[ 3], S14); /* 4 */\r\n  FF (a, b, c, d, x[ 4], S11); /* 5 */\r\n  FF (d, a, b, c, x[ 5], S12); /* 6 */\r\n  FF (c, d, a, b, x[ 6], S13); /* 7 */\r\n  FF (b, c, d, a, x[ 7], S14); /* 8 */\r\n  FF (a, b, c, d, x[ 8], S11); /* 9 */\r\n  FF (d, a, b, c, x[ 9], S12); /* 10 */\r\n  FF (c, d, a, b, x[10], S13); /* 11 */\r\n  FF (b, c, d, a, x[11], S14); /* 12 */\r\n  FF (a, b, c, d, x[12], S11); /* 13 */\r\n  FF (d, a, b, c, x[13], S12); /* 14 */\r\n  FF (c, d, a, b, x[14], S13); /* 15 */\r\n  FF (b, c, d, a, x[15], S14); /* 16 */\r\n\r\n  /* Round 2 */\r\n  GG (a, b, c, d, x[ 0], S21); /* 17 */\r\n  GG (d, a, b, c, x[ 4], S22); /* 18 */\r\n  GG (c, d, a, b, x[ 8], S23); /* 19 */\r\n  GG (b, c, d, a, x[12], S24); /* 20 */\r\n  GG (a, b, c, d, x[ 1], S21); /* 21 */\r\n  GG (d, a, b, c, x[ 5], S22); /* 22 */\r\n  GG (c, d, a, b, x[ 9], S23); /* 23 */\r\n  GG (b, c, d, a, x[13], S24); /* 24 */\r\n  GG (a, b, c, d, x[ 2], S21); /* 25 */\r\n  GG (d, a, b, c, x[ 6], S22); /* 26 */\r\n  GG (c, d, a, b, x[10], S23); /* 27 */\r\n  GG (b, c, d, a, x[14], S24); /* 28 */\r\n  GG (a, b, c, d, x[ 3], S21); /* 29 */\r\n  GG (d, a, b, c, x[ 7], S22); /* 30 */\r\n  GG (c, d, a, b, x[11], S23); /* 31 */\r\n  GG (b, c, d, a, x[15], S24); /* 32 */\r\n\r\n  /* Round 3 */\r\n  HH (a, b, c, d, x[ 0], S31); /* 33 */\r\n  HH (d, a, b, c, x[ 8], S32); /* 34 */\r\n  HH (c, d, a, b, x[ 4], S33); /* 35 */\r\n  HH (b, c, d, a, x[12], S34); /* 36 */\r\n  HH (a, b, c, d, x[ 2], S31); /* 37 */\r\n  HH (d, a, b, c, x[10], S32); /* 38 */\r\n  HH (c, d, a, b, x[ 6], S33); /* 39 */\r\n  HH (b, c, d, a, x[14], S34); /* 40 */\r\n  HH (a, b, c, d, x[ 1], S31); /* 41 */\r\n  HH (d, a, b, c, x[ 9], S32); /* 42 */\r\n  HH (c, d, a, b, x[ 5], S33); /* 43 */\r\n  HH (b, c, d, a, x[13], S34); /* 44 */\r\n  HH (a, b, c, d, x[ 3], S31); /* 45 */\r\n  HH (d, a, b, c, x[11], S32); /* 46 */\r\n  HH (c, d, a, b, x[ 7], S33); /* 47 */\r\n  HH (b, c, d, a, x[15], S34); /* 48 */\r\n\r\n  state[0] += a;\r\n  state[1] += b;\r\n  state[2] += c;\r\n  state[3] += d;\r\n\r\n  /* Zeroize sensitive information.\r\n   */\r\n  memset(x, 0, sizeof(x));\r\n}\r\n\r\n/* Encodes input (UINT4) into output (unsigned char). Assumes len is\r\n     a multiple of 4.\r\n */\r\nstatic void Encode(unsigned char *output, UINT4 *input, unsigned int len)\r\n{\r\n  unsigned int i, j;\r\n\r\n  for(i = 0, j = 0; j < len; i++, j += 4) {\r\n    output[j] = (unsigned char)(input[i] & 0xff);\r\n    output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);\r\n    output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);\r\n    output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);\r\n  }\r\n}\r\n\r\n/* Decodes input (unsigned char) into output (UINT4). Assumes len is\r\n     a multiple of 4.\r\n */\r\nstatic void Decode (UINT4 *output, const unsigned char *input,\r\n                    unsigned int len)\r\n{\r\n  unsigned int i, j;\r\n\r\n  for(i = 0, j = 0; j < len; i++, j += 4)\r\n    output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |\r\n      (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);\r\n}\r\n\r\nvoid Curl_md4it(unsigned char *output, const unsigned char *input, size_t len)\r\n{\r\n  MD4_CTX ctx;\r\n  MD4Init(&ctx);\r\n  MD4Update(&ctx, input, curlx_uztoui(len));\r\n  MD4Final(output, &ctx);\r\n}\r\n#endif /* USE_NSS */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/md5.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n\r\n#include \"curl_md5.h\"\r\n#include \"curl_hmac.h\"\r\n#include \"warnless.h\"\r\n\r\n#include \"curl_memory.h\"\r\n\r\n#if defined(USE_GNUTLS_NETTLE)\r\n\r\n#include <nettle/md5.h>\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\ntypedef struct md5_ctx MD5_CTX;\r\n\r\nstatic void MD5_Init(MD5_CTX * ctx)\r\n{\r\n  md5_init(ctx);\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX * ctx,\r\n                       const unsigned char * input,\r\n                       unsigned int inputLen)\r\n{\r\n  md5_update(ctx, inputLen, input);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX * ctx)\r\n{\r\n  md5_digest(ctx, 16, digest);\r\n}\r\n\r\n#elif defined(USE_GNUTLS)\r\n\r\n#include <gcrypt.h>\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\ntypedef gcry_md_hd_t MD5_CTX;\r\n\r\nstatic void MD5_Init(MD5_CTX * ctx)\r\n{\r\n  gcry_md_open(ctx, GCRY_MD_MD5, 0);\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX * ctx,\r\n                       const unsigned char * input,\r\n                       unsigned int inputLen)\r\n{\r\n  gcry_md_write(*ctx, input, inputLen);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX * ctx)\r\n{\r\n  memcpy(digest, gcry_md_read(*ctx, 0), 16);\r\n  gcry_md_close(*ctx);\r\n}\r\n\r\n#elif defined(USE_SSLEAY)\r\n/* When OpenSSL is available we use the MD5-function from OpenSSL */\r\n\r\n#  ifdef USE_OPENSSL\r\n#    include <openssl/md5.h>\r\n#  else\r\n#    include <md5.h>\r\n#  endif\r\n\r\n#elif defined(__MAC_10_4) || defined(__IPHONE_5_0)\r\n\r\n/* For Apple operating systems: CommonCrypto has the functions we need.\r\n   The library's headers are even backward-compatible with OpenSSL's\r\n   headers as long as we define COMMON_DIGEST_FOR_OPENSSL first.\r\n\r\n   These functions are available on Tiger and later, as well as iOS 5.0\r\n   and later. If you're building for an older cat, well, sorry. */\r\n#  define COMMON_DIGEST_FOR_OPENSSL\r\n#  include <CommonCrypto/CommonDigest.h>\r\n\r\n#elif defined(_WIN32)\r\n\r\n#include <wincrypt.h>\r\n\r\ntypedef struct {\r\n  HCRYPTPROV hCryptProv;\r\n  HCRYPTHASH hHash;\r\n} MD5_CTX;\r\n\r\nstatic void MD5_Init(MD5_CTX *ctx)\r\n{\r\n  if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,\r\n                         PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {\r\n    CryptCreateHash(ctx->hCryptProv, CALG_MD5, 0, 0, &ctx->hHash);\r\n  }\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX *ctx,\r\n                       const unsigned char *input,\r\n                       unsigned int inputLen)\r\n{\r\n  CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)\r\n{\r\n  unsigned long length;\r\n  CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0);\r\n  if(length == 16)\r\n    CryptGetHashParam(ctx->hHash, HP_HASHVAL, digest, &length, 0);\r\n  if(ctx->hHash)\r\n    CryptDestroyHash(ctx->hHash);\r\n  if(ctx->hCryptProv)\r\n    CryptReleaseContext(ctx->hCryptProv, 0);\r\n}\r\n\r\n#else\r\n/* When no other crypto library is available we use this code segment */\r\n\r\n/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All\r\nrights reserved.\r\n\r\nLicense to copy and use this software is granted provided that it\r\nis identified as the \"RSA Data Security, Inc. MD5 Message-Digest\r\nAlgorithm\" in all material mentioning or referencing this software\r\nor this function.\r\n\r\nLicense is also granted to make and use derivative works provided\r\nthat such works are identified as \"derived from the RSA Data\r\nSecurity, Inc. MD5 Message-Digest Algorithm\" in all material\r\nmentioning or referencing the derived work.\r\n\r\nRSA Data Security, Inc. makes no representations concerning either\r\nthe merchantability of this software or the suitability of this\r\nsoftware for any particular purpose. It is provided \"as is\"\r\nwithout express or implied warranty of any kind.\r\n\r\nThese notices must be retained in any copies of any part of this\r\ndocumentation and/or software.\r\n */\r\n\r\n/* UINT4 defines a four byte word */\r\ntypedef unsigned int UINT4;\r\n\r\n/* MD5 context. */\r\nstruct md5_ctx {\r\n  UINT4 state[4];                                   /* state (ABCD) */\r\n  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */\r\n  unsigned char buffer[64];                         /* input buffer */\r\n};\r\n\r\ntypedef struct md5_ctx MD5_CTX;\r\n\r\nstatic void MD5_Init(struct md5_ctx *);\r\nstatic void MD5_Update(struct md5_ctx *, const unsigned char *, unsigned int);\r\nstatic void MD5_Final(unsigned char [16], struct md5_ctx *);\r\n\r\n/* Constants for MD5Transform routine.\r\n */\r\n\r\n#define S11 7\r\n#define S12 12\r\n#define S13 17\r\n#define S14 22\r\n#define S21 5\r\n#define S22 9\r\n#define S23 14\r\n#define S24 20\r\n#define S31 4\r\n#define S32 11\r\n#define S33 16\r\n#define S34 23\r\n#define S41 6\r\n#define S42 10\r\n#define S43 15\r\n#define S44 21\r\n\r\nstatic void MD5Transform(UINT4 [4], const unsigned char [64]);\r\nstatic void Encode(unsigned char *, UINT4 *, unsigned int);\r\nstatic void Decode(UINT4 *, const unsigned char *, unsigned int);\r\n\r\nstatic const unsigned char PADDING[64] = {\r\n  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\r\n};\r\n\r\n/* F, G, H and I are basic MD5 functions.\r\n */\r\n#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))\r\n#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))\r\n#define H(x, y, z) ((x) ^ (y) ^ (z))\r\n#define I(x, y, z) ((y) ^ ((x) | (~z)))\r\n\r\n/* ROTATE_LEFT rotates x left n bits.\r\n */\r\n#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))\r\n\r\n/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.\r\nRotation is separate from addition to prevent recomputation.\r\n */\r\n#define FF(a, b, c, d, x, s, ac) { \\\r\n (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \\\r\n (a) = ROTATE_LEFT ((a), (s)); \\\r\n (a) += (b); \\\r\n  }\r\n#define GG(a, b, c, d, x, s, ac) { \\\r\n (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \\\r\n (a) = ROTATE_LEFT ((a), (s)); \\\r\n (a) += (b); \\\r\n  }\r\n#define HH(a, b, c, d, x, s, ac) { \\\r\n (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \\\r\n (a) = ROTATE_LEFT ((a), (s)); \\\r\n (a) += (b); \\\r\n  }\r\n#define II(a, b, c, d, x, s, ac) { \\\r\n (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \\\r\n (a) = ROTATE_LEFT ((a), (s)); \\\r\n (a) += (b); \\\r\n  }\r\n\r\n/* MD5 initialization. Begins an MD5 operation, writing a new context.\r\n */\r\nstatic void MD5_Init(struct md5_ctx *context)\r\n{\r\n  context->count[0] = context->count[1] = 0;\r\n  /* Load magic initialization constants. */\r\n  context->state[0] = 0x67452301;\r\n  context->state[1] = 0xefcdab89;\r\n  context->state[2] = 0x98badcfe;\r\n  context->state[3] = 0x10325476;\r\n}\r\n\r\n/* MD5 block update operation. Continues an MD5 message-digest\r\n  operation, processing another message block, and updating the\r\n  context.\r\n */\r\nstatic void MD5_Update (struct md5_ctx *context,    /* context */\r\n                        const unsigned char *input, /* input block */\r\n                        unsigned int inputLen)      /* length of input block */\r\n{\r\n  unsigned int i, bufindex, partLen;\r\n\r\n  /* Compute number of bytes mod 64 */\r\n  bufindex = (unsigned int)((context->count[0] >> 3) & 0x3F);\r\n\r\n  /* Update number of bits */\r\n  if((context->count[0] += ((UINT4)inputLen << 3))\r\n      < ((UINT4)inputLen << 3))\r\n    context->count[1]++;\r\n  context->count[1] += ((UINT4)inputLen >> 29);\r\n\r\n  partLen = 64 - bufindex;\r\n\r\n  /* Transform as many times as possible. */\r\n  if(inputLen >= partLen) {\r\n    memcpy(&context->buffer[bufindex], input, partLen);\r\n    MD5Transform(context->state, context->buffer);\r\n\r\n    for(i = partLen; i + 63 < inputLen; i += 64)\r\n      MD5Transform(context->state, &input[i]);\r\n\r\n    bufindex = 0;\r\n  }\r\n  else\r\n    i = 0;\r\n\r\n  /* Buffer remaining input */\r\n  memcpy(&context->buffer[bufindex], &input[i], inputLen-i);\r\n}\r\n\r\n/* MD5 finalization. Ends an MD5 message-digest operation, writing the\r\n   the message digest and zeroizing the context.\r\n*/\r\nstatic void MD5_Final(unsigned char digest[16], /* message digest */\r\n                      struct md5_ctx *context) /* context */\r\n{\r\n  unsigned char bits[8];\r\n  unsigned int count, padLen;\r\n\r\n  /* Save number of bits */\r\n  Encode (bits, context->count, 8);\r\n\r\n  /* Pad out to 56 mod 64. */\r\n  count = (unsigned int)((context->count[0] >> 3) & 0x3f);\r\n  padLen = (count < 56) ? (56 - count) : (120 - count);\r\n  MD5_Update (context, PADDING, padLen);\r\n\r\n  /* Append length (before padding) */\r\n  MD5_Update (context, bits, 8);\r\n\r\n  /* Store state in digest */\r\n  Encode (digest, context->state, 16);\r\n\r\n  /* Zeroize sensitive information. */\r\n  memset ((void *)context, 0, sizeof (*context));\r\n}\r\n\r\n/* MD5 basic transformation. Transforms state based on block. */\r\nstatic void MD5Transform(UINT4 state[4],\r\n                         const unsigned char block[64])\r\n{\r\n  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];\r\n\r\n  Decode (x, block, 64);\r\n\r\n  /* Round 1 */\r\n  FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */\r\n  FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */\r\n  FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */\r\n  FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */\r\n  FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */\r\n  FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */\r\n  FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */\r\n  FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */\r\n  FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */\r\n  FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */\r\n  FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */\r\n  FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */\r\n  FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */\r\n  FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */\r\n  FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */\r\n  FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */\r\n\r\n /* Round 2 */\r\n  GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */\r\n  GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */\r\n  GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */\r\n  GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */\r\n  GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */\r\n  GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */\r\n  GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */\r\n  GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */\r\n  GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */\r\n  GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */\r\n  GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */\r\n  GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */\r\n  GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */\r\n  GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */\r\n  GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */\r\n  GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */\r\n\r\n  /* Round 3 */\r\n  HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */\r\n  HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */\r\n  HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */\r\n  HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */\r\n  HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */\r\n  HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */\r\n  HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */\r\n  HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */\r\n  HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */\r\n  HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */\r\n  HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */\r\n  HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */\r\n  HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */\r\n  HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */\r\n  HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */\r\n  HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */\r\n\r\n  /* Round 4 */\r\n  II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */\r\n  II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */\r\n  II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */\r\n  II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */\r\n  II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */\r\n  II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */\r\n  II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */\r\n  II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */\r\n  II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */\r\n  II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */\r\n  II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */\r\n  II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */\r\n  II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */\r\n  II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */\r\n  II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */\r\n  II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */\r\n\r\n  state[0] += a;\r\n  state[1] += b;\r\n  state[2] += c;\r\n  state[3] += d;\r\n\r\n  /* Zeroize sensitive information. */\r\n  memset((void *)x, 0, sizeof (x));\r\n}\r\n\r\n/* Encodes input (UINT4) into output (unsigned char). Assumes len is\r\n  a multiple of 4.\r\n */\r\nstatic void Encode (unsigned char *output,\r\n                    UINT4 *input,\r\n                    unsigned int len)\r\n{\r\n  unsigned int i, j;\r\n\r\n  for(i = 0, j = 0; j < len; i++, j += 4) {\r\n    output[j] = (unsigned char)(input[i] & 0xff);\r\n    output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);\r\n    output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);\r\n    output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);\r\n  }\r\n}\r\n\r\n/* Decodes input (unsigned char) into output (UINT4). Assumes len is\r\n   a multiple of 4.\r\n*/\r\nstatic void Decode (UINT4 *output,\r\n                    const unsigned char *input,\r\n                    unsigned int len)\r\n{\r\n  unsigned int i, j;\r\n\r\n  for(i = 0, j = 0; j < len; i++, j += 4)\r\n    output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |\r\n      (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);\r\n}\r\n\r\n#endif /* CRYPTO LIBS */\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nconst HMAC_params Curl_HMAC_MD5[] = {\r\n  {\r\n    (HMAC_hinit_func) MD5_Init,           /* Hash initialization function. */\r\n    (HMAC_hupdate_func) MD5_Update,       /* Hash update function. */\r\n    (HMAC_hfinal_func) MD5_Final,         /* Hash computation end function. */\r\n    sizeof(MD5_CTX),                      /* Size of hash context structure. */\r\n    64,                                   /* Maximum key length. */\r\n    16                                    /* Result size. */\r\n  }\r\n};\r\n\r\nconst MD5_params Curl_DIGEST_MD5[] = {\r\n  {\r\n    (Curl_MD5_init_func) MD5_Init,      /* Digest initialization function */\r\n    (Curl_MD5_update_func) MD5_Update,  /* Digest update function */\r\n    (Curl_MD5_final_func) MD5_Final,    /* Digest computation end function */\r\n    sizeof(MD5_CTX),                    /* Size of digest context struct */\r\n    16                                  /* Result size */\r\n  }\r\n};\r\n\r\nvoid Curl_md5it(unsigned char *outbuffer, /* 16 bytes */\r\n                const unsigned char *input)\r\n{\r\n  MD5_CTX ctx;\r\n  MD5_Init(&ctx);\r\n  MD5_Update(&ctx, input, curlx_uztoui(strlen((char *)input)));\r\n  MD5_Final(outbuffer, &ctx);\r\n}\r\n\r\nMD5_context *Curl_MD5_init(const MD5_params *md5params)\r\n{\r\n  MD5_context *ctxt;\r\n\r\n  /* Create MD5 context */\r\n  ctxt = malloc(sizeof *ctxt);\r\n\r\n  if(!ctxt)\r\n    return ctxt;\r\n\r\n  ctxt->md5_hashctx = malloc(md5params->md5_ctxtsize);\r\n\r\n  if(!ctxt->md5_hashctx) {\r\n    free(ctxt);\r\n    return NULL;\r\n  }\r\n\r\n  ctxt->md5_hash = md5params;\r\n\r\n  (*md5params->md5_init_func)(ctxt->md5_hashctx);\r\n\r\n  return ctxt;\r\n}\r\n\r\nint Curl_MD5_update(MD5_context *context,\r\n                    const unsigned char *data,\r\n                    unsigned int len)\r\n{\r\n  (*context->md5_hash->md5_update_func)(context->md5_hashctx, data, len);\r\n\r\n  return 0;\r\n}\r\n\r\nint Curl_MD5_final(MD5_context *context, unsigned char *result)\r\n{\r\n  (*context->md5_hash->md5_final_func)(result, context->md5_hashctx);\r\n\r\n  free(context->md5_hashctx);\r\n  free(context);\r\n\r\n  return 0;\r\n}\r\n\r\n#endif /* CURL_DISABLE_CRYPTO_AUTH */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/memdebug.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef CURLDEBUG\r\n\r\n#include <curl/curl.h>\r\n\r\n#define _MPRINTF_REPLACE\r\n#include <curl/mprintf.h>\r\n#include \"urldata.h\"\r\n\r\n#define MEMDEBUG_NODEFINES /* don't redefine the standard functions */\r\n#include \"curl_memory.h\"\r\n#include \"memdebug.h\"\r\n\r\n#ifndef HAVE_ASSERT_H\r\n#  define assert(x) Curl_nop_stmt\r\n#endif\r\n\r\n/*\r\n * Until 2011-08-17 libcurl's Memory Tracking feature also performed\r\n * automatic malloc and free filling operations using 0xA5 and 0x13\r\n * values. Our own preinitialization of dynamically allocated memory\r\n * might be useful when not using third party memory debuggers, but\r\n * on the other hand this would fool memory debuggers into thinking\r\n * that all dynamically allocated memory is properly initialized.\r\n *\r\n * As a default setting, libcurl's Memory Tracking feature no longer\r\n * performs preinitialization of dynamically allocated memory on its\r\n * own. If you know what you are doing, and really want to retain old\r\n * behavior, you can achieve this compiling with preprocessor symbols\r\n * CURL_MT_MALLOC_FILL and CURL_MT_FREE_FILL defined with appropriate\r\n * values.\r\n */\r\n\r\n#ifdef CURL_MT_MALLOC_FILL\r\n# if (CURL_MT_MALLOC_FILL < 0) || (CURL_MT_MALLOC_FILL > 0xff)\r\n#   error \"invalid CURL_MT_MALLOC_FILL or out of range\"\r\n# endif\r\n#endif\r\n\r\n#ifdef CURL_MT_FREE_FILL\r\n# if (CURL_MT_FREE_FILL < 0) || (CURL_MT_FREE_FILL > 0xff)\r\n#   error \"invalid CURL_MT_FREE_FILL or out of range\"\r\n# endif\r\n#endif\r\n\r\n#if defined(CURL_MT_MALLOC_FILL) && defined(CURL_MT_FREE_FILL)\r\n# if (CURL_MT_MALLOC_FILL == CURL_MT_FREE_FILL)\r\n#   error \"CURL_MT_MALLOC_FILL same as CURL_MT_FREE_FILL\"\r\n# endif\r\n#endif\r\n\r\n#ifdef CURL_MT_MALLOC_FILL\r\n#  define mt_malloc_fill(buf,len) memset((buf), CURL_MT_MALLOC_FILL, (len))\r\n#else\r\n#  define mt_malloc_fill(buf,len) Curl_nop_stmt\r\n#endif\r\n\r\n#ifdef CURL_MT_FREE_FILL\r\n#  define mt_free_fill(buf,len) memset((buf), CURL_MT_FREE_FILL, (len))\r\n#else\r\n#  define mt_free_fill(buf,len) Curl_nop_stmt\r\n#endif\r\n\r\nstruct memdebug {\r\n  size_t size;\r\n  union {\r\n    curl_off_t o;\r\n    double d;\r\n    void * p;\r\n  } mem[1];\r\n  /* I'm hoping this is the thing with the strictest alignment\r\n   * requirements.  That also means we waste some space :-( */\r\n};\r\n\r\n/*\r\n * Note that these debug functions are very simple and they are meant to\r\n * remain so. For advanced analysis, record a log file and write perl scripts\r\n * to analyze them!\r\n *\r\n * Don't use these with multithreaded test programs!\r\n */\r\n\r\n#define logfile curl_debuglogfile\r\nFILE *curl_debuglogfile = NULL;\r\nstatic bool memlimit = FALSE; /* enable memory limit */\r\nstatic long memsize = 0;  /* set number of mallocs allowed */\r\n\r\n/* this sets the log file name */\r\nvoid curl_memdebug(const char *logname)\r\n{\r\n  if(!logfile) {\r\n    if(logname && *logname)\r\n      logfile = fopen(logname, \"w\");\r\n    else\r\n      logfile = stderr;\r\n#ifdef MEMDEBUG_LOG_SYNC\r\n    /* Flush the log file after every line so the log isn't lost in a crash */\r\n    setvbuf(logfile, (char *)NULL, _IOLBF, 0);\r\n#endif\r\n  }\r\n}\r\n\r\n/* This function sets the number of malloc() calls that should return\r\n   successfully! */\r\nvoid curl_memlimit(long limit)\r\n{\r\n  if(!memlimit) {\r\n    memlimit = TRUE;\r\n    memsize = limit;\r\n  }\r\n}\r\n\r\n/* returns TRUE if this isn't allowed! */\r\nstatic bool countcheck(const char *func, int line, const char *source)\r\n{\r\n  /* if source is NULL, then the call is made internally and this check\r\n     should not be made */\r\n  if(memlimit && source) {\r\n    if(!memsize) {\r\n      if(source) {\r\n        /* log to file */\r\n        curl_memlog(\"LIMIT %s:%d %s reached memlimit\\n\",\r\n                    source, line, func);\r\n        /* log to stderr also */\r\n        fprintf(stderr, \"LIMIT %s:%d %s reached memlimit\\n\",\r\n                source, line, func);\r\n      }\r\n      SET_ERRNO(ENOMEM);\r\n      return TRUE; /* RETURN ERROR! */\r\n    }\r\n    else\r\n      memsize--; /* countdown */\r\n\r\n    /* log the countdown */\r\n    if(source)\r\n      curl_memlog(\"LIMIT %s:%d %ld ALLOCS left\\n\",\r\n                  source, line, memsize);\r\n\r\n  }\r\n\r\n  return FALSE; /* allow this */\r\n}\r\n\r\nvoid *curl_domalloc(size_t wantedsize, int line, const char *source)\r\n{\r\n  struct memdebug *mem;\r\n  size_t size;\r\n\r\n  assert(wantedsize != 0);\r\n\r\n  if(countcheck(\"malloc\", line, source))\r\n    return NULL;\r\n\r\n  /* alloc at least 64 bytes */\r\n  size = sizeof(struct memdebug)+wantedsize;\r\n\r\n  mem = (Curl_cmalloc)(size);\r\n  if(mem) {\r\n    /* fill memory with junk */\r\n    mt_malloc_fill(mem->mem, wantedsize);\r\n    mem->size = wantedsize;\r\n  }\r\n\r\n  if(source)\r\n    curl_memlog(\"MEM %s:%d malloc(%zd) = %p\\n\",\r\n                source, line, wantedsize, mem ? mem->mem : 0);\r\n  return (mem ? mem->mem : NULL);\r\n}\r\n\r\nvoid *curl_docalloc(size_t wanted_elements, size_t wanted_size,\r\n                    int line, const char *source)\r\n{\r\n  struct memdebug *mem;\r\n  size_t size, user_size;\r\n\r\n  assert(wanted_elements != 0);\r\n  assert(wanted_size != 0);\r\n\r\n  if(countcheck(\"calloc\", line, source))\r\n    return NULL;\r\n\r\n  /* alloc at least 64 bytes */\r\n  user_size = wanted_size * wanted_elements;\r\n  size = sizeof(struct memdebug) + user_size;\r\n\r\n  mem = (Curl_ccalloc)(1, size);\r\n  if(mem)\r\n    mem->size = user_size;\r\n\r\n  if(source)\r\n    curl_memlog(\"MEM %s:%d calloc(%zu,%zu) = %p\\n\",\r\n                source, line, wanted_elements, wanted_size, mem?mem->mem:0);\r\n  return (mem ? mem->mem : NULL);\r\n}\r\n\r\nchar *curl_dostrdup(const char *str, int line, const char *source)\r\n{\r\n  char *mem;\r\n  size_t len;\r\n\r\n  assert(str != NULL);\r\n\r\n  if(countcheck(\"strdup\", line, source))\r\n    return NULL;\r\n\r\n  len=strlen(str)+1;\r\n\r\n  mem=curl_domalloc(len, 0, NULL); /* NULL prevents logging */\r\n  if(mem)\r\n    memcpy(mem, str, len);\r\n\r\n  if(source)\r\n    curl_memlog(\"MEM %s:%d strdup(%p) (%zu) = %p\\n\",\r\n                source, line, str, len, mem);\r\n\r\n  return mem;\r\n}\r\n\r\n/* We provide a realloc() that accepts a NULL as pointer, which then\r\n   performs a malloc(). In order to work with ares. */\r\nvoid *curl_dorealloc(void *ptr, size_t wantedsize,\r\n                     int line, const char *source)\r\n{\r\n  struct memdebug *mem=NULL;\r\n\r\n  size_t size = sizeof(struct memdebug)+wantedsize;\r\n\r\n  assert(wantedsize != 0);\r\n\r\n  if(countcheck(\"realloc\", line, source))\r\n    return NULL;\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:1684)\r\n   /* 1684: conversion from pointer to same-sized integral type */\r\n#endif\r\n\r\n  if(ptr)\r\n    mem = (void *)((char *)ptr - offsetof(struct memdebug, mem));\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n\r\n  mem = (Curl_crealloc)(mem, size);\r\n  if(source)\r\n    curl_memlog(\"MEM %s:%d realloc(%p, %zu) = %p\\n\",\r\n                source, line, ptr, wantedsize, mem?mem->mem:NULL);\r\n\r\n  if(mem) {\r\n    mem->size = wantedsize;\r\n    return mem->mem;\r\n  }\r\n\r\n  return NULL;\r\n}\r\n\r\nvoid curl_dofree(void *ptr, int line, const char *source)\r\n{\r\n  struct memdebug *mem;\r\n\r\n  assert(ptr != NULL);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:1684)\r\n   /* 1684: conversion from pointer to same-sized integral type */\r\n#endif\r\n\r\n  mem = (void *)((char *)ptr - offsetof(struct memdebug, mem));\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n\r\n  /* destroy */\r\n  mt_free_fill(mem->mem, mem->size);\r\n\r\n  /* free for real */\r\n  (Curl_cfree)(mem);\r\n\r\n  if(source)\r\n    curl_memlog(\"MEM %s:%d free(%p)\\n\", source, line, ptr);\r\n}\r\n\r\ncurl_socket_t curl_socket(int domain, int type, int protocol,\r\n                          int line, const char *source)\r\n{\r\n  const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?\r\n                    \"FD %s:%d socket() = %d\\n\" :\r\n                    (sizeof(curl_socket_t) == sizeof(long)) ?\r\n                    \"FD %s:%d socket() = %ld\\n\" :\r\n                    \"FD %s:%d socket() = %zd\\n\" ;\r\n\r\n  curl_socket_t sockfd = socket(domain, type, protocol);\r\n  if(source && (sockfd != CURL_SOCKET_BAD))\r\n    curl_memlog(fmt, source, line, sockfd);\r\n  return sockfd;\r\n}\r\n\r\n#ifdef HAVE_SOCKETPAIR\r\nint curl_socketpair(int domain, int type, int protocol,\r\n                    curl_socket_t socket_vector[2],\r\n                    int line, const char *source)\r\n{\r\n  const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?\r\n                    \"FD %s:%d socketpair() = %d %d\\n\" :\r\n                    (sizeof(curl_socket_t) == sizeof(long)) ?\r\n                    \"FD %s:%d socketpair() = %ld %ld\\n\" :\r\n                    \"FD %s:%d socketpair() = %zd %zd\\n\" ;\r\n\r\n  int res = socketpair(domain, type, protocol, socket_vector);\r\n  if(source && (0 == res))\r\n    curl_memlog(fmt, source, line, socket_vector[0], socket_vector[1]);\r\n  return res;\r\n}\r\n#endif\r\n\r\ncurl_socket_t curl_accept(curl_socket_t s, void *saddr, void *saddrlen,\r\n                          int line, const char *source)\r\n{\r\n  const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?\r\n                    \"FD %s:%d accept() = %d\\n\" :\r\n                    (sizeof(curl_socket_t) == sizeof(long)) ?\r\n                    \"FD %s:%d accept() = %ld\\n\" :\r\n                    \"FD %s:%d accept() = %zd\\n\" ;\r\n\r\n  struct sockaddr *addr = (struct sockaddr *)saddr;\r\n  curl_socklen_t *addrlen = (curl_socklen_t *)saddrlen;\r\n  curl_socket_t sockfd = accept(s, addr, addrlen);\r\n  if(source && (sockfd != CURL_SOCKET_BAD))\r\n    curl_memlog(fmt, source, line, sockfd);\r\n  return sockfd;\r\n}\r\n\r\n/* separate function to allow libcurl to mark a \"faked\" close */\r\nvoid curl_mark_sclose(curl_socket_t sockfd, int line, const char *source)\r\n{\r\n  const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?\r\n                    \"FD %s:%d sclose(%d)\\n\" :\r\n                    (sizeof(curl_socket_t) == sizeof(long)) ?\r\n                    \"FD %s:%d sclose(%ld)\\n\" :\r\n                    \"FD %s:%d sclose(%zd)\\n\" ;\r\n\r\n  if(source)\r\n    curl_memlog(fmt, source, line, sockfd);\r\n}\r\n\r\n/* this is our own defined way to close sockets on *ALL* platforms */\r\nint curl_sclose(curl_socket_t sockfd, int line, const char *source)\r\n{\r\n  int res=sclose(sockfd);\r\n  curl_mark_sclose(sockfd, line, source);\r\n  return res;\r\n}\r\n\r\nFILE *curl_fopen(const char *file, const char *mode,\r\n                 int line, const char *source)\r\n{\r\n  FILE *res=fopen(file, mode);\r\n  if(source)\r\n    curl_memlog(\"FILE %s:%d fopen(\\\"%s\\\",\\\"%s\\\") = %p\\n\",\r\n                source, line, file, mode, res);\r\n  return res;\r\n}\r\n\r\n#ifdef HAVE_FDOPEN\r\nFILE *curl_fdopen(int filedes, const char *mode,\r\n                  int line, const char *source)\r\n{\r\n  FILE *res=fdopen(filedes, mode);\r\n  if(source)\r\n    curl_memlog(\"FILE %s:%d fdopen(\\\"%d\\\",\\\"%s\\\") = %p\\n\",\r\n                source, line, filedes, mode, res);\r\n  return res;\r\n}\r\n#endif\r\n\r\nint curl_fclose(FILE *file, int line, const char *source)\r\n{\r\n  int res;\r\n\r\n  assert(file != NULL);\r\n\r\n  res=fclose(file);\r\n  if(source)\r\n    curl_memlog(\"FILE %s:%d fclose(%p)\\n\",\r\n                source, line, file);\r\n  return res;\r\n}\r\n\r\n#define LOGLINE_BUFSIZE  1024\r\n\r\n/* this does the writting to the memory tracking log file */\r\nvoid curl_memlog(const char *format, ...)\r\n{\r\n  char *buf;\r\n  int nchars;\r\n  va_list ap;\r\n\r\n  if(!logfile)\r\n    return;\r\n\r\n  buf = (Curl_cmalloc)(LOGLINE_BUFSIZE);\r\n  if(!buf)\r\n    return;\r\n\r\n  va_start(ap, format);\r\n  nchars = vsnprintf(buf, LOGLINE_BUFSIZE, format, ap);\r\n  va_end(ap);\r\n\r\n  if(nchars > LOGLINE_BUFSIZE - 1)\r\n    nchars = LOGLINE_BUFSIZE - 1;\r\n\r\n  if(nchars > 0)\r\n    fwrite(buf, 1, nchars, logfile);\r\n\r\n  (Curl_cfree)(buf);\r\n}\r\n\r\n#endif /* CURLDEBUG */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/memdebug.h",
    "content": "#ifndef HEADER_CURL_MEMDEBUG_H\r\n#define HEADER_CURL_MEMDEBUG_H\r\n#ifdef CURLDEBUG\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * CAUTION: this header is designed to work when included by the app-side\r\n * as well as the library. Do not mix with library internals!\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#define CURL_MT_LOGFNAME_BUFSIZE 512\r\n\r\n#define logfile curl_debuglogfile\r\n\r\nextern FILE *logfile;\r\n\r\n/* memory functions */\r\nCURL_EXTERN void *curl_domalloc(size_t size, int line, const char *source);\r\nCURL_EXTERN void *curl_docalloc(size_t elements, size_t size, int line,\r\n                                const char *source);\r\nCURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line,\r\n                                 const char *source);\r\nCURL_EXTERN void curl_dofree(void *ptr, int line, const char *source);\r\nCURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source);\r\nCURL_EXTERN void curl_memdebug(const char *logname);\r\nCURL_EXTERN void curl_memlimit(long limit);\r\nCURL_EXTERN void curl_memlog(const char *format, ...);\r\n\r\n/* file descriptor manipulators */\r\nCURL_EXTERN curl_socket_t curl_socket(int domain, int type, int protocol,\r\n                                      int line , const char *source);\r\nCURL_EXTERN void curl_mark_sclose(curl_socket_t sockfd,\r\n                                  int line , const char *source);\r\nCURL_EXTERN int curl_sclose(curl_socket_t sockfd,\r\n                            int line , const char *source);\r\nCURL_EXTERN curl_socket_t curl_accept(curl_socket_t s, void *a, void *alen,\r\n                                      int line, const char *source);\r\n#ifdef HAVE_SOCKETPAIR\r\nCURL_EXTERN int curl_socketpair(int domain, int type, int protocol,\r\n                                curl_socket_t socket_vector[2],\r\n                                int line , const char *source);\r\n#endif\r\n\r\n/* FILE functions */\r\nCURL_EXTERN FILE *curl_fopen(const char *file, const char *mode, int line,\r\n                             const char *source);\r\n#ifdef HAVE_FDOPEN\r\nCURL_EXTERN FILE *curl_fdopen(int filedes, const char *mode, int line,\r\n                              const char *source);\r\n#endif\r\nCURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);\r\n\r\n#ifndef MEMDEBUG_NODEFINES\r\n\r\n/* Set this symbol on the command-line, recompile all lib-sources */\r\n#undef strdup\r\n#define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)\r\n#define malloc(size) curl_domalloc(size, __LINE__, __FILE__)\r\n#define calloc(nbelem,size) curl_docalloc(nbelem, size, __LINE__, __FILE__)\r\n#define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)\r\n#define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)\r\n\r\n#define socket(domain,type,protocol)\\\r\n curl_socket(domain,type,protocol,__LINE__,__FILE__)\r\n#undef accept /* for those with accept as a macro */\r\n#define accept(sock,addr,len)\\\r\n curl_accept(sock,addr,len,__LINE__,__FILE__)\r\n#ifdef HAVE_SOCKETPAIR\r\n#define socketpair(domain,type,protocol,socket_vector)\\\r\n curl_socketpair(domain,type,protocol,socket_vector,__LINE__,__FILE__)\r\n#endif\r\n\r\n#ifdef HAVE_GETADDRINFO\r\n#if defined(getaddrinfo) && defined(__osf__)\r\n/* OSF/1 and Tru64 have getaddrinfo as a define already, so we cannot define\r\n   our macro as for other platforms. Instead, we redefine the new name they\r\n   define getaddrinfo to become! */\r\n#define ogetaddrinfo(host,serv,hint,res) \\\r\n  curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__)\r\n#else\r\n#undef getaddrinfo\r\n#define getaddrinfo(host,serv,hint,res) \\\r\n  curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__)\r\n#endif\r\n#endif /* HAVE_GETADDRINFO */\r\n\r\n#ifdef HAVE_GETNAMEINFO\r\n#undef getnameinfo\r\n#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \\\r\n  curl_dogetnameinfo(sa,salen,host,hostlen,serv,servlen,flags, __LINE__, \\\r\n  __FILE__)\r\n#endif /* HAVE_GETNAMEINFO */\r\n\r\n#ifdef HAVE_FREEADDRINFO\r\n#undef freeaddrinfo\r\n#define freeaddrinfo(data) \\\r\n  curl_dofreeaddrinfo(data,__LINE__,__FILE__)\r\n#endif /* HAVE_FREEADDRINFO */\r\n\r\n/* sclose is probably already defined, redefine it! */\r\n#undef sclose\r\n#define sclose(sockfd) curl_sclose(sockfd,__LINE__,__FILE__)\r\n\r\n#define fake_sclose(sockfd) curl_mark_sclose(sockfd,__LINE__,__FILE__)\r\n\r\n#undef fopen\r\n#define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)\r\n#undef fdopen\r\n#define fdopen(file,mode) curl_fdopen(file,mode,__LINE__,__FILE__)\r\n#define fclose(file) curl_fclose(file,__LINE__,__FILE__)\r\n\r\n#endif /* MEMDEBUG_NODEFINES */\r\n\r\n#endif /* CURLDEBUG */\r\n\r\n/*\r\n** Following section applies even when CURLDEBUG is not defined.\r\n*/\r\n\r\n#ifndef fake_sclose\r\n#define fake_sclose(x)  Curl_nop_stmt\r\n#endif\r\n\r\n/*\r\n * Curl_safefree defined as a macro to allow MemoryTracking feature\r\n * to log free() calls at same location where Curl_safefree is used.\r\n * This macro also assigns NULL to given pointer when free'd.\r\n */\r\n\r\n#define Curl_safefree(ptr) \\\r\n  do {if((ptr)) {free((ptr)); (ptr) = NULL;}} WHILE_FALSE\r\n\r\n#endif /* HEADER_CURL_MEMDEBUG_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/mprintf.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1999 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n *\r\n * Purpose:\r\n *  A merge of Bjorn Reese's format() function and Daniel's dsprintf()\r\n *  1.0. A full blooded printf() clone with full support for <num>$\r\n *  everywhere (parameters, widths and precisions) including variabled\r\n *  sized parameters (like doubles, long longs, long doubles and even\r\n *  void * in 64-bit architectures).\r\n *\r\n * Current restrictions:\r\n * - Max 128 parameters\r\n * - No 'long double' support.\r\n *\r\n * If you ever want truly portable and good *printf() clones, the project that\r\n * took on from here is named 'Trio' and you find more details on the trio web\r\n * page at http://daniel.haxx.se/trio/\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(DJGPP) && (DJGPP_MINOR < 4)\r\n#undef _MPRINTF_REPLACE /* don't use x_was_used() here */\r\n#endif\r\n\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifndef SIZEOF_LONG_DOUBLE\r\n#define SIZEOF_LONG_DOUBLE 0\r\n#endif\r\n\r\n/*\r\n * If SIZEOF_SIZE_T has not been defined, default to the size of long.\r\n */\r\n\r\n#ifndef SIZEOF_SIZE_T\r\n#  define SIZEOF_SIZE_T CURL_SIZEOF_LONG\r\n#endif\r\n\r\n#ifdef HAVE_LONGLONG\r\n#  define LONG_LONG_TYPE long long\r\n#  define HAVE_LONG_LONG_TYPE\r\n#else\r\n#  if defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)\r\n#    define LONG_LONG_TYPE __int64\r\n#    define HAVE_LONG_LONG_TYPE\r\n#  else\r\n#    undef LONG_LONG_TYPE\r\n#    undef HAVE_LONG_LONG_TYPE\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Max integer data types that mprintf.c is capable\r\n */\r\n\r\n#ifdef HAVE_LONG_LONG_TYPE\r\n#  define mp_intmax_t LONG_LONG_TYPE\r\n#  define mp_uintmax_t unsigned LONG_LONG_TYPE\r\n#else\r\n#  define mp_intmax_t long\r\n#  define mp_uintmax_t unsigned long\r\n#endif\r\n\r\n#define BUFFSIZE 256 /* buffer for long-to-str and float-to-str calcs */\r\n#define MAX_PARAMETERS 128 /* lame static limit */\r\n\r\n#ifdef __AMIGA__\r\n# undef FORMAT_INT\r\n#endif\r\n\r\n/* Lower-case digits.  */\r\nstatic const char lower_digits[] = \"0123456789abcdefghijklmnopqrstuvwxyz\";\r\n\r\n/* Upper-case digits.  */\r\nstatic const char upper_digits[] = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\r\n\r\n#define OUTCHAR(x) \\\r\n  do{ \\\r\n    if(stream((unsigned char)(x), (FILE *)data) != -1) \\\r\n      done++; \\\r\n    else \\\r\n     return done; /* return immediately on failure */ \\\r\n  } WHILE_FALSE\r\n\r\n/* Data type to read from the arglist */\r\ntypedef enum  {\r\n  FORMAT_UNKNOWN = 0,\r\n  FORMAT_STRING,\r\n  FORMAT_PTR,\r\n  FORMAT_INT,\r\n  FORMAT_INTPTR,\r\n  FORMAT_LONG,\r\n  FORMAT_LONGLONG,\r\n  FORMAT_DOUBLE,\r\n  FORMAT_LONGDOUBLE,\r\n  FORMAT_WIDTH /* For internal use */\r\n} FormatType;\r\n\r\n/* conversion and display flags */\r\nenum {\r\n  FLAGS_NEW        = 0,\r\n  FLAGS_SPACE      = 1<<0,\r\n  FLAGS_SHOWSIGN   = 1<<1,\r\n  FLAGS_LEFT       = 1<<2,\r\n  FLAGS_ALT        = 1<<3,\r\n  FLAGS_SHORT      = 1<<4,\r\n  FLAGS_LONG       = 1<<5,\r\n  FLAGS_LONGLONG   = 1<<6,\r\n  FLAGS_LONGDOUBLE = 1<<7,\r\n  FLAGS_PAD_NIL    = 1<<8,\r\n  FLAGS_UNSIGNED   = 1<<9,\r\n  FLAGS_OCTAL      = 1<<10,\r\n  FLAGS_HEX        = 1<<11,\r\n  FLAGS_UPPER      = 1<<12,\r\n  FLAGS_WIDTH      = 1<<13, /* '*' or '*<num>$' used */\r\n  FLAGS_WIDTHPARAM = 1<<14, /* width PARAMETER was specified */\r\n  FLAGS_PREC       = 1<<15, /* precision was specified */\r\n  FLAGS_PRECPARAM  = 1<<16, /* precision PARAMETER was specified */\r\n  FLAGS_CHAR       = 1<<17, /* %c story */\r\n  FLAGS_FLOATE     = 1<<18, /* %e or %E */\r\n  FLAGS_FLOATG     = 1<<19  /* %g or %G */\r\n};\r\n\r\ntypedef struct {\r\n  FormatType type;\r\n  int flags;\r\n  long width;     /* width OR width parameter number */\r\n  long precision; /* precision OR precision parameter number */\r\n  union {\r\n    char *str;\r\n    void *ptr;\r\n    union {\r\n      mp_intmax_t as_signed;\r\n      mp_uintmax_t as_unsigned;\r\n    } num;\r\n    double dnum;\r\n  } data;\r\n} va_stack_t;\r\n\r\nstruct nsprintf {\r\n  char *buffer;\r\n  size_t length;\r\n  size_t max;\r\n};\r\n\r\nstruct asprintf {\r\n  char *buffer; /* allocated buffer */\r\n  size_t len;   /* length of string */\r\n  size_t alloc; /* length of alloc */\r\n  int fail;     /* (!= 0) if an alloc has failed and thus\r\n                   the output is not the complete data */\r\n};\r\n\r\nstatic long dprintf_DollarString(char *input, char **end)\r\n{\r\n  int number=0;\r\n  while(ISDIGIT(*input)) {\r\n    number *= 10;\r\n    number += *input-'0';\r\n    input++;\r\n  }\r\n  if(number && ('$'==*input++)) {\r\n    *end = input;\r\n    return number;\r\n  }\r\n  return 0;\r\n}\r\n\r\nstatic int dprintf_IsQualifierNoDollar(char c)\r\n{\r\n  switch (c) {\r\n  case '-': case '+': case ' ': case '#': case '.':\r\n  case '0': case '1': case '2': case '3': case '4':\r\n  case '5': case '6': case '7': case '8': case '9':\r\n  case 'h': case 'l': case 'L': case 'z': case 'q':\r\n  case '*': case 'O':\r\n    return 1; /* true */\r\n  default:\r\n    return 0; /* false */\r\n  }\r\n}\r\n\r\n#ifdef DPRINTF_DEBUG2\r\nstatic void dprintf_Pass1Report(va_stack_t *vto, int max)\r\n{\r\n  int i;\r\n  char buffer[256];\r\n  int bit;\r\n  int flags;\r\n\r\n  for(i=0; i<max; i++) {\r\n    char *type;\r\n    switch(vto[i].type) {\r\n    case FORMAT_UNKNOWN:\r\n      type = \"unknown\";\r\n      break;\r\n    case FORMAT_STRING:\r\n      type =\"string\";\r\n      break;\r\n    case FORMAT_PTR:\r\n      type =\"pointer\";\r\n      break;\r\n    case FORMAT_INT:\r\n      type = \"int\";\r\n      break;\r\n    case FORMAT_INTPTR:\r\n      type = \"intptr\";\r\n      break;\r\n    case FORMAT_LONG:\r\n      type = \"long\";\r\n      break;\r\n    case FORMAT_LONGLONG:\r\n      type = \"long long\";\r\n      break;\r\n    case FORMAT_DOUBLE:\r\n      type = \"double\";\r\n      break;\r\n    case FORMAT_LONGDOUBLE:\r\n      type = \"long double\";\r\n      break;\r\n    }\r\n\r\n\r\n    buffer[0]=0;\r\n\r\n    for(bit=0; bit<31; bit++) {\r\n      flags = vto[i].flags & (1<<bit);\r\n\r\n      if(flags & FLAGS_SPACE)\r\n        strcat(buffer, \"space \");\r\n      else if(flags & FLAGS_SHOWSIGN)\r\n        strcat(buffer, \"plus \");\r\n      else if(flags & FLAGS_LEFT)\r\n        strcat(buffer, \"left \");\r\n      else if(flags & FLAGS_ALT)\r\n        strcat(buffer, \"alt \");\r\n      else if(flags & FLAGS_SHORT)\r\n        strcat(buffer, \"short \");\r\n      else if(flags & FLAGS_LONG)\r\n        strcat(buffer, \"long \");\r\n      else if(flags & FLAGS_LONGLONG)\r\n        strcat(buffer, \"longlong \");\r\n      else if(flags & FLAGS_LONGDOUBLE)\r\n        strcat(buffer, \"longdouble \");\r\n      else if(flags & FLAGS_PAD_NIL)\r\n        strcat(buffer, \"padnil \");\r\n      else if(flags & FLAGS_UNSIGNED)\r\n        strcat(buffer, \"unsigned \");\r\n      else if(flags & FLAGS_OCTAL)\r\n        strcat(buffer, \"octal \");\r\n      else if(flags & FLAGS_HEX)\r\n        strcat(buffer, \"hex \");\r\n      else if(flags & FLAGS_UPPER)\r\n        strcat(buffer, \"upper \");\r\n      else if(flags & FLAGS_WIDTH)\r\n        strcat(buffer, \"width \");\r\n      else if(flags & FLAGS_WIDTHPARAM)\r\n        strcat(buffer, \"widthparam \");\r\n      else if(flags & FLAGS_PREC)\r\n        strcat(buffer, \"precision \");\r\n      else if(flags & FLAGS_PRECPARAM)\r\n        strcat(buffer, \"precparam \");\r\n      else if(flags & FLAGS_CHAR)\r\n        strcat(buffer, \"char \");\r\n      else if(flags & FLAGS_FLOATE)\r\n        strcat(buffer, \"floate \");\r\n      else if(flags & FLAGS_FLOATG)\r\n        strcat(buffer, \"floatg \");\r\n    }\r\n    printf(\"REPORT: %d. %s [%s]\\n\", i, type, buffer);\r\n\r\n  }\r\n\r\n\r\n}\r\n#endif\r\n\r\n/******************************************************************\r\n *\r\n * Pass 1:\r\n * Create an index with the type of each parameter entry and its\r\n * value (may vary in size)\r\n *\r\n ******************************************************************/\r\n\r\nstatic long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,\r\n                          va_list arglist)\r\n{\r\n  char *fmt = (char *)format;\r\n  int param_num = 0;\r\n  long this_param;\r\n  long width;\r\n  long precision;\r\n  int flags;\r\n  long max_param=0;\r\n  long i;\r\n\r\n  while(*fmt) {\r\n    if(*fmt++ == '%') {\r\n      if(*fmt == '%') {\r\n        fmt++;\r\n        continue; /* while */\r\n      }\r\n\r\n      flags = FLAGS_NEW;\r\n\r\n      /* Handle the positional case (N$) */\r\n\r\n      param_num++;\r\n\r\n      this_param = dprintf_DollarString(fmt, &fmt);\r\n      if(0 == this_param)\r\n        /* we got no positional, get the next counter */\r\n        this_param = param_num;\r\n\r\n      if(this_param > max_param)\r\n        max_param = this_param;\r\n\r\n      /*\r\n       * The parameter with number 'i' should be used. Next, we need\r\n       * to get SIZE and TYPE of the parameter. Add the information\r\n       * to our array.\r\n       */\r\n\r\n      width = 0;\r\n      precision = 0;\r\n\r\n      /* Handle the flags */\r\n\r\n      while(dprintf_IsQualifierNoDollar(*fmt)) {\r\n        switch (*fmt++) {\r\n        case ' ':\r\n          flags |= FLAGS_SPACE;\r\n          break;\r\n        case '+':\r\n          flags |= FLAGS_SHOWSIGN;\r\n          break;\r\n        case '-':\r\n          flags |= FLAGS_LEFT;\r\n          flags &= ~FLAGS_PAD_NIL;\r\n          break;\r\n        case '#':\r\n          flags |= FLAGS_ALT;\r\n          break;\r\n        case '.':\r\n          flags |= FLAGS_PREC;\r\n          if('*' == *fmt) {\r\n            /* The precision is picked from a specified parameter */\r\n\r\n            flags |= FLAGS_PRECPARAM;\r\n            fmt++;\r\n            param_num++;\r\n\r\n            i = dprintf_DollarString(fmt, &fmt);\r\n            if(i)\r\n              precision = i;\r\n            else\r\n              precision = param_num;\r\n\r\n            if(precision > max_param)\r\n              max_param = precision;\r\n          }\r\n          else {\r\n            flags |= FLAGS_PREC;\r\n            precision = strtol(fmt, &fmt, 10);\r\n          }\r\n          break;\r\n        case 'h':\r\n          flags |= FLAGS_SHORT;\r\n          break;\r\n        case 'l':\r\n          if(flags & FLAGS_LONG)\r\n            flags |= FLAGS_LONGLONG;\r\n          else\r\n            flags |= FLAGS_LONG;\r\n          break;\r\n        case 'L':\r\n          flags |= FLAGS_LONGDOUBLE;\r\n          break;\r\n        case 'q':\r\n          flags |= FLAGS_LONGLONG;\r\n          break;\r\n        case 'z':\r\n          /* the code below generates a warning if -Wunreachable-code is\r\n             used */\r\n#if (SIZEOF_SIZE_T > CURL_SIZEOF_LONG)\r\n          flags |= FLAGS_LONGLONG;\r\n#else\r\n          flags |= FLAGS_LONG;\r\n#endif\r\n          break;\r\n        case 'O':\r\n#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)\r\n          flags |= FLAGS_LONGLONG;\r\n#else\r\n          flags |= FLAGS_LONG;\r\n#endif\r\n          break;\r\n        case '0':\r\n          if(!(flags & FLAGS_LEFT))\r\n            flags |= FLAGS_PAD_NIL;\r\n          /* FALLTHROUGH */\r\n        case '1': case '2': case '3': case '4':\r\n        case '5': case '6': case '7': case '8': case '9':\r\n          flags |= FLAGS_WIDTH;\r\n          width = strtol(fmt-1, &fmt, 10);\r\n          break;\r\n        case '*':  /* Special case */\r\n          flags |= FLAGS_WIDTHPARAM;\r\n          param_num++;\r\n\r\n          i = dprintf_DollarString(fmt, &fmt);\r\n          if(i)\r\n            width = i;\r\n          else\r\n            width = param_num;\r\n          if(width > max_param)\r\n            max_param=width;\r\n          break;\r\n        default:\r\n          break;\r\n        }\r\n      } /* switch */\r\n\r\n      /* Handle the specifier */\r\n\r\n      i = this_param - 1;\r\n\r\n      switch (*fmt) {\r\n      case 'S':\r\n        flags |= FLAGS_ALT;\r\n        /* FALLTHROUGH */\r\n      case 's':\r\n        vto[i].type = FORMAT_STRING;\r\n        break;\r\n      case 'n':\r\n        vto[i].type = FORMAT_INTPTR;\r\n        break;\r\n      case 'p':\r\n        vto[i].type = FORMAT_PTR;\r\n        break;\r\n      case 'd': case 'i':\r\n        vto[i].type = FORMAT_INT;\r\n        break;\r\n      case 'u':\r\n        vto[i].type = FORMAT_INT;\r\n        flags |= FLAGS_UNSIGNED;\r\n        break;\r\n      case 'o':\r\n        vto[i].type = FORMAT_INT;\r\n        flags |= FLAGS_OCTAL;\r\n        break;\r\n      case 'x':\r\n        vto[i].type = FORMAT_INT;\r\n        flags |= FLAGS_HEX;\r\n        break;\r\n      case 'X':\r\n        vto[i].type = FORMAT_INT;\r\n        flags |= FLAGS_HEX|FLAGS_UPPER;\r\n        break;\r\n      case 'c':\r\n        vto[i].type = FORMAT_INT;\r\n        flags |= FLAGS_CHAR;\r\n        break;\r\n      case 'f':\r\n        vto[i].type = FORMAT_DOUBLE;\r\n        break;\r\n      case 'e':\r\n        vto[i].type = FORMAT_DOUBLE;\r\n        flags |= FLAGS_FLOATE;\r\n        break;\r\n      case 'E':\r\n        vto[i].type = FORMAT_DOUBLE;\r\n        flags |= FLAGS_FLOATE|FLAGS_UPPER;\r\n        break;\r\n      case 'g':\r\n        vto[i].type = FORMAT_DOUBLE;\r\n        flags |= FLAGS_FLOATG;\r\n        break;\r\n      case 'G':\r\n        vto[i].type = FORMAT_DOUBLE;\r\n        flags |= FLAGS_FLOATG|FLAGS_UPPER;\r\n        break;\r\n      default:\r\n        vto[i].type = FORMAT_UNKNOWN;\r\n        break;\r\n      } /* switch */\r\n\r\n      vto[i].flags = flags;\r\n      vto[i].width = width;\r\n      vto[i].precision = precision;\r\n\r\n      if(flags & FLAGS_WIDTHPARAM) {\r\n        /* we have the width specified from a parameter, so we make that\r\n           parameter's info setup properly */\r\n        vto[i].width = width - 1;\r\n        i = width - 1;\r\n        vto[i].type = FORMAT_WIDTH;\r\n        vto[i].flags = FLAGS_NEW;\r\n        vto[i].precision = vto[i].width = 0; /* can't use width or precision\r\n                                                of width! */\r\n      }\r\n      if(flags & FLAGS_PRECPARAM) {\r\n        /* we have the precision specified from a parameter, so we make that\r\n           parameter's info setup properly */\r\n        vto[i].precision = precision - 1;\r\n        i = precision - 1;\r\n        vto[i].type = FORMAT_WIDTH;\r\n        vto[i].flags = FLAGS_NEW;\r\n        vto[i].precision = vto[i].width = 0; /* can't use width or precision\r\n                                                of width! */\r\n      }\r\n      *endpos++ = fmt + 1; /* end of this sequence */\r\n    }\r\n  }\r\n\r\n#ifdef DPRINTF_DEBUG2\r\n  dprintf_Pass1Report(vto, max_param);\r\n#endif\r\n\r\n  /* Read the arg list parameters into our data list */\r\n  for(i=0; i<max_param; i++) {\r\n    if((i + 1 < max_param) && (vto[i + 1].type == FORMAT_WIDTH)) {\r\n      /* Width/precision arguments must be read before the main argument\r\n       * they are attached to\r\n       */\r\n      vto[i + 1].data.num.as_signed = (mp_intmax_t)va_arg(arglist, int);\r\n    }\r\n\r\n    switch (vto[i].type) {\r\n    case FORMAT_STRING:\r\n      vto[i].data.str = va_arg(arglist, char *);\r\n      break;\r\n\r\n    case FORMAT_INTPTR:\r\n    case FORMAT_UNKNOWN:\r\n    case FORMAT_PTR:\r\n      vto[i].data.ptr = va_arg(arglist, void *);\r\n      break;\r\n\r\n    case FORMAT_INT:\r\n#ifdef HAVE_LONG_LONG_TYPE\r\n      if((vto[i].flags & FLAGS_LONGLONG) && (vto[i].flags & FLAGS_UNSIGNED))\r\n        vto[i].data.num.as_unsigned =\r\n          (mp_uintmax_t)va_arg(arglist, mp_uintmax_t);\r\n      else if(vto[i].flags & FLAGS_LONGLONG)\r\n        vto[i].data.num.as_signed =\r\n          (mp_intmax_t)va_arg(arglist, mp_intmax_t);\r\n      else\r\n#endif\r\n      {\r\n        if((vto[i].flags & FLAGS_LONG) && (vto[i].flags & FLAGS_UNSIGNED))\r\n          vto[i].data.num.as_unsigned =\r\n            (mp_uintmax_t)va_arg(arglist, unsigned long);\r\n        else if(vto[i].flags & FLAGS_LONG)\r\n          vto[i].data.num.as_signed =\r\n            (mp_intmax_t)va_arg(arglist, long);\r\n        else if(vto[i].flags & FLAGS_UNSIGNED)\r\n          vto[i].data.num.as_unsigned =\r\n            (mp_uintmax_t)va_arg(arglist, unsigned int);\r\n        else\r\n          vto[i].data.num.as_signed =\r\n            (mp_intmax_t)va_arg(arglist, int);\r\n      }\r\n      break;\r\n\r\n    case FORMAT_DOUBLE:\r\n      vto[i].data.dnum = va_arg(arglist, double);\r\n      break;\r\n\r\n    case FORMAT_WIDTH:\r\n      /* Argument has been read. Silently convert it into an integer\r\n       * for later use\r\n       */\r\n      vto[i].type = FORMAT_INT;\r\n      break;\r\n\r\n    default:\r\n      break;\r\n    }\r\n  }\r\n\r\n  return max_param;\r\n\r\n}\r\n\r\nstatic int dprintf_formatf(\r\n  void *data, /* untouched by format(), just sent to the stream() function in\r\n                 the second argument */\r\n  /* function pointer called for each output character */\r\n  int (*stream)(int, FILE *),\r\n  const char *format,    /* %-formatted string */\r\n  va_list ap_save) /* list of parameters */\r\n{\r\n  /* Base-36 digits for numbers.  */\r\n  const char *digits = lower_digits;\r\n\r\n  /* Pointer into the format string.  */\r\n  char *f;\r\n\r\n  /* Number of characters written.  */\r\n  int done = 0;\r\n\r\n  long param; /* current parameter to read */\r\n  long param_num=0; /* parameter counter */\r\n\r\n  va_stack_t vto[MAX_PARAMETERS];\r\n  char *endpos[MAX_PARAMETERS];\r\n  char **end;\r\n\r\n  char work[BUFFSIZE];\r\n\r\n  va_stack_t *p;\r\n\r\n  /* Do the actual %-code parsing */\r\n  dprintf_Pass1(format, vto, endpos, ap_save);\r\n\r\n  end = &endpos[0]; /* the initial end-position from the list dprintf_Pass1()\r\n                       created for us */\r\n\r\n  f = (char *)format;\r\n  while(*f != '\\0') {\r\n    /* Format spec modifiers.  */\r\n    int is_alt;\r\n\r\n    /* Width of a field.  */\r\n    long width;\r\n\r\n    /* Precision of a field.  */\r\n    long prec;\r\n\r\n    /* Decimal integer is negative.  */\r\n    int is_neg;\r\n\r\n    /* Base of a number to be written.  */\r\n    long base;\r\n\r\n    /* Integral values to be written.  */\r\n    mp_uintmax_t num;\r\n\r\n    /* Used to convert negative in positive.  */\r\n    mp_intmax_t signed_num;\r\n\r\n    if(*f != '%') {\r\n      /* This isn't a format spec, so write everything out until the next one\r\n         OR end of string is reached.  */\r\n      do {\r\n        OUTCHAR(*f);\r\n      } while(*++f && ('%' != *f));\r\n      continue;\r\n    }\r\n\r\n    ++f;\r\n\r\n    /* Check for \"%%\".  Note that although the ANSI standard lists\r\n       '%' as a conversion specifier, it says \"The complete format\r\n       specification shall be `%%',\" so we can avoid all the width\r\n       and precision processing.  */\r\n    if(*f == '%') {\r\n      ++f;\r\n      OUTCHAR('%');\r\n      continue;\r\n    }\r\n\r\n    /* If this is a positional parameter, the position must follow immediately\r\n       after the %, thus create a %<num>$ sequence */\r\n    param=dprintf_DollarString(f, &f);\r\n\r\n    if(!param)\r\n      param = param_num;\r\n    else\r\n      --param;\r\n\r\n    param_num++; /* increase this always to allow \"%2$s %1$s %s\" and then the\r\n                    third %s will pick the 3rd argument */\r\n\r\n    p = &vto[param];\r\n\r\n    /* pick up the specified width */\r\n    if(p->flags & FLAGS_WIDTHPARAM)\r\n      width = (long)vto[p->width].data.num.as_signed;\r\n    else\r\n      width = p->width;\r\n\r\n    /* pick up the specified precision */\r\n    if(p->flags & FLAGS_PRECPARAM) {\r\n      prec = (long)vto[p->precision].data.num.as_signed;\r\n      param_num++; /* since the precision is extraced from a parameter, we\r\n                      must skip that to get to the next one properly */\r\n    }\r\n    else if(p->flags & FLAGS_PREC)\r\n      prec = p->precision;\r\n    else\r\n      prec = -1;\r\n\r\n    is_alt = (p->flags & FLAGS_ALT) ? 1 : 0;\r\n\r\n    switch (p->type) {\r\n    case FORMAT_INT:\r\n      num = p->data.num.as_unsigned;\r\n      if(p->flags & FLAGS_CHAR) {\r\n        /* Character.  */\r\n        if(!(p->flags & FLAGS_LEFT))\r\n          while(--width > 0)\r\n            OUTCHAR(' ');\r\n        OUTCHAR((char) num);\r\n        if(p->flags & FLAGS_LEFT)\r\n          while(--width > 0)\r\n            OUTCHAR(' ');\r\n        break;\r\n      }\r\n      if(p->flags & FLAGS_UNSIGNED) {\r\n        /* Decimal unsigned integer.  */\r\n        base = 10;\r\n        goto unsigned_number;\r\n      }\r\n      if(p->flags & FLAGS_OCTAL) {\r\n        /* Octal unsigned integer.  */\r\n        base = 8;\r\n        goto unsigned_number;\r\n      }\r\n      if(p->flags & FLAGS_HEX) {\r\n        /* Hexadecimal unsigned integer.  */\r\n\r\n        digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits;\r\n        base = 16;\r\n        goto unsigned_number;\r\n      }\r\n\r\n      /* Decimal integer.  */\r\n      base = 10;\r\n\r\n      is_neg = (p->data.num.as_signed < (mp_intmax_t)0) ? 1 : 0;\r\n      if(is_neg) {\r\n        /* signed_num might fail to hold absolute negative minimum by 1 */\r\n        signed_num = p->data.num.as_signed + (mp_intmax_t)1;\r\n        signed_num = -signed_num;\r\n        num = (mp_uintmax_t)signed_num;\r\n        num += (mp_uintmax_t)1;\r\n      }\r\n\r\n      goto number;\r\n\r\n      unsigned_number:\r\n      /* Unsigned number of base BASE.  */\r\n      is_neg = 0;\r\n\r\n      number:\r\n      /* Number of base BASE.  */\r\n      {\r\n        char *workend = &work[sizeof(work) - 1];\r\n        char *w;\r\n\r\n        /* Supply a default precision if none was given.  */\r\n        if(prec == -1)\r\n          prec = 1;\r\n\r\n        /* Put the number in WORK.  */\r\n        w = workend;\r\n        while(num > 0) {\r\n          *w-- = digits[num % base];\r\n          num /= base;\r\n        }\r\n        width -= (long)(workend - w);\r\n        prec -= (long)(workend - w);\r\n\r\n        if(is_alt && base == 8 && prec <= 0) {\r\n          *w-- = '0';\r\n          --width;\r\n        }\r\n\r\n        if(prec > 0) {\r\n          width -= prec;\r\n          while(prec-- > 0)\r\n            *w-- = '0';\r\n        }\r\n\r\n        if(is_alt && base == 16)\r\n          width -= 2;\r\n\r\n        if(is_neg || (p->flags & FLAGS_SHOWSIGN) || (p->flags & FLAGS_SPACE))\r\n          --width;\r\n\r\n        if(!(p->flags & FLAGS_LEFT) && !(p->flags & FLAGS_PAD_NIL))\r\n          while(width-- > 0)\r\n            OUTCHAR(' ');\r\n\r\n        if(is_neg)\r\n          OUTCHAR('-');\r\n        else if(p->flags & FLAGS_SHOWSIGN)\r\n          OUTCHAR('+');\r\n        else if(p->flags & FLAGS_SPACE)\r\n          OUTCHAR(' ');\r\n\r\n        if(is_alt && base == 16) {\r\n          OUTCHAR('0');\r\n          if(p->flags & FLAGS_UPPER)\r\n            OUTCHAR('X');\r\n          else\r\n            OUTCHAR('x');\r\n        }\r\n\r\n        if(!(p->flags & FLAGS_LEFT) && (p->flags & FLAGS_PAD_NIL))\r\n          while(width-- > 0)\r\n            OUTCHAR('0');\r\n\r\n        /* Write the number.  */\r\n        while(++w <= workend) {\r\n          OUTCHAR(*w);\r\n        }\r\n\r\n        if(p->flags & FLAGS_LEFT)\r\n          while(width-- > 0)\r\n            OUTCHAR(' ');\r\n      }\r\n      break;\r\n\r\n    case FORMAT_STRING:\r\n            /* String.  */\r\n      {\r\n        static const char null[] = \"(nil)\";\r\n        const char *str;\r\n        size_t len;\r\n\r\n        str = (char *) p->data.str;\r\n        if(str == NULL) {\r\n          /* Write null[] if there's space.  */\r\n          if(prec == -1 || prec >= (long) sizeof(null) - 1) {\r\n            str = null;\r\n            len = sizeof(null) - 1;\r\n            /* Disable quotes around (nil) */\r\n            p->flags &= (~FLAGS_ALT);\r\n          }\r\n          else {\r\n            str = \"\";\r\n            len = 0;\r\n          }\r\n        }\r\n        else\r\n          len = strlen(str);\r\n\r\n        if(prec != -1 && (size_t) prec < len)\r\n          len = (size_t)prec;\r\n        width -= (long)len;\r\n\r\n        if(p->flags & FLAGS_ALT)\r\n          OUTCHAR('\"');\r\n\r\n        if(!(p->flags&FLAGS_LEFT))\r\n          while(width-- > 0)\r\n            OUTCHAR(' ');\r\n\r\n        while(len-- > 0)\r\n          OUTCHAR(*str++);\r\n        if(p->flags&FLAGS_LEFT)\r\n          while(width-- > 0)\r\n            OUTCHAR(' ');\r\n\r\n        if(p->flags & FLAGS_ALT)\r\n          OUTCHAR('\"');\r\n      }\r\n      break;\r\n\r\n    case FORMAT_PTR:\r\n      /* Generic pointer.  */\r\n      {\r\n        void *ptr;\r\n        ptr = (void *) p->data.ptr;\r\n        if(ptr != NULL) {\r\n          /* If the pointer is not NULL, write it as a %#x spec.  */\r\n          base = 16;\r\n          digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits;\r\n          is_alt = 1;\r\n          num = (size_t) ptr;\r\n          is_neg = 0;\r\n          goto number;\r\n        }\r\n        else {\r\n          /* Write \"(nil)\" for a nil pointer.  */\r\n          static const char strnil[] = \"(nil)\";\r\n          const char *point;\r\n\r\n          width -= (long)(sizeof(strnil) - 1);\r\n          if(p->flags & FLAGS_LEFT)\r\n            while(width-- > 0)\r\n              OUTCHAR(' ');\r\n          for(point = strnil; *point != '\\0'; ++point)\r\n            OUTCHAR(*point);\r\n          if(! (p->flags & FLAGS_LEFT))\r\n            while(width-- > 0)\r\n              OUTCHAR(' ');\r\n        }\r\n      }\r\n      break;\r\n\r\n    case FORMAT_DOUBLE:\r\n      {\r\n        char formatbuf[32]=\"%\";\r\n        char *fptr;\r\n        size_t left = sizeof(formatbuf)-strlen(formatbuf);\r\n        int len;\r\n\r\n        width = -1;\r\n        if(p->flags & FLAGS_WIDTH)\r\n          width = p->width;\r\n        else if(p->flags & FLAGS_WIDTHPARAM)\r\n          width = (long)vto[p->width].data.num.as_signed;\r\n\r\n        prec = -1;\r\n        if(p->flags & FLAGS_PREC)\r\n          prec = p->precision;\r\n        else if(p->flags & FLAGS_PRECPARAM)\r\n          prec = (long)vto[p->precision].data.num.as_signed;\r\n\r\n        if(p->flags & FLAGS_LEFT)\r\n          strcat(formatbuf, \"-\");\r\n        if(p->flags & FLAGS_SHOWSIGN)\r\n          strcat(formatbuf, \"+\");\r\n        if(p->flags & FLAGS_SPACE)\r\n          strcat(formatbuf, \" \");\r\n        if(p->flags & FLAGS_ALT)\r\n          strcat(formatbuf, \"#\");\r\n\r\n        fptr=&formatbuf[strlen(formatbuf)];\r\n\r\n        if(width >= 0) {\r\n          /* RECURSIVE USAGE */\r\n          len = curl_msnprintf(fptr, left, \"%ld\", width);\r\n          fptr += len;\r\n          left -= len;\r\n        }\r\n        if(prec >= 0) {\r\n          /* RECURSIVE USAGE */\r\n          len = curl_msnprintf(fptr, left, \".%ld\", prec);\r\n          fptr += len;\r\n        }\r\n        if(p->flags & FLAGS_LONG)\r\n          *fptr++ = 'l';\r\n\r\n        if(p->flags & FLAGS_FLOATE)\r\n          *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'E':'e');\r\n        else if(p->flags & FLAGS_FLOATG)\r\n          *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'G' : 'g');\r\n        else\r\n          *fptr++ = 'f';\r\n\r\n        *fptr = 0; /* and a final zero termination */\r\n\r\n        /* NOTE NOTE NOTE!! Not all sprintf() implementations returns number\r\n           of output characters */\r\n        (sprintf)(work, formatbuf, p->data.dnum);\r\n\r\n        for(fptr=work; *fptr; fptr++)\r\n          OUTCHAR(*fptr);\r\n      }\r\n      break;\r\n\r\n    case FORMAT_INTPTR:\r\n      /* Answer the count of characters written.  */\r\n#ifdef HAVE_LONG_LONG_TYPE\r\n      if(p->flags & FLAGS_LONGLONG)\r\n        *(LONG_LONG_TYPE *) p->data.ptr = (LONG_LONG_TYPE)done;\r\n      else\r\n#endif\r\n        if(p->flags & FLAGS_LONG)\r\n          *(long *) p->data.ptr = (long)done;\r\n      else if(!(p->flags & FLAGS_SHORT))\r\n        *(int *) p->data.ptr = (int)done;\r\n      else\r\n        *(short *) p->data.ptr = (short)done;\r\n      break;\r\n\r\n    default:\r\n      break;\r\n    }\r\n    f = *end++; /* goto end of %-code */\r\n\r\n  }\r\n  return done;\r\n}\r\n\r\n/* fputc() look-alike */\r\nstatic int addbyter(int output, FILE *data)\r\n{\r\n  struct nsprintf *infop=(struct nsprintf *)data;\r\n  unsigned char outc = (unsigned char)output;\r\n\r\n  if(infop->length < infop->max) {\r\n    /* only do this if we haven't reached max length yet */\r\n    infop->buffer[0] = outc; /* store */\r\n    infop->buffer++; /* increase pointer */\r\n    infop->length++; /* we are now one byte larger */\r\n    return outc;     /* fputc() returns like this on success */\r\n  }\r\n  return -1;\r\n}\r\n\r\nint curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,\r\n                    va_list ap_save)\r\n{\r\n  int retcode;\r\n  struct nsprintf info;\r\n\r\n  info.buffer = buffer;\r\n  info.length = 0;\r\n  info.max = maxlength;\r\n\r\n  retcode = dprintf_formatf(&info, addbyter, format, ap_save);\r\n  if(info.max) {\r\n    /* we terminate this with a zero byte */\r\n    if(info.max == info.length)\r\n      /* we're at maximum, scrap the last letter */\r\n      info.buffer[-1] = 0;\r\n    else\r\n      info.buffer[0] = 0;\r\n  }\r\n  return retcode;\r\n}\r\n\r\nint curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...)\r\n{\r\n  int retcode;\r\n  va_list ap_save; /* argument pointer */\r\n  va_start(ap_save, format);\r\n  retcode = curl_mvsnprintf(buffer, maxlength, format, ap_save);\r\n  va_end(ap_save);\r\n  return retcode;\r\n}\r\n\r\n/* fputc() look-alike */\r\nstatic int alloc_addbyter(int output, FILE *data)\r\n{\r\n  struct asprintf *infop=(struct asprintf *)data;\r\n  unsigned char outc = (unsigned char)output;\r\n\r\n  if(!infop->buffer) {\r\n    infop->buffer = malloc(32);\r\n    if(!infop->buffer) {\r\n      infop->fail = 1;\r\n      return -1; /* fail */\r\n    }\r\n    infop->alloc = 32;\r\n    infop->len =0;\r\n  }\r\n  else if(infop->len+1 >= infop->alloc) {\r\n    char *newptr;\r\n\r\n    newptr = realloc(infop->buffer, infop->alloc*2);\r\n\r\n    if(!newptr) {\r\n      infop->fail = 1;\r\n      return -1; /* fail */\r\n    }\r\n    infop->buffer = newptr;\r\n    infop->alloc *= 2;\r\n  }\r\n\r\n  infop->buffer[ infop->len ] = outc;\r\n\r\n  infop->len++;\r\n\r\n  return outc; /* fputc() returns like this on success */\r\n}\r\n\r\nchar *curl_maprintf(const char *format, ...)\r\n{\r\n  va_list ap_save; /* argument pointer */\r\n  int retcode;\r\n  struct asprintf info;\r\n\r\n  info.buffer = NULL;\r\n  info.len = 0;\r\n  info.alloc = 0;\r\n  info.fail = 0;\r\n\r\n  va_start(ap_save, format);\r\n  retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);\r\n  va_end(ap_save);\r\n  if((-1 == retcode) || info.fail) {\r\n    if(info.alloc)\r\n      free(info.buffer);\r\n    return NULL;\r\n  }\r\n  if(info.alloc) {\r\n    info.buffer[info.len] = 0; /* we terminate this with a zero byte */\r\n    return info.buffer;\r\n  }\r\n  else\r\n    return strdup(\"\");\r\n}\r\n\r\nchar *curl_mvaprintf(const char *format, va_list ap_save)\r\n{\r\n  int retcode;\r\n  struct asprintf info;\r\n\r\n  info.buffer = NULL;\r\n  info.len = 0;\r\n  info.alloc = 0;\r\n  info.fail = 0;\r\n\r\n  retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);\r\n  if((-1 == retcode) || info.fail) {\r\n    if(info.alloc)\r\n      free(info.buffer);\r\n    return NULL;\r\n  }\r\n\r\n  if(info.alloc) {\r\n    info.buffer[info.len] = 0; /* we terminate this with a zero byte */\r\n    return info.buffer;\r\n  }\r\n  else\r\n    return strdup(\"\");\r\n}\r\n\r\nstatic int storebuffer(int output, FILE *data)\r\n{\r\n  char **buffer = (char **)data;\r\n  unsigned char outc = (unsigned char)output;\r\n  **buffer = outc;\r\n  (*buffer)++;\r\n  return outc; /* act like fputc() ! */\r\n}\r\n\r\nint curl_msprintf(char *buffer, const char *format, ...)\r\n{\r\n  va_list ap_save; /* argument pointer */\r\n  int retcode;\r\n  va_start(ap_save, format);\r\n  retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);\r\n  va_end(ap_save);\r\n  *buffer=0; /* we terminate this with a zero byte */\r\n  return retcode;\r\n}\r\n\r\nint curl_mprintf(const char *format, ...)\r\n{\r\n  int retcode;\r\n  va_list ap_save; /* argument pointer */\r\n  va_start(ap_save, format);\r\n\r\n  retcode = dprintf_formatf(stdout, fputc, format, ap_save);\r\n  va_end(ap_save);\r\n  return retcode;\r\n}\r\n\r\nint curl_mfprintf(FILE *whereto, const char *format, ...)\r\n{\r\n  int retcode;\r\n  va_list ap_save; /* argument pointer */\r\n  va_start(ap_save, format);\r\n  retcode = dprintf_formatf(whereto, fputc, format, ap_save);\r\n  va_end(ap_save);\r\n  return retcode;\r\n}\r\n\r\nint curl_mvsprintf(char *buffer, const char *format, va_list ap_save)\r\n{\r\n  int retcode;\r\n  retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);\r\n  *buffer=0; /* we terminate this with a zero byte */\r\n  return retcode;\r\n}\r\n\r\nint curl_mvprintf(const char *format, va_list ap_save)\r\n{\r\n  return dprintf_formatf(stdout, fputc, format, ap_save);\r\n}\r\n\r\nint curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save)\r\n{\r\n  return dprintf_formatf(whereto, fputc, format, ap_save);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/multi.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4127 : conditional expression is constant\r\n#pragma warning( disable : 4127 )\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"transfer.h\"\r\n#include \"url.h\"\r\n#include \"connect.h\"\r\n#include \"progress.h\"\r\n#include \"easyif.h\"\r\n#include \"multiif.h\"\r\n#include \"sendf.h\"\r\n#include \"timeval.h\"\r\n#include \"http.h\"\r\n#include \"select.h\"\r\n#include \"warnless.h\"\r\n#include \"speedcheck.h\"\r\n#include \"conncache.h\"\r\n#include \"bundles.h\"\r\n#include \"multihandle.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n  CURL_SOCKET_HASH_TABLE_SIZE should be a prime number. Increasing it from 97\r\n  to 911 takes on a 32-bit machine 4 x 804 = 3211 more bytes.  Still, every\r\n  CURL handle takes 45-50 K memory, therefore this 3K are not significant.\r\n*/\r\n#ifndef CURL_SOCKET_HASH_TABLE_SIZE\r\n#define CURL_SOCKET_HASH_TABLE_SIZE 911\r\n#endif\r\n\r\n\r\n#define CURL_MULTI_HANDLE 0x000bab1e\r\n\r\n#define GOOD_MULTI_HANDLE(x) \\\r\n  ((x) && (((struct Curl_multi *)(x))->type == CURL_MULTI_HANDLE))\r\n#define GOOD_EASY_HANDLE(x) \\\r\n  ((x) && (((struct SessionHandle *)(x))->magic == CURLEASY_MAGIC_NUMBER))\r\n\r\nstatic void singlesocket(struct Curl_multi *multi,\r\n                         struct Curl_one_easy *easy);\r\nstatic int update_timer(struct Curl_multi *multi);\r\n\r\nstatic CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle,\r\n                                              struct connectdata *conn);\r\nstatic int checkPendPipeline(struct connectdata *conn);\r\nstatic void moveHandleFromSendToRecvPipeline(struct SessionHandle *handle,\r\n                                             struct connectdata *conn);\r\nstatic void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle,\r\n                                             struct connectdata *conn);\r\nstatic bool isHandleAtHead(struct SessionHandle *handle,\r\n                           struct curl_llist *pipeline);\r\nstatic CURLMcode add_next_timeout(struct timeval now,\r\n                                  struct Curl_multi *multi,\r\n                                  struct SessionHandle *d);\r\n\r\n#ifdef DEBUGBUILD\r\nstatic const char * const statename[]={\r\n  \"INIT\",\r\n  \"CONNECT\",\r\n  \"WAITRESOLVE\",\r\n  \"WAITCONNECT\",\r\n  \"WAITPROXYCONNECT\",\r\n  \"PROTOCONNECT\",\r\n  \"WAITDO\",\r\n  \"DO\",\r\n  \"DOING\",\r\n  \"DO_MORE\",\r\n  \"DO_DONE\",\r\n  \"WAITPERFORM\",\r\n  \"PERFORM\",\r\n  \"TOOFAST\",\r\n  \"DONE\",\r\n  \"COMPLETED\",\r\n  \"MSGSENT\",\r\n};\r\n#endif\r\n\r\nstatic void multi_freetimeout(void *a, void *b);\r\n\r\n/* always use this function to change state, to make debugging easier */\r\nstatic void mstate(struct Curl_one_easy *easy, CURLMstate state\r\n#ifdef DEBUGBUILD\r\n                   , int lineno\r\n#endif\r\n)\r\n{\r\n#ifdef DEBUGBUILD\r\n  long connection_id = -5000;\r\n#endif\r\n  CURLMstate oldstate = easy->state;\r\n\r\n  if(oldstate == state)\r\n    /* don't bother when the new state is the same as the old state */\r\n    return;\r\n\r\n  easy->state = state;\r\n\r\n#ifdef DEBUGBUILD\r\n  if(easy->easy_conn) {\r\n    if(easy->state > CURLM_STATE_CONNECT &&\r\n       easy->state < CURLM_STATE_COMPLETED)\r\n      connection_id = easy->easy_conn->connection_id;\r\n\r\n    infof(easy->easy_handle,\r\n          \"STATE: %s => %s handle %p; line %d (connection #%ld) \\n\",\r\n          statename[oldstate], statename[easy->state],\r\n          (char *)easy, lineno, connection_id);\r\n  }\r\n#endif\r\n  if(state == CURLM_STATE_COMPLETED)\r\n    /* changing to COMPLETED means there's one less easy handle 'alive' */\r\n    easy->easy_handle->multi->num_alive--;\r\n}\r\n\r\n#ifndef DEBUGBUILD\r\n#define multistate(x,y) mstate(x,y)\r\n#else\r\n#define multistate(x,y) mstate(x,y, __LINE__)\r\n#endif\r\n\r\n/*\r\n * We add one of these structs to the sockhash for a particular socket\r\n */\r\n\r\nstruct Curl_sh_entry {\r\n  struct SessionHandle *easy;\r\n  time_t timestamp;\r\n  int action;  /* what action READ/WRITE this socket waits for */\r\n  curl_socket_t socket; /* mainly to ease debugging */\r\n  void *socketp; /* settable by users with curl_multi_assign() */\r\n};\r\n/* bits for 'action' having no bits means this socket is not expecting any\r\n   action */\r\n#define SH_READ  1\r\n#define SH_WRITE 2\r\n\r\n/* make sure this socket is present in the hash for this handle */\r\nstatic struct Curl_sh_entry *sh_addentry(struct curl_hash *sh,\r\n                                         curl_socket_t s,\r\n                                         struct SessionHandle *data)\r\n{\r\n  struct Curl_sh_entry *there =\r\n    Curl_hash_pick(sh, (char *)&s, sizeof(curl_socket_t));\r\n  struct Curl_sh_entry *check;\r\n\r\n  if(there)\r\n    /* it is present, return fine */\r\n    return there;\r\n\r\n  /* not present, add it */\r\n  check = calloc(1, sizeof(struct Curl_sh_entry));\r\n  if(!check)\r\n    return NULL; /* major failure */\r\n  check->easy = data;\r\n  check->socket = s;\r\n\r\n  /* make/add new hash entry */\r\n  if(NULL == Curl_hash_add(sh, (char *)&s, sizeof(curl_socket_t), check)) {\r\n    free(check);\r\n    return NULL; /* major failure */\r\n  }\r\n\r\n  return check; /* things are good in sockhash land */\r\n}\r\n\r\n\r\n/* delete the given socket + handle from the hash */\r\nstatic void sh_delentry(struct curl_hash *sh, curl_socket_t s)\r\n{\r\n  struct Curl_sh_entry *there =\r\n    Curl_hash_pick(sh, (char *)&s, sizeof(curl_socket_t));\r\n\r\n  if(there) {\r\n    /* this socket is in the hash */\r\n    /* We remove the hash entry. (This'll end up in a call to\r\n       sh_freeentry().) */\r\n    Curl_hash_delete(sh, (char *)&s, sizeof(curl_socket_t));\r\n  }\r\n}\r\n\r\n/*\r\n * free a sockhash entry\r\n */\r\nstatic void sh_freeentry(void *freethis)\r\n{\r\n  struct Curl_sh_entry *p = (struct Curl_sh_entry *) freethis;\r\n\r\n  if(p)\r\n    free(p);\r\n}\r\n\r\nstatic size_t fd_key_compare(void*k1, size_t k1_len, void*k2, size_t k2_len)\r\n{\r\n  (void) k1_len; (void) k2_len;\r\n\r\n  return (*((int* ) k1)) == (*((int* ) k2));\r\n}\r\n\r\nstatic size_t hash_fd(void* key, size_t key_length, size_t slots_num)\r\n{\r\n  int fd = * ((int* ) key);\r\n  (void) key_length;\r\n\r\n  return (fd % (int)slots_num);\r\n}\r\n\r\n/*\r\n * sh_init() creates a new socket hash and returns the handle for it.\r\n *\r\n * Quote from README.multi_socket:\r\n *\r\n * \"Some tests at 7000 and 9000 connections showed that the socket hash lookup\r\n * is somewhat of a bottle neck. Its current implementation may be a bit too\r\n * limiting. It simply has a fixed-size array, and on each entry in the array\r\n * it has a linked list with entries. So the hash only checks which list to\r\n * scan through. The code I had used so for used a list with merely 7 slots\r\n * (as that is what the DNS hash uses) but with 7000 connections that would\r\n * make an average of 1000 nodes in each list to run through. I upped that to\r\n * 97 slots (I believe a prime is suitable) and noticed a significant speed\r\n * increase.  I need to reconsider the hash implementation or use a rather\r\n * large default value like this. At 9000 connections I was still below 10us\r\n * per call.\"\r\n *\r\n */\r\nstatic struct curl_hash *sh_init(void)\r\n{\r\n  return Curl_hash_alloc(CURL_SOCKET_HASH_TABLE_SIZE, hash_fd, fd_key_compare,\r\n                         sh_freeentry);\r\n}\r\n\r\n/*\r\n * multi_addmsg()\r\n *\r\n * Called when a transfer is completed. Adds the given msg pointer to\r\n * the list kept in the multi handle.\r\n */\r\nstatic CURLMcode multi_addmsg(struct Curl_multi *multi,\r\n                              struct Curl_message *msg)\r\n{\r\n  if(!Curl_llist_insert_next(multi->msglist, multi->msglist->tail, msg))\r\n    return CURLM_OUT_OF_MEMORY;\r\n\r\n  return CURLM_OK;\r\n}\r\n\r\n/*\r\n * multi_freeamsg()\r\n *\r\n * Callback used by the llist system when a single list entry is destroyed.\r\n */\r\nstatic void multi_freeamsg(void *a, void *b)\r\n{\r\n  (void)a;\r\n  (void)b;\r\n}\r\n\r\nCURLM *curl_multi_init(void)\r\n{\r\n  struct Curl_multi *multi = calloc(1, sizeof(struct Curl_multi));\r\n\r\n  if(!multi)\r\n    return NULL;\r\n\r\n  multi->type = CURL_MULTI_HANDLE;\r\n\r\n  multi->hostcache = Curl_mk_dnscache();\r\n  if(!multi->hostcache)\r\n    goto error;\r\n\r\n  multi->sockhash = sh_init();\r\n  if(!multi->sockhash)\r\n    goto error;\r\n\r\n  multi->conn_cache = Curl_conncache_init();\r\n  if(!multi->conn_cache)\r\n    goto error;\r\n\r\n  multi->msglist = Curl_llist_alloc(multi_freeamsg);\r\n  if(!multi->msglist)\r\n    goto error;\r\n\r\n  /* Let's make the doubly-linked list a circular list.  This makes\r\n     the linked list code simpler and allows inserting at the end\r\n     with less work (we didn't keep a tail pointer before). */\r\n  multi->easy.next = &multi->easy;\r\n  multi->easy.prev = &multi->easy;\r\n\r\n  return (CURLM *) multi;\r\n\r\n  error:\r\n\r\n  Curl_hash_destroy(multi->sockhash);\r\n  multi->sockhash = NULL;\r\n  Curl_hash_destroy(multi->hostcache);\r\n  multi->hostcache = NULL;\r\n  Curl_conncache_destroy(multi->conn_cache);\r\n  multi->conn_cache = NULL;\r\n\r\n  free(multi);\r\n  return NULL;\r\n}\r\n\r\nCURLMcode curl_multi_add_handle(CURLM *multi_handle,\r\n                                CURL *easy_handle)\r\n{\r\n  struct curl_llist *timeoutlist;\r\n  struct Curl_one_easy *easy;\r\n  struct Curl_multi *multi = (struct Curl_multi *)multi_handle;\r\n  struct SessionHandle *data = (struct SessionHandle *)easy_handle;\r\n  struct SessionHandle *new_closure = NULL;\r\n  struct curl_hash *hostcache = NULL;\r\n\r\n  /* First, make some basic checks that the CURLM handle is a good handle */\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  /* Verify that we got a somewhat good easy handle too */\r\n  if(!GOOD_EASY_HANDLE(easy_handle))\r\n    return CURLM_BAD_EASY_HANDLE;\r\n\r\n  /* Prevent users from adding same easy handle more than\r\n     once and prevent adding to more than one multi stack */\r\n  if(data->multi)\r\n    /* possibly we should create a new unique error code for this condition */\r\n    return CURLM_BAD_EASY_HANDLE;\r\n\r\n  /* Allocate and initialize timeout list for easy handle */\r\n  timeoutlist = Curl_llist_alloc(multi_freetimeout);\r\n  if(!timeoutlist)\r\n    return CURLM_OUT_OF_MEMORY;\r\n\r\n  /* Allocate new node for the doubly-linked circular list of\r\n     Curl_one_easy structs that holds pointers to easy handles */\r\n  easy = calloc(1, sizeof(struct Curl_one_easy));\r\n  if(!easy) {\r\n    Curl_llist_destroy(timeoutlist, NULL);\r\n    return CURLM_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* In case multi handle has no hostcache yet, allocate one */\r\n  if(!multi->hostcache) {\r\n    hostcache = Curl_mk_dnscache();\r\n    if(!hostcache) {\r\n      free(easy);\r\n      Curl_llist_destroy(timeoutlist, NULL);\r\n      return CURLM_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* In case multi handle has no closure_handle yet, allocate\r\n     a new easy handle to use when closing cached connections */\r\n  if(!multi->closure_handle) {\r\n    new_closure = (struct SessionHandle *)curl_easy_init();\r\n    if(!new_closure) {\r\n      Curl_hash_destroy(hostcache);\r\n      free(easy);\r\n      Curl_llist_destroy(timeoutlist, NULL);\r\n      return CURLM_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /*\r\n  ** No failure allowed in this function beyond this point. And\r\n  ** no modification of easy nor multi handle allowed before this\r\n  ** except for potential multi's connection cache growing which\r\n  ** won't be undone in this function no matter what.\r\n  */\r\n\r\n  /* In case a new closure handle has been initialized above, it\r\n     is associated now with the multi handle which lacked one. */\r\n  if(new_closure) {\r\n    multi->closure_handle = new_closure;\r\n    Curl_easy_addmulti(multi->closure_handle, multi_handle);\r\n    multi->closure_handle->state.conn_cache = multi->conn_cache;\r\n  }\r\n\r\n  /* In case hostcache has been allocated above,\r\n     it is associated now with the multi handle. */\r\n  if(hostcache)\r\n    multi->hostcache = hostcache;\r\n\r\n  /* Make easy handle use timeout list initialized above */\r\n  data->state.timeoutlist = timeoutlist;\r\n  timeoutlist = NULL;\r\n\r\n  /* set the easy handle */\r\n  easy->easy_handle = data;\r\n  multistate(easy, CURLM_STATE_INIT);\r\n\r\n  /* set the back pointer to one_easy to assist in removal */\r\n  easy->easy_handle->multi_pos =  easy;\r\n\r\n  /* for multi interface connections, we share DNS cache automatically if the\r\n     easy handle's one is currently not set. */\r\n  if(!easy->easy_handle->dns.hostcache ||\r\n     (easy->easy_handle->dns.hostcachetype == HCACHE_NONE)) {\r\n    easy->easy_handle->dns.hostcache = multi->hostcache;\r\n    easy->easy_handle->dns.hostcachetype = HCACHE_MULTI;\r\n  }\r\n\r\n  /* Point to the multi's connection cache */\r\n  easy->easy_handle->state.conn_cache = multi->conn_cache;\r\n\r\n  /* This adds the new entry at the 'end' of the doubly-linked circular\r\n     list of Curl_one_easy structs to try and maintain a FIFO queue so\r\n     the pipelined requests are in order. */\r\n\r\n  /* We add this new entry last in the list. We make our 'next' point to the\r\n     'first' struct and our 'prev' point to the previous 'prev' */\r\n  easy->next = &multi->easy;\r\n  easy->prev = multi->easy.prev;\r\n\r\n  /* make 'easy' the last node in the chain */\r\n  multi->easy.prev = easy;\r\n\r\n  /* if there was a prev node, make sure its 'next' pointer links to\r\n     the new node */\r\n  easy->prev->next = easy;\r\n\r\n  /* make the SessionHandle refer back to this multi handle */\r\n  Curl_easy_addmulti(easy_handle, multi_handle);\r\n\r\n  /* make the SessionHandle struct refer back to this struct */\r\n  easy->easy_handle->set.one_easy = easy;\r\n\r\n  /* Set the timeout for this handle to expire really soon so that it will\r\n     be taken care of even when this handle is added in the midst of operation\r\n     when only the curl_multi_socket() API is used. During that flow, only\r\n     sockets that time-out or have actions will be dealt with. Since this\r\n     handle has no action yet, we make sure it times out to get things to\r\n     happen. */\r\n  Curl_expire(easy->easy_handle, 1);\r\n\r\n  /* increase the node-counter */\r\n  multi->num_easy++;\r\n\r\n  /* increase the alive-counter */\r\n  multi->num_alive++;\r\n\r\n  /* A somewhat crude work-around for a little glitch in update_timer() that\r\n     happens if the lastcall time is set to the same time when the handle is\r\n     removed as when the next handle is added, as then the check in\r\n     update_timer() that prevents calling the application multiple times with\r\n     the same timer infor will not trigger and then the new handle's timeout\r\n     will not be notified to the app.\r\n\r\n     The work-around is thus simply to clear the 'lastcall' variable to force\r\n     update_timer() to always trigger a callback to the app when a new easy\r\n     handle is added */\r\n  memset(&multi->timer_lastcall, 0, sizeof(multi->timer_lastcall));\r\n\r\n  update_timer(multi);\r\n  return CURLM_OK;\r\n}\r\n\r\n#if 0\r\n/* Debug-function, used like this:\r\n *\r\n * Curl_hash_print(multi->sockhash, debug_print_sock_hash);\r\n *\r\n * Enable the hash print function first by editing hash.c\r\n */\r\nstatic void debug_print_sock_hash(void *p)\r\n{\r\n  struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p;\r\n\r\n  fprintf(stderr, \" [easy %p/magic %x/socket %d]\",\r\n          (void *)sh->easy, sh->easy->magic, (int)sh->socket);\r\n}\r\n#endif\r\n\r\nCURLMcode curl_multi_remove_handle(CURLM *multi_handle,\r\n                                   CURL *curl_handle)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_one_easy *easy;\r\n  struct SessionHandle *data = curl_handle;\r\n\r\n  /* First, make some basic checks that the CURLM handle is a good handle */\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  /* Verify that we got a somewhat good easy handle too */\r\n  if(!GOOD_EASY_HANDLE(curl_handle))\r\n    return CURLM_BAD_EASY_HANDLE;\r\n\r\n  /* pick-up from the 'curl_handle' the kept position in the list */\r\n  easy = data->multi_pos;\r\n\r\n  if(easy) {\r\n    bool premature = (easy->state < CURLM_STATE_COMPLETED) ? TRUE : FALSE;\r\n    bool easy_owns_conn = (easy->easy_conn &&\r\n                           (easy->easy_conn->data == easy->easy_handle)) ?\r\n                           TRUE : FALSE;\r\n\r\n    /* If the 'state' is not INIT or COMPLETED, we might need to do something\r\n       nice to put the easy_handle in a good known state when this returns. */\r\n    if(premature)\r\n      /* this handle is \"alive\" so we need to count down the total number of\r\n         alive connections when this is removed */\r\n      multi->num_alive--;\r\n\r\n    if(easy->easy_conn &&\r\n       (easy->easy_conn->send_pipe->size +\r\n        easy->easy_conn->recv_pipe->size > 1) &&\r\n       easy->state > CURLM_STATE_WAITDO &&\r\n       easy->state < CURLM_STATE_COMPLETED) {\r\n      /* If the handle is in a pipeline and has started sending off its\r\n         request but not received its response yet, we need to close\r\n         connection. */\r\n      easy->easy_conn->bits.close = TRUE;\r\n      /* Set connection owner so that Curl_done() closes it.\r\n         We can sefely do this here since connection is killed. */\r\n      easy->easy_conn->data = easy->easy_handle;\r\n    }\r\n\r\n    /* The timer must be shut down before easy->multi is set to NULL,\r\n       else the timenode will remain in the splay tree after\r\n       curl_easy_cleanup is called. */\r\n    Curl_expire(easy->easy_handle, 0);\r\n\r\n    /* destroy the timeout list that is held in the easy handle */\r\n    if(data->state.timeoutlist) {\r\n      Curl_llist_destroy(data->state.timeoutlist, NULL);\r\n      data->state.timeoutlist = NULL;\r\n    }\r\n\r\n    if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) {\r\n      /* stop using the multi handle's DNS cache */\r\n      easy->easy_handle->dns.hostcache = NULL;\r\n      easy->easy_handle->dns.hostcachetype = HCACHE_NONE;\r\n    }\r\n\r\n    if(easy->easy_conn) {\r\n\r\n      /* we must call Curl_done() here (if we still \"own it\") so that we don't\r\n         leave a half-baked one around */\r\n      if(easy_owns_conn) {\r\n\r\n        /* Curl_done() clears the conn->data field to lose the association\r\n           between the easy handle and the connection\r\n\r\n           Note that this ignores the return code simply because there's\r\n           nothing really useful to do with it anyway! */\r\n        (void)Curl_done(&easy->easy_conn, easy->result, premature);\r\n      }\r\n      else\r\n        /* Clear connection pipelines, if Curl_done above was not called */\r\n        Curl_getoff_all_pipelines(easy->easy_handle, easy->easy_conn);\r\n    }\r\n\r\n    /* as this was using a shared connection cache we clear the pointer\r\n       to that since we're not part of that multi handle anymore */\r\n    easy->easy_handle->state.conn_cache = NULL;\r\n\r\n    /* change state without using multistate(), only to make singlesocket() do\r\n       what we want */\r\n    easy->state = CURLM_STATE_COMPLETED;\r\n    singlesocket(multi, easy); /* to let the application know what sockets\r\n                                  that vanish with this handle */\r\n\r\n    /* Remove the association between the connection and the handle */\r\n    if(easy->easy_conn) {\r\n      easy->easy_conn->data = NULL;\r\n      easy->easy_conn = NULL;\r\n    }\r\n\r\n    Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association\r\n                                                    to this multi handle */\r\n\r\n    {\r\n      /* make sure there's no pending message in the queue sent from this easy\r\n         handle */\r\n      struct curl_llist_element *e;\r\n\r\n      for(e = multi->msglist->head; e; e = e->next) {\r\n        struct Curl_message *msg = e->ptr;\r\n\r\n        if(msg->extmsg.easy_handle == easy->easy_handle) {\r\n          Curl_llist_remove(multi->msglist, e, NULL);\r\n          /* there can only be one from this specific handle */\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* make the previous node point to our next */\r\n    if(easy->prev)\r\n      easy->prev->next = easy->next;\r\n    /* make our next point to our previous node */\r\n    if(easy->next)\r\n      easy->next->prev = easy->prev;\r\n\r\n    easy->easy_handle->set.one_easy = NULL; /* detached */\r\n\r\n    /* Null the position in the controlling structure */\r\n    easy->easy_handle->multi_pos = NULL;\r\n\r\n    /* NOTE NOTE NOTE\r\n       We do not touch the easy handle here! */\r\n    free(easy);\r\n\r\n    multi->num_easy--; /* one less to care about now */\r\n\r\n    update_timer(multi);\r\n    return CURLM_OK;\r\n  }\r\n  else\r\n    return CURLM_BAD_EASY_HANDLE; /* twasn't found */\r\n}\r\n\r\nbool Curl_multi_canPipeline(const struct Curl_multi* multi)\r\n{\r\n  return multi->pipelining_enabled;\r\n}\r\n\r\nvoid Curl_multi_handlePipeBreak(struct SessionHandle *data)\r\n{\r\n  struct Curl_one_easy *one_easy = data->set.one_easy;\r\n\r\n  if(one_easy)\r\n    one_easy->easy_conn = NULL;\r\n}\r\n\r\nstatic int waitconnect_getsock(struct connectdata *conn,\r\n                               curl_socket_t *sock,\r\n                               int numsocks)\r\n{\r\n  if(!numsocks)\r\n    return GETSOCK_BLANK;\r\n\r\n  sock[0] = conn->sock[FIRSTSOCKET];\r\n\r\n  /* when we've sent a CONNECT to a proxy, we should rather wait for the\r\n     socket to become readable to be able to get the response headers */\r\n  if(conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)\r\n    return GETSOCK_READSOCK(0);\r\n\r\n  return GETSOCK_WRITESOCK(0);\r\n}\r\n\r\nstatic int domore_getsock(struct connectdata *conn,\r\n                          curl_socket_t *socks,\r\n                          int numsocks)\r\n{\r\n  if(conn && conn->handler->domore_getsock)\r\n    return conn->handler->domore_getsock(conn, socks, numsocks);\r\n  return GETSOCK_BLANK;\r\n}\r\n\r\n/* returns bitmapped flags for this handle and its sockets */\r\nstatic int multi_getsock(struct Curl_one_easy *easy,\r\n                         curl_socket_t *socks, /* points to numsocks number\r\n                                                  of sockets */\r\n                         int numsocks)\r\n{\r\n  /* If the pipe broke, or if there's no connection left for this easy handle,\r\n     then we MUST bail out now with no bitmask set. The no connection case can\r\n     happen when this is called from curl_multi_remove_handle() =>\r\n     singlesocket() => multi_getsock().\r\n  */\r\n  if(easy->easy_handle->state.pipe_broke || !easy->easy_conn)\r\n    return 0;\r\n\r\n  if(easy->state > CURLM_STATE_CONNECT &&\r\n     easy->state < CURLM_STATE_COMPLETED) {\r\n    /* Set up ownership correctly */\r\n    easy->easy_conn->data = easy->easy_handle;\r\n  }\r\n\r\n  switch(easy->state) {\r\n  default:\r\n#if 0 /* switch back on these cases to get the compiler to check for all enums\r\n         to be present */\r\n  case CURLM_STATE_TOOFAST:  /* returns 0, so will not select. */\r\n  case CURLM_STATE_COMPLETED:\r\n  case CURLM_STATE_MSGSENT:\r\n  case CURLM_STATE_INIT:\r\n  case CURLM_STATE_CONNECT:\r\n  case CURLM_STATE_WAITDO:\r\n  case CURLM_STATE_DONE:\r\n  case CURLM_STATE_LAST:\r\n    /* this will get called with CURLM_STATE_COMPLETED when a handle is\r\n       removed */\r\n#endif\r\n    return 0;\r\n\r\n  case CURLM_STATE_WAITRESOLVE:\r\n    return Curl_resolver_getsock(easy->easy_conn, socks, numsocks);\r\n\r\n  case CURLM_STATE_PROTOCONNECT:\r\n    return Curl_protocol_getsock(easy->easy_conn, socks, numsocks);\r\n\r\n  case CURLM_STATE_DO:\r\n  case CURLM_STATE_DOING:\r\n    return Curl_doing_getsock(easy->easy_conn, socks, numsocks);\r\n\r\n  case CURLM_STATE_WAITPROXYCONNECT:\r\n  case CURLM_STATE_WAITCONNECT:\r\n    return waitconnect_getsock(easy->easy_conn, socks, numsocks);\r\n\r\n  case CURLM_STATE_DO_MORE:\r\n    return domore_getsock(easy->easy_conn, socks, numsocks);\r\n\r\n  case CURLM_STATE_DO_DONE: /* since is set after DO is completed, we switch\r\n                               to waiting for the same as the *PERFORM\r\n                               states */\r\n  case CURLM_STATE_PERFORM:\r\n  case CURLM_STATE_WAITPERFORM:\r\n    return Curl_single_getsock(easy->easy_conn, socks, numsocks);\r\n  }\r\n\r\n}\r\n\r\nCURLMcode curl_multi_fdset(CURLM *multi_handle,\r\n                           fd_set *read_fd_set, fd_set *write_fd_set,\r\n                           fd_set *exc_fd_set, int *max_fd)\r\n{\r\n  /* Scan through all the easy handles to get the file descriptors set.\r\n     Some easy handles may not have connected to the remote host yet,\r\n     and then we must make sure that is done. */\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_one_easy *easy;\r\n  int this_max_fd=-1;\r\n  curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE];\r\n  int bitmap;\r\n  int i;\r\n  (void)exc_fd_set; /* not used */\r\n\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  easy=multi->easy.next;\r\n  while(easy != &multi->easy) {\r\n    bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE);\r\n\r\n    for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) {\r\n      curl_socket_t s = CURL_SOCKET_BAD;\r\n\r\n      if((bitmap & GETSOCK_READSOCK(i)) && VALID_SOCK((sockbunch[i]))) {\r\n        FD_SET(sockbunch[i], read_fd_set);\r\n        s = sockbunch[i];\r\n      }\r\n      if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK((sockbunch[i]))) {\r\n        FD_SET(sockbunch[i], write_fd_set);\r\n        s = sockbunch[i];\r\n      }\r\n      if(s == CURL_SOCKET_BAD)\r\n        /* this socket is unused, break out of loop */\r\n        break;\r\n      else {\r\n        if((int)s > this_max_fd)\r\n          this_max_fd = (int)s;\r\n      }\r\n    }\r\n\r\n    easy = easy->next; /* check next handle */\r\n  }\r\n\r\n  *max_fd = this_max_fd;\r\n\r\n  return CURLM_OK;\r\n}\r\n\r\nCURLMcode curl_multi_wait(CURLM *multi_handle,\r\n                          struct curl_waitfd extra_fds[],\r\n                          unsigned int extra_nfds,\r\n                          int timeout_ms,\r\n                          int *ret)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_one_easy *easy;\r\n  curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE];\r\n  int bitmap;\r\n  unsigned int i;\r\n  unsigned int nfds = extra_nfds;\r\n  struct pollfd *ufds = NULL;\r\n\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  /* Count up how many fds we have from the multi handle */\r\n  easy=multi->easy.next;\r\n  while(easy != &multi->easy) {\r\n    bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE);\r\n\r\n    for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) {\r\n      curl_socket_t s = CURL_SOCKET_BAD;\r\n\r\n      if(bitmap & GETSOCK_READSOCK(i)) {\r\n        ++nfds;\r\n        s = sockbunch[i];\r\n      }\r\n      if(bitmap & GETSOCK_WRITESOCK(i)) {\r\n        ++nfds;\r\n        s = sockbunch[i];\r\n      }\r\n      if(s == CURL_SOCKET_BAD) {\r\n        break;\r\n      }\r\n    }\r\n\r\n    easy = easy->next; /* check next handle */\r\n  }\r\n\r\n  if(nfds) {\r\n    ufds = malloc(nfds * sizeof(struct pollfd));\r\n    if(!ufds)\r\n      return CURLM_OUT_OF_MEMORY;\r\n  }\r\n  nfds = 0;\r\n\r\n  /* Add the curl handles to our pollfds first */\r\n  easy=multi->easy.next;\r\n  while(easy != &multi->easy) {\r\n    bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE);\r\n\r\n    for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) {\r\n      curl_socket_t s = CURL_SOCKET_BAD;\r\n\r\n      if(bitmap & GETSOCK_READSOCK(i)) {\r\n        ufds[nfds].fd = sockbunch[i];\r\n        ufds[nfds].events = POLLIN;\r\n        ++nfds;\r\n        s = sockbunch[i];\r\n      }\r\n      if(bitmap & GETSOCK_WRITESOCK(i)) {\r\n        ufds[nfds].fd = sockbunch[i];\r\n        ufds[nfds].events = POLLOUT;\r\n        ++nfds;\r\n        s = sockbunch[i];\r\n      }\r\n      if(s == CURL_SOCKET_BAD) {\r\n        break;\r\n      }\r\n    }\r\n\r\n    easy = easy->next; /* check next handle */\r\n  }\r\n\r\n  /* Add external file descriptions from poll-like struct curl_waitfd */\r\n  for(i = 0; i < extra_nfds; i++) {\r\n    ufds[nfds].fd = extra_fds[i].fd;\r\n    ufds[nfds].events = 0;\r\n    if(extra_fds[i].events & CURL_WAIT_POLLIN)\r\n      ufds[nfds].events |= POLLIN;\r\n    if(extra_fds[i].events & CURL_WAIT_POLLPRI)\r\n      ufds[nfds].events |= POLLPRI;\r\n    if(extra_fds[i].events & CURL_WAIT_POLLOUT)\r\n      ufds[nfds].events |= POLLOUT;\r\n    ++nfds;\r\n  }\r\n\r\n  if(nfds)\r\n    /* wait... */\r\n    i = Curl_poll(ufds, nfds, timeout_ms);\r\n  else\r\n    i = 0;\r\n\r\n  Curl_safefree(ufds);\r\n  if(ret)\r\n    *ret = i;\r\n  return CURLM_OK;\r\n}\r\n\r\nstatic CURLMcode multi_runsingle(struct Curl_multi *multi,\r\n                                 struct timeval now,\r\n                                 struct Curl_one_easy *easy)\r\n{\r\n  struct Curl_message *msg = NULL;\r\n  bool connected;\r\n  bool async;\r\n  bool protocol_connect = FALSE;\r\n  bool dophase_done = FALSE;\r\n  bool done = FALSE;\r\n  CURLMcode result = CURLM_OK;\r\n  struct SingleRequest *k;\r\n  struct SessionHandle *data;\r\n  long timeout_ms;\r\n\r\n  if(!GOOD_EASY_HANDLE(easy->easy_handle))\r\n    return CURLM_BAD_EASY_HANDLE;\r\n\r\n  data = easy->easy_handle;\r\n\r\n  do {\r\n    /* this is a single-iteration do-while loop just to allow a\r\n       break to skip to the end of it */\r\n    bool disconnect_conn = FALSE;\r\n\r\n    /* Handle the case when the pipe breaks, i.e., the connection\r\n       we're using gets cleaned up and we're left with nothing. */\r\n    if(data->state.pipe_broke) {\r\n      infof(data, \"Pipe broke: handle 0x%p, url = %s\\n\",\r\n            easy, data->state.path);\r\n\r\n      if(easy->state < CURLM_STATE_COMPLETED) {\r\n        /* Head back to the CONNECT state */\r\n        multistate(easy, CURLM_STATE_CONNECT);\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n        easy->result = CURLE_OK;\r\n      }\r\n\r\n      data->state.pipe_broke = FALSE;\r\n      easy->easy_conn = NULL;\r\n      break;\r\n    }\r\n\r\n    if(!easy->easy_conn &&\r\n       easy->state > CURLM_STATE_CONNECT &&\r\n       easy->state < CURLM_STATE_DONE) {\r\n      /* In all these states, the code will blindly access 'easy->easy_conn'\r\n         so this is precaution that it isn't NULL. And it silences static\r\n         analyzers. */\r\n      failf(data, \"In state %d with no easy_conn, bail out!\\n\", easy->state);\r\n      return CURLM_INTERNAL_ERROR;\r\n    }\r\n\r\n    if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT &&\r\n       easy->state < CURLM_STATE_COMPLETED)\r\n      /* Make sure we set the connection's current owner */\r\n      easy->easy_conn->data = data;\r\n\r\n    if(easy->easy_conn &&\r\n       (easy->state >= CURLM_STATE_CONNECT) &&\r\n       (easy->state < CURLM_STATE_COMPLETED)) {\r\n      /* we need to wait for the connect state as only then is the start time\r\n         stored, but we must not check already completed handles */\r\n\r\n      timeout_ms = Curl_timeleft(data, &now,\r\n                                 (easy->state <= CURLM_STATE_WAITDO)?\r\n                                 TRUE:FALSE);\r\n\r\n      if(timeout_ms < 0) {\r\n        /* Handle timed out */\r\n        if(easy->state == CURLM_STATE_WAITRESOLVE)\r\n          failf(data, \"Resolving timed out after %ld milliseconds\",\r\n                Curl_tvdiff(now, data->progress.t_startsingle));\r\n        else if(easy->state == CURLM_STATE_WAITCONNECT)\r\n          failf(data, \"Connection timed out after %ld milliseconds\",\r\n                Curl_tvdiff(now, data->progress.t_startsingle));\r\n        else {\r\n          k = &data->req;\r\n          failf(data, \"Operation timed out after %ld milliseconds with %\"\r\n                FORMAT_OFF_T \" out of %\" FORMAT_OFF_T \" bytes received\",\r\n                Curl_tvdiff(now, data->progress.t_startsingle), k->bytecount,\r\n                k->size);\r\n        }\r\n\r\n        /* Force the connection closed because the server could continue to\r\n           send us stuff at any time. (The disconnect_conn logic used below\r\n           doesn't work at this point). */\r\n        easy->easy_conn->bits.close = TRUE;\r\n        easy->result = CURLE_OPERATION_TIMEDOUT;\r\n        multistate(easy, CURLM_STATE_COMPLETED);\r\n        break;\r\n      }\r\n    }\r\n\r\n    switch(easy->state) {\r\n    case CURLM_STATE_INIT:\r\n      /* init this transfer. */\r\n      easy->result=Curl_pretransfer(data);\r\n\r\n      if(CURLE_OK == easy->result) {\r\n        /* after init, go CONNECT */\r\n        multistate(easy, CURLM_STATE_CONNECT);\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_CONNECT:\r\n      /* Connect. We get a connection identifier filled in. */\r\n      Curl_pgrsTime(data, TIMER_STARTSINGLE);\r\n      easy->result = Curl_connect(data, &easy->easy_conn,\r\n                                  &async, &protocol_connect);\r\n\r\n      if(CURLE_OK == easy->result) {\r\n        /* Add this handle to the send or pend pipeline */\r\n        easy->result = addHandleToSendOrPendPipeline(data,\r\n                                                     easy->easy_conn);\r\n        if(CURLE_OK != easy->result)\r\n          disconnect_conn = TRUE;\r\n        else {\r\n          if(async)\r\n            /* We're now waiting for an asynchronous name lookup */\r\n            multistate(easy, CURLM_STATE_WAITRESOLVE);\r\n          else {\r\n            /* after the connect has been sent off, go WAITCONNECT unless the\r\n               protocol connect is already done and we can go directly to\r\n               WAITDO or DO! */\r\n            result = CURLM_CALL_MULTI_PERFORM;\r\n\r\n            if(protocol_connect)\r\n              multistate(easy, multi->pipelining_enabled?\r\n                         CURLM_STATE_WAITDO:CURLM_STATE_DO);\r\n            else {\r\n#ifndef CURL_DISABLE_HTTP\r\n              if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)\r\n                multistate(easy, CURLM_STATE_WAITPROXYCONNECT);\r\n              else\r\n#endif\r\n                multistate(easy, CURLM_STATE_WAITCONNECT);\r\n            }\r\n          }\r\n        }\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_WAITRESOLVE:\r\n      /* awaiting an asynch name resolve to complete */\r\n    {\r\n      struct Curl_dns_entry *dns = NULL;\r\n\r\n      /* check if we have the name resolved by now */\r\n      easy->result = Curl_resolver_is_resolved(easy->easy_conn, &dns);\r\n\r\n      /* Update sockets here, because the socket(s) may have been\r\n         closed and the application thus needs to be told, even if it\r\n         is likely that the same socket(s) will again be used further\r\n         down.  If the name has not yet been resolved, it is likely\r\n         that new sockets have been opened in an attempt to contact\r\n         another resolver. */\r\n      singlesocket(multi, easy);\r\n\r\n      if(dns) {\r\n        /* Perform the next step in the connection phase, and then move on\r\n           to the WAITCONNECT state */\r\n        easy->result = Curl_async_resolved(easy->easy_conn,\r\n                                           &protocol_connect);\r\n\r\n        if(CURLE_OK != easy->result)\r\n          /* if Curl_async_resolved() returns failure, the connection struct\r\n             is already freed and gone */\r\n          easy->easy_conn = NULL;           /* no more connection */\r\n        else {\r\n          /* call again please so that we get the next socket setup */\r\n          result = CURLM_CALL_MULTI_PERFORM;\r\n          if(protocol_connect)\r\n            multistate(easy, multi->pipelining_enabled?\r\n                       CURLM_STATE_WAITDO:CURLM_STATE_DO);\r\n          else {\r\n#ifndef CURL_DISABLE_HTTP\r\n            if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)\r\n              multistate(easy, CURLM_STATE_WAITPROXYCONNECT);\r\n            else\r\n#endif\r\n              multistate(easy, CURLM_STATE_WAITCONNECT);\r\n          }\r\n        }\r\n      }\r\n\r\n      if(CURLE_OK != easy->result) {\r\n        /* failure detected */\r\n        disconnect_conn = TRUE;\r\n        break;\r\n      }\r\n    }\r\n    break;\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n    case CURLM_STATE_WAITPROXYCONNECT:\r\n      /* this is HTTP-specific, but sending CONNECT to a proxy is HTTP... */\r\n      easy->result = Curl_http_connect(easy->easy_conn, &protocol_connect);\r\n\r\n      if(easy->easy_conn->bits.proxy_connect_closed) {\r\n        /* reset the error buffer */\r\n        if(data->set.errorbuffer)\r\n          data->set.errorbuffer[0] = '\\0';\r\n        data->state.errorbuf = FALSE;\r\n\r\n        easy->result = CURLE_OK;\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n        multistate(easy, CURLM_STATE_CONNECT);\r\n      }\r\n      else if(CURLE_OK == easy->result) {\r\n        if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_COMPLETE)\r\n          multistate(easy, CURLM_STATE_WAITCONNECT);\r\n      }\r\n      break;\r\n#endif\r\n\r\n    case CURLM_STATE_WAITCONNECT:\r\n      /* awaiting a completion of an asynch connect */\r\n      easy->result = Curl_is_connected(easy->easy_conn,\r\n                                       FIRSTSOCKET,\r\n                                       &connected);\r\n      if(connected) {\r\n\r\n        if(!easy->result)\r\n          /* if everything is still fine we do the protocol-specific connect\r\n             setup */\r\n          easy->result = Curl_protocol_connect(easy->easy_conn,\r\n                                               &protocol_connect);\r\n      }\r\n\r\n      if(CURLE_OK != easy->result) {\r\n        /* failure detected */\r\n        /* Just break, the cleaning up is handled all in one place */\r\n        disconnect_conn = TRUE;\r\n        break;\r\n      }\r\n\r\n      if(connected) {\r\n        if(!protocol_connect) {\r\n          /* We have a TCP connection, but 'protocol_connect' may be false\r\n             and then we continue to 'STATE_PROTOCONNECT'. If protocol\r\n             connect is TRUE, we move on to STATE_DO.\r\n             BUT if we are using a proxy we must change to WAITPROXYCONNECT\r\n          */\r\n#ifndef CURL_DISABLE_HTTP\r\n          if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)\r\n            multistate(easy, CURLM_STATE_WAITPROXYCONNECT);\r\n          else\r\n#endif\r\n            multistate(easy, CURLM_STATE_PROTOCONNECT);\r\n\r\n        }\r\n        else\r\n          /* after the connect has completed, go WAITDO or DO */\r\n          multistate(easy, multi->pipelining_enabled?\r\n                     CURLM_STATE_WAITDO:CURLM_STATE_DO);\r\n\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_PROTOCONNECT:\r\n      /* protocol-specific connect phase */\r\n      easy->result = Curl_protocol_connecting(easy->easy_conn,\r\n                                              &protocol_connect);\r\n      if((easy->result == CURLE_OK) && protocol_connect) {\r\n        /* after the connect has completed, go WAITDO or DO */\r\n        multistate(easy, multi->pipelining_enabled?\r\n                   CURLM_STATE_WAITDO:CURLM_STATE_DO);\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n      else if(easy->result) {\r\n        /* failure detected */\r\n        Curl_posttransfer(data);\r\n        Curl_done(&easy->easy_conn, easy->result, TRUE);\r\n        disconnect_conn = TRUE;\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_WAITDO:\r\n      /* Wait for our turn to DO when we're pipelining requests */\r\n#ifdef DEBUGBUILD\r\n      infof(data, \"WAITDO: Conn %ld send pipe %zu inuse %d athead %d\\n\",\r\n            easy->easy_conn->connection_id,\r\n            easy->easy_conn->send_pipe->size,\r\n            easy->easy_conn->writechannel_inuse?1:0,\r\n            isHandleAtHead(data,\r\n                           easy->easy_conn->send_pipe)?1:0);\r\n#endif\r\n      if(!easy->easy_conn->writechannel_inuse &&\r\n         isHandleAtHead(data,\r\n                        easy->easy_conn->send_pipe)) {\r\n        /* Grab the channel */\r\n        easy->easy_conn->writechannel_inuse = TRUE;\r\n        multistate(easy, CURLM_STATE_DO);\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_DO:\r\n      if(data->set.connect_only) {\r\n        /* keep connection open for application to use the socket */\r\n        easy->easy_conn->bits.close = FALSE;\r\n        multistate(easy, CURLM_STATE_DONE);\r\n        easy->result = CURLE_OK;\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n      else {\r\n        /* Perform the protocol's DO action */\r\n        easy->result = Curl_do(&easy->easy_conn,\r\n                               &dophase_done);\r\n\r\n        if(CURLE_OK == easy->result) {\r\n          if(!dophase_done) {\r\n            /* some steps needed for wildcard matching */\r\n            if(data->set.wildcardmatch) {\r\n              struct WildcardData *wc = &data->wildcard;\r\n              if(wc->state == CURLWC_DONE || wc->state == CURLWC_SKIP) {\r\n                /* skip some states if it is important */\r\n                Curl_done(&easy->easy_conn, CURLE_OK, FALSE);\r\n                multistate(easy, CURLM_STATE_DONE);\r\n                result = CURLM_CALL_MULTI_PERFORM;\r\n                break;\r\n              }\r\n            }\r\n            /* DO was not completed in one function call, we must continue\r\n               DOING... */\r\n            multistate(easy, CURLM_STATE_DOING);\r\n            result = CURLM_OK;\r\n          }\r\n\r\n          /* after DO, go DO_DONE... or DO_MORE */\r\n          else if(easy->easy_conn->bits.do_more) {\r\n            /* we're supposed to do more, but we need to sit down, relax\r\n               and wait a little while first */\r\n            multistate(easy, CURLM_STATE_DO_MORE);\r\n            result = CURLM_OK;\r\n          }\r\n          else {\r\n            /* we're done with the DO, now DO_DONE */\r\n            multistate(easy, CURLM_STATE_DO_DONE);\r\n            result = CURLM_CALL_MULTI_PERFORM;\r\n          }\r\n        }\r\n        else if((CURLE_SEND_ERROR == easy->result) &&\r\n                easy->easy_conn->bits.reuse) {\r\n          /*\r\n           * In this situation, a connection that we were trying to use\r\n           * may have unexpectedly died.  If possible, send the connection\r\n           * back to the CONNECT phase so we can try again.\r\n           */\r\n          char *newurl = NULL;\r\n          followtype follow=FOLLOW_NONE;\r\n          CURLcode drc;\r\n          bool retry = FALSE;\r\n\r\n          drc = Curl_retry_request(easy->easy_conn, &newurl);\r\n          if(drc) {\r\n            /* a failure here pretty much implies an out of memory */\r\n            easy->result = drc;\r\n            disconnect_conn = TRUE;\r\n          }\r\n          else\r\n            retry = (newurl)?TRUE:FALSE;\r\n\r\n          Curl_posttransfer(data);\r\n          drc = Curl_done(&easy->easy_conn, easy->result, FALSE);\r\n\r\n          /* When set to retry the connection, we must to go back to\r\n           * the CONNECT state */\r\n          if(retry) {\r\n            if((drc == CURLE_OK) || (drc == CURLE_SEND_ERROR)) {\r\n              follow = FOLLOW_RETRY;\r\n              drc = Curl_follow(data, newurl, follow);\r\n              if(drc == CURLE_OK) {\r\n                multistate(easy, CURLM_STATE_CONNECT);\r\n                result = CURLM_CALL_MULTI_PERFORM;\r\n                easy->result = CURLE_OK;\r\n              }\r\n              else {\r\n                /* Follow failed */\r\n                easy->result = drc;\r\n                free(newurl);\r\n              }\r\n            }\r\n            else {\r\n              /* done didn't return OK or SEND_ERROR */\r\n              easy->result = drc;\r\n              free(newurl);\r\n            }\r\n          }\r\n          else {\r\n            /* Have error handler disconnect conn if we can't retry */\r\n            disconnect_conn = TRUE;\r\n          }\r\n        }\r\n        else {\r\n          /* failure detected */\r\n          Curl_posttransfer(data);\r\n          Curl_done(&easy->easy_conn, easy->result, FALSE);\r\n          disconnect_conn = TRUE;\r\n        }\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_DOING:\r\n      /* we continue DOING until the DO phase is complete */\r\n      easy->result = Curl_protocol_doing(easy->easy_conn,\r\n                                         &dophase_done);\r\n      if(CURLE_OK == easy->result) {\r\n        if(dophase_done) {\r\n          /* after DO, go DO_DONE or DO_MORE */\r\n          multistate(easy, easy->easy_conn->bits.do_more?\r\n                     CURLM_STATE_DO_MORE:\r\n                     CURLM_STATE_DO_DONE);\r\n          result = CURLM_CALL_MULTI_PERFORM;\r\n        } /* dophase_done */\r\n      }\r\n      else {\r\n        /* failure detected */\r\n        Curl_posttransfer(data);\r\n        Curl_done(&easy->easy_conn, easy->result, FALSE);\r\n        disconnect_conn = TRUE;\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_DO_MORE:\r\n      /*\r\n       * When we are connected, DO MORE and then go DO_DONE\r\n       */\r\n      easy->result = Curl_do_more(easy->easy_conn, &dophase_done);\r\n\r\n      /* No need to remove this handle from the send pipeline here since that\r\n         is done in Curl_done() */\r\n      if(CURLE_OK == easy->result) {\r\n        if(dophase_done) {\r\n          multistate(easy, CURLM_STATE_DO_DONE);\r\n          result = CURLM_CALL_MULTI_PERFORM;\r\n        }\r\n        else\r\n          /* stay in DO_MORE */\r\n          result = CURLM_OK;\r\n      }\r\n      else {\r\n        /* failure detected */\r\n        Curl_posttransfer(data);\r\n        Curl_done(&easy->easy_conn, easy->result, FALSE);\r\n        disconnect_conn = TRUE;\r\n      }\r\n      break;\r\n\r\n    case CURLM_STATE_DO_DONE:\r\n      /* Move ourselves from the send to recv pipeline */\r\n      moveHandleFromSendToRecvPipeline(data, easy->easy_conn);\r\n      /* Check if we can move pending requests to send pipe */\r\n      checkPendPipeline(easy->easy_conn);\r\n      multistate(easy, CURLM_STATE_WAITPERFORM);\r\n      result = CURLM_CALL_MULTI_PERFORM;\r\n      break;\r\n\r\n    case CURLM_STATE_WAITPERFORM:\r\n      /* Wait for our turn to PERFORM */\r\n      if(!easy->easy_conn->readchannel_inuse &&\r\n         isHandleAtHead(data,\r\n                        easy->easy_conn->recv_pipe)) {\r\n        /* Grab the channel */\r\n        easy->easy_conn->readchannel_inuse = TRUE;\r\n        multistate(easy, CURLM_STATE_PERFORM);\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n#ifdef DEBUGBUILD\r\n      else {\r\n        infof(data, \"WAITPERFORM: Conn %ld recv pipe %zu inuse %d athead %d\\n\",\r\n              easy->easy_conn->connection_id,\r\n              easy->easy_conn->recv_pipe->size,\r\n              easy->easy_conn->readchannel_inuse?1:0,\r\n              isHandleAtHead(data,\r\n                             easy->easy_conn->recv_pipe)?1:0);\r\n      }\r\n#endif\r\n      break;\r\n\r\n    case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */\r\n      /* if both rates are within spec, resume transfer */\r\n      if(Curl_pgrsUpdate(easy->easy_conn))\r\n        easy->result = CURLE_ABORTED_BY_CALLBACK;\r\n      else\r\n        easy->result = Curl_speedcheck(data, now);\r\n\r\n      if(( (data->set.max_send_speed == 0) ||\r\n           (data->progress.ulspeed < data->set.max_send_speed ))  &&\r\n         ( (data->set.max_recv_speed == 0) ||\r\n           (data->progress.dlspeed < data->set.max_recv_speed)))\r\n        multistate(easy, CURLM_STATE_PERFORM);\r\n      break;\r\n\r\n    case CURLM_STATE_PERFORM:\r\n      {\r\n      char *newurl = NULL;\r\n      bool retry = FALSE;\r\n\r\n      /* check if over send speed */\r\n      if((data->set.max_send_speed > 0) &&\r\n         (data->progress.ulspeed > data->set.max_send_speed)) {\r\n        int buffersize;\r\n\r\n        multistate(easy, CURLM_STATE_TOOFAST);\r\n\r\n        /* calculate upload rate-limitation timeout. */\r\n        buffersize = (int)(data->set.buffer_size ?\r\n                           data->set.buffer_size : BUFSIZE);\r\n        timeout_ms = Curl_sleep_time(data->set.max_send_speed,\r\n                                     data->progress.ulspeed, buffersize);\r\n        Curl_expire(data, timeout_ms);\r\n        break;\r\n      }\r\n\r\n      /* check if over recv speed */\r\n      if((data->set.max_recv_speed > 0) &&\r\n         (data->progress.dlspeed > data->set.max_recv_speed)) {\r\n        int buffersize;\r\n\r\n        multistate(easy, CURLM_STATE_TOOFAST);\r\n\r\n         /* Calculate download rate-limitation timeout. */\r\n        buffersize = (int)(data->set.buffer_size ?\r\n                           data->set.buffer_size : BUFSIZE);\r\n        timeout_ms = Curl_sleep_time(data->set.max_recv_speed,\r\n                                     data->progress.dlspeed, buffersize);\r\n        Curl_expire(data, timeout_ms);\r\n        break;\r\n      }\r\n\r\n      /* read/write data if it is ready to do so */\r\n      easy->result = Curl_readwrite(easy->easy_conn, &done);\r\n\r\n      k = &data->req;\r\n\r\n      if(!(k->keepon & KEEP_RECV)) {\r\n        /* We're done receiving */\r\n        easy->easy_conn->readchannel_inuse = FALSE;\r\n      }\r\n\r\n      if(!(k->keepon & KEEP_SEND)) {\r\n        /* We're done sending */\r\n        easy->easy_conn->writechannel_inuse = FALSE;\r\n      }\r\n\r\n      if(done || (easy->result == CURLE_RECV_ERROR)) {\r\n        /* If CURLE_RECV_ERROR happens early enough, we assume it was a race\r\n         * condition and the server closed the re-used connection exactly when\r\n         * we wanted to use it, so figure out if that is indeed the case.\r\n         */\r\n        CURLcode ret = Curl_retry_request(easy->easy_conn, &newurl);\r\n        if(!ret)\r\n          retry = (newurl)?TRUE:FALSE;\r\n\r\n        if(retry) {\r\n          /* if we are to retry, set the result to OK and consider the\r\n             request as done */\r\n          easy->result = CURLE_OK;\r\n          done = TRUE;\r\n        }\r\n      }\r\n\r\n      if(easy->result) {\r\n        /*\r\n         * The transfer phase returned error, we mark the connection to get\r\n         * closed to prevent being re-used. This is because we can't possibly\r\n         * know if the connection is in a good shape or not now.  Unless it is\r\n         * a protocol which uses two \"channels\" like FTP, as then the error\r\n         * happened in the data connection.\r\n         */\r\n\r\n        if(!(easy->easy_conn->handler->flags & PROTOPT_DUAL))\r\n          easy->easy_conn->bits.close = TRUE;\r\n\r\n        Curl_posttransfer(data);\r\n        Curl_done(&easy->easy_conn, easy->result, FALSE);\r\n      }\r\n      else if(done) {\r\n        followtype follow=FOLLOW_NONE;\r\n\r\n        /* call this even if the readwrite function returned error */\r\n        Curl_posttransfer(data);\r\n\r\n        /* we're no longer receiving */\r\n        moveHandleFromRecvToDonePipeline(data,\r\n                                         easy->easy_conn);\r\n\r\n        /* expire the new receiving pipeline head */\r\n        if(easy->easy_conn->recv_pipe->head)\r\n          Curl_expire(easy->easy_conn->recv_pipe->head->ptr, 1);\r\n\r\n        /* Check if we can move pending requests to send pipe */\r\n        checkPendPipeline(easy->easy_conn);\r\n\r\n        /* When we follow redirects or is set to retry the connection, we must\r\n           to go back to the CONNECT state */\r\n        if(data->req.newurl || retry) {\r\n          if(!retry) {\r\n            /* if the URL is a follow-location and not just a retried request\r\n               then figure out the URL here */\r\n            newurl = data->req.newurl;\r\n            data->req.newurl = NULL;\r\n            follow = FOLLOW_REDIR;\r\n          }\r\n          else\r\n            follow = FOLLOW_RETRY;\r\n          easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);\r\n          if(easy->result == CURLE_OK)\r\n            easy->result = Curl_follow(data, newurl, follow);\r\n          if(CURLE_OK == easy->result) {\r\n            multistate(easy, CURLM_STATE_CONNECT);\r\n            result = CURLM_CALL_MULTI_PERFORM;\r\n            newurl = NULL; /* handed over the memory ownership to\r\n                              Curl_follow(), make sure we don't free() it\r\n                              here */\r\n          }\r\n        }\r\n        else {\r\n          /* after the transfer is done, go DONE */\r\n\r\n          /* but first check to see if we got a location info even though we're\r\n             not following redirects */\r\n          if(data->req.location) {\r\n            if(newurl)\r\n              free(newurl);\r\n            newurl = data->req.location;\r\n            data->req.location = NULL;\r\n            easy->result = Curl_follow(data, newurl, FOLLOW_FAKE);\r\n            if(CURLE_OK == easy->result)\r\n              newurl = NULL; /* allocation was handed over Curl_follow() */\r\n            else\r\n              disconnect_conn = TRUE;\r\n          }\r\n\r\n          multistate(easy, CURLM_STATE_DONE);\r\n          result = CURLM_CALL_MULTI_PERFORM;\r\n        }\r\n      }\r\n\r\n      if(newurl)\r\n        free(newurl);\r\n      break;\r\n      }\r\n\r\n    case CURLM_STATE_DONE:\r\n\r\n      if(easy->easy_conn) {\r\n        /* Remove ourselves from the receive and done pipelines. Handle\r\n           should be on one of these lists, depending upon how we got here. */\r\n        Curl_removeHandleFromPipeline(data,\r\n                                      easy->easy_conn->recv_pipe);\r\n        Curl_removeHandleFromPipeline(data,\r\n                                      easy->easy_conn->done_pipe);\r\n        /* Check if we can move pending requests to send pipe */\r\n        checkPendPipeline(easy->easy_conn);\r\n\r\n        if(easy->easy_conn->bits.stream_was_rewound) {\r\n          /* This request read past its response boundary so we quickly let\r\n             the other requests consume those bytes since there is no\r\n             guarantee that the socket will become active again */\r\n          result = CURLM_CALL_MULTI_PERFORM;\r\n        }\r\n\r\n        /* post-transfer command */\r\n        easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);\r\n        /*\r\n         * If there are other handles on the pipeline, Curl_done won't set\r\n         * easy_conn to NULL.  In such a case, curl_multi_remove_handle() can\r\n         * access free'd data, if the connection is free'd and the handle\r\n         * removed before we perform the processing in CURLM_STATE_COMPLETED\r\n         */\r\n        if(easy->easy_conn)\r\n          easy->easy_conn = NULL;\r\n      }\r\n\r\n      if(data->set.wildcardmatch) {\r\n        if(data->wildcard.state != CURLWC_DONE) {\r\n          /* if a wildcard is set and we are not ending -> lets start again\r\n             with CURLM_STATE_INIT */\r\n          result = CURLM_CALL_MULTI_PERFORM;\r\n          multistate(easy, CURLM_STATE_INIT);\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* after we have DONE what we're supposed to do, go COMPLETED, and\r\n         it doesn't matter what the Curl_done() returned! */\r\n      multistate(easy, CURLM_STATE_COMPLETED);\r\n\r\n      break;\r\n\r\n    case CURLM_STATE_COMPLETED:\r\n      /* this is a completed transfer, it is likely to still be connected */\r\n\r\n      /* This node should be delinked from the list now and we should post\r\n         an information message that we are complete. */\r\n\r\n      /* Important: reset the conn pointer so that we don't point to memory\r\n         that could be freed anytime */\r\n      easy->easy_conn = NULL;\r\n\r\n      Curl_expire(data, 0); /* stop all timers */\r\n      break;\r\n\r\n    case CURLM_STATE_MSGSENT:\r\n      return CURLM_OK; /* do nothing */\r\n\r\n    default:\r\n      return CURLM_INTERNAL_ERROR;\r\n    }\r\n\r\n    if(easy->state < CURLM_STATE_COMPLETED) {\r\n      if(CURLE_OK != easy->result) {\r\n        /*\r\n         * If an error was returned, and we aren't in completed state now,\r\n         * then we go to completed and consider this transfer aborted.\r\n         */\r\n\r\n        /* NOTE: no attempt to disconnect connections must be made\r\n           in the case blocks above - cleanup happens only here */\r\n\r\n        data->state.pipe_broke = FALSE;\r\n\r\n        if(easy->easy_conn) {\r\n          /* if this has a connection, unsubscribe from the pipelines */\r\n          easy->easy_conn->writechannel_inuse = FALSE;\r\n          easy->easy_conn->readchannel_inuse = FALSE;\r\n          Curl_removeHandleFromPipeline(data,\r\n                                        easy->easy_conn->send_pipe);\r\n          Curl_removeHandleFromPipeline(data,\r\n                                        easy->easy_conn->recv_pipe);\r\n          Curl_removeHandleFromPipeline(data,\r\n                                        easy->easy_conn->done_pipe);\r\n          /* Check if we can move pending requests to send pipe */\r\n          checkPendPipeline(easy->easy_conn);\r\n\r\n          if(disconnect_conn) {\r\n            /* disconnect properly */\r\n            Curl_disconnect(easy->easy_conn, /* dead_connection */ FALSE);\r\n\r\n            /* This is where we make sure that the easy_conn pointer is reset.\r\n               We don't have to do this in every case block above where a\r\n               failure is detected */\r\n            easy->easy_conn = NULL;\r\n          }\r\n        }\r\n        else if(easy->state == CURLM_STATE_CONNECT) {\r\n          /* Curl_connect() failed */\r\n          (void)Curl_posttransfer(data);\r\n        }\r\n\r\n        multistate(easy, CURLM_STATE_COMPLETED);\r\n      }\r\n      /* if there's still a connection to use, call the progress function */\r\n      else if(easy->easy_conn && Curl_pgrsUpdate(easy->easy_conn)) {\r\n        /* aborted due to progress callback return code must close the\r\n           connection */\r\n        easy->easy_conn->bits.close = TRUE;\r\n\r\n        /* if not yet in DONE state, go there, otherwise COMPLETED */\r\n        multistate(easy, (easy->state < CURLM_STATE_DONE)?\r\n                   CURLM_STATE_DONE: CURLM_STATE_COMPLETED);\r\n        result = CURLM_CALL_MULTI_PERFORM;\r\n      }\r\n    }\r\n  } WHILE_FALSE; /* just to break out from! */\r\n\r\n  if(CURLM_STATE_COMPLETED == easy->state) {\r\n    /* now fill in the Curl_message with this info */\r\n    msg = &easy->msg;\r\n\r\n    msg->extmsg.msg = CURLMSG_DONE;\r\n    msg->extmsg.easy_handle = data;\r\n    msg->extmsg.data.result = easy->result;\r\n\r\n    result = multi_addmsg(multi, msg);\r\n\r\n    multistate(easy, CURLM_STATE_MSGSENT);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n\r\nCURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_one_easy *easy;\r\n  CURLMcode returncode=CURLM_OK;\r\n  struct Curl_tree *t;\r\n  struct timeval now = Curl_tvnow();\r\n\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  easy=multi->easy.next;\r\n  while(easy != &multi->easy) {\r\n    CURLMcode result;\r\n    struct WildcardData *wc = &easy->easy_handle->wildcard;\r\n\r\n    if(easy->easy_handle->set.wildcardmatch) {\r\n      if(!wc->filelist) {\r\n        CURLcode ret = Curl_wildcard_init(wc); /* init wildcard structures */\r\n        if(ret)\r\n          return CURLM_OUT_OF_MEMORY;\r\n      }\r\n    }\r\n\r\n    do\r\n      result = multi_runsingle(multi, now, easy);\r\n    while(CURLM_CALL_MULTI_PERFORM == result);\r\n\r\n    if(easy->easy_handle->set.wildcardmatch) {\r\n      /* destruct wildcard structures if it is needed */\r\n      if(wc->state == CURLWC_DONE || result)\r\n        Curl_wildcard_dtor(wc);\r\n    }\r\n\r\n    if(result)\r\n      returncode = result;\r\n\r\n    easy = easy->next; /* operate on next handle */\r\n  }\r\n\r\n  /*\r\n   * Simply remove all expired timers from the splay since handles are dealt\r\n   * with unconditionally by this function and curl_multi_timeout() requires\r\n   * that already passed/handled expire times are removed from the splay.\r\n   *\r\n   * It is important that the 'now' value is set at the entry of this function\r\n   * and not for the current time as it may have ticked a little while since\r\n   * then and then we risk this loop to remove timers that actually have not\r\n   * been handled!\r\n   */\r\n  do {\r\n    multi->timetree = Curl_splaygetbest(now, multi->timetree, &t);\r\n    if(t)\r\n      /* the removed may have another timeout in queue */\r\n      (void)add_next_timeout(now, multi, t->payload);\r\n\r\n  } while(t);\r\n\r\n  *running_handles = multi->num_alive;\r\n\r\n  if(CURLM_OK >= returncode)\r\n    update_timer(multi);\r\n\r\n  return returncode;\r\n}\r\n\r\nstatic void close_all_connections(struct Curl_multi *multi)\r\n{\r\n  struct connectdata *conn;\r\n\r\n  conn = Curl_conncache_find_first_connection(multi->conn_cache);\r\n  while(conn) {\r\n    conn->data = multi->closure_handle;\r\n\r\n    /* This will remove the connection from the cache */\r\n    (void)Curl_disconnect(conn, FALSE);\r\n\r\n    conn = Curl_conncache_find_first_connection(multi->conn_cache);\r\n  }\r\n}\r\n\r\nCURLMcode curl_multi_cleanup(CURLM *multi_handle)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_one_easy *easy;\r\n  struct Curl_one_easy *nexteasy;\r\n\r\n  if(GOOD_MULTI_HANDLE(multi)) {\r\n    multi->type = 0; /* not good anymore */\r\n\r\n    /* Close all the connections in the connection cache */\r\n    close_all_connections(multi);\r\n\r\n    multi->closure_handle->dns.hostcache = multi->hostcache;\r\n    Curl_hostcache_clean(multi->closure_handle);\r\n\r\n    Curl_close(multi->closure_handle);\r\n    multi->closure_handle = NULL;\r\n\r\n    Curl_hash_destroy(multi->sockhash);\r\n    multi->sockhash = NULL;\r\n\r\n    Curl_conncache_destroy(multi->conn_cache);\r\n    multi->conn_cache = NULL;\r\n\r\n    /* remove the pending list of messages */\r\n    Curl_llist_destroy(multi->msglist, NULL);\r\n    multi->msglist = NULL;\r\n\r\n    /* remove all easy handles */\r\n    easy = multi->easy.next;\r\n    while(easy != &multi->easy) {\r\n      nexteasy=easy->next;\r\n      if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) {\r\n        /* clear out the usage of the shared DNS cache */\r\n        Curl_hostcache_clean(easy->easy_handle);\r\n        easy->easy_handle->dns.hostcache = NULL;\r\n        easy->easy_handle->dns.hostcachetype = HCACHE_NONE;\r\n      }\r\n\r\n      /* Clear the pointer to the connection cache */\r\n      easy->easy_handle->state.conn_cache = NULL;\r\n\r\n      Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association */\r\n\r\n      free(easy);\r\n      easy = nexteasy;\r\n    }\r\n\r\n    Curl_hash_destroy(multi->hostcache);\r\n    multi->hostcache = NULL;\r\n\r\n    free(multi);\r\n\r\n    return CURLM_OK;\r\n  }\r\n  else\r\n    return CURLM_BAD_HANDLE;\r\n}\r\n\r\n/*\r\n * curl_multi_info_read()\r\n *\r\n * This function is the primary way for a multi/multi_socket application to\r\n * figure out if a transfer has ended. We MUST make this function as fast as\r\n * possible as it will be polled frequently and we MUST NOT scan any lists in\r\n * here to figure out things. We must scale fine to thousands of handles and\r\n * beyond. The current design is fully O(1).\r\n */\r\n\r\nCURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_message *msg;\r\n\r\n  *msgs_in_queue = 0; /* default to none */\r\n\r\n  if(GOOD_MULTI_HANDLE(multi) && Curl_llist_count(multi->msglist)) {\r\n    /* there is one or more messages in the list */\r\n    struct curl_llist_element *e;\r\n\r\n    /* extract the head of the list to return */\r\n    e = multi->msglist->head;\r\n\r\n    msg = e->ptr;\r\n\r\n    /* remove the extracted entry */\r\n    Curl_llist_remove(multi->msglist, e, NULL);\r\n\r\n    *msgs_in_queue = curlx_uztosi(Curl_llist_count(multi->msglist));\r\n\r\n    return &msg->extmsg;\r\n  }\r\n  else\r\n    return NULL;\r\n}\r\n\r\n/*\r\n * singlesocket() checks what sockets we deal with and their \"action state\"\r\n * and if we have a different state in any of those sockets from last time we\r\n * call the callback accordingly.\r\n */\r\nstatic void singlesocket(struct Curl_multi *multi,\r\n                         struct Curl_one_easy *easy)\r\n{\r\n  curl_socket_t socks[MAX_SOCKSPEREASYHANDLE];\r\n  int i;\r\n  struct Curl_sh_entry *entry;\r\n  curl_socket_t s;\r\n  int num;\r\n  unsigned int curraction;\r\n  struct Curl_one_easy *easy_by_hash;\r\n  bool remove_sock_from_hash;\r\n\r\n  for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++)\r\n    socks[i] = CURL_SOCKET_BAD;\r\n\r\n  /* Fill in the 'current' struct with the state as it is now: what sockets to\r\n     supervise and for what actions */\r\n  curraction = multi_getsock(easy, socks, MAX_SOCKSPEREASYHANDLE);\r\n\r\n  /* We have 0 .. N sockets already and we get to know about the 0 .. M\r\n     sockets we should have from now on. Detect the differences, remove no\r\n     longer supervised ones and add new ones */\r\n\r\n  /* walk over the sockets we got right now */\r\n  for(i=0; (i< MAX_SOCKSPEREASYHANDLE) &&\r\n        (curraction & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i)));\r\n      i++) {\r\n    int action = CURL_POLL_NONE;\r\n\r\n    s = socks[i];\r\n\r\n    /* get it from the hash */\r\n    entry = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s));\r\n\r\n    if(curraction & GETSOCK_READSOCK(i))\r\n      action |= CURL_POLL_IN;\r\n    if(curraction & GETSOCK_WRITESOCK(i))\r\n      action |= CURL_POLL_OUT;\r\n\r\n    if(entry) {\r\n      /* yeps, already present so check if it has the same action set */\r\n      if(entry->action == action)\r\n        /* same, continue */\r\n        continue;\r\n    }\r\n    else {\r\n      /* this is a socket we didn't have before, add it! */\r\n      entry = sh_addentry(multi->sockhash, s, easy->easy_handle);\r\n      if(!entry)\r\n        /* fatal */\r\n        return;\r\n    }\r\n\r\n    /* we know (entry != NULL) at this point, see the logic above */\r\n    if(multi->socket_cb)\r\n      multi->socket_cb(easy->easy_handle,\r\n                       s,\r\n                       action,\r\n                       multi->socket_userp,\r\n                       entry->socketp);\r\n\r\n    entry->action = action; /* store the current action state */\r\n  }\r\n\r\n  num = i; /* number of sockets */\r\n\r\n  /* when we've walked over all the sockets we should have right now, we must\r\n     make sure to detect sockets that are removed */\r\n  for(i=0; i< easy->numsocks; i++) {\r\n    int j;\r\n    s = easy->sockets[i];\r\n    for(j=0; j<num; j++) {\r\n      if(s == socks[j]) {\r\n        /* this is still supervised */\r\n        s = CURL_SOCKET_BAD;\r\n        break;\r\n      }\r\n    }\r\n    if(s != CURL_SOCKET_BAD) {\r\n\r\n      /* this socket has been removed. Tell the app to remove it */\r\n      remove_sock_from_hash = TRUE;\r\n\r\n      entry = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s));\r\n      if(entry) {\r\n        /* check if the socket to be removed serves a connection which has\r\n           other easy-s in a pipeline. In this case the socket should not be\r\n           removed. */\r\n        struct connectdata *easy_conn;\r\n\r\n        easy_by_hash = entry->easy->multi_pos;\r\n        easy_conn = easy_by_hash->easy_conn;\r\n        if(easy_conn) {\r\n          if(easy_conn->recv_pipe && easy_conn->recv_pipe->size > 1) {\r\n            /* the handle should not be removed from the pipe yet */\r\n            remove_sock_from_hash = FALSE;\r\n\r\n            /* Update the sockhash entry to instead point to the next in line\r\n               for the recv_pipe, or the first (in case this particular easy\r\n               isn't already) */\r\n            if(entry->easy == easy->easy_handle) {\r\n              if(isHandleAtHead(easy->easy_handle, easy_conn->recv_pipe))\r\n                entry->easy = easy_conn->recv_pipe->head->next->ptr;\r\n              else\r\n                entry->easy = easy_conn->recv_pipe->head->ptr;\r\n            }\r\n          }\r\n          if(easy_conn->send_pipe  && easy_conn->send_pipe->size > 1) {\r\n            /* the handle should not be removed from the pipe yet */\r\n            remove_sock_from_hash = FALSE;\r\n\r\n            /* Update the sockhash entry to instead point to the next in line\r\n               for the send_pipe, or the first (in case this particular easy\r\n               isn't already) */\r\n            if(entry->easy == easy->easy_handle) {\r\n              if(isHandleAtHead(easy->easy_handle, easy_conn->send_pipe))\r\n                entry->easy = easy_conn->send_pipe->head->next->ptr;\r\n              else\r\n                entry->easy = easy_conn->send_pipe->head->ptr;\r\n            }\r\n          }\r\n          /* Don't worry about overwriting recv_pipe head with send_pipe_head,\r\n             when action will be asked on the socket (see multi_socket()), the\r\n             head of the correct pipe will be taken according to the\r\n             action. */\r\n        }\r\n      }\r\n      else\r\n        /* just a precaution, this socket really SHOULD be in the hash already\r\n           but in case it isn't, we don't have to tell the app to remove it\r\n           either since it never got to know about it */\r\n        remove_sock_from_hash = FALSE;\r\n\r\n      if(remove_sock_from_hash) {\r\n        /* in this case 'entry' is always non-NULL */\r\n        if(multi->socket_cb)\r\n          multi->socket_cb(easy->easy_handle,\r\n                           s,\r\n                           CURL_POLL_REMOVE,\r\n                           multi->socket_userp,\r\n                           entry->socketp);\r\n        sh_delentry(multi->sockhash, s);\r\n      }\r\n\r\n    }\r\n  }\r\n\r\n  memcpy(easy->sockets, socks, num*sizeof(curl_socket_t));\r\n  easy->numsocks = num;\r\n}\r\n\r\n/*\r\n * add_next_timeout()\r\n *\r\n * Each SessionHandle has a list of timeouts. The add_next_timeout() is called\r\n * when it has just been removed from the splay tree because the timeout has\r\n * expired. This function is then to advance in the list to pick the next\r\n * timeout to use (skip the already expired ones) and add this node back to\r\n * the splay tree again.\r\n *\r\n * The splay tree only has each sessionhandle as a single node and the nearest\r\n * timeout is used to sort it on.\r\n */\r\nstatic CURLMcode add_next_timeout(struct timeval now,\r\n                                  struct Curl_multi *multi,\r\n                                  struct SessionHandle *d)\r\n{\r\n  struct timeval *tv = &d->state.expiretime;\r\n  struct curl_llist *list = d->state.timeoutlist;\r\n  struct curl_llist_element *e;\r\n\r\n  /* move over the timeout list for this specific handle and remove all\r\n     timeouts that are now passed tense and store the next pending\r\n     timeout in *tv */\r\n  for(e = list->head; e; ) {\r\n    struct curl_llist_element *n = e->next;\r\n    long diff = curlx_tvdiff(*(struct timeval *)e->ptr, now);\r\n    if(diff <= 0)\r\n      /* remove outdated entry */\r\n      Curl_llist_remove(list, e, NULL);\r\n    else\r\n      /* the list is sorted so get out on the first mismatch */\r\n      break;\r\n    e = n;\r\n  }\r\n  e = list->head;\r\n  if(!e) {\r\n    /* clear the expire times within the handles that we remove from the\r\n       splay tree */\r\n    tv->tv_sec = 0;\r\n    tv->tv_usec = 0;\r\n  }\r\n  else {\r\n    /* copy the first entry to 'tv' */\r\n    memcpy(tv, e->ptr, sizeof(*tv));\r\n\r\n    /* remove first entry from list */\r\n    Curl_llist_remove(list, e, NULL);\r\n\r\n    /* insert this node again into the splay */\r\n    multi->timetree = Curl_splayinsert(*tv, multi->timetree,\r\n                                       &d->state.timenode);\r\n  }\r\n  return CURLM_OK;\r\n}\r\n\r\n\r\nstatic CURLMcode multi_socket(struct Curl_multi *multi,\r\n                              bool checkall,\r\n                              curl_socket_t s,\r\n                              int ev_bitmask,\r\n                              int *running_handles)\r\n{\r\n  CURLMcode result = CURLM_OK;\r\n  struct SessionHandle *data = NULL;\r\n  struct Curl_tree *t;\r\n  struct timeval now = Curl_tvnow();\r\n\r\n  if(checkall) {\r\n    struct Curl_one_easy *easyp;\r\n    /* *perform() deals with running_handles on its own */\r\n    result = curl_multi_perform(multi, running_handles);\r\n\r\n    /* walk through each easy handle and do the socket state change magic\r\n       and callbacks */\r\n    easyp=multi->easy.next;\r\n    while(easyp != &multi->easy) {\r\n      singlesocket(multi, easyp);\r\n      easyp = easyp->next;\r\n    }\r\n\r\n    /* or should we fall-through and do the timer-based stuff? */\r\n    return result;\r\n  }\r\n  else if(s != CURL_SOCKET_TIMEOUT) {\r\n\r\n    struct Curl_sh_entry *entry =\r\n      Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s));\r\n\r\n    if(!entry)\r\n      /* Unmatched socket, we can't act on it but we ignore this fact.  In\r\n         real-world tests it has been proved that libevent can in fact give\r\n         the application actions even though the socket was just previously\r\n         asked to get removed, so thus we better survive stray socket actions\r\n         and just move on. */\r\n      ;\r\n    else {\r\n      data = entry->easy;\r\n\r\n      if(data->magic != CURLEASY_MAGIC_NUMBER)\r\n        /* bad bad bad bad bad bad bad */\r\n        return CURLM_INTERNAL_ERROR;\r\n\r\n      /* If the pipeline is enabled, take the handle which is in the head of\r\n         the pipeline. If we should write into the socket, take the send_pipe\r\n         head.  If we should read from the socket, take the recv_pipe head. */\r\n      if(data->set.one_easy->easy_conn) {\r\n        if((ev_bitmask & CURL_POLL_OUT) &&\r\n           data->set.one_easy->easy_conn->send_pipe &&\r\n           data->set.one_easy->easy_conn->send_pipe->head)\r\n          data = data->set.one_easy->easy_conn->send_pipe->head->ptr;\r\n        else if((ev_bitmask & CURL_POLL_IN) &&\r\n                data->set.one_easy->easy_conn->recv_pipe &&\r\n                data->set.one_easy->easy_conn->recv_pipe->head)\r\n          data = data->set.one_easy->easy_conn->recv_pipe->head->ptr;\r\n      }\r\n\r\n      if(data->set.one_easy->easy_conn &&\r\n         !(data->set.one_easy->easy_conn->handler->flags & PROTOPT_DIRLOCK))\r\n        /* set socket event bitmask if they're not locked */\r\n        data->set.one_easy->easy_conn->cselect_bits = ev_bitmask;\r\n\r\n      do\r\n        result = multi_runsingle(multi, now, data->set.one_easy);\r\n      while(CURLM_CALL_MULTI_PERFORM == result);\r\n\r\n      if(data->set.one_easy->easy_conn &&\r\n         !(data->set.one_easy->easy_conn->handler->flags & PROTOPT_DIRLOCK))\r\n        /* clear the bitmask only if not locked */\r\n        data->set.one_easy->easy_conn->cselect_bits = 0;\r\n\r\n      if(CURLM_OK >= result)\r\n        /* get the socket(s) and check if the state has been changed since\r\n           last */\r\n        singlesocket(multi, data->set.one_easy);\r\n\r\n      /* Now we fall-through and do the timer-based stuff, since we don't want\r\n         to force the user to have to deal with timeouts as long as at least\r\n         one connection in fact has traffic. */\r\n\r\n      data = NULL; /* set data to NULL again to avoid calling\r\n                      multi_runsingle() in case there's no need to */\r\n    }\r\n  }\r\n\r\n  now.tv_usec += 40000; /* compensate for bad precision timers that might've\r\n                           triggered too early */\r\n  if(now.tv_usec >= 1000000) {\r\n    now.tv_sec++;\r\n    now.tv_usec -= 1000000;\r\n  }\r\n\r\n  /*\r\n   * The loop following here will go on as long as there are expire-times left\r\n   * to process in the splay and 'data' will be re-assigned for every expired\r\n   * handle we deal with.\r\n   */\r\n  do {\r\n    /* the first loop lap 'data' can be NULL */\r\n    if(data) {\r\n      do\r\n        result = multi_runsingle(multi, now, data->set.one_easy);\r\n      while(CURLM_CALL_MULTI_PERFORM == result);\r\n\r\n      if(CURLM_OK >= result)\r\n        /* get the socket(s) and check if the state has been changed since\r\n           last */\r\n        singlesocket(multi, data->set.one_easy);\r\n    }\r\n\r\n    /* Check if there's one (more) expired timer to deal with! This function\r\n       extracts a matching node if there is one */\r\n\r\n    multi->timetree = Curl_splaygetbest(now, multi->timetree, &t);\r\n    if(t) {\r\n      data = t->payload; /* assign this for next loop */\r\n      (void)add_next_timeout(now, multi, t->payload);\r\n    }\r\n\r\n  } while(t);\r\n\r\n  *running_handles = multi->num_alive;\r\n  return result;\r\n}\r\n\r\n#undef curl_multi_setopt\r\nCURLMcode curl_multi_setopt(CURLM *multi_handle,\r\n                            CURLMoption option, ...)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  CURLMcode res = CURLM_OK;\r\n  va_list param;\r\n\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  va_start(param, option);\r\n\r\n  switch(option) {\r\n  case CURLMOPT_SOCKETFUNCTION:\r\n    multi->socket_cb = va_arg(param, curl_socket_callback);\r\n    break;\r\n  case CURLMOPT_SOCKETDATA:\r\n    multi->socket_userp = va_arg(param, void *);\r\n    break;\r\n  case CURLMOPT_PIPELINING:\r\n    multi->pipelining_enabled = (0 != va_arg(param, long)) ? TRUE : FALSE;\r\n    break;\r\n  case CURLMOPT_TIMERFUNCTION:\r\n    multi->timer_cb = va_arg(param, curl_multi_timer_callback);\r\n    break;\r\n  case CURLMOPT_TIMERDATA:\r\n    multi->timer_userp = va_arg(param, void *);\r\n    break;\r\n  case CURLMOPT_MAXCONNECTS:\r\n    multi->maxconnects = va_arg(param, long);\r\n    break;\r\n  default:\r\n    res = CURLM_UNKNOWN_OPTION;\r\n    break;\r\n  }\r\n  va_end(param);\r\n  return res;\r\n}\r\n\r\n/* we define curl_multi_socket() in the public multi.h header */\r\n#undef curl_multi_socket\r\n\r\nCURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,\r\n                            int *running_handles)\r\n{\r\n  CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, FALSE, s,\r\n                                  0, running_handles);\r\n  if(CURLM_OK >= result)\r\n    update_timer((struct Curl_multi *)multi_handle);\r\n  return result;\r\n}\r\n\r\nCURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s,\r\n                                   int ev_bitmask, int *running_handles)\r\n{\r\n  CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, FALSE, s,\r\n                                  ev_bitmask, running_handles);\r\n  if(CURLM_OK >= result)\r\n    update_timer((struct Curl_multi *)multi_handle);\r\n  return result;\r\n}\r\n\r\nCURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles)\r\n\r\n{\r\n  CURLMcode result = multi_socket((struct Curl_multi *)multi_handle,\r\n                                  TRUE, CURL_SOCKET_BAD, 0, running_handles);\r\n  if(CURLM_OK >= result)\r\n    update_timer((struct Curl_multi *)multi_handle);\r\n  return result;\r\n}\r\n\r\nstatic CURLMcode multi_timeout(struct Curl_multi *multi,\r\n                               long *timeout_ms)\r\n{\r\n  static struct timeval tv_zero = {0,0};\r\n\r\n  if(multi->timetree) {\r\n    /* we have a tree of expire times */\r\n    struct timeval now = Curl_tvnow();\r\n\r\n    /* splay the lowest to the bottom */\r\n    multi->timetree = Curl_splay(tv_zero, multi->timetree);\r\n\r\n    if(Curl_splaycomparekeys(multi->timetree->key, now) > 0) {\r\n      /* some time left before expiration */\r\n      *timeout_ms = curlx_tvdiff(multi->timetree->key, now);\r\n      if(!*timeout_ms)\r\n        /*\r\n         * Since we only provide millisecond resolution on the returned value\r\n         * and the diff might be less than one millisecond here, we don't\r\n         * return zero as that may cause short bursts of busyloops on fast\r\n         * processors while the diff is still present but less than one\r\n         * millisecond! instead we return 1 until the time is ripe.\r\n         */\r\n        *timeout_ms=1;\r\n    }\r\n    else\r\n      /* 0 means immediately */\r\n      *timeout_ms = 0;\r\n  }\r\n  else\r\n    *timeout_ms = -1;\r\n\r\n  return CURLM_OK;\r\n}\r\n\r\nCURLMcode curl_multi_timeout(CURLM *multi_handle,\r\n                             long *timeout_ms)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n\r\n  /* First, make some basic checks that the CURLM handle is a good handle */\r\n  if(!GOOD_MULTI_HANDLE(multi))\r\n    return CURLM_BAD_HANDLE;\r\n\r\n  return multi_timeout(multi, timeout_ms);\r\n}\r\n\r\n/*\r\n * Tell the application it should update its timers, if it subscribes to the\r\n * update timer callback.\r\n */\r\nstatic int update_timer(struct Curl_multi *multi)\r\n{\r\n  long timeout_ms;\r\n\r\n  if(!multi->timer_cb)\r\n    return 0;\r\n  if(multi_timeout(multi, &timeout_ms)) {\r\n    return -1;\r\n  }\r\n  if(timeout_ms < 0) {\r\n    static const struct timeval none={0,0};\r\n    if(Curl_splaycomparekeys(none, multi->timer_lastcall)) {\r\n      multi->timer_lastcall = none;\r\n      /* there's no timeout now but there was one previously, tell the app to\r\n         disable it */\r\n      return multi->timer_cb((CURLM*)multi, -1, multi->timer_userp);\r\n    }\r\n    return 0;\r\n  }\r\n\r\n  /* When multi_timeout() is done, multi->timetree points to the node with the\r\n   * timeout we got the (relative) time-out time for. We can thus easily check\r\n   * if this is the same (fixed) time as we got in a previous call and then\r\n   * avoid calling the callback again. */\r\n  if(Curl_splaycomparekeys(multi->timetree->key, multi->timer_lastcall) == 0)\r\n    return 0;\r\n\r\n  multi->timer_lastcall = multi->timetree->key;\r\n\r\n  return multi->timer_cb((CURLM*)multi, timeout_ms, multi->timer_userp);\r\n}\r\n\r\nstatic CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle,\r\n                                              struct connectdata *conn)\r\n{\r\n  size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size;\r\n  struct curl_llist_element *sendhead = conn->send_pipe->head;\r\n  struct curl_llist *pipeline;\r\n  CURLcode rc;\r\n\r\n  if(!Curl_isPipeliningEnabled(handle) ||\r\n     pipeLen == 0)\r\n    pipeline = conn->send_pipe;\r\n  else {\r\n    if(conn->server_supports_pipelining &&\r\n       pipeLen < MAX_PIPELINE_LENGTH)\r\n      pipeline = conn->send_pipe;\r\n    else\r\n      pipeline = conn->pend_pipe;\r\n  }\r\n\r\n  rc = Curl_addHandleToPipeline(handle, pipeline);\r\n\r\n  if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) {\r\n    /* this is a new one as head, expire it */\r\n    conn->writechannel_inuse = FALSE; /* not in use yet */\r\n#ifdef DEBUGBUILD\r\n    infof(conn->data, \"%p is at send pipe head!\\n\",\r\n          conn->send_pipe->head->ptr);\r\n#endif\r\n    Curl_expire(conn->send_pipe->head->ptr, 1);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\nstatic int checkPendPipeline(struct connectdata *conn)\r\n{\r\n  int result = 0;\r\n  struct curl_llist_element *sendhead = conn->send_pipe->head;\r\n\r\n  size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size;\r\n  if(conn->server_supports_pipelining || pipeLen == 0) {\r\n    struct curl_llist_element *curr = conn->pend_pipe->head;\r\n    const size_t maxPipeLen =\r\n      conn->server_supports_pipelining ? MAX_PIPELINE_LENGTH : 1;\r\n\r\n    while(pipeLen < maxPipeLen && curr) {\r\n      Curl_llist_move(conn->pend_pipe, curr,\r\n                      conn->send_pipe, conn->send_pipe->tail);\r\n      Curl_pgrsTime(curr->ptr, TIMER_PRETRANSFER);\r\n      ++result; /* count how many handles we moved */\r\n      curr = conn->pend_pipe->head;\r\n      ++pipeLen;\r\n    }\r\n  }\r\n\r\n  if(result) {\r\n    conn->now = Curl_tvnow();\r\n    /* something moved, check for a new send pipeline leader */\r\n    if(sendhead != conn->send_pipe->head) {\r\n      /* this is a new one as head, expire it */\r\n      conn->writechannel_inuse = FALSE; /* not in use yet */\r\n#ifdef DEBUGBUILD\r\n      infof(conn->data, \"%p is at send pipe head!\\n\",\r\n            conn->send_pipe->head->ptr);\r\n#endif\r\n      Curl_expire(conn->send_pipe->head->ptr, 1);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Move this transfer from the sending list to the receiving list.\r\n\r\n   Pay special attention to the new sending list \"leader\" as it needs to get\r\n   checked to update what sockets it acts on.\r\n\r\n*/\r\nstatic void moveHandleFromSendToRecvPipeline(struct SessionHandle *handle,\r\n                                             struct connectdata *conn)\r\n{\r\n  struct curl_llist_element *curr;\r\n\r\n  curr = conn->send_pipe->head;\r\n  while(curr) {\r\n    if(curr->ptr == handle) {\r\n      Curl_llist_move(conn->send_pipe, curr,\r\n                      conn->recv_pipe, conn->recv_pipe->tail);\r\n\r\n      if(conn->send_pipe->head) {\r\n        /* Since there's a new easy handle at the start of the send pipeline,\r\n           set its timeout value to 1ms to make it trigger instantly */\r\n        conn->writechannel_inuse = FALSE; /* not used now */\r\n#ifdef DEBUGBUILD\r\n        infof(conn->data, \"%p is at send pipe head B!\\n\",\r\n              conn->send_pipe->head->ptr);\r\n#endif\r\n        Curl_expire(conn->send_pipe->head->ptr, 1);\r\n      }\r\n\r\n      /* The receiver's list is not really interesting here since either this\r\n         handle is now first in the list and we'll deal with it soon, or\r\n         another handle is already first and thus is already taken care of */\r\n\r\n      break; /* we're done! */\r\n    }\r\n    curr = curr->next;\r\n  }\r\n}\r\n\r\nstatic void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle,\r\n                                            struct connectdata *conn)\r\n{\r\n  struct curl_llist_element *curr;\r\n\r\n  curr = conn->recv_pipe->head;\r\n  while(curr) {\r\n    if(curr->ptr == handle) {\r\n      Curl_llist_move(conn->recv_pipe, curr,\r\n                      conn->done_pipe, conn->done_pipe->tail);\r\n      break;\r\n    }\r\n    curr = curr->next;\r\n  }\r\n}\r\nstatic bool isHandleAtHead(struct SessionHandle *handle,\r\n                           struct curl_llist *pipeline)\r\n{\r\n  struct curl_llist_element *curr = pipeline->head;\r\n  if(curr)\r\n    return (curr->ptr == handle) ? TRUE : FALSE;\r\n\r\n  return FALSE;\r\n}\r\n\r\n/*\r\n * multi_freetimeout()\r\n *\r\n * Callback used by the llist system when a single timeout list entry is\r\n * destroyed.\r\n */\r\nstatic void multi_freetimeout(void *user, void *entryptr)\r\n{\r\n  (void)user;\r\n\r\n  /* the entry was plain malloc()'ed */\r\n  free(entryptr);\r\n}\r\n\r\n/*\r\n * multi_addtimeout()\r\n *\r\n * Add a timestamp to the list of timeouts. Keep the list sorted so that head\r\n * of list is always the timeout nearest in time.\r\n *\r\n */\r\nstatic CURLMcode\r\nmulti_addtimeout(struct curl_llist *timeoutlist,\r\n                 struct timeval *stamp)\r\n{\r\n  struct curl_llist_element *e;\r\n  struct timeval *timedup;\r\n  struct curl_llist_element *prev = NULL;\r\n\r\n  timedup = malloc(sizeof(*timedup));\r\n  if(!timedup)\r\n    return CURLM_OUT_OF_MEMORY;\r\n\r\n  /* copy the timestamp */\r\n  memcpy(timedup, stamp, sizeof(*timedup));\r\n\r\n  if(Curl_llist_count(timeoutlist)) {\r\n    /* find the correct spot in the list */\r\n    for(e = timeoutlist->head; e; e = e->next) {\r\n      struct timeval *checktime = e->ptr;\r\n      long diff = curlx_tvdiff(*checktime, *timedup);\r\n      if(diff > 0)\r\n        break;\r\n      prev = e;\r\n    }\r\n\r\n  }\r\n  /* else\r\n     this is the first timeout on the list */\r\n\r\n  if(!Curl_llist_insert_next(timeoutlist, prev, timedup)) {\r\n    free(timedup);\r\n    return CURLM_OUT_OF_MEMORY;\r\n  }\r\n\r\n  return CURLM_OK;\r\n}\r\n\r\n/*\r\n * Curl_expire()\r\n *\r\n * given a number of milliseconds from now to use to set the 'act before\r\n * this'-time for the transfer, to be extracted by curl_multi_timeout()\r\n *\r\n * Note that the timeout will be added to a queue of timeouts if it defines a\r\n * moment in time that is later than the current head of queue.\r\n *\r\n * Pass zero to clear all timeout values for this handle.\r\n*/\r\nvoid Curl_expire(struct SessionHandle *data, long milli)\r\n{\r\n  struct Curl_multi *multi = data->multi;\r\n  struct timeval *nowp = &data->state.expiretime;\r\n  int rc;\r\n\r\n  /* this is only interesting for multi-interface using libcurl, and only\r\n     while there is still a multi interface struct remaining! */\r\n  if(!multi)\r\n    return;\r\n\r\n  if(!milli) {\r\n    /* No timeout, clear the time data. */\r\n    if(nowp->tv_sec || nowp->tv_usec) {\r\n      /* Since this is an cleared time, we must remove the previous entry from\r\n         the splay tree */\r\n      struct curl_llist *list = data->state.timeoutlist;\r\n\r\n      rc = Curl_splayremovebyaddr(multi->timetree,\r\n                                  &data->state.timenode,\r\n                                  &multi->timetree);\r\n      if(rc)\r\n        infof(data, \"Internal error clearing splay node = %d\\n\", rc);\r\n\r\n      /* flush the timeout list too */\r\n      while(list->size > 0)\r\n        Curl_llist_remove(list, list->tail, NULL);\r\n\r\n#ifdef DEBUGBUILD\r\n      infof(data, \"Expire cleared\\n\");\r\n#endif\r\n      nowp->tv_sec = 0;\r\n      nowp->tv_usec = 0;\r\n    }\r\n  }\r\n  else {\r\n    struct timeval set;\r\n\r\n    set = Curl_tvnow();\r\n    set.tv_sec += milli/1000;\r\n    set.tv_usec += (milli%1000)*1000;\r\n\r\n    if(set.tv_usec >= 1000000) {\r\n      set.tv_sec++;\r\n      set.tv_usec -= 1000000;\r\n    }\r\n\r\n    if(nowp->tv_sec || nowp->tv_usec) {\r\n      /* This means that the struct is added as a node in the splay tree.\r\n         Compare if the new time is earlier, and only remove-old/add-new if it\r\n         is. */\r\n      long diff = curlx_tvdiff(set, *nowp);\r\n      if(diff > 0) {\r\n        /* the new expire time was later so just add it to the queue\r\n           and get out */\r\n        multi_addtimeout(data->state.timeoutlist, &set);\r\n        return;\r\n      }\r\n\r\n      /* the new time is newer than the presently set one, so add the current\r\n         to the queue and update the head */\r\n      multi_addtimeout(data->state.timeoutlist, nowp);\r\n\r\n      /* Since this is an updated time, we must remove the previous entry from\r\n         the splay tree first and then re-add the new value */\r\n      rc = Curl_splayremovebyaddr(multi->timetree,\r\n                                  &data->state.timenode,\r\n                                  &multi->timetree);\r\n      if(rc)\r\n        infof(data, \"Internal error removing splay node = %d\\n\", rc);\r\n    }\r\n\r\n    *nowp = set;\r\n    data->state.timenode.payload = data;\r\n    multi->timetree = Curl_splayinsert(*nowp,\r\n                                       multi->timetree,\r\n                                       &data->state.timenode);\r\n  }\r\n#if 0\r\n  Curl_splayprint(multi->timetree, 0, TRUE);\r\n#endif\r\n}\r\n\r\nCURLMcode curl_multi_assign(CURLM *multi_handle,\r\n                            curl_socket_t s, void *hashp)\r\n{\r\n  struct Curl_sh_entry *there = NULL;\r\n  struct Curl_multi *multi = (struct Curl_multi *)multi_handle;\r\n\r\n  if(s != CURL_SOCKET_BAD)\r\n    there = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(curl_socket_t));\r\n\r\n  if(!there)\r\n    return CURLM_BAD_SOCKET;\r\n\r\n  there->socketp = hashp;\r\n\r\n  return CURLM_OK;\r\n}\r\n\r\n#ifdef DEBUGBUILD\r\nvoid Curl_multi_dump(const struct Curl_multi *multi_handle)\r\n{\r\n  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;\r\n  struct Curl_one_easy *easy;\r\n  int i;\r\n  fprintf(stderr, \"* Multi status: %d handles, %d alive\\n\",\r\n          multi->num_easy, multi->num_alive);\r\n  for(easy=multi->easy.next; easy != &multi->easy; easy = easy->next) {\r\n    if(easy->state < CURLM_STATE_COMPLETED) {\r\n      /* only display handles that are not completed */\r\n      fprintf(stderr, \"handle %p, state %s, %d sockets\\n\",\r\n              (void *)easy->easy_handle,\r\n              statename[easy->state], easy->numsocks);\r\n      for(i=0; i < easy->numsocks; i++) {\r\n        curl_socket_t s = easy->sockets[i];\r\n        struct Curl_sh_entry *entry =\r\n          Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s));\r\n\r\n        fprintf(stderr, \"%d \", (int)s);\r\n        if(!entry) {\r\n          fprintf(stderr, \"INTERNAL CONFUSION\\n\");\r\n          continue;\r\n        }\r\n        fprintf(stderr, \"[%s %s] \",\r\n                entry->action&CURL_POLL_IN?\"RECVING\":\"\",\r\n                entry->action&CURL_POLL_OUT?\"SENDING\":\"\");\r\n      }\r\n      if(easy->numsocks)\r\n        fprintf(stderr, \"\\n\");\r\n    }\r\n  }\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/multihandle.h",
    "content": "#ifndef HEADER_CURL_MULTIHANDLE_H\r\n#define HEADER_CURL_MULTIHANDLE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nstruct Curl_message {\r\n  /* the 'CURLMsg' is the part that is visible to the external user */\r\n  struct CURLMsg extmsg;\r\n};\r\n\r\n/* NOTE: if you add a state here, add the name to the statename[] array as\r\n   well!\r\n*/\r\ntypedef enum {\r\n  CURLM_STATE_INIT,        /* 0 - start in this state */\r\n  CURLM_STATE_CONNECT,     /* 1 - resolve/connect has been sent off */\r\n  CURLM_STATE_WAITRESOLVE, /* 2 - awaiting the resolve to finalize */\r\n  CURLM_STATE_WAITCONNECT, /* 3 - awaiting the connect to finalize */\r\n  CURLM_STATE_WAITPROXYCONNECT, /* 4 - awaiting proxy CONNECT to finalize */\r\n  CURLM_STATE_PROTOCONNECT, /* 5 - completing the protocol-specific connect\r\n                               phase */\r\n  CURLM_STATE_WAITDO,      /* 6 - wait for our turn to send the request */\r\n  CURLM_STATE_DO,          /* 7 - start send off the request (part 1) */\r\n  CURLM_STATE_DOING,       /* 8 - sending off the request (part 1) */\r\n  CURLM_STATE_DO_MORE,     /* 9 - send off the request (part 2) */\r\n  CURLM_STATE_DO_DONE,     /* 10 - done sending off request */\r\n  CURLM_STATE_WAITPERFORM, /* 11 - wait for our turn to read the response */\r\n  CURLM_STATE_PERFORM,     /* 12 - transfer data */\r\n  CURLM_STATE_TOOFAST,     /* 13 - wait because limit-rate exceeded */\r\n  CURLM_STATE_DONE,        /* 14 - post data transfer operation */\r\n  CURLM_STATE_COMPLETED,   /* 15 - operation complete */\r\n  CURLM_STATE_MSGSENT,     /* 16 - the operation complete message is sent */\r\n  CURLM_STATE_LAST         /* 17 - not a true state, never use this */\r\n} CURLMstate;\r\n\r\n/* we support N sockets per easy handle. Set the corresponding bit to what\r\n   action we should wait for */\r\n#define MAX_SOCKSPEREASYHANDLE 5\r\n#define GETSOCK_READABLE (0x00ff)\r\n#define GETSOCK_WRITABLE (0xff00)\r\n\r\nstruct Curl_one_easy {\r\n  /* first, two fields for the linked list of these */\r\n  struct Curl_one_easy *next;\r\n  struct Curl_one_easy *prev;\r\n\r\n  struct SessionHandle *easy_handle; /* the easy handle for this unit */\r\n  struct connectdata *easy_conn;     /* the \"unit's\" connection */\r\n\r\n  CURLMstate state;  /* the handle's state */\r\n  CURLcode result;   /* previous result */\r\n\r\n  struct Curl_message msg; /* A single posted message. */\r\n\r\n  /* Array with the plain socket numbers this handle takes care of, in no\r\n     particular order. Note that all sockets are added to the sockhash, where\r\n     the state etc are also kept. This array is mostly used to detect when a\r\n     socket is to be removed from the hash. See singlesocket(). */\r\n  curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE];\r\n  int numsocks;\r\n};\r\n\r\n/* This is the struct known as CURLM on the outside */\r\nstruct Curl_multi {\r\n  /* First a simple identifier to easier detect if a user mix up\r\n     this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */\r\n  long type;\r\n\r\n  /* We have a doubly-linked circular list with easy handles */\r\n  struct Curl_one_easy easy;\r\n\r\n  int num_easy; /* amount of entries in the linked list above. */\r\n  int num_alive; /* amount of easy handles that are added but have not yet\r\n                    reached COMPLETE state */\r\n\r\n  struct curl_llist *msglist; /* a list of messages from completed transfers */\r\n\r\n  /* callback function and user data pointer for the *socket() API */\r\n  curl_socket_callback socket_cb;\r\n  void *socket_userp;\r\n\r\n  /* Hostname cache */\r\n  struct curl_hash *hostcache;\r\n\r\n  /* timetree points to the splay-tree of time nodes to figure out expire\r\n     times of all currently set timers */\r\n  struct Curl_tree *timetree;\r\n\r\n  /* 'sockhash' is the lookup hash for socket descriptor => easy handles (note\r\n     the pluralis form, there can be more than one easy handle waiting on the\r\n     same actual socket) */\r\n  struct curl_hash *sockhash;\r\n\r\n  /* Whether pipelining is enabled for this multi handle */\r\n  bool pipelining_enabled;\r\n\r\n  /* Shared connection cache (bundles)*/\r\n  struct conncache *conn_cache;\r\n\r\n  /* This handle will be used for closing the cached connections in\r\n     curl_multi_cleanup() */\r\n  struct SessionHandle *closure_handle;\r\n\r\n  long maxconnects; /* if >0, a fixed limit of the maximum number of entries\r\n                       we're allowed to grow the connection cache to */\r\n\r\n  /* timer callback and user data pointer for the *socket() API */\r\n  curl_multi_timer_callback timer_cb;\r\n  void *timer_userp;\r\n  struct timeval timer_lastcall; /* the fixed time for the timeout for the\r\n                                    previous callback */\r\n};\r\n\r\n#endif /* HEADER_CURL_MULTIHANDLE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/multiif.h",
    "content": "#ifndef HEADER_CURL_MULTIIF_H\r\n#define HEADER_CURL_MULTIIF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Prototypes for library-wide functions provided by multi.c\r\n */\r\nvoid Curl_expire(struct SessionHandle *data, long milli);\r\n\r\nbool Curl_multi_canPipeline(const struct Curl_multi* multi);\r\nvoid Curl_multi_handlePipeBreak(struct SessionHandle *data);\r\n\r\n/* the write bits start at bit 16 for the *getsock() bitmap */\r\n#define GETSOCK_WRITEBITSTART 16\r\n\r\n#define GETSOCK_BLANK 0 /* no bits set */\r\n\r\n/* set the bit for the given sock number to make the bitmap for writable */\r\n#define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))\r\n\r\n/* set the bit for the given sock number to make the bitmap for readable */\r\n#define GETSOCK_READSOCK(x) (1 << (x))\r\n\r\n#ifdef DEBUGBUILD\r\n /*\r\n  * Curl_multi_dump is not a stable public function, this is only meant to\r\n  * allow easier tracking of the internal handle's state and what sockets\r\n  * they use. Only for research and development DEBUGBUILD enabled builds.\r\n  */\r\nvoid Curl_multi_dump(const struct Curl_multi *multi_handle);\r\n#endif\r\n\r\n#endif /* HEADER_CURL_MULTIIF_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/netrc.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_PWD_H\r\n#include <pwd.h>\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"netrc.h\"\r\n\r\n#include \"strequal.h\"\r\n#include \"strtok.h\"\r\n#include \"curl_memory.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Get user and password from .netrc when given a machine name */\r\n\r\nenum host_lookup_state {\r\n  NOTHING,\r\n  HOSTFOUND,    /* the 'machine' keyword was found */\r\n  HOSTVALID     /* this is \"our\" machine! */\r\n};\r\n\r\n/*\r\n * @unittest: 1304\r\n */\r\nint Curl_parsenetrc(const char *host,\r\n                    char *login,\r\n                    char *password,\r\n                    char *netrcfile)\r\n{\r\n  FILE *file;\r\n  int retcode=1;\r\n  int specific_login = (login[0] != 0);\r\n  char *home = NULL;\r\n  bool home_alloc = FALSE;\r\n  bool netrc_alloc = FALSE;\r\n  enum host_lookup_state state=NOTHING;\r\n\r\n  char state_login=0;      /* Found a login keyword */\r\n  char state_password=0;   /* Found a password keyword */\r\n  int state_our_login=FALSE;  /* With specific_login, found *our* login name */\r\n\r\n#define NETRC DOT_CHAR \"netrc\"\r\n\r\n  if(!netrcfile) {\r\n    home = curl_getenv(\"HOME\"); /* portable environment reader */\r\n    if(home) {\r\n      home_alloc = TRUE;\r\n#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)\r\n    }\r\n    else {\r\n      struct passwd *pw;\r\n      pw= getpwuid(geteuid());\r\n      if(pw) {\r\n        home = pw->pw_dir;\r\n      }\r\n#endif\r\n    }\r\n\r\n    if(!home)\r\n      return -1;\r\n\r\n    netrcfile = curl_maprintf(\"%s%s%s\", home, DIR_CHAR, NETRC);\r\n    if(!netrcfile) {\r\n      if(home_alloc)\r\n        free(home);\r\n      return -1;\r\n    }\r\n    netrc_alloc = TRUE;\r\n  }\r\n\r\n  file = fopen(netrcfile, \"r\");\r\n  if(file) {\r\n    char *tok;\r\n    char *tok_buf;\r\n    bool done=FALSE;\r\n    char netrcbuffer[256];\r\n    int  netrcbuffsize = (int)sizeof(netrcbuffer);\r\n\r\n    while(!done && fgets(netrcbuffer, netrcbuffsize, file)) {\r\n      tok=strtok_r(netrcbuffer, \" \\t\\n\", &tok_buf);\r\n      while(!done && tok) {\r\n\r\n        if(login[0] && password[0]) {\r\n          done=TRUE;\r\n          break;\r\n        }\r\n\r\n        switch(state) {\r\n        case NOTHING:\r\n          if(Curl_raw_equal(\"machine\", tok)) {\r\n            /* the next tok is the machine name, this is in itself the\r\n               delimiter that starts the stuff entered for this machine,\r\n               after this we need to search for 'login' and\r\n               'password'. */\r\n            state=HOSTFOUND;\r\n          }\r\n          break;\r\n        case HOSTFOUND:\r\n          if(Curl_raw_equal(host, tok)) {\r\n            /* and yes, this is our host! */\r\n            state=HOSTVALID;\r\n            retcode=0; /* we did find our host */\r\n          }\r\n          else\r\n            /* not our host */\r\n            state=NOTHING;\r\n          break;\r\n        case HOSTVALID:\r\n          /* we are now parsing sub-keywords concerning \"our\" host */\r\n          if(state_login) {\r\n            if(specific_login) {\r\n              state_our_login = Curl_raw_equal(login, tok);\r\n            }\r\n            else {\r\n              strncpy(login, tok, LOGINSIZE-1);\r\n            }\r\n            state_login=0;\r\n          }\r\n          else if(state_password) {\r\n            if(state_our_login || !specific_login) {\r\n              strncpy(password, tok, PASSWORDSIZE-1);\r\n            }\r\n            state_password=0;\r\n          }\r\n          else if(Curl_raw_equal(\"login\", tok))\r\n            state_login=1;\r\n          else if(Curl_raw_equal(\"password\", tok))\r\n            state_password=1;\r\n          else if(Curl_raw_equal(\"machine\", tok)) {\r\n            /* ok, there's machine here go => */\r\n            state = HOSTFOUND;\r\n            state_our_login = FALSE;\r\n          }\r\n          break;\r\n        } /* switch (state) */\r\n\r\n        tok = strtok_r(NULL, \" \\t\\n\", &tok_buf);\r\n      } /* while(tok) */\r\n    } /* while fgets() */\r\n\r\n    fclose(file);\r\n  }\r\n\r\n  if(home_alloc)\r\n    free(home);\r\n  if(netrc_alloc)\r\n    free(netrcfile);\r\n\r\n  return retcode;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/netrc.h",
    "content": "#ifndef HEADER_CURL_NETRC_H\r\n#define HEADER_CURL_NETRC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* Make sure we have room for at least this size: */\r\n#define LOGINSIZE 64\r\n#define PASSWORDSIZE 64\r\n\r\n/* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */\r\nint Curl_parsenetrc(const char *host,\r\n                    char *login,\r\n                    char *password,\r\n                    char *filename);\r\n  /* Assume: password[0]=0, host[0] != 0.\r\n   * If login[0] = 0, search for login and password within a machine section\r\n   * in the netrc.\r\n   * If login[0] != 0, search for password within machine and login.\r\n   */\r\n\r\n#endif /* HEADER_CURL_NETRC_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/non-ascii.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"non-ascii.h\"\r\n#include \"formdata.h\"\r\n#include \"sendf.h\"\r\n#include \"urldata.h\"\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef HAVE_ICONV\r\n#include <iconv.h>\r\n/* set default codesets for iconv */\r\n#ifndef CURL_ICONV_CODESET_OF_NETWORK\r\n#define CURL_ICONV_CODESET_OF_NETWORK \"ISO8859-1\"\r\n#endif\r\n#ifndef CURL_ICONV_CODESET_FOR_UTF8\r\n#define CURL_ICONV_CODESET_FOR_UTF8   \"UTF-8\"\r\n#endif\r\n#define ICONV_ERROR  (size_t)-1\r\n#endif /* HAVE_ICONV */\r\n\r\n/*\r\n * Curl_convert_clone() returns a malloced copy of the source string (if\r\n * returning CURLE_OK), with the data converted to network format.\r\n */\r\nCURLcode Curl_convert_clone(struct SessionHandle *data,\r\n                           const char *indata,\r\n                           size_t insize,\r\n                           char **outbuf)\r\n{\r\n  char *convbuf;\r\n  CURLcode result;\r\n\r\n  convbuf = malloc(insize);\r\n  if(!convbuf)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  memcpy(convbuf, indata, insize);\r\n  result = Curl_convert_to_network(data, convbuf, insize);\r\n  if(result) {\r\n    free(convbuf);\r\n    return result;\r\n  }\r\n\r\n  *outbuf = convbuf; /* return the converted buffer */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_convert_to_network() is an internal function for performing ASCII\r\n * conversions on non-ASCII platforms. It convers the buffer _in place_.\r\n */\r\nCURLcode Curl_convert_to_network(struct SessionHandle *data,\r\n                                 char *buffer, size_t length)\r\n{\r\n  CURLcode rc;\r\n\r\n  if(data->set.convtonetwork) {\r\n    /* use translation callback */\r\n    rc = data->set.convtonetwork(buffer, length);\r\n    if(rc != CURLE_OK) {\r\n      failf(data,\r\n            \"CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s\",\r\n            (int)rc, curl_easy_strerror(rc));\r\n    }\r\n    return rc;\r\n  }\r\n  else {\r\n#ifdef HAVE_ICONV\r\n    /* do the translation ourselves */\r\n    char *input_ptr, *output_ptr;\r\n    size_t in_bytes, out_bytes, rc;\r\n    int error;\r\n\r\n    /* open an iconv conversion descriptor if necessary */\r\n    if(data->outbound_cd == (iconv_t)-1) {\r\n      data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,\r\n                                     CURL_ICONV_CODESET_OF_HOST);\r\n      if(data->outbound_cd == (iconv_t)-1) {\r\n        error = ERRNO;\r\n        failf(data,\r\n              \"The iconv_open(\\\"%s\\\", \\\"%s\\\") call failed with errno %i: %s\",\r\n              CURL_ICONV_CODESET_OF_NETWORK,\r\n              CURL_ICONV_CODESET_OF_HOST,\r\n              error, strerror(error));\r\n        return CURLE_CONV_FAILED;\r\n      }\r\n    }\r\n    /* call iconv */\r\n    input_ptr = output_ptr = buffer;\r\n    in_bytes = out_bytes = length;\r\n    rc = iconv(data->outbound_cd, (const char**)&input_ptr, &in_bytes,\r\n               &output_ptr, &out_bytes);\r\n    if((rc == ICONV_ERROR) || (in_bytes != 0)) {\r\n      error = ERRNO;\r\n      failf(data,\r\n            \"The Curl_convert_to_network iconv call failed with errno %i: %s\",\r\n            error, strerror(error));\r\n      return CURLE_CONV_FAILED;\r\n    }\r\n#else\r\n    failf(data, \"CURLOPT_CONV_TO_NETWORK_FUNCTION callback required\");\r\n    return CURLE_CONV_REQD;\r\n#endif /* HAVE_ICONV */\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_convert_from_network() is an internal function for performing ASCII\r\n * conversions on non-ASCII platforms. It convers the buffer _in place_.\r\n */\r\nCURLcode Curl_convert_from_network(struct SessionHandle *data,\r\n                                   char *buffer, size_t length)\r\n{\r\n  CURLcode rc;\r\n\r\n  if(data->set.convfromnetwork) {\r\n    /* use translation callback */\r\n    rc = data->set.convfromnetwork(buffer, length);\r\n    if(rc != CURLE_OK) {\r\n      failf(data,\r\n            \"CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s\",\r\n            (int)rc, curl_easy_strerror(rc));\r\n    }\r\n    return rc;\r\n  }\r\n  else {\r\n#ifdef HAVE_ICONV\r\n    /* do the translation ourselves */\r\n    char *input_ptr, *output_ptr;\r\n    size_t in_bytes, out_bytes, rc;\r\n    int error;\r\n\r\n    /* open an iconv conversion descriptor if necessary */\r\n    if(data->inbound_cd == (iconv_t)-1) {\r\n      data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,\r\n                                    CURL_ICONV_CODESET_OF_NETWORK);\r\n      if(data->inbound_cd == (iconv_t)-1) {\r\n        error = ERRNO;\r\n        failf(data,\r\n              \"The iconv_open(\\\"%s\\\", \\\"%s\\\") call failed with errno %i: %s\",\r\n              CURL_ICONV_CODESET_OF_HOST,\r\n              CURL_ICONV_CODESET_OF_NETWORK,\r\n              error, strerror(error));\r\n        return CURLE_CONV_FAILED;\r\n      }\r\n    }\r\n    /* call iconv */\r\n    input_ptr = output_ptr = buffer;\r\n    in_bytes = out_bytes = length;\r\n    rc = iconv(data->inbound_cd, (const char **)&input_ptr, &in_bytes,\r\n               &output_ptr, &out_bytes);\r\n    if((rc == ICONV_ERROR) || (in_bytes != 0)) {\r\n      error = ERRNO;\r\n      failf(data,\r\n            \"Curl_convert_from_network iconv call failed with errno %i: %s\",\r\n            error, strerror(error));\r\n      return CURLE_CONV_FAILED;\r\n    }\r\n#else\r\n    failf(data, \"CURLOPT_CONV_FROM_NETWORK_FUNCTION callback required\");\r\n    return CURLE_CONV_REQD;\r\n#endif /* HAVE_ICONV */\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_convert_from_utf8() is an internal function for performing UTF-8\r\n * conversions on non-ASCII platforms.\r\n */\r\nCURLcode Curl_convert_from_utf8(struct SessionHandle *data,\r\n                                char *buffer, size_t length)\r\n{\r\n  CURLcode rc;\r\n\r\n  if(data->set.convfromutf8) {\r\n    /* use translation callback */\r\n    rc = data->set.convfromutf8(buffer, length);\r\n    if(rc != CURLE_OK) {\r\n      failf(data,\r\n            \"CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s\",\r\n            (int)rc, curl_easy_strerror(rc));\r\n    }\r\n    return rc;\r\n  }\r\n  else {\r\n#ifdef HAVE_ICONV\r\n    /* do the translation ourselves */\r\n    const char *input_ptr;\r\n    char *output_ptr;\r\n    size_t in_bytes, out_bytes, rc;\r\n    int error;\r\n\r\n    /* open an iconv conversion descriptor if necessary */\r\n    if(data->utf8_cd == (iconv_t)-1) {\r\n      data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,\r\n                                 CURL_ICONV_CODESET_FOR_UTF8);\r\n      if(data->utf8_cd == (iconv_t)-1) {\r\n        error = ERRNO;\r\n        failf(data,\r\n              \"The iconv_open(\\\"%s\\\", \\\"%s\\\") call failed with errno %i: %s\",\r\n              CURL_ICONV_CODESET_OF_HOST,\r\n              CURL_ICONV_CODESET_FOR_UTF8,\r\n              error, strerror(error));\r\n        return CURLE_CONV_FAILED;\r\n      }\r\n    }\r\n    /* call iconv */\r\n    input_ptr = output_ptr = buffer;\r\n    in_bytes = out_bytes = length;\r\n    rc = iconv(data->utf8_cd, &input_ptr, &in_bytes,\r\n               &output_ptr, &out_bytes);\r\n    if((rc == ICONV_ERROR) || (in_bytes != 0)) {\r\n      error = ERRNO;\r\n      failf(data,\r\n            \"The Curl_convert_from_utf8 iconv call failed with errno %i: %s\",\r\n            error, strerror(error));\r\n      return CURLE_CONV_FAILED;\r\n    }\r\n    if(output_ptr < input_ptr) {\r\n      /* null terminate the now shorter output string */\r\n      *output_ptr = 0x00;\r\n    }\r\n#else\r\n    failf(data, \"CURLOPT_CONV_FROM_UTF8_FUNCTION callback required\");\r\n    return CURLE_CONV_REQD;\r\n#endif /* HAVE_ICONV */\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Init conversion stuff for a SessionHandle\r\n */\r\nvoid Curl_convert_init(struct SessionHandle *data)\r\n{\r\n#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)\r\n  /* conversion descriptors for iconv calls */\r\n  data->outbound_cd = (iconv_t)-1;\r\n  data->inbound_cd  = (iconv_t)-1;\r\n  data->utf8_cd     = (iconv_t)-1;\r\n#else\r\n  (void)data;\r\n#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */\r\n}\r\n\r\n/*\r\n * Setup conversion stuff for a SessionHandle\r\n */\r\nvoid Curl_convert_setup(struct SessionHandle *data)\r\n{\r\n  data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,\r\n                                CURL_ICONV_CODESET_OF_NETWORK);\r\n  data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,\r\n                                 CURL_ICONV_CODESET_OF_HOST);\r\n  data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,\r\n                             CURL_ICONV_CODESET_FOR_UTF8);\r\n}\r\n\r\n/*\r\n * Close conversion stuff for a SessionHandle\r\n */\r\n\r\nvoid Curl_convert_close(struct SessionHandle *data)\r\n{\r\n#ifdef HAVE_ICONV\r\n  /* close iconv conversion descriptors */\r\n  if(data->inbound_cd != (iconv_t)-1) {\r\n    iconv_close(data->inbound_cd);\r\n  }\r\n  if(data->outbound_cd != (iconv_t)-1) {\r\n    iconv_close(data->outbound_cd);\r\n  }\r\n  if(data->utf8_cd != (iconv_t)-1) {\r\n    iconv_close(data->utf8_cd);\r\n  }\r\n#else\r\n  (void)data;\r\n#endif /* HAVE_ICONV */\r\n}\r\n\r\n/*\r\n * Curl_convert_form() is used from http.c, this converts any form items that\r\n   need to be sent in the network encoding.  Returns CURLE_OK on success.\r\n */\r\nCURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form)\r\n{\r\n  struct FormData *next;\r\n  CURLcode rc;\r\n\r\n  if(!form)\r\n    return CURLE_OK;\r\n\r\n  if(!data)\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n\r\n  do {\r\n    next=form->next;  /* the following form line */\r\n    if(form->type == FORM_DATA) {\r\n      rc = Curl_convert_to_network(data, form->line, form->length);\r\n      /* Curl_convert_to_network calls failf if unsuccessful */\r\n      if(rc != CURLE_OK)\r\n        return rc;\r\n    }\r\n  } while((form = next) != NULL); /* continue */\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/non-ascii.h",
    "content": "#ifndef HEADER_CURL_NON_ASCII_H\r\n#define HEADER_CURL_NON_ASCII_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n\r\n#include \"urldata.h\"\r\n\r\n/*\r\n * Curl_convert_clone() returns a malloced copy of the source string (if\r\n * returning CURLE_OK), with the data converted to network format.\r\n *\r\n * If no conversion was needed *outbuf may be NULL.\r\n */\r\nCURLcode Curl_convert_clone(struct SessionHandle *data,\r\n                            const char *indata,\r\n                            size_t insize,\r\n                            char **outbuf);\r\n\r\nvoid Curl_convert_init(struct SessionHandle *data);\r\nvoid Curl_convert_setup(struct SessionHandle *data);\r\nvoid Curl_convert_close(struct SessionHandle *data);\r\n\r\nCURLcode Curl_convert_to_network(struct SessionHandle *data,\r\n                                 char *buffer, size_t length);\r\nCURLcode Curl_convert_from_network(struct SessionHandle *data,\r\n                                 char *buffer, size_t length);\r\nCURLcode Curl_convert_from_utf8(struct SessionHandle *data,\r\n                                 char *buffer, size_t length);\r\nCURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form);\r\n#else\r\n#define Curl_convert_clone(a,b,c,d) ((void)a, CURLE_OK)\r\n#define Curl_convert_init(x) Curl_nop_stmt\r\n#define Curl_convert_setup(x) Curl_nop_stmt\r\n#define Curl_convert_close(x) Curl_nop_stmt\r\n#define Curl_convert_to_network(a,b,c) ((void)a, CURLE_OK)\r\n#define Curl_convert_from_network(a,b,c) ((void)a, CURLE_OK)\r\n#define Curl_convert_from_utf8(a,b,c) ((void)a, CURLE_OK)\r\n#define Curl_convert_form(a,b) CURLE_OK\r\n#endif\r\n\r\n#endif /* HEADER_CURL_NON_ASCII_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/nonblock.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n#ifdef HAVE_FCNTL_H\r\n#include <fcntl.h>\r\n#endif\r\n\r\n#if (defined(HAVE_IOCTL_FIONBIO) && defined(NETWARE))\r\n#include <sys/filio.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#include \"nonblock.h\"\r\n\r\n/*\r\n * curlx_nonblock() set the given socket to either blocking or non-blocking\r\n * mode based on the 'nonblock' boolean argument. This function is highly\r\n * portable.\r\n */\r\nint curlx_nonblock(curl_socket_t sockfd,    /* operate on this */\r\n                   int nonblock   /* TRUE or FALSE */)\r\n{\r\n#if defined(USE_BLOCKING_SOCKETS)\r\n\r\n  return 0; /* returns success */\r\n\r\n#elif defined(HAVE_FCNTL_O_NONBLOCK)\r\n\r\n  /* most recent unix versions */\r\n  int flags;\r\n  flags = sfcntl(sockfd, F_GETFL, 0);\r\n  if(nonblock)\r\n    return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK);\r\n  else\r\n    return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));\r\n\r\n#elif defined(HAVE_IOCTL_FIONBIO)\r\n\r\n  /* older unix versions */\r\n  int flags = nonblock ? 1 : 0;\r\n  return ioctl(sockfd, FIONBIO, &flags);\r\n\r\n#elif defined(HAVE_IOCTLSOCKET_FIONBIO)\r\n\r\n  /* Windows */\r\n  unsigned long flags = nonblock ? 1UL : 0UL;\r\n  return ioctlsocket(sockfd, FIONBIO, &flags);\r\n\r\n#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)\r\n\r\n  /* Amiga */\r\n  long flags = nonblock ? 1L : 0L;\r\n  return IoctlSocket(sockfd, FIONBIO, flags);\r\n\r\n#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)\r\n\r\n  /* BeOS */\r\n  long b = nonblock ? 1L : 0L;\r\n  return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));\r\n\r\n#else\r\n#  error \"no non-blocking method was found/used/set\"\r\n#endif\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/nonblock.h",
    "content": "#ifndef HEADER_CURL_NONBLOCK_H\r\n#define HEADER_CURL_NONBLOCK_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h> /* for curl_socket_t */\r\n\r\nint curlx_nonblock(curl_socket_t sockfd,    /* operate on this */\r\n                   int nonblock   /* TRUE or FALSE */);\r\n\r\n#endif /* HEADER_CURL_NONBLOCK_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/nss.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all NSS-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_NSS\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"formdata.h\" /* for the boundary function */\r\n#include \"url.h\" /* for the ssl config check function */\r\n#include \"connect.h\"\r\n#include \"strequal.h\"\r\n#include \"select.h\"\r\n#include \"sslgen.h\"\r\n#include \"llist.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use the internal *printf() functions */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"nssg.h\"\r\n#include <nspr.h>\r\n#include <nss.h>\r\n#include <ssl.h>\r\n#include <sslerr.h>\r\n#include <secerr.h>\r\n#include <secmod.h>\r\n#include <sslproto.h>\r\n#include <prtypes.h>\r\n#include <pk11pub.h>\r\n#include <prio.h>\r\n#include <secitem.h>\r\n#include <secport.h>\r\n#include <certdb.h>\r\n#include <base64.h>\r\n#include <cert.h>\r\n#include <prerror.h>\r\n\r\n#include \"curl_memory.h\"\r\n#include \"rawstr.h\"\r\n#include \"warnless.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define SSL_DIR \"/etc/pki/nssdb\"\r\n\r\n/* enough to fit the string \"PEM Token #[0|1]\" */\r\n#define SLOTSIZE 13\r\n\r\nPRFileDesc *PR_ImportTCPSocket(PRInt32 osfd);\r\n\r\nPRLock * nss_initlock = NULL;\r\nPRLock * nss_crllock = NULL;\r\n#ifdef HAVE_NSS_INITCONTEXT\r\nNSSInitContext * nss_context = NULL;\r\n#endif\r\n\r\nvolatile int initialized = 0;\r\n\r\ntypedef struct {\r\n  const char *name;\r\n  int num;\r\n} cipher_s;\r\n\r\n#define PK11_SETATTRS(_attr, _idx, _type, _val, _len) do {  \\\r\n  CK_ATTRIBUTE *ptr = (_attr) + ((_idx)++);                 \\\r\n  ptr->type = (_type);                                      \\\r\n  ptr->pValue = (_val);                                     \\\r\n  ptr->ulValueLen = (_len);                                 \\\r\n} WHILE_FALSE\r\n\r\n#define CERT_NewTempCertificate __CERT_NewTempCertificate\r\n\r\n#define NUM_OF_CIPHERS sizeof(cipherlist)/sizeof(cipherlist[0])\r\nstatic const cipher_s cipherlist[] = {\r\n  /* SSL2 cipher suites */\r\n  {\"rc4\",                        SSL_EN_RC4_128_WITH_MD5},\r\n  {\"rc4-md5\",                    SSL_EN_RC4_128_WITH_MD5},\r\n  {\"rc4export\",                  SSL_EN_RC4_128_EXPORT40_WITH_MD5},\r\n  {\"rc2\",                        SSL_EN_RC2_128_CBC_WITH_MD5},\r\n  {\"rc2export\",                  SSL_EN_RC2_128_CBC_EXPORT40_WITH_MD5},\r\n  {\"des\",                        SSL_EN_DES_64_CBC_WITH_MD5},\r\n  {\"desede3\",                    SSL_EN_DES_192_EDE3_CBC_WITH_MD5},\r\n  /* SSL3/TLS cipher suites */\r\n  {\"rsa_rc4_128_md5\",            SSL_RSA_WITH_RC4_128_MD5},\r\n  {\"rsa_rc4_128_sha\",            SSL_RSA_WITH_RC4_128_SHA},\r\n  {\"rsa_3des_sha\",               SSL_RSA_WITH_3DES_EDE_CBC_SHA},\r\n  {\"rsa_des_sha\",                SSL_RSA_WITH_DES_CBC_SHA},\r\n  {\"rsa_rc4_40_md5\",             SSL_RSA_EXPORT_WITH_RC4_40_MD5},\r\n  {\"rsa_rc2_40_md5\",             SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5},\r\n  {\"rsa_null_md5\",               SSL_RSA_WITH_NULL_MD5},\r\n  {\"rsa_null_sha\",               SSL_RSA_WITH_NULL_SHA},\r\n  {\"fips_3des_sha\",              SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA},\r\n  {\"fips_des_sha\",               SSL_RSA_FIPS_WITH_DES_CBC_SHA},\r\n  {\"fortezza\",                   SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA},\r\n  {\"fortezza_rc4_128_sha\",       SSL_FORTEZZA_DMS_WITH_RC4_128_SHA},\r\n  {\"fortezza_null\",              SSL_FORTEZZA_DMS_WITH_NULL_SHA},\r\n  /* TLS 1.0: Exportable 56-bit Cipher Suites. */\r\n  {\"rsa_des_56_sha\",             TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA},\r\n  {\"rsa_rc4_56_sha\",             TLS_RSA_EXPORT1024_WITH_RC4_56_SHA},\r\n  /* AES ciphers. */\r\n  {\"rsa_aes_128_sha\",            TLS_RSA_WITH_AES_128_CBC_SHA},\r\n  {\"rsa_aes_256_sha\",            TLS_RSA_WITH_AES_256_CBC_SHA},\r\n#ifdef NSS_ENABLE_ECC\r\n  /* ECC ciphers. */\r\n  {\"ecdh_ecdsa_null_sha\",        TLS_ECDH_ECDSA_WITH_NULL_SHA},\r\n  {\"ecdh_ecdsa_rc4_128_sha\",     TLS_ECDH_ECDSA_WITH_RC4_128_SHA},\r\n  {\"ecdh_ecdsa_3des_sha\",        TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA},\r\n  {\"ecdh_ecdsa_aes_128_sha\",     TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA},\r\n  {\"ecdh_ecdsa_aes_256_sha\",     TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA},\r\n  {\"ecdhe_ecdsa_null_sha\",       TLS_ECDHE_ECDSA_WITH_NULL_SHA},\r\n  {\"ecdhe_ecdsa_rc4_128_sha\",    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA},\r\n  {\"ecdhe_ecdsa_3des_sha\",       TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA},\r\n  {\"ecdhe_ecdsa_aes_128_sha\",    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA},\r\n  {\"ecdhe_ecdsa_aes_256_sha\",    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\r\n  {\"ecdh_rsa_null_sha\",          TLS_ECDH_RSA_WITH_NULL_SHA},\r\n  {\"ecdh_rsa_128_sha\",           TLS_ECDH_RSA_WITH_RC4_128_SHA},\r\n  {\"ecdh_rsa_3des_sha\",          TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA},\r\n  {\"ecdh_rsa_aes_128_sha\",       TLS_ECDH_RSA_WITH_AES_128_CBC_SHA},\r\n  {\"ecdh_rsa_aes_256_sha\",       TLS_ECDH_RSA_WITH_AES_256_CBC_SHA},\r\n  {\"echde_rsa_null\",             TLS_ECDHE_RSA_WITH_NULL_SHA},\r\n  {\"ecdhe_rsa_rc4_128_sha\",      TLS_ECDHE_RSA_WITH_RC4_128_SHA},\r\n  {\"ecdhe_rsa_3des_sha\",         TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA},\r\n  {\"ecdhe_rsa_aes_128_sha\",      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA},\r\n  {\"ecdhe_rsa_aes_256_sha\",      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA},\r\n  {\"ecdh_anon_null_sha\",         TLS_ECDH_anon_WITH_NULL_SHA},\r\n  {\"ecdh_anon_rc4_128sha\",       TLS_ECDH_anon_WITH_RC4_128_SHA},\r\n  {\"ecdh_anon_3des_sha\",         TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA},\r\n  {\"ecdh_anon_aes_128_sha\",      TLS_ECDH_anon_WITH_AES_128_CBC_SHA},\r\n  {\"ecdh_anon_aes_256_sha\",      TLS_ECDH_anon_WITH_AES_256_CBC_SHA},\r\n#endif\r\n};\r\n\r\n/* following ciphers are new in NSS 3.4 and not enabled by default, therefore\r\n   they are enabled explicitly */\r\nstatic const int enable_ciphers_by_default[] = {\r\n  TLS_DHE_DSS_WITH_AES_128_CBC_SHA,\r\n  TLS_DHE_DSS_WITH_AES_256_CBC_SHA,\r\n  TLS_DHE_RSA_WITH_AES_128_CBC_SHA,\r\n  TLS_DHE_RSA_WITH_AES_256_CBC_SHA,\r\n  TLS_RSA_WITH_AES_128_CBC_SHA,\r\n  TLS_RSA_WITH_AES_256_CBC_SHA,\r\n  SSL_NULL_WITH_NULL_NULL\r\n};\r\n\r\nstatic const char* pem_library = \"libnsspem.so\";\r\nSECMODModule* mod = NULL;\r\n\r\nstatic const char* nss_error_to_name(PRErrorCode code)\r\n{\r\n  const char *name = PR_ErrorToName(code);\r\n  if(name)\r\n    return name;\r\n\r\n  return \"unknown error\";\r\n}\r\n\r\nstatic void nss_print_error_message(struct SessionHandle *data, PRUint32 err)\r\n{\r\n  failf(data, \"%s\", PR_ErrorToString(err, PR_LANGUAGE_I_DEFAULT));\r\n}\r\n\r\nstatic SECStatus set_ciphers(struct SessionHandle *data, PRFileDesc * model,\r\n                             char *cipher_list)\r\n{\r\n  unsigned int i;\r\n  PRBool cipher_state[NUM_OF_CIPHERS];\r\n  PRBool found;\r\n  char *cipher;\r\n  SECStatus rv;\r\n\r\n  /* First disable all ciphers. This uses a different max value in case\r\n   * NSS adds more ciphers later we don't want them available by\r\n   * accident\r\n   */\r\n  for(i=0; i<SSL_NumImplementedCiphers; i++) {\r\n    SSL_CipherPrefSet(model, SSL_ImplementedCiphers[i], SSL_NOT_ALLOWED);\r\n  }\r\n\r\n  /* Set every entry in our list to false */\r\n  for(i=0; i<NUM_OF_CIPHERS; i++) {\r\n    cipher_state[i] = PR_FALSE;\r\n  }\r\n\r\n  cipher = cipher_list;\r\n\r\n  while(cipher_list && (cipher_list[0])) {\r\n    while((*cipher) && (ISSPACE(*cipher)))\r\n      ++cipher;\r\n\r\n    if((cipher_list = strchr(cipher, ','))) {\r\n      *cipher_list++ = '\\0';\r\n    }\r\n\r\n    found = PR_FALSE;\r\n\r\n    for(i=0; i<NUM_OF_CIPHERS; i++) {\r\n      if(Curl_raw_equal(cipher, cipherlist[i].name)) {\r\n        cipher_state[i] = PR_TRUE;\r\n        found = PR_TRUE;\r\n        break;\r\n      }\r\n    }\r\n\r\n    if(found == PR_FALSE) {\r\n      failf(data, \"Unknown cipher in list: %s\", cipher);\r\n      return SECFailure;\r\n    }\r\n\r\n    if(cipher_list) {\r\n      cipher = cipher_list;\r\n    }\r\n  }\r\n\r\n  /* Finally actually enable the selected ciphers */\r\n  for(i=0; i<NUM_OF_CIPHERS; i++) {\r\n    rv = SSL_CipherPrefSet(model, cipherlist[i].num, cipher_state[i]);\r\n    if(rv != SECSuccess) {\r\n      failf(data, \"cipher-suite not supported by NSS: %s\", cipherlist[i].name);\r\n      return SECFailure;\r\n    }\r\n  }\r\n\r\n  return SECSuccess;\r\n}\r\n\r\n/*\r\n * Get the number of ciphers that are enabled. We use this to determine\r\n * if we need to call NSS_SetDomesticPolicy() to enable the default ciphers.\r\n */\r\nstatic int num_enabled_ciphers(void)\r\n{\r\n  PRInt32 policy = 0;\r\n  int count = 0;\r\n  unsigned int i;\r\n\r\n  for(i=0; i<NUM_OF_CIPHERS; i++) {\r\n    SSL_CipherPolicyGet(cipherlist[i].num, &policy);\r\n    if(policy)\r\n      count++;\r\n  }\r\n  return count;\r\n}\r\n\r\n/*\r\n * Determine whether the nickname passed in is a filename that needs to\r\n * be loaded as a PEM or a regular NSS nickname.\r\n *\r\n * returns 1 for a file\r\n * returns 0 for not a file (NSS nickname)\r\n */\r\nstatic int is_file(const char *filename)\r\n{\r\n  struct_stat st;\r\n\r\n  if(filename == NULL)\r\n    return 0;\r\n\r\n  if(stat(filename, &st) == 0)\r\n    if(S_ISREG(st.st_mode))\r\n      return 1;\r\n\r\n  return 0;\r\n}\r\n\r\n/* Check if the given string is filename or nickname of a certificate.  If the\r\n * given string is recognized as filename, return NULL.  If the given string is\r\n * recognized as nickname, return a duplicated string.  The returned string\r\n * should be later deallocated using free().  If the OOM failure occurs, we\r\n * return NULL, too.\r\n */\r\nstatic char* dup_nickname(struct SessionHandle *data, enum dupstring cert_kind)\r\n{\r\n  const char *str = data->set.str[cert_kind];\r\n  const char *n;\r\n\r\n  if(!is_file(str))\r\n    /* no such file exists, use the string as nickname */\r\n    return strdup(str);\r\n\r\n  /* search the last slash; we require at least one slash in a file name */\r\n  n = strrchr(str, '/');\r\n  if(!n) {\r\n    infof(data, \"warning: certificate file name \\\"%s\\\" handled as nickname; \"\r\n          \"please use \\\"./%s\\\" to force file name\\n\", str, str);\r\n    return strdup(str);\r\n  }\r\n\r\n  /* we'll use the PEM reader to read the certificate from file */\r\n  return NULL;\r\n}\r\n\r\n/* Call PK11_CreateGenericObject() with the given obj_class and filename.  If\r\n * the call succeeds, append the object handle to the list of objects so that\r\n * the object can be destroyed in Curl_nss_close(). */\r\nstatic CURLcode nss_create_object(struct ssl_connect_data *ssl,\r\n                                  CK_OBJECT_CLASS obj_class,\r\n                                  const char *filename, bool cacert)\r\n{\r\n  PK11SlotInfo *slot;\r\n  PK11GenericObject *obj;\r\n  CK_BBOOL cktrue = CK_TRUE;\r\n  CK_BBOOL ckfalse = CK_FALSE;\r\n  CK_ATTRIBUTE attrs[/* max count of attributes */ 4];\r\n  int attr_cnt = 0;\r\n  CURLcode err = (cacert)\r\n    ? CURLE_SSL_CACERT_BADFILE\r\n    : CURLE_SSL_CERTPROBLEM;\r\n\r\n  const int slot_id = (cacert) ? 0 : 1;\r\n  char *slot_name = aprintf(\"PEM Token #%d\", slot_id);\r\n  if(!slot_name)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  slot = PK11_FindSlotByName(slot_name);\r\n  free(slot_name);\r\n  if(!slot)\r\n    return err;\r\n\r\n  PK11_SETATTRS(attrs, attr_cnt, CKA_CLASS, &obj_class, sizeof(obj_class));\r\n  PK11_SETATTRS(attrs, attr_cnt, CKA_TOKEN, &cktrue, sizeof(CK_BBOOL));\r\n  PK11_SETATTRS(attrs, attr_cnt, CKA_LABEL, (unsigned char *)filename,\r\n                strlen(filename) + 1);\r\n\r\n  if(CKO_CERTIFICATE == obj_class) {\r\n    CK_BBOOL *pval = (cacert) ? (&cktrue) : (&ckfalse);\r\n    PK11_SETATTRS(attrs, attr_cnt, CKA_TRUST, pval, sizeof(*pval));\r\n  }\r\n\r\n  obj = PK11_CreateGenericObject(slot, attrs, attr_cnt, PR_FALSE);\r\n  PK11_FreeSlot(slot);\r\n  if(!obj)\r\n    return err;\r\n\r\n  if(!Curl_llist_insert_next(ssl->obj_list, ssl->obj_list->tail, obj)) {\r\n    PK11_DestroyGenericObject(obj);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  if(!cacert && CKO_CERTIFICATE == obj_class)\r\n    /* store reference to a client certificate */\r\n    ssl->obj_clicert = obj;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Destroy the NSS object whose handle is given by ptr.  This function is\r\n * a callback of Curl_llist_alloc() used by Curl_llist_destroy() to destroy\r\n * NSS objects in Curl_nss_close() */\r\nstatic void nss_destroy_object(void *user, void *ptr)\r\n{\r\n  PK11GenericObject *obj = (PK11GenericObject *)ptr;\r\n  (void) user;\r\n  PK11_DestroyGenericObject(obj);\r\n}\r\n\r\nstatic CURLcode nss_load_cert(struct ssl_connect_data *ssl,\r\n                              const char *filename, PRBool cacert)\r\n{\r\n  CURLcode err = (cacert)\r\n    ? CURLE_SSL_CACERT_BADFILE\r\n    : CURLE_SSL_CERTPROBLEM;\r\n\r\n  /* libnsspem.so leaks memory if the requested file does not exist.  For more\r\n   * details, go to <https://bugzilla.redhat.com/734760>. */\r\n  if(is_file(filename))\r\n    err = nss_create_object(ssl, CKO_CERTIFICATE, filename, cacert);\r\n\r\n  if(CURLE_OK == err && !cacert) {\r\n    /* we have successfully loaded a client certificate */\r\n    CERTCertificate *cert;\r\n    char *nickname = NULL;\r\n    char *n = strrchr(filename, '/');\r\n    if(n)\r\n      n++;\r\n\r\n    /* The following undocumented magic helps to avoid a SIGSEGV on call\r\n     * of PK11_ReadRawAttribute() from SelectClientCert() when using an\r\n     * immature version of libnsspem.so.  For more details, go to\r\n     * <https://bugzilla.redhat.com/733685>. */\r\n    nickname = aprintf(\"PEM Token #1:%s\", n);\r\n    if(nickname) {\r\n      cert = PK11_FindCertFromNickname(nickname, NULL);\r\n      if(cert)\r\n        CERT_DestroyCertificate(cert);\r\n\r\n      free(nickname);\r\n    }\r\n  }\r\n\r\n  return err;\r\n}\r\n\r\n/* add given CRL to cache if it is not already there */\r\nstatic SECStatus nss_cache_crl(SECItem *crlDER)\r\n{\r\n  CERTCertDBHandle *db = CERT_GetDefaultCertDB();\r\n  CERTSignedCrl *crl = SEC_FindCrlByDERCert(db, crlDER, 0);\r\n  if(crl) {\r\n    /* CRL already cached */\r\n    SEC_DestroyCrl(crl);\r\n    SECITEM_FreeItem(crlDER, PR_FALSE);\r\n    return SECSuccess;\r\n  }\r\n\r\n  /* acquire lock before call of CERT_CacheCRL() */\r\n  PR_Lock(nss_crllock);\r\n  if(SECSuccess != CERT_CacheCRL(db, crlDER)) {\r\n    /* unable to cache CRL */\r\n    PR_Unlock(nss_crllock);\r\n    SECITEM_FreeItem(crlDER, PR_FALSE);\r\n    return SECFailure;\r\n  }\r\n\r\n  /* we need to clear session cache, so that the CRL could take effect */\r\n  SSL_ClearSessionCache();\r\n  PR_Unlock(nss_crllock);\r\n  return SECSuccess;\r\n}\r\n\r\nstatic SECStatus nss_load_crl(const char* crlfilename)\r\n{\r\n  PRFileDesc *infile;\r\n  PRFileInfo  info;\r\n  SECItem filedata = { 0, NULL, 0 };\r\n  SECItem crlDER = { 0, NULL, 0 };\r\n  char *body;\r\n\r\n  infile = PR_Open(crlfilename, PR_RDONLY, 0);\r\n  if(!infile)\r\n    return SECFailure;\r\n\r\n  if(PR_SUCCESS != PR_GetOpenFileInfo(infile, &info))\r\n    goto fail;\r\n\r\n  if(!SECITEM_AllocItem(NULL, &filedata, info.size + /* zero ended */ 1))\r\n    goto fail;\r\n\r\n  if(info.size != PR_Read(infile, filedata.data, info.size))\r\n    goto fail;\r\n\r\n  /* place a trailing zero right after the visible data */\r\n  body = (char*)filedata.data;\r\n  body[--filedata.len] = '\\0';\r\n\r\n  body = strstr(body, \"-----BEGIN\");\r\n  if(body) {\r\n    /* assume ASCII */\r\n    char *trailer;\r\n    char *begin = PORT_Strchr(body, '\\n');\r\n    if(!begin)\r\n      begin = PORT_Strchr(body, '\\r');\r\n    if(!begin)\r\n      goto fail;\r\n\r\n    trailer = strstr(++begin, \"-----END\");\r\n    if(!trailer)\r\n      goto fail;\r\n\r\n    /* retrieve DER from ASCII */\r\n    *trailer = '\\0';\r\n    if(ATOB_ConvertAsciiToItem(&crlDER, begin))\r\n      goto fail;\r\n\r\n    SECITEM_FreeItem(&filedata, PR_FALSE);\r\n  }\r\n  else\r\n    /* assume DER */\r\n    crlDER = filedata;\r\n\r\n  PR_Close(infile);\r\n  return nss_cache_crl(&crlDER);\r\n\r\nfail:\r\n  PR_Close(infile);\r\n  SECITEM_FreeItem(&filedata, PR_FALSE);\r\n  return SECFailure;\r\n}\r\n\r\nstatic CURLcode nss_load_key(struct connectdata *conn, int sockindex,\r\n                             char *key_file)\r\n{\r\n  PK11SlotInfo *slot;\r\n  SECStatus status;\r\n  CURLcode rv;\r\n  struct ssl_connect_data *ssl = conn->ssl;\r\n  (void)sockindex; /* unused */\r\n\r\n  rv = nss_create_object(ssl, CKO_PRIVATE_KEY, key_file, FALSE);\r\n  if(CURLE_OK != rv) {\r\n    PR_SetError(SEC_ERROR_BAD_KEY, 0);\r\n    return rv;\r\n  }\r\n\r\n  slot = PK11_FindSlotByName(\"PEM Token #1\");\r\n  if(!slot)\r\n    return CURLE_SSL_CERTPROBLEM;\r\n\r\n  /* This will force the token to be seen as re-inserted */\r\n  SECMOD_WaitForAnyTokenEvent(mod, 0, 0);\r\n  PK11_IsPresent(slot);\r\n\r\n  status = PK11_Authenticate(slot, PR_TRUE,\r\n                             conn->data->set.str[STRING_KEY_PASSWD]);\r\n  PK11_FreeSlot(slot);\r\n  return (SECSuccess == status)\r\n    ? CURLE_OK\r\n    : CURLE_SSL_CERTPROBLEM;\r\n}\r\n\r\nstatic int display_error(struct connectdata *conn, PRInt32 err,\r\n                         const char *filename)\r\n{\r\n  switch(err) {\r\n  case SEC_ERROR_BAD_PASSWORD:\r\n    failf(conn->data, \"Unable to load client key: Incorrect password\");\r\n    return 1;\r\n  case SEC_ERROR_UNKNOWN_CERT:\r\n    failf(conn->data, \"Unable to load certificate %s\", filename);\r\n    return 1;\r\n  default:\r\n    break;\r\n  }\r\n  return 0; /* The caller will print a generic error */\r\n}\r\n\r\nstatic CURLcode cert_stuff(struct connectdata *conn, int sockindex,\r\n                           char *cert_file, char *key_file)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode rv;\r\n\r\n  if(cert_file) {\r\n    rv = nss_load_cert(&conn->ssl[sockindex], cert_file, PR_FALSE);\r\n    if(CURLE_OK != rv) {\r\n      const PRErrorCode err = PR_GetError();\r\n      if(!display_error(conn, err, cert_file)) {\r\n        const char *err_name = nss_error_to_name(err);\r\n        failf(data, \"unable to load client cert: %d (%s)\", err, err_name);\r\n      }\r\n\r\n      return rv;\r\n    }\r\n  }\r\n\r\n  if(key_file || (is_file(cert_file))) {\r\n    if(key_file)\r\n      rv = nss_load_key(conn, sockindex, key_file);\r\n    else\r\n      /* In case the cert file also has the key */\r\n      rv = nss_load_key(conn, sockindex, cert_file);\r\n    if(CURLE_OK != rv) {\r\n      const PRErrorCode err = PR_GetError();\r\n      if(!display_error(conn, err, key_file)) {\r\n        const char *err_name = nss_error_to_name(err);\r\n        failf(data, \"unable to load client key: %d (%s)\", err, err_name);\r\n      }\r\n\r\n      return rv;\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic char * nss_get_password(PK11SlotInfo * slot, PRBool retry, void *arg)\r\n{\r\n  (void)slot; /* unused */\r\n  if(retry || NULL == arg)\r\n    return NULL;\r\n  else\r\n    return (char *)PORT_Strdup((char *)arg);\r\n}\r\n\r\n/* bypass the default SSL_AuthCertificate() hook in case we do not want to\r\n * verify peer */\r\nstatic SECStatus nss_auth_cert_hook(void *arg, PRFileDesc *fd, PRBool checksig,\r\n                                    PRBool isServer)\r\n{\r\n  struct connectdata *conn = (struct connectdata *)arg;\r\n  if(!conn->data->set.ssl.verifypeer) {\r\n    infof(conn->data, \"skipping SSL peer certificate verification\\n\");\r\n    return SECSuccess;\r\n  }\r\n\r\n  return SSL_AuthCertificate(CERT_GetDefaultCertDB(), fd, checksig, isServer);\r\n}\r\n\r\n/**\r\n * Inform the application that the handshake is complete.\r\n */\r\nstatic void HandshakeCallback(PRFileDesc *sock, void *arg)\r\n{\r\n  (void)sock;\r\n  (void)arg;\r\n}\r\n\r\nstatic void display_cert_info(struct SessionHandle *data,\r\n                              CERTCertificate *cert)\r\n{\r\n  char *subject, *issuer, *common_name;\r\n  PRExplodedTime printableTime;\r\n  char timeString[256];\r\n  PRTime notBefore, notAfter;\r\n\r\n  subject = CERT_NameToAscii(&cert->subject);\r\n  issuer = CERT_NameToAscii(&cert->issuer);\r\n  common_name = CERT_GetCommonName(&cert->subject);\r\n  infof(data, \"\\tsubject: %s\\n\", subject);\r\n\r\n  CERT_GetCertTimes(cert, &notBefore, &notAfter);\r\n  PR_ExplodeTime(notBefore, PR_GMTParameters, &printableTime);\r\n  PR_FormatTime(timeString, 256, \"%b %d %H:%M:%S %Y GMT\", &printableTime);\r\n  infof(data, \"\\tstart date: %s\\n\", timeString);\r\n  PR_ExplodeTime(notAfter, PR_GMTParameters, &printableTime);\r\n  PR_FormatTime(timeString, 256, \"%b %d %H:%M:%S %Y GMT\", &printableTime);\r\n  infof(data, \"\\texpire date: %s\\n\", timeString);\r\n  infof(data, \"\\tcommon name: %s\\n\", common_name);\r\n  infof(data, \"\\tissuer: %s\\n\", issuer);\r\n\r\n  PR_Free(subject);\r\n  PR_Free(issuer);\r\n  PR_Free(common_name);\r\n}\r\n\r\nstatic void display_conn_info(struct connectdata *conn, PRFileDesc *sock)\r\n{\r\n  SSLChannelInfo channel;\r\n  SSLCipherSuiteInfo suite;\r\n  CERTCertificate *cert;\r\n\r\n  if(SSL_GetChannelInfo(sock, &channel, sizeof channel) ==\r\n     SECSuccess && channel.length == sizeof channel &&\r\n     channel.cipherSuite) {\r\n    if(SSL_GetCipherSuiteInfo(channel.cipherSuite,\r\n                              &suite, sizeof suite) == SECSuccess) {\r\n      infof(conn->data, \"SSL connection using %s\\n\", suite.cipherSuiteName);\r\n    }\r\n  }\r\n\r\n  infof(conn->data, \"Server certificate:\\n\");\r\n\r\n  cert = SSL_PeerCertificate(sock);\r\n  display_cert_info(conn->data, cert);\r\n  CERT_DestroyCertificate(cert);\r\n\r\n  return;\r\n}\r\n\r\nstatic SECStatus BadCertHandler(void *arg, PRFileDesc *sock)\r\n{\r\n  struct connectdata *conn = (struct connectdata *)arg;\r\n  struct SessionHandle *data = conn->data;\r\n  PRErrorCode err = PR_GetError();\r\n  CERTCertificate *cert;\r\n\r\n  /* remember the cert verification result */\r\n  data->set.ssl.certverifyresult = err;\r\n\r\n  if(err == SSL_ERROR_BAD_CERT_DOMAIN && !data->set.ssl.verifyhost)\r\n    /* we are asked not to verify the host name */\r\n    return SECSuccess;\r\n\r\n  /* print only info about the cert, the error is printed off the callback */\r\n  cert = SSL_PeerCertificate(sock);\r\n  if(cert) {\r\n    infof(data, \"Server certificate:\\n\");\r\n    display_cert_info(data, cert);\r\n    CERT_DestroyCertificate(cert);\r\n  }\r\n\r\n  return SECFailure;\r\n}\r\n\r\n/**\r\n *\r\n * Check that the Peer certificate's issuer certificate matches the one found\r\n * by issuer_nickname.  This is not exactly the way OpenSSL and GNU TLS do the\r\n * issuer check, so we provide comments that mimic the OpenSSL\r\n * X509_check_issued function (in x509v3/v3_purp.c)\r\n */\r\nstatic SECStatus check_issuer_cert(PRFileDesc *sock,\r\n                                   char *issuer_nickname)\r\n{\r\n  CERTCertificate *cert,*cert_issuer,*issuer;\r\n  SECStatus res=SECSuccess;\r\n  void *proto_win = NULL;\r\n\r\n  /*\r\n    PRArenaPool   *tmpArena = NULL;\r\n    CERTAuthKeyID *authorityKeyID = NULL;\r\n    SECITEM       *caname = NULL;\r\n  */\r\n\r\n  cert = SSL_PeerCertificate(sock);\r\n  cert_issuer = CERT_FindCertIssuer(cert,PR_Now(),certUsageObjectSigner);\r\n\r\n  proto_win = SSL_RevealPinArg(sock);\r\n  issuer = PK11_FindCertFromNickname(issuer_nickname, proto_win);\r\n\r\n  if((!cert_issuer) || (!issuer))\r\n    res = SECFailure;\r\n  else if(SECITEM_CompareItem(&cert_issuer->derCert,\r\n                              &issuer->derCert)!=SECEqual)\r\n    res = SECFailure;\r\n\r\n  CERT_DestroyCertificate(cert);\r\n  CERT_DestroyCertificate(issuer);\r\n  CERT_DestroyCertificate(cert_issuer);\r\n  return res;\r\n}\r\n\r\n/**\r\n *\r\n * Callback to pick the SSL client certificate.\r\n */\r\nstatic SECStatus SelectClientCert(void *arg, PRFileDesc *sock,\r\n                                  struct CERTDistNamesStr *caNames,\r\n                                  struct CERTCertificateStr **pRetCert,\r\n                                  struct SECKEYPrivateKeyStr **pRetKey)\r\n{\r\n  struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg;\r\n  struct SessionHandle *data = connssl->data;\r\n  const char *nickname = connssl->client_nickname;\r\n\r\n  if(connssl->obj_clicert) {\r\n    /* use the cert/key provided by PEM reader */\r\n    static const char pem_slotname[] = \"PEM Token #1\";\r\n    SECItem cert_der = { 0, NULL, 0 };\r\n    void *proto_win = SSL_RevealPinArg(sock);\r\n    struct CERTCertificateStr *cert;\r\n    struct SECKEYPrivateKeyStr *key;\r\n\r\n    PK11SlotInfo *slot = PK11_FindSlotByName(pem_slotname);\r\n    if(NULL == slot) {\r\n      failf(data, \"NSS: PK11 slot not found: %s\", pem_slotname);\r\n      return SECFailure;\r\n    }\r\n\r\n    if(PK11_ReadRawAttribute(PK11_TypeGeneric, connssl->obj_clicert, CKA_VALUE,\r\n                             &cert_der) != SECSuccess) {\r\n      failf(data, \"NSS: CKA_VALUE not found in PK11 generic object\");\r\n      PK11_FreeSlot(slot);\r\n      return SECFailure;\r\n    }\r\n\r\n    cert = PK11_FindCertFromDERCertItem(slot, &cert_der, proto_win);\r\n    SECITEM_FreeItem(&cert_der, PR_FALSE);\r\n    if(NULL == cert) {\r\n      failf(data, \"NSS: client certificate from file not found\");\r\n      PK11_FreeSlot(slot);\r\n      return SECFailure;\r\n    }\r\n\r\n    key = PK11_FindPrivateKeyFromCert(slot, cert, NULL);\r\n    PK11_FreeSlot(slot);\r\n    if(NULL == key) {\r\n      failf(data, \"NSS: private key from file not found\");\r\n      CERT_DestroyCertificate(cert);\r\n      return SECFailure;\r\n    }\r\n\r\n    infof(data, \"NSS: client certificate from file\\n\");\r\n    display_cert_info(data, cert);\r\n\r\n    *pRetCert = cert;\r\n    *pRetKey = key;\r\n    return SECSuccess;\r\n  }\r\n\r\n  /* use the default NSS hook */\r\n  if(SECSuccess != NSS_GetClientAuthData((void *)nickname, sock, caNames,\r\n                                          pRetCert, pRetKey)\r\n      || NULL == *pRetCert) {\r\n\r\n    if(NULL == nickname)\r\n      failf(data, \"NSS: client certificate not found (nickname not \"\r\n            \"specified)\");\r\n    else\r\n      failf(data, \"NSS: client certificate not found: %s\", nickname);\r\n\r\n    return SECFailure;\r\n  }\r\n\r\n  /* get certificate nickname if any */\r\n  nickname = (*pRetCert)->nickname;\r\n  if(NULL == nickname)\r\n    nickname = \"[unknown]\";\r\n\r\n  if(NULL == *pRetKey) {\r\n    failf(data, \"NSS: private key not found for certificate: %s\", nickname);\r\n    return SECFailure;\r\n  }\r\n\r\n  infof(data, \"NSS: using client certificate: %s\\n\", nickname);\r\n  display_cert_info(data, *pRetCert);\r\n  return SECSuccess;\r\n}\r\n\r\n/* This function is supposed to decide, which error codes should be used\r\n * to conclude server is TLS intolerant.\r\n *\r\n * taken from xulrunner - nsNSSIOLayer.cpp\r\n */\r\nstatic PRBool\r\nisTLSIntoleranceError(PRInt32 err)\r\n{\r\n  switch (err) {\r\n  case SSL_ERROR_BAD_MAC_ALERT:\r\n  case SSL_ERROR_BAD_MAC_READ:\r\n  case SSL_ERROR_HANDSHAKE_FAILURE_ALERT:\r\n  case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT:\r\n  case SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE:\r\n  case SSL_ERROR_ILLEGAL_PARAMETER_ALERT:\r\n  case SSL_ERROR_NO_CYPHER_OVERLAP:\r\n  case SSL_ERROR_BAD_SERVER:\r\n  case SSL_ERROR_BAD_BLOCK_PADDING:\r\n  case SSL_ERROR_UNSUPPORTED_VERSION:\r\n  case SSL_ERROR_PROTOCOL_VERSION_ALERT:\r\n  case SSL_ERROR_RX_MALFORMED_FINISHED:\r\n  case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE:\r\n  case SSL_ERROR_DECODE_ERROR_ALERT:\r\n  case SSL_ERROR_RX_UNKNOWN_ALERT:\r\n    return PR_TRUE;\r\n  default:\r\n    return PR_FALSE;\r\n  }\r\n}\r\n\r\nstatic CURLcode nss_init_core(struct SessionHandle *data, const char *cert_dir)\r\n{\r\n#ifdef HAVE_NSS_INITCONTEXT\r\n  NSSInitParameters initparams;\r\n\r\n  if(nss_context != NULL)\r\n    return CURLE_OK;\r\n\r\n  memset((void *) &initparams, '\\0', sizeof(initparams));\r\n  initparams.length = sizeof(initparams);\r\n#else /* HAVE_NSS_INITCONTEXT */\r\n  SECStatus rv;\r\n\r\n  if(NSS_IsInitialized())\r\n    return CURLE_OK;\r\n#endif\r\n\r\n  if(cert_dir) {\r\n    const bool use_sql = NSS_VersionCheck(\"3.12.0\");\r\n    char *certpath = aprintf(\"%s%s\", use_sql ? \"sql:\" : \"\", cert_dir);\r\n    if(!certpath)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    infof(data, \"Initializing NSS with certpath: %s\\n\", certpath);\r\n#ifdef HAVE_NSS_INITCONTEXT\r\n    nss_context = NSS_InitContext(certpath, \"\", \"\", \"\", &initparams,\r\n            NSS_INIT_READONLY | NSS_INIT_PK11RELOAD);\r\n    free(certpath);\r\n\r\n    if(nss_context != NULL)\r\n      return CURLE_OK;\r\n#else /* HAVE_NSS_INITCONTEXT */\r\n    rv = NSS_Initialize(certpath, \"\", \"\", \"\", NSS_INIT_READONLY);\r\n    free(certpath);\r\n\r\n    if(rv == SECSuccess)\r\n      return CURLE_OK;\r\n#endif\r\n\r\n    infof(data, \"Unable to initialize NSS database\\n\");\r\n  }\r\n\r\n  infof(data, \"Initializing NSS with certpath: none\\n\");\r\n#ifdef HAVE_NSS_INITCONTEXT\r\n  nss_context = NSS_InitContext(\"\", \"\", \"\", \"\", &initparams, NSS_INIT_READONLY\r\n         | NSS_INIT_NOCERTDB   | NSS_INIT_NOMODDB       | NSS_INIT_FORCEOPEN\r\n         | NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD);\r\n  if(nss_context != NULL)\r\n    return CURLE_OK;\r\n#else /* HAVE_NSS_INITCONTEXT */\r\n  if(NSS_NoDB_Init(NULL) == SECSuccess)\r\n    return CURLE_OK;\r\n#endif\r\n\r\n  infof(data, \"Unable to initialize NSS\\n\");\r\n  return CURLE_SSL_CACERT_BADFILE;\r\n}\r\n\r\nstatic CURLcode nss_init(struct SessionHandle *data)\r\n{\r\n  char *cert_dir;\r\n  struct_stat st;\r\n  CURLcode rv;\r\n\r\n  if(initialized)\r\n    return CURLE_OK;\r\n\r\n  /* First we check if $SSL_DIR points to a valid dir */\r\n  cert_dir = getenv(\"SSL_DIR\");\r\n  if(cert_dir) {\r\n    if((stat(cert_dir, &st) != 0) ||\r\n        (!S_ISDIR(st.st_mode))) {\r\n      cert_dir = NULL;\r\n    }\r\n  }\r\n\r\n  /* Now we check if the default location is a valid dir */\r\n  if(!cert_dir) {\r\n    if((stat(SSL_DIR, &st) == 0) &&\r\n        (S_ISDIR(st.st_mode))) {\r\n      cert_dir = (char *)SSL_DIR;\r\n    }\r\n  }\r\n\r\n  rv = nss_init_core(data, cert_dir);\r\n  if(rv)\r\n    return rv;\r\n\r\n  if(num_enabled_ciphers() == 0)\r\n    NSS_SetDomesticPolicy();\r\n\r\n  initialized = 1;\r\n  return CURLE_OK;\r\n}\r\n\r\n/**\r\n * Global SSL init\r\n *\r\n * @retval 0 error initializing SSL\r\n * @retval 1 SSL initialized successfully\r\n */\r\nint Curl_nss_init(void)\r\n{\r\n  /* curl_global_init() is not thread-safe so this test is ok */\r\n  if(nss_initlock == NULL) {\r\n    PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);\r\n    nss_initlock = PR_NewLock();\r\n    nss_crllock = PR_NewLock();\r\n  }\r\n\r\n  /* We will actually initialize NSS later */\r\n\r\n  return 1;\r\n}\r\n\r\nCURLcode Curl_nss_force_init(struct SessionHandle *data)\r\n{\r\n  CURLcode rv;\r\n  if(!nss_initlock) {\r\n    failf(data,\r\n          \"unable to initialize NSS, curl_global_init() should have been \"\r\n          \"called with CURL_GLOBAL_SSL or CURL_GLOBAL_ALL\");\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  PR_Lock(nss_initlock);\r\n  rv = nss_init(data);\r\n  PR_Unlock(nss_initlock);\r\n  return rv;\r\n}\r\n\r\n/* Global cleanup */\r\nvoid Curl_nss_cleanup(void)\r\n{\r\n  /* This function isn't required to be threadsafe and this is only done\r\n   * as a safety feature.\r\n   */\r\n  PR_Lock(nss_initlock);\r\n  if(initialized) {\r\n    /* Free references to client certificates held in the SSL session cache.\r\n     * Omitting this hampers destruction of the security module owning\r\n     * the certificates. */\r\n    SSL_ClearSessionCache();\r\n\r\n    if(mod && SECSuccess == SECMOD_UnloadUserModule(mod)) {\r\n      SECMOD_DestroyModule(mod);\r\n      mod = NULL;\r\n    }\r\n#ifdef HAVE_NSS_INITCONTEXT\r\n    NSS_ShutdownContext(nss_context);\r\n    nss_context = NULL;\r\n#else /* HAVE_NSS_INITCONTEXT */\r\n    NSS_Shutdown();\r\n#endif\r\n  }\r\n  PR_Unlock(nss_initlock);\r\n\r\n  PR_DestroyLock(nss_initlock);\r\n  PR_DestroyLock(nss_crllock);\r\n  nss_initlock = NULL;\r\n\r\n  initialized = 0;\r\n}\r\n\r\n/*\r\n * This function uses SSL_peek to determine connection status.\r\n *\r\n * Return codes:\r\n *     1 means the connection is still in place\r\n *     0 means the connection has been closed\r\n *    -1 means the connection status is unknown\r\n */\r\nint\r\nCurl_nss_check_cxn(struct connectdata *conn)\r\n{\r\n  int rc;\r\n  char buf;\r\n\r\n  rc =\r\n    PR_Recv(conn->ssl[FIRSTSOCKET].handle, (void *)&buf, 1, PR_MSG_PEEK,\r\n            PR_SecondsToInterval(1));\r\n  if(rc > 0)\r\n    return 1; /* connection still in place */\r\n\r\n  if(rc == 0)\r\n    return 0; /* connection has been closed */\r\n\r\n  return -1;  /* connection status unknown */\r\n}\r\n\r\n/*\r\n * This function is called when an SSL connection is closed.\r\n */\r\nvoid Curl_nss_close(struct connectdata *conn, int sockindex)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  if(connssl->handle) {\r\n    /* NSS closes the socket we previously handed to it, so we must mark it\r\n       as closed to avoid double close */\r\n    fake_sclose(conn->sock[sockindex]);\r\n    conn->sock[sockindex] = CURL_SOCKET_BAD;\r\n\r\n    if((connssl->client_nickname != NULL) || (connssl->obj_clicert != NULL))\r\n      /* A server might require different authentication based on the\r\n       * particular path being requested by the client.  To support this\r\n       * scenario, we must ensure that a connection will never reuse the\r\n       * authentication data from a previous connection. */\r\n      SSL_InvalidateSession(connssl->handle);\r\n\r\n    if(connssl->client_nickname != NULL) {\r\n      free(connssl->client_nickname);\r\n      connssl->client_nickname = NULL;\r\n    }\r\n    /* destroy all NSS objects in order to avoid failure of NSS shutdown */\r\n    Curl_llist_destroy(connssl->obj_list, NULL);\r\n    connssl->obj_list = NULL;\r\n    connssl->obj_clicert = NULL;\r\n\r\n    PR_Close(connssl->handle);\r\n    connssl->handle = NULL;\r\n  }\r\n}\r\n\r\n/*\r\n * This function is called when the 'data' struct is going away. Close\r\n * down everything and free all resources!\r\n */\r\nint Curl_nss_close_all(struct SessionHandle *data)\r\n{\r\n  (void)data;\r\n  return 0;\r\n}\r\n\r\n/* return true if NSS can provide error code (and possibly msg) for the\r\n   error */\r\nstatic bool is_nss_error(CURLcode err)\r\n{\r\n  switch(err) {\r\n  case CURLE_PEER_FAILED_VERIFICATION:\r\n  case CURLE_SSL_CACERT:\r\n  case CURLE_SSL_CERTPROBLEM:\r\n  case CURLE_SSL_CONNECT_ERROR:\r\n  case CURLE_SSL_ISSUER_ERROR:\r\n    return true;\r\n\r\n  default:\r\n    return false;\r\n  }\r\n}\r\n\r\n/* return true if the given error code is related to a client certificate */\r\nstatic bool is_cc_error(PRInt32 err)\r\n{\r\n  switch(err) {\r\n  case SSL_ERROR_BAD_CERT_ALERT:\r\n  case SSL_ERROR_EXPIRED_CERT_ALERT:\r\n  case SSL_ERROR_REVOKED_CERT_ALERT:\r\n    return true;\r\n\r\n  default:\r\n    return false;\r\n  }\r\n}\r\n\r\nstatic Curl_recv nss_recv;\r\nstatic Curl_send nss_send;\r\n\r\nstatic CURLcode nss_load_ca_certificates(struct connectdata *conn,\r\n                                         int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  const char *cafile = data->set.ssl.CAfile;\r\n  const char *capath = data->set.ssl.CApath;\r\n\r\n  if(cafile) {\r\n    CURLcode rv = nss_load_cert(&conn->ssl[sockindex], cafile, PR_TRUE);\r\n    if(CURLE_OK != rv)\r\n      return rv;\r\n  }\r\n\r\n  if(capath) {\r\n    struct_stat st;\r\n    if(stat(capath, &st) == -1)\r\n      return CURLE_SSL_CACERT_BADFILE;\r\n\r\n    if(S_ISDIR(st.st_mode)) {\r\n      PRDirEntry *entry;\r\n      PRDir *dir = PR_OpenDir(capath);\r\n      if(!dir)\r\n        return CURLE_SSL_CACERT_BADFILE;\r\n\r\n      while((entry = PR_ReadDir(dir, PR_SKIP_BOTH | PR_SKIP_HIDDEN))) {\r\n        char *fullpath = aprintf(\"%s/%s\", capath, entry->name);\r\n        if(!fullpath) {\r\n          PR_CloseDir(dir);\r\n          return CURLE_OUT_OF_MEMORY;\r\n        }\r\n\r\n        if(CURLE_OK != nss_load_cert(&conn->ssl[sockindex], fullpath, PR_TRUE))\r\n          /* This is purposefully tolerant of errors so non-PEM files can\r\n           * be in the same directory */\r\n          infof(data, \"failed to load '%s' from CURLOPT_CAPATH\\n\", fullpath);\r\n\r\n        free(fullpath);\r\n      }\r\n\r\n      PR_CloseDir(dir);\r\n    }\r\n    else\r\n      infof(data, \"warning: CURLOPT_CAPATH not a directory (%s)\\n\", capath);\r\n  }\r\n\r\n  infof(data, \"  CAfile: %s\\n  CApath: %s\\n\",\r\n      cafile ? cafile : \"none\",\r\n      capath ? capath : \"none\");\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_nss_connect(struct connectdata *conn, int sockindex)\r\n{\r\n  PRErrorCode err = 0;\r\n  PRFileDesc *model = NULL;\r\n  PRBool ssl2 = PR_FALSE;\r\n  PRBool ssl3 = PR_FALSE;\r\n  PRBool tlsv1 = PR_FALSE;\r\n  PRBool ssl_no_cache;\r\n  PRBool ssl_cbc_random_iv;\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  CURLcode curlerr;\r\n  const int *cipher_to_enable;\r\n  PRSocketOptionData sock_opt;\r\n  long time_left;\r\n  PRUint32 timeout;\r\n\r\n  if(connssl->state == ssl_connection_complete)\r\n    return CURLE_OK;\r\n\r\n  connssl->data = data;\r\n\r\n  /* list of all NSS objects we need to destroy in Curl_nss_close() */\r\n  connssl->obj_list = Curl_llist_alloc(nss_destroy_object);\r\n  if(!connssl->obj_list)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* FIXME. NSS doesn't support multiple databases open at the same time. */\r\n  PR_Lock(nss_initlock);\r\n  curlerr = nss_init(conn->data);\r\n  if(CURLE_OK != curlerr) {\r\n    PR_Unlock(nss_initlock);\r\n    goto error;\r\n  }\r\n\r\n  curlerr = CURLE_SSL_CONNECT_ERROR;\r\n\r\n  if(!mod) {\r\n    char *configstring = aprintf(\"library=%s name=PEM\", pem_library);\r\n    if(!configstring) {\r\n      PR_Unlock(nss_initlock);\r\n      goto error;\r\n    }\r\n    mod = SECMOD_LoadUserModule(configstring, NULL, PR_FALSE);\r\n    free(configstring);\r\n\r\n    if(!mod || !mod->loaded) {\r\n      if(mod) {\r\n        SECMOD_DestroyModule(mod);\r\n        mod = NULL;\r\n      }\r\n      infof(data, \"WARNING: failed to load NSS PEM library %s. Using \"\r\n            \"OpenSSL PEM certificates will not work.\\n\", pem_library);\r\n    }\r\n  }\r\n\r\n  PK11_SetPasswordFunc(nss_get_password);\r\n  PR_Unlock(nss_initlock);\r\n\r\n  model = PR_NewTCPSocket();\r\n  if(!model)\r\n    goto error;\r\n  model = SSL_ImportFD(NULL, model);\r\n\r\n  /* make the socket nonblocking */\r\n  sock_opt.option = PR_SockOpt_Nonblocking;\r\n  sock_opt.value.non_blocking = PR_TRUE;\r\n  if(PR_SetSocketOption(model, &sock_opt) != PR_SUCCESS)\r\n    goto error;\r\n\r\n  if(SSL_OptionSet(model, SSL_SECURITY, PR_TRUE) != SECSuccess)\r\n    goto error;\r\n  if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_SERVER, PR_FALSE) != SECSuccess)\r\n    goto error;\r\n  if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE) != SECSuccess)\r\n    goto error;\r\n\r\n  /* do not use SSL cache if we are not going to verify peer */\r\n  ssl_no_cache = (data->set.ssl.verifypeer) ? PR_FALSE : PR_TRUE;\r\n  if(SSL_OptionSet(model, SSL_NO_CACHE, ssl_no_cache) != SECSuccess)\r\n    goto error;\r\n\r\n  switch (data->set.ssl.version) {\r\n  default:\r\n  case CURL_SSLVERSION_DEFAULT:\r\n    ssl3 = PR_TRUE;\r\n    if(data->state.ssl_connect_retry)\r\n      infof(data, \"TLS disabled due to previous handshake failure\\n\");\r\n    else\r\n      tlsv1 = PR_TRUE;\r\n    break;\r\n  case CURL_SSLVERSION_TLSv1:\r\n    tlsv1 = PR_TRUE;\r\n    break;\r\n  case CURL_SSLVERSION_SSLv2:\r\n    ssl2 = PR_TRUE;\r\n    break;\r\n  case CURL_SSLVERSION_SSLv3:\r\n    ssl3 = PR_TRUE;\r\n    break;\r\n  }\r\n\r\n  if(SSL_OptionSet(model, SSL_ENABLE_SSL2, ssl2) != SECSuccess)\r\n    goto error;\r\n  if(SSL_OptionSet(model, SSL_ENABLE_SSL3, ssl3) != SECSuccess)\r\n    goto error;\r\n  if(SSL_OptionSet(model, SSL_ENABLE_TLS, tlsv1) != SECSuccess)\r\n    goto error;\r\n\r\n  if(SSL_OptionSet(model, SSL_V2_COMPATIBLE_HELLO, ssl2) != SECSuccess)\r\n    goto error;\r\n\r\n  ssl_cbc_random_iv = !data->set.ssl_enable_beast;\r\n#ifdef SSL_CBC_RANDOM_IV\r\n  /* unless the user explicitly asks to allow the protocol vulnerability, we\r\n     use the work-around */\r\n  if(SSL_OptionSet(model, SSL_CBC_RANDOM_IV, ssl_cbc_random_iv) != SECSuccess)\r\n    infof(data, \"warning: failed to set SSL_CBC_RANDOM_IV = %d\\n\",\r\n          ssl_cbc_random_iv);\r\n#else\r\n  if(ssl_cbc_random_iv)\r\n    infof(data, \"warning: support for SSL_CBC_RANDOM_IV not compiled in\\n\");\r\n#endif\r\n\r\n  /* reset the flag to avoid an infinite loop */\r\n  data->state.ssl_connect_retry = FALSE;\r\n\r\n  /* enable all ciphers from enable_ciphers_by_default */\r\n  cipher_to_enable = enable_ciphers_by_default;\r\n  while(SSL_NULL_WITH_NULL_NULL != *cipher_to_enable) {\r\n    if(SSL_CipherPrefSet(model, *cipher_to_enable, PR_TRUE) != SECSuccess) {\r\n      curlerr = CURLE_SSL_CIPHER;\r\n      goto error;\r\n    }\r\n    cipher_to_enable++;\r\n  }\r\n\r\n  if(data->set.ssl.cipher_list) {\r\n    if(set_ciphers(data, model, data->set.ssl.cipher_list) != SECSuccess) {\r\n      curlerr = CURLE_SSL_CIPHER;\r\n      goto error;\r\n    }\r\n  }\r\n\r\n  if(!data->set.ssl.verifypeer && data->set.ssl.verifyhost)\r\n    infof(data, \"warning: ignoring value of ssl.verifyhost\\n\");\r\n\r\n  /* bypass the default SSL_AuthCertificate() hook in case we do not want to\r\n   * verify peer */\r\n  if(SSL_AuthCertificateHook(model, nss_auth_cert_hook, conn) != SECSuccess)\r\n    goto error;\r\n\r\n  data->set.ssl.certverifyresult=0; /* not checked yet */\r\n  if(SSL_BadCertHook(model, BadCertHandler, conn) != SECSuccess)\r\n    goto error;\r\n\r\n  if(SSL_HandshakeCallback(model, HandshakeCallback, NULL) != SECSuccess)\r\n    goto error;\r\n\r\n  if(data->set.ssl.verifypeer) {\r\n    const CURLcode rv = nss_load_ca_certificates(conn, sockindex);\r\n    if(CURLE_OK != rv) {\r\n      curlerr = rv;\r\n      goto error;\r\n    }\r\n  }\r\n\r\n  if(data->set.ssl.CRLfile) {\r\n    if(SECSuccess != nss_load_crl(data->set.ssl.CRLfile)) {\r\n      curlerr = CURLE_SSL_CRL_BADFILE;\r\n      goto error;\r\n    }\r\n    infof(data,\r\n          \"  CRLfile: %s\\n\",\r\n          data->set.ssl.CRLfile ? data->set.ssl.CRLfile : \"none\");\r\n  }\r\n\r\n  if(data->set.str[STRING_CERT]) {\r\n    char *nickname = dup_nickname(data, STRING_CERT);\r\n    if(nickname) {\r\n      /* we are not going to use libnsspem.so to read the client cert */\r\n      connssl->obj_clicert = NULL;\r\n    }\r\n    else {\r\n      CURLcode rv = cert_stuff(conn, sockindex, data->set.str[STRING_CERT],\r\n                               data->set.str[STRING_KEY]);\r\n      if(CURLE_OK != rv) {\r\n        /* failf() is already done in cert_stuff() */\r\n        curlerr = rv;\r\n        goto error;\r\n      }\r\n    }\r\n\r\n    /* store the nickname for SelectClientCert() called during handshake */\r\n    connssl->client_nickname = nickname;\r\n  }\r\n  else\r\n    connssl->client_nickname = NULL;\r\n\r\n  if(SSL_GetClientAuthDataHook(model, SelectClientCert,\r\n                               (void *)connssl) != SECSuccess) {\r\n    curlerr = CURLE_SSL_CERTPROBLEM;\r\n    goto error;\r\n  }\r\n\r\n  /* Import our model socket  onto the existing file descriptor */\r\n  connssl->handle = PR_ImportTCPSocket(sockfd);\r\n  connssl->handle = SSL_ImportFD(model, connssl->handle);\r\n  if(!connssl->handle)\r\n    goto error;\r\n\r\n  PR_Close(model); /* We don't need this any more */\r\n  model = NULL;\r\n\r\n  /* This is the password associated with the cert that we're using */\r\n  if(data->set.str[STRING_KEY_PASSWD]) {\r\n    SSL_SetPKCS11PinArg(connssl->handle, data->set.str[STRING_KEY_PASSWD]);\r\n  }\r\n\r\n  /* Force handshake on next I/O */\r\n  SSL_ResetHandshake(connssl->handle, /* asServer */ PR_FALSE);\r\n\r\n  SSL_SetURL(connssl->handle, conn->host.name);\r\n\r\n  /* check timeout situation */\r\n  time_left = Curl_timeleft(data, NULL, TRUE);\r\n  if(time_left < 0L) {\r\n    failf(data, \"timed out before SSL handshake\");\r\n    curlerr = CURLE_OPERATION_TIMEDOUT;\r\n    goto error;\r\n  }\r\n  timeout = PR_MillisecondsToInterval((PRUint32) time_left);\r\n\r\n  /* Force the handshake now */\r\n  if(SSL_ForceHandshakeWithTimeout(connssl->handle, timeout) != SECSuccess) {\r\n    if(conn->data->set.ssl.certverifyresult == SSL_ERROR_BAD_CERT_DOMAIN)\r\n      curlerr = CURLE_PEER_FAILED_VERIFICATION;\r\n    else if(conn->data->set.ssl.certverifyresult!=0)\r\n      curlerr = CURLE_SSL_CACERT;\r\n    goto error;\r\n  }\r\n\r\n  connssl->state = ssl_connection_complete;\r\n  conn->recv[sockindex] = nss_recv;\r\n  conn->send[sockindex] = nss_send;\r\n\r\n  display_conn_info(conn, connssl->handle);\r\n\r\n  if(data->set.str[STRING_SSL_ISSUERCERT]) {\r\n    SECStatus ret = SECFailure;\r\n    char *nickname = dup_nickname(data, STRING_SSL_ISSUERCERT);\r\n    if(nickname) {\r\n      /* we support only nicknames in case of STRING_SSL_ISSUERCERT for now */\r\n      ret = check_issuer_cert(connssl->handle, nickname);\r\n      free(nickname);\r\n    }\r\n\r\n    if(SECFailure == ret) {\r\n      infof(data,\"SSL certificate issuer check failed\\n\");\r\n      curlerr = CURLE_SSL_ISSUER_ERROR;\r\n      goto error;\r\n    }\r\n    else {\r\n      infof(data, \"SSL certificate issuer check ok\\n\");\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n\r\n  error:\r\n  /* reset the flag to avoid an infinite loop */\r\n  data->state.ssl_connect_retry = FALSE;\r\n\r\n  if(is_nss_error(curlerr)) {\r\n    /* read NSPR error code */\r\n    err = PR_GetError();\r\n    if(is_cc_error(err))\r\n      curlerr = CURLE_SSL_CERTPROBLEM;\r\n\r\n    /* print the error number and error string */\r\n    infof(data, \"NSS error %d (%s)\\n\", err, nss_error_to_name(err));\r\n\r\n    /* print a human-readable message describing the error if available */\r\n    nss_print_error_message(data, err);\r\n  }\r\n\r\n  if(model)\r\n    PR_Close(model);\r\n\r\n    /* cleanup on connection failure */\r\n    Curl_llist_destroy(connssl->obj_list, NULL);\r\n    connssl->obj_list = NULL;\r\n\r\n  if(ssl3 && tlsv1 && isTLSIntoleranceError(err)) {\r\n    /* schedule reconnect through Curl_retry_request() */\r\n    data->state.ssl_connect_retry = TRUE;\r\n    infof(data, \"Error in TLS handshake, trying SSLv3...\\n\");\r\n    return CURLE_OK;\r\n  }\r\n\r\n  return curlerr;\r\n}\r\n\r\nstatic ssize_t nss_send(struct connectdata *conn,  /* connection data */\r\n                        int sockindex,             /* socketindex */\r\n                        const void *mem,           /* send this data */\r\n                        size_t len,                /* amount to write */\r\n                        CURLcode *curlcode)\r\n{\r\n  int rc;\r\n\r\n  rc = PR_Send(conn->ssl[sockindex].handle, mem, (int)len, 0, -1);\r\n\r\n  if(rc < 0) {\r\n    PRInt32 err = PR_GetError();\r\n    if(err == PR_WOULD_BLOCK_ERROR)\r\n      *curlcode = CURLE_AGAIN;\r\n    else {\r\n      /* print the error number and error string */\r\n      const char *err_name = nss_error_to_name(err);\r\n      infof(conn->data, \"SSL write: error %d (%s)\\n\", err, err_name);\r\n\r\n      /* print a human-readable message describing the error if available */\r\n      nss_print_error_message(conn->data, err);\r\n\r\n      *curlcode = (is_cc_error(err))\r\n        ? CURLE_SSL_CERTPROBLEM\r\n        : CURLE_SEND_ERROR;\r\n    }\r\n    return -1;\r\n  }\r\n  return rc; /* number of bytes */\r\n}\r\n\r\nstatic ssize_t nss_recv(struct connectdata * conn, /* connection data */\r\n                        int num,                   /* socketindex */\r\n                        char *buf,                 /* store read data here */\r\n                        size_t buffersize,         /* max amount to read */\r\n                        CURLcode *curlcode)\r\n{\r\n  ssize_t nread;\r\n\r\n  nread = PR_Recv(conn->ssl[num].handle, buf, (int)buffersize, 0, -1);\r\n  if(nread < 0) {\r\n    /* failed SSL read */\r\n    PRInt32 err = PR_GetError();\r\n\r\n    if(err == PR_WOULD_BLOCK_ERROR)\r\n      *curlcode = CURLE_AGAIN;\r\n    else {\r\n      /* print the error number and error string */\r\n      const char *err_name = nss_error_to_name(err);\r\n      infof(conn->data, \"SSL read: errno %d (%s)\\n\", err, err_name);\r\n\r\n      /* print a human-readable message describing the error if available */\r\n      nss_print_error_message(conn->data, err);\r\n\r\n      *curlcode = (is_cc_error(err))\r\n        ? CURLE_SSL_CERTPROBLEM\r\n        : CURLE_RECV_ERROR;\r\n    }\r\n    return -1;\r\n  }\r\n  return nread;\r\n}\r\n\r\nsize_t Curl_nss_version(char *buffer, size_t size)\r\n{\r\n  return snprintf(buffer, size, \"NSS/%s\", NSS_VERSION);\r\n}\r\n\r\nint Curl_nss_seed(struct SessionHandle *data)\r\n{\r\n  /* TODO: implement? */\r\n  (void) data;\r\n  return 0;\r\n}\r\n\r\nvoid Curl_nss_random(struct SessionHandle *data,\r\n                     unsigned char *entropy,\r\n                     size_t length)\r\n{\r\n  Curl_nss_seed(data);  /* Initiate the seed if not already done */\r\n  PK11_GenerateRandom(entropy, curlx_uztosi(length));\r\n}\r\n\r\nvoid Curl_nss_md5sum(unsigned char *tmp, /* input */\r\n                     size_t tmplen,\r\n                     unsigned char *md5sum, /* output */\r\n                     size_t md5len)\r\n{\r\n  PK11Context *MD5pw = PK11_CreateDigestContext(SEC_OID_MD5);\r\n  unsigned int MD5out;\r\n  PK11_DigestOp(MD5pw, tmp, curlx_uztoui(tmplen));\r\n  PK11_DigestFinal(MD5pw, md5sum, &MD5out, curlx_uztoui(md5len));\r\n  PK11_DestroyContext(MD5pw, PR_TRUE);\r\n}\r\n\r\n#endif /* USE_NSS */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/nssg.h",
    "content": "#ifndef HEADER_CURL_NSSG_H\r\n#define HEADER_CURL_NSSG_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_NSS\r\n/*\r\n * This header should only be needed to get included by sslgen.c and nss.c\r\n */\r\n\r\n#include \"urldata.h\"\r\n\r\nCURLcode Curl_nss_connect(struct connectdata *conn, int sockindex);\r\nCURLcode Curl_nss_connect_nonblocking(struct connectdata *conn,\r\n                                      int sockindex,\r\n                                      bool *done);\r\n/* close a SSL connection */\r\nvoid Curl_nss_close(struct connectdata *conn, int sockindex);\r\n\r\n/* tell NSS to close down all open information regarding connections (and\r\n   thus session ID caching etc) */\r\nint Curl_nss_close_all(struct SessionHandle *data);\r\n\r\nint Curl_nss_init(void);\r\nvoid Curl_nss_cleanup(void);\r\n\r\nsize_t Curl_nss_version(char *buffer, size_t size);\r\nint Curl_nss_check_cxn(struct connectdata *cxn);\r\nint Curl_nss_seed(struct SessionHandle *data);\r\n\r\n/* initialize NSS library if not already */\r\nCURLcode Curl_nss_force_init(struct SessionHandle *data);\r\n\r\nvoid Curl_nss_random(struct SessionHandle *data,\r\n                     unsigned char *entropy,\r\n                     size_t length);\r\n\r\nvoid Curl_nss_md5sum(unsigned char *tmp, /* input */\r\n                     size_t tmplen,\r\n                     unsigned char *md5sum, /* output */\r\n                     size_t md5len);\r\n\r\n/* API setup for NSS */\r\n#define curlssl_init Curl_nss_init\r\n#define curlssl_cleanup Curl_nss_cleanup\r\n#define curlssl_connect Curl_nss_connect\r\n\r\n/* NSS has its own session ID cache */\r\n#define curlssl_session_free(x) Curl_nop_stmt\r\n#define curlssl_close_all Curl_nss_close_all\r\n#define curlssl_close Curl_nss_close\r\n/* NSS has no shutdown function provided and thus always fail */\r\n#define curlssl_shutdown(x,y) (x=x, y=y, 1)\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_nss_version\r\n#define curlssl_check_cxn(x) Curl_nss_check_cxn(x)\r\n#define curlssl_data_pending(x,y) (x=x, y=y, 0)\r\n#define curlssl_random(x,y,z) Curl_nss_random(x,y,z)\r\n#define curlssl_md5sum(a,b,c,d) Curl_nss_md5sum(a,b,c,d)\r\n\r\n#endif /* USE_NSS */\r\n#endif /* HEADER_CURL_NSSG_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/nwlib.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef NETWARE /* Novell NetWare */\r\n\r\n#ifdef __NOVELL_LIBC__\r\n/* For native LibC-based NLM we need to register as a real lib. */\r\n#include <library.h>\r\n#include <netware.h>\r\n#include <screen.h>\r\n#include <nks/thread.h>\r\n#include <nks/synch.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\ntypedef struct\r\n{\r\n  int     _errno;\r\n  void    *twentybytes;\r\n} libthreaddata_t;\r\n\r\ntypedef struct\r\n{\r\n  int         x;\r\n  int         y;\r\n  int         z;\r\n  void        *tenbytes;\r\n  NXKey_t     perthreadkey;   /* if -1, no key obtained... */\r\n  NXMutex_t   *lock;\r\n} libdata_t;\r\n\r\nint         gLibId      = -1;\r\nvoid        *gLibHandle = (void *) NULL;\r\nrtag_t      gAllocTag   = (rtag_t) NULL;\r\nNXMutex_t   *gLibLock   = (NXMutex_t *) NULL;\r\n\r\n/* internal library function prototypes... */\r\nint  DisposeLibraryData( void * );\r\nvoid DisposeThreadData( void * );\r\nint  GetOrSetUpData( int id, libdata_t **data, libthreaddata_t **threaddata );\r\n\r\n\r\nint _NonAppStart( void        *NLMHandle,\r\n                  void        *errorScreen,\r\n                  const char  *cmdLine,\r\n                  const char  *loadDirPath,\r\n                  size_t      uninitializedDataLength,\r\n                  void        *NLMFileHandle,\r\n                  int         (*readRoutineP)( int conn,\r\n                                               void *fileHandle, size_t offset,\r\n                                               size_t nbytes,\r\n                                               size_t *bytesRead,\r\n                                               void *buffer ),\r\n                  size_t      customDataOffset,\r\n                  size_t      customDataSize,\r\n                  int         messageCount,\r\n                  const char  **messages )\r\n{\r\n  NX_LOCK_INFO_ALLOC(liblock, \"Per-Application Data Lock\", 0);\r\n\r\n#ifndef __GNUC__\r\n#pragma unused(cmdLine)\r\n#pragma unused(loadDirPath)\r\n#pragma unused(uninitializedDataLength)\r\n#pragma unused(NLMFileHandle)\r\n#pragma unused(readRoutineP)\r\n#pragma unused(customDataOffset)\r\n#pragma unused(customDataSize)\r\n#pragma unused(messageCount)\r\n#pragma unused(messages)\r\n#endif\r\n\r\n  /*\r\n   * Here we process our command line, post errors (to the error screen),\r\n   * perform initializations and anything else we need to do before being able\r\n   * to accept calls into us. If we succeed, we return non-zero and the NetWare\r\n   * Loader will leave us up, otherwise we fail to load and get dumped.\r\n   */\r\n  gAllocTag = AllocateResourceTag(NLMHandle,\r\n                                  \"<library-name> memory allocations\",\r\n                                  AllocSignature);\r\n\r\n  if(!gAllocTag) {\r\n    OutputToScreen(errorScreen, \"Unable to allocate resource tag for \"\r\n                   \"library memory allocations.\\n\");\r\n    return -1;\r\n  }\r\n\r\n  gLibId = register_library(DisposeLibraryData);\r\n\r\n  if(gLibId < -1) {\r\n    OutputToScreen(errorScreen, \"Unable to register library with kernel.\\n\");\r\n    return -1;\r\n  }\r\n\r\n  gLibHandle = NLMHandle;\r\n\r\n  gLibLock = NXMutexAlloc(0, 0, &liblock);\r\n\r\n  if(!gLibLock) {\r\n    OutputToScreen(errorScreen, \"Unable to allocate library data lock.\\n\");\r\n    return -1;\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n/*\r\n * Here we clean up any resources we allocated. Resource tags is a big part\r\n * of what we created, but NetWare doesn't ask us to free those.\r\n */\r\nvoid _NonAppStop( void )\r\n{\r\n  (void) unregister_library(gLibId);\r\n  NXMutexFree(gLibLock);\r\n}\r\n\r\n/*\r\n * This function cannot be the first in the file for if the file is linked\r\n * first, then the check-unload function's offset will be nlmname.nlm+0\r\n * which is how to tell that there isn't one. When the check function is\r\n * first in the linked objects, it is ambiguous. For this reason, we will\r\n * put it inside this file after the stop function.\r\n *\r\n * Here we check to see if it's alright to ourselves to be unloaded. If not,\r\n * we return a non-zero value. Right now, there isn't any reason not to allow\r\n * it.\r\n */\r\nint _NonAppCheckUnload( void )\r\n{\r\n    return 0;\r\n}\r\n\r\nint GetOrSetUpData(int id, libdata_t **appData,\r\n                   libthreaddata_t **threadData )\r\n{\r\n  int                 err;\r\n  libdata_t           *app_data;\r\n  libthreaddata_t *thread_data;\r\n  NXKey_t             key;\r\n  NX_LOCK_INFO_ALLOC(liblock, \"Application Data Lock\", 0);\r\n\r\n  err         = 0;\r\n  thread_data = (libthreaddata_t *) NULL;\r\n\r\n  /*\r\n   * Attempt to get our data for the application calling us. This is where we\r\n   * store whatever application-specific information we need to carry in\r\n   * support of calling applications.\r\n   */\r\n  app_data = (libdata_t *) get_app_data(id);\r\n\r\n  if(!app_data) {\r\n    /*\r\n     * This application hasn't called us before; set up application AND\r\n     * per-thread data. Of course, just in case a thread from this same\r\n     * application is calling us simultaneously, we better lock our application\r\n     * data-creation mutex. We also need to recheck for data after we acquire\r\n     * the lock because WE might be that other thread that was too late to\r\n     * create the data and the first thread in will have created it.\r\n     */\r\n    NXLock(gLibLock);\r\n\r\n    if(!(app_data = (libdata_t *) get_app_data(id))) {\r\n      app_data = malloc(sizeof(libdata_t));\r\n\r\n      if(app_data) {\r\n        memset(app_data, 0, sizeof(libdata_t));\r\n\r\n        app_data->tenbytes = malloc(10);\r\n        app_data->lock     = NXMutexAlloc(0, 0, &liblock);\r\n\r\n        if(!app_data->tenbytes || !app_data->lock) {\r\n          if(app_data->lock)\r\n            NXMutexFree(app_data->lock);\r\n\r\n          free(app_data);\r\n          app_data = (libdata_t *) NULL;\r\n          err      = ENOMEM;\r\n        }\r\n\r\n        if(app_data) {\r\n          /*\r\n           * Here we burn in the application data that we were trying to get\r\n           * by calling get_app_data(). Next time we call the first function,\r\n           * we'll get this data we're just now setting. We also go on here to\r\n           * establish the per-thread data for the calling thread, something\r\n           * we'll have to do on each application thread the first time\r\n           * it calls us.\r\n           */\r\n          err = set_app_data(gLibId, app_data);\r\n\r\n          if(err) {\r\n            free(app_data);\r\n            app_data = (libdata_t *) NULL;\r\n            err      = ENOMEM;\r\n          }\r\n          else {\r\n            /* create key for thread-specific data... */\r\n            err = NXKeyCreate(DisposeThreadData, (void *) NULL, &key);\r\n\r\n            if(err)                /* (no more keys left?) */\r\n              key = -1;\r\n\r\n            app_data->perthreadkey = key;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    NXUnlock(gLibLock);\r\n  }\r\n\r\n  if(app_data) {\r\n    key = app_data->perthreadkey;\r\n\r\n    if(key != -1 /* couldn't create a key? no thread data */\r\n        && !(err = NXKeyGetValue(key, (void **) &thread_data))\r\n        && !thread_data) {\r\n      /*\r\n       * Allocate the per-thread data for the calling thread. Regardless of\r\n       * whether there was already application data or not, this may be the\r\n       * first call by a new thread. The fact that we allocation 20 bytes on\r\n       * a pointer is not very important, this just helps to demonstrate that\r\n       * we can have arbitrarily complex per-thread data.\r\n       */\r\n      thread_data = malloc(sizeof(libthreaddata_t));\r\n\r\n      if(thread_data) {\r\n        thread_data->_errno      = 0;\r\n        thread_data->twentybytes = malloc(20);\r\n\r\n        if(!thread_data->twentybytes) {\r\n          free(thread_data);\r\n          thread_data = (libthreaddata_t *) NULL;\r\n          err         = ENOMEM;\r\n        }\r\n\r\n        if((err = NXKeySetValue(key, thread_data))) {\r\n          free(thread_data->twentybytes);\r\n          free(thread_data);\r\n          thread_data = (libthreaddata_t *) NULL;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  if(appData)\r\n    *appData = app_data;\r\n\r\n  if(threadData)\r\n    *threadData = thread_data;\r\n\r\n  return err;\r\n}\r\n\r\nint DisposeLibraryData( void *data )\r\n{\r\n  if(data) {\r\n    void *tenbytes = ((libdata_t *) data)->tenbytes;\r\n\r\n    if(tenbytes)\r\n      free(tenbytes);\r\n\r\n    free(data);\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\nvoid DisposeThreadData( void *data )\r\n{\r\n  if(data) {\r\n    void *twentybytes = ((libthreaddata_t *) data)->twentybytes;\r\n\r\n    if(twentybytes)\r\n      free(twentybytes);\r\n\r\n    free(data);\r\n  }\r\n}\r\n\r\n#else /* __NOVELL_LIBC__ */\r\n/* For native CLib-based NLM seems we can do a bit more simple. */\r\n#include <nwthread.h>\r\n\r\nint main ( void )\r\n{\r\n  /* initialize any globals here... */\r\n\r\n  /* do this if any global initializing was done\r\n  SynchronizeStart();\r\n  */\r\n  ExitThread (TSR_THREAD, 0);\r\n  return 0;\r\n}\r\n\r\n#endif /* __NOVELL_LIBC__ */\r\n\r\n#else /* NETWARE */\r\n\r\n#ifdef __POCC__\r\n#  pragma warn(disable:2024)  /* Disable warning #2024: Empty input file */\r\n#endif\r\n\r\n#endif /* NETWARE */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/nwos.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef NETWARE /* Novell NetWare */\r\n\r\n#ifdef __NOVELL_LIBC__\r\n/* For native LibC-based NLM we need to do nothing. */\r\nint netware_init ( void )\r\n{\r\n  return 0;\r\n}\r\n\r\n#else /* __NOVELL_LIBC__ */\r\n\r\n/* For native CLib-based NLM we need to initialize the LONG namespace. */\r\n#include <nwnspace.h>\r\n#include <nwthread.h>\r\n#include <nwadv.h>\r\n/* Make the CLIB Ctx stuff link */\r\n#include <netdb.h>\r\nNETDB_DEFINE_CONTEXT\r\n/* Make the CLIB Inet stuff link */\r\n#include <netinet/in.h>\r\n#include <arpa/inet.h>\r\nNETINET_DEFINE_CONTEXT\r\n\r\nint netware_init ( void )\r\n{\r\n  int rc = 0;\r\n  unsigned int myHandle = GetNLMHandle();\r\n  /* import UnAugmentAsterisk dynamically for NW4.x compatibility */\r\n  void (*pUnAugmentAsterisk)(int) = (void(*)(int))\r\n          ImportSymbol(myHandle, \"UnAugmentAsterisk\");\r\n  /* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */\r\n  void (*pUseAccurateCaseForPaths)(int) = (void(*)(int))\r\n          ImportSymbol(myHandle, \"UseAccurateCaseForPaths\");\r\n  if(pUnAugmentAsterisk)\r\n    pUnAugmentAsterisk(1);\r\n  if(pUseAccurateCaseForPaths)\r\n    pUseAccurateCaseForPaths(1);\r\n  UnimportSymbol(myHandle, \"UnAugmentAsterisk\");\r\n  UnimportSymbol(myHandle, \"UseAccurateCaseForPaths\");\r\n  /* set long name space */\r\n  if((SetCurrentNameSpace(4) == 255)) {\r\n    rc = 1;\r\n  }\r\n  if((SetTargetNameSpace(4) == 255)) {\r\n    rc = rc + 2;\r\n  }\r\n  return rc;\r\n}\r\n\r\n/* dummy function to satisfy newer prelude */\r\nint __init_environment ( void )\r\n{\r\n  return 0;\r\n}\r\n\r\n/* dummy function to satisfy newer prelude */\r\nint __deinit_environment ( void )\r\n{\r\n  return 0;\r\n}\r\n\r\n#endif /* __NOVELL_LIBC__ */\r\n\r\n#endif /* NETWARE */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/objnames.inc",
    "content": "# ***************************************************************************\r\n# *                                  _   _ ____  _\r\n# *  Project                     ___| | | |  _ \\| |\r\n# *                             / __| | | | |_) | |\r\n# *                            | (__| |_| |  _ <| |___\r\n# *                             \\___|\\___/|_| \\_\\_____|\r\n# *\r\n# * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n# *\r\n# * This software is licensed as described in the file COPYING, which\r\n# * you should have received as part of this distribution. The terms\r\n# * are also available at http://curl.haxx.se/docs/copyright.html.\r\n# *\r\n# * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n# * copies of the Software, and permit persons to whom the Software is\r\n# * furnished to do so, under the terms of the COPYING file.\r\n# *\r\n# * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n# * KIND, either express or implied.\r\n# *\r\n# ***************************************************************************\r\n\r\n#\r\n# This file is sourced from curl/packages/OS400/initscript.sh and\r\n# other Bourne shell scripts. Keep it as portable as possible.\r\n#\r\n\r\n#\r\n# curl_10char_object_name\r\n#\r\n# This shell function accepts a single string argument with unspecified\r\n# length representing a (*.c) source file name and returns a string which\r\n# is a transformation of given argument.\r\n#\r\n# The intended purpose of this function is to transliterate a (*.c) source\r\n# file name that may be longer than 10 characters, or not, into a string\r\n# with at most 10 characters which may be used as an OS/400 object name.\r\n#\r\n# This function might not be universally usefull, nor we care about it.\r\n#\r\n# It is intended to be used with libcurl's (*.c) source file names, so\r\n# dependency on libcurl's source file naming scheme is acceptable and\r\n# good enough for its intended use. Specifically it makes use of the fact\r\n# that libcurl's (*.c) source file names which may be longer than 10 chars\r\n# are conformed with underscore '_' separated substrings, or separated by\r\n# other character which does not belong to the [0-9], [a-z] or [A-Z] sets.\r\n#\r\n# This allows repeatable and automatic short object name generation with\r\n# no need for a hardcoded mapping table.\r\n#\r\n# Transformation is done in the following way:\r\n#\r\n# 1) Leading directory components are removed.\r\n# 2) Leftmost dot character and any other char following it are removed.\r\n# 3) Lowercase characters are transliterated to uppercase.\r\n# 4) Characters not in [A-Z] or [0-9] are transliterated to underscore '_'.\r\n# 5) Every sequence of one or more underscores is replaced with a single one.\r\n# 6) Five leftmost substrings which end in an underscore character are\r\n#    replaced by the first character of each substring, while retaining\r\n#    the rest of the string.\r\n# 7) Finally the result is truncated to 10 characters.\r\n#\r\n# Resulting object name may be shorter than 10 characters.\r\n#\r\n# Test case 1221 does unit testng of this function and also verifies\r\n# that it is possible to generate distinct short object names for all\r\n# curl and libcurl *.c source file names.\r\n#\r\n\r\ncurl_10char_object_name() {\r\n  echo \"${1}\" | \\\r\n  sed -e 's:.*/::' \\\r\n   -e 's:[.].*::' \\\r\n   -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' \\\r\n   -e 's:[^ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_]:_:g' \\\r\n   -e 's:__*:_:g' \\\r\n   -e 's:\\([^_]\\)[^_]*_\\(.*\\):\\1\\2:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3\\4:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3\\4\\5:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)\\([^_]\\)\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3\\4\\5\\6:' \\\r\n   -e 's:^\\(..........\\).*:\\1:'\r\n}\r\n\r\n#\r\n# curl_8char_object_name\r\n#\r\n# Same as curl_10char_object_name() description and details above, except\r\n# that object name is limited to 8 charcters maximum.\r\n#\r\n\r\ncurl_8char_object_name() {\r\n  echo \"${1}\" | \\\r\n  sed -e 's:.*/::' \\\r\n   -e 's:[.].*::' \\\r\n   -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' \\\r\n   -e 's:[^ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_]:_:g' \\\r\n   -e 's:__*:_:g' \\\r\n   -e 's:\\([^_]\\)[^_]*_\\(.*\\):\\1\\2:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3\\4:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3\\4\\5:' \\\r\n   -e 's:\\([^_]\\)\\([^_]\\)\\([^_]\\)\\([^_]\\)\\([^_]\\)[^_]*_\\(.*\\):\\1\\2\\3\\4\\5\\6:' \\\r\n   -e 's:^\\(........\\).*:\\1:'\r\n}\r\n\r\n# end of objectname.inc\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/openldap.c",
    "content": "/***************************************************************************\r\n *                      _   _ ____  _\r\n *  Project         ___| | | |  _ \\| |\r\n *                 / __| | | | |_) | |\r\n *                | (__| |_| |  _ <| |___\r\n *                 \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, Howard Chu, <hyc@openldap.org>\r\n * Copyright (C) 2011 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP)\r\n\r\n/*\r\n * Notice that USE_OPENLDAP is only a source code selection switch. When\r\n * libcurl is built with USE_OPENLDAP defined the libcurl source code that\r\n * gets compiled is the code from openldap.c, otherwise the code that gets\r\n * compiled is the code from ldap.c.\r\n *\r\n * When USE_OPENLDAP is defined a recent version of the OpenLDAP library\r\n * might be required for compilation and runtime. In order to use ancient\r\n * OpenLDAP library versions, USE_OPENLDAP shall not be defined.\r\n */\r\n\r\n#include <ldap.h>\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"sendf.h\"\r\n#include \"sslgen.h\"\r\n#include \"transfer.h\"\r\n#include \"curl_ldap.h\"\r\n#include \"curl_memory.h\"\r\n#include \"curl_base64.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"memdebug.h\"\r\n\r\n#ifndef _LDAP_PVT_H\r\nextern int ldap_pvt_url_scheme2proto(const char *);\r\nextern int ldap_init_fd(ber_socket_t fd, int proto, const char *url,\r\n                        LDAP **ld);\r\n#endif\r\n\r\nstatic CURLcode ldap_setup(struct connectdata *conn);\r\nstatic CURLcode ldap_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode ldap_done(struct connectdata *conn, CURLcode, bool);\r\nstatic CURLcode ldap_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode ldap_connecting(struct connectdata *conn, bool *done);\r\nstatic CURLcode ldap_disconnect(struct connectdata *conn, bool dead);\r\n\r\nstatic Curl_recv ldap_recv;\r\n\r\n/*\r\n * LDAP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_ldap = {\r\n  \"LDAP\",                               /* scheme */\r\n  ldap_setup,                           /* setup_connection */\r\n  ldap_do,                              /* do_it */\r\n  ldap_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ldap_connect,                         /* connect_it */\r\n  ldap_connecting,                      /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ldap_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_LDAP,                            /* defport */\r\n  CURLPROTO_LDAP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * LDAPS protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_ldaps = {\r\n  \"LDAPS\",                              /* scheme */\r\n  ldap_setup,                           /* setup_connection */\r\n  ldap_do,                              /* do_it */\r\n  ldap_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ldap_connect,                         /* connect_it */\r\n  ldap_connecting,                      /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ldap_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_LDAPS,                           /* defport */\r\n  CURLPROTO_LDAP,                       /* protocol */\r\n  PROTOPT_SSL                           /* flags */\r\n};\r\n#endif\r\n\r\nstatic const char *url_errs[] = {\r\n  \"success\",\r\n  \"out of memory\",\r\n  \"bad parameter\",\r\n  \"unrecognized scheme\",\r\n  \"unbalanced delimiter\",\r\n  \"bad URL\",\r\n  \"bad host or port\",\r\n  \"bad or missing attributes\",\r\n  \"bad or missing scope\",\r\n  \"bad or missing filter\",\r\n  \"bad or missing extensions\"\r\n};\r\n\r\ntypedef struct ldapconninfo {\r\n  LDAP *ld;\r\n  Curl_recv *recv;  /* for stacking SSL handler */\r\n  Curl_send *send;\r\n  int proto;\r\n  int msgid;\r\n  bool ssldone;\r\n  bool sslinst;\r\n  bool didbind;\r\n} ldapconninfo;\r\n\r\ntypedef struct ldapreqinfo {\r\n  int msgid;\r\n  int nument;\r\n} ldapreqinfo;\r\n\r\nstatic CURLcode ldap_setup(struct connectdata *conn)\r\n{\r\n  ldapconninfo *li;\r\n  LDAPURLDesc *lud;\r\n  struct SessionHandle *data=conn->data;\r\n  int rc, proto;\r\n  CURLcode status;\r\n\r\n  rc = ldap_url_parse(data->change.url, &lud);\r\n  if(rc != LDAP_URL_SUCCESS) {\r\n    const char *msg = \"url parsing problem\";\r\n    status = CURLE_URL_MALFORMAT;\r\n    if(rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) {\r\n      if(rc == LDAP_URL_ERR_MEM)\r\n        status = CURLE_OUT_OF_MEMORY;\r\n      msg = url_errs[rc];\r\n    }\r\n    failf(conn->data, \"LDAP local: %s\", msg);\r\n    return status;\r\n  }\r\n  proto = ldap_pvt_url_scheme2proto(lud->lud_scheme);\r\n  ldap_free_urldesc(lud);\r\n\r\n  li = calloc(1, sizeof(ldapconninfo));\r\n  if(!li)\r\n    return CURLE_OUT_OF_MEMORY;\r\n  li->proto = proto;\r\n  conn->proto.generic = li;\r\n  conn->bits.close = FALSE;\r\n  /* TODO:\r\n   * - provide option to choose SASL Binds instead of Simple\r\n   */\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifdef USE_SSL\r\nstatic Sockbuf_IO ldapsb_tls;\r\n#endif\r\n\r\nstatic CURLcode ldap_connect(struct connectdata *conn, bool *done)\r\n{\r\n  ldapconninfo *li = conn->proto.generic;\r\n  struct SessionHandle *data=conn->data;\r\n  int rc, proto = LDAP_VERSION3;\r\n  char hosturl[1024], *ptr;\r\n  (void)done;\r\n\r\n  strcpy(hosturl, \"ldap\");\r\n  ptr = hosturl+4;\r\n  if(conn->handler->flags & PROTOPT_SSL)\r\n    *ptr++ = 's';\r\n  snprintf(ptr, sizeof(hosturl)-(ptr-hosturl), \"://%s:%d\",\r\n    conn->host.name, conn->remote_port);\r\n\r\n  rc = ldap_init_fd(conn->sock[FIRSTSOCKET], li->proto, hosturl, &li->ld);\r\n  if(rc) {\r\n    failf(data, \"LDAP local: Cannot connect to %s, %s\",\r\n          hosturl, ldap_err2string(rc));\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto);\r\n\r\n#ifdef USE_SSL\r\n  if(conn->handler->flags & PROTOPT_SSL) {\r\n    CURLcode res;\r\n    res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone);\r\n    if(res)\r\n      return res;\r\n  }\r\n#endif\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode ldap_connecting(struct connectdata *conn, bool *done)\r\n{\r\n  ldapconninfo *li = conn->proto.generic;\r\n  struct SessionHandle *data=conn->data;\r\n  LDAPMessage *result = NULL;\r\n  struct timeval tv = {0,1}, *tvp;\r\n  int rc, err;\r\n  char *info = NULL;\r\n\r\n#ifdef USE_SSL\r\n  if(conn->handler->flags & PROTOPT_SSL) {\r\n    /* Is the SSL handshake complete yet? */\r\n    if(!li->ssldone) {\r\n      CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET,\r\n                                                  &li->ssldone);\r\n      if(res || !li->ssldone)\r\n        return res;\r\n    }\r\n    /* Have we installed the libcurl SSL handlers into the sockbuf yet? */\r\n    if(!li->sslinst) {\r\n      Sockbuf *sb;\r\n      ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb);\r\n      ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, conn);\r\n      li->sslinst = TRUE;\r\n      li->recv = conn->recv[FIRSTSOCKET];\r\n      li->send = conn->send[FIRSTSOCKET];\r\n    }\r\n  }\r\n#endif\r\n\r\n  tvp = &tv;\r\n\r\nretry:\r\n  if(!li->didbind) {\r\n    char *binddn;\r\n    struct berval passwd;\r\n\r\n    if(conn->bits.user_passwd) {\r\n      binddn = conn->user;\r\n      passwd.bv_val = conn->passwd;\r\n      passwd.bv_len = strlen(passwd.bv_val);\r\n    }\r\n    else {\r\n      binddn = NULL;\r\n      passwd.bv_val = NULL;\r\n      passwd.bv_len = 0;\r\n    }\r\n    rc = ldap_sasl_bind(li->ld, binddn, LDAP_SASL_SIMPLE, &passwd,\r\n                        NULL, NULL, &li->msgid);\r\n    if(rc)\r\n      return CURLE_LDAP_CANNOT_BIND;\r\n    li->didbind = TRUE;\r\n    if(tvp)\r\n      return CURLE_OK;\r\n  }\r\n\r\n  rc = ldap_result(li->ld, li->msgid, LDAP_MSG_ONE, tvp, &result);\r\n  if(rc < 0) {\r\n    failf(data, \"LDAP local: bind ldap_result %s\", ldap_err2string(rc));\r\n    return CURLE_LDAP_CANNOT_BIND;\r\n  }\r\n  if(rc == 0) {\r\n    /* timed out */\r\n    return CURLE_OK;\r\n  }\r\n  rc = ldap_parse_result(li->ld, result, &err, NULL, &info, NULL, NULL, 1);\r\n  if(rc) {\r\n    failf(data, \"LDAP local: bind ldap_parse_result %s\", ldap_err2string(rc));\r\n    return CURLE_LDAP_CANNOT_BIND;\r\n  }\r\n  /* Try to fallback to LDAPv2? */\r\n  if(err == LDAP_PROTOCOL_ERROR) {\r\n    int proto;\r\n    ldap_get_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto);\r\n    if(proto == LDAP_VERSION3) {\r\n      if(info) {\r\n        ldap_memfree(info);\r\n        info = NULL;\r\n      }\r\n      proto = LDAP_VERSION2;\r\n      ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto);\r\n      li->didbind = FALSE;\r\n      goto retry;\r\n    }\r\n  }\r\n\r\n  if(err) {\r\n    failf(data, \"LDAP remote: bind failed %s %s\", ldap_err2string(rc),\r\n          info ? info : \"\");\r\n    if(info)\r\n      ldap_memfree(info);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  if(info)\r\n    ldap_memfree(info);\r\n  conn->recv[FIRSTSOCKET] = ldap_recv;\r\n  *done = TRUE;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  ldapconninfo *li = conn->proto.generic;\r\n  (void) dead_connection;\r\n\r\n  if(li) {\r\n    if(li->ld) {\r\n      ldap_unbind_ext(li->ld, NULL, NULL);\r\n      li->ld = NULL;\r\n    }\r\n    conn->proto.generic = NULL;\r\n    free(li);\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode ldap_do(struct connectdata *conn, bool *done)\r\n{\r\n  ldapconninfo *li = conn->proto.generic;\r\n  ldapreqinfo *lr;\r\n  CURLcode status = CURLE_OK;\r\n  int rc = 0;\r\n  LDAPURLDesc *ludp = NULL;\r\n  int msgid;\r\n  struct SessionHandle *data=conn->data;\r\n\r\n  conn->bits.close = FALSE;\r\n\r\n  infof(data, \"LDAP local: %s\\n\", data->change.url);\r\n\r\n  rc = ldap_url_parse(data->change.url, &ludp);\r\n  if(rc != LDAP_URL_SUCCESS) {\r\n    const char *msg = \"url parsing problem\";\r\n    status = CURLE_URL_MALFORMAT;\r\n    if(rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) {\r\n      if(rc == LDAP_URL_ERR_MEM)\r\n        status = CURLE_OUT_OF_MEMORY;\r\n      msg = url_errs[rc];\r\n    }\r\n    failf(conn->data, \"LDAP local: %s\", msg);\r\n    return status;\r\n  }\r\n\r\n  rc = ldap_search_ext(li->ld, ludp->lud_dn, ludp->lud_scope,\r\n                       ludp->lud_filter, ludp->lud_attrs, 0,\r\n                       NULL, NULL, NULL, 0, &msgid);\r\n  ldap_free_urldesc(ludp);\r\n  if(rc != LDAP_SUCCESS) {\r\n    failf(data, \"LDAP local: ldap_search_ext %s\", ldap_err2string(rc));\r\n    return CURLE_LDAP_SEARCH_FAILED;\r\n  }\r\n  lr = calloc(1,sizeof(ldapreqinfo));\r\n  if(!lr)\r\n    return CURLE_OUT_OF_MEMORY;\r\n  lr->msgid = msgid;\r\n  data->state.proto.generic = lr;\r\n  Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL);\r\n  *done = TRUE;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode ldap_done(struct connectdata *conn, CURLcode res,\r\n                          bool premature)\r\n{\r\n  ldapreqinfo *lr = conn->data->state.proto.generic;\r\n  (void)res;\r\n  (void)premature;\r\n\r\n  if(lr) {\r\n    /* if there was a search in progress, abandon it */\r\n    if(lr->msgid) {\r\n      ldapconninfo *li = conn->proto.generic;\r\n      ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL);\r\n      lr->msgid = 0;\r\n    }\r\n    conn->data->state.proto.generic = NULL;\r\n    free(lr);\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,\r\n                         size_t len, CURLcode *err)\r\n{\r\n  ldapconninfo *li = conn->proto.generic;\r\n  struct SessionHandle *data=conn->data;\r\n  ldapreqinfo *lr = data->state.proto.generic;\r\n  int rc, ret;\r\n  LDAPMessage *result = NULL;\r\n  LDAPMessage *ent;\r\n  BerElement *ber = NULL;\r\n  struct timeval tv = {0,1};\r\n  (void)len;\r\n  (void)buf;\r\n  (void)sockindex;\r\n\r\n  rc = ldap_result(li->ld, lr->msgid, LDAP_MSG_RECEIVED, &tv, &result);\r\n  if(rc < 0) {\r\n    failf(data, \"LDAP local: search ldap_result %s\", ldap_err2string(rc));\r\n    *err = CURLE_RECV_ERROR;\r\n    return -1;\r\n  }\r\n\r\n  *err = CURLE_AGAIN;\r\n  ret = -1;\r\n\r\n  /* timed out */\r\n  if(result == NULL)\r\n    return ret;\r\n\r\n  for(ent = ldap_first_message(li->ld, result); ent;\r\n    ent = ldap_next_message(li->ld, ent)) {\r\n    struct berval bv, *bvals, **bvp = &bvals;\r\n    int binary = 0, msgtype;\r\n\r\n    msgtype = ldap_msgtype(ent);\r\n    if(msgtype == LDAP_RES_SEARCH_RESULT) {\r\n      int code;\r\n      char *info = NULL;\r\n      rc = ldap_parse_result(li->ld, ent, &code, NULL, &info, NULL, NULL, 0);\r\n      if(rc) {\r\n        failf(data, \"LDAP local: search ldap_parse_result %s\",\r\n              ldap_err2string(rc));\r\n        *err = CURLE_LDAP_SEARCH_FAILED;\r\n      }\r\n      else if(code && code != LDAP_SIZELIMIT_EXCEEDED) {\r\n        failf(data, \"LDAP remote: search failed %s %s\", ldap_err2string(rc),\r\n              info ? info : \"\");\r\n        *err = CURLE_LDAP_SEARCH_FAILED;\r\n      }\r\n      else {\r\n        /* successful */\r\n        if(code == LDAP_SIZELIMIT_EXCEEDED)\r\n          infof(data, \"There are more than %d entries\\n\", lr->nument);\r\n        data->req.size = data->req.bytecount;\r\n        *err = CURLE_OK;\r\n        ret = 0;\r\n      }\r\n      lr->msgid = 0;\r\n      ldap_memfree(info);\r\n      break;\r\n    }\r\n    else if(msgtype != LDAP_RES_SEARCH_ENTRY)\r\n      continue;\r\n\r\n    lr->nument++;\r\n    rc = ldap_get_dn_ber(li->ld, ent, &ber, &bv);\r\n    if(rc < 0) {\r\n      /* TODO: verify that this is really how this return code should be\r\n         handled */\r\n      *err = CURLE_RECV_ERROR;\r\n      return -1;\r\n    }\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"DN: \", 4);\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val, bv.bv_len);\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 1);\r\n    data->req.bytecount += bv.bv_len + 5;\r\n\r\n    for(rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp);\r\n      rc == LDAP_SUCCESS;\r\n      rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp)) {\r\n      int i;\r\n\r\n      if(bv.bv_val == NULL) break;\r\n\r\n      if(bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, \";binary\", 7))\r\n        binary = 1;\r\n      else\r\n        binary = 0;\r\n\r\n      for(i=0; bvals[i].bv_val != NULL; i++) {\r\n        int binval = 0;\r\n        Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\t\", 1);\r\n        Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val,\r\n                          bv.bv_len);\r\n        Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\":\", 1);\r\n        data->req.bytecount += bv.bv_len + 2;\r\n\r\n        if(!binary) {\r\n          /* check for leading or trailing whitespace */\r\n          if(ISSPACE(bvals[i].bv_val[0]) ||\r\n              ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1]))\r\n            binval = 1;\r\n          else {\r\n            /* check for unprintable characters */\r\n            unsigned int j;\r\n            for(j=0; j<bvals[i].bv_len; j++)\r\n              if(!ISPRINT(bvals[i].bv_val[j])) {\r\n                binval = 1;\r\n                break;\r\n              }\r\n          }\r\n        }\r\n        if(binary || binval) {\r\n          char *val_b64 = NULL;\r\n          size_t val_b64_sz = 0;\r\n          /* Binary value, encode to base64. */\r\n          CURLcode error = Curl_base64_encode(data,\r\n                                              bvals[i].bv_val,\r\n                                              bvals[i].bv_len,\r\n                                              &val_b64,\r\n                                              &val_b64_sz);\r\n          if(error) {\r\n            ber_memfree(bvals);\r\n            ber_free(ber, 0);\r\n            ldap_msgfree(result);\r\n            *err = error;\r\n            return -1;\r\n          }\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\": \", 2);\r\n          data->req.bytecount += 2;\r\n          if(val_b64_sz > 0) {\r\n            Curl_client_write(conn, CLIENTWRITE_BODY, val_b64, val_b64_sz);\r\n            free(val_b64);\r\n            data->req.bytecount += val_b64_sz;\r\n          }\r\n        }\r\n        else {\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\" \", 1);\r\n          Curl_client_write(conn, CLIENTWRITE_BODY, bvals[i].bv_val,\r\n                            bvals[i].bv_len);\r\n          data->req.bytecount += bvals[i].bv_len + 1;\r\n        }\r\n        Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 0);\r\n        data->req.bytecount++;\r\n      }\r\n      ber_memfree(bvals);\r\n      Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 0);\r\n      data->req.bytecount++;\r\n    }\r\n    Curl_client_write(conn, CLIENTWRITE_BODY, (char *)\"\\n\", 0);\r\n    data->req.bytecount++;\r\n    ber_free(ber, 0);\r\n  }\r\n  ldap_msgfree(result);\r\n  return ret;\r\n}\r\n\r\n#ifdef USE_SSL\r\nstatic int\r\nldapsb_tls_setup(Sockbuf_IO_Desc *sbiod, void *arg)\r\n{\r\n  sbiod->sbiod_pvt = arg;\r\n  return 0;\r\n}\r\n\r\nstatic int\r\nldapsb_tls_remove(Sockbuf_IO_Desc *sbiod)\r\n{\r\n  sbiod->sbiod_pvt = NULL;\r\n  return 0;\r\n}\r\n\r\n/* We don't need to do anything because libcurl does it already */\r\nstatic int\r\nldapsb_tls_close(Sockbuf_IO_Desc *sbiod)\r\n{\r\n  (void)sbiod;\r\n  return 0;\r\n}\r\n\r\nstatic int\r\nldapsb_tls_ctrl(Sockbuf_IO_Desc *sbiod, int opt, void *arg)\r\n{\r\n  (void)arg;\r\n  if(opt == LBER_SB_OPT_DATA_READY) {\r\n    struct connectdata *conn = sbiod->sbiod_pvt;\r\n    return Curl_ssl_data_pending(conn, FIRSTSOCKET);\r\n  }\r\n  return 0;\r\n}\r\n\r\nstatic ber_slen_t\r\nldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)\r\n{\r\n  struct connectdata *conn = sbiod->sbiod_pvt;\r\n  ldapconninfo *li = conn->proto.generic;\r\n  ber_slen_t ret;\r\n  CURLcode err = CURLE_RECV_ERROR;\r\n\r\n  ret = li->recv(conn, FIRSTSOCKET, buf, len, &err);\r\n  if(ret < 0 && err == CURLE_AGAIN) {\r\n    SET_SOCKERRNO(EWOULDBLOCK);\r\n  }\r\n  return ret;\r\n}\r\n\r\nstatic ber_slen_t\r\nldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)\r\n{\r\n  struct connectdata *conn = sbiod->sbiod_pvt;\r\n  ldapconninfo *li = conn->proto.generic;\r\n  ber_slen_t ret;\r\n  CURLcode err = CURLE_SEND_ERROR;\r\n\r\n  ret = li->send(conn, FIRSTSOCKET, buf, len, &err);\r\n  if(ret < 0 && err == CURLE_AGAIN) {\r\n    SET_SOCKERRNO(EWOULDBLOCK);\r\n  }\r\n  return ret;\r\n}\r\n\r\nstatic Sockbuf_IO ldapsb_tls =\r\n{\r\n  ldapsb_tls_setup,\r\n  ldapsb_tls_remove,\r\n  ldapsb_tls_ctrl,\r\n  ldapsb_tls_read,\r\n  ldapsb_tls_write,\r\n  ldapsb_tls_close\r\n};\r\n#endif /* USE_SSL */\r\n\r\n#endif /* !CURL_DISABLE_LDAP && USE_OPENLDAP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/parsedate.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n  A brief summary of the date string formats this parser groks:\r\n\r\n  RFC 2616 3.3.1\r\n\r\n  Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123\r\n  Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036\r\n  Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format\r\n\r\n  we support dates without week day name:\r\n\r\n  06 Nov 1994 08:49:37 GMT\r\n  06-Nov-94 08:49:37 GMT\r\n  Nov  6 08:49:37 1994\r\n\r\n  without the time zone:\r\n\r\n  06 Nov 1994 08:49:37\r\n  06-Nov-94 08:49:37\r\n\r\n  weird order:\r\n\r\n  1994 Nov 6 08:49:37  (GNU date fails)\r\n  GMT 08:49:37 06-Nov-94 Sunday\r\n  94 6 Nov 08:49:37    (GNU date fails)\r\n\r\n  time left out:\r\n\r\n  1994 Nov 6\r\n  06-Nov-94\r\n  Sun Nov 6 94\r\n\r\n  unusual separators:\r\n\r\n  1994.Nov.6\r\n  Sun/Nov/6/94/GMT\r\n\r\n  commonly used time zone names:\r\n\r\n  Sun, 06 Nov 1994 08:49:37 CET\r\n  06 Nov 1994 08:49:37 EST\r\n\r\n  time zones specified using RFC822 style:\r\n\r\n  Sun, 12 Sep 2004 15:05:58 -0700\r\n  Sat, 11 Sep 2004 21:32:11 +0200\r\n\r\n  compact numerical date strings:\r\n\r\n  20040912 15:05:58 -0700\r\n  20040911 +0200\r\n\r\n*/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"rawstr.h\"\r\n#include \"warnless.h\"\r\n#include \"parsedate.h\"\r\n\r\nconst char * const Curl_wkday[] =\r\n{\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"};\r\nstatic const char * const weekday[] =\r\n{ \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\",\r\n  \"Friday\", \"Saturday\", \"Sunday\" };\r\nconst char * const Curl_month[]=\r\n{ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\r\n  \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" };\r\n\r\nstruct tzinfo {\r\n  char name[5];\r\n  int offset; /* +/- in minutes */\r\n};\r\n\r\n/*\r\n * parsedate()\r\n *\r\n * Returns:\r\n *\r\n * PARSEDATE_OK     - a fine conversion\r\n * PARSEDATE_FAIL   - failed to convert\r\n * PARSEDATE_LATER  - time overflow at the far end of time_t\r\n * PARSEDATE_SOONER - time underflow at the low end of time_t\r\n */\r\n\r\nstatic int parsedate(const char *date, time_t *output);\r\n\r\n#define PARSEDATE_OK     0\r\n#define PARSEDATE_FAIL   -1\r\n#define PARSEDATE_LATER  1\r\n#define PARSEDATE_SOONER 2\r\n\r\n/* Here's a bunch of frequently used time zone names. These were supported\r\n   by the old getdate parser. */\r\n#define tDAYZONE -60       /* offset for daylight savings time */\r\nstatic const struct tzinfo tz[]= {\r\n  {\"GMT\", 0},              /* Greenwich Mean */\r\n  {\"UTC\", 0},              /* Universal (Coordinated) */\r\n  {\"WET\", 0},              /* Western European */\r\n  {\"BST\", 0 tDAYZONE},     /* British Summer */\r\n  {\"WAT\", 60},             /* West Africa */\r\n  {\"AST\", 240},            /* Atlantic Standard */\r\n  {\"ADT\", 240 tDAYZONE},   /* Atlantic Daylight */\r\n  {\"EST\", 300},            /* Eastern Standard */\r\n  {\"EDT\", 300 tDAYZONE},   /* Eastern Daylight */\r\n  {\"CST\", 360},            /* Central Standard */\r\n  {\"CDT\", 360 tDAYZONE},   /* Central Daylight */\r\n  {\"MST\", 420},            /* Mountain Standard */\r\n  {\"MDT\", 420 tDAYZONE},   /* Mountain Daylight */\r\n  {\"PST\", 480},            /* Pacific Standard */\r\n  {\"PDT\", 480 tDAYZONE},   /* Pacific Daylight */\r\n  {\"YST\", 540},            /* Yukon Standard */\r\n  {\"YDT\", 540 tDAYZONE},   /* Yukon Daylight */\r\n  {\"HST\", 600},            /* Hawaii Standard */\r\n  {\"HDT\", 600 tDAYZONE},   /* Hawaii Daylight */\r\n  {\"CAT\", 600},            /* Central Alaska */\r\n  {\"AHST\", 600},           /* Alaska-Hawaii Standard */\r\n  {\"NT\",  660},            /* Nome */\r\n  {\"IDLW\", 720},           /* International Date Line West */\r\n  {\"CET\", -60},            /* Central European */\r\n  {\"MET\", -60},            /* Middle European */\r\n  {\"MEWT\", -60},           /* Middle European Winter */\r\n  {\"MEST\", -60 tDAYZONE},  /* Middle European Summer */\r\n  {\"CEST\", -60 tDAYZONE},  /* Central European Summer */\r\n  {\"MESZ\", -60 tDAYZONE},  /* Middle European Summer */\r\n  {\"FWT\", -60},            /* French Winter */\r\n  {\"FST\", -60 tDAYZONE},   /* French Summer */\r\n  {\"EET\", -120},           /* Eastern Europe, USSR Zone 1 */\r\n  {\"WAST\", -420},          /* West Australian Standard */\r\n  {\"WADT\", -420 tDAYZONE}, /* West Australian Daylight */\r\n  {\"CCT\", -480},           /* China Coast, USSR Zone 7 */\r\n  {\"JST\", -540},           /* Japan Standard, USSR Zone 8 */\r\n  {\"EAST\", -600},          /* Eastern Australian Standard */\r\n  {\"EADT\", -600 tDAYZONE}, /* Eastern Australian Daylight */\r\n  {\"GST\", -600},           /* Guam Standard, USSR Zone 9 */\r\n  {\"NZT\", -720},           /* New Zealand */\r\n  {\"NZST\", -720},          /* New Zealand Standard */\r\n  {\"NZDT\", -720 tDAYZONE}, /* New Zealand Daylight */\r\n  {\"IDLE\", -720},          /* International Date Line East */\r\n  /* Next up: Military timezone names. RFC822 allowed these, but (as noted in\r\n     RFC 1123) had their signs wrong. Here we use the correct signs to match\r\n     actual military usage.\r\n   */\r\n  {\"A\",  +1 * 60},         /* Alpha */\r\n  {\"B\",  +2 * 60},         /* Bravo */\r\n  {\"C\",  +3 * 60},         /* Charlie */\r\n  {\"D\",  +4 * 60},         /* Delta */\r\n  {\"E\",  +5 * 60},         /* Echo */\r\n  {\"F\",  +6 * 60},         /* Foxtrot */\r\n  {\"G\",  +7 * 60},         /* Golf */\r\n  {\"H\",  +8 * 60},         /* Hotel */\r\n  {\"I\",  +9 * 60},         /* India */\r\n  /* \"J\", Juliet is not used as a timezone, to indicate the observer's local\r\n     time */\r\n  {\"K\", +10 * 60},         /* Kilo */\r\n  {\"L\", +11 * 60},         /* Lima */\r\n  {\"M\", +12 * 60},         /* Mike */\r\n  {\"N\",  -1 * 60},         /* November */\r\n  {\"O\",  -2 * 60},         /* Oscar */\r\n  {\"P\",  -3 * 60},         /* Papa */\r\n  {\"Q\",  -4 * 60},         /* Quebec */\r\n  {\"R\",  -5 * 60},         /* Romeo */\r\n  {\"S\",  -6 * 60},         /* Sierra */\r\n  {\"T\",  -7 * 60},         /* Tango */\r\n  {\"U\",  -8 * 60},         /* Uniform */\r\n  {\"V\",  -9 * 60},         /* Victor */\r\n  {\"W\", -10 * 60},         /* Whiskey */\r\n  {\"X\", -11 * 60},         /* X-ray */\r\n  {\"Y\", -12 * 60},         /* Yankee */\r\n  {\"Z\", 0},                /* Zulu, zero meridian, a.k.a. UTC */\r\n};\r\n\r\n/* returns:\r\n   -1 no day\r\n   0 monday - 6 sunday\r\n*/\r\n\r\nstatic int checkday(const char *check, size_t len)\r\n{\r\n  int i;\r\n  const char * const *what;\r\n  bool found= FALSE;\r\n  if(len > 3)\r\n    what = &weekday[0];\r\n  else\r\n    what = &Curl_wkday[0];\r\n  for(i=0; i<7; i++) {\r\n    if(Curl_raw_equal(check, what[0])) {\r\n      found=TRUE;\r\n      break;\r\n    }\r\n    what++;\r\n  }\r\n  return found?i:-1;\r\n}\r\n\r\nstatic int checkmonth(const char *check)\r\n{\r\n  int i;\r\n  const char * const *what;\r\n  bool found= FALSE;\r\n\r\n  what = &Curl_month[0];\r\n  for(i=0; i<12; i++) {\r\n    if(Curl_raw_equal(check, what[0])) {\r\n      found=TRUE;\r\n      break;\r\n    }\r\n    what++;\r\n  }\r\n  return found?i:-1; /* return the offset or -1, no real offset is -1 */\r\n}\r\n\r\n/* return the time zone offset between GMT and the input one, in number\r\n   of seconds or -1 if the timezone wasn't found/legal */\r\n\r\nstatic int checktz(const char *check)\r\n{\r\n  unsigned int i;\r\n  const struct tzinfo *what;\r\n  bool found= FALSE;\r\n\r\n  what = tz;\r\n  for(i=0; i< sizeof(tz)/sizeof(tz[0]); i++) {\r\n    if(Curl_raw_equal(check, what->name)) {\r\n      found=TRUE;\r\n      break;\r\n    }\r\n    what++;\r\n  }\r\n  return found?what->offset*60:-1;\r\n}\r\n\r\nstatic void skip(const char **date)\r\n{\r\n  /* skip everything that aren't letters or digits */\r\n  while(**date && !ISALNUM(**date))\r\n    (*date)++;\r\n}\r\n\r\nenum assume {\r\n  DATE_MDAY,\r\n  DATE_YEAR,\r\n  DATE_TIME\r\n};\r\n\r\n/* this is a clone of 'struct tm' but with all fields we don't need or use\r\n   cut out */\r\nstruct my_tm {\r\n  int tm_sec;\r\n  int tm_min;\r\n  int tm_hour;\r\n  int tm_mday;\r\n  int tm_mon;\r\n  int tm_year;\r\n};\r\n\r\n/* struct tm to time since epoch in GMT time zone.\r\n * This is similar to the standard mktime function but for GMT only, and\r\n * doesn't suffer from the various bugs and portability problems that\r\n * some systems' implementations have.\r\n */\r\nstatic time_t my_timegm(struct my_tm *tm)\r\n{\r\n  static const int month_days_cumulative [12] =\r\n    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };\r\n  int month, year, leap_days;\r\n\r\n  if(tm->tm_year < 70)\r\n    /* we don't support years before 1970 as they will cause this function\r\n       to return a negative value */\r\n    return -1;\r\n\r\n  year = tm->tm_year + 1900;\r\n  month = tm->tm_mon;\r\n  if(month < 0) {\r\n    year += (11 - month) / 12;\r\n    month = 11 - (11 - month) % 12;\r\n  }\r\n  else if(month >= 12) {\r\n    year -= month / 12;\r\n    month = month % 12;\r\n  }\r\n\r\n  leap_days = year - (tm->tm_mon <= 1);\r\n  leap_days = ((leap_days / 4) - (leap_days / 100) + (leap_days / 400)\r\n               - (1969 / 4) + (1969 / 100) - (1969 / 400));\r\n\r\n  return ((((time_t) (year - 1970) * 365\r\n            + leap_days + month_days_cumulative [month] + tm->tm_mday - 1) * 24\r\n           + tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec;\r\n}\r\n\r\n/*\r\n * parsedate()\r\n *\r\n * Returns:\r\n *\r\n * PARSEDATE_OK     - a fine conversion\r\n * PARSEDATE_FAIL   - failed to convert\r\n * PARSEDATE_LATER  - time overflow at the far end of time_t\r\n * PARSEDATE_SOONER - time underflow at the low end of time_t\r\n */\r\n\r\nstatic int parsedate(const char *date, time_t *output)\r\n{\r\n  time_t t = 0;\r\n  int wdaynum=-1;  /* day of the week number, 0-6 (mon-sun) */\r\n  int monnum=-1;   /* month of the year number, 0-11 */\r\n  int mdaynum=-1; /* day of month, 1 - 31 */\r\n  int hournum=-1;\r\n  int minnum=-1;\r\n  int secnum=-1;\r\n  int yearnum=-1;\r\n  int tzoff=-1;\r\n  struct my_tm tm;\r\n  enum assume dignext = DATE_MDAY;\r\n  const char *indate = date; /* save the original pointer */\r\n  int part = 0; /* max 6 parts */\r\n\r\n  while(*date && (part < 6)) {\r\n    bool found=FALSE;\r\n\r\n    skip(&date);\r\n\r\n    if(ISALPHA(*date)) {\r\n      /* a name coming up */\r\n      char buf[32]=\"\";\r\n      size_t len;\r\n      sscanf(date, \"%31[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]\",\r\n             buf);\r\n      len = strlen(buf);\r\n\r\n      if(wdaynum == -1) {\r\n        wdaynum = checkday(buf, len);\r\n        if(wdaynum != -1)\r\n          found = TRUE;\r\n      }\r\n      if(!found && (monnum == -1)) {\r\n        monnum = checkmonth(buf);\r\n        if(monnum != -1)\r\n          found = TRUE;\r\n      }\r\n\r\n      if(!found && (tzoff == -1)) {\r\n        /* this just must be a time zone string */\r\n        tzoff = checktz(buf);\r\n        if(tzoff != -1)\r\n          found = TRUE;\r\n      }\r\n\r\n      if(!found)\r\n        return PARSEDATE_FAIL; /* bad string */\r\n\r\n      date += len;\r\n    }\r\n    else if(ISDIGIT(*date)) {\r\n      /* a digit */\r\n      int val;\r\n      char *end;\r\n      if((secnum == -1) &&\r\n         (3 == sscanf(date, \"%02d:%02d:%02d\", &hournum, &minnum, &secnum))) {\r\n        /* time stamp! */\r\n        date += 8;\r\n      }\r\n      else if((secnum == -1) &&\r\n              (2 == sscanf(date, \"%02d:%02d\", &hournum, &minnum))) {\r\n        /* time stamp without seconds */\r\n        date += 5;\r\n        secnum = 0;\r\n      }\r\n      else {\r\n        long lval;\r\n        int error;\r\n        int old_errno;\r\n\r\n        old_errno = ERRNO;\r\n        SET_ERRNO(0);\r\n        lval = strtol(date, &end, 10);\r\n        error = ERRNO;\r\n        if(error != old_errno)\r\n          SET_ERRNO(old_errno);\r\n\r\n        if(error)\r\n          return PARSEDATE_FAIL;\r\n\r\n        if((lval > (long)INT_MAX) || (lval < (long)INT_MIN))\r\n          return PARSEDATE_FAIL;\r\n\r\n        val = curlx_sltosi(lval);\r\n\r\n        if((tzoff == -1) &&\r\n           ((end - date) == 4) &&\r\n           (val <= 1400) &&\r\n           (indate< date) &&\r\n           ((date[-1] == '+' || date[-1] == '-'))) {\r\n          /* four digits and a value less than or equal to 1400 (to take into\r\n             account all sorts of funny time zone diffs) and it is preceded\r\n             with a plus or minus. This is a time zone indication.  1400 is\r\n             picked since +1300 is frequently used and +1400 is mentioned as\r\n             an edge number in the document \"ISO C 200X Proposal: Timezone\r\n             Functions\" at http://david.tribble.com/text/c0xtimezone.html If\r\n             anyone has a more authoritative source for the exact maximum time\r\n             zone offsets, please speak up! */\r\n          found = TRUE;\r\n          tzoff = (val/100 * 60 + val%100)*60;\r\n\r\n          /* the + and - prefix indicates the local time compared to GMT,\r\n             this we need ther reversed math to get what we want */\r\n          tzoff = date[-1]=='+'?-tzoff:tzoff;\r\n        }\r\n\r\n        if(((end - date) == 8) &&\r\n           (yearnum == -1) &&\r\n           (monnum == -1) &&\r\n           (mdaynum == -1)) {\r\n          /* 8 digits, no year, month or day yet. This is YYYYMMDD */\r\n          found = TRUE;\r\n          yearnum = val/10000;\r\n          monnum = (val%10000)/100-1; /* month is 0 - 11 */\r\n          mdaynum = val%100;\r\n        }\r\n\r\n        if(!found && (dignext == DATE_MDAY) && (mdaynum == -1)) {\r\n          if((val > 0) && (val<32)) {\r\n            mdaynum = val;\r\n            found = TRUE;\r\n          }\r\n          dignext = DATE_YEAR;\r\n        }\r\n\r\n        if(!found && (dignext == DATE_YEAR) && (yearnum == -1)) {\r\n          yearnum = val;\r\n          found = TRUE;\r\n          if(yearnum < 1900) {\r\n            if(yearnum > 70)\r\n              yearnum += 1900;\r\n            else\r\n              yearnum += 2000;\r\n          }\r\n          if(mdaynum == -1)\r\n            dignext = DATE_MDAY;\r\n        }\r\n\r\n        if(!found)\r\n          return PARSEDATE_FAIL;\r\n\r\n        date = end;\r\n      }\r\n    }\r\n\r\n    part++;\r\n  }\r\n\r\n  if(-1 == secnum)\r\n    secnum = minnum = hournum = 0; /* no time, make it zero */\r\n\r\n  if((-1 == mdaynum) ||\r\n     (-1 == monnum) ||\r\n     (-1 == yearnum))\r\n    /* lacks vital info, fail */\r\n    return PARSEDATE_FAIL;\r\n\r\n#if SIZEOF_TIME_T < 5\r\n  /* 32 bit time_t can only hold dates to the beginning of 2038 */\r\n  if(yearnum > 2037) {\r\n    *output = 0x7fffffff;\r\n    return PARSEDATE_LATER;\r\n  }\r\n#endif\r\n\r\n  if(yearnum < 1970) {\r\n    *output = 0;\r\n    return PARSEDATE_SOONER;\r\n  }\r\n\r\n  if((mdaynum > 31) || (monnum > 11) ||\r\n     (hournum > 23) || (minnum > 59) || (secnum > 60))\r\n    return PARSEDATE_FAIL; /* clearly an illegal date */\r\n\r\n  tm.tm_sec = secnum;\r\n  tm.tm_min = minnum;\r\n  tm.tm_hour = hournum;\r\n  tm.tm_mday = mdaynum;\r\n  tm.tm_mon = monnum;\r\n  tm.tm_year = yearnum - 1900;\r\n\r\n  /* my_timegm() returns a time_t. time_t is often 32 bits, even on many\r\n     architectures that feature 64 bit 'long'.\r\n\r\n     Some systems have 64 bit time_t and deal with years beyond 2038. However,\r\n     even on some of the systems with 64 bit time_t mktime() returns -1 for\r\n     dates beyond 03:14:07 UTC, January 19, 2038. (Such as AIX 5100-06)\r\n  */\r\n  t = my_timegm(&tm);\r\n\r\n  /* time zone adjust (cast t to int to compare to negative one) */\r\n  if(-1 != (int)t) {\r\n\r\n    /* Add the time zone diff between local time zone and GMT. */\r\n    long delta = (long)(tzoff!=-1?tzoff:0);\r\n\r\n    if((delta>0) && (t + delta < t))\r\n      return -1; /* time_t overflow */\r\n\r\n    t += delta;\r\n  }\r\n\r\n  *output = t;\r\n\r\n  return PARSEDATE_OK;\r\n}\r\n\r\ntime_t curl_getdate(const char *p, const time_t *now)\r\n{\r\n  time_t parsed;\r\n  int rc = parsedate(p, &parsed);\r\n  (void)now; /* legacy argument from the past that we ignore */\r\n\r\n  switch(rc) {\r\n  case PARSEDATE_OK:\r\n  case PARSEDATE_LATER:\r\n  case PARSEDATE_SOONER:\r\n    return parsed;\r\n  }\r\n  /* everything else is fail */\r\n  return -1;\r\n}\r\n\r\n/*\r\n * Curl_gmtime() is a gmtime() replacement for portability. Do not use the\r\n * gmtime_r() or gmtime() functions anywhere else but here.\r\n *\r\n * To make sure no such function calls slip in, we define them to cause build\r\n * errors, which is why we use the name within parentheses in this function.\r\n *\r\n */\r\n\r\nCURLcode Curl_gmtime(time_t intime, struct tm *store)\r\n{\r\n  const struct tm *tm;\r\n#ifdef HAVE_GMTIME_R\r\n  /* thread-safe version */\r\n  tm = (struct tm *)gmtime_r(&intime, store);\r\n#else\r\n  tm = gmtime(&intime);\r\n  if(tm)\r\n    *store = *tm; /* copy the pointed struct to the local copy */\r\n#endif\r\n\r\n  if(!tm)\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  return CURLE_OK;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/parsedate.h",
    "content": "#ifndef HEADER_CURL_PARSEDATE_H\r\n#define HEADER_CURL_PARSEDATE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nextern const char * const Curl_wkday[7];\r\nextern const char * const Curl_month[12];\r\n\r\nCURLcode Curl_gmtime(time_t intime, struct tm *store);\r\n\r\n#endif /* HEADER_CURL_PARSEDATE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/pingpong.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n *   'pingpong' is for generic back-and-forth support functions used by FTP,\r\n *   IMAP, POP3, SMTP and whatever more that likes them.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"select.h\"\r\n#include \"progress.h\"\r\n#include \"speedcheck.h\"\r\n#include \"pingpong.h\"\r\n#include \"multiif.h\"\r\n#include \"non-ascii.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef USE_PINGPONG\r\n\r\n/* Returns timeout in ms. 0 or negative number means the timeout has already\r\n   triggered */\r\nlong Curl_pp_state_timeout(struct pingpong *pp)\r\n{\r\n  struct connectdata *conn = pp->conn;\r\n  struct SessionHandle *data=conn->data;\r\n  long timeout_ms; /* in milliseconds */\r\n  long timeout2_ms; /* in milliseconds */\r\n  long response_time= (data->set.server_response_timeout)?\r\n    data->set.server_response_timeout: pp->response_time;\r\n\r\n  /* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine\r\n     remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is\r\n     supposed to govern the response for any given server response, not for\r\n     the time from connect to the given server response. */\r\n\r\n  /* Without a requested timeout, we only wait 'response_time' seconds for the\r\n     full response to arrive before we bail out */\r\n  timeout_ms = response_time -\r\n    Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */\r\n\r\n  if(data->set.timeout) {\r\n    /* if timeout is requested, find out how much remaining time we have */\r\n    timeout2_ms = data->set.timeout - /* timeout time */\r\n      Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */\r\n\r\n    /* pick the lowest number */\r\n    timeout_ms = CURLMIN(timeout_ms, timeout2_ms);\r\n  }\r\n\r\n  return timeout_ms;\r\n}\r\n\r\n\r\n/*\r\n * Curl_pp_multi_statemach()\r\n *\r\n * called repeatedly until done when the multi interface is used.\r\n */\r\nCURLcode Curl_pp_multi_statemach(struct pingpong *pp)\r\n{\r\n  struct connectdata *conn = pp->conn;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  int rc;\r\n  struct SessionHandle *data=conn->data;\r\n  CURLcode result = CURLE_OK;\r\n  long timeout_ms = Curl_pp_state_timeout(pp);\r\n\r\n  if(timeout_ms <= 0) {\r\n    failf(data, \"server response timeout\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */\r\n                         pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */\r\n                         0);\r\n\r\n  if(rc == -1) {\r\n    failf(data, \"select/poll error\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else if(rc != 0)\r\n    result = pp->statemach_act(conn);\r\n\r\n  /* if rc == 0, then select() timed out */\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * Curl_pp_easy_statemach()\r\n *\r\n * called repeatedly until done when the easy interface is used.\r\n */\r\nCURLcode Curl_pp_easy_statemach(struct pingpong *pp)\r\n{\r\n  struct connectdata *conn = pp->conn;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  int rc;\r\n  long interval_ms;\r\n  long timeout_ms = Curl_pp_state_timeout(pp);\r\n  struct SessionHandle *data=conn->data;\r\n  CURLcode result;\r\n\r\n  if(timeout_ms <=0 ) {\r\n    failf(data, \"server response timeout\");\r\n    return CURLE_OPERATION_TIMEDOUT; /* already too little time */\r\n  }\r\n\r\n  interval_ms = 1000;  /* use 1 second timeout intervals */\r\n  if(timeout_ms < interval_ms)\r\n    interval_ms = timeout_ms;\r\n\r\n  rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */\r\n                         pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */\r\n                         interval_ms);\r\n\r\n  if(Curl_pgrsUpdate(conn))\r\n    result = CURLE_ABORTED_BY_CALLBACK;\r\n  else\r\n    result = Curl_speedcheck(data, Curl_tvnow());\r\n\r\n  if(result)\r\n    ;\r\n  else if(rc == -1) {\r\n    failf(data, \"select/poll error\");\r\n    result = CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else if(rc)\r\n    result = pp->statemach_act(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* initialize stuff to prepare for reading a fresh new response */\r\nvoid Curl_pp_init(struct pingpong *pp)\r\n{\r\n  struct connectdata *conn = pp->conn;\r\n  pp->nread_resp = 0;\r\n  pp->linestart_resp = conn->data->state.buffer;\r\n  pp->pending_resp = TRUE;\r\n  pp->response = Curl_tvnow(); /* start response time-out now! */\r\n}\r\n\r\n\r\n\r\n/***********************************************************************\r\n *\r\n * Curl_pp_vsendf()\r\n *\r\n * Send the formated string as a command to a pingpong server. Note that\r\n * the string should not have any CRLF appended, as this function will\r\n * append the necessary things itself.\r\n *\r\n * made to never block\r\n */\r\nCURLcode Curl_pp_vsendf(struct pingpong *pp,\r\n                        const char *fmt,\r\n                        va_list args)\r\n{\r\n  ssize_t bytes_written;\r\n  size_t write_len;\r\n  char *fmt_crlf;\r\n  char *s;\r\n  CURLcode error;\r\n  struct connectdata *conn = pp->conn;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  enum protection_level data_sec = conn->data_prot;\r\n#endif\r\n\r\n  DEBUGASSERT(pp->sendleft == 0);\r\n  DEBUGASSERT(pp->sendsize == 0);\r\n  DEBUGASSERT(pp->sendthis == NULL);\r\n\r\n  fmt_crlf = aprintf(\"%s\\r\\n\", fmt); /* append a trailing CRLF */\r\n  if(!fmt_crlf)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  s = vaprintf(fmt_crlf, args); /* trailing CRLF appended */\r\n  free(fmt_crlf);\r\n  if(!s)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  bytes_written = 0;\r\n  write_len = strlen(s);\r\n\r\n  Curl_pp_init(pp);\r\n\r\n  error = Curl_convert_to_network(data, s, write_len);\r\n  /* Curl_convert_to_network calls failf if unsuccessful */\r\n  if(error) {\r\n    free(s);\r\n    return error;\r\n  }\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  conn->data_prot = PROT_CMD;\r\n#endif\r\n  error = Curl_write(conn, conn->sock[FIRSTSOCKET], s, write_len,\r\n                     &bytes_written);\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);\r\n  conn->data_prot = data_sec;\r\n#endif\r\n\r\n  if(error) {\r\n    free(s);\r\n    return error;\r\n  }\r\n\r\n  if(conn->data->set.verbose)\r\n    Curl_debug(conn->data, CURLINFO_HEADER_OUT,\r\n               s, (size_t)bytes_written, conn);\r\n\r\n  if(bytes_written != (ssize_t)write_len) {\r\n    /* the whole chunk was not sent, keep it around and adjust sizes */\r\n    pp->sendthis = s;\r\n    pp->sendsize = write_len;\r\n    pp->sendleft = write_len - bytes_written;\r\n  }\r\n  else {\r\n    free(s);\r\n    pp->sendthis = NULL;\r\n    pp->sendleft = pp->sendsize = 0;\r\n    pp->response = Curl_tvnow();\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/***********************************************************************\r\n *\r\n * Curl_pp_sendf()\r\n *\r\n * Send the formated string as a command to a pingpong server. Note that\r\n * the string should not have any CRLF appended, as this function will\r\n * append the necessary things itself.\r\n *\r\n * made to never block\r\n */\r\nCURLcode Curl_pp_sendf(struct pingpong *pp,\r\n                       const char *fmt, ...)\r\n{\r\n  CURLcode res;\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n\r\n  res = Curl_pp_vsendf(pp, fmt, ap);\r\n\r\n  va_end(ap);\r\n\r\n  return res;\r\n}\r\n\r\n/*\r\n * Curl_pp_readresp()\r\n *\r\n * Reads a piece of a server response.\r\n */\r\nCURLcode Curl_pp_readresp(curl_socket_t sockfd,\r\n                          struct pingpong *pp,\r\n                          int *code, /* return the server code if done */\r\n                          size_t *size) /* size of the response */\r\n{\r\n  ssize_t perline; /* count bytes per line */\r\n  bool keepon=TRUE;\r\n  ssize_t gotbytes;\r\n  char *ptr;\r\n  struct connectdata *conn = pp->conn;\r\n  struct SessionHandle *data = conn->data;\r\n  char * const buf = data->state.buffer;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  *code = 0; /* 0 for errors or not done */\r\n  *size = 0;\r\n\r\n  ptr=buf + pp->nread_resp;\r\n\r\n  /* number of bytes in the current line, so far */\r\n  perline = (ssize_t)(ptr-pp->linestart_resp);\r\n\r\n  keepon=TRUE;\r\n\r\n  while((pp->nread_resp<BUFSIZE) && (keepon && !result)) {\r\n\r\n    if(pp->cache) {\r\n      /* we had data in the \"cache\", copy that instead of doing an actual\r\n       * read\r\n       *\r\n       * pp->cache_size is cast to ssize_t here.  This should be safe, because\r\n       * it would have been populated with something of size int to begin\r\n       * with, even though its datatype may be larger than an int.\r\n       */\r\n      DEBUGASSERT((ptr+pp->cache_size) <= (buf+BUFSIZE+1));\r\n      memcpy(ptr, pp->cache, pp->cache_size);\r\n      gotbytes = (ssize_t)pp->cache_size;\r\n      free(pp->cache);    /* free the cache */\r\n      pp->cache = NULL;   /* clear the pointer */\r\n      pp->cache_size = 0; /* zero the size just in case */\r\n    }\r\n    else {\r\n      int res;\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n      enum protection_level prot = conn->data_prot;\r\n      conn->data_prot = PROT_CLEAR;\r\n#endif\r\n      DEBUGASSERT((ptr+BUFSIZE-pp->nread_resp) <= (buf+BUFSIZE+1));\r\n      res = Curl_read(conn, sockfd, ptr, BUFSIZE-pp->nread_resp,\r\n                      &gotbytes);\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n      DEBUGASSERT(prot  > PROT_NONE && prot < PROT_LAST);\r\n      conn->data_prot = prot;\r\n#endif\r\n      if(res == CURLE_AGAIN)\r\n        return CURLE_OK; /* return */\r\n\r\n      if((res == CURLE_OK) && (gotbytes > 0))\r\n        /* convert from the network encoding */\r\n        res = Curl_convert_from_network(data, ptr, gotbytes);\r\n      /* Curl_convert_from_network calls failf if unsuccessful */\r\n\r\n      if(CURLE_OK != res) {\r\n        result = (CURLcode)res; /* Set outer result variable to this error. */\r\n        keepon = FALSE;\r\n      }\r\n    }\r\n\r\n    if(!keepon)\r\n      ;\r\n    else if(gotbytes <= 0) {\r\n      keepon = FALSE;\r\n      result = CURLE_RECV_ERROR;\r\n      failf(data, \"response reading failed\");\r\n    }\r\n    else {\r\n      /* we got a whole chunk of data, which can be anything from one\r\n       * byte to a set of lines and possible just a piece of the last\r\n       * line */\r\n      ssize_t i;\r\n      ssize_t clipamount = 0;\r\n      bool restart = FALSE;\r\n\r\n      data->req.headerbytecount += (long)gotbytes;\r\n\r\n      pp->nread_resp += gotbytes;\r\n      for(i = 0; i < gotbytes; ptr++, i++) {\r\n        perline++;\r\n        if(*ptr=='\\n') {\r\n          /* a newline is CRLF in pp-talk, so the CR is ignored as\r\n             the line isn't really terminated until the LF comes */\r\n\r\n          /* output debug output if that is requested */\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n          if(!conn->sec_complete)\r\n#endif\r\n            if(data->set.verbose)\r\n              Curl_debug(data, CURLINFO_HEADER_IN,\r\n                         pp->linestart_resp, (size_t)perline, conn);\r\n\r\n          /*\r\n           * We pass all response-lines to the callback function registered\r\n           * for \"headers\". The response lines can be seen as a kind of\r\n           * headers.\r\n           */\r\n          result = Curl_client_write(conn, CLIENTWRITE_HEADER,\r\n                                     pp->linestart_resp, perline);\r\n          if(result)\r\n            return result;\r\n\r\n          if(pp->endofresp(pp, code)) {\r\n            /* This is the end of the last line, copy the last line to the\r\n               start of the buffer and zero terminate, for old times sake (and\r\n               krb4)! */\r\n            char *meow;\r\n            int n;\r\n            for(meow=pp->linestart_resp, n=0; meow<ptr; meow++, n++)\r\n              buf[n] = *meow;\r\n            *meow=0; /* zero terminate */\r\n            keepon=FALSE;\r\n            pp->linestart_resp = ptr+1; /* advance pointer */\r\n            i++; /* skip this before getting out */\r\n\r\n            *size = pp->nread_resp; /* size of the response */\r\n            pp->nread_resp = 0; /* restart */\r\n            break;\r\n          }\r\n          perline=0; /* line starts over here */\r\n          pp->linestart_resp = ptr+1;\r\n        }\r\n      }\r\n\r\n      if(!keepon && (i != gotbytes)) {\r\n        /* We found the end of the response lines, but we didn't parse the\r\n           full chunk of data we have read from the server. We therefore need\r\n           to store the rest of the data to be checked on the next invoke as\r\n           it may actually contain another end of response already! */\r\n        clipamount = gotbytes - i;\r\n        restart = TRUE;\r\n        DEBUGF(infof(data, \"Curl_pp_readresp_ %d bytes of trailing \"\r\n                     \"server response left\\n\",\r\n                     (int)clipamount));\r\n      }\r\n      else if(keepon) {\r\n\r\n        if((perline == gotbytes) && (gotbytes > BUFSIZE/2)) {\r\n          /* We got an excessive line without newlines and we need to deal\r\n             with it. We keep the first bytes of the line then we throw\r\n             away the rest. */\r\n          infof(data, \"Excessive server response line length received, \"\r\n                \"%zd bytes. Stripping\\n\", gotbytes);\r\n          restart = TRUE;\r\n\r\n          /* we keep 40 bytes since all our pingpong protocols are only\r\n             interested in the first piece */\r\n          clipamount = 40;\r\n        }\r\n        else if(pp->nread_resp > BUFSIZE/2) {\r\n          /* We got a large chunk of data and there's potentially still\r\n             trailing data to take care of, so we put any such part in the\r\n             \"cache\", clear the buffer to make space and restart. */\r\n          clipamount = perline;\r\n          restart = TRUE;\r\n        }\r\n      }\r\n      else if(i == gotbytes)\r\n        restart = TRUE;\r\n\r\n      if(clipamount) {\r\n        pp->cache_size = clipamount;\r\n        pp->cache = malloc(pp->cache_size);\r\n        if(pp->cache)\r\n          memcpy(pp->cache, pp->linestart_resp, pp->cache_size);\r\n        else\r\n          return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      if(restart) {\r\n        /* now reset a few variables to start over nicely from the start of\r\n           the big buffer */\r\n        pp->nread_resp = 0; /* start over from scratch in the buffer */\r\n        ptr = pp->linestart_resp = buf;\r\n        perline = 0;\r\n      }\r\n\r\n    } /* there was data */\r\n\r\n  } /* while there's buffer left and loop is requested */\r\n\r\n  pp->pending_resp = FALSE;\r\n\r\n  return result;\r\n}\r\n\r\nint Curl_pp_getsock(struct pingpong *pp,\r\n                    curl_socket_t *socks,\r\n                    int numsocks)\r\n{\r\n  struct connectdata *conn = pp->conn;\r\n\r\n  if(!numsocks)\r\n    return GETSOCK_BLANK;\r\n\r\n  socks[0] = conn->sock[FIRSTSOCKET];\r\n\r\n  if(pp->sendleft) {\r\n    /* write mode */\r\n    return GETSOCK_WRITESOCK(0);\r\n  }\r\n\r\n  /* read mode */\r\n  return GETSOCK_READSOCK(0);\r\n}\r\n\r\nCURLcode Curl_pp_flushsend(struct pingpong *pp)\r\n{\r\n  /* we have a piece of a command still left to send */\r\n  struct connectdata *conn = pp->conn;\r\n  ssize_t written;\r\n  CURLcode result = CURLE_OK;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n\r\n  result = Curl_write(conn, sock, pp->sendthis + pp->sendsize -\r\n                      pp->sendleft, pp->sendleft, &written);\r\n  if(result)\r\n    return result;\r\n\r\n  if(written != (ssize_t)pp->sendleft) {\r\n    /* only a fraction was sent */\r\n    pp->sendleft -= written;\r\n  }\r\n  else {\r\n    free(pp->sendthis);\r\n    pp->sendthis=NULL;\r\n    pp->sendleft = pp->sendsize = 0;\r\n    pp->response = Curl_tvnow();\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_pp_disconnect(struct pingpong *pp)\r\n{\r\n  if(pp->cache) {\r\n    free(pp->cache);\r\n    pp->cache = NULL;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/pingpong.h",
    "content": "#ifndef HEADER_CURL_PINGPONG_H\r\n#define HEADER_CURL_PINGPONG_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_FTP) || \\\r\n  !defined(CURL_DISABLE_POP3) || !defined(CURL_DISABLE_SMTP)\r\n#define USE_PINGPONG\r\n#endif\r\n\r\n/* forward-declaration, this is defined in urldata.h */\r\nstruct connectdata;\r\n\r\n/*\r\n * 'pingpong' is the generic struct used for protocols doing server<->client\r\n * conversations in a back-and-forth style such as FTP, IMAP, POP3, SMTP etc.\r\n *\r\n * It holds response cache and non-blocking sending data.\r\n */\r\nstruct pingpong {\r\n  char *cache;     /* data cache between getresponse()-calls */\r\n  size_t cache_size;  /* size of cache in bytes */\r\n  size_t nread_resp;  /* number of bytes currently read of a server response */\r\n  char *linestart_resp; /* line start pointer for the server response\r\n                           reader function */\r\n  bool pending_resp;  /* set TRUE when a server response is pending or in\r\n                         progress, and is cleared once the last response is\r\n                         read */\r\n  char *sendthis; /* allocated pointer to a buffer that is to be sent to the\r\n                     server */\r\n  size_t sendleft; /* number of bytes left to send from the sendthis buffer */\r\n  size_t sendsize; /* total size of the sendthis buffer */\r\n  struct timeval response; /* set to Curl_tvnow() when a command has been sent\r\n                              off, used to time-out response reading */\r\n  long response_time; /* When no timeout is given, this is the amount of\r\n                         milliseconds we await for a server response. */\r\n\r\n  struct connectdata *conn; /* points to the connectdata struct that this\r\n                               belongs to */\r\n\r\n  /* Function pointers the protocols MUST implement and provide for the\r\n     pingpong layer to function */\r\n\r\n  CURLcode (*statemach_act)(struct connectdata *conn);\r\n\r\n  int (*endofresp)(struct pingpong *pp, int *code);\r\n};\r\n\r\n/*\r\n * Curl_pp_multi_statemach()\r\n *\r\n * called repeatedly until done when the multi interface is used.\r\n */\r\nCURLcode Curl_pp_multi_statemach(struct pingpong *pp);\r\n\r\n/*\r\n * Curl_pp_easy_statemach()\r\n *\r\n * called repeatedly until done when the easy interface is used.\r\n */\r\nCURLcode Curl_pp_easy_statemach(struct pingpong *pp);\r\n\r\n\r\n/* initialize stuff to prepare for reading a fresh new response */\r\nvoid Curl_pp_init(struct pingpong *pp);\r\n\r\n/* Returns timeout in ms. 0 or negative number means the timeout has already\r\n   triggered */\r\nlong Curl_pp_state_timeout(struct pingpong *pp);\r\n\r\n\r\n/***********************************************************************\r\n *\r\n * Curl_pp_sendf()\r\n *\r\n * Send the formated string as a command to a pingpong server. Note that\r\n * the string should not have any CRLF appended, as this function will\r\n * append the necessary things itself.\r\n *\r\n * made to never block\r\n */\r\nCURLcode Curl_pp_sendf(struct pingpong *pp,\r\n                       const char *fmt, ...);\r\n\r\n/***********************************************************************\r\n *\r\n * Curl_pp_vsendf()\r\n *\r\n * Send the formated string as a command to a pingpong server. Note that\r\n * the string should not have any CRLF appended, as this function will\r\n * append the necessary things itself.\r\n *\r\n * made to never block\r\n */\r\nCURLcode Curl_pp_vsendf(struct pingpong *pp,\r\n                        const char *fmt,\r\n                        va_list args);\r\n\r\n/*\r\n * Curl_pp_readresp()\r\n *\r\n * Reads a piece of a server response.\r\n */\r\nCURLcode Curl_pp_readresp(curl_socket_t sockfd,\r\n                          struct pingpong *pp,\r\n                          int *code, /* return the server code if done */\r\n                          size_t *size); /* size of the response */\r\n\r\n\r\nCURLcode Curl_pp_flushsend(struct pingpong *pp);\r\n\r\n/* call this when a pingpong connection is disconnected */\r\nCURLcode Curl_pp_disconnect(struct pingpong *pp);\r\n\r\nint Curl_pp_getsock(struct pingpong *pp, curl_socket_t *socks,\r\n                    int numsocks);\r\n\r\n#endif /* HEADER_CURL_PINGPONG_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/polarssl.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>\r\n * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all PolarSSL-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n *\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_POLARSSL\r\n\r\n#include <polarssl/net.h>\r\n#include <polarssl/ssl.h>\r\n#include <polarssl/havege.h>\r\n#include <polarssl/certs.h>\r\n#include <polarssl/x509.h>\r\n#include <polarssl/version.h>\r\n\r\n#include <polarssl/entropy.h>\r\n#include <polarssl/ctr_drbg.h>\r\n\r\n#if POLARSSL_VERSION_NUMBER<0x01000000\r\n/*\r\n  Earlier versions of polarssl had no WANT_READ or WANT_WRITE, only TRY_AGAIN\r\n*/\r\n#define POLARSSL_ERR_NET_WANT_READ  POLARSSL_ERR_NET_TRY_AGAIN\r\n#define POLARSSL_ERR_NET_WANT_WRITE POLARSSL_ERR_NET_TRY_AGAIN\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"inet_pton.h\"\r\n#include \"polarssl.h\"\r\n#include \"sslgen.h\"\r\n#include \"parsedate.h\"\r\n#include \"connect.h\" /* for the connect timeout */\r\n#include \"select.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* version dependent differences */\r\n#if POLARSSL_VERSION_NUMBER < 0x01010000\r\n/* the old way */\r\n#define HAVEGE_RANDOM havege_rand\r\n#else\r\n/* from 1.1.0 */\r\n#define HAVEGE_RANDOM havege_random\r\n#endif\r\n\r\n/* Define this to enable lots of debugging for PolarSSL */\r\n#undef POLARSSL_DEBUG\r\n\r\n#ifdef POLARSSL_DEBUG\r\nstatic void polarssl_debug(void *context, int level, char *line)\r\n{\r\n  struct SessionHandle *data = NULL;\r\n\r\n  if(!context)\r\n    return;\r\n\r\n  data = (struct SessionHandle *)context;\r\n\r\n  infof(data, \"%s\\n\", line);\r\n}\r\n#else\r\n#endif\r\n\r\nstatic Curl_recv polarssl_recv;\r\nstatic Curl_send polarssl_send;\r\n\r\n\r\nstatic CURLcode\r\npolarssl_connect_step1(struct connectdata *conn,\r\n                     int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data* connssl = &conn->ssl[sockindex];\r\n\r\n  bool sni = TRUE; /* default is SNI enabled */\r\n  int ret = -1;\r\n#ifdef ENABLE_IPV6\r\n  struct in6_addr addr;\r\n#else\r\n  struct in_addr addr;\r\n#endif\r\n  void *old_session = NULL;\r\n  size_t old_session_size = 0;\r\n\r\n  /* PolarSSL only supports SSLv3 and TLSv1 */\r\n  if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) {\r\n    failf(data, \"PolarSSL does not support SSLv2\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n  else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3)\r\n    sni = FALSE; /* SSLv3 has no SNI */\r\n\r\n  havege_init(&connssl->hs);\r\n\r\n  /* Load the trusted CA */\r\n  memset(&connssl->cacert, 0, sizeof(x509_cert));\r\n\r\n  if(data->set.str[STRING_SSL_CAFILE]) {\r\n    ret = x509parse_crtfile(&connssl->cacert,\r\n                            data->set.str[STRING_SSL_CAFILE]);\r\n\r\n    if(ret<0) {\r\n      failf(data, \"Error reading ca cert file %s: -0x%04X\",\r\n            data->set.str[STRING_SSL_CAFILE], ret);\r\n\r\n      if(data->set.ssl.verifypeer)\r\n        return CURLE_SSL_CACERT_BADFILE;\r\n    }\r\n  }\r\n\r\n  /* Load the client certificate */\r\n  memset(&connssl->clicert, 0, sizeof(x509_cert));\r\n\r\n  if(data->set.str[STRING_CERT]) {\r\n    ret = x509parse_crtfile(&connssl->clicert,\r\n                            data->set.str[STRING_CERT]);\r\n\r\n    if(ret) {\r\n      failf(data, \"Error reading client cert file %s: -0x%04X\",\r\n            data->set.str[STRING_CERT], -ret);\r\n      return CURLE_SSL_CERTPROBLEM;\r\n    }\r\n  }\r\n\r\n  /* Load the client private key */\r\n  if(data->set.str[STRING_KEY]) {\r\n    ret = x509parse_keyfile(&connssl->rsa,\r\n                            data->set.str[STRING_KEY],\r\n                            data->set.str[STRING_KEY_PASSWD]);\r\n\r\n    if(ret) {\r\n      failf(data, \"Error reading private key %s: -0x%04X\",\r\n            data->set.str[STRING_KEY], -ret);\r\n      return CURLE_SSL_CERTPROBLEM;\r\n    }\r\n  }\r\n\r\n  /* Load the CRL */\r\n  memset(&connssl->crl, 0, sizeof(x509_crl));\r\n\r\n  if(data->set.str[STRING_SSL_CRLFILE]) {\r\n    ret = x509parse_crlfile(&connssl->crl,\r\n                            data->set.str[STRING_SSL_CRLFILE]);\r\n\r\n    if(ret) {\r\n      failf(data, \"Error reading CRL file %s: -0x%04X\",\r\n            data->set.str[STRING_SSL_CRLFILE], -ret);\r\n      return CURLE_SSL_CRL_BADFILE;\r\n    }\r\n  }\r\n\r\n  infof(data, \"PolarSSL: Connecting to %s:%d\\n\",\r\n        conn->host.name, conn->remote_port);\r\n\r\n  if(ssl_init(&connssl->ssl)) {\r\n    failf(data, \"PolarSSL: ssl_init failed\");\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  ssl_set_endpoint(&connssl->ssl, SSL_IS_CLIENT);\r\n  ssl_set_authmode(&connssl->ssl, SSL_VERIFY_OPTIONAL);\r\n\r\n  ssl_set_rng(&connssl->ssl, HAVEGE_RANDOM,\r\n              &connssl->hs);\r\n  ssl_set_bio(&connssl->ssl,\r\n              net_recv, &conn->sock[sockindex],\r\n              net_send, &conn->sock[sockindex]);\r\n\r\n\r\n#if POLARSSL_VERSION_NUMBER<0x01000000\r\n  ssl_set_ciphers(&connssl->ssl, ssl_default_ciphers);\r\n#else\r\n  ssl_set_ciphersuites(&connssl->ssl, ssl_default_ciphersuites);\r\n#endif\r\n  if(!Curl_ssl_getsessionid(conn, &old_session, &old_session_size)) {\r\n    memcpy(&connssl->ssn, old_session, old_session_size);\r\n    infof(data, \"PolarSSL re-using session\\n\");\r\n  }\r\n\r\n/* PolarSSL SVN revision r1316 to r1317, matching <1.2.0 is to cover Ubuntu's\r\n   1.1.4 version and the like */\r\n#if POLARSSL_VERSION_NUMBER<0x01020000\r\n  ssl_set_session(&connssl->ssl, 1, 600,\r\n                  &connssl->ssn);\r\n#else\r\n  ssl_set_session(&connssl->ssl,\r\n                  &connssl->ssn);\r\n#endif\r\n\r\n  ssl_set_ca_chain(&connssl->ssl,\r\n                   &connssl->cacert,\r\n                   &connssl->crl,\r\n                   conn->host.name);\r\n\r\n  ssl_set_own_cert(&connssl->ssl,\r\n                   &connssl->clicert, &connssl->rsa);\r\n\r\n  if(!Curl_inet_pton(AF_INET, conn->host.name, &addr) &&\r\n#ifdef ENABLE_IPV6\r\n     !Curl_inet_pton(AF_INET6, conn->host.name, &addr) &&\r\n#endif\r\n     sni && ssl_set_hostname(&connssl->ssl, conn->host.name)) {\r\n     infof(data, \"WARNING: failed to configure \"\r\n                 \"server name indication (SNI) TLS extension\\n\");\r\n  }\r\n\r\n#ifdef POLARSSL_DEBUG\r\n  ssl_set_dbg(&connssl->ssl, polarssl_debug, data);\r\n#endif\r\n\r\n  connssl->connecting_state = ssl_connect_2;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\npolarssl_connect_step2(struct connectdata *conn,\r\n                     int sockindex)\r\n{\r\n  int ret;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data* connssl = &conn->ssl[sockindex];\r\n  char buffer[1024];\r\n\r\n  conn->recv[sockindex] = polarssl_recv;\r\n  conn->send[sockindex] = polarssl_send;\r\n\r\n  for(;;) {\r\n    if(!(ret = ssl_handshake(&connssl->ssl)))\r\n      break;\r\n    else if(ret != POLARSSL_ERR_NET_WANT_READ &&\r\n            ret != POLARSSL_ERR_NET_WANT_WRITE) {\r\n      failf(data, \"ssl_handshake returned -0x%04X\", -ret);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n    else {\r\n      if(ret == POLARSSL_ERR_NET_WANT_READ) {\r\n        connssl->connecting_state = ssl_connect_2_reading;\r\n        return CURLE_OK;\r\n      }\r\n      if(ret == POLARSSL_ERR_NET_WANT_WRITE) {\r\n        connssl->connecting_state = ssl_connect_2_writing;\r\n        return CURLE_OK;\r\n      }\r\n      failf(data, \"SSL_connect failed with error %d.\", ret);\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n\r\n    }\r\n  }\r\n\r\n  infof(data, \"PolarSSL: Handshake complete, cipher is %s\\n\",\r\n#if POLARSSL_VERSION_NUMBER<0x01000000\r\n        ssl_get_cipher(&conn->ssl[sockindex].ssl)\r\n#elif POLARSSL_VERSION_NUMBER >= 0x01010000\r\n        ssl_get_ciphersuite(&conn->ssl[sockindex].ssl)\r\n#else\r\n        ssl_get_ciphersuite_name(&conn->ssl[sockindex].ssl)\r\n#endif\r\n    );\r\n\r\n  ret = ssl_get_verify_result(&conn->ssl[sockindex].ssl);\r\n\r\n  if(ret && data->set.ssl.verifypeer) {\r\n    if(ret & BADCERT_EXPIRED)\r\n      failf(data, \"Cert verify failed: BADCERT_EXPIRED\");\r\n\r\n    if(ret & BADCERT_REVOKED) {\r\n      failf(data, \"Cert verify failed: BADCERT_REVOKED\");\r\n      return CURLE_SSL_CACERT;\r\n    }\r\n\r\n    if(ret & BADCERT_CN_MISMATCH)\r\n      failf(data, \"Cert verify failed: BADCERT_CN_MISMATCH\");\r\n\r\n    if(ret & BADCERT_NOT_TRUSTED)\r\n      failf(data, \"Cert verify failed: BADCERT_NOT_TRUSTED\");\r\n\r\n    return CURLE_PEER_FAILED_VERIFICATION;\r\n  }\r\n\r\n/* PolarSSL SVN revision r1316 to r1317, matching <1.2.0 is to cover Ubuntu's\r\n   1.1.4 version and the like */\r\n#if POLARSSL_VERSION_NUMBER<0x01020000\r\n  if(conn->ssl[sockindex].ssl.peer_cert) {\r\n#else\r\n  if(ssl_get_peer_cert(&(connssl->ssl))) {\r\n#endif\r\n    /* If the session was resumed, there will be no peer certs */\r\n    memset(buffer, 0, sizeof(buffer));\r\n\r\n/* PolarSSL SVN revision r1316 to r1317, matching <1.2.0 is to cover Ubuntu's\r\n   1.1.4 version and the like */\r\n#if POLARSSL_VERSION_NUMBER<0x01020000\r\n    if(x509parse_cert_info(buffer, sizeof(buffer), (char *)\"* \",\r\n                           conn->ssl[sockindex].ssl.peer_cert) != -1)\r\n#else\r\n    if(x509parse_cert_info(buffer, sizeof(buffer), (char *)\"* \",\r\n                           ssl_get_peer_cert(&(connssl->ssl))) != -1)\r\n#endif\r\n      infof(data, \"Dumping cert info:\\n%s\\n\", buffer);\r\n  }\r\n\r\n  connssl->connecting_state = ssl_connect_3;\r\n  infof(data, \"SSL connected\\n\");\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\npolarssl_connect_step3(struct connectdata *conn,\r\n                     int sockindex)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n  void *old_ssl_sessionid = NULL;\r\n  ssl_session *our_ssl_sessionid = &conn->ssl[sockindex].ssn ;\r\n  int incache;\r\n\r\n  DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);\r\n\r\n  /* Save the current session data for possible re-use */\r\n  incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL));\r\n  if(incache) {\r\n    if(old_ssl_sessionid != our_ssl_sessionid) {\r\n      infof(data, \"old SSL session ID is stale, removing\\n\");\r\n      Curl_ssl_delsessionid(conn, old_ssl_sessionid);\r\n      incache = FALSE;\r\n    }\r\n  }\r\n  if(!incache) {\r\n    void *new_session = malloc(sizeof(ssl_session));\r\n\r\n    if(new_session) {\r\n      memcpy(new_session, our_ssl_sessionid,\r\n             sizeof(ssl_session));\r\n\r\n      retcode = Curl_ssl_addsessionid(conn, new_session,\r\n                                   sizeof(ssl_session));\r\n    }\r\n    else {\r\n      retcode = CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    if(retcode) {\r\n      failf(data, \"failed to store ssl session\");\r\n      return retcode;\r\n    }\r\n  }\r\n\r\n  connssl->connecting_state = ssl_connect_done;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic ssize_t polarssl_send(struct connectdata *conn,\r\n                             int sockindex,\r\n                             const void *mem,\r\n                             size_t len,\r\n                             CURLcode *curlcode)\r\n{\r\n  int ret = -1;\r\n\r\n  ret = ssl_write(&conn->ssl[sockindex].ssl,\r\n                  (unsigned char *)mem, len);\r\n\r\n  if(ret < 0) {\r\n    *curlcode = (ret == POLARSSL_ERR_NET_WANT_WRITE) ?\r\n      CURLE_AGAIN : CURLE_SEND_ERROR;\r\n    ret = -1;\r\n  }\r\n\r\n  return ret;\r\n}\r\n\r\nvoid Curl_polarssl_close_all(struct SessionHandle *data)\r\n{\r\n  (void)data;\r\n}\r\n\r\nvoid Curl_polarssl_close(struct connectdata *conn, int sockindex)\r\n{\r\n  rsa_free(&conn->ssl[sockindex].rsa);\r\n  x509_free(&conn->ssl[sockindex].clicert);\r\n  x509_free(&conn->ssl[sockindex].cacert);\r\n  x509_crl_free(&conn->ssl[sockindex].crl);\r\n  ssl_free(&conn->ssl[sockindex].ssl);\r\n}\r\n\r\nstatic ssize_t polarssl_recv(struct connectdata *conn,\r\n                             int num,\r\n                             char *buf,\r\n                             size_t buffersize,\r\n                             CURLcode *curlcode)\r\n{\r\n  int ret = -1;\r\n  ssize_t len = -1;\r\n\r\n  memset(buf, 0, buffersize);\r\n  ret = ssl_read(&conn->ssl[num].ssl, (unsigned char *)buf, buffersize);\r\n\r\n  if(ret <= 0) {\r\n    if(ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY)\r\n      return 0;\r\n\r\n    *curlcode = (ret == POLARSSL_ERR_NET_WANT_READ) ?\r\n      CURLE_AGAIN : CURLE_RECV_ERROR;\r\n    return -1;\r\n  }\r\n\r\n  len = ret;\r\n\r\n  return len;\r\n}\r\n\r\nvoid Curl_polarssl_session_free(void *ptr)\r\n{\r\n  free(ptr);\r\n}\r\n\r\nsize_t Curl_polarssl_version(char *buffer, size_t size)\r\n{\r\n  unsigned int version = version_get_number();\r\n  return snprintf(buffer, size, \"PolarSSL/%d.%d.%d\", version>>24,\r\n                  (version>>16)&0xff, (version>>8)&0xff);\r\n}\r\n\r\nstatic CURLcode\r\npolarssl_connect_common(struct connectdata *conn,\r\n                        int sockindex,\r\n                        bool nonblocking,\r\n                        bool *done)\r\n{\r\n  CURLcode retcode;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long timeout_ms;\r\n  int what;\r\n\r\n  /* check if the connection has already been established */\r\n  if(ssl_connection_complete == connssl->state) {\r\n    *done = TRUE;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(ssl_connect_1==connssl->connecting_state) {\r\n    /* Find out how much more time we're allowed */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n    retcode = polarssl_connect_step1(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  while(ssl_connect_2 == connssl->connecting_state ||\r\n        ssl_connect_2_reading == connssl->connecting_state ||\r\n        ssl_connect_2_writing == connssl->connecting_state) {\r\n\r\n    /* check allowed time left */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    /* if ssl is expecting something, check if it's available. */\r\n    if(connssl->connecting_state == ssl_connect_2_reading\r\n       || connssl->connecting_state == ssl_connect_2_writing) {\r\n\r\n      curl_socket_t writefd = ssl_connect_2_writing==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n      curl_socket_t readfd = ssl_connect_2_reading==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n\r\n      what = Curl_socket_ready(readfd, writefd, nonblocking?0:timeout_ms);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n      else if(0 == what) {\r\n        if(nonblocking) {\r\n          *done = FALSE;\r\n          return CURLE_OK;\r\n        }\r\n        else {\r\n          /* timeout */\r\n          failf(data, \"SSL connection timeout\");\r\n          return CURLE_OPERATION_TIMEDOUT;\r\n        }\r\n      }\r\n      /* socket is readable or writable */\r\n    }\r\n\r\n    /* Run transaction, and return to the caller if it failed or if\r\n     * this connection is part of a multi handle and this loop would\r\n     * execute again. This permits the owner of a multi handle to\r\n     * abort a connection attempt before step2 has completed while\r\n     * ensuring that a client using select() or epoll() will always\r\n     * have a valid fdset to wait on.\r\n     */\r\n    retcode = polarssl_connect_step2(conn, sockindex);\r\n    if(retcode || (nonblocking &&\r\n                   (ssl_connect_2 == connssl->connecting_state ||\r\n                    ssl_connect_2_reading == connssl->connecting_state ||\r\n                    ssl_connect_2_writing == connssl->connecting_state)))\r\n      return retcode;\r\n\r\n  } /* repeat step2 until all transactions are done. */\r\n\r\n  if(ssl_connect_3==connssl->connecting_state) {\r\n    retcode = polarssl_connect_step3(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  if(ssl_connect_done==connssl->connecting_state) {\r\n    connssl->state = ssl_connection_complete;\r\n    conn->recv[sockindex] = polarssl_recv;\r\n    conn->send[sockindex] = polarssl_send;\r\n    *done = TRUE;\r\n  }\r\n  else\r\n    *done = FALSE;\r\n\r\n  /* Reset our connect state machine */\r\n  connssl->connecting_state = ssl_connect_1;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode\r\nCurl_polarssl_connect_nonblocking(struct connectdata *conn,\r\n                                int sockindex,\r\n                                bool *done)\r\n{\r\n  return polarssl_connect_common(conn, sockindex, TRUE, done);\r\n}\r\n\r\n\r\nCURLcode\r\nCurl_polarssl_connect(struct connectdata *conn,\r\n                    int sockindex)\r\n{\r\n  CURLcode retcode;\r\n  bool done = FALSE;\r\n\r\n  retcode = polarssl_connect_common(conn, sockindex, FALSE, &done);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  DEBUGASSERT(done);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/polarssl.h",
    "content": "#ifndef HEADER_CURL_POLARSSL_H\r\n#define HEADER_CURL_POLARSSL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010, Hoi-Ho Chan, <hoiho.chan@gmail.com>\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_POLARSSL\r\n\r\nCURLcode Curl_polarssl_connect(struct connectdata *conn, int sockindex);\r\n\r\nCURLcode Curl_polarssl_connect_nonblocking(struct connectdata *conn,\r\n                                           int sockindex,\r\n                                           bool *done);\r\n\r\n/* tell PolarSSL to close down all open information regarding connections (and\r\n   thus session ID caching etc) */\r\nvoid Curl_polarssl_close_all(struct SessionHandle *data);\r\n\r\n /* close a SSL connection */\r\nvoid Curl_polarssl_close(struct connectdata *conn, int sockindex);\r\n\r\nvoid Curl_polarssl_session_free(void *ptr);\r\nsize_t Curl_polarssl_version(char *buffer, size_t size);\r\nint Curl_polarssl_shutdown(struct connectdata *conn, int sockindex);\r\n\r\n/* API setup for PolarSSL */\r\n#define curlssl_init() (1)\r\n#define curlssl_cleanup() Curl_nop_stmt\r\n#define curlssl_connect Curl_polarssl_connect\r\n#define curlssl_connect_nonblocking Curl_polarssl_connect_nonblocking\r\n#define curlssl_session_free(x)  Curl_polarssl_session_free(x)\r\n#define curlssl_close_all Curl_polarssl_close_all\r\n#define curlssl_close Curl_polarssl_close\r\n#define curlssl_shutdown(x,y) 0\r\n#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)\r\n#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)\r\n#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)\r\n#define curlssl_version Curl_polarssl_version\r\n#define curlssl_check_cxn(x) (x=x, -1)\r\n#define curlssl_data_pending(x,y) (x=x, y=y, 0)\r\n\r\n#endif /* USE_POLARSSL */\r\n#endif /* HEADER_CURL_POLARSSL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/pop3.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n * RFC1734 POP3 Authentication\r\n * RFC1939 POP3 protocol\r\n * RFC2195 CRAM-MD5 authentication\r\n * RFC2384 POP URL Scheme\r\n * RFC2449 POP3 Extension Mechanism\r\n * RFC2595 Using TLS with IMAP, POP3 and ACAP\r\n * RFC2831 DIGEST-MD5 authentication\r\n * RFC4422 Simple Authentication and Security Layer (SASL)\r\n * RFC4616 PLAIN authentication\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_POP3\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_UTSNAME_H\r\n#include <sys/utsname.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"if2ip.h\"\r\n#include \"hostip.h\"\r\n#include \"progress.h\"\r\n#include \"transfer.h\"\r\n#include \"escape.h\"\r\n#include \"http.h\" /* for HTTP proxy tunnel stuff */\r\n#include \"socks.h\"\r\n#include \"pop3.h\"\r\n\r\n#include \"strtoofft.h\"\r\n#include \"strequal.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"select.h\"\r\n#include \"multiif.h\"\r\n#include \"url.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_sasl.h\"\r\n#include \"curl_md5.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Local API functions */\r\nstatic CURLcode pop3_parse_url_path(struct connectdata *conn);\r\nstatic CURLcode pop3_parse_custom_request(struct connectdata *conn);\r\nstatic CURLcode pop3_regular_transfer(struct connectdata *conn, bool *done);\r\nstatic CURLcode pop3_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode pop3_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature);\r\nstatic CURLcode pop3_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode pop3_disconnect(struct connectdata *conn, bool dead);\r\nstatic CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done);\r\nstatic int pop3_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks);\r\nstatic CURLcode pop3_doing(struct connectdata *conn, bool *dophase_done);\r\nstatic CURLcode pop3_setup_connection(struct connectdata *conn);\r\nstatic CURLcode pop3_state_upgrade_tls(struct connectdata *conn);\r\n\r\n/*\r\n * POP3 protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_pop3 = {\r\n  \"POP3\",                           /* scheme */\r\n  pop3_setup_connection,            /* setup_connection */\r\n  pop3_do,                          /* do_it */\r\n  pop3_done,                        /* done */\r\n  ZERO_NULL,                        /* do_more */\r\n  pop3_connect,                     /* connect_it */\r\n  pop3_multi_statemach,             /* connecting */\r\n  pop3_doing,                       /* doing */\r\n  pop3_getsock,                     /* proto_getsock */\r\n  pop3_getsock,                     /* doing_getsock */\r\n  ZERO_NULL,                        /* domore_getsock */\r\n  ZERO_NULL,                        /* perform_getsock */\r\n  pop3_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                        /* readwrite */\r\n  PORT_POP3,                        /* defport */\r\n  CURLPROTO_POP3,                   /* protocol */\r\n  PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * POP3S protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_pop3s = {\r\n  \"POP3S\",                          /* scheme */\r\n  pop3_setup_connection,            /* setup_connection */\r\n  pop3_do,                          /* do_it */\r\n  pop3_done,                        /* done */\r\n  ZERO_NULL,                        /* do_more */\r\n  pop3_connect,                     /* connect_it */\r\n  pop3_multi_statemach,             /* connecting */\r\n  pop3_doing,                       /* doing */\r\n  pop3_getsock,                     /* proto_getsock */\r\n  pop3_getsock,                     /* doing_getsock */\r\n  ZERO_NULL,                        /* domore_getsock */\r\n  ZERO_NULL,                        /* perform_getsock */\r\n  pop3_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                        /* readwrite */\r\n  PORT_POP3S,                       /* defport */\r\n  CURLPROTO_POP3 | CURLPROTO_POP3S, /* protocol */\r\n  PROTOPT_CLOSEACTION | PROTOPT_SSL\r\n  | PROTOPT_NOURLQUERY              /* flags */\r\n};\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n/*\r\n * HTTP-proxyed POP3 protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_pop3_proxy = {\r\n  \"POP3\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_POP3,                            /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * HTTP-proxyed POP3S protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_pop3s_proxy = {\r\n  \"POP3S\",                              /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_POP3S,                           /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n#endif\r\n#endif\r\n\r\n/* Function that checks for an ending pop3 status code at the start of the\r\n   given string, but also detects the APOP timestamp from the server greeting\r\n   as well as the supported authentication types and allowed SASL mechanisms\r\n   from the CAPA response. */\r\nstatic int pop3_endofresp(struct pingpong *pp, int *resp)\r\n{\r\n  char *line = pp->linestart_resp;\r\n  size_t len = strlen(pp->linestart_resp);\r\n  struct connectdata *conn = pp->conn;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  size_t wordlen;\r\n  size_t i;\r\n\r\n  /* Do we have an error response? */\r\n  if(len >= 4 && !memcmp(\"-ERR\", line, 4)) {\r\n    *resp = '-';\r\n\r\n    return FALSE;\r\n  }\r\n\r\n  /* Are we processing servergreet responses? */\r\n  if(pop3c->state == POP3_SERVERGREET) {\r\n    /* Look for the APOP timestamp */\r\n    if(len >= 3 && line[len - 3] == '>') {\r\n      for(i = 0; i < len - 3; ++i) {\r\n        if(line[i] == '<') {\r\n          /* Calculate the length of the timestamp */\r\n          size_t timestamplen = len - 2 - i;\r\n\r\n          /* Allocate some memory for the timestamp */\r\n          pop3c->apoptimestamp = (char *)calloc(1, timestamplen + 1);\r\n\r\n          if(!pop3c->apoptimestamp)\r\n            break;\r\n\r\n          /* Copy the timestamp */\r\n          memcpy(pop3c->apoptimestamp, line + i, timestamplen);\r\n          pop3c->apoptimestamp[timestamplen] = '\\0';\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  /* Are we processing CAPA command responses? */\r\n  else if(pop3c->state == POP3_CAPA) {\r\n\r\n    /* Do we have the terminating character? */\r\n    if(len >= 1 && !memcmp(line, \".\", 1)) {\r\n      *resp = '+';\r\n\r\n      return TRUE;\r\n    }\r\n\r\n    /* Does the server support clear text authentication? */\r\n    if(len >= 4 && !memcmp(line, \"USER\", 4)) {\r\n      pop3c->authtypes |= POP3_TYPE_CLEARTEXT;\r\n      return FALSE;\r\n    }\r\n\r\n    /* Does the server support APOP authentication? */\r\n    if(len >= 4 && !memcmp(line, \"APOP\", 4)) {\r\n      pop3c->authtypes |= POP3_TYPE_APOP;\r\n      return FALSE;\r\n    }\r\n\r\n    /* Does the server support SASL based authentication? */\r\n    if(len < 4 || memcmp(line, \"SASL\", 4))\r\n      return FALSE;\r\n\r\n    pop3c->authtypes |= POP3_TYPE_SASL;\r\n\r\n    /* Advance past the SASL keyword */\r\n    line += 4;\r\n    len -= 4;\r\n\r\n    /* Loop through the data line */\r\n    for(;;) {\r\n      while(len &&\r\n            (*line == ' ' || *line == '\\t' ||\r\n             *line == '\\r' || *line == '\\n')) {\r\n\r\n        if(*line == '\\n')\r\n          return FALSE;\r\n\r\n        line++;\r\n        len--;\r\n      }\r\n\r\n      if(!len)\r\n        break;\r\n\r\n      /* Extract the word */\r\n      for(wordlen = 0; wordlen < len && line[wordlen] != ' ' &&\r\n            line[wordlen] != '\\t' && line[wordlen] != '\\r' &&\r\n            line[wordlen] != '\\n';)\r\n        wordlen++;\r\n\r\n      /* Test the word for a matching authentication mechanism */\r\n      if(wordlen == 5 && !memcmp(line, \"LOGIN\", 5))\r\n        pop3c->authmechs |= SASL_MECH_LOGIN;\r\n      else if(wordlen == 5 && !memcmp(line, \"PLAIN\", 5))\r\n        pop3c->authmechs |= SASL_MECH_PLAIN;\r\n      else if(wordlen == 8 && !memcmp(line, \"CRAM-MD5\", 8))\r\n        pop3c->authmechs |= SASL_MECH_CRAM_MD5;\r\n      else if(wordlen == 10 && !memcmp(line, \"DIGEST-MD5\", 10))\r\n        pop3c->authmechs |= SASL_MECH_DIGEST_MD5;\r\n      else if(wordlen == 6 && !memcmp(line, \"GSSAPI\", 6))\r\n        pop3c->authmechs |= SASL_MECH_GSSAPI;\r\n      else if(wordlen == 8 && !memcmp(line, \"EXTERNAL\", 8))\r\n        pop3c->authmechs |= SASL_MECH_EXTERNAL;\r\n      else if(wordlen == 4 && !memcmp(line, \"NTLM\", 4))\r\n        pop3c->authmechs |= SASL_MECH_NTLM;\r\n\r\n      line += wordlen;\r\n      len -= wordlen;\r\n    }\r\n  }\r\n\r\n  if((len < 1 || memcmp(\"+\", line, 1)) &&\r\n     (len < 3 || memcmp(\"+OK\", line, 3)))\r\n  return FALSE; /* Nothing for us */\r\n\r\n  /* Otherwise it's a positive response */\r\n  *resp = '+';\r\n\r\n  return TRUE;\r\n}\r\n\r\n/* This is the ONLY way to change POP3 state! */\r\nstatic void state(struct connectdata *conn, pop3state newstate)\r\n{\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  /* for debug purposes */\r\n  static const char * const names[] = {\r\n    \"STOP\",\r\n    \"SERVERGREET\",\r\n    \"STARTTLS\",\r\n    \"UPGRADETLS\",\r\n    \"CAPA\",\r\n    \"AUTH_PLAIN\",\r\n    \"AUTH_LOGIN\",\r\n    \"AUTH_LOGIN_PASSWD\",\r\n    \"AUTH_CRAMMD5\",\r\n    \"AUTH_DIGESTMD5\",\r\n    \"AUTH_DIGESTMD5_RESP\",\r\n    \"AUTH_NTLM\",\r\n    \"AUTH_NTLM_TYPE2MSG\",\r\n    \"AUTH\",\r\n    \"APOP\",\r\n    \"USER\",\r\n    \"PASS\",\r\n    \"COMMAND\",\r\n    \"QUIT\",\r\n    /* LAST */\r\n  };\r\n\r\n  if(pop3c->state != newstate)\r\n    infof(conn->data, \"POP3 %p state change from %s to %s\\n\",\r\n          pop3c, names[pop3c->state], names[newstate]);\r\n#endif\r\n\r\n  pop3c->state = newstate;\r\n}\r\n\r\nstatic CURLcode pop3_state_capa(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n\r\n  pop3c->authmechs = 0;         /* No known authentication mechanisms yet */\r\n  pop3c->authused = 0;          /* Clear the authentication mechanism used */\r\n\r\n  /* Check we have a username and password to authenticate with and end the\r\n     connect phase if we don't */\r\n  if(!conn->bits.user_passwd) {\r\n    state(conn, POP3_STOP);\r\n\r\n    return result;\r\n  }\r\n\r\n  /* Send the CAPA command */\r\n  result = Curl_pp_sendf(&pop3c->pp, \"CAPA\");\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, POP3_CAPA);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode pop3_state_user(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  struct FTP *pop3 = conn->data->state.proto.pop3;\r\n\r\n  /* Send the USER command */\r\n  result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"USER %s\",\r\n                         pop3->user ? pop3->user : \"\");\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, POP3_USER);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\nstatic CURLcode pop3_state_apop(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  size_t i;\r\n  MD5_context *ctxt;\r\n  unsigned char digest[MD5_DIGEST_LEN];\r\n  char secret[2 * MD5_DIGEST_LEN + 1];\r\n\r\n  ctxt = Curl_MD5_init(Curl_DIGEST_MD5);\r\n  if(!ctxt)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) pop3c->apoptimestamp,\r\n                  curlx_uztoui(strlen(pop3c->apoptimestamp)));\r\n\r\n  Curl_MD5_update(ctxt, (const unsigned char *) conn->passwd,\r\n                  curlx_uztoui(strlen(conn->passwd)));\r\n\r\n  /* Finalise the digest */\r\n  Curl_MD5_final(ctxt, digest);\r\n\r\n  /* Convert the calculated 16 octet digest into a 32 byte hex string */\r\n  for(i = 0; i < MD5_DIGEST_LEN; i++)\r\n    snprintf(&secret[2 * i], 3, \"%02x\", digest[i]);\r\n\r\n  result = Curl_pp_sendf(&pop3c->pp, \"APOP %s %s\", conn->user, secret);\r\n\r\n  if(!result)\r\n    state(conn, POP3_APOP);\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\nstatic CURLcode pop3_authenticate(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  const char *mech = NULL;\r\n  pop3state authstate = POP3_STOP;\r\n\r\n  /* Calculate the supported authentication mechanism by decreasing order of\r\n     security */\r\n  if(pop3c->authtypes & POP3_TYPE_SASL) {\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n    if(pop3c->authmechs & SASL_MECH_DIGEST_MD5) {\r\n      mech = \"DIGEST-MD5\";\r\n      authstate = POP3_AUTH_DIGESTMD5;\r\n      pop3c->authused = SASL_MECH_DIGEST_MD5;\r\n    }\r\n    else if(pop3c->authmechs & SASL_MECH_CRAM_MD5) {\r\n      mech = \"CRAM-MD5\";\r\n      authstate = POP3_AUTH_CRAMMD5;\r\n      pop3c->authused = SASL_MECH_CRAM_MD5;\r\n    }\r\n    else\r\n#endif\r\n#ifdef USE_NTLM\r\n    if(pop3c->authmechs & SASL_MECH_NTLM) {\r\n      mech = \"NTLM\";\r\n      authstate = POP3_AUTH_NTLM;\r\n      pop3c->authused = SASL_MECH_NTLM;\r\n    }\r\n    else\r\n#endif\r\n    if(pop3c->authmechs & SASL_MECH_LOGIN) {\r\n      mech = \"LOGIN\";\r\n      authstate = POP3_AUTH_LOGIN;\r\n      pop3c->authused = SASL_MECH_LOGIN;\r\n    }\r\n    else if(pop3c->authmechs & SASL_MECH_PLAIN) {\r\n      mech = \"PLAIN\";\r\n      authstate = POP3_AUTH_PLAIN;\r\n      pop3c->authused = SASL_MECH_PLAIN;\r\n    }\r\n  }\r\n\r\n  if(mech) {\r\n    /* Perform SASL based authentication */\r\n    result = Curl_pp_sendf(&pop3c->pp, \"AUTH %s\", mech);\r\n\r\n    if(!result)\r\n      state(conn, authstate);\r\n  }\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n  else if(pop3c->authtypes & POP3_TYPE_APOP)\r\n    /* Perform APOP authentication */\r\n    result = pop3_state_apop(conn);\r\n#endif\r\n  else if(pop3c->authtypes & POP3_TYPE_CLEARTEXT)\r\n    /* Perform clear text authentication */\r\n    result = pop3_state_user(conn);\r\n  else {\r\n    /* Other mechanisms not supported */\r\n    infof(conn->data, \"No known authentication mechanisms supported!\\n\");\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For the POP3 \"protocol connect\" and \"doing\" phases only */\r\nstatic int pop3_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks)\r\n{\r\n  return Curl_pp_getsock(&conn->proto.pop3c.pp, socks, numsocks);\r\n}\r\n\r\n#ifdef USE_SSL\r\nstatic void pop3_to_pop3s(struct connectdata *conn)\r\n{\r\n  conn->handler = &Curl_handler_pop3s;\r\n}\r\n#else\r\n#define pop3_to_pop3s(x) Curl_nop_stmt\r\n#endif\r\n\r\n/* For the initial server greeting */\r\nstatic CURLcode pop3_state_servergreet_resp(struct connectdata *conn,\r\n                                            int pop3code,\r\n                                            pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Got unexpected pop3-server response\");\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n\r\n  if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {\r\n    /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch\r\n       to TLS connection now */\r\n    result = Curl_pp_sendf(&pop3c->pp, \"STLS\");\r\n    if(!result)\r\n      state(conn, POP3_STARTTLS);\r\n  }\r\n  else\r\n    result = pop3_state_capa(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For STARTTLS responses */\r\nstatic CURLcode pop3_state_starttls_resp(struct connectdata *conn,\r\n                                         int pop3code,\r\n                                         pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    if(data->set.use_ssl != CURLUSESSL_TRY) {\r\n      failf(data, \"STARTTLS denied. %c\", pop3code);\r\n      result = CURLE_USE_SSL_FAILED;\r\n    }\r\n    else\r\n      result = pop3_state_capa(conn);\r\n  }\r\n  else\r\n    result = pop3_state_upgrade_tls(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode pop3_state_upgrade_tls(struct connectdata *conn)\r\n{\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  CURLcode result;\r\n\r\n  result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone);\r\n\r\n  if(!result) {\r\n    if(pop3c->state != POP3_UPGRADETLS)\r\n      state(conn, POP3_UPGRADETLS);\r\n\r\n    if(pop3c->ssldone) {\r\n      pop3_to_pop3s(conn);\r\n      result = pop3_state_capa(conn);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For CAPA responses */\r\nstatic CURLcode pop3_state_capa_resp(struct connectdata *conn, int pop3code,\r\n                                     pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code == '+')\r\n    result = pop3_authenticate(conn);\r\n  else\r\n    result = pop3_state_user(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH PLAIN responses */\r\nstatic CURLcode pop3_state_auth_plain_resp(struct connectdata *conn,\r\n                                           int pop3code,\r\n                                           pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *plainauth = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied. %c\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the authorisation message */\r\n    result = Curl_sasl_create_plain_message(data, conn->user, conn->passwd,\r\n                                            &plainauth, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(plainauth) {\r\n        result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", plainauth);\r\n\r\n        if(!result)\r\n          state(conn, POP3_AUTH);\r\n      }\r\n\r\n      Curl_safefree(plainauth);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH LOGIN responses */\r\nstatic CURLcode pop3_state_auth_login_resp(struct connectdata *conn,\r\n                                           int pop3code,\r\n                                           pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *authuser = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the user message */\r\n    result = Curl_sasl_create_login_message(data, conn->user,\r\n                                            &authuser, &len);\r\n\r\n    /* Send the user */\r\n    if(!result) {\r\n      if(authuser) {\r\n        result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", authuser);\r\n\r\n        if(!result)\r\n          state(conn, POP3_AUTH_LOGIN_PASSWD);\r\n      }\r\n\r\n      Curl_safefree(authuser);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH LOGIN user entry responses */\r\nstatic CURLcode pop3_state_auth_login_password_resp(struct connectdata *conn,\r\n                                                    int pop3code,\r\n                                                    pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *authpasswd = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the password message */\r\n    result = Curl_sasl_create_login_message(data, conn->passwd,\r\n                                            &authpasswd, &len);\r\n\r\n    /* Send the password */\r\n    if(!result) {\r\n      if(authpasswd) {\r\n        result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", authpasswd);\r\n\r\n        if(!result)\r\n          state(conn, POP3_AUTH);\r\n      }\r\n\r\n      Curl_safefree(authpasswd);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n/* For AUTH CRAM-MD5 responses */\r\nstatic CURLcode pop3_state_auth_cram_resp(struct connectdata *conn,\r\n                                          int pop3code,\r\n                                          pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *chlg64 = data->state.buffer;\r\n  size_t len = 0;\r\n  char *rplyb64 = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied: %d\", pop3code);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Get the challenge */\r\n  for(chlg64 += 2; *chlg64 == ' ' || *chlg64 == '\\t'; chlg64++)\r\n    ;\r\n\r\n  /* Terminate the challenge */\r\n  if(*chlg64 != '=') {\r\n    for(len = strlen(chlg64); len--;)\r\n      if(chlg64[len] != '\\r' && chlg64[len] != '\\n' && chlg64[len] != ' ' &&\r\n         chlg64[len] != '\\t')\r\n        break;\r\n\r\n    if(++len) {\r\n      chlg64[len] = '\\0';\r\n    }\r\n  }\r\n\r\n  /* Create the response message */\r\n  result = Curl_sasl_create_cram_md5_message(data, chlg64, conn->user,\r\n                                             conn->passwd, &rplyb64, &len);\r\n\r\n  /* Send the response */\r\n  if(!result) {\r\n    if(rplyb64) {\r\n      result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", rplyb64);\r\n\r\n      if(!result)\r\n        state(conn, POP3_AUTH);\r\n    }\r\n\r\n    Curl_safefree(rplyb64);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH DIGEST-MD5 challenge responses */\r\nstatic CURLcode pop3_state_auth_digest_resp(struct connectdata *conn,\r\n                                            int pop3code,\r\n                                            pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *chlg64 = data->state.buffer;\r\n  size_t len = 0;\r\n  char *rplyb64 = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied: %d\", pop3code);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Get the challenge */\r\n  for(chlg64 += 2; *chlg64 == ' ' || *chlg64 == '\\t'; chlg64++)\r\n    ;\r\n\r\n  /* Create the response message */\r\n  result = Curl_sasl_create_digest_md5_message(data, chlg64, conn->user,\r\n                                               conn->passwd, \"pop\",\r\n                                               &rplyb64, &len);\r\n\r\n  /* Send the response */\r\n  if(!result) {\r\n    if(rplyb64) {\r\n      result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", rplyb64);\r\n\r\n      if(!result)\r\n        state(conn, POP3_AUTH_DIGESTMD5_RESP);\r\n    }\r\n\r\n    Curl_safefree(rplyb64);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH DIGEST-MD5 challenge-response responses */\r\nstatic CURLcode pop3_state_auth_digest_resp_resp(struct connectdata *conn,\r\n                                                 int pop3code,\r\n                                                 pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Authentication failed: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Send an empty response */\r\n    result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"\");\r\n\r\n    if(!result)\r\n      state(conn, POP3_AUTH);\r\n  }\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n/* For AUTH NTLM responses */\r\nstatic CURLcode pop3_state_auth_ntlm_resp(struct connectdata *conn,\r\n                                          int pop3code,\r\n                                          pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *type1msg = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the type-1 message */\r\n    result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &type1msg, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(type1msg) {\r\n        result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", type1msg);\r\n\r\n        if(!result)\r\n          state(conn, POP3_AUTH_NTLM_TYPE2MSG);\r\n      }\r\n\r\n      Curl_safefree(type1msg);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For NTLM type-2 responses (sent in reponse to our type-1 message) */\r\nstatic CURLcode pop3_state_auth_ntlm_type2msg_resp(struct connectdata *conn,\r\n                                                   int pop3code,\r\n                                                   pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *type3msg = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the type-3 message */\r\n    result = Curl_sasl_create_ntlm_type3_message(data,\r\n                                                 data->state.buffer + 2,\r\n                                                 conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &type3msg, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(type3msg) {\r\n        result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s\", type3msg);\r\n\r\n        if(!result)\r\n          state(conn, POP3_AUTH);\r\n      }\r\n\r\n      Curl_safefree(type3msg);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\n/* For final responses to the AUTH sequence */\r\nstatic CURLcode pop3_state_auth_final_resp(struct connectdata *conn,\r\n                                           int pop3code,\r\n                                           pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Authentication failed: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* End of connect phase */\r\n  state(conn, POP3_STOP);\r\n\r\n  return result;\r\n}\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\nstatic CURLcode pop3_state_apop_resp(struct connectdata *conn, int pop3code,\r\n                                     pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Authentication failed: %d\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* End of connect phase */\r\n  state(conn, POP3_STOP);\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\n/* For USER responses */\r\nstatic CURLcode pop3_state_user_resp(struct connectdata *conn, int pop3code,\r\n                                     pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *pop3 = data->state.proto.pop3;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied. %c\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else\r\n    /* Send the PASS command */\r\n    result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"PASS %s\",\r\n                           pop3->passwd ? pop3->passwd : \"\");\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, POP3_PASS);\r\n\r\n  return result;\r\n}\r\n\r\n/* For PASS responses */\r\nstatic CURLcode pop3_state_pass_resp(struct connectdata *conn, int pop3code,\r\n                                     pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    failf(data, \"Access denied. %c\", pop3code);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* End of connect phase */\r\n  state(conn, POP3_STOP);\r\n\r\n  return result;\r\n}\r\n\r\n/* Start the DO phase for the command */\r\nstatic CURLcode pop3_command(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  const char *command = NULL;\r\n\r\n  /* Calculate the default command */\r\n  if(pop3c->mailbox[0] == '\\0' || conn->data->set.ftp_list_only) {\r\n    command = \"LIST\";\r\n\r\n    if(pop3c->mailbox[0] != '\\0') {\r\n      /* Message specific LIST so skip the BODY transfer */\r\n      struct FTP *pop3 = conn->data->state.proto.pop3;\r\n      pop3->transfer = FTPTRANSFER_INFO;\r\n    }\r\n  }\r\n  else\r\n    command = \"RETR\";\r\n\r\n  /* Send the command */\r\n  if(pop3c->mailbox[0] != '\\0')\r\n    result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"%s %s\",\r\n                           (pop3c->custom && pop3c->custom[0] != '\\0' ?\r\n                            pop3c->custom : command), pop3c->mailbox);\r\n  else\r\n    result = Curl_pp_sendf(&conn->proto.pop3c.pp,\r\n                           (pop3c->custom && pop3c->custom[0] != '\\0' ?\r\n                            pop3c->custom : command));\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, POP3_COMMAND);\r\n\r\n  return result;\r\n}\r\n\r\n/* For command responses */\r\nstatic CURLcode pop3_state_command_resp(struct connectdata *conn,\r\n                                        int pop3code,\r\n                                        pop3state instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *pop3 = data->state.proto.pop3;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  struct pingpong *pp = &pop3c->pp;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(pop3code != '+') {\r\n    state(conn, POP3_STOP);\r\n    return CURLE_RECV_ERROR;\r\n  }\r\n\r\n  /* This 'OK' line ends with a CR LF pair which is the two first bytes of the\r\n     EOB string so count this is two matching bytes. This is necessary to make\r\n     the code detect the EOB if the only data than comes now is %2e CR LF like\r\n     when there is no body to return. */\r\n  pop3c->eob = 2;\r\n\r\n  /* But since this initial CR LF pair is not part of the actual body, we set\r\n     the strip counter here so that these bytes won't be delivered. */\r\n  pop3c->strip = 2;\r\n\r\n  /* POP3 download */\r\n  Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp,\r\n                      -1, NULL); /* no upload here */\r\n\r\n  if(pp->cache) {\r\n    /* The header \"cache\" contains a bunch of data that is actually body\r\n       content so send it as such. Note that there may even be additional\r\n       \"headers\" after the body */\r\n\r\n    if(!data->set.opt_no_body) {\r\n      result = Curl_pop3_write(conn, pp->cache, pp->cache_size);\r\n      if(result)\r\n        return result;\r\n    }\r\n\r\n    /* Free the cache */\r\n    Curl_safefree(pp->cache);\r\n\r\n    /* Reset the cache size */\r\n    pp->cache_size = 0;\r\n  }\r\n\r\n  /* End of do phase */\r\n  state(conn, POP3_STOP);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode pop3_statemach_act(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  int pop3code;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  struct pingpong *pp = &pop3c->pp;\r\n  size_t nread = 0;\r\n\r\n  /* Busy upgrading the connection; right now all I/O is SSL/TLS, not POP3 */\r\n  if(pop3c->state == POP3_UPGRADETLS)\r\n    return pop3_state_upgrade_tls(conn);\r\n\r\n  /* Flush any data that needs to be sent */\r\n  if(pp->sendleft)\r\n    return Curl_pp_flushsend(pp);\r\n\r\n  /* Read the response from the server */\r\n  result = Curl_pp_readresp(sock, pp, &pop3code, &nread);\r\n  if(result)\r\n    return result;\r\n\r\n  if(pop3code) {\r\n    /* We have now received a full POP3 server response */\r\n    switch(pop3c->state) {\r\n    case POP3_SERVERGREET:\r\n      result = pop3_state_servergreet_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_STARTTLS:\r\n      result = pop3_state_starttls_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_CAPA:\r\n      result = pop3_state_capa_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_AUTH_PLAIN:\r\n      result = pop3_state_auth_plain_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_AUTH_LOGIN:\r\n      result = pop3_state_auth_login_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_AUTH_LOGIN_PASSWD:\r\n      result = pop3_state_auth_login_password_resp(conn, pop3code,\r\n                                                   pop3c->state);\r\n      break;\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n    case POP3_AUTH_CRAMMD5:\r\n      result = pop3_state_auth_cram_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_AUTH_DIGESTMD5:\r\n      result = pop3_state_auth_digest_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_AUTH_DIGESTMD5_RESP:\r\n      result = pop3_state_auth_digest_resp_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n    case POP3_AUTH_NTLM:\r\n      result = pop3_state_auth_ntlm_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_AUTH_NTLM_TYPE2MSG:\r\n      result = pop3_state_auth_ntlm_type2msg_resp(conn, pop3code,\r\n                                                  pop3c->state);\r\n      break;\r\n#endif\r\n\r\n    case POP3_AUTH:\r\n      result = pop3_state_auth_final_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n    case POP3_APOP:\r\n      result = pop3_state_apop_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n#endif\r\n\r\n    case POP3_USER:\r\n      result = pop3_state_user_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_PASS:\r\n      result = pop3_state_pass_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_COMMAND:\r\n      result = pop3_state_command_resp(conn, pop3code, pop3c->state);\r\n      break;\r\n\r\n    case POP3_QUIT:\r\n      /* fallthrough, just stop! */\r\n    default:\r\n      /* internal error */\r\n      state(conn, POP3_STOP);\r\n      break;\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Called repeatedly until done from multi.c */\r\nstatic CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done)\r\n{\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  CURLcode result;\r\n\r\n  if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone)\r\n    result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone);\r\n  else\r\n    result = Curl_pp_multi_statemach(&pop3c->pp);\r\n\r\n  *done = (pop3c->state == POP3_STOP) ? TRUE : FALSE;\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode pop3_easy_statemach(struct connectdata *conn)\r\n{\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  struct pingpong *pp = &pop3c->pp;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  while(pop3c->state != POP3_STOP) {\r\n    result = Curl_pp_easy_statemach(pp);\r\n    if(result)\r\n      break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Allocate and initialize the POP3 struct for the current SessionHandle if\r\n   required */\r\nstatic CURLcode pop3_init(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *pop3 = data->state.proto.pop3;\r\n\r\n  if(!pop3) {\r\n    pop3 = data->state.proto.pop3 = calloc(sizeof(struct FTP), 1);\r\n    if(!pop3)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Get some initial data into the pop3 struct */\r\n  pop3->bytecountp = &data->req.bytecount;\r\n\r\n  /* No need to duplicate user+password, the connectdata struct won't change\r\n     during a session, but we re-init them here since on subsequent inits\r\n     since the conn struct may have changed or been replaced.\r\n  */\r\n  pop3->user = conn->user;\r\n  pop3->passwd = conn->passwd;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_connect()\r\n *\r\n * This function should do everything that is to be considered a part of the\r\n * connection phase.\r\n *\r\n * The variable 'done' points to will be TRUE if the protocol-layer connect\r\n * phase is done when this function returns, or FALSE is not. When called as\r\n * a part of the easy interface, it will always be TRUE.\r\n */\r\nstatic CURLcode pop3_connect(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  struct pingpong *pp = &pop3c->pp;\r\n\r\n  *done = FALSE; /* default to not done yet */\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  result = pop3_init(conn);\r\n  if(CURLE_OK != result)\r\n    return result;\r\n\r\n  /* We always support persistent connections on pop3 */\r\n  conn->bits.close = FALSE;\r\n\r\n  pp->response_time = RESP_TIMEOUT; /* set default response time-out */\r\n  pp->statemach_act = pop3_statemach_act;\r\n  pp->endofresp = pop3_endofresp;\r\n  pp->conn = conn;\r\n\r\n  if(conn->handler->flags & PROTOPT_SSL) {\r\n    /* POP3S is simply pop3 with SSL for the control channel */\r\n    /* so perform the SSL initialization for this socket */\r\n    result = Curl_ssl_connect(conn, FIRSTSOCKET);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  /* Initialise the response reader stuff */\r\n  Curl_pp_init(pp);\r\n\r\n  /* Start off waiting for the server greeting response */\r\n  state(conn, POP3_SERVERGREET);\r\n\r\n  result = pop3_multi_statemach(conn, done);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_done()\r\n *\r\n * The DONE function. This does what needs to be done after a single DO has\r\n * performed.\r\n *\r\n * Input argument is already checked for validity.\r\n */\r\nstatic CURLcode pop3_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *pop3 = data->state.proto.pop3;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  (void)premature;\r\n\r\n  if(!pop3)\r\n    /* When the easy handle is removed from the multi while libcurl is still\r\n     * trying to resolve the host name, it seems that the pop3 struct is not\r\n     * yet initialized, but the removal action calls Curl_done() which calls\r\n     * this function. So we simply return success if no pop3 pointer is set.\r\n     */\r\n    return CURLE_OK;\r\n\r\n  if(status) {\r\n    conn->bits.close = TRUE; /* marked for closure */\r\n    result = status;         /* use the already set error code */\r\n  }\r\n\r\n  /* Cleanup our do based variables */\r\n  Curl_safefree(pop3c->mailbox);\r\n  Curl_safefree(pop3c->custom);\r\n\r\n  /* Clear the transfer mode for the next connection */\r\n  pop3->transfer = FTPTRANSFER_BODY;\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_perform()\r\n *\r\n * This is the actual DO function for POP3. Get a file/directory according to\r\n * the options previously setup.\r\n */\r\nstatic CURLcode pop3_perform(struct connectdata *conn, bool *connected,\r\n                             bool *dophase_done)\r\n{\r\n  /* This is POP3 and no proxy */\r\n  CURLcode result = CURLE_OK;\r\n\r\n  DEBUGF(infof(conn->data, \"DO phase starts\\n\"));\r\n\r\n  if(conn->data->set.opt_no_body) {\r\n    /* Requested no body means no transfer */\r\n    struct FTP *pop3 = conn->data->state.proto.pop3;\r\n    pop3->transfer = FTPTRANSFER_INFO;\r\n  }\r\n\r\n  *dophase_done = FALSE; /* not done yet */\r\n\r\n  /* Start the first command in the DO phase */\r\n  result = pop3_command(conn);\r\n  if(result)\r\n    return result;\r\n\r\n  /* Run the state-machine */\r\n  result = pop3_multi_statemach(conn, dophase_done);\r\n\r\n  *connected = conn->bits.tcpconnect[FIRSTSOCKET];\r\n\r\n  if(*dophase_done)\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_do()\r\n *\r\n * This function is registered as 'curl_do' function. It decodes the path\r\n * parts etc as a wrapper to the actual DO function (pop3_perform).\r\n *\r\n * The input argument is already checked for validity.\r\n */\r\nstatic CURLcode pop3_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n\r\n  *done = FALSE; /* default to false */\r\n\r\n  /*\r\n    Since connections can be re-used between SessionHandles, this might be a\r\n    connection already existing but on a fresh SessionHandle struct so we must\r\n    make sure we have a good 'struct POP3' to play with. For new connections,\r\n    the struct POP3 is allocated and setup in the pop3_connect() function.\r\n  */\r\n  Curl_reset_reqproto(conn);\r\n  retcode = pop3_init(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  /* Parse the URL path */\r\n  retcode = pop3_parse_url_path(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  /* Parse the custom request */\r\n  retcode = pop3_parse_custom_request(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  retcode = pop3_regular_transfer(conn, done);\r\n\r\n  return retcode;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_quit()\r\n *\r\n * This should be called before calling sclose().  We should then wait for the\r\n * response from the server before returning. The calling code should then try\r\n * to close the connection.\r\n */\r\nstatic CURLcode pop3_quit(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  result = Curl_pp_sendf(&conn->proto.pop3c.pp, \"QUIT\", NULL);\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, POP3_QUIT);\r\n\r\n  result = pop3_easy_statemach(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_disconnect()\r\n *\r\n * Disconnect from an POP3 server. Cleanup protocol-specific per-connection\r\n * resources. BLOCKING.\r\n */\r\nstatic CURLcode pop3_disconnect(struct connectdata *conn,\r\n                                bool dead_connection)\r\n{\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n\r\n  /* We cannot send quit unconditionally. If this connection is stale or\r\n     bad in any way, sending quit and waiting around here will make the\r\n     disconnect wait in vain and cause more problems than we need to */\r\n\r\n  /* The POP3 session may or may not have been allocated/setup at this\r\n     point! */\r\n  if(!dead_connection && pop3c->pp.conn)\r\n    (void)pop3_quit(conn); /* ignore errors on the LOGOUT */\r\n\r\n  /* Disconnect from the server */\r\n  Curl_pp_disconnect(&pop3c->pp);\r\n\r\n  /* Cleanup the SASL module */\r\n  Curl_sasl_cleanup(conn, pop3c->authused);\r\n\r\n  /* Cleanup our connection based variables */\r\n  Curl_safefree(pop3c->apoptimestamp);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_parse_url_path()\r\n *\r\n * Parse the URL path into separate path components.\r\n */\r\nstatic CURLcode pop3_parse_url_path(struct connectdata *conn)\r\n{\r\n  /* The POP3 struct is already initialised in pop3_connect() */\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  struct SessionHandle *data = conn->data;\r\n  const char *path = data->state.path;\r\n\r\n  /* URL decode the path and use this mailbox */\r\n  return Curl_urldecode(data, path, 0, &pop3c->mailbox, NULL, TRUE);\r\n}\r\n\r\nstatic CURLcode pop3_parse_custom_request(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  struct SessionHandle *data = conn->data;\r\n  const char *custom = conn->data->set.str[STRING_CUSTOMREQUEST];\r\n\r\n  /* URL decode the custom request */\r\n  if(custom)\r\n    result = Curl_urldecode(data, custom, 0, &pop3c->custom, NULL, TRUE);\r\n\r\n  return result;\r\n}\r\n\r\n/* Call this when the DO phase has completed */\r\nstatic CURLcode pop3_dophase_done(struct connectdata *conn, bool connected)\r\n{\r\n  struct FTP *pop3 = conn->data->state.proto.pop3;\r\n\r\n  (void)connected;\r\n\r\n  if(pop3->transfer != FTPTRANSFER_BODY)\r\n    /* no data to transfer */\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Called from multi.c while DOing */\r\nstatic CURLcode pop3_doing(struct connectdata *conn, bool *dophase_done)\r\n{\r\n  CURLcode result = pop3_multi_statemach(conn, dophase_done);\r\n\r\n  if(result)\r\n    DEBUGF(infof(conn->data, \"DO phase failed\\n\"));\r\n  else {\r\n    if(*dophase_done) {\r\n      result = pop3_dophase_done(conn, FALSE /* not connected */);\r\n\r\n      DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * pop3_regular_transfer()\r\n *\r\n * The input argument is already checked for validity.\r\n *\r\n * Performs all commands done before a regular transfer between a local and a\r\n * remote host.\r\n */\r\nstatic CURLcode pop3_regular_transfer(struct connectdata *conn,\r\n                                      bool *dophase_done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  bool connected = FALSE;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* Make sure size is unknown at this point */\r\n  data->req.size = -1;\r\n\r\n  Curl_pgrsSetUploadCounter(data, 0);\r\n  Curl_pgrsSetDownloadCounter(data, 0);\r\n  Curl_pgrsSetUploadSize(data, 0);\r\n  Curl_pgrsSetDownloadSize(data, 0);\r\n\r\n  result = pop3_perform(conn, &connected, dophase_done);\r\n\r\n  if(CURLE_OK == result) {\r\n    if(!*dophase_done)\r\n      /* The DO phase has not completed yet */\r\n      return CURLE_OK;\r\n\r\n    result = pop3_dophase_done(conn, connected);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode pop3_setup_connection(struct connectdata * conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) {\r\n    /* Unless we have asked to tunnel pop3 operations through the proxy, we\r\n       switch and use HTTP operations only */\r\n#ifndef CURL_DISABLE_HTTP\r\n    if(conn->handler == &Curl_handler_pop3)\r\n      conn->handler = &Curl_handler_pop3_proxy;\r\n    else {\r\n#ifdef USE_SSL\r\n      conn->handler = &Curl_handler_pop3s_proxy;\r\n#else\r\n      failf(data, \"POP3S not supported!\");\r\n      return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n    }\r\n\r\n    /* We explicitly mark this connection as persistent here as we're doing\r\n       POP3 over HTTP and thus we accidentally avoid setting this value\r\n       otherwise */\r\n    conn->bits.close = FALSE;\r\n#else\r\n    failf(data, \"POP3 over http proxy requires HTTP support built-in!\");\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n  }\r\n\r\n  data->state.path++;   /* don't include the initial slash */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* This function scans the body after the end-of-body and writes everything\r\n   until the end is found */\r\nCURLcode Curl_pop3_write(struct connectdata *conn, char *str, size_t nread)\r\n{\r\n  /* This code could be made into a special function in the handler struct */\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct SingleRequest *k = &data->req;\r\n\r\n  struct pop3_conn *pop3c = &conn->proto.pop3c;\r\n  bool strip_dot = FALSE;\r\n  size_t last = 0;\r\n  size_t i;\r\n\r\n  /* Search through the buffer looking for the end-of-body marker which is\r\n     5 bytes (0d 0a 2e 0d 0a). Note that a line starting with a dot matches\r\n     the eob so the server will have prefixed it with an extra dot which we\r\n     need to strip out. Additionally the marker could of course be spread out\r\n     over 5 different data chunks */\r\n  for(i = 0; i < nread; i++) {\r\n    size_t prev = pop3c->eob;\r\n\r\n    switch(str[i]) {\r\n    case 0x0d:\r\n      if(pop3c->eob == 0) {\r\n        pop3c->eob++;\r\n\r\n        if(i) {\r\n          /* Write out the body part that didn't match */\r\n          result = Curl_client_write(conn, CLIENTWRITE_BODY, &str[last],\r\n                                     i - last);\r\n\r\n          if(result)\r\n            return result;\r\n\r\n          last = i;\r\n        }\r\n      }\r\n      else if(pop3c->eob == 3)\r\n        pop3c->eob++;\r\n      else\r\n        /* If the character match wasn't at position 0 or 3 then restart the\r\n           pattern matching */\r\n        pop3c->eob = 1;\r\n      break;\r\n\r\n    case 0x0a:\r\n      if(pop3c->eob == 1 || pop3c->eob == 4)\r\n        pop3c->eob++;\r\n      else\r\n        /* If the character match wasn't at position 1 or 4 then start the\r\n           search again */\r\n        pop3c->eob = 0;\r\n      break;\r\n\r\n    case 0x2e:\r\n      if(pop3c->eob == 2)\r\n        pop3c->eob++;\r\n      else if(pop3c->eob == 3) {\r\n        /* We have an extra dot after the CRLF which we need to strip off */\r\n        strip_dot = TRUE;\r\n        pop3c->eob = 0;\r\n      }\r\n      else\r\n        /* If the character match wasn't at position 2 then start the search\r\n           again */\r\n        pop3c->eob = 0;\r\n      break;\r\n\r\n    default:\r\n      pop3c->eob = 0;\r\n      break;\r\n    }\r\n\r\n    /* Did we have a partial match which has subsequently failed? */\r\n    if(prev && prev >= pop3c->eob) {\r\n      /* Strip can only be non-zero for the very first mismatch after CRLF\r\n         and then both prev and strip are equal and nothing will be output\r\n         below */\r\n      while(prev && pop3c->strip) {\r\n        prev--;\r\n        pop3c->strip--;\r\n      }\r\n\r\n      if(prev) {\r\n        /* If the partial match was the CRLF and dot then only write the CRLF\r\n           as the server would have inserted the dot */\r\n        result = Curl_client_write(conn, CLIENTWRITE_BODY, (char*)POP3_EOB,\r\n                                   strip_dot ? prev - 1 : prev);\r\n\r\n        if(result)\r\n          return result;\r\n\r\n        last = i;\r\n        strip_dot = FALSE;\r\n      }\r\n    }\r\n  }\r\n\r\n  if(pop3c->eob == POP3_EOB_LEN) {\r\n    /* We have a full match so the transfer is done, however we must transfer\r\n    the CRLF at the start of the EOB as this is considered to be part of the\r\n    message as per RFC-1939, sect. 3 */\r\n    result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)POP3_EOB, 2);\r\n\r\n    k->keepon &= ~KEEP_RECV;\r\n    pop3c->eob = 0;\r\n\r\n    return result;\r\n  }\r\n\r\n  if(pop3c->eob)\r\n    /* While EOB is matching nothing should be output */\r\n    return CURLE_OK;\r\n\r\n  if(nread - last) {\r\n    result = Curl_client_write(conn, CLIENTWRITE_BODY, &str[last],\r\n                               nread - last);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n#endif /* CURL_DISABLE_POP3 */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/pop3.h",
    "content": "#ifndef HEADER_CURL_POP3_H\r\n#define HEADER_CURL_POP3_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2009 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/****************************************************************************\r\n * POP3 unique setup\r\n ***************************************************************************/\r\ntypedef enum {\r\n  POP3_STOP,         /* do nothing state, stops the state machine */\r\n  POP3_SERVERGREET,  /* waiting for the initial greeting immediately after\r\n                        a connect */\r\n  POP3_STARTTLS,\r\n  POP3_UPGRADETLS,   /* asynchronously upgrade the connection to SSL/TLS\r\n                       (multi mode only) */\r\n  POP3_CAPA,\r\n  POP3_AUTH_PLAIN,\r\n  POP3_AUTH_LOGIN,\r\n  POP3_AUTH_LOGIN_PASSWD,\r\n  POP3_AUTH_CRAMMD5,\r\n  POP3_AUTH_DIGESTMD5,\r\n  POP3_AUTH_DIGESTMD5_RESP,\r\n  POP3_AUTH_NTLM,\r\n  POP3_AUTH_NTLM_TYPE2MSG,\r\n  POP3_AUTH,\r\n  POP3_APOP,\r\n  POP3_USER,\r\n  POP3_PASS,\r\n  POP3_COMMAND,\r\n  POP3_QUIT,\r\n  POP3_LAST          /* never used */\r\n} pop3state;\r\n\r\n/* pop3_conn is used for struct connection-oriented data in the connectdata\r\n   struct */\r\nstruct pop3_conn {\r\n  struct pingpong pp;\r\n  char *mailbox;          /* Message ID */\r\n  char *custom;           /* Custom Request */\r\n  size_t eob;             /* Number of bytes of the EOB (End Of Body) that\r\n                             have been received so far */\r\n  size_t strip;           /* Number of bytes from the start to ignore as\r\n                             non-body */\r\n  unsigned int authtypes; /* Supported authentication types */\r\n  unsigned int authmechs; /* Accepted SASL authentication mechanisms */\r\n  unsigned int authused;  /* SASL auth mechanism used for the connection */\r\n  char *apoptimestamp;    /* APOP timestamp from the server greeting */\r\n  pop3state state;        /* Always use pop3.c:state() to change state! */\r\n  bool ssldone;           /* Is connect() over SSL done? */\r\n};\r\n\r\nextern const struct Curl_handler Curl_handler_pop3;\r\nextern const struct Curl_handler Curl_handler_pop3s;\r\n\r\n/* Authentication type flags */\r\n#define POP3_TYPE_CLEARTEXT 0x0001\r\n#define POP3_TYPE_APOP      0x0002\r\n#define POP3_TYPE_SASL      0x0004\r\n\r\n/* This is the 5-bytes End-Of-Body marker for POP3 */\r\n#define POP3_EOB \"\\x0d\\x0a\\x2e\\x0d\\x0a\"\r\n#define POP3_EOB_LEN 5\r\n\r\n/* This function scans the body after the end-of-body and writes everything\r\n * until the end is found */\r\nCURLcode Curl_pop3_write(struct connectdata *conn, char *str, size_t nread);\r\n\r\n#endif /* HEADER_CURL_POP3_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/progress.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"progress.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* Provide a string that is 2 + 1 + 2 + 1 + 2 = 8 letters long (plus the zero\r\n   byte) */\r\nstatic void time2str(char *r, curl_off_t seconds)\r\n{\r\n  curl_off_t d, h, m, s;\r\n  if(seconds <= 0) {\r\n    strcpy(r, \"--:--:--\");\r\n    return;\r\n  }\r\n  h = seconds / CURL_OFF_T_C(3600);\r\n  if(h <= CURL_OFF_T_C(99)) {\r\n    m = (seconds - (h*CURL_OFF_T_C(3600))) / CURL_OFF_T_C(60);\r\n    s = (seconds - (h*CURL_OFF_T_C(3600))) - (m*CURL_OFF_T_C(60));\r\n    snprintf(r, 9, \"%2\" FORMAT_OFF_T \":%02\" FORMAT_OFF_T \":%02\" FORMAT_OFF_T,\r\n             h, m, s);\r\n  }\r\n  else {\r\n    /* this equals to more than 99 hours, switch to a more suitable output\r\n       format to fit within the limits. */\r\n    d = seconds / CURL_OFF_T_C(86400);\r\n    h = (seconds - (d*CURL_OFF_T_C(86400))) / CURL_OFF_T_C(3600);\r\n    if(d <= CURL_OFF_T_C(999))\r\n      snprintf(r, 9, \"%3\" FORMAT_OFF_T \"d %02\" FORMAT_OFF_T \"h\", d, h);\r\n    else\r\n      snprintf(r, 9, \"%7\" FORMAT_OFF_T \"d\", d);\r\n  }\r\n}\r\n\r\n/* The point of this function would be to return a string of the input data,\r\n   but never longer than 5 columns (+ one zero byte).\r\n   Add suffix k, M, G when suitable... */\r\nstatic char *max5data(curl_off_t bytes, char *max5)\r\n{\r\n#define ONE_KILOBYTE  CURL_OFF_T_C(1024)\r\n#define ONE_MEGABYTE (CURL_OFF_T_C(1024) * ONE_KILOBYTE)\r\n#define ONE_GIGABYTE (CURL_OFF_T_C(1024) * ONE_MEGABYTE)\r\n#define ONE_TERABYTE (CURL_OFF_T_C(1024) * ONE_GIGABYTE)\r\n#define ONE_PETABYTE (CURL_OFF_T_C(1024) * ONE_TERABYTE)\r\n\r\n  if(bytes < CURL_OFF_T_C(100000))\r\n    snprintf(max5, 6, \"%5\" FORMAT_OFF_T, bytes);\r\n\r\n  else if(bytes < CURL_OFF_T_C(10000) * ONE_KILOBYTE)\r\n    snprintf(max5, 6, \"%4\" FORMAT_OFF_T \"k\", bytes/ONE_KILOBYTE);\r\n\r\n  else if(bytes < CURL_OFF_T_C(100) * ONE_MEGABYTE)\r\n    /* 'XX.XM' is good as long as we're less than 100 megs */\r\n    snprintf(max5, 6, \"%2\" FORMAT_OFF_T \".%0\" FORMAT_OFF_T \"M\",\r\n              bytes/ONE_MEGABYTE,\r\n             (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) );\r\n\r\n#if (CURL_SIZEOF_CURL_OFF_T > 4)\r\n\r\n  else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE)\r\n    /* 'XXXXM' is good until we're at 10000MB or above */\r\n    snprintf(max5, 6, \"%4\" FORMAT_OFF_T \"M\", bytes/ONE_MEGABYTE);\r\n\r\n  else if(bytes < CURL_OFF_T_C(100) * ONE_GIGABYTE)\r\n    /* 10000 MB - 100 GB, we show it as XX.XG */\r\n    snprintf(max5, 6, \"%2\" FORMAT_OFF_T \".%0\" FORMAT_OFF_T \"G\",\r\n              bytes/ONE_GIGABYTE,\r\n             (bytes%ONE_GIGABYTE) / (ONE_GIGABYTE/CURL_OFF_T_C(10)) );\r\n\r\n  else if(bytes < CURL_OFF_T_C(10000) * ONE_GIGABYTE)\r\n    /* up to 10000GB, display without decimal: XXXXG */\r\n    snprintf(max5, 6, \"%4\" FORMAT_OFF_T \"G\", bytes/ONE_GIGABYTE);\r\n\r\n  else if(bytes < CURL_OFF_T_C(10000) * ONE_TERABYTE)\r\n    /* up to 10000TB, display without decimal: XXXXT */\r\n    snprintf(max5, 6, \"%4\" FORMAT_OFF_T \"T\", bytes/ONE_TERABYTE);\r\n\r\n  else\r\n    /* up to 10000PB, display without decimal: XXXXP */\r\n    snprintf(max5, 6, \"%4\" FORMAT_OFF_T \"P\", bytes/ONE_PETABYTE);\r\n\r\n    /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number\r\n       can hold, but our data type is signed so 8192PB will be the maximum. */\r\n\r\n#else\r\n\r\n  else\r\n    snprintf(max5, 6, \"%4\" FORMAT_OFF_T \"M\", bytes/ONE_MEGABYTE);\r\n\r\n#endif\r\n\r\n  return max5;\r\n}\r\n\r\n/*\r\n\r\n   New proposed interface, 9th of February 2000:\r\n\r\n   pgrsStartNow() - sets start time\r\n   pgrsSetDownloadSize(x) - known expected download size\r\n   pgrsSetUploadSize(x) - known expected upload size\r\n   pgrsSetDownloadCounter() - amount of data currently downloaded\r\n   pgrsSetUploadCounter() - amount of data currently uploaded\r\n   pgrsUpdate() - show progress\r\n   pgrsDone() - transfer complete\r\n\r\n*/\r\n\r\nint Curl_pgrsDone(struct connectdata *conn)\r\n{\r\n  int rc;\r\n  struct SessionHandle *data = conn->data;\r\n  data->progress.lastshow=0;\r\n  rc = Curl_pgrsUpdate(conn); /* the final (forced) update */\r\n  if(rc)\r\n    return rc;\r\n\r\n  if(!(data->progress.flags & PGRS_HIDE) &&\r\n     !data->progress.callback)\r\n    /* only output if we don't use a progress callback and we're not\r\n     * hidden */\r\n    fprintf(data->set.err, \"\\n\");\r\n\r\n  data->progress.speeder_c = 0; /* reset the progress meter display */\r\n  return 0;\r\n}\r\n\r\n/* reset all times except redirect, and reset the known transfer sizes */\r\nvoid Curl_pgrsResetTimesSizes(struct SessionHandle *data)\r\n{\r\n  data->progress.t_nslookup = 0.0;\r\n  data->progress.t_connect = 0.0;\r\n  data->progress.t_pretransfer = 0.0;\r\n  data->progress.t_starttransfer = 0.0;\r\n\r\n  Curl_pgrsSetDownloadSize(data, 0);\r\n  Curl_pgrsSetUploadSize(data, 0);\r\n}\r\n\r\nvoid Curl_pgrsTime(struct SessionHandle *data, timerid timer)\r\n{\r\n  struct timeval now = Curl_tvnow();\r\n\r\n  switch(timer) {\r\n  default:\r\n  case TIMER_NONE:\r\n    /* mistake filter */\r\n    break;\r\n  case TIMER_STARTSINGLE:\r\n    /* This is set at the start of a single fetch */\r\n    data->progress.t_startsingle = now;\r\n    break;\r\n\r\n  case TIMER_STARTACCEPT:\r\n    data->progress.t_acceptdata = Curl_tvnow();\r\n    break;\r\n\r\n  case TIMER_NAMELOOKUP:\r\n    data->progress.t_nslookup =\r\n      Curl_tvdiff_secs(now, data->progress.t_startsingle);\r\n    break;\r\n  case TIMER_CONNECT:\r\n    data->progress.t_connect =\r\n      Curl_tvdiff_secs(now, data->progress.t_startsingle);\r\n    break;\r\n  case TIMER_APPCONNECT:\r\n    data->progress.t_appconnect =\r\n      Curl_tvdiff_secs(now, data->progress.t_startsingle);\r\n    break;\r\n  case TIMER_PRETRANSFER:\r\n    data->progress.t_pretransfer =\r\n      Curl_tvdiff_secs(now, data->progress.t_startsingle);\r\n    break;\r\n  case TIMER_STARTTRANSFER:\r\n    data->progress.t_starttransfer =\r\n      Curl_tvdiff_secs(now, data->progress.t_startsingle);\r\n    break;\r\n  case TIMER_POSTRANSFER:\r\n    /* this is the normal end-of-transfer thing */\r\n    break;\r\n  case TIMER_REDIRECT:\r\n    data->progress.t_redirect = Curl_tvdiff_secs(now, data->progress.start);\r\n    break;\r\n  }\r\n}\r\n\r\nvoid Curl_pgrsStartNow(struct SessionHandle *data)\r\n{\r\n  data->progress.speeder_c = 0; /* reset the progress meter display */\r\n  data->progress.start = Curl_tvnow();\r\n  /* clear all bits except HIDE and HEADERS_OUT */\r\n  data->progress.flags &= PGRS_HIDE|PGRS_HEADERS_OUT;\r\n}\r\n\r\nvoid Curl_pgrsSetDownloadCounter(struct SessionHandle *data, curl_off_t size)\r\n{\r\n  data->progress.downloaded = size;\r\n}\r\n\r\nvoid Curl_pgrsSetUploadCounter(struct SessionHandle *data, curl_off_t size)\r\n{\r\n  data->progress.uploaded = size;\r\n}\r\n\r\nvoid Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size)\r\n{\r\n  data->progress.size_dl = size;\r\n  if(size >= 0)\r\n    data->progress.flags |= PGRS_DL_SIZE_KNOWN;\r\n  else\r\n    data->progress.flags &= ~PGRS_DL_SIZE_KNOWN;\r\n}\r\n\r\nvoid Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size)\r\n{\r\n  data->progress.size_ul = size;\r\n  if(size >= 0)\r\n    data->progress.flags |= PGRS_UL_SIZE_KNOWN;\r\n  else\r\n    data->progress.flags &= ~PGRS_UL_SIZE_KNOWN;\r\n}\r\n\r\n/*\r\n * Curl_pgrsUpdate() returns 0 for success or the value returned by the\r\n * progress callback!\r\n */\r\nint Curl_pgrsUpdate(struct connectdata *conn)\r\n{\r\n  struct timeval now;\r\n  int result;\r\n  char max5[6][10];\r\n  curl_off_t dlpercen=0;\r\n  curl_off_t ulpercen=0;\r\n  curl_off_t total_percen=0;\r\n  curl_off_t total_transfer;\r\n  curl_off_t total_expected_transfer;\r\n  curl_off_t timespent;\r\n  struct SessionHandle *data = conn->data;\r\n  int nowindex = data->progress.speeder_c% CURR_TIME;\r\n  int checkindex;\r\n  int countindex; /* amount of seconds stored in the speeder array */\r\n  char time_left[10];\r\n  char time_total[10];\r\n  char time_spent[10];\r\n  curl_off_t ulestimate=0;\r\n  curl_off_t dlestimate=0;\r\n  curl_off_t total_estimate;\r\n  bool shownow=FALSE;\r\n\r\n  now = Curl_tvnow(); /* what time is it */\r\n\r\n  /* The time spent so far (from the start) */\r\n  data->progress.timespent =\r\n    (double)(now.tv_sec - data->progress.start.tv_sec) +\r\n    (double)(now.tv_usec - data->progress.start.tv_usec)/1000000.0;\r\n  timespent = (curl_off_t)data->progress.timespent;\r\n\r\n  /* The average download speed this far */\r\n  data->progress.dlspeed = (curl_off_t)\r\n    ((double)data->progress.downloaded/\r\n     (data->progress.timespent>0?data->progress.timespent:1));\r\n\r\n  /* The average upload speed this far */\r\n  data->progress.ulspeed = (curl_off_t)\r\n    ((double)data->progress.uploaded/\r\n     (data->progress.timespent>0?data->progress.timespent:1));\r\n\r\n  /* Calculations done at most once a second, unless end is reached */\r\n  if(data->progress.lastshow != (long)now.tv_sec) {\r\n    shownow = TRUE;\r\n\r\n    data->progress.lastshow = now.tv_sec;\r\n\r\n    /* Let's do the \"current speed\" thing, which should use the fastest\r\n       of the dl/ul speeds. Store the faster speed at entry 'nowindex'. */\r\n    data->progress.speeder[ nowindex ] =\r\n      data->progress.downloaded>data->progress.uploaded?\r\n      data->progress.downloaded:data->progress.uploaded;\r\n\r\n    /* remember the exact time for this moment */\r\n    data->progress.speeder_time [ nowindex ] = now;\r\n\r\n    /* advance our speeder_c counter, which is increased every time we get\r\n       here and we expect it to never wrap as 2^32 is a lot of seconds! */\r\n    data->progress.speeder_c++;\r\n\r\n    /* figure out how many index entries of data we have stored in our speeder\r\n       array. With N_ENTRIES filled in, we have about N_ENTRIES-1 seconds of\r\n       transfer. Imagine, after one second we have filled in two entries,\r\n       after two seconds we've filled in three entries etc. */\r\n    countindex = ((data->progress.speeder_c>=CURR_TIME)?\r\n                  CURR_TIME:data->progress.speeder_c) - 1;\r\n\r\n    /* first of all, we don't do this if there's no counted seconds yet */\r\n    if(countindex) {\r\n      long span_ms;\r\n\r\n      /* Get the index position to compare with the 'nowindex' position.\r\n         Get the oldest entry possible. While we have less than CURR_TIME\r\n         entries, the first entry will remain the oldest. */\r\n      checkindex = (data->progress.speeder_c>=CURR_TIME)?\r\n        data->progress.speeder_c%CURR_TIME:0;\r\n\r\n      /* Figure out the exact time for the time span */\r\n      span_ms = Curl_tvdiff(now,\r\n                            data->progress.speeder_time[checkindex]);\r\n      if(0 == span_ms)\r\n        span_ms=1; /* at least one millisecond MUST have passed */\r\n\r\n      /* Calculate the average speed the last 'span_ms' milliseconds */\r\n      {\r\n        curl_off_t amount = data->progress.speeder[nowindex]-\r\n          data->progress.speeder[checkindex];\r\n\r\n        if(amount > CURL_OFF_T_C(4294967) /* 0xffffffff/1000 */)\r\n          /* the 'amount' value is bigger than would fit in 32 bits if\r\n             multiplied with 1000, so we use the double math for this */\r\n          data->progress.current_speed = (curl_off_t)\r\n            ((double)amount/((double)span_ms/1000.0));\r\n        else\r\n          /* the 'amount' value is small enough to fit within 32 bits even\r\n             when multiplied with 1000 */\r\n          data->progress.current_speed = amount*CURL_OFF_T_C(1000)/span_ms;\r\n      }\r\n    }\r\n    else\r\n      /* the first second we use the main average */\r\n      data->progress.current_speed =\r\n        (data->progress.ulspeed>data->progress.dlspeed)?\r\n        data->progress.ulspeed:data->progress.dlspeed;\r\n\r\n  } /* Calculations end */\r\n\r\n  if(!(data->progress.flags & PGRS_HIDE)) {\r\n\r\n    /* progress meter has not been shut off */\r\n\r\n    if(data->set.fprogress) {\r\n      /* There's a callback set, so we call that instead of writing\r\n         anything ourselves. This really is the way to go. */\r\n      result= data->set.fprogress(data->set.progress_client,\r\n                                  (double)data->progress.size_dl,\r\n                                  (double)data->progress.downloaded,\r\n                                  (double)data->progress.size_ul,\r\n                                  (double)data->progress.uploaded);\r\n      if(result)\r\n        failf(data, \"Callback aborted\");\r\n      return result;\r\n    }\r\n\r\n    if(!shownow)\r\n      /* only show the internal progress meter once per second */\r\n      return 0;\r\n\r\n    /* If there's no external callback set, use internal code to show\r\n       progress */\r\n\r\n    if(!(data->progress.flags & PGRS_HEADERS_OUT)) {\r\n      if(data->state.resume_from) {\r\n        fprintf(data->set.err,\r\n                \"** Resuming transfer from byte position %\" FORMAT_OFF_T \"\\n\",\r\n                data->state.resume_from);\r\n      }\r\n      fprintf(data->set.err,\r\n              \"  %% Total    %% Received %% Xferd  Average Speed   \"\r\n              \"Time    Time     Time  Current\\n\"\r\n              \"                                 Dload  Upload   \"\r\n              \"Total   Spent    Left  Speed\\n\");\r\n      data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */\r\n    }\r\n\r\n    /* Figure out the estimated time of arrival for the upload */\r\n    if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&\r\n       (data->progress.ulspeed > CURL_OFF_T_C(0))) {\r\n      ulestimate = data->progress.size_ul / data->progress.ulspeed;\r\n\r\n      if(data->progress.size_ul > CURL_OFF_T_C(10000))\r\n        ulpercen = data->progress.uploaded /\r\n          (data->progress.size_ul/CURL_OFF_T_C(100));\r\n      else if(data->progress.size_ul > CURL_OFF_T_C(0))\r\n        ulpercen = (data->progress.uploaded*100) /\r\n          data->progress.size_ul;\r\n    }\r\n\r\n    /* ... and the download */\r\n    if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&\r\n       (data->progress.dlspeed > CURL_OFF_T_C(0))) {\r\n      dlestimate = data->progress.size_dl / data->progress.dlspeed;\r\n\r\n      if(data->progress.size_dl > CURL_OFF_T_C(10000))\r\n        dlpercen = data->progress.downloaded /\r\n          (data->progress.size_dl/CURL_OFF_T_C(100));\r\n      else if(data->progress.size_dl > CURL_OFF_T_C(0))\r\n        dlpercen = (data->progress.downloaded*100) /\r\n          data->progress.size_dl;\r\n    }\r\n\r\n    /* Now figure out which of them is slower and use that one for the\r\n       total estimate! */\r\n    total_estimate = ulestimate>dlestimate?ulestimate:dlestimate;\r\n\r\n    /* create the three time strings */\r\n    time2str(time_left, total_estimate > 0?(total_estimate - timespent):0);\r\n    time2str(time_total, total_estimate);\r\n    time2str(time_spent, timespent);\r\n\r\n    /* Get the total amount of data expected to get transferred */\r\n    total_expected_transfer =\r\n      (data->progress.flags & PGRS_UL_SIZE_KNOWN?\r\n       data->progress.size_ul:data->progress.uploaded)+\r\n      (data->progress.flags & PGRS_DL_SIZE_KNOWN?\r\n       data->progress.size_dl:data->progress.downloaded);\r\n\r\n    /* We have transferred this much so far */\r\n    total_transfer = data->progress.downloaded + data->progress.uploaded;\r\n\r\n    /* Get the percentage of data transferred so far */\r\n    if(total_expected_transfer > CURL_OFF_T_C(10000))\r\n      total_percen = total_transfer /\r\n        (total_expected_transfer/CURL_OFF_T_C(100));\r\n    else if(total_expected_transfer > CURL_OFF_T_C(0))\r\n      total_percen = (total_transfer*100) / total_expected_transfer;\r\n\r\n    fprintf(data->set.err,\r\n            \"\\r\"\r\n            \"%3\" FORMAT_OFF_T \" %s  \"\r\n            \"%3\" FORMAT_OFF_T \" %s  \"\r\n            \"%3\" FORMAT_OFF_T \" %s  %s  %s %s %s %s %s\",\r\n            total_percen,  /* 3 letters */                /* total % */\r\n            max5data(total_expected_transfer, max5[2]),   /* total size */\r\n            dlpercen,      /* 3 letters */                /* rcvd % */\r\n            max5data(data->progress.downloaded, max5[0]), /* rcvd size */\r\n            ulpercen,      /* 3 letters */                /* xfer % */\r\n            max5data(data->progress.uploaded, max5[1]),   /* xfer size */\r\n            max5data(data->progress.dlspeed, max5[3]),    /* avrg dl speed */\r\n            max5data(data->progress.ulspeed, max5[4]),    /* avrg ul speed */\r\n            time_total,    /* 8 letters */                /* total time */\r\n            time_spent,    /* 8 letters */                /* time spent */\r\n            time_left,     /* 8 letters */                /* time left */\r\n            max5data(data->progress.current_speed, max5[5]) /* current speed */\r\n            );\r\n\r\n    /* we flush the output stream to make it appear as soon as possible */\r\n    fflush(data->set.err);\r\n\r\n  } /* !(data->progress.flags & PGRS_HIDE) */\r\n\r\n  return 0;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/progress.h",
    "content": "#ifndef HEADER_CURL_PROGRESS_H\r\n#define HEADER_CURL_PROGRESS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"timeval.h\"\r\n\r\n\r\ntypedef enum {\r\n  TIMER_NONE,\r\n  TIMER_NAMELOOKUP,\r\n  TIMER_CONNECT,\r\n  TIMER_APPCONNECT,\r\n  TIMER_PRETRANSFER,\r\n  TIMER_STARTTRANSFER,\r\n  TIMER_POSTRANSFER,\r\n  TIMER_STARTSINGLE,\r\n  TIMER_STARTACCEPT,\r\n  TIMER_REDIRECT,\r\n  TIMER_LAST /* must be last */\r\n} timerid;\r\n\r\nint Curl_pgrsDone(struct connectdata *);\r\nvoid Curl_pgrsStartNow(struct SessionHandle *data);\r\nvoid Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size);\r\nvoid Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size);\r\nvoid Curl_pgrsSetDownloadCounter(struct SessionHandle *data, curl_off_t size);\r\nvoid Curl_pgrsSetUploadCounter(struct SessionHandle *data, curl_off_t size);\r\nint Curl_pgrsUpdate(struct connectdata *);\r\nvoid Curl_pgrsResetTimesSizes(struct SessionHandle *data);\r\nvoid Curl_pgrsTime(struct SessionHandle *data, timerid timer);\r\n\r\n\r\n/* Don't show progress for sizes smaller than: */\r\n#define LEAST_SIZE_PROGRESS BUFSIZE\r\n\r\n#define PROGRESS_DOWNLOAD (1<<0)\r\n#define PROGRESS_UPLOAD   (1<<1)\r\n#define PROGRESS_DOWN_AND_UP (PROGRESS_UPLOAD | PROGRESS_DOWNLOAD)\r\n\r\n#define PGRS_SHOW_DL (1<<0)\r\n#define PGRS_SHOW_UL (1<<1)\r\n#define PGRS_DONE_DL (1<<2)\r\n#define PGRS_DONE_UL (1<<3)\r\n#define PGRS_HIDE    (1<<4)\r\n#define PGRS_UL_SIZE_KNOWN (1<<5)\r\n#define PGRS_DL_SIZE_KNOWN (1<<6)\r\n\r\n#define PGRS_HEADERS_OUT (1<<7) /* set when the headers have been written */\r\n\r\n\r\n#endif /* HEADER_CURL_PROGRESS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/qssl.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_QSOSSL\r\n\r\n#include <qsossl.h>\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#  include <limits.h>\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"qssl.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\" /* for the connect timeout */\r\n#include \"select.h\"\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n\r\nint Curl_qsossl_init(void)\r\n\r\n{\r\n  /* Nothing to do here. We must have connection data to initialize ssl, so\r\n   * defer.\r\n   */\r\n\r\n  return 1;\r\n}\r\n\r\n\r\nvoid Curl_qsossl_cleanup(void)\r\n\r\n{\r\n  /* Nothing to do. */\r\n}\r\n\r\n\r\nstatic CURLcode Curl_qsossl_init_session(struct SessionHandle * data)\r\n\r\n{\r\n  int rc;\r\n  char * certname;\r\n  SSLInit initstr;\r\n  SSLInitApp initappstr;\r\n\r\n  /* Initialize the job for SSL according to the current parameters.\r\n   * QsoSSL offers two ways to do it: SSL_Init_Application() that uses an\r\n   *  application identifier to select certificates in the main certificate\r\n   *  store, and SSL_Init() that uses named keyring files and a password.\r\n   * It is not possible to have different keyrings for the CAs and the\r\n   *  local certificate. We thus use the certificate name to identify the\r\n   *  keyring if given, else the CA file name.\r\n   * If the key file name is given, it is taken as the password for the\r\n   *  keyring in certificate file.\r\n   * We first try to SSL_Init_Application(), then SSL_Init() if it failed.\r\n   */\r\n\r\n  certname = data->set.str[STRING_CERT];\r\n\r\n  if(!certname) {\r\n    certname = data->set.str[STRING_SSL_CAFILE];\r\n\r\n    if(!certname)\r\n      return CURLE_OK;          /* Use previous setup. */\r\n    }\r\n\r\n  memset((char *) &initappstr, 0, sizeof initappstr);\r\n  initappstr.applicationID = certname;\r\n  initappstr.applicationIDLen = strlen(certname);\r\n  initappstr.protocol = SSL_VERSION_CURRENT;    /* TLSV1 compat. SSLV[23]. */\r\n  initappstr.sessionType = SSL_REGISTERED_AS_CLIENT;\r\n  rc = SSL_Init_Application(&initappstr);\r\n\r\n  if(rc == SSL_ERROR_NOT_REGISTERED) {\r\n    initstr.keyringFileName = certname;\r\n    initstr.keyringPassword = data->set.str[STRING_KEY];\r\n    initstr.cipherSuiteList = NULL;    /* Use default. */\r\n    initstr.cipherSuiteListLen = 0;\r\n    rc = SSL_Init(&initstr);\r\n    }\r\n\r\n  switch (rc) {\r\n\r\n  case 0:                             /* No error. */\r\n    break;\r\n\r\n  case SSL_ERROR_IO:\r\n    failf(data, \"SSL_Init() I/O error: %s\", strerror(errno));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n\r\n  case SSL_ERROR_BAD_CIPHER_SUITE:\r\n    return CURLE_SSL_CIPHER;\r\n\r\n  case SSL_ERROR_KEYPASSWORD_EXPIRED:\r\n  case SSL_ERROR_NOT_REGISTERED:\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n\r\n  case SSL_ERROR_NO_KEYRING:\r\n    return CURLE_SSL_CACERT;\r\n\r\n  case SSL_ERROR_CERT_EXPIRED:\r\n    return CURLE_SSL_CERTPROBLEM;\r\n\r\n  default:\r\n    failf(data, \"SSL_Init(): %s\", SSL_Strerror(rc, NULL));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nstatic CURLcode Curl_qsossl_create(struct connectdata * conn, int sockindex)\r\n\r\n{\r\n  SSLHandle * h;\r\n  struct ssl_connect_data * connssl = &conn->ssl[sockindex];\r\n\r\n  h = SSL_Create(conn->sock[sockindex], SSL_ENCRYPT);\r\n\r\n  if(!h) {\r\n    failf(conn->data, \"SSL_Create() I/O error: %s\", strerror(errno));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  connssl->handle = h;\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nstatic int Curl_qsossl_trap_cert(SSLHandle * h)\r\n\r\n{\r\n  return 1;       /* Accept certificate. */\r\n}\r\n\r\n\r\nstatic CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex)\r\n\r\n{\r\n  int rc;\r\n  struct SessionHandle * data = conn->data;\r\n  struct ssl_connect_data * connssl = &conn->ssl[sockindex];\r\n  SSLHandle * h = connssl->handle;\r\n  long timeout_ms;\r\n\r\n  h->exitPgm = NULL;\r\n\r\n  if(!data->set.ssl.verifyhost)\r\n    h->exitPgm = Curl_qsossl_trap_cert;\r\n\r\n  /* figure out how long time we should wait at maximum */\r\n  timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n  if(timeout_ms < 0) {\r\n    /* time-out, bail out, go home */\r\n    failf(data, \"Connection time-out\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  /* SSL_Handshake() timeout resolution is second, so round up. */\r\n  h->timeout = (timeout_ms + 1000 - 1) / 1000;\r\n\r\n  /* Set-up protocol. */\r\n\r\n  switch (data->set.ssl.version) {\r\n\r\n  default:\r\n  case CURL_SSLVERSION_DEFAULT:\r\n    h->protocol = SSL_VERSION_CURRENT;          /* TLSV1 compat. SSLV[23]. */\r\n    break;\r\n\r\n  case CURL_SSLVERSION_TLSv1:\r\n    h->protocol = TLS_VERSION_1;\r\n    break;\r\n\r\n  case CURL_SSLVERSION_SSLv2:\r\n    h->protocol = SSL_VERSION_2;\r\n    break;\r\n\r\n  case CURL_SSLVERSION_SSLv3:\r\n    h->protocol = SSL_VERSION_3;\r\n    break;\r\n  }\r\n\r\n  rc = SSL_Handshake(h, SSL_HANDSHAKE_AS_CLIENT);\r\n\r\n  switch (rc) {\r\n\r\n  case 0:                             /* No error. */\r\n    break;\r\n\r\n  case SSL_ERROR_BAD_CERTIFICATE:\r\n  case SSL_ERROR_BAD_CERT_SIG:\r\n  case SSL_ERROR_NOT_TRUSTED_ROOT:\r\n    return CURLE_PEER_FAILED_VERIFICATION;\r\n\r\n  case SSL_ERROR_BAD_CIPHER_SUITE:\r\n  case SSL_ERROR_NO_CIPHERS:\r\n    return CURLE_SSL_CIPHER;\r\n\r\n  case SSL_ERROR_CERTIFICATE_REJECTED:\r\n  case SSL_ERROR_CERT_EXPIRED:\r\n  case SSL_ERROR_NO_CERTIFICATE:\r\n    return CURLE_SSL_CERTPROBLEM;\r\n\r\n  case SSL_ERROR_IO:\r\n    failf(data, \"SSL_Handshake() I/O error: %s\", strerror(errno));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n\r\n  default:\r\n    failf(data, \"SSL_Handshake(): %s\", SSL_Strerror(rc, NULL));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nstatic Curl_recv qsossl_recv;\r\nstatic Curl_send qsossl_send;\r\n\r\nCURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex)\r\n\r\n{\r\n  struct SessionHandle * data = conn->data;\r\n  struct ssl_connect_data * connssl = &conn->ssl[sockindex];\r\n  int rc;\r\n\r\n  rc = Curl_qsossl_init_session(data);\r\n\r\n  if(rc == CURLE_OK) {\r\n    rc = Curl_qsossl_create(conn, sockindex);\r\n\r\n    if(rc == CURLE_OK)\r\n      rc = Curl_qsossl_handshake(conn, sockindex);\r\n    else {\r\n      SSL_Destroy(connssl->handle);\r\n      connssl->handle = NULL;\r\n      connssl->use = FALSE;\r\n      connssl->state = ssl_connection_none;\r\n    }\r\n  }\r\n  if(rc == CURLE_OK) {\r\n    connssl->state = ssl_connection_complete;\r\n    conn->recv[sockindex] = qsossl_recv;\r\n    conn->send[sockindex] = qsossl_send;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n\r\nstatic int Curl_qsossl_close_one(struct ssl_connect_data * conn,\r\n                                 struct SessionHandle * data)\r\n\r\n{\r\n  int rc;\r\n\r\n  if(!conn->handle)\r\n    return 0;\r\n\r\n  rc = SSL_Destroy(conn->handle);\r\n\r\n  if(rc) {\r\n    if(rc == SSL_ERROR_IO) {\r\n      failf(data, \"SSL_Destroy() I/O error: %s\", strerror(errno));\r\n      return -1;\r\n    }\r\n\r\n    /* An SSL error. */\r\n    failf(data, \"SSL_Destroy() returned error %s\", SSL_Strerror(rc, NULL));\r\n    return -1;\r\n  }\r\n\r\n  conn->handle = NULL;\r\n  return 0;\r\n}\r\n\r\n\r\nvoid Curl_qsossl_close(struct connectdata *conn, int sockindex)\r\n\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  if(connssl->use)\r\n    (void) Curl_qsossl_close_one(connssl, data);\r\n}\r\n\r\n\r\nint Curl_qsossl_close_all(struct SessionHandle * data)\r\n\r\n{\r\n  /* Unimplemented. */\r\n  (void) data;\r\n  return 0;\r\n}\r\n\r\n\r\nint Curl_qsossl_shutdown(struct connectdata * conn, int sockindex)\r\n\r\n{\r\n  struct ssl_connect_data * connssl = &conn->ssl[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n  ssize_t nread;\r\n  int what;\r\n  int rc;\r\n  char buf[120];\r\n\r\n  if(!connssl->handle)\r\n    return 0;\r\n\r\n  if(data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE)\r\n    return 0;\r\n\r\n  if(Curl_qsossl_close_one(connssl, data))\r\n    return -1;\r\n\r\n  rc = 0;\r\n\r\n  what = Curl_socket_ready(conn->sock[sockindex],\r\n                           CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);\r\n\r\n  for(;;) {\r\n    if(what < 0) {\r\n      /* anything that gets here is fatally bad */\r\n      failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n      rc = -1;\r\n      break;\r\n    }\r\n\r\n    if(!what) {                                /* timeout */\r\n      failf(data, \"SSL shutdown timeout\");\r\n      break;\r\n    }\r\n\r\n    /* Something to read, let's do it and hope that it is the close\r\n       notify alert from the server. No way to SSL_Read now, so use read(). */\r\n\r\n    nread = read(conn->sock[sockindex], buf, sizeof(buf));\r\n\r\n    if(nread < 0) {\r\n      failf(data, \"read: %s\", strerror(errno));\r\n      rc = -1;\r\n    }\r\n\r\n    if(nread <= 0)\r\n      break;\r\n\r\n    what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, 0);\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n\r\nstatic ssize_t qsossl_send(struct connectdata * conn, int sockindex,\r\n                           const void * mem, size_t len, CURLcode * curlcode)\r\n\r\n{\r\n  /* SSL_Write() is said to return 'int' while write() and send() returns\r\n     'size_t' */\r\n  int rc;\r\n\r\n  rc = SSL_Write(conn->ssl[sockindex].handle, (void *) mem, (int) len);\r\n\r\n  if(rc < 0) {\r\n    switch(rc) {\r\n\r\n    case SSL_ERROR_BAD_STATE:\r\n      /* The operation did not complete; the same SSL I/O function\r\n         should be called again later. This is basically an EWOULDBLOCK\r\n         equivalent. */\r\n      *curlcode = CURLE_AGAIN;\r\n      return -1;\r\n\r\n    case SSL_ERROR_IO:\r\n      switch (errno) {\r\n      case EWOULDBLOCK:\r\n      case EINTR:\r\n        *curlcode = CURLE_AGAIN;\r\n        return -1;\r\n        }\r\n\r\n      failf(conn->data, \"SSL_Write() I/O error: %s\", strerror(errno));\r\n      *curlcode = CURLE_SEND_ERROR;\r\n      return -1;\r\n    }\r\n\r\n    /* An SSL error. */\r\n    failf(conn->data, \"SSL_Write() returned error %s\",\r\n          SSL_Strerror(rc, NULL));\r\n    *curlcode = CURLE_SEND_ERROR;\r\n    return -1;\r\n  }\r\n\r\n  return (ssize_t) rc; /* number of bytes */\r\n}\r\n\r\n\r\nstatic ssize_t qsossl_recv(struct connectdata * conn, int num, char * buf,\r\n                           size_t buffersize, CURLcode * curlcode)\r\n\r\n{\r\n  char error_buffer[120]; /* OpenSSL documents that this must be at\r\n                             least 120 bytes long. */\r\n  unsigned long sslerror;\r\n  int buffsize;\r\n  int nread;\r\n\r\n  buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;\r\n  nread = SSL_Read(conn->ssl[num].handle, buf, buffsize);\r\n\r\n  if(nread < 0) {\r\n    /* failed SSL_read */\r\n\r\n    switch (nread) {\r\n\r\n    case SSL_ERROR_BAD_STATE:\r\n      /* there's data pending, re-invoke SSL_Read(). */\r\n      *curlcode = CURLE_AGAIN;\r\n      return -1;\r\n\r\n    case SSL_ERROR_IO:\r\n      switch (errno) {\r\n      case EWOULDBLOCK:\r\n        *curlcode = CURLE_AGAIN;\r\n        return -1;\r\n        }\r\n\r\n      failf(conn->data, \"SSL_Read() I/O error: %s\", strerror(errno));\r\n      *curlcode = CURLE_RECV_ERROR;\r\n      return -1;\r\n\r\n    default:\r\n      failf(conn->data, \"SSL read error: %s\", SSL_Strerror(nread, NULL));\r\n      *curlcode = CURLE_RECV_ERROR;\r\n      return -1;\r\n    }\r\n  }\r\n  return (ssize_t) nread;\r\n}\r\n\r\n\r\nsize_t Curl_qsossl_version(char * buffer, size_t size)\r\n\r\n{\r\n  strncpy(buffer, \"IBM OS/400 SSL\", size);\r\n  return strlen(buffer);\r\n}\r\n\r\n\r\nint Curl_qsossl_check_cxn(struct connectdata * cxn)\r\n\r\n{\r\n  int err;\r\n  int errlen;\r\n\r\n  /* The only thing that can be tested here is at the socket level. */\r\n\r\n  if(!cxn->ssl[FIRSTSOCKET].handle)\r\n    return 0; /* connection has been closed */\r\n\r\n  err = 0;\r\n  errlen = sizeof err;\r\n\r\n  if(getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR,\r\n                 (unsigned char *) &err, &errlen) ||\r\n      errlen != sizeof err || err)\r\n    return 0; /* connection has been closed */\r\n\r\n  return -1;  /* connection status unknown */\r\n}\r\n\r\n#endif /* USE_QSOSSL */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/qssl.h",
    "content": "#ifndef HEADER_CURL_QSSL_H\r\n#define HEADER_CURL_QSSL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n/*\r\n * This header should only be needed to get included by sslgen.c and qssl.c\r\n */\r\n\r\n#include \"urldata.h\"\r\n\r\n#ifdef USE_QSOSSL\r\nint Curl_qsossl_init(void);\r\nvoid Curl_qsossl_cleanup(void);\r\nCURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex);\r\nvoid Curl_qsossl_close(struct connectdata *conn, int sockindex);\r\nint Curl_qsossl_close_all(struct SessionHandle * data);\r\nint Curl_qsossl_shutdown(struct connectdata * conn, int sockindex);\r\n\r\nsize_t Curl_qsossl_version(char * buffer, size_t size);\r\nint Curl_qsossl_check_cxn(struct connectdata * cxn);\r\n\r\n/* API setup for QsoSSL */\r\n#define curlssl_init Curl_qsossl_init\r\n#define curlssl_cleanup Curl_qsossl_cleanup\r\n#define curlssl_connect Curl_qsossl_connect\r\n\r\n/*  No session handling for QsoSSL */\r\n#define curlssl_session_free(x) Curl_nop_stmt\r\n#define curlssl_close_all Curl_qsossl_close_all\r\n#define curlssl_close Curl_qsossl_close\r\n#define curlssl_shutdown(x,y) Curl_qsossl_shutdown(x,y)\r\n#define curlssl_set_engine(x,y) CURLE_NOT_BUILT_IN\r\n#define curlssl_set_engine_default(x) CURLE_NOT_BUILT_IN\r\n#define curlssl_engines_list(x) NULL\r\n#define curlssl_version Curl_qsossl_version\r\n#define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x)\r\n#define curlssl_data_pending(x,y) 0\r\n#endif /* USE_QSOSSL */\r\n\r\n#endif /* HEADER_CURL_QSSL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/rawstr.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because\r\n   its behavior is altered by the current locale. */\r\nchar Curl_raw_toupper(char in)\r\n{\r\n  switch (in) {\r\n  case 'a':\r\n    return 'A';\r\n  case 'b':\r\n    return 'B';\r\n  case 'c':\r\n    return 'C';\r\n  case 'd':\r\n    return 'D';\r\n  case 'e':\r\n    return 'E';\r\n  case 'f':\r\n    return 'F';\r\n  case 'g':\r\n    return 'G';\r\n  case 'h':\r\n    return 'H';\r\n  case 'i':\r\n    return 'I';\r\n  case 'j':\r\n    return 'J';\r\n  case 'k':\r\n    return 'K';\r\n  case 'l':\r\n    return 'L';\r\n  case 'm':\r\n    return 'M';\r\n  case 'n':\r\n    return 'N';\r\n  case 'o':\r\n    return 'O';\r\n  case 'p':\r\n    return 'P';\r\n  case 'q':\r\n    return 'Q';\r\n  case 'r':\r\n    return 'R';\r\n  case 's':\r\n    return 'S';\r\n  case 't':\r\n    return 'T';\r\n  case 'u':\r\n    return 'U';\r\n  case 'v':\r\n    return 'V';\r\n  case 'w':\r\n    return 'W';\r\n  case 'x':\r\n    return 'X';\r\n  case 'y':\r\n    return 'Y';\r\n  case 'z':\r\n    return 'Z';\r\n  }\r\n  return in;\r\n}\r\n\r\n/*\r\n * Curl_raw_equal() is for doing \"raw\" case insensitive strings. This is meant\r\n * to be locale independent and only compare strings we know are safe for\r\n * this.  See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for\r\n * some further explanation to why this function is necessary.\r\n *\r\n * The function is capable of comparing a-z case insensitively even for\r\n * non-ascii.\r\n */\r\n\r\nint Curl_raw_equal(const char *first, const char *second)\r\n{\r\n  while(*first && *second) {\r\n    if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))\r\n      /* get out of the loop as soon as they don't match */\r\n      break;\r\n    first++;\r\n    second++;\r\n  }\r\n  /* we do the comparison here (possibly again), just to make sure that if the\r\n     loop above is skipped because one of the strings reached zero, we must not\r\n     return this as a successful match */\r\n  return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second));\r\n}\r\n\r\nint Curl_raw_nequal(const char *first, const char *second, size_t max)\r\n{\r\n  while(*first && *second && max) {\r\n    if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {\r\n      break;\r\n    }\r\n    max--;\r\n    first++;\r\n    second++;\r\n  }\r\n  if(0 == max)\r\n    return 1; /* they are equal this far */\r\n\r\n  return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);\r\n}\r\n\r\n/* Copy an upper case version of the string from src to dest.  The\r\n * strings may overlap.  No more than n characters of the string are copied\r\n * (including any NUL) and the destination string will NOT be\r\n * NUL-terminated if that limit is reached.\r\n */\r\nvoid Curl_strntoupper(char *dest, const char *src, size_t n)\r\n{\r\n  if(n < 1)\r\n    return;\r\n\r\n  do {\r\n    *dest++ = Curl_raw_toupper(*src);\r\n  } while(*src++ && --n);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/rawstr.h",
    "content": "#ifndef HEADER_CURL_RAWSTR_H\r\n#define HEADER_CURL_RAWSTR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h>\r\n\r\n/*\r\n * Curl_raw_equal() is for doing \"raw\" case insensitive strings. This is meant\r\n * to be locale independent and only compare strings we know are safe for\r\n * this.\r\n *\r\n * The function is capable of comparing a-z case insensitively even for\r\n * non-ascii.\r\n */\r\nint Curl_raw_equal(const char *first, const char *second);\r\nint Curl_raw_nequal(const char *first, const char *second, size_t max);\r\n\r\nchar Curl_raw_toupper(char in);\r\n\r\n/* checkprefix() is a shorter version of the above, used when the first\r\n   argument is zero-byte terminated */\r\n#define checkprefix(a,b)    Curl_raw_nequal(a,b,strlen(a))\r\n\r\nvoid Curl_strntoupper(char *dest, const char *src, size_t n);\r\n\r\n#endif /* HEADER_CURL_RAWSTR_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/rtsp.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_RTSP\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n#include \"multiif.h\"\r\n#include \"http.h\"\r\n#include \"url.h\"\r\n#include \"progress.h\"\r\n#include \"rtsp.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_memory.h\"\r\n#include \"select.h\"\r\n#include \"connect.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * TODO (general)\r\n *  -incoming server requests\r\n *      -server CSeq counter\r\n *  -digest authentication\r\n *  -connect thru proxy\r\n *  -pipelining?\r\n */\r\n\r\n\r\n#define RTP_PKT_CHANNEL(p)   ((int)((unsigned char)((p)[1])))\r\n\r\n#define RTP_PKT_LENGTH(p)  ((((int)((unsigned char)((p)[2]))) << 8) | \\\r\n                             ((int)((unsigned char)((p)[3]))))\r\n\r\n/* protocol-specific functions set up to be called by the main engine */\r\nstatic CURLcode rtsp_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode rtsp_done(struct connectdata *conn, CURLcode, bool premature);\r\nstatic CURLcode rtsp_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode rtsp_disconnect(struct connectdata *conn, bool dead);\r\n\r\nstatic int rtsp_getsock_do(struct connectdata *conn,\r\n                           curl_socket_t *socks,\r\n                           int numsocks);\r\n\r\n/*\r\n * Parse and write out any available RTP data.\r\n *\r\n * nread: amount of data left after k->str. will be modified if RTP\r\n *        data is parsed and k->str is moved up\r\n * readmore: whether or not the RTP parser needs more data right away\r\n */\r\nstatic CURLcode rtsp_rtp_readwrite(struct SessionHandle *data,\r\n                                   struct connectdata *conn,\r\n                                   ssize_t *nread,\r\n                                   bool *readmore);\r\n\r\n\r\n/* this returns the socket to wait for in the DO and DOING state for the multi\r\n   interface and then we're always _sending_ a request and thus we wait for\r\n   the single socket to become writable only */\r\nstatic int rtsp_getsock_do(struct connectdata *conn,\r\n                           curl_socket_t *socks,\r\n                           int numsocks)\r\n{\r\n  /* write mode */\r\n  (void)numsocks; /* unused, we trust it to be at least 1 */\r\n  socks[0] = conn->sock[FIRSTSOCKET];\r\n  return GETSOCK_WRITESOCK(0);\r\n}\r\n\r\nstatic\r\nCURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len);\r\n\r\n\r\n/*\r\n * RTSP handler interface.\r\n */\r\nconst struct Curl_handler Curl_handler_rtsp = {\r\n  \"RTSP\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  rtsp_do,                              /* do_it */\r\n  rtsp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  rtsp_connect,                         /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  rtsp_getsock_do,                      /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  rtsp_disconnect,                      /* disconnect */\r\n  rtsp_rtp_readwrite,                   /* readwrite */\r\n  PORT_RTSP,                            /* defport */\r\n  CURLPROTO_RTSP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n/*\r\n * The server may send us RTP data at any point, and RTSPREQ_RECEIVE does not\r\n * want to block the application forever while receiving a stream. Therefore,\r\n * we cannot assume that an RTSP socket is dead just because it is readable.\r\n *\r\n * Instead, if it is readable, run Curl_getconnectinfo() to peek at the socket\r\n * and distinguish between closed and data.\r\n */\r\nbool Curl_rtsp_connisdead(struct connectdata *check)\r\n{\r\n  int sval;\r\n  bool ret_val = TRUE;\r\n\r\n  sval = Curl_socket_ready(check->sock[FIRSTSOCKET], CURL_SOCKET_BAD, 0);\r\n  if(sval == 0) {\r\n    /* timeout */\r\n    ret_val = FALSE;\r\n  }\r\n  else if(sval & CURL_CSELECT_ERR) {\r\n    /* socket is in an error state */\r\n    ret_val = TRUE;\r\n  }\r\n  else if((sval & CURL_CSELECT_IN) && check->data) {\r\n    /* readable with no error. could be closed or could be alive but we can\r\n       only check if we have a proper SessionHandle for the connection */\r\n    curl_socket_t connectinfo = Curl_getconnectinfo(check->data, &check);\r\n    if(connectinfo != CURL_SOCKET_BAD)\r\n      ret_val = FALSE;\r\n  }\r\n\r\n  return ret_val;\r\n}\r\n\r\nstatic CURLcode rtsp_connect(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode httpStatus;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  httpStatus = Curl_http_connect(conn, done);\r\n\r\n  /* Initialize the CSeq if not already done */\r\n  if(data->state.rtsp_next_client_CSeq == 0)\r\n    data->state.rtsp_next_client_CSeq = 1;\r\n  if(data->state.rtsp_next_server_CSeq == 0)\r\n    data->state.rtsp_next_server_CSeq = 1;\r\n\r\n  conn->proto.rtspc.rtp_channel = -1;\r\n\r\n  return httpStatus;\r\n}\r\n\r\nstatic CURLcode rtsp_disconnect(struct connectdata *conn, bool dead)\r\n{\r\n  (void) dead;\r\n  Curl_safefree(conn->proto.rtspc.rtp_buf);\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nstatic CURLcode rtsp_done(struct connectdata *conn,\r\n                          CURLcode status, bool premature)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct RTSP *rtsp = data->state.proto.rtsp;\r\n  CURLcode httpStatus;\r\n  long CSeq_sent;\r\n  long CSeq_recv;\r\n\r\n  /* Bypass HTTP empty-reply checks on receive */\r\n  if(data->set.rtspreq == RTSPREQ_RECEIVE)\r\n    premature = TRUE;\r\n\r\n  httpStatus = Curl_http_done(conn, status, premature);\r\n\r\n  if(rtsp) {\r\n    /* Check the sequence numbers */\r\n    CSeq_sent = rtsp->CSeq_sent;\r\n    CSeq_recv = rtsp->CSeq_recv;\r\n    if((data->set.rtspreq != RTSPREQ_RECEIVE) && (CSeq_sent != CSeq_recv)) {\r\n      failf(data,\r\n            \"The CSeq of this request %ld did not match the response %ld\",\r\n            CSeq_sent, CSeq_recv);\r\n      return CURLE_RTSP_CSEQ_ERROR;\r\n    }\r\n    else if(data->set.rtspreq == RTSPREQ_RECEIVE &&\r\n            (conn->proto.rtspc.rtp_channel == -1)) {\r\n      infof(data, \"Got an RTP Receive with a CSeq of %ld\\n\", CSeq_recv);\r\n      /* TODO CPC: Server -> Client logic here */\r\n    }\r\n  }\r\n\r\n  return httpStatus;\r\n}\r\n\r\nstatic CURLcode rtsp_do(struct connectdata *conn, bool *done)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  CURLcode result=CURLE_OK;\r\n  Curl_RtspReq rtspreq = data->set.rtspreq;\r\n  struct RTSP *rtsp;\r\n  struct HTTP *http;\r\n  Curl_send_buffer *req_buffer;\r\n  curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */\r\n  curl_off_t putsize = 0; /* for ANNOUNCE and SET_PARAMETER */\r\n\r\n  const char *p_request = NULL;\r\n  const char *p_session_id = NULL;\r\n  const char *p_accept = NULL;\r\n  const char *p_accept_encoding = NULL;\r\n  const char *p_range = NULL;\r\n  const char *p_referrer = NULL;\r\n  const char *p_stream_uri = NULL;\r\n  const char *p_transport = NULL;\r\n  const char *p_uagent = NULL;\r\n\r\n  *done = TRUE;\r\n\r\n  Curl_reset_reqproto(conn);\r\n\r\n  if(!data->state.proto.rtsp) {\r\n    /* Only allocate this struct if we don't already have it! */\r\n\r\n    rtsp = calloc(1, sizeof(struct RTSP));\r\n    if(!rtsp)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    data->state.proto.rtsp = rtsp;\r\n  }\r\n  else {\r\n    rtsp = data->state.proto.rtsp;\r\n  }\r\n\r\n  http = &(rtsp->http_wrapper);\r\n  /* Assert that no one has changed the RTSP struct in an evil way */\r\n  DEBUGASSERT((void *)http == (void *)rtsp);\r\n\r\n  rtsp->CSeq_sent = data->state.rtsp_next_client_CSeq;\r\n  rtsp->CSeq_recv = 0;\r\n\r\n  /* Setup the 'p_request' pointer to the proper p_request string\r\n   * Since all RTSP requests are included here, there is no need to\r\n   * support custom requests like HTTP.\r\n   **/\r\n  DEBUGASSERT((rtspreq > RTSPREQ_NONE && rtspreq < RTSPREQ_LAST));\r\n  data->set.opt_no_body = TRUE; /* most requests don't contain a body */\r\n  switch(rtspreq) {\r\n  case RTSPREQ_NONE:\r\n    failf(data, \"Got invalid RTSP request: RTSPREQ_NONE\");\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  case RTSPREQ_OPTIONS:\r\n    p_request = \"OPTIONS\";\r\n    break;\r\n  case RTSPREQ_DESCRIBE:\r\n    p_request = \"DESCRIBE\";\r\n    data->set.opt_no_body = FALSE;\r\n    break;\r\n  case RTSPREQ_ANNOUNCE:\r\n    p_request = \"ANNOUNCE\";\r\n    break;\r\n  case RTSPREQ_SETUP:\r\n    p_request = \"SETUP\";\r\n    break;\r\n  case RTSPREQ_PLAY:\r\n    p_request = \"PLAY\";\r\n    break;\r\n  case RTSPREQ_PAUSE:\r\n    p_request = \"PAUSE\";\r\n    break;\r\n  case RTSPREQ_TEARDOWN:\r\n    p_request = \"TEARDOWN\";\r\n    break;\r\n  case RTSPREQ_GET_PARAMETER:\r\n    /* GET_PARAMETER's no_body status is determined later */\r\n    p_request = \"GET_PARAMETER\";\r\n    data->set.opt_no_body = FALSE;\r\n    break;\r\n  case RTSPREQ_SET_PARAMETER:\r\n    p_request = \"SET_PARAMETER\";\r\n    break;\r\n  case RTSPREQ_RECORD:\r\n    p_request = \"RECORD\";\r\n    break;\r\n  case RTSPREQ_RECEIVE:\r\n    p_request = \"\";\r\n    /* Treat interleaved RTP as body*/\r\n    data->set.opt_no_body = FALSE;\r\n    break;\r\n  case RTSPREQ_LAST:\r\n    failf(data, \"Got invalid RTSP request: RTSPREQ_LAST\");\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n\r\n  if(rtspreq == RTSPREQ_RECEIVE) {\r\n    Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,\r\n                        &http->readbytecount, -1, NULL);\r\n\r\n    return result;\r\n  }\r\n\r\n  p_session_id = data->set.str[STRING_RTSP_SESSION_ID];\r\n  if(!p_session_id &&\r\n     (rtspreq & ~(RTSPREQ_OPTIONS | RTSPREQ_DESCRIBE | RTSPREQ_SETUP))) {\r\n    failf(data, \"Refusing to issue an RTSP request [%s] without a session ID.\",\r\n          p_request ? p_request : \"\");\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n\r\n  /* TODO: auth? */\r\n  /* TODO: proxy? */\r\n\r\n  /* Stream URI. Default to server '*' if not specified */\r\n  if(data->set.str[STRING_RTSP_STREAM_URI]) {\r\n    p_stream_uri = data->set.str[STRING_RTSP_STREAM_URI];\r\n  }\r\n  else {\r\n    p_stream_uri = \"*\";\r\n  }\r\n\r\n  /* Transport Header for SETUP requests */\r\n  p_transport = Curl_checkheaders(data, \"Transport:\");\r\n  if(rtspreq == RTSPREQ_SETUP && !p_transport) {\r\n    /* New Transport: setting? */\r\n    if(data->set.str[STRING_RTSP_TRANSPORT]) {\r\n      Curl_safefree(conn->allocptr.rtsp_transport);\r\n\r\n      conn->allocptr.rtsp_transport =\r\n        aprintf(\"Transport: %s\\r\\n\",\r\n                data->set.str[STRING_RTSP_TRANSPORT]);\r\n      if(!conn->allocptr.rtsp_transport)\r\n        return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    else {\r\n      failf(data,\r\n            \"Refusing to issue an RTSP SETUP without a Transport: header.\");\r\n      return CURLE_BAD_FUNCTION_ARGUMENT;\r\n    }\r\n\r\n    p_transport = conn->allocptr.rtsp_transport;\r\n  }\r\n\r\n  /* Accept Headers for DESCRIBE requests */\r\n  if(rtspreq == RTSPREQ_DESCRIBE) {\r\n    /* Accept Header */\r\n    p_accept = Curl_checkheaders(data, \"Accept:\")?\r\n      NULL:\"Accept: application/sdp\\r\\n\";\r\n\r\n    /* Accept-Encoding header */\r\n    if(!Curl_checkheaders(data, \"Accept-Encoding:\") &&\r\n       data->set.str[STRING_ENCODING]) {\r\n      Curl_safefree(conn->allocptr.accept_encoding);\r\n      conn->allocptr.accept_encoding =\r\n        aprintf(\"Accept-Encoding: %s\\r\\n\", data->set.str[STRING_ENCODING]);\r\n\r\n      if(!conn->allocptr.accept_encoding)\r\n        return CURLE_OUT_OF_MEMORY;\r\n\r\n      p_accept_encoding = conn->allocptr.accept_encoding;\r\n    }\r\n  }\r\n\r\n  /* The User-Agent string might have been allocated in url.c already, because\r\n     it might have been used in the proxy connect, but if we have got a header\r\n     with the user-agent string specified, we erase the previously made string\r\n     here. */\r\n  if(Curl_checkheaders(data, \"User-Agent:\") && conn->allocptr.uagent) {\r\n    Curl_safefree(conn->allocptr.uagent);\r\n    conn->allocptr.uagent = NULL;\r\n  }\r\n  else if(!Curl_checkheaders(data, \"User-Agent:\") &&\r\n          data->set.str[STRING_USERAGENT]) {\r\n    p_uagent = conn->allocptr.uagent;\r\n  }\r\n\r\n  /* Referrer */\r\n  Curl_safefree(conn->allocptr.ref);\r\n  if(data->change.referer && !Curl_checkheaders(data, \"Referer:\"))\r\n    conn->allocptr.ref = aprintf(\"Referer: %s\\r\\n\", data->change.referer);\r\n  else\r\n    conn->allocptr.ref = NULL;\r\n\r\n  p_referrer = conn->allocptr.ref;\r\n\r\n  /*\r\n   * Range Header\r\n   * Only applies to PLAY, PAUSE, RECORD\r\n   *\r\n   * Go ahead and use the Range stuff supplied for HTTP\r\n   */\r\n  if(data->state.use_range &&\r\n     (rtspreq  & (RTSPREQ_PLAY | RTSPREQ_PAUSE | RTSPREQ_RECORD))) {\r\n\r\n    /* Check to see if there is a range set in the custom headers */\r\n    if(!Curl_checkheaders(data, \"Range:\") && data->state.range) {\r\n      Curl_safefree(conn->allocptr.rangeline);\r\n      conn->allocptr.rangeline = aprintf(\"Range: %s\\r\\n\", data->state.range);\r\n      p_range = conn->allocptr.rangeline;\r\n    }\r\n  }\r\n\r\n  /*\r\n   * Sanity check the custom headers\r\n   */\r\n  if(Curl_checkheaders(data, \"CSeq:\")) {\r\n    failf(data, \"CSeq cannot be set as a custom header.\");\r\n    return CURLE_RTSP_CSEQ_ERROR;\r\n  }\r\n  if(Curl_checkheaders(data, \"Session:\")) {\r\n    failf(data, \"Session ID cannot be set as a custom header.\");\r\n    return CURLE_BAD_FUNCTION_ARGUMENT;\r\n  }\r\n\r\n  /* Initialize a dynamic send buffer */\r\n  req_buffer = Curl_add_buffer_init();\r\n\r\n  if(!req_buffer)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  result =\r\n    Curl_add_bufferf(req_buffer,\r\n                     \"%s %s RTSP/1.0\\r\\n\" /* Request Stream-URI RTSP/1.0 */\r\n                     \"CSeq: %ld\\r\\n\", /* CSeq */\r\n                     (p_request ? p_request : \"\"), p_stream_uri,\r\n                     rtsp->CSeq_sent);\r\n  if(result)\r\n    return result;\r\n\r\n  /*\r\n   * Rather than do a normal alloc line, keep the session_id unformatted\r\n   * to make comparison easier\r\n   */\r\n  if(p_session_id) {\r\n    result = Curl_add_bufferf(req_buffer, \"Session: %s\\r\\n\", p_session_id);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  /*\r\n   * Shared HTTP-like options\r\n   */\r\n  result = Curl_add_bufferf(req_buffer,\r\n                            \"%s\" /* transport */\r\n                            \"%s\" /* accept */\r\n                            \"%s\" /* accept-encoding */\r\n                            \"%s\" /* range */\r\n                            \"%s\" /* referrer */\r\n                            \"%s\" /* user-agent */\r\n                            ,\r\n                            p_transport ? p_transport : \"\",\r\n                            p_accept ? p_accept : \"\",\r\n                            p_accept_encoding ? p_accept_encoding : \"\",\r\n                            p_range ? p_range : \"\",\r\n                            p_referrer ? p_referrer : \"\",\r\n                            p_uagent ? p_uagent : \"\");\r\n  if(result)\r\n    return result;\r\n\r\n  if((rtspreq == RTSPREQ_SETUP) || (rtspreq == RTSPREQ_DESCRIBE)) {\r\n    result = Curl_add_timecondition(data, req_buffer);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  result = Curl_add_custom_headers(conn, req_buffer);\r\n  if(result)\r\n    return result;\r\n\r\n  if(rtspreq == RTSPREQ_ANNOUNCE ||\r\n     rtspreq == RTSPREQ_SET_PARAMETER ||\r\n     rtspreq == RTSPREQ_GET_PARAMETER) {\r\n\r\n    if(data->set.upload) {\r\n      putsize = data->set.infilesize;\r\n      data->set.httpreq = HTTPREQ_PUT;\r\n\r\n    }\r\n    else {\r\n      postsize = (data->set.postfieldsize != -1)?\r\n        data->set.postfieldsize:\r\n        (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);\r\n      data->set.httpreq = HTTPREQ_POST;\r\n    }\r\n\r\n    if(putsize > 0 || postsize > 0) {\r\n      /* As stated in the http comments, it is probably not wise to\r\n       * actually set a custom Content-Length in the headers */\r\n      if(!Curl_checkheaders(data, \"Content-Length:\")) {\r\n        result = Curl_add_bufferf(req_buffer,\r\n            \"Content-Length: %\" FORMAT_OFF_T\"\\r\\n\",\r\n            (data->set.upload ? putsize : postsize));\r\n        if(result)\r\n          return result;\r\n      }\r\n\r\n      if(rtspreq == RTSPREQ_SET_PARAMETER ||\r\n         rtspreq == RTSPREQ_GET_PARAMETER) {\r\n        if(!Curl_checkheaders(data, \"Content-Type:\")) {\r\n          result = Curl_add_bufferf(req_buffer,\r\n              \"Content-Type: text/parameters\\r\\n\");\r\n          if(result)\r\n            return result;\r\n        }\r\n      }\r\n\r\n      if(rtspreq == RTSPREQ_ANNOUNCE) {\r\n        if(!Curl_checkheaders(data, \"Content-Type:\")) {\r\n          result = Curl_add_bufferf(req_buffer,\r\n              \"Content-Type: application/sdp\\r\\n\");\r\n          if(result)\r\n            return result;\r\n        }\r\n      }\r\n\r\n      data->state.expect100header = FALSE; /* RTSP posts are simple/small */\r\n    }\r\n    else if(rtspreq == RTSPREQ_GET_PARAMETER) {\r\n      /* Check for an empty GET_PARAMETER (heartbeat) request */\r\n      data->set.httpreq = HTTPREQ_HEAD;\r\n      data->set.opt_no_body = TRUE;\r\n    }\r\n  }\r\n\r\n  /* RTSP never allows chunked transfer */\r\n  data->req.forbidchunk = TRUE;\r\n  /* Finish the request buffer */\r\n  result = Curl_add_buffer(req_buffer, \"\\r\\n\", 2);\r\n  if(result)\r\n    return result;\r\n\r\n  if(postsize > 0) {\r\n    result = Curl_add_buffer(req_buffer, data->set.postfields,\r\n                             (size_t)postsize);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  /* issue the request */\r\n  result = Curl_add_buffer_send(req_buffer, conn,\r\n                                &data->info.request_size, 0, FIRSTSOCKET);\r\n  if(result) {\r\n    failf(data, \"Failed sending RTSP request\");\r\n    return result;\r\n  }\r\n\r\n  Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,\r\n                      putsize?FIRSTSOCKET:-1,\r\n                      putsize?&http->writebytecount:NULL);\r\n\r\n  /* Increment the CSeq on success */\r\n  data->state.rtsp_next_client_CSeq++;\r\n\r\n  if(http->writebytecount) {\r\n    /* if a request-body has been sent off, we make sure this progress is\r\n       noted properly */\r\n    Curl_pgrsSetUploadCounter(data, http->writebytecount);\r\n    if(Curl_pgrsUpdate(conn))\r\n      result = CURLE_ABORTED_BY_CALLBACK;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n\r\nstatic CURLcode rtsp_rtp_readwrite(struct SessionHandle *data,\r\n                                   struct connectdata *conn,\r\n                                   ssize_t *nread,\r\n                                   bool *readmore) {\r\n  struct SingleRequest *k = &data->req;\r\n  struct rtsp_conn *rtspc = &(conn->proto.rtspc);\r\n\r\n  char *rtp; /* moving pointer to rtp data */\r\n  ssize_t rtp_dataleft; /* how much data left to parse in this round */\r\n  char *scratch;\r\n  CURLcode result;\r\n\r\n  if(rtspc->rtp_buf) {\r\n    /* There was some leftover data the last time. Merge buffers */\r\n    char *newptr = realloc(rtspc->rtp_buf, rtspc->rtp_bufsize + *nread);\r\n    if(!newptr) {\r\n      Curl_safefree(rtspc->rtp_buf);\r\n      rtspc->rtp_buf = NULL;\r\n      rtspc->rtp_bufsize = 0;\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    rtspc->rtp_buf = newptr;\r\n    memcpy(rtspc->rtp_buf + rtspc->rtp_bufsize, k->str, *nread);\r\n    rtspc->rtp_bufsize += *nread;\r\n    rtp = rtspc->rtp_buf;\r\n    rtp_dataleft = rtspc->rtp_bufsize;\r\n  }\r\n  else {\r\n    /* Just parse the request buffer directly */\r\n    rtp = k->str;\r\n    rtp_dataleft = *nread;\r\n  }\r\n\r\n  while((rtp_dataleft > 0) &&\r\n        (rtp[0] == '$')) {\r\n    if(rtp_dataleft > 4) {\r\n      int rtp_length;\r\n\r\n      /* Parse the header */\r\n      /* The channel identifier immediately follows and is 1 byte */\r\n      rtspc->rtp_channel = RTP_PKT_CHANNEL(rtp);\r\n\r\n      /* The length is two bytes */\r\n      rtp_length = RTP_PKT_LENGTH(rtp);\r\n\r\n      if(rtp_dataleft < rtp_length + 4) {\r\n        /* Need more - incomplete payload*/\r\n        *readmore = TRUE;\r\n        break;\r\n      }\r\n      else {\r\n        /* We have the full RTP interleaved packet\r\n         * Write out the header including the leading '$' */\r\n        DEBUGF(infof(data, \"RTP write channel %d rtp_length %d\\n\",\r\n              rtspc->rtp_channel, rtp_length));\r\n        result = rtp_client_write(conn, &rtp[0], rtp_length + 4);\r\n        if(result) {\r\n          failf(data, \"Got an error writing an RTP packet\");\r\n          *readmore = FALSE;\r\n          Curl_safefree(rtspc->rtp_buf);\r\n          rtspc->rtp_buf = NULL;\r\n          rtspc->rtp_bufsize = 0;\r\n          return result;\r\n        }\r\n\r\n        /* Move forward in the buffer */\r\n        rtp_dataleft -= rtp_length + 4;\r\n        rtp += rtp_length + 4;\r\n\r\n        if(data->set.rtspreq == RTSPREQ_RECEIVE) {\r\n          /* If we are in a passive receive, give control back\r\n           * to the app as often as we can.\r\n           */\r\n          k->keepon &= ~KEEP_RECV;\r\n        }\r\n      }\r\n    }\r\n    else {\r\n      /* Need more - incomplete header */\r\n      *readmore = TRUE;\r\n      break;\r\n    }\r\n  }\r\n\r\n  if(rtp_dataleft != 0 && rtp[0] == '$') {\r\n    DEBUGF(infof(data, \"RTP Rewinding %zu %s\\n\", rtp_dataleft,\r\n          *readmore ? \"(READMORE)\" : \"\"));\r\n\r\n    /* Store the incomplete RTP packet for a \"rewind\" */\r\n    scratch = malloc(rtp_dataleft);\r\n    if(!scratch) {\r\n      Curl_safefree(rtspc->rtp_buf);\r\n      rtspc->rtp_buf = NULL;\r\n      rtspc->rtp_bufsize = 0;\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    memcpy(scratch, rtp, rtp_dataleft);\r\n    Curl_safefree(rtspc->rtp_buf);\r\n    rtspc->rtp_buf = scratch;\r\n    rtspc->rtp_bufsize = rtp_dataleft;\r\n\r\n    /* As far as the transfer is concerned, this data is consumed */\r\n    *nread = 0;\r\n    return CURLE_OK;\r\n  }\r\n  else {\r\n    /* Fix up k->str to point just after the last RTP packet */\r\n    k->str += *nread - rtp_dataleft;\r\n\r\n    /* either all of the data has been read or...\r\n     * rtp now points at the next byte to parse\r\n     */\r\n    if(rtp_dataleft > 0)\r\n      DEBUGASSERT(k->str[0] == rtp[0]);\r\n\r\n    DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */\r\n\r\n    *nread = rtp_dataleft;\r\n  }\r\n\r\n  /* If we get here, we have finished with the leftover/merge buffer */\r\n  Curl_safefree(rtspc->rtp_buf);\r\n  rtspc->rtp_buf = NULL;\r\n  rtspc->rtp_bufsize = 0;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic\r\nCURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  size_t wrote;\r\n  curl_write_callback writeit;\r\n\r\n  if(len == 0) {\r\n    failf (data, \"Cannot write a 0 size RTP packet.\");\r\n    return CURLE_WRITE_ERROR;\r\n  }\r\n\r\n  writeit = data->set.fwrite_rtp?data->set.fwrite_rtp:data->set.fwrite_func;\r\n  wrote = writeit(ptr, 1, len, data->set.rtp_out);\r\n\r\n  if(CURL_WRITEFUNC_PAUSE == wrote) {\r\n    failf (data, \"Cannot pause RTP\");\r\n    return CURLE_WRITE_ERROR;\r\n  }\r\n\r\n  if(wrote != len) {\r\n    failf (data, \"Failed writing RTP data\");\r\n    return CURLE_WRITE_ERROR;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_rtsp_parseheader(struct connectdata *conn,\r\n                               char *header)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  long CSeq = 0;\r\n\r\n  if(checkprefix(\"CSeq:\", header)) {\r\n    /* Store the received CSeq. Match is verified in rtsp_done */\r\n    int nc = sscanf(&header[4], \": %ld\", &CSeq);\r\n    if(nc == 1) {\r\n      data->state.proto.rtsp->CSeq_recv = CSeq; /* mark the request */\r\n      data->state.rtsp_CSeq_recv = CSeq; /* update the handle */\r\n    }\r\n    else {\r\n      failf(data, \"Unable to read the CSeq header: [%s]\", header);\r\n      return CURLE_RTSP_CSEQ_ERROR;\r\n    }\r\n  }\r\n  else if(checkprefix(\"Session:\", header)) {\r\n    char *start;\r\n\r\n    /* Find the first non-space letter */\r\n    start = header + 9;\r\n    while(*start && ISSPACE(*start))\r\n      start++;\r\n\r\n    if(!*start) {\r\n      failf(data, \"Got a blank Session ID\");\r\n    }\r\n    else if(data->set.str[STRING_RTSP_SESSION_ID]) {\r\n      /* If the Session ID is set, then compare */\r\n      if(strncmp(start, data->set.str[STRING_RTSP_SESSION_ID],\r\n                 strlen(data->set.str[STRING_RTSP_SESSION_ID]))  != 0) {\r\n        failf(data, \"Got RTSP Session ID Line [%s], but wanted ID [%s]\",\r\n              start, data->set.str[STRING_RTSP_SESSION_ID]);\r\n        return CURLE_RTSP_SESSION_ERROR;\r\n      }\r\n    }\r\n    else {\r\n      /* If the Session ID is not set, and we find it in a response, then\r\n         set it */\r\n\r\n      /* The session ID can be an alphanumeric or a 'safe' character\r\n       *\r\n       * RFC 2326 15.1 Base Syntax:\r\n       * safe =  \"\\$\" | \"-\" | \"_\" | \".\" | \"+\"\r\n       * */\r\n      char *end = start;\r\n      while(*end &&\r\n            (ISALNUM(*end) || *end == '-' || *end == '_' || *end == '.' ||\r\n             *end == '+' ||\r\n             (*end == '\\\\' && *(end + 1) && *(end + 1) == '$' && (++end, 1))))\r\n        end++;\r\n\r\n      /* Copy the id substring into a new buffer */\r\n      data->set.str[STRING_RTSP_SESSION_ID] = malloc(end - start + 1);\r\n      if(data->set.str[STRING_RTSP_SESSION_ID] == NULL)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, end - start);\r\n      (data->set.str[STRING_RTSP_SESSION_ID])[end - start] = '\\0';\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* CURL_DISABLE_RTSP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/rtsp.h",
    "content": "#ifndef HEADER_CURL_RTSP_H\r\n#define HEADER_CURL_RTSP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifndef CURL_DISABLE_RTSP\r\n\r\nextern const struct Curl_handler Curl_handler_rtsp;\r\n\r\nbool Curl_rtsp_connisdead(struct connectdata *check);\r\nCURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header);\r\n\r\n#else\r\n/* disabled */\r\n#define Curl_rtsp_parseheader(x,y) CURLE_NOT_BUILT_IN\r\n#define Curl_rtsp_connisdead(x) TRUE\r\n\r\n#endif /* CURL_DISABLE_RTSP */\r\n\r\n/*\r\n * RTSP Connection data\r\n *\r\n * Currently, only used for tracking incomplete RTP data reads\r\n */\r\nstruct rtsp_conn {\r\n  char *rtp_buf;\r\n  ssize_t rtp_bufsize;\r\n  int rtp_channel;\r\n};\r\n\r\n/****************************************************************************\r\n * RTSP unique setup\r\n ***************************************************************************/\r\nstruct RTSP {\r\n  /*\r\n   * http_wrapper MUST be the first element of this structure for the wrap\r\n   * logic to work. In this way, we get a cheap polymorphism because\r\n   * &(data->state.proto.rtsp) == &(data->state.proto.http) per the C spec\r\n   *\r\n   * HTTP functions can safely treat this as an HTTP struct, but RTSP aware\r\n   * functions can also index into the later elements.\r\n   */\r\n  struct HTTP http_wrapper; /*wrap HTTP to do the heavy lifting */\r\n\r\n  long CSeq_sent; /* CSeq of this request */\r\n  long CSeq_recv; /* CSeq received */\r\n};\r\n\r\n\r\n#endif /* HEADER_CURL_RTSP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/security.c",
    "content": "/* This source code was modified by Martin Hedenfalk <mhe@stacken.kth.se> for\r\n * use in Curl. His latest changes were done 2000-09-18.\r\n *\r\n * It has since been patched and modified a lot by Daniel Stenberg\r\n * <daniel@haxx.se> to make it better applied to curl conditions, and to make\r\n * it not use globals, pollute name space and more. This source code awaits a\r\n * rewrite to work around the paragraph 2 in the BSD licenses as explained\r\n * below.\r\n *\r\n * Copyright (c) 1998, 1999 Kungliga Tekniska Hgskolan\r\n * (Royal Institute of Technology, Stockholm, Sweden).\r\n *\r\n * Copyright (C) 2001 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the Institute nor the names of its contributors\r\n *    may be used to endorse or promote products derived from this software\r\n *    without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.  */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"curl_base64.h\"\r\n#include \"curl_memory.h\"\r\n#include \"krb4.h\"\r\n#include \"ftp.h\"\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n#include \"warnless.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic const struct {\r\n  enum protection_level level;\r\n  const char *name;\r\n} level_names[] = {\r\n  { PROT_CLEAR, \"clear\" },\r\n  { PROT_SAFE, \"safe\" },\r\n  { PROT_CONFIDENTIAL, \"confidential\" },\r\n  { PROT_PRIVATE, \"private\" }\r\n};\r\n\r\nstatic enum protection_level\r\nname_to_level(const char *name)\r\n{\r\n  int i;\r\n  for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)\r\n    if(checkprefix(name, level_names[i].name))\r\n      return level_names[i].level;\r\n  return PROT_NONE;\r\n}\r\n\r\n/* Convert a protocol |level| to its char representation.\r\n   We take an int to catch programming mistakes. */\r\nstatic char level_to_char(int level) {\r\n  switch(level) {\r\n  case PROT_CLEAR:\r\n    return 'C';\r\n  case PROT_SAFE:\r\n    return 'S';\r\n  case PROT_CONFIDENTIAL:\r\n    return 'E';\r\n  case PROT_PRIVATE:\r\n    return 'P';\r\n  case PROT_CMD:\r\n    /* Fall through */\r\n  default:\r\n    /* Those 2 cases should not be reached! */\r\n    break;\r\n  }\r\n  DEBUGASSERT(0);\r\n  /* Default to the most secure alternative. */\r\n  return 'P';\r\n}\r\n\r\nstatic const struct Curl_sec_client_mech * const mechs[] = {\r\n#if defined(HAVE_GSSAPI)\r\n  &Curl_krb5_client_mech,\r\n#endif\r\n#if defined(HAVE_KRB4)\r\n  &Curl_krb4_client_mech,\r\n#endif\r\n  NULL\r\n};\r\n\r\n/* Send an FTP command defined by |message| and the optional arguments. The\r\n   function returns the ftp_code. If an error occurs, -1 is returned. */\r\nstatic int ftp_send_command(struct connectdata *conn, const char *message, ...)\r\n{\r\n  int ftp_code;\r\n  ssize_t nread;\r\n  va_list args;\r\n  char print_buffer[50];\r\n\r\n  va_start(args, message);\r\n  vsnprintf(print_buffer, sizeof(print_buffer), message, args);\r\n  va_end(args);\r\n\r\n  if(Curl_ftpsendf(conn, print_buffer) != CURLE_OK) {\r\n    ftp_code = -1;\r\n  }\r\n  else {\r\n    if(Curl_GetFTPResponse(&nread, conn, &ftp_code) != CURLE_OK)\r\n      ftp_code = -1;\r\n  }\r\n\r\n  (void)nread; /* Unused */\r\n  return ftp_code;\r\n}\r\n\r\n/* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode\r\n   saying whether an error occurred or CURLE_OK if |len| was read. */\r\nstatic CURLcode\r\nsocket_read(curl_socket_t fd, void *to, size_t len)\r\n{\r\n  char *to_p = to;\r\n  CURLcode code;\r\n  ssize_t nread;\r\n\r\n  while(len > 0) {\r\n    code = Curl_read_plain(fd, to_p, len, &nread);\r\n    if(code == CURLE_OK) {\r\n      len -= nread;\r\n      to_p += nread;\r\n    }\r\n    else {\r\n      /* FIXME: We are doing a busy wait */\r\n      if(code == CURLE_AGAIN)\r\n        continue;\r\n      return code;\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/* Write |len| bytes from the buffer |to| to the socket |fd|. Return a\r\n   CURLcode saying whether an error occurred or CURLE_OK if |len| was\r\n   written. */\r\nstatic CURLcode\r\nsocket_write(struct connectdata *conn, curl_socket_t fd, const void *to,\r\n             size_t len)\r\n{\r\n  const char *to_p = to;\r\n  CURLcode code;\r\n  ssize_t written;\r\n\r\n  while(len > 0) {\r\n    code = Curl_write_plain(conn, fd, to_p, len, &written);\r\n    if(code == CURLE_OK) {\r\n      len -= written;\r\n      to_p += written;\r\n    }\r\n    else {\r\n      /* FIXME: We are doing a busy wait */\r\n      if(code == CURLE_AGAIN)\r\n        continue;\r\n      return code;\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode read_data(struct connectdata *conn,\r\n                          curl_socket_t fd,\r\n                          struct krb4buffer *buf)\r\n{\r\n  int len;\r\n  void* tmp;\r\n  CURLcode ret;\r\n\r\n  ret = socket_read(fd, &len, sizeof(len));\r\n  if(ret != CURLE_OK)\r\n    return ret;\r\n\r\n  len = ntohl(len);\r\n  tmp = realloc(buf->data, len);\r\n  if(tmp == NULL)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  buf->data = tmp;\r\n  ret = socket_read(fd, buf->data, len);\r\n  if(ret != CURLE_OK)\r\n    return ret;\r\n  buf->size = conn->mech->decode(conn->app_data, buf->data, len,\r\n                                 conn->data_prot, conn);\r\n  buf->index = 0;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic size_t\r\nbuffer_read(struct krb4buffer *buf, void *data, size_t len)\r\n{\r\n  if(buf->size - buf->index < len)\r\n    len = buf->size - buf->index;\r\n  memcpy(data, (char*)buf->data + buf->index, len);\r\n  buf->index += len;\r\n  return len;\r\n}\r\n\r\n/* Matches Curl_recv signature */\r\nstatic ssize_t sec_recv(struct connectdata *conn, int sockindex,\r\n                        char *buffer, size_t len, CURLcode *err)\r\n{\r\n  size_t bytes_read;\r\n  size_t total_read = 0;\r\n  curl_socket_t fd = conn->sock[sockindex];\r\n\r\n  *err = CURLE_OK;\r\n\r\n  /* Handle clear text response. */\r\n  if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR)\r\n      return read(fd, buffer, len);\r\n\r\n  if(conn->in_buffer.eof_flag) {\r\n    conn->in_buffer.eof_flag = 0;\r\n    return 0;\r\n  }\r\n\r\n  bytes_read = buffer_read(&conn->in_buffer, buffer, len);\r\n  len -= bytes_read;\r\n  total_read += bytes_read;\r\n  buffer += bytes_read;\r\n\r\n  while(len > 0) {\r\n    if(read_data(conn, fd, &conn->in_buffer) != CURLE_OK)\r\n      return -1;\r\n    if(conn->in_buffer.size == 0) {\r\n      if(bytes_read > 0)\r\n        conn->in_buffer.eof_flag = 1;\r\n      return bytes_read;\r\n    }\r\n    bytes_read = buffer_read(&conn->in_buffer, buffer, len);\r\n    len -= bytes_read;\r\n    total_read += bytes_read;\r\n    buffer += bytes_read;\r\n  }\r\n  /* FIXME: Check for overflow */\r\n  return total_read;\r\n}\r\n\r\n/* Send |length| bytes from |from| to the |fd| socket taking care of encoding\r\n   and negociating with the server. |from| can be NULL. */\r\n/* FIXME: We don't check for errors nor report any! */\r\nstatic void do_sec_send(struct connectdata *conn, curl_socket_t fd,\r\n                        const char *from, int length)\r\n{\r\n  int bytes, htonl_bytes; /* 32-bit integers for htonl */\r\n  char *buffer = NULL;\r\n  char *cmd_buffer;\r\n  size_t cmd_size = 0;\r\n  CURLcode error;\r\n  enum protection_level prot_level = conn->data_prot;\r\n  bool iscmd = (prot_level == PROT_CMD)?TRUE:FALSE;\r\n\r\n  DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);\r\n\r\n  if(iscmd) {\r\n    if(!strncmp(from, \"PASS \", 5) || !strncmp(from, \"ACCT \", 5))\r\n      prot_level = PROT_PRIVATE;\r\n    else\r\n      prot_level = conn->command_prot;\r\n  }\r\n  bytes = conn->mech->encode(conn->app_data, from, length, prot_level,\r\n                             (void**)&buffer, conn);\r\n  if(!buffer || bytes <= 0)\r\n    return; /* error */\r\n\r\n  if(iscmd) {\r\n    error = Curl_base64_encode(conn->data, buffer, curlx_sitouz(bytes),\r\n                               &cmd_buffer, &cmd_size);\r\n    if(error) {\r\n      free(buffer);\r\n      return; /* error */\r\n    }\r\n    if(cmd_size > 0) {\r\n      static const char *enc = \"ENC \";\r\n      static const char *mic = \"MIC \";\r\n      if(prot_level == PROT_PRIVATE)\r\n        socket_write(conn, fd, enc, 4);\r\n      else\r\n        socket_write(conn, fd, mic, 4);\r\n\r\n      socket_write(conn, fd, cmd_buffer, cmd_size);\r\n      socket_write(conn, fd, \"\\r\\n\", 2);\r\n      infof(conn->data, \"Send: %s%s\\n\", prot_level == PROT_PRIVATE?enc:mic,\r\n            cmd_buffer);\r\n      free(cmd_buffer);\r\n    }\r\n  }\r\n  else {\r\n    htonl_bytes = htonl(bytes);\r\n    socket_write(conn, fd, &htonl_bytes, sizeof(htonl_bytes));\r\n    socket_write(conn, fd, buffer, curlx_sitouz(bytes));\r\n  }\r\n  free(buffer);\r\n}\r\n\r\nstatic ssize_t sec_write(struct connectdata *conn, curl_socket_t fd,\r\n                         const char *buffer, size_t length)\r\n{\r\n  /* FIXME: Check for overflow */\r\n  ssize_t tx = 0, len = conn->buffer_size;\r\n\r\n  len -= conn->mech->overhead(conn->app_data, conn->data_prot,\r\n                              curlx_sztosi(len));\r\n  if(len <= 0)\r\n    len = length;\r\n  while(length) {\r\n    if(len >= 0 || length < (size_t)len) {\r\n      /* FIXME: Check for overflow. */\r\n      len = length;\r\n    }\r\n    do_sec_send(conn, fd, buffer, curlx_sztosi(len));\r\n    length -= len;\r\n    buffer += len;\r\n    tx += len;\r\n  }\r\n  return tx;\r\n}\r\n\r\n/* Matches Curl_send signature */\r\nstatic ssize_t sec_send(struct connectdata *conn, int sockindex,\r\n                        const void *buffer, size_t len, CURLcode *err)\r\n{\r\n  curl_socket_t fd = conn->sock[sockindex];\r\n  *err = CURLE_OK;\r\n  return sec_write(conn, fd, buffer, len);\r\n}\r\n\r\nint Curl_sec_read_msg(struct connectdata *conn, char *buffer,\r\n                      enum protection_level level)\r\n{\r\n  /* decoded_len should be size_t or ssize_t but conn->mech->decode returns an\r\n     int */\r\n  int decoded_len;\r\n  char *buf;\r\n  int ret_code;\r\n  size_t decoded_sz = 0;\r\n  CURLcode error;\r\n\r\n  DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);\r\n\r\n  error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);\r\n  if(error || decoded_sz == 0)\r\n    return -1;\r\n\r\n  if(decoded_sz > (size_t)INT_MAX) {\r\n    free(buf);\r\n    return -1;\r\n  }\r\n  decoded_len = curlx_uztosi(decoded_sz);\r\n\r\n  decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len,\r\n                                   level, conn);\r\n  if(decoded_len <= 0) {\r\n    free(buf);\r\n    return -1;\r\n  }\r\n\r\n  if(conn->data->set.verbose) {\r\n    buf[decoded_len] = '\\n';\r\n    Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1, conn);\r\n  }\r\n\r\n  buf[decoded_len] = '\\0';\r\n  DEBUGASSERT(decoded_len > 3);\r\n  if(buf[3] == '-')\r\n    ret_code = 0;\r\n  else {\r\n    /* Check for error? */\r\n    sscanf(buf, \"%d\", &ret_code);\r\n  }\r\n\r\n  if(buf[decoded_len - 1] == '\\n')\r\n    buf[decoded_len - 1] = '\\0';\r\n  /* FIXME: Is |buffer| length always greater than |decoded_len|? */\r\n  strcpy(buffer, buf);\r\n  free(buf);\r\n  return ret_code;\r\n}\r\n\r\n/* FIXME: The error code returned here is never checked. */\r\nstatic int sec_set_protection_level(struct connectdata *conn)\r\n{\r\n  int code;\r\n  char* pbsz;\r\n  static unsigned int buffer_size = 1 << 20; /* 1048576 */\r\n  enum protection_level level = conn->request_data_prot;\r\n\r\n  DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);\r\n\r\n  if(!conn->sec_complete) {\r\n    infof(conn->data, \"Trying to change the protection level after the\"\r\n                      \"completion of the data exchange.\\n\");\r\n    return -1;\r\n  }\r\n\r\n  /* Bail out if we try to set up the same level */\r\n  if(conn->data_prot == level)\r\n    return 0;\r\n\r\n  if(level) {\r\n    code = ftp_send_command(conn, \"PBSZ %u\", buffer_size);\r\n    if(code < 0)\r\n      return -1;\r\n\r\n    if(code/100 != 2) {\r\n      failf(conn->data, \"Failed to set the protection's buffer size.\");\r\n      return -1;\r\n    }\r\n    conn->buffer_size = buffer_size;\r\n\r\n    pbsz = strstr(conn->data->state.buffer, \"PBSZ=\");\r\n    if(pbsz) {\r\n      /* FIXME: Checks for errors in sscanf? */\r\n      sscanf(pbsz, \"PBSZ=%u\", &buffer_size);\r\n      if(buffer_size < conn->buffer_size)\r\n        conn->buffer_size = buffer_size;\r\n    }\r\n  }\r\n\r\n  /* Now try to negiociate the protection level. */\r\n  code = ftp_send_command(conn, \"PROT %c\", level_to_char(level));\r\n\r\n  if(code < 0)\r\n    return -1;\r\n\r\n  if(code/100 != 2) {\r\n    failf(conn->data, \"Failed to set the protection level.\");\r\n    return -1;\r\n  }\r\n\r\n  conn->data_prot = level;\r\n  if(level == PROT_PRIVATE)\r\n    conn->command_prot = level;\r\n\r\n  return 0;\r\n}\r\n\r\nint\r\nCurl_sec_request_prot(struct connectdata *conn, const char *level)\r\n{\r\n  enum protection_level l = name_to_level(level);\r\n  if(l == PROT_NONE)\r\n    return -1;\r\n  DEBUGASSERT(l > PROT_NONE && l < PROT_LAST);\r\n  conn->request_data_prot = l;\r\n  return 0;\r\n}\r\n\r\nstatic CURLcode choose_mech(struct connectdata *conn)\r\n{\r\n  int ret;\r\n  struct SessionHandle *data = conn->data;\r\n  const struct Curl_sec_client_mech * const *mech;\r\n  void *tmp_allocation;\r\n  const char *mech_name;\r\n\r\n  for(mech = mechs; (*mech); ++mech) {\r\n    mech_name = (*mech)->name;\r\n    /* We have no mechanism with a NULL name but keep this check */\r\n    DEBUGASSERT(mech_name != NULL);\r\n    if(mech_name == NULL) {\r\n      infof(data, \"Skipping mechanism with empty name (%p)\\n\", mech);\r\n      continue;\r\n    }\r\n    tmp_allocation = realloc(conn->app_data, (*mech)->size);\r\n    if(tmp_allocation == NULL) {\r\n      failf(data, \"Failed realloc of size %u\", (*mech)->size);\r\n      mech = NULL;\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    conn->app_data = tmp_allocation;\r\n\r\n    if((*mech)->init) {\r\n      ret = (*mech)->init(conn->app_data);\r\n      if(ret != 0) {\r\n        infof(data, \"Failed initialization for %s. Skipping it.\\n\", mech_name);\r\n        continue;\r\n      }\r\n    }\r\n\r\n    infof(data, \"Trying mechanism %s...\\n\", mech_name);\r\n    ret = ftp_send_command(conn, \"AUTH %s\", mech_name);\r\n    if(ret < 0)\r\n      /* FIXME: This error is too generic but it is OK for now. */\r\n      return CURLE_COULDNT_CONNECT;\r\n\r\n    if(ret/100 != 3) {\r\n      switch(ret) {\r\n      case 504:\r\n        infof(data, \"Mechanism %s is not supported by the server (server \"\r\n                    \"returned ftp code: 504).\\n\", mech_name);\r\n        break;\r\n      case 534:\r\n        infof(data, \"Mechanism %s was rejected by the server (server returned \"\r\n                    \"ftp code: 534).\\n\", mech_name);\r\n        break;\r\n      default:\r\n        if(ret/100 == 5) {\r\n          infof(data, \"server does not support the security extensions\\n\");\r\n          return CURLE_USE_SSL_FAILED;\r\n        }\r\n        break;\r\n      }\r\n      continue;\r\n    }\r\n\r\n    /* Authenticate */\r\n    ret = (*mech)->auth(conn->app_data, conn);\r\n\r\n    if(ret == AUTH_CONTINUE)\r\n      continue;\r\n    else if(ret != AUTH_OK) {\r\n      /* Mechanism has dumped the error to stderr, don't error here. */\r\n      return -1;\r\n    }\r\n    DEBUGASSERT(ret == AUTH_OK);\r\n\r\n    conn->mech = *mech;\r\n    conn->sec_complete = 1;\r\n    conn->recv[FIRSTSOCKET] = sec_recv;\r\n    conn->send[FIRSTSOCKET] = sec_send;\r\n    conn->recv[SECONDARYSOCKET] = sec_recv;\r\n    conn->send[SECONDARYSOCKET] = sec_send;\r\n    conn->command_prot = PROT_SAFE;\r\n    /* Set the requested protection level */\r\n    /* BLOCKING */\r\n    (void)sec_set_protection_level(conn);\r\n    break;\r\n  }\r\n\r\n  return mech != NULL ? CURLE_OK : CURLE_FAILED_INIT;\r\n}\r\n\r\nCURLcode\r\nCurl_sec_login(struct connectdata *conn)\r\n{\r\n  return choose_mech(conn);\r\n}\r\n\r\n\r\nvoid\r\nCurl_sec_end(struct connectdata *conn)\r\n{\r\n  if(conn->mech != NULL && conn->mech->end)\r\n    conn->mech->end(conn->app_data);\r\n  if(conn->app_data) {\r\n    free(conn->app_data);\r\n    conn->app_data = NULL;\r\n  }\r\n  if(conn->in_buffer.data) {\r\n    free(conn->in_buffer.data);\r\n    conn->in_buffer.data = NULL;\r\n    conn->in_buffer.size = 0;\r\n    conn->in_buffer.index = 0;\r\n    /* FIXME: Is this really needed? */\r\n    conn->in_buffer.eof_flag = 0;\r\n  }\r\n  conn->sec_complete = 0;\r\n  conn->data_prot = PROT_CLEAR;\r\n  conn->mech = NULL;\r\n}\r\n\r\n#endif /* HAVE_KRB4 || HAVE_GSSAPI */\r\n\r\n#endif /* CURL_DISABLE_FTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/select.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4127 : conditional expression is constant\r\n#pragma warning( disable : 4127 )\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_SYS_SELECT_H\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#if !defined(HAVE_SELECT) && !defined(HAVE_POLL_FINE)\r\n#error \"We can't compile without select() or poll() support.\"\r\n#endif\r\n\r\n#if defined(__BEOS__) && !defined(__HAIKU__)\r\n/* BeOS has FD_SET defined in socket.h */\r\n#include <socket.h>\r\n#endif\r\n\r\n#ifdef MSDOS\r\n#include <dos.h>  /* delay() */\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"connect.h\"\r\n#include \"select.h\"\r\n#include \"warnless.h\"\r\n\r\n/* Convenience local macros */\r\n\r\n#define elapsed_ms  (int)curlx_tvdiff(curlx_tvnow(), initial_tv)\r\n\r\n#ifdef CURL_ACKNOWLEDGE_EINTR\r\n#define error_not_EINTR (1)\r\n#else\r\n#define error_not_EINTR (error != EINTR)\r\n#endif\r\n\r\n/*\r\n * Internal function used for waiting a specific amount of ms\r\n * in Curl_socket_ready() and Curl_poll() when no file descriptor\r\n * is provided to wait on, just being used to delay execution.\r\n * WinSock select() and poll() timeout mechanisms need a valid\r\n * socket descriptor in a not null file descriptor set to work.\r\n * Waiting indefinitely with this function is not allowed, a\r\n * zero or negative timeout value will return immediately.\r\n * Timeout resolution, accuracy, as well as maximum supported\r\n * value is system dependent, neither factor is a citical issue\r\n * for the intended use of this function in the library.\r\n * On non-DOS and non-Winsock platforms, when compiled with\r\n * CURL_ACKNOWLEDGE_EINTR defined, EINTR condition is honored\r\n * and function might exit early without awaiting full timeout,\r\n * otherwise EINTR will be ignored and full timeout will elapse.\r\n *\r\n * Return values:\r\n *   -1 = system call error, invalid timeout value, or interrupted\r\n *    0 = specified timeout has elapsed\r\n */\r\nint Curl_wait_ms(int timeout_ms)\r\n{\r\n#if !defined(MSDOS) && !defined(USE_WINSOCK)\r\n#ifndef HAVE_POLL_FINE\r\n  struct timeval pending_tv;\r\n#endif\r\n  struct timeval initial_tv;\r\n  int pending_ms;\r\n  int error;\r\n#endif\r\n  int r = 0;\r\n\r\n  if(!timeout_ms)\r\n    return 0;\r\n  if(timeout_ms < 0) {\r\n    SET_SOCKERRNO(EINVAL);\r\n    return -1;\r\n  }\r\n#if defined(MSDOS)\r\n  delay(timeout_ms);\r\n#elif defined(USE_WINSOCK)\r\n  Sleep(timeout_ms);\r\n#else\r\n  pending_ms = timeout_ms;\r\n  initial_tv = curlx_tvnow();\r\n  do {\r\n#if defined(HAVE_POLL_FINE)\r\n    r = poll(NULL, 0, pending_ms);\r\n#else\r\n    pending_tv.tv_sec = pending_ms / 1000;\r\n    pending_tv.tv_usec = (pending_ms % 1000) * 1000;\r\n    r = select(0, NULL, NULL, NULL, &pending_tv);\r\n#endif /* HAVE_POLL_FINE */\r\n    if(r != -1)\r\n      break;\r\n    error = SOCKERRNO;\r\n    if(error && error_not_EINTR)\r\n      break;\r\n    pending_ms = timeout_ms - elapsed_ms;\r\n    if(pending_ms <= 0)\r\n      break;\r\n  } while(r == -1);\r\n#endif /* USE_WINSOCK */\r\n  if(r)\r\n    r = -1;\r\n  return r;\r\n}\r\n\r\n/*\r\n * Wait for read or write events on a set of file descriptors. It uses poll()\r\n * when a fine poll() is available, in order to avoid limits with FD_SETSIZE,\r\n * otherwise select() is used.  An error is returned if select() is being used\r\n * and a file descriptor is too large for FD_SETSIZE.\r\n *\r\n * A negative timeout value makes this function wait indefinitely,\r\n * unles no valid file descriptor is given, when this happens the\r\n * negative timeout is ignored and the function times out immediately.\r\n * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition\r\n * is honored and function might exit early without awaiting timeout,\r\n * otherwise EINTR will be ignored.\r\n *\r\n * Return values:\r\n *   -1 = system call error or fd >= FD_SETSIZE\r\n *    0 = timeout\r\n *    [bitmask] = action as described below\r\n *\r\n * CURL_CSELECT_IN - first socket is readable\r\n * CURL_CSELECT_IN2 - second socket is readable\r\n * CURL_CSELECT_OUT - write socket is writable\r\n * CURL_CSELECT_ERR - an error condition occurred\r\n */\r\nint Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */\r\n                      curl_socket_t readfd1,\r\n                      curl_socket_t writefd, /* socket to write to */\r\n                      long timeout_ms)       /* milliseconds to wait */\r\n{\r\n#ifdef HAVE_POLL_FINE\r\n  struct pollfd pfd[3];\r\n  int num;\r\n#else\r\n  struct timeval pending_tv;\r\n  struct timeval *ptimeout;\r\n  fd_set fds_read;\r\n  fd_set fds_write;\r\n  fd_set fds_err;\r\n  curl_socket_t maxfd;\r\n#endif\r\n  struct timeval initial_tv = {0,0};\r\n  int pending_ms = 0;\r\n  int error;\r\n  int r;\r\n  int ret;\r\n\r\n  if((readfd0 == CURL_SOCKET_BAD) && (readfd1 == CURL_SOCKET_BAD) &&\r\n     (writefd == CURL_SOCKET_BAD)) {\r\n    /* no sockets, just wait */\r\n    r = Curl_wait_ms((int)timeout_ms);\r\n    return r;\r\n  }\r\n\r\n  /* Avoid initial timestamp, avoid curlx_tvnow() call, when elapsed\r\n     time in this function does not need to be measured. This happens\r\n     when function is called with a zero timeout or a negative timeout\r\n     value indicating a blocking call should be performed. */\r\n\r\n  if(timeout_ms > 0) {\r\n    pending_ms = (int)timeout_ms;\r\n    initial_tv = curlx_tvnow();\r\n  }\r\n\r\n#ifdef HAVE_POLL_FINE\r\n\r\n  num = 0;\r\n  if(readfd0 != CURL_SOCKET_BAD) {\r\n    pfd[num].fd = readfd0;\r\n    pfd[num].events = POLLRDNORM|POLLIN|POLLRDBAND|POLLPRI;\r\n    pfd[num].revents = 0;\r\n    num++;\r\n  }\r\n  if(readfd1 != CURL_SOCKET_BAD) {\r\n    pfd[num].fd = readfd1;\r\n    pfd[num].events = POLLRDNORM|POLLIN|POLLRDBAND|POLLPRI;\r\n    pfd[num].revents = 0;\r\n    num++;\r\n  }\r\n  if(writefd != CURL_SOCKET_BAD) {\r\n    pfd[num].fd = writefd;\r\n    pfd[num].events = POLLWRNORM|POLLOUT;\r\n    pfd[num].revents = 0;\r\n    num++;\r\n  }\r\n\r\n  do {\r\n    if(timeout_ms < 0)\r\n      pending_ms = -1;\r\n    else if(!timeout_ms)\r\n      pending_ms = 0;\r\n    r = poll(pfd, num, pending_ms);\r\n    if(r != -1)\r\n      break;\r\n    error = SOCKERRNO;\r\n    if(error && error_not_EINTR)\r\n      break;\r\n    if(timeout_ms > 0) {\r\n      pending_ms = (int)(timeout_ms - elapsed_ms);\r\n      if(pending_ms <= 0) {\r\n        r = 0;  /* Simulate a \"call timed out\" case */\r\n        break;\r\n      }\r\n    }\r\n  } while(r == -1);\r\n\r\n  if(r < 0)\r\n    return -1;\r\n  if(r == 0)\r\n    return 0;\r\n\r\n  ret = 0;\r\n  num = 0;\r\n  if(readfd0 != CURL_SOCKET_BAD) {\r\n    if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))\r\n      ret |= CURL_CSELECT_IN;\r\n    if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))\r\n      ret |= CURL_CSELECT_ERR;\r\n    num++;\r\n  }\r\n  if(readfd1 != CURL_SOCKET_BAD) {\r\n    if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))\r\n      ret |= CURL_CSELECT_IN2;\r\n    if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))\r\n      ret |= CURL_CSELECT_ERR;\r\n    num++;\r\n  }\r\n  if(writefd != CURL_SOCKET_BAD) {\r\n    if(pfd[num].revents & (POLLWRNORM|POLLOUT))\r\n      ret |= CURL_CSELECT_OUT;\r\n    if(pfd[num].revents & (POLLERR|POLLHUP|POLLNVAL))\r\n      ret |= CURL_CSELECT_ERR;\r\n  }\r\n\r\n  return ret;\r\n\r\n#else  /* HAVE_POLL_FINE */\r\n\r\n  FD_ZERO(&fds_err);\r\n  maxfd = (curl_socket_t)-1;\r\n\r\n  FD_ZERO(&fds_read);\r\n  if(readfd0 != CURL_SOCKET_BAD) {\r\n    VERIFY_SOCK(readfd0);\r\n    FD_SET(readfd0, &fds_read);\r\n    FD_SET(readfd0, &fds_err);\r\n    maxfd = readfd0;\r\n  }\r\n  if(readfd1 != CURL_SOCKET_BAD) {\r\n    VERIFY_SOCK(readfd1);\r\n    FD_SET(readfd1, &fds_read);\r\n    FD_SET(readfd1, &fds_err);\r\n    if(readfd1 > maxfd)\r\n      maxfd = readfd1;\r\n  }\r\n\r\n  FD_ZERO(&fds_write);\r\n  if(writefd != CURL_SOCKET_BAD) {\r\n    VERIFY_SOCK(writefd);\r\n    FD_SET(writefd, &fds_write);\r\n    FD_SET(writefd, &fds_err);\r\n    if(writefd > maxfd)\r\n      maxfd = writefd;\r\n  }\r\n\r\n  ptimeout = (timeout_ms < 0) ? NULL : &pending_tv;\r\n\r\n  do {\r\n    if(timeout_ms > 0) {\r\n      pending_tv.tv_sec = pending_ms / 1000;\r\n      pending_tv.tv_usec = (pending_ms % 1000) * 1000;\r\n    }\r\n    else if(!timeout_ms) {\r\n      pending_tv.tv_sec = 0;\r\n      pending_tv.tv_usec = 0;\r\n    }\r\n    r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout);\r\n    if(r != -1)\r\n      break;\r\n    error = SOCKERRNO;\r\n    if(error && error_not_EINTR)\r\n      break;\r\n    if(timeout_ms > 0) {\r\n      pending_ms = timeout_ms - elapsed_ms;\r\n      if(pending_ms <= 0) {\r\n        r = 0;  /* Simulate a \"call timed out\" case */\r\n        break;\r\n      }\r\n    }\r\n  } while(r == -1);\r\n\r\n  if(r < 0)\r\n    return -1;\r\n  if(r == 0)\r\n    return 0;\r\n\r\n  ret = 0;\r\n  if(readfd0 != CURL_SOCKET_BAD) {\r\n    if(FD_ISSET(readfd0, &fds_read))\r\n      ret |= CURL_CSELECT_IN;\r\n    if(FD_ISSET(readfd0, &fds_err))\r\n      ret |= CURL_CSELECT_ERR;\r\n  }\r\n  if(readfd1 != CURL_SOCKET_BAD) {\r\n    if(FD_ISSET(readfd1, &fds_read))\r\n      ret |= CURL_CSELECT_IN2;\r\n    if(FD_ISSET(readfd1, &fds_err))\r\n      ret |= CURL_CSELECT_ERR;\r\n  }\r\n  if(writefd != CURL_SOCKET_BAD) {\r\n    if(FD_ISSET(writefd, &fds_write))\r\n      ret |= CURL_CSELECT_OUT;\r\n    if(FD_ISSET(writefd, &fds_err))\r\n      ret |= CURL_CSELECT_ERR;\r\n  }\r\n\r\n  return ret;\r\n\r\n#endif  /* HAVE_POLL_FINE */\r\n\r\n}\r\n\r\n/*\r\n * This is a wrapper around poll().  If poll() does not exist, then\r\n * select() is used instead.  An error is returned if select() is\r\n * being used and a file descriptor is too large for FD_SETSIZE.\r\n * A negative timeout value makes this function wait indefinitely,\r\n * unles no valid file descriptor is given, when this happens the\r\n * negative timeout is ignored and the function times out immediately.\r\n * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition\r\n * is honored and function might exit early without awaiting timeout,\r\n * otherwise EINTR will be ignored.\r\n *\r\n * Return values:\r\n *   -1 = system call error or fd >= FD_SETSIZE\r\n *    0 = timeout\r\n *    N = number of structures with non zero revent fields\r\n */\r\nint Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)\r\n{\r\n#ifndef HAVE_POLL_FINE\r\n  struct timeval pending_tv;\r\n  struct timeval *ptimeout;\r\n  fd_set fds_read;\r\n  fd_set fds_write;\r\n  fd_set fds_err;\r\n  curl_socket_t maxfd;\r\n#endif\r\n  struct timeval initial_tv = {0,0};\r\n  bool fds_none = TRUE;\r\n  unsigned int i;\r\n  int pending_ms = 0;\r\n  int error;\r\n  int r;\r\n\r\n  if(ufds) {\r\n    for(i = 0; i < nfds; i++) {\r\n      if(ufds[i].fd != CURL_SOCKET_BAD) {\r\n        fds_none = FALSE;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  if(fds_none) {\r\n    r = Curl_wait_ms(timeout_ms);\r\n    return r;\r\n  }\r\n\r\n  /* Avoid initial timestamp, avoid curlx_tvnow() call, when elapsed\r\n     time in this function does not need to be measured. This happens\r\n     when function is called with a zero timeout or a negative timeout\r\n     value indicating a blocking call should be performed. */\r\n\r\n  if(timeout_ms > 0) {\r\n    pending_ms = timeout_ms;\r\n    initial_tv = curlx_tvnow();\r\n  }\r\n\r\n#ifdef HAVE_POLL_FINE\r\n\r\n  do {\r\n    if(timeout_ms < 0)\r\n      pending_ms = -1;\r\n    else if(!timeout_ms)\r\n      pending_ms = 0;\r\n    r = poll(ufds, nfds, pending_ms);\r\n    if(r != -1)\r\n      break;\r\n    error = SOCKERRNO;\r\n    if(error && error_not_EINTR)\r\n      break;\r\n    if(timeout_ms > 0) {\r\n      pending_ms = timeout_ms - elapsed_ms;\r\n      if(pending_ms <= 0)\r\n        break;\r\n    }\r\n  } while(r == -1);\r\n\r\n  if(r < 0)\r\n    return -1;\r\n  if(r == 0)\r\n    return 0;\r\n\r\n  for(i = 0; i < nfds; i++) {\r\n    if(ufds[i].fd == CURL_SOCKET_BAD)\r\n      continue;\r\n    if(ufds[i].revents & POLLHUP)\r\n      ufds[i].revents |= POLLIN;\r\n    if(ufds[i].revents & POLLERR)\r\n      ufds[i].revents |= (POLLIN|POLLOUT);\r\n  }\r\n\r\n#else  /* HAVE_POLL_FINE */\r\n\r\n  FD_ZERO(&fds_read);\r\n  FD_ZERO(&fds_write);\r\n  FD_ZERO(&fds_err);\r\n  maxfd = (curl_socket_t)-1;\r\n\r\n  for(i = 0; i < nfds; i++) {\r\n    ufds[i].revents = 0;\r\n    if(ufds[i].fd == CURL_SOCKET_BAD)\r\n      continue;\r\n    VERIFY_SOCK(ufds[i].fd);\r\n    if(ufds[i].events & (POLLIN|POLLOUT|POLLPRI|\r\n                          POLLRDNORM|POLLWRNORM|POLLRDBAND)) {\r\n      if(ufds[i].fd > maxfd)\r\n        maxfd = ufds[i].fd;\r\n      if(ufds[i].events & (POLLRDNORM|POLLIN))\r\n        FD_SET(ufds[i].fd, &fds_read);\r\n      if(ufds[i].events & (POLLWRNORM|POLLOUT))\r\n        FD_SET(ufds[i].fd, &fds_write);\r\n      if(ufds[i].events & (POLLRDBAND|POLLPRI))\r\n        FD_SET(ufds[i].fd, &fds_err);\r\n    }\r\n  }\r\n\r\n  ptimeout = (timeout_ms < 0) ? NULL : &pending_tv;\r\n\r\n  do {\r\n    if(timeout_ms > 0) {\r\n      pending_tv.tv_sec = pending_ms / 1000;\r\n      pending_tv.tv_usec = (pending_ms % 1000) * 1000;\r\n    }\r\n    else if(!timeout_ms) {\r\n      pending_tv.tv_sec = 0;\r\n      pending_tv.tv_usec = 0;\r\n    }\r\n    r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout);\r\n    if(r != -1)\r\n      break;\r\n    error = SOCKERRNO;\r\n    if(error && error_not_EINTR)\r\n      break;\r\n    if(timeout_ms > 0) {\r\n      pending_ms = timeout_ms - elapsed_ms;\r\n      if(pending_ms <= 0)\r\n        break;\r\n    }\r\n  } while(r == -1);\r\n\r\n  if(r < 0)\r\n    return -1;\r\n  if(r == 0)\r\n    return 0;\r\n\r\n  r = 0;\r\n  for(i = 0; i < nfds; i++) {\r\n    ufds[i].revents = 0;\r\n    if(ufds[i].fd == CURL_SOCKET_BAD)\r\n      continue;\r\n    if(FD_ISSET(ufds[i].fd, &fds_read))\r\n      ufds[i].revents |= POLLIN;\r\n    if(FD_ISSET(ufds[i].fd, &fds_write))\r\n      ufds[i].revents |= POLLOUT;\r\n    if(FD_ISSET(ufds[i].fd, &fds_err))\r\n      ufds[i].revents |= POLLPRI;\r\n    if(ufds[i].revents != 0)\r\n      r++;\r\n  }\r\n\r\n#endif  /* HAVE_POLL_FINE */\r\n\r\n  return r;\r\n}\r\n\r\n#ifdef TPF\r\n/*\r\n * This is a replacement for select() on the TPF platform.\r\n * It is used whenever libcurl calls select().\r\n * The call below to tpf_process_signals() is required because\r\n * TPF's select calls are not signal interruptible.\r\n *\r\n * Return values are the same as select's.\r\n */\r\nint tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,\r\n                       fd_set* excepts, struct timeval* tv)\r\n{\r\n   int rc;\r\n\r\n   rc = tpf_select_bsd(maxfds, reads, writes, excepts, tv);\r\n   tpf_process_signals();\r\n   return(rc);\r\n}\r\n#endif /* TPF */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/select.h",
    "content": "#ifndef HEADER_CURL_SELECT_H\r\n#define HEADER_CURL_SELECT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_SYS_POLL_H\r\n#include <sys/poll.h>\r\n#elif defined(HAVE_POLL_H)\r\n#include <poll.h>\r\n#endif\r\n\r\n/*\r\n * Definition of pollfd struct and constants for platforms lacking them.\r\n */\r\n\r\n#if !defined(HAVE_STRUCT_POLLFD) && \\\r\n    !defined(HAVE_SYS_POLL_H) && \\\r\n    !defined(HAVE_POLL_H)\r\n\r\n#define POLLIN      0x01\r\n#define POLLPRI     0x02\r\n#define POLLOUT     0x04\r\n#define POLLERR     0x08\r\n#define POLLHUP     0x10\r\n#define POLLNVAL    0x20\r\n\r\nstruct pollfd\r\n{\r\n    curl_socket_t fd;\r\n    short   events;\r\n    short   revents;\r\n};\r\n\r\n#endif\r\n\r\n#ifndef POLLRDNORM\r\n#define POLLRDNORM POLLIN\r\n#endif\r\n\r\n#ifndef POLLWRNORM\r\n#define POLLWRNORM POLLOUT\r\n#endif\r\n\r\n#ifndef POLLRDBAND\r\n#define POLLRDBAND POLLPRI\r\n#endif\r\n\r\n/* there are three CSELECT defines that are defined in the public header that\r\n   are exposed to users, but this *IN2 bit is only ever used internally and\r\n   therefore defined here */\r\n#define CURL_CSELECT_IN2 (CURL_CSELECT_ERR << 1)\r\n\r\nint Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2,\r\n                      curl_socket_t writefd,\r\n                      long timeout_ms);\r\n\r\n/* provide the former API internally */\r\n#define Curl_socket_ready(x,y,z) \\\r\n  Curl_socket_check(x, CURL_SOCKET_BAD, y, z)\r\n\r\nint Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);\r\n\r\nint Curl_wait_ms(int timeout_ms);\r\n\r\n#ifdef TPF\r\nint tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,\r\n                       fd_set* excepts, struct timeval* tv);\r\n#endif\r\n\r\n/* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1], which\r\n   unfortunately makes it impossible for us to easily check if they're valid\r\n*/\r\n#if defined(USE_WINSOCK) || defined(TPF)\r\n#define VALID_SOCK(x) 1\r\n#define VERIFY_SOCK(x) Curl_nop_stmt\r\n#else\r\n#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))\r\n#define VERIFY_SOCK(x) do { \\\r\n  if(!VALID_SOCK(x)) { \\\r\n    SET_SOCKERRNO(EINVAL); \\\r\n    return -1; \\\r\n  } \\\r\n} WHILE_FALSE\r\n#endif\r\n\r\n#endif /* HEADER_CURL_SELECT_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/sendf.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"connect.h\"\r\n#include \"sslgen.h\"\r\n#include \"ssh.h\"\r\n#include \"multiif.h\"\r\n#include \"non-ascii.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use the internal *printf() functions */\r\n#include <curl/mprintf.h>\r\n\r\n/* the krb4 functions only exists for FTP and if krb4 or gssapi is defined */\r\n#if !defined(CURL_DISABLE_FTP) && (defined(HAVE_KRB4) || defined(HAVE_GSSAPI))\r\n#include \"krb4.h\"\r\n#else\r\n#define Curl_sec_send(a,b,c,d) -1\r\n#define Curl_sec_read(a,b,c,d) -1\r\n#endif\r\n\r\n#include \"curl_memory.h\"\r\n#include \"strerror.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef CURL_DO_LINEEND_CONV\r\n/*\r\n * convert_lineends() changes CRLF (\\r\\n) end-of-line markers to a single LF\r\n * (\\n), with special processing for CRLF sequences that are split between two\r\n * blocks of data.  Remaining, bare CRs are changed to LFs.  The possibly new\r\n * size of the data is returned.\r\n */\r\nstatic size_t convert_lineends(struct SessionHandle *data,\r\n                               char *startPtr, size_t size)\r\n{\r\n  char *inPtr, *outPtr;\r\n\r\n  /* sanity check */\r\n  if((startPtr == NULL) || (size < 1)) {\r\n    return(size);\r\n  }\r\n\r\n  if(data->state.prev_block_had_trailing_cr) {\r\n    /* The previous block of incoming data\r\n       had a trailing CR, which was turned into a LF. */\r\n    if(*startPtr == '\\n') {\r\n      /* This block of incoming data starts with the\r\n         previous block's LF so get rid of it */\r\n      memmove(startPtr, startPtr+1, size-1);\r\n      size--;\r\n      /* and it wasn't a bare CR but a CRLF conversion instead */\r\n      data->state.crlf_conversions++;\r\n    }\r\n    data->state.prev_block_had_trailing_cr = FALSE; /* reset the flag */\r\n  }\r\n\r\n  /* find 1st CR, if any */\r\n  inPtr = outPtr = memchr(startPtr, '\\r', size);\r\n  if(inPtr) {\r\n    /* at least one CR, now look for CRLF */\r\n    while(inPtr < (startPtr+size-1)) {\r\n      /* note that it's size-1, so we'll never look past the last byte */\r\n      if(memcmp(inPtr, \"\\r\\n\", 2) == 0) {\r\n        /* CRLF found, bump past the CR and copy the NL */\r\n        inPtr++;\r\n        *outPtr = *inPtr;\r\n        /* keep track of how many CRLFs we converted */\r\n        data->state.crlf_conversions++;\r\n      }\r\n      else {\r\n        if(*inPtr == '\\r') {\r\n          /* lone CR, move LF instead */\r\n          *outPtr = '\\n';\r\n        }\r\n        else {\r\n          /* not a CRLF nor a CR, just copy whatever it is */\r\n          *outPtr = *inPtr;\r\n        }\r\n      }\r\n      outPtr++;\r\n      inPtr++;\r\n    } /* end of while loop */\r\n\r\n    if(inPtr < startPtr+size) {\r\n      /* handle last byte */\r\n      if(*inPtr == '\\r') {\r\n        /* deal with a CR at the end of the buffer */\r\n        *outPtr = '\\n'; /* copy a NL instead */\r\n        /* note that a CRLF might be split across two blocks */\r\n        data->state.prev_block_had_trailing_cr = TRUE;\r\n      }\r\n      else {\r\n        /* copy last byte */\r\n        *outPtr = *inPtr;\r\n      }\r\n      outPtr++;\r\n    }\r\n    if(outPtr < startPtr+size)\r\n      /* tidy up by null terminating the now shorter data */\r\n      *outPtr = '\\0';\r\n\r\n    return(outPtr - startPtr);\r\n  }\r\n  return(size);\r\n}\r\n#endif /* CURL_DO_LINEEND_CONV */\r\n\r\n/* Curl_infof() is for info message along the way */\r\n\r\nvoid Curl_infof(struct SessionHandle *data, const char *fmt, ...)\r\n{\r\n  if(data && data->set.verbose) {\r\n    va_list ap;\r\n    size_t len;\r\n    char print_buffer[2048 + 1];\r\n    va_start(ap, fmt);\r\n    vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap);\r\n    va_end(ap);\r\n    len = strlen(print_buffer);\r\n    Curl_debug(data, CURLINFO_TEXT, print_buffer, len, NULL);\r\n  }\r\n}\r\n\r\n/* Curl_failf() is for messages stating why we failed.\r\n * The message SHALL NOT include any LF or CR.\r\n */\r\n\r\nvoid Curl_failf(struct SessionHandle *data, const char *fmt, ...)\r\n{\r\n  va_list ap;\r\n  size_t len;\r\n  va_start(ap, fmt);\r\n\r\n  vsnprintf(data->state.buffer, BUFSIZE, fmt, ap);\r\n\r\n  if(data->set.errorbuffer && !data->state.errorbuf) {\r\n    snprintf(data->set.errorbuffer, CURL_ERROR_SIZE, \"%s\", data->state.buffer);\r\n    data->state.errorbuf = TRUE; /* wrote error string */\r\n  }\r\n  if(data->set.verbose) {\r\n    len = strlen(data->state.buffer);\r\n    if(len < BUFSIZE - 1) {\r\n      data->state.buffer[len] = '\\n';\r\n      data->state.buffer[++len] = '\\0';\r\n    }\r\n    Curl_debug(data, CURLINFO_TEXT, data->state.buffer, len, NULL);\r\n  }\r\n\r\n  va_end(ap);\r\n}\r\n\r\n/* Curl_sendf() sends formated data to the server */\r\nCURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,\r\n                    const char *fmt, ...)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  ssize_t bytes_written;\r\n  size_t write_len;\r\n  CURLcode res = CURLE_OK;\r\n  char *s;\r\n  char *sptr;\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n  s = vaprintf(fmt, ap); /* returns an allocated string */\r\n  va_end(ap);\r\n  if(!s)\r\n    return CURLE_OUT_OF_MEMORY; /* failure */\r\n\r\n  bytes_written=0;\r\n  write_len = strlen(s);\r\n  sptr = s;\r\n\r\n  for(;;) {\r\n    /* Write the buffer to the socket */\r\n    res = Curl_write(conn, sockfd, sptr, write_len, &bytes_written);\r\n\r\n    if(CURLE_OK != res)\r\n      break;\r\n\r\n    if(data->set.verbose)\r\n      Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written, conn);\r\n\r\n    if((size_t)bytes_written != write_len) {\r\n      /* if not all was written at once, we must advance the pointer, decrease\r\n         the size left and try again! */\r\n      write_len -= bytes_written;\r\n      sptr += bytes_written;\r\n    }\r\n    else\r\n      break;\r\n  }\r\n\r\n  free(s); /* free the output string */\r\n\r\n  return res;\r\n}\r\n\r\n/*\r\n * Curl_write() is an internal write function that sends data to the\r\n * server. Works with plain sockets, SCP, SSL or kerberos.\r\n *\r\n * If the write would block (CURLE_AGAIN), we return CURLE_OK and\r\n * (*written == 0). Otherwise we return regular CURLcode value.\r\n */\r\nCURLcode Curl_write(struct connectdata *conn,\r\n                    curl_socket_t sockfd,\r\n                    const void *mem,\r\n                    size_t len,\r\n                    ssize_t *written)\r\n{\r\n  ssize_t bytes_written;\r\n  CURLcode curlcode = CURLE_OK;\r\n  int num = (sockfd == conn->sock[SECONDARYSOCKET]);\r\n\r\n  bytes_written = conn->send[num](conn, num, mem, len, &curlcode);\r\n\r\n  *written = bytes_written;\r\n  if(bytes_written >= 0)\r\n    /* we completely ignore the curlcode value when subzero is not returned */\r\n    return CURLE_OK;\r\n\r\n  /* handle CURLE_AGAIN or a send failure */\r\n  switch(curlcode) {\r\n  case CURLE_AGAIN:\r\n    *written = 0;\r\n    return CURLE_OK;\r\n\r\n  case CURLE_OK:\r\n    /* general send failure */\r\n    return CURLE_SEND_ERROR;\r\n\r\n  default:\r\n    /* we got a specific curlcode, forward it */\r\n    return curlcode;\r\n  }\r\n}\r\n\r\nssize_t Curl_send_plain(struct connectdata *conn, int num,\r\n                        const void *mem, size_t len, CURLcode *code)\r\n{\r\n  curl_socket_t sockfd = conn->sock[num];\r\n  ssize_t bytes_written = swrite(sockfd, mem, len);\r\n\r\n  *code = CURLE_OK;\r\n  if(-1 == bytes_written) {\r\n    int err = SOCKERRNO;\r\n\r\n    if(\r\n#ifdef WSAEWOULDBLOCK\r\n      /* This is how Windows does it */\r\n      (WSAEWOULDBLOCK == err)\r\n#else\r\n      /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned\r\n         due to its inability to send off data without blocking. We therefor\r\n         treat both error codes the same here */\r\n      (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err)\r\n#endif\r\n      ) {\r\n      /* this is just a case of EWOULDBLOCK */\r\n      bytes_written=0;\r\n      *code = CURLE_AGAIN;\r\n    }\r\n    else {\r\n      failf(conn->data, \"Send failure: %s\",\r\n            Curl_strerror(conn, err));\r\n      conn->data->state.os_errno = err;\r\n      *code = CURLE_SEND_ERROR;\r\n    }\r\n  }\r\n  return bytes_written;\r\n}\r\n\r\n/*\r\n * Curl_write_plain() is an internal write function that sends data to the\r\n * server using plain sockets only. Otherwise meant to have the exact same\r\n * proto as Curl_write()\r\n */\r\nCURLcode Curl_write_plain(struct connectdata *conn,\r\n                          curl_socket_t sockfd,\r\n                          const void *mem,\r\n                          size_t len,\r\n                          ssize_t *written)\r\n{\r\n  ssize_t bytes_written;\r\n  CURLcode retcode;\r\n  int num = (sockfd == conn->sock[SECONDARYSOCKET]);\r\n\r\n  bytes_written = Curl_send_plain(conn, num, mem, len, &retcode);\r\n\r\n  *written = bytes_written;\r\n\r\n  return retcode;\r\n}\r\n\r\nssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf,\r\n                        size_t len, CURLcode *code)\r\n{\r\n  curl_socket_t sockfd = conn->sock[num];\r\n  ssize_t nread = sread(sockfd, buf, len);\r\n\r\n  *code = CURLE_OK;\r\n  if(-1 == nread) {\r\n    int err = SOCKERRNO;\r\n\r\n    if(\r\n#ifdef WSAEWOULDBLOCK\r\n      /* This is how Windows does it */\r\n      (WSAEWOULDBLOCK == err)\r\n#else\r\n      /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned\r\n         due to its inability to send off data without blocking. We therefor\r\n         treat both error codes the same here */\r\n      (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err)\r\n#endif\r\n      ) {\r\n      /* this is just a case of EWOULDBLOCK */\r\n      *code = CURLE_AGAIN;\r\n    }\r\n    else {\r\n      failf(conn->data, \"Recv failure: %s\",\r\n            Curl_strerror(conn, err));\r\n      conn->data->state.os_errno = err;\r\n      *code = CURLE_RECV_ERROR;\r\n    }\r\n  }\r\n  return nread;\r\n}\r\n\r\nstatic CURLcode pausewrite(struct SessionHandle *data,\r\n                           int type, /* what type of data */\r\n                           const char *ptr,\r\n                           size_t len)\r\n{\r\n  /* signalled to pause sending on this connection, but since we have data\r\n     we want to send we need to dup it to save a copy for when the sending\r\n     is again enabled */\r\n  struct SingleRequest *k = &data->req;\r\n  char *dupl = malloc(len);\r\n  if(!dupl)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  memcpy(dupl, ptr, len);\r\n\r\n  /* store this information in the state struct for later use */\r\n  data->state.tempwrite = dupl;\r\n  data->state.tempwritesize = len;\r\n  data->state.tempwritetype = type;\r\n\r\n  /* mark the connection as RECV paused */\r\n  k->keepon |= KEEP_RECV_PAUSE;\r\n\r\n  DEBUGF(infof(data, \"Pausing with %zu bytes in buffer for type %02x\\n\",\r\n               len, type));\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/* Curl_client_write() sends data to the write callback(s)\r\n\r\n   The bit pattern defines to what \"streams\" to write to. Body and/or header.\r\n   The defines are in sendf.h of course.\r\n\r\n   If CURL_DO_LINEEND_CONV is enabled, data is converted IN PLACE to the\r\n   local character encoding.  This is a problem and should be changed in\r\n   the future to leave the original data alone.\r\n */\r\nCURLcode Curl_client_write(struct connectdata *conn,\r\n                           int type,\r\n                           char *ptr,\r\n                           size_t len)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  size_t wrote;\r\n\r\n  if(0 == len)\r\n    len = strlen(ptr);\r\n\r\n  /* If reading is actually paused, we're forced to append this chunk of data\r\n     to the already held data, but only if it is the same type as otherwise it\r\n     can't work and it'll return error instead. */\r\n  if(data->req.keepon & KEEP_RECV_PAUSE) {\r\n    size_t newlen;\r\n    char *newptr;\r\n    if(type != data->state.tempwritetype)\r\n      /* major internal confusion */\r\n      return CURLE_RECV_ERROR;\r\n\r\n    DEBUGASSERT(data->state.tempwrite);\r\n\r\n    /* figure out the new size of the data to save */\r\n    newlen = len + data->state.tempwritesize;\r\n    /* allocate the new memory area */\r\n    newptr = realloc(data->state.tempwrite, newlen);\r\n    if(!newptr)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    /* copy the new data to the end of the new area */\r\n    memcpy(newptr + data->state.tempwritesize, ptr, len);\r\n    /* update the pointer and the size */\r\n    data->state.tempwrite = newptr;\r\n    data->state.tempwritesize = newlen;\r\n\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(type & CLIENTWRITE_BODY) {\r\n    if((conn->handler->protocol&CURLPROTO_FTP) &&\r\n       conn->proto.ftpc.transfertype == 'A') {\r\n      /* convert from the network encoding */\r\n      CURLcode rc = Curl_convert_from_network(data, ptr, len);\r\n      /* Curl_convert_from_network calls failf if unsuccessful */\r\n      if(rc)\r\n        return rc;\r\n\r\n#ifdef CURL_DO_LINEEND_CONV\r\n      /* convert end-of-line markers */\r\n      len = convert_lineends(data, ptr, len);\r\n#endif /* CURL_DO_LINEEND_CONV */\r\n    }\r\n    /* If the previous block of data ended with CR and this block of data is\r\n       just a NL, then the length might be zero */\r\n    if(len) {\r\n      wrote = data->set.fwrite_func(ptr, 1, len, data->set.out);\r\n    }\r\n    else {\r\n      wrote = len;\r\n    }\r\n\r\n    if(CURL_WRITEFUNC_PAUSE == wrote)\r\n      return pausewrite(data, type, ptr, len);\r\n\r\n    if(wrote != len) {\r\n      failf(data, \"Failed writing body (%zu != %zu)\", wrote, len);\r\n      return CURLE_WRITE_ERROR;\r\n    }\r\n  }\r\n\r\n  if((type & CLIENTWRITE_HEADER) &&\r\n     (data->set.fwrite_header || data->set.writeheader) ) {\r\n    /*\r\n     * Write headers to the same callback or to the especially setup\r\n     * header callback function (added after version 7.7.1).\r\n     */\r\n    curl_write_callback writeit=\r\n      data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite_func;\r\n\r\n    /* Note: The header is in the host encoding\r\n       regardless of the ftp transfer mode (ASCII/Image) */\r\n\r\n    wrote = writeit(ptr, 1, len, data->set.writeheader);\r\n    if(CURL_WRITEFUNC_PAUSE == wrote)\r\n      /* here we pass in the HEADER bit only since if this was body as well\r\n         then it was passed already and clearly that didn't trigger the pause,\r\n         so this is saved for later with the HEADER bit only */\r\n      return pausewrite(data, CLIENTWRITE_HEADER, ptr, len);\r\n\r\n    if(wrote != len) {\r\n      failf (data, \"Failed writing header\");\r\n      return CURLE_WRITE_ERROR;\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_read_plain(curl_socket_t sockfd,\r\n                         char *buf,\r\n                         size_t bytesfromsocket,\r\n                         ssize_t *n)\r\n{\r\n  ssize_t nread = sread(sockfd, buf, bytesfromsocket);\r\n\r\n  if(-1 == nread) {\r\n    int err = SOCKERRNO;\r\n#ifdef USE_WINSOCK\r\n    if(WSAEWOULDBLOCK == err)\r\n#else\r\n    if((EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err))\r\n#endif\r\n      return CURLE_AGAIN;\r\n    else\r\n      return CURLE_RECV_ERROR;\r\n  }\r\n\r\n  /* we only return number of bytes read when we return OK */\r\n  *n = nread;\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Internal read-from-socket function. This is meant to deal with plain\r\n * sockets, SSL sockets and kerberos sockets.\r\n *\r\n * Returns a regular CURLcode value.\r\n */\r\nCURLcode Curl_read(struct connectdata *conn, /* connection data */\r\n                   curl_socket_t sockfd,     /* read from this socket */\r\n                   char *buf,                /* store read data here */\r\n                   size_t sizerequested,     /* max amount to read */\r\n                   ssize_t *n)               /* amount bytes read */\r\n{\r\n  CURLcode curlcode = CURLE_RECV_ERROR;\r\n  ssize_t nread = 0;\r\n  size_t bytesfromsocket = 0;\r\n  char *buffertofill = NULL;\r\n  bool pipelining = (conn->data->multi &&\r\n                     Curl_multi_canPipeline(conn->data->multi)) ? TRUE : FALSE;\r\n\r\n  /* Set 'num' to 0 or 1, depending on which socket that has been sent here.\r\n     If it is the second socket, we set num to 1. Otherwise to 0. This lets\r\n     us use the correct ssl handle. */\r\n  int num = (sockfd == conn->sock[SECONDARYSOCKET]);\r\n\r\n  *n=0; /* reset amount to zero */\r\n\r\n  /* If session can pipeline, check connection buffer  */\r\n  if(pipelining) {\r\n    size_t bytestocopy = CURLMIN(conn->buf_len - conn->read_pos,\r\n                                 sizerequested);\r\n\r\n    /* Copy from our master buffer first if we have some unread data there*/\r\n    if(bytestocopy > 0) {\r\n      memcpy(buf, conn->master_buffer + conn->read_pos, bytestocopy);\r\n      conn->read_pos += bytestocopy;\r\n      conn->bits.stream_was_rewound = FALSE;\r\n\r\n      *n = (ssize_t)bytestocopy;\r\n      return CURLE_OK;\r\n    }\r\n    /* If we come here, it means that there is no data to read from the buffer,\r\n     * so we read from the socket */\r\n    bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof (char));\r\n    buffertofill = conn->master_buffer;\r\n  }\r\n  else {\r\n    bytesfromsocket = CURLMIN((long)sizerequested,\r\n                              conn->data->set.buffer_size ?\r\n                              conn->data->set.buffer_size : BUFSIZE);\r\n    buffertofill = buf;\r\n  }\r\n\r\n  nread = conn->recv[num](conn, num, buffertofill, bytesfromsocket, &curlcode);\r\n  if(nread < 0)\r\n    return curlcode;\r\n\r\n  if(pipelining) {\r\n    memcpy(buf, conn->master_buffer, nread);\r\n    conn->buf_len = nread;\r\n    conn->read_pos = nread;\r\n  }\r\n\r\n  *n += nread;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* return 0 on success */\r\nstatic int showit(struct SessionHandle *data, curl_infotype type,\r\n                  char *ptr, size_t size)\r\n{\r\n  static const char s_infotype[CURLINFO_END][3] = {\r\n    \"* \", \"< \", \"> \", \"{ \", \"} \", \"{ \", \"} \" };\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  char buf[BUFSIZE+1];\r\n  size_t conv_size = 0;\r\n\r\n  switch(type) {\r\n  case CURLINFO_HEADER_OUT:\r\n    /* assume output headers are ASCII */\r\n    /* copy the data into my buffer so the original is unchanged */\r\n    if(size > BUFSIZE) {\r\n      size = BUFSIZE; /* truncate if necessary */\r\n      buf[BUFSIZE] = '\\0';\r\n    }\r\n    conv_size = size;\r\n    memcpy(buf, ptr, size);\r\n    /* Special processing is needed for this block if it\r\n     * contains both headers and data (separated by CRLFCRLF).\r\n     * We want to convert just the headers, leaving the data as-is.\r\n     */\r\n    if(size > 4) {\r\n      size_t i;\r\n      for(i = 0; i < size-4; i++) {\r\n        if(memcmp(&buf[i], \"\\x0d\\x0a\\x0d\\x0a\", 4) == 0) {\r\n          /* convert everything through this CRLFCRLF but no further */\r\n          conv_size = i + 4;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n    Curl_convert_from_network(data, buf, conv_size);\r\n    /* Curl_convert_from_network calls failf if unsuccessful */\r\n    /* we might as well continue even if it fails...   */\r\n    ptr = buf; /* switch pointer to use my buffer instead */\r\n    break;\r\n  default:\r\n    /* leave everything else as-is */\r\n    break;\r\n  }\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n  if(data->set.fdebug)\r\n    return (*data->set.fdebug)(data, type, ptr, size,\r\n                               data->set.debugdata);\r\n\r\n  switch(type) {\r\n  case CURLINFO_TEXT:\r\n  case CURLINFO_HEADER_OUT:\r\n  case CURLINFO_HEADER_IN:\r\n    fwrite(s_infotype[type], 2, 1, data->set.err);\r\n    fwrite(ptr, size, 1, data->set.err);\r\n#ifdef CURL_DOES_CONVERSIONS\r\n    if(size != conv_size) {\r\n      /* we had untranslated data so we need an explicit newline */\r\n      fwrite(\"\\n\", 1, 1, data->set.err);\r\n    }\r\n#endif\r\n    break;\r\n  default: /* nada */\r\n    break;\r\n  }\r\n  return 0;\r\n}\r\n\r\nint Curl_debug(struct SessionHandle *data, curl_infotype type,\r\n               char *ptr, size_t size,\r\n               struct connectdata *conn)\r\n{\r\n  int rc;\r\n  if(data->set.printhost && conn && conn->host.dispname) {\r\n    char buffer[160];\r\n    const char *t=NULL;\r\n    const char *w=\"Data\";\r\n    switch (type) {\r\n    case CURLINFO_HEADER_IN:\r\n      w = \"Header\";\r\n    case CURLINFO_DATA_IN:\r\n      t = \"from\";\r\n      break;\r\n    case CURLINFO_HEADER_OUT:\r\n      w = \"Header\";\r\n    case CURLINFO_DATA_OUT:\r\n      t = \"to\";\r\n      break;\r\n    default:\r\n      break;\r\n    }\r\n\r\n    if(t) {\r\n      snprintf(buffer, sizeof(buffer), \"[%s %s %s]\", w, t,\r\n               conn->host.dispname);\r\n      rc = showit(data, CURLINFO_TEXT, buffer, strlen(buffer));\r\n      if(rc)\r\n        return rc;\r\n    }\r\n  }\r\n  rc = showit(data, type, ptr, size);\r\n  return rc;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/sendf.h",
    "content": "#ifndef HEADER_CURL_SENDF_H\r\n#define HEADER_CURL_SENDF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\nCURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *,\r\n                    const char *fmt, ...);\r\nvoid Curl_infof(struct SessionHandle *, const char *fmt, ...);\r\nvoid Curl_failf(struct SessionHandle *, const char *fmt, ...);\r\n\r\n#if defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n\r\n#if defined(HAVE_VARIADIC_MACROS_C99)\r\n#define infof(...)  Curl_nop_stmt\r\n#elif defined(HAVE_VARIADIC_MACROS_GCC)\r\n#define infof(x...)  Curl_nop_stmt\r\n#else\r\n#define infof (void)\r\n#endif\r\n\r\n#else /* CURL_DISABLE_VERBOSE_STRINGS */\r\n\r\n#define infof Curl_infof\r\n\r\n#endif /* CURL_DISABLE_VERBOSE_STRINGS */\r\n\r\n#define failf Curl_failf\r\n\r\n#define CLIENTWRITE_BODY   (1<<0)\r\n#define CLIENTWRITE_HEADER (1<<1)\r\n#define CLIENTWRITE_BOTH   (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)\r\n\r\nCURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr,\r\n                           size_t len);\r\n\r\n/* internal read-function, does plain socket only */\r\nCURLcode Curl_read_plain(curl_socket_t sockfd,\r\n                         char *buf,\r\n                         size_t bytesfromsocket,\r\n                         ssize_t *n);\r\n\r\nssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf,\r\n                        size_t len, CURLcode *code);\r\nssize_t Curl_send_plain(struct connectdata *conn, int num,\r\n                        const void *mem, size_t len, CURLcode *code);\r\n\r\n/* internal read-function, does plain socket, SSL and krb4 */\r\nCURLcode Curl_read(struct connectdata *conn, curl_socket_t sockfd,\r\n                   char *buf, size_t buffersize,\r\n                   ssize_t *n);\r\n/* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */\r\nCURLcode Curl_write(struct connectdata *conn,\r\n                    curl_socket_t sockfd,\r\n                    const void *mem, size_t len,\r\n                    ssize_t *written);\r\n\r\n/* internal write-function, does plain sockets ONLY */\r\nCURLcode Curl_write_plain(struct connectdata *conn,\r\n                          curl_socket_t sockfd,\r\n                          const void *mem, size_t len,\r\n                          ssize_t *written);\r\n\r\n/* the function used to output verbose information */\r\nint Curl_debug(struct SessionHandle *handle, curl_infotype type,\r\n               char *data, size_t size,\r\n               struct connectdata *conn);\r\n\r\n\r\n#endif /* HEADER_CURL_SENDF_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/setup-os400.h",
    "content": "#ifndef HEADER_CURL_SETUP_OS400_H\r\n#define HEADER_CURL_SETUP_OS400_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n\r\n/* OS/400 netdb.h does not define NI_MAXHOST. */\r\n#define NI_MAXHOST      1025\r\n\r\n/* OS/400 netdb.h does not define NI_MAXSERV. */\r\n#define NI_MAXSERV      32\r\n\r\n/* No OS/400 header file defines u_int32_t. */\r\ntypedef unsigned long   u_int32_t;\r\n\r\n\r\n/* System API wrapper prototypes and definitions to support ASCII parameters. */\r\n\r\n#include <sys/socket.h>\r\n#include <netdb.h>\r\n#include <qsossl.h>\r\n#include <gssapi.h>\r\n\r\nextern int      Curl_getaddrinfo_a(const char * nodename, const char * servname,\r\n                                   const struct addrinfo * hints,\r\n                                   struct addrinfo * * res);\r\n#define getaddrinfo             Curl_getaddrinfo_a\r\n\r\n\r\nextern int      Curl_getnameinfo_a(const struct sockaddr * sa,\r\n                                   curl_socklen_t salen,\r\n                                   char * nodename, curl_socklen_t nodenamelen,\r\n                                   char * servname, curl_socklen_t servnamelen,\r\n                                   int flags);\r\n#define getnameinfo             Curl_getnameinfo_a\r\n\r\n\r\n/* SSL wrappers. */\r\n\r\nextern int      Curl_SSL_Init_Application_a(SSLInitApp * init_app);\r\n#define SSL_Init_Application    Curl_SSL_Init_Application_a\r\n\r\n\r\nextern int      Curl_SSL_Init_a(SSLInit * init);\r\n#define SSL_Init                Curl_SSL_Init_a\r\n\r\n\r\nextern char *   Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp);\r\n#define SSL_Strerror            Curl_SSL_Strerror_a\r\n\r\n\r\n/* GSSAPI wrappers. */\r\n\r\nextern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status,\r\n                                        gss_buffer_t in_name,\r\n                                        gss_OID in_name_type,\r\n                                        gss_name_t * out_name);\r\n#define gss_import_name         Curl_gss_import_name_a\r\n\r\n\r\nextern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status,\r\n                                           OM_uint32 status_value,\r\n                                           int status_type, gss_OID mech_type,\r\n                                           gss_msg_ctx_t * message_context,\r\n                                           gss_buffer_t status_string);\r\n#define gss_display_status      Curl_gss_display_status_a\r\n\r\n\r\nextern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,\r\n                                             gss_cred_id_t cred_handle,\r\n                                             gss_ctx_id_t * context_handle,\r\n                                             gss_name_t target_name,\r\n                                             gss_OID mech_type,\r\n                                             gss_flags_t req_flags,\r\n                                             OM_uint32 time_req,\r\n                                             gss_channel_bindings_t\r\n                                             input_chan_bindings,\r\n                                             gss_buffer_t input_token,\r\n                                             gss_OID * actual_mech_type,\r\n                                             gss_buffer_t output_token,\r\n                                             gss_flags_t * ret_flags,\r\n                                             OM_uint32 * time_rec);\r\n#define gss_init_sec_context    Curl_gss_init_sec_context_a\r\n\r\n\r\nextern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,\r\n                                               gss_ctx_id_t * context_handle,\r\n                                               gss_buffer_t output_token);\r\n#define gss_delete_sec_context  Curl_gss_delete_sec_context_a\r\n\r\n/* LDAP wrappers. */\r\n\r\n#define BerValue                struct berval\r\n\r\n#define ldap_url_parse          ldap_url_parse_utf8\r\n#define ldap_init               Curl_ldap_init_a\r\n#define ldap_simple_bind_s      Curl_ldap_simple_bind_s_a\r\n#define ldap_search_s           Curl_ldap_search_s_a\r\n#define ldap_get_values_len     Curl_ldap_get_values_len_a\r\n#define ldap_err2string         Curl_ldap_err2string_a\r\n#define ldap_get_dn             Curl_ldap_get_dn_a\r\n#define ldap_first_attribute    Curl_ldap_first_attribute_a\r\n#define ldap_next_attribute     Curl_ldap_next_attribute_a\r\n\r\n/* Some socket functions must be wrapped to process textual addresses\r\n   like AF_UNIX. */\r\n\r\nextern int Curl_os400_connect(int sd, struct sockaddr * destaddr, int addrlen);\r\nextern int Curl_os400_bind(int sd, struct sockaddr * localaddr, int addrlen);\r\nextern int Curl_os400_sendto(int sd, char * buffer, int buflen, int flags,\r\n            struct sockaddr * dstaddr, int addrlen);\r\nextern int Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags,\r\n                                struct sockaddr * fromaddr, int * addrlen);\r\n\r\n#define connect                 Curl_os400_connect\r\n#define bind                    Curl_os400_bind\r\n#define sendto                  Curl_os400_sendto\r\n#define recvfrom                Curl_os400_recvfrom\r\n\r\n\r\n#endif /* HEADER_CURL_SETUP_OS400_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/setup-vms.h",
    "content": "#ifndef HEADER_CURL_SETUP_VMS_H\r\n#define HEADER_CURL_SETUP_VMS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*                                                                         */\r\n/* JEM, 12/30/12, VMS now generates config.h, so only define wrappers for  */\r\n/*                getenv(), getpwuid() and provide is_vms_shell()          */\r\n/*                Also need upper case symbols for system services, and    */\r\n/*                OpenSSL, and some Kerberos image                         */\r\n\r\n#ifdef __DECC\r\n#pragma message save\r\n#pragma message disable dollarid\r\n#endif\r\n\r\n/* Hide the stuff we are overriding */\r\n#define getenv decc_getenv\r\n#ifdef __DECC\r\n#   if __INITIAL_POINTER_SIZE != 64\r\n#       define getpwuid decc_getpwuid\r\n#   endif\r\n#endif\r\n#include <stdlib.h>\r\n    char * decc$getenv(const char * __name);\r\n#include <pwd.h>\r\n\r\n#include <string.h>\r\n#include <unixlib.h>\r\n\r\n#undef getenv\r\n#undef getpwuid\r\n#define getenv vms_getenv\r\n#define getpwuid vms_getpwuid\r\n\r\n/* VAX needs these in upper case when compiling exact case */\r\n#define sys$assign SYS$ASSIGN\r\n#define sys$dassgn SYS$DASSGN\r\n#define sys$qiow SYS$QIOW\r\n\r\n#ifdef __DECC\r\n#   if __INITIAL_POINTER_SIZE\r\n#       pragma __pointer_size __save\r\n#   endif\r\n#endif\r\n\r\n#if __USE_LONG_GID_T\r\n#   define decc_getpwuid DECC$__LONG_GID_GETPWUID\r\n#else\r\n#   if __INITIAL_POINTER_SIZE\r\n#       define decc_getpwuid decc$__32_getpwuid\r\n#   else\r\n#       define decc_getpwuid decc$getpwuid\r\n#   endif\r\n#endif\r\n\r\n    struct passwd * decc_getpwuid(uid_t uid);\r\n\r\n#ifdef __DECC\r\n#   if __INITIAL_POINTER_SIZE == 32\r\n/* Translate the path, but only if the path is a VMS file specification */\r\n/* The translation is usually only needed for older versions of VMS */\r\nstatic char * vms_translate_path(const char * path) {\r\nchar * unix_path;\r\nchar * test_str;\r\n\r\n    /* See if the result is in VMS format, if not, we are done */\r\n    /* Assume that this is a PATH, not just some data */\r\n    test_str = strpbrk(path, \":[<^\");\r\n    if(test_str == NULL) {\r\n      return (char *)path;\r\n    }\r\n\r\n    unix_path = decc$translate_vms(path);\r\n\r\n    if((int)unix_path <= 0) {\r\n      /* We can not translate it, so return the original string */\r\n      return (char *)path;\r\n    }\r\n}\r\n#   else\r\n    /* VMS translate path is actually not needed on the current 64 bit */\r\n    /* VMS platforms, so instead of figuring out the pointer settings */\r\n    /* Change it to a noop */\r\n#   define vms_translate_path(__path) __path\r\n#   endif\r\n#endif\r\n\r\n#ifdef __DECC\r\n#   if __INITIAL_POINTER_SIZE\r\n#       pragma __pointer_size __restore\r\n#   endif\r\n#endif\r\n\r\nstatic char * vms_getenv(const char * envvar) {\r\n\r\nchar * result;\r\nchar * vms_path;\r\n\r\n    /* first use the DECC getenv() function */\r\n    result = decc$getenv(envvar);\r\n    if(result == NULL) {\r\n      return result;\r\n    }\r\n\r\n    vms_path = result;\r\n    result = vms_translate_path(vms_path);\r\n\r\n    /* note that if you backport this to use VAX C RTL, that the VAX C RTL */\r\n    /* may do a malloc(2048) for each call to getenv(), so you will need   */\r\n    /* to add a free(vms_path) */\r\n    /* Do not do a free() for DEC C RTL builds, which should be used for */\r\n    /* VMS 5.5-2 and later, even if using GCC */\r\n\r\n    return result;\r\n}\r\n\r\n\r\nstatic struct passwd vms_passwd_cache;\r\n\r\nstatic struct passwd * vms_getpwuid(uid_t uid) {\r\n\r\nstruct passwd * my_passwd;\r\n\r\n/* Hack needed to support 64 bit builds, decc_getpwnam is 32 bit only */\r\n#ifdef __DECC\r\n#   if __INITIAL_POINTER_SIZE\r\n__char_ptr32 unix_path;\r\n#   else\r\nchar * unix_path;\r\n#   endif\r\n#else\r\nchar * unix_path;\r\n#endif\r\n\r\n    my_passwd = decc_getpwuid(uid);\r\n    if(my_passwd == NULL) {\r\n      return my_passwd;\r\n    }\r\n\r\n    unix_path = vms_translate_path(my_passwd->pw_dir);\r\n\r\n    if((long)unix_path <= 0) {\r\n      /* We can not translate it, so return the original string */\r\n      return my_passwd;\r\n    }\r\n\r\n    /* If no changes needed just return it */\r\n    if(unix_path == my_passwd->pw_dir) {\r\n      return my_passwd;\r\n    }\r\n\r\n    /* Need to copy the structure returned */\r\n    /* Since curl is only using pw_dir, no need to fix up *\r\n    /* the pw_shell when running under Bash */\r\n    vms_passwd_cache.pw_name = my_passwd->pw_name;\r\n    vms_passwd_cache.pw_uid = my_passwd->pw_uid;\r\n    vms_passwd_cache.pw_gid = my_passwd->pw_uid;\r\n    vms_passwd_cache.pw_dir = unix_path;\r\n    vms_passwd_cache.pw_shell = my_passwd->pw_shell;\r\n\r\n    return &vms_passwd_cache;\r\n}\r\n\r\n#ifdef __DECC\r\n#pragma message restore\r\n#endif\r\n\r\n/* Bug - VMS OpenSSL and Kerberos universal symbols are in uppercase only */\r\n/* VMS libraries should have universal symbols in exact and uppercase */\r\n\r\n#define ASN1_INTEGER_get ASN1_INTEGER_GET\r\n#define ASN1_STRING_data ASN1_STRING_DATA\r\n#define ASN1_STRING_length ASN1_STRING_LENGTH\r\n#define ASN1_STRING_print ASN1_STRING_PRINT\r\n#define ASN1_STRING_to_UTF8 ASN1_STRING_TO_UTF8\r\n#define ASN1_STRING_type ASN1_STRING_TYPE\r\n#define BIO_ctrl BIO_CTRL\r\n#define BIO_free BIO_FREE\r\n#define BIO_new BIO_NEW\r\n#define BIO_s_mem BIO_S_MEM\r\n#define BN_bn2bin BN_BN2BIN\r\n#define BN_num_bits BN_NUM_BITS\r\n#define CRYPTO_cleanup_all_ex_data CRYPTO_CLEANUP_ALL_EX_DATA\r\n#define CRYPTO_free CRYPTO_FREE\r\n#define CRYPTO_malloc CRYPTO_MALLOC\r\n#define DES_ecb_encrypt DES_ECB_ENCRYPT\r\n#define DES_set_key DES_SET_KEY\r\n#define DES_set_odd_parity DES_SET_ODD_PARITY\r\n#define ENGINE_ctrl ENGINE_CTRL\r\n#define ENGINE_ctrl_cmd ENGINE_CTRL_CMD\r\n#define ENGINE_finish ENGINE_FINISH\r\n#define ENGINE_free ENGINE_FREE\r\n#define ENGINE_get_first ENGINE_GET_FIRST\r\n#define ENGINE_get_id ENGINE_GET_ID\r\n#define ENGINE_get_next ENGINE_GET_NEXT\r\n#define ENGINE_init ENGINE_INIT\r\n#define ENGINE_load_builtin_engines ENGINE_LOAD_BUILTIN_ENGINES\r\n#define ENGINE_load_private_key ENGINE_LOAD_PRIVATE_KEY\r\n#define ENGINE_set_default ENGINE_SET_DEFAULT\r\n#define ERR_clear_error ERR_CLEAR_ERROR\r\n#define ERR_error_string ERR_ERROR_STRING\r\n#define ERR_error_string_n ERR_ERROR_STRING_N\r\n#define ERR_free_strings ERR_FREE_STRINGS\r\n#define ERR_get_error ERR_GET_ERROR\r\n#define ERR_peek_error ERR_PEEK_ERROR\r\n#define ERR_remove_state ERR_REMOVE_STATE\r\n#define EVP_PKEY_copy_parameters EVP_PKEY_COPY_PARAMETERS\r\n#define EVP_PKEY_free EVP_PKEY_FREE\r\n#define EVP_cleanup EVP_CLEANUP\r\n#define GENERAL_NAMES_free GENERAL_NAMES_FREE\r\n#define MD4_Final MD4_FINAL\r\n#define MD4_Init MD4_INIT\r\n#define MD4_Update MD4_UPDATE\r\n#define MD5_Final MD5_FINAL\r\n#define MD5_Init MD5_INIT\r\n#define MD5_Update MD5_UPDATE\r\n#define OPENSSL_add_all_algo_noconf OPENSSL_ADD_ALL_ALGO_NOCONF\r\n#define PEM_read_X509 PEM_READ_X509\r\n#define PEM_write_bio_X509 PEM_WRITE_BIO_X509\r\n#define PKCS12_PBE_add PKCS12_PBE_ADD\r\n#define PKCS12_free PKCS12_FREE\r\n#define PKCS12_parse PKCS12_PARSE\r\n#define RAND_add RAND_ADD\r\n#define RAND_bytes RAND_BYTES\r\n#define RAND_egd RAND_EGD\r\n#define RAND_file_name RAND_FILE_NAME\r\n#define RAND_load_file RAND_LOAD_FILE\r\n#define RAND_status RAND_STATUS\r\n#define SSL_CIPHER_get_name SSL_CIPHER_GET_NAME\r\n#define SSL_CTX_add_client_CA SSL_CTX_ADD_CLIENT_CA\r\n#define SSL_CTX_callback_ctrl SSL_CTX_CALLBACK_CTRL\r\n#define SSL_CTX_check_private_key SSL_CTX_CHECK_PRIVATE_KEY\r\n#define SSL_CTX_ctrl SSL_CTX_CTRL\r\n#define SSL_CTX_free SSL_CTX_FREE\r\n#define SSL_CTX_get_cert_store SSL_CTX_GET_CERT_STORE\r\n#define SSL_CTX_load_verify_locations SSL_CTX_LOAD_VERIFY_LOCATIONS\r\n#define SSL_CTX_new SSL_CTX_NEW\r\n#define SSL_CTX_set_cipher_list SSL_CTX_SET_CIPHER_LIST\r\n#define SSL_CTX_set_def_passwd_cb_ud SSL_CTX_SET_DEF_PASSWD_CB_UD\r\n#define SSL_CTX_set_default_passwd_cb SSL_CTX_SET_DEFAULT_PASSWD_CB\r\n#define SSL_CTX_set_verify SSL_CTX_SET_VERIFY\r\n#define SSL_CTX_use_PrivateKey SSL_CTX_USE_PRIVATEKEY\r\n#define SSL_CTX_use_PrivateKey_file SSL_CTX_USE_PRIVATEKEY_FILE\r\n#define SSL_CTX_use_cert_chain_file SSL_CTX_USE_CERT_CHAIN_FILE\r\n#define SSL_CTX_use_certificate SSL_CTX_USE_CERTIFICATE\r\n#define SSL_CTX_use_certificate_file SSL_CTX_USE_CERTIFICATE_FILE\r\n#define SSL_SESSION_free SSL_SESSION_FREE\r\n#define SSL_connect SSL_CONNECT\r\n#define SSL_free SSL_FREE\r\n#define SSL_get1_session SSL_GET1_SESSION\r\n#define SSL_get_certificate SSL_GET_CERTIFICATE\r\n#define SSL_get_current_cipher SSL_GET_CURRENT_CIPHER\r\n#define SSL_get_error SSL_GET_ERROR\r\n#define SSL_get_peer_cert_chain SSL_GET_PEER_CERT_CHAIN\r\n#define SSL_get_peer_certificate SSL_GET_PEER_CERTIFICATE\r\n#define SSL_get_privatekey SSL_GET_PRIVATEKEY\r\n#define SSL_get_shutdown SSL_GET_SHUTDOWN\r\n#define SSL_get_verify_result SSL_GET_VERIFY_RESULT\r\n#define SSL_library_init SSL_LIBRARY_INIT\r\n#define SSL_load_error_strings SSL_LOAD_ERROR_STRINGS\r\n#define SSL_new SSL_NEW\r\n#define SSL_peek SSL_PEEK\r\n#define SSL_pending SSL_PENDING\r\n#define SSL_read SSL_READ\r\n#define SSL_set_connect_state SSL_SET_CONNECT_STATE\r\n#define SSL_set_fd SSL_SET_FD\r\n#define SSL_set_session SSL_SET_SESSION\r\n#define SSL_shutdown SSL_SHUTDOWN\r\n#define SSL_write SSL_WRITE\r\n#define SSLeay SSLEAY\r\n#define SSLv23_client_method SSLV23_CLIENT_METHOD\r\n#define SSLv3_client_method SSLV3_CLIENT_METHOD\r\n#define TLSv1_client_method TLSV1_CLIENT_METHOD\r\n#define UI_OpenSSL UI_OPENSSL\r\n#define X509V3_EXT_print X509V3_EXT_PRINT\r\n#define X509_EXTENSION_get_critical X509_EXTENSION_GET_CRITICAL\r\n#define X509_EXTENSION_get_object X509_EXTENSION_GET_OBJECT\r\n#define X509_LOOKUP_file X509_LOOKUP_FILE\r\n#define X509_NAME_ENTRY_get_data X509_NAME_ENTRY_GET_DATA\r\n#define X509_NAME_get_entry X509_NAME_GET_ENTRY\r\n#define X509_NAME_get_index_by_NID X509_NAME_GET_INDEX_BY_NID\r\n#define X509_NAME_print_ex X509_NAME_PRINT_EX\r\n#define X509_STORE_CTX_get_current_cert X509_STORE_CTX_GET_CURRENT_CERT\r\n#define X509_STORE_add_lookup X509_STORE_ADD_LOOKUP\r\n#define X509_STORE_set_flags X509_STORE_SET_FLAGS\r\n#define X509_check_issued X509_CHECK_ISSUED\r\n#define X509_free X509_FREE\r\n#define X509_get_ext_d2i X509_GET_EXT_D2I\r\n#define X509_get_issuer_name X509_GET_ISSUER_NAME\r\n#define X509_get_pubkey X509_GET_PUBKEY\r\n#define X509_get_serialNumber X509_GET_SERIALNUMBER\r\n#define X509_get_subject_name X509_GET_SUBJECT_NAME\r\n#define X509_load_crl_file X509_LOAD_CRL_FILE\r\n#define X509_verify_cert_error_string X509_VERIFY_CERT_ERROR_STRING\r\n#define d2i_PKCS12_fp D2I_PKCS12_FP\r\n#define i2t_ASN1_OBJECT I2T_ASN1_OBJECT\r\n#define sk_num SK_NUM\r\n#define sk_pop_free SK_POP_FREE\r\n#define sk_value SK_VALUE\r\n\r\n#define USE_UPPERCASE_GSSAPI 1\r\n#define gss_seal GSS_SEAL\r\n#define gss_unseal GSS_UNSEAL\r\n\r\n#define USE_UPPERCASE_KRBAPI 1\r\n\r\n/* AI_NUMERICHOST needed for IP V6 support in Curl */\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#ifndef AI_NUMERICHOST\r\n#ifdef ENABLE_IPV6\r\n#undef ENABLE_IPV6\r\n#endif\r\n#endif\r\n#endif\r\n\r\n/* VAX symbols are always in uppercase */\r\n#ifdef __VAX\r\n#define inflate INFLATE\r\n#define inflateEnd INFLATEEND\r\n#define inflateInit2_ INFLATEINIT2_\r\n#define inflateInit_ INFLATEINIT_\r\n#define zlibVersion ZLIBVERSION\r\n#endif\r\n\r\n/* Older VAX OpenSSL port defines these as Macros */\r\n/* Need to include the headers first and then redefine */\r\n/* that way a newer port will also work if some one has one */\r\n#ifdef __VAX\r\n\r\n#   if (OPENSSL_VERSION_NUMBER < 0x00907001L)\r\n#       define des_set_odd_parity DES_SET_ODD_PARITY\r\n#       define des_set_key DES_SET_KEY\r\n#       define des_ecb_encrypt DES_ECB_ENCRYPT\r\n\r\n#   endif\r\n#   include <openssl/evp.h>\r\n#   ifndef OpenSSL_add_all_algorithms\r\n#       define OpenSSL_add_all_algorithms OPENSSL_ADD_ALL_ALGORITHMS\r\n        void OPENSSL_ADD_ALL_ALGORITHMS(void);\r\n#   endif\r\n\r\n    /* Curl defines these to lower case and VAX needs them in upper case */\r\n    /* So we need static routines */\r\n#   if (OPENSSL_VERSION_NUMBER < 0x00907001L)\r\n\r\n#       undef des_set_odd_parity\r\n#       undef DES_set_odd_parity\r\n#       undef des_set_key\r\n#       undef DES_set_key\r\n#       undef des_ecb_encrypt\r\n#       undef DES_ecb_encrypt\r\n\r\n        static void des_set_odd_parity(des_cblock *key) {\r\n            DES_SET_ODD_PARITY(key);\r\n        }\r\n\r\n        static int des_set_key(const_des_cblock *key,\r\n                               des_key_schedule schedule) {\r\n            return DES_SET_KEY(key, schedule);\r\n        }\r\n\r\n        static void des_ecb_encrypt(const_des_cblock *input,\r\n                                    des_cblock *output,\r\n                                    des_key_schedule ks,int enc) {\r\n            DES_ECB_ENCRYPT(input, output, ks, enc);\r\n        }\r\n#endif\r\n/* Need this to stop a macro redefinition error */\r\n#if OPENSSL_VERSION_NUMBER < 0x00907000L\r\n#   ifdef X509_STORE_set_flags\r\n#       undef X509_STORE_set_flags\r\n#       define X509_STORE_set_flags(x,y) Curl_nop_stmt\r\n#   endif\r\n#endif\r\n#endif\r\n\r\n#endif /* HEADER_CURL_SETUP_VMS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/share.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"share_curl.h\"\r\n#include \"sslgen.h\"\r\n#include \"curl_memory.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nCURLSH *\r\ncurl_share_init(void)\r\n{\r\n  struct Curl_share *share = calloc(1, sizeof(struct Curl_share));\r\n  if(share)\r\n    share->specifier |= (1<<CURL_LOCK_DATA_SHARE);\r\n\r\n  return share;\r\n}\r\n\r\n#undef curl_share_setopt\r\nCURLSHcode\r\ncurl_share_setopt(CURLSH *sh, CURLSHoption option, ...)\r\n{\r\n  struct Curl_share *share = (struct Curl_share *)sh;\r\n  va_list param;\r\n  int type;\r\n  curl_lock_function lockfunc;\r\n  curl_unlock_function unlockfunc;\r\n  void *ptr;\r\n  CURLSHcode res = CURLSHE_OK;\r\n\r\n  if(share->dirty)\r\n    /* don't allow setting options while one or more handles are already\r\n       using this share */\r\n    return CURLSHE_IN_USE;\r\n\r\n  va_start(param, option);\r\n\r\n  switch(option) {\r\n  case CURLSHOPT_SHARE:\r\n    /* this is a type this share will share */\r\n    type = va_arg(param, int);\r\n    share->specifier |= (1<<type);\r\n    switch( type ) {\r\n    case CURL_LOCK_DATA_DNS:\r\n      if(!share->hostcache) {\r\n        share->hostcache = Curl_mk_dnscache();\r\n        if(!share->hostcache)\r\n          res = CURLSHE_NOMEM;\r\n      }\r\n      break;\r\n\r\n    case CURL_LOCK_DATA_COOKIE:\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n      if(!share->cookies) {\r\n        share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );\r\n        if(!share->cookies)\r\n          res = CURLSHE_NOMEM;\r\n      }\r\n#else   /* CURL_DISABLE_HTTP */\r\n      res = CURLSHE_NOT_BUILT_IN;\r\n#endif\r\n      break;\r\n\r\n    case CURL_LOCK_DATA_SSL_SESSION:\r\n#ifdef USE_SSL\r\n      if(!share->sslsession) {\r\n        share->max_ssl_sessions = 8;\r\n        share->sslsession = calloc(share->max_ssl_sessions,\r\n                                   sizeof(struct curl_ssl_session));\r\n        share->sessionage = 0;\r\n        if(!share->sslsession)\r\n          res = CURLSHE_NOMEM;\r\n      }\r\n#else\r\n      res = CURLSHE_NOT_BUILT_IN;\r\n#endif\r\n      break;\r\n\r\n    case CURL_LOCK_DATA_CONNECT:     /* not supported (yet) */\r\n      break;\r\n\r\n    default:\r\n      res = CURLSHE_BAD_OPTION;\r\n    }\r\n    break;\r\n\r\n  case CURLSHOPT_UNSHARE:\r\n    /* this is a type this share will no longer share */\r\n    type = va_arg(param, int);\r\n    share->specifier &= ~(1<<type);\r\n    switch( type ) {\r\n    case CURL_LOCK_DATA_DNS:\r\n      if(share->hostcache) {\r\n        Curl_hash_destroy(share->hostcache);\r\n        share->hostcache = NULL;\r\n      }\r\n      break;\r\n\r\n    case CURL_LOCK_DATA_COOKIE:\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n      if(share->cookies) {\r\n        Curl_cookie_cleanup(share->cookies);\r\n        share->cookies = NULL;\r\n      }\r\n#else   /* CURL_DISABLE_HTTP */\r\n      res = CURLSHE_NOT_BUILT_IN;\r\n#endif\r\n      break;\r\n\r\n    case CURL_LOCK_DATA_SSL_SESSION:\r\n#ifdef USE_SSL\r\n      Curl_safefree(share->sslsession);\r\n#else\r\n      res = CURLSHE_NOT_BUILT_IN;\r\n#endif\r\n      break;\r\n\r\n    case CURL_LOCK_DATA_CONNECT:\r\n      break;\r\n\r\n    default:\r\n      res = CURLSHE_BAD_OPTION;\r\n      break;\r\n    }\r\n    break;\r\n\r\n  case CURLSHOPT_LOCKFUNC:\r\n    lockfunc = va_arg(param, curl_lock_function);\r\n    share->lockfunc = lockfunc;\r\n    break;\r\n\r\n  case CURLSHOPT_UNLOCKFUNC:\r\n    unlockfunc = va_arg(param, curl_unlock_function);\r\n    share->unlockfunc = unlockfunc;\r\n    break;\r\n\r\n  case CURLSHOPT_USERDATA:\r\n    ptr = va_arg(param, void *);\r\n    share->clientdata = ptr;\r\n    break;\r\n\r\n  default:\r\n    res = CURLSHE_BAD_OPTION;\r\n    break;\r\n  }\r\n\r\n  va_end(param);\r\n\r\n  return res;\r\n}\r\n\r\nCURLSHcode\r\ncurl_share_cleanup(CURLSH *sh)\r\n{\r\n  struct Curl_share *share = (struct Curl_share *)sh;\r\n\r\n  if(share == NULL)\r\n    return CURLSHE_INVALID;\r\n\r\n  if(share->lockfunc)\r\n    share->lockfunc(NULL, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE,\r\n                    share->clientdata);\r\n\r\n  if(share->dirty) {\r\n    if(share->unlockfunc)\r\n      share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);\r\n    return CURLSHE_IN_USE;\r\n  }\r\n\r\n  if(share->hostcache) {\r\n    Curl_hash_destroy(share->hostcache);\r\n    share->hostcache = NULL;\r\n  }\r\n\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n  if(share->cookies)\r\n    Curl_cookie_cleanup(share->cookies);\r\n#endif\r\n\r\n#ifdef USE_SSL\r\n  if(share->sslsession) {\r\n    size_t i;\r\n    for(i = 0; i < share->max_ssl_sessions; i++)\r\n      Curl_ssl_kill_session(&(share->sslsession[i]));\r\n    free(share->sslsession);\r\n  }\r\n#endif\r\n\r\n  if(share->unlockfunc)\r\n    share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);\r\n  free(share);\r\n\r\n  return CURLSHE_OK;\r\n}\r\n\r\n\r\nCURLSHcode\r\nCurl_share_lock(struct SessionHandle *data, curl_lock_data type,\r\n                curl_lock_access accesstype)\r\n{\r\n  struct Curl_share *share = data->share;\r\n\r\n  if(share == NULL)\r\n    return CURLSHE_INVALID;\r\n\r\n  if(share->specifier & (1<<type)) {\r\n    if(share->lockfunc) /* only call this if set! */\r\n      share->lockfunc(data, type, accesstype, share->clientdata);\r\n  }\r\n  /* else if we don't share this, pretend successful lock */\r\n\r\n  return CURLSHE_OK;\r\n}\r\n\r\nCURLSHcode\r\nCurl_share_unlock(struct SessionHandle *data, curl_lock_data type)\r\n{\r\n  struct Curl_share *share = data->share;\r\n\r\n  if(share == NULL)\r\n    return CURLSHE_INVALID;\r\n\r\n  if(share->specifier & (1<<type)) {\r\n    if(share->unlockfunc) /* only call this if set! */\r\n      share->unlockfunc (data, type, share->clientdata);\r\n  }\r\n\r\n  return CURLSHE_OK;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/share_curl.h",
    "content": "#ifndef HEADER_CURL_SHARE_H\r\n#define HEADER_CURL_SHARE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n#include <curl/curl.h>\r\n#include \"cookie.h\"\r\n#include \"urldata.h\"\r\n\r\n/* SalfordC says \"A structure member may not be volatile\". Hence:\r\n */\r\n#ifdef __SALFORDC__\r\n#define CURL_VOLATILE\r\n#else\r\n#define CURL_VOLATILE volatile\r\n#endif\r\n\r\n/* this struct is libcurl-private, don't export details */\r\nstruct Curl_share {\r\n  unsigned int specifier;\r\n  CURL_VOLATILE unsigned int dirty;\r\n\r\n  curl_lock_function lockfunc;\r\n  curl_unlock_function unlockfunc;\r\n  void *clientdata;\r\n\r\n  struct curl_hash *hostcache;\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n  struct CookieInfo *cookies;\r\n#endif\r\n\r\n  struct curl_ssl_session *sslsession;\r\n  size_t max_ssl_sessions;\r\n  long sessionage;\r\n};\r\n\r\nCURLSHcode Curl_share_lock (struct SessionHandle *, curl_lock_data,\r\n                            curl_lock_access);\r\nCURLSHcode Curl_share_unlock (struct SessionHandle *, curl_lock_data);\r\n\r\n#endif /* HEADER_CURL_SHARE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/slist.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"curl_memory.h\"\r\n#include \"slist.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* returns last node in linked list */\r\nstatic struct curl_slist *slist_get_last(struct curl_slist *list)\r\n{\r\n  struct curl_slist     *item;\r\n\r\n  /* if caller passed us a NULL, return now */\r\n  if(!list)\r\n    return NULL;\r\n\r\n  /* loop through to find the last item */\r\n  item = list;\r\n  while(item->next) {\r\n    item = item->next;\r\n  }\r\n  return item;\r\n}\r\n\r\n/*\r\n * curl_slist_append() appends a string to the linked list. It always returns\r\n * the address of the first record, so that you can use this function as an\r\n * initialization function as well as an append function. If you find this\r\n * bothersome, then simply create a separate _init function and call it\r\n * appropriately from within the program.\r\n */\r\nstruct curl_slist *curl_slist_append(struct curl_slist *list,\r\n                                     const char *data)\r\n{\r\n  struct curl_slist     *last;\r\n  struct curl_slist     *new_item;\r\n\r\n  new_item = malloc(sizeof(struct curl_slist));\r\n  if(new_item) {\r\n    char *dupdata = strdup(data);\r\n    if(dupdata) {\r\n      new_item->next = NULL;\r\n      new_item->data = dupdata;\r\n    }\r\n    else {\r\n      free(new_item);\r\n      return NULL;\r\n    }\r\n  }\r\n  else\r\n    return NULL;\r\n\r\n  if(list) {\r\n    last = slist_get_last(list);\r\n    last->next = new_item;\r\n    return list;\r\n  }\r\n\r\n  /* if this is the first item, then new_item *is* the list */\r\n  return new_item;\r\n}\r\n\r\n/*\r\n * Curl_slist_duplicate() duplicates a linked list. It always returns the\r\n * address of the first record of the cloned list or NULL in case of an\r\n * error (or if the input list was NULL).\r\n */\r\nstruct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist)\r\n{\r\n  struct curl_slist *outlist = NULL;\r\n  struct curl_slist *tmp;\r\n\r\n  while(inlist) {\r\n    tmp = curl_slist_append(outlist, inlist->data);\r\n\r\n    if(!tmp) {\r\n      curl_slist_free_all(outlist);\r\n      return NULL;\r\n    }\r\n\r\n    outlist = tmp;\r\n    inlist = inlist->next;\r\n  }\r\n  return outlist;\r\n}\r\n\r\n/* be nice and clean up resources */\r\nvoid curl_slist_free_all(struct curl_slist *list)\r\n{\r\n  struct curl_slist     *next;\r\n  struct curl_slist     *item;\r\n\r\n  if(!list)\r\n    return;\r\n\r\n  item = list;\r\n  do {\r\n    next = item->next;\r\n    Curl_safefree(item->data);\r\n    free(item);\r\n    item = next;\r\n  } while(next);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/slist.h",
    "content": "#ifndef HEADER_CURL_SLIST_H\r\n#define HEADER_CURL_SLIST_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Curl_slist_duplicate() duplicates a linked list. It always returns the\r\n * address of the first record of the cloned list or NULL in case of an\r\n * error (or if the input list was NULL).\r\n */\r\nstruct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist);\r\n\r\n#endif /* HEADER_CURL_SLIST_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/smtp.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n * RFC1870 SMTP Service Extension for Message Size\r\n * RFC2195 CRAM-MD5 authentication\r\n * RFC2831 DIGEST-MD5 authentication\r\n * RFC3207 SMTP over TLS\r\n * RFC4422 Simple Authentication and Security Layer (SASL)\r\n * RFC4616 PLAIN authentication\r\n * RFC4954 SMTP Authentication\r\n * RFC5321 SMTP protocol\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_SMTP\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_UTSNAME_H\r\n#include <sys/utsname.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"if2ip.h\"\r\n#include \"hostip.h\"\r\n#include \"progress.h\"\r\n#include \"transfer.h\"\r\n#include \"escape.h\"\r\n#include \"http.h\" /* for HTTP proxy tunnel stuff */\r\n#include \"socks.h\"\r\n#include \"smtp.h\"\r\n\r\n#include \"strtoofft.h\"\r\n#include \"strequal.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"select.h\"\r\n#include \"multiif.h\"\r\n#include \"url.h\"\r\n#include \"rawstr.h\"\r\n#include \"curl_gethostname.h\"\r\n#include \"curl_sasl.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Local API functions */\r\nstatic CURLcode smtp_regular_transfer(struct connectdata *conn, bool *done);\r\nstatic CURLcode smtp_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode smtp_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature);\r\nstatic CURLcode smtp_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode smtp_disconnect(struct connectdata *conn, bool dead);\r\nstatic CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done);\r\nstatic int smtp_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks);\r\nstatic CURLcode smtp_doing(struct connectdata *conn, bool *dophase_done);\r\nstatic CURLcode smtp_setup_connection(struct connectdata *conn);\r\nstatic CURLcode smtp_state_upgrade_tls(struct connectdata *conn);\r\n\r\n/*\r\n * SMTP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_smtp = {\r\n  \"SMTP\",                           /* scheme */\r\n  smtp_setup_connection,            /* setup_connection */\r\n  smtp_do,                          /* do_it */\r\n  smtp_done,                        /* done */\r\n  ZERO_NULL,                        /* do_more */\r\n  smtp_connect,                     /* connect_it */\r\n  smtp_multi_statemach,             /* connecting */\r\n  smtp_doing,                       /* doing */\r\n  smtp_getsock,                     /* proto_getsock */\r\n  smtp_getsock,                     /* doing_getsock */\r\n  ZERO_NULL,                        /* domore_getsock */\r\n  ZERO_NULL,                        /* perform_getsock */\r\n  smtp_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                        /* readwrite */\r\n  PORT_SMTP,                        /* defport */\r\n  CURLPROTO_SMTP,                   /* protocol */\r\n  PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * SMTPS protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_smtps = {\r\n  \"SMTPS\",                          /* scheme */\r\n  smtp_setup_connection,            /* setup_connection */\r\n  smtp_do,                          /* do_it */\r\n  smtp_done,                        /* done */\r\n  ZERO_NULL,                        /* do_more */\r\n  smtp_connect,                     /* connect_it */\r\n  smtp_multi_statemach,             /* connecting */\r\n  smtp_doing,                       /* doing */\r\n  smtp_getsock,                     /* proto_getsock */\r\n  smtp_getsock,                     /* doing_getsock */\r\n  ZERO_NULL,                        /* domore_getsock */\r\n  ZERO_NULL,                        /* perform_getsock */\r\n  smtp_disconnect,                  /* disconnect */\r\n  ZERO_NULL,                        /* readwrite */\r\n  PORT_SMTPS,                       /* defport */\r\n  CURLPROTO_SMTP | CURLPROTO_SMTPS, /* protocol */\r\n  PROTOPT_CLOSEACTION | PROTOPT_SSL\r\n  | PROTOPT_NOURLQUERY              /* flags */\r\n};\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n/*\r\n * HTTP-proxyed SMTP protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_smtp_proxy = {\r\n  \"SMTP\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_SMTP,                            /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\n#ifdef USE_SSL\r\n/*\r\n * HTTP-proxyed SMTPS protocol handler.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_smtps_proxy = {\r\n  \"SMTPS\",                              /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  Curl_http,                            /* do_it */\r\n  Curl_http_done,                       /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_SMTPS,                           /* defport */\r\n  CURLPROTO_HTTP,                       /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n#endif\r\n#endif\r\n\r\n/* Function that checks for an ending smtp status code at the start of the\r\n   given string, but also detects the supported authentication mechanisms\r\n   from  the EHLO AUTH response. */\r\nstatic int smtp_endofresp(struct pingpong *pp, int *resp)\r\n{\r\n  char *line = pp->linestart_resp;\r\n  size_t len = pp->nread_resp;\r\n  struct connectdata *conn = pp->conn;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  int result;\r\n  size_t wordlen;\r\n\r\n  if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2]))\r\n    return FALSE;       /* Nothing for us */\r\n\r\n  /* Extract the response code if necessary */\r\n  if((result = (line[3] == ' ')) != 0)\r\n    *resp = curlx_sltosi(strtol(line, NULL, 10));\r\n\r\n  line += 4;\r\n  len -= 4;\r\n\r\n  /* Does the server support the SIZE capability? */\r\n  if(smtpc->state == SMTP_EHLO && len >= 4 && !memcmp(line, \"SIZE\", 4)) {\r\n    DEBUGF(infof(conn->data, \"Server supports SIZE extension.\\n\"));\r\n    smtpc->size_supported = true;\r\n  }\r\n\r\n  /* Do we have the authentication mechanism list? */\r\n  if(smtpc->state == SMTP_EHLO && len >= 5 && !memcmp(line, \"AUTH \", 5)) {\r\n    line += 5;\r\n    len -= 5;\r\n\r\n    for(;;) {\r\n      while(len &&\r\n            (*line == ' ' || *line == '\\t' ||\r\n             *line == '\\r' || *line == '\\n')) {\r\n        line++;\r\n        len--;\r\n      }\r\n\r\n      if(!len)\r\n        break;\r\n\r\n      /* Extract the word */\r\n      for(wordlen = 0; wordlen < len && line[wordlen] != ' ' &&\r\n            line[wordlen] != '\\t' && line[wordlen] != '\\r' &&\r\n            line[wordlen] != '\\n';)\r\n        wordlen++;\r\n\r\n      /* Test the word for a matching authentication mechanism */\r\n      if(wordlen == 5 && !memcmp(line, \"LOGIN\", 5))\r\n        smtpc->authmechs |= SASL_MECH_LOGIN;\r\n      else if(wordlen == 5 && !memcmp(line, \"PLAIN\", 5))\r\n        smtpc->authmechs |= SASL_MECH_PLAIN;\r\n      else if(wordlen == 8 && !memcmp(line, \"CRAM-MD5\", 8))\r\n        smtpc->authmechs |= SASL_MECH_CRAM_MD5;\r\n      else if(wordlen == 10 && !memcmp(line, \"DIGEST-MD5\", 10))\r\n        smtpc->authmechs |= SASL_MECH_DIGEST_MD5;\r\n      else if(wordlen == 6 && !memcmp(line, \"GSSAPI\", 6))\r\n        smtpc->authmechs |= SASL_MECH_GSSAPI;\r\n      else if(wordlen == 8 && !memcmp(line, \"EXTERNAL\", 8))\r\n        smtpc->authmechs |= SASL_MECH_EXTERNAL;\r\n      else if(wordlen == 4 && !memcmp(line, \"NTLM\", 4))\r\n        smtpc->authmechs |= SASL_MECH_NTLM;\r\n\r\n      line += wordlen;\r\n      len -= wordlen;\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* This is the ONLY way to change SMTP state! */\r\nstatic void state(struct connectdata *conn, smtpstate newstate)\r\n{\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  /* for debug purposes */\r\n  static const char * const names[] = {\r\n    \"STOP\",\r\n    \"SERVERGREET\",\r\n    \"EHLO\",\r\n    \"HELO\",\r\n    \"STARTTLS\",\r\n    \"UPGRADETLS\",\r\n    \"AUTH_PLAIN\",\r\n    \"AUTH_LOGIN\",\r\n    \"AUTH_PASSWD\",\r\n    \"AUTH_CRAMMD5\",\r\n    \"AUTH_DIGESTMD5\",\r\n    \"AUTH_DIGESTMD5_RESP\",\r\n    \"AUTH_NTLM\",\r\n    \"AUTH_NTLM_TYPE2MSG\",\r\n    \"AUTH\",\r\n    \"MAIL\",\r\n    \"RCPT\",\r\n    \"DATA\",\r\n    \"POSTDATA\",\r\n    \"QUIT\",\r\n    /* LAST */\r\n  };\r\n\r\n  if(smtpc->state != newstate)\r\n    infof(conn->data, \"SMTP %p state change from %s to %s\\n\",\r\n          smtpc, names[smtpc->state], names[newstate]);\r\n#endif\r\n\r\n  smtpc->state = newstate;\r\n}\r\n\r\nstatic CURLcode smtp_state_ehlo(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n\r\n  smtpc->authmechs = 0;         /* No known authentication mechanisms yet */\r\n  smtpc->authused = 0;          /* Clear the authentication mechanism used\r\n                                   for esmtp connections */\r\n\r\n  /* Send the EHLO command */\r\n  result = Curl_pp_sendf(&smtpc->pp, \"EHLO %s\", smtpc->domain);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, SMTP_EHLO);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode smtp_state_helo(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n\r\n  smtpc->authused = 0;          /* No authentication mechanism used in smtp\r\n                                   connections */\r\n\r\n  /* Send the HELO command */\r\n  result = Curl_pp_sendf(&smtpc->pp, \"HELO %s\", smtpc->domain);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, SMTP_HELO);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode smtp_authenticate(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  char *initresp = NULL;\r\n  const char *mech = NULL;\r\n  size_t len = 0;\r\n  smtpstate state1 = SMTP_STOP;\r\n  smtpstate state2 = SMTP_STOP;\r\n\r\n  /* Check we have a username and password to authenticate with and end the\r\n     connect phase if we don't */\r\n  if(!conn->bits.user_passwd) {\r\n    state(conn, SMTP_STOP);\r\n\r\n    return result;\r\n  }\r\n\r\n  /* Calculate the supported authentication mechanism, by decreasing order of\r\n     security, as well as the initial response where appropriate */\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n  if(smtpc->authmechs & SASL_MECH_DIGEST_MD5) {\r\n    mech = \"DIGEST-MD5\";\r\n    state1 = SMTP_AUTH_DIGESTMD5;\r\n    smtpc->authused = SASL_MECH_DIGEST_MD5;\r\n  }\r\n  else if(smtpc->authmechs & SASL_MECH_CRAM_MD5) {\r\n    mech = \"CRAM-MD5\";\r\n    state1 = SMTP_AUTH_CRAMMD5;\r\n    smtpc->authused = SASL_MECH_CRAM_MD5;\r\n  }\r\n  else\r\n#endif\r\n#ifdef USE_NTLM\r\n  if(smtpc->authmechs & SASL_MECH_NTLM) {\r\n    mech = \"NTLM\";\r\n    state1 = SMTP_AUTH_NTLM;\r\n    state2 = SMTP_AUTH_NTLM_TYPE2MSG;\r\n    smtpc->authused = SASL_MECH_NTLM;\r\n    result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &initresp, &len);\r\n  }\r\n  else\r\n#endif\r\n  if(smtpc->authmechs & SASL_MECH_LOGIN) {\r\n    mech = \"LOGIN\";\r\n    state1 = SMTP_AUTH_LOGIN;\r\n    state2 = SMTP_AUTH_PASSWD;\r\n    smtpc->authused = SASL_MECH_LOGIN;\r\n    result = Curl_sasl_create_login_message(conn->data, conn->user,\r\n                                            &initresp, &len);\r\n  }\r\n  else if(smtpc->authmechs & SASL_MECH_PLAIN) {\r\n    mech = \"PLAIN\";\r\n    state1 = SMTP_AUTH_PLAIN;\r\n    state2 = SMTP_AUTH;\r\n    smtpc->authused = SASL_MECH_PLAIN;\r\n    result = Curl_sasl_create_plain_message(conn->data, conn->user,\r\n                                            conn->passwd, &initresp, &len);\r\n  }\r\n  else {\r\n    /* Other mechanisms not supported */\r\n    infof(conn->data, \"No known authentication mechanisms supported!\\n\");\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  if(!result) {\r\n    /* Perform SASL based authentication */\r\n    if(initresp &&\r\n       strlen(mech) + len <= 512 - 8) { /* AUTH <mech> ...<crlf> */\r\n       result = Curl_pp_sendf(&smtpc->pp, \"AUTH %s %s\", mech, initresp);\r\n\r\n      if(!result)\r\n        state(conn, state2);\r\n    }\r\n    else {\r\n      result = Curl_pp_sendf(&smtpc->pp, \"AUTH %s\", mech);\r\n\r\n      if(!result)\r\n        state(conn, state1);\r\n    }\r\n\r\n    Curl_safefree(initresp);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For the SMTP \"protocol connect\" and \"doing\" phases only */\r\nstatic int smtp_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks)\r\n{\r\n  return Curl_pp_getsock(&conn->proto.smtpc.pp, socks, numsocks);\r\n}\r\n\r\n#ifdef USE_SSL\r\nstatic void smtp_to_smtps(struct connectdata *conn)\r\n{\r\n  conn->handler = &Curl_handler_smtps;\r\n}\r\n#else\r\n#define smtp_to_smtps(x) Curl_nop_stmt\r\n#endif\r\n\r\n/* For the initial server greeting */\r\nstatic CURLcode smtp_state_servergreet_resp(struct connectdata *conn,\r\n                                            int smtpcode,\r\n                                            smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode/100 != 2) {\r\n    failf(data, \"Got unexpected smtp-server response: %d\", smtpcode);\r\n    return CURLE_FTP_WEIRD_SERVER_REPLY;\r\n  }\r\n\r\n  result = smtp_state_ehlo(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For STARTTLS responses */\r\nstatic CURLcode smtp_state_starttls_resp(struct connectdata *conn,\r\n                                         int smtpcode,\r\n                                         smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 220) {\r\n    if(data->set.use_ssl != CURLUSESSL_TRY) {\r\n      failf(data, \"STARTTLS denied. %c\", smtpcode);\r\n      result = CURLE_USE_SSL_FAILED;\r\n    }\r\n    else\r\n      result = smtp_authenticate(conn);\r\n  }\r\n  else\r\n    result = smtp_state_upgrade_tls(conn);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode smtp_state_upgrade_tls(struct connectdata *conn)\r\n{\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  CURLcode result;\r\n\r\n  result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);\r\n\r\n  if(!result) {\r\n    if(smtpc->state != SMTP_UPGRADETLS)\r\n      state(conn, SMTP_UPGRADETLS);\r\n\r\n    if(smtpc->ssldone) {\r\n      smtp_to_smtps(conn);\r\n      result = smtp_state_ehlo(conn);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For EHLO responses */\r\nstatic CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode,\r\n                                     smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode/100 != 2) {\r\n    if((data->set.use_ssl <= CURLUSESSL_TRY || conn->ssl[FIRSTSOCKET].use) &&\r\n     !conn->bits.user_passwd)\r\n      result = smtp_state_helo(conn);\r\n    else {\r\n      failf(data, \"Remote access denied: %d\", smtpcode);\r\n      result = CURLE_REMOTE_ACCESS_DENIED;\r\n    }\r\n  }\r\n  else if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {\r\n    /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch\r\n       to TLS connection now */\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"STARTTLS\");\r\n    if(!result)\r\n      state(conn, SMTP_STARTTLS);\r\n  }\r\n  else\r\n    result = smtp_authenticate(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* For HELO responses */\r\nstatic CURLcode smtp_state_helo_resp(struct connectdata *conn, int smtpcode,\r\n                                     smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode/100 != 2) {\r\n    failf(data, \"Remote access denied: %d\", smtpcode);\r\n    result = CURLE_REMOTE_ACCESS_DENIED;\r\n  }\r\n  else\r\n    /* End of connect phase */\r\n    state(conn, SMTP_STOP);\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH PLAIN (without initial response) responses */\r\nstatic CURLcode smtp_state_auth_plain_resp(struct connectdata *conn,\r\n                                           int smtpcode,\r\n                                           smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *plainauth = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the authorisation message */\r\n    result = Curl_sasl_create_plain_message(conn->data, conn->user,\r\n                                            conn->passwd, &plainauth, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(plainauth) {\r\n        result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", plainauth);\r\n\r\n        if(!result)\r\n          state(conn, SMTP_AUTH);\r\n      }\r\n\r\n      Curl_safefree(plainauth);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH LOGIN (without initial response) responses */\r\nstatic CURLcode smtp_state_auth_login_resp(struct connectdata *conn,\r\n                                           int smtpcode,\r\n                                           smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *authuser = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the user message */\r\n    result = Curl_sasl_create_login_message(conn->data, conn->user,\r\n                                            &authuser, &len);\r\n\r\n    /* Send the user */\r\n    if(!result) {\r\n      if(authuser) {\r\n        result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", authuser);\r\n\r\n        if(!result)\r\n          state(conn, SMTP_AUTH_PASSWD);\r\n      }\r\n\r\n      Curl_safefree(authuser);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For responses to user entry of AUTH LOGIN */\r\nstatic CURLcode smtp_state_auth_passwd_resp(struct connectdata *conn,\r\n                                            int smtpcode,\r\n                                            smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t len = 0;\r\n  char *authpasswd = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the password message */\r\n    result = Curl_sasl_create_login_message(conn->data, conn->passwd,\r\n                                            &authpasswd, &len);\r\n\r\n    /* Send the password */\r\n    if(!result) {\r\n      if(authpasswd) {\r\n        result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", authpasswd);\r\n\r\n        if(!result)\r\n          state(conn, SMTP_AUTH);\r\n      }\r\n\r\n      Curl_safefree(authpasswd);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n/* For AUTH CRAM-MD5 responses */\r\nstatic CURLcode smtp_state_auth_cram_resp(struct connectdata *conn,\r\n                                          int smtpcode,\r\n                                          smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *chlg64 = data->state.buffer;\r\n  size_t len = 0;\r\n  char *rplyb64 = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Get the challenge */\r\n  for(chlg64 += 4; *chlg64 == ' ' || *chlg64 == '\\t'; chlg64++)\r\n    ;\r\n\r\n  /* Terminate the challenge */\r\n  if(*chlg64 != '=') {\r\n    for(len = strlen(chlg64); len--;)\r\n      if(chlg64[len] != '\\r' && chlg64[len] != '\\n' && chlg64[len] != ' ' &&\r\n         chlg64[len] != '\\t')\r\n        break;\r\n\r\n    if(++len) {\r\n      chlg64[len] = '\\0';\r\n    }\r\n  }\r\n\r\n  /* Create the response message */\r\n  result = Curl_sasl_create_cram_md5_message(data, chlg64, conn->user,\r\n                                             conn->passwd, &rplyb64, &len);\r\n\r\n  /* Send the response */\r\n  if(!result) {\r\n    if(rplyb64) {\r\n      result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", rplyb64);\r\n\r\n      if(!result)\r\n        state(conn, SMTP_AUTH);\r\n    }\r\n\r\n    Curl_safefree(rplyb64);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH DIGEST-MD5 challenge responses */\r\nstatic CURLcode smtp_state_auth_digest_resp(struct connectdata *conn,\r\n                                            int smtpcode,\r\n                                            smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *chlg64 = data->state.buffer;\r\n  size_t len = 0;\r\n  char *rplyb64 = NULL;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    return CURLE_LOGIN_DENIED;\r\n  }\r\n\r\n  /* Get the challenge */\r\n  for(chlg64 += 4; *chlg64 == ' ' || *chlg64 == '\\t'; chlg64++)\r\n    ;\r\n\r\n  /* Create the response message */\r\n  result = Curl_sasl_create_digest_md5_message(data, chlg64, conn->user,\r\n                                               conn->passwd, \"smtp\",\r\n                                               &rplyb64, &len);\r\n\r\n  /* Send the response */\r\n  if(!result) {\r\n    if(rplyb64) {\r\n      result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", rplyb64);\r\n\r\n      if(!result)\r\n        state(conn, SMTP_AUTH_DIGESTMD5_RESP);\r\n    }\r\n\r\n    Curl_safefree(rplyb64);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For AUTH DIGEST-MD5 challenge-response responses */\r\nstatic CURLcode smtp_state_auth_digest_resp_resp(struct connectdata *conn,\r\n                                                 int smtpcode,\r\n                                                 smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Authentication failed: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Send an empty response */\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"\");\r\n\r\n    if(!result)\r\n      state(conn, SMTP_AUTH);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n/* For AUTH NTLM (without initial response) responses */\r\nstatic CURLcode smtp_state_auth_ntlm_resp(struct connectdata *conn,\r\n                                          int smtpcode,\r\n                                          smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *type1msg = NULL;\r\n  size_t len = 0;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the type-1 message */\r\n    result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &type1msg, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(type1msg) {\r\n        result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", type1msg);\r\n\r\n        if(!result)\r\n          state(conn, SMTP_AUTH_NTLM_TYPE2MSG);\r\n      }\r\n\r\n      Curl_safefree(type1msg);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For NTLM type-2 responses (sent in reponse to our type-1 message) */\r\nstatic CURLcode smtp_state_auth_ntlm_type2msg_resp(struct connectdata *conn,\r\n                                                   int smtpcode,\r\n                                                   smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  char *type3msg = NULL;\r\n  size_t len = 0;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 334) {\r\n    failf(data, \"Access denied: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else {\r\n    /* Create the type-3 message */\r\n    result = Curl_sasl_create_ntlm_type3_message(data,\r\n                                                 data->state.buffer + 4,\r\n                                                 conn->user, conn->passwd,\r\n                                                 &conn->ntlm,\r\n                                                 &type3msg, &len);\r\n\r\n    /* Send the message */\r\n    if(!result) {\r\n      if(type3msg) {\r\n        result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"%s\", type3msg);\r\n\r\n        if(!result)\r\n          state(conn, SMTP_AUTH);\r\n      }\r\n\r\n      Curl_safefree(type3msg);\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n#endif\r\n\r\n/* For the final responses to the AUTH sequence */\r\nstatic CURLcode smtp_state_auth_resp(struct connectdata *conn, int smtpcode,\r\n                                     smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 235) {\r\n    failf(data, \"Authentication failed: %d\", smtpcode);\r\n    result = CURLE_LOGIN_DENIED;\r\n  }\r\n  else\r\n    /* End of connect phase */\r\n    state(conn, SMTP_STOP);\r\n\r\n  return result;\r\n}\r\n\r\n/* Start the DO phase */\r\nstatic CURLcode smtp_mail(struct connectdata *conn)\r\n{\r\n  char *from = NULL;\r\n  char *auth = NULL;\r\n  char *size = NULL;\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* Calculate the FROM parameter */\r\n  if(!data->set.str[STRING_MAIL_FROM])\r\n    /* Null reverse-path, RFC-2821, sect. 3.7 */\r\n    from = strdup(\"<>\");\r\n  else if(data->set.str[STRING_MAIL_FROM][0] == '<')\r\n    from = aprintf(\"%s\", data->set.str[STRING_MAIL_FROM]);\r\n  else\r\n    from = aprintf(\"<%s>\", data->set.str[STRING_MAIL_FROM]);\r\n\r\n  if(!from)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* Calculate the optional AUTH parameter */\r\n  if(data->set.str[STRING_MAIL_AUTH] && conn->proto.smtpc.authused) {\r\n    if(data->set.str[STRING_MAIL_AUTH][0] != '\\0')\r\n      auth = aprintf(\"%s\", data->set.str[STRING_MAIL_AUTH]);\r\n    else\r\n      /* Empty AUTH, RFC-2554, sect. 5 */\r\n      auth = strdup(\"<>\");\r\n\r\n    if(!auth) {\r\n      Curl_safefree(from);\r\n\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* calculate the optional SIZE parameter */\r\n  if(conn->proto.smtpc.size_supported && conn->data->set.infilesize > 0) {\r\n    size = aprintf(\"%\" FORMAT_OFF_T, data->set.infilesize);\r\n\r\n    if(!size) {\r\n      Curl_safefree(from);\r\n      Curl_safefree(auth);\r\n\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* Send the MAIL command */\r\n  if(!auth && !size)\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp,\r\n                           \"MAIL FROM:%s\", from);\r\n  else if(auth && !size)\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp,\r\n                           \"MAIL FROM:%s AUTH=%s\", from, auth);\r\n  else if(auth && size)\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp,\r\n                           \"MAIL FROM:%s AUTH=%s SIZE=%s\", from, auth, size);\r\n  else\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp,\r\n                           \"MAIL FROM:%s SIZE=%s\", from, size);\r\n\r\n  Curl_safefree(from);\r\n  Curl_safefree(auth);\r\n  Curl_safefree(size);\r\n\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, SMTP_MAIL);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode smtp_rcpt_to(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n\r\n  /* Send the RCPT TO command */\r\n  if(smtpc->rcpt) {\r\n    if(smtpc->rcpt->data[0] == '<')\r\n      result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"RCPT TO:%s\",\r\n                             smtpc->rcpt->data);\r\n    else\r\n      result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"RCPT TO:<%s>\",\r\n                             smtpc->rcpt->data);\r\n    if(!result)\r\n      state(conn, SMTP_RCPT);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For MAIL responses */\r\nstatic CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode,\r\n                                     smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode/100 != 2) {\r\n    failf(data, \"MAIL failed: %d\", smtpcode);\r\n    result = CURLE_SEND_ERROR;\r\n    state(conn, SMTP_STOP);\r\n  }\r\n  else {\r\n    struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n    smtpc->rcpt = data->set.mail_rcpt;\r\n\r\n    result = smtp_rcpt_to(conn);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For RCPT responses */\r\nstatic CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,\r\n                                     smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode/100 != 2) {\r\n    failf(data, \"RCPT failed: %d\", smtpcode);\r\n    result = CURLE_SEND_ERROR;\r\n    state(conn, SMTP_STOP);\r\n  }\r\n  else {\r\n    struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n\r\n    if(smtpc->rcpt) {\r\n      smtpc->rcpt = smtpc->rcpt->next;\r\n      result = smtp_rcpt_to(conn);\r\n\r\n      /* If we failed or still are sending RCPT data then return */\r\n      if(result || smtpc->rcpt)\r\n        return result;\r\n    }\r\n\r\n    /* Send the DATA command */\r\n    result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"DATA\");\r\n\r\n    if(result)\r\n      return result;\r\n\r\n    state(conn, SMTP_DATA);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* For DATA response */\r\nstatic CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode,\r\n                                     smtpstate instate)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *smtp = data->state.proto.smtp;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 354) {\r\n    state(conn, SMTP_STOP);\r\n    return CURLE_SEND_ERROR;\r\n  }\r\n\r\n  /* SMTP upload */\r\n  Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */\r\n                      FIRSTSOCKET, smtp->bytecountp);\r\n\r\n  /* End of do phase */\r\n  state(conn, SMTP_STOP);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* For POSTDATA responses, which are received after the entire DATA\r\n   part has been sent to the server */\r\nstatic CURLcode smtp_state_postdata_resp(struct connectdata *conn,\r\n                                         int smtpcode,\r\n                                         smtpstate instate)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  (void)instate; /* no use for this yet */\r\n\r\n  if(smtpcode != 250)\r\n    result = CURLE_RECV_ERROR;\r\n\r\n  /* End of done phase */\r\n  state(conn, SMTP_STOP);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode smtp_statemach_act(struct connectdata *conn)\r\n{\r\n  CURLcode result;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  struct SessionHandle *data = conn->data;\r\n  int smtpcode;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  struct pingpong *pp = &smtpc->pp;\r\n  size_t nread = 0;\r\n\r\n  /* Busy upgrading the connection; right now all I/O is SSL/TLS, not SMTP */\r\n  if(smtpc->state == SMTP_UPGRADETLS)\r\n    return smtp_state_upgrade_tls(conn);\r\n\r\n  /* Flush any data that needs to be sent */\r\n  if(pp->sendleft)\r\n    return Curl_pp_flushsend(pp);\r\n\r\n  /* Read the response from the server */\r\n  result = Curl_pp_readresp(sock, pp, &smtpcode, &nread);\r\n  if(result)\r\n    return result;\r\n\r\n  /* Store the latest response for later retrieval */\r\n  if(smtpc->state != SMTP_QUIT)\r\n    data->info.httpcode = smtpcode;\r\n\r\n  if(smtpcode) {\r\n    /* We have now received a full SMTP server response */\r\n    switch(smtpc->state) {\r\n    case SMTP_SERVERGREET:\r\n      result = smtp_state_servergreet_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_EHLO:\r\n      result = smtp_state_ehlo_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_HELO:\r\n      result = smtp_state_helo_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_STARTTLS:\r\n      result = smtp_state_starttls_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_AUTH_PLAIN:\r\n      result = smtp_state_auth_plain_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_AUTH_LOGIN:\r\n      result = smtp_state_auth_login_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_AUTH_PASSWD:\r\n      result = smtp_state_auth_passwd_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n#ifndef CURL_DISABLE_CRYPTO_AUTH\r\n    case SMTP_AUTH_CRAMMD5:\r\n      result = smtp_state_auth_cram_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_AUTH_DIGESTMD5:\r\n      result = smtp_state_auth_digest_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_AUTH_DIGESTMD5_RESP:\r\n      result = smtp_state_auth_digest_resp_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n#endif\r\n\r\n#ifdef USE_NTLM\r\n    case SMTP_AUTH_NTLM:\r\n      result = smtp_state_auth_ntlm_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_AUTH_NTLM_TYPE2MSG:\r\n      result = smtp_state_auth_ntlm_type2msg_resp(conn, smtpcode,\r\n                                                  smtpc->state);\r\n      break;\r\n#endif\r\n\r\n    case SMTP_AUTH:\r\n      result = smtp_state_auth_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_MAIL:\r\n      result = smtp_state_mail_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_RCPT:\r\n      result = smtp_state_rcpt_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_DATA:\r\n      result = smtp_state_data_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_POSTDATA:\r\n      result = smtp_state_postdata_resp(conn, smtpcode, smtpc->state);\r\n      break;\r\n\r\n    case SMTP_QUIT:\r\n      /* fallthrough, just stop! */\r\n    default:\r\n      /* internal error */\r\n      state(conn, SMTP_STOP);\r\n      break;\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Called repeatedly until done from multi.c */\r\nstatic CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done)\r\n{\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  CURLcode result;\r\n\r\n  if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone)\r\n    result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);\r\n  else\r\n    result = Curl_pp_multi_statemach(&smtpc->pp);\r\n\r\n  *done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE;\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode smtp_easy_statemach(struct connectdata *conn)\r\n{\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  struct pingpong *pp = &smtpc->pp;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  while(smtpc->state != SMTP_STOP) {\r\n    result = Curl_pp_easy_statemach(pp);\r\n    if(result)\r\n      break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Allocate and initialize the SMTP struct for the current SessionHandle if\r\n   required */\r\nstatic CURLcode smtp_init(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *smtp = data->state.proto.smtp;\r\n\r\n  if(!smtp) {\r\n    smtp = data->state.proto.smtp = calloc(sizeof(struct FTP), 1);\r\n    if(!smtp)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  /* Get some initial data into the smtp struct */\r\n  smtp->bytecountp = &data->req.bytecount;\r\n\r\n  /* No need to duplicate user+password, the connectdata struct won't change\r\n     during a session, but we re-init them here since on subsequent inits\r\n     since the conn struct may have changed or been replaced.\r\n  */\r\n  smtp->user = conn->user;\r\n  smtp->passwd = conn->passwd;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_connect()\r\n *\r\n * This function should do everything that is to be considered a part of\r\n * the connection phase.\r\n *\r\n * The variable pointed to by 'done' will be TRUE if the protocol-layer\r\n * connect phase is done when this function returns, or FALSE if not. When\r\n * called as a part of the easy interface, it will always be TRUE.\r\n */\r\nstatic CURLcode smtp_connect(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  struct pingpong *pp = &smtpc->pp;\r\n  const char *path = conn->data->state.path;\r\n  char localhost[HOSTNAME_MAX + 1];\r\n\r\n  *done = FALSE; /* default to not done yet */\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  result = smtp_init(conn);\r\n  if(CURLE_OK != result)\r\n    return result;\r\n\r\n  /* We always support persistent connections on smtp */\r\n  conn->bits.close = FALSE;\r\n\r\n  pp->response_time = RESP_TIMEOUT; /* set default response time-out */\r\n  pp->statemach_act = smtp_statemach_act;\r\n  pp->endofresp = smtp_endofresp;\r\n  pp->conn = conn;\r\n\r\n  /* Initialise the response reader stuff */\r\n  Curl_pp_init(pp);\r\n\r\n  /* Set the default response time-out */\r\n  pp->response_time = RESP_TIMEOUT;\r\n  pp->statemach_act = smtp_statemach_act;\r\n  pp->endofresp = smtp_endofresp;\r\n  pp->conn = conn;\r\n\r\n  /* Calculate the path if necessary */\r\n  if(!*path) {\r\n    if(!Curl_gethostname(localhost, sizeof(localhost)))\r\n      path = localhost;\r\n    else\r\n      path = \"localhost\";\r\n  }\r\n\r\n  /* URL decode the path and use it as the domain in our EHLO */\r\n  result = Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL, TRUE);\r\n  if(result)\r\n    return result;\r\n\r\n  /* Start off waiting for the server greeting response */\r\n  state(conn, SMTP_SERVERGREET);\r\n\r\n  result = smtp_multi_statemach(conn, done);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_done()\r\n *\r\n * The DONE function. This does what needs to be done after a single DO has\r\n * performed.\r\n *\r\n * Input argument is already checked for validity.\r\n */\r\nstatic CURLcode smtp_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct FTP *smtp = data->state.proto.smtp;\r\n  CURLcode result = CURLE_OK;\r\n  ssize_t bytes_written;\r\n\r\n  (void)premature;\r\n\r\n  if(!smtp)\r\n    /* When the easy handle is removed from the multi while libcurl is still\r\n     * trying to resolve the host name, it seems that the smtp struct is not\r\n     * yet initialized, but the removal action calls Curl_done() which calls\r\n     * this function. So we simply return success if no smtp pointer is set.\r\n     */\r\n    return CURLE_OK;\r\n\r\n  if(status) {\r\n    conn->bits.close = TRUE; /* marked for closure */\r\n    result = status;         /* use the already set error code */\r\n  }\r\n  else if(!data->set.connect_only) {\r\n    struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n    struct pingpong *pp = &smtpc->pp;\r\n\r\n    /* Send the end of block data */\r\n    result = Curl_write(conn,\r\n                        conn->writesockfd,  /* socket to send to */\r\n                        SMTP_EOB,           /* buffer pointer */\r\n                        SMTP_EOB_LEN,       /* buffer size */\r\n                        &bytes_written);    /* actually sent away */\r\n\r\n    if(result)\r\n      return result;\r\n\r\n    if(bytes_written != SMTP_EOB_LEN) {\r\n      /* The whole chunk was not sent so keep it around and adjust the\r\n         pingpong structure accordingly */\r\n      pp->sendthis = strdup(SMTP_EOB);\r\n      pp->sendsize = SMTP_EOB_LEN;\r\n      pp->sendleft = SMTP_EOB_LEN - bytes_written;\r\n    }\r\n    else\r\n      /* Successfully sent so adjust the response timeout relative to now */\r\n      pp->response = Curl_tvnow();\r\n\r\n    state(conn, SMTP_POSTDATA);\r\n\r\n    /* Run the state-machine\r\n\r\n       TODO: when the multi interface is used, this _really_ should be using\r\n       the smtp_multi_statemach function but we have no general support for\r\n       non-blocking DONE operations, not in the multi state machine and with\r\n       Curl_done() invokes on several places in the code!\r\n    */\r\n    result = smtp_easy_statemach(conn);\r\n  }\r\n\r\n  /* Clear the transfer mode for the next connection */\r\n  smtp->transfer = FTPTRANSFER_BODY;\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_perform()\r\n *\r\n * This is the actual DO function for SMTP. Get a file/directory according to\r\n * the options previously setup.\r\n */\r\nstatic CURLcode smtp_perform(struct connectdata *conn, bool *connected,\r\n                             bool *dophase_done)\r\n{\r\n  /* This is SMTP and no proxy */\r\n  CURLcode result = CURLE_OK;\r\n\r\n  DEBUGF(infof(conn->data, \"DO phase starts\\n\"));\r\n\r\n  if(conn->data->set.opt_no_body) {\r\n    /* Requested no body means no transfer */\r\n    struct FTP *smtp = conn->data->state.proto.smtp;\r\n    smtp->transfer = FTPTRANSFER_INFO;\r\n  }\r\n\r\n  *dophase_done = FALSE; /* not done yet */\r\n\r\n  /* Start the first command in the DO phase */\r\n  result = smtp_mail(conn);\r\n  if(result)\r\n    return result;\r\n\r\n  /* run the state-machine */\r\n  result = smtp_multi_statemach(conn, dophase_done);\r\n\r\n  *connected = conn->bits.tcpconnect[FIRSTSOCKET];\r\n\r\n  if(*dophase_done)\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_do()\r\n *\r\n * This function is registered as 'curl_do' function. It decodes the path\r\n * parts etc as a wrapper to the actual DO function (smtp_perform).\r\n *\r\n * The input argument is already checked for validity.\r\n */\r\nstatic CURLcode smtp_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n\r\n  *done = FALSE; /* default to false */\r\n\r\n  /*\r\n    Since connections can be re-used between SessionHandles, this might be a\r\n    connection already existing but on a fresh SessionHandle struct so we must\r\n    make sure we have a good 'struct SMTP' to play with. For new connections,\r\n    the struct SMTP is allocated and setup in the smtp_connect() function.\r\n  */\r\n  Curl_reset_reqproto(conn);\r\n  retcode = smtp_init(conn);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  retcode = smtp_regular_transfer(conn, done);\r\n\r\n  return retcode;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_quit()\r\n *\r\n * This should be called before calling sclose().  We should then wait for the\r\n * response from the server before returning. The calling code should then try\r\n * to close the connection.\r\n */\r\nstatic CURLcode smtp_quit(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  result = Curl_pp_sendf(&conn->proto.smtpc.pp, \"QUIT\");\r\n  if(result)\r\n    return result;\r\n\r\n  state(conn, SMTP_QUIT);\r\n\r\n  result = smtp_easy_statemach(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_disconnect()\r\n *\r\n * Disconnect from an SMTP server. Cleanup protocol-specific per-connection\r\n * resources. BLOCKING.\r\n */\r\nstatic CURLcode smtp_disconnect(struct connectdata *conn,\r\n                                bool dead_connection)\r\n{\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n\r\n  /* We cannot send quit unconditionally. If this connection is stale or\r\n     bad in any way, sending quit and waiting around here will make the\r\n     disconnect wait in vain and cause more problems than we need to */\r\n\r\n  /* The SMTP session may or may not have been allocated/setup at this\r\n     point! */\r\n  if(!dead_connection && smtpc->pp.conn)\r\n    (void)smtp_quit(conn); /* ignore errors on the LOGOUT */\r\n\r\n  /* Disconnect from the server */\r\n  Curl_pp_disconnect(&smtpc->pp);\r\n\r\n  /* Cleanup the SASL module */\r\n  Curl_sasl_cleanup(conn, smtpc->authused);\r\n\r\n  /* Cleanup our connection based variables */\r\n  Curl_safefree(smtpc->domain);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Call this when the DO phase has completed */\r\nstatic CURLcode smtp_dophase_done(struct connectdata *conn, bool connected)\r\n{\r\n  struct FTP *smtp = conn->data->state.proto.smtp;\r\n\r\n  (void)connected;\r\n\r\n  if(smtp->transfer != FTPTRANSFER_BODY)\r\n    /* no data to transfer */\r\n    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Called from multi.c while DOing */\r\nstatic CURLcode smtp_doing(struct connectdata *conn, bool *dophase_done)\r\n{\r\n  CURLcode result = smtp_multi_statemach(conn, dophase_done);\r\n\r\n  if(result)\r\n    DEBUGF(infof(conn->data, \"DO phase failed\\n\"));\r\n  else {\r\n    if(*dophase_done) {\r\n      result = smtp_dophase_done(conn, FALSE /* not connected */);\r\n\r\n      DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/***********************************************************************\r\n *\r\n * smtp_regular_transfer()\r\n *\r\n * The input argument is already checked for validity.\r\n *\r\n * Performs all commands done before a regular transfer between a local and a\r\n * remote host.\r\n */\r\nstatic CURLcode smtp_regular_transfer(struct connectdata *conn,\r\n                                      bool *dophase_done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  bool connected = FALSE;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* Make sure size is unknown at this point */\r\n  data->req.size = -1;\r\n\r\n  Curl_pgrsSetUploadCounter(data, 0);\r\n  Curl_pgrsSetDownloadCounter(data, 0);\r\n  Curl_pgrsSetUploadSize(data, 0);\r\n  Curl_pgrsSetDownloadSize(data, 0);\r\n\r\n  result = smtp_perform(conn, &connected, dophase_done);\r\n\r\n  if(CURLE_OK == result) {\r\n    if(!*dophase_done)\r\n      /* The DO phase has not completed yet */\r\n      return CURLE_OK;\r\n\r\n    result = smtp_dophase_done(conn, connected);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode smtp_setup_connection(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) {\r\n    /* Unless we have asked to tunnel smtp operations through the proxy, we\r\n       switch and use HTTP operations only */\r\n#ifndef CURL_DISABLE_HTTP\r\n    if(conn->handler == &Curl_handler_smtp)\r\n      conn->handler = &Curl_handler_smtp_proxy;\r\n    else {\r\n#ifdef USE_SSL\r\n      conn->handler = &Curl_handler_smtps_proxy;\r\n#else\r\n      failf(data, \"SMTPS not supported!\");\r\n      return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n    }\r\n\r\n    /* We explicitly mark this connection as persistent here as we're doing\r\n       SMTP over HTTP and thus we accidentally avoid setting this value\r\n       otherwise */\r\n    conn->bits.close = FALSE;\r\n#else\r\n    failf(data, \"SMTP over http proxy requires HTTP support built-in!\");\r\n    return CURLE_UNSUPPORTED_PROTOCOL;\r\n#endif\r\n  }\r\n\r\n  data->state.path++;   /* don't include the initial slash */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread)\r\n{\r\n  /* When sending a SMTP payload we must detect CRLF. sequences making sure\r\n     they are sent as CRLF.. instead, as a . on the beginning of a line will\r\n     be deleted by the server when not part of an EOB terminator and a\r\n     genuine CRLF.CRLF which isn't escaped will wrongly be detected as end of\r\n     data by the server.\r\n  */\r\n  ssize_t i;\r\n  ssize_t si;\r\n  struct smtp_conn *smtpc = &conn->proto.smtpc;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* Do we need to allocate the scatch buffer? */\r\n  if(!data->state.scratch) {\r\n    data->state.scratch = malloc(2 * BUFSIZE);\r\n\r\n    if(!data->state.scratch) {\r\n      failf (data, \"Failed to alloc scratch buffer!\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* This loop can be improved by some kind of Boyer-Moore style of\r\n     approach but that is saved for later... */\r\n  for(i = 0, si = 0; i < nread; i++) {\r\n    if(SMTP_EOB[smtpc->eob] == data->req.upload_fromhere[i])\r\n      smtpc->eob++;\r\n    else if(smtpc->eob) {\r\n      /* A previous substring matched so output that first */\r\n      memcpy(&data->state.scratch[si], SMTP_EOB, smtpc->eob);\r\n      si += smtpc->eob;\r\n\r\n      /* Then compare the first byte */\r\n      if(SMTP_EOB[0] == data->req.upload_fromhere[i])\r\n        smtpc->eob = 1;\r\n      else\r\n        smtpc->eob = 0;\r\n    }\r\n\r\n    /* Do we have a match for CRLF. as per RFC-2821, sect. 4.5.2 */\r\n    if(SMTP_EOB_FIND_LEN == smtpc->eob) {\r\n      /* Copy the replacement data to the target buffer */\r\n      memcpy(&data->state.scratch[si], SMTP_EOB_REPL, SMTP_EOB_REPL_LEN);\r\n      si += SMTP_EOB_REPL_LEN;\r\n      smtpc->eob = 0;\r\n    }\r\n    else if(!smtpc->eob)\r\n      data->state.scratch[si++] = data->req.upload_fromhere[i];\r\n  }\r\n\r\n  if(smtpc->eob) {\r\n    /* A substring matched before processing ended so output that now */\r\n    memcpy(&data->state.scratch[si], SMTP_EOB, smtpc->eob);\r\n    si += smtpc->eob;\r\n    smtpc->eob = 0;\r\n  }\r\n\r\n  if(si != nread) {\r\n    /* Only use the new buffer if we replaced something */\r\n    nread = si;\r\n\r\n    /* Upload from the new (replaced) buffer instead */\r\n    data->req.upload_fromhere = data->state.scratch;\r\n\r\n    /* Set the new amount too */\r\n    data->req.upload_present = nread;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#endif /* CURL_DISABLE_SMTP */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/smtp.h",
    "content": "#ifndef HEADER_CURL_SMTP_H\r\n#define HEADER_CURL_SMTP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2009 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"pingpong.h\"\r\n\r\n/****************************************************************************\r\n * SMTP unique setup\r\n ***************************************************************************/\r\ntypedef enum {\r\n  SMTP_STOP,        /* do nothing state, stops the state machine */\r\n  SMTP_SERVERGREET, /* waiting for the initial greeting immediately after\r\n                       a connect */\r\n  SMTP_EHLO,\r\n  SMTP_HELO,\r\n  SMTP_STARTTLS,\r\n  SMTP_UPGRADETLS,  /* asynchronously upgrade the connection to SSL/TLS\r\n                       (multi mode only) */\r\n  SMTP_AUTH_PLAIN,\r\n  SMTP_AUTH_LOGIN,\r\n  SMTP_AUTH_PASSWD,\r\n  SMTP_AUTH_CRAMMD5,\r\n  SMTP_AUTH_DIGESTMD5,\r\n  SMTP_AUTH_DIGESTMD5_RESP,\r\n  SMTP_AUTH_NTLM,\r\n  SMTP_AUTH_NTLM_TYPE2MSG,\r\n  SMTP_AUTH,\r\n  SMTP_MAIL,        /* MAIL FROM */\r\n  SMTP_RCPT,        /* RCPT TO */\r\n  SMTP_DATA,\r\n  SMTP_POSTDATA,\r\n  SMTP_QUIT,\r\n  SMTP_LAST         /* never used */\r\n} smtpstate;\r\n\r\n/* smtp_conn is used for struct connection-oriented data in the connectdata\r\n   struct */\r\nstruct smtp_conn {\r\n  struct pingpong pp;\r\n  char *domain;            /* Client address/name to send in the EHLO */\r\n  size_t eob;              /* Number of bytes of the EOB (End Of Body) that\r\n                              have been received so far */\r\n  unsigned int authmechs;  /* Accepted authentication mechanisms */\r\n  unsigned int authused;   /* Auth mechanism used for the connection */\r\n  smtpstate state;         /* Always use smtp.c:state() to change state! */\r\n  struct curl_slist *rcpt; /* Recipient list */\r\n  bool ssldone;            /* Is connect() over SSL done? */\r\n  bool size_supported;     /* If server supports SIZE extension according to\r\n                              RFC 1870 */\r\n};\r\n\r\nextern const struct Curl_handler Curl_handler_smtp;\r\nextern const struct Curl_handler Curl_handler_smtps;\r\n\r\n/* this is the 5-bytes End-Of-Body marker for SMTP */\r\n#define SMTP_EOB \"\\x0d\\x0a\\x2e\\x0d\\x0a\"\r\n#define SMTP_EOB_LEN 5\r\n#define SMTP_EOB_FIND_LEN 3\r\n\r\n/* if found in data, replace it with this string instead */\r\n#define SMTP_EOB_REPL \"\\x0d\\x0a\\x2e\\x2e\"\r\n#define SMTP_EOB_REPL_LEN 4\r\n\r\nCURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread);\r\n\r\n#endif /* HEADER_CURL_SMTP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/sockaddr.h",
    "content": "#ifndef HEADER_CURL_SOCKADDR_H\r\n#define HEADER_CURL_SOCKADDR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\nstruct Curl_sockaddr_storage {\r\n  union {\r\n    struct sockaddr sa;\r\n    struct sockaddr_in sa_in;\r\n#ifdef ENABLE_IPV6\r\n    struct sockaddr_in6 sa_in6;\r\n#endif\r\n#ifdef HAVE_STRUCT_SOCKADDR_STORAGE\r\n    struct sockaddr_storage sa_stor;\r\n#else\r\n    char cbuf[256];   /* this should be big enough to fit a lot */\r\n#endif\r\n  } buffer;\r\n};\r\n\r\n#endif /* HEADER_CURL_SOCKADDR_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/socks.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if !defined(CURL_DISABLE_PROXY)\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"strequal.h\"\r\n#include \"select.h\"\r\n#include \"connect.h\"\r\n#include \"timeval.h\"\r\n#include \"socks.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Helper read-from-socket functions. Does the same as Curl_read() but it\r\n * blocks until all bytes amount of buffersize will be read. No more, no less.\r\n *\r\n * This is STUPID BLOCKING behaviour which we frown upon, but right now this\r\n * is what we have...\r\n */\r\nint Curl_blockread_all(struct connectdata *conn, /* connection data */\r\n                       curl_socket_t sockfd,     /* read from this socket */\r\n                       char *buf,                /* store read data here */\r\n                       ssize_t buffersize,       /* max amount to read */\r\n                       ssize_t *n)               /* amount bytes read */\r\n{\r\n  ssize_t nread;\r\n  ssize_t allread = 0;\r\n  int result;\r\n  long timeleft;\r\n  *n = 0;\r\n  for(;;) {\r\n    timeleft = Curl_timeleft(conn->data, NULL, TRUE);\r\n    if(timeleft < 0) {\r\n      /* we already got the timeout */\r\n      result = CURLE_OPERATION_TIMEDOUT;\r\n      break;\r\n    }\r\n    if(Curl_socket_ready(sockfd, CURL_SOCKET_BAD, timeleft) <= 0) {\r\n      result = ~CURLE_OK;\r\n      break;\r\n    }\r\n    result = Curl_read_plain(sockfd, buf, buffersize, &nread);\r\n    if(CURLE_AGAIN == result)\r\n      continue;\r\n    else if(result)\r\n      break;\r\n\r\n    if(buffersize == nread) {\r\n      allread += nread;\r\n      *n = allread;\r\n      result = CURLE_OK;\r\n      break;\r\n    }\r\n    if(!nread) {\r\n      result = ~CURLE_OK;\r\n      break;\r\n    }\r\n\r\n    buffersize -= nread;\r\n    buf += nread;\r\n    allread += nread;\r\n  }\r\n  return result;\r\n}\r\n\r\n/*\r\n* This function logs in to a SOCKS4 proxy and sends the specifics to the final\r\n* destination server.\r\n*\r\n* Reference :\r\n*   http://socks.permeo.com/protocol/socks4.protocol\r\n*\r\n* Note :\r\n*   Set protocol4a=true for  \"SOCKS 4A (Simple Extension to SOCKS 4 Protocol)\"\r\n*   Nonsupport \"Identification Protocol (RFC1413)\"\r\n*/\r\nCURLcode Curl_SOCKS4(const char *proxy_name,\r\n                     const char *hostname,\r\n                     int remote_port,\r\n                     int sockindex,\r\n                     struct connectdata *conn,\r\n                     bool protocol4a)\r\n{\r\n#define SOCKS4REQLEN 262\r\n  unsigned char socksreq[SOCKS4REQLEN]; /* room for SOCKS4 request incl. user\r\n                                           id */\r\n  int result;\r\n  CURLcode code;\r\n  curl_socket_t sock = conn->sock[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(Curl_timeleft(data, NULL, TRUE) < 0) {\r\n    /* time-out, bail out, go home */\r\n    failf(data, \"Connection time-out\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  curlx_nonblock(sock, FALSE);\r\n\r\n  /*\r\n   * Compose socks4 request\r\n   *\r\n   * Request format\r\n   *\r\n   *     +----+----+----+----+----+----+----+----+----+----+....+----+\r\n   *     | VN | CD | DSTPORT |      DSTIP        | USERID       |NULL|\r\n   *     +----+----+----+----+----+----+----+----+----+----+....+----+\r\n   * # of bytes:  1    1      2              4           variable       1\r\n   */\r\n\r\n  socksreq[0] = 4; /* version (SOCKS4) */\r\n  socksreq[1] = 1; /* connect */\r\n  socksreq[2] = (unsigned char)((remote_port >> 8) & 0xff); /* PORT MSB */\r\n  socksreq[3] = (unsigned char)(remote_port & 0xff);        /* PORT LSB */\r\n\r\n  /* DNS resolve only for SOCKS4, not SOCKS4a */\r\n  if(!protocol4a) {\r\n    struct Curl_dns_entry *dns;\r\n    Curl_addrinfo *hp=NULL;\r\n    int rc;\r\n\r\n    rc = Curl_resolv(conn, hostname, remote_port, &dns);\r\n\r\n    if(rc == CURLRESOLV_ERROR)\r\n      return CURLE_COULDNT_RESOLVE_PROXY;\r\n\r\n    if(rc == CURLRESOLV_PENDING)\r\n      /* ignores the return code, but 'dns' remains NULL on failure */\r\n      (void)Curl_resolver_wait_resolv(conn, &dns);\r\n\r\n    /*\r\n     * We cannot use 'hostent' as a struct that Curl_resolv() returns.  It\r\n     * returns a Curl_addrinfo pointer that may not always look the same.\r\n     */\r\n    if(dns)\r\n      hp=dns->addr;\r\n    if(hp) {\r\n      char buf[64];\r\n      unsigned short ip[4];\r\n      Curl_printable_address(hp, buf, sizeof(buf));\r\n\r\n      if(4 == sscanf( buf, \"%hu.%hu.%hu.%hu\",\r\n                      &ip[0], &ip[1], &ip[2], &ip[3])) {\r\n        /* Set DSTIP */\r\n        socksreq[4] = (unsigned char)ip[0];\r\n        socksreq[5] = (unsigned char)ip[1];\r\n        socksreq[6] = (unsigned char)ip[2];\r\n        socksreq[7] = (unsigned char)ip[3];\r\n      }\r\n      else\r\n        hp = NULL; /* fail! */\r\n\r\n      Curl_resolv_unlock(data, dns); /* not used anymore from now on */\r\n\r\n    }\r\n    if(!hp) {\r\n      failf(data, \"Failed to resolve \\\"%s\\\" for SOCKS4 connect.\",\r\n            hostname);\r\n      return CURLE_COULDNT_RESOLVE_HOST;\r\n    }\r\n  }\r\n\r\n  /*\r\n   * This is currently not supporting \"Identification Protocol (RFC1413)\".\r\n   */\r\n  socksreq[8] = 0; /* ensure empty userid is NUL-terminated */\r\n  if(proxy_name)\r\n    strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8);\r\n\r\n  /*\r\n   * Make connection\r\n   */\r\n  {\r\n    ssize_t actualread;\r\n    ssize_t written;\r\n    ssize_t hostnamelen = 0;\r\n    int packetsize = 9 +\r\n      (int)strlen((char*)socksreq + 8); /* size including NUL */\r\n\r\n    /* If SOCKS4a, set special invalid IP address 0.0.0.x */\r\n    if(protocol4a) {\r\n      socksreq[4] = 0;\r\n      socksreq[5] = 0;\r\n      socksreq[6] = 0;\r\n      socksreq[7] = 1;\r\n      /* If still enough room in buffer, also append hostname */\r\n      hostnamelen = (ssize_t)strlen(hostname) + 1; /* length including NUL */\r\n      if(packetsize + hostnamelen <= SOCKS4REQLEN)\r\n        strcpy((char*)socksreq + packetsize, hostname);\r\n      else\r\n        hostnamelen = 0; /* Flag: hostname did not fit in buffer */\r\n    }\r\n\r\n    /* Send request */\r\n    code = Curl_write_plain(conn, sock, (char *)socksreq,\r\n                            packetsize + hostnamelen,\r\n                            &written);\r\n    if((code != CURLE_OK) || (written != packetsize + hostnamelen)) {\r\n      failf(data, \"Failed to send SOCKS4 connect request.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    if(protocol4a && hostnamelen == 0) {\r\n      /* SOCKS4a with very long hostname - send that name separately */\r\n      hostnamelen = (ssize_t)strlen(hostname) + 1;\r\n      code = Curl_write_plain(conn, sock, (char *)hostname, hostnamelen,\r\n                              &written);\r\n      if((code != CURLE_OK) || (written != hostnamelen)) {\r\n        failf(data, \"Failed to send SOCKS4 connect request.\");\r\n        return CURLE_COULDNT_CONNECT;\r\n      }\r\n    }\r\n\r\n    packetsize = 8; /* receive data size */\r\n\r\n    /* Receive response */\r\n    result = Curl_blockread_all(conn, sock, (char *)socksreq, packetsize,\r\n                                &actualread);\r\n    if((result != CURLE_OK) || (actualread != packetsize)) {\r\n      failf(data, \"Failed to receive SOCKS4 connect request ack.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    /*\r\n     * Response format\r\n     *\r\n     *     +----+----+----+----+----+----+----+----+\r\n     *     | VN | CD | DSTPORT |      DSTIP        |\r\n     *     +----+----+----+----+----+----+----+----+\r\n     * # of bytes:  1    1      2              4\r\n     *\r\n     * VN is the version of the reply code and should be 0. CD is the result\r\n     * code with one of the following values:\r\n     *\r\n     * 90: request granted\r\n     * 91: request rejected or failed\r\n     * 92: request rejected because SOCKS server cannot connect to\r\n     *     identd on the client\r\n     * 93: request rejected because the client program and identd\r\n     *     report different user-ids\r\n     */\r\n\r\n    /* wrong version ? */\r\n    if(socksreq[0] != 0) {\r\n      failf(data,\r\n            \"SOCKS4 reply has wrong version, version should be 4.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    /* Result */\r\n    switch(socksreq[1]) {\r\n    case 90:\r\n      infof(data, \"SOCKS4%s request granted.\\n\", protocol4a?\"a\":\"\");\r\n      break;\r\n    case 91:\r\n      failf(data,\r\n            \"Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)\"\r\n            \", request rejected or failed.\",\r\n            (unsigned char)socksreq[4], (unsigned char)socksreq[5],\r\n            (unsigned char)socksreq[6], (unsigned char)socksreq[7],\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n      return CURLE_COULDNT_CONNECT;\r\n    case 92:\r\n      failf(data,\r\n            \"Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)\"\r\n            \", request rejected because SOCKS server cannot connect to \"\r\n            \"identd on the client.\",\r\n            (unsigned char)socksreq[4], (unsigned char)socksreq[5],\r\n            (unsigned char)socksreq[6], (unsigned char)socksreq[7],\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n      return CURLE_COULDNT_CONNECT;\r\n    case 93:\r\n      failf(data,\r\n            \"Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)\"\r\n            \", request rejected because the client program and identd \"\r\n            \"report different user-ids.\",\r\n            (unsigned char)socksreq[4], (unsigned char)socksreq[5],\r\n            (unsigned char)socksreq[6], (unsigned char)socksreq[7],\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n      return CURLE_COULDNT_CONNECT;\r\n    default:\r\n      failf(data,\r\n            \"Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)\"\r\n            \", Unknown.\",\r\n            (unsigned char)socksreq[4], (unsigned char)socksreq[5],\r\n            (unsigned char)socksreq[6], (unsigned char)socksreq[7],\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n  }\r\n\r\n  curlx_nonblock(sock, TRUE);\r\n\r\n  return CURLE_OK; /* Proxy was successful! */\r\n}\r\n\r\n/*\r\n * This function logs in to a SOCKS5 proxy and sends the specifics to the final\r\n * destination server.\r\n */\r\nCURLcode Curl_SOCKS5(const char *proxy_name,\r\n                     const char *proxy_password,\r\n                     const char *hostname,\r\n                     int remote_port,\r\n                     int sockindex,\r\n                     struct connectdata *conn)\r\n{\r\n  /*\r\n    According to the RFC1928, section \"6.  Replies\". This is what a SOCK5\r\n    replies:\r\n\r\n        +----+-----+-------+------+----------+----------+\r\n        |VER | REP |  RSV  | ATYP | BND.ADDR | BND.PORT |\r\n        +----+-----+-------+------+----------+----------+\r\n        | 1  |  1  | X'00' |  1   | Variable |    2     |\r\n        +----+-----+-------+------+----------+----------+\r\n\r\n    Where:\r\n\r\n    o  VER    protocol version: X'05'\r\n    o  REP    Reply field:\r\n    o  X'00' succeeded\r\n  */\r\n\r\n  unsigned char socksreq[600]; /* room for large user/pw (255 max each) */\r\n  ssize_t actualread;\r\n  ssize_t written;\r\n  int result;\r\n  CURLcode code;\r\n  curl_socket_t sock = conn->sock[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n  long timeout;\r\n  bool socks5_resolve_local = (conn->proxytype == CURLPROXY_SOCKS5)?TRUE:FALSE;\r\n  const size_t hostname_len = strlen(hostname);\r\n  ssize_t len = 0;\r\n\r\n  /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */\r\n  if(!socks5_resolve_local && hostname_len > 255) {\r\n    infof(conn->data,\"SOCKS5: server resolving disabled for hostnames of \"\r\n          \"length > 255 [actual len=%zu]\\n\", hostname_len);\r\n    socks5_resolve_local = TRUE;\r\n  }\r\n\r\n  /* get timeout */\r\n  timeout = Curl_timeleft(data, NULL, TRUE);\r\n\r\n  if(timeout < 0) {\r\n    /* time-out, bail out, go home */\r\n    failf(data, \"Connection time-out\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  curlx_nonblock(sock, TRUE);\r\n\r\n  /* wait until socket gets connected */\r\n  result = Curl_socket_ready(CURL_SOCKET_BAD, sock, timeout);\r\n\r\n  if(-1 == result) {\r\n    failf(conn->data, \"SOCKS5: no connection here\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  else if(0 == result) {\r\n    failf(conn->data, \"SOCKS5: connection timeout\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  if(result & CURL_CSELECT_ERR) {\r\n    failf(conn->data, \"SOCKS5: error occurred during connection\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  socksreq[0] = 5; /* version */\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  socksreq[1] = (char)(proxy_name ? 3 : 2); /* number of methods (below) */\r\n  socksreq[2] = 0; /* no authentication */\r\n  socksreq[3] = 1; /* gssapi */\r\n  socksreq[4] = 2; /* username/password */\r\n#else\r\n  socksreq[1] = (char)(proxy_name ? 2 : 1); /* number of methods (below) */\r\n  socksreq[2] = 0; /* no authentication */\r\n  socksreq[3] = 2; /* username/password */\r\n#endif\r\n\r\n  curlx_nonblock(sock, FALSE);\r\n\r\n  code = Curl_write_plain(conn, sock, (char *)socksreq, (2 + (int)socksreq[1]),\r\n                          &written);\r\n  if((code != CURLE_OK) || (written != (2 + (int)socksreq[1]))) {\r\n    failf(data, \"Unable to send initial SOCKS5 request.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  curlx_nonblock(sock, TRUE);\r\n\r\n  result = Curl_socket_ready(sock, CURL_SOCKET_BAD, timeout);\r\n\r\n  if(-1 == result) {\r\n    failf(conn->data, \"SOCKS5 nothing to read\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  else if(0 == result) {\r\n    failf(conn->data, \"SOCKS5 read timeout\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  if(result & CURL_CSELECT_ERR) {\r\n    failf(conn->data, \"SOCKS5 read error occurred\");\r\n    return CURLE_RECV_ERROR;\r\n  }\r\n\r\n  curlx_nonblock(sock, FALSE);\r\n\r\n  result=Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread);\r\n  if((result != CURLE_OK) || (actualread != 2)) {\r\n    failf(data, \"Unable to receive initial SOCKS5 response.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(socksreq[0] != 5) {\r\n    failf(data, \"Received invalid version in initial SOCKS5 response.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  if(socksreq[1] == 0) {\r\n    /* Nothing to do, no authentication needed */\r\n    ;\r\n  }\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  else if(socksreq[1] == 1) {\r\n    code = Curl_SOCKS5_gssapi_negotiate(sockindex, conn);\r\n    if(code != CURLE_OK) {\r\n      failf(data, \"Unable to negotiate SOCKS5 gssapi context.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n  }\r\n#endif\r\n  else if(socksreq[1] == 2) {\r\n    /* Needs user name and password */\r\n    size_t proxy_name_len, proxy_password_len;\r\n    if(proxy_name && proxy_password) {\r\n      proxy_name_len = strlen(proxy_name);\r\n      proxy_password_len = strlen(proxy_password);\r\n    }\r\n    else {\r\n      proxy_name_len = 0;\r\n      proxy_password_len = 0;\r\n    }\r\n\r\n    /*   username/password request looks like\r\n     * +----+------+----------+------+----------+\r\n     * |VER | ULEN |  UNAME   | PLEN |  PASSWD  |\r\n     * +----+------+----------+------+----------+\r\n     * | 1  |  1   | 1 to 255 |  1   | 1 to 255 |\r\n     * +----+------+----------+------+----------+\r\n     */\r\n    len = 0;\r\n    socksreq[len++] = 1;    /* username/pw subnegotiation version */\r\n    socksreq[len++] = (unsigned char) proxy_name_len;\r\n    if(proxy_name && proxy_name_len)\r\n      memcpy(socksreq + len, proxy_name, proxy_name_len);\r\n    len += proxy_name_len;\r\n    socksreq[len++] = (unsigned char) proxy_password_len;\r\n    if(proxy_password && proxy_password_len)\r\n      memcpy(socksreq + len, proxy_password, proxy_password_len);\r\n    len += proxy_password_len;\r\n\r\n    code = Curl_write_plain(conn, sock, (char *)socksreq, len, &written);\r\n    if((code != CURLE_OK) || (len != written)) {\r\n      failf(data, \"Failed to send SOCKS5 sub-negotiation request.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    result=Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread);\r\n    if((result != CURLE_OK) || (actualread != 2)) {\r\n      failf(data, \"Unable to receive SOCKS5 sub-negotiation response.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    /* ignore the first (VER) byte */\r\n    if(socksreq[1] != 0) { /* status */\r\n      failf(data, \"User was rejected by the SOCKS5 server (%d %d).\",\r\n            socksreq[0], socksreq[1]);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    /* Everything is good so far, user was authenticated! */\r\n  }\r\n  else {\r\n    /* error */\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n    if(socksreq[1] == 255) {\r\n#else\r\n    if(socksreq[1] == 1) {\r\n      failf(data,\r\n            \"SOCKS5 GSSAPI per-message authentication is not supported.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    else if(socksreq[1] == 255) {\r\n#endif\r\n      if(!proxy_name || !*proxy_name) {\r\n        failf(data,\r\n              \"No authentication method was acceptable. (It is quite likely\"\r\n              \" that the SOCKS5 server wanted a username/password, since none\"\r\n              \" was supplied to the server on this connection.)\");\r\n      }\r\n      else {\r\n        failf(data, \"No authentication method was acceptable.\");\r\n      }\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    else {\r\n      failf(data,\r\n            \"Undocumented SOCKS5 mode attempted to be used by server.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n  }\r\n\r\n  /* Authentication is complete, now specify destination to the proxy */\r\n  len = 0;\r\n  socksreq[len++] = 5; /* version (SOCKS5) */\r\n  socksreq[len++] = 1; /* connect */\r\n  socksreq[len++] = 0; /* must be zero */\r\n\r\n  if(!socks5_resolve_local) {\r\n    socksreq[len++] = 3; /* ATYP: domain name = 3 */\r\n    socksreq[len++] = (char) hostname_len; /* address length */\r\n    memcpy(&socksreq[len], hostname, hostname_len); /* address str w/o NULL */\r\n    len += hostname_len;\r\n  }\r\n  else {\r\n    struct Curl_dns_entry *dns;\r\n    Curl_addrinfo *hp = NULL;\r\n    int rc = Curl_resolv(conn, hostname, remote_port, &dns);\r\n\r\n    if(rc == CURLRESOLV_ERROR)\r\n      return CURLE_COULDNT_RESOLVE_HOST;\r\n\r\n    if(rc == CURLRESOLV_PENDING) {\r\n      /* this requires that we're in \"wait for resolve\" state */\r\n      code = Curl_resolver_wait_resolv(conn, &dns);\r\n      if(code != CURLE_OK)\r\n        return code;\r\n    }\r\n\r\n    /*\r\n     * We cannot use 'hostent' as a struct that Curl_resolv() returns.  It\r\n     * returns a Curl_addrinfo pointer that may not always look the same.\r\n     */\r\n    if(dns)\r\n      hp=dns->addr;\r\n    if(hp) {\r\n      struct sockaddr_in *saddr_in;\r\n#ifdef ENABLE_IPV6\r\n      struct sockaddr_in6 *saddr_in6;\r\n#endif\r\n      int i;\r\n\r\n      if(hp->ai_family == AF_INET) {\r\n        socksreq[len++] = 1; /* ATYP: IPv4 = 1 */\r\n\r\n        saddr_in = (struct sockaddr_in*)hp->ai_addr;\r\n        for(i = 0; i < 4; i++) {\r\n          socksreq[len++] = ((unsigned char*)&saddr_in->sin_addr.s_addr)[i];\r\n          infof(data, \"%d\\n\", socksreq[len-1]);\r\n        }\r\n      }\r\n#ifdef ENABLE_IPV6\r\n      else if(hp->ai_family == AF_INET6) {\r\n        socksreq[len++] = 4; /* ATYP: IPv6 = 4 */\r\n\r\n        saddr_in6 = (struct sockaddr_in6*)hp->ai_addr;\r\n        for(i = 0; i < 16; i++) {\r\n          socksreq[len++] = ((unsigned char*)&saddr_in6->sin6_addr.s6_addr)[i];\r\n        }\r\n      }\r\n#endif\r\n      else\r\n        hp = NULL; /* fail! */\r\n\r\n      Curl_resolv_unlock(data, dns); /* not used anymore from now on */\r\n    }\r\n    if(!hp) {\r\n      failf(data, \"Failed to resolve \\\"%s\\\" for SOCKS5 connect.\",\r\n            hostname);\r\n      return CURLE_COULDNT_RESOLVE_HOST;\r\n    }\r\n  }\r\n\r\n  socksreq[len++] = (unsigned char)((remote_port >> 8) & 0xff); /* PORT MSB */\r\n  socksreq[len++] = (unsigned char)(remote_port & 0xff);        /* PORT LSB */\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  if(conn->socks5_gssapi_enctype) {\r\n    failf(data, \"SOCKS5 gssapi protection not yet implemented.\");\r\n  }\r\n  else\r\n#endif\r\n    code = Curl_write_plain(conn, sock, (char *)socksreq, len, &written);\r\n\r\n  if((code != CURLE_OK) || (len != written)) {\r\n    failf(data, \"Failed to send SOCKS5 connect request.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  len = 10; /* minimum packet size is 10 */\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  if(conn->socks5_gssapi_enctype) {\r\n    failf(data, \"SOCKS5 gssapi protection not yet implemented.\");\r\n  }\r\n  else\r\n#endif\r\n    result = Curl_blockread_all(conn, sock, (char *)socksreq,\r\n                                len, &actualread);\r\n\r\n  if((result != CURLE_OK) || (len != actualread)) {\r\n    failf(data, \"Failed to receive SOCKS5 connect request ack.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(socksreq[0] != 5) { /* version */\r\n    failf(data,\r\n          \"SOCKS5 reply has wrong version, version should be 5.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  if(socksreq[1] != 0) { /* Anything besides 0 is an error */\r\n    if(socksreq[3] == 1) {\r\n      failf(data,\r\n            \"Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)\",\r\n            (unsigned char)socksreq[4], (unsigned char)socksreq[5],\r\n            (unsigned char)socksreq[6], (unsigned char)socksreq[7],\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n    }\r\n    else if(socksreq[3] == 3) {\r\n      failf(data,\r\n            \"Can't complete SOCKS5 connection to %s:%d. (%d)\",\r\n            hostname,\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n    }\r\n    else if(socksreq[3] == 4) {\r\n      failf(data,\r\n            \"Can't complete SOCKS5 connection to %02x%02x:%02x%02x:\"\r\n            \"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%d. (%d)\",\r\n            (unsigned char)socksreq[4], (unsigned char)socksreq[5],\r\n            (unsigned char)socksreq[6], (unsigned char)socksreq[7],\r\n            (unsigned char)socksreq[8], (unsigned char)socksreq[9],\r\n            (unsigned char)socksreq[10], (unsigned char)socksreq[11],\r\n            (unsigned char)socksreq[12], (unsigned char)socksreq[13],\r\n            (unsigned char)socksreq[14], (unsigned char)socksreq[15],\r\n            (unsigned char)socksreq[16], (unsigned char)socksreq[17],\r\n            (unsigned char)socksreq[18], (unsigned char)socksreq[19],\r\n            ((socksreq[8] << 8) | socksreq[9]),\r\n            socksreq[1]);\r\n    }\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  /* Fix: in general, returned BND.ADDR is variable length parameter by RFC\r\n     1928, so the reply packet should be read until the end to avoid errors at\r\n     subsequent protocol level.\r\n\r\n    +----+-----+-------+------+----------+----------+\r\n    |VER | REP |  RSV  | ATYP | BND.ADDR | BND.PORT |\r\n    +----+-----+-------+------+----------+----------+\r\n    | 1  |  1  | X'00' |  1   | Variable |    2     |\r\n    +----+-----+-------+------+----------+----------+\r\n\r\n     ATYP:\r\n     o  IP v4 address: X'01', BND.ADDR = 4 byte\r\n     o  domain name:  X'03', BND.ADDR = [ 1 byte length, string ]\r\n     o  IP v6 address: X'04', BND.ADDR = 16 byte\r\n     */\r\n\r\n  /* Calculate real packet size */\r\n  if(socksreq[3] == 3) {\r\n    /* domain name */\r\n    int addrlen = (int) socksreq[4];\r\n    len = 5 + addrlen + 2;\r\n  }\r\n  else if(socksreq[3] == 4) {\r\n    /* IPv6 */\r\n    len = 4 + 16 + 2;\r\n  }\r\n\r\n  /* At this point we already read first 10 bytes */\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  if(!conn->socks5_gssapi_enctype) {\r\n    /* decrypt_gssapi_blockread already read the whole packet */\r\n#endif\r\n    if(len > 10) {\r\n      len -= 10;\r\n      result = Curl_blockread_all(conn, sock, (char *)&socksreq[10],\r\n                                  len, &actualread);\r\n      if((result != CURLE_OK) || (len != actualread)) {\r\n        failf(data, \"Failed to receive SOCKS5 connect request ack.\");\r\n        return CURLE_COULDNT_CONNECT;\r\n      }\r\n    }\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  }\r\n#endif\r\n\r\n  curlx_nonblock(sock, TRUE);\r\n  return CURLE_OK; /* Proxy was successful! */\r\n}\r\n\r\n#endif /* CURL_DISABLE_PROXY */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/socks.h",
    "content": "#ifndef HEADER_CURL_SOCKS_H\r\n#define HEADER_CURL_SOCKS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef CURL_DISABLE_PROXY\r\n#define Curl_SOCKS4(a,b,c,d,e,f) CURLE_NOT_BUILT_IN\r\n#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_NOT_BUILT_IN\r\n#else\r\n/*\r\n * Helper read-from-socket functions. Does the same as Curl_read() but it\r\n * blocks until all bytes amount of buffersize will be read. No more, no less.\r\n *\r\n * This is STUPID BLOCKING behaviour which we frown upon, but right now this\r\n * is what we have...\r\n */\r\nint Curl_blockread_all(struct connectdata *conn,\r\n                       curl_socket_t sockfd,\r\n                       char *buf,\r\n                       ssize_t buffersize,\r\n                       ssize_t *n);\r\n\r\n/*\r\n * This function logs in to a SOCKS4(a) proxy and sends the specifics to the\r\n * final destination server.\r\n */\r\nCURLcode Curl_SOCKS4(const char *proxy_name,\r\n                     const char *hostname,\r\n                     int remote_port,\r\n                     int sockindex,\r\n                     struct connectdata *conn,\r\n                     bool protocol4a);\r\n\r\n/*\r\n * This function logs in to a SOCKS5 proxy and sends the specifics to the\r\n * final destination server.\r\n */\r\nCURLcode Curl_SOCKS5(const char *proxy_name,\r\n                     const char *proxy_password,\r\n                     const char *hostname,\r\n                     int remote_port,\r\n                     int sockindex,\r\n                     struct connectdata *conn);\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n/*\r\n * This function handles the sockss5 gssapie negotiation and initialisation\r\n */\r\nCURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,\r\n                                      struct connectdata *conn);\r\n#endif\r\n\r\n#endif /* CURL_DISABLE_PROXY */\r\n\r\n#endif  /* HEADER_CURL_SOCKS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/socks_gssapi.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com>\r\n * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n\r\n#ifdef HAVE_GSSAPI\r\n#ifdef HAVE_OLD_GSSMIT\r\n#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name\r\n#define NCOMPAT 1\r\n#endif\r\n#ifndef gss_nt_service_name\r\n#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE\r\n#endif\r\n\r\n#include \"curl_gssapi.h\"\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"connect.h\"\r\n#include \"timeval.h\"\r\n#include \"socks.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nstatic gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;\r\n\r\n/*\r\n * Helper gssapi error functions.\r\n */\r\nstatic int check_gss_err(struct SessionHandle *data,\r\n                         OM_uint32 major_status,\r\n                         OM_uint32 minor_status,\r\n                         const char* function)\r\n{\r\n  if(GSS_ERROR(major_status)) {\r\n    OM_uint32 maj_stat,min_stat;\r\n    OM_uint32 msg_ctx = 0;\r\n    gss_buffer_desc status_string;\r\n    char buf[1024];\r\n    size_t len;\r\n\r\n    len = 0;\r\n    msg_ctx = 0;\r\n    while(!msg_ctx) {\r\n      /* convert major status code (GSS-API error) to text */\r\n      maj_stat = gss_display_status(&min_stat, major_status,\r\n                                    GSS_C_GSS_CODE,\r\n                                    GSS_C_NULL_OID,\r\n                                    &msg_ctx, &status_string);\r\n      if(maj_stat == GSS_S_COMPLETE) {\r\n        if(sizeof(buf) > len + status_string.length + 1) {\r\n          strcpy(buf+len, (char*) status_string.value);\r\n          len += status_string.length;\r\n        }\r\n        gss_release_buffer(&min_stat, &status_string);\r\n        break;\r\n      }\r\n      gss_release_buffer(&min_stat, &status_string);\r\n    }\r\n    if(sizeof(buf) > len + 3) {\r\n      strcpy(buf+len, \".\\n\");\r\n      len += 2;\r\n    }\r\n    msg_ctx = 0;\r\n    while(!msg_ctx) {\r\n      /* convert minor status code (underlying routine error) to text */\r\n      maj_stat = gss_display_status(&min_stat, minor_status,\r\n                                    GSS_C_MECH_CODE,\r\n                                    GSS_C_NULL_OID,\r\n                                    &msg_ctx, &status_string);\r\n      if(maj_stat == GSS_S_COMPLETE) {\r\n        if(sizeof(buf) > len + status_string.length)\r\n          strcpy(buf+len, (char*) status_string.value);\r\n        gss_release_buffer(&min_stat, &status_string);\r\n        break;\r\n      }\r\n      gss_release_buffer(&min_stat, &status_string);\r\n    }\r\n    failf(data, \"GSSAPI error: %s failed:\\n%s\", function, buf);\r\n    return(1);\r\n  }\r\n\r\n  return(0);\r\n}\r\n\r\nCURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,\r\n                                      struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sock = conn->sock[sockindex];\r\n  CURLcode code;\r\n  ssize_t actualread;\r\n  ssize_t written;\r\n  int result;\r\n  OM_uint32 gss_major_status, gss_minor_status, gss_status;\r\n  OM_uint32 gss_ret_flags;\r\n  int gss_conf_state, gss_enc;\r\n  gss_buffer_desc  service = GSS_C_EMPTY_BUFFER;\r\n  gss_buffer_desc  gss_send_token = GSS_C_EMPTY_BUFFER;\r\n  gss_buffer_desc  gss_recv_token = GSS_C_EMPTY_BUFFER;\r\n  gss_buffer_desc  gss_w_token = GSS_C_EMPTY_BUFFER;\r\n  gss_buffer_desc* gss_token = GSS_C_NO_BUFFER;\r\n  gss_name_t       server = GSS_C_NO_NAME;\r\n  gss_name_t       gss_client_name = GSS_C_NO_NAME;\r\n  unsigned short   us_length;\r\n  char             *user=NULL;\r\n  unsigned char socksreq[4]; /* room for gssapi exchange header only */\r\n  char *serviceptr = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE];\r\n\r\n  /*   GSSAPI request looks like\r\n   * +----+------+-----+----------------+\r\n   * |VER | MTYP | LEN |     TOKEN      |\r\n   * +----+------+----------------------+\r\n   * | 1  |  1   |  2  | up to 2^16 - 1 |\r\n   * +----+------+-----+----------------+\r\n   */\r\n\r\n  /* prepare service name */\r\n  if(strchr(serviceptr,'/')) {\r\n    service.value = malloc(strlen(serviceptr));\r\n    if(!service.value)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    service.length = strlen(serviceptr);\r\n    memcpy(service.value, serviceptr, service.length);\r\n\r\n    gss_major_status = gss_import_name(&gss_minor_status, &service,\r\n                                       (gss_OID) GSS_C_NULL_OID, &server);\r\n  }\r\n  else {\r\n    service.value = malloc(strlen(serviceptr) +strlen(conn->proxy.name)+2);\r\n    if(!service.value)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    service.length = strlen(serviceptr) +strlen(conn->proxy.name)+1;\r\n    snprintf(service.value, service.length+1, \"%s@%s\",\r\n             serviceptr, conn->proxy.name);\r\n\r\n    gss_major_status = gss_import_name(&gss_minor_status, &service,\r\n                                       gss_nt_service_name, &server);\r\n  }\r\n\r\n  gss_release_buffer(&gss_status, &service); /* clear allocated memory */\r\n\r\n  if(check_gss_err(data,gss_major_status,\r\n                   gss_minor_status,\"gss_import_name()\")) {\r\n    failf(data, \"Failed to create service name.\");\r\n    gss_release_name(&gss_status, &server);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  /* As long as we need to keep sending some context info, and there's no  */\r\n  /* errors, keep sending it...                                            */\r\n  for(;;) {\r\n    gss_major_status = Curl_gss_init_sec_context(data,\r\n                                                 &gss_minor_status,\r\n                                                 &gss_context,\r\n                                                 server,\r\n                                                 NULL,\r\n                                                 gss_token,\r\n                                                 &gss_send_token,\r\n                                                 &gss_ret_flags);\r\n\r\n    if(gss_token != GSS_C_NO_BUFFER)\r\n      gss_release_buffer(&gss_status, &gss_recv_token);\r\n    if(check_gss_err(data,gss_major_status,\r\n                     gss_minor_status,\"gss_init_sec_context\")) {\r\n      gss_release_name(&gss_status, &server);\r\n      gss_release_buffer(&gss_status, &gss_recv_token);\r\n      gss_release_buffer(&gss_status, &gss_send_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      failf(data, \"Failed to initial GSSAPI token.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    if(gss_send_token.length != 0) {\r\n      socksreq[0] = 1;    /* gssapi subnegotiation version */\r\n      socksreq[1] = 1;    /* authentication message type */\r\n      us_length = htons((short)gss_send_token.length);\r\n      memcpy(socksreq+2,&us_length,sizeof(short));\r\n\r\n      code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);\r\n      if((code != CURLE_OK) || (4 != written)) {\r\n        failf(data, \"Failed to send GSSAPI authentication request.\");\r\n        gss_release_name(&gss_status, &server);\r\n        gss_release_buffer(&gss_status, &gss_recv_token);\r\n        gss_release_buffer(&gss_status, &gss_send_token);\r\n        gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n        return CURLE_COULDNT_CONNECT;\r\n      }\r\n\r\n      code = Curl_write_plain(conn, sock, (char *)gss_send_token.value,\r\n                              gss_send_token.length, &written);\r\n\r\n      if((code != CURLE_OK) || ((ssize_t)gss_send_token.length != written)) {\r\n        failf(data, \"Failed to send GSSAPI authentication token.\");\r\n        gss_release_name(&gss_status, &server);\r\n        gss_release_buffer(&gss_status, &gss_recv_token);\r\n        gss_release_buffer(&gss_status, &gss_send_token);\r\n        gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n        return CURLE_COULDNT_CONNECT;\r\n      }\r\n\r\n    }\r\n\r\n    gss_release_buffer(&gss_status, &gss_send_token);\r\n    gss_release_buffer(&gss_status, &gss_recv_token);\r\n    if(gss_major_status != GSS_S_CONTINUE_NEEDED) break;\r\n\r\n    /* analyse response */\r\n\r\n    /*   GSSAPI response looks like\r\n     * +----+------+-----+----------------+\r\n     * |VER | MTYP | LEN |     TOKEN      |\r\n     * +----+------+----------------------+\r\n     * | 1  |  1   |  2  | up to 2^16 - 1 |\r\n     * +----+------+-----+----------------+\r\n     */\r\n\r\n    result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);\r\n    if(result != CURLE_OK || actualread != 4) {\r\n      failf(data, \"Failed to receive GSSAPI authentication response.\");\r\n      gss_release_name(&gss_status, &server);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    /* ignore the first (VER) byte */\r\n    if(socksreq[1] == 255) { /* status / message type */\r\n      failf(data, \"User was rejected by the SOCKS5 server (%d %d).\",\r\n            socksreq[0], socksreq[1]);\r\n      gss_release_name(&gss_status, &server);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    if(socksreq[1] != 1) { /* status / messgae type */\r\n      failf(data, \"Invalid GSSAPI authentication response type (%d %d).\",\r\n            socksreq[0], socksreq[1]);\r\n      gss_release_name(&gss_status, &server);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    memcpy(&us_length, socksreq+2, sizeof(short));\r\n    us_length = ntohs(us_length);\r\n\r\n    gss_recv_token.length=us_length;\r\n    gss_recv_token.value=malloc(us_length);\r\n    if(!gss_recv_token.value) {\r\n      failf(data,\r\n            \"Could not allocate memory for GSSAPI authentication \"\r\n            \"response token.\");\r\n      gss_release_name(&gss_status, &server);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    result=Curl_blockread_all(conn, sock, (char *)gss_recv_token.value,\r\n                              gss_recv_token.length, &actualread);\r\n\r\n    if(result != CURLE_OK || actualread != us_length) {\r\n      failf(data, \"Failed to receive GSSAPI authentication token.\");\r\n      gss_release_name(&gss_status, &server);\r\n      gss_release_buffer(&gss_status, &gss_recv_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    gss_token = &gss_recv_token;\r\n  }\r\n\r\n  gss_release_name(&gss_status, &server);\r\n\r\n  /* Everything is good so far, user was authenticated! */\r\n  gss_major_status = gss_inquire_context (&gss_minor_status, gss_context,\r\n                                          &gss_client_name, NULL, NULL, NULL,\r\n                                          NULL, NULL, NULL);\r\n  if(check_gss_err(data,gss_major_status,\r\n                   gss_minor_status,\"gss_inquire_context\")) {\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    gss_release_name(&gss_status, &gss_client_name);\r\n    failf(data, \"Failed to determine user name.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  gss_major_status = gss_display_name(&gss_minor_status, gss_client_name,\r\n                                      &gss_send_token, NULL);\r\n  if(check_gss_err(data,gss_major_status,\r\n                   gss_minor_status,\"gss_display_name\")) {\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    gss_release_name(&gss_status, &gss_client_name);\r\n    gss_release_buffer(&gss_status, &gss_send_token);\r\n    failf(data, \"Failed to determine user name.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  user=malloc(gss_send_token.length+1);\r\n  if(!user) {\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    gss_release_name(&gss_status, &gss_client_name);\r\n    gss_release_buffer(&gss_status, &gss_send_token);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  memcpy(user, gss_send_token.value, gss_send_token.length);\r\n  user[gss_send_token.length] = '\\0';\r\n  gss_release_name(&gss_status, &gss_client_name);\r\n  gss_release_buffer(&gss_status, &gss_send_token);\r\n  infof(data, \"SOCKS5 server authencticated user %s with gssapi.\\n\",user);\r\n  free(user);\r\n  user=NULL;\r\n\r\n  /* Do encryption */\r\n  socksreq[0] = 1;    /* gssapi subnegotiation version */\r\n  socksreq[1] = 2;    /* encryption message type */\r\n\r\n  gss_enc = 0; /* no data protection */\r\n  /* do confidentiality protection if supported */\r\n  if(gss_ret_flags & GSS_C_CONF_FLAG)\r\n    gss_enc = 2;\r\n  /* else do integrity protection */\r\n  else if(gss_ret_flags & GSS_C_INTEG_FLAG)\r\n    gss_enc = 1;\r\n\r\n  infof(data, \"SOCKS5 server supports gssapi %s data protection.\\n\",\r\n        (gss_enc==0)?\"no\":((gss_enc==1)?\"integrity\":\"confidentiality\"));\r\n  /* force for the moment to no data protection */\r\n  gss_enc = 0;\r\n  /*\r\n   * Sending the encryption type in clear seems wrong. It should be\r\n   * protected with gss_seal()/gss_wrap(). See RFC1961 extract below\r\n   * The NEC reference implementations on which this is based is\r\n   * therefore at fault\r\n   *\r\n   *  +------+------+------+.......................+\r\n   *  + ver  | mtyp | len  |   token               |\r\n   *  +------+------+------+.......................+\r\n   *  + 0x01 | 0x02 | 0x02 | up to 2^16 - 1 octets |\r\n   *  +------+------+------+.......................+\r\n   *\r\n   *   Where:\r\n   *\r\n   *  - \"ver\" is the protocol version number, here 1 to represent the\r\n   *    first version of the SOCKS/GSS-API protocol\r\n   *\r\n   *  - \"mtyp\" is the message type, here 2 to represent a protection\r\n   *    -level negotiation message\r\n   *\r\n   *  - \"len\" is the length of the \"token\" field in octets\r\n   *\r\n   *  - \"token\" is the GSS-API encapsulated protection level\r\n   *\r\n   * The token is produced by encapsulating an octet containing the\r\n   * required protection level using gss_seal()/gss_wrap() with conf_req\r\n   * set to FALSE.  The token is verified using gss_unseal()/\r\n   * gss_unwrap().\r\n   *\r\n   */\r\n  if(data->set.socks5_gssapi_nec) {\r\n    us_length = htons((short)1);\r\n    memcpy(socksreq+2,&us_length,sizeof(short));\r\n  }\r\n  else {\r\n    gss_send_token.length = 1;\r\n    gss_send_token.value = malloc(1);\r\n    if(!gss_send_token.value) {\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    memcpy(gss_send_token.value, &gss_enc, 1);\r\n\r\n    gss_major_status = gss_wrap(&gss_minor_status, gss_context, 0,\r\n                                GSS_C_QOP_DEFAULT, &gss_send_token,\r\n                                &gss_conf_state, &gss_w_token);\r\n\r\n    if(check_gss_err(data,gss_major_status,gss_minor_status,\"gss_wrap\")) {\r\n      gss_release_buffer(&gss_status, &gss_send_token);\r\n      gss_release_buffer(&gss_status, &gss_w_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      failf(data, \"Failed to wrap GSSAPI encryption value into token.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    gss_release_buffer(&gss_status, &gss_send_token);\r\n\r\n    us_length = htons((short)gss_w_token.length);\r\n    memcpy(socksreq+2,&us_length,sizeof(short));\r\n  }\r\n\r\n  code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);\r\n  if((code != CURLE_OK) || (4 != written)) {\r\n    failf(data, \"Failed to send GSSAPI encryption request.\");\r\n    gss_release_buffer(&gss_status, &gss_w_token);\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(data->set.socks5_gssapi_nec) {\r\n    memcpy(socksreq, &gss_enc, 1);\r\n    code = Curl_write_plain(conn, sock, socksreq, 1, &written);\r\n    if((code != CURLE_OK) || ( 1 != written)) {\r\n      failf(data, \"Failed to send GSSAPI encryption type.\");\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n  }\r\n  else {\r\n    code = Curl_write_plain(conn, sock, (char *)gss_w_token.value,\r\n                            gss_w_token.length, &written);\r\n    if((code != CURLE_OK) || ((ssize_t)gss_w_token.length != written)) {\r\n      failf(data, \"Failed to send GSSAPI encryption type.\");\r\n      gss_release_buffer(&gss_status, &gss_w_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    gss_release_buffer(&gss_status, &gss_w_token);\r\n  }\r\n\r\n  result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);\r\n  if(result != CURLE_OK || actualread != 4) {\r\n    failf(data, \"Failed to receive GSSAPI encryption response.\");\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  /* ignore the first (VER) byte */\r\n  if(socksreq[1] == 255) { /* status / message type */\r\n    failf(data, \"User was rejected by the SOCKS5 server (%d %d).\",\r\n          socksreq[0], socksreq[1]);\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(socksreq[1] != 2) { /* status / messgae type */\r\n    failf(data, \"Invalid GSSAPI encryption response type (%d %d).\",\r\n          socksreq[0], socksreq[1]);\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  memcpy(&us_length, socksreq+2, sizeof(short));\r\n  us_length = ntohs(us_length);\r\n\r\n  gss_recv_token.length= us_length;\r\n  gss_recv_token.value=malloc(gss_recv_token.length);\r\n  if(!gss_recv_token.value) {\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  result=Curl_blockread_all(conn, sock, (char *)gss_recv_token.value,\r\n                            gss_recv_token.length, &actualread);\r\n\r\n  if(result != CURLE_OK || actualread != us_length) {\r\n    failf(data, \"Failed to receive GSSAPI encryptrion type.\");\r\n    gss_release_buffer(&gss_status, &gss_recv_token);\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(!data->set.socks5_gssapi_nec) {\r\n    gss_major_status = gss_unwrap(&gss_minor_status, gss_context,\r\n                                  &gss_recv_token, &gss_w_token,\r\n                                  0, GSS_C_QOP_DEFAULT);\r\n\r\n    if(check_gss_err(data,gss_major_status,gss_minor_status,\"gss_unwrap\")) {\r\n      gss_release_buffer(&gss_status, &gss_recv_token);\r\n      gss_release_buffer(&gss_status, &gss_w_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      failf(data, \"Failed to unwrap GSSAPI encryption value into token.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    gss_release_buffer(&gss_status, &gss_recv_token);\r\n\r\n    if(gss_w_token.length != 1) {\r\n      failf(data, \"Invalid GSSAPI encryption response length (%d).\",\r\n            gss_w_token.length);\r\n      gss_release_buffer(&gss_status, &gss_w_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    memcpy(socksreq,gss_w_token.value,gss_w_token.length);\r\n    gss_release_buffer(&gss_status, &gss_w_token);\r\n  }\r\n  else {\r\n    if(gss_recv_token.length != 1) {\r\n      failf(data, \"Invalid GSSAPI encryption response length (%d).\",\r\n            gss_recv_token.length);\r\n      gss_release_buffer(&gss_status, &gss_recv_token);\r\n      gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    memcpy(socksreq,gss_recv_token.value,gss_recv_token.length);\r\n    gss_release_buffer(&gss_status, &gss_recv_token);\r\n  }\r\n\r\n  infof(data, \"SOCKS5 access with%s protection granted.\\n\",\r\n        (socksreq[0]==0)?\"out gssapi data\":\r\n        ((socksreq[0]==1)?\" gssapi integrity\":\" gssapi confidentiality\"));\r\n\r\n  conn->socks5_gssapi_enctype = socksreq[0];\r\n  if(socksreq[0] == 0)\r\n    gss_delete_sec_context(&gss_status, &gss_context, NULL);\r\n\r\n  return CURLE_OK;\r\n}\r\n#endif\r\n\r\n#endif /* CURL_DISABLE_PROXY */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/socks_sspi.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com>\r\n * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(USE_WINDOWS_SSPI) && !defined(CURL_DISABLE_PROXY)\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"timeval.h\"\r\n#include \"socks.h\"\r\n#include \"curl_sspi.h\"\r\n#include \"curl_multibyte.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use the internal *printf() functions */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/*\r\n * Definitions required from ntsecapi.h are directly provided below this point\r\n * to avoid including ntsecapi.h due to a conflict with OpenSSL's safestack.h\r\n */\r\n#define KERB_WRAP_NO_ENCRYPT 0x80000001\r\n\r\n/*\r\n * Helper sspi error functions.\r\n */\r\nstatic int check_sspi_err(struct connectdata *conn,\r\n                          SECURITY_STATUS status,\r\n                          const char* function)\r\n{\r\n  if(status != SEC_E_OK &&\r\n     status != SEC_I_COMPLETE_AND_CONTINUE &&\r\n     status != SEC_I_COMPLETE_NEEDED &&\r\n     status != SEC_I_CONTINUE_NEEDED) {\r\n    failf(conn->data, \"SSPI error: %s failed: %s\", function,\r\n          Curl_sspi_strerror(conn, status));\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* This is the SSPI-using version of this function */\r\nCURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,\r\n                                      struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sock = conn->sock[sockindex];\r\n  CURLcode code;\r\n  ssize_t actualread;\r\n  ssize_t written;\r\n  int result;\r\n  /* Needs GSSAPI authentication */\r\n  SECURITY_STATUS status;\r\n  unsigned long sspi_ret_flags = 0;\r\n  int gss_enc;\r\n  SecBuffer sspi_send_token, sspi_recv_token, sspi_w_token[3];\r\n  SecBufferDesc input_desc, output_desc, wrap_desc;\r\n  SecPkgContext_Sizes sspi_sizes;\r\n  CredHandle cred_handle;\r\n  CtxtHandle sspi_context;\r\n  PCtxtHandle context_handle = NULL;\r\n  SecPkgCredentials_Names names;\r\n  TimeStamp expiry;\r\n  char *service_name = NULL;\r\n  unsigned short us_length;\r\n  unsigned long qop;\r\n  unsigned char socksreq[4]; /* room for gssapi exchange header only */\r\n  char *service = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE];\r\n\r\n  /*   GSSAPI request looks like\r\n   * +----+------+-----+----------------+\r\n   * |VER | MTYP | LEN |     TOKEN      |\r\n   * +----+------+----------------------+\r\n   * | 1  |  1   |  2  | up to 2^16 - 1 |\r\n   * +----+------+-----+----------------+\r\n   */\r\n\r\n  /* prepare service name */\r\n  if(strchr(service, '/')) {\r\n    service_name = malloc(strlen(service));\r\n    if(!service_name)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    memcpy(service_name, service, strlen(service));\r\n  }\r\n  else {\r\n    service_name = malloc(strlen(service) + strlen(conn->proxy.name) + 2);\r\n    if(!service_name)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    snprintf(service_name,strlen(service) +strlen(conn->proxy.name)+2,\"%s/%s\",\r\n             service,conn->proxy.name);\r\n  }\r\n\r\n  input_desc.cBuffers = 1;\r\n  input_desc.pBuffers = &sspi_recv_token;\r\n  input_desc.ulVersion = SECBUFFER_VERSION;\r\n\r\n  sspi_recv_token.BufferType = SECBUFFER_TOKEN;\r\n  sspi_recv_token.cbBuffer = 0;\r\n  sspi_recv_token.pvBuffer = NULL;\r\n\r\n  output_desc.cBuffers = 1;\r\n  output_desc.pBuffers = &sspi_send_token;\r\n  output_desc.ulVersion = SECBUFFER_VERSION;\r\n\r\n  sspi_send_token.BufferType = SECBUFFER_TOKEN;\r\n  sspi_send_token.cbBuffer = 0;\r\n  sspi_send_token.pvBuffer = NULL;\r\n\r\n  wrap_desc.cBuffers = 3;\r\n  wrap_desc.pBuffers = sspi_w_token;\r\n  wrap_desc.ulVersion = SECBUFFER_VERSION;\r\n\r\n  cred_handle.dwLower = 0;\r\n  cred_handle.dwUpper = 0;\r\n\r\n  status = s_pSecFn->AcquireCredentialsHandle(NULL,\r\n                                              (TCHAR *) TEXT(\"Kerberos\"),\r\n                                              SECPKG_CRED_OUTBOUND,\r\n                                              NULL,\r\n                                              NULL,\r\n                                              NULL,\r\n                                              NULL,\r\n                                              &cred_handle,\r\n                                              &expiry);\r\n\r\n  if(check_sspi_err(conn, status, \"AcquireCredentialsHandle\")) {\r\n    failf(data, \"Failed to acquire credentials.\");\r\n    Curl_safefree(service_name);\r\n    s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  /* As long as we need to keep sending some context info, and there's no  */\r\n  /* errors, keep sending it...                                            */\r\n  for(;;) {\r\n    TCHAR *sname;\r\n\r\n    sname = Curl_convert_UTF8_to_tchar(service_name);\r\n    if(!sname)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    status = s_pSecFn->InitializeSecurityContext(&cred_handle,\r\n                                                 context_handle,\r\n                                                 sname,\r\n                                                 ISC_REQ_MUTUAL_AUTH |\r\n                                                 ISC_REQ_ALLOCATE_MEMORY |\r\n                                                 ISC_REQ_CONFIDENTIALITY |\r\n                                                 ISC_REQ_REPLAY_DETECT,\r\n                                                 0,\r\n                                                 SECURITY_NATIVE_DREP,\r\n                                                 &input_desc,\r\n                                                 0,\r\n                                                 &sspi_context,\r\n                                                 &output_desc,\r\n                                                 &sspi_ret_flags,\r\n                                                 &expiry);\r\n\r\n    Curl_unicodefree(sname);\r\n\r\n    if(sspi_recv_token.pvBuffer) {\r\n      s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);\r\n      sspi_recv_token.pvBuffer = NULL;\r\n      sspi_recv_token.cbBuffer = 0;\r\n    }\r\n\r\n    if(check_sspi_err(conn, status, \"InitializeSecurityContext\")) {\r\n      Curl_safefree(service_name);\r\n      s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);\r\n      failf(data, \"Failed to initialise security context.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    if(sspi_send_token.cbBuffer != 0) {\r\n      socksreq[0] = 1;    /* gssapi subnegotiation version */\r\n      socksreq[1] = 1;    /* authentication message type */\r\n      us_length = htons((short)sspi_send_token.cbBuffer);\r\n      memcpy(socksreq+2, &us_length, sizeof(short));\r\n\r\n      code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);\r\n      if((code != CURLE_OK) || (4 != written)) {\r\n        failf(data, \"Failed to send SSPI authentication request.\");\r\n        Curl_safefree(service_name);\r\n        s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);\r\n        s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);\r\n        s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n        s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n        return CURLE_COULDNT_CONNECT;\r\n      }\r\n\r\n      code = Curl_write_plain(conn, sock, (char *)sspi_send_token.pvBuffer,\r\n                              sspi_send_token.cbBuffer, &written);\r\n      if((code != CURLE_OK) || (sspi_send_token.cbBuffer != (size_t)written)) {\r\n        failf(data, \"Failed to send SSPI authentication token.\");\r\n        Curl_safefree(service_name);\r\n        s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);\r\n        s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);\r\n        s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n        s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n        return CURLE_COULDNT_CONNECT;\r\n      }\r\n\r\n    }\r\n\r\n    s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);\r\n    sspi_send_token.pvBuffer = NULL;\r\n    sspi_send_token.cbBuffer = 0;\r\n    s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);\r\n    sspi_recv_token.pvBuffer = NULL;\r\n    sspi_recv_token.cbBuffer = 0;\r\n    if(status != SEC_I_CONTINUE_NEEDED)\r\n      break;\r\n\r\n    /* analyse response */\r\n\r\n    /*   GSSAPI response looks like\r\n     * +----+------+-----+----------------+\r\n     * |VER | MTYP | LEN |     TOKEN      |\r\n     * +----+------+----------------------+\r\n     * | 1  |  1   |  2  | up to 2^16 - 1 |\r\n     * +----+------+-----+----------------+\r\n     */\r\n\r\n    result = Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);\r\n    if(result != CURLE_OK || actualread != 4) {\r\n      failf(data, \"Failed to receive SSPI authentication response.\");\r\n      Curl_safefree(service_name);\r\n      s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    /* ignore the first (VER) byte */\r\n    if(socksreq[1] == 255) { /* status / message type */\r\n      failf(data, \"User was rejected by the SOCKS5 server (%d %d).\",\r\n            socksreq[0], socksreq[1]);\r\n      Curl_safefree(service_name);\r\n      s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    if(socksreq[1] != 1) { /* status / messgae type */\r\n      failf(data, \"Invalid SSPI authentication response type (%d %d).\",\r\n            socksreq[0], socksreq[1]);\r\n      Curl_safefree(service_name);\r\n      s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    memcpy(&us_length, socksreq+2, sizeof(short));\r\n    us_length = ntohs(us_length);\r\n\r\n    sspi_recv_token.cbBuffer = us_length;\r\n    sspi_recv_token.pvBuffer = malloc(us_length);\r\n\r\n    if(!sspi_recv_token.pvBuffer) {\r\n      Curl_safefree(service_name);\r\n      s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    result = Curl_blockread_all(conn, sock, (char *)sspi_recv_token.pvBuffer,\r\n                                sspi_recv_token.cbBuffer, &actualread);\r\n\r\n    if(result != CURLE_OK || actualread != us_length) {\r\n      failf(data, \"Failed to receive SSPI authentication token.\");\r\n      Curl_safefree(service_name);\r\n      s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);\r\n      s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    context_handle = &sspi_context;\r\n  }\r\n\r\n  Curl_safefree(service_name);\r\n\r\n  /* Everything is good so far, user was authenticated! */\r\n  status = s_pSecFn->QueryCredentialsAttributes(&cred_handle,\r\n                                                SECPKG_CRED_ATTR_NAMES,\r\n                                                &names);\r\n  s_pSecFn->FreeCredentialsHandle(&cred_handle);\r\n  if(check_sspi_err(conn, status, \"QueryCredentialAttributes\")) {\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    s_pSecFn->FreeContextBuffer(names.sUserName);\r\n    failf(data, \"Failed to determine user name.\");\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n  infof(data, \"SOCKS5 server authencticated user %s with gssapi.\\n\",\r\n        names.sUserName);\r\n  s_pSecFn->FreeContextBuffer(names.sUserName);\r\n\r\n  /* Do encryption */\r\n  socksreq[0] = 1;    /* gssapi subnegotiation version */\r\n  socksreq[1] = 2;    /* encryption message type */\r\n\r\n  gss_enc = 0; /* no data protection */\r\n  /* do confidentiality protection if supported */\r\n  if(sspi_ret_flags & ISC_REQ_CONFIDENTIALITY)\r\n    gss_enc = 2;\r\n  /* else do integrity protection */\r\n  else if(sspi_ret_flags & ISC_REQ_INTEGRITY)\r\n    gss_enc = 1;\r\n\r\n  infof(data, \"SOCKS5 server supports gssapi %s data protection.\\n\",\r\n        (gss_enc==0)?\"no\":((gss_enc==1)?\"integrity\":\"confidentiality\") );\r\n  /* force to no data protection, avoid encryption/decryption for now */\r\n  gss_enc = 0;\r\n  /*\r\n   * Sending the encryption type in clear seems wrong. It should be\r\n   * protected with gss_seal()/gss_wrap(). See RFC1961 extract below\r\n   * The NEC reference implementations on which this is based is\r\n   * therefore at fault\r\n   *\r\n   *  +------+------+------+.......................+\r\n   *  + ver  | mtyp | len  |   token               |\r\n   *  +------+------+------+.......................+\r\n   *  + 0x01 | 0x02 | 0x02 | up to 2^16 - 1 octets |\r\n   *  +------+------+------+.......................+\r\n   *\r\n   *   Where:\r\n   *\r\n   *  - \"ver\" is the protocol version number, here 1 to represent the\r\n   *    first version of the SOCKS/GSS-API protocol\r\n   *\r\n   *  - \"mtyp\" is the message type, here 2 to represent a protection\r\n   *    -level negotiation message\r\n   *\r\n   *  - \"len\" is the length of the \"token\" field in octets\r\n   *\r\n   *  - \"token\" is the GSS-API encapsulated protection level\r\n   *\r\n   * The token is produced by encapsulating an octet containing the\r\n   * required protection level using gss_seal()/gss_wrap() with conf_req\r\n   * set to FALSE.  The token is verified using gss_unseal()/\r\n   * gss_unwrap().\r\n   *\r\n   */\r\n\r\n  if(data->set.socks5_gssapi_nec) {\r\n    us_length = htons((short)1);\r\n    memcpy(socksreq+2, &us_length, sizeof(short));\r\n  }\r\n  else {\r\n    status = s_pSecFn->QueryContextAttributes(&sspi_context,\r\n                                              SECPKG_ATTR_SIZES,\r\n                                              &sspi_sizes);\r\n    if(check_sspi_err(conn, status, \"QueryContextAttributes\")) {\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      failf(data, \"Failed to query security context attributes.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    sspi_w_token[0].cbBuffer = sspi_sizes.cbSecurityTrailer;\r\n    sspi_w_token[0].BufferType = SECBUFFER_TOKEN;\r\n    sspi_w_token[0].pvBuffer = malloc(sspi_sizes.cbSecurityTrailer);\r\n\r\n    if(!sspi_w_token[0].pvBuffer) {\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    sspi_w_token[1].cbBuffer = 1;\r\n    sspi_w_token[1].pvBuffer = malloc(1);\r\n    if(!sspi_w_token[1].pvBuffer) {\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    memcpy(sspi_w_token[1].pvBuffer,&gss_enc,1);\r\n    sspi_w_token[2].BufferType = SECBUFFER_PADDING;\r\n    sspi_w_token[2].cbBuffer = sspi_sizes.cbBlockSize;\r\n    sspi_w_token[2].pvBuffer = malloc(sspi_sizes.cbBlockSize);\r\n    if(!sspi_w_token[2].pvBuffer) {\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    status = s_pSecFn->EncryptMessage(&sspi_context,\r\n                                      KERB_WRAP_NO_ENCRYPT,\r\n                                      &wrap_desc,\r\n                                      0);\r\n    if(check_sspi_err(conn, status, \"EncryptMessage\")) {\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[2].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      failf(data, \"Failed to query security context attributes.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    sspi_send_token.cbBuffer = sspi_w_token[0].cbBuffer\r\n      + sspi_w_token[1].cbBuffer\r\n      + sspi_w_token[2].cbBuffer;\r\n    sspi_send_token.pvBuffer = malloc(sspi_send_token.cbBuffer);\r\n    if(!sspi_send_token.pvBuffer) {\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[2].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    memcpy(sspi_send_token.pvBuffer, sspi_w_token[0].pvBuffer,\r\n           sspi_w_token[0].cbBuffer);\r\n    memcpy((PUCHAR) sspi_send_token.pvBuffer +(int)sspi_w_token[0].cbBuffer,\r\n           sspi_w_token[1].pvBuffer, sspi_w_token[1].cbBuffer);\r\n    memcpy((PUCHAR) sspi_send_token.pvBuffer\r\n           +sspi_w_token[0].cbBuffer\r\n           +sspi_w_token[1].cbBuffer,\r\n           sspi_w_token[2].pvBuffer, sspi_w_token[2].cbBuffer);\r\n\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n    sspi_w_token[0].pvBuffer = NULL;\r\n    sspi_w_token[0].cbBuffer = 0;\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n    sspi_w_token[1].pvBuffer = NULL;\r\n    sspi_w_token[1].cbBuffer = 0;\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[2].pvBuffer);\r\n    sspi_w_token[2].pvBuffer = NULL;\r\n    sspi_w_token[2].cbBuffer = 0;\r\n\r\n    us_length = htons((short)sspi_send_token.cbBuffer);\r\n    memcpy(socksreq+2,&us_length,sizeof(short));\r\n  }\r\n\r\n  code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);\r\n  if((code != CURLE_OK) || (4 != written)) {\r\n    failf(data, \"Failed to send SSPI encryption request.\");\r\n    s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(data->set.socks5_gssapi_nec) {\r\n    memcpy(socksreq,&gss_enc,1);\r\n    code = Curl_write_plain(conn, sock, (char *)socksreq, 1, &written);\r\n    if((code != CURLE_OK) || (1 != written)) {\r\n      failf(data, \"Failed to send SSPI encryption type.\");\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n  }\r\n  else {\r\n    code = Curl_write_plain(conn, sock, (char *)sspi_send_token.pvBuffer,\r\n                            sspi_send_token.cbBuffer, &written);\r\n    if((code != CURLE_OK) || (sspi_send_token.cbBuffer != (size_t)written)) {\r\n      failf(data, \"Failed to send SSPI encryption type.\");\r\n      s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);\r\n  }\r\n\r\n  result = Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);\r\n  if(result != CURLE_OK || actualread != 4) {\r\n    failf(data, \"Failed to receive SSPI encryption response.\");\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  /* ignore the first (VER) byte */\r\n  if(socksreq[1] == 255) { /* status / message type */\r\n    failf(data, \"User was rejected by the SOCKS5 server (%d %d).\",\r\n          socksreq[0], socksreq[1]);\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  if(socksreq[1] != 2) { /* status / message type */\r\n    failf(data, \"Invalid SSPI encryption response type (%d %d).\",\r\n          socksreq[0], socksreq[1]);\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n  memcpy(&us_length, socksreq+2, sizeof(short));\r\n  us_length = ntohs(us_length);\r\n\r\n  sspi_w_token[0].cbBuffer = us_length;\r\n  sspi_w_token[0].pvBuffer = malloc(us_length);\r\n  if(!sspi_w_token[0].pvBuffer) {\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  result = Curl_blockread_all(conn, sock, (char *)sspi_w_token[0].pvBuffer,\r\n                              sspi_w_token[0].cbBuffer, &actualread);\r\n\r\n  if(result != CURLE_OK || actualread != us_length) {\r\n    failf(data, \"Failed to receive SSPI encryption type.\");\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n    s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n    return CURLE_COULDNT_CONNECT;\r\n  }\r\n\r\n\r\n  if(!data->set.socks5_gssapi_nec) {\r\n    wrap_desc.cBuffers = 2;\r\n    sspi_w_token[0].BufferType = SECBUFFER_STREAM;\r\n    sspi_w_token[1].BufferType = SECBUFFER_DATA;\r\n    sspi_w_token[1].cbBuffer = 0;\r\n    sspi_w_token[1].pvBuffer = NULL;\r\n\r\n    status = s_pSecFn->DecryptMessage(&sspi_context,\r\n                                      &wrap_desc,\r\n                                      0,\r\n                                      &qop);\r\n\r\n    if(check_sspi_err(conn, status, \"DecryptMessage\")) {\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      failf(data, \"Failed to query security context attributes.\");\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    if(sspi_w_token[1].cbBuffer != 1) {\r\n      failf(data, \"Invalid SSPI encryption response length (%d).\",\r\n            sspi_w_token[1].cbBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n\r\n    memcpy(socksreq,sspi_w_token[1].pvBuffer,sspi_w_token[1].cbBuffer);\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);\r\n  }\r\n  else {\r\n    if(sspi_w_token[0].cbBuffer != 1) {\r\n      failf(data, \"Invalid SSPI encryption response length (%d).\",\r\n            sspi_w_token[0].cbBuffer);\r\n      s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n      s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    memcpy(socksreq,sspi_w_token[0].pvBuffer,sspi_w_token[0].cbBuffer);\r\n    s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);\r\n  }\r\n\r\n  infof(data, \"SOCKS5 access with%s protection granted.\\n\",\r\n        (socksreq[0]==0)?\"out gssapi data\":\r\n        ((socksreq[0]==1)?\" gssapi integrity\":\" gssapi confidentiality\"));\r\n\r\n  /* For later use if encryption is required\r\n     conn->socks5_gssapi_enctype = socksreq[0];\r\n     if(socksreq[0] != 0)\r\n       conn->socks5_sspi_context = sspi_context;\r\n     else {\r\n       s_pSecFn->DeleteSecurityContext(&sspi_context);\r\n       conn->socks5_sspi_context = sspi_context;\r\n     }\r\n  */\r\n  return CURLE_OK;\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/speedcheck.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"multiif.h\"\r\n#include \"speedcheck.h\"\r\n\r\nvoid Curl_speedinit(struct SessionHandle *data)\r\n{\r\n  memset(&data->state.keeps_speed, 0, sizeof(struct timeval));\r\n}\r\n\r\nCURLcode Curl_speedcheck(struct SessionHandle *data,\r\n                         struct timeval now)\r\n{\r\n  if((data->progress.current_speed >= 0) &&\r\n     data->set.low_speed_time &&\r\n     (Curl_tvlong(data->state.keeps_speed) != 0) &&\r\n     (data->progress.current_speed < data->set.low_speed_limit)) {\r\n    long howlong = Curl_tvdiff(now, data->state.keeps_speed);\r\n    long nextcheck = (data->set.low_speed_time * 1000) - howlong;\r\n\r\n    /* We are now below the \"low speed limit\". If we are below it\r\n       for \"low speed time\" seconds we consider that enough reason\r\n       to abort the download. */\r\n    if(nextcheck <= 0) {\r\n      /* we have been this slow for long enough, now die */\r\n      failf(data,\r\n            \"Operation too slow. \"\r\n            \"Less than %ld bytes/sec transferred the last %ld seconds\",\r\n            data->set.low_speed_limit,\r\n            data->set.low_speed_time);\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n    else {\r\n      /* wait complete low_speed_time */\r\n      Curl_expire(data, nextcheck);\r\n    }\r\n  }\r\n  else {\r\n    /* we keep up the required speed all right */\r\n    data->state.keeps_speed = now;\r\n\r\n    if(data->set.low_speed_limit)\r\n      /* if there is a low speed limit enabled, we set the expire timer to\r\n         make this connection's speed get checked again no later than when\r\n         this time is up */\r\n      Curl_expire(data, data->set.low_speed_time*1000);\r\n  }\r\n  return CURLE_OK;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/speedcheck.h",
    "content": "#ifndef HEADER_CURL_SPEEDCHECK_H\r\n#define HEADER_CURL_SPEEDCHECK_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"timeval.h\"\r\n\r\nvoid Curl_speedinit(struct SessionHandle *data);\r\nCURLcode Curl_speedcheck(struct SessionHandle *data,\r\n                         struct timeval now);\r\n\r\n#endif /* HEADER_CURL_SPEEDCHECK_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/splay.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1997 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"splay.h\"\r\n\r\n/*\r\n * This macro compares two node keys i and j and returns:\r\n *\r\n *  negative value: when i is smaller than j\r\n *  zero          : when i is equal   to   j\r\n *  positive when : when i is larger  than j\r\n */\r\n#define compare(i,j) Curl_splaycomparekeys((i),(j))\r\n\r\n/*\r\n * Splay using the key i (which may or may not be in the tree.) The starting\r\n * root is t.\r\n */\r\nstruct Curl_tree *Curl_splay(struct timeval i,\r\n                             struct Curl_tree *t)\r\n{\r\n  struct Curl_tree N, *l, *r, *y;\r\n  long comp;\r\n\r\n  if(t == NULL)\r\n    return t;\r\n  N.smaller = N.larger = NULL;\r\n  l = r = &N;\r\n\r\n  for(;;) {\r\n    comp = compare(i, t->key);\r\n    if(comp < 0) {\r\n      if(t->smaller == NULL)\r\n        break;\r\n      if(compare(i, t->smaller->key) < 0) {\r\n        y = t->smaller;                           /* rotate smaller */\r\n        t->smaller = y->larger;\r\n        y->larger = t;\r\n        t = y;\r\n        if(t->smaller == NULL)\r\n          break;\r\n      }\r\n      r->smaller = t;                               /* link smaller */\r\n      r = t;\r\n      t = t->smaller;\r\n    }\r\n    else if(comp > 0) {\r\n      if(t->larger == NULL)\r\n        break;\r\n      if(compare(i, t->larger->key) > 0) {\r\n        y = t->larger;                          /* rotate larger */\r\n        t->larger = y->smaller;\r\n        y->smaller = t;\r\n        t = y;\r\n        if(t->larger == NULL)\r\n          break;\r\n      }\r\n      l->larger = t;                              /* link larger */\r\n      l = t;\r\n      t = t->larger;\r\n    }\r\n    else\r\n      break;\r\n  }\r\n\r\n  l->larger = t->smaller;                                /* assemble */\r\n  r->smaller = t->larger;\r\n  t->smaller = N.larger;\r\n  t->larger = N.smaller;\r\n\r\n  return t;\r\n}\r\n\r\n/* Insert key i into the tree t.  Return a pointer to the resulting tree or\r\n * NULL if something went wrong.\r\n *\r\n * @unittest: 1309\r\n */\r\nstruct Curl_tree *Curl_splayinsert(struct timeval i,\r\n                                   struct Curl_tree *t,\r\n                                   struct Curl_tree *node)\r\n{\r\n  static struct timeval KEY_NOTUSED = {-1,-1}; /* will *NEVER* appear */\r\n\r\n  if(node == NULL)\r\n    return t;\r\n\r\n  if(t != NULL) {\r\n    t = Curl_splay(i,t);\r\n    if(compare(i, t->key)==0) {\r\n      /* There already exists a node in the tree with the very same key. Build\r\n         a linked list of nodes. We make the new 'node' struct the new master\r\n         node and make the previous node the first one in the 'same' list. */\r\n\r\n      node->same = t;\r\n      node->key = i;\r\n      node->smaller = t->smaller;\r\n      node->larger = t->larger;\r\n\r\n      t->smaller = node; /* in the sub node for this same key, we use the\r\n                            smaller pointer to point back to the master\r\n                            node */\r\n\r\n      t->key = KEY_NOTUSED; /* and we set the key in the sub node to NOTUSED\r\n                               to quickly identify this node as a subnode */\r\n\r\n      return node; /* new root node */\r\n    }\r\n  }\r\n\r\n  if(t == NULL) {\r\n    node->smaller = node->larger = NULL;\r\n  }\r\n  else if(compare(i, t->key) < 0) {\r\n    node->smaller = t->smaller;\r\n    node->larger = t;\r\n    t->smaller = NULL;\r\n\r\n  }\r\n  else {\r\n    node->larger = t->larger;\r\n    node->smaller = t;\r\n    t->larger = NULL;\r\n  }\r\n  node->key = i;\r\n\r\n  node->same = NULL; /* no identical node (yet) */\r\n  return node;\r\n}\r\n\r\n/* Finds and deletes the best-fit node from the tree. Return a pointer to the\r\n   resulting tree.  best-fit means the node with the given or lower key */\r\nstruct Curl_tree *Curl_splaygetbest(struct timeval i,\r\n                                    struct Curl_tree *t,\r\n                                    struct Curl_tree **removed)\r\n{\r\n  struct Curl_tree *x;\r\n\r\n  if(!t) {\r\n    *removed = NULL; /* none removed since there was no root */\r\n    return NULL;\r\n  }\r\n\r\n  t = Curl_splay(i,t);\r\n  if(compare(i, t->key) < 0) {\r\n    /* too big node, try the smaller chain */\r\n    if(t->smaller)\r\n      t=Curl_splay(t->smaller->key, t);\r\n    else {\r\n      /* fail */\r\n      *removed = NULL;\r\n      return t;\r\n    }\r\n  }\r\n\r\n  if(compare(i, t->key) >= 0) {               /* found it */\r\n    /* FIRST! Check if there is a list with identical keys */\r\n    x = t->same;\r\n    if(x) {\r\n      /* there is, pick one from the list */\r\n\r\n      /* 'x' is the new root node */\r\n\r\n      x->key = t->key;\r\n      x->larger = t->larger;\r\n      x->smaller = t->smaller;\r\n\r\n      *removed = t;\r\n      return x; /* new root */\r\n    }\r\n\r\n    if(t->smaller == NULL) {\r\n      x = t->larger;\r\n    }\r\n    else {\r\n      x = Curl_splay(i, t->smaller);\r\n      x->larger = t->larger;\r\n    }\r\n    *removed = t;\r\n\r\n    return x;\r\n  }\r\n  else {\r\n    *removed = NULL; /* no match */\r\n    return t;        /* It wasn't there */\r\n  }\r\n}\r\n\r\n\r\n/* Deletes the very node we point out from the tree if it's there. Stores a\r\n * pointer to the new resulting tree in 'newroot'.\r\n *\r\n * Returns zero on success and non-zero on errors! TODO: document error codes.\r\n * When returning error, it does not touch the 'newroot' pointer.\r\n *\r\n * NOTE: when the last node of the tree is removed, there's no tree left so\r\n * 'newroot' will be made to point to NULL.\r\n *\r\n * @unittest: 1309\r\n */\r\nint Curl_splayremovebyaddr(struct Curl_tree *t,\r\n                           struct Curl_tree *removenode,\r\n                           struct Curl_tree **newroot)\r\n{\r\n  static struct timeval KEY_NOTUSED = {-1,-1}; /* will *NEVER* appear */\r\n  struct Curl_tree *x;\r\n\r\n  if(!t || !removenode)\r\n    return 1;\r\n\r\n  if(compare(KEY_NOTUSED, removenode->key) == 0) {\r\n    /* Key set to NOTUSED means it is a subnode within a 'same' linked list\r\n       and thus we can unlink it easily. The 'smaller' link of a subnode\r\n       links to the parent node. */\r\n    if(removenode->smaller == NULL)\r\n      return 3;\r\n\r\n    removenode->smaller->same = removenode->same;\r\n    if(removenode->same)\r\n      removenode->same->smaller = removenode->smaller;\r\n\r\n    /* Ensures that double-remove gets caught. */\r\n    removenode->smaller = NULL;\r\n\r\n    /* voila, we're done! */\r\n    *newroot = t; /* return the same root */\r\n    return 0;\r\n  }\r\n\r\n  t = Curl_splay(removenode->key, t);\r\n\r\n  /* First make sure that we got the same root node as the one we want\r\n     to remove, as otherwise we might be trying to remove a node that\r\n     isn't actually in the tree.\r\n\r\n     We cannot just compare the keys here as a double remove in quick\r\n     succession of a node with key != KEY_NOTUSED && same != NULL\r\n     could return the same key but a different node. */\r\n  if(t != removenode)\r\n    return 2;\r\n\r\n  /* Check if there is a list with identical sizes, as then we're trying to\r\n     remove the root node of a list of nodes with identical keys. */\r\n  x = t->same;\r\n  if(x) {\r\n    /* 'x' is the new root node, we just make it use the root node's\r\n       smaller/larger links */\r\n\r\n    x->key = t->key;\r\n    x->larger = t->larger;\r\n    x->smaller = t->smaller;\r\n  }\r\n  else {\r\n    /* Remove the root node */\r\n    if(t->smaller == NULL)\r\n      x = t->larger;\r\n    else {\r\n      x = Curl_splay(removenode->key, t->smaller);\r\n      x->larger = t->larger;\r\n    }\r\n  }\r\n\r\n  *newroot = x; /* store new root pointer */\r\n\r\n  return 0;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/splay.h",
    "content": "#ifndef HEADER_CURL_SPLAY_H\r\n#define HEADER_CURL_SPLAY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1997 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\nstruct Curl_tree {\r\n  struct Curl_tree *smaller; /* smaller node */\r\n  struct Curl_tree *larger;  /* larger node */\r\n  struct Curl_tree *same;    /* points to a node with identical key */\r\n  struct timeval key;        /* this node's \"sort\" key */\r\n  void *payload;             /* data the splay code doesn't care about */\r\n};\r\n\r\nstruct Curl_tree *Curl_splay(struct timeval i,\r\n                             struct Curl_tree *t);\r\n\r\nstruct Curl_tree *Curl_splayinsert(struct timeval key,\r\n                                   struct Curl_tree *t,\r\n                                   struct Curl_tree *newnode);\r\n\r\n#if 0\r\nstruct Curl_tree *Curl_splayremove(struct timeval key,\r\n                                   struct Curl_tree *t,\r\n                                   struct Curl_tree **removed);\r\n#endif\r\n\r\nstruct Curl_tree *Curl_splaygetbest(struct timeval key,\r\n                                    struct Curl_tree *t,\r\n                                    struct Curl_tree **removed);\r\n\r\nint Curl_splayremovebyaddr(struct Curl_tree *t,\r\n                           struct Curl_tree *removenode,\r\n                           struct Curl_tree **newroot);\r\n\r\n#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec)  < (j.tv_sec))  ? -1 : \\\r\n                                   ( ((i.tv_sec)  > (j.tv_sec))  ?  1 : \\\r\n                                   ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \\\r\n                                   ( ((i.tv_usec) > (j.tv_usec)) ?  1 : 0 ))))\r\n\r\n#ifdef DEBUGBUILD\r\nvoid Curl_splayprint(struct Curl_tree * t, int d, char output);\r\n#else\r\n#define Curl_splayprint(x,y,z) Curl_nop_stmt\r\n#endif\r\n\r\n#endif /* HEADER_CURL_SPLAY_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ssh.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* #define CURL_LIBSSH2_DEBUG */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_LIBSSH2\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#  include <limits.h>\r\n#endif\r\n\r\n#include <libssh2.h>\r\n#include <libssh2_sftp.h>\r\n\r\n#ifdef HAVE_FCNTL_H\r\n#include <fcntl.h>\r\n#endif\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_UTSNAME_H\r\n#include <sys/utsname.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#if (defined(NETWARE) && defined(__NOVELL_LIBC__))\r\n#undef in_addr_t\r\n#define in_addr_t unsigned long\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"hostip.h\"\r\n#include \"progress.h\"\r\n#include \"transfer.h\"\r\n#include \"escape.h\"\r\n#include \"http.h\" /* for HTTP proxy tunnel stuff */\r\n#include \"ssh.h\"\r\n#include \"url.h\"\r\n#include \"speedcheck.h\"\r\n#include \"getinfo.h\"\r\n\r\n#include \"strequal.h\"\r\n#include \"sslgen.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"inet_ntop.h\"\r\n#include \"parsedate.h\" /* for the week day and month names */\r\n#include \"sockaddr.h\" /* required for Curl_sockaddr_storage */\r\n#include \"strtoofft.h\"\r\n#include \"multiif.h\"\r\n#include \"select.h\"\r\n#include \"warnless.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifdef WIN32\r\n#  undef  PATH_MAX\r\n#  define PATH_MAX MAX_PATH\r\n#endif\r\n\r\n#ifndef PATH_MAX\r\n#define PATH_MAX 1024 /* just an extra precaution since there are systems that\r\n                         have their definition hidden well */\r\n#endif\r\n\r\n#define sftp_libssh2_last_error(s) curlx_ultosi(libssh2_sftp_last_error(s))\r\n\r\n#define sftp_libssh2_realpath(s,p,t,m) \\\r\n        libssh2_sftp_symlink_ex((s), (p), curlx_uztoui(strlen(p)), \\\r\n                                (t), (m), LIBSSH2_SFTP_REALPATH)\r\n\r\n/* Local functions: */\r\nstatic const char *sftp_libssh2_strerror(int err);\r\nstatic LIBSSH2_ALLOC_FUNC(my_libssh2_malloc);\r\nstatic LIBSSH2_REALLOC_FUNC(my_libssh2_realloc);\r\nstatic LIBSSH2_FREE_FUNC(my_libssh2_free);\r\n\r\nstatic CURLcode get_pathname(const char **cpp, char **path);\r\n\r\nstatic CURLcode ssh_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done);\r\nstatic CURLcode ssh_do(struct connectdata *conn, bool *done);\r\n\r\nstatic CURLcode ssh_getworkingpath(struct connectdata *conn,\r\n                                   char *homedir, /* when SFTP is used */\r\n                                   char **path);\r\n\r\nstatic CURLcode scp_done(struct connectdata *conn,\r\n                         CURLcode, bool premature);\r\nstatic CURLcode scp_doing(struct connectdata *conn,\r\n                          bool *dophase_done);\r\nstatic CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection);\r\n\r\nstatic CURLcode sftp_done(struct connectdata *conn,\r\n                          CURLcode, bool premature);\r\nstatic CURLcode sftp_doing(struct connectdata *conn,\r\n                           bool *dophase_done);\r\nstatic CURLcode sftp_disconnect(struct connectdata *conn, bool dead);\r\nstatic\r\nCURLcode sftp_perform(struct connectdata *conn,\r\n                      bool *connected,\r\n                      bool *dophase_done);\r\n\r\nstatic int ssh_getsock(struct connectdata *conn,\r\n                       curl_socket_t *sock, /* points to numsocks number\r\n                                               of sockets */\r\n                       int numsocks);\r\n\r\nstatic int ssh_perform_getsock(const struct connectdata *conn,\r\n                               curl_socket_t *sock, /* points to numsocks\r\n                                                       number of sockets */\r\n                               int numsocks);\r\n\r\n/*\r\n * SCP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_scp = {\r\n  \"SCP\",                                /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  ssh_do,                               /* do_it */\r\n  scp_done,                             /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ssh_connect,                          /* connect_it */\r\n  ssh_multi_statemach,                  /* connecting */\r\n  scp_doing,                            /* doing */\r\n  ssh_getsock,                          /* proto_getsock */\r\n  ssh_getsock,                          /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ssh_perform_getsock,                  /* perform_getsock */\r\n  scp_disconnect,                       /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_SSH,                             /* defport */\r\n  CURLPROTO_SCP,                        /* protocol */\r\n  PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION\r\n  | PROTOPT_NOURLQUERY                  /* flags */\r\n};\r\n\r\n\r\n/*\r\n * SFTP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_sftp = {\r\n  \"SFTP\",                               /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  ssh_do,                               /* do_it */\r\n  sftp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ssh_connect,                          /* connect_it */\r\n  ssh_multi_statemach,                  /* connecting */\r\n  sftp_doing,                           /* doing */\r\n  ssh_getsock,                          /* proto_getsock */\r\n  ssh_getsock,                          /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ssh_perform_getsock,                  /* perform_getsock */\r\n  sftp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_SSH,                             /* defport */\r\n  CURLPROTO_SFTP,                       /* protocol */\r\n  PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION\r\n  | PROTOPT_NOURLQUERY                  /* flags */\r\n};\r\n\r\n\r\nstatic void\r\nkbd_callback(const char *name, int name_len, const char *instruction,\r\n             int instruction_len, int num_prompts,\r\n             const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,\r\n             LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,\r\n             void **abstract)\r\n{\r\n  struct connectdata *conn = (struct connectdata *)*abstract;\r\n\r\n#ifdef CURL_LIBSSH2_DEBUG\r\n  fprintf(stderr, \"name=%s\\n\", name);\r\n  fprintf(stderr, \"name_len=%d\\n\", name_len);\r\n  fprintf(stderr, \"instruction=%s\\n\", instruction);\r\n  fprintf(stderr, \"instruction_len=%d\\n\", instruction_len);\r\n  fprintf(stderr, \"num_prompts=%d\\n\", num_prompts);\r\n#else\r\n  (void)name;\r\n  (void)name_len;\r\n  (void)instruction;\r\n  (void)instruction_len;\r\n#endif  /* CURL_LIBSSH2_DEBUG */\r\n  if(num_prompts == 1) {\r\n    responses[0].text = strdup(conn->passwd);\r\n    responses[0].length = curlx_uztoui(strlen(conn->passwd));\r\n  }\r\n  (void)prompts;\r\n  (void)abstract;\r\n} /* kbd_callback */\r\n\r\nstatic CURLcode sftp_libssh2_error_to_CURLE(int err)\r\n{\r\n  switch (err) {\r\n    case LIBSSH2_FX_OK:\r\n      return CURLE_OK;\r\n\r\n    case LIBSSH2_FX_NO_SUCH_FILE:\r\n    case LIBSSH2_FX_NO_SUCH_PATH:\r\n      return CURLE_REMOTE_FILE_NOT_FOUND;\r\n\r\n    case LIBSSH2_FX_PERMISSION_DENIED:\r\n    case LIBSSH2_FX_WRITE_PROTECT:\r\n    case LIBSSH2_FX_LOCK_CONFlICT:\r\n      return CURLE_REMOTE_ACCESS_DENIED;\r\n\r\n    case LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM:\r\n    case LIBSSH2_FX_QUOTA_EXCEEDED:\r\n      return CURLE_REMOTE_DISK_FULL;\r\n\r\n    case LIBSSH2_FX_FILE_ALREADY_EXISTS:\r\n      return CURLE_REMOTE_FILE_EXISTS;\r\n\r\n    case LIBSSH2_FX_DIR_NOT_EMPTY:\r\n      return CURLE_QUOTE_ERROR;\r\n\r\n    default:\r\n      break;\r\n  }\r\n\r\n  return CURLE_SSH;\r\n}\r\n\r\nstatic CURLcode libssh2_session_error_to_CURLE(int err)\r\n{\r\n  switch (err) {\r\n    /* Ordered by order of appearance in libssh2.h */\r\n    case LIBSSH2_ERROR_NONE:\r\n      return CURLE_OK;\r\n\r\n    case LIBSSH2_ERROR_SOCKET_NONE:\r\n      return CURLE_COULDNT_CONNECT;\r\n\r\n    case LIBSSH2_ERROR_ALLOC:\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    case LIBSSH2_ERROR_SOCKET_SEND:\r\n      return CURLE_SEND_ERROR;\r\n\r\n    case LIBSSH2_ERROR_HOSTKEY_INIT:\r\n    case LIBSSH2_ERROR_HOSTKEY_SIGN:\r\n    case LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED:\r\n    case LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED:\r\n      return CURLE_PEER_FAILED_VERIFICATION;\r\n\r\n    case LIBSSH2_ERROR_PASSWORD_EXPIRED:\r\n      return CURLE_LOGIN_DENIED;\r\n\r\n    case LIBSSH2_ERROR_SOCKET_TIMEOUT:\r\n    case LIBSSH2_ERROR_TIMEOUT:\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n\r\n    case LIBSSH2_ERROR_EAGAIN:\r\n      return CURLE_AGAIN;\r\n  }\r\n\r\n  /* TODO: map some more of the libssh2 errors to the more appropriate CURLcode\r\n     error code, and possibly add a few new SSH-related one. We must however\r\n     not return or even depend on libssh2 errors in the public libcurl API */\r\n\r\n  return CURLE_SSH;\r\n}\r\n\r\nstatic LIBSSH2_ALLOC_FUNC(my_libssh2_malloc)\r\n{\r\n  (void)abstract; /* arg not used */\r\n  return malloc(count);\r\n}\r\n\r\nstatic LIBSSH2_REALLOC_FUNC(my_libssh2_realloc)\r\n{\r\n  (void)abstract; /* arg not used */\r\n  return realloc(ptr, count);\r\n}\r\n\r\nstatic LIBSSH2_FREE_FUNC(my_libssh2_free)\r\n{\r\n  (void)abstract; /* arg not used */\r\n  if(ptr) /* ssh2 agent sometimes call free with null ptr */\r\n    free(ptr);\r\n}\r\n\r\n/*\r\n * SSH State machine related code\r\n */\r\n/* This is the ONLY way to change SSH state! */\r\nstatic void state(struct connectdata *conn, sshstate nowstate)\r\n{\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  /* for debug purposes */\r\n  static const char * const names[] = {\r\n    \"SSH_STOP\",\r\n    \"SSH_INIT\",\r\n    \"SSH_S_STARTUP\",\r\n    \"SSH_HOSTKEY\",\r\n    \"SSH_AUTHLIST\",\r\n    \"SSH_AUTH_PKEY_INIT\",\r\n    \"SSH_AUTH_PKEY\",\r\n    \"SSH_AUTH_PASS_INIT\",\r\n    \"SSH_AUTH_PASS\",\r\n    \"SSH_AUTH_AGENT_INIT\",\r\n    \"SSH_AUTH_AGENT_LIST\",\r\n    \"SSH_AUTH_AGENT\",\r\n    \"SSH_AUTH_HOST_INIT\",\r\n    \"SSH_AUTH_HOST\",\r\n    \"SSH_AUTH_KEY_INIT\",\r\n    \"SSH_AUTH_KEY\",\r\n    \"SSH_AUTH_DONE\",\r\n    \"SSH_SFTP_INIT\",\r\n    \"SSH_SFTP_REALPATH\",\r\n    \"SSH_SFTP_QUOTE_INIT\",\r\n    \"SSH_SFTP_POSTQUOTE_INIT\",\r\n    \"SSH_SFTP_QUOTE\",\r\n    \"SSH_SFTP_NEXT_QUOTE\",\r\n    \"SSH_SFTP_QUOTE_STAT\",\r\n    \"SSH_SFTP_QUOTE_SETSTAT\",\r\n    \"SSH_SFTP_QUOTE_SYMLINK\",\r\n    \"SSH_SFTP_QUOTE_MKDIR\",\r\n    \"SSH_SFTP_QUOTE_RENAME\",\r\n    \"SSH_SFTP_QUOTE_RMDIR\",\r\n    \"SSH_SFTP_QUOTE_UNLINK\",\r\n    \"SSH_SFTP_TRANS_INIT\",\r\n    \"SSH_SFTP_UPLOAD_INIT\",\r\n    \"SSH_SFTP_CREATE_DIRS_INIT\",\r\n    \"SSH_SFTP_CREATE_DIRS\",\r\n    \"SSH_SFTP_CREATE_DIRS_MKDIR\",\r\n    \"SSH_SFTP_READDIR_INIT\",\r\n    \"SSH_SFTP_READDIR\",\r\n    \"SSH_SFTP_READDIR_LINK\",\r\n    \"SSH_SFTP_READDIR_BOTTOM\",\r\n    \"SSH_SFTP_READDIR_DONE\",\r\n    \"SSH_SFTP_DOWNLOAD_INIT\",\r\n    \"SSH_SFTP_DOWNLOAD_STAT\",\r\n    \"SSH_SFTP_CLOSE\",\r\n    \"SSH_SFTP_SHUTDOWN\",\r\n    \"SSH_SCP_TRANS_INIT\",\r\n    \"SSH_SCP_UPLOAD_INIT\",\r\n    \"SSH_SCP_DOWNLOAD_INIT\",\r\n    \"SSH_SCP_DONE\",\r\n    \"SSH_SCP_SEND_EOF\",\r\n    \"SSH_SCP_WAIT_EOF\",\r\n    \"SSH_SCP_WAIT_CLOSE\",\r\n    \"SSH_SCP_CHANNEL_FREE\",\r\n    \"SSH_SESSION_DISCONNECT\",\r\n    \"SSH_SESSION_FREE\",\r\n    \"QUIT\"\r\n  };\r\n#endif\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n\r\n#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  if(sshc->state != nowstate) {\r\n    infof(conn->data, \"SFTP %p state change from %s to %s\\n\",\r\n          sshc, names[sshc->state], names[nowstate]);\r\n  }\r\n#endif\r\n\r\n  sshc->state = nowstate;\r\n}\r\n\r\n/* figure out the path to work with in this particular request */\r\nstatic CURLcode ssh_getworkingpath(struct connectdata *conn,\r\n                                   char *homedir,  /* when SFTP is used */\r\n                                   char **path) /* returns the  allocated\r\n                                                   real path to work with */\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  char *real_path = NULL;\r\n  char *working_path;\r\n  int working_path_len;\r\n\r\n  working_path = curl_easy_unescape(data, data->state.path, 0,\r\n                                    &working_path_len);\r\n  if(!working_path)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* Check for /~/ , indicating relative to the user's home directory */\r\n  if(conn->handler->protocol & CURLPROTO_SCP) {\r\n    real_path = malloc(working_path_len+1);\r\n    if(real_path == NULL) {\r\n      free(working_path);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    if((working_path_len > 3) && (!memcmp(working_path, \"/~/\", 3)))\r\n      /* It is referenced to the home directory, so strip the leading '/~/' */\r\n      memcpy(real_path, working_path+3, 4 + working_path_len-3);\r\n    else\r\n      memcpy(real_path, working_path, 1 + working_path_len);\r\n  }\r\n  else if(conn->handler->protocol & CURLPROTO_SFTP) {\r\n    if((working_path_len > 1) && (working_path[1] == '~')) {\r\n      size_t homelen = strlen(homedir);\r\n      real_path = malloc(homelen + working_path_len + 1);\r\n      if(real_path == NULL) {\r\n        free(working_path);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      /* It is referenced to the home directory, so strip the\r\n         leading '/' */\r\n      memcpy(real_path, homedir, homelen);\r\n      real_path[homelen] = '/';\r\n      real_path[homelen+1] = '\\0';\r\n      if(working_path_len > 3) {\r\n        memcpy(real_path+homelen+1, working_path + 3,\r\n               1 + working_path_len -3);\r\n      }\r\n    }\r\n    else {\r\n      real_path = malloc(working_path_len+1);\r\n      if(real_path == NULL) {\r\n        free(working_path);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      memcpy(real_path, working_path, 1+working_path_len);\r\n    }\r\n  }\r\n\r\n  free(working_path);\r\n\r\n  /* store the pointer for the caller to receive */\r\n  *path = real_path;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\nstatic int sshkeycallback(CURL *easy,\r\n                          const struct curl_khkey *knownkey, /* known */\r\n                          const struct curl_khkey *foundkey, /* found */\r\n                          enum curl_khmatch match,\r\n                          void *clientp)\r\n{\r\n  (void)easy;\r\n  (void)knownkey;\r\n  (void)foundkey;\r\n  (void)clientp;\r\n\r\n  /* we only allow perfect matches, and we reject everything else */\r\n  return (match != CURLKHMATCH_OK)?CURLKHSTAT_REJECT:CURLKHSTAT_FINE;\r\n}\r\n#endif\r\n\r\n/*\r\n * Earlier libssh2 versions didn't have the ability to seek to 64bit positions\r\n * with 32bit size_t.\r\n */\r\n#ifdef HAVE_LIBSSH2_SFTP_SEEK64\r\n#define SFTP_SEEK(x,y) libssh2_sftp_seek64(x, (libssh2_uint64_t)y)\r\n#else\r\n#define SFTP_SEEK(x,y) libssh2_sftp_seek(x, (size_t)y)\r\n#endif\r\n\r\n/*\r\n * Earlier libssh2 versions didn't do SCP properly beyond 32bit sizes on 32bit\r\n * architectures so we check of the necessary function is present.\r\n */\r\n#ifndef HAVE_LIBSSH2_SCP_SEND64\r\n#define SCP_SEND(a,b,c,d) libssh2_scp_send_ex(a, b, (int)(c), (size_t)d, 0, 0)\r\n#else\r\n#define SCP_SEND(a,b,c,d) libssh2_scp_send64(a, b, (int)(c),            \\\r\n                                             (libssh2_uint64_t)d, 0, 0)\r\n#endif\r\n\r\n/*\r\n * libssh2 1.2.8 fixed the problem with 32bit ints used for sockets on win64.\r\n */\r\n#ifdef HAVE_LIBSSH2_SESSION_HANDSHAKE\r\n#define libssh2_session_startup(x,y) libssh2_session_handshake(x,y)\r\n#endif\r\n\r\nstatic CURLcode ssh_knownhost(struct connectdata *conn)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(data->set.str[STRING_SSH_KNOWNHOSTS]) {\r\n    /* we're asked to verify the host against a file */\r\n    struct ssh_conn *sshc = &conn->proto.sshc;\r\n    int rc;\r\n    int keytype;\r\n    size_t keylen;\r\n    const char *remotekey = libssh2_session_hostkey(sshc->ssh_session,\r\n                                                    &keylen, &keytype);\r\n    int keycheck = LIBSSH2_KNOWNHOST_CHECK_FAILURE;\r\n    int keybit = 0;\r\n\r\n    if(remotekey) {\r\n      /*\r\n       * A subject to figure out is what host name we need to pass in here.\r\n       * What host name does OpenSSH store in its file if an IDN name is\r\n       * used?\r\n       */\r\n      struct libssh2_knownhost *host;\r\n      enum curl_khmatch keymatch;\r\n      curl_sshkeycallback func =\r\n        data->set.ssh_keyfunc?data->set.ssh_keyfunc:sshkeycallback;\r\n      struct curl_khkey knownkey;\r\n      struct curl_khkey *knownkeyp = NULL;\r\n      struct curl_khkey foundkey;\r\n\r\n      keybit = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?\r\n        LIBSSH2_KNOWNHOST_KEY_SSHRSA:LIBSSH2_KNOWNHOST_KEY_SSHDSS;\r\n\r\n      keycheck = libssh2_knownhost_check(sshc->kh,\r\n                                         conn->host.name,\r\n                                         remotekey, keylen,\r\n                                         LIBSSH2_KNOWNHOST_TYPE_PLAIN|\r\n                                         LIBSSH2_KNOWNHOST_KEYENC_RAW|\r\n                                         keybit,\r\n                                         &host);\r\n\r\n      infof(data, \"SSH host check: %d, key: %s\\n\", keycheck,\r\n            (keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?\r\n            host->key:\"<none>\");\r\n\r\n      /* setup 'knownkey' */\r\n      if(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH) {\r\n        knownkey.key = host->key;\r\n        knownkey.len = 0;\r\n        knownkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?\r\n          CURLKHTYPE_RSA : CURLKHTYPE_DSS;\r\n        knownkeyp = &knownkey;\r\n      }\r\n\r\n      /* setup 'foundkey' */\r\n      foundkey.key = remotekey;\r\n      foundkey.len = keylen;\r\n      foundkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?\r\n        CURLKHTYPE_RSA : CURLKHTYPE_DSS;\r\n\r\n      /*\r\n       * if any of the LIBSSH2_KNOWNHOST_CHECK_* defines and the\r\n       * curl_khmatch enum are ever modified, we need to introduce a\r\n       * translation table here!\r\n       */\r\n      keymatch = (enum curl_khmatch)keycheck;\r\n\r\n      /* Ask the callback how to behave */\r\n      rc = func(data, knownkeyp, /* from the knownhosts file */\r\n                &foundkey, /* from the remote host */\r\n                keymatch, data->set.ssh_keyfunc_userp);\r\n    }\r\n    else\r\n      /* no remotekey means failure! */\r\n      rc = CURLKHSTAT_REJECT;\r\n\r\n    switch(rc) {\r\n    default: /* unknown return codes will equal reject */\r\n    case CURLKHSTAT_REJECT:\r\n      state(conn, SSH_SESSION_FREE);\r\n    case CURLKHSTAT_DEFER:\r\n      /* DEFER means bail out but keep the SSH_HOSTKEY state */\r\n      result = sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;\r\n      break;\r\n    case CURLKHSTAT_FINE:\r\n    case CURLKHSTAT_FINE_ADD_TO_FILE:\r\n      /* proceed */\r\n      if(keycheck != LIBSSH2_KNOWNHOST_CHECK_MATCH) {\r\n        /* the found host+key didn't match but has been told to be fine\r\n           anyway so we add it in memory */\r\n        int addrc = libssh2_knownhost_add(sshc->kh,\r\n                                          conn->host.name, NULL,\r\n                                          remotekey, keylen,\r\n                                          LIBSSH2_KNOWNHOST_TYPE_PLAIN|\r\n                                          LIBSSH2_KNOWNHOST_KEYENC_RAW|\r\n                                          keybit, NULL);\r\n        if(addrc)\r\n          infof(data, \"Warning adding the known host %s failed!\\n\",\r\n                conn->host.name);\r\n        else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE) {\r\n          /* now we write the entire in-memory list of known hosts to the\r\n             known_hosts file */\r\n          int wrc =\r\n            libssh2_knownhost_writefile(sshc->kh,\r\n                                        data->set.str[STRING_SSH_KNOWNHOSTS],\r\n                                        LIBSSH2_KNOWNHOST_FILE_OPENSSH);\r\n          if(wrc) {\r\n            infof(data, \"Warning, writing %s failed!\\n\",\r\n                  data->set.str[STRING_SSH_KNOWNHOSTS]);\r\n          }\r\n        }\r\n      }\r\n      break;\r\n    }\r\n  }\r\n#else /* HAVE_LIBSSH2_KNOWNHOST_API */\r\n  (void)conn;\r\n#endif\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ssh_check_fingerprint(struct connectdata *conn)\r\n{\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n  struct SessionHandle *data = conn->data;\r\n  const char *pubkey_md5 = data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5];\r\n  char md5buffer[33];\r\n  int i;\r\n\r\n  const char *fingerprint = libssh2_hostkey_hash(sshc->ssh_session,\r\n      LIBSSH2_HOSTKEY_HASH_MD5);\r\n\r\n  if(fingerprint) {\r\n    /* The fingerprint points to static storage (!), don't free() it. */\r\n    for(i = 0; i < 16; i++)\r\n      snprintf(&md5buffer[i*2], 3, \"%02x\", (unsigned char) fingerprint[i]);\r\n    infof(data, \"SSH MD5 fingerprint: %s\\n\", md5buffer);\r\n  }\r\n\r\n  /* Before we authenticate we check the hostkey's MD5 fingerprint\r\n   * against a known fingerprint, if available.\r\n   */\r\n  if(pubkey_md5 && strlen(pubkey_md5) == 32) {\r\n    if(!fingerprint || !strequal(md5buffer, pubkey_md5)) {\r\n      if(fingerprint)\r\n        failf(data,\r\n            \"Denied establishing ssh session: mismatch md5 fingerprint. \"\r\n            \"Remote %s is not equal to %s\", md5buffer, pubkey_md5);\r\n      else\r\n        failf(data,\r\n            \"Denied establishing ssh session: md5 fingerprint not available\");\r\n      state(conn, SSH_SESSION_FREE);\r\n      sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;\r\n      return sshc->actualcode;\r\n    }\r\n    else {\r\n      infof(data, \"MD5 checksum match!\\n\");\r\n      /* as we already matched, we skip the check for known hosts */\r\n      return CURLE_OK;\r\n    }\r\n  }\r\n  else\r\n    return ssh_knownhost(conn);\r\n}\r\n\r\n/*\r\n * ssh_statemach_act() runs the SSH state machine as far as it can without\r\n * blocking and without reaching the end.  The data the pointer 'block' points\r\n * to will be set to TRUE if the libssh2 function returns LIBSSH2_ERROR_EAGAIN\r\n * meaning it wants to be called again when the socket is ready\r\n */\r\n\r\nstatic CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n  struct SSHPROTO *sftp_scp = data->state.proto.ssh;\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n  curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n  char *new_readdir_line;\r\n  int rc = LIBSSH2_ERROR_NONE;\r\n  int err;\r\n  int seekerr = CURL_SEEKFUNC_OK;\r\n  *block = 0; /* we're not blocking by default */\r\n\r\n  do {\r\n\r\n    switch(sshc->state) {\r\n    case SSH_INIT:\r\n      sshc->secondCreateDirs = 0;\r\n      sshc->nextstate = SSH_NO_STATE;\r\n      sshc->actualcode = CURLE_OK;\r\n\r\n      /* Set libssh2 to non-blocking, since everything internally is\r\n         non-blocking */\r\n      libssh2_session_set_blocking(sshc->ssh_session, 0);\r\n\r\n      state(conn, SSH_S_STARTUP);\r\n      /* fall-through */\r\n\r\n    case SSH_S_STARTUP:\r\n      rc = libssh2_session_startup(sshc->ssh_session, (int)sock);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc) {\r\n        failf(data, \"Failure establishing ssh session\");\r\n        state(conn, SSH_SESSION_FREE);\r\n        sshc->actualcode = CURLE_FAILED_INIT;\r\n        break;\r\n      }\r\n\r\n      state(conn, SSH_HOSTKEY);\r\n\r\n      /* fall-through */\r\n    case SSH_HOSTKEY:\r\n      /*\r\n       * Before we authenticate we should check the hostkey's fingerprint\r\n       * against our known hosts. How that is handled (reading from file,\r\n       * whatever) is up to us.\r\n       */\r\n      result = ssh_check_fingerprint(conn);\r\n      if(result == CURLE_OK)\r\n        state(conn, SSH_AUTHLIST);\r\n      break;\r\n\r\n    case SSH_AUTHLIST:\r\n      /*\r\n       * Figure out authentication methods\r\n       * NB: As soon as we have provided a username to an openssh server we\r\n       * must never change it later. Thus, always specify the correct username\r\n       * here, even though the libssh2 docs kind of indicate that it should be\r\n       * possible to get a 'generic' list (not user-specific) of authentication\r\n       * methods, presumably with a blank username. That won't work in my\r\n       * experience.\r\n       * So always specify it here.\r\n       */\r\n      sshc->authlist = libssh2_userauth_list(sshc->ssh_session,\r\n                                             conn->user,\r\n                                             curlx_uztoui(strlen(conn->user)));\r\n\r\n      if(!sshc->authlist) {\r\n        if((err = libssh2_session_last_errno(sshc->ssh_session)) ==\r\n           LIBSSH2_ERROR_EAGAIN) {\r\n          rc = LIBSSH2_ERROR_EAGAIN;\r\n          break;\r\n        }\r\n        else {\r\n          state(conn, SSH_SESSION_FREE);\r\n          sshc->actualcode = libssh2_session_error_to_CURLE(err);\r\n          break;\r\n        }\r\n      }\r\n      infof(data, \"SSH authentication methods available: %s\\n\",\r\n            sshc->authlist);\r\n\r\n      state(conn, SSH_AUTH_PKEY_INIT);\r\n      break;\r\n\r\n    case SSH_AUTH_PKEY_INIT:\r\n      /*\r\n       * Check the supported auth types in the order I feel is most secure\r\n       * with the requested type of authentication\r\n       */\r\n      sshc->authed = FALSE;\r\n\r\n      if((data->set.ssh_auth_types & CURLSSH_AUTH_PUBLICKEY) &&\r\n         (strstr(sshc->authlist, \"publickey\") != NULL)) {\r\n        char *home = NULL;\r\n        bool rsa_pub_empty_but_ok = FALSE;\r\n\r\n        sshc->rsa_pub = sshc->rsa = NULL;\r\n\r\n        /* To ponder about: should really the lib be messing about with the\r\n           HOME environment variable etc? */\r\n        home = curl_getenv(\"HOME\");\r\n\r\n        if(data->set.str[STRING_SSH_PUBLIC_KEY] &&\r\n           !*data->set.str[STRING_SSH_PUBLIC_KEY])\r\n           rsa_pub_empty_but_ok = true;\r\n        else if(data->set.str[STRING_SSH_PUBLIC_KEY])\r\n          sshc->rsa_pub = aprintf(\"%s\", data->set.str[STRING_SSH_PUBLIC_KEY]);\r\n        else if(home)\r\n          sshc->rsa_pub = aprintf(\"%s/.ssh/id_dsa.pub\", home);\r\n        else\r\n          /* as a final resort, try current dir! */\r\n          sshc->rsa_pub = strdup(\"id_dsa.pub\");\r\n\r\n        if(!rsa_pub_empty_but_ok && (sshc->rsa_pub == NULL)) {\r\n          Curl_safefree(home);\r\n          state(conn, SSH_SESSION_FREE);\r\n          sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n          break;\r\n        }\r\n\r\n        if(data->set.str[STRING_SSH_PRIVATE_KEY])\r\n          sshc->rsa = aprintf(\"%s\", data->set.str[STRING_SSH_PRIVATE_KEY]);\r\n        else if(home)\r\n          sshc->rsa = aprintf(\"%s/.ssh/id_dsa\", home);\r\n        else\r\n          /* as a final resort, try current dir! */\r\n          sshc->rsa = strdup(\"id_dsa\");\r\n\r\n        if(sshc->rsa == NULL) {\r\n          Curl_safefree(home);\r\n          Curl_safefree(sshc->rsa_pub);\r\n          state(conn, SSH_SESSION_FREE);\r\n          sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n          break;\r\n        }\r\n\r\n        sshc->passphrase = data->set.str[STRING_KEY_PASSWD];\r\n        if(!sshc->passphrase)\r\n          sshc->passphrase = \"\";\r\n\r\n        Curl_safefree(home);\r\n\r\n        infof(data, \"Using ssh public key file %s\\n\", sshc->rsa_pub);\r\n        infof(data, \"Using ssh private key file %s\\n\", sshc->rsa);\r\n\r\n        state(conn, SSH_AUTH_PKEY);\r\n      }\r\n      else {\r\n        state(conn, SSH_AUTH_PASS_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_AUTH_PKEY:\r\n      /* The function below checks if the files exists, no need to stat() here.\r\n       */\r\n      rc = libssh2_userauth_publickey_fromfile_ex(sshc->ssh_session,\r\n                                                  conn->user,\r\n                                                  curlx_uztoui(\r\n                                                    strlen(conn->user)),\r\n                                                  sshc->rsa_pub,\r\n                                                  sshc->rsa, sshc->passphrase);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n\r\n      Curl_safefree(sshc->rsa_pub);\r\n      Curl_safefree(sshc->rsa);\r\n\r\n      if(rc == 0) {\r\n        sshc->authed = TRUE;\r\n        infof(data, \"Initialized SSH public key authentication\\n\");\r\n        state(conn, SSH_AUTH_DONE);\r\n      }\r\n      else {\r\n        char *err_msg;\r\n        (void)libssh2_session_last_error(sshc->ssh_session,\r\n                                         &err_msg, NULL, 0);\r\n        infof(data, \"SSH public key authentication failed: %s\\n\", err_msg);\r\n        state(conn, SSH_AUTH_PASS_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_AUTH_PASS_INIT:\r\n      if((data->set.ssh_auth_types & CURLSSH_AUTH_PASSWORD) &&\r\n         (strstr(sshc->authlist, \"password\") != NULL)) {\r\n        state(conn, SSH_AUTH_PASS);\r\n      }\r\n      else {\r\n        state(conn, SSH_AUTH_HOST_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_AUTH_PASS:\r\n      rc = libssh2_userauth_password_ex(sshc->ssh_session, conn->user,\r\n                                        curlx_uztoui(strlen(conn->user)),\r\n                                        conn->passwd,\r\n                                        curlx_uztoui(strlen(conn->passwd)),\r\n                                        NULL);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc == 0) {\r\n        sshc->authed = TRUE;\r\n        infof(data, \"Initialized password authentication\\n\");\r\n        state(conn, SSH_AUTH_DONE);\r\n      }\r\n      else {\r\n        state(conn, SSH_AUTH_HOST_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_AUTH_HOST_INIT:\r\n      if((data->set.ssh_auth_types & CURLSSH_AUTH_HOST) &&\r\n         (strstr(sshc->authlist, \"hostbased\") != NULL)) {\r\n        state(conn, SSH_AUTH_HOST);\r\n      }\r\n      else {\r\n        state(conn, SSH_AUTH_AGENT_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_AUTH_HOST:\r\n      state(conn, SSH_AUTH_AGENT_INIT);\r\n      break;\r\n\r\n    case SSH_AUTH_AGENT_INIT:\r\n#ifdef HAVE_LIBSSH2_AGENT_API\r\n      if((data->set.ssh_auth_types & CURLSSH_AUTH_AGENT)\r\n         && (strstr(sshc->authlist, \"publickey\") != NULL)) {\r\n\r\n        /* Connect to the ssh-agent */\r\n        /* The agent could be shared by a curl thread i believe\r\n           but nothing obvious as keys can be added/removed at any time */\r\n        if(!sshc->ssh_agent) {\r\n          sshc->ssh_agent = libssh2_agent_init(sshc->ssh_session);\r\n          if(!sshc->ssh_agent) {\r\n            infof(data, \"Could not create agent object\\n\");\r\n\r\n            state(conn, SSH_AUTH_KEY_INIT);\r\n          }\r\n        }\r\n\r\n        rc = libssh2_agent_connect(sshc->ssh_agent);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN)\r\n          break;\r\n        if(rc < 0) {\r\n          infof(data, \"Failure connecting to agent\\n\");\r\n          state(conn, SSH_AUTH_KEY_INIT);\r\n        }\r\n        else {\r\n          state(conn, SSH_AUTH_AGENT_LIST);\r\n        }\r\n      }\r\n      else\r\n#endif /* HAVE_LIBSSH2_AGENT_API */\r\n        state(conn, SSH_AUTH_KEY_INIT);\r\n      break;\r\n\r\n    case SSH_AUTH_AGENT_LIST:\r\n#ifdef HAVE_LIBSSH2_AGENT_API\r\n      rc = libssh2_agent_list_identities(sshc->ssh_agent);\r\n\r\n      if(rc == LIBSSH2_ERROR_EAGAIN)\r\n        break;\r\n      if(rc < 0) {\r\n        infof(data, \"Failure requesting identities to agent\\n\");\r\n        state(conn, SSH_AUTH_KEY_INIT);\r\n      }\r\n      else {\r\n        state(conn, SSH_AUTH_AGENT);\r\n        sshc->sshagent_prev_identity = NULL;\r\n      }\r\n#endif\r\n      break;\r\n\r\n    case SSH_AUTH_AGENT:\r\n#ifdef HAVE_LIBSSH2_AGENT_API\r\n      /* as prev_identity evolves only after an identity user auth finished we\r\n         can safely request it again as long as EAGAIN is returned here or by\r\n         libssh2_agent_userauth */\r\n      rc = libssh2_agent_get_identity(sshc->ssh_agent,\r\n                                      &sshc->sshagent_identity,\r\n                                      sshc->sshagent_prev_identity);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN)\r\n        break;\r\n\r\n      if(rc == 0) {\r\n        rc = libssh2_agent_userauth(sshc->ssh_agent, conn->user,\r\n                                    sshc->sshagent_identity);\r\n\r\n        if(rc < 0) {\r\n          if(rc != LIBSSH2_ERROR_EAGAIN) {\r\n            /* tried and failed? go to next identity */\r\n            sshc->sshagent_prev_identity = sshc->sshagent_identity;\r\n          }\r\n          break;\r\n        }\r\n      }\r\n\r\n      if(rc < 0)\r\n        infof(data, \"Failure requesting identities to agent\\n\");\r\n      else if(rc == 1)\r\n        infof(data, \"No identity would match\\n\");\r\n\r\n      if(rc == LIBSSH2_ERROR_NONE) {\r\n        sshc->authed = TRUE;\r\n        infof(data, \"Agent based authentication successful\\n\");\r\n        state(conn, SSH_AUTH_DONE);\r\n      }\r\n      else\r\n        state(conn, SSH_AUTH_KEY_INIT);\r\n#endif\r\n      break;\r\n\r\n    case SSH_AUTH_KEY_INIT:\r\n      if((data->set.ssh_auth_types & CURLSSH_AUTH_KEYBOARD)\r\n         && (strstr(sshc->authlist, \"keyboard-interactive\") != NULL)) {\r\n        state(conn, SSH_AUTH_KEY);\r\n      }\r\n      else {\r\n        state(conn, SSH_AUTH_DONE);\r\n      }\r\n      break;\r\n\r\n    case SSH_AUTH_KEY:\r\n      /* Authentication failed. Continue with keyboard-interactive now. */\r\n      rc = libssh2_userauth_keyboard_interactive_ex(sshc->ssh_session,\r\n                                                    conn->user,\r\n                                                    curlx_uztoui(\r\n                                                      strlen(conn->user)),\r\n                                                    &kbd_callback);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc == 0) {\r\n        sshc->authed = TRUE;\r\n        infof(data, \"Initialized keyboard interactive authentication\\n\");\r\n      }\r\n      state(conn, SSH_AUTH_DONE);\r\n      break;\r\n\r\n    case SSH_AUTH_DONE:\r\n      if(!sshc->authed) {\r\n        failf(data, \"Authentication failure\");\r\n        state(conn, SSH_SESSION_FREE);\r\n        sshc->actualcode = CURLE_LOGIN_DENIED;\r\n        break;\r\n      }\r\n\r\n      /*\r\n       * At this point we have an authenticated ssh session.\r\n       */\r\n      infof(data, \"Authentication complete\\n\");\r\n\r\n      Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSH is connected */\r\n\r\n      conn->sockfd = sock;\r\n      conn->writesockfd = CURL_SOCKET_BAD;\r\n\r\n      if(conn->handler->protocol == CURLPROTO_SFTP) {\r\n        state(conn, SSH_SFTP_INIT);\r\n        break;\r\n      }\r\n      infof(data, \"SSH CONNECT phase done\\n\");\r\n      state(conn, SSH_STOP);\r\n      break;\r\n\r\n    case SSH_SFTP_INIT:\r\n      /*\r\n       * Start the libssh2 sftp session\r\n       */\r\n      sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session);\r\n      if(!sshc->sftp_session) {\r\n        if(libssh2_session_last_errno(sshc->ssh_session) ==\r\n           LIBSSH2_ERROR_EAGAIN) {\r\n          rc = LIBSSH2_ERROR_EAGAIN;\r\n          break;\r\n        }\r\n        else {\r\n          char *err_msg;\r\n\r\n          (void)libssh2_session_last_error(sshc->ssh_session,\r\n                                           &err_msg, NULL, 0);\r\n          failf(data, \"Failure initializing sftp session: %s\", err_msg);\r\n          state(conn, SSH_SESSION_FREE);\r\n          sshc->actualcode = CURLE_FAILED_INIT;\r\n          break;\r\n        }\r\n      }\r\n      state(conn, SSH_SFTP_REALPATH);\r\n      break;\r\n\r\n    case SSH_SFTP_REALPATH:\r\n    {\r\n      char tempHome[PATH_MAX];\r\n\r\n      /*\r\n       * Get the \"home\" directory\r\n       */\r\n      rc = sftp_libssh2_realpath(sshc->sftp_session, \".\",\r\n                                 tempHome, PATH_MAX-1);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc > 0) {\r\n        /* It seems that this string is not always NULL terminated */\r\n        tempHome[rc] = '\\0';\r\n        sshc->homedir = strdup(tempHome);\r\n        if(!sshc->homedir) {\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n          break;\r\n        }\r\n        conn->data->state.most_recent_ftp_entrypath = sshc->homedir;\r\n      }\r\n      else {\r\n        /* Return the error type */\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        result = sftp_libssh2_error_to_CURLE(err);\r\n        sshc->actualcode = result?result:CURLE_SSH;\r\n        DEBUGF(infof(data, \"error = %d makes libcurl = %d\\n\",\r\n                     err, (int)result));\r\n        state(conn, SSH_STOP);\r\n        break;\r\n      }\r\n    }\r\n    /* This is the last step in the SFTP connect phase. Do note that while\r\n       we get the homedir here, we get the \"workingpath\" in the DO action\r\n       since the homedir will remain the same between request but the\r\n       working path will not. */\r\n    DEBUGF(infof(data, \"SSH CONNECT phase done\\n\"));\r\n    state(conn, SSH_STOP);\r\n    break;\r\n\r\n    case SSH_SFTP_QUOTE_INIT:\r\n\r\n      result = ssh_getworkingpath(conn, sshc->homedir, &sftp_scp->path);\r\n      if(result) {\r\n        sshc->actualcode = result;\r\n        state(conn, SSH_STOP);\r\n        break;\r\n      }\r\n\r\n      if(data->set.quote) {\r\n        infof(data, \"Sending quote commands\\n\");\r\n        sshc->quote_item = data->set.quote;\r\n        state(conn, SSH_SFTP_QUOTE);\r\n      }\r\n      else {\r\n        state(conn, SSH_SFTP_TRANS_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_POSTQUOTE_INIT:\r\n      if(data->set.postquote) {\r\n        infof(data, \"Sending quote commands\\n\");\r\n        sshc->quote_item = data->set.postquote;\r\n        state(conn, SSH_SFTP_QUOTE);\r\n      }\r\n      else {\r\n        state(conn, SSH_STOP);\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE:\r\n      /* Send any quote commands */\r\n    {\r\n      const char *cp;\r\n\r\n      /*\r\n       * Support some of the \"FTP\" commands\r\n       */\r\n      char *cmd = sshc->quote_item->data;\r\n      sshc->acceptfail = FALSE;\r\n\r\n      /* if a command starts with an asterisk, which a legal SFTP command never\r\n         can, the command will be allowed to fail without it causing any\r\n         aborts or cancels etc. It will cause libcurl to act as if the command\r\n         is successful, whatever the server reponds. */\r\n\r\n      if(cmd[0] == '*') {\r\n        cmd++;\r\n        sshc->acceptfail = TRUE;\r\n      }\r\n\r\n      if(curl_strequal(\"pwd\", cmd)) {\r\n        /* output debug output if that is requested */\r\n        char *tmp = aprintf(\"257 \\\"%s\\\" is current directory.\\n\",\r\n                            sftp_scp->path);\r\n        if(!tmp) {\r\n          result = CURLE_OUT_OF_MEMORY;\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          break;\r\n        }\r\n        if(data->set.verbose) {\r\n          Curl_debug(data, CURLINFO_HEADER_OUT, (char *)\"PWD\\n\", 4, conn);\r\n          Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp), conn);\r\n        }\r\n        /* this sends an FTP-like \"header\" to the header callback so that the\r\n           current directory can be read very similar to how it is read when\r\n           using ordinary FTP. */\r\n        result = Curl_client_write(conn, CLIENTWRITE_HEADER, tmp, strlen(tmp));\r\n        free(tmp);\r\n        state(conn, SSH_SFTP_NEXT_QUOTE);\r\n        break;\r\n      }\r\n      else if(cmd) {\r\n        /*\r\n         * the arguments following the command must be separated from the\r\n         * command with a space so we can check for it unconditionally\r\n         */\r\n        cp = strchr(cmd, ' ');\r\n        if(cp == NULL) {\r\n          failf(data, \"Syntax error in SFTP command. Supply parameter(s)!\");\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          sshc->actualcode = CURLE_QUOTE_ERROR;\r\n          break;\r\n        }\r\n\r\n        /*\r\n         * also, every command takes at least one argument so we get that\r\n         * first argument right now\r\n         */\r\n        result = get_pathname(&cp, &sshc->quote_path1);\r\n        if(result) {\r\n          if(result == CURLE_OUT_OF_MEMORY)\r\n            failf(data, \"Out of memory\");\r\n          else\r\n            failf(data, \"Syntax error: Bad first parameter\");\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          sshc->actualcode = result;\r\n          break;\r\n        }\r\n\r\n        /*\r\n         * SFTP is a binary protocol, so we don't send text commands to\r\n         * the server. Instead, we scan for commands for commands used by\r\n         * OpenSSH's sftp program and call the appropriate libssh2\r\n         * functions.\r\n         */\r\n        if(curl_strnequal(cmd, \"chgrp \", 6) ||\r\n           curl_strnequal(cmd, \"chmod \", 6) ||\r\n           curl_strnequal(cmd, \"chown \", 6) ) {\r\n          /* attribute change */\r\n\r\n          /* sshc->quote_path1 contains the mode to set */\r\n          /* get the destination */\r\n          result = get_pathname(&cp, &sshc->quote_path2);\r\n          if(result) {\r\n            if(result == CURLE_OUT_OF_MEMORY)\r\n              failf(data, \"Out of memory\");\r\n            else\r\n              failf(data, \"Syntax error in chgrp/chmod/chown: \"\r\n                    \"Bad second parameter\");\r\n            Curl_safefree(sshc->quote_path1);\r\n            state(conn, SSH_SFTP_CLOSE);\r\n            sshc->nextstate = SSH_NO_STATE;\r\n            sshc->actualcode = result;\r\n            break;\r\n          }\r\n          memset(&sshc->quote_attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));\r\n          state(conn, SSH_SFTP_QUOTE_STAT);\r\n          break;\r\n        }\r\n        else if(curl_strnequal(cmd, \"ln \", 3) ||\r\n                curl_strnequal(cmd, \"symlink \", 8)) {\r\n          /* symbolic linking */\r\n          /* sshc->quote_path1 is the source */\r\n          /* get the destination */\r\n          result = get_pathname(&cp, &sshc->quote_path2);\r\n          if(result) {\r\n            if(result == CURLE_OUT_OF_MEMORY)\r\n              failf(data, \"Out of memory\");\r\n            else\r\n              failf(data,\r\n                    \"Syntax error in ln/symlink: Bad second parameter\");\r\n            Curl_safefree(sshc->quote_path1);\r\n            state(conn, SSH_SFTP_CLOSE);\r\n            sshc->nextstate = SSH_NO_STATE;\r\n            sshc->actualcode = result;\r\n            break;\r\n          }\r\n          state(conn, SSH_SFTP_QUOTE_SYMLINK);\r\n          break;\r\n        }\r\n        else if(curl_strnequal(cmd, \"mkdir \", 6)) {\r\n          /* create dir */\r\n          state(conn, SSH_SFTP_QUOTE_MKDIR);\r\n          break;\r\n        }\r\n        else if(curl_strnequal(cmd, \"rename \", 7)) {\r\n          /* rename file */\r\n          /* first param is the source path */\r\n          /* second param is the dest. path */\r\n          result = get_pathname(&cp, &sshc->quote_path2);\r\n          if(result) {\r\n            if(result == CURLE_OUT_OF_MEMORY)\r\n              failf(data, \"Out of memory\");\r\n            else\r\n              failf(data, \"Syntax error in rename: Bad second parameter\");\r\n            Curl_safefree(sshc->quote_path1);\r\n            state(conn, SSH_SFTP_CLOSE);\r\n            sshc->nextstate = SSH_NO_STATE;\r\n            sshc->actualcode = result;\r\n            break;\r\n          }\r\n          state(conn, SSH_SFTP_QUOTE_RENAME);\r\n          break;\r\n        }\r\n        else if(curl_strnequal(cmd, \"rmdir \", 6)) {\r\n          /* delete dir */\r\n          state(conn, SSH_SFTP_QUOTE_RMDIR);\r\n          break;\r\n        }\r\n        else if(curl_strnequal(cmd, \"rm \", 3)) {\r\n          state(conn, SSH_SFTP_QUOTE_UNLINK);\r\n          break;\r\n        }\r\n\r\n        failf(data, \"Unknown SFTP command\");\r\n        Curl_safefree(sshc->quote_path1);\r\n        Curl_safefree(sshc->quote_path2);\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n    }\r\n    if(!sshc->quote_item) {\r\n      state(conn, SSH_SFTP_TRANS_INIT);\r\n    }\r\n    break;\r\n\r\n    case SSH_SFTP_NEXT_QUOTE:\r\n      Curl_safefree(sshc->quote_path1);\r\n      Curl_safefree(sshc->quote_path2);\r\n\r\n      sshc->quote_item = sshc->quote_item->next;\r\n\r\n      if(sshc->quote_item) {\r\n        state(conn, SSH_SFTP_QUOTE);\r\n      }\r\n      else {\r\n        if(sshc->nextstate != SSH_NO_STATE) {\r\n          state(conn, sshc->nextstate);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n        }\r\n        else {\r\n          state(conn, SSH_SFTP_TRANS_INIT);\r\n        }\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE_STAT:\r\n    {\r\n      char *cmd = sshc->quote_item->data;\r\n      sshc->acceptfail = FALSE;\r\n\r\n      /* if a command starts with an asterisk, which a legal SFTP command never\r\n         can, the command will be allowed to fail without it causing any\r\n         aborts or cancels etc. It will cause libcurl to act as if the command\r\n         is successful, whatever the server reponds. */\r\n\r\n      if(cmd[0] == '*') {\r\n        cmd++;\r\n        sshc->acceptfail = TRUE;\r\n      }\r\n\r\n      if(!curl_strnequal(cmd, \"chmod\", 5)) {\r\n        /* Since chown and chgrp only set owner OR group but libssh2 wants to\r\n         * set them both at once, we need to obtain the current ownership\r\n         * first.  This takes an extra protocol round trip.\r\n         */\r\n        rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2,\r\n                                  curlx_uztoui(strlen(sshc->quote_path2)),\r\n                                  LIBSSH2_SFTP_STAT,\r\n                                  &sshc->quote_attrs);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc != 0 && !sshc->acceptfail) { /* get those attributes */\r\n          err = sftp_libssh2_last_error(sshc->sftp_session);\r\n          Curl_safefree(sshc->quote_path1);\r\n          Curl_safefree(sshc->quote_path2);\r\n          failf(data, \"Attempt to get SFTP stats failed: %s\",\r\n                sftp_libssh2_strerror(err));\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          sshc->actualcode = CURLE_QUOTE_ERROR;\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* Now set the new attributes... */\r\n      if(curl_strnequal(cmd, \"chgrp\", 5)) {\r\n        sshc->quote_attrs.gid = strtoul(sshc->quote_path1, NULL, 10);\r\n        sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;\r\n        if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&\r\n           !sshc->acceptfail) {\r\n          Curl_safefree(sshc->quote_path1);\r\n          Curl_safefree(sshc->quote_path2);\r\n          failf(data, \"Syntax error: chgrp gid not a number\");\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          sshc->actualcode = CURLE_QUOTE_ERROR;\r\n          break;\r\n        }\r\n      }\r\n      else if(curl_strnequal(cmd, \"chmod\", 5)) {\r\n        sshc->quote_attrs.permissions = strtoul(sshc->quote_path1, NULL, 8);\r\n        sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS;\r\n        /* permissions are octal */\r\n        if(sshc->quote_attrs.permissions == 0 &&\r\n           !ISDIGIT(sshc->quote_path1[0])) {\r\n          Curl_safefree(sshc->quote_path1);\r\n          Curl_safefree(sshc->quote_path2);\r\n          failf(data, \"Syntax error: chmod permissions not a number\");\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          sshc->actualcode = CURLE_QUOTE_ERROR;\r\n          break;\r\n        }\r\n      }\r\n      else if(curl_strnequal(cmd, \"chown\", 5)) {\r\n        sshc->quote_attrs.uid = strtoul(sshc->quote_path1, NULL, 10);\r\n        sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;\r\n        if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&\r\n           !sshc->acceptfail) {\r\n          Curl_safefree(sshc->quote_path1);\r\n          Curl_safefree(sshc->quote_path2);\r\n          failf(data, \"Syntax error: chown uid not a number\");\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->nextstate = SSH_NO_STATE;\r\n          sshc->actualcode = CURLE_QUOTE_ERROR;\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* Now send the completed structure... */\r\n      state(conn, SSH_SFTP_QUOTE_SETSTAT);\r\n      break;\r\n    }\r\n\r\n    case SSH_SFTP_QUOTE_SETSTAT:\r\n      rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2,\r\n                                curlx_uztoui(strlen(sshc->quote_path2)),\r\n                                LIBSSH2_SFTP_SETSTAT,\r\n                                &sshc->quote_attrs);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc != 0 && !sshc->acceptfail) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        Curl_safefree(sshc->quote_path1);\r\n        Curl_safefree(sshc->quote_path2);\r\n        failf(data, \"Attempt to set SFTP stats failed: %s\",\r\n              sftp_libssh2_strerror(err));\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_NEXT_QUOTE);\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE_SYMLINK:\r\n      rc = libssh2_sftp_symlink_ex(sshc->sftp_session, sshc->quote_path1,\r\n                                   curlx_uztoui(strlen(sshc->quote_path1)),\r\n                                   sshc->quote_path2,\r\n                                   curlx_uztoui(strlen(sshc->quote_path2)),\r\n                                   LIBSSH2_SFTP_SYMLINK);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc != 0 && !sshc->acceptfail) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        Curl_safefree(sshc->quote_path1);\r\n        Curl_safefree(sshc->quote_path2);\r\n        failf(data, \"symlink command failed: %s\",\r\n              sftp_libssh2_strerror(err));\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_NEXT_QUOTE);\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE_MKDIR:\r\n      rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sshc->quote_path1,\r\n                                 curlx_uztoui(strlen(sshc->quote_path1)),\r\n                                 data->set.new_directory_perms);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc != 0 && !sshc->acceptfail) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        Curl_safefree(sshc->quote_path1);\r\n        failf(data, \"mkdir command failed: %s\", sftp_libssh2_strerror(err));\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_NEXT_QUOTE);\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE_RENAME:\r\n      rc = libssh2_sftp_rename_ex(sshc->sftp_session, sshc->quote_path1,\r\n                                  curlx_uztoui(strlen(sshc->quote_path1)),\r\n                                  sshc->quote_path2,\r\n                                  curlx_uztoui(strlen(sshc->quote_path2)),\r\n                                  LIBSSH2_SFTP_RENAME_OVERWRITE |\r\n                                  LIBSSH2_SFTP_RENAME_ATOMIC |\r\n                                  LIBSSH2_SFTP_RENAME_NATIVE);\r\n\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc != 0 && !sshc->acceptfail) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        Curl_safefree(sshc->quote_path1);\r\n        Curl_safefree(sshc->quote_path2);\r\n        failf(data, \"rename command failed: %s\", sftp_libssh2_strerror(err));\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_NEXT_QUOTE);\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE_RMDIR:\r\n      rc = libssh2_sftp_rmdir_ex(sshc->sftp_session, sshc->quote_path1,\r\n                                 curlx_uztoui(strlen(sshc->quote_path1)));\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc != 0 && !sshc->acceptfail) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        Curl_safefree(sshc->quote_path1);\r\n        failf(data, \"rmdir command failed: %s\", sftp_libssh2_strerror(err));\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_NEXT_QUOTE);\r\n      break;\r\n\r\n    case SSH_SFTP_QUOTE_UNLINK:\r\n      rc = libssh2_sftp_unlink_ex(sshc->sftp_session, sshc->quote_path1,\r\n                                  curlx_uztoui(strlen(sshc->quote_path1)));\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc != 0 && !sshc->acceptfail) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        Curl_safefree(sshc->quote_path1);\r\n        failf(data, \"rm command failed: %s\", sftp_libssh2_strerror(err));\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->nextstate = SSH_NO_STATE;\r\n        sshc->actualcode = CURLE_QUOTE_ERROR;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_NEXT_QUOTE);\r\n      break;\r\n\r\n    case SSH_SFTP_TRANS_INIT:\r\n      if(data->set.upload)\r\n        state(conn, SSH_SFTP_UPLOAD_INIT);\r\n      else {\r\n        if(data->set.opt_no_body)\r\n          state(conn, SSH_STOP);\r\n        else if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')\r\n          state(conn, SSH_SFTP_READDIR_INIT);\r\n        else\r\n          state(conn, SSH_SFTP_DOWNLOAD_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_UPLOAD_INIT:\r\n    {\r\n      unsigned long flags;\r\n      /*\r\n       * NOTE!!!  libssh2 requires that the destination path is a full path\r\n       *          that includes the destination file and name OR ends in a \"/\"\r\n       *          If this is not done the destination file will be named the\r\n       *          same name as the last directory in the path.\r\n       */\r\n\r\n      if(data->state.resume_from != 0) {\r\n        LIBSSH2_SFTP_ATTRIBUTES attrs;\r\n        if(data->state.resume_from < 0) {\r\n          rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,\r\n                                    curlx_uztoui(strlen(sftp_scp->path)),\r\n                                    LIBSSH2_SFTP_STAT, &attrs);\r\n          if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n            break;\r\n          }\r\n          else if(rc) {\r\n            data->state.resume_from = 0;\r\n          }\r\n          else {\r\n            curl_off_t size = attrs.filesize;\r\n            if(size < 0) {\r\n              failf(data, \"Bad file size (%\" FORMAT_OFF_T \")\", size);\r\n              return CURLE_BAD_DOWNLOAD_RESUME;\r\n            }\r\n            data->state.resume_from = attrs.filesize;\r\n          }\r\n        }\r\n      }\r\n\r\n      if(data->set.ftp_append)\r\n        /* Try to open for append, but create if nonexisting */\r\n        flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_APPEND;\r\n      else if(data->state.resume_from > 0)\r\n        /* If we have restart position then open for append */\r\n        flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_APPEND;\r\n      else\r\n        /* Clear file before writing (normal behaviour) */\r\n        flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC;\r\n\r\n      sshc->sftp_handle =\r\n        libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,\r\n                             curlx_uztoui(strlen(sftp_scp->path)),\r\n                             flags, data->set.new_file_perms,\r\n                             LIBSSH2_SFTP_OPENFILE);\r\n\r\n      if(!sshc->sftp_handle) {\r\n        rc = libssh2_session_last_errno(sshc->ssh_session);\r\n\r\n        if(LIBSSH2_ERROR_EAGAIN == rc)\r\n          break;\r\n        else {\r\n          if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)\r\n            /* only when there was an SFTP protocol error can we extract\r\n               the sftp error! */\r\n            err = sftp_libssh2_last_error(sshc->sftp_session);\r\n          else\r\n            err = -1; /* not an sftp error at all */\r\n\r\n          if(sshc->secondCreateDirs) {\r\n            state(conn, SSH_SFTP_CLOSE);\r\n            sshc->actualcode = err>= LIBSSH2_FX_OK?\r\n              sftp_libssh2_error_to_CURLE(err):CURLE_SSH;\r\n            failf(data, \"Creating the dir/file failed: %s\",\r\n                  sftp_libssh2_strerror(err));\r\n            break;\r\n          }\r\n          else if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||\r\n                   (err == LIBSSH2_FX_FAILURE) ||\r\n                   (err == LIBSSH2_FX_NO_SUCH_PATH)) &&\r\n                  (data->set.ftp_create_missing_dirs &&\r\n                   (strlen(sftp_scp->path) > 1))) {\r\n            /* try to create the path remotely */\r\n            sshc->secondCreateDirs = 1;\r\n            state(conn, SSH_SFTP_CREATE_DIRS_INIT);\r\n            break;\r\n          }\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->actualcode = err>= LIBSSH2_FX_OK?\r\n            sftp_libssh2_error_to_CURLE(err):CURLE_SSH;\r\n          if(!sshc->actualcode) {\r\n            /* Sometimes, for some reason libssh2_sftp_last_error() returns\r\n               zero even though libssh2_sftp_open() failed previously! We need\r\n               to work around that! */\r\n            sshc->actualcode = CURLE_SSH;\r\n            err=-1;\r\n          }\r\n          failf(data, \"Upload failed: %s (%d/%d)\",\r\n                err>= LIBSSH2_FX_OK?sftp_libssh2_strerror(err):\"ssh error\",\r\n                err, rc);\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* If we have restart point then we need to seek to the correct\r\n         position. */\r\n      if(data->state.resume_from > 0) {\r\n        /* Let's read off the proper amount of bytes from the input. */\r\n        if(conn->seek_func) {\r\n          seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,\r\n                                    SEEK_SET);\r\n        }\r\n\r\n        if(seekerr != CURL_SEEKFUNC_OK) {\r\n\r\n          if(seekerr != CURL_SEEKFUNC_CANTSEEK) {\r\n            failf(data, \"Could not seek stream\");\r\n            return CURLE_FTP_COULDNT_USE_REST;\r\n          }\r\n          /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */\r\n          else {\r\n            curl_off_t passed=0;\r\n            do {\r\n              size_t readthisamountnow =\r\n                (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?\r\n                BUFSIZE : curlx_sotouz(data->state.resume_from - passed);\r\n\r\n              size_t actuallyread =\r\n                conn->fread_func(data->state.buffer, 1, readthisamountnow,\r\n                                 conn->fread_in);\r\n\r\n              passed += actuallyread;\r\n              if((actuallyread == 0) || (actuallyread > readthisamountnow)) {\r\n                /* this checks for greater-than only to make sure that the\r\n                   CURL_READFUNC_ABORT return code still aborts */\r\n                failf(data, \"Failed to read data\");\r\n                return CURLE_FTP_COULDNT_USE_REST;\r\n              }\r\n            } while(passed < data->state.resume_from);\r\n          }\r\n        }\r\n\r\n        /* now, decrease the size of the read */\r\n        if(data->set.infilesize > 0) {\r\n          data->set.infilesize -= data->state.resume_from;\r\n          data->req.size = data->set.infilesize;\r\n          Curl_pgrsSetUploadSize(data, data->set.infilesize);\r\n        }\r\n\r\n        SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);\r\n      }\r\n      if(data->set.infilesize > 0) {\r\n        data->req.size = data->set.infilesize;\r\n        Curl_pgrsSetUploadSize(data, data->set.infilesize);\r\n      }\r\n      /* upload data */\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);\r\n\r\n      /* not set by Curl_setup_transfer to preserve keepon bits */\r\n      conn->sockfd = conn->writesockfd;\r\n\r\n      if(result) {\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->actualcode = result;\r\n      }\r\n      else {\r\n        /* store this original bitmask setup to use later on if we can't\r\n           figure out a \"real\" bitmask */\r\n        sshc->orig_waitfor = data->req.keepon;\r\n\r\n        /* we want to use the _sending_ function even when the socket turns\r\n           out readable as the underlying libssh2 sftp send function will deal\r\n           with both accordingly */\r\n        conn->cselect_bits = CURL_CSELECT_OUT;\r\n\r\n        /* since we don't really wait for anything at this point, we want the\r\n           state machine to move on as soon as possible so we set a very short\r\n           timeout here */\r\n        Curl_expire(data, 1);\r\n\r\n        state(conn, SSH_STOP);\r\n      }\r\n      break;\r\n    }\r\n\r\n    case SSH_SFTP_CREATE_DIRS_INIT:\r\n      if(strlen(sftp_scp->path) > 1) {\r\n        sshc->slash_pos = sftp_scp->path + 1; /* ignore the leading '/' */\r\n        state(conn, SSH_SFTP_CREATE_DIRS);\r\n      }\r\n      else {\r\n        state(conn, SSH_SFTP_UPLOAD_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_CREATE_DIRS:\r\n      if((sshc->slash_pos = strchr(sshc->slash_pos, '/')) != NULL) {\r\n        *sshc->slash_pos = 0;\r\n\r\n        infof(data, \"Creating directory '%s'\\n\", sftp_scp->path);\r\n        state(conn, SSH_SFTP_CREATE_DIRS_MKDIR);\r\n        break;\r\n      }\r\n      else {\r\n        state(conn, SSH_SFTP_UPLOAD_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_CREATE_DIRS_MKDIR:\r\n      /* 'mode' - parameter is preliminary - default to 0644 */\r\n      rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sftp_scp->path,\r\n                                 curlx_uztoui(strlen(sftp_scp->path)),\r\n                                 data->set.new_directory_perms);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      *sshc->slash_pos = '/';\r\n      ++sshc->slash_pos;\r\n      if(rc == -1) {\r\n        /*\r\n         * Abort if failure wasn't that the dir already exists or the\r\n         * permission was denied (creation might succeed further down the\r\n         * path) - retry on unspecific FAILURE also\r\n         */\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        if((err != LIBSSH2_FX_FILE_ALREADY_EXISTS) &&\r\n           (err != LIBSSH2_FX_FAILURE) &&\r\n           (err != LIBSSH2_FX_PERMISSION_DENIED)) {\r\n          result = sftp_libssh2_error_to_CURLE(err);\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          sshc->actualcode = result?result:CURLE_SSH;\r\n          break;\r\n        }\r\n      }\r\n      state(conn, SSH_SFTP_CREATE_DIRS);\r\n      break;\r\n\r\n    case SSH_SFTP_READDIR_INIT:\r\n      /*\r\n       * This is a directory that we are trying to get, so produce a directory\r\n       * listing\r\n       */\r\n      sshc->sftp_handle = libssh2_sftp_open_ex(sshc->sftp_session,\r\n                                               sftp_scp->path,\r\n                                               curlx_uztoui(\r\n                                                 strlen(sftp_scp->path)),\r\n                                               0, 0, LIBSSH2_SFTP_OPENDIR);\r\n      if(!sshc->sftp_handle) {\r\n        if(libssh2_session_last_errno(sshc->ssh_session) ==\r\n           LIBSSH2_ERROR_EAGAIN) {\r\n          rc = LIBSSH2_ERROR_EAGAIN;\r\n          break;\r\n        }\r\n        else {\r\n          err = sftp_libssh2_last_error(sshc->sftp_session);\r\n          failf(data, \"Could not open directory for reading: %s\",\r\n                sftp_libssh2_strerror(err));\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          result = sftp_libssh2_error_to_CURLE(err);\r\n          sshc->actualcode = result?result:CURLE_SSH;\r\n          break;\r\n        }\r\n      }\r\n      if((sshc->readdir_filename = malloc(PATH_MAX+1)) == NULL) {\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n        break;\r\n      }\r\n      if((sshc->readdir_longentry = malloc(PATH_MAX+1)) == NULL) {\r\n        Curl_safefree(sshc->readdir_filename);\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n        break;\r\n      }\r\n      state(conn, SSH_SFTP_READDIR);\r\n      break;\r\n\r\n    case SSH_SFTP_READDIR:\r\n      sshc->readdir_len = libssh2_sftp_readdir_ex(sshc->sftp_handle,\r\n                                                  sshc->readdir_filename,\r\n                                                  PATH_MAX,\r\n                                                  sshc->readdir_longentry,\r\n                                                  PATH_MAX,\r\n                                                  &sshc->readdir_attrs);\r\n      if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) {\r\n        rc = LIBSSH2_ERROR_EAGAIN;\r\n        break;\r\n      }\r\n      if(sshc->readdir_len > 0) {\r\n        sshc->readdir_filename[sshc->readdir_len] = '\\0';\r\n\r\n        if(data->set.ftp_list_only) {\r\n          char *tmpLine;\r\n\r\n          tmpLine = aprintf(\"%s\\n\", sshc->readdir_filename);\r\n          if(tmpLine == NULL) {\r\n            state(conn, SSH_SFTP_CLOSE);\r\n            sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n            break;\r\n          }\r\n          result = Curl_client_write(conn, CLIENTWRITE_BODY,\r\n                                     tmpLine, sshc->readdir_len+1);\r\n          Curl_safefree(tmpLine);\r\n\r\n          if(result) {\r\n            state(conn, SSH_STOP);\r\n            break;\r\n          }\r\n          /* since this counts what we send to the client, we include the\r\n             newline in this counter */\r\n          data->req.bytecount += sshc->readdir_len+1;\r\n\r\n          /* output debug output if that is requested */\r\n          if(data->set.verbose) {\r\n            Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_filename,\r\n                       sshc->readdir_len, conn);\r\n          }\r\n        }\r\n        else {\r\n          sshc->readdir_currLen = (int)strlen(sshc->readdir_longentry);\r\n          sshc->readdir_totalLen = 80 + sshc->readdir_currLen;\r\n          sshc->readdir_line = calloc(sshc->readdir_totalLen, 1);\r\n          if(!sshc->readdir_line) {\r\n            Curl_safefree(sshc->readdir_filename);\r\n            Curl_safefree(sshc->readdir_longentry);\r\n            state(conn, SSH_SFTP_CLOSE);\r\n            sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n            break;\r\n          }\r\n\r\n          memcpy(sshc->readdir_line, sshc->readdir_longentry,\r\n                 sshc->readdir_currLen);\r\n          if((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) &&\r\n             ((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) ==\r\n              LIBSSH2_SFTP_S_IFLNK)) {\r\n            sshc->readdir_linkPath = malloc(PATH_MAX + 1);\r\n            if(sshc->readdir_linkPath == NULL) {\r\n              Curl_safefree(sshc->readdir_filename);\r\n              Curl_safefree(sshc->readdir_longentry);\r\n              state(conn, SSH_SFTP_CLOSE);\r\n              sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n              break;\r\n            }\r\n\r\n            snprintf(sshc->readdir_linkPath, PATH_MAX, \"%s%s\", sftp_scp->path,\r\n                     sshc->readdir_filename);\r\n            state(conn, SSH_SFTP_READDIR_LINK);\r\n            break;\r\n          }\r\n          state(conn, SSH_SFTP_READDIR_BOTTOM);\r\n          break;\r\n        }\r\n      }\r\n      else if(sshc->readdir_len == 0) {\r\n        Curl_safefree(sshc->readdir_filename);\r\n        Curl_safefree(sshc->readdir_longentry);\r\n        state(conn, SSH_SFTP_READDIR_DONE);\r\n        break;\r\n      }\r\n      else if(sshc->readdir_len <= 0) {\r\n        err = sftp_libssh2_last_error(sshc->sftp_session);\r\n        result = sftp_libssh2_error_to_CURLE(err);\r\n        sshc->actualcode = result?result:CURLE_SSH;\r\n        failf(data, \"Could not open remote file for reading: %s :: %d\",\r\n              sftp_libssh2_strerror(err),\r\n              libssh2_session_last_errno(sshc->ssh_session));\r\n        Curl_safefree(sshc->readdir_filename);\r\n        Curl_safefree(sshc->readdir_longentry);\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        break;\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_READDIR_LINK:\r\n      sshc->readdir_len =\r\n        libssh2_sftp_symlink_ex(sshc->sftp_session,\r\n                                sshc->readdir_linkPath,\r\n                                curlx_uztoui(strlen(sshc->readdir_linkPath)),\r\n                                sshc->readdir_filename,\r\n                                PATH_MAX, LIBSSH2_SFTP_READLINK);\r\n      if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) {\r\n        rc = LIBSSH2_ERROR_EAGAIN;\r\n        break;\r\n      }\r\n      Curl_safefree(sshc->readdir_linkPath);\r\n\r\n      /* get room for the filename and extra output */\r\n      sshc->readdir_totalLen += 4 + sshc->readdir_len;\r\n      new_readdir_line = realloc(sshc->readdir_line, sshc->readdir_totalLen);\r\n      if(!new_readdir_line) {\r\n        Curl_safefree(sshc->readdir_line);\r\n        Curl_safefree(sshc->readdir_filename);\r\n        Curl_safefree(sshc->readdir_longentry);\r\n        state(conn, SSH_SFTP_CLOSE);\r\n        sshc->actualcode = CURLE_OUT_OF_MEMORY;\r\n        break;\r\n      }\r\n      sshc->readdir_line = new_readdir_line;\r\n\r\n      sshc->readdir_currLen += snprintf(sshc->readdir_line +\r\n                                        sshc->readdir_currLen,\r\n                                        sshc->readdir_totalLen -\r\n                                        sshc->readdir_currLen,\r\n                                        \" -> %s\",\r\n                                        sshc->readdir_filename);\r\n\r\n      state(conn, SSH_SFTP_READDIR_BOTTOM);\r\n      break;\r\n\r\n    case SSH_SFTP_READDIR_BOTTOM:\r\n      sshc->readdir_currLen += snprintf(sshc->readdir_line +\r\n                                        sshc->readdir_currLen,\r\n                                        sshc->readdir_totalLen -\r\n                                        sshc->readdir_currLen, \"\\n\");\r\n      result = Curl_client_write(conn, CLIENTWRITE_BODY,\r\n                                 sshc->readdir_line,\r\n                                 sshc->readdir_currLen);\r\n\r\n      if(result == CURLE_OK) {\r\n\r\n        /* output debug output if that is requested */\r\n        if(data->set.verbose) {\r\n          Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,\r\n                     sshc->readdir_currLen, conn);\r\n        }\r\n        data->req.bytecount += sshc->readdir_currLen;\r\n      }\r\n      Curl_safefree(sshc->readdir_line);\r\n      if(result) {\r\n        state(conn, SSH_STOP);\r\n      }\r\n      else\r\n        state(conn, SSH_SFTP_READDIR);\r\n      break;\r\n\r\n    case SSH_SFTP_READDIR_DONE:\r\n      if(libssh2_sftp_closedir(sshc->sftp_handle) ==\r\n         LIBSSH2_ERROR_EAGAIN) {\r\n        rc = LIBSSH2_ERROR_EAGAIN;\r\n        break;\r\n      }\r\n      sshc->sftp_handle = NULL;\r\n      Curl_safefree(sshc->readdir_filename);\r\n      Curl_safefree(sshc->readdir_longentry);\r\n\r\n      /* no data to transfer */\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n      state(conn, SSH_STOP);\r\n      break;\r\n\r\n    case SSH_SFTP_DOWNLOAD_INIT:\r\n      /*\r\n       * Work on getting the specified file\r\n       */\r\n      sshc->sftp_handle =\r\n        libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,\r\n                             curlx_uztoui(strlen(sftp_scp->path)),\r\n                             LIBSSH2_FXF_READ, data->set.new_file_perms,\r\n                             LIBSSH2_SFTP_OPENFILE);\r\n      if(!sshc->sftp_handle) {\r\n        if(libssh2_session_last_errno(sshc->ssh_session) ==\r\n           LIBSSH2_ERROR_EAGAIN) {\r\n          rc = LIBSSH2_ERROR_EAGAIN;\r\n          break;\r\n        }\r\n        else {\r\n          err = sftp_libssh2_last_error(sshc->sftp_session);\r\n          failf(data, \"Could not open remote file for reading: %s\",\r\n                sftp_libssh2_strerror(err));\r\n          state(conn, SSH_SFTP_CLOSE);\r\n          result = sftp_libssh2_error_to_CURLE(err);\r\n          sshc->actualcode = result?result:CURLE_SSH;\r\n          break;\r\n        }\r\n      }\r\n      state(conn, SSH_SFTP_DOWNLOAD_STAT);\r\n      break;\r\n\r\n    case SSH_SFTP_DOWNLOAD_STAT:\r\n    {\r\n      LIBSSH2_SFTP_ATTRIBUTES attrs;\r\n\r\n      rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,\r\n                                curlx_uztoui(strlen(sftp_scp->path)),\r\n                                LIBSSH2_SFTP_STAT, &attrs);\r\n      if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n        break;\r\n      }\r\n      else if(rc) {\r\n        /*\r\n         * libssh2_sftp_open() didn't return an error, so maybe the server\r\n         * just doesn't support stat()\r\n         */\r\n        data->req.size = -1;\r\n        data->req.maxdownload = -1;\r\n      }\r\n      else {\r\n        curl_off_t size = attrs.filesize;\r\n\r\n        if(size < 0) {\r\n          failf(data, \"Bad file size (%\" FORMAT_OFF_T \")\", size);\r\n          return CURLE_BAD_DOWNLOAD_RESUME;\r\n        }\r\n        if(conn->data->state.use_range) {\r\n          curl_off_t from, to;\r\n          char *ptr;\r\n          char *ptr2;\r\n\r\n          from=curlx_strtoofft(conn->data->state.range, &ptr, 0);\r\n          while(*ptr && (ISSPACE(*ptr) || (*ptr=='-')))\r\n            ptr++;\r\n          to=curlx_strtoofft(ptr, &ptr2, 0);\r\n          if((ptr == ptr2) /* no \"to\" value given */\r\n             || (to >= size)) {\r\n            to = size - 1;\r\n          }\r\n          if(from < 0) {\r\n            /* from is relative to end of file */\r\n            from += size;\r\n          }\r\n          if(from >= size) {\r\n            failf(data, \"Offset (%\"\r\n                  FORMAT_OFF_T \") was beyond file size (%\" FORMAT_OFF_T \")\",\r\n                  from, attrs.filesize);\r\n            return CURLE_BAD_DOWNLOAD_RESUME;\r\n          }\r\n          if(from > to) {\r\n            from = to;\r\n            size = 0;\r\n          }\r\n          else {\r\n            size = to - from + 1;\r\n          }\r\n\r\n          SFTP_SEEK(conn->proto.sshc.sftp_handle, from);\r\n        }\r\n        data->req.size = size;\r\n        data->req.maxdownload = size;\r\n        Curl_pgrsSetDownloadSize(data, size);\r\n      }\r\n\r\n      /* We can resume if we can seek to the resume position */\r\n      if(data->state.resume_from) {\r\n        if(data->state.resume_from < 0) {\r\n          /* We're supposed to download the last abs(from) bytes */\r\n          if((curl_off_t)attrs.filesize < -data->state.resume_from) {\r\n            failf(data, \"Offset (%\"\r\n                  FORMAT_OFF_T \") was beyond file size (%\" FORMAT_OFF_T \")\",\r\n                  data->state.resume_from, attrs.filesize);\r\n            return CURLE_BAD_DOWNLOAD_RESUME;\r\n          }\r\n          /* download from where? */\r\n          data->state.resume_from += attrs.filesize;\r\n        }\r\n        else {\r\n          if((curl_off_t)attrs.filesize < data->state.resume_from) {\r\n            failf(data, \"Offset (%\" FORMAT_OFF_T\r\n                  \") was beyond file size (%\" FORMAT_OFF_T \")\",\r\n                  data->state.resume_from, attrs.filesize);\r\n            return CURLE_BAD_DOWNLOAD_RESUME;\r\n          }\r\n        }\r\n        /* Does a completed file need to be seeked and started or closed ? */\r\n        /* Now store the number of bytes we are expected to download */\r\n        data->req.size = attrs.filesize - data->state.resume_from;\r\n        data->req.maxdownload = attrs.filesize - data->state.resume_from;\r\n        Curl_pgrsSetDownloadSize(data,\r\n                                 attrs.filesize - data->state.resume_from);\r\n        SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);\r\n      }\r\n    }\r\n    /* Setup the actual download */\r\n    if(data->req.size == 0) {\r\n      /* no data to transfer */\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n      infof(data, \"File already completely downloaded\\n\");\r\n      state(conn, SSH_STOP);\r\n      break;\r\n    }\r\n    else {\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,\r\n                          FALSE, NULL, -1, NULL);\r\n\r\n      /* not set by Curl_setup_transfer to preserve keepon bits */\r\n      conn->writesockfd = conn->sockfd;\r\n\r\n      /* we want to use the _receiving_ function even when the socket turns\r\n         out writableable as the underlying libssh2 recv function will deal\r\n         with both accordingly */\r\n      conn->cselect_bits = CURL_CSELECT_IN;\r\n    }\r\n    if(result) {\r\n      state(conn, SSH_SFTP_CLOSE);\r\n      sshc->actualcode = result;\r\n    }\r\n    else {\r\n      state(conn, SSH_STOP);\r\n    }\r\n    break;\r\n\r\n    case SSH_SFTP_CLOSE:\r\n      if(sshc->sftp_handle) {\r\n        rc = libssh2_sftp_close(sshc->sftp_handle);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to close libssh2 file\\n\");\r\n        }\r\n        sshc->sftp_handle = NULL;\r\n      }\r\n      if(sftp_scp)\r\n        Curl_safefree(sftp_scp->path);\r\n\r\n      DEBUGF(infof(data, \"SFTP DONE done\\n\"));\r\n\r\n      /* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT\r\n         After nextstate is executed,the control should come back to\r\n         SSH_SFTP_CLOSE to pass the correct result back  */\r\n      if(sshc->nextstate != SSH_NO_STATE) {\r\n        state(conn, sshc->nextstate);\r\n        sshc->nextstate = SSH_SFTP_CLOSE;\r\n      }\r\n      else {\r\n        state(conn, SSH_STOP);\r\n        result = sshc->actualcode;\r\n      }\r\n      break;\r\n\r\n    case SSH_SFTP_SHUTDOWN:\r\n      /* during times we get here due to a broken transfer and then the\r\n         sftp_handle might not have been taken down so make sure that is done\r\n         before we proceed */\r\n\r\n      if(sshc->sftp_handle) {\r\n        rc = libssh2_sftp_close(sshc->sftp_handle);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to close libssh2 file\\n\");\r\n        }\r\n        sshc->sftp_handle = NULL;\r\n      }\r\n      if(sshc->sftp_session) {\r\n        rc = libssh2_sftp_shutdown(sshc->sftp_session);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to stop libssh2 sftp subsystem\\n\");\r\n        }\r\n        sshc->sftp_session = NULL;\r\n      }\r\n\r\n      Curl_safefree(sshc->homedir);\r\n      conn->data->state.most_recent_ftp_entrypath = NULL;\r\n\r\n      state(conn, SSH_SESSION_DISCONNECT);\r\n      break;\r\n\r\n    case SSH_SCP_TRANS_INIT:\r\n      result = ssh_getworkingpath(conn, sshc->homedir, &sftp_scp->path);\r\n      if(result) {\r\n        sshc->actualcode = result;\r\n        state(conn, SSH_STOP);\r\n        break;\r\n      }\r\n\r\n      if(data->set.upload) {\r\n        if(data->set.infilesize < 0) {\r\n          failf(data, \"SCP requires a known file size for upload\");\r\n          sshc->actualcode = CURLE_UPLOAD_FAILED;\r\n          state(conn, SSH_SCP_CHANNEL_FREE);\r\n          break;\r\n        }\r\n        state(conn, SSH_SCP_UPLOAD_INIT);\r\n      }\r\n      else {\r\n        state(conn, SSH_SCP_DOWNLOAD_INIT);\r\n      }\r\n      break;\r\n\r\n    case SSH_SCP_UPLOAD_INIT:\r\n      /*\r\n       * libssh2 requires that the destination path is a full path that\r\n       * includes the destination file and name OR ends in a \"/\" .  If this is\r\n       * not done the destination file will be named the same name as the last\r\n       * directory in the path.\r\n       */\r\n      sshc->ssh_channel =\r\n        SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,\r\n                 data->set.infilesize);\r\n      if(!sshc->ssh_channel) {\r\n        if(libssh2_session_last_errno(sshc->ssh_session) ==\r\n           LIBSSH2_ERROR_EAGAIN) {\r\n          rc = LIBSSH2_ERROR_EAGAIN;\r\n          break;\r\n        }\r\n        else {\r\n          int ssh_err;\r\n          char *err_msg;\r\n\r\n          ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,\r\n                                                     &err_msg, NULL, 0));\r\n          failf(conn->data, \"%s\", err_msg);\r\n          state(conn, SSH_SCP_CHANNEL_FREE);\r\n          sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* upload data */\r\n      Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL,\r\n                          FIRSTSOCKET, NULL);\r\n\r\n      /* not set by Curl_setup_transfer to preserve keepon bits */\r\n      conn->sockfd = conn->writesockfd;\r\n\r\n      if(result) {\r\n        state(conn, SSH_SCP_CHANNEL_FREE);\r\n        sshc->actualcode = result;\r\n      }\r\n      else {\r\n        /* we want to use the _sending_ function even when the socket turns\r\n           out readable as the underlying libssh2 scp send function will deal\r\n           with both accordingly */\r\n        conn->cselect_bits = CURL_CSELECT_OUT;\r\n\r\n        state(conn, SSH_STOP);\r\n      }\r\n      break;\r\n\r\n    case SSH_SCP_DOWNLOAD_INIT:\r\n    {\r\n      /*\r\n       * We must check the remote file; if it is a directory no values will\r\n       * be set in sb\r\n       */\r\n      struct stat sb;\r\n      curl_off_t bytecount;\r\n\r\n      /* clear the struct scp recv will fill in */\r\n      memset(&sb, 0, sizeof(struct stat));\r\n\r\n      /* get a fresh new channel from the ssh layer */\r\n      sshc->ssh_channel = libssh2_scp_recv(sshc->ssh_session,\r\n                                           sftp_scp->path, &sb);\r\n      if(!sshc->ssh_channel) {\r\n        if(libssh2_session_last_errno(sshc->ssh_session) ==\r\n           LIBSSH2_ERROR_EAGAIN) {\r\n          rc = LIBSSH2_ERROR_EAGAIN;\r\n          break;\r\n        }\r\n        else {\r\n          int ssh_err;\r\n          char *err_msg;\r\n\r\n          ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,\r\n                                                     &err_msg, NULL, 0));\r\n          failf(conn->data, \"%s\", err_msg);\r\n          state(conn, SSH_SCP_CHANNEL_FREE);\r\n          sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* download data */\r\n      bytecount = (curl_off_t)sb.st_size;\r\n      data->req.maxdownload =  (curl_off_t)sb.st_size;\r\n      Curl_setup_transfer(conn, FIRSTSOCKET, bytecount, FALSE, NULL, -1, NULL);\r\n\r\n      /* not set by Curl_setup_transfer to preserve keepon bits */\r\n      conn->writesockfd = conn->sockfd;\r\n\r\n      /* we want to use the _receiving_ function even when the socket turns\r\n         out writableable as the underlying libssh2 recv function will deal\r\n         with both accordingly */\r\n      conn->cselect_bits = CURL_CSELECT_IN;\r\n\r\n      if(result) {\r\n        state(conn, SSH_SCP_CHANNEL_FREE);\r\n        sshc->actualcode = result;\r\n      }\r\n      else\r\n        state(conn, SSH_STOP);\r\n    }\r\n    break;\r\n\r\n    case SSH_SCP_DONE:\r\n      if(data->set.upload)\r\n        state(conn, SSH_SCP_SEND_EOF);\r\n      else\r\n        state(conn, SSH_SCP_CHANNEL_FREE);\r\n      break;\r\n\r\n    case SSH_SCP_SEND_EOF:\r\n      if(sshc->ssh_channel) {\r\n        rc = libssh2_channel_send_eof(sshc->ssh_channel);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc) {\r\n          infof(data, \"Failed to send libssh2 channel EOF\\n\");\r\n        }\r\n      }\r\n      state(conn, SSH_SCP_WAIT_EOF);\r\n      break;\r\n\r\n    case SSH_SCP_WAIT_EOF:\r\n      if(sshc->ssh_channel) {\r\n        rc = libssh2_channel_wait_eof(sshc->ssh_channel);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc) {\r\n          infof(data, \"Failed to get channel EOF: %d\\n\", rc);\r\n        }\r\n      }\r\n      state(conn, SSH_SCP_WAIT_CLOSE);\r\n      break;\r\n\r\n    case SSH_SCP_WAIT_CLOSE:\r\n      if(sshc->ssh_channel) {\r\n        rc = libssh2_channel_wait_closed(sshc->ssh_channel);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc) {\r\n          infof(data, \"Channel failed to close: %d\\n\", rc);\r\n        }\r\n      }\r\n      state(conn, SSH_SCP_CHANNEL_FREE);\r\n      break;\r\n\r\n    case SSH_SCP_CHANNEL_FREE:\r\n      if(sshc->ssh_channel) {\r\n        rc = libssh2_channel_free(sshc->ssh_channel);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to free libssh2 scp subsystem\\n\");\r\n        }\r\n        sshc->ssh_channel = NULL;\r\n      }\r\n      DEBUGF(infof(data, \"SCP DONE phase complete\\n\"));\r\n#if 0 /* PREV */\r\n      state(conn, SSH_SESSION_DISCONNECT);\r\n#endif\r\n      state(conn, SSH_STOP);\r\n      result = sshc->actualcode;\r\n      break;\r\n\r\n    case SSH_SESSION_DISCONNECT:\r\n      /* during weird times when we've been prematurely aborted, the channel\r\n         is still alive when we reach this state and we MUST kill the channel\r\n         properly first */\r\n      if(sshc->ssh_channel) {\r\n        rc = libssh2_channel_free(sshc->ssh_channel);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to free libssh2 scp subsystem\\n\");\r\n        }\r\n        sshc->ssh_channel = NULL;\r\n      }\r\n\r\n      if(sshc->ssh_session) {\r\n        rc = libssh2_session_disconnect(sshc->ssh_session, \"Shutdown\");\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to disconnect libssh2 session\\n\");\r\n        }\r\n      }\r\n\r\n      Curl_safefree(sshc->homedir);\r\n      conn->data->state.most_recent_ftp_entrypath = NULL;\r\n\r\n      state(conn, SSH_SESSION_FREE);\r\n      break;\r\n\r\n    case SSH_SESSION_FREE:\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\n      if(sshc->kh) {\r\n        libssh2_knownhost_free(sshc->kh);\r\n        sshc->kh = NULL;\r\n      }\r\n#endif\r\n\r\n#ifdef HAVE_LIBSSH2_AGENT_API\r\n      if(sshc->ssh_agent) {\r\n        rc = libssh2_agent_disconnect(sshc->ssh_agent);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to disconnect from libssh2 agent\\n\");\r\n        }\r\n        libssh2_agent_free (sshc->ssh_agent);\r\n        sshc->ssh_agent = NULL;\r\n\r\n        /* NB: there is no need to free identities, they are part of internal\r\n           agent stuff */\r\n        sshc->sshagent_identity = NULL;\r\n        sshc->sshagent_prev_identity = NULL;\r\n      }\r\n#endif\r\n\r\n      if(sshc->ssh_session) {\r\n        rc = libssh2_session_free(sshc->ssh_session);\r\n        if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n          break;\r\n        }\r\n        else if(rc < 0) {\r\n          infof(data, \"Failed to free libssh2 session\\n\");\r\n        }\r\n        sshc->ssh_session = NULL;\r\n      }\r\n\r\n      /* worst-case scenario cleanup */\r\n\r\n      DEBUGASSERT(sshc->ssh_session == NULL);\r\n      DEBUGASSERT(sshc->ssh_channel == NULL);\r\n      DEBUGASSERT(sshc->sftp_session == NULL);\r\n      DEBUGASSERT(sshc->sftp_handle == NULL);\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\n      DEBUGASSERT(sshc->kh == NULL);\r\n#endif\r\n#ifdef HAVE_LIBSSH2_AGENT_API\r\n      DEBUGASSERT(sshc->ssh_agent == NULL);\r\n#endif\r\n\r\n      Curl_safefree(sshc->rsa_pub);\r\n      Curl_safefree(sshc->rsa);\r\n\r\n      Curl_safefree(sshc->quote_path1);\r\n      Curl_safefree(sshc->quote_path2);\r\n\r\n      Curl_safefree(sshc->homedir);\r\n\r\n      Curl_safefree(sshc->readdir_filename);\r\n      Curl_safefree(sshc->readdir_longentry);\r\n      Curl_safefree(sshc->readdir_line);\r\n      Curl_safefree(sshc->readdir_linkPath);\r\n\r\n      /* the code we are about to return */\r\n      result = sshc->actualcode;\r\n\r\n      memset(sshc, 0, sizeof(struct ssh_conn));\r\n\r\n      conn->bits.close = TRUE;\r\n      sshc->state = SSH_SESSION_FREE; /* current */\r\n      sshc->nextstate = SSH_NO_STATE;\r\n      state(conn, SSH_STOP);\r\n      break;\r\n\r\n    case SSH_QUIT:\r\n      /* fallthrough, just stop! */\r\n    default:\r\n      /* internal error */\r\n      sshc->nextstate = SSH_NO_STATE;\r\n      state(conn, SSH_STOP);\r\n      break;\r\n    }\r\n\r\n  } while(!rc && (sshc->state != SSH_STOP));\r\n\r\n  if(rc == LIBSSH2_ERROR_EAGAIN) {\r\n    /* we would block, we need to wait for the socket to be ready (in the\r\n       right direction too)! */\r\n    *block = TRUE;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* called by the multi interface to figure out what socket(s) to wait for and\r\n   for what actions in the DO_DONE, PERFORM and WAITPERFORM states */\r\nstatic int ssh_perform_getsock(const struct connectdata *conn,\r\n                               curl_socket_t *sock, /* points to numsocks\r\n                                                       number of sockets */\r\n                               int numsocks)\r\n{\r\n#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION\r\n  int bitmap = GETSOCK_BLANK;\r\n  (void)numsocks;\r\n\r\n  sock[0] = conn->sock[FIRSTSOCKET];\r\n\r\n  if(conn->waitfor & KEEP_RECV)\r\n    bitmap |= GETSOCK_READSOCK(FIRSTSOCKET);\r\n\r\n  if(conn->waitfor & KEEP_SEND)\r\n    bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET);\r\n\r\n  return bitmap;\r\n#else\r\n  /* if we don't know the direction we can use the generic *_getsock()\r\n     function even for the protocol_connect and doing states */\r\n  return Curl_single_getsock(conn, sock, numsocks);\r\n#endif\r\n}\r\n\r\n/* Generic function called by the multi interface to figure out what socket(s)\r\n   to wait for and for what actions during the DOING and PROTOCONNECT states*/\r\nstatic int ssh_getsock(struct connectdata *conn,\r\n                       curl_socket_t *sock, /* points to numsocks number\r\n                                               of sockets */\r\n                       int numsocks)\r\n{\r\n#ifndef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION\r\n  (void)conn;\r\n  (void)sock;\r\n  (void)numsocks;\r\n  /* if we don't know any direction we can just play along as we used to and\r\n     not provide any sensible info */\r\n  return GETSOCK_BLANK;\r\n#else\r\n  /* if we know the direction we can use the generic *_getsock() function even\r\n     for the protocol_connect and doing states */\r\n  return ssh_perform_getsock(conn, sock, numsocks);\r\n#endif\r\n}\r\n\r\n#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION\r\n/*\r\n * When one of the libssh2 functions has returned LIBSSH2_ERROR_EAGAIN this\r\n * function is used to figure out in what direction and stores this info so\r\n * that the multi interface can take advantage of it. Make sure to call this\r\n * function in all cases so that when it _doesn't_ return EAGAIN we can\r\n * restore the default wait bits.\r\n */\r\nstatic void ssh_block2waitfor(struct connectdata *conn, bool block)\r\n{\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n  int dir;\r\n  if(!block)\r\n    conn->waitfor = 0;\r\n  else if((dir = libssh2_session_block_directions(sshc->ssh_session))) {\r\n    /* translate the libssh2 define bits into our own bit defines */\r\n    conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |\r\n      ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);\r\n  }\r\n  else\r\n    /* It didn't block or libssh2 didn't reveal in which direction, put back\r\n       the original set */\r\n    conn->waitfor = sshc->orig_waitfor;\r\n}\r\n#else\r\n  /* no libssh2 directional support so we simply don't know */\r\n#define ssh_block2waitfor(x,y) Curl_nop_stmt\r\n#endif\r\n\r\n/* called repeatedly until done from multi.c */\r\nstatic CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done)\r\n{\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n  CURLcode result = CURLE_OK;\r\n  bool block; /* we store the status and use that to provide a ssh_getsock()\r\n                 implementation */\r\n\r\n  result = ssh_statemach_act(conn, &block);\r\n  *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;\r\n  ssh_block2waitfor(conn, block);\r\n\r\n  return result;\r\n}\r\n\r\nstatic CURLcode ssh_easy_statemach(struct connectdata *conn,\r\n                                   bool duringconnect)\r\n{\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  while((sshc->state != SSH_STOP) && !result) {\r\n    bool block;\r\n    long left;\r\n\r\n    result = ssh_statemach_act(conn, &block);\r\n    if(result)\r\n      break;\r\n\r\n    if(Curl_pgrsUpdate(conn))\r\n      return CURLE_ABORTED_BY_CALLBACK;\r\n    else {\r\n      struct timeval now = Curl_tvnow();\r\n      result = Curl_speedcheck(data, now);\r\n      if(result)\r\n        break;\r\n    }\r\n\r\n    left = Curl_timeleft(data, NULL, duringconnect);\r\n    if(left < 0) {\r\n      failf(data, \"Operation timed out\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION\r\n    if((CURLE_OK == result) && block) {\r\n      int dir = libssh2_session_block_directions(sshc->ssh_session);\r\n      curl_socket_t sock = conn->sock[FIRSTSOCKET];\r\n      curl_socket_t fd_read = CURL_SOCKET_BAD;\r\n      curl_socket_t fd_write = CURL_SOCKET_BAD;\r\n      if(LIBSSH2_SESSION_BLOCK_INBOUND & dir)\r\n        fd_read = sock;\r\n      if(LIBSSH2_SESSION_BLOCK_OUTBOUND & dir)\r\n        fd_write = sock;\r\n      /* wait for the socket to become ready */\r\n      Curl_socket_ready(fd_read, fd_write,\r\n                        left>1000?1000:left); /* ignore result */\r\n    }\r\n#endif\r\n\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * SSH setup and connection\r\n */\r\nstatic CURLcode ssh_init(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct SSHPROTO *ssh;\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n\r\n  sshc->actualcode = CURLE_OK; /* reset error code */\r\n  sshc->secondCreateDirs =0;   /* reset the create dir attempt state\r\n                                  variable */\r\n\r\n  if(data->state.proto.ssh)\r\n    return CURLE_OK;\r\n\r\n  ssh = calloc(1, sizeof(struct SSHPROTO));\r\n  if(!ssh)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  data->state.proto.ssh = ssh;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic Curl_recv scp_recv, sftp_recv;\r\nstatic Curl_send scp_send, sftp_send;\r\n\r\n/*\r\n * Curl_ssh_connect() gets called from Curl_protocol_connect() to allow us to\r\n * do protocol-specific actions at connect-time.\r\n */\r\nstatic CURLcode ssh_connect(struct connectdata *conn, bool *done)\r\n{\r\n#ifdef CURL_LIBSSH2_DEBUG\r\n  curl_socket_t sock;\r\n#endif\r\n  struct ssh_conn *ssh;\r\n  CURLcode result;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* We default to persistent connections. We set this already in this connect\r\n     function to make the re-use checks properly be able to check this bit. */\r\n  conn->bits.close = FALSE;\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  result = ssh_init(conn);\r\n  if(result)\r\n    return result;\r\n\r\n  if(conn->handler->protocol & CURLPROTO_SCP) {\r\n    conn->recv[FIRSTSOCKET] = scp_recv;\r\n    conn->send[FIRSTSOCKET] = scp_send;\r\n  }\r\n  else {\r\n    conn->recv[FIRSTSOCKET] = sftp_recv;\r\n    conn->send[FIRSTSOCKET] = sftp_send;\r\n  }\r\n  ssh = &conn->proto.sshc;\r\n\r\n#ifdef CURL_LIBSSH2_DEBUG\r\n  if(conn->user) {\r\n    infof(data, \"User: %s\\n\", conn->user);\r\n  }\r\n  if(conn->passwd) {\r\n    infof(data, \"Password: %s\\n\", conn->passwd);\r\n  }\r\n  sock = conn->sock[FIRSTSOCKET];\r\n#endif /* CURL_LIBSSH2_DEBUG */\r\n\r\n  ssh->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,\r\n                                             my_libssh2_free,\r\n                                             my_libssh2_realloc, conn);\r\n  if(ssh->ssh_session == NULL) {\r\n    failf(data, \"Failure initialising ssh session\");\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\n  if(data->set.str[STRING_SSH_KNOWNHOSTS]) {\r\n    int rc;\r\n    ssh->kh = libssh2_knownhost_init(ssh->ssh_session);\r\n    if(!ssh->kh) {\r\n      /* eeek. TODO: free the ssh_session! */\r\n      return CURLE_FAILED_INIT;\r\n    }\r\n\r\n    /* read all known hosts from there */\r\n    rc = libssh2_knownhost_readfile(ssh->kh,\r\n                                    data->set.str[STRING_SSH_KNOWNHOSTS],\r\n                                    LIBSSH2_KNOWNHOST_FILE_OPENSSH);\r\n    if(rc < 0)\r\n      infof(data, \"Failed to read known hosts from %s\\n\",\r\n            data->set.str[STRING_SSH_KNOWNHOSTS]);\r\n  }\r\n#endif /* HAVE_LIBSSH2_KNOWNHOST_API */\r\n\r\n#ifdef CURL_LIBSSH2_DEBUG\r\n  libssh2_trace(ssh->ssh_session, ~0);\r\n  infof(data, \"SSH socket: %d\\n\", (int)sock);\r\n#endif /* CURL_LIBSSH2_DEBUG */\r\n\r\n  state(conn, SSH_INIT);\r\n\r\n  result = ssh_multi_statemach(conn, done);\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n ***********************************************************************\r\n *\r\n * scp_perform()\r\n *\r\n * This is the actual DO function for SCP. Get a file according to\r\n * the options previously setup.\r\n */\r\n\r\nstatic\r\nCURLcode scp_perform(struct connectdata *conn,\r\n                      bool *connected,\r\n                      bool *dophase_done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  DEBUGF(infof(conn->data, \"DO phase starts\\n\"));\r\n\r\n  *dophase_done = FALSE; /* not done yet */\r\n\r\n  /* start the first command in the DO phase */\r\n  state(conn, SSH_SCP_TRANS_INIT);\r\n\r\n  /* run the state-machine */\r\n  result = ssh_multi_statemach(conn, dophase_done);\r\n\r\n  *connected = conn->bits.tcpconnect[FIRSTSOCKET];\r\n\r\n  if(*dophase_done) {\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* called from multi.c while DOing */\r\nstatic CURLcode scp_doing(struct connectdata *conn,\r\n                               bool *dophase_done)\r\n{\r\n  CURLcode result;\r\n  result = ssh_multi_statemach(conn, dophase_done);\r\n\r\n  if(*dophase_done) {\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n  }\r\n  return result;\r\n}\r\n\r\n/*\r\n * The DO function is generic for both protocols. There was previously two\r\n * separate ones but this way means less duplicated code.\r\n */\r\n\r\nstatic CURLcode ssh_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode res;\r\n  bool connected = 0;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  *done = FALSE; /* default to false */\r\n\r\n  /*\r\n    Since connections can be re-used between SessionHandles, this might be a\r\n    connection already existing but on a fresh SessionHandle struct so we must\r\n    make sure we have a good 'struct SSHPROTO' to play with. For new\r\n    connections, the struct SSHPROTO is allocated and setup in the\r\n    ssh_connect() function.\r\n  */\r\n  Curl_reset_reqproto(conn);\r\n  res = ssh_init(conn);\r\n  if(res)\r\n    return res;\r\n\r\n  data->req.size = -1; /* make sure this is unknown at this point */\r\n\r\n  Curl_pgrsSetUploadCounter(data, 0);\r\n  Curl_pgrsSetDownloadCounter(data, 0);\r\n  Curl_pgrsSetUploadSize(data, 0);\r\n  Curl_pgrsSetDownloadSize(data, 0);\r\n\r\n  if(conn->handler->protocol & CURLPROTO_SCP)\r\n    res = scp_perform(conn, &connected,  done);\r\n  else\r\n    res = sftp_perform(conn, &connected,  done);\r\n\r\n  return res;\r\n}\r\n\r\n/* BLOCKING, but the function is using the state machine so the only reason\r\n   this is still blocking is that the multi interface code has no support for\r\n   disconnecting operations that takes a while */\r\nstatic CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct ssh_conn *ssh = &conn->proto.sshc;\r\n  (void) dead_connection;\r\n\r\n  Curl_safefree(conn->data->state.proto.ssh);\r\n\r\n  if(ssh->ssh_session) {\r\n    /* only if there's a session still around to use! */\r\n\r\n    state(conn, SSH_SESSION_DISCONNECT);\r\n\r\n    result = ssh_easy_statemach(conn, FALSE);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* generic done function for both SCP and SFTP called from their specific\r\n   done functions */\r\nstatic CURLcode ssh_done(struct connectdata *conn, CURLcode status)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SSHPROTO *sftp_scp = conn->data->state.proto.ssh;\r\n\r\n  if(status == CURLE_OK) {\r\n    /* run the state-machine\r\n\r\n       TODO: when the multi interface is used, this _really_ should be using\r\n       the ssh_multi_statemach function but we have no general support for\r\n       non-blocking DONE operations, not in the multi state machine and with\r\n       Curl_done() invokes on several places in the code!\r\n    */\r\n    result = ssh_easy_statemach(conn, FALSE);\r\n  }\r\n  else\r\n    result = status;\r\n\r\n  if(sftp_scp)\r\n    Curl_safefree(sftp_scp->path);\r\n  if(Curl_pgrsDone(conn))\r\n    return CURLE_ABORTED_BY_CALLBACK;\r\n\r\n  conn->data->req.keepon = 0; /* clear all bits */\r\n  return result;\r\n}\r\n\r\n\r\nstatic CURLcode scp_done(struct connectdata *conn, CURLcode status,\r\n                         bool premature)\r\n{\r\n  (void)premature; /* not used */\r\n\r\n  if(status == CURLE_OK)\r\n    state(conn, SSH_SCP_DONE);\r\n\r\n  return ssh_done(conn, status);\r\n\r\n}\r\n\r\n/* return number of received (decrypted) bytes */\r\nstatic ssize_t scp_send(struct connectdata *conn, int sockindex,\r\n                        const void *mem, size_t len, CURLcode *err)\r\n{\r\n  ssize_t nwrite;\r\n  (void)sockindex; /* we only support SCP on the fixed known primary socket */\r\n\r\n  /* libssh2_channel_write() returns int! */\r\n  nwrite = (ssize_t)\r\n    libssh2_channel_write(conn->proto.sshc.ssh_channel, mem, len);\r\n\r\n  ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);\r\n\r\n  if(nwrite == LIBSSH2_ERROR_EAGAIN) {\r\n    *err = CURLE_AGAIN;\r\n    nwrite = 0;\r\n  }\r\n  else if(nwrite < LIBSSH2_ERROR_NONE) {\r\n    *err = libssh2_session_error_to_CURLE((int)nwrite);\r\n    nwrite = -1;\r\n  }\r\n\r\n  return nwrite;\r\n}\r\n\r\n/*\r\n * If the read would block (EWOULDBLOCK) we return -1. Otherwise we return\r\n * a regular CURLcode value.\r\n */\r\nstatic ssize_t scp_recv(struct connectdata *conn, int sockindex,\r\n                        char *mem, size_t len, CURLcode *err)\r\n{\r\n  ssize_t nread;\r\n  (void)sockindex; /* we only support SCP on the fixed known primary socket */\r\n\r\n  /* libssh2_channel_read() returns int */\r\n  nread = (ssize_t)\r\n    libssh2_channel_read(conn->proto.sshc.ssh_channel, mem, len);\r\n\r\n  ssh_block2waitfor(conn, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);\r\n  if(nread == LIBSSH2_ERROR_EAGAIN) {\r\n    *err = CURLE_AGAIN;\r\n    nread = -1;\r\n  }\r\n\r\n  return nread;\r\n}\r\n\r\n/*\r\n * =============== SFTP ===============\r\n */\r\n\r\n/*\r\n ***********************************************************************\r\n *\r\n * sftp_perform()\r\n *\r\n * This is the actual DO function for SFTP. Get a file/directory according to\r\n * the options previously setup.\r\n */\r\n\r\nstatic\r\nCURLcode sftp_perform(struct connectdata *conn,\r\n                      bool *connected,\r\n                      bool *dophase_done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  DEBUGF(infof(conn->data, \"DO phase starts\\n\"));\r\n\r\n  *dophase_done = FALSE; /* not done yet */\r\n\r\n  /* start the first command in the DO phase */\r\n  state(conn, SSH_SFTP_QUOTE_INIT);\r\n\r\n  /* run the state-machine */\r\n  result = ssh_multi_statemach(conn, dophase_done);\r\n\r\n  *connected = conn->bits.tcpconnect[FIRSTSOCKET];\r\n\r\n  if(*dophase_done) {\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* called from multi.c while DOing */\r\nstatic CURLcode sftp_doing(struct connectdata *conn,\r\n                           bool *dophase_done)\r\n{\r\n  CURLcode result;\r\n  result = ssh_multi_statemach(conn, dophase_done);\r\n\r\n  if(*dophase_done) {\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n  }\r\n  return result;\r\n}\r\n\r\n/* BLOCKING, but the function is using the state machine so the only reason\r\n   this is still blocking is that the multi interface code has no support for\r\n   disconnecting operations that takes a while */\r\nstatic CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  (void) dead_connection;\r\n\r\n  DEBUGF(infof(conn->data, \"SSH DISCONNECT starts now\\n\"));\r\n\r\n  Curl_safefree(conn->data->state.proto.ssh);\r\n\r\n  if(conn->proto.sshc.ssh_session) {\r\n    /* only if there's a session still around to use! */\r\n    state(conn, SSH_SFTP_SHUTDOWN);\r\n    result = ssh_easy_statemach(conn, FALSE);\r\n  }\r\n\r\n  DEBUGF(infof(conn->data, \"SSH DISCONNECT is done\\n\"));\r\n\r\n  return result;\r\n\r\n}\r\n\r\nstatic CURLcode sftp_done(struct connectdata *conn, CURLcode status,\r\n                               bool premature)\r\n{\r\n  struct ssh_conn *sshc = &conn->proto.sshc;\r\n\r\n  if(status == CURLE_OK) {\r\n    /* Post quote commands are executed after the SFTP_CLOSE state to avoid\r\n       errors that could happen due to open file handles during POSTQUOTE\r\n       operation */\r\n    if(!status && !premature && conn->data->set.postquote) {\r\n      sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT;\r\n      state(conn, SSH_SFTP_CLOSE);\r\n    }\r\n    else\r\n      state(conn, SSH_SFTP_CLOSE);\r\n  }\r\n  return ssh_done(conn, status);\r\n}\r\n\r\n/* return number of sent bytes */\r\nstatic ssize_t sftp_send(struct connectdata *conn, int sockindex,\r\n                         const void *mem, size_t len, CURLcode *err)\r\n{\r\n  ssize_t nwrite;   /* libssh2_sftp_write() used to return size_t in 0.14\r\n                       but is changed to ssize_t in 0.15. These days we don't\r\n                       support libssh2 0.15*/\r\n  (void)sockindex;\r\n\r\n  nwrite = libssh2_sftp_write(conn->proto.sshc.sftp_handle, mem, len);\r\n\r\n  ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);\r\n\r\n  if(nwrite == LIBSSH2_ERROR_EAGAIN) {\r\n    *err = CURLE_AGAIN;\r\n    nwrite = 0;\r\n  }\r\n  else if(nwrite < LIBSSH2_ERROR_NONE) {\r\n    *err = libssh2_session_error_to_CURLE((int)nwrite);\r\n    nwrite = -1;\r\n  }\r\n\r\n  return nwrite;\r\n}\r\n\r\n/*\r\n * Return number of received (decrypted) bytes\r\n */\r\nstatic ssize_t sftp_recv(struct connectdata *conn, int sockindex,\r\n                         char *mem, size_t len, CURLcode *err)\r\n{\r\n  ssize_t nread;\r\n  (void)sockindex;\r\n\r\n  nread = libssh2_sftp_read(conn->proto.sshc.sftp_handle, mem, len);\r\n\r\n  ssh_block2waitfor(conn, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);\r\n\r\n  if(nread == LIBSSH2_ERROR_EAGAIN) {\r\n    *err = CURLE_AGAIN;\r\n    nread = -1;\r\n  }\r\n  return nread;\r\n}\r\n\r\n/* The get_pathname() function is being borrowed from OpenSSH sftp.c\r\n   version 4.6p1. */\r\n/*\r\n * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>\r\n *\r\n * Permission to use, copy, modify, and distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\nstatic CURLcode\r\nget_pathname(const char **cpp, char **path)\r\n{\r\n  const char *cp = *cpp, *end;\r\n  char quot;\r\n  unsigned int i, j;\r\n  static const char WHITESPACE[] = \" \\t\\r\\n\";\r\n\r\n  cp += strspn(cp, WHITESPACE);\r\n  if(!*cp) {\r\n    *cpp = cp;\r\n    *path = NULL;\r\n    return CURLE_QUOTE_ERROR;\r\n  }\r\n\r\n  *path = malloc(strlen(cp) + 1);\r\n  if(*path == NULL)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* Check for quoted filenames */\r\n  if(*cp == '\\\"' || *cp == '\\'') {\r\n    quot = *cp++;\r\n\r\n    /* Search for terminating quote, unescape some chars */\r\n    for(i = j = 0; i <= strlen(cp); i++) {\r\n      if(cp[i] == quot) {  /* Found quote */\r\n        i++;\r\n        (*path)[j] = '\\0';\r\n        break;\r\n      }\r\n      if(cp[i] == '\\0') {  /* End of string */\r\n        /*error(\"Unterminated quote\");*/\r\n        goto fail;\r\n      }\r\n      if(cp[i] == '\\\\') {  /* Escaped characters */\r\n        i++;\r\n        if(cp[i] != '\\'' && cp[i] != '\\\"' &&\r\n            cp[i] != '\\\\') {\r\n          /*error(\"Bad escaped character '\\\\%c'\",\r\n              cp[i]);*/\r\n          goto fail;\r\n        }\r\n      }\r\n      (*path)[j++] = cp[i];\r\n    }\r\n\r\n    if(j == 0) {\r\n      /*error(\"Empty quotes\");*/\r\n      goto fail;\r\n    }\r\n    *cpp = cp + i + strspn(cp + i, WHITESPACE);\r\n  }\r\n  else {\r\n    /* Read to end of filename */\r\n    end = strpbrk(cp, WHITESPACE);\r\n    if(end == NULL)\r\n      end = strchr(cp, '\\0');\r\n    *cpp = end + strspn(end, WHITESPACE);\r\n\r\n    memcpy(*path, cp, end - cp);\r\n    (*path)[end - cp] = '\\0';\r\n  }\r\n  return CURLE_OK;\r\n\r\n  fail:\r\n    Curl_safefree(*path);\r\n    return CURLE_QUOTE_ERROR;\r\n}\r\n\r\n\r\nstatic const char *sftp_libssh2_strerror(int err)\r\n{\r\n  switch (err) {\r\n    case LIBSSH2_FX_NO_SUCH_FILE:\r\n      return \"No such file or directory\";\r\n\r\n    case LIBSSH2_FX_PERMISSION_DENIED:\r\n      return \"Permission denied\";\r\n\r\n    case LIBSSH2_FX_FAILURE:\r\n      return \"Operation failed\";\r\n\r\n    case LIBSSH2_FX_BAD_MESSAGE:\r\n      return \"Bad message from SFTP server\";\r\n\r\n    case LIBSSH2_FX_NO_CONNECTION:\r\n      return \"Not connected to SFTP server\";\r\n\r\n    case LIBSSH2_FX_CONNECTION_LOST:\r\n      return \"Connection to SFTP server lost\";\r\n\r\n    case LIBSSH2_FX_OP_UNSUPPORTED:\r\n      return \"Operation not supported by SFTP server\";\r\n\r\n    case LIBSSH2_FX_INVALID_HANDLE:\r\n      return \"Invalid handle\";\r\n\r\n    case LIBSSH2_FX_NO_SUCH_PATH:\r\n      return \"No such file or directory\";\r\n\r\n    case LIBSSH2_FX_FILE_ALREADY_EXISTS:\r\n      return \"File already exists\";\r\n\r\n    case LIBSSH2_FX_WRITE_PROTECT:\r\n      return \"File is write protected\";\r\n\r\n    case LIBSSH2_FX_NO_MEDIA:\r\n      return \"No media\";\r\n\r\n    case LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM:\r\n      return \"Disk full\";\r\n\r\n    case LIBSSH2_FX_QUOTA_EXCEEDED:\r\n      return \"User quota exceeded\";\r\n\r\n    case LIBSSH2_FX_UNKNOWN_PRINCIPLE:\r\n      return \"Unknown principle\";\r\n\r\n    case LIBSSH2_FX_LOCK_CONFlICT:\r\n      return \"File lock conflict\";\r\n\r\n    case LIBSSH2_FX_DIR_NOT_EMPTY:\r\n      return \"Directory not empty\";\r\n\r\n    case LIBSSH2_FX_NOT_A_DIRECTORY:\r\n      return \"Not a directory\";\r\n\r\n    case LIBSSH2_FX_INVALID_FILENAME:\r\n      return \"Invalid filename\";\r\n\r\n    case LIBSSH2_FX_LINK_LOOP:\r\n      return \"Link points to itself\";\r\n  }\r\n  return \"Unknown error in libssh2\";\r\n}\r\n\r\n#endif /* USE_LIBSSH2 */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ssh.h",
    "content": "#ifndef HEADER_CURL_SSH_H\r\n#define HEADER_CURL_SSH_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_LIBSSH2_H\r\n#include <libssh2.h>\r\n#include <libssh2_sftp.h>\r\n#endif /* HAVE_LIBSSH2_H */\r\n\r\n/****************************************************************************\r\n * SSH unique setup\r\n ***************************************************************************/\r\ntypedef enum {\r\n  SSH_NO_STATE = -1,  /* Used for \"nextState\" so say there is none */\r\n  SSH_STOP = 0,       /* do nothing state, stops the state machine */\r\n\r\n  SSH_INIT,           /* First state in SSH-CONNECT */\r\n  SSH_S_STARTUP,      /* Session startup */\r\n  SSH_HOSTKEY,        /* verify hostkey */\r\n  SSH_AUTHLIST,\r\n  SSH_AUTH_PKEY_INIT,\r\n  SSH_AUTH_PKEY,\r\n  SSH_AUTH_PASS_INIT,\r\n  SSH_AUTH_PASS,\r\n  SSH_AUTH_AGENT_INIT,/* initialize then wait for connection to agent */\r\n  SSH_AUTH_AGENT_LIST,/* ask for list then wait for entire list to come */\r\n  SSH_AUTH_AGENT,     /* attempt one key at a time */\r\n  SSH_AUTH_HOST_INIT,\r\n  SSH_AUTH_HOST,\r\n  SSH_AUTH_KEY_INIT,\r\n  SSH_AUTH_KEY,\r\n  SSH_AUTH_DONE,\r\n  SSH_SFTP_INIT,\r\n  SSH_SFTP_REALPATH,   /* Last state in SSH-CONNECT */\r\n\r\n  SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */\r\n  SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */\r\n  SSH_SFTP_QUOTE,\r\n  SSH_SFTP_NEXT_QUOTE,\r\n  SSH_SFTP_QUOTE_STAT,\r\n  SSH_SFTP_QUOTE_SETSTAT,\r\n  SSH_SFTP_QUOTE_SYMLINK,\r\n  SSH_SFTP_QUOTE_MKDIR,\r\n  SSH_SFTP_QUOTE_RENAME,\r\n  SSH_SFTP_QUOTE_RMDIR,\r\n  SSH_SFTP_QUOTE_UNLINK,\r\n  SSH_SFTP_TRANS_INIT,\r\n  SSH_SFTP_UPLOAD_INIT,\r\n  SSH_SFTP_CREATE_DIRS_INIT,\r\n  SSH_SFTP_CREATE_DIRS,\r\n  SSH_SFTP_CREATE_DIRS_MKDIR,\r\n  SSH_SFTP_READDIR_INIT,\r\n  SSH_SFTP_READDIR,\r\n  SSH_SFTP_READDIR_LINK,\r\n  SSH_SFTP_READDIR_BOTTOM,\r\n  SSH_SFTP_READDIR_DONE,\r\n  SSH_SFTP_DOWNLOAD_INIT,\r\n  SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */\r\n  SSH_SFTP_CLOSE,    /* Last state in SFTP-DONE */\r\n  SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */\r\n  SSH_SCP_TRANS_INIT, /* First state in SCP-DO */\r\n  SSH_SCP_UPLOAD_INIT,\r\n  SSH_SCP_DOWNLOAD_INIT,\r\n  SSH_SCP_DONE,\r\n  SSH_SCP_SEND_EOF,\r\n  SSH_SCP_WAIT_EOF,\r\n  SSH_SCP_WAIT_CLOSE,\r\n  SSH_SCP_CHANNEL_FREE,   /* Last state in SCP-DONE */\r\n  SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */\r\n  SSH_SESSION_FREE,       /* Last state in SCP/SFTP-DISCONNECT */\r\n  SSH_QUIT,\r\n  SSH_LAST  /* never used */\r\n} sshstate;\r\n\r\n/* this struct is used in the HandleData struct which is part of the\r\n   SessionHandle, which means this is used on a per-easy handle basis.\r\n   Everything that is strictly related to a connection is banned from this\r\n   struct. */\r\nstruct SSHPROTO {\r\n  char *path;                  /* the path we operate on */\r\n};\r\n\r\n/* ssh_conn is used for struct connection-oriented data in the connectdata\r\n   struct */\r\nstruct ssh_conn {\r\n  const char *authlist;       /* List of auth. methods, managed by libssh2 */\r\n#ifdef USE_LIBSSH2\r\n  const char *passphrase;     /* pass-phrase to use */\r\n  char *rsa_pub;              /* path name */\r\n  char *rsa;                  /* path name */\r\n  bool authed;                /* the connection has been authenticated fine */\r\n  sshstate state;             /* always use ssh.c:state() to change state! */\r\n  sshstate nextstate;         /* the state to goto after stopping */\r\n  CURLcode actualcode;        /* the actual error code */\r\n  struct curl_slist *quote_item; /* for the quote option */\r\n  char *quote_path1;          /* two generic pointers for the QUOTE stuff */\r\n  char *quote_path2;\r\n  LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */\r\n  bool acceptfail;            /* used by the SFTP_QUOTE (continue if\r\n                                 quote command fails) */\r\n  char *homedir;              /* when doing SFTP we figure out home dir in the\r\n                                 connect phase */\r\n\r\n  /* Here's a set of struct members used by the SFTP_READDIR state */\r\n  LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;\r\n  char *readdir_filename;\r\n  char *readdir_longentry;\r\n  int readdir_len, readdir_totalLen, readdir_currLen;\r\n  char *readdir_line;\r\n  char *readdir_linkPath;\r\n  /* end of READDIR stuff */\r\n\r\n  int secondCreateDirs;         /* counter use by the code to see if the\r\n                                   second attempt has been made to change\r\n                                   to/create a directory */\r\n  char *slash_pos;              /* used by the SFTP_CREATE_DIRS state */\r\n  LIBSSH2_SESSION *ssh_session; /* Secure Shell session */\r\n  LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */\r\n  LIBSSH2_SFTP *sftp_session;   /* SFTP handle */\r\n  LIBSSH2_SFTP_HANDLE *sftp_handle;\r\n  int orig_waitfor;             /* default READ/WRITE bits wait for */\r\n\r\n#ifdef HAVE_LIBSSH2_AGENT_API\r\n  LIBSSH2_AGENT *ssh_agent;     /* proxy to ssh-agent/pageant */\r\n  struct libssh2_agent_publickey *sshagent_identity,\r\n                                 *sshagent_prev_identity;\r\n#endif\r\n\r\n  /* note that HAVE_LIBSSH2_KNOWNHOST_API is a define set in the libssh2.h\r\n     header */\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\n  LIBSSH2_KNOWNHOSTS *kh;\r\n#endif\r\n#endif /* USE_LIBSSH2 */\r\n};\r\n\r\n#ifdef USE_LIBSSH2\r\n\r\n#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)\r\n#  error \"SCP/SFTP protocols require libssh2 0.16 or later\"\r\n#endif\r\n\r\n#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010000)\r\n#  define HAVE_LIBSSH2_SFTP_SEEK64 1\r\n#else\r\n#  undef HAVE_LIBSSH2_SFTP_SEEK64\r\n#endif\r\n\r\n#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010206)\r\n#  define HAVE_LIBSSH2_SCP_SEND64 1\r\n#else\r\n#  undef HAVE_LIBSSH2_SCP_SEND64\r\n#endif\r\n\r\n\r\nextern const struct Curl_handler Curl_handler_scp;\r\nextern const struct Curl_handler Curl_handler_sftp;\r\n\r\n#endif /* USE_LIBSSH2 */\r\n\r\n#endif /* HEADER_CURL_SSH_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/sslgen.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* This file is for implementing all \"generic\" SSL functions that all libcurl\r\n   internals should use. It is then responsible for calling the proper\r\n   \"backend\" function.\r\n\r\n   SSL-functions in libcurl should call functions in this source file, and not\r\n   to any specific SSL-layer.\r\n\r\n   Curl_ssl_ - prefix for generic ones\r\n   Curl_ossl_ - prefix for OpenSSL ones\r\n   Curl_gtls_ - prefix for GnuTLS ones\r\n   Curl_nss_ - prefix for NSS ones\r\n   Curl_polarssl_ - prefix for PolarSSL ones\r\n   Curl_cyassl_ - prefix for CyaSSL ones\r\n   Curl_schannel_ - prefix for Schannel SSPI ones\r\n   Curl_darwinssl_ - prefix for SecureTransport (Darwin) ones\r\n\r\n   Note that this source code uses curlssl_* functions, and they are all\r\n   defines/macros #defined by the lib-specific header files.\r\n\r\n   \"SSL/TLS Strong Encryption: An Introduction\"\r\n   http://httpd.apache.org/docs-2.0/ssl/ssl_intro.html\r\n*/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"urldata.h\"\r\n#define SSLGEN_C\r\n#include \"sslgen.h\" /* generic SSL protos etc */\r\n#include \"ssluse.h\" /* OpenSSL versions */\r\n#include \"gtls.h\"   /* GnuTLS versions */\r\n#include \"nssg.h\"   /* NSS versions */\r\n#include \"qssl.h\"   /* QSOSSL versions */\r\n#include \"polarssl.h\" /* PolarSSL versions */\r\n#include \"axtls.h\"  /* axTLS versions */\r\n#include \"cyassl.h\"  /* CyaSSL versions */\r\n#include \"curl_schannel.h\" /* Schannel SSPI version */\r\n#include \"curl_darwinssl.h\" /* SecureTransport (Darwin) version */\r\n#include \"sendf.h\"\r\n#include \"rawstr.h\"\r\n#include \"url.h\"\r\n#include \"curl_memory.h\"\r\n#include \"progress.h\"\r\n#include \"share_curl.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* convenience macro to check if this handle is using a shared SSL session */\r\n#define SSLSESSION_SHARED(data) (data->share &&                        \\\r\n                                 (data->share->specifier &             \\\r\n                                  (1<<CURL_LOCK_DATA_SSL_SESSION)))\r\n\r\nstatic bool safe_strequal(char* str1, char* str2)\r\n{\r\n  if(str1 && str2)\r\n    /* both pointers point to something then compare them */\r\n    return (0 != Curl_raw_equal(str1, str2)) ? TRUE : FALSE;\r\n  else\r\n    /* if both pointers are NULL then treat them as equal */\r\n    return (!str1 && !str2) ? TRUE : FALSE;\r\n}\r\n\r\nbool\r\nCurl_ssl_config_matches(struct ssl_config_data* data,\r\n                        struct ssl_config_data* needle)\r\n{\r\n  if((data->version == needle->version) &&\r\n     (data->verifypeer == needle->verifypeer) &&\r\n     (data->verifyhost == needle->verifyhost) &&\r\n     safe_strequal(data->CApath, needle->CApath) &&\r\n     safe_strequal(data->CAfile, needle->CAfile) &&\r\n     safe_strequal(data->random_file, needle->random_file) &&\r\n     safe_strequal(data->egdsocket, needle->egdsocket) &&\r\n     safe_strequal(data->cipher_list, needle->cipher_list))\r\n    return TRUE;\r\n\r\n  return FALSE;\r\n}\r\n\r\nbool\r\nCurl_clone_ssl_config(struct ssl_config_data *source,\r\n                      struct ssl_config_data *dest)\r\n{\r\n  dest->sessionid = source->sessionid;\r\n  dest->verifyhost = source->verifyhost;\r\n  dest->verifypeer = source->verifypeer;\r\n  dest->version = source->version;\r\n\r\n  if(source->CAfile) {\r\n    dest->CAfile = strdup(source->CAfile);\r\n    if(!dest->CAfile)\r\n      return FALSE;\r\n  }\r\n  else\r\n    dest->CAfile = NULL;\r\n\r\n  if(source->CApath) {\r\n    dest->CApath = strdup(source->CApath);\r\n    if(!dest->CApath)\r\n      return FALSE;\r\n  }\r\n  else\r\n    dest->CApath = NULL;\r\n\r\n  if(source->cipher_list) {\r\n    dest->cipher_list = strdup(source->cipher_list);\r\n    if(!dest->cipher_list)\r\n      return FALSE;\r\n  }\r\n  else\r\n    dest->cipher_list = NULL;\r\n\r\n  if(source->egdsocket) {\r\n    dest->egdsocket = strdup(source->egdsocket);\r\n    if(!dest->egdsocket)\r\n      return FALSE;\r\n  }\r\n  else\r\n    dest->egdsocket = NULL;\r\n\r\n  if(source->random_file) {\r\n    dest->random_file = strdup(source->random_file);\r\n    if(!dest->random_file)\r\n      return FALSE;\r\n  }\r\n  else\r\n    dest->random_file = NULL;\r\n\r\n  return TRUE;\r\n}\r\n\r\nvoid Curl_free_ssl_config(struct ssl_config_data* sslc)\r\n{\r\n  Curl_safefree(sslc->CAfile);\r\n  Curl_safefree(sslc->CApath);\r\n  Curl_safefree(sslc->cipher_list);\r\n  Curl_safefree(sslc->egdsocket);\r\n  Curl_safefree(sslc->random_file);\r\n}\r\n\r\n#ifdef USE_SSL\r\n\r\n/* \"global\" init done? */\r\nstatic bool init_ssl=FALSE;\r\n\r\n/**\r\n * Global SSL init\r\n *\r\n * @retval 0 error initializing SSL\r\n * @retval 1 SSL initialized successfully\r\n */\r\nint Curl_ssl_init(void)\r\n{\r\n  /* make sure this is only done once */\r\n  if(init_ssl)\r\n    return 1;\r\n  init_ssl = TRUE; /* never again */\r\n\r\n  return curlssl_init();\r\n}\r\n\r\n\r\n/* Global cleanup */\r\nvoid Curl_ssl_cleanup(void)\r\n{\r\n  if(init_ssl) {\r\n    /* only cleanup if we did a previous init */\r\n    curlssl_cleanup();\r\n    init_ssl = FALSE;\r\n  }\r\n}\r\n\r\nCURLcode\r\nCurl_ssl_connect(struct connectdata *conn, int sockindex)\r\n{\r\n  CURLcode res;\r\n  /* mark this is being ssl-enabled from here on. */\r\n  conn->ssl[sockindex].use = TRUE;\r\n  conn->ssl[sockindex].state = ssl_connection_negotiating;\r\n\r\n  res = curlssl_connect(conn, sockindex);\r\n\r\n  if(!res)\r\n    Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */\r\n\r\n  return res;\r\n}\r\n\r\nCURLcode\r\nCurl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,\r\n                             bool *done)\r\n{\r\n  CURLcode res;\r\n  /* mark this is being ssl requested from here on. */\r\n  conn->ssl[sockindex].use = TRUE;\r\n#ifdef curlssl_connect_nonblocking\r\n  res = curlssl_connect_nonblocking(conn, sockindex, done);\r\n#else\r\n  *done = TRUE; /* fallback to BLOCKING */\r\n  res = curlssl_connect(conn, sockindex);\r\n#endif /* non-blocking connect support */\r\n  if(!res && *done)\r\n    Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */\r\n  return res;\r\n}\r\n\r\n/*\r\n * Check if there's a session ID for the given connection in the cache, and if\r\n * there's one suitable, it is provided. Returns TRUE when no entry matched.\r\n */\r\nint Curl_ssl_getsessionid(struct connectdata *conn,\r\n                          void **ssl_sessionid,\r\n                          size_t *idsize) /* set 0 if unknown */\r\n{\r\n  struct curl_ssl_session *check;\r\n  struct SessionHandle *data = conn->data;\r\n  size_t i;\r\n  long *general_age;\r\n  bool no_match = TRUE;\r\n\r\n  *ssl_sessionid = NULL;\r\n\r\n  if(!conn->ssl_config.sessionid)\r\n    /* session ID re-use is disabled */\r\n    return TRUE;\r\n\r\n  /* Lock if shared */\r\n  if(SSLSESSION_SHARED(data)) {\r\n    Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);\r\n    general_age = &data->share->sessionage;\r\n  }\r\n  else\r\n    general_age = &data->state.sessionage;\r\n\r\n  for(i = 0; i < data->set.ssl.max_ssl_sessions; i++) {\r\n    check = &data->state.session[i];\r\n    if(!check->sessionid)\r\n      /* not session ID means blank entry */\r\n      continue;\r\n    if(Curl_raw_equal(conn->host.name, check->name) &&\r\n       (conn->remote_port == check->remote_port) &&\r\n       Curl_ssl_config_matches(&conn->ssl_config, &check->ssl_config)) {\r\n      /* yes, we have a session ID! */\r\n      (*general_age)++;          /* increase general age */\r\n      check->age = *general_age; /* set this as used in this age */\r\n      *ssl_sessionid = check->sessionid;\r\n      if(idsize)\r\n        *idsize = check->idsize;\r\n      no_match = FALSE;\r\n      break;\r\n    }\r\n  }\r\n\r\n  /* Unlock */\r\n  if(SSLSESSION_SHARED(data))\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION);\r\n\r\n  return no_match;\r\n}\r\n\r\n/*\r\n * Kill a single session ID entry in the cache.\r\n */\r\nvoid Curl_ssl_kill_session(struct curl_ssl_session *session)\r\n{\r\n  if(session->sessionid) {\r\n    /* defensive check */\r\n\r\n    /* free the ID the SSL-layer specific way */\r\n    curlssl_session_free(session->sessionid);\r\n\r\n    session->sessionid = NULL;\r\n    session->age = 0; /* fresh */\r\n\r\n    Curl_free_ssl_config(&session->ssl_config);\r\n\r\n    Curl_safefree(session->name);\r\n  }\r\n}\r\n\r\n/*\r\n * Delete the given session ID from the cache.\r\n */\r\nvoid Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid)\r\n{\r\n  size_t i;\r\n  struct SessionHandle *data=conn->data;\r\n\r\n  if(SSLSESSION_SHARED(data))\r\n    Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n  for(i = 0; i < data->set.ssl.max_ssl_sessions; i++) {\r\n    struct curl_ssl_session *check = &data->state.session[i];\r\n\r\n    if(check->sessionid == ssl_sessionid) {\r\n      Curl_ssl_kill_session(check);\r\n      break;\r\n    }\r\n  }\r\n\r\n  if(SSLSESSION_SHARED(data))\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION);\r\n}\r\n\r\n/*\r\n * Store session id in the session cache. The ID passed on to this function\r\n * must already have been extracted and allocated the proper way for the SSL\r\n * layer. Curl_XXXX_session_free() will be called to free/kill the session ID\r\n * later on.\r\n */\r\nCURLcode Curl_ssl_addsessionid(struct connectdata *conn,\r\n                               void *ssl_sessionid,\r\n                               size_t idsize)\r\n{\r\n  size_t i;\r\n  struct SessionHandle *data=conn->data; /* the mother of all structs */\r\n  struct curl_ssl_session *store = &data->state.session[0];\r\n  long oldest_age=data->state.session[0].age; /* zero if unused */\r\n  char *clone_host;\r\n  long *general_age;\r\n\r\n  /* Even though session ID re-use might be disabled, that only disables USING\r\n     IT. We still store it here in case the re-using is again enabled for an\r\n     upcoming transfer */\r\n\r\n  clone_host = strdup(conn->host.name);\r\n  if(!clone_host)\r\n    return CURLE_OUT_OF_MEMORY; /* bail out */\r\n\r\n  /* Now we should add the session ID and the host name to the cache, (remove\r\n     the oldest if necessary) */\r\n\r\n  /* If using shared SSL session, lock! */\r\n  if(SSLSESSION_SHARED(data)) {\r\n    Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);\r\n    general_age = &data->share->sessionage;\r\n  }\r\n  else {\r\n    general_age = &data->state.sessionage;\r\n  }\r\n\r\n  /* find an empty slot for us, or find the oldest */\r\n  for(i = 1; (i < data->set.ssl.max_ssl_sessions) &&\r\n        data->state.session[i].sessionid; i++) {\r\n    if(data->state.session[i].age < oldest_age) {\r\n      oldest_age = data->state.session[i].age;\r\n      store = &data->state.session[i];\r\n    }\r\n  }\r\n  if(i == data->set.ssl.max_ssl_sessions)\r\n    /* cache is full, we must \"kill\" the oldest entry! */\r\n    Curl_ssl_kill_session(store);\r\n  else\r\n    store = &data->state.session[i]; /* use this slot */\r\n\r\n  /* now init the session struct wisely */\r\n  store->sessionid = ssl_sessionid;\r\n  store->idsize = idsize;\r\n  store->age = *general_age;    /* set current age */\r\n  if(store->name)\r\n    /* free it if there's one already present */\r\n    free(store->name);\r\n  store->name = clone_host;               /* clone host name */\r\n  store->remote_port = conn->remote_port; /* port number */\r\n\r\n\r\n  /* Unlock */\r\n  if(SSLSESSION_SHARED(data))\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION);\r\n\r\n  if(!Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config)) {\r\n    store->sessionid = NULL; /* let caller free sessionid */\r\n    free(clone_host);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\nvoid Curl_ssl_close_all(struct SessionHandle *data)\r\n{\r\n  size_t i;\r\n  /* kill the session ID cache if not shared */\r\n  if(data->state.session && !SSLSESSION_SHARED(data)) {\r\n    for(i = 0; i < data->set.ssl.max_ssl_sessions; i++)\r\n      /* the single-killer function handles empty table slots */\r\n      Curl_ssl_kill_session(&data->state.session[i]);\r\n\r\n    /* free the cache data */\r\n    Curl_safefree(data->state.session);\r\n  }\r\n\r\n  curlssl_close_all(data);\r\n}\r\n\r\nvoid Curl_ssl_close(struct connectdata *conn, int sockindex)\r\n{\r\n  DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));\r\n  curlssl_close(conn, sockindex);\r\n}\r\n\r\nCURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  if(curlssl_shutdown(conn, sockindex))\r\n    return CURLE_SSL_SHUTDOWN_FAILED;\r\n\r\n  conn->ssl[sockindex].use = FALSE; /* get back to ordinary socket usage */\r\n  conn->ssl[sockindex].state = ssl_connection_none;\r\n\r\n  conn->recv[sockindex] = Curl_recv_plain;\r\n  conn->send[sockindex] = Curl_send_plain;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Selects an SSL crypto engine\r\n */\r\nCURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine)\r\n{\r\n  return curlssl_set_engine(data, engine);\r\n}\r\n\r\n/* Selects the default SSL crypto engine\r\n */\r\nCURLcode Curl_ssl_set_engine_default(struct SessionHandle *data)\r\n{\r\n  return curlssl_set_engine_default(data);\r\n}\r\n\r\n/* Return list of OpenSSL crypto engine names. */\r\nstruct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data)\r\n{\r\n  return curlssl_engines_list(data);\r\n}\r\n\r\n/*\r\n * This sets up a session ID cache to the specified size. Make sure this code\r\n * is agnostic to what underlying SSL technology we use.\r\n */\r\nCURLcode Curl_ssl_initsessions(struct SessionHandle *data, size_t amount)\r\n{\r\n  struct curl_ssl_session *session;\r\n\r\n  if(data->state.session)\r\n    /* this is just a precaution to prevent multiple inits */\r\n    return CURLE_OK;\r\n\r\n  session = calloc(amount, sizeof(struct curl_ssl_session));\r\n  if(!session)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* store the info in the SSL section */\r\n  data->set.ssl.max_ssl_sessions = amount;\r\n  data->state.session = session;\r\n  data->state.sessionage = 1; /* this is brand new */\r\n  return CURLE_OK;\r\n}\r\n\r\nsize_t Curl_ssl_version(char *buffer, size_t size)\r\n{\r\n  return curlssl_version(buffer, size);\r\n}\r\n\r\n/*\r\n * This function tries to determine connection status.\r\n *\r\n * Return codes:\r\n *     1 means the connection is still in place\r\n *     0 means the connection has been closed\r\n *    -1 means the connection status is unknown\r\n */\r\nint Curl_ssl_check_cxn(struct connectdata *conn)\r\n{\r\n  return curlssl_check_cxn(conn);\r\n}\r\n\r\nbool Curl_ssl_data_pending(const struct connectdata *conn,\r\n                           int connindex)\r\n{\r\n  return curlssl_data_pending(conn, connindex);\r\n}\r\n\r\nvoid Curl_ssl_free_certinfo(struct SessionHandle *data)\r\n{\r\n  int i;\r\n  struct curl_certinfo *ci = &data->info.certs;\r\n  if(ci->num_of_certs) {\r\n    /* free all individual lists used */\r\n    for(i=0; i<ci->num_of_certs; i++) {\r\n      curl_slist_free_all(ci->certinfo[i]);\r\n      ci->certinfo[i] = NULL;\r\n    }\r\n    free(ci->certinfo); /* free the actual array too */\r\n    ci->certinfo = NULL;\r\n    ci->num_of_certs = 0;\r\n  }\r\n}\r\n\r\n#if defined(USE_SSLEAY) || defined(USE_GNUTLS) || defined(USE_NSS) || \\\r\n    defined(USE_DARWINSSL)\r\n/* these functions are only used by some SSL backends */\r\n\r\nvoid Curl_ssl_random(struct SessionHandle *data,\r\n                     unsigned char *entropy,\r\n                     size_t length)\r\n{\r\n  curlssl_random(data, entropy, length);\r\n}\r\n\r\nvoid Curl_ssl_md5sum(unsigned char *tmp, /* input */\r\n                     size_t tmplen,\r\n                     unsigned char *md5sum, /* output */\r\n                     size_t md5len)\r\n{\r\n  curlssl_md5sum(tmp, tmplen, md5sum, md5len);\r\n}\r\n#endif /* USE_SSLEAY || USE_GNUTLS || USE_NSS || USE_DARWINSSL */\r\n\r\n#endif /* USE_SSL */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/sslgen.h",
    "content": "#ifndef HEADER_CURL_SSLGEN_H\r\n#define HEADER_CURL_SSLGEN_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef MD5_DIGEST_LENGTH\r\n#define MD5_DIGEST_LENGTH 16 /* fixed size */\r\n#endif\r\n\r\nbool Curl_ssl_config_matches(struct ssl_config_data* data,\r\n                             struct ssl_config_data* needle);\r\nbool Curl_clone_ssl_config(struct ssl_config_data* source,\r\n                           struct ssl_config_data* dest);\r\nvoid Curl_free_ssl_config(struct ssl_config_data* sslc);\r\n\r\n#ifdef USE_SSL\r\nint Curl_ssl_init(void);\r\nvoid Curl_ssl_cleanup(void);\r\nCURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);\r\nCURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,\r\n                                      int sockindex,\r\n                                      bool *done);\r\n/* tell the SSL stuff to close down all open information regarding\r\n   connections (and thus session ID caching etc) */\r\nvoid Curl_ssl_close_all(struct SessionHandle *data);\r\nvoid Curl_ssl_close(struct connectdata *conn, int sockindex);\r\nCURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);\r\nCURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);\r\n/* Sets engine as default for all SSL operations */\r\nCURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);\r\nstruct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);\r\n\r\n/* init the SSL session ID cache */\r\nCURLcode Curl_ssl_initsessions(struct SessionHandle *, size_t);\r\nsize_t Curl_ssl_version(char *buffer, size_t size);\r\nbool Curl_ssl_data_pending(const struct connectdata *conn,\r\n                           int connindex);\r\nint Curl_ssl_check_cxn(struct connectdata *conn);\r\nvoid Curl_ssl_free_certinfo(struct SessionHandle *data);\r\n\r\n/* Functions to be used by SSL library adaptation functions */\r\n\r\n/* extract a session ID */\r\nint Curl_ssl_getsessionid(struct connectdata *conn,\r\n                          void **ssl_sessionid,\r\n                          size_t *idsize) /* set 0 if unknown */;\r\n/* add a new session ID */\r\nCURLcode Curl_ssl_addsessionid(struct connectdata *conn,\r\n                               void *ssl_sessionid,\r\n                               size_t idsize);\r\n/* Kill a single session ID entry in the cache */\r\nvoid Curl_ssl_kill_session(struct curl_ssl_session *session);\r\n/* delete a session from the cache */\r\nvoid Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);\r\n\r\n/* get N random bytes into the buffer */\r\nvoid Curl_ssl_random(struct SessionHandle *data, unsigned char *buffer,\r\n                     size_t length);\r\nvoid Curl_ssl_md5sum(unsigned char *tmp, /* input */\r\n                     size_t tmplen,\r\n                     unsigned char *md5sum, /* output */\r\n                     size_t md5len);\r\n\r\n#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */\r\n\r\n#else\r\n/* When SSL support is not present, just define away these function calls */\r\n#define Curl_ssl_init() 1\r\n#define Curl_ssl_cleanup() Curl_nop_stmt\r\n#define Curl_ssl_connect(x,y) CURLE_NOT_BUILT_IN\r\n#define Curl_ssl_close_all(x) Curl_nop_stmt\r\n#define Curl_ssl_close(x,y) Curl_nop_stmt\r\n#define Curl_ssl_shutdown(x,y) CURLE_NOT_BUILT_IN\r\n#define Curl_ssl_set_engine(x,y) CURLE_NOT_BUILT_IN\r\n#define Curl_ssl_set_engine_default(x) CURLE_NOT_BUILT_IN\r\n#define Curl_ssl_engines_list(x) NULL\r\n#define Curl_ssl_send(a,b,c,d,e) -1\r\n#define Curl_ssl_recv(a,b,c,d,e) -1\r\n#define Curl_ssl_initsessions(x,y) CURLE_OK\r\n#define Curl_ssl_version(x,y) 0\r\n#define Curl_ssl_data_pending(x,y) 0\r\n#define Curl_ssl_check_cxn(x) 0\r\n#define Curl_ssl_free_certinfo(x) Curl_nop_stmt\r\n#define Curl_ssl_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN\r\n#define Curl_ssl_kill_session(x) Curl_nop_stmt\r\n#endif\r\n\r\n#endif /* HEADER_CURL_SSLGEN_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ssluse.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * Source file for all OpenSSL-specific code for the TLS/SSL layer. No code\r\n * but sslgen.c should ever call or use these functions.\r\n */\r\n\r\n/*\r\n * The original SSLeay-using code for curl was written by Linas Vepstas and\r\n * Sampo Kellomaki 1998.\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include \"sendf.h\"\r\n#include \"formdata.h\" /* for the boundary function */\r\n#include \"url.h\" /* for the ssl config check function */\r\n#include \"inet_pton.h\"\r\n#include \"ssluse.h\"\r\n#include \"connect.h\"\r\n#include \"strequal.h\"\r\n#include \"select.h\"\r\n#include \"sslgen.h\"\r\n#include \"rawstr.h\"\r\n#include \"hostcheck.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use the internal *printf() functions */\r\n#include <curl/mprintf.h>\r\n\r\n#ifdef USE_SSLEAY\r\n\r\n#ifdef USE_OPENSSL\r\n#include <openssl/rand.h>\r\n#include <openssl/x509v3.h>\r\n#include <openssl/dsa.h>\r\n#include <openssl/dh.h>\r\n#include <openssl/err.h>\r\n#include <openssl/md5.h>\r\n#else\r\n#include <rand.h>\r\n#include <x509v3.h>\r\n#include <md5.h>\r\n#endif\r\n\r\n#include \"warnless.h\"\r\n#include \"curl_memory.h\"\r\n#include \"non-ascii.h\" /* for Curl_convert_from_utf8 prototype */\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#ifndef OPENSSL_VERSION_NUMBER\r\n#error \"OPENSSL_VERSION_NUMBER not defined\"\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x0090581fL\r\n#define HAVE_SSL_GET1_SESSION 1\r\n#else\r\n#undef HAVE_SSL_GET1_SESSION\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x00904100L\r\n#define HAVE_USERDATA_IN_PWD_CALLBACK 1\r\n#else\r\n#undef HAVE_USERDATA_IN_PWD_CALLBACK\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x00907001L\r\n/* ENGINE_load_private_key() takes four arguments */\r\n#define HAVE_ENGINE_LOAD_FOUR_ARGS\r\n#include <openssl/ui.h>\r\n#else\r\n/* ENGINE_load_private_key() takes three arguments */\r\n#undef HAVE_ENGINE_LOAD_FOUR_ARGS\r\n#endif\r\n\r\n#if (OPENSSL_VERSION_NUMBER >= 0x00903001L) && defined(HAVE_OPENSSL_PKCS12_H)\r\n/* OpenSSL has PKCS 12 support */\r\n#define HAVE_PKCS12_SUPPORT\r\n#else\r\n/* OpenSSL/SSLEay does not have PKCS12 support */\r\n#undef HAVE_PKCS12_SUPPORT\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x00906001L\r\n#define HAVE_ERR_ERROR_STRING_N 1\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x00909000L\r\n#define SSL_METHOD_QUAL const\r\n#else\r\n#define SSL_METHOD_QUAL\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x00907000L\r\n/* 0.9.6 didn't have X509_STORE_set_flags() */\r\n#define HAVE_X509_STORE_SET_FLAGS 1\r\n#else\r\n#define X509_STORE_set_flags(x,y) Curl_nop_stmt\r\n#endif\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x10000000L\r\n#define HAVE_ERR_REMOVE_THREAD_STATE 1\r\n#endif\r\n\r\n#ifndef HAVE_SSLV2_CLIENT_METHOD\r\n#undef OPENSSL_NO_SSL2 /* undef first to avoid compiler warnings */\r\n#define OPENSSL_NO_SSL2\r\n#endif\r\n\r\n/*\r\n * Number of bytes to read from the random number seed file. This must be\r\n * a finite value (because some entropy \"files\" like /dev/urandom have\r\n * an infinite length), but must be large enough to provide enough\r\n * entopy to properly seed OpenSSL's PRNG.\r\n */\r\n#define RAND_LOAD_LENGTH 1024\r\n\r\n#ifndef HAVE_USERDATA_IN_PWD_CALLBACK\r\nstatic char global_passwd[64];\r\n#endif\r\n\r\nstatic int passwd_callback(char *buf, int num, int encrypting\r\n#ifdef HAVE_USERDATA_IN_PWD_CALLBACK\r\n                           /* This was introduced in 0.9.4, we can set this\r\n                              using SSL_CTX_set_default_passwd_cb_userdata()\r\n                              */\r\n                           , void *global_passwd\r\n#endif\r\n                           )\r\n{\r\n  DEBUGASSERT(0 == encrypting);\r\n\r\n  if(!encrypting) {\r\n    int klen = curlx_uztosi(strlen((char *)global_passwd));\r\n    if(num > klen) {\r\n      memcpy(buf, global_passwd, klen+1);\r\n      return klen;\r\n    }\r\n  }\r\n  return 0;\r\n}\r\n\r\n/*\r\n * rand_enough() is a function that returns TRUE if we have seeded the random\r\n * engine properly. We use some preprocessor magic to provide a seed_enough()\r\n * macro to use, just to prevent a compiler warning on this function if we\r\n * pass in an argument that is never used.\r\n */\r\n\r\n#ifdef HAVE_RAND_STATUS\r\n#define seed_enough(x) rand_enough()\r\nstatic bool rand_enough(void)\r\n{\r\n  return (0 != RAND_status()) ? TRUE : FALSE;\r\n}\r\n#else\r\n#define seed_enough(x) rand_enough(x)\r\nstatic bool rand_enough(int nread)\r\n{\r\n  /* this is a very silly decision to make */\r\n  return (nread > 500) ? TRUE : FALSE;\r\n}\r\n#endif\r\n\r\nstatic int ossl_seed(struct SessionHandle *data)\r\n{\r\n  char *buf = data->state.buffer; /* point to the big buffer */\r\n  int nread=0;\r\n\r\n  /* Q: should we add support for a random file name as a libcurl option?\r\n     A: Yes, it is here */\r\n\r\n#ifndef RANDOM_FILE\r\n  /* if RANDOM_FILE isn't defined, we only perform this if an option tells\r\n     us to! */\r\n  if(data->set.ssl.random_file)\r\n#define RANDOM_FILE \"\" /* doesn't matter won't be used */\r\n#endif\r\n  {\r\n    /* let the option override the define */\r\n    nread += RAND_load_file((data->set.str[STRING_SSL_RANDOM_FILE]?\r\n                             data->set.str[STRING_SSL_RANDOM_FILE]:\r\n                             RANDOM_FILE),\r\n                            RAND_LOAD_LENGTH);\r\n    if(seed_enough(nread))\r\n      return nread;\r\n  }\r\n\r\n#if defined(HAVE_RAND_EGD)\r\n  /* only available in OpenSSL 0.9.5 and later */\r\n  /* EGD_SOCKET is set at configure time or not at all */\r\n#ifndef EGD_SOCKET\r\n  /* If we don't have the define set, we only do this if the egd-option\r\n     is set */\r\n  if(data->set.str[STRING_SSL_EGDSOCKET])\r\n#define EGD_SOCKET \"\" /* doesn't matter won't be used */\r\n#endif\r\n  {\r\n    /* If there's an option and a define, the option overrides the\r\n       define */\r\n    int ret = RAND_egd(data->set.str[STRING_SSL_EGDSOCKET]?\r\n                       data->set.str[STRING_SSL_EGDSOCKET]:EGD_SOCKET);\r\n    if(-1 != ret) {\r\n      nread += ret;\r\n      if(seed_enough(nread))\r\n        return nread;\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* If we get here, it means we need to seed the PRNG using a \"silly\"\r\n     approach! */\r\n  {\r\n    int len;\r\n    char *area;\r\n\r\n    /* Changed call to RAND_seed to use the underlying RAND_add implementation\r\n     * directly.  Do this in a loop, with the amount of additional entropy\r\n     * being dependent upon the algorithm used by Curl_FormBoundary(): N bytes\r\n     * of a 7-bit ascii set. -- Richard Gorton, March 11 2003.\r\n     */\r\n\r\n    do {\r\n      area = Curl_FormBoundary();\r\n      if(!area)\r\n        return 3; /* out of memory */\r\n\r\n      len = curlx_uztosi(strlen(area));\r\n      RAND_add(area, len, (len >> 1));\r\n\r\n      free(area); /* now remove the random junk */\r\n    } while(!RAND_status());\r\n  }\r\n\r\n  /* generates a default path for the random seed file */\r\n  buf[0]=0; /* blank it first */\r\n  RAND_file_name(buf, BUFSIZE);\r\n  if(buf[0]) {\r\n    /* we got a file name to try */\r\n    nread += RAND_load_file(buf, RAND_LOAD_LENGTH);\r\n    if(seed_enough(nread))\r\n      return nread;\r\n  }\r\n\r\n  infof(data, \"libcurl is now using a weak random seed!\\n\");\r\n  return nread;\r\n}\r\n\r\nint Curl_ossl_seed(struct SessionHandle *data)\r\n{\r\n  /* we have the \"SSL is seeded\" boolean static to prevent multiple\r\n     time-consuming seedings in vain */\r\n  static bool ssl_seeded = FALSE;\r\n\r\n  if(!ssl_seeded || data->set.str[STRING_SSL_RANDOM_FILE] ||\r\n     data->set.str[STRING_SSL_EGDSOCKET]) {\r\n    ossl_seed(data);\r\n    ssl_seeded = TRUE;\r\n  }\r\n  return 0;\r\n}\r\n\r\n\r\n#ifndef SSL_FILETYPE_ENGINE\r\n#define SSL_FILETYPE_ENGINE 42\r\n#endif\r\n#ifndef SSL_FILETYPE_PKCS12\r\n#define SSL_FILETYPE_PKCS12 43\r\n#endif\r\nstatic int do_file_type(const char *type)\r\n{\r\n  if(!type || !type[0])\r\n    return SSL_FILETYPE_PEM;\r\n  if(Curl_raw_equal(type, \"PEM\"))\r\n    return SSL_FILETYPE_PEM;\r\n  if(Curl_raw_equal(type, \"DER\"))\r\n    return SSL_FILETYPE_ASN1;\r\n  if(Curl_raw_equal(type, \"ENG\"))\r\n    return SSL_FILETYPE_ENGINE;\r\n  if(Curl_raw_equal(type, \"P12\"))\r\n    return SSL_FILETYPE_PKCS12;\r\n  return -1;\r\n}\r\n\r\nstatic\r\nint cert_stuff(struct connectdata *conn,\r\n               SSL_CTX* ctx,\r\n               char *cert_file,\r\n               const char *cert_type,\r\n               char *key_file,\r\n               const char *key_type)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  int file_type = do_file_type(cert_type);\r\n\r\n  if(cert_file != NULL || file_type == SSL_FILETYPE_ENGINE) {\r\n    SSL *ssl;\r\n    X509 *x509;\r\n    int cert_done = 0;\r\n\r\n    if(data->set.str[STRING_KEY_PASSWD]) {\r\n#ifndef HAVE_USERDATA_IN_PWD_CALLBACK\r\n      /*\r\n       * If password has been given, we store that in the global\r\n       * area (*shudder*) for a while:\r\n       */\r\n      size_t len = strlen(data->set.str[STRING_KEY_PASSWD]);\r\n      if(len < sizeof(global_passwd))\r\n        memcpy(global_passwd, data->set.str[STRING_KEY_PASSWD], len+1);\r\n      else\r\n        global_passwd[0] = '\\0';\r\n#else\r\n      /*\r\n       * We set the password in the callback userdata\r\n       */\r\n      SSL_CTX_set_default_passwd_cb_userdata(ctx,\r\n                                             data->set.str[STRING_KEY_PASSWD]);\r\n#endif\r\n      /* Set passwd callback: */\r\n      SSL_CTX_set_default_passwd_cb(ctx, passwd_callback);\r\n    }\r\n\r\n\r\n#define SSL_CLIENT_CERT_ERR \\\r\n    \"unable to use client certificate (no key found or wrong pass phrase?)\"\r\n\r\n    switch(file_type) {\r\n    case SSL_FILETYPE_PEM:\r\n      /* SSL_CTX_use_certificate_chain_file() only works on PEM files */\r\n      if(SSL_CTX_use_certificate_chain_file(ctx,\r\n                                            cert_file) != 1) {\r\n        failf(data, SSL_CLIENT_CERT_ERR);\r\n        return 0;\r\n      }\r\n      break;\r\n\r\n    case SSL_FILETYPE_ASN1:\r\n      /* SSL_CTX_use_certificate_file() works with either PEM or ASN1, but\r\n         we use the case above for PEM so this can only be performed with\r\n         ASN1 files. */\r\n      if(SSL_CTX_use_certificate_file(ctx,\r\n                                      cert_file,\r\n                                      file_type) != 1) {\r\n        failf(data, SSL_CLIENT_CERT_ERR);\r\n        return 0;\r\n      }\r\n      break;\r\n    case SSL_FILETYPE_ENGINE:\r\n#if defined(HAVE_OPENSSL_ENGINE_H) && defined(ENGINE_CTRL_GET_CMD_FROM_NAME)\r\n      {\r\n        if(data->state.engine) {\r\n          const char *cmd_name = \"LOAD_CERT_CTRL\";\r\n          struct {\r\n            const char *cert_id;\r\n            X509 *cert;\r\n          } params;\r\n\r\n          params.cert_id = cert_file;\r\n          params.cert = NULL;\r\n\r\n          /* Does the engine supports LOAD_CERT_CTRL ? */\r\n          if(!ENGINE_ctrl(data->state.engine, ENGINE_CTRL_GET_CMD_FROM_NAME,\r\n                          0, (void *)cmd_name, NULL)) {\r\n            failf(data, \"ssl engine does not support loading certificates\");\r\n            return 0;\r\n          }\r\n\r\n          /* Load the certificate from the engine */\r\n          if(!ENGINE_ctrl_cmd(data->state.engine, cmd_name,\r\n                              0, &params, NULL, 1)) {\r\n            failf(data, \"ssl engine cannot load client cert with id\"\r\n                  \" '%s' [%s]\", cert_file,\r\n                  ERR_error_string(ERR_get_error(), NULL));\r\n            return 0;\r\n          }\r\n\r\n          if(!params.cert) {\r\n            failf(data, \"ssl engine didn't initialized the certificate \"\r\n                  \"properly.\");\r\n            return 0;\r\n          }\r\n\r\n          if(SSL_CTX_use_certificate(ctx, params.cert) != 1) {\r\n            failf(data, \"unable to set client certificate\");\r\n            X509_free(params.cert);\r\n            return 0;\r\n          }\r\n          X509_free(params.cert); /* we don't need the handle any more... */\r\n        }\r\n        else {\r\n          failf(data, \"crypto engine not set, can't load certificate\");\r\n          return 0;\r\n        }\r\n      }\r\n      break;\r\n#else\r\n      failf(data, \"file type ENG for certificate not implemented\");\r\n      return 0;\r\n#endif\r\n\r\n    case SSL_FILETYPE_PKCS12:\r\n    {\r\n#ifdef HAVE_PKCS12_SUPPORT\r\n      FILE *f;\r\n      PKCS12 *p12;\r\n      EVP_PKEY *pri;\r\n      STACK_OF(X509) *ca = NULL;\r\n      int i;\r\n\r\n      f = fopen(cert_file,\"rb\");\r\n      if(!f) {\r\n        failf(data, \"could not open PKCS12 file '%s'\", cert_file);\r\n        return 0;\r\n      }\r\n      p12 = d2i_PKCS12_fp(f, NULL);\r\n      fclose(f);\r\n\r\n      if(!p12) {\r\n        failf(data, \"error reading PKCS12 file '%s'\", cert_file );\r\n        return 0;\r\n      }\r\n\r\n      PKCS12_PBE_add();\r\n\r\n      if(!PKCS12_parse(p12, data->set.str[STRING_KEY_PASSWD], &pri, &x509,\r\n                        &ca)) {\r\n        failf(data,\r\n              \"could not parse PKCS12 file, check password, OpenSSL error %s\",\r\n              ERR_error_string(ERR_get_error(), NULL) );\r\n        PKCS12_free(p12);\r\n        return 0;\r\n      }\r\n\r\n      PKCS12_free(p12);\r\n\r\n      if(SSL_CTX_use_certificate(ctx, x509) != 1) {\r\n        failf(data, SSL_CLIENT_CERT_ERR);\r\n        EVP_PKEY_free(pri);\r\n        X509_free(x509);\r\n        sk_X509_pop_free(ca, X509_free);\r\n        return 0;\r\n      }\r\n\r\n      if(SSL_CTX_use_PrivateKey(ctx, pri) != 1) {\r\n        failf(data, \"unable to use private key from PKCS12 file '%s'\",\r\n              cert_file);\r\n        EVP_PKEY_free(pri);\r\n        X509_free(x509);\r\n        sk_X509_pop_free(ca, X509_free);\r\n        return 0;\r\n      }\r\n\r\n      if(!SSL_CTX_check_private_key (ctx)) {\r\n        failf(data, \"private key from PKCS12 file '%s' \"\r\n              \"does not match certificate in same file\", cert_file);\r\n        EVP_PKEY_free(pri);\r\n        X509_free(x509);\r\n        sk_X509_pop_free(ca, X509_free);\r\n        return 0;\r\n      }\r\n      /* Set Certificate Verification chain */\r\n      if(ca && sk_X509_num(ca)) {\r\n        for(i = 0; i < sk_X509_num(ca); i++) {\r\n          if(!SSL_CTX_add_extra_chain_cert(ctx,sk_X509_value(ca, i))) {\r\n            failf(data, \"cannot add certificate to certificate chain\");\r\n            EVP_PKEY_free(pri);\r\n            X509_free(x509);\r\n            sk_X509_pop_free(ca, X509_free);\r\n            return 0;\r\n          }\r\n          if(!SSL_CTX_add_client_CA(ctx, sk_X509_value(ca, i))) {\r\n            failf(data, \"cannot add certificate to client CA list\");\r\n            EVP_PKEY_free(pri);\r\n            X509_free(x509);\r\n            sk_X509_pop_free(ca, X509_free);\r\n            return 0;\r\n          }\r\n        }\r\n      }\r\n\r\n      EVP_PKEY_free(pri);\r\n      X509_free(x509);\r\n      sk_X509_pop_free(ca, X509_free);\r\n      cert_done = 1;\r\n      break;\r\n#else\r\n      failf(data, \"file type P12 for certificate not supported\");\r\n      return 0;\r\n#endif\r\n    }\r\n    default:\r\n      failf(data, \"not supported file type '%s' for certificate\", cert_type);\r\n      return 0;\r\n    }\r\n\r\n    file_type = do_file_type(key_type);\r\n\r\n    switch(file_type) {\r\n    case SSL_FILETYPE_PEM:\r\n      if(cert_done)\r\n        break;\r\n      if(key_file == NULL)\r\n        /* cert & key can only be in PEM case in the same file */\r\n        key_file=cert_file;\r\n    case SSL_FILETYPE_ASN1:\r\n      if(SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type) != 1) {\r\n        failf(data, \"unable to set private key file: '%s' type %s\",\r\n              key_file, key_type?key_type:\"PEM\");\r\n        return 0;\r\n      }\r\n      break;\r\n    case SSL_FILETYPE_ENGINE:\r\n#ifdef HAVE_OPENSSL_ENGINE_H\r\n      {                         /* XXXX still needs some work */\r\n        EVP_PKEY *priv_key = NULL;\r\n        if(data->state.engine) {\r\n#ifdef HAVE_ENGINE_LOAD_FOUR_ARGS\r\n          UI_METHOD *ui_method = UI_OpenSSL();\r\n#endif\r\n          /* the typecast below was added to please mingw32 */\r\n          priv_key = (EVP_PKEY *)\r\n            ENGINE_load_private_key(data->state.engine,key_file,\r\n#ifdef HAVE_ENGINE_LOAD_FOUR_ARGS\r\n                                    ui_method,\r\n#endif\r\n                                    data->set.str[STRING_KEY_PASSWD]);\r\n          if(!priv_key) {\r\n            failf(data, \"failed to load private key from crypto engine\");\r\n            return 0;\r\n          }\r\n          if(SSL_CTX_use_PrivateKey(ctx, priv_key) != 1) {\r\n            failf(data, \"unable to set private key\");\r\n            EVP_PKEY_free(priv_key);\r\n            return 0;\r\n          }\r\n          EVP_PKEY_free(priv_key);  /* we don't need the handle any more... */\r\n        }\r\n        else {\r\n          failf(data, \"crypto engine not set, can't load private key\");\r\n          return 0;\r\n        }\r\n      }\r\n      break;\r\n#else\r\n      failf(data, \"file type ENG for private key not supported\");\r\n      return 0;\r\n#endif\r\n    case SSL_FILETYPE_PKCS12:\r\n      if(!cert_done) {\r\n        failf(data, \"file type P12 for private key not supported\");\r\n        return 0;\r\n      }\r\n      break;\r\n    default:\r\n      failf(data, \"not supported file type for private key\");\r\n      return 0;\r\n    }\r\n\r\n    ssl=SSL_new(ctx);\r\n    if(NULL == ssl) {\r\n      failf(data,\"unable to create an SSL structure\");\r\n      return 0;\r\n    }\r\n\r\n    x509=SSL_get_certificate(ssl);\r\n\r\n    /* This version was provided by Evan Jordan and is supposed to not\r\n       leak memory as the previous version: */\r\n    if(x509 != NULL) {\r\n      EVP_PKEY *pktmp = X509_get_pubkey(x509);\r\n      EVP_PKEY_copy_parameters(pktmp,SSL_get_privatekey(ssl));\r\n      EVP_PKEY_free(pktmp);\r\n    }\r\n\r\n    SSL_free(ssl);\r\n\r\n    /* If we are using DSA, we can copy the parameters from\r\n     * the private key */\r\n\r\n\r\n    /* Now we know that a key and cert have been set against\r\n     * the SSL context */\r\n    if(!SSL_CTX_check_private_key(ctx)) {\r\n      failf(data, \"Private key does not match the certificate public key\");\r\n      return 0;\r\n    }\r\n#ifndef HAVE_USERDATA_IN_PWD_CALLBACK\r\n    /* erase it now */\r\n    memset(global_passwd, 0, sizeof(global_passwd));\r\n#endif\r\n  }\r\n  return 1;\r\n}\r\n\r\n/* returns non-zero on failure */\r\nstatic int x509_name_oneline(X509_NAME *a, char *buf, size_t size)\r\n{\r\n#if 0\r\n  return X509_NAME_oneline(a, buf, size);\r\n#else\r\n  BIO *bio_out = BIO_new(BIO_s_mem());\r\n  BUF_MEM *biomem;\r\n  int rc;\r\n\r\n  if(!bio_out)\r\n    return 1; /* alloc failed! */\r\n\r\n  rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_SPLUS_SPC);\r\n  BIO_get_mem_ptr(bio_out, &biomem);\r\n\r\n  if((size_t)biomem->length < size)\r\n    size = biomem->length;\r\n  else\r\n    size--; /* don't overwrite the buffer end */\r\n\r\n  memcpy(buf, biomem->data, size);\r\n  buf[size]=0;\r\n\r\n  BIO_free(bio_out);\r\n\r\n  return !rc;\r\n#endif\r\n}\r\n\r\nstatic\r\nint cert_verify_callback(int ok, X509_STORE_CTX *ctx)\r\n{\r\n  X509 *err_cert;\r\n  char buf[256];\r\n\r\n  err_cert=X509_STORE_CTX_get_current_cert(ctx);\r\n  (void)x509_name_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf));\r\n  return ok;\r\n}\r\n\r\n/* Return error string for last OpenSSL error\r\n */\r\nstatic char *SSL_strerror(unsigned long error, char *buf, size_t size)\r\n{\r\n#ifdef HAVE_ERR_ERROR_STRING_N\r\n  /* OpenSSL 0.9.6 and later has a function named\r\n     ERRO_error_string_n() that takes the size of the buffer as a\r\n     third argument */\r\n  ERR_error_string_n(error, buf, size);\r\n#else\r\n  (void) size;\r\n  ERR_error_string(error, buf);\r\n#endif\r\n  return buf;\r\n}\r\n\r\n#endif /* USE_SSLEAY */\r\n\r\n#ifdef USE_SSLEAY\r\n/**\r\n * Global SSL init\r\n *\r\n * @retval 0 error initializing SSL\r\n * @retval 1 SSL initialized successfully\r\n */\r\nint Curl_ossl_init(void)\r\n{\r\n#ifdef HAVE_ENGINE_LOAD_BUILTIN_ENGINES\r\n  ENGINE_load_builtin_engines();\r\n#endif\r\n\r\n  /* Lets get nice error messages */\r\n  SSL_load_error_strings();\r\n\r\n  /* Init the global ciphers and digests */\r\n  if(!SSLeay_add_ssl_algorithms())\r\n    return 0;\r\n\r\n  OpenSSL_add_all_algorithms();\r\n\r\n  return 1;\r\n}\r\n\r\n#endif /* USE_SSLEAY */\r\n\r\n#ifdef USE_SSLEAY\r\n\r\n/* Global cleanup */\r\nvoid Curl_ossl_cleanup(void)\r\n{\r\n  /* Free ciphers and digests lists */\r\n  EVP_cleanup();\r\n\r\n#ifdef HAVE_ENGINE_CLEANUP\r\n  /* Free engine list */\r\n  ENGINE_cleanup();\r\n#endif\r\n\r\n#ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA\r\n  /* Free OpenSSL ex_data table */\r\n  CRYPTO_cleanup_all_ex_data();\r\n#endif\r\n\r\n  /* Free OpenSSL error strings */\r\n  ERR_free_strings();\r\n\r\n  /* Free thread local error state, destroying hash upon zero refcount */\r\n#ifdef HAVE_ERR_REMOVE_THREAD_STATE\r\n  ERR_remove_thread_state(NULL);\r\n#else\r\n  ERR_remove_state(0);\r\n#endif\r\n}\r\n\r\n/*\r\n * This function uses SSL_peek to determine connection status.\r\n *\r\n * Return codes:\r\n *     1 means the connection is still in place\r\n *     0 means the connection has been closed\r\n *    -1 means the connection status is unknown\r\n */\r\nint Curl_ossl_check_cxn(struct connectdata *conn)\r\n{\r\n  int rc;\r\n  char buf;\r\n\r\n  rc = SSL_peek(conn->ssl[FIRSTSOCKET].handle, (void*)&buf, 1);\r\n  if(rc > 0)\r\n    return 1; /* connection still in place */\r\n\r\n  if(rc == 0)\r\n    return 0; /* connection has been closed */\r\n\r\n  return -1; /* connection status unknown */\r\n}\r\n\r\n/* Selects an OpenSSL crypto engine\r\n */\r\nCURLcode Curl_ossl_set_engine(struct SessionHandle *data, const char *engine)\r\n{\r\n#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)\r\n  ENGINE *e;\r\n\r\n#if OPENSSL_VERSION_NUMBER >= 0x00909000L\r\n  e = ENGINE_by_id(engine);\r\n#else\r\n  /* avoid memory leak */\r\n  for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) {\r\n    const char *e_id = ENGINE_get_id(e);\r\n    if(!strcmp(engine, e_id))\r\n      break;\r\n  }\r\n#endif\r\n\r\n  if(!e) {\r\n    failf(data, \"SSL Engine '%s' not found\", engine);\r\n    return CURLE_SSL_ENGINE_NOTFOUND;\r\n  }\r\n\r\n  if(data->state.engine) {\r\n    ENGINE_finish(data->state.engine);\r\n    ENGINE_free(data->state.engine);\r\n    data->state.engine = NULL;\r\n  }\r\n  if(!ENGINE_init(e)) {\r\n    char buf[256];\r\n\r\n    ENGINE_free(e);\r\n    failf(data, \"Failed to initialise SSL Engine '%s':\\n%s\",\r\n          engine, SSL_strerror(ERR_get_error(), buf, sizeof(buf)));\r\n    return CURLE_SSL_ENGINE_INITFAILED;\r\n  }\r\n  data->state.engine = e;\r\n  return CURLE_OK;\r\n#else\r\n  (void)engine;\r\n  failf(data, \"SSL Engine not supported\");\r\n  return CURLE_SSL_ENGINE_NOTFOUND;\r\n#endif\r\n}\r\n\r\n/* Sets engine as default for all SSL operations\r\n */\r\nCURLcode Curl_ossl_set_engine_default(struct SessionHandle *data)\r\n{\r\n#ifdef HAVE_OPENSSL_ENGINE_H\r\n  if(data->state.engine) {\r\n    if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) {\r\n      infof(data,\"set default crypto engine '%s'\\n\",\r\n            ENGINE_get_id(data->state.engine));\r\n    }\r\n    else {\r\n      failf(data, \"set default crypto engine '%s' failed\",\r\n            ENGINE_get_id(data->state.engine));\r\n      return CURLE_SSL_ENGINE_SETFAILED;\r\n    }\r\n  }\r\n#else\r\n  (void) data;\r\n#endif\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Return list of OpenSSL crypto engine names.\r\n */\r\nstruct curl_slist *Curl_ossl_engines_list(struct SessionHandle *data)\r\n{\r\n  struct curl_slist *list = NULL;\r\n#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)\r\n  struct curl_slist *beg;\r\n  ENGINE *e;\r\n\r\n  for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) {\r\n    beg = curl_slist_append(list, ENGINE_get_id(e));\r\n    if(!beg) {\r\n      curl_slist_free_all(list);\r\n      return NULL;\r\n    }\r\n    list = beg;\r\n  }\r\n#endif\r\n  (void) data;\r\n  return list;\r\n}\r\n\r\n\r\n/*\r\n * This function is called when an SSL connection is closed.\r\n */\r\nvoid Curl_ossl_close(struct connectdata *conn, int sockindex)\r\n{\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  if(connssl->handle) {\r\n    (void)SSL_shutdown(connssl->handle);\r\n    SSL_set_connect_state(connssl->handle);\r\n\r\n    SSL_free (connssl->handle);\r\n    connssl->handle = NULL;\r\n  }\r\n  if(connssl->ctx) {\r\n    SSL_CTX_free (connssl->ctx);\r\n    connssl->ctx = NULL;\r\n  }\r\n}\r\n\r\n/*\r\n * This function is called to shut down the SSL layer but keep the\r\n * socket open (CCC - Clear Command Channel)\r\n */\r\nint Curl_ossl_shutdown(struct connectdata *conn, int sockindex)\r\n{\r\n  int retval = 0;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  struct SessionHandle *data = conn->data;\r\n  char buf[120]; /* We will use this for the OpenSSL error buffer, so it has\r\n                    to be at least 120 bytes long. */\r\n  unsigned long sslerror;\r\n  ssize_t nread;\r\n  int buffsize;\r\n  int err;\r\n  int done = 0;\r\n\r\n  /* This has only been tested on the proftpd server, and the mod_tls code\r\n     sends a close notify alert without waiting for a close notify alert in\r\n     response. Thus we wait for a close notify alert from the server, but\r\n     we do not send one. Let's hope other servers do the same... */\r\n\r\n  if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE)\r\n      (void)SSL_shutdown(connssl->handle);\r\n\r\n  if(connssl->handle) {\r\n    buffsize = (int)sizeof(buf);\r\n    while(!done) {\r\n      int what = Curl_socket_ready(conn->sock[sockindex],\r\n                                   CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);\r\n      if(what > 0) {\r\n        ERR_clear_error();\r\n\r\n        /* Something to read, let's do it and hope that it is the close\r\n           notify alert from the server */\r\n        nread = (ssize_t)SSL_read(conn->ssl[sockindex].handle, buf,\r\n                                  buffsize);\r\n        err = SSL_get_error(conn->ssl[sockindex].handle, (int)nread);\r\n\r\n        switch(err) {\r\n        case SSL_ERROR_NONE: /* this is not an error */\r\n        case SSL_ERROR_ZERO_RETURN: /* no more data */\r\n          /* This is the expected response. There was no data but only\r\n             the close notify alert */\r\n          done = 1;\r\n          break;\r\n        case SSL_ERROR_WANT_READ:\r\n          /* there's data pending, re-invoke SSL_read() */\r\n          infof(data, \"SSL_ERROR_WANT_READ\\n\");\r\n          break;\r\n        case SSL_ERROR_WANT_WRITE:\r\n          /* SSL wants a write. Really odd. Let's bail out. */\r\n          infof(data, \"SSL_ERROR_WANT_WRITE\\n\");\r\n          done = 1;\r\n          break;\r\n        default:\r\n          /* openssl/ssl.h says \"look at error stack/return value/errno\" */\r\n          sslerror = ERR_get_error();\r\n          failf(conn->data, \"SSL read: %s, errno %d\",\r\n                ERR_error_string(sslerror, buf),\r\n                SOCKERRNO);\r\n          done = 1;\r\n          break;\r\n        }\r\n      }\r\n      else if(0 == what) {\r\n        /* timeout */\r\n        failf(data, \"SSL shutdown timeout\");\r\n        done = 1;\r\n      }\r\n      else {\r\n        /* anything that gets here is fatally bad */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        retval = -1;\r\n        done = 1;\r\n      }\r\n    } /* while()-loop for the select() */\r\n\r\n    if(data->set.verbose) {\r\n#ifdef HAVE_SSL_GET_SHUTDOWN\r\n      switch(SSL_get_shutdown(connssl->handle)) {\r\n      case SSL_SENT_SHUTDOWN:\r\n        infof(data, \"SSL_get_shutdown() returned SSL_SENT_SHUTDOWN\\n\");\r\n        break;\r\n      case SSL_RECEIVED_SHUTDOWN:\r\n        infof(data, \"SSL_get_shutdown() returned SSL_RECEIVED_SHUTDOWN\\n\");\r\n        break;\r\n      case SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN:\r\n        infof(data, \"SSL_get_shutdown() returned SSL_SENT_SHUTDOWN|\"\r\n              \"SSL_RECEIVED__SHUTDOWN\\n\");\r\n        break;\r\n      }\r\n#endif\r\n    }\r\n\r\n    SSL_free (connssl->handle);\r\n    connssl->handle = NULL;\r\n  }\r\n  return retval;\r\n}\r\n\r\nvoid Curl_ossl_session_free(void *ptr)\r\n{\r\n  /* free the ID */\r\n  SSL_SESSION_free(ptr);\r\n}\r\n\r\n/*\r\n * This function is called when the 'data' struct is going away. Close\r\n * down everything and free all resources!\r\n */\r\nint Curl_ossl_close_all(struct SessionHandle *data)\r\n{\r\n#ifdef HAVE_OPENSSL_ENGINE_H\r\n  if(data->state.engine) {\r\n    ENGINE_finish(data->state.engine);\r\n    ENGINE_free(data->state.engine);\r\n    data->state.engine = NULL;\r\n  }\r\n#else\r\n  (void)data;\r\n#endif\r\n  return 0;\r\n}\r\n\r\nstatic int asn1_output(const ASN1_UTCTIME *tm,\r\n                       char *buf,\r\n                       size_t sizeofbuf)\r\n{\r\n  const char *asn1_string;\r\n  int gmt=FALSE;\r\n  int i;\r\n  int year=0,month=0,day=0,hour=0,minute=0,second=0;\r\n\r\n  i=tm->length;\r\n  asn1_string=(const char *)tm->data;\r\n\r\n  if(i < 10)\r\n    return 1;\r\n  if(asn1_string[i-1] == 'Z')\r\n    gmt=TRUE;\r\n  for(i=0; i<10; i++)\r\n    if((asn1_string[i] > '9') || (asn1_string[i] < '0'))\r\n      return 2;\r\n\r\n  year= (asn1_string[0]-'0')*10+(asn1_string[1]-'0');\r\n  if(year < 50)\r\n    year+=100;\r\n\r\n  month= (asn1_string[2]-'0')*10+(asn1_string[3]-'0');\r\n  if((month > 12) || (month < 1))\r\n    return 3;\r\n\r\n  day= (asn1_string[4]-'0')*10+(asn1_string[5]-'0');\r\n  hour= (asn1_string[6]-'0')*10+(asn1_string[7]-'0');\r\n  minute=  (asn1_string[8]-'0')*10+(asn1_string[9]-'0');\r\n\r\n  if((asn1_string[10] >= '0') && (asn1_string[10] <= '9') &&\r\n     (asn1_string[11] >= '0') && (asn1_string[11] <= '9'))\r\n    second= (asn1_string[10]-'0')*10+(asn1_string[11]-'0');\r\n\r\n  snprintf(buf, sizeofbuf,\r\n           \"%04d-%02d-%02d %02d:%02d:%02d %s\",\r\n           year+1900, month, day, hour, minute, second, (gmt?\"GMT\":\"\"));\r\n\r\n  return 0;\r\n}\r\n\r\n/* ====================================================== */\r\n\r\n\r\n/* Quote from RFC2818 section 3.1 \"Server Identity\"\r\n\r\n   If a subjectAltName extension of type dNSName is present, that MUST\r\n   be used as the identity. Otherwise, the (most specific) Common Name\r\n   field in the Subject field of the certificate MUST be used. Although\r\n   the use of the Common Name is existing practice, it is deprecated and\r\n   Certification Authorities are encouraged to use the dNSName instead.\r\n\r\n   Matching is performed using the matching rules specified by\r\n   [RFC2459].  If more than one identity of a given type is present in\r\n   the certificate (e.g., more than one dNSName name, a match in any one\r\n   of the set is considered acceptable.) Names may contain the wildcard\r\n   character * which is considered to match any single domain name\r\n   component or component fragment. E.g., *.a.com matches foo.a.com but\r\n   not bar.foo.a.com. f*.com matches foo.com but not bar.com.\r\n\r\n   In some cases, the URI is specified as an IP address rather than a\r\n   hostname. In this case, the iPAddress subjectAltName must be present\r\n   in the certificate and must exactly match the IP in the URI.\r\n\r\n*/\r\nstatic CURLcode verifyhost(struct connectdata *conn,\r\n                           X509 *server_cert)\r\n{\r\n  int matched = -1; /* -1 is no alternative match yet, 1 means match and 0\r\n                       means mismatch */\r\n  int target = GEN_DNS; /* target type, GEN_DNS or GEN_IPADD */\r\n  size_t addrlen = 0;\r\n  struct SessionHandle *data = conn->data;\r\n  STACK_OF(GENERAL_NAME) *altnames;\r\n#ifdef ENABLE_IPV6\r\n  struct in6_addr addr;\r\n#else\r\n  struct in_addr addr;\r\n#endif\r\n  CURLcode res = CURLE_OK;\r\n\r\n#ifdef ENABLE_IPV6\r\n  if(conn->bits.ipv6_ip &&\r\n     Curl_inet_pton(AF_INET6, conn->host.name, &addr)) {\r\n    target = GEN_IPADD;\r\n    addrlen = sizeof(struct in6_addr);\r\n  }\r\n  else\r\n#endif\r\n    if(Curl_inet_pton(AF_INET, conn->host.name, &addr)) {\r\n      target = GEN_IPADD;\r\n      addrlen = sizeof(struct in_addr);\r\n    }\r\n\r\n  /* get a \"list\" of alternative names */\r\n  altnames = X509_get_ext_d2i(server_cert, NID_subject_alt_name, NULL, NULL);\r\n\r\n  if(altnames) {\r\n    int numalts;\r\n    int i;\r\n\r\n    /* get amount of alternatives, RFC2459 claims there MUST be at least\r\n       one, but we don't depend on it... */\r\n    numalts = sk_GENERAL_NAME_num(altnames);\r\n\r\n    /* loop through all alternatives while none has matched */\r\n    for(i=0; (i<numalts) && (matched != 1); i++) {\r\n      /* get a handle to alternative name number i */\r\n      const GENERAL_NAME *check = sk_GENERAL_NAME_value(altnames, i);\r\n\r\n      /* only check alternatives of the same type the target is */\r\n      if(check->type == target) {\r\n        /* get data and length */\r\n        const char *altptr = (char *)ASN1_STRING_data(check->d.ia5);\r\n        size_t altlen = (size_t) ASN1_STRING_length(check->d.ia5);\r\n\r\n        switch(target) {\r\n        case GEN_DNS: /* name/pattern comparison */\r\n          /* The OpenSSL man page explicitly says: \"In general it cannot be\r\n             assumed that the data returned by ASN1_STRING_data() is null\r\n             terminated or does not contain embedded nulls.\" But also that\r\n             \"The actual format of the data will depend on the actual string\r\n             type itself: for example for and IA5String the data will be ASCII\"\r\n\r\n             Gisle researched the OpenSSL sources:\r\n             \"I checked the 0.9.6 and 0.9.8 sources before my patch and\r\n             it always 0-terminates an IA5String.\"\r\n          */\r\n          if((altlen == strlen(altptr)) &&\r\n             /* if this isn't true, there was an embedded zero in the name\r\n                string and we cannot match it. */\r\n             Curl_cert_hostcheck(altptr, conn->host.name))\r\n            matched = 1;\r\n          else\r\n            matched = 0;\r\n          break;\r\n\r\n        case GEN_IPADD: /* IP address comparison */\r\n          /* compare alternative IP address if the data chunk is the same size\r\n             our server IP address is */\r\n          if((altlen == addrlen) && !memcmp(altptr, &addr, altlen))\r\n            matched = 1;\r\n          else\r\n            matched = 0;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n    GENERAL_NAMES_free(altnames);\r\n  }\r\n\r\n  if(matched == 1)\r\n    /* an alternative name matched the server hostname */\r\n    infof(data, \"\\t subjectAltName: %s matched\\n\", conn->host.dispname);\r\n  else if(matched == 0) {\r\n    /* an alternative name field existed, but didn't match and then\r\n       we MUST fail */\r\n    infof(data, \"\\t subjectAltName does not match %s\\n\", conn->host.dispname);\r\n    res = CURLE_PEER_FAILED_VERIFICATION;\r\n  }\r\n  else {\r\n    /* we have to look to the last occurrence of a commonName in the\r\n       distinguished one to get the most significant one. */\r\n    int j,i=-1 ;\r\n\r\n/* The following is done because of a bug in 0.9.6b */\r\n\r\n    unsigned char *nulstr = (unsigned char *)\"\";\r\n    unsigned char *peer_CN = nulstr;\r\n\r\n    X509_NAME *name = X509_get_subject_name(server_cert) ;\r\n    if(name)\r\n      while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i))>=0)\r\n        i=j;\r\n\r\n    /* we have the name entry and we will now convert this to a string\r\n       that we can use for comparison. Doing this we support BMPstring,\r\n       UTF8 etc. */\r\n\r\n    if(i>=0) {\r\n      ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name,i));\r\n\r\n      /* In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input\r\n         is already UTF-8 encoded. We check for this case and copy the raw\r\n         string manually to avoid the problem. This code can be made\r\n         conditional in the future when OpenSSL has been fixed. Work-around\r\n         brought by Alexis S. L. Carvalho. */\r\n      if(tmp) {\r\n        if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) {\r\n          j = ASN1_STRING_length(tmp);\r\n          if(j >= 0) {\r\n            peer_CN = OPENSSL_malloc(j+1);\r\n            if(peer_CN) {\r\n              memcpy(peer_CN, ASN1_STRING_data(tmp), j);\r\n              peer_CN[j] = '\\0';\r\n            }\r\n          }\r\n        }\r\n        else /* not a UTF8 name */\r\n          j = ASN1_STRING_to_UTF8(&peer_CN, tmp);\r\n\r\n        if(peer_CN && (curlx_uztosi(strlen((char *)peer_CN)) != j)) {\r\n          /* there was a terminating zero before the end of string, this\r\n             cannot match and we return failure! */\r\n          failf(data, \"SSL: illegal cert name field\");\r\n          res = CURLE_PEER_FAILED_VERIFICATION;\r\n        }\r\n      }\r\n    }\r\n\r\n    if(peer_CN == nulstr)\r\n       peer_CN = NULL;\r\n    else {\r\n      /* convert peer_CN from UTF8 */\r\n      CURLcode rc = Curl_convert_from_utf8(data, peer_CN, strlen(peer_CN));\r\n      /* Curl_convert_from_utf8 calls failf if unsuccessful */\r\n      if(rc) {\r\n        OPENSSL_free(peer_CN);\r\n        return rc;\r\n      }\r\n    }\r\n\r\n    if(res)\r\n      /* error already detected, pass through */\r\n      ;\r\n    else if(!peer_CN) {\r\n      failf(data,\r\n            \"SSL: unable to obtain common name from peer certificate\");\r\n      res = CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n    else if(!Curl_cert_hostcheck((const char *)peer_CN, conn->host.name)) {\r\n      failf(data, \"SSL: certificate subject name '%s' does not match \"\r\n            \"target host name '%s'\", peer_CN, conn->host.dispname);\r\n      res = CURLE_PEER_FAILED_VERIFICATION;\r\n    }\r\n    else {\r\n      infof(data, \"\\t common name: %s (matched)\\n\", peer_CN);\r\n    }\r\n    if(peer_CN)\r\n      OPENSSL_free(peer_CN);\r\n  }\r\n  return res;\r\n}\r\n#endif /* USE_SSLEAY */\r\n\r\n/* The SSL_CTRL_SET_MSG_CALLBACK doesn't exist in ancient OpenSSL versions\r\n   and thus this cannot be done there. */\r\n#ifdef SSL_CTRL_SET_MSG_CALLBACK\r\n\r\nstatic const char *ssl_msg_type(int ssl_ver, int msg)\r\n{\r\n  if(ssl_ver == SSL2_VERSION_MAJOR) {\r\n    switch (msg) {\r\n      case SSL2_MT_ERROR:\r\n        return \"Error\";\r\n      case SSL2_MT_CLIENT_HELLO:\r\n        return \"Client hello\";\r\n      case SSL2_MT_CLIENT_MASTER_KEY:\r\n        return \"Client key\";\r\n      case SSL2_MT_CLIENT_FINISHED:\r\n        return \"Client finished\";\r\n      case SSL2_MT_SERVER_HELLO:\r\n        return \"Server hello\";\r\n      case SSL2_MT_SERVER_VERIFY:\r\n        return \"Server verify\";\r\n      case SSL2_MT_SERVER_FINISHED:\r\n        return \"Server finished\";\r\n      case SSL2_MT_REQUEST_CERTIFICATE:\r\n        return \"Request CERT\";\r\n      case SSL2_MT_CLIENT_CERTIFICATE:\r\n        return \"Client CERT\";\r\n    }\r\n  }\r\n  else if(ssl_ver == SSL3_VERSION_MAJOR) {\r\n    switch (msg) {\r\n      case SSL3_MT_HELLO_REQUEST:\r\n        return \"Hello request\";\r\n      case SSL3_MT_CLIENT_HELLO:\r\n        return \"Client hello\";\r\n      case SSL3_MT_SERVER_HELLO:\r\n        return \"Server hello\";\r\n      case SSL3_MT_CERTIFICATE:\r\n        return \"CERT\";\r\n      case SSL3_MT_SERVER_KEY_EXCHANGE:\r\n        return \"Server key exchange\";\r\n      case SSL3_MT_CLIENT_KEY_EXCHANGE:\r\n        return \"Client key exchange\";\r\n      case SSL3_MT_CERTIFICATE_REQUEST:\r\n        return \"Request CERT\";\r\n      case SSL3_MT_SERVER_DONE:\r\n        return \"Server finished\";\r\n      case SSL3_MT_CERTIFICATE_VERIFY:\r\n        return \"CERT verify\";\r\n      case SSL3_MT_FINISHED:\r\n        return \"Finished\";\r\n    }\r\n  }\r\n  return \"Unknown\";\r\n}\r\n\r\nstatic const char *tls_rt_type(int type)\r\n{\r\n  return (\r\n    type == SSL3_RT_CHANGE_CIPHER_SPEC ? \"TLS change cipher, \" :\r\n    type == SSL3_RT_ALERT              ? \"TLS alert, \"         :\r\n    type == SSL3_RT_HANDSHAKE          ? \"TLS handshake, \"     :\r\n    type == SSL3_RT_APPLICATION_DATA   ? \"TLS app data, \"      :\r\n                                         \"TLS Unknown, \");\r\n}\r\n\r\n\r\n/*\r\n * Our callback from the SSL/TLS layers.\r\n */\r\nstatic void ssl_tls_trace(int direction, int ssl_ver, int content_type,\r\n                          const void *buf, size_t len, const SSL *ssl,\r\n                          struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data;\r\n  const char *msg_name, *tls_rt_name;\r\n  char ssl_buf[1024];\r\n  int  ver, msg_type, txt_len;\r\n\r\n  if(!conn || !conn->data || !conn->data->set.fdebug ||\r\n     (direction != 0 && direction != 1))\r\n    return;\r\n\r\n  data = conn->data;\r\n  ssl_ver >>= 8;\r\n  ver = (ssl_ver == SSL2_VERSION_MAJOR ? '2' :\r\n         ssl_ver == SSL3_VERSION_MAJOR ? '3' : '?');\r\n\r\n  /* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL\r\n   * always pass-up content-type as 0. But the interesting message-type\r\n   * is at 'buf[0]'.\r\n   */\r\n  if(ssl_ver == SSL3_VERSION_MAJOR && content_type != 0)\r\n    tls_rt_name = tls_rt_type(content_type);\r\n  else\r\n    tls_rt_name = \"\";\r\n\r\n  msg_type = *(char*)buf;\r\n  msg_name = ssl_msg_type(ssl_ver, msg_type);\r\n\r\n  txt_len = snprintf(ssl_buf, sizeof(ssl_buf), \"SSLv%c, %s%s (%d):\\n\",\r\n                     ver, tls_rt_name, msg_name, msg_type);\r\n  Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len, NULL);\r\n\r\n  Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT :\r\n             CURLINFO_SSL_DATA_IN, (char *)buf, len, NULL);\r\n  (void) ssl;\r\n}\r\n#endif\r\n\r\n#ifdef USE_SSLEAY\r\n/* ====================================================== */\r\n\r\n#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME\r\n#  define use_sni(x)  sni = (x)\r\n#else\r\n#  define use_sni(x)  Curl_nop_stmt\r\n#endif\r\n\r\nstatic CURLcode\r\nossl_connect_step1(struct connectdata *conn,\r\n                   int sockindex)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n\r\n  struct SessionHandle *data = conn->data;\r\n  SSL_METHOD_QUAL SSL_METHOD *req_method=NULL;\r\n  void *ssl_sessionid=NULL;\r\n  X509_LOOKUP *lookup=NULL;\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  long ctx_options;\r\n#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME\r\n  bool sni;\r\n#ifdef ENABLE_IPV6\r\n  struct in6_addr addr;\r\n#else\r\n  struct in_addr addr;\r\n#endif\r\n#endif\r\n\r\n  DEBUGASSERT(ssl_connect_1 == connssl->connecting_state);\r\n\r\n  /* Make funny stuff to get random input */\r\n  Curl_ossl_seed(data);\r\n\r\n  /* check to see if we've been told to use an explicit SSL/TLS version */\r\n\r\n  switch(data->set.ssl.version) {\r\n  default:\r\n  case CURL_SSLVERSION_DEFAULT:\r\n#ifdef USE_TLS_SRP\r\n    if(data->set.ssl.authtype == CURL_TLSAUTH_SRP) {\r\n      infof(data, \"Set version TLSv1 for SRP authorisation\\n\");\r\n      req_method = TLSv1_client_method() ;\r\n    }\r\n    else\r\n#endif\r\n    /* we try to figure out version */\r\n    req_method = SSLv23_client_method();\r\n    use_sni(TRUE);\r\n    break;\r\n  case CURL_SSLVERSION_TLSv1:\r\n    req_method = TLSv1_client_method();\r\n    use_sni(TRUE);\r\n    break;\r\n  case CURL_SSLVERSION_SSLv2:\r\n#ifdef OPENSSL_NO_SSL2\r\n    failf(data, \"OpenSSL was built without SSLv2 support\");\r\n    return CURLE_NOT_BUILT_IN;\r\n#else\r\n#ifdef USE_TLS_SRP\r\n    if(data->set.ssl.authtype == CURL_TLSAUTH_SRP)\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n#endif\r\n    req_method = SSLv2_client_method();\r\n    use_sni(FALSE);\r\n    break;\r\n#endif\r\n  case CURL_SSLVERSION_SSLv3:\r\n#ifdef USE_TLS_SRP\r\n    if(data->set.ssl.authtype == CURL_TLSAUTH_SRP)\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n#endif\r\n    req_method = SSLv3_client_method();\r\n    use_sni(FALSE);\r\n    break;\r\n  }\r\n\r\n  if(connssl->ctx)\r\n    SSL_CTX_free(connssl->ctx);\r\n  connssl->ctx = SSL_CTX_new(req_method);\r\n\r\n  if(!connssl->ctx) {\r\n    failf(data, \"SSL: couldn't create a context: %s\",\r\n          ERR_error_string(ERR_peek_error(), NULL));\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n#ifdef SSL_MODE_RELEASE_BUFFERS\r\n  SSL_CTX_set_mode(connssl->ctx, SSL_MODE_RELEASE_BUFFERS);\r\n#endif\r\n\r\n#ifdef SSL_CTRL_SET_MSG_CALLBACK\r\n  if(data->set.fdebug && data->set.verbose) {\r\n    /* the SSL trace callback is only used for verbose logging so we only\r\n       inform about failures of setting it */\r\n    if(!SSL_CTX_callback_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK,\r\n                               (void (*)(void))ssl_tls_trace)) {\r\n      infof(data, \"SSL: couldn't set callback!\\n\");\r\n    }\r\n    else if(!SSL_CTX_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK_ARG, 0,\r\n                          conn)) {\r\n      infof(data, \"SSL: couldn't set callback argument!\\n\");\r\n    }\r\n  }\r\n#endif\r\n\r\n  /* OpenSSL contains code to work-around lots of bugs and flaws in various\r\n     SSL-implementations. SSL_CTX_set_options() is used to enabled those\r\n     work-arounds. The man page for this option states that SSL_OP_ALL enables\r\n     all the work-arounds and that \"It is usually safe to use SSL_OP_ALL to\r\n     enable the bug workaround options if compatibility with somewhat broken\r\n     implementations is desired.\"\r\n\r\n     The \"-no_ticket\" option was introduced in Openssl0.9.8j. It's a flag to\r\n     disable \"rfc4507bis session ticket support\".  rfc4507bis was later turned\r\n     into the proper RFC5077 it seems: http://tools.ietf.org/html/rfc5077\r\n\r\n     The enabled extension concerns the session management. I wonder how often\r\n     libcurl stops a connection and then resumes a TLS session. also, sending\r\n     the session data is some overhead. .I suggest that you just use your\r\n     proposed patch (which explicitly disables TICKET).\r\n\r\n     If someone writes an application with libcurl and openssl who wants to\r\n     enable the feature, one can do this in the SSL callback.\r\n\r\n     SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG option enabling allowed proper\r\n     interoperability with web server Netscape Enterprise Server 2.0.1 which\r\n     was released back in 1996.\r\n\r\n     Due to CVE-2010-4180, option SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG has\r\n     become ineffective as of OpenSSL 0.9.8q and 1.0.0c. In order to mitigate\r\n     CVE-2010-4180 when using previous OpenSSL versions we no longer enable\r\n     this option regardless of OpenSSL version and SSL_OP_ALL definition.\r\n\r\n     OpenSSL added a work-around for a SSL 3.0/TLS 1.0 CBC vulnerability\r\n     (http://www.openssl.org/~bodo/tls-cbc.txt). In 0.9.6e they added a bit to\r\n     SSL_OP_ALL that _disables_ that work-around despite the fact that\r\n     SSL_OP_ALL is documented to do \"rather harmless\" workarounds. In order to\r\n     keep the secure work-around, the SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS bit\r\n     must not be set.\r\n  */\r\n\r\n  ctx_options = SSL_OP_ALL;\r\n\r\n#ifdef SSL_OP_NO_TICKET\r\n  ctx_options |= SSL_OP_NO_TICKET;\r\n#endif\r\n\r\n#ifdef SSL_OP_NO_COMPRESSION\r\n  ctx_options |= SSL_OP_NO_COMPRESSION;\r\n#endif\r\n\r\n#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG\r\n  /* mitigate CVE-2010-4180 */\r\n  ctx_options &= ~SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG;\r\n#endif\r\n\r\n#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS\r\n  /* unless the user explicitly ask to allow the protocol vulnerability we\r\n     use the work-around */\r\n  if(!conn->data->set.ssl_enable_beast)\r\n    ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;\r\n#endif\r\n\r\n  /* disable SSLv2 in the default case (i.e. allow SSLv3 and TLSv1) */\r\n  if(data->set.ssl.version == CURL_SSLVERSION_DEFAULT)\r\n    ctx_options |= SSL_OP_NO_SSLv2;\r\n\r\n  SSL_CTX_set_options(connssl->ctx, ctx_options);\r\n\r\n  if(data->set.str[STRING_CERT] || data->set.str[STRING_CERT_TYPE]) {\r\n    if(!cert_stuff(conn,\r\n                   connssl->ctx,\r\n                   data->set.str[STRING_CERT],\r\n                   data->set.str[STRING_CERT_TYPE],\r\n                   data->set.str[STRING_KEY],\r\n                   data->set.str[STRING_KEY_TYPE])) {\r\n      /* failf() is already done in cert_stuff() */\r\n      return CURLE_SSL_CERTPROBLEM;\r\n    }\r\n  }\r\n\r\n  if(data->set.str[STRING_SSL_CIPHER_LIST]) {\r\n    if(!SSL_CTX_set_cipher_list(connssl->ctx,\r\n                                data->set.str[STRING_SSL_CIPHER_LIST])) {\r\n      failf(data, \"failed setting cipher list\");\r\n      return CURLE_SSL_CIPHER;\r\n    }\r\n  }\r\n\r\n#ifdef USE_TLS_SRP\r\n  if(data->set.ssl.authtype == CURL_TLSAUTH_SRP) {\r\n    infof(data, \"Using TLS-SRP username: %s\\n\", data->set.ssl.username);\r\n\r\n    if(!SSL_CTX_set_srp_username(connssl->ctx, data->set.ssl.username)) {\r\n      failf(data, \"Unable to set SRP user name\");\r\n      return CURLE_BAD_FUNCTION_ARGUMENT;\r\n    }\r\n    if(!SSL_CTX_set_srp_password(connssl->ctx,data->set.ssl.password)) {\r\n      failf(data, \"failed setting SRP password\");\r\n      return CURLE_BAD_FUNCTION_ARGUMENT;\r\n    }\r\n    if(!data->set.str[STRING_SSL_CIPHER_LIST]) {\r\n      infof(data, \"Setting cipher list SRP\\n\");\r\n\r\n      if(!SSL_CTX_set_cipher_list(connssl->ctx, \"SRP\")) {\r\n        failf(data, \"failed setting SRP cipher list\");\r\n        return CURLE_SSL_CIPHER;\r\n      }\r\n    }\r\n  }\r\n#endif\r\n  if(data->set.str[STRING_SSL_CAFILE] || data->set.str[STRING_SSL_CAPATH]) {\r\n    /* tell SSL where to find CA certificates that are used to verify\r\n       the servers certificate. */\r\n    if(!SSL_CTX_load_verify_locations(connssl->ctx,\r\n                                       data->set.str[STRING_SSL_CAFILE],\r\n                                       data->set.str[STRING_SSL_CAPATH])) {\r\n      if(data->set.ssl.verifypeer) {\r\n        /* Fail if we insist on successfully verifying the server. */\r\n        failf(data,\"error setting certificate verify locations:\\n\"\r\n              \"  CAfile: %s\\n  CApath: %s\",\r\n              data->set.str[STRING_SSL_CAFILE]?\r\n              data->set.str[STRING_SSL_CAFILE]: \"none\",\r\n              data->set.str[STRING_SSL_CAPATH]?\r\n              data->set.str[STRING_SSL_CAPATH] : \"none\");\r\n        return CURLE_SSL_CACERT_BADFILE;\r\n      }\r\n      else {\r\n        /* Just continue with a warning if no strict  certificate verification\r\n           is required. */\r\n        infof(data, \"error setting certificate verify locations,\"\r\n              \" continuing anyway:\\n\");\r\n      }\r\n    }\r\n    else {\r\n      /* Everything is fine. */\r\n      infof(data, \"successfully set certificate verify locations:\\n\");\r\n    }\r\n    infof(data,\r\n          \"  CAfile: %s\\n\"\r\n          \"  CApath: %s\\n\",\r\n          data->set.str[STRING_SSL_CAFILE] ? data->set.str[STRING_SSL_CAFILE]:\r\n          \"none\",\r\n          data->set.str[STRING_SSL_CAPATH] ? data->set.str[STRING_SSL_CAPATH]:\r\n          \"none\");\r\n  }\r\n\r\n  if(data->set.str[STRING_SSL_CRLFILE]) {\r\n    /* tell SSL where to find CRL file that is used to check certificate\r\n     * revocation */\r\n    lookup=X509_STORE_add_lookup(SSL_CTX_get_cert_store(connssl->ctx),\r\n                                 X509_LOOKUP_file());\r\n    if(!lookup ||\r\n       (!X509_load_crl_file(lookup,data->set.str[STRING_SSL_CRLFILE],\r\n                            X509_FILETYPE_PEM)) ) {\r\n      failf(data,\"error loading CRL file: %s\",\r\n            data->set.str[STRING_SSL_CRLFILE]);\r\n      return CURLE_SSL_CRL_BADFILE;\r\n    }\r\n    else {\r\n      /* Everything is fine. */\r\n      infof(data, \"successfully load CRL file:\\n\");\r\n      X509_STORE_set_flags(SSL_CTX_get_cert_store(connssl->ctx),\r\n                           X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);\r\n    }\r\n    infof(data,\r\n          \"  CRLfile: %s\\n\", data->set.str[STRING_SSL_CRLFILE] ?\r\n          data->set.str[STRING_SSL_CRLFILE]: \"none\");\r\n  }\r\n\r\n  /* SSL always tries to verify the peer, this only says whether it should\r\n   * fail to connect if the verification fails, or if it should continue\r\n   * anyway. In the latter case the result of the verification is checked with\r\n   * SSL_get_verify_result() below. */\r\n  SSL_CTX_set_verify(connssl->ctx,\r\n                     data->set.ssl.verifypeer?SSL_VERIFY_PEER:SSL_VERIFY_NONE,\r\n                     cert_verify_callback);\r\n\r\n  /* give application a chance to interfere with SSL set up. */\r\n  if(data->set.ssl.fsslctx) {\r\n    retcode = (*data->set.ssl.fsslctx)(data, connssl->ctx,\r\n                                       data->set.ssl.fsslctxp);\r\n    if(retcode) {\r\n      failf(data,\"error signaled by ssl ctx callback\");\r\n      return retcode;\r\n    }\r\n  }\r\n\r\n  /* Lets make an SSL structure */\r\n  if(connssl->handle)\r\n    SSL_free(connssl->handle);\r\n  connssl->handle = SSL_new(connssl->ctx);\r\n  if(!connssl->handle) {\r\n    failf(data, \"SSL: couldn't create a context (handle)!\");\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  SSL_set_connect_state(connssl->handle);\r\n\r\n  connssl->server_cert = 0x0;\r\n\r\n#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME\r\n  if((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) &&\r\n#ifdef ENABLE_IPV6\r\n     (0 == Curl_inet_pton(AF_INET6, conn->host.name, &addr)) &&\r\n#endif\r\n     sni &&\r\n     !SSL_set_tlsext_host_name(connssl->handle, conn->host.name))\r\n    infof(data, \"WARNING: failed to configure server name indication (SNI) \"\r\n          \"TLS extension\\n\");\r\n#endif\r\n\r\n  /* Check if there's a cached ID we can/should use here! */\r\n  if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL)) {\r\n    /* we got a session id, use it! */\r\n    if(!SSL_set_session(connssl->handle, ssl_sessionid)) {\r\n      failf(data, \"SSL: SSL_set_session failed: %s\",\r\n            ERR_error_string(ERR_get_error(),NULL));\r\n      return CURLE_SSL_CONNECT_ERROR;\r\n    }\r\n    /* Informational message */\r\n    infof (data, \"SSL re-using session ID\\n\");\r\n  }\r\n\r\n  /* pass the raw socket into the SSL layers */\r\n  if(!SSL_set_fd(connssl->handle, (int)sockfd)) {\r\n    failf(data, \"SSL: SSL_set_fd failed: %s\",\r\n          ERR_error_string(ERR_get_error(),NULL));\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n\r\n  connssl->connecting_state = ssl_connect_2;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode\r\nossl_connect_step2(struct connectdata *conn, int sockindex)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  int err;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n\r\n  DEBUGASSERT(ssl_connect_2 == connssl->connecting_state\r\n             || ssl_connect_2_reading == connssl->connecting_state\r\n             || ssl_connect_2_writing == connssl->connecting_state);\r\n\r\n  ERR_clear_error();\r\n\r\n  err = SSL_connect(connssl->handle);\r\n\r\n  /* 1  is fine\r\n     0  is \"not successful but was shut down controlled\"\r\n     <0 is \"handshake was not successful, because a fatal error occurred\" */\r\n  if(1 != err) {\r\n    int detail = SSL_get_error(connssl->handle, err);\r\n\r\n    if(SSL_ERROR_WANT_READ == detail) {\r\n      connssl->connecting_state = ssl_connect_2_reading;\r\n      return CURLE_OK;\r\n    }\r\n    else if(SSL_ERROR_WANT_WRITE == detail) {\r\n      connssl->connecting_state = ssl_connect_2_writing;\r\n      return CURLE_OK;\r\n    }\r\n    else {\r\n      /* untreated error */\r\n      unsigned long errdetail;\r\n      char error_buffer[256]; /* OpenSSL documents that this must be at least\r\n                                 256 bytes long. */\r\n      CURLcode rc;\r\n      const char *cert_problem = NULL;\r\n      long lerr;\r\n\r\n      connssl->connecting_state = ssl_connect_2; /* the connection failed,\r\n                                                    we're not waiting for\r\n                                                    anything else. */\r\n\r\n      errdetail = ERR_get_error(); /* Gets the earliest error code from the\r\n                                      thread's error queue and removes the\r\n                                      entry. */\r\n\r\n      switch(errdetail) {\r\n      case 0x1407E086:\r\n        /* 1407E086:\r\n           SSL routines:\r\n           SSL2_SET_CERTIFICATE:\r\n           certificate verify failed */\r\n        /* fall-through */\r\n      case 0x14090086:\r\n        /* 14090086:\r\n           SSL routines:\r\n           SSL3_GET_SERVER_CERTIFICATE:\r\n           certificate verify failed */\r\n        rc = CURLE_SSL_CACERT;\r\n\r\n        lerr = SSL_get_verify_result(connssl->handle);\r\n        if(lerr != X509_V_OK) {\r\n          snprintf(error_buffer, sizeof(error_buffer),\r\n                   \"SSL certificate problem: %s\",\r\n                   X509_verify_cert_error_string(lerr));\r\n        }\r\n        else\r\n          cert_problem = \"SSL certificate problem, verify that the CA cert is\"\r\n            \" OK.\";\r\n\r\n        break;\r\n      default:\r\n        rc = CURLE_SSL_CONNECT_ERROR;\r\n        SSL_strerror(errdetail, error_buffer, sizeof(error_buffer));\r\n        break;\r\n      }\r\n\r\n      /* detail is already set to the SSL error above */\r\n\r\n      /* If we e.g. use SSLv2 request-method and the server doesn't like us\r\n       * (RST connection etc.), OpenSSL gives no explanation whatsoever and\r\n       * the SO_ERROR is also lost.\r\n       */\r\n      if(CURLE_SSL_CONNECT_ERROR == rc && errdetail == 0) {\r\n        failf(data, \"Unknown SSL protocol error in connection to %s:%ld \",\r\n              conn->host.name, conn->port);\r\n        return rc;\r\n      }\r\n      /* Could be a CERT problem */\r\n\r\n      failf(data, \"%s%s\", cert_problem ? cert_problem : \"\", error_buffer);\r\n      return rc;\r\n    }\r\n  }\r\n  else {\r\n    /* we have been connected fine, we're not waiting for anything else. */\r\n    connssl->connecting_state = ssl_connect_3;\r\n\r\n    /* Informational message */\r\n    infof (data, \"SSL connection using %s\\n\",\r\n           SSL_get_cipher(connssl->handle));\r\n\r\n    return CURLE_OK;\r\n  }\r\n}\r\n\r\nstatic int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len)\r\n{\r\n  int i, ilen;\r\n\r\n  if((ilen = (int)len) < 0)\r\n    return 1; /* buffer too big */\r\n\r\n  i = i2t_ASN1_OBJECT(buf, ilen, a);\r\n\r\n  if(i >= ilen)\r\n    return 1; /* buffer too small */\r\n\r\n  return 0;\r\n}\r\n\r\nstatic CURLcode push_certinfo_len(struct SessionHandle *data,\r\n                                  int certnum,\r\n                                  const char *label,\r\n                                  const char *value,\r\n                                  size_t valuelen)\r\n{\r\n  struct curl_certinfo *ci = &data->info.certs;\r\n  char *output;\r\n  struct curl_slist *nl;\r\n  CURLcode res = CURLE_OK;\r\n  size_t labellen = strlen(label);\r\n  size_t outlen = labellen + 1 + valuelen + 1; /* label:value\\0 */\r\n\r\n  output = malloc(outlen);\r\n  if(!output)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* sprintf the label and colon */\r\n  snprintf(output, outlen, \"%s:\", label);\r\n\r\n  /* memcpy the value (it might not be zero terminated) */\r\n  memcpy(&output[labellen+1], value, valuelen);\r\n\r\n  /* zero terminate the output */\r\n  output[labellen + 1 + valuelen] = 0;\r\n\r\n  /* TODO: we should rather introduce an internal API that can do the\r\n     equivalent of curl_slist_append but doesn't strdup() the given data as\r\n     like in this place the extra malloc/free is totally pointless */\r\n  nl = curl_slist_append(ci->certinfo[certnum], output);\r\n  free(output);\r\n  if(!nl) {\r\n    curl_slist_free_all(ci->certinfo[certnum]);\r\n    ci->certinfo[certnum] = NULL;\r\n    res = CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else\r\n    ci->certinfo[certnum] = nl;\r\n\r\n  return res;\r\n}\r\n\r\n/* this is a convenience function for push_certinfo_len that takes a zero\r\n   terminated value */\r\nstatic CURLcode push_certinfo(struct SessionHandle *data,\r\n                              int certnum,\r\n                              const char *label,\r\n                              const char *value)\r\n{\r\n  size_t valuelen = strlen(value);\r\n\r\n  return push_certinfo_len(data, certnum, label, value, valuelen);\r\n}\r\n\r\nstatic void pubkey_show(struct SessionHandle *data,\r\n                        int num,\r\n                        const char *type,\r\n                        const char *name,\r\n                        unsigned char *raw,\r\n                        int len)\r\n{\r\n  size_t left;\r\n  int i;\r\n  char namebuf[32];\r\n  char *buffer;\r\n\r\n  left = len*3 + 1;\r\n  buffer = malloc(left);\r\n  if(buffer) {\r\n    char *ptr=buffer;\r\n    snprintf(namebuf, sizeof(namebuf), \"%s(%s)\", type, name);\r\n    for(i=0; i< len; i++) {\r\n      snprintf(ptr, left, \"%02x:\", raw[i]);\r\n      ptr += 3;\r\n      left -= 3;\r\n    }\r\n    infof(data, \"   %s: %s\\n\", namebuf, buffer);\r\n    push_certinfo(data, num, namebuf, buffer);\r\n    free(buffer);\r\n  }\r\n}\r\n\r\n#define print_pubkey_BN(_type, _name, _num)    \\\r\ndo {                              \\\r\n  if(pubkey->pkey._type->_name != NULL) { \\\r\n    int len = BN_num_bytes(pubkey->pkey._type->_name);  \\\r\n    if(len < CERTBUFFERSIZE) {                                    \\\r\n      BN_bn2bin(pubkey->pkey._type->_name, (unsigned char*)bufp); \\\r\n      bufp[len] = 0;                                                    \\\r\n      pubkey_show(data, _num, #_type, #_name, (unsigned char*)bufp, len); \\\r\n    } \\\r\n  } \\\r\n} WHILE_FALSE\r\n\r\nstatic int X509V3_ext(struct SessionHandle *data,\r\n                      int certnum,\r\n                      STACK_OF(X509_EXTENSION) *exts)\r\n{\r\n  int i;\r\n  size_t j;\r\n\r\n  if(sk_X509_EXTENSION_num(exts) <= 0)\r\n    /* no extensions, bail out */\r\n    return 1;\r\n\r\n  for(i=0; i<sk_X509_EXTENSION_num(exts); i++) {\r\n    ASN1_OBJECT *obj;\r\n    X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i);\r\n    BUF_MEM *biomem;\r\n    char buf[512];\r\n    char *ptr=buf;\r\n    char namebuf[128];\r\n    BIO *bio_out = BIO_new(BIO_s_mem());\r\n\r\n    if(!bio_out)\r\n      return 1;\r\n\r\n    obj = X509_EXTENSION_get_object(ext);\r\n\r\n    asn1_object_dump(obj, namebuf, sizeof(namebuf));\r\n\r\n    infof(data, \"%s: %s\\n\", namebuf,\r\n          X509_EXTENSION_get_critical(ext)?\"(critical)\":\"\");\r\n\r\n    if(!X509V3_EXT_print(bio_out, ext, 0, 0))\r\n      M_ASN1_OCTET_STRING_print(bio_out, ext->value);\r\n\r\n    BIO_get_mem_ptr(bio_out, &biomem);\r\n\r\n    /* biomem->length bytes at biomem->data, this little loop here is only\r\n       done for the infof() call, we send the \"raw\" data to the certinfo\r\n       function */\r\n    for(j=0; j<(size_t)biomem->length; j++) {\r\n      const char *sep=\"\";\r\n      if(biomem->data[j] == '\\n') {\r\n        sep=\", \";\r\n        j++; /* skip the newline */\r\n      };\r\n      while((biomem->data[j] == ' ') && (j<(size_t)biomem->length))\r\n        j++;\r\n      if(j<(size_t)biomem->length)\r\n        ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), \"%s%c\", sep,\r\n                      biomem->data[j]);\r\n    }\r\n    infof(data, \"  %s\\n\", buf);\r\n\r\n    push_certinfo(data, certnum, namebuf, buf);\r\n\r\n    BIO_free(bio_out);\r\n\r\n  }\r\n  return 0; /* all is fine */\r\n}\r\n\r\n\r\nstatic void X509_signature(struct SessionHandle *data,\r\n                           int numcert,\r\n                           ASN1_STRING *sig)\r\n{\r\n  char buf[1024];\r\n  char *ptr = buf;\r\n  int i;\r\n  for(i=0; i<sig->length; i++)\r\n    ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), \"%02x:\", sig->data[i]);\r\n\r\n  infof(data, \" Signature: %s\\n\", buf);\r\n  push_certinfo(data, numcert, \"Signature\", buf);\r\n}\r\n\r\nstatic void dumpcert(struct SessionHandle *data, X509 *x, int numcert)\r\n{\r\n  BIO *bio_out = BIO_new(BIO_s_mem());\r\n  BUF_MEM *biomem;\r\n\r\n  /* this outputs the cert in this 64 column wide style with newlines and\r\n     -----BEGIN CERTIFICATE----- texts and more */\r\n  PEM_write_bio_X509(bio_out, x);\r\n\r\n  BIO_get_mem_ptr(bio_out, &biomem);\r\n\r\n  infof(data, \"%s\\n\", biomem->data);\r\n\r\n  push_certinfo_len(data, numcert, \"Cert\", biomem->data, biomem->length);\r\n\r\n  BIO_free(bio_out);\r\n\r\n}\r\n\r\n\r\nstatic int init_certinfo(struct SessionHandle *data,\r\n                         int num)\r\n{\r\n  struct curl_certinfo *ci = &data->info.certs;\r\n  struct curl_slist **table;\r\n\r\n  Curl_ssl_free_certinfo(data);\r\n\r\n  ci->num_of_certs = num;\r\n  table = calloc((size_t)num, sizeof(struct curl_slist *));\r\n  if(!table)\r\n    return 1;\r\n\r\n  ci->certinfo = table;\r\n  return 0;\r\n}\r\n\r\n/*\r\n * This size was previously 512 which has been reported \"too small\" without\r\n * any specifics, so it was enlarged to allow more data to get shown uncut.\r\n * The \"perfect\" size is yet to figure out.\r\n */\r\n#define CERTBUFFERSIZE 8192\r\n\r\nstatic CURLcode get_cert_chain(struct connectdata *conn,\r\n                               struct ssl_connect_data *connssl)\r\n\r\n{\r\n  STACK_OF(X509) *sk;\r\n  int i;\r\n  char *bufp;\r\n  struct SessionHandle *data = conn->data;\r\n  int numcerts;\r\n\r\n  bufp = malloc(CERTBUFFERSIZE);\r\n  if(!bufp)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  sk = SSL_get_peer_cert_chain(connssl->handle);\r\n  if(!sk) {\r\n    free(bufp);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  numcerts = sk_X509_num(sk);\r\n  if(init_certinfo(data, numcerts)) {\r\n    free(bufp);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  infof(data, \"--- Certificate chain\\n\");\r\n  for(i=0; i<numcerts; i++) {\r\n    long value;\r\n    ASN1_INTEGER *num;\r\n    ASN1_TIME *certdate;\r\n\r\n    /* get the certs in \"importance order\" */\r\n#if 0\r\n    X509 *x = sk_X509_value(sk, numcerts - i - 1);\r\n#else\r\n    X509 *x = sk_X509_value(sk, i);\r\n#endif\r\n\r\n    X509_CINF *cinf;\r\n    EVP_PKEY *pubkey=NULL;\r\n    int j;\r\n    char *ptr;\r\n\r\n    (void)x509_name_oneline(X509_get_subject_name(x), bufp, CERTBUFFERSIZE);\r\n    infof(data, \"%2d Subject: %s\\n\", i, bufp);\r\n    push_certinfo(data, i, \"Subject\", bufp);\r\n\r\n    (void)x509_name_oneline(X509_get_issuer_name(x), bufp, CERTBUFFERSIZE);\r\n    infof(data, \"   Issuer: %s\\n\", bufp);\r\n    push_certinfo(data, i, \"Issuer\", bufp);\r\n\r\n    value = X509_get_version(x);\r\n    infof(data, \"   Version: %lu (0x%lx)\\n\", value+1, value);\r\n    snprintf(bufp, CERTBUFFERSIZE, \"%lx\", value);\r\n    push_certinfo(data, i, \"Version\", bufp); /* hex */\r\n\r\n    num=X509_get_serialNumber(x);\r\n    if(num->length <= 4) {\r\n      value = ASN1_INTEGER_get(num);\r\n      infof(data,\"   Serial Number: %ld (0x%lx)\\n\", value, value);\r\n      snprintf(bufp, CERTBUFFERSIZE, \"%lx\", value);\r\n    }\r\n    else {\r\n      int left = CERTBUFFERSIZE;\r\n\r\n      ptr = bufp;\r\n      *ptr++ = 0;\r\n      if(num->type == V_ASN1_NEG_INTEGER)\r\n        *ptr++='-';\r\n\r\n      for(j=0; (j<num->length) && (left>=4); j++) {\r\n        /* TODO: length restrictions */\r\n        snprintf(ptr, 3, \"%02x%c\",num->data[j],\r\n                 ((j+1 == num->length)?'\\n':':'));\r\n        ptr += 3;\r\n        left-=4;\r\n      }\r\n      if(num->length)\r\n        infof(data,\"   Serial Number: %s\\n\", bufp);\r\n      else\r\n        bufp[0]=0;\r\n    }\r\n    if(bufp[0])\r\n      push_certinfo(data, i, \"Serial Number\", bufp); /* hex */\r\n\r\n    cinf = x->cert_info;\r\n\r\n    j = asn1_object_dump(cinf->signature->algorithm, bufp, CERTBUFFERSIZE);\r\n    if(!j) {\r\n      infof(data, \"   Signature Algorithm: %s\\n\", bufp);\r\n      push_certinfo(data, i, \"Signature Algorithm\", bufp);\r\n    }\r\n\r\n    certdate = X509_get_notBefore(x);\r\n    asn1_output(certdate, bufp, CERTBUFFERSIZE);\r\n    infof(data, \"   Start date: %s\\n\", bufp);\r\n    push_certinfo(data, i, \"Start date\", bufp);\r\n\r\n    certdate = X509_get_notAfter(x);\r\n    asn1_output(certdate, bufp, CERTBUFFERSIZE);\r\n    infof(data, \"   Expire date: %s\\n\", bufp);\r\n    push_certinfo(data, i, \"Expire date\", bufp);\r\n\r\n    j = asn1_object_dump(cinf->key->algor->algorithm, bufp, CERTBUFFERSIZE);\r\n    if(!j) {\r\n      infof(data, \"   Public Key Algorithm: %s\\n\", bufp);\r\n      push_certinfo(data, i, \"Public Key Algorithm\", bufp);\r\n    }\r\n\r\n    pubkey = X509_get_pubkey(x);\r\n    if(!pubkey)\r\n      infof(data, \"   Unable to load public key\\n\");\r\n    else {\r\n      switch(pubkey->type) {\r\n      case EVP_PKEY_RSA:\r\n        infof(data,  \"   RSA Public Key (%d bits)\\n\",\r\n              BN_num_bits(pubkey->pkey.rsa->n));\r\n        snprintf(bufp, CERTBUFFERSIZE, \"%d\", BN_num_bits(pubkey->pkey.rsa->n));\r\n        push_certinfo(data, i, \"RSA Public Key\", bufp);\r\n\r\n        print_pubkey_BN(rsa, n, i);\r\n        print_pubkey_BN(rsa, e, i);\r\n        print_pubkey_BN(rsa, d, i);\r\n        print_pubkey_BN(rsa, p, i);\r\n        print_pubkey_BN(rsa, q, i);\r\n        print_pubkey_BN(rsa, dmp1, i);\r\n        print_pubkey_BN(rsa, dmq1, i);\r\n        print_pubkey_BN(rsa, iqmp, i);\r\n        break;\r\n      case EVP_PKEY_DSA:\r\n        print_pubkey_BN(dsa, p, i);\r\n        print_pubkey_BN(dsa, q, i);\r\n        print_pubkey_BN(dsa, g, i);\r\n        print_pubkey_BN(dsa, priv_key, i);\r\n        print_pubkey_BN(dsa, pub_key, i);\r\n        break;\r\n      case EVP_PKEY_DH:\r\n        print_pubkey_BN(dh, p, i);\r\n        print_pubkey_BN(dh, g, i);\r\n        print_pubkey_BN(dh, priv_key, i);\r\n        print_pubkey_BN(dh, pub_key, i);\r\n        break;\r\n#if 0\r\n      case EVP_PKEY_EC: /* symbol not present in OpenSSL 0.9.6 */\r\n        /* left TODO */\r\n        break;\r\n#endif\r\n      }\r\n      EVP_PKEY_free(pubkey);\r\n    }\r\n\r\n    X509V3_ext(data, i, cinf->extensions);\r\n\r\n    X509_signature(data, i, x->signature);\r\n\r\n    dumpcert(data, x, i);\r\n  }\r\n\r\n  free(bufp);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Get the server cert, verify it and show it etc, only call failf() if the\r\n * 'strict' argument is TRUE as otherwise all this is for informational\r\n * purposes only!\r\n *\r\n * We check certificates to authenticate the server; otherwise we risk\r\n * man-in-the-middle attack.\r\n */\r\nstatic CURLcode servercert(struct connectdata *conn,\r\n                           struct ssl_connect_data *connssl,\r\n                           bool strict)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n  int rc;\r\n  long lerr;\r\n  ASN1_TIME *certdate;\r\n  struct SessionHandle *data = conn->data;\r\n  X509 *issuer;\r\n  FILE *fp;\r\n  char *buffer = data->state.buffer;\r\n\r\n  if(data->set.ssl.certinfo)\r\n    /* we've been asked to gather certificate info! */\r\n    (void)get_cert_chain(conn, connssl);\r\n\r\n  data->set.ssl.certverifyresult = !X509_V_OK;\r\n\r\n  connssl->server_cert = SSL_get_peer_certificate(connssl->handle);\r\n  if(!connssl->server_cert) {\r\n    if(strict)\r\n      failf(data, \"SSL: couldn't get peer certificate!\");\r\n    return CURLE_PEER_FAILED_VERIFICATION;\r\n  }\r\n  infof (data, \"Server certificate:\\n\");\r\n\r\n  rc = x509_name_oneline(X509_get_subject_name(connssl->server_cert),\r\n                         buffer, BUFSIZE);\r\n  if(rc) {\r\n    if(strict)\r\n      failf(data, \"SSL: couldn't get X509-subject!\");\r\n    X509_free(connssl->server_cert);\r\n    connssl->server_cert = NULL;\r\n    return CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n  infof(data, \"\\t subject: %s\\n\", buffer);\r\n\r\n  certdate = X509_get_notBefore(connssl->server_cert);\r\n  asn1_output(certdate, buffer, BUFSIZE);\r\n  infof(data, \"\\t start date: %s\\n\", buffer);\r\n\r\n  certdate = X509_get_notAfter(connssl->server_cert);\r\n  asn1_output(certdate, buffer, BUFSIZE);\r\n  infof(data, \"\\t expire date: %s\\n\", buffer);\r\n\r\n  if(data->set.ssl.verifyhost) {\r\n    retcode = verifyhost(conn, connssl->server_cert);\r\n    if(retcode) {\r\n      X509_free(connssl->server_cert);\r\n      connssl->server_cert = NULL;\r\n      return retcode;\r\n    }\r\n  }\r\n\r\n  rc = x509_name_oneline(X509_get_issuer_name(connssl->server_cert),\r\n                         buffer, BUFSIZE);\r\n  if(rc) {\r\n    if(strict)\r\n      failf(data, \"SSL: couldn't get X509-issuer name!\");\r\n    retcode = CURLE_SSL_CONNECT_ERROR;\r\n  }\r\n  else {\r\n    infof(data, \"\\t issuer: %s\\n\", buffer);\r\n\r\n    /* We could do all sorts of certificate verification stuff here before\r\n       deallocating the certificate. */\r\n\r\n    /* e.g. match issuer name with provided issuer certificate */\r\n    if(data->set.str[STRING_SSL_ISSUERCERT]) {\r\n      fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],\"r\");\r\n      if(!fp) {\r\n        if(strict)\r\n          failf(data, \"SSL: Unable to open issuer cert (%s)\",\r\n                data->set.str[STRING_SSL_ISSUERCERT]);\r\n        X509_free(connssl->server_cert);\r\n        connssl->server_cert = NULL;\r\n        return CURLE_SSL_ISSUER_ERROR;\r\n      }\r\n      issuer = PEM_read_X509(fp,NULL,ZERO_NULL,NULL);\r\n      if(!issuer) {\r\n        if(strict)\r\n          failf(data, \"SSL: Unable to read issuer cert (%s)\",\r\n                data->set.str[STRING_SSL_ISSUERCERT]);\r\n        X509_free(connssl->server_cert);\r\n        X509_free(issuer);\r\n        fclose(fp);\r\n        return CURLE_SSL_ISSUER_ERROR;\r\n      }\r\n      fclose(fp);\r\n      if(X509_check_issued(issuer,connssl->server_cert) != X509_V_OK) {\r\n        if(strict)\r\n          failf(data, \"SSL: Certificate issuer check failed (%s)\",\r\n                data->set.str[STRING_SSL_ISSUERCERT]);\r\n        X509_free(connssl->server_cert);\r\n        X509_free(issuer);\r\n        connssl->server_cert = NULL;\r\n        return CURLE_SSL_ISSUER_ERROR;\r\n      }\r\n      infof(data, \"\\t SSL certificate issuer check ok (%s)\\n\",\r\n            data->set.str[STRING_SSL_ISSUERCERT]);\r\n      X509_free(issuer);\r\n    }\r\n\r\n    lerr = data->set.ssl.certverifyresult=\r\n      SSL_get_verify_result(connssl->handle);\r\n    if(data->set.ssl.certverifyresult != X509_V_OK) {\r\n      if(data->set.ssl.verifypeer) {\r\n        /* We probably never reach this, because SSL_connect() will fail\r\n           and we return earlier if verifypeer is set? */\r\n        if(strict)\r\n          failf(data, \"SSL certificate verify result: %s (%ld)\",\r\n                X509_verify_cert_error_string(lerr), lerr);\r\n        retcode = CURLE_PEER_FAILED_VERIFICATION;\r\n      }\r\n      else\r\n        infof(data, \"\\t SSL certificate verify result: %s (%ld),\"\r\n              \" continuing anyway.\\n\",\r\n              X509_verify_cert_error_string(lerr), lerr);\r\n    }\r\n    else\r\n      infof(data, \"\\t SSL certificate verify ok.\\n\");\r\n  }\r\n\r\n  X509_free(connssl->server_cert);\r\n  connssl->server_cert = NULL;\r\n  connssl->connecting_state = ssl_connect_done;\r\n\r\n  return retcode;\r\n}\r\n\r\n\r\nstatic CURLcode\r\nossl_connect_step3(struct connectdata *conn,\r\n                   int sockindex)\r\n{\r\n  CURLcode retcode = CURLE_OK;\r\n  void *old_ssl_sessionid=NULL;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  int incache;\r\n  SSL_SESSION *our_ssl_sessionid;\r\n\r\n  DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);\r\n\r\n#ifdef HAVE_SSL_GET1_SESSION\r\n  our_ssl_sessionid = SSL_get1_session(connssl->handle);\r\n\r\n  /* SSL_get1_session() will increment the reference\r\n     count and the session will stay in memory until explicitly freed with\r\n     SSL_SESSION_free(3), regardless of its state.\r\n     This function was introduced in openssl 0.9.5a. */\r\n#else\r\n  our_ssl_sessionid = SSL_get_session(connssl->handle);\r\n\r\n  /* if SSL_get1_session() is unavailable, use SSL_get_session().\r\n     This is an inferior option because the session can be flushed\r\n     at any time by openssl. It is included only so curl compiles\r\n     under versions of openssl < 0.9.5a.\r\n\r\n     WARNING: How curl behaves if it's session is flushed is\r\n     untested.\r\n  */\r\n#endif\r\n\r\n  incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL));\r\n  if(incache) {\r\n    if(old_ssl_sessionid != our_ssl_sessionid) {\r\n      infof(data, \"old SSL session ID is stale, removing\\n\");\r\n      Curl_ssl_delsessionid(conn, old_ssl_sessionid);\r\n      incache = FALSE;\r\n    }\r\n  }\r\n  if(!incache) {\r\n    retcode = Curl_ssl_addsessionid(conn, our_ssl_sessionid,\r\n                                    0 /* unknown size */);\r\n    if(retcode) {\r\n      failf(data, \"failed to store ssl session\");\r\n      return retcode;\r\n    }\r\n  }\r\n#ifdef HAVE_SSL_GET1_SESSION\r\n  else {\r\n    /* Session was incache, so refcount already incremented earlier.\r\n     * Avoid further increments with each SSL_get1_session() call.\r\n     * This does not free the session as refcount remains > 0\r\n     */\r\n    SSL_SESSION_free(our_ssl_sessionid);\r\n  }\r\n#endif\r\n\r\n  /*\r\n   * We check certificates to authenticate the server; otherwise we risk\r\n   * man-in-the-middle attack; NEVERTHELESS, if we're told explicitly not to\r\n   * verify the peer ignore faults and failures from the server cert\r\n   * operations.\r\n   */\r\n\r\n  if(!data->set.ssl.verifypeer)\r\n    (void)servercert(conn, connssl, FALSE);\r\n  else\r\n    retcode = servercert(conn, connssl, TRUE);\r\n\r\n  if(CURLE_OK == retcode)\r\n    connssl->connecting_state = ssl_connect_done;\r\n  return retcode;\r\n}\r\n\r\nstatic Curl_recv ossl_recv;\r\nstatic Curl_send ossl_send;\r\n\r\nstatic CURLcode\r\nossl_connect_common(struct connectdata *conn,\r\n                    int sockindex,\r\n                    bool nonblocking,\r\n                    bool *done)\r\n{\r\n  CURLcode retcode;\r\n  struct SessionHandle *data = conn->data;\r\n  struct ssl_connect_data *connssl = &conn->ssl[sockindex];\r\n  curl_socket_t sockfd = conn->sock[sockindex];\r\n  long timeout_ms;\r\n  int what;\r\n\r\n  /* check if the connection has already been established */\r\n  if(ssl_connection_complete == connssl->state) {\r\n    *done = TRUE;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(ssl_connect_1==connssl->connecting_state) {\r\n    /* Find out how much more time we're allowed */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n    retcode = ossl_connect_step1(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  while(ssl_connect_2 == connssl->connecting_state ||\r\n        ssl_connect_2_reading == connssl->connecting_state ||\r\n        ssl_connect_2_writing == connssl->connecting_state) {\r\n\r\n    /* check allowed time left */\r\n    timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n    if(timeout_ms < 0) {\r\n      /* no need to continue if time already is up */\r\n      failf(data, \"SSL connection timeout\");\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n\r\n    /* if ssl is expecting something, check if it's available. */\r\n    if(connssl->connecting_state == ssl_connect_2_reading\r\n        || connssl->connecting_state == ssl_connect_2_writing) {\r\n\r\n      curl_socket_t writefd = ssl_connect_2_writing==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n      curl_socket_t readfd = ssl_connect_2_reading==\r\n        connssl->connecting_state?sockfd:CURL_SOCKET_BAD;\r\n\r\n      what = Curl_socket_ready(readfd, writefd, nonblocking?0:timeout_ms);\r\n      if(what < 0) {\r\n        /* fatal error */\r\n        failf(data, \"select/poll on SSL socket, errno: %d\", SOCKERRNO);\r\n        return CURLE_SSL_CONNECT_ERROR;\r\n      }\r\n      else if(0 == what) {\r\n        if(nonblocking) {\r\n          *done = FALSE;\r\n          return CURLE_OK;\r\n        }\r\n        else {\r\n          /* timeout */\r\n          failf(data, \"SSL connection timeout\");\r\n          return CURLE_OPERATION_TIMEDOUT;\r\n        }\r\n      }\r\n      /* socket is readable or writable */\r\n    }\r\n\r\n    /* Run transaction, and return to the caller if it failed or if this\r\n     * connection is done nonblocking and this loop would execute again. This\r\n     * permits the owner of a multi handle to abort a connection attempt\r\n     * before step2 has completed while ensuring that a client using select()\r\n     * or epoll() will always have a valid fdset to wait on.\r\n     */\r\n    retcode = ossl_connect_step2(conn, sockindex);\r\n    if(retcode || (nonblocking &&\r\n                   (ssl_connect_2 == connssl->connecting_state ||\r\n                    ssl_connect_2_reading == connssl->connecting_state ||\r\n                    ssl_connect_2_writing == connssl->connecting_state)))\r\n      return retcode;\r\n\r\n  } /* repeat step2 until all transactions are done. */\r\n\r\n\r\n  if(ssl_connect_3==connssl->connecting_state) {\r\n    retcode = ossl_connect_step3(conn, sockindex);\r\n    if(retcode)\r\n      return retcode;\r\n  }\r\n\r\n  if(ssl_connect_done==connssl->connecting_state) {\r\n    connssl->state = ssl_connection_complete;\r\n    conn->recv[sockindex] = ossl_recv;\r\n    conn->send[sockindex] = ossl_send;\r\n    *done = TRUE;\r\n  }\r\n  else\r\n    *done = FALSE;\r\n\r\n  /* Reset our connect state machine */\r\n  connssl->connecting_state = ssl_connect_1;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode\r\nCurl_ossl_connect_nonblocking(struct connectdata *conn,\r\n                              int sockindex,\r\n                              bool *done)\r\n{\r\n  return ossl_connect_common(conn, sockindex, TRUE, done);\r\n}\r\n\r\nCURLcode\r\nCurl_ossl_connect(struct connectdata *conn,\r\n                  int sockindex)\r\n{\r\n  CURLcode retcode;\r\n  bool done = FALSE;\r\n\r\n  retcode = ossl_connect_common(conn, sockindex, FALSE, &done);\r\n  if(retcode)\r\n    return retcode;\r\n\r\n  DEBUGASSERT(done);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nbool Curl_ossl_data_pending(const struct connectdata *conn,\r\n                            int connindex)\r\n{\r\n  if(conn->ssl[connindex].handle)\r\n    /* SSL is in use */\r\n    return (0 != SSL_pending(conn->ssl[connindex].handle)) ? TRUE : FALSE;\r\n  else\r\n    return FALSE;\r\n}\r\n\r\nstatic ssize_t ossl_send(struct connectdata *conn,\r\n                         int sockindex,\r\n                         const void *mem,\r\n                         size_t len,\r\n                         CURLcode *curlcode)\r\n{\r\n  /* SSL_write() is said to return 'int' while write() and send() returns\r\n     'size_t' */\r\n  int err;\r\n  char error_buffer[120]; /* OpenSSL documents that this must be at least 120\r\n                             bytes long. */\r\n  unsigned long sslerror;\r\n  int memlen;\r\n  int rc;\r\n\r\n  ERR_clear_error();\r\n\r\n  memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len;\r\n  rc = SSL_write(conn->ssl[sockindex].handle, mem, memlen);\r\n\r\n  if(rc < 0) {\r\n    err = SSL_get_error(conn->ssl[sockindex].handle, rc);\r\n\r\n    switch(err) {\r\n    case SSL_ERROR_WANT_READ:\r\n    case SSL_ERROR_WANT_WRITE:\r\n      /* The operation did not complete; the same TLS/SSL I/O function\r\n         should be called again later. This is basically an EWOULDBLOCK\r\n         equivalent. */\r\n      *curlcode = CURLE_AGAIN;\r\n      return -1;\r\n    case SSL_ERROR_SYSCALL:\r\n      failf(conn->data, \"SSL_write() returned SYSCALL, errno = %d\",\r\n            SOCKERRNO);\r\n      *curlcode = CURLE_SEND_ERROR;\r\n      return -1;\r\n    case SSL_ERROR_SSL:\r\n      /*  A failure in the SSL library occurred, usually a protocol error.\r\n          The OpenSSL error queue contains more information on the error. */\r\n      sslerror = ERR_get_error();\r\n      failf(conn->data, \"SSL_write() error: %s\",\r\n            ERR_error_string(sslerror, error_buffer));\r\n      *curlcode = CURLE_SEND_ERROR;\r\n      return -1;\r\n    }\r\n    /* a true error */\r\n    failf(conn->data, \"SSL_write() return error %d\", err);\r\n    *curlcode = CURLE_SEND_ERROR;\r\n    return -1;\r\n  }\r\n  return (ssize_t)rc; /* number of bytes */\r\n}\r\n\r\nstatic ssize_t ossl_recv(struct connectdata *conn, /* connection data */\r\n                         int num,                  /* socketindex */\r\n                         char *buf,                /* store read data here */\r\n                         size_t buffersize,        /* max amount to read */\r\n                         CURLcode *curlcode)\r\n{\r\n  char error_buffer[120]; /* OpenSSL documents that this must be at\r\n                             least 120 bytes long. */\r\n  unsigned long sslerror;\r\n  ssize_t nread;\r\n  int buffsize;\r\n\r\n  ERR_clear_error();\r\n\r\n  buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;\r\n  nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, buffsize);\r\n  if(nread < 0) {\r\n    /* failed SSL_read */\r\n    int err = SSL_get_error(conn->ssl[num].handle, (int)nread);\r\n\r\n    switch(err) {\r\n    case SSL_ERROR_NONE: /* this is not an error */\r\n    case SSL_ERROR_ZERO_RETURN: /* no more data */\r\n      break;\r\n    case SSL_ERROR_WANT_READ:\r\n    case SSL_ERROR_WANT_WRITE:\r\n      /* there's data pending, re-invoke SSL_read() */\r\n      *curlcode = CURLE_AGAIN;\r\n      return -1;\r\n    default:\r\n      /* openssl/ssl.h says \"look at error stack/return value/errno\" */\r\n      sslerror = ERR_get_error();\r\n      failf(conn->data, \"SSL read: %s, errno %d\",\r\n            ERR_error_string(sslerror, error_buffer),\r\n            SOCKERRNO);\r\n      *curlcode = CURLE_RECV_ERROR;\r\n      return -1;\r\n    }\r\n  }\r\n  return nread;\r\n}\r\n\r\nsize_t Curl_ossl_version(char *buffer, size_t size)\r\n{\r\n#ifdef YASSL_VERSION\r\n  /* yassl provides an OpenSSL API compatibility layer so it looks identical\r\n     to OpenSSL in all other aspects */\r\n  return snprintf(buffer, size, \"yassl/%s\", YASSL_VERSION);\r\n#else /* YASSL_VERSION */\r\n\r\n#if(SSLEAY_VERSION_NUMBER >= 0x905000)\r\n  {\r\n    char sub[2];\r\n    unsigned long ssleay_value;\r\n    sub[1]='\\0';\r\n    ssleay_value=SSLeay();\r\n    if(ssleay_value < 0x906000) {\r\n      ssleay_value=SSLEAY_VERSION_NUMBER;\r\n      sub[0]='\\0';\r\n    }\r\n    else {\r\n      if(ssleay_value&0xff0) {\r\n        sub[0]=(char)(((ssleay_value>>4)&0xff) + 'a' -1);\r\n      }\r\n      else\r\n        sub[0]='\\0';\r\n    }\r\n\r\n    return snprintf(buffer, size, \"OpenSSL/%lx.%lx.%lx%s\",\r\n                    (ssleay_value>>28)&0xf,\r\n                    (ssleay_value>>20)&0xff,\r\n                    (ssleay_value>>12)&0xff,\r\n                    sub);\r\n  }\r\n\r\n#else /* SSLEAY_VERSION_NUMBER is less than 0.9.5 */\r\n\r\n#if(SSLEAY_VERSION_NUMBER >= 0x900000)\r\n  return snprintf(buffer, size, \"OpenSSL/%lx.%lx.%lx\",\r\n                  (SSLEAY_VERSION_NUMBER>>28)&0xff,\r\n                  (SSLEAY_VERSION_NUMBER>>20)&0xff,\r\n                  (SSLEAY_VERSION_NUMBER>>12)&0xf);\r\n\r\n#else /* (SSLEAY_VERSION_NUMBER >= 0x900000) */\r\n  {\r\n    char sub[2];\r\n    sub[1]='\\0';\r\n    if(SSLEAY_VERSION_NUMBER&0x0f) {\r\n      sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1;\r\n    }\r\n    else\r\n      sub[0]='\\0';\r\n\r\n    return snprintf(buffer, size, \"SSL/%x.%x.%x%s\",\r\n                    (SSLEAY_VERSION_NUMBER>>12)&0xff,\r\n                    (SSLEAY_VERSION_NUMBER>>8)&0xf,\r\n                    (SSLEAY_VERSION_NUMBER>>4)&0xf, sub);\r\n  }\r\n#endif /* (SSLEAY_VERSION_NUMBER >= 0x900000) */\r\n#endif /* SSLEAY_VERSION_NUMBER is less than 0.9.5 */\r\n\r\n#endif /* YASSL_VERSION */\r\n}\r\n\r\nvoid Curl_ossl_random(struct SessionHandle *data, unsigned char *entropy,\r\n                      size_t length)\r\n{\r\n  Curl_ossl_seed(data); /* Initiate the seed if not already done */\r\n  RAND_bytes(entropy, curlx_uztosi(length));\r\n}\r\n\r\nvoid Curl_ossl_md5sum(unsigned char *tmp, /* input */\r\n                      size_t tmplen,\r\n                      unsigned char *md5sum /* output */,\r\n                      size_t unused)\r\n{\r\n  MD5_CTX MD5pw;\r\n  (void)unused;\r\n  MD5_Init(&MD5pw);\r\n  MD5_Update(&MD5pw, tmp, tmplen);\r\n  MD5_Final(md5sum, &MD5pw);\r\n}\r\n#endif /* USE_SSLEAY */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/ssluse.h",
    "content": "#ifndef HEADER_CURL_SSLUSE_H\r\n#define HEADER_CURL_SSLUSE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef USE_SSLEAY\r\n/*\r\n * This header should only be needed to get included by sslgen.c and ssluse.c\r\n */\r\n\r\n#include \"urldata.h\"\r\n\r\nCURLcode Curl_ossl_connect(struct connectdata *conn, int sockindex);\r\nCURLcode Curl_ossl_connect_nonblocking(struct connectdata *conn,\r\n                                       int sockindex,\r\n                                       bool *done);\r\n\r\n/* close a SSL connection */\r\nvoid Curl_ossl_close(struct connectdata *conn, int sockindex);\r\n\r\n/* tell OpenSSL to close down all open information regarding connections (and\r\n   thus session ID caching etc) */\r\nint Curl_ossl_close_all(struct SessionHandle *data);\r\n\r\n/* Sets an OpenSSL engine */\r\nCURLcode Curl_ossl_set_engine(struct SessionHandle *data, const char *engine);\r\n\r\n/* function provided for the generic SSL-layer, called when a session id\r\n   should be freed */\r\nvoid Curl_ossl_session_free(void *ptr);\r\n\r\n/* Sets engine as default for all SSL operations */\r\nCURLcode Curl_ossl_set_engine_default(struct SessionHandle *data);\r\n\r\n/* Build list of OpenSSL engines */\r\nstruct curl_slist *Curl_ossl_engines_list(struct SessionHandle *data);\r\n\r\nint Curl_ossl_init(void);\r\nvoid Curl_ossl_cleanup(void);\r\n\r\nsize_t Curl_ossl_version(char *buffer, size_t size);\r\nint Curl_ossl_check_cxn(struct connectdata *cxn);\r\nint Curl_ossl_seed(struct SessionHandle *data);\r\n\r\nint Curl_ossl_shutdown(struct connectdata *conn, int sockindex);\r\nbool Curl_ossl_data_pending(const struct connectdata *conn,\r\n                            int connindex);\r\nvoid Curl_ossl_random(struct SessionHandle *data, unsigned char *entropy,\r\n                      size_t length);\r\nvoid Curl_ossl_md5sum(unsigned char *tmp, /* input */\r\n                      size_t tmplen,\r\n                      unsigned char *md5sum /* output */,\r\n                      size_t unused);\r\n\r\n/* API setup for OpenSSL */\r\n#define curlssl_init Curl_ossl_init\r\n#define curlssl_cleanup Curl_ossl_cleanup\r\n#define curlssl_connect Curl_ossl_connect\r\n#define curlssl_connect_nonblocking Curl_ossl_connect_nonblocking\r\n#define curlssl_session_free(x) Curl_ossl_session_free(x)\r\n#define curlssl_close_all Curl_ossl_close_all\r\n#define curlssl_close Curl_ossl_close\r\n#define curlssl_shutdown(x,y) Curl_ossl_shutdown(x,y)\r\n#define curlssl_set_engine(x,y) Curl_ossl_set_engine(x,y)\r\n#define curlssl_set_engine_default(x) Curl_ossl_set_engine_default(x)\r\n#define curlssl_engines_list(x) Curl_ossl_engines_list(x)\r\n#define curlssl_version Curl_ossl_version\r\n#define curlssl_check_cxn Curl_ossl_check_cxn\r\n#define curlssl_data_pending(x,y) Curl_ossl_data_pending(x,y)\r\n#define curlssl_random(x,y,z) Curl_ossl_random(x,y,z)\r\n#define curlssl_md5sum(a,b,c,d) Curl_ossl_md5sum(a,b,c,d)\r\n\r\n#endif /* USE_SSLEAY */\r\n#endif /* HEADER_CURL_SSLUSE_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strdup.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n * This file is 'mem-include-scan' clean. See test 1132.\r\n */\r\n#include \"curl_setup.h\"\r\n\r\n#include \"strdup.h\"\r\n\r\n#ifndef HAVE_STRDUP\r\nchar *curlx_strdup(const char *str)\r\n{\r\n  size_t len;\r\n  char *newstr;\r\n\r\n  if(!str)\r\n    return (char *)NULL;\r\n\r\n  len = strlen(str);\r\n\r\n  if(len >= ((size_t)-1) / sizeof(char))\r\n    return (char *)NULL;\r\n\r\n  newstr = malloc((len+1)*sizeof(char));\r\n  if(!newstr)\r\n    return (char *)NULL;\r\n\r\n  memcpy(newstr,str,(len+1)*sizeof(char));\r\n\r\n  return newstr;\r\n\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strdup.h",
    "content": "#ifndef HEADER_CURL_STRDUP_H\r\n#define HEADER_CURL_STRDUP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef HAVE_STRDUP\r\nextern char *curlx_strdup(const char *str);\r\n#endif\r\n\r\n#endif /* HEADER_CURL_STRDUP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strequal.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_STRINGS_H\r\n#include <strings.h>\r\n#endif\r\n\r\n#include \"strequal.h\"\r\n\r\n/*\r\n * @unittest: 1301\r\n */\r\nint curl_strequal(const char *first, const char *second)\r\n{\r\n#if defined(HAVE_STRCASECMP)\r\n  return !(strcasecmp)(first, second);\r\n#elif defined(HAVE_STRCMPI)\r\n  return !(strcmpi)(first, second);\r\n#elif defined(HAVE_STRICMP)\r\n  return !(stricmp)(first, second);\r\n#else\r\n  while(*first && *second) {\r\n    if(toupper(*first) != toupper(*second)) {\r\n      break;\r\n    }\r\n    first++;\r\n    second++;\r\n  }\r\n  return toupper(*first) == toupper(*second);\r\n#endif\r\n}\r\n\r\n/*\r\n * @unittest: 1301\r\n */\r\nint curl_strnequal(const char *first, const char *second, size_t max)\r\n{\r\n#if defined(HAVE_STRNCASECMP)\r\n  return !strncasecmp(first, second, max);\r\n#elif defined(HAVE_STRNCMPI)\r\n  return !strncmpi(first, second, max);\r\n#elif defined(HAVE_STRNICMP)\r\n  return !strnicmp(first, second, max);\r\n#else\r\n  while(*first && *second && max) {\r\n    if(toupper(*first) != toupper(*second)) {\r\n      break;\r\n    }\r\n    max--;\r\n    first++;\r\n    second++;\r\n  }\r\n  if(0 == max)\r\n    return 1; /* they are equal this far */\r\n\r\n  return toupper(*first) == toupper(*second);\r\n#endif\r\n}\r\n\r\n#ifndef HAVE_STRLCAT\r\n/*\r\n * The strlcat() function appends the NUL-terminated string src to the end\r\n * of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi-\r\n * nating the result.\r\n *\r\n * The strlcpy() and strlcat() functions return the total length of the\r\n * string they tried to create.  For strlcpy() that means the length of src.\r\n * For strlcat() that means the initial length of dst plus the length of\r\n * src. While this may seem somewhat confusing it was done to make trunca-\r\n * tion detection simple.\r\n *\r\n *\r\n */\r\nsize_t Curl_strlcat(char *dst, const char *src, size_t siz)\r\n{\r\n  char *d = dst;\r\n  const char *s = src;\r\n  size_t n = siz;\r\n  union {\r\n    ssize_t sig;\r\n     size_t uns;\r\n  } dlen;\r\n\r\n  /* Find the end of dst and adjust bytes left but don't go past end */\r\n  while(n-- != 0 && *d != '\\0')\r\n    d++;\r\n  dlen.sig = d - dst;\r\n  n = siz - dlen.uns;\r\n\r\n  if(n == 0)\r\n    return(dlen.uns + strlen(s));\r\n  while(*s != '\\0') {\r\n    if(n != 1) {\r\n      *d++ = *s;\r\n      n--;\r\n    }\r\n    s++;\r\n  }\r\n  *d = '\\0';\r\n\r\n  return(dlen.uns + (s - src));     /* count does not include NUL */\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strequal.h",
    "content": "#ifndef HEADER_CURL_STREQUAL_H\r\n#define HEADER_CURL_STREQUAL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h>\r\n\r\n#define strequal(a,b) curl_strequal(a,b)\r\n#define strnequal(a,b,c) curl_strnequal(a,b,c)\r\n\r\n#ifndef HAVE_STRLCAT\r\n#define strlcat(x,y,z) Curl_strlcat(x,y,z)\r\n#endif\r\nsize_t strlcat(char *dst, const char *src, size_t siz);\r\n\r\n#endif /* HEADER_CURL_STREQUAL_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strerror.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2004 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_STRERROR_R\r\n#  if (!defined(HAVE_POSIX_STRERROR_R) && \\\r\n       !defined(HAVE_GLIBC_STRERROR_R) && \\\r\n       !defined(HAVE_VXWORKS_STRERROR_R)) || \\\r\n      (defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \\\r\n      (defined(HAVE_GLIBC_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \\\r\n      (defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R))\r\n#    error \"strerror_r MUST be either POSIX, glibc or vxworks-style\"\r\n#  endif\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n\r\n#ifdef USE_LIBIDN\r\n#include <idna.h>\r\n#endif\r\n\r\n#include \"strerror.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nconst char *\r\ncurl_easy_strerror(CURLcode error)\r\n{\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  switch (error) {\r\n  case CURLE_OK:\r\n    return \"No error\";\r\n\r\n  case CURLE_UNSUPPORTED_PROTOCOL:\r\n    return \"Unsupported protocol\";\r\n\r\n  case CURLE_FAILED_INIT:\r\n    return \"Failed initialization\";\r\n\r\n  case CURLE_URL_MALFORMAT:\r\n    return \"URL using bad/illegal format or missing URL\";\r\n\r\n  case CURLE_NOT_BUILT_IN:\r\n    return \"A requested feature, protocol or option was not found built-in in\"\r\n      \" this libcurl due to a build-time decision.\";\r\n\r\n  case CURLE_COULDNT_RESOLVE_PROXY:\r\n    return \"Couldn't resolve proxy name\";\r\n\r\n  case CURLE_COULDNT_RESOLVE_HOST:\r\n    return \"Couldn't resolve host name\";\r\n\r\n  case CURLE_COULDNT_CONNECT:\r\n    return \"Couldn't connect to server\";\r\n\r\n  case CURLE_FTP_WEIRD_SERVER_REPLY:\r\n    return \"FTP: weird server reply\";\r\n\r\n  case CURLE_REMOTE_ACCESS_DENIED:\r\n    return \"Access denied to remote resource\";\r\n\r\n  case CURLE_FTP_ACCEPT_FAILED:\r\n    return \"FTP: The server failed to connect to data port\";\r\n\r\n  case CURLE_FTP_ACCEPT_TIMEOUT:\r\n    return \"FTP: Accepting server connect has timed out\";\r\n\r\n  case CURLE_FTP_PRET_FAILED:\r\n    return \"FTP: The server did not accept the PRET command.\";\r\n\r\n  case CURLE_FTP_WEIRD_PASS_REPLY:\r\n    return \"FTP: unknown PASS reply\";\r\n\r\n  case CURLE_FTP_WEIRD_PASV_REPLY:\r\n    return \"FTP: unknown PASV reply\";\r\n\r\n  case CURLE_FTP_WEIRD_227_FORMAT:\r\n    return \"FTP: unknown 227 response format\";\r\n\r\n  case CURLE_FTP_CANT_GET_HOST:\r\n    return \"FTP: can't figure out the host in the PASV response\";\r\n\r\n  case CURLE_FTP_COULDNT_SET_TYPE:\r\n    return \"FTP: couldn't set file type\";\r\n\r\n  case CURLE_PARTIAL_FILE:\r\n    return \"Transferred a partial file\";\r\n\r\n  case CURLE_FTP_COULDNT_RETR_FILE:\r\n    return \"FTP: couldn't retrieve (RETR failed) the specified file\";\r\n\r\n  case CURLE_QUOTE_ERROR:\r\n    return \"Quote command returned error\";\r\n\r\n  case CURLE_HTTP_RETURNED_ERROR:\r\n    return \"HTTP response code said error\";\r\n\r\n  case CURLE_WRITE_ERROR:\r\n    return \"Failed writing received data to disk/application\";\r\n\r\n  case CURLE_UPLOAD_FAILED:\r\n    return \"Upload failed (at start/before it took off)\";\r\n\r\n  case CURLE_READ_ERROR:\r\n    return \"Failed to open/read local data from file/application\";\r\n\r\n  case CURLE_OUT_OF_MEMORY:\r\n    return \"Out of memory\";\r\n\r\n  case CURLE_OPERATION_TIMEDOUT:\r\n    return \"Timeout was reached\";\r\n\r\n  case CURLE_FTP_PORT_FAILED:\r\n    return \"FTP: command PORT failed\";\r\n\r\n  case CURLE_FTP_COULDNT_USE_REST:\r\n    return \"FTP: command REST failed\";\r\n\r\n  case CURLE_RANGE_ERROR:\r\n    return \"Requested range was not delivered by the server\";\r\n\r\n  case CURLE_HTTP_POST_ERROR:\r\n    return \"Internal problem setting up the POST\";\r\n\r\n  case CURLE_SSL_CONNECT_ERROR:\r\n    return \"SSL connect error\";\r\n\r\n  case CURLE_BAD_DOWNLOAD_RESUME:\r\n    return \"Couldn't resume download\";\r\n\r\n  case CURLE_FILE_COULDNT_READ_FILE:\r\n    return \"Couldn't read a file:// file\";\r\n\r\n  case CURLE_LDAP_CANNOT_BIND:\r\n    return \"LDAP: cannot bind\";\r\n\r\n  case CURLE_LDAP_SEARCH_FAILED:\r\n    return \"LDAP: search failed\";\r\n\r\n  case CURLE_FUNCTION_NOT_FOUND:\r\n    return \"A required function in the library was not found\";\r\n\r\n  case CURLE_ABORTED_BY_CALLBACK:\r\n    return \"Operation was aborted by an application callback\";\r\n\r\n  case CURLE_BAD_FUNCTION_ARGUMENT:\r\n    return \"A libcurl function was given a bad argument\";\r\n\r\n  case CURLE_INTERFACE_FAILED:\r\n    return \"Failed binding local connection end\";\r\n\r\n  case CURLE_TOO_MANY_REDIRECTS :\r\n    return \"Number of redirects hit maximum amount\";\r\n\r\n  case CURLE_UNKNOWN_OPTION:\r\n    return \"An unknown option was passed in to libcurl\";\r\n\r\n  case CURLE_TELNET_OPTION_SYNTAX :\r\n    return \"Malformed telnet option\";\r\n\r\n  case CURLE_PEER_FAILED_VERIFICATION:\r\n    return \"SSL peer certificate or SSH remote key was not OK\";\r\n\r\n  case CURLE_GOT_NOTHING:\r\n    return \"Server returned nothing (no headers, no data)\";\r\n\r\n  case CURLE_SSL_ENGINE_NOTFOUND:\r\n    return \"SSL crypto engine not found\";\r\n\r\n  case CURLE_SSL_ENGINE_SETFAILED:\r\n    return \"Can not set SSL crypto engine as default\";\r\n\r\n  case CURLE_SSL_ENGINE_INITFAILED:\r\n    return \"Failed to initialise SSL crypto engine\";\r\n\r\n  case CURLE_SEND_ERROR:\r\n    return \"Failed sending data to the peer\";\r\n\r\n  case CURLE_RECV_ERROR:\r\n    return \"Failure when receiving data from the peer\";\r\n\r\n  case CURLE_SSL_CERTPROBLEM:\r\n    return \"Problem with the local SSL certificate\";\r\n\r\n  case CURLE_SSL_CIPHER:\r\n    return \"Couldn't use specified SSL cipher\";\r\n\r\n  case CURLE_SSL_CACERT:\r\n    return \"Peer certificate cannot be authenticated with given CA \"\r\n      \"certificates\";\r\n\r\n  case CURLE_SSL_CACERT_BADFILE:\r\n    return \"Problem with the SSL CA cert (path? access rights?)\";\r\n\r\n  case CURLE_BAD_CONTENT_ENCODING:\r\n    return \"Unrecognized or bad HTTP Content or Transfer-Encoding\";\r\n\r\n  case CURLE_LDAP_INVALID_URL:\r\n    return \"Invalid LDAP URL\";\r\n\r\n  case CURLE_FILESIZE_EXCEEDED:\r\n    return \"Maximum file size exceeded\";\r\n\r\n  case CURLE_USE_SSL_FAILED:\r\n    return \"Requested SSL level failed\";\r\n\r\n  case CURLE_SSL_SHUTDOWN_FAILED:\r\n    return \"Failed to shut down the SSL connection\";\r\n\r\n  case CURLE_SSL_CRL_BADFILE:\r\n    return \"Failed to load CRL file (path? access rights?, format?)\";\r\n\r\n  case CURLE_SSL_ISSUER_ERROR:\r\n    return \"Issuer check against peer certificate failed\";\r\n\r\n  case CURLE_SEND_FAIL_REWIND:\r\n    return \"Send failed since rewinding of the data stream failed\";\r\n\r\n  case CURLE_LOGIN_DENIED:\r\n    return \"Login denied\";\r\n\r\n  case CURLE_TFTP_NOTFOUND:\r\n    return \"TFTP: File Not Found\";\r\n\r\n  case CURLE_TFTP_PERM:\r\n    return \"TFTP: Access Violation\";\r\n\r\n  case CURLE_REMOTE_DISK_FULL:\r\n    return \"Disk full or allocation exceeded\";\r\n\r\n  case CURLE_TFTP_ILLEGAL:\r\n    return \"TFTP: Illegal operation\";\r\n\r\n  case CURLE_TFTP_UNKNOWNID:\r\n    return \"TFTP: Unknown transfer ID\";\r\n\r\n  case CURLE_REMOTE_FILE_EXISTS:\r\n    return \"Remote file already exists\";\r\n\r\n  case CURLE_TFTP_NOSUCHUSER:\r\n    return \"TFTP: No such user\";\r\n\r\n  case CURLE_CONV_FAILED:\r\n    return \"Conversion failed\";\r\n\r\n  case CURLE_CONV_REQD:\r\n    return \"Caller must register CURLOPT_CONV_ callback options\";\r\n\r\n  case CURLE_REMOTE_FILE_NOT_FOUND:\r\n    return \"Remote file not found\";\r\n\r\n  case CURLE_SSH:\r\n    return \"Error in the SSH layer\";\r\n\r\n  case CURLE_AGAIN:\r\n    return \"Socket not ready for send/recv\";\r\n\r\n  case CURLE_RTSP_CSEQ_ERROR:\r\n    return \"RTSP CSeq mismatch or invalid CSeq\";\r\n\r\n  case CURLE_RTSP_SESSION_ERROR:\r\n    return \"RTSP session error\";\r\n\r\n  case CURLE_FTP_BAD_FILE_LIST:\r\n    return \"Unable to parse FTP file list\";\r\n\r\n  case CURLE_CHUNK_FAILED:\r\n    return \"Chunk callback failed\";\r\n\r\n    /* error codes not used by current libcurl */\r\n  case CURLE_OBSOLETE16:\r\n  case CURLE_OBSOLETE20:\r\n  case CURLE_OBSOLETE24:\r\n  case CURLE_OBSOLETE29:\r\n  case CURLE_OBSOLETE32:\r\n  case CURLE_OBSOLETE40:\r\n  case CURLE_OBSOLETE44:\r\n  case CURLE_OBSOLETE46:\r\n  case CURLE_OBSOLETE50:\r\n  case CURLE_OBSOLETE57:\r\n  case CURL_LAST:\r\n    break;\r\n  }\r\n  /*\r\n   * By using a switch, gcc -Wall will complain about enum values\r\n   * which do not appear, helping keep this function up-to-date.\r\n   * By using gcc -Wall -Werror, you can't forget.\r\n   *\r\n   * A table would not have the same benefit.  Most compilers will\r\n   * generate code very similar to a table in any case, so there\r\n   * is little performance gain from a table.  And something is broken\r\n   * for the user's application, anyways, so does it matter how fast\r\n   * it _doesn't_ work?\r\n   *\r\n   * The line number for the error will be near this comment, which\r\n   * is why it is here, and not at the start of the switch.\r\n   */\r\n  return \"Unknown error\";\r\n#else\r\n  if(error == CURLE_OK)\r\n    return \"No error\";\r\n  else\r\n    return \"Error\";\r\n#endif\r\n}\r\n\r\nconst char *\r\ncurl_multi_strerror(CURLMcode error)\r\n{\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  switch (error) {\r\n  case CURLM_CALL_MULTI_PERFORM:\r\n    return \"Please call curl_multi_perform() soon\";\r\n\r\n  case CURLM_OK:\r\n    return \"No error\";\r\n\r\n  case CURLM_BAD_HANDLE:\r\n    return \"Invalid multi handle\";\r\n\r\n  case CURLM_BAD_EASY_HANDLE:\r\n    return \"Invalid easy handle\";\r\n\r\n  case CURLM_OUT_OF_MEMORY:\r\n    return \"Out of memory\";\r\n\r\n  case CURLM_INTERNAL_ERROR:\r\n    return \"Internal error\";\r\n\r\n  case CURLM_BAD_SOCKET:\r\n    return \"Invalid socket argument\";\r\n\r\n  case CURLM_UNKNOWN_OPTION:\r\n    return \"Unknown option\";\r\n\r\n  case CURLM_LAST:\r\n    break;\r\n  }\r\n\r\n  return \"Unknown error\";\r\n#else\r\n  if(error == CURLM_OK)\r\n    return \"No error\";\r\n  else\r\n    return \"Error\";\r\n#endif\r\n}\r\n\r\nconst char *\r\ncurl_share_strerror(CURLSHcode error)\r\n{\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  switch (error) {\r\n  case CURLSHE_OK:\r\n    return \"No error\";\r\n\r\n  case CURLSHE_BAD_OPTION:\r\n    return \"Unknown share option\";\r\n\r\n  case CURLSHE_IN_USE:\r\n    return \"Share currently in use\";\r\n\r\n  case CURLSHE_INVALID:\r\n    return \"Invalid share handle\";\r\n\r\n  case CURLSHE_NOMEM:\r\n    return \"Out of memory\";\r\n\r\n  case CURLSHE_NOT_BUILT_IN:\r\n    return \"Feature not enabled in this library\";\r\n\r\n  case CURLSHE_LAST:\r\n    break;\r\n  }\r\n\r\n  return \"CURLSHcode unknown\";\r\n#else\r\n  if(error == CURLSHE_OK)\r\n    return \"No error\";\r\n  else\r\n    return \"Error\";\r\n#endif\r\n}\r\n\r\n#ifdef USE_WINSOCK\r\n\r\n/* This function handles most / all (?) Winsock errors cURL is able to produce.\r\n */\r\nstatic const char *\r\nget_winsock_error (int err, char *buf, size_t len)\r\n{\r\n  const char *p;\r\n\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  switch (err) {\r\n  case WSAEINTR:\r\n    p = \"Call interrupted\";\r\n    break;\r\n  case WSAEBADF:\r\n    p = \"Bad file\";\r\n    break;\r\n  case WSAEACCES:\r\n    p = \"Bad access\";\r\n    break;\r\n  case WSAEFAULT:\r\n    p = \"Bad argument\";\r\n    break;\r\n  case WSAEINVAL:\r\n    p = \"Invalid arguments\";\r\n    break;\r\n  case WSAEMFILE:\r\n    p = \"Out of file descriptors\";\r\n    break;\r\n  case WSAEWOULDBLOCK:\r\n    p = \"Call would block\";\r\n    break;\r\n  case WSAEINPROGRESS:\r\n  case WSAEALREADY:\r\n    p = \"Blocking call in progress\";\r\n    break;\r\n  case WSAENOTSOCK:\r\n    p = \"Descriptor is not a socket\";\r\n    break;\r\n  case WSAEDESTADDRREQ:\r\n    p = \"Need destination address\";\r\n    break;\r\n  case WSAEMSGSIZE:\r\n    p = \"Bad message size\";\r\n    break;\r\n  case WSAEPROTOTYPE:\r\n    p = \"Bad protocol\";\r\n    break;\r\n  case WSAENOPROTOOPT:\r\n    p = \"Protocol option is unsupported\";\r\n    break;\r\n  case WSAEPROTONOSUPPORT:\r\n    p = \"Protocol is unsupported\";\r\n    break;\r\n  case WSAESOCKTNOSUPPORT:\r\n    p = \"Socket is unsupported\";\r\n    break;\r\n  case WSAEOPNOTSUPP:\r\n    p = \"Operation not supported\";\r\n    break;\r\n  case WSAEAFNOSUPPORT:\r\n    p = \"Address family not supported\";\r\n    break;\r\n  case WSAEPFNOSUPPORT:\r\n    p = \"Protocol family not supported\";\r\n    break;\r\n  case WSAEADDRINUSE:\r\n    p = \"Address already in use\";\r\n    break;\r\n  case WSAEADDRNOTAVAIL:\r\n    p = \"Address not available\";\r\n    break;\r\n  case WSAENETDOWN:\r\n    p = \"Network down\";\r\n    break;\r\n  case WSAENETUNREACH:\r\n    p = \"Network unreachable\";\r\n    break;\r\n  case WSAENETRESET:\r\n    p = \"Network has been reset\";\r\n    break;\r\n  case WSAECONNABORTED:\r\n    p = \"Connection was aborted\";\r\n    break;\r\n  case WSAECONNRESET:\r\n    p = \"Connection was reset\";\r\n    break;\r\n  case WSAENOBUFS:\r\n    p = \"No buffer space\";\r\n    break;\r\n  case WSAEISCONN:\r\n    p = \"Socket is already connected\";\r\n    break;\r\n  case WSAENOTCONN:\r\n    p = \"Socket is not connected\";\r\n    break;\r\n  case WSAESHUTDOWN:\r\n    p = \"Socket has been shut down\";\r\n    break;\r\n  case WSAETOOMANYREFS:\r\n    p = \"Too many references\";\r\n    break;\r\n  case WSAETIMEDOUT:\r\n    p = \"Timed out\";\r\n    break;\r\n  case WSAECONNREFUSED:\r\n    p = \"Connection refused\";\r\n    break;\r\n  case WSAELOOP:\r\n    p = \"Loop??\";\r\n    break;\r\n  case WSAENAMETOOLONG:\r\n    p = \"Name too long\";\r\n    break;\r\n  case WSAEHOSTDOWN:\r\n    p = \"Host down\";\r\n    break;\r\n  case WSAEHOSTUNREACH:\r\n    p = \"Host unreachable\";\r\n    break;\r\n  case WSAENOTEMPTY:\r\n    p = \"Not empty\";\r\n    break;\r\n  case WSAEPROCLIM:\r\n    p = \"Process limit reached\";\r\n    break;\r\n  case WSAEUSERS:\r\n    p = \"Too many users\";\r\n    break;\r\n  case WSAEDQUOT:\r\n    p = \"Bad quota\";\r\n    break;\r\n  case WSAESTALE:\r\n    p = \"Something is stale\";\r\n    break;\r\n  case WSAEREMOTE:\r\n    p = \"Remote error\";\r\n    break;\r\n#ifdef WSAEDISCON  /* missing in SalfordC! */\r\n  case WSAEDISCON:\r\n    p = \"Disconnected\";\r\n    break;\r\n#endif\r\n    /* Extended Winsock errors */\r\n  case WSASYSNOTREADY:\r\n    p = \"Winsock library is not ready\";\r\n    break;\r\n  case WSANOTINITIALISED:\r\n    p = \"Winsock library not initialised\";\r\n    break;\r\n  case WSAVERNOTSUPPORTED:\r\n    p = \"Winsock version not supported\";\r\n    break;\r\n\r\n    /* getXbyY() errors (already handled in herrmsg):\r\n     * Authoritative Answer: Host not found */\r\n  case WSAHOST_NOT_FOUND:\r\n    p = \"Host not found\";\r\n    break;\r\n\r\n    /* Non-Authoritative: Host not found, or SERVERFAIL */\r\n  case WSATRY_AGAIN:\r\n    p = \"Host not found, try again\";\r\n    break;\r\n\r\n    /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */\r\n  case WSANO_RECOVERY:\r\n    p = \"Unrecoverable error in call to nameserver\";\r\n    break;\r\n\r\n    /* Valid name, no data record of requested type */\r\n  case WSANO_DATA:\r\n    p = \"No data record of requested type\";\r\n    break;\r\n\r\n  default:\r\n    return NULL;\r\n  }\r\n#else\r\n  if(err == CURLE_OK)\r\n    return NULL;\r\n  else\r\n    p = \"error\";\r\n#endif\r\n  strncpy (buf, p, len);\r\n  buf [len-1] = '\\0';\r\n  return buf;\r\n}\r\n#endif   /* USE_WINSOCK */\r\n\r\n/*\r\n * Our thread-safe and smart strerror() replacement.\r\n *\r\n * The 'err' argument passed in to this function MUST be a true errno number\r\n * as reported on this system. We do no range checking on the number before\r\n * we pass it to the \"number-to-message\" conversion function and there might\r\n * be systems that don't do proper range checking in there themselves.\r\n *\r\n * We don't do range checking (on systems other than Windows) since there is\r\n * no good reliable and portable way to do it.\r\n */\r\nconst char *Curl_strerror(struct connectdata *conn, int err)\r\n{\r\n  char *buf, *p;\r\n  size_t max;\r\n  int old_errno = ERRNO;\r\n\r\n  DEBUGASSERT(conn);\r\n  DEBUGASSERT(err >= 0);\r\n\r\n  buf = conn->syserr_buf;\r\n  max = sizeof(conn->syserr_buf)-1;\r\n  *buf = '\\0';\r\n\r\n#ifdef USE_WINSOCK\r\n\r\n#ifdef _WIN32_WCE\r\n  {\r\n    wchar_t wbuf[256];\r\n    wbuf[0] = L'\\0';\r\n\r\n    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,\r\n                  LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL);\r\n    wcstombs(buf,wbuf,max);\r\n  }\r\n#else\r\n  /* 'sys_nerr' is the maximum errno number, it is not widely portable */\r\n  if(err >= 0 && err < sys_nerr)\r\n    strncpy(buf, strerror(err), max);\r\n  else {\r\n    if(!get_winsock_error(err, buf, max) &&\r\n       !FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,\r\n                       LANG_NEUTRAL, buf, (DWORD)max, NULL))\r\n      snprintf(buf, max, \"Unknown error %d (%#x)\", err, err);\r\n  }\r\n#endif\r\n\r\n#else /* not USE_WINSOCK coming up */\r\n\r\n#if defined(HAVE_STRERROR_R) && defined(HAVE_POSIX_STRERROR_R)\r\n /*\r\n  * The POSIX-style strerror_r() may set errno to ERANGE if insufficient\r\n  * storage is supplied via 'strerrbuf' and 'buflen' to hold the generated\r\n  * message string, or EINVAL if 'errnum' is not a valid error number.\r\n  */\r\n  if(0 != strerror_r(err, buf, max)) {\r\n    if('\\0' == buf[0])\r\n      snprintf(buf, max, \"Unknown error %d\", err);\r\n  }\r\n#elif defined(HAVE_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R)\r\n /*\r\n  * The glibc-style strerror_r() only *might* use the buffer we pass to\r\n  * the function, but it always returns the error message as a pointer,\r\n  * so we must copy that string unconditionally (if non-NULL).\r\n  */\r\n  {\r\n    char buffer[256];\r\n    char *msg = strerror_r(err, buffer, sizeof(buffer));\r\n    if(msg)\r\n      strncpy(buf, msg, max);\r\n    else\r\n      snprintf(buf, max, \"Unknown error %d\", err);\r\n  }\r\n#elif defined(HAVE_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)\r\n /*\r\n  * The vxworks-style strerror_r() does use the buffer we pass to the function.\r\n  * The buffer size should be at least MAXERRSTR_SIZE (150) defined in rtsold.h\r\n  */\r\n  {\r\n    char buffer[256];\r\n    if(OK == strerror_r(err, buffer))\r\n      strncpy(buf, buffer, max);\r\n    else\r\n      snprintf(buf, max, \"Unknown error %d\", err);\r\n  }\r\n#else\r\n  {\r\n    char *msg = strerror(err);\r\n    if(msg)\r\n      strncpy(buf, msg, max);\r\n    else\r\n      snprintf(buf, max, \"Unknown error %d\", err);\r\n  }\r\n#endif\r\n\r\n#endif /* end of ! USE_WINSOCK */\r\n\r\n  buf[max] = '\\0'; /* make sure the string is zero terminated */\r\n\r\n  /* strip trailing '\\r\\n' or '\\n'. */\r\n  if((p = strrchr(buf,'\\n')) != NULL && (p - buf) >= 2)\r\n     *p = '\\0';\r\n  if((p = strrchr(buf,'\\r')) != NULL && (p - buf) >= 1)\r\n     *p = '\\0';\r\n\r\n  if(old_errno != ERRNO)\r\n    SET_ERRNO(old_errno);\r\n\r\n  return buf;\r\n}\r\n\r\n#ifdef USE_LIBIDN\r\n/*\r\n * Return error-string for libidn status as returned from idna_to_ascii_lz().\r\n */\r\nconst char *Curl_idn_strerror (struct connectdata *conn, int err)\r\n{\r\n#ifdef HAVE_IDNA_STRERROR\r\n  (void)conn;\r\n  return idna_strerror((Idna_rc) err);\r\n#else\r\n  const char *str;\r\n  char *buf;\r\n  size_t max;\r\n\r\n  DEBUGASSERT(conn);\r\n\r\n  buf = conn->syserr_buf;\r\n  max = sizeof(conn->syserr_buf)-1;\r\n  *buf = '\\0';\r\n\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  switch ((Idna_rc)err) {\r\n    case IDNA_SUCCESS:\r\n      str = \"No error\";\r\n      break;\r\n    case IDNA_STRINGPREP_ERROR:\r\n      str = \"Error in string preparation\";\r\n      break;\r\n    case IDNA_PUNYCODE_ERROR:\r\n      str = \"Error in Punycode operation\";\r\n      break;\r\n    case IDNA_CONTAINS_NON_LDH:\r\n      str = \"Illegal ASCII characters\";\r\n      break;\r\n    case IDNA_CONTAINS_MINUS:\r\n      str = \"Contains minus\";\r\n      break;\r\n    case IDNA_INVALID_LENGTH:\r\n      str = \"Invalid output length\";\r\n      break;\r\n    case IDNA_NO_ACE_PREFIX:\r\n      str = \"No ACE prefix (\\\"xn--\\\")\";\r\n      break;\r\n    case IDNA_ROUNDTRIP_VERIFY_ERROR:\r\n      str = \"Round trip verify error\";\r\n      break;\r\n    case IDNA_CONTAINS_ACE_PREFIX:\r\n      str = \"Already have ACE prefix (\\\"xn--\\\")\";\r\n      break;\r\n    case IDNA_ICONV_ERROR:\r\n      str = \"Locale conversion failed\";\r\n      break;\r\n    case IDNA_MALLOC_ERROR:\r\n      str = \"Allocation failed\";\r\n      break;\r\n    case IDNA_DLOPEN_ERROR:\r\n      str = \"dlopen() error\";\r\n      break;\r\n    default:\r\n      snprintf(buf, max, \"error %d\", err);\r\n      str = NULL;\r\n      break;\r\n  }\r\n#else\r\n  if((Idna_rc)err == IDNA_SUCCESS)\r\n    str = \"No error\";\r\n  else\r\n    str = \"Error\";\r\n#endif\r\n  if(str)\r\n    strncpy(buf, str, max);\r\n  buf[max] = '\\0';\r\n  return (buf);\r\n#endif\r\n}\r\n#endif  /* USE_LIBIDN */\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\nconst char *Curl_sspi_strerror (struct connectdata *conn, int err)\r\n{\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  char txtbuf[80];\r\n  char msgbuf[sizeof(conn->syserr_buf)];\r\n  char *p, *str, *msg = NULL;\r\n  bool msg_formatted = FALSE;\r\n  int old_errno;\r\n#endif\r\n  const char *txt;\r\n  char *outbuf;\r\n  size_t outmax;\r\n\r\n  DEBUGASSERT(conn);\r\n\r\n  outbuf = conn->syserr_buf;\r\n  outmax = sizeof(conn->syserr_buf)-1;\r\n  *outbuf = '\\0';\r\n\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n\r\n  old_errno = ERRNO;\r\n\r\n  switch (err) {\r\n    case SEC_E_OK:\r\n      txt = \"No error\";\r\n      break;\r\n    case SEC_E_ALGORITHM_MISMATCH:\r\n      txt = \"SEC_E_ALGORITHM_MISMATCH\";\r\n      break;\r\n    case SEC_E_BAD_BINDINGS:\r\n      txt = \"SEC_E_BAD_BINDINGS\";\r\n      break;\r\n    case SEC_E_BAD_PKGID:\r\n      txt = \"SEC_E_BAD_PKGID\";\r\n      break;\r\n    case SEC_E_BUFFER_TOO_SMALL:\r\n      txt = \"SEC_E_BUFFER_TOO_SMALL\";\r\n      break;\r\n    case SEC_E_CANNOT_INSTALL:\r\n      txt = \"SEC_E_CANNOT_INSTALL\";\r\n      break;\r\n    case SEC_E_CANNOT_PACK:\r\n      txt = \"SEC_E_CANNOT_PACK\";\r\n      break;\r\n    case SEC_E_CERT_EXPIRED:\r\n      txt = \"SEC_E_CERT_EXPIRED\";\r\n      break;\r\n    case SEC_E_CERT_UNKNOWN:\r\n      txt = \"SEC_E_CERT_UNKNOWN\";\r\n      break;\r\n    case SEC_E_CERT_WRONG_USAGE:\r\n      txt = \"SEC_E_CERT_WRONG_USAGE\";\r\n      break;\r\n    case SEC_E_CONTEXT_EXPIRED:\r\n      txt = \"SEC_E_CONTEXT_EXPIRED\";\r\n      break;\r\n    case SEC_E_CROSSREALM_DELEGATION_FAILURE:\r\n      txt = \"SEC_E_CROSSREALM_DELEGATION_FAILURE\";\r\n      break;\r\n    case SEC_E_CRYPTO_SYSTEM_INVALID:\r\n      txt = \"SEC_E_CRYPTO_SYSTEM_INVALID\";\r\n      break;\r\n    case SEC_E_DECRYPT_FAILURE:\r\n      txt = \"SEC_E_DECRYPT_FAILURE\";\r\n      break;\r\n    case SEC_E_DELEGATION_POLICY:\r\n      txt = \"SEC_E_DELEGATION_POLICY\";\r\n      break;\r\n    case SEC_E_DELEGATION_REQUIRED:\r\n      txt = \"SEC_E_DELEGATION_REQUIRED\";\r\n      break;\r\n    case SEC_E_DOWNGRADE_DETECTED:\r\n      txt = \"SEC_E_DOWNGRADE_DETECTED\";\r\n      break;\r\n    case SEC_E_ENCRYPT_FAILURE:\r\n      txt = \"SEC_E_ENCRYPT_FAILURE\";\r\n      break;\r\n    case SEC_E_ILLEGAL_MESSAGE:\r\n      txt = \"SEC_E_ILLEGAL_MESSAGE\";\r\n      break;\r\n    case SEC_E_INCOMPLETE_CREDENTIALS:\r\n      txt = \"SEC_E_INCOMPLETE_CREDENTIALS\";\r\n      break;\r\n    case SEC_E_INCOMPLETE_MESSAGE:\r\n      txt = \"SEC_E_INCOMPLETE_MESSAGE\";\r\n      break;\r\n    case SEC_E_INSUFFICIENT_MEMORY:\r\n      txt = \"SEC_E_INSUFFICIENT_MEMORY\";\r\n      break;\r\n    case SEC_E_INTERNAL_ERROR:\r\n      txt = \"SEC_E_INTERNAL_ERROR\";\r\n      break;\r\n    case SEC_E_INVALID_HANDLE:\r\n      txt = \"SEC_E_INVALID_HANDLE\";\r\n      break;\r\n    case SEC_E_INVALID_PARAMETER:\r\n      txt = \"SEC_E_INVALID_PARAMETER\";\r\n      break;\r\n    case SEC_E_INVALID_TOKEN:\r\n      txt = \"SEC_E_INVALID_TOKEN\";\r\n      break;\r\n    case SEC_E_ISSUING_CA_UNTRUSTED:\r\n      txt = \"SEC_E_ISSUING_CA_UNTRUSTED\";\r\n      break;\r\n    case SEC_E_ISSUING_CA_UNTRUSTED_KDC:\r\n      txt = \"SEC_E_ISSUING_CA_UNTRUSTED_KDC\";\r\n      break;\r\n    case SEC_E_KDC_CERT_EXPIRED:\r\n      txt = \"SEC_E_KDC_CERT_EXPIRED\";\r\n      break;\r\n    case SEC_E_KDC_CERT_REVOKED:\r\n      txt = \"SEC_E_KDC_CERT_REVOKED\";\r\n      break;\r\n    case SEC_E_KDC_INVALID_REQUEST:\r\n      txt = \"SEC_E_KDC_INVALID_REQUEST\";\r\n      break;\r\n    case SEC_E_KDC_UNABLE_TO_REFER:\r\n      txt = \"SEC_E_KDC_UNABLE_TO_REFER\";\r\n      break;\r\n    case SEC_E_KDC_UNKNOWN_ETYPE:\r\n      txt = \"SEC_E_KDC_UNKNOWN_ETYPE\";\r\n      break;\r\n    case SEC_E_LOGON_DENIED:\r\n      txt = \"SEC_E_LOGON_DENIED\";\r\n      break;\r\n    case SEC_E_MAX_REFERRALS_EXCEEDED:\r\n      txt = \"SEC_E_MAX_REFERRALS_EXCEEDED\";\r\n      break;\r\n    case SEC_E_MESSAGE_ALTERED:\r\n      txt = \"SEC_E_MESSAGE_ALTERED\";\r\n      break;\r\n    case SEC_E_MULTIPLE_ACCOUNTS:\r\n      txt = \"SEC_E_MULTIPLE_ACCOUNTS\";\r\n      break;\r\n    case SEC_E_MUST_BE_KDC:\r\n      txt = \"SEC_E_MUST_BE_KDC\";\r\n      break;\r\n    case SEC_E_NOT_OWNER:\r\n      txt = \"SEC_E_NOT_OWNER\";\r\n      break;\r\n    case SEC_E_NO_AUTHENTICATING_AUTHORITY:\r\n      txt = \"SEC_E_NO_AUTHENTICATING_AUTHORITY\";\r\n      break;\r\n    case SEC_E_NO_CREDENTIALS:\r\n      txt = \"SEC_E_NO_CREDENTIALS\";\r\n      break;\r\n    case SEC_E_NO_IMPERSONATION:\r\n      txt = \"SEC_E_NO_IMPERSONATION\";\r\n      break;\r\n    case SEC_E_NO_IP_ADDRESSES:\r\n      txt = \"SEC_E_NO_IP_ADDRESSES\";\r\n      break;\r\n    case SEC_E_NO_KERB_KEY:\r\n      txt = \"SEC_E_NO_KERB_KEY\";\r\n      break;\r\n    case SEC_E_NO_PA_DATA:\r\n      txt = \"SEC_E_NO_PA_DATA\";\r\n      break;\r\n    case SEC_E_NO_S4U_PROT_SUPPORT:\r\n      txt = \"SEC_E_NO_S4U_PROT_SUPPORT\";\r\n      break;\r\n    case SEC_E_NO_TGT_REPLY:\r\n      txt = \"SEC_E_NO_TGT_REPLY\";\r\n      break;\r\n    case SEC_E_OUT_OF_SEQUENCE:\r\n      txt = \"SEC_E_OUT_OF_SEQUENCE\";\r\n      break;\r\n    case SEC_E_PKINIT_CLIENT_FAILURE:\r\n      txt = \"SEC_E_PKINIT_CLIENT_FAILURE\";\r\n      break;\r\n    case SEC_E_PKINIT_NAME_MISMATCH:\r\n      txt = \"SEC_E_PKINIT_NAME_MISMATCH\";\r\n      break;\r\n    case SEC_E_POLICY_NLTM_ONLY:\r\n      txt = \"SEC_E_POLICY_NLTM_ONLY\";\r\n      break;\r\n    case SEC_E_QOP_NOT_SUPPORTED:\r\n      txt = \"SEC_E_QOP_NOT_SUPPORTED\";\r\n      break;\r\n    case SEC_E_REVOCATION_OFFLINE_C:\r\n      txt = \"SEC_E_REVOCATION_OFFLINE_C\";\r\n      break;\r\n    case SEC_E_REVOCATION_OFFLINE_KDC:\r\n      txt = \"SEC_E_REVOCATION_OFFLINE_KDC\";\r\n      break;\r\n    case SEC_E_SECPKG_NOT_FOUND:\r\n      txt = \"SEC_E_SECPKG_NOT_FOUND\";\r\n      break;\r\n    case SEC_E_SECURITY_QOS_FAILED:\r\n      txt = \"SEC_E_SECURITY_QOS_FAILED\";\r\n      break;\r\n    case SEC_E_SHUTDOWN_IN_PROGRESS:\r\n      txt = \"SEC_E_SHUTDOWN_IN_PROGRESS\";\r\n      break;\r\n    case SEC_E_SMARTCARD_CERT_EXPIRED:\r\n      txt = \"SEC_E_SMARTCARD_CERT_EXPIRED\";\r\n      break;\r\n    case SEC_E_SMARTCARD_CERT_REVOKED:\r\n      txt = \"SEC_E_SMARTCARD_CERT_REVOKED\";\r\n      break;\r\n    case SEC_E_SMARTCARD_LOGON_REQUIRED:\r\n      txt = \"SEC_E_SMARTCARD_LOGON_REQUIRED\";\r\n      break;\r\n    case SEC_E_STRONG_CRYPTO_NOT_SUPPORTED:\r\n      txt = \"SEC_E_STRONG_CRYPTO_NOT_SUPPORTED\";\r\n      break;\r\n    case SEC_E_TARGET_UNKNOWN:\r\n      txt = \"SEC_E_TARGET_UNKNOWN\";\r\n      break;\r\n    case SEC_E_TIME_SKEW:\r\n      txt = \"SEC_E_TIME_SKEW\";\r\n      break;\r\n    case SEC_E_TOO_MANY_PRINCIPALS:\r\n      txt = \"SEC_E_TOO_MANY_PRINCIPALS\";\r\n      break;\r\n    case SEC_E_UNFINISHED_CONTEXT_DELETED:\r\n      txt = \"SEC_E_UNFINISHED_CONTEXT_DELETED\";\r\n      break;\r\n    case SEC_E_UNKNOWN_CREDENTIALS:\r\n      txt = \"SEC_E_UNKNOWN_CREDENTIALS\";\r\n      break;\r\n    case SEC_E_UNSUPPORTED_FUNCTION:\r\n      txt = \"SEC_E_UNSUPPORTED_FUNCTION\";\r\n      break;\r\n    case SEC_E_UNSUPPORTED_PREAUTH:\r\n      txt = \"SEC_E_UNSUPPORTED_PREAUTH\";\r\n      break;\r\n    case SEC_E_UNTRUSTED_ROOT:\r\n      txt = \"SEC_E_UNTRUSTED_ROOT\";\r\n      break;\r\n    case SEC_E_WRONG_CREDENTIAL_HANDLE:\r\n      txt = \"SEC_E_WRONG_CREDENTIAL_HANDLE\";\r\n      break;\r\n    case SEC_E_WRONG_PRINCIPAL:\r\n      txt = \"SEC_E_WRONG_PRINCIPAL\";\r\n      break;\r\n    case SEC_I_COMPLETE_AND_CONTINUE:\r\n      txt = \"SEC_I_COMPLETE_AND_CONTINUE\";\r\n      break;\r\n    case SEC_I_COMPLETE_NEEDED:\r\n      txt = \"SEC_I_COMPLETE_NEEDED\";\r\n      break;\r\n    case SEC_I_CONTEXT_EXPIRED:\r\n      txt = \"SEC_I_CONTEXT_EXPIRED\";\r\n      break;\r\n    case SEC_I_CONTINUE_NEEDED:\r\n      txt = \"SEC_I_CONTINUE_NEEDED\";\r\n      break;\r\n    case SEC_I_INCOMPLETE_CREDENTIALS:\r\n      txt = \"SEC_I_INCOMPLETE_CREDENTIALS\";\r\n      break;\r\n    case SEC_I_LOCAL_LOGON:\r\n      txt = \"SEC_I_LOCAL_LOGON\";\r\n      break;\r\n    case SEC_I_NO_LSA_CONTEXT:\r\n      txt = \"SEC_I_NO_LSA_CONTEXT\";\r\n      break;\r\n    case SEC_I_RENEGOTIATE:\r\n      txt = \"SEC_I_RENEGOTIATE\";\r\n      break;\r\n    case SEC_I_SIGNATURE_NEEDED:\r\n      txt = \"SEC_I_SIGNATURE_NEEDED\";\r\n      break;\r\n    default:\r\n      txt = \"Unknown error\";\r\n  }\r\n\r\n  if(err == SEC_E_OK)\r\n    strncpy(outbuf, txt, outmax);\r\n  else {\r\n    str = txtbuf;\r\n    snprintf(txtbuf, sizeof(txtbuf), \"%s (0x%04X%04X)\",\r\n             txt, (err >> 16) & 0xffff, err & 0xffff);\r\n    txtbuf[sizeof(txtbuf)-1] = '\\0';\r\n\r\n#ifdef _WIN32_WCE\r\n    {\r\n      wchar_t wbuf[256];\r\n      wbuf[0] = L'\\0';\r\n\r\n      if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |\r\n                       FORMAT_MESSAGE_IGNORE_INSERTS,\r\n                       NULL, err, LANG_NEUTRAL,\r\n                       wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) {\r\n        wcstombs(msgbuf,wbuf,sizeof(msgbuf)-1);\r\n        msg_formatted = TRUE;\r\n      }\r\n    }\r\n#else\r\n    if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |\r\n                      FORMAT_MESSAGE_IGNORE_INSERTS,\r\n                      NULL, err, LANG_NEUTRAL,\r\n                      msgbuf, sizeof(msgbuf)-1, NULL)) {\r\n      msg_formatted = TRUE;\r\n    }\r\n#endif\r\n    if(msg_formatted) {\r\n      msgbuf[sizeof(msgbuf)-1] = '\\0';\r\n      /* strip trailing '\\r\\n' or '\\n' */\r\n      if((p = strrchr(msgbuf,'\\n')) != NULL && (p - msgbuf) >= 2)\r\n         *p = '\\0';\r\n      if((p = strrchr(msgbuf,'\\r')) != NULL && (p - msgbuf) >= 1)\r\n         *p = '\\0';\r\n      msg = msgbuf;\r\n    }\r\n    if(msg)\r\n      snprintf(outbuf, outmax, \"%s - %s\", str, msg);\r\n    else\r\n      strncpy(outbuf, str, outmax);\r\n  }\r\n\r\n  if(old_errno != ERRNO)\r\n    SET_ERRNO(old_errno);\r\n\r\n#else\r\n\r\n  if(err == SEC_E_OK)\r\n    txt = \"No error\";\r\n  else\r\n    txt = \"Error\";\r\n\r\n  strncpy(outbuf, txt, outmax);\r\n\r\n#endif\r\n\r\n  outbuf[outmax] = '\\0';\r\n\r\n  return outbuf;\r\n}\r\n#endif /* USE_WINDOWS_SSPI */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strerror.h",
    "content": "#ifndef HEADER_CURL_STRERROR_H\r\n#define HEADER_CURL_STRERROR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"urldata.h\"\r\n\r\nconst char *Curl_strerror (struct connectdata *conn, int err);\r\n\r\n#ifdef USE_LIBIDN\r\nconst char *Curl_idn_strerror (struct connectdata *conn, int err);\r\n#endif\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\nconst char *Curl_sspi_strerror (struct connectdata *conn, int err);\r\n#endif\r\n\r\n#endif /* HEADER_CURL_STRERROR_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strtok.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef HAVE_STRTOK_R\r\n#include <stddef.h>\r\n\r\n#include \"strtok.h\"\r\n\r\nchar *\r\nCurl_strtok_r(char *ptr, const char *sep, char **end)\r\n{\r\n  if(!ptr)\r\n    /* we got NULL input so then we get our last position instead */\r\n    ptr = *end;\r\n\r\n  /* pass all letters that are including in the separator string */\r\n  while(*ptr && strchr(sep, *ptr))\r\n    ++ptr;\r\n\r\n  if(*ptr) {\r\n    /* so this is where the next piece of string starts */\r\n    char *start = ptr;\r\n\r\n    /* set the end pointer to the first byte after the start */\r\n    *end = start + 1;\r\n\r\n    /* scan through the string to find where it ends, it ends on a\r\n       null byte or a character that exists in the separator string */\r\n    while(**end && !strchr(sep, **end))\r\n      ++*end;\r\n\r\n    if(**end) {\r\n      /* the end is not a null byte */\r\n      **end = '\\0';  /* zero terminate it! */\r\n      ++*end;        /* advance the last pointer to beyond the null byte */\r\n    }\r\n\r\n    return start; /* return the position where the string starts */\r\n  }\r\n\r\n  /* we ended up on a null byte, there are no more strings to find! */\r\n  return NULL;\r\n}\r\n\r\n#endif /* this was only compiled if strtok_r wasn't present */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strtok.h",
    "content": "#ifndef HEADER_CURL_STRTOK_H\r\n#define HEADER_CURL_STRTOK_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n#include <stddef.h>\r\n\r\n#ifndef HAVE_STRTOK_R\r\nchar *Curl_strtok_r(char *s, const char *delim, char **last);\r\n#define strtok_r Curl_strtok_r\r\n#else\r\n#include <string.h>\r\n#endif\r\n\r\n#endif /* HEADER_CURL_STRTOK_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strtoofft.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"strtoofft.h\"\r\n\r\n/*\r\n * NOTE:\r\n *\r\n * In the ISO C standard (IEEE Std 1003.1), there is a strtoimax() function we\r\n * could use in case strtoll() doesn't exist...  See\r\n * http://www.opengroup.org/onlinepubs/009695399/functions/strtoimax.html\r\n */\r\n\r\n#ifdef NEED_CURL_STRTOLL\r\n\r\n/* Range tests can be used for alphanum decoding if characters are consecutive,\r\n   like in ASCII. Else an array is scanned. Determine this condition now. */\r\n\r\n#if('9' - '0') != 9 || ('Z' - 'A') != 25 || ('z' - 'a') != 25\r\n\r\n#define NO_RANGE_TEST\r\n\r\nstatic const char valchars[] =\r\n            \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\r\n#endif\r\n\r\nstatic int get_char(char c, int base);\r\n\r\n/**\r\n * Emulated version of the strtoll function.  This extracts a long long\r\n * value from the given input string and returns it.\r\n */\r\ncurl_off_t\r\ncurlx_strtoll(const char *nptr, char **endptr, int base)\r\n{\r\n  char *end;\r\n  int is_negative = 0;\r\n  int overflow;\r\n  int i;\r\n  curl_off_t value = 0;\r\n  curl_off_t newval;\r\n\r\n  /* Skip leading whitespace. */\r\n  end = (char *)nptr;\r\n  while(ISSPACE(end[0])) {\r\n    end++;\r\n  }\r\n\r\n  /* Handle the sign, if any. */\r\n  if(end[0] == '-') {\r\n    is_negative = 1;\r\n    end++;\r\n  }\r\n  else if(end[0] == '+') {\r\n    end++;\r\n  }\r\n  else if(end[0] == '\\0') {\r\n    /* We had nothing but perhaps some whitespace -- there was no number. */\r\n    if(endptr) {\r\n      *endptr = end;\r\n    }\r\n    return 0;\r\n  }\r\n\r\n  /* Handle special beginnings, if present and allowed. */\r\n  if(end[0] == '0' && end[1] == 'x') {\r\n    if(base == 16 || base == 0) {\r\n      end += 2;\r\n      base = 16;\r\n    }\r\n  }\r\n  else if(end[0] == '0') {\r\n    if(base == 8 || base == 0) {\r\n      end++;\r\n      base = 8;\r\n    }\r\n  }\r\n\r\n  /* Matching strtol, if the base is 0 and it doesn't look like\r\n   * the number is octal or hex, we assume it's base 10.\r\n   */\r\n  if(base == 0) {\r\n    base = 10;\r\n  }\r\n\r\n  /* Loop handling digits. */\r\n  value = 0;\r\n  overflow = 0;\r\n  for(i = get_char(end[0], base);\r\n      i != -1;\r\n      end++, i = get_char(end[0], base)) {\r\n    newval = base * value + i;\r\n    if(newval < value) {\r\n      /* We've overflowed. */\r\n      overflow = 1;\r\n      break;\r\n    }\r\n    else\r\n      value = newval;\r\n  }\r\n\r\n  if(!overflow) {\r\n    if(is_negative) {\r\n      /* Fix the sign. */\r\n      value *= -1;\r\n    }\r\n  }\r\n  else {\r\n    if(is_negative)\r\n      value = CURL_OFF_T_MIN;\r\n    else\r\n      value = CURL_OFF_T_MAX;\r\n\r\n    SET_ERRNO(ERANGE);\r\n  }\r\n\r\n  if(endptr)\r\n    *endptr = end;\r\n\r\n  return value;\r\n}\r\n\r\n/**\r\n * Returns the value of c in the given base, or -1 if c cannot\r\n * be interpreted properly in that base (i.e., is out of range,\r\n * is a null, etc.).\r\n *\r\n * @param c     the character to interpret according to base\r\n * @param base  the base in which to interpret c\r\n *\r\n * @return  the value of c in base, or -1 if c isn't in range\r\n */\r\nstatic int get_char(char c, int base)\r\n{\r\n#ifndef NO_RANGE_TEST\r\n  int value = -1;\r\n  if(c <= '9' && c >= '0') {\r\n    value = c - '0';\r\n  }\r\n  else if(c <= 'Z' && c >= 'A') {\r\n    value = c - 'A' + 10;\r\n  }\r\n  else if(c <= 'z' && c >= 'a') {\r\n    value = c - 'a' + 10;\r\n  }\r\n#else\r\n  const char * cp;\r\n  int value;\r\n\r\n  cp = memchr(valchars, c, 10 + 26 + 26);\r\n\r\n  if(!cp)\r\n    return -1;\r\n\r\n  value = cp - valchars;\r\n\r\n  if(value >= 10 + 26)\r\n    value -= 26;                /* Lowercase. */\r\n#endif\r\n\r\n  if(value >= base) {\r\n    value = -1;\r\n  }\r\n\r\n  return value;\r\n}\r\n#endif  /* Only present if we need strtoll, but don't have it. */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/strtoofft.h",
    "content": "#ifndef HEADER_CURL_STRTOOFFT_H\r\n#define HEADER_CURL_STRTOOFFT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n/*\r\n * Determine which string to integral data type conversion function we use\r\n * to implement string conversion to our curl_off_t integral data type.\r\n *\r\n * Notice that curl_off_t might be 64 or 32 bit wide, and that it might use\r\n * an underlying data type which might be 'long', 'int64_t', 'long long' or\r\n * '__int64' and more remotely other data types.\r\n *\r\n * On systems where the size of curl_off_t is greater than the size of 'long'\r\n * the conversion function to use is strtoll() if it is available, otherwise,\r\n * we emulate its functionality with our own clone.\r\n *\r\n * On systems where the size of curl_off_t is smaller or equal than the size\r\n * of 'long' the conversion function to use is strtol().\r\n */\r\n\r\n#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)\r\n#  ifdef HAVE_STRTOLL\r\n#    define curlx_strtoofft strtoll\r\n#  else\r\n#    if defined(_MSC_VER) && (_MSC_VER >= 1300) && (_INTEGRAL_MAX_BITS >= 64)\r\n       _CRTIMP __int64 __cdecl _strtoi64(const char *, char **, int);\r\n#      define curlx_strtoofft _strtoi64\r\n#    else\r\n       curl_off_t curlx_strtoll(const char *nptr, char **endptr, int base);\r\n#      define curlx_strtoofft curlx_strtoll\r\n#      define NEED_CURL_STRTOLL 1\r\n#    endif\r\n#  endif\r\n#else\r\n#  define curlx_strtoofft strtol\r\n#endif\r\n\r\n#if (CURL_SIZEOF_CURL_OFF_T == 4)\r\n#  define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF)\r\n#else\r\n   /* assume CURL_SIZEOF_CURL_OFF_T == 8 */\r\n#  define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)\r\n#endif\r\n#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1))\r\n\r\n#endif /* HEADER_CURL_STRTOOFFT_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/telnet.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_TELNET\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n#include \"telnet.h\"\r\n#include \"connect.h\"\r\n#include \"progress.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#define  TELOPTS\r\n#define  TELCMDS\r\n\r\n#include \"arpa_telnet.h\"\r\n#include \"curl_memory.h\"\r\n#include \"select.h\"\r\n#include \"strequal.h\"\r\n#include \"rawstr.h\"\r\n#include \"warnless.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define SUBBUFSIZE 512\r\n\r\n#define CURL_SB_CLEAR(x)  x->subpointer = x->subbuffer\r\n#define CURL_SB_TERM(x)                                 \\\r\n  do {                                                  \\\r\n    x->subend = x->subpointer;                          \\\r\n    CURL_SB_CLEAR(x);                                   \\\r\n  } WHILE_FALSE\r\n#define CURL_SB_ACCUM(x,c)                                   \\\r\n  do {                                                       \\\r\n    if(x->subpointer < (x->subbuffer+sizeof x->subbuffer))   \\\r\n      *x->subpointer++ = (c);                                \\\r\n  } WHILE_FALSE\r\n\r\n#define  CURL_SB_GET(x) ((*x->subpointer++)&0xff)\r\n#define  CURL_SB_PEEK(x)   ((*x->subpointer)&0xff)\r\n#define  CURL_SB_EOF(x) (x->subpointer >= x->subend)\r\n#define  CURL_SB_LEN(x) (x->subend - x->subpointer)\r\n\r\n#ifdef CURL_DISABLE_VERBOSE_STRINGS\r\n#define printoption(a,b,c,d)  Curl_nop_stmt\r\n#endif\r\n\r\n#ifdef USE_WINSOCK\r\ntypedef FARPROC WSOCK2_FUNC;\r\nstatic CURLcode check_wsock2 ( struct SessionHandle *data );\r\n#endif\r\n\r\nstatic\r\nCURLcode telrcv(struct connectdata *,\r\n                const unsigned char *inbuf, /* Data received from socket */\r\n                ssize_t count);             /* Number of bytes received */\r\n\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\nstatic void printoption(struct SessionHandle *data,\r\n                        const char *direction,\r\n                        int cmd, int option);\r\n#endif\r\n\r\nstatic void negotiate(struct connectdata *);\r\nstatic void send_negotiation(struct connectdata *, int cmd, int option);\r\nstatic void set_local_option(struct connectdata *, int cmd, int option);\r\nstatic void set_remote_option(struct connectdata *, int cmd, int option);\r\n\r\nstatic void printsub(struct SessionHandle *data,\r\n                     int direction, unsigned char *pointer,\r\n                     size_t length);\r\nstatic void suboption(struct connectdata *);\r\nstatic void sendsuboption(struct connectdata *conn, int option);\r\n\r\nstatic CURLcode telnet_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode telnet_done(struct connectdata *conn,\r\n                                 CURLcode, bool premature);\r\nstatic CURLcode send_telnet_data(struct connectdata *conn,\r\n                                 char *buffer, ssize_t nread);\r\n\r\n/* For negotiation compliant to RFC 1143 */\r\n#define CURL_NO          0\r\n#define CURL_YES         1\r\n#define CURL_WANTYES     2\r\n#define CURL_WANTNO      3\r\n\r\n#define CURL_EMPTY       0\r\n#define CURL_OPPOSITE    1\r\n\r\n/*\r\n * Telnet receiver states for fsm\r\n */\r\ntypedef enum\r\n{\r\n   CURL_TS_DATA = 0,\r\n   CURL_TS_IAC,\r\n   CURL_TS_WILL,\r\n   CURL_TS_WONT,\r\n   CURL_TS_DO,\r\n   CURL_TS_DONT,\r\n   CURL_TS_CR,\r\n   CURL_TS_SB,   /* sub-option collection */\r\n   CURL_TS_SE   /* looking for sub-option end */\r\n} TelnetReceive;\r\n\r\nstruct TELNET {\r\n  int please_negotiate;\r\n  int already_negotiated;\r\n  int us[256];\r\n  int usq[256];\r\n  int us_preferred[256];\r\n  int him[256];\r\n  int himq[256];\r\n  int him_preferred[256];\r\n  int subnegotiation[256];\r\n  char subopt_ttype[32];             /* Set with suboption TTYPE */\r\n  char subopt_xdisploc[128];         /* Set with suboption XDISPLOC */\r\n  unsigned short subopt_wsx;         /* Set with suboption NAWS */\r\n  unsigned short subopt_wsy;         /* Set with suboption NAWS */\r\n  struct curl_slist *telnet_vars;    /* Environment variables */\r\n\r\n  /* suboptions */\r\n  unsigned char subbuffer[SUBBUFSIZE];\r\n  unsigned char *subpointer, *subend;      /* buffer for sub-options */\r\n\r\n  TelnetReceive telrcv_state;\r\n};\r\n\r\n\r\n/*\r\n * TELNET protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_telnet = {\r\n  \"TELNET\",                             /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  telnet_do,                            /* do_it */\r\n  telnet_done,                          /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_TELNET,                          /* defport */\r\n  CURLPROTO_TELNET,                     /* protocol */\r\n  PROTOPT_NONE | PROTOPT_NOURLQUERY     /* flags */\r\n};\r\n\r\n\r\n#ifdef USE_WINSOCK\r\nstatic CURLcode\r\ncheck_wsock2 ( struct SessionHandle *data )\r\n{\r\n  int err;\r\n  WORD wVersionRequested;\r\n  WSADATA wsaData;\r\n\r\n  DEBUGASSERT(data);\r\n\r\n  /* telnet requires at least WinSock 2.0 so ask for it. */\r\n  wVersionRequested = MAKEWORD(2, 0);\r\n\r\n  err = WSAStartup(wVersionRequested, &wsaData);\r\n\r\n  /* We must've called this once already, so this call */\r\n  /* should always succeed.  But, just in case... */\r\n  if(err != 0) {\r\n    failf(data,\"WSAStartup failed (%d)\",err);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* We have to have a WSACleanup call for every successful */\r\n  /* WSAStartup call. */\r\n  WSACleanup();\r\n\r\n  /* Check that our version is supported */\r\n  if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) ||\r\n      HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested)) {\r\n      /* Our version isn't supported */\r\n      failf(data,\"insufficient winsock version to support \"\r\n            \"telnet\");\r\n      return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* Our version is supported */\r\n  return CURLE_OK;\r\n}\r\n#endif\r\n\r\nstatic\r\nCURLcode init_telnet(struct connectdata *conn)\r\n{\r\n  struct TELNET *tn;\r\n\r\n  tn = calloc(1, sizeof(struct TELNET));\r\n  if(!tn)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  conn->data->state.proto.telnet = (void *)tn; /* make us known */\r\n\r\n  tn->telrcv_state = CURL_TS_DATA;\r\n\r\n  /* Init suboptions */\r\n  CURL_SB_CLEAR(tn);\r\n\r\n  /* Set the options we want by default */\r\n  tn->us_preferred[CURL_TELOPT_SGA] = CURL_YES;\r\n  tn->him_preferred[CURL_TELOPT_SGA] = CURL_YES;\r\n\r\n  /* To be compliant with previous releases of libcurl\r\n     we enable this option by default. This behaviour\r\n         can be changed thanks to the \"BINARY\" option in\r\n         CURLOPT_TELNETOPTIONS\r\n  */\r\n  tn->us_preferred[CURL_TELOPT_BINARY] = CURL_YES;\r\n  tn->him_preferred[CURL_TELOPT_BINARY] = CURL_YES;\r\n\r\n  /* We must allow the server to echo what we sent\r\n         but it is not necessary to request the server\r\n         to do so (it might forces the server to close\r\n         the connection). Hence, we ignore ECHO in the\r\n         negotiate function\r\n  */\r\n  tn->him_preferred[CURL_TELOPT_ECHO] = CURL_YES;\r\n\r\n  /* Set the subnegotiation fields to send information\r\n    just after negotiation passed (do/will)\r\n\r\n     Default values are (0,0) initialized by calloc.\r\n     According to the RFC1013 it is valid:\r\n     A value equal to zero is acceptable for the width (or height),\r\n         and means that no character width (or height) is being sent.\r\n         In this case, the width (or height) that will be assumed by the\r\n         Telnet server is operating system specific (it will probably be\r\n         based upon the terminal type information that may have been sent\r\n         using the TERMINAL TYPE Telnet option). */\r\n  tn->subnegotiation[CURL_TELOPT_NAWS] = CURL_YES;\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic void negotiate(struct connectdata *conn)\r\n{\r\n  int i;\r\n  struct TELNET *tn = (struct TELNET *) conn->data->state.proto.telnet;\r\n\r\n  for(i = 0;i < CURL_NTELOPTS;i++) {\r\n    if(i==CURL_TELOPT_ECHO)\r\n      continue;\r\n\r\n    if(tn->us_preferred[i] == CURL_YES)\r\n      set_local_option(conn, i, CURL_YES);\r\n\r\n    if(tn->him_preferred[i] == CURL_YES)\r\n      set_remote_option(conn, i, CURL_YES);\r\n  }\r\n}\r\n\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\nstatic void printoption(struct SessionHandle *data,\r\n                        const char *direction, int cmd, int option)\r\n{\r\n  const char *fmt;\r\n  const char *opt;\r\n\r\n  if(data->set.verbose) {\r\n    if(cmd == CURL_IAC) {\r\n      if(CURL_TELCMD_OK(option))\r\n        infof(data, \"%s IAC %s\\n\", direction, CURL_TELCMD(option));\r\n      else\r\n        infof(data, \"%s IAC %d\\n\", direction, option);\r\n    }\r\n    else {\r\n      fmt = (cmd == CURL_WILL) ? \"WILL\" : (cmd == CURL_WONT) ? \"WONT\" :\r\n        (cmd == CURL_DO) ? \"DO\" : (cmd == CURL_DONT) ? \"DONT\" : 0;\r\n      if(fmt) {\r\n        if(CURL_TELOPT_OK(option))\r\n          opt = CURL_TELOPT(option);\r\n        else if(option == CURL_TELOPT_EXOPL)\r\n          opt = \"EXOPL\";\r\n        else\r\n          opt = NULL;\r\n\r\n        if(opt)\r\n          infof(data, \"%s %s %s\\n\", direction, fmt, opt);\r\n        else\r\n          infof(data, \"%s %s %d\\n\", direction, fmt, option);\r\n      }\r\n      else\r\n        infof(data, \"%s %d %d\\n\", direction, cmd, option);\r\n    }\r\n  }\r\n}\r\n#endif\r\n\r\nstatic void send_negotiation(struct connectdata *conn, int cmd, int option)\r\n{\r\n   unsigned char buf[3];\r\n   ssize_t bytes_written;\r\n   int err;\r\n   struct SessionHandle *data = conn->data;\r\n\r\n   buf[0] = CURL_IAC;\r\n   buf[1] = (unsigned char)cmd;\r\n   buf[2] = (unsigned char)option;\r\n\r\n   bytes_written = swrite(conn->sock[FIRSTSOCKET], buf, 3);\r\n   if(bytes_written < 0) {\r\n     err = SOCKERRNO;\r\n     failf(data,\"Sending data failed (%d)\",err);\r\n   }\r\n\r\n   printoption(conn->data, \"SENT\", cmd, option);\r\n}\r\n\r\nstatic\r\nvoid set_remote_option(struct connectdata *conn, int option, int newstate)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  if(newstate == CURL_YES) {\r\n    switch(tn->him[option]) {\r\n    case CURL_NO:\r\n      tn->him[option] = CURL_WANTYES;\r\n      send_negotiation(conn, CURL_DO, option);\r\n      break;\r\n\r\n    case CURL_YES:\r\n      /* Already enabled */\r\n      break;\r\n\r\n    case CURL_WANTNO:\r\n      switch(tn->himq[option]) {\r\n      case CURL_EMPTY:\r\n        /* Already negotiating for CURL_YES, queue the request */\r\n        tn->himq[option] = CURL_OPPOSITE;\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        /* Error: already queued an enable request */\r\n        break;\r\n      }\r\n      break;\r\n\r\n    case CURL_WANTYES:\r\n      switch(tn->himq[option]) {\r\n      case CURL_EMPTY:\r\n        /* Error: already negotiating for enable */\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        tn->himq[option] = CURL_EMPTY;\r\n        break;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  else { /* NO */\r\n    switch(tn->him[option]) {\r\n    case CURL_NO:\r\n      /* Already disabled */\r\n      break;\r\n\r\n    case CURL_YES:\r\n      tn->him[option] = CURL_WANTNO;\r\n      send_negotiation(conn, CURL_DONT, option);\r\n      break;\r\n\r\n    case CURL_WANTNO:\r\n      switch(tn->himq[option]) {\r\n      case CURL_EMPTY:\r\n        /* Already negotiating for NO */\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        tn->himq[option] = CURL_EMPTY;\r\n        break;\r\n      }\r\n      break;\r\n\r\n    case CURL_WANTYES:\r\n      switch(tn->himq[option]) {\r\n      case CURL_EMPTY:\r\n        tn->himq[option] = CURL_OPPOSITE;\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        break;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\nstatic\r\nvoid rec_will(struct connectdata *conn, int option)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  switch(tn->him[option]) {\r\n  case CURL_NO:\r\n    if(tn->him_preferred[option] == CURL_YES) {\r\n      tn->him[option] = CURL_YES;\r\n      send_negotiation(conn, CURL_DO, option);\r\n    }\r\n    else\r\n      send_negotiation(conn, CURL_DONT, option);\r\n\r\n    break;\r\n\r\n  case CURL_YES:\r\n    /* Already enabled */\r\n    break;\r\n\r\n  case CURL_WANTNO:\r\n    switch(tn->himq[option]) {\r\n    case CURL_EMPTY:\r\n      /* Error: DONT answered by WILL */\r\n      tn->him[option] = CURL_NO;\r\n      break;\r\n    case CURL_OPPOSITE:\r\n      /* Error: DONT answered by WILL */\r\n      tn->him[option] = CURL_YES;\r\n      tn->himq[option] = CURL_EMPTY;\r\n      break;\r\n    }\r\n    break;\r\n\r\n  case CURL_WANTYES:\r\n    switch(tn->himq[option]) {\r\n    case CURL_EMPTY:\r\n      tn->him[option] = CURL_YES;\r\n      break;\r\n    case CURL_OPPOSITE:\r\n      tn->him[option] = CURL_WANTNO;\r\n      tn->himq[option] = CURL_EMPTY;\r\n      send_negotiation(conn, CURL_DONT, option);\r\n      break;\r\n    }\r\n    break;\r\n  }\r\n}\r\n\r\nstatic\r\nvoid rec_wont(struct connectdata *conn, int option)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  switch(tn->him[option]) {\r\n  case CURL_NO:\r\n    /* Already disabled */\r\n    break;\r\n\r\n  case CURL_YES:\r\n    tn->him[option] = CURL_NO;\r\n    send_negotiation(conn, CURL_DONT, option);\r\n    break;\r\n\r\n  case CURL_WANTNO:\r\n    switch(tn->himq[option]) {\r\n    case CURL_EMPTY:\r\n      tn->him[option] = CURL_NO;\r\n      break;\r\n\r\n    case CURL_OPPOSITE:\r\n      tn->him[option] = CURL_WANTYES;\r\n      tn->himq[option] = CURL_EMPTY;\r\n      send_negotiation(conn, CURL_DO, option);\r\n      break;\r\n    }\r\n    break;\r\n\r\n  case CURL_WANTYES:\r\n    switch(tn->himq[option]) {\r\n    case CURL_EMPTY:\r\n      tn->him[option] = CURL_NO;\r\n      break;\r\n    case CURL_OPPOSITE:\r\n      tn->him[option] = CURL_NO;\r\n      tn->himq[option] = CURL_EMPTY;\r\n      break;\r\n    }\r\n    break;\r\n  }\r\n}\r\n\r\nstatic void\r\nset_local_option(struct connectdata *conn, int option, int newstate)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  if(newstate == CURL_YES) {\r\n    switch(tn->us[option]) {\r\n    case CURL_NO:\r\n      tn->us[option] = CURL_WANTYES;\r\n      send_negotiation(conn, CURL_WILL, option);\r\n      break;\r\n\r\n    case CURL_YES:\r\n      /* Already enabled */\r\n      break;\r\n\r\n    case CURL_WANTNO:\r\n      switch(tn->usq[option]) {\r\n      case CURL_EMPTY:\r\n        /* Already negotiating for CURL_YES, queue the request */\r\n        tn->usq[option] = CURL_OPPOSITE;\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        /* Error: already queued an enable request */\r\n        break;\r\n      }\r\n      break;\r\n\r\n    case CURL_WANTYES:\r\n      switch(tn->usq[option]) {\r\n      case CURL_EMPTY:\r\n        /* Error: already negotiating for enable */\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        tn->usq[option] = CURL_EMPTY;\r\n        break;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  else { /* NO */\r\n    switch(tn->us[option]) {\r\n    case CURL_NO:\r\n      /* Already disabled */\r\n      break;\r\n\r\n    case CURL_YES:\r\n      tn->us[option] = CURL_WANTNO;\r\n      send_negotiation(conn, CURL_WONT, option);\r\n      break;\r\n\r\n    case CURL_WANTNO:\r\n      switch(tn->usq[option]) {\r\n      case CURL_EMPTY:\r\n        /* Already negotiating for NO */\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        tn->usq[option] = CURL_EMPTY;\r\n        break;\r\n      }\r\n      break;\r\n\r\n    case CURL_WANTYES:\r\n      switch(tn->usq[option]) {\r\n      case CURL_EMPTY:\r\n        tn->usq[option] = CURL_OPPOSITE;\r\n        break;\r\n      case CURL_OPPOSITE:\r\n        break;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\nstatic\r\nvoid rec_do(struct connectdata *conn, int option)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  switch(tn->us[option]) {\r\n  case CURL_NO:\r\n    if(tn->us_preferred[option] == CURL_YES) {\r\n      tn->us[option] = CURL_YES;\r\n      send_negotiation(conn, CURL_WILL, option);\r\n      if(tn->subnegotiation[option] == CURL_YES)\r\n        /* transmission of data option */\r\n        sendsuboption(conn, option);\r\n    }\r\n    else if(tn->subnegotiation[option] == CURL_YES) {\r\n      /* send information to achieve this option*/\r\n      tn->us[option] = CURL_YES;\r\n      send_negotiation(conn, CURL_WILL, option);\r\n      sendsuboption(conn, option);\r\n    }\r\n    else\r\n      send_negotiation(conn, CURL_WONT, option);\r\n    break;\r\n\r\n  case CURL_YES:\r\n    /* Already enabled */\r\n    break;\r\n\r\n  case CURL_WANTNO:\r\n    switch(tn->usq[option]) {\r\n    case CURL_EMPTY:\r\n      /* Error: DONT answered by WILL */\r\n      tn->us[option] = CURL_NO;\r\n      break;\r\n    case CURL_OPPOSITE:\r\n      /* Error: DONT answered by WILL */\r\n      tn->us[option] = CURL_YES;\r\n      tn->usq[option] = CURL_EMPTY;\r\n      break;\r\n    }\r\n    break;\r\n\r\n  case CURL_WANTYES:\r\n    switch(tn->usq[option]) {\r\n    case CURL_EMPTY:\r\n      tn->us[option] = CURL_YES;\r\n      if(tn->subnegotiation[option] == CURL_YES) {\r\n        /* transmission of data option */\r\n        sendsuboption(conn, option);\r\n      }\r\n      break;\r\n    case CURL_OPPOSITE:\r\n      tn->us[option] = CURL_WANTNO;\r\n      tn->himq[option] = CURL_EMPTY;\r\n      send_negotiation(conn, CURL_WONT, option);\r\n      break;\r\n    }\r\n    break;\r\n  }\r\n}\r\n\r\nstatic\r\nvoid rec_dont(struct connectdata *conn, int option)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  switch(tn->us[option]) {\r\n  case CURL_NO:\r\n    /* Already disabled */\r\n    break;\r\n\r\n  case CURL_YES:\r\n    tn->us[option] = CURL_NO;\r\n    send_negotiation(conn, CURL_WONT, option);\r\n    break;\r\n\r\n  case CURL_WANTNO:\r\n    switch(tn->usq[option]) {\r\n    case CURL_EMPTY:\r\n      tn->us[option] = CURL_NO;\r\n      break;\r\n\r\n    case CURL_OPPOSITE:\r\n      tn->us[option] = CURL_WANTYES;\r\n      tn->usq[option] = CURL_EMPTY;\r\n      send_negotiation(conn, CURL_WILL, option);\r\n      break;\r\n    }\r\n    break;\r\n\r\n  case CURL_WANTYES:\r\n    switch(tn->usq[option]) {\r\n    case CURL_EMPTY:\r\n      tn->us[option] = CURL_NO;\r\n      break;\r\n    case CURL_OPPOSITE:\r\n      tn->us[option] = CURL_NO;\r\n      tn->usq[option] = CURL_EMPTY;\r\n      break;\r\n    }\r\n    break;\r\n  }\r\n}\r\n\r\n\r\nstatic void printsub(struct SessionHandle *data,\r\n                     int direction,             /* '<' or '>' */\r\n                     unsigned char *pointer,    /* where suboption data is */\r\n                     size_t length)             /* length of suboption data */\r\n{\r\n  unsigned int i = 0;\r\n  unsigned short *pval;\r\n\r\n  if(data->set.verbose) {\r\n    if(direction) {\r\n      infof(data, \"%s IAC SB \", (direction == '<')? \"RCVD\":\"SENT\");\r\n      if(length >= 3) {\r\n        int j;\r\n\r\n        i = pointer[length-2];\r\n        j = pointer[length-1];\r\n\r\n        if(i != CURL_IAC || j != CURL_SE) {\r\n          infof(data, \"(terminated by \");\r\n          if(CURL_TELOPT_OK(i))\r\n            infof(data, \"%s \", CURL_TELOPT(i));\r\n          else if(CURL_TELCMD_OK(i))\r\n            infof(data, \"%s \", CURL_TELCMD(i));\r\n          else\r\n            infof(data, \"%u \", i);\r\n          if(CURL_TELOPT_OK(j))\r\n            infof(data, \"%s\", CURL_TELOPT(j));\r\n          else if(CURL_TELCMD_OK(j))\r\n            infof(data, \"%s\", CURL_TELCMD(j));\r\n          else\r\n            infof(data, \"%d\", j);\r\n          infof(data, \", not IAC SE!) \");\r\n        }\r\n      }\r\n      length -= 2;\r\n    }\r\n    if(length < 1) {\r\n      infof(data, \"(Empty suboption?)\");\r\n      return;\r\n    }\r\n\r\n    if(CURL_TELOPT_OK(pointer[0])) {\r\n      switch(pointer[0]) {\r\n      case CURL_TELOPT_TTYPE:\r\n      case CURL_TELOPT_XDISPLOC:\r\n      case CURL_TELOPT_NEW_ENVIRON:\r\n      case CURL_TELOPT_NAWS:\r\n        infof(data, \"%s\", CURL_TELOPT(pointer[0]));\r\n        break;\r\n      default:\r\n        infof(data, \"%s (unsupported)\", CURL_TELOPT(pointer[0]));\r\n        break;\r\n      }\r\n    }\r\n    else\r\n      infof(data, \"%d (unknown)\", pointer[i]);\r\n\r\n    switch(pointer[0]) {\r\n    case CURL_TELOPT_NAWS:\r\n      pval = (unsigned short*)(pointer+1);\r\n      infof(data, \"Width: %hu ; Height: %hu\",\r\n            ntohs(pval[0]), ntohs(pval[1]));\r\n      break;\r\n    default:\r\n      switch(pointer[1]) {\r\n      case CURL_TELQUAL_IS:\r\n        infof(data, \" IS\");\r\n        break;\r\n      case CURL_TELQUAL_SEND:\r\n        infof(data, \" SEND\");\r\n        break;\r\n      case CURL_TELQUAL_INFO:\r\n        infof(data, \" INFO/REPLY\");\r\n        break;\r\n      case CURL_TELQUAL_NAME:\r\n        infof(data, \" NAME\");\r\n        break;\r\n      }\r\n\r\n      switch(pointer[0]) {\r\n      case CURL_TELOPT_TTYPE:\r\n      case CURL_TELOPT_XDISPLOC:\r\n        pointer[length] = 0;\r\n        infof(data, \" \\\"%s\\\"\", &pointer[2]);\r\n        break;\r\n      case CURL_TELOPT_NEW_ENVIRON:\r\n        if(pointer[1] == CURL_TELQUAL_IS) {\r\n          infof(data, \" \");\r\n          for(i = 3;i < length;i++) {\r\n            switch(pointer[i]) {\r\n            case CURL_NEW_ENV_VAR:\r\n              infof(data, \", \");\r\n              break;\r\n            case CURL_NEW_ENV_VALUE:\r\n              infof(data, \" = \");\r\n              break;\r\n            default:\r\n              infof(data, \"%c\", pointer[i]);\r\n              break;\r\n            }\r\n          }\r\n        }\r\n        break;\r\n      default:\r\n        for(i = 2; i < length; i++)\r\n          infof(data, \" %.2x\", pointer[i]);\r\n        break;\r\n      }\r\n    }\r\n    if(direction)\r\n      infof(data, \"\\n\");\r\n  }\r\n}\r\n\r\nstatic CURLcode check_telnet_options(struct connectdata *conn)\r\n{\r\n  struct curl_slist *head;\r\n  struct curl_slist *beg;\r\n  char option_keyword[128];\r\n  char option_arg[256];\r\n  struct SessionHandle *data = conn->data;\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  CURLcode result = CURLE_OK;\r\n  int binary_option;\r\n\r\n  /* Add the user name as an environment variable if it\r\n     was given on the command line */\r\n  if(conn->bits.user_passwd) {\r\n    snprintf(option_arg, sizeof(option_arg), \"USER,%s\", conn->user);\r\n    beg = curl_slist_append(tn->telnet_vars, option_arg);\r\n    if(!beg) {\r\n      curl_slist_free_all(tn->telnet_vars);\r\n      tn->telnet_vars = NULL;\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n    tn->telnet_vars = beg;\r\n    tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES;\r\n  }\r\n\r\n  for(head = data->set.telnet_options; head; head=head->next) {\r\n    if(sscanf(head->data, \"%127[^= ]%*[ =]%255s\",\r\n              option_keyword, option_arg) == 2) {\r\n\r\n      /* Terminal type */\r\n      if(Curl_raw_equal(option_keyword, \"TTYPE\")) {\r\n        strncpy(tn->subopt_ttype, option_arg, 31);\r\n        tn->subopt_ttype[31] = 0; /* String termination */\r\n        tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;\r\n        continue;\r\n      }\r\n\r\n      /* Display variable */\r\n      if(Curl_raw_equal(option_keyword, \"XDISPLOC\")) {\r\n        strncpy(tn->subopt_xdisploc, option_arg, 127);\r\n        tn->subopt_xdisploc[127] = 0; /* String termination */\r\n        tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;\r\n        continue;\r\n      }\r\n\r\n      /* Environment variable */\r\n      if(Curl_raw_equal(option_keyword, \"NEW_ENV\")) {\r\n        beg = curl_slist_append(tn->telnet_vars, option_arg);\r\n        if(!beg) {\r\n          result = CURLE_OUT_OF_MEMORY;\r\n          break;\r\n        }\r\n        tn->telnet_vars = beg;\r\n        tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES;\r\n        continue;\r\n      }\r\n\r\n          /* Window Size */\r\n      if(Curl_raw_equal(option_keyword, \"WS\")) {\r\n        if(sscanf(option_arg, \"%hu%*[xX]%hu\",\r\n                  &tn->subopt_wsx, &tn->subopt_wsy) == 2)\r\n          tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES;\r\n        else {\r\n          failf(data, \"Syntax error in telnet option: %s\", head->data);\r\n          result = CURLE_TELNET_OPTION_SYNTAX;\r\n          break;\r\n        }\r\n        continue;\r\n      }\r\n\r\n      /* To take care or not of the 8th bit in data exchange */\r\n      if(Curl_raw_equal(option_keyword, \"BINARY\")) {\r\n        binary_option=atoi(option_arg);\r\n        if(binary_option!=1) {\r\n          tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO;\r\n          tn->him_preferred[CURL_TELOPT_BINARY] = CURL_NO;\r\n        }\r\n        continue;\r\n      }\r\n\r\n      failf(data, \"Unknown telnet option %s\", head->data);\r\n      result = CURLE_UNKNOWN_TELNET_OPTION;\r\n      break;\r\n    }\r\n    else {\r\n      failf(data, \"Syntax error in telnet option: %s\", head->data);\r\n      result = CURLE_TELNET_OPTION_SYNTAX;\r\n      break;\r\n    }\r\n  }\r\n\r\n  if(result) {\r\n    curl_slist_free_all(tn->telnet_vars);\r\n    tn->telnet_vars = NULL;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * suboption()\r\n *\r\n * Look at the sub-option buffer, and try to be helpful to the other\r\n * side.\r\n */\r\n\r\nstatic void suboption(struct connectdata *conn)\r\n{\r\n  struct curl_slist *v;\r\n  unsigned char temp[2048];\r\n  ssize_t bytes_written;\r\n  size_t len;\r\n  size_t tmplen;\r\n  int err;\r\n  char varname[128];\r\n  char varval[128];\r\n  struct SessionHandle *data = conn->data;\r\n  struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;\r\n\r\n  printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2);\r\n  switch (CURL_SB_GET(tn)) {\r\n    case CURL_TELOPT_TTYPE:\r\n      len = strlen(tn->subopt_ttype) + 4 + 2;\r\n      snprintf((char *)temp, sizeof(temp),\r\n               \"%c%c%c%c%s%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE,\r\n               CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE);\r\n      bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);\r\n      if(bytes_written < 0) {\r\n        err = SOCKERRNO;\r\n        failf(data,\"Sending data failed (%d)\",err);\r\n      }\r\n      printsub(data, '>', &temp[2], len-2);\r\n      break;\r\n    case CURL_TELOPT_XDISPLOC:\r\n      len = strlen(tn->subopt_xdisploc) + 4 + 2;\r\n      snprintf((char *)temp, sizeof(temp),\r\n               \"%c%c%c%c%s%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC,\r\n               CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE);\r\n      bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);\r\n      if(bytes_written < 0) {\r\n        err = SOCKERRNO;\r\n        failf(data,\"Sending data failed (%d)\",err);\r\n      }\r\n      printsub(data, '>', &temp[2], len-2);\r\n      break;\r\n    case CURL_TELOPT_NEW_ENVIRON:\r\n      snprintf((char *)temp, sizeof(temp),\r\n               \"%c%c%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON,\r\n               CURL_TELQUAL_IS);\r\n      len = 4;\r\n\r\n      for(v = tn->telnet_vars;v;v = v->next) {\r\n        tmplen = (strlen(v->data) + 1);\r\n        /* Add the variable only if it fits */\r\n        if(len + tmplen < (int)sizeof(temp)-6) {\r\n          sscanf(v->data, \"%127[^,],%127s\", varname, varval);\r\n          snprintf((char *)&temp[len], sizeof(temp) - len,\r\n                   \"%c%s%c%s\", CURL_NEW_ENV_VAR, varname,\r\n                   CURL_NEW_ENV_VALUE, varval);\r\n          len += tmplen;\r\n        }\r\n      }\r\n      snprintf((char *)&temp[len], sizeof(temp) - len,\r\n               \"%c%c\", CURL_IAC, CURL_SE);\r\n      len += 2;\r\n      bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);\r\n      if(bytes_written < 0) {\r\n        err = SOCKERRNO;\r\n        failf(data,\"Sending data failed (%d)\",err);\r\n      }\r\n      printsub(data, '>', &temp[2], len-2);\r\n      break;\r\n  }\r\n  return;\r\n}\r\n\r\n\r\n/*\r\n * sendsuboption()\r\n *\r\n * Send suboption information to the server side.\r\n */\r\n\r\nstatic void sendsuboption(struct connectdata *conn, int option)\r\n{\r\n  ssize_t bytes_written;\r\n  int err;\r\n  unsigned short x, y;\r\n  unsigned char*uc1, *uc2;\r\n\r\n  struct SessionHandle *data = conn->data;\r\n  struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;\r\n\r\n  switch (option) {\r\n  case CURL_TELOPT_NAWS:\r\n    /* We prepare data to be sent */\r\n    CURL_SB_CLEAR(tn);\r\n    CURL_SB_ACCUM(tn, CURL_IAC);\r\n    CURL_SB_ACCUM(tn, CURL_SB);\r\n    CURL_SB_ACCUM(tn, CURL_TELOPT_NAWS);\r\n    /* We must deal either with litte or big endien processors */\r\n    /* Window size must be sent according to the 'network order' */\r\n    x=htons(tn->subopt_wsx);\r\n    y=htons(tn->subopt_wsy);\r\n    uc1 = (unsigned char*)&x;\r\n    uc2 = (unsigned char*)&y;\r\n    CURL_SB_ACCUM(tn, uc1[0]);\r\n    CURL_SB_ACCUM(tn, uc1[1]);\r\n    CURL_SB_ACCUM(tn, uc2[0]);\r\n    CURL_SB_ACCUM(tn, uc2[1]);\r\n\r\n    CURL_SB_ACCUM(tn, CURL_IAC);\r\n    CURL_SB_ACCUM(tn, CURL_SE);\r\n    CURL_SB_TERM(tn);\r\n    /* data suboption is now ready */\r\n\r\n    printsub(data, '>', (unsigned char *)tn->subbuffer+2,\r\n             CURL_SB_LEN(tn)-2);\r\n\r\n    /* we send the header of the suboption... */\r\n    bytes_written = swrite(conn->sock[FIRSTSOCKET], tn->subbuffer, 3);\r\n    if(bytes_written < 0) {\r\n      err = SOCKERRNO;\r\n      failf(data, \"Sending data failed (%d)\", err);\r\n    }\r\n    /* ... then the window size with the send_telnet_data() function\r\n       to deal with 0xFF cases ... */\r\n    send_telnet_data(conn, (char *)tn->subbuffer+3, 4);\r\n    /* ... and the footer */\r\n    bytes_written = swrite(conn->sock[FIRSTSOCKET], tn->subbuffer+7, 2);\r\n    if(bytes_written < 0) {\r\n      err = SOCKERRNO;\r\n      failf(data, \"Sending data failed (%d)\", err);\r\n    }\r\n    break;\r\n  }\r\n}\r\n\r\n\r\nstatic\r\nCURLcode telrcv(struct connectdata *conn,\r\n                const unsigned char *inbuf, /* Data received from socket */\r\n                ssize_t count)              /* Number of bytes received */\r\n{\r\n  unsigned char c;\r\n  CURLcode result;\r\n  int in = 0;\r\n  int startwrite=-1;\r\n  struct SessionHandle *data = conn->data;\r\n  struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;\r\n\r\n#define startskipping()                                       \\\r\n  if(startwrite >= 0) {                                       \\\r\n    result = Curl_client_write(conn,                          \\\r\n                               CLIENTWRITE_BODY,              \\\r\n                               (char *)&inbuf[startwrite],    \\\r\n                               in-startwrite);                \\\r\n    if(result != CURLE_OK)                                    \\\r\n      return result;                                          \\\r\n  }                                                           \\\r\n  startwrite = -1\r\n\r\n#define writebyte() \\\r\n    if(startwrite < 0) \\\r\n      startwrite = in\r\n\r\n#define bufferflush() startskipping()\r\n\r\n  while(count--) {\r\n    c = inbuf[in];\r\n\r\n    switch (tn->telrcv_state) {\r\n    case CURL_TS_CR:\r\n      tn->telrcv_state = CURL_TS_DATA;\r\n      if(c == '\\0') {\r\n        startskipping();\r\n        break;   /* Ignore \\0 after CR */\r\n      }\r\n      writebyte();\r\n      break;\r\n\r\n    case CURL_TS_DATA:\r\n      if(c == CURL_IAC) {\r\n        tn->telrcv_state = CURL_TS_IAC;\r\n        startskipping();\r\n        break;\r\n      }\r\n      else if(c == '\\r')\r\n        tn->telrcv_state = CURL_TS_CR;\r\n      writebyte();\r\n      break;\r\n\r\n    case CURL_TS_IAC:\r\n    process_iac:\r\n      DEBUGASSERT(startwrite < 0);\r\n      switch (c) {\r\n      case CURL_WILL:\r\n        tn->telrcv_state = CURL_TS_WILL;\r\n        break;\r\n      case CURL_WONT:\r\n        tn->telrcv_state = CURL_TS_WONT;\r\n        break;\r\n      case CURL_DO:\r\n        tn->telrcv_state = CURL_TS_DO;\r\n        break;\r\n      case CURL_DONT:\r\n        tn->telrcv_state = CURL_TS_DONT;\r\n        break;\r\n      case CURL_SB:\r\n        CURL_SB_CLEAR(tn);\r\n        tn->telrcv_state = CURL_TS_SB;\r\n        break;\r\n      case CURL_IAC:\r\n        tn->telrcv_state = CURL_TS_DATA;\r\n        writebyte();\r\n        break;\r\n      case CURL_DM:\r\n      case CURL_NOP:\r\n      case CURL_GA:\r\n      default:\r\n        tn->telrcv_state = CURL_TS_DATA;\r\n        printoption(data, \"RCVD\", CURL_IAC, c);\r\n        break;\r\n      }\r\n      break;\r\n\r\n      case CURL_TS_WILL:\r\n        printoption(data, \"RCVD\", CURL_WILL, c);\r\n        tn->please_negotiate = 1;\r\n        rec_will(conn, c);\r\n        tn->telrcv_state = CURL_TS_DATA;\r\n        break;\r\n\r\n      case CURL_TS_WONT:\r\n        printoption(data, \"RCVD\", CURL_WONT, c);\r\n        tn->please_negotiate = 1;\r\n        rec_wont(conn, c);\r\n        tn->telrcv_state = CURL_TS_DATA;\r\n        break;\r\n\r\n      case CURL_TS_DO:\r\n        printoption(data, \"RCVD\", CURL_DO, c);\r\n        tn->please_negotiate = 1;\r\n        rec_do(conn, c);\r\n        tn->telrcv_state = CURL_TS_DATA;\r\n        break;\r\n\r\n      case CURL_TS_DONT:\r\n        printoption(data, \"RCVD\", CURL_DONT, c);\r\n        tn->please_negotiate = 1;\r\n        rec_dont(conn, c);\r\n        tn->telrcv_state = CURL_TS_DATA;\r\n        break;\r\n\r\n      case CURL_TS_SB:\r\n        if(c == CURL_IAC)\r\n          tn->telrcv_state = CURL_TS_SE;\r\n        else\r\n          CURL_SB_ACCUM(tn,c);\r\n        break;\r\n\r\n      case CURL_TS_SE:\r\n        if(c != CURL_SE) {\r\n          if(c != CURL_IAC) {\r\n            /*\r\n             * This is an error.  We only expect to get \"IAC IAC\" or \"IAC SE\".\r\n             * Several things may have happened.  An IAC was not doubled, the\r\n             * IAC SE was left off, or another option got inserted into the\r\n             * suboption are all possibilities.  If we assume that the IAC was\r\n             * not doubled, and really the IAC SE was left off, we could get\r\n             * into an infinate loop here.  So, instead, we terminate the\r\n             * suboption, and process the partial suboption if we can.\r\n             */\r\n            CURL_SB_ACCUM(tn, CURL_IAC);\r\n            CURL_SB_ACCUM(tn, c);\r\n            tn->subpointer -= 2;\r\n            CURL_SB_TERM(tn);\r\n\r\n            printoption(data, \"In SUBOPTION processing, RCVD\", CURL_IAC, c);\r\n            suboption(conn);   /* handle sub-option */\r\n            tn->telrcv_state = CURL_TS_IAC;\r\n            goto process_iac;\r\n          }\r\n          CURL_SB_ACCUM(tn,c);\r\n          tn->telrcv_state = CURL_TS_SB;\r\n        }\r\n        else\r\n        {\r\n          CURL_SB_ACCUM(tn, CURL_IAC);\r\n          CURL_SB_ACCUM(tn, CURL_SE);\r\n          tn->subpointer -= 2;\r\n          CURL_SB_TERM(tn);\r\n          suboption(conn);   /* handle sub-option */\r\n          tn->telrcv_state = CURL_TS_DATA;\r\n        }\r\n        break;\r\n    }\r\n    ++in;\r\n  }\r\n  bufferflush();\r\n  return CURLE_OK;\r\n}\r\n\r\n/* Escape and send a telnet data block */\r\n/* TODO: write large chunks of data instead of one byte at a time */\r\nstatic CURLcode send_telnet_data(struct connectdata *conn,\r\n                                 char *buffer, ssize_t nread)\r\n{\r\n  unsigned char outbuf[2];\r\n  ssize_t bytes_written, total_written;\r\n  int out_count;\r\n  CURLcode rc = CURLE_OK;\r\n\r\n  while(rc == CURLE_OK && nread--) {\r\n    outbuf[0] = *buffer++;\r\n    out_count = 1;\r\n    if(outbuf[0] == CURL_IAC)\r\n      outbuf[out_count++] = CURL_IAC;\r\n\r\n    total_written = 0;\r\n    do {\r\n      /* Make sure socket is writable to avoid EWOULDBLOCK condition */\r\n      struct pollfd pfd[1];\r\n      pfd[0].fd = conn->sock[FIRSTSOCKET];\r\n      pfd[0].events = POLLOUT;\r\n      switch (Curl_poll(pfd, 1, -1)) {\r\n        case -1:                    /* error, abort writing */\r\n        case 0:                     /* timeout (will never happen) */\r\n          rc = CURLE_SEND_ERROR;\r\n          break;\r\n        default:                    /* write! */\r\n          bytes_written = 0;\r\n          rc = Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf+total_written,\r\n                          out_count-total_written, &bytes_written);\r\n          total_written += bytes_written;\r\n          break;\r\n      }\r\n    /* handle partial write */\r\n    } while(rc == CURLE_OK && total_written < out_count);\r\n  }\r\n  return rc;\r\n}\r\n\r\nstatic CURLcode telnet_done(struct connectdata *conn,\r\n                                 CURLcode status, bool premature)\r\n{\r\n  struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;\r\n  (void)status; /* unused */\r\n  (void)premature; /* not used */\r\n\r\n  if(!tn)\r\n    return CURLE_OK;\r\n\r\n  curl_slist_free_all(tn->telnet_vars);\r\n  tn->telnet_vars = NULL;\r\n\r\n  Curl_safefree(conn->data->state.proto.telnet);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode telnet_do(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode code;\r\n  struct SessionHandle *data = conn->data;\r\n  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];\r\n#ifdef USE_WINSOCK\r\n  HMODULE wsock2;\r\n  WSOCK2_FUNC close_event_func;\r\n  WSOCK2_FUNC create_event_func;\r\n  WSOCK2_FUNC event_select_func;\r\n  WSOCK2_FUNC enum_netevents_func;\r\n  WSAEVENT event_handle;\r\n  WSANETWORKEVENTS events;\r\n  HANDLE stdin_handle;\r\n  HANDLE objs[2];\r\n  DWORD  obj_count;\r\n  DWORD  wait_timeout;\r\n  DWORD waitret;\r\n  DWORD readfile_read;\r\n  int err;\r\n#else\r\n  int interval_ms;\r\n  struct pollfd pfd[2];\r\n  int poll_cnt;\r\n  curl_off_t total_dl = 0;\r\n  curl_off_t total_ul = 0;\r\n#endif\r\n  ssize_t nread;\r\n  struct timeval now;\r\n  bool keepon = TRUE;\r\n  char *buf = data->state.buffer;\r\n  struct TELNET *tn;\r\n\r\n  *done = TRUE; /* unconditionally */\r\n\r\n  code = init_telnet(conn);\r\n  if(code)\r\n    return code;\r\n\r\n  tn = (struct TELNET *)data->state.proto.telnet;\r\n\r\n  code = check_telnet_options(conn);\r\n  if(code)\r\n    return code;\r\n\r\n#ifdef USE_WINSOCK\r\n  /*\r\n  ** This functionality only works with WinSock >= 2.0.  So,\r\n  ** make sure have it.\r\n  */\r\n  code = check_wsock2(data);\r\n  if(code)\r\n    return code;\r\n\r\n  /* OK, so we have WinSock 2.0.  We need to dynamically */\r\n  /* load ws2_32.dll and get the function pointers we need. */\r\n  wsock2 = LoadLibrary(TEXT(\"WS2_32.DLL\"));\r\n  if(wsock2 == NULL) {\r\n    failf(data,\"failed to load WS2_32.DLL (%d)\", ERRNO);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* Grab a pointer to WSACreateEvent */\r\n  create_event_func = GetProcAddress(wsock2,\"WSACreateEvent\");\r\n  if(create_event_func == NULL) {\r\n    failf(data,\"failed to find WSACreateEvent function (%d)\",\r\n          ERRNO);\r\n    FreeLibrary(wsock2);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* And WSACloseEvent */\r\n  close_event_func = GetProcAddress(wsock2,\"WSACloseEvent\");\r\n  if(close_event_func == NULL) {\r\n    failf(data,\"failed to find WSACloseEvent function (%d)\",\r\n          ERRNO);\r\n    FreeLibrary(wsock2);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* And WSAEventSelect */\r\n  event_select_func = GetProcAddress(wsock2,\"WSAEventSelect\");\r\n  if(event_select_func == NULL) {\r\n    failf(data,\"failed to find WSAEventSelect function (%d)\",\r\n          ERRNO);\r\n    FreeLibrary(wsock2);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* And WSAEnumNetworkEvents */\r\n  enum_netevents_func = GetProcAddress(wsock2,\"WSAEnumNetworkEvents\");\r\n  if(enum_netevents_func == NULL) {\r\n    failf(data,\"failed to find WSAEnumNetworkEvents function (%d)\",\r\n          ERRNO);\r\n    FreeLibrary(wsock2);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* We want to wait for both stdin and the socket. Since\r\n  ** the select() function in winsock only works on sockets\r\n  ** we have to use the WaitForMultipleObjects() call.\r\n  */\r\n\r\n  /* First, create a sockets event object */\r\n  event_handle = (WSAEVENT)create_event_func();\r\n  if(event_handle == WSA_INVALID_EVENT) {\r\n    failf(data,\"WSACreateEvent failed (%d)\", SOCKERRNO);\r\n    FreeLibrary(wsock2);\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* Tell winsock what events we want to listen to */\r\n  if(event_select_func(sockfd, event_handle, FD_READ|FD_CLOSE) ==\r\n     SOCKET_ERROR) {\r\n    close_event_func(event_handle);\r\n    FreeLibrary(wsock2);\r\n    return CURLE_OK;\r\n  }\r\n\r\n  /* The get the Windows file handle for stdin */\r\n  stdin_handle = GetStdHandle(STD_INPUT_HANDLE);\r\n\r\n  /* Create the list of objects to wait for */\r\n  objs[0] = event_handle;\r\n  objs[1] = stdin_handle;\r\n\r\n  /* If stdin_handle is a pipe, use PeekNamedPipe() method to check it,\r\n     else use the old WaitForMultipleObjects() way */\r\n  if(GetFileType(stdin_handle) == FILE_TYPE_PIPE ||\r\n     data->set.is_fread_set) {\r\n    /* Don't wait for stdin_handle, just wait for event_handle */\r\n    obj_count = 1;\r\n    /* Check stdin_handle per 100 milliseconds */\r\n    wait_timeout = 100;\r\n  }\r\n  else {\r\n    obj_count = 2;\r\n    wait_timeout = 1000;\r\n  }\r\n\r\n  /* Keep on listening and act on events */\r\n  while(keepon) {\r\n    waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout);\r\n    switch(waitret) {\r\n    case WAIT_TIMEOUT:\r\n    {\r\n      for(;;) {\r\n        if(obj_count == 1) {\r\n          /* read from user-supplied method */\r\n          code = (int)conn->fread_func(buf, 1, BUFSIZE - 1, conn->fread_in);\r\n          if(code == CURL_READFUNC_ABORT) {\r\n            keepon = FALSE;\r\n            code = CURLE_READ_ERROR;\r\n            break;\r\n          }\r\n\r\n          if(code == CURL_READFUNC_PAUSE)\r\n            break;\r\n\r\n          if(code == 0)                        /* no bytes */\r\n            break;\r\n\r\n          readfile_read = code; /* fall thru with number of bytes read */\r\n        }\r\n        else {\r\n          /* read from stdin */\r\n          if(!PeekNamedPipe(stdin_handle, NULL, 0, NULL,\r\n                            &readfile_read, NULL)) {\r\n            keepon = FALSE;\r\n            code = CURLE_READ_ERROR;\r\n            break;\r\n          }\r\n\r\n          if(!readfile_read)\r\n            break;\r\n\r\n          if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),\r\n                       &readfile_read, NULL)) {\r\n            keepon = FALSE;\r\n            code = CURLE_READ_ERROR;\r\n            break;\r\n          }\r\n        }\r\n\r\n        code = send_telnet_data(conn, buf, readfile_read);\r\n        if(code) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n    break;\r\n\r\n    case WAIT_OBJECT_0 + 1:\r\n    {\r\n      if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),\r\n                   &readfile_read, NULL)) {\r\n        keepon = FALSE;\r\n        code = CURLE_READ_ERROR;\r\n        break;\r\n      }\r\n\r\n      code = send_telnet_data(conn, buf, readfile_read);\r\n      if(code) {\r\n        keepon = FALSE;\r\n        break;\r\n      }\r\n    }\r\n    break;\r\n\r\n    case WAIT_OBJECT_0:\r\n\r\n      if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) {\r\n        if((err = SOCKERRNO) != EINPROGRESS) {\r\n          infof(data,\"WSAEnumNetworkEvents failed (%d)\", err);\r\n          keepon = FALSE;\r\n          code = CURLE_READ_ERROR;\r\n        }\r\n        break;\r\n      }\r\n      if(events.lNetworkEvents & FD_READ) {\r\n        /* read data from network */\r\n        code = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);\r\n        /* read would've blocked. Loop again */\r\n        if(code == CURLE_AGAIN)\r\n          break;\r\n        /* returned not-zero, this an error */\r\n        else if(code) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n        /* returned zero but actually received 0 or less here,\r\n           the server closed the connection and we bail out */\r\n        else if(nread <= 0) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n\r\n        code = telrcv(conn, (unsigned char *)buf, nread);\r\n        if(code) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n\r\n        /* Negotiate if the peer has started negotiating,\r\n           otherwise don't. We don't want to speak telnet with\r\n           non-telnet servers, like POP or SMTP. */\r\n        if(tn->please_negotiate && !tn->already_negotiated) {\r\n          negotiate(conn);\r\n          tn->already_negotiated = 1;\r\n        }\r\n      }\r\n      if(events.lNetworkEvents & FD_CLOSE) {\r\n        keepon = FALSE;\r\n      }\r\n      break;\r\n\r\n    }\r\n\r\n    if(data->set.timeout) {\r\n      now = Curl_tvnow();\r\n      if(Curl_tvdiff(now, conn->created) >= data->set.timeout) {\r\n        failf(data, \"Time-out\");\r\n        code = CURLE_OPERATION_TIMEDOUT;\r\n        keepon = FALSE;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* We called WSACreateEvent, so call WSACloseEvent */\r\n  if(!close_event_func(event_handle)) {\r\n    infof(data,\"WSACloseEvent failed (%d)\", SOCKERRNO);\r\n  }\r\n\r\n  /* \"Forget\" pointers into the library we're about to free */\r\n  create_event_func = NULL;\r\n  close_event_func = NULL;\r\n  event_select_func = NULL;\r\n  enum_netevents_func = NULL;\r\n\r\n  /* We called LoadLibrary, so call FreeLibrary */\r\n  if(!FreeLibrary(wsock2))\r\n    infof(data,\"FreeLibrary(wsock2) failed (%d)\", ERRNO);\r\n#else\r\n  pfd[0].fd = sockfd;\r\n  pfd[0].events = POLLIN;\r\n\r\n  if(conn->fread_func != (curl_read_callback)fread) {\r\n    poll_cnt = 1;\r\n    interval_ms = 100; /* poll user-supplied read function */\r\n  }\r\n  else {\r\n    /* really using fread, so infile is a FILE* */\r\n    pfd[1].fd = fileno((FILE *)conn->fread_in);\r\n    pfd[1].events = POLLIN;\r\n    poll_cnt = 2;\r\n    interval_ms = 1 * 1000;\r\n  }\r\n\r\n  while(keepon) {\r\n    switch (Curl_poll(pfd, poll_cnt, interval_ms)) {\r\n    case -1:                    /* error, stop reading */\r\n      keepon = FALSE;\r\n      continue;\r\n    case 0:                     /* timeout */\r\n      pfd[0].revents = 0;\r\n      pfd[1].revents = 0;\r\n      /* fall through */\r\n    default:                    /* read! */\r\n      if(pfd[0].revents & POLLIN) {\r\n        /* read data from network */\r\n        code = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);\r\n        /* read would've blocked. Loop again */\r\n        if(code == CURLE_AGAIN)\r\n          break;\r\n        /* returned not-zero, this an error */\r\n        else if(code) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n        /* returned zero but actually received 0 or less here,\r\n           the server closed the connection and we bail out */\r\n        else if(nread <= 0) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n\r\n        total_dl += nread;\r\n        Curl_pgrsSetDownloadCounter(data, total_dl);\r\n        code = telrcv(conn, (unsigned char *)buf, nread);\r\n        if(code) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n\r\n        /* Negotiate if the peer has started negotiating,\r\n           otherwise don't. We don't want to speak telnet with\r\n           non-telnet servers, like POP or SMTP. */\r\n        if(tn->please_negotiate && !tn->already_negotiated) {\r\n          negotiate(conn);\r\n          tn->already_negotiated = 1;\r\n        }\r\n      }\r\n\r\n      nread = 0;\r\n      if(poll_cnt == 2) {\r\n        if(pfd[1].revents & POLLIN) { /* read from in file */\r\n          nread = read(pfd[1].fd, buf, BUFSIZE - 1);\r\n        }\r\n      }\r\n      else {\r\n        /* read from user-supplied method */\r\n        nread = (int)conn->fread_func(buf, 1, BUFSIZE - 1, conn->fread_in);\r\n        if(nread == CURL_READFUNC_ABORT) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n        if(nread == CURL_READFUNC_PAUSE)\r\n          break;\r\n      }\r\n\r\n      if(nread > 0) {\r\n        code = send_telnet_data(conn, buf, nread);\r\n        if(code) {\r\n          keepon = FALSE;\r\n          break;\r\n        }\r\n        total_ul += nread;\r\n        Curl_pgrsSetUploadCounter(data, total_ul);\r\n      }\r\n      else if(nread < 0)\r\n        keepon = FALSE;\r\n\r\n      break;\r\n    } /* poll switch statement */\r\n\r\n    if(data->set.timeout) {\r\n      now = Curl_tvnow();\r\n      if(Curl_tvdiff(now, conn->created) >= data->set.timeout) {\r\n        failf(data, \"Time-out\");\r\n        code = CURLE_OPERATION_TIMEDOUT;\r\n        keepon = FALSE;\r\n      }\r\n    }\r\n\r\n    if(Curl_pgrsUpdate(conn)) {\r\n      code = CURLE_ABORTED_BY_CALLBACK;\r\n      break;\r\n    }\r\n  }\r\n#endif\r\n  /* mark this as \"no further transfer wanted\" */\r\n  Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n\r\n  return code;\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/telnet.h",
    "content": "#ifndef HEADER_CURL_TELNET_H\r\n#define HEADER_CURL_TELNET_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifndef CURL_DISABLE_TELNET\r\nextern const struct Curl_handler Curl_handler_telnet;\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TELNET_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/tftp.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_TFTP\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n#include \"tftp.h\"\r\n#include \"progress.h\"\r\n#include \"connect.h\"\r\n#include \"strerror.h\"\r\n#include \"sockaddr.h\" /* required for Curl_sockaddr_storage */\r\n#include \"multiif.h\"\r\n#include \"url.h\"\r\n#include \"rawstr.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n#include \"select.h\"\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* RFC2348 allows the block size to be negotiated */\r\n#define TFTP_BLKSIZE_DEFAULT 512\r\n#define TFTP_BLKSIZE_MIN 8\r\n#define TFTP_BLKSIZE_MAX 65464\r\n#define TFTP_OPTION_BLKSIZE \"blksize\"\r\n\r\n/* from RFC2349: */\r\n#define TFTP_OPTION_TSIZE    \"tsize\"\r\n#define TFTP_OPTION_INTERVAL \"timeout\"\r\n\r\ntypedef enum {\r\n  TFTP_MODE_NETASCII=0,\r\n  TFTP_MODE_OCTET\r\n} tftp_mode_t;\r\n\r\ntypedef enum {\r\n  TFTP_STATE_START=0,\r\n  TFTP_STATE_RX,\r\n  TFTP_STATE_TX,\r\n  TFTP_STATE_FIN\r\n} tftp_state_t;\r\n\r\ntypedef enum {\r\n  TFTP_EVENT_NONE = -1,\r\n  TFTP_EVENT_INIT = 0,\r\n  TFTP_EVENT_RRQ = 1,\r\n  TFTP_EVENT_WRQ = 2,\r\n  TFTP_EVENT_DATA = 3,\r\n  TFTP_EVENT_ACK = 4,\r\n  TFTP_EVENT_ERROR = 5,\r\n  TFTP_EVENT_OACK = 6,\r\n  TFTP_EVENT_TIMEOUT\r\n} tftp_event_t;\r\n\r\ntypedef enum {\r\n  TFTP_ERR_UNDEF=0,\r\n  TFTP_ERR_NOTFOUND,\r\n  TFTP_ERR_PERM,\r\n  TFTP_ERR_DISKFULL,\r\n  TFTP_ERR_ILLEGAL,\r\n  TFTP_ERR_UNKNOWNID,\r\n  TFTP_ERR_EXISTS,\r\n  TFTP_ERR_NOSUCHUSER,  /* This will never be triggered by this code */\r\n\r\n  /* The remaining error codes are internal to curl */\r\n  TFTP_ERR_NONE = -100,\r\n  TFTP_ERR_TIMEOUT,\r\n  TFTP_ERR_NORESPONSE\r\n} tftp_error_t;\r\n\r\ntypedef struct tftp_packet {\r\n  unsigned char *data;\r\n} tftp_packet_t;\r\n\r\ntypedef struct tftp_state_data {\r\n  tftp_state_t    state;\r\n  tftp_mode_t     mode;\r\n  tftp_error_t    error;\r\n  tftp_event_t    event;\r\n  struct connectdata      *conn;\r\n  curl_socket_t   sockfd;\r\n  int             retries;\r\n  int             retry_time;\r\n  int             retry_max;\r\n  time_t          start_time;\r\n  time_t          max_time;\r\n  time_t          rx_time;\r\n  unsigned short  block;\r\n  struct Curl_sockaddr_storage   local_addr;\r\n  struct Curl_sockaddr_storage   remote_addr;\r\n  curl_socklen_t  remote_addrlen;\r\n  int             rbytes;\r\n  int             sbytes;\r\n  int             blksize;\r\n  int             requested_blksize;\r\n  tftp_packet_t   rpacket;\r\n  tftp_packet_t   spacket;\r\n} tftp_state_data_t;\r\n\r\n\r\n/* Forward declarations */\r\nstatic CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) ;\r\nstatic CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) ;\r\nstatic CURLcode tftp_connect(struct connectdata *conn, bool *done);\r\nstatic CURLcode tftp_disconnect(struct connectdata *conn,\r\n                                bool dead_connection);\r\nstatic CURLcode tftp_do(struct connectdata *conn, bool *done);\r\nstatic CURLcode tftp_done(struct connectdata *conn,\r\n                          CURLcode, bool premature);\r\nstatic CURLcode tftp_setup_connection(struct connectdata * conn);\r\nstatic CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done);\r\nstatic CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done);\r\nstatic int tftp_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks);\r\nstatic CURLcode tftp_translate_code(tftp_error_t error);\r\n\r\n\r\n/*\r\n * TFTP protocol handler.\r\n */\r\n\r\nconst struct Curl_handler Curl_handler_tftp = {\r\n  \"TFTP\",                               /* scheme */\r\n  tftp_setup_connection,                /* setup_connection */\r\n  tftp_do,                              /* do_it */\r\n  tftp_done,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  tftp_connect,                         /* connect_it */\r\n  tftp_multi_statemach,                 /* connecting */\r\n  tftp_doing,                           /* doing */\r\n  tftp_getsock,                         /* proto_getsock */\r\n  tftp_getsock,                         /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  tftp_disconnect,                      /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  PORT_TFTP,                            /* defport */\r\n  CURLPROTO_TFTP,                       /* protocol */\r\n  PROTOPT_NONE | PROTOPT_NOURLQUERY     /* flags */\r\n};\r\n\r\n/**********************************************************\r\n *\r\n * tftp_set_timeouts -\r\n *\r\n * Set timeouts based on state machine state.\r\n * Use user provided connect timeouts until DATA or ACK\r\n * packet is received, then use user-provided transfer timeouts\r\n *\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_set_timeouts(tftp_state_data_t *state)\r\n{\r\n  time_t maxtime, timeout;\r\n  long timeout_ms;\r\n  bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE;\r\n\r\n  time(&state->start_time);\r\n\r\n  /* Compute drop-dead time */\r\n  timeout_ms = Curl_timeleft(state->conn->data, NULL, start);\r\n\r\n  if(timeout_ms < 0) {\r\n    /* time-out, bail out, go home */\r\n    failf(state->conn->data, \"Connection time-out\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n\r\n  if(start) {\r\n\r\n    maxtime = (time_t)(timeout_ms + 500) / 1000;\r\n    state->max_time = state->start_time+maxtime;\r\n\r\n    /* Set per-block timeout to total */\r\n    timeout = maxtime ;\r\n\r\n    /* Average restart after 5 seconds */\r\n    state->retry_max = (int)timeout/5;\r\n\r\n    if(state->retry_max < 1)\r\n      /* avoid division by zero below */\r\n      state->retry_max = 1;\r\n\r\n    /* Compute the re-start interval to suit the timeout */\r\n    state->retry_time = (int)timeout/state->retry_max;\r\n    if(state->retry_time<1)\r\n      state->retry_time=1;\r\n\r\n  }\r\n  else {\r\n    if(timeout_ms > 0)\r\n      maxtime = (time_t)(timeout_ms + 500) / 1000;\r\n    else\r\n      maxtime = 3600;\r\n\r\n    state->max_time = state->start_time+maxtime;\r\n\r\n    /* Set per-block timeout to total */\r\n    timeout = maxtime;\r\n\r\n    /* Average reposting an ACK after 5 seconds */\r\n    state->retry_max = (int)timeout/5;\r\n  }\r\n  /* But bound the total number */\r\n  if(state->retry_max<3)\r\n    state->retry_max=3;\r\n\r\n  if(state->retry_max>50)\r\n    state->retry_max=50;\r\n\r\n  /* Compute the re-ACK interval to suit the timeout */\r\n  state->retry_time = (int)(timeout/state->retry_max);\r\n  if(state->retry_time<1)\r\n    state->retry_time=1;\r\n\r\n  infof(state->conn->data,\r\n        \"set timeouts for state %d; Total %ld, retry %d maxtry %d\\n\",\r\n        (int)state->state, (long)(state->max_time-state->start_time),\r\n        state->retry_time, state->retry_max);\r\n\r\n  /* init RX time */\r\n  time(&state->rx_time);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_set_send_first\r\n *\r\n * Event handler for the START state\r\n *\r\n **********************************************************/\r\n\r\nstatic void setpacketevent(tftp_packet_t *packet, unsigned short num)\r\n{\r\n  packet->data[0] = (unsigned char)(num >> 8);\r\n  packet->data[1] = (unsigned char)(num & 0xff);\r\n}\r\n\r\n\r\nstatic void setpacketblock(tftp_packet_t *packet, unsigned short num)\r\n{\r\n  packet->data[2] = (unsigned char)(num >> 8);\r\n  packet->data[3] = (unsigned char)(num & 0xff);\r\n}\r\n\r\nstatic unsigned short getrpacketevent(const tftp_packet_t *packet)\r\n{\r\n  return (unsigned short)((packet->data[0] << 8) | packet->data[1]);\r\n}\r\n\r\nstatic unsigned short getrpacketblock(const tftp_packet_t *packet)\r\n{\r\n  return (unsigned short)((packet->data[2] << 8) | packet->data[3]);\r\n}\r\n\r\nstatic size_t Curl_strnlen(const char *string, size_t maxlen)\r\n{\r\n  const char *end = memchr (string, '\\0', maxlen);\r\n  return end ? (size_t) (end - string) : maxlen;\r\n}\r\n\r\nstatic const char *tftp_option_get(const char *buf, size_t len,\r\n                                   const char **option, const char **value)\r\n{\r\n  size_t loc;\r\n\r\n  loc = Curl_strnlen( buf, len );\r\n  loc++; /* NULL term */\r\n\r\n  if(loc >= len)\r\n    return NULL;\r\n  *option = buf;\r\n\r\n  loc += Curl_strnlen( buf+loc, len-loc );\r\n  loc++; /* NULL term */\r\n\r\n  if(loc > len)\r\n    return NULL;\r\n  *value = &buf[strlen(*option) + 1];\r\n\r\n  return &buf[loc];\r\n}\r\n\r\nstatic CURLcode tftp_parse_option_ack(tftp_state_data_t *state,\r\n                                      const char *ptr, int len)\r\n{\r\n  const char *tmp = ptr;\r\n  struct SessionHandle *data = state->conn->data;\r\n\r\n  /* if OACK doesn't contain blksize option, the default (512) must be used */\r\n  state->blksize = TFTP_BLKSIZE_DEFAULT;\r\n\r\n  while(tmp < ptr + len) {\r\n    const char *option, *value;\r\n\r\n    tmp = tftp_option_get(tmp, ptr + len - tmp, &option, &value);\r\n    if(tmp == NULL) {\r\n      failf(data, \"Malformed ACK packet, rejecting\");\r\n      return CURLE_TFTP_ILLEGAL;\r\n    }\r\n\r\n    infof(data, \"got option=(%s) value=(%s)\\n\", option, value);\r\n\r\n    if(checkprefix(option, TFTP_OPTION_BLKSIZE)) {\r\n      long blksize;\r\n\r\n      blksize = strtol( value, NULL, 10 );\r\n\r\n      if(!blksize) {\r\n        failf(data, \"invalid blocksize value in OACK packet\");\r\n        return CURLE_TFTP_ILLEGAL;\r\n      }\r\n      else if(blksize > TFTP_BLKSIZE_MAX) {\r\n        failf(data, \"%s (%d)\", \"blksize is larger than max supported\",\r\n              TFTP_BLKSIZE_MAX);\r\n        return CURLE_TFTP_ILLEGAL;\r\n      }\r\n      else if(blksize < TFTP_BLKSIZE_MIN) {\r\n        failf(data, \"%s (%d)\", \"blksize is smaller than min supported\",\r\n              TFTP_BLKSIZE_MIN);\r\n        return CURLE_TFTP_ILLEGAL;\r\n      }\r\n      else if(blksize > state->requested_blksize) {\r\n        /* could realloc pkt buffers here, but the spec doesn't call out\r\n         * support for the server requesting a bigger blksize than the client\r\n         * requests */\r\n        failf(data, \"%s (%ld)\",\r\n              \"server requested blksize larger than allocated\", blksize);\r\n        return CURLE_TFTP_ILLEGAL;\r\n      }\r\n\r\n      state->blksize = (int)blksize;\r\n      infof(data, \"%s (%d) %s (%d)\\n\", \"blksize parsed from OACK\",\r\n            state->blksize, \"requested\", state->requested_blksize);\r\n    }\r\n    else if(checkprefix(option, TFTP_OPTION_TSIZE)) {\r\n      long tsize = 0;\r\n\r\n      tsize = strtol( value, NULL, 10 );\r\n      infof(data, \"%s (%ld)\\n\", \"tsize parsed from OACK\", tsize);\r\n\r\n      /* tsize should be ignored on upload: Who cares about the size of the\r\n         remote file? */\r\n      if(!data->set.upload) {\r\n        if(!tsize) {\r\n          failf(data, \"invalid tsize -:%s:- value in OACK packet\", value);\r\n          return CURLE_TFTP_ILLEGAL;\r\n        }\r\n        Curl_pgrsSetDownloadSize(data, tsize);\r\n      }\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic size_t tftp_option_add(tftp_state_data_t *state, size_t csize,\r\n                              char *buf, const char *option)\r\n{\r\n  if(( strlen(option) + csize + 1 ) > (size_t)state->blksize)\r\n    return 0;\r\n  strcpy(buf, option);\r\n  return( strlen(option) + 1 );\r\n}\r\n\r\nstatic CURLcode tftp_connect_for_tx(tftp_state_data_t *state,\r\n                                    tftp_event_t event)\r\n{\r\n  CURLcode res;\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  struct SessionHandle *data = state->conn->data;\r\n\r\n  infof(data, \"%s\\n\", \"Connected for transmit\");\r\n#endif\r\n  state->state = TFTP_STATE_TX;\r\n  res = tftp_set_timeouts(state);\r\n  if(res != CURLE_OK)\r\n    return(res);\r\n  return tftp_tx(state, event);\r\n}\r\n\r\nstatic CURLcode tftp_connect_for_rx(tftp_state_data_t *state,\r\n                                    tftp_event_t event)\r\n{\r\n  CURLcode res;\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  struct SessionHandle *data = state->conn->data;\r\n\r\n  infof(data, \"%s\\n\", \"Connected for receive\");\r\n#endif\r\n  state->state = TFTP_STATE_RX;\r\n  res = tftp_set_timeouts(state);\r\n  if(res != CURLE_OK)\r\n    return(res);\r\n  return tftp_rx(state, event);\r\n}\r\n\r\nstatic CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)\r\n{\r\n  size_t sbytes;\r\n  ssize_t senddata;\r\n  const char *mode = \"octet\";\r\n  char *filename;\r\n  char buf[64];\r\n  struct SessionHandle *data = state->conn->data;\r\n  CURLcode res = CURLE_OK;\r\n\r\n  /* Set ascii mode if -B flag was used */\r\n  if(data->set.prefer_ascii)\r\n    mode = \"netascii\";\r\n\r\n  switch(event) {\r\n\r\n  case TFTP_EVENT_INIT:    /* Send the first packet out */\r\n  case TFTP_EVENT_TIMEOUT: /* Resend the first packet out */\r\n    /* Increment the retry counter, quit if over the limit */\r\n    state->retries++;\r\n    if(state->retries>state->retry_max) {\r\n      state->error = TFTP_ERR_NORESPONSE;\r\n      state->state = TFTP_STATE_FIN;\r\n      return res;\r\n    }\r\n\r\n    if(data->set.upload) {\r\n      /* If we are uploading, send an WRQ */\r\n      setpacketevent(&state->spacket, TFTP_EVENT_WRQ);\r\n      state->conn->data->req.upload_fromhere =\r\n        (char *)state->spacket.data+4;\r\n      if(data->set.infilesize != -1)\r\n        Curl_pgrsSetUploadSize(data, data->set.infilesize);\r\n    }\r\n    else {\r\n      /* If we are downloading, send an RRQ */\r\n      setpacketevent(&state->spacket, TFTP_EVENT_RRQ);\r\n    }\r\n    /* As RFC3617 describes the separator slash is not actually part of the\r\n       file name so we skip the always-present first letter of the path\r\n       string. */\r\n    filename = curl_easy_unescape(data, &state->conn->data->state.path[1], 0,\r\n                                  NULL);\r\n    if(!filename)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    snprintf((char *)state->spacket.data+2,\r\n             state->blksize,\r\n             \"%s%c%s%c\", filename, '\\0',  mode, '\\0');\r\n    sbytes = 4 + strlen(filename) + strlen(mode);\r\n\r\n    /* add tsize option */\r\n    if(data->set.upload && (data->set.infilesize != -1))\r\n      snprintf( buf, sizeof(buf), \"%\" FORMAT_OFF_T, data->set.infilesize );\r\n    else\r\n      strcpy(buf, \"0\"); /* the destination is large enough */\r\n\r\n    sbytes += tftp_option_add(state, sbytes,\r\n                              (char *)state->spacket.data+sbytes,\r\n                              TFTP_OPTION_TSIZE);\r\n    sbytes += tftp_option_add(state, sbytes,\r\n                              (char *)state->spacket.data+sbytes, buf);\r\n    /* add blksize option */\r\n    snprintf( buf, sizeof(buf), \"%d\", state->requested_blksize );\r\n    sbytes += tftp_option_add(state, sbytes,\r\n                              (char *)state->spacket.data+sbytes,\r\n                              TFTP_OPTION_BLKSIZE);\r\n    sbytes += tftp_option_add(state, sbytes,\r\n                              (char *)state->spacket.data+sbytes, buf );\r\n\r\n    /* add timeout option */\r\n    snprintf( buf, sizeof(buf), \"%d\", state->retry_time);\r\n    sbytes += tftp_option_add(state, sbytes,\r\n                              (char *)state->spacket.data+sbytes,\r\n                              TFTP_OPTION_INTERVAL);\r\n    sbytes += tftp_option_add(state, sbytes,\r\n                              (char *)state->spacket.data+sbytes, buf );\r\n\r\n    /* the typecase for the 3rd argument is mostly for systems that do\r\n       not have a size_t argument, like older unixes that want an 'int' */\r\n    senddata = sendto(state->sockfd, (void *)state->spacket.data,\r\n                      (SEND_TYPE_ARG3)sbytes, 0,\r\n                      state->conn->ip_addr->ai_addr,\r\n                      state->conn->ip_addr->ai_addrlen);\r\n    if(senddata != (ssize_t)sbytes) {\r\n      failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n    }\r\n    Curl_safefree(filename);\r\n    break;\r\n\r\n  case TFTP_EVENT_OACK:\r\n    if(data->set.upload) {\r\n      res = tftp_connect_for_tx(state, event);\r\n    }\r\n    else {\r\n      res = tftp_connect_for_rx(state, event);\r\n    }\r\n    break;\r\n\r\n  case TFTP_EVENT_ACK: /* Connected for transmit */\r\n    res = tftp_connect_for_tx(state, event);\r\n    break;\r\n\r\n  case TFTP_EVENT_DATA: /* Connected for receive */\r\n    res = tftp_connect_for_rx(state, event);\r\n    break;\r\n\r\n  case TFTP_EVENT_ERROR:\r\n    state->state = TFTP_STATE_FIN;\r\n    break;\r\n\r\n  default:\r\n    failf(state->conn->data, \"tftp_send_first: internal error\");\r\n    break;\r\n  }\r\n  return res;\r\n}\r\n\r\n/* the next blocknum is x + 1 but it needs to wrap at an unsigned 16bit\r\n   boundary */\r\n#define NEXT_BLOCKNUM(x) (((x)+1)&0xffff)\r\n\r\n/**********************************************************\r\n *\r\n * tftp_rx\r\n *\r\n * Event handler for the RX state\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)\r\n{\r\n  ssize_t sbytes;\r\n  int rblock;\r\n  struct SessionHandle *data = state->conn->data;\r\n\r\n  switch(event) {\r\n\r\n  case TFTP_EVENT_DATA:\r\n    /* Is this the block we expect? */\r\n    rblock = getrpacketblock(&state->rpacket);\r\n    if(NEXT_BLOCKNUM(state->block) == rblock) {\r\n      /* This is the expected block.  Reset counters and ACK it. */\r\n      state->retries = 0;\r\n    }\r\n    else if(state->block == rblock) {\r\n      /* This is the last recently received block again. Log it and ACK it\r\n         again. */\r\n      infof(data, \"Received last DATA packet block %d again.\\n\", rblock);\r\n    }\r\n    else {\r\n      /* totally unexpected, just log it */\r\n      infof(data,\r\n            \"Received unexpected DATA packet block %d, expecting block %d\\n\",\r\n            rblock, NEXT_BLOCKNUM(state->block));\r\n      break;\r\n    }\r\n\r\n    /* ACK this block. */\r\n    state->block = (unsigned short)rblock;\r\n    setpacketevent(&state->spacket, TFTP_EVENT_ACK);\r\n    setpacketblock(&state->spacket, state->block);\r\n    sbytes = sendto(state->sockfd, (void *)state->spacket.data,\r\n                    4, SEND_4TH_ARG,\r\n                    (struct sockaddr *)&state->remote_addr,\r\n                    state->remote_addrlen);\r\n    if(sbytes < 0) {\r\n      failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n      return CURLE_SEND_ERROR;\r\n    }\r\n\r\n    /* Check if completed (That is, a less than full packet is received) */\r\n    if(state->rbytes < (ssize_t)state->blksize+4) {\r\n      state->state = TFTP_STATE_FIN;\r\n    }\r\n    else {\r\n      state->state = TFTP_STATE_RX;\r\n    }\r\n    time(&state->rx_time);\r\n    break;\r\n\r\n  case TFTP_EVENT_OACK:\r\n    /* ACK option acknowledgement so we can move on to data */\r\n    state->block = 0;\r\n    state->retries = 0;\r\n    setpacketevent(&state->spacket, TFTP_EVENT_ACK);\r\n    setpacketblock(&state->spacket, state->block);\r\n    sbytes = sendto(state->sockfd, (void *)state->spacket.data,\r\n                    4, SEND_4TH_ARG,\r\n                    (struct sockaddr *)&state->remote_addr,\r\n                    state->remote_addrlen);\r\n    if(sbytes < 0) {\r\n      failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n      return CURLE_SEND_ERROR;\r\n    }\r\n\r\n    /* we're ready to RX data */\r\n    state->state = TFTP_STATE_RX;\r\n    time(&state->rx_time);\r\n    break;\r\n\r\n  case TFTP_EVENT_TIMEOUT:\r\n    /* Increment the retry count and fail if over the limit */\r\n    state->retries++;\r\n    infof(data,\r\n          \"Timeout waiting for block %d ACK.  Retries = %d\\n\",\r\n          NEXT_BLOCKNUM(state->block), state->retries);\r\n    if(state->retries > state->retry_max) {\r\n      state->error = TFTP_ERR_TIMEOUT;\r\n      state->state = TFTP_STATE_FIN;\r\n    }\r\n    else {\r\n      /* Resend the previous ACK */\r\n      sbytes = sendto(state->sockfd, (void *)state->spacket.data,\r\n                      4, SEND_4TH_ARG,\r\n                      (struct sockaddr *)&state->remote_addr,\r\n                      state->remote_addrlen);\r\n      if(sbytes<0) {\r\n        failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n        return CURLE_SEND_ERROR;\r\n      }\r\n    }\r\n    break;\r\n\r\n  case TFTP_EVENT_ERROR:\r\n    setpacketevent(&state->spacket, TFTP_EVENT_ERROR);\r\n    setpacketblock(&state->spacket, state->block);\r\n    (void)sendto(state->sockfd, (void *)state->spacket.data,\r\n                 4, SEND_4TH_ARG,\r\n                 (struct sockaddr *)&state->remote_addr,\r\n                 state->remote_addrlen);\r\n    /* don't bother with the return code, but if the socket is still up we\r\n     * should be a good TFTP client and let the server know we're done */\r\n    state->state = TFTP_STATE_FIN;\r\n    break;\r\n\r\n  default:\r\n    failf(data, \"%s\", \"tftp_rx: internal error\");\r\n    return CURLE_TFTP_ILLEGAL; /* not really the perfect return code for\r\n                                  this */\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_tx\r\n *\r\n * Event handler for the TX state\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)\r\n{\r\n  struct SessionHandle *data = state->conn->data;\r\n  ssize_t sbytes;\r\n  int rblock;\r\n  CURLcode res = CURLE_OK;\r\n  struct SingleRequest *k = &data->req;\r\n\r\n  switch(event) {\r\n\r\n  case TFTP_EVENT_ACK:\r\n  case TFTP_EVENT_OACK:\r\n    if(event == TFTP_EVENT_ACK) {\r\n      /* Ack the packet */\r\n      rblock = getrpacketblock(&state->rpacket);\r\n\r\n      if(rblock != state->block &&\r\n         /* There's a bug in tftpd-hpa that causes it to send us an ack for\r\n          * 65535 when the block number wraps to 0. So when we're expecting\r\n          * 0, also accept 65535. See\r\n          * http://syslinux.zytor.com/archives/2010-September/015253.html\r\n          * */\r\n         !(state->block == 0 && rblock == 65535)) {\r\n        /* This isn't the expected block.  Log it and up the retry counter */\r\n        infof(data, \"Received ACK for block %d, expecting %d\\n\",\r\n              rblock, state->block);\r\n        state->retries++;\r\n        /* Bail out if over the maximum */\r\n        if(state->retries>state->retry_max) {\r\n          failf(data, \"tftp_tx: giving up waiting for block %d ack\",\r\n                state->block);\r\n          res = CURLE_SEND_ERROR;\r\n        }\r\n        else {\r\n          /* Re-send the data packet */\r\n          sbytes = sendto(state->sockfd, (void *)state->spacket.data,\r\n                          4+state->sbytes, SEND_4TH_ARG,\r\n                          (struct sockaddr *)&state->remote_addr,\r\n                          state->remote_addrlen);\r\n          /* Check all sbytes were sent */\r\n          if(sbytes<0) {\r\n            failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n            res = CURLE_SEND_ERROR;\r\n          }\r\n        }\r\n        return res;\r\n      }\r\n      /* This is the expected packet.  Reset the counters and send the next\r\n         block */\r\n      time(&state->rx_time);\r\n      state->block++;\r\n    }\r\n    else\r\n      state->block = 1; /* first data block is 1 when using OACK */\r\n\r\n    state->retries = 0;\r\n    setpacketevent(&state->spacket, TFTP_EVENT_DATA);\r\n    setpacketblock(&state->spacket, state->block);\r\n    if(state->block > 1 && state->sbytes < (int)state->blksize) {\r\n      state->state = TFTP_STATE_FIN;\r\n      return CURLE_OK;\r\n    }\r\n    res = Curl_fillreadbuffer(state->conn, state->blksize, &state->sbytes);\r\n    if(res)\r\n      return res;\r\n    sbytes = sendto(state->sockfd, (void *)state->spacket.data,\r\n                    4+state->sbytes, SEND_4TH_ARG,\r\n                    (struct sockaddr *)&state->remote_addr,\r\n                    state->remote_addrlen);\r\n    /* Check all sbytes were sent */\r\n    if(sbytes<0) {\r\n      failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n      return CURLE_SEND_ERROR;\r\n    }\r\n    /* Update the progress meter */\r\n    k->writebytecount += state->sbytes;\r\n    Curl_pgrsSetUploadCounter(data, k->writebytecount);\r\n    break;\r\n\r\n  case TFTP_EVENT_TIMEOUT:\r\n    /* Increment the retry counter and log the timeout */\r\n    state->retries++;\r\n    infof(data, \"Timeout waiting for block %d ACK. \"\r\n          \" Retries = %d\\n\", NEXT_BLOCKNUM(state->block), state->retries);\r\n    /* Decide if we've had enough */\r\n    if(state->retries > state->retry_max) {\r\n      state->error = TFTP_ERR_TIMEOUT;\r\n      state->state = TFTP_STATE_FIN;\r\n    }\r\n    else {\r\n      /* Re-send the data packet */\r\n      sbytes = sendto(state->sockfd, (void *)state->spacket.data,\r\n                      4+state->sbytes, SEND_4TH_ARG,\r\n                      (struct sockaddr *)&state->remote_addr,\r\n                      state->remote_addrlen);\r\n      /* Check all sbytes were sent */\r\n      if(sbytes<0) {\r\n        failf(data, \"%s\", Curl_strerror(state->conn, SOCKERRNO));\r\n        return CURLE_SEND_ERROR;\r\n      }\r\n      /* since this was a re-send, we remain at the still byte position */\r\n      Curl_pgrsSetUploadCounter(data, k->writebytecount);\r\n    }\r\n    break;\r\n\r\n  case TFTP_EVENT_ERROR:\r\n    state->state = TFTP_STATE_FIN;\r\n    setpacketevent(&state->spacket, TFTP_EVENT_ERROR);\r\n    setpacketblock(&state->spacket, state->block);\r\n    (void)sendto(state->sockfd, (void *)state->spacket.data, 4, SEND_4TH_ARG,\r\n                 (struct sockaddr *)&state->remote_addr,\r\n                 state->remote_addrlen);\r\n    /* don't bother with the return code, but if the socket is still up we\r\n     * should be a good TFTP client and let the server know we're done */\r\n    state->state = TFTP_STATE_FIN;\r\n    break;\r\n\r\n  default:\r\n    failf(data, \"tftp_tx: internal error, event: %i\", (int)(event));\r\n    break;\r\n  }\r\n\r\n  return res;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_translate_code\r\n *\r\n * Translate internal error codes to CURL error codes\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_translate_code(tftp_error_t error)\r\n{\r\n  CURLcode code = CURLE_OK;\r\n\r\n  if(error != TFTP_ERR_NONE) {\r\n    switch(error) {\r\n    case TFTP_ERR_NOTFOUND:\r\n      code = CURLE_TFTP_NOTFOUND;\r\n      break;\r\n    case TFTP_ERR_PERM:\r\n      code = CURLE_TFTP_PERM;\r\n      break;\r\n    case TFTP_ERR_DISKFULL:\r\n      code = CURLE_REMOTE_DISK_FULL;\r\n      break;\r\n    case TFTP_ERR_UNDEF:\r\n    case TFTP_ERR_ILLEGAL:\r\n      code = CURLE_TFTP_ILLEGAL;\r\n      break;\r\n    case TFTP_ERR_UNKNOWNID:\r\n      code = CURLE_TFTP_UNKNOWNID;\r\n      break;\r\n    case TFTP_ERR_EXISTS:\r\n      code = CURLE_REMOTE_FILE_EXISTS;\r\n      break;\r\n    case TFTP_ERR_NOSUCHUSER:\r\n      code = CURLE_TFTP_NOSUCHUSER;\r\n      break;\r\n    case TFTP_ERR_TIMEOUT:\r\n      code = CURLE_OPERATION_TIMEDOUT;\r\n      break;\r\n    case TFTP_ERR_NORESPONSE:\r\n      code = CURLE_COULDNT_CONNECT;\r\n      break;\r\n    default:\r\n      code= CURLE_ABORTED_BY_CALLBACK;\r\n      break;\r\n    }\r\n  }\r\n  else {\r\n    code = CURLE_OK;\r\n  }\r\n\r\n  return(code);\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_state_machine\r\n *\r\n * The tftp state machine event dispatcher\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_state_machine(tftp_state_data_t *state,\r\n                                   tftp_event_t event)\r\n{\r\n  CURLcode res = CURLE_OK;\r\n  struct SessionHandle *data = state->conn->data;\r\n  switch(state->state) {\r\n  case TFTP_STATE_START:\r\n    DEBUGF(infof(data, \"TFTP_STATE_START\\n\"));\r\n    res = tftp_send_first(state, event);\r\n    break;\r\n  case TFTP_STATE_RX:\r\n    DEBUGF(infof(data, \"TFTP_STATE_RX\\n\"));\r\n    res = tftp_rx(state, event);\r\n    break;\r\n  case TFTP_STATE_TX:\r\n    DEBUGF(infof(data, \"TFTP_STATE_TX\\n\"));\r\n    res = tftp_tx(state, event);\r\n    break;\r\n  case TFTP_STATE_FIN:\r\n    infof(data, \"%s\\n\", \"TFTP finished\");\r\n    break;\r\n  default:\r\n    DEBUGF(infof(data, \"STATE: %d\\n\", state->state));\r\n    failf(data, \"%s\", \"Internal state machine error\");\r\n    res = CURLE_TFTP_ILLEGAL;\r\n    break;\r\n  }\r\n  return res;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_disconnect\r\n *\r\n * The disconnect callback\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  tftp_state_data_t *state = conn->proto.tftpc;\r\n  (void) dead_connection;\r\n\r\n  /* done, free dynamically allocated pkt buffers */\r\n  if(state) {\r\n    Curl_safefree(state->rpacket.data);\r\n    Curl_safefree(state->spacket.data);\r\n    free(state);\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_connect\r\n *\r\n * The connect callback\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_connect(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode code;\r\n  tftp_state_data_t *state;\r\n  int blksize, rc;\r\n\r\n  blksize = TFTP_BLKSIZE_DEFAULT;\r\n\r\n  /* If there already is a protocol-specific struct allocated for this\r\n     sessionhandle, deal with it */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  state = conn->proto.tftpc = calloc(1, sizeof(tftp_state_data_t));\r\n  if(!state)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* alloc pkt buffers based on specified blksize */\r\n  if(conn->data->set.tftp_blksize) {\r\n    blksize = (int)conn->data->set.tftp_blksize;\r\n    if(blksize > TFTP_BLKSIZE_MAX || blksize < TFTP_BLKSIZE_MIN )\r\n      return CURLE_TFTP_ILLEGAL;\r\n  }\r\n\r\n  if(!state->rpacket.data) {\r\n    state->rpacket.data = calloc(1, blksize + 2 + 2);\r\n\r\n    if(!state->rpacket.data)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  if(!state->spacket.data) {\r\n    state->spacket.data = calloc(1, blksize + 2 + 2);\r\n\r\n    if(!state->spacket.data)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  conn->bits.close = TRUE; /* we don't keep TFTP connections up bascially\r\n                              because there's none or very little gain for UDP\r\n                           */\r\n\r\n  state->conn = conn;\r\n  state->sockfd = state->conn->sock[FIRSTSOCKET];\r\n  state->state = TFTP_STATE_START;\r\n  state->error = TFTP_ERR_NONE;\r\n  state->blksize = TFTP_BLKSIZE_DEFAULT;\r\n  state->requested_blksize = blksize;\r\n\r\n  ((struct sockaddr *)&state->local_addr)->sa_family =\r\n    (unsigned short)(conn->ip_addr->ai_family);\r\n\r\n  tftp_set_timeouts(state);\r\n\r\n  if(!conn->bits.bound) {\r\n    /* If not already bound, bind to any interface, random UDP port. If it is\r\n     * reused or a custom local port was desired, this has already been done!\r\n     *\r\n     * We once used the size of the local_addr struct as the third argument\r\n     * for bind() to better work with IPv6 or whatever size the struct could\r\n     * have, but we learned that at least Tru64, AIX and IRIX *requires* the\r\n     * size of that argument to match the exact size of a 'sockaddr_in' struct\r\n     * when running IPv4-only.\r\n     *\r\n     * Therefore we use the size from the address we connected to, which we\r\n     * assume uses the same IP version and thus hopefully this works for both\r\n     * IPv4 and IPv6...\r\n     */\r\n    rc = bind(state->sockfd, (struct sockaddr *)&state->local_addr,\r\n              conn->ip_addr->ai_addrlen);\r\n    if(rc) {\r\n      failf(conn->data, \"bind() failed; %s\",\r\n            Curl_strerror(conn, SOCKERRNO));\r\n      return CURLE_COULDNT_CONNECT;\r\n    }\r\n    conn->bits.bound = TRUE;\r\n  }\r\n\r\n  Curl_pgrsStartNow(conn->data);\r\n\r\n  *done = TRUE;\r\n  code = CURLE_OK;\r\n  return(code);\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_done\r\n *\r\n * The done callback\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_done(struct connectdata *conn, CURLcode status,\r\n                          bool premature)\r\n{\r\n  CURLcode code = CURLE_OK;\r\n  tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc;\r\n\r\n  (void)status; /* unused */\r\n  (void)premature; /* not used */\r\n\r\n  if(Curl_pgrsDone(conn))\r\n    return CURLE_ABORTED_BY_CALLBACK;\r\n\r\n  /* If we have encountered an error */\r\n  code = tftp_translate_code(state->error);\r\n\r\n  return code;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_getsock\r\n *\r\n * The getsock callback\r\n *\r\n **********************************************************/\r\nstatic int tftp_getsock(struct connectdata *conn, curl_socket_t *socks,\r\n                        int numsocks)\r\n{\r\n  if(!numsocks)\r\n    return GETSOCK_BLANK;\r\n\r\n  socks[0] = conn->sock[FIRSTSOCKET];\r\n\r\n  return GETSOCK_READSOCK(0);\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_receive_packet\r\n *\r\n * Called once select fires and data is ready on the socket\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_receive_packet(struct connectdata *conn)\r\n{\r\n  struct Curl_sockaddr_storage fromaddr;\r\n  curl_socklen_t        fromlen;\r\n  CURLcode              result = CURLE_OK;\r\n  struct SessionHandle  *data = conn->data;\r\n  tftp_state_data_t     *state = (tftp_state_data_t *)conn->proto.tftpc;\r\n  struct SingleRequest  *k = &data->req;\r\n\r\n  /* Receive the packet */\r\n  fromlen = sizeof(fromaddr);\r\n  state->rbytes = (int)recvfrom(state->sockfd,\r\n                                (void *)state->rpacket.data,\r\n                                state->blksize+4,\r\n                                0,\r\n                                (struct sockaddr *)&fromaddr,\r\n                                &fromlen);\r\n  if(state->remote_addrlen==0) {\r\n    memcpy(&state->remote_addr, &fromaddr, fromlen);\r\n    state->remote_addrlen = fromlen;\r\n  }\r\n\r\n  /* Sanity check packet length */\r\n  if(state->rbytes < 4) {\r\n    failf(data, \"Received too short packet\");\r\n    /* Not a timeout, but how best to handle it? */\r\n    state->event = TFTP_EVENT_TIMEOUT;\r\n  }\r\n  else {\r\n    /* The event is given by the TFTP packet time */\r\n    state->event = (tftp_event_t)getrpacketevent(&state->rpacket);\r\n\r\n    switch(state->event) {\r\n    case TFTP_EVENT_DATA:\r\n      /* Don't pass to the client empty or retransmitted packets */\r\n      if(state->rbytes > 4 &&\r\n         (NEXT_BLOCKNUM(state->block) == getrpacketblock(&state->rpacket))) {\r\n        result = Curl_client_write(conn, CLIENTWRITE_BODY,\r\n                                   (char *)state->rpacket.data+4,\r\n                                   state->rbytes-4);\r\n        if(result) {\r\n          tftp_state_machine(state, TFTP_EVENT_ERROR);\r\n          return result;\r\n        }\r\n        k->bytecount += state->rbytes-4;\r\n        Curl_pgrsSetDownloadCounter(data, (curl_off_t) k->bytecount);\r\n      }\r\n      break;\r\n    case TFTP_EVENT_ERROR:\r\n      state->error = (tftp_error_t)getrpacketblock(&state->rpacket);\r\n      infof(data, \"%s\\n\", (const char *)state->rpacket.data+4);\r\n      break;\r\n    case TFTP_EVENT_ACK:\r\n      break;\r\n    case TFTP_EVENT_OACK:\r\n      result = tftp_parse_option_ack(state,\r\n                                     (const char *)state->rpacket.data+2,\r\n                                     state->rbytes-2);\r\n      if(result)\r\n        return result;\r\n      break;\r\n    case TFTP_EVENT_RRQ:\r\n    case TFTP_EVENT_WRQ:\r\n    default:\r\n      failf(data, \"%s\", \"Internal error: Unexpected packet\");\r\n      break;\r\n    }\r\n\r\n    /* Update the progress meter */\r\n    if(Curl_pgrsUpdate(conn)) {\r\n      tftp_state_machine(state, TFTP_EVENT_ERROR);\r\n      return CURLE_ABORTED_BY_CALLBACK;\r\n    }\r\n  }\r\n  return result;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_state_timeout\r\n *\r\n * Check if timeouts have been reached\r\n *\r\n **********************************************************/\r\nstatic long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event)\r\n{\r\n  time_t                current;\r\n  tftp_state_data_t     *state = (tftp_state_data_t *)conn->proto.tftpc;\r\n\r\n  if(event)\r\n    *event = TFTP_EVENT_NONE;\r\n\r\n  time(&current);\r\n  if(current > state->max_time) {\r\n    DEBUGF(infof(conn->data, \"timeout: %ld > %ld\\n\",\r\n                 (long)current, (long)state->max_time));\r\n    state->error = TFTP_ERR_TIMEOUT;\r\n    state->state = TFTP_STATE_FIN;\r\n    return 0;\r\n  }\r\n  else if(current > state->rx_time+state->retry_time) {\r\n    if(event)\r\n      *event = TFTP_EVENT_TIMEOUT;\r\n    time(&state->rx_time); /* update even though we received nothing */\r\n  }\r\n\r\n  /* there's a typecast below here since 'time_t' may in fact be larger than\r\n     'long', but we estimate that a 'long' will still be able to hold number\r\n     of seconds even if \"only\" 32 bit */\r\n  return (long)(state->max_time - current);\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_multi_statemach\r\n *\r\n * Handle single RX socket event and return\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)\r\n{\r\n  int                   rc;\r\n  tftp_event_t          event;\r\n  CURLcode              result = CURLE_OK;\r\n  struct SessionHandle  *data = conn->data;\r\n  tftp_state_data_t     *state = (tftp_state_data_t *)conn->proto.tftpc;\r\n  long                  timeout_ms = tftp_state_timeout(conn, &event);\r\n\r\n  *done = FALSE;\r\n\r\n  if(timeout_ms <= 0) {\r\n    failf(data, \"TFTP response timeout\");\r\n    return CURLE_OPERATION_TIMEDOUT;\r\n  }\r\n  else if(event != TFTP_EVENT_NONE) {\r\n    result = tftp_state_machine(state, event);\r\n    if(result != CURLE_OK)\r\n      return(result);\r\n    *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;\r\n    if(*done)\r\n      /* Tell curl we're done */\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n  }\r\n  else {\r\n    /* no timeouts to handle, check our socket */\r\n    rc = Curl_socket_ready(state->sockfd, CURL_SOCKET_BAD, 0);\r\n\r\n    if(rc == -1) {\r\n      /* bail out */\r\n      int error = SOCKERRNO;\r\n      failf(data, \"%s\", Curl_strerror(conn, error));\r\n      state->event = TFTP_EVENT_ERROR;\r\n    }\r\n    else if(rc != 0) {\r\n      result = tftp_receive_packet(conn);\r\n      if(result != CURLE_OK)\r\n        return(result);\r\n      result = tftp_state_machine(state, state->event);\r\n      if(result != CURLE_OK)\r\n        return(result);\r\n      *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;\r\n      if(*done)\r\n        /* Tell curl we're done */\r\n        Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);\r\n    }\r\n    /* if rc == 0, then select() timed out */\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_doing\r\n *\r\n * Called from multi.c while DOing\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done)\r\n{\r\n  CURLcode result;\r\n  result = tftp_multi_statemach(conn, dophase_done);\r\n\r\n  if(*dophase_done) {\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n  }\r\n  return result;\r\n}\r\n\r\n/**********************************************************\r\n *\r\n * tftp_peform\r\n *\r\n * Entry point for transfer from tftp_do, sarts state mach\r\n *\r\n **********************************************************/\r\nstatic CURLcode tftp_perform(struct connectdata *conn, bool *dophase_done)\r\n{\r\n  CURLcode              result = CURLE_OK;\r\n  tftp_state_data_t     *state = (tftp_state_data_t *)conn->proto.tftpc;\r\n\r\n  *dophase_done = FALSE;\r\n\r\n  result = tftp_state_machine(state, TFTP_EVENT_INIT);\r\n\r\n  if(state->state == TFTP_STATE_FIN || result != CURLE_OK)\r\n    return(result);\r\n\r\n  tftp_multi_statemach(conn, dophase_done);\r\n\r\n  if(*dophase_done)\r\n    DEBUGF(infof(conn->data, \"DO phase is complete\\n\"));\r\n\r\n  return result;\r\n}\r\n\r\n\r\n/**********************************************************\r\n *\r\n * tftp_do\r\n *\r\n * The do callback\r\n *\r\n * This callback initiates the TFTP transfer\r\n *\r\n **********************************************************/\r\n\r\nstatic CURLcode tftp_do(struct connectdata *conn, bool *done)\r\n{\r\n  tftp_state_data_t     *state;\r\n  CURLcode              code;\r\n\r\n  *done = FALSE;\r\n\r\n  /*\r\n    Since connections can be re-used between SessionHandles, this might be a\r\n    connection already existing but on a fresh SessionHandle struct so we must\r\n    make sure we have a good 'struct TFTP' to play with. For new connections,\r\n    the struct TFTP is allocated and setup in the tftp_connect() function.\r\n  */\r\n  Curl_reset_reqproto(conn);\r\n\r\n  if(!conn->proto.tftpc) {\r\n    code = tftp_connect(conn, done);\r\n    if(code)\r\n      return code;\r\n  }\r\n  state = (tftp_state_data_t *)conn->proto.tftpc;\r\n\r\n  code = tftp_perform(conn, done);\r\n\r\n  /* If tftp_perform() returned an error, use that for return code. If it\r\n     was OK, see if tftp_translate_code() has an error. */\r\n  if(code == CURLE_OK)\r\n    /* If we have encountered an internal tftp error, translate it. */\r\n    code = tftp_translate_code(state->error);\r\n\r\n  return code;\r\n}\r\n\r\nstatic CURLcode tftp_setup_connection(struct connectdata * conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  char * type;\r\n  char command;\r\n\r\n  conn->socktype = SOCK_DGRAM;   /* UDP datagram based */\r\n\r\n  /* TFTP URLs support an extension like \";mode=<typecode>\" that\r\n   * we'll try to get now! */\r\n  type = strstr(data->state.path, \";mode=\");\r\n\r\n  if(!type)\r\n    type = strstr(conn->host.rawalloc, \";mode=\");\r\n\r\n  if(type) {\r\n    *type = 0;                   /* it was in the middle of the hostname */\r\n    command = Curl_raw_toupper(type[6]);\r\n\r\n    switch (command) {\r\n    case 'A': /* ASCII mode */\r\n    case 'N': /* NETASCII mode */\r\n      data->set.prefer_ascii = TRUE;\r\n      break;\r\n\r\n    case 'O': /* octet mode */\r\n    case 'I': /* binary mode */\r\n    default:\r\n      /* switch off ASCII */\r\n      data->set.prefer_ascii = FALSE;\r\n      break;\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/tftp.h",
    "content": "#ifndef HEADER_CURL_TFTP_H\r\n#define HEADER_CURL_TFTP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifndef CURL_DISABLE_TFTP\r\nextern const struct Curl_handler Curl_handler_tftp;\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TFTP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/timeval.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"timeval.h\"\r\n\r\n#if defined(WIN32) && !defined(MSDOS)\r\n\r\nstruct timeval curlx_tvnow(void)\r\n{\r\n  /*\r\n  ** GetTickCount() is available on _all_ Windows versions from W95 up\r\n  ** to nowadays. Returns milliseconds elapsed since last system boot,\r\n  ** increases monotonically and wraps once 49.7 days have elapsed.\r\n  */\r\n  struct timeval now;\r\n  DWORD milliseconds = GetTickCount();\r\n  now.tv_sec = milliseconds / 1000;\r\n  now.tv_usec = (milliseconds % 1000) * 1000;\r\n  return now;\r\n}\r\n\r\n#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)\r\n\r\nstruct timeval curlx_tvnow(void)\r\n{\r\n  /*\r\n  ** clock_gettime() is granted to be increased monotonically when the\r\n  ** monotonic clock is queried. Time starting point is unspecified, it\r\n  ** could be the system start-up time, the Epoch, or something else,\r\n  ** in any case the time starting point does not change once that the\r\n  ** system has started up.\r\n  */\r\n  struct timeval now;\r\n  struct timespec tsnow;\r\n  if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {\r\n    now.tv_sec = tsnow.tv_sec;\r\n    now.tv_usec = tsnow.tv_nsec / 1000;\r\n  }\r\n  /*\r\n  ** Even when the configure process has truly detected monotonic clock\r\n  ** availability, it might happen that it is not actually available at\r\n  ** run-time. When this occurs simply fallback to other time source.\r\n  */\r\n#ifdef HAVE_GETTIMEOFDAY\r\n  else\r\n    (void)gettimeofday(&now, NULL);\r\n#else\r\n  else {\r\n    now.tv_sec = (long)time(NULL);\r\n    now.tv_usec = 0;\r\n  }\r\n#endif\r\n  return now;\r\n}\r\n\r\n#elif defined(HAVE_GETTIMEOFDAY)\r\n\r\nstruct timeval curlx_tvnow(void)\r\n{\r\n  /*\r\n  ** gettimeofday() is not granted to be increased monotonically, due to\r\n  ** clock drifting and external source time synchronization it can jump\r\n  ** forward or backward in time.\r\n  */\r\n  struct timeval now;\r\n  (void)gettimeofday(&now, NULL);\r\n  return now;\r\n}\r\n\r\n#else\r\n\r\nstruct timeval curlx_tvnow(void)\r\n{\r\n  /*\r\n  ** time() returns the value of time in seconds since the Epoch.\r\n  */\r\n  struct timeval now;\r\n  now.tv_sec = (long)time(NULL);\r\n  now.tv_usec = 0;\r\n  return now;\r\n}\r\n\r\n#endif\r\n\r\n/*\r\n * Make sure that the first argument is the more recent time, as otherwise\r\n * we'll get a weird negative time-diff back...\r\n *\r\n * Returns: the time difference in number of milliseconds.\r\n */\r\nlong curlx_tvdiff(struct timeval newer, struct timeval older)\r\n{\r\n  return (newer.tv_sec-older.tv_sec)*1000+\r\n    (newer.tv_usec-older.tv_usec)/1000;\r\n}\r\n\r\n/*\r\n * Same as curlx_tvdiff but with full usec resolution.\r\n *\r\n * Returns: the time difference in seconds with subsecond resolution.\r\n */\r\ndouble curlx_tvdiff_secs(struct timeval newer, struct timeval older)\r\n{\r\n  if(newer.tv_sec != older.tv_sec)\r\n    return (double)(newer.tv_sec-older.tv_sec)+\r\n      (double)(newer.tv_usec-older.tv_usec)/1000000.0;\r\n  else\r\n    return (double)(newer.tv_usec-older.tv_usec)/1000000.0;\r\n}\r\n\r\n/* return the number of seconds in the given input timeval struct */\r\nlong Curl_tvlong(struct timeval t1)\r\n{\r\n  return t1.tv_sec;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/timeval.h",
    "content": "#ifndef HEADER_CURL_TIMEVAL_H\r\n#define HEADER_CURL_TIMEVAL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * CAUTION: this header is designed to work when included by the app-side\r\n * as well as the library. Do not mix with library internals!\r\n */\r\n\r\n#include \"curl_setup.h\"\r\n\r\nstruct timeval curlx_tvnow(void);\r\n\r\n/*\r\n * Make sure that the first argument (t1) is the more recent time and t2 is\r\n * the older time, as otherwise you get a weird negative time-diff back...\r\n *\r\n * Returns: the time difference in number of milliseconds.\r\n */\r\nlong curlx_tvdiff(struct timeval t1, struct timeval t2);\r\n\r\n/*\r\n * Same as curlx_tvdiff but with full usec resolution.\r\n *\r\n * Returns: the time difference in seconds with subsecond resolution.\r\n */\r\ndouble curlx_tvdiff_secs(struct timeval t1, struct timeval t2);\r\n\r\nlong Curl_tvlong(struct timeval t1);\r\n\r\n/* These two defines below exist to provide the older API for library\r\n   internals only. */\r\n#define Curl_tvnow() curlx_tvnow()\r\n#define Curl_tvdiff(x,y) curlx_tvdiff(x,y)\r\n#define Curl_tvdiff_secs(x,y) curlx_tvdiff_secs(x,y)\r\n\r\n#endif /* HEADER_CURL_TIMEVAL_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/transfer.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"strtoofft.h\"\r\n#include \"strequal.h\"\r\n#include \"rawstr.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n#ifdef HAVE_SIGNAL_H\r\n#include <signal.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_SELECT_H\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#ifndef HAVE_SOCKET\r\n#error \"We can't compile without socket() support!\"\r\n#endif\r\n\r\n#include \"urldata.h\"\r\n#include <curl/curl.h>\r\n#include \"netrc.h\"\r\n\r\n#include \"content_encoding.h\"\r\n#include \"hostip.h\"\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n#include \"speedcheck.h\"\r\n#include \"progress.h\"\r\n#include \"http.h\"\r\n#include \"url.h\"\r\n#include \"getinfo.h\"\r\n#include \"sslgen.h\"\r\n#include \"http_digest.h\"\r\n#include \"curl_ntlm.h\"\r\n#include \"http_negotiate.h\"\r\n#include \"share_curl.h\"\r\n#include \"curl_memory.h\"\r\n#include \"select.h\"\r\n#include \"multiif.h\"\r\n#include \"connect.h\"\r\n#include \"non-ascii.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n#define CURL_TIMEOUT_EXPECT_100 1000 /* counting ms here */\r\n\r\n/*\r\n * This function will call the read callback to fill our buffer with data\r\n * to upload.\r\n */\r\nCURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  size_t buffersize = (size_t)bytes;\r\n  int nread;\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  bool sending_http_headers = FALSE;\r\n\r\n  if((conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) &&\r\n     (data->state.proto.http->sending == HTTPSEND_REQUEST)) {\r\n    /* We're sending the HTTP request headers, not the data.\r\n       Remember that so we don't re-translate them into garbage. */\r\n    sending_http_headers = TRUE;\r\n  }\r\n#endif\r\n\r\n  if(data->req.upload_chunky) {\r\n    /* if chunked Transfer-Encoding */\r\n    buffersize -= (8 + 2 + 2);   /* 32bit hex + CRLF + CRLF */\r\n    data->req.upload_fromhere += (8 + 2); /* 32bit hex + CRLF */\r\n  }\r\n\r\n  /* this function returns a size_t, so we typecast to int to prevent warnings\r\n     with picky compilers */\r\n  nread = (int)conn->fread_func(data->req.upload_fromhere, 1,\r\n                                buffersize, conn->fread_in);\r\n\r\n  if(nread == CURL_READFUNC_ABORT) {\r\n    failf(data, \"operation aborted by callback\");\r\n    *nreadp = 0;\r\n    return CURLE_ABORTED_BY_CALLBACK;\r\n  }\r\n  else if(nread == CURL_READFUNC_PAUSE) {\r\n    struct SingleRequest *k = &data->req;\r\n    /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */\r\n    k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */\r\n    if(data->req.upload_chunky) {\r\n      /* Back out the preallocation done above */\r\n      data->req.upload_fromhere -= (8 + 2);\r\n    }\r\n    *nreadp = 0;\r\n    return CURLE_OK; /* nothing was read */\r\n  }\r\n  else if((size_t)nread > buffersize) {\r\n    /* the read function returned a too large value */\r\n    *nreadp = 0;\r\n    failf(data, \"read function returned funny value\");\r\n    return CURLE_READ_ERROR;\r\n  }\r\n\r\n  if(!data->req.forbidchunk && data->req.upload_chunky) {\r\n    /* if chunked Transfer-Encoding\r\n     *    build chunk:\r\n     *\r\n     *        <HEX SIZE> CRLF\r\n     *        <DATA> CRLF\r\n     */\r\n    /* On non-ASCII platforms the <DATA> may or may not be\r\n       translated based on set.prefer_ascii while the protocol\r\n       portion must always be translated to the network encoding.\r\n       To further complicate matters, line end conversion might be\r\n       done later on, so we need to prevent CRLFs from becoming\r\n       CRCRLFs if that's the case.  To do this we use bare LFs\r\n       here, knowing they'll become CRLFs later on.\r\n     */\r\n\r\n    char hexbuffer[11];\r\n    const char *endofline_native;\r\n    const char *endofline_network;\r\n    int hexlen;\r\n\r\n    if(\r\n#ifdef CURL_DO_LINEEND_CONV\r\n       (data->set.prefer_ascii) ||\r\n#endif\r\n       (data->set.crlf)) {\r\n      /* \\n will become \\r\\n later on */\r\n      endofline_native  = \"\\n\";\r\n      endofline_network = \"\\x0a\";\r\n    }\r\n    else {\r\n      endofline_native  = \"\\r\\n\";\r\n      endofline_network = \"\\x0d\\x0a\";\r\n    }\r\n    hexlen = snprintf(hexbuffer, sizeof(hexbuffer),\r\n                      \"%x%s\", nread, endofline_native);\r\n\r\n    /* move buffer pointer */\r\n    data->req.upload_fromhere -= hexlen;\r\n    nread += hexlen;\r\n\r\n    /* copy the prefix to the buffer, leaving out the NUL */\r\n    memcpy(data->req.upload_fromhere, hexbuffer, hexlen);\r\n\r\n    /* always append ASCII CRLF to the data */\r\n    memcpy(data->req.upload_fromhere + nread,\r\n           endofline_network,\r\n           strlen(endofline_network));\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n    CURLcode res;\r\n    int length;\r\n    if(data->set.prefer_ascii) {\r\n      /* translate the protocol and data */\r\n      length = nread;\r\n    }\r\n    else {\r\n      /* just translate the protocol portion */\r\n      length = strlen(hexbuffer);\r\n    }\r\n    res = Curl_convert_to_network(data, data->req.upload_fromhere, length);\r\n    /* Curl_convert_to_network calls failf if unsuccessful */\r\n    if(res)\r\n      return(res);\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n    if((nread - hexlen) == 0)\r\n      /* mark this as done once this chunk is transferred */\r\n      data->req.upload_done = TRUE;\r\n\r\n    nread+=(int)strlen(endofline_native); /* for the added end of line */\r\n  }\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  else if((data->set.prefer_ascii) && (!sending_http_headers)) {\r\n    CURLcode res;\r\n    res = Curl_convert_to_network(data, data->req.upload_fromhere, nread);\r\n    /* Curl_convert_to_network calls failf if unsuccessful */\r\n    if(res != CURLE_OK)\r\n      return(res);\r\n  }\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n  *nreadp = nread;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/*\r\n * Curl_readrewind() rewinds the read stream. This is typically used for HTTP\r\n * POST/PUT with multi-pass authentication when a sending was denied and a\r\n * resend is necessary.\r\n */\r\nCURLcode Curl_readrewind(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  conn->bits.rewindaftersend = FALSE; /* we rewind now */\r\n\r\n  /* explicitly switch off sending data on this connection now since we are\r\n     about to restart a new transfer and thus we want to avoid inadvertently\r\n     sending more data on the existing connection until the next transfer\r\n     starts */\r\n  data->req.keepon &= ~KEEP_SEND;\r\n\r\n  /* We have sent away data. If not using CURLOPT_POSTFIELDS or\r\n     CURLOPT_HTTPPOST, call app to rewind\r\n  */\r\n  if(data->set.postfields ||\r\n     (data->set.httpreq == HTTPREQ_POST_FORM))\r\n    ; /* do nothing */\r\n  else {\r\n    if(data->set.seek_func) {\r\n      int err;\r\n\r\n      err = (data->set.seek_func)(data->set.seek_client, 0, SEEK_SET);\r\n      if(err) {\r\n        failf(data, \"seek callback returned error %d\", (int)err);\r\n        return CURLE_SEND_FAIL_REWIND;\r\n      }\r\n    }\r\n    else if(data->set.ioctl_func) {\r\n      curlioerr err;\r\n\r\n      err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD,\r\n                                   data->set.ioctl_client);\r\n      infof(data, \"the ioctl callback returned %d\\n\", (int)err);\r\n\r\n      if(err) {\r\n        /* FIXME: convert to a human readable error message */\r\n        failf(data, \"ioctl callback returned error %d\", (int)err);\r\n        return CURLE_SEND_FAIL_REWIND;\r\n      }\r\n    }\r\n    else {\r\n      /* If no CURLOPT_READFUNCTION is used, we know that we operate on a\r\n         given FILE * stream and we can actually attempt to rewind that\r\n         ourselves with fseek() */\r\n      if(data->set.fread_func == (curl_read_callback)fread) {\r\n        if(-1 != fseek(data->set.in, 0, SEEK_SET))\r\n          /* successful rewind */\r\n          return CURLE_OK;\r\n      }\r\n\r\n      /* no callback set or failure above, makes us fail at once */\r\n      failf(data, \"necessary data rewind wasn't possible\");\r\n      return CURLE_SEND_FAIL_REWIND;\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic int data_pending(const struct connectdata *conn)\r\n{\r\n  /* in the case of libssh2, we can never be really sure that we have emptied\r\n     its internal buffers so we MUST always try until we get EAGAIN back */\r\n  return conn->handler->protocol&(CURLPROTO_SCP|CURLPROTO_SFTP) ||\r\n    Curl_ssl_data_pending(conn, FIRSTSOCKET);\r\n}\r\n\r\nstatic void read_rewind(struct connectdata *conn,\r\n                        size_t thismuch)\r\n{\r\n  DEBUGASSERT(conn->read_pos >= thismuch);\r\n\r\n  conn->read_pos -= thismuch;\r\n  conn->bits.stream_was_rewound = TRUE;\r\n\r\n#ifdef DEBUGBUILD\r\n  {\r\n    char buf[512 + 1];\r\n    size_t show;\r\n\r\n    show = CURLMIN(conn->buf_len - conn->read_pos, sizeof(buf)-1);\r\n    if(conn->master_buffer) {\r\n      memcpy(buf, conn->master_buffer + conn->read_pos, show);\r\n      buf[show] = '\\0';\r\n    }\r\n    else {\r\n      buf[0] = '\\0';\r\n    }\r\n\r\n    DEBUGF(infof(conn->data,\r\n                 \"Buffer after stream rewind (read_pos = %zu): [%s]\\n\",\r\n                 conn->read_pos, buf));\r\n  }\r\n#endif\r\n}\r\n\r\n/*\r\n * Check to see if CURLOPT_TIMECONDITION was met by comparing the time of the\r\n * remote document with the time provided by CURLOPT_TIMEVAL\r\n */\r\nbool Curl_meets_timecondition(struct SessionHandle *data, time_t timeofdoc)\r\n{\r\n  if((timeofdoc == 0) || (data->set.timevalue == 0))\r\n    return TRUE;\r\n\r\n  switch(data->set.timecondition) {\r\n  case CURL_TIMECOND_IFMODSINCE:\r\n  default:\r\n    if(timeofdoc <= data->set.timevalue) {\r\n      infof(data,\r\n            \"The requested document is not new enough\\n\");\r\n      data->info.timecond = TRUE;\r\n      return FALSE;\r\n    }\r\n    break;\r\n  case CURL_TIMECOND_IFUNMODSINCE:\r\n    if(timeofdoc >= data->set.timevalue) {\r\n      infof(data,\r\n            \"The requested document is not old enough\\n\");\r\n      data->info.timecond = TRUE;\r\n      return FALSE;\r\n    }\r\n    break;\r\n  }\r\n\r\n  return TRUE;\r\n}\r\n\r\n/*\r\n * Go ahead and do a read if we have a readable socket or if\r\n * the stream was rewound (in which case we have data in a\r\n * buffer)\r\n */\r\nstatic CURLcode readwrite_data(struct SessionHandle *data,\r\n                               struct connectdata *conn,\r\n                               struct SingleRequest *k,\r\n                               int *didwhat, bool *done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  ssize_t nread; /* number of bytes read */\r\n  size_t excess = 0; /* excess bytes read */\r\n  bool is_empty_data = FALSE;\r\n  bool readmore = FALSE; /* used by RTP to signal for more data */\r\n\r\n  *done = FALSE;\r\n\r\n  /* This is where we loop until we have read everything there is to\r\n     read or we get a CURLE_AGAIN */\r\n  do {\r\n    size_t buffersize = data->set.buffer_size?\r\n      data->set.buffer_size : BUFSIZE;\r\n    size_t bytestoread = buffersize;\r\n\r\n    if(k->size != -1 && !k->header) {\r\n      /* make sure we don't read \"too much\" if we can help it since we\r\n         might be pipelining and then someone else might want to read what\r\n         follows! */\r\n      curl_off_t totalleft = k->size - k->bytecount;\r\n      if(totalleft < (curl_off_t)bytestoread)\r\n        bytestoread = (size_t)totalleft;\r\n    }\r\n\r\n    if(bytestoread) {\r\n      /* receive data from the network! */\r\n      result = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread);\r\n\r\n      /* read would've blocked */\r\n      if(CURLE_AGAIN == result)\r\n        break; /* get out of loop */\r\n\r\n      if(result>0)\r\n        return result;\r\n    }\r\n    else {\r\n      /* read nothing but since we wanted nothing we consider this an OK\r\n         situation to proceed from */\r\n      nread = 0;\r\n    }\r\n\r\n    if((k->bytecount == 0) && (k->writebytecount == 0)) {\r\n      Curl_pgrsTime(data, TIMER_STARTTRANSFER);\r\n      if(k->exp100 > EXP100_SEND_DATA)\r\n        /* set time stamp to compare with when waiting for the 100 */\r\n        k->start100 = Curl_tvnow();\r\n    }\r\n\r\n    *didwhat |= KEEP_RECV;\r\n    /* indicates data of zero size, i.e. empty file */\r\n    is_empty_data = ((nread == 0) && (k->bodywrites == 0)) ? TRUE : FALSE;\r\n\r\n    /* NUL terminate, allowing string ops to be used */\r\n    if(0 < nread || is_empty_data) {\r\n      k->buf[nread] = 0;\r\n    }\r\n    else if(0 >= nread) {\r\n      /* if we receive 0 or less here, the server closed the connection\r\n         and we bail out from this! */\r\n      DEBUGF(infof(data, \"nread <= 0, server closed connection, bailing\\n\"));\r\n      k->keepon &= ~KEEP_RECV;\r\n      break;\r\n    }\r\n\r\n    /* Default buffer to use when we write the buffer, it may be changed\r\n       in the flow below before the actual storing is done. */\r\n    k->str = k->buf;\r\n\r\n    if(conn->handler->readwrite) {\r\n      result = conn->handler->readwrite(data, conn, &nread, &readmore);\r\n      if(result)\r\n        return result;\r\n      if(readmore)\r\n        break;\r\n    }\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n    /* Since this is a two-state thing, we check if we are parsing\r\n       headers at the moment or not. */\r\n    if(k->header) {\r\n      /* we are in parse-the-header-mode */\r\n      bool stop_reading = FALSE;\r\n      result = Curl_http_readwrite_headers(data, conn, &nread, &stop_reading);\r\n      if(result)\r\n        return result;\r\n\r\n      if(conn->handler->readwrite &&\r\n         (k->maxdownload <= 0 && nread > 0)) {\r\n        result = conn->handler->readwrite(data, conn, &nread, &readmore);\r\n        if(result)\r\n          return result;\r\n        if(readmore)\r\n          break;\r\n      }\r\n\r\n      if(stop_reading) {\r\n        /* We've stopped dealing with input, get out of the do-while loop */\r\n\r\n        if(nread > 0) {\r\n          if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {\r\n            infof(data,\r\n                  \"Rewinding stream by : %zd\"\r\n                  \" bytes on url %s (zero-length body)\\n\",\r\n                  nread, data->state.path);\r\n            read_rewind(conn, (size_t)nread);\r\n          }\r\n          else {\r\n            infof(data,\r\n                  \"Excess found in a non pipelined read:\"\r\n                  \" excess = %zd\"\r\n                  \" url = %s (zero-length body)\\n\",\r\n                  nread, data->state.path);\r\n          }\r\n        }\r\n\r\n        break;\r\n      }\r\n    }\r\n#endif /* CURL_DISABLE_HTTP */\r\n\r\n\r\n    /* This is not an 'else if' since it may be a rest from the header\r\n       parsing, where the beginning of the buffer is headers and the end\r\n       is non-headers. */\r\n    if(k->str && !k->header && (nread > 0 || is_empty_data)) {\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n      if(0 == k->bodywrites && !is_empty_data) {\r\n        /* These checks are only made the first time we are about to\r\n           write a piece of the body */\r\n        if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {\r\n          /* HTTP-only checks */\r\n\r\n          if(data->req.newurl) {\r\n            if(conn->bits.close) {\r\n              /* Abort after the headers if \"follow Location\" is set\r\n                 and we're set to close anyway. */\r\n              k->keepon &= ~KEEP_RECV;\r\n              *done = TRUE;\r\n              return CURLE_OK;\r\n            }\r\n            /* We have a new url to load, but since we want to be able\r\n               to re-use this connection properly, we read the full\r\n               response in \"ignore more\" */\r\n            k->ignorebody = TRUE;\r\n            infof(data, \"Ignoring the response-body\\n\");\r\n          }\r\n          if(data->state.resume_from && !k->content_range &&\r\n             (data->set.httpreq==HTTPREQ_GET) &&\r\n             !k->ignorebody) {\r\n            /* we wanted to resume a download, although the server doesn't\r\n             * seem to support this and we did this with a GET (if it\r\n             * wasn't a GET we did a POST or PUT resume) */\r\n            failf(data, \"HTTP server doesn't seem to support \"\r\n                  \"byte ranges. Cannot resume.\");\r\n            return CURLE_RANGE_ERROR;\r\n          }\r\n\r\n          if(data->set.timecondition && !data->state.range) {\r\n            /* A time condition has been set AND no ranges have been\r\n               requested. This seems to be what chapter 13.3.4 of\r\n               RFC 2616 defines to be the correct action for a\r\n               HTTP/1.1 client */\r\n\r\n            if(!Curl_meets_timecondition(data, k->timeofdoc)) {\r\n              *done = TRUE;\r\n              /* we abort the transfer before it is completed == we ruin the\r\n                 re-use ability. Close the connection */\r\n              conn->bits.close = TRUE;\r\n              return CURLE_OK;\r\n            }\r\n          } /* we have a time condition */\r\n\r\n        } /* this is HTTP or RTSP */\r\n      } /* this is the first time we write a body part */\r\n#endif /* CURL_DISABLE_HTTP */\r\n\r\n      k->bodywrites++;\r\n\r\n      /* pass data to the debug function before it gets \"dechunked\" */\r\n      if(data->set.verbose) {\r\n        if(k->badheader) {\r\n          Curl_debug(data, CURLINFO_DATA_IN, data->state.headerbuff,\r\n                     (size_t)k->hbuflen, conn);\r\n          if(k->badheader == HEADER_PARTHEADER)\r\n            Curl_debug(data, CURLINFO_DATA_IN,\r\n                       k->str, (size_t)nread, conn);\r\n        }\r\n        else\r\n          Curl_debug(data, CURLINFO_DATA_IN,\r\n                     k->str, (size_t)nread, conn);\r\n      }\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n      if(k->chunk) {\r\n        /*\r\n         * Here comes a chunked transfer flying and we need to decode this\r\n         * properly.  While the name says read, this function both reads\r\n         * and writes away the data. The returned 'nread' holds the number\r\n         * of actual data it wrote to the client.\r\n         */\r\n\r\n        CHUNKcode res =\r\n          Curl_httpchunk_read(conn, k->str, nread, &nread);\r\n\r\n        if(CHUNKE_OK < res) {\r\n          if(CHUNKE_WRITE_ERROR == res) {\r\n            failf(data, \"Failed writing data\");\r\n            return CURLE_WRITE_ERROR;\r\n          }\r\n          failf(data, \"Problem (%d) in the Chunked-Encoded data\", (int)res);\r\n          return CURLE_RECV_ERROR;\r\n        }\r\n        else if(CHUNKE_STOP == res) {\r\n          size_t dataleft;\r\n          /* we're done reading chunks! */\r\n          k->keepon &= ~KEEP_RECV; /* read no more */\r\n\r\n          /* There are now possibly N number of bytes at the end of the\r\n             str buffer that weren't written to the client.\r\n\r\n             We DO care about this data if we are pipelining.\r\n             Push it back to be read on the next pass. */\r\n\r\n          dataleft = conn->chunk.dataleft;\r\n          if(dataleft != 0) {\r\n            infof(conn->data, \"Leftovers after chunking: %zu bytes\\n\",\r\n                  dataleft);\r\n            if(conn->data->multi &&\r\n               Curl_multi_canPipeline(conn->data->multi)) {\r\n              /* only attempt the rewind if we truly are pipelining */\r\n              infof(conn->data, \"Rewinding %zu bytes\\n\",dataleft);\r\n              read_rewind(conn, dataleft);\r\n            }\r\n          }\r\n        }\r\n        /* If it returned OK, we just keep going */\r\n      }\r\n#endif   /* CURL_DISABLE_HTTP */\r\n\r\n      /* Account for body content stored in the header buffer */\r\n      if(k->badheader && !k->ignorebody) {\r\n        DEBUGF(infof(data, \"Increasing bytecount by %zu from hbuflen\\n\",\r\n                     k->hbuflen));\r\n        k->bytecount += k->hbuflen;\r\n      }\r\n\r\n      if((-1 != k->maxdownload) &&\r\n         (k->bytecount + nread >= k->maxdownload)) {\r\n\r\n        excess = (size_t)(k->bytecount + nread - k->maxdownload);\r\n        if(excess > 0 && !k->ignorebody) {\r\n          if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {\r\n            /* The 'excess' amount below can't be more than BUFSIZE which\r\n               always will fit in a size_t */\r\n            infof(data,\r\n                  \"Rewinding stream by : %zu\"\r\n                  \" bytes on url %s (size = %\" FORMAT_OFF_T\r\n                  \", maxdownload = %\" FORMAT_OFF_T\r\n                  \", bytecount = %\" FORMAT_OFF_T \", nread = %zd)\\n\",\r\n                  excess, data->state.path,\r\n                  k->size, k->maxdownload, k->bytecount, nread);\r\n            read_rewind(conn, excess);\r\n          }\r\n          else {\r\n            infof(data,\r\n                  \"Excess found in a non pipelined read:\"\r\n                  \" excess = %zu\"\r\n                  \", size = %\" FORMAT_OFF_T\r\n                  \", maxdownload = %\" FORMAT_OFF_T\r\n                  \", bytecount = %\" FORMAT_OFF_T \"\\n\",\r\n                  excess, k->size, k->maxdownload, k->bytecount);\r\n          }\r\n        }\r\n\r\n        nread = (ssize_t) (k->maxdownload - k->bytecount);\r\n        if(nread < 0 ) /* this should be unusual */\r\n          nread = 0;\r\n\r\n        k->keepon &= ~KEEP_RECV; /* we're done reading */\r\n      }\r\n\r\n      k->bytecount += nread;\r\n\r\n      Curl_pgrsSetDownloadCounter(data, k->bytecount);\r\n\r\n      if(!k->chunk && (nread || k->badheader || is_empty_data)) {\r\n        /* If this is chunky transfer, it was already written */\r\n\r\n        if(k->badheader && !k->ignorebody) {\r\n          /* we parsed a piece of data wrongly assuming it was a header\r\n             and now we output it as body instead */\r\n\r\n          /* Don't let excess data pollute body writes */\r\n          if(k->maxdownload == -1 || (curl_off_t)k->hbuflen <= k->maxdownload)\r\n            result = Curl_client_write(conn, CLIENTWRITE_BODY,\r\n                                       data->state.headerbuff,\r\n                                       k->hbuflen);\r\n          else\r\n            result = Curl_client_write(conn, CLIENTWRITE_BODY,\r\n                                       data->state.headerbuff,\r\n                                       (size_t)k->maxdownload);\r\n\r\n          if(result)\r\n            return result;\r\n        }\r\n        if(k->badheader < HEADER_ALLBAD) {\r\n          /* This switch handles various content encodings. If there's an\r\n             error here, be sure to check over the almost identical code\r\n             in http_chunks.c.\r\n             Make sure that ALL_CONTENT_ENCODINGS contains all the\r\n             encodings handled here. */\r\n#ifdef HAVE_LIBZ\r\n          switch (conn->data->set.http_ce_skip ?\r\n                  IDENTITY : k->auto_decoding) {\r\n          case IDENTITY:\r\n#endif\r\n            /* This is the default when the server sends no\r\n               Content-Encoding header. See Curl_readwrite_init; the\r\n               memset() call initializes k->auto_decoding to zero. */\r\n            if(!k->ignorebody) {\r\n\r\n#ifndef CURL_DISABLE_POP3\r\n              if(conn->handler->protocol&CURLPROTO_POP3)\r\n                result = Curl_pop3_write(conn, k->str, nread);\r\n              else\r\n#endif /* CURL_DISABLE_POP3 */\r\n\r\n                result = Curl_client_write(conn, CLIENTWRITE_BODY, k->str,\r\n                                           nread);\r\n            }\r\n#ifdef HAVE_LIBZ\r\n            break;\r\n\r\n          case DEFLATE:\r\n            /* Assume CLIENTWRITE_BODY; headers are not encoded. */\r\n            if(!k->ignorebody)\r\n              result = Curl_unencode_deflate_write(conn, k, nread);\r\n            break;\r\n\r\n          case GZIP:\r\n            /* Assume CLIENTWRITE_BODY; headers are not encoded. */\r\n            if(!k->ignorebody)\r\n              result = Curl_unencode_gzip_write(conn, k, nread);\r\n            break;\r\n\r\n          case COMPRESS:\r\n          default:\r\n            failf (data, \"Unrecognized content encoding type. \"\r\n                   \"libcurl understands `identity', `deflate' and `gzip' \"\r\n                   \"content encodings.\");\r\n            result = CURLE_BAD_CONTENT_ENCODING;\r\n            break;\r\n          }\r\n#endif\r\n        }\r\n        k->badheader = HEADER_NORMAL; /* taken care of now */\r\n\r\n        if(result)\r\n          return result;\r\n      }\r\n\r\n    } /* if(! header and data to read ) */\r\n\r\n    if(conn->handler->readwrite &&\r\n       (excess > 0 && !conn->bits.stream_was_rewound)) {\r\n      /* Parse the excess data */\r\n      k->str += nread;\r\n      nread = (ssize_t)excess;\r\n\r\n      result = conn->handler->readwrite(data, conn, &nread, &readmore);\r\n      if(result)\r\n        return result;\r\n\r\n      if(readmore)\r\n        k->keepon |= KEEP_RECV; /* we're not done reading */\r\n      break;\r\n    }\r\n\r\n    if(is_empty_data) {\r\n      /* if we received nothing, the server closed the connection and we\r\n         are done */\r\n      k->keepon &= ~KEEP_RECV;\r\n    }\r\n\r\n  } while(data_pending(conn));\r\n\r\n  if(((k->keepon & (KEEP_RECV|KEEP_SEND)) == KEEP_SEND) &&\r\n     conn->bits.close ) {\r\n    /* When we've read the entire thing and the close bit is set, the server\r\n       may now close the connection. If there's now any kind of sending going\r\n       on from our side, we need to stop that immediately. */\r\n    infof(data, \"we are done reading and this is set to close, stop send\\n\");\r\n    k->keepon &= ~KEEP_SEND; /* no writing anymore either */\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Send data to upload to the server, when the socket is writable.\r\n */\r\nstatic CURLcode readwrite_upload(struct SessionHandle *data,\r\n                                 struct connectdata *conn,\r\n                                 struct SingleRequest *k,\r\n                                 int *didwhat)\r\n{\r\n  ssize_t i, si;\r\n  ssize_t bytes_written;\r\n  CURLcode result;\r\n  ssize_t nread; /* number of bytes read */\r\n  bool sending_http_headers = FALSE;\r\n\r\n  if((k->bytecount == 0) && (k->writebytecount == 0))\r\n    Curl_pgrsTime(data, TIMER_STARTTRANSFER);\r\n\r\n  *didwhat |= KEEP_SEND;\r\n\r\n  /*\r\n   * We loop here to do the READ and SEND loop until we run out of\r\n   * data to send or until we get EWOULDBLOCK back\r\n   *\r\n   * FIXME: above comment is misleading. Currently no looping is\r\n   * actually done in do-while loop below.\r\n   */\r\n  do {\r\n\r\n    /* only read more data if there's no upload data already\r\n       present in the upload buffer */\r\n    if(0 == data->req.upload_present) {\r\n      /* init the \"upload from here\" pointer */\r\n      data->req.upload_fromhere = k->uploadbuf;\r\n\r\n      if(!k->upload_done) {\r\n        /* HTTP pollution, this should be written nicer to become more\r\n           protocol agnostic. */\r\n        int fillcount;\r\n\r\n        if((k->exp100 == EXP100_SENDING_REQUEST) &&\r\n           (data->state.proto.http->sending == HTTPSEND_BODY)) {\r\n          /* If this call is to send body data, we must take some action:\r\n             We have sent off the full HTTP 1.1 request, and we shall now\r\n             go into the Expect: 100 state and await such a header */\r\n          k->exp100 = EXP100_AWAITING_CONTINUE; /* wait for the header */\r\n          k->keepon &= ~KEEP_SEND;         /* disable writing */\r\n          k->start100 = Curl_tvnow();       /* timeout count starts now */\r\n          *didwhat &= ~KEEP_SEND;  /* we didn't write anything actually */\r\n\r\n          /* set a timeout for the multi interface */\r\n          Curl_expire(data, CURL_TIMEOUT_EXPECT_100);\r\n          break;\r\n        }\r\n\r\n        if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {\r\n          if(data->state.proto.http->sending == HTTPSEND_REQUEST)\r\n            /* We're sending the HTTP request headers, not the data.\r\n               Remember that so we don't change the line endings. */\r\n            sending_http_headers = TRUE;\r\n          else\r\n            sending_http_headers = FALSE;\r\n        }\r\n\r\n        result = Curl_fillreadbuffer(conn, BUFSIZE, &fillcount);\r\n        if(result)\r\n          return result;\r\n\r\n        nread = (ssize_t)fillcount;\r\n      }\r\n      else\r\n        nread = 0; /* we're done uploading/reading */\r\n\r\n      if(!nread && (k->keepon & KEEP_SEND_PAUSE)) {\r\n        /* this is a paused transfer */\r\n        break;\r\n      }\r\n      else if(nread<=0) {\r\n        /* done */\r\n        k->keepon &= ~KEEP_SEND; /* we're done writing */\r\n\r\n        if(conn->bits.rewindaftersend) {\r\n          result = Curl_readrewind(conn);\r\n          if(result)\r\n            return result;\r\n        }\r\n        break;\r\n      }\r\n\r\n      /* store number of bytes available for upload */\r\n      data->req.upload_present = nread;\r\n\r\n#ifndef CURL_DISABLE_SMTP\r\n      if(conn->handler->protocol & CURLPROTO_SMTP) {\r\n        result = Curl_smtp_escape_eob(conn, nread);\r\n        if(result)\r\n          return result;\r\n      }\r\n      else\r\n#endif /* CURL_DISABLE_SMTP */\r\n\r\n      /* convert LF to CRLF if so asked */\r\n      if((!sending_http_headers) && (\r\n#ifdef CURL_DO_LINEEND_CONV\r\n         /* always convert if we're FTPing in ASCII mode */\r\n         (data->set.prefer_ascii) ||\r\n#endif\r\n         (data->set.crlf))) {\r\n        if(data->state.scratch == NULL)\r\n          data->state.scratch = malloc(2*BUFSIZE);\r\n        if(data->state.scratch == NULL) {\r\n          failf (data, \"Failed to alloc scratch buffer!\");\r\n          return CURLE_OUT_OF_MEMORY;\r\n        }\r\n        /*\r\n         * ASCII/EBCDIC Note: This is presumably a text (not binary)\r\n         * transfer so the data should already be in ASCII.\r\n         * That means the hex values for ASCII CR (0x0d) & LF (0x0a)\r\n         * must be used instead of the escape sequences \\r & \\n.\r\n         */\r\n        for(i = 0, si = 0; i < nread; i++, si++) {\r\n          if(data->req.upload_fromhere[i] == 0x0a) {\r\n            data->state.scratch[si++] = 0x0d;\r\n            data->state.scratch[si] = 0x0a;\r\n            if(!data->set.crlf) {\r\n              /* we're here only because FTP is in ASCII mode...\r\n                 bump infilesize for the LF we just added */\r\n              data->set.infilesize++;\r\n            }\r\n          }\r\n          else\r\n            data->state.scratch[si] = data->req.upload_fromhere[i];\r\n        }\r\n        if(si != nread) {\r\n          /* only perform the special operation if we really did replace\r\n             anything */\r\n          nread = si;\r\n\r\n          /* upload from the new (replaced) buffer instead */\r\n          data->req.upload_fromhere = data->state.scratch;\r\n\r\n          /* set the new amount too */\r\n          data->req.upload_present = nread;\r\n        }\r\n      }\r\n    } /* if 0 == data->req.upload_present */\r\n    else {\r\n      /* We have a partial buffer left from a previous \"round\". Use\r\n         that instead of reading more data */\r\n    }\r\n\r\n    /* write to socket (send away data) */\r\n    result = Curl_write(conn,\r\n                        conn->writesockfd,     /* socket to send to */\r\n                        data->req.upload_fromhere, /* buffer pointer */\r\n                        data->req.upload_present,  /* buffer size */\r\n                        &bytes_written);           /* actually sent */\r\n\r\n    if(result)\r\n      return result;\r\n\r\n    if(data->set.verbose)\r\n      /* show the data before we change the pointer upload_fromhere */\r\n      Curl_debug(data, CURLINFO_DATA_OUT, data->req.upload_fromhere,\r\n                 (size_t)bytes_written, conn);\r\n\r\n    k->writebytecount += bytes_written;\r\n\r\n    if(k->writebytecount == data->set.infilesize) {\r\n      /* we have sent all data we were supposed to */\r\n      k->upload_done = TRUE;\r\n      infof(data, \"We are completely uploaded and fine\\n\");\r\n    }\r\n\r\n    if(data->req.upload_present != bytes_written) {\r\n      /* we only wrote a part of the buffer (if anything), deal with it! */\r\n\r\n      /* store the amount of bytes left in the buffer to write */\r\n      data->req.upload_present -= bytes_written;\r\n\r\n      /* advance the pointer where to find the buffer when the next send\r\n         is to happen */\r\n      data->req.upload_fromhere += bytes_written;\r\n    }\r\n    else {\r\n      /* we've uploaded that buffer now */\r\n      data->req.upload_fromhere = k->uploadbuf;\r\n      data->req.upload_present = 0; /* no more bytes left */\r\n\r\n      if(k->upload_done) {\r\n        /* switch off writing, we're done! */\r\n        k->keepon &= ~KEEP_SEND; /* we're done writing */\r\n      }\r\n    }\r\n\r\n    Curl_pgrsSetUploadCounter(data, k->writebytecount);\r\n\r\n  } WHILE_FALSE; /* just to break out from! */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_readwrite() is the low-level function to be called when data is to\r\n * be read and written to/from the connection.\r\n */\r\nCURLcode Curl_readwrite(struct connectdata *conn,\r\n                        bool *done)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct SingleRequest *k = &data->req;\r\n  CURLcode result;\r\n  int didwhat=0;\r\n\r\n  curl_socket_t fd_read;\r\n  curl_socket_t fd_write;\r\n  int select_res = conn->cselect_bits;\r\n\r\n  conn->cselect_bits = 0;\r\n\r\n  /* only use the proper socket if the *_HOLD bit is not set simultaneously as\r\n     then we are in rate limiting state in that transfer direction */\r\n\r\n  if((k->keepon & KEEP_RECVBITS) == KEEP_RECV)\r\n    fd_read = conn->sockfd;\r\n  else\r\n    fd_read = CURL_SOCKET_BAD;\r\n\r\n  if((k->keepon & KEEP_SENDBITS) == KEEP_SEND)\r\n    fd_write = conn->writesockfd;\r\n  else\r\n    fd_write = CURL_SOCKET_BAD;\r\n\r\n  if(!select_res) /* Call for select()/poll() only, if read/write/error\r\n                     status is not known. */\r\n    select_res = Curl_socket_ready(fd_read, fd_write, 0);\r\n\r\n  if(select_res == CURL_CSELECT_ERR) {\r\n    failf(data, \"select/poll returned error\");\r\n    return CURLE_SEND_ERROR;\r\n  }\r\n\r\n  /* We go ahead and do a read if we have a readable socket or if\r\n     the stream was rewound (in which case we have data in a\r\n     buffer) */\r\n  if((k->keepon & KEEP_RECV) &&\r\n     ((select_res & CURL_CSELECT_IN) || conn->bits.stream_was_rewound)) {\r\n\r\n    result = readwrite_data(data, conn, k, &didwhat, done);\r\n    if(result || *done)\r\n      return result;\r\n  }\r\n\r\n  /* If we still have writing to do, we check if we have a writable socket. */\r\n  if((k->keepon & KEEP_SEND) && (select_res & CURL_CSELECT_OUT)) {\r\n    /* write */\r\n\r\n    result = readwrite_upload(data, conn, k, &didwhat);\r\n    if(result)\r\n      return result;\r\n  }\r\n\r\n  k->now = Curl_tvnow();\r\n  if(didwhat) {\r\n    /* Update read/write counters */\r\n    if(k->bytecountp)\r\n      *k->bytecountp = k->bytecount; /* read count */\r\n    if(k->writebytecountp)\r\n      *k->writebytecountp = k->writebytecount; /* write count */\r\n  }\r\n  else {\r\n    /* no read no write, this is a timeout? */\r\n    if(k->exp100 == EXP100_AWAITING_CONTINUE) {\r\n      /* This should allow some time for the header to arrive, but only a\r\n         very short time as otherwise it'll be too much wasted time too\r\n         often. */\r\n\r\n      /* Quoting RFC2616, section \"8.2.3 Use of the 100 (Continue) Status\":\r\n\r\n         Therefore, when a client sends this header field to an origin server\r\n         (possibly via a proxy) from which it has never seen a 100 (Continue)\r\n         status, the client SHOULD NOT wait for an indefinite period before\r\n         sending the request body.\r\n\r\n      */\r\n\r\n      long ms = Curl_tvdiff(k->now, k->start100);\r\n      if(ms > CURL_TIMEOUT_EXPECT_100) {\r\n        /* we've waited long enough, continue anyway */\r\n        k->exp100 = EXP100_SEND_DATA;\r\n        k->keepon |= KEEP_SEND;\r\n        infof(data, \"Done waiting for 100-continue\\n\");\r\n      }\r\n    }\r\n  }\r\n\r\n  if(Curl_pgrsUpdate(conn))\r\n    result = CURLE_ABORTED_BY_CALLBACK;\r\n  else\r\n    result = Curl_speedcheck(data, k->now);\r\n  if(result)\r\n    return result;\r\n\r\n  if(k->keepon) {\r\n    if(0 > Curl_timeleft(data, &k->now, FALSE)) {\r\n      if(k->size != -1) {\r\n        failf(data, \"Operation timed out after %ld milliseconds with %\"\r\n              FORMAT_OFF_T \" out of %\" FORMAT_OFF_T \" bytes received\",\r\n              Curl_tvdiff(k->now, data->progress.t_startsingle), k->bytecount,\r\n              k->size);\r\n      }\r\n      else {\r\n        failf(data, \"Operation timed out after %ld milliseconds with %\"\r\n              FORMAT_OFF_T \" bytes received\",\r\n              Curl_tvdiff(k->now, data->progress.t_startsingle), k->bytecount);\r\n      }\r\n      return CURLE_OPERATION_TIMEDOUT;\r\n    }\r\n  }\r\n  else {\r\n    /*\r\n     * The transfer has been performed. Just make some general checks before\r\n     * returning.\r\n     */\r\n\r\n    if(!(data->set.opt_no_body) && (k->size != -1) &&\r\n       (k->bytecount != k->size) &&\r\n#ifdef CURL_DO_LINEEND_CONV\r\n       /* Most FTP servers don't adjust their file SIZE response for CRLFs,\r\n          so we'll check to see if the discrepancy can be explained\r\n          by the number of CRLFs we've changed to LFs.\r\n       */\r\n       (k->bytecount != (k->size + data->state.crlf_conversions)) &&\r\n#endif /* CURL_DO_LINEEND_CONV */\r\n       !data->req.newurl) {\r\n      failf(data, \"transfer closed with %\" FORMAT_OFF_T\r\n            \" bytes remaining to read\",\r\n            k->size - k->bytecount);\r\n      return CURLE_PARTIAL_FILE;\r\n    }\r\n    else if(!(data->set.opt_no_body) &&\r\n            k->chunk &&\r\n            (conn->chunk.state != CHUNK_STOP)) {\r\n      /*\r\n       * In chunked mode, return an error if the connection is closed prior to\r\n       * the empty (terminating) chunk is read.\r\n       *\r\n       * The condition above used to check for\r\n       * conn->proto.http->chunk.datasize != 0 which is true after reading\r\n       * *any* chunk, not just the empty chunk.\r\n       *\r\n       */\r\n      failf(data, \"transfer closed with outstanding read data remaining\");\r\n      return CURLE_PARTIAL_FILE;\r\n    }\r\n    if(Curl_pgrsUpdate(conn))\r\n      return CURLE_ABORTED_BY_CALLBACK;\r\n  }\r\n\r\n  /* Now update the \"done\" boolean we return */\r\n  *done = (0 == (k->keepon&(KEEP_RECV|KEEP_SEND|\r\n                            KEEP_RECV_PAUSE|KEEP_SEND_PAUSE))) ? TRUE : FALSE;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_single_getsock() gets called by the multi interface code when the app\r\n * has requested to get the sockets for the current connection. This function\r\n * will then be called once for every connection that the multi interface\r\n * keeps track of. This function will only be called for connections that are\r\n * in the proper state to have this information available.\r\n */\r\nint Curl_single_getsock(const struct connectdata *conn,\r\n                        curl_socket_t *sock, /* points to numsocks number\r\n                                                of sockets */\r\n                        int numsocks)\r\n{\r\n  const struct SessionHandle *data = conn->data;\r\n  int bitmap = GETSOCK_BLANK;\r\n  unsigned sockindex = 0;\r\n\r\n  if(conn->handler->perform_getsock)\r\n    return conn->handler->perform_getsock(conn, sock, numsocks);\r\n\r\n  if(numsocks < 2)\r\n    /* simple check but we might need two slots */\r\n    return GETSOCK_BLANK;\r\n\r\n  /* don't include HOLD and PAUSE connections */\r\n  if((data->req.keepon & KEEP_RECVBITS) == KEEP_RECV) {\r\n\r\n    DEBUGASSERT(conn->sockfd != CURL_SOCKET_BAD);\r\n\r\n    bitmap |= GETSOCK_READSOCK(sockindex);\r\n    sock[sockindex] = conn->sockfd;\r\n  }\r\n\r\n  /* don't include HOLD and PAUSE connections */\r\n  if((data->req.keepon & KEEP_SENDBITS) == KEEP_SEND) {\r\n\r\n    if((conn->sockfd != conn->writesockfd) ||\r\n       !(data->req.keepon & KEEP_RECV)) {\r\n      /* only if they are not the same socket or we didn't have a readable\r\n         one, we increase index */\r\n      if(data->req.keepon & KEEP_RECV)\r\n        sockindex++; /* increase index if we need two entries */\r\n\r\n      DEBUGASSERT(conn->writesockfd != CURL_SOCKET_BAD);\r\n\r\n      sock[sockindex] = conn->writesockfd;\r\n    }\r\n\r\n    bitmap |= GETSOCK_WRITESOCK(sockindex);\r\n  }\r\n\r\n  return bitmap;\r\n}\r\n\r\n/*\r\n * Determine optimum sleep time based on configured rate, current rate,\r\n * and packet size.\r\n * Returns value in milliseconds.\r\n *\r\n * The basic idea is to adjust the desired rate up/down in this method\r\n * based on whether we are running too slow or too fast.  Then, calculate\r\n * how many milliseconds to wait for the next packet to achieve this new\r\n * rate.\r\n */\r\nlong Curl_sleep_time(curl_off_t rate_bps, curl_off_t cur_rate_bps,\r\n                             int pkt_size)\r\n{\r\n  curl_off_t min_sleep = 0;\r\n  curl_off_t rv = 0;\r\n\r\n  if(rate_bps == 0)\r\n    return 0;\r\n\r\n  /* If running faster than about .1% of the desired speed, slow\r\n   * us down a bit.  Use shift instead of division as the 0.1%\r\n   * cutoff is arbitrary anyway.\r\n   */\r\n  if(cur_rate_bps > (rate_bps + (rate_bps >> 10))) {\r\n    /* running too fast, decrease target rate by 1/64th of rate */\r\n    rate_bps -= rate_bps >> 6;\r\n    min_sleep = 1;\r\n  }\r\n  else if(cur_rate_bps < (rate_bps - (rate_bps >> 10))) {\r\n    /* running too slow, increase target rate by 1/64th of rate */\r\n    rate_bps += rate_bps >> 6;\r\n  }\r\n\r\n  /* Determine number of milliseconds to wait until we do\r\n   * the next packet at the adjusted rate.  We should wait\r\n   * longer when using larger packets, for instance.\r\n   */\r\n  rv = ((curl_off_t)((pkt_size * 8) * 1000) / rate_bps);\r\n\r\n  /* Catch rounding errors and always slow down at least 1ms if\r\n   * we are running too fast.\r\n   */\r\n  if(rv < min_sleep)\r\n    rv = min_sleep;\r\n\r\n  /* Bound value to fit in 'long' on 32-bit platform.  That's\r\n   * plenty long enough anyway!\r\n   */\r\n  if(rv > 0x7fffffff)\r\n    rv = 0x7fffffff;\r\n\r\n  return (long)rv;\r\n}\r\n\r\n/*\r\n * Curl_pretransfer() is called immediately before a transfer starts.\r\n */\r\nCURLcode Curl_pretransfer(struct SessionHandle *data)\r\n{\r\n  CURLcode res;\r\n  if(!data->change.url) {\r\n    /* we can't do anything without URL */\r\n    failf(data, \"No URL set!\");\r\n    return CURLE_URL_MALFORMAT;\r\n  }\r\n\r\n  /* Init the SSL session ID cache here. We do it here since we want to do it\r\n     after the *_setopt() calls (that could specify the size of the cache) but\r\n     before any transfer takes place. */\r\n  res = Curl_ssl_initsessions(data, data->set.ssl.max_ssl_sessions);\r\n  if(res)\r\n    return res;\r\n\r\n  data->set.followlocation=0; /* reset the location-follow counter */\r\n  data->state.this_is_a_follow = FALSE; /* reset this */\r\n  data->state.errorbuf = FALSE; /* no error has occurred */\r\n  data->state.httpversion = 0; /* don't assume any particular server version */\r\n\r\n  data->state.ssl_connect_retry = FALSE;\r\n\r\n  data->state.authproblem = FALSE;\r\n  data->state.authhost.want = data->set.httpauth;\r\n  data->state.authproxy.want = data->set.proxyauth;\r\n  Curl_safefree(data->info.wouldredirect);\r\n  data->info.wouldredirect = NULL;\r\n\r\n  /* If there is a list of cookie files to read, do it now! */\r\n  if(data->change.cookielist)\r\n    Curl_cookie_loadfiles(data);\r\n\r\n  /* If there is a list of host pairs to deal with */\r\n  if(data->change.resolve)\r\n    res = Curl_loadhostpairs(data);\r\n\r\n  if(!res) {\r\n    /* Allow data->set.use_port to set which port to use. This needs to be\r\n     * disabled for example when we follow Location: headers to URLs using\r\n     * different ports! */\r\n    data->state.allow_port = TRUE;\r\n\r\n#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)\r\n    /*************************************************************\r\n     * Tell signal handler to ignore SIGPIPE\r\n     *************************************************************/\r\n    if(!data->set.no_signal)\r\n      data->state.prev_signal = signal(SIGPIPE, SIG_IGN);\r\n#endif\r\n\r\n    Curl_initinfo(data); /* reset session-specific information \"variables\" */\r\n    Curl_pgrsStartNow(data);\r\n\r\n    if(data->set.timeout)\r\n      Curl_expire(data, data->set.timeout);\r\n\r\n    if(data->set.connecttimeout)\r\n      Curl_expire(data, data->set.connecttimeout);\r\n\r\n    /* In case the handle is re-used and an authentication method was picked\r\n       in the session we need to make sure we only use the one(s) we now\r\n       consider to be fine */\r\n    data->state.authhost.picked &= data->state.authhost.want;\r\n    data->state.authproxy.picked &= data->state.authproxy.want;\r\n  }\r\n\r\n  return res;\r\n}\r\n\r\n/*\r\n * Curl_posttransfer() is called immediately after a transfer ends\r\n */\r\nCURLcode Curl_posttransfer(struct SessionHandle *data)\r\n{\r\n#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)\r\n  /* restore the signal handler for SIGPIPE before we get back */\r\n  if(!data->set.no_signal)\r\n    signal(SIGPIPE, data->state.prev_signal);\r\n#else\r\n  (void)data; /* unused parameter */\r\n#endif\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n/*\r\n * strlen_url() returns the length of the given URL if the spaces within the\r\n * URL were properly URL encoded.\r\n */\r\nstatic size_t strlen_url(const char *url)\r\n{\r\n  const char *ptr;\r\n  size_t newlen=0;\r\n  bool left=TRUE; /* left side of the ? */\r\n\r\n  for(ptr=url; *ptr; ptr++) {\r\n    switch(*ptr) {\r\n    case '?':\r\n      left=FALSE;\r\n      /* fall through */\r\n    default:\r\n      newlen++;\r\n      break;\r\n    case ' ':\r\n      if(left)\r\n        newlen+=3;\r\n      else\r\n        newlen++;\r\n      break;\r\n    }\r\n  }\r\n  return newlen;\r\n}\r\n\r\n/* strcpy_url() copies a url to a output buffer and URL-encodes the spaces in\r\n * the source URL accordingly.\r\n */\r\nstatic void strcpy_url(char *output, const char *url)\r\n{\r\n  /* we must add this with whitespace-replacing */\r\n  bool left=TRUE;\r\n  const char *iptr;\r\n  char *optr = output;\r\n  for(iptr = url;    /* read from here */\r\n      *iptr;         /* until zero byte */\r\n      iptr++) {\r\n    switch(*iptr) {\r\n    case '?':\r\n      left=FALSE;\r\n      /* fall through */\r\n    default:\r\n      *optr++=*iptr;\r\n      break;\r\n    case ' ':\r\n      if(left) {\r\n        *optr++='%'; /* add a '%' */\r\n        *optr++='2'; /* add a '2' */\r\n        *optr++='0'; /* add a '0' */\r\n      }\r\n      else\r\n        *optr++='+'; /* add a '+' here */\r\n      break;\r\n    }\r\n  }\r\n  *optr=0; /* zero terminate output buffer */\r\n\r\n}\r\n\r\n/*\r\n * Returns true if the given URL is absolute (as opposed to relative)\r\n */\r\nstatic bool is_absolute_url(const char *url)\r\n{\r\n  char prot[16]; /* URL protocol string storage */\r\n  char letter;   /* used for a silly sscanf */\r\n\r\n  return (2 == sscanf(url, \"%15[^?&/:]://%c\", prot, &letter)) ? TRUE : FALSE;\r\n}\r\n\r\n/*\r\n * Concatenate a relative URL to a base URL making it absolute.\r\n * URL-encodes any spaces.\r\n * The returned pointer must be freed by the caller unless NULL\r\n * (returns NULL on out of memory).\r\n */\r\nstatic char *concat_url(const char *base, const char *relurl)\r\n{\r\n  /***\r\n   TRY to append this new path to the old URL\r\n   to the right of the host part. Oh crap, this is doomed to cause\r\n   problems in the future...\r\n  */\r\n  char *newest;\r\n  char *protsep;\r\n  char *pathsep;\r\n  size_t newlen;\r\n\r\n  const char *useurl = relurl;\r\n  size_t urllen;\r\n\r\n  /* we must make our own copy of the URL to play with, as it may\r\n     point to read-only data */\r\n  char *url_clone=strdup(base);\r\n\r\n  if(!url_clone)\r\n    return NULL; /* skip out of this NOW */\r\n\r\n  /* protsep points to the start of the host name */\r\n  protsep=strstr(url_clone, \"//\");\r\n  if(!protsep)\r\n    protsep=url_clone;\r\n  else\r\n    protsep+=2; /* pass the slashes */\r\n\r\n  if('/' != relurl[0]) {\r\n    int level=0;\r\n\r\n    /* First we need to find out if there's a ?-letter in the URL,\r\n       and cut it and the right-side of that off */\r\n    pathsep = strchr(protsep, '?');\r\n    if(pathsep)\r\n      *pathsep=0;\r\n\r\n    /* we have a relative path to append to the last slash if there's one\r\n       available, or if the new URL is just a query string (starts with a\r\n       '?')  we append the new one at the end of the entire currently worked\r\n       out URL */\r\n    if(useurl[0] != '?') {\r\n      pathsep = strrchr(protsep, '/');\r\n      if(pathsep)\r\n        *pathsep=0;\r\n    }\r\n\r\n    /* Check if there's any slash after the host name, and if so, remember\r\n       that position instead */\r\n    pathsep = strchr(protsep, '/');\r\n    if(pathsep)\r\n      protsep = pathsep+1;\r\n    else\r\n      protsep = NULL;\r\n\r\n    /* now deal with one \"./\" or any amount of \"../\" in the newurl\r\n       and act accordingly */\r\n\r\n    if((useurl[0] == '.') && (useurl[1] == '/'))\r\n      useurl+=2; /* just skip the \"./\" */\r\n\r\n    while((useurl[0] == '.') &&\r\n          (useurl[1] == '.') &&\r\n          (useurl[2] == '/')) {\r\n      level++;\r\n      useurl+=3; /* pass the \"../\" */\r\n    }\r\n\r\n    if(protsep) {\r\n      while(level--) {\r\n        /* cut off one more level from the right of the original URL */\r\n        pathsep = strrchr(protsep, '/');\r\n        if(pathsep)\r\n          *pathsep=0;\r\n        else {\r\n          *protsep=0;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  else {\r\n    /* We got a new absolute path for this server */\r\n\r\n    if((relurl[0] == '/') && (relurl[1] == '/')) {\r\n      /* the new URL starts with //, just keep the protocol part from the\r\n         original one */\r\n      *protsep=0;\r\n      useurl = &relurl[2]; /* we keep the slashes from the original, so we\r\n                              skip the new ones */\r\n    }\r\n    else {\r\n      /* cut off the original URL from the first slash, or deal with URLs\r\n         without slash */\r\n      pathsep = strchr(protsep, '/');\r\n      if(pathsep) {\r\n        /* When people use badly formatted URLs, such as\r\n           \"http://www.url.com?dir=/home/daniel\" we must not use the first\r\n           slash, if there's a ?-letter before it! */\r\n        char *sep = strchr(protsep, '?');\r\n        if(sep && (sep < pathsep))\r\n          pathsep = sep;\r\n        *pathsep=0;\r\n      }\r\n      else {\r\n        /* There was no slash. Now, since we might be operating on a badly\r\n           formatted URL, such as \"http://www.url.com?id=2380\" which doesn't\r\n           use a slash separator as it is supposed to, we need to check for a\r\n           ?-letter as well! */\r\n        pathsep = strchr(protsep, '?');\r\n        if(pathsep)\r\n          *pathsep=0;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* If the new part contains a space, this is a mighty stupid redirect\r\n     but we still make an effort to do \"right\". To the left of a '?'\r\n     letter we replace each space with %20 while it is replaced with '+'\r\n     on the right side of the '?' letter.\r\n  */\r\n  newlen = strlen_url(useurl);\r\n\r\n  urllen = strlen(url_clone);\r\n\r\n  newest = malloc(urllen + 1 + /* possible slash */\r\n                  newlen + 1 /* zero byte */);\r\n\r\n  if(!newest) {\r\n    free(url_clone); /* don't leak this */\r\n    return NULL;\r\n  }\r\n\r\n  /* copy over the root url part */\r\n  memcpy(newest, url_clone, urllen);\r\n\r\n  /* check if we need to append a slash */\r\n  if(('/' == useurl[0]) || (protsep && !*protsep) || ('?' == useurl[0]))\r\n    ;\r\n  else\r\n    newest[urllen++]='/';\r\n\r\n  /* then append the new piece on the right side */\r\n  strcpy_url(&newest[urllen], useurl);\r\n\r\n  free(url_clone);\r\n\r\n  return newest;\r\n}\r\n#endif /* CURL_DISABLE_HTTP */\r\n\r\n/*\r\n * Curl_follow() handles the URL redirect magic. Pass in the 'newurl' string\r\n * as given by the remote server and set up the new URL to request.\r\n */\r\nCURLcode Curl_follow(struct SessionHandle *data,\r\n                     char *newurl, /* this 'newurl' is the Location: string,\r\n                                      and it must be malloc()ed before passed\r\n                                      here */\r\n                     followtype type) /* see transfer.h */\r\n{\r\n#ifdef CURL_DISABLE_HTTP\r\n  (void)data;\r\n  (void)newurl;\r\n  (void)type;\r\n  /* Location: following will not happen when HTTP is disabled */\r\n  return CURLE_TOO_MANY_REDIRECTS;\r\n#else\r\n\r\n  /* Location: redirect */\r\n  bool disallowport = FALSE;\r\n\r\n  if(type == FOLLOW_REDIR) {\r\n    if((data->set.maxredirs != -1) &&\r\n        (data->set.followlocation >= data->set.maxredirs)) {\r\n      failf(data,\"Maximum (%ld) redirects followed\", data->set.maxredirs);\r\n      return CURLE_TOO_MANY_REDIRECTS;\r\n    }\r\n\r\n    /* mark the next request as a followed location: */\r\n    data->state.this_is_a_follow = TRUE;\r\n\r\n    data->set.followlocation++; /* count location-followers */\r\n\r\n    if(data->set.http_auto_referer) {\r\n      /* We are asked to automatically set the previous URL as the referer\r\n         when we get the next URL. We pick the ->url field, which may or may\r\n         not be 100% correct */\r\n\r\n      if(data->change.referer_alloc) {\r\n        Curl_safefree(data->change.referer);\r\n        data->change.referer_alloc = FALSE;\r\n      }\r\n\r\n      data->change.referer = strdup(data->change.url);\r\n      if(!data->change.referer)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      data->change.referer_alloc = TRUE; /* yes, free this later */\r\n    }\r\n  }\r\n\r\n  if(!is_absolute_url(newurl))  {\r\n    /***\r\n     *DANG* this is an RFC 2068 violation. The URL is supposed\r\n     to be absolute and this doesn't seem to be that!\r\n     */\r\n    char *absolute = concat_url(data->change.url, newurl);\r\n    if(!absolute)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    free(newurl);\r\n    newurl = absolute;\r\n  }\r\n  else {\r\n    /* This is an absolute URL, don't allow the custom port number */\r\n    disallowport = TRUE;\r\n\r\n    if(strchr(newurl, ' ')) {\r\n      /* This new URL contains at least one space, this is a mighty stupid\r\n         redirect but we still make an effort to do \"right\". */\r\n      char *newest;\r\n      size_t newlen = strlen_url(newurl);\r\n\r\n      newest = malloc(newlen+1); /* get memory for this */\r\n      if(!newest)\r\n        return CURLE_OUT_OF_MEMORY;\r\n      strcpy_url(newest, newurl); /* create a space-free URL */\r\n\r\n      free(newurl); /* that was no good */\r\n      newurl = newest; /* use this instead now */\r\n    }\r\n\r\n  }\r\n\r\n  if(type == FOLLOW_FAKE) {\r\n    /* we're only figuring out the new url if we would've followed locations\r\n       but now we're done so we can get out! */\r\n    data->info.wouldredirect = newurl;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(disallowport)\r\n    data->state.allow_port = FALSE;\r\n\r\n  if(data->change.url_alloc) {\r\n    Curl_safefree(data->change.url);\r\n    data->change.url_alloc = FALSE;\r\n  }\r\n\r\n  data->change.url = newurl;\r\n  data->change.url_alloc = TRUE;\r\n  newurl = NULL; /* don't free! */\r\n\r\n  infof(data, \"Issue another request to this URL: '%s'\\n\", data->change.url);\r\n\r\n  /*\r\n   * We get here when the HTTP code is 300-399 (and 401). We need to perform\r\n   * differently based on exactly what return code there was.\r\n   *\r\n   * News from 7.10.6: we can also get here on a 401 or 407, in case we act on\r\n   * a HTTP (proxy-) authentication scheme other than Basic.\r\n   */\r\n  switch(data->info.httpcode) {\r\n    /* 401 - Act on a WWW-Authenticate, we keep on moving and do the\r\n       Authorization: XXXX header in the HTTP request code snippet */\r\n    /* 407 - Act on a Proxy-Authenticate, we keep on moving and do the\r\n       Proxy-Authorization: XXXX header in the HTTP request code snippet */\r\n    /* 300 - Multiple Choices */\r\n    /* 306 - Not used */\r\n    /* 307 - Temporary Redirect */\r\n  default:  /* for all above (and the unknown ones) */\r\n    /* Some codes are explicitly mentioned since I've checked RFC2616 and they\r\n     * seem to be OK to POST to.\r\n     */\r\n    break;\r\n  case 301: /* Moved Permanently */\r\n    /* (quote from RFC2616, section 10.3.2):\r\n     *\r\n     * When automatically redirecting a POST request after receiving a 301\r\n     * status code, some existing HTTP/1.0 user agents will erroneously change\r\n     * it into a GET request.\r\n     *\r\n     * ----\r\n     *\r\n     * As most of the important user agents do this obvious RFC2616 violation,\r\n     * many webservers expect this. So these servers often answers to a POST\r\n     * request with an error page.  To be sure that libcurl gets the page that\r\n     * most user agents would get, libcurl has to force GET.\r\n     *\r\n     * This behavior can be overridden with CURLOPT_POSTREDIR.\r\n     */\r\n    if((data->set.httpreq == HTTPREQ_POST\r\n        || data->set.httpreq == HTTPREQ_POST_FORM)\r\n       && !(data->set.keep_post & CURL_REDIR_POST_301)) {\r\n      infof(data,\r\n            \"Violate RFC 2616/10.3.2 and switch from POST to GET\\n\");\r\n      data->set.httpreq = HTTPREQ_GET;\r\n    }\r\n    break;\r\n  case 302: /* Found */\r\n    /* (From 10.3.3)\r\n\r\n    Note: RFC 1945 and RFC 2068 specify that the client is not allowed\r\n    to change the method on the redirected request.  However, most\r\n    existing user agent implementations treat 302 as if it were a 303\r\n    response, performing a GET on the Location field-value regardless\r\n    of the original request method. The status codes 303 and 307 have\r\n    been added for servers that wish to make unambiguously clear which\r\n    kind of reaction is expected of the client.\r\n\r\n    (From 10.3.4)\r\n\r\n    Note: Many pre-HTTP/1.1 user agents do not understand the 303\r\n    status. When interoperability with such clients is a concern, the\r\n    302 status code may be used instead, since most user agents react\r\n    to a 302 response as described here for 303.\r\n\r\n    This behavior can be overridden with CURLOPT_POSTREDIR\r\n    */\r\n    if((data->set.httpreq == HTTPREQ_POST\r\n        || data->set.httpreq == HTTPREQ_POST_FORM)\r\n       && !(data->set.keep_post & CURL_REDIR_POST_302)) {\r\n      infof(data,\r\n            \"Violate RFC 2616/10.3.3 and switch from POST to GET\\n\");\r\n      data->set.httpreq = HTTPREQ_GET;\r\n    }\r\n    break;\r\n\r\n  case 303: /* See Other */\r\n    /* Disable both types of POSTs, unless the user explicitely\r\n       asks for POST after POST */\r\n    if(data->set.httpreq != HTTPREQ_GET\r\n      && !(data->set.keep_post & CURL_REDIR_POST_303)) {\r\n      data->set.httpreq = HTTPREQ_GET; /* enforce GET request */\r\n      infof(data, \"Disables POST, goes with %s\\n\",\r\n            data->set.opt_no_body?\"HEAD\":\"GET\");\r\n    }\r\n    break;\r\n  case 304: /* Not Modified */\r\n    /* 304 means we did a conditional request and it was \"Not modified\".\r\n     * We shouldn't get any Location: header in this response!\r\n     */\r\n    break;\r\n  case 305: /* Use Proxy */\r\n    /* (quote from RFC2616, section 10.3.6):\r\n     * \"The requested resource MUST be accessed through the proxy given\r\n     * by the Location field. The Location field gives the URI of the\r\n     * proxy.  The recipient is expected to repeat this single request\r\n     * via the proxy. 305 responses MUST only be generated by origin\r\n     * servers.\"\r\n     */\r\n    break;\r\n  }\r\n  Curl_pgrsTime(data, TIMER_REDIRECT);\r\n  Curl_pgrsResetTimesSizes(data);\r\n\r\n  return CURLE_OK;\r\n#endif /* CURL_DISABLE_HTTP */\r\n}\r\n\r\nCURLcode\r\nCurl_reconnect_request(struct connectdata **connp)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct connectdata *conn = *connp;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  /* This was a re-use of a connection and we got a write error in the\r\n   * DO-phase. Then we DISCONNECT this connection and have another attempt to\r\n   * CONNECT and then DO again! The retry cannot possibly find another\r\n   * connection to re-use, since we only keep one possible connection for\r\n   * each.  */\r\n\r\n  infof(data, \"Re-used connection seems dead, get a new one\\n\");\r\n\r\n  conn->bits.close = TRUE; /* enforce close of this connection */\r\n  result = Curl_done(&conn, result, FALSE); /* we are so done with this */\r\n\r\n  /* conn may no longer be a good pointer, clear it to avoid mistakes by\r\n     parent functions */\r\n  *connp = NULL;\r\n\r\n  /*\r\n   * According to bug report #1330310. We need to check for CURLE_SEND_ERROR\r\n   * here as well. I figure this could happen when the request failed on a FTP\r\n   * connection and thus Curl_done() itself tried to use the connection\r\n   * (again). Slight Lack of feedback in the report, but I don't think this\r\n   * extra check can do much harm.\r\n   */\r\n  if((CURLE_OK == result) || (CURLE_SEND_ERROR == result)) {\r\n    bool async;\r\n    bool protocol_done = TRUE;\r\n\r\n    /* Now, redo the connect and get a new connection */\r\n    result = Curl_connect(data, connp, &async, &protocol_done);\r\n    if(CURLE_OK == result) {\r\n      /* We have connected or sent away a name resolve query fine */\r\n\r\n      conn = *connp; /* setup conn to again point to something nice */\r\n      if(async) {\r\n        /* Now, if async is TRUE here, we need to wait for the name\r\n           to resolve */\r\n        result = Curl_resolver_wait_resolv(conn, NULL);\r\n        if(result)\r\n          return result;\r\n\r\n        /* Resolved, continue with the connection */\r\n        result = Curl_async_resolved(conn, &protocol_done);\r\n        if(result)\r\n          return result;\r\n      }\r\n    }\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/* Returns CURLE_OK *and* sets '*url' if a request retry is wanted.\r\n\r\n   NOTE: that the *url is malloc()ed. */\r\nCURLcode Curl_retry_request(struct connectdata *conn,\r\n                            char **url)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  *url = NULL;\r\n\r\n  /* if we're talking upload, we can't do the checks below, unless the protocol\r\n     is HTTP as when uploading over HTTP we will still get a response */\r\n  if(data->set.upload &&\r\n     !(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)))\r\n    return CURLE_OK;\r\n\r\n  if(/* workaround for broken TLS servers */ data->state.ssl_connect_retry ||\r\n      ((data->req.bytecount +\r\n        data->req.headerbytecount == 0) &&\r\n        conn->bits.reuse &&\r\n        !data->set.opt_no_body &&\r\n        data->set.rtspreq != RTSPREQ_RECEIVE)) {\r\n    /* We got no data, we attempted to re-use a connection and yet we want a\r\n       \"body\". This might happen if the connection was left alive when we were\r\n       done using it before, but that was closed when we wanted to read from\r\n       it again. Bad luck. Retry the same request on a fresh connect! */\r\n    infof(conn->data, \"Connection died, retrying a fresh connect\\n\");\r\n    *url = strdup(conn->data->change.url);\r\n    if(!*url)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    conn->bits.close = TRUE; /* close this connection */\r\n    conn->bits.retry = TRUE; /* mark this as a connection we're about\r\n                                to retry. Marking it this way should\r\n                                prevent i.e HTTP transfers to return\r\n                                error just because nothing has been\r\n                                transferred! */\r\n\r\n\r\n    if((conn->handler->protocol&CURLPROTO_HTTP) &&\r\n       data->state.proto.http->writebytecount)\r\n      return Curl_readrewind(conn);\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Curl_setup_transfer() is called to setup some basic properties for the\r\n * upcoming transfer.\r\n */\r\nvoid\r\nCurl_setup_transfer(\r\n  struct connectdata *conn, /* connection data */\r\n  int sockindex,            /* socket index to read from or -1 */\r\n  curl_off_t size,          /* -1 if unknown at this point */\r\n  bool getheader,           /* TRUE if header parsing is wanted */\r\n  curl_off_t *bytecountp,   /* return number of bytes read or NULL */\r\n  int writesockindex,       /* socket index to write to, it may very well be\r\n                               the same we read from. -1 disables */\r\n  curl_off_t *writecountp   /* return number of bytes written or NULL */\r\n  )\r\n{\r\n  struct SessionHandle *data;\r\n  struct SingleRequest *k;\r\n\r\n  DEBUGASSERT(conn != NULL);\r\n\r\n  data = conn->data;\r\n  k = &data->req;\r\n\r\n  DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));\r\n\r\n  /* now copy all input parameters */\r\n  conn->sockfd = sockindex == -1 ?\r\n      CURL_SOCKET_BAD : conn->sock[sockindex];\r\n  conn->writesockfd = writesockindex == -1 ?\r\n      CURL_SOCKET_BAD:conn->sock[writesockindex];\r\n  k->getheader = getheader;\r\n\r\n  k->size = size;\r\n  k->bytecountp = bytecountp;\r\n  k->writebytecountp = writecountp;\r\n\r\n  /* The code sequence below is placed in this function just because all\r\n     necessary input is not always known in do_complete() as this function may\r\n     be called after that */\r\n\r\n  if(!k->getheader) {\r\n    k->header = FALSE;\r\n    if(size > 0)\r\n      Curl_pgrsSetDownloadSize(data, size);\r\n  }\r\n  /* we want header and/or body, if neither then don't do this! */\r\n  if(k->getheader || !data->set.opt_no_body) {\r\n\r\n    if(conn->sockfd != CURL_SOCKET_BAD)\r\n      k->keepon |= KEEP_RECV;\r\n\r\n    if(conn->writesockfd != CURL_SOCKET_BAD) {\r\n      /* HTTP 1.1 magic:\r\n\r\n         Even if we require a 100-return code before uploading data, we might\r\n         need to write data before that since the REQUEST may not have been\r\n         finished sent off just yet.\r\n\r\n         Thus, we must check if the request has been sent before we set the\r\n         state info where we wait for the 100-return code\r\n      */\r\n      if((data->state.expect100header) &&\r\n         (data->state.proto.http->sending == HTTPSEND_BODY)) {\r\n        /* wait with write until we either got 100-continue or a timeout */\r\n        k->exp100 = EXP100_AWAITING_CONTINUE;\r\n        k->start100 = Curl_tvnow();\r\n\r\n        /* set a timeout for the multi interface */\r\n        Curl_expire(data, CURL_TIMEOUT_EXPECT_100);\r\n      }\r\n      else {\r\n        if(data->state.expect100header)\r\n          /* when we've sent off the rest of the headers, we must await a\r\n             100-continue but first finish sending the request */\r\n          k->exp100 = EXP100_SENDING_REQUEST;\r\n\r\n        /* enable the write bit when we're not waiting for continue */\r\n        k->keepon |= KEEP_SEND;\r\n      }\r\n    } /* if(conn->writesockfd != CURL_SOCKET_BAD) */\r\n  } /* if(k->getheader || !data->set.opt_no_body) */\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/transfer.h",
    "content": "#ifndef HEADER_CURL_TRANSFER_H\r\n#define HEADER_CURL_TRANSFER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\nCURLcode Curl_pretransfer(struct SessionHandle *data);\r\nCURLcode Curl_second_connect(struct connectdata *conn);\r\nCURLcode Curl_posttransfer(struct SessionHandle *data);\r\n\r\ntypedef enum {\r\n  FOLLOW_NONE,  /* not used within the function, just a placeholder to\r\n                   allow initing to this */\r\n  FOLLOW_FAKE,  /* only records stuff, not actually following */\r\n  FOLLOW_RETRY, /* set if this is a request retry as opposed to a real\r\n                          redirect following */\r\n  FOLLOW_REDIR, /* a full true redirect */\r\n  FOLLOW_LAST   /* never used */\r\n} followtype;\r\n\r\nCURLcode Curl_follow(struct SessionHandle *data, char *newurl,\r\n                     followtype type);\r\n\r\n\r\nCURLcode Curl_readwrite(struct connectdata *conn, bool *done);\r\nint Curl_single_getsock(const struct connectdata *conn,\r\n                        curl_socket_t *socks,\r\n                        int numsocks);\r\nCURLcode Curl_readrewind(struct connectdata *conn);\r\nCURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp);\r\nCURLcode Curl_reconnect_request(struct connectdata **connp);\r\nCURLcode Curl_retry_request(struct connectdata *conn, char **url);\r\nbool Curl_meets_timecondition(struct SessionHandle *data, time_t timeofdoc);\r\n\r\n/* This sets up a forthcoming transfer */\r\nvoid\r\nCurl_setup_transfer (struct connectdata *data,\r\n               int sockindex,           /* socket index to read from or -1 */\r\n               curl_off_t size,         /* -1 if unknown at this point */\r\n               bool getheader,          /* TRUE if header parsing is wanted */\r\n               curl_off_t *bytecountp,  /* return number of bytes read */\r\n               int writesockindex,      /* socket index to write to, it may\r\n                                           very well be the same we read from.\r\n                                           -1 disables */\r\n               curl_off_t *writecountp /* return number of bytes written */\r\n);\r\n\r\nlong Curl_sleep_time(curl_off_t rate_bps, curl_off_t cur_rate_bps,\r\n                     int pkt_size);\r\n\r\n#endif /* HEADER_CURL_TRANSFER_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/url.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4127 : conditional expression is constant\r\n#pragma warning( disable : 4127 )\r\n\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_NETDB_H\r\n#include <netdb.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#include <arpa/inet.h>\r\n#endif\r\n#ifdef HAVE_NET_IF_H\r\n#include <net/if.h>\r\n#endif\r\n#ifdef HAVE_SYS_IOCTL_H\r\n#include <sys/ioctl.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_PARAM_H\r\n#include <sys/param.h>\r\n#endif\r\n\r\n#ifdef __VMS\r\n#include <in.h>\r\n#include <inet.h>\r\n#endif\r\n\r\n#ifndef HAVE_SOCKET\r\n#error \"We can't compile without socket() support!\"\r\n#endif\r\n\r\n#ifdef HAVE_LIMITS_H\r\n#include <limits.h>\r\n#endif\r\n\r\n#ifdef USE_LIBIDN\r\n#include <idna.h>\r\n#include <tld.h>\r\n#include <stringprep.h>\r\n#ifdef HAVE_IDN_FREE_H\r\n#include <idn-free.h>\r\n#else\r\n/* prototype from idn-free.h, not provided by libidn 0.4.5's make install! */\r\nvoid idn_free (void *ptr);\r\n#endif\r\n#ifndef HAVE_IDN_FREE\r\n/* if idn_free() was not found in this version of libidn use free() instead */\r\n#define idn_free(x) (free)(x)\r\n#endif\r\n#elif defined(USE_WIN32_IDN)\r\n/* prototype for curl_win32_idn_to_ascii() */\r\nint curl_win32_idn_to_ascii(const char *in, char **out);\r\n#endif  /* USE_LIBIDN */\r\n\r\n#include \"urldata.h\"\r\n#include \"netrc.h\"\r\n\r\n#include \"formdata.h\"\r\n#include \"sslgen.h\"\r\n#include \"hostip.h\"\r\n#include \"transfer.h\"\r\n#include \"sendf.h\"\r\n#include \"progress.h\"\r\n#include \"cookie.h\"\r\n#include \"strequal.h\"\r\n#include \"strerror.h\"\r\n#include \"escape.h\"\r\n#include \"strtok.h\"\r\n#include \"share_curl.h\"\r\n#include \"content_encoding.h\"\r\n#include \"http_digest.h\"\r\n#include \"http_negotiate.h\"\r\n#include \"select.h\"\r\n#include \"multiif.h\"\r\n#include \"easyif.h\"\r\n#include \"speedcheck.h\"\r\n#include \"rawstr.h\"\r\n#include \"warnless.h\"\r\n#include \"non-ascii.h\"\r\n#include \"inet_pton.h\"\r\n\r\n/* And now for the protocols */\r\n#include \"ftp.h\"\r\n#include \"dict.h\"\r\n#include \"telnet.h\"\r\n#include \"tftp.h\"\r\n#include \"http.h\"\r\n#include \"file.h\"\r\n#include \"curl_ldap.h\"\r\n#include \"ssh.h\"\r\n#include \"imap.h\"\r\n#include \"url.h\"\r\n#include \"connect.h\"\r\n#include \"inet_ntop.h\"\r\n#include \"curl_ntlm.h\"\r\n#include \"curl_ntlm_wb.h\"\r\n#include \"socks.h\"\r\n#include \"curl_rtmp.h\"\r\n#include \"gopher.h\"\r\n#include \"http_proxy.h\"\r\n#include \"bundles.h\"\r\n#include \"conncache.h\"\r\n#include \"multihandle.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\n/* Local static prototypes */\r\nstatic struct connectdata *\r\nfind_oldest_idle_connection(struct SessionHandle *data);\r\nstatic void conn_free(struct connectdata *conn);\r\nstatic void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke);\r\nstatic CURLcode do_init(struct connectdata *conn);\r\nstatic CURLcode parse_url_userpass(struct SessionHandle *data,\r\n                                   struct connectdata *conn,\r\n                                   char *user, char *passwd);\r\n/*\r\n * Protocol table.\r\n */\r\n\r\nstatic const struct Curl_handler * const protocols[] = {\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n  &Curl_handler_http,\r\n#endif\r\n\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)\r\n  &Curl_handler_https,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_FTP\r\n  &Curl_handler_ftp,\r\n#endif\r\n\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)\r\n  &Curl_handler_ftps,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_TELNET\r\n  &Curl_handler_telnet,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_DICT\r\n  &Curl_handler_dict,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_LDAP\r\n  &Curl_handler_ldap,\r\n#if !defined(CURL_DISABLE_LDAPS) && \\\r\n    ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \\\r\n     (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))\r\n  &Curl_handler_ldaps,\r\n#endif\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_FILE\r\n  &Curl_handler_file,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_TFTP\r\n  &Curl_handler_tftp,\r\n#endif\r\n\r\n#ifdef USE_LIBSSH2\r\n  &Curl_handler_scp,\r\n  &Curl_handler_sftp,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_IMAP\r\n  &Curl_handler_imap,\r\n#ifdef USE_SSL\r\n  &Curl_handler_imaps,\r\n#endif\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_POP3\r\n  &Curl_handler_pop3,\r\n#ifdef USE_SSL\r\n  &Curl_handler_pop3s,\r\n#endif\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_SMTP\r\n  &Curl_handler_smtp,\r\n#ifdef USE_SSL\r\n  &Curl_handler_smtps,\r\n#endif\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_RTSP\r\n  &Curl_handler_rtsp,\r\n#endif\r\n\r\n#ifndef CURL_DISABLE_GOPHER\r\n  &Curl_handler_gopher,\r\n#endif\r\n\r\n#ifdef USE_LIBRTMP\r\n  &Curl_handler_rtmp,\r\n  &Curl_handler_rtmpt,\r\n  &Curl_handler_rtmpe,\r\n  &Curl_handler_rtmpte,\r\n  &Curl_handler_rtmps,\r\n  &Curl_handler_rtmpts,\r\n#endif\r\n\r\n  (struct Curl_handler *) NULL\r\n};\r\n\r\n/*\r\n * Dummy handler for undefined protocol schemes.\r\n */\r\n\r\nstatic const struct Curl_handler Curl_handler_dummy = {\r\n  \"<no protocol>\",                      /* scheme */\r\n  ZERO_NULL,                            /* setup_connection */\r\n  ZERO_NULL,                            /* do_it */\r\n  ZERO_NULL,                            /* done */\r\n  ZERO_NULL,                            /* do_more */\r\n  ZERO_NULL,                            /* connect_it */\r\n  ZERO_NULL,                            /* connecting */\r\n  ZERO_NULL,                            /* doing */\r\n  ZERO_NULL,                            /* proto_getsock */\r\n  ZERO_NULL,                            /* doing_getsock */\r\n  ZERO_NULL,                            /* domore_getsock */\r\n  ZERO_NULL,                            /* perform_getsock */\r\n  ZERO_NULL,                            /* disconnect */\r\n  ZERO_NULL,                            /* readwrite */\r\n  0,                                    /* defport */\r\n  0,                                    /* protocol */\r\n  PROTOPT_NONE                          /* flags */\r\n};\r\n\r\nvoid Curl_freeset(struct SessionHandle * data)\r\n{\r\n  /* Free all dynamic strings stored in the data->set substructure. */\r\n  enum dupstring i;\r\n  for(i=(enum dupstring)0; i < STRING_LAST; i++)\r\n    Curl_safefree(data->set.str[i]);\r\n\r\n  if(data->change.referer_alloc) {\r\n    Curl_safefree(data->change.referer);\r\n    data->change.referer_alloc = FALSE;\r\n  }\r\n  data->change.referer = NULL;\r\n}\r\n\r\nstatic CURLcode setstropt(char **charp, char * s)\r\n{\r\n  /* Release the previous storage at `charp' and replace by a dynamic storage\r\n     copy of `s'. Return CURLE_OK or CURLE_OUT_OF_MEMORY. */\r\n\r\n  Curl_safefree(*charp);\r\n\r\n  if(s) {\r\n    s = strdup(s);\r\n\r\n    if(!s)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    *charp = s;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode setstropt_userpwd(char *option, char **user_storage,\r\n                                  char **pwd_storage)\r\n{\r\n  char* separator;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  if(!option) {\r\n    /* we treat a NULL passed in as a hint to clear existing info */\r\n    Curl_safefree(*user_storage);\r\n    *user_storage = (char *) NULL;\r\n    Curl_safefree(*pwd_storage);\r\n    *pwd_storage = (char *) NULL;\r\n    return CURLE_OK;\r\n  }\r\n\r\n  separator = strchr(option, ':');\r\n  if(separator != NULL) {\r\n\r\n    /* store username part of option */\r\n    char * p;\r\n    size_t username_len = (size_t)(separator-option);\r\n    p = malloc(username_len+1);\r\n    if(!p)\r\n      result = CURLE_OUT_OF_MEMORY;\r\n    else {\r\n      memcpy(p, option, username_len);\r\n      p[username_len] = '\\0';\r\n      Curl_safefree(*user_storage);\r\n      *user_storage = p;\r\n    }\r\n\r\n    /* store password part of option */\r\n    if(result == CURLE_OK)\r\n      result = setstropt(pwd_storage, separator+1);\r\n  }\r\n  else {\r\n    result = setstropt(user_storage, option);\r\n  }\r\n  return result;\r\n}\r\n\r\nCURLcode Curl_dupset(struct SessionHandle * dst, struct SessionHandle * src)\r\n{\r\n  CURLcode r = CURLE_OK;\r\n  enum dupstring i;\r\n\r\n  /* Copy src->set into dst->set first, then deal with the strings\r\n     afterwards */\r\n  dst->set = src->set;\r\n\r\n  /* clear all string pointers first */\r\n  memset(dst->set.str, 0, STRING_LAST * sizeof(char *));\r\n\r\n  /* duplicate all strings */\r\n  for(i=(enum dupstring)0; i< STRING_LAST; i++) {\r\n    r = setstropt(&dst->set.str[i], src->set.str[i]);\r\n    if(r != CURLE_OK)\r\n      break;\r\n  }\r\n\r\n  /* If a failure occurred, freeing has to be performed externally. */\r\n  return r;\r\n}\r\n\r\n/*\r\n * This is the internal function curl_easy_cleanup() calls. This should\r\n * cleanup and free all resources associated with this sessionhandle.\r\n *\r\n * NOTE: if we ever add something that attempts to write to a socket or\r\n * similar here, we must ignore SIGPIPE first. It is currently only done\r\n * when curl_easy_perform() is invoked.\r\n */\r\n\r\nCURLcode Curl_close(struct SessionHandle *data)\r\n{\r\n  struct Curl_multi *m;\r\n\r\n  if(!data)\r\n    return CURLE_OK;\r\n\r\n  Curl_expire(data, 0); /* shut off timers */\r\n\r\n  m = data->multi;\r\n\r\n  if(m)\r\n    /* This handle is still part of a multi handle, take care of this first\r\n       and detach this handle from there. */\r\n    curl_multi_remove_handle(data->multi, data);\r\n\r\n  if(data->multi_easy)\r\n    /* when curl_easy_perform() is used, it creates its own multi handle to\r\n       use and this is the one */\r\n    curl_multi_cleanup(data->multi_easy);\r\n\r\n  /* Destroy the timeout list that is held in the easy handle. It is\r\n     /normally/ done by curl_multi_remove_handle() but this is \"just in\r\n     case\" */\r\n  if(data->state.timeoutlist) {\r\n    Curl_llist_destroy(data->state.timeoutlist, NULL);\r\n    data->state.timeoutlist = NULL;\r\n  }\r\n\r\n  data->magic = 0; /* force a clear AFTER the possibly enforced removal from\r\n                      the multi handle, since that function uses the magic\r\n                      field! */\r\n\r\n  if(data->state.rangestringalloc)\r\n    free(data->state.range);\r\n\r\n  /* Free the pathbuffer */\r\n  Curl_safefree(data->state.pathbuffer);\r\n  data->state.path = NULL;\r\n\r\n  Curl_safefree(data->state.proto.generic);\r\n\r\n  /* Close down all open SSL info and sessions */\r\n  Curl_ssl_close_all(data);\r\n  Curl_safefree(data->state.first_host);\r\n  Curl_safefree(data->state.scratch);\r\n  Curl_ssl_free_certinfo(data);\r\n\r\n  if(data->change.referer_alloc) {\r\n    Curl_safefree(data->change.referer);\r\n    data->change.referer_alloc = FALSE;\r\n  }\r\n  data->change.referer = NULL;\r\n\r\n  if(data->change.url_alloc) {\r\n    Curl_safefree(data->change.url);\r\n    data->change.url_alloc = FALSE;\r\n  }\r\n  data->change.url = NULL;\r\n\r\n  Curl_safefree(data->state.headerbuff);\r\n\r\n  Curl_flush_cookies(data, 1);\r\n\r\n  Curl_digest_cleanup(data);\r\n\r\n  Curl_safefree(data->info.contenttype);\r\n  Curl_safefree(data->info.wouldredirect);\r\n\r\n  /* this destroys the channel and we cannot use it anymore after this */\r\n  Curl_resolver_cleanup(data->state.resolver);\r\n\r\n  Curl_convert_close(data);\r\n\r\n  /* No longer a dirty share, if it exists */\r\n  if(data->share) {\r\n    Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\r\n    data->share->dirty--;\r\n    Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\r\n  }\r\n\r\n  Curl_freeset(data);\r\n  free(data);\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Initialize the UserDefined fields within a SessionHandle.\r\n * This may be safely called on a new or existing SessionHandle.\r\n */\r\nCURLcode Curl_init_userdefined(struct UserDefined *set)\r\n{\r\n  CURLcode res = CURLE_OK;\r\n\r\n  set->out = stdout; /* default output to stdout */\r\n  set->in  = stdin;  /* default input from stdin */\r\n  set->err  = stderr;  /* default stderr to stderr */\r\n\r\n  /* use fwrite as default function to store output */\r\n  set->fwrite_func = (curl_write_callback)fwrite;\r\n\r\n  /* use fread as default function to read input */\r\n  set->fread_func = (curl_read_callback)fread;\r\n  set->is_fread_set = 0;\r\n  set->is_fwrite_set = 0;\r\n\r\n  set->seek_func = ZERO_NULL;\r\n  set->seek_client = ZERO_NULL;\r\n\r\n  /* conversion callbacks for non-ASCII hosts */\r\n  set->convfromnetwork = ZERO_NULL;\r\n  set->convtonetwork   = ZERO_NULL;\r\n  set->convfromutf8    = ZERO_NULL;\r\n\r\n  set->infilesize = -1;      /* we don't know any size */\r\n  set->postfieldsize = -1;   /* unknown size */\r\n  set->maxredirs = -1;       /* allow any amount by default */\r\n\r\n  set->httpreq = HTTPREQ_GET; /* Default HTTP request */\r\n  set->rtspreq = RTSPREQ_OPTIONS; /* Default RTSP request */\r\n  set->ftp_use_epsv = TRUE;   /* FTP defaults to EPSV operations */\r\n  set->ftp_use_eprt = TRUE;   /* FTP defaults to EPRT operations */\r\n  set->ftp_use_pret = FALSE;  /* mainly useful for drftpd servers */\r\n  set->ftp_filemethod = FTPFILE_MULTICWD;\r\n\r\n  set->dns_cache_timeout = 60; /* Timeout every 60 seconds by default */\r\n\r\n  /* Set the default size of the SSL session ID cache */\r\n  set->ssl.max_ssl_sessions = 5;\r\n\r\n  set->proxyport = CURL_DEFAULT_PROXY_PORT; /* from url.h */\r\n  set->proxytype = CURLPROXY_HTTP; /* defaults to HTTP proxy */\r\n  set->httpauth = CURLAUTH_BASIC;  /* defaults to basic */\r\n  set->proxyauth = CURLAUTH_BASIC; /* defaults to basic */\r\n\r\n  /* make libcurl quiet by default: */\r\n  set->hide_progress = TRUE;  /* CURLOPT_NOPROGRESS changes these */\r\n\r\n  /*\r\n   * libcurl 7.10 introduced SSL verification *by default*! This needs to be\r\n   * switched off unless wanted.\r\n   */\r\n  set->ssl.verifypeer = TRUE;\r\n  set->ssl.verifyhost = TRUE;\r\n#ifdef USE_TLS_SRP\r\n  set->ssl.authtype = CURL_TLSAUTH_NONE;\r\n#endif\r\n  set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth\r\n                                                      type */\r\n  set->ssl.sessionid = TRUE; /* session ID caching enabled by default */\r\n\r\n  set->new_file_perms = 0644;    /* Default permissions */\r\n  set->new_directory_perms = 0755; /* Default permissions */\r\n\r\n  /* for the *protocols fields we don't use the CURLPROTO_ALL convenience\r\n     define since we internally only use the lower 16 bits for the passed\r\n     in bitmask to not conflict with the private bits */\r\n  set->allowed_protocols = CURLPROTO_ALL;\r\n  set->redir_protocols =\r\n    CURLPROTO_ALL & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  /*\r\n   * disallow unprotected protection negotiation NEC reference implementation\r\n   * seem not to follow rfc1961 section 4.3/4.4\r\n   */\r\n  set->socks5_gssapi_nec = FALSE;\r\n  /* set default gssapi service name */\r\n  res = setstropt(&set->str[STRING_SOCKS5_GSSAPI_SERVICE],\r\n                  (char *) CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE);\r\n  if(res != CURLE_OK)\r\n    return res;\r\n#endif\r\n\r\n  /* This is our preferred CA cert bundle/path since install time */\r\n#if defined(CURL_CA_BUNDLE)\r\n  res = setstropt(&set->str[STRING_SSL_CAFILE], (char *) CURL_CA_BUNDLE);\r\n#elif defined(CURL_CA_PATH)\r\n  res = setstropt(&set->str[STRING_SSL_CAPATH], (char *) CURL_CA_PATH);\r\n#endif\r\n\r\n  set->wildcardmatch  = FALSE;\r\n  set->chunk_bgn      = ZERO_NULL;\r\n  set->chunk_end      = ZERO_NULL;\r\n\r\n  /* tcp keepalives are disabled by default, but provide reasonable values for\r\n   * the interval and idle times.\r\n   */\r\n  set->tcp_keepalive = FALSE;\r\n  set->tcp_keepintvl = 60;\r\n  set->tcp_keepidle = 60;\r\n\r\n  return res;\r\n}\r\n\r\n/**\r\n * Curl_open()\r\n *\r\n * @param curl is a pointer to a sessionhandle pointer that gets set by this\r\n * function.\r\n * @return CURLcode\r\n */\r\n\r\nCURLcode Curl_open(struct SessionHandle **curl)\r\n{\r\n  CURLcode res = CURLE_OK;\r\n  struct SessionHandle *data;\r\n  CURLcode status;\r\n\r\n  /* Very simple start-up: alloc the struct, init it with zeroes and return */\r\n  data = calloc(1, sizeof(struct SessionHandle));\r\n  if(!data) {\r\n    /* this is a very serious error */\r\n    DEBUGF(fprintf(stderr, \"Error: calloc of SessionHandle failed\\n\"));\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  data->magic = CURLEASY_MAGIC_NUMBER;\r\n\r\n  status = Curl_resolver_init(&data->state.resolver);\r\n  if(status) {\r\n    DEBUGF(fprintf(stderr, \"Error: resolver_init failed\\n\"));\r\n    free(data);\r\n    return status;\r\n  }\r\n\r\n  /* We do some initial setup here, all those fields that can't be just 0 */\r\n\r\n  data->state.headerbuff = malloc(HEADERSIZE);\r\n  if(!data->state.headerbuff) {\r\n    DEBUGF(fprintf(stderr, \"Error: malloc of headerbuff failed\\n\"));\r\n    res = CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else {\r\n    Curl_easy_initHandleData(data);\r\n    res = Curl_init_userdefined(&data->set);\r\n\r\n    data->state.headersize=HEADERSIZE;\r\n\r\n    Curl_convert_init(data);\r\n\r\n    /* most recent connection is not yet defined */\r\n    data->state.lastconnect = NULL;\r\n\r\n    data->progress.flags |= PGRS_HIDE;\r\n    data->state.current_speed = -1; /* init to negative == impossible */\r\n\r\n    data->wildcard.state = CURLWC_INIT;\r\n    data->wildcard.filelist = NULL;\r\n    data->set.fnmatch = ZERO_NULL;\r\n    /* This no longer creates a connection cache here. It is instead made on\r\n       the first call to curl_easy_perform() or when the handle is added to a\r\n       multi stack. */\r\n  }\r\n\r\n\r\n  if(res) {\r\n    Curl_resolver_cleanup(data->state.resolver);\r\n    if(data->state.headerbuff)\r\n      free(data->state.headerbuff);\r\n    Curl_freeset(data);\r\n    free(data);\r\n    data = NULL;\r\n  }\r\n  else\r\n    *curl = data;\r\n\r\n  return res;\r\n}\r\n\r\nCURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,\r\n                     va_list param)\r\n{\r\n  char *argptr;\r\n  CURLcode result = CURLE_OK;\r\n  long arg;\r\n#ifndef CURL_DISABLE_HTTP\r\n  curl_off_t bigsize;\r\n#endif\r\n\r\n  switch(option) {\r\n  case CURLOPT_DNS_CACHE_TIMEOUT:\r\n    data->set.dns_cache_timeout = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_DNS_USE_GLOBAL_CACHE:\r\n    /* remember we want this enabled */\r\n    arg = va_arg(param, long);\r\n    data->set.global_dns_cache = (0 != arg)?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_SSL_CIPHER_LIST:\r\n    /* set a list of cipher we want to use in the SSL connection */\r\n    result = setstropt(&data->set.str[STRING_SSL_CIPHER_LIST],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_RANDOM_FILE:\r\n    /*\r\n     * This is the path name to a file that contains random data to seed\r\n     * the random SSL stuff with. The file is only used for reading.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSL_RANDOM_FILE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_EGDSOCKET:\r\n    /*\r\n     * The Entropy Gathering Daemon socket pathname\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSL_EGDSOCKET],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_MAXCONNECTS:\r\n    /*\r\n     * Set the absolute number of maximum simultaneous alive connection that\r\n     * libcurl is allowed to have.\r\n     */\r\n    data->set.maxconnects = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_FORBID_REUSE:\r\n    /*\r\n     * When this transfer is done, it must not be left to be reused by a\r\n     * subsequent transfer but shall be closed immediately.\r\n     */\r\n    data->set.reuse_forbid = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_FRESH_CONNECT:\r\n    /*\r\n     * This transfer shall not use a previously cached connection but\r\n     * should be made with a fresh new connect!\r\n     */\r\n    data->set.reuse_fresh = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_VERBOSE:\r\n    /*\r\n     * Verbose means infof() calls that give a lot of information about\r\n     * the connection and transfer procedures as well as internal choices.\r\n     */\r\n    data->set.verbose = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_HEADER:\r\n    /*\r\n     * Set to include the header in the general data output stream.\r\n     */\r\n    data->set.include_header = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_NOPROGRESS:\r\n    /*\r\n     * Shut off the internal supported progress meter\r\n     */\r\n    data->set.hide_progress = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    if(data->set.hide_progress)\r\n      data->progress.flags |= PGRS_HIDE;\r\n    else\r\n      data->progress.flags &= ~PGRS_HIDE;\r\n    break;\r\n  case CURLOPT_NOBODY:\r\n    /*\r\n     * Do not include the body part in the output data stream.\r\n     */\r\n    data->set.opt_no_body = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_FAILONERROR:\r\n    /*\r\n     * Don't output the >=300 error code HTML-page, but instead only\r\n     * return error.\r\n     */\r\n    data->set.http_fail_on_error = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_UPLOAD:\r\n  case CURLOPT_PUT:\r\n    /*\r\n     * We want to sent data to the remote host. If this is HTTP, that equals\r\n     * using the PUT request.\r\n     */\r\n    data->set.upload = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    if(data->set.upload) {\r\n      /* If this is HTTP, PUT is what's needed to \"upload\" */\r\n      data->set.httpreq = HTTPREQ_PUT;\r\n      data->set.opt_no_body = FALSE; /* this is implied */\r\n    }\r\n    else\r\n      /* In HTTP, the opposite of upload is GET (unless NOBODY is true as\r\n         then this can be changed to HEAD later on) */\r\n      data->set.httpreq = HTTPREQ_GET;\r\n    break;\r\n  case CURLOPT_FILETIME:\r\n    /*\r\n     * Try to get the file time of the remote document. The time will\r\n     * later (possibly) become available using curl_easy_getinfo().\r\n     */\r\n    data->set.get_filetime = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_FTP_CREATE_MISSING_DIRS:\r\n    /*\r\n     * An FTP option that modifies an upload to create missing directories on\r\n     * the server.\r\n     */\r\n    switch(va_arg(param, long)) {\r\n    case 0:\r\n      data->set.ftp_create_missing_dirs = 0;\r\n      break;\r\n    case 1:\r\n      data->set.ftp_create_missing_dirs = 1;\r\n      break;\r\n    case 2:\r\n      data->set.ftp_create_missing_dirs = 2;\r\n      break;\r\n    default:\r\n      /* reserve other values for future use */\r\n      result = CURLE_UNKNOWN_OPTION;\r\n      break;\r\n    }\r\n    break;\r\n  case CURLOPT_SERVER_RESPONSE_TIMEOUT:\r\n    /*\r\n     * Option that specifies how quickly an server response must be obtained\r\n     * before it is considered failure. For pingpong protocols.\r\n     */\r\n    data->set.server_response_timeout = va_arg( param , long ) * 1000;\r\n    break;\r\n  case CURLOPT_TFTP_BLKSIZE:\r\n    /*\r\n     * TFTP option that specifies the block size to use for data transmission\r\n     */\r\n    data->set.tftp_blksize = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_DIRLISTONLY:\r\n    /*\r\n     * An option that changes the command to one that asks for a list\r\n     * only, no file info details.\r\n     */\r\n    data->set.ftp_list_only = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_APPEND:\r\n    /*\r\n     * We want to upload and append to an existing file.\r\n     */\r\n    data->set.ftp_append = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_FTP_FILEMETHOD:\r\n    /*\r\n     * How do access files over FTP.\r\n     */\r\n    data->set.ftp_filemethod = (curl_ftpfile)va_arg(param, long);\r\n    break;\r\n  case CURLOPT_NETRC:\r\n    /*\r\n     * Parse the $HOME/.netrc file\r\n     */\r\n    data->set.use_netrc = (enum CURL_NETRC_OPTION)va_arg(param, long);\r\n    break;\r\n  case CURLOPT_NETRC_FILE:\r\n    /*\r\n     * Use this file instead of the $HOME/.netrc file\r\n     */\r\n    result = setstropt(&data->set.str[STRING_NETRC_FILE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_TRANSFERTEXT:\r\n    /*\r\n     * This option was previously named 'FTPASCII'. Renamed to work with\r\n     * more protocols than merely FTP.\r\n     *\r\n     * Transfer using ASCII (instead of BINARY).\r\n     */\r\n    data->set.prefer_ascii = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_TIMECONDITION:\r\n    /*\r\n     * Set HTTP time condition. This must be one of the defines in the\r\n     * curl/curl.h header file.\r\n     */\r\n    data->set.timecondition = (curl_TimeCond)va_arg(param, long);\r\n    break;\r\n  case CURLOPT_TIMEVALUE:\r\n    /*\r\n     * This is the value to compare with the remote document with the\r\n     * method set with CURLOPT_TIMECONDITION\r\n     */\r\n    data->set.timevalue = (time_t)va_arg(param, long);\r\n    break;\r\n  case CURLOPT_SSLVERSION:\r\n    /*\r\n     * Set explicit SSL version to try to connect with, as some SSL\r\n     * implementations are lame.\r\n     */\r\n    data->set.ssl.version = va_arg(param, long);\r\n    break;\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n  case CURLOPT_AUTOREFERER:\r\n    /*\r\n     * Switch on automatic referer that gets set if curl follows locations.\r\n     */\r\n    data->set.http_auto_referer = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_ACCEPT_ENCODING:\r\n    /*\r\n     * String to use at the value of Accept-Encoding header.\r\n     *\r\n     * If the encoding is set to \"\" we use an Accept-Encoding header that\r\n     * encompasses all the encodings we support.\r\n     * If the encoding is set to NULL we don't send an Accept-Encoding header\r\n     * and ignore an received Content-Encoding header.\r\n     *\r\n     */\r\n    argptr = va_arg(param, char *);\r\n    result = setstropt(&data->set.str[STRING_ENCODING],\r\n                       (argptr && !*argptr)?\r\n                       (char *) ALL_CONTENT_ENCODINGS: argptr);\r\n    break;\r\n\r\n  case CURLOPT_TRANSFER_ENCODING:\r\n    data->set.http_transfer_encoding = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FOLLOWLOCATION:\r\n    /*\r\n     * Follow Location: header hints on a HTTP-server.\r\n     */\r\n    data->set.http_follow_location = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_UNRESTRICTED_AUTH:\r\n    /*\r\n     * Send authentication (user+password) when following locations, even when\r\n     * hostname changed.\r\n     */\r\n    data->set.http_disable_hostname_check_before_authentication =\r\n      (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_MAXREDIRS:\r\n    /*\r\n     * The maximum amount of hops you allow curl to follow Location:\r\n     * headers. This should mostly be used to detect never-ending loops.\r\n     */\r\n    data->set.maxredirs = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_POSTREDIR:\r\n  {\r\n    /*\r\n     * Set the behaviour of POST when redirecting\r\n     * CURL_REDIR_GET_ALL - POST is changed to GET after 301 and 302\r\n     * CURL_REDIR_POST_301 - POST is kept as POST after 301\r\n     * CURL_REDIR_POST_302 - POST is kept as POST after 302\r\n     * CURL_REDIR_POST_303 - POST is kept as POST after 303\r\n     * CURL_REDIR_POST_ALL - POST is kept as POST after 301, 302 and 303\r\n     * other - POST is kept as POST after 301 and 302\r\n     */\r\n    int postRedir = curlx_sltosi(va_arg(param, long));\r\n    data->set.keep_post = postRedir & CURL_REDIR_POST_ALL;\r\n  }\r\n  break;\r\n\r\n  case CURLOPT_POST:\r\n    /* Does this option serve a purpose anymore? Yes it does, when\r\n       CURLOPT_POSTFIELDS isn't used and the POST data is read off the\r\n       callback! */\r\n    if(va_arg(param, long)) {\r\n      data->set.httpreq = HTTPREQ_POST;\r\n      data->set.opt_no_body = FALSE; /* this is implied */\r\n    }\r\n    else\r\n      data->set.httpreq = HTTPREQ_GET;\r\n    break;\r\n\r\n  case CURLOPT_COPYPOSTFIELDS:\r\n    /*\r\n     * A string with POST data. Makes curl HTTP POST. Even if it is NULL.\r\n     * If needed, CURLOPT_POSTFIELDSIZE must have been set prior to\r\n     *  CURLOPT_COPYPOSTFIELDS and not altered later.\r\n     */\r\n    argptr = va_arg(param, char *);\r\n\r\n    if(!argptr || data->set.postfieldsize == -1)\r\n      result = setstropt(&data->set.str[STRING_COPYPOSTFIELDS], argptr);\r\n    else {\r\n      /*\r\n       *  Check that requested length does not overflow the size_t type.\r\n       */\r\n\r\n      if((data->set.postfieldsize < 0) ||\r\n         ((sizeof(curl_off_t) != sizeof(size_t)) &&\r\n          (data->set.postfieldsize > (curl_off_t)((size_t)-1))))\r\n        result = CURLE_OUT_OF_MEMORY;\r\n      else {\r\n        char * p;\r\n\r\n        (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);\r\n\r\n        /* Allocate even when size == 0. This satisfies the need of possible\r\n           later address compare to detect the COPYPOSTFIELDS mode, and\r\n           to mark that postfields is used rather than read function or\r\n           form data.\r\n        */\r\n        p = malloc((size_t)(data->set.postfieldsize?\r\n                            data->set.postfieldsize:1));\r\n\r\n        if(!p)\r\n          result = CURLE_OUT_OF_MEMORY;\r\n        else {\r\n          if(data->set.postfieldsize)\r\n            memcpy(p, argptr, (size_t)data->set.postfieldsize);\r\n\r\n          data->set.str[STRING_COPYPOSTFIELDS] = p;\r\n        }\r\n      }\r\n    }\r\n\r\n    data->set.postfields = data->set.str[STRING_COPYPOSTFIELDS];\r\n    data->set.httpreq = HTTPREQ_POST;\r\n    break;\r\n\r\n  case CURLOPT_POSTFIELDS:\r\n    /*\r\n     * Like above, but use static data instead of copying it.\r\n     */\r\n    data->set.postfields = va_arg(param, void *);\r\n    /* Release old copied data. */\r\n    (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);\r\n    data->set.httpreq = HTTPREQ_POST;\r\n    break;\r\n\r\n  case CURLOPT_POSTFIELDSIZE:\r\n    /*\r\n     * The size of the POSTFIELD data to prevent libcurl to do strlen() to\r\n     * figure it out. Enables binary posts.\r\n     */\r\n    bigsize = va_arg(param, long);\r\n\r\n    if(data->set.postfieldsize < bigsize &&\r\n       data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) {\r\n      /* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */\r\n      (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);\r\n      data->set.postfields = NULL;\r\n    }\r\n\r\n    data->set.postfieldsize = bigsize;\r\n    break;\r\n\r\n  case CURLOPT_POSTFIELDSIZE_LARGE:\r\n    /*\r\n     * The size of the POSTFIELD data to prevent libcurl to do strlen() to\r\n     * figure it out. Enables binary posts.\r\n     */\r\n    bigsize = va_arg(param, curl_off_t);\r\n\r\n    if(data->set.postfieldsize < bigsize &&\r\n       data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) {\r\n      /* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */\r\n      (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);\r\n      data->set.postfields = NULL;\r\n    }\r\n\r\n    data->set.postfieldsize = bigsize;\r\n    break;\r\n\r\n  case CURLOPT_HTTPPOST:\r\n    /*\r\n     * Set to make us do HTTP POST\r\n     */\r\n    data->set.httppost = va_arg(param, struct curl_httppost *);\r\n    data->set.httpreq = HTTPREQ_POST_FORM;\r\n    data->set.opt_no_body = FALSE; /* this is implied */\r\n    break;\r\n\r\n  case CURLOPT_REFERER:\r\n    /*\r\n     * String to set in the HTTP Referer: field.\r\n     */\r\n    if(data->change.referer_alloc) {\r\n      Curl_safefree(data->change.referer);\r\n      data->change.referer_alloc = FALSE;\r\n    }\r\n    result = setstropt(&data->set.str[STRING_SET_REFERER],\r\n                       va_arg(param, char *));\r\n    data->change.referer = data->set.str[STRING_SET_REFERER];\r\n    break;\r\n\r\n  case CURLOPT_USERAGENT:\r\n    /*\r\n     * String to use in the HTTP User-Agent field\r\n     */\r\n    result = setstropt(&data->set.str[STRING_USERAGENT],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_HTTPHEADER:\r\n    /*\r\n     * Set a list with HTTP headers to use (or replace internals with)\r\n     */\r\n    data->set.headers = va_arg(param, struct curl_slist *);\r\n    break;\r\n\r\n  case CURLOPT_HTTP200ALIASES:\r\n    /*\r\n     * Set a list of aliases for HTTP 200 in response header\r\n     */\r\n    data->set.http200aliases = va_arg(param, struct curl_slist *);\r\n    break;\r\n\r\n#if !defined(CURL_DISABLE_COOKIES)\r\n  case CURLOPT_COOKIE:\r\n    /*\r\n     * Cookie string to send to the remote server in the request.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_COOKIE],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_COOKIEFILE:\r\n    /*\r\n     * Set cookie file to read and parse. Can be used multiple times.\r\n     */\r\n    argptr = (char *)va_arg(param, void *);\r\n    if(argptr) {\r\n      struct curl_slist *cl;\r\n      /* append the cookie file name to the list of file names, and deal with\r\n         them later */\r\n      cl = curl_slist_append(data->change.cookielist, argptr);\r\n      if(!cl) {\r\n        curl_slist_free_all(data->change.cookielist);\r\n        data->change.cookielist = NULL;\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      data->change.cookielist = cl; /* store the list for later use */\r\n    }\r\n    break;\r\n\r\n  case CURLOPT_COOKIEJAR:\r\n    /*\r\n     * Set cookie file name to dump all cookies to when we're done.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_COOKIEJAR],\r\n                       va_arg(param, char *));\r\n\r\n    /*\r\n     * Activate the cookie parser. This may or may not already\r\n     * have been made.\r\n     */\r\n    data->cookies = Curl_cookie_init(data, NULL, data->cookies,\r\n                                     data->set.cookiesession);\r\n    break;\r\n\r\n  case CURLOPT_COOKIESESSION:\r\n    /*\r\n     * Set this option to TRUE to start a new \"cookie session\". It will\r\n     * prevent the forthcoming read-cookies-from-file actions to accept\r\n     * cookies that are marked as being session cookies, as they belong to a\r\n     * previous session.\r\n     *\r\n     * In the original Netscape cookie spec, \"session cookies\" are cookies\r\n     * with no expire date set. RFC2109 describes the same action if no\r\n     * 'Max-Age' is set and RFC2965 includes the RFC2109 description and adds\r\n     * a 'Discard' action that can enforce the discard even for cookies that\r\n     * have a Max-Age.\r\n     *\r\n     * We run mostly with the original cookie spec, as hardly anyone implements\r\n     * anything else.\r\n     */\r\n    data->set.cookiesession = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_COOKIELIST:\r\n    argptr = va_arg(param, char *);\r\n\r\n    if(argptr == NULL)\r\n      break;\r\n\r\n    if(Curl_raw_equal(argptr, \"ALL\")) {\r\n      /* clear all cookies */\r\n      Curl_cookie_clearall(data->cookies);\r\n      break;\r\n    }\r\n    else if(Curl_raw_equal(argptr, \"SESS\")) {\r\n      /* clear session cookies */\r\n      Curl_cookie_clearsess(data->cookies);\r\n      break;\r\n    }\r\n    else if(Curl_raw_equal(argptr, \"FLUSH\")) {\r\n      /* flush cookies to file */\r\n      Curl_flush_cookies(data, 0);\r\n      break;\r\n    }\r\n\r\n    if(!data->cookies)\r\n      /* if cookie engine was not running, activate it */\r\n      data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE);\r\n\r\n    argptr = strdup(argptr);\r\n    if(!argptr) {\r\n      result = CURLE_OUT_OF_MEMORY;\r\n      break;\r\n    }\r\n\r\n    if(checkprefix(\"Set-Cookie:\", argptr))\r\n      /* HTTP Header format line */\r\n      Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL);\r\n\r\n    else\r\n      /* Netscape format line */\r\n      Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL);\r\n\r\n    free(argptr);\r\n    break;\r\n#endif /* CURL_DISABLE_COOKIES */\r\n\r\n  case CURLOPT_HTTPGET:\r\n    /*\r\n     * Set to force us do HTTP GET\r\n     */\r\n    if(va_arg(param, long)) {\r\n      data->set.httpreq = HTTPREQ_GET;\r\n      data->set.upload = FALSE; /* switch off upload */\r\n      data->set.opt_no_body = FALSE; /* this is implied */\r\n    }\r\n    break;\r\n\r\n  case CURLOPT_HTTP_VERSION:\r\n    /*\r\n     * This sets a requested HTTP version to be used. The value is one of\r\n     * the listed enums in curl/curl.h.\r\n     */\r\n    data->set.httpversion = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_HTTPAUTH:\r\n    /*\r\n     * Set HTTP Authentication type BITMASK.\r\n     */\r\n  {\r\n    int bitcheck;\r\n    bool authbits;\r\n    unsigned long auth = va_arg(param, unsigned long);\r\n\r\n    if(auth == CURLAUTH_NONE) {\r\n      data->set.httpauth = auth;\r\n      break;\r\n    }\r\n\r\n    /* the DIGEST_IE bit is only used to set a special marker, for all the\r\n       rest we need to handle it as normal DIGEST */\r\n    data->state.authhost.iestyle = (auth & CURLAUTH_DIGEST_IE)?TRUE:FALSE;\r\n\r\n    if(auth & CURLAUTH_DIGEST_IE) {\r\n      auth |= CURLAUTH_DIGEST; /* set standard digest bit */\r\n      auth &= ~CURLAUTH_DIGEST_IE; /* unset ie digest bit */\r\n    }\r\n\r\n    /* switch off bits we can't support */\r\n#ifndef USE_NTLM\r\n    auth &= ~CURLAUTH_NTLM;    /* no NTLM support */\r\n    auth &= ~CURLAUTH_NTLM_WB; /* no NTLM_WB support */\r\n#elif !defined(NTLM_WB_ENABLED)\r\n    auth &= ~CURLAUTH_NTLM_WB; /* no NTLM_WB support */\r\n#endif\r\n#ifndef USE_HTTP_NEGOTIATE\r\n    auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI or\r\n                                       WINDOWS_SSPI */\r\n#endif\r\n\r\n    /* check if any auth bit lower than CURLAUTH_ONLY is still set */\r\n    bitcheck = 0;\r\n    authbits = FALSE;\r\n    while(bitcheck < 31) {\r\n      if(auth & (1UL << bitcheck++)) {\r\n        authbits = TRUE;\r\n        break;\r\n      }\r\n    }\r\n    if(!authbits)\r\n      return CURLE_NOT_BUILT_IN; /* no supported types left! */\r\n\r\n    data->set.httpauth = auth;\r\n  }\r\n  break;\r\n\r\n#endif   /* CURL_DISABLE_HTTP */\r\n\r\n  case CURLOPT_CUSTOMREQUEST:\r\n    /*\r\n     * Set a custom string to use as request\r\n     */\r\n    result = setstropt(&data->set.str[STRING_CUSTOMREQUEST],\r\n                       va_arg(param, char *));\r\n\r\n    /* we don't set\r\n       data->set.httpreq = HTTPREQ_CUSTOM;\r\n       here, we continue as if we were using the already set type\r\n       and this just changes the actual request keyword */\r\n    break;\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n  case CURLOPT_HTTPPROXYTUNNEL:\r\n    /*\r\n     * Tunnel operations through the proxy instead of normal proxy use\r\n     */\r\n    data->set.tunnel_thru_httpproxy = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_PROXYPORT:\r\n    /*\r\n     * Explicitly set HTTP proxy port number.\r\n     */\r\n    data->set.proxyport = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_PROXYAUTH:\r\n    /*\r\n     * Set HTTP Authentication type BITMASK.\r\n     */\r\n  {\r\n    int bitcheck;\r\n    bool authbits;\r\n    unsigned long auth = va_arg(param, unsigned long);\r\n\r\n    if(auth == CURLAUTH_NONE) {\r\n      data->set.proxyauth = auth;\r\n      break;\r\n    }\r\n\r\n    /* the DIGEST_IE bit is only used to set a special marker, for all the\r\n       rest we need to handle it as normal DIGEST */\r\n    data->state.authproxy.iestyle = (auth & CURLAUTH_DIGEST_IE)?TRUE:FALSE;\r\n\r\n    if(auth & CURLAUTH_DIGEST_IE) {\r\n      auth |= CURLAUTH_DIGEST; /* set standard digest bit */\r\n      auth &= ~CURLAUTH_DIGEST_IE; /* unset ie digest bit */\r\n    }\r\n    /* switch off bits we can't support */\r\n#ifndef USE_NTLM\r\n    auth &= ~CURLAUTH_NTLM;    /* no NTLM support */\r\n    auth &= ~CURLAUTH_NTLM_WB; /* no NTLM_WB support */\r\n#elif !defined(NTLM_WB_ENABLED)\r\n    auth &= ~CURLAUTH_NTLM_WB; /* no NTLM_WB support */\r\n#endif\r\n#ifndef USE_HTTP_NEGOTIATE\r\n    auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI or\r\n                                       WINDOWS_SSPI */\r\n#endif\r\n\r\n    /* check if any auth bit lower than CURLAUTH_ONLY is still set */\r\n    bitcheck = 0;\r\n    authbits = FALSE;\r\n    while(bitcheck < 31) {\r\n      if(auth & (1UL << bitcheck++)) {\r\n        authbits = TRUE;\r\n        break;\r\n      }\r\n    }\r\n    if(!authbits)\r\n      return CURLE_NOT_BUILT_IN; /* no supported types left! */\r\n\r\n    data->set.proxyauth = auth;\r\n  }\r\n  break;\r\n\r\n  case CURLOPT_PROXY:\r\n    /*\r\n     * Set proxy server:port to use as HTTP proxy.\r\n     *\r\n     * If the proxy is set to \"\" we explicitly say that we don't want to use a\r\n     * proxy (even though there might be environment variables saying so).\r\n     *\r\n     * Setting it to NULL, means no proxy but allows the environment variables\r\n     * to decide for us.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_PROXY],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_PROXYTYPE:\r\n    /*\r\n     * Set proxy type. HTTP/HTTP_1_0/SOCKS4/SOCKS4a/SOCKS5/SOCKS5_HOSTNAME\r\n     */\r\n    data->set.proxytype = (curl_proxytype)va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_PROXY_TRANSFER_MODE:\r\n    /*\r\n     * set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy\r\n     */\r\n    switch (va_arg(param, long)) {\r\n    case 0:\r\n      data->set.proxy_transfer_mode = FALSE;\r\n      break;\r\n    case 1:\r\n      data->set.proxy_transfer_mode = TRUE;\r\n      break;\r\n    default:\r\n      /* reserve other values for future use */\r\n      result = CURLE_UNKNOWN_OPTION;\r\n      break;\r\n    }\r\n    break;\r\n#endif   /* CURL_DISABLE_PROXY */\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  case CURLOPT_SOCKS5_GSSAPI_SERVICE:\r\n    /*\r\n     * Set gssapi service name\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SOCKS5_GSSAPI_SERVICE],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_SOCKS5_GSSAPI_NEC:\r\n    /*\r\n     * set flag for nec socks5 support\r\n     */\r\n    data->set.socks5_gssapi_nec = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n#endif\r\n\r\n  case CURLOPT_WRITEHEADER:\r\n    /*\r\n     * Custom pointer to pass the header write callback function\r\n     */\r\n    data->set.writeheader = (void *)va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_ERRORBUFFER:\r\n    /*\r\n     * Error buffer provided by the caller to get the human readable\r\n     * error string in.\r\n     */\r\n    data->set.errorbuffer = va_arg(param, char *);\r\n    break;\r\n  case CURLOPT_FILE:\r\n    /*\r\n     * FILE pointer to write to or include in the data write callback\r\n     */\r\n    data->set.out = va_arg(param, FILE *);\r\n    break;\r\n  case CURLOPT_FTPPORT:\r\n    /*\r\n     * Use FTP PORT, this also specifies which IP address to use\r\n     */\r\n    result = setstropt(&data->set.str[STRING_FTPPORT],\r\n                       va_arg(param, char *));\r\n    data->set.ftp_use_port = (NULL != data->set.str[STRING_FTPPORT]) ?\r\n                             TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FTP_USE_EPRT:\r\n    data->set.ftp_use_eprt = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FTP_USE_EPSV:\r\n    data->set.ftp_use_epsv = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FTP_USE_PRET:\r\n    data->set.ftp_use_pret = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FTP_SSL_CCC:\r\n    data->set.ftp_ccc = (curl_ftpccc)va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_FTP_SKIP_PASV_IP:\r\n    /*\r\n     * Enable or disable FTP_SKIP_PASV_IP, which will disable/enable the\r\n     * bypass of the IP address in PASV responses.\r\n     */\r\n    data->set.ftp_skip_ip = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_INFILE:\r\n    /*\r\n     * FILE pointer to read the file to be uploaded from. Or possibly\r\n     * used as argument to the read callback.\r\n     */\r\n    data->set.in = va_arg(param, FILE *);\r\n    break;\r\n  case CURLOPT_INFILESIZE:\r\n    /*\r\n     * If known, this should inform curl about the file size of the\r\n     * to-be-uploaded file.\r\n     */\r\n    data->set.infilesize = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_INFILESIZE_LARGE:\r\n    /*\r\n     * If known, this should inform curl about the file size of the\r\n     * to-be-uploaded file.\r\n     */\r\n    data->set.infilesize = va_arg(param, curl_off_t);\r\n    break;\r\n  case CURLOPT_LOW_SPEED_LIMIT:\r\n    /*\r\n     * The low speed limit that if transfers are below this for\r\n     * CURLOPT_LOW_SPEED_TIME, the transfer is aborted.\r\n     */\r\n    data->set.low_speed_limit=va_arg(param, long);\r\n    break;\r\n  case CURLOPT_MAX_SEND_SPEED_LARGE:\r\n    /*\r\n     * When transfer uploads are faster then CURLOPT_MAX_SEND_SPEED_LARGE\r\n     * bytes per second the transfer is throttled..\r\n     */\r\n    data->set.max_send_speed=va_arg(param, curl_off_t);\r\n    break;\r\n  case CURLOPT_MAX_RECV_SPEED_LARGE:\r\n    /*\r\n     * When receiving data faster than CURLOPT_MAX_RECV_SPEED_LARGE bytes per\r\n     * second the transfer is throttled..\r\n     */\r\n    data->set.max_recv_speed=va_arg(param, curl_off_t);\r\n    break;\r\n  case CURLOPT_LOW_SPEED_TIME:\r\n    /*\r\n     * The low speed time that if transfers are below the set\r\n     * CURLOPT_LOW_SPEED_LIMIT during this time, the transfer is aborted.\r\n     */\r\n    data->set.low_speed_time=va_arg(param, long);\r\n    break;\r\n  case CURLOPT_URL:\r\n    /*\r\n     * The URL to fetch.\r\n     */\r\n    if(data->change.url_alloc) {\r\n      /* the already set URL is allocated, free it first! */\r\n      Curl_safefree(data->change.url);\r\n      data->change.url_alloc = FALSE;\r\n    }\r\n    result = setstropt(&data->set.str[STRING_SET_URL],\r\n                       va_arg(param, char *));\r\n    data->change.url = data->set.str[STRING_SET_URL];\r\n    break;\r\n  case CURLOPT_PORT:\r\n    /*\r\n     * The port number to use when getting the URL\r\n     */\r\n    data->set.use_port = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_TIMEOUT:\r\n    /*\r\n     * The maximum time you allow curl to use for a single transfer\r\n     * operation.\r\n     */\r\n    data->set.timeout = va_arg(param, long) * 1000L;\r\n    break;\r\n\r\n  case CURLOPT_TIMEOUT_MS:\r\n    data->set.timeout = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_CONNECTTIMEOUT:\r\n    /*\r\n     * The maximum time you allow curl to use to connect.\r\n     */\r\n    data->set.connecttimeout = va_arg(param, long) * 1000L;\r\n    break;\r\n\r\n  case CURLOPT_CONNECTTIMEOUT_MS:\r\n    data->set.connecttimeout = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_ACCEPTTIMEOUT_MS:\r\n    /*\r\n     * The maximum time you allow curl to wait for server connect\r\n     */\r\n    data->set.accepttimeout = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_USERPWD:\r\n    /*\r\n     * user:password to use in the operation\r\n     */\r\n    result = setstropt_userpwd(va_arg(param, char *),\r\n                               &data->set.str[STRING_USERNAME],\r\n                               &data->set.str[STRING_PASSWORD]);\r\n    break;\r\n  case CURLOPT_USERNAME:\r\n    /*\r\n     * authentication user name to use in the operation\r\n     */\r\n    result = setstropt(&data->set.str[STRING_USERNAME],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_PASSWORD:\r\n    /*\r\n     * authentication password to use in the operation\r\n     */\r\n    result = setstropt(&data->set.str[STRING_PASSWORD],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_POSTQUOTE:\r\n    /*\r\n     * List of RAW FTP commands to use after a transfer\r\n     */\r\n    data->set.postquote = va_arg(param, struct curl_slist *);\r\n    break;\r\n  case CURLOPT_PREQUOTE:\r\n    /*\r\n     * List of RAW FTP commands to use prior to RETR (Wesley Laxton)\r\n     */\r\n    data->set.prequote = va_arg(param, struct curl_slist *);\r\n    break;\r\n  case CURLOPT_QUOTE:\r\n    /*\r\n     * List of RAW FTP commands to use before a transfer\r\n     */\r\n    data->set.quote = va_arg(param, struct curl_slist *);\r\n    break;\r\n  case CURLOPT_RESOLVE:\r\n    /*\r\n     * List of NAME:[address] names to populate the DNS cache with\r\n     * Prefix the NAME with dash (-) to _remove_ the name from the cache.\r\n     *\r\n     * Names added with this API will remain in the cache until explicitly\r\n     * removed or the handle is cleaned up.\r\n     *\r\n     * This API can remove any name from the DNS cache, but only entries\r\n     * that aren't actually in use right now will be pruned immediately.\r\n     */\r\n    data->set.resolve = va_arg(param, struct curl_slist *);\r\n    data->change.resolve = data->set.resolve;\r\n    break;\r\n  case CURLOPT_PROGRESSFUNCTION:\r\n    /*\r\n     * Progress callback function\r\n     */\r\n    data->set.fprogress = va_arg(param, curl_progress_callback);\r\n    if(data->set.fprogress)\r\n      data->progress.callback = TRUE; /* no longer internal */\r\n    else\r\n      data->progress.callback = FALSE; /* NULL enforces internal */\r\n\r\n    break;\r\n  case CURLOPT_PROGRESSDATA:\r\n    /*\r\n     * Custom client data to pass to the progress callback\r\n     */\r\n    data->set.progress_client = va_arg(param, void *);\r\n    break;\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n  case CURLOPT_PROXYUSERPWD:\r\n    /*\r\n     * user:password needed to use the proxy\r\n     */\r\n    result = setstropt_userpwd(va_arg(param, char *),\r\n                               &data->set.str[STRING_PROXYUSERNAME],\r\n                               &data->set.str[STRING_PROXYPASSWORD]);\r\n    break;\r\n  case CURLOPT_PROXYUSERNAME:\r\n    /*\r\n     * authentication user name to use in the operation\r\n     */\r\n    result = setstropt(&data->set.str[STRING_PROXYUSERNAME],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_PROXYPASSWORD:\r\n    /*\r\n     * authentication password to use in the operation\r\n     */\r\n    result = setstropt(&data->set.str[STRING_PROXYPASSWORD],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_NOPROXY:\r\n    /*\r\n     * proxy exception list\r\n     */\r\n    result = setstropt(&data->set.str[STRING_NOPROXY],\r\n                       va_arg(param, char *));\r\n    break;\r\n#endif\r\n\r\n  case CURLOPT_RANGE:\r\n    /*\r\n     * What range of the file you want to transfer\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SET_RANGE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_RESUME_FROM:\r\n    /*\r\n     * Resume transfer at the give file position\r\n     */\r\n    data->set.set_resume_from = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_RESUME_FROM_LARGE:\r\n    /*\r\n     * Resume transfer at the give file position\r\n     */\r\n    data->set.set_resume_from = va_arg(param, curl_off_t);\r\n    break;\r\n  case CURLOPT_DEBUGFUNCTION:\r\n    /*\r\n     * stderr write callback.\r\n     */\r\n    data->set.fdebug = va_arg(param, curl_debug_callback);\r\n    /*\r\n     * if the callback provided is NULL, it'll use the default callback\r\n     */\r\n    break;\r\n  case CURLOPT_DEBUGDATA:\r\n    /*\r\n     * Set to a void * that should receive all error writes. This\r\n     * defaults to CURLOPT_STDERR for normal operations.\r\n     */\r\n    data->set.debugdata = va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_STDERR:\r\n    /*\r\n     * Set to a FILE * that should receive all error writes. This\r\n     * defaults to stderr for normal operations.\r\n     */\r\n    data->set.err = va_arg(param, FILE *);\r\n    if(!data->set.err)\r\n      data->set.err = stderr;\r\n    break;\r\n  case CURLOPT_HEADERFUNCTION:\r\n    /*\r\n     * Set header write callback\r\n     */\r\n    data->set.fwrite_header = va_arg(param, curl_write_callback);\r\n    break;\r\n  case CURLOPT_WRITEFUNCTION:\r\n    /*\r\n     * Set data write callback\r\n     */\r\n    data->set.fwrite_func = va_arg(param, curl_write_callback);\r\n    if(!data->set.fwrite_func) {\r\n      data->set.is_fwrite_set = 0;\r\n      /* When set to NULL, reset to our internal default function */\r\n      data->set.fwrite_func = (curl_write_callback)fwrite;\r\n    }\r\n    else\r\n      data->set.is_fwrite_set = 1;\r\n    break;\r\n  case CURLOPT_READFUNCTION:\r\n    /*\r\n     * Read data callback\r\n     */\r\n    data->set.fread_func = va_arg(param, curl_read_callback);\r\n    if(!data->set.fread_func) {\r\n      data->set.is_fread_set = 0;\r\n      /* When set to NULL, reset to our internal default function */\r\n      data->set.fread_func = (curl_read_callback)fread;\r\n    }\r\n    else\r\n      data->set.is_fread_set = 1;\r\n    break;\r\n  case CURLOPT_SEEKFUNCTION:\r\n    /*\r\n     * Seek callback. Might be NULL.\r\n     */\r\n    data->set.seek_func = va_arg(param, curl_seek_callback);\r\n    break;\r\n  case CURLOPT_SEEKDATA:\r\n    /*\r\n     * Seek control callback. Might be NULL.\r\n     */\r\n    data->set.seek_client = va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_CONV_FROM_NETWORK_FUNCTION:\r\n    /*\r\n     * \"Convert from network encoding\" callback\r\n     */\r\n    data->set.convfromnetwork = va_arg(param, curl_conv_callback);\r\n    break;\r\n  case CURLOPT_CONV_TO_NETWORK_FUNCTION:\r\n    /*\r\n     * \"Convert to network encoding\" callback\r\n     */\r\n    data->set.convtonetwork = va_arg(param, curl_conv_callback);\r\n    break;\r\n  case CURLOPT_CONV_FROM_UTF8_FUNCTION:\r\n    /*\r\n     * \"Convert from UTF-8 encoding\" callback\r\n     */\r\n    data->set.convfromutf8 = va_arg(param, curl_conv_callback);\r\n    break;\r\n  case CURLOPT_IOCTLFUNCTION:\r\n    /*\r\n     * I/O control callback. Might be NULL.\r\n     */\r\n    data->set.ioctl_func = va_arg(param, curl_ioctl_callback);\r\n    break;\r\n  case CURLOPT_IOCTLDATA:\r\n    /*\r\n     * I/O control data pointer. Might be NULL.\r\n     */\r\n    data->set.ioctl_client = va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_SSLCERT:\r\n    /*\r\n     * String that holds file name of the SSL certificate to use\r\n     */\r\n    result = setstropt(&data->set.str[STRING_CERT],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_SSLCERTTYPE:\r\n    /*\r\n     * String that holds file type of the SSL certificate to use\r\n     */\r\n    result = setstropt(&data->set.str[STRING_CERT_TYPE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_SSLKEY:\r\n    /*\r\n     * String that holds file name of the SSL key to use\r\n     */\r\n    result = setstropt(&data->set.str[STRING_KEY],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_SSLKEYTYPE:\r\n    /*\r\n     * String that holds file type of the SSL key to use\r\n     */\r\n    result = setstropt(&data->set.str[STRING_KEY_TYPE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_KEYPASSWD:\r\n    /*\r\n     * String that holds the SSL or SSH private key password.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_KEY_PASSWD],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_SSLENGINE:\r\n    /*\r\n     * String that holds the SSL crypto engine.\r\n     */\r\n    argptr = va_arg(param, char *);\r\n    if(argptr && argptr[0])\r\n      result = Curl_ssl_set_engine(data, argptr);\r\n    break;\r\n\r\n  case CURLOPT_SSLENGINE_DEFAULT:\r\n    /*\r\n     * flag to set engine as default.\r\n     */\r\n    result = Curl_ssl_set_engine_default(data);\r\n    break;\r\n  case CURLOPT_CRLF:\r\n    /*\r\n     * Kludgy option to enable CRLF conversions. Subject for removal.\r\n     */\r\n    data->set.crlf = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_INTERFACE:\r\n    /*\r\n     * Set what interface or address/hostname to bind the socket to when\r\n     * performing an operation and thus what from-IP your connection will use.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_DEVICE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_LOCALPORT:\r\n    /*\r\n     * Set what local port to bind the socket to when performing an operation.\r\n     */\r\n    data->set.localport = curlx_sltous(va_arg(param, long));\r\n    break;\r\n  case CURLOPT_LOCALPORTRANGE:\r\n    /*\r\n     * Set number of local ports to try, starting with CURLOPT_LOCALPORT.\r\n     */\r\n    data->set.localportrange = curlx_sltosi(va_arg(param, long));\r\n    break;\r\n  case CURLOPT_KRBLEVEL:\r\n    /*\r\n     * A string that defines the kerberos security level.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_KRB_LEVEL],\r\n                       va_arg(param, char *));\r\n    data->set.krb = (NULL != data->set.str[STRING_KRB_LEVEL])?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_GSSAPI_DELEGATION:\r\n    /*\r\n     * GSSAPI credential delegation\r\n     */\r\n    data->set.gssapi_delegation = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_SSL_VERIFYPEER:\r\n    /*\r\n     * Enable peer SSL verifying.\r\n     */\r\n    data->set.ssl.verifypeer = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_SSL_VERIFYHOST:\r\n    /*\r\n     * Enable verification of the host name in the peer certificate\r\n     */\r\n    arg = va_arg(param, long);\r\n\r\n    /* Obviously people are not reading documentation and too many thought\r\n       this argument took a boolean when it wasn't and misused it. We thus ban\r\n       1 as a sensible input and we warn about its use. Then we only have the\r\n       2 action internally stored as TRUE. */\r\n\r\n    if(1 == arg) {\r\n      failf(data, \"CURLOPT_SSL_VERIFYHOST no longer supports 1 as value!\");\r\n      return CURLE_BAD_FUNCTION_ARGUMENT;\r\n    }\r\n\r\n    data->set.ssl.verifyhost = (0 != arg)?TRUE:FALSE;\r\n    break;\r\n#ifdef USE_SSLEAY\r\n    /* since these two options are only possible to use on an OpenSSL-\r\n       powered libcurl we #ifdef them on this condition so that libcurls\r\n       built against other SSL libs will return a proper error when trying\r\n       to set this option! */\r\n  case CURLOPT_SSL_CTX_FUNCTION:\r\n    /*\r\n     * Set a SSL_CTX callback\r\n     */\r\n    data->set.ssl.fsslctx = va_arg(param, curl_ssl_ctx_callback);\r\n    break;\r\n  case CURLOPT_SSL_CTX_DATA:\r\n    /*\r\n     * Set a SSL_CTX callback parameter pointer\r\n     */\r\n    data->set.ssl.fsslctxp = va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_CERTINFO:\r\n    data->set.ssl.certinfo = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n#endif\r\n  case CURLOPT_CAINFO:\r\n    /*\r\n     * Set CA info for SSL connection. Specify file name of the CA certificate\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSL_CAFILE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_CAPATH:\r\n    /*\r\n     * Set CA path info for SSL connection. Specify directory name of the CA\r\n     * certificates which have been prepared using openssl c_rehash utility.\r\n     */\r\n    /* This does not work on windows. */\r\n    result = setstropt(&data->set.str[STRING_SSL_CAPATH],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_CRLFILE:\r\n    /*\r\n     * Set CRL file info for SSL connection. Specify file name of the CRL\r\n     * to check certificates revocation\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSL_CRLFILE],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_ISSUERCERT:\r\n    /*\r\n     * Set Issuer certificate file\r\n     * to check certificates issuer\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSL_ISSUERCERT],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_TELNETOPTIONS:\r\n    /*\r\n     * Set a linked list of telnet options\r\n     */\r\n    data->set.telnet_options = va_arg(param, struct curl_slist *);\r\n    break;\r\n\r\n  case CURLOPT_BUFFERSIZE:\r\n    /*\r\n     * The application kindly asks for a differently sized receive buffer.\r\n     * If it seems reasonable, we'll use it.\r\n     */\r\n    data->set.buffer_size = va_arg(param, long);\r\n\r\n    if((data->set.buffer_size> (BUFSIZE -1 )) ||\r\n       (data->set.buffer_size < 1))\r\n      data->set.buffer_size = 0; /* huge internal default */\r\n\r\n    break;\r\n\r\n  case CURLOPT_NOSIGNAL:\r\n    /*\r\n     * The application asks not to set any signal() or alarm() handlers,\r\n     * even when using a timeout.\r\n     */\r\n    data->set.no_signal = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_SHARE:\r\n  {\r\n    struct Curl_share *set;\r\n    set = va_arg(param, struct Curl_share *);\r\n\r\n    /* disconnect from old share, if any */\r\n    if(data->share) {\r\n      Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n      if(data->dns.hostcachetype == HCACHE_SHARED) {\r\n        data->dns.hostcache = NULL;\r\n        data->dns.hostcachetype = HCACHE_NONE;\r\n      }\r\n\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n      if(data->share->cookies == data->cookies)\r\n        data->cookies = NULL;\r\n#endif\r\n\r\n      if(data->share->sslsession == data->state.session)\r\n        data->state.session = NULL;\r\n\r\n      data->share->dirty--;\r\n\r\n      Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\r\n      data->share = NULL;\r\n    }\r\n\r\n    /* use new share if it set */\r\n    data->share = set;\r\n    if(data->share) {\r\n\r\n      Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\r\n\r\n      data->share->dirty++;\r\n\r\n      if(data->share->hostcache) {\r\n        /* use shared host cache */\r\n        data->dns.hostcache = data->share->hostcache;\r\n        data->dns.hostcachetype = HCACHE_SHARED;\r\n      }\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n      if(data->share->cookies) {\r\n        /* use shared cookie list, first free own one if any */\r\n        if(data->cookies)\r\n          Curl_cookie_cleanup(data->cookies);\r\n        /* enable cookies since we now use a share that uses cookies! */\r\n        data->cookies = data->share->cookies;\r\n      }\r\n#endif   /* CURL_DISABLE_HTTP */\r\n      if(data->share->sslsession) {\r\n        data->set.ssl.max_ssl_sessions = data->share->max_ssl_sessions;\r\n        data->state.session = data->share->sslsession;\r\n      }\r\n      Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\r\n\r\n    }\r\n    /* check for host cache not needed,\r\n     * it will be done by curl_easy_perform */\r\n  }\r\n  break;\r\n\r\n  case CURLOPT_PRIVATE:\r\n    /*\r\n     * Set private data pointer.\r\n     */\r\n    data->set.private_data = va_arg(param, void *);\r\n    break;\r\n\r\n  case CURLOPT_MAXFILESIZE:\r\n    /*\r\n     * Set the maximum size of a file to download.\r\n     */\r\n    data->set.max_filesize = va_arg(param, long);\r\n    break;\r\n\r\n#ifdef USE_SSL\r\n  case CURLOPT_USE_SSL:\r\n    /*\r\n     * Make transfers attempt to use SSL/TLS.\r\n     */\r\n    data->set.use_ssl = (curl_usessl)va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_SSL_OPTIONS:\r\n    arg = va_arg(param, long);\r\n    data->set.ssl_enable_beast = arg&CURLSSLOPT_ALLOW_BEAST?TRUE:FALSE;\r\n    break;\r\n\r\n#endif\r\n  case CURLOPT_FTPSSLAUTH:\r\n    /*\r\n     * Set a specific auth for FTP-SSL transfers.\r\n     */\r\n    data->set.ftpsslauth = (curl_ftpauth)va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_IPRESOLVE:\r\n    data->set.ipver = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_MAXFILESIZE_LARGE:\r\n    /*\r\n     * Set the maximum size of a file to download.\r\n     */\r\n    data->set.max_filesize = va_arg(param, curl_off_t);\r\n    break;\r\n\r\n  case CURLOPT_TCP_NODELAY:\r\n    /*\r\n     * Enable or disable TCP_NODELAY, which will disable/enable the Nagle\r\n     * algorithm\r\n     */\r\n    data->set.tcp_nodelay = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FTP_ACCOUNT:\r\n    result = setstropt(&data->set.str[STRING_FTP_ACCOUNT],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_IGNORE_CONTENT_LENGTH:\r\n    data->set.ignorecl = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_CONNECT_ONLY:\r\n    /*\r\n     * No data transfer, set up connection and let application use the socket\r\n     */\r\n    data->set.connect_only = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_FTP_ALTERNATIVE_TO_USER:\r\n    result = setstropt(&data->set.str[STRING_FTP_ALTERNATIVE_TO_USER],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_SOCKOPTFUNCTION:\r\n    /*\r\n     * socket callback function: called after socket() but before connect()\r\n     */\r\n    data->set.fsockopt = va_arg(param, curl_sockopt_callback);\r\n    break;\r\n\r\n  case CURLOPT_SOCKOPTDATA:\r\n    /*\r\n     * socket callback data pointer. Might be NULL.\r\n     */\r\n    data->set.sockopt_client = va_arg(param, void *);\r\n    break;\r\n\r\n  case CURLOPT_OPENSOCKETFUNCTION:\r\n    /*\r\n     * open/create socket callback function: called instead of socket(),\r\n     * before connect()\r\n     */\r\n    data->set.fopensocket = va_arg(param, curl_opensocket_callback);\r\n    break;\r\n\r\n  case CURLOPT_OPENSOCKETDATA:\r\n    /*\r\n     * socket callback data pointer. Might be NULL.\r\n     */\r\n    data->set.opensocket_client = va_arg(param, void *);\r\n    break;\r\n\r\n  case CURLOPT_CLOSESOCKETFUNCTION:\r\n    /*\r\n     * close socket callback function: called instead of close()\r\n     * when shutting down a connection\r\n     */\r\n    data->set.fclosesocket = va_arg(param, curl_closesocket_callback);\r\n    break;\r\n\r\n  case CURLOPT_CLOSESOCKETDATA:\r\n    /*\r\n     * socket callback data pointer. Might be NULL.\r\n     */\r\n    data->set.closesocket_client = va_arg(param, void *);\r\n    break;\r\n\r\n  case CURLOPT_SSL_SESSIONID_CACHE:\r\n    data->set.ssl.sessionid = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n#ifdef USE_LIBSSH2\r\n    /* we only include SSH options if explicitly built to support SSH */\r\n  case CURLOPT_SSH_AUTH_TYPES:\r\n    data->set.ssh_auth_types = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_SSH_PUBLIC_KEYFILE:\r\n    /*\r\n     * Use this file instead of the $HOME/.ssh/id_dsa.pub file\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSH_PUBLIC_KEY],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_SSH_PRIVATE_KEYFILE:\r\n    /*\r\n     * Use this file instead of the $HOME/.ssh/id_dsa file\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSH_PRIVATE_KEY],\r\n                       va_arg(param, char *));\r\n    break;\r\n  case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:\r\n    /*\r\n     * Option to allow for the MD5 of the host public key to be checked\r\n     * for validation purposes.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5],\r\n                       va_arg(param, char *));\r\n    break;\r\n#ifdef HAVE_LIBSSH2_KNOWNHOST_API\r\n  case CURLOPT_SSH_KNOWNHOSTS:\r\n    /*\r\n     * Store the file name to read known hosts from.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_SSH_KNOWNHOSTS],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_SSH_KEYFUNCTION:\r\n    /* setting to NULL is fine since the ssh.c functions themselves will\r\n       then rever to use the internal default */\r\n    data->set.ssh_keyfunc = va_arg(param, curl_sshkeycallback);\r\n    break;\r\n\r\n  case CURLOPT_SSH_KEYDATA:\r\n    /*\r\n     * Custom client data to pass to the SSH keyfunc callback\r\n     */\r\n    data->set.ssh_keyfunc_userp = va_arg(param, void *);\r\n    break;\r\n#endif /* HAVE_LIBSSH2_KNOWNHOST_API */\r\n\r\n#endif /* USE_LIBSSH2 */\r\n\r\n  case CURLOPT_HTTP_TRANSFER_DECODING:\r\n    /*\r\n     * disable libcurl transfer encoding is used\r\n     */\r\n    data->set.http_te_skip = (0 == va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_HTTP_CONTENT_DECODING:\r\n    /*\r\n     * raw data passed to the application when content encoding is used\r\n     */\r\n    data->set.http_ce_skip = (0 == va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n\r\n  case CURLOPT_NEW_FILE_PERMS:\r\n    /*\r\n     * Uses these permissions instead of 0644\r\n     */\r\n    data->set.new_file_perms = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_NEW_DIRECTORY_PERMS:\r\n    /*\r\n     * Uses these permissions instead of 0755\r\n     */\r\n    data->set.new_directory_perms = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_ADDRESS_SCOPE:\r\n    /*\r\n     * We always get longs when passed plain numericals, but for this value we\r\n     * know that an unsigned int will always hold the value so we blindly\r\n     * typecast to this type\r\n     */\r\n    data->set.scope = curlx_sltoui(va_arg(param, long));\r\n    break;\r\n\r\n  case CURLOPT_PROTOCOLS:\r\n    /* set the bitmask for the protocols that are allowed to be used for the\r\n       transfer, which thus helps the app which takes URLs from users or other\r\n       external inputs and want to restrict what protocol(s) to deal\r\n       with. Defaults to CURLPROTO_ALL. */\r\n    data->set.allowed_protocols = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_REDIR_PROTOCOLS:\r\n    /* set the bitmask for the protocols that libcurl is allowed to follow to,\r\n       as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs\r\n       to be set in both bitmasks to be allowed to get redirected to. Defaults\r\n       to all protocols except FILE and SCP. */\r\n    data->set.redir_protocols = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_MAIL_FROM:\r\n    result = setstropt(&data->set.str[STRING_MAIL_FROM],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_MAIL_AUTH:\r\n    result = setstropt(&data->set.str[STRING_MAIL_AUTH],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_MAIL_RCPT:\r\n    /* get a list of mail recipients */\r\n    data->set.mail_rcpt = va_arg(param, struct curl_slist *);\r\n    break;\r\n\r\n  case CURLOPT_RTSP_REQUEST:\r\n    {\r\n      /*\r\n       * Set the RTSP request method (OPTIONS, SETUP, PLAY, etc...)\r\n       * Would this be better if the RTSPREQ_* were just moved into here?\r\n       */\r\n      long curl_rtspreq = va_arg(param, long);\r\n      Curl_RtspReq rtspreq = RTSPREQ_NONE;\r\n      switch(curl_rtspreq) {\r\n        case CURL_RTSPREQ_OPTIONS:\r\n          rtspreq = RTSPREQ_OPTIONS;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_DESCRIBE:\r\n          rtspreq = RTSPREQ_DESCRIBE;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_ANNOUNCE:\r\n          rtspreq = RTSPREQ_ANNOUNCE;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_SETUP:\r\n          rtspreq = RTSPREQ_SETUP;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_PLAY:\r\n          rtspreq = RTSPREQ_PLAY;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_PAUSE:\r\n          rtspreq = RTSPREQ_PAUSE;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_TEARDOWN:\r\n          rtspreq = RTSPREQ_TEARDOWN;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_GET_PARAMETER:\r\n          rtspreq = RTSPREQ_GET_PARAMETER;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_SET_PARAMETER:\r\n          rtspreq = RTSPREQ_SET_PARAMETER;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_RECORD:\r\n          rtspreq = RTSPREQ_RECORD;\r\n          break;\r\n\r\n        case CURL_RTSPREQ_RECEIVE:\r\n          rtspreq = RTSPREQ_RECEIVE;\r\n          break;\r\n        default:\r\n          rtspreq = RTSPREQ_NONE;\r\n      }\r\n\r\n      data->set.rtspreq = rtspreq;\r\n    break;\r\n    }\r\n\r\n\r\n  case CURLOPT_RTSP_SESSION_ID:\r\n    /*\r\n     * Set the RTSP Session ID manually. Useful if the application is\r\n     * resuming a previously established RTSP session\r\n     */\r\n    result = setstropt(&data->set.str[STRING_RTSP_SESSION_ID],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_RTSP_STREAM_URI:\r\n    /*\r\n     * Set the Stream URI for the RTSP request. Unless the request is\r\n     * for generic server options, the application will need to set this.\r\n     */\r\n    result = setstropt(&data->set.str[STRING_RTSP_STREAM_URI],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_RTSP_TRANSPORT:\r\n    /*\r\n     * The content of the Transport: header for the RTSP request\r\n     */\r\n    result = setstropt(&data->set.str[STRING_RTSP_TRANSPORT],\r\n                       va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_RTSP_CLIENT_CSEQ:\r\n    /*\r\n     * Set the CSEQ number to issue for the next RTSP request. Useful if the\r\n     * application is resuming a previously broken connection. The CSEQ\r\n     * will increment from this new number henceforth.\r\n     */\r\n    data->state.rtsp_next_client_CSeq = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_RTSP_SERVER_CSEQ:\r\n    /* Same as the above, but for server-initiated requests */\r\n    data->state.rtsp_next_client_CSeq = va_arg(param, long);\r\n    break;\r\n\r\n  case CURLOPT_INTERLEAVEDATA:\r\n    data->set.rtp_out = va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_INTERLEAVEFUNCTION:\r\n    /* Set the user defined RTP write function */\r\n    data->set.fwrite_rtp = va_arg(param, curl_write_callback);\r\n    break;\r\n\r\n  case CURLOPT_WILDCARDMATCH:\r\n    data->set.wildcardmatch = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_CHUNK_BGN_FUNCTION:\r\n    data->set.chunk_bgn = va_arg(param, curl_chunk_bgn_callback);\r\n    break;\r\n  case CURLOPT_CHUNK_END_FUNCTION:\r\n    data->set.chunk_end = va_arg(param, curl_chunk_end_callback);\r\n    break;\r\n  case CURLOPT_FNMATCH_FUNCTION:\r\n    data->set.fnmatch = va_arg(param, curl_fnmatch_callback);\r\n    break;\r\n  case CURLOPT_CHUNK_DATA:\r\n    data->wildcard.customptr = va_arg(param, void *);\r\n    break;\r\n  case CURLOPT_FNMATCH_DATA:\r\n    data->set.fnmatch_data = va_arg(param, void *);\r\n    break;\r\n#ifdef USE_TLS_SRP\r\n  case CURLOPT_TLSAUTH_USERNAME:\r\n    result = setstropt(&data->set.str[STRING_TLSAUTH_USERNAME],\r\n                       va_arg(param, char *));\r\n    if(data->set.str[STRING_TLSAUTH_USERNAME] && !data->set.ssl.authtype)\r\n      data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */\r\n    break;\r\n  case CURLOPT_TLSAUTH_PASSWORD:\r\n    result = setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD],\r\n                       va_arg(param, char *));\r\n    if(data->set.str[STRING_TLSAUTH_USERNAME] && !data->set.ssl.authtype)\r\n      data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */\r\n    break;\r\n  case CURLOPT_TLSAUTH_TYPE:\r\n    if(strnequal((char *)va_arg(param, char *), \"SRP\", strlen(\"SRP\")))\r\n      data->set.ssl.authtype = CURL_TLSAUTH_SRP;\r\n    else\r\n      data->set.ssl.authtype = CURL_TLSAUTH_NONE;\r\n    break;\r\n#endif\r\n  case CURLOPT_DNS_SERVERS:\r\n    result = Curl_set_dns_servers(data, va_arg(param, char *));\r\n    break;\r\n\r\n  case CURLOPT_TCP_KEEPALIVE:\r\n    data->set.tcp_keepalive = (0 != va_arg(param, long))?TRUE:FALSE;\r\n    break;\r\n  case CURLOPT_TCP_KEEPIDLE:\r\n    data->set.tcp_keepidle = va_arg(param, long);\r\n    break;\r\n  case CURLOPT_TCP_KEEPINTVL:\r\n    data->set.tcp_keepintvl = va_arg(param, long);\r\n    break;\r\n\r\n  default:\r\n    /* unknown tag and its companion, just ignore: */\r\n    result = CURLE_UNKNOWN_OPTION;\r\n    break;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\nstatic void conn_free(struct connectdata *conn)\r\n{\r\n  if(!conn)\r\n    return;\r\n\r\n  /* possible left-overs from the async name resolvers */\r\n  Curl_resolver_cancel(conn);\r\n\r\n  /* close the SSL stuff before we close any sockets since they will/may\r\n     write to the sockets */\r\n  Curl_ssl_close(conn, FIRSTSOCKET);\r\n  Curl_ssl_close(conn, SECONDARYSOCKET);\r\n\r\n  /* close possibly still open sockets */\r\n  if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET])\r\n    Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]);\r\n  if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET])\r\n    Curl_closesocket(conn, conn->sock[FIRSTSOCKET]);\r\n\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n  Curl_ntlm_wb_cleanup(conn);\r\n#endif\r\n\r\n  Curl_safefree(conn->user);\r\n  Curl_safefree(conn->passwd);\r\n  Curl_safefree(conn->proxyuser);\r\n  Curl_safefree(conn->proxypasswd);\r\n  Curl_safefree(conn->allocptr.proxyuserpwd);\r\n  Curl_safefree(conn->allocptr.uagent);\r\n  Curl_safefree(conn->allocptr.userpwd);\r\n  Curl_safefree(conn->allocptr.accept_encoding);\r\n  Curl_safefree(conn->allocptr.te);\r\n  Curl_safefree(conn->allocptr.rangeline);\r\n  Curl_safefree(conn->allocptr.ref);\r\n  Curl_safefree(conn->allocptr.host);\r\n  Curl_safefree(conn->allocptr.cookiehost);\r\n  Curl_safefree(conn->allocptr.rtsp_transport);\r\n  Curl_safefree(conn->trailer);\r\n  Curl_safefree(conn->host.rawalloc); /* host name buffer */\r\n  Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */\r\n  Curl_safefree(conn->master_buffer);\r\n\r\n  Curl_llist_destroy(conn->send_pipe, NULL);\r\n  Curl_llist_destroy(conn->recv_pipe, NULL);\r\n  Curl_llist_destroy(conn->pend_pipe, NULL);\r\n  Curl_llist_destroy(conn->done_pipe, NULL);\r\n\r\n  conn->send_pipe = NULL;\r\n  conn->recv_pipe = NULL;\r\n  conn->pend_pipe = NULL;\r\n  conn->done_pipe = NULL;\r\n\r\n  Curl_safefree(conn->localdev);\r\n  Curl_free_ssl_config(&conn->ssl_config);\r\n\r\n  free(conn); /* free all the connection oriented data */\r\n}\r\n\r\nCURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)\r\n{\r\n  struct SessionHandle *data;\r\n  if(!conn)\r\n    return CURLE_OK; /* this is closed and fine already */\r\n  data = conn->data;\r\n\r\n  if(!data) {\r\n    DEBUGF(fprintf(stderr, \"DISCONNECT without easy handle, ignoring\\n\"));\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(conn->dns_entry != NULL) {\r\n    Curl_resolv_unlock(data, conn->dns_entry);\r\n    conn->dns_entry = NULL;\r\n  }\r\n\r\n  Curl_hostcache_prune(data); /* kill old DNS cache entries */\r\n\r\n  {\r\n    int has_host_ntlm = (conn->ntlm.state != NTLMSTATE_NONE);\r\n    int has_proxy_ntlm = (conn->proxyntlm.state != NTLMSTATE_NONE);\r\n\r\n    /* Authentication data is a mix of connection-related and sessionhandle-\r\n       related stuff. NTLM is connection-related so when we close the shop\r\n       we shall forget. */\r\n\r\n    if(has_host_ntlm) {\r\n      data->state.authhost.done = FALSE;\r\n      data->state.authhost.picked =\r\n        data->state.authhost.want;\r\n    }\r\n\r\n    if(has_proxy_ntlm) {\r\n      data->state.authproxy.done = FALSE;\r\n      data->state.authproxy.picked =\r\n        data->state.authproxy.want;\r\n    }\r\n\r\n    if(has_host_ntlm || has_proxy_ntlm) {\r\n      data->state.authproblem = FALSE;\r\n\r\n      Curl_http_ntlm_cleanup(conn);\r\n    }\r\n  }\r\n\r\n  /* Cleanup possible redirect junk */\r\n  if(data->req.newurl) {\r\n    free(data->req.newurl);\r\n    data->req.newurl = NULL;\r\n  }\r\n\r\n  if(conn->handler->disconnect)\r\n    /* This is set if protocol-specific cleanups should be made */\r\n    conn->handler->disconnect(conn, dead_connection);\r\n\r\n    /* unlink ourselves! */\r\n  infof(data, \"Closing connection %d\\n\", conn->connection_id);\r\n  Curl_conncache_remove_conn(data->state.conn_cache, conn);\r\n\r\n#if defined(USE_LIBIDN)\r\n  if(conn->host.encalloc)\r\n    idn_free(conn->host.encalloc); /* encoded host name buffer, must be freed\r\n                                      with idn_free() since this was allocated\r\n                                      by libidn */\r\n  if(conn->proxy.encalloc)\r\n    idn_free(conn->proxy.encalloc); /* encoded proxy name buffer, must be\r\n                                       freed with idn_free() since this was\r\n                                       allocated by libidn */\r\n#elif defined(USE_WIN32_IDN)\r\n  free(conn->host.encalloc); /* encoded host name buffer, must be freed with\r\n                                idn_free() since this was allocated by\r\n                                curl_win32_idn_to_ascii */\r\n  if(conn->proxy.encalloc)\r\n    free(conn->proxy.encalloc); /* encoded proxy name buffer, must be freed\r\n                                   with idn_free() since this was allocated by\r\n                                   curl_win32_idn_to_ascii */\r\n#endif\r\n\r\n  Curl_ssl_close(conn, FIRSTSOCKET);\r\n\r\n  /* Indicate to all handles on the pipe that we're dead */\r\n  if(Curl_isPipeliningEnabled(data)) {\r\n    signalPipeClose(conn->send_pipe, TRUE);\r\n    signalPipeClose(conn->recv_pipe, TRUE);\r\n    signalPipeClose(conn->pend_pipe, TRUE);\r\n    signalPipeClose(conn->done_pipe, FALSE);\r\n  }\r\n\r\n  conn_free(conn);\r\n  data->state.current_conn = NULL;\r\n  Curl_speedinit(data);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * This function should return TRUE if the socket is to be assumed to\r\n * be dead. Most commonly this happens when the server has closed the\r\n * connection due to inactivity.\r\n */\r\nstatic bool SocketIsDead(curl_socket_t sock)\r\n{\r\n  int sval;\r\n  bool ret_val = TRUE;\r\n\r\n  sval = Curl_socket_ready(sock, CURL_SOCKET_BAD, 0);\r\n  if(sval == 0)\r\n    /* timeout */\r\n    ret_val = FALSE;\r\n\r\n  return ret_val;\r\n}\r\n\r\nstatic bool IsPipeliningPossible(const struct SessionHandle *handle,\r\n                                 const struct connectdata *conn)\r\n{\r\n  if((conn->handler->protocol & CURLPROTO_HTTP) &&\r\n     handle->multi && Curl_multi_canPipeline(handle->multi) &&\r\n     (handle->set.httpreq == HTTPREQ_GET ||\r\n      handle->set.httpreq == HTTPREQ_HEAD) &&\r\n     handle->set.httpversion != CURL_HTTP_VERSION_1_0)\r\n    return TRUE;\r\n\r\n  return FALSE;\r\n}\r\n\r\nbool Curl_isPipeliningEnabled(const struct SessionHandle *handle)\r\n{\r\n  if(handle->multi && Curl_multi_canPipeline(handle->multi))\r\n    return TRUE;\r\n\r\n  return FALSE;\r\n}\r\n\r\nCURLcode Curl_addHandleToPipeline(struct SessionHandle *data,\r\n                                  struct curl_llist *pipeline)\r\n{\r\n  if(!Curl_llist_insert_next(pipeline, pipeline->tail, data))\r\n    return CURLE_OUT_OF_MEMORY;\r\n  return CURLE_OK;\r\n}\r\n\r\nint Curl_removeHandleFromPipeline(struct SessionHandle *handle,\r\n                                  struct curl_llist *pipeline)\r\n{\r\n  struct curl_llist_element *curr;\r\n\r\n  curr = pipeline->head;\r\n  while(curr) {\r\n    if(curr->ptr == handle) {\r\n      Curl_llist_remove(pipeline, curr, NULL);\r\n      return 1; /* we removed a handle */\r\n    }\r\n    curr = curr->next;\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n#if 0 /* this code is saved here as it is useful for debugging purposes */\r\nstatic void Curl_printPipeline(struct curl_llist *pipeline)\r\n{\r\n  struct curl_llist_element *curr;\r\n\r\n  curr = pipeline->head;\r\n  while(curr) {\r\n    struct SessionHandle *data = (struct SessionHandle *) curr->ptr;\r\n    infof(data, \"Handle in pipeline: %s\\n\", data->state.path);\r\n    curr = curr->next;\r\n  }\r\n}\r\n#endif\r\n\r\nstatic struct SessionHandle* gethandleathead(struct curl_llist *pipeline)\r\n{\r\n  struct curl_llist_element *curr = pipeline->head;\r\n  if(curr) {\r\n    return (struct SessionHandle *) curr->ptr;\r\n  }\r\n\r\n  return NULL;\r\n}\r\n\r\n/* remove the specified connection from all (possible) pipelines and related\r\n   queues */\r\nvoid Curl_getoff_all_pipelines(struct SessionHandle *data,\r\n                               struct connectdata *conn)\r\n{\r\n  bool recv_head = (conn->readchannel_inuse &&\r\n    (gethandleathead(conn->recv_pipe) == data)) ? TRUE : FALSE;\r\n\r\n  bool send_head = (conn->writechannel_inuse &&\r\n    (gethandleathead(conn->send_pipe) == data)) ? TRUE : FALSE;\r\n\r\n  if(Curl_removeHandleFromPipeline(data, conn->recv_pipe) && recv_head)\r\n    conn->readchannel_inuse = FALSE;\r\n  if(Curl_removeHandleFromPipeline(data, conn->send_pipe) && send_head)\r\n    conn->writechannel_inuse = FALSE;\r\n  Curl_removeHandleFromPipeline(data, conn->pend_pipe);\r\n  Curl_removeHandleFromPipeline(data, conn->done_pipe);\r\n}\r\n\r\nstatic void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke)\r\n{\r\n  struct curl_llist_element *curr;\r\n\r\n  if(!pipeline)\r\n    return;\r\n\r\n  curr = pipeline->head;\r\n  while(curr) {\r\n    struct curl_llist_element *next = curr->next;\r\n    struct SessionHandle *data = (struct SessionHandle *) curr->ptr;\r\n\r\n#ifdef DEBUGBUILD /* debug-only code */\r\n    if(data->magic != CURLEASY_MAGIC_NUMBER) {\r\n      /* MAJOR BADNESS */\r\n      infof(data, \"signalPipeClose() found BAAD easy handle\\n\");\r\n    }\r\n#endif\r\n\r\n    if(pipe_broke)\r\n      data->state.pipe_broke = TRUE;\r\n    Curl_multi_handlePipeBreak(data);\r\n    Curl_llist_remove(pipeline, curr, NULL);\r\n    curr = next;\r\n  }\r\n}\r\n\r\n/*\r\n * This function kills and removes an existing connection in the connection\r\n * cache. The connection that has been unused for the longest time.\r\n *\r\n * Returns the pointer to the oldest idle connection, or NULL if none was\r\n * found.\r\n */\r\nstatic struct connectdata *\r\nfind_oldest_idle_connection(struct SessionHandle *data)\r\n{\r\n  struct conncache *bc = data->state.conn_cache;\r\n  struct curl_hash_iterator iter;\r\n  struct curl_llist_element *curr;\r\n  struct curl_hash_element *he;\r\n  long highscore=-1;\r\n  long score;\r\n  struct timeval now;\r\n  struct connectdata *conn_candidate = NULL;\r\n  struct connectbundle *bundle;\r\n\r\n  now = Curl_tvnow();\r\n\r\n  Curl_hash_start_iterate(bc->hash, &iter);\r\n\r\n  he = Curl_hash_next_element(&iter);\r\n  while(he) {\r\n    struct connectdata *conn;\r\n\r\n    bundle = he->ptr;\r\n\r\n    curr = bundle->conn_list->head;\r\n    while(curr) {\r\n      conn = curr->ptr;\r\n\r\n      if(!conn->inuse) {\r\n        /* Set higher score for the age passed since the connection was used */\r\n        score = Curl_tvdiff(now, conn->now);\r\n\r\n        if(score > highscore) {\r\n          highscore = score;\r\n          conn_candidate = conn;\r\n        }\r\n      }\r\n      curr = curr->next;\r\n    }\r\n\r\n    he = Curl_hash_next_element(&iter);\r\n  }\r\n\r\n  return conn_candidate;\r\n}\r\n\r\n/*\r\n * Given one filled in connection struct (named needle), this function should\r\n * detect if there already is one that has all the significant details\r\n * exactly the same and thus should be used instead.\r\n *\r\n * If there is a match, this function returns TRUE - and has marked the\r\n * connection as 'in-use'. It must later be called with ConnectionDone() to\r\n * return back to 'idle' (unused) state.\r\n */\r\nstatic bool\r\nConnectionExists(struct SessionHandle *data,\r\n                 struct connectdata *needle,\r\n                 struct connectdata **usethis)\r\n{\r\n  struct connectdata *check;\r\n  struct connectdata *chosen = 0;\r\n  bool canPipeline = IsPipeliningPossible(data, needle);\r\n  bool wantNTLM = (data->state.authhost.want==CURLAUTH_NTLM) ||\r\n                  (data->state.authhost.want==CURLAUTH_NTLM_WB) ? TRUE : FALSE;\r\n  struct connectbundle *bundle;\r\n\r\n  /* Look up the bundle with all the connections to this\r\n     particular host */\r\n  bundle = Curl_conncache_find_bundle(data->state.conn_cache,\r\n                                      needle->host.name);\r\n  if(bundle) {\r\n    struct curl_llist_element *curr;\r\n\r\n    infof(data, \"Found bundle for host %s: %p\\n\", needle->host.name, bundle);\r\n\r\n    curr = bundle->conn_list->head;\r\n    while(curr) {\r\n      bool match = FALSE;\r\n      bool credentialsMatch = FALSE;\r\n      size_t pipeLen;\r\n\r\n      /*\r\n       * Note that if we use a HTTP proxy, we check connections to that\r\n       * proxy and not to the actual remote server.\r\n       */\r\n      check = curr->ptr;\r\n      curr = curr->next;\r\n\r\n      pipeLen = check->send_pipe->size + check->recv_pipe->size;\r\n\r\n      if(!pipeLen && !check->inuse) {\r\n        /* The check for a dead socket makes sense only if there are no\r\n           handles in pipeline and the connection isn't already marked in\r\n           use */\r\n        bool dead;\r\n        if(check->handler->protocol & CURLPROTO_RTSP)\r\n          /* RTSP is a special case due to RTP interleaving */\r\n          dead = Curl_rtsp_connisdead(check);\r\n        else\r\n          dead = SocketIsDead(check->sock[FIRSTSOCKET]);\r\n\r\n        if(dead) {\r\n          check->data = data;\r\n          infof(data, \"Connection %d seems to be dead!\\n\",\r\n                check->connection_id);\r\n\r\n          /* disconnect resources */\r\n          Curl_disconnect(check, /* dead_connection */ TRUE);\r\n          continue;\r\n        }\r\n      }\r\n\r\n      if(canPipeline) {\r\n        /* Make sure the pipe has only GET requests */\r\n        struct SessionHandle* sh = gethandleathead(check->send_pipe);\r\n        struct SessionHandle* rh = gethandleathead(check->recv_pipe);\r\n        if(sh) {\r\n          if(!IsPipeliningPossible(sh, check))\r\n            continue;\r\n        }\r\n        else if(rh) {\r\n          if(!IsPipeliningPossible(rh, check))\r\n            continue;\r\n        }\r\n#ifdef DEBUGBUILD\r\n      if(pipeLen > MAX_PIPELINE_LENGTH) {\r\n        infof(data, \"BAD! Connection #%ld has too big pipeline!\\n\",\r\n              check->connection_id);\r\n      }\r\n#endif\r\n      }\r\n      else {\r\n        if(pipeLen > 0) {\r\n          /* can only happen within multi handles, and means that another easy\r\n             handle is using this connection */\r\n          continue;\r\n        }\r\n\r\n        if(Curl_resolver_asynch()) {\r\n          /* ip_addr_str[0] is NUL only if the resolving of the name hasn't\r\n             completed yet and until then we don't re-use this connection */\r\n          if(!check->ip_addr_str[0]) {\r\n            infof(data,\r\n                  \"Connection #%ld is still name resolving, can't reuse\\n\",\r\n                  check->connection_id);\r\n            continue;\r\n          }\r\n        }\r\n\r\n        if((check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) ||\r\n           check->bits.close) {\r\n          /* Don't pick a connection that hasn't connected yet or that is going\r\n             to get closed. */\r\n          infof(data, \"Connection #%ld isn't open enough, can't reuse\\n\",\r\n                check->connection_id);\r\n#ifdef DEBUGBUILD\r\n          if(check->recv_pipe->size > 0) {\r\n            infof(data,\r\n                  \"BAD! Unconnected #%ld has a non-empty recv pipeline!\\n\",\r\n                  check->connection_id);\r\n          }\r\n#endif\r\n          continue;\r\n        }\r\n      }\r\n\r\n      if((needle->handler->flags&PROTOPT_SSL) !=\r\n         (check->handler->flags&PROTOPT_SSL))\r\n        /* don't do mixed SSL and non-SSL connections */\r\n        if(!(needle->handler->protocol & check->handler->protocol))\r\n          /* except protocols that have been upgraded via TLS */\r\n          continue;\r\n\r\n      if(needle->handler->flags&PROTOPT_SSL) {\r\n        if((data->set.ssl.verifypeer != check->verifypeer) ||\r\n           (data->set.ssl.verifyhost != check->verifyhost))\r\n          continue;\r\n      }\r\n\r\n      if(needle->bits.proxy != check->bits.proxy)\r\n        /* don't do mixed proxy and non-proxy connections */\r\n        continue;\r\n\r\n      if(!canPipeline && check->inuse)\r\n        /* this request can't be pipelined but the checked connection is\r\n           already in use so we skip it */\r\n        continue;\r\n\r\n      if(needle->localdev || needle->localport) {\r\n        /* If we are bound to a specific local end (IP+port), we must not\r\n           re-use a random other one, although if we didn't ask for a\r\n           particular one we can reuse one that was bound.\r\n\r\n           This comparison is a bit rough and too strict. Since the input\r\n           parameters can be specified in numerous ways and still end up the\r\n           same it would take a lot of processing to make it really accurate.\r\n           Instead, this matching will assume that re-uses of bound connections\r\n           will most likely also re-use the exact same binding parameters and\r\n           missing out a few edge cases shouldn't hurt anyone very much.\r\n        */\r\n        if((check->localport != needle->localport) ||\r\n           (check->localportrange != needle->localportrange) ||\r\n           !check->localdev ||\r\n           !needle->localdev ||\r\n           strcmp(check->localdev, needle->localdev))\r\n          continue;\r\n      }\r\n\r\n      if(!needle->bits.httpproxy || needle->handler->flags&PROTOPT_SSL ||\r\n         (needle->bits.httpproxy && check->bits.httpproxy &&\r\n          needle->bits.tunnel_proxy && check->bits.tunnel_proxy &&\r\n          Curl_raw_equal(needle->proxy.name, check->proxy.name) &&\r\n          (needle->port == check->port))) {\r\n        /* The requested connection does not use a HTTP proxy or it uses SSL or\r\n           it is a non-SSL protocol tunneled over the same http proxy name and\r\n           port number or it is a non-SSL protocol which is allowed to be\r\n           upgraded via TLS */\r\n\r\n        if((Curl_raw_equal(needle->handler->scheme, check->handler->scheme) ||\r\n            needle->handler->protocol & check->handler->protocol) &&\r\n           Curl_raw_equal(needle->host.name, check->host.name) &&\r\n           needle->remote_port == check->remote_port) {\r\n          if(needle->handler->flags & PROTOPT_SSL) {\r\n            /* This is a SSL connection so verify that we're using the same\r\n               SSL options as well */\r\n            if(!Curl_ssl_config_matches(&needle->ssl_config,\r\n                                        &check->ssl_config)) {\r\n              DEBUGF(infof(data,\r\n                           \"Connection #%ld has different SSL parameters, \"\r\n                           \"can't reuse\\n\",\r\n                           check->connection_id));\r\n              continue;\r\n            }\r\n            else if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) {\r\n              DEBUGF(infof(data,\r\n                           \"Connection #%ld has not started SSL connect, \"\r\n                           \"can't reuse\\n\",\r\n                           check->connection_id));\r\n              continue;\r\n            }\r\n          }\r\n          if((needle->handler->protocol & CURLPROTO_FTP) ||\r\n             ((needle->handler->protocol & CURLPROTO_HTTP) && wantNTLM)) {\r\n            /* This is FTP or HTTP+NTLM, verify that we're using the same name\r\n               and password as well */\r\n            if(!strequal(needle->user, check->user) ||\r\n               !strequal(needle->passwd, check->passwd)) {\r\n              /* one of them was different */\r\n              continue;\r\n            }\r\n            credentialsMatch = TRUE;\r\n          }\r\n          match = TRUE;\r\n        }\r\n      }\r\n      else { /* The requested needle connection is using a proxy,\r\n                is the checked one using the same host, port and type? */\r\n        if(check->bits.proxy &&\r\n           (needle->proxytype == check->proxytype) &&\r\n           (needle->bits.tunnel_proxy == check->bits.tunnel_proxy) &&\r\n           Curl_raw_equal(needle->proxy.name, check->proxy.name) &&\r\n           needle->port == check->port) {\r\n          /* This is the same proxy connection, use it! */\r\n          match = TRUE;\r\n        }\r\n      }\r\n\r\n      if(match) {\r\n        chosen = check;\r\n\r\n        /* If we are not looking for an NTLM connection, we can choose this one\r\n           immediately. */\r\n        if(!wantNTLM)\r\n          break;\r\n\r\n        /* Otherwise, check if this is already authenticating with the right\r\n           credentials. If not, keep looking so that we can reuse NTLM\r\n           connections if possible. (Especially we must reuse the same\r\n           connection if partway through a handshake!) */\r\n        if(credentialsMatch && chosen->ntlm.state != NTLMSTATE_NONE)\r\n          break;\r\n      }\r\n    }\r\n  }\r\n\r\n  if(chosen) {\r\n    chosen->inuse = TRUE; /* mark this as being in use so that no other\r\n                            handle in a multi stack may nick it */\r\n    *usethis = chosen;\r\n    return TRUE; /* yes, we found one to use! */\r\n  }\r\n\r\n  return FALSE; /* no matching connecting exists */\r\n}\r\n\r\n/* Mark the connection as 'idle', or close it if the cache is full.\r\n   Returns TRUE if the connection is kept, or FALSE if it was closed. */\r\nstatic bool\r\nConnectionDone(struct SessionHandle *data, struct connectdata *conn)\r\n{\r\n  /* data->multi->maxconnects can be negative, deal with it. */\r\n  size_t maxconnects =\r\n    (data->multi->maxconnects < 0) ? 0 : data->multi->maxconnects;\r\n  struct connectdata *conn_candidate = NULL;\r\n\r\n  /* Mark the current connection as 'unused' */\r\n  conn->inuse = FALSE;\r\n\r\n  if(maxconnects > 0 &&\r\n     data->state.conn_cache->num_connections > maxconnects) {\r\n    infof(data, \"Connection cache is full, closing the oldest one.\\n\");\r\n\r\n    conn_candidate = find_oldest_idle_connection(data);\r\n\r\n    if(conn_candidate) {\r\n      /* Set the connection's owner correctly */\r\n      conn_candidate->data = data;\r\n\r\n      /* the winner gets the honour of being disconnected */\r\n      (void)Curl_disconnect(conn_candidate, /* dead_connection */ FALSE);\r\n    }\r\n  }\r\n\r\n  return (conn_candidate == conn) ? FALSE : TRUE;\r\n}\r\n\r\n/*\r\n * The given input connection struct pointer is to be stored in the connection\r\n * cache. If the cache is already full, least interesting existing connection\r\n * (if any) gets closed.\r\n *\r\n * The given connection should be unique. That must've been checked prior to\r\n * this call.\r\n */\r\nstatic CURLcode ConnectionStore(struct SessionHandle *data,\r\n                                struct connectdata *conn)\r\n{\r\n  static int connection_id_counter = 0;\r\n\r\n  CURLcode result;\r\n\r\n  /* Assign a number to the connection for easier tracking in the log\r\n     output */\r\n  conn->connection_id = connection_id_counter++;\r\n\r\n  result = Curl_conncache_add_conn(data->state.conn_cache, conn);\r\n  if(result != CURLE_OK)\r\n    conn->connection_id = -1;\r\n\r\n  return result;\r\n}\r\n\r\n/* after a TCP connection to the proxy has been verified, this function does\r\n   the next magic step.\r\n\r\n   Note: this function's sub-functions call failf()\r\n\r\n*/\r\nCURLcode Curl_connected_proxy(struct connectdata *conn)\r\n{\r\n  switch(conn->proxytype) {\r\n#ifndef CURL_DISABLE_PROXY\r\n  case CURLPROXY_SOCKS5:\r\n  case CURLPROXY_SOCKS5_HOSTNAME:\r\n    return Curl_SOCKS5(conn->proxyuser, conn->proxypasswd,\r\n                       conn->host.name, conn->remote_port,\r\n                       FIRSTSOCKET, conn);\r\n\r\n  case CURLPROXY_SOCKS4:\r\n    return Curl_SOCKS4(conn->proxyuser, conn->host.name,\r\n                       conn->remote_port, FIRSTSOCKET, conn, FALSE);\r\n\r\n  case CURLPROXY_SOCKS4A:\r\n    return Curl_SOCKS4(conn->proxyuser, conn->host.name,\r\n                       conn->remote_port, FIRSTSOCKET, conn, TRUE);\r\n\r\n#endif /* CURL_DISABLE_PROXY */\r\n  case CURLPROXY_HTTP:\r\n  case CURLPROXY_HTTP_1_0:\r\n    /* do nothing here. handled later. */\r\n    break;\r\n  default:\r\n    break;\r\n  } /* switch proxytype */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nstatic CURLcode ConnectPlease(struct SessionHandle *data,\r\n                              struct connectdata *conn,\r\n                              bool *connected)\r\n{\r\n  CURLcode result;\r\n  Curl_addrinfo *addr;\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  char *hostname = conn->bits.proxy?conn->proxy.name:conn->host.name;\r\n\r\n  infof(data, \"About to connect() to %s%s port %ld (#%ld)\\n\",\r\n        conn->bits.proxy?\"proxy \":\"\",\r\n        hostname, conn->port, conn->connection_id);\r\n#else\r\n  (void)data;\r\n#endif\r\n\r\n  /*************************************************************\r\n   * Connect to server/proxy\r\n   *************************************************************/\r\n  result= Curl_connecthost(conn,\r\n                           conn->dns_entry,\r\n                           &conn->sock[FIRSTSOCKET],\r\n                           &addr,\r\n                           connected);\r\n  if(CURLE_OK == result) {\r\n    /* All is cool, we store the current information */\r\n    conn->ip_addr = addr;\r\n\r\n    if(*connected) {\r\n      result = Curl_connected_proxy(conn);\r\n      if(!result) {\r\n        conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;\r\n        Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */\r\n      }\r\n    }\r\n  }\r\n\r\n  if(result)\r\n    *connected = FALSE; /* mark it as not connected */\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * verboseconnect() displays verbose information after a connect\r\n */\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\nvoid Curl_verboseconnect(struct connectdata *conn)\r\n{\r\n  if(conn->data->set.verbose)\r\n    infof(conn->data, \"Connected to %s (%s) port %ld (#%ld)\\n\",\r\n          conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname,\r\n          conn->ip_addr_str, conn->port, conn->connection_id);\r\n}\r\n#endif\r\n\r\nint Curl_protocol_getsock(struct connectdata *conn,\r\n                          curl_socket_t *socks,\r\n                          int numsocks)\r\n{\r\n  if(conn->handler->proto_getsock)\r\n    return conn->handler->proto_getsock(conn, socks, numsocks);\r\n  return GETSOCK_BLANK;\r\n}\r\n\r\nint Curl_doing_getsock(struct connectdata *conn,\r\n                       curl_socket_t *socks,\r\n                       int numsocks)\r\n{\r\n  if(conn && conn->handler->doing_getsock)\r\n    return conn->handler->doing_getsock(conn, socks, numsocks);\r\n  return GETSOCK_BLANK;\r\n}\r\n\r\n/*\r\n * We are doing protocol-specific connecting and this is being called over and\r\n * over from the multi interface until the connection phase is done on\r\n * protocol layer.\r\n */\r\n\r\nCURLcode Curl_protocol_connecting(struct connectdata *conn,\r\n                                  bool *done)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n\r\n  if(conn && conn->handler->connecting) {\r\n    *done = FALSE;\r\n    result = conn->handler->connecting(conn, done);\r\n  }\r\n  else\r\n    *done = TRUE;\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * We are DOING this is being called over and over from the multi interface\r\n * until the DOING phase is done on protocol layer.\r\n */\r\n\r\nCURLcode Curl_protocol_doing(struct connectdata *conn, bool *done)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n\r\n  if(conn && conn->handler->doing) {\r\n    *done = FALSE;\r\n    result = conn->handler->doing(conn, done);\r\n  }\r\n  else\r\n    *done = TRUE;\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * We have discovered that the TCP connection has been successful, we can now\r\n * proceed with some action.\r\n *\r\n */\r\nCURLcode Curl_protocol_connect(struct connectdata *conn,\r\n                               bool *protocol_done)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n\r\n  *protocol_done = FALSE;\r\n\r\n  if(conn->bits.tcpconnect[FIRSTSOCKET] && conn->bits.protoconnstart) {\r\n    /* We already are connected, get back. This may happen when the connect\r\n       worked fine in the first call, like when we connect to a local server\r\n       or proxy. Note that we don't know if the protocol is actually done.\r\n\r\n       Unless this protocol doesn't have any protocol-connect callback, as\r\n       then we know we're done. */\r\n    if(!conn->handler->connecting)\r\n      *protocol_done = TRUE;\r\n\r\n    return CURLE_OK;\r\n  }\r\n\r\n  if(!conn->bits.protoconnstart) {\r\n\r\n    result = Curl_proxy_connect(conn);\r\n    if(result)\r\n      return result;\r\n\r\n    if(conn->bits.tunnel_proxy && conn->bits.httpproxy &&\r\n       (conn->tunnel_state[FIRSTSOCKET] != TUNNEL_COMPLETE))\r\n      /* when using an HTTP tunnel proxy, await complete tunnel establishment\r\n         before proceeding further. Return CURLE_OK so we'll be called again */\r\n      return CURLE_OK;\r\n\r\n    if(conn->handler->connect_it) {\r\n      /* is there a protocol-specific connect() procedure? */\r\n\r\n      /* Call the protocol-specific connect function */\r\n      result = conn->handler->connect_it(conn, protocol_done);\r\n    }\r\n    else\r\n      *protocol_done = TRUE;\r\n\r\n    /* it has started, possibly even completed but that knowledge isn't stored\r\n       in this bit! */\r\n    if(!result)\r\n      conn->bits.protoconnstart = TRUE;\r\n  }\r\n\r\n  return result; /* pass back status */\r\n}\r\n\r\n/*\r\n * Helpers for IDNA convertions.\r\n */\r\nstatic bool is_ASCII_name(const char *hostname)\r\n{\r\n  const unsigned char *ch = (const unsigned char*)hostname;\r\n\r\n  while(*ch) {\r\n    if(*ch++ & 0x80)\r\n      return FALSE;\r\n  }\r\n  return TRUE;\r\n}\r\n\r\n#ifdef USE_LIBIDN\r\n/*\r\n * Check if characters in hostname is allowed in Top Level Domain.\r\n */\r\nstatic bool tld_check_name(struct SessionHandle *data,\r\n                           const char *ace_hostname)\r\n{\r\n  size_t err_pos;\r\n  char *uc_name = NULL;\r\n  int rc;\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n  const char *tld_errmsg = \"<no msg>\";\r\n#else\r\n  (void)data;\r\n#endif\r\n\r\n  /* Convert (and downcase) ACE-name back into locale's character set */\r\n  rc = idna_to_unicode_lzlz(ace_hostname, &uc_name, 0);\r\n  if(rc != IDNA_SUCCESS)\r\n    return FALSE;\r\n\r\n  rc = tld_check_lz(uc_name, &err_pos, NULL);\r\n#ifndef CURL_DISABLE_VERBOSE_STRINGS\r\n#ifdef HAVE_TLD_STRERROR\r\n  if(rc != TLD_SUCCESS)\r\n    tld_errmsg = tld_strerror((Tld_rc)rc);\r\n#endif\r\n  if(rc == TLD_INVALID)\r\n    infof(data, \"WARNING: %s; pos %u = `%c'/0x%02X\\n\",\r\n          tld_errmsg, err_pos, uc_name[err_pos],\r\n          uc_name[err_pos] & 255);\r\n  else if(rc != TLD_SUCCESS)\r\n    infof(data, \"WARNING: TLD check for %s failed; %s\\n\",\r\n          uc_name, tld_errmsg);\r\n#endif /* CURL_DISABLE_VERBOSE_STRINGS */\r\n  if(uc_name)\r\n     idn_free(uc_name);\r\n  if(rc != TLD_SUCCESS)\r\n    return FALSE;\r\n\r\n  return TRUE;\r\n}\r\n#endif\r\n\r\n/*\r\n * Perform any necessary IDN conversion of hostname\r\n */\r\nstatic void fix_hostname(struct SessionHandle *data,\r\n                         struct connectdata *conn, struct hostname *host)\r\n{\r\n#ifndef USE_LIBIDN\r\n  (void)data;\r\n  (void)conn;\r\n#elif defined(CURL_DISABLE_VERBOSE_STRINGS)\r\n  (void)conn;\r\n#endif\r\n\r\n  /* set the name we use to display the host name */\r\n  host->dispname = host->name;\r\n  if(!is_ASCII_name(host->name)) {\r\n#ifdef USE_LIBIDN\r\n  /*************************************************************\r\n   * Check name for non-ASCII and convert hostname to ACE form.\r\n   *************************************************************/\r\n  if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {\r\n    char *ace_hostname = NULL;\r\n    int rc = idna_to_ascii_lz(host->name, &ace_hostname, 0);\r\n    infof (data, \"Input domain encoded as `%s'\\n\",\r\n           stringprep_locale_charset ());\r\n    if(rc != IDNA_SUCCESS)\r\n      infof(data, \"Failed to convert %s to ACE; %s\\n\",\r\n            host->name, Curl_idn_strerror(conn,rc));\r\n    else {\r\n      /* tld_check_name() displays a warning if the host name contains\r\n         \"illegal\" characters for this TLD */\r\n      (void)tld_check_name(data, ace_hostname);\r\n\r\n      host->encalloc = ace_hostname;\r\n      /* change the name pointer to point to the encoded hostname */\r\n      host->name = host->encalloc;\r\n    }\r\n  }\r\n#elif defined(USE_WIN32_IDN)\r\n  /*************************************************************\r\n   * Check name for non-ASCII and convert hostname to ACE form.\r\n   *************************************************************/\r\n    char *ace_hostname = NULL;\r\n    int rc = curl_win32_idn_to_ascii(host->name, &ace_hostname);\r\n    if(rc == 0)\r\n      infof(data, \"Failed to convert %s to ACE;\\n\",\r\n            host->name);\r\n    else {\r\n      host->encalloc = ace_hostname;\r\n      /* change the name pointer to point to the encoded hostname */\r\n      host->name = host->encalloc;\r\n    }\r\n#else\r\n    infof(data, \"IDN support not present, can't parse Unicode domains\\n\");\r\n#endif\r\n  }\r\n}\r\n\r\nstatic void llist_dtor(void *user, void *element)\r\n{\r\n  (void)user;\r\n  (void)element;\r\n  /* Do nothing */\r\n}\r\n\r\n/*\r\n * Allocate and initialize a new connectdata object.\r\n */\r\nstatic struct connectdata *allocate_conn(struct SessionHandle *data)\r\n{\r\n  struct connectdata *conn = calloc(1, sizeof(struct connectdata));\r\n  if(!conn)\r\n    return NULL;\r\n\r\n  conn->handler = &Curl_handler_dummy;  /* Be sure we have a handler defined\r\n                                           already from start to avoid NULL\r\n                                           situations and checks */\r\n\r\n  /* and we setup a few fields in case we end up actually using this struct */\r\n\r\n  conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD;     /* no file descriptor */\r\n  conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */\r\n  conn->connection_id = -1;    /* no ID */\r\n  conn->port = -1; /* unknown at this point */\r\n\r\n  /* Default protocol-independent behavior doesn't support persistent\r\n     connections, so we set this to force-close. Protocols that support\r\n     this need to set this to FALSE in their \"curl_do\" functions. */\r\n  conn->bits.close = TRUE;\r\n\r\n  /* Store creation time to help future close decision making */\r\n  conn->created = Curl_tvnow();\r\n\r\n  conn->data = data; /* Setup the association between this connection\r\n                        and the SessionHandle */\r\n\r\n  conn->proxytype = data->set.proxytype; /* type */\r\n\r\n#ifdef CURL_DISABLE_PROXY\r\n\r\n  conn->bits.proxy = FALSE;\r\n  conn->bits.httpproxy = FALSE;\r\n  conn->bits.proxy_user_passwd = FALSE;\r\n  conn->bits.tunnel_proxy = FALSE;\r\n\r\n#else /* CURL_DISABLE_PROXY */\r\n\r\n  /* note that these two proxy bits are now just on what looks to be\r\n     requested, they may be altered down the road */\r\n  conn->bits.proxy = (data->set.str[STRING_PROXY] &&\r\n                      *data->set.str[STRING_PROXY])?TRUE:FALSE;\r\n  conn->bits.httpproxy = (conn->bits.proxy &&\r\n                          (conn->proxytype == CURLPROXY_HTTP ||\r\n                           conn->proxytype == CURLPROXY_HTTP_1_0))?TRUE:FALSE;\r\n  conn->bits.proxy_user_passwd =\r\n    (NULL != data->set.str[STRING_PROXYUSERNAME])?TRUE:FALSE;\r\n  conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;\r\n\r\n#endif /* CURL_DISABLE_PROXY */\r\n\r\n  conn->bits.user_passwd = (NULL != data->set.str[STRING_USERNAME])?TRUE:FALSE;\r\n  conn->bits.ftp_use_epsv = data->set.ftp_use_epsv;\r\n  conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;\r\n\r\n  conn->verifypeer = data->set.ssl.verifypeer;\r\n  conn->verifyhost = data->set.ssl.verifyhost;\r\n\r\n  conn->ip_version = data->set.ipver;\r\n\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n  conn->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;\r\n  conn->ntlm_auth_hlpr_pid = 0;\r\n  conn->challenge_header = NULL;\r\n  conn->response_header = NULL;\r\n#endif\r\n\r\n  if(data->multi && Curl_multi_canPipeline(data->multi) &&\r\n      !conn->master_buffer) {\r\n    /* Allocate master_buffer to be used for pipelining */\r\n    conn->master_buffer = calloc(BUFSIZE, sizeof (char));\r\n    if(!conn->master_buffer)\r\n      goto error;\r\n  }\r\n\r\n  /* Initialize the pipeline lists */\r\n  conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);\r\n  conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);\r\n  conn->pend_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);\r\n  conn->done_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);\r\n  if(!conn->send_pipe || !conn->recv_pipe || !conn->pend_pipe ||\r\n     !conn->done_pipe)\r\n    goto error;\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  conn->data_prot = PROT_CLEAR;\r\n#endif\r\n\r\n  /* Store the local bind parameters that will be used for this connection */\r\n  if(data->set.str[STRING_DEVICE]) {\r\n    conn->localdev = strdup(data->set.str[STRING_DEVICE]);\r\n    if(!conn->localdev)\r\n      goto error;\r\n  }\r\n  conn->localportrange = data->set.localportrange;\r\n  conn->localport = data->set.localport;\r\n\r\n  /* the close socket stuff needs to be copied to the connection struct as\r\n     it may live on without (this specific) SessionHandle */\r\n  conn->fclosesocket = data->set.fclosesocket;\r\n  conn->closesocket_client = data->set.closesocket_client;\r\n\r\n  return conn;\r\n  error:\r\n\r\n  Curl_llist_destroy(conn->send_pipe, NULL);\r\n  Curl_llist_destroy(conn->recv_pipe, NULL);\r\n  Curl_llist_destroy(conn->pend_pipe, NULL);\r\n  Curl_llist_destroy(conn->done_pipe, NULL);\r\n\r\n  conn->send_pipe = NULL;\r\n  conn->recv_pipe = NULL;\r\n  conn->pend_pipe = NULL;\r\n  conn->done_pipe = NULL;\r\n\r\n  Curl_safefree(conn->master_buffer);\r\n  Curl_safefree(conn->localdev);\r\n  Curl_safefree(conn);\r\n  return NULL;\r\n}\r\n\r\nstatic CURLcode findprotocol(struct SessionHandle *data,\r\n                             struct connectdata *conn,\r\n                             const char *protostr)\r\n{\r\n  const struct Curl_handler * const *pp;\r\n  const struct Curl_handler *p;\r\n\r\n  /* Scan protocol handler table and match against 'protostr' to set a few\r\n     variables based on the URL. Now that the handler may be changed later\r\n     when the protocol specific setup function is called. */\r\n  for(pp = protocols; (p = *pp) != NULL; pp++) {\r\n    if(Curl_raw_equal(p->scheme, protostr)) {\r\n      /* Protocol found in table. Check if allowed */\r\n      if(!(data->set.allowed_protocols & p->protocol))\r\n        /* nope, get out */\r\n        break;\r\n\r\n      /* it is allowed for \"normal\" request, now do an extra check if this is\r\n         the result of a redirect */\r\n      if(data->state.this_is_a_follow &&\r\n         !(data->set.redir_protocols & p->protocol))\r\n        /* nope, get out */\r\n        break;\r\n\r\n      /* Perform setup complement if some. */\r\n      conn->handler = conn->given = p;\r\n\r\n      /* 'port' and 'remote_port' are set in setup_connection_internals() */\r\n      return CURLE_OK;\r\n    }\r\n  }\r\n\r\n\r\n  /* The protocol was not found in the table, but we don't have to assign it\r\n     to anything since it is already assigned to a dummy-struct in the\r\n     create_conn() function when the connectdata struct is allocated. */\r\n  failf(data, \"Protocol %s not supported or disabled in \" LIBCURL_NAME,\r\n        protostr);\r\n\r\n  return CURLE_UNSUPPORTED_PROTOCOL;\r\n}\r\n\r\n/*\r\n * Parse URL and fill in the relevant members of the connection struct.\r\n */\r\nstatic CURLcode parseurlandfillconn(struct SessionHandle *data,\r\n                                    struct connectdata *conn,\r\n                                    bool *prot_missing,\r\n                                    char *user,\r\n                                    char *passwd)\r\n{\r\n  char *at;\r\n  char *fragment;\r\n  char *path = data->state.path;\r\n  char *query;\r\n  int rc;\r\n  char protobuf[16];\r\n  const char *protop;\r\n  CURLcode result;\r\n\r\n  *prot_missing = FALSE;\r\n\r\n  /*************************************************************\r\n   * Parse the URL.\r\n   *\r\n   * We need to parse the url even when using the proxy, because we will need\r\n   * the hostname and port in case we are trying to SSL connect through the\r\n   * proxy -- and we don't know if we will need to use SSL until we parse the\r\n   * url ...\r\n   ************************************************************/\r\n  if((2 == sscanf(data->change.url, \"%15[^:]:%[^\\n]\",\r\n                  protobuf, path)) &&\r\n     Curl_raw_equal(protobuf, \"file\")) {\r\n    if(path[0] == '/' && path[1] == '/') {\r\n      /* Allow omitted hostname (e.g. file:/<path>).  This is not strictly\r\n       * speaking a valid file: URL by RFC 1738, but treating file:/<path> as\r\n       * file://localhost/<path> is similar to how other schemes treat missing\r\n       * hostnames.  See RFC 1808. */\r\n\r\n      /* This cannot be done with strcpy() in a portable manner, since the\r\n         memory areas overlap! */\r\n      memmove(path, path + 2, strlen(path + 2)+1);\r\n    }\r\n    /*\r\n     * we deal with file://<host>/<path> differently since it supports no\r\n     * hostname other than \"localhost\" and \"127.0.0.1\", which is unique among\r\n     * the URL protocols specified in RFC 1738\r\n     */\r\n    if(path[0] != '/') {\r\n      /* the URL included a host name, we ignore host names in file:// URLs\r\n         as the standards don't define what to do with them */\r\n      char *ptr=strchr(path, '/');\r\n      if(ptr) {\r\n        /* there was a slash present\r\n\r\n           RFC1738 (section 3.1, page 5) says:\r\n\r\n           The rest of the locator consists of data specific to the scheme,\r\n           and is known as the \"url-path\". It supplies the details of how the\r\n           specified resource can be accessed. Note that the \"/\" between the\r\n           host (or port) and the url-path is NOT part of the url-path.\r\n\r\n           As most agents use file://localhost/foo to get '/foo' although the\r\n           slash preceding foo is a separator and not a slash for the path,\r\n           a URL as file://localhost//foo must be valid as well, to refer to\r\n           the same file with an absolute path.\r\n        */\r\n\r\n        if(ptr[1] && ('/' == ptr[1]))\r\n          /* if there was two slashes, we skip the first one as that is then\r\n             used truly as a separator */\r\n          ptr++;\r\n\r\n        /* This cannot be made with strcpy, as the memory chunks overlap! */\r\n        memmove(path, ptr, strlen(ptr)+1);\r\n      }\r\n    }\r\n\r\n    protop = \"file\"; /* protocol string */\r\n  }\r\n  else {\r\n    /* clear path */\r\n    path[0]=0;\r\n\r\n    if(2 > sscanf(data->change.url,\r\n                   \"%15[^\\n:]://%[^\\n/?]%[^\\n]\",\r\n                   protobuf,\r\n                   conn->host.name, path)) {\r\n\r\n      /*\r\n       * The URL was badly formatted, let's try the browser-style _without_\r\n       * protocol specified like 'http://'.\r\n       */\r\n      rc = sscanf(data->change.url, \"%[^\\n/?]%[^\\n]\", conn->host.name, path);\r\n      if(1 > rc) {\r\n        /*\r\n         * We couldn't even get this format.\r\n         * djgpp 2.04 has a sscanf() bug where 'conn->host.name' is\r\n         * assigned, but the return value is EOF!\r\n         */\r\n#if defined(__DJGPP__) && (DJGPP_MINOR == 4)\r\n        if(!(rc == -1 && *conn->host.name))\r\n#endif\r\n        {\r\n          failf(data, \"<url> malformed\");\r\n          return CURLE_URL_MALFORMAT;\r\n        }\r\n      }\r\n\r\n      /*\r\n       * Since there was no protocol part specified, we guess what protocol it\r\n       * is based on the first letters of the server name.\r\n       */\r\n\r\n      /* Note: if you add a new protocol, please update the list in\r\n       * lib/version.c too! */\r\n\r\n      if(checkprefix(\"FTP.\", conn->host.name))\r\n        protop = \"ftp\";\r\n      else if(checkprefix(\"DICT.\", conn->host.name))\r\n        protop = \"DICT\";\r\n      else if(checkprefix(\"LDAP.\", conn->host.name))\r\n        protop = \"LDAP\";\r\n      else if(checkprefix(\"IMAP.\", conn->host.name))\r\n        protop = \"IMAP\";\r\n      else {\r\n        protop = \"http\";\r\n      }\r\n\r\n      *prot_missing = TRUE; /* not given in URL */\r\n    }\r\n    else\r\n      protop = protobuf;\r\n  }\r\n\r\n  /* We search for '?' in the host name (but only on the right side of a\r\n   * @-letter to allow ?-letters in username and password) to handle things\r\n   * like http://example.com?param= (notice the missing '/').\r\n   */\r\n  at = strchr(conn->host.name, '@');\r\n  if(at)\r\n    query = strchr(at+1, '?');\r\n  else\r\n    query = strchr(conn->host.name, '?');\r\n\r\n  if(query) {\r\n    /* We must insert a slash before the '?'-letter in the URL. If the URL had\r\n       a slash after the '?', that is where the path currently begins and the\r\n       '?string' is still part of the host name.\r\n\r\n       We must move the trailing part from the host name and put it first in\r\n       the path. And have it all prefixed with a slash.\r\n    */\r\n\r\n    size_t hostlen = strlen(query);\r\n    size_t pathlen = strlen(path);\r\n\r\n    /* move the existing path plus the zero byte forward, to make room for\r\n       the host-name part */\r\n    memmove(path+hostlen+1, path, pathlen+1);\r\n\r\n     /* now copy the trailing host part in front of the existing path */\r\n    memcpy(path+1, query, hostlen);\r\n\r\n    path[0]='/'; /* prepend the missing slash */\r\n\r\n    *query=0; /* now cut off the hostname at the ? */\r\n  }\r\n  else if(!path[0]) {\r\n    /* if there's no path set, use a single slash */\r\n    strcpy(path, \"/\");\r\n  }\r\n\r\n  /* If the URL is malformatted (missing a '/' after hostname before path) we\r\n   * insert a slash here. The only letter except '/' we accept to start a path\r\n   * is '?'.\r\n   */\r\n  if(path[0] == '?') {\r\n    /* We need this function to deal with overlapping memory areas. We know\r\n       that the memory area 'path' points to is 'urllen' bytes big and that\r\n       is bigger than the path. Use +1 to move the zero byte too. */\r\n    memmove(&path[1], path, strlen(path)+1);\r\n    path[0] = '/';\r\n  }\r\n\r\n  /*************************************************************\r\n   * Parse a user name and password in the URL and strip it out\r\n   * of the host name\r\n   *************************************************************/\r\n  result = parse_url_userpass(data, conn, user, passwd);\r\n  if(result != CURLE_OK)\r\n    return result;\r\n\r\n  if(conn->host.name[0] == '[') {\r\n    /* This looks like an IPv6 address literal.  See if there is an address\r\n       scope.  */\r\n    char *percent = strstr (conn->host.name, \"%25\");\r\n    if(percent) {\r\n      char *endp;\r\n      unsigned long scope = strtoul (percent + 3, &endp, 10);\r\n      if(*endp == ']') {\r\n        /* The address scope was well formed.  Knock it out of the\r\n           hostname. */\r\n        memmove(percent, endp, strlen(endp)+1);\r\n        if(!data->state.this_is_a_follow)\r\n          /* Don't honour a scope given in a Location: header */\r\n          conn->scope = (unsigned int)scope;\r\n      }\r\n      else\r\n        infof(data, \"Invalid IPv6 address format\\n\");\r\n    }\r\n  }\r\n\r\n  if(data->set.scope)\r\n    /* Override any scope that was set above.  */\r\n    conn->scope = data->set.scope;\r\n\r\n  /* Remove the fragment part of the path. Per RFC 2396, this is always the\r\n     last part of the URI. We are looking for the first '#' so that we deal\r\n     gracefully with non conformant URI such as http://example.com#foo#bar. */\r\n  fragment = strchr(path, '#');\r\n  if(fragment) {\r\n    *fragment = 0;\r\n\r\n    /* we know the path part ended with a fragment, so we know the full URL\r\n       string does too and we need to cut it off from there so it isn't used\r\n       over proxy */\r\n    fragment = strchr(data->change.url, '#');\r\n    if(fragment)\r\n      *fragment = 0;\r\n  }\r\n\r\n  /*\r\n   * So if the URL was A://B/C#D,\r\n   *   protop is A\r\n   *   conn->host.name is B\r\n   *   data->state.path is /C\r\n   */\r\n\r\n  return findprotocol(data, conn, protop);\r\n}\r\n\r\n/*\r\n * If we're doing a resumed transfer, we need to setup our stuff\r\n * properly.\r\n */\r\nstatic CURLcode setup_range(struct SessionHandle *data)\r\n{\r\n  struct UrlState *s = &data->state;\r\n  s->resume_from = data->set.set_resume_from;\r\n  if(s->resume_from || data->set.str[STRING_SET_RANGE]) {\r\n    if(s->rangestringalloc)\r\n      free(s->range);\r\n\r\n    if(s->resume_from)\r\n      s->range = aprintf(\"%\" FORMAT_OFF_TU \"-\", s->resume_from);\r\n    else\r\n      s->range = strdup(data->set.str[STRING_SET_RANGE]);\r\n\r\n    s->rangestringalloc = (s->range)?TRUE:FALSE;\r\n\r\n    if(!s->range)\r\n      return CURLE_OUT_OF_MEMORY;\r\n\r\n    /* tell ourselves to fetch this range */\r\n    s->use_range = TRUE;        /* enable range download */\r\n  }\r\n  else\r\n    s->use_range = FALSE; /* disable range download */\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n\r\n/***************************************************************\r\n* Setup connection internals specific to the requested protocol.\r\n* This MUST get called after proxy magic has been figured out.\r\n***************************************************************/\r\nstatic CURLcode setup_connection_internals(struct connectdata *conn)\r\n{\r\n  const struct Curl_handler * p;\r\n  CURLcode result;\r\n\r\n  conn->socktype = SOCK_STREAM; /* most of them are TCP streams */\r\n\r\n  /* Scan protocol handler table. */\r\n\r\n  /* Perform setup complement if some. */\r\n  p = conn->handler;\r\n\r\n  if(p->setup_connection) {\r\n    result = (*p->setup_connection)(conn);\r\n\r\n    if(result != CURLE_OK)\r\n      return result;\r\n\r\n    p = conn->handler;              /* May have changed. */\r\n  }\r\n\r\n  if(conn->port < 0)\r\n    /* we check for -1 here since if proxy was detected already, this\r\n       was very likely already set to the proxy port */\r\n    conn->port = p->defport;\r\n  conn->remote_port = (unsigned short)conn->given->defport;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n/****************************************************************\r\n* Checks if the host is in the noproxy list. returns true if it matches\r\n* and therefore the proxy should NOT be used.\r\n****************************************************************/\r\nstatic bool check_noproxy(const char* name, const char* no_proxy)\r\n{\r\n  /* no_proxy=domain1.dom,host.domain2.dom\r\n   *   (a comma-separated list of hosts which should\r\n   *   not be proxied, or an asterisk to override\r\n   *   all proxy variables)\r\n   */\r\n  size_t tok_start;\r\n  size_t tok_end;\r\n  const char* separator = \", \";\r\n  size_t no_proxy_len;\r\n  size_t namelen;\r\n  char *endptr;\r\n\r\n  if(no_proxy && no_proxy[0]) {\r\n    if(Curl_raw_equal(\"*\", no_proxy)) {\r\n      return TRUE;\r\n    }\r\n\r\n    /* NO_PROXY was specified and it wasn't just an asterisk */\r\n\r\n    no_proxy_len = strlen(no_proxy);\r\n    endptr = strchr(name, ':');\r\n    if(endptr)\r\n      namelen = endptr - name;\r\n    else\r\n      namelen = strlen(name);\r\n\r\n    for(tok_start = 0; tok_start < no_proxy_len; tok_start = tok_end + 1) {\r\n      while(tok_start < no_proxy_len &&\r\n            strchr(separator, no_proxy[tok_start]) != NULL) {\r\n        /* Look for the beginning of the token. */\r\n        ++tok_start;\r\n      }\r\n\r\n      if(tok_start == no_proxy_len)\r\n        break; /* It was all trailing separator chars, no more tokens. */\r\n\r\n      for(tok_end = tok_start; tok_end < no_proxy_len &&\r\n            strchr(separator, no_proxy[tok_end]) == NULL; ++tok_end)\r\n        /* Look for the end of the token. */\r\n        ;\r\n\r\n      /* To match previous behaviour, where it was necessary to specify\r\n       * \".local.com\" to prevent matching \"notlocal.com\", we will leave\r\n       * the '.' off.\r\n       */\r\n      if(no_proxy[tok_start] == '.')\r\n        ++tok_start;\r\n\r\n      if((tok_end - tok_start) <= namelen) {\r\n        /* Match the last part of the name to the domain we are checking. */\r\n        const char *checkn = name + namelen - (tok_end - tok_start);\r\n        if(Curl_raw_nequal(no_proxy + tok_start, checkn,\r\n                           tok_end - tok_start)) {\r\n          if((tok_end - tok_start) == namelen || *(checkn - 1) == '.') {\r\n            /* We either have an exact match, or the previous character is a .\r\n             * so it is within the same domain, so no proxy for this host.\r\n             */\r\n            return TRUE;\r\n          }\r\n        }\r\n      } /* if((tok_end - tok_start) <= namelen) */\r\n    } /* for(tok_start = 0; tok_start < no_proxy_len;\r\n         tok_start = tok_end + 1) */\r\n  } /* NO_PROXY was specified and it wasn't just an asterisk */\r\n\r\n  return FALSE;\r\n}\r\n\r\n/****************************************************************\r\n* Detect what (if any) proxy to use. Remember that this selects a host\r\n* name and is not limited to HTTP proxies only.\r\n* The returned pointer must be freed by the caller (unless NULL)\r\n****************************************************************/\r\nstatic char *detect_proxy(struct connectdata *conn)\r\n{\r\n  char *proxy = NULL;\r\n\r\n#ifndef CURL_DISABLE_HTTP\r\n  /* If proxy was not specified, we check for default proxy environment\r\n   * variables, to enable i.e Lynx compliance:\r\n   *\r\n   * http_proxy=http://some.server.dom:port/\r\n   * https_proxy=http://some.server.dom:port/\r\n   * ftp_proxy=http://some.server.dom:port/\r\n   * no_proxy=domain1.dom,host.domain2.dom\r\n   *   (a comma-separated list of hosts which should\r\n   *   not be proxied, or an asterisk to override\r\n   *   all proxy variables)\r\n   * all_proxy=http://some.server.dom:port/\r\n   *   (seems to exist for the CERN www lib. Probably\r\n   *   the first to check for.)\r\n   *\r\n   * For compatibility, the all-uppercase versions of these variables are\r\n   * checked if the lowercase versions don't exist.\r\n   */\r\n  char *no_proxy=NULL;\r\n  char proxy_env[128];\r\n\r\n  no_proxy=curl_getenv(\"no_proxy\");\r\n  if(!no_proxy)\r\n    no_proxy=curl_getenv(\"NO_PROXY\");\r\n\r\n  if(!check_noproxy(conn->host.name, no_proxy)) {\r\n    /* It was not listed as without proxy */\r\n    const char *protop = conn->handler->scheme;\r\n    char *envp = proxy_env;\r\n    char *prox;\r\n\r\n    /* Now, build <protocol>_proxy and check for such a one to use */\r\n    while(*protop)\r\n      *envp++ = (char)tolower((int)*protop++);\r\n\r\n    /* append _proxy */\r\n    strcpy(envp, \"_proxy\");\r\n\r\n    /* read the protocol proxy: */\r\n    prox=curl_getenv(proxy_env);\r\n\r\n    /*\r\n     * We don't try the uppercase version of HTTP_PROXY because of\r\n     * security reasons:\r\n     *\r\n     * When curl is used in a webserver application\r\n     * environment (cgi or php), this environment variable can\r\n     * be controlled by the web server user by setting the\r\n     * http header 'Proxy:' to some value.\r\n     *\r\n     * This can cause 'internal' http/ftp requests to be\r\n     * arbitrarily redirected by any external attacker.\r\n     */\r\n    if(!prox && !Curl_raw_equal(\"http_proxy\", proxy_env)) {\r\n      /* There was no lowercase variable, try the uppercase version: */\r\n      Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));\r\n      prox=curl_getenv(proxy_env);\r\n    }\r\n\r\n    if(prox && *prox) { /* don't count \"\" strings */\r\n      proxy = prox; /* use this */\r\n    }\r\n    else {\r\n      proxy = curl_getenv(\"all_proxy\"); /* default proxy to use */\r\n      if(!proxy)\r\n        proxy=curl_getenv(\"ALL_PROXY\");\r\n    }\r\n  } /* if(!check_noproxy(conn->host.name, no_proxy)) - it wasn't specified\r\n       non-proxy */\r\n  if(no_proxy)\r\n    free(no_proxy);\r\n\r\n#else /* !CURL_DISABLE_HTTP */\r\n\r\n  (void)conn;\r\n#endif /* CURL_DISABLE_HTTP */\r\n\r\n  return proxy;\r\n}\r\n\r\n/*\r\n * If this is supposed to use a proxy, we need to figure out the proxy\r\n * host name, so that we can re-use an existing connection\r\n * that may exist registered to the same proxy host.\r\n * proxy will be freed before this function returns.\r\n */\r\nstatic CURLcode parse_proxy(struct SessionHandle *data,\r\n                            struct connectdata *conn, char *proxy)\r\n{\r\n  char *prox_portno;\r\n  char *endofprot;\r\n\r\n  /* We use 'proxyptr' to point to the proxy name from now on... */\r\n  char *proxyptr;\r\n  char *portptr;\r\n  char *atsign;\r\n\r\n  /* We do the proxy host string parsing here. We want the host name and the\r\n   * port name. Accept a protocol:// prefix\r\n   */\r\n\r\n  /* Parse the protocol part if present */\r\n  endofprot = strstr(proxy, \"://\");\r\n  if(endofprot) {\r\n    proxyptr = endofprot+3;\r\n    if(checkprefix(\"socks5h\", proxy))\r\n      conn->proxytype = CURLPROXY_SOCKS5_HOSTNAME;\r\n    else if(checkprefix(\"socks5\", proxy))\r\n      conn->proxytype = CURLPROXY_SOCKS5;\r\n    else if(checkprefix(\"socks4a\", proxy))\r\n      conn->proxytype = CURLPROXY_SOCKS4A;\r\n    else if(checkprefix(\"socks4\", proxy) || checkprefix(\"socks\", proxy))\r\n      conn->proxytype = CURLPROXY_SOCKS4;\r\n    /* Any other xxx:// : change to http proxy */\r\n  }\r\n  else\r\n    proxyptr = proxy; /* No xxx:// head: It's a HTTP proxy */\r\n\r\n  /* Is there a username and password given in this proxy url? */\r\n  atsign = strchr(proxyptr, '@');\r\n  if(atsign) {\r\n    char proxyuser[MAX_CURL_USER_LENGTH];\r\n    char proxypasswd[MAX_CURL_PASSWORD_LENGTH];\r\n    proxypasswd[0] = 0;\r\n\r\n    if(1 <= sscanf(proxyptr,\r\n                   \"%\" MAX_CURL_USER_LENGTH_TXT\"[^:@]:\"\r\n                   \"%\" MAX_CURL_PASSWORD_LENGTH_TXT \"[^@]\",\r\n                   proxyuser, proxypasswd)) {\r\n      CURLcode res = CURLE_OK;\r\n\r\n      /* found user and password, rip them out.  note that we are\r\n         unescaping them, as there is otherwise no way to have a\r\n         username or password with reserved characters like ':' in\r\n         them. */\r\n      Curl_safefree(conn->proxyuser);\r\n      conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL);\r\n\r\n      if(!conn->proxyuser)\r\n        res = CURLE_OUT_OF_MEMORY;\r\n      else {\r\n        Curl_safefree(conn->proxypasswd);\r\n        conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL);\r\n\r\n        if(!conn->proxypasswd)\r\n          res = CURLE_OUT_OF_MEMORY;\r\n      }\r\n\r\n      if(CURLE_OK == res) {\r\n        conn->bits.proxy_user_passwd = TRUE; /* enable it */\r\n        atsign++; /* the right side of the @-letter */\r\n\r\n        if(atsign)\r\n          proxyptr = atsign; /* now use this instead */\r\n        else\r\n          res = CURLE_OUT_OF_MEMORY;\r\n      }\r\n\r\n      if(res)\r\n        return res;\r\n    }\r\n  }\r\n\r\n  /* start scanning for port number at this point */\r\n  portptr = proxyptr;\r\n\r\n  /* detect and extract RFC2732-style IPv6-addresses */\r\n  if(*proxyptr == '[') {\r\n    char *ptr = ++proxyptr; /* advance beyond the initial bracket */\r\n    while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '%') ||\r\n                   (*ptr == '.')))\r\n      ptr++;\r\n    if(*ptr == ']')\r\n      /* yeps, it ended nicely with a bracket as well */\r\n      *ptr++ = 0;\r\n    else\r\n      infof(data, \"Invalid IPv6 address format\\n\");\r\n    portptr = ptr;\r\n    /* Note that if this didn't end with a bracket, we still advanced the\r\n     * proxyptr first, but I can't see anything wrong with that as no host\r\n     * name nor a numeric can legally start with a bracket.\r\n     */\r\n  }\r\n\r\n  /* Get port number off proxy.server.com:1080 */\r\n  prox_portno = strchr(portptr, ':');\r\n  if(prox_portno) {\r\n    *prox_portno = 0x0; /* cut off number from host name */\r\n    prox_portno ++;\r\n    /* now set the local port number */\r\n    conn->port = strtol(prox_portno, NULL, 10);\r\n  }\r\n  else {\r\n    if(proxyptr[0]=='/')\r\n      /* If the first character in the proxy string is a slash, fail\r\n         immediately. The following code will otherwise clear the string which\r\n         will lead to code running as if no proxy was set! */\r\n      return CURLE_COULDNT_RESOLVE_PROXY;\r\n\r\n    /* without a port number after the host name, some people seem to use\r\n       a slash so we strip everything from the first slash */\r\n    atsign = strchr(proxyptr, '/');\r\n    if(atsign)\r\n      *atsign = 0x0; /* cut off path part from host name */\r\n\r\n    if(data->set.proxyport)\r\n      /* None given in the proxy string, then get the default one if it is\r\n         given */\r\n      conn->port = data->set.proxyport;\r\n  }\r\n\r\n  /* now, clone the cleaned proxy host name */\r\n  conn->proxy.rawalloc = strdup(proxyptr);\r\n  conn->proxy.name = conn->proxy.rawalloc;\r\n\r\n  if(!conn->proxy.rawalloc)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Extract the user and password from the authentication string\r\n */\r\nstatic CURLcode parse_proxy_auth(struct SessionHandle *data,\r\n                                 struct connectdata *conn)\r\n{\r\n  char proxyuser[MAX_CURL_USER_LENGTH]=\"\";\r\n  char proxypasswd[MAX_CURL_PASSWORD_LENGTH]=\"\";\r\n\r\n  if(data->set.str[STRING_PROXYUSERNAME] != NULL) {\r\n    strncpy(proxyuser, data->set.str[STRING_PROXYUSERNAME],\r\n            MAX_CURL_USER_LENGTH);\r\n    proxyuser[MAX_CURL_USER_LENGTH-1] = '\\0';   /*To be on safe side*/\r\n  }\r\n  if(data->set.str[STRING_PROXYPASSWORD] != NULL) {\r\n    strncpy(proxypasswd, data->set.str[STRING_PROXYPASSWORD],\r\n            MAX_CURL_PASSWORD_LENGTH);\r\n    proxypasswd[MAX_CURL_PASSWORD_LENGTH-1] = '\\0'; /*To be on safe side*/\r\n  }\r\n\r\n  conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL);\r\n  if(!conn->proxyuser)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL);\r\n  if(!conn->proxypasswd)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  return CURLE_OK;\r\n}\r\n#endif /* CURL_DISABLE_PROXY */\r\n\r\n/*\r\n *\r\n * Parse a user name and password in the URL and strip it out of the host name\r\n *\r\n * Inputs: data->set.use_netrc (CURLOPT_NETRC)\r\n *         conn->host.name\r\n *\r\n * Outputs: (almost :- all currently undefined)\r\n *          conn->bits.user_passwd  - non-zero if non-default passwords exist\r\n *          user                    - non-zero length if defined\r\n *          passwd                  -   ditto\r\n *          conn->host.name         - remove user name and password\r\n */\r\nstatic CURLcode parse_url_userpass(struct SessionHandle *data,\r\n                                   struct connectdata *conn,\r\n                                   char *user, char *passwd)\r\n{\r\n  /* At this point, we're hoping all the other special cases have\r\n   * been taken care of, so conn->host.name is at most\r\n   *    [user[:password]]@]hostname\r\n   *\r\n   * We need somewhere to put the embedded details, so do that first.\r\n   */\r\n\r\n  char *ptr=strchr(conn->host.name, '@');\r\n  char *userpass = conn->host.name;\r\n\r\n  user[0] =0;   /* to make everything well-defined */\r\n  passwd[0]=0;\r\n\r\n  /* We will now try to extract the\r\n   * possible user+password pair in a string like:\r\n   * ftp://user:password@ftp.my.site:8021/README */\r\n  if(ptr != NULL) {\r\n    /* there's a user+password given here, to the left of the @ */\r\n\r\n    conn->host.name = ++ptr;\r\n\r\n    /* So the hostname is sane.  Only bother interpreting the\r\n     * results if we could care.  It could still be wasted\r\n     * work because it might be overtaken by the programmatically\r\n     * set user/passwd, but doing that first adds more cases here :-(\r\n     */\r\n\r\n    conn->bits.userpwd_in_url = TRUE;\r\n    if(data->set.use_netrc != CURL_NETRC_REQUIRED) {\r\n      /* We could use the one in the URL */\r\n\r\n      conn->bits.user_passwd = TRUE; /* enable user+password */\r\n\r\n      if(*userpass != ':') {\r\n        /* the name is given, get user+password */\r\n        sscanf(userpass, \"%\" MAX_CURL_USER_LENGTH_TXT \"[^:@]:\"\r\n               \"%\" MAX_CURL_PASSWORD_LENGTH_TXT \"[^@]\",\r\n               user, passwd);\r\n      }\r\n      else\r\n        /* no name given, get the password only */\r\n        sscanf(userpass, \":%\" MAX_CURL_PASSWORD_LENGTH_TXT \"[^@]\", passwd);\r\n\r\n      if(user[0]) {\r\n        char *newname=curl_easy_unescape(data, user, 0, NULL);\r\n        if(!newname)\r\n          return CURLE_OUT_OF_MEMORY;\r\n        if(strlen(newname) < MAX_CURL_USER_LENGTH)\r\n          strcpy(user, newname);\r\n\r\n        /* if the new name is longer than accepted, then just use\r\n           the unconverted name, it'll be wrong but what the heck */\r\n        free(newname);\r\n      }\r\n      if(passwd[0]) {\r\n        /* we have a password found in the URL, decode it! */\r\n        char *newpasswd=curl_easy_unescape(data, passwd, 0, NULL);\r\n        if(!newpasswd)\r\n          return CURLE_OUT_OF_MEMORY;\r\n        if(strlen(newpasswd) < MAX_CURL_PASSWORD_LENGTH)\r\n          strcpy(passwd, newpasswd);\r\n\r\n        free(newpasswd);\r\n      }\r\n    }\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n/*************************************************************\r\n * Figure out the remote port number and fix it in the URL\r\n *\r\n * No matter if we use a proxy or not, we have to figure out the remote\r\n * port number of various reasons.\r\n *\r\n * To be able to detect port number flawlessly, we must not confuse them\r\n * IPv6-specified addresses in the [0::1] style. (RFC2732)\r\n *\r\n * The conn->host.name is currently [user:passwd@]host[:port] where host\r\n * could be a hostname, IPv4 address or IPv6 address.\r\n *\r\n * The port number embedded in the URL is replaced, if necessary.\r\n *************************************************************/\r\nstatic CURLcode parse_remote_port(struct SessionHandle *data,\r\n                                  struct connectdata *conn)\r\n{\r\n  char *portptr;\r\n  char endbracket;\r\n\r\n  /* Note that at this point, the IPv6 address cannot contain any scope\r\n     suffix as that has already been removed in the parseurlandfillconn()\r\n     function */\r\n  if((1 == sscanf(conn->host.name, \"[%*45[0123456789abcdefABCDEF:.]%c\",\r\n                  &endbracket)) &&\r\n     (']' == endbracket)) {\r\n    /* this is a RFC2732-style specified IP-address */\r\n    conn->bits.ipv6_ip = TRUE;\r\n\r\n    conn->host.name++; /* skip over the starting bracket */\r\n    portptr = strchr(conn->host.name, ']');\r\n    if(portptr) {\r\n      *portptr++ = '\\0'; /* zero terminate, killing the bracket */\r\n      if(':' != *portptr)\r\n        portptr = NULL; /* no port number available */\r\n    }\r\n  }\r\n  else {\r\n#ifdef ENABLE_IPV6\r\n    struct in6_addr in6;\r\n    if(Curl_inet_pton(AF_INET6, conn->host.name, &in6) > 0) {\r\n      /* This is a numerical IPv6 address, meaning this is a wrongly formatted\r\n         URL */\r\n      failf(data, \"IPv6 numerical address used in URL without brackets\");\r\n      return CURLE_URL_MALFORMAT;\r\n    }\r\n#endif\r\n\r\n    portptr = strrchr(conn->host.name, ':');\r\n  }\r\n\r\n  if(data->set.use_port && data->state.allow_port) {\r\n    /* if set, we use this and ignore the port possibly given in the URL */\r\n    conn->remote_port = (unsigned short)data->set.use_port;\r\n    if(portptr)\r\n      *portptr = '\\0'; /* cut off the name there anyway - if there was a port\r\n                      number - since the port number is to be ignored! */\r\n    if(conn->bits.httpproxy) {\r\n      /* we need to create new URL with the new port number */\r\n      char *url;\r\n      char type[12]=\"\";\r\n\r\n      if(conn->bits.type_set)\r\n        snprintf(type, sizeof(type), \";type=%c\",\r\n                 data->set.prefer_ascii?'A':\r\n                 (data->set.ftp_list_only?'D':'I'));\r\n\r\n      /*\r\n       * This synthesized URL isn't always right--suffixes like ;type=A are\r\n       * stripped off. It would be better to work directly from the original\r\n       * URL and simply replace the port part of it.\r\n       */\r\n      url = aprintf(\"%s://%s%s%s:%hu%s%s%s\", conn->given->scheme,\r\n                    conn->bits.ipv6_ip?\"[\":\"\", conn->host.name,\r\n                    conn->bits.ipv6_ip?\"]\":\"\", conn->remote_port,\r\n                    data->state.slash_removed?\"/\":\"\", data->state.path,\r\n                    type);\r\n      if(!url)\r\n        return CURLE_OUT_OF_MEMORY;\r\n\r\n      if(data->change.url_alloc) {\r\n        Curl_safefree(data->change.url);\r\n        data->change.url_alloc = FALSE;\r\n      }\r\n\r\n      data->change.url = url;\r\n      data->change.url_alloc = TRUE;\r\n    }\r\n  }\r\n  else if(portptr) {\r\n    /* no CURLOPT_PORT given, extract the one from the URL */\r\n\r\n    char *rest;\r\n    unsigned long port;\r\n\r\n    port=strtoul(portptr+1, &rest, 10);  /* Port number must be decimal */\r\n\r\n    if(rest != (portptr+1) && *rest == '\\0') {\r\n      /* The colon really did have only digits after it,\r\n       * so it is either a port number or a mistake */\r\n\r\n      if(port > 0xffff) {   /* Single unix standard says port numbers are\r\n                              * 16 bits long */\r\n        failf(data, \"Port number too large: %lu\", port);\r\n        return CURLE_URL_MALFORMAT;\r\n      }\r\n\r\n      *portptr = '\\0'; /* cut off the name there */\r\n      conn->remote_port = curlx_ultous(port);\r\n    }\r\n    else if(!port)\r\n      /* Browser behavior adaptation. If there's a colon with no digits after,\r\n         just cut off the name there which makes us ignore the colon and just\r\n         use the default port. Firefox and Chrome both do that. */\r\n      *portptr = '\\0';\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * Override a user name and password from the URL with that in the\r\n * CURLOPT_USERPWD option or a .netrc file, if applicable.\r\n */\r\nstatic void override_userpass(struct SessionHandle *data,\r\n                              struct connectdata *conn,\r\n                              char *user, char *passwd)\r\n{\r\n  if(data->set.str[STRING_USERNAME] != NULL) {\r\n    strncpy(user, data->set.str[STRING_USERNAME], MAX_CURL_USER_LENGTH);\r\n    user[MAX_CURL_USER_LENGTH-1] = '\\0';   /*To be on safe side*/\r\n  }\r\n  if(data->set.str[STRING_PASSWORD] != NULL) {\r\n    strncpy(passwd, data->set.str[STRING_PASSWORD], MAX_CURL_PASSWORD_LENGTH);\r\n    passwd[MAX_CURL_PASSWORD_LENGTH-1] = '\\0'; /*To be on safe side*/\r\n  }\r\n\r\n  conn->bits.netrc = FALSE;\r\n  if(data->set.use_netrc != CURL_NETRC_IGNORED) {\r\n    if(Curl_parsenetrc(conn->host.name,\r\n                       user, passwd,\r\n                       data->set.str[STRING_NETRC_FILE])) {\r\n      infof(data, \"Couldn't find host %s in the \"\r\n            DOT_CHAR \"netrc file; using defaults\\n\",\r\n            conn->host.name);\r\n    }\r\n    else {\r\n      /* set bits.netrc TRUE to remember that we got the name from a .netrc\r\n         file, so that it is safe to use even if we followed a Location: to a\r\n         different host or similar. */\r\n      conn->bits.netrc = TRUE;\r\n\r\n      conn->bits.user_passwd = TRUE; /* enable user+password */\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n * Set password so it's available in the connection.\r\n */\r\nstatic CURLcode set_userpass(struct connectdata *conn,\r\n                             const char *user, const char *passwd)\r\n{\r\n  /* If our protocol needs a password and we have none, use the defaults */\r\n  if((conn->handler->flags & PROTOPT_NEEDSPWD) &&\r\n     !conn->bits.user_passwd) {\r\n\r\n    conn->user = strdup(CURL_DEFAULT_USER);\r\n    if(conn->user)\r\n      conn->passwd = strdup(CURL_DEFAULT_PASSWORD);\r\n    else\r\n      conn->passwd = NULL;\r\n    /* This is the default password, so DON'T set conn->bits.user_passwd */\r\n  }\r\n  else {\r\n    /* store user + password, zero-length if not set */\r\n    conn->user = strdup(user);\r\n    if(conn->user)\r\n      conn->passwd = strdup(passwd);\r\n    else\r\n      conn->passwd = NULL;\r\n  }\r\n  if(!conn->user || !conn->passwd)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*************************************************************\r\n * Resolve the address of the server or proxy\r\n *************************************************************/\r\nstatic CURLcode resolve_server(struct SessionHandle *data,\r\n                               struct connectdata *conn,\r\n                               bool *async)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n  long timeout_ms = Curl_timeleft(data, NULL, TRUE);\r\n\r\n  /*************************************************************\r\n   * Resolve the name of the server or proxy\r\n   *************************************************************/\r\n  if(conn->bits.reuse)\r\n    /* We're reusing the connection - no need to resolve anything, and\r\n       fix_hostname() was called already in create_conn() for the re-use\r\n       case. */\r\n    *async = FALSE;\r\n\r\n  else {\r\n    /* this is a fresh connect */\r\n    int rc;\r\n    struct Curl_dns_entry *hostaddr;\r\n\r\n    /* set a pointer to the hostname we display */\r\n    fix_hostname(data, conn, &conn->host);\r\n\r\n    if(!conn->proxy.name || !*conn->proxy.name) {\r\n      /* If not connecting via a proxy, extract the port from the URL, if it is\r\n       * there, thus overriding any defaults that might have been set above. */\r\n      conn->port =  conn->remote_port; /* it is the same port */\r\n\r\n      /* Resolve target host right on */\r\n      rc = Curl_resolv_timeout(conn, conn->host.name, (int)conn->port,\r\n                               &hostaddr, timeout_ms);\r\n      if(rc == CURLRESOLV_PENDING)\r\n        *async = TRUE;\r\n\r\n      else if(rc == CURLRESOLV_TIMEDOUT)\r\n        result = CURLE_OPERATION_TIMEDOUT;\r\n\r\n      else if(!hostaddr) {\r\n        failf(data, \"Couldn't resolve host '%s'\", conn->host.dispname);\r\n        result =  CURLE_COULDNT_RESOLVE_HOST;\r\n        /* don't return yet, we need to clean up the timeout first */\r\n      }\r\n    }\r\n    else {\r\n      /* This is a proxy that hasn't been resolved yet. */\r\n\r\n      /* IDN-fix the proxy name */\r\n      fix_hostname(data, conn, &conn->proxy);\r\n\r\n      /* resolve proxy */\r\n      rc = Curl_resolv_timeout(conn, conn->proxy.name, (int)conn->port,\r\n                               &hostaddr, timeout_ms);\r\n\r\n      if(rc == CURLRESOLV_PENDING)\r\n        *async = TRUE;\r\n\r\n      else if(rc == CURLRESOLV_TIMEDOUT)\r\n        result = CURLE_OPERATION_TIMEDOUT;\r\n\r\n      else if(!hostaddr) {\r\n        failf(data, \"Couldn't resolve proxy '%s'\", conn->proxy.dispname);\r\n        result = CURLE_COULDNT_RESOLVE_PROXY;\r\n        /* don't return yet, we need to clean up the timeout first */\r\n      }\r\n    }\r\n    DEBUGASSERT(conn->dns_entry == NULL);\r\n    conn->dns_entry = hostaddr;\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * Cleanup the connection just allocated before we can move along and use the\r\n * previously existing one.  All relevant data is copied over and old_conn is\r\n * ready for freeing once this function returns.\r\n */\r\nstatic void reuse_conn(struct connectdata *old_conn,\r\n                       struct connectdata *conn)\r\n{\r\n  if(old_conn->proxy.rawalloc)\r\n    free(old_conn->proxy.rawalloc);\r\n\r\n  /* free the SSL config struct from this connection struct as this was\r\n     allocated in vain and is targeted for destruction */\r\n  Curl_free_ssl_config(&old_conn->ssl_config);\r\n\r\n  conn->data = old_conn->data;\r\n\r\n  /* get the user+password information from the old_conn struct since it may\r\n   * be new for this request even when we re-use an existing connection */\r\n  conn->bits.user_passwd = old_conn->bits.user_passwd;\r\n  if(conn->bits.user_passwd) {\r\n    /* use the new user name and password though */\r\n    Curl_safefree(conn->user);\r\n    Curl_safefree(conn->passwd);\r\n    conn->user = old_conn->user;\r\n    conn->passwd = old_conn->passwd;\r\n    old_conn->user = NULL;\r\n    old_conn->passwd = NULL;\r\n  }\r\n\r\n  conn->bits.proxy_user_passwd = old_conn->bits.proxy_user_passwd;\r\n  if(conn->bits.proxy_user_passwd) {\r\n    /* use the new proxy user name and proxy password though */\r\n    Curl_safefree(conn->proxyuser);\r\n    Curl_safefree(conn->proxypasswd);\r\n    conn->proxyuser = old_conn->proxyuser;\r\n    conn->proxypasswd = old_conn->proxypasswd;\r\n    old_conn->proxyuser = NULL;\r\n    old_conn->proxypasswd = NULL;\r\n  }\r\n\r\n  /* host can change, when doing keepalive with a proxy or if the case is\r\n     different this time etc */\r\n  Curl_safefree(conn->host.rawalloc);\r\n  conn->host=old_conn->host;\r\n\r\n  /* persist connection info in session handle */\r\n  Curl_persistconninfo(conn);\r\n\r\n  /* re-use init */\r\n  conn->bits.reuse = TRUE; /* yes, we're re-using here */\r\n\r\n  Curl_safefree(old_conn->user);\r\n  Curl_safefree(old_conn->passwd);\r\n  Curl_safefree(old_conn->proxyuser);\r\n  Curl_safefree(old_conn->proxypasswd);\r\n  Curl_safefree(old_conn->localdev);\r\n\r\n  Curl_llist_destroy(old_conn->send_pipe, NULL);\r\n  Curl_llist_destroy(old_conn->recv_pipe, NULL);\r\n  Curl_llist_destroy(old_conn->pend_pipe, NULL);\r\n  Curl_llist_destroy(old_conn->done_pipe, NULL);\r\n\r\n  old_conn->send_pipe = NULL;\r\n  old_conn->recv_pipe = NULL;\r\n  old_conn->pend_pipe = NULL;\r\n  old_conn->done_pipe = NULL;\r\n\r\n  Curl_safefree(old_conn->master_buffer);\r\n}\r\n\r\n/**\r\n * create_conn() sets up a new connectdata struct, or re-uses an already\r\n * existing one, and resolves host name.\r\n *\r\n * if this function returns CURLE_OK and *async is set to TRUE, the resolve\r\n * response will be coming asynchronously. If *async is FALSE, the name is\r\n * already resolved.\r\n *\r\n * @param data The sessionhandle pointer\r\n * @param in_connect is set to the next connection data pointer\r\n * @param async is set TRUE when an async DNS resolution is pending\r\n * @see Curl_setup_conn()\r\n *\r\n * *NOTE* this function assigns the conn->data pointer!\r\n */\r\n\r\nstatic CURLcode create_conn(struct SessionHandle *data,\r\n                            struct connectdata **in_connect,\r\n                            bool *async)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n  struct connectdata *conn;\r\n  struct connectdata *conn_temp = NULL;\r\n  size_t urllen;\r\n  char user[MAX_CURL_USER_LENGTH];\r\n  char passwd[MAX_CURL_PASSWORD_LENGTH];\r\n  bool reuse;\r\n  char *proxy = NULL;\r\n  bool prot_missing = FALSE;\r\n\r\n  *async = FALSE;\r\n\r\n  /*************************************************************\r\n   * Check input data\r\n   *************************************************************/\r\n\r\n  if(!data->change.url)\r\n    return CURLE_URL_MALFORMAT;\r\n\r\n  /* First, split up the current URL in parts so that we can use the\r\n     parts for checking against the already present connections. In order\r\n     to not have to modify everything at once, we allocate a temporary\r\n     connection data struct and fill in for comparison purposes. */\r\n  conn = allocate_conn(data);\r\n\r\n  if(!conn)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /* We must set the return variable as soon as possible, so that our\r\n     parent can cleanup any possible allocs we may have done before\r\n     any failure */\r\n  *in_connect = conn;\r\n\r\n  /* This initing continues below, see the comment \"Continue connectdata\r\n   * initialization here\" */\r\n\r\n  /***********************************************************\r\n   * We need to allocate memory to store the path in. We get the size of the\r\n   * full URL to be sure, and we need to make it at least 256 bytes since\r\n   * other parts of the code will rely on this fact\r\n   ***********************************************************/\r\n#define LEAST_PATH_ALLOC 256\r\n  urllen=strlen(data->change.url);\r\n  if(urllen < LEAST_PATH_ALLOC)\r\n    urllen=LEAST_PATH_ALLOC;\r\n\r\n  /*\r\n   * We malloc() the buffers below urllen+2 to make room for 2 possibilities:\r\n   * 1 - an extra terminating zero\r\n   * 2 - an extra slash (in case a syntax like \"www.host.com?moo\" is used)\r\n   */\r\n\r\n  Curl_safefree(data->state.pathbuffer);\r\n  data->state.path = NULL;\r\n\r\n  data->state.pathbuffer = malloc(urllen+2);\r\n  if(NULL == data->state.pathbuffer)\r\n    return CURLE_OUT_OF_MEMORY; /* really bad error */\r\n  data->state.path = data->state.pathbuffer;\r\n\r\n  conn->host.rawalloc = malloc(urllen+2);\r\n  if(NULL == conn->host.rawalloc) {\r\n    Curl_safefree(data->state.pathbuffer);\r\n    data->state.path = NULL;\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  conn->host.name = conn->host.rawalloc;\r\n  conn->host.name[0] = 0;\r\n\r\n  result = parseurlandfillconn(data, conn, &prot_missing, user, passwd);\r\n  if(result != CURLE_OK)\r\n    return result;\r\n\r\n  /*************************************************************\r\n   * No protocol part in URL was used, add it!\r\n   *************************************************************/\r\n  if(prot_missing) {\r\n    /* We're guessing prefixes here and if we're told to use a proxy or if\r\n       we're gonna follow a Location: later or... then we need the protocol\r\n       part added so that we have a valid URL. */\r\n    char *reurl;\r\n\r\n    reurl = aprintf(\"%s://%s\", conn->handler->scheme, data->change.url);\r\n\r\n    if(!reurl) {\r\n      Curl_safefree(proxy);\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    if(data->change.url_alloc) {\r\n      Curl_safefree(data->change.url);\r\n      data->change.url_alloc = FALSE;\r\n    }\r\n\r\n    data->change.url = reurl;\r\n    data->change.url_alloc = TRUE; /* free this later */\r\n  }\r\n\r\n  /*************************************************************\r\n   * If the protocol can't handle url query strings, then cut\r\n   * of the unhandable part\r\n   *************************************************************/\r\n  if((conn->given->flags&PROTOPT_NOURLQUERY)) {\r\n    char *path_q_sep = strchr(conn->data->state.path, '?');\r\n    if(path_q_sep) {\r\n      /* according to rfc3986, allow the query (?foo=bar)\r\n         also on protocols that can't handle it.\r\n\r\n         cut the string-part after '?'\r\n      */\r\n\r\n      /* terminate the string */\r\n      path_q_sep[0] = 0;\r\n    }\r\n  }\r\n\r\n#ifndef CURL_DISABLE_PROXY\r\n  /*************************************************************\r\n   * Extract the user and password from the authentication string\r\n   *************************************************************/\r\n  if(conn->bits.proxy_user_passwd) {\r\n    result = parse_proxy_auth(data, conn);\r\n    if(result != CURLE_OK)\r\n      return result;\r\n  }\r\n\r\n  /*************************************************************\r\n   * Detect what (if any) proxy to use\r\n   *************************************************************/\r\n  if(data->set.str[STRING_PROXY]) {\r\n    proxy = strdup(data->set.str[STRING_PROXY]);\r\n    /* if global proxy is set, this is it */\r\n    if(NULL == proxy) {\r\n      failf(data, \"memory shortage\");\r\n      return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  if(data->set.str[STRING_NOPROXY] &&\r\n     check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY])) {\r\n    if(proxy) {\r\n      free(proxy);  /* proxy is in exception list */\r\n      proxy = NULL;\r\n    }\r\n  }\r\n  else if(!proxy)\r\n    proxy = detect_proxy(conn);\r\n\r\n  if(proxy && (!*proxy || (conn->handler->flags & PROTOPT_NONETWORK))) {\r\n    free(proxy);  /* Don't bother with an empty proxy string or if the\r\n                     protocol doesn't work with network */\r\n    proxy = NULL;\r\n  }\r\n\r\n  /***********************************************************************\r\n   * If this is supposed to use a proxy, we need to figure out the proxy host\r\n   * name, proxy type and port number, so that we can re-use an existing\r\n   * connection that may exist registered to the same proxy host.\r\n   ***********************************************************************/\r\n  if(proxy) {\r\n    result = parse_proxy(data, conn, proxy);\r\n\r\n    free(proxy); /* parse_proxy copies the proxy string */\r\n\r\n    if(result)\r\n      return result;\r\n\r\n    if((conn->proxytype == CURLPROXY_HTTP) ||\r\n       (conn->proxytype == CURLPROXY_HTTP_1_0)) {\r\n#ifdef CURL_DISABLE_HTTP\r\n      /* asking for a HTTP proxy is a bit funny when HTTP is disabled... */\r\n      return CURLE_UNSUPPORTED_PROTOCOL;\r\n#else\r\n      /* force this connection's protocol to become HTTP if not already\r\n         compatible - if it isn't tunneling through */\r\n      if(!(conn->handler->protocol & CURLPROTO_HTTP) &&\r\n         !conn->bits.tunnel_proxy)\r\n        conn->handler = &Curl_handler_http;\r\n\r\n      conn->bits.httpproxy = TRUE;\r\n#endif\r\n    }\r\n    else\r\n      conn->bits.httpproxy = FALSE; /* not a HTTP proxy */\r\n    conn->bits.proxy = TRUE;\r\n  }\r\n  else {\r\n    /* we aren't using the proxy after all... */\r\n    conn->bits.proxy = FALSE;\r\n    conn->bits.httpproxy = FALSE;\r\n    conn->bits.proxy_user_passwd = FALSE;\r\n    conn->bits.tunnel_proxy = FALSE;\r\n  }\r\n\r\n#endif /* CURL_DISABLE_PROXY */\r\n\r\n  /*************************************************************\r\n   * Setup internals depending on protocol. Needs to be done after\r\n   * we figured out what/if proxy to use.\r\n   *************************************************************/\r\n  result = setup_connection_internals(conn);\r\n  if(result != CURLE_OK) {\r\n    Curl_safefree(proxy);\r\n    return result;\r\n  }\r\n\r\n  conn->recv[FIRSTSOCKET] = Curl_recv_plain;\r\n  conn->send[FIRSTSOCKET] = Curl_send_plain;\r\n  conn->recv[SECONDARYSOCKET] = Curl_recv_plain;\r\n  conn->send[SECONDARYSOCKET] = Curl_send_plain;\r\n\r\n  /***********************************************************************\r\n   * file: is a special case in that it doesn't need a network connection\r\n   ***********************************************************************/\r\n#ifndef CURL_DISABLE_FILE\r\n  if(conn->handler->flags & PROTOPT_NONETWORK) {\r\n    bool done;\r\n    /* this is supposed to be the connect function so we better at least check\r\n       that the file is present here! */\r\n    DEBUGASSERT(conn->handler->connect_it);\r\n    result = conn->handler->connect_it(conn, &done);\r\n\r\n    /* Setup a \"faked\" transfer that'll do nothing */\r\n    if(CURLE_OK == result) {\r\n      conn->data = data;\r\n      conn->bits.tcpconnect[FIRSTSOCKET] = TRUE; /* we are \"connected */\r\n\r\n      ConnectionStore(data, conn);\r\n\r\n      /*\r\n       * Setup whatever necessary for a resumed transfer\r\n       */\r\n      result = setup_range(data);\r\n      if(result) {\r\n        DEBUGASSERT(conn->handler->done);\r\n        /* we ignore the return code for the protocol-specific DONE */\r\n        (void)conn->handler->done(conn, result, FALSE);\r\n        return result;\r\n      }\r\n\r\n      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */\r\n                          -1, NULL); /* no upload */\r\n    }\r\n\r\n    return result;\r\n  }\r\n#endif\r\n\r\n  /*************************************************************\r\n   * If the protocol is using SSL and HTTP proxy is used, we set\r\n   * the tunnel_proxy bit.\r\n   *************************************************************/\r\n  if((conn->given->flags&PROTOPT_SSL) && conn->bits.httpproxy)\r\n    conn->bits.tunnel_proxy = TRUE;\r\n\r\n  /*************************************************************\r\n   * Figure out the remote port number and fix it in the URL\r\n   *************************************************************/\r\n  result = parse_remote_port(data, conn);\r\n  if(result != CURLE_OK)\r\n    return result;\r\n\r\n  /*************************************************************\r\n   * Check for an overridden user name and password, then set it\r\n   * for use\r\n   *************************************************************/\r\n  override_userpass(data, conn, user, passwd);\r\n  result = set_userpass(conn, user, passwd);\r\n  if(result != CURLE_OK)\r\n    return result;\r\n\r\n  /* Get a cloned copy of the SSL config situation stored in the\r\n     connection struct. But to get this going nicely, we must first make\r\n     sure that the strings in the master copy are pointing to the correct\r\n     strings in the session handle strings array!\r\n\r\n     Keep in mind that the pointers in the master copy are pointing to strings\r\n     that will be freed as part of the SessionHandle struct, but all cloned\r\n     copies will be separately allocated.\r\n  */\r\n  data->set.ssl.CApath = data->set.str[STRING_SSL_CAPATH];\r\n  data->set.ssl.CAfile = data->set.str[STRING_SSL_CAFILE];\r\n  data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE];\r\n  data->set.ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT];\r\n  data->set.ssl.random_file = data->set.str[STRING_SSL_RANDOM_FILE];\r\n  data->set.ssl.egdsocket = data->set.str[STRING_SSL_EGDSOCKET];\r\n  data->set.ssl.cipher_list = data->set.str[STRING_SSL_CIPHER_LIST];\r\n#ifdef USE_TLS_SRP\r\n  data->set.ssl.username = data->set.str[STRING_TLSAUTH_USERNAME];\r\n  data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD];\r\n#endif\r\n\r\n  if(!Curl_clone_ssl_config(&data->set.ssl, &conn->ssl_config))\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  /*************************************************************\r\n   * Check the current list of connections to see if we can\r\n   * re-use an already existing one or if we have to create a\r\n   * new one.\r\n   *************************************************************/\r\n\r\n  /* reuse_fresh is TRUE if we are told to use a new connection by force, but\r\n     we only acknowledge this option if this is not a re-used connection\r\n     already (which happens due to follow-location or during a HTTP\r\n     authentication phase). */\r\n  if(data->set.reuse_fresh && !data->state.this_is_a_follow)\r\n    reuse = FALSE;\r\n  else\r\n    reuse = ConnectionExists(data, conn, &conn_temp);\r\n\r\n  if(reuse) {\r\n    /*\r\n     * We already have a connection for this, we got the former connection\r\n     * in the conn_temp variable and thus we need to cleanup the one we\r\n     * just allocated before we can move along and use the previously\r\n     * existing one.\r\n     */\r\n    reuse_conn(conn, conn_temp);\r\n    free(conn);          /* we don't need this anymore */\r\n    conn = conn_temp;\r\n    *in_connect = conn;\r\n\r\n    /* set a pointer to the hostname we display */\r\n    fix_hostname(data, conn, &conn->host);\r\n\r\n    infof(data, \"Re-using existing connection! (#%ld) with host %s\\n\",\r\n          conn->connection_id,\r\n          conn->proxy.name?conn->proxy.dispname:conn->host.dispname);\r\n  }\r\n  else {\r\n    /*\r\n     * This is a brand new connection, so let's store it in the connection\r\n     * cache of ours!\r\n     */\r\n    conn->inuse = TRUE;\r\n    ConnectionStore(data, conn);\r\n  }\r\n\r\n  /* Setup and init stuff before DO starts, in preparing for the transfer. */\r\n  do_init(conn);\r\n\r\n  /*\r\n   * Setup whatever necessary for a resumed transfer\r\n   */\r\n  result = setup_range(data);\r\n  if(result)\r\n    return result;\r\n\r\n  /* Continue connectdata initialization here. */\r\n\r\n  /*\r\n   * Inherit the proper values from the urldata struct AFTER we have arranged\r\n   * the persistent connection stuff\r\n   */\r\n  conn->fread_func = data->set.fread_func;\r\n  conn->fread_in = data->set.in;\r\n  conn->seek_func = data->set.seek_func;\r\n  conn->seek_client = data->set.seek_client;\r\n\r\n  /*************************************************************\r\n   * Resolve the address of the server or proxy\r\n   *************************************************************/\r\n  result = resolve_server(data, conn, async);\r\n\r\n  return result;\r\n}\r\n\r\n/* Curl_setup_conn() is called after the name resolve initiated in\r\n * create_conn() is all done.\r\n *\r\n * Curl_setup_conn() also handles reused connections\r\n *\r\n * conn->data MUST already have been setup fine (in create_conn)\r\n */\r\n\r\nCURLcode Curl_setup_conn(struct connectdata *conn,\r\n                         bool *protocol_done)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  Curl_pgrsTime(data, TIMER_NAMELOOKUP);\r\n\r\n  if(conn->handler->flags & PROTOPT_NONETWORK) {\r\n    /* nothing to setup when not using a network */\r\n    *protocol_done = TRUE;\r\n    return result;\r\n  }\r\n  *protocol_done = FALSE; /* default to not done */\r\n\r\n  /* set proxy_connect_closed to false unconditionally already here since it\r\n     is used strictly to provide extra information to a parent function in the\r\n     case of proxy CONNECT failures and we must make sure we don't have it\r\n     lingering set from a previous invoke */\r\n  conn->bits.proxy_connect_closed = FALSE;\r\n\r\n  /*\r\n   * Set user-agent. Used for HTTP, but since we can attempt to tunnel\r\n   * basically anything through a http proxy we can't limit this based on\r\n   * protocol.\r\n   */\r\n  if(data->set.str[STRING_USERAGENT]) {\r\n    Curl_safefree(conn->allocptr.uagent);\r\n    conn->allocptr.uagent =\r\n      aprintf(\"User-Agent: %s\\r\\n\", data->set.str[STRING_USERAGENT]);\r\n    if(!conn->allocptr.uagent)\r\n      return CURLE_OUT_OF_MEMORY;\r\n  }\r\n\r\n  data->req.headerbytecount = 0;\r\n\r\n#ifdef CURL_DO_LINEEND_CONV\r\n  data->state.crlf_conversions = 0; /* reset CRLF conversion counter */\r\n#endif /* CURL_DO_LINEEND_CONV */\r\n\r\n  /* set start time here for timeout purposes in the connect procedure, it\r\n     is later set again for the progress meter purpose */\r\n  conn->now = Curl_tvnow();\r\n\r\n  for(;;) {\r\n    /* loop for CURL_SERVER_CLOSED_CONNECTION */\r\n\r\n    if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {\r\n      /* Try to connect only if not already connected */\r\n      bool connected = FALSE;\r\n\r\n      result = ConnectPlease(data, conn, &connected);\r\n\r\n      if(result && !conn->ip_addr) {\r\n        /* transport connection failure not related with authentication */\r\n        conn->bits.tcpconnect[FIRSTSOCKET] = FALSE;\r\n        return result;\r\n      }\r\n\r\n      if(connected) {\r\n        result = Curl_protocol_connect(conn, protocol_done);\r\n        if(CURLE_OK == result)\r\n          conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;\r\n      }\r\n      else\r\n        conn->bits.tcpconnect[FIRSTSOCKET] = FALSE;\r\n\r\n      /* if the connection was closed by the server while exchanging\r\n         authentication informations, retry with the new set\r\n         authentication information */\r\n      if(conn->bits.proxy_connect_closed) {\r\n        /* reset the error buffer */\r\n        if(data->set.errorbuffer)\r\n          data->set.errorbuffer[0] = '\\0';\r\n        data->state.errorbuf = FALSE;\r\n        continue;\r\n      }\r\n\r\n      if(CURLE_OK != result)\r\n        return result;\r\n    }\r\n    else {\r\n      Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */\r\n      Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */\r\n      conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;\r\n      *protocol_done = TRUE;\r\n      Curl_verboseconnect(conn);\r\n      Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]);\r\n    }\r\n    /* Stop the loop now */\r\n    break;\r\n  }\r\n\r\n  conn->now = Curl_tvnow(); /* time this *after* the connect is done, we\r\n                               set this here perhaps a second time */\r\n\r\n#ifdef __EMX__\r\n  /*\r\n   * This check is quite a hack. We're calling _fsetmode to fix the problem\r\n   * with fwrite converting newline characters (you get mangled text files,\r\n   * and corrupted binary files when you download to stdout and redirect it to\r\n   * a file).\r\n   */\r\n\r\n  if((data->set.out)->_handle == NULL) {\r\n    _fsetmode(stdout, \"b\");\r\n  }\r\n#endif\r\n\r\n  return result;\r\n}\r\n\r\nCURLcode Curl_connect(struct SessionHandle *data,\r\n                      struct connectdata **in_connect,\r\n                      bool *asyncp,\r\n                      bool *protocol_done)\r\n{\r\n  CURLcode code;\r\n\r\n  *asyncp = FALSE; /* assume synchronous resolves by default */\r\n\r\n  /* call the stuff that needs to be called */\r\n  code = create_conn(data, in_connect, asyncp);\r\n\r\n  if(CURLE_OK == code) {\r\n    /* no error */\r\n    if((*in_connect)->send_pipe->size || (*in_connect)->recv_pipe->size)\r\n      /* pipelining */\r\n      *protocol_done = TRUE;\r\n    else if(!*asyncp) {\r\n      /* DNS resolution is done: that's either because this is a reused\r\n         connection, in which case DNS was unnecessary, or because DNS\r\n         really did finish already (synch resolver/fast async resolve) */\r\n      code = Curl_setup_conn(*in_connect, protocol_done);\r\n    }\r\n  }\r\n\r\n  if(code && *in_connect) {\r\n    /* We're not allowed to return failure with memory left allocated\r\n       in the connectdata struct, free those here */\r\n    Curl_disconnect(*in_connect, FALSE); /* close the connection */\r\n    *in_connect = NULL;           /* return a NULL */\r\n  }\r\n\r\n  return code;\r\n}\r\n\r\nCURLcode Curl_done(struct connectdata **connp,\r\n                   CURLcode status,  /* an error if this is called after an\r\n                                        error was detected */\r\n                   bool premature)\r\n{\r\n  CURLcode result;\r\n  struct connectdata *conn;\r\n  struct SessionHandle *data;\r\n\r\n  DEBUGASSERT(*connp);\r\n\r\n  conn = *connp;\r\n  data = conn->data;\r\n\r\n  if(conn->bits.done)\r\n    /* Stop if Curl_done() has already been called */\r\n    return CURLE_OK;\r\n\r\n  Curl_getoff_all_pipelines(data, conn);\r\n\r\n  if((conn->send_pipe->size + conn->recv_pipe->size != 0 &&\r\n      !data->set.reuse_forbid &&\r\n      !conn->bits.close))\r\n    /* Stop if pipeline is not empty and we do not have to close\r\n       connection. */\r\n    return CURLE_OK;\r\n\r\n  conn->bits.done = TRUE; /* called just now! */\r\n\r\n  /* Cleanup possible redirect junk */\r\n  if(data->req.newurl) {\r\n    free(data->req.newurl);\r\n    data->req.newurl = NULL;\r\n  }\r\n  if(data->req.location) {\r\n    free(data->req.location);\r\n    data->req.location = NULL;\r\n  }\r\n\r\n  Curl_resolver_cancel(conn);\r\n\r\n  if(conn->dns_entry) {\r\n    Curl_resolv_unlock(data, conn->dns_entry); /* done with this */\r\n    conn->dns_entry = NULL;\r\n  }\r\n\r\n  /* this calls the protocol-specific function pointer previously set */\r\n  if(conn->handler->done)\r\n    result = conn->handler->done(conn, status, premature);\r\n  else\r\n    result = CURLE_OK;\r\n\r\n  if(Curl_pgrsDone(conn) && !result)\r\n    result = CURLE_ABORTED_BY_CALLBACK;\r\n\r\n  /* if the transfer was completed in a paused state there can be buffered\r\n     data left to write and then kill */\r\n  if(data->state.tempwrite) {\r\n    free(data->state.tempwrite);\r\n    data->state.tempwrite = NULL;\r\n  }\r\n\r\n  /* if data->set.reuse_forbid is TRUE, it means the libcurl client has\r\n     forced us to close this no matter what we think.\r\n\r\n     if conn->bits.close is TRUE, it means that the connection should be\r\n     closed in spite of all our efforts to be nice, due to protocol\r\n     restrictions in our or the server's end\r\n\r\n     if premature is TRUE, it means this connection was said to be DONE before\r\n     the entire request operation is complete and thus we can't know in what\r\n     state it is for re-using, so we're forced to close it. In a perfect world\r\n     we can add code that keep track of if we really must close it here or not,\r\n     but currently we have no such detail knowledge.\r\n\r\n     connection_id == -1 here means that the connection has not been added\r\n     to the connection cache (OOM) and thus we must disconnect it here.\r\n  */\r\n  if(data->set.reuse_forbid || conn->bits.close || premature ||\r\n     (-1 == conn->connection_id)) {\r\n    CURLcode res2 = Curl_disconnect(conn, premature); /* close connection */\r\n\r\n    /* If we had an error already, make sure we return that one. But\r\n       if we got a new error, return that. */\r\n    if(!result && res2)\r\n      result = res2;\r\n  }\r\n  else {\r\n    /* the connection is no longer in use */\r\n    if(ConnectionDone(data, conn)) {\r\n      /* remember the most recently used connection */\r\n      data->state.lastconnect = conn;\r\n\r\n      infof(data, \"Connection #%ld to host %s left intact\\n\",\r\n            conn->connection_id,\r\n            conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);\r\n    }\r\n    else\r\n      data->state.lastconnect = NULL;\r\n  }\r\n\r\n  *connp = NULL; /* to make the caller of this function better detect that\r\n                    this was either closed or handed over to the connection\r\n                    cache here, and therefore cannot be used from this point on\r\n                 */\r\n\r\n  return result;\r\n}\r\n\r\n/*\r\n * do_init() inits the readwrite session. This is inited each time (in the DO\r\n * function before the protocol-specific DO functions are invoked) for a\r\n * transfer, sometimes multiple times on the same SessionHandle. Make sure\r\n * nothing in here depends on stuff that are setup dynamically for the\r\n * transfer.\r\n */\r\n\r\nstatic CURLcode do_init(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  struct SingleRequest *k = &data->req;\r\n\r\n  conn->bits.done = FALSE; /* Curl_done() is not called yet */\r\n  conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to use */\r\n  data->state.expect100header = FALSE;\r\n\r\n  if(data->set.opt_no_body)\r\n    /* in HTTP lingo, no body means using the HEAD request... */\r\n    data->set.httpreq = HTTPREQ_HEAD;\r\n  else if(HTTPREQ_HEAD == data->set.httpreq)\r\n    /* ... but if unset there really is no perfect method that is the\r\n       \"opposite\" of HEAD but in reality most people probably think GET\r\n       then. The important thing is that we can't let it remain HEAD if the\r\n       opt_no_body is set FALSE since then we'll behave wrong when getting\r\n       HTTP. */\r\n    data->set.httpreq = HTTPREQ_GET;\r\n\r\n  /* NB: the content encoding software depends on this initialization */\r\n  Curl_easy_initHandleData(data);\r\n\r\n  k->start = Curl_tvnow(); /* start time */\r\n  k->now = k->start;   /* current time is now */\r\n  k->header = TRUE; /* assume header */\r\n\r\n  k->bytecount = 0;\r\n\r\n  k->buf = data->state.buffer;\r\n  k->uploadbuf = data->state.uploadbuffer;\r\n  k->hbufp = data->state.headerbuff;\r\n  k->ignorebody=FALSE;\r\n\r\n  Curl_speedinit(data);\r\n\r\n  Curl_pgrsSetUploadCounter(data, 0);\r\n  Curl_pgrsSetDownloadCounter(data, 0);\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * do_complete is called when the DO actions are complete.\r\n *\r\n * We init chunking and trailer bits to their default values here immediately\r\n * before receiving any header data for the current request in the pipeline.\r\n */\r\nstatic void do_complete(struct connectdata *conn)\r\n{\r\n  conn->data->req.chunk=FALSE;\r\n  conn->data->req.maxfd = (conn->sockfd>conn->writesockfd?\r\n                           conn->sockfd:conn->writesockfd)+1;\r\n  Curl_pgrsTime(conn->data, TIMER_PRETRANSFER);\r\n}\r\n\r\nCURLcode Curl_do(struct connectdata **connp, bool *done)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n  struct connectdata *conn = *connp;\r\n  struct SessionHandle *data = conn->data;\r\n\r\n  if(conn->handler->do_it) {\r\n    /* generic protocol-specific function pointer set in curl_connect() */\r\n    result = conn->handler->do_it(conn, done);\r\n\r\n    /* This was formerly done in transfer.c, but we better do it here */\r\n    if((CURLE_SEND_ERROR == result) && conn->bits.reuse) {\r\n      /*\r\n       * If the connection is using an easy handle, call reconnect\r\n       * to re-establish the connection.  Otherwise, let the multi logic\r\n       * figure out how to re-establish the connection.\r\n       */\r\n      if(!data->multi) {\r\n        result = Curl_reconnect_request(connp);\r\n\r\n        if(result == CURLE_OK) {\r\n          /* ... finally back to actually retry the DO phase */\r\n          conn = *connp; /* re-assign conn since Curl_reconnect_request\r\n                            creates a new connection */\r\n          result = conn->handler->do_it(conn, done);\r\n        }\r\n      }\r\n      else\r\n        return result;\r\n    }\r\n\r\n    if((result == CURLE_OK) && *done)\r\n      /* do_complete must be called after the protocol-specific DO function */\r\n      do_complete(conn);\r\n  }\r\n  return result;\r\n}\r\n\r\n/*\r\n * Curl_do_more() is called during the DO_MORE multi state. It is basically a\r\n * second stage DO state which (wrongly) was introduced to support FTP's\r\n * second connection.\r\n *\r\n * TODO: A future libcurl should be able to work away this state.\r\n *\r\n */\r\n\r\nCURLcode Curl_do_more(struct connectdata *conn, bool *completed)\r\n{\r\n  CURLcode result=CURLE_OK;\r\n\r\n  *completed = FALSE;\r\n\r\n  if(conn->handler->do_more)\r\n    result = conn->handler->do_more(conn, completed);\r\n\r\n  if(!result && *completed)\r\n    /* do_complete must be called after the protocol-specific DO function */\r\n    do_complete(conn);\r\n\r\n  return result;\r\n}\r\n\r\n/* Called on connect, and if there's already a protocol-specific struct\r\n   allocated for a different connection, this frees it that it can be setup\r\n   properly later on. */\r\nvoid Curl_reset_reqproto(struct connectdata *conn)\r\n{\r\n  struct SessionHandle *data = conn->data;\r\n  if(data->state.proto.generic && data->state.current_conn != conn) {\r\n    free(data->state.proto.generic);\r\n    data->state.proto.generic = NULL;\r\n  }\r\n  data->state.current_conn = conn;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/url.h",
    "content": "#ifndef HEADER_CURL_URL_H\r\n#define HEADER_CURL_URL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"curl_setup.h\"\r\n\r\n/*\r\n * Prototypes for library-wide functions provided by url.c\r\n */\r\n\r\nCURLcode Curl_open(struct SessionHandle **curl);\r\nCURLcode Curl_init_userdefined(struct UserDefined *set);\r\nCURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,\r\n                     va_list arg);\r\nCURLcode Curl_dupset(struct SessionHandle * dst, struct SessionHandle * src);\r\nvoid Curl_freeset(struct SessionHandle * data);\r\nCURLcode Curl_close(struct SessionHandle *data); /* opposite of curl_open() */\r\nCURLcode Curl_connect(struct SessionHandle *, struct connectdata **,\r\n                      bool *async, bool *protocol_connect);\r\nCURLcode Curl_do(struct connectdata **, bool *done);\r\nCURLcode Curl_do_more(struct connectdata *, bool *completed);\r\nCURLcode Curl_done(struct connectdata **, CURLcode, bool premature);\r\nCURLcode Curl_disconnect(struct connectdata *, bool dead_connection);\r\nCURLcode Curl_protocol_connect(struct connectdata *conn, bool *done);\r\nCURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done);\r\nCURLcode Curl_protocol_doing(struct connectdata *conn, bool *done);\r\nCURLcode Curl_setup_conn(struct connectdata *conn,\r\n                         bool *protocol_done);\r\n\r\nint Curl_protocol_getsock(struct connectdata *conn,\r\n                          curl_socket_t *socks,\r\n                          int numsocks);\r\nint Curl_doing_getsock(struct connectdata *conn,\r\n                       curl_socket_t *socks,\r\n                       int numsocks);\r\n\r\nbool Curl_isPipeliningEnabled(const struct SessionHandle *handle);\r\nCURLcode Curl_addHandleToPipeline(struct SessionHandle *handle,\r\n                                  struct curl_llist *pipeline);\r\nint Curl_removeHandleFromPipeline(struct SessionHandle *handle,\r\n                                  struct curl_llist *pipeline);\r\n/* remove the specified connection from all (possible) pipelines and related\r\n   queues */\r\nvoid Curl_getoff_all_pipelines(struct SessionHandle *data,\r\n                               struct connectdata *conn);\r\n\r\nvoid Curl_close_connections(struct SessionHandle *data);\r\n\r\n/* Called on connect, and if there's already a protocol-specific struct\r\n   allocated for a different connection, this frees it that it can be setup\r\n   properly later on. */\r\nvoid Curl_reset_reqproto(struct connectdata *conn);\r\n\r\n#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */\r\n#define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE \"rcmd\" /* default socks5 gssapi\r\n                                                     service */\r\n\r\nCURLcode Curl_connected_proxy(struct connectdata *conn);\r\n\r\n#ifdef CURL_DISABLE_VERBOSE_STRINGS\r\n#define Curl_verboseconnect(x)  Curl_nop_stmt\r\n#else\r\nvoid Curl_verboseconnect(struct connectdata *conn);\r\n#endif\r\n\r\n\r\n#endif /* HEADER_CURL_URL_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/urldata.h",
    "content": "#ifndef HEADER_CURL_URLDATA_H\r\n#define HEADER_CURL_URLDATA_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* This file is for lib internal stuff */\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#define PORT_FTP 21\r\n#define PORT_FTPS 990\r\n#define PORT_TELNET 23\r\n#define PORT_HTTP 80\r\n#define PORT_HTTPS 443\r\n#define PORT_DICT 2628\r\n#define PORT_LDAP 389\r\n#define PORT_LDAPS 636\r\n#define PORT_TFTP 69\r\n#define PORT_SSH 22\r\n#define PORT_IMAP 143\r\n#define PORT_IMAPS 993\r\n#define PORT_POP3 110\r\n#define PORT_POP3S 995\r\n#define PORT_SMTP 25\r\n#define PORT_SMTPS 465 /* sometimes called SSMTP */\r\n#define PORT_RTSP 554\r\n#define PORT_RTMP 1935\r\n#define PORT_RTMPT PORT_HTTP\r\n#define PORT_RTMPS PORT_HTTPS\r\n#define PORT_GOPHER 70\r\n\r\n#define DICT_MATCH \"/MATCH:\"\r\n#define DICT_MATCH2 \"/M:\"\r\n#define DICT_MATCH3 \"/FIND:\"\r\n#define DICT_DEFINE \"/DEFINE:\"\r\n#define DICT_DEFINE2 \"/D:\"\r\n#define DICT_DEFINE3 \"/LOOKUP:\"\r\n\r\n#define CURL_DEFAULT_USER \"anonymous\"\r\n#define CURL_DEFAULT_PASSWORD \"ftp@example.com\"\r\n\r\n/* length of longest IPv6 address string including the trailing null */\r\n#define MAX_IPADR_LEN sizeof(\"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255\")\r\n\r\n/* Default FTP/IMAP etc response timeout in milliseconds.\r\n   Symbian OS panics when given a timeout much greater than 1/2 hour.\r\n*/\r\n#define RESP_TIMEOUT (1800*1000)\r\n\r\n#include \"cookie.h\"\r\n#include \"formdata.h\"\r\n\r\n#ifdef USE_SSLEAY\r\n#ifdef USE_OPENSSL\r\n#include <openssl/rsa.h>\r\n#include <openssl/crypto.h>\r\n#include <openssl/x509.h>\r\n#include <openssl/pem.h>\r\n#include <openssl/ssl.h>\r\n#include <openssl/err.h>\r\n#ifdef HAVE_OPENSSL_ENGINE_H\r\n#include <openssl/engine.h>\r\n#endif\r\n#ifdef HAVE_OPENSSL_PKCS12_H\r\n#include <openssl/pkcs12.h>\r\n#endif\r\n#else /* SSLeay-style includes */\r\n#include <rsa.h>\r\n#include <crypto.h>\r\n#include <x509.h>\r\n#include <pem.h>\r\n#include <ssl.h>\r\n#include <err.h>\r\n#ifdef HAVE_OPENSSL_ENGINE_H\r\n#include <engine.h>\r\n#endif\r\n#ifdef HAVE_OPENSSL_PKCS12_H\r\n#include <pkcs12.h>\r\n#endif\r\n#endif /* USE_OPENSSL */\r\n#ifdef USE_GNUTLS\r\n#error Configuration error; cannot use GnuTLS *and* OpenSSL.\r\n#endif\r\n#endif /* USE_SSLEAY */\r\n\r\n#ifdef USE_GNUTLS\r\n#include <gnutls/gnutls.h>\r\n#endif\r\n\r\n#ifdef USE_POLARSSL\r\n#include <polarssl/havege.h>\r\n#include <polarssl/ssl.h>\r\n#endif\r\n\r\n#ifdef USE_CYASSL\r\n#undef OCSP_REQUEST  /* avoid cyassl/openssl/ssl.h clash with wincrypt.h */\r\n#undef OCSP_RESPONSE /* avoid cyassl/openssl/ssl.h clash with wincrypt.h */\r\n#include <cyassl/openssl/ssl.h>\r\n#endif\r\n\r\n#ifdef USE_NSS\r\n#include <nspr.h>\r\n#include <pk11pub.h>\r\n#endif\r\n\r\n#ifdef USE_QSOSSL\r\n#include <qsossl.h>\r\n#endif\r\n\r\n#ifdef USE_AXTLS\r\n#include <axTLS/ssl.h>\r\n#undef malloc\r\n#undef calloc\r\n#undef realloc\r\n#endif /* USE_AXTLS */\r\n\r\n#ifdef USE_SCHANNEL\r\n#include \"curl_sspi.h\"\r\n#include <schnlsp.h>\r\n#include <schannel.h>\r\n#endif\r\n\r\n#ifdef USE_DARWINSSL\r\n#include <Security/Security.h>\r\n/* For some reason, when building for iOS, the omnibus header above does\r\n * not include SecureTransport.h as of iOS SDK 5.1. */\r\n#include <Security/SecureTransport.h>\r\n#endif\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#include <netinet/in.h>\r\n#endif\r\n\r\n#include \"timeval.h\"\r\n\r\n#ifdef HAVE_ZLIB_H\r\n#include <zlib.h>               /* for content-encoding */\r\n#ifdef __SYMBIAN32__\r\n/* zlib pollutes the namespace with this definition */\r\n#undef WIN32\r\n#endif\r\n#endif\r\n\r\n#include <curl/curl.h>\r\n\r\n#include \"http_chunks.h\" /* for the structs and enum stuff */\r\n#include \"hostip.h\"\r\n#include \"hash.h\"\r\n#include \"splay.h\"\r\n\r\n#include \"imap.h\"\r\n#include \"pop3.h\"\r\n#include \"smtp.h\"\r\n#include \"ftp.h\"\r\n#include \"file.h\"\r\n#include \"ssh.h\"\r\n#include \"http.h\"\r\n#include \"rtsp.h\"\r\n#include \"wildcard.h\"\r\n\r\n#ifdef HAVE_GSSAPI\r\n# ifdef HAVE_GSSGNU\r\n#  include <gss.h>\r\n# elif defined HAVE_GSSMIT\r\n#  include <gssapi/gssapi.h>\r\n#  include <gssapi/gssapi_generic.h>\r\n# else\r\n#  include <gssapi.h>\r\n# endif\r\n#endif\r\n\r\n#ifdef HAVE_LIBSSH2_H\r\n#include <libssh2.h>\r\n#include <libssh2_sftp.h>\r\n#endif /* HAVE_LIBSSH2_H */\r\n\r\n/* Download buffer size, keep it fairly big for speed reasons */\r\n#undef BUFSIZE\r\n#define BUFSIZE CURL_MAX_WRITE_SIZE\r\n\r\n/* Initial size of the buffer to store headers in, it'll be enlarged in case\r\n   of need. */\r\n#define HEADERSIZE 256\r\n\r\n#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU\r\n\r\n/* Some convenience macros to get the larger/smaller value out of two given.\r\n   We prefix with CURL to prevent name collisions. */\r\n#define CURLMAX(x,y) ((x)>(y)?(x):(y))\r\n#define CURLMIN(x,y) ((x)<(y)?(x):(y))\r\n\r\n\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n/* Types needed for krb4/5-ftp connections */\r\nstruct krb4buffer {\r\n  void *data;\r\n  size_t size;\r\n  size_t index;\r\n  int eof_flag;\r\n};\r\n\r\nenum protection_level {\r\n  PROT_NONE, /* first in list */\r\n  PROT_CLEAR,\r\n  PROT_SAFE,\r\n  PROT_CONFIDENTIAL,\r\n  PROT_PRIVATE,\r\n  PROT_CMD,\r\n  PROT_LAST /* last in list */\r\n};\r\n#endif\r\n\r\n#ifdef USE_SCHANNEL\r\n/* Structs to store Schannel handles */\r\nstruct curl_schannel_cred {\r\n  CredHandle cred_handle;\r\n  TimeStamp time_stamp;\r\n  int refcount;\r\n};\r\n\r\nstruct curl_schannel_ctxt {\r\n  CtxtHandle ctxt_handle;\r\n  TimeStamp time_stamp;\r\n};\r\n#endif\r\n\r\n/* enum for the nonblocking SSL connection state machine */\r\ntypedef enum {\r\n  ssl_connect_1,\r\n  ssl_connect_2,\r\n  ssl_connect_2_reading,\r\n  ssl_connect_2_writing,\r\n  ssl_connect_3,\r\n  ssl_connect_done\r\n} ssl_connect_state;\r\n\r\ntypedef enum {\r\n  ssl_connection_none,\r\n  ssl_connection_negotiating,\r\n  ssl_connection_complete\r\n} ssl_connection_state;\r\n\r\n/* struct for data related to each SSL connection */\r\nstruct ssl_connect_data {\r\n  /* Use ssl encrypted communications TRUE/FALSE, not necessarily using it atm\r\n     but at least asked to or meaning to use it. See 'state' for the exact\r\n     current state of the connection. */\r\n  bool use;\r\n  ssl_connection_state state;\r\n#ifdef USE_SSLEAY\r\n  /* these ones requires specific SSL-types */\r\n  SSL_CTX* ctx;\r\n  SSL*     handle;\r\n  X509*    server_cert;\r\n  ssl_connect_state connecting_state;\r\n#endif /* USE_SSLEAY */\r\n#ifdef USE_GNUTLS\r\n  gnutls_session session;\r\n  gnutls_certificate_credentials cred;\r\n#ifdef USE_TLS_SRP\r\n  gnutls_srp_client_credentials srp_client_cred;\r\n#endif\r\n  ssl_connect_state connecting_state;\r\n#endif /* USE_GNUTLS */\r\n#ifdef USE_POLARSSL\r\n  havege_state hs;\r\n  ssl_context ssl;\r\n  ssl_session ssn;\r\n  int server_fd;\r\n  x509_cert cacert;\r\n  x509_cert clicert;\r\n  x509_crl crl;\r\n  rsa_context rsa;\r\n  ssl_connect_state connecting_state;\r\n#endif /* USE_POLARSSL */\r\n#ifdef USE_CYASSL\r\n  SSL_CTX* ctx;\r\n  SSL*     handle;\r\n  ssl_connect_state connecting_state;\r\n#endif /* USE_CYASSL */\r\n#ifdef USE_NSS\r\n  PRFileDesc *handle;\r\n  char *client_nickname;\r\n  struct SessionHandle *data;\r\n  struct curl_llist *obj_list;\r\n  PK11GenericObject *obj_clicert;\r\n#endif /* USE_NSS */\r\n#ifdef USE_QSOSSL\r\n  SSLHandle *handle;\r\n#endif /* USE_QSOSSL */\r\n#ifdef USE_AXTLS\r\n  SSL_CTX* ssl_ctx;\r\n  SSL*     ssl;\r\n#endif /* USE_AXTLS */\r\n#ifdef USE_SCHANNEL\r\n  struct curl_schannel_cred *cred;\r\n  struct curl_schannel_ctxt *ctxt;\r\n  SecPkgContext_StreamSizes stream_sizes;\r\n  ssl_connect_state connecting_state;\r\n  size_t encdata_length, decdata_length;\r\n  size_t encdata_offset, decdata_offset;\r\n  unsigned char *encdata_buffer, *decdata_buffer;\r\n  unsigned long req_flags, ret_flags;\r\n#endif /* USE_SCHANNEL */\r\n#ifdef USE_DARWINSSL\r\n  SSLContextRef ssl_ctx;\r\n  curl_socket_t ssl_sockfd;\r\n  ssl_connect_state connecting_state;\r\n  bool ssl_direction; /* true if writing, false if reading */\r\n#endif /* USE_DARWINSSL */\r\n};\r\n\r\nstruct ssl_config_data {\r\n  long version;          /* what version the client wants to use */\r\n  long certverifyresult; /* result from the certificate verification */\r\n\r\n  bool verifypeer;       /* set TRUE if this is desired */\r\n  bool verifyhost;       /* set TRUE if CN/SAN must match hostname */\r\n  char *CApath;          /* certificate dir (doesn't work on windows) */\r\n  char *CAfile;          /* certificate to verify peer against */\r\n  const char *CRLfile;   /* CRL to check certificate revocation */\r\n  const char *issuercert;/* optional issuer certificate filename */\r\n  char *random_file;     /* path to file containing \"random\" data */\r\n  char *egdsocket;       /* path to file containing the EGD daemon socket */\r\n  char *cipher_list;     /* list of ciphers to use */\r\n  size_t max_ssl_sessions; /* SSL session id cache size */\r\n  curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */\r\n  void *fsslctxp;        /* parameter for call back */\r\n  bool sessionid;        /* cache session IDs or not */\r\n  bool certinfo;         /* gather lots of certificate info */\r\n\r\n#ifdef USE_TLS_SRP\r\n  char *username; /* TLS username (for, e.g., SRP) */\r\n  char *password; /* TLS password (for, e.g., SRP) */\r\n  enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */\r\n#endif\r\n};\r\n\r\n/* information stored about one single SSL session */\r\nstruct curl_ssl_session {\r\n  char *name;       /* host name for which this ID was used */\r\n  void *sessionid;  /* as returned from the SSL layer */\r\n  size_t idsize;    /* if known, otherwise 0 */\r\n  long age;         /* just a number, the higher the more recent */\r\n  unsigned short remote_port; /* remote port to connect to */\r\n  struct ssl_config_data ssl_config; /* setup for this session */\r\n};\r\n\r\n/* Struct used for Digest challenge-response authentication */\r\nstruct digestdata {\r\n  char *nonce;\r\n  char *cnonce;\r\n  char *realm;\r\n  int algo;\r\n  bool stale; /* set true for re-negotiation */\r\n  char *opaque;\r\n  char *qop;\r\n  char *algorithm;\r\n  int nc; /* nounce count */\r\n};\r\n\r\ntypedef enum {\r\n  NTLMSTATE_NONE,\r\n  NTLMSTATE_TYPE1,\r\n  NTLMSTATE_TYPE2,\r\n  NTLMSTATE_TYPE3,\r\n  NTLMSTATE_LAST\r\n} curlntlm;\r\n\r\n#ifdef USE_WINDOWS_SSPI\r\n#include \"curl_sspi.h\"\r\n#endif\r\n\r\n#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)\r\n#include <iconv.h>\r\n#endif\r\n\r\n/* Struct used for NTLM challenge-response authentication */\r\nstruct ntlmdata {\r\n  curlntlm state;\r\n#ifdef USE_WINDOWS_SSPI\r\n  CredHandle handle;\r\n  CtxtHandle c_handle;\r\n  SEC_WINNT_AUTH_IDENTITY identity;\r\n  SEC_WINNT_AUTH_IDENTITY *p_identity;\r\n  int has_handles;\r\n  void *type_2;\r\n  unsigned long n_type_2;\r\n#else\r\n  unsigned int flags;\r\n  unsigned char nonce[8];\r\n#endif\r\n};\r\n\r\n#ifdef USE_HTTP_NEGOTIATE\r\nstruct negotiatedata {\r\n  /* when doing Negotiate we first need to receive an auth token and then we\r\n     need to send our header */\r\n  enum { GSS_AUTHNONE, GSS_AUTHRECV, GSS_AUTHSENT } state;\r\n  bool gss; /* Whether we're processing GSS-Negotiate or Negotiate */\r\n  const char* protocol; /* \"GSS-Negotiate\" or \"Negotiate\" */\r\n#ifdef HAVE_GSSAPI\r\n  OM_uint32 status;\r\n  gss_ctx_id_t context;\r\n  gss_name_t server_name;\r\n  gss_buffer_desc output_token;\r\n#else\r\n#ifdef USE_WINDOWS_SSPI\r\n  DWORD status;\r\n  CtxtHandle *context;\r\n  CredHandle *credentials;\r\n  char server_name[1024];\r\n  size_t max_token_length;\r\n  BYTE *output_token;\r\n  size_t output_token_length;\r\n#endif\r\n#endif\r\n};\r\n#endif\r\n\r\n\r\n/*\r\n * Boolean values that concerns this connection.\r\n */\r\nstruct ConnectBits {\r\n  bool close; /* if set, we close the connection after this request */\r\n  bool reuse; /* if set, this is a re-used connection */\r\n  bool proxy; /* if set, this transfer is done through a proxy - any type */\r\n  bool httpproxy;    /* if set, this transfer is done through a http proxy */\r\n  bool user_passwd;    /* do we use user+password for this connection? */\r\n  bool proxy_user_passwd; /* user+password for the proxy? */\r\n  bool ipv6_ip; /* we communicate with a remote site specified with pure IPv6\r\n                   IP address */\r\n  bool ipv6;    /* we communicate with a site using an IPv6 address */\r\n\r\n  bool do_more; /* this is set TRUE if the ->curl_do_more() function is\r\n                   supposed to be called, after ->curl_do() */\r\n  bool tcpconnect[2]; /* the TCP layer (or similar) is connected, this is set\r\n                         the first time on the first connect function call */\r\n  bool protoconnstart;/* the protocol layer has STARTED its operation after\r\n                         the TCP layer connect */\r\n\r\n  bool retry;         /* this connection is about to get closed and then\r\n                         re-attempted at another connection. */\r\n  bool tunnel_proxy;  /* if CONNECT is used to \"tunnel\" through the proxy.\r\n                         This is implicit when SSL-protocols are used through\r\n                         proxies, but can also be enabled explicitly by\r\n                         apps */\r\n  bool authneg;       /* TRUE when the auth phase has started, which means\r\n                         that we are creating a request with an auth header,\r\n                         but it is not the final request in the auth\r\n                         negotiation. */\r\n  bool rewindaftersend;/* TRUE when the sending couldn't be stopped even\r\n                          though it will be discarded. When the whole send\r\n                          operation is done, we must call the data rewind\r\n                          callback. */\r\n  bool ftp_use_epsv;  /* As set with CURLOPT_FTP_USE_EPSV, but if we find out\r\n                         EPSV doesn't work we disable it for the forthcoming\r\n                         requests */\r\n\r\n  bool ftp_use_eprt;  /* As set with CURLOPT_FTP_USE_EPRT, but if we find out\r\n                         EPRT doesn't work we disable it for the forthcoming\r\n                         requests */\r\n  bool netrc;         /* name+password provided by netrc */\r\n  bool userpwd_in_url; /* name+password found in url */\r\n\r\n  bool done;          /* set to FALSE when Curl_do() is called and set to TRUE\r\n                         when Curl_done() is called, to prevent Curl_done() to\r\n                         get invoked twice when the multi interface is\r\n                         used. */\r\n  bool stream_was_rewound; /* Indicates that the stream was rewound after a\r\n                              request read past the end of its response byte\r\n                              boundary */\r\n  bool proxy_connect_closed; /* set true if a proxy disconnected the\r\n                                connection in a CONNECT request with auth, so\r\n                                that libcurl should reconnect and continue. */\r\n  bool bound; /* set true if bind() has already been done on this socket/\r\n                 connection */\r\n  bool type_set;  /* type= was used in the URL */\r\n};\r\n\r\nstruct hostname {\r\n  char *rawalloc; /* allocated \"raw\" version of the name */\r\n  char *encalloc; /* allocated IDN-encoded version of the name */\r\n  char *name;     /* name to use internally, might be encoded, might be raw */\r\n  const char *dispname; /* name to display, as 'name' might be encoded */\r\n};\r\n\r\n/*\r\n * Flags on the keepon member of the Curl_transfer_keeper\r\n */\r\n\r\n#define KEEP_NONE  0\r\n#define KEEP_RECV  (1<<0)     /* there is or may be data to read */\r\n#define KEEP_SEND (1<<1)     /* there is or may be data to write */\r\n#define KEEP_RECV_HOLD (1<<2) /* when set, no reading should be done but there\r\n                                 might still be data to read */\r\n#define KEEP_SEND_HOLD (1<<3) /* when set, no writing should be done but there\r\n                                  might still be data to write */\r\n#define KEEP_RECV_PAUSE (1<<4) /* reading is paused */\r\n#define KEEP_SEND_PAUSE (1<<5) /* writing is paused */\r\n\r\n#define KEEP_RECVBITS (KEEP_RECV | KEEP_RECV_HOLD | KEEP_RECV_PAUSE)\r\n#define KEEP_SENDBITS (KEEP_SEND | KEEP_SEND_HOLD | KEEP_SEND_PAUSE)\r\n\r\n\r\n#ifdef HAVE_LIBZ\r\ntypedef enum {\r\n  ZLIB_UNINIT,          /* uninitialized */\r\n  ZLIB_INIT,            /* initialized */\r\n  ZLIB_GZIP_HEADER,     /* reading gzip header */\r\n  ZLIB_GZIP_INFLATING,  /* inflating gzip stream */\r\n  ZLIB_INIT_GZIP        /* initialized in transparent gzip mode */\r\n} zlibInitState;\r\n#endif\r\n\r\n#ifdef CURLRES_ASYNCH\r\nstruct Curl_async {\r\n  char *hostname;\r\n  int port;\r\n  struct Curl_dns_entry *dns;\r\n  bool done;  /* set TRUE when the lookup is complete */\r\n  int status; /* if done is TRUE, this is the status from the callback */\r\n  void *os_specific;  /* 'struct thread_data' for Windows */\r\n};\r\n#endif\r\n\r\n#define FIRSTSOCKET     0\r\n#define SECONDARYSOCKET 1\r\n\r\n/* These function pointer types are here only to allow easier typecasting\r\n   within the source when we need to cast between data pointers (such as NULL)\r\n   and function pointers. */\r\ntypedef CURLcode (*Curl_do_more_func)(struct connectdata *, bool *);\r\ntypedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode, bool);\r\n\r\n\r\nenum expect100 {\r\n  EXP100_SEND_DATA,           /* enough waiting, just send the body now */\r\n  EXP100_AWAITING_CONTINUE,   /* waiting for the 100 Continue header */\r\n  EXP100_SENDING_REQUEST,     /* still sending the request but will wait for\r\n                                 the 100 header once done with the request */\r\n  EXP100_FAILED               /* used on 417 Expectation Failed */\r\n};\r\n\r\n/*\r\n * Request specific data in the easy handle (SessionHandle).  Previously,\r\n * these members were on the connectdata struct but since a conn struct may\r\n * now be shared between different SessionHandles, we store connection-specific\r\n * data here. This struct only keeps stuff that's interesting for *this*\r\n * request, as it will be cleared between multiple ones\r\n */\r\nstruct SingleRequest {\r\n  curl_off_t size;        /* -1 if unknown at this point */\r\n  curl_off_t *bytecountp; /* return number of bytes read or NULL */\r\n\r\n  curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch,\r\n                             -1 means unlimited */\r\n  curl_off_t *writebytecountp; /* return number of bytes written or NULL */\r\n\r\n  curl_off_t bytecount;         /* total number of bytes read */\r\n  curl_off_t writebytecount;    /* number of bytes written */\r\n\r\n  long headerbytecount;         /* only count received headers */\r\n  long deductheadercount; /* this amount of bytes doesn't count when we check\r\n                             if anything has been transferred at the end of a\r\n                             connection. We use this counter to make only a\r\n                             100 reply (without a following second response\r\n                             code) result in a CURLE_GOT_NOTHING error code */\r\n\r\n  struct timeval start;         /* transfer started at this time */\r\n  struct timeval now;           /* current time */\r\n  bool header;                  /* incoming data has HTTP header */\r\n  enum {\r\n    HEADER_NORMAL,              /* no bad header at all */\r\n    HEADER_PARTHEADER,          /* part of the chunk is a bad header, the rest\r\n                                   is normal data */\r\n    HEADER_ALLBAD               /* all was believed to be header */\r\n  } badheader;                  /* the header was deemed bad and will be\r\n                                   written as body */\r\n  int headerline;               /* counts header lines to better track the\r\n                                   first one */\r\n  char *hbufp;                  /* points at *end* of header line */\r\n  size_t hbuflen;\r\n  char *str;                    /* within buf */\r\n  char *str_start;              /* within buf */\r\n  char *end_ptr;                /* within buf */\r\n  char *p;                      /* within headerbuff */\r\n  bool content_range;           /* set TRUE if Content-Range: was found */\r\n  curl_off_t offset;            /* possible resume offset read from the\r\n                                   Content-Range: header */\r\n  int httpcode;                 /* error code from the 'HTTP/1.? XXX' or\r\n                                   'RTSP/1.? XXX' line */\r\n  struct timeval start100;      /* time stamp to wait for the 100 code from */\r\n  enum expect100 exp100;        /* expect 100 continue state */\r\n\r\n  int auto_decoding;            /* What content encoding. sec 3.5, RFC2616. */\r\n\r\n#define IDENTITY 0              /* No encoding */\r\n#define DEFLATE 1               /* zlib deflate [RFC 1950 & 1951] */\r\n#define GZIP 2                  /* gzip algorithm [RFC 1952] */\r\n#define COMPRESS 3              /* Not handled, added for completeness */\r\n\r\n#ifdef HAVE_LIBZ\r\n  zlibInitState zlib_init;      /* possible zlib init state;\r\n                                   undefined if Content-Encoding header. */\r\n  z_stream z;                   /* State structure for zlib. */\r\n#endif\r\n\r\n  time_t timeofdoc;\r\n  long bodywrites;\r\n\r\n  char *buf;\r\n  char *uploadbuf;\r\n  curl_socket_t maxfd;\r\n\r\n  int keepon;\r\n\r\n  bool upload_done; /* set to TRUE when doing chunked transfer-encoding upload\r\n                       and we're uploading the last chunk */\r\n\r\n  bool ignorebody;  /* we read a response-body but we ignore it! */\r\n  bool ignorecl;    /* This HTTP response has no body so we ignore the Content-\r\n                       Length: header */\r\n\r\n  char *location;   /* This points to an allocated version of the Location:\r\n                       header data */\r\n  char *newurl;     /* Set to the new URL to use when a redirect or a retry is\r\n                       wanted */\r\n\r\n  /* 'upload_present' is used to keep a byte counter of how much data there is\r\n     still left in the buffer, aimed for upload. */\r\n  ssize_t upload_present;\r\n\r\n   /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a\r\n      buffer, so the next read should read from where this pointer points to,\r\n      and the 'upload_present' contains the number of bytes available at this\r\n      position */\r\n  char *upload_fromhere;\r\n\r\n  bool chunk; /* if set, this is a chunked transfer-encoding */\r\n  bool upload_chunky; /* set TRUE if we are doing chunked transfer-encoding\r\n                         on upload */\r\n  bool getheader;     /* TRUE if header parsing is wanted */\r\n\r\n  bool forbidchunk;   /* used only to explicitly forbid chunk-upload for\r\n                         specific upload buffers. See readmoredata() in\r\n                         http.c for details. */\r\n};\r\n\r\n/*\r\n * Specific protocol handler.\r\n */\r\n\r\nstruct Curl_handler {\r\n  const char * scheme;        /* URL scheme name. */\r\n\r\n  /* Complement to setup_connection_internals(). */\r\n  CURLcode (*setup_connection)(struct connectdata *);\r\n\r\n  /* These two functions MUST be set to be protocol dependent */\r\n  CURLcode (*do_it)(struct connectdata *, bool *done);\r\n  Curl_done_func done;\r\n\r\n  /* If the curl_do() function is better made in two halves, this\r\n   * curl_do_more() function will be called afterwards, if set. For example\r\n   * for doing the FTP stuff after the PASV/PORT command.\r\n   */\r\n  Curl_do_more_func do_more;\r\n\r\n  /* This function *MAY* be set to a protocol-dependent function that is run\r\n   * after the connect() and everything is done, as a step in the connection.\r\n   * The 'done' pointer points to a bool that should be set to TRUE if the\r\n   * function completes before return. If it doesn't complete, the caller\r\n   * should call the curl_connecting() function until it is.\r\n   */\r\n  CURLcode (*connect_it)(struct connectdata *, bool *done);\r\n\r\n  /* See above. Currently only used for FTP. */\r\n  CURLcode (*connecting)(struct connectdata *, bool *done);\r\n  CURLcode (*doing)(struct connectdata *, bool *done);\r\n\r\n  /* Called from the multi interface during the PROTOCONNECT phase, and it\r\n     should then return a proper fd set */\r\n  int (*proto_getsock)(struct connectdata *conn,\r\n                       curl_socket_t *socks,\r\n                       int numsocks);\r\n\r\n  /* Called from the multi interface during the DOING phase, and it should\r\n     then return a proper fd set */\r\n  int (*doing_getsock)(struct connectdata *conn,\r\n                       curl_socket_t *socks,\r\n                       int numsocks);\r\n\r\n  /* Called from the multi interface during the DO_MORE phase, and it should\r\n     then return a proper fd set */\r\n  int (*domore_getsock)(struct connectdata *conn,\r\n                        curl_socket_t *socks,\r\n                        int numsocks);\r\n\r\n  /* Called from the multi interface during the DO_DONE, PERFORM and\r\n     WAITPERFORM phases, and it should then return a proper fd set. Not setting\r\n     this will make libcurl use the generic default one. */\r\n  int (*perform_getsock)(const struct connectdata *conn,\r\n                         curl_socket_t *socks,\r\n                         int numsocks);\r\n\r\n  /* This function *MAY* be set to a protocol-dependent function that is run\r\n   * by the curl_disconnect(), as a step in the disconnection.  If the handler\r\n   * is called because the connection has been considered dead, dead_connection\r\n   * is set to TRUE.\r\n   */\r\n  CURLcode (*disconnect)(struct connectdata *, bool dead_connection);\r\n\r\n  /* If used, this function gets called from transfer.c:readwrite_data() to\r\n     allow the protocol to do extra reads/writes */\r\n  CURLcode (*readwrite)(struct SessionHandle *data, struct connectdata *conn,\r\n                        ssize_t *nread, bool *readmore);\r\n\r\n  long defport;           /* Default port. */\r\n  unsigned int protocol;  /* See CURLPROTO_*  */\r\n  unsigned int flags;     /* Extra particular characteristics, see PROTOPT_* */\r\n};\r\n\r\n#define PROTOPT_NONE 0             /* nothing extra */\r\n#define PROTOPT_SSL (1<<0)         /* uses SSL */\r\n#define PROTOPT_DUAL (1<<1)        /* this protocol uses two connections */\r\n#define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */\r\n/* some protocols will have to call the underlying functions without regard to\r\n   what exact state the socket signals. IE even if the socket says \"readable\",\r\n   the send function might need to be called while uploading, or vice versa.\r\n*/\r\n#define PROTOPT_DIRLOCK (1<<3)\r\n#define PROTOPT_NONETWORK (1<<4)   /* protocol doesn't use the network! */\r\n#define PROTOPT_NEEDSPWD (1<<5)    /* needs a password, and if none is set it\r\n                                      gets a default */\r\n#define PROTOPT_NOURLQUERY (1<<6)   /* protocol can't handle\r\n                                        url query strings (?foo=bar) ! */\r\n\r\n\r\n/* return the count of bytes sent, or -1 on error */\r\ntypedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */\r\n                            int sockindex,            /* socketindex */\r\n                            const void *buf,          /* data to write */\r\n                            size_t len,               /* max amount to write */\r\n                            CURLcode *err);           /* error to return */\r\n\r\n/* return the count of bytes read, or -1 on error */\r\ntypedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */\r\n                            int sockindex,            /* socketindex */\r\n                            char *buf,                /* store data here */\r\n                            size_t len,               /* max amount to read */\r\n                            CURLcode *err);           /* error to return */\r\n\r\n/*\r\n * The connectdata struct contains all fields and variables that should be\r\n * unique for an entire connection.\r\n */\r\nstruct connectdata {\r\n  /* 'data' is the CURRENT SessionHandle using this connection -- take great\r\n     caution that this might very well vary between different times this\r\n     connection is used! */\r\n  struct SessionHandle *data;\r\n\r\n  /* chunk is for HTTP chunked encoding, but is in the general connectdata\r\n     struct only because we can do just about any protocol through a HTTP proxy\r\n     and a HTTP proxy may in fact respond using chunked encoding */\r\n  struct Curl_chunker chunk;\r\n\r\n  curl_closesocket_callback fclosesocket; /* function closing the socket(s) */\r\n  void *closesocket_client;\r\n\r\n  bool inuse; /* This is a marker for the connection cache logic. If this is\r\n                 TRUE this handle is being used by an easy handle and cannot\r\n                 be used by any other easy handle without careful\r\n                 consideration (== only for pipelining). */\r\n\r\n  /**** Fields set when inited and not modified again */\r\n  long connection_id; /* Contains a unique number to make it easier to\r\n                         track the connections in the log output */\r\n\r\n  /* 'dns_entry' is the particular host we use. This points to an entry in the\r\n     DNS cache and it will not get pruned while locked. It gets unlocked in\r\n     Curl_done(). This entry will be NULL if the connection is re-used as then\r\n     there is no name resolve done. */\r\n  struct Curl_dns_entry *dns_entry;\r\n\r\n  /* 'ip_addr' is the particular IP we connected to. It points to a struct\r\n     within the DNS cache, so this pointer is only valid as long as the DNS\r\n     cache entry remains locked. It gets unlocked in Curl_done() */\r\n  Curl_addrinfo *ip_addr;\r\n\r\n  /* 'ip_addr_str' is the ip_addr data as a human readable string.\r\n     It remains available as long as the connection does, which is longer than\r\n     the ip_addr itself. */\r\n  char ip_addr_str[MAX_IPADR_LEN];\r\n\r\n  unsigned int scope;    /* address scope for IPv6 */\r\n\r\n  int socktype;  /* SOCK_STREAM or SOCK_DGRAM */\r\n\r\n  struct hostname host;\r\n  struct hostname proxy;\r\n\r\n  long port;       /* which port to use locally */\r\n  unsigned short remote_port; /* what remote port to connect to,\r\n                                 not the proxy port! */\r\n\r\n  /* 'primary_ip' and 'primary_port' get filled with peer's numerical\r\n     ip address and port number whenever an outgoing connection is\r\n     *attempted* from the primary socket to a remote address. When more\r\n     than one address is tried for a connection these will hold data\r\n     for the last attempt. When the connection is actually established\r\n     these are updated with data which comes directly from the socket. */\r\n\r\n  char primary_ip[MAX_IPADR_LEN];\r\n  long primary_port;\r\n\r\n  /* 'local_ip' and 'local_port' get filled with local's numerical\r\n     ip address and port number whenever an outgoing connection is\r\n     **established** from the primary socket to a remote address. */\r\n\r\n  char local_ip[MAX_IPADR_LEN];\r\n  long local_port;\r\n\r\n  char *user;    /* user name string, allocated */\r\n  char *passwd;  /* password string, allocated */\r\n\r\n  char *proxyuser;    /* proxy user name string, allocated */\r\n  char *proxypasswd;  /* proxy password string, allocated */\r\n  curl_proxytype proxytype; /* what kind of proxy that is in use */\r\n\r\n  int httpversion;        /* the HTTP version*10 reported by the server */\r\n  int rtspversion;        /* the RTSP version*10 reported by the server */\r\n\r\n  struct timeval now;     /* \"current\" time */\r\n  struct timeval created; /* creation time */\r\n  curl_socket_t sock[2]; /* two sockets, the second is used for the data\r\n                            transfer when doing FTP */\r\n  bool sock_accepted[2]; /* TRUE if the socket on this index was created with\r\n                            accept() */\r\n  Curl_recv *recv[2];\r\n  Curl_send *send[2];\r\n\r\n  struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */\r\n  struct ssl_config_data ssl_config;\r\n\r\n  struct ConnectBits bits;    /* various state-flags for this connection */\r\n\r\n /* connecttime: when connect() is called on the current IP address. Used to\r\n    be able to track when to move on to try next IP - but only when the multi\r\n    interface is used. */\r\n  struct timeval connecttime;\r\n  /* The two fields below get set in Curl_connecthost */\r\n  int num_addr; /* number of addresses to try to connect to */\r\n  long timeoutms_per_addr; /* how long time in milliseconds to spend on\r\n                              trying to connect to each IP address */\r\n\r\n  const struct Curl_handler *handler; /* Connection's protocol handler */\r\n  const struct Curl_handler *given;   /* The protocol first given */\r\n\r\n  long ip_version; /* copied from the SessionHandle at creation time */\r\n\r\n  /**** curl_get() phase fields */\r\n\r\n  curl_socket_t sockfd;   /* socket to read from or CURL_SOCKET_BAD */\r\n  curl_socket_t writesockfd; /* socket to write to, it may very\r\n                                well be the same we read from.\r\n                                CURL_SOCKET_BAD disables */\r\n\r\n  /** Dynamicly allocated strings, MUST be freed before this **/\r\n  /** struct is killed.                                      **/\r\n  struct dynamically_allocated_data {\r\n    char *proxyuserpwd;\r\n    char *uagent;\r\n    char *accept_encoding;\r\n    char *userpwd;\r\n    char *rangeline;\r\n    char *ref;\r\n    char *host;\r\n    char *cookiehost;\r\n    char *rtsp_transport;\r\n    char *te; /* TE: request header */\r\n  } allocptr;\r\n\r\n  int sec_complete; /* if kerberos is enabled for this connection */\r\n#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)\r\n  enum protection_level command_prot;\r\n  enum protection_level data_prot;\r\n  enum protection_level request_data_prot;\r\n  size_t buffer_size;\r\n  struct krb4buffer in_buffer;\r\n  void *app_data;\r\n  const struct Curl_sec_client_mech *mech;\r\n  struct sockaddr_in local_addr;\r\n#endif\r\n\r\n  /* the two following *_inuse fields are only flags, not counters in any way.\r\n     If TRUE it means the channel is in use, and if FALSE it means the channel\r\n     is up for grabs by one. */\r\n\r\n  bool readchannel_inuse;  /* whether the read channel is in use by an easy\r\n                              handle */\r\n  bool writechannel_inuse; /* whether the write channel is in use by an easy\r\n                              handle */\r\n  bool server_supports_pipelining; /* TRUE if server supports pipelining,\r\n                                      set after first response */\r\n  struct curl_llist *send_pipe; /* List of handles waiting to\r\n                                   send on this pipeline */\r\n  struct curl_llist *recv_pipe; /* List of handles waiting to read\r\n                                   their responses on this pipeline */\r\n  struct curl_llist *pend_pipe; /* List of pending handles on\r\n                                   this pipeline */\r\n  struct curl_llist *done_pipe; /* Handles that are finished, but\r\n                                   still reference this connectdata */\r\n#define MAX_PIPELINE_LENGTH 5\r\n  char* master_buffer; /* The master buffer allocated on-demand;\r\n                          used for pipelining. */\r\n  size_t read_pos; /* Current read position in the master buffer */\r\n  size_t buf_len; /* Length of the buffer?? */\r\n\r\n\r\n  curl_seek_callback seek_func; /* function that seeks the input */\r\n  void *seek_client;            /* pointer to pass to the seek() above */\r\n\r\n  /*************** Request - specific items ************/\r\n\r\n  /* previously this was in the urldata struct */\r\n  curl_read_callback fread_func; /* function that reads the input */\r\n  void *fread_in;           /* pointer to pass to the fread() above */\r\n\r\n  struct ntlmdata ntlm;     /* NTLM differs from other authentication schemes\r\n                               because it authenticates connections, not\r\n                               single requests! */\r\n  struct ntlmdata proxyntlm; /* NTLM data for proxy */\r\n\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n  /* used for communication with Samba's winbind daemon helper ntlm_auth */\r\n  curl_socket_t ntlm_auth_hlpr_socket;\r\n  pid_t ntlm_auth_hlpr_pid;\r\n  char* challenge_header;\r\n  char* response_header;\r\n#endif\r\n\r\n  char syserr_buf [256]; /* buffer for Curl_strerror() */\r\n\r\n#ifdef CURLRES_ASYNCH\r\n  /* data used for the asynch name resolve callback */\r\n  struct Curl_async async;\r\n#endif\r\n\r\n  /* These three are used for chunked-encoding trailer support */\r\n  char *trailer; /* allocated buffer to store trailer in */\r\n  int trlMax;    /* allocated buffer size */\r\n  int trlPos;    /* index of where to store data */\r\n\r\n  union {\r\n    struct ftp_conn ftpc;\r\n    struct ssh_conn sshc;\r\n    struct tftp_state_data *tftpc;\r\n    struct imap_conn imapc;\r\n    struct pop3_conn pop3c;\r\n    struct smtp_conn smtpc;\r\n    struct rtsp_conn rtspc;\r\n    void *generic;\r\n  } proto;\r\n\r\n  int cselect_bits; /* bitmask of socket events */\r\n  int waitfor;      /* current READ/WRITE bits to wait for */\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  int socks5_gssapi_enctype;\r\n#endif\r\n\r\n  bool verifypeer;\r\n  bool verifyhost;\r\n\r\n  /* When this connection is created, store the conditions for the local end\r\n     bind. This is stored before the actual bind and before any connection is\r\n     made and will serve the purpose of being used for comparison reasons so\r\n     that subsequent bound-requested connections aren't accidentally re-using\r\n     wrong connections. */\r\n  char *localdev;\r\n  unsigned short localport;\r\n  int localportrange;\r\n\r\n  /* tunnel as in tunnel through a HTTP proxy with CONNECT */\r\n  enum {\r\n    TUNNEL_INIT,    /* init/default/no tunnel state */\r\n    TUNNEL_CONNECT, /* CONNECT has been sent off */\r\n    TUNNEL_COMPLETE /* CONNECT response received completely */\r\n  } tunnel_state[2]; /* two separate ones to allow FTP */\r\n\r\n   struct connectbundle *bundle; /* The bundle we are member of */\r\n};\r\n\r\n/* The end of connectdata. */\r\n\r\n/*\r\n * Struct to keep statistical and informational data.\r\n */\r\nstruct PureInfo {\r\n  int httpcode;  /* Recent HTTP, FTP, or RTSP response code */\r\n  int httpproxycode; /* response code from proxy when received separate */\r\n  int httpversion; /* the http version number X.Y = X*10+Y */\r\n  long filetime; /* If requested, this is might get set. Set to -1 if the time\r\n                    was unretrievable. We cannot have this of type time_t,\r\n                    since time_t is unsigned on several platforms such as\r\n                    OpenVMS. */\r\n  bool timecond;  /* set to TRUE if the time condition didn't match, which\r\n                     thus made the document NOT get fetched */\r\n  long header_size;  /* size of read header(s) in bytes */\r\n  long request_size; /* the amount of bytes sent in the request(s) */\r\n  unsigned long proxyauthavail; /* what proxy auth types were announced */\r\n  unsigned long httpauthavail;  /* what host auth types were announced */\r\n  long numconnects; /* how many new connection did libcurl created */\r\n  char *contenttype; /* the content type of the object */\r\n  char *wouldredirect; /* URL this would've been redirected to if asked to */\r\n\r\n  /* PureInfo members 'conn_primary_ip', 'conn_primary_port', 'conn_local_ip'\r\n     and, 'conn_local_port' are copied over from the connectdata struct in\r\n     order to allow curl_easy_getinfo() to return this information even when\r\n     the session handle is no longer associated with a connection, and also\r\n     allow curl_easy_reset() to clear this information from the session handle\r\n     without disturbing information which is still alive, and that might be\r\n     reused, in the connection cache. */\r\n\r\n  char conn_primary_ip[MAX_IPADR_LEN];\r\n  long conn_primary_port;\r\n\r\n  char conn_local_ip[MAX_IPADR_LEN];\r\n  long conn_local_port;\r\n\r\n  struct curl_certinfo certs; /* info about the certs, only populated in\r\n                                 OpenSSL builds. Asked for with\r\n                                 CURLOPT_CERTINFO / CURLINFO_CERTINFO */\r\n};\r\n\r\n\r\nstruct Progress {\r\n  long lastshow; /* time() of the last displayed progress meter or NULL to\r\n                    force redraw at next call */\r\n  curl_off_t size_dl; /* total expected size */\r\n  curl_off_t size_ul; /* total expected size */\r\n  curl_off_t downloaded; /* transferred so far */\r\n  curl_off_t uploaded; /* transferred so far */\r\n\r\n  curl_off_t current_speed; /* uses the currently fastest transfer */\r\n\r\n  bool callback;  /* set when progress callback is used */\r\n  int width; /* screen width at download start */\r\n  int flags; /* see progress.h */\r\n\r\n  double timespent;\r\n\r\n  curl_off_t dlspeed;\r\n  curl_off_t ulspeed;\r\n\r\n  double t_nslookup;\r\n  double t_connect;\r\n  double t_appconnect;\r\n  double t_pretransfer;\r\n  double t_starttransfer;\r\n  double t_redirect;\r\n\r\n  struct timeval start;\r\n  struct timeval t_startsingle;\r\n  struct timeval t_acceptdata;\r\n#define CURR_TIME (5+1) /* 6 entries for 5 seconds */\r\n\r\n  curl_off_t speeder[ CURR_TIME ];\r\n  struct timeval speeder_time[ CURR_TIME ];\r\n  int speeder_c;\r\n};\r\n\r\ntypedef enum {\r\n  HTTPREQ_NONE, /* first in list */\r\n  HTTPREQ_GET,\r\n  HTTPREQ_POST,\r\n  HTTPREQ_POST_FORM, /* we make a difference internally */\r\n  HTTPREQ_PUT,\r\n  HTTPREQ_HEAD,\r\n  HTTPREQ_CUSTOM,\r\n  HTTPREQ_LAST /* last in list */\r\n} Curl_HttpReq;\r\n\r\ntypedef enum {\r\n    RTSPREQ_NONE, /* first in list */\r\n    RTSPREQ_OPTIONS,\r\n    RTSPREQ_DESCRIBE,\r\n    RTSPREQ_ANNOUNCE,\r\n    RTSPREQ_SETUP,\r\n    RTSPREQ_PLAY,\r\n    RTSPREQ_PAUSE,\r\n    RTSPREQ_TEARDOWN,\r\n    RTSPREQ_GET_PARAMETER,\r\n    RTSPREQ_SET_PARAMETER,\r\n    RTSPREQ_RECORD,\r\n    RTSPREQ_RECEIVE,\r\n    RTSPREQ_LAST /* last in list */\r\n} Curl_RtspReq;\r\n\r\n/*\r\n * Values that are generated, temporary or calculated internally for a\r\n * \"session handle\" must be defined within the 'struct UrlState'.  This struct\r\n * will be used within the SessionHandle struct. When the 'SessionHandle'\r\n * struct is cloned, this data MUST NOT be copied.\r\n *\r\n * Remember that any \"state\" information goes globally for the curl handle.\r\n * Session-data MUST be put in the connectdata struct and here.  */\r\n#define MAX_CURL_USER_LENGTH 256\r\n#define MAX_CURL_PASSWORD_LENGTH 256\r\n#define MAX_CURL_USER_LENGTH_TXT \"255\"\r\n#define MAX_CURL_PASSWORD_LENGTH_TXT \"255\"\r\n\r\nstruct auth {\r\n  unsigned long want;  /* Bitmask set to the authentication methods wanted by\r\n                          app (with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */\r\n  unsigned long picked;\r\n  unsigned long avail; /* Bitmask for what the server reports to support for\r\n                          this resource */\r\n  bool done;  /* TRUE when the auth phase is done and ready to do the *actual*\r\n                 request */\r\n  bool multi; /* TRUE if this is not yet authenticated but within the auth\r\n                 multipass negotiation */\r\n  bool iestyle; /* TRUE if digest should be done IE-style or FALSE if it should\r\n                   be RFC compliant */\r\n};\r\n\r\nstruct UrlState {\r\n\r\n  /* Points to the connection cache */\r\n  struct conncache *conn_cache;\r\n\r\n  /* when curl_easy_perform() is called, the multi handle is \"owned\" by\r\n     the easy handle so curl_easy_cleanup() on such an easy handle will\r\n     also close the multi handle! */\r\n  bool multi_owned_by_easy;\r\n\r\n  /* buffers to store authentication data in, as parsed from input options */\r\n  struct timeval keeps_speed; /* for the progress meter really */\r\n\r\n  struct connectdata *pending_conn; /* This points to the connection we want\r\n                                       to open when we are waiting in the\r\n                                       CONNECT_PEND state in the multi\r\n                                       interface. This to avoid recreating it\r\n                                       when we enter the CONNECT state again.\r\n                                    */\r\n\r\n  struct connectdata *lastconnect; /* The last connection, NULL if undefined */\r\n\r\n  char *headerbuff; /* allocated buffer to store headers in */\r\n  size_t headersize;   /* size of the allocation */\r\n\r\n  char buffer[BUFSIZE+1]; /* download buffer */\r\n  char uploadbuffer[BUFSIZE+1]; /* upload buffer */\r\n  curl_off_t current_speed;  /* the ProgressShow() funcion sets this,\r\n                                bytes / second */\r\n  bool this_is_a_follow; /* this is a followed Location: request */\r\n\r\n  char *first_host; /* if set, this should be the host name that we will\r\n                       sent authorization to, no else. Used to make Location:\r\n                       following not keep sending user+password... This is\r\n                       strdup() data.\r\n                    */\r\n  struct curl_ssl_session *session; /* array of 'max_ssl_sessions' size */\r\n  long sessionage;                  /* number of the most recent session */\r\n  char *tempwrite;      /* allocated buffer to keep data in when a write\r\n                           callback returns to make the connection paused */\r\n  size_t tempwritesize; /* size of the 'tempwrite' allocated buffer */\r\n  int tempwritetype;    /* type of the 'tempwrite' buffer as a bitmask that is\r\n                           used with Curl_client_write() */\r\n  char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */\r\n  bool errorbuf; /* Set to TRUE if the error buffer is already filled in.\r\n                    This must be set to FALSE every time _easy_perform() is\r\n                    called. */\r\n  int os_errno;  /* filled in with errno whenever an error occurs */\r\n#ifdef HAVE_SIGNAL\r\n  /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */\r\n  void (*prev_signal)(int sig);\r\n#endif\r\n  bool allow_port; /* Is set.use_port allowed to take effect or not. This\r\n                      is always set TRUE when curl_easy_perform() is called. */\r\n  struct digestdata digest;      /* state data for host Digest auth */\r\n  struct digestdata proxydigest; /* state data for proxy Digest auth */\r\n\r\n#ifdef USE_HTTP_NEGOTIATE\r\n  struct negotiatedata negotiate; /* state data for host Negotiate auth */\r\n  struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */\r\n#endif\r\n\r\n  struct auth authhost;  /* auth details for host */\r\n  struct auth authproxy; /* auth details for proxy */\r\n\r\n  bool authproblem; /* TRUE if there's some problem authenticating */\r\n\r\n  void *resolver; /* resolver state, if it is used in the URL state -\r\n                     ares_channel f.e. */\r\n\r\n#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)\r\n  ENGINE *engine;\r\n#endif /* USE_SSLEAY */\r\n  struct timeval expiretime; /* set this with Curl_expire() only */\r\n  struct Curl_tree timenode; /* for the splay stuff */\r\n  struct curl_llist *timeoutlist; /* list of pending timeouts */\r\n\r\n  /* a place to store the most recently set FTP entrypath */\r\n  char *most_recent_ftp_entrypath;\r\n\r\n  /* set after initial USER failure, to prevent an authentication loop */\r\n  bool ftp_trying_alternative;\r\n\r\n  int httpversion;       /* the lowest HTTP version*10 reported by any server\r\n                            involved in this request */\r\n  bool expect100header;  /* TRUE if we added Expect: 100-continue */\r\n\r\n  bool pipe_broke; /* TRUE if the connection we were pipelined on broke\r\n                      and we need to restart from the beginning */\r\n\r\n#if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__) && \\\r\n    !defined(__SYMBIAN32__)\r\n/* do FTP line-end conversions on most platforms */\r\n#define CURL_DO_LINEEND_CONV\r\n  /* for FTP downloads: track CRLF sequences that span blocks */\r\n  bool prev_block_had_trailing_cr;\r\n  /* for FTP downloads: how many CRLFs did we converted to LFs? */\r\n  curl_off_t crlf_conversions;\r\n#endif\r\n  char *pathbuffer;/* allocated buffer to store the URL's path part in */\r\n  char *path;      /* path to use, points to somewhere within the pathbuffer\r\n                      area */\r\n  bool slash_removed; /* set TRUE if the 'path' points to a path where the\r\n                         initial URL slash separator has been taken off */\r\n  bool use_range;\r\n  bool rangestringalloc; /* the range string is malloc()'ed */\r\n\r\n  char *range; /* range, if used. See README for detailed specification on\r\n                  this syntax. */\r\n  curl_off_t resume_from; /* continue [ftp] transfer from here */\r\n\r\n  /* This RTSP state information survives requests and connections */\r\n  long rtsp_next_client_CSeq; /* the session's next client CSeq */\r\n  long rtsp_next_server_CSeq; /* the session's next server CSeq */\r\n  long rtsp_CSeq_recv; /* most recent CSeq received */\r\n\r\n  /* Protocol specific data.\r\n   *\r\n   *************************************************************************\r\n   * Note that this data will be REMOVED after each request, so anything that\r\n   * should be kept/stored on a per-connection basis and thus live for the\r\n   * next request on the same connection MUST be put in the connectdata struct!\r\n   *************************************************************************/\r\n  union {\r\n    struct HTTP *http;\r\n    struct HTTP *https;  /* alias, just for the sake of being more readable */\r\n    struct RTSP *rtsp;\r\n    struct FTP *ftp;\r\n    /* void *tftp;    not used */\r\n    struct FILEPROTO *file;\r\n    void *telnet;        /* private for telnet.c-eyes only */\r\n    void *generic;\r\n    struct SSHPROTO *ssh;\r\n    struct FTP *imap;\r\n    struct FTP *pop3;\r\n    struct FTP *smtp;\r\n  } proto;\r\n  /* current user of this SessionHandle instance, or NULL */\r\n  struct connectdata *current_conn;\r\n\r\n  /* if true, force SSL connection retry (workaround for certain servers) */\r\n  bool ssl_connect_retry;\r\n};\r\n\r\n\r\n/*\r\n * This 'DynamicStatic' struct defines dynamic states that actually change\r\n * values in the 'UserDefined' area, which MUST be taken into consideration\r\n * if the UserDefined struct is cloned or similar. You can probably just\r\n * copy these, but each one indicate a special action on other data.\r\n */\r\n\r\nstruct DynamicStatic {\r\n  char *url;        /* work URL, copied from UserDefined */\r\n  bool url_alloc;   /* URL string is malloc()'ed */\r\n  char *referer;    /* referer string */\r\n  bool referer_alloc; /* referer sting is malloc()ed */\r\n  struct curl_slist *cookielist; /* list of cookie files set by\r\n                                    curl_easy_setopt(COOKIEFILE) calls */\r\n  struct curl_slist *resolve; /* set to point to the set.resolve list when\r\n                                 this should be dealt with in pretransfer */\r\n};\r\n\r\n/*\r\n * This 'UserDefined' struct must only contain data that is set once to go\r\n * for many (perhaps) independent connections. Values that are generated or\r\n * calculated internally for the \"session handle\" MUST be defined within the\r\n * 'struct UrlState' instead. The only exceptions MUST note the changes in\r\n * the 'DynamicStatic' struct.\r\n * Character pointer fields point to dynamic storage, unless otherwise stated.\r\n */\r\nstruct Curl_one_easy; /* declared and used only in multi.c */\r\nstruct Curl_multi;    /* declared and used only in multi.c */\r\n\r\nenum dupstring {\r\n  STRING_CERT,            /* client certificate file name */\r\n  STRING_CERT_TYPE,       /* format for certificate (default: PEM)*/\r\n  STRING_COOKIE,          /* HTTP cookie string to send */\r\n  STRING_COOKIEJAR,       /* dump all cookies to this file */\r\n  STRING_CUSTOMREQUEST,   /* HTTP/FTP/RTSP request/method to use */\r\n  STRING_DEVICE,          /* local network interface/address to use */\r\n  STRING_ENCODING,        /* Accept-Encoding string */\r\n  STRING_FTP_ACCOUNT,     /* ftp account data */\r\n  STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */\r\n  STRING_FTPPORT,         /* port to send with the FTP PORT command */\r\n  STRING_KEY,             /* private key file name */\r\n  STRING_KEY_PASSWD,      /* plain text private key password */\r\n  STRING_KEY_TYPE,        /* format for private key (default: PEM) */\r\n  STRING_KRB_LEVEL,       /* krb security level */\r\n  STRING_NETRC_FILE,      /* if not NULL, use this instead of trying to find\r\n                             $HOME/.netrc */\r\n  STRING_COPYPOSTFIELDS,  /* if POST, set the fields' values here */\r\n  STRING_PROXY,           /* proxy to use */\r\n  STRING_SET_RANGE,       /* range, if used */\r\n  STRING_SET_REFERER,     /* custom string for the HTTP referer field */\r\n  STRING_SET_URL,         /* what original URL to work on */\r\n  STRING_SSL_CAPATH,      /* CA directory name (doesn't work on windows) */\r\n  STRING_SSL_CAFILE,      /* certificate file to verify peer against */\r\n  STRING_SSL_CIPHER_LIST, /* list of ciphers to use */\r\n  STRING_SSL_EGDSOCKET,   /* path to file containing the EGD daemon socket */\r\n  STRING_SSL_RANDOM_FILE, /* path to file containing \"random\" data */\r\n  STRING_USERAGENT,       /* User-Agent string */\r\n  STRING_SSL_CRLFILE,     /* crl file to check certificate */\r\n  STRING_SSL_ISSUERCERT,  /* issuer cert file to check certificate */\r\n  STRING_USERNAME,        /* <username>, if used */\r\n  STRING_PASSWORD,        /* <password>, if used */\r\n  STRING_PROXYUSERNAME,   /* Proxy <username>, if used */\r\n  STRING_PROXYPASSWORD,   /* Proxy <password>, if used */\r\n  STRING_NOPROXY,         /* List of hosts which should not use the proxy, if\r\n                             used */\r\n  STRING_RTSP_SESSION_ID, /* Session ID to use */\r\n  STRING_RTSP_STREAM_URI, /* Stream URI for this request */\r\n  STRING_RTSP_TRANSPORT,  /* Transport for this session */\r\n#ifdef USE_LIBSSH2\r\n  STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */\r\n  STRING_SSH_PUBLIC_KEY,  /* path to the public key file for auth */\r\n  STRING_SSH_HOST_PUBLIC_KEY_MD5, /* md5 of host public key in ascii hex */\r\n  STRING_SSH_KNOWNHOSTS,  /* file name of knownhosts file */\r\n#endif\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  STRING_SOCKS5_GSSAPI_SERVICE,  /* GSSAPI service name */\r\n#endif\r\n  STRING_MAIL_FROM,\r\n  STRING_MAIL_AUTH,\r\n\r\n#ifdef USE_TLS_SRP\r\n  STRING_TLSAUTH_USERNAME,     /* TLS auth <username> */\r\n  STRING_TLSAUTH_PASSWORD,     /* TLS auth <password> */\r\n#endif\r\n\r\n  /* -- end of strings -- */\r\n  STRING_LAST /* not used, just an end-of-list marker */\r\n};\r\n\r\nstruct UserDefined {\r\n  FILE *err;         /* the stderr user data goes here */\r\n  void *debugdata;   /* the data that will be passed to fdebug */\r\n  char *errorbuffer; /* (Static) store failure messages in here */\r\n  long proxyport; /* If non-zero, use this port number by default. If the\r\n                     proxy string features a \":[port]\" that one will override\r\n                     this. */\r\n  void *out;         /* the fetched file goes here */\r\n  void *in;          /* the uploaded file is read from here */\r\n  void *writeheader; /* write the header to this if non-NULL */\r\n  void *rtp_out;     /* write RTP to this if non-NULL */\r\n  long use_port;     /* which port to use (when not using default) */\r\n  unsigned long httpauth;  /* kind of HTTP authentication to use (bitmask) */\r\n  unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */\r\n  long followlocation; /* as in HTTP Location: */\r\n  long maxredirs;    /* maximum no. of http(s) redirects to follow, set to -1\r\n                        for infinity */\r\n\r\n  int keep_post;     /* keep POSTs as POSTs after a 30x request; each\r\n                        bit represents a request, from 301 to 303 */\r\n  bool free_referer; /* set TRUE if 'referer' points to a string we\r\n                        allocated */\r\n  void *postfields;  /* if POST, set the fields' values here */\r\n  curl_seek_callback seek_func;      /* function that seeks the input */\r\n  curl_off_t postfieldsize; /* if POST, this might have a size to use instead\r\n                               of strlen(), and then the data *may* be binary\r\n                               (contain zero bytes) */\r\n  unsigned short localport; /* local port number to bind to */\r\n  int localportrange; /* number of additional port numbers to test in case the\r\n                         'localport' one can't be bind()ed */\r\n  curl_write_callback fwrite_func;   /* function that stores the output */\r\n  curl_write_callback fwrite_header; /* function that stores headers */\r\n  curl_write_callback fwrite_rtp;    /* function that stores interleaved RTP */\r\n  curl_read_callback fread_func;     /* function that reads the input */\r\n  int is_fread_set; /* boolean, has read callback been set to non-NULL? */\r\n  int is_fwrite_set; /* boolean, has write callback been set to non-NULL? */\r\n  curl_progress_callback fprogress;  /* function for progress information */\r\n  curl_debug_callback fdebug;      /* function that write informational data */\r\n  curl_ioctl_callback ioctl_func;  /* function for I/O control */\r\n  curl_sockopt_callback fsockopt;  /* function for setting socket options */\r\n  void *sockopt_client; /* pointer to pass to the socket options callback */\r\n  curl_opensocket_callback fopensocket; /* function for checking/translating\r\n                                           the address and opening the\r\n                                           socket */\r\n  void* opensocket_client;\r\n  curl_closesocket_callback fclosesocket; /* function for closing the\r\n                                             socket */\r\n  void* closesocket_client;\r\n\r\n  void *seek_client;    /* pointer to pass to the seek callback */\r\n  /* the 3 curl_conv_callback functions below are used on non-ASCII hosts */\r\n  /* function to convert from the network encoding: */\r\n  curl_conv_callback convfromnetwork;\r\n  /* function to convert to the network encoding: */\r\n  curl_conv_callback convtonetwork;\r\n  /* function to convert from UTF-8 encoding: */\r\n  curl_conv_callback convfromutf8;\r\n\r\n  void *progress_client; /* pointer to pass to the progress callback */\r\n  void *ioctl_client;   /* pointer to pass to the ioctl callback */\r\n  long timeout;         /* in milliseconds, 0 means no timeout */\r\n  long connecttimeout;  /* in milliseconds, 0 means no timeout */\r\n  long accepttimeout;   /* in milliseconds, 0 means no timeout */\r\n  long server_response_timeout; /* in milliseconds, 0 means no timeout */\r\n  long tftp_blksize ; /* in bytes, 0 means use default */\r\n  curl_off_t infilesize;      /* size of file to upload, -1 means unknown */\r\n  long low_speed_limit; /* bytes/second */\r\n  long low_speed_time;  /* number of seconds */\r\n  curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */\r\n  curl_off_t max_recv_speed; /* high speed limit in bytes/second for\r\n                                download */\r\n  curl_off_t set_resume_from;  /* continue [ftp] transfer from here */\r\n  struct curl_slist *headers; /* linked list of extra headers */\r\n  struct curl_httppost *httppost;  /* linked list of POST data */\r\n  bool cookiesession;   /* new cookie session? */\r\n  bool crlf;            /* convert crlf on ftp upload(?) */\r\n  struct curl_slist *quote;     /* after connection is established */\r\n  struct curl_slist *postquote; /* after the transfer */\r\n  struct curl_slist *prequote; /* before the transfer, after type */\r\n  struct curl_slist *source_quote;  /* 3rd party quote */\r\n  struct curl_slist *source_prequote;  /* in 3rd party transfer mode - before\r\n                                          the transfer on source host */\r\n  struct curl_slist *source_postquote; /* in 3rd party transfer mode - after\r\n                                          the transfer on source host */\r\n  struct curl_slist *telnet_options; /* linked list of telnet options */\r\n  struct curl_slist *resolve;     /* list of names to add/remove from\r\n                                     DNS cache */\r\n  curl_TimeCond timecondition; /* kind of time/date comparison */\r\n  time_t timevalue;       /* what time to compare with */\r\n  Curl_HttpReq httpreq;   /* what kind of HTTP request (if any) is this */\r\n  long httpversion; /* when non-zero, a specific HTTP version requested to\r\n                       be used in the library's request(s) */\r\n  struct ssl_config_data ssl;  /* user defined SSL stuff */\r\n  curl_proxytype proxytype; /* what kind of proxy that is in use */\r\n  long dns_cache_timeout; /* DNS cache timeout */\r\n  long buffer_size;      /* size of receive buffer to use */\r\n  void *private_data; /* application-private data */\r\n\r\n  struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi\r\n                                     handle, an internal 'Curl_one_easy'\r\n                                     struct is created and this is a pointer\r\n                                     to the particular struct associated with\r\n                                     this SessionHandle */\r\n\r\n  struct curl_slist *http200aliases; /* linked list of aliases for http200 */\r\n\r\n  long ipver; /* the CURL_IPRESOLVE_* defines in the public header file\r\n                 0 - whatever, 1 - v2, 2 - v6 */\r\n\r\n  curl_off_t max_filesize; /* Maximum file size to download */\r\n\r\n  curl_ftpfile ftp_filemethod; /* how to get to a file when FTP is used  */\r\n\r\n  int ftp_create_missing_dirs; /* 1 - create directories that don't exist\r\n                                  2 - the same but also allow MKD to fail once\r\n                               */\r\n\r\n  curl_sshkeycallback ssh_keyfunc; /* key matching callback */\r\n  void *ssh_keyfunc_userp;         /* custom pointer to callback */\r\n\r\n/* Here follows boolean settings that define how to behave during\r\n   this session. They are STATIC, set by libcurl users or at least initially\r\n   and they don't change during operations. */\r\n\r\n  bool printhost;        /* printing host name in debug info */\r\n  bool get_filetime;     /* get the time and get of the remote file */\r\n  bool tunnel_thru_httpproxy; /* use CONNECT through a HTTP proxy */\r\n  bool prefer_ascii;     /* ASCII rather than binary */\r\n  bool ftp_append;       /* append, not overwrite, on upload */\r\n  bool ftp_list_only;    /* switch FTP command for listing directories */\r\n  bool ftp_use_port;     /* use the FTP PORT command */\r\n  bool hide_progress;    /* don't use the progress meter */\r\n  bool http_fail_on_error;  /* fail on HTTP error codes >= 300 */\r\n  bool http_follow_location; /* follow HTTP redirects */\r\n  bool http_transfer_encoding; /* request compressed HTTP transfer-encoding */\r\n  bool http_disable_hostname_check_before_authentication;\r\n  bool include_header;   /* include received protocol headers in data output */\r\n  bool http_set_referer; /* is a custom referer used */\r\n  bool http_auto_referer; /* set \"correct\" referer when following location: */\r\n  bool opt_no_body;      /* as set with CURLOPT_NO_BODY */\r\n  bool set_port;         /* custom port number used */\r\n  bool upload;           /* upload request */\r\n  enum CURL_NETRC_OPTION\r\n       use_netrc;        /* defined in include/curl.h */\r\n  bool verbose;          /* output verbosity */\r\n  bool krb;              /* kerberos connection requested */\r\n  bool reuse_forbid;     /* forbidden to be reused, close after use */\r\n  bool reuse_fresh;      /* do not re-use an existing connection  */\r\n  bool ftp_use_epsv;     /* if EPSV is to be attempted or not */\r\n  bool ftp_use_eprt;     /* if EPRT is to be attempted or not */\r\n  bool ftp_use_pret;     /* if PRET is to be used before PASV or not */\r\n\r\n  curl_usessl use_ssl;   /* if AUTH TLS is to be attempted etc, for FTP or\r\n                            IMAP or POP3 or others! */\r\n  curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */\r\n  curl_ftpccc ftp_ccc;   /* FTP CCC options */\r\n  bool no_signal;        /* do not use any signal/alarm handler */\r\n  bool global_dns_cache; /* subject for future removal */\r\n  bool tcp_nodelay;      /* whether to enable TCP_NODELAY or not */\r\n  bool ignorecl;         /* ignore content length */\r\n  bool ftp_skip_ip;      /* skip the IP address the FTP server passes on to\r\n                            us */\r\n  bool connect_only;     /* make connection, let application use the socket */\r\n  bool ssl_enable_beast; /* especially allow this flaw for interoperability's\r\n                            sake*/\r\n  long ssh_auth_types;   /* allowed SSH auth types */\r\n  bool http_te_skip;     /* pass the raw body data to the user, even when\r\n                            transfer-encoded (chunked, compressed) */\r\n  bool http_ce_skip;     /* pass the raw body data to the user, even when\r\n                            content-encoded (chunked, compressed) */\r\n  long new_file_perms;    /* Permissions to use when creating remote files */\r\n  long new_directory_perms; /* Permissions to use when creating remote dirs */\r\n  bool proxy_transfer_mode; /* set transfer mode (;type=<a|i>) when doing FTP\r\n                               via an HTTP proxy */\r\n  char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */\r\n  unsigned int scope;    /* address scope for IPv6 */\r\n  long allowed_protocols;\r\n  long redir_protocols;\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  long socks5_gssapi_nec; /* flag to support nec socks5 server */\r\n#endif\r\n  struct curl_slist *mail_rcpt; /* linked list of mail recipients */\r\n  /* Common RTSP header options */\r\n  Curl_RtspReq rtspreq; /* RTSP request type */\r\n  long rtspversion; /* like httpversion, for RTSP */\r\n  bool wildcardmatch; /* enable wildcard matching */\r\n  curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer\r\n                                        starts */\r\n  curl_chunk_end_callback chunk_end; /* called after part transferring\r\n                                        stopped */\r\n  curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds\r\n                                    to pattern (e.g. if WILDCARDMATCH is on) */\r\n  void *fnmatch_data;\r\n\r\n  long gssapi_delegation; /* GSSAPI credential delegation, see the\r\n                             documentation of CURLOPT_GSSAPI_DELEGATION */\r\n\r\n  bool tcp_keepalive;    /* use TCP keepalives */\r\n  long tcp_keepidle;     /* seconds in idle before sending keepalive probe */\r\n  long tcp_keepintvl;    /* seconds between TCP keepalive probes */\r\n\r\n  size_t maxconnects;  /* Max idle connections in the connection cache */\r\n};\r\n\r\nstruct Names {\r\n  struct curl_hash *hostcache;\r\n  enum {\r\n    HCACHE_NONE,    /* not pointing to anything */\r\n    HCACHE_GLOBAL,  /* points to the (shrug) global one */\r\n    HCACHE_MULTI,   /* points to a shared one in the multi handle */\r\n    HCACHE_SHARED   /* points to a shared one in a shared object */\r\n  } hostcachetype;\r\n};\r\n\r\n/*\r\n * The 'connectdata' struct MUST have all the connection oriented stuff as we\r\n * may have several simultaneous connections and connection structs in memory.\r\n *\r\n * The 'struct UserDefined' must only contain data that is set once to go for\r\n * many (perhaps) independent connections. Values that are generated or\r\n * calculated internally for the \"session handle\" must be defined within the\r\n * 'struct UrlState' instead.\r\n */\r\n\r\nstruct SessionHandle {\r\n  struct Names dns;\r\n  struct Curl_multi *multi;    /* if non-NULL, points to the multi handle\r\n                                  struct to which this \"belongs\" when used by\r\n                                  the multi interface */\r\n  struct Curl_multi *multi_easy; /* if non-NULL, points to the multi handle\r\n                                    struct to which this \"belongs\" when used\r\n                                    by the easy interface */\r\n  struct Curl_one_easy *multi_pos; /* if non-NULL, points to its position\r\n                                      in multi controlling structure to assist\r\n                                      in removal. */\r\n  struct Curl_share *share;    /* Share, handles global variable mutexing */\r\n  struct SingleRequest req;    /* Request-specific data */\r\n  struct UserDefined set;      /* values set by the libcurl user */\r\n  struct DynamicStatic change; /* possibly modified userdefined data */\r\n  struct CookieInfo *cookies;  /* the cookies, read from files and servers.\r\n                                  NOTE that the 'cookie' field in the\r\n                                  UserDefined struct defines if the \"engine\"\r\n                                  is to be used or not. */\r\n  struct Progress progress;    /* for all the progress meter data */\r\n  struct UrlState state;       /* struct for fields used for state info and\r\n                                  other dynamic purposes */\r\n  struct WildcardData wildcard; /* wildcard download state info */\r\n  struct PureInfo info;        /* stats, reports and info data */\r\n#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)\r\n  iconv_t outbound_cd;         /* for translating to the network encoding */\r\n  iconv_t inbound_cd;          /* for translating from the network encoding */\r\n  iconv_t utf8_cd;             /* for translating to UTF8 */\r\n#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */\r\n  unsigned int magic;          /* set to a CURLEASY_MAGIC_NUMBER */\r\n};\r\n\r\n#define LIBCURL_NAME \"libcurl\"\r\n\r\n#endif /* HEADER_CURL_URLDATA_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/version.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include <curl/curl.h>\r\n#include \"urldata.h\"\r\n#include \"sslgen.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use the internal *printf() functions */\r\n#include <curl/mprintf.h>\r\n\r\n#ifdef USE_ARES\r\n#  if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \\\r\n     (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))\r\n#    define CARES_STATICLIB\r\n#  endif\r\n#  include <ares.h>\r\n#endif\r\n\r\n#ifdef USE_LIBIDN\r\n#include <stringprep.h>\r\n#endif\r\n\r\n#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)\r\n#include <iconv.h>\r\n#endif\r\n\r\n#ifdef USE_LIBRTMP\r\n#include <librtmp/rtmp.h>\r\n#endif\r\n\r\n#ifdef USE_LIBSSH2\r\n#include <libssh2.h>\r\n#endif\r\n\r\n#ifdef HAVE_LIBSSH2_VERSION\r\n/* get it run-time if possible */\r\n#define CURL_LIBSSH2_VERSION libssh2_version(0)\r\n#else\r\n/* use build-time if run-time not possible */\r\n#define CURL_LIBSSH2_VERSION LIBSSH2_VERSION\r\n#endif\r\n\r\nchar *curl_version(void)\r\n{\r\n  static char version[200];\r\n  char *ptr = version;\r\n  size_t len;\r\n  size_t left = sizeof(version);\r\n\r\n  strcpy(ptr, LIBCURL_NAME \"/\" LIBCURL_VERSION);\r\n  len = strlen(ptr);\r\n  left -= len;\r\n  ptr += len;\r\n\r\n  if(left > 1) {\r\n    len = Curl_ssl_version(ptr + 1, left - 1);\r\n\r\n    if(len > 0) {\r\n      *ptr = ' ';\r\n      left -= ++len;\r\n      ptr += len;\r\n    }\r\n  }\r\n\r\n#ifdef HAVE_LIBZ\r\n  len = snprintf(ptr, left, \" zlib/%s\", zlibVersion());\r\n  left -= len;\r\n  ptr += len;\r\n#endif\r\n#ifdef USE_ARES\r\n  /* this function is only present in c-ares, not in the original ares */\r\n  len = snprintf(ptr, left, \" c-ares/%s\", ares_version(NULL));\r\n  left -= len;\r\n  ptr += len;\r\n#endif\r\n#ifdef USE_LIBIDN\r\n  if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {\r\n    len = snprintf(ptr, left, \" libidn/%s\", stringprep_check_version(NULL));\r\n    left -= len;\r\n    ptr += len;\r\n  }\r\n#endif\r\n#ifdef USE_WIN32_IDN\r\n  len = snprintf(ptr, left, \" WinIDN\");\r\n  left -= len;\r\n  ptr += len;\r\n#endif\r\n#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)\r\n#ifdef _LIBICONV_VERSION\r\n  len = snprintf(ptr, left, \" iconv/%d.%d\",\r\n                 _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);\r\n#else\r\n  /* version unknown */\r\n  len = snprintf(ptr, left, \" iconv\");\r\n#endif /* _LIBICONV_VERSION */\r\n  left -= len;\r\n  ptr += len;\r\n#endif\r\n#ifdef USE_LIBSSH2\r\n  len = snprintf(ptr, left, \" libssh2/%s\", CURL_LIBSSH2_VERSION);\r\n  left -= len;\r\n  ptr += len;\r\n#endif\r\n#ifdef USE_LIBRTMP\r\n  {\r\n    char suff[2];\r\n    if(RTMP_LIB_VERSION & 0xff) {\r\n      suff[0] = (RTMP_LIB_VERSION & 0xff) + 'a' - 1;\r\n      suff[1] = '\\0';\r\n    }\r\n    else\r\n      suff[0] = '\\0';\r\n\r\n    snprintf(ptr, left, \" librtmp/%d.%d%s\",\r\n             RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,\r\n             suff);\r\n/*\r\n  If another lib version is added below this one, this code would\r\n  also have to do:\r\n\r\n    len = what snprintf() returned\r\n\r\n    left -= len;\r\n    ptr += len;\r\n*/\r\n  }\r\n#endif\r\n\r\n  return version;\r\n}\r\n\r\n/* data for curl_version_info\r\n\r\n   Keep the list sorted alphabetically. It is also written so that each\r\n   protocol line has its own #if line to make things easier on the eye.\r\n */\r\n\r\nstatic const char * const protocols[] = {\r\n#ifndef CURL_DISABLE_DICT\r\n  \"dict\",\r\n#endif\r\n#ifndef CURL_DISABLE_FILE\r\n  \"file\",\r\n#endif\r\n#ifndef CURL_DISABLE_FTP\r\n  \"ftp\",\r\n#endif\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)\r\n  \"ftps\",\r\n#endif\r\n#ifndef CURL_DISABLE_GOPHER\r\n  \"gopher\",\r\n#endif\r\n#ifndef CURL_DISABLE_HTTP\r\n  \"http\",\r\n#endif\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)\r\n  \"https\",\r\n#endif\r\n#ifndef CURL_DISABLE_IMAP\r\n  \"imap\",\r\n#endif\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)\r\n  \"imaps\",\r\n#endif\r\n#ifndef CURL_DISABLE_LDAP\r\n  \"ldap\",\r\n#if !defined(CURL_DISABLE_LDAPS) && \\\r\n    ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \\\r\n     (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))\r\n  \"ldaps\",\r\n#endif\r\n#endif\r\n#ifndef CURL_DISABLE_POP3\r\n  \"pop3\",\r\n#endif\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)\r\n  \"pop3s\",\r\n#endif\r\n#ifdef USE_LIBRTMP\r\n  \"rtmp\",\r\n#endif\r\n#ifndef CURL_DISABLE_RTSP\r\n  \"rtsp\",\r\n#endif\r\n#ifdef USE_LIBSSH2\r\n  \"scp\",\r\n#endif\r\n#ifdef USE_LIBSSH2\r\n  \"sftp\",\r\n#endif\r\n#ifndef CURL_DISABLE_SMTP\r\n  \"smtp\",\r\n#endif\r\n#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)\r\n  \"smtps\",\r\n#endif\r\n#ifndef CURL_DISABLE_TELNET\r\n  \"telnet\",\r\n#endif\r\n#ifndef CURL_DISABLE_TFTP\r\n  \"tftp\",\r\n#endif\r\n\r\n  NULL\r\n};\r\n\r\nstatic curl_version_info_data version_info = {\r\n  CURLVERSION_NOW,\r\n  LIBCURL_VERSION,\r\n  LIBCURL_VERSION_NUM,\r\n  OS, /* as found by configure or set by hand at build-time */\r\n  0 /* features is 0 by default */\r\n#ifdef ENABLE_IPV6\r\n  | CURL_VERSION_IPV6\r\n#endif\r\n#ifdef HAVE_KRB4\r\n  | CURL_VERSION_KERBEROS4\r\n#endif\r\n#ifdef USE_SSL\r\n  | CURL_VERSION_SSL\r\n#endif\r\n#ifdef USE_NTLM\r\n  | CURL_VERSION_NTLM\r\n#endif\r\n#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)\r\n  | CURL_VERSION_NTLM_WB\r\n#endif\r\n#ifdef USE_WINDOWS_SSPI\r\n  | CURL_VERSION_SSPI\r\n#endif\r\n#ifdef HAVE_LIBZ\r\n  | CURL_VERSION_LIBZ\r\n#endif\r\n#ifdef USE_HTTP_NEGOTIATE\r\n  | CURL_VERSION_GSSNEGOTIATE\r\n#endif\r\n#ifdef DEBUGBUILD\r\n  | CURL_VERSION_DEBUG\r\n#endif\r\n#ifdef CURLDEBUG\r\n  | CURL_VERSION_CURLDEBUG\r\n#endif\r\n#ifdef CURLRES_ASYNCH\r\n  | CURL_VERSION_ASYNCHDNS\r\n#endif\r\n#ifdef HAVE_SPNEGO\r\n  | CURL_VERSION_SPNEGO\r\n#endif\r\n#if (CURL_SIZEOF_CURL_OFF_T > 4) && \\\r\n    ( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )\r\n  | CURL_VERSION_LARGEFILE\r\n#endif\r\n#if defined(CURL_DOES_CONVERSIONS)\r\n  | CURL_VERSION_CONV\r\n#endif\r\n#if defined(USE_TLS_SRP)\r\n  | CURL_VERSION_TLSAUTH_SRP\r\n#endif\r\n  ,\r\n  NULL, /* ssl_version */\r\n  0,    /* ssl_version_num, this is kept at zero */\r\n  NULL, /* zlib_version */\r\n  protocols,\r\n  NULL, /* c-ares version */\r\n  0,    /* c-ares version numerical */\r\n  NULL, /* libidn version */\r\n  0,    /* iconv version */\r\n  NULL, /* ssh lib version */\r\n};\r\n\r\ncurl_version_info_data *curl_version_info(CURLversion stamp)\r\n{\r\n#ifdef USE_LIBSSH2\r\n  static char ssh_buffer[80];\r\n#endif\r\n\r\n#ifdef USE_SSL\r\n  static char ssl_buffer[80];\r\n  Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));\r\n  version_info.ssl_version = ssl_buffer;\r\n#endif\r\n\r\n#ifdef HAVE_LIBZ\r\n  version_info.libz_version = zlibVersion();\r\n  /* libz left NULL if non-existing */\r\n#endif\r\n#ifdef USE_ARES\r\n  {\r\n    int aresnum;\r\n    version_info.ares = ares_version(&aresnum);\r\n    version_info.ares_num = aresnum;\r\n  }\r\n#endif\r\n#ifdef USE_LIBIDN\r\n  /* This returns a version string if we use the given version or later,\r\n     otherwise it returns NULL */\r\n  version_info.libidn = stringprep_check_version(LIBIDN_REQUIRED_VERSION);\r\n  if(version_info.libidn)\r\n    version_info.features |= CURL_VERSION_IDN;\r\n#elif defined(USE_WIN32_IDN)\r\n  version_info.features |= CURL_VERSION_IDN;\r\n#endif\r\n\r\n#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)\r\n#ifdef _LIBICONV_VERSION\r\n  version_info.iconv_ver_num = _LIBICONV_VERSION;\r\n#else\r\n  /* version unknown */\r\n  version_info.iconv_ver_num = -1;\r\n#endif /* _LIBICONV_VERSION */\r\n#endif\r\n\r\n#ifdef USE_LIBSSH2\r\n  snprintf(ssh_buffer, sizeof(ssh_buffer), \"libssh2/%s\", LIBSSH2_VERSION);\r\n  version_info.libssh_version = ssh_buffer;\r\n#endif\r\n\r\n  (void)stamp; /* avoid compiler warnings, we don't use this */\r\n\r\n  return &version_info;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/warnless.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#if defined(__INTEL_COMPILER) && defined(__unix__)\r\n\r\n#ifdef HAVE_NETINET_IN_H\r\n#  include <netinet/in.h>\r\n#endif\r\n#ifdef HAVE_ARPA_INET_H\r\n#  include <arpa/inet.h>\r\n#endif\r\n\r\n#endif /* __INTEL_COMPILER && __unix__ */\r\n\r\n#define BUILDING_WARNLESS_C 1\r\n\r\n#include \"warnless.h\"\r\n\r\n#define CURL_MASK_SCHAR  0x7F\r\n#define CURL_MASK_UCHAR  0xFF\r\n\r\n#if (SIZEOF_SHORT == 2)\r\n#  define CURL_MASK_SSHORT  0x7FFF\r\n#  define CURL_MASK_USHORT  0xFFFF\r\n#elif (SIZEOF_SHORT == 4)\r\n#  define CURL_MASK_SSHORT  0x7FFFFFFF\r\n#  define CURL_MASK_USHORT  0xFFFFFFFF\r\n#elif (SIZEOF_SHORT == 8)\r\n#  define CURL_MASK_SSHORT  0x7FFFFFFFFFFFFFFF\r\n#  define CURL_MASK_USHORT  0xFFFFFFFFFFFFFFFF\r\n#else\r\n#  error \"SIZEOF_SHORT not defined\"\r\n#endif\r\n\r\n#if (SIZEOF_INT == 2)\r\n#  define CURL_MASK_SINT  0x7FFF\r\n#  define CURL_MASK_UINT  0xFFFF\r\n#elif (SIZEOF_INT == 4)\r\n#  define CURL_MASK_SINT  0x7FFFFFFF\r\n#  define CURL_MASK_UINT  0xFFFFFFFF\r\n#elif (SIZEOF_INT == 8)\r\n#  define CURL_MASK_SINT  0x7FFFFFFFFFFFFFFF\r\n#  define CURL_MASK_UINT  0xFFFFFFFFFFFFFFFF\r\n#elif (SIZEOF_INT == 16)\r\n#  define CURL_MASK_SINT  0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\r\n#  define CURL_MASK_UINT  0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\r\n#else\r\n#  error \"SIZEOF_INT not defined\"\r\n#endif\r\n\r\n#if (CURL_SIZEOF_LONG == 2)\r\n#  define CURL_MASK_SLONG  0x7FFFL\r\n#  define CURL_MASK_ULONG  0xFFFFUL\r\n#elif (CURL_SIZEOF_LONG == 4)\r\n#  define CURL_MASK_SLONG  0x7FFFFFFFL\r\n#  define CURL_MASK_ULONG  0xFFFFFFFFUL\r\n#elif (CURL_SIZEOF_LONG == 8)\r\n#  define CURL_MASK_SLONG  0x7FFFFFFFFFFFFFFFL\r\n#  define CURL_MASK_ULONG  0xFFFFFFFFFFFFFFFFUL\r\n#elif (CURL_SIZEOF_LONG == 16)\r\n#  define CURL_MASK_SLONG  0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL\r\n#  define CURL_MASK_ULONG  0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL\r\n#else\r\n#  error \"CURL_SIZEOF_LONG not defined\"\r\n#endif\r\n\r\n#if (CURL_SIZEOF_CURL_OFF_T == 2)\r\n#  define CURL_MASK_SCOFFT  CURL_OFF_T_C(0x7FFF)\r\n#  define CURL_MASK_UCOFFT  CURL_OFF_TU_C(0xFFFF)\r\n#elif (CURL_SIZEOF_CURL_OFF_T == 4)\r\n#  define CURL_MASK_SCOFFT  CURL_OFF_T_C(0x7FFFFFFF)\r\n#  define CURL_MASK_UCOFFT  CURL_OFF_TU_C(0xFFFFFFFF)\r\n#elif (CURL_SIZEOF_CURL_OFF_T == 8)\r\n#  define CURL_MASK_SCOFFT  CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)\r\n#  define CURL_MASK_UCOFFT  CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF)\r\n#elif (CURL_SIZEOF_CURL_OFF_T == 16)\r\n#  define CURL_MASK_SCOFFT  CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\r\n#  define CURL_MASK_UCOFFT  CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\r\n#else\r\n#  error \"CURL_SIZEOF_CURL_OFF_T not defined\"\r\n#endif\r\n\r\n#if (SIZEOF_SIZE_T == SIZEOF_SHORT)\r\n#  define CURL_MASK_SSIZE_T  CURL_MASK_SSHORT\r\n#  define CURL_MASK_USIZE_T  CURL_MASK_USHORT\r\n#elif (SIZEOF_SIZE_T == SIZEOF_INT)\r\n#  define CURL_MASK_SSIZE_T  CURL_MASK_SINT\r\n#  define CURL_MASK_USIZE_T  CURL_MASK_UINT\r\n#elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG)\r\n#  define CURL_MASK_SSIZE_T  CURL_MASK_SLONG\r\n#  define CURL_MASK_USIZE_T  CURL_MASK_ULONG\r\n#elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T)\r\n#  define CURL_MASK_SSIZE_T  CURL_MASK_SCOFFT\r\n#  define CURL_MASK_USIZE_T  CURL_MASK_UCOFFT\r\n#else\r\n#  error \"SIZEOF_SIZE_T not defined\"\r\n#endif\r\n\r\n/*\r\n** unsigned long to unsigned short\r\n*/\r\n\r\nunsigned short curlx_ultous(unsigned long ulnum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_USHORT);\r\n  return (unsigned short)(ulnum & (unsigned long) CURL_MASK_USHORT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** unsigned long to unsigned char\r\n*/\r\n\r\nunsigned char curlx_ultouc(unsigned long ulnum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_UCHAR);\r\n  return (unsigned char)(ulnum & (unsigned long) CURL_MASK_UCHAR);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** unsigned long to signed int\r\n*/\r\n\r\nint curlx_ultosi(unsigned long ulnum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_SINT);\r\n  return (int)(ulnum & (unsigned long) CURL_MASK_SINT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** unsigned size_t to signed int\r\n*/\r\n\r\nint curlx_uztosi(size_t uznum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(uznum <= (size_t) CURL_MASK_SINT);\r\n  return (int)(uznum & (size_t) CURL_MASK_SINT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** unsigned size_t to unsigned long\r\n*/\r\n\r\nunsigned long curlx_uztoul(size_t uznum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n# pragma warning(push)\r\n# pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n#if (CURL_SIZEOF_LONG < SIZEOF_SIZE_T)\r\n  DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG);\r\n#endif\r\n  return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG);\r\n\r\n#ifdef __INTEL_COMPILER\r\n# pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** unsigned size_t to unsigned int\r\n*/\r\n\r\nunsigned int curlx_uztoui(size_t uznum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n# pragma warning(push)\r\n# pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n#if (SIZEOF_INT < SIZEOF_SIZE_T)\r\n  DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT);\r\n#endif\r\n  return (unsigned int)(uznum & (size_t) CURL_MASK_UINT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n# pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** signed long to signed int\r\n*/\r\n\r\nint curlx_sltosi(long slnum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(slnum >= 0);\r\n#if (SIZEOF_INT < CURL_SIZEOF_LONG)\r\n  DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_SINT);\r\n#endif\r\n  return (int)(slnum & (long) CURL_MASK_SINT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** signed long to unsigned int\r\n*/\r\n\r\nunsigned int curlx_sltoui(long slnum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(slnum >= 0);\r\n#if (SIZEOF_INT < CURL_SIZEOF_LONG)\r\n  DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_UINT);\r\n#endif\r\n  return (unsigned int)(slnum & (long) CURL_MASK_UINT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** signed long to unsigned short\r\n*/\r\n\r\nunsigned short curlx_sltous(long slnum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(slnum >= 0);\r\n  DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_USHORT);\r\n  return (unsigned short)(slnum & (long) CURL_MASK_USHORT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** unsigned size_t to signed ssize_t\r\n*/\r\n\r\nssize_t curlx_uztosz(size_t uznum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(uznum <= (size_t) CURL_MASK_SSIZE_T);\r\n  return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** signed curl_off_t to unsigned size_t\r\n*/\r\n\r\nsize_t curlx_sotouz(curl_off_t sonum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(sonum >= 0);\r\n  return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** signed ssize_t to signed int\r\n*/\r\n\r\nint curlx_sztosi(ssize_t sznum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(sznum >= 0);\r\n#if (SIZEOF_INT < SIZEOF_SIZE_T)\r\n  DEBUGASSERT((size_t) sznum <= (size_t) CURL_MASK_SINT);\r\n#endif\r\n  return (int)(sznum & (ssize_t) CURL_MASK_SINT);\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n/*\r\n** signed int to unsigned size_t\r\n*/\r\n\r\nsize_t curlx_sitouz(int sinum)\r\n{\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(push)\r\n#  pragma warning(disable:810) /* conversion may lose significant bits */\r\n#endif\r\n\r\n  DEBUGASSERT(sinum >= 0);\r\n  return (size_t) sinum;\r\n\r\n#ifdef __INTEL_COMPILER\r\n#  pragma warning(pop)\r\n#endif\r\n}\r\n\r\n#ifdef USE_WINSOCK\r\n\r\n/*\r\n** curl_socket_t to signed int\r\n*/\r\n\r\nint curlx_sktosi(curl_socket_t s)\r\n{\r\n  return (int)((ssize_t) s);\r\n}\r\n\r\n/*\r\n** signed int to curl_socket_t\r\n*/\r\n\r\ncurl_socket_t curlx_sitosk(int i)\r\n{\r\n  return (curl_socket_t)((ssize_t) i);\r\n}\r\n\r\n#endif /* USE_WINSOCK */\r\n\r\n#if defined(__INTEL_COMPILER) && defined(__unix__)\r\n\r\nint curlx_FD_ISSET(int fd, fd_set *fdset)\r\n{\r\n  #pragma warning(push)\r\n  #pragma warning(disable:1469) /* clobber ignored */\r\n  return FD_ISSET(fd, fdset);\r\n  #pragma warning(pop)\r\n}\r\n\r\nvoid curlx_FD_SET(int fd, fd_set *fdset)\r\n{\r\n  #pragma warning(push)\r\n  #pragma warning(disable:1469) /* clobber ignored */\r\n  FD_SET(fd, fdset);\r\n  #pragma warning(pop)\r\n}\r\n\r\nvoid curlx_FD_ZERO(fd_set *fdset)\r\n{\r\n  #pragma warning(push)\r\n  #pragma warning(disable:593) /* variable was set but never used */\r\n  FD_ZERO(fdset);\r\n  #pragma warning(pop)\r\n}\r\n\r\nunsigned short curlx_htons(unsigned short usnum)\r\n{\r\n#if (__INTEL_COMPILER == 910) && defined(__i386__)\r\n  return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF));\r\n#else\r\n  #pragma warning(push)\r\n  #pragma warning(disable:810) /* conversion may lose significant bits */\r\n  return htons(usnum);\r\n  #pragma warning(pop)\r\n#endif\r\n}\r\n\r\nunsigned short curlx_ntohs(unsigned short usnum)\r\n{\r\n#if (__INTEL_COMPILER == 910) && defined(__i386__)\r\n  return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF));\r\n#else\r\n  #pragma warning(push)\r\n  #pragma warning(disable:810) /* conversion may lose significant bits */\r\n  return ntohs(usnum);\r\n  #pragma warning(pop)\r\n#endif\r\n}\r\n\r\n#endif /* __INTEL_COMPILER && __unix__ */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/warnless.h",
    "content": "#ifndef HEADER_CURL_WARNLESS_H\r\n#define HEADER_CURL_WARNLESS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#ifdef USE_WINSOCK\r\n#include <curl/curl.h> /* for curl_socket_t */\r\n#endif\r\n\r\nunsigned short curlx_ultous(unsigned long ulnum);\r\n\r\nunsigned char curlx_ultouc(unsigned long ulnum);\r\n\r\nint curlx_ultosi(unsigned long ulnum);\r\n\r\nint curlx_uztosi(size_t uznum);\r\n\r\nunsigned long curlx_uztoul(size_t uznum);\r\n\r\nunsigned int curlx_uztoui(size_t uznum);\r\n\r\nint curlx_sltosi(long slnum);\r\n\r\nunsigned int curlx_sltoui(long slnum);\r\n\r\nunsigned short curlx_sltous(long slnum);\r\n\r\nssize_t curlx_uztosz(size_t uznum);\r\n\r\nsize_t curlx_sotouz(curl_off_t sonum);\r\n\r\nint curlx_sztosi(ssize_t sznum);\r\n\r\nsize_t curlx_sitouz(int sinum);\r\n\r\n#ifdef USE_WINSOCK\r\n\r\nint curlx_sktosi(curl_socket_t s);\r\n\r\ncurl_socket_t curlx_sitosk(int i);\r\n\r\n#endif /* USE_WINSOCK */\r\n\r\n#if defined(__INTEL_COMPILER) && defined(__unix__)\r\n\r\nint curlx_FD_ISSET(int fd, fd_set *fdset);\r\n\r\nvoid curlx_FD_SET(int fd, fd_set *fdset);\r\n\r\nvoid curlx_FD_ZERO(fd_set *fdset);\r\n\r\nunsigned short curlx_htons(unsigned short usnum);\r\n\r\nunsigned short curlx_ntohs(unsigned short usnum);\r\n\r\n#ifndef BUILDING_WARNLESS_C\r\n#  undef  FD_ISSET\r\n#  define FD_ISSET(a,b) curlx_FD_ISSET((a),(b))\r\n#  undef  FD_SET\r\n#  define FD_SET(a,b)   curlx_FD_SET((a),(b))\r\n#  undef  FD_ZERO\r\n#  define FD_ZERO(a)    curlx_FD_ZERO((a))\r\n#  undef  htons\r\n#  define htons(a)      curlx_htons((a))\r\n#  undef  ntohs\r\n#  define ntohs(a)      curlx_ntohs((a))\r\n#endif\r\n\r\n#endif /* __INTEL_COMPILER && __unix__ */\r\n\r\n#endif /* HEADER_CURL_WARNLESS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/wildcard.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include \"curl_setup.h\"\r\n\r\n#include \"wildcard.h\"\r\n#include \"llist.h\"\r\n#include \"fileinfo.h\"\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"curl_memory.h\"\r\n/* The last #include file should be: */\r\n#include \"memdebug.h\"\r\n\r\nCURLcode Curl_wildcard_init(struct WildcardData *wc)\r\n{\r\n  DEBUGASSERT(wc->filelist == NULL);\r\n  /* now allocate only wc->filelist, everything else\r\n     will be allocated if it is needed. */\r\n  wc->filelist = Curl_llist_alloc(Curl_fileinfo_dtor);\r\n  if(!wc->filelist) {;\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid Curl_wildcard_dtor(struct WildcardData *wc)\r\n{\r\n  if(!wc)\r\n    return;\r\n\r\n  if(wc->tmp_dtor) {\r\n    wc->tmp_dtor(wc->tmp);\r\n    wc->tmp_dtor = ZERO_NULL;\r\n    wc->tmp = NULL;\r\n  }\r\n  DEBUGASSERT(wc->tmp == NULL);\r\n\r\n  if(wc->filelist) {\r\n    Curl_llist_destroy(wc->filelist, NULL);\r\n    wc->filelist = NULL;\r\n  }\r\n\r\n  if(wc->path) {\r\n    free(wc->path);\r\n    wc->path = NULL;\r\n  }\r\n\r\n  if(wc->pattern) {\r\n    free(wc->pattern);\r\n    wc->pattern = NULL;\r\n  }\r\n\r\n  wc->customptr = NULL;\r\n  wc->state = CURLWC_INIT;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/lib/wildcard.h",
    "content": "#ifndef HEADER_CURL_WILDCARD_H\r\n#define HEADER_CURL_WILDCARD_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 2010 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curl.h>\r\n\r\n/* list of wildcard process states */\r\ntypedef enum {\r\n  CURLWC_INIT = 0,\r\n  CURLWC_MATCHING, /* library is trying to get list of addresses for\r\n                      downloading */\r\n  CURLWC_DOWNLOADING,\r\n  CURLWC_CLEAN, /* deallocate resources and reset settings */\r\n  CURLWC_SKIP,  /* skip over concrete file */\r\n  CURLWC_ERROR, /* error cases */\r\n  CURLWC_DONE   /* if is wildcard->state == CURLWC_DONE wildcard loop\r\n                   will end */\r\n} curl_wildcard_states;\r\n\r\ntypedef void (*curl_wildcard_tmp_dtor)(void *ptr);\r\n\r\n/* struct keeping information about wildcard download process */\r\nstruct WildcardData {\r\n  curl_wildcard_states state;\r\n  char *path; /* path to the directory, where we trying wildcard-match */\r\n  char *pattern; /* wildcard pattern */\r\n  struct curl_llist *filelist; /* llist with struct Curl_fileinfo */\r\n  void *tmp; /* pointer to protocol specific temporary data */\r\n  curl_wildcard_tmp_dtor tmp_dtor;\r\n  void *customptr;  /* for CURLOPT_CHUNK_DATA pointer */\r\n};\r\n\r\nCURLcode Curl_wildcard_init(struct WildcardData *wc);\r\nvoid Curl_wildcard_dtor(struct WildcardData *wc);\r\n\r\nstruct SessionHandle;\r\n\r\n#endif /* HEADER_CURL_WILDCARD_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_binmode.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef HAVE_SETMODE\r\n\r\n#ifdef HAVE_IO_H\r\n#  include <io.h>\r\n#endif\r\n\r\n#ifdef HAVE_FCNTL_H\r\n#  include <fcntl.h>\r\n#endif\r\n\r\n#include \"tool_binmode.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nvoid set_binmode(FILE *stream)\r\n{\r\n#ifdef O_BINARY\r\n#  ifdef __HIGHC__\r\n  _setmode(stream, O_BINARY);\r\n#  else\r\n  setmode(fileno(stream), O_BINARY);\r\n#  endif\r\n#else\r\n  (void)stream;\r\n#endif\r\n}\r\n\r\n#endif /* HAVE_SETMODE */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_binmode.h",
    "content": "#ifndef HEADER_CURL_TOOL_BINMODE_H\r\n#define HEADER_CURL_TOOL_BINMODE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef HAVE_SETMODE\r\n\r\nvoid set_binmode(FILE *stream);\r\n\r\n#else\r\n\r\n#define set_binmode(x) Curl_nop_stmt\r\n\r\n#endif /* HAVE_SETMODE */\r\n\r\n#endif /* HEADER_CURL_TOOL_BINMODE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_bname.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"tool_bname.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifndef HAVE_BASENAME\r\n\r\nchar *tool_basename(char *path)\r\n{\r\n  char *s1;\r\n  char *s2;\r\n\r\n  s1 = strrchr(path, '/');\r\n  s2 = strrchr(path, '\\\\');\r\n\r\n  if(s1 && s2) {\r\n    path = (s1 > s2) ? s1 + 1 : s2 + 1;\r\n  }\r\n  else if(s1)\r\n    path = s1 + 1;\r\n  else if(s2)\r\n    path = s2 + 1;\r\n\r\n  return path;\r\n}\r\n\r\n#endif /* HAVE_BASENAME */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_bname.h",
    "content": "#ifndef HEADER_CURL_TOOL_BNAME_H\r\n#define HEADER_CURL_TOOL_BNAME_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifndef HAVE_BASENAME\r\n\r\nchar *tool_basename(char *path);\r\n\r\n#define basename(x) tool_basename((x))\r\n\r\n#endif /* HAVE_BASENAME */\r\n\r\n#endif /* HEADER_CURL_TOOL_BNAME_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_dbg.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_cb_dbg.h\"\r\n#include \"tool_util.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nstatic void dump(const char *timebuf, const char *text,\r\n                 FILE *stream, const unsigned char *ptr, size_t size,\r\n                 trace tracetype, curl_infotype infotype);\r\n\r\n/*\r\n** callback for CURLOPT_DEBUGFUNCTION\r\n*/\r\n\r\nint tool_debug_cb(CURL *handle, curl_infotype type,\r\n                  unsigned char *data, size_t size,\r\n                  void *userdata)\r\n{\r\n  struct Configurable *config = userdata;\r\n  FILE *output = config->errors;\r\n  const char *text;\r\n  struct timeval tv;\r\n  struct tm *now;\r\n  char timebuf[20];\r\n  time_t secs;\r\n  static time_t epoch_offset;\r\n  static int    known_offset;\r\n\r\n  (void)handle; /* not used */\r\n\r\n  if(config->tracetime) {\r\n    tv = tvnow();\r\n    if(!known_offset) {\r\n      epoch_offset = time(NULL) - tv.tv_sec;\r\n      known_offset = 1;\r\n    }\r\n    secs = epoch_offset + tv.tv_sec;\r\n    now = localtime(&secs);  /* not thread safe but we don't care */\r\n    snprintf(timebuf, sizeof(timebuf), \"%02d:%02d:%02d.%06ld \",\r\n             now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);\r\n  }\r\n  else\r\n    timebuf[0] = 0;\r\n\r\n  if(!config->trace_stream) {\r\n    /* open for append */\r\n    if(curlx_strequal(\"-\", config->trace_dump))\r\n      config->trace_stream = stdout;\r\n    else if(curlx_strequal(\"%\", config->trace_dump))\r\n      /* Ok, this is somewhat hackish but we do it undocumented for now */\r\n      config->trace_stream = config->errors;  /* aka stderr */\r\n    else {\r\n      config->trace_stream = fopen(config->trace_dump, \"w\");\r\n      config->trace_fopened = TRUE;\r\n    }\r\n  }\r\n\r\n  if(config->trace_stream)\r\n    output = config->trace_stream;\r\n\r\n  if(!output) {\r\n    warnf(config, \"Failed to create/open output\");\r\n    return 0;\r\n  }\r\n\r\n  if(config->tracetype == TRACE_PLAIN) {\r\n    /*\r\n     * This is the trace look that is similar to what libcurl makes on its\r\n     * own.\r\n     */\r\n    static const char * const s_infotype[] = {\r\n      \"*\", \"<\", \">\", \"{\", \"}\", \"{\", \"}\"\r\n    };\r\n    size_t i;\r\n    size_t st = 0;\r\n    static bool newl = FALSE;\r\n    static bool traced_data = FALSE;\r\n\r\n    switch(type) {\r\n    case CURLINFO_HEADER_OUT:\r\n      if(size > 0) {\r\n        for(i = 0; i < size - 1; i++) {\r\n          if(data[i] == '\\n') { /* LF */\r\n            if(!newl) {\r\n              fprintf(output, \"%s%s \", timebuf, s_infotype[type]);\r\n            }\r\n            (void)fwrite(data + st, i - st + 1, 1, output);\r\n            st = i + 1;\r\n            newl = FALSE;\r\n          }\r\n        }\r\n        if(!newl)\r\n          fprintf(output, \"%s%s \", timebuf, s_infotype[type]);\r\n        (void)fwrite(data + st, i - st + 1, 1, output);\r\n      }\r\n      newl = (size && (data[size - 1] != '\\n')) ? TRUE : FALSE;\r\n      traced_data = FALSE;\r\n      break;\r\n    case CURLINFO_TEXT:\r\n    case CURLINFO_HEADER_IN:\r\n      if(!newl)\r\n        fprintf(output, \"%s%s \", timebuf, s_infotype[type]);\r\n      (void)fwrite(data, size, 1, output);\r\n      newl = (size && (data[size - 1] != '\\n')) ? TRUE : FALSE;\r\n      traced_data = FALSE;\r\n      break;\r\n    case CURLINFO_DATA_OUT:\r\n    case CURLINFO_DATA_IN:\r\n    case CURLINFO_SSL_DATA_IN:\r\n    case CURLINFO_SSL_DATA_OUT:\r\n      if(!traced_data) {\r\n        /* if the data is output to a tty and we're sending this debug trace\r\n           to stderr or stdout, we don't display the alert about the data not\r\n           being shown as the data _is_ shown then just not via this\r\n           function */\r\n        if(!config->isatty ||\r\n           ((output != stderr) && (output != stdout))) {\r\n          if(!newl)\r\n            fprintf(output, \"%s%s \", timebuf, s_infotype[type]);\r\n          fprintf(output, \"[data not shown]\\n\");\r\n          newl = FALSE;\r\n          traced_data = TRUE;\r\n        }\r\n      }\r\n      break;\r\n    default: /* nada */\r\n      newl = FALSE;\r\n      traced_data = FALSE;\r\n      break;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n  /* Special processing is needed for CURLINFO_HEADER_OUT blocks\r\n   * if they contain both headers and data (separated by CRLFCRLF).\r\n   * We dump the header text and then switch type to CURLINFO_DATA_OUT.\r\n   */\r\n  if((type == CURLINFO_HEADER_OUT) && (size > 4)) {\r\n    size_t i;\r\n    for(i = 0; i < size - 4; i++) {\r\n      if(memcmp(&data[i], \"\\r\\n\\r\\n\", 4) == 0) {\r\n        /* dump everything through the CRLFCRLF as a sent header */\r\n        text = \"=> Send header\";\r\n        dump(timebuf, text, output, data, i + 4, config->tracetype, type);\r\n        data += i + 3;\r\n        size -= i + 4;\r\n        type = CURLINFO_DATA_OUT;\r\n        data += 1;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n  switch (type) {\r\n  case CURLINFO_TEXT:\r\n    fprintf(output, \"%s== Info: %s\", timebuf, data);\r\n  default: /* in case a new one is introduced to shock us */\r\n    return 0;\r\n\r\n  case CURLINFO_HEADER_OUT:\r\n    text = \"=> Send header\";\r\n    break;\r\n  case CURLINFO_DATA_OUT:\r\n    text = \"=> Send data\";\r\n    break;\r\n  case CURLINFO_HEADER_IN:\r\n    text = \"<= Recv header\";\r\n    break;\r\n  case CURLINFO_DATA_IN:\r\n    text = \"<= Recv data\";\r\n    break;\r\n  case CURLINFO_SSL_DATA_IN:\r\n    text = \"<= Recv SSL data\";\r\n    break;\r\n  case CURLINFO_SSL_DATA_OUT:\r\n    text = \"=> Send SSL data\";\r\n    break;\r\n  }\r\n\r\n  dump(timebuf, text, output, data, size, config->tracetype, type);\r\n  return 0;\r\n}\r\n\r\nstatic void dump(const char *timebuf, const char *text,\r\n                 FILE *stream, const unsigned char *ptr, size_t size,\r\n                 trace tracetype, curl_infotype infotype)\r\n{\r\n  size_t i;\r\n  size_t c;\r\n\r\n  unsigned int width = 0x10;\r\n\r\n  if(tracetype == TRACE_ASCII)\r\n    /* without the hex output, we can fit more on screen */\r\n    width = 0x40;\r\n\r\n  fprintf(stream, \"%s%s, %zd bytes (0x%zx)\\n\", timebuf, text, size, size);\r\n\r\n  for(i = 0; i < size; i += width) {\r\n\r\n    fprintf(stream, \"%04zx: \", i);\r\n\r\n    if(tracetype == TRACE_BIN) {\r\n      /* hex not disabled, show it */\r\n      for(c = 0; c < width; c++)\r\n        if(i+c < size)\r\n          fprintf(stream, \"%02x \", ptr[i+c]);\r\n        else\r\n          fputs(\"   \", stream);\r\n    }\r\n\r\n    for(c = 0; (c < width) && (i+c < size); c++) {\r\n      /* check for 0D0A; if found, skip past and start a new line of output */\r\n      if((tracetype == TRACE_ASCII) &&\r\n         (i+c+1 < size) && (ptr[i+c] == 0x0D) && (ptr[i+c+1] == 0x0A)) {\r\n        i += (c+2-width);\r\n        break;\r\n      }\r\n#ifdef CURL_DOES_CONVERSIONS\r\n      /* repeat the 0D0A check above but use the host encoding for CRLF */\r\n      if((tracetype == TRACE_ASCII) &&\r\n         (i+c+1 < size) && (ptr[i+c] == '\\r') && (ptr[i+c+1] == '\\n')) {\r\n        i += (c+2-width);\r\n        break;\r\n      }\r\n      /* convert to host encoding and print this character */\r\n      fprintf(stream, \"%c\", convert_char(infotype, ptr[i+c]));\r\n#else\r\n      (void)infotype;\r\n      fprintf(stream, \"%c\", ((ptr[i+c] >= 0x20) && (ptr[i+c] < 0x80)) ?\r\n              ptr[i+c] : UNPRINTABLE_CHAR);\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n      /* check again for 0D0A, to avoid an extra \\n if it's at width */\r\n      if((tracetype == TRACE_ASCII) &&\r\n         (i+c+2 < size) && (ptr[i+c+1] == 0x0D) && (ptr[i+c+2] == 0x0A)) {\r\n        i += (c+3-width);\r\n        break;\r\n      }\r\n    }\r\n    fputc('\\n', stream); /* newline */\r\n  }\r\n  fflush(stream);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_dbg.h",
    "content": "#ifndef HEADER_CURL_TOOL_CB_DBG_H\r\n#define HEADER_CURL_TOOL_CB_DBG_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/*\r\n** callback for CURLOPT_DEBUGFUNCTION\r\n*/\r\n\r\nint tool_debug_cb(CURL *handle, curl_infotype type,\r\n                  unsigned char *data, size_t size,\r\n                  void *userdata);\r\n\r\n#endif /* HEADER_CURL_TOOL_CB_DBG_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_hdr.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_cb_hdr.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nstatic char *parse_filename(const char *ptr, size_t len);\r\n\r\n/*\r\n** callback for CURLOPT_HEADERFUNCTION\r\n*/\r\n\r\nsize_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)\r\n{\r\n  struct HdrCbData *hdrcbdata = userdata;\r\n  struct OutStruct *outs = hdrcbdata->outs;\r\n  struct OutStruct *heads = hdrcbdata->heads;\r\n  const char *str = ptr;\r\n  const size_t cb = size * nmemb;\r\n  const char *end = (char*)ptr + cb;\r\n\r\n  /*\r\n   * Once that libcurl has called back tool_header_cb() the returned value\r\n   * is checked against the amount that was intended to be written, if\r\n   * it does not match then it fails with CURLE_WRITE_ERROR. So at this\r\n   * point returning a value different from sz*nmemb indicates failure.\r\n   */\r\n  size_t failure = (size * nmemb) ? 0 : 1;\r\n\r\n  if(!heads->config)\r\n    return failure;\r\n\r\n#ifdef DEBUGBUILD\r\n  if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {\r\n    warnf(heads->config, \"Header data exceeds single call write limit!\\n\");\r\n    return failure;\r\n  }\r\n#endif\r\n\r\n  /*\r\n   * Write header data when curl option --dump-header (-D) is given.\r\n   */\r\n\r\n  if(heads->config->headerfile && heads->stream) {\r\n    size_t rc = fwrite(ptr, size, nmemb, heads->stream);\r\n    if(rc != cb)\r\n      return rc;\r\n  }\r\n\r\n  /*\r\n   * This callback sets the filename where output shall be written when\r\n   * curl options --remote-name (-O) and --remote-header-name (-J) have\r\n   * been simultaneously given and additionally server returns an HTTP\r\n   * Content-Disposition header specifying a filename property.\r\n   */\r\n\r\n  if(hdrcbdata->honor_cd_filename &&\r\n     (cb > 20) && checkprefix(\"Content-disposition:\", str)) {\r\n    const char *p = str + 20;\r\n\r\n    /* look for the 'filename=' parameter\r\n       (encoded filenames (*=) are not supported) */\r\n    for(;;) {\r\n      char *filename;\r\n      size_t len;\r\n\r\n      while(*p && (p < end) && !ISALPHA(*p))\r\n        p++;\r\n      if(p > end - 9)\r\n        break;\r\n\r\n      if(memcmp(p, \"filename=\", 9)) {\r\n        /* no match, find next parameter */\r\n        while((p < end) && (*p != ';'))\r\n          p++;\r\n        continue;\r\n      }\r\n      p += 9;\r\n\r\n      /* this expression below typecasts 'cb' only to avoid\r\n         warning: signed and unsigned type in conditional expression\r\n      */\r\n      len = (ssize_t)cb - (p - str);\r\n      filename = parse_filename(p, len);\r\n      if(filename) {\r\n        outs->filename = filename;\r\n        outs->alloc_filename = TRUE;\r\n        outs->is_cd_filename = TRUE;\r\n        outs->s_isreg = TRUE;\r\n        outs->fopened = FALSE;\r\n        outs->stream = NULL;\r\n        hdrcbdata->honor_cd_filename = FALSE;\r\n        break;\r\n      }\r\n      else\r\n        return failure;\r\n    }\r\n  }\r\n\r\n  return cb;\r\n}\r\n\r\n/*\r\n * Copies a file name part and returns an ALLOCATED data buffer.\r\n */\r\nstatic char *parse_filename(const char *ptr, size_t len)\r\n{\r\n  char *copy;\r\n  char *p;\r\n  char *q;\r\n  char  stop = '\\0';\r\n\r\n  /* simple implementation of strndup() */\r\n  copy = malloc(len+1);\r\n  if(!copy)\r\n    return NULL;\r\n  memcpy(copy, ptr, len);\r\n  copy[len] = '\\0';\r\n\r\n  p = copy;\r\n  if(*p == '\\'' || *p == '\"') {\r\n    /* store the starting quote */\r\n    stop = *p;\r\n    p++;\r\n  }\r\n  else\r\n    stop = ';';\r\n\r\n  /* if the filename contains a path, only use filename portion */\r\n  q = strrchr(copy, '/');\r\n  if(q) {\r\n    p = q + 1;\r\n    if(!*p) {\r\n      Curl_safefree(copy);\r\n      return NULL;\r\n    }\r\n  }\r\n\r\n  /* If the filename contains a backslash, only use filename portion. The idea\r\n     is that even systems that don't handle backslashes as path separators\r\n     probably want the path removed for convenience. */\r\n  q = strrchr(p, '\\\\');\r\n  if(q) {\r\n    p = q + 1;\r\n    if(!*p) {\r\n      Curl_safefree(copy);\r\n      return NULL;\r\n    }\r\n  }\r\n\r\n  /* scan for the end letter and stop there */\r\n  q = p;\r\n  while(*q) {\r\n    if(q[1] && (q[0] == '\\\\'))\r\n      q++;\r\n    else if(q[0] == stop)\r\n      break;\r\n    q++;\r\n  }\r\n  *q = '\\0';\r\n\r\n  /* make sure the file name doesn't end in \\r or \\n */\r\n  q = strchr(p, '\\r');\r\n  if(q)\r\n    *q = '\\0';\r\n\r\n  q = strchr(p, '\\n');\r\n  if(q)\r\n    *q = '\\0';\r\n\r\n  if(copy != p)\r\n    memmove(copy, p, strlen(p) + 1);\r\n\r\n  /* in case we built debug enabled, we allow an evironment variable\r\n   * named CURL_TESTDIR to prefix the given file name to put it into a\r\n   * specific directory\r\n   */\r\n#ifdef DEBUGBUILD\r\n  {\r\n    char *tdir = curlx_getenv(\"CURL_TESTDIR\");\r\n    if(tdir) {\r\n      char buffer[512]; /* suitably large */\r\n      snprintf(buffer, sizeof(buffer), \"%s/%s\", tdir, copy);\r\n      Curl_safefree(copy);\r\n      copy = strdup(buffer); /* clone the buffer, we don't use the libcurl\r\n                                aprintf() or similar since we want to use the\r\n                                same memory code as the \"real\" parse_filename\r\n                                function */\r\n      curl_free(tdir);\r\n    }\r\n  }\r\n#endif\r\n\r\n  return copy;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_hdr.h",
    "content": "#ifndef HEADER_CURL_TOOL_CB_HDR_H\r\n#define HEADER_CURL_TOOL_CB_HDR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/*\r\n * curl operates using a single HdrCbData struct variable, a\r\n * pointer to this is passed as userdata pointer to tool_header_cb.\r\n *\r\n * 'outs' member is a pointer to the OutStruct variable used to keep\r\n * track of information relative to curl's output writing.\r\n *\r\n * 'heads' member is a pointer to the OutStruct variable used to keep\r\n * track of information relative to header response writing.\r\n *\r\n * 'honor_cd_filename' member is TRUE when tool_header_cb is allowed\r\n * to honor Content-Disposition filename property and accordingly\r\n * set 'outs' filename, otherwise FALSE;\r\n */\r\n\r\nstruct HdrCbData {\r\n  struct OutStruct *outs;\r\n  struct OutStruct *heads;\r\n  bool honor_cd_filename;\r\n};\r\n\r\n/*\r\n** callback for CURLOPT_HEADERFUNCTION\r\n*/\r\n\r\nsize_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata);\r\n\r\n#endif /* HEADER_CURL_TOOL_CB_HDR_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_prg.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_cb_prg.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/*\r\n** callback for CURLOPT_PROGRESSFUNCTION\r\n*/\r\n\r\n#define MAX_BARLENGTH 256\r\n\r\nint tool_progress_cb(void *clientp,\r\n                     double dltotal, double dlnow,\r\n                     double ultotal, double ulnow)\r\n{\r\n  /* The original progress-bar source code was written for curl by Lars Aas,\r\n     and this new edition inherits some of his concepts. */\r\n\r\n  char line[MAX_BARLENGTH+1];\r\n  char format[40];\r\n  double frac;\r\n  double percent;\r\n  int barwidth;\r\n  int num;\r\n  int i;\r\n\r\n  struct ProgressData *bar = (struct ProgressData *)clientp;\r\n\r\n  /* expected transfer size */\r\n  curl_off_t total = (curl_off_t)dltotal + (curl_off_t)ultotal +\r\n    bar->initial_size;\r\n\r\n  /* we've come this far */\r\n  curl_off_t point = (curl_off_t)dlnow + (curl_off_t)ulnow +\r\n    bar->initial_size;\r\n\r\n  if(point > total)\r\n    /* we have got more than the expected total! */\r\n    total = point;\r\n\r\n  /* simply count invokes */\r\n  bar->calls++;\r\n\r\n  if(total < 1) {\r\n    curl_off_t prevblock = bar->prev / 1024;\r\n    curl_off_t thisblock = point / 1024;\r\n    while(thisblock > prevblock) {\r\n      fprintf(bar->out, \"#\");\r\n      prevblock++;\r\n    }\r\n  }\r\n  else if(point != bar->prev) {\r\n    frac = (double)point / (double)total;\r\n    percent = frac * 100.0f;\r\n    barwidth = bar->width - 7;\r\n    num = (int) (((double)barwidth) * frac);\r\n    if(num > MAX_BARLENGTH)\r\n      num = MAX_BARLENGTH;\r\n    for(i = 0; i < num; i++)\r\n      line[i] = '#';\r\n    line[i] = '\\0';\r\n    snprintf(format, sizeof(format), \"\\r%%-%ds %%5.1f%%%%\", barwidth);\r\n    fprintf(bar->out, format, line, percent);\r\n  }\r\n  fflush(bar->out);\r\n  bar->prev = point;\r\n\r\n  return 0;\r\n}\r\n\r\nvoid progressbarinit(struct ProgressData *bar,\r\n                     struct Configurable *config)\r\n{\r\n#ifdef __EMX__\r\n  /* 20000318 mgs */\r\n  int scr_size[2];\r\n#endif\r\n  char *colp;\r\n\r\n  memset(bar, 0, sizeof(struct ProgressData));\r\n\r\n  /* pass this through to progress function so\r\n   * it can display progress towards total file\r\n   * not just the part that's left. (21-may-03, dbyron) */\r\n  if(config->use_resume)\r\n    bar->initial_size = config->resume_from;\r\n\r\n/* TODO: get terminal width through ansi escapes or something similar.\r\n   try to update width when xterm is resized... - 19990617 larsa */\r\n#ifndef __EMX__\r\n  /* 20000318 mgs\r\n   * OS/2 users most likely won't have this env var set, and besides that\r\n   * we're using our own way to determine screen width */\r\n  colp = curlx_getenv(\"COLUMNS\");\r\n  if(colp) {\r\n    char *endptr;\r\n    long num = strtol(colp, &endptr, 10);\r\n    if((endptr != colp) && (endptr == colp + strlen(colp)) && (num > 0))\r\n      bar->width = (int)num;\r\n    else\r\n      bar->width = 79;\r\n    curl_free(colp);\r\n  }\r\n  else\r\n    bar->width = 79;\r\n#else\r\n  /* 20000318 mgs\r\n   * We use this emx library call to get the screen width, and subtract\r\n   * one from what we got in order to avoid a problem with the cursor\r\n   * advancing to the next line if we print a string that is as long as\r\n   * the screen is wide. */\r\n\r\n  _scrsize(scr_size);\r\n  bar->width = scr_size[0] - 1;\r\n#endif\r\n\r\n  bar->out = config->errors;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_prg.h",
    "content": "#ifndef HEADER_CURL_TOOL_CB_PRG_H\r\n#define HEADER_CURL_TOOL_CB_PRG_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define CURL_PROGRESS_STATS 0 /* default progress display */\r\n#define CURL_PROGRESS_BAR   1\r\n\r\nstruct ProgressData {\r\n  int         calls;\r\n  curl_off_t  prev;\r\n  int         width;\r\n  FILE       *out;  /* where to write everything to */\r\n  curl_off_t  initial_size;\r\n};\r\n\r\nvoid progressbarinit(struct ProgressData *bar,\r\n                     struct Configurable *config);\r\n\r\n/*\r\n** callback for CURLOPT_PROGRESSFUNCTION\r\n*/\r\n\r\nint tool_progress_cb(void *clientp,\r\n                     double dltotal, double dlnow,\r\n                     double ultotal, double ulnow);\r\n\r\n#endif /* HEADER_CURL_TOOL_CB_PRG_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_rea.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_cb_rea.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/*\r\n** callback for CURLOPT_READFUNCTION\r\n*/\r\n\r\nsize_t tool_read_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)\r\n{\r\n  ssize_t rc;\r\n  struct InStruct *in = userdata;\r\n\r\n  rc = read(in->fd, buffer, sz*nmemb);\r\n  if(rc < 0) {\r\n    if(errno == EAGAIN) {\r\n      errno = 0;\r\n      in->config->readbusy = TRUE;\r\n      return CURL_READFUNC_PAUSE;\r\n    }\r\n    /* since size_t is unsigned we can't return negative values fine */\r\n    rc = 0;\r\n  }\r\n  in->config->readbusy = FALSE;\r\n  return (size_t)rc;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_rea.h",
    "content": "#ifndef HEADER_CURL_TOOL_CB_REA_H\r\n#define HEADER_CURL_TOOL_CB_REA_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/*\r\n** callback for CURLOPT_READFUNCTION\r\n*/\r\n\r\nsize_t tool_read_cb(void *buffer, size_t sz, size_t nmemb, void *userdata);\r\n\r\n#endif /* HEADER_CURL_TOOL_CB_REA_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_see.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_cb_see.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/* OUR_MAX_SEEK_L has 'long' data type, OUR_MAX_SEEK_O has 'curl_off_t,\r\n   both represent the same value. Maximum offset used here when we lseek\r\n   using a 'long' data type offset */\r\n\r\n#define OUR_MAX_SEEK_L  2147483647L - 1L\r\n#define OUR_MAX_SEEK_O  CURL_OFF_T_C(0x7FFFFFFF) - CURL_OFF_T_C(0x1)\r\n\r\n/*\r\n** callback for CURLOPT_SEEKFUNCTION\r\n**\r\n** Notice that this is not supposed to return the resulting offset. This\r\n** shall only return CURL_SEEKFUNC_* return codes.\r\n*/\r\n\r\nint tool_seek_cb(void *userdata, curl_off_t offset, int whence)\r\n{\r\n  struct InStruct *in = userdata;\r\n\r\n#if(CURL_SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES)\r\n\r\n  /* The offset check following here is only interesting if curl_off_t is\r\n     larger than off_t and we are not using the WIN32 large file support\r\n     macros that provide the support to do 64bit seeks correctly */\r\n\r\n  if(offset > OUR_MAX_SEEK_O) {\r\n    /* Some precaution code to work around problems with different data sizes\r\n       to allow seeking >32bit even if off_t is 32bit. Should be very rare and\r\n       is really valid on weirdo-systems. */\r\n    curl_off_t left = offset;\r\n\r\n    if(whence != SEEK_SET)\r\n      /* this code path doesn't support other types */\r\n      return CURL_SEEKFUNC_FAIL;\r\n\r\n    if(LSEEK_ERROR == lseek(in->fd, 0, SEEK_SET))\r\n      /* couldn't rewind to beginning */\r\n      return CURL_SEEKFUNC_FAIL;\r\n\r\n    while(left) {\r\n      long step = (left > OUR_MAX_SEEK_O) ? OUR_MAX_SEEK_L : (long)left;\r\n      if(LSEEK_ERROR == lseek(in->fd, step, SEEK_CUR))\r\n        /* couldn't seek forwards the desired amount */\r\n        return CURL_SEEKFUNC_FAIL;\r\n      left -= step;\r\n    }\r\n    return CURL_SEEKFUNC_OK;\r\n  }\r\n#endif\r\n\r\n  if(LSEEK_ERROR == lseek(in->fd, offset, whence))\r\n    /* couldn't rewind, the reason is in errno but errno is just not portable\r\n       enough and we don't actually care that much why we failed. We'll let\r\n       libcurl know that it may try other means if it wants to. */\r\n    return CURL_SEEKFUNC_CANTSEEK;\r\n\r\n  return CURL_SEEKFUNC_OK;\r\n}\r\n\r\n#if defined(WIN32) && !defined(__MINGW64__)\r\n\r\n#ifdef __BORLANDC__\r\n/* 64-bit lseek-like function unavailable */\r\n#  define _lseeki64(hnd,ofs,whence) lseek(hnd,ofs,whence)\r\n#endif\r\n\r\n#ifdef __POCC__\r\n#  if(__POCC__ < 450)\r\n/* 64-bit lseek-like function unavailable */\r\n#    define _lseeki64(hnd,ofs,whence) _lseek(hnd,ofs,whence)\r\n#  else\r\n#    define _lseeki64(hnd,ofs,whence) _lseek64(hnd,ofs,whence)\r\n#  endif\r\n#endif\r\n\r\n#ifdef _WIN32_WCE\r\n/* 64-bit lseek-like function unavailable */\r\n#  undef _lseeki64\r\n#  define _lseeki64(hnd,ofs,whence) lseek(hnd,ofs,whence)\r\n#  undef _get_osfhandle\r\n#  define _get_osfhandle(fd) (fd)\r\n#endif\r\n\r\n/*\r\n * Truncate a file handle at a 64-bit position 'where'.\r\n */\r\n\r\nint tool_ftruncate64(int fd, curl_off_t where)\r\n{\r\n  if(_lseeki64(fd, where, SEEK_SET) < 0)\r\n    return -1;\r\n\r\n  if(!SetEndOfFile((HANDLE)_get_osfhandle(fd)))\r\n    return -1;\r\n\r\n  return 0;\r\n}\r\n\r\n#endif /* WIN32  && ! __MINGW64__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_see.h",
    "content": "#ifndef HEADER_CURL_TOOL_CB_SEE_H\r\n#define HEADER_CURL_TOOL_CB_SEE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#if defined(WIN32) && !defined(__MINGW64__)\r\n\r\nint tool_ftruncate64(int fd, curl_off_t where);\r\n\r\n#undef  ftruncate\r\n#define ftruncate(fd,where) tool_ftruncate64(fd,where)\r\n\r\n#ifndef HAVE_FTRUNCATE\r\n#  define HAVE_FTRUNCATE 1\r\n#endif\r\n\r\n#endif /* WIN32  && ! __MINGW64__ */\r\n\r\n/*\r\n** callback for CURLOPT_SEEKFUNCTION\r\n*/\r\n\r\nint tool_seek_cb(void *userdata, curl_off_t offset, int whence);\r\n\r\n#endif /* HEADER_CURL_TOOL_CB_SEE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_wrt.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_cb_wrt.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/*\r\n** callback for CURLOPT_WRITEFUNCTION\r\n*/\r\n\r\nsize_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)\r\n{\r\n  size_t rc;\r\n  struct OutStruct *outs = userdata;\r\n  struct Configurable *config = outs->config;\r\n\r\n  /*\r\n   * Once that libcurl has called back tool_write_cb() the returned value\r\n   * is checked against the amount that was intended to be written, if\r\n   * it does not match then it fails with CURLE_WRITE_ERROR. So at this\r\n   * point returning a value different from sz*nmemb indicates failure.\r\n   */\r\n  const size_t failure = (sz * nmemb) ? 0 : 1;\r\n\r\n  if(!config)\r\n    return failure;\r\n\r\n#ifdef DEBUGBUILD\r\n  if(config->include_headers) {\r\n    if(sz * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {\r\n      warnf(config, \"Header data size exceeds single call write limit!\\n\");\r\n      return failure;\r\n    }\r\n  }\r\n  else {\r\n    if(sz * nmemb > (size_t)CURL_MAX_WRITE_SIZE) {\r\n      warnf(config, \"Data size exceeds single call write limit!\\n\");\r\n      return failure;\r\n    }\r\n  }\r\n\r\n  {\r\n    /* Some internal congruency checks on received OutStruct */\r\n    bool check_fails = FALSE;\r\n    if(outs->filename) {\r\n      /* regular file */\r\n      if(!*outs->filename)\r\n        check_fails = TRUE;\r\n      if(!outs->s_isreg)\r\n        check_fails = TRUE;\r\n      if(outs->fopened && !outs->stream)\r\n        check_fails = TRUE;\r\n      if(!outs->fopened && outs->stream)\r\n        check_fails = TRUE;\r\n      if(!outs->fopened && outs->bytes)\r\n        check_fails = TRUE;\r\n    }\r\n    else {\r\n      /* standard stream */\r\n      if(!outs->stream || outs->s_isreg || outs->fopened)\r\n        check_fails = TRUE;\r\n      if(outs->alloc_filename || outs->is_cd_filename || outs->init)\r\n        check_fails = TRUE;\r\n    }\r\n    if(check_fails) {\r\n      warnf(config, \"Invalid output struct data for write callback\\n\");\r\n      return failure;\r\n    }\r\n  }\r\n#endif\r\n\r\n  if(!outs->stream) {\r\n    FILE *file;\r\n\r\n    if(!outs->filename || !*outs->filename) {\r\n      warnf(config, \"Remote filename has no length!\\n\");\r\n      return failure;\r\n    }\r\n\r\n    if(outs->is_cd_filename) {\r\n      /* don't overwrite existing files */\r\n      file = fopen(outs->filename, \"rb\");\r\n      if(file) {\r\n        fclose(file);\r\n        warnf(config, \"Refusing to overwrite %s: %s\\n\", outs->filename,\r\n              strerror(EEXIST));\r\n        return failure;\r\n      }\r\n    }\r\n\r\n    /* open file for writing */\r\n    file = fopen(outs->filename, \"wb\");\r\n    if(!file) {\r\n      warnf(config, \"Failed to create the file %s: %s\\n\", outs->filename,\r\n            strerror(errno));\r\n      return failure;\r\n    }\r\n    outs->s_isreg = TRUE;\r\n    outs->fopened = TRUE;\r\n    outs->stream = file;\r\n    outs->bytes = 0;\r\n    outs->init = 0;\r\n  }\r\n\r\n  rc = fwrite(buffer, sz, nmemb, outs->stream);\r\n\r\n  if((sz * nmemb) == rc)\r\n    /* we added this amount of data to the output */\r\n    outs->bytes += (sz * nmemb);\r\n\r\n  if(config->readbusy) {\r\n    config->readbusy = FALSE;\r\n    curl_easy_pause(config->easy, CURLPAUSE_CONT);\r\n  }\r\n\r\n  if(config->nobuffer) {\r\n    /* output buffering disabled */\r\n    int res = fflush(outs->stream);\r\n    if(res)\r\n      return failure;\r\n  }\r\n\r\n  return rc;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cb_wrt.h",
    "content": "#ifndef HEADER_CURL_TOOL_CB_WRT_H\r\n#define HEADER_CURL_TOOL_CB_WRT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/*\r\n** callback for CURLOPT_WRITEFUNCTION\r\n*/\r\n\r\nsize_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata);\r\n\r\n#endif /* HEADER_CURL_TOOL_CB_WRT_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cfgable.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nvoid free_config_fields(struct Configurable *config)\r\n{\r\n  struct getout *urlnode;\r\n\r\n  if(config->easy) {\r\n    curl_easy_cleanup(config->easy);\r\n    config->easy = NULL;\r\n  }\r\n\r\n  Curl_safefree(config->random_file);\r\n  Curl_safefree(config->egd_file);\r\n  Curl_safefree(config->useragent);\r\n  Curl_safefree(config->cookie);\r\n  Curl_safefree(config->cookiejar);\r\n  Curl_safefree(config->cookiefile);\r\n\r\n  Curl_safefree(config->postfields);\r\n  Curl_safefree(config->referer);\r\n\r\n  Curl_safefree(config->headerfile);\r\n  Curl_safefree(config->ftpport);\r\n  Curl_safefree(config->iface);\r\n\r\n  Curl_safefree(config->range);\r\n\r\n  Curl_safefree(config->userpwd);\r\n  Curl_safefree(config->tls_username);\r\n  Curl_safefree(config->tls_password);\r\n  Curl_safefree(config->tls_authtype);\r\n  Curl_safefree(config->proxyuserpwd);\r\n  Curl_safefree(config->proxy);\r\n\r\n  Curl_safefree(config->noproxy);\r\n\r\n  Curl_safefree(config->mail_from);\r\n  curl_slist_free_all(config->mail_rcpt);\r\n  Curl_safefree(config->mail_auth);\r\n\r\n  Curl_safefree(config->netrc_file);\r\n\r\n  urlnode = config->url_list;\r\n  while(urlnode) {\r\n    struct getout *next = urlnode->next;\r\n    Curl_safefree(urlnode->url);\r\n    Curl_safefree(urlnode->outfile);\r\n    Curl_safefree(urlnode->infile);\r\n    Curl_safefree(urlnode);\r\n    urlnode = next;\r\n  }\r\n  config->url_list = NULL;\r\n  config->url_last = NULL;\r\n  config->url_get = NULL;\r\n  config->url_out = NULL;\r\n\r\n  Curl_safefree(config->cipher_list);\r\n  Curl_safefree(config->cert);\r\n  Curl_safefree(config->cert_type);\r\n  Curl_safefree(config->cacert);\r\n  Curl_safefree(config->capath);\r\n  Curl_safefree(config->crlfile);\r\n  Curl_safefree(config->key);\r\n  Curl_safefree(config->key_type);\r\n  Curl_safefree(config->key_passwd);\r\n  Curl_safefree(config->pubkey);\r\n  Curl_safefree(config->hostpubmd5);\r\n  Curl_safefree(config->engine);\r\n\r\n  Curl_safefree(config->customrequest);\r\n  Curl_safefree(config->krblevel);\r\n  Curl_safefree(config->trace_dump);\r\n\r\n  config->trace_stream = NULL; /* closed elsewhere when appropriate */\r\n\r\n  Curl_safefree(config->writeout);\r\n\r\n  config->errors = NULL; /* closed elsewhere when appropriate */\r\n\r\n  curl_slist_free_all(config->quote);\r\n  curl_slist_free_all(config->postquote);\r\n  curl_slist_free_all(config->prequote);\r\n\r\n  curl_slist_free_all(config->headers);\r\n\r\n  if(config->httppost) {\r\n    curl_formfree(config->httppost);\r\n    config->httppost = NULL;\r\n  }\r\n  config->last_post = NULL;\r\n\r\n  curl_slist_free_all(config->telnet_options);\r\n  curl_slist_free_all(config->resolve);\r\n\r\n  Curl_safefree(config->socksproxy);\r\n  Curl_safefree(config->socks5_gssapi_service);\r\n\r\n  Curl_safefree(config->ftp_account);\r\n  Curl_safefree(config->ftp_alternative_to_user);\r\n\r\n  Curl_safefree(config->libcurl);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_cfgable.h",
    "content": "#ifndef HEADER_CURL_TOOL_CFGABLE_H\r\n#define HEADER_CURL_TOOL_CFGABLE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"tool_sdecls.h\"\r\n\r\n#include \"tool_metalink.h\"\r\n\r\nstruct Configurable {\r\n  CURL *easy;               /* once we have one, we keep it here */\r\n  bool remote_time;\r\n  char *random_file;\r\n  char *egd_file;\r\n  char *useragent;\r\n  char *cookie;             /* single line with specified cookies */\r\n  char *cookiejar;          /* write to this file */\r\n  char *cookiefile;         /* read from this file */\r\n  bool cookiesession;       /* new session? */\r\n  bool encoding;            /* Accept-Encoding please */\r\n  bool tr_encoding;         /* Transfer-Encoding please */\r\n  unsigned long authtype;   /* auth bitmask */\r\n  bool use_resume;\r\n  bool resume_from_current;\r\n  bool disable_epsv;\r\n  bool disable_eprt;\r\n  bool ftp_pret;\r\n  long proto;\r\n  bool proto_present;\r\n  long proto_redir;\r\n  bool proto_redir_present;\r\n  curl_off_t resume_from;\r\n  char *postfields;\r\n  curl_off_t postfieldsize;\r\n  char *referer;\r\n  long timeout;\r\n  long connecttimeout;\r\n  long maxredirs;\r\n  curl_off_t max_filesize;\r\n  char *headerfile;\r\n  char *ftpport;\r\n  char *iface;\r\n  int localport;\r\n  int localportrange;\r\n  unsigned short porttouse;\r\n  char *range;\r\n  long low_speed_limit;\r\n  long low_speed_time;\r\n  int showerror; /* -1 == unset, default => show errors\r\n                    0 => -s is used to NOT show errors\r\n                    1 => -S has been used to show errors */\r\n  char *userpwd;\r\n  char *tls_username;\r\n  char *tls_password;\r\n  char *tls_authtype;\r\n  char *proxyuserpwd;\r\n  char *proxy;\r\n  int proxyver;             /* set to CURLPROXY_HTTP* define */\r\n  char *noproxy;\r\n  char *mail_from;\r\n  struct curl_slist *mail_rcpt;\r\n  char *mail_auth;\r\n  bool proxytunnel;\r\n  bool ftp_append;          /* APPE on ftp */\r\n  bool mute;                /* don't show messages, --silent given */\r\n  bool use_ascii;           /* select ascii or text transfer */\r\n  bool autoreferer;         /* automatically set referer */\r\n  bool failonerror;         /* fail on (HTTP) errors */\r\n  bool include_headers;     /* send headers to data output */\r\n  bool no_body;             /* don't get the body */\r\n  bool dirlistonly;         /* only get the FTP dir list */\r\n  bool followlocation;      /* follow http redirects */\r\n  bool unrestricted_auth;   /* Continue to send authentication (user+password)\r\n                               when following ocations, even when hostname\r\n                               changed */\r\n  bool netrc_opt;\r\n  bool netrc;\r\n  char *netrc_file;\r\n  bool noprogress;          /* don't show progress meter, --silent given */\r\n  bool isatty;              /* updated internally only if output is a tty */\r\n  struct getout *url_list;  /* point to the first node */\r\n  struct getout *url_last;  /* point to the last/current node */\r\n  struct getout *url_get;   /* point to the node to fill in URL */\r\n  struct getout *url_out;   /* point to the node to fill in outfile */\r\n  char *cipher_list;\r\n  char *cert;\r\n  char *cert_type;\r\n  char *cacert;\r\n  char *capath;\r\n  char *crlfile;\r\n  char *key;\r\n  char *key_type;\r\n  char *key_passwd;\r\n  char *pubkey;\r\n  char *hostpubmd5;\r\n  char *engine;\r\n  bool list_engines;\r\n  bool crlf;\r\n  char *customrequest;\r\n  char *krblevel;\r\n  char *trace_dump;         /* file to dump the network trace to, or NULL */\r\n  FILE *trace_stream;\r\n  bool trace_fopened;\r\n  trace tracetype;\r\n  bool tracetime;           /* include timestamp? */\r\n  long httpversion;\r\n  int progressmode;         /* CURL_PROGRESS_BAR or CURL_PROGRESS_STATS */\r\n  bool nobuffer;\r\n  bool readbusy;            /* set when reading input returns EAGAIN */\r\n  bool globoff;\r\n  bool use_httpget;\r\n  bool insecure_ok;         /* set TRUE to allow insecure SSL connects */\r\n  bool create_dirs;\r\n  bool ftp_create_dirs;\r\n  bool ftp_skip_ip;\r\n  bool proxynegotiate;\r\n  bool proxyntlm;\r\n  bool proxydigest;\r\n  bool proxybasic;\r\n  bool proxyanyauth;\r\n  char *writeout;           /* %-styled format string to output */\r\n  bool writeenv;            /* write results to environment, if available */\r\n  FILE *errors;             /* errors stream, defaults to stderr */\r\n  bool errors_fopened;      /* whether errors stream isn't stderr */\r\n  struct curl_slist *quote;\r\n  struct curl_slist *postquote;\r\n  struct curl_slist *prequote;\r\n  long ssl_version;\r\n  long ip_version;\r\n  curl_TimeCond timecond;\r\n  time_t condtime;\r\n  struct curl_slist *headers;\r\n  struct curl_httppost *httppost;\r\n  struct curl_httppost *last_post;\r\n  struct curl_slist *telnet_options;\r\n  struct curl_slist *resolve;\r\n  HttpReq httpreq;\r\n\r\n  /* for bandwidth limiting features: */\r\n  curl_off_t sendpersecond; /* send to peer */\r\n  curl_off_t recvpersecond; /* receive from peer */\r\n\r\n  bool ftp_ssl;\r\n  bool ftp_ssl_reqd;\r\n  bool ftp_ssl_control;\r\n  bool ftp_ssl_ccc;\r\n  int ftp_ssl_ccc_mode;\r\n\r\n  char *socksproxy;         /* set to server string */\r\n  int socksver;             /* set to CURLPROXY_SOCKS* define */\r\n  char *socks5_gssapi_service;  /* set service name for gssapi principal\r\n                                 * default rcmd */\r\n  int socks5_gssapi_nec ;   /* The NEC reference server does not protect\r\n                             * the encryption type exchange */\r\n\r\n  bool tcp_nodelay;\r\n  long req_retry;           /* number of retries */\r\n  long retry_delay;         /* delay between retries (in seconds) */\r\n  long retry_maxtime;       /* maximum time to keep retrying */\r\n\r\n  char *ftp_account;        /* for ACCT */\r\n  char *ftp_alternative_to_user;  /* send command if USER/PASS fails */\r\n  int ftp_filemethod;\r\n  long tftp_blksize;        /* TFTP BLKSIZE option */\r\n  bool ignorecl;            /* --ignore-content-length */\r\n  bool disable_sessionid;\r\n\r\n  char *libcurl;            /* output libcurl code to this file name */\r\n  bool raw;\r\n  bool post301;\r\n  bool post302;\r\n  bool post303;\r\n  bool nokeepalive;         /* for keepalive needs */\r\n  long alivetime;\r\n  bool content_disposition; /* use Content-disposition filename */\r\n\r\n  int default_node_flags;   /* default flags to search for each 'node', which\r\n                               is basically each given URL to transfer */\r\n\r\n  bool xattr;               /* store metadata in extended attributes */\r\n  long gssapi_delegation;\r\n  bool ssl_allow_beast;     /* allow this SSL vulnerability */\r\n\r\n  bool use_metalink;        /* process given URLs as metalink XML file */\r\n  metalinkfile *metalinkfile_list; /* point to the first node */\r\n  metalinkfile *metalinkfile_last; /* point to the last/current node */\r\n}; /* struct Configurable */\r\n\r\nvoid free_config_fields(struct Configurable *config);\r\n\r\n#endif /* HEADER_CURL_TOOL_CFGABLE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_convert.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n\r\n#ifdef HAVE_ICONV\r\n#  include <iconv.h>\r\n#endif\r\n\r\n#include \"tool_convert.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef HAVE_ICONV\r\n\r\n/* curl tool iconv conversion descriptors */\r\nstatic iconv_t inbound_cd  = (iconv_t)-1;\r\nstatic iconv_t outbound_cd = (iconv_t)-1;\r\n\r\n/* set default codesets for iconv */\r\n#ifndef CURL_ICONV_CODESET_OF_NETWORK\r\n#  define CURL_ICONV_CODESET_OF_NETWORK \"ISO8859-1\"\r\n#endif\r\n\r\n/*\r\n * convert_to_network() is a curl tool function to convert\r\n * from the host encoding to ASCII on non-ASCII platforms.\r\n */\r\nCURLcode convert_to_network(char *buffer, size_t length)\r\n{\r\n  /* translate from the host encoding to the network encoding */\r\n  char *input_ptr, *output_ptr;\r\n  size_t res, in_bytes, out_bytes;\r\n\r\n  /* open an iconv conversion descriptor if necessary */\r\n  if(outbound_cd == (iconv_t)-1) {\r\n    outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,\r\n                             CURL_ICONV_CODESET_OF_HOST);\r\n    if(outbound_cd == (iconv_t)-1) {\r\n      return CURLE_CONV_FAILED;\r\n    }\r\n  }\r\n  /* call iconv */\r\n  input_ptr = output_ptr = buffer;\r\n  in_bytes = out_bytes = length;\r\n  res = iconv(outbound_cd, &input_ptr,  &in_bytes,\r\n              &output_ptr, &out_bytes);\r\n  if((res == (size_t)-1) || (in_bytes != 0)) {\r\n    return CURLE_CONV_FAILED;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * convert_from_network() is a curl tool function\r\n * for performing ASCII conversions on non-ASCII platforms.\r\n */\r\nCURLcode convert_from_network(char *buffer, size_t length)\r\n{\r\n  /* translate from the network encoding to the host encoding */\r\n  char *input_ptr, *output_ptr;\r\n  size_t res, in_bytes, out_bytes;\r\n\r\n  /* open an iconv conversion descriptor if necessary */\r\n  if(inbound_cd == (iconv_t)-1) {\r\n    inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,\r\n                            CURL_ICONV_CODESET_OF_NETWORK);\r\n    if(inbound_cd == (iconv_t)-1) {\r\n      return CURLE_CONV_FAILED;\r\n    }\r\n  }\r\n  /* call iconv */\r\n  input_ptr = output_ptr = buffer;\r\n  in_bytes = out_bytes = length;\r\n  res = iconv(inbound_cd, &input_ptr,  &in_bytes,\r\n              &output_ptr, &out_bytes);\r\n  if((res == (size_t)-1) || (in_bytes != 0)) {\r\n    return CURLE_CONV_FAILED;\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid convert_cleanup(void)\r\n{\r\n  /* close iconv conversion descriptors */\r\n  if(inbound_cd != (iconv_t)-1)\r\n    (void)iconv_close(inbound_cd);\r\n  if(outbound_cd != (iconv_t)-1)\r\n    (void)iconv_close(outbound_cd);\r\n}\r\n\r\n#endif /* HAVE_ICONV */\r\n\r\nchar convert_char(curl_infotype infotype, char this_char)\r\n{\r\n/* determine how this specific character should be displayed */\r\n  switch(infotype) {\r\n  case CURLINFO_DATA_IN:\r\n  case CURLINFO_DATA_OUT:\r\n  case CURLINFO_SSL_DATA_IN:\r\n  case CURLINFO_SSL_DATA_OUT:\r\n    /* data, treat as ASCII */\r\n    if((this_char >= 0x20) && (this_char < 0x7f)) {\r\n      /* printable ASCII hex value: convert to host encoding */\r\n      (void)convert_from_network(&this_char, 1);\r\n    }\r\n    else {\r\n      /* non-printable ASCII, use a replacement character */\r\n      return UNPRINTABLE_CHAR;\r\n    }\r\n    /* fall through to default */\r\n  default:\r\n    /* treat as host encoding */\r\n    if(ISPRINT(this_char)\r\n       &&  (this_char != '\\t')\r\n       &&  (this_char != '\\r')\r\n       &&  (this_char != '\\n')) {\r\n      /* printable characters excluding tabs and line end characters */\r\n      return this_char;\r\n    }\r\n    break;\r\n  }\r\n  /* non-printable, use a replacement character  */\r\n  return UNPRINTABLE_CHAR;\r\n}\r\n\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_convert.h",
    "content": "#ifndef HEADER_CURL_TOOL_CONVERT_H\r\n#define HEADER_CURL_TOOL_CONVERT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n\r\n#ifdef HAVE_ICONV\r\n\r\nCURLcode convert_to_network(char *buffer, size_t length);\r\nCURLcode convert_from_network(char *buffer, size_t length);\r\nvoid convert_cleanup(void);\r\n\r\n#endif /* HAVE_ICONV */\r\n\r\nchar convert_char(curl_infotype infotype, char this_char);\r\n\r\n#endif /* CURL_DOES_CONVERSIONS */\r\n\r\n#if !defined(CURL_DOES_CONVERSIONS) || !defined(HAVE_ICONV)\r\n#define convert_cleanup() Curl_nop_stmt\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_CONVERT_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_dirhie.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include <sys/stat.h>\r\n\r\n#ifdef WIN32\r\n#  include <direct.h>\r\n#endif\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_dirhie.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef NETWARE\r\n#  ifndef __NOVELL_LIBC__\r\n#    define mkdir mkdir_510\r\n#  endif\r\n#endif\r\n\r\n#ifdef WIN32\r\n#  define mkdir(x,y) (mkdir)((x))\r\n#  ifndef __POCC__\r\n#    define F_OK 0\r\n#  endif\r\n#endif\r\n\r\nstatic void show_dir_errno(FILE *errors, const char *name)\r\n{\r\n  switch(ERRNO) {\r\n#ifdef EACCES\r\n  case EACCES:\r\n    fprintf(errors, \"You don't have permission to create %s.\\n\", name);\r\n    break;\r\n#endif\r\n#ifdef ENAMETOOLONG\r\n  case ENAMETOOLONG:\r\n    fprintf(errors, \"The directory name %s is too long.\\n\", name);\r\n    break;\r\n#endif\r\n#ifdef EROFS\r\n  case EROFS:\r\n    fprintf(errors, \"%s resides on a read-only file system.\\n\", name);\r\n    break;\r\n#endif\r\n#ifdef ENOSPC\r\n  case ENOSPC:\r\n    fprintf(errors, \"No space left on the file system that will \"\r\n            \"contain the directory %s.\\n\", name);\r\n    break;\r\n#endif\r\n#ifdef EDQUOT\r\n  case EDQUOT:\r\n    fprintf(errors, \"Cannot create directory %s because you \"\r\n            \"exceeded your quota.\\n\", name);\r\n    break;\r\n#endif\r\n  default :\r\n    fprintf(errors, \"Error creating directory %s.\\n\", name);\r\n    break;\r\n  }\r\n}\r\n\r\n/*\r\n * Create the needed directory hierarchy recursively in order to save\r\n *  multi-GETs in file output, ie:\r\n *  curl \"http://my.site/dir[1-5]/file[1-5].txt\" -o \"dir#1/file#2.txt\"\r\n *  should create all the dir* automagically\r\n */\r\n\r\nCURLcode create_dir_hierarchy(const char *outfile, FILE *errors)\r\n{\r\n  char *tempdir;\r\n  char *tempdir2;\r\n  char *outdup;\r\n  char *dirbuildup;\r\n  CURLcode result = CURLE_OK;\r\n\r\n  outdup = strdup(outfile);\r\n  if(!outdup)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  dirbuildup = malloc(strlen(outfile) + 1);\r\n  if(!dirbuildup) {\r\n    Curl_safefree(outdup);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  dirbuildup[0] = '\\0';\r\n\r\n  tempdir = strtok(outdup, DIR_CHAR);\r\n\r\n  while(tempdir != NULL) {\r\n    tempdir2 = strtok(NULL, DIR_CHAR);\r\n    /* since strtok returns a token for the last word even\r\n       if not ending with DIR_CHAR, we need to prune it */\r\n    if(tempdir2 != NULL) {\r\n      size_t dlen = strlen(dirbuildup);\r\n      if(dlen)\r\n        sprintf(&dirbuildup[dlen], \"%s%s\", DIR_CHAR, tempdir);\r\n      else {\r\n        if(0 != strncmp(outdup, DIR_CHAR, 1))\r\n          strcpy(dirbuildup, tempdir);\r\n        else\r\n          sprintf(dirbuildup, \"%s%s\", DIR_CHAR, tempdir);\r\n      }\r\n      if(access(dirbuildup, F_OK) == -1) {\r\n        if(-1 == mkdir(dirbuildup,(mode_t)0000750)) {\r\n          show_dir_errno(errors, dirbuildup);\r\n          result = CURLE_WRITE_ERROR;\r\n          break; /* get out of loop */\r\n        }\r\n      }\r\n    }\r\n    tempdir = tempdir2;\r\n  }\r\n\r\n  Curl_safefree(dirbuildup);\r\n  Curl_safefree(outdup);\r\n\r\n  return result;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_dirhie.h",
    "content": "#ifndef HEADER_CURL_TOOL_DIRHIE_H\r\n#define HEADER_CURL_TOOL_DIRHIE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nCURLcode create_dir_hierarchy(const char *outfile, FILE *errors);\r\n\r\n#endif /* HEADER_CURL_TOOL_DIRHIE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_doswin.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4127 : conditional expression is constant\r\n#pragma warning( disable : 4127 )\r\n\r\n\r\n#include \"tool_setup.h\"\r\n\r\n#if defined(MSDOS) || defined(WIN32)\r\n\r\n#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME)\r\n#  include <libgen.h>\r\n#endif\r\n\r\n#ifdef WIN32\r\n#  include \"tool_cfgable.h\"\r\n#  include \"tool_libinfo.h\"\r\n#endif\r\n\r\n#include \"tool_bname.h\"\r\n#include \"tool_doswin.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/*\r\n * Macros ALWAYS_TRUE and ALWAYS_FALSE are used to avoid compiler warnings.\r\n */\r\n\r\n#define ALWAYS_TRUE   (1)\r\n#define ALWAYS_FALSE  (0)\r\n\r\n#if defined(_MSC_VER) && !defined(__POCC__)\r\n#  undef ALWAYS_TRUE\r\n#  undef ALWAYS_FALSE\r\n#  if (_MSC_VER < 1500)\r\n#    define ALWAYS_TRUE   (0, 1)\r\n#    define ALWAYS_FALSE  (1, 0)\r\n#  else\r\n#    define ALWAYS_TRUE \\\r\n__pragma(warning(push)) \\\r\n__pragma(warning(disable:4127)) \\\r\n(1) \\\r\n__pragma(warning(pop))\r\n#    define ALWAYS_FALSE \\\r\n__pragma(warning(push)) \\\r\n__pragma(warning(disable:4127)) \\\r\n(0) \\\r\n__pragma(warning(pop))\r\n#  endif\r\n#endif\r\n\r\n#ifdef WIN32\r\n#  undef  PATH_MAX\r\n#  define PATH_MAX MAX_PATH\r\n#endif\r\n\r\n#ifndef S_ISCHR\r\n#  ifdef S_IFCHR\r\n#    define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)\r\n#  else\r\n#    define S_ISCHR(m) (0) /* cannot tell if file is a device */\r\n#  endif\r\n#endif\r\n\r\n#ifdef WIN32\r\n#  define _use_lfn(f) ALWAYS_TRUE   /* long file names always available */\r\n#elif !defined(__DJGPP__) || (__DJGPP__ < 2)  /* DJGPP 2.0 has _use_lfn() */\r\n#  define _use_lfn(f) ALWAYS_FALSE  /* long file names never available */\r\n#elif defined(__DJGPP__)\r\n#  include <fcntl.h>                /* _use_lfn(f) prototype */\r\n#endif\r\n\r\nstatic const char *msdosify (const char *file_name);\r\nstatic char *rename_if_dos_device_name (char *file_name);\r\n\r\n/*\r\n * sanitize_dos_name: returns a newly allocated string holding a\r\n * valid file name which will be a transformation of given argument\r\n * in case this wasn't already a valid file name.\r\n *\r\n * This function takes ownership of given argument, free'ing it before\r\n * returning. Caller is responsible of free'ing returned string. Upon\r\n * out of memory condition function returns NULL.\r\n */\r\n\r\nchar *sanitize_dos_name(char *file_name)\r\n{\r\n  char new_name[PATH_MAX];\r\n\r\n  if(!file_name)\r\n    return NULL;\r\n\r\n  if(strlen(file_name) >= PATH_MAX)\r\n    file_name[PATH_MAX-1] = '\\0'; /* truncate it */\r\n\r\n  strcpy(new_name, msdosify(file_name));\r\n\r\n  Curl_safefree(file_name);\r\n\r\n  return strdup(rename_if_dos_device_name(new_name));\r\n}\r\n\r\n/* The following functions are taken with modification from the DJGPP\r\n * port of tar 1.12. They use algorithms originally from DJTAR. */\r\n\r\nstatic const char *msdosify (const char *file_name)\r\n{\r\n  static char dos_name[PATH_MAX];\r\n  static const char illegal_chars_dos[] = \".+, ;=[]\" /* illegal in DOS */\r\n    \"|<>\\\\\\\":?*\"; /* illegal in DOS & W95 */\r\n  static const char *illegal_chars_w95 = &illegal_chars_dos[8];\r\n  int idx, dot_idx;\r\n  const char *s = file_name;\r\n  char *d = dos_name;\r\n  const char *const dlimit = dos_name + sizeof(dos_name) - 1;\r\n  const char *illegal_aliens = illegal_chars_dos;\r\n  size_t len = sizeof(illegal_chars_dos) - 1;\r\n\r\n  /* Support for Windows 9X VFAT systems, when available. */\r\n  if(_use_lfn(file_name)) {\r\n    illegal_aliens = illegal_chars_w95;\r\n    len -= (illegal_chars_w95 - illegal_chars_dos);\r\n  }\r\n\r\n  /* Get past the drive letter, if any. */\r\n  if(s[0] >= 'A' && s[0] <= 'z' && s[1] == ':') {\r\n    *d++ = *s++;\r\n    *d++ = *s++;\r\n  }\r\n\r\n  for(idx = 0, dot_idx = -1; *s && d < dlimit; s++, d++) {\r\n    if(memchr(illegal_aliens, *s, len)) {\r\n      /* Dots are special: DOS doesn't allow them as the leading character,\r\n         and a file name cannot have more than a single dot.  We leave the\r\n         first non-leading dot alone, unless it comes too close to the\r\n         beginning of the name: we want sh.lex.c to become sh_lex.c, not\r\n         sh.lex-c.  */\r\n      if(*s == '.') {\r\n        if(idx == 0 && (s[1] == '/' || (s[1] == '.' && s[2] == '/'))) {\r\n          /* Copy \"./\" and \"../\" verbatim.  */\r\n          *d++ = *s++;\r\n          if(*s == '.')\r\n            *d++ = *s++;\r\n          *d = *s;\r\n        }\r\n        else if(idx == 0)\r\n          *d = '_';\r\n        else if(dot_idx >= 0) {\r\n          if(dot_idx < 5) { /* 5 is a heuristic ad-hoc'ery */\r\n            d[dot_idx - idx] = '_'; /* replace previous dot */\r\n            *d = '.';\r\n          }\r\n          else\r\n            *d = '-';\r\n        }\r\n        else\r\n          *d = '.';\r\n\r\n        if(*s == '.')\r\n          dot_idx = idx;\r\n      }\r\n      else if(*s == '+' && s[1] == '+') {\r\n        if(idx - 2 == dot_idx) { /* .c++, .h++ etc. */\r\n          *d++ = 'x';\r\n          *d   = 'x';\r\n        }\r\n        else {\r\n          /* libg++ etc.  */\r\n          memcpy (d, \"plus\", 4);\r\n          d += 3;\r\n        }\r\n        s++;\r\n        idx++;\r\n      }\r\n      else\r\n        *d = '_';\r\n    }\r\n    else\r\n      *d = *s;\r\n    if(*s == '/') {\r\n      idx = 0;\r\n      dot_idx = -1;\r\n    }\r\n    else\r\n      idx++;\r\n  }\r\n\r\n  *d = '\\0';\r\n  return dos_name;\r\n}\r\n\r\nstatic char *rename_if_dos_device_name (char *file_name)\r\n{\r\n  /* We could have a file whose name is a device on MS-DOS.  Trying to\r\n   * retrieve such a file would fail at best and wedge us at worst.  We need\r\n   * to rename such files. */\r\n  char *base;\r\n  struct_stat st_buf;\r\n  char fname[PATH_MAX];\r\n\r\n  strncpy(fname, file_name, PATH_MAX-1);\r\n  fname[PATH_MAX-1] = '\\0';\r\n  base = basename(fname);\r\n  if(((stat(base, &st_buf)) == 0) && (S_ISCHR(st_buf.st_mode))) {\r\n    size_t blen = strlen(base);\r\n\r\n    if(strlen(fname) >= PATH_MAX-1) {\r\n      /* Make room for the '_' */\r\n      blen--;\r\n      base[blen] = '\\0';\r\n    }\r\n    /* Prepend a '_'.  */\r\n    memmove(base + 1, base, blen + 1);\r\n    base[0] = '_';\r\n    strcpy(file_name, fname);\r\n  }\r\n  return file_name;\r\n}\r\n\r\n#if defined(MSDOS) && (defined(__DJGPP__) || defined(__GO32__))\r\n\r\n/*\r\n * Disable program default argument globbing. We do it on our own.\r\n */\r\nchar **__crt0_glob_function(char *arg)\r\n{\r\n  (void)arg;\r\n  return (char**)0;\r\n}\r\n\r\n#endif /* MSDOS && (__DJGPP__ || __GO32__) */\r\n\r\n#ifdef WIN32\r\n\r\n/*\r\n * Function to find CACert bundle on a Win32 platform using SearchPath.\r\n * (SearchPath is already declared via inclusions done in setup header file)\r\n * (Use the ASCII version instead of the unicode one!)\r\n * The order of the directories it searches is:\r\n *  1. application's directory\r\n *  2. current working directory\r\n *  3. Windows System directory (e.g. C:\\windows\\system32)\r\n *  4. Windows Directory (e.g. C:\\windows)\r\n *  5. all directories along %PATH%\r\n *\r\n * For WinXP and later search order actually depends on registry value:\r\n * HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\SafeProcessSearchMode\r\n */\r\n\r\nCURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file)\r\n{\r\n  CURLcode result = CURLE_OK;\r\n\r\n  /* search and set cert file only if libcurl supports SSL */\r\n  if(curlinfo->features & CURL_VERSION_SSL) {\r\n\r\n    DWORD res_len;\r\n    DWORD buf_tchar_size = PATH_MAX + 1;\r\n    DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size;\r\n    char *ptr = NULL;\r\n\r\n    char *buf = malloc(buf_bytes_size);\r\n    if(!buf)\r\n      return CURLE_OUT_OF_MEMORY;\r\n    buf[0] = '\\0';\r\n\r\n    res_len = SearchPathA(NULL, bundle_file, NULL, buf_tchar_size, buf, &ptr);\r\n    if(res_len > 0) {\r\n      Curl_safefree(config->cacert);\r\n      config->cacert = strdup(buf);\r\n      if(!config->cacert)\r\n        result = CURLE_OUT_OF_MEMORY;\r\n    }\r\n\r\n    Curl_safefree(buf);\r\n  }\r\n\r\n  return result;\r\n}\r\n\r\n#endif /* WIN32 */\r\n\r\n#endif /* MSDOS || WIN32 */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_doswin.h",
    "content": "#ifndef HEADER_CURL_TOOL_DOSWIN_H\r\n#define HEADER_CURL_TOOL_DOSWIN_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#if defined(MSDOS) || defined(WIN32)\r\n\r\nchar *sanitize_dos_name(char *file_name);\r\n\r\n#if defined(MSDOS) && (defined(__DJGPP__) || defined(__GO32__))\r\n\r\nchar **__crt0_glob_function(char *arg);\r\n\r\n#endif /* MSDOS && (__DJGPP__ || __GO32__) */\r\n\r\n#ifdef WIN32\r\n\r\nCURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file);\r\n\r\n#endif /* WIN32 */\r\n\r\n#endif /* MSDOS || WIN32 */\r\n\r\n#endif /* HEADER_CURL_TOOL_DOSWIN_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_easysrc.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_easysrc.h\"\r\n#include \"tool_msgs.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/* global variable definitions, for easy-interface source code generation */\r\n\r\nstruct curl_slist *easysrc_decl = NULL; /* Variable declarations */\r\nstruct curl_slist *easysrc_data = NULL; /* Build slists, forms etc. */\r\nstruct curl_slist *easysrc_code = NULL; /* Setopt calls */\r\nstruct curl_slist *easysrc_toohard = NULL; /* Unconvertible setopt */\r\nstruct curl_slist *easysrc_clean = NULL;  /* Clean up allocated data */\r\nint easysrc_form_count = 0;\r\nint easysrc_slist_count = 0;\r\n\r\nstatic const char *const srchead[]={\r\n  \"/********* Sample code generated by the curl command line tool **********\",\r\n  \" * All curl_easy_setopt() options are documented at:\",\r\n  \" * http://curl.haxx.se/libcurl/c/curl_easy_setopt.html\",\r\n  \" ************************************************************************/\",\r\n  \"#include <curl/curl.h>\",\r\n  \"\",\r\n  \"int main(int argc, char *argv[])\",\r\n  \"{\",\r\n  \"  CURLcode ret;\",\r\n  \"  CURL *hnd;\",\r\n  NULL\r\n};\r\n/* easysrc_decl declarations come here */\r\n/* easysrc_data initialisations come here */\r\n/* easysrc_code statements come here */\r\nstatic const char *const srchard[]={\r\n  \"/* Here is a list of options the curl code used that cannot get generated\",\r\n  \"   as source easily. You may select to either not use them or implement\",\r\n  \"   them yourself.\",\r\n  \"\",\r\n  NULL\r\n};\r\nstatic const char *const srcend[]={\r\n  \"\",\r\n  \"  return (int)ret;\",\r\n  \"}\",\r\n  \"/**** End of sample code ****/\",\r\n  NULL\r\n};\r\n\r\n/* Clean up all source code if we run out of memory */\r\nstatic void easysrc_free(void)\r\n{\r\n  curl_slist_free_all(easysrc_decl);\r\n  easysrc_decl = NULL;\r\n  curl_slist_free_all(easysrc_data);\r\n  easysrc_data = NULL;\r\n  curl_slist_free_all(easysrc_code);\r\n  easysrc_code = NULL;\r\n  curl_slist_free_all(easysrc_toohard);\r\n  easysrc_toohard = NULL;\r\n  curl_slist_free_all(easysrc_clean);\r\n  easysrc_clean = NULL;\r\n}\r\n\r\n/* Add a source line to the main code or remarks */\r\nCURLcode easysrc_add(struct curl_slist **plist, const char *line)\r\n{\r\n  CURLcode ret = CURLE_OK;\r\n  struct curl_slist *list =\r\n    curl_slist_append(*plist, line);\r\n  if(!list) {\r\n    easysrc_free();\r\n    ret = CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else\r\n    *plist = list;\r\n  return ret;\r\n}\r\n\r\nCURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...)\r\n{\r\n  CURLcode ret;\r\n  char *bufp;\r\n  va_list ap;\r\n  va_start(ap, fmt);\r\n  bufp = curlx_mvaprintf(fmt, ap);\r\n  va_end(ap);\r\n  if(! bufp) {\r\n    ret = CURLE_OUT_OF_MEMORY;\r\n  }\r\n  else {\r\n    ret = easysrc_add(plist, bufp);\r\n    curl_free(bufp);\r\n  }\r\n  return ret;\r\n}\r\n\r\n#define CHKRET(v) do {CURLcode ret = (v); if(ret) return ret;} WHILE_FALSE\r\n\r\nCURLcode easysrc_init(void)\r\n{\r\n  CHKRET(easysrc_add(&easysrc_code,\r\n                     \"hnd = curl_easy_init();\"));\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode easysrc_perform(void)\r\n{\r\n  /* Note any setopt calls which we could not convert */\r\n  if(easysrc_toohard) {\r\n    int i;\r\n    struct curl_slist *ptr;\r\n    const char *c;\r\n    CHKRET(easysrc_add(&easysrc_code, \"\"));\r\n    /* Preamble comment */\r\n    for(i=0; ((c = srchard[i]) != NULL); i++)\r\n      CHKRET(easysrc_add(&easysrc_code, c));\r\n    /* Each unconverted option */\r\n    for(ptr=easysrc_toohard; ptr; ptr = ptr->next)\r\n      CHKRET(easysrc_add(&easysrc_code, ptr->data));\r\n    CHKRET(easysrc_add(&easysrc_code, \"\"));\r\n    CHKRET(easysrc_add(&easysrc_code, \"*/\"));\r\n\r\n    curl_slist_free_all(easysrc_toohard);\r\n    easysrc_toohard = NULL;\r\n  }\r\n\r\n  CHKRET(easysrc_add(&easysrc_code, \"\"));\r\n  CHKRET(easysrc_add(&easysrc_code, \"ret = curl_easy_perform(hnd);\"));\r\n  return CURLE_OK;\r\n}\r\n\r\nCURLcode easysrc_cleanup(void)\r\n{\r\n  CHKRET(easysrc_add(&easysrc_code, \"\"));\r\n  CHKRET(easysrc_add(&easysrc_code, \"curl_easy_cleanup(hnd);\"));\r\n  CHKRET(easysrc_add(&easysrc_code, \"hnd = NULL;\"));\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid dumpeasysrc(struct Configurable *config)\r\n{\r\n  struct curl_slist *ptr;\r\n  char *o = config->libcurl;\r\n\r\n  if(o) {\r\n    FILE *out;\r\n    bool fopened = FALSE;\r\n    if(strcmp(o, \"-\")) {\r\n      out = fopen(o, \"w\");\r\n      fopened = TRUE;\r\n    }\r\n    else\r\n      out = stdout;\r\n    if(!out)\r\n      warnf(config, \"Failed to open %s to write libcurl code!\\n\", o);\r\n    else {\r\n      int i;\r\n      const char *c;\r\n\r\n      for(i=0; ((c = srchead[i]) != NULL); i++)\r\n        fprintf(out, \"%s\\n\", c);\r\n\r\n      /* Declare variables used for complex setopt values */\r\n      for(ptr=easysrc_decl; ptr; ptr = ptr->next)\r\n        fprintf(out, \"  %s\\n\", ptr->data);\r\n\r\n      /* Set up complex values for setopt calls */\r\n      if(easysrc_data) {\r\n        fprintf(out, \"\\n\");\r\n\r\n        for(ptr=easysrc_data; ptr; ptr = ptr->next)\r\n          fprintf(out, \"  %s\\n\", ptr->data);\r\n      }\r\n\r\n      fprintf(out, \"\\n\");\r\n      for(ptr=easysrc_code; ptr; ptr = ptr->next) {\r\n        if(ptr->data[0]) {\r\n          fprintf(out, \"  %s\\n\", ptr->data);\r\n        }\r\n        else {\r\n          fprintf(out, \"\\n\");\r\n        }\r\n      }\r\n\r\n      for(ptr=easysrc_clean; ptr; ptr = ptr->next)\r\n        fprintf(out, \"  %s\\n\", ptr->data);\r\n\r\n      for(i=0; ((c = srcend[i]) != NULL); i++)\r\n        fprintf(out, \"%s\\n\", c);\r\n\r\n      if(fopened)\r\n        fclose(out);\r\n    }\r\n  }\r\n\r\n  easysrc_free();\r\n}\r\n\r\n#endif /* CURL_DISABLE_LIBCURL_OPTION */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_easysrc.h",
    "content": "#ifndef HEADER_CURL_TOOL_EASYSRC_H\r\n#define HEADER_CURL_TOOL_EASYSRC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n\r\n/* global variable declarations, for easy-interface source code generation */\r\n\r\nextern struct curl_slist *easysrc_decl; /* Variable declarations */\r\nextern struct curl_slist *easysrc_data; /* Build slists, forms etc. */\r\nextern struct curl_slist *easysrc_code; /* Setopt calls etc. */\r\nextern struct curl_slist *easysrc_toohard; /* Unconvertible setopt */\r\nextern struct curl_slist *easysrc_clean;  /* Clean up (reverse order) */\r\n\r\nextern int easysrc_form_count;  /* Number of curl_httppost variables */\r\nextern int easysrc_slist_count; /* Number of curl_slist variables */\r\n\r\nextern CURLcode easysrc_init(void);\r\nextern CURLcode easysrc_add(struct curl_slist **plist, const char *bupf);\r\nextern CURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...);\r\nextern CURLcode easysrc_perform(void);\r\nextern CURLcode easysrc_cleanup(void);\r\nvoid dumpeasysrc(struct Configurable *config);\r\n\r\n#endif /* CURL_DISABLE_LIBCURL_OPTION */\r\n\r\n#endif /* HEADER_CURL_TOOL_EASYSRC_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_formparse.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_mfiles.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_formparse.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n\r\n/*\r\n * helper function to get a word from form param\r\n * after call get_parm_word, str either point to string end\r\n * or point to any of end chars.\r\n */\r\nstatic char *get_param_word(char **str, char **end_pos)\r\n{\r\n  char *ptr = *str;\r\n  char *word_begin = NULL;\r\n  char *ptr2;\r\n  char *escape = NULL;\r\n  const char *end_chars = \";,\";\r\n\r\n  /* the first non-space char is here */\r\n  word_begin = ptr;\r\n  if(*ptr == '\"') {\r\n    ++ptr;\r\n    while(*ptr) {\r\n      if(*ptr == '\\\\') {\r\n        if(ptr[1] == '\\\\' || ptr[1] == '\"') {\r\n          /* remember the first escape position */\r\n          if(!escape)\r\n            escape = ptr;\r\n          /* skip escape of back-slash or double-quote */\r\n          ptr += 2;\r\n          continue;\r\n        }\r\n      }\r\n      if(*ptr == '\"') {\r\n        *end_pos = ptr;\r\n        if(escape) {\r\n          /* has escape, we restore the unescaped string here */\r\n          ptr = ptr2 = escape;\r\n          do {\r\n            if(*ptr == '\\\\' && (ptr[1] == '\\\\' || ptr[1] == '\"'))\r\n              ++ptr;\r\n            *ptr2++ = *ptr++;\r\n          }\r\n          while(ptr < *end_pos);\r\n          *end_pos = ptr2;\r\n        }\r\n        while(*ptr && NULL==strchr(end_chars, *ptr))\r\n          ++ptr;\r\n        *str = ptr;\r\n        return word_begin+1;\r\n      }\r\n      ++ptr;\r\n    }\r\n    /* end quote is missing, treat it as non-quoted. */\r\n    ptr = word_begin;\r\n  }\r\n\r\n  while(*ptr && NULL==strchr(end_chars, *ptr))\r\n    ++ptr;\r\n  *str = *end_pos = ptr;\r\n  return word_begin;\r\n}\r\n\r\n/***************************************************************************\r\n *\r\n * formparse()\r\n *\r\n * Reads a 'name=value' parameter and builds the appropriate linked list.\r\n *\r\n * Specify files to upload with 'name=@filename', or 'name=@\"filename\"'\r\n * in case the filename contain ',' or ';'. Supports specified\r\n * given Content-Type of the files. Such as ';type=<content-type>'.\r\n *\r\n * If literal_value is set, any initial '@' or '<' in the value string\r\n * loses its special meaning, as does any embedded ';type='.\r\n *\r\n * You may specify more than one file for a single name (field). Specify\r\n * multiple files by writing it like:\r\n *\r\n * 'name=@filename,filename2,filename3'\r\n *\r\n * or use double-quotes quote the filename:\r\n *\r\n * 'name=@\"filename\",\"filename2\",\"filename3\"'\r\n *\r\n * If you want content-types specified for each too, write them like:\r\n *\r\n * 'name=@filename;type=image/gif,filename2,filename3'\r\n *\r\n * If you want custom headers added for a single part, write them in a separate\r\n * file and do like this:\r\n *\r\n * 'name=foo;headers=@headerfile' or why not\r\n * 'name=@filemame;headers=@headerfile'\r\n *\r\n * To upload a file, but to fake the file name that will be included in the\r\n * formpost, do like this:\r\n *\r\n * 'name=@filename;filename=/dev/null' or quote the faked filename like:\r\n * 'name=@filename;filename=\"play, play, and play.txt\"'\r\n *\r\n * If filename/path contains ',' or ';', it must be quoted by double-quotes,\r\n * else curl will fail to figure out the correct filename. if the filename\r\n * tobe quoted contains '\"' or '\\', '\"' and '\\' must be escaped by backslash.\r\n *\r\n * This function uses curl_formadd to fulfill it's job. Is heavily based on\r\n * the old curl_formparse code.\r\n *\r\n ***************************************************************************/\r\n\r\nint formparse(struct Configurable *config,\r\n              const char *input,\r\n              struct curl_httppost **httppost,\r\n              struct curl_httppost **last_post,\r\n              bool literal_value)\r\n{\r\n  /* nextarg MUST be a string in the format 'name=contents' and we'll\r\n     build a linked list with the info */\r\n  char name[256];\r\n  char *contents = NULL;\r\n  char type_major[128];\r\n  char type_minor[128];\r\n  char *contp;\r\n  const char *type = NULL;\r\n  char *sep;\r\n\r\n  if((1 == sscanf(input, \"%255[^=]=\", name)) &&\r\n     ((contp = strchr(input, '=')) != NULL)) {\r\n    /* the input was using the correct format */\r\n\r\n    /* Allocate the contents */\r\n    contents = strdup(contp+1);\r\n    if(!contents) {\r\n      fprintf(config->errors, \"out of memory\\n\");\r\n      return 1;\r\n    }\r\n    contp = contents;\r\n\r\n    if('@' == contp[0] && !literal_value) {\r\n\r\n      /* we use the @-letter to indicate file name(s) */\r\n\r\n      struct multi_files *multi_start = NULL;\r\n      struct multi_files *multi_current = NULL;\r\n\r\n      char *ptr = contp;\r\n      char *end = ptr + strlen(ptr);\r\n\r\n      do {\r\n        /* since this was a file, it may have a content-type specifier\r\n           at the end too, or a filename. Or both. */\r\n        char *filename = NULL;\r\n        char *word_end;\r\n        bool semicolon;\r\n\r\n        type = NULL;\r\n\r\n        ++ptr;\r\n        contp = get_param_word(&ptr, &word_end);\r\n        semicolon = (';' == *ptr) ? TRUE : FALSE;\r\n        *word_end = '\\0'; /* terminate the contp */\r\n\r\n        /* have other content, continue parse */\r\n        while(semicolon) {\r\n          /* have type or filename field */\r\n          ++ptr;\r\n          while(*ptr && (ISSPACE(*ptr)))\r\n            ++ptr;\r\n\r\n          if(checkprefix(\"type=\", ptr)) {\r\n            /* set type pointer */\r\n            type = &ptr[5];\r\n\r\n            /* verify that this is a fine type specifier */\r\n            if(2 != sscanf(type, \"%127[^/]/%127[^;,\\n]\",\r\n                           type_major, type_minor)) {\r\n              warnf(config, \"Illegally formatted content-type field!\\n\");\r\n              Curl_safefree(contents);\r\n              FreeMultiInfo(&multi_start, &multi_current);\r\n              return 2; /* illegal content-type syntax! */\r\n            }\r\n\r\n            /* now point beyond the content-type specifier */\r\n            sep = (char *)type + strlen(type_major)+strlen(type_minor)+1;\r\n\r\n            /* there's a semicolon following - we check if it is a filename\r\n               specified and if not we simply assume that it is text that\r\n               the user wants included in the type and include that too up\r\n               to the next sep. */\r\n            ptr = sep;\r\n            if(*sep==';') {\r\n              if(!checkprefix(\";filename=\", sep)) {\r\n                ptr = sep + 1;\r\n                (void)get_param_word(&ptr, &sep);\r\n                semicolon = (';' == *ptr) ? TRUE : FALSE;\r\n              }\r\n            }\r\n            else\r\n              semicolon = FALSE;\r\n\r\n            if(*sep)\r\n              *sep = '\\0'; /* zero terminate type string */\r\n          }\r\n          else if(checkprefix(\"filename=\", ptr)) {\r\n            ptr += 9;\r\n            filename = get_param_word(&ptr, &word_end);\r\n            semicolon = (';' == *ptr) ? TRUE : FALSE;\r\n            *word_end = '\\0';\r\n          }\r\n          else {\r\n            /* unknown prefix, skip to next block */\r\n            char *unknown = NULL;\r\n            unknown = get_param_word(&ptr, &word_end);\r\n            semicolon = (';' == *ptr) ? TRUE : FALSE;\r\n            if(*unknown) {\r\n              *word_end = '\\0';\r\n              warnf(config, \"skip unknown form field: %s\\n\", unknown);\r\n            }\r\n          }\r\n        }\r\n        /* now ptr point to comma or string end */\r\n\r\n\r\n        /* if type == NULL curl_formadd takes care of the problem */\r\n\r\n        if(*contp && !AddMultiFiles(contp, type, filename, &multi_start,\r\n                          &multi_current)) {\r\n          warnf(config, \"Error building form post!\\n\");\r\n          Curl_safefree(contents);\r\n          FreeMultiInfo(&multi_start, &multi_current);\r\n          return 3;\r\n        }\r\n\r\n        /* *ptr could be '\\0', so we just check with the string end */\r\n      } while(ptr < end); /* loop if there's another file name */\r\n\r\n      /* now we add the multiple files section */\r\n      if(multi_start) {\r\n        struct curl_forms *forms = NULL;\r\n        struct multi_files *start = multi_start;\r\n        unsigned int i, count = 0;\r\n        while(start) {\r\n          start = start->next;\r\n          ++count;\r\n        }\r\n        forms = malloc((count+1)*sizeof(struct curl_forms));\r\n        if(!forms) {\r\n          fprintf(config->errors, \"Error building form post!\\n\");\r\n          Curl_safefree(contents);\r\n          FreeMultiInfo(&multi_start, &multi_current);\r\n          return 4;\r\n        }\r\n        for(i = 0, start = multi_start; i < count; ++i, start = start->next) {\r\n          forms[i].option = start->form.option;\r\n          forms[i].value = start->form.value;\r\n        }\r\n        forms[count].option = CURLFORM_END;\r\n        FreeMultiInfo(&multi_start, &multi_current);\r\n        if(curl_formadd(httppost, last_post,\r\n                        CURLFORM_COPYNAME, name,\r\n                        CURLFORM_ARRAY, forms, CURLFORM_END) != 0) {\r\n          warnf(config, \"curl_formadd failed!\\n\");\r\n          Curl_safefree(forms);\r\n          Curl_safefree(contents);\r\n          return 5;\r\n        }\r\n        Curl_safefree(forms);\r\n      }\r\n    }\r\n    else {\r\n      struct curl_forms info[4];\r\n      int i = 0;\r\n      char *ct = literal_value ? NULL : strstr(contp, \";type=\");\r\n\r\n      info[i].option = CURLFORM_COPYNAME;\r\n      info[i].value = name;\r\n      i++;\r\n\r\n      if(ct) {\r\n        info[i].option = CURLFORM_CONTENTTYPE;\r\n        info[i].value = &ct[6];\r\n        i++;\r\n        ct[0] = '\\0'; /* zero terminate here */\r\n      }\r\n\r\n      if(contp[0]=='<' && !literal_value) {\r\n        info[i].option = CURLFORM_FILECONTENT;\r\n        info[i].value = contp+1;\r\n        i++;\r\n        info[i].option = CURLFORM_END;\r\n\r\n        if(curl_formadd(httppost, last_post,\r\n                        CURLFORM_ARRAY, info, CURLFORM_END ) != 0) {\r\n          warnf(config, \"curl_formadd failed, possibly the file %s is bad!\\n\",\r\n                contp+1);\r\n          Curl_safefree(contents);\r\n          return 6;\r\n        }\r\n      }\r\n      else {\r\n#ifdef CURL_DOES_CONVERSIONS\r\n        if(convert_to_network(contp, strlen(contp))) {\r\n          warnf(config, \"curl_formadd failed!\\n\");\r\n          Curl_safefree(contents);\r\n          return 7;\r\n        }\r\n#endif\r\n        info[i].option = CURLFORM_COPYCONTENTS;\r\n        info[i].value = contp;\r\n        i++;\r\n        info[i].option = CURLFORM_END;\r\n        if(curl_formadd(httppost, last_post,\r\n                        CURLFORM_ARRAY, info, CURLFORM_END) != 0) {\r\n          warnf(config, \"curl_formadd failed!\\n\");\r\n          Curl_safefree(contents);\r\n          return 8;\r\n        }\r\n      }\r\n    }\r\n\r\n  }\r\n  else {\r\n    warnf(config, \"Illegally formatted input field!\\n\");\r\n    return 1;\r\n  }\r\n  Curl_safefree(contents);\r\n  return 0;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_formparse.h",
    "content": "#ifndef HEADER_CURL_TOOL_FORMPARSE_H\r\n#define HEADER_CURL_TOOL_FORMPARSE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nint formparse(struct Configurable *config,\r\n              const char *input,\r\n              struct curl_httppost **httppost,\r\n              struct curl_httppost **last_post,\r\n              bool literal_value);\r\n\r\n#endif /* HEADER_CURL_TOOL_FORMPARSE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_getparam.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#ifdef USE_MANUAL\r\n#  include \"tool_hugehelp.h\"\r\n#endif\r\n\r\n#include \"tool_binmode.h\"\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_cb_prg.h\"\r\n#include \"tool_formparse.h\"\r\n#include \"tool_getparam.h\"\r\n#include \"tool_help.h\"\r\n#include \"tool_helpers.h\"\r\n#include \"tool_libinfo.h\"\r\n#include \"tool_metalink.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_paramhlp.h\"\r\n#include \"tool_parsecfg.h\"\r\n#include \"tool_version.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef MSDOS\r\n#  define USE_WATT32\r\n#endif\r\n\r\n#define GetStr(str,val) do { \\\r\n  if(*(str)) { \\\r\n    free(*(str)); \\\r\n    *(str) = NULL; \\\r\n  } \\\r\n  if((val)) {              \\\r\n    *(str) = strdup((val)); \\\r\n    if(!(*(str)))          \\\r\n      return PARAM_NO_MEM; \\\r\n  } \\\r\n} WHILE_FALSE\r\n\r\nstruct LongShort {\r\n  const char *letter; /* short name option */\r\n  const char *lname;  /* long name option */\r\n  bool extraparam;    /* whether it takes an additional argument */\r\n};\r\n\r\nstatic const struct LongShort aliases[]= {\r\n  /* all these ones, starting with \"*\" or \"$\" as a short-option have *no*\r\n     short option to mention. */\r\n  {\"*\",  \"url\",                      TRUE},\r\n  {\"*a\", \"random-file\",              TRUE},\r\n  {\"*b\", \"egd-file\",                 TRUE},\r\n  {\"*c\", \"connect-timeout\",          TRUE},\r\n  {\"*d\", \"ciphers\",                  TRUE},\r\n  {\"*e\", \"disable-epsv\",             FALSE},\r\n  {\"*E\", \"epsv\",                     FALSE},\r\n         /* 'epsv' made like this to make --no-epsv and --epsv to work\r\n             although --disable-epsv is the documented option */\r\n#ifdef USE_ENVIRONMENT\r\n  {\"*f\", \"environment\",              FALSE},\r\n#endif\r\n  {\"*g\", \"trace\",                    TRUE},\r\n  {\"*h\", \"trace-ascii\",              TRUE},\r\n  {\"*i\", \"limit-rate\",               TRUE},\r\n  {\"*j\", \"compressed\",               FALSE},\r\n  {\"*J\", \"tr-encoding\",              FALSE},\r\n  {\"*k\", \"digest\",                   FALSE},\r\n  {\"*l\", \"negotiate\",                FALSE},\r\n  {\"*m\", \"ntlm\",                     FALSE},\r\n  {\"*M\", \"ntlm-wb\",                  FALSE},\r\n  {\"*n\", \"basic\",                    FALSE},\r\n  {\"*o\", \"anyauth\",                  FALSE},\r\n#ifdef USE_WATT32\r\n  {\"*p\", \"wdebug\",                   FALSE},\r\n#endif\r\n  {\"*q\", \"ftp-create-dirs\",          FALSE},\r\n  {\"*r\", \"create-dirs\",              FALSE},\r\n  {\"*s\", \"max-redirs\",               TRUE},\r\n  {\"*t\", \"proxy-ntlm\",               FALSE},\r\n  {\"*u\", \"crlf\",                     FALSE},\r\n  {\"*v\", \"stderr\",                   TRUE},\r\n  {\"*w\", \"interface\",                TRUE},\r\n  {\"*x\", \"krb\" ,                     TRUE},\r\n  {\"*x\", \"krb4\" ,                    TRUE},\r\n         /* 'krb4' is the previous name */\r\n  {\"*y\", \"max-filesize\",             TRUE},\r\n  {\"*z\", \"disable-eprt\",             FALSE},\r\n  {\"*Z\", \"eprt\",                     FALSE},\r\n         /* 'eprt' made like this to make --no-eprt and --eprt to work\r\n             although --disable-eprt is the documented option */\r\n  {\"$a\", \"ftp-ssl\",                  FALSE},\r\n         /* 'ftp-ssl' deprecated name since 7.20.0 */\r\n  {\"$a\", \"ssl\",                      FALSE},\r\n         /* 'ssl' new option name in 7.20.0, previously this was ftp-ssl */\r\n  {\"$b\", \"ftp-pasv\",                 FALSE},\r\n  {\"$c\", \"socks5\",                   TRUE},\r\n  {\"$c\", \"socks\",                    TRUE},\r\n         /* 'socks' is how the option once was documented but we prefer\r\n            the --socks5 version for explicit version */\r\n  {\"$d\", \"tcp-nodelay\",              FALSE},\r\n  {\"$e\", \"proxy-digest\",             FALSE},\r\n  {\"$f\", \"proxy-basic\",              FALSE},\r\n  {\"$g\", \"retry\",                    TRUE},\r\n  {\"$h\", \"retry-delay\",              TRUE},\r\n  {\"$i\", \"retry-max-time\",           TRUE},\r\n  {\"$k\", \"proxy-negotiate\",          FALSE},\r\n  {\"$m\", \"ftp-account\",              TRUE},\r\n  {\"$n\", \"proxy-anyauth\",            FALSE},\r\n  {\"$o\", \"trace-time\",               FALSE},\r\n  {\"$p\", \"ignore-content-length\",    FALSE},\r\n  {\"$q\", \"ftp-skip-pasv-ip\",         FALSE},\r\n  {\"$r\", \"ftp-method\",               TRUE},\r\n  {\"$s\", \"local-port\",               TRUE},\r\n  {\"$t\", \"socks4\",                   TRUE},\r\n  {\"$T\", \"socks4a\",                  TRUE},\r\n  {\"$u\", \"ftp-alternative-to-user\",  TRUE},\r\n  {\"$v\", \"ftp-ssl-reqd\",             FALSE},\r\n         /* 'ftp-ssl-reqd' deprecated name since 7.20.0 */\r\n  {\"$v\", \"ssl-reqd\",                 FALSE},\r\n         /* 'ssl-reqd' new in 7.20.0, previously this was ftp-ssl-reqd */\r\n  {\"$w\", \"sessionid\",                FALSE},\r\n         /* sessionid' listed as --no-sessionid in the help */\r\n  {\"$x\", \"ftp-ssl-control\",          FALSE},\r\n  {\"$y\", \"ftp-ssl-ccc\",              FALSE},\r\n  {\"$j\", \"ftp-ssl-ccc-mode\",         TRUE},\r\n  {\"$z\", \"libcurl\",                  TRUE},\r\n  {\"$#\", \"raw\",                      FALSE},\r\n  {\"$0\", \"post301\",                  FALSE},\r\n  {\"$1\", \"keepalive\",                FALSE},\r\n         /* 'keepalive' listed as --no-keepalive in the help */\r\n  {\"$2\", \"socks5-hostname\",          TRUE},\r\n  {\"$3\", \"keepalive-time\",           TRUE},\r\n  {\"$4\", \"post302\",                  FALSE},\r\n  {\"$5\", \"noproxy\",                  TRUE},\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  {\"$6\", \"socks5-gssapi-service\",    TRUE},\r\n  {\"$7\", \"socks5-gssapi-nec\",        FALSE},\r\n#endif\r\n  {\"$8\", \"proxy1.0\",                 TRUE},\r\n  {\"$9\", \"tftp-blksize\",             TRUE},\r\n  {\"$A\", \"mail-from\",                TRUE},\r\n  {\"$B\", \"mail-rcpt\",                TRUE},\r\n  {\"$C\", \"ftp-pret\",                 FALSE},\r\n  {\"$D\", \"proto\",                    TRUE},\r\n  {\"$E\", \"proto-redir\",              TRUE},\r\n  {\"$F\", \"resolve\",                  TRUE},\r\n  {\"$G\", \"delegation\",               TRUE},\r\n  {\"$H\", \"mail-auth\",                TRUE},\r\n  {\"$I\", \"post303\",                  FALSE},\r\n  {\"$J\", \"metalink\",                 FALSE},\r\n  {\"0\",  \"http1.0\",                  FALSE},\r\n  {\"1\",  \"tlsv1\",                    FALSE},\r\n  {\"2\",  \"sslv2\",                    FALSE},\r\n  {\"3\",  \"sslv3\",                    FALSE},\r\n  {\"4\",  \"ipv4\",                     FALSE},\r\n  {\"6\",  \"ipv6\",                     FALSE},\r\n  {\"a\",  \"append\",                   FALSE},\r\n  {\"A\",  \"user-agent\",               TRUE},\r\n  {\"b\",  \"cookie\",                   TRUE},\r\n  {\"B\",  \"use-ascii\",                FALSE},\r\n  {\"c\",  \"cookie-jar\",               TRUE},\r\n  {\"C\",  \"continue-at\",              TRUE},\r\n  {\"d\",  \"data\",                     TRUE},\r\n  {\"da\", \"data-ascii\",               TRUE},\r\n  {\"db\", \"data-binary\",              TRUE},\r\n  {\"de\", \"data-urlencode\",           TRUE},\r\n  {\"D\",  \"dump-header\",              TRUE},\r\n  {\"e\",  \"referer\",                  TRUE},\r\n  {\"E\",  \"cert\",                     TRUE},\r\n  {\"Ea\", \"cacert\",                   TRUE},\r\n  {\"Eb\", \"cert-type\",                TRUE},\r\n  {\"Ec\", \"key\",                      TRUE},\r\n  {\"Ed\", \"key-type\",                 TRUE},\r\n  {\"Ee\", \"pass\",                     TRUE},\r\n  {\"Ef\", \"engine\",                   TRUE},\r\n  {\"Eg\", \"capath \",                  TRUE},\r\n  {\"Eh\", \"pubkey\",                   TRUE},\r\n  {\"Ei\", \"hostpubmd5\",               TRUE},\r\n  {\"Ej\", \"crlfile\",                  TRUE},\r\n  {\"Ek\", \"tlsuser\",                  TRUE},\r\n  {\"El\", \"tlspassword\",              TRUE},\r\n  {\"Em\", \"tlsauthtype\",              TRUE},\r\n  {\"En\", \"ssl-allow-beast\",          FALSE},\r\n  {\"f\",  \"fail\",                     FALSE},\r\n  {\"F\",  \"form\",                     TRUE},\r\n  {\"Fs\", \"form-string\",              TRUE},\r\n  {\"g\",  \"globoff\",                  FALSE},\r\n  {\"G\",  \"get\",                      FALSE},\r\n  {\"h\",  \"help\",                     FALSE},\r\n  {\"H\",  \"header\",                   TRUE},\r\n  {\"i\",  \"include\",                  FALSE},\r\n  {\"I\",  \"head\",                     FALSE},\r\n  {\"j\",  \"junk-session-cookies\",     FALSE},\r\n  {\"J\",  \"remote-header-name\",       FALSE},\r\n  {\"k\",  \"insecure\",                 FALSE},\r\n  {\"K\",  \"config\",                   TRUE},\r\n  {\"l\",  \"list-only\",                FALSE},\r\n  {\"L\",  \"location\",                 FALSE},\r\n  {\"Lt\", \"location-trusted\",         FALSE},\r\n  {\"m\",  \"max-time\",                 TRUE},\r\n  {\"M\",  \"manual\",                   FALSE},\r\n  {\"n\",  \"netrc\",                    FALSE},\r\n  {\"no\", \"netrc-optional\",           FALSE},\r\n  {\"ne\", \"netrc-file\",               TRUE},\r\n  {\"N\",  \"buffer\",                   FALSE},\r\n         /* 'buffer' listed as --no-buffer in the help */\r\n  {\"o\",  \"output\",                   TRUE},\r\n  {\"O\",  \"remote-name\",              FALSE},\r\n  {\"Oa\", \"remote-name-all\",          FALSE},\r\n  {\"p\",  \"proxytunnel\",              FALSE},\r\n  {\"P\",  \"ftpport\",                  TRUE},\r\n         /* 'ftpport' old version */\r\n  {\"P\",  \"ftp-port\",                 TRUE},\r\n  {\"q\",  \"disable\",                  FALSE},\r\n  {\"Q\",  \"quote\",                    TRUE},\r\n  {\"r\",  \"range\",                    TRUE},\r\n  {\"R\",  \"remote-time\",              FALSE},\r\n  {\"s\",  \"silent\",                   FALSE},\r\n  {\"S\",  \"show-error\",               FALSE},\r\n  {\"t\",  \"telnet-options\",           TRUE},\r\n         /* 'telnet-options' documented as telnet-option */\r\n  {\"T\",  \"upload-file\",              TRUE},\r\n  {\"u\",  \"user\",                     TRUE},\r\n  {\"U\",  \"proxy-user\",               TRUE},\r\n  {\"v\",  \"verbose\",                  FALSE},\r\n  {\"V\",  \"version\",                  FALSE},\r\n  {\"w\",  \"write-out\",                TRUE},\r\n  {\"x\",  \"proxy\",                    TRUE},\r\n  {\"X\",  \"request\",                  TRUE},\r\n  {\"X\",  \"http-request\",             TRUE},\r\n         /* 'http-request' OBSOLETE VERSION */\r\n  {\"Y\",  \"speed-limit\",              TRUE},\r\n  {\"y\",  \"speed-time\",               TRUE},\r\n  {\"z\",  \"time-cond\",                TRUE},\r\n  {\"#\",  \"progress-bar\",             FALSE},\r\n  {\"~\",  \"xattr\",                    FALSE},\r\n};\r\n\r\nstruct feat {\r\n  const char *name;\r\n  int bitmask;\r\n};\r\n\r\nstatic const struct feat feats[] = {\r\n  {\"AsynchDNS\",      CURL_VERSION_ASYNCHDNS},\r\n  {\"Debug\",          CURL_VERSION_DEBUG},\r\n  {\"TrackMemory\",    CURL_VERSION_CURLDEBUG},\r\n  {\"GSS-Negotiate\",  CURL_VERSION_GSSNEGOTIATE},\r\n  {\"IDN\",            CURL_VERSION_IDN},\r\n  {\"IPv6\",           CURL_VERSION_IPV6},\r\n  {\"Largefile\",      CURL_VERSION_LARGEFILE},\r\n  {\"NTLM\",           CURL_VERSION_NTLM},\r\n  {\"NTLM_WB\",        CURL_VERSION_NTLM_WB},\r\n  {\"SPNEGO\",         CURL_VERSION_SPNEGO},\r\n  {\"SSL\",            CURL_VERSION_SSL},\r\n  {\"SSPI\",           CURL_VERSION_SSPI},\r\n  {\"krb4\",           CURL_VERSION_KERBEROS4},\r\n  {\"libz\",           CURL_VERSION_LIBZ},\r\n  {\"CharConv\",       CURL_VERSION_CONV},\r\n  {\"TLS-SRP\",        CURL_VERSION_TLSAUTH_SRP}\r\n};\r\n\r\nParameterError getparameter(char *flag,    /* f or -long-flag */\r\n                            char *nextarg, /* NULL if unset */\r\n                            bool *usedarg, /* set to TRUE if the arg\r\n                                              has been used */\r\n                            struct Configurable *config)\r\n{\r\n  char letter;\r\n  char subletter = '\\0'; /* subletters can only occur on long options */\r\n  int rc;\r\n  const char *parse = NULL;\r\n  unsigned int j;\r\n  time_t now;\r\n  int hit = -1;\r\n  bool longopt = FALSE;\r\n  bool singleopt = FALSE; /* when true means '-o foo' used '-ofoo' */\r\n  ParameterError err;\r\n  bool toggle = TRUE; /* how to switch boolean options, on or off. Controlled\r\n                         by using --OPTION or --no-OPTION */\r\n\r\n\r\n  if(('-' != flag[0]) ||\r\n     (('-' == flag[0]) && ('-' == flag[1]))) {\r\n    /* this should be a long name */\r\n    char *word = ('-' == flag[0]) ? flag+2 : flag;\r\n    size_t fnam = strlen(word);\r\n    int numhits = 0;\r\n\r\n    if(!strncmp(word, \"no-\", 3)) {\r\n      /* disable this option but ignore the \"no-\" part when looking for it */\r\n      word += 3;\r\n      toggle = FALSE;\r\n    }\r\n\r\n    for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) {\r\n      if(curlx_strnequal(aliases[j].lname, word, fnam)) {\r\n        longopt = TRUE;\r\n        numhits++;\r\n        if(curlx_raw_equal(aliases[j].lname, word)) {\r\n          parse = aliases[j].letter;\r\n          hit = j;\r\n          numhits = 1; /* a single unique hit */\r\n          break;\r\n        }\r\n        parse = aliases[j].letter;\r\n        hit = j;\r\n      }\r\n    }\r\n    if(numhits > 1) {\r\n      /* this is at least the second match! */\r\n      return PARAM_OPTION_AMBIGUOUS;\r\n    }\r\n    if(hit < 0) {\r\n      return PARAM_OPTION_UNKNOWN;\r\n    }\r\n  }\r\n  else {\r\n    flag++; /* prefixed with one dash, pass it */\r\n    hit = -1;\r\n    parse = flag;\r\n  }\r\n\r\n  do {\r\n    /* we can loop here if we have multiple single-letters */\r\n\r\n    if(!longopt) {\r\n      if(NULL != parse) {\r\n        letter = (char)*parse;\r\n      }\r\n      else {\r\n        letter = '\\0';\r\n      }\r\n      subletter='\\0';\r\n    }\r\n    else {\r\n      letter = parse[0];\r\n      subletter = parse[1];\r\n    }\r\n    *usedarg = FALSE; /* default is that we don't use the arg */\r\n\r\n    if(hit < 0) {\r\n      for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) {\r\n        if(letter == aliases[j].letter[0]) {\r\n          hit = j;\r\n          break;\r\n        }\r\n      }\r\n      if(hit < 0) {\r\n        return PARAM_OPTION_UNKNOWN;\r\n      }\r\n    }\r\n\r\n    if(aliases[hit].extraparam) {\r\n      /* this option requires an extra parameter */\r\n      if(!longopt && parse[1]) {\r\n        nextarg = (char *)&parse[1]; /* this is the actual extra parameter */\r\n        singleopt = TRUE;   /* don't loop anymore after this */\r\n      }\r\n      else if(!nextarg)\r\n        return PARAM_REQUIRES_PARAMETER;\r\n      else\r\n        *usedarg = TRUE; /* mark it as used */\r\n    }\r\n\r\n    switch(letter) {\r\n    case '*': /* options without a short option */\r\n      switch(subletter) {\r\n      case 'a': /* random-file */\r\n        GetStr(&config->random_file, nextarg);\r\n        break;\r\n      case 'b': /* egd-file */\r\n        GetStr(&config->egd_file, nextarg);\r\n        break;\r\n      case 'c': /* connect-timeout */\r\n        err = str2unum(&config->connecttimeout, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'd': /* ciphers */\r\n        GetStr(&config->cipher_list, nextarg);\r\n        break;\r\n      case 'e': /* --disable-epsv */\r\n        config->disable_epsv = toggle;\r\n        break;\r\n      case 'E': /* --epsv */\r\n        config->disable_epsv = (!toggle)?TRUE:FALSE;\r\n        break;\r\n#ifdef USE_ENVIRONMENT\r\n      case 'f':\r\n        config->writeenv = toggle;\r\n        break;\r\n#endif\r\n      case 'g': /* --trace */\r\n        GetStr(&config->trace_dump, nextarg);\r\n        if(config->tracetype && (config->tracetype != TRACE_BIN))\r\n          warnf(config, \"--trace overrides an earlier trace/verbose option\\n\");\r\n        config->tracetype = TRACE_BIN;\r\n        break;\r\n      case 'h': /* --trace-ascii */\r\n        GetStr(&config->trace_dump, nextarg);\r\n        if(config->tracetype && (config->tracetype != TRACE_ASCII))\r\n          warnf(config,\r\n                \"--trace-ascii overrides an earlier trace/verbose option\\n\");\r\n        config->tracetype = TRACE_ASCII;\r\n        break;\r\n      case 'i': /* --limit-rate */\r\n      {\r\n        /* We support G, M, K too */\r\n        char *unit;\r\n        curl_off_t value = curlx_strtoofft(nextarg, &unit, 0);\r\n\r\n        if(!*unit)\r\n          unit = (char *)\"b\";\r\n        else if(strlen(unit) > 1)\r\n          unit = (char *)\"w\"; /* unsupported */\r\n\r\n        switch(*unit) {\r\n        case 'G':\r\n        case 'g':\r\n          value *= 1024*1024*1024;\r\n          break;\r\n        case 'M':\r\n        case 'm':\r\n          value *= 1024*1024;\r\n          break;\r\n        case 'K':\r\n        case 'k':\r\n          value *= 1024;\r\n          break;\r\n        case 'b':\r\n        case 'B':\r\n          /* for plain bytes, leave as-is */\r\n          break;\r\n        default:\r\n          warnf(config, \"unsupported rate unit. Use G, M, K or B!\\n\");\r\n          return PARAM_BAD_USE;\r\n        }\r\n        config->recvpersecond = value;\r\n        config->sendpersecond = value;\r\n      }\r\n      break;\r\n\r\n      case 'j': /* --compressed */\r\n        if(toggle && !(curlinfo->features & CURL_VERSION_LIBZ))\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        config->encoding = toggle;\r\n        break;\r\n\r\n      case 'J': /* --tr-encoding */\r\n        config->tr_encoding = toggle;\r\n        break;\r\n\r\n      case 'k': /* --digest */\r\n        if(toggle)\r\n          config->authtype |= CURLAUTH_DIGEST;\r\n        else\r\n          config->authtype &= ~CURLAUTH_DIGEST;\r\n        break;\r\n\r\n      case 'l': /* --negotiate */\r\n        if(toggle) {\r\n          if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE)\r\n            config->authtype |= CURLAUTH_GSSNEGOTIATE;\r\n          else\r\n            return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        }\r\n        else\r\n          config->authtype &= ~CURLAUTH_GSSNEGOTIATE;\r\n        break;\r\n\r\n      case 'm': /* --ntlm */\r\n        if(toggle) {\r\n          if(curlinfo->features & CURL_VERSION_NTLM)\r\n            config->authtype |= CURLAUTH_NTLM;\r\n          else\r\n            return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        }\r\n        else\r\n          config->authtype &= ~CURLAUTH_NTLM;\r\n        break;\r\n\r\n      case 'M': /* --ntlm-wb */\r\n        if(toggle) {\r\n          if(curlinfo->features & CURL_VERSION_NTLM_WB)\r\n            config->authtype |= CURLAUTH_NTLM_WB;\r\n          else\r\n            return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        }\r\n        else\r\n          config->authtype &= ~CURLAUTH_NTLM_WB;\r\n        break;\r\n\r\n      case 'n': /* --basic for completeness */\r\n        if(toggle)\r\n          config->authtype |= CURLAUTH_BASIC;\r\n        else\r\n          config->authtype &= ~CURLAUTH_BASIC;\r\n        break;\r\n\r\n      case 'o': /* --anyauth, let libcurl pick it */\r\n        if(toggle)\r\n          config->authtype = CURLAUTH_ANY;\r\n        /* --no-anyauth simply doesn't touch it */\r\n        break;\r\n\r\n#ifdef USE_WATT32\r\n      case 'p': /* --wdebug */\r\n        dbug_init();\r\n        break;\r\n#endif\r\n      case 'q': /* --ftp-create-dirs */\r\n        config->ftp_create_dirs = toggle;\r\n        break;\r\n\r\n      case 'r': /* --create-dirs */\r\n        config->create_dirs = TRUE;\r\n        break;\r\n\r\n      case 's': /* --max-redirs */\r\n        /* specified max no of redirects (http(s)), this accepts -1 as a\r\n           special condition */\r\n        err = str2num(&config->maxredirs, nextarg);\r\n        if(err)\r\n          return err;\r\n        if(config->maxredirs < -1)\r\n          return PARAM_BAD_NUMERIC;\r\n        break;\r\n\r\n      case 't': /* --proxy-ntlm */\r\n        if(curlinfo->features & CURL_VERSION_NTLM)\r\n          config->proxyntlm = toggle;\r\n        else\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        break;\r\n\r\n      case 'u': /* --crlf */\r\n        /* LF -> CRLF conversion? */\r\n        config->crlf = TRUE;\r\n        break;\r\n\r\n      case 'v': /* --stderr */\r\n        if(strcmp(nextarg, \"-\")) {\r\n          FILE *newfile = fopen(nextarg, \"wt\");\r\n          if(!newfile)\r\n            warnf(config, \"Failed to open %s!\\n\", nextarg);\r\n          else {\r\n            if(config->errors_fopened)\r\n              fclose(config->errors);\r\n            config->errors = newfile;\r\n            config->errors_fopened = TRUE;\r\n          }\r\n        }\r\n        else\r\n          config->errors = stdout;\r\n        break;\r\n      case 'w': /* --interface */\r\n        /* interface */\r\n        GetStr(&config->iface, nextarg);\r\n        break;\r\n      case 'x': /* --krb */\r\n        /* kerberos level string */\r\n        if(curlinfo->features & (CURL_VERSION_KERBEROS4 |\r\n                                 CURL_VERSION_GSSNEGOTIATE))\r\n          GetStr(&config->krblevel, nextarg);\r\n        else\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        break;\r\n      case 'y': /* --max-filesize */\r\n        err = str2offset(&config->max_filesize, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'z': /* --disable-eprt */\r\n        config->disable_eprt = toggle;\r\n        break;\r\n      case 'Z': /* --eprt */\r\n        config->disable_eprt = (!toggle)?TRUE:FALSE;\r\n        break;\r\n\r\n      default: /* the URL! */\r\n      {\r\n        struct getout *url;\r\n        if(config->url_get || ((config->url_get = config->url_list) != NULL)) {\r\n          /* there's a node here, if it already is filled-in continue to find\r\n             an \"empty\" node */\r\n          while(config->url_get && (config->url_get->flags & GETOUT_URL))\r\n            config->url_get = config->url_get->next;\r\n        }\r\n\r\n        /* now there might or might not be an available node to fill in! */\r\n\r\n        if(config->url_get)\r\n          /* existing node */\r\n          url = config->url_get;\r\n        else\r\n          /* there was no free node, create one! */\r\n          url = new_getout(config);\r\n\r\n        if(!url)\r\n          return PARAM_NO_MEM;\r\n        else {\r\n          /* fill in the URL */\r\n          GetStr(&url->url, nextarg);\r\n          url->flags |= GETOUT_URL;\r\n        }\r\n      }\r\n      }\r\n      break;\r\n    case '$': /* more options without a short option */\r\n      switch(subletter) {\r\n      case 'a': /* --ftp-ssl */\r\n        if(toggle && !(curlinfo->features & CURL_VERSION_SSL))\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        config->ftp_ssl = toggle;\r\n        break;\r\n      case 'b': /* --ftp-pasv */\r\n        Curl_safefree(config->ftpport);\r\n        break;\r\n      case 'c': /* --socks5 specifies a socks5 proxy to use, and resolves\r\n                   the name locally and passes on the resolved address */\r\n        GetStr(&config->socksproxy, nextarg);\r\n        config->socksver = CURLPROXY_SOCKS5;\r\n        break;\r\n      case 't': /* --socks4 specifies a socks4 proxy to use */\r\n        GetStr(&config->socksproxy, nextarg);\r\n        config->socksver = CURLPROXY_SOCKS4;\r\n        break;\r\n      case 'T': /* --socks4a specifies a socks4a proxy to use */\r\n        GetStr(&config->socksproxy, nextarg);\r\n        config->socksver = CURLPROXY_SOCKS4A;\r\n        break;\r\n      case '2': /* --socks5-hostname specifies a socks5 proxy and enables name\r\n                   resolving with the proxy */\r\n        GetStr(&config->socksproxy, nextarg);\r\n        config->socksver = CURLPROXY_SOCKS5_HOSTNAME;\r\n        break;\r\n      case 'd': /* --tcp-nodelay option */\r\n        config->tcp_nodelay = toggle;\r\n        break;\r\n      case 'e': /* --proxy-digest */\r\n        config->proxydigest = toggle;\r\n        break;\r\n      case 'f': /* --proxy-basic */\r\n        config->proxybasic = toggle;\r\n        break;\r\n      case 'g': /* --retry */\r\n        err = str2unum(&config->req_retry, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'h': /* --retry-delay */\r\n        err = str2unum(&config->retry_delay, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'i': /* --retry-max-time */\r\n        err = str2unum(&config->retry_maxtime, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n\r\n      case 'k': /* --proxy-negotiate */\r\n        if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE)\r\n          config->proxynegotiate = toggle;\r\n        else\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        break;\r\n      case 'm': /* --ftp-account */\r\n        GetStr(&config->ftp_account, nextarg);\r\n        break;\r\n      case 'n': /* --proxy-anyauth */\r\n        config->proxyanyauth = toggle;\r\n        break;\r\n      case 'o': /* --trace-time */\r\n        config->tracetime = toggle;\r\n        break;\r\n      case 'p': /* --ignore-content-length */\r\n        config->ignorecl = toggle;\r\n        break;\r\n      case 'q': /* --ftp-skip-pasv-ip */\r\n        config->ftp_skip_ip = toggle;\r\n        break;\r\n      case 'r': /* --ftp-method (undocumented at this point) */\r\n        config->ftp_filemethod = ftpfilemethod(config, nextarg);\r\n        break;\r\n      case 's': /* --local-port */\r\n        rc = sscanf(nextarg, \"%d - %d\",\r\n                    &config->localport,\r\n                    &config->localportrange);\r\n        if(!rc)\r\n          return PARAM_BAD_USE;\r\n        else if(rc == 1)\r\n          config->localportrange = 1; /* default number of ports to try */\r\n        else {\r\n          config->localportrange -= config->localport;\r\n          if(config->localportrange < 1) {\r\n            warnf(config, \"bad range input\\n\");\r\n            return PARAM_BAD_USE;\r\n          }\r\n        }\r\n        break;\r\n      case 'u': /* --ftp-alternative-to-user */\r\n        GetStr(&config->ftp_alternative_to_user, nextarg);\r\n        break;\r\n      case 'v': /* --ftp-ssl-reqd */\r\n        if(toggle && !(curlinfo->features & CURL_VERSION_SSL))\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        config->ftp_ssl_reqd = toggle;\r\n        break;\r\n      case 'w': /* --no-sessionid */\r\n        config->disable_sessionid = (!toggle)?TRUE:FALSE;\r\n        break;\r\n      case 'x': /* --ftp-ssl-control */\r\n        if(toggle && !(curlinfo->features & CURL_VERSION_SSL))\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        config->ftp_ssl_control = toggle;\r\n        break;\r\n      case 'y': /* --ftp-ssl-ccc */\r\n        config->ftp_ssl_ccc = toggle;\r\n        if(!config->ftp_ssl_ccc_mode)\r\n          config->ftp_ssl_ccc_mode = CURLFTPSSL_CCC_PASSIVE;\r\n        break;\r\n      case 'j': /* --ftp-ssl-ccc-mode */\r\n        config->ftp_ssl_ccc = TRUE;\r\n        config->ftp_ssl_ccc_mode = ftpcccmethod(config, nextarg);\r\n        break;\r\n      case 'z': /* --libcurl */\r\n#ifdef CURL_DISABLE_LIBCURL_OPTION\r\n        warnf(config,\r\n              \"--libcurl option was disabled at build-time!\\n\");\r\n        return PARAM_OPTION_UNKNOWN;\r\n#else\r\n        GetStr(&config->libcurl, nextarg);\r\n        break;\r\n#endif\r\n      case '#': /* --raw */\r\n        config->raw = toggle;\r\n        break;\r\n      case '0': /* --post301 */\r\n        config->post301 = toggle;\r\n        break;\r\n      case '1': /* --no-keepalive */\r\n        config->nokeepalive = (!toggle)?TRUE:FALSE;\r\n        break;\r\n      case '3': /* --keepalive-time */\r\n        err = str2unum(&config->alivetime, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case '4': /* --post302 */\r\n        config->post302 = toggle;\r\n        break;\r\n      case 'I': /* --post303 */\r\n        config->post303 = toggle;\r\n        break;\r\n      case '5': /* --noproxy */\r\n        /* This specifies the noproxy list */\r\n        GetStr(&config->noproxy, nextarg);\r\n        break;\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n      case '6': /* --socks5-gssapi-service */\r\n        GetStr(&config->socks5_gssapi_service, nextarg);\r\n        break;\r\n      case '7': /* --socks5-gssapi-nec*/\r\n        config->socks5_gssapi_nec = TRUE;\r\n        break;\r\n#endif\r\n      case '8': /* --proxy1.0 */\r\n        /* http 1.0 proxy */\r\n        GetStr(&config->proxy, nextarg);\r\n        config->proxyver = CURLPROXY_HTTP_1_0;\r\n        break;\r\n      case '9': /* --tftp-blksize */\r\n        err = str2unum(&config->tftp_blksize, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'A': /* --mail-from */\r\n        GetStr(&config->mail_from, nextarg);\r\n        break;\r\n      case 'B': /* --mail-rcpt */\r\n        /* append receiver to a list */\r\n        err = add2list(&config->mail_rcpt, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'C': /* --ftp-pret */\r\n        config->ftp_pret = toggle;\r\n        break;\r\n      case 'D': /* --proto */\r\n        config->proto_present = TRUE;\r\n        if(proto2num(config, &config->proto, nextarg))\r\n          return PARAM_BAD_USE;\r\n        break;\r\n      case 'E': /* --proto-redir */\r\n        config->proto_redir_present = TRUE;\r\n        if(proto2num(config, &config->proto_redir, nextarg))\r\n          return PARAM_BAD_USE;\r\n        break;\r\n      case 'F': /* --resolve */\r\n        err = add2list(&config->resolve, nextarg);\r\n        if(err)\r\n          return err;\r\n        break;\r\n      case 'G': /* --delegation LEVEL */\r\n        config->gssapi_delegation = delegation(config, nextarg);\r\n        break;\r\n      case 'H': /* --mail-auth */\r\n        GetStr(&config->mail_auth, nextarg);\r\n        break;\r\n      case 'J': /* --metalink */\r\n        {\r\n#ifdef USE_METALINK\r\n          int mlmaj, mlmin, mlpatch;\r\n          metalink_get_version(&mlmaj, &mlmin, &mlpatch);\r\n          if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) {\r\n            warnf(config,\r\n                  \"--metalink option cannot be used because the version of \"\r\n                  \"the linked libmetalink library is too old. \"\r\n                  \"Required: %d.%d.%d, found %d.%d.%d\\n\",\r\n                  CURL_REQ_LIBMETALINK_MAJOR,\r\n                  CURL_REQ_LIBMETALINK_MINOR,\r\n                  CURL_REQ_LIBMETALINK_PATCH,\r\n                  mlmaj, mlmin, mlpatch);\r\n            return PARAM_BAD_USE;\r\n          }\r\n          else\r\n            config->use_metalink = toggle;\r\n#else\r\n          warnf(config, \"--metalink option is ignored because the binary is \"\r\n                \"built without the Metalink support.\\n\");\r\n#endif\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    case '#': /* --progress-bar */\r\n      if(toggle)\r\n        config->progressmode = CURL_PROGRESS_BAR;\r\n      else\r\n        config->progressmode = CURL_PROGRESS_STATS;\r\n      break;\r\n    case '~': /* --xattr */\r\n      config->xattr = toggle;\r\n      break;\r\n    case '0':\r\n      /* HTTP version 1.0 */\r\n      config->httpversion = CURL_HTTP_VERSION_1_0;\r\n      break;\r\n    case '1':\r\n      /* TLS version 1 */\r\n      config->ssl_version = CURL_SSLVERSION_TLSv1;\r\n      break;\r\n    case '2':\r\n      /* SSL version 2 */\r\n      config->ssl_version = CURL_SSLVERSION_SSLv2;\r\n      break;\r\n    case '3':\r\n      /* SSL version 3 */\r\n      config->ssl_version = CURL_SSLVERSION_SSLv3;\r\n      break;\r\n    case '4':\r\n      /* IPv4 */\r\n      config->ip_version = 4;\r\n      break;\r\n    case '6':\r\n      /* IPv6 */\r\n      config->ip_version = 6;\r\n      break;\r\n    case 'a':\r\n      /* This makes the FTP sessions use APPE instead of STOR */\r\n      config->ftp_append = toggle;\r\n      break;\r\n    case 'A':\r\n      /* This specifies the User-Agent name */\r\n      GetStr(&config->useragent, nextarg);\r\n      break;\r\n    case 'b': /* cookie string coming up: */\r\n      if(nextarg[0] == '@') {\r\n        nextarg++;\r\n      }\r\n      else if(strchr(nextarg, '=')) {\r\n        /* A cookie string must have a =-letter */\r\n        GetStr(&config->cookie, nextarg);\r\n        break;\r\n      }\r\n      /* We have a cookie file to read from! */\r\n      GetStr(&config->cookiefile, nextarg);\r\n      break;\r\n    case 'B':\r\n      /* use ASCII/text when transferring */\r\n      config->use_ascii = toggle;\r\n      break;\r\n    case 'c':\r\n      /* get the file name to dump all cookies in */\r\n      GetStr(&config->cookiejar, nextarg);\r\n      break;\r\n    case 'C':\r\n      /* This makes us continue an ftp transfer at given position */\r\n      if(!curlx_strequal(nextarg, \"-\")) {\r\n        err = str2offset(&config->resume_from, nextarg);\r\n        if(err)\r\n          return err;\r\n        config->resume_from_current = FALSE;\r\n      }\r\n      else {\r\n        config->resume_from_current = TRUE;\r\n        config->resume_from = 0;\r\n      }\r\n      config->use_resume=TRUE;\r\n      break;\r\n    case 'd':\r\n      /* postfield data */\r\n    {\r\n      char *postdata = NULL;\r\n      FILE *file;\r\n      size_t size = 0;\r\n\r\n      if(subletter == 'e') { /* --data-urlencode*/\r\n        /* [name]=[content], we encode the content part only\r\n         * [name]@[file name]\r\n         *\r\n         * Case 2: we first load the file using that name and then encode\r\n         * the content.\r\n         */\r\n        const char *p = strchr(nextarg, '=');\r\n        size_t nlen;\r\n        char is_file;\r\n        if(!p)\r\n          /* there was no '=' letter, check for a '@' instead */\r\n          p = strchr(nextarg, '@');\r\n        if(p) {\r\n          nlen = p - nextarg; /* length of the name part */\r\n          is_file = *p++; /* pass the separator */\r\n        }\r\n        else {\r\n          /* neither @ nor =, so no name and it isn't a file */\r\n          nlen = is_file = 0;\r\n          p = nextarg;\r\n        }\r\n        if('@' == is_file) {\r\n          /* a '@' letter, it means that a file name or - (stdin) follows */\r\n\r\n          if(curlx_strequal(\"-\", p)) {\r\n            file = stdin;\r\n            set_binmode(stdin);\r\n          }\r\n          else {\r\n            file = fopen(p, \"rb\");\r\n            if(!file)\r\n              warnf(config,\r\n                    \"Couldn't read data from file \\\"%s\\\", this makes \"\r\n                    \"an empty POST.\\n\", nextarg);\r\n          }\r\n\r\n          err = file2memory(&postdata, &size, file);\r\n\r\n          if(file && (file != stdin))\r\n            fclose(file);\r\n          if(err)\r\n            return err;\r\n        }\r\n        else {\r\n          GetStr(&postdata, p);\r\n          if(postdata)\r\n            size = strlen(postdata);\r\n        }\r\n\r\n        if(!postdata) {\r\n          /* no data from the file, point to a zero byte string to make this\r\n             get sent as a POST anyway */\r\n          postdata = strdup(\"\");\r\n          if(!postdata)\r\n            return PARAM_NO_MEM;\r\n          size = 0;\r\n        }\r\n        else {\r\n          char *enc = curl_easy_escape(config->easy, postdata, (int)size);\r\n          Curl_safefree(postdata); /* no matter if it worked or not */\r\n          if(enc) {\r\n            /* now make a string with the name from above and append the\r\n               encoded string */\r\n            size_t outlen = nlen + strlen(enc) + 2;\r\n            char *n = malloc(outlen);\r\n            if(!n) {\r\n              curl_free(enc);\r\n              return PARAM_NO_MEM;\r\n            }\r\n            if(nlen > 0) { /* only append '=' if we have a name */\r\n              snprintf(n, outlen, \"%.*s=%s\", nlen, nextarg, enc);\r\n              size = outlen-1;\r\n            }\r\n            else {\r\n              strcpy(n, enc);\r\n              size = outlen-2; /* since no '=' was inserted */\r\n            }\r\n            curl_free(enc);\r\n            postdata = n;\r\n          }\r\n          else\r\n            return PARAM_NO_MEM;\r\n        }\r\n      }\r\n      else if('@' == *nextarg) {\r\n        /* the data begins with a '@' letter, it means that a file name\r\n           or - (stdin) follows */\r\n        nextarg++; /* pass the @ */\r\n\r\n        if(curlx_strequal(\"-\", nextarg)) {\r\n          file = stdin;\r\n          if(subletter == 'b') /* forced data-binary */\r\n            set_binmode(stdin);\r\n        }\r\n        else {\r\n          file = fopen(nextarg, \"rb\");\r\n          if(!file)\r\n            warnf(config, \"Couldn't read data from file \\\"%s\\\", this makes \"\r\n                  \"an empty POST.\\n\", nextarg);\r\n        }\r\n\r\n        if(subletter == 'b')\r\n          /* forced binary */\r\n          err = file2memory(&postdata, &size, file);\r\n        else {\r\n          err = file2string(&postdata, file);\r\n          if(postdata)\r\n            size = strlen(postdata);\r\n        }\r\n\r\n        if(file && (file != stdin))\r\n          fclose(file);\r\n        if(err)\r\n          return err;\r\n\r\n        if(!postdata) {\r\n          /* no data from the file, point to a zero byte string to make this\r\n             get sent as a POST anyway */\r\n          postdata = strdup(\"\");\r\n          if(!postdata)\r\n            return PARAM_NO_MEM;\r\n        }\r\n      }\r\n      else {\r\n        GetStr(&postdata, nextarg);\r\n        if(postdata)\r\n          size = strlen(postdata);\r\n      }\r\n\r\n#ifdef CURL_DOES_CONVERSIONS\r\n      if(subletter != 'b') {\r\n        /* NOT forced binary, convert to ASCII */\r\n        if(convert_to_network(postdata, strlen(postdata))) {\r\n          Curl_safefree(postdata);\r\n          return PARAM_NO_MEM;\r\n        }\r\n      }\r\n#endif\r\n\r\n      if(config->postfields) {\r\n        /* we already have a string, we append this one with a separating\r\n           &-letter */\r\n        char *oldpost = config->postfields;\r\n        curl_off_t oldlen = config->postfieldsize;\r\n        curl_off_t newlen = oldlen + size + 2;\r\n        config->postfields = malloc((size_t)newlen);\r\n        if(!config->postfields) {\r\n          Curl_safefree(oldpost);\r\n          Curl_safefree(postdata);\r\n          return PARAM_NO_MEM;\r\n        }\r\n        memcpy(config->postfields, oldpost, (size_t)oldlen);\r\n        /* use byte value 0x26 for '&' to accommodate non-ASCII platforms */\r\n        config->postfields[oldlen] = '\\x26';\r\n        memcpy(&config->postfields[oldlen+1], postdata, size);\r\n        config->postfields[oldlen+1+size] = '\\0';\r\n        Curl_safefree(oldpost);\r\n        Curl_safefree(postdata);\r\n        config->postfieldsize += size+1;\r\n      }\r\n      else {\r\n        config->postfields = postdata;\r\n        config->postfieldsize = size;\r\n      }\r\n    }\r\n    /*\r\n      We can't set the request type here, as this data might be used in\r\n      a simple GET if -G is used. Already or soon.\r\n\r\n      if(SetHTTPrequest(HTTPREQ_SIMPLEPOST, &config->httpreq)) {\r\n        Curl_safefree(postdata);\r\n        return PARAM_BAD_USE;\r\n      }\r\n    */\r\n    break;\r\n    case 'D':\r\n      /* dump-header to given file name */\r\n      GetStr(&config->headerfile, nextarg);\r\n      break;\r\n    case 'e':\r\n    {\r\n      char *ptr = strstr(nextarg, \";auto\");\r\n      if(ptr) {\r\n        /* Automatic referer requested, this may be combined with a\r\n           set initial one */\r\n        config->autoreferer = TRUE;\r\n        *ptr = 0; /* zero terminate here */\r\n      }\r\n      else\r\n        config->autoreferer = FALSE;\r\n      GetStr(&config->referer, nextarg);\r\n    }\r\n    break;\r\n    case 'E':\r\n      switch(subletter) {\r\n      case 'a': /* CA info PEM file */\r\n        /* CA info PEM file */\r\n        GetStr(&config->cacert, nextarg);\r\n        break;\r\n      case 'b': /* cert file type */\r\n        GetStr(&config->cert_type, nextarg);\r\n        break;\r\n      case 'c': /* private key file */\r\n        GetStr(&config->key, nextarg);\r\n        break;\r\n      case 'd': /* private key file type */\r\n        GetStr(&config->key_type, nextarg);\r\n        break;\r\n      case 'e': /* private key passphrase */\r\n        GetStr(&config->key_passwd, nextarg);\r\n        cleanarg(nextarg);\r\n        break;\r\n      case 'f': /* crypto engine */\r\n        GetStr(&config->engine, nextarg);\r\n        if(config->engine && curlx_raw_equal(config->engine,\"list\"))\r\n          config->list_engines = TRUE;\r\n        break;\r\n      case 'g': /* CA info PEM file */\r\n        /* CA cert directory */\r\n        GetStr(&config->capath, nextarg);\r\n        break;\r\n      case 'h': /* --pubkey public key file */\r\n        GetStr(&config->pubkey, nextarg);\r\n        break;\r\n      case 'i': /* --hostpubmd5 md5 of the host public key */\r\n        GetStr(&config->hostpubmd5, nextarg);\r\n        if(!config->hostpubmd5 || strlen(config->hostpubmd5) != 32)\r\n          return PARAM_BAD_USE;\r\n        break;\r\n      case 'j': /* CRL info PEM file */\r\n        /* CRL file */\r\n        GetStr(&config->crlfile, nextarg);\r\n        break;\r\n      case 'k': /* TLS username */\r\n        if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP)\r\n          GetStr(&config->tls_username, nextarg);\r\n        else\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        break;\r\n      case 'l': /* TLS password */\r\n        if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP)\r\n          GetStr(&config->tls_password, nextarg);\r\n        else\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        break;\r\n      case 'm': /* TLS authentication type */\r\n        if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) {\r\n          GetStr(&config->tls_authtype, nextarg);\r\n          if(!strequal(config->tls_authtype, \"SRP\"))\r\n            return PARAM_LIBCURL_DOESNT_SUPPORT; /* only support TLS-SRP */\r\n        }\r\n        else\r\n          return PARAM_LIBCURL_DOESNT_SUPPORT;\r\n        break;\r\n      case 'n': /* no empty SSL fragments */\r\n        if(curlinfo->features & CURL_VERSION_SSL)\r\n          config->ssl_allow_beast = toggle;\r\n        break;\r\n      default: /* certificate file */\r\n      {\r\n        char *ptr = strchr(nextarg, ':');\r\n        /* Since we live in a world of weirdness and confusion, the win32\r\n           dudes can use : when using drive letters and thus\r\n           c:\\file:password needs to work. In order not to break\r\n           compatibility, we still use : as separator, but we try to detect\r\n           when it is used for a file name! On windows. */\r\n#ifdef WIN32\r\n        if(ptr &&\r\n           (ptr == &nextarg[1]) &&\r\n           (nextarg[2] == '\\\\' || nextarg[2] == '/') &&\r\n           (ISALPHA(nextarg[0])) )\r\n          /* colon in the second column, followed by a backslash, and the\r\n             first character is an alphabetic letter:\r\n\r\n             this is a drive letter colon */\r\n          ptr = strchr(&nextarg[3], ':'); /* find the next one instead */\r\n#endif\r\n        if(ptr) {\r\n          /* we have a password too */\r\n          *ptr = '\\0';\r\n          ptr++;\r\n          GetStr(&config->key_passwd, ptr);\r\n        }\r\n        GetStr(&config->cert, nextarg);\r\n        cleanarg(nextarg);\r\n      }\r\n      }\r\n      break;\r\n    case 'f':\r\n      /* fail hard on errors  */\r\n      config->failonerror = toggle;\r\n      break;\r\n    case 'F':\r\n      /* \"form data\" simulation, this is a little advanced so lets do our best\r\n         to sort this out slowly and carefully */\r\n      if(formparse(config,\r\n                   nextarg,\r\n                   &config->httppost,\r\n                   &config->last_post,\r\n                   (subletter=='s')?TRUE:FALSE)) /* 's' means literal string */\r\n        return PARAM_BAD_USE;\r\n      if(SetHTTPrequest(config, HTTPREQ_POST, &config->httpreq))\r\n        return PARAM_BAD_USE;\r\n      break;\r\n\r\n    case 'g': /* g disables URLglobbing */\r\n      config->globoff = toggle;\r\n      break;\r\n\r\n    case 'G': /* HTTP GET */\r\n      config->use_httpget = TRUE;\r\n      break;\r\n\r\n    case 'h': /* h for help */\r\n      if(toggle) {\r\n        tool_help();\r\n        return PARAM_HELP_REQUESTED;\r\n      }\r\n      /* we now actually support --no-help too! */\r\n      break;\r\n    case 'H':\r\n      /* A custom header to append to a list */\r\n      err = add2list(&config->headers, nextarg);\r\n      if(err)\r\n        return err;\r\n      break;\r\n    case 'i':\r\n      config->include_headers = toggle; /* include the headers as well in the\r\n                                           general output stream */\r\n      break;\r\n    case 'j':\r\n      config->cookiesession = toggle;\r\n      break;\r\n    case 'I':\r\n      /*\r\n       * no_body will imply include_headers later on\r\n       */\r\n      config->no_body = toggle;\r\n      if(SetHTTPrequest(config,\r\n                        (config->no_body)?HTTPREQ_HEAD:HTTPREQ_GET,\r\n                        &config->httpreq))\r\n        return PARAM_BAD_USE;\r\n      break;\r\n    case 'J': /* --remote-header-name */\r\n      if(config->include_headers) {\r\n        warnf(config,\r\n              \"--include and --remote-header-name cannot be combined.\\n\");\r\n        return PARAM_BAD_USE;\r\n      }\r\n      config->content_disposition = toggle;\r\n      break;\r\n    case 'k': /* allow insecure SSL connects */\r\n      config->insecure_ok = toggle;\r\n      break;\r\n    case 'K': /* parse config file */\r\n      if(parseconfig(nextarg, config))\r\n        warnf(config, \"error trying read config from the '%s' file\\n\",\r\n              nextarg);\r\n      break;\r\n    case 'l':\r\n      config->dirlistonly = toggle; /* only list the names of the FTP dir */\r\n      break;\r\n    case 'L':\r\n      config->followlocation = toggle; /* Follow Location: HTTP headers */\r\n      switch (subletter) {\r\n      case 't':\r\n        /* Continue to send authentication (user+password) when following\r\n         * locations, even when hostname changed */\r\n        config->unrestricted_auth = toggle;\r\n        break;\r\n      }\r\n      break;\r\n    case 'm':\r\n      /* specified max time */\r\n      err = str2unum(&config->timeout, nextarg);\r\n      if(err)\r\n        return err;\r\n      break;\r\n    case 'M': /* M for manual, huge help */\r\n      if(toggle) { /* --no-manual shows no manual... */\r\n#ifdef USE_MANUAL\r\n        hugehelp();\r\n        return PARAM_HELP_REQUESTED;\r\n#else\r\n        warnf(config,\r\n              \"built-in manual was disabled at build-time!\\n\");\r\n        return PARAM_OPTION_UNKNOWN;\r\n#endif\r\n      }\r\n      break;\r\n    case 'n':\r\n      switch(subletter) {\r\n      case 'o': /* CA info PEM file */\r\n        /* use .netrc or URL */\r\n        config->netrc_opt = toggle;\r\n        break;\r\n      case 'e': /* netrc-file */\r\n        GetStr(&config->netrc_file, nextarg);\r\n        break;\r\n      default:\r\n        /* pick info from .netrc, if this is used for http, curl will\r\n           automatically enfore user+password with the request */\r\n        config->netrc = toggle;\r\n        break;\r\n      }\r\n      break;\r\n    case 'N':\r\n      /* disable the output I/O buffering. note that the option is called\r\n         --buffer but is mostly used in the negative form: --no-buffer */\r\n      if(longopt)\r\n        config->nobuffer = (!toggle)?TRUE:FALSE;\r\n      else\r\n        config->nobuffer = toggle;\r\n      break;\r\n    case 'O': /* --remote-name */\r\n      if(subletter == 'a') { /* --remote-name-all */\r\n        config->default_node_flags = toggle?GETOUT_USEREMOTE:0;\r\n        break;\r\n      }\r\n      /* fall-through! */\r\n    case 'o': /* --output */\r\n      /* output file */\r\n    {\r\n      struct getout *url;\r\n      if(config->url_out || ((config->url_out = config->url_list) != NULL)) {\r\n        /* there's a node here, if it already is filled-in continue to find\r\n           an \"empty\" node */\r\n        while(config->url_out && (config->url_out->flags & GETOUT_OUTFILE))\r\n          config->url_out = config->url_out->next;\r\n      }\r\n\r\n      /* now there might or might not be an available node to fill in! */\r\n\r\n      if(config->url_out)\r\n        /* existing node */\r\n        url = config->url_out;\r\n      else\r\n        /* there was no free node, create one! */\r\n        url = new_getout(config);\r\n\r\n      if(!url)\r\n        return PARAM_NO_MEM;\r\n      else {\r\n        /* fill in the outfile */\r\n        if('o' == letter) {\r\n          GetStr(&url->outfile, nextarg);\r\n          url->flags &= ~GETOUT_USEREMOTE; /* switch off */\r\n        }\r\n        else {\r\n          url->outfile = NULL; /* leave it */\r\n          if(toggle)\r\n            url->flags |= GETOUT_USEREMOTE;  /* switch on */\r\n          else\r\n            url->flags &= ~GETOUT_USEREMOTE; /* switch off */\r\n        }\r\n        url->flags |= GETOUT_OUTFILE;\r\n      }\r\n    }\r\n    break;\r\n    case 'P':\r\n      /* This makes the FTP sessions use PORT instead of PASV */\r\n      /* use <eth0> or <192.168.10.10> style addresses. Anything except\r\n         this will make us try to get the \"default\" address.\r\n         NOTE: this is a changed behaviour since the released 4.1!\r\n      */\r\n      GetStr(&config->ftpport, nextarg);\r\n      break;\r\n    case 'p':\r\n      /* proxy tunnel for non-http protocols */\r\n      config->proxytunnel = toggle;\r\n      break;\r\n\r\n    case 'q': /* if used first, already taken care of, we do it like\r\n                 this so we don't cause an error! */\r\n      break;\r\n    case 'Q':\r\n      /* QUOTE command to send to FTP server */\r\n      switch(nextarg[0]) {\r\n      case '-':\r\n        /* prefixed with a dash makes it a POST TRANSFER one */\r\n        nextarg++;\r\n        err = add2list(&config->postquote, nextarg);\r\n        break;\r\n      case '+':\r\n        /* prefixed with a plus makes it a just-before-transfer one */\r\n        nextarg++;\r\n        err = add2list(&config->prequote, nextarg);\r\n        break;\r\n      default:\r\n        err = add2list(&config->quote, nextarg);\r\n        break;\r\n      }\r\n      if(err)\r\n        return err;\r\n      break;\r\n    case 'r':\r\n      /* Specifying a range WITHOUT A DASH will create an illegal HTTP range\r\n         (and won't actually be range by definition). The man page previously\r\n         claimed that to be a good way, why this code is added to work-around\r\n         it. */\r\n      if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {\r\n        char buffer[32];\r\n        curl_off_t off;\r\n        warnf(config,\r\n              \"A specified range MUST include at least one dash (-). \"\r\n              \"Appending one for you!\\n\");\r\n        off = curlx_strtoofft(nextarg, NULL, 10);\r\n        snprintf(buffer, sizeof(buffer), \"%\" CURL_FORMAT_CURL_OFF_T \"-\", off);\r\n        Curl_safefree(config->range);\r\n        config->range = strdup(buffer);\r\n        if(!config->range)\r\n          return PARAM_NO_MEM;\r\n      }\r\n      {\r\n        /* byte range requested */\r\n        char *tmp_range;\r\n        tmp_range = nextarg;\r\n        while(*tmp_range != '\\0') {\r\n          if(!ISDIGIT(*tmp_range) && *tmp_range != '-' && *tmp_range != ',') {\r\n            warnf(config,\"Invalid character is found in given range. \"\r\n                  \"A specified range MUST have only digits in \"\r\n                  \"\\'start\\'-\\'stop\\'. The server's response to this \"\r\n                  \"request is uncertain.\\n\");\r\n            break;\r\n          }\r\n          tmp_range++;\r\n        }\r\n        /* byte range requested */\r\n        GetStr(&config->range, nextarg);\r\n      }\r\n      break;\r\n    case 'R':\r\n      /* use remote file's time */\r\n      config->remote_time = toggle;\r\n      break;\r\n    case 's':\r\n      /* don't show progress meter, don't show errors : */\r\n      if(toggle)\r\n        config->mute = config->noprogress = TRUE;\r\n      else\r\n        config->mute = config->noprogress = FALSE;\r\n      if(config->showerror < 0)\r\n        /* if still on the default value, set showerror to the reverse of\r\n           toggle. This is to allow -S and -s to be used in an independent\r\n           order but still have the same effect. */\r\n        config->showerror = (!toggle)?TRUE:FALSE; /* toggle off */\r\n      break;\r\n    case 'S':\r\n      /* show errors */\r\n      config->showerror = toggle?1:0; /* toggle on if used with -s */\r\n      break;\r\n    case 't':\r\n      /* Telnet options */\r\n      err = add2list(&config->telnet_options, nextarg);\r\n      if(err)\r\n        return err;\r\n      break;\r\n    case 'T':\r\n      /* we are uploading */\r\n    {\r\n      struct getout *url;\r\n      if(config->url_out || ((config->url_out = config->url_list) != NULL)) {\r\n        /* there's a node here, if it already is filled-in continue to find\r\n           an \"empty\" node */\r\n        while(config->url_out && (config->url_out->flags & GETOUT_UPLOAD))\r\n          config->url_out = config->url_out->next;\r\n      }\r\n\r\n      /* now there might or might not be an available node to fill in! */\r\n\r\n      if(config->url_out)\r\n        /* existing node */\r\n        url = config->url_out;\r\n      else\r\n        /* there was no free node, create one! */\r\n        url = new_getout(config);\r\n\r\n      if(!url)\r\n        return PARAM_NO_MEM;\r\n      else {\r\n        url->flags |= GETOUT_UPLOAD; /* mark -T used */\r\n        if(!*nextarg)\r\n          url->flags |= GETOUT_NOUPLOAD;\r\n        else {\r\n          /* \"-\" equals stdin, but keep the string around for now */\r\n          GetStr(&url->infile, nextarg);\r\n        }\r\n      }\r\n    }\r\n    break;\r\n    case 'u':\r\n      /* user:password  */\r\n      GetStr(&config->userpwd, nextarg);\r\n      cleanarg(nextarg);\r\n      err = checkpasswd(\"host\", &config->userpwd);\r\n      if(err)\r\n        return err;\r\n      break;\r\n    case 'U':\r\n      /* Proxy user:password  */\r\n      GetStr(&config->proxyuserpwd, nextarg);\r\n      cleanarg(nextarg);\r\n      err = checkpasswd(\"proxy\", &config->proxyuserpwd);\r\n      if(err)\r\n        return err;\r\n      break;\r\n    case 'v':\r\n      if(toggle) {\r\n        /* the '%' thing here will cause the trace get sent to stderr */\r\n        Curl_safefree(config->trace_dump);\r\n        config->trace_dump = strdup(\"%\");\r\n        if(!config->trace_dump)\r\n          return PARAM_NO_MEM;\r\n        if(config->tracetype && (config->tracetype != TRACE_PLAIN))\r\n          warnf(config,\r\n                \"-v, --verbose overrides an earlier trace/verbose option\\n\");\r\n        config->tracetype = TRACE_PLAIN;\r\n      }\r\n      else\r\n        /* verbose is disabled here */\r\n        config->tracetype = TRACE_NONE;\r\n      break;\r\n    case 'V':\r\n    {\r\n      const char *const *proto;\r\n\r\n      if(!toggle)\r\n        /* --no-version yields no output! */\r\n        break;\r\n\r\n      printf(CURL_ID \"%s\\n\", curl_version());\r\n      if(curlinfo->protocols) {\r\n        printf(\"Protocols: \");\r\n        for(proto = curlinfo->protocols; *proto; ++proto) {\r\n          printf(\"%s \", *proto);\r\n        }\r\n        puts(\"\"); /* newline */\r\n      }\r\n      if(curlinfo->features) {\r\n        unsigned int i;\r\n        printf(\"Features: \");\r\n        for(i = 0; i < sizeof(feats)/sizeof(feats[0]); i++) {\r\n          if(curlinfo->features & feats[i].bitmask)\r\n            printf(\"%s \", feats[i].name);\r\n        }\r\n#ifdef USE_METALINK\r\n        printf(\"Metalink \");\r\n#endif\r\n        puts(\"\"); /* newline */\r\n      }\r\n    }\r\n    return PARAM_HELP_REQUESTED;\r\n    case 'w':\r\n      /* get the output string */\r\n      if('@' == *nextarg) {\r\n        /* the data begins with a '@' letter, it means that a file name\r\n           or - (stdin) follows */\r\n        FILE *file;\r\n        const char *fname;\r\n        nextarg++; /* pass the @ */\r\n        if(curlx_strequal(\"-\", nextarg)) {\r\n          fname = \"<stdin>\";\r\n          file = stdin;\r\n        }\r\n        else {\r\n          fname = nextarg;\r\n          file = fopen(nextarg, \"r\");\r\n        }\r\n        err = file2string(&config->writeout, file);\r\n        if(file && (file != stdin))\r\n          fclose(file);\r\n        if(err)\r\n          return err;\r\n        if(!config->writeout)\r\n          warnf(config, \"Failed to read %s\", fname);\r\n      }\r\n      else\r\n        GetStr(&config->writeout, nextarg);\r\n      break;\r\n    case 'x':\r\n      /* proxy */\r\n      GetStr(&config->proxy, nextarg);\r\n      config->proxyver = CURLPROXY_HTTP;\r\n      break;\r\n    case 'X':\r\n      /* set custom request */\r\n      GetStr(&config->customrequest, nextarg);\r\n      break;\r\n    case 'y':\r\n      /* low speed time */\r\n      err = str2unum(&config->low_speed_time, nextarg);\r\n      if(err)\r\n        return err;\r\n      if(!config->low_speed_limit)\r\n        config->low_speed_limit = 1;\r\n      break;\r\n    case 'Y':\r\n      /* low speed limit */\r\n      err = str2unum(&config->low_speed_limit, nextarg);\r\n      if(err)\r\n        return err;\r\n      if(!config->low_speed_time)\r\n        config->low_speed_time = 30;\r\n      break;\r\n    case 'z': /* time condition coming up */\r\n      switch(*nextarg) {\r\n      case '+':\r\n        nextarg++;\r\n      default:\r\n        /* If-Modified-Since: (section 14.28 in RFC2068) */\r\n        config->timecond = CURL_TIMECOND_IFMODSINCE;\r\n        break;\r\n      case '-':\r\n        /* If-Unmodified-Since:  (section 14.24 in RFC2068) */\r\n        config->timecond = CURL_TIMECOND_IFUNMODSINCE;\r\n        nextarg++;\r\n        break;\r\n      case '=':\r\n        /* Last-Modified:  (section 14.29 in RFC2068) */\r\n        config->timecond = CURL_TIMECOND_LASTMOD;\r\n        nextarg++;\r\n        break;\r\n      }\r\n      now = time(NULL);\r\n      config->condtime=curl_getdate(nextarg, &now);\r\n      if(-1 == (int)config->condtime) {\r\n        /* now let's see if it is a file name to get the time from instead! */\r\n        struct_stat statbuf;\r\n        if(-1 == stat(nextarg, &statbuf)) {\r\n          /* failed, remove time condition */\r\n          config->timecond = CURL_TIMECOND_NONE;\r\n          warnf(config,\r\n                \"Illegal date format for -z, --timecond (and not \"\r\n                \"a file name). Disabling time condition. \"\r\n                \"See curl_getdate(3) for valid date syntax.\\n\");\r\n        }\r\n        else {\r\n          /* pull the time out from the file */\r\n          config->condtime = statbuf.st_mtime;\r\n        }\r\n      }\r\n      break;\r\n    default: /* unknown flag */\r\n      return PARAM_OPTION_UNKNOWN;\r\n    }\r\n    hit = -1;\r\n\r\n  } while(!longopt && !singleopt && *++parse && !*usedarg);\r\n\r\n  return PARAM_OK;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_getparam.h",
    "content": "#ifndef HEADER_CURL_TOOL_GETPARAM_H\r\n#define HEADER_CURL_TOOL_GETPARAM_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\ntypedef enum {\r\n  PARAM_OK = 0,\r\n  PARAM_OPTION_AMBIGUOUS,\r\n  PARAM_OPTION_UNKNOWN,\r\n  PARAM_REQUIRES_PARAMETER,\r\n  PARAM_BAD_USE,\r\n  PARAM_HELP_REQUESTED,\r\n  PARAM_GOT_EXTRA_PARAMETER,\r\n  PARAM_BAD_NUMERIC,\r\n  PARAM_NEGATIVE_NUMERIC,\r\n  PARAM_LIBCURL_DOESNT_SUPPORT,\r\n  PARAM_NO_MEM,\r\n  PARAM_LAST\r\n} ParameterError;\r\n\r\nstruct Configurable;\r\n\r\nParameterError getparameter(char *flag,\r\n                            char *nextarg,\r\n                            bool *usedarg,\r\n                            struct Configurable *config);\r\n\r\n#endif /* HEADER_CURL_TOOL_GETPARAM_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_getpass.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifndef HAVE_GETPASS_R\r\n/* this file is only for systems without getpass_r() */\r\n\r\n#ifdef HAVE_FCNTL_H\r\n#  include <fcntl.h>\r\n#endif\r\n\r\n#ifdef HAVE_TERMIOS_H\r\n#  include <termios.h>\r\n#elif defined(HAVE_TERMIO_H)\r\n#  include <termio.h>\r\n#endif\r\n\r\n#ifdef __VMS\r\n#  include descrip\r\n#  include starlet\r\n#  include iodef\r\n#endif\r\n\r\n#ifdef WIN32\r\n#  include <conio.h>\r\n#endif\r\n\r\n#ifdef NETWARE\r\n#  ifdef __NOVELL_LIBC__\r\n#    include <screen.h>\r\n#  else\r\n#    include <nwconio.h>\r\n#  endif\r\n#endif\r\n\r\n#define _MPRINTF_REPLACE\r\n#include <curl/mprintf.h>\r\n\r\n#include \"tool_getpass.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef __VMS\r\n/* VMS implementation */\r\nchar *getpass_r(const char *prompt, char *buffer, size_t buflen)\r\n{\r\n  long sts;\r\n  short chan;\r\n\r\n  /* MSK, 23-JAN-2004, iosbdef.h wasn't in VAX V7.2 or CC 6.4  */\r\n  /* distribution so I created this.  May revert back later to */\r\n  /* struct _iosb iosb;                                        */\r\n  struct _iosb\r\n     {\r\n     short int iosb$w_status; /* status     */\r\n     short int iosb$w_bcnt;   /* byte count */\r\n     int       unused;        /* unused     */\r\n     } iosb;\r\n\r\n  $DESCRIPTOR(ttdesc, \"TT\");\r\n\r\n  buffer[0] = '\\0';\r\n  sts = sys$assign(&ttdesc, &chan, 0, 0);\r\n  if(sts & 1) {\r\n    sts = sys$qiow(0, chan,\r\n                   IO$_READPROMPT | IO$M_NOECHO,\r\n                   &iosb, 0, 0, buffer, buflen, 0, 0,\r\n                   prompt, strlen(prompt));\r\n\r\n    if((sts & 1) && (iosb.iosb$w_status & 1))\r\n      buffer[iosb.iosb$w_bcnt] = '\\0';\r\n\r\n    sts = sys$dassgn(chan);\r\n  }\r\n  return buffer; /* we always return success */\r\n}\r\n#define DONE\r\n#endif /* __VMS */\r\n\r\n#ifdef __SYMBIAN32__\r\n#  define getch() getchar()\r\n#endif\r\n\r\n#if defined(WIN32) || defined(__SYMBIAN32__)\r\n\r\nchar *getpass_r(const char *prompt, char *buffer, size_t buflen)\r\n{\r\n  size_t i;\r\n  fputs(prompt, stderr);\r\n\r\n  for(i = 0; i < buflen; i++) {\r\n    buffer[i] = (char)getch();\r\n    if(buffer[i] == '\\r' || buffer[i] == '\\n') {\r\n      buffer[i] = '\\0';\r\n      break;\r\n    }\r\n    else\r\n      if(buffer[i] == '\\b')\r\n        /* remove this letter and if this is not the first key, remove the\r\n           previous one as well */\r\n        i = i - (i >= 1) ? 2 : 1;\r\n  }\r\n#ifndef __SYMBIAN32__\r\n  /* since echo is disabled, print a newline */\r\n  fputs(\"\\n\", stderr);\r\n#endif\r\n  /* if user didn't hit ENTER, terminate buffer */\r\n  if(i == buflen)\r\n    buffer[buflen-1] = '\\0';\r\n\r\n  return buffer; /* we always return success */\r\n}\r\n#define DONE\r\n#endif /* WIN32 || __SYMBIAN32__ */\r\n\r\n#ifdef NETWARE\r\n/* NetWare implementation */\r\n#ifdef __NOVELL_LIBC__\r\nchar *getpass_r(const char *prompt, char *buffer, size_t buflen)\r\n{\r\n  return getpassword(prompt, buffer, buflen);\r\n}\r\n#else\r\nchar *getpass_r(const char *prompt, char *buffer, size_t buflen)\r\n{\r\n  size_t i = 0;\r\n\r\n  printf(\"%s\", prompt);\r\n  do {\r\n    buffer[i++] = getch();\r\n    if(buffer[i-1] == '\\b') {\r\n      /* remove this letter and if this is not the first key,\r\n         remove the previous one as well */\r\n      if(i > 1) {\r\n        printf(\"\\b \\b\");\r\n        i = i - 2;\r\n      }\r\n      else {\r\n        RingTheBell();\r\n        i = i - 1;\r\n      }\r\n    }\r\n    else if(buffer[i-1] != 13)\r\n      putchar('*');\r\n\r\n  } while((buffer[i-1] != 13) && (i < buflen));\r\n  buffer[i-1] = '\\0';\r\n  printf(\"\\r\\n\");\r\n  return buffer;\r\n}\r\n#endif /* __NOVELL_LIBC__ */\r\n#define DONE\r\n#endif /* NETWARE */\r\n\r\n#ifndef DONE /* not previously provided */\r\n\r\n#ifdef HAVE_TERMIOS_H\r\n#  define struct_term  struct termios\r\n#elif defined(HAVE_TERMIO_H)\r\n#  define struct_term  struct termio\r\n#else\r\n#  undef  struct_term\r\n#endif\r\n\r\nstatic bool ttyecho(bool enable, int fd)\r\n{\r\n#ifdef struct_term\r\n  static struct_term withecho;\r\n  static struct_term noecho;\r\n#endif\r\n  if(!enable) {\r\n    /* disable echo by extracting the current 'withecho' mode and remove the\r\n       ECHO bit and set back the struct */\r\n#ifdef HAVE_TERMIOS_H\r\n    tcgetattr(fd, &withecho);\r\n    noecho = withecho;\r\n    noecho.c_lflag &= ~ECHO;\r\n    tcsetattr(fd, TCSANOW, &noecho);\r\n#elif defined(HAVE_TERMIO_H)\r\n    ioctl(fd, TCGETA, &withecho);\r\n    noecho = withecho;\r\n    noecho.c_lflag &= ~ECHO;\r\n    ioctl(fd, TCSETA, &noecho);\r\n#else\r\n    /* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */\r\n    (void)fd;\r\n    return FALSE; /* not disabled */\r\n#endif\r\n    return TRUE; /* disabled */\r\n  }\r\n  else {\r\n    /* re-enable echo, assumes we disabled it before (and set the structs we\r\n       now use to reset the terminal status) */\r\n#ifdef HAVE_TERMIOS_H\r\n    tcsetattr(fd, TCSAFLUSH, &withecho);\r\n#elif defined(HAVE_TERMIO_H)\r\n    ioctl(fd, TCSETA, &withecho);\r\n#else\r\n    return FALSE; /* not enabled */\r\n#endif\r\n    return TRUE; /* enabled */\r\n  }\r\n}\r\n\r\nchar *getpass_r(const char *prompt, /* prompt to display */\r\n                char *password,     /* buffer to store password in */\r\n                size_t buflen)      /* size of buffer to store password in */\r\n{\r\n  ssize_t nread;\r\n  bool disabled;\r\n  int fd = open(\"/dev/tty\", O_RDONLY);\r\n  if(-1 == fd)\r\n    fd = 1; /* use stdin if the tty couldn't be used */\r\n\r\n  disabled = ttyecho(FALSE, fd); /* disable terminal echo */\r\n\r\n  fputs(prompt, stderr);\r\n  nread = read(fd, password, buflen);\r\n  if(nread > 0)\r\n    password[--nread] = '\\0'; /* zero terminate where enter is stored */\r\n  else\r\n    password[0] = '\\0'; /* got nothing */\r\n\r\n  if(disabled) {\r\n    /* if echo actually was disabled, add a newline */\r\n    fputs(\"\\n\", stderr);\r\n    (void)ttyecho(TRUE, fd); /* enable echo */\r\n  }\r\n\r\n  if(1 != fd)\r\n    close(fd);\r\n\r\n  return password; /* return pointer to buffer */\r\n}\r\n\r\n#endif /* DONE */\r\n#endif /* HAVE_GETPASS_R */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_getpass.h",
    "content": "#ifndef HEADER_CURL_TOOL_GETPASS_H\r\n#define HEADER_CURL_TOOL_GETPASS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifndef HAVE_GETPASS_R\r\n/* If there's a system-provided function named like this, we trust it is\r\n   also found in one of the standard headers. */\r\n\r\n/*\r\n * Returning NULL will abort the continued operation!\r\n */\r\nchar* getpass_r(const char *prompt, char* buffer, size_t buflen);\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_GETPASS_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_help.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"tool_panykey.h\"\r\n#include \"tool_help.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef MSDOS\r\n#  define USE_WATT32\r\n#endif\r\n\r\n/*\r\n * A few of these source lines are >80 columns wide, but that's only because\r\n * breaking the strings narrower makes this chunk look even worse!\r\n *\r\n *  Starting with 7.18.0, this list of command line options is sorted based\r\n *  on the long option name. It is not done automatically, although a command\r\n *  line like the following can help out:\r\n *\r\n *  curl --help | cut -c5- | grep \"^-\" | sort\r\n */\r\n\r\nstatic const char *const helptext[] = {\r\n  \"Usage: curl [options...] <url>\",\r\n  \"Options: (H) means HTTP/HTTPS only, (F) means FTP only\",\r\n  \"     --anyauth       Pick \\\"any\\\" authentication method (H)\",\r\n  \" -a, --append        Append to target file when uploading (F/SFTP)\",\r\n  \"     --basic         Use HTTP Basic Authentication (H)\",\r\n  \"     --cacert FILE   CA certificate to verify peer against (SSL)\",\r\n  \"     --capath DIR    CA directory to verify peer against (SSL)\",\r\n  \" -E, --cert CERT[:PASSWD] Client certificate file and password (SSL)\",\r\n  \"     --cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL)\",\r\n  \"     --ciphers LIST  SSL ciphers to use (SSL)\",\r\n  \"     --compressed    Request compressed response (using deflate or gzip)\",\r\n  \" -K, --config FILE   Specify which config file to read\",\r\n  \"     --connect-timeout SECONDS  Maximum time allowed for connection\",\r\n  \" -C, --continue-at OFFSET  Resumed transfer offset\",\r\n  \" -b, --cookie STRING/FILE  String or file to read cookies from (H)\",\r\n  \" -c, --cookie-jar FILE  Write cookies to this file after operation (H)\",\r\n  \"     --create-dirs   Create necessary local directory hierarchy\",\r\n  \"     --crlf          Convert LF to CRLF in upload\",\r\n  \"     --crlfile FILE  Get a CRL list in PEM format from the given file\",\r\n  \" -d, --data DATA     HTTP POST data (H)\",\r\n  \"     --data-ascii DATA  HTTP POST ASCII data (H)\",\r\n  \"     --data-binary DATA  HTTP POST binary data (H)\",\r\n  \"     --data-urlencode DATA  HTTP POST data url encoded (H)\",\r\n  \"     --delegation STRING GSS-API delegation permission\",\r\n  \"     --digest        Use HTTP Digest Authentication (H)\",\r\n  \"     --disable-eprt  Inhibit using EPRT or LPRT (F)\",\r\n  \"     --disable-epsv  Inhibit using EPSV (F)\",\r\n  \" -D, --dump-header FILE  Write the headers to this file\",\r\n  \"     --egd-file FILE  EGD socket path for random data (SSL)\",\r\n  \"     --engine ENGINGE  Crypto engine (SSL). \\\"--engine list\\\" for list\",\r\n#ifdef USE_ENVIRONMENT\r\n  \"     --environment   Write results to environment variables (RISC OS)\",\r\n#endif\r\n  \" -f, --fail          Fail silently (no output at all) on HTTP errors (H)\",\r\n  \" -F, --form CONTENT  Specify HTTP multipart POST data (H)\",\r\n  \"     --form-string STRING  Specify HTTP multipart POST data (H)\",\r\n  \"     --ftp-account DATA  Account data string (F)\",\r\n  \"     --ftp-alternative-to-user COMMAND  \"\r\n  \"String to replace \\\"USER [name]\\\" (F)\",\r\n  \"     --ftp-create-dirs  Create the remote dirs if not present (F)\",\r\n  \"     --ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)\",\r\n  \"     --ftp-pasv      Use PASV/EPSV instead of PORT (F)\",\r\n  \" -P, --ftp-port ADR  Use PORT with given address instead of PASV (F)\",\r\n  \"     --ftp-skip-pasv-ip Skip the IP address for PASV (F)\\n\"\r\n  \"     --ftp-pret      Send PRET before PASV (for drftpd) (F)\",\r\n  \"     --ftp-ssl-ccc   Send CCC after authenticating (F)\",\r\n  \"     --ftp-ssl-ccc-mode ACTIVE/PASSIVE  Set CCC mode (F)\",\r\n  \"     --ftp-ssl-control Require SSL/TLS for ftp login, \"\r\n  \"clear for transfer (F)\",\r\n  \" -G, --get           Send the -d data with a HTTP GET (H)\",\r\n  \" -g, --globoff       Disable URL sequences and ranges using {} and []\",\r\n  \" -H, --header LINE   Custom header to pass to server (H)\",\r\n  \" -I, --head          Show document info only\",\r\n  \" -h, --help          This help text\",\r\n  \"     --hostpubmd5 MD5  \"\r\n  \"Hex encoded MD5 string of the host public key. (SSH)\",\r\n  \" -0, --http1.0       Use HTTP 1.0 (H)\",\r\n  \"     --ignore-content-length  Ignore the HTTP Content-Length header\",\r\n  \" -i, --include       Include protocol headers in the output (H/F)\",\r\n  \" -k, --insecure      Allow connections to SSL sites without certs (H)\",\r\n  \"     --interface INTERFACE  Specify network interface/address to use\",\r\n  \" -4, --ipv4          Resolve name to IPv4 address\",\r\n  \" -6, --ipv6          Resolve name to IPv6 address\",\r\n  \" -j, --junk-session-cookies Ignore session cookies read from file (H)\",\r\n  \"     --keepalive-time SECONDS  Interval between keepalive probes\",\r\n  \"     --key KEY       Private key file name (SSL/SSH)\",\r\n  \"     --key-type TYPE Private key file type (DER/PEM/ENG) (SSL)\",\r\n  \"     --krb LEVEL     Enable Kerberos with specified security level (F)\",\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n  \"     --libcurl FILE  Dump libcurl equivalent code of this command line\",\r\n#endif\r\n  \"     --limit-rate RATE  Limit transfer speed to this rate\",\r\n  \" -l, --list-only     List only names of an FTP directory (F)\",\r\n  \"     --local-port RANGE  Force use of these local port numbers\",\r\n  \" -L, --location      Follow redirects (H)\",\r\n  \"     --location-trusted like --location and send auth to other hosts (H)\",\r\n  \" -M, --manual        Display the full manual\",\r\n  \"     --mail-from FROM  Mail from this address\",\r\n  \"     --mail-rcpt TO  Mail to this receiver(s)\",\r\n  \"     --mail-auth AUTH  Originator address of the original email\",\r\n  \"     --max-filesize BYTES  Maximum file size to download (H/F)\",\r\n  \"     --max-redirs NUM  Maximum number of redirects allowed (H)\",\r\n  \" -m, --max-time SECONDS  Maximum time allowed for the transfer\",\r\n  \"     --metalink      Process given URLs as metalink XML file\",\r\n  \"     --negotiate     Use HTTP Negotiate Authentication (H)\",\r\n  \" -n, --netrc         Must read .netrc for user name and password\",\r\n  \"     --netrc-optional Use either .netrc or URL; overrides -n\",\r\n  \"     --netrc-file FILE  Set up the netrc filename to use\",\r\n  \" -N, --no-buffer     Disable buffering of the output stream\",\r\n  \"     --no-keepalive  Disable keepalive use on the connection\",\r\n  \"     --no-sessionid  Disable SSL session-ID reusing (SSL)\",\r\n  \"     --noproxy       List of hosts which do not use proxy\",\r\n  \"     --ntlm          Use HTTP NTLM authentication (H)\",\r\n  \" -o, --output FILE   Write output to <file> instead of stdout\",\r\n  \"     --pass PASS     Pass phrase for the private key (SSL/SSH)\",\r\n  \"     --post301       \"\r\n  \"Do not switch to GET after following a 301 redirect (H)\",\r\n  \"     --post302       \"\r\n  \"Do not switch to GET after following a 302 redirect (H)\",\r\n  \"     --post303       \"\r\n  \"Do not switch to GET after following a 303 redirect (H)\",\r\n  \" -#, --progress-bar  Display transfer progress as a progress bar\",\r\n  \"     --proto PROTOCOLS  Enable/disable specified protocols\",\r\n  \"     --proto-redir PROTOCOLS  \"\r\n  \"Enable/disable specified protocols on redirect\",\r\n  \" -x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port\",\r\n  \"     --proxy-anyauth Pick \\\"any\\\" proxy authentication method (H)\",\r\n  \"     --proxy-basic   Use Basic authentication on the proxy (H)\",\r\n  \"     --proxy-digest  Use Digest authentication on the proxy (H)\",\r\n  \"     --proxy-negotiate Use Negotiate authentication on the proxy (H)\",\r\n  \"     --proxy-ntlm    Use NTLM authentication on the proxy (H)\",\r\n  \" -U, --proxy-user USER[:PASSWORD]  Proxy user and password\",\r\n  \"     --proxy1.0 HOST[:PORT]  Use HTTP/1.0 proxy on given port\",\r\n  \" -p, --proxytunnel   Operate through a HTTP proxy tunnel (using CONNECT)\",\r\n  \"     --pubkey KEY    Public key file name (SSH)\",\r\n  \" -Q, --quote CMD     Send command(s) to server before transfer (F/SFTP)\",\r\n  \"     --random-file FILE  File for reading random data from (SSL)\",\r\n  \" -r, --range RANGE   Retrieve only the bytes within a range\",\r\n  \"     --raw           Do HTTP \\\"raw\\\", without any transfer decoding (H)\",\r\n  \" -e, --referer       Referer URL (H)\",\r\n  \" -J, --remote-header-name Use the header-provided filename (H)\",\r\n  \" -O, --remote-name   Write output to a file named as the remote file\",\r\n  \"     --remote-name-all Use the remote file name for all URLs\",\r\n  \" -R, --remote-time   Set the remote file's time on the local output\",\r\n  \" -X, --request COMMAND  Specify request command to use\",\r\n  \"     --resolve HOST:PORT:ADDRESS  Force resolve of HOST:PORT to ADDRESS\",\r\n  \"     --retry NUM   \"\r\n  \"Retry request NUM times if transient problems occur\",\r\n  \"     --retry-delay SECONDS \"\r\n  \"When retrying, wait this many seconds between each\",\r\n  \"     --retry-max-time SECONDS  Retry only within this period\",\r\n  \" -S, --show-error    \"\r\n  \"Show error. With -s, make curl show errors when they occur\",\r\n  \" -s, --silent        Silent mode. Don't output anything\",\r\n  \"     --socks4 HOST[:PORT]  SOCKS4 proxy on given host + port\",\r\n  \"     --socks4a HOST[:PORT]  SOCKS4a proxy on given host + port\",\r\n  \"     --socks5 HOST[:PORT]  SOCKS5 proxy on given host + port\",\r\n  \"     --socks5-hostname HOST[:PORT] \"\r\n  \"SOCKS5 proxy, pass host name to proxy\",\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n  \"     --socks5-gssapi-service NAME  SOCKS5 proxy service name for gssapi\",\r\n  \"     --socks5-gssapi-nec  Compatibility with NEC SOCKS5 server\",\r\n#endif\r\n  \" -Y, --speed-limit RATE  \"\r\n  \"Stop transfers below speed-limit for 'speed-time' secs\",\r\n  \" -y, --speed-time SECONDS  \"\r\n  \"Time for trig speed-limit abort. Defaults to 30\",\r\n  \"     --ssl           Try SSL/TLS (FTP, IMAP, POP3, SMTP)\",\r\n  \"     --ssl-reqd      Require SSL/TLS (FTP, IMAP, POP3, SMTP)\",\r\n  \" -2, --sslv2         Use SSLv2 (SSL)\",\r\n  \" -3, --sslv3         Use SSLv3 (SSL)\",\r\n  \"     --ssl-allow-beast Allow security flaw to improve interop (SSL)\",\r\n  \"     --stderr FILE   Where to redirect stderr. - means stdout\",\r\n  \"     --tcp-nodelay   Use the TCP_NODELAY option\",\r\n  \" -t, --telnet-option OPT=VAL  Set telnet option\",\r\n  \"     --tftp-blksize VALUE  Set TFTP BLKSIZE option (must be >512)\",\r\n  \" -z, --time-cond TIME  Transfer based on a time condition\",\r\n  \" -1, --tlsv1         Use TLSv1 (SSL)\",\r\n  \"     --trace FILE    Write a debug trace to the given file\",\r\n  \"     --trace-ascii FILE  Like --trace but without the hex output\",\r\n  \"     --trace-time    Add time stamps to trace/verbose output\",\r\n  \"     --tr-encoding   Request compressed transfer encoding (H)\",\r\n  \" -T, --upload-file FILE  Transfer FILE to destination\",\r\n  \"     --url URL       URL to work with\",\r\n  \" -B, --use-ascii     Use ASCII/text transfer\",\r\n  \" -u, --user USER[:PASSWORD]  Server user and password\",\r\n  \"     --tlsuser USER  TLS username\",\r\n  \"     --tlspassword STRING TLS password\",\r\n  \"     --tlsauthtype STRING  TLS authentication type (default SRP)\",\r\n  \" -A, --user-agent STRING  User-Agent to send to server (H)\",\r\n  \" -v, --verbose       Make the operation more talkative\",\r\n  \" -V, --version       Show version number and quit\",\r\n#ifdef USE_WATT32\r\n  \"     --wdebug        Turn on Watt-32 debugging\",\r\n#endif\r\n  \" -w, --write-out FORMAT  What to output after completion\",\r\n  \"     --xattr        Store metadata in extended file attributes\",\r\n  \" -q                 If used as the first parameter disables .curlrc\",\r\n  NULL\r\n};\r\n\r\n#ifdef NETWARE\r\n#  define PRINT_LINES_PAUSE 23\r\n#endif\r\n\r\n#ifdef __SYMBIAN32__\r\n#  define PRINT_LINES_PAUSE 16\r\n#endif\r\n\r\nvoid tool_help(void)\r\n{\r\n  int i;\r\n  for(i = 0; helptext[i]; i++) {\r\n    puts(helptext[i]);\r\n#ifdef PRINT_LINES_PAUSE\r\n    if(i && ((i % PRINT_LINES_PAUSE) == 0))\r\n      tool_pressanykey();\r\n#endif\r\n  }\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_help.h",
    "content": "#ifndef HEADER_CURL_TOOL_HELP_H\r\n#define HEADER_CURL_TOOL_HELP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nvoid tool_help(void);\r\n\r\n#endif /* HEADER_CURL_TOOL_HELP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_helpers.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_getparam.h\"\r\n#include \"tool_helpers.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/*\r\n** Helper functions that are used from more tha one source file.\r\n*/\r\n\r\nconst char *param2text(int res)\r\n{\r\n  ParameterError error = (ParameterError)res;\r\n  switch(error) {\r\n  case PARAM_GOT_EXTRA_PARAMETER:\r\n    return \"had unsupported trailing garbage\";\r\n  case PARAM_OPTION_UNKNOWN:\r\n    return \"is unknown\";\r\n  case PARAM_OPTION_AMBIGUOUS:\r\n    return \"is ambiguous\";\r\n  case PARAM_REQUIRES_PARAMETER:\r\n    return \"requires parameter\";\r\n  case PARAM_BAD_USE:\r\n    return \"is badly used here\";\r\n  case PARAM_BAD_NUMERIC:\r\n    return \"expected a proper numerical parameter\";\r\n  case PARAM_NEGATIVE_NUMERIC:\r\n    return \"expected a positive numerical parameter\";\r\n  case PARAM_LIBCURL_DOESNT_SUPPORT:\r\n    return \"the installed libcurl version doesn't support this\";\r\n  case PARAM_NO_MEM:\r\n    return \"out of memory\";\r\n  default:\r\n    return \"unknown error\";\r\n  }\r\n}\r\n\r\nint SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store)\r\n{\r\n  if((*store == HTTPREQ_UNSPEC) ||\r\n     (*store == req)) {\r\n    *store = req;\r\n    return 0;\r\n  }\r\n  warnf(config, \"You can only select one HTTP request!\\n\");\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_helpers.h",
    "content": "#ifndef HEADER_CURL_TOOL_HELPERS_H\r\n#define HEADER_CURL_TOOL_HELPERS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nconst char *param2text(int res);\r\n\r\nint SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store);\r\n\r\n#endif /* HEADER_CURL_TOOL_HELPERS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_homedir.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef HAVE_PWD_H\r\n#  include <pwd.h>\r\n#endif\r\n\r\n#include \"tool_homedir.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nstatic char *GetEnv(const char *variable, char do_expand)\r\n{\r\n  char *env = NULL;\r\n#ifdef WIN32\r\n  char  buf1[1024], buf2[1024];\r\n  DWORD rc;\r\n\r\n  /* Don't use getenv(); it doesn't find variable added after program was\r\n   * started. Don't accept truncated results (i.e. rc >= sizeof(buf1)).  */\r\n\r\n  rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1));\r\n  if(rc > 0 && rc < sizeof(buf1)) {\r\n    env = buf1;\r\n    variable = buf1;\r\n  }\r\n  if(do_expand && strchr(variable,'%')) {\r\n    /* buf2 == variable if not expanded */\r\n    rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2));\r\n    if(rc > 0 && rc < sizeof(buf2) &&\r\n       !strchr(buf2,'%'))    /* no vars still unexpanded */\r\n      env = buf2;\r\n  }\r\n#else\r\n  (void)do_expand;\r\n  /* no length control */\r\n  env = getenv(variable);\r\n#endif\r\n  return (env && env[0]) ? strdup(env) : NULL;\r\n}\r\n\r\n/* return the home directory of the current user as an allocated string */\r\nchar *homedir(void)\r\n{\r\n  char *home;\r\n\r\n  home = GetEnv(\"CURL_HOME\", FALSE);\r\n  if(home)\r\n    return home;\r\n\r\n  home = GetEnv(\"HOME\", FALSE);\r\n  if(home)\r\n    return home;\r\n\r\n#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)\r\n {\r\n   struct passwd *pw = getpwuid(geteuid());\r\n\r\n   if(pw) {\r\n     home = pw->pw_dir;\r\n     if(home && home[0])\r\n       home = strdup(home);\r\n     else\r\n       home = NULL;\r\n   }\r\n }\r\n#endif /* PWD-stuff */\r\n#ifdef WIN32\r\n  home = GetEnv(\"APPDATA\", TRUE);\r\n  if(!home)\r\n    home = GetEnv(\"%USERPROFILE%\\\\Application Data\", TRUE); /* Normally only\r\n                                                               on Win-2K/XP */\r\n#endif /* WIN32 */\r\n  return home;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_homedir.h",
    "content": "#ifndef HEADER_CURL_TOOL_HOMEDIR_H\r\n#define HEADER_CURL_TOOL_HOMEDIR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nchar *homedir(void);\r\n\r\n#endif /* HEADER_CURL_TOOL_HOMEDIR_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_hugehelp.c",
    "content": "#include \"tool_setup.h\"\r\n#ifndef HAVE_LIBZ\r\n/*\r\n * NEVER EVER edit this manually, fix the mkhelp.pl script instead!\r\n * Generation time: Mon Jan 28 21:57:07 2013\r\n */\r\n#ifdef USE_MANUAL\r\n#include \"tool_hugehelp.h\"\r\nvoid hugehelp(void)\r\n{\r\n   fputs(\r\n\"                                  _   _ ____  _\\n\"\r\n\"  Project                     ___| | | |  _ \\\\| |\\n\"\r\n\"                             / __| | | | |_) | |\\n\"\r\n\"                            | (__| |_| |  _ <| |___\\n\"\r\n\"                             \\\\___|\\\\___/|_| \\\\_\\\\_____|\\n\"\r\n\"\\n\"\r\n\"NAME\\n\"\r\n\"       curl - transfer a URL\\n\"\r\n\"\\n\"\r\n\"SYNOPSIS\\n\"\r\n\"       curl [options] [URL...]\\n\"\r\n\"\\n\"\r\n\"DESCRIPTION\\n\"\r\n\"       curl  is  a tool to transfer data from or to a server, using one of the\\n\"\r\n\"       supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS,  IMAP,\\n\"\r\n, stdout);\r\n fputs(\r\n\"       IMAPS,  LDAP,  LDAPS,  POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS,\\n\"\r\n\"       TELNET and TFTP).  The command is designed to work without user  inter-\\n\"\r\n\"       action.\\n\"\r\n\"\\n\"\r\n\"       curl offers a busload of useful tricks like proxy support, user authen-\\n\"\r\n\"       tication, FTP upload, HTTP post, SSL connections, cookies, file  trans-\\n\"\r\n\"       fer  resume,  Metalink,  and more. As you will see below, the number of\\n\"\r\n\"       features will make your head spin!\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       curl is powered by  libcurl  for  all  transfer-related  features.  See\\n\"\r\n\"       libcurl(3) for details.\\n\"\r\n\"\\n\"\r\n\"URL\\n\"\r\n\"       The  URL  syntax is protocol-dependent. You'll find a detailed descrip-\\n\"\r\n\"       tion in RFC 3986.\\n\"\r\n\"\\n\"\r\n\"       You can specify multiple URLs or parts of URLs  by  writing  part  sets\\n\"\r\n\"       within braces as in:\\n\"\r\n\"\\n\"\r\n\"        http://site.{one,two,three}.com\\n\"\r\n\"\\n\"\r\n\"       or you can get sequences of alphanumeric series by using [] as in:\\n\"\r\n\"\\n\"\r\n\"        ftp://ftp.numericals.com/file[1-100].txt\\n\"\r\n, stdout);\r\n fputs(\r\n\"        ftp://ftp.numericals.com/file[001-100].txt    (with leading zeros)\\n\"\r\n\"        ftp://ftp.letters.com/file[a-z].txt\\n\"\r\n\"\\n\"\r\n\"       Nested  sequences  are not supported, but you can use several ones next\\n\"\r\n\"       to each other:\\n\"\r\n\"\\n\"\r\n\"        http://any.org/archive[1996-1999]/vol[1-4]/part{a,b,c}.html\\n\"\r\n\"\\n\"\r\n\"       You can specify any amount of URLs on the command line.  They  will  be\\n\"\r\n\"       fetched in a sequential manner in the specified order.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       You  can  specify a step counter for the ranges to get every Nth number\\n\"\r\n\"       or letter:\\n\"\r\n\"\\n\"\r\n\"        http://www.numericals.com/file[1-100:10].txt\\n\"\r\n\"        http://www.letters.com/file[a-z:2].txt\\n\"\r\n\"\\n\"\r\n\"       If you specify URL without protocol:// prefix,  curl  will  attempt  to\\n\"\r\n\"       guess  what  protocol  you might want. It will then default to HTTP but\\n\"\r\n\"       try other protocols based on often-used host name prefixes.  For  exam-\\n\"\r\n, stdout);\r\n fputs(\r\n\"       ple,  for  host names starting with \\\"ftp.\\\" curl will assume you want to\\n\"\r\n\"       speak FTP.\\n\"\r\n\"\\n\"\r\n\"       curl will do its best to use what you pass to it as a URL.  It  is  not\\n\"\r\n\"       trying  to  validate it as a syntactically correct URL by any means but\\n\"\r\n\"       is instead very liberal with what it accepts.\\n\"\r\n\"\\n\"\r\n\"       curl will attempt to re-use connections for multiple file transfers, so\\n\"\r\n\"       that  getting many files from the same server will not do multiple con-\\n\"\r\n, stdout);\r\n fputs(\r\n\"       nects / handshakes. This improves speed. Of course this is only done on\\n\"\r\n\"       files  specified  on  a  single command line and cannot be used between\\n\"\r\n\"       separate curl invokes.\\n\"\r\n\"\\n\"\r\n\"PROGRESS METER\\n\"\r\n\"       curl normally displays a progress meter during  operations,  indicating\\n\"\r\n\"       the  amount  of  transferred  data,  transfer speeds and estimated time\\n\"\r\n\"       left, etc.\\n\"\r\n\"\\n\"\r\n\"       curl displays this data to the terminal by default, so  if  you  invoke\\n\"\r\n, stdout);\r\n fputs(\r\n\"       curl  to do an operation and it is about to write data to the terminal,\\n\"\r\n\"       it disables the progress meter as otherwise it would mess up the output\\n\"\r\n\"       mixing progress meter and response data.\\n\"\r\n\"\\n\"\r\n\"       If you want a progress meter for HTTP POST or PUT requests, you need to\\n\"\r\n\"       redirect the response output to a file, using shell  redirect  (>),  -o\\n\"\r\n\"       [file] or similar.\\n\"\r\n\"\\n\"\r\n\"       It  is not the same case for FTP upload as that operation does not spit\\n\"\r\n, stdout);\r\n fputs(\r\n\"       out any response data to the terminal.\\n\"\r\n\"\\n\"\r\n\"       If you prefer a progress \\\"bar\\\" instead of the regular meter, -# is your\\n\"\r\n\"       friend.\\n\"\r\n\"OPTIONS\\n\"\r\n\"       In general, all boolean options are enabled with --option and yet again\\n\"\r\n\"       disabled with --no-option. That is, you use the exact same option  name\\n\"\r\n\"       but prefix it with \\\"no-\\\". However, in this list we mostly only list and\\n\"\r\n\"       show the --option version of them. (This concept with --no options  was\\n\"\r\n, stdout);\r\n fputs(\r\n\"       added  in  7.19.0.  Previously  most  options  were  toggled  on/off on\\n\"\r\n\"       repeated use of the same command line option.)\\n\"\r\n\"\\n\"\r\n\"       -#, --progress-bar\\n\"\r\n\"              Make curl display progress as a simple progress bar  instead  of\\n\"\r\n\"              the standard, more informational, meter.\\n\"\r\n\"\\n\"\r\n\"       -0, --http1.0\\n\"\r\n\"              (HTTP)  Forces curl to issue its requests using HTTP 1.0 instead\\n\"\r\n\"              of using its internally preferred: HTTP 1.1.\\n\"\r\n\"\\n\"\r\n\"       -1, --tlsv1\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (SSL) Forces curl to use TLS version 1 when negotiating  with  a\\n\"\r\n\"              remote TLS server.\\n\"\r\n\"\\n\"\r\n\"       -2, --sslv2\\n\"\r\n\"              (SSL)  Forces  curl to use SSL version 2 when negotiating with a\\n\"\r\n\"              remote SSL server.\\n\"\r\n\"\\n\"\r\n\"       -3, --sslv3\\n\"\r\n\"              (SSL) Forces curl to use SSL version 3 when negotiating  with  a\\n\"\r\n\"              remote SSL server.\\n\"\r\n\"\\n\"\r\n\"       -4, --ipv4\\n\"\r\n\"              If  curl  is capable of resolving an address to multiple IP ver-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              sions (which it is if it is  IPv6-capable),  this  option  tells\\n\"\r\n\"              curl to resolve names to IPv4 addresses only.\\n\"\r\n\"\\n\"\r\n\"       -6, --ipv6\\n\"\r\n\"              If  curl  is capable of resolving an address to multiple IP ver-\\n\"\r\n\"              sions (which it is if it is  IPv6-capable),  this  option  tells\\n\"\r\n\"              curl to resolve names to IPv6 addresses only.\\n\"\r\n\"\\n\"\r\n\"       -a, --append\\n\"\r\n\"              (FTP/SFTP) When used in an upload, this will tell curl to append\\n\"\r\n, stdout);\r\n fputs(\r\n\"              to the target file  instead  of  overwriting  it.  If  the  file\\n\"\r\n\"              doesn't  exist,  it  will  be  created.   Note that this flag is\\n\"\r\n\"              ignored by some SSH servers (including OpenSSH).\\n\"\r\n\"\\n\"\r\n\"       -A, --user-agent <agent string>\\n\"\r\n\"              (HTTP) Specify the User-Agent string to send to the HTTP server.\\n\"\r\n\"              Some   badly   done  CGIs  fail  if  this  field  isn't  set  to\\n\"\r\n\"              \\\"Mozilla/4.0\\\". To encode blanks  in  the  string,  surround  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              string  with  single  quote marks. This can also be set with the\\n\"\r\n\"              -H, --header option of course.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --anyauth\\n\"\r\n\"              (HTTP) Tells curl to figure out authentication method by itself,\\n\"\r\n\"              and  use  the most secure one the remote site claims to support.\\n\"\r\n\"              This is done by first doing a request and checking the response-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              headers,  thus  possibly  inducing  an extra network round-trip.\\n\"\r\n\"              This is  used  instead  of  setting  a  specific  authentication\\n\"\r\n\"              method,  which  you  can  do with --basic, --digest, --ntlm, and\\n\"\r\n\"              --negotiate.\\n\"\r\n\"\\n\"\r\n\"              Note that using --anyauth is not recommended if you  do  uploads\\n\"\r\n\"              from  stdin, since it may require data to be sent twice and then\\n\"\r\n, stdout);\r\n fputs(\r\n\"              the client must be able to rewind. If the need should arise when\\n\"\r\n\"              uploading from stdin, the upload operation will fail.\\n\"\r\n\"\\n\"\r\n\"       -b, --cookie <name=data>\\n\"\r\n\"              (HTTP)  Pass the data to the HTTP server as a cookie. It is sup-\\n\"\r\n\"              posedly the data previously received from the server in a  \\\"Set-\\n\"\r\n\"              Cookie:\\\"  line.  The data should be in the format \\\"NAME1=VALUE1;\\n\"\r\n\"              NAME2=VALUE2\\\".\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If no '=' symbol is used in the line, it is treated as  a  file-\\n\"\r\n\"              name  to  use to read previously stored cookie lines from, which\\n\"\r\n\"              should be used in this session if they match. Using this  method\\n\"\r\n\"              also  activates  the \\\"cookie parser\\\" which will make curl record\\n\"\r\n\"              incoming cookies too, which may be handy if you're using this in\\n\"\r\n\"              combination  with  the -L, --location option. The file format of\\n\"\r\n, stdout);\r\n fputs(\r\n\"              the file to read cookies from should be plain  HTTP  headers  or\\n\"\r\n\"              the Netscape/Mozilla cookie file format.\\n\"\r\n\"\\n\"\r\n\"              NOTE  that  the file specified with -b, --cookie is only used as\\n\"\r\n\"              input. No cookies will be stored in the file. To store  cookies,\\n\"\r\n\"              use  the -c, --cookie-jar option or you could even save the HTTP\\n\"\r\n\"              headers to a file using -D, --dump-header!\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -B, --use-ascii\\n\"\r\n\"              (FTP/LDAP) Enable ASCII transfer. For  FTP,  this  can  also  be\\n\"\r\n\"              enforced  by  using an URL that ends with \\\";type=A\\\". This option\\n\"\r\n\"              causes data sent to stdout to be in text mode for win32 systems.\\n\"\r\n\"\\n\"\r\n\"       --basic\\n\"\r\n\"              (HTTP) Tells curl to use HTTP Basic authentication. This is  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              default  and this option is usually pointless, unless you use it\\n\"\r\n\"              to override a  previously  set  option  that  sets  a  different\\n\"\r\n\"              authentication  method  (such  as --ntlm, --digest, or --negoti-\\n\"\r\n\"              ate).\\n\"\r\n\"\\n\"\r\n\"       -c, --cookie-jar <file name>\\n\"\r\n\"              (HTTP) Specify to which file you want curl to write all  cookies\\n\"\r\n\"              after  a completed operation. Curl writes all cookies previously\\n\"\r\n, stdout);\r\n fputs(\r\n\"              read from a specified file as well as all cookies received  from\\n\"\r\n\"              remote server(s). If no cookies are known, no file will be writ-\\n\"\r\n\"              ten. The file will be written using  the  Netscape  cookie  file\\n\"\r\n\"              format.  If  you  set  the  file name to a single dash, \\\"-\\\", the\\n\"\r\n\"              cookies will be written to stdout.\\n\"\r\n\"\\n\"\r\n\"              This command line option will activate the  cookie  engine  that\\n\"\r\n, stdout);\r\n fputs(\r\n\"              makes curl record and use cookies. Another way to activate it is\\n\"\r\n\"              to use the -b, --cookie option.\\n\"\r\n\"\\n\"\r\n\"              If the cookie jar can't be created or written to, the whole curl\\n\"\r\n\"              operation  won't  fail or even report an error clearly. Using -v\\n\"\r\n\"              will get a warning displayed, but that is the only visible feed-\\n\"\r\n\"              back you get about this possibly lethal situation.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If  this  option  is used several times, the last specified file\\n\"\r\n\"              name will be used.\\n\"\r\n\"\\n\"\r\n\"       -C, --continue-at <offset>\\n\"\r\n\"              Continue/Resume a previous file transfer at  the  given  offset.\\n\"\r\n\"              The  given  offset  is  the  exact  number of bytes that will be\\n\"\r\n\"              skipped, counting from the beginning of the source  file  before\\n\"\r\n\"              it is transferred to the destination.  If used with uploads, the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              FTP server command SIZE will not be used by curl.\\n\"\r\n\"\\n\"\r\n\"              Use \\\"-C -\\\" to tell curl to automatically find out  where/how  to\\n\"\r\n\"              resume  the  transfer. It then uses the given output/input files\\n\"\r\n\"              to figure that out.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --ciphers <list of ciphers>\\n\"\r\n\"              (SSL) Specifies which ciphers to use in the connection. The list\\n\"\r\n, stdout);\r\n fputs(\r\n\"              of  ciphers  must  specify  valid ciphers. Read up on SSL cipher\\n\"\r\n\"              list          details           on           this           URL:\\n\"\r\n\"              http://www.openssl.org/docs/apps/ciphers.html\\n\"\r\n\"\\n\"\r\n\"              NSS  ciphers  are  done differently than OpenSSL and GnuTLS. The\\n\"\r\n\"              full list of NSS ciphers is in the NSSCipherSuite entry at  this\\n\"\r\n\"              URL:                                          http://git.fedora-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              hosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html#Directives\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --compressed\\n\"\r\n\"              (HTTP) Request a compressed response using one of the algorithms\\n\"\r\n\"              curl  supports,  and  save  the  uncompressed document.  If this\\n\"\r\n\"              option is used and the server  sends  an  unsupported  encoding,\\n\"\r\n\"              curl will report an error.\\n\"\r\n\"\\n\"\r\n\"       --connect-timeout <seconds>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Maximum  time  in  seconds  that you allow the connection to the\\n\"\r\n\"              server to take.  This only limits  the  connection  phase,  once\\n\"\r\n\"              curl  has  connected this option is of no more use. See also the\\n\"\r\n\"              -m, --max-time option.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --create-dirs\\n\"\r\n\"              When used in conjunction with the -o option,  curl  will  create\\n\"\r\n, stdout);\r\n fputs(\r\n\"              the  necessary  local directory hierarchy as needed. This option\\n\"\r\n\"              creates the dirs mentioned with the -o option, nothing else.  If\\n\"\r\n\"              the  -o file name uses no dir or if the dirs it mentions already\\n\"\r\n\"              exist, no dir will be created.\\n\"\r\n\"\\n\"\r\n\"              To create remote directories when using FTP or SFTP, try  --ftp-\\n\"\r\n\"              create-dirs.\\n\"\r\n\"\\n\"\r\n\"       --crlf (FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).\\n\"\r\n\"\\n\"\r\n\"       --crlfile <file>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (HTTPS/FTPS)  Provide a file using PEM format with a Certificate\\n\"\r\n\"              Revocation List that may specify peer certificates that  are  to\\n\"\r\n\"              be considered revoked.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.19.7)\\n\"\r\n\"       -d, --data <data>\\n\"\r\n\"              (HTTP)  Sends  the  specified data in a POST request to the HTTP\\n\"\r\n\"              server, in the same way that a browser  does  when  a  user  has\\n\"\r\n, stdout);\r\n fputs(\r\n\"              filled  in an HTML form and presses the submit button. This will\\n\"\r\n\"              cause curl to pass the data to the server using the content-type\\n\"\r\n\"              application/x-www-form-urlencoded.  Compare to -F, --form.\\n\"\r\n\"\\n\"\r\n\"              -d,  --data  is  the  same  as --data-ascii. To post data purely\\n\"\r\n\"              binary, you should instead use the --data-binary option. To URL-\\n\"\r\n\"              encode the value of a form field you may use --data-urlencode.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If  any of these options is used more than once on the same com-\\n\"\r\n\"              mand line, the data pieces specified  will  be  merged  together\\n\"\r\n\"              with  a  separating  &-symbol.  Thus,  using  '-d name=daniel -d\\n\"\r\n\"              skill=lousy'  would  generate  a  post  chunk  that  looks  like\\n\"\r\n\"              'name=daniel&skill=lousy'.\\n\"\r\n\"\\n\"\r\n\"              If  you  start  the data with the letter @, the rest should be a\\n\"\r\n, stdout);\r\n fputs(\r\n\"              file name to read the data from, or - if you want curl  to  read\\n\"\r\n\"              the  data  from stdin.  The contents of the file must already be\\n\"\r\n\"              URL-encoded. Multiple files can also be specified. Posting  data\\n\"\r\n\"              from  a file named 'foobar' would thus be done with --data @foo-\\n\"\r\n\"              bar.\\n\"\r\n\"\\n\"\r\n\"       -D, --dump-header <file>\\n\"\r\n\"              Write the protocol headers to the specified file.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              This option is handy to use when you want to store  the  headers\\n\"\r\n\"              that  an  HTTP site sends to you. Cookies from the headers could\\n\"\r\n\"              then be read in a  second  curl  invocation  by  using  the  -b,\\n\"\r\n\"              --cookie option! The -c, --cookie-jar option is however a better\\n\"\r\n\"              way to store cookies.\\n\"\r\n\"\\n\"\r\n\"              When used in FTP, the FTP server response lines  are  considered\\n\"\r\n\"              being \\\"headers\\\" and thus are saved there.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --data-ascii <data>\\n\"\r\n\"              See -d, --data.\\n\"\r\n\"\\n\"\r\n\"       --data-binary <data>\\n\"\r\n\"              (HTTP)  This  posts data exactly as specified with no extra pro-\\n\"\r\n\"              cessing whatsoever.\\n\"\r\n\"\\n\"\r\n\"              If you start the data with the letter @, the rest  should  be  a\\n\"\r\n\"              filename.   Data  is  posted in a similar manner as --data-ascii\\n\"\r\n, stdout);\r\n fputs(\r\n\"              does, except that newlines are  preserved  and  conversions  are\\n\"\r\n\"              never done.\\n\"\r\n\"\\n\"\r\n\"              If  this  option  is  used several times, the ones following the\\n\"\r\n\"              first will append data as described in -d, --data.\\n\"\r\n\"\\n\"\r\n\"       --data-urlencode <data>\\n\"\r\n\"              (HTTP) This posts data, similar to the other --data options with\\n\"\r\n\"              the exception that this performs URL-encoding. (Added in 7.18.0)\\n\"\r\n, stdout);\r\n fputs(\r\n\"              To  be  CGI-compliant,  the <data> part should begin with a name\\n\"\r\n\"              followed by a separator and a content specification. The  <data>\\n\"\r\n\"              part can be passed to curl using one of the following syntaxes:\\n\"\r\n\"\\n\"\r\n\"              content\\n\"\r\n\"                     This  will make curl URL-encode the content and pass that\\n\"\r\n\"                     on. Just be careful so that the content  doesn't  contain\\n\"\r\n\"                     any  =  or  @  symbols, as that will then make the syntax\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     match one of the other cases below!\\n\"\r\n\"\\n\"\r\n\"              =content\\n\"\r\n\"                     This will make curl URL-encode the content and pass  that\\n\"\r\n\"                     on. The preceding = symbol is not included in the data.\\n\"\r\n\"\\n\"\r\n\"              name=content\\n\"\r\n\"                     This  will make curl URL-encode the content part and pass\\n\"\r\n\"                     that on. Note that the name part is expected to  be  URL-\\n\"\r\n\"                     encoded already.\\n\"\r\n\"\\n\"\r\n\"              @filename\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     This  will  make  curl  load  data  from  the  given file\\n\"\r\n\"                     (including any newlines), URL-encode that data  and  pass\\n\"\r\n\"                     it on in the POST.\\n\"\r\n\"\\n\"\r\n\"              name@filename\\n\"\r\n\"                     This  will  make  curl  load  data  from  the  given file\\n\"\r\n\"                     (including any newlines), URL-encode that data  and  pass\\n\"\r\n\"                     it  on  in  the  POST.  The  name part gets an equal sign\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     appended, resulting in name=urlencoded-file-content. Note\\n\"\r\n\"                     that the name is expected to be URL-encoded already.\\n\"\r\n\"\\n\"\r\n\"       --delegation LEVEL\\n\"\r\n\"              Set LEVEL to tell the server what it is allowed to delegate when\\n\"\r\n\"              it comes to user credentials. Used with GSS/kerberos.\\n\"\r\n\"\\n\"\r\n\"              none   Don't allow any delegation.\\n\"\r\n\"\\n\"\r\n\"              policy Delegates if and only if the OK-AS-DELEGATE flag  is  set\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     in  the  Kerberos  service  ticket,  which is a matter of\\n\"\r\n\"                     realm policy.\\n\"\r\n\"\\n\"\r\n\"              always Unconditionally allow the server to delegate.\\n\"\r\n\"\\n\"\r\n\"       --digest\\n\"\r\n\"              (HTTP) Enables HTTP Digest authentication. This is an  authenti-\\n\"\r\n\"              cation  scheme  that  prevents the password from being sent over\\n\"\r\n\"              the wire in clear text. Use this in combination with the  normal\\n\"\r\n, stdout);\r\n fputs(\r\n\"              -u,  --user  option  to  set  user  name  and password. See also\\n\"\r\n\"              --ntlm, --negotiate and --anyauth for related options.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times,  only  the  first  one  is\\n\"\r\n\"              used.\\n\"\r\n\"\\n\"\r\n\"       --disable-eprt\\n\"\r\n\"              (FTP) Tell curl to disable the use of the EPRT and LPRT commands\\n\"\r\n\"              when doing active FTP transfers. Curl will normally always first\\n\"\r\n, stdout);\r\n fputs(\r\n\"              attempt  to use EPRT, then LPRT before using PORT, but with this\\n\"\r\n\"              option, it will use PORT right away. EPRT and  LPRT  are  exten-\\n\"\r\n\"              sions  to  the  original  FTP  protocol, and may not work on all\\n\"\r\n\"              servers, but they enable more functionality in a better way than\\n\"\r\n\"              the traditional PORT command.\\n\"\r\n\"\\n\"\r\n\"              --eprt can be used to explicitly enable EPRT again and --no-eprt\\n\"\r\n\"              is an alias for --disable-eprt.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Disabling EPRT only changes the active behavior. If you want  to\\n\"\r\n\"              switch  to  passive  mode  you need to not use -P, --ftp-port or\\n\"\r\n\"              force it with --ftp-pasv.\\n\"\r\n\"\\n\"\r\n\"       --disable-epsv\\n\"\r\n\"              (FTP) Tell curl to disable the use  of  the  EPSV  command  when\\n\"\r\n\"              doing  passive  FTP  transfers.  Curl will normally always first\\n\"\r\n\"              attempt to use EPSV before PASV, but with this option,  it  will\\n\"\r\n\"              not try using EPSV.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              --epsv can be used to explicitly enable EPSV again and --no-epsv\\n\"\r\n\"              is an alias for --disable-epsv.\\n\"\r\n\"\\n\"\r\n\"              Disabling EPSV only changes the passive behavior. If you want to\\n\"\r\n\"              switch to active mode you need to use -P, --ftp-port.\\n\"\r\n\"\\n\"\r\n\"       -e, --referer <URL>\\n\"\r\n\"              (HTTP)  Sends the \\\"Referer Page\\\" information to the HTTP server.\\n\"\r\n\"              This can also be set with the -H, --header flag of course.  When\\n\"\r\n, stdout);\r\n fputs(\r\n\"              used with -L, --location you can append \\\";auto\\\" to the --referer\\n\"\r\n\"              URL to make curl automatically set the previous URL when it fol-\\n\"\r\n\"              lows  a  Location: header. The \\\";auto\\\" string can be used alone,\\n\"\r\n\"              even if you don't set an initial --referer.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -E, --cert <certificate[:password]>\\n\"\r\n\"              (SSL) Tells curl to use the specified  client  certificate  file\\n\"\r\n, stdout);\r\n fputs(\r\n\"              when getting a file with HTTPS, FTPS or another SSL-based proto-\\n\"\r\n\"              col. The certificate must be in PEM  format.   If  the  optional\\n\"\r\n\"              password  isn't  specified, it will be queried for on the termi-\\n\"\r\n\"              nal. Note that this option assumes a \\\"certificate\\\" file that  is\\n\"\r\n\"              the  private  key  and the private certificate concatenated! See\\n\"\r\n\"              --cert and --key to specify them independently.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If curl is built against the NSS SSL library  then  this  option\\n\"\r\n\"              can  tell curl the nickname of the certificate to use within the\\n\"\r\n\"              NSS database defined by the environment variable SSL_DIR (or  by\\n\"\r\n\"              default  /etc/pki/nssdb).  If  the  NSS PEM PKCS#11 module (lib-\\n\"\r\n\"              nsspem.so) is available then PEM files may  be  loaded.  If  you\\n\"\r\n\"              want to use a file from the current directory, please precede it\\n\"\r\n, stdout);\r\n fputs(\r\n\"              with \\\"./\\\" prefix, in order to avoid confusion with a nickname.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --engine <name>\\n\"\r\n\"              Select the OpenSSL crypto engine to use for  cipher  operations.\\n\"\r\n\"              Use  --engine  list  to  print  a  list  of build-time supported\\n\"\r\n\"              engines. Note that not all (or  none)  of  the  engines  may  be\\n\"\r\n\"              available at run-time.\\n\"\r\n\"\\n\"\r\n\"       --environment\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (RISC  OS ONLY) Sets a range of environment variables, using the\\n\"\r\n\"              names the -w option supports, to allow easier extraction of use-\\n\"\r\n\"              ful information after having run curl.\\n\"\r\n\"\\n\"\r\n\"       --egd-file <file>\\n\"\r\n\"              (SSL)  Specify  the  path  name  to the Entropy Gathering Daemon\\n\"\r\n\"              socket. The socket is used to seed the  random  engine  for  SSL\\n\"\r\n\"              connections. See also the --random-file option.\\n\"\r\n\"\\n\"\r\n\"       --cert-type <type>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (SSL)  Tells curl what certificate type the provided certificate\\n\"\r\n\"              is in. PEM, DER and ENG are recognized types.  If not specified,\\n\"\r\n\"              PEM is assumed.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --cacert <CA certificate>\\n\"\r\n\"              (SSL) Tells curl to use the specified certificate file to verify\\n\"\r\n\"              the peer. The file may contain  multiple  CA  certificates.  The\\n\"\r\n, stdout);\r\n fputs(\r\n\"              certificate(s)  must be in PEM format. Normally curl is built to\\n\"\r\n\"              use a default file for this, so this option is typically used to\\n\"\r\n\"              alter that default file.\\n\"\r\n\"\\n\"\r\n\"              curl  recognizes the environment variable named 'CURL_CA_BUNDLE'\\n\"\r\n\"              if it is set, and uses the given path as a path  to  a  CA  cert\\n\"\r\n\"              bundle. This option overrides that variable.\\n\"\r\n\"\\n\"\r\n\"              The  windows  version  of  curl will automatically look for a CA\\n\"\r\n, stdout);\r\n fputs(\r\n\"              certs file named 'curl-ca-bundle.crt', either in the same direc-\\n\"\r\n\"              tory as curl.exe, or in the Current Working Directory, or in any\\n\"\r\n\"              folder along your PATH.\\n\"\r\n\"\\n\"\r\n\"              If curl is built against  the  NSS  SSL  library,  the  NSS  PEM\\n\"\r\n\"              PKCS#11  module  (libnsspem.so)  needs  to be available for this\\n\"\r\n\"              option to work properly.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       --capath <CA certificate directory>\\n\"\r\n\"              (SSL) Tells curl to use the specified certificate  directory  to\\n\"\r\n\"              verify  the  peer.  Multiple paths can be provided by separating\\n\"\r\n\"              them with \\\":\\\" (e.g.  \\\"path1:path2:path3\\\"). The certificates must\\n\"\r\n\"              be  in  PEM  format,  and  if curl is built against OpenSSL, the\\n\"\r\n\"              directory must have been processed using  the  c_rehash  utility\\n\"\r\n, stdout);\r\n fputs(\r\n\"              supplied  with OpenSSL. Using --capath can allow OpenSSL-powered\\n\"\r\n\"              curl to make SSL-connections much more  efficiently  than  using\\n\"\r\n\"              --cacert if the --cacert file contains many CA certificates.\\n\"\r\n\"\\n\"\r\n\"              If this option is set, the default capath value will be ignored,\\n\"\r\n\"              and if it is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -f, --fail\\n\"\r\n\"              (HTTP) Fail silently (no output at all) on server  errors.  This\\n\"\r\n, stdout);\r\n fputs(\r\n\"              is  mostly done to better enable scripts etc to better deal with\\n\"\r\n\"              failed attempts. In normal cases when an HTTP  server  fails  to\\n\"\r\n\"              deliver  a  document,  it  returns  an  HTML document stating so\\n\"\r\n\"              (which often also describes why and more). This flag  will  pre-\\n\"\r\n\"              vent curl from outputting that and return error 22.\\n\"\r\n\"\\n\"\r\n\"              This  method is not fail-safe and there are occasions where non-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              successful response codes will  slip  through,  especially  when\\n\"\r\n\"              authentication is involved (response codes 401 and 407).\\n\"\r\n\"\\n\"\r\n\"       -F, --form <name=content>\\n\"\r\n\"              (HTTP)  This  lets curl emulate a filled-in form in which a user\\n\"\r\n\"              has pressed the submit button. This causes  curl  to  POST  data\\n\"\r\n\"              using  the  Content-Type  multipart/form-data  according  to RFC\\n\"\r\n\"              2388. This enables uploading of binary files etc. To  force  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              'content'  part  to  be  a  file, prefix the file name with an @\\n\"\r\n\"              sign. To just get the content part from a file, prefix the  file\\n\"\r\n\"              name  with  the symbol <. The difference between @ and < is then\\n\"\r\n\"              that @ makes a file get attached in the post as a  file  upload,\\n\"\r\n\"              while  the  <  makes  a text field and just get the contents for\\n\"\r\n\"              that text field from a file.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Example, to send your password file to the server, where  'pass-\\n\"\r\n\"              word' is the name of the form-field to which /etc/passwd will be\\n\"\r\n\"              the input:\\n\"\r\n\"\\n\"\r\n\"              curl -F password=@/etc/passwd www.mypasswords.com\\n\"\r\n\"\\n\"\r\n\"              To read content from stdin instead of a file, use - as the file-\\n\"\r\n\"              name. This goes for both @ and < constructs.\\n\"\r\n\"\\n\"\r\n\"              You  can  also  tell  curl  what  Content-Type  to  use by using\\n\"\r\n, stdout);\r\n fputs(\r\n\"              'type=', in a manner similar to:\\n\"\r\n\"\\n\"\r\n\"              curl -F \\\"web=@index.html;type=text/html\\\" url.com\\n\"\r\n\"\\n\"\r\n\"              or\\n\"\r\n\"\\n\"\r\n\"              curl -F \\\"name=daniel;type=text/foo\\\" url.com\\n\"\r\n\"\\n\"\r\n\"              You can also explicitly change the name field of a  file  upload\\n\"\r\n\"              part by setting filename=, like this:\\n\"\r\n\"\\n\"\r\n\"              curl -F \\\"file=@localfile;filename=nameinpost\\\" url.com\\n\"\r\n\"\\n\"\r\n\"              If  filename/path contains ',' or ';', it must be quoted by dou-\\n\"\r\n\"              ble-quotes like:\\n\"\r\n, stdout);\r\n fputs(\r\n\"\\n\"\r\n\"              curl -F \\\"file=@\\\\\\\"localfile\\\\\\\";filename=\\\\\\\"nameinpost\\\\\\\"\\\" url.com\\n\"\r\n\"\\n\"\r\n\"              or\\n\"\r\n\"\\n\"\r\n\"              curl -F 'file=@\\\"localfile\\\";filename=\\\"nameinpost\\\"' url.com\\n\"\r\n\"\\n\"\r\n\"              Note that if a filename/path is  quoted  by  double-quotes,  any\\n\"\r\n\"              double-quote or backslash within the filename must be escaped by\\n\"\r\n\"              backslash.\\n\"\r\n\"\\n\"\r\n\"              See further examples and details in the MANUAL.\\n\"\r\n\"\\n\"\r\n\"              This option can be used multiple times.\\n\"\r\n\"\\n\"\r\n\"       --ftp-account [data]\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (FTP) When an FTP server asks for \\\"account data\\\" after user name\\n\"\r\n\"              and  password has been provided, this data is sent off using the\\n\"\r\n\"              ACCT command. (Added in 7.13.0)\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --ftp-alternative-to-user <command>\\n\"\r\n\"              (FTP) If authenticating with the USER and PASS  commands  fails,\\n\"\r\n\"              send  this  command.   When  connecting  to  Tumbleweed's Secure\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Transport server over FTPS using  a  client  certificate,  using\\n\"\r\n\"              \\\"SITE  AUTH\\\"  will tell the server to retrieve the username from\\n\"\r\n\"              the certificate. (Added in 7.15.5)\\n\"\r\n\"\\n\"\r\n\"       --ftp-create-dirs\\n\"\r\n\"              (FTP/SFTP) When an FTP or SFTP URL/operation uses  a  path  that\\n\"\r\n\"              doesn't  currently exist on the server, the standard behavior of\\n\"\r\n\"              curl is to fail. Using this option, curl will instead attempt to\\n\"\r\n, stdout);\r\n fputs(\r\n\"              create missing directories.\\n\"\r\n\"\\n\"\r\n\"       --ftp-method [method]\\n\"\r\n\"              (FTP)  Control what method curl should use to reach a file on an\\n\"\r\n\"              FTP(S) server. The method argument should be one of the  follow-\\n\"\r\n\"              ing alternatives:\\n\"\r\n\"\\n\"\r\n\"              multicwd\\n\"\r\n\"                     curl  does  a  single CWD operation for each path part in\\n\"\r\n\"                     the given URL. For deep hierarchies this means very  many\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     commands.  This  is  how RFC 1738 says it should be done.\\n\"\r\n\"                     This is the default but the slowest behavior.\\n\"\r\n\"\\n\"\r\n\"              nocwd  curl does no CWD at all. curl will do  SIZE,  RETR,  STOR\\n\"\r\n\"                     etc and give a full path to the server for all these com-\\n\"\r\n\"                     mands. This is the fastest behavior.\\n\"\r\n\"\\n\"\r\n\"              singlecwd\\n\"\r\n\"                     curl does one CWD with the full target directory and then\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     operates  on  the  file  \\\"normally\\\" (like in the multicwd\\n\"\r\n\"                     case). This is somewhat  more  standards  compliant  than\\n\"\r\n\"                     'nocwd' but without the full penalty of 'multicwd'.\\n\"\r\n\"       (Added in 7.15.1)\\n\"\r\n\"\\n\"\r\n\"       --ftp-pasv\\n\"\r\n\"              (FTP)  Use  passive mode for the data connection. Passive is the\\n\"\r\n\"              internal default behavior, but using this option can be used  to\\n\"\r\n, stdout);\r\n fputs(\r\n\"              override a previous -P/-ftp-port option. (Added in 7.11.0)\\n\"\r\n\"\\n\"\r\n\"              If  this  option  is  used  several times, only the first one is\\n\"\r\n\"              used. Undoing an enforced passive really isn't  doable  but  you\\n\"\r\n\"              must then instead enforce the correct -P, --ftp-port again.\\n\"\r\n\"\\n\"\r\n\"              Passive mode means that curl will try the EPSV command first and\\n\"\r\n\"              then PASV, unless --disable-epsv is used.\\n\"\r\n\"\\n\"\r\n\"       --ftp-skip-pasv-ip\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (FTP) Tell curl to not use the IP address the server suggests in\\n\"\r\n\"              its  response to curl's PASV command when curl connects the data\\n\"\r\n\"              connection. Instead curl will re-use  the  same  IP  address  it\\n\"\r\n\"              already uses for the control connection. (Added in 7.14.2)\\n\"\r\n\"\\n\"\r\n\"              This  option has no effect if PORT, EPRT or EPSV is used instead\\n\"\r\n\"              of PASV.\\n\"\r\n\"\\n\"\r\n\"       --ftp-pret\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (FTP) Tell curl to send a PRET command before PASV  (and  EPSV).\\n\"\r\n\"              Certain  FTP  servers,  mainly drftpd, require this non-standard\\n\"\r\n\"              command for directory listings as well as up  and  downloads  in\\n\"\r\n\"              PASV mode.  (Added in 7.20.x)\\n\"\r\n\"\\n\"\r\n\"       --ftp-ssl-ccc\\n\"\r\n\"              (FTP)  Use  CCC  (Clear  Command Channel) Shuts down the SSL/TLS\\n\"\r\n\"              layer after authenticating. The rest of the control channel com-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              munication  will be unencrypted. This allows NAT routers to fol-\\n\"\r\n\"              low the FTP transaction. The default mode is passive. See --ftp-\\n\"\r\n\"              ssl-ccc-mode for other modes.  (Added in 7.16.1)\\n\"\r\n\"\\n\"\r\n\"       --ftp-ssl-ccc-mode [active/passive]\\n\"\r\n\"              (FTP)  Use  CCC  (Clear  Command Channel) Sets the CCC mode. The\\n\"\r\n\"              passive mode will not initiate the shutdown,  but  instead  wait\\n\"\r\n, stdout);\r\n fputs(\r\n\"              for the server to do it, and will not reply to the shutdown from\\n\"\r\n\"              the server. The active mode initiates the shutdown and waits for\\n\"\r\n\"              a reply from the server.  (Added in 7.16.2)\\n\"\r\n\"\\n\"\r\n\"       --ftp-ssl-control\\n\"\r\n\"              (FTP)  Require  SSL/TLS  for  the FTP login, clear for transfer.\\n\"\r\n\"              Allows secure authentication, but non-encrypted  data  transfers\\n\"\r\n\"              for  efficiency.   Fails the transfer if the server doesn't sup-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              port SSL/TLS.  (Added in 7.16.0) that can still be used but will\\n\"\r\n\"              be removed in a future version.\\n\"\r\n\"\\n\"\r\n\"       --form-string <name=string>\\n\"\r\n\"              (HTTP)  Similar  to  --form except that the value string for the\\n\"\r\n\"              named parameter is used literally. Leading '@' and  '<'  charac-\\n\"\r\n\"              ters, and the ';type=' string in the value have no special mean-\\n\"\r\n\"              ing. Use this in preference to --form if there's any possibility\\n\"\r\n, stdout);\r\n fputs(\r\n\"              that  the  string  value may accidentally trigger the '@' or '<'\\n\"\r\n\"              features of --form.\\n\"\r\n\"\\n\"\r\n\"       -g, --globoff\\n\"\r\n\"              This option switches off the \\\"URL globbing parser\\\". When you set\\n\"\r\n\"              this  option, you can specify URLs that contain the letters {}[]\\n\"\r\n\"              without having them being interpreted by curl itself. Note  that\\n\"\r\n\"              these  letters are not normal legal URL contents but they should\\n\"\r\n, stdout);\r\n fputs(\r\n\"              be encoded according to the URI standard.\\n\"\r\n\"\\n\"\r\n\"       -G, --get\\n\"\r\n\"              When used, this option will make all  data  specified  with  -d,\\n\"\r\n\"              --data  or  --data-binary  to  be  used  in  an HTTP GET request\\n\"\r\n\"              instead of the POST request that otherwise would  be  used.  The\\n\"\r\n\"              data will be appended to the URL with a '?' separator.\\n\"\r\n\"\\n\"\r\n\"              If  used  in  combination with -I, the POST data will instead be\\n\"\r\n, stdout);\r\n fputs(\r\n\"              appended to the URL with a HEAD request.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times,  only  the  first  one  is\\n\"\r\n\"              used.  This is because undoing a GET doesn't make sense, but you\\n\"\r\n\"              should then instead enforce the alternative method you prefer.\\n\"\r\n\"\\n\"\r\n\"       -H, --header <header>\\n\"\r\n\"              (HTTP) Extra header to use when getting  a  web  page.  You  may\\n\"\r\n\"              specify any number of extra headers. Note that if you should add\\n\"\r\n, stdout);\r\n fputs(\r\n\"              a custom header that has the same name as one  of  the  internal\\n\"\r\n\"              ones  curl  would  use,  your externally set header will be used\\n\"\r\n\"              instead of the internal one. This allows you to make even trick-\\n\"\r\n\"              ier  stuff  than  curl would normally do. You should not replace\\n\"\r\n\"              internally set  headers  without  knowing  perfectly  well  what\\n\"\r\n\"              you're  doing. Remove an internal header by giving a replacement\\n\"\r\n, stdout);\r\n fputs(\r\n\"              without content on the right  side  of  the  colon,  as  in:  -H\\n\"\r\n\"              \\\"Host:\\\".  If  you  send the custom header with no-value then its\\n\"\r\n\"              header must be terminated with a semicolon, such as  -H  \\\"X-Cus-\\n\"\r\n\"              tom-Header;\\\" to send \\\"X-Custom-Header:\\\".\\n\"\r\n\"\\n\"\r\n\"              curl  will  make  sure  that each header you add/replace is sent\\n\"\r\n\"              with the proper end-of-line marker, you should thus not add that\\n\"\r\n, stdout);\r\n fputs(\r\n\"              as a part of the header content: do not add newlines or carriage\\n\"\r\n\"              returns, they will only mess things up for you.\\n\"\r\n\"\\n\"\r\n\"              See also the -A, --user-agent and -e, --referer options.\\n\"\r\n\"\\n\"\r\n\"              This option can be used  multiple  times  to  add/replace/remove\\n\"\r\n\"              multiple headers.\\n\"\r\n\"\\n\"\r\n\"       --hostpubmd5 <md5>\\n\"\r\n\"              (SCP/SFTP)  Pass  a string containing 32 hexadecimal digits. The\\n\"\r\n, stdout);\r\n fputs(\r\n\"              string should be the 128 bit MD5 checksum of the  remote  host's\\n\"\r\n\"              public key, curl will refuse the connection with the host unless\\n\"\r\n\"              the md5sums match. (Added in 7.17.1)\\n\"\r\n\"\\n\"\r\n\"       --ignore-content-length\\n\"\r\n\"              (HTTP) Ignore the Content-Length header.  This  is  particularly\\n\"\r\n\"              useful  for servers running Apache 1.x, which will report incor-\\n\"\r\n\"              rect Content-Length for files larger than 2 gigabytes.\\n\"\r\n\"\\n\"\r\n\"       -i, --include\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (HTTP) Include the HTTP-header in the  output.  The  HTTP-header\\n\"\r\n\"              includes  things  like  server-name, date of the document, HTTP-\\n\"\r\n\"              version and more...\\n\"\r\n\"\\n\"\r\n\"       -I, --head\\n\"\r\n\"              (HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature\\n\"\r\n\"              the  command  HEAD which this uses to get nothing but the header\\n\"\r\n\"              of a document. When used on an FTP or FILE file,  curl  displays\\n\"\r\n, stdout);\r\n fputs(\r\n\"              the file size and last modification time only.\\n\"\r\n\"\\n\"\r\n\"       --interface <name>\\n\"\r\n\"              Perform  an operation using a specified interface. You can enter\\n\"\r\n\"              interface name, IP address or host name. An example  could  look\\n\"\r\n\"              like:\\n\"\r\n\"\\n\"\r\n\"               curl --interface eth0:1 http://www.netscape.com/\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -j, --junk-session-cookies\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (HTTP) When curl is told to read cookies from a given file, this\\n\"\r\n\"              option will make it discard all  \\\"session  cookies\\\".  This  will\\n\"\r\n\"              basically  have  the same effect as if a new session is started.\\n\"\r\n\"              Typical browsers always discard  session  cookies  when  they're\\n\"\r\n\"              closed down.\\n\"\r\n\"\\n\"\r\n\"       -J, --remote-header-name\\n\"\r\n\"              (HTTP) This option tells the -O, --remote-name option to use the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              server-specified   Content-Disposition   filename   instead   of\\n\"\r\n\"              extracting a filename from the URL.\\n\"\r\n\"\\n\"\r\n\"       -k, --insecure\\n\"\r\n\"              (SSL)  This  option explicitly allows curl to perform \\\"insecure\\\"\\n\"\r\n\"              SSL connections and transfers. All SSL connections are attempted\\n\"\r\n\"              to  be  made secure by using the CA certificate bundle installed\\n\"\r\n\"              by default. This makes  all  connections  considered  \\\"insecure\\\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              fail unless -k, --insecure is used.\\n\"\r\n\"\\n\"\r\n\"              See     this    online    resource    for    further    details:\\n\"\r\n\"              http://curl.haxx.se/docs/sslcerts.html\\n\"\r\n\"\\n\"\r\n\"       -K, --config <config file>\\n\"\r\n\"              Specify which config file to read curl arguments from. The  con-\\n\"\r\n\"              fig  file  is a text file in which command line arguments can be\\n\"\r\n\"              written which then will be used as if they were written  on  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              actual command line. Options and their parameters must be speci-\\n\"\r\n\"              fied on the same config  file  line,  separated  by  whitespace,\\n\"\r\n\"              colon,  the equals sign or any combination thereof (however, the\\n\"\r\n\"              preferred separator is the equals sign). If the parameter is  to\\n\"\r\n\"              contain  whitespace,  the  parameter  must  be  enclosed  within\\n\"\r\n\"              quotes. Within double quotes, the following escape sequences are\\n\"\r\n, stdout);\r\n fputs(\r\n\"              available:  \\\\\\\\, \\\\\\\", \\\\t, \\\\n, \\\\r and \\\\v. A backslash preceding any\\n\"\r\n\"              other letter is ignored. If the first column of a config line is\\n\"\r\n\"              a  '#' character, the rest of the line will be treated as a com-\\n\"\r\n\"              ment. Only write one option per  physical  line  in  the  config\\n\"\r\n\"              file.\\n\"\r\n\"\\n\"\r\n\"              Specify  the  filename  to -K, --config as '-' to make curl read\\n\"\r\n\"              the file from stdin.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Note that to be able to specify a URL in the  config  file,  you\\n\"\r\n\"              need  to  specify  it  using the --url option, and not by simply\\n\"\r\n\"              writing the URL on its own line. So, it could  look  similar  to\\n\"\r\n\"              this:\\n\"\r\n\"\\n\"\r\n\"              url = \\\"http://curl.haxx.se/docs/\\\"\\n\"\r\n\"\\n\"\r\n\"              Long  option  names  can  optionally be given in the config file\\n\"\r\n\"              without the initial double dashes.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              When curl is invoked, it always (unless -q is used) checks for a\\n\"\r\n\"              default  config  file  and  uses it if found. The default config\\n\"\r\n\"              file is checked for in the following places in this order:\\n\"\r\n\"\\n\"\r\n\"              1) curl tries to find the \\\"home dir\\\": It first  checks  for  the\\n\"\r\n\"              CURL_HOME and then the HOME environment variables. Failing that,\\n\"\r\n\"              it uses getpwuid() on UNIX-like systems (which returns the  home\\n\"\r\n, stdout);\r\n fputs(\r\n\"              dir  given the current user in your system). On Windows, it then\\n\"\r\n\"              checks for the APPDATA variable, or as a last resort the '%USER-\\n\"\r\n\"              PROFILE%\\\\Application Data'.\\n\"\r\n\"\\n\"\r\n\"              2)  On  windows, if there is no _curlrc file in the home dir, it\\n\"\r\n\"              checks for one in the same dir the curl executable is placed. On\\n\"\r\n\"              UNIX-like  systems,  it will simply try to load .curlrc from the\\n\"\r\n\"              determined home dir.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              # --- Example file ---\\n\"\r\n\"              # this is a comment\\n\"\r\n\"              url = \\\"curl.haxx.se\\\"\\n\"\r\n\"              output = \\\"curlhere.html\\\"\\n\"\r\n\"              user-agent = \\\"superagent/1.0\\\"\\n\"\r\n\"\\n\"\r\n\"              # and fetch another URL too\\n\"\r\n\"              url = \\\"curl.haxx.se/docs/manpage.html\\\"\\n\"\r\n\"              -O\\n\"\r\n\"              referer = \\\"http://nowhereatall.com/\\\"\\n\"\r\n\"              # --- End of example file ---\\n\"\r\n\"\\n\"\r\n\"              This option can be used multiple times to load  multiple  config\\n\"\r\n\"              files.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       --keepalive-time <seconds>\\n\"\r\n\"              This  option  sets  the  time  a connection needs to remain idle\\n\"\r\n\"              before sending keepalive probes and the time between  individual\\n\"\r\n\"              keepalive probes. It is currently effective on operating systems\\n\"\r\n\"              offering  the  TCP_KEEPIDLE  and  TCP_KEEPINTVL  socket  options\\n\"\r\n\"              (meaning  Linux, recent AIX, HP-UX and more). This option has no\\n\"\r\n\"              effect if --no-keepalive is used. (Added in 7.18.0)\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"              If unspecified, the option defaults to 60 seconds.\\n\"\r\n\"\\n\"\r\n\"       --key <key>\\n\"\r\n\"              (SSL/SSH) Private key file name. Allows you to provide your pri-\\n\"\r\n\"              vate key in this separate file.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --key-type <type>\\n\"\r\n\"              (SSL) Private key file type. Specify which type your --key  pro-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              vided  private  key  is. DER, PEM, and ENG are supported. If not\\n\"\r\n\"              specified, PEM is assumed.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --krb <level>\\n\"\r\n\"              (FTP) Enable Kerberos authentication and use. The level must  be\\n\"\r\n\"              entered and should be one of 'clear', 'safe', 'confidential', or\\n\"\r\n\"              'private'. Should you use a level that  is  not  one  of  these,\\n\"\r\n, stdout);\r\n fputs(\r\n\"              'private' will instead be used.\\n\"\r\n\"\\n\"\r\n\"              This  option  requires  a library built with kerberos4 or GSSAPI\\n\"\r\n\"              (GSS-Negotiate) support. This is not very common. Use -V, --ver-\\n\"\r\n\"              sion to see if your curl supports it.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -l, --list-only\\n\"\r\n\"              (FTP)  When listing an FTP directory, this switch forces a name-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              only view.  Especially useful if you want to  machine-parse  the\\n\"\r\n\"              contents  of  an  FTP  directory since the normal directory view\\n\"\r\n\"              doesn't use a standard look or format.\\n\"\r\n\"\\n\"\r\n\"              This option causes an FTP NLST command to  be  sent.   Some  FTP\\n\"\r\n\"              servers  list  only files in their response to NLST; they do not\\n\"\r\n\"              include subdirectories and symbolic links.\\n\"\r\n\"\\n\"\r\n\"       -L, --location\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (HTTP/HTTPS) If the server reports that the requested  page  has\\n\"\r\n\"              moved to a different location (indicated with a Location: header\\n\"\r\n\"              and a 3XX response code), this option will make  curl  redo  the\\n\"\r\n\"              request on the new place. If used together with -i, --include or\\n\"\r\n\"              -I, --head, headers from all requested pages will be shown. When\\n\"\r\n\"              authentication  is  used, curl only sends its credentials to the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              initial host. If a redirect takes curl to a different  host,  it\\n\"\r\n\"              won't  be  able to intercept the user+password. See also --loca-\\n\"\r\n\"              tion-trusted on how to change this. You can limit the amount  of\\n\"\r\n\"              redirects to follow by using the --max-redirs option.\\n\"\r\n\"\\n\"\r\n\"              When  curl follows a redirect and the request is not a plain GET\\n\"\r\n\"              (for example POST or PUT), it will do the following request with\\n\"\r\n, stdout);\r\n fputs(\r\n\"              a GET if the HTTP response was 301, 302, or 303. If the response\\n\"\r\n\"              code was any other 3xx code, curl  will  re-send  the  following\\n\"\r\n\"              request using the same unmodified method.\\n\"\r\n\"\\n\"\r\n\"       --libcurl <file>\\n\"\r\n\"              Append  this  option  to any ordinary curl command line, and you\\n\"\r\n\"              will get a libcurl-using C source code written to the file  that\\n\"\r\n\"              does the equivalent of what your command-line operation does!\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If  this  option is used several times, the last given file name\\n\"\r\n\"              will be used. (Added in 7.16.1)\\n\"\r\n\"\\n\"\r\n\"       --limit-rate <speed>\\n\"\r\n\"              Specify the maximum transfer rate you want  curl  to  use.  This\\n\"\r\n\"              feature is useful if you have a limited pipe and you'd like your\\n\"\r\n\"              transfer not to use your entire bandwidth.\\n\"\r\n\"\\n\"\r\n\"              The given speed is measured in bytes/second, unless a suffix  is\\n\"\r\n, stdout);\r\n fputs(\r\n\"              appended.   Appending  'k' or 'K' will count the number as kilo-\\n\"\r\n\"              bytes, 'm' or M' makes it megabytes, while 'g' or 'G'  makes  it\\n\"\r\n\"              gigabytes. Examples: 200K, 3m and 1G.\\n\"\r\n\"\\n\"\r\n\"              The  given  rate  is the average speed counted during the entire\\n\"\r\n\"              transfer. It means that curl might use higher transfer speeds in\\n\"\r\n\"              short bursts, but over time it uses no more than the given rate.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If  you  also use the -Y, --speed-limit option, that option will\\n\"\r\n\"              take precedence and might cripple the rate-limiting slightly, to\\n\"\r\n\"              help keeping the speed-limit logic working.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --local-port <num>[-num]\\n\"\r\n\"              Set a preferred number or range of local port numbers to use for\\n\"\r\n\"              the connection(s).  Note that  port  numbers  by  nature  are  a\\n\"\r\n, stdout);\r\n fputs(\r\n\"              scarce resource that will be busy at times so setting this range\\n\"\r\n\"              to something too narrow might cause unnecessary connection setup\\n\"\r\n\"              failures. (Added in 7.15.2)\\n\"\r\n\"\\n\"\r\n\"       --location-trusted\\n\"\r\n\"              (HTTP/HTTPS)  Like  -L,  --location,  but will allow sending the\\n\"\r\n\"              name + password to all hosts that the site may redirect to. This\\n\"\r\n\"              may or may not introduce a security breach if the site redirects\\n\"\r\n, stdout);\r\n fputs(\r\n\"              you to a site to which  you'll  send  your  authentication  info\\n\"\r\n\"              (which is plaintext in the case of HTTP Basic authentication).\\n\"\r\n\"\\n\"\r\n\"       -m, --max-time <seconds>\\n\"\r\n\"              Maximum  time  in  seconds that you allow the whole operation to\\n\"\r\n\"              take.  This is useful for preventing your batch jobs from  hang-\\n\"\r\n\"              ing  for  hours  due  to slow networks or links going down.  See\\n\"\r\n\"              also the --connect-timeout option.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --mail-auth <address>\\n\"\r\n\"              (SMTP) Specify a single address. This will be  used  to  specify\\n\"\r\n\"              the  authentication  address  (identity)  of a submitted message\\n\"\r\n\"              that is being relayed to another server.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.25.0)\\n\"\r\n\"\\n\"\r\n\"       --mail-from <address>\\n\"\r\n\"              (SMTP) Specify a single address that the given mail  should  get\\n\"\r\n\"              sent from.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (Added in 7.20.0)\\n\"\r\n\"\\n\"\r\n\"       --max-filesize <bytes>\\n\"\r\n\"              Specify  the  maximum  size (in bytes) of a file to download. If\\n\"\r\n\"              the file requested is larger than this value, the transfer  will\\n\"\r\n\"              not start and curl will return with exit code 63.\\n\"\r\n\"\\n\"\r\n\"              NOTE:  The  file size is not always known prior to download, and\\n\"\r\n\"              for such files this option has no effect even if the file trans-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              fer  ends  up  being larger than this given limit. This concerns\\n\"\r\n\"              both FTP and HTTP transfers.\\n\"\r\n\"\\n\"\r\n\"       --mail-rcpt <address>\\n\"\r\n\"              (SMTP) Specify a single address that the given mail  should  get\\n\"\r\n\"              sent  to. This option can be used multiple times to specify many\\n\"\r\n\"              recipients.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.20.0)\\n\"\r\n\"\\n\"\r\n\"       --max-redirs <num>\\n\"\r\n\"              Set maximum number of  redirection-followings  allowed.  If  -L,\\n\"\r\n, stdout);\r\n fputs(\r\n\"              --location is used, this option can be used to prevent curl from\\n\"\r\n\"              following redirections \\\"in absurdum\\\". By default, the  limit  is\\n\"\r\n\"              set  to 50 redirections. Set this option to -1 to make it limit-\\n\"\r\n\"              less.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --metalink\\n\"\r\n\"              This option can tell curl to parse and process a  given  URI  as\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Metalink  file  (both  version 3 and 4 (RFC 5854) are supported)\\n\"\r\n\"              and make use of the mirrors listed within for failover if  there\\n\"\r\n\"              are  errors (such as the file or server not being available). It\\n\"\r\n\"              will also verify the hash of the file after  the  download  com-\\n\"\r\n\"              pletes.  The Metalink file itself is downloaded and processed in\\n\"\r\n\"              memory and not stored in the local file system.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Example to use a remote Metalink file:\\n\"\r\n\"\\n\"\r\n\"              curl --metalink http://www.example.com/example.metalink\\n\"\r\n\"\\n\"\r\n\"              To use a Metalink file in the local file system, use FILE proto-\\n\"\r\n\"              col (file://):\\n\"\r\n\"\\n\"\r\n\"              curl --metalink file://example.metalink\\n\"\r\n\"\\n\"\r\n\"              Please  note  that if FILE protocol is disabled, there is no way\\n\"\r\n\"              to use a local Metalink file at the time of this  writing.  Also\\n\"\r\n, stdout);\r\n fputs(\r\n\"              note  that  if  --metalink  and  --include  are  used  together,\\n\"\r\n\"              --include will be ignored. This is because including headers  in\\n\"\r\n\"              the  response  will break Metalink parser and if the headers are\\n\"\r\n\"              included in the file described in Metalink file, hash check will\\n\"\r\n\"              fail.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.27.0, if built against the libmetalink library.)\\n\"\r\n\"\\n\"\r\n\"       -n, --netrc\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Makes  curl  scan  the  .netrc  (_netrc  on Windows) file in the\\n\"\r\n\"              user's home directory for login name and password. This is typi-\\n\"\r\n\"              cally  used for FTP on UNIX. If used with HTTP, curl will enable\\n\"\r\n\"              user authentication. See netrc(4) or ftp(1) for details  on  the\\n\"\r\n\"              file  format.  Curl  will not complain if that file doesn't have\\n\"\r\n\"              the right permissions (it should not be either world- or  group-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              readable).  The  environment variable \\\"HOME\\\" is used to find the\\n\"\r\n\"              home directory.\\n\"\r\n\"\\n\"\r\n\"              A quick and very simple example of how  to  setup  a  .netrc  to\\n\"\r\n\"              allow  curl to FTP to the machine host.domain.com with user name\\n\"\r\n\"              'myself' and password 'secret' should look similar to:\\n\"\r\n\"\\n\"\r\n\"              machine host.domain.com login myself password secret\\n\"\r\n\"\\n\"\r\n\"       -N, --no-buffer\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Disables the buffering of the output stream. In normal work sit-\\n\"\r\n\"              uations,  curl  will  use a standard buffered output stream that\\n\"\r\n\"              will have the effect that it will output the data in chunks, not\\n\"\r\n\"              necessarily  exactly  when  the data arrives.  Using this option\\n\"\r\n\"              will disable that buffering.\\n\"\r\n\"\\n\"\r\n\"              Note that this is the negated option name  documented.  You  can\\n\"\r\n\"              thus use --buffer to enforce the buffering.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       --netrc-file\\n\"\r\n\"              This  option  is similar to --netrc, except that you provide the\\n\"\r\n\"              path (absolute or relative) to the netrc file that  Curl  should\\n\"\r\n\"              use.   You  can  only  specify one netrc file per invocation. If\\n\"\r\n\"              several --netrc-file options are provided,  only  the  last  one\\n\"\r\n\"              will be used.  (Added in 7.21.5)\\n\"\r\n\"\\n\"\r\n\"              This  option  overrides  any use of --netrc as they are mutually\\n\"\r\n, stdout);\r\n fputs(\r\n\"              exclusive.  It will also abide by --netrc-optional if specified.\\n\"\r\n\"\\n\"\r\n\"       --netrc-optional\\n\"\r\n\"              Very similar to --netrc, but this option makes the .netrc  usage\\n\"\r\n\"              optional and not mandatory as the --netrc option does.\\n\"\r\n\"\\n\"\r\n\"       --negotiate\\n\"\r\n\"              (HTTP)  Enables  GSS-Negotiate authentication. The GSS-Negotiate\\n\"\r\n\"              method was designed by Microsoft and is used in their web appli-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              cations.  It  is  primarily  meant  as  a  support for Kerberos5\\n\"\r\n\"              authentication but may be also used along with another authenti-\\n\"\r\n\"              cation method. For more information see IETF draft draft-brezak-\\n\"\r\n\"              spnego-http-04.txt.\\n\"\r\n\"\\n\"\r\n\"              If you want to enable Negotiate for your  proxy  authentication,\\n\"\r\n\"              then use --proxy-negotiate.\\n\"\r\n\"\\n\"\r\n\"              This  option  requires a library built with GSSAPI support. This\\n\"\r\n, stdout);\r\n fputs(\r\n\"              is not very common. Use -V, --version to  see  if  your  version\\n\"\r\n\"              supports GSS-Negotiate.\\n\"\r\n\"\\n\"\r\n\"              When  using this option, you must also provide a fake -u, --user\\n\"\r\n\"              option to activate the authentication code properly.  Sending  a\\n\"\r\n\"              '-u  :'  is  enough  as  the  user name and password from the -u\\n\"\r\n\"              option aren't actually used.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times,  only  the  first  one  is\\n\"\r\n\"              used.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       --no-keepalive\\n\"\r\n\"              Disables the use of keepalive messages on the TCP connection, as\\n\"\r\n\"              by default curl enables them.\\n\"\r\n\"\\n\"\r\n\"              Note that this is the negated option name  documented.  You  can\\n\"\r\n\"              thus use --keepalive to enforce keepalive.\\n\"\r\n\"\\n\"\r\n\"       --no-sessionid\\n\"\r\n\"              (SSL)  Disable curl's use of SSL session-ID caching.  By default\\n\"\r\n\"              all transfers are done using the cache. Note that while  nothing\\n\"\r\n, stdout);\r\n fputs(\r\n\"              should  ever  get  hurt  by attempting to reuse SSL session-IDs,\\n\"\r\n\"              there seem to be broken SSL implementations in the wild that may\\n\"\r\n\"              require  you to disable this in order for you to succeed. (Added\\n\"\r\n\"              in 7.16.0)\\n\"\r\n\"\\n\"\r\n\"              Note that this is the negated option name  documented.  You  can\\n\"\r\n\"              thus use --sessionid to enforce session-ID caching.\\n\"\r\n\"\\n\"\r\n\"       --noproxy <no-proxy-list>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Comma-separated  list  of hosts which do not use a proxy, if one\\n\"\r\n\"              is specified.  The only wildcard is a single * character,  which\\n\"\r\n\"              matches all hosts, and effectively disables the proxy. Each name\\n\"\r\n\"              in this list is matched as either a domain  which  contains  the\\n\"\r\n\"              hostname,  or  the hostname itself. For example, local.com would\\n\"\r\n\"              match  local.com,  local.com:80,  and  www.local.com,  but   not\\n\"\r\n, stdout);\r\n fputs(\r\n\"              www.notlocal.com.  (Added in 7.19.4).\\n\"\r\n\"\\n\"\r\n\"       --ntlm (HTTP)  Enables  NTLM  authentication.  The  NTLM authentication\\n\"\r\n\"              method was designed by Microsoft and is used by IIS web servers.\\n\"\r\n\"              It  is a proprietary protocol, reverse-engineered by clever peo-\\n\"\r\n\"              ple and implemented in curl based on their efforts. This kind of\\n\"\r\n\"              behavior  should  not be endorsed, you should encourage everyone\\n\"\r\n, stdout);\r\n fputs(\r\n\"              who uses NTLM to switch to a public and  documented  authentica-\\n\"\r\n\"              tion method instead, such as Digest.\\n\"\r\n\"\\n\"\r\n\"              If  you  want to enable NTLM for your proxy authentication, then\\n\"\r\n\"              use --proxy-ntlm.\\n\"\r\n\"\\n\"\r\n\"              This option requires a library built with SSL support.  Use  -V,\\n\"\r\n\"              --version to see if your curl supports NTLM.\\n\"\r\n\"\\n\"\r\n\"              If  this  option  is  used  several times, only the first one is\\n\"\r\n\"              used.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       -o, --output <file>\\n\"\r\n\"              Write output to <file> instead of stdout. If you are using {} or\\n\"\r\n\"              []  to  fetch  multiple documents, you can use '#' followed by a\\n\"\r\n\"              number in the <file> specifier. That variable will  be  replaced\\n\"\r\n\"              with the current string for the URL being fetched. Like in:\\n\"\r\n\"\\n\"\r\n\"                curl http://{one,two}.site.com -o \\\"file_#1.txt\\\"\\n\"\r\n\"\\n\"\r\n\"              or use several variables like:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"                curl http://{site,host}.host[1-5].com -o \\\"#1_#2\\\"\\n\"\r\n\"\\n\"\r\n\"              You  may use this option as many times as the number of URLs you\\n\"\r\n\"              have.\\n\"\r\n\"\\n\"\r\n\"              See also the --create-dirs option to create the  local  directo-\\n\"\r\n\"              ries  dynamically.  Specifying the output as '-' (a single dash)\\n\"\r\n\"              will force the output to be done to stdout.\\n\"\r\n\"\\n\"\r\n\"       -O, --remote-name\\n\"\r\n\"              Write output to a local file named like the remote file we  get.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (Only  the file part of the remote file is used, the path is cut\\n\"\r\n\"              off.)\\n\"\r\n\"\\n\"\r\n\"              The remote file name to use for saving  is  extracted  from  the\\n\"\r\n\"              given URL, nothing else.\\n\"\r\n\"\\n\"\r\n\"              Consequentially,  the  file will be saved in the current working\\n\"\r\n\"              directory. If you want the file saved in a different  directory,\\n\"\r\n\"              make sure you change current working directory before you invoke\\n\"\r\n, stdout);\r\n fputs(\r\n\"              curl with the -O, --remote-name flag!\\n\"\r\n\"\\n\"\r\n\"              You may use this option as many times as the number of URLs  you\\n\"\r\n\"              have.\\n\"\r\n\"\\n\"\r\n\"       -p, --proxytunnel\\n\"\r\n\"              When an HTTP proxy is used (-x, --proxy), this option will cause\\n\"\r\n\"              non-HTTP protocols  to  attempt  to  tunnel  through  the  proxy\\n\"\r\n\"              instead  of merely using it to do HTTP-like operations. The tun-\\n\"\r\n\"              nel approach is made with the HTTP  proxy  CONNECT  request  and\\n\"\r\n, stdout);\r\n fputs(\r\n\"              requires that the proxy allows direct connect to the remote port\\n\"\r\n\"              number curl wants to tunnel through to.\\n\"\r\n\"\\n\"\r\n\"       -P, --ftp-port <address>\\n\"\r\n\"              (FTP) Reverses the default initiator/listener  roles  when  con-\\n\"\r\n\"              necting  with  FTP.  This  switch makes curl use active mode. In\\n\"\r\n\"              practice, curl then tells the server  to  connect  back  to  the\\n\"\r\n\"              client's specified address and port, while passive mode asks the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              server to setup an IP address and port for  it  to  connect  to.\\n\"\r\n\"              <address> should be one of:\\n\"\r\n\"\\n\"\r\n\"              interface\\n\"\r\n\"                     i.e  \\\"eth0\\\"  to  specify which interface's IP address you\\n\"\r\n\"                     want to use (Unix only)\\n\"\r\n\"\\n\"\r\n\"              IP address\\n\"\r\n\"                     i.e \\\"192.168.10.1\\\" to specify the exact IP address\\n\"\r\n\"\\n\"\r\n\"              host name\\n\"\r\n\"                     i.e \\\"my.host.domain\\\" to specify the machine\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              -      make curl pick the same IP address that is  already  used\\n\"\r\n\"                     for the control connection\\n\"\r\n\"\\n\"\r\n\"       If  this  option is used several times, the last one will be used. Dis-\\n\"\r\n\"       able the use of PORT with --ftp-pasv. Disable the attempt  to  use  the\\n\"\r\n\"       EPRT  command  instead  of PORT by using --disable-eprt. EPRT is really\\n\"\r\n\"       PORT++.\\n\"\r\n\"\\n\"\r\n\"       Starting in 7.19.5, you can append \\\":[start]-[end]\\\" to the right of the\\n\"\r\n, stdout);\r\n fputs(\r\n\"       address,  to tell curl what TCP port range to use. That means you spec-\\n\"\r\n\"       ify a port range, from a lower to a  higher  number.  A  single  number\\n\"\r\n\"       works  as well, but do note that it increases the risk of failure since\\n\"\r\n\"       the port may not be available.\\n\"\r\n\"\\n\"\r\n\"       --pass <phrase>\\n\"\r\n\"              (SSL/SSH) Passphrase for the private key\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --post301\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (HTTP) Tells curl to respect RFC  2616/10.3.2  and  not  convert\\n\"\r\n\"              POST  requests  into GET requests when following a 301 redirect-\\n\"\r\n\"              ion. The non-RFC behaviour is ubiquitous  in  web  browsers,  so\\n\"\r\n\"              curl  does  the  conversion  by default to maintain consistency.\\n\"\r\n\"              However, a server may require a POST to remain a POST after such\\n\"\r\n\"              a  redirection.  This  option  is meaningful only when using -L,\\n\"\r\n, stdout);\r\n fputs(\r\n\"              --location (Added in 7.17.1)\\n\"\r\n\"\\n\"\r\n\"       --post302\\n\"\r\n\"              (HTTP) Tells curl to respect RFC  2616/10.3.2  and  not  convert\\n\"\r\n\"              POST  requests  into GET requests when following a 302 redirect-\\n\"\r\n\"              ion. The non-RFC behaviour is ubiquitous  in  web  browsers,  so\\n\"\r\n\"              curl  does  the  conversion  by default to maintain consistency.\\n\"\r\n\"              However, a server may require a POST to remain a POST after such\\n\"\r\n, stdout);\r\n fputs(\r\n\"              a  redirection.  This  option  is meaningful only when using -L,\\n\"\r\n\"              --location (Added in 7.19.1)\\n\"\r\n\"\\n\"\r\n\"       --proto <protocols>\\n\"\r\n\"              Tells  curl  to  use  the  listed  protocols  for  its   initial\\n\"\r\n\"              retrieval. Protocols are evaluated left to right, are comma sep-\\n\"\r\n\"              arated, and are each a protocol name or 'all',  optionally  pre-\\n\"\r\n\"              fixed by zero or more modifiers. Available modifiers are:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              +  Permit this protocol in addition to protocols already permit-\\n\"\r\n\"                 ted (this is the default if no modifier is used).\\n\"\r\n\"\\n\"\r\n\"              -  Deny this protocol, removing it from the  list  of  protocols\\n\"\r\n\"                 already permitted.\\n\"\r\n\"\\n\"\r\n\"              =  Permit  only this protocol (ignoring the list already permit-\\n\"\r\n\"                 ted), though subject  to  later  modification  by  subsequent\\n\"\r\n\"                 entries in the comma separated list.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              For example:\\n\"\r\n\"\\n\"\r\n\"              --proto -ftps  uses the default protocols, but disables ftps\\n\"\r\n\"\\n\"\r\n\"              --proto -all,https,+http\\n\"\r\n\"                             only enables http and https\\n\"\r\n\"\\n\"\r\n\"              --proto =http,https\\n\"\r\n\"                             also only enables http and https\\n\"\r\n\"\\n\"\r\n\"              Unknown  protocols  produce  a  warning.  This allows scripts to\\n\"\r\n\"              safely rely on being able to disable potentially dangerous  pro-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              tocols,  without  relying  upon  support for that protocol being\\n\"\r\n\"              built into curl to avoid an error.\\n\"\r\n\"\\n\"\r\n\"              This option can be used multiple times, in which case the effect\\n\"\r\n\"              is  the same as concatenating the protocols into one instance of\\n\"\r\n\"              the option.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.20.2)\\n\"\r\n\"\\n\"\r\n\"       --proto-redir <protocols>\\n\"\r\n\"              Tells curl to use the listed protocols  after  a  redirect.  See\\n\"\r\n, stdout);\r\n fputs(\r\n\"              --proto for how protocols are represented.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.20.2)\\n\"\r\n\"\\n\"\r\n\"       --proxy-anyauth\\n\"\r\n\"              Tells  curl to pick a suitable authentication method when commu-\\n\"\r\n\"              nicating with  the  given  proxy.  This  might  cause  an  extra\\n\"\r\n\"              request/response round-trip. (Added in 7.13.2)\\n\"\r\n\"\\n\"\r\n\"       --proxy-basic\\n\"\r\n\"              Tells  curl  to use HTTP Basic authentication when communicating\\n\"\r\n, stdout);\r\n fputs(\r\n\"              with the given proxy. Use --basic for enabling HTTP Basic with a\\n\"\r\n\"              remote  host.  Basic  is  the default authentication method curl\\n\"\r\n\"              uses with proxies.\\n\"\r\n\"\\n\"\r\n\"       --proxy-digest\\n\"\r\n\"              Tells curl to use HTTP Digest authentication when  communicating\\n\"\r\n\"              with the given proxy. Use --digest for enabling HTTP Digest with\\n\"\r\n\"              a remote host.\\n\"\r\n\"\\n\"\r\n\"       --proxy-negotiate\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Tells curl to use HTTP Negotiate authentication when communicat-\\n\"\r\n\"              ing  with  the  given  proxy.  Use --negotiate for enabling HTTP\\n\"\r\n\"              Negotiate with a remote host. (Added in 7.17.1)\\n\"\r\n\"\\n\"\r\n\"       --proxy-ntlm\\n\"\r\n\"              Tells curl to use HTTP NTLM  authentication  when  communicating\\n\"\r\n\"              with the given proxy. Use --ntlm for enabling NTLM with a remote\\n\"\r\n\"              host.\\n\"\r\n\"\\n\"\r\n\"       --proxy1.0 <proxyhost[:port]>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Use the specified HTTP 1.0 proxy. If  the  port  number  is  not\\n\"\r\n\"              specified, it is assumed at port 1080.\\n\"\r\n\"\\n\"\r\n\"              The  only difference between this and the HTTP proxy option (-x,\\n\"\r\n\"              --proxy), is that attempts to use CONNECT through the proxy will\\n\"\r\n\"              specify an HTTP 1.0 protocol instead of the default HTTP 1.1.\\n\"\r\n\"\\n\"\r\n\"       --pubkey <key>\\n\"\r\n\"              (SSH)  Public  key  file name. Allows you to provide your public\\n\"\r\n, stdout);\r\n fputs(\r\n\"              key in this separate file.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -q     If used as the first parameter on the command line,  the  curlrc\\n\"\r\n\"              config  file will not be read and used. See the -K, --config for\\n\"\r\n\"              details on the default config file search path.\\n\"\r\n\"\\n\"\r\n\"       -Q, --quote <command>\\n\"\r\n\"              (FTP/SFTP) Send an arbitrary command to the remote FTP  or  SFTP\\n\"\r\n, stdout);\r\n fputs(\r\n\"              server.  Quote commands are sent BEFORE the transfer takes place\\n\"\r\n\"              (just after the initial PWD command in an FTP  transfer,  to  be\\n\"\r\n\"              exact). To make commands take place after a successful transfer,\\n\"\r\n\"              prefix them with a dash '-'.  To make  commands  be  sent  after\\n\"\r\n\"              curl has changed the working directory, just before the transfer\\n\"\r\n\"              command(s), prefix the command with a '+'  (this  is  only  sup-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              ported  for FTP). You may specify any number of commands. If the\\n\"\r\n\"              server returns failure for one of the commands, the entire oper-\\n\"\r\n\"              ation  will  be aborted. You must send syntactically correct FTP\\n\"\r\n\"              commands as RFC 959 defines to FTP servers, or one of  the  com-\\n\"\r\n\"              mands  listed  below  to  SFTP servers.  This option can be used\\n\"\r\n\"              multiple times. When speaking to an FTP server, prefix the  com-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              mand with an asterisk (*) to make curl continue even if the com-\\n\"\r\n\"              mand fails as by default curl will stop at first failure.\\n\"\r\n\"\\n\"\r\n\"              SFTP is a binary protocol. Unlike for FTP, curl interprets  SFTP\\n\"\r\n\"              quote  commands  itself before sending them to the server.  File\\n\"\r\n\"              names may be quoted shell-style to embed spaces or special char-\\n\"\r\n\"              acters.   Following is the list of all supported SFTP quote com-\\n\"\r\n\"              mands:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              chgrp group file\\n\"\r\n\"                     The chgrp command sets the group ID of the file named  by\\n\"\r\n\"                     the  file  operand to the group ID specified by the group\\n\"\r\n\"                     operand. The group operand is a decimal integer group ID.\\n\"\r\n\"\\n\"\r\n\"              chmod mode file\\n\"\r\n\"                     The chmod command modifies the  file  mode  bits  of  the\\n\"\r\n\"                     specified file. The mode operand is an octal integer mode\\n\"\r\n\"                     number.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              chown user file\\n\"\r\n\"                     The chown command sets the owner of the file named by the\\n\"\r\n\"                     file  operand  to the user ID specified by the user oper-\\n\"\r\n\"                     and. The user operand is a decimal integer user ID.\\n\"\r\n\"\\n\"\r\n\"              ln source_file target_file\\n\"\r\n\"                     The ln and symlink commands create a symbolic link at the\\n\"\r\n\"                     target_file  location  pointing  to the source_file loca-\\n\"\r\n\"                     tion.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              mkdir directory_name\\n\"\r\n\"                     The mkdir command creates  the  directory  named  by  the\\n\"\r\n\"                     directory_name operand.\\n\"\r\n\"\\n\"\r\n\"              pwd    The pwd command returns the absolute pathname of the cur-\\n\"\r\n\"                     rent working directory.\\n\"\r\n\"\\n\"\r\n\"              rename source target\\n\"\r\n\"                     The rename command renames the file or directory named by\\n\"\r\n\"                     the  source  operand to the destination path named by the\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     target operand.\\n\"\r\n\"\\n\"\r\n\"              rm file\\n\"\r\n\"                     The rm command removes the file specified by the file op-\\n\"\r\n\"                     erand.\\n\"\r\n\"\\n\"\r\n\"              rmdir directory\\n\"\r\n\"                     The  rmdir  command removes the directory entry specified\\n\"\r\n\"                     by the directory operand, provided it is empty.\\n\"\r\n\"\\n\"\r\n\"              symlink source_file target_file\\n\"\r\n\"                     See ln.\\n\"\r\n\"\\n\"\r\n\"       -r, --range <range>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (HTTP/FTP/SFTP/FILE) Retrieve a byte range (i.e a partial  docu-\\n\"\r\n\"              ment)  from  a  HTTP/1.1,  FTP  or  SFTP server or a local FILE.\\n\"\r\n\"              Ranges can be specified in a number of ways.\\n\"\r\n\"\\n\"\r\n\"              0-499     specifies the first 500 bytes\\n\"\r\n\"\\n\"\r\n\"              500-999   specifies the second 500 bytes\\n\"\r\n\"\\n\"\r\n\"              -500      specifies the last 500 bytes\\n\"\r\n\"\\n\"\r\n\"              9500-     specifies the bytes from offset 9500 and forward\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              0-0,-1    specifies the first and last byte only(*)(H)\\n\"\r\n\"\\n\"\r\n\"              500-700,600-799\\n\"\r\n\"                        specifies 300 bytes from offset 500(H)\\n\"\r\n\"\\n\"\r\n\"              100-199,500-599\\n\"\r\n\"                        specifies two separate 100-byte ranges(*)(H)\\n\"\r\n\"\\n\"\r\n\"       (*) = NOTE that this will cause the server to reply  with  a  multipart\\n\"\r\n\"       response!\\n\"\r\n\"\\n\"\r\n\"       Only  digit characters (0-9) are valid in the 'start' and 'stop' fields\\n\"\r\n, stdout);\r\n fputs(\r\n\"       of the 'start-stop' range syntax. If a non-digit character is given  in\\n\"\r\n\"       the  range, the server's response will be unspecified, depending on the\\n\"\r\n\"       server's configuration.\\n\"\r\n\"\\n\"\r\n\"       You should also be aware that many HTTP/1.1 servers do  not  have  this\\n\"\r\n\"       feature  enabled,  so  that  when  you  attempt  to get a range, you'll\\n\"\r\n\"       instead get the whole document.\\n\"\r\n\"\\n\"\r\n\"       FTP and SFTP range downloads only support the simple 'start-stop'  syn-\\n\"\r\n, stdout);\r\n fputs(\r\n\"       tax  (optionally  with  one of the numbers omitted). FTP use depends on\\n\"\r\n\"       the extended FTP command SIZE.\\n\"\r\n\"\\n\"\r\n\"       If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -R, --remote-time\\n\"\r\n\"              When used, this will make curl attempt to figure out  the  time-\\n\"\r\n\"              stamp  of  the  remote  file,  and if that is available make the\\n\"\r\n\"              local file get that same timestamp.\\n\"\r\n\"\\n\"\r\n\"       --random-file <file>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (SSL) Specify the path name to file containing what will be con-\\n\"\r\n\"              sidered  as  random  data.  The  data is used to seed the random\\n\"\r\n\"              engine for SSL connections.  See also the --egd-file option.\\n\"\r\n\"\\n\"\r\n\"       --raw  (HTTP) When used, it disables all internal HTTP decoding of con-\\n\"\r\n\"              tent  or  transfer  encodings  and  instead makes them passed on\\n\"\r\n\"              unaltered, raw. (Added in 7.16.2)\\n\"\r\n\"\\n\"\r\n\"       --remote-name-all\\n\"\r\n, stdout);\r\n fputs(\r\n\"              This option changes the default action for all given URLs to  be\\n\"\r\n\"              dealt with as if -O, --remote-name were used for each one. So if\\n\"\r\n\"              you want to disable that for a specific URL after --remote-name-\\n\"\r\n\"              all  has  been  used,  you  must use \\\"-o -\\\" or --no-remote-name.\\n\"\r\n\"              (Added in 7.19.0)\\n\"\r\n\"\\n\"\r\n\"       --resolve <host:port:address>\\n\"\r\n\"              Provide a custom address for a  specific  host  and  port  pair.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Using  this,  you  can make the curl requests(s) use a specified\\n\"\r\n\"              address and prevent the otherwise normally resolved  address  to\\n\"\r\n\"              be  used.  Consider it a sort of /etc/hosts alternative provided\\n\"\r\n\"              on the command line. The port number should be the  number  used\\n\"\r\n\"              for  the  specific  protocol the host will be used for. It means\\n\"\r\n\"              you need several entries if you want to provide address for  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              same host but different ports.\\n\"\r\n\"\\n\"\r\n\"              This  option  can  be  used many times to add many host names to\\n\"\r\n\"              resolve.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.21.3)\\n\"\r\n\"\\n\"\r\n\"       --retry <num>\\n\"\r\n\"              If a transient error is returned when curl tries  to  perform  a\\n\"\r\n\"              transfer,  it  will retry this number of times before giving up.\\n\"\r\n\"              Setting the number to 0 makes curl do no retries (which  is  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              default).  Transient  error  means either: a timeout, an FTP 4xx\\n\"\r\n\"              response code or an HTTP 5xx response code.\\n\"\r\n\"\\n\"\r\n\"              When curl is about to retry a transfer, it will first  wait  one\\n\"\r\n\"              second  and  then for all forthcoming retries it will double the\\n\"\r\n\"              waiting time until it reaches 10 minutes which then will be  the\\n\"\r\n\"              delay  between  the rest of the retries.  By using --retry-delay\\n\"\r\n, stdout);\r\n fputs(\r\n\"              you  disable  this  exponential  backoff  algorithm.  See   also\\n\"\r\n\"              --retry-max-time  to  limit  the total time allowed for retries.\\n\"\r\n\"              (Added in 7.12.3)\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --retry-delay <seconds>\\n\"\r\n\"              Make curl sleep this amount of time before  each  retry  when  a\\n\"\r\n\"              transfer  has  failed  with  a  transient  error (it changes the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              default backoff time algorithm between retries). This option  is\\n\"\r\n\"              only  interesting if --retry is also used. Setting this delay to\\n\"\r\n\"              zero will make curl use the default  backoff  time.   (Added  in\\n\"\r\n\"              7.12.3)\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --retry-max-time <seconds>\\n\"\r\n\"              The  retry  timer  is  reset  before the first transfer attempt.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Retries will be done as usual (see --retry) as long as the timer\\n\"\r\n\"              hasn't reached this given limit. Notice that if the timer hasn't\\n\"\r\n\"              reached the limit, the request will be made and  while  perform-\\n\"\r\n\"              ing,  it may take longer than this given time period. To limit a\\n\"\r\n\"              single request's maximum time, use  -m,  --max-time.   Set  this\\n\"\r\n\"              option to zero to not timeout retries. (Added in 7.12.3)\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -s, --silent\\n\"\r\n\"              Silent  or  quiet  mode. Don't show progress meter or error mes-\\n\"\r\n\"              sages.  Makes Curl mute.\\n\"\r\n\"\\n\"\r\n\"       -S, --show-error\\n\"\r\n\"              When used with -s it makes curl show  an  error  message  if  it\\n\"\r\n\"              fails.\\n\"\r\n\"\\n\"\r\n\"       --ssl  (FTP,  POP3,  IMAP, SMTP) Try to use SSL/TLS for the connection.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Reverts to a non-secure connection if the server doesn't support\\n\"\r\n\"              SSL/TLS.   See also --ftp-ssl-control and --ssl-reqd for differ-\\n\"\r\n\"              ent levels of encryption required. (Added in 7.20.0)\\n\"\r\n\"\\n\"\r\n\"              This option was formerly known as --ftp-ssl (Added  in  7.11.0).\\n\"\r\n\"              That  option  name  can  still  be used but will be removed in a\\n\"\r\n\"              future version.\\n\"\r\n\"\\n\"\r\n\"       --ssl-reqd\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (FTP, POP3, IMAP, SMTP)  Require  SSL/TLS  for  the  connection.\\n\"\r\n\"              Terminates the connection if the server doesn't support SSL/TLS.\\n\"\r\n\"              (Added in 7.20.0)\\n\"\r\n\"\\n\"\r\n\"              This option was  formerly  known  as  --ftp-ssl-reqd  (added  in\\n\"\r\n\"              7.15.5).  That option name can still be used but will be removed\\n\"\r\n\"              in a future version.\\n\"\r\n\"\\n\"\r\n\"       --ssl-allow-beast\\n\"\r\n\"              (SSL) This option tells curl to not work around a security  flaw\\n\"\r\n, stdout);\r\n fputs(\r\n\"              in the SSL3 and TLS1.0 protocols known as BEAST.  If this option\\n\"\r\n\"              isn't used, the SSL layer may use work-arounds  known  to  cause\\n\"\r\n\"              interoperability  problems  with some older SSL implementations.\\n\"\r\n\"              WARNING: this option loosens the SSL security, and by using this\\n\"\r\n\"              flag you ask for exactly that.  (Added in 7.25.0)\\n\"\r\n\"\\n\"\r\n\"       --socks4 <host[:port]>\\n\"\r\n\"              Use the specified SOCKS4 proxy. If the port number is not speci-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              fied, it is assumed at port 1080. (Added in 7.15.2)\\n\"\r\n\"\\n\"\r\n\"              This option overrides any previous use of -x, --proxy,  as  they\\n\"\r\n\"              are mutually exclusive.\\n\"\r\n\"\\n\"\r\n\"              Since 7.21.7, this option is superfluous since you can specify a\\n\"\r\n\"              socks4 proxy with -x, --proxy using a socks4:// protocol prefix.\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --socks4a <host[:port]>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Use the specified SOCKS4a proxy. If the port number is not spec-\\n\"\r\n\"              ified, it is assumed at port 1080. (Added in 7.18.0)\\n\"\r\n\"\\n\"\r\n\"              This  option  overrides any previous use of -x, --proxy, as they\\n\"\r\n\"              are mutually exclusive.\\n\"\r\n\"\\n\"\r\n\"              Since 7.21.7, this option is superfluous since you can specify a\\n\"\r\n\"              socks4a  proxy with -x, --proxy using a socks4a:// protocol pre-\\n\"\r\n\"              fix.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --socks5-hostname <host[:port]>\\n\"\r\n\"              Use the specified SOCKS5 proxy (and let the  proxy  resolve  the\\n\"\r\n\"              host  name).  If the port number is not specified, it is assumed\\n\"\r\n\"              at port 1080. (Added in 7.18.0)\\n\"\r\n\"\\n\"\r\n\"              This option overrides any previous use of -x, --proxy,  as  they\\n\"\r\n\"              are mutually exclusive.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Since 7.21.7, this option is superfluous since you can specify a\\n\"\r\n\"              socks5 hostname proxy with -x, --proxy using a socks5h:// proto-\\n\"\r\n\"              col prefix.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"              (This option was  previously  wrongly  documented  and  used  as\\n\"\r\n\"              --socks without the number appended.)\\n\"\r\n\"\\n\"\r\n\"       --socks5 <host[:port]>\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Use  the  specified  SOCKS5  proxy  -  but resolve the host name\\n\"\r\n\"              locally. If the port number is not specified, it is  assumed  at\\n\"\r\n\"              port 1080.\\n\"\r\n\"\\n\"\r\n\"              This  option  overrides any previous use of -x, --proxy, as they\\n\"\r\n\"              are mutually exclusive.\\n\"\r\n\"\\n\"\r\n\"              Since 7.21.7, this option is superfluous since you can specify a\\n\"\r\n\"              socks5 proxy with -x, --proxy using a socks5:// protocol prefix.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"              (This option was  previously  wrongly  documented  and  used  as\\n\"\r\n\"              --socks without the number appended.)\\n\"\r\n\"\\n\"\r\n\"              This  option (as well as --socks4) does not work with IPV6, FTPS\\n\"\r\n\"              or LDAP.\\n\"\r\n\"\\n\"\r\n\"       --socks5-gssapi-service <servicename>\\n\"\r\n\"              The default service name for a socks server is rcmd/server-fqdn.\\n\"\r\n\"              This option allows you to change it.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Examples:   --socks5  proxy-name  --socks5-gssapi-service  sockd\\n\"\r\n\"              would use sockd/proxy-name --socks5 proxy-name  --socks5-gssapi-\\n\"\r\n\"              service  sockd/real-name  would  use  sockd/real-name  for cases\\n\"\r\n\"              where the proxy-name does not match the principal name.   (Added\\n\"\r\n\"              in 7.19.4).\\n\"\r\n\"\\n\"\r\n\"       --socks5-gssapi-nec\\n\"\r\n\"              As  part  of the gssapi negotiation a protection mode is negoti-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              ated. RFC 1961 says in section 4.3/4.4 it should  be  protected,\\n\"\r\n\"              but  the  NEC  reference  implementation  does  not.  The option\\n\"\r\n\"              --socks5-gssapi-nec allows the unprotected exchange of the  pro-\\n\"\r\n\"              tection mode negotiation. (Added in 7.19.4).\\n\"\r\n\"\\n\"\r\n\"       --stderr <file>\\n\"\r\n\"              Redirect  all writes to stderr to the specified file instead. If\\n\"\r\n\"              the file name is a plain '-', it is instead written to stdout.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -t, --telnet-option <OPT=val>\\n\"\r\n\"              Pass options to the telnet protocol. Supported options are:\\n\"\r\n\"\\n\"\r\n\"              TTYPE=<term> Sets the terminal type.\\n\"\r\n\"\\n\"\r\n\"              XDISPLOC=<X display> Sets the X display location.\\n\"\r\n\"\\n\"\r\n\"              NEW_ENV=<var,val> Sets an environment variable.\\n\"\r\n\"\\n\"\r\n\"       -T, --upload-file <file>\\n\"\r\n\"              This transfers the specified local file to the  remote  URL.  If\\n\"\r\n, stdout);\r\n fputs(\r\n\"              there is no file part in the specified URL, Curl will append the\\n\"\r\n\"              local file name. NOTE that you must use a trailing / on the last\\n\"\r\n\"              directory  to really prove to Curl that there is no file name or\\n\"\r\n\"              curl will think that your last directory name is the remote file\\n\"\r\n\"              name to use. That will most likely cause the upload operation to\\n\"\r\n\"              fail. If this is used on an HTTP(S) server, the PUT command will\\n\"\r\n\"              be used.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Use  the file name \\\"-\\\" (a single dash) to use stdin instead of a\\n\"\r\n\"              given file.  Alternately, the file name \\\".\\\"  (a  single  period)\\n\"\r\n\"              may  be  specified  instead  of \\\"-\\\" to use stdin in non-blocking\\n\"\r\n\"              mode to  allow  reading  server  output  while  stdin  is  being\\n\"\r\n\"              uploaded.\\n\"\r\n\"\\n\"\r\n\"              You can specify one -T for each URL on the command line. Each -T\\n\"\r\n, stdout);\r\n fputs(\r\n\"              + URL pair specifies what to upload and to where. curl also sup-\\n\"\r\n\"              ports \\\"globbing\\\" of the -T argument, meaning that you can upload\\n\"\r\n\"              multiple files to a single URL by using the  same  URL  globbing\\n\"\r\n\"              style supported in the URL, like this:\\n\"\r\n\"\\n\"\r\n\"              curl -T \\\"{file1,file2}\\\" http://www.uploadtothissite.com\\n\"\r\n\"\\n\"\r\n\"              or even\\n\"\r\n\"\\n\"\r\n\"              curl -T \\\"img[1-1000].png\\\" ftp://ftp.picturemania.com/upload/\\n\"\r\n\"\\n\"\r\n\"       --tcp-nodelay\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Turn  on the TCP_NODELAY option. See the curl_easy_setopt(3) man\\n\"\r\n\"              page for details about this option. (Added in 7.11.2)\\n\"\r\n\"\\n\"\r\n\"       --tftp-blksize <value>\\n\"\r\n\"              (TFTP) Set TFTP BLKSIZE option (must be >512). This is the block\\n\"\r\n\"              size that curl will try to use when transferring data to or from\\n\"\r\n\"              a TFTP server. By default 512 bytes will be used.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              (Added in 7.20.0)\\n\"\r\n\"\\n\"\r\n\"       --tlsauthtype <authtype>\\n\"\r\n\"              Set TLS  authentication  type.  Currently,  the  only  supported\\n\"\r\n\"              option  is  \\\"SRP\\\",  for  TLS-SRP  (RFC  5054).  If --tlsuser and\\n\"\r\n\"              --tlspassword are specified but --tlsauthtype is not, then  this\\n\"\r\n\"              option defaults to \\\"SRP\\\".  (Added in 7.21.4)\\n\"\r\n\"\\n\"\r\n\"       --tlsuser <user>\\n\"\r\n\"              Set  username  for use with the TLS authentication method speci-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              fied with --tlsauthtype. Requires  that  --tlspassword  also  be\\n\"\r\n\"              set.  (Added in 7.21.4)\\n\"\r\n\"\\n\"\r\n\"       --tlspassword <password>\\n\"\r\n\"              Set  password  for use with the TLS authentication method speci-\\n\"\r\n\"              fied with --tlsauthtype. Requires that --tlsuser  also  be  set.\\n\"\r\n\"              (Added in 7.21.4)\\n\"\r\n\"\\n\"\r\n\"       --tr-encoding\\n\"\r\n\"              (HTTP) Request a compressed Transfer-Encoding response using one\\n\"\r\n, stdout);\r\n fputs(\r\n\"              of the algorithms curl supports, and uncompress the  data  while\\n\"\r\n\"              receiving it.\\n\"\r\n\"\\n\"\r\n\"              (Added in 7.21.6)\\n\"\r\n\"\\n\"\r\n\"       --trace <file>\\n\"\r\n\"              Enables  a  full  trace  dump of all incoming and outgoing data,\\n\"\r\n\"              including descriptive information, to the given output file. Use\\n\"\r\n\"              \\\"-\\\" as filename to have the output sent to stdout.\\n\"\r\n\"\\n\"\r\n\"              This option overrides previous uses of -v, --verbose or --trace-\\n\"\r\n\"              ascii.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --trace-ascii <file>\\n\"\r\n\"              Enables a full trace dump of all  incoming  and  outgoing  data,\\n\"\r\n\"              including descriptive information, to the given output file. Use\\n\"\r\n\"              \\\"-\\\" as filename to have the output sent to stdout.\\n\"\r\n\"\\n\"\r\n\"              This is very similar to --trace, but leaves out the hex part and\\n\"\r\n\"              only  shows  the ASCII part of the dump. It makes smaller output\\n\"\r\n, stdout);\r\n fputs(\r\n\"              that might be easier to read for untrained humans.\\n\"\r\n\"\\n\"\r\n\"              This option overrides previous uses of -v, --verbose or --trace.\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --trace-time\\n\"\r\n\"              Prepends a time stamp to each trace or verbose  line  that  curl\\n\"\r\n\"              displays.  (Added in 7.14.0)\\n\"\r\n\"\\n\"\r\n\"       -u, --user <user:password>\\n\"\r\n\"              Specify the user name and password to use for server authentica-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              tion. Overrides -n, --netrc and --netrc-optional.\\n\"\r\n\"\\n\"\r\n\"              If you just give the user name (without entering a  colon)  curl\\n\"\r\n\"              will prompt for a password.\\n\"\r\n\"\\n\"\r\n\"              If  you  use an SSPI-enabled curl binary and do NTLM authentica-\\n\"\r\n\"              tion, you can force curl to pick up the user name  and  password\\n\"\r\n\"              from  your  environment by simply specifying a single colon with\\n\"\r\n\"              this option: \\\"-u :\\\".\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -U, --proxy-user <user:password>\\n\"\r\n\"              Specify the user name and password to use for proxy  authentica-\\n\"\r\n\"              tion.\\n\"\r\n\"\\n\"\r\n\"              If  you  use an SSPI-enabled curl binary and do NTLM authentica-\\n\"\r\n\"              tion, you can force curl to pick up the user name  and  password\\n\"\r\n\"              from  your  environment by simply specifying a single colon with\\n\"\r\n\"              this option: \\\"-U :\\\".\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --url <URL>\\n\"\r\n\"              Specify a URL to fetch. This option is  mostly  handy  when  you\\n\"\r\n\"              want to specify URL(s) in a config file.\\n\"\r\n\"\\n\"\r\n\"              This  option  may  be used any number of times. To control where\\n\"\r\n\"              this URL is written, use the -o, --output or the  -O,  --remote-\\n\"\r\n\"              name options.\\n\"\r\n\"       -v, --verbose\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Makes  the  fetching  more  verbose/talkative. Mostly useful for\\n\"\r\n\"              debugging. A line starting with '>' means \\\"header data\\\" sent  by\\n\"\r\n\"              curl, '<' means \\\"header data\\\" received by curl that is hidden in\\n\"\r\n\"              normal cases, and a line starting with '*' means additional info\\n\"\r\n\"              provided by curl.\\n\"\r\n\"\\n\"\r\n\"              Note  that  if  you  only  want  HTTP headers in the output, -i,\\n\"\r\n\"              --include might be the option you're looking for.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If you think this option still doesn't give you enough  details,\\n\"\r\n\"              consider using --trace or --trace-ascii instead.\\n\"\r\n\"\\n\"\r\n\"              This option overrides previous uses of --trace-ascii or --trace.\\n\"\r\n\"\\n\"\r\n\"              Use -s, --silent to make curl quiet.\\n\"\r\n\"\\n\"\r\n\"       -w, --write-out <format>\\n\"\r\n\"              Defines what to display on stdout after a completed and success-\\n\"\r\n\"              ful operation. The format is a string  that  may  contain  plain\\n\"\r\n, stdout);\r\n fputs(\r\n\"              text mixed with any number of variables. The string can be spec-\\n\"\r\n\"              ified as \\\"string\\\", to get read from a particular file you  spec-\\n\"\r\n\"              ify  it  \\\"@filename\\\"  and  to  tell curl to read the format from\\n\"\r\n\"              stdin you write \\\"@-\\\".\\n\"\r\n\"\\n\"\r\n\"              The variables present in the output format will  be  substituted\\n\"\r\n\"              by  the  value or text that curl thinks fit, as described below.\\n\"\r\n, stdout);\r\n fputs(\r\n\"              All variables are specified as %{variable_name} and to output  a\\n\"\r\n\"              normal  % you just write them as %%. You can output a newline by\\n\"\r\n\"              using \\\\n, a carriage return with \\\\r and a tab space with \\\\t.\\n\"\r\n\"\\n\"\r\n\"              NOTE: The %-symbol is a special symbol in the win32-environment,\\n\"\r\n\"              where  all  occurrences  of  %  must  be doubled when using this\\n\"\r\n\"              option.\\n\"\r\n\"\\n\"\r\n\"              The variables available are:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              content_type   The Content-Type of the  requested  document,  if\\n\"\r\n\"                             there was any.\\n\"\r\n\"\\n\"\r\n\"              filename_effective\\n\"\r\n\"                             The  ultimate  filename  that curl writes out to.\\n\"\r\n\"                             This is only meaningful if curl is told to  write\\n\"\r\n\"                             to  a  file  with  the  --remote-name or --output\\n\"\r\n\"                             option. It's most useful in combination with  the\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             --remote-header-name option. (Added in 7.25.1)\\n\"\r\n\"\\n\"\r\n\"              ftp_entry_path The initial path curl ended up in when logging on\\n\"\r\n\"                             to the remote FTP server. (Added in 7.15.4)\\n\"\r\n\"\\n\"\r\n\"              http_code      The numerical response code that was found in the\\n\"\r\n\"                             last  retrieved  HTTP(S)  or  FTP(s) transfer. In\\n\"\r\n\"                             7.18.2 the alias response_code was added to  show\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             the same info.\\n\"\r\n\"\\n\"\r\n\"              http_connect   The  numerical  code  that  was found in the last\\n\"\r\n\"                             response  (from  a  proxy)  to  a  curl   CONNECT\\n\"\r\n\"                             request. (Added in 7.12.4)\\n\"\r\n\"\\n\"\r\n\"              local_ip       The  IP  address  of  the  local  end of the most\\n\"\r\n\"                             recently done connection - can be either IPv4  or\\n\"\r\n\"                             IPv6 (Added in 7.29.0)\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              local_port     The  local  port number of the most recently done\\n\"\r\n\"                             connection (Added in 7.29.0)\\n\"\r\n\"\\n\"\r\n\"              num_connects   Number of new connects made in the recent  trans-\\n\"\r\n\"                             fer. (Added in 7.12.3)\\n\"\r\n\"\\n\"\r\n\"              num_redirects  Number  of  redirects  that  were followed in the\\n\"\r\n\"                             request. (Added in 7.12.3)\\n\"\r\n\"\\n\"\r\n\"              redirect_url   When an HTTP request was made without -L to  fol-\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             low redirects, this variable will show the actual\\n\"\r\n\"                             URL a redirect  would  take  you  to.  (Added  in\\n\"\r\n\"                             7.18.2)\\n\"\r\n\"\\n\"\r\n\"              remote_ip      The  remote  IP address of the most recently done\\n\"\r\n\"                             connection - can be either IPv4 or IPv6 (Added in\\n\"\r\n\"                             7.29.0)\\n\"\r\n\"\\n\"\r\n\"              remote_port    The  remote port number of the most recently done\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             connection (Added in 7.29.0)\\n\"\r\n\"\\n\"\r\n\"              size_download  The total amount of bytes that were downloaded.\\n\"\r\n\"\\n\"\r\n\"              size_header    The total amount of bytes of the downloaded head-\\n\"\r\n\"                             ers.\\n\"\r\n\"\\n\"\r\n\"              size_request   The  total  amount of bytes that were sent in the\\n\"\r\n\"                             HTTP request.\\n\"\r\n\"\\n\"\r\n\"              size_upload    The total amount of bytes that were uploaded.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              speed_download The average download speed that curl measured for\\n\"\r\n\"                             the complete download. Bytes per second.\\n\"\r\n\"\\n\"\r\n\"              speed_upload   The  average  upload speed that curl measured for\\n\"\r\n\"                             the complete upload. Bytes per second.\\n\"\r\n\"\\n\"\r\n\"              ssl_verify_result\\n\"\r\n\"                             The result of the SSL peer certificate  verifica-\\n\"\r\n\"                             tion that was requested. 0 means the verification\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             was successful. (Added in 7.19.0)\\n\"\r\n\"\\n\"\r\n\"              time_appconnect\\n\"\r\n\"                             The time, in seconds,  it  took  from  the  start\\n\"\r\n\"                             until  the  SSL/SSH/etc  connect/handshake to the\\n\"\r\n\"                             remote host was completed. (Added in 7.19.0)\\n\"\r\n\"\\n\"\r\n\"              time_connect   The time, in seconds,  it  took  from  the  start\\n\"\r\n\"                             until  the  TCP  connect  to  the remote host (or\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             proxy) was completed.\\n\"\r\n\"\\n\"\r\n\"              time_namelookup\\n\"\r\n\"                             The time, in seconds,  it  took  from  the  start\\n\"\r\n\"                             until the name resolving was completed.\\n\"\r\n\"\\n\"\r\n\"              time_pretransfer\\n\"\r\n\"                             The  time,  in  seconds,  it  took from the start\\n\"\r\n\"                             until the file transfer was just about to  begin.\\n\"\r\n\"                             This includes all pre-transfer commands and nego-\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             tiations that are specific to the particular pro-\\n\"\r\n\"                             tocol(s) involved.\\n\"\r\n\"\\n\"\r\n\"              time_redirect  The time, in seconds, it took for all redirection\\n\"\r\n\"                             steps include name lookup,  connect,  pretransfer\\n\"\r\n\"                             and  transfer  before  the  final transaction was\\n\"\r\n\"                             started. time_redirect shows the complete  execu-\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             tion  time  for  multiple redirections. (Added in\\n\"\r\n\"                             7.12.3)\\n\"\r\n\"\\n\"\r\n\"              time_starttransfer\\n\"\r\n\"                             The time, in seconds,  it  took  from  the  start\\n\"\r\n\"                             until  the first byte was just about to be trans-\\n\"\r\n\"                             ferred. This includes time_pretransfer  and  also\\n\"\r\n\"                             the  time  the  server  needed  to  calculate the\\n\"\r\n, stdout);\r\n fputs(\r\n\"                             result.\\n\"\r\n\"\\n\"\r\n\"              time_total     The total time, in seconds, that the full  opera-\\n\"\r\n\"                             tion lasted. The time will be displayed with mil-\\n\"\r\n\"                             lisecond resolution.\\n\"\r\n\"\\n\"\r\n\"              url_effective  The URL that was fetched last. This is most mean-\\n\"\r\n\"                             ingful  if  you've  told curl to follow location:\\n\"\r\n\"                             headers.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -x, --proxy <[protocol://][user:password@]proxyhost[:port]>\\n\"\r\n\"              Use the specified HTTP proxy. If the port number is  not  speci-\\n\"\r\n\"              fied, it is assumed at port 1080.\\n\"\r\n\"\\n\"\r\n\"              This  option  overrides  existing environment variables that set\\n\"\r\n\"              the proxy to use. If there's an environment variable  setting  a\\n\"\r\n\"              proxy, you can set proxy to \\\"\\\" to override it.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              All operations that are performed over an HTTP proxy will trans-\\n\"\r\n\"              parently be converted to HTTP. It means  that  certain  protocol\\n\"\r\n\"              specific operations might not be available. This is not the case\\n\"\r\n\"              if you can tunnel through the proxy, as one with the -p, --prox-\\n\"\r\n\"              ytunnel option.\\n\"\r\n\"\\n\"\r\n\"              User and password that might be provided in the proxy string are\\n\"\r\n, stdout);\r\n fputs(\r\n\"              URL decoded by curl. This allows you to pass in special  charac-\\n\"\r\n\"              ters such as @ by using %40 or pass in a colon with %3a.\\n\"\r\n\"\\n\"\r\n\"              The  proxy host can be specified the exact same way as the proxy\\n\"\r\n\"              environment variables, including the protocol  prefix  (http://)\\n\"\r\n\"              and the embedded user + password.\\n\"\r\n\"\\n\"\r\n\"              From  7.21.7,  the  proxy  string may be specified with a proto-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              col://  prefix  to  specify  alternative  proxy  protocols.  Use\\n\"\r\n\"              socks4://,  socks4a://,  socks5://  or socks5h:// to request the\\n\"\r\n\"              specific SOCKS  version  to  be  used.  No  protocol  specified,\\n\"\r\n\"              http:// and all others will be treated as HTTP proxies.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -X, --request <command>\\n\"\r\n\"              (HTTP) Specifies a custom request method to use when communicat-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              ing with the HTTP server.  The specified request  will  be  used\\n\"\r\n\"              instead  of  the  method otherwise used (which defaults to GET).\\n\"\r\n\"              Read the HTTP 1.1 specification for  details  and  explanations.\\n\"\r\n\"              Common  additional  HTTP  requests  include  PUT and DELETE, but\\n\"\r\n\"              related technologies like WebDAV offers PROPFIND, COPY, MOVE and\\n\"\r\n\"              more.\\n\"\r\n\"\\n\"\r\n\"              Normally  you  don't  need  this option. All sorts of GET, HEAD,\\n\"\r\n, stdout);\r\n fputs(\r\n\"              POST and PUT requests are rather invoked by using dedicated com-\\n\"\r\n\"              mand line options.\\n\"\r\n\"\\n\"\r\n\"              This  option  only  changes  the  actual  word  used in the HTTP\\n\"\r\n\"              request, it does not alter the way curl behaves. So for  example\\n\"\r\n\"              if  you  want  to make a proper HEAD request, using -X HEAD will\\n\"\r\n\"              not suffice. You need to use the -I, --head option.\\n\"\r\n\"\\n\"\r\n\"              (FTP) Specifies a custom FTP command to use instead of LIST when\\n\"\r\n, stdout);\r\n fputs(\r\n\"              doing file lists with FTP.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       --xattr\\n\"\r\n\"              When  saving  output  to a file, this option tells curl to store\\n\"\r\n\"              certain file metadata in extened file attributes. Currently, the\\n\"\r\n\"              URL is stored in the xdg.origin.url attribute and, for HTTP, the\\n\"\r\n\"              content type is stored in the mime_type attribute. If  the  file\\n\"\r\n, stdout);\r\n fputs(\r\n\"              system  does  not  support  extended  attributes,  a  warning is\\n\"\r\n\"              issued.\\n\"\r\n\"\\n\"\r\n\"       -y, --speed-time <time>\\n\"\r\n\"              If a download is slower than speed-limit bytes per second during\\n\"\r\n\"              a speed-time period, the download gets aborted. If speed-time is\\n\"\r\n\"              used, the default speed-limit will be 1 unless set with -Y.\\n\"\r\n\"\\n\"\r\n\"              This option controls transfers and thus  will  not  affect  slow\\n\"\r\n, stdout);\r\n fputs(\r\n\"              connects  etc.  If this is a concern for you, try the --connect-\\n\"\r\n\"              timeout option.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -Y, --speed-limit <speed>\\n\"\r\n\"              If a download is slower than this given speed (in bytes per sec-\\n\"\r\n\"              ond)  for  speed-time seconds it gets aborted. speed-time is set\\n\"\r\n\"              with -y and is 30 if not set.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n\"       -z/--time-cond <date expression>|<file>\\n\"\r\n\"              (HTTP/FTP) Request a file that has been modified later than  the\\n\"\r\n\"              given  time  and date, or one that has been modified before that\\n\"\r\n\"              time. The <date expression> can be all sorts of date strings  or\\n\"\r\n\"              if it doesn't match any internal ones, it is taken as a filename\\n\"\r\n, stdout);\r\n fputs(\r\n\"              and tries to get  the  modification  date  (mtime)  from  <file>\\n\"\r\n\"              instead.  See  the curl_getdate(3) man pages for date expression\\n\"\r\n\"              details.\\n\"\r\n\"\\n\"\r\n\"              Start the date expression with a dash (-) to make it request for\\n\"\r\n\"              a  document that is older than the given date/time, default is a\\n\"\r\n\"              document that is newer than the specified date/time.\\n\"\r\n\"\\n\"\r\n\"              If this option is used several times, the last one will be used.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       -h, --help\\n\"\r\n\"              Usage help.\\n\"\r\n\"\\n\"\r\n\"       -M, --manual\\n\"\r\n\"              Manual. Display the huge help text.\\n\"\r\n\"\\n\"\r\n\"       -V, --version\\n\"\r\n\"              Displays information about curl and the libcurl version it uses.\\n\"\r\n\"              The first line includes the full version of  curl,  libcurl  and\\n\"\r\n\"              other 3rd party libraries linked with the executable.\\n\"\r\n\"\\n\"\r\n\"              The  second  line (starts with \\\"Protocols:\\\") shows all protocols\\n\"\r\n\"              that libcurl reports to support.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"              The third line (starts with \\\"Features:\\\") shows specific features\\n\"\r\n\"              libcurl reports to offer. Available features include:\\n\"\r\n\"\\n\"\r\n\"              IPv6   You can use IPv6 with this.\\n\"\r\n\"\\n\"\r\n\"              krb4   Krb4 for FTP is supported.\\n\"\r\n\"\\n\"\r\n\"              SSL    HTTPS and FTPS are supported.\\n\"\r\n\"\\n\"\r\n\"              libz   Automatic  decompression of compressed files over HTTP is\\n\"\r\n\"                     supported.\\n\"\r\n\"\\n\"\r\n\"              NTLM   NTLM authentication is supported.\\n\"\r\n\"\\n\"\r\n\"              GSS-Negotiate\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     Negotiate authentication and krb5 for FTP is supported.\\n\"\r\n\"\\n\"\r\n\"              Debug  This curl uses a libcurl built with Debug.  This  enables\\n\"\r\n\"                     more  error-tracking  and memory debugging etc. For curl-\\n\"\r\n\"                     developers only!\\n\"\r\n\"\\n\"\r\n\"              AsynchDNS\\n\"\r\n\"                     This curl uses asynchronous name resolves.\\n\"\r\n\"\\n\"\r\n\"              SPNEGO SPNEGO Negotiate authentication is supported.\\n\"\r\n\"\\n\"\r\n\"              Largefile\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     This curl supports transfers of large files, files larger\\n\"\r\n\"                     than 2GB.\\n\"\r\n\"\\n\"\r\n\"              IDN    This curl supports IDN - international domain names.\\n\"\r\n\"\\n\"\r\n\"              SSPI   SSPI  is  supported. If you use NTLM and set a blank user\\n\"\r\n\"                     name, curl will authenticate with your current  user  and\\n\"\r\n\"                     password.\\n\"\r\n\"\\n\"\r\n\"              TLS-SRP\\n\"\r\n\"                     SRP  (Secure Remote Password) authentication is supported\\n\"\r\n, stdout);\r\n fputs(\r\n\"                     for TLS.\\n\"\r\n\"              Metalink\\n\"\r\n\"                     This curl supports Metalink (both version 3  and  4  (RFC\\n\"\r\n\"                     5854)),  which  describes  mirrors and hashes.  curl will\\n\"\r\n\"                     use mirrors for failover if there are errors (such as the\\n\"\r\n\"                     file or server not being available).\\n\"\r\n\"\\n\"\r\n\"FILES\\n\"\r\n\"       ~/.curlrc\\n\"\r\n\"              Default config file, see -K, --config for details.\\n\"\r\n\"\\n\"\r\n\"ENVIRONMENT\\n\"\r\n, stdout);\r\n fputs(\r\n\"       The environment variables can be specified in lower case or upper case.\\n\"\r\n\"       The lower case version has precedence. http_proxy is an exception as it\\n\"\r\n\"       is only available in lower case.\\n\"\r\n\"\\n\"\r\n\"       Using  an  environment variable to set the proxy has the same effect as\\n\"\r\n\"       using the --proxy option.\\n\"\r\n\"\\n\"\r\n\"       http_proxy [protocol://]<host>[:port]\\n\"\r\n\"              Sets the proxy server to use for HTTP.\\n\"\r\n\"       HTTPS_PROXY [protocol://]<host>[:port]\\n\"\r\n, stdout);\r\n fputs(\r\n\"              Sets the proxy server to use for HTTPS.\\n\"\r\n\"\\n\"\r\n\"       [url-protocol]_PROXY [protocol://]<host>[:port]\\n\"\r\n\"              Sets the proxy server to use for [url-protocol], where the  pro-\\n\"\r\n\"              tocol  is  a  protocol  that curl supports and as specified in a\\n\"\r\n\"              URL. FTP, FTPS, POP3, IMAP, SMTP, LDAP etc.\\n\"\r\n\"\\n\"\r\n\"       ALL_PROXY [protocol://]<host>[:port]\\n\"\r\n\"              Sets the proxy server to use if no  protocol-specific  proxy  is\\n\"\r\n\"              set.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       NO_PROXY <comma-separated list of hosts>\\n\"\r\n\"              list  of  host names that shouldn't go through any proxy. If set\\n\"\r\n\"              to a asterisk '*' only, it matches all hosts.\\n\"\r\n\"\\n\"\r\n\"PROXY PROTOCOL PREFIXES\\n\"\r\n\"       Since curl version 7.21.7, the proxy string may  be  specified  with  a\\n\"\r\n\"       protocol:// prefix to specify alternative proxy protocols.\\n\"\r\n\"\\n\"\r\n\"       If  no  protocol  is  specified  in  the  proxy string or if the string\\n\"\r\n, stdout);\r\n fputs(\r\n\"       doesn't match a supported one, the proxy will be  treated  as  an  HTTP\\n\"\r\n\"       proxy.\\n\"\r\n\"\\n\"\r\n\"       The supported proxy protocol prefixes are as follows:\\n\"\r\n\"\\n\"\r\n\"       socks4://\\n\"\r\n\"              Makes it the equivalent of --socks4\\n\"\r\n\"\\n\"\r\n\"       socks4a://\\n\"\r\n\"              Makes it the equivalent of --socks4a\\n\"\r\n\"\\n\"\r\n\"       socks5://\\n\"\r\n\"              Makes it the equivalent of --socks5\\n\"\r\n\"\\n\"\r\n\"       socks5h://\\n\"\r\n\"              Makes it the equivalent of --socks5-hostname\\n\"\r\n\"\\n\"\r\n\"EXIT CODES\\n\"\r\n, stdout);\r\n fputs(\r\n\"       There  are  a  bunch  of  different error codes and their corresponding\\n\"\r\n\"       error messages that may appear during bad conditions. At  the  time  of\\n\"\r\n\"       this writing, the exit codes are:\\n\"\r\n\"\\n\"\r\n\"       1      Unsupported protocol. This build of curl has no support for this\\n\"\r\n\"              protocol.\\n\"\r\n\"\\n\"\r\n\"       2      Failed to initialize.\\n\"\r\n\"\\n\"\r\n\"       3      URL malformed. The syntax was not correct.\\n\"\r\n\"\\n\"\r\n\"       4      A feature or option that  was  needed  to  perform  the  desired\\n\"\r\n, stdout);\r\n fputs(\r\n\"              request  was  not  enabled  or was explicitly disabled at build-\\n\"\r\n\"              time. To make curl able to do this, you  probably  need  another\\n\"\r\n\"              build of libcurl!\\n\"\r\n\"\\n\"\r\n\"       5      Couldn't  resolve  proxy.  The  given  proxy  host  could not be\\n\"\r\n\"              resolved.\\n\"\r\n\"\\n\"\r\n\"       6      Couldn't resolve host. The given remote host was not resolved.\\n\"\r\n\"\\n\"\r\n\"       7      Failed to connect to host.\\n\"\r\n\"\\n\"\r\n\"       8      FTP weird server reply.  The  server  sent  data  curl  couldn't\\n\"\r\n, stdout);\r\n fputs(\r\n\"              parse.\\n\"\r\n\"\\n\"\r\n\"       9      FTP  access  denied. The server denied login or denied access to\\n\"\r\n\"              the particular resource or directory you wanted to  reach.  Most\\n\"\r\n\"              often  you  tried to change to a directory that doesn't exist on\\n\"\r\n\"              the server.\\n\"\r\n\"\\n\"\r\n\"       11     FTP weird PASS reply. Curl couldn't parse the reply sent to  the\\n\"\r\n\"              PASS request.\\n\"\r\n\"\\n\"\r\n\"       13     FTP  weird PASV reply, Curl couldn't parse the reply sent to the\\n\"\r\n, stdout);\r\n fputs(\r\n\"              PASV request.\\n\"\r\n\"\\n\"\r\n\"       14     FTP weird 227 format.  Curl  couldn't  parse  the  227-line  the\\n\"\r\n\"              server sent.\\n\"\r\n\"\\n\"\r\n\"       15     FTP  can't  get host. Couldn't resolve the host IP we got in the\\n\"\r\n\"              227-line.\\n\"\r\n\"\\n\"\r\n\"       17     FTP couldn't set binary.  Couldn't  change  transfer  method  to\\n\"\r\n\"              binary.\\n\"\r\n\"\\n\"\r\n\"       18     Partial file. Only a part of the file was transferred.\\n\"\r\n\"\\n\"\r\n\"       19     FTP  couldn't download/access the given file, the RETR (or simi-\\n\"\r\n, stdout);\r\n fputs(\r\n\"              lar) command failed.\\n\"\r\n\"\\n\"\r\n\"       21     FTP quote error. A quote command returned error from the server.\\n\"\r\n\"       22     HTTP page not retrieved. The requested  url  was  not  found  or\\n\"\r\n\"              returned  another  error  with  the HTTP error code being 400 or\\n\"\r\n\"              above. This return code only appears if -f, --fail is used.\\n\"\r\n\"\\n\"\r\n\"       23     Write error. Curl couldn't write data to a local  filesystem  or\\n\"\r\n\"              similar.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       25     FTP  couldn't  STOR  file. The server denied the STOR operation,\\n\"\r\n\"              used for FTP uploading.\\n\"\r\n\"\\n\"\r\n\"       26     Read error. Various reading problems.\\n\"\r\n\"\\n\"\r\n\"       27     Out of memory. A memory allocation request failed.\\n\"\r\n\"\\n\"\r\n\"       28     Operation timeout. The specified  time-out  period  was  reached\\n\"\r\n\"              according to the conditions.\\n\"\r\n\"\\n\"\r\n\"       30     FTP  PORT  failed.  The PORT command failed. Not all FTP servers\\n\"\r\n, stdout);\r\n fputs(\r\n\"              support the PORT  command,  try  doing  a  transfer  using  PASV\\n\"\r\n\"              instead!\\n\"\r\n\"\\n\"\r\n\"       31     FTP  couldn't use REST. The REST command failed. This command is\\n\"\r\n\"              used for resumed FTP transfers.\\n\"\r\n\"\\n\"\r\n\"       33     HTTP range error. The range \\\"command\\\" didn't work.\\n\"\r\n\"\\n\"\r\n\"       34     HTTP post error. Internal post-request generation error.\\n\"\r\n\"\\n\"\r\n\"       35     SSL connect error. The SSL handshaking failed.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       36     FTP bad download resume. Couldn't continue  an  earlier  aborted\\n\"\r\n\"              download.\\n\"\r\n\"\\n\"\r\n\"       37     FILE couldn't read file. Failed to open the file. Permissions?\\n\"\r\n\"\\n\"\r\n\"       38     LDAP cannot bind. LDAP bind operation failed.\\n\"\r\n\"\\n\"\r\n\"       39     LDAP search failed.\\n\"\r\n\"\\n\"\r\n\"       41     Function not found. A required LDAP function was not found.\\n\"\r\n\"\\n\"\r\n\"       42     Aborted by callback. An application told curl to abort the oper-\\n\"\r\n\"              ation.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       43     Internal error. A function was called with a bad parameter.\\n\"\r\n\"\\n\"\r\n\"       45     Interface error. A specified outgoing  interface  could  not  be\\n\"\r\n\"              used.\\n\"\r\n\"\\n\"\r\n\"       47     Too many redirects. When following redirects, curl hit the maxi-\\n\"\r\n\"              mum amount.\\n\"\r\n\"\\n\"\r\n\"       48     Unknown option specified to libcurl.  This  indicates  that  you\\n\"\r\n\"              passed  a weird option to curl that was passed on to libcurl and\\n\"\r\n\"              rejected. Read up in the manual!\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       49     Malformed telnet option.\\n\"\r\n\"\\n\"\r\n\"       51     The peer's SSL certificate or SSH MD5 fingerprint was not OK.\\n\"\r\n\"\\n\"\r\n\"       52     The server didn't reply anything, which here  is  considered  an\\n\"\r\n\"              error.\\n\"\r\n\"\\n\"\r\n\"       53     SSL crypto engine not found.\\n\"\r\n\"\\n\"\r\n\"       54     Cannot set SSL crypto engine as default.\\n\"\r\n\"\\n\"\r\n\"       55     Failed sending network data.\\n\"\r\n\"\\n\"\r\n\"       56     Failure in receiving network data.\\n\"\r\n\"\\n\"\r\n\"       58     Problem with the local certificate.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       59     Couldn't use specified SSL cipher.\\n\"\r\n\"\\n\"\r\n\"       60     Peer  certificate cannot be authenticated with known CA certifi-\\n\"\r\n\"              cates.\\n\"\r\n\"\\n\"\r\n\"       61     Unrecognized transfer encoding.\\n\"\r\n\"\\n\"\r\n\"       62     Invalid LDAP URL.\\n\"\r\n\"\\n\"\r\n\"       63     Maximum file size exceeded.\\n\"\r\n\"\\n\"\r\n\"       64     Requested FTP SSL level failed.\\n\"\r\n\"\\n\"\r\n\"       65     Sending the data requires a rewind that failed.\\n\"\r\n\"\\n\"\r\n\"       66     Failed to initialise SSL Engine.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       67     The user name, password, or similar was not  accepted  and  curl\\n\"\r\n\"              failed to log in.\\n\"\r\n\"\\n\"\r\n\"       68     File not found on TFTP server.\\n\"\r\n\"\\n\"\r\n\"       69     Permission problem on TFTP server.\\n\"\r\n\"\\n\"\r\n\"       70     Out of disk space on TFTP server.\\n\"\r\n\"\\n\"\r\n\"       71     Illegal TFTP operation.\\n\"\r\n\"\\n\"\r\n\"       72     Unknown TFTP transfer ID.\\n\"\r\n\"\\n\"\r\n\"       73     File already exists (TFTP).\\n\"\r\n\"\\n\"\r\n\"       74     No such user (TFTP).\\n\"\r\n\"\\n\"\r\n\"       75     Character conversion failed.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       76     Character conversion functions required.\\n\"\r\n\"\\n\"\r\n\"       77     Problem with reading the SSL CA cert (path? access rights?).\\n\"\r\n\"\\n\"\r\n\"       78     The resource referenced in the URL does not exist.\\n\"\r\n\"\\n\"\r\n\"       79     An unspecified error occurred during the SSH session.\\n\"\r\n\"\\n\"\r\n\"       80     Failed to shut down the SSL connection.\\n\"\r\n\"\\n\"\r\n\"       82     Could  not  load  CRL  file,  missing  or wrong format (added in\\n\"\r\n\"              7.19.0).\\n\"\r\n\"\\n\"\r\n\"       83     Issuer check failed (added in 7.19.0).\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"       84     The FTP PRET command failed\\n\"\r\n\"\\n\"\r\n\"       85     RTSP: mismatch of CSeq numbers\\n\"\r\n\"\\n\"\r\n\"       86     RTSP: mismatch of Session Identifiers\\n\"\r\n\"\\n\"\r\n\"       87     unable to parse FTP file list\\n\"\r\n\"\\n\"\r\n\"       88     FTP chunk callback reported error\\n\"\r\n\"\\n\"\r\n\"       XX     More error codes will appear here in future releases. The exist-\\n\"\r\n\"              ing ones are meant to never change.\\n\"\r\n\"\\n\"\r\n\"AUTHORS / CONTRIBUTORS\\n\"\r\n\"       Daniel  Stenberg is the main author, but the whole list of contributors\\n\"\r\n, stdout);\r\n fputs(\r\n\"       is found in the separate THANKS file.\\n\"\r\n\"\\n\"\r\n\"WWW\\n\"\r\n\"       http://curl.haxx.se\\n\"\r\n\"\\n\"\r\n\"FTP\\n\"\r\n\"       ftp://ftp.sunet.se/pub/www/utilities/curl/\\n\"\r\n\"\\n\"\r\n\"SEE ALSO\\n\"\r\n\"       ftp(1), wget(1)\\n\"\r\n\"\\n\"\r\n\"LATEST VERSION\\n\"\r\n\"\\n\"\r\n\"  You always find news about what's going on as well as the latest versions\\n\"\r\n\"  from the curl web pages, located at:\\n\"\r\n\"\\n\"\r\n\"        http://curl.haxx.se\\n\"\r\n\"\\n\"\r\n\"SIMPLE USAGE\\n\"\r\n\"\\n\"\r\n\"  Get the main page from Netscape's web-server:\\n\"\r\n\"\\n\"\r\n\"        curl http://www.netscape.com/\\n\"\r\n\"\\n\"\r\n\"  Get the README file the user's home directory at funet's ftp-server:\\n\"\r\n, stdout);\r\n fputs(\r\n\"\\n\"\r\n\"        curl ftp://ftp.funet.fi/README\\n\"\r\n\"\\n\"\r\n\"  Get a web page from a server using port 8000:\\n\"\r\n\"\\n\"\r\n\"        curl http://www.weirdserver.com:8000/\\n\"\r\n\"\\n\"\r\n\"  Get a directory listing of an FTP site:\\n\"\r\n\"\\n\"\r\n\"        curl ftp://cool.haxx.se/\\n\"\r\n\"\\n\"\r\n\"  Get the definition of curl from a dictionary:\\n\"\r\n\"\\n\"\r\n\"        curl dict://dict.org/m:curl\\n\"\r\n\"\\n\"\r\n\"  Fetch two documents at once:\\n\"\r\n\"\\n\"\r\n\"        curl ftp://cool.haxx.se/ http://www.weirdserver.com:8000/\\n\"\r\n\"\\n\"\r\n\"  Get a file off an FTPS server:\\n\"\r\n\"\\n\"\r\n\"        curl ftps://files.are.secure.com/secrets.txt\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  or use the more appropriate FTPS way to get the same file:\\n\"\r\n\"\\n\"\r\n\"        curl --ftp-ssl ftp://files.are.secure.com/secrets.txt\\n\"\r\n\"\\n\"\r\n\"  Get a file from an SSH server using SFTP:\\n\"\r\n\"\\n\"\r\n\"        curl -u username sftp://shell.example.com/etc/issue\\n\"\r\n\"\\n\"\r\n\"  Get a file from an SSH server using SCP using a private key to authenticate:\\n\"\r\n\"\\n\"\r\n\"        curl -u username: --key ~/.ssh/id_dsa --pubkey ~/.ssh/id_dsa.pub \\\\\\n\"\r\n\"            scp://shell.example.com/~/personal.txt\\n\"\r\n\"\\n\"\r\n\"  Get the main page from an IPv6 web server:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -g \\\"http://[2001:1890:1112:1::20]/\\\"\\n\"\r\n\"\\n\"\r\n\"DOWNLOAD TO A FILE\\n\"\r\n\"\\n\"\r\n\"  Get a web page and store in a local file with a specific name:\\n\"\r\n\"\\n\"\r\n\"        curl -o thatpage.html http://www.netscape.com/\\n\"\r\n\"\\n\"\r\n\"  Get a web page and store in a local file, make the local file get the name\\n\"\r\n\"  of the remote document (if no file name part is specified in the URL, this\\n\"\r\n\"  will fail):\\n\"\r\n\"\\n\"\r\n\"        curl -O http://www.netscape.com/index.html\\n\"\r\n\"\\n\"\r\n\"  Fetch two files and store them with their remote names:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -O www.haxx.se/index.html -O curl.haxx.se/download.html\\n\"\r\n\"\\n\"\r\n\"USING PASSWORDS\\n\"\r\n\"\\n\"\r\n\" FTP\\n\"\r\n\"\\n\"\r\n\"   To ftp files using name+passwd, include them in the URL like:\\n\"\r\n\"\\n\"\r\n\"        curl ftp://name:passwd@machine.domain:port/full/path/to/file\\n\"\r\n\"\\n\"\r\n\"   or specify them with the -u flag like\\n\"\r\n\"\\n\"\r\n\"        curl -u name:passwd ftp://machine.domain:port/full/path/to/file\\n\"\r\n\"\\n\"\r\n\" FTPS\\n\"\r\n\"\\n\"\r\n\"   It is just like for FTP, but you may also want to specify and use\\n\"\r\n\"   SSL-specific options for certificates etc.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"   Note that using FTPS:// as prefix is the \\\"implicit\\\" way as described in the\\n\"\r\n\"   standards while the recommended \\\"explicit\\\" way is done by using FTP:// and\\n\"\r\n\"   the --ftp-ssl option.\\n\"\r\n\"\\n\"\r\n\" SFTP / SCP\\n\"\r\n\"\\n\"\r\n\"   This is similar to FTP, but you can specify a private key to use instead of\\n\"\r\n\"   a password. Note that the private key may itself be protected by a password\\n\"\r\n\"   that is unrelated to the login password of the remote system.  If you\\n\"\r\n\"   provide a private key file you must also provide a public key file.\\n\"\r\n, stdout);\r\n fputs(\r\n\"\\n\"\r\n\" HTTP\\n\"\r\n\"\\n\"\r\n\"   Curl also supports user and password in HTTP URLs, thus you can pick a file\\n\"\r\n\"   like:\\n\"\r\n\"\\n\"\r\n\"        curl http://name:passwd@machine.domain/full/path/to/file\\n\"\r\n\"\\n\"\r\n\"   or specify user and password separately like in\\n\"\r\n\"\\n\"\r\n\"        curl -u name:passwd http://machine.domain/full/path/to/file\\n\"\r\n\"\\n\"\r\n\"   HTTP offers many different methods of authentication and curl supports\\n\"\r\n\"   several: Basic, Digest, NTLM and Negotiate. Without telling which method to\\n\"\r\n, stdout);\r\n fputs(\r\n\"   use, curl defaults to Basic. You can also ask curl to pick the most secure\\n\"\r\n\"   ones out of the ones that the server accepts for the given URL, by using\\n\"\r\n\"   --anyauth.\\n\"\r\n\"\\n\"\r\n\"   NOTE! According to the URL specification, HTTP URLs can not contain a user\\n\"\r\n\"   and password, so that style will not work when using curl via a proxy, even\\n\"\r\n\"   though curl allows it at other times. When using a proxy, you _must_ use\\n\"\r\n\"   the -u style for user and password.\\n\"\r\n\"\\n\"\r\n\" HTTPS\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"   Probably most commonly used with private certificates, as explained below.\\n\"\r\n\"\\n\"\r\n\"PROXY\\n\"\r\n\"\\n\"\r\n\" curl supports both HTTP and SOCKS proxy servers, with optional authentication.\\n\"\r\n\" It does not have special support for FTP proxy servers since there are no\\n\"\r\n\" standards for those, but it can still be made to work with many of them. You\\n\"\r\n\" can also use both HTTP and SOCKS proxies to transfer files to and from FTP\\n\"\r\n\" servers.\\n\"\r\n\"\\n\"\r\n\" Get an ftp file using an HTTP proxy named my-proxy that uses port 888:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -x my-proxy:888 ftp://ftp.leachsite.com/README\\n\"\r\n\"\\n\"\r\n\" Get a file from an HTTP server that requires user and password, using the\\n\"\r\n\" same proxy as above:\\n\"\r\n\"\\n\"\r\n\"        curl -u user:passwd -x my-proxy:888 http://www.get.this/\\n\"\r\n\"\\n\"\r\n\" Some proxies require special authentication. Specify by using -U as above:\\n\"\r\n\"\\n\"\r\n\"        curl -U user:passwd -x my-proxy:888 http://www.get.this/\\n\"\r\n\"\\n\"\r\n\" A comma-separated list of hosts and domains which do not use the proxy can\\n\"\r\n\" be specified as:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl --noproxy localhost,get.this -x my-proxy:888 http://www.get.this/\\n\"\r\n\"\\n\"\r\n\" If the proxy is specified with --proxy1.0 instead of --proxy or -x, then\\n\"\r\n\" curl will use HTTP/1.0 instead of HTTP/1.1 for any CONNECT attempts.\\n\"\r\n\"\\n\"\r\n\" curl also supports SOCKS4 and SOCKS5 proxies with --socks4 and --socks5.\\n\"\r\n\"\\n\"\r\n\" See also the environment variables Curl supports that offer further proxy\\n\"\r\n\" control.\\n\"\r\n\"\\n\"\r\n\" Most FTP proxy servers are set up to appear as a normal FTP server from the\\n\"\r\n, stdout);\r\n fputs(\r\n\" client's perspective, with special commands to select the remote FTP server.\\n\"\r\n\" curl supports the -u, -Q and --ftp-account options that can be used to\\n\"\r\n\" set up transfers through many FTP proxies. For example, a file can be\\n\"\r\n\" uploaded to a remote FTP server using a Blue Coat FTP proxy with the\\n\"\r\n\" options:\\n\"\r\n\"\\n\"\r\n\"   curl -u \\\"Remote-FTP-Username@remote.ftp.server Proxy-Username:Remote-Pass\\\" \\\\\\n\"\r\n\"    --ftp-account Proxy-Password --upload-file local-file \\\\\\n\"\r\n\"    ftp://my-ftp.proxy.server:21/remote/upload/path/\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\" See the manual for your FTP proxy to determine the form it expects to set up\\n\"\r\n\" transfers, and curl's -v option to see exactly what curl is sending.\\n\"\r\n\"\\n\"\r\n\"RANGES\\n\"\r\n\"\\n\"\r\n\"  HTTP 1.1 introduced byte-ranges. Using this, a client can request\\n\"\r\n\"  to get only one or more subparts of a specified document. Curl supports\\n\"\r\n\"  this with the -r flag.\\n\"\r\n\"\\n\"\r\n\"  Get the first 100 bytes of a document:\\n\"\r\n\"\\n\"\r\n\"        curl -r 0-99 http://www.get.this/\\n\"\r\n\"\\n\"\r\n\"  Get the last 500 bytes of a document:\\n\"\r\n\"\\n\"\r\n\"        curl -r -500 http://www.get.this/\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Curl also supports simple ranges for FTP files as well. Then you can only\\n\"\r\n\"  specify start and stop position.\\n\"\r\n\"\\n\"\r\n\"  Get the first 100 bytes of a document using FTP:\\n\"\r\n\"\\n\"\r\n\"        curl -r 0-99 ftp://www.get.this/README\\n\"\r\n\"\\n\"\r\n\"UPLOADING\\n\"\r\n\"\\n\"\r\n\" FTP / FTPS / SFTP / SCP\\n\"\r\n\"\\n\"\r\n\"  Upload all data on stdin to a specified server:\\n\"\r\n\"\\n\"\r\n\"        curl -T - ftp://ftp.upload.com/myfile\\n\"\r\n\"\\n\"\r\n\"  Upload data from a specified file, login with user and password:\\n\"\r\n\"\\n\"\r\n\"        curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Upload a local file to the remote site, and use the local file name at the remote\\n\"\r\n\"  site too:\\n\"\r\n\"\\n\"\r\n\"        curl -T uploadfile -u user:passwd ftp://ftp.upload.com/\\n\"\r\n\"\\n\"\r\n\"  Upload a local file to get appended to the remote file:\\n\"\r\n\"\\n\"\r\n\"        curl -T localfile -a ftp://ftp.upload.com/remotefile\\n\"\r\n\"\\n\"\r\n\"  Curl also supports ftp upload through a proxy, but only if the proxy is\\n\"\r\n\"  configured to allow that kind of tunneling. If it does, you can run curl in\\n\"\r\n\"  a fashion similar to:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl --proxytunnel -x proxy:port -T localfile ftp.upload.com\\n\"\r\n\"\\n\"\r\n\" HTTP\\n\"\r\n\"\\n\"\r\n\"  Upload all data on stdin to a specified HTTP site:\\n\"\r\n\"\\n\"\r\n\"        curl -T - http://www.upload.com/myfile\\n\"\r\n\"\\n\"\r\n\"  Note that the HTTP server must have been configured to accept PUT before\\n\"\r\n\"  this can be done successfully.\\n\"\r\n\"\\n\"\r\n\"  For other ways to do HTTP data upload, see the POST section below.\\n\"\r\n\"\\n\"\r\n\"VERBOSE / DEBUG\\n\"\r\n\"\\n\"\r\n\"  If curl fails where it isn't supposed to, if the servers don't let you in,\\n\"\r\n, stdout);\r\n fputs(\r\n\"  if you can't understand the responses: use the -v flag to get verbose\\n\"\r\n\"  fetching. Curl will output lots of info and what it sends and receives in\\n\"\r\n\"  order to let the user see all client-server interaction (but it won't show\\n\"\r\n\"  you the actual data).\\n\"\r\n\"\\n\"\r\n\"        curl -v ftp://ftp.upload.com/\\n\"\r\n\"\\n\"\r\n\"  To get even more details and information on what curl does, try using the\\n\"\r\n\"  --trace or --trace-ascii options with a given file name to log to, like\\n\"\r\n\"  this:\\n\"\r\n\"\\n\"\r\n\"        curl --trace trace.txt www.haxx.se\\n\"\r\n\"\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"DETAILED INFORMATION\\n\"\r\n\"\\n\"\r\n\"  Different protocols provide different ways of getting detailed information\\n\"\r\n\"  about specific files/documents. To get curl to show detailed information\\n\"\r\n\"  about a single file, you should use -I/--head option. It displays all\\n\"\r\n\"  available info on a single file for HTTP and FTP. The HTTP information is a\\n\"\r\n\"  lot more extensive.\\n\"\r\n\"\\n\"\r\n\"  For HTTP, you can get the header information (the same as -I would show)\\n\"\r\n\"  shown before the data by using -i/--include. Curl understands the\\n\"\r\n, stdout);\r\n fputs(\r\n\"  -D/--dump-header option when getting files from both FTP and HTTP, and it\\n\"\r\n\"  will then store the headers in the specified file.\\n\"\r\n\"\\n\"\r\n\"  Store the HTTP headers in a separate file (headers.txt in the example):\\n\"\r\n\"\\n\"\r\n\"        curl --dump-header headers.txt curl.haxx.se\\n\"\r\n\"\\n\"\r\n\"  Note that headers stored in a separate file can be very useful at a later\\n\"\r\n\"  time if you want curl to use cookies sent by the server. More about that in\\n\"\r\n\"  the cookies section.\\n\"\r\n\"\\n\"\r\n\"POST (HTTP)\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  It's easy to post data using curl. This is done using the -d <data>\\n\"\r\n\"  option.  The post data must be urlencoded.\\n\"\r\n\"\\n\"\r\n\"  Post a simple \\\"name\\\" and \\\"phone\\\" guestbook.\\n\"\r\n\"\\n\"\r\n\"        curl -d \\\"name=Rafael%20Sagula&phone=3320780\\\" \\\\\\n\"\r\n\"                http://www.where.com/guest.cgi\\n\"\r\n\"\\n\"\r\n\"  How to post a form with curl, lesson #1:\\n\"\r\n\"\\n\"\r\n\"  Dig out all the <input> tags in the form that you want to fill in. (There's\\n\"\r\n\"  a perl program called formfind.pl on the curl site that helps with this).\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  If there's a \\\"normal\\\" post, you use -d to post. -d takes a full \\\"post\\n\"\r\n\"  string\\\", which is in the format\\n\"\r\n\"\\n\"\r\n\"        <variable1>=<data1>&<variable2>=<data2>&...\\n\"\r\n\"\\n\"\r\n\"  The 'variable' names are the names set with \\\"name=\\\" in the <input> tags, and\\n\"\r\n\"  the data is the contents you want to fill in for the inputs. The data *must*\\n\"\r\n\"  be properly URL encoded. That means you replace space with + and that you\\n\"\r\n\"  replace weird letters with %XX where XX is the hexadecimal representation of\\n\"\r\n, stdout);\r\n fputs(\r\n\"  the letter's ASCII code.\\n\"\r\n\"\\n\"\r\n\"  Example:\\n\"\r\n\"\\n\"\r\n\"  (page located at http://www.formpost.com/getthis/\\n\"\r\n\"\\n\"\r\n\"        <form action=\\\"post.cgi\\\" method=\\\"post\\\">\\n\"\r\n\"        <input name=user size=10>\\n\"\r\n\"        <input name=pass type=password size=10>\\n\"\r\n\"        <input name=id type=hidden value=\\\"blablabla\\\">\\n\"\r\n\"        <input name=ding value=\\\"submit\\\">\\n\"\r\n\"        </form>\\n\"\r\n\"\\n\"\r\n\"  We want to enter user 'foobar' with password '12345'.\\n\"\r\n\"\\n\"\r\n\"  To post to this, you enter a curl command line like:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -d \\\"user=foobar&pass=12345&id=blablabla&ding=submit\\\"  (continues)\\n\"\r\n\"          http://www.formpost.com/getthis/post.cgi\\n\"\r\n\"\\n\"\r\n\"\\n\"\r\n\"  While -d uses the application/x-www-form-urlencoded mime-type, generally\\n\"\r\n\"  understood by CGI's and similar, curl also supports the more capable\\n\"\r\n\"  multipart/form-data type. This latter type supports things like file upload.\\n\"\r\n\"\\n\"\r\n\"  -F accepts parameters like -F \\\"name=contents\\\". If you want the contents to\\n\"\r\n, stdout);\r\n fputs(\r\n\"  be read from a file, use <@filename> as contents. When specifying a file,\\n\"\r\n\"  you can also specify the file content type by appending ';type=<mime type>'\\n\"\r\n\"  to the file name. You can also post the contents of several files in one\\n\"\r\n\"  field.  For example, the field name 'coolfiles' is used to send three files,\\n\"\r\n\"  with different content types using the following syntax:\\n\"\r\n\"\\n\"\r\n\"        curl -F \\\"coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html\\\" \\\\\\n\"\r\n\"        http://www.post.com/postit.cgi\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  If the content-type is not specified, curl will try to guess from the file\\n\"\r\n\"  extension (it only knows a few), or use the previously specified type (from\\n\"\r\n\"  an earlier file if several files are specified in a list) or else it will\\n\"\r\n\"  use the default type 'application/octet-stream'.\\n\"\r\n\"\\n\"\r\n\"  Emulate a fill-in form with -F. Let's say you fill in three fields in a\\n\"\r\n\"  form. One field is a file name which to post, one field is your name and one\\n\"\r\n, stdout);\r\n fputs(\r\n\"  field is a file description. We want to post the file we have written named\\n\"\r\n\"  \\\"cooltext.txt\\\". To let curl do the posting of this data instead of your\\n\"\r\n\"  favourite browser, you have to read the HTML source of the form page and\\n\"\r\n\"  find the names of the input fields. In our example, the input field names\\n\"\r\n\"  are 'file', 'yourname' and 'filedescription'.\\n\"\r\n\"\\n\"\r\n\"        curl -F \\\"file=@cooltext.txt\\\" -F \\\"yourname=Daniel\\\" \\\\\\n\"\r\n\"             -F \\\"filedescription=Cool text file with cool text inside\\\" \\\\\\n\"\r\n, stdout);\r\n fputs(\r\n\"             http://www.post.com/postit.cgi\\n\"\r\n\"\\n\"\r\n\"  To send two files in one post you can do it in two ways:\\n\"\r\n\"\\n\"\r\n\"  1. Send multiple files in a single \\\"field\\\" with a single field name:\\n\"\r\n\"\\n\"\r\n\"        curl -F \\\"pictures=@dog.gif,cat.gif\\\"\\n\"\r\n\"\\n\"\r\n\"  2. Send two fields with two field names:\\n\"\r\n\"\\n\"\r\n\"        curl -F \\\"docpicture=@dog.gif\\\" -F \\\"catpicture=@cat.gif\\\"\\n\"\r\n\"\\n\"\r\n\"  To send a field value literally without interpreting a leading '@'\\n\"\r\n\"  or '<', or an embedded ';type=', use --form-string instead of\\n\"\r\n, stdout);\r\n fputs(\r\n\"  -F. This is recommended when the value is obtained from a user or\\n\"\r\n\"  some other unpredictable source. Under these circumstances, using\\n\"\r\n\"  -F instead of --form-string would allow a user to trick curl into\\n\"\r\n\"  uploading a file.\\n\"\r\n\"\\n\"\r\n\"REFERRER\\n\"\r\n\"\\n\"\r\n\"  An HTTP request has the option to include information about which address\\n\"\r\n\"  referred it to the actual page.  Curl allows you to specify the\\n\"\r\n\"  referrer to be used on the command line. It is especially useful to\\n\"\r\n, stdout);\r\n fputs(\r\n\"  fool or trick stupid servers or CGI scripts that rely on that information\\n\"\r\n\"  being available or contain certain data.\\n\"\r\n\"\\n\"\r\n\"        curl -e www.coolsite.com http://www.showme.com/\\n\"\r\n\"\\n\"\r\n\"  NOTE: The Referer: [sic] field is defined in the HTTP spec to be a full URL.\\n\"\r\n\"\\n\"\r\n\"USER AGENT\\n\"\r\n\"\\n\"\r\n\"  An HTTP request has the option to include information about the browser\\n\"\r\n\"  that generated the request. Curl allows it to be specified on the command\\n\"\r\n\"  line. It is especially useful to fool or trick stupid servers or CGI\\n\"\r\n, stdout);\r\n fputs(\r\n\"  scripts that only accept certain browsers.\\n\"\r\n\"\\n\"\r\n\"  Example:\\n\"\r\n\"\\n\"\r\n\"  curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/\\n\"\r\n\"\\n\"\r\n\"  Other common strings:\\n\"\r\n\"    'Mozilla/3.0 (Win95; I)'     Netscape Version 3 for Windows 95\\n\"\r\n\"    'Mozilla/3.04 (Win95; U)'    Netscape Version 3 for Windows 95\\n\"\r\n\"    'Mozilla/2.02 (OS/2; U)'     Netscape Version 2 for OS/2\\n\"\r\n\"    'Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)'           NS for AIX\\n\"\r\n\"    'Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)'      NS for Linux\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Note that Internet Explorer tries hard to be compatible in every way:\\n\"\r\n\"    'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)'    MSIE for W95\\n\"\r\n\"\\n\"\r\n\"  Mozilla is not the only possible User-Agent name:\\n\"\r\n\"    'Konqueror/1.0'             KDE File Manager desktop client\\n\"\r\n\"    'Lynx/2.7.1 libwww-FM/2.14' Lynx command line browser\\n\"\r\n\"\\n\"\r\n\"COOKIES\\n\"\r\n\"\\n\"\r\n\"  Cookies are generally used by web servers to keep state information at the\\n\"\r\n\"  client's side. The server sets cookies by sending a response line in the\\n\"\r\n, stdout);\r\n fputs(\r\n\"  headers that looks like 'Set-Cookie: <data>' where the data part then\\n\"\r\n\"  typically contains a set of NAME=VALUE pairs (separated by semicolons ';'\\n\"\r\n\"  like \\\"NAME1=VALUE1; NAME2=VALUE2;\\\"). The server can also specify for what\\n\"\r\n\"  path the \\\"cookie\\\" should be used for (by specifying \\\"path=value\\\"), when the\\n\"\r\n\"  cookie should expire (\\\"expire=DATE\\\"), for what domain to use it\\n\"\r\n\"  (\\\"domain=NAME\\\") and if it should be used on secure connections only\\n\"\r\n\"  (\\\"secure\\\").\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  If you've received a page from a server that contains a header like:\\n\"\r\n\"        Set-Cookie: sessionid=boo123; path=\\\"/foo\\\";\\n\"\r\n\"\\n\"\r\n\"  it means the server wants that first pair passed on when we get anything in\\n\"\r\n\"  a path beginning with \\\"/foo\\\".\\n\"\r\n\"\\n\"\r\n\"  Example, get a page that wants my name passed in a cookie:\\n\"\r\n\"\\n\"\r\n\"        curl -b \\\"name=Daniel\\\" www.sillypage.com\\n\"\r\n\"\\n\"\r\n\"  Curl also has the ability to use previously received cookies in following\\n\"\r\n\"  sessions. If you get cookies from a server and store them in a file in a\\n\"\r\n, stdout);\r\n fputs(\r\n\"  manner similar to:\\n\"\r\n\"\\n\"\r\n\"        curl --dump-header headers www.example.com\\n\"\r\n\"\\n\"\r\n\"  ... you can then in a second connect to that (or another) site, use the\\n\"\r\n\"  cookies from the 'headers' file like:\\n\"\r\n\"\\n\"\r\n\"        curl -b headers www.example.com\\n\"\r\n\"\\n\"\r\n\"  While saving headers to a file is a working way to store cookies, it is\\n\"\r\n\"  however error-prone and not the preferred way to do this. Instead, make curl\\n\"\r\n\"  save the incoming cookies using the well-known netscape cookie format like\\n\"\r\n\"  this:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -c cookies.txt www.example.com\\n\"\r\n\"\\n\"\r\n\"  Note that by specifying -b you enable the \\\"cookie awareness\\\" and with -L\\n\"\r\n\"  you can make curl follow a location: (which often is used in combination\\n\"\r\n\"  with cookies). So that if a site sends cookies and a location, you can\\n\"\r\n\"  use a non-existing file to trigger the cookie awareness like:\\n\"\r\n\"\\n\"\r\n\"        curl -L -b empty.txt www.example.com\\n\"\r\n\"\\n\"\r\n\"  The file to read cookies from must be formatted using plain HTTP headers OR\\n\"\r\n, stdout);\r\n fputs(\r\n\"  as netscape's cookie file. Curl will determine what kind it is based on the\\n\"\r\n\"  file contents.  In the above command, curl will parse the header and store\\n\"\r\n\"  the cookies received from www.example.com.  curl will send to the server the\\n\"\r\n\"  stored cookies which match the request as it follows the location.  The\\n\"\r\n\"  file \\\"empty.txt\\\" may be a nonexistent file.\\n\"\r\n\"\\n\"\r\n\"  Alas, to both read and write cookies from a netscape cookie file, you can\\n\"\r\n\"  set both -b and -c to use the same file:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -b cookies.txt -c cookies.txt www.example.com\\n\"\r\n\"\\n\"\r\n\"PROGRESS METER\\n\"\r\n\"\\n\"\r\n\"  The progress meter exists to show a user that something actually is\\n\"\r\n\"  happening. The different fields in the output have the following meaning:\\n\"\r\n\"\\n\"\r\n\"  % Total    % Received % Xferd  Average Speed          Time             Curr.\\n\"\r\n\"                                 Dload  Upload Total    Current  Left    Speed\\n\"\r\n\"  0  151M    0 38608    0     0   9406      0  4:41:43  0:00:04  4:41:39  9287\\n\"\r\n\"\\n\"\r\n\"  From left-to-right:\\n\"\r\n, stdout);\r\n fputs(\r\n\"   %             - percentage completed of the whole transfer\\n\"\r\n\"   Total         - total size of the whole expected transfer\\n\"\r\n\"   %             - percentage completed of the download\\n\"\r\n\"   Received      - currently downloaded amount of bytes\\n\"\r\n\"   %             - percentage completed of the upload\\n\"\r\n\"   Xferd         - currently uploaded amount of bytes\\n\"\r\n\"   Average Speed\\n\"\r\n\"   Dload         - the average transfer speed of the download\\n\"\r\n\"   Average Speed\\n\"\r\n\"   Upload        - the average transfer speed of the upload\\n\"\r\n, stdout);\r\n fputs(\r\n\"   Time Total    - expected time to complete the operation\\n\"\r\n\"   Time Current  - time passed since the invoke\\n\"\r\n\"   Time Left     - expected time left to completion\\n\"\r\n\"   Curr.Speed    - the average transfer speed the last 5 seconds (the first\\n\"\r\n\"                   5 seconds of a transfer is based on less time of course.)\\n\"\r\n\"\\n\"\r\n\"  The -# option will display a totally different progress bar that doesn't\\n\"\r\n\"  need much explanation!\\n\"\r\n\"\\n\"\r\n\"SPEED LIMIT\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Curl allows the user to set the transfer speed conditions that must be met\\n\"\r\n\"  to let the transfer keep going. By using the switch -y and -Y you\\n\"\r\n\"  can make curl abort transfers if the transfer speed is below the specified\\n\"\r\n\"  lowest limit for a specified time.\\n\"\r\n\"\\n\"\r\n\"  To have curl abort the download if the speed is slower than 3000 bytes per\\n\"\r\n\"  second for 1 minute, run:\\n\"\r\n\"\\n\"\r\n\"        curl -Y 3000 -y 60 www.far-away-site.com\\n\"\r\n\"\\n\"\r\n\"  This can very well be used in combination with the overall time limit, so\\n\"\r\n, stdout);\r\n fputs(\r\n\"  that the above operation must be completed in whole within 30 minutes:\\n\"\r\n\"\\n\"\r\n\"        curl -m 1800 -Y 3000 -y 60 www.far-away-site.com\\n\"\r\n\"\\n\"\r\n\"  Forcing curl not to transfer data faster than a given rate is also possible,\\n\"\r\n\"  which might be useful if you're using a limited bandwidth connection and you\\n\"\r\n\"  don't want your transfer to use all of it (sometimes referred to as\\n\"\r\n\"  \\\"bandwidth throttle\\\").\\n\"\r\n\"\\n\"\r\n\"  Make curl transfer data no faster than 10 kilobytes per second:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl --limit-rate 10K www.far-away-site.com\\n\"\r\n\"\\n\"\r\n\"    or\\n\"\r\n\"\\n\"\r\n\"        curl --limit-rate 10240 www.far-away-site.com\\n\"\r\n\"\\n\"\r\n\"  Or prevent curl from uploading data faster than 1 megabyte per second:\\n\"\r\n\"\\n\"\r\n\"        curl -T upload --limit-rate 1M ftp://uploadshereplease.com\\n\"\r\n\"\\n\"\r\n\"  When using the --limit-rate option, the transfer rate is regulated on a\\n\"\r\n\"  per-second basis, which will cause the total transfer speed to become lower\\n\"\r\n\"  than the given number. Sometimes of course substantially lower, if your\\n\"\r\n, stdout);\r\n fputs(\r\n\"  transfer stalls during periods.\\n\"\r\n\"\\n\"\r\n\"CONFIG FILE\\n\"\r\n\"\\n\"\r\n\"  Curl automatically tries to read the .curlrc file (or _curlrc file on win32\\n\"\r\n\"  systems) from the user's home dir on startup.\\n\"\r\n\"\\n\"\r\n\"  The config file could be made up with normal command line switches, but you\\n\"\r\n\"  can also specify the long options without the dashes to make it more\\n\"\r\n\"  readable. You can separate the options and the parameter with spaces, or\\n\"\r\n\"  with = or :. Comments can be used within the file. If the first letter on a\\n\"\r\n, stdout);\r\n fputs(\r\n\"  line is a '#'-symbol the rest of the line is treated as a comment.\\n\"\r\n\"\\n\"\r\n\"  If you want the parameter to contain spaces, you must enclose the entire\\n\"\r\n\"  parameter within double quotes (\\\"). Within those quotes, you specify a\\n\"\r\n\"  quote as \\\\\\\".\\n\"\r\n\"\\n\"\r\n\"  NOTE: You must specify options and their arguments on the same line.\\n\"\r\n\"\\n\"\r\n\"  Example, set default time out and proxy in a config file:\\n\"\r\n\"\\n\"\r\n\"        # We want a 30 minute timeout:\\n\"\r\n\"        -m 1800\\n\"\r\n\"        # ... and we use a proxy for all accesses:\\n\"\r\n, stdout);\r\n fputs(\r\n\"        proxy = proxy.our.domain.com:8080\\n\"\r\n\"\\n\"\r\n\"  White spaces ARE significant at the end of lines, but all white spaces\\n\"\r\n\"  leading up to the first characters of each line are ignored.\\n\"\r\n\"\\n\"\r\n\"  Prevent curl from reading the default file by using -q as the first command\\n\"\r\n\"  line parameter, like:\\n\"\r\n\"\\n\"\r\n\"        curl -q www.thatsite.com\\n\"\r\n\"\\n\"\r\n\"  Force curl to get and display a local help page in case it is invoked\\n\"\r\n\"  without URL by making a config file similar to:\\n\"\r\n\"\\n\"\r\n\"        # default url to get\\n\"\r\n, stdout);\r\n fputs(\r\n\"        url = \\\"http://help.with.curl.com/curlhelp.html\\\"\\n\"\r\n\"\\n\"\r\n\"  You can specify another config file to be read by using the -K/--config\\n\"\r\n\"  flag. If you set config file name to \\\"-\\\" it'll read the config from stdin,\\n\"\r\n\"  which can be handy if you want to hide options from being visible in process\\n\"\r\n\"  tables etc:\\n\"\r\n\"\\n\"\r\n\"        echo \\\"user = user:passwd\\\" | curl -K - http://that.secret.site.com\\n\"\r\n\"\\n\"\r\n\"EXTRA HEADERS\\n\"\r\n\"\\n\"\r\n\"  When using curl in your own very special programs, you may end up needing\\n\"\r\n, stdout);\r\n fputs(\r\n\"  to pass on your own custom headers when getting a web page. You can do\\n\"\r\n\"  this by using the -H flag.\\n\"\r\n\"\\n\"\r\n\"  Example, send the header \\\"X-you-and-me: yes\\\" to the server when getting a\\n\"\r\n\"  page:\\n\"\r\n\"\\n\"\r\n\"        curl -H \\\"X-you-and-me: yes\\\" www.love.com\\n\"\r\n\"\\n\"\r\n\"  This can also be useful in case you want curl to send a different text in a\\n\"\r\n\"  header than it normally does. The -H header you specify then replaces the\\n\"\r\n\"  header curl would normally send. If you replace an internal header with an\\n\"\r\n, stdout);\r\n fputs(\r\n\"  empty one, you prevent that header from being sent. To prevent the Host:\\n\"\r\n\"  header from being used:\\n\"\r\n\"\\n\"\r\n\"        curl -H \\\"Host:\\\" www.server.com\\n\"\r\n\"\\n\"\r\n\"FTP and PATH NAMES\\n\"\r\n\"\\n\"\r\n\"  Do note that when getting files with the ftp:// URL, the given path is\\n\"\r\n\"  relative the directory you enter. To get the file 'README' from your home\\n\"\r\n\"  directory at your ftp site, do:\\n\"\r\n\"\\n\"\r\n\"        curl ftp://user:passwd@my.site.com/README\\n\"\r\n\"\\n\"\r\n\"  But if you want the README file from the root directory of that very same\\n\"\r\n, stdout);\r\n fputs(\r\n\"  site, you need to specify the absolute file name:\\n\"\r\n\"\\n\"\r\n\"        curl ftp://user:passwd@my.site.com//README\\n\"\r\n\"\\n\"\r\n\"  (I.e with an extra slash in front of the file name.)\\n\"\r\n\"\\n\"\r\n\"SFTP and SCP and PATH NAMES\\n\"\r\n\"\\n\"\r\n\"  With sftp: and scp: URLs, the path name given is the absolute name on the\\n\"\r\n\"  server. To access a file relative to the remote user's home directory,\\n\"\r\n\"  prefix the file with /~/ , such as:\\n\"\r\n\"\\n\"\r\n\"        curl -u $USER sftp://home.example.com/~/.bashrc\\n\"\r\n\"\\n\"\r\n\"FTP and firewalls\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  The FTP protocol requires one of the involved parties to open a second\\n\"\r\n\"  connection as soon as data is about to get transferred. There are two ways to\\n\"\r\n\"  do this.\\n\"\r\n\"\\n\"\r\n\"  The default way for curl is to issue the PASV command which causes the\\n\"\r\n\"  server to open another port and await another connection performed by the\\n\"\r\n\"  client. This is good if the client is behind a firewall that doesn't allow\\n\"\r\n\"  incoming connections.\\n\"\r\n\"\\n\"\r\n\"        curl ftp.download.com\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  If the server, for example, is behind a firewall that doesn't allow connections\\n\"\r\n\"  on ports other than 21 (or if it just doesn't support the PASV command), the\\n\"\r\n\"  other way to do it is to use the PORT command and instruct the server to\\n\"\r\n\"  connect to the client on the given IP number and port (as parameters to the\\n\"\r\n\"  PORT command).\\n\"\r\n\"\\n\"\r\n\"  The -P flag to curl supports a few different options. Your machine may have\\n\"\r\n\"  several IP-addresses and/or network interfaces and curl allows you to select\\n\"\r\n, stdout);\r\n fputs(\r\n\"  which of them to use. Default address can also be used:\\n\"\r\n\"\\n\"\r\n\"        curl -P - ftp.download.com\\n\"\r\n\"\\n\"\r\n\"  Download with PORT but use the IP address of our 'le0' interface (this does\\n\"\r\n\"  not work on windows):\\n\"\r\n\"\\n\"\r\n\"        curl -P le0 ftp.download.com\\n\"\r\n\"\\n\"\r\n\"  Download with PORT but use 192.168.0.10 as our IP address to use:\\n\"\r\n\"\\n\"\r\n\"        curl -P 192.168.0.10 ftp.download.com\\n\"\r\n\"\\n\"\r\n\"NETWORK INTERFACE\\n\"\r\n\"\\n\"\r\n\"  Get a web page from a server using a specified port for the interface:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl --interface eth0:1 http://www.netscape.com/\\n\"\r\n\"\\n\"\r\n\"  or\\n\"\r\n\"\\n\"\r\n\"        curl --interface 192.168.1.10 http://www.netscape.com/\\n\"\r\n\"\\n\"\r\n\"HTTPS\\n\"\r\n\"\\n\"\r\n\"  Secure HTTP requires SSL libraries to be installed and used when curl is\\n\"\r\n\"  built. If that is done, curl is capable of retrieving and posting documents\\n\"\r\n\"  using the HTTPS protocol.\\n\"\r\n\"\\n\"\r\n\"  Example:\\n\"\r\n\"\\n\"\r\n\"        curl https://www.secure-site.com\\n\"\r\n\"\\n\"\r\n\"  Curl is also capable of using your personal certificates to get/post files\\n\"\r\n, stdout);\r\n fputs(\r\n\"  from sites that require valid certificates. The only drawback is that the\\n\"\r\n\"  certificate needs to be in PEM-format. PEM is a standard and open format to\\n\"\r\n\"  store certificates with, but it is not used by the most commonly used\\n\"\r\n\"  browsers (Netscape and MSIE both use the so called PKCS#12 format). If you\\n\"\r\n\"  want curl to use the certificates you use with your (favourite) browser, you\\n\"\r\n\"  may need to download/compile a converter that can convert your browser's\\n\"\r\n, stdout);\r\n fputs(\r\n\"  formatted certificates to PEM formatted ones. This kind of converter is\\n\"\r\n\"  included in recent versions of OpenSSL, and for older versions Dr Stephen\\n\"\r\n\"  N. Henson has written a patch for SSLeay that adds this functionality. You\\n\"\r\n\"  can get his patch (that requires an SSLeay installation) from his site at:\\n\"\r\n\"  http://www.drh-consultancy.demon.co.uk/\\n\"\r\n\"\\n\"\r\n\"  Example on how to automatically retrieve a document using a certificate with\\n\"\r\n\"  a personal password:\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -E /path/to/cert.pem:password https://secure.site.com/\\n\"\r\n\"\\n\"\r\n\"  If you neglect to specify the password on the command line, you will be\\n\"\r\n\"  prompted for the correct password before any data can be received.\\n\"\r\n\"\\n\"\r\n\"  Many older SSL-servers have problems with SSLv3 or TLS, which newer versions\\n\"\r\n\"  of OpenSSL etc use, therefore it is sometimes useful to specify what\\n\"\r\n\"  SSL-version curl should use. Use -3, -2 or -1 to specify that exact SSL\\n\"\r\n\"  version to use (for SSLv3, SSLv2 or TLSv1 respectively):\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl -2 https://secure.site.com/\\n\"\r\n\"\\n\"\r\n\"  Otherwise, curl will first attempt to use v3 and then v2.\\n\"\r\n\"\\n\"\r\n\"  To use OpenSSL to convert your favourite browser's certificate into a PEM\\n\"\r\n\"  formatted one that curl can use, do something like this:\\n\"\r\n\"\\n\"\r\n\"    In Netscape, you start with hitting the 'Security' menu button.\\n\"\r\n\"\\n\"\r\n\"    Select 'certificates->yours' and then pick a certificate in the list\\n\"\r\n\"\\n\"\r\n\"    Press the 'Export' button\\n\"\r\n\"\\n\"\r\n\"    enter your PIN code for the certs\\n\"\r\n\"\\n\"\r\n\"    select a proper place to save it\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"    Run the 'openssl' application to convert the certificate. If you cd to the\\n\"\r\n\"    openssl installation, you can do it like:\\n\"\r\n\"\\n\"\r\n\"     # ./apps/openssl pkcs12 -in [file you saved] -clcerts -out [PEMfile]\\n\"\r\n\"\\n\"\r\n\"    In Firefox, select Options, then Advanced, then the Encryption tab,\\n\"\r\n\"    View Certificates. This opens the Certificate Manager, where you can\\n\"\r\n\"    Export. Be sure to select PEM for the Save as type.\\n\"\r\n\"\\n\"\r\n\"    In Internet Explorer, select Internet Options, then the Content tab, then\\n\"\r\n, stdout);\r\n fputs(\r\n\"    Certificates. Then you can Export, and depending on the format you may\\n\"\r\n\"    need to convert to PEM.\\n\"\r\n\"\\n\"\r\n\"    In Chrome, select Settings, then Show Advanced Settings. Under HTTPS/SSL\\n\"\r\n\"    select Manage Certificates.\\n\"\r\n\"\\n\"\r\n\"RESUMING FILE TRANSFERS\\n\"\r\n\"\\n\"\r\n\" To continue a file transfer where it was previously aborted, curl supports\\n\"\r\n\" resume on HTTP(S) downloads as well as FTP uploads and downloads.\\n\"\r\n\"\\n\"\r\n\" Continue downloading a document:\\n\"\r\n\"\\n\"\r\n\"        curl -C - -o file ftp://ftp.server.com/path/file\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\" Continue uploading a document(*1):\\n\"\r\n\"\\n\"\r\n\"        curl -C - -T file ftp://ftp.server.com/path/file\\n\"\r\n\"\\n\"\r\n\" Continue downloading a document from a web server(*2):\\n\"\r\n\"\\n\"\r\n\"        curl -C - -o file http://www.server.com/\\n\"\r\n\"\\n\"\r\n\" (*1) = This requires that the FTP server supports the non-standard command\\n\"\r\n\"        SIZE. If it doesn't, curl will say so.\\n\"\r\n\"\\n\"\r\n\" (*2) = This requires that the web server supports at least HTTP/1.1. If it\\n\"\r\n\"        doesn't, curl will say so.\\n\"\r\n\"\\n\"\r\n\"TIME CONDITIONS\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\" HTTP allows a client to specify a time condition for the document it\\n\"\r\n\" requests. It is If-Modified-Since or If-Unmodified-Since. Curl allows you to\\n\"\r\n\" specify them with the -z/--time-cond flag.\\n\"\r\n\"\\n\"\r\n\" For example, you can easily make a download that only gets performed if the\\n\"\r\n\" remote file is newer than a local copy. It would be made like:\\n\"\r\n\"\\n\"\r\n\"        curl -z local.html http://remote.server.com/remote.html\\n\"\r\n\"\\n\"\r\n\" Or you can download a file only if the local file is newer than the remote\\n\"\r\n, stdout);\r\n fputs(\r\n\" one. Do this by prepending the date string with a '-', as in:\\n\"\r\n\"\\n\"\r\n\"        curl -z -local.html http://remote.server.com/remote.html\\n\"\r\n\"\\n\"\r\n\" You can specify a \\\"free text\\\" date as condition. Tell curl to only download\\n\"\r\n\" the file if it was updated since January 12, 2012:\\n\"\r\n\"\\n\"\r\n\"        curl -z \\\"Jan 12 2012\\\" http://remote.server.com/remote.html\\n\"\r\n\"\\n\"\r\n\" Curl will then accept a wide range of date formats. You always make the date\\n\"\r\n\" check the other way around by prepending it with a dash '-'.\\n\"\r\n\"\\n\"\r\n\"DICT\\n\"\r\n\"\\n\"\r\n\"  For fun try\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"        curl dict://dict.org/m:curl\\n\"\r\n\"        curl dict://dict.org/d:heisenbug:jargon\\n\"\r\n\"        curl dict://dict.org/d:daniel:web1913\\n\"\r\n\"\\n\"\r\n\"  Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define'\\n\"\r\n\"  and 'lookup'. For example,\\n\"\r\n\"\\n\"\r\n\"        curl dict://dict.org/find:curl\\n\"\r\n\"\\n\"\r\n\"  Commands that break the URL description of the RFC (but not the DICT\\n\"\r\n\"  protocol) are\\n\"\r\n\"\\n\"\r\n\"        curl dict://dict.org/show:db\\n\"\r\n\"        curl dict://dict.org/show:strat\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Authentication is still missing (but this is not required by the RFC)\\n\"\r\n\"\\n\"\r\n\"LDAP\\n\"\r\n\"\\n\"\r\n\"  If you have installed the OpenLDAP library, curl can take advantage of it\\n\"\r\n\"  and offer ldap:// support.\\n\"\r\n\"\\n\"\r\n\"  LDAP is a complex thing and writing an LDAP query is not an easy task. I do\\n\"\r\n\"  advise you to dig up the syntax description for that elsewhere. Two places\\n\"\r\n\"  that might suit you are:\\n\"\r\n\"\\n\"\r\n\"  Netscape's \\\"Netscape Directory SDK 3.0 for C Programmer's Guide Chapter 10:\\n\"\r\n\"  Working with LDAP URLs\\\":\\n\"\r\n, stdout);\r\n fputs(\r\n\"  http://developer.netscape.com/docs/manuals/dirsdk/csdk30/url.htm\\n\"\r\n\"\\n\"\r\n\"  RFC 2255, \\\"The LDAP URL Format\\\" http://curl.haxx.se/rfc/rfc2255.txt\\n\"\r\n\"\\n\"\r\n\"  To show you an example, this is how I can get all people from my local LDAP\\n\"\r\n\"  server that has a certain sub-domain in their email address:\\n\"\r\n\"\\n\"\r\n\"        curl -B \\\"ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se\\\"\\n\"\r\n\"\\n\"\r\n\"  If I want the same info in HTML format, I can get it by not using the -B\\n\"\r\n\"  (enforce ASCII) flag.\\n\"\r\n\"\\n\"\r\n\"ENVIRONMENT VARIABLES\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Curl reads and understands the following environment variables:\\n\"\r\n\"\\n\"\r\n\"        http_proxy, HTTPS_PROXY, FTP_PROXY\\n\"\r\n\"\\n\"\r\n\"  They should be set for protocol-specific proxies. General proxy should be\\n\"\r\n\"  set with\\n\"\r\n\"\\n\"\r\n\"        ALL_PROXY\\n\"\r\n\"\\n\"\r\n\"  A comma-separated list of host names that shouldn't go through any proxy is\\n\"\r\n\"  set in (only an asterisk, '*' matches all hosts)\\n\"\r\n\"\\n\"\r\n\"        NO_PROXY\\n\"\r\n\"\\n\"\r\n\"  If the host name matches one of these strings, or the host is within the\\n\"\r\n, stdout);\r\n fputs(\r\n\"  domain of one of these strings, transactions with that node will not be\\n\"\r\n\"  proxied.\\n\"\r\n\"\\n\"\r\n\"\\n\"\r\n\"  The usage of the -x/--proxy flag overrides the environment variables.\\n\"\r\n\"\\n\"\r\n\"NETRC\\n\"\r\n\"\\n\"\r\n\"  Unix introduced the .netrc concept a long time ago. It is a way for a user\\n\"\r\n\"  to specify name and password for commonly visited FTP sites in a file so\\n\"\r\n\"  that you don't have to type them in each time you visit those sites. You\\n\"\r\n\"  realize this is a big security risk if someone else gets hold of your\\n\"\r\n, stdout);\r\n fputs(\r\n\"  passwords, so therefore most unix programs won't read this file unless it is\\n\"\r\n\"  only readable by yourself (curl doesn't care though).\\n\"\r\n\"\\n\"\r\n\"  Curl supports .netrc files if told to (using the -n/--netrc and\\n\"\r\n\"  --netrc-optional options). This is not restricted to just FTP,\\n\"\r\n\"  so curl can use it for all protocols where authentication is used.\\n\"\r\n\"\\n\"\r\n\"  A very simple .netrc file could look something like:\\n\"\r\n\"\\n\"\r\n\"        machine curl.haxx.se login iamdaniel password mysecret\\n\"\r\n\"\\n\"\r\n\"CUSTOM OUTPUT\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  To better allow script programmers to get to know about the progress of\\n\"\r\n\"  curl, the -w/--write-out option was introduced. Using this, you can specify\\n\"\r\n\"  what information from the previous transfer you want to extract.\\n\"\r\n\"\\n\"\r\n\"  To display the amount of bytes downloaded together with some text and an\\n\"\r\n\"  ending newline:\\n\"\r\n\"\\n\"\r\n\"        curl -w 'We downloaded %{size_download} bytes\\\\n' www.download.com\\n\"\r\n\"\\n\"\r\n\"KERBEROS FTP TRANSFER\\n\"\r\n\"\\n\"\r\n\"  Curl supports kerberos4 and kerberos5/GSSAPI for FTP transfers. You need\\n\"\r\n, stdout);\r\n fputs(\r\n\"  the kerberos package installed and used at curl build time for it to be\\n\"\r\n\"  available.\\n\"\r\n\"\\n\"\r\n\"  First, get the krb-ticket the normal way, like with the kinit/kauth tool.\\n\"\r\n\"  Then use curl in way similar to:\\n\"\r\n\"\\n\"\r\n\"        curl --krb private ftp://krb4site.com -u username:fakepwd\\n\"\r\n\"\\n\"\r\n\"  There's no use for a password on the -u switch, but a blank one will make\\n\"\r\n\"  curl ask for one and you already entered the real password to kinit/kauth.\\n\"\r\n\"\\n\"\r\n\"TELNET\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  The curl telnet support is basic and very easy to use. Curl passes all data\\n\"\r\n\"  passed to it on stdin to the remote server. Connect to a remote telnet\\n\"\r\n\"  server using a command line similar to:\\n\"\r\n\"\\n\"\r\n\"        curl telnet://remote.server.com\\n\"\r\n\"\\n\"\r\n\"  And enter the data to pass to the server on stdin. The result will be sent\\n\"\r\n\"  to stdout or to the file you specify with -o.\\n\"\r\n\"\\n\"\r\n\"  You might want the -N/--no-buffer option to switch off the buffered output\\n\"\r\n\"  for slow connections or similar.\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Pass options to the telnet protocol negotiation, by using the -t option. To\\n\"\r\n\"  tell the server we use a vt100 terminal, try something like:\\n\"\r\n\"\\n\"\r\n\"        curl -tTTYPE=vt100 telnet://remote.server.com\\n\"\r\n\"\\n\"\r\n\"  Other interesting options for it -t include:\\n\"\r\n\"\\n\"\r\n\"   - XDISPLOC=<X display> Sets the X display location.\\n\"\r\n\"\\n\"\r\n\"   - NEW_ENV=<var,val> Sets an environment variable.\\n\"\r\n\"\\n\"\r\n\"  NOTE: The telnet protocol does not specify any way to login with a specified\\n\"\r\n, stdout);\r\n fputs(\r\n\"  user and password so curl can't do that automatically. To do that, you need\\n\"\r\n\"  to track when the login prompt is received and send the username and\\n\"\r\n\"  password accordingly.\\n\"\r\n\"\\n\"\r\n\"PERSISTENT CONNECTIONS\\n\"\r\n\"\\n\"\r\n\"  Specifying multiple files on a single command line will make curl transfer\\n\"\r\n\"  all of them, one after the other in the specified order.\\n\"\r\n\"\\n\"\r\n\"  libcurl will attempt to use persistent connections for the transfers so that\\n\"\r\n\"  the second transfer to the same host can use the same connection that was\\n\"\r\n, stdout);\r\n fputs(\r\n\"  already initiated and was left open in the previous transfer. This greatly\\n\"\r\n\"  decreases connection time for all but the first transfer and it makes a far\\n\"\r\n\"  better use of the network.\\n\"\r\n\"\\n\"\r\n\"  Note that curl cannot use persistent connections for transfers that are used\\n\"\r\n\"  in subsequence curl invokes. Try to stuff as many URLs as possible on the\\n\"\r\n\"  same command line if they are using the same host, as that'll make the\\n\"\r\n\"  transfers faster. If you use an HTTP proxy for file transfers, practically\\n\"\r\n, stdout);\r\n fputs(\r\n\"  all transfers will be persistent.\\n\"\r\n\"\\n\"\r\n\"MULTIPLE TRANSFERS WITH A SINGLE COMMAND LINE\\n\"\r\n\"\\n\"\r\n\"  As is mentioned above, you can download multiple files with one command line\\n\"\r\n\"  by simply adding more URLs. If you want those to get saved to a local file\\n\"\r\n\"  instead of just printed to stdout, you need to add one save option for each\\n\"\r\n\"  URL you specify. Note that this also goes for the -O option (but not\\n\"\r\n\"  --remote-name-all).\\n\"\r\n\"\\n\"\r\n\"  For example: get two files and use -O for the first and a custom file\\n\"\r\n, stdout);\r\n fputs(\r\n\"  name for the second:\\n\"\r\n\"\\n\"\r\n\"    curl -O http://url.com/file.txt ftp://ftp.com/moo.exe -o moo.jpg\\n\"\r\n\"\\n\"\r\n\"  You can also upload multiple files in a similar fashion:\\n\"\r\n\"\\n\"\r\n\"    curl -T local1 ftp://ftp.com/moo.exe -T local2 ftp://ftp.com/moo2.txt\\n\"\r\n\"\\n\"\r\n\"IPv6\\n\"\r\n\"\\n\"\r\n\"  curl will connect to a server with IPv6 when a host lookup returns an IPv6\\n\"\r\n\"  address and fall back to IPv4 if the connection fails. The --ipv4 and --ipv6\\n\"\r\n\"  options can specify which address to use when both are available. IPv6\\n\"\r\n, stdout);\r\n fputs(\r\n\"  addresses can also be specified directly in URLs using the syntax:\\n\"\r\n\"\\n\"\r\n\"    http://[2001:1890:1112:1::20]/overview.html\\n\"\r\n\"\\n\"\r\n\"  When this style is used, the -g option must be given to stop curl from\\n\"\r\n\"  interpreting the square brackets as special globbing characters.  Link local\\n\"\r\n\"  and site local addresses including a scope identifier, such as fe80::1234%1,\\n\"\r\n\"  may also be used, but the scope portion must be numeric and the percent\\n\"\r\n\"  character must be URL escaped. The previous example in an SFTP URL might\\n\"\r\n, stdout);\r\n fputs(\r\n\"  look like:\\n\"\r\n\"\\n\"\r\n\"    sftp://[fe80::1234%251]/\\n\"\r\n\"\\n\"\r\n\"  IPv6 addresses provided other than in URLs (e.g. to the --proxy, --interface\\n\"\r\n\"  or --ftp-port options) should not be URL encoded.\\n\"\r\n\"\\n\"\r\n\"METALINK\\n\"\r\n\"\\n\"\r\n\"  Curl supports Metalink (both version 3 and 4 (RFC 5854) are supported), a way\\n\"\r\n\"  to list multiple URIs and hashes for a file. Curl will make use of the mirrors\\n\"\r\n\"  listed within for failover if there are errors (such as the file or server not\\n\"\r\n, stdout);\r\n fputs(\r\n\"  being available). It will also verify the hash of the file after the download\\n\"\r\n\"  completes. The Metalink file itself is downloaded and processed in memory and\\n\"\r\n\"  not stored in the local file system.\\n\"\r\n\"\\n\"\r\n\"  Example to use a remote Metalink file:\\n\"\r\n\"\\n\"\r\n\"    curl --metalink http://www.example.com/example.metalink\\n\"\r\n\"\\n\"\r\n\"  To use a Metalink file in the local file system, use FILE protocol (file://):\\n\"\r\n\"\\n\"\r\n\"    curl --metalink file://example.metalink\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"  Please note that if FILE protocol is disabled, there is no way to use a local\\n\"\r\n\"  Metalink file at the time of this writing. Also note that if --metalink and\\n\"\r\n\"  --include are used together, --include will be ignored. This is because including\\n\"\r\n\"  headers in the response will break Metalink parser and if the headers are included\\n\"\r\n\"  in the file described in Metalink file, hash check will fail.\\n\"\r\n\"\\n\"\r\n\"MAILING LISTS\\n\"\r\n\"\\n\"\r\n\"  For your convenience, we have several open mailing lists to discuss curl,\\n\"\r\n, stdout);\r\n fputs(\r\n\"  its development and things relevant to this. Get all info at\\n\"\r\n\"  http://curl.haxx.se/mail/. Some of the lists available are:\\n\"\r\n\"\\n\"\r\n\"  curl-users\\n\"\r\n\"\\n\"\r\n\"    Users of the command line tool. How to use it, what doesn't work, new\\n\"\r\n\"    features, related tools, questions, news, installations, compilations,\\n\"\r\n\"    running, porting etc.\\n\"\r\n\"\\n\"\r\n\"  curl-library\\n\"\r\n\"\\n\"\r\n\"    Developers using or developing libcurl. Bugs, extensions, improvements.\\n\"\r\n\"\\n\"\r\n\"  curl-announce\\n\"\r\n\"\\n\"\r\n, stdout);\r\n fputs(\r\n\"    Low-traffic. Only receives announcements of new public versions. At worst,\\n\"\r\n\"    that makes something like one or two mails per month, but usually only one\\n\"\r\n\"    mail every second month.\\n\"\r\n\"\\n\"\r\n\"  curl-and-php\\n\"\r\n\"\\n\"\r\n\"    Using the curl functions in PHP. Everything curl with a PHP angle. Or PHP\\n\"\r\n\"    with a curl angle.\\n\"\r\n\"\\n\"\r\n\"  curl-and-python\\n\"\r\n\"\\n\"\r\n\"    Python hackers using curl with or without the python binding pycurl.\\n\"\r\n\"\\n\"\r\n\"  Please direct curl questions, feature requests and trouble reports to one of\\n\"\r\n, stdout);\r\n fputs(\r\n\"  these mailing lists instead of mailing any individual.\\n\"\r\n, stdout) ;\r\n}\r\n#endif /* USE_MANUAL */\r\n#else\r\n/*\r\n * NEVER EVER edit this manually, fix the mkhelp.pl script instead!\r\n * Generation time: Mon Jan 28 21:57:07 2013\r\n */\r\n#ifdef USE_MANUAL\r\n#include \"tool_hugehelp.h\"\r\n#include <zlib.h>\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\nstatic const unsigned char hugehelpgz[] = {\r\n  /* This mumbo-jumbo is the huge help text compressed with gzip.\r\n     Thanks to this operation, the size of this data shrunk from 147046\r\n     to 45006 bytes. You can disable the use of compressed help\r\n     texts by NOT passing -c to the mkhelp.pl tool. */\r\n  0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0xed, 0xbd,\r\n  0x6b, 0x77, 0x1b, 0x57, 0x92, 0x25, 0xfa, 0x9d, 0xbf, 0x22, 0x0b, 0x75,\r\n  0xab, 0x41, 0x56, 0x01, 0xe0, 0x43, 0x92, 0x6d, 0xb1, 0x24, 0xb7, 0x69,\r\n  0x92, 0xb2, 0xd9, 0xa6, 0x44, 0x0e, 0x41, 0xd9, 0xae, 0xb1, 0xbd, 0xb4,\r\n  0x12, 0x40, 0x92, 0xcc, 0x22, 0x90, 0x09, 0x67, 0x26, 0x48, 0xb1, 0xba,\r\n  0x6b, 0x7e, 0xfb, 0x8d, 0xd8, 0x11, 0x71, 0xce, 0xc9, 0x07, 0x28, 0xd9,\r\n  0x6d, 0xd7, 0x9d, 0x99, 0x75, 0x6b, 0xa6, 0x65, 0x89, 0xcc, 0x3c, 0x79,\r\n  0x9e, 0x71, 0xe2, 0xb1, 0x63, 0x47, 0x14, 0x7d, 0xe8, 0x7f, 0xef, 0xf0,\r\n  0x7f, 0xef, 0xe8, 0x7f, 0xf4, 0xdf, 0x8d, 0x28, 0x3a, 0x2f, 0xf2, 0xbf,\r\n  0x27, 0xd3, 0xaa, 0xfb, 0xd9, 0x77, 0xef, 0xfe, 0x2b, 0x92, 0xff, 0x47,\r\n  0xef, 0xfc, 0x48, 0xff, 0xdd, 0x78, 0xb4, 0xed, 0xed, 0xc8, 0xbf, 0xf0,\r\n  0x5f, 0xef, 0xb6, 0xa2, 0x0f, 0xbd, 0xf0, 0x5f, 0xd1, 0x26, 0x5e, 0x78,\r\n  0xa7, 0x5f, 0x78, 0xc1, 0x7f, 0x7f, 0xf7, 0xee, 0xf1, 0x8f, 0xfc, 0xc8,\r\n  0xbd, 0xe2, 0x3f, 0xb6, 0xf9, 0xbd, 0x1f, 0xdf, 0xf1, 0x5f, 0xe9, 0x27,\r\n  0x1b, 0x1b, 0x6f, 0x0e, 0x5e, 0x1f, 0xdb, 0xab, 0xd3, 0x55, 0x31, 0x8f,\r\n  0x86, 0x51, 0x55, 0xc4, 0x59, 0x79, 0x95, 0x14, 0x51, 0x1c, 0xbd, 0xbd,\r\n  0x38, 0xdd, 0xd8, 0x18, 0xff, 0xed, 0xcd, 0xd9, 0xf9, 0xf8, 0x64, 0x5c,\r\n  0x7b, 0xec, 0x87, 0x7c, 0x59, 0xa5, 0x79, 0x56, 0xfe, 0x14, 0xfd, 0x40,\r\n  0x0f, 0x8d, 0x46, 0xa3, 0x9f, 0x36, 0x36, 0x8e, 0x8e, 0xc7, 0x87, 0x17,\r\n  0x27, 0xe7, 0x97, 0x27, 0x67, 0x6f, 0x6a, 0xcf, 0x46, 0x69, 0x19, 0x51,\r\n  0x63, 0x55, 0x9e, 0xcf, 0xe9, 0x0f, 0xdf, 0xfe, 0x2c, 0xae, 0xe2, 0xe8,\r\n  0xaa, 0xc8, 0x17, 0x51, 0x5e, 0xf0, 0x2f, 0xe2, 0xa8, 0x4c, 0x8a, 0xbb,\r\n  0xa4, 0x18, 0x44, 0xab, 0x32, 0xcd, 0xae, 0xa3, 0x3c, 0x4b, 0xa2, 0xfc,\r\n  0x2a, 0xaa, 0x6e, 0x12, 0x6b, 0xae, 0x5c, 0x2d, 0x97, 0x79, 0x51, 0x25,\r\n  0xb3, 0x68, 0x59, 0xe4, 0x55, 0x3e, 0xcd, 0xe7, 0x65, 0xb4, 0x79, 0x74,\r\n  0x72, 0x78, 0x39, 0x88, 0x5e, 0x9d, 0x9c, 0x1e, 0xd3, 0x9f, 0x97, 0xe7,\r\n  0xf8, 0x63, 0x3c, 0x88, 0xbe, 0x3a, 0x3b, 0xff, 0xfa, 0xf8, 0x62, 0x10,\r\n  0x7d, 0x7d, 0xc9, 0x3f, 0xe3, 0x3f, 0xe9, 0x87, 0xd1, 0xc9, 0xeb, 0x83,\r\n  0xf3, 0x81, 0x35, 0xc7, 0xff, 0xe0, 0x1f, 0x9e, 0x1e, 0xd1, 0x0f, 0xe5,\r\n  0x3f, 0xfc, 0xcf, 0xf3, 0xb3, 0xf3, 0x27, 0x03, 0xfc, 0x49, 0xff, 0xba,\r\n  0xb8, 0x7c, 0x7d, 0xce, 0x7f, 0x8e, 0xe9, 0xcf, 0xf1, 0x21, 0xff, 0x81,\r\n  0x6f, 0x8c, 0x5f, 0xdb, 0x9f, 0x63, 0xd7, 0xdc, 0xe5, 0xf1, 0xe9, 0x9b,\r\n  0xe3, 0xcb, 0x28, 0xce, 0x66, 0xd1, 0x25, 0x3d, 0xb4, 0x35, 0xa2, 0x1f,\r\n  0xdd, 0x24, 0xd1, 0x34, 0x5f, 0x2c, 0xf8, 0x67, 0x34, 0x0b, 0xb3, 0xa4,\r\n  0x4c, 0xaf, 0x33, 0xea, 0x3e, 0x8d, 0xf6, 0x3e, 0x2f, 0x6e, 0xa3, 0xfb,\r\n  0xb4, 0xba, 0xc9, 0x57, 0x15, 0x0d, 0x98, 0xe6, 0x23, 0x4a, 0xb3, 0x2a,\r\n  0x29, 0x86, 0xd6, 0x5c, 0x3c, 0xe5, 0x19, 0x1e, 0x6d, 0xd4, 0xe6, 0x32,\r\n  0xbf, 0xa2, 0x99, 0x2b, 0x69, 0xaa, 0x26, 0xab, 0x72, 0x9e, 0xc7, 0x33,\r\n  0x9e, 0x20, 0x7a, 0xf9, 0x6a, 0x45, 0x53, 0x5b, 0xa4, 0xd3, 0xdb, 0x32,\r\n  0x9a, 0xa7, 0xb7, 0x09, 0x4f, 0xcf, 0xfb, 0x07, 0x9b, 0xae, 0x81, 0x34,\r\n  0x1f, 0xaf, 0x68, 0x26, 0x33, 0xd7, 0x7c, 0x95, 0x4e, 0x63, 0xfe, 0x00,\r\n  0xe6, 0x2b, 0x5a, 0x2d, 0xb9, 0x35, 0x99, 0xa7, 0x68, 0x99, 0x97, 0xf4,\r\n  0xd2, 0x78, 0x7c, 0x4a, 0x7d, 0xcf, 0xb2, 0x04, 0xfd, 0x28, 0x07, 0xf4,\r\n  0x8f, 0xfc, 0x36, 0x4d, 0xe8, 0x2f, 0x57, 0xe9, 0x3c, 0x89, 0x64, 0x1d,\r\n  0x5d, 0x73, 0xbc, 0xa0, 0x51, 0x91, 0x94, 0xab, 0x45, 0x42, 0x53, 0xf8,\r\n  0x3a, 0xa9, 0xe2, 0x79, 0x9a, 0xdd, 0xd2, 0x5f, 0x79, 0xe8, 0x8b, 0xbc,\r\n  0x48, 0x46, 0xd1, 0x41, 0x19, 0x3d, 0xe4, 0x2b, 0x1a, 0xf3, 0x7c, 0x4e,\r\n  0x2b, 0x9d, 0x44, 0x93, 0x64, 0x9e, 0xdf, 0x0f, 0x78, 0x7d, 0xa3, 0x6c,\r\n  0xb5, 0x98, 0x50, 0x03, 0xf9, 0x95, 0x6f, 0x2e, 0xae, 0x56, 0xd4, 0x9c,\r\n  0x3c, 0xbd, 0x88, 0x69, 0x4c, 0xf4, 0x6e, 0x11, 0xdd, 0x24, 0x34, 0xe6,\r\n  0x72, 0x99, 0x66, 0x7f, 0xa8, 0xcf, 0x0b, 0x4d, 0xee, 0x32, 0xbf, 0x4f,\r\n  0x0a, 0x9a, 0xdb, 0xc9, 0x43, 0x44, 0x93, 0x30, 0x91, 0xad, 0x77, 0x45,\r\n  0x5b, 0x2b, 0x8a, 0xa9, 0x09, 0xb7, 0xed, 0x86, 0x45, 0x32, 0x8f, 0x79,\r\n  0x0b, 0xb9, 0x6f, 0xd0, 0x3a, 0x8d, 0x13, 0xb7, 0xc7, 0xf4, 0xd5, 0xcd,\r\n  0x27, 0x5b, 0x78, 0x79, 0x46, 0x23, 0x49, 0xe7, 0x25, 0x2d, 0x03, 0x1f,\r\n  0x06, 0x5b, 0x69, 0xea, 0x32, 0x1f, 0x0e, 0xda, 0x91, 0x0f, 0x59, 0x15,\r\n  0xbf, 0xc7, 0xe7, 0x75, 0x47, 0x0e, 0x67, 0xc9, 0x32, 0xc9, 0x66, 0x49,\r\n  0x56, 0x8d, 0xa2, 0xbf, 0xe5, 0xab, 0x3e, 0x7d, 0xfb, 0x2a, 0xa5, 0x39,\r\n  0x88, 0xb5, 0x29, 0xfa, 0x32, 0x6d, 0x83, 0x69, 0x91, 0x2e, 0x83, 0xa5,\r\n  0xc8, 0x33, 0x5a, 0xfc, 0xe8, 0xe2, 0xd5, 0x61, 0xf4, 0xe4, 0xf9, 0x67,\r\n  0x9f, 0xf8, 0x35, 0xa7, 0x06, 0xa2, 0x69, 0x9c, 0xd1, 0x88, 0x93, 0x69,\r\n  0x7a, 0xf5, 0x10, 0x2d, 0x56, 0xf3, 0x2a, 0x5d, 0xd2, 0xec, 0xd3, 0xc7,\r\n  0x4b, 0x3e, 0x36, 0xcb, 0xb8, 0xa8, 0x4a, 0xde, 0x04, 0xf8, 0x01, 0xc6,\r\n  0x7e, 0x5f, 0xa4, 0x15, 0x1f, 0x1f, 0xfc, 0x8e, 0x7a, 0x98, 0x54, 0xa5,\r\n  0x35, 0xc7, 0xdb, 0x8d, 0xbe, 0x33, 0x29, 0xe2, 0x29, 0x4d, 0x6d, 0x5c,\r\n  0xd2, 0x47, 0xf7, 0xdd, 0xb7, 0xa2, 0x9b, 0xaa, 0x5a, 0xee, 0x6f, 0x6f,\r\n  0x97, 0x69, 0x95, 0x8c, 0xfe, 0x93, 0x0e, 0xdf, 0xa0, 0xba, 0xcf, 0x07,\r\n  0xd5, 0x4d, 0x91, 0x24, 0xff, 0x1c, 0xd1, 0x26, 0x76, 0x0f, 0xd2, 0x67,\r\n  0x1f, 0xb4, 0x5f, 0xd7, 0x49, 0x45, 0x1f, 0xf8, 0x79, 0x95, 0x64, 0xdc,\r\n  0x20, 0x75, 0x23, 0x9e, 0x2f, 0x6f, 0x62, 0x5a, 0xcd, 0x84, 0x36, 0x23,\r\n  0x1f, 0x67, 0xda, 0x2f, 0xdc, 0x29, 0x39, 0xd0, 0x3f, 0xfc, 0xd4, 0xfa,\r\n  0xe6, 0x15, 0x3e, 0x49, 0x7f, 0x8e, 0xf4, 0xa5, 0x98, 0xe6, 0x9a, 0x3e,\r\n  0xb6, 0xcd, 0x7b, 0xec, 0x87, 0xdd, 0xe1, 0xee, 0xce, 0xce, 0x4f, 0xa3,\r\n  0xea, 0x7d, 0xf5, 0x91, 0x2f, 0xec, 0xec, 0xf8, 0x57, 0xf8, 0xe9, 0x4d,\r\n  0x1e, 0x71, 0x34, 0xa7, 0x4d, 0xc3, 0xdf, 0xff, 0x47, 0x52, 0xe4, 0xe5,\r\n  0x56, 0x47, 0x53, 0xf3, 0xa4, 0xa2, 0x93, 0x17, 0xb4, 0x13, 0x0f, 0xff,\r\n  0x21, 0x9f, 0xb5, 0x87, 0xdf, 0x24, 0x25, 0xf6, 0x8c, 0x1f, 0x6c, 0x14,\r\n  0x17, 0xb4, 0x6f, 0xf3, 0xca, 0x0b, 0xa5, 0x01, 0x1d, 0xca, 0xca, 0x4d,\r\n  0x0d, 0x9d, 0x39, 0x7a, 0x9a, 0xc4, 0x59, 0x3c, 0x67, 0x49, 0x56, 0x46,\r\n  0x59, 0xe2, 0x87, 0x41, 0xe7, 0x3f, 0x89, 0xa7, 0x37, 0x51, 0x4e, 0x9b,\r\n  0xbf, 0x68, 0x2f, 0x41, 0x9c, 0x3d, 0x8c, 0xf2, 0xe2, 0x7a, 0x3b, 0x2e,\r\n  0xa6, 0x37, 0xe9, 0x1d, 0xcd, 0xc3, 0xf3, 0xe7, 0x9f, 0x0c, 0xe9, 0x8f,\r\n  0xe7, 0x3f, 0x6d, 0xdf, 0xe5, 0x73, 0x9a, 0x96, 0xa7, 0x3f, 0x6d, 0xf3,\r\n  0xea, 0xfe, 0x67, 0x3c, 0x98, 0x0c, 0xa6, 0xff, 0x1c, 0xdd, 0x54, 0x8b,\r\n  0xf9, 0xda, 0x3d, 0x43, 0x8d, 0x45, 0xf1, 0x22, 0x5f, 0x65, 0x95, 0xdb,\r\n  0x27, 0xb4, 0xdd, 0xaa, 0x40, 0x32, 0xd1, 0x49, 0x4d, 0x44, 0x58, 0xf1,\r\n  0xf6, 0xe1, 0x03, 0x47, 0x67, 0xd3, 0x9f, 0xc4, 0x6a, 0x7a, 0x43, 0x43,\r\n  0xa7, 0x7d, 0x13, 0xeb, 0xf0, 0xab, 0x34, 0xe6, 0x33, 0x49, 0xa2, 0xa1,\r\n  0xe0, 0x1f, 0x73, 0x53, 0xf2, 0xb1, 0x94, 0x9e, 0xcb, 0x8b, 0x59, 0x52,\r\n  0xd4, 0x77, 0x30, 0xba, 0xe3, 0xfb, 0x13, 0xd1, 0x54, 0x2e, 0xe9, 0xe3,\r\n  0x2b, 0x16, 0x77, 0x38, 0x64, 0xdc, 0x02, 0x1d, 0xcf, 0x6b, 0x9a, 0x25,\r\n  0x9a, 0x19, 0xde, 0x54, 0x3c, 0x71, 0x0f, 0xd1, 0x1b, 0x5a, 0x3c, 0x11,\r\n  0x0d, 0xc1, 0xde, 0x93, 0xc5, 0x6a, 0x4f, 0xda, 0xfd, 0xfd, 0xfd, 0xfa,\r\n  0x4d, 0xb4, 0xbf, 0xdb, 0xd8, 0x47, 0xc1, 0x4b, 0x5d, 0xab, 0xbf, 0xbf,\r\n  0x57, 0x5f, 0xff, 0x93, 0x2b, 0x2c, 0xac, 0x8d, 0x81, 0xcf, 0xbe, 0xc9,\r\n  0x6e, 0x3b, 0xf8, 0xd4, 0x1a, 0xfd, 0x3d, 0xb9, 0x4a, 0xdf, 0x0f, 0xec,\r\n  0xe2, 0x93, 0xb9, 0x8c, 0xa9, 0xf9, 0xc5, 0xb2, 0xe2, 0x55, 0xb7, 0xe6,\r\n  0xae, 0x57, 0x49, 0x49, 0x5b, 0xe8, 0xfe, 0x26, 0xa6, 0x1f, 0x5b, 0x03,\r\n  0x11, 0x3e, 0xb1, 0x48, 0xaf, 0x6f, 0xaa, 0xe8, 0x3e, 0x66, 0xf9, 0x71,\r\n  0x52, 0x49, 0x13, 0x2c, 0xb8, 0x49, 0x6a, 0x5c, 0xc5, 0x74, 0xfc, 0x79,\r\n  0x86, 0x20, 0xa5, 0x69, 0xb3, 0xb9, 0xed, 0x44, 0x73, 0x85, 0xad, 0x14,\r\n  0xdc, 0x8b, 0x93, 0xb8, 0xe4, 0xd5, 0xc8, 0x68, 0xd1, 0x2b, 0x12, 0xfb,\r\n  0x2b, 0xfe, 0xd7, 0x0d, 0x09, 0xf6, 0x28, 0x8b, 0x17, 0x89, 0x76, 0x14,\r\n  0xb2, 0xef, 0x15, 0x8b, 0xc8, 0xe4, 0x7d, 0xbc, 0x70, 0xf2, 0x88, 0x04,\r\n  0xcc, 0x40, 0x45, 0xa7, 0x7b, 0xa3, 0xa4, 0x55, 0xa3, 0x1d, 0xc7, 0xc7,\r\n  0x08, 0x67, 0xaa, 0xc7, 0xe7, 0xa6, 0x27, 0xe3, 0x44, 0x1f, 0xe3, 0x92,\r\n  0x65, 0xbf, 0x48, 0x78, 0xea, 0x7c, 0x30, 0x58, 0x9a, 0xb4, 0xf8, 0x96,\r\n  0x6f, 0x99, 0xc6, 0x5d, 0x86, 0xd7, 0x66, 0x79, 0x94, 0x92, 0x04, 0x9b,\r\n  0xd0, 0xf9, 0xe2, 0x91, 0xf1, 0xa9, 0xc1, 0xac, 0x70, 0x3b, 0x4b, 0x6a,\r\n  0x93, 0x7f, 0x98, 0x56, 0x2c, 0x37, 0xa0, 0x8e, 0x50, 0x7f, 0x69, 0x52,\r\n  0xa0, 0x51, 0xd0, 0xd9, 0x0b, 0xc6, 0x0f, 0x89, 0x47, 0xcf, 0x46, 0x77,\r\n  0x74, 0xf1, 0x90, 0x66, 0x91, 0xb8, 0xb7, 0x20, 0xa2, 0xa7, 0x7c, 0xdd,\r\n  0xcd, 0xe7, 0x0f, 0xb4, 0xed, 0x8a, 0x82, 0x55, 0x37, 0x5e, 0xc1, 0x89,\r\n  0x1c, 0x8e, 0x45, 0x42, 0x37, 0x43, 0x38, 0x9d, 0x29, 0x0b, 0x29, 0xda,\r\n  0xa4, 0x74, 0xd5, 0x60, 0x1b, 0xd2, 0x95, 0x80, 0x63, 0x8c, 0x81, 0xa3,\r\n  0x77, 0xdc, 0xf6, 0x74, 0x9a, 0x2c, 0xab, 0xb2, 0x6b, 0x4c, 0xb6, 0xe0,\r\n  0xd4, 0x9d, 0x22, 0xe1, 0x99, 0x0f, 0xef, 0x51, 0xcc, 0xab, 0x93, 0xe3,\r\n  0xb8, 0x4a, 0xed, 0x6a, 0xa2, 0xab, 0xb5, 0x74, 0xb3, 0x56, 0x61, 0x6f,\r\n  0xd0, 0x59, 0xc0, 0x9c, 0x2f, 0xb8, 0xa3, 0xfc, 0x70, 0x29, 0x1a, 0x13,\r\n  0xce, 0x1c, 0x2f, 0xa4, 0xa8, 0x4c, 0xf2, 0x5d, 0x96, 0x46, 0x34, 0x9f,\r\n  0xae, 0x71, 0xfa, 0xaa, 0x5b, 0x53, 0xfe, 0x7c, 0x49, 0xca, 0x26, 0x49,\r\n  0xe7, 0x59, 0x79, 0x43, 0xf7, 0x29, 0x2d, 0xfd, 0xe5, 0x0d, 0x8f, 0x74,\r\n  0x41, 0x7b, 0xe6, 0x8e, 0xd7, 0x77, 0x99, 0x24, 0xb3, 0x51, 0x74, 0x76,\r\n  0xc5, 0x47, 0xb3, 0xa0, 0x4e, 0x57, 0xf8, 0x35, 0x4b, 0x0b, 0x9a, 0xb7,\r\n  0x19, 0xb4, 0xb1, 0xcc, 0x49, 0x05, 0x74, 0x25, 0x38, 0xf6, 0xbc, 0xd3,\r\n  0x68, 0xb2, 0x23, 0x16, 0xf4, 0xf3, 0xba, 0x68, 0x81, 0x0a, 0x40, 0x22,\r\n  0x80, 0xbb, 0x37, 0x49, 0x22, 0xec, 0xc4, 0x49, 0x52, 0xdd, 0x27, 0x89,\r\n  0x6b, 0xae, 0x4c, 0x48, 0x9c, 0xf1, 0xa2, 0xc9, 0x65, 0x9e, 0xdd, 0xe5,\r\n  0xdc, 0xc1, 0x8d, 0x8d, 0xf3, 0x8b, 0xb3, 0xaf, 0x2e, 0x8e, 0xc7, 0xe3,\r\n  0xe8, 0xf5, 0xf1, 0xe5, 0xf1, 0x45, 0x6d, 0xa6, 0xb3, 0xbc, 0x58, 0x60,\r\n  0x45, 0x67, 0x69, 0xb9, 0x9c, 0xc7, 0x0f, 0xbc, 0xd4, 0x34, 0x92, 0xeb,\r\n  0x82, 0x4f, 0xd6, 0x22, 0x61, 0xd1, 0x32, 0x5b, 0x15, 0xd8, 0x16, 0xf9,\r\n  0x92, 0x96, 0x4f, 0x95, 0x18, 0x6a, 0x7c, 0x06, 0xcd, 0x27, 0xbb, 0xf6,\r\n  0x33, 0x4d, 0xb7, 0xb9, 0x4a, 0x48, 0x16, 0x91, 0x6e, 0x3d, 0x58, 0x9b,\r\n  0x80, 0x96, 0x3a, 0xf0, 0x3f, 0x93, 0x69, 0x2a, 0x31, 0x26, 0xda, 0xb3,\r\n  0xe9, 0x02, 0xba, 0x04, 0xfd, 0xd7, 0x2b, 0x10, 0xc9, 0x15, 0x69, 0x4f,\r\n  0x24, 0x35, 0x1b, 0x5b, 0xc3, 0xf5, 0x13, 0xf3, 0x0a, 0xe5, 0x97, 0xb5,\r\n  0x61, 0xfa, 0x38, 0xf5, 0x75, 0x91, 0x66, 0xb4, 0xc1, 0x68, 0x43, 0xea,\r\n  0x29, 0xe7, 0x9d, 0x40, 0x7d, 0xbd, 0x12, 0x99, 0xa0, 0x33, 0x52, 0xd7,\r\n  0xaa, 0xe9, 0x65, 0x5a, 0x6c, 0x92, 0xac, 0x6e, 0x78, 0xe8, 0x14, 0x6d,\r\n  0x4d, 0x6a, 0x3e, 0x9e, 0xb0, 0x68, 0x62, 0x35, 0x93, 0xb4, 0x81, 0xa4,\r\n  0xf3, 0x6b, 0x4e, 0x6f, 0xa5, 0x37, 0xa8, 0x6f, 0xf1, 0x84, 0x57, 0x94,\r\n  0x1f, 0x68, 0xcc, 0x22, 0x1d, 0x22, 0xc8, 0x96, 0xfb, 0xb4, 0xc4, 0xa1,\r\n  0xba, 0xcf, 0x57, 0x73, 0x52, 0xe9, 0xf8, 0x81, 0xd5, 0x12, 0x2f, 0xd0,\r\n  0xa7, 0x96, 0xfe, 0xf4, 0x2c, 0xd2, 0xf7, 0x3c, 0xeb, 0xcd, 0x56, 0xa8,\r\n  0x6b, 0xf4, 0xcf, 0x25, 0x2d, 0x82, 0x74, 0x67, 0xd4, 0x94, 0xad, 0x90,\r\n  0x1a, 0xad, 0x35, 0xe4, 0xd3, 0x02, 0x71, 0x77, 0x7e, 0x36, 0xbe, 0x64,\r\n  0xf1, 0x7f, 0xfe, 0xf6, 0x92, 0x1a, 0xa2, 0x6b, 0xa8, 0xac, 0x68, 0x39,\r\n  0xf9, 0xc5, 0x2c, 0x81, 0x46, 0x6d, 0xcd, 0xd1, 0xaa, 0xa5, 0x38, 0xe2,\r\n  0xb8, 0x55, 0xec, 0x93, 0xd2, 0x47, 0x31, 0x33, 0x78, 0xf3, 0x9a, 0x91,\r\n  0x51, 0xde, 0x24, 0x2c, 0xa3, 0xdd, 0x4b, 0xd1, 0xe6, 0xe7, 0x5b, 0xb4,\r\n  0xdc, 0x43, 0xd7, 0xdc, 0x0f, 0xfc, 0xf4, 0x4f, 0xfc, 0xe5, 0x32, 0x5d,\r\n  0xa4, 0xf3, 0x38, 0xb8, 0xdb, 0x54, 0x12, 0xf1, 0xbe, 0x76, 0xe7, 0x71,\r\n  0x4a, 0x62, 0x17, 0x9d, 0xf6, 0x5a, 0x35, 0xcf, 0x20, 0x4e, 0xb3, 0x5f,\r\n  0xa8, 0x59, 0x9e, 0xc8, 0x7b, 0xa4, 0xca, 0xba, 0x89, 0xe3, 0x15, 0xe3,\r\n  0x63, 0x5e, 0x9b, 0xa6, 0xe6, 0xaa, 0xb5, 0xa6, 0x8d, 0x25, 0x39, 0x8c,\r\n  0x35, 0x37, 0x71, 0xbd, 0x49, 0x5c, 0xf4, 0x9c, 0x04, 0x13, 0x0b, 0x8a,\r\n  0x1a, 0xbd, 0x5e, 0x51, 0xe7, 0x65, 0x56, 0x07, 0xd1, 0xf0, 0x8f, 0xdc,\r\n  0x73, 0x56, 0xa9, 0xdd, 0x89, 0x26, 0x5d, 0x2d, 0x9b, 0x8d, 0x36, 0xce,\r\n  0x60, 0xc0, 0x39, 0x6b, 0xef, 0x84, 0x95, 0xbc, 0x8c, 0xc5, 0xdf, 0x00,\r\n  0x7a, 0xf4, 0x84, 0xac, 0xb8, 0x04, 0x9b, 0x4e, 0xa4, 0x19, 0x6b, 0x41,\r\n  0x49, 0xc6, 0x9b, 0x67, 0x26, 0xf2, 0x71, 0x38, 0x94, 0x5f, 0x61, 0xc5,\r\n  0x1f, 0xe8, 0x2a, 0x8f, 0xaf, 0xe3, 0xd4, 0x1d, 0x74, 0xdd, 0x68, 0xee,\r\n  0xd9, 0x2c, 0xd7, 0xc7, 0x59, 0x1a, 0xb1, 0x60, 0xd5, 0x35, 0x5d, 0x41,\r\n  0xfe, 0x24, 0x7c, 0x2f, 0xd1, 0xa2, 0x60, 0x66, 0xb5, 0x59, 0xdc, 0x46,\r\n  0xd6, 0xdc, 0x04, 0xf7, 0x2f, 0x5f, 0x65, 0xd8, 0x99, 0xb8, 0x98, 0xa8,\r\n  0xc9, 0xde, 0x28, 0xfa, 0x9a, 0xac, 0x01, 0xd8, 0x92, 0x50, 0x50, 0x52,\r\n  0xb6, 0x8b, 0xe8, 0x86, 0xb9, 0x4f, 0xc8, 0x16, 0x29, 0x2b, 0x92, 0x1a,\r\n  0x10, 0x6a, 0xf8, 0x19, 0xf5, 0xd3, 0x89, 0xa1, 0x9b, 0xfc, 0x1e, 0x9f,\r\n  0x75, 0x83, 0xa0, 0x26, 0xca, 0x14, 0x97, 0x28, 0xff, 0x7c, 0x31, 0x8a,\r\n  0x36, 0x21, 0x34, 0x49, 0xb2, 0xb2, 0xf4, 0xf7, 0xa3, 0x70, 0xf3, 0x41,\r\n  0xdb, 0xd8, 0xa9, 0xdb, 0xf1, 0x6c, 0xc6, 0x12, 0x84, 0x7a, 0x10, 0x7d,\r\n  0x3a, 0xda, 0x7d, 0x3e, 0xda, 0x19, 0xb1, 0xeb, 0x20, 0xb9, 0x4b, 0x73,\r\n  0x32, 0xde, 0x48, 0xd5, 0xe2, 0xae, 0x44, 0xc1, 0x9b, 0x64, 0xbe, 0xf0,\r\n  0xb1, 0xbe, 0xbe, 0x9e, 0x8b, 0x40, 0xdd, 0x26, 0x6b, 0x2f, 0x90, 0xb9,\r\n  0x05, 0x19, 0x16, 0x90, 0x36, 0x3c, 0x39, 0xba, 0xac, 0xb2, 0xe7, 0x42,\r\n  0x61, 0xab, 0xd3, 0xb9, 0xe5, 0xf6, 0xc9, 0xf0, 0x8f, 0xb4, 0xdc, 0x43,\r\n  0xdb, 0x1d, 0x43, 0xda, 0x1c, 0x0d, 0x5f, 0xc1, 0x6b, 0xb6, 0xae, 0x42,\r\n  0x11, 0xe5, 0xb7, 0x92, 0x5c, 0xa0, 0x74, 0x45, 0xcc, 0x03, 0xb1, 0x40,\r\n  0x2d, 0x44, 0x6e, 0x7b, 0x05, 0x36, 0x5b, 0x20, 0x4e, 0x49, 0x57, 0xc8,\r\n  0x66, 0x71, 0x41, 0x2a, 0x31, 0x9b, 0x7e, 0xf4, 0xf0, 0x15, 0x4b, 0x6b,\r\n  0xee, 0x18, 0xef, 0x23, 0xec, 0x41, 0xbf, 0x91, 0x87, 0x3b, 0xdc, 0x41,\r\n  0x56, 0xc8, 0x76, 0x47, 0x3b, 0x8d, 0xc6, 0x36, 0xf9, 0xec, 0x6f, 0x41,\r\n  0x49, 0x61, 0xa5, 0x1b, 0xbd, 0x64, 0x8d, 0x80, 0x94, 0x8d, 0x04, 0x8a,\r\n  0x83, 0x89, 0x02, 0x3d, 0xce, 0x10, 0x15, 0xd4, 0x8c, 0xf5, 0xaf, 0xd1,\r\n  0x1c, 0xac, 0x65, 0x7e, 0x8e, 0x5f, 0x85, 0xb9, 0x9d, 0xe1, 0x0e, 0x91,\r\n  0x43, 0x44, 0x42, 0x60, 0xdf, 0x5a, 0xd8, 0x0d, 0xfa, 0xb7, 0xcb, 0xfd,\r\n  0xab, 0xe6, 0xe5, 0xdd, 0x6e, 0xb3, 0x77, 0x64, 0x23, 0x6f, 0x35, 0xfb,\r\n  0xc6, 0xab, 0x73, 0x79, 0x3a, 0x76, 0x5b, 0x67, 0x97, 0x54, 0x06, 0x52,\r\n  0xdf, 0xb2, 0xe4, 0x3a, 0x27, 0xc5, 0x59, 0x4c, 0x33, 0xec, 0x9b, 0x28,\r\n  0x6e, 0x34, 0x57, 0x24, 0x8b, 0xbc, 0x92, 0x97, 0xe5, 0x5a, 0x0f, 0xfa,\r\n  0xb0, 0xc7, 0x7d, 0x28, 0xcb, 0xf9, 0xdd, 0x5e, 0x67, 0x1f, 0xac, 0x13,\r\n  0xb5, 0x5e, 0xb0, 0x05, 0x6f, 0xbd, 0xd8, 0x6b, 0xf7, 0x02, 0x9d, 0x58,\r\n  0xd3, 0x07, 0x7e, 0xb5, 0xd5, 0x87, 0x27, 0xd6, 0x87, 0x27, 0x1f, 0x3b,\r\n  0x0f, 0x61, 0x0f, 0x9e, 0xfc, 0xd2, 0x79, 0xe8, 0xec, 0xc3, 0x53, 0xee,\r\n  0x43, 0xba, 0xbc, 0x7b, 0xda, 0x78, 0x87, 0xa4, 0xa1, 0xf7, 0x36, 0x4d,\r\n  0xe3, 0x25, 0x4b, 0x19, 0x5e, 0x6e, 0xda, 0xb1, 0xf9, 0xfc, 0x8e, 0x3f,\r\n  0x46, 0x42, 0x8b, 0x0e, 0x24, 0x76, 0x70, 0x15, 0x28, 0x49, 0x27, 0xe7,\r\n  0xdc, 0xc3, 0x61, 0xa3, 0xb9, 0x12, 0x47, 0x72, 0xf3, 0xfe, 0x26, 0x25,\r\n  0x2b, 0x4d, 0xae, 0x54, 0xba, 0x8c, 0xe5, 0x2f, 0xf4, 0xca, 0xdd, 0x27,\r\n  0x43, 0xfd, 0x06, 0x5f, 0x16, 0x90, 0x2f, 0x4e, 0x3e, 0x55, 0x74, 0xa1,\r\n  0x94, 0x8d, 0xe6, 0x6c, 0x4e, 0xa4, 0x37, 0x89, 0x6a, 0xd4, 0xf4, 0x03,\r\n  0x6a, 0xea, 0xa9, 0x75, 0x2b, 0x11, 0x55, 0x2b, 0x18, 0xec, 0x27, 0x3a,\r\n  0xd8, 0x4f, 0xfe, 0xaf, 0x19, 0xec, 0x27, 0xeb, 0x07, 0x1b, 0xf3, 0x60,\r\n  0xe3, 0x25, 0x3b, 0x4f, 0x9a, 0xdb, 0x8b, 0xee, 0xd2, 0x6d, 0xf6, 0xbb,\r\n  0x6d, 0x45, 0xdf, 0xf1, 0x16, 0x82, 0x06, 0xc9, 0xf6, 0x68, 0xe6, 0xfc,\r\n  0x56, 0xe8, 0x95, 0xd8, 0x4a, 0x7c, 0x9f, 0x5b, 0x17, 0x3a, 0x9b, 0xb3,\r\n  0x1b, 0x35, 0x2e, 0xd8, 0xd2, 0x14, 0x67, 0x56, 0x20, 0xce, 0xe8, 0xff,\r\n  0x68, 0x8e, 0x9c, 0x17, 0x25, 0xad, 0x46, 0x32, 0xe1, 0x50, 0x13, 0xf9,\r\n  0xe9, 0x46, 0x73, 0x7c, 0x97, 0x67, 0xfd, 0x8a, 0x6d, 0xa8, 0x94, 0xfd,\r\n  0x66, 0x3c, 0x71, 0xce, 0x8a, 0xa6, 0xd9, 0x28, 0x20, 0xb4, 0x47, 0xec,\r\n  0x44, 0xe0, 0x5d, 0x0d, 0x4d, 0x00, 0xdd, 0xbd, 0x9a, 0xc7, 0x24, 0x88,\r\n  0x9a, 0xb3, 0x97, 0x5e, 0x93, 0x66, 0x2b, 0x6e, 0xac, 0x32, 0x5f, 0xf0,\r\n  0x29, 0xf8, 0x5a, 0x4f, 0x01, 0x2d, 0x51, 0x9a, 0x4d, 0xe7, 0x2b, 0xf8,\r\n  0x32, 0xce, 0x68, 0x60, 0xf4, 0xab, 0xad, 0x60, 0x02, 0x0f, 0x78, 0x02,\r\n  0xd9, 0xd5, 0x37, 0x8c, 0xe9, 0xca, 0xae, 0xa2, 0x17, 0xf2, 0x9f, 0xb2,\r\n  0x62, 0x2d, 0xf8, 0xf3, 0x6e, 0xc1, 0x3a, 0x56, 0x83, 0x96, 0x07, 0xf7,\r\n  0x96, 0x5f, 0x3d, 0x08, 0xde, 0xe1, 0x99, 0x2a, 0x69, 0xfe, 0x6c, 0xc6,\r\n  0x20, 0x1a, 0xed, 0x44, 0xd6, 0x9b, 0x1b, 0x73, 0x57, 0x69, 0xc0, 0xf1,\r\n  0x8c, 0x2f, 0x36, 0xb1, 0x16, 0xa2, 0xc3, 0xaf, 0x4e, 0x68, 0xab, 0x5c,\r\n  0xc5, 0xe9, 0x5c, 0x54, 0x59, 0xd9, 0x3a, 0x64, 0x2e, 0xcc, 0xf9, 0x56,\r\n  0x94, 0x49, 0x2b, 0x93, 0x9a, 0x61, 0xac, 0xff, 0xeb, 0xbd, 0xce, 0xff,\r\n  0x41, 0x33, 0x18, 0x6f, 0x3f, 0x1d, 0xed, 0xd0, 0x65, 0x7e, 0x99, 0x93,\r\n  0x8e, 0x31, 0xcd, 0x67, 0x49, 0x34, 0x99, 0xc7, 0xd9, 0x6d, 0x29, 0x77,\r\n  0x2a, 0x16, 0x44, 0x7a, 0x3a, 0x60, 0xdf, 0x70, 0x51, 0x90, 0x0a, 0x3f,\r\n  0x8b, 0x42, 0x87, 0xb1, 0x6d, 0x70, 0x19, 0x8e, 0x8a, 0x1b, 0x35, 0x51,\r\n  0xa2, 0x9f, 0x57, 0xbc, 0x1e, 0x8b, 0xb8, 0xb8, 0x35, 0x5b, 0x88, 0xfd,\r\n  0x14, 0xf1, 0x9c, 0x34, 0xef, 0x49, 0x82, 0x8e, 0xe1, 0xf9, 0x76, 0x73,\r\n  0xc3, 0xaf, 0x71, 0x61, 0xd1, 0x7e, 0x61, 0x9f, 0xa5, 0x9c, 0x84, 0xdc,\r\n  0xcc, 0x26, 0xbf, 0x20, 0xfe, 0xb0, 0x62, 0xe0, 0xfa, 0x60, 0x5a, 0xca,\r\n  0xfe, 0x35, 0xdf, 0x10, 0x9b, 0x0e, 0xa5, 0x78, 0x41, 0xe7, 0x31, 0xe9,\r\n  0x03, 0x3c, 0x73, 0xd8, 0x3d, 0x6a, 0x2a, 0x05, 0x0b, 0x3c, 0x24, 0xed,\r\n  0x90, 0xbd, 0xb8, 0xdd, 0x4b, 0x79, 0xc9, 0x47, 0xd1, 0xed, 0xfc, 0xab,\r\n  0xf4, 0x7a, 0x55, 0x24, 0xa2, 0x53, 0xc2, 0xf1, 0x6b, 0xfe, 0x5e, 0xbe,\r\n  0x7d, 0x6f, 0x72, 0xec, 0x2f, 0xba, 0x04, 0x93, 0xf9, 0xd5, 0xa0, 0xd1,\r\n  0x1c, 0x6b, 0x12, 0x10, 0xde, 0xe8, 0x13, 0x74, 0x94, 0x32, 0x99, 0xa2,\r\n  0xb1, 0x2c, 0x51, 0x5d, 0x12, 0xf2, 0x99, 0x1d, 0x85, 0xd1, 0x74, 0x1e,\r\n  0xa7, 0x0b, 0x9c, 0x6e, 0xf5, 0x83, 0x35, 0x77, 0xc6, 0xa5, 0x5a, 0x91,\r\n  0xd8, 0x12, 0x13, 0x36, 0x62, 0x8b, 0x92, 0xcd, 0x54, 0x48, 0x29, 0xbb,\r\n  0xbe, 0xc5, 0x44, 0xbc, 0x49, 0xa6, 0xb7, 0xd8, 0x76, 0x81, 0xe2, 0xde,\r\n  0x94, 0x55, 0x32, 0xeb, 0x25, 0x04, 0xd1, 0x8a, 0x36, 0xc2, 0x32, 0x2f,\r\n  0xcb, 0x74, 0xc2, 0x9b, 0x8e, 0x0c, 0xbb, 0xd5, 0x14, 0xcb, 0x4c, 0xab,\r\n  0x98, 0xbc, 0x27, 0x83, 0x8d, 0xee, 0x9a, 0x0a, 0x6e, 0x76, 0x6c, 0x8c,\r\n  0x21, 0x6d, 0x82, 0xe5, 0xba, 0xde, 0xc9, 0x9a, 0xd4, 0xc5, 0x40, 0xa9,\r\n  0xb6, 0x37, 0xcc, 0x5a, 0x31, 0x74, 0xa7, 0x51, 0x63, 0x36, 0x1b, 0xcd,\r\n  0xc9, 0xdc, 0x0e, 0xd8, 0xb3, 0xc3, 0xb2, 0x54, 0x8c, 0x37, 0x78, 0xbf,\r\n  0xc8, 0x54, 0x53, 0x65, 0x71, 0x12, 0x97, 0xe9, 0x94, 0x37, 0xd0, 0x2c,\r\n  0xbd, 0x4e, 0x58, 0x60, 0x90, 0xfe, 0x58, 0xcd, 0x17, 0x83, 0x50, 0x11,\r\n  0x75, 0x2b, 0x6e, 0xb7, 0x65, 0x7b, 0x5b, 0x79, 0x61, 0x22, 0x1a, 0x8d,\r\n  0xdb, 0x1d, 0x66, 0x92, 0x90, 0x39, 0x43, 0x7a, 0x21, 0xbb, 0xa2, 0x67,\r\n  0x7c, 0xfa, 0xd0, 0x15, 0xea, 0x85, 0x8a, 0xcc, 0xa6, 0xd8, 0x81, 0x57,\r\n  0x81, 0x0e, 0x0a, 0x09, 0x97, 0x01, 0x9f, 0x90, 0x29, 0x6c, 0xbd, 0x45,\r\n  0xfc, 0x80, 0x25, 0x22, 0xdb, 0xc8, 0x59, 0x23, 0x38, 0x1b, 0xec, 0xe0,\r\n  0xb9, 0x4f, 0xa7, 0x62, 0xdb, 0xf3, 0x84, 0x74, 0x28, 0x81, 0xd3, 0x79,\r\n  0xca, 0xcf, 0x2d, 0x56, 0x25, 0xec, 0x7e, 0x5c, 0x52, 0xb8, 0x16, 0xee,\r\n  0x69, 0xa9, 0x46, 0x72, 0x2e, 0x12, 0xb1, 0xde, 0x48, 0xf1, 0x66, 0xa3,\r\n  0x32, 0x2e, 0x52, 0xf8, 0x7f, 0x5a, 0xcd, 0x49, 0x9f, 0x79, 0x98, 0xe8,\r\n  0xa7, 0x76, 0x93, 0x5f, 0x57, 0x13, 0xcb, 0x9b, 0x56, 0x38, 0x3b, 0x2c,\r\n  0x73, 0x82, 0x83, 0x33, 0xe1, 0x49, 0x96, 0xf0, 0x45, 0xf4, 0x82, 0xaf,\r\n  0xa3, 0x97, 0x3c, 0x98, 0x35, 0x22, 0x31, 0x3a, 0x87, 0xdb, 0xe9, 0xa6,\r\n  0x6e, 0x7f, 0x05, 0xb2, 0x4f, 0xb4, 0x62, 0x69, 0x0e, 0x3e, 0x3a, 0x9a,\r\n  0x70, 0xda, 0xfc, 0xcd, 0x9d, 0x4a, 0x3b, 0x33, 0x61, 0x69, 0xe8, 0x5a,\r\n  0x5a, 0x7a, 0xd5, 0x9f, 0xd6, 0x26, 0x49, 0xef, 0x68, 0xe0, 0xde, 0x99,\r\n  0x23, 0x4d, 0xc3, 0xcb, 0x1a, 0xf5, 0xc6, 0x49, 0xd5, 0x6c, 0xee, 0x10,\r\n  0xdf, 0xdb, 0xef, 0x45, 0x81, 0xbb, 0x56, 0xda, 0xd5, 0xc9, 0x9b, 0x24,\r\n  0xe6, 0x8c, 0x15, 0x65, 0x3b, 0xea, 0x71, 0x70, 0x6f, 0xf7, 0xe5, 0xb7,\r\n  0x07, 0xa7, 0x6f, 0x8f, 0x77, 0xff, 0xda, 0xdc, 0x3e, 0xf4, 0xbb, 0x3d,\r\n  0xf9, 0xdd, 0x5e, 0xaf, 0x4b, 0x66, 0x91, 0x4d, 0xd3, 0x7f, 0xd9, 0x8f,\r\n  0xca, 0x87, 0xc5, 0x24, 0x9f, 0x3b, 0xa9, 0xa5, 0x5f, 0xe0, 0x2e, 0x0c,\r\n  0x54, 0x43, 0xa8, 0xe4, 0x82, 0xe3, 0x59, 0xe1, 0xbe, 0xf3, 0x0d, 0xd9,\r\n  0xec, 0x3b, 0x5c, 0x8e, 0xf0, 0xce, 0xc1, 0xae, 0xe3, 0x3d, 0x10, 0xcf,\r\n  0xc2, 0xf9, 0x28, 0x2b, 0xdc, 0x79, 0xba, 0x44, 0xdc, 0xba, 0xf8, 0xb9,\r\n  0x06, 0x72, 0x90, 0x9a, 0xe2, 0xdc, 0x0d, 0xd8, 0xf7, 0x89, 0xd7, 0x80,\r\n  0xd4, 0x0a, 0x48, 0x58, 0x6c, 0xac, 0x07, 0xda, 0xbc, 0xd5, 0xf4, 0x66,\r\n  0x44, 0xd7, 0x9a, 0xc8, 0x14, 0x3e, 0xe5, 0x72, 0x3e, 0x9b, 0x02, 0x8f,\r\n  0x25, 0x3e, 0xc2, 0x6d, 0x77, 0x34, 0x90, 0x52, 0x36, 0x6f, 0x4f, 0xfb,\r\n  0xb2, 0x8c, 0x49, 0xa6, 0x93, 0x39, 0x2d, 0x07, 0xda, 0x47, 0xa3, 0x20,\r\n  0x67, 0xf9, 0x88, 0x15, 0xcd, 0xe6, 0xe8, 0xec, 0xe4, 0x0b, 0xfe, 0xa4,\r\n  0xc6, 0xcb, 0x38, 0xf0, 0xa9, 0xe3, 0xc0, 0x79, 0xa2, 0x6e, 0xb3, 0x13,\r\n  0xee, 0x41, 0x0f, 0x65, 0xbf, 0x48, 0xf4, 0x04, 0x8b, 0xbf, 0xad, 0xb9,\r\n  0xf5, 0xa9, 0xb1, 0x09, 0x19, 0xfe, 0xa2, 0x6e, 0xc9, 0x05, 0x06, 0x0b,\r\n  0xf5, 0x94, 0xf7, 0xf4, 0x3c, 0x57, 0xa1, 0xee, 0x8d, 0x68, 0xf5, 0x29,\r\n  0xea, 0x1e, 0xe8, 0xb4, 0xce, 0xc4, 0xe9, 0xa8, 0xab, 0x60, 0xbd, 0x94,\r\n  0x83, 0xe5, 0x66, 0x96, 0xec, 0x40, 0xbe, 0x63, 0xb1, 0xed, 0x4d, 0xe8,\r\n  0xb2, 0xfb, 0xbd, 0xa3, 0xb9, 0x37, 0x49, 0x55, 0x92, 0x82, 0x98, 0x6c,\r\n  0xeb, 0xa5, 0x6d, 0xcb, 0x18, 0xf4, 0xa3, 0x2d, 0xbd, 0xce, 0x2e, 0x8f,\r\n  0xcd, 0xc7, 0xe9, 0xba, 0xe4, 0xbd, 0x89, 0x22, 0x2a, 0xc3, 0x63, 0x6b,\r\n  0x7e, 0x48, 0xac, 0x78, 0xdc, 0x52, 0x9a, 0xb2, 0xe5, 0x8a, 0xf4, 0xb4,\r\n  0x37, 0xb9, 0x1b, 0x8e, 0x5d, 0xa1, 0xba, 0xb3, 0xec, 0x64, 0xd0, 0x67,\r\n  0xa0, 0x4e, 0xe0, 0xc7, 0x91, 0x0b, 0x69, 0x36, 0xc5, 0x8d, 0xdd, 0x7e,\r\n  0xc3, 0xa9, 0xef, 0xc2, 0xf0, 0xef, 0xb1, 0xbf, 0xed, 0x35, 0x04, 0x86,\r\n  0xd9, 0xa2, 0x8b, 0x3c, 0x23, 0x43, 0xfc, 0x2e, 0x71, 0x82, 0xa2, 0xfb,\r\n  0xce, 0xf2, 0xce, 0x27, 0x13, 0xd9, 0x47, 0xb8, 0x06, 0x56, 0x8b, 0xa5,\r\n  0x2a, 0x13, 0x7f, 0xf8, 0xfd, 0x74, 0x87, 0x2f, 0x55, 0x39, 0x1c, 0xc6,\r\n  0xe5, 0x34, 0x4d, 0xbb, 0x14, 0x6c, 0x0e, 0x7f, 0x6f, 0x45, 0xc7, 0xf0,\r\n  0xe5, 0x44, 0x07, 0xe3, 0xc3, 0x93, 0x13, 0xe7, 0xf4, 0x1c, 0x49, 0x90,\r\n  0x00, 0x91, 0x6f, 0x3d, 0x49, 0xb8, 0xd4, 0xe4, 0xe4, 0x4c, 0x9a, 0xfa,\r\n  0x51, 0xc2, 0xe6, 0xfe, 0x94, 0xef, 0x53, 0x8e, 0x47, 0xca, 0x58, 0xe9,\r\n  0x71, 0x76, 0xb9, 0x63, 0xc5, 0xe9, 0x4e, 0x2a, 0xd5, 0x59, 0xf3, 0xd7,\r\n  0xea, 0x61, 0x99, 0xbc, 0x3c, 0xe8, 0xa9, 0x02, 0x26, 0xe3, 0x6c, 0x9e,\r\n  0x80, 0x78, 0xc5, 0xe6, 0x82, 0xc8, 0x3a, 0xdc, 0x3c, 0xbc, 0x7e, 0x33,\r\n  0x75, 0x70, 0xaa, 0xd8, 0xa3, 0x0b, 0x9f, 0x74, 0x95, 0x99, 0xf8, 0xde,\r\n  0xe8, 0x82, 0x79, 0xb2, 0x47, 0xa2, 0x8b, 0x2e, 0xf3, 0x45, 0x19, 0x2a,\r\n  0x50, 0xb8, 0x7b, 0x3f, 0x46, 0x7d, 0xe2, 0x1d, 0x80, 0xbd, 0xff, 0x25,\r\n  0xbf, 0xd1, 0xb8, 0xf4, 0x47, 0x5e, 0x6d, 0x68, 0x2b, 0x87, 0x16, 0xa6,\r\n  0xd1, 0x9b, 0xb1, 0xb1, 0x78, 0x2b, 0x71, 0x37, 0x90, 0xf6, 0x53, 0xcd,\r\n  0x49, 0x5c, 0x0d, 0xa2, 0x55, 0xc6, 0xff, 0x75, 0x3e, 0x2f, 0xef, 0x0d,\r\n  0xf4, 0xc6, 0x0a, 0x9b, 0x23, 0x45, 0x4a, 0x43, 0x8b, 0xa3, 0x50, 0x66,\r\n  0x8a, 0xea, 0xec, 0x0c, 0x31, 0x1c, 0x25, 0x0e, 0xf6, 0x42, 0x0a, 0xcf,\r\n  0x52, 0x06, 0x0a, 0x50, 0x97, 0x9b, 0xb2, 0xae, 0xae, 0x0b, 0x9a, 0x32,\r\n  0x18, 0x6d, 0x96, 0x2b, 0xd6, 0x57, 0x48, 0x86, 0x9b, 0x36, 0xe2, 0xf5,\r\n  0x13, 0x9a, 0x50, 0x53, 0x44, 0x9a, 0x82, 0x9d, 0xe4, 0x65, 0x68, 0x81,\r\n  0x34, 0x4f, 0xcb, 0x0b, 0x6c, 0x76, 0x96, 0xfe, 0x1f, 0x32, 0x3f, 0x72,\r\n  0x15, 0x90, 0x78, 0xc1, 0x79, 0x83, 0x6d, 0x35, 0xc4, 0x89, 0x8d, 0x30,\r\n  0xbe, 0x9e, 0xd8, 0x66, 0x3f, 0xae, 0xd8, 0x57, 0x8c, 0x5b, 0x99, 0x7d,\r\n  0x55, 0x7c, 0x1d, 0x39, 0x8d, 0x60, 0x14, 0x1d, 0x22, 0x32, 0xc3, 0x6d,\r\n  0x94, 0x68, 0xc4, 0x64, 0x84, 0x9f, 0xcc, 0x96, 0x03, 0x22, 0xd6, 0xab,\r\n  0x39, 0x0e, 0x84, 0x12, 0xfa, 0x46, 0x33, 0x74, 0x9f, 0x20, 0xdc, 0x55,\r\n  0x6b, 0xca, 0x5d, 0xe8, 0x78, 0xad, 0xdb, 0x9f, 0x21, 0x57, 0xfc, 0x66,\r\n  0xb9, 0x35, 0xd2, 0xfb, 0xd5, 0x5e, 0x66, 0x1f, 0xea, 0x6d, 0x96, 0xdf,\r\n  0x93, 0x4a, 0x93, 0xe5, 0xf2, 0x19, 0x3b, 0xc5, 0xdc, 0xeb, 0xe6, 0xa4,\r\n  0x57, 0x49, 0x28, 0xe8, 0xc3, 0x27, 0x2b, 0x18, 0xc7, 0x12, 0x0a, 0x63,\r\n  0xe3, 0xc8, 0x24, 0xb3, 0x4d, 0x5b, 0xa7, 0xfd, 0xaa, 0x12, 0x5a, 0x8c,\r\n  0x5c, 0x68, 0x89, 0x62, 0x93, 0x99, 0xb9, 0x2b, 0xb7, 0xb7, 0xe0, 0x73,\r\n  0xc4, 0x72, 0x9a, 0xc5, 0xe5, 0xcd, 0x20, 0xea, 0x0d, 0x7b, 0x83, 0x8e,\r\n  0xfd, 0xdf, 0x14, 0xc0, 0xd6, 0x2f, 0x77, 0x68, 0x5b, 0x77, 0x81, 0x7a,\r\n  0x54, 0x5b, 0x3e, 0x4c, 0x0d, 0xa6, 0xe9, 0xbd, 0x2c, 0x1d, 0xb2, 0x71,\r\n  0x24, 0xd9, 0x35, 0x3f, 0x88, 0x6d, 0xdf, 0xd4, 0xc1, 0x39, 0xb8, 0x15,\r\n  0xde, 0xcf, 0x38, 0x89, 0x12, 0x85, 0x43, 0xd7, 0x46, 0xd1, 0x41, 0x26,\r\n  0xd1, 0xd2, 0xfb, 0x18, 0x5b, 0xcf, 0x7d, 0x02, 0x0a, 0x4d, 0xfb, 0x00,\r\n  0x9a, 0x33, 0xba, 0x76, 0x21, 0xe9, 0x8d, 0xdb, 0x29, 0xb1, 0xed, 0x53,\r\n  0x11, 0x1f, 0x02, 0x92, 0x94, 0x7d, 0x28, 0xc0, 0xea, 0x09, 0xe0, 0xf3,\r\n  0xe4, 0x27, 0x45, 0xa4, 0xf7, 0xfd, 0x4d, 0x3e, 0x17, 0x9d, 0xa2, 0xe9,\r\n  0xb0, 0x74, 0x7a, 0x6d, 0x74, 0x9f, 0xc3, 0x60, 0x86, 0x39, 0x4d, 0x4d,\r\n  0xe0, 0xd6, 0x29, 0x12, 0x36, 0xb9, 0x60, 0xf0, 0x90, 0xf5, 0x4b, 0xdf,\r\n  0x9a, 0x27, 0x71, 0x31, 0x7f, 0x30, 0xa5, 0x67, 0x78, 0xd7, 0x68, 0x0e,\r\n  0x33, 0xca, 0x5e, 0x8f, 0x98, 0xc6, 0x5e, 0x64, 0xfc, 0x8c, 0xfa, 0x7c,\r\n  0x0d, 0xbe, 0x50, 0x89, 0x17, 0x5e, 0xe2, 0x3a, 0x7c, 0xe1, 0xde, 0xa5,\r\n  0x6c, 0x5f, 0xd1, 0x66, 0x23, 0x3d, 0xbd, 0xb9, 0x13, 0x27, 0xf1, 0xf4,\r\n  0x16, 0x5b, 0x06, 0x4d, 0x4a, 0xc8, 0xe9, 0x06, 0x50, 0x1c, 0x35, 0xca,\r\n  0xe8, 0x28, 0xde, 0xd0, 0x3d, 0x45, 0x96, 0xe2, 0x2a, 0x5e, 0x37, 0x5d,\r\n  0x0d, 0x8f, 0xd2, 0x87, 0xee, 0xb8, 0xfa, 0x79, 0xec, 0x52, 0x34, 0xd7,\r\n  0xdc, 0x80, 0x87, 0xb2, 0x78, 0x24, 0xfc, 0xb2, 0x15, 0x5d, 0x83, 0x55,\r\n  0xf4, 0x22, 0xbf, 0xba, 0xa2, 0xad, 0xfe, 0x79, 0x4b, 0xd1, 0x96, 0x47,\r\n  0xb6, 0x2f, 0x80, 0x66, 0x8a, 0xbc, 0xe2, 0x5e, 0x8f, 0xd6, 0x46, 0xa6,\r\n  0xbb, 0x44, 0xd7, 0x29, 0xaf, 0x45, 0x24, 0xcd, 0xb5, 0x2d, 0xcc, 0xe6,\r\n  0x13, 0x91, 0xdd, 0x1c, 0x91, 0x86, 0x37, 0x3c, 0xfc, 0x89, 0x2e, 0xcc,\r\n  0x2a, 0xd1, 0x68, 0x91, 0x0e, 0xa3, 0xa9, 0xfb, 0xde, 0xa6, 0xcb, 0x25,\r\n  0x2f, 0x16, 0xf0, 0x13, 0xce, 0x22, 0xe2, 0xd6, 0x26, 0x09, 0x9d, 0x09,\r\n  0xac, 0xa9, 0x05, 0x07, 0xf2, 0x15, 0x5d, 0xc3, 0x7a, 0x8a, 0xe9, 0xd7,\r\n  0x74, 0xd2, 0x9b, 0xcd, 0x99, 0x0a, 0xef, 0x03, 0x9e, 0x6a, 0xef, 0xcc,\r\n  0x38, 0xb8, 0x99, 0xa9, 0x00, 0xe5, 0x65, 0xc2, 0xa2, 0xe0, 0xd2, 0x56,\r\n  0x03, 0xb2, 0xeb, 0xf0, 0xbf, 0xf2, 0x46, 0x92, 0x1d, 0xe8, 0xf1, 0xc9,\r\n  0xff, 0x3c, 0xf6, 0xe1, 0x69, 0x17, 0xff, 0x7d, 0xc0, 0x6e, 0x6f, 0xed,\r\n  0x87, 0xb7, 0x74, 0xd4, 0x7a, 0xc3, 0xc3, 0x68, 0xd8, 0x43, 0x47, 0x6a,\r\n  0xbe, 0xbc, 0x55, 0x95, 0x73, 0x0c, 0x41, 0xe2, 0xf8, 0xc0, 0x54, 0xf1,\r\n  0x86, 0x63, 0x73, 0xb1, 0x48, 0xb6, 0x39, 0x72, 0xd3, 0xf6, 0x23, 0x09,\r\n  0x20, 0x4d, 0x27, 0xdb, 0x6b, 0x33, 0x27, 0x95, 0x40, 0x2a, 0xa0, 0x57,\r\n  0xf0, 0xef, 0x64, 0x7d, 0x24, 0x46, 0xb8, 0x0d, 0x65, 0x52, 0x22, 0xdc,\r\n  0x6d, 0x59, 0xa0, 0x7e, 0x15, 0x89, 0xe7, 0x75, 0x08, 0xb3, 0xdf, 0xd0,\r\n  0xdb, 0x33, 0x4d, 0x97, 0x37, 0xac, 0x36, 0xbe, 0x40, 0x98, 0x8a, 0x1d,\r\n  0x4c, 0xf2, 0x83, 0xcf, 0x3b, 0xbd, 0xef, 0x63, 0x3d, 0x17, 0xa5, 0xde,\r\n  0xa4, 0xf6, 0xb6, 0xca, 0xaf, 0xd4, 0x20, 0x3f, 0x06, 0x44, 0x90, 0x2b,\r\n  0x84, 0x9b, 0x6e, 0xc7, 0x48, 0xdc, 0xcb, 0x62, 0xbc, 0x3b, 0xd8, 0x8b,\r\n  0x80, 0x2b, 0xec, 0xb7, 0xa3, 0xe8, 0x82, 0xef, 0xc9, 0xd5, 0x92, 0x63,\r\n  0xff, 0x40, 0x0b, 0xe2, 0xe7, 0x8d, 0xe6, 0xd0, 0xf9, 0x40, 0x3b, 0x02,\r\n  0x9c, 0x2e, 0xfc, 0x5c, 0x56, 0x33, 0x27, 0xd2, 0xf0, 0x77, 0xa4, 0x31,\r\n  0xee, 0x37, 0x75, 0x69, 0x8f, 0xdb, 0x21, 0xd9, 0x98, 0x95, 0xe5, 0x1c,\r\n  0x48, 0xa9, 0x59, 0x3e, 0x2d, 0xb7, 0xe3, 0xe5, 0xb2, 0xdc, 0xb6, 0xce,\r\n  0xd5, 0x30, 0x51, 0x66, 0x75, 0x8c, 0xc7, 0xc1, 0xd8, 0xf8, 0xda, 0x15,\r\n  0xb7, 0x94, 0xd3, 0x96, 0x60, 0xae, 0x93, 0x34, 0x15, 0xef, 0xea, 0x29,\r\n  0x6e, 0x8e, 0xaf, 0xb2, 0xd5, 0xe5, 0xe9, 0x18, 0xd3, 0xd5, 0xbc, 0x39,\r\n  0x57, 0xb4, 0x70, 0xb6, 0x38, 0xdc, 0xb6, 0x35, 0x0d, 0x3b, 0x4e, 0x6c,\r\n  0xa3, 0xf1, 0xf8, 0x10, 0x3f, 0x1c, 0xaf, 0x58, 0x85, 0xa1, 0x4f, 0x14,\r\n  0x0f, 0x2a, 0x38, 0x5a, 0x37, 0x0d, 0x8f, 0x36, 0xfa, 0xe8, 0xff, 0xe9,\r\n  0x44, 0x5c, 0xa7, 0xd5, 0xe8, 0x2a, 0x99, 0xe5, 0x45, 0xdc, 0xf2, 0x94,\r\n  0xe5, 0x0c, 0x59, 0xc3, 0xec, 0x4c, 0xe9, 0xa9, 0x6d, 0xd2, 0x8e, 0xdf,\r\n  0xd1, 0x7c, 0x8d, 0xf8, 0xef, 0xb0, 0xee, 0x64, 0xd2, 0xec, 0xc7, 0x3c,\r\n  0x5f, 0x7f, 0x3c, 0x42, 0x10, 0x9c, 0x0e, 0x43, 0xf9, 0x7b, 0xee, 0x6b,\r\n  0xd2, 0xd1, 0x10, 0x02, 0x98, 0x75, 0x2b, 0x85, 0x17, 0xe6, 0x13, 0x8c,\r\n  0xfc, 0x93, 0x3e, 0x28, 0xde, 0xc4, 0x06, 0x93, 0x1a, 0x76, 0x9d, 0xd3,\r\n  0x75, 0x7a, 0xb3, 0xe8, 0x8c, 0x43, 0x98, 0x5b, 0xb2, 0x54, 0x28, 0xaa,\r\n  0x18, 0x6a, 0x22, 0x10, 0x56, 0x59, 0xf0, 0x01, 0x9a, 0x0c, 0x12, 0x15,\r\n  0x99, 0x2a, 0x42, 0x1d, 0xcb, 0xd3, 0x18, 0xb9, 0x3a, 0xbe, 0x4c, 0xdc,\r\n  0xc1, 0x51, 0x5e, 0xc2, 0xf7, 0x48, 0xed, 0x7a, 0xa0, 0xb2, 0x38, 0xae,\r\n  0xd9, 0x45, 0xdd, 0xd5, 0x3b, 0x4c, 0x51, 0xe3, 0x12, 0xaf, 0x4f, 0x15,\r\n  0x8e, 0xeb, 0x90, 0xa7, 0x97, 0x85, 0xdd, 0x8b, 0x92, 0x34, 0x1a, 0xfa,\r\n  0xce, 0xe7, 0xad, 0x10, 0xee, 0xfb, 0x74, 0xb1, 0x5a, 0x44, 0x58, 0x07,\r\n  0xf1, 0x8e, 0xeb, 0x93, 0x6a, 0x19, 0xf0, 0x25, 0x4d, 0x72, 0x53, 0xc3,\r\n  0xdb, 0x5e, 0x0a, 0xa8, 0xb8, 0x6f, 0x5e, 0x32, 0x32, 0x26, 0xfe, 0x1d,\r\n  0x29, 0x53, 0x23, 0x55, 0xd1, 0x34, 0x64, 0xbe, 0xe0, 0xd8, 0xa9, 0x69,\r\n  0x63, 0xae, 0x9d, 0x68, 0x79, 0x13, 0x97, 0x0c, 0x1b, 0xe3, 0xc8, 0x78,\r\n  0xe7, 0x42, 0xdc, 0xb0, 0x83, 0x48, 0xdf, 0x48, 0x5a, 0xa6, 0x51, 0x0e,\r\n  0x8d, 0x18, 0xd1, 0x62, 0x9a, 0xde, 0x11, 0x23, 0x72, 0xc5, 0xbc, 0xec,\r\n  0x70, 0xbf, 0xc3, 0x3a, 0x59, 0xc4, 0xef, 0x31, 0x2d, 0x8f, 0x2a, 0x62,\r\n  0xbf, 0xd1, 0x86, 0x85, 0xe2, 0x46, 0xf6, 0x50, 0xd1, 0xdc, 0x13, 0xb5,\r\n  0x70, 0x14, 0x8d, 0xed, 0xef, 0xb4, 0xa5, 0x54, 0x75, 0x95, 0xc8, 0x41,\r\n  0x34, 0x34, 0x68, 0x40, 0x03, 0x14, 0x28, 0x6d, 0x76, 0x78, 0x53, 0x18,\r\n  0xa9, 0x45, 0x3b, 0x32, 0x2e, 0x18, 0xc6, 0x9c, 0xd3, 0x65, 0x17, 0x09,\r\n  0x32, 0x25, 0xa7, 0x1f, 0xdc, 0xa4, 0xd4, 0xf7, 0x62, 0x7a, 0xf3, 0xc0,\r\n  0xe6, 0x07, 0x3b, 0x4e, 0x39, 0xae, 0xf4, 0x88, 0xe1, 0x8c, 0x6f, 0xa8,\r\n  0x2f, 0x93, 0x3a, 0x1f, 0xf1, 0xfe, 0xa6, 0xc7, 0xec, 0x22, 0x6f, 0xf4,\r\n  0x8f, 0x95, 0x62, 0x3e, 0x5b, 0xc9, 0x9c, 0x17, 0x80, 0x26, 0xb0, 0xab,\r\n  0x77, 0xc3, 0x3c, 0x30, 0x0a, 0x70, 0x7f, 0xd2, 0xb2, 0x51, 0xe3, 0xac,\r\n  0x92, 0x8a, 0xe3, 0x4d, 0x3e, 0xc5, 0xce, 0x63, 0xf9, 0x1a, 0x1b, 0x4a,\r\n  0x6c, 0x50, 0x35, 0x8d, 0x2c, 0x0d, 0x97, 0xe9, 0xeb, 0x36, 0xf7, 0x16,\r\n  0x2e, 0x6b, 0x19, 0x09, 0xb9, 0xfe, 0xca, 0xac, 0x29, 0x9b, 0x15, 0xb9,\r\n  0xf1, 0x9c, 0xe1, 0xc3, 0x1a, 0x08, 0x75, 0x45, 0x50, 0xfa, 0x2c, 0x6c,\r\n  0x69, 0xfd, 0xae, 0xaa, 0x96, 0x73, 0x36, 0x58, 0xd2, 0xfa, 0x4a, 0xcf,\r\n  0xaf, 0xe0, 0x0d, 0xd9, 0x62, 0x35, 0x90, 0x76, 0x4a, 0x15, 0x9d, 0xbe,\r\n  0xe2, 0x73, 0x70, 0x78, 0x41, 0xff, 0x4d, 0x2d, 0xde, 0xc8, 0xfa, 0x35,\r\n  0x30, 0xf7, 0xec, 0x6c, 0x78, 0xfd, 0xed, 0x38, 0xda, 0x3c, 0x1b, 0x6f,\r\n  0x3f, 0x79, 0xbe, 0xb3, 0xd5, 0x6c, 0x8b, 0x67, 0x0a, 0x46, 0x70, 0xa7,\r\n  0xfd, 0x3b, 0xde, 0xe6, 0x54, 0x85, 0x2d, 0xe4, 0x93, 0xdc, 0x89, 0x81,\r\n  0x1f, 0x78, 0x87, 0xce, 0x8f, 0x5f, 0x9b, 0x17, 0x4f, 0x22, 0xf5, 0xd1,\r\n  0x21, 0xf5, 0x87, 0x83, 0x10, 0xed, 0x8d, 0x73, 0x91, 0xdc, 0x99, 0x27,\r\n  0xf0, 0x94, 0xef, 0x23, 0x9c, 0x79, 0x76, 0x36, 0xda, 0xcd, 0xbd, 0x4c,\r\n  0x58, 0x25, 0xf3, 0xef, 0xab, 0x8e, 0x29, 0x77, 0x60, 0x4b, 0x6d, 0x9a,\r\n  0x40, 0x44, 0x94, 0xd4, 0xa5, 0x02, 0xa2, 0x97, 0xc1, 0x67, 0xb3, 0xdf,\r\n  0xef, 0x84, 0xd9, 0x9c, 0x1c, 0x00, 0x2f, 0x43, 0xb3, 0x0c, 0xb4, 0xcc,\r\n  0xa7, 0x0e, 0xa9, 0x3d, 0x9c, 0xc1, 0x1d, 0xc1, 0xfe, 0x9f, 0x17, 0x8f,\r\n  0x39, 0xee, 0xc7, 0x89, 0x0a, 0xbc, 0x24, 0x44, 0x26, 0xe2, 0x3d, 0xf8,\r\n  0xd5, 0x01, 0x21, 0xb3, 0x88, 0x53, 0xe0, 0xd7, 0xef, 0x94, 0x7e, 0x03,\r\n  0x07, 0x6d, 0x86, 0x4d, 0x11, 0x3f, 0xc8, 0x8c, 0xc5, 0xd1, 0xa4, 0xc8,\r\n  0xef, 0x91, 0xae, 0x01, 0x10, 0x97, 0xec, 0x3d, 0x76, 0xb9, 0x48, 0x0e,\r\n  0xc7, 0x4d, 0xcb, 0x37, 0x49, 0x4b, 0x3a, 0x57, 0x18, 0x10, 0x89, 0xf8,\r\n  0xaf, 0x2f, 0x5f, 0x9f, 0x62, 0x59, 0x71, 0x81, 0x2c, 0x35, 0x14, 0x8e,\r\n  0xef, 0xac, 0x26, 0x24, 0x5a, 0xd9, 0x08, 0xab, 0x9c, 0x8b, 0x89, 0xe7,\r\n  0xab, 0xcb, 0x1b, 0xe6, 0x94, 0xe2, 0x65, 0x57, 0xac, 0x42, 0xc5, 0xb7,\r\n  0x79, 0x95, 0xb1, 0x98, 0x64, 0x6d, 0xd2, 0x35, 0xf2, 0xb0, 0x6c, 0xee,\r\n  0x1c, 0xd2, 0x99, 0xe6, 0xea, 0x0d, 0xda, 0x7e, 0x3f, 0x24, 0xb5, 0x6a,\r\n  0xc8, 0x9d, 0x1b, 0x52, 0xf3, 0x12, 0x71, 0xe5, 0xc0, 0xf5, 0x21, 0xdd,\r\n  0x92, 0xbc, 0x51, 0xa8, 0xf9, 0xe1, 0x2b, 0x5e, 0x0a, 0x7e, 0xa4, 0xb5,\r\n  0x7c, 0xbc, 0x4a, 0xb6, 0x4c, 0xde, 0xc2, 0xc1, 0xec, 0x89, 0x5f, 0x89,\r\n  0x7f, 0x23, 0xee, 0x47, 0xb8, 0x60, 0x39, 0xcb, 0x44, 0x03, 0x23, 0xa4,\r\n  0x51, 0xb7, 0x7c, 0x30, 0xec, 0xf4, 0x2e, 0x1e, 0x04, 0x0d, 0xa6, 0x6e,\r\n  0x69, 0x8b, 0xce, 0x39, 0x7b, 0x5c, 0x9a, 0x94, 0x27, 0xbd, 0x0b, 0x3c,\r\n  0x67, 0x4d, 0x6a, 0xd8, 0xf2, 0x49, 0x22, 0x7e, 0xcc, 0xaf, 0x91, 0x12,\r\n  0xbb, 0x82, 0xf6, 0x10, 0xcb, 0x42, 0x48, 0x40, 0x1a, 0xd8, 0xeb, 0x18,\r\n  0x0e, 0x66, 0x6b, 0xd8, 0x4d, 0x42, 0xa7, 0xd9, 0xca, 0x50, 0x3d, 0x51,\r\n  0x41, 0xca, 0xc4, 0x81, 0xb8, 0xec, 0x10, 0xe0, 0x22, 0x83, 0x2a, 0xc9,\r\n  0xf7, 0xa1, 0x01, 0xee, 0x0d, 0xad, 0x35, 0x6c, 0xb9, 0x2c, 0xd4, 0xf3,\r\n  0x31, 0x08, 0xa2, 0x45, 0x29, 0xdf, 0x03, 0x21, 0xc2, 0xd6, 0x63, 0x0a,\r\n  0x16, 0x49, 0x71, 0xcd, 0x3f, 0xa9, 0x72, 0x32, 0xbc, 0xdb, 0x2a, 0xb7,\r\n  0xa2, 0x6a, 0x1c, 0xac, 0x16, 0x0e, 0xa1, 0x7f, 0x1b, 0x4a, 0x28, 0x07,\r\n  0xb7, 0xf9, 0x8a, 0xd5, 0x21, 0xf5, 0x14, 0xf5, 0x87, 0xb3, 0x48, 0x63,\r\n  0x62, 0x19, 0xcd, 0x04, 0xad, 0x63, 0xdb, 0xe4, 0x9c, 0xcf, 0x5f, 0xce,\r\n  0xc9, 0x00, 0x7e, 0xe8, 0x47, 0x0a, 0xff, 0x54, 0x50, 0x60, 0x95, 0xe0,\r\n  0x3b, 0x58, 0xca, 0x68, 0x7a, 0xb3, 0xca, 0x6e, 0xcd, 0x13, 0x39, 0xcf,\r\n  0x73, 0x8e, 0xd3, 0x73, 0x36, 0x52, 0xa3, 0xb9, 0x7e, 0xf0, 0xb1, 0x7f,\r\n  0x0b, 0xdb, 0xee, 0x9c, 0x65, 0x71, 0x48, 0x55, 0x48, 0x65, 0x71, 0x73,\r\n  0xe3, 0x6e, 0x2f, 0x81, 0xee, 0x47, 0x5f, 0x0c, 0x2c, 0x66, 0x5c, 0x05,\r\n  0x21, 0x8c, 0xb8, 0x7d, 0x10, 0xbd, 0x33, 0x0b, 0x2e, 0x3e, 0xd7, 0xa0,\r\n  0xc4, 0x9a, 0xd8, 0xd1, 0x69, 0xa1, 0x52, 0xef, 0x7f, 0x44, 0xdc, 0xaa,\r\n  0x68, 0x63, 0xc9, 0xb0, 0xbd, 0x65, 0xb7, 0xfb, 0xa0, 0xa4, 0xcb, 0xf9,\r\n  0xc2, 0x81, 0x2b, 0x4d, 0x47, 0xc5, 0xa7, 0x61, 0x4b, 0xe9, 0x5d, 0xd8,\r\n  0x36, 0xec, 0x79, 0xcf, 0xba, 0x23, 0xf7, 0x3a, 0xc4, 0x87, 0x37, 0x70,\r\n  0x09, 0xb6, 0x21, 0x46, 0xd1, 0x79, 0x5e, 0xca, 0xda, 0x72, 0x2f, 0x3a,\r\n  0xe3, 0xb9, 0xb1, 0x1f, 0xf4, 0x2c, 0xea, 0x5f, 0xe5, 0xf9, 0x24, 0x2e,\r\n  0xfa, 0xba, 0x84, 0x88, 0x9f, 0x53, 0x83, 0x33, 0x11, 0xcc, 0x88, 0x4d,\r\n  0x63, 0x38, 0x5f, 0xd0, 0x73, 0x6d, 0x4f, 0x4f, 0xa8, 0x97, 0x36, 0xe3,\r\n  0x16, 0xdd, 0x77, 0xdc, 0x77, 0xf0, 0xda, 0x2a, 0xa2, 0x58, 0x32, 0x1c,\r\n  0x82, 0x48, 0x48, 0x3d, 0x6b, 0x04, 0x81, 0x99, 0x4e, 0xc7, 0xa0, 0xbf,\r\n  0x5d, 0x24, 0x6a, 0xe6, 0x92, 0x04, 0x48, 0xec, 0x06, 0xc9, 0x06, 0x16,\r\n  0xd1, 0xc1, 0xaa, 0xe8, 0x67, 0x5a, 0x0b, 0x86, 0x1b, 0xcf, 0xa2, 0x5a,\r\n  0x80, 0x2f, 0x88, 0xd6, 0x4e, 0xaf, 0x53, 0x53, 0x23, 0x8d, 0xb1, 0x06,\r\n  0x10, 0x7b, 0xeb, 0x2f, 0x02, 0x3d, 0xed, 0xf5, 0xcf, 0x78, 0xfe, 0xb0,\r\n  0x93, 0x24, 0x6e, 0x2b, 0x3a, 0xb7, 0xc3, 0x66, 0x65, 0xee, 0x52, 0x0e,\r\n  0x02, 0x21, 0xaa, 0x46, 0x4d, 0x06, 0xad, 0x58, 0x7f, 0xcd, 0xb1, 0xf8,\r\n  0x07, 0xec, 0xa3, 0x75, 0xf1, 0x27, 0x9e, 0x0d, 0x01, 0xb8, 0xf2, 0x85,\r\n  0x84, 0x43, 0xd0, 0x94, 0x01, 0xe2, 0xda, 0x94, 0x59, 0x31, 0xc7, 0xe7,\r\n  0xc6, 0x63, 0xea, 0xab, 0x68, 0x4c, 0xf4, 0xd1, 0xc0, 0x89, 0xe3, 0xac,\r\n  0x2e, 0x09, 0xc9, 0x8a, 0xba, 0xe0, 0x55, 0x83, 0x96, 0xda, 0xc0, 0x03,\r\n  0xec, 0xe9, 0xa4, 0xf5, 0xd4, 0x44, 0x5a, 0x89, 0x83, 0x9b, 0xed, 0x2e,\r\n  0x9c, 0xb8, 0xe2, 0x77, 0x85, 0xc8, 0xf8, 0x4b, 0xa6, 0x5b, 0x57, 0x60,\r\n  0xbb, 0xc2, 0xeb, 0x13, 0xad, 0x37, 0xf5, 0x2e, 0x79, 0x54, 0xcd, 0xc0,\r\n  0xb6, 0x84, 0xcc, 0xd3, 0xa0, 0x14, 0xbc, 0x78, 0x73, 0x28, 0xe5, 0x8d,\r\n  0x10, 0x26, 0x29, 0xb7, 0x82, 0x44, 0xa1, 0x13, 0xd0, 0x52, 0x41, 0x39,\r\n  0x5c, 0xcd, 0x30, 0x4c, 0xda, 0x96, 0x65, 0x9e, 0xd4, 0x60, 0x8e, 0x8d,\r\n  0xac, 0x23, 0x88, 0xbf, 0x8f, 0x92, 0x7e, 0x26, 0xfe, 0x70, 0x4d, 0x74,\r\n  0x09, 0x40, 0x16, 0x05, 0x8c, 0x45, 0x3b, 0x72, 0xd7, 0xf4, 0x12, 0x7e,\r\n  0x02, 0xcd, 0xef, 0x12, 0x88, 0xbb, 0x25, 0x77, 0x35, 0xae, 0xed, 0x0e,\r\n  0xe0, 0xdb, 0x80, 0xc6, 0x07, 0x24, 0x34, 0x0e, 0x57, 0x96, 0xdc, 0xcb,\r\n  0x46, 0xc1, 0x3e, 0x61, 0xe5, 0x86, 0xb7, 0xd1, 0x4c, 0x2d, 0xef, 0x29,\r\n  0x34, 0x6a, 0x01, 0x1b, 0xf2, 0x13, 0x4d, 0xdf, 0x2d, 0xb6, 0x33, 0x4b,\r\n  0xa3, 0x8f, 0xf3, 0x12, 0xaf, 0xdd, 0x23, 0xc8, 0xb6, 0xbb, 0xca, 0xd9,\r\n  0xda, 0x55, 0x05, 0xa8, 0x35, 0x0f, 0x0c, 0x41, 0x92, 0xe8, 0x02, 0x00,\r\n  0x82, 0x32, 0xaf, 0x71, 0xa9, 0x99, 0x99, 0x13, 0x99, 0x8e, 0x47, 0xb6,\r\n  0x89, 0xd3, 0x0c, 0x1e, 0xdd, 0x29, 0x97, 0xea, 0x0b, 0xd7, 0x7d, 0x32,\r\n  0x70, 0xd3, 0xab, 0xe2, 0x4f, 0x82, 0x10, 0x2a, 0x75, 0x4d, 0x83, 0xe0,\r\n  0xd5, 0xed, 0xb8, 0x69, 0x64, 0x9a, 0x61, 0xb1, 0x3b, 0x00, 0xe1, 0x32,\r\n  0x29, 0x58, 0x81, 0x29, 0xfd, 0xdd, 0x41, 0xe3, 0x1d, 0xd5, 0xf5, 0xe8,\r\n  0xcf, 0x46, 0x3b, 0x5b, 0x6d, 0x53, 0x0a, 0xdb, 0xe3, 0xf0, 0xab, 0x13,\r\n  0xf8, 0x62, 0xe6, 0x29, 0x89, 0xd0, 0x81, 0x7c, 0x46, 0x86, 0x23, 0xa9,\r\n  0xa3, 0xee, 0x26, 0xbd, 0x4e, 0x33, 0x33, 0x41, 0x42, 0xf0, 0xbd, 0x8b,\r\n  0x1f, 0xf1, 0x4c, 0x8b, 0x4f, 0x37, 0x36, 0x95, 0x23, 0x97, 0x8c, 0x8f,\r\n  0xd8, 0x6e, 0x42, 0x07, 0xa0, 0x8a, 0xbd, 0xef, 0xb1, 0x7b, 0xee, 0xf0,\r\n  0x69, 0xbe, 0xf0, 0x18, 0x84, 0x10, 0xc3, 0x35, 0x43, 0xd3, 0x05, 0x89,\r\n  0xda, 0x72, 0xfd, 0xf8, 0x45, 0x96, 0x3c, 0xdc, 0xa4, 0xdc, 0xdf, 0x68,\r\n  0x85, 0xa3, 0xf0, 0xfd, 0xee, 0xf4, 0x78, 0x39, 0xc9, 0x0d, 0x50, 0x87,\r\n  0xbf, 0x88, 0x43, 0xdd, 0x59, 0xd4, 0x75, 0xd1, 0xb6, 0xe3, 0x35, 0xcd,\r\n  0xf1, 0xc0, 0xfe, 0x43, 0xd1, 0x4e, 0x53, 0xda, 0xe0, 0x6c, 0x21, 0xc2,\r\n  0x83, 0x11, 0x57, 0xb5, 0xa6, 0x3c, 0x64, 0x94, 0x7f, 0x12, 0xb7, 0x20,\r\n  0x1f, 0x0e, 0x88, 0x47, 0x97, 0xc6, 0x4b, 0xe4, 0x3c, 0x46, 0x5f, 0x44,\r\n  0x8a, 0xc4, 0xa1, 0x3d, 0x1e, 0x87, 0x01, 0x02, 0xdc, 0x42, 0xe8, 0x3c,\r\n  0x2e, 0x54, 0x4c, 0x43, 0x77, 0x73, 0x80, 0xc3, 0x84, 0xb3, 0x27, 0xdb,\r\n  0x8f, 0x13, 0x56, 0x4a, 0xc9, 0xc5, 0x6e, 0xc1, 0x0f, 0x5e, 0x7e, 0x78,\r\n  0xf6, 0x7e, 0xe1, 0xe4, 0x7d, 0x60, 0xf6, 0x2e, 0xa1, 0x2c, 0x90, 0xe2,\r\n  0x0b, 0xac, 0xd7, 0xcb, 0x00, 0x7d, 0xc4, 0xc1, 0x03, 0x41, 0xbf, 0x7a,\r\n  0x34, 0x47, 0xfd, 0x68, 0x06, 0x21, 0xa0, 0x97, 0xbf, 0xd9, 0xaa, 0x63,\r\n  0x37, 0x5a, 0xef, 0xbb, 0x9b, 0x93, 0x50, 0x40, 0x36, 0xaa, 0xc1, 0x7b,\r\n  0x55, 0xd1, 0xc4, 0xeb, 0xf4, 0xb5, 0xe4, 0xfd, 0x52, 0xbd, 0x5e, 0x7a,\r\n  0xf6, 0x3a, 0x2c, 0x94, 0x9a, 0xa1, 0x32, 0x33, 0x45, 0xb1, 0x35, 0xbe,\r\n  0x2f, 0x4c, 0x8a, 0x7f, 0x70, 0x70, 0x32, 0x3a, 0x55, 0x46, 0x80, 0x92,\r\n  0x0b, 0xd5, 0xd5, 0x30, 0x74, 0xd5, 0x11, 0x49, 0x33, 0x49, 0xe6, 0x11,\r\n  0xc7, 0xbc, 0x1d, 0x4d, 0xc0, 0x6f, 0x0d, 0xea, 0x13, 0x16, 0xab, 0x25,\r\n  0x27, 0x82, 0x7e, 0xfd, 0x5c, 0xa5, 0x3c, 0x53, 0xb6, 0x7c, 0x6c, 0x8e,\r\n  0x77, 0x2e, 0xdf, 0xff, 0xe9, 0x43, 0x44, 0x4c, 0xc3, 0x21, 0x94, 0x31,\r\n  0x4c, 0x8d, 0x03, 0xfa, 0x4d, 0x71, 0xcd, 0x48, 0x0d, 0x76, 0xf9, 0xfe,\r\n  0xbc, 0x42, 0x80, 0xf4, 0x7a, 0x9d, 0x10, 0xc0, 0x05, 0xc5, 0x01, 0x3f,\r\n  0x8e, 0x65, 0xcd, 0xa1, 0xef, 0x53, 0xd3, 0xd8, 0xe5, 0xde, 0x48, 0x1f,\r\n  0x02, 0x75, 0xa7, 0x9b, 0x56, 0x76, 0xe2, 0x23, 0x9b, 0xd5, 0x6d, 0xcf,\r\n  0xc6, 0xce, 0x9c, 0x24, 0xa1, 0x15, 0xd2, 0xde, 0x81, 0x74, 0x53, 0x25,\r\n  0xf3, 0xe4, 0x5a, 0xfd, 0x4c, 0xc7, 0xdf, 0x1e, 0x9f, 0xb6, 0x94, 0xab,\r\n  0x4a, 0x7e, 0xee, 0x82, 0x77, 0x81, 0x3b, 0xc2, 0x12, 0x67, 0xd3, 0x52,\r\n  0x3c, 0xd1, 0xf2, 0x4d, 0x6d, 0xb1, 0x13, 0xf5, 0x49, 0x0f, 0xd3, 0xfd,\r\n  0x94, 0x58, 0x0c, 0xab, 0x60, 0xaf, 0xdd, 0x4c, 0xd2, 0xcf, 0x4b, 0xb8,\r\n  0xe0, 0x54, 0xcb, 0xfa, 0x6a, 0x3c, 0xde, 0xbe, 0x4d, 0x8a, 0x09, 0xa7,\r\n  0xf7, 0xb7, 0x37, 0x14, 0xa0, 0xe8, 0xd1, 0x11, 0xa2, 0xe7, 0xe2, 0x02,\r\n  0xe7, 0x65, 0xf6, 0x23, 0x69, 0xbd, 0xb1, 0xcc, 0xe7, 0xe9, 0xf4, 0x21,\r\n  0x3a, 0xd2, 0x9e, 0x21, 0x19, 0x82, 0x17, 0x1d, 0xfe, 0x6f, 0xf5, 0x71,\r\n  0x9e, 0x7d, 0x33, 0x3c, 0x18, 0x0f, 0x8f, 0x8e, 0x4f, 0x8f, 0xbf, 0x3a,\r\n  0xb8, 0x3c, 0x16, 0x28, 0x3f, 0x94, 0x92, 0x32, 0x59, 0x23, 0x75, 0xdc,\r\n  0x7e, 0xf8, 0x46, 0x7b, 0x2a, 0x8e, 0x26, 0xc6, 0xd0, 0x32, 0x17, 0xc7,\r\n  0x6d, 0x52, 0x39, 0xd8, 0x30, 0xcf, 0x10, 0x8b, 0xeb, 0xaa, 0x46, 0x89,\r\n  0xd1, 0x82, 0xa8, 0xcc, 0x17, 0xda, 0xd5, 0xd6, 0x08, 0xe2, 0xf9, 0x3d,\r\n  0x27, 0x9a, 0xbe, 0xcd, 0xd8, 0x1c, 0x49, 0x25, 0xed, 0x8a, 0xf5, 0x53,\r\n  0x17, 0x00, 0xf0, 0x0e, 0x7e, 0x9b, 0xff, 0xda, 0x2a, 0x03, 0xf8, 0xd3,\r\n  0xad, 0xd3, 0x08, 0x3e, 0xac, 0x14, 0x13, 0xea, 0x08, 0x0f, 0xae, 0x45,\r\n  0x47, 0x01, 0x22, 0xa6, 0xbf, 0x6b, 0x69, 0xbf, 0x6a, 0x18, 0x95, 0xd3,\r\n  0x9b, 0x64, 0x91, 0x98, 0x71, 0xc6, 0x91, 0x76, 0xd8, 0xcd, 0xb0, 0x1a,\r\n  0xe9, 0x8c, 0xdd, 0x33, 0x7e, 0x03, 0x87, 0x59, 0x8c, 0x0b, 0xe0, 0xbf,\r\n  0x18, 0x10, 0xd5, 0xa1, 0x22, 0xdd, 0xa7, 0x48, 0x35, 0x13, 0x10, 0x04,\r\n  0x10, 0x61, 0xd8, 0x24, 0x86, 0xab, 0xac, 0x21, 0x29, 0x9d, 0x0e, 0xad,\r\n  0x79, 0xc4, 0x4d, 0x63, 0x6c, 0x05, 0x5f, 0x96, 0xb8, 0xf4, 0x1c, 0xc4,\r\n  0x2a, 0x57, 0x68, 0x8c, 0xfc, 0x58, 0x40, 0xad, 0x76, 0x37, 0x70, 0x47,\r\n  0x7d, 0xd4, 0xa2, 0x8d, 0xe3, 0x56, 0x4c, 0x95, 0xc3, 0x73, 0xe3, 0x45,\r\n  0x8f, 0xd9, 0x66, 0x47, 0xb2, 0x11, 0x93, 0xa8, 0x26, 0xf8, 0x2b, 0xad,\r\n  0x24, 0xd9, 0xa6, 0x06, 0xdf, 0x29, 0x90, 0x61, 0xc8, 0x27, 0xa0, 0x15,\r\n  0xcf, 0x6a, 0x59, 0x4e, 0x92, 0x9a, 0x39, 0x4c, 0x96, 0x45, 0xd5, 0x81,\r\n  0x0f, 0x14, 0x84, 0x9c, 0x73, 0x3c, 0xea, 0xd3, 0x82, 0xc1, 0xf6, 0xf9,\r\n  0x88, 0xc7, 0xe7, 0x17, 0xc2, 0x80, 0x73, 0xca, 0x7f, 0x51, 0x0c, 0x40,\r\n  0xf3, 0xcb, 0xb0, 0xdd, 0x35, 0x03, 0x00, 0xd1, 0x46, 0x98, 0x9c, 0x2e,\r\n  0x0b, 0xde, 0x00, 0x5b, 0x82, 0x19, 0xd0, 0x2c, 0x6f, 0xdd, 0xd2, 0x18,\r\n  0x51, 0x0b, 0x84, 0xe6, 0xf8, 0x15, 0xd0, 0x15, 0xee, 0xc3, 0x40, 0x14,\r\n  0x23, 0xf4, 0x42, 0x80, 0x0f, 0xe6, 0x55, 0x3f, 0xe3, 0x5f, 0x32, 0xd2,\r\n  0x45, 0xb7, 0xc0, 0x9a, 0x38, 0xdf, 0x40, 0x12, 0x4a, 0xe7, 0x73, 0x34,\r\n  0xc9, 0x6f, 0x45, 0x05, 0x98, 0x19, 0x62, 0xea, 0xc7, 0xc8, 0x8f, 0x53,\r\n  0x3e, 0x21, 0x06, 0x0f, 0xed, 0xb8, 0x80, 0x60, 0xa7, 0x96, 0x5c, 0x85,\r\n  0xcd, 0x83, 0x35, 0xc9, 0xa9, 0x19, 0x24, 0x7b, 0x63, 0xd0, 0xce, 0x35,\r\n  0x32, 0x10, 0xa2, 0x1c, 0xb2, 0xda, 0x59, 0xd3, 0x41, 0xd6, 0x02, 0xe7,\r\n  0xd0, 0xb6, 0xdc, 0xbf, 0x9a, 0x0a, 0x64, 0x60, 0x9d, 0xe4, 0x41, 0xb3,\r\n  0x6f, 0xc5, 0xe3, 0x78, 0xa5, 0xf1, 0xa7, 0x78, 0x9e, 0x56, 0x0f, 0x62,\r\n  0xd2, 0x89, 0x77, 0xc0, 0x1c, 0xd8, 0x5d, 0x38, 0x7d, 0x9a, 0x78, 0x13,\r\n  0x12, 0x32, 0x50, 0x5d, 0xb6, 0xb6, 0x87, 0x17, 0x7b, 0xc3, 0x94, 0xf3,\r\n  0x95, 0xaa, 0xe6, 0x74, 0x83, 0x90, 0x10, 0x4a, 0xd9, 0x00, 0xd6, 0xae,\r\n  0xc8, 0xe4, 0x70, 0xda, 0xaf, 0xee, 0xf2, 0x2c, 0xef, 0xda, 0x55, 0x22,\r\n  0x21, 0xa8, 0xab, 0xb1, 0x90, 0x22, 0xd4, 0xb7, 0x60, 0xeb, 0xeb, 0x47,\r\n  0xf8, 0x25, 0xaf, 0x21, 0xda, 0xc7, 0x36, 0x9f, 0xde, 0x28, 0x6b, 0x08,\r\n  0xc7, 0x81, 0x65, 0x2b, 0x4d, 0x92, 0x9b, 0xf8, 0x2e, 0xcd, 0x8b, 0x51,\r\n  0x2d, 0xaf, 0xbc, 0x1d, 0xe3, 0x28, 0x69, 0xfd, 0x19, 0xf2, 0xc8, 0x0b,\r\n  0xc3, 0x07, 0x98, 0xdf, 0x15, 0x04, 0x69, 0x98, 0x54, 0x8e, 0xd5, 0x80,\r\n  0x4b, 0xf8, 0x7c, 0xa0, 0x91, 0x24, 0x04, 0x6b, 0x5b, 0x40, 0x68, 0x20,\r\n  0x5e, 0x5d, 0x12, 0xb2, 0x3e, 0x19, 0x97, 0x77, 0xdd, 0x27, 0xac, 0xbc,\r\n  0xfb, 0xe5, 0x27, 0x4c, 0xa8, 0x09, 0x78, 0x0b, 0x1d, 0x9f, 0x8f, 0xbf,\r\n  0x8d, 0x1c, 0xc0, 0xa6, 0xeb, 0xe6, 0x94, 0xc3, 0xe5, 0xc7, 0x85, 0xad,\r\n  0x16, 0x1c, 0xb0, 0x5f, 0x79, 0xc2, 0xdc, 0x01, 0xa3, 0xef, 0xeb, 0xa9,\r\n  0x3a, 0x3f, 0x18, 0x7f, 0xdb, 0x38, 0x4f, 0x3e, 0xe0, 0x69, 0x99, 0x70,\r\n  0xad, 0x2b, 0xb9, 0x42, 0x68, 0x4e, 0x4e, 0x24, 0xb7, 0xd6, 0xb9, 0xd5,\r\n  0xca, 0xbb, 0x8f, 0xd9, 0x6a, 0xd4, 0x95, 0xd6, 0x56, 0x6b, 0x4d, 0xef,\r\n  0x63, 0x5b, 0x2d, 0x5c, 0xa3, 0x8e, 0xad, 0x46, 0xed, 0xb7, 0xb6, 0x9a,\r\n  0xcd, 0x6b, 0xf7, 0x5e, 0x5b, 0xb7, 0xd5, 0x0c, 0x69, 0x98, 0xc8, 0x36,\r\n  0x0b, 0x77, 0x59, 0x7b, 0x87, 0x05, 0xfb, 0x26, 0xe1, 0x9f, 0x23, 0x41,\r\n  0x99, 0x3d, 0xad, 0xa4, 0xa1, 0x3d, 0x1e, 0xff, 0x42, 0xf6, 0xc2, 0x85,\r\n  0x3e, 0x7e, 0x1e, 0x5f, 0x27, 0xbd, 0x30, 0xff, 0xfa, 0x23, 0x72, 0xf9,\r\n  0x1e, 0x4d, 0x85, 0xab, 0x27, 0xbf, 0x41, 0xef, 0xf1, 0xa9, 0x6f, 0xe2,\r\n  0x51, 0xec, 0xb8, 0x67, 0xf4, 0x54, 0xd4, 0x73, 0x16, 0x8c, 0x29, 0x49,\r\n  0x7d, 0x30, 0xbd, 0xbf, 0x32, 0xc2, 0xab, 0x67, 0x1d, 0x74, 0x43, 0x6e,\r\n  0xfb, 0xc9, 0x91, 0xd2, 0xea, 0x2c, 0xb7, 0x3a, 0x2e, 0x8c, 0xfb, 0x2a,\r\n  0x2e, 0x67, 0xc5, 0xec, 0x81, 0xaa, 0x87, 0xef, 0x02, 0xda, 0x8c, 0x57,\r\n  0xf9, 0xbc, 0x29, 0x9e, 0x49, 0x23, 0x12, 0xc4, 0xf4, 0xa9, 0x76, 0x6b,\r\n  0x5f, 0x9d, 0xbe, 0x62, 0x8c, 0x5a, 0xa7, 0x34, 0x83, 0x30, 0xdc, 0x8f,\r\n  0xf1, 0x9c, 0x39, 0xb2, 0x9a, 0x61, 0x26, 0xb6, 0x35, 0x34, 0x84, 0x30,\r\n  0x83, 0xca, 0xc9, 0x1d, 0x8a, 0xd9, 0xe6, 0x49, 0x41, 0x9b, 0xe4, 0x86,\r\n  0xf5, 0x3b, 0x3a, 0x41, 0x8f, 0xe1, 0x34, 0xe6, 0xe0, 0xf5, 0x8b, 0x20,\r\n  0xe4, 0xfb, 0xc3, 0xbe, 0xe9, 0x29, 0x3f, 0x75, 0x23, 0xc8, 0xda, 0x08,\r\n  0xf8, 0xba, 0x8f, 0xde, 0x12, 0xba, 0xc2, 0x38, 0x72, 0x27, 0xa2, 0x18,\r\n  0xd3, 0x6d, 0xcc, 0x35, 0xb1, 0xc1, 0x94, 0x69, 0x03, 0x28, 0x0b, 0x1f,\r\n  0x47, 0xbd, 0x23, 0x78, 0x88, 0xc4, 0x05, 0x41, 0x5f, 0x1f, 0x0a, 0x5d,\r\n  0x11, 0x6e, 0xc3, 0x96, 0xaa, 0xc8, 0x41, 0x2b, 0x44, 0x55, 0x82, 0xef,\r\n  0x5a, 0x56, 0x19, 0x1d, 0x7c, 0x0e, 0x94, 0x7b, 0x14, 0xb3, 0xcf, 0xd5,\r\n  0x95, 0x89, 0x6c, 0xe9, 0x76, 0x4e, 0xad, 0x74, 0x29, 0xa8, 0x36, 0x42,\r\n  0x7f, 0xe7, 0x53, 0xc3, 0x3f, 0xaf, 0x98, 0xbd, 0x6c, 0x06, 0x71, 0xa1,\r\n  0xe1, 0x3b, 0x70, 0x70, 0xb4, 0x73, 0x9b, 0xe6, 0xa3, 0x66, 0x66, 0xaf,\r\n  0x31, 0x60, 0x80, 0x12, 0x89, 0x95, 0xf9, 0x5e, 0xd0, 0xf5, 0x9e, 0xc2,\r\n  0x48, 0xa1, 0xf0, 0xb6, 0xe1, 0xc6, 0x37, 0xf0, 0x9c, 0x0a, 0x1e, 0x39,\r\n  0xba, 0x65, 0x46, 0x2e, 0x43, 0x1a, 0xd9, 0x4f, 0xc3, 0x69, 0x60, 0x22,\r\n  0x0a, 0xfa, 0x6f, 0xc6, 0x8a, 0xe3, 0x1f, 0x42, 0x1a, 0x3b, 0x1f, 0x55,\r\n  0x48, 0xd4, 0x83, 0x31, 0x1c, 0x72, 0x6b, 0x1c, 0x13, 0xf0, 0x39, 0xbf,\r\n  0x0b, 0xce, 0x9a, 0x34, 0xbe, 0xba, 0xf9, 0x43, 0xd7, 0x9e, 0x34, 0x7a,\r\n  0xbd, 0xc9, 0x2a, 0x9d, 0x2b, 0x99, 0x47, 0x59, 0x19, 0xb6, 0x0d, 0xb0,\r\n  0xbf, 0x79, 0x3a, 0x29, 0x00, 0x57, 0x81, 0xca, 0x55, 0x73, 0xd4, 0xb6,\r\n  0x94, 0x7e, 0x4d, 0x19, 0xd7, 0x5d, 0xc6, 0x76, 0x28, 0x99, 0x3e, 0xd0,\r\n  0xa4, 0x55, 0x81, 0x0c, 0x07, 0x67, 0xa1, 0x1e, 0x61, 0xad, 0x6b, 0xfb,\r\n  0x71, 0xb9, 0x03, 0x6c, 0x93, 0xf3, 0xde, 0xe1, 0xbc, 0x8b, 0x34, 0x13,\r\n  0x2f, 0x24, 0xfc, 0xa5, 0xd9, 0x5d, 0x5a, 0xe4, 0x19, 0x63, 0x50, 0xa2,\r\n  0xbb, 0xb8, 0x48, 0x71, 0x5b, 0x50, 0x6f, 0xdf, 0x1d, 0x9d, 0x5c, 0x44,\r\n  0x9b, 0xec, 0x52, 0x9b, 0x3c, 0xac, 0xcb, 0xdc, 0xd8, 0x4e, 0xaa, 0xe9,\r\n  0xf6, 0xf2, 0x36, 0xdd, 0xce, 0xca, 0x72, 0x36, 0xd9, 0x0a, 0xf3, 0xbf,\r\n  0xf9, 0x93, 0xbc, 0xdf, 0xce, 0xbf, 0x39, 0x1c, 0xff, 0x71, 0x77, 0x97,\r\n  0x25, 0xf9, 0x8a, 0x1a, 0xde, 0xa4, 0x39, 0x68, 0x6d, 0x8c, 0x92, 0x26,\r\n  0x7a, 0x31, 0x2a, 0xf3, 0x2d, 0x5c, 0x3f, 0x77, 0x71, 0x3a, 0xb7, 0xfb,\r\n  0x5c, 0xf6, 0xac, 0xc4, 0xf6, 0x58, 0xe5, 0x83, 0x4b, 0x88, 0xdd, 0x17,\r\n  0x08, 0xb7, 0x6b, 0xd8, 0xb3, 0x15, 0xd0, 0xc9, 0xdc, 0x05, 0xac, 0x67,\r\n  0xca, 0x85, 0xa9, 0x68, 0x36, 0x19, 0xbd, 0xe8, 0x91, 0x42, 0x03, 0xe6,\r\n  0xf0, 0xe2, 0x59, 0x11, 0x67, 0x5a, 0x47, 0x5e, 0x89, 0xa4, 0xdf, 0x8c,\r\n  0xb6, 0x7b, 0x8e, 0xb3, 0x2c, 0xcd, 0x84, 0xbb, 0x0d, 0xf7, 0xd4, 0x5d,\r\n  0xce, 0x38, 0xcf, 0x3c, 0xbb, 0x5a, 0x95, 0xce, 0x5c, 0x8a, 0xdd, 0x62,\r\n  0xfd, 0x9e, 0x01, 0x1c, 0x45, 0xf6, 0xbf, 0xe8, 0xca, 0x1a, 0x19, 0x93,\r\n  0xb1, 0xaa, 0xc4, 0x3e, 0x86, 0xd0, 0x9c, 0x16, 0x0f, 0x4b, 0xd6, 0x0c,\r\n  0xe4, 0x2d, 0x9d, 0x1f, 0x50, 0x97, 0x09, 0x18, 0x33, 0x64, 0x7f, 0x1a,\r\n  0x75, 0x80, 0x8d, 0xfd, 0x17, 0x15, 0xa9, 0x0a, 0x7d, 0x90, 0x84, 0x7d,\r\n  0x85, 0x5b, 0x41, 0x7e, 0xc6, 0xc0, 0x6c, 0xda, 0xfe, 0x33, 0x01, 0x9c,\r\n  0x39, 0x70, 0x5f, 0x0b, 0x62, 0xc0, 0xed, 0x94, 0xa1, 0x34, 0x60, 0x4d,\r\n  0x87, 0xd3, 0x44, 0xb0, 0xe1, 0xd8, 0x13, 0xb1, 0x15, 0xa8, 0x71, 0xfa,\r\n  0x7c, 0x64, 0x5b, 0xa0, 0xa9, 0x74, 0xb9, 0x1d, 0x43, 0x0d, 0x15, 0xab,\r\n  0x0c, 0x1f, 0xaf, 0xcf, 0x94, 0xdb, 0xe2, 0x4d, 0x79, 0x7e, 0x71, 0x32,\r\n  0x3e, 0x8c, 0xa2, 0xb3, 0x71, 0x74, 0xf6, 0xe6, 0xf4, 0x6f, 0x5b, 0xec,\r\n  0x97, 0x61, 0x29, 0x04, 0x8a, 0x3d, 0xfe, 0x7e, 0xd7, 0xe1, 0x28, 0x07,\r\n  0x1e, 0x30, 0xd2, 0xe1, 0x93, 0x13, 0xbd, 0x62, 0x78, 0x6f, 0x4b, 0xec,\r\n  0x61, 0x95, 0xbc, 0x5d, 0xe0, 0x58, 0xa0, 0x0d, 0x97, 0xd2, 0x84, 0x23,\r\n  0xe0, 0x35, 0xb5, 0xa4, 0xf8, 0x55, 0x3b, 0x85, 0x9b, 0xdd, 0xe2, 0xa1,\r\n  0x46, 0x22, 0xc9, 0x3b, 0xac, 0x49, 0xd1, 0xd7, 0x69, 0xa0, 0x0d, 0x64,\r\n  0x38, 0x0d, 0xf4, 0x5a, 0x1c, 0x5c, 0x6b, 0xa0, 0x54, 0x42, 0x80, 0x62,\r\n  0xa9, 0x44, 0x2a, 0x41, 0x63, 0x86, 0x40, 0xb8, 0xbc, 0x53, 0x98, 0xa6,\r\n  0x59, 0x55, 0xe4, 0xcb, 0x87, 0xe8, 0xab, 0x98, 0x2f, 0x1d, 0xfe, 0xd6,\r\n  0x51, 0x9c, 0x2c, 0x5a, 0x32, 0xaa, 0xcc, 0xd9, 0x17, 0x23, 0x17, 0x8e,\r\n  0xfc, 0xdd, 0x6d, 0x67, 0xd0, 0x21, 0x48, 0x10, 0x33, 0xe2, 0xc9, 0x9c,\r\n  0xb1, 0x8f, 0xd1, 0x76, 0x0f, 0xf6, 0x1c, 0x75, 0xa5, 0x1d, 0x7f, 0x30,\r\n  0xe6, 0xb7, 0x3a, 0xa8, 0x91, 0x35, 0x01, 0x34, 0x21, 0x43, 0x6b, 0xa2,\r\n  0x18, 0x45, 0x70, 0x03, 0xb1, 0x13, 0xbd, 0xe0, 0x3f, 0xd7, 0x0c, 0x3b,\r\n  0xb8, 0xb4, 0xe1, 0x60, 0xab, 0xc9, 0x4f, 0x7e, 0x59, 0xe3, 0xef, 0x8c,\r\n  0x2f, 0x9b, 0x85, 0xbf, 0x6d, 0x6b, 0xc8, 0x8c, 0x5e, 0x20, 0xb9, 0x34,\r\n  0x88, 0x8e, 0x8e, 0x2f, 0x70, 0x63, 0x1c, 0xbf, 0xf9, 0x0a, 0x86, 0x2d,\r\n  0xa7, 0xd1, 0x5c, 0x67, 0xe9, 0x3f, 0x78, 0xe8, 0xd4, 0x64, 0x39, 0xd2,\r\n  0x04, 0xe1, 0x20, 0x19, 0xa3, 0xa9, 0x07, 0xb1, 0x7c, 0x63, 0xa9, 0x87,\r\n  0x1b, 0x70, 0xf6, 0xbb, 0x82, 0x33, 0x63, 0xd1, 0x74, 0x0e, 0x0f, 0xc2,\r\n  0xd1, 0xfd, 0x3a, 0x0d, 0x27, 0x9c, 0x3c, 0x4b, 0x92, 0xa5, 0x1e, 0xd1,\r\n  0xb6, 0xea, 0xb8, 0xa5, 0x19, 0x52, 0x17, 0xe4, 0x61, 0xf1, 0x21, 0xd6,\r\n  0x70, 0x4e, 0xe4, 0x09, 0x57, 0x22, 0xea, 0x56, 0x0d, 0x77, 0x27, 0x9e,\r\n  0xe0, 0x56, 0x28, 0xd8, 0x3d, 0xb0, 0x59, 0x6e, 0x45, 0x4d, 0xe5, 0xc6,\r\n  0x74, 0x9b, 0x37, 0x66, 0xaa, 0xd5, 0xef, 0xe4, 0x96, 0xbd, 0x21, 0x57,\r\n  0x84, 0x5d, 0x67, 0x96, 0x86, 0x8b, 0x19, 0x1f, 0x48, 0x40, 0xaa, 0x36,\r\n  0xf5, 0xb4, 0xa6, 0xaa, 0x3c, 0xeb, 0x2e, 0x6f, 0x79, 0x13, 0xf9, 0x7c,\r\n  0x8a, 0x07, 0x3c, 0x68, 0xb3, 0xb5, 0xa8, 0xe2, 0x85, 0x77, 0x9b, 0xa5,\r\n  0x5c, 0x7f, 0x0f, 0x2b, 0x1e, 0xe5, 0x90, 0x74, 0xf3, 0x77, 0x87, 0x07,\r\n  0xef, 0xbe, 0x7c, 0xfb, 0xe6, 0xe8, 0xf4, 0xb8, 0xdf, 0xdc, 0x91, 0x46,\r\n  0x41, 0x53, 0xb2, 0x6b, 0x54, 0x73, 0xb8, 0xc2, 0x74, 0x0d, 0x9c, 0x71,\r\n  0xe4, 0xe2, 0xcb, 0x69, 0x67, 0xc9, 0x1d, 0xfb, 0x19, 0x6f, 0x82, 0x13,\r\n  0x56, 0xd9, 0x0c, 0xc9, 0xbf, 0xc1, 0xe0, 0x2d, 0xb3, 0x52, 0x03, 0x6a,\r\n  0xd6, 0xbf, 0x0e, 0x20, 0x4a, 0xc2, 0x37, 0x26, 0x9d, 0x56, 0x36, 0x16,\r\n  0x8c, 0xd0, 0x48, 0x32, 0x25, 0x3c, 0xeb, 0x63, 0xcd, 0x0e, 0x61, 0xfc,\r\n  0x13, 0x66, 0x3d, 0xa6, 0x0e, 0x75, 0x2c, 0x77, 0x59, 0x43, 0xe6, 0x70,\r\n  0x2b, 0xb4, 0x93, 0x87, 0xda, 0xc9, 0x69, 0x51, 0xf5, 0x07, 0x51, 0x92,\r\n  0x42, 0x3b, 0x0e, 0x61, 0x88, 0xb8, 0xe0, 0x5b, 0xf9, 0x80, 0x0c, 0x0d,\r\n  0x8e, 0x65, 0x5f, 0x8f, 0x92, 0xf7, 0x09, 0x80, 0x4c, 0xfa, 0xd6, 0xa1,\r\n  0x6a, 0x06, 0xdf, 0xe5, 0x05, 0xa8, 0x35, 0x8e, 0xbc, 0x86, 0x20, 0x0f,\r\n  0xc5, 0xd9, 0x43, 0x3b, 0x9e, 0xcb, 0x5a, 0x00, 0x9b, 0x37, 0xd7, 0x42,\r\n  0xba, 0x7c, 0x7e, 0x70, 0xf9, 0xf5, 0xc7, 0xab, 0x86, 0x5e, 0x51, 0x82,\r\n  0x76, 0x68, 0xea, 0xe1, 0x20, 0xfc, 0x05, 0xed, 0xea, 0xa6, 0xc0, 0x50,\r\n  0x85, 0xca, 0x34, 0x2a, 0xa8, 0x54, 0x81, 0x0a, 0x05, 0x53, 0x59, 0xfc,\r\n  0x68, 0x0c, 0xed, 0x72, 0x77, 0xa3, 0x6d, 0xec, 0x6e, 0xb0, 0xbe, 0xf1,\r\n  0x6c, 0x93, 0x00, 0x24, 0x2d, 0xa0, 0x5b, 0xc1, 0xfd, 0xed, 0x04, 0x11,\r\n  0xb6, 0x61, 0x43, 0x10, 0x79, 0x9d, 0xec, 0xbf, 0x2f, 0x92, 0x02, 0x24,\r\n  0x78, 0xfb, 0x94, 0x8a, 0x9c, 0xb2, 0xeb, 0x0f, 0xb2, 0xc9, 0xc3, 0xc8,\r\n  0xb8, 0x67, 0xa5, 0x8b, 0xaa, 0xdb, 0x6d, 0xc0, 0x14, 0x43, 0x0e, 0x21,\r\n  0xd8, 0x96, 0x70, 0x0b, 0x55, 0x12, 0xf7, 0x7b, 0xd1, 0x66, 0x32, 0xba,\r\n  0xa6, 0xf6, 0x7a, 0xdc, 0xce, 0xee, 0x3e, 0xff, 0xb9, 0x87, 0x3f, 0x9f,\r\n  0xf4, 0xb6, 0x5a, 0xa6, 0x59, 0x09, 0xf1, 0xd5, 0x46, 0x14, 0x23, 0x02,\r\n  0x12, 0xd8, 0x6a, 0x96, 0x90, 0x91, 0xae, 0xdb, 0x48, 0xaa, 0xe2, 0x75,\r\n  0xe5, 0x99, 0xf9, 0x89, 0x80, 0xa8, 0xbc, 0x89, 0xe1, 0x8c, 0x61, 0x99,\r\n  0x50, 0xe4, 0x53, 0xc9, 0xe7, 0x08, 0xd1, 0x56, 0xd3, 0x77, 0x45, 0x72,\r\n  0x13, 0x97, 0x24, 0x23, 0x56, 0x55, 0xca, 0xae, 0xd1, 0xe6, 0x9d, 0xbf,\r\n  0x62, 0x14, 0xac, 0x60, 0x2c, 0x69, 0xc4, 0xfa, 0x61, 0x97, 0x45, 0x69,\r\n  0x4b, 0x2b, 0x3e, 0x11, 0x56, 0x75, 0xf4, 0x89, 0xa1, 0x72, 0x8e, 0xaf,\r\n  0x21, 0xc0, 0x82, 0x8f, 0x82, 0x1f, 0x0b, 0xe9, 0x5f, 0x17, 0x9c, 0x68,\r\n  0x0d, 0x67, 0x6d, 0x94, 0x5c, 0xd1, 0x8c, 0xa5, 0x92, 0x76, 0x24, 0x60,\r\n  0x51, 0xe9, 0x75, 0xdb, 0x86, 0x93, 0x3b, 0x4e, 0x63, 0x4f, 0xee, 0xdf,\r\n  0x90, 0x20, 0x7a, 0xe7, 0x94, 0x42, 0x11, 0x5b, 0xdf, 0x7c, 0x1f, 0x13,\r\n  0x43, 0x80, 0x74, 0x95, 0x8c, 0x3f, 0x91, 0xed, 0x3a, 0x58, 0x41, 0xc9,\r\n  0xda, 0x66, 0x57, 0x56, 0xaa, 0x2e, 0xae, 0x20, 0x27, 0xa7, 0x7f, 0xed,\r\n  0xc9, 0xb9, 0x82, 0xdf, 0x8b, 0x0e, 0x74, 0xb7, 0x5b, 0xeb, 0x15, 0x27,\r\n  0xbc, 0x96, 0x1c, 0x11, 0xe6, 0x79, 0xda, 0x64, 0xae, 0x45, 0xe1, 0xf2,\r\n  0x8c, 0xa1, 0x5b, 0x6f, 0xb1, 0x75, 0x6e, 0x49, 0x38, 0x48, 0xa0, 0x29,\r\n  0x35, 0x61, 0xa5, 0xad, 0xe1, 0x18, 0xf9, 0x23, 0x20, 0x8f, 0x90, 0x24,\r\n  0xf0, 0x8d, 0xab, 0x2f, 0x11, 0xa4, 0xec, 0x24, 0x98, 0xc9, 0xfa, 0x0b,\r\n  0x7e, 0x39, 0x4b, 0x94, 0xf9, 0xb7, 0x29, 0x26, 0x85, 0xcb, 0x5d, 0x5d,\r\n  0xa3, 0xf4, 0xcd, 0x93, 0x4c, 0x7d, 0xa9, 0x0a, 0xa9, 0x80, 0x17, 0x04,\r\n  0x88, 0x6f, 0x76, 0xbe, 0x5a, 0x0f, 0xaf, 0x24, 0xfd, 0xad, 0x75, 0x7c,\r\n  0x67, 0xc9, 0x3c, 0xbd, 0x93, 0x1c, 0x76, 0x97, 0x8a, 0xa4, 0x1e, 0xd4,\r\n  0x22, 0xa9, 0x56, 0x45, 0x56, 0x1a, 0x74, 0xf1, 0xf5, 0xa9, 0x7b, 0x80,\r\n  0x91, 0x61, 0x70, 0xb2, 0xb4, 0x22, 0x4e, 0x4a, 0xe6, 0x06, 0xee, 0x67,\r\n  0x51, 0x39, 0x0d, 0xda, 0xc4, 0x1d, 0x7b, 0x70, 0xac, 0xfc, 0x5b, 0x7a,\r\n  0x21, 0x4a, 0x00, 0x53, 0x62, 0xea, 0x64, 0x10, 0x0e, 0x5b, 0xc2, 0xc5,\r\n  0xd0, 0xb0, 0x52, 0xaf, 0x01, 0x0b, 0x50, 0x89, 0xb5, 0x10, 0x57, 0x4a,\r\n  0xee, 0xca, 0xbd, 0xd4, 0x3c, 0xe4, 0xbd, 0xbd, 0x6e, 0x30, 0xa7, 0xf1,\r\n  0x0d, 0x28, 0xa0, 0x83, 0x27, 0x63, 0x58, 0xc6, 0x57, 0x8e, 0x46, 0x88,\r\n  0x4e, 0x05, 0x2b, 0x9c, 0xf9, 0x94, 0xa6, 0x50, 0xd0, 0x50, 0xf8, 0x59,\r\n  0x96, 0xb7, 0xc3, 0x2a, 0xab, 0x29, 0x1f, 0x74, 0xb6, 0x25, 0x1c, 0x48,\r\n  0x91, 0xc3, 0xd6, 0x8a, 0x48, 0x89, 0xca, 0x79, 0xba, 0xe4, 0x43, 0x55,\r\n  0xe4, 0xab, 0xeb, 0x1b, 0x9a, 0xc8, 0x04, 0x22, 0x15, 0x57, 0x73, 0x97,\r\n  0xc3, 0xbc, 0xc1, 0x8b, 0x00, 0x6d, 0xf8, 0x8e, 0xd9, 0xeb, 0x66, 0xd1,\r\n  0x66, 0xa3, 0xfd, 0xa7, 0x3b, 0xbb, 0xe8, 0xee, 0xd3, 0x9d, 0x4f, 0xc3,\r\n  0x7c, 0x0f, 0x07, 0x8c, 0x57, 0x86, 0x21, 0x0d, 0xc6, 0x3f, 0x0e, 0x22,\r\n  0x9c, 0xb3, 0x61, 0x86, 0x79, 0x4d, 0x48, 0x65, 0x44, 0x58, 0x50, 0xf3,\r\n  0x05, 0x86, 0x24, 0x2d, 0xd1, 0x1a, 0x63, 0xaf, 0xb0, 0x96, 0x31, 0xe2,\r\n  0x8e, 0xcd, 0x24, 0xbf, 0xb8, 0x8c, 0x2c, 0x83, 0x6d, 0x5d, 0x12, 0x81,\r\n  0xf2, 0x67, 0x04, 0x68, 0x66, 0x24, 0x42, 0x74, 0xa1, 0x86, 0x43, 0xa1,\r\n  0x79, 0xa8, 0x49, 0x03, 0x97, 0x6c, 0x45, 0xa8, 0x46, 0x1b, 0x17, 0xd5,\r\n  0x36, 0xf2, 0x03, 0x14, 0x0a, 0x31, 0xe5, 0xfc, 0x7a, 0xa3, 0xde, 0xbe,\r\n  0x78, 0x75, 0xd8, 0x68, 0x6e, 0xef, 0xc9, 0x67, 0x9f, 0x69, 0x27, 0x12,\r\n  0x8d, 0x1b, 0x7b, 0x26, 0x27, 0x36, 0xaa, 0x05, 0x6d, 0x29, 0x8e, 0x10,\r\n  0x66, 0x4c, 0x06, 0x36, 0x4d, 0x42, 0x29, 0x1d, 0x52, 0xbf, 0xaf, 0x73,\r\n  0xda, 0xb7, 0xda, 0x06, 0x86, 0xa6, 0x51, 0xda, 0xa1, 0x81, 0x71, 0xc1,\r\n  0x3a, 0xc8, 0xb5, 0xe6, 0x83, 0xb3, 0x9e, 0x98, 0x45, 0x5f, 0xb4, 0x22,\r\n  0x73, 0xd7, 0x92, 0x2e, 0xf0, 0x77, 0xbe, 0x43, 0xae, 0x93, 0xaa, 0x8d,\r\n  0xfc, 0x51, 0x0e, 0x88, 0x56, 0xe3, 0x6b, 0x73, 0xcf, 0x03, 0x86, 0x1e,\r\n  0xc5, 0x2e, 0xbd, 0x90, 0x0b, 0xd2, 0x52, 0x4c, 0xa7, 0x89, 0x71, 0x5f,\r\n  0x47, 0x5f, 0x60, 0x1b, 0xbd, 0xd0, 0x6c, 0xfb, 0xac, 0x0b, 0xad, 0xfc,\r\n  0x85, 0xb2, 0x19, 0xa8, 0xc3, 0x07, 0x69, 0xf6, 0x55, 0x15, 0x1b, 0x21,\r\n  0x3f, 0xcc, 0x10, 0xc6, 0xde, 0x43, 0x0b, 0xd6, 0x3c, 0x6f, 0xa5, 0x44,\r\n  0x6c, 0xf9, 0x64, 0xa5, 0x68, 0x07, 0x70, 0x77, 0x46, 0x92, 0xc0, 0x55,\r\n  0x59, 0x98, 0x38, 0x45, 0x32, 0x20, 0xb8, 0x37, 0x5d, 0x53, 0x81, 0x90,\r\n  0x49, 0x57, 0xef, 0x82, 0x77, 0x83, 0x89, 0x6a, 0x9d, 0xfc, 0xe3, 0xf7,\r\n  0xf1, 0x02, 0x94, 0xf2, 0x46, 0x27, 0x08, 0xa5, 0xd2, 0x47, 0xf7, 0xd5,\r\n  0xd0, 0xf2, 0xb8, 0x84, 0x81, 0x1e, 0xfb, 0xa8, 0xcf, 0x0f, 0x35, 0x4f,\r\n  0x3e, 0xbf, 0xd4, 0x37, 0x8a, 0x82, 0xd0, 0x75, 0x88, 0x8d, 0x29, 0xdd,\r\n  0x71, 0x7c, 0x22, 0xe2, 0xca, 0xe3, 0x4f, 0xcd, 0xd6, 0x24, 0xd4, 0xf3,\r\n  0x9b, 0xc8, 0xf8, 0xde, 0xef, 0xb4, 0x67, 0x86, 0xaf, 0x5c, 0x4f, 0x5f,\r\n  0x7e, 0x51, 0x6b, 0xed, 0xfe, 0x7e, 0xb4, 0x78, 0xb0, 0xdf, 0x95, 0xb5,\r\n  0x0a, 0x19, 0x1e, 0x68, 0xa9, 0x14, 0x4b, 0xb2, 0xa5, 0x7c, 0x9a, 0x40,\r\n  0xc8, 0xce, 0xec, 0xf9, 0xa8, 0xe9, 0x6a, 0x17, 0x70, 0x5f, 0xb2, 0x96,\r\n  0x45, 0x4b, 0x4f, 0xd3, 0x75, 0x9e, 0x48, 0x20, 0x6b, 0x92, 0xd3, 0x76,\r\n  0xb3, 0x8d, 0xc4, 0xc0, 0xec, 0xaa, 0x58, 0x4d, 0xab, 0xf6, 0xbd, 0xef,\r\n  0xcb, 0x30, 0x08, 0x67, 0x0f, 0x9c, 0xb0, 0x96, 0x90, 0x08, 0x4f, 0x74,\r\n  0xfd, 0xb8, 0x1b, 0x57, 0x97, 0xd5, 0xee, 0x68, 0x9e, 0x44, 0xd0, 0xf6,\r\n  0xf4, 0x07, 0x12, 0x62, 0x56, 0xb4, 0xb0, 0x47, 0xb7, 0xae, 0x9d, 0xca,\r\n  0xde, 0x7d, 0x32, 0x79, 0xf9, 0x05, 0xfb, 0x9c, 0xdf, 0x23, 0xe1, 0x58,\r\n  0xe8, 0x7f, 0x78, 0x1f, 0x6d, 0xf3, 0x3f, 0x7b, 0x11, 0x9b, 0x30, 0x1d,\r\n  0x33, 0x49, 0xfb, 0x6f, 0x5d, 0x8b, 0x41, 0x36, 0x49, 0xd0, 0xda, 0x55,\r\n  0x9e, 0xaf, 0x6d, 0xcc, 0x0a, 0x64, 0x60, 0x26, 0x82, 0x90, 0xa2, 0x44,\r\n  0xf8, 0xfc, 0xb6, 0x92, 0xad, 0x84, 0x15, 0xaa, 0x1d, 0xad, 0x2e, 0xc0,\r\n  0x2a, 0x54, 0x69, 0xb9, 0x11, 0x0d, 0xbc, 0xf6, 0x72, 0x20, 0xb5, 0x78,\r\n  0x58, 0xdf, 0x5a, 0x3f, 0x21, 0xfc, 0xf4, 0xcb, 0x2f, 0x90, 0xe8, 0xc9,\r\n  0x7f, 0xfd, 0xab, 0x7b, 0x9b, 0xff, 0xa0, 0x7d, 0x49, 0xa7, 0x7b, 0xed,\r\n  0x40, 0xd8, 0x51, 0x6c, 0xcf, 0x6f, 0x8b, 0x86, 0x6a, 0xca, 0x60, 0x7f,\r\n  0xd0, 0x67, 0x03, 0xaf, 0xff, 0xd7, 0x3e, 0x82, 0x1a, 0xe6, 0x50, 0x00,\r\n  0xe5, 0x25, 0x14, 0xff, 0x59, 0xbe, 0x6a, 0xe5, 0x78, 0xd0, 0x96, 0xc3,\r\n  0x03, 0x52, 0x44, 0xe8, 0x43, 0x7d, 0xfe, 0xb1, 0xe7, 0x7a, 0xfd, 0x63,\r\n  0xcf, 0xf7, 0xfb, 0xc7, 0x9e, 0xef, 0xf9, 0x8f, 0xbd, 0x5f, 0xb1, 0xa2,\r\n  0x7d, 0x69, 0xde, 0xb7, 0x1e, 0x34, 0x1e, 0xb4, 0xdd, 0xeb, 0xaf, 0x6b,\r\n  0xda, 0xbb, 0x5f, 0x53, 0x3b, 0x5d, 0x7e, 0x86, 0xf8, 0xd6, 0xd5, 0x59,\r\n  0x40, 0x52, 0x06, 0xcd, 0x83, 0x1f, 0x37, 0x4c, 0x92, 0x56, 0x58, 0x20,\r\n  0x78, 0x82, 0xe7, 0x94, 0x49, 0x4f, 0xca, 0x39, 0x5b, 0x13, 0x3e, 0x30,\r\n  0xe1, 0x3e, 0xe2, 0x66, 0x3a, 0x01, 0xf1, 0xce, 0xac, 0x1d, 0x65, 0x70,\r\n  0xaf, 0xb7, 0xce, 0x28, 0x7b, 0x07, 0xaf, 0x56, 0x05, 0x8c, 0xfe, 0x44,\r\n  0x64, 0xa6, 0xd4, 0x19, 0x30, 0xd2, 0x04, 0xfd, 0xd6, 0xeb, 0x83, 0x37,\r\n  0x6f, 0x0f, 0x4e, 0x1f, 0xcd, 0x96, 0x09, 0xe3, 0x94, 0xce, 0x17, 0x05,\r\n  0x95, 0x3c, 0xb4, 0x58, 0x39, 0xd6, 0xcc, 0x57, 0x38, 0x17, 0x3e, 0xf8,\r\n  0x81, 0x6f, 0xf4, 0x9f, 0x3a, 0x51, 0x09, 0xdf, 0xa9, 0x22, 0xfb, 0x2a,\r\n  0x64, 0x40, 0xbc, 0x15, 0xf9, 0xd3, 0xb3, 0xf7, 0xf9, 0xf5, 0x9e, 0xba,\r\n  0x72, 0x81, 0x8f, 0xea, 0xc0, 0x6f, 0x3a, 0xe4, 0x24, 0xe4, 0x3e, 0xab,\r\n  0x2e, 0x66, 0xb3, 0xc1, 0x1e, 0x1d, 0x04, 0x95, 0x11, 0x60, 0x98, 0xa0,\r\n  0x62, 0xcd, 0xd5, 0x5a, 0xb7, 0xf4, 0xc1, 0xe1, 0xa1, 0xc7, 0xaa, 0xd4,\r\n  0x51, 0xef, 0x4f, 0x18, 0xf5, 0xfe, 0xfb, 0x99, 0xfa, 0x98, 0xb8, 0x39,\r\n  0xd8, 0xc3, 0x39, 0x9e, 0x3f, 0xac, 0x72, 0x81, 0x8a, 0xbd, 0xd0, 0xde,\r\n  0x7c, 0xde, 0x39, 0x8f, 0xd4, 0x81, 0x50, 0xcd, 0x34, 0x06, 0x6e, 0x50,\r\n  0xef, 0x8e, 0xd5, 0xe5, 0x7a, 0x7e, 0x00, 0x8a, 0x0a, 0xc5, 0x4d, 0xa9,\r\n  0xb9, 0x30, 0x68, 0x61, 0x80, 0x84, 0xe6, 0x16, 0x3c, 0x6c, 0x36, 0x7e,\r\n  0xcd, 0xe6, 0x71, 0x0e, 0x67, 0xab, 0x87, 0x72, 0xb9, 0x5a, 0xd0, 0xf6,\r\n  0x25, 0x85, 0x63, 0xd6, 0x2f, 0x69, 0x8b, 0x31, 0x91, 0x6b, 0x73, 0xe3,\r\n  0x30, 0x2e, 0x04, 0xa8, 0x16, 0x5d, 0x5d, 0x76, 0x8b, 0x49, 0x90, 0x56,\r\n  0xf5, 0xc1, 0xb8, 0x33, 0xf6, 0x3b, 0xe8, 0x36, 0x57, 0x7b, 0xe3, 0x13,\r\n  0xe6, 0xf6, 0x3b, 0x78, 0x7b, 0xf9, 0x75, 0x2f, 0x0a, 0x38, 0x99, 0xeb,\r\n  0xb8, 0x43, 0x32, 0x17, 0x8a, 0x34, 0xb9, 0x73, 0xf0, 0x96, 0x42, 0x44,\r\n  0x6e, 0x9b, 0x3c, 0xab, 0x11, 0x14, 0x6c, 0x2c, 0xf4, 0xb3, 0xd1, 0xb3,\r\n  0xad, 0xc6, 0xc2, 0xac, 0xcf, 0xd6, 0x6f, 0xf2, 0x48, 0xeb, 0x9e, 0xd6,\r\n  0x74, 0x71, 0x46, 0x0a, 0x6c, 0x7b, 0xbe, 0x25, 0xd1, 0x99, 0x63, 0x0b,\r\n  0x25, 0x74, 0xe0, 0xd6, 0x3d, 0x8a, 0x5f, 0x9c, 0x6c, 0x8c, 0x4a, 0x79,\r\n  0x0f, 0x36, 0x90, 0xac, 0xa6, 0xcc, 0x84, 0x84, 0xf8, 0x0e, 0x32, 0xd2,\r\n  0x06, 0x76, 0x9a, 0x13, 0x84, 0x49, 0x66, 0x98, 0xbe, 0x34, 0x24, 0xae,\r\n  0x34, 0x44, 0x8d, 0xf7, 0x36, 0x9a, 0x02, 0xe1, 0xa1, 0x39, 0x9d, 0x19,\r\n  0xee, 0xd1, 0x22, 0x95, 0x2c, 0xa3, 0x20, 0x5d, 0xbe, 0xb9, 0x93, 0xd5,\r\n  0x26, 0xfb, 0x41, 0xfe, 0xdb, 0x2d, 0x03, 0xa0, 0x1e, 0x14, 0xb9, 0x06,\r\n  0x19, 0xf4, 0x0d, 0xf4, 0x46, 0xb3, 0x44, 0x3c, 0xb1, 0x27, 0x4c, 0x15,\r\n  0x89, 0x69, 0xf0, 0x14, 0xb7, 0x19, 0x82, 0x36, 0xc7, 0x5b, 0x86, 0x3c,\r\n  0x81, 0x6a, 0xac, 0xad, 0xc5, 0xc5, 0xb5, 0x1a, 0xb5, 0x2e, 0x83, 0x33,\r\n  0x48, 0x56, 0xd0, 0x5c, 0x8f, 0x61, 0x8b, 0xf8, 0xf1, 0x3a, 0x0a, 0x4e,\r\n  0x62, 0xfb, 0xa2, 0x85, 0xf4, 0x9b, 0xde, 0xcf, 0xba, 0x51, 0xb4, 0xa2,\r\n  0x00, 0x49, 0x22, 0xb7, 0x2f, 0x5e, 0x73, 0xf8, 0xdd, 0x51, 0x40, 0xbc,\r\n  0xc5, 0x62, 0x0e, 0xa3, 0xc2, 0x46, 0x10, 0x44, 0x7f, 0xb6, 0x0e, 0x5d,\r\n  0x6d, 0xbe, 0x69, 0x94, 0x2a, 0x7a, 0x85, 0xfa, 0x71, 0xc9, 0xd2, 0xf1,\r\n  0x36, 0x80, 0x0d, 0x94, 0xd7, 0x53, 0x4a, 0x0e, 0xa1, 0xb8, 0x10, 0xfc,\r\n  0x36, 0x6b, 0x7a, 0xa7, 0x62, 0xc0, 0x08, 0x38, 0x70, 0x79, 0x31, 0xd1,\r\n  0x11, 0x17, 0x8a, 0xdb, 0xfd, 0xf4, 0xc9, 0x67, 0x51, 0xc9, 0x88, 0xad,\r\n  0x34, 0x9c, 0x32, 0xc9, 0x9f, 0x5a, 0x8f, 0x9b, 0x57, 0xbd, 0xd9, 0x9c,\r\n  0x3d, 0x8a, 0x22, 0x24, 0x73, 0x39, 0xbf, 0x4f, 0x70, 0x73, 0x29, 0xa2,\r\n  0xa9, 0x0d, 0xa3, 0xa6, 0x49, 0xb4, 0x4a, 0x36, 0x52, 0xbd, 0x04, 0xf3,\r\n  0x24, 0x4e, 0x98, 0x51, 0xbd, 0xa2, 0x13, 0x48, 0x9f, 0x48, 0x3c, 0x5c,\r\n  0x1c, 0x5f, 0x5e, 0xd0, 0x7f, 0xc6, 0x97, 0x67, 0x17, 0x6b, 0x92, 0x1d,\r\n  0xaa, 0x29, 0xc4, 0x1e, 0x4f, 0x1a, 0xef, 0x1a, 0x26, 0xd4, 0xc1, 0x34,\r\n  0xd7, 0x33, 0xd9, 0xe1, 0x47, 0x17, 0x11, 0x52, 0x76, 0x26, 0x50, 0x07,\r\n  0x79, 0xd4, 0xe5, 0xa8, 0x36, 0xd0, 0x2b, 0x92, 0xe5, 0x8f, 0x0e, 0x4c,\r\n  0xd6, 0xfc, 0xf1, 0x1d, 0x82, 0x01, 0xf3, 0x66, 0xe4, 0x11, 0x3b, 0xa1,\r\n  0x8d, 0xde, 0x2a, 0x8b, 0xbc, 0x77, 0x48, 0xae, 0x21, 0x44, 0xae, 0xf1,\r\n  0xb9, 0xf1, 0x76, 0xcb, 0xb3, 0x90, 0x63, 0x8f, 0xcb, 0x96, 0x48, 0x70,\r\n  0xa7, 0xc7, 0x9e, 0xef, 0x5b, 0x47, 0xd8, 0xf4, 0x81, 0xfd, 0x1b, 0x97,\r\n  0xce, 0x85, 0xc3, 0x57, 0x66, 0xbe, 0x48, 0x44, 0x9b, 0x17, 0x07, 0xa3,\r\n  0x49, 0x1d, 0xb9, 0x27, 0x24, 0xd1, 0x2b, 0xea, 0x82, 0x81, 0xba, 0xd4,\r\n  0x6c, 0x5e, 0xe5, 0xbe, 0x83, 0xf3, 0xe5, 0xba, 0x3b, 0x64, 0x5d, 0x48,\r\n  0xc1, 0x99, 0x57, 0xc8, 0x79, 0xef, 0x5b, 0xaf, 0xfa, 0x6e, 0xab, 0x35,\r\n  0xa4, 0xf2, 0x6e, 0x53, 0x2a, 0x33, 0x16, 0xb2, 0x5b, 0xb2, 0x20, 0x0a,\r\n  0x6f, 0x88, 0x3a, 0x47, 0xe1, 0xe9, 0xb2, 0x1d, 0x43, 0xc6, 0xaa, 0x73,\r\n  0x7d, 0x4a, 0xd6, 0xb6, 0x25, 0x0a, 0xa4, 0x9c, 0x87, 0xdf, 0xdb, 0xba,\r\n  0xe4, 0x02, 0x4f, 0x5c, 0x35, 0xa5, 0x69, 0x4d, 0x49, 0x6a, 0xcb, 0xcf,\r\n  0x80, 0x75, 0xd3, 0x61, 0xc9, 0x86, 0xe7, 0xdb, 0x01, 0x04, 0x54, 0xf9,\r\n  0x06, 0x6a, 0x23, 0xdf, 0xed, 0x56, 0x3c, 0xd6, 0x65, 0x2f, 0x36, 0xb5,\r\n  0x0f, 0x20, 0x0d, 0x45, 0x9f, 0x2c, 0x54, 0x07, 0xe9, 0xc6, 0x6d, 0x47,\r\n  0x6f, 0x33, 0x05, 0x50, 0x67, 0x9e, 0x6e, 0xd5, 0x26, 0x91, 0x73, 0x03,\r\n  0x38, 0x55, 0x41, 0x6e, 0xa7, 0x59, 0x0e, 0xef, 0x26, 0x26, 0xa1, 0x03,\r\n  0x57, 0x02, 0x85, 0x15, 0x98, 0x14, 0xbb, 0x52, 0xb4, 0x3d, 0x75, 0x01,\r\n  0x48, 0xb9, 0xb4, 0x06, 0xfc, 0x15, 0x2e, 0xfa, 0xd6, 0x51, 0x3a, 0x0f,\r\n  0x17, 0x51, 0x44, 0x1c, 0xd4, 0x70, 0x2f, 0x1b, 0x18, 0xf5, 0x29, 0x30,\r\n  0xf1, 0xf1, 0xb7, 0x0e, 0xc0, 0x2a, 0x63, 0x6d, 0xb3, 0x9f, 0x0b, 0x50,\r\n  0x06, 0xf8, 0x52, 0x65, 0x49, 0xad, 0xc3, 0x36, 0x4d, 0x85, 0x6b, 0xde,\r\n  0x67, 0x4c, 0x91, 0x87, 0xfd, 0x36, 0x4c, 0x97, 0x1f, 0x86, 0xd9, 0x1a,\r\n  0xc0, 0x97, 0xbb, 0x75, 0x72, 0xee, 0xab, 0x66, 0x78, 0xe9, 0x53, 0xae,\r\n  0xae, 0xaf, 0x51, 0x62, 0x26, 0x6d, 0x27, 0xa8, 0x94, 0x91, 0x77, 0x3f,\r\n  0x6a, 0x9a, 0x22, 0xa9, 0x59, 0xdc, 0x69, 0x37, 0x3c, 0xf8, 0x81, 0xf1,\r\n  0x35, 0xdd, 0xca, 0x9e, 0xb0, 0x63, 0x2d, 0x56, 0x80, 0xbd, 0xc9, 0xb2,\r\n  0x18, 0x21, 0x4d, 0xd4, 0xd0, 0xf1, 0x12, 0x2b, 0xad, 0x06, 0xf5, 0xd7,\r\n  0x75, 0xb8, 0x0d, 0xf1, 0x31, 0xaa, 0x01, 0x68, 0x32, 0x76, 0xa6, 0xa6,\r\n  0x7a, 0x8f, 0x87, 0xdf, 0xaa, 0xed, 0xe0, 0xa7, 0xa3, 0xbd, 0xad, 0x6e,\r\n  0xdf, 0xad, 0xee, 0x5e, 0xd6, 0xdb, 0x39, 0xaf, 0xf9, 0xea, 0x8a, 0x37,\r\n  0x06, 0x99, 0x58, 0x02, 0xa9, 0x17, 0x50, 0x76, 0x21, 0x4b, 0xeb, 0xe9,\r\n  0xc2, 0xd7, 0x54, 0xe1, 0xe1, 0x19, 0x6a, 0xae, 0x1b, 0x1d, 0xb3, 0x8f,\r\n  0x48, 0x3c, 0x80, 0xf2, 0x1b, 0x47, 0xe7, 0x74, 0xb7, 0xb8, 0x29, 0x0e,\r\n  0xb0, 0xc8, 0xf4, 0x0e, 0xcc, 0x0c, 0xee, 0xc6, 0x56, 0xf3, 0x22, 0x64,\r\n  0x02, 0x1d, 0xc4, 0xe7, 0x5f, 0x79, 0x97, 0x3c, 0x1b, 0x7d, 0x0b, 0xfa,\r\n  0x21, 0x87, 0x05, 0x0a, 0xea, 0x06, 0x32, 0xad, 0x84, 0xf1, 0x1e, 0x87,\r\n  0x96, 0x7d, 0xcf, 0x26, 0x47, 0x37, 0x3a, 0xef, 0x67, 0xa9, 0x13, 0xeb,\r\n  0x2e, 0x00, 0x86, 0x0c, 0xd1, 0xc9, 0x2c, 0x43, 0xaa, 0xd8, 0xd5, 0x52,\r\n  0xad, 0x9f, 0x59, 0x7e, 0x9f, 0x81, 0x3d, 0x31, 0x6a, 0xef, 0x26, 0x74,\r\n  0x9f, 0xcf, 0xce, 0xa8, 0x2e, 0x4e, 0xf7, 0x76, 0x46, 0xef, 0x9b, 0xe2,\r\n  0xb4, 0x2c, 0xe7, 0xc3, 0xe9, 0x74, 0xfa, 0x88, 0x44, 0x3d, 0x3c, 0x3c,\r\n  0xa4, 0x1f, 0x1c, 0x22, 0x17, 0x86, 0x19, 0x5c, 0xd0, 0xd3, 0xc3, 0x1b,\r\n  0x76, 0xd5, 0xcc, 0xb7, 0xa2, 0xf1, 0xcd, 0x8a, 0xb3, 0x92, 0xa9, 0x37,\r\n  0xd8, 0x15, 0xe3, 0xf1, 0xe9, 0xf6, 0xe5, 0xe9, 0xb8, 0x89, 0x8d, 0x8d,\r\n  0x1f, 0xd8, 0xd6, 0x83, 0x4d, 0x57, 0xb7, 0x5c, 0x44, 0x71, 0x43, 0xc6,\r\n  0xb9, 0xe1, 0xf6, 0x6c, 0x5f, 0xc9, 0x17, 0x3a, 0x59, 0x4e, 0x56, 0x99,\r\n  0xe3, 0x1d, 0x76, 0x96, 0x55, 0x96, 0x64, 0x80, 0x70, 0x39, 0x26, 0x2b,\r\n  0x04, 0xd8, 0xca, 0xe8, 0xcd, 0xc1, 0x25, 0x97, 0x6d, 0xa8, 0x94, 0x2d,\r\n  0xa2, 0x1b, 0xb9, 0xeb, 0xe8, 0x0a, 0x00, 0x6d, 0x8f, 0x03, 0x5e, 0x43,\r\n  0xbb, 0x03, 0x20, 0x8a, 0x38, 0x55, 0x5a, 0x44, 0x93, 0x40, 0x70, 0x3a,\r\n  0x19, 0xa1, 0x74, 0x46, 0x87, 0xee, 0x06, 0x12, 0x6c, 0x2a, 0xff, 0xb3,\r\n  0x6c, 0x2c, 0xc8, 0xee, 0x27, 0xed, 0xfb, 0xad, 0xf6, 0xfa, 0x0f, 0x82,\r\n  0xf3, 0xde, 0xd6, 0xaf, 0xfe, 0xf4, 0xeb, 0x97, 0x29, 0x51, 0x69, 0xc1,\r\n  0x8f, 0xc9, 0xd6, 0x68, 0xa3, 0x47, 0x6a, 0x77, 0xa7, 0x63, 0xda, 0x14,\r\n  0xc0, 0xb1, 0x12, 0x70, 0x94, 0xb4, 0xdc, 0x33, 0x10, 0x0c, 0xcb, 0x35,\r\n  0xe0, 0xea, 0x5c, 0xdc, 0xc7, 0x2d, 0xb1, 0x61, 0x92, 0x22, 0xc8, 0x11,\r\n  0xe3, 0x12, 0x9c, 0x02, 0xc1, 0x70, 0xcd, 0x17, 0xc9, 0x72, 0xfe, 0xe0,\r\n  0xd4, 0x34, 0x6d, 0x7e, 0x9d, 0xfd, 0x16, 0x6a, 0xfb, 0x21, 0x04, 0xde,\r\n  0xfa, 0x58, 0xd6, 0x5b, 0xc1, 0x87, 0xe2, 0xb4, 0xd3, 0xf1, 0x1c, 0xeb,\r\n  0x97, 0x1b, 0x85, 0x13, 0xda, 0x2b, 0xb4, 0xd7, 0xb9, 0x42, 0xb2, 0x4b,\r\n  0xbb, 0xd7, 0xe3, 0x42, 0x8f, 0xbd, 0x9d, 0x06, 0xc5, 0x74, 0xd9, 0x1e,\r\n  0x9b, 0xe7, 0xd7, 0x5c, 0x74, 0x42, 0xb2, 0xcb, 0x30, 0x49, 0xc6, 0x27,\r\n  0xda, 0xf4, 0x4b, 0xc8, 0x0e, 0xd6, 0xa2, 0x29, 0xf5, 0xc8, 0x92, 0xe8,\r\n  0x22, 0x2c, 0x53, 0xdc, 0xbe, 0xb7, 0x94, 0x55, 0x97, 0x9e, 0xd1, 0xb1,\r\n  0x1e, 0x2e, 0x54, 0x3c, 0x7d, 0x60, 0x4b, 0xff, 0x15, 0xdc, 0x41, 0x9a,\r\n  0xbb, 0x23, 0x64, 0xb4, 0x1a, 0x1b, 0xd6, 0x45, 0x33, 0xd3, 0xb4, 0xb3,\r\n  0x2c, 0x05, 0xdd, 0xdf, 0x3a, 0xc2, 0xf6, 0xac, 0xed, 0x6c, 0xe9, 0x95,\r\n  0xcd, 0x05, 0x84, 0xab, 0xc0, 0xfd, 0xa1, 0x3a, 0x61, 0x2b, 0x97, 0x63,\r\n  0x22, 0x84, 0x6c, 0x77, 0xc6, 0x20, 0x71, 0xb5, 0xe2, 0x9a, 0xda, 0x86,\r\n  0x91, 0xa9, 0x89, 0x78, 0x76, 0xcf, 0x2b, 0x8e, 0x5e, 0x42, 0x64, 0x8f,\r\n  0x56, 0x26, 0x8a, 0xc6, 0xea, 0x4e, 0x86, 0x17, 0x43, 0x43, 0x6b, 0x21,\r\n  0xd9, 0x84, 0xa7, 0x72, 0xd2, 0x46, 0x75, 0xe3, 0x76, 0x78, 0xcd, 0x59,\r\n  0x35, 0x2a, 0x62, 0x29, 0x28, 0x69, 0x57, 0xd3, 0x3c, 0xad, 0x58, 0xf3,\r\n  0x62, 0xb2, 0xe4, 0x53, 0xad, 0x0f, 0xdd, 0xff, 0xa2, 0x2f, 0x52, 0xba,\r\n  0xff, 0xa2, 0xcf, 0x74, 0x46, 0xf4, 0x4e, 0x1b, 0x6c, 0x83, 0x1b, 0xc3,\r\n  0x20, 0xd9, 0x7d, 0x71, 0x39, 0xf7, 0xad, 0x0b, 0xaa, 0xb4, 0x4b, 0xb7,\r\n  0x80, 0x4a, 0xc8, 0x14, 0x6f, 0xcd, 0x15, 0x93, 0x49, 0x23, 0xea, 0xb0,\r\n  0x5f, 0xeb, 0x49, 0x8a, 0x52, 0x89, 0x0e, 0x71, 0x22, 0xa6, 0xdb, 0x92,\r\n  0x61, 0xcb, 0xe2, 0x16, 0x49, 0xbf, 0x44, 0xee, 0xaa, 0xd0, 0x2b, 0x77,\r\n  0x01, 0x19, 0x7c, 0x41, 0x05, 0x57, 0xf3, 0x48, 0xfa, 0xc2, 0xe8, 0xb4,\r\n  0x78, 0x3a, 0x4d, 0x19, 0xe7, 0x0d, 0xe5, 0x90, 0x7e, 0x4b, 0x5a, 0x8d,\r\n  0x9c, 0x74, 0x1e, 0x37, 0x3b, 0x8b, 0x5f, 0x34, 0x21, 0x58, 0xae, 0x0a,\r\n  0x3b, 0x09, 0xf9, 0x26, 0xeb, 0xd7, 0xf0, 0x9a, 0x35, 0xc2, 0xeb, 0x79,\r\n  0x3e, 0xc9, 0xaf, 0xae, 0x1e, 0x71, 0x45, 0x4a, 0xf2, 0x0b, 0xda, 0x90,\r\n  0x2d, 0xda, 0xe3, 0x8c, 0x0c, 0x7e, 0x6f, 0x82, 0x32, 0xa1, 0x52, 0x5f,\r\n  0x63, 0x24, 0x1e, 0x19, 0xb0, 0x9d, 0xb4, 0xb4, 0x80, 0x50, 0x79, 0x1e,\r\n  0xb8, 0xb4, 0x91, 0xa0, 0x16, 0xb3, 0xe9, 0x99, 0x0a, 0xbf, 0xf3, 0xdc,\r\n  0x28, 0x65, 0xf4, 0x9f, 0xff, 0xfc, 0xe1, 0xa7, 0x0e, 0xe8, 0x33, 0x5b,\r\n  0x36, 0x8a, 0x38, 0x05, 0xd2, 0x45, 0xb2, 0x4b, 0x61, 0x42, 0xb0, 0x1a,\r\n  0xe2, 0x19, 0x8a, 0xb5, 0x48, 0x92, 0x82, 0x7a, 0xbb, 0xdc, 0x40, 0x62,\r\n  0x94, 0xba, 0x0f, 0x5a, 0x59, 0x70, 0xc5, 0x02, 0x70, 0x76, 0x2d, 0xd8,\r\n  0x05, 0x7c, 0x34, 0xcd, 0x65, 0xee, 0x89, 0xd5, 0xde, 0x3e, 0x50, 0x2e,\r\n  0x01, 0xdb, 0x85, 0x57, 0x55, 0xce, 0xbe, 0xbd, 0x38, 0x71, 0x36, 0x5d,\r\n  0xb0, 0x12, 0x5f, 0x61, 0x25, 0x5a, 0xd3, 0xe6, 0xd8, 0x7d, 0x06, 0x35,\r\n  0xb3, 0xc7, 0x13, 0x1f, 0x80, 0x50, 0x5f, 0x84, 0x4f, 0x8d, 0x66, 0x8c,\r\n  0xfd, 0x5d, 0xc3, 0x59, 0x9b, 0xa0, 0x48, 0x1e, 0x65, 0x71, 0x54, 0x67,\r\n  0xcb, 0x71, 0x71, 0x58, 0x2b, 0xa2, 0x14, 0x39, 0xdc, 0xc3, 0x57, 0xc7,\r\n  0x8e, 0x71, 0xaf, 0xb5, 0xf3, 0x6b, 0xf5, 0x49, 0xeb, 0xdc, 0x7c, 0xa0,\r\n  0x54, 0x70, 0x45, 0x67, 0xef, 0x3d, 0xa5, 0x8d, 0x18, 0x3f, 0x1d, 0x97,\r\n  0xa0, 0x32, 0xe3, 0x88, 0xc0, 0xb2, 0xa4, 0x79, 0x3f, 0x6f, 0xa7, 0x06,\r\n  0x61, 0xef, 0xff, 0x7b, 0xdf, 0x73, 0x94, 0x74, 0x12, 0xcd, 0xf8, 0x41,\r\n  0xb4, 0x12, 0x86, 0x87, 0x27, 0x03, 0xdf, 0x59, 0xff, 0x45, 0x1b, 0xca,\r\n  0xa4, 0x83, 0x5c, 0x6f, 0x5d, 0x3f, 0xbe, 0x3e, 0x3e, 0x38, 0xb2, 0xf1,\r\n  0xfe, 0x4b, 0x32, 0x7d, 0xbd, 0xff, 0x67, 0x92, 0x08, 0x87, 0xe0, 0xca,\r\n  0x4c, 0x48, 0xac, 0x92, 0x5d, 0x19, 0xd8, 0x19, 0xa4, 0x64, 0x33, 0x99,\r\n  0xab, 0xd6, 0xb3, 0xef, 0x2e, 0xbf, 0xb3, 0xd6, 0x66, 0x0c, 0xfc, 0x71,\r\n  0xe6, 0xdb, 0xf3, 0x85, 0x6a, 0x83, 0x6d, 0x1b, 0x26, 0x92, 0xbd, 0x90,\r\n  0xff, 0xae, 0xb9, 0x0b, 0x8e, 0xc1, 0xa1, 0xa4, 0x8f, 0x86, 0x04, 0x60,\r\n  0xd7, 0x41, 0x89, 0xae, 0xfb, 0x64, 0xc2, 0xba, 0xd0, 0x35, 0xab, 0xcf,\r\n  0x08, 0x77, 0x92, 0xcc, 0x6b, 0xf6, 0xdc, 0x4a, 0xd0, 0x33, 0xcf, 0x83,\r\n  0xe3, 0x5c, 0x4f, 0x82, 0xd6, 0x6b, 0xe8, 0x7d, 0xcd, 0xe3, 0xb2, 0xe2,\r\n  0x54, 0xb3, 0x56, 0xe1, 0x20, 0x92, 0x10, 0x65, 0x45, 0x7a, 0x88, 0xf5,\r\n  0x8c, 0x5f, 0xba, 0xd1, 0x08, 0x2e, 0x2c, 0x34, 0x38, 0xb5, 0x63, 0xf1,\r\n  0x1d, 0x79, 0xe0, 0xbf, 0x79, 0x2a, 0x9a, 0x66, 0x51, 0xe6, 0x51, 0x1a,\r\n  0xba, 0xe5, 0x57, 0xa0, 0xd4, 0x45, 0xbc, 0x9c, 0x93, 0x8b, 0xb5, 0x5a,\r\n  0x29, 0xa7, 0x94, 0xe9, 0x27, 0xc3, 0x08, 0xc5, 0xe3, 0x07, 0xcc, 0xb9,\r\n  0x47, 0xd8, 0x41, 0x58, 0x53, 0xb5, 0x79, 0x8c, 0x86, 0x56, 0x43, 0xfe,\r\n  0x1a, 0xdd, 0x0d, 0xd3, 0xdb, 0xd6, 0x4d, 0x05, 0x92, 0xe3, 0x6a, 0x75,\r\n  0x75, 0x65, 0x58, 0x35, 0x31, 0x4d, 0xd1, 0x51, 0x5f, 0x8c, 0x3b, 0x1f,\r\n  0x61, 0xf2, 0x75, 0xce, 0x4c, 0x53, 0x8c, 0xa7, 0xeb, 0xbc, 0x35, 0x3a,\r\n  0x1c, 0x5f, 0x62, 0xc8, 0xa4, 0x33, 0x2a, 0x62, 0x48, 0x16, 0x6b, 0x52,\r\n  0xb0, 0xa9, 0x09, 0xe4, 0x0e, 0xc2, 0xd6, 0xf7, 0x6d, 0x21, 0xac, 0x85,\r\n  0x94, 0x24, 0xf1, 0x95, 0x89, 0xc9, 0x59, 0x25, 0x91, 0xbc, 0x3b, 0x1d,\r\n  0xb6, 0x4e, 0x18, 0x89, 0xf5, 0xeb, 0xf4, 0xce, 0x8a, 0xcf, 0xa1, 0x67,\r\n  0x1d, 0x09, 0x14, 0xd6, 0x09, 0x8b, 0xdc, 0xab, 0x47, 0x5f, 0x32, 0xc0,\r\n  0x23, 0x66, 0x3f, 0x0b, 0x96, 0x73, 0x9a, 0xcf, 0x91, 0xed, 0x1a, 0xc3,\r\n  0xa8, 0xdb, 0xe7, 0x9d, 0xdd, 0x0c, 0x89, 0x7c, 0x9d, 0x97, 0xd5, 0x7e,\r\n  0xaf, 0x5e, 0x63, 0x43, 0x55, 0x88, 0xfa, 0x16, 0x52, 0xd6, 0xb0, 0xa1,\r\n  0xdc, 0xda, 0x72, 0xc4, 0xaa, 0xb2, 0xb3, 0x9e, 0x90, 0x0b, 0x35, 0x6a,\r\n  0x69, 0xe8, 0xca, 0xd2, 0x2c, 0x99, 0x84, 0x69, 0x91, 0x6a, 0xaf, 0x50,\r\n  0xd7, 0x85, 0x7b, 0x36, 0xfc, 0x9a, 0xfa, 0xf1, 0xfd, 0xf0, 0x70, 0x55,\r\n  0xb6, 0xf1, 0xc3, 0x8b, 0xe1, 0xd7, 0x68, 0xf2, 0xaf, 0x3d, 0x67, 0x61,\r\n  0xcb, 0xa3, 0xfe, 0x57, 0xfb, 0xbd, 0x35, 0x78, 0xef, 0x90, 0x87, 0xa5,\r\n  0x5c, 0x15, 0x46, 0xe5, 0x00, 0x8f, 0xb9, 0x76, 0x14, 0xe4, 0xd3, 0xb3,\r\n  0xd9, 0xb6, 0xce, 0xb7, 0x05, 0xf7, 0xba, 0x32, 0x92, 0x34, 0x5b, 0x61,\r\n  0x09, 0x54, 0xde, 0x6c, 0x98, 0x5f, 0x0d, 0x51, 0x10, 0x84, 0x8b, 0x34,\r\n  0x72, 0x28, 0x25, 0x38, 0x8e, 0x20, 0x96, 0x43, 0x7e, 0xcd, 0x6c, 0xd6,\r\n  0x75, 0x2d, 0x2b, 0x30, 0xbc, 0x70, 0x16, 0xaa, 0x76, 0x46, 0x97, 0x74,\r\n  0x9f, 0xad, 0x1a, 0x7b, 0xdd, 0xf1, 0x96, 0x71, 0x09, 0x8d, 0xb8, 0x28,\r\n  0x52, 0x92, 0x22, 0xad, 0x4a, 0x02, 0x00, 0xe1, 0x0d, 0xe4, 0xe6, 0xc6,\r\n  0xa0, 0x21, 0x7e, 0x17, 0xe2, 0x2c, 0x82, 0xc1, 0x4f, 0x56, 0xfe, 0x95,\r\n  0x54, 0x86, 0xea, 0x8c, 0xed, 0xfa, 0xcc, 0x8f, 0x66, 0xa5, 0x4e, 0xa4,\r\n  0xe7, 0xd5, 0xd2, 0x7c, 0xd7, 0x71, 0x40, 0xac, 0x0b, 0xf2, 0x06, 0x19,\r\n  0x07, 0xb8, 0x1d, 0x14, 0x0d, 0xef, 0x27, 0x7d, 0x5b, 0xb4, 0xf4, 0xae,\r\n  0xe8, 0x08, 0xbf, 0x65, 0xd2, 0x2f, 0xd0, 0xd7, 0x99, 0x3f, 0x7e, 0xb9,\r\n  0x9a, 0x2c, 0x66, 0xcf, 0xa2, 0x17, 0xf4, 0x47, 0x1b, 0xbe, 0x7c, 0x68,\r\n  0xc1, 0x34, 0xa9, 0x98, 0xc7, 0xfb, 0x4e, 0xb3, 0x64, 0x45, 0x0f, 0xe3,\r\n  0xbf, 0x3e, 0xd9, 0xa3, 0xa6, 0xdf, 0x53, 0xdb, 0xd3, 0x74, 0x01, 0x2a,\r\n  0xeb, 0xeb, 0xb4, 0x2a, 0xbb, 0x8c, 0x58, 0x7d, 0xd5, 0x07, 0x32, 0x78,\r\n  0xa2, 0x76, 0xf7, 0x3e, 0x8b, 0x26, 0x69, 0x15, 0xbd, 0x3e, 0x7a, 0x26,\r\n  0xd5, 0x21, 0xcb, 0xd5, 0xc2, 0x05, 0x84, 0x94, 0x07, 0x1a, 0x3c, 0xf7,\r\n  0xfd, 0xe6, 0x11, 0xa1, 0x8e, 0xcf, 0xd3, 0x29, 0xe7, 0x4f, 0x0e, 0x6a,\r\n  0x2e, 0xb4, 0x2b, 0x73, 0xf5, 0x05, 0xd4, 0xe5, 0x6e, 0xe3, 0x71, 0x4b,\r\n  0xea, 0x6a, 0xec, 0x30, 0x62, 0x69, 0x0e, 0xe8, 0xf3, 0xa5, 0x95, 0x95,\r\n  0xab, 0x19, 0x4e, 0x9f, 0xd6, 0x1d, 0x02, 0x82, 0x96, 0x35, 0x3e, 0x9e,\r\n  0xe1, 0x3c, 0xc9, 0xae, 0xd7, 0x55, 0xed, 0x3c, 0xc1, 0xa3, 0x62, 0xe3,\r\n  0xeb, 0xe3, 0xa7, 0x78, 0xdc, 0xa5, 0x21, 0x07, 0xb1, 0x1f, 0xde, 0xce,\r\n  0xe9, 0x94, 0xeb, 0xb8, 0xb7, 0xe8, 0x72, 0x57, 0x42, 0x48, 0x8d, 0x0d,\r\n  0x68, 0xe5, 0x62, 0x8b, 0x95, 0x94, 0x03, 0x39, 0x58, 0x32, 0x62, 0x2c,\r\n  0xda, 0x1d, 0xbd, 0x1f, 0x84, 0x75, 0xec, 0x94, 0x77, 0x9e, 0xeb, 0xd5,\r\n  0xb5, 0x4a, 0x02, 0xc3, 0xe9, 0xdb, 0xe8, 0x10, 0x37, 0x2d, 0x50, 0xbd,\r\n  0x39, 0x07, 0x3d, 0x0a, 0xb9, 0x06, 0xf6, 0x48, 0x9e, 0x5e, 0xc7, 0xa8,\r\n  0x5b, 0x12, 0xec, 0x9e, 0x14, 0x95, 0x8b, 0x85, 0xaf, 0x6b, 0xcd, 0xc0,\r\n  0xe5, 0x97, 0x2e, 0x19, 0xdd, 0x34, 0x01, 0xd5, 0xdf, 0x15, 0x63, 0x6a,\r\n  0xc4, 0x49, 0xc1, 0x13, 0xed, 0x72, 0x7b, 0xdc, 0x0e, 0xa8, 0xc5, 0x70,\r\n  0x0a, 0x05, 0x75, 0xa3, 0x93, 0x30, 0xe4, 0x1b, 0x78, 0xc0, 0xba, 0x9a,\r\n  0x8b, 0x24, 0x7a, 0x74, 0x2d, 0x1a, 0x6d, 0xc3, 0xe8, 0x4b, 0xab, 0x5e,\r\n  0xcf, 0x41, 0x94, 0xd1, 0x28, 0x18, 0xd5, 0x89, 0x69, 0x2c, 0x5d, 0x43,\r\n  0x62, 0x32, 0xef, 0xed, 0x57, 0x27, 0xa7, 0xc7, 0x5b, 0xd1, 0xab, 0x04,\r\n  0xf9, 0xfe, 0x8d, 0x91, 0xb1, 0xbc, 0xf8, 0x83, 0xfc, 0xc4, 0x56, 0x48,\r\n  0x0d, 0xac, 0xae, 0x1c, 0x60, 0x47, 0xef, 0x00, 0x4d, 0x51, 0x96, 0x0d,\r\n  0x4a, 0xa1, 0x64, 0xc1, 0xe4, 0x40, 0xe9, 0x19, 0x65, 0xbb, 0x85, 0xf1,\r\n  0x3a, 0x67, 0x08, 0x08, 0x26, 0x5f, 0xde, 0xc0, 0x93, 0x7e, 0xe6, 0x61,\r\n  0x08, 0x9c, 0x7b, 0xae, 0x48, 0x34, 0x0b, 0x8b, 0x4a, 0x65, 0xa0, 0x72,\r\n  0x5d, 0x05, 0xc1, 0x32, 0xfd, 0x87, 0x00, 0x77, 0x81, 0x97, 0x58, 0xe4,\r\n  0x33, 0xc7, 0xef, 0x27, 0x65, 0x08, 0x1a, 0xf5, 0x9d, 0x87, 0xb8, 0x8a,\r\n  0xaf, 0xf8, 0x02, 0xe8, 0x4c, 0xee, 0x3c, 0x17, 0x36, 0x43, 0xd8, 0x0e,\r\n  0x61, 0x18, 0x5e, 0xee, 0x6a, 0x6f, 0xa0, 0xb8, 0x66, 0x46, 0x0e, 0xc9,\r\n  0x95, 0x64, 0x55, 0xc7, 0xbe, 0xb0, 0xaf, 0xc9, 0x16, 0x08, 0x7c, 0xfb,\r\n  0x34, 0x5a, 0x1c, 0x75, 0x01, 0xd4, 0x1d, 0x64, 0x86, 0xb6, 0x89, 0xb4,\r\n  0xa0, 0x1f, 0x92, 0x77, 0x5a, 0x65, 0x4c, 0x3a, 0x10, 0x51, 0x8a, 0x59,\r\n  0x0a, 0x46, 0x46, 0xea, 0xee, 0xce, 0xfe, 0x6e, 0x58, 0xa5, 0x24, 0xd3,\r\n  0x1a, 0x5c, 0x8c, 0x54, 0xda, 0xfe, 0xfd, 0x30, 0x29, 0x7f, 0xe7, 0xad,\r\n  0xf9, 0xf7, 0x55, 0x76, 0x3b, 0xd4, 0x32, 0x98, 0xc3, 0xee, 0x4a, 0x69,\r\n  0x7a, 0xfa, 0xbe, 0x73, 0x41, 0x09, 0x20, 0x0e, 0x04, 0x32, 0xd9, 0xae,\r\n  0x07, 0x19, 0x07, 0xec, 0x69, 0x83, 0x47, 0xf2, 0x6c, 0xbc, 0x4d, 0x99,\r\n  0x72, 0x2c, 0x94, 0x06, 0xcc, 0x65, 0xb7, 0x58, 0x31, 0xe8, 0x59, 0x55,\r\n  0x4e, 0x6b, 0xb8, 0x37, 0x0a, 0x19, 0xdc, 0x5a, 0xe0, 0xa8, 0x52, 0xf3,\r\n  0xa7, 0xc4, 0x7b, 0xe2, 0x35, 0x69, 0x0d, 0x37, 0xc4, 0xc2, 0xc6, 0xc5,\r\n  0x37, 0xb6, 0xaf, 0xf7, 0x59, 0x0a, 0x43, 0x2a, 0xcf, 0x47, 0xe3, 0xb6,\r\n  0x94, 0xcc, 0x36, 0xa3, 0x6c, 0x2f, 0x8d, 0xe3, 0xc4, 0x7a, 0x18, 0x35,\r\n  0x3b, 0x67, 0x74, 0xee, 0x7c, 0xc9, 0xf7, 0x5b, 0xe7, 0x72, 0x3a, 0xcf,\r\n  0xa5, 0x52, 0xc8, 0x7d, 0xe8, 0xd8, 0xfa, 0x0f, 0xb9, 0xb7, 0xf9, 0x32,\r\n  0xd2, 0x93, 0x3e, 0xec, 0xc0, 0x3e, 0x85, 0x94, 0xa0, 0x96, 0x9c, 0x84,\r\n  0xd4, 0x1f, 0x28, 0x04, 0x67, 0x41, 0x1b, 0x02, 0x69, 0x75, 0xf9, 0x4b,\r\n  0x7a, 0x61, 0x75, 0xd2, 0x00, 0x0d, 0x03, 0xb3, 0xdd, 0x49, 0xeb, 0x23,\r\n  0x3a, 0xb6, 0x79, 0x99, 0x8a, 0x9f, 0xdd, 0x03, 0xd3, 0x02, 0xa7, 0x6f,\r\n  0x1b, 0x7b, 0x62, 0x39, 0xbb, 0x8e, 0xaf, 0xc1, 0xa1, 0x71, 0xcc, 0x6e,\r\n  0x0d, 0x06, 0x7c, 0x2b, 0xb2, 0xbd, 0xec, 0xc2, 0x12, 0x59, 0x56, 0x6a,\r\n  0x18, 0x30, 0x0a, 0x20, 0x96, 0x6a, 0x71, 0x38, 0xf6, 0x7a, 0x3d, 0xf2,\r\n  0x3d, 0x6b, 0xad, 0xd7, 0x54, 0x9b, 0xc6, 0xa7, 0x61, 0x06, 0xad, 0xf8,\r\n  0xdd, 0x3c, 0x8d, 0xcd, 0x01, 0xed, 0xb0, 0xd6, 0x23, 0xec, 0x73, 0x15,\r\n  0x50, 0x4c, 0xd2, 0x51, 0xf9, 0x5d, 0xf8, 0xd3, 0x69, 0x95, 0xcc, 0x3f,\r\n  0x6b, 0x08, 0x57, 0xb9, 0x82, 0xeb, 0xb9, 0x5b, 0x92, 0x8e, 0x87, 0x89,\r\n  0x8b, 0x19, 0x94, 0xdf, 0xdc, 0xad, 0x0f, 0x16, 0x67, 0x50, 0x83, 0xca,\r\n  0x50, 0xd5, 0x52, 0xa8, 0xd0, 0xf7, 0x29, 0xac, 0xa6, 0xb0, 0x7e, 0xb0,\r\n  0xa8, 0xec, 0x66, 0x91, 0xce, 0xda, 0x24, 0xb7, 0x23, 0x9d, 0x81, 0x5a,\r\n  0xe9, 0x3d, 0x64, 0xf0, 0x08, 0x20, 0x19, 0x19, 0x51, 0x49, 0xad, 0xfe,\r\n  0xa5, 0x1e, 0xe4, 0xc8, 0x61, 0x0b, 0x23, 0x57, 0x86, 0x69, 0x4d, 0x71,\r\n  0x25, 0x24, 0x12, 0xde, 0xc4, 0xef, 0xdf, 0x8f, 0xca, 0x44, 0x8a, 0x04,\r\n  0x95, 0xe5, 0x1c, 0x49, 0x8b, 0xf5, 0xaa, 0x4a, 0xc3, 0x6f, 0xb4, 0xa4,\r\n  0xda, 0x55, 0x7a, 0xcd, 0xd8, 0x37, 0xfc, 0xb7, 0x2b, 0x45, 0xdb, 0x72,\r\n  0xb3, 0xb5, 0x32, 0x95, 0x7f, 0xd0, 0x4b, 0x1d, 0x30, 0xb9, 0x28, 0x02,\r\n  0x48, 0x84, 0x8f, 0x92, 0xc4, 0x4e, 0xdb, 0xb9, 0x1f, 0xfc, 0xb6, 0xc2,\r\n  0x26, 0x40, 0x95, 0xa7, 0x38, 0x74, 0xac, 0x94, 0xfb, 0x46, 0x50, 0x4e,\r\n  0xd0, 0xb7, 0x2b, 0x2a, 0x73, 0xd3, 0xf0, 0xd0, 0x62, 0x7c, 0x76, 0xc7,\r\n  0x26, 0x59, 0x4d, 0xc8, 0xaa, 0xcc, 0x11, 0xbd, 0x9f, 0x61, 0xe9, 0xf6,\r\n  0xbc, 0x41, 0x38, 0x9a, 0x86, 0xc7, 0xb4, 0x62, 0x4a, 0xc7, 0xb0, 0x07,\r\n  0xa3, 0xe8, 0x6c, 0x19, 0x6c, 0xe0, 0x9b, 0x24, 0x2d, 0xbc, 0x47, 0xba,\r\n  0x74, 0x86, 0x1c, 0x4e, 0x73, 0x7b, 0xb0, 0x72, 0x53, 0x07, 0xf5, 0x03,\r\n  0xb2, 0x60, 0x02, 0xa4, 0x6a, 0x80, 0xb9, 0xb4, 0x0c, 0xd5, 0x4a, 0x43,\r\n  0x21, 0x7d, 0x8c, 0xd4, 0xbe, 0x16, 0x41, 0x8d, 0x19, 0xab, 0xc8, 0xcd,\r\n  0x65, 0xee, 0xc9, 0x12, 0x79, 0x10, 0x42, 0xc7, 0xf2, 0x50, 0x73, 0x79,\r\n  0xc1, 0xe5, 0x4c, 0xca, 0xc3, 0xa6, 0x52, 0x8d, 0x77, 0x25, 0xe2, 0x89,\r\n  0x53, 0xa7, 0xc0, 0x9d, 0x65, 0xc4, 0xbf, 0x8a, 0xbc, 0x09, 0x5a, 0xdf,\r\n  0x72, 0xd5, 0xbe, 0x6b, 0x7e, 0xf8, 0x0e, 0xd0, 0x9a, 0x25, 0x50, 0x07,\r\n  0x03, 0x70, 0x19, 0xfd, 0xf6, 0xa6, 0x16, 0x25, 0x9b, 0x80, 0x42, 0x41,\r\n  0x65, 0xb2, 0x62, 0x71, 0x1b, 0xcd, 0x09, 0xaa, 0x97, 0x54, 0x1e, 0x01,\r\n  0xea, 0x0a, 0x92, 0x37, 0x32, 0xac, 0x6f, 0x9d, 0x41, 0x58, 0x00, 0xbb,\r\n  0x34, 0x8c, 0x9f, 0x57, 0xec, 0x7d, 0x2f, 0x3b, 0x18, 0xaa, 0x5d, 0xd6,\r\n  0x29, 0xd9, 0xf8, 0x3f, 0xfe, 0x38, 0x88, 0x7e, 0xec, 0xd1, 0xff, 0x91,\r\n  0x1e, 0xf9, 0x23, 0x4d, 0xe8, 0x8f, 0x42, 0x78, 0xfc, 0xe3, 0x1d, 0x49,\r\n  0xa5, 0x00, 0x22, 0xec, 0xc9, 0x6c, 0xdb, 0x28, 0x2f, 0x09, 0x30, 0x2a,\r\n  0x89, 0x37, 0xbb, 0xe6, 0x24, 0xc7, 0xce, 0xcd, 0x95, 0xf8, 0xf4, 0x68,\r\n  0xc1, 0x56, 0x8b, 0x4c, 0x94, 0x38, 0x5d, 0x7a, 0x6c, 0xea, 0xd6, 0x55,\r\n  0x1c, 0x47, 0x51, 0xff, 0x8f, 0x7d, 0x0d, 0x5b, 0x54, 0x06, 0x3c, 0x0c,\r\n  0x63, 0xb4, 0x78, 0xcf, 0xb6, 0x76, 0x50, 0xb6, 0x3b, 0xee, 0x8c, 0xd6,\r\n  0x42, 0x59, 0x3c, 0x63, 0x1b, 0x57, 0xca, 0xaf, 0xe6, 0xbe, 0x30, 0x27,\r\n  0x9b, 0xe7, 0xd1, 0xf2, 0xe6, 0x01, 0x97, 0xb5, 0xec, 0xc1, 0x80, 0xe0,\r\n  0x52, 0x7a, 0xd9, 0xc1, 0x3d, 0xde, 0x16, 0x5f, 0x35, 0xce, 0x06, 0x7f,\r\n  0x55, 0x71, 0xe4, 0x23, 0x94, 0x2d, 0xd4, 0xc7, 0xfe, 0xb0, 0x5f, 0xa7,\r\n  0x7d, 0x5a, 0x53, 0x91, 0xc1, 0x13, 0xa3, 0x48, 0x3d, 0x86, 0xf5, 0xe0,\r\n  0x70, 0xcd, 0x24, 0xd6, 0xaa, 0xf4, 0xce, 0x35, 0x08, 0x27, 0xad, 0x19,\r\n  0x21, 0xe1, 0x59, 0x1b, 0x74, 0xa1, 0x67, 0x40, 0xe0, 0x25, 0xcc, 0x90,\r\n  0x36, 0x96, 0xb4, 0x8a, 0x82, 0x1b, 0x65, 0xc8, 0x5c, 0xe1, 0x2e, 0x76,\r\n  0xc1, 0x5b, 0x04, 0x65, 0x10, 0x1f, 0x38, 0x5b, 0x62, 0xd9, 0xb2, 0xe2,\r\n  0x78, 0xa6, 0xed, 0x4d, 0xee, 0x47, 0x0e, 0xf7, 0x4f, 0xc4, 0x41, 0x51,\r\n  0x91, 0x23, 0xe3, 0x7c, 0x20, 0xb4, 0xa8, 0x4e, 0x4f, 0x8d, 0x5c, 0xde,\r\n  0x45, 0xfb, 0x38, 0x75, 0xa6, 0x1e, 0x70, 0x7f, 0x5e, 0x46, 0xbd, 0xb5,\r\n  0xb2, 0xbe, 0xd7, 0x7c, 0xe1, 0x94, 0x13, 0xc1, 0x1d, 0x76, 0x49, 0xc8,\r\n  0x40, 0x24, 0x97, 0xc4, 0x18, 0x96, 0xe6, 0xa8, 0x6a, 0x2e, 0xaa, 0xa2,\r\n  0x2f, 0x34, 0x68, 0x42, 0x7e, 0x8d, 0x6f, 0x4d, 0x9c, 0x92, 0xc2, 0x8a,\r\n  0xa5, 0x27, 0x93, 0x0b, 0xcb, 0xae, 0x2b, 0x53, 0x60, 0xca, 0x2a, 0xe7,\r\n  0xe5, 0xdd, 0x2a, 0x57, 0x93, 0xaa, 0x73, 0x9b, 0x76, 0x69, 0xfe, 0x6c,\r\n  0x17, 0xe5, 0x96, 0xba, 0x0b, 0x04, 0x39, 0xb8, 0x8e, 0xe7, 0xa7, 0x2e,\r\n  0x49, 0x61, 0x6c, 0xc1, 0xb8, 0x4a, 0xe1, 0xfa, 0xbd, 0xca, 0x57, 0xd9,\r\n  0xac, 0x8e, 0x26, 0x58, 0xbb, 0xb3, 0xf9, 0xbb, 0xf8, 0xa2, 0x12, 0x46,\r\n  0x59, 0x56, 0x80, 0x93, 0x2e, 0xf0, 0xc1, 0x94, 0xae, 0x54, 0x3d, 0x88,\r\n  0x76, 0x5a, 0x2b, 0xb3, 0xbb, 0xa5, 0x9a, 0x51, 0x21, 0x65, 0xe3, 0xa5,\r\n  0xc8, 0x25, 0x62, 0x66, 0x37, 0xb9, 0x64, 0xff, 0xf7, 0xf6, 0xb9, 0x78,\r\n  0xa5, 0x7a, 0xfb, 0x75, 0x8c, 0x2e, 0x4c, 0xdd, 0x44, 0xbb, 0x30, 0xbd,\r\n  0xc2, 0xd7, 0x67, 0xaf, 0x8f, 0x1d, 0x26, 0x51, 0x4c, 0x52, 0xfe, 0x49,\r\n  0x27, 0x03, 0xcc, 0x08, 0x81, 0x65, 0xcb, 0xea, 0x1c, 0xb4, 0xd9, 0x78,\r\n  0x31, 0x3b, 0x64, 0x77, 0x2e, 0xef, 0x57, 0xe9, 0x6c, 0x13, 0x99, 0xb7,\r\n  0x6f, 0xdf, 0x9c, 0x7c, 0x3f, 0x84, 0xc5, 0xad, 0xe5, 0xb6, 0x2d, 0xf5,\r\n  0xd4, 0xb2, 0x56, 0xa5, 0x20, 0x47, 0xbe, 0xe8, 0x48, 0xe1, 0x36, 0x6e,\r\n  0xe6, 0x90, 0xc2, 0x08, 0x38, 0xfa, 0x34, 0x13, 0x9f, 0xb7, 0x34, 0xb9,\r\n  0xc5, 0x62, 0x88, 0x64, 0x38, 0xe8, 0x17, 0xb0, 0xee, 0x1d, 0xf8, 0xca,\r\n  0x60, 0xbd, 0xb9, 0xb9, 0x83, 0xf3, 0xf3, 0xa3, 0x83, 0xcb, 0x03, 0x37,\r\n  0x36, 0xd0, 0x1d, 0x40, 0xd4, 0xc1, 0x90, 0x62, 0xed, 0x48, 0x4b, 0x2a,\r\n  0xf4, 0xff, 0xc4, 0xe0, 0xfb, 0xa6, 0xf4, 0x3b, 0xbf, 0x38, 0x63, 0x83,\r\n  0xf8, 0x4f, 0x3f, 0x1e, 0xf8, 0xfa, 0x48, 0xa8, 0x99, 0xd0, 0xae, 0x52,\r\n  0xb3, 0x47, 0xfa, 0xee, 0x59, 0xe6, 0xf8, 0x21, 0x06, 0x2e, 0x5a, 0x2b,\r\n  0x59, 0xae, 0xd1, 0x3b, 0x5e, 0xd3, 0x62, 0xea, 0x14, 0x14, 0xf1, 0x34,\r\n  0xc9, 0x72, 0x0e, 0xda, 0xa8, 0xad, 0x60, 0x20, 0x80, 0xff, 0xd5, 0xd9,\r\n  0x1f, 0x6c, 0xae, 0xe6, 0xa4, 0x55, 0x93, 0x6a, 0x58, 0x41, 0x7c, 0x31,\r\n  0xbe, 0x85, 0xf7, 0xd7, 0x8c, 0x27, 0xaa, 0xc9, 0x71, 0xe4, 0xd6, 0xc7,\r\n  0x16, 0x48, 0xb2, 0x8a, 0x71, 0x0d, 0x88, 0x0c, 0x12, 0x54, 0x5e, 0x2e,\r\n  0xfc, 0xd9, 0x23, 0xeb, 0xad, 0xea, 0xfe, 0xad, 0xb3, 0x23, 0xde, 0x66,\r\n  0xda, 0xe7, 0x36, 0x86, 0xd6, 0x84, 0xfc, 0x91, 0x84, 0xde, 0xd0, 0xb2,\r\n  0xfe, 0x64, 0xd8, 0xf4, 0x83, 0xd6, 0x43, 0x95, 0xb1, 0x04, 0x43, 0x55,\r\n  0x6a, 0xfb, 0x83, 0x55, 0x4e, 0x85, 0x02, 0xaa, 0xa9, 0x31, 0x6b, 0x22,\r\n  0xb8, 0x3e, 0x85, 0xd2, 0x22, 0x48, 0x23, 0x6b, 0xfb, 0xc6, 0xcc, 0xd3,\r\n  0x4a, 0x8f, 0x96, 0x2b, 0x76, 0x2e, 0xf0, 0xbf, 0xb6, 0x77, 0x47, 0x3b,\r\n  0xbd, 0x76, 0xef, 0x01, 0xe9, 0x82, 0x07, 0xc7, 0x08, 0xea, 0x84, 0x73,\r\n  0x30, 0xff, 0x70, 0x07, 0xb5, 0xa4, 0x66, 0x9c, 0x21, 0x0e, 0xd5, 0xd5,\r\n  0x97, 0xe1, 0x59, 0xcb, 0xd3, 0x26, 0x1e, 0x5f, 0x2f, 0x92, 0xb3, 0x1c,\r\n  0xe9, 0x8f, 0x31, 0xdb, 0x1c, 0xf0, 0x1a, 0xf4, 0xba, 0x27, 0x38, 0x9b,\r\n  0x49, 0xf4, 0xaa, 0x31, 0xcf, 0xbf, 0x2a, 0x2d, 0xc8, 0xad, 0x7f, 0xe0,\r\n  0x48, 0x5e, 0x2b, 0xed, 0x6a, 0x6e, 0xe2, 0xdb, 0x84, 0x14, 0xbf, 0x39,\r\n  0xb2, 0x60, 0xd8, 0xe9, 0xb3, 0xae, 0x42, 0x65, 0xcd, 0x22, 0xd4, 0x3a,\r\n  0xf5, 0x52, 0x95, 0x17, 0x15, 0x2b, 0x43, 0x9c, 0xaf, 0x52, 0x7d, 0xc0,\r\n  0x34, 0x60, 0x64, 0x5e, 0x94, 0xce, 0x5a, 0x97, 0x88, 0x22, 0xfe, 0x38,\r\n  0x54, 0xc1, 0xf2, 0xca, 0x75, 0x82, 0x83, 0x07, 0x93, 0xc4, 0xe9, 0xd9,\r\n  0xd2, 0xba, 0x25, 0xdc, 0x32, 0xd9, 0x5d, 0x7a, 0x97, 0xce, 0x56, 0xad,\r\n  0xd0, 0x5b, 0xf3, 0x7d, 0x94, 0x08, 0x4e, 0xcb, 0x30, 0xb3, 0x03, 0xfe,\r\n  0x07, 0x7e, 0x22, 0x77, 0xee, 0x29, 0xd4, 0x9d, 0xc0, 0x99, 0x6a, 0x79,\r\n  0xdc, 0xae, 0x84, 0x61, 0x4a, 0x86, 0x78, 0x79, 0x78, 0xfe, 0xee, 0x9b,\r\n  0xe3, 0xe3, 0xf3, 0x93, 0xa3, 0xd3, 0x63, 0xbd, 0x67, 0xdc, 0x8f, 0xde,\r\n  0x5c, 0x7e, 0x7b, 0x6a, 0xa4, 0x53, 0x36, 0x3f, 0x2d, 0x9f, 0x0d, 0x23,\r\n  0x47, 0xd0, 0xdc, 0x69, 0x9a, 0xad, 0xde, 0x0f, 0x50, 0x6d, 0x9e, 0x36,\r\n  0xf3, 0xc1, 0xc9, 0xf7, 0x83, 0xe8, 0xeb, 0xf3, 0xe1, 0xdb, 0xef, 0x5b,\r\n  0xf9, 0xfc, 0x35, 0xac, 0x66, 0xd3, 0xd8, 0x77, 0xc8, 0x4d, 0xd0, 0xa5,\r\n  0xfa, 0xb1, 0x9b, 0x95, 0xd9, 0x51, 0x41, 0xe4, 0xb7, 0xf6, 0x5b, 0xb5,\r\n  0x9a, 0x5b, 0x65, 0x01, 0x0d, 0x23, 0xaa, 0x53, 0x48, 0xd3, 0x7a, 0xf5,\r\n  0x62, 0x3b, 0x7c, 0xb2, 0x63, 0x55, 0x4d, 0xeb, 0x1b, 0xf0, 0x21, 0x7a,\r\n  0x41, 0x7f, 0x74, 0xf1, 0xab, 0x6c, 0x8f, 0xc7, 0x5f, 0x6f, 0x45, 0xe7,\r\n  0x4a, 0x9c, 0xc8, 0x4f, 0xba, 0xb4, 0xf0, 0x91, 0xe1, 0xb4, 0x34, 0xfc,\r\n  0xa9, 0x59, 0x68, 0x9a, 0x9c, 0x5c, 0xb4, 0xec, 0x30, 0xd7, 0x82, 0xdd,\r\n  0xe1, 0x66, 0x72, 0x75, 0xab, 0xb6, 0xbf, 0x61, 0xb6, 0x19, 0x7d, 0xf4,\r\n  0x83, 0x3c, 0x60, 0xad, 0x21, 0xf2, 0xa3, 0xa3, 0x86, 0xe1, 0x8d, 0x46,\r\n  0x30, 0x3e, 0x99, 0xb5, 0xae, 0xaa, 0x44, 0xc2, 0x0c, 0xd3, 0x60, 0xa0,\r\n  0x4c, 0xe9, 0x40, 0x1c, 0x1d, 0x5f, 0x0c, 0x84, 0x1e, 0x2c, 0xa4, 0x06,\r\n  0x73, 0x5c, 0x78, 0x23, 0xa5, 0x04, 0xeb, 0x8c, 0xb8, 0x63, 0x51, 0xff,\r\n  0x75, 0x94, 0x60, 0xb7, 0xc5, 0x24, 0x7a, 0x31, 0xa7, 0x17, 0xe7, 0xdd,\r\n  0x89, 0x78, 0xc2, 0x61, 0xef, 0x89, 0xf8, 0x1b, 0xe4, 0x0f, 0x4a, 0x35,\r\n  0xa5, 0x05, 0xb2, 0xb9, 0x19, 0x67, 0x71, 0xb6, 0x18, 0xff, 0x2a, 0xf8,\r\n  0x74, 0xf8, 0x8d, 0x56, 0xd6, 0x52, 0x1f, 0x48, 0xc1, 0xfe, 0x20, 0xea,\r\n  0x33, 0xc3, 0x05, 0xff, 0x17, 0x02, 0x55, 0x0b, 0x18, 0xf4, 0x07, 0x6d,\r\n  0x0e, 0xe9, 0xbe, 0xce, 0x7a, 0x9f, 0x16, 0x4e, 0x5a, 0xe3, 0xbd, 0x29,\r\n  0x6c, 0x5e, 0xd2, 0x0f, 0x23, 0x0d, 0x15, 0x0e, 0xe5, 0x1a, 0xac, 0xa0,\r\n  0x6c, 0x99, 0xfa, 0xae, 0xb9, 0x26, 0x4a, 0xa5, 0xdb, 0x97, 0x54, 0x97,\r\n  0xd0, 0x8a, 0x81, 0x46, 0x58, 0xcf, 0x08, 0x3e, 0x85, 0x9e, 0x07, 0xe1,\r\n  0x32, 0x2b, 0xb7, 0xf0, 0x94, 0xf5, 0xaa, 0xaf, 0xc6, 0xe3, 0x83, 0xf3,\r\n  0x93, 0xe6, 0x54, 0xd3, 0x4f, 0x87, 0x6f, 0x8c, 0xee, 0x7e, 0xcb, 0x76,\r\n  0x8a, 0x4f, 0x56, 0xe1, 0x11, 0x20, 0x03, 0x8a, 0xaf, 0x7f, 0xc6, 0xed,\r\n  0x32, 0x0c, 0x6e, 0xf8, 0x2d, 0x9b, 0x7d, 0xec, 0xda, 0xec, 0xa0, 0x51,\r\n  0x57, 0x02, 0x3e, 0xc5, 0x65, 0x14, 0x9a, 0x7f, 0xa6, 0x44, 0x84, 0xa4,\r\n  0xd4, 0xfc, 0x8e, 0x7b, 0x6a, 0x0e, 0xe6, 0xe2, 0xb4, 0xac, 0x86, 0x1c,\r\n  0xd5, 0xe8, 0xc6, 0x8f, 0xc2, 0x4c, 0x51, 0xf4, 0xb7, 0x05, 0x56, 0x02,\r\n  0x46, 0x4e, 0x11, 0x1a, 0x42, 0x05, 0x0d, 0xb0, 0x4c, 0xa9, 0xf5, 0x94,\r\n  0x86, 0x2d, 0x1c, 0x08, 0xdd, 0x37, 0x77, 0x69, 0x72, 0x3f, 0x8a, 0xa2,\r\n  0x63, 0x4f, 0x5b, 0xa2, 0x11, 0xbe, 0xb4, 0xc6, 0x34, 0xcd, 0xbe, 0xcc,\r\n  0xe9, 0x0d, 0xe9, 0x63, 0x43, 0x00, 0xe9, 0xba, 0xcc, 0x00, 0x87, 0x3b,\r\n  0xc3, 0x4e, 0x89, 0x0d, 0xfd, 0xee, 0x01, 0xeb, 0x64, 0xab, 0x2a, 0x72,\r\n  0x47, 0x31, 0x6b, 0xfe, 0x57, 0xdc, 0x8b, 0x35, 0x59, 0x8f, 0xb2, 0x2d,\r\n  0x5d, 0x5e, 0x23, 0x4c, 0xd1, 0xbc, 0x30, 0xae, 0xba, 0xc7, 0xb5, 0x10,\r\n  0xd8, 0x11, 0x3a, 0x43, 0x6f, 0x4e, 0xc7, 0x1e, 0xc8, 0x6f, 0x0e, 0xda,\r\n  0x52, 0x0a, 0x71, 0x93, 0xb9, 0xbb, 0x10, 0xf6, 0xf2, 0x6e, 0x16, 0x7c,\r\n  0xc7, 0xcf, 0xc9, 0x33, 0x26, 0xa1, 0x49, 0xd1, 0x97, 0xd3, 0xa2, 0x96,\r\n  0x96, 0xc1, 0xdf, 0xf8, 0xab, 0x78, 0xf0, 0x24, 0xea, 0xdf, 0x1d, 0x43,\r\n  0x64, 0xf6, 0x94, 0xb0, 0xac, 0x30, 0x8e, 0x35, 0x58, 0x3c, 0xd2, 0x29,\r\n  0xdb, 0xdf, 0xb7, 0xe1, 0xbd, 0x53, 0xe3, 0xb2, 0xee, 0x8c, 0x07, 0x82,\r\n  0xed, 0x78, 0xcb, 0xbc, 0x39, 0xae, 0xa2, 0x9e, 0xec, 0x56, 0x07, 0x61,\r\n  0x55, 0x0c, 0x18, 0x84, 0x2e, 0x29, 0x8d, 0x5d, 0x15, 0x64, 0x05, 0x5e,\r\n  0xcb, 0x3c, 0x9b, 0xbe, 0x52, 0x7d, 0xe4, 0x68, 0xb4, 0x37, 0x59, 0xab,\r\n  0x99, 0x86, 0xf0, 0x8f, 0x26, 0x95, 0x75, 0x47, 0x1a, 0x76, 0x1c, 0x3d,\r\n  0xf9, 0xfe, 0xfb, 0x3a, 0x73, 0xce, 0xd6, 0x3a, 0x98, 0xa0, 0x23, 0xf6,\r\n  0x9b, 0xe5, 0x5d, 0xfb, 0xcb, 0x40, 0x7b, 0xea, 0xa3, 0xe4, 0xc8, 0x0c,\r\n  0xac, 0x11, 0xdc, 0x08, 0xca, 0x28, 0x28, 0x65, 0x4a, 0x15, 0x44, 0x17,\r\n  0xc6, 0x86, 0xdb, 0x42, 0xd0, 0x07, 0x59, 0x07, 0x0e, 0x14, 0x24, 0xb1,\r\n  0x28, 0x84, 0xac, 0x6d, 0xb2, 0x78, 0xae, 0x4a, 0x77, 0x5a, 0x49, 0xf8,\r\n  0xde, 0x67, 0xa3, 0x2e, 0xf6, 0xf1, 0x86, 0x6c, 0x77, 0xa9, 0x57, 0x0a,\r\n  0x0b, 0xc0, 0xce, 0x91, 0x22, 0x90, 0xec, 0x68, 0x09, 0x0a, 0xcc, 0x74,\r\n  0x57, 0x46, 0x37, 0x87, 0x05, 0xc7, 0x0f, 0x31, 0x40, 0x46, 0x11, 0xc9,\r\n  0x9e, 0x41, 0xad, 0x74, 0x1f, 0xdb, 0x08, 0xd7, 0x0a, 0x8f, 0x0f, 0x3a,\r\n  0x52, 0x74, 0xee, 0x41, 0x11, 0x2e, 0x1c, 0x36, 0xea, 0x88, 0x42, 0x2c,\r\n  0x51, 0x51, 0xce, 0x92, 0x19, 0xfd, 0x97, 0x76, 0x7d, 0x11, 0xdd, 0x7a,\r\n  0x2d, 0x24, 0x0f, 0xc7, 0xfd, 0xaa, 0x62, 0x85, 0x19, 0x62, 0xf5, 0x8f,\r\n  0x53, 0x24, 0x72, 0x4f, 0x6c, 0xc1, 0xf7, 0xb8, 0xc5, 0x4c, 0x51, 0xc8,\r\n  0x5d, 0xf0, 0x7a, 0x0b, 0x64, 0xf0, 0xb7, 0xa3, 0x42, 0x36, 0x32, 0xcb,\r\n  0xc0, 0xe0, 0x8c, 0x8b, 0x5a, 0xb8, 0x44, 0xaa, 0xb0, 0xe3, 0xb1, 0x72,\r\n  0x5d, 0x1d, 0x76, 0xcd, 0x4a, 0x07, 0x77, 0x54, 0x2e, 0x1a, 0x57, 0x30,\r\n  0x67, 0xa6, 0xa7, 0xdb, 0x26, 0xd2, 0x7b, 0x21, 0xe6, 0x2d, 0x44, 0x47,\r\n  0xf9, 0xab, 0xe3, 0xcb, 0xe6, 0xd1, 0x42, 0x3a, 0xae, 0xda, 0x3c, 0xc0,\r\n  0x61, 0xd2, 0xbf, 0xcf, 0xdf, 0x5e, 0x6e, 0x79, 0xf2, 0xee, 0x59, 0xde,\r\n  0x70, 0xbe, 0x58, 0xe3, 0x1d, 0x2c, 0x5e, 0x82, 0x7d, 0x54, 0xf0, 0x3c,\r\n  0x10, 0xab, 0xee, 0x4c, 0xdc, 0x93, 0xee, 0xfc, 0x64, 0x67, 0x77, 0x40,\r\n  0x7f, 0xec, 0xc1, 0x7d, 0xf0, 0x64, 0xe7, 0x89, 0xf3, 0xcd, 0xda, 0x53,\r\n  0x2d, 0x59, 0x3b, 0x93, 0x17, 0x51, 0x1c, 0x18, 0x7b, 0xfe, 0xc9, 0xfb,\r\n  0xf7, 0xf8, 0xf1, 0xa0, 0x86, 0x97, 0x2a, 0x92, 0xa1, 0x65, 0xf1, 0xbb,\r\n  0xdc, 0xe6, 0x76, 0x2a, 0xbd, 0x75, 0xdc, 0xcf, 0x38, 0xfc, 0x00, 0xab,\r\n  0x4c, 0x82, 0xed, 0x6c, 0xc5, 0x01, 0x5f, 0x19, 0x2a, 0x3f, 0x74, 0x59,\r\n  0xe3, 0x43, 0x9d, 0x5c, 0xb9, 0x07, 0x42, 0xb5, 0xdf, 0x48, 0x47, 0xe4,\r\n  0xdd, 0xca, 0xfd, 0x65, 0xac, 0x31, 0xdf, 0xf3, 0x9a, 0xac, 0xb6, 0x08,\r\n  0xca, 0x12, 0xc7, 0x42, 0xdb, 0xd3, 0x72, 0xe5, 0xd1, 0x58, 0x40, 0x4a,\r\n  0x14, 0xe9, 0x67, 0x87, 0xd2, 0xd5, 0xc3, 0x48, 0xa3, 0x4f, 0x32, 0x21,\r\n  0x1a, 0x30, 0x51, 0x14, 0xec, 0x95, 0x32, 0x11, 0x75, 0x26, 0xd4, 0x5b,\r\n  0xe8, 0x80, 0x34, 0x97, 0xb9, 0x10, 0x40, 0x48, 0xca, 0xb9, 0x5c, 0xf8,\r\n  0xd2, 0x27, 0xc1, 0x84, 0x79, 0x8c, 0x00, 0xbf, 0xf7, 0x87, 0x0f, 0x66,\r\n  0x5d, 0x7e, 0xe8, 0xf6, 0xf7, 0x91, 0xee, 0x2e, 0xee, 0x8a, 0x9a, 0x5e,\r\n  0xf0, 0x68, 0x36, 0x10, 0x0e, 0xd6, 0x10, 0x96, 0xc1, 0x0b, 0xba, 0xbd,\r\n  0x93, 0xd9, 0xba, 0x68, 0x18, 0x40, 0x45, 0xf1, 0xfb, 0x74, 0xb1, 0x5a,\r\n  0xf8, 0x3c, 0x0e, 0xbc, 0xe7, 0xcb, 0x96, 0x78, 0xce, 0x2e, 0x68, 0xa4,\r\n  0x5d, 0xbc, 0x76, 0x8a, 0x21, 0xd1, 0xf1, 0x05, 0x2a, 0x02, 0x22, 0xe8,\r\n  0xb1, 0x1c, 0x74, 0x96, 0x98, 0xe9, 0x32, 0xb1, 0x75, 0xec, 0xcf, 0x04,\r\n  0x25, 0xc3, 0xb3, 0xda, 0x94, 0x21, 0xd6, 0x13, 0x54, 0xe9, 0x90, 0xf8,\r\n  0xb3, 0x00, 0x50, 0x49, 0x2e, 0x72, 0xbc, 0x94, 0x9a, 0xb8, 0x4f, 0x67,\r\n  0xd5, 0x4d, 0x27, 0x4b, 0xaa, 0x4c, 0x22, 0x86, 0x1d, 0x49, 0x9e, 0x3b,\r\n  0x63, 0x02, 0x31, 0x53, 0x80, 0x08, 0x6d, 0x8b, 0x01, 0xe7, 0x32, 0x3a,\r\n  0x49, 0x83, 0x58, 0x5d, 0x31, 0xab, 0x56, 0x47, 0x3c, 0x43, 0xc1, 0xd3,\r\n  0x23, 0xb7, 0x6f, 0xa5, 0x5c, 0xf5, 0xad, 0x24, 0x2b, 0x7c, 0xa3, 0x6a,\r\n  0xad, 0xd0, 0x8f, 0xe0, 0xe6, 0x11, 0x44, 0x2f, 0x9d, 0xbe, 0xdb, 0x74,\r\n  0xde, 0xae, 0x60, 0xfc, 0x80, 0xa0, 0x4f, 0x7f, 0x81, 0xd7, 0x5f, 0xf7,\r\n  0x35, 0x58, 0xcb, 0xe4, 0x38, 0x89, 0xe2, 0x97, 0x06, 0xca, 0x92, 0xd5,\r\n  0xbf, 0x96, 0x4f, 0x7c, 0xd5, 0x77, 0x44, 0x59, 0x2d, 0xc9, 0xed, 0x41,\r\n  0x4f, 0xe6, 0xe9, 0x2a, 0xf7, 0xa3, 0xbd, 0x9d, 0x9d, 0x6f, 0x48, 0x5e,\r\n  0x48, 0x6d, 0xf7, 0xdd, 0xaf, 0xba, 0x79, 0x64, 0x65, 0x8a, 0x64, 0xa1,\r\n  0x2d, 0x56, 0x16, 0xdf, 0xc1, 0x25, 0xa5, 0x13, 0x87, 0x21, 0x31, 0xd0,\r\n  0x60, 0x55, 0xd8, 0xb9, 0x97, 0xc9, 0x5f, 0xb3, 0x54, 0xf0, 0x56, 0x34,\r\n  0xf3, 0x6d, 0x17, 0xc0, 0xaa, 0xf2, 0xea, 0xdd, 0xd0, 0xdf, 0x12, 0x9f,\r\n  0xae, 0x24, 0x1f, 0xe9, 0xc8, 0x66, 0xa5, 0x4b, 0x94, 0x99, 0x8c, 0x56,\r\n  0x45, 0x59, 0x69, 0x7d, 0x21, 0x10, 0x81, 0xc0, 0x85, 0x62, 0xce, 0xdf,\r\n  0x2c, 0x0f, 0x4a, 0x9b, 0x7b, 0xba, 0x83, 0x02, 0x15, 0xc4, 0xda, 0x07,\r\n  0x10, 0x50, 0x57, 0x5c, 0x58, 0xae, 0x66, 0xfb, 0xdf, 0xf8, 0x7a, 0x47,\r\n  0x17, 0xe4, 0xa4, 0xb8, 0xd8, 0x88, 0x80, 0xfe, 0xbd, 0xf2, 0xd1, 0x1c,\r\n  0x2c, 0xab, 0x22, 0x4a, 0x67, 0xcf, 0xfa, 0x2a, 0x3c, 0x1e, 0x18, 0x23,\r\n  0xd3, 0x36, 0x2e, 0xb5, 0x50, 0x0e, 0x77, 0x44, 0xda, 0x85, 0x77, 0x66,\r\n  0xce, 0x0f, 0xcc, 0x59, 0xf9, 0xce, 0x5b, 0x18, 0xda, 0xf9, 0x12, 0x6e,\r\n  0x1f, 0x27, 0x59, 0x83, 0x2e, 0x71, 0xaa, 0xd7, 0x14, 0xcc, 0xb1, 0x8c,\r\n  0x26, 0xfe, 0x1d, 0x2d, 0x55, 0x70, 0x1c, 0x49, 0x4a, 0xf5, 0x0b, 0xda,\r\n  0xbe, 0x9f, 0xff, 0x30, 0xa4, 0x3f, 0x7f, 0xea, 0xa8, 0xaa, 0x17, 0x07,\r\n  0x91, 0x56, 0x43, 0xae, 0x17, 0x9e, 0xd0, 0x1d, 0xed, 0x48, 0x6a, 0x97,\r\n  0xfc, 0xb6, 0x0c, 0xa8, 0xf0, 0xbb, 0x08, 0x55, 0x9c, 0xb3, 0x6d, 0xb3,\r\n  0xe4, 0xfa, 0x06, 0x3e, 0x2a, 0x26, 0x8d, 0xb8, 0x56, 0x10, 0x4d, 0xce,\r\n  0x44, 0xc0, 0x48, 0x91, 0xab, 0x66, 0x34, 0x85, 0x91, 0x34, 0xd3, 0xc4,\r\n  0xe3, 0x0d, 0x7c, 0x69, 0xd2, 0x09, 0x03, 0x28, 0xca, 0x07, 0xa6, 0x88,\r\n  0x10, 0x1f, 0x63, 0x99, 0x3b, 0x92, 0x2c, 0x4c, 0x20, 0xba, 0xdf, 0x86,\r\n  0x68, 0x30, 0x8b, 0x81, 0xc0, 0xda, 0xaa, 0x9c, 0xb4, 0xf5, 0xb8, 0x28,\r\n  0x48, 0xef, 0xd0, 0xa5, 0xd6, 0xc4, 0x05, 0xea, 0x3c, 0x49, 0x0f, 0xdc,\r\n  0x55, 0xde, 0x6d, 0x48, 0x6d, 0xaf, 0x96, 0x1d, 0x98, 0x0a, 0xce, 0x60,\r\n  0x6a, 0xd1, 0xc6, 0xd4, 0xd2, 0x03, 0x4d, 0x97, 0x36, 0xdd, 0xe9, 0x31,\r\n  0x75, 0x3e, 0x3a, 0x85, 0x33, 0x9d, 0xf5, 0xff, 0xe0, 0x4d, 0x4d, 0xac,\r\n  0x14, 0x22, 0x68, 0x28, 0x4a, 0xe6, 0x9a, 0xec, 0xce, 0x48, 0x8b, 0xfe,\r\n  0xe2, 0x89, 0x90, 0x84, 0x40, 0x1f, 0x3a, 0x62, 0x60, 0x17, 0xa0, 0x3c,\r\n  0x39, 0xa7, 0x6d, 0x79, 0xfd, 0x32, 0x1f, 0x75, 0xc9, 0x7f, 0x7e, 0x26,\r\n  0x2f, 0x5c, 0xe9, 0xb0, 0x94, 0x33, 0x1c, 0x67, 0xab, 0x29, 0xac, 0x33,\r\n  0x46, 0x8f, 0x70, 0x25, 0xb0, 0x89, 0xf0, 0xb2, 0x58, 0x92, 0x20, 0x37,\r\n  0xed, 0x94, 0xbb, 0x36, 0x92, 0x5e, 0xd4, 0x57, 0x3c, 0xe5, 0x88, 0xf4,\r\n  0x70, 0x6b, 0x80, 0x58, 0x13, 0x0a, 0x04, 0x6e, 0x84, 0xb6, 0x72, 0x9d,\r\n  0x5d, 0xad, 0x21, 0x22, 0x95, 0x10, 0x05, 0xeb, 0xb6, 0xef, 0x2b, 0x17,\r\n  0x22, 0x8c, 0xa5, 0x6e, 0x1c, 0xd4, 0xae, 0x2f, 0x19, 0xf9, 0xd5, 0x68,\r\n  0x30, 0xa4, 0xd7, 0x44, 0xf5, 0x3c, 0xd6, 0x36, 0x1f, 0xf5, 0x32, 0xbf,\r\n  0xd6, 0xeb, 0x54, 0xbd, 0xca, 0x69, 0x66, 0x35, 0xd9, 0x75, 0x62, 0x81,\r\n  0x44, 0x77, 0x55, 0x10, 0xef, 0x6f, 0xf2, 0x79, 0xa8, 0x47, 0xb4, 0xe3,\r\n  0xa7, 0x24, 0x73, 0x82, 0xc4, 0x19, 0xbd, 0x5e, 0x59, 0x03, 0xd5, 0x42,\r\n  0x85, 0xa9, 0x51, 0x64, 0x4f, 0x50, 0x5c, 0xf7, 0xef, 0xf9, 0x44, 0x8d,\r\n  0x15, 0x2e, 0x56, 0x7f, 0xdd, 0x45, 0x56, 0x23, 0xc1, 0xba, 0x1b, 0xae,\r\n  0x97, 0x44, 0x0a, 0xcf, 0x4a, 0x82, 0xdd, 0xcc, 0xbe, 0x42, 0x86, 0x53,\r\n  0xc5, 0x12, 0x07, 0xf0, 0x44, 0x18, 0x9b, 0xd1, 0x35, 0xd2, 0x73, 0x00,\r\n  0x37, 0x8b, 0x3a, 0x6a, 0xbb, 0x04, 0x95, 0x04, 0xf4, 0x14, 0x60, 0x72,\r\n  0x38, 0xb6, 0xba, 0x46, 0x17, 0xff, 0x0d, 0x25, 0xd7, 0x82, 0xa9, 0x5b,\r\n  0x51, 0xba, 0xf0, 0x85, 0xc2, 0x2a, 0xdb, 0x8e, 0xc9, 0xd7, 0xec, 0x16,\r\n  0x19, 0xbb, 0xc0, 0xba, 0xb2, 0xeb, 0xe8, 0xe3, 0xa3, 0xa0, 0x7e, 0xb0,\r\n  0xcf, 0x1d, 0x0b, 0x22, 0xe9, 0x5d, 0xa0, 0xd8, 0xe6, 0x86, 0x73, 0xe4,\r\n  0x07, 0x9b, 0xe2, 0x57, 0xab, 0x1e, 0xb6, 0x14, 0xef, 0x2a, 0x44, 0xa8,\r\n  0x15, 0x54, 0x64, 0x92, 0x14, 0x6d, 0x39, 0x83, 0x04, 0x9f, 0x52, 0x13,\r\n  0xff, 0xb8, 0xf4, 0xe2, 0x83, 0xda, 0xd8, 0x1a, 0xf3, 0xb1, 0xda, 0x58,\r\n  0xcd, 0x51, 0x85, 0x89, 0xf9, 0xcf, 0x42, 0xd7, 0xb8, 0xce, 0x09, 0x96,\r\n  0xff, 0x57, 0xce, 0x89, 0x3f, 0xfd, 0x72, 0xad, 0x72, 0x83, 0xbe, 0xa4,\r\n  0x7b, 0x3b, 0xc3, 0xaf, 0x34, 0x56, 0xc9, 0xc7, 0xbb, 0xb9, 0xd3, 0xec,\r\n  0xe6, 0x7b, 0xd4, 0x9c, 0x00, 0x7e, 0xf7, 0x05, 0x94, 0x98, 0xcf, 0x1f,\r\n  0x05, 0x66, 0x98, 0x92, 0x2a, 0x88, 0xdf, 0x4d, 0xd3, 0xe5, 0xb6, 0x3c,\r\n  0x7b, 0xa5, 0x64, 0x89, 0x0b, 0xb5, 0x01, 0xdb, 0x48, 0xeb, 0x80, 0x19,\r\n  0xde, 0x7e, 0x4f, 0xeb, 0x28, 0x72, 0x6c, 0x4b, 0x24, 0xbd, 0x0c, 0xea,\r\n  0x79, 0xcd, 0xeb, 0xea, 0xc7, 0x01, 0xf1, 0x09, 0x25, 0x20, 0x84, 0xf7,\r\n  0x83, 0x82, 0x18, 0x5e, 0x86, 0xe4, 0x3d, 0x60, 0x12, 0x64, 0x7d, 0x7c,\r\n  0xf2, 0xa4, 0x0d, 0x02, 0x39, 0xbb, 0x3c, 0xde, 0x57, 0x75, 0xcc, 0x43,\r\n  0x99, 0xcd, 0xf6, 0x14, 0x50, 0x01, 0xa7, 0x1f, 0x71, 0x3a, 0x2e, 0x73,\r\n  0x75, 0x05, 0xa3, 0x1b, 0x74, 0x10, 0x95, 0x00, 0x73, 0xcf, 0x79, 0x36,\r\n  0xe2, 0x82, 0xaa, 0x5a, 0x01, 0x18, 0x0b, 0xb9, 0x58, 0x75, 0x30, 0x37,\r\n  0x1f, 0x18, 0x66, 0x0b, 0xf1, 0x05, 0x26, 0x6b, 0xd0, 0xbf, 0x31, 0x6f,\r\n  0x84, 0xec, 0xd0, 0xd6, 0x64, 0xc9, 0x0e, 0x81, 0xbe, 0x62, 0x3c, 0xbf,\r\n  0x39, 0xe9, 0x45, 0x45, 0x2b, 0x7a, 0x04, 0x8a, 0x50, 0xf6, 0xb4, 0xf1,\r\n  0x64, 0x41, 0xd6, 0x7a, 0x04, 0x65, 0x73, 0xf3, 0x16, 0xd3, 0x65, 0xf5,\r\n  0x2f, 0xdd, 0xbc, 0xee, 0x52, 0xfb, 0xb8, 0x10, 0xa5, 0x81, 0x6c, 0x3a,\r\n  0x38, 0xb3, 0xe8, 0x2e, 0x4b, 0x97, 0xcc, 0x51, 0x57, 0xfe, 0xe2, 0xc3,\r\n  0xa0, 0x0e, 0x0c, 0x68, 0x60, 0x1d, 0xba, 0x97, 0x6d, 0x7f, 0x9f, 0x31,\r\n  0xe8, 0x2e, 0x4f, 0xd6, 0x19, 0x9c, 0xf1, 0x2e, 0xc8, 0x4f, 0x2e, 0x6c,\r\n  0xac, 0x89, 0x5e, 0xa4, 0x23, 0xb4, 0x72, 0x68, 0x9d, 0xdb, 0x4e, 0x85,\r\n  0xef, 0x60, 0x2d, 0x25, 0x11, 0x62, 0x52, 0x49, 0x9d, 0x79, 0xbb, 0x5d,\r\n  0xaa, 0xc1, 0xb9, 0x38, 0x5c, 0x87, 0x4a, 0x46, 0x98, 0x46, 0xf1, 0x84,\r\n  0x0c, 0xaf, 0xd9, 0x6a, 0xd1, 0x1b, 0x45, 0x5f, 0x3a, 0x98, 0xaa, 0x9c,\r\n  0x2d, 0x75, 0xfd, 0xb4, 0x2d, 0x2e, 0x24, 0xe2, 0xd1, 0x67, 0x9f, 0xed,\r\n  0xd4, 0xda, 0x1b, 0x61, 0x16, 0xc2, 0x6e, 0x32, 0x3e, 0x6b, 0xd7, 0xc1,\r\n  0xb1, 0x58, 0x61, 0x86, 0xcd, 0xdb, 0x84, 0xcc, 0xb3, 0x94, 0xff, 0x3d,\r\n  0xaf, 0xa0, 0xa4, 0x8a, 0xf9, 0xa2, 0xfc, 0x40, 0xc0, 0xbb, 0x0a, 0xd9,\r\n  0x63, 0xc4, 0x4b, 0x8e, 0xa2, 0xbd, 0x52, 0x29, 0x80, 0x61, 0x73, 0x6a,\r\n  0x91, 0x71, 0x76, 0x75, 0xd4, 0x72, 0xbe, 0xbe, 0xd6, 0xaf, 0x18, 0x4c,\r\n  0x68, 0x13, 0xe7, 0xc9, 0xe5, 0x89, 0x3c, 0x11, 0x2e, 0xf0, 0x68, 0x93,\r\n  0x39, 0xd9, 0x9e, 0x7d, 0xf6, 0xec, 0xe9, 0x56, 0x3d, 0x2e, 0xb6, 0xd5,\r\n  0xe1, 0x7c, 0xc5, 0xac, 0x05, 0x45, 0x73, 0x17, 0x29, 0x68, 0xeb, 0xe1,\r\n  0xcc, 0x56, 0x2f, 0xae, 0xb0, 0x7f, 0x43, 0x7d, 0x85, 0x11, 0x96, 0x4a,\r\n  0x90, 0xa7, 0x0d, 0x49, 0x44, 0x1d, 0x01, 0x79, 0x7d, 0xd3, 0x72, 0xfd,\r\n  0x9c, 0x78, 0x71, 0xb9, 0x40, 0x02, 0x3a, 0x83, 0x20, 0x71, 0x20, 0x46,\r\n  0x06, 0x65, 0x56, 0x5d, 0x5e, 0x0e, 0xe8, 0x15, 0x5a, 0x4e, 0x02, 0x60,\r\n  0x15, 0x06, 0x32, 0xe6, 0x81, 0xd4, 0x12, 0x46, 0x18, 0xd9, 0x4b, 0x26,\r\n  0x17, 0xa3, 0x2e, 0x0c, 0x21, 0x9d, 0x5d, 0x57, 0xf2, 0xc6, 0x4f, 0xa4,\r\n  0x00, 0x61, 0x90, 0x56, 0xcf, 0xeb, 0x6f, 0x2d, 0x68, 0x1c, 0xcd, 0x57,\r\n  0x70, 0x68, 0x19, 0xa8, 0x8b, 0x64, 0x61, 0x0c, 0x6b, 0x72, 0x05, 0xe4,\r\n  0x85, 0xe7, 0xc1, 0x16, 0x13, 0x48, 0xa4, 0x39, 0x82, 0xf2, 0xeb, 0x78,\r\n  0xa8, 0x7d, 0x11, 0x35, 0xcd, 0x20, 0xab, 0x75, 0x6c, 0x0d, 0xeb, 0xad,\r\n  0xdb, 0x6c, 0x61, 0x6a, 0x87, 0xba, 0x21, 0x81, 0xd1, 0xb0, 0xbf, 0xbb,\r\n  0x4d, 0xd9, 0xe6, 0x82, 0x96, 0x8f, 0x36, 0xa6, 0x61, 0x4d, 0xe7, 0x85,\r\n  0x0e, 0x1a, 0x39, 0x39, 0xeb, 0x6a, 0x22, 0x46, 0x9b, 0xe8, 0xef, 0xf6,\r\n  0xf6, 0xd6, 0x07, 0xfb, 0xac, 0x0f, 0x7e, 0xa8, 0x8f, 0xe7, 0x52, 0x33,\r\n  0x8e, 0x27, 0xd7, 0xd2, 0x38, 0x69, 0xdf, 0xf9, 0x4e, 0xf0, 0x47, 0xd3,\r\n  0xd2, 0x0a, 0xd3, 0x4a, 0x9c, 0xde, 0xc1, 0x9c, 0xee, 0x5b, 0xd9, 0xd6,\r\n  0x6e, 0x9e, 0x65, 0x74, 0xf5, 0x81, 0xeb, 0x55, 0x21, 0x89, 0x42, 0x2a,\r\n  0x13, 0x0c, 0xfe, 0x38, 0x62, 0x0e, 0x95, 0x56, 0x49, 0x83, 0xa0, 0x57,\r\n  0x38, 0x0e, 0xc1, 0xf8, 0x04, 0x53, 0xe1, 0x83, 0x0a, 0x72, 0x2c, 0x4c,\r\n  0xa3, 0x94, 0xe0, 0x43, 0x5b, 0x14, 0xdb, 0xd3, 0x8d, 0x1a, 0x17, 0xa3,\r\n  0x56, 0xa2, 0xbc, 0x3c, 0xc8, 0x87, 0xc7, 0x65, 0x29, 0xa7, 0x5d, 0x85,\r\n  0x94, 0xbd, 0xef, 0x58, 0xdb, 0x24, 0xab, 0xeb, 0xd6, 0x8f, 0x5b, 0xa8,\r\n  0x2e, 0xac, 0x66, 0x86, 0x4f, 0xd7, 0xea, 0x82, 0x1a, 0x6b, 0xdf, 0xdc,\r\n  0xee, 0xc6, 0x9c, 0x59, 0x09, 0x07, 0xfc, 0xb4, 0x36, 0x9d, 0x03, 0x39,\r\n  0xa4, 0xc0, 0x8e, 0x75, 0x69, 0x4c, 0x20, 0x14, 0x7d, 0xf4, 0x5a, 0xfc,\r\n  0x74, 0xb4, 0x03, 0xe4, 0x5a, 0xbb, 0xcc, 0xe3, 0x3c, 0x9d, 0xb8, 0x89,\r\n  0xd6, 0x48, 0xf0, 0x28, 0xb8, 0x41, 0x33, 0x29, 0x6b, 0x5e, 0x15, 0xd3,\r\n  0x96, 0x2d, 0x76, 0xeb, 0xf3, 0xd9, 0x4b, 0x29, 0xfd, 0xc8, 0x93, 0x34,\r\n  0xc2, 0xc3, 0xf4, 0xf9, 0x77, 0xfa, 0x97, 0xdc, 0x81, 0xfb, 0xb6, 0xc2,\r\n  0x43, 0xd1, 0x01, 0xe2, 0xea, 0x97, 0x0e, 0x75, 0xa6, 0x01, 0x4a, 0x16,\r\n  0x92, 0x20, 0xe6, 0xd1, 0x54, 0xfb, 0x5a, 0x35, 0x76, 0xc7, 0x03, 0xf9,\r\n  0xb0, 0xec, 0xa8, 0x3f, 0x8f, 0x2c, 0x23, 0xec, 0x11, 0x6e, 0x04, 0x59,\r\n  0x70, 0x02, 0x67, 0xf4, 0x81, 0x2b, 0x57, 0xb4, 0x34, 0x4c, 0x22, 0x95,\r\n  0x4a, 0x06, 0x1d, 0xbd, 0x6b, 0x58, 0x27, 0x12, 0xad, 0xc1, 0x18, 0x37,\r\n  0xe9, 0x56, 0x60, 0x69, 0x5e, 0x2d, 0x37, 0x77, 0xb7, 0x84, 0x2e, 0x4c,\r\n  0x29, 0x9d, 0xd7, 0xe4, 0x10, 0xc8, 0x55, 0xe3, 0x6a, 0x9a, 0x1e, 0xfa,\r\n  0xc8, 0x01, 0x0b, 0x3e, 0x70, 0x39, 0x02, 0x18, 0x75, 0x25, 0xe7, 0x41,\r\n  0x76, 0x87, 0x06, 0x66, 0xd9, 0xed, 0xdb, 0xb1, 0x39, 0x25, 0x77, 0x7d,\r\n  0xc9, 0xe8, 0xbd, 0x52, 0x6a, 0x6b, 0x6c, 0x7a, 0xe2, 0x50, 0xb9, 0x1e,\r\n  0xac, 0xe2, 0x14, 0xcd, 0xde, 0x7c, 0x36, 0x04, 0xd1, 0xc7, 0x75, 0x91,\r\n  0xb7, 0x29, 0x84, 0x18, 0x7a, 0xad, 0x37, 0x88, 0xe8, 0xd0, 0x9d, 0x45,\r\n  0xbe, 0x7a, 0x0c, 0x34, 0xed, 0x85, 0xc5, 0xf3, 0x0c, 0xce, 0xda, 0x74,\r\n  0xc5, 0xd5, 0x96, 0xb4, 0xb5, 0x4d, 0x0f, 0xa2, 0x9f, 0x57, 0x29, 0x6d,\r\n  0x6b, 0x5e, 0x5b, 0xe0, 0x05, 0x80, 0x5a, 0x4c, 0x5c, 0x10, 0x88, 0xa4,\r\n  0x07, 0xc7, 0xb9, 0xc4, 0x74, 0x64, 0x17, 0x10, 0xa0, 0xf0, 0xb6, 0xcb,\r\n  0x3a, 0xaa, 0x99, 0xb1, 0xb1, 0xed, 0x14, 0x02, 0xb0, 0x87, 0xe5, 0xea,\r\n  0x8b, 0x47, 0x24, 0x5d, 0x62, 0x7b, 0xb3, 0x9c, 0xa1, 0x67, 0x2c, 0xda,\r\n  0x65, 0x17, 0xac, 0xe3, 0xb4, 0xee, 0x2f, 0x1e, 0xf8, 0x22, 0xeb, 0xd7,\r\n  0xb6, 0x5e, 0xd4, 0x2f, 0x93, 0x29, 0x59, 0x23, 0x7d, 0x9b, 0x5f, 0x44,\r\n  0xc7, 0x1f, 0xe1, 0xc7, 0x5f, 0xf7, 0x69, 0xd9, 0xda, 0xf2, 0x09, 0xdf,\r\n  0xba, 0x34, 0xee, 0x8f, 0xe0, 0x9b, 0x81, 0x20, 0xb9, 0x26, 0x2b, 0x0e,\r\n  0x38, 0x76, 0xd6, 0xb2, 0xd6, 0xc0, 0x8a, 0x3c, 0xa1, 0xd5, 0x37, 0x80,\r\n  0xb2, 0x12, 0x04, 0x65, 0xc9, 0xd9, 0x00, 0x8b, 0xb0, 0x86, 0x0d, 0xca,\r\n  0x66, 0x95, 0x6d, 0xa5, 0x6e, 0x25, 0xa5, 0x34, 0x07, 0xf5, 0xf4, 0xff,\r\n  0x06, 0x18, 0x40, 0x3e, 0xc3, 0x31, 0xc8, 0xb0, 0xf9, 0xae, 0x90, 0x0f,\r\n  0x5e, 0x47, 0xa0, 0x02, 0x5e, 0x6e, 0x31, 0x93, 0xe4, 0xe6, 0x51, 0x6f,\r\n  0x9a, 0x36, 0xe1, 0xf8, 0x40, 0x69, 0x3e, 0xa6, 0x37, 0xab, 0xec, 0x96,\r\n  0xba, 0xd0, 0x0e, 0xe4, 0x9b, 0x5f, 0x30, 0xe5, 0xb3, 0x4d, 0x1b, 0x44,\r\n  0x59, 0x23, 0x2c, 0xa7, 0x4f, 0x5a, 0xe0, 0x04, 0xff, 0x3b, 0xa8, 0x25,\r\n  0x2d, 0x86, 0xe5, 0xae, 0xde, 0xf9, 0x3a, 0xec, 0x71, 0xe5, 0x27, 0xf0,\r\n  0xb1, 0xc4, 0x82, 0x80, 0x7e, 0x36, 0x4b, 0xae, 0x11, 0x99, 0x57, 0x7d,\r\n  0x54, 0xd2, 0x1b, 0x2c, 0x17, 0x17, 0x86, 0x82, 0x55, 0x66, 0x68, 0x1d,\r\n  0xd9, 0x55, 0x29, 0x25, 0x21, 0x74, 0x59, 0x51, 0xff, 0x3c, 0x60, 0x59,\r\n  0xe9, 0xe8, 0x89, 0xca, 0xe1, 0x61, 0x07, 0xe8, 0xfe, 0xb2, 0xc9, 0x3f,\r\n  0xea, 0x37, 0xa3, 0xbd, 0x36, 0xa8, 0xb1, 0x6b, 0x09, 0x63, 0x8b, 0x40,\r\n  0xe2, 0x3a, 0xd2, 0x7e, 0x98, 0xa3, 0x77, 0x93, 0x6c, 0x8c, 0x7c, 0xbe,\r\n  0x12, 0x56, 0x7c, 0xf6, 0xa0, 0x30, 0x3c, 0x72, 0xcb, 0x4e, 0x93, 0x9c,\r\n  0xbf, 0xa0, 0xd4, 0xb1, 0x08, 0xb1, 0x4e, 0xce, 0x23, 0x89, 0x6d, 0x05,\r\n  0x45, 0x2a, 0x84, 0xd9, 0xc6, 0xac, 0x3d, 0x36, 0x02, 0x82, 0xe6, 0x96,\r\n  0x40, 0x88, 0xdf, 0xe5, 0x26, 0x66, 0x5b, 0xee, 0x06, 0x33, 0x26, 0xc2,\r\n  0xf9, 0x30, 0x68, 0x25, 0x54, 0x03, 0xcf, 0x38, 0x1f, 0x72, 0xe8, 0xc0,\r\n  0xe0, 0xe0, 0x8f, 0x3d, 0x1a, 0xfa, 0xab, 0x5f, 0x9b, 0xbb, 0x21, 0xff,\r\n  0x78, 0xe7, 0x5c, 0xfb, 0x1a, 0x83, 0x08, 0xb2, 0xaa, 0xda, 0xaf, 0x5d,\r\n  0x53, 0x6d, 0xfd, 0x01, 0xbd, 0x5a, 0xac, 0x38, 0x71, 0xac, 0x85, 0x2e,\r\n  0xa2, 0x55, 0x99, 0xaf, 0x84, 0xbc, 0x90, 0xe3, 0x3c, 0x5e, 0x45, 0x8f,\r\n  0x27, 0xbc, 0x38, 0x93, 0x07, 0x37, 0x4e, 0x4b, 0xc7, 0xe0, 0x7b, 0xc1,\r\n  0x01, 0xef, 0xda, 0xdb, 0x63, 0x4d, 0x5d, 0xec, 0x6f, 0x55, 0xb6, 0xb6,\r\n  0xb6, 0x85, 0x24, 0x97, 0x7b, 0xa3, 0x4a, 0x42, 0x62, 0x3c, 0x65, 0x26,\r\n  0x64, 0x57, 0x1d, 0x0e, 0x36, 0xd7, 0x19, 0x53, 0xd7, 0x39, 0x72, 0x1b,\r\n  0x5b, 0xad, 0x42, 0x71, 0x5b, 0xca, 0xeb, 0x86, 0xf4, 0xcc, 0xeb, 0xc0,\r\n  0xe2, 0xcc, 0xb0, 0x63, 0x6b, 0xf8, 0xe1, 0x8e, 0xb5, 0xa2, 0x50, 0x54,\r\n  0x03, 0x9a, 0xb5, 0x2e, 0x61, 0xbe, 0xa0, 0x6a, 0x4f, 0xb4, 0x8c, 0x0a,\r\n  0x30, 0x14, 0x71, 0xd0, 0x9e, 0x16, 0x89, 0x74, 0x40, 0xe1, 0xfe, 0x7a,\r\n  0x9d, 0x4e, 0x8b, 0xbc, 0xcc, 0xaf, 0xc4, 0xc7, 0xe4, 0xf9, 0x4c, 0x15,\r\n  0x5d, 0xc4, 0x64, 0x43, 0x31, 0xa7, 0x06, 0xb4, 0xf5, 0x0a, 0xb5, 0x99,\r\n  0x79, 0xad, 0x84, 0xb4, 0xa1, 0x48, 0x17, 0x2a, 0x91, 0x38, 0x46, 0x57,\r\n  0x09, 0x51, 0x4c, 0x1c, 0x99, 0x8d, 0x08, 0x7d, 0xc0, 0xb0, 0x88, 0xcf,\r\n  0x1e, 0x87, 0xaf, 0xf0, 0x52, 0xb0, 0xa3, 0x7f, 0x92, 0xb8, 0xa8, 0xda,\r\n  0x4c, 0x2b, 0x35, 0x6a, 0x95, 0x23, 0x71, 0x5e, 0xda, 0x6b, 0xdd, 0xbd,\r\n  0x33, 0xd4, 0x00, 0x08, 0xca, 0x11, 0xce, 0x0b, 0xcb, 0xf1, 0x32, 0xc2,\r\n  0xee, 0xe4, 0xf8, 0xf2, 0x55, 0x34, 0x2b, 0xc8, 0xd0, 0x93, 0x3f, 0x87,\r\n  0xa4, 0xca, 0xfe, 0x23, 0x6e, 0x71, 0x02, 0x95, 0x4b, 0x5e, 0xa4, 0x21,\r\n  0x9b, 0x44, 0xc3, 0x9d, 0xa7, 0xa3, 0xea, 0x7d, 0x27, 0x04, 0x2f, 0x84,\r\n  0xab, 0x69, 0xa9, 0x35, 0xbf, 0x5c, 0x4a, 0x98, 0x52, 0x00, 0x8c, 0xfa,\r\n  0xfe, 0xa1, 0x39, 0xe2, 0x41, 0x17, 0x27, 0xb0, 0x88, 0x45, 0x3c, 0xef,\r\n  0x77, 0xc9, 0xc7, 0xe2, 0x19, 0x3b, 0xe1, 0x8c, 0x82, 0x60, 0xac, 0x63,\r\n  0x14, 0xdb, 0xe5, 0xe3, 0x1e, 0x47, 0x2c, 0x1a, 0x42, 0x11, 0x13, 0x08,\r\n  0x0b, 0x45, 0xc6, 0xa5, 0xbf, 0xea, 0x28, 0x39, 0x08, 0x20, 0x58, 0x6d,\r\n  0x6f, 0xae, 0x41, 0xcf, 0xac, 0xda, 0x95, 0x00, 0x78, 0x52, 0x81, 0x4a,\r\n  0xc5, 0x3e, 0x30, 0x49, 0x1d, 0x93, 0xa6, 0x7f, 0x4b, 0x7d, 0x5a, 0x19,\r\n  0xc1, 0xcc, 0xda, 0xb2, 0x98, 0xa0, 0xe1, 0x34, 0x7a, 0xd0, 0xc6, 0x2e,\r\n  0x83, 0xdb, 0xd4, 0x95, 0xcc, 0x64, 0x27, 0x98, 0xc6, 0xde, 0x9b, 0xb1,\r\n  0xbf, 0xfe, 0x90, 0x04, 0xf6, 0x7e, 0x5f, 0xf6, 0x79, 0x92, 0x71, 0xa9,\r\n  0x35, 0xd9, 0xdd, 0x90, 0xa7, 0x4e, 0x65, 0xaa, 0xeb, 0x46, 0x2e, 0xab,\r\n  0x7c, 0xb8, 0xea, 0xee, 0x1d, 0xc9, 0x42, 0xd6, 0x63, 0x25, 0x8f, 0x56,\r\n  0xab, 0xd2, 0xfe, 0x4b, 0x28, 0xd2, 0x42, 0xe1, 0x13, 0xe0, 0xe2, 0x1f,\r\n  0x53, 0xa8, 0x54, 0x9c, 0x7b, 0x0c, 0xbd, 0x46, 0x1b, 0x4a, 0x83, 0xc3,\r\n  0x5d, 0x1e, 0x9e, 0x07, 0x31, 0xca, 0x41, 0xdb, 0xbf, 0xe4, 0x93, 0xc8,\r\n  0x35, 0xaf, 0x27, 0x73, 0xad, 0x2f, 0xfe, 0x85, 0x4a, 0x86, 0x1f, 0x41,\r\n  0xa0, 0x67, 0xb8, 0x1f, 0x36, 0xa6, 0x46, 0x69, 0x13, 0xd2, 0x59, 0x77,\r\n  0xf6, 0xbf, 0xce, 0x90, 0xb1, 0x61, 0xeb, 0x1c, 0x71, 0xa2, 0xbe, 0x71,\r\n  0x53, 0x9c, 0x1c, 0x51, 0x6f, 0x58, 0xe5, 0x65, 0x5b, 0xdf, 0xfb, 0x27,\r\n  0xdb, 0xaa, 0xba, 0xf7, 0x55, 0xe3, 0x8a, 0x44, 0xe1, 0x46, 0x8f, 0x86,\r\n  0xe2, 0x36, 0x92, 0x90, 0xb1, 0x4d, 0xab, 0x9c, 0x29, 0x2d, 0x4a, 0x37,\r\n  0x6f, 0x1d, 0x7b, 0xe1, 0x0b, 0x38, 0xa4, 0xc9, 0xf4, 0x58, 0x71, 0xb0,\r\n  0x7b, 0xf2, 0x60, 0x8c, 0x01, 0xca, 0xb5, 0x58, 0x24, 0xdc, 0xe7, 0x7a,\r\n  0x87, 0xcb, 0x0e, 0x51, 0x84, 0x0c, 0x94, 0x64, 0xa1, 0xa9, 0xa4, 0x93,\r\n  0x22, 0xbf, 0xa5, 0xd3, 0xca, 0xaf, 0xc1, 0x42, 0xe1, 0xd9, 0x97, 0xdb,\r\n  0xc0, 0xac, 0x78, 0xba, 0xbb, 0x85, 0xab, 0xaa, 0x83, 0x9b, 0xce, 0x48,\r\n  0xa7, 0x2d, 0x00, 0xeb, 0xd5, 0x4e, 0x21, 0x06, 0x45, 0xca, 0xa0, 0x89,\r\n  0x4b, 0xf8, 0xc2, 0xb9, 0x02, 0xa2, 0x07, 0x23, 0xb5, 0x1c, 0x08, 0x46,\r\n  0xe8, 0xfa, 0xaf, 0xdb, 0x43, 0x6e, 0x5b, 0x84, 0x7b, 0xa8, 0x63, 0xc9,\r\n  0x6b, 0x9b, 0x49, 0xc4, 0xfe, 0x0b, 0xda, 0x55, 0x22, 0xd0, 0xd9, 0x09,\r\n  0xda, 0xf4, 0xc2, 0x83, 0x17, 0x79, 0x18, 0xe4, 0xb8, 0x2b, 0xec, 0xf7,\r\n  0x4a, 0x83, 0xe6, 0x12, 0x63, 0x9e, 0x79, 0x32, 0xf7, 0x58, 0x6e, 0x13,\r\n  0x78, 0x34, 0xda, 0x0a, 0x1d, 0xab, 0xbf, 0x4e, 0x3d, 0x12, 0x13, 0x16,\r\n  0x72, 0x82, 0x97, 0x07, 0xbc, 0x20, 0xc8, 0x4a, 0xd3, 0xe8, 0xc6, 0x9f,\r\n  0xc3, 0x8c, 0x6a, 0xf9, 0x52, 0xcb, 0x78, 0x13, 0x82, 0x53, 0x17, 0xc4,\r\n  0x17, 0xb8, 0x9c, 0xcb, 0x18, 0x62, 0x5a, 0xbc, 0x50, 0x66, 0xa0, 0x6b,\r\n  0xa3, 0xe8, 0x98, 0x23, 0xf2, 0x1d, 0x16, 0xa5, 0xe5, 0x97, 0x60, 0x8c,\r\n  0xa9, 0xf2, 0x4d, 0x49, 0xa2, 0xb6, 0xda, 0xe7, 0xcc, 0xe6, 0xb3, 0xb0,\r\n  0x34, 0x79, 0x8e, 0xcd, 0xbb, 0xb2, 0x5f, 0x9d, 0xd6, 0x75, 0x59, 0x09,\r\n  0x03, 0x4e, 0x64, 0x6c, 0xc6, 0xf6, 0x23, 0xc7, 0x6d, 0xfa, 0xca, 0x63,\r\n  0x2a, 0x07, 0xe2, 0xad, 0x13, 0xc3, 0xb7, 0x43, 0x55, 0x47, 0x6f, 0x22,\r\n  0xff, 0xd0, 0x20, 0xf8, 0xfb, 0xfe, 0x67, 0x3b, 0x56, 0xd4, 0x97, 0xdd,\r\n  0xa3, 0xe1, 0x33, 0x60, 0x9d, 0xee, 0x30, 0xd8, 0xc0, 0x90, 0x93, 0x57,\r\n  0xee, 0xd1, 0x26, 0x23, 0xf1, 0xf3, 0xd1, 0xd3, 0xad, 0xda, 0x7e, 0xa9,\r\n  0xe6, 0x8b, 0xb6, 0x06, 0xf8, 0xe6, 0xf2, 0xf4, 0x75, 0xd4, 0xd2, 0xfc,\r\n  0xc4, 0x37, 0x81, 0xdf, 0xd5, 0x7f, 0xf5, 0xdf, 0xd1, 0x00, 0xe9, 0x17,\r\n  0x27, 0x27, 0x63, 0xe8, 0x7f, 0x0a, 0x42, 0x6f, 0xe1, 0x9e, 0x2a, 0xa5,\r\n  0xa5, 0xe0, 0x1b, 0xb4, 0x48, 0x93, 0x8a, 0x75, 0x0d, 0xf3, 0x9f, 0x72,\r\n  0xee, 0x16, 0xbf, 0x94, 0x0c, 0x93, 0x8c, 0x4c, 0xfb, 0x04, 0x56, 0x32,\r\n  0x53, 0xcd, 0xce, 0x21, 0x95, 0x96, 0x49, 0xde, 0xe1, 0x43, 0x97, 0x0e,\r\n  0x98, 0x48, 0x91, 0xb9, 0xc1, 0x5d, 0x31, 0x89, 0x4b, 0x47, 0x0e, 0x41,\r\n  0x4a, 0x29, 0xed, 0x38, 0x56, 0x29, 0xd4, 0xf1, 0x75, 0x9b, 0x22, 0x41,\r\n  0xb0, 0x95, 0x38, 0xa7, 0xf5, 0x87, 0x9c, 0x38, 0x34, 0xdf, 0x4f, 0x36,\r\n  0xcb, 0x0b, 0x04, 0xa4, 0x02, 0x92, 0x3d, 0x66, 0xa2, 0x5d, 0x01, 0x99,\r\n  0xc6, 0xdd, 0x7b, 0xe8, 0xb0, 0x8d, 0x6e, 0x72, 0x01, 0x86, 0x61, 0x9a,\r\n  0x59, 0x2a, 0x49, 0x82, 0x03, 0x10, 0x24, 0x4a, 0xc2, 0xa6, 0xc4, 0xf7,\r\n  0x26, 0x4a, 0xc2, 0x85, 0xea, 0x02, 0x30, 0xbb, 0x1a, 0xb1, 0x92, 0xaf,\r\n  0xe2, 0x29, 0x0c, 0x8f, 0xd2, 0xeb, 0x35, 0x64, 0xa9, 0x82, 0x33, 0x6b,\r\n  0xea, 0x98, 0xdc, 0x23, 0xa7, 0x5e, 0x8a, 0x98, 0x69, 0x92, 0x71, 0x77,\r\n  0x24, 0x12, 0xd7, 0x94, 0x4b, 0xda, 0x6d, 0x8f, 0xa6, 0x32, 0x3c, 0xae,\r\n  0x55, 0xe2, 0x02, 0x31, 0x95, 0x52, 0xe8, 0xde, 0x49, 0x5b, 0x6c, 0xf9,\r\n  0xa1, 0x03, 0xdd, 0x71, 0x7d, 0x76, 0x0b, 0x8f, 0x66, 0xf4, 0xaf, 0xa8,\r\n  0x2c, 0xe2, 0x0f, 0x5b, 0xce, 0x4a, 0xa4, 0xba, 0x5f, 0x3a, 0xd1, 0xc4,\r\n  0xdf, 0x09, 0x2f, 0x84, 0x3a, 0x68, 0x72, 0x7d, 0x28, 0x24, 0x1e, 0x2d,\r\n  0xab, 0x59, 0xbe, 0x12, 0xa0, 0x3c, 0xa0, 0x37, 0x85, 0xdd, 0xde, 0xff,\r\n  0xf9, 0xcf, 0x36, 0xf2, 0xff, 0x87, 0x9f, 0xc4, 0x89, 0x27, 0xb9, 0xb7,\r\n  0x3e, 0xfa, 0x6b, 0x5b, 0xa7, 0xf4, 0xdc, 0xcf, 0xbc, 0x48, 0x4c, 0x76,\r\n  0x21, 0x01, 0x50, 0x39, 0x42, 0x4d, 0xe5, 0x54, 0xc3, 0xb5, 0x7a, 0xf5,\r\n  0x6a, 0xdf, 0x4c, 0xee, 0x83, 0x8c, 0x3e, 0x0e, 0xbc, 0x95, 0xe2, 0xc7,\r\n  0x9a, 0xc0, 0x89, 0x2f, 0xc9, 0xd4, 0xeb, 0xe8, 0x29, 0x2d, 0x53, 0xbd,\r\n  0xce, 0x3a, 0x8e, 0x1c, 0x61, 0x89, 0xb0, 0xa1, 0xff, 0x7c, 0xb3, 0x9c,\r\n  0x4a, 0x1d, 0x9f, 0x36, 0x6d, 0x98, 0xac, 0xad, 0x46, 0x92, 0xfe, 0x93,\r\n  0xd6, 0x62, 0x50, 0xdd, 0xe7, 0xff, 0x1c, 0x31, 0xe2, 0x0a, 0x82, 0x77,\r\n  0x98, 0x4b, 0x91, 0xc5, 0x77, 0x7f, 0xdc, 0x65, 0xa3, 0xaa, 0xd7, 0x2e,\r\n  0x9e, 0x88, 0x19, 0xb0, 0x25, 0x76, 0x09, 0xfc, 0x6b, 0x58, 0xca, 0xea,\r\n  0x9f, 0xe3, 0xaf, 0x0c, 0xf8, 0x0a, 0xf8, 0xe7, 0x88, 0xff, 0xfc, 0x61,\r\n  0x77, 0xf8, 0xec, 0x27, 0xf7, 0xd5, 0x3f, 0xee, 0xbe, 0xfb, 0xe3, 0x5e,\r\n  0xaf, 0xb3, 0x7a, 0x28, 0xdb, 0x9d, 0x2b, 0x63, 0x2a, 0x37, 0x55, 0x5d,\r\n  0xcb, 0x8e, 0x4b, 0x80, 0x5e, 0xed, 0x7a, 0x1f, 0x27, 0x07, 0x35, 0x77,\r\n  0x1b, 0x36, 0xce, 0xfe, 0xbe, 0x0f, 0x30, 0x64, 0x86, 0x55, 0xdc, 0x02,\r\n  0xab, 0x45, 0x8b, 0x9a, 0x89, 0xbb, 0x06, 0x51, 0x25, 0x73, 0x1c, 0xb7,\r\n  0x7c, 0xd4, 0x60, 0xf3, 0x9a, 0x3d, 0xd0, 0x3d, 0x27, 0x8c, 0x62, 0x23,\r\n  0x87, 0x6a, 0x31, 0xed, 0xd1, 0xca, 0x88, 0x0b, 0xb9, 0xc8, 0xa6, 0xbb,\r\n  0xf1, 0x99, 0x85, 0x62, 0xab, 0xcb, 0x07, 0xe4, 0x9d, 0x6f, 0x7e, 0xcf,\r\n  0x6b, 0xc9, 0x2d, 0x1c, 0x5e, 0xd9, 0xec, 0xfe, 0x00, 0x35, 0x59, 0xbd,\r\n  0x3e, 0x70, 0x7c, 0xe2, 0x30, 0x0c, 0x28, 0xb4, 0xf5, 0x5a, 0x40, 0x34,\r\n  0xb1, 0x50, 0x25, 0x7e, 0x75, 0x9f, 0x40, 0x7b, 0x6d, 0xde, 0x3b, 0x9b,\r\n  0x67, 0xce, 0xd6, 0x11, 0x37, 0x59, 0xc0, 0x7d, 0x1a, 0xbe, 0x1e, 0x00,\r\n  0x0f, 0x92, 0xc8, 0x6a, 0x62, 0x4e, 0x57, 0x55, 0x3b, 0x87, 0x79, 0xb4,\r\n  0xd5, 0x05, 0x60, 0x0e, 0xdb, 0x82, 0x16, 0xe1, 0x91, 0xa6, 0x51, 0x29,\r\n  0x94, 0xea, 0x62, 0x0f, 0x0a, 0xa7, 0x18, 0xcb, 0x22, 0x81, 0xc4, 0xb5,\r\n  0x75, 0x13, 0x57, 0x2b, 0x6d, 0xe0, 0x98, 0x0c, 0x93, 0x79, 0xd9, 0xde,\r\n  0x1b, 0x87, 0x1c, 0x54, 0x63, 0x5e, 0x9e, 0x0a, 0xa9, 0x70, 0x83, 0xb0,\r\n  0x72, 0x96, 0x4b, 0x01, 0x8a, 0xef, 0x7c, 0xb8, 0xcc, 0xce, 0xa8, 0x42,\r\n  0x78, 0xdb, 0xd4, 0x13, 0x1a, 0x6b, 0xa8, 0xbb, 0x27, 0x1c, 0xb1, 0x61,\r\n  0xec, 0xca, 0x19, 0x04, 0x39, 0x3c, 0x3e, 0x95, 0xaf, 0xa5, 0x12, 0x31,\r\n  0xfb, 0x05, 0x23, 0x64, 0x21, 0x9e, 0x24, 0xd9, 0xa6, 0xd1, 0x83, 0x20,\r\n  0x64, 0xa5, 0xa9, 0xeb, 0xfc, 0xac, 0x70, 0x99, 0x74, 0x05, 0x6f, 0x9d,\r\n  0xb4, 0x69, 0x53, 0xc3, 0x71, 0xa9, 0xf6, 0x3f, 0x74, 0x9d, 0xd0, 0x5f,\r\n  0x7b, 0x40, 0x3f, 0x78, 0x42, 0x87, 0xcb, 0x81, 0x5d, 0x89, 0x15, 0x63,\r\n  0x6f, 0xe7, 0x5d, 0x4e, 0x0a, 0x63, 0x7c, 0x97, 0x8b, 0xd6, 0xd4, 0xa5,\r\n  0xcd, 0xe1, 0x7b, 0xf7, 0x6e, 0x57, 0x82, 0x19, 0x02, 0xac, 0xad, 0x40,\r\n  0x6f, 0x36, 0xb4, 0xa6, 0xa0, 0x34, 0x19, 0x9b, 0xad, 0x96, 0x3a, 0xc4,\r\n  0x3f, 0xa4, 0x23, 0xae, 0xc2, 0xbb, 0x91, 0x44, 0xf1, 0x77, 0xd6, 0xf0,\r\n  0x60, 0xf3, 0x78, 0x17, 0xb4, 0x96, 0x73, 0xcb, 0x60, 0x4a, 0x2b, 0x2d,\r\n  0x6e, 0x02, 0x4a, 0x4e, 0x1c, 0x35, 0x87, 0x05, 0x15, 0x8e, 0x5a, 0xfe,\r\n  0x4a, 0xab, 0x0a, 0x33, 0x7d, 0x35, 0x5e, 0xd2, 0x87, 0x62, 0x81, 0xb5,\r\n  0x82, 0x4b, 0xce, 0x2d, 0x17, 0xfa, 0x6d, 0xae, 0xac, 0xc3, 0xb3, 0x37,\r\n  0x6f, 0x8e, 0x0f, 0x2f, 0x7d, 0x1e, 0x4f, 0x07, 0x76, 0xcc, 0x69, 0x10,\r\n  0x0e, 0x3d, 0xa5, 0x9a, 0x8a, 0xa4, 0x4a, 0x29, 0xf4, 0x57, 0x3d, 0x08,\r\n  0xe6, 0x5b, 0xd7, 0x23, 0xc8, 0x9a, 0x41, 0xf7, 0xa5, 0x27, 0x7b, 0x28,\r\n  0xce, 0x24, 0x75, 0x4b, 0xe7, 0xca, 0xa6, 0xaa, 0xca, 0x83, 0xa5, 0xad,\r\n  0xd7, 0xf5, 0x5a, 0x0b, 0xfd, 0x42, 0x86, 0xeb, 0x85, 0xa8, 0xae, 0xf5,\r\n  0x0a, 0x82, 0x5a, 0xc3, 0x25, 0x2f, 0xb6, 0x01, 0x5f, 0xe1, 0x42, 0xd0,\r\n  0x51, 0x91, 0xcf, 0x3d, 0x97, 0x62, 0x07, 0x81, 0x9b, 0x2b, 0x50, 0x2a,\r\n  0xb5, 0x06, 0xa8, 0x71, 0x47, 0x0a, 0xa9, 0xfa, 0xe3, 0xc2, 0xe7, 0xd2,\r\n  0xc1, 0x9e, 0xf3, 0x45, 0x63, 0x38, 0x48, 0xd5, 0x22, 0x21, 0xe3, 0xdf,\r\n  0x4f, 0x2d, 0xc5, 0x4a, 0x98, 0x6e, 0x1c, 0xb9, 0xa2, 0x22, 0x60, 0xb0,\r\n  0x6b, 0x6c, 0x1e, 0xc1, 0xd0, 0xa5, 0x1b, 0xa9, 0x9d, 0x30, 0x8b, 0x52,\r\n  0xa7, 0xfd, 0xc0, 0x48, 0x74, 0x10, 0x37, 0x38, 0xb2, 0x68, 0xa2, 0x2c,\r\n  0x53, 0xa4, 0x56, 0x7a, 0x07, 0x45, 0x71, 0xd7, 0x51, 0x35, 0x8a, 0x76,\r\n  0xc7, 0xd1, 0x49, 0x3a, 0x28, 0x01, 0x17, 0xa9, 0xb5, 0x28, 0xb8, 0xe0,\r\n  0xb4, 0x6a, 0xf4, 0x93, 0xd7, 0xaa, 0xde, 0x9c, 0x5b, 0xa2, 0x56, 0xc6,\r\n  0x79, 0xeb, 0xe2, 0x77, 0xb4, 0xa4, 0xdd, 0xd5, 0xfe, 0xd2, 0x11, 0xd7,\r\n  0x1d, 0x64, 0xc6, 0xd2, 0x5e, 0x9d, 0xc2, 0x4a, 0x21, 0xdb, 0xf6, 0x36,\r\n  0xcd, 0x44, 0xd0, 0xe1, 0xb6, 0xb0, 0xb0, 0x2b, 0x52, 0xd5, 0x6f, 0x5e,\r\n  0xaf, 0xcd, 0xb7, 0x59, 0xfa, 0x1e, 0x3a, 0x67, 0x9b, 0x3a, 0xc2, 0x35,\r\n  0xb5, 0xbe, 0x57, 0xbd, 0xdd, 0xe7, 0x7b, 0xa3, 0xdd, 0x4f, 0x3e, 0x1b,\r\n  0xed, 0xee, 0x8c, 0x76, 0x7b, 0x21, 0xf0, 0x0f, 0x51, 0x42, 0x8e, 0xeb,\r\n  0x85, 0xed, 0x74, 0x58, 0xbc, 0x5d, 0x86, 0x75, 0xf8, 0x81, 0xc5, 0xc3,\r\n  0x28, 0x88, 0xb5, 0xb6, 0x3e, 0xa1, 0xf1, 0xd8, 0x66, 0xcb, 0xc3, 0x40,\r\n  0xe0, 0x63, 0xab, 0x2d, 0x39, 0x30, 0xed, 0xf2, 0xf2, 0x6a, 0xe5, 0xe3,\r\n  0x04, 0x5e, 0xec, 0x8a, 0xb0, 0x75, 0x31, 0xf4, 0x07, 0xf0, 0xd1, 0xee,\r\n  0xd2, 0x6c, 0xee, 0xfb, 0xbf, 0x38, 0x99, 0xad, 0x85, 0x9b, 0x63, 0xa7,\r\n  0x9c, 0x3b, 0x86, 0xea, 0x58, 0x72, 0xee, 0x4b, 0xae, 0xe0, 0xa6, 0xc9,\r\n  0xb9, 0xae, 0x58, 0xe3, 0xc8, 0xb9, 0xf1, 0xe0, 0x21, 0x0e, 0x65, 0xef,\r\n  0xaa, 0x91, 0x68, 0x8e, 0xd2, 0x6f, 0x9e, 0xb0, 0x38, 0x14, 0xb8, 0x68,\r\n  0xd9, 0xe5, 0x8c, 0x86, 0xf5, 0xfb, 0xd8, 0x26, 0xc2, 0x8b, 0x9c, 0x08,\r\n  0x92, 0x84, 0x71, 0x2f, 0x7e, 0xe7, 0x2f, 0x7f, 0xf1, 0x32, 0x6a, 0xcc,\r\n  0x50, 0x5f, 0xad, 0xae, 0x03, 0x97, 0xc0, 0x33, 0x6f, 0x08, 0x48, 0x92,\r\n  0x58, 0xd4, 0xdb, 0xff, 0x01, 0x80, 0xe0, 0x9f, 0x86, 0x3f, 0xd0, 0x3f,\r\n  0x7f, 0xea, 0x39, 0x41, 0x09, 0xd0, 0x83, 0x28, 0x41, 0x6e, 0xf0, 0xb2,\r\n  0x44, 0x03, 0x8c, 0xc5, 0x83, 0x03, 0x91, 0x65, 0xc8, 0xde, 0x5a, 0x9c,\r\n  0x46, 0xc9, 0xac, 0x91, 0xdd, 0xac, 0xa6, 0x82, 0x24, 0x58, 0xc1, 0x38,\r\n  0xa6, 0x9d, 0xe2, 0xe6, 0x52, 0xa0, 0xb0, 0xfe, 0xa5, 0x81, 0x31, 0xe7,\r\n  0xb2, 0x61, 0x52, 0x88, 0x5e, 0x67, 0x29, 0x58, 0x2a, 0x9e, 0x19, 0xdf,\r\n  0xe4, 0x8a, 0xcd, 0xea, 0xcf, 0x36, 0x5c, 0x46, 0x30, 0xa7, 0x00, 0x58,\r\n  0xed, 0x38, 0x09, 0xbe, 0x89, 0x63, 0x2b, 0x71, 0x71, 0xf1, 0x34, 0x63,\r\n  0x3d, 0xd8, 0x04, 0x71, 0x91, 0x96, 0xb7, 0x3c, 0x44, 0x4d, 0x75, 0x91,\r\n  0x74, 0xfe, 0x8d, 0x00, 0xf9, 0x81, 0xbe, 0x59, 0x7a, 0x08, 0x47, 0x8e,\r\n  0x0c, 0x01, 0x18, 0x3a, 0x56, 0x58, 0x92, 0x45, 0x2f, 0x96, 0x37, 0x05,\r\n  0xb5, 0xfb, 0x08, 0x93, 0x0a, 0x3d, 0x25, 0xcf, 0xb8, 0x5d, 0xbb, 0xf4,\r\n  0xcc, 0x23, 0xbf, 0x23, 0xd6, 0x93, 0x2b, 0xbe, 0x3f, 0xd9, 0xd9, 0x5d,\r\n  0x43, 0xaa, 0x0b, 0x59, 0x6f, 0x88, 0x0e, 0x06, 0x61, 0xb1, 0xec, 0x64,\r\n  0x40, 0x66, 0xb4, 0xf7, 0xc9, 0xee, 0x27, 0xdb, 0x24, 0x45, 0x9e, 0x8c,\r\n  0xf6, 0xd4, 0x33, 0x05, 0xe2, 0x0c, 0x3a, 0x62, 0xd4, 0x87, 0xe6, 0xe5,\r\n  0x89, 0x74, 0x62, 0xbb, 0xac, 0x01, 0xf2, 0xa2, 0xe6, 0x82, 0x0a, 0x36,\r\n  0xa5, 0xdc, 0x68, 0x1e, 0x75, 0x1b, 0x73, 0x82, 0xb0, 0xc3, 0xca, 0xb6,\r\n  0xd2, 0x3d, 0x2c, 0xfc, 0xc8, 0x0a, 0x0d, 0xf7, 0x46, 0x7d, 0x2f, 0x2b,\r\n  0x29, 0x42, 0x35, 0x49, 0xe9, 0xe6, 0xaf, 0xb8, 0xac, 0x28, 0xf2, 0x54,\r\n  0x50, 0xbe, 0xc4, 0x88, 0x8a, 0x99, 0xd1, 0x33, 0xef, 0x2c, 0xb7, 0x20,\r\n  0xb5, 0x8a, 0x8d, 0x9c, 0xd0, 0x5c, 0x07, 0x61, 0x14, 0x01, 0xb0, 0xdc,\r\n  0x54, 0x78, 0x34, 0xc1, 0x3b, 0xcb, 0xb7, 0xf2, 0xf4, 0xa1, 0x79, 0x8f,\r\n  0x7c, 0x6d, 0xa4, 0x9e, 0xb1, 0xdd, 0x50, 0x92, 0x6c, 0x24, 0x5e, 0xe8,\r\n  0x58, 0x26, 0xc3, 0x73, 0x30, 0xe9, 0x0f, 0x04, 0xfa, 0xc9, 0x1e, 0x99,\r\n  0x36, 0xfb, 0x64, 0x80, 0x19, 0x1e, 0x75, 0x20, 0x0e, 0x94, 0xc4, 0x88,\r\n  0x33, 0x68, 0xc4, 0xdb, 0x2a, 0xa1, 0x3c, 0xc8, 0x85, 0xc7, 0x80, 0xd2,\r\n  0x8f, 0x11, 0xed, 0xcb, 0xb6, 0xd8, 0xfb, 0xdf, 0x70, 0x5b, 0xec, 0xfd,\r\n  0xff, 0xdb, 0xe2, 0x5f, 0xb8, 0x2d, 0x9e, 0x37, 0xb6, 0x05, 0x1b, 0x0e,\r\n  0x24, 0xcd, 0xcc, 0x7e, 0x68, 0x91, 0x91, 0x61, 0x67, 0xd4, 0x93, 0xab,\r\n  0x0d, 0x04, 0x92, 0x2a, 0x17, 0x87, 0xb7, 0x3d, 0x54, 0x33, 0x2b, 0x3d,\r\n  0xfd, 0x43, 0xbb, 0x36, 0x08, 0xd7, 0xb2, 0x8f, 0xe7, 0xa3, 0xe8, 0xdc,\r\n  0xbd, 0xc6, 0xbe, 0x2e, 0xfe, 0xd9, 0x0a, 0x11, 0x8b, 0x79, 0x72, 0x85,\r\n  0x25, 0xc0, 0x85, 0x34, 0xc0, 0x2f, 0x71, 0x5f, 0x32, 0x8b, 0xd4, 0xb0,\r\n  0x85, 0xe9, 0xe6, 0x57, 0x24, 0x88, 0x80, 0x56, 0xa4, 0xa4, 0xba, 0x83,\r\n  0xe0, 0x0a, 0x41, 0x78, 0x11, 0xf5, 0xe9, 0xd2, 0xec, 0x0f, 0x6a, 0x2c,\r\n  0x9c, 0x9c, 0x31, 0xd0, 0x26, 0x10, 0x7e, 0x2f, 0x0e, 0xb2, 0x7f, 0x24,\r\n  0x45, 0x1e, 0x59, 0xc4, 0x5f, 0x19, 0x04, 0xc0, 0xa2, 0x6d, 0xf7, 0x81,\r\n  0xff, 0x21, 0x7f, 0xb7, 0xa5, 0x4e, 0xfe, 0x05, 0x1c, 0xfd, 0xc2, 0x1a,\r\n  0xc1, 0xf9, 0x7c, 0x0e, 0x12, 0x9c, 0xf1, 0x9d, 0x9a, 0x9a, 0x8f, 0xc6,\r\n  0xcf, 0x9c, 0xe9, 0x3e, 0x00, 0x1d, 0x56, 0x1d, 0x35, 0xbb, 0x79, 0x66,\r\n  0x36, 0xab, 0x8e, 0xb2, 0xe4, 0xe9, 0x95, 0x64, 0x1a, 0x4b, 0x77, 0x1c,\r\n  0xab, 0xe7, 0xa8, 0x43, 0x21, 0x3b, 0x4a, 0xd8, 0xbc, 0x0d, 0x3b, 0x34,\r\n  0x90, 0x8a, 0x84, 0x6a, 0xe2, 0xb9, 0x70, 0xb3, 0x0f, 0x1a, 0xf9, 0x2e,\r\n  0xb6, 0xbb, 0x54, 0xef, 0x73, 0xd5, 0x11, 0x79, 0x7e, 0xe9, 0xa6, 0xc1,\r\n  0x9c, 0xaa, 0xe1, 0x64, 0x6c, 0x02, 0x45, 0x6c, 0x2e, 0x26, 0x7c, 0xf2,\r\n  0x63, 0xa6, 0x01, 0xb6, 0x31, 0xac, 0xb3, 0x72, 0x35, 0xf9, 0xbb, 0xaa,\r\n  0xfe, 0x0c, 0x49, 0x12, 0xc2, 0xe3, 0xb0, 0xb6, 0x02, 0x52, 0x72, 0xe9,\r\n  0x29, 0xf5, 0x88, 0xb4, 0x9b, 0xa3, 0x1f, 0xc2, 0xfb, 0xe5, 0x98, 0x58,\r\n  0x75, 0x9f, 0x69, 0xf0, 0x8c, 0xfb, 0xd4, 0x1a, 0x54, 0x10, 0x01, 0x6a,\r\n  0xad, 0xbb, 0x9d, 0x27, 0x56, 0x0d, 0x4b, 0xa5, 0x48, 0x0d, 0x17, 0xcb,\r\n  0xcd, 0xa6, 0x6a, 0x2b, 0x16, 0xeb, 0xe2, 0xc7, 0xd7, 0xb6, 0x45, 0xdb,\r\n  0x75, 0xc0, 0x1e, 0xc9, 0x72, 0xf0, 0x17, 0xfe, 0x4f, 0xb7, 0x66, 0x5c,\r\n  0x63, 0x44, 0xb2, 0xc0, 0x38, 0x3f, 0x8e, 0xb3, 0x81, 0xd7, 0xd7, 0x7d,\r\n  0xe0, 0x25, 0xff, 0x56, 0xbe, 0xf0, 0x78, 0xdb, 0xf0, 0x39, 0xfe, 0x82,\r\n  0x0f, 0xbc, 0xcd, 0x24, 0x33, 0x2c, 0x94, 0x10, 0x4b, 0xcd, 0xb8, 0x45,\r\n  0x19, 0xb2, 0xb8, 0xc8, 0x24, 0xae, 0x1d, 0xd6, 0xd8, 0x62, 0xe0, 0xf6,\r\n  0x12, 0xd6, 0x78, 0xd3, 0x3a, 0x8c, 0xaf, 0xd8, 0x23, 0x01, 0xb7, 0x04,\r\n  0x03, 0x7c, 0x24, 0x47, 0x43, 0xb9, 0x60, 0x2c, 0x06, 0xbc, 0xcc, 0x2b,\r\n  0xf3, 0x7d, 0x45, 0x33, 0x56, 0x32, 0x0b, 0xdc, 0x0f, 0x1d, 0xf4, 0x6d,\r\n  0xb6, 0x10, 0xbe, 0x8c, 0x16, 0xb7, 0x0c, 0x5b, 0x7b, 0xb5, 0x04, 0xf3,\r\n  0x62, 0x00, 0x3a, 0x82, 0x3e, 0xe9, 0x76, 0x2e, 0x3e, 0xdd, 0x8c, 0x16,\r\n  0x21, 0x98, 0x81, 0x0b, 0xcf, 0xf1, 0xda, 0xdc, 0xe5, 0xe9, 0x0c, 0x65,\r\n  0xc7, 0x39, 0xeb, 0x64, 0xf4, 0xeb, 0xe8, 0x26, 0x07, 0x01, 0x53, 0x7b,\r\n  0x5c, 0x86, 0xe0, 0xcf, 0x76, 0xa8, 0xd6, 0xdb, 0x57, 0xb1, 0xe4, 0xb8,\r\n  0xd1, 0x2e, 0xce, 0x62, 0x47, 0x93, 0xec, 0x97, 0x01, 0xdd, 0x14, 0xce,\r\n  0x54, 0x46, 0xa2, 0x4e, 0x93, 0x76, 0xf4, 0xcb, 0x13, 0x0b, 0x7e, 0x28,\r\n  0x49, 0x6c, 0xaf, 0x75, 0x9f, 0x48, 0x9a, 0xd8, 0x07, 0x6f, 0x15, 0x9b,\r\n  0x27, 0x23, 0x3c, 0xd0, 0x0b, 0x25, 0xd8, 0x2d, 0x9a, 0x3e, 0x13, 0x5c,\r\n  0x8d, 0x9d, 0xe9, 0xbd, 0xb6, 0x93, 0xaf, 0x50, 0xae, 0xe4, 0x3e, 0x94,\r\n  0xab, 0x05, 0xbb, 0x80, 0x48, 0xd4, 0x97, 0x12, 0x9b, 0xff, 0x85, 0x43,\r\n  0x79, 0xff, 0x30, 0x8c, 0xb3, 0x07, 0x0e, 0x85, 0x3d, 0x72, 0x2d, 0xb2,\r\n  0x20, 0x07, 0xea, 0x9a, 0x76, 0x4c, 0x2a, 0x34, 0xb3, 0x0d, 0x94, 0x90,\r\n  0x85, 0x4d, 0x41, 0xce, 0x4c, 0x32, 0x66, 0xd5, 0xf2, 0xf2, 0x68, 0xb1,\r\n  0x68, 0xf5, 0xf2, 0x54, 0x01, 0xf9, 0x85, 0x86, 0xc0, 0x55, 0x1b, 0x90,\r\n  0xdc, 0x7e, 0x4d, 0xee, 0x07, 0x43, 0x19, 0x7c, 0xc7, 0xdd, 0x64, 0x38,\r\n  0xdb, 0x2e, 0xc9, 0xa2, 0x60, 0x82, 0xe6, 0x21, 0xc9, 0xba, 0x65, 0x23,\r\n  0xbb, 0xff, 0x49, 0xd7, 0x90, 0x51, 0x5a, 0xe4, 0x03, 0x7a, 0x00, 0x7f,\r\n  0x7f, 0x6d, 0x36, 0x7a, 0x30, 0x52, 0x1b, 0xd9, 0xba, 0x10, 0x91, 0x8c,\r\n  0x52, 0x07, 0xf9, 0x56, 0x40, 0xbc, 0x68, 0x11, 0xe4, 0x45, 0x2c, 0x66,\r\n  0x78, 0x5a, 0x82, 0x2f, 0x09, 0x78, 0xaf, 0x35, 0x60, 0x5f, 0xe0, 0x8a,\r\n  0x61, 0x32, 0x78, 0xd2, 0x9d, 0x08, 0x93, 0xbe, 0xdd, 0xab, 0xc2, 0x43,\r\n  0x6a, 0x47, 0xf7, 0x4a, 0xf9, 0x10, 0x77, 0x2c, 0xad, 0x83, 0x2d, 0x65,\r\n  0x8e, 0x66, 0x88, 0xb0, 0x7e, 0x70, 0x5b, 0xa3, 0xe3, 0x12, 0x8d, 0xed,\r\n  0x9c, 0xa3, 0x5f, 0x3d, 0x49, 0xf2, 0xfd, 0x8e, 0x59, 0xd2, 0x8f, 0x75,\r\n  0x12, 0x38, 0xe9, 0x34, 0x61, 0x96, 0x5a, 0x23, 0x5a, 0x07, 0x22, 0x5d,\r\n  0x33, 0xa8, 0x75, 0x30, 0xd2, 0xe6, 0xda, 0x77, 0x66, 0xf6, 0xaf, 0xdf,\r\n  0xe6, 0x32, 0xba, 0xac, 0x06, 0x7a, 0xac, 0x0d, 0xb0, 0x09, 0xd1, 0x71,\r\n  0x4f, 0x2a, 0xa3, 0x5b, 0x38, 0xc6, 0xc7, 0x0d, 0x22, 0x17, 0xb7, 0xfe,\r\n  0xc8, 0x01, 0x77, 0x20, 0x27, 0xa2, 0xff, 0xe6, 0x2a, 0x02, 0xa3, 0x51,\r\n  0x1b, 0x22, 0xbe, 0x52, 0x1b, 0x4a, 0x87, 0xcb, 0xae, 0xb5, 0x78, 0xbb,\r\n  0xa3, 0x1d, 0x48, 0xdb, 0xf7, 0x0f, 0x88, 0x53, 0xee, 0xf3, 0xbd, 0xf5,\r\n  0x53, 0x53, 0xe8, 0xbe, 0x55, 0x31, 0xeb, 0x7d, 0xb5, 0x18, 0x17, 0xbf,\r\n  0xab, 0x9d, 0x3a, 0xb1, 0x3a, 0x8d, 0x21, 0xb3, 0x89, 0x23, 0xd1, 0x5c,\r\n  0xcf, 0x57, 0x9a, 0x56, 0x01, 0x5d, 0x29, 0xe7, 0xab, 0xe1, 0xfd, 0xdd,\r\n  0x9d, 0xcf, 0x76, 0xba, 0x79, 0x7d, 0xa0, 0x43, 0x58, 0xbc, 0x68, 0xea,\r\n  0x59, 0x87, 0xa1, 0x1f, 0x1a, 0xcf, 0x59, 0x10, 0x22, 0xd1, 0x4b, 0x92,\r\n  0x23, 0x24, 0x5d, 0x92, 0x1f, 0xf1, 0x92, 0x54, 0x3d, 0x89, 0xea, 0x7e,\r\n  0x73, 0xac, 0x2e, 0x16, 0x59, 0x70, 0x2e, 0x7d, 0x17, 0x37, 0xe8, 0x48,\r\n  0xfe, 0xf2, 0x55, 0x4f, 0x6b, 0x73, 0x63, 0xca, 0x7b, 0xad, 0x4a, 0xa8,\r\n  0x49, 0x15, 0x7d, 0x70, 0xb7, 0xb6, 0x28, 0xab, 0xc9, 0x23, 0x5c, 0xbb,\r\n  0x5f, 0x73, 0x1d, 0x40, 0x01, 0x7c, 0x08, 0x69, 0xec, 0x47, 0x32, 0xed,\r\n  0xe2, 0x95, 0x16, 0x1d, 0xf3, 0xbf, 0x9e, 0x66, 0xf7, 0x67, 0xc7, 0x44,\r\n  0xac, 0x35, 0x5f, 0x3c, 0x58, 0xc2, 0x97, 0x1e, 0xc9, 0x03, 0x95, 0xda,\r\n  0x71, 0xa3, 0xa9, 0xd9, 0x0d, 0xde, 0xf4, 0x36, 0xf7, 0xa6, 0xaf, 0x30,\r\n  0xe0, 0xf2, 0xb7, 0x50, 0x33, 0x3d, 0x9e, 0x19, 0xd1, 0xac, 0xf2, 0xfa,\r\n  0x21, 0xda, 0x17, 0x56, 0xbd, 0x68, 0x53, 0xf7, 0x58, 0xd6, 0x98, 0x76,\r\n  0xa3, 0x5e, 0x96, 0x40, 0x63, 0x97, 0x49, 0x5c, 0x90, 0x56, 0xc5, 0x71,\r\n  0xdd, 0x60, 0x70, 0xff, 0x83, 0x9b, 0x45, 0xdd, 0x13, 0xae, 0xd3, 0x83,\r\n  0xce, 0x77, 0x85, 0x78, 0xb4, 0x9e, 0x23, 0xe3, 0x7d, 0x79, 0xb7, 0xc4,\r\n  0xc5, 0x24, 0xad, 0x8a, 0x58, 0x01, 0xcf, 0xca, 0xcf, 0x19, 0xc4, 0x9f,\r\n  0xc0, 0x23, 0xca, 0xc6, 0xf1, 0x78, 0x1d, 0x43, 0x27, 0xc9, 0xbe, 0xff,\r\n  0x81, 0xaf, 0x6a, 0x03, 0xa2, 0xbb, 0x20, 0xf3, 0xff, 0xcb, 0xe3, 0x57,\r\n  0x67, 0x17, 0xc7, 0x75, 0xb2, 0x07, 0x61, 0x50, 0xec, 0x2a, 0x17, 0xbb,\r\n  0xf9, 0x77, 0x60, 0x9d, 0xa1, 0x39, 0x85, 0x85, 0x23, 0xce, 0xbf, 0x3b,\r\n  0x72, 0x9d, 0x4b, 0x5d, 0x39, 0x3b, 0xd7, 0xe2, 0xc0, 0x6a, 0x3e, 0xb5,\r\n  0x72, 0x2a, 0xe2, 0x69, 0xc5, 0x5c, 0xd9, 0x56, 0x51, 0xc4, 0xba, 0x27,\r\n  0x2c, 0x53, 0xa8, 0x52, 0x2a, 0x1f, 0x8b, 0x05, 0x67, 0x59, 0x96, 0xec,\r\n  0xa0, 0x70, 0xcd, 0x76, 0x54, 0xc1, 0x49, 0xdf, 0x4b, 0x25, 0x71, 0x15,\r\n  0x73, 0x0c, 0x22, 0x60, 0x5c, 0xc1, 0x28, 0x72, 0x1f, 0xf1, 0x5f, 0x71,\r\n  0x1c, 0xa7, 0xaa, 0x0c, 0x76, 0xb9, 0x74, 0x98, 0x39, 0x42, 0x62, 0xc9,\r\n  0x22, 0x39, 0x5a, 0x81, 0xe4, 0x41, 0xf4, 0x77, 0xa9, 0x1b, 0x74, 0x65,\r\n  0x05, 0x24, 0xad, 0x7b, 0xad, 0x4d, 0x88, 0xcf, 0x6e, 0x96, 0x24, 0x50,\r\n  0x7c, 0x4f, 0xdd, 0xb4, 0x59, 0x61, 0xec, 0xbf, 0xf4, 0x23, 0x35, 0xc6,\r\n  0x21, 0x1b, 0x35, 0x05, 0xa7, 0x9d, 0xfd, 0x27, 0x79, 0xed, 0x91, 0x65,\r\n  0x4d, 0x6e, 0x8d, 0x5c, 0xf0, 0xb9, 0xbb, 0xbc, 0xb2, 0x8d, 0xda, 0xb8,\r\n  0x13, 0xbb, 0xc3, 0x63, 0x56, 0x2e, 0xc2, 0xbc, 0xd8, 0x56, 0xff, 0x40,\r\n  0xe5, 0x92, 0x35, 0x32, 0x08, 0xd8, 0xd0, 0x10, 0xad, 0x6d, 0x39, 0x4f,\r\n  0xf4, 0x06, 0x33, 0x38, 0x4f, 0x3c, 0x51, 0x7a, 0xea, 0xbf, 0x19, 0x60,\r\n  0x1e, 0x04, 0x46, 0xe5, 0x43, 0x56, 0x21, 0x68, 0x08, 0x9b, 0x6a, 0x9a,\r\n  0x17, 0x08, 0xb3, 0xb6, 0xb7, 0xb1, 0xdf, 0xb7, 0x25, 0x3c, 0x87, 0xcf,\r\n  0x9f, 0x3d, 0xe7, 0x63, 0x87, 0x62, 0xb1, 0x9a, 0x3d, 0xa8, 0x30, 0x40,\r\n  0x50, 0x44, 0x6a, 0x8f, 0x5d, 0x05, 0xc7, 0x56, 0x51, 0x1d, 0x59, 0x7e,\r\n  0x73, 0x32, 0x4d, 0x92, 0xb9, 0x65, 0x2e, 0x8e, 0x83, 0xa6, 0x46, 0x6b,\r\n  0xcd, 0xa8, 0x75, 0xe5, 0x5b, 0x21, 0xe7, 0xb4, 0xb4, 0x23, 0xad, 0x42,\r\n  0x7c, 0xab, 0x40, 0x66, 0x3d, 0x0f, 0xd2, 0x6e, 0x6d, 0xf5, 0xd7, 0xf5,\r\n  0xce, 0xf2, 0x48, 0x68, 0xc0, 0xb4, 0x31, 0x39, 0xb4, 0xb0, 0xf9, 0xe7,\r\n  0xad, 0x7a, 0xe5, 0x1d, 0x8e, 0x53, 0xa5, 0xd9, 0x2a, 0xa9, 0xd1, 0x99,\r\n  0xac, 0x6b, 0xee, 0x0a, 0x02, 0x8b, 0x66, 0xaf, 0x89, 0x73, 0x97, 0x02,\r\n  0x14, 0x55, 0xbe, 0x8c, 0x62, 0x2b, 0x68, 0xa2, 0x6b, 0xdf, 0x86, 0x06,\r\n  0xf1, 0x18, 0x00, 0xa9, 0xd4, 0x82, 0xf3, 0x76, 0x7b, 0x91, 0xc6, 0x91,\r\n  0x21, 0x6e, 0xaf, 0x7b, 0x51, 0x03, 0xc0, 0x88, 0x5c, 0xd2, 0x58, 0xd9,\r\n  0x65, 0xd7, 0x21, 0x9a, 0x44, 0x0e, 0x06, 0xa7, 0x51, 0xb9, 0x08, 0x1a,\r\n  0x35, 0x05, 0x70, 0x9a, 0x55, 0xe0, 0x39, 0x69, 0xf6, 0xaa, 0x9d, 0x5a,\r\n  0x27, 0x05, 0x71, 0x34, 0x2b, 0x07, 0x6d, 0x33, 0x19, 0x38, 0xa9, 0x5b,\r\n  0xc3, 0xb2, 0x7a, 0x10, 0x3b, 0x3e, 0x59, 0x70, 0xd2, 0x36, 0xca, 0x59,\r\n  0x81, 0xde, 0x49, 0x49, 0x9d, 0x81, 0x2c, 0x1e, 0xb6, 0xcb, 0x87, 0xc9,\r\n  0x16, 0x88, 0x5e, 0x39, 0x87, 0xb2, 0x7a, 0xc7, 0xe0, 0x4d, 0x62, 0xce,\r\n  0x9d, 0xf9, 0xdc, 0x13, 0x4c, 0xc8, 0xec, 0xfc, 0x6c, 0x52, 0xb6, 0x73,\r\n  0xc7, 0xb5, 0x09, 0x02, 0x6e, 0xae, 0x8b, 0xa5, 0x24, 0xf7, 0x76, 0x95,\r\n  0xe8, 0x09, 0xd4, 0x1a, 0x79, 0xd2, 0x64, 0x05, 0xea, 0x36, 0x40, 0xed,\r\n  0xc3, 0xab, 0x27, 0x47, 0x35, 0x5e, 0x08, 0xc1, 0x2c, 0xd1, 0x4a, 0x77,\r\n  0x37, 0xe7, 0x31, 0x3b, 0x82, 0xb3, 0xf0, 0xf7, 0x89, 0x6b, 0xcd, 0x6b,\r\n  0x71, 0x93, 0x07, 0xff, 0x9b, 0xee, 0xe6, 0xb4, 0x0d, 0xf1, 0xa5, 0x4b,\r\n  0x0b, 0xd6, 0x2c, 0xf6, 0x8a, 0xd5, 0x1c, 0xe6, 0xdd, 0xc0, 0xd4, 0x39,\r\n  0xf6, 0x91, 0x76, 0x1d, 0xeb, 0x9b, 0x45, 0x3e, 0x93, 0x10, 0xfe, 0x87,\r\n  0xe6, 0x82, 0x1f, 0xb4, 0xb9, 0x50, 0xef, 0x64, 0x19, 0x8e, 0x0b, 0x8d,\r\n  0x70, 0xc9, 0xe2, 0xd2, 0xf1, 0xb2, 0x77, 0x37, 0xe7, 0x07, 0x0a, 0xb5,\r\n  0x06, 0xcd, 0xe3, 0xe5, 0x70, 0x08, 0x59, 0x94, 0x4f, 0xab, 0x60, 0x04,\r\n  0xfc, 0x40, 0x77, 0x73, 0x1a, 0x57, 0x6c, 0x8f, 0x8c, 0x3d, 0x55, 0xc8,\r\n  0xc3, 0xf9, 0xd0, 0xc8, 0xf8, 0xc1, 0xd6, 0x2a, 0xd3, 0x0f, 0x45, 0x86,\r\n  0x37, 0x96, 0x58, 0x16, 0x67, 0x4d, 0x34, 0xbb, 0xb6, 0xc0, 0xb6, 0xc2,\r\n  0xe8, 0x43, 0xd7, 0x02, 0xe3, 0x17, 0x5d, 0x82, 0xdc, 0xf3, 0xa5, 0xc8,\r\n  0xec, 0xb8, 0x07, 0xd7, 0x2e, 0xb0, 0x7e, 0xa3, 0x35, 0x0b, 0xf3, 0x4c,\r\n  0xd9, 0x68, 0xdf, 0x49, 0x36, 0x2a, 0x33, 0x29, 0x55, 0xef, 0x1e, 0x9f,\r\n  0x90, 0x79, 0x66, 0xec, 0xdf, 0xe0, 0x3d, 0x70, 0xb2, 0x42, 0x01, 0x88,\r\n  0x71, 0x9d, 0x17, 0x5c, 0xd9, 0x2c, 0xd6, 0x6c, 0x7b, 0xff, 0xbd, 0xc8,\r\n  0xb3, 0x76, 0xd3, 0x35, 0x9a, 0x0a, 0x7f, 0x9c, 0x93, 0x31, 0x41, 0x1f,\r\n  0xbb, 0xc8, 0x9d, 0x03, 0x88, 0x74, 0x6b, 0x88, 0x8b, 0x5b, 0x76, 0x4d,\r\n  0x39, 0xd5, 0xe0, 0xdd, 0x7a, 0xf4, 0x03, 0x36, 0x1a, 0x9e, 0xb6, 0xd5,\r\n  0x96, 0x21, 0x59, 0xf4, 0xc8, 0xe3, 0xd4, 0xfc, 0x71, 0x7e, 0x64, 0x1f,\r\n  0xd7, 0x3f, 0xe9, 0xce, 0x64, 0xb3, 0x7f, 0xcb, 0xfb, 0x99, 0x7d, 0x9c,\r\n  0xff, 0x6a, 0x9f, 0x0e, 0x6b, 0x44, 0xb9, 0x64, 0x62, 0x56, 0x5d, 0xa5,\r\n  0xb1, 0x2b, 0xc3, 0xf2, 0xad, 0x99, 0x8a, 0x6e, 0x80, 0x5d, 0xeb, 0xe3,\r\n  0x85, 0x54, 0x95, 0x33, 0x7e, 0x4a, 0x2c, 0xc7, 0xfa, 0xc9, 0xd1, 0xa7,\r\n  0x7d, 0x17, 0x45, 0xbe, 0x87, 0x9c, 0x3a, 0x7e, 0x8e, 0xec, 0x38, 0x3c,\r\n  0x22, 0xf0, 0xac, 0x0c, 0x67, 0x43, 0xe4, 0xcd, 0x12, 0xae, 0x13, 0x20,\r\n  0x7b, 0x01, 0x20, 0xcc, 0x0f, 0x9f, 0x2c, 0xe9, 0xf9, 0xda, 0x39, 0x2e,\r\n  0x16, 0x1f, 0x38, 0xe4, 0xf4, 0x80, 0x1f, 0x15, 0x73, 0xca, 0x07, 0xa3,\r\n  0x6a, 0x9d, 0x4b, 0xcd, 0x99, 0x5e, 0x33, 0xf3, 0xeb, 0x7a, 0x50, 0xdb,\r\n  0x85, 0xeb, 0x7b, 0xa2, 0x4f, 0x76, 0x76, 0xc7, 0x4f, 0x2e, 0xc7, 0x31,\r\n  0x1e, 0x7c, 0xcf, 0xba, 0x9b, 0xd3, 0xee, 0xfa, 0xb7, 0x74, 0x7a, 0x06,\r\n  0x2e, 0xc9, 0x5b, 0x0d, 0x79, 0xb6, 0x9f, 0xdb, 0x7b, 0xc3, 0x0e, 0xf8,\r\n  0x2f, 0x12, 0x10, 0x6c, 0xad, 0xcd, 0xc3, 0x12, 0xc0, 0x05, 0x30, 0x9a,\r\n  0x80, 0x8c, 0xbc, 0xc0, 0x7f, 0x3e, 0x5f, 0x5b, 0x20, 0x7c, 0xec, 0xab,\r\n  0x84, 0x5f, 0x48, 0xd8, 0x90, 0xa5, 0x09, 0xf3, 0xe9, 0x29, 0xe6, 0x64,\r\n  0x93, 0xf1, 0x49, 0xb1, 0x94, 0x7a, 0x07, 0xbe, 0x39, 0x9f, 0xae, 0xba,\r\n  0x6a, 0x33, 0x6e, 0x19, 0xac, 0x36, 0x96, 0xea, 0xe8, 0xdb, 0x64, 0xad,\r\n  0x0f, 0xa2, 0xba, 0x4d, 0x66, 0xca, 0x35, 0xd7, 0x3e, 0x53, 0x70, 0x31,\r\n  0x7f, 0xba, 0x19, 0xf3, 0xbd, 0xe0, 0x0f, 0x5b, 0x71, 0xd4, 0x5a, 0xa5,\r\n  0x6d, 0xae, 0x50, 0xe1, 0x14, 0x79, 0xa6, 0xc5, 0x6b, 0x4d, 0xe0, 0xce,\r\n  0xf0, 0xe9, 0xf3, 0xe7, 0xb5, 0x2b, 0x2d, 0xb4, 0x9c, 0x9f, 0xed, 0xec,\r\n  0x08, 0x57, 0x60, 0xf3, 0x35, 0xfa, 0xc5, 0xf0, 0x39, 0x5e, 0xac, 0xbf,\r\n  0x26, 0x6c, 0x9d, 0xeb, 0xdf, 0x1b, 0xf2, 0x6f, 0x3a, 0x3e, 0x07, 0xeb,\r\n  0x7e, 0xed, 0x5b, 0xcf, 0xf9, 0x73, 0x1d, 0x6f, 0xe1, 0x61, 0x99, 0xc6,\r\n  0xfc, 0xea, 0x8a, 0xe9, 0xcf, 0xf8, 0x49, 0x29, 0x00, 0x96, 0x17, 0xf7,\r\n  0x71, 0x31, 0x6b, 0x0f, 0x77, 0x67, 0x30, 0xdc, 0x5d, 0x37, 0x5c, 0x57,\r\n  0x0c, 0x1d, 0xeb, 0xc9, 0x16, 0x14, 0x29, 0xcf, 0x9b, 0x5f, 0x6f, 0x75,\r\n  0x8d, 0xfe, 0xd3, 0x9d, 0x9d, 0xc1, 0x27, 0xfc, 0xdf, 0xe7, 0xcf, 0xd7,\r\n  0x06, 0xa8, 0xfc, 0x37, 0x9e, 0xd8, 0xd0, 0x6a, 0xbd, 0xa5, 0x76, 0x3a,\r\n  0x5a, 0xdf, 0xa5, 0x56, 0x77, 0x9f, 0x3f, 0x1f, 0xf0, 0x57, 0x9e, 0x7d,\r\n  0x54, 0xeb, 0xd5, 0x7d, 0xee, 0xfd, 0x2c, 0xfc, 0xba, 0xdf, 0x8f, 0x65,\r\n  0x63, 0x04, 0x6c, 0x0d, 0xbc, 0x04, 0x81, 0x62, 0x90, 0x43, 0xe8, 0xa1,\r\n  0xbc, 0x21, 0xe2, 0x12, 0x28, 0x81, 0x25, 0x08, 0x38, 0xe0, 0x19, 0x8d,\r\n  0xcd, 0x60, 0x89, 0x3d, 0xc4, 0xc2, 0x9c, 0xf9, 0x1e, 0xd0, 0x2c, 0x28,\r\n  0xf6, 0x59, 0x7a, 0xcd, 0xfc, 0x8d, 0x96, 0x79, 0x57, 0x46, 0x9b, 0xb4,\r\n  0x5f, 0x84, 0x5a, 0xed, 0x2e, 0x9e, 0xa7, 0x0e, 0xe8, 0xdd, 0x07, 0xec,\r\n  0x4b, 0xd8, 0x57, 0xfa, 0x6c, 0x4d, 0xf4, 0xb9, 0x60, 0xee, 0x7c, 0xe6,\r\n  0x82, 0x7e, 0x7a, 0x89, 0xc8, 0x73, 0x43, 0x79, 0x42, 0x0e, 0x1a, 0x4c,\r\n  0xc0, 0xf7, 0x5a, 0xc4, 0x81, 0xb1, 0x18, 0x8d, 0x6f, 0x46, 0x8e, 0x64,\r\n  0x31, 0x60, 0x7b, 0x12, 0x9a, 0x27, 0xc1, 0x79, 0xf9, 0xa1, 0xf6, 0xcb,\r\n  0xa0, 0x6c, 0x80, 0xb9, 0x97, 0xc2, 0x82, 0x56, 0xb3, 0xc4, 0xf8, 0xcb,\r\n  0xf3, 0x1a, 0xb7, 0x91, 0x7b, 0x5d, 0x5c, 0x38, 0x2b, 0x01, 0x1f, 0xfb,\r\n  0x43, 0xf6, 0x37, 0x9f, 0x8a, 0x85, 0x38, 0x25, 0x1b, 0xb4, 0xf7, 0x71,\r\n  0x91, 0x58, 0x12, 0x29, 0x19, 0xda, 0x76, 0xf6, 0x5d, 0x4d, 0x14, 0xae,\r\n  0xd2, 0x01, 0x34, 0x8b, 0x55, 0x50, 0xf7, 0x79, 0x3e, 0x46, 0x15, 0xaf,\r\n  0xa1, 0xce, 0x19, 0xf0, 0x24, 0xc6, 0xa9, 0x25, 0x4e, 0x5f, 0x61, 0xec,\r\n  0x0e, 0xd0, 0x7e, 0x42, 0xef, 0xaf, 0x43, 0x16, 0x12, 0xe0, 0x8d, 0x06,\r\n  0xb2, 0xfa, 0x3a, 0xa9, 0x02, 0x3e, 0x5d, 0x4b, 0xd7, 0xf1, 0xa3, 0x30,\r\n  0xf2, 0x49, 0x88, 0x24, 0x99, 0x7c, 0x23, 0x7d, 0x2b, 0xb5, 0x02, 0x87,\r\n  0x46, 0x25, 0x85, 0x9d, 0x18, 0xb4, 0x3e, 0xb5, 0x15, 0xe3, 0xc5, 0x72,\r\n  0x42, 0x90, 0x56, 0x8d, 0xf6, 0x61, 0x88, 0x7a, 0x90, 0xfd, 0x15, 0xb8,\r\n  0x0b, 0x8c, 0xbe, 0x3a, 0x97, 0x18, 0xfe, 0xd6, 0x08, 0x7d, 0xe0, 0xfd,\r\n  0x29, 0x2b, 0xc1, 0x9f, 0x0d, 0x97, 0x34, 0x79, 0x5f, 0x81, 0x6b, 0x1e,\r\n  0x8f, 0xd9, 0xad, 0x34, 0x3e, 0xf9, 0x9f, 0xc7, 0xa3, 0x10, 0x82, 0xf9,\r\n  0x1b, 0x79, 0x1a, 0x2f, 0x02, 0x44, 0x3f, 0xbf, 0xd6, 0x85, 0xa6, 0x0f,\r\n  0xa8, 0x21, 0x7d, 0x21, 0x16, 0x29, 0x92, 0xad, 0x6b, 0x03, 0x3e, 0xa5,\r\n  0x6b, 0x5e, 0x4d, 0x84, 0x79, 0x5d, 0x2d, 0xbd, 0x16, 0x47, 0x43, 0x15,\r\n  0x2f, 0x96, 0x91, 0xf7, 0x4a, 0x58, 0x54, 0x49, 0x4b, 0xda, 0x3a, 0x36,\r\n  0x32, 0xc1, 0xab, 0xc6, 0x1e, 0x0b, 0x12, 0xdf, 0x76, 0x31, 0xbf, 0x04,\r\n  0x29, 0x2a, 0xb2, 0xec, 0xf4, 0x1e, 0x82, 0xb3, 0x98, 0x00, 0xfe, 0x56,\r\n  0xe8, 0x32, 0xe6, 0x9b, 0x98, 0x6c, 0x52, 0x3c, 0xde, 0x99, 0x42, 0x26,\r\n  0x19, 0xe3, 0x61, 0x45, 0x04, 0xa7, 0x0c, 0xc9, 0x08, 0xe7, 0x89, 0x65,\r\n  0xb7, 0x22, 0x92, 0x18, 0x92, 0x8b, 0x77, 0x00, 0xcb, 0x5d, 0x91, 0x75,\r\n  0x26, 0x21, 0x90, 0x8f, 0x47, 0x20, 0xfd, 0xb1, 0x6c, 0x50, 0xa1, 0x10,\r\n  0xf2, 0x94, 0x54, 0x65, 0xa2, 0xee, 0x35, 0x79, 0xb8, 0x55, 0xdf, 0x8b,\r\n  0x73, 0x34, 0xe1, 0x5d, 0x68, 0x94, 0x99, 0x1f, 0xb5, 0x12, 0x96, 0x92,\r\n  0xeb, 0x59, 0x48, 0x34, 0x53, 0x9f, 0x85, 0x7b, 0x07, 0x4a, 0x0b, 0x56,\r\n  0x37, 0x0d, 0xb0, 0x12, 0xf1, 0x5c, 0xdd, 0x16, 0xcc, 0x98, 0x02, 0xe7,\r\n  0x3b, 0x59, 0x37, 0xf9, 0x4c, 0x99, 0x9a, 0x3a, 0x46, 0x5a, 0xc1, 0x7b,\r\n  0x88, 0x8c, 0x5e, 0x47, 0x95, 0xcb, 0xd9, 0x9a, 0x33, 0x25, 0x22, 0x0d,\r\n  0x81, 0xb8, 0x8e, 0xb0, 0x65, 0x01, 0xc0, 0x3a, 0x52, 0x46, 0x9b, 0xc1,\r\n  0x41, 0xfa, 0x2e, 0x6a, 0x99, 0x0d, 0x68, 0x26, 0xee, 0x5b, 0x05, 0x2e,\r\n  0x6a, 0xf1, 0xd4, 0x20, 0x19, 0x85, 0x61, 0x1c, 0x8f, 0x01, 0x00, 0x6e,\r\n  0x44, 0xb3, 0xa8, 0xc5, 0x2b, 0x85, 0xac, 0x1d, 0x85, 0x79, 0xb9, 0x7a,\r\n  0x88, 0xa5, 0x00, 0x95, 0xdd, 0x9e, 0xda, 0x59, 0x12, 0x5b, 0x3a, 0xa5,\r\n  0xd4, 0x61, 0x6f, 0x27, 0xc4, 0xa0, 0x28, 0xbb, 0x23, 0x72, 0x03, 0x5a,\r\n  0x2a, 0x97, 0x5a, 0xc9, 0xf4, 0x7c, 0x07, 0xbb, 0xb9, 0x01, 0xd5, 0x6b,\r\n  0xc4, 0x4e, 0xe8, 0x8f, 0x5d, 0x89, 0x53, 0x64, 0xf3, 0x89, 0x03, 0xb8,\r\n  0x3e, 0xde, 0x0e, 0x86, 0x02, 0x78, 0x6a, 0xa9, 0xe3, 0x42, 0xd4, 0x01,\r\n  0xa1, 0x0a, 0x21, 0x0a, 0x67, 0x23, 0x8b, 0x9c, 0xde, 0x30, 0x8f, 0x86,\r\n  0x3d, 0x5e, 0x2b, 0x90, 0x27, 0x04, 0xcd, 0x8d, 0x1e, 0x09, 0xdc, 0xef,\r\n  0x3e, 0xaf, 0x13, 0xd5, 0x32, 0xc1, 0xfe, 0x9c, 0x04, 0xfa, 0x0b, 0x0e,\r\n  0x86, 0x21, 0x16, 0xb6, 0xbf, 0x26, 0x59, 0xe3, 0xdc, 0x91, 0x81, 0x4c,\r\n  0xa9, 0x0b, 0x8c, 0x45, 0x56, 0x50, 0xba, 0x8c, 0xd1, 0x0f, 0x52, 0x90,\r\n  0xf2, 0xb2, 0x57, 0x24, 0x38, 0xb6, 0x8c, 0xb9, 0x9e, 0x6b, 0x33, 0xc2,\r\n  0xa6, 0x95, 0x2c, 0xd3, 0xd2, 0x86, 0xc6, 0x9a, 0xa2, 0xc9, 0x07, 0xab,\r\n  0xc6, 0x2d, 0x50, 0xc8, 0xcd, 0x72, 0xcb, 0xc8, 0xc0, 0xd6, 0xe8, 0xed,\r\n  0xb5, 0xc4, 0x07, 0xe5, 0xb7, 0x85, 0xaf, 0x81, 0x53, 0xdb, 0xef, 0xd3,\r\n  0xd2, 0xaa, 0x90, 0x01, 0x14, 0x83, 0x21, 0xcf, 0x02, 0x9e, 0xef, 0x16,\r\n  0x7e, 0xc6, 0xa8, 0xc3, 0x47, 0x92, 0x25, 0xc6, 0xe7, 0x1f, 0x95, 0xa1,\r\n  0x23, 0x14, 0xf8, 0xa5, 0xb3, 0xb3, 0x9d, 0x54, 0xd3, 0x6d, 0xa1, 0x09,\r\n  0xc0, 0x16, 0xcf, 0x40, 0x53, 0xe5, 0xac, 0x83, 0x56, 0xed, 0xb5, 0x56,\r\n  0x80, 0x47, 0xdc, 0x0f, 0x41, 0x6d, 0x85, 0x20, 0xf1, 0x02, 0x12, 0xd5,\r\n  0x22, 0x8a, 0x1d, 0x0e, 0x5a, 0xab, 0xcc, 0x1c, 0x4e, 0xba, 0x0b, 0xbd,\r\n  0x59, 0x2a, 0x7e, 0xed, 0x9e, 0xe0, 0x57, 0x7c, 0x3d, 0x8f, 0x8e, 0xdd,\r\n  0x8b, 0x8a, 0xe3, 0x76, 0xeb, 0x38, 0xa8, 0x57, 0x9d, 0x65, 0xc7, 0xd1,\r\n  0xc1, 0x04, 0x0b, 0xdf, 0xe5, 0x7a, 0xe7, 0xd3, 0x83, 0x1e, 0x08, 0x6e,\r\n  0xcb, 0x52, 0xdd, 0x90, 0x71, 0xfc, 0x01, 0x3e, 0x1d, 0xd0, 0x74, 0x39,\r\n  0xde, 0xf6, 0x20, 0xc7, 0x8c, 0xbd, 0xce, 0x33, 0xfd, 0x89, 0xcb, 0xc4,\r\n  0xe8, 0x00, 0x3e, 0xe9, 0xe2, 0x3e, 0x0e, 0x5e, 0xd9, 0x1d, 0x3d, 0xa9,\r\n  0x9f, 0x01, 0xb6, 0x08, 0xbb, 0x78, 0x9a, 0xa1, 0xc4, 0x41, 0x12, 0x72,\r\n  0xee, 0x8e, 0x60, 0x93, 0x24, 0xb3, 0x80, 0x3d, 0x0c, 0x89, 0xc1, 0x54,\r\n  0x7c, 0x75, 0x6d, 0x48, 0x1b, 0x32, 0x15, 0x99, 0xf7, 0xa8, 0x4d, 0x6c,\r\n  0x13, 0xc4, 0x8f, 0x18, 0xe7, 0x67, 0xec, 0xe2, 0x85, 0xa2, 0xfd, 0xbc,\r\n  0x4d, 0x24, 0x63, 0x56, 0xcf, 0x31, 0xc9, 0x32, 0x3e, 0x2a, 0xab, 0xe5,\r\n  0xa8, 0xcd, 0x22, 0xed, 0xf0, 0x4a, 0xfa, 0x2e, 0x7d, 0x7e, 0x27, 0xcc,\r\n  0x72, 0x02, 0xc6, 0x5f, 0x91, 0xa4, 0xae, 0x86, 0xb6, 0x81, 0x3d, 0xba,\r\n  0x0b, 0x98, 0x83, 0x7e, 0xd1, 0x0d, 0x59, 0xc7, 0xac, 0x69, 0x0a, 0xc2,\r\n  0x14, 0xb1, 0xcf, 0x93, 0x22, 0x25, 0x01, 0x06, 0x16, 0x0b, 0x78, 0xfa,\r\n  0xfe, 0x7d, 0x7b, 0x25, 0x7c, 0x15, 0x38, 0xd8, 0x8a, 0x1a, 0x28, 0x7e,\r\n  0xf6, 0xfe, 0x7d, 0xfd, 0x97, 0x8f, 0x57, 0x66, 0x8f, 0x27, 0xb9, 0x24,\r\n  0xb2, 0xca, 0x4c, 0xc5, 0xc1, 0x2c, 0x1a, 0x99, 0x9f, 0x72, 0xf0, 0xdc,\r\n  0xc7, 0x69, 0x27, 0xd3, 0x9a, 0x5a, 0x7f, 0x22, 0x91, 0x2a, 0x01, 0x55,\r\n  0xcb, 0x35, 0xc1, 0xc4, 0x06, 0x37, 0x74, 0x2a, 0x85, 0xeb, 0x5a, 0x37,\r\n  0xbd, 0xab, 0xf7, 0xb5, 0xd2, 0x34, 0x95, 0x26, 0x48, 0x21, 0x96, 0x32,\r\n  0x30, 0x20, 0x99, 0x5d, 0x65, 0x55, 0x3a, 0xe7, 0x77, 0x50, 0x0a, 0x83,\r\n  0x5e, 0xdf, 0xa5, 0xf9, 0x4f, 0xb3, 0x15, 0xdb, 0x54, 0x5a, 0x1e, 0x95,\r\n  0x3f, 0xe8, 0xea, 0x11, 0x74, 0x4d, 0xfb, 0x3c, 0x7e, 0x88, 0x7c, 0x35,\r\n  0x61, 0xad, 0x03, 0x16, 0x24, 0xd9, 0xa2, 0x5f, 0xc2, 0x68, 0x63, 0x09,\r\n  0x2f, 0x98, 0x8b, 0x21, 0x5e, 0xed, 0x38, 0xcc, 0xee, 0x0e, 0xd2, 0xec,\r\n  0x9e, 0xe4, 0x3d, 0x4d, 0xb6, 0x40, 0xfd, 0x24, 0x47, 0x8d, 0x0c, 0x3d,\r\n  0xbe, 0x65, 0xae, 0xf3, 0x82, 0x16, 0x74, 0xa1, 0x5a, 0x87, 0x80, 0x16,\r\n  0x5b, 0xa0, 0x01, 0xf9, 0x94, 0xab, 0x91, 0x21, 0x00, 0x52, 0xa1, 0xfa,\r\n  0x46, 0x74, 0x30, 0xaf, 0x54, 0x4f, 0x35, 0x9a, 0x72, 0xcc, 0xae, 0xf5,\r\n  0xfa, 0xb1, 0xab, 0x68, 0x2f, 0x3c, 0x86, 0xbf, 0x7d, 0x72, 0x47, 0x30,\r\n  0x47, 0x8f, 0x54, 0xf6, 0x30, 0x05, 0xb8, 0x9c, 0x27, 0xc9, 0x52, 0x51,\r\n  0x15, 0x52, 0xb9, 0x4e, 0xcf, 0xa1, 0x1d, 0x43, 0x51, 0x01, 0x74, 0x17,\r\n  0xaa, 0x59, 0xb3, 0xee, 0x80, 0xeb, 0xed, 0xcd, 0x91, 0x27, 0xbe, 0x67,\r\n  0x9c, 0xa1, 0x5a, 0x35, 0xcf, 0xd5, 0xa6, 0x98, 0x86, 0xa6, 0xce, 0x74,\r\n  0x9f, 0x48, 0xb7, 0x64, 0x3a, 0xcb, 0xba, 0x6c, 0x6e, 0xcb, 0xe8, 0x5c,\r\n  0x37, 0x8a, 0x34, 0xb7, 0x89, 0x18, 0x24, 0xf6, 0x0a, 0x7d, 0x30, 0x91,\r\n  0x72, 0xa2, 0x28, 0xd6, 0x2c, 0x23, 0x02, 0xa8, 0x54, 0xb9, 0xdf, 0x46,\r\n  0x81, 0x68, 0x61, 0x66, 0x66, 0x4c, 0x61, 0x4b, 0xd4, 0x02, 0xf8, 0xdd,\r\n  0x30, 0x23, 0xcc, 0x56, 0xb7, 0x9e, 0xfb, 0xdd, 0xc6, 0x7d, 0x1f, 0xf9,\r\n  0x1d, 0xd0, 0xa6, 0x3a, 0xfe, 0x57, 0x6d, 0x88, 0x0f, 0x56, 0x7b, 0x11,\r\n  0x57, 0xa2, 0x2c, 0x33, 0x3f, 0xa8, 0xa8, 0x1e, 0xc6, 0x45, 0x56, 0x51,\r\n  0x18, 0x18, 0x17, 0xb1, 0xe3, 0xd6, 0x5c, 0x4d, 0xa8, 0x96, 0x1b, 0x4c,\r\n  0xe5, 0x8a, 0xf5, 0x0a, 0x79, 0xfd, 0x31, 0x0f, 0x63, 0x45, 0xfd, 0xdf,\r\n  0x64, 0x6e, 0x0e, 0xed, 0xda, 0x16, 0xff, 0x18, 0xac, 0x7b, 0x8a, 0x13,\r\n  0xc1, 0xd7, 0x5b, 0x39, 0xd4, 0xa0, 0xe3, 0x15, 0x71, 0x33, 0xeb, 0x28,\r\n  0xda, 0xf0, 0x26, 0xe7, 0xa4, 0x55, 0xc7, 0xb3, 0xed, 0xda, 0xd1, 0x37,\r\n  0xdb, 0xa4, 0xbb, 0xda, 0x4e, 0x22, 0x0d, 0x0c, 0x6a, 0x85, 0x13, 0xad,\r\n  0xd3, 0x48, 0x47, 0x16, 0x0a, 0x1e, 0xe1, 0xc2, 0xd2, 0x3b, 0xae, 0x03,\r\n  0xb1, 0x26, 0x97, 0x1b, 0x07, 0x2e, 0x81, 0x7a, 0xe0, 0xf1, 0x74, 0x54,\r\n  0x98, 0xc0, 0x0a, 0x50, 0x23, 0x29, 0x13, 0x06, 0x5e, 0xe6, 0x2a, 0x51,\r\n  0x5a, 0x55, 0xa0, 0x24, 0x99, 0x4d, 0x7b, 0xd3, 0x2f, 0x7d, 0x61, 0xbb,\r\n  0x94, 0xa9, 0x87, 0x00, 0xec, 0xe4, 0x1a, 0x3e, 0x41, 0x11, 0x9f, 0x91,\r\n  0x5c, 0x8c, 0x75, 0x0f, 0x45, 0x8b, 0xa7, 0x0e, 0x7b, 0xb7, 0x12, 0x66,\r\n  0x27, 0xab, 0x6e, 0xe3, 0x04, 0xed, 0xbf, 0x50, 0x48, 0x95, 0x28, 0x5b,\r\n  0x96, 0xce, 0xdb, 0x88, 0xfb, 0x31, 0x7e, 0x28, 0xb6, 0xd8, 0xcf, 0xab,\r\n  0x94, 0x47, 0x24, 0x79, 0xca, 0x47, 0x28, 0xee, 0x59, 0x2a, 0x76, 0xf7,\r\n  0x1a, 0x9a, 0x98, 0xc2, 0x88, 0x0a, 0x95, 0x2a, 0xf4, 0xf9, 0x96, 0x09,\r\n  0xcb, 0xec, 0x71, 0x23, 0xa3, 0xcf, 0x06, 0x69, 0xea, 0x62, 0x15, 0x32,\r\n  0x03, 0x0e, 0xc7, 0xe8, 0x0a, 0x35, 0x3b, 0x44, 0x23, 0xeb, 0xdc, 0x07,\r\n  0x9a, 0xd0, 0x29, 0x25, 0xee, 0xbc, 0xa2, 0x81, 0xfe, 0x08, 0xc8, 0xd6,\r\n  0x14, 0x06, 0x30, 0xd6, 0x09, 0x65, 0x61, 0xab, 0xce, 0x1d, 0xe2, 0xf7,\r\n  0xe1, 0xd9, 0x2c, 0xcb, 0xb9, 0x80, 0x85, 0x06, 0x9c, 0x19, 0x75, 0xfe,\r\n  0x84, 0xfe, 0x73, 0xf2, 0xfa, 0x80, 0xfe, 0x25, 0xd5, 0x41, 0x2e, 0x59,\r\n  0x47, 0x12, 0x90, 0x1a, 0x67, 0x0d, 0x5e, 0x9e, 0x8e, 0xc3, 0xfc, 0x56,\r\n  0x35, 0x9f, 0xdb, 0x27, 0x8f, 0xd3, 0xae, 0x44, 0x77, 0x84, 0x2b, 0x0e,\r\n  0x85, 0xab, 0xc2, 0x37, 0x5c, 0xe9, 0x2a, 0x71, 0x2d, 0x1a, 0xd7, 0xb5,\r\n  0xfa, 0x8d, 0x9a, 0x2b, 0x22, 0x1f, 0x1e, 0x85, 0xac, 0x22, 0x92, 0xd8,\r\n  0x4a, 0x9d, 0x1f, 0x5a, 0x9a, 0x2d, 0x1f, 0x12, 0x0c, 0x87, 0xce, 0xf4,\r\n  0xcf, 0x72, 0x17, 0x8a, 0x0a, 0x3c, 0x6c, 0x57, 0xf9, 0x96, 0xf2, 0xdb,\r\n  0x25, 0xdf, 0x34, 0x64, 0x64, 0x17, 0x0f, 0x35, 0xf6, 0x9f, 0x46, 0x3d,\r\n  0xc8, 0x7a, 0x85, 0x91, 0x0e, 0xab, 0x98, 0x89, 0xa6, 0xf8, 0x48, 0x32,\r\n  0xbb, 0xa2, 0x96, 0x99, 0xa1, 0x9f, 0xb8, 0x0e, 0x06, 0x82, 0x17, 0xb2,\r\n  0x76, 0x97, 0x9a, 0x1b, 0xb5, 0x9a, 0x63, 0x8f, 0x9d, 0xdd, 0x1f, 0x42,\r\n  0xd6, 0x06, 0x8d, 0x9c, 0x6e, 0x0b, 0x05, 0xbe, 0x08, 0x5b, 0xd5, 0xca,\r\n  0x4b, 0x06, 0x09, 0xb2, 0x88, 0x57, 0xbf, 0xb9, 0xc8, 0x2b, 0xb8, 0x05,\r\n  0x35, 0x6d, 0xac, 0xb1, 0xda, 0x98, 0x9e, 0x0e, 0xb0, 0xd8, 0x40, 0x97,\r\n  0x3f, 0x5c, 0x7d, 0x5a, 0x49, 0x65, 0xb1, 0xb3, 0xc5, 0x0f, 0x4c, 0xa0,\r\n  0xf5, 0xeb, 0x7f, 0xc9, 0x99, 0x31, 0x19, 0xa2, 0x90, 0xf5, 0x8d, 0xf2,\r\n  0xf8, 0xb2, 0xbb, 0x85, 0xfe, 0xe8, 0x7a, 0x2f, 0x6b, 0x56, 0xc3, 0x2f,\r\n  0x87, 0xae, 0x07, 0xfc, 0x47, 0x7e, 0xcb, 0x60, 0x83, 0x44, 0x9b, 0xf1,\r\n  0xfa, 0x0b, 0xf1, 0xd9, 0xe8, 0x99, 0xb0, 0xa1, 0xfb, 0x1a, 0x86, 0x12,\r\n  0x46, 0xa4, 0x45, 0x91, 0x35, 0x79, 0x64, 0x49, 0xda, 0x04, 0x70, 0xf1,\r\n  0x07, 0x96, 0x04, 0x0a, 0xdc, 0x70, 0x92, 0xc4, 0x2d, 0xb4, 0xb6, 0x38,\r\n  0xd4, 0xc2, 0x01, 0x56, 0x35, 0xe4, 0x2f, 0xcb, 0x51, 0x70, 0x7b, 0xc7,\r\n  0x80, 0xcf, 0x87, 0x45, 0xe2, 0x98, 0x59, 0xe4, 0xbe, 0x8b, 0x8c, 0x0e,\r\n  0x47, 0x59, 0x0a, 0x9d, 0xd0, 0x6c, 0x87, 0xf0, 0xd1, 0xd2, 0xef, 0xdf,\r\n  0x2f, 0x8f, 0x0f, 0xc6, 0x97, 0xa3, 0xa6, 0xc8, 0x6d, 0xa5, 0x73, 0x68,\r\n  0xe9, 0x70, 0xa5, 0x9f, 0x61, 0xaf, 0x1a, 0x57, 0xde, 0x2a, 0x1c, 0x79,\r\n  0x09, 0xf7, 0x6d, 0x28, 0x7d, 0x2b, 0xdd, 0x6a, 0x80, 0x12, 0xa1, 0x83,\r\n  0x29, 0x04, 0x1a, 0x12, 0x02, 0x7e, 0x93, 0x74, 0x8e, 0x21, 0x50, 0xc7,\r\n  0x48, 0x9d, 0x5e, 0x94, 0xaa, 0xca, 0x71, 0x29, 0xc1, 0x28, 0x9f, 0xb3,\r\n  0x53, 0xa0, 0x83, 0x96, 0xb1, 0xb9, 0x6f, 0xbe, 0x3b, 0xb8, 0x78, 0x73,\r\n  0xf2, 0xe6, 0xab, 0xfd, 0xda, 0x9d, 0x31, 0xcf, 0xf3, 0x32, 0xd1, 0x18,\r\n  0xb5, 0x30, 0x42, 0xca, 0x74, 0x49, 0x7e, 0x5e, 0x50, 0x0e, 0xb9, 0x5d,\r\n  0x98, 0x75, 0x1e, 0x5f, 0x0b, 0xed, 0x55, 0x79, 0x1b, 0x69, 0xd9, 0x62,\r\n  0x10, 0x92, 0xf3, 0x8d, 0x3f, 0x7a, 0xbc, 0x94, 0x58, 0x99, 0x4f, 0x6f,\r\n  0xcb, 0xa7, 0xe2, 0xec, 0xf9, 0x68, 0xe4, 0xf3, 0xf8, 0xec, 0xf0, 0x9b,\r\n  0xf1, 0xd3, 0x00, 0xf7, 0x5c, 0x35, 0x1c, 0x17, 0xca, 0x61, 0x8b, 0x37,\r\n  0xda, 0x69, 0x82, 0x1f, 0x00, 0x3d, 0x3f, 0x52, 0x41, 0xb1, 0xe3, 0x58,\r\n  0x79, 0xda, 0x6b, 0x76, 0x04, 0xb0, 0xa3, 0x27, 0xcd, 0x57, 0x8e, 0x0b,\r\n  0x34, 0x60, 0x85, 0x19, 0x38, 0xc6, 0xd8, 0x87, 0x8e, 0xda, 0x36, 0xc6,\r\n  0x89, 0x1d, 0xb0, 0x60, 0xb7, 0xd0, 0x61, 0x28, 0x5f, 0x0f, 0x67, 0xc1,\r\n  0xa7, 0x83, 0xe6, 0x75, 0x4f, 0x92, 0x82, 0xf4, 0x9f, 0xf9, 0x8a, 0xbf,\r\n  0x2d, 0x75, 0xee, 0x8d, 0x39, 0xc0, 0x81, 0x15, 0x9b, 0xf7, 0xaf, 0xcc,\r\n  0xbc, 0xa1, 0xa9, 0xf9, 0x0a, 0xf5, 0x9d, 0xd5, 0xc5, 0x8e, 0xf5, 0xa9,\r\n  0xfd, 0xed, 0x6d, 0xef, 0xce, 0x11, 0x70, 0xdd, 0xe8, 0xf7, 0xd3, 0x8a,\r\n  0xe5, 0x9b, 0xf1, 0xaf, 0xda, 0x14, 0xf1, 0xc7, 0xed, 0x8a, 0x96, 0x96,\r\n  0xf8, 0x0b, 0x77, 0xc5, 0x67, 0xeb, 0x84, 0x6d, 0x07, 0x1d, 0xfa, 0x07,\r\n  0xf7, 0x85, 0x72, 0xa3, 0xff, 0x6f, 0xb4, 0x2b, 0xe2, 0xe8, 0xe3, 0xf6,\r\n  0x45, 0xdc, 0xdc, 0x18, 0x1d, 0x39, 0xb9, 0xbf, 0x67, 0x65, 0x2c, 0xf4,\r\n  0xe2, 0xd9, 0xd0, 0xf1, 0x7c, 0xfe, 0x8a, 0x1d, 0xf3, 0x4c, 0x47, 0xba,\r\n  0x09, 0x37, 0xa8, 0x06, 0xf8, 0x8c, 0xd8, 0xc8, 0x7c, 0xd1, 0x6b, 0xe8,\r\n  0x46, 0x45, 0x23, 0xd9, 0xb2, 0xcb, 0x60, 0xbd, 0x0c, 0xea, 0xd8, 0x5d,\r\n  0x2d, 0x38, 0xef, 0x2f, 0xdf, 0x6b, 0xff, 0x57, 0x48, 0xa0, 0x67, 0x9e,\r\n  0xa5, 0xf5, 0x63, 0xb6, 0xdc, 0xb3, 0x1b, 0xb7, 0xe5, 0xba, 0x4a, 0x45,\r\n  0x99, 0x6c, 0xfa, 0xad, 0xb7, 0x5c, 0x43, 0xf7, 0x68, 0xe9, 0x55, 0x36,\r\n  0xeb, 0x08, 0xd2, 0x16, 0x64, 0x60, 0x22, 0xb6, 0x1f, 0x52, 0x81, 0xb2,\r\n  0xa5, 0x2a, 0x84, 0x95, 0x2d, 0x66, 0x6c, 0xdd, 0xc7, 0x2e, 0x95, 0x35,\r\n  0xac, 0xf1, 0x6d, 0xb5, 0xc1, 0x5b, 0x77, 0xe6, 0xb3, 0x0f, 0x6e, 0xf6,\r\n  0x9a, 0x3f, 0x9e, 0x3f, 0xac, 0xfb, 0xdd, 0x36, 0xf7, 0x50, 0xd8, 0x6a,\r\n  0x6d, 0x8f, 0x3b, 0x2f, 0x7d, 0x07, 0xa6, 0x0e, 0xc1, 0xd0, 0xf9, 0x87,\r\n  0xef, 0xda, 0x70, 0x9f, 0x3b, 0x31, 0x1a, 0xb5, 0x8a, 0xa1, 0x3c, 0x96,\r\n  0x60, 0xf4, 0x7f, 0x8b, 0x0c, 0x7d, 0xf6, 0x71, 0xdb, 0xf9, 0x5f, 0x71,\r\n  0xb3, 0xfe, 0x6f, 0xb4, 0x79, 0xbb, 0x96, 0x79, 0x53, 0x39, 0x80, 0xc4,\r\n  0x38, 0x94, 0x8b, 0x65, 0x4b, 0x88, 0x3e, 0x9c, 0x12, 0x8f, 0x59, 0x3c,\r\n  0x39, 0xff, 0xf6, 0x93, 0x01, 0xfb, 0xf6, 0xc7, 0x6d, 0x9a, 0xd0, 0xd3,\r\n  0xa3, 0x83, 0xf3, 0x8e, 0x9b, 0xe1, 0x9a, 0x4c, 0xfe, 0x65, 0x3a, 0x64,\r\n  0xb3, 0x8a, 0x5d, 0x50, 0x2f, 0xf4, 0x2f, 0xbc, 0xc5, 0xbb, 0x9c, 0x6c,\r\n  0xe6, 0x24, 0xb4, 0xe7, 0x85, 0x87, 0x50, 0x22, 0xa6, 0x18, 0xa5, 0xda,\r\n  0x67, 0x1c, 0x70, 0x99, 0x2e, 0x66, 0xdb, 0xf2, 0xcf, 0xe1, 0xd5, 0xcf,\r\n  0xb3, 0xb6, 0xa9, 0x17, 0x92, 0x13, 0xd6, 0xd2, 0xc2, 0x94, 0x38, 0x31,\r\n  0xad, 0xd6, 0x15, 0xee, 0x2b, 0xf7, 0xc3, 0x63, 0x1e, 0x69, 0xaa, 0x23,\r\n  0x6c, 0xdf, 0x75, 0x03, 0x43, 0xf7, 0x5a, 0x4c, 0xae, 0x88, 0xde, 0x81,\r\n  0x40, 0x95, 0x7f, 0xbb, 0x1d, 0x34, 0xe4, 0x5a, 0x7f, 0xac, 0xf1, 0x8e,\r\n  0x04, 0x16, 0xff, 0xad, 0x6d, 0xe6, 0xb2, 0xd2, 0x17, 0xe5, 0x43, 0xe2,\r\n  0xfc, 0x6a, 0xfd, 0x92, 0xa7, 0x8f, 0x73, 0xdf, 0xcb, 0x16, 0xa3, 0x72,\r\n  0xa2, 0x5e, 0xcb, 0xa0, 0x0f, 0x6e, 0xd5, 0x85, 0x7e, 0x5b, 0x79, 0x97,\r\n  0xb2, 0x69, 0xba, 0x8c, 0xe7, 0x9a, 0x63, 0x17, 0x3d, 0xc6, 0x03, 0xdf,\r\n  0xa4, 0xd1, 0xae, 0x0f, 0x88, 0x8c, 0xed, 0x66, 0xcd, 0x2d, 0xde, 0xfe,\r\n  0xcc, 0x1f, 0x6a, 0xb1, 0x0d, 0x79, 0x32, 0xb2, 0x14, 0x56, 0xac, 0x1e,\r\n  0x0e, 0xa8, 0xda, 0xe9, 0xc0, 0xae, 0xb3, 0xc8, 0xc3, 0x03, 0xed, 0xa4,\r\n  0x1c, 0x76, 0x92, 0x70, 0xfe, 0xcc, 0xee, 0xf3, 0x4f, 0x76, 0xa3, 0x92,\r\n  0xeb, 0xeb, 0xa6, 0x5c, 0x69, 0x44, 0x5e, 0x7e, 0x3a, 0x7a, 0xb2, 0xfd,\r\n  0x74, 0xf4, 0x34, 0xf2, 0xf5, 0xc8, 0x10, 0x81, 0xd1, 0xe6, 0x49, 0x74,\r\n  0xb6, 0x58, 0x09, 0x0c, 0xf0, 0xf2, 0xe6, 0xf8, 0x90, 0xb5, 0x11, 0x4b,\r\n  0xb9, 0x6c, 0x18, 0x78, 0x46, 0x8b, 0x43, 0x13, 0x67, 0x34, 0xef, 0x5d,\r\n  0x46, 0x69, 0xc7, 0x74, 0xd8, 0xd6, 0x04, 0x42, 0x3d, 0x73, 0x1d, 0x61,\r\n  0x59, 0x29, 0xbb, 0x54, 0xa7, 0xa5, 0x93, 0x82, 0x21, 0x9c, 0x92, 0x60,\r\n  0xc2, 0x46, 0x8f, 0x33, 0x9b, 0x97, 0x15, 0x59, 0xa9, 0x45, 0x37, 0x4a,\r\n  0xe6, 0xc2, 0x4a, 0xc0, 0x23, 0x16, 0xc6, 0x55, 0x12, 0xb5, 0x1c, 0xae,\r\n  0xbc, 0x63, 0x00, 0xf2, 0x5a, 0x4e, 0x81, 0xa1, 0x3f, 0x1e, 0x2b, 0xc7,\r\n  0x2c, 0x24, 0xf0, 0xe0, 0x2a, 0x47, 0x3d, 0xb9, 0xfe, 0xb0, 0x6f, 0xd7,\r\n  0x94, 0x61, 0x47, 0xf8, 0x63, 0x55, 0x92, 0x75, 0xf1, 0xdb, 0xfe, 0xe6,\r\n  0x7a, 0x6b, 0xc5, 0xb7, 0x41, 0x95, 0xcc, 0xb3, 0xa4, 0xd2, 0x22, 0x45,\r\n  0xd1, 0x8b, 0xb3, 0xf3, 0xcb, 0x97, 0x77, 0xf1, 0xbc, 0x85, 0x71, 0x60,\r\n  0xba, 0x32, 0x2b, 0xe9, 0xa4, 0xe3, 0x97, 0x37, 0x83, 0xe4, 0xa0, 0xb1,\r\n  0xcb, 0x91, 0x09, 0x8a, 0x3f, 0xb5, 0x72, 0x61, 0x2e, 0x2f, 0xff, 0x76,\r\n  0x7e, 0xfc, 0xf2, 0x45, 0x95, 0x14, 0x8b, 0xcf, 0xd9, 0x21, 0xad, 0x1e,\r\n  0x7d, 0x71, 0x49, 0xcd, 0xb9, 0x78, 0x60, 0xfb, 0x66, 0xfc, 0xfe, 0xe8,\r\n  0x64, 0x7c, 0x7e, 0x7a, 0x76, 0xf8, 0xf2, 0xc5, 0xf7, 0x1c, 0xc2, 0xa3,\r\n  0xd9, 0x7b, 0x08, 0xde, 0x75, 0x3f, 0x73, 0x70, 0xff, 0x76, 0x21, 0x8f,\r\n  0xe3, 0xef, 0xde, 0x1d, 0xbf, 0xf9, 0xf6, 0xe5, 0x8b, 0xbb, 0xb8, 0x18,\r\n  0xf0, 0xf8, 0xe4, 0x6d, 0xa6, 0xd5, 0xe8, 0xa8, 0xa5, 0x17, 0xcc, 0xd1,\r\n  0x25, 0x2a, 0xbb, 0x2c, 0x19, 0x3b, 0xf7, 0x08, 0xac, 0x0a, 0x52, 0xd6,\r\n  0x97, 0xce, 0xa8, 0xef, 0x8e, 0x00, 0xc2, 0xa5, 0x33, 0xe7, 0x40, 0x61,\r\n  0x6f, 0x2f, 0x4e, 0xa1, 0xb5, 0x77, 0x96, 0xba, 0x90, 0x3a, 0x9f, 0x9e,\r\n  0x5b, 0x58, 0x7d, 0x43, 0xbe, 0x61, 0x10, 0xf9, 0x1e, 0xba, 0xe4, 0x2e,\r\n  0xe5, 0xe6, 0x7b, 0x14, 0x43, 0x26, 0xb2, 0xcb, 0xc3, 0x49, 0x5d, 0x59,\r\n  0x1b, 0x01, 0x91, 0xd0, 0x10, 0x52, 0x64, 0x90, 0x6f, 0x1b, 0x32, 0x63,\r\n  0xde, 0x76, 0x79, 0x05, 0x29, 0x0b, 0x08, 0x3e, 0x43, 0xab, 0x61, 0x08,\r\n  0x04, 0xc6, 0x77, 0x28, 0x94, 0xa0, 0x92, 0xa1, 0x51, 0x1f, 0x85, 0x12,\r\n  0x29, 0x75, 0xf3, 0xef, 0x72, 0xed, 0x91, 0x1b, 0x86, 0x86, 0x5b, 0xbf,\r\n  0x0a, 0xd9, 0xbf, 0x75, 0xf0, 0xbf, 0xa5, 0x66, 0x05, 0xa4, 0xc8, 0x1d,\r\n  0xe9, 0x61, 0x75, 0x22, 0x41, 0x89, 0xc4, 0xb1, 0x4a, 0xc9, 0xb9, 0x6b,\r\n  0x9c, 0x7e, 0xe8, 0x90, 0xb3, 0xb2, 0xb0, 0x9e, 0x86, 0xb6, 0x1d, 0xcb,\r\n  0x43, 0x25, 0x4f, 0x77, 0xe6, 0xec, 0xb0, 0xe5, 0x8e, 0x7f, 0x77, 0x73,\r\n  0xbc, 0xe5, 0xd2, 0xfd, 0xb8, 0xc5, 0xf3, 0xb7, 0x97, 0x41, 0xa6, 0x67,\r\n  0x0b, 0xad, 0xd5, 0x3a, 0x84, 0x4d, 0x45, 0xd9, 0x4f, 0x54, 0x6f, 0xd8,\r\n  0x6b, 0x92, 0x64, 0x9b, 0xa7, 0x9f, 0x24, 0x03, 0x57, 0xa3, 0xf4, 0xa9,\r\n  0xe4, 0x71, 0x27, 0xd1, 0xb3, 0xa4, 0x3a, 0x45, 0x07, 0x0a, 0xc3, 0x49,\r\n  0x98, 0xc9, 0xb9, 0xf1, 0x8d, 0x51, 0x8f, 0xfd, 0xac, 0x9e, 0x1c, 0x51,\r\n  0x02, 0x4f, 0x5b, 0xad, 0xa4, 0xb6, 0x07, 0xcd, 0xa1, 0xf5, 0x5a, 0x7c,\r\n  0xc8, 0x3a, 0xc9, 0x5d, 0x6d, 0x74, 0x0d, 0x61, 0x85, 0x09, 0xed, 0xbc,\r\n  0x0e, 0x3e, 0x68, 0x48, 0x6a, 0x30, 0x0c, 0x4b, 0x6d, 0x48, 0x4e, 0xce,\r\n  0x06, 0xe6, 0xc9, 0xa8, 0x63, 0x95, 0xa3, 0xdb, 0x42, 0x6a, 0xd2, 0x26,\r\n  0x94, 0xf9, 0x2e, 0xd2, 0x1c, 0x59, 0xc4, 0x8e, 0x49, 0xfd, 0x5b, 0x43,\r\n  0x41, 0x66, 0x51, 0x38, 0xbc, 0xf4, 0xa8, 0x35, 0x06, 0x9d, 0x75, 0x02,\r\n  0x90, 0x50, 0x2a, 0x64, 0x78, 0xd9, 0xe2, 0xe3, 0xe2, 0x17, 0x18, 0xb2,\r\n  0x15, 0x40, 0xb9, 0x81, 0x90, 0xe4, 0xb1, 0xcb, 0x4e, 0xd2, 0x8c, 0x13,\r\n  0x28, 0x15, 0x23, 0x05, 0x90, 0x72, 0x38, 0x64, 0x4d, 0x5e, 0x6f, 0x19,\r\n  0xf5, 0xae, 0xe7, 0xf9, 0x64, 0x42, 0x83, 0xea, 0xd9, 0x1d, 0x47, 0x3d,\r\n  0x8c, 0x8b, 0x6b, 0x28, 0xbd, 0x03, 0x63, 0x6b, 0xf3, 0x87, 0x15, 0x6c,\r\n  0xfc, 0xf8, 0xd6, 0xba, 0xdc, 0x54, 0x5e, 0x5d, 0x0d, 0xed, 0xe8, 0xaa,\r\n  0x82, 0x2a, 0xff, 0x21, 0xa8, 0xe3, 0x23, 0x48, 0x24, 0xfc, 0x3c, 0xb2,\r\n  0xef, 0xb7, 0x60, 0xac, 0x9c, 0x4b, 0xe9, 0xb3, 0x1e, 0x55, 0xf8, 0x40,\r\n  0xe4, 0x28, 0x4b, 0x7a, 0x5a, 0xae, 0x29, 0x84, 0x7c, 0x19, 0xf5, 0xfe,\r\n  0x93, 0x7b, 0xb1, 0x3b, 0xe0, 0x3f, 0xf7, 0xfe, 0xd9, 0x0b, 0x8b, 0x38,\r\n  0x4b, 0xe7, 0x2b, 0xa6, 0x1f, 0x2f, 0x8d, 0x80, 0xbf, 0x83, 0x6f, 0x9f,\r\n  0x81, 0x6a, 0x6b, 0x5b, 0x4f, 0x17, 0xd7, 0x3f, 0xec, 0x0e, 0x77, 0x77,\r\n  0x76, 0x76, 0x7e, 0x1a, 0x2d, 0x79, 0xea, 0xae, 0xd0, 0x3c, 0xfd, 0x39,\r\n  0x5a, 0xa6, 0x53, 0x76, 0xe4, 0xd3, 0x62, 0xa6, 0x31, 0x0a, 0x45, 0xcb,\r\n  0xf7, 0xb6, 0x83, 0x9b, 0xbf, 0x9a, 0x2e, 0x87, 0x59, 0xde, 0x05, 0x11,\r\n  0xb9, 0x5c, 0x15, 0x59, 0x14, 0x54, 0x92, 0x7a, 0xf7, 0xe6, 0xec, 0xe8,\r\n  0xf8, 0xf4, 0xe0, 0x6f, 0x86, 0x31, 0x75, 0xbc, 0x01, 0xdc, 0x93, 0x77,\r\n  0x49, 0x5c, 0x3e, 0xbc, 0x2b, 0x93, 0x8a, 0x7e, 0xb9, 0xf9, 0x64, 0x8b,\r\n  0x11, 0x58, 0xad, 0xaa, 0x8d, 0xd7, 0x49, 0xad, 0xfa, 0xac, 0x22, 0x76,\r\n  0xfc, 0xed, 0xdd, 0xd0, 0x51, 0x76, 0xeb, 0xc0, 0xcf, 0x8a, 0xe3, 0x21,\r\n  0x93, 0xf9, 0x6d, 0x99, 0xfe, 0x83, 0xee, 0x1d, 0xe6, 0xb6, 0x6b, 0xe3,\r\n  0x79, 0x2f, 0x95, 0x41, 0xa0, 0x8a, 0xf8, 0x6f, 0xd1, 0x97, 0xa7, 0xdf,\r\n  0x30, 0x8c, 0xda, 0xd9, 0x34, 0x0b, 0x49, 0x59, 0x8f, 0x3e, 0x7f, 0xb6,\r\n  0xbb, 0xb7, 0x15, 0x54, 0xe8, 0xe5, 0x64, 0x0c, 0x3e, 0x9c, 0xad, 0xb0,\r\n  0xf2, 0x3f, 0x34, 0x40, 0x1e, 0x48, 0x65, 0x1f, 0x61, 0x04, 0xb6, 0xc3,\r\n  0xae, 0x39, 0x90, 0xae, 0x01, 0xdf, 0x5b, 0x81, 0xe6, 0x8e, 0x13, 0x25,\r\n  0x5a, 0x64, 0x31, 0x97, 0x3e, 0x2b, 0x66, 0x14, 0x14, 0x9e, 0x8a, 0xa8,\r\n  0x3b, 0x9a, 0x5f, 0xd1, 0xad, 0x9b, 0xfc, 0xd6, 0xba, 0xce, 0x07, 0x23,\r\n  0x55, 0x34, 0xdb, 0xf3, 0x92, 0x79, 0x59, 0x58, 0xff, 0x88, 0x5e, 0xd8,\r\n  0xdf, 0x3e, 0x6f, 0x23, 0xcb, 0x22, 0x84, 0xd9, 0x9a, 0x14, 0x2e, 0x50,\r\n  0x5b, 0x50, 0x74, 0x93, 0x21, 0x7d, 0x9e, 0x33, 0xdf, 0xa5, 0xf5, 0xcb,\r\n  0x39, 0xea, 0x8e, 0xbb, 0x43, 0xb4, 0xf5, 0xc6, 0x17, 0xe7, 0xbd, 0x81,\r\n  0x06, 0xf0, 0xe8, 0x1b, 0x43, 0xfa, 0x77, 0x24, 0x75, 0xee, 0xa3, 0x67,\r\n  0x3b, 0xcf, 0x9e, 0xaa, 0x7f, 0x0f, 0x1d, 0x5d, 0x69, 0x61, 0xeb, 0x96,\r\n  0x66, 0x4d, 0xbf, 0x73, 0x85, 0xdf, 0x40, 0xfd, 0xe0, 0xf3, 0xcc, 0x68,\r\n  0xe7, 0xd5, 0x07, 0x29, 0x1e, 0x13, 0x29, 0xca, 0xf2, 0x18, 0x2a, 0x40,\r\n  0xd7, 0x0c, 0x32, 0x05, 0x9d, 0x6c, 0x17, 0xe5, 0x7c, 0xda, 0x98, 0x48,\r\n  0xf4, 0xef, 0x05, 0xff, 0xd9, 0x35, 0x81, 0xc8, 0x1c, 0xf5, 0x56, 0x19,\r\n  0x76, 0x96, 0xf1, 0xdb, 0xf0, 0xe4, 0x76, 0x53, 0x2c, 0xad, 0x8d, 0xa2,\r\n  0x18, 0x93, 0x72, 0x30, 0xb6, 0x91, 0x05, 0x46, 0x4b, 0xcb, 0xb6, 0xa8,\r\n  0x4f, 0x8d, 0x08, 0xe5, 0x36, 0xfa, 0x99, 0x4e, 0xf3, 0x87, 0x07, 0xe7,\r\n  0x5a, 0x79, 0x61, 0x7f, 0xeb, 0x1c, 0xa4, 0xff, 0xd8, 0xef, 0x3f, 0x48,\r\n  0x8c, 0xd1, 0xcf, 0xbc, 0x1b, 0x9e, 0x8c, 0xe8, 0x71, 0xc4, 0x67, 0x7d,\r\n  0x78, 0xc5, 0xd0, 0x50, 0xed, 0xdd, 0x24, 0xaf, 0x17, 0x8a, 0x7f, 0x89,\r\n  0x51, 0x15, 0x9b, 0x31, 0x16, 0xd4, 0xd4, 0xa5, 0x8a, 0x84, 0xe1, 0xb1,\r\n  0xbe, 0xeb, 0x61, 0x8c, 0x72, 0xe9, 0xb4, 0xa1, 0x87, 0x7a, 0xd9, 0x39,\r\n  0xcc, 0x56, 0x59, 0xaf, 0xbf, 0x23, 0xd1, 0xbe, 0x55, 0x66, 0x1f, 0xd1,\r\n  0x64, 0x59, 0x96, 0x36, 0xa2, 0x15, 0xb4, 0xd0, 0x3a, 0xd3, 0x24, 0x55,\r\n  0x0a, 0xca, 0x0f, 0x41, 0x5c, 0x3f, 0xa9, 0x0f, 0x98, 0xb9, 0x47, 0x3a,\r\n  0x95, 0x7a, 0x57, 0xee, 0x2a, 0xe6, 0x88, 0x3d, 0x87, 0xf9, 0xe5, 0xe1,\r\n  0x68, 0xb6, 0x5a, 0x2c, 0x8d, 0x17, 0x20, 0xcd, 0x14, 0x25, 0xc9, 0xfd,\r\n  0x25, 0xe9, 0x7e, 0x9d, 0x9b, 0x58, 0x1c, 0x74, 0x96, 0x98, 0xc7, 0x6f,\r\n  0x13, 0xa1, 0x27, 0x64, 0x5c, 0x74, 0x50, 0x09, 0x74, 0xe0, 0xd2, 0xf3,\r\n  0xa1, 0xbd, 0xa9, 0x12, 0x24, 0x4a, 0xdc, 0xdb, 0x56, 0x2c, 0x96, 0x75,\r\n  0x2e, 0x06, 0x36, 0x30, 0x1a, 0x46, 0x55, 0x5e, 0x57, 0xd7, 0xd9, 0xca,\r\n  0x40, 0x27, 0x02, 0x4f, 0x5e, 0x63, 0x48, 0x76, 0x3b, 0xef, 0x43, 0xf7,\r\n  0x26, 0x00, 0x18, 0xc3, 0x3b, 0x2d, 0xb8, 0x39, 0xc9, 0xcb, 0x44, 0x50,\r\n  0xf5, 0x98, 0x87, 0x96, 0xd3, 0xa1, 0x9c, 0xa6, 0xe9, 0xef, 0x19, 0x65,\r\n  0x91, 0xaf, 0xe2, 0x33, 0x8f, 0x2f, 0x58, 0x2c, 0xcb, 0x25, 0xab, 0x15,\r\n  0x2e, 0x96, 0x5f, 0x2d, 0xf1, 0x25, 0xba, 0xf5, 0xfa, 0x3f, 0x68, 0xc1,\r\n  0xe8, 0xff, 0xdf, 0xb5, 0x2a, 0x07, 0x63, 0xa8, 0x42, 0x07, 0x3a, 0x4f,\r\n  0x62, 0x4e, 0xed, 0x35, 0x1f, 0xe8, 0x4d, 0xf2, 0x5e, 0xac, 0xc7, 0xf6,\r\n  0x6d, 0xa1, 0x57, 0xd3, 0x0d, 0x3b, 0x5e, 0xf0, 0xec, 0xc1, 0xf8, 0xf0,\r\n  0xe4, 0xa4, 0x56, 0xc7, 0x86, 0x27, 0x4f, 0xd0, 0xf1, 0x00, 0x34, 0x95,\r\n  0x9c, 0x27, 0xc0, 0x78, 0x2a, 0x74, 0xb7, 0x65, 0xb4, 0x72, 0x8a, 0x1c,\r\n  0xa8, 0x05, 0xb9, 0xbc, 0x59, 0x5c, 0xa6, 0x96, 0x93, 0x18, 0x0b, 0xda,\r\n  0x67, 0x95, 0xb1, 0x79, 0xc9, 0xe0, 0xf0, 0x9b, 0x15, 0x29, 0x4b, 0xe5,\r\n  0x6f, 0xbd, 0x21, 0x47, 0xbf, 0xf7, 0xd6, 0xeb, 0x48, 0x1e, 0x3b, 0x2f,\r\n  0x34, 0xbf, 0x4d, 0x80, 0xdf, 0x9a, 0xfd, 0xc5, 0x14, 0x24, 0x6c, 0x42,\r\n  0xc8, 0x0e, 0xa4, 0x1e, 0x5a, 0x67, 0x61, 0x5f, 0xd8, 0x95, 0xd4, 0xc1,\r\n  0x19, 0xa8, 0x7e, 0x8c, 0xb2, 0x59, 0x96, 0xef, 0x69, 0x4d, 0x55, 0x71,\r\n  0xd5, 0x66, 0xe5, 0x8a, 0xdd, 0x5f, 0x7b, 0x0d, 0x05, 0x69, 0x5e, 0x6b,\r\n  0x8a, 0xc3, 0x86, 0xb5, 0x84, 0xc4, 0xf8, 0x7a, 0xbc, 0x58, 0xdc, 0x28,\r\n  0x3a, 0x73, 0x0b, 0x33, 0xcc, 0x06, 0xbe, 0xae, 0x36, 0xc0, 0x5d, 0xf5,\r\n  0x7a, 0xd7, 0xeb, 0x6a, 0x13, 0x83, 0x46, 0xe9, 0x3a, 0xbd, 0x4b, 0x1a,\r\n  0x1d, 0xdb, 0x34, 0xdf, 0x3d, 0xbb, 0xfb, 0x0b, 0x89, 0x4e, 0x70, 0x34,\r\n  0x2d, 0xcf, 0xb6, 0x3a, 0x27, 0x0b, 0x8b, 0xb5, 0x24, 0xad, 0x73, 0x69,\r\n  0xe9, 0x44, 0x36, 0xac, 0xf5, 0x35, 0xeb, 0xe0, 0xe6, 0xe0, 0x9a, 0xa1,\r\n  0xe7, 0x27, 0x43, 0x4d, 0xca, 0xd4, 0xd2, 0x7e, 0xc2, 0x74, 0xc3, 0xe3,\r\n  0x98, 0xe5, 0xcd, 0x22, 0x86, 0x5d, 0x33, 0xe1, 0x6b, 0x22, 0x48, 0x99,\r\n  0xaa, 0x1a, 0x8b, 0xe7, 0x6a, 0xd9, 0x18, 0x9b, 0x26, 0xfd, 0x68, 0xff,\r\n  0x9a, 0xf7, 0x3b, 0xf2, 0xca, 0xa5, 0x7a, 0x71, 0xe8, 0x8e, 0x9a, 0x3c,\r\n  0x48, 0x72, 0xa6, 0x63, 0x7a, 0xd2, 0x88, 0x8d, 0x58, 0x75, 0x98, 0x99,\r\n  0x2e, 0x8a, 0xc6, 0x60, 0xd3, 0xef, 0x93, 0xd4, 0x59, 0x45, 0xfb, 0xbd,\r\n  0xdf, 0x51, 0x2c, 0xbf, 0x75, 0x21, 0xa5, 0xdf, 0x7e, 0x4b, 0xb6, 0x4a,\r\n  0x54, 0x77, 0x6e, 0xc9, 0xff, 0x7f, 0xb1, 0xfd, 0x62, 0xbf, 0xfd, 0x7d,\r\n  0x17, 0x7b, 0xc8, 0xe3, 0x7e, 0xf1, 0xf6, 0xe2, 0x74, 0xdd, 0xba, 0xc6,\r\n  0x70, 0x2a, 0x70, 0x26, 0x29, 0x17, 0xe5, 0xab, 0xe3, 0xee, 0x41, 0x3d,\r\n  0x9b, 0x97, 0x8c, 0xc8, 0xa2, 0x9b, 0x2f, 0x9b, 0x3d, 0x04, 0x39, 0xd0,\r\n  0xad, 0x4c, 0x12, 0xbd, 0x08, 0xb5, 0x59, 0x6a, 0x94, 0x33, 0xdd, 0x80,\r\n  0xd4, 0x0b, 0xd8, 0xf7, 0x3e, 0x10, 0xb7, 0x35, 0xb7, 0x95, 0x30, 0x0c,\r\n  0xd6, 0x48, 0xd2, 0x94, 0xc0, 0xeb, 0x32, 0x77, 0x55, 0x60, 0xe0, 0xb2,\r\n  0xe9, 0x9a, 0x5c, 0x1e, 0x10, 0xa7, 0x05, 0x8b, 0x63, 0x7e, 0xe0, 0x90,\r\n  0xfc, 0xb5, 0x7a, 0x8d, 0x0a, 0xb9, 0x45, 0xb6, 0xa4, 0x4f, 0x61, 0xec,\r\n  0x72, 0x4d, 0xaa, 0x6b, 0xdc, 0x5d, 0x56, 0xb5, 0xdb, 0xac, 0x23, 0x09,\r\n  0xc3, 0x88, 0x62, 0x30, 0xa1, 0xd0, 0x55, 0xc0, 0x27, 0x6f, 0x57, 0xca,\r\n  0x76, 0x15, 0xcf, 0x6f, 0x91, 0x62, 0x37, 0x8a, 0x5e, 0xcb, 0xe4, 0x52,\r\n  0x07, 0x99, 0x3c, 0xaf, 0x8b, 0xce, 0x70, 0xb2, 0xba, 0xbe, 0x06, 0x59,\r\n  0xf6, 0x81, 0xdc, 0x44, 0xa5, 0x95, 0x7a, 0x81, 0x75, 0xd1, 0xff, 0xbc,\r\n  0xaf, 0xe9, 0x4c, 0xbd, 0x1b, 0xba, 0xb4, 0x19, 0x00, 0x4a, 0x6a, 0x51,\r\n  0x4f, 0x99, 0xf3, 0x5a, 0xac, 0x2b, 0x7c, 0x08, 0x06, 0x51, 0xff, 0x45,\r\n  0xf7, 0x4b, 0xa2, 0x91, 0x6b, 0xb5, 0x55, 0xe7, 0x13, 0xa6, 0x89, 0xbc,\r\n  0x49, 0xe9, 0x62, 0xcb, 0xda, 0xa8, 0x4e, 0x49, 0x43, 0x94, 0x18, 0x9d,\r\n  0x92, 0xf1, 0x77, 0x76, 0xf2, 0xcf, 0xf6, 0x3d, 0x23, 0xc1, 0x07, 0x25,\r\n  0xd1, 0x55, 0xde, 0xe2, 0x08, 0x54, 0x3a, 0x12, 0xfd, 0x7e, 0x77, 0x6d,\r\n  0x6f, 0xbd, 0x8a, 0x53, 0x13, 0x19, 0xa2, 0x13, 0x61, 0xfb, 0x49, 0x4e,\r\n  0x96, 0x8c, 0xc9, 0x91, 0xbb, 0xcb, 0x72, 0xd3, 0x8a, 0xa5, 0x6d, 0x12,\r\n  0x51, 0xd1, 0x17, 0x13, 0xaf, 0x03, 0x79, 0xf6, 0x6b, 0x24, 0xf2, 0x17,\r\n  0x8c, 0xf9, 0xcf, 0x6f, 0xb5, 0x88, 0xe5, 0xba, 0xdb, 0xd1, 0x9c, 0xe0,\r\n  0xfe, 0xdc, 0x08, 0x9e, 0xd5, 0xb0, 0xb8, 0xb8, 0x38, 0xf9, 0x41, 0xab,\r\n  0xff, 0xae, 0xce, 0xa5, 0x41, 0x9b, 0x0a, 0x53, 0xb2, 0x33, 0x2d, 0x33,\r\n  0xca, 0x29, 0x23, 0x75, 0x4d, 0xda, 0xc2, 0x56, 0xbf, 0x56, 0x19, 0xab,\r\n  0x35, 0x16, 0x2a, 0x63, 0x1d, 0x1e, 0xee, 0x10, 0xd5, 0x5f, 0xe7, 0xb8,\r\n  0x03, 0x90, 0x3f, 0x10, 0x34, 0xf7, 0xfc, 0x20, 0x02, 0x6f, 0x7c, 0xc2,\r\n  0x48, 0xdd, 0x87, 0xce, 0xdd, 0x94, 0x3a, 0x47, 0xca, 0x0c, 0x68, 0x4e,\r\n  0x58, 0x0b, 0x03, 0x61, 0xd2, 0x58, 0x85, 0x76, 0xa4, 0x92, 0x6c, 0x47,\r\n  0xce, 0x93, 0x2a, 0x11, 0x0f, 0xad, 0x52, 0x4c, 0xb6, 0xec, 0x6c, 0xae,\r\n  0x89, 0x61, 0xa1, 0x00, 0x49, 0x43, 0x95, 0xef, 0x6a, 0x81, 0x6a, 0x29,\r\n  0x40, 0xaa, 0x5b, 0x06, 0xc2, 0x45, 0x53, 0xe5, 0x23, 0x89, 0xe7, 0xb5,\r\n  0x02, 0x93, 0xef, 0x59, 0x21, 0x7e, 0x9f, 0x38, 0x92, 0xbf, 0x50, 0x02,\r\n  0xb9, 0x22, 0xa2, 0xf2, 0x21, 0x6d, 0x3c, 0xe0, 0x84, 0xe9, 0xc4, 0x06,\r\n  0xb2, 0x05, 0xd1, 0x93, 0x67, 0x7b, 0x03, 0xa3, 0x8b, 0x10, 0x0d, 0x5b,\r\n  0xaa, 0x20, 0x81, 0xc7, 0x66, 0xba, 0x62, 0xcb, 0x00, 0x6e, 0x7e, 0xec,\r\n  0xea, 0xee, 0xe6, 0x1e, 0x24, 0xd9, 0xb2, 0xf7, 0x85, 0x99, 0x24, 0x3d,\r\n  0xcb, 0x04, 0x64, 0x8e, 0x0a, 0x57, 0xa8, 0xc9, 0x54, 0xf8, 0xca, 0x4f,\r\n  0x47, 0x87, 0xab, 0x4f, 0x7c, 0xf4, 0x48, 0x8a, 0x45, 0x99, 0xcd, 0xde,\r\n  0x17, 0xc3, 0x5e, 0x27, 0x6f, 0xaf, 0x2f, 0x9e, 0xaa, 0x84, 0xea, 0xf5,\r\n  0xa3, 0x65, 0x9f, 0xf0, 0xf5, 0x61, 0xb9, 0xf4, 0x42, 0x95, 0x56, 0xab,\r\n  0xb6, 0xf7, 0x4c, 0x99, 0xb2, 0xa2, 0x08, 0xae, 0x51, 0xc8, 0x60, 0x9e,\r\n  0x72, 0xef, 0xbf, 0xc4, 0x59, 0x62, 0x93, 0xab, 0x02, 0x32, 0x47, 0xcc,\r\n  0x38, 0xa6, 0x06, 0x04, 0x11, 0x64, 0xd3, 0x5e, 0x38, 0x98, 0x87, 0xa5,\r\n  0x5d, 0xeb, 0xde, 0x33, 0x7a, 0xfb, 0x4f, 0xff, 0x69, 0xbf, 0x04, 0xf7,\r\n  0xd6, 0x3f, 0xcd, 0xd7, 0x6f, 0xc1, 0x8a, 0xb8, 0x5b, 0x9e, 0x45, 0x7f,\r\n  0xf2, 0x4a, 0xaf, 0x4c, 0x0d, 0x88, 0x01, 0xb8, 0xc1, 0x3f, 0x8d, 0x5c,\r\n  0x88, 0xc2, 0x6a, 0xa3, 0x46, 0x59, 0x72, 0x0f, 0xa1, 0xd7, 0x92, 0xb6,\r\n  0x72, 0x8c, 0x7f, 0xcc, 0xb8, 0x52, 0xcc, 0x34, 0xa6, 0xe3, 0xc8, 0xce,\r\n  0x65, 0x49, 0xb7, 0x95, 0xed, 0xf5, 0x63, 0xa1, 0x42, 0xb3, 0x8a, 0x27,\r\n  0xc2, 0x7d, 0xa8, 0x3f, 0x6f, 0x1b, 0x92, 0x1c, 0xff, 0xdb, 0xc7, 0x6a,\r\n  0xfc, 0x69, 0x28, 0xc4, 0x6a, 0xba, 0xc3, 0x95, 0x27, 0xd1, 0x7e, 0x26,\r\n  0x0b, 0x73, 0x9f, 0x66, 0x4f, 0xf6, 0x86, 0x81, 0xae, 0x32, 0xe8, 0x84,\r\n  0x50, 0x88, 0x85, 0x9d, 0x4f, 0xa5, 0x12, 0x27, 0x33, 0x2f, 0x82, 0x04,\r\n  0xe3, 0x4f, 0x9a, 0x99, 0x2f, 0x19, 0x5e, 0x2b, 0x28, 0x61, 0x41, 0xcd,\r\n  0x99, 0xb5, 0x6e, 0xc7, 0x0f, 0x6c, 0x1e, 0x4f, 0x9c, 0xd1, 0x15, 0x63,\r\n  0xe6, 0x73, 0x49, 0x1d, 0x7d, 0x07, 0x3f, 0xa7, 0xbc, 0x7a, 0x28, 0x3f,\r\n  0x1a, 0x5e, 0xf2, 0x8f, 0x0c, 0x4e, 0xa0, 0xf9, 0x53, 0x49, 0x50, 0x30,\r\n  0x9b, 0xb3, 0xb4, 0xae, 0x1e, 0x2f, 0x61, 0x21, 0x81, 0x4d, 0xc6, 0x2c,\r\n  0xd1, 0x91, 0x6e, 0xf5, 0xd3, 0x4e, 0xd3, 0x3b, 0x57, 0x90, 0xfe, 0xf1,\r\n  0xd6, 0x90, 0x55, 0xc7, 0xc1, 0x9b, 0x45, 0x6c, 0x3c, 0x21, 0xa2, 0x45,\r\n  0x06, 0x7e, 0x78, 0x41, 0x20, 0x48, 0xba, 0xef, 0xe8, 0x43, 0xcd, 0x89,\r\n  0x93, 0x00, 0x37, 0x59, 0x50, 0xec, 0x87, 0xae, 0x38, 0x4b, 0x1c, 0xae,\r\n  0xf2, 0x39, 0x76, 0xae, 0xb4, 0xfb, 0x81, 0xb1, 0xe6, 0xe2, 0xff, 0x42,\r\n  0x20, 0x2e, 0x60, 0x5c, 0xaf, 0x53, 0x42, 0x40, 0xee, 0x77, 0x7a, 0x05,\r\n  0xa2, 0xce, 0xb5, 0x8d, 0x4e, 0x90, 0xb3, 0x96, 0x4b, 0xe0, 0x19, 0xdd,\r\n  0x03, 0x1d, 0xe2, 0xc4, 0x28, 0xda, 0xdc, 0x97, 0x1e, 0x6f, 0xce, 0xf5,\r\n  0x42, 0xae, 0xe9, 0x61, 0xa0, 0x61, 0x8d, 0x9a, 0x78, 0xff, 0xdd, 0x16,\r\n  0xfc, 0xeb, 0xaa, 0x5a, 0xbe, 0x03, 0xe9, 0xd9, 0x3b, 0x90, 0xa0, 0x5c,\r\n  0x06, 0x3c, 0xc7, 0xf8, 0x01, 0xe6, 0x4b, 0x78, 0x6a, 0x48, 0xc7, 0x4f,\r\n  0x95, 0x95, 0x7e, 0x9e, 0x43, 0x87, 0x6a, 0x73, 0x7a, 0xb4, 0x67, 0xae,\r\n  0xc1, 0xdd, 0x6c, 0x71, 0x90, 0x06, 0xb0, 0xff, 0x69, 0xab, 0x63, 0x1c,\r\n  0x2e, 0x7b, 0x87, 0xec, 0x70, 0xb7, 0x43, 0xe8, 0xe2, 0x20, 0x9b, 0x98,\r\n  0xe3, 0xf8, 0xf5, 0xf4, 0x71, 0x6c, 0x12, 0xc9, 0x70, 0x5a, 0x65, 0x16,\r\n  0xa6, 0x7b, 0xbc, 0x63, 0x50, 0xf2, 0xad, 0x88, 0x12, 0x6f, 0x7d, 0x8b,\r\n  0x63, 0x23, 0xa5, 0x8e, 0x3a, 0xca, 0xaa, 0xb6, 0x45, 0x79, 0x3a, 0xca,\r\n  0x7f, 0x46, 0xad, 0x6c, 0x9c, 0xcf, 0x46, 0x7b, 0xea, 0xcd, 0x4d, 0x63,\r\n  0x4f, 0xcd, 0x24, 0x23, 0xc0, 0x31, 0xc1, 0x78, 0x51, 0xf2, 0xf2, 0x26,\r\n  0xbf, 0xff, 0xe0, 0xe1, 0x92, 0xf0, 0x24, 0xeb, 0x74, 0xa3, 0x35, 0x33,\r\n  0xa3, 0xd5, 0x3a, 0xe5, 0xec, 0xf8, 0xa9, 0x91, 0x29, 0x31, 0x7e, 0xa5,\r\n  0xc6, 0xa4, 0x74, 0x41, 0x19, 0xa2, 0x35, 0x99, 0xf9, 0xd1, 0xa6, 0xe3,\r\n  0x7a, 0x13, 0x6a, 0x78, 0x77, 0x10, 0xa4, 0x76, 0x85, 0x11, 0xc2, 0x7f,\r\n  0xa8, 0x39, 0x48, 0x97, 0x56, 0xde, 0x64, 0x7b, 0xc1, 0x81, 0xd0, 0x78,\r\n  0x97, 0x2e, 0x43, 0x91, 0x70, 0x72, 0x1e, 0xf0, 0x70, 0x38, 0x3a, 0x21,\r\n  0xad, 0xc2, 0xcd, 0x40, 0x0f, 0x15, 0x62, 0x7c, 0x8a, 0x3e, 0xd4, 0x8f,\r\n  0x29, 0x62, 0x52, 0x92, 0x61, 0x1b, 0x64, 0x7b, 0x0d, 0x4d, 0xdf, 0x10,\r\n  0xfa, 0x02, 0xfa, 0xe4, 0xdd, 0xd3, 0xa8, 0x8d, 0xd0, 0x68, 0xfc, 0x8f,\r\n  0x9e, 0xfa, 0xa4, 0x7e, 0xb8, 0x9e, 0x77, 0x40, 0xc3, 0x65, 0x48, 0x42,\r\n  0x73, 0x62, 0x43, 0xd2, 0xce, 0x87, 0xb0, 0xdd, 0x60, 0x10, 0xf5, 0x7e,\r\n  0x3e, 0xde, 0x87, 0x60, 0x10, 0x1f, 0xec, 0x09, 0x7d, 0xc9, 0xb6, 0x0c,\r\n  0xd7, 0x14, 0x7b, 0xe3, 0x3e, 0x4c, 0x77, 0x6d, 0xe4, 0x7e, 0x81, 0x44,\r\n  0x5e, 0xdd, 0x29, 0xd2, 0x11, 0xcd, 0x4a, 0x1f, 0x3e, 0xde, 0x93, 0xab,\r\n  0xd6, 0x89, 0xee, 0x4a, 0x8c, 0xe5, 0x3e, 0x58, 0xf5, 0x99, 0xd2, 0xf5,\r\n  0x01, 0xcb, 0x1a, 0xfc, 0x58, 0x37, 0x6e, 0x02, 0x3e, 0x6e, 0xe5, 0x0c,\r\n  0xf8, 0x98, 0x13, 0xbd, 0x6e, 0xa3, 0xb5, 0xfb, 0x61, 0x1f, 0x7b, 0x27,\r\n  0xdb, 0xb8, 0x56, 0x49, 0xda, 0xa5, 0x36, 0xc7, 0x41, 0x95, 0x65, 0xbe,\r\n  0x73, 0x86, 0xb0, 0xe8, 0xb9, 0x4b, 0x1f, 0x98, 0x0b, 0x46, 0x73, 0xb8,\r\n  0xe1, 0x28, 0x82, 0xd9, 0xae, 0x6c, 0x25, 0xa0, 0xe6, 0x6c, 0x58, 0x88,\r\n  0x8a, 0x29, 0xc3, 0xa1, 0x1f, 0x6f, 0x0e, 0xa4, 0x40, 0xae, 0x41, 0x87,\r\n  0xef, 0x44, 0xf6, 0xb4, 0x28, 0xb6, 0x74, 0x1b, 0x3e, 0x92, 0x38, 0xdf,\r\n  0x29, 0xa8, 0x3a, 0xa6, 0x84, 0x05, 0xb4, 0x3b, 0x7c, 0x97, 0x21, 0x3e,\r\n  0x2b, 0xa8, 0x30, 0xfb, 0xdf, 0xdf, 0xa8, 0x9d, 0xa7, 0x2d, 0x2f, 0x1a,\r\n  0xe7, 0xe9, 0x43, 0x63, 0xe8, 0xdc, 0xe2, 0x3a, 0x06, 0x3b, 0x6d, 0xe1,\r\n  0x18, 0xfe, 0xc5, 0x87, 0x8d, 0x11, 0x04, 0xef, 0x8c, 0x6d, 0x4e, 0x7a,\r\n  0x22, 0x44, 0x18, 0x9e, 0x3b, 0x42, 0xe2, 0xfe, 0x72, 0x71, 0xf1, 0x56,\r\n  0xb7, 0xa7, 0x3b, 0xe2, 0xf5, 0x68, 0x4d, 0xdd, 0x0a, 0xd1, 0x63, 0xad,\r\n  0x59, 0xbc, 0xc2, 0x35, 0x05, 0xc3, 0xfd, 0x03, 0xdb, 0x95, 0x79, 0xbf,\r\n  0x3b, 0xbf, 0xe8, 0xea, 0x87, 0xcb, 0x4c, 0xca, 0x27, 0x1f, 0x19, 0x41,\r\n  0x60, 0xc6, 0x3c, 0xfe, 0xc5, 0xf0, 0x9c, 0x75, 0x7f, 0x5a, 0x71, 0x44,\r\n  0xd1, 0xc7, 0x4d, 0xdd, 0x5a, 0xe8, 0x13, 0x69, 0xf2, 0xc9, 0xcc, 0xaf,\r\n  0x03, 0xb7, 0x15, 0xb3, 0xb7, 0x2f, 0xa0, 0x02, 0x94, 0x67, 0x02, 0x2d,\r\n  0x93, 0x94, 0xc5, 0x72, 0x55, 0x08, 0x4d, 0xc9, 0x87, 0xef, 0x68, 0xb3,\r\n  0xa8, 0x5d, 0x7b, 0x8c, 0xef, 0xe0, 0xde, 0x2d, 0x99, 0xb1, 0x09, 0x04,\r\n  0x12, 0x6b, 0x7a, 0xe5, 0x86, 0x88, 0xc9, 0xb5, 0x6e, 0x19, 0x82, 0xea,\r\n  0x37, 0xea, 0x95, 0xb4, 0xf6, 0x31, 0x7d, 0x2a, 0xe7, 0xef, 0xa8, 0x0b,\r\n  0x64, 0x0e, 0xd3, 0xb2, 0x97, 0xa4, 0x87, 0x7f, 0x58, 0x5b, 0x97, 0xe7,\r\n  0x6c, 0xcf, 0x71, 0x92, 0x2a, 0xf5, 0xb9, 0x88, 0xa6, 0x09, 0x99, 0xde,\r\n  0x28, 0x1b, 0x28, 0xee, 0x39, 0xfc, 0xfd, 0x03, 0x5b, 0x50, 0x40, 0x87,\r\n  0xa6, 0xc3, 0x39, 0x73, 0x64, 0xc4, 0x64, 0x45, 0x70, 0x72, 0xf1, 0x17,\r\n  0xac, 0xad, 0x0e, 0x2c, 0x75, 0xd4, 0xf4, 0x9b, 0x96, 0x41, 0xfd, 0x8c,\r\n  0xd1, 0x23, 0x04, 0x67, 0xee, 0xfb, 0x64, 0xa8, 0xc4, 0xcb, 0xa5, 0x1e,\r\n  0xf1, 0x0f, 0x8f, 0x5d, 0xf8, 0x25, 0x04, 0x4c, 0x9e, 0xa3, 0x40, 0x84,\r\n  0x16, 0x51, 0xcf, 0x6f, 0xcd, 0xb7, 0x2d, 0x08, 0xb3, 0x2a, 0x2e, 0x3e,\r\n  0xd0, 0x9c, 0x30, 0x04, 0xc9, 0xe3, 0x5a, 0xf1, 0x98, 0xc9, 0xc3, 0x9c,\r\n  0xbc, 0xd9, 0x66, 0x27, 0x71, 0x79, 0x03, 0xde, 0xb3, 0xfc, 0x63, 0x2e,\r\n  0x41, 0x57, 0xb3, 0x09, 0xf3, 0xe0, 0x5c, 0x3e, 0x1f, 0x3b, 0x0d, 0x75,\r\n  0xb5, 0xf2, 0x77, 0x1a, 0x28, 0x57, 0xbc, 0x0e, 0xcb, 0xcd, 0x47, 0xa1,\r\n  0x91, 0x80, 0xbe, 0x6f, 0x7e, 0x68, 0x9f, 0xab, 0x46, 0x5a, 0x1f, 0x63,\r\n  0xe7, 0x88, 0xd8, 0x1c, 0x62, 0x97, 0xe3, 0x6a, 0xf9, 0xff, 0xc1, 0xc2,\r\n  0x22, 0x03, 0x87, 0x15, 0x79, 0xc9, 0xec, 0x82, 0x03, 0xf7, 0xc3, 0x5d,\r\n  0xe6, 0x32, 0x12, 0xdd, 0x65, 0x55, 0xba, 0xcc, 0x66, 0xe9, 0x34, 0x98,\r\n  0x1b, 0x3a, 0xba, 0xed, 0x4a, 0x91, 0xfe, 0xa2, 0x3e, 0x0b, 0x50, 0xdb,\r\n  0xb8, 0x6b, 0xb8, 0xcb, 0x52, 0x0b, 0xc7, 0xd8, 0xb6, 0xe8, 0x06, 0x27,\r\n  0xfb, 0xef, 0xa3, 0xac, 0x70, 0x71, 0x08, 0x0b, 0xdb, 0x24, 0x67, 0xa5,\r\n  0xba, 0x56, 0x7d, 0x99, 0x13, 0xd2, 0xe3, 0x39, 0x67, 0xe1, 0x83, 0x62,\r\n  0x22, 0x56, 0xe8, 0x3d, 0xaa, 0x53, 0x79, 0xd7, 0xd4, 0xd4, 0xcc, 0xcc,\r\n  0xc0, 0xef, 0xd7, 0x91, 0x23, 0xd1, 0x32, 0x4d, 0xa7, 0xf9, 0x5c, 0x02,\r\n  0x2a, 0x77, 0x60, 0xfc, 0xeb, 0x5e, 0x0b, 0xaf, 0x79, 0x75, 0x6f, 0x10,\r\n  0xae, 0x4c, 0x8b, 0x79, 0x56, 0xd2, 0xb0, 0xa0, 0xf2, 0xf0, 0xe3, 0xdf,\r\n  0x27, 0x11, 0xb7, 0x74, 0xd3, 0x23, 0x9b, 0x44, 0xb6, 0xe9, 0xc0, 0x9d,\r\n  0x8d, 0x01, 0xf2, 0xc1, 0x3e, 0x6e, 0x2b, 0x88, 0xd3, 0xd2, 0x31, 0x4c,\r\n  0x19, 0x2d, 0x95, 0xd6, 0x89, 0x40, 0x52, 0x01, 0xff, 0x52, 0x99, 0x30,\r\n  0xef, 0xe3, 0xf2, 0x43, 0xbd, 0x8b, 0xa5, 0x84, 0x4d, 0x7d, 0x12, 0x04,\r\n  0x28, 0x51, 0xbb, 0x64, 0xa2, 0xe4, 0x7d, 0xd2, 0x66, 0x0b, 0xef, 0x12,\r\n  0xf1, 0x82, 0x0e, 0x10, 0x6c, 0x9f, 0x43, 0xea, 0x06, 0xf3, 0x15, 0x92,\r\n  0xeb, 0x7c, 0x50, 0x8b, 0xed, 0x52, 0xec, 0xd1, 0x57, 0xf4, 0xfc, 0xe3,\r\n  0x8f, 0xcf, 0xef, 0x23, 0xe2, 0x84, 0xfc, 0x09, 0x8c, 0xd6, 0xed, 0xc3,\r\n  0x33, 0x49, 0x3e, 0xd6, 0xa8, 0x02, 0xcf, 0x4b, 0xfd, 0x18, 0x35, 0x05,\r\n  0x84, 0xae, 0x7c, 0x07, 0x39, 0x5b, 0x87, 0x66, 0xa0, 0x2b, 0x20, 0x03,\r\n  0x52, 0x9c, 0x39, 0x73, 0x3b, 0x26, 0x33, 0xe3, 0xbb, 0x98, 0xf3, 0xf1,\r\n  0xa9, 0x92, 0x8f, 0xb9, 0x69, 0xf8, 0xfe, 0xef, 0x3e, 0x33, 0xaa, 0x2b,\r\n  0xd6, 0xf4, 0xb7, 0xf6, 0x3c, 0x5b, 0x7e, 0x84, 0xe2, 0xca, 0x10, 0x74,\r\n  0xf8, 0x98, 0x6d, 0xc4, 0x2e, 0x8c, 0x44, 0x0b, 0x74, 0x60, 0x3c, 0x8e,\r\n  0x3b, 0x4b, 0x22, 0x1f, 0x16, 0x6a, 0x58, 0xa4, 0x1f, 0x34, 0xd5, 0x52,\r\n  0x25, 0xff, 0x83, 0x74, 0x5e, 0x75, 0x7a, 0x5c, 0x01, 0x72, 0x36, 0x27,\r\n  0xa6, 0x0c, 0x08, 0xd1, 0x5d, 0xe7, 0x72, 0xe2, 0x90, 0x64, 0x22, 0x14,\r\n  0xec, 0x1e, 0x5b, 0x0c, 0xeb, 0x82, 0x95, 0x97, 0x0f, 0xf4, 0x40, 0xfd,\r\n  0x92, 0x16, 0x7b, 0xeb, 0x23, 0xbf, 0x9d, 0x3d, 0x93, 0x16, 0x75, 0x10,\r\n  0x13, 0xd8, 0xe5, 0xf4, 0xec, 0x3f, 0xde, 0x9c, 0x06, 0xea, 0x7e, 0x0f,\r\n  0x02, 0xe9, 0x20, 0x6b, 0xf6, 0xc5, 0x0f, 0x96, 0xee, 0xb4, 0xbf, 0xbd,\r\n  0xfd, 0xd3, 0x0f, 0x35, 0xac, 0xc3, 0x17, 0x3f, 0xfd, 0xca, 0xe2, 0x89,\r\n  0x8f, 0x52, 0x45, 0x08, 0xb7, 0xf8, 0xaf, 0xa3, 0x10, 0xf9, 0xd8, 0xb4,\r\n  0x66, 0x92, 0x63, 0xa9, 0xf0, 0xde, 0x75, 0x65, 0x43, 0xe9, 0xad, 0x53,\r\n  0x26, 0x55, 0x47, 0x5e, 0x9b, 0x4c, 0x8b, 0xe5, 0xdb, 0xc8, 0x10, 0x8a,\r\n  0xa4, 0xbf, 0x36, 0xb5, 0x0a, 0x88, 0x54, 0xa9, 0xc3, 0x12, 0x6f, 0x74,\r\n  0xe8, 0x35, 0x1e, 0x69, 0x51, 0x4a, 0x6e, 0x99, 0xb4, 0xde, 0x43, 0x82,\r\n  0x89, 0xf5, 0xb8, 0x0b, 0xe4, 0xc9, 0xd1, 0x1b, 0x17, 0xbc, 0x0b, 0x2e,\r\n  0x4a, 0xe5, 0x63, 0xe3, 0xa4, 0x1d, 0xc0, 0x9b, 0xb2, 0xb0, 0x26, 0xa4,\r\n  0x02, 0xdc, 0x3b, 0x04, 0x12, 0xdd, 0xa7, 0x62, 0x1e, 0x0b, 0xf1, 0x35,\r\n  0xf3, 0x65, 0x89, 0x0b, 0x93, 0xdf, 0xf6, 0x84, 0xb1, 0x0e, 0xcb, 0x45,\r\n  0xbf, 0x97, 0x40, 0xa0, 0x6e, 0x8f, 0xee, 0x3a, 0x97, 0xd3, 0xb0, 0x8b,\r\n  0x12, 0x27, 0xd6, 0x02, 0x85, 0x2e, 0x9e, 0xe1, 0x0f, 0x12, 0x28, 0xd8,\r\n  0xf8, 0xba, 0x89, 0xdb, 0x44, 0x3c, 0x57, 0x6e, 0x9a, 0xaa, 0x15, 0xdd,\r\n  0x97, 0xf3, 0x76, 0x65, 0x4a, 0x44, 0xbc, 0x64, 0x53, 0x2b, 0xea, 0x78,\r\n  0xb8, 0xb4, 0x7d, 0xdc, 0x1c, 0xec, 0x83, 0x36, 0xb2, 0x26, 0xf2, 0xf2,\r\n  0x56, 0xd1, 0xe6, 0x01, 0x46, 0xa7, 0x86, 0xf5, 0xf3, 0x95, 0x3f, 0xb2,\r\n  0x60, 0x4f, 0x68, 0x44, 0x33, 0x6e, 0xa1, 0x2a, 0x58, 0x86, 0x80, 0x6d,\r\n  0x3b, 0x08, 0xce, 0xd7, 0x8a, 0x77, 0x5b, 0xdd, 0x4a, 0xce, 0x39, 0x4c,\r\n  0x33, 0x17, 0x95, 0xd2, 0x52, 0x01, 0xed, 0xfc, 0xcf, 0x02, 0x46, 0x0f,\r\n  0x08, 0xab, 0xbf, 0xf0, 0x89, 0x2e, 0x7f, 0x7a, 0xba, 0xc3, 0xde, 0x15,\r\n  0x6b, 0x25, 0x0e, 0x30, 0x34, 0xd1, 0x9f, 0x9e, 0xc4, 0xdd, 0x45, 0x45,\r\n  0xa5, 0xeb, 0xd0, 0xc3, 0x5b, 0xe5, 0x39, 0x84, 0xb8, 0x3e, 0x9e, 0x2a,\r\n  0x01, 0xfb, 0x7d, 0xfc, 0x60, 0x74, 0x84, 0x78, 0xab, 0xc5, 0x62, 0xd6,\r\n  0x71, 0x92, 0x06, 0x01, 0xa8, 0x34, 0x2c, 0xa6, 0xed, 0x4a, 0x1a, 0x46,\r\n  0x9b, 0x9a, 0x2a, 0xd3, 0x4c, 0xc1, 0xb2, 0x82, 0xa6, 0x28, 0x6d, 0x86,\r\n  0x88, 0x04, 0x2f, 0xca, 0x5f, 0xd6, 0x43, 0xde, 0x5e, 0xe1, 0xfe, 0x36,\r\n  0x32, 0x81, 0x1a, 0x9d, 0x88, 0xae, 0x8c, 0x96, 0x50, 0xf3, 0x03, 0xd4,\r\n  0xca, 0x84, 0xeb, 0x58, 0x2d, 0x98, 0x23, 0xc0, 0xf5, 0x13, 0xce, 0x7c,\r\n  0x45, 0xe7, 0xd4, 0x88, 0x9e, 0xed, 0x23, 0x8e, 0xb2, 0x4a, 0xea, 0xf1,\r\n  0x76, 0xf2, 0xbb, 0x50, 0x8b, 0x83, 0x28, 0xe0, 0x70, 0xb1, 0x7f, 0x80,\r\n  0x8e, 0x00, 0x85, 0xdb, 0x3c, 0xd7, 0x06, 0xc2, 0xd0, 0xe2, 0x96, 0xe9,\r\n  0x60, 0x56, 0xb6, 0xe3, 0x05, 0x6e, 0x89, 0xc8, 0x68, 0xbc, 0xac, 0x1a,\r\n  0xa5, 0xa3, 0xac, 0x7e, 0x93, 0x07, 0x7c, 0xd0, 0x01, 0x57, 0x44, 0x47,\r\n  0x94, 0x81, 0xbf, 0x89, 0x78, 0x2a, 0xcb, 0x15, 0x16, 0x6a, 0x3e, 0x55,\r\n  0xa5, 0x42, 0x05, 0x27, 0x04, 0x85, 0x9d, 0x2c, 0xa9, 0xd5, 0x77, 0xfe,\r\n  0xcd, 0x6f, 0xa0, 0xef, 0x85, 0x83, 0x5d, 0x86, 0xbf, 0xb6, 0xa2, 0xa8,\r\n  0x20, 0xf4, 0xc7, 0x2e, 0x37, 0xcd, 0x11, 0x92, 0xdb, 0x9b, 0x9a, 0x64,\r\n  0x10, 0x66, 0xf3, 0x3c, 0x5e, 0x63, 0xd9, 0xc9, 0x0e, 0x8c, 0xd3, 0x55,\r\n  0xe5, 0xbb, 0xac, 0xdd, 0x61, 0xce, 0x5b, 0xe6, 0x63, 0xf6, 0x1d, 0xd4,\r\n  0xdc, 0x61, 0xbe, 0xa0, 0xec, 0x46, 0xed, 0x8d, 0x27, 0x22, 0xc7, 0xec,\r\n  0x28, 0x15, 0x73, 0x98, 0x74, 0xf2, 0xd5, 0xf1, 0xe5, 0x56, 0x9b, 0xc2,\r\n  0x30, 0x0e, 0x2a, 0xfc, 0xa2, 0x1e, 0x87, 0xee, 0x81, 0xd8, 0xf1, 0xdd,\r\n  0xbb, 0xbc, 0x2b, 0xd1, 0x13, 0x93, 0xf7, 0xa4, 0x22, 0x65, 0xdd, 0x54,\r\n  0x64, 0x87, 0x34, 0x0d, 0xbc, 0x5f, 0x02, 0x4c, 0x91, 0xb4, 0xec, 0x98,\r\n  0xd6, 0x23, 0x67, 0xaf, 0x20, 0xc7, 0x93, 0x5b, 0x3c, 0x3a, 0x3e, 0x3d,\r\n  0xbe, 0x3c, 0x06, 0xec, 0xba, 0xe5, 0x8f, 0x9d, 0x63, 0x87, 0x54, 0xc9,\r\n  0xf4, 0x26, 0x23, 0xb1, 0x73, 0xcd, 0xcb, 0x81, 0xb4, 0xb9, 0xef, 0x92,\r\n  0xc9, 0xd1, 0xc1, 0xb7, 0x5c, 0x50, 0x86, 0x77, 0xd4, 0xf9, 0xc5, 0xd9,\r\n  0xf9, 0xab, 0x93, 0x37, 0x47, 0x83, 0xe8, 0xf0, 0xec, 0xfc, 0x6f, 0x83,\r\n  0xe8, 0xf5, 0xd9, 0xb7, 0xc7, 0x1d, 0x48, 0x6d, 0x46, 0x7c, 0x75, 0xe0,\r\n  0x97, 0x94, 0xb6, 0x5d, 0x99, 0x8d, 0xc1, 0x7e, 0x29, 0x74, 0xe5, 0xf5,\r\n  0x14, 0x33, 0xbe, 0x19, 0x4b, 0x24, 0x1b, 0xd2, 0xd4, 0xd3, 0x5c, 0x0e,\r\n  0xa2, 0xaf, 0x8f, 0x0f, 0x8e, 0x9a, 0x7b, 0xfe, 0xfc, 0x6c, 0x2c, 0xa3,\r\n  0xe2, 0xd1, 0xb9, 0x41, 0xf3, 0x0d, 0x4a, 0xf7, 0x15, 0xbb, 0xab, 0xd9,\r\n  0x56, 0xbc, 0x4d, 0x02, 0x0a, 0x36, 0x92, 0x42, 0x70, 0x76, 0xcd, 0xd6,\r\n  0x16, 0xa3, 0x04, 0x92, 0xc1, 0x01, 0xde, 0x1e, 0x57, 0x46, 0x00, 0xbc,\r\n  0x32, 0xc6, 0x5f, 0xd9, 0x20, 0x12, 0x23, 0x60, 0xbf, 0x7f, 0x61, 0xc4,\r\n  0x1f, 0x7a, 0xc3, 0x74, 0xd4, 0xf0, 0xd6, 0x2e, 0x4b, 0x99, 0x07, 0xa3,\r\n  0x6f, 0x80, 0x60, 0x12, 0x10, 0x43, 0xac, 0x30, 0xb4, 0x49, 0xc2, 0xa8,\r\n  0xfb, 0x12, 0xe5, 0x0a, 0xb0, 0x49, 0x12, 0x61, 0xbb, 0x68, 0xdf, 0xb0,\r\n  0x32, 0xaf, 0x82, 0x05, 0x33, 0xb0, 0x12, 0xa4, 0x23, 0x7b, 0x13, 0x79,\r\n  0x0a, 0xfd, 0x37, 0x15, 0x63, 0xf5, 0xbd, 0xfc, 0xb8, 0x23, 0xef, 0x17,\r\n  0xd4, 0x34, 0xab, 0x2b, 0xda, 0x9e, 0x89, 0x80, 0x3e, 0xb0, 0x4e, 0x7a,\r\n  0x10, 0x71, 0x39, 0x9f, 0xf0, 0x11, 0xbf, 0x41, 0x3e, 0x6f, 0xf7, 0x2d,\r\n  0xbc, 0xf9, 0x6a, 0xcd, 0xe9, 0x0e, 0x6b, 0xa8, 0x68, 0x8b, 0x41, 0x6a,\r\n  0xf0, 0xe9, 0x09, 0xad, 0x2b, 0x1f, 0xf5, 0x26, 0x18, 0x10, 0x89, 0x0f,\r\n  0x52, 0xfd, 0x2e, 0xe5, 0xa5, 0xc6, 0x59, 0xa7, 0xb6, 0x7e, 0x4f, 0xf8,\r\n  0xe8, 0xfb, 0x98, 0xcc, 0xd3, 0x2e, 0x02, 0x55, 0xba, 0x52, 0xe1, 0x21,\r\n  0x72, 0x68, 0x1a, 0xe4, 0xaf, 0x4a, 0xcd, 0x94, 0x6a, 0x2d, 0xb9, 0x22,\r\n  0x0d, 0xbf, 0xa5, 0x5d, 0x98, 0x26, 0x86, 0x91, 0x91, 0x88, 0x89, 0xa5,\r\n  0x04, 0x49, 0x26, 0x35, 0x67, 0x8c, 0xac, 0x81, 0xfb, 0x91, 0x4e, 0x98,\r\n  0x8c, 0x7c, 0x14, 0xe6, 0xec, 0xb5, 0x6f, 0x16, 0x45, 0x7f, 0xe2, 0x4b,\r\n  0x6e, 0xfb, 0xbd, 0x9f, 0x5d, 0x8f, 0xf2, 0x22, 0x65, 0x37, 0x90, 0x96,\r\n  0x88, 0x91, 0xc6, 0x22, 0x14, 0x42, 0xe3, 0x5d, 0xc5, 0x1b, 0xb4, 0xab,\r\n  0x39, 0x05, 0xa6, 0x44, 0x96, 0x80, 0x57, 0x6f, 0x77, 0x01, 0x0b, 0x92,\r\n  0x7f, 0xe5, 0x9a, 0x0c, 0xea, 0xa9, 0x77, 0x24, 0xbb, 0x97, 0x0f, 0xb4,\r\n  0xce, 0x8b, 0x80, 0x77, 0xc3, 0xa5, 0x1a, 0x46, 0xbe, 0xc6, 0x4e, 0x30,\r\n  0xd8, 0x01, 0x62, 0xd8, 0xf7, 0x71, 0x91, 0x49, 0x99, 0xd3, 0x16, 0x5d,\r\n  0x64, 0xb9, 0xaa, 0x2d, 0xd8, 0x03, 0xf0, 0x7a, 0xec, 0x91, 0x57, 0x66,\r\n  0x68, 0xfe, 0xb3, 0xb3, 0x16, 0x80, 0x8b, 0x2a, 0xf0, 0xa0, 0x38, 0x72,\r\n  0xa9, 0xcc, 0xc6, 0xf2, 0xb2, 0x90, 0x18, 0x4f, 0x1a, 0xbe, 0xf8, 0x68,\r\n  0xb6, 0x2a, 0xda, 0x89, 0x66, 0x71, 0x14, 0x7c, 0x50, 0xf2, 0xd1, 0x07,\r\n  0xb5, 0xe0, 0x0e, 0x63, 0xde, 0x4a, 0x5f, 0x68, 0x98, 0x3e, 0x1f, 0xbc,\r\n  0xd0, 0x1a, 0x93, 0x27, 0xbf, 0x74, 0xac, 0x3a, 0x41, 0x97, 0x6c, 0xa3,\r\n  0xee, 0x46, 0xab, 0x6c, 0xce, 0x61, 0x3e, 0xb6, 0x3a, 0x24, 0xd5, 0xee,\r\n  0x6f, 0x8f, 0x42, 0x22, 0x15, 0x36, 0x1c, 0xb2, 0x3e, 0x88, 0x8a, 0xb6,\r\n  0x2a, 0xed, 0x22, 0xc4, 0x72, 0xc4, 0xb0, 0x9f, 0x23, 0xcc, 0xc9, 0x46,\r\n  0x67, 0x58, 0x8d, 0xcd, 0xaf, 0x6a, 0x1a, 0x30, 0x79, 0x02, 0x8a, 0x45,\r\n  0xbf, 0xa4, 0x9d, 0x2c, 0xf7, 0x18, 0xc9, 0xa1, 0x81, 0xa4, 0xe1, 0xa2,\r\n  0xf2, 0x8d, 0xbe, 0x37, 0xec, 0x70, 0x3f, 0xb0, 0x97, 0x65, 0x8d, 0xf8,\r\n  0xf8, 0xed, 0x4e, 0xf1, 0xdf, 0xfc, 0xa6, 0x90, 0x49, 0x7c, 0x81, 0x7f,\r\n  0xfc, 0xa2, 0x6d, 0x11, 0x10, 0x5e, 0x4b, 0xc0, 0x67, 0x93, 0x8e, 0x40,\r\n  0x6d, 0x7f, 0x0c, 0x5b, 0xd9, 0x4a, 0xb3, 0x2d, 0x75, 0xa0, 0x05, 0xcb,\r\n  0xad, 0x1e, 0x15, 0x16, 0xfa, 0xf5, 0x5d, 0x51, 0xdb, 0x12, 0x1d, 0xb6,\r\n  0xab, 0xac, 0xb1, 0xe4, 0x00, 0xa4, 0x5c, 0xef, 0x8d, 0x25, 0x3e, 0xa4,\r\n  0x74, 0xf2, 0x7b, 0x52, 0xae, 0xfc, 0x63, 0x7b, 0x88, 0x4e, 0x0d, 0xb1,\r\n  0xff, 0x5f, 0xcc, 0xd8, 0xdf, 0x44, 0x7a, 0x09, 0x47, 0x98, 0xa9, 0xe5,\r\n  0xcf, 0xff, 0xab, 0xbb, 0x68, 0x93, 0x55, 0x33, 0x0c, 0xd3, 0x2f, 0xc5,\r\n  0x4d, 0xcd, 0x76, 0x18, 0x33, 0xea, 0xa3, 0x1c, 0x8e, 0x56, 0xc8, 0x65,\r\n  0x87, 0x4c, 0x65, 0x13, 0xdd, 0x21, 0x83, 0xb4, 0xc8, 0x9a, 0xf8, 0xc3,\r\n  0x90, 0x03, 0x41, 0x8f, 0xbb, 0x72, 0xda, 0x6b, 0x9a, 0x74, 0xec, 0xee,\r\n  0x2d, 0x16, 0x35, 0xe1, 0x16, 0x67, 0x95, 0xb0, 0x35, 0x1c, 0xb3, 0xa1,\r\n  0xe2, 0x50, 0x03, 0xc1, 0x43, 0x62, 0x82, 0x94, 0x1d, 0x60, 0x13, 0x5a,\r\n  0x06, 0xbd, 0xc1, 0x59, 0x9f, 0x11, 0xfe, 0x25, 0x46, 0xce, 0xba, 0x6a,\r\n  0x4d, 0xd4, 0xc9, 0xd2, 0xbc, 0x1e, 0x0c, 0x05, 0x00, 0x1b, 0x6e, 0xec,\r\n  0x70, 0x73, 0x5d, 0x76, 0x13, 0x68, 0xe6, 0x15, 0x2c, 0xab, 0xba, 0x27,\r\n  0xc6, 0x65, 0xc9, 0xdb, 0xe8, 0x52, 0xb4, 0xb9, 0xe0, 0xa1, 0xb8, 0x3a,\r\n  0x8f, 0x9d, 0x4b, 0xe1, 0x48, 0x7e, 0xa4, 0x30, 0x84, 0xe3, 0x02, 0xa0,\r\n  0x96, 0xb9, 0x11, 0xe5, 0x01, 0x40, 0xe6, 0xbf, 0x94, 0x81, 0x69, 0x4c,\r\n  0x49, 0x0b, 0x91, 0x5f, 0xd5, 0xf9, 0xbe, 0x2d, 0x9d, 0x82, 0x3d, 0xae,\r\n  0x22, 0xb4, 0xea, 0xef, 0xd7, 0xca, 0xdd, 0x6f, 0x0e, 0x7d, 0xa5, 0x70,\r\n  0x14, 0xda, 0x90, 0xbd, 0xd1, 0x0e, 0x94, 0xc6, 0x1e, 0xde, 0xe8, 0x60,\r\n  0xf8, 0xc2, 0xd2, 0xab, 0x87, 0xd1, 0x52, 0x18, 0xf9, 0x6b, 0xdb, 0xe2,\r\n  0xae, 0x34, 0x69, 0xc9, 0xd2, 0xa8, 0xa5, 0x3a, 0x34, 0xda, 0xca, 0x92,\r\n  0xfb, 0xb0, 0x2d, 0x6f, 0x1a, 0xb8, 0xf6, 0x7e, 0xc7, 0x23, 0x75, 0x23,\r\n  0x8a, 0xd3, 0x7c, 0xd9, 0xf2, 0x5a, 0x70, 0x58, 0x99, 0x7f, 0x11, 0x3c,\r\n  0xfc, 0x7a, 0x00, 0x46, 0xfc, 0xac, 0x8d, 0x3d, 0x79, 0x8d, 0x1f, 0x8e,\r\n  0xa2, 0x23, 0xc5, 0x90, 0x23, 0x79, 0x72, 0xa5, 0x2d, 0x00, 0x58, 0x1c,\r\n  0x34, 0xf3, 0xad, 0xe6, 0x6c, 0x74, 0x2c, 0xa9, 0xbe, 0x5f, 0x86, 0x89,\r\n  0xa2, 0xea, 0xff, 0x16, 0x3a, 0x90, 0xcc, 0x6a, 0x0a, 0x4c, 0xf0, 0x6f,\r\n  0x33, 0x55, 0x53, 0x40, 0x21, 0xcb, 0x51, 0x87, 0x57, 0x42, 0x3c, 0xea,\r\n  0x50, 0xa6, 0xbd, 0x2f, 0xdc, 0x9c, 0xc7, 0xf6, 0x3e, 0x9b, 0x55, 0x92,\r\n  0x91, 0xe1, 0x9a, 0xee, 0xca, 0xf9, 0x84, 0x2a, 0xff, 0xa4, 0x98, 0x21,\r\n  0x60, 0xf4, 0xc0, 0x8f, 0x16, 0x71, 0x21, 0xd6, 0x49, 0x76, 0x6b, 0x3e,\r\n  0x00, 0xf1, 0x74, 0x24, 0xd3, 0x55, 0x55, 0x67, 0x43, 0x0a, 0x3d, 0x25,\r\n  0x56, 0x3b, 0x06, 0xdd, 0xda, 0x44, 0x88, 0x40, 0x75, 0xc8, 0xde, 0xb9,\r\n  0x99, 0xfe, 0xfb, 0xbd, 0x2d, 0x0d, 0x9b, 0x48, 0x04, 0x4c, 0x7f, 0xdc,\r\n  0x95, 0x38, 0x6a, 0x7d, 0x2e, 0x12, 0xe1, 0x45, 0xa9, 0x72, 0xd3, 0x64,\r\n  0x3a, 0x3f, 0x4f, 0x7b, 0xa7, 0x98, 0x75, 0x7d, 0xfb, 0x95, 0x94, 0x5c,\r\n  0x0c, 0x3e, 0xed, 0x7c, 0x03, 0x5a, 0x8d, 0xb1, 0xf9, 0xf9, 0x8e, 0x2f,\r\n  0xc3, 0x3a, 0x23, 0xc3, 0xc9, 0x61, 0x8c, 0xed, 0x55, 0x9b, 0xff, 0x16,\r\n  0xe0, 0x18, 0x18, 0x1e, 0xcf, 0x38, 0xc3, 0x3a, 0x38, 0x7e, 0xa4, 0xd3,\r\n  0x99, 0xb6, 0x8f, 0xf8, 0x6d, 0x31, 0x79, 0x4a, 0xff, 0xf9, 0x86, 0xff,\r\n  0xc3, 0x82, 0x82, 0xb5, 0x78, 0xa1, 0x79, 0x14, 0xa6, 0x88, 0xb6, 0x4c,\r\n  0x18, 0x9f, 0x1a, 0x84, 0x64, 0x8c, 0x5d, 0xf4, 0x0a, 0x7f, 0x29, 0x92,\r\n  0x47, 0xde, 0xa1, 0xb1, 0xfd, 0x83, 0x7d, 0xa3, 0x2b, 0xb2, 0x13, 0x68,\r\n  0x27, 0x4e, 0x23, 0x38, 0xde, 0x16, 0x4e, 0x9a, 0xa0, 0xd6, 0x9d, 0x4b,\r\n  0xe3, 0x17, 0xe6, 0x18, 0xb8, 0x49, 0x61, 0xfb, 0xa6, 0x6b, 0x02, 0x65,\r\n  0xeb, 0xbf, 0x87, 0x54, 0xba, 0xa8, 0x99, 0x51, 0x17, 0x50, 0x58, 0xae,\r\n  0x79, 0xef, 0xab, 0xf1, 0x78, 0xf8, 0x46, 0xa9, 0xdb, 0xd6, 0x04, 0x5f,\r\n  0xdc, 0xaf, 0x9b, 0x0d, 0xf3, 0x54, 0xd0, 0x64, 0x3e, 0xfb, 0xb8, 0x59,\r\n  0x3c, 0xe2, 0x1c, 0x28, 0x55, 0xe5, 0xac, 0x30, 0x4b, 0x89, 0x4c, 0x23,\r\n  0xd9, 0x05, 0x93, 0x55, 0x6a, 0xf5, 0xef, 0xf0, 0xe8, 0xc8, 0x0c, 0x55,\r\n  0x49, 0x20, 0x5c, 0x33, 0x23, 0x92, 0x92, 0x85, 0x02, 0x0f, 0x48, 0x7f,\r\n  0xb9, 0x75, 0x39, 0xe6, 0x8b, 0x64, 0xc1, 0xdc, 0x55, 0x2e, 0xf5, 0x4a,\r\n  0x74, 0xbd, 0x57, 0x4c, 0x46, 0x48, 0x9f, 0x5b, 0x13, 0x22, 0x99, 0x71,\r\n  0xf5, 0x03, 0x36, 0x33, 0x05, 0xc6, 0xfd, 0x87, 0x96, 0xaf, 0xbb, 0x7c,\r\n  0xc8, 0xa6, 0x37, 0x47, 0x6f, 0xc6, 0x1b, 0xeb, 0x83, 0xcf, 0xc1, 0xe0,\r\n  0xf0, 0x74, 0x91, 0x67, 0x9c, 0xb7, 0x13, 0x44, 0xe4, 0x3b, 0x3c, 0x56,\r\n  0xe3, 0xf3, 0x37, 0xc7, 0x5f, 0x9d, 0xd9, 0x7f, 0xd6, 0x4e, 0xf9, 0xa3,\r\n  0x33, 0x7c, 0xca, 0xe5, 0x9c, 0x1f, 0xab, 0x8c, 0x9d, 0x36, 0xb8, 0x1e,\r\n  0x02, 0x15, 0x9a, 0xf6, 0xe3, 0x9c, 0x5f, 0x97, 0xad, 0x38, 0xd0, 0x1d,\r\n  0x89, 0x1f, 0x15, 0xeb, 0x6a, 0x7e, 0xd3, 0x71, 0xdb, 0xfb, 0xea, 0xcb,\r\n  0xf6, 0x05, 0x73, 0xf4, 0x66, 0xcd, 0xe7, 0xf8, 0x37, 0x43, 0xd3, 0x27,\r\n  0xd4, 0xd9, 0x33, 0xa3, 0xf3, 0x91, 0x4a, 0x0d, 0x81, 0x8e, 0x59, 0x19,\r\n  0x9f, 0x9f, 0xb8, 0xff, 0xf0, 0x5e, 0xf0, 0x83, 0xb7, 0xac, 0x2d, 0x3e,\r\n  0xf0, 0xb2, 0xeb, 0x39, 0xbd, 0x08, 0x25, 0x5c, 0x27, 0xf3, 0x38, 0xbb,\r\n  0x85, 0x9b, 0xb6, 0xbb, 0xe7, 0xfc, 0xad, 0x41, 0xc0, 0xb3, 0x13, 0xcc,\r\n  0xb1, 0x3a, 0xed, 0x91, 0x24, 0x2a, 0xe9, 0x14, 0x4a, 0x9a, 0xd2, 0x25,\r\n  0xd2, 0x5d, 0xc0, 0x62, 0x8d, 0x23, 0x58, 0xa9, 0x64, 0xd6, 0x94, 0xd6,\r\n  0x06, 0xc7, 0xcc, 0x58, 0xca, 0x7f, 0x5c, 0x08, 0x0a, 0xe5, 0x5c, 0x5b,\r\n  0xda, 0x7a, 0x6c, 0xd9, 0xbb, 0x9b, 0xe3, 0x23, 0xd8, 0x51, 0x20, 0xe2,\r\n  0x35, 0xa9, 0x39, 0x7c, 0xbf, 0x7c, 0xf4, 0x8e, 0xb0, 0x17, 0xa2, 0xcd,\r\n  0x09, 0xdd, 0x58, 0xee, 0x8e, 0x7b, 0xa2, 0x9e, 0xbc, 0xa7, 0xc2, 0x8b,\r\n  0xd3, 0xdd, 0xdc, 0xb3, 0xcf, 0x9e, 0x3d, 0xdd, 0xda, 0x1a, 0x44, 0x5a,\r\n  0x65, 0xcc, 0x65, 0xfd, 0x70, 0xf6, 0x69, 0xca, 0x27, 0x54, 0x2c, 0x35,\r\n  0x52, 0x71, 0x6f, 0x50, 0xf8, 0xc5, 0xad, 0x40, 0x77, 0x73, 0xbc, 0xb2,\r\n  0xf6, 0x1e, 0x0f, 0x8f, 0x09, 0xe1, 0x20, 0x22, 0x53, 0x8d, 0x75, 0x41,\r\n  0x04, 0x27, 0xf2, 0xc0, 0xa6, 0xc5, 0x21, 0xd6, 0xc6, 0x90, 0xad, 0xa6,\r\n  0xbd, 0x86, 0xa0, 0x25, 0xfa, 0x83, 0x38, 0x89, 0x5d, 0x36, 0xcc, 0x52,\r\n  0xc9, 0x55, 0xc3, 0xdd, 0xe1, 0xfe, 0x5f, 0xdb, 0x23, 0xee, 0x63, 0x31,\r\n  0x6d, 0x67, 0xbf, 0x41, 0x43, 0x0b, 0x12, 0x62, 0x07, 0x11, 0xaa, 0x26,\r\n  0x7d, 0x33, 0x10, 0x33, 0x11, 0x3f, 0xf6, 0xfc, 0x53, 0xd4, 0xf0, 0xf1,\r\n  0x9b, 0x6f, 0x4f, 0x2e, 0xce, 0xde, 0xbc, 0x3e, 0x7e, 0xe3, 0xb0, 0xeb,\r\n  0x7c, 0x9d, 0x76, 0x87, 0xfd, 0xba, 0x0a, 0x94, 0x8b, 0x0d, 0xc7, 0x21,\r\n  0x29, 0x1e, 0x05, 0xad, 0x97, 0xfe, 0x6b, 0x14, 0x36, 0x17, 0x3c, 0x64,\r\n  0x4b, 0xc7, 0x16, 0xc5, 0x92, 0x31, 0xa7, 0x33, 0xce, 0x0d, 0x1a, 0x09,\r\n  0x90, 0x5f, 0x42, 0x05, 0xa9, 0x04, 0x0b, 0xdf, 0x4f, 0x13, 0xa5, 0xa9,\r\n  0x2d, 0x83, 0xb2, 0x38, 0x96, 0xc9, 0xe2, 0xf3, 0x7d, 0x6a, 0x9d, 0xf0,\r\n  0xbb, 0x5d, 0xcb, 0x66, 0xa2, 0xd0, 0x4e, 0x57, 0xdc, 0x11, 0xc5, 0x67,\r\n  0xab, 0x20, 0x3e, 0x75, 0xa3, 0xc1, 0x1b, 0x04, 0x73, 0x24, 0xcc, 0x1d,\r\n  0xd0, 0x0a, 0x7b, 0xb2, 0x34, 0x0b, 0xfd, 0x36, 0xed, 0xea, 0x60, 0x04,\r\n  0xb5, 0xa0, 0x30, 0xf8, 0xb0, 0x3f, 0xd7, 0x08, 0x70, 0x9b, 0x18, 0xa8,\r\n  0x0c, 0x43, 0x64, 0xae, 0x70, 0xb7, 0x65, 0xbc, 0x23, 0xba, 0xb8, 0x11,\r\n  0xa0, 0x45, 0xc7, 0xef, 0xce, 0x2f, 0xce, 0xbe, 0xff, 0xdb, 0x6f, 0xfc,\r\n  0x89, 0xb1, 0x1f, 0xc6, 0x0f, 0x7c, 0x0d, 0x59, 0xe3, 0x3f, 0xfd, 0xe6,\r\n  0x5f, 0xab, 0x37, 0x3f, 0x08, 0xe8, 0x76, 0x3b, 0xb9, 0x5c, 0x25, 0x30,\r\n  0x93, 0x96, 0x96, 0x7a, 0xa1, 0x3f, 0xf0, 0x70, 0x50, 0x27, 0x22, 0x10,\r\n  0x9b, 0x29, 0xeb, 0x9b, 0x33, 0x6e, 0x3b, 0xef, 0x50, 0x89, 0x5a, 0xd8,\r\n  0x9a, 0xdb, 0x05, 0x74, 0x06, 0xe0, 0x6b, 0xc6, 0x95, 0xec, 0xe6, 0xe3,\r\n  0xe0, 0xf4, 0xf4, 0x37, 0x9d, 0x04, 0xb8, 0x15, 0xfc, 0x58, 0x86, 0xb5,\r\n  0xc2, 0xa4, 0x1c, 0x28, 0x6b, 0x69, 0x59, 0x35, 0x0f, 0xc4, 0x9b, 0x33,\r\n  0xed, 0x8d, 0x44, 0x7d, 0x86, 0x56, 0x36, 0x7e, 0x06, 0xaf, 0x2d, 0x5f,\r\n  0x98, 0xa8, 0xb5, 0xfa, 0x79, 0x4b, 0xf1, 0x2b, 0x85, 0x4c, 0xb8, 0x56,\r\n  0x13, 0x14, 0x61, 0x7c, 0x30, 0xfe, 0x22, 0x93, 0x38, 0x77, 0x51, 0x63,\r\n  0xe1, 0x35, 0x37, 0x14, 0x42, 0x47, 0xa4, 0x9f, 0xbd, 0xb1, 0x8c, 0x3d,\r\n  0x29, 0xd2, 0xf2, 0x16, 0x29, 0xd8, 0x7c, 0x28, 0x07, 0x52, 0xea, 0xaa,\r\n  0x42, 0x79, 0x47, 0xd6, 0xf0, 0xd1, 0x15, 0xea, 0xbb, 0xf4, 0x98, 0xfe,\r\n  0xbc, 0x3c, 0x3b, 0x3c, 0x3b, 0xa5, 0xbf, 0x1c, 0xbf, 0x3a, 0xf9, 0xde,\r\n  0x0b, 0x34, 0xe1, 0x39, 0xaf, 0x59, 0x3f, 0x9e, 0xf4, 0xbc, 0x11, 0x3e,\r\n  0xee, 0xa2, 0x9e, 0xd4, 0xaa, 0x81, 0x1b, 0x1e, 0x37, 0x60, 0xcb, 0x64,\r\n  0xe1, 0xc9, 0x80, 0x3a, 0xa0, 0x51, 0x84, 0xf6, 0xfd, 0x43, 0x10, 0x99,\r\n  0x0c, 0xb1, 0x22, 0xb5, 0x55, 0xd2, 0x6b, 0x3e, 0x64, 0xbb, 0xac, 0x85,\r\n  0x50, 0xb5, 0x73, 0x79, 0xe1, 0x0a, 0x26, 0x55, 0xa1, 0x27, 0xb3, 0xe1,\r\n  0xbd, 0x08, 0x68, 0x14, 0xc9, 0x8e, 0x0d, 0x07, 0xe9, 0xab, 0x5f, 0x6a,\r\n  0x48, 0x11, 0x95, 0x11, 0x58, 0x86, 0x85, 0x11, 0x0e, 0x59, 0x99, 0x8d,\r\n  0x50, 0xc2, 0xfa, 0x16, 0xeb, 0x63, 0xd2, 0x09, 0xd0, 0xfc, 0x55, 0x64,\r\n  0x40, 0x21, 0xa6, 0xee, 0x0d, 0x16, 0x17, 0x79, 0xed, 0xe4, 0x1a, 0x48,\r\n  0x45, 0x42, 0x32, 0xaf, 0xd8, 0x5d, 0x8c, 0x34, 0x6d, 0xe4, 0x78, 0xcb,\r\n  0x4b, 0x8d, 0x36, 0xe2, 0x5f, 0xd5, 0x48, 0x5c, 0x6f, 0xe5, 0xd9, 0xaf,\r\n  0x69, 0xe4, 0x59, 0xa3, 0x8d, 0x9b, 0x5f, 0xd5, 0x88, 0xab, 0xd7, 0x41,\r\n  0xd7, 0xe2, 0xf7, 0x27, 0x97, 0xd1, 0xe1, 0xd9, 0x91, 0xdf, 0xa3, 0x97,\r\n  0x9a, 0xd3, 0x8a, 0x3f, 0x98, 0x02, 0x3b, 0x63, 0x5d, 0x82, 0x0f, 0x94,\r\n  0xaf, 0xdb, 0x2b, 0x05, 0xdd, 0x18, 0xc8, 0x60, 0xce, 0xdf, 0x24, 0xe5,\r\n  0x7f, 0x17, 0x92, 0x47, 0x16, 0x92, 0xa8, 0xb9, 0xf2, 0x73, 0x28, 0x37,\r\n  0xa7, 0xf8, 0x09, 0x06, 0x10, 0xd0, 0x05, 0x1a, 0x17, 0xea, 0x08, 0x8f,\r\n  0x26, 0x31, 0xc7, 0xd2, 0x32, 0x09, 0x41, 0x92, 0x6e, 0x72, 0x50, 0xd5,\r\n  0xb0, 0x6b, 0xb9, 0xcb, 0x4b, 0x95, 0x42, 0xf5, 0x05, 0xca, 0xad, 0x0e,\r\n  0xd4, 0x5c, 0xe7, 0x82, 0x99, 0xd2, 0x95, 0x30, 0x21, 0x76, 0x57, 0x25,\r\n  0x61, 0x56, 0xdb, 0x31, 0x4a, 0xd8, 0x0c, 0xcd, 0x8b, 0x2d, 0x1e, 0x44,\r\n  0x8a, 0x70, 0x20, 0xf9, 0x56, 0xcc, 0x9c, 0xed, 0xad, 0xb5, 0xe4, 0x5a,\r\n  0x22, 0xca, 0x35, 0xe1, 0xbe, 0xb3, 0xa7, 0xa8, 0x03, 0x29, 0xec, 0x49,\r\n  0xe7, 0x4f, 0x33, 0x29, 0xd3, 0x7f, 0x04, 0x77, 0xf4, 0x13, 0x1f, 0x53,\r\n  0x59, 0xc4, 0x73, 0x81, 0xe5, 0x68, 0xfa, 0xfb, 0x43, 0x56, 0xc5, 0xef,\r\n  0x81, 0x2a, 0x63, 0x95, 0x08, 0x73, 0x38, 0x0d, 0xc4, 0xe0, 0x53, 0x15,\r\n  0xce, 0x66, 0x89, 0xc3, 0x5b, 0xb9, 0xf4, 0xe8, 0x79, 0xa9, 0x20, 0x10,\r\n  0xe2, 0xf9, 0x5c, 0xad, 0x61, 0x61, 0x8e, 0x4b, 0x4a, 0xae, 0x1c, 0xd7,\r\n  0x1d, 0x33, 0xb4, 0xb7, 0xd9, 0x5f, 0x6f, 0x3c, 0x31, 0xfc, 0x01, 0xfe,\r\n  0x29, 0x07, 0x8d, 0xd3, 0x69, 0x8a, 0x44, 0x19, 0xa9, 0x1d, 0x0b, 0x8c,\r\n  0x15, 0x26, 0x6d, 0xd8, 0xed, 0x09, 0x0d, 0x79, 0x0d, 0x4c, 0xf5, 0x98,\r\n  0xe5, 0x5a, 0xd0, 0x1b, 0x31, 0x45, 0xae, 0x9a, 0x45, 0xbf, 0x79, 0xb0,\r\n  0x70, 0x6d, 0x9c, 0xc1, 0x2f, 0xd3, 0xa2, 0x5d, 0xd7, 0x85, 0x51, 0xdb,\r\n  0xd4, 0x9b, 0x81, 0xcf, 0x2c, 0x68, 0xad, 0x92, 0xdc, 0x17, 0x88, 0x51,\r\n  0x21, 0x2e, 0x2e, 0x1a, 0x75, 0xf4, 0xea, 0x3d, 0x23, 0x95, 0x62, 0xa6,\r\n  0xc8, 0xa1, 0x12, 0xb5, 0xb3, 0xbb, 0x42, 0x74, 0x60, 0x41, 0x7c, 0xd2,\r\n  0xf8, 0x8e, 0x7d, 0x86, 0x9b, 0x92, 0x75, 0x93, 0x4f, 0x34, 0xa1, 0xf7,\r\n  0xdc, 0x7c, 0xbb, 0xb5, 0x4f, 0x9b, 0x5b, 0xc4, 0x60, 0xf0, 0xcc, 0x84,\r\n  0x96, 0x87, 0x09, 0x31, 0x9f, 0xe9, 0x93, 0x64, 0xcc, 0xdf, 0x27, 0xec,\r\n  0xe8, 0xd1, 0x2b, 0xb5, 0x48, 0x96, 0x73, 0x37, 0x3a, 0x03, 0x71, 0x0a,\r\n  0x3b, 0x89, 0x50, 0x03, 0x8a, 0xdb, 0x6b, 0xaa, 0xfd, 0x6d, 0x43, 0xba,\r\n  0x42, 0x85, 0xf1, 0xb9, 0xff, 0x48, 0x14, 0x23, 0x65, 0x82, 0xb7, 0x49,\r\n  0x96, 0xba, 0x2d, 0xa9, 0x35, 0xf0, 0xf0, 0x23, 0xce, 0xfa, 0xa5, 0x3b,\r\n  0x20, 0x77, 0xff, 0xd6, 0x37, 0x5a, 0x7c, 0xd1, 0x0d, 0x2c, 0x36, 0xcf,\r\n  0xc2, 0xaa, 0x10, 0xde, 0x0d, 0xcf, 0x64, 0x6d, 0xb5, 0xc3, 0x35, 0x29,\r\n  0x16, 0xa5, 0x46, 0xb9, 0x04, 0x65, 0x3b, 0x93, 0x33, 0xbf, 0xaa, 0x94,\r\n  0x21, 0x27, 0x82, 0x1b, 0x7b, 0x16, 0x54, 0x6e, 0xc0, 0xa5, 0xec, 0x1b,\r\n  0xc5, 0x39, 0xb0, 0x9b, 0x07, 0x80, 0xbe, 0x76, 0x8a, 0xb2, 0xaf, 0xed,\r\n  0xe7, 0xe7, 0x61, 0x77, 0xb7, 0x31, 0xd9, 0xe7, 0x07, 0xe3, 0xb1, 0x4d,\r\n  0x35, 0xd8, 0xbc, 0x6d, 0x3e, 0x65, 0x06, 0x35, 0x61, 0x01, 0x4c, 0x45,\r\n  0xca, 0xe3, 0xd1, 0x61, 0xee, 0x68, 0x23, 0x8d, 0x4c, 0xa7, 0xdd, 0x27,\r\n  0x7e, 0xce, 0xdd, 0xc7, 0xbe, 0x95, 0xd6, 0x06, 0x1f, 0xf9, 0xb1, 0xce,\r\n  0x6f, 0x7d, 0xdb, 0xf1, 0xad, 0xa7, 0x8d, 0x71, 0xed, 0xed, 0x7d, 0xaa,\r\n  0xec, 0x12, 0x42, 0xd4, 0x1a, 0xec, 0x14, 0xdd, 0x1c, 0x2a, 0x2c, 0xe8,\r\n  0xc1, 0xa1, 0x11, 0xb5, 0x25, 0x1d, 0xd5, 0x27, 0x10, 0xa0, 0xca, 0xc2,\r\n  0x4f, 0x3d, 0xf3, 0xc3, 0x22, 0xa3, 0x89, 0xdb, 0xe3, 0x50, 0x83, 0x1c,\r\n  0x93, 0xd6, 0xe9, 0x71, 0x15, 0x6e, 0x4e, 0xb8, 0x67, 0xa4, 0x86, 0xad,\r\n  0xc9, 0x1d, 0xb3, 0x6e, 0x04, 0xdf, 0xf9, 0xd4, 0x7d, 0xc7, 0xf5, 0x9c,\r\n  0x8d, 0x1a, 0xe1, 0xb3, 0x1a, 0x85, 0x12, 0x41, 0xf7, 0x48, 0x00, 0x8b,\r\n  0x57, 0xb8, 0x4d, 0x7b, 0xcb, 0xea, 0xdb, 0xfe, 0x2b, 0x72, 0xfc, 0xce,\r\n  0x79, 0x17, 0x2b, 0x6f, 0xfc, 0x28, 0x3a, 0x83, 0x11, 0x56, 0x23, 0x07,\r\n  0x84, 0x29, 0xcb, 0xc7, 0xdd, 0x31, 0x02, 0x87, 0xa7, 0x7d, 0xf7, 0x79,\r\n  0x30, 0x27, 0xd6, 0x2d, 0x0b, 0x07, 0x6e, 0xdb, 0xf1, 0x71, 0x22, 0xc4,\r\n  0x42, 0xfd, 0x49, 0x74, 0x71, 0x7c, 0x79, 0xc1, 0x49, 0x30, 0x60, 0x38,\r\n  0x6c, 0x8a, 0x58, 0x3a, 0x53, 0x5b, 0x0e, 0xec, 0x20, 0x55, 0xa4, 0x83,\r\n  0x3b, 0xc8, 0xef, 0xe4, 0x9f, 0x57, 0x2c, 0x90, 0x70, 0xeb, 0x32, 0xd9,\r\n  0x91, 0xfc, 0xd3, 0xde, 0x73, 0x45, 0xea, 0xe5, 0x56, 0xf6, 0x69, 0x22,\r\n  0x7a, 0x32, 0xdc, 0xfc, 0xfb, 0x9c, 0x3d, 0x50, 0x39, 0x8b, 0x58, 0xd3,\r\n  0xb4, 0xf9, 0x91, 0xa6, 0x82, 0x39, 0x02, 0x09, 0x6c, 0x28, 0x7f, 0x91,\r\n  0x48, 0xea, 0x79, 0x3b, 0xbe, 0xe5, 0x3e, 0x6e, 0x52, 0xdf, 0x15, 0x86,\r\n  0xf5, 0xec, 0x0a, 0xf8, 0xa4, 0xd7, 0x2e, 0xd4, 0x43, 0xf0, 0x74, 0x67,\r\n  0xa7, 0xdd, 0x5c, 0x3c, 0xc9, 0xef, 0x0c, 0x33, 0xaa, 0x6c, 0x20, 0x52,\r\n  0x56, 0x1e, 0xeb, 0x05, 0xed, 0xa2, 0x44, 0x35, 0xeb, 0x2b, 0xf6, 0x09,\r\n  0xf0, 0x8c, 0x59, 0xac, 0x25, 0x98, 0x37, 0x39, 0x95, 0xdf, 0x81, 0x9d,\r\n  0x44, 0xe7, 0xac, 0x7e, 0x16, 0x85, 0xb8, 0xc4, 0xc8, 0x9e, 0x63, 0x4b,\r\n  0xe4, 0x86, 0x7b, 0x4e, 0x21, 0x08, 0xad, 0x9e, 0x29, 0x41, 0x65, 0xf0,\r\n  0x99, 0x67, 0x1d, 0x3b, 0x22, 0x1a, 0x5f, 0x9e, 0x5d, 0x44, 0xba, 0xc9,\r\n  0xda, 0x62, 0x17, 0x09, 0x76, 0xfc, 0x84, 0xc3, 0xcd, 0x0e, 0x3a, 0xe2,\r\n  0xfb, 0xce, 0xf5, 0x2b, 0x59, 0x7f, 0xcc, 0x70, 0xe5, 0xbf, 0xfa, 0x89,\r\n  0xc7, 0x8b, 0xe9, 0xd8, 0xbe, 0x8d, 0x0b, 0x70, 0x18, 0x19, 0xef, 0xbc,\r\n  0x15, 0xb1, 0x0c, 0x5e, 0x92, 0x83, 0x76, 0xb6, 0xc2, 0x66, 0x17, 0x1f,\r\n  0x2e, 0xef, 0x23, 0xf5, 0xe6, 0x32, 0x4e, 0x55, 0x7d, 0x62, 0x2e, 0xe8,\r\n  0xd6, 0xdc, 0x8b, 0x72, 0x88, 0xce, 0x7c, 0x65, 0x01, 0x09, 0xcf, 0x8f,\r\n  0x1a, 0xe0, 0x39, 0xfc, 0x1c, 0x1c, 0x47, 0x8a, 0x75, 0xd0, 0x3d, 0xa4,\r\n  0xe5, 0xa7, 0x9b, 0xab, 0x3d, 0x25, 0xcd, 0x48, 0xd0, 0xa3, 0xb9, 0x95,\r\n  0x6e, 0x35, 0x6d, 0xd1, 0x6b, 0x59, 0x3b, 0x7e, 0x9e, 0xcf, 0xcf, 0x2e,\r\n  0x2e, 0xad, 0xdc, 0xba, 0x5e, 0x9c, 0xf8, 0x51, 0xe3, 0x08, 0x31, 0x19,\r\n  0x16, 0x2c, 0x38, 0x4f, 0x53, 0xd1, 0xb2, 0x4a, 0x55, 0x23, 0xac, 0xac,\r\n  0x09, 0x6b, 0x83, 0xc1, 0xa5, 0xc5, 0x83, 0x01, 0x8a, 0x5c, 0x31, 0x77,\r\n  0xc8, 0x1c, 0xf1, 0xa2, 0x40, 0x40, 0x77, 0x07, 0x52, 0xbd, 0x4e, 0xf3,\r\n  0x64, 0xb7, 0x63, 0x77, 0xb0, 0x01, 0x7d, 0x71, 0xcc, 0x75, 0x4e, 0x2f,\r\n  0x6f, 0xe4, 0x6f, 0xad, 0x9e, 0x8b, 0xf7, 0x50, 0x7f, 0xd8, 0x89, 0xfe,\r\n  0xc0, 0xee, 0xe0, 0x9c, 0x0d, 0x06, 0x81, 0x73, 0xfb, 0xce, 0xdf, 0x1c,\r\n  0xcc, 0xd9, 0x93, 0x20, 0x3f, 0x17, 0x92, 0x53, 0xf7, 0x0a, 0x0e, 0x39,\r\n  0x7e, 0xd0, 0xd3, 0x8f, 0xf4, 0xe8, 0xce, 0x95, 0x43, 0x91, 0x17, 0xb7,\r\n  0x41, 0x0b, 0x4f, 0x03, 0x69, 0xc1, 0xd2, 0x5d, 0x1b, 0x38, 0xb1, 0xb8,\r\n  0x35, 0xff, 0xd0, 0x61, 0x38, 0xaf, 0x93, 0xcc, 0x36, 0x86, 0x3c, 0xe7,\r\n  0xdb, 0x79, 0xe6, 0xa2, 0x3d, 0xa6, 0x1f, 0x05, 0x5d, 0xe1, 0x1f, 0x5b,\r\n  0x5a, 0x24, 0xf0, 0x5b, 0x8d, 0x6d, 0xf7, 0xe4, 0x13, 0x37, 0x8b, 0x6c,\r\n  0x4c, 0x38, 0xf8, 0x85, 0x0c, 0x3f, 0xb8, 0x8c, 0x18, 0xbf, 0x92, 0x66,\r\n  0xab, 0x44, 0x3d, 0x66, 0x71, 0x31, 0x4f, 0xe1, 0x5e, 0x9e, 0x74, 0x79,\r\n  0x77, 0x5d, 0x8a, 0xaf, 0xff, 0x8e, 0xde, 0x44, 0x27, 0xa7, 0xc7, 0x7e,\r\n  0xb5, 0x84, 0x87, 0x0a, 0x27, 0xd9, 0x2b, 0x79, 0x74, 0x70, 0x33, 0x77,\r\n  0x5d, 0x8c, 0xa2, 0x73, 0xae, 0xf3, 0x82, 0xe0, 0x53, 0xf9, 0xef, 0xbe,\r\n  0x35, 0x39, 0x2c, 0x70, 0xc6, 0xd0, 0xfd, 0x09, 0xed, 0x34, 0xcd, 0x68,\r\n  0x71, 0xf1, 0x13, 0xfe, 0x6b, 0x50, 0xa2, 0xa3, 0x35, 0xe4, 0xe7, 0xfe,\r\n  0xe5, 0x92, 0x06, 0x42, 0x76, 0x5a, 0xf3, 0x91, 0xa7, 0xba, 0xb7, 0xc8,\r\n  0x88, 0x93, 0x52, 0xc1, 0x79, 0x25, 0xf2, 0x99, 0xcf, 0xb4, 0x55, 0x95,\r\n  0x96, 0x16, 0xae, 0xec, 0x19, 0xd3, 0x63, 0xe5, 0x39, 0xdf, 0x94, 0x5c,\r\n  0x0a, 0x07, 0x32, 0x4f, 0xc0, 0xaf, 0xd3, 0xb9, 0x99, 0xc4, 0xd3, 0x5b,\r\n  0x6a, 0x2b, 0x63, 0x89, 0x3b, 0x37, 0x77, 0x79, 0x2d, 0x99, 0x05, 0x13,\r\n  0xab, 0x8c, 0x70, 0xed, 0x92, 0xd7, 0x8d, 0xa2, 0x35, 0x4f, 0x65, 0x37,\r\n  0xba, 0xad, 0xe3, 0xee, 0xb1, 0x5a, 0xef, 0xf8, 0xc3, 0x1e, 0xb5, 0xcd,\r\n  0xcb, 0xcd, 0xae, 0x21, 0x54, 0x3c, 0x0f, 0x9a, 0x7a, 0xe6, 0x9b, 0xba,\r\n  0x62, 0x4e, 0x28, 0xd7, 0x96, 0x97, 0x41, 0x9e, 0x06, 0x39, 0x75, 0x8f,\r\n  0xa9, 0xa1, 0x20, 0x77, 0x59, 0xcb, 0x54, 0xa8, 0xdf, 0x1f, 0x4f, 0x65,\r\n  0x33, 0x5c, 0xe6, 0x6c, 0xf9, 0x64, 0x0f, 0x9e, 0x02, 0x62, 0x24, 0xe0,\r\n  0x3e, 0xf1, 0x41, 0x08, 0x2d, 0xb8, 0x23, 0x87, 0x10, 0x6b, 0x53, 0x0d,\r\n  0x74, 0xae, 0x5e, 0xdf, 0x42, 0x90, 0xae, 0x16, 0x9a, 0xf9, 0x1e, 0x7c,\r\n  0xe9, 0x33, 0xb5, 0x66, 0xa5, 0x50, 0xb1, 0x11, 0xe4, 0x79, 0x88, 0x7e,\r\n  0x6e, 0xc6, 0x92, 0x8b, 0xdb, 0xd1, 0xe6, 0x41, 0x48, 0xc5, 0xa5, 0x6a,\r\n  0xb4, 0xd9, 0x26, 0x39, 0x74, 0x82, 0x0b, 0x59, 0x15, 0x45, 0x33, 0x2c,\r\n  0xf3, 0x80, 0xb8, 0x90, 0x27, 0x5c, 0x9f, 0x93, 0x5f, 0x59, 0xc0, 0xb0,\r\n  0x1d, 0x90, 0x29, 0x92, 0xbf, 0xa3, 0x7a, 0xd5, 0x48, 0x2e, 0x1d, 0xa1,\r\n  0x0e, 0x92, 0x51, 0x32, 0xc4, 0xc0, 0x8b, 0xbc, 0xa7, 0xcf, 0xd5, 0x55,\r\n  0xa1, 0xa6, 0xb0, 0x55, 0x54, 0x6a, 0x7a, 0x9a, 0x9f, 0xed, 0x3a, 0xbf,\r\n  0x0f, 0x27, 0x9a, 0xf7, 0x4b, 0x91, 0x0e, 0x41, 0xba, 0x79, 0xce, 0xf5,\r\n  0x96, 0xbf, 0x8e, 0x5e, 0x1f, 0x3d, 0xe3, 0x84, 0xc7, 0xeb, 0xa4, 0xe0,\r\n  0x6a, 0x65, 0xde, 0x16, 0x3b, 0xfb, 0x26, 0x68, 0x6c, 0xcf, 0x3b, 0x91,\r\n  0xf4, 0xaa, 0x4d, 0xf5, 0xf4, 0xb2, 0x96, 0x4d, 0xeb, 0xc7, 0xac, 0x69,\r\n  0xd7, 0x03, 0x0d, 0x9f, 0x88, 0x1b, 0x84, 0x27, 0xd2, 0x08, 0x05, 0x45,\r\n  0x75, 0x69, 0x66, 0x3b, 0xd4, 0x85, 0xd8, 0xb3, 0x27, 0x5e, 0x88, 0x71,\r\n  0xf5, 0xf6, 0x9c, 0xec, 0xea, 0x6b, 0xd6, 0xa8, 0x3b, 0x4e, 0xd4, 0x33,\r\n  0x11, 0x9c, 0x87, 0x72, 0xee, 0x59, 0x9d, 0x6d, 0xbf, 0x06, 0xf2, 0x36,\r\n  0x44, 0x3b, 0x82, 0xf7, 0x9e, 0x85, 0xe6, 0x24, 0x29, 0xe4, 0xb8, 0x17,\r\n  0x69, 0xfe, 0x50, 0xa9, 0x8f, 0x75, 0x95, 0xe0, 0xd9, 0x4f, 0xdc, 0xb3,\r\n  0xec, 0x3c, 0x48, 0xb3, 0x80, 0x30, 0x7e, 0xcd, 0x1b, 0xaa, 0x04, 0x8b,\r\n  0x6a, 0xe0, 0x61, 0x11, 0xa2, 0xf9, 0x04, 0x73, 0x1f, 0xbc, 0xf2, 0xbc,\r\n  0x6e, 0x2d, 0xa3, 0x1c, 0x8e, 0xaf, 0xf2, 0xca, 0x83, 0x4a, 0x97, 0x37,\r\n  0xe1, 0xe1, 0xfc, 0x44, 0x6e, 0xea, 0x73, 0x66, 0x0f, 0xa8, 0xad, 0xa7,\r\n  0x09, 0xc1, 0x5a, 0xe4, 0xd5, 0xce, 0xba, 0xec, 0xfd, 0xc3, 0x03, 0x7b,\r\n  0xa3, 0x95, 0xaa, 0xc1, 0xbb, 0x3d, 0xf8, 0xc8, 0xae, 0x9e, 0x19, 0x1a,\r\n  0x72, 0x7e, 0x9d, 0xa5, 0xff, 0xe0, 0x8d, 0x66, 0x37, 0xb4, 0x91, 0xfd,\r\n  0x07, 0x8f, 0xef, 0xa9, 0xc0, 0xb8, 0x8b, 0xe7, 0xa9, 0x0a, 0x45, 0xf6,\r\n  0xa3, 0xfb, 0x07, 0x9e, 0xe8, 0xae, 0x7d, 0x9f, 0xf2, 0x11, 0x85, 0x15,\r\n  0x80, 0xba, 0x21, 0x1c, 0xc1, 0x49, 0x6a, 0x64, 0x14, 0x9f, 0x3c, 0x55,\r\n  0xdd, 0xcb, 0x94, 0x64, 0xbe, 0x97, 0x50, 0x83, 0x9c, 0x03, 0xdc, 0x2d,\r\n  0x31, 0xfd, 0x89, 0x5e, 0x7d, 0xba, 0x94, 0x0a, 0x7f, 0x8a, 0x4d, 0x42,\r\n  0x97, 0x20, 0x83, 0xb9, 0x4f, 0x33, 0xcd, 0x3f, 0x6a, 0xbd, 0xfe, 0xc9,\r\n  0x1a, 0x17, 0x54, 0x29, 0xf7, 0xe6, 0x31, 0xf6, 0x52, 0xf0, 0xfc, 0xa7,\r\n  0xee, 0x24, 0x38, 0xee, 0xde, 0x81, 0x8b, 0xa3, 0x02, 0x10, 0x67, 0x24,\r\n  0xeb, 0x76, 0x90, 0x60, 0xf6, 0x2f, 0x7d, 0x31, 0xca, 0x0e, 0x56, 0xea,\r\n  0x2b, 0xf7, 0xf9, 0x79, 0x7e, 0x1d, 0xa5, 0xc1, 0x31, 0xfe, 0x44, 0xb6,\r\n  0xd4, 0x2b, 0x54, 0x5f, 0xb2, 0x73, 0xc0, 0xd2, 0x24, 0x2c, 0x92, 0xe2,\r\n  0x9f, 0x7e, 0xae, 0x7b, 0xc3, 0xee, 0x4b, 0x53, 0x53, 0xd7, 0xbe, 0xf1,\r\n  0xe9, 0x4e, 0xa8, 0xb4, 0xce, 0xd8, 0x53, 0x2f, 0x34, 0x80, 0x6b, 0x5f,\r\n  0x90, 0x9d, 0x71, 0x42, 0xd7, 0xc8, 0x35, 0x6d, 0x6a, 0x3c, 0xe3, 0xf9,\r\n  0x2f, 0xfd, 0x63, 0x7b, 0x35, 0xa1, 0x7b, 0x19, 0xaa, 0x50, 0xd1, 0xc9,\r\n  0x51, 0xf0, 0xe0, 0x13, 0x3f, 0xc0, 0x78, 0xce, 0xda, 0xc0, 0x83, 0x38,\r\n  0x22, 0x4a, 0xad, 0x53, 0x13, 0x3c, 0xfa, 0x54, 0x73, 0x18, 0x24, 0x73,\r\n  0x0b, 0xf3, 0xdf, 0x7a, 0x46, 0xb6, 0xc3, 0x21, 0xb2, 0xbe, 0x2a, 0x64,\r\n  0xcd, 0x67, 0x16, 0x2f, 0x68, 0xae, 0xfd, 0xa7, 0x9f, 0x3c, 0xf2, 0xac,\r\n  0x5e, 0x9a, 0xa5, 0xbb, 0xea, 0x83, 0xf7, 0x3e, 0x6d, 0x1f, 0x73, 0x33,\r\n  0x0b, 0x8c, 0xdc, 0x43, 0x4f, 0x5a, 0xb4, 0xc9, 0xa4, 0x70, 0xff, 0x6e,\r\n  0x9e, 0x9f, 0x82, 0xb3, 0xdf, 0xca, 0x7f, 0x0f, 0xfb, 0xfb, 0x59, 0xc8,\r\n  0x10, 0x22, 0x6e, 0x1f, 0x57, 0x2b, 0x31, 0xac, 0xa0, 0xe4, 0xf3, 0x13,\r\n  0x30, 0x3b, 0x41, 0x0b, 0xb2, 0xe6, 0xa4, 0x47, 0xac, 0x32, 0x2f, 0x39,\r\n  0xc4, 0x10, 0x54, 0x62, 0x45, 0x03, 0x4d, 0x6b, 0xef, 0xbe, 0xa6, 0x45,\r\n  0xc5, 0xee, 0x08, 0x9c, 0x67, 0x3b, 0x8d, 0x63, 0x50, 0xde, 0xac, 0xc4,\r\n  0xf2, 0x76, 0x23, 0xf2, 0x84, 0x3e, 0xc1, 0x6b, 0x7b, 0x5e, 0x7a, 0xe9,\r\n  0xb5, 0x2f, 0x34, 0x2d, 0x87, 0x5c, 0x25, 0x4a, 0xcc, 0xf3, 0x08, 0x5b,\r\n  0x11, 0x30, 0xfd, 0x42, 0x4a, 0xb4, 0x1a, 0x5d, 0xe7, 0x66, 0xdc, 0x9d,\r\n  0xbc, 0xae, 0x7c, 0x1b, 0xc1, 0x67, 0x54, 0xb5, 0x61, 0xa4, 0x39, 0xad,\r\n  0xd2, 0x4d, 0x32, 0xbd, 0xb5, 0x23, 0xe3, 0xda, 0xe8, 0x78, 0xeb, 0xa9,\r\n  0x9b, 0x5a, 0xde, 0x7d, 0xe7, 0x17, 0xc7, 0x4d, 0x43, 0xc0, 0x3f, 0x2a,\r\n  0xbb, 0xe6, 0xe2, 0x72, 0x7c, 0xbe, 0xcf, 0xfd, 0x95, 0x18, 0x0c, 0x1d,\r\n  0x88, 0xc3, 0x71, 0xf2, 0xb3, 0xe6, 0xd5, 0x96, 0xfe, 0xe9, 0x4f, 0xd6,\r\n  0x3c, 0x3d, 0x56, 0x84, 0xd4, 0xc9, 0x8c, 0xa5, 0x2f, 0xad, 0x43, 0xf8,\r\n  0xd2, 0xa7, 0x9a, 0xf3, 0x6e, 0xde, 0x5d, 0x71, 0x1e, 0x71, 0xcf, 0x5c,\r\n  0x3e, 0x85, 0x7f, 0xf8, 0x33, 0xef, 0xb3, 0xb9, 0x59, 0x65, 0xb7, 0x4e,\r\n  0x5f, 0x54, 0xc0, 0x99, 0x2d, 0xb0, 0x7b, 0xe1, 0xfb, 0xef, 0x45, 0xbe,\r\n  0xe6, 0x06, 0x2b, 0x50, 0xb7, 0xbe, 0xab, 0xf1, 0x47, 0xf2, 0x48, 0x2a,\r\n  0xeb, 0xf1, 0xd6, 0x86, 0x33, 0xbc, 0x48, 0xe6, 0x09, 0xd3, 0x26, 0x8b,\r\n  0x8d, 0x80, 0x4d, 0xd5, 0x95, 0xcd, 0xc5, 0xc8, 0x59, 0xa9, 0x45, 0x9c,\r\n  0x28, 0xbf, 0x76, 0xc6, 0x70, 0x4b, 0xf5, 0x15, 0xd1, 0x6c, 0x1f, 0xbc,\r\n  0xbd, 0xfc, 0xfa, 0xec, 0x62, 0x1c, 0x6d, 0x33, 0xbf, 0xdd, 0xe5, 0xc5,\r\n  0xc9, 0x97, 0x6f, 0xc9, 0xf4, 0x76, 0x21, 0x91, 0xa3, 0x98, 0x4c, 0xf2,\r\n  0x39, 0x83, 0x53, 0x93, 0x8c, 0x26, 0xf1, 0xda, 0x0a, 0x49, 0x01, 0x39,\r\n  0xc3, 0xf7, 0x54, 0x5e, 0x48, 0x09, 0x0a, 0xe4, 0xdb, 0xdc, 0xe4, 0x3a,\r\n  0x13, 0x02, 0x32, 0xcb, 0x24, 0x05, 0x21, 0xf7, 0x76, 0x65, 0xda, 0xa0,\r\n  0xe7, 0xb3, 0xc8, 0x66, 0x74, 0xf9, 0xf5, 0xc1, 0x9b, 0x6f, 0xc6, 0x46,\r\n  0xf0, 0xfd, 0xdd, 0x77, 0xdf, 0x6d, 0xd4, 0xd3, 0xf2, 0xa0, 0xde, 0xdd,\r\n  0xc4, 0xef, 0xdf, 0x8f, 0xca, 0x64, 0x63, 0xe3, 0x95, 0x8f, 0x93, 0xf9,\r\n  0x2a, 0x60, 0xe5, 0x8a, 0x6e, 0x75, 0xfa, 0xf5, 0xf6, 0x72, 0x35, 0xe1,\r\n  0xaa, 0x63, 0xdb, 0xab, 0x2a, 0x9d, 0xd3, 0x65, 0x90, 0x94, 0x78, 0x7b,\r\n  0x7b, 0x63, 0x63, 0x7c, 0x7c, 0x1c, 0x1d, 0x9c, 0x8e, 0xcf, 0x82, 0x77,\r\n  0x37, 0x77, 0xb7, 0x48, 0xeb, 0xb9, 0x4e, 0xaa, 0x4d, 0xa6, 0x8a, 0x3c,\r\n  0x3d, 0xb8, 0x64, 0x73, 0xf3, 0xdb, 0xe3, 0x8b, 0xf1, 0xc9, 0xd9, 0x1b,\r\n  0x5e, 0x1d, 0x06, 0xf7, 0xc5, 0xf3, 0x7b, 0xc6, 0x76, 0x5e, 0xa5, 0xe0,\r\n  0xed, 0xb8, 0xb7, 0x92, 0x5e, 0x4c, 0x40, 0x4c, 0x6a, 0x99, 0x68, 0xd1,\r\n  0x02, 0x61, 0xb0, 0x52, 0xc2, 0x02, 0x61, 0xad, 0xd8, 0xe8, 0x53, 0x81,\r\n  0xc4, 0x33, 0xe0, 0x7c, 0x4e, 0x82, 0x3e, 0x49, 0x26, 0x02, 0x19, 0x1e,\r\n  0x48, 0xb6, 0x3b, 0x62, 0x0c, 0x01, 0xc6, 0xb0, 0x73, 0xe0, 0xe3, 0x93,\r\n  0xd7, 0xe7, 0x64, 0x7d, 0xbd, 0x1d, 0x1f, 0x7c, 0x75, 0xcc, 0x8f, 0x7e,\r\n  0x95, 0x54, 0x7e, 0x39, 0xa4, 0xf4, 0x18, 0x7f, 0xe4, 0x4d, 0x52, 0x95,\r\n  0xd3, 0x78, 0xc9, 0x29, 0xd9, 0xf4, 0x99, 0xa1, 0xdc, 0x01, 0x41, 0xdb,\r\n  0xa2, 0x87, 0xfb, 0xfa, 0x6c, 0x99, 0x3e, 0x8f, 0xe2, 0x69, 0x61, 0xbb,\r\n  0x17, 0xc7, 0x07, 0x47, 0xaf, 0x8f, 0x0d, 0x77, 0x2e, 0x77, 0x26, 0x35,\r\n  0x7a, 0x93, 0x73, 0xbd, 0x5c, 0xe7, 0x85, 0xe6, 0x7b, 0x99, 0x27, 0x9f,\r\n  0x7e, 0xc3, 0xd5, 0xcb, 0xba, 0x3f, 0xe7, 0x17, 0x0a, 0xcf, 0x8e, 0xae,\r\n  0xd2, 0x6d, 0x69, 0xdd, 0xbe, 0x17, 0xbb, 0x29, 0x31, 0x5e, 0x63, 0xd5,\r\n  0x55, 0xc5, 0xa1, 0x00, 0x47, 0xc4, 0x67, 0x3b, 0x3b, 0x3b, 0x8f, 0x8c,\r\n  0x03, 0xaa, 0xbc, 0xde, 0x78, 0x34, 0x94, 0x7d, 0x7e, 0x7c, 0xdb, 0xb7,\r\n  0xef, 0x7b, 0x3c, 0xd7, 0xd4, 0x77, 0xae, 0x11, 0x93, 0x89, 0x03, 0x24,\r\n  0xad, 0x92, 0xee, 0x2e, 0x4f, 0xf3, 0xdc, 0xad, 0x40, 0x6d, 0x72, 0x66,\r\n  0xcc, 0x44, 0x9d, 0x56, 0x86, 0xa9, 0xc4, 0x1b, 0xd2, 0x71, 0xb2, 0x3e,\r\n  0x80, 0x31, 0x2b, 0x1e, 0x9a, 0x4d, 0xf2, 0x6f, 0xa8, 0x4d, 0xfe, 0xcf,\r\n  0x28, 0x2f, 0xae, 0xb7, 0x17, 0xfb, 0x50, 0x27, 0xe8, 0xa1, 0x57, 0x09,\r\n  0xaa, 0x0e, 0xdf, 0xe7, 0x0e, 0x6a, 0x5d, 0xf2, 0xc4, 0x72, 0x4a, 0xc8,\r\n  0x47, 0xf4, 0xeb, 0x17, 0xcc, 0x82, 0xa0, 0x91, 0xae, 0x6c, 0xe4, 0xe3,\r\n  0x68, 0xed, 0x7a, 0x95, 0xbc, 0x60, 0xec, 0xee, 0x1b, 0x91, 0x00, 0xa1,\r\n  0xaf, 0x30, 0x60, 0x0c, 0x5b, 0x84, 0xfe, 0x5a, 0xd0, 0x96, 0x19, 0x55,\r\n  0xef, 0x21, 0xf3, 0xb4, 0xd4, 0x95, 0xd0, 0xcc, 0x71, 0x08, 0x7a, 0xc9,\r\n  0x09, 0x73, 0x05, 0x50, 0x84, 0xf8, 0x02, 0x27, 0xe2, 0x29, 0x14, 0xdf,\r\n  0xa1, 0x6f, 0xb8, 0xe1, 0xe6, 0x37, 0x87, 0x43, 0xec, 0x9f, 0xd2, 0xed,\r\n  0x96, 0x8f, 0xf8, 0x78, 0x30, 0x28, 0x99, 0xfd, 0x4c, 0xaf, 0xc8, 0x60,\r\n  0xef, 0x8c, 0xa9, 0x17, 0xad, 0x6f, 0xad, 0x7c, 0x49, 0xb2, 0x52, 0x3e,\r\n  0x57, 0xde, 0xd0, 0xf9, 0x1d, 0x69, 0x6e, 0x20, 0xbe, 0x45, 0x6b, 0xb2,\r\n  0x8d, 0x04, 0xa9, 0x8f, 0xfe, 0xd2, 0xe1, 0xb9, 0xab, 0xb2, 0x4e, 0x33,\r\n  0x70, 0xc7, 0x53, 0x70, 0x9b, 0x60, 0xf4, 0xa1, 0x56, 0xff, 0x48, 0x67,\r\n  0xf6, 0x69, 0x16, 0xf8, 0x8d, 0xff, 0xb5, 0x3d, 0x2a, 0xcb, 0x9b, 0xed,\r\n  0x74, 0xf6, 0x6e, 0x56, 0xc6, 0x0c, 0x48, 0x5a, 0x4d, 0x5a, 0x3f, 0x1e,\r\n  0xd1, 0x0f, 0xa3, 0x1f, 0x6b, 0x52, 0xbf, 0x9c, 0x76, 0x8f, 0xe4, 0x7f,\r\n  0x6d, 0x33, 0xb4, 0x14, 0x25, 0x5a, 0x82, 0x89, 0xeb, 0x90, 0x1d, 0x34,\r\n  0x2a, 0x41, 0x31, 0xd3, 0x61, 0xec, 0xde, 0x19, 0xc3, 0xeb, 0xa8, 0xa7,\r\n  0xdb, 0xed, 0x87, 0xbd, 0x9d, 0x9d, 0xdd, 0xfd, 0xdd, 0xcf, 0x9e, 0xef,\r\n  0xec, 0xef, 0xee, 0xee, 0xee, 0xed, 0xef, 0xee, 0xef, 0xef, 0xed, 0xfc,\r\n  0xb4, 0xdd, 0xdb, 0xd8, 0x38, 0x3a, 0xfb, 0xee, 0xcd, 0xe9, 0xd9, 0xc1,\r\n  0x51, 0x74, 0x79, 0x16, 0x1d, 0xc0, 0x67, 0xd4, 0x71, 0xce, 0x01, 0x9c,\r\n  0xe4, 0x6c, 0x38, 0x49, 0xd6, 0x0f, 0x6a, 0xd6, 0xaa, 0x83, 0xc3, 0x01,\r\n  0x67, 0x30, 0x33, 0xcd, 0x7e, 0xe4, 0xb0, 0x09, 0xb8, 0xa5, 0xd1, 0x4d,\r\n  0xb5, 0xf8, 0xb0, 0x44, 0xfb, 0x98, 0x2f, 0x0f, 0x24, 0x90, 0xeb, 0xcd,\r\n  0x3e, 0x74, 0xc7, 0x76, 0xae, 0x26, 0x9b, 0x68, 0x30, 0x44, 0x43, 0xa0,\r\n  0x2e, 0x35, 0x62, 0x53, 0x70, 0x3f, 0xbe, 0xd4, 0xaa, 0x94, 0xf0, 0x6d,\r\n  0x00, 0x96, 0x5c, 0x49, 0x4d, 0x8d, 0xb1, 0xe3, 0x8e, 0x67, 0x85, 0x66,\r\n  0xab, 0x35, 0xc0, 0xb3, 0xb5, 0x43, 0xa2, 0xbb, 0x28, 0x79, 0x8f, 0x51,\r\n  0xd7, 0x65, 0x87, 0x80, 0x67, 0xfd, 0xe8, 0xc0, 0x3b, 0x6e, 0x86, 0x6c,\r\n  0x5a, 0x58, 0x97, 0x81, 0x0d, 0xea, 0xf8, 0x1c, 0x7f, 0xc7, 0x44, 0x8a,\r\n  0xff, 0x04, 0xff, 0x26, 0xbc, 0x87, 0xb6, 0x9d, 0x6f, 0x50, 0x3a, 0xf0,\r\n  0x76, 0x7c, 0xf2, 0xe6, 0x2b, 0x44, 0xff, 0xbe, 0x3b, 0xbb, 0x38, 0x1a,\r\n  0x53, 0xb3, 0x7c, 0x41, 0x6f, 0xc0, 0x3d, 0xc4, 0x27, 0x59, 0x7b, 0x25,\r\n  0xe7, 0x82, 0x3f, 0xfd, 0x17, 0x18, 0x5c, 0xb3, 0x81, 0x4b, 0xaf, 0x46,\r\n  0x37, 0x03, 0x65, 0x99, 0xd3, 0xa6, 0xbb, 0xa5, 0x1e, 0x36, 0x82, 0xbc,\r\n  0xfe, 0xc5, 0x22, 0xe6, 0xea, 0x18, 0xc9, 0x48, 0x80, 0xbc, 0x80, 0x69,\r\n  0x6d, 0x73, 0x7e, 0xc4, 0x36, 0x2b, 0xed, 0xdb, 0x55, 0x0e, 0xf9, 0x81,\r\n  0x56, 0xf2, 0xc2, 0x61, 0x83, 0x6a, 0x33, 0xc2, 0x07, 0xef, 0x6a, 0x1e,\r\n  0x5f, 0xe3, 0x83, 0xed, 0x33, 0x19, 0x7c, 0x4c, 0x3f, 0xff, 0xb1, 0x9f,\r\n  0x64, 0xb1, 0x87, 0xf6, 0x4e, 0xb0, 0x01, 0x40, 0x88, 0x84, 0x5c, 0x70,\r\n  0x8d, 0x5a, 0x88, 0xd2, 0x84, 0x4a, 0xcc, 0x8c, 0x08, 0xe1, 0xd2, 0x7d,\r\n  0xcd, 0xfa, 0x27, 0x28, 0x86, 0x27, 0x24, 0x0a, 0xa4, 0xbf, 0x0f, 0x03,\r\n  0x36, 0x11, 0x31, 0x6c, 0x50, 0xdc, 0xde, 0xfb, 0x0f, 0x4a, 0x0f, 0x69,\r\n  0x43, 0x95, 0x0b, 0x98, 0xcb, 0x32, 0xe5, 0xdc, 0x19, 0x50, 0x1b, 0x94,\r\n  0x86, 0x95, 0x52, 0x2d, 0xae, 0xc7, 0xc5, 0x67, 0x18, 0xe9, 0xd0, 0x33,\r\n  0x66, 0x0b, 0x4f, 0x97, 0xef, 0xc3, 0x93, 0x65, 0x45, 0x5d, 0x89, 0xe9,\r\n  0x4a, 0xd1, 0xda, 0xbc, 0xca, 0x96, 0x4b, 0xaa, 0xb8, 0xe4, 0x9a, 0xf6,\r\n  0x0c, 0x2f, 0x21, 0xad, 0x50, 0xdb, 0xe0, 0x1c, 0x76, 0x39, 0xe3, 0x2c,\r\n  0x7c, 0x85, 0x58, 0x61, 0x43, 0xc3, 0xd1, 0x5e, 0xce, 0x7b, 0xb7, 0x17,\r\n  0xcb, 0x68, 0x52, 0x42, 0x49, 0x80, 0xca, 0xce, 0xd1, 0xac, 0xc8, 0xa0,\r\n  0xe4, 0x59, 0x6d, 0xda, 0xc2, 0x1a, 0xbf, 0x2d, 0x51, 0x5b, 0x4f, 0x87,\r\n  0xde, 0x40, 0x36, 0x94, 0xc3, 0x4a, 0x07, 0xd3, 0x23, 0xa0, 0x2c, 0xff,\r\n  0x2a, 0xaf, 0x45, 0x5a, 0x95, 0xc9, 0xfc, 0x4a, 0x29, 0x4e, 0xb4, 0x24,\r\n  0xfd, 0xe4, 0x21, 0x68, 0x60, 0xc3, 0xd2, 0x57, 0x38, 0xa6, 0x96, 0xb9,\r\n  0xac, 0xff, 0x5c, 0x65, 0xc6, 0x35, 0xa4, 0xa9, 0x72, 0xa6, 0xd4, 0x05,\r\n  0x85, 0x84, 0xcd, 0x46, 0x56, 0xf6, 0x63, 0x23, 0x72, 0x15, 0x4b, 0x1a,\r\n  0x43, 0x70, 0x55, 0x1c, 0xc0, 0xa2, 0x8f, 0xdd, 0x11, 0x3c, 0xb8, 0x9a,\r\n  0xd0, 0x6c, 0xbb, 0xe7, 0x78, 0xee, 0x00, 0x1c, 0xe3, 0xe6, 0x0e, 0xc3,\r\n  0xe2, 0xc3, 0x82, 0x99, 0x5c, 0xb5, 0x88, 0x5c, 0x52, 0xa5, 0xc3, 0xa1,\r\n  0x83, 0x86, 0x74, 0xab, 0x55, 0xe9, 0x66, 0x14, 0xb5, 0x8d, 0x62, 0x97,\r\n  0x75, 0xdc, 0x75, 0x0c, 0x55, 0x22, 0xad, 0x3f, 0x87, 0x1f, 0x3e, 0x82,\r\n  0xed, 0x2e, 0x99, 0x1d, 0x30, 0x7f, 0x90, 0x53, 0x92, 0x66, 0x8f, 0x1f,\r\n  0x46, 0xed, 0xc4, 0x47, 0x7d, 0x18, 0x63, 0x55, 0xee, 0x05, 0xb8, 0xaa,\r\n  0x3d, 0x98, 0x4b, 0xc2, 0xe3, 0x48, 0x41, 0xe8, 0x48, 0x30, 0xa9, 0x61,\r\n  0x4f, 0x71, 0x10, 0x24, 0x51, 0x6d, 0x3f, 0xfa, 0x32, 0x2e, 0xd3, 0xe9,\r\n  0x20, 0x3a, 0x4a, 0xaf, 0xc1, 0x04, 0xe0, 0x92, 0x00, 0x5c, 0xf2, 0xc4,\r\n  0x28, 0xfa, 0x4e, 0x79, 0x94, 0x39, 0x79, 0x1d, 0xac, 0x1a, 0xf0, 0xac,\r\n  0x3a, 0x32, 0x8e, 0x0d, 0x71, 0xa8, 0xab, 0x4b, 0x3c, 0x24, 0xbe, 0x40,\r\n  0xdb, 0xbe, 0x48, 0x04, 0x16, 0x33, 0x2e, 0x6f, 0xeb, 0xe5, 0xa7, 0x1c,\r\n  0xa3, 0xaf, 0xe8, 0x45, 0x98, 0xdf, 0x4c, 0xab, 0x05, 0xe8, 0x9e, 0xc3,\r\n  0xbf, 0xdd, 0x2e, 0xb7, 0x42, 0x6f, 0x70, 0x65, 0x95, 0x0a, 0xf1, 0xb2,\r\n  0x38, 0x3c, 0x6e, 0x23, 0x3b, 0xae, 0x1b, 0x48, 0xda, 0xa7, 0x79, 0xe2,\r\n  0x19, 0x51, 0x79, 0x72, 0x76, 0x79, 0xfc, 0x87, 0xe8, 0xa0, 0x19, 0x87,\r\n  0x64, 0x41, 0x5d, 0x23, 0xe0, 0x18, 0xf8, 0x7d, 0x85, 0xbe, 0x0b, 0xaa,\r\n  0x4b, 0xaa, 0xa5, 0xc4, 0x2e, 0x2b, 0x22, 0x5c, 0xf8, 0x41, 0x54, 0xe6,\r\n  0x0a, 0x51, 0x45, 0xed, 0x69, 0xdc, 0x85, 0xfc, 0x1a, 0xbc, 0xb3, 0x41,\r\n  0xc9, 0x08, 0x01, 0x8e, 0xa6, 0xb1, 0x90, 0x31, 0x30, 0xd3, 0x11, 0x8a,\r\n  0x45, 0xe3, 0x28, 0x02, 0xcd, 0xaa, 0x65, 0xb7, 0xc1, 0x25, 0x94, 0x56,\r\n  0xd0, 0x9c, 0x11, 0x68, 0xd7, 0xa2, 0x4f, 0xdf, 0xf9, 0xa6, 0xe2, 0x90,\r\n  0x74, 0xea, 0x1d, 0x9f, 0xb0, 0x77, 0x26, 0x67, 0xf5, 0x46, 0x90, 0xbe,\r\n  0x68, 0x05, 0xd7, 0xfa, 0x4e, 0xb5, 0xd3, 0x26, 0xc2, 0xfd, 0xdc, 0x30,\r\n  0x5d, 0x58, 0x8b, 0x29, 0xf8, 0x44, 0xa4, 0x18, 0x93, 0xba, 0x6d, 0xed,\r\n  0x50, 0x87, 0x72, 0x1a, 0x24, 0x4d, 0xe0, 0x25, 0x41, 0x5d, 0x44, 0x2d,\r\n  0x4b, 0x22, 0xf8, 0x59, 0x6a, 0xb5, 0x8e, 0x78, 0x46, 0x2a, 0x04, 0x66,\r\n  0x95, 0x7b, 0x21, 0x4c, 0x37, 0x21, 0xe2, 0x98, 0x5a, 0xc3, 0x87, 0xac,\r\n  0xfe, 0x5e, 0x63, 0x1f, 0x8f, 0x36, 0xf8, 0x02, 0x72, 0xae, 0x27, 0xd4,\r\n  0x9e, 0x74, 0x05, 0x3f, 0x02, 0xb8, 0xdf, 0x2b, 0xc7, 0x8e, 0xa5, 0xcd,\r\n  0x72, 0x0d, 0xb2, 0x69, 0x12, 0x24, 0x3b, 0x64, 0xb4, 0x65, 0xfd, 0x45,\r\n  0x20, 0xfb, 0x27, 0x2f, 0xb5, 0xfe, 0x64, 0x2a, 0xcc, 0x49, 0x52, 0xb4,\r\n  0x68, 0x92, 0x08, 0x93, 0x38, 0x97, 0x44, 0xc7, 0x2a, 0x82, 0x9c, 0x8e,\r\n  0x0f, 0x9e, 0xec, 0xcc, 0x05, 0x36, 0xf7, 0x86, 0xdf, 0xdd, 0x2c, 0xad,\r\n  0xd7, 0x8d, 0x53, 0x93, 0x78, 0x9d, 0xeb, 0xd1, 0x17, 0x3a, 0xcf, 0xb4,\r\n  0xfc, 0x0d, 0x7c, 0x01, 0xda, 0x6b, 0x5e, 0x1d, 0x28, 0x7a, 0x99, 0x53,\r\n  0x3b, 0x6c, 0xd1, 0x6b, 0x14, 0x60, 0x2c, 0x4a, 0x66, 0xd1, 0xe2, 0x41,\r\n  0x51, 0xfe, 0x7a, 0x55, 0x72, 0x1e, 0x3a, 0x8c, 0xcc, 0xcf, 0x3e, 0x6b,\r\n  0xa9, 0x46, 0xef, 0xdd, 0xd3, 0xfb, 0xf4, 0xeb, 0xc0, 0x98, 0x9d, 0x73,\r\n  0xcc, 0xde, 0x6a, 0x9a, 0x7b, 0x8b, 0xb6, 0xc3, 0x56, 0x08, 0xe8, 0x74,\r\n  0xe4, 0x8b, 0xce, 0xc5, 0xdd, 0xda, 0x65, 0x03, 0x9f, 0x8a, 0xb0, 0x21,\r\n  0xd6, 0x92, 0x74, 0x34, 0x2e, 0x05, 0xfb, 0xb1, 0xc6, 0x7c, 0x30, 0xe9,\r\n  0xd8, 0xec, 0x6d, 0xa0, 0x44, 0x92, 0x22, 0x3b, 0x62, 0xbd, 0x93, 0x75,\r\n  0xe2, 0x71, 0xae, 0x0d, 0xf3, 0x24, 0x6b, 0x67, 0xdc, 0xee, 0x68, 0xec,\r\n  0x23, 0x57, 0xec, 0xcd, 0xdd, 0xea, 0xc3, 0xb7, 0xeb, 0xbb, 0xf3, 0xf6,\r\n  0xd7, 0x74, 0xe7, 0x20, 0x7a, 0x14, 0xed, 0xae, 0x95, 0xfb, 0x58, 0xd0,\r\n  0x97, 0x2a, 0x4d, 0x67, 0x39, 0x76, 0xb5, 0xd9, 0x9e, 0x32, 0x47, 0x53,\r\n  0x8e, 0x53, 0x4d, 0xea, 0x75, 0x7c, 0xda, 0x76, 0x66, 0x96, 0xcb, 0xd3,\r\n  0xd0, 0xf1, 0xb9, 0xfd, 0x81, 0x75, 0xe5, 0x63, 0xbb, 0x6b, 0xcc, 0x7d,\r\n  0x96, 0xce, 0xd2, 0xa0, 0xd4, 0xd2, 0x0c, 0x92, 0xdd, 0xd1, 0x4e, 0x48,\r\n  0xcc, 0xe2, 0xf2, 0x4a, 0x0a, 0x30, 0x0c, 0x56, 0xa0, 0x68, 0xf1, 0xe9,\r\n  0x60, 0x3c, 0x12, 0xe4, 0xfd, 0x37, 0x5e, 0xd3, 0x9f, 0xed, 0x0a, 0xeb,\r\n  0x2a, 0x9d, 0x24, 0x2d, 0x45, 0xc1, 0x2c, 0x1f, 0xc9, 0x62, 0x09, 0xfc,\r\n  0xbd, 0x49, 0xc0, 0xf0, 0xee, 0xc7, 0x39, 0x7a, 0xea, 0x8f, 0xd4, 0x33,\r\n  0xb7, 0xdc, 0xda, 0x47, 0x81, 0x67, 0x6b, 0x25, 0x4f, 0x41, 0x48, 0x43,\r\n  0x17, 0x4b, 0x12, 0x69, 0xa9, 0x5a, 0x9b, 0x27, 0x74, 0x58, 0xcf, 0xe6,\r\n  0xe3, 0xfd, 0x8c, 0x3b, 0x36, 0xba, 0x5a, 0x15, 0x10, 0xbc, 0xca, 0x8f,\r\n  0xa6, 0x9c, 0x19, 0xdc, 0x2a, 0x43, 0x1d, 0x3b, 0x24, 0x0d, 0xb2, 0x59,\r\n  0xe9, 0xb8, 0xac, 0x50, 0x43, 0x55, 0x9d, 0x9d, 0x48, 0xef, 0xd7, 0x6a,\r\n  0x4a, 0x3e, 0x8c, 0xe1, 0x5c, 0x68, 0xd4, 0xee, 0x3c, 0xa5, 0x0e, 0xf5,\r\n  0x41, 0x1d, 0xc1, 0x53, 0xcf, 0x58, 0x7f, 0x95, 0x85, 0xb6, 0x85, 0x1d,\r\n  0xe1, 0x2e, 0xd2, 0x80, 0xe6, 0x40, 0x9d, 0x76, 0x16, 0x67, 0x69, 0x0a,\r\n  0x5d, 0xb9, 0x06, 0x06, 0xd1, 0xf0, 0x7f, 0xe8, 0xcc, 0xb0, 0xb6, 0xca,\r\n  0x30, 0x1c, 0x30, 0xb2, 0x2f, 0x03, 0xb2, 0x41, 0xcd, 0x96, 0x82, 0xc0,\r\n  0xe7, 0x4b, 0xdd, 0xc6, 0xe1, 0x92, 0x1b, 0x2d, 0xd9, 0x02, 0xf2, 0xef,\r\n  0x55, 0xc0, 0x1b, 0x86, 0x74, 0x50, 0x35, 0xd0, 0x07, 0x26, 0x2a, 0xa4,\r\n  0xb9, 0x0d, 0x47, 0xf1, 0x2e, 0xc0, 0xab, 0x56, 0x87, 0xdd, 0x45, 0xf6,\r\n  0x25, 0x97, 0xc0, 0x3a, 0xcc, 0xe3, 0x70, 0x5a, 0xcd, 0xb4, 0xd9, 0xb0,\r\n  0x9e, 0xca, 0xe6, 0x37, 0x39, 0xd1, 0x93, 0x84, 0xbf, 0x21, 0xbd, 0x30,\r\n  0x7c, 0xab, 0x2e, 0x87, 0x2f, 0xe4, 0x0b, 0x23, 0x78, 0x51, 0xe5, 0x0b,\r\n  0xe7, 0x28, 0xee, 0x69, 0x0f, 0xec, 0xeb, 0x4b, 0x9c, 0x25, 0xd8, 0x53,\r\n  0x87, 0x43, 0x7d, 0x56, 0xe4, 0x79, 0xcb, 0x22, 0xe4, 0xa2, 0x91, 0x18,\r\n  0xc2, 0x50, 0x7c, 0xe3, 0x7c, 0xc8, 0xe4, 0xaf, 0xf2, 0xae, 0xda, 0x52,\r\n  0x0f, 0xdc, 0xc4, 0x48, 0xe0, 0xcb, 0xea, 0x6a, 0xd8, 0xdb, 0xdd, 0x96,\r\n  0xce, 0x6c, 0x4b, 0x03, 0xa2, 0xce, 0xe9, 0x96, 0xf4, 0xf1, 0x74, 0xa3,\r\n  0x48, 0x09, 0x6f, 0x2e, 0x46, 0x5c, 0x33, 0x0e, 0x62, 0x91, 0x66, 0x89,\r\n  0x2b, 0x5c, 0xc6, 0x57, 0x13, 0xdd, 0xb5, 0xa0, 0x5c, 0xd1, 0x6c, 0x30,\r\n  0x26, 0xc6, 0x76, 0x0b, 0x34, 0x70, 0x9a, 0x1e, 0x6d, 0xa5, 0xe1, 0x5d,\r\n  0x00, 0x03, 0xe0, 0xa4, 0x3a, 0x30, 0xff, 0xd1, 0x85, 0x7e, 0xef, 0x52,\r\n  0x91, 0xc0, 0x2b, 0x92, 0x69, 0xf4, 0xf4, 0xe2, 0xe0, 0xcd, 0x57, 0xc7,\r\n  0xd0, 0x04, 0x1c, 0x21, 0x59, 0xca, 0xbb, 0x7d, 0xb6, 0x9a, 0xc2, 0x68,\r\n  0xa0, 0x19, 0x03, 0x8c, 0xa8, 0x1c, 0x69, 0xa6, 0x9a, 0xc0, 0xc1, 0x63,\r\n  0xdd, 0xbc, 0x58, 0x6e, 0x05, 0x07, 0x6d, 0x44, 0xe6, 0x20, 0x83, 0x06,\r\n  0xc1, 0xf6, 0x13, 0xe7, 0x0e, 0xe4, 0xc8, 0xf4, 0x9e, 0x2c, 0x63, 0xe5,\r\n  0xd1, 0x88, 0x43, 0x9e, 0x05, 0x75, 0x3b, 0x8c, 0xea, 0x67, 0x71, 0xc3,\r\n  0x32, 0x05, 0x9c, 0x89, 0x5b, 0xc0, 0xc4, 0x1d, 0x85, 0x3e, 0x1f, 0x61,\r\n  0x17, 0xd8, 0xdd, 0xd9, 0xf1, 0xa5, 0x14, 0x62, 0xd7, 0x60, 0x4b, 0x5a,\r\n  0x16, 0xd1, 0xce, 0xf0, 0xf9, 0xf3, 0x75, 0x82, 0xd0, 0x35, 0x0a, 0xd2,\r\n  0x86, 0x67, 0x1f, 0xdd, 0xe6, 0x90, 0x1f, 0x5d, 0xd7, 0x66, 0x87, 0x21,\r\n  0x83, 0x4a, 0xa9, 0x0a, 0xcc, 0x2a, 0x9d, 0xd6, 0xa2, 0x0e, 0x0f, 0xf1,\r\n  0xbd, 0x23, 0x16, 0x92, 0x39, 0x6b, 0x86, 0xa7, 0x72, 0xc3, 0x53, 0x16,\r\n  0x82, 0x33, 0xc0, 0x7c, 0x23, 0x4b, 0xc6, 0x66, 0xa5, 0x2e, 0x1c, 0xf6,\r\n  0x51, 0x13, 0x13, 0xd8, 0xb3, 0x6b, 0xa6, 0xe8, 0xaa, 0x3d, 0x1a, 0x53,\r\n  0x09, 0xde, 0x9e, 0xb3, 0x3b, 0xec, 0xe4, 0xcd, 0x57, 0xe2, 0x1d, 0x20,\r\n  0x53, 0x17, 0xae, 0xd1, 0xed, 0x86, 0xe1, 0xfb, 0x56, 0x2a, 0x22, 0x30,\r\n  0x2e, 0x0f, 0x71, 0x70, 0x29, 0x6b, 0x98, 0x66, 0x22, 0x0a, 0xfc, 0xea,\r\n  0xaf, 0x71, 0xcd, 0x5d, 0x46, 0xc3, 0x40, 0x39, 0xd1, 0x82, 0x08, 0xac,\r\n  0x99, 0x2c, 0x1e, 0xcc, 0x20, 0xd2, 0x2f, 0xa0, 0x75, 0x73, 0xb4, 0xbb,\r\n  0x66, 0xc5, 0x05, 0x26, 0x56, 0x2c, 0x76, 0x50, 0x4b, 0x37, 0xe9, 0xf8,\r\n  0xa4, 0x7c, 0x06, 0xe7, 0xbb, 0xa1, 0x89, 0x7c, 0x5c, 0x57, 0x6a, 0x9e,\r\n  0xbf, 0x7a, 0x09, 0x2d, 0xd6, 0xac, 0x06, 0xe6, 0x0a, 0x69, 0x7a, 0xe5,\r\n  0xa4, 0x8e, 0x70, 0x28, 0xd5, 0x79, 0xb5, 0x51, 0x6e, 0x2f, 0xcf, 0xff,\r\n  0xfb, 0xfd, 0x7c, 0xa4, 0x87, 0x7c, 0x50, 0xf9, 0xa6, 0xca, 0x66, 0xde,\r\n  0xf4, 0xd7, 0x1e, 0x77, 0xfa, 0xb5, 0x2f, 0xe5, 0x7d, 0xf9, 0x74, 0xdc,\r\n  0xfd, 0x39, 0x79, 0xdf, 0xa6, 0xa6, 0xe3, 0x00, 0xb0, 0x4a, 0xab, 0x05,\r\n  0x33, 0x5c, 0x0e, 0x9f, 0xd9, 0x32, 0xac, 0x85, 0x43, 0x72, 0xa4, 0x75,\r\n  0xb5, 0x64, 0x23, 0xd2, 0x54, 0x61, 0x94, 0xd3, 0xe0, 0x3d, 0x04, 0x7e,\r\n  0x65, 0x5c, 0x5e, 0xb7, 0xa9, 0x16, 0x94, 0x02, 0x11, 0x2c, 0x4a, 0xc4,\r\n  0x9e, 0x38, 0x22, 0x1e, 0xcf, 0xc9, 0x5b, 0xac, 0x32, 0x95, 0x7d, 0x6c,\r\n  0x6f, 0x51, 0xe7, 0xe3, 0xf2, 0x06, 0x08, 0x2c, 0xe7, 0x99, 0x69, 0xab,\r\n  0x57, 0xf8, 0xbc, 0x12, 0xcc, 0x92, 0x3e, 0x25, 0xca, 0x14, 0x94, 0xeb,\r\n  0xda, 0x54, 0xd4, 0x67, 0x20, 0x70, 0x64, 0x7c, 0xec, 0x29, 0x10, 0x9d,\r\n  0xba, 0x23, 0x74, 0x83, 0x83, 0x10, 0x08, 0x97, 0xce, 0xed, 0x57, 0x77,\r\n  0x04, 0x85, 0xfa, 0x39, 0xfc, 0x2e, 0xb0, 0x96, 0xc0, 0x88, 0xd4, 0x98,\r\n  0x42, 0x18, 0xd1, 0xe0, 0x4c, 0x14, 0x86, 0x24, 0x13, 0xb9, 0xaa, 0x0d,\r\n  0xc0, 0xfb, 0xe5, 0x2b, 0x72, 0xcc, 0x05, 0x66, 0xcf, 0xf7, 0xbd, 0x98,\r\n  0xa4, 0x88, 0x26, 0x4a, 0x7e, 0x10, 0xbe, 0x89, 0x11, 0x4a, 0x07, 0x25,\r\n  0x97, 0x5b, 0xe0, 0xb6, 0xe3, 0x4b, 0xb6, 0xee, 0x71, 0x1d, 0x99, 0x8d,\r\n  0xf8, 0xed, 0xf1, 0xc5, 0x97, 0x67, 0xe3, 0x63, 0x92, 0x16, 0x47, 0xc7,\r\n  0x5f, 0xbe, 0x65, 0x49, 0xc2, 0x2b, 0x26, 0xde, 0x51, 0x90, 0x5e, 0x4a,\r\n  0xa6, 0x2d, 0x78, 0x92, 0x90, 0x27, 0xc0, 0x5b, 0x47, 0x74, 0x93, 0x81,\r\n  0xcb, 0x5a, 0x54, 0xb5, 0x4b, 0xb8, 0x23, 0xe7, 0x89, 0xb8, 0xd3, 0x52,\r\n  0x60, 0xac, 0x3d, 0xc5, 0x30, 0x43, 0x99, 0x32, 0xe6, 0xd6, 0xae, 0x8c,\r\n  0xbb, 0xc6, 0xea, 0xa4, 0x95, 0xfb, 0x9e, 0xbf, 0xf0, 0x4e, 0x9c, 0xa7,\r\n  0x7a, 0x20, 0x7c, 0x3d, 0x63, 0xab, 0x5b, 0xac, 0x57, 0x13, 0x74, 0x5b,\r\n  0x25, 0xf9, 0x9b, 0xe7, 0x72, 0x93, 0x31, 0x53, 0x0e, 0xce, 0x35, 0xee,\r\n  0xd6, 0xb4, 0xc2, 0xb5, 0x2a, 0x4a, 0xbe, 0x56, 0x11, 0x2e, 0x65, 0xc3,\r\n  0x91, 0xc8, 0x91, 0xc4, 0xda, 0xb9, 0x8a, 0x68, 0x48, 0xa4, 0x32, 0x11,\r\n  0x86, 0x29, 0xb9, 0x49, 0x35, 0xe4, 0x28, 0x50, 0x46, 0xa5, 0xfc, 0xdf,\r\n  0x54, 0xc3, 0xf4, 0x1e, 0xe3, 0xd4, 0x1a, 0x74, 0x52, 0x6c, 0xd7, 0x2a,\r\n  0x51, 0x61, 0xe6, 0x03, 0xc4, 0x81, 0x6e, 0x9d, 0xbb, 0xf5, 0xe2, 0xe0,\r\n  0x52, 0x46, 0xca, 0xbe, 0x07, 0xb9, 0x9c, 0x8d, 0x6d, 0x14, 0x40, 0xe4,\r\n  0x80, 0xfc, 0x87, 0xe1, 0x9a, 0x4e, 0x69, 0x90, 0xf3, 0xc4, 0x80, 0xe9,\r\n  0xc0, 0xac, 0x5b, 0x5f, 0x9d, 0xd7, 0x34, 0x4c, 0x8d, 0x81, 0xf8, 0x5c,\r\n  0x09, 0x11, 0x78, 0x8a, 0x32, 0xe2, 0x25, 0x85, 0xd7, 0x5a, 0x36, 0x5f,\r\n  0xfb, 0x0c, 0x4a, 0xeb, 0x52, 0x98, 0xb7, 0x7a, 0x5f, 0x85, 0xbe, 0xfd,\r\n  0x8d, 0x8d, 0x8d, 0xa3, 0xe3, 0xcb, 0x83, 0x93, 0xd3, 0xe3, 0xa3, 0xe8,\r\n  0xe4, 0xcd, 0xab, 0xb3, 0x8b, 0xd7, 0x07, 0x97, 0x1a, 0xf0, 0x3e, 0x72,\r\n  0xce, 0x31, 0x97, 0x32, 0xeb, 0x7c, 0x8f, 0xde, 0x71, 0x86, 0x2d, 0x4c,\r\n  0xab, 0x78, 0xad, 0xbc, 0xde, 0x32, 0x0d, 0x49, 0x6d, 0x0e, 0x36, 0x22,\r\n  0x0d, 0x94, 0x7b, 0x32, 0x1e, 0xbe, 0xab, 0xb7, 0x5d, 0x78, 0x73, 0x64,\r\n  0xd3, 0xe9, 0xa8, 0x1d, 0xb9, 0x50, 0xd8, 0xa3, 0x4d, 0xb9, 0xda, 0xe8,\r\n  0x72, 0x4f, 0xf1, 0x72, 0x4a, 0x6e, 0x33, 0xf6, 0xe4, 0xf0, 0x64, 0xbb,\r\n  0x4e, 0xa7, 0x09, 0xe7, 0x87, 0x71, 0x33, 0xc5, 0x60, 0x7b, 0x08, 0x39,\r\n  0x05, 0x68, 0x07, 0xb2, 0xab, 0x2f, 0x6c, 0xd3, 0x65, 0xcb, 0x1b, 0xdb,\r\n  0x8e, 0xc0, 0x2b, 0x84, 0x1a, 0x27, 0x58, 0x5f, 0x65, 0xc8, 0xa2, 0xdd,\r\n  0x2c, 0xfb, 0x00, 0xc4, 0x8b, 0x25, 0x57, 0xe4, 0xb6, 0xb3, 0x2e, 0x6c,\r\n  0x90, 0x26, 0x44, 0x2d, 0x80, 0xa4, 0x75, 0xad, 0xc2, 0xa6, 0x36, 0x5d,\r\n  0x48, 0x94, 0xb4, 0x98, 0xe1, 0x89, 0x56, 0x3c, 0xe3, 0xb9, 0x60, 0x3e,\r\n  0x68, 0xfe, 0x6f, 0xe6, 0x99, 0xd8, 0x14, 0x1d, 0xe7, 0xad, 0xf0, 0x74,\r\n  0xdb, 0x15, 0xa1, 0xd6, 0xd3, 0xe6, 0xcf, 0xad, 0x51, 0x52, 0x0c, 0x8f,\r\n  0xe8, 0xa1, 0xd9, 0x6a, 0xb1, 0xd4, 0x92, 0x99, 0xa6, 0xe5, 0xc2, 0xbf,\r\n  0x66, 0x4b, 0x28, 0x8a, 0x14, 0x14, 0x02, 0x38, 0x63, 0x5e, 0xe9, 0x1c,\r\n  0xc8, 0x38, 0xb0, 0xbf, 0x2b, 0x8b, 0x56, 0xb1, 0xdd, 0xea, 0x03, 0x4c,\r\n  0xcd, 0x7a, 0xd9, 0x75, 0x6d, 0x02, 0x13, 0x32, 0x76, 0xcf, 0x36, 0x0b,\r\n  0x6c, 0xc7, 0x1e, 0x03, 0x82, 0xf9, 0xdf, 0x34, 0x4e, 0x7f, 0xde, 0xb2,\r\n  0xda, 0xa0, 0x9a, 0x49, 0xed, 0xf8, 0x58, 0x6d, 0x50, 0xe1, 0x8b, 0x75,\r\n  0xd4, 0x44, 0x28, 0xe9, 0xed, 0xd3, 0x9e, 0x84, 0xb3, 0xd9, 0x03, 0x95,\r\n  0xe2, 0x24, 0x4f, 0x5c, 0x59, 0x75, 0xa6, 0x95, 0x17, 0x82, 0xbd, 0x0d,\r\n  0xcd, 0xcb, 0x55, 0x49, 0x89, 0x98, 0x8d, 0x6d, 0xdf, 0x15, 0xea, 0x73,\r\n  0xe6, 0xb7, 0x6c, 0x5f, 0x23, 0x71, 0x6d, 0xf2, 0x10, 0xa6, 0x18, 0x09,\r\n  0xba, 0x47, 0xab, 0x62, 0x40, 0xe8, 0x65, 0x1b, 0x56, 0xc0, 0xca, 0x5e,\r\n  0x32, 0x7c, 0x16, 0xa4, 0xbf, 0x70, 0x3b, 0x43, 0xc8, 0xb3, 0xa1, 0x9b,\r\n  0xc4, 0x25, 0x8c, 0x1c, 0x24, 0x1a, 0xc8, 0x9d, 0xe1, 0x5c, 0xa3, 0x9e,\r\n  0x40, 0x1e, 0x97, 0x4f, 0x40, 0x64, 0x21, 0x84, 0x83, 0x31, 0x73, 0x05,\r\n  0xd8, 0xa1, 0x10, 0x50, 0xb1, 0x6b, 0x05, 0x77, 0x1d, 0x1b, 0xb1, 0xc5,\r\n  0x1c, 0xc8, 0x50, 0x85, 0xca, 0x9d, 0xe7, 0xa5, 0x9c, 0x37, 0x68, 0xdd,\r\n  0x3d, 0xa9, 0x15, 0xcd, 0xdb, 0xa0, 0xb7, 0xbc, 0xa1, 0x6f, 0xf4, 0xa2,\r\n  0x6b, 0xb6, 0x5b, 0x26, 0xd4, 0xf5, 0x96, 0x00, 0x9d, 0xc9, 0xe3, 0x2f,\r\n  0x2f, 0xe2, 0xab, 0x38, 0x99, 0xff, 0x69, 0x6f, 0x67, 0x1c, 0x5f, 0xaf,\r\n  0xe6, 0xf1, 0xbf, 0xe1, 0xc5, 0x97, 0x4f, 0x9e, 0xec, 0xed, 0x7c, 0xfa,\r\n  0xd9, 0x4e, 0xaf, 0x11, 0xb8, 0x0e, 0x30, 0x2f, 0x00, 0x31, 0xf0, 0x4d,\r\n  0x06, 0xb9, 0x8b, 0xef, 0x8c, 0xa6, 0xd7, 0x29, 0x0c, 0x2d, 0x56, 0x5e,\r\n  0x74, 0x0e, 0x62, 0xb1, 0xf0, 0x20, 0x26, 0x85, 0x05, 0x8d, 0xd9, 0x3c,\r\n  0x69, 0x5f, 0xff, 0x71, 0x77, 0x5f, 0x44, 0xd9, 0x35, 0x1c, 0xe2, 0xb1,\r\n  0xec, 0xd8, 0xe8, 0x45, 0x9a, 0xd1, 0x0d, 0xf4, 0x79, 0x54, 0xc5, 0xd7,\r\n  0x6e, 0xaf, 0xa2, 0x05, 0xac, 0x86, 0x5b, 0xce, 0x0a, 0x51, 0x54, 0x56,\r\n  0x77, 0x46, 0xd1, 0xe6, 0xa5, 0x54, 0x36, 0x80, 0xe2, 0xb3, 0x4c, 0x0a,\r\n  0x10, 0x9a, 0x5d, 0x17, 0xf1, 0xc2, 0x80, 0xf8, 0xfc, 0x3e, 0x03, 0x83,\r\n  0x46, 0xcb, 0x39, 0x30, 0xe2, 0x86, 0xee, 0x11, 0x2d, 0x54, 0x36, 0xdc,\r\n  0x7c, 0x59, 0x7a, 0x4e, 0x30, 0xb9, 0x6e, 0xc2, 0x9a, 0x09, 0x34, 0x59,\r\n  0xf0, 0x73, 0xf4, 0x30, 0xaa, 0x81, 0xa3, 0x16, 0x1a, 0xce, 0x6c, 0xa4,\r\n  0x23, 0xfc, 0x1d, 0xc9, 0xed, 0xb1, 0x10, 0xc0, 0xf5, 0x96, 0x92, 0x36,\r\n  0xea, 0xaa, 0x82, 0x8b, 0x43, 0x2c, 0xad, 0x8d, 0x2b, 0xf6, 0x80, 0xb4,\r\n  0xe8, 0x85, 0x79, 0x6e, 0x76, 0x3f, 0x7f, 0x89, 0x0d, 0xb1, 0xfb, 0xf9,\r\n  0xbf, 0xb9, 0x9f, 0xed, 0xe9, 0xcf, 0xf6, 0x3e, 0xff, 0xb7, 0xd1, 0x08,\r\n  0xfd, 0xe3, 0x1d, 0xd2, 0xb7, 0x5f, 0xf7, 0x95, 0x4a, 0x22, 0xd6, 0x23,\r\n  0x2c, 0xff, 0x72, 0xa4, 0xa9, 0xb2, 0xd6, 0x3d, 0xfb, 0x72, 0x38, 0xcb,\r\n  0x03, 0x0d, 0xfa, 0x39, 0xb9, 0x95, 0x5a, 0x31, 0x1d, 0x30, 0xe2, 0x96,\r\n  0x5d, 0x93, 0xee, 0x62, 0x13, 0x68, 0x47, 0xe1, 0x6d, 0x78, 0xf9, 0xcf,\r\n  0xbc, 0x53, 0xff, 0xbc, 0x11, 0x69, 0x6c, 0x8e, 0x97, 0xe3, 0x01, 0x41,\r\n  0x08, 0xdb, 0xb6, 0xf4, 0x68, 0x6c, 0x35, 0x1a, 0xb8, 0x65, 0x46, 0xb7,\r\n  0xf3, 0x1d, 0x18, 0x14, 0xc6, 0xfe, 0x8b, 0x26, 0xed, 0xcb, 0x82, 0x6f,\r\n  0x44, 0xee, 0x19, 0xc9, 0x02, 0x20, 0x1d, 0xa3, 0x12, 0xd6, 0x77, 0x2e,\r\n  0x18, 0xf0, 0xfd, 0xf7, 0xaa, 0x50, 0xd1, 0x5f, 0xb4, 0xe7, 0x37, 0x24,\r\n  0x8b, 0x66, 0x24, 0xde, 0x16, 0x28, 0xca, 0xab, 0xd5, 0xcc, 0xf5, 0xca,\r\n  0xbf, 0xd2, 0x91, 0x4a, 0x23, 0xb4, 0xb4, 0x07, 0xe3, 0xc3, 0x93, 0x13,\r\n  0x20, 0xf9, 0x30, 0xa9, 0xc7, 0x22, 0xc6, 0xb0, 0x37, 0x37, 0x81, 0x42,\r\n  0xf0, 0xc0, 0xaf, 0x70, 0xeb, 0xf3, 0xda, 0x61, 0xd9, 0xb1, 0xfb, 0xa9,\r\n  0x31, 0x33, 0x8a, 0x75, 0x29, 0xb1, 0x67, 0x45, 0xcb, 0x79, 0xd9, 0x93,\r\n  0x07, 0xaf, 0xd3, 0x9e, 0xc6, 0x96, 0xe4, 0x27, 0x3d, 0xcf, 0x0d, 0x22,\r\n  0xeb, 0x81, 0x45, 0x7b, 0x29, 0xaa, 0x53, 0xfa, 0x8f, 0xe4, 0xe5, 0xee,\r\n  0x4e, 0xf7, 0x13, 0xa8, 0x9c, 0xc0, 0x6c, 0xc4, 0x2f, 0x7d, 0x6c, 0xee,\r\n  0xb1, 0xe7, 0xd3, 0x99, 0x3c, 0x7d, 0x93, 0xce, 0x66, 0x74, 0x27, 0xa0,\r\n  0x28, 0xfb, 0xcb, 0xde, 0x84, 0x6f, 0x58, 0xfe, 0xff, 0x6b, 0xfa, 0x81,\r\n  0x28, 0x92, 0x3e, 0x5b, 0xae, 0x26, 0x8b, 0xb4, 0xd6, 0xe1, 0x6d, 0x1e,\r\n  0xe0, 0xe7, 0x3c, 0xe0, 0xef, 0x12, 0xb7, 0x3b, 0x12, 0x56, 0xed, 0x44,\r\n  0xf7, 0xeb, 0x5f, 0xe5, 0xf9, 0x24, 0x2e, 0xfa, 0x1a, 0x62, 0xb1, 0x7e,\r\n  0xf6, 0x77, 0xf7, 0x9e, 0x3c, 0x7d, 0xd6, 0x1f, 0xa9, 0x9e, 0x06, 0x11,\r\n  0x51, 0x85, 0x29, 0xf8, 0xd2, 0x44, 0x2c, 0x07, 0xd4, 0x90, 0xa4, 0xc8,\r\n  0xf9, 0xed, 0x8a, 0x73, 0xb2, 0x14, 0xe3, 0xcf, 0xbd, 0x94, 0xaf, 0xfd,\r\n  0x1b, 0x7f, 0xe7, 0x25, 0x3e, 0xf1, 0x6f, 0xe9, 0xec, 0xa5, 0x1b, 0xe1,\r\n  0xbf, 0xf1, 0x58, 0x5e, 0xea, 0x20, 0x68, 0x5d, 0x2d, 0xc7, 0xaa, 0x0c,\r\n  0x8b, 0x39, 0x7c, 0x68, 0x71, 0x6d, 0x11, 0x37, 0x30, 0x68, 0x04, 0xd9,\r\n  0x87, 0x33, 0x89, 0x48, 0x40, 0x5b, 0xf5, 0x09, 0x46, 0xdb, 0xef, 0x87,\r\n  0xd4, 0xca, 0x90, 0x5b, 0x19, 0x7a, 0x81, 0x0d, 0x12, 0xe9, 0x21, 0x2f,\r\n  0xc4, 0x40, 0xb3, 0xcc, 0xe6, 0xf0, 0x7c, 0xa8, 0x2a, 0x90, 0xe7, 0x08,\r\n  0x61, 0x1f, 0x7e, 0x75, 0xd2, 0x57, 0x6c, 0x88, 0x98, 0x6e, 0x83, 0x2e,\r\n  0x9f, 0xb1, 0x43, 0x71, 0x4d, 0xe3, 0x25, 0x9f, 0xfe, 0x0d, 0x2b, 0x5e,\r\n  0x15, 0x33, 0xd4, 0x81, 0xbf, 0x2b, 0x29, 0xa1, 0xf4, 0x31, 0xbd, 0x75,\r\n  0xe6, 0xec, 0x85, 0x2e, 0x84, 0xde, 0x3a, 0x68, 0x06, 0x5c, 0xaf, 0x82,\r\n  0x79, 0x40, 0x1c, 0x66, 0xe9, 0xb2, 0xc9, 0x86, 0xaf, 0x5c, 0x20, 0xd2,\r\n  0x65, 0x2f, 0xe9, 0xa3, 0xf4, 0x2b, 0x91, 0x27, 0x26, 0x22, 0x7a, 0x8e,\r\n  0x6e, 0x4d, 0x76, 0x42, 0x28, 0x3d, 0x10, 0x46, 0x9d, 0x24, 0x9a, 0x83,\r\n  0x26, 0xae, 0x0c, 0x51, 0x0c, 0x59, 0x7e, 0xbe, 0xf8, 0xc2, 0xe8, 0x61,\r\n  0x3f, 0x8f, 0x50, 0x83, 0x4e, 0xde, 0xd2, 0x58, 0xa0, 0x3a, 0x85, 0xc4,\r\n  0x8f, 0x8a, 0x97, 0xd4, 0x3c, 0x70, 0x61, 0xa9, 0x00, 0x30, 0xa2, 0x8a,\r\n  0x41, 0xc8, 0xe3, 0x3d, 0x79, 0x50, 0x07, 0x00, 0xb7, 0xd0, 0xff, 0x2b,\r\n  0x0e, 0xc1, 0x0b, 0x5e, 0x06, 0xfc, 0xfa, 0xf3, 0xfe, 0x86, 0x2b, 0x06,\r\n  0xee, 0x34, 0xf7, 0x46, 0x50, 0x57, 0x36, 0x68, 0x38, 0x9e, 0xfc, 0xca,\r\n  0x71, 0xa1, 0x8a, 0x36, 0xc6, 0xec, 0x03, 0x28, 0xd4, 0x4a, 0xda, 0xd4,\r\n  0x9c, 0x73, 0x39, 0x6b, 0x4e, 0x63, 0x69, 0x3c, 0x61, 0x6a, 0x07, 0xd6,\r\n  0x1e, 0xfb, 0x0c, 0x08, 0xc4, 0x7b, 0x7d, 0x47, 0xad, 0x0a, 0x3f, 0x26,\r\n  0x04, 0x5e, 0x91, 0x18, 0xc1, 0xde, 0x86, 0x66, 0x1d, 0x7b, 0x6d, 0x3e,\r\n  0x1c, 0x58, 0x19, 0x28, 0x0f, 0x3e, 0x87, 0x4b, 0xa8, 0x3a, 0x5a, 0x47,\r\n  0xe4, 0x15, 0x27, 0x48, 0xea, 0x47, 0x5f, 0xf2, 0x74, 0xef, 0x8e, 0xae,\r\n  0xd3, 0x2b, 0x99, 0x0c, 0x12, 0x91, 0xd7, 0xc9, 0x36, 0xfd, 0x73, 0x40,\r\n  0x3f, 0xdf, 0x63, 0xad, 0x8c, 0xff, 0xf2, 0x04, 0x90, 0xa1, 0xf0, 0xee,\r\n  0x0f, 0xce, 0x86, 0x3b, 0x17, 0xfc, 0x97, 0xd4, 0xdd, 0xf9, 0x1a, 0x69,\r\n  0xd1, 0x5e, 0x0e, 0x8d, 0x46, 0x1d, 0x99, 0x43, 0xae, 0x9a, 0x47, 0x10,\r\n  0x45, 0x01, 0x6b, 0x76, 0x0e, 0xfd, 0xa4, 0xf4, 0xa0, 0x5b, 0xc5, 0x34,\r\n  0xa8, 0xa2, 0xce, 0x7a, 0x77, 0xaa, 0x2e, 0x13, 0x4e, 0x71, 0xc0, 0xcd,\r\n  0x9a, 0xdc, 0x6f, 0x0d, 0x42, 0x30, 0x23, 0x89, 0xf7, 0x3b, 0x4e, 0x1a,\r\n  0x66, 0x22, 0x02, 0x9f, 0x6e, 0xc6, 0x9f, 0x47, 0xa9, 0xf0, 0x0d, 0xe4,\r\n  0x51, 0x5a, 0x1a, 0x25, 0x96, 0x39, 0x6d, 0xae, 0x60, 0x50, 0xb6, 0xcf,\r\n  0xb4, 0x4d, 0x8e, 0x6a, 0x6d, 0xf1, 0x67, 0x92, 0x79, 0x09, 0x5b, 0x5d,\r\n  0x79, 0xe8, 0xec, 0xab, 0x46, 0xc2, 0x8b, 0x0f, 0xf5, 0xc3, 0xb3, 0x9f,\r\n  0x4f, 0xab, 0x84, 0x6c, 0x5d, 0xe6, 0x0d, 0x5a, 0x88, 0x9c, 0x3b, 0x5e,\r\n  0x48, 0xf9, 0x32, 0x6c, 0xe1, 0xf9, 0x50, 0x6e, 0x4f, 0x55, 0x89, 0x86,\r\n  0xaf, 0x46, 0xd1, 0x29, 0x40, 0xb9, 0x65, 0x2c, 0xf4, 0x13, 0x76, 0xc3,\r\n  0xda, 0x6e, 0xa0, 0xad, 0x53, 0x1a, 0x85, 0x16, 0xbf, 0xc7, 0x19, 0xff,\r\n  0xb6, 0xa5, 0x52, 0xe3, 0x57, 0x96, 0xcd, 0x25, 0xfa, 0x85, 0xea, 0x23,\r\n  0x03, 0xf8, 0xa7, 0xdd, 0x73, 0xf0, 0xc3, 0x8b, 0x2f, 0x0e, 0xb9, 0x2d,\r\n  0x6e, 0xc3, 0x06, 0x8d, 0x08, 0xae, 0x48, 0x15, 0xd0, 0x40, 0xac, 0xbb,\r\n  0x43, 0x20, 0xa8, 0xbf, 0x44, 0x9c, 0x2e, 0x9c, 0x7a, 0xce, 0x1c, 0x18,\r\n  0x88, 0xd3, 0x52, 0x6b, 0xd8, 0x65, 0xa0, 0xe3, 0xa5, 0x6d, 0xd4, 0x83,\r\n  0xdd, 0x38, 0x4f, 0x9c, 0x71, 0xad, 0x15, 0xb4, 0x1c, 0xa2, 0x17, 0xbe,\r\n  0x18, 0xad, 0x00, 0xe0, 0x42, 0x68, 0xdc, 0x49, 0xee, 0x57, 0x7c, 0x47,\r\n  0x7f, 0x61, 0xe5, 0x6c, 0x52, 0xd0, 0xaa, 0x27, 0x85, 0x5c, 0x0d, 0xf8,\r\n  0x2a, 0xaa, 0xcd, 0xb8, 0x0a, 0x23, 0xaf, 0x4f, 0x23, 0xa3, 0xf1, 0xb8,\r\n  0xf2, 0xaa, 0xa2, 0x81, 0x07, 0x31, 0x44, 0xf5, 0x8c, 0x88, 0x3e, 0xa4,\r\n  0x4f, 0xc9, 0x2d, 0x27, 0x73, 0xcb, 0x89, 0xc0, 0x11, 0x4f, 0x4e, 0xed,\r\n  0xc8, 0x06, 0x4f, 0xc8, 0xab, 0x1b, 0x42, 0x39, 0xd4, 0xe7, 0x29, 0xe8,\r\n  0x0f, 0xa2, 0x3e, 0x77, 0x95, 0x7f, 0xd1, 0xc7, 0x7c, 0xe2, 0xc7, 0xc1,\r\n  0xf4, 0xf5, 0x47, 0x1d, 0xa7, 0x90, 0x9f, 0x79, 0xf9, 0x45, 0x6d, 0x96,\r\n  0xf0, 0x73, 0x6b, 0xea, 0xa5, 0xe0, 0xf8, 0x5b, 0x3a, 0xb7, 0xbd, 0x1b,\r\n  0xb4, 0xff, 0xf2, 0x90, 0x5a, 0x01, 0xf7, 0x71, 0x80, 0xc4, 0x9c, 0xba,\r\n  0x9f, 0xa5, 0x48, 0x08, 0x6c, 0x35, 0xf4, 0xe1, 0x53, 0x7c, 0x69, 0xa2,\r\n  0xc8, 0xa1, 0x14, 0x45, 0xba, 0xc9, 0x16, 0x30, 0xc9, 0x4b, 0xab, 0x99,\r\n  0x8a, 0xdd, 0x77, 0x9f, 0xc3, 0xcb, 0x00, 0x99, 0xb3, 0x3b, 0x42, 0x82,\r\n  0x98, 0xaf, 0xa2, 0xe8, 0x1a, 0x70, 0xc6, 0x7b, 0x0f, 0x13, 0xda, 0x73,\r\n  0xc0, 0x51, 0x33, 0xe9, 0x6d, 0x96, 0xbb, 0x64, 0xd7, 0x32, 0x9d, 0x82,\r\n  0xe1, 0xf7, 0xe5, 0x17, 0xb3, 0xfc, 0x9a, 0x25, 0xd7, 0x80, 0x0e, 0x1a,\r\n  0xff, 0xb7, 0xc7, 0x0f, 0xef, 0xe9, 0x47, 0xa5, 0xc3, 0x38, 0x2b, 0xa2,\r\n  0xc5, 0xdb, 0xbf, 0xd7, 0xa0, 0x28, 0xa9, 0xe1, 0x59, 0x3e, 0xd5, 0xb6,\r\n  0x5d, 0xd3, 0xb2, 0x1e, 0xd4, 0xbe, 0xfb, 0x45, 0xf8, 0x2d, 0x9b, 0x9c,\r\n  0x58, 0x5b, 0x86, 0x6e, 0x44, 0x92, 0xa2, 0x92, 0xab, 0xdc, 0x55, 0x65,\r\n  0x87, 0x83, 0x8b, 0xab, 0x21, 0xca, 0xbd, 0x35, 0xd7, 0xac, 0xa5, 0xfe,\r\n  0x17, 0x7d, 0x81, 0x61, 0xf7, 0x5f, 0xf4, 0x21, 0xc1, 0x58, 0x2e, 0x59,\r\n  0xd1, 0x28, 0xbd, 0x9c, 0xfa, 0x72, 0x2b, 0x0e, 0x45, 0x77, 0x50, 0x32,\r\n  0xb3, 0x1a, 0x48, 0x8e, 0x05, 0x86, 0x99, 0x91, 0x21, 0xbe, 0x0f, 0x6e,\r\n  0x02, 0xd4, 0x24, 0x46, 0xaf, 0x98, 0x9d, 0x71, 0x52, 0x09, 0x78, 0x45,\r\n  0x2f, 0x5d, 0xa8, 0x65, 0x20, 0x83, 0x28, 0x19, 0x53, 0x20, 0x6e, 0xce,\r\n  0x55, 0xb6, 0xe4, 0xd4, 0xdf, 0x29, 0xf8, 0xa4, 0xf5, 0x2c, 0x8d, 0xa2,\r\n  0xb7, 0x99, 0x50, 0x90, 0x27, 0x6c, 0x2c, 0xa7, 0xc5, 0x74, 0xb5, 0x60,\r\n  0x57, 0xc5, 0x94, 0x1d, 0x64, 0x06, 0x3f, 0xa2, 0x89, 0xaa, 0x85, 0xcc,\r\n  0xc3, 0x0e, 0x8b, 0x73, 0x44, 0x9c, 0xd8, 0xfa, 0x5d, 0xc0, 0x43, 0x18,\r\n  0x14, 0xa5, 0x4e, 0x6a, 0x68, 0x05, 0x8e, 0x14, 0x42, 0x05, 0x10, 0x47,\r\n  0xeb, 0x8e, 0x5f, 0x1d, 0x5f, 0x5c, 0x1c, 0x5f, 0xf0, 0x7c, 0x1f, 0x64,\r\n  0xb5, 0xb2, 0xdc, 0x8e, 0x17, 0xd2, 0x87, 0xff, 0x0c, 0x99, 0xda, 0x66,\r\n  0xf4, 0x16, 0x51, 0xa8, 0x25, 0xe2, 0x61, 0x41, 0x08, 0x0d, 0x8a, 0x94,\r\n  0x46, 0x0d, 0xdd, 0x8b, 0x40, 0x26, 0x3b, 0x57, 0x7e, 0x58, 0xe6, 0x2c,\r\n  0xd0, 0x2d, 0x7c, 0x0b, 0x85, 0x16, 0xcb, 0x5c, 0x59, 0xc2, 0xf1, 0x4d,\r\n  0x52, 0x53, 0x53, 0x47, 0x0a, 0x26, 0x4d, 0x34, 0xc0, 0x3d, 0x77, 0xfe,\r\n  0x09, 0x0c, 0xf9, 0x8a, 0xcf, 0x28, 0xdb, 0x4e, 0x98, 0x8c, 0xb2, 0x5a,\r\n  0x2d, 0xd3, 0x99, 0xf3, 0xf6, 0xd2, 0xcf, 0x49, 0xfd, 0x8b, 0xe4, 0x94,\r\n  0x97, 0x86, 0x3f, 0x41, 0xa4, 0xd1, 0x9c, 0x11, 0xa1, 0xb7, 0xad, 0x41,\r\n  0x4f, 0x1a, 0x21, 0x21, 0x49, 0x80, 0x5c, 0x56, 0x6b, 0xa5, 0x9e, 0x3a,\r\n  0xab, 0x7b, 0x3f, 0x81, 0x97, 0x91, 0xa5, 0x85, 0x41, 0x62, 0x42, 0xc9,\r\n  0xc0, 0xbe, 0xac, 0x85, 0x87, 0x64, 0x33, 0xac, 0x6c, 0x5f, 0x48, 0x1e,\r\n  0x90, 0x31, 0x57, 0xec, 0x47, 0x3f, 0x94, 0xe9, 0xf4, 0x27, 0x7f, 0x79,\r\n  0x20, 0xc3, 0xa2, 0x5e, 0x01, 0x08, 0x53, 0xa7, 0x13, 0xa5, 0xc6, 0xb0,\r\n  0x64, 0xaa, 0xbe, 0x1d, 0x1f, 0x5f, 0x44, 0x07, 0x5f, 0x31, 0xc9, 0xe9,\r\n  0x7f, 0x73, 0x81, 0xf9, 0x39, 0xbd, 0x1d, 0x36, 0x14, 0xea, 0xa9, 0xd4,\r\n  0x0d, 0x89, 0xb9, 0xc2, 0x85, 0x76, 0xa8, 0xb6, 0xb2, 0xa9, 0xd5, 0x3a,\r\n  0x0d, 0x72, 0xec, 0x6b, 0x6b, 0xb8, 0x11, 0x7d, 0x70, 0x15, 0x3f, 0x66,\r\n  0x0d, 0xf9, 0x90, 0x85, 0xab, 0x28, 0xa4, 0x2f, 0x12, 0x92, 0xb0, 0xb5,\r\n  0xd1, 0xde, 0x97, 0x2d, 0xb3, 0x53, 0x56, 0xe9, 0x20, 0xea, 0xbf, 0xce,\r\n  0xff, 0x41, 0xca, 0x40, 0xbc, 0xfd, 0x64, 0xb4, 0x13, 0x6d, 0x7e, 0x97,\r\n  0x66, 0xcf, 0x9f, 0xfd, 0x35, 0x3a, 0xd9, 0xea, 0xd7, 0xf0, 0xe6, 0x52,\r\n  0x35, 0x6b, 0x12, 0x67, 0xb7, 0x6e, 0xc9, 0xce, 0x70, 0xb2, 0x05, 0xe8,\r\n  0x66, 0xf5, 0x1c, 0xa4, 0x46, 0xe7, 0xda, 0x16, 0x85, 0xc7, 0x5b, 0xa0,\r\n  0xeb, 0xd1, 0xb7, 0x8e, 0xd4, 0x97, 0xad, 0x7c, 0x7a, 0x6a, 0xc6, 0x53,\r\n  0xf7, 0xfc, 0x59, 0xab, 0x89, 0xa7, 0xae, 0x8d, 0xb7, 0xd2, 0xc6, 0x2f,\r\n  0x6c, 0x62, 0x6f, 0xb4, 0xb3, 0x17, 0x6d, 0x9e, 0x8d, 0xb7, 0xf7, 0x5c,\r\n  0x0b, 0xed, 0x26, 0xf6, 0xd0, 0x04, 0x3f, 0x54, 0x7f, 0xf9, 0x29, 0x7f,\r\n  0xff, 0x87, 0x24, 0xfb, 0x29, 0xda, 0xfc, 0x7e, 0x77, 0x97, 0x1a, 0xf8,\r\n  0x6b, 0x74, 0x70, 0xf2, 0x7d, 0xf4, 0x74, 0x44, 0x8d, 0xbd, 0x89, 0xef,\r\n  0xb4, 0x39, 0xe5, 0xea, 0x1c, 0xa3, 0x11, 0xfa, 0x7d, 0xab, 0x8d, 0x67,\r\n  0x8d, 0x36, 0x4e, 0xc9, 0x2e, 0x7c, 0x4f, 0xd7, 0xca, 0xce, 0xe8, 0xc9,\r\n  0x5e, 0x94, 0x3e, 0xfb, 0xec, 0x13, 0x6b, 0x48, 0xdb, 0xc0, 0xef, 0xeb,\r\n  0xde, 0x4a, 0x61, 0x83, 0x20, 0x55, 0xe7, 0xf8, 0x3d, 0x09, 0x34, 0x88,\r\n  0x08, 0x10, 0xf7, 0xdf, 0xc4, 0xc5, 0x4c, 0xb7, 0x1b, 0x73, 0xb9, 0xd3,\r\n  0x4a, 0x29, 0x4b, 0x6e, 0x02, 0xb7, 0x25, 0x5d, 0x9c, 0xfb, 0xad, 0xee,\r\n  0xb0, 0x6d, 0x6a, 0x8f, 0xfe, 0x35, 0x7a, 0x3d, 0x3e, 0x39, 0xa6, 0x11,\r\n  0xed, 0x50, 0xd7, 0xfc, 0x1c, 0x4a, 0x87, 0xf0, 0x2b, 0x4c, 0xee, 0x73,\r\n  0x90, 0x2e, 0x6a, 0x1b, 0x61, 0x79, 0x4a, 0x6c, 0x3a, 0xba, 0xb8, 0x4b,\r\n  0x7c, 0x97, 0x61, 0x22, 0xc3, 0x83, 0x6b, 0x36, 0x21, 0xe4, 0xaa, 0xc5,\r\n  0xa7, 0xbf, 0xc9, 0x33, 0x3a, 0x26, 0x45, 0x5e, 0x30, 0x9a, 0xa9, 0x5f,\r\n  0xd3, 0x16, 0xbe, 0x39, 0x3a, 0x96, 0x8c, 0xe1, 0xd7, 0x71, 0x46, 0x32,\r\n  0x92, 0x99, 0x7f, 0xca, 0x5b, 0x8e, 0xc9, 0x4b, 0x38, 0x47, 0xde, 0x3f,\r\n  0x7d, 0xc8, 0xde, 0xd3, 0x3a, 0x7e, 0x3a, 0xda, 0x65, 0xde, 0x05, 0xb6,\r\n  0x7a, 0x5f, 0xbd, 0xa6, 0x7f, 0xef, 0x3e, 0xed, 0x47, 0xfc, 0xab, 0xba,\r\n  0x05, 0x6f, 0xe7, 0x75, 0xe3, 0xf0, 0xec, 0xec, 0x9b, 0x13, 0x01, 0x65,\r\n  0x1c, 0xaa, 0x5b, 0x95, 0x95, 0x2b, 0x67, 0x15, 0x8b, 0x74, 0x25, 0xeb,\r\n  0xcd, 0xe7, 0xb7, 0x20, 0x18, 0x77, 0x9b, 0x24, 0x4b, 0x46, 0x08, 0x54,\r\n  0x0d, 0x89, 0x60, 0x95, 0x07, 0x1d, 0xde, 0x88, 0xd5, 0x9f, 0x1a, 0x6b,\r\n  0x51, 0xc9, 0x4c, 0xb0, 0xe6, 0xc2, 0x9d, 0x3c, 0x38, 0x56, 0x82, 0xd8,\r\n  0x85, 0xcc, 0xac, 0x8c, 0x83, 0x36, 0x65, 0x2e, 0x68, 0xa9, 0x81, 0x40,\r\n  0x2f, 0xaa, 0xed, 0xdb, 0x1f, 0x93, 0x76, 0x2f, 0x9d, 0xde, 0x57, 0xaf,\r\n  0x6d, 0x3f, 0xe0, 0xce, 0x85, 0x46, 0xbb, 0xd4, 0x1a, 0x21, 0x70, 0x1d,\r\n  0x3f, 0x90, 0x2e, 0x81, 0x31, 0xa9, 0x6c, 0x2e, 0xe1, 0xcb, 0x06, 0x64,\r\n  0xee, 0xcd, 0xc1, 0xeb, 0xe3, 0x97, 0xdf, 0x1e, 0x9c, 0xbe, 0x3d, 0xa6,\r\n  0x57, 0x52, 0xb0, 0x54, 0x3b, 0x58, 0x1d, 0xfa, 0xb8, 0x48, 0x51, 0x1a,\r\n  0xb3, 0x24, 0xf5, 0xa0, 0xbf, 0x21, 0x48, 0xef, 0xa8, 0xc7, 0x6f, 0xed,\r\n  0xca, 0x6b, 0xb4, 0x2f, 0xf8, 0x5f, 0x7b, 0xf2, 0xaf, 0xbd, 0xbf, 0xf6,\r\n  0xb6, 0x6a, 0x83, 0x6e, 0x59, 0xc9, 0xbc, 0x5f, 0xee, 0xa5, 0x50, 0x0c,\r\n  0x43, 0x76, 0x24, 0xbd, 0x40, 0x66, 0xa5, 0x67, 0x31, 0x1a, 0xbb, 0xdb,\r\n  0xf8, 0xd9, 0xcd, 0xc9, 0x43, 0x68, 0x83, 0xf7, 0xf8, 0xa5, 0x97, 0x50,\r\n  0x30, 0x7a, 0x5b, 0x03, 0xa7, 0x72, 0x20, 0x7c, 0xcd, 0x6d, 0x58, 0x13,\r\n  0xc9, 0xfb, 0x25, 0xa3, 0x14, 0x37, 0x7b, 0xf2, 0x97, 0x97, 0x47, 0x07,\r\n  0x97, 0xc7, 0xfc, 0x82, 0x7d, 0xde, 0x48, 0xdd, 0x2d, 0x09, 0x80, 0xfb,\r\n  0xb3, 0xd9, 0x93, 0x1f, 0xbe, 0xe4, 0x01, 0xf5, 0xb6, 0x24, 0x96, 0x81,\r\n  0x40, 0x77, 0xa3, 0x5f, 0x79, 0xa6, 0x78, 0xea, 0x20, 0x59, 0xba, 0x34,\r\n  0x14, 0xc9, 0x66, 0x4f, 0x7e, 0xd7, 0x73, 0x1e, 0x5c, 0x2d, 0x60, 0xac,\r\n  0xe1, 0xca, 0x19, 0x52, 0x04, 0x5a, 0xc9, 0x8b, 0x02, 0x13, 0xf3, 0xeb,\r\n  0xa3, 0xc1, 0x0a, 0xf1, 0x38, 0x05, 0x64, 0xc2, 0x6e, 0xe1, 0x35, 0xb7,\r\n  0x9b, 0x7d, 0x4c, 0x79, 0xbe, 0xbb, 0xf7, 0xe4, 0xaf, 0x98, 0xcf, 0x97,\r\n  0xbd, 0x6d, 0xba, 0x1b, 0x7a, 0x7f, 0xe5, 0x4f, 0xa7, 0xe6, 0xe3, 0x0c,\r\n  0x80, 0xdd, 0x6c, 0x4f, 0xe9, 0x8e, 0x12, 0x08, 0x0b, 0xaf, 0x7a, 0x40,\r\n  0x5e, 0x82, 0x09, 0xbd, 0x97, 0x44, 0x26, 0xa3, 0xfb, 0xb0, 0x80, 0x3e,\r\n  0xd6, 0x0b, 0x05, 0xee, 0x33, 0x57, 0xff, 0x51, 0x3e, 0x17, 0xde, 0x1f,\r\n  0x03, 0x79, 0x57, 0xc6, 0xa8, 0xf4, 0x28, 0xfc, 0xcd, 0xc5, 0x83, 0xe5,\r\n  0x3a, 0x95, 0xa5, 0x99, 0xb8, 0xb2, 0x66, 0x2d, 0xcd, 0x78, 0xa2, 0xbe,\r\n  0x1d, 0x33, 0x46, 0xa0, 0x13, 0x90, 0x68, 0x79, 0x80, 0xa2, 0x24, 0x08,\r\n  0x80, 0x00, 0xf8, 0x60, 0x77, 0x76, 0x3c, 0xe1, 0x3c, 0x5e, 0x97, 0xd8,\r\n  0x11, 0x58, 0xe5, 0x6e, 0xea, 0xed, 0xf8, 0xa5, 0x01, 0xf1, 0x0c, 0x5f,\r\n  0x94, 0x32, 0x97, 0xa5, 0xf3, 0x21, 0x21, 0xda, 0xa8, 0xcf, 0xd6, 0xd7,\r\n  0xa9, 0x91, 0x32, 0x85, 0x61, 0x88, 0x49, 0x2f, 0xf6, 0x31, 0x89, 0x9a,\r\n  0x2c, 0x29, 0x1e, 0x05, 0x3d, 0x74, 0x04, 0xa3, 0x30, 0xc4, 0x20, 0x0d,\r\n  0x8f, 0xdf, 0x19, 0x8d, 0x46, 0xbe, 0x90, 0x2f, 0x2f, 0x8b, 0xc6, 0xa0,\r\n  0x50, 0x5a, 0x25, 0xa0, 0xc7, 0xc4, 0x1c, 0x6f, 0x42, 0x99, 0x87, 0x42,\r\n  0xbd, 0xa5, 0x60, 0x18, 0xf5, 0x13, 0xb8, 0xa3, 0x11, 0xf8, 0x38, 0xfa,\r\n  0xfa, 0xd9, 0xbe, 0xe5, 0xa4, 0xdf, 0x76, 0x2d, 0xc2, 0x23, 0x7d, 0x13,\r\n  0xdf, 0xa3, 0xd6, 0xe5, 0x73, 0x72, 0x2a, 0x77, 0x73, 0xc1, 0x3b, 0x98,\r\n  0x41, 0xdd, 0xd8, 0x27, 0x92, 0xd4, 0x29, 0x93, 0xa6, 0x5d, 0xd1, 0x1a,\r\n  0x4d, 0x2c, 0xe4, 0xf2, 0x7b, 0xe4, 0x99, 0x4b, 0x7d, 0x8c, 0x65, 0xc1,\r\n  0x96, 0x1e, 0xcf, 0xb1, 0xdd, 0x20, 0x4b, 0xa7, 0x36, 0x6b, 0x3b, 0xca,\r\n  0x96, 0xca, 0x36, 0x33, 0x74, 0xff, 0x81, 0x67, 0x54, 0xdd, 0x40, 0xa9,\r\n  0xc0, 0x44, 0xad, 0x67, 0xea, 0x2a, 0xc2, 0x5e, 0x3a, 0x78, 0xef, 0xae,\r\n  0x62, 0x04, 0xd8, 0x50, 0xf8, 0x2a, 0x2c, 0x57, 0xce, 0xa4, 0x87, 0x32,\r\n  0x16, 0x3c, 0x16, 0x2f, 0x9f, 0x5a, 0x8b, 0x2e, 0x58, 0xde, 0x98, 0x1b,\r\n  0x7f, 0x2b, 0xd7, 0x45, 0x17, 0xcd, 0xa8, 0x78, 0x97, 0x85, 0x19, 0xc0,\r\n  0xcb, 0xbd, 0x28, 0xbe, 0xe7, 0x82, 0xd2, 0x09, 0x63, 0x26, 0x81, 0x74,\r\n  0x80, 0x57, 0xe6, 0x34, 0xf0, 0x33, 0x7a, 0xce, 0x58, 0xad, 0x7b, 0x1e,\r\n  0xfb, 0xca, 0xe7, 0x56, 0x14, 0x55, 0xd8, 0x40, 0xcd, 0xa1, 0x97, 0xa2,\r\n  0x7a, 0x2b, 0xb3, 0x37, 0xaa, 0xa6, 0x6e, 0xe6, 0x39, 0xf7, 0x7c, 0x0b,\r\n  0x05, 0x2e, 0x45, 0x9d, 0x07, 0x56, 0x90, 0xfd, 0x1c, 0x82, 0xab, 0xb0,\r\n  0xd9, 0x02, 0x83, 0xba, 0xfb, 0x88, 0x8b, 0x4f, 0xab, 0xfb, 0x89, 0x21,\r\n  0xb7, 0xd9, 0xd0, 0x15, 0x06, 0x77, 0x78, 0xac, 0x22, 0xbd, 0xbe, 0xd6,\r\n  0x9a, 0x9a, 0xcd, 0xa1, 0x75, 0x6f, 0xb2, 0x53, 0x9e, 0x15, 0x46, 0x26,\r\n  0x3f, 0xac, 0x9b, 0xcd, 0x4b, 0xf3, 0xf9, 0x98, 0xd7, 0xa5, 0xb6, 0x99,\r\n  0x2d, 0x26, 0x29, 0xeb, 0x56, 0xa1, 0xf4, 0x31, 0x92, 0xc0, 0x39, 0x69,\r\n  0xa2, 0x1e, 0x43, 0x3e, 0xbb, 0xd8, 0x00, 0x83, 0x76, 0xe6, 0x73, 0xde,\r\n  0x6d, 0xd1, 0x41, 0x3e, 0xe6, 0x11, 0x28, 0x1e, 0x1d, 0x7a, 0xef, 0xe0,\r\n  0x4f, 0x52, 0x52, 0x6c, 0x12, 0x7b, 0x93, 0x6b, 0x23, 0xaa, 0x79, 0x7b,\r\n  0xb9, 0x5a, 0xc4, 0x49, 0xa6, 0x72, 0x28, 0xbf, 0x4b, 0x3c, 0x03, 0x9e,\r\n  0x77, 0x38, 0x7a, 0xd6, 0x52, 0x3d, 0xfd, 0x4e, 0x98, 0x34, 0x02, 0xbc,\r\n  0x4e, 0x5e, 0x61, 0x90, 0x8d, 0x59, 0x09, 0xcb, 0x52, 0xa8, 0xab, 0x24,\r\n  0x0f, 0x45, 0xbc, 0xf4, 0x4d, 0xe3, 0xd6, 0xd6, 0xa2, 0xa6, 0x15, 0x81,\r\n  0xc1, 0x22, 0x30, 0x4d, 0xa4, 0x9e, 0x82, 0x11, 0x81, 0x3b, 0xdc, 0x9c,\r\n  0x8f, 0xff, 0xda, 0x28, 0x7b, 0x6e, 0x91, 0x7a, 0x56, 0x1b, 0x1a, 0x9b,\r\n  0x00, 0x7b, 0x80, 0x15, 0x3a, 0x17, 0xc2, 0x3f, 0x98, 0xc7, 0x0c, 0x62,\r\n  0xc9, 0x05, 0x1d, 0x80, 0x25, 0xc3, 0xa6, 0x86, 0x33, 0xad, 0x21, 0x53,\r\n  0x5b, 0xc7, 0xcf, 0xa1, 0x35, 0x64, 0xaf, 0x81, 0xbf, 0x94, 0x9b, 0xa1,\r\n  0x5d, 0x02, 0x84, 0xf5, 0x34, 0x2c, 0x8b, 0xba, 0x3e, 0x3d, 0x7c, 0x52,\r\n  0x3b, 0xa3, 0x1f, 0x3a, 0xb2, 0xe7, 0x17, 0x67, 0x5f, 0x5d, 0x1c, 0x8f,\r\n  0xc7, 0xd1, 0xeb, 0xe3, 0x4b, 0x31, 0xfb, 0x2f, 0x05, 0x19, 0x77, 0xcd,\r\n  0x96, 0x7b, 0x84, 0xb0, 0x83, 0x71, 0xd5, 0x18, 0xfa, 0xc4, 0x7c, 0x0a,\r\n  0x48, 0x49, 0xca, 0x39, 0xa4, 0x06, 0x55, 0x0e, 0xf6, 0xfc, 0x5c, 0x01,\r\n  0x75, 0x37, 0x70, 0xfc, 0x03, 0xde, 0x84, 0xd8, 0xa4, 0xf3, 0xa3, 0x7b,\r\n  0x8f, 0x2a, 0x74, 0x64, 0x01, 0x3c, 0xdd, 0x98, 0xe4, 0xf2, 0xde, 0x74,\r\n  0xbe, 0xbd, 0xe9, 0xbf, 0x18, 0xde, 0x9f, 0xa2, 0xcb, 0xbc, 0x62, 0x5e,\r\n  0x4d, 0xfe, 0xeb, 0x85, 0xed, 0x8f, 0x3f, 0x45, 0xdf, 0x53, 0x9b, 0x33,\r\n  0x9a, 0x75, 0x76, 0x26, 0xd3, 0x85, 0x3b, 0x46, 0xc1, 0x44, 0x5f, 0x3e,\r\n  0x05, 0xdc, 0xe0, 0x61, 0x2d, 0xe3, 0x55, 0x51, 0x8c, 0xba, 0xab, 0x8f,\r\n  0xd4, 0xca, 0x87, 0x08, 0xbd, 0x8b, 0xc2, 0xeb, 0xdc, 0x97, 0x0f, 0xad,\r\n  0xde, 0xcc, 0x69, 0x72, 0x55, 0x41, 0x21, 0xe1, 0xcf, 0x51, 0x73, 0x3b,\r\n  0xcc, 0x73, 0xbb, 0xcb, 0xe5, 0x9d, 0xe8, 0xaf, 0x4f, 0x3e, 0xfb, 0x64,\r\n  0xe7, 0x33, 0xf9, 0xab, 0xfd, 0xf9, 0xfc, 0xe9, 0x8e, 0xf2, 0x45, 0xd3,\r\n  0xbf, 0x9e, 0xee, 0x3f, 0xdd, 0xdd, 0x67, 0x1a, 0xbb, 0x9d, 0xfd, 0x1d,\r\n  0xfa, 0xff, 0x4f, 0xf5, 0x27, 0xcc, 0xd5, 0xf7, 0x7c, 0xef, 0xb3, 0x4f,\r\n  0x01, 0x8c, 0xe1, 0xfd, 0x31, 0xa7, 0x8f, 0x0c, 0xab, 0x7c, 0x08, 0x36,\r\n  0x1d, 0x28, 0x41, 0x7f, 0xaa, 0x3b, 0x25, 0x39, 0xd2, 0x3e, 0xe5, 0xb8,\r\n  0xea, 0xb5, 0x98, 0x37, 0xf3, 0x04, 0x34, 0xfa, 0x57, 0x01, 0xc9, 0x88,\r\n  0x01, 0xb8, 0x25, 0xc9, 0x58, 0x87, 0xa1, 0x6f, 0x57, 0xf8, 0x37, 0xe8,\r\n  0xa9, 0x6a, 0xef, 0x08, 0x0e, 0x3c, 0x60, 0xc2, 0xfa, 0xa5, 0x9f, 0xb6,\r\n  0xb4, 0xe7, 0x0d, 0xf0, 0x5b, 0xe9, 0x52, 0xe9, 0x7b, 0x53, 0x2b, 0x28,\r\n  0xeb, 0x9e, 0x62, 0x8d, 0x70, 0x21, 0x29, 0x03, 0x57, 0x82, 0x26, 0xfe,\r\n  0xa5, 0xdf, 0x13, 0x27, 0x16, 0xbf, 0xa5, 0xbb, 0x21, 0x6a, 0x7f, 0xcd,\r\n  0xa5, 0x0a, 0x74, 0x7c, 0xab, 0xb6, 0x79, 0x36, 0xfc, 0xf2, 0xfb, 0x99,\r\n  0x62, 0xa9, 0xa6, 0x0f, 0xb9, 0x14, 0x2b, 0xa9, 0xcd, 0xd9, 0x31, 0xe4,\r\n  0x56, 0x73, 0xba, 0x8d, 0x7e, 0x41, 0x73, 0x7e, 0x44, 0xd8, 0xc1, 0x6e,\r\n  0xe5, 0x86, 0xc1, 0xe2, 0xa4, 0x82, 0x71, 0xb3, 0xd9, 0x70, 0xfc, 0x89,\r\n  0x76, 0xe3, 0xc9, 0xab, 0x6e, 0xcb, 0x0e, 0xe5, 0x0d, 0x55, 0x3f, 0x5d,\r\n  0xda, 0x9a, 0x96, 0xae, 0x76, 0xcf, 0xdb, 0xce, 0x6e, 0x7d, 0x8a, 0x77,\r\n  0x63, 0xf0, 0x3d, 0xfd, 0x06, 0xce, 0x93, 0x3b, 0x74, 0x8f, 0x0e, 0xcd,\r\n  0x43, 0xdf, 0x5d, 0x65, 0xd2, 0x4d, 0x07, 0x25, 0xef, 0x3a, 0x92, 0xfe,\r\n  0x39, 0xa0, 0xcb, 0x5d, 0x73, 0xe1, 0x45, 0x84, 0xba, 0xb4, 0xe8, 0x1f,\r\n  0x98, 0x74, 0x56, 0xcc, 0x62, 0xbe, 0x65, 0x22, 0x6c, 0xf8, 0x47, 0x87,\r\n  0xe0, 0xc2, 0xbd, 0xa6, 0xd5, 0x0b, 0x63, 0xd9, 0xf9, 0xf3, 0x30, 0xc3,\r\n  0xd5, 0x49, 0xbb, 0x49, 0x5c, 0xd4, 0xd8, 0xc2, 0x37, 0x94, 0x87, 0x7e,\r\n  0xc1, 0x54, 0x5c, 0x41, 0x95, 0xf4, 0x3f, 0x6c, 0x6c, 0x8c, 0xcf, 0x8f,\r\n  0x8f, 0x8f, 0xa2, 0xd3, 0x93, 0xd7, 0x27, 0x97, 0x81, 0x42, 0xee, 0x2e,\r\n  0x12, 0x73, 0xba, 0x5a, 0x65, 0x9d, 0xc6, 0x74, 0x78, 0x76, 0x5a, 0xad,\r\n  0x78, 0xa0, 0x57, 0xf9, 0x22, 0xd1, 0x24, 0x87, 0x79, 0xf3, 0x3d, 0x98,\r\n  0xde, 0xa0, 0xd1, 0x19, 0x45, 0x5f, 0x06, 0x18, 0xc9, 0xa8, 0x24, 0xe5,\r\n  0x66, 0xea, 0x2a, 0xb6, 0x0e, 0xff, 0xa6, 0x90, 0x8d, 0xba, 0xe6, 0xa4,\r\n  0x24, 0x9b, 0x2e, 0xe3, 0x46, 0x61, 0xae, 0x8d, 0x5e, 0xf1, 0xdc, 0x26,\r\n  0x82, 0x7c, 0x0e, 0x3c, 0x74, 0x40, 0xf0, 0xdd, 0x27, 0xc8, 0xcd, 0x5f,\r\n  0xa4, 0x92, 0x0a, 0x19, 0xc2, 0x8b, 0x5d, 0x15, 0xcb, 0xcb, 0x5c, 0xe4,\r\n  0x78, 0xf8, 0xc5, 0xb0, 0x3a, 0xb1, 0x61, 0x6b, 0xed, 0x5b, 0x61, 0xd9,\r\n  0xdb, 0x27, 0x3b, 0x2e, 0x9b, 0x60, 0x09, 0x99, 0xa3, 0xaa, 0x3e, 0x7f,\r\n  0x6c, 0x37, 0x22, 0x7d, 0x64, 0xc5, 0x5a, 0x7d, 0xb1, 0xca, 0x5a, 0xd7,\r\n  0xdd, 0xdf, 0xe4, 0x5d, 0x1a, 0xff, 0x27, 0x3b, 0xb8, 0xde, 0xae, 0xe2,\r\n  0x62, 0x48, 0x9a, 0xd7, 0xc3, 0xd0, 0xbc, 0xab, 0xb2, 0x23, 0x14, 0x7a,\r\n  0x2c, 0xae, 0x9f, 0xc4, 0x17, 0xcc, 0x6c, 0x68, 0x8b, 0x3e, 0x25, 0x24,\r\n  0x47, 0x88, 0x72, 0xae, 0x07, 0x80, 0x87, 0xce, 0x89, 0xb8, 0xe6, 0xec,\r\n  0xf4, 0xba, 0x8e, 0x27, 0x60, 0xb5, 0x55, 0xf4, 0x32, 0x8a, 0x13, 0x04,\r\n  0x20, 0x56, 0xb9, 0xd5, 0x94, 0x87, 0xa9, 0x63, 0x69, 0xab, 0xd6, 0x8b,\r\n  0x68, 0xf7, 0x33, 0x1e, 0xc7, 0xc7, 0x8d, 0xe7, 0x55, 0x5e, 0x4c, 0x5d,\r\n  0xca, 0x2f, 0xcc, 0x85, 0x20, 0xff, 0x53, 0xb2, 0x16, 0x50, 0x95, 0x46,\r\n  0x66, 0xd7, 0xf0, 0xb1, 0xc0, 0xef, 0xb1, 0x7d, 0xa2, 0xa1, 0x75, 0x78,\r\n  0xa6, 0x10, 0xeb, 0x16, 0x0d, 0x89, 0xef, 0x1a, 0x9d, 0x17, 0xf6, 0xb5,\r\n  0x0a, 0x7e, 0xaf, 0x5f, 0xb8, 0xfc, 0x50, 0x99, 0x06, 0xf6, 0x8e, 0xd0,\r\n  0x5e, 0xbb, 0x4f, 0x67, 0xd0, 0xaa, 0xcd, 0x09, 0x80, 0xfd, 0x27, 0x9b,\r\n  0x4f, 0x60, 0xd3, 0x08, 0x5f, 0x22, 0xee, 0xe9, 0x7a, 0xa6, 0x0a, 0x0c,\r\n  0x4f, 0x6b, 0x0e, 0xe7, 0xc2, 0x26, 0xf4, 0x07, 0x4e, 0x3f, 0xf6, 0x21,\r\n  0x02, 0x36, 0xa5, 0x58, 0x34, 0xf7, 0xfc, 0x57, 0x18, 0xca, 0x5f, 0x55,\r\n  0x73, 0xf3, 0x2b, 0xbc, 0x76, 0x1b, 0xbb, 0x3e, 0x66, 0xe6, 0x15, 0x09,\r\n  0x86, 0xbd, 0xbb, 0x43, 0xfa, 0xeb, 0x3c, 0x6f, 0x56, 0xd7, 0x6e, 0x1b,\r\n  0xa5, 0x18, 0xd6, 0x10, 0xb3, 0xb3, 0xbb, 0xf3, 0xcd, 0xfa, 0x59, 0x07,\r\n  0x99, 0xf7, 0xa3, 0x2f, 0xef, 0x3d, 0x7d, 0x64, 0xd1, 0xce, 0x0a, 0xd8,\r\n  0xe5, 0x89, 0xc1, 0x21, 0xa1, 0x08, 0xfa, 0x20, 0x4c, 0x6b, 0xd9, 0x68,\r\n  0xe3, 0x27, 0xd7, 0x31, 0x77, 0xff, 0xb1, 0xde, 0x5b, 0xca, 0x46, 0xa3,\r\n  0x2b, 0xaf, 0x15, 0xa0, 0x2d, 0xbf, 0x2c, 0xd9, 0x43, 0xb6, 0x04, 0x19,\r\n  0x9a, 0x37, 0x63, 0x5d, 0xb6, 0xb7, 0xd0, 0x4d, 0x04, 0x6f, 0x8b, 0xe4,\r\n  0x1c, 0xd4, 0x85, 0x84, 0xed, 0x9e, 0x22, 0xb9, 0x5e, 0x09, 0x9f, 0x43,\r\n  0x2e, 0x66, 0x3f, 0xf3, 0xf6, 0xea, 0x79, 0x25, 0xd9, 0xcc, 0x48, 0x22,\r\n  0xd9, 0x4f, 0x10, 0xbc, 0xd3, 0xd8, 0x54, 0x56, 0x51, 0x39, 0x9a, 0x17,\r\n  0x03, 0xfb, 0x67, 0xa7, 0x1c, 0x10, 0x83, 0x34, 0xd8, 0x88, 0x9a, 0x95,\r\n  0x77, 0x85, 0x98, 0x6e, 0x84, 0x44, 0x5c, 0xd9, 0x28, 0x4e, 0xd8, 0x73,\r\n  0xd6, 0x17, 0x07, 0xc6, 0x2a, 0x89, 0x10, 0xa0, 0x81, 0x81, 0xee, 0x5a,\r\n  0xb4, 0xe4, 0x3e, 0xc5, 0x12, 0xbf, 0x34, 0x82, 0x40, 0xa1, 0x13, 0x67,\r\n  0xbf, 0xff, 0xe1, 0xd9, 0x9b, 0x57, 0x27, 0x5f, 0x39, 0xe2, 0x1d, 0x11,\r\n  0xe2, 0x56, 0x12, 0x14, 0x6d, 0xba, 0x0a, 0xc9, 0x2e, 0xe8, 0xad, 0x25,\r\n  0xe7, 0x14, 0x88, 0x4b, 0xe2, 0xe9, 0x5d, 0xf8, 0x03, 0x08, 0x90, 0xec,\r\n  0x09, 0xfb, 0xca, 0x85, 0xc8, 0xa2, 0xdc, 0xf2, 0x9e, 0x87, 0x06, 0x31,\r\n  0x98, 0x24, 0x6c, 0xc4, 0x45, 0xb5, 0x5a, 0x3a, 0x3c, 0x61, 0x50, 0xb2,\r\n  0x4e, 0x89, 0x86, 0x2d, 0x53, 0x7c, 0xb5, 0x14, 0xd1, 0xa4, 0xf9, 0x9e,\r\n  0x35, 0xc7, 0xae, 0xdc, 0x01, 0xec, 0x59, 0x50, 0xe6, 0x0f, 0xbd, 0x00,\r\n  0x5a, 0x10, 0x9d, 0x39, 0x33, 0x13, 0x86, 0xd0, 0x79, 0x0b, 0xe5, 0xcc,\r\n  0x50, 0xf4, 0x2f, 0x2c, 0x9a, 0xbc, 0x10, 0xcb, 0x8c, 0xc7, 0x8d, 0x5a,\r\n  0xb7, 0x0e, 0x97, 0xe3, 0x80, 0xc0, 0x3e, 0x54, 0xe4, 0xaa, 0xfc, 0x78,\r\n  0xa8, 0x92, 0x65, 0x99, 0xc6, 0x88, 0x5a, 0x22, 0xec, 0x89, 0x9f, 0xbc,\r\n  0xe4, 0x08, 0xcd, 0x3e, 0xf3, 0x6d, 0x2f, 0x84, 0xbe, 0x2b, 0xcc, 0x0e,\r\n  0x55, 0x29, 0xe9, 0x49, 0xb1, 0x4f, 0xae, 0x82, 0x84, 0x33, 0x81, 0x0c,\r\n  0xda, 0xa6, 0x13, 0x77, 0x31, 0xfb, 0x5a, 0xfa, 0x7f, 0xec, 0x0f, 0xcb,\r\n  0x87, 0xc5, 0x24, 0x9f, 0x5b, 0x0e, 0x86, 0xe3, 0x77, 0xb0, 0x87, 0xac,\r\n  0x8a, 0x54, 0x2c, 0x15, 0xe4, 0xf1, 0xe9, 0xc0, 0x43, 0xe9, 0x61, 0x53,\r\n  0xbe, 0xff, 0x52, 0x86, 0x05, 0x91, 0x22, 0x1b, 0x85, 0x23, 0x1b, 0x49,\r\n  0xb2, 0xe9, 0x3c, 0xd7, 0x5d, 0xcd, 0xf9, 0xdf, 0x98, 0xa9, 0xfa, 0xd0,\r\n  0x39, 0xf8, 0x97, 0xaf, 0xd8, 0xd9, 0x81, 0x12, 0x0b, 0xa4, 0xee, 0xb0,\r\n  0x73, 0xf8, 0x3b, 0x1b, 0x20, 0xbf, 0x2d, 0xbf, 0x50, 0x80, 0xbe, 0xb1,\r\n  0xb4, 0x50, 0x43, 0x52, 0x93, 0x81, 0xba, 0xfa, 0xa3, 0xf8, 0x16, 0x25,\r\n  0x04, 0xf8, 0x37, 0xfb, 0xb8, 0x3d, 0xda, 0x98, 0x7a, 0xda, 0x4f, 0x71,\r\n  0x71, 0xad, 0x9c, 0x68, 0x1a, 0x54, 0x83, 0x91, 0xe8, 0x2a, 0x65, 0x38,\r\n  0x1f, 0x25, 0x2b, 0x25, 0x0e, 0x40, 0x03, 0xf5, 0x69, 0x25, 0x29, 0x7f,\r\n  0x9a, 0x10, 0x25, 0xde, 0x49, 0xb7, 0x11, 0x03, 0x89, 0xf3, 0x47, 0x07,\r\n  0x4b, 0x89, 0xfd, 0x5d, 0x66, 0x0c, 0xfe, 0xde, 0x55, 0xab, 0x97, 0x59,\r\n  0xf0, 0x1a, 0xfb, 0xf3, 0x60, 0x09, 0x27, 0xea, 0x43, 0x91, 0x4f, 0x41,\r\n  0x97, 0x60, 0x3a, 0x40, 0xe4, 0x01, 0x25, 0xa5, 0x6f, 0x42, 0x7e, 0xff,\r\n  0x52, 0xeb, 0xf6, 0xd0, 0x79, 0x56, 0xfe, 0x12, 0x25, 0x6b, 0xfb, 0x6c,\r\n  0x47, 0x3d, 0x71, 0x95, 0x22, 0x57, 0xcb, 0xe8, 0xe0, 0xe2, 0x98, 0x34,\r\n  0xdb, 0xeb, 0x0c, 0x14, 0x12, 0x59, 0x65, 0x39, 0x6f, 0x49, 0xa6, 0xa5,\r\n  0x82, 0x32, 0x3b, 0x1f, 0xfc, 0xc1, 0xfb, 0xe0, 0x4d, 0xde, 0x4c, 0x8a,\r\n  0x11, 0x90, 0xf4, 0x6a, 0xbf, 0xe5, 0xa6, 0x46, 0x9b, 0x0a, 0xa9, 0xc3,\r\n  0x2c, 0x06, 0xb2, 0xa5, 0x38, 0x5a, 0x42, 0x9f, 0xca, 0x8d, 0x32, 0xf5,\r\n  0xbc, 0x25, 0xd6, 0x43, 0xae, 0x54, 0x9b, 0x6b, 0x9c, 0x6a, 0x9f, 0x95,\r\n  0xf0, 0xb3, 0xb1, 0x20, 0xea, 0xb7, 0x6a, 0x11, 0x50, 0xbf, 0x9d, 0x06,\r\n  0xdd, 0xde, 0xa3, 0x9f, 0x71, 0xcf, 0xb0, 0x2e, 0xd2, 0xd4, 0x0b, 0x12,\r\n  0x07, 0xb6, 0x17, 0x47, 0xf6, 0x2c, 0x50, 0x7e, 0x25, 0x43, 0x0f, 0x95,\r\n  0xbb, 0xe1, 0xa3, 0x66, 0xe5, 0x27, 0x2e, 0x35, 0x1b, 0x4a, 0xcd, 0x81,\r\n  0x99, 0x9e, 0x55, 0xde, 0x15, 0x8c, 0x1c, 0x9e, 0x30, 0xe7, 0xcf, 0xad,\r\n  0x28, 0x00, 0xa1, 0x7c, 0xea, 0x74, 0xf3, 0xfe, 0xd1, 0x8d, 0xd6, 0xf7,\r\n  0xc1, 0xfd, 0x92, 0x7f, 0xf4, 0xd2, 0xf1, 0xa2, 0xa1, 0x02, 0x39, 0x7f,\r\n  0x08, 0x22, 0x15, 0xe1, 0x53, 0xfe, 0x0b, 0x7e, 0x0c, 0x00, 0x9c, 0x71,\r\n  0x4b, 0xd6, 0x68, 0x8c, 0xb4, 0x36, 0x48, 0xd8, 0x11, 0x89, 0xf1, 0x41,\r\n  0x42, 0x4f, 0x42, 0xd5, 0x78, 0xf8, 0xcd, 0xb6, 0x55, 0xfb, 0x64, 0x57,\r\n  0x0e, 0xe7, 0xf7, 0xda, 0x81, 0x2f, 0x93, 0x5a, 0x79, 0x50, 0x97, 0x34,\r\n  0xd4, 0x1b, 0xf6, 0x68, 0x2e, 0xfa, 0xf3, 0xb9, 0x17, 0xf8, 0xf6, 0x18,\r\n  0xaf, 0x2a, 0xf2, 0xeb, 0xbc, 0xc2, 0xa4, 0xb2, 0x8b, 0xeb, 0x0e, 0x3c,\r\n  0xd4, 0xb2, 0x1d, 0xb8, 0x70, 0x13, 0x27, 0x03, 0x39, 0x1a, 0x2a, 0x64,\r\n  0x8c, 0x00, 0x2f, 0x70, 0x97, 0x96, 0x16, 0x87, 0xa4, 0xbd, 0x3d, 0x15,\r\n  0x78, 0x44, 0x25, 0x7c, 0x01, 0x49, 0x35, 0x0d, 0xa6, 0x32, 0x99, 0xde,\r\n  0xe4, 0x02, 0xaf, 0xa5, 0x49, 0x0b, 0x12, 0x31, 0x7b, 0xd1, 0x7f, 0xe9,\r\n  0x1e, 0xf8, 0xc6, 0xe7, 0xef, 0xf1, 0x46, 0x18, 0x09, 0xeb, 0xdf, 0xc8,\r\n  0x6f, 0x88, 0xe3, 0xef, 0x2f, 0x2f, 0x0e, 0xa2, 0xaf, 0x8f, 0x0f, 0x8e,\r\n  0x8e, 0x2f, 0xc6, 0x8d, 0x4b, 0x5f, 0x91, 0x20, 0xa2, 0xa1, 0xb1, 0x3f,\r\n  0x18, 0xaa, 0xb1, 0xf1, 0x02, 0x28, 0x84, 0xdf, 0xa4, 0x1e, 0x6d, 0x1e,\r\n  0x3e, 0x48, 0x74, 0x3e, 0xd8, 0x20, 0x92, 0xc0, 0x01, 0xf8, 0x5d, 0x4b,\r\n  0x08, 0x1b, 0xd7, 0xc6, 0x94, 0x24, 0x14, 0xe3, 0x19, 0xcc, 0x7b, 0x1e,\r\n  0x26, 0xcf, 0x78, 0x66, 0x39, 0x7f, 0x99, 0xcc, 0x72, 0xcb, 0x0b, 0xac,\r\n  0xaf, 0xdc, 0xd7, 0x3e, 0x1d, 0x3b, 0x10, 0x5b, 0x7a, 0xc9, 0xa8, 0x03,\r\n  0xb1, 0xf7, 0xfd, 0x90, 0xbe, 0x3b, 0xa4, 0xc9, 0x1f, 0x32, 0x23, 0xe0,\r\n  0x43, 0x52, 0xf6, 0x1a, 0xde, 0xc0, 0xfa, 0xe7, 0x21, 0xa3, 0xaf, 0xdb,\r\n  0x27, 0xe9, 0xeb, 0xce, 0x96, 0xf8, 0x74, 0x71, 0x3d, 0xdb, 0x96, 0x05,\r\n  0x81, 0x4b, 0x35, 0x50, 0x92, 0xf5, 0x04, 0xb5, 0x32, 0x5d, 0x14, 0xab,\r\n  0xe4, 0xcd, 0x4c, 0x85, 0x86, 0xa1, 0x23, 0x3a, 0x04, 0xe8, 0x3a, 0x74,\r\n  0xf6, 0xe4, 0x52, 0x87, 0x5f, 0xc4, 0xc8, 0x6a, 0xa9, 0x5b, 0xfa, 0x50,\r\n  0x78, 0x3f, 0x20, 0x16, 0xa2, 0x70, 0xfc, 0xb2, 0x16, 0x2a, 0x55, 0xbf,\r\n  0xa8, 0x56, 0x31, 0xd3, 0xe6, 0xb8, 0x0f, 0x6e, 0xcf, 0x1b, 0x8a, 0x9f,\r\n  0x3f, 0x69, 0x05, 0x14, 0xf4, 0x5d, 0x01, 0x84, 0xb1, 0x51, 0x0f, 0x57,\r\n  0xa7, 0x54, 0x63, 0xe4, 0x77, 0x4c, 0x5f, 0x0d, 0xd2, 0x82, 0xc2, 0xcd,\r\n  0x8c, 0x6a, 0x4f, 0x00, 0x92, 0xbb, 0xe7, 0x92, 0xe8, 0xeb, 0xbc, 0xc4,\r\n  0x5d, 0xd0, 0x7e, 0x9c, 0x2f, 0xf9, 0xae, 0xe9, 0xc7, 0x1b, 0x1a, 0xea,\r\n  0x72, 0x94, 0x9c, 0x60, 0xb0, 0x85, 0xf8, 0x3a, 0x3f, 0xb8, 0xfc, 0x1a,\r\n  0x81, 0x56, 0x6c, 0xe1, 0x23, 0x10, 0x9a, 0x58, 0x78, 0xad, 0x9d, 0x9d,\r\n  0xe5, 0x0c, 0x38, 0xd1, 0x7f, 0x8d, 0x46, 0xd0, 0xf4, 0x49, 0x04, 0xf2,\r\n  0x52, 0xc1, 0x24, 0xcd, 0xa5, 0xfa, 0x25, 0x64, 0x74, 0xad, 0x06, 0x19,\r\n  0x50, 0xf0, 0x2e, 0xf5, 0xce, 0x41, 0x2f, 0xfb, 0x92, 0xa7, 0xde, 0x97,\r\n  0x31, 0x61, 0xd3, 0xb3, 0x32, 0xc7, 0x16, 0x4f, 0xc8, 0xf3, 0x8a, 0x5f,\r\n  0x70, 0x22, 0xb2, 0xc4, 0xa2, 0x66, 0x79, 0x37, 0x4b, 0x5f, 0x70, 0xa4,\r\n  0xbf, 0x58, 0x3c, 0x8c, 0xda, 0xfc, 0x38, 0xd1, 0x97, 0xab, 0xaa, 0x2e,\r\n  0x56, 0x1a, 0x6c, 0xb3, 0x4e, 0xb3, 0x2c, 0xf2, 0xbc, 0x0a, 0xfa, 0x00,\r\n  0xed, 0x27, 0xae, 0xf4, 0x44, 0x0b, 0x1d, 0xa3, 0xf4, 0x85, 0x9b, 0xca,\r\n  0x54, 0xef, 0x0e, 0x15, 0xc3, 0x78, 0x52, 0xe6, 0xf3, 0x55, 0x15, 0x00,\r\n  0xb1, 0x7f, 0x59, 0x9f, 0x83, 0x4e, 0x6f, 0x9e, 0x8c, 0x8c, 0x9a, 0x92,\r\n  0x8b, 0x17, 0x93, 0x12, 0x4e, 0x96, 0x3e, 0xa9, 0x97, 0x88, 0x3b, 0x16,\r\n  0x79, 0x56, 0x2f, 0x93, 0x05, 0xcc, 0xf7, 0xd6, 0xc6, 0xc6, 0xd8, 0x16,\r\n  0x9b, 0xc9, 0x41, 0xdb, 0x8b, 0xfe, 0x1d, 0xb4, 0x49, 0xee, 0x83, 0xc4,\r\n  0x0d, 0xa6, 0xf4, 0x17, 0xa3, 0x66, 0x4b, 0x64, 0x4d, 0x21, 0xc2, 0x65,\r\n  0x8d, 0xd3, 0xb2, 0x3e, 0x28, 0xfc, 0xca, 0x45, 0x2e, 0x2c, 0xd5, 0xec,\r\n  0x32, 0x37, 0xca, 0x72, 0x8d, 0xdc, 0xf9, 0x0d, 0x51, 0x4b, 0x56, 0xef,\r\n  0xe4, 0xf3, 0xe5, 0x4b, 0xc0, 0x6a, 0xaa, 0x3a, 0x64, 0x2e, 0x77, 0x72,\r\n  0xfb, 0x7f, 0x6d, 0x47, 0x83, 0x48, 0xcb, 0x5d, 0x77, 0x70, 0x10, 0xfd,\r\n  0x3f, 0xc0, 0x60, 0x29, 0x99, 0x2a, 0xb7, 0xd9, 0x60, 0x20, 0x1d, 0x91,\r\n  0x09, 0x75, 0x53, 0x4c, 0xfd, 0xee, 0x27, 0xed, 0x20, 0xb9, 0x67, 0xfb,\r\n  0xc5, 0x6c, 0x04, 0x65, 0xf3, 0x90, 0xb2, 0xa6, 0x8e, 0x1f, 0x09, 0x6c,\r\n  0x18, 0x57, 0xce, 0xab, 0xc7, 0x15, 0x06, 0xa5, 0xde, 0x9e, 0xa8, 0xf5,\r\n  0xa8, 0x36, 0x63, 0x11, 0x54, 0x49, 0x78, 0x77, 0x76, 0x7b, 0x19, 0x95,\r\n  0xb9, 0xfc, 0xd7, 0xf2, 0x8f, 0x14, 0xe3, 0xa5, 0xdb, 0x3f, 0xa8, 0x62,\r\n  0xa6, 0xe5, 0x3f, 0x91, 0xe5, 0xa4, 0xe0, 0x53, 0x01, 0xd6, 0x59, 0x64,\r\n  0xd2, 0x3a, 0x69, 0x5a, 0x00, 0x07, 0x2e, 0x41, 0xc2, 0xa8, 0xc4, 0x20,\r\n  0x0c, 0x2a, 0x63, 0xae, 0x58, 0xc9, 0xdf, 0xe6, 0xfa, 0x74, 0x66, 0xc9,\r\n  0xd8, 0x95, 0x6a, 0x19, 0x1d, 0x6e, 0xa5, 0x7c, 0xf7, 0xf5, 0xee, 0x47,\r\n  0x8e, 0x3c, 0x82, 0x74, 0xf7, 0x31, 0xd3, 0x98, 0x79, 0x95, 0xc0, 0x86,\r\n  0xa4, 0x35, 0x2e, 0x05, 0xc7, 0x11, 0x62, 0x53, 0x3c, 0x78, 0xf3, 0x9a,\r\n  0x13, 0x3e, 0xd4, 0x25, 0xa5, 0x54, 0x23, 0xf0, 0x7f, 0xdd, 0xa4, 0x0a,\r\n  0x31, 0x95, 0x59, 0xaf, 0x57, 0x0f, 0x84, 0x87, 0x8f, 0xd1, 0x05, 0x3e,\r\n  0xc0, 0xea, 0x30, 0x10, 0xa3, 0xf6, 0x81, 0x19, 0x39, 0x0e, 0x50, 0xbd,\r\n  0x44, 0x4e, 0xc2, 0xf4, 0x72, 0x01, 0x64, 0x38, 0xd8, 0xf3, 0x47, 0x7e,\r\n  0x3d, 0xfc, 0x24, 0xe3, 0x59, 0xb3, 0x48, 0x72, 0x49, 0x94, 0xc9, 0x8d,\r\n  0x2f, 0x94, 0xbd, 0x5d, 0x18, 0xa6, 0x02, 0xdf, 0x00, 0xab, 0xa6, 0xb5,\r\n  0x50, 0xab, 0x55, 0x15, 0x4c, 0xfe, 0xd6, 0x40, 0x67, 0xc9, 0x25, 0xdf,\r\n  0x6b, 0xb4, 0x59, 0xf4, 0xc2, 0x20, 0xee, 0x54, 0x2b, 0x92, 0x25, 0x09,\r\n  0xdd, 0x65, 0x55, 0xac, 0xa6, 0x35, 0x06, 0x3d, 0xec, 0x88, 0x5a, 0x94,\r\n  0xde, 0xcd, 0x71, 0x1e, 0xda, 0xf6, 0x27, 0xe7, 0x6a, 0xde, 0x8b, 0xf5,\r\n  0xc1, 0x3d, 0xdb, 0x8c, 0x6b, 0xf9, 0x2e, 0xae, 0xac, 0x61, 0xf8, 0xdd,\r\n  0x2d, 0xb7, 0xcb, 0x86, 0xe7, 0x2e, 0xb9, 0xbe, 0x51, 0x04, 0x9b, 0x13,\r\n  0x15, 0x82, 0xbb, 0x57, 0x15, 0x31, 0x28, 0x1e, 0x45, 0xa4, 0x94, 0x88,\r\n  0x50, 0x6b, 0xd8, 0x65, 0xb9, 0xe1, 0x68, 0x0b, 0xa9, 0x4b, 0x43, 0x45,\r\n  0xad, 0x4a, 0x20, 0x78, 0x9b, 0x26, 0xd2, 0x0a, 0xa1, 0xb8, 0x22, 0x40,\r\n  0xa5, 0xa7, 0x3e, 0x6c, 0x40, 0x56, 0xc1, 0xa0, 0xe4, 0xf4, 0x43, 0xe5,\r\n  0x72, 0xd3, 0xf9, 0x1b, 0xb9, 0xc2, 0xf4, 0xfa, 0x85, 0xa6, 0x3a, 0xd1,\r\n  0xbe, 0x1b, 0xcf, 0x85, 0xa9, 0xa4, 0xb5, 0x8f, 0x8e, 0xcc, 0xa7, 0x0a,\r\n  0x91, 0x83, 0xb9, 0x61, 0xcb, 0xc6, 0x16, 0x89, 0xe6, 0xd5, 0x3e, 0x41,\r\n  0x5d, 0xe0, 0x11, 0xf7, 0xe7, 0xc9, 0x4e, 0x3f, 0xa8, 0x62, 0xb4, 0x29,\r\n  0xf8, 0xff, 0x1c, 0xd6, 0x8f, 0xe3, 0x12, 0x14, 0xef, 0x05, 0xe3, 0xdc,\r\n  0xb6, 0x3a, 0xba, 0x42, 0x4d, 0xfc, 0xd2, 0xce, 0xec, 0x3e, 0xdf, 0x1b,\r\n  0xed, 0x7e, 0xf2, 0xd9, 0x68, 0x67, 0xb4, 0xbb, 0xc3, 0xf2, 0x85, 0xbb,\r\n  0x12, 0x74, 0x4e, 0xe6, 0xa5, 0xe3, 0x53, 0xb5, 0xf7, 0xda, 0xdf, 0x7c,\r\n  0x73, 0x7c, 0xf9, 0xdd, 0xd9, 0xc5, 0x37, 0xd1, 0xc9, 0x9b, 0xcb, 0xe3,\r\n  0x8b, 0x57, 0x07, 0x87, 0x1f, 0x4b, 0x8f, 0x1e, 0xba, 0xad, 0x83, 0x2a,\r\n  0xbe, 0x89, 0x9f, 0x98, 0xb6, 0x6f, 0xd0, 0xcf, 0x59, 0x52, 0xdd, 0xec,\r\n  0xec, 0xef, 0x3e, 0x4a, 0xa0, 0xdc, 0xe1, 0x1e, 0xf4, 0xef, 0xdb, 0xa0,\r\n  0x76, 0x79, 0x50, 0xeb, 0x5b, 0x71, 0xcc, 0x89, 0x63, 0x81, 0x59, 0x39,\r\n  0x88, 0x2e, 0xc4, 0x3c, 0x8a, 0xc4, 0xa4, 0x93, 0x22, 0x36, 0xc7, 0xd4,\r\n  0x44, 0x58, 0x5c, 0x25, 0xd3, 0x56, 0x39, 0x60, 0x14, 0x8e, 0xae, 0x32,\r\n  0x77, 0x43, 0x2a, 0xe6, 0x56, 0xea, 0x4e, 0x11, 0x52, 0xd6, 0x19, 0x54,\r\n  0x3c, 0x93, 0xca, 0x9a, 0xc6, 0xc6, 0xbb, 0x45, 0xeb, 0x38, 0x0a, 0x1f,\r\n  0xe0, 0xcc, 0xa5, 0x8c, 0x38, 0x42, 0x82, 0x8d, 0x28, 0xd0, 0xd3, 0xd1,\r\n  0xd7, 0x7a, 0xd1, 0xe3, 0x10, 0x49, 0xdb, 0x60, 0x44, 0x2d, 0x0d, 0xe2,\r\n  0x8c, 0x81, 0xd5, 0x5c, 0xa3, 0x87, 0xda, 0x11, 0x9c, 0x86, 0xa0, 0x37,\r\n  0xf2, 0x29, 0x28, 0x54, 0x46, 0xcd, 0x5d, 0xe7, 0xf3, 0x95, 0x3b, 0x0a,\r\n  0x69, 0x14, 0xa2, 0xff, 0x59, 0x0d, 0x01, 0x6e, 0xbd, 0xac, 0x71, 0x08,\r\n  0x46, 0x52, 0xb8, 0x27, 0x7c, 0x5d, 0x54, 0x6d, 0x00, 0x35, 0x67, 0x45,\r\n  0x7c, 0x8f, 0xea, 0x13, 0xa9, 0x67, 0x04, 0xdd, 0xa8, 0x17, 0x1f, 0x62,\r\n  0xc5, 0xc9, 0xcf, 0x79, 0x74, 0x7e, 0xfc, 0x7a, 0x68, 0x65, 0x53, 0xe9,\r\n  0xef, 0xe2, 0x8c, 0x32, 0xfa, 0x47, 0x49, 0xf3, 0x59, 0x26, 0x99, 0xc1,\r\n  0x6a, 0x20, 0x13, 0x15, 0x07, 0x14, 0x0e, 0x80, 0x0f, 0x8d, 0x23, 0x88,\r\n  0x54, 0xf4, 0xa8, 0xc1, 0x2f, 0x1d, 0x83, 0x69, 0x8d, 0x35, 0x93, 0xd7,\r\n  0x53, 0xb1, 0xcb, 0xd1, 0xa6, 0xc3, 0xeb, 0xf2, 0xf7, 0x00, 0x4a, 0x05,\r\n  0x66, 0xc0, 0xc1, 0x04, 0x72, 0x4b, 0xc2, 0x3e, 0xff, 0xe6, 0x70, 0xfc,\r\n  0xc7, 0xdd, 0x3d, 0xed, 0xce, 0xd6, 0xc8, 0xf3, 0xeb, 0xb6, 0xf2, 0xf3,\r\n  0x21, 0xae, 0xc3, 0x3e, 0x5a, 0xb6, 0x35, 0x0e, 0x38, 0x16, 0x63, 0xd3,\r\n  0xe5, 0x08, 0x6d, 0xd5, 0x92, 0x84, 0x00, 0x02, 0x7b, 0x70, 0x2a, 0xa6,\r\n  0x2b, 0x6b, 0xca, 0x21, 0x11, 0x54, 0xbf, 0xd1, 0xfa, 0x33, 0x95, 0x43,\r\n  0xfd, 0xc5, 0x99, 0xfd, 0x48, 0x5a, 0xd6, 0xd6, 0x90, 0x4e, 0xee, 0x91,\r\n  0x2d, 0xcd, 0x35, 0xe7, 0xf9, 0xf6, 0xbf, 0x65, 0x1a, 0x57, 0xbd, 0xd9,\r\n  0x8d, 0xaf, 0xc7, 0x7f, 0x06, 0x07, 0x40, 0x81, 0xec, 0x33, 0xab, 0x70,\r\n  0x95, 0xf9, 0xa2, 0x13, 0xfc, 0xf4, 0x19, 0x2d, 0x14, 0x9d, 0x2c, 0xa1,\r\n  0x70, 0x60, 0xa1, 0x90, 0xcf, 0xd9, 0x74, 0x71, 0x8f, 0x1c, 0x15, 0x5c,\r\n  0xdc, 0x63, 0x29, 0x90, 0xd2, 0x37, 0xa3, 0xe8, 0xeb, 0x24, 0xe3, 0x1c,\r\n  0x7a, 0x06, 0xdf, 0x59, 0x1a, 0x16, 0x20, 0x82, 0x5c, 0x62, 0x0f, 0x25,\r\n  0xc7, 0x4e, 0x93, 0x58, 0x29, 0x33, 0x49, 0xd6, 0x95, 0x62, 0xe1, 0x5a,\r\n  0xb9, 0x9d, 0x98, 0x81, 0x7a, 0xca, 0xef, 0xe9, 0x78, 0x2f, 0xf8, 0x01,\r\n  0x69, 0x60, 0xb3, 0xce, 0x7b, 0x09, 0x02, 0x7d, 0x34, 0xa7, 0xc7, 0x1c,\r\n  0xb1, 0x26, 0xf5, 0x2a, 0xdf, 0x80, 0xfc, 0x99, 0xbd, 0x85, 0x62, 0x71,\r\n  0x79, 0xa1, 0x32, 0x2b, 0x6e, 0xd8, 0xf5, 0x51, 0xd2, 0x75, 0x13, 0x67,\r\n  0xd3, 0x87, 0xd1, 0x8c, 0x74, 0x59, 0x76, 0x9e, 0x8d, 0x56, 0xb7, 0xdb,\r\n  0xc1, 0x31, 0x65, 0x91, 0x7f, 0x23, 0x74, 0x01, 0x75, 0xc7, 0xb7, 0x95,\r\n  0x73, 0x6d, 0x33, 0x7b, 0xc5, 0xb5, 0x33, 0xc1, 0x5b, 0xc2, 0x12, 0xff,\r\n  0xe5, 0x78, 0xae, 0xe5, 0xc0, 0x3a, 0x8e, 0x1c, 0xef, 0x30, 0xb7, 0x30,\r\n  0x5a, 0x26, 0x8b, 0x7d, 0x97, 0x98, 0x6c, 0xf2, 0x41, 0x6b, 0x18, 0x38,\r\n  0xc3, 0x22, 0x70, 0xd2, 0x66, 0xc9, 0xf5, 0x5c, 0x15, 0x8a, 0xd0, 0x74,\r\n  0xf1, 0x3c, 0xd2, 0xed, 0x6c, 0x10, 0x31, 0x78, 0xee, 0x85, 0x71, 0x15,\r\n  0x1a, 0x3b, 0xed, 0xc3, 0x4a, 0xd1, 0xb5, 0xf2, 0x30, 0xea, 0xa9, 0xfb,\r\n  0x46, 0x94, 0x44, 0x04, 0x14, 0xc8, 0xac, 0x0c, 0xab, 0x8b, 0xc7, 0x40,\r\n  0x49, 0x1a, 0x7e, 0x62, 0x9e, 0x56, 0xec, 0x10, 0x90, 0x8e, 0x2b, 0x40,\r\n  0x1a, 0xc1, 0x4f, 0x2b, 0x99, 0x2a, 0x67, 0x85, 0x7e, 0x7d, 0xf7, 0x84,\r\n  0x3d, 0xde, 0x97, 0xa7, 0x63, 0x8b, 0x8a, 0x64, 0xc9, 0x7d, 0xb0, 0xb5,\r\n  0x84, 0x28, 0x5f, 0xf7, 0x1f, 0x3b, 0x80, 0x84, 0xf1, 0x18, 0xc4, 0x07,\r\n  0xe8, 0x89, 0x48, 0x05, 0x1f, 0x26, 0xf3, 0x79, 0x10, 0x36, 0x09, 0x8a,\r\n  0x28, 0xe6, 0xae, 0x58, 0x65, 0x27, 0x51, 0x86, 0x1c, 0xe9, 0x0b, 0x53,\r\n  0xeb, 0x91, 0xb2, 0xf4, 0x64, 0x10, 0x0d, 0xf7, 0x40, 0xa5, 0xb3, 0x5b,\r\n  0x9f, 0xc4, 0xb8, 0x12, 0x16, 0x3f, 0x6e, 0x83, 0x5a, 0xb2, 0x56, 0x54,\r\n  0x1c, 0x6c, 0xea, 0x96, 0xbe, 0xa3, 0xf7, 0xf9, 0x3f, 0x7b, 0x3a, 0xa0,\r\n  0xbb, 0x5d, 0x80, 0xb7, 0x85, 0x56, 0x72, 0xfe, 0xd0, 0x56, 0x19, 0xf6,\r\n  0x1e, 0x5d, 0x55, 0xa4, 0x49, 0xdc, 0xa7, 0x8e, 0xdf, 0x59, 0x28, 0xfe,\r\n  0xe1, 0x0a, 0x55, 0xc6, 0x4e, 0xeb, 0x00, 0x4d, 0xa1, 0x3a, 0xb9, 0xb3,\r\n  0xe8, 0x6e, 0xcf, 0x62, 0xcd, 0xfc, 0x1b, 0x9b, 0x37, 0x71, 0xd6, 0x7b,\r\n  0x21, 0xd2, 0xca, 0x60, 0x64, 0xc0, 0x5b, 0xb0, 0x6b, 0x39, 0x01, 0x8a,\r\n  0xf6, 0x2c, 0x49, 0x91, 0x9a, 0x94, 0xc9, 0x33, 0x75, 0x2b, 0x48, 0xf6,\r\n  0x7b, 0x9c, 0xc9, 0x62, 0x90, 0x1e, 0xec, 0x61, 0x4e, 0x00, 0x81, 0x07,\r\n  0xe0, 0xc8, 0x93, 0xcc, 0xe5, 0x4c, 0xa8, 0x2b, 0x1f, 0x0c, 0x7a, 0x58,\r\n  0xfe, 0x9b, 0x54, 0x1c, 0x13, 0x80, 0x9d, 0xe2, 0x3a, 0xa7, 0x93, 0xdf,\r\n  0x8f, 0xe8, 0x30, 0xad, 0x58, 0xe2, 0x57, 0xae, 0xcc, 0xd4, 0x58, 0x98,\r\n  0x37, 0xfb, 0xa1, 0x98, 0x1b, 0x7e, 0xce, 0x43, 0x29, 0xfb, 0x7e, 0xec,\r\n  0x4a, 0x3c, 0x5e, 0x1f, 0x88, 0xc6, 0x39, 0xac, 0xb0, 0xd2, 0x79, 0x61,\r\n  0xe5, 0xa3, 0xfb, 0xc7, 0xef, 0x59, 0xc7, 0xe9, 0xeb, 0x97, 0xe4, 0xd7,\r\n  0x92, 0xde, 0x8f, 0x39, 0x3a, 0x3f, 0x79, 0x23, 0x15, 0x91, 0xdd, 0x59,\r\n  0x48, 0x98, 0x19, 0x71, 0x43, 0x8a, 0x79, 0xa3, 0x3f, 0xb1, 0x52, 0x48,\r\n  0x44, 0xe2, 0x38, 0xe2, 0x3d, 0xc3, 0x7b, 0x3c, 0xd5, 0x6f, 0x5d, 0xac,\r\n  0xe4, 0xeb, 0x7d, 0xbe, 0xe7, 0xca, 0x72, 0xde, 0x6f, 0x54, 0xf9, 0x74,\r\n  0x6b, 0xd2, 0xb8, 0x50, 0x9c, 0x47, 0x6a, 0x3a, 0x0b, 0xeb, 0x96, 0x6b,\r\n  0x2b, 0x35, 0x39, 0x37, 0x68, 0x24, 0x3d, 0x86, 0xae, 0xf0, 0x3f, 0x46,\r\n  0xa3, 0x6d, 0xfa, 0x60, 0xb9, 0x6d, 0x2f, 0x2e, 0x6f, 0xa7, 0x25, 0xdd,\r\n  0x70, 0x9c, 0xe1, 0xfb, 0x83, 0x63, 0x87, 0xe7, 0x1e, 0xcf, 0x7e, 0x8a,\r\n  0x86, 0xd3, 0x39, 0xc6, 0x17, 0xa1, 0xa4, 0xf0, 0x0f, 0xb4, 0xf2, 0xfc,\r\n  0xc4, 0x4f, 0x6e, 0x0d, 0x5f, 0xa5, 0x7c, 0xde, 0xde, 0x0f, 0x6c, 0xe8,\r\n  0x67, 0x62, 0x30, 0x08, 0xfd, 0x6c, 0x74, 0x30, 0xbb, 0xe3, 0xfc, 0xbb,\r\n  0x99, 0xfe, 0x93, 0xc7, 0x73, 0x9c, 0xa1, 0x12, 0x23, 0x46, 0x1a, 0x4f,\r\n  0xa4, 0xf8, 0xf2, 0xb7, 0x29, 0x19, 0x1d, 0x87, 0x0d, 0xfd, 0x82, 0x53,\r\n  0x01, 0xb9, 0x83, 0x78, 0x2b, 0xf8, 0xa5, 0xe5, 0x75, 0x0c, 0x34, 0x7d,\r\n  0xc1, 0x23, 0xff, 0x58, 0x3a, 0xf3, 0xd2, 0x8d, 0xa2, 0x2f, 0x39, 0xc6,\r\n  0x59, 0x24, 0x01, 0x39, 0xab, 0x5e, 0x7c, 0x52, 0xb1, 0x8c, 0x17, 0x23,\r\n  0x16, 0x2a, 0x8a, 0x91, 0x1b, 0x49, 0x2b, 0x1d, 0xc6, 0x8d, 0xc9, 0xfd,\r\n  0xa6, 0x3e, 0x38, 0xf4, 0xcb, 0xb2, 0xdb, 0x69, 0x28, 0x96, 0x3a, 0x11,\r\n  0xb5, 0x86, 0x12, 0xd0, 0x46, 0x4a, 0x0f, 0xe5, 0xc2, 0x9c, 0x25, 0x96,\r\n  0xe3, 0x9f, 0x87, 0xc4, 0x2a, 0xe6, 0x39, 0x46, 0x53, 0xa6, 0x11, 0xb8,\r\n  0x2d, 0x81, 0x3b, 0xdc, 0xf7, 0xfa, 0xf0, 0x86, 0x44, 0x73, 0xe2, 0xba,\r\n  0x3a, 0x16, 0x97, 0x9e, 0x75, 0x71, 0xcc, 0x77, 0x94, 0x2d, 0x82, 0xfb,\r\n  0xa5, 0x25, 0x4a, 0x42, 0x0b, 0xdd, 0x16, 0xd9, 0xe5, 0xf6, 0xae, 0xcc,\r\n  0x6e, 0x7d, 0x08, 0x9c, 0xdf, 0x38, 0x7e, 0xfb, 0x9a, 0x0b, 0x71, 0xa0,\r\n  0x40, 0xef, 0xe5, 0xc5, 0xc1, 0x9b, 0xf1, 0x2b, 0x71, 0x8d, 0x5f, 0xe6,\r\n  0xbe, 0xf4, 0xaf, 0xfa, 0x83, 0x5c, 0xfc, 0xd8, 0x31, 0xc6, 0xdd, 0x4b,\r\n  0x75, 0x08, 0x83, 0xd6, 0x6b, 0x51, 0xe0, 0x41, 0x93, 0x05, 0x5f, 0x8a,\r\n  0x0a, 0xf3, 0x6c, 0x70, 0xd7, 0x36, 0xc7, 0x5b, 0x4e, 0x11, 0x2a, 0xc3,\r\n  0x0a, 0x58, 0xbe, 0x30, 0xb7, 0x11, 0x37, 0xeb, 0x43, 0x3c, 0x2d, 0x87,\r\n  0xd6, 0x19, 0xfb, 0xa9, 0xdc, 0xbd, 0x6b, 0xb9, 0x42, 0x0f, 0xc9, 0x54,\r\n  0x1c, 0x6a, 0x5d, 0x95, 0xa0, 0xde, 0x97, 0x73, 0xa7, 0xca, 0xdd, 0xab,\r\n  0xac, 0x7e, 0xae, 0xf1, 0x30, 0x05, 0xd4, 0x9a, 0xde, 0xfc, 0xf3, 0xee,\r\n  0x56, 0x77, 0xf3, 0x97, 0xbf, 0xb4, 0xf9, 0xee, 0xbe, 0x9b, 0x6d, 0xe6,\r\n  0xb3, 0x8b, 0x36, 0xff, 0xbc, 0xb7, 0xf5, 0xe8, 0x88, 0xc2, 0x04, 0x49,\r\n  0xff, 0x4d, 0x7a, 0x83, 0x3b, 0x1b, 0xbd, 0xb4, 0x32, 0xef, 0xaa, 0x33,\r\n  0x39, 0x84, 0x4e, 0x40, 0x07, 0x5c, 0xe3, 0xee, 0x60, 0x04, 0xb7, 0xd3,\r\n  0xd4, 0x7d, 0xe0, 0x4d, 0x13, 0x4d, 0x4e, 0xfe, 0xe7, 0x71, 0xc8, 0xf2,\r\n  0x98, 0xf5, 0xab, 0xf0, 0x8a, 0x62, 0xa2, 0x80, 0x32, 0x1f, 0xe1, 0xdb,\r\n  0x7b, 0x8f, 0x7c, 0xdb, 0x8f, 0x2e, 0x70, 0x4b, 0x70, 0x14, 0x9b, 0x61,\r\n  0x70, 0x46, 0x56, 0xad, 0xdf, 0xd9, 0xf0, 0x05, 0xa5, 0xd7, 0x7f, 0xef,\r\n  0xf2, 0xe4, 0xf5, 0x31, 0x93, 0x5a, 0x1f, 0x9d, 0x30, 0x0f, 0xdd, 0x58,\r\n  0x99, 0x20, 0xcd, 0x03, 0xe1, 0x08, 0x73, 0xc3, 0xea, 0x28, 0x12, 0xde,\r\n  0x75, 0x68, 0x33, 0x27, 0x39, 0xdc, 0x4a, 0xf0, 0xa7, 0x15, 0x0e, 0x5d,\r\n  0x5a, 0xd2, 0xe5, 0xc9, 0xd5, 0xf0, 0x75, 0x3e, 0x83, 0x95, 0x3c, 0x1c,\r\n  0x03, 0x2a, 0x48, 0x6f, 0xd1, 0x0f, 0xdf, 0x66, 0x8b, 0xda, 0x8f, 0x47,\r\n  0x1d, 0x49, 0xbb, 0x1b, 0xeb, 0x4a, 0xc8, 0xfc, 0x63, 0x7b, 0x38, 0x44,\r\n  0x45, 0x77, 0x81, 0x75, 0x69, 0x70, 0xa7, 0x46, 0xd5, 0x61, 0xa2, 0x85,\r\n  0x26, 0x28, 0x9d, 0x3f, 0x08, 0x10, 0x21, 0xf6, 0xf0, 0x31, 0x9f, 0xc8,\r\n  0x79, 0xcd, 0xc9, 0x64, 0xde, 0xc5, 0x27, 0x4e, 0xbc, 0x8d, 0x90, 0x5b,\r\n  0x14, 0x86, 0x54, 0x72, 0xef, 0xf1, 0x4f, 0x5a, 0x9d, 0x36, 0x5f, 0x3e,\r\n  0x60, 0x94, 0xf7, 0x35, 0x68, 0x45, 0x67, 0x7c, 0xf5, 0x1f, 0xf2, 0x4e,\r\n  0xad, 0x68, 0x92, 0x52, 0x40, 0x07, 0x3b, 0x50, 0x7f, 0xa2, 0x35, 0x86,\r\n  0xce, 0x8a, 0xe0, 0xba, 0xd2, 0x6e, 0x5b, 0x2d, 0xb1, 0x80, 0x77, 0x34,\r\n  0xa0, 0x49, 0xad, 0xf7, 0x33, 0xe4, 0x68, 0xcd, 0x39, 0x0b, 0xf6, 0x28,\r\n  0x77, 0xc1, 0x31, 0x12, 0x3b, 0xcb, 0x7a, 0xfd, 0xd7, 0x24, 0xb2, 0x7c,\r\n  0x6f, 0x49, 0xe7, 0xef, 0x0f, 0xfb, 0x28, 0x9b, 0x90, 0x66, 0x1d, 0x83,\r\n  0x19, 0xfe, 0xf2, 0xd1, 0xb4, 0x42, 0xaf, 0x51, 0xef, 0x8a, 0x39, 0x31,\r\n  0x38, 0x8e, 0xd5, 0x93, 0x0e, 0x08, 0x65, 0x8c, 0x6c, 0x2e, 0xba, 0x20,\r\n  0x58, 0xae, 0x99, 0x21, 0x29, 0x46, 0xb5, 0x43, 0xc6, 0x3a, 0x27, 0xb9,\r\n  0x78, 0x25, 0x59, 0x90, 0xae, 0x96, 0x33, 0x80, 0x32, 0x04, 0x8e, 0xfa,\r\n  0x1f, 0xcc, 0x59, 0x5d, 0x3c, 0x44, 0xbb, 0x7b, 0x83, 0x68, 0x6f, 0x67,\r\n  0x77, 0xaf, 0x63, 0x0c, 0xbd, 0xff, 0x60, 0x50, 0xd4, 0x1e, 0x7e, 0xdd,\r\n  0xfb, 0xd8, 0x51, 0xf8, 0xd4, 0x06, 0xdc, 0x24, 0x9a, 0x04, 0x4c, 0xc2,\r\n  0x87, 0xe3, 0xb3, 0x52, 0xc0, 0x9e, 0x8b, 0xc2, 0x82, 0xd9, 0x0e, 0xd7,\r\n  0x96, 0x38, 0x09, 0xad, 0xa0, 0xa1, 0x2b, 0x74, 0xc5, 0x4f, 0x6c, 0x68,\r\n  0x5d, 0x4e, 0x20, 0x5f, 0x9c, 0xa7, 0x34, 0x2e, 0x50, 0xad, 0xb1, 0xbe,\r\n  0x46, 0x69, 0x65, 0xcb, 0xc2, 0xd0, 0x1a, 0x5e, 0x1b, 0xda, 0xef, 0x47,\r\n  0x27, 0x87, 0x97, 0x46, 0x7d, 0x78, 0xc5, 0xca, 0x53, 0xf1, 0xf0, 0x71,\r\n  0xa5, 0xef, 0x1e, 0x7d, 0x66, 0xb6, 0x7f, 0x93, 0x90, 0x1a, 0x9d, 0x4d,\r\n  0x56, 0xd7, 0xfb, 0x7f, 0x8f, 0x8b, 0xeb, 0x3c, 0xfb, 0xd0, 0xf3, 0x33,\r\n  0xe4, 0x96, 0xed, 0x93, 0x84, 0xda, 0x7d, 0xbe, 0xfb, 0x44, 0x12, 0x17,\r\n  0x52, 0xae, 0x93, 0x09, 0x01, 0xd1, 0x5f, 0xf4, 0x85, 0x6b, 0x03, 0x19,\r\n  0x13, 0x8e, 0x60, 0x23, 0x9b, 0xf5, 0xe5, 0xba, 0x8f, 0xc3, 0x67, 0x67,\r\n  0xfa, 0xac, 0x64, 0xa1, 0xf7, 0x37, 0xa4, 0x74, 0x49, 0x9f, 0x33, 0x36,\r\n  0x57, 0xcb, 0x7e, 0x9d, 0xc1, 0xfd, 0x03, 0x63, 0xe5, 0x4f, 0xb8, 0x4a,\r\n  0x7f, 0x87, 0x8e, 0x97, 0x1e, 0xc9, 0x44, 0x45, 0x12, 0xdf, 0xfa, 0x2a,\r\n  0xb1, 0x9e, 0x88, 0xc3, 0x42, 0x1e, 0x17, 0xaf, 0x0e, 0x85, 0xcc, 0xd4,\r\n  0x52, 0xa7, 0x30, 0xd5, 0x91, 0x73, 0x4d, 0x6d, 0x71, 0x2f, 0x3f, 0xf0,\r\n  0x7d, 0xce, 0x6d, 0xd8, 0x9f, 0x4d, 0x3e, 0xe2, 0x21, 0x3a, 0x77, 0xc2,\r\n  0x1b, 0x77, 0x50, 0x2f, 0x88, 0xc3, 0x86, 0x1a, 0xca, 0x7b, 0x58, 0x39,\r\n  0xd8, 0x4d, 0xa9, 0xfa, 0x29, 0x11, 0x07, 0xee, 0x9a, 0x15, 0xda, 0x35,\r\n  0xef, 0x0e, 0xf5, 0x9b, 0x4b, 0x6a, 0x1e, 0x1d, 0x9c, 0x07, 0x86, 0x2e,\r\n  0x0c, 0x49, 0xef, 0xd4, 0xe3, 0xe7, 0xd8, 0xd0, 0x41, 0xc5, 0x69, 0xf1,\r\n  0xfd, 0x3d, 0x0c, 0xbc, 0x89, 0x52, 0x41, 0x4e, 0xb2, 0x6e, 0x04, 0x80,\r\n  0x7c, 0xae, 0xf7, 0x09, 0xfc, 0x4f, 0x28, 0x36, 0x30, 0x9f, 0xc5, 0x08,\r\n  0x84, 0xea, 0x2d, 0x04, 0x9d, 0x0b, 0x6d, 0xa5, 0x8a, 0x86, 0xa2, 0xb5,\r\n  0x79, 0x1f, 0x69, 0x12, 0x87, 0x66, 0xab, 0x68, 0x39, 0x10, 0x3c, 0xc6,\r\n  0x09, 0xca, 0x0f, 0x36, 0x00, 0x91, 0xcf, 0xd4, 0xf9, 0xb8, 0xbc, 0x25,\r\n  0x51, 0x2a, 0x01, 0x7c, 0xfa, 0x7a, 0xaa, 0x21, 0x70, 0x76, 0xfa, 0xa4,\r\n  0x02, 0xa4, 0x61, 0xf7, 0x13, 0x28, 0x91, 0x6a, 0x0b, 0x26, 0x57, 0x10,\r\n  0x5b, 0x9c, 0xf3, 0x32, 0x11, 0x02, 0xc3, 0xe8, 0xf2, 0x3e, 0x17, 0x13,\r\n  0xa3, 0x34, 0x78, 0xad, 0x40, 0x51, 0xcb, 0x55, 0x2a, 0x5a, 0x24, 0x2d,\r\n  0x1e, 0xe4, 0x41, 0x50, 0xb3, 0xb3, 0xe7, 0x3c, 0x5f, 0x47, 0x2e, 0xee,\r\n  0x39, 0x3e, 0xfa, 0x26, 0xe2, 0xd4, 0x7a, 0xfe, 0xc6, 0x21, 0xd3, 0xed,\r\n  0x33, 0x84, 0x61, 0x01, 0xeb, 0xef, 0xab, 0x15, 0x9f, 0xf7, 0xc3, 0x9b,\r\n  0x78, 0xc9, 0x06, 0xd0, 0xee, 0x0e, 0xbb, 0x4b, 0xbe, 0xb3, 0x24, 0x3d,\r\n  0x3e, 0xa8, 0x56, 0xcf, 0xbb, 0xec, 0x05, 0x9e, 0x94, 0x19, 0x97, 0xe3,\r\n  0x66, 0x0b, 0xa8, 0xee, 0xa4, 0xa5, 0xeb, 0xb3, 0xdc, 0x16, 0x92, 0xfd,\r\n  0x92, 0xb6, 0x46, 0x51, 0xce, 0x6e, 0xb7, 0xa7, 0xf4, 0xc7, 0x93, 0x9d,\r\n  0x6d, 0x70, 0x6a, 0x56, 0xf0, 0x69, 0xf2, 0x9e, 0xdc, 0xdb, 0x7b, 0xf6,\r\n  0x6c, 0x10, 0xf5, 0xd8, 0xcb, 0x68, 0x1f, 0xe0, 0x23, 0x41, 0x27, 0xab,\r\n  0xd7, 0x55, 0xbc, 0x74, 0xbb, 0xb8, 0x9a, 0xf2, 0xff, 0xf1, 0x6b, 0x56,\r\n  0x82, 0xf0, 0x52, 0xb3, 0x6e, 0x30, 0x0f, 0x59, 0x48, 0x93, 0x23, 0xdb,\r\n  0x8a, 0x7f, 0x77, 0xe2, 0xfc, 0x48, 0x1c, 0x34, 0x5a, 0x26, 0xf9, 0xd2,\r\n  0xa2, 0xc3, 0x0b, 0x2d, 0xdf, 0x81, 0xcf, 0x07, 0x21, 0x35, 0xc4, 0xf3,\r\n  0x05, 0x0e, 0xa7, 0x7c, 0x08, 0xe5, 0x6a, 0x32, 0xd4, 0xc4, 0x60, 0xb1,\r\n  0x2a, 0x53, 0x3a, 0xb9, 0xf4, 0xcf, 0xb9, 0xb9, 0xeb, 0x5b, 0x12, 0xf9,\r\n  0xcb, 0xa8, 0xa7, 0x7b, 0x8b, 0xff, 0x33, 0x42, 0x70, 0x37, 0x99, 0xf2,\r\n  0x30, 0xf2, 0x97, 0xfa, 0x8f, 0x7f, 0xff, 0x77, 0x6a, 0xf6, 0xdf, 0xb9,\r\n  0x95, 0x97, 0x7f, 0x2e, 0xab, 0x9b, 0xe0, 0x99, 0x9e, 0x6e, 0xf8, 0x13,\r\n  0x1f, 0xda, 0x06, 0x5c, 0x0d, 0x8c, 0xb3, 0xc8, 0x5f, 0x7b, 0x7d, 0xaa,\r\n  0x12, 0x79, 0x10, 0x8c, 0x2f, 0x45, 0x66, 0xa1, 0x38, 0x49, 0x1d, 0x5a,\r\n  0xe4, 0x4b, 0x0e, 0x3b, 0x27, 0x9c, 0x91, 0x4e, 0x17, 0x09, 0x08, 0x05,\r\n  0xb7, 0x4c, 0xc5, 0x38, 0x7e, 0xf3, 0xed, 0xc9, 0xc5, 0xd9, 0x9b, 0xd7,\r\n  0xc7, 0x6f, 0x2e, 0xa3, 0x6f, 0x0f, 0x2e, 0x4e, 0x0e, 0xbe, 0x3c, 0xd5,\r\n  0xc4, 0x77, 0x1e, 0x02, 0x83, 0x7c, 0x44, 0xf7, 0x6e, 0x10, 0xc2, 0x06,\r\n  0x89, 0x48, 0x9d, 0xa5, 0x3d, 0x1a, 0x35, 0x68, 0xdf, 0x29, 0xc3, 0x38,\r\n  0x2c, 0x91, 0x77, 0xa8, 0x52, 0x34, 0x60, 0xe5, 0xf3, 0x9d, 0x15, 0x2c,\r\n  0x62, 0xe3, 0xe9, 0x21, 0x48, 0xa5, 0x66, 0xfc, 0x11, 0xef, 0x52, 0x93,\r\n  0x4f, 0xbe, 0x72, 0x9d, 0xab, 0x7d, 0xf1, 0x95, 0x64, 0xe3, 0x5b, 0x21,\r\n  0x10, 0x7b, 0x55, 0x33, 0xc3, 0xe0, 0x77, 0x73, 0x7d, 0x38, 0x38, 0x3d,\r\n  0xf5, 0x9f, 0x7a, 0xbc, 0x46, 0x8c, 0x32, 0x31, 0x49, 0xf2, 0x16, 0x1a,\r\n  0xe5, 0xc0, 0xe0, 0x75, 0xee, 0xe9, 0xd2, 0xb3, 0x87, 0x90, 0x19, 0x9d,\r\n  0x3f, 0x46, 0xcb, 0xb1, 0x29, 0x14, 0x1a, 0x1c, 0x25, 0xa6, 0x03, 0x94,\r\n  0x96, 0xb7, 0x83, 0xa8, 0xff, 0xe7, 0xbe, 0x24, 0xd5, 0x25, 0xe0, 0x0d,\r\n  0x96, 0x0a, 0x34, 0x5b, 0xbe, 0x53, 0x6f, 0xce, 0x7c, 0x9f, 0x34, 0xf0,\r\n  0xe9, 0x3a, 0xe0, 0x5e, 0xf4, 0x61, 0xeb, 0xd2, 0xf4, 0x19, 0xe0, 0x45,\r\n  0xfd, 0xe3, 0x5a, 0xa6, 0xc1, 0x31, 0x03, 0xe8, 0x1e, 0xe5, 0xc0, 0x56,\r\n  0xe7, 0xbb, 0xb0, 0xda, 0xe2, 0x69, 0x40, 0x0f, 0x8d, 0xb1, 0x66, 0xec,\r\n  0xea, 0x70, 0xa5, 0xb3, 0xcc, 0x1b, 0x48, 0x53, 0xcd, 0x3e, 0xbd, 0x0d,\r\n  0xab, 0x76, 0xaf, 0x12, 0x14, 0xbb, 0xea, 0xfd, 0xb6, 0x55, 0xa2, 0x41,\r\n  0x8c, 0x91, 0xf3, 0x01, 0x8a, 0x74, 0xa6, 0x74, 0x83, 0x9d, 0xbb, 0x62,\r\n  0x84, 0xd0, 0xd4, 0xc5, 0x21, 0xd8, 0xd9, 0x33, 0x2e, 0x21, 0xe8, 0x2b,\r\n  0x5d, 0x00, 0x3b, 0x4c, 0x52, 0xa4, 0xe0, 0x84, 0xbc, 0x4c, 0x95, 0x10,\r\n  0xe0, 0x71, 0xa1, 0xa3, 0xc7, 0xd7, 0xb9, 0xe9, 0xdf, 0xb1, 0x0b, 0x9a,\r\n  0xbb, 0x7a, 0x60, 0x81, 0x4e, 0xef, 0x38, 0xc4, 0x9c, 0xcb, 0x12, 0xe1,\r\n  0x75, 0x0b, 0x10, 0x30, 0xbc, 0x8c, 0x97, 0xdc, 0xca, 0xf5, 0x96, 0x41,\r\n  0x96, 0xb6, 0xcf, 0x5e, 0x60, 0x59, 0x22, 0x20, 0x7d, 0x23, 0xf5, 0x02,\r\n  0x91, 0x9a, 0x65, 0x75, 0x03, 0xe8, 0x88, 0x6e, 0xf1, 0x83, 0x68, 0x52,\r\n  0x31, 0xab, 0x68, 0xd2, 0x7c, 0xd7, 0x74, 0x7a, 0xe6, 0x9c, 0x40, 0x66,\r\n  0x92, 0x28, 0x8e, 0x26, 0xe9, 0xb5, 0xb0, 0x03, 0x70, 0x2a, 0x3a, 0xef,\r\n  0x12, 0x90, 0xbd, 0x91, 0x61, 0xcf, 0x4b, 0x05, 0x2a, 0x37, 0xe8, 0xee,\r\n  0x37, 0xf9, 0x3c, 0xe4, 0x1b, 0xb3, 0x91, 0x94, 0x5a, 0xe9, 0xcc, 0x5c,\r\n  0x9f, 0x08, 0x7d, 0xac, 0x78, 0x1e, 0x0d, 0x8d, 0xa6, 0x44, 0xe5, 0x8a,\r\n  0xcd, 0x63, 0x9f, 0x3a, 0x58, 0x13, 0x33, 0x64, 0x02, 0x59, 0x56, 0x35,\r\n  0xe6, 0xc1, 0x70, 0xcb, 0x2c, 0x2d, 0xe0, 0x47, 0xe3, 0x7a, 0x85, 0x9b,\r\n  0x8e, 0x69, 0x9c, 0x5b, 0x99, 0x0a, 0x57, 0x2b, 0x6f, 0x7a, 0x89, 0x28,\r\n  0xd7, 0xcb, 0xf5, 0xe8, 0x62, 0x29, 0x8b, 0x16, 0xed, 0x09, 0xee, 0x34,\r\n  0xcd, 0xd4, 0x66, 0x20, 0x78, 0x32, 0xda, 0x22, 0xf2, 0x98, 0x18, 0x90,\r\n  0xfa, 0xaf, 0xa1, 0xab, 0x34, 0xa6, 0x71, 0xe7, 0x2d, 0x8f, 0x3b, 0x10,\r\n  0x2d, 0x80, 0x77, 0xeb, 0x54, 0x4b, 0x22, 0x22, 0x42, 0xcf, 0x75, 0x1b,\r\n  0x41, 0x0d, 0x55, 0xf3, 0x3d, 0x46, 0x96, 0x6f, 0x33, 0x9f, 0x07, 0x54,\r\n  0xe3, 0xe2, 0x8e, 0x88, 0x5b, 0xba, 0x07, 0x07, 0x87, 0x24, 0x0d, 0x55,\r\n  0x91, 0x3f, 0x42, 0x4b, 0x1c, 0x0c, 0x44, 0x31, 0xe5, 0xac, 0x9d, 0x35,\r\n  0x5c, 0x9a, 0x81, 0x40, 0xb3, 0xe8, 0x78, 0x78, 0x31, 0x69, 0xb5, 0x8b,\r\n  0x34, 0x5e, 0x88, 0xee, 0xe8, 0x77, 0xdf, 0xe2, 0x41, 0x50, 0x87, 0x1b,\r\n  0x1b, 0x87, 0x6f, 0xc7, 0x97, 0x67, 0xaf, 0xa3, 0xb3, 0xb7, 0x97, 0xe7,\r\n  0x6f, 0x2f, 0xf5, 0xe6, 0x9a, 0x08, 0x66, 0x5b, 0x90, 0x0b, 0xa2, 0x04,\r\n  0xd8, 0x62, 0x2e, 0x34, 0xbe, 0x0f, 0x88, 0x49, 0x0e, 0x82, 0xc1, 0x80,\r\n  0x5b, 0xc8, 0xe5, 0x64, 0x81, 0x75, 0x4b, 0x98, 0x8b, 0x31, 0xe5, 0xf7,\r\n  0x34, 0xe5, 0xc8, 0xa7, 0x85, 0x23, 0xcf, 0x52, 0xbc, 0x60, 0xf6, 0xd8,\r\n  0x59, 0xab, 0x57, 0x92, 0x69, 0x14, 0xc2, 0x44, 0x70, 0xbe, 0xce, 0xe5,\r\n  0xe4, 0x71, 0x54, 0xe6, 0xdb, 0xf1, 0xae, 0x9f, 0x10, 0xd2, 0x09, 0x30,\r\n  0xd3, 0xb4, 0x32, 0x07, 0xb4, 0xa1, 0x6a, 0x01, 0x35, 0xaa, 0x27, 0x16,\r\n  0x86, 0xf9, 0x8d, 0x55, 0x4e, 0x23, 0xbc, 0x71, 0x88, 0x78, 0x46, 0x11,\r\n  0x01, 0x09, 0x28, 0x00, 0x0a, 0x86, 0xdc, 0x89, 0xc5, 0x40, 0x76, 0x20,\r\n  0x87, 0x2c, 0x5a, 0xb7, 0xec, 0x7d, 0xd4, 0xff, 0x2e, 0x09, 0x1b, 0xfc,\r\n  0xd3, 0x7f, 0x72, 0xda, 0xe6, 0x3b, 0xfb, 0xc9, 0x3f, 0xe5, 0x93, 0x3f,\r\n  0x66, 0x7d, 0x00, 0xe8, 0xea, 0x91, 0xf2, 0x6f, 0x8e, 0x2f, 0xbe, 0x3c,\r\n  0xbe, 0x38, 0x1b, 0x43, 0x1e, 0x98, 0xbb, 0xab, 0xbd, 0xd7, 0x6f, 0x93,\r\n  0x62, 0x92, 0x14, 0xb9, 0x56, 0xb9, 0xb2, 0x7f, 0x3d, 0xdb, 0xfe, 0x6a,\r\n  0x3c, 0x3e, 0x38, 0x3f, 0x71, 0x75, 0x64, 0x5c, 0x02, 0x99, 0x98, 0x48,\r\n  0x99, 0xa4, 0x38, 0xf2, 0xf8, 0xed, 0x15, 0xda, 0x17, 0xd3, 0x5b, 0x01,\r\n  0x16, 0xb7, 0x62, 0xd2, 0xe6, 0x57, 0xe7, 0x60, 0xb4, 0xe6, 0x15, 0x72,\r\n  0xc3, 0xc6, 0x09, 0x15, 0xf2, 0xce, 0x0b, 0x41, 0x3c, 0xc7, 0x02, 0x06,\r\n  0x0e, 0x81, 0x77, 0x5b, 0x4c, 0x86, 0xb4, 0xdb, 0x6f, 0xad, 0xca, 0xb0,\r\n  0xe4, 0x41, 0x90, 0xa8, 0x14, 0x80, 0xb4, 0xf7, 0x35, 0xdc, 0x72, 0xc1,\r\n  0xf1, 0xed, 0x5b, 0x3e, 0x1f, 0x5c, 0xe3, 0x64, 0x3e, 0x12, 0xe9, 0x2e,\r\n  0x07, 0xca, 0x50, 0xaf, 0x2c, 0x62, 0x1f, 0xe3, 0xa9, 0xa0, 0xaf, 0xb9,\r\n  0xc2, 0x84, 0xe2, 0xef, 0xa2, 0x9f, 0x3c, 0x75, 0x84, 0x5d, 0x61, 0x2d,\r\n  0xea, 0x2b, 0x52, 0xc0, 0x97, 0xf7, 0x33, 0xbd, 0x44, 0xc0, 0x57, 0x9d,\r\n  0x49, 0x78, 0x42, 0x64, 0x78, 0x33, 0x40, 0xc5, 0xc5, 0x13, 0x91, 0xb0,\r\n  0xa1, 0x70, 0xf4, 0x68, 0x32, 0x8f, 0xb3, 0x5b, 0xdc, 0x66, 0xb8, 0x9f,\r\n  0xd8, 0xe4, 0x34, 0x1a, 0x2a, 0x2e, 0x6a, 0x89, 0x78, 0xa4, 0x32, 0x43,\r\n  0x40, 0x09, 0x9c, 0xb3, 0x70, 0x7b, 0x10, 0x5f, 0xbe, 0x63, 0xdb, 0x0a,\r\n  0x22, 0x6f, 0x38, 0x4e, 0x7e, 0x12, 0xd8, 0x75, 0x74, 0x7c, 0x4a, 0x17,\r\n  0x93, 0x4b, 0x32, 0x81, 0x89, 0x9e, 0xcc, 0xd9, 0x15, 0x6c, 0x88, 0x20,\r\n  0xc9, 0xab, 0x4c, 0x21, 0xc8, 0x44, 0x7a, 0x18, 0x95, 0x3a, 0xe2, 0x47,\r\n  0xd8, 0x2e, 0x48, 0x1f, 0x2d, 0x5d, 0xc1, 0x11, 0x95, 0xdc, 0x22, 0xc4,\r\n  0xc0, 0x13, 0xea, 0xeb, 0x8f, 0x84, 0xd5, 0x69, 0x14, 0x6e, 0x77, 0xe8,\r\n  0xf1, 0x40, 0xae, 0x5c, 0x97, 0x74, 0xc2, 0xab, 0xa5, 0x2e, 0xc2, 0x58,\r\n  0xcb, 0x6e, 0x59, 0xbb, 0x4c, 0xf2, 0x7a, 0x97, 0x13, 0x40, 0xe8, 0xcd,\r\n  0x66, 0x1a, 0xef, 0x70, 0xcc, 0x40, 0x06, 0x59, 0xae, 0xc3, 0x84, 0xad,\r\n  0xe3, 0x82, 0x06, 0x60, 0xe7, 0xed, 0xbc, 0xb2, 0xa0, 0x21, 0x20, 0xae,\r\n  0x7a, 0x03, 0x57, 0x33, 0x88, 0x9c, 0xa2, 0x46, 0x5a, 0x1b, 0xa2, 0x73,\r\n  0x85, 0xbc, 0x02, 0xbe, 0x41, 0xc9, 0xd7, 0x80, 0x15, 0xe3, 0xf4, 0xdb,\r\n  0xe1, 0x1b, 0xbe, 0x2e, 0xf2, 0xe1, 0x64, 0x05, 0xbb, 0x2c, 0x28, 0xa3,\r\n  0x25, 0x39, 0x9c, 0x5c, 0x6f, 0x1e, 0xbc, 0x6a, 0xf8, 0x3d, 0xc7, 0xa3,\r\n  0x90, 0x1d, 0x2f, 0x21, 0x2a, 0xa4, 0x4b, 0xd6, 0x39, 0x77, 0x1c, 0xd3,\r\n  0x8a, 0xe4, 0x20, 0x00, 0x8b, 0x6d, 0x85, 0xd7, 0xa4, 0x87, 0xba, 0xc8,\r\n  0x0e, 0x2d, 0x98, 0x69, 0xed, 0x55, 0x44, 0x56, 0xea, 0x88, 0xeb, 0xca,\r\n  0x51, 0xdf, 0x5f, 0x42, 0x4d, 0x48, 0x94, 0x10, 0xde, 0xa0, 0xd4, 0x96,\r\n  0xb8, 0x71, 0x57, 0x71, 0xe1, 0x27, 0x21, 0x89, 0x88, 0xe7, 0x52, 0xb1,\r\n  0x63, 0xed, 0x55, 0x22, 0x87, 0xa9, 0xba, 0xbc, 0xfc, 0xdb, 0xf9, 0xf1,\r\n  0x4b, 0x7b, 0xf3, 0xb1, 0x35, 0x13, 0xee, 0x34, 0x60, 0x66, 0x12, 0xe5,\r\n  0x2a, 0x0d, 0x2a, 0x39, 0xd3, 0x26, 0x1b, 0x56, 0x16, 0xcb, 0x97, 0xcf,\r\n  0x0c, 0xa3, 0xef, 0x8f, 0x4e, 0xc6, 0xe7, 0xa7, 0x67, 0x87, 0x2f, 0x5f,\r\n  0x7c, 0x6f, 0x22, 0xf9, 0x73, 0x0e, 0x11, 0x88, 0x9e, 0xe6, 0x7e, 0xe6,\r\n  0xb9, 0x1d, 0xf4, 0xbd, 0x37, 0xc7, 0xdf, 0xbd, 0x23, 0xeb, 0xe0, 0x25,\r\n  0x33, 0xbc, 0x0f, 0xee, 0xe2, 0xb9, 0xbe, 0xc4, 0x26, 0x56, 0x87, 0x6e,\r\n  0x37, 0xaa, 0x93, 0xf1, 0x35, 0x27, 0xd6, 0x55, 0x0f, 0xf5, 0x79, 0x0a,\r\n  0x0f, 0x06, 0xa3, 0x0b, 0x0a, 0x45, 0xc5, 0xb5, 0xb4, 0xda, 0x8e, 0x12,\r\n  0xbf, 0xfe, 0xfa, 0xef, 0x57, 0x82, 0xa9, 0x64, 0x08, 0x41, 0x18, 0x99,\r\n  0x07, 0x6e, 0x55, 0x7f, 0xe3, 0xf1, 0xbc, 0xca, 0xa4, 0x5c, 0x30, 0x80,\r\n  0xc5, 0x51, 0x51, 0x6a, 0x9d, 0x65, 0xc4, 0xbc, 0x95, 0xaf, 0x52, 0x49,\r\n  0x98, 0x18, 0x42, 0x6b, 0x68, 0x7a, 0x93, 0x63, 0xaa, 0xc2, 0xb8, 0xbe,\r\n  0xc4, 0x56, 0xca, 0x16, 0xb5, 0x79, 0xce, 0x8f, 0x2f, 0xc6, 0x27, 0xe3,\r\n  0x4b, 0x36, 0xa3, 0xb4, 0xae, 0xa2, 0xfa, 0xa0, 0xad, 0xe8, 0x25, 0x38,\r\n  0x1b, 0xea, 0xd4, 0xa3, 0x61, 0xdd, 0x90, 0xda, 0x89, 0x76, 0x62, 0xae,\r\n  0x9e, 0xc4, 0xc9, 0x37, 0x80, 0x64, 0x86, 0xb2, 0x22, 0x2a, 0x04, 0xba,\r\n  0xf1, 0x95, 0x1d, 0xe0, 0x5c, 0xb7, 0x46, 0xa3, 0x7c, 0x06, 0x4a, 0xdf,\r\n  0x60, 0x75, 0xe6, 0xe9, 0xc4, 0x7b, 0xcd, 0x1b, 0x21, 0x64, 0x46, 0x27,\r\n  0x28, 0x59, 0x47, 0x78, 0x84, 0xcc, 0x1f, 0xee, 0x33, 0xa3, 0xb5, 0xd4,\r\n  0xae, 0x5e, 0x6b, 0x9a, 0xd5, 0x18, 0xe6, 0xaf, 0x3a, 0x43, 0x15, 0xc6,\r\n  0x89, 0xe9, 0x69, 0xee, 0xa7, 0x01, 0x08, 0x55, 0xf9, 0x9f, 0x40, 0x5d,\r\n  0xab, 0x22, 0x9b, 0x85, 0x72, 0x2a, 0x99, 0x68, 0xec, 0x68, 0x21, 0xad,\r\n  0x05, 0x99, 0xf5, 0xc0, 0x09, 0xe9, 0xc8, 0x5a, 0x2a, 0x88, 0xaa, 0x8e,\r\n  0xd7, 0x9c, 0xc2, 0x06, 0x92, 0xad, 0x19, 0xeb, 0x5b, 0xf0, 0xc0, 0x85,\r\n  0x1f, 0xb3, 0xeb, 0x94, 0x67, 0x70, 0xb2, 0x0a, 0x0b, 0xb5, 0xb9, 0xde,\r\n  0x4b, 0x7d, 0x12, 0x4c, 0x3c, 0x10, 0x92, 0x71, 0x01, 0x16, 0xcb, 0x4a,\r\n  0x49, 0xe3, 0xcd, 0xf0, 0x51, 0xb8, 0xe3, 0xa8, 0xce, 0xe7, 0x63, 0xfb,\r\n  0xd2, 0x8a, 0x89, 0x3e, 0x36, 0xa3, 0x41, 0x65, 0x47, 0xde, 0xbe, 0x45,\r\n  0x62, 0xb8, 0x25, 0x71, 0x33, 0x94, 0x1c, 0x70, 0xc8, 0xa6, 0xee, 0x32,\r\n  0xe6, 0xa4, 0x23, 0x8e, 0x2f, 0x16, 0xca, 0x95, 0x44, 0xe2, 0x8f, 0x3d,\r\n  0xcb, 0x28, 0x07, 0x89, 0x3a, 0xc9, 0x1c, 0x75, 0x33, 0x1e, 0x3d, 0x0f,\r\n  0xe3, 0x96, 0xe9, 0x0e, 0xb6, 0x95, 0xb8, 0xd7, 0x1f, 0xf4, 0x83, 0x2e,\r\n  0x41, 0xde, 0x16, 0x6b, 0x20, 0xf9, 0x56, 0x31, 0xd2, 0x7b, 0xcc, 0xaf,\r\n  0x1b, 0xa4, 0x89, 0x96, 0x9a, 0x7c, 0xeb, 0xc2, 0xd3, 0x10, 0x78, 0xb5,\r\n  0x9a, 0xb8, 0x3c, 0xba, 0x5a, 0x68, 0x90, 0xf4, 0xcb, 0x25, 0x8a, 0x29,\r\n  0x4d, 0x95, 0x4d, 0x1e, 0xa0, 0x5d, 0xd7, 0xa0, 0x5d, 0x22, 0x7e, 0xb2,\r\n  0x68, 0x56, 0x5f, 0xbf, 0x3d, 0xbd, 0x3c, 0x39, 0x0f, 0xc3, 0x8f, 0xd1,\r\n  0x77, 0x27, 0x97, 0x5f, 0x93, 0xd6, 0x3e, 0x3e, 0x79, 0xf3, 0xd5, 0x29,\r\n  0xc7, 0x78, 0x5e, 0xbf, 0x3e, 0x78, 0xc3, 0xec, 0x02, 0x6f, 0x80, 0x6c,\r\n  0x3c, 0x80, 0xe1, 0xc0, 0xe2, 0x88, 0xa6, 0x98, 0xf7, 0x0e, 0xe7, 0x9d,\r\n  0x0f, 0xda, 0xa1, 0x86, 0xc6, 0xf1, 0x93, 0x9a, 0xc7, 0x59, 0x7d, 0x92,\r\n  0x78, 0xc5, 0xd5, 0x32, 0x78, 0x60, 0xc7, 0x0e, 0x8e, 0x2d, 0x1b, 0x5b,\r\n  0x3c, 0xd1, 0x4d, 0x1a, 0x79, 0xe4, 0x38, 0x8a, 0x86, 0x8e, 0x30, 0xba,\r\n  0xdc, 0xdd, 0x3e, 0x7c, 0x81, 0x15, 0x75, 0x24, 0xb4, 0xb0, 0x63, 0x48,\r\n  0x67, 0xca, 0xd4, 0xae, 0x91, 0xfb, 0xb2, 0x9e, 0x73, 0x40, 0x5f, 0x44,\r\n  0x97, 0x80, 0x23, 0xc8, 0xbd, 0x47, 0x90, 0x2d, 0x4e, 0x36, 0x9a, 0x2f,\r\n  0x4e, 0xc3, 0x0b, 0xb5, 0x5e, 0x86, 0xde, 0xe0, 0x81, 0xd7, 0x79, 0xe2,\r\n  0x4f, 0xee, 0xf0, 0xcc, 0x9a, 0x31, 0xf7, 0x2f, 0xcc, 0x30, 0xb9, 0x5c,\r\n  0x86, 0x2c, 0xd7, 0x86, 0xb4, 0x24, 0x5b, 0xae, 0xe2, 0x90, 0xba, 0xcf,\r\n  0xf6, 0x45, 0xad, 0x74, 0x34, 0xcb, 0x56, 0x3c, 0x8f, 0x9a, 0xb3, 0x96,\r\n  0x15, 0x8a, 0x02, 0x3c, 0xb6, 0xa6, 0x35, 0xe9, 0x98, 0x21, 0x2d, 0xed,\r\n  0xb1, 0x5a, 0x56, 0xb6, 0xdc, 0x77, 0x67, 0xe6, 0xda, 0xb3, 0xb4, 0x36,\r\n  0x24, 0xb3, 0x32, 0xfd, 0x8e, 0x8f, 0x9c, 0xa2, 0xc8, 0x5a, 0x9e, 0x8f,\r\n  0x92, 0xf7, 0x09, 0x07, 0x39, 0xf9, 0xaf, 0x7f, 0x5f, 0x5e, 0x87, 0x19,\r\n  0x6f, 0x52, 0xf6, 0x79, 0xd9, 0xb5, 0xb2, 0xca, 0xe9, 0x2c, 0x6a, 0x91,\r\n  0x96, 0x9a, 0xab, 0xf5, 0x40, 0xeb, 0xc7, 0xed, 0xae, 0xfb, 0xa0, 0xfe,\r\n  0x7e, 0xaf, 0xfd, 0xfb, 0x3d, 0x71, 0x3b, 0x9e, 0x9c, 0xdf, 0x7d, 0xe2,\r\n  0xb8, 0x50, 0x25, 0x8f, 0x3b, 0x54, 0xdf, 0x4c, 0x29, 0xe0, 0x1d, 0xc6,\r\n  0x8f, 0xca, 0x9d, 0x13, 0x8b, 0x4c, 0x14, 0xdf, 0x3f, 0x23, 0xc8, 0x56,\r\n  0x05, 0xf2, 0x53, 0xf1, 0x08, 0xdc, 0xc4, 0x02, 0xfb, 0x05, 0xc8, 0x0e,\r\n  0x72, 0x8a, 0xaf, 0x2b, 0x6a, 0x90, 0x7e, 0xff, 0xd4, 0x61, 0xf1, 0xbd,\r\n  0x4c, 0x43, 0xb9, 0x36, 0xcd, 0x86, 0x1a, 0xa6, 0xcb, 0x3b, 0xab, 0xc1,\r\n  0x4b, 0x7f, 0xfd, 0xc4, 0x95, 0xea, 0x29, 0x6b, 0x31, 0xaa, 0x1a, 0xef,\r\n  0xb0, 0x09, 0x7f, 0x74, 0x0e, 0xb0, 0x48, 0x96, 0x0c, 0xde, 0xc8, 0x68,\r\n  0xf4, 0x2b, 0xa9, 0x03, 0xb2, 0x83, 0x22, 0xa2, 0x70, 0x30, 0xcf, 0x91,\r\n  0x19, 0x0b, 0x79, 0x14, 0x08, 0x97, 0x90, 0xf3, 0x5f, 0x57, 0xfd, 0x87,\r\n  0xbd, 0x9d, 0x9d, 0xdd, 0xfd, 0xdd, 0xcf, 0x9e, 0xef, 0xec, 0xef, 0xee,\r\n  0xee, 0xee, 0xed, 0xef, 0xee, 0xef, 0xef, 0xed, 0xfc, 0xb4, 0xcd, 0xfe,\r\n  0xa3, 0xbb, 0x34, 0xb9, 0xb7, 0xc0, 0x94, 0xe4, 0xe2, 0x61, 0x5b, 0x4b,\r\n  0x2d, 0x75, 0xb5, 0xe0, 0xd5, 0xce, 0x35, 0xcd, 0xc7, 0xb1, 0x4a, 0x08,\r\n  0x64, 0x5e, 0xc8, 0xe4, 0x96, 0x3e, 0xd3, 0x14, 0x67, 0x30, 0x20, 0xbc,\r\n  0x46, 0xaf, 0x7e, 0x5e, 0xf1, 0x48, 0x27, 0xac, 0x0e, 0x40, 0xa7, 0x29,\r\n  0x5d, 0x5e, 0xdf, 0xf5, 0x3c, 0x9f, 0x4c, 0x90, 0xb9, 0xe0, 0x52, 0x5b,\r\n  0x47, 0x11, 0xb3, 0xaa, 0xde, 0xca, 0x96, 0xd0, 0xc8, 0x01, 0x40, 0x85,\r\n  0x72, 0xd0, 0xfd, 0xec, 0x88, 0xe2, 0xa5, 0x40, 0xea, 0x69, 0xce, 0x15,\r\n  0x06, 0x66, 0x2c, 0x94, 0x68, 0x92, 0x0a, 0x97, 0xf2, 0x12, 0x5d, 0x25,\r\n  0x9f, 0xed, 0xec, 0xef, 0x73, 0x11, 0x90, 0x3f, 0xed, 0x0e, 0x14, 0x0f,\r\n  0x1a, 0x82, 0xdc, 0x07, 0xee, 0x7a, 0x92, 0x36, 0xd8, 0xfc, 0x08, 0xc7,\r\n  0x99, 0xad, 0x16, 0x49, 0xa1, 0x86, 0x08, 0x2e, 0x44, 0x21, 0xff, 0xe1,\r\n  0xcd, 0x68, 0x5d, 0x76, 0xcf, 0xa2, 0xb0, 0x0d, 0xfc, 0xf2, 0x92, 0x9a,\r\n  0xe2, 0x6f, 0x4f, 0x3d, 0xe7, 0x38, 0x2a, 0x99, 0x94, 0x0f, 0xe5, 0x87,\r\n  0xa1, 0x91, 0x83, 0xd1, 0x24, 0xbf, 0x0d, 0x95, 0x55, 0xcd, 0xc7, 0xf9,\r\n  0x21, 0xe8, 0xfc, 0xde, 0xb3, 0xdd, 0x9f, 0x04, 0x7e, 0xc8, 0x1b, 0xdc,\r\n  0xcf, 0x82, 0x16, 0x7a, 0x9b, 0x85, 0x19, 0x17, 0xb6, 0x31, 0x36, 0x93,\r\n  0xd1, 0xf5, 0xc8, 0xb4, 0x04, 0xf5, 0x1e, 0x0e, 0x42, 0x10, 0xb8, 0x30,\r\n  0x90, 0x4b, 0x59, 0x60, 0xd8, 0x5d, 0xe6, 0x20, 0x32, 0x07, 0xaf, 0x38,\r\n  0x27, 0x6b, 0x15, 0x7b, 0xe8, 0xc6, 0x38, 0xbe, 0x3c, 0xa0, 0xcb, 0xe0,\r\n  0x9b, 0xb6, 0xe1, 0xfe, 0x3a, 0x21, 0x2b, 0x9b, 0x17, 0x6f, 0x13, 0xfb,\r\n  0xfb, 0xce, 0xf1, 0xfe, 0xf2, 0xec, 0x3d, 0x8d, 0x36, 0x39, 0x06, 0xf1,\r\n  0xec, 0xb3, 0x67, 0x4f, 0xb7, 0xa4, 0xc8, 0x82, 0xbc, 0x96, 0x70, 0xbe,\r\n  0x07, 0xbc, 0x8c, 0x4a, 0x36, 0xc3, 0xee, 0x61, 0x27, 0x62, 0xde, 0x5e,\r\n  0x9c, 0xc8, 0x11, 0xbd, 0x11, 0x4e, 0x00, 0x31, 0x62, 0x9b, 0x3c, 0x71,\r\n  0xb8, 0x3f, 0x03, 0xa5, 0x61, 0x91, 0x32, 0x87, 0x21, 0x72, 0xa9, 0xf9,\r\n  0xa2, 0x73, 0xb9, 0xfc, 0xb8, 0x31, 0xe9, 0xc0, 0xe5, 0x28, 0x3d, 0xa8,\r\n  0x15, 0x9d, 0xd0, 0x19, 0x90, 0x1e, 0x32, 0xe7, 0xaa, 0xee, 0x1b, 0x67,\r\n  0x51, 0xb1, 0x5d, 0x23, 0xf2, 0x45, 0xa4, 0x79, 0x83, 0x67, 0x7b, 0x4b,\r\n  0x22, 0xf8, 0x50, 0xf2, 0x78, 0x5b, 0xd1, 0x83, 0x06, 0x05, 0xe5, 0x1e,\r\n  0xd7, 0xb2, 0xcb, 0xbc, 0xf6, 0x18, 0x70, 0x34, 0x19, 0x3d, 0x8b, 0x8a,\r\n  0x16, 0x37, 0x85, 0x12, 0x9e, 0xae, 0xe0, 0x29, 0x4c, 0x6b, 0x2e, 0x1c,\r\n  0xcd, 0x8d, 0x47, 0x8e, 0x3a, 0x20, 0xc4, 0x0b, 0xba, 0x5e, 0x8a, 0x07,\r\n  0xd5, 0x98, 0xa1, 0xf6, 0xbb, 0x4a, 0x69, 0x8d, 0x00, 0xbf, 0xb0, 0x40,\r\n  0x84, 0xc8, 0x78, 0x47, 0x82, 0x62, 0x46, 0x70, 0xad, 0x03, 0x35, 0x31,\r\n  0x3e, 0x5c, 0xd8, 0xaf, 0x02, 0xfc, 0x4b, 0x98, 0x2e, 0x66, 0x7f, 0xb7,\r\n  0xe7, 0x02, 0x68, 0x64, 0xdc, 0x1c, 0xd8, 0x9a, 0xae, 0x09, 0x57, 0x26,\r\n  0xe0, 0x50, 0xce, 0x9a, 0xd9, 0x44, 0x4f, 0xb6, 0xb7, 0xb7, 0xd6, 0xf4,\r\n  0x46, 0x7f, 0xdd, 0xf5, 0xf5, 0x73, 0x70, 0x8c, 0x04, 0x19, 0x9a, 0xb4,\r\n  0xe6, 0xf5, 0xc6, 0x79, 0x6a, 0xd3, 0x92, 0x57, 0x72, 0xa6, 0x38, 0x57,\r\n  0x71, 0x8b, 0x9a, 0xb9, 0x24, 0x9d, 0x37, 0x61, 0x54, 0x1f, 0x84, 0x42,\r\n  0x6b, 0x8c, 0xf3, 0x49, 0x6a, 0x38, 0x4b, 0xb8, 0x72, 0x14, 0x1d, 0xf0,\r\n  0x6e, 0xa8, 0x7d, 0x38, 0xe8, 0xb2, 0xf9, 0x67, 0x8d, 0xd1, 0xdc, 0x94,\r\n  0x52, 0xe7, 0x9e, 0x1b, 0x04, 0xbf, 0x34, 0xb5, 0xcd, 0x52, 0xfc, 0x9d,\r\n  0xf3, 0x76, 0x92, 0x08, 0x9d, 0x89, 0x93, 0x84, 0x01, 0x53, 0x71, 0x9a,\r\n  0xd5, 0x4a, 0x80, 0x6a, 0x23, 0x08, 0x5c, 0xbb, 0x41, 0x80, 0x04, 0xb1,\r\n  0x30, 0x72, 0xdd, 0xb0, 0x2c, 0x20, 0x18, 0x05, 0x14, 0xa4, 0x2e, 0x8a,\r\n  0xb2, 0xdb, 0xc4, 0x12, 0x3d, 0x9d, 0xc8, 0xf6, 0xaa, 0xcd, 0xc7, 0x40,\r\n  0x76, 0xbc, 0x80, 0x12, 0x04, 0x3f, 0x4b, 0x87, 0x84, 0x05, 0xc6, 0xc1,\r\n  0xc9, 0x29, 0xa3, 0xdc, 0x4e, 0xc9, 0x64, 0x1b, 0x9b, 0xea, 0x03, 0xd4,\r\n  0x27, 0xf0, 0x77, 0x59, 0xca, 0xea, 0xf7, 0xc0, 0x95, 0x12, 0xb1, 0xe4,\r\n  0x27, 0xd8, 0x21, 0x1c, 0xac, 0x13, 0x53, 0x5e, 0x39, 0xff, 0x68, 0xb5,\r\n  0x48, 0xff, 0x29, 0xc5, 0x09, 0x0b, 0x6a, 0x5d, 0x26, 0x9d, 0x47, 0x60,\r\n  0x14, 0x26, 0xb2, 0x08, 0x6a, 0x54, 0x32, 0x2a, 0x92, 0x79, 0x72, 0xa7,\r\n  0xde, 0x52, 0x21, 0x2a, 0xfd, 0x4a, 0x63, 0x92, 0x52, 0xca, 0xb4, 0xf2,\r\n  0xa1, 0xd5, 0x5a, 0xd8, 0x93, 0xbf, 0xb9, 0x2d, 0x1c, 0x2f, 0x9e, 0xba,\r\n  0x83, 0x3f, 0xef, 0xd9, 0xf5, 0x2d, 0x04, 0xcc, 0xef, 0x0d, 0xd9, 0x66,\r\n  0x55, 0xa8, 0xea, 0xdb, 0x52, 0xd9, 0x19, 0x9a, 0xd8, 0x6f, 0xf1, 0xfd,\r\n  0x59, 0x31, 0x3c, 0x71, 0xa6, 0x0f, 0x8c, 0xff, 0x58, 0x22, 0x00, 0x6c,\r\n  0xe6, 0x0c, 0xd8, 0xf1, 0x2a, 0x05, 0xd7, 0xc9, 0xc0, 0xe2, 0x4a, 0x17,\r\n  0x03, 0x49, 0x04, 0xc5, 0xde, 0xc8, 0xe7, 0xf4, 0x4f, 0xc0, 0xa3, 0x04,\r\n  0x30, 0x49, 0xcf, 0x32, 0x7f, 0x6b, 0x80, 0x50, 0xa5, 0x7f, 0x4a, 0x72,\r\n  0x83, 0xfe, 0x0b, 0x4d, 0x15, 0x2b, 0xd0, 0x04, 0x0f, 0xe4, 0x72, 0xe3,\r\n  0x20, 0x62, 0x35, 0x1d, 0xb9, 0xde, 0x6b, 0x0c, 0x5f, 0xfa, 0x7f, 0x64,\r\n  0x21, 0x66, 0x53, 0x2b, 0xf2, 0xc2, 0x66, 0x57, 0x56, 0x61, 0x22, 0xb5,\r\n  0x0b, 0xbf, 0x5c, 0x71, 0x70, 0xcb, 0x55, 0xe6, 0xe1, 0x5e, 0x2c, 0xf8,\r\n  0x2a, 0x4a, 0xa4, 0x4c, 0xa8, 0x6b, 0x9c, 0x2d, 0xb4, 0x15, 0xad, 0xae,\r\n  0xb4, 0x7e, 0x9a, 0xdf, 0x73, 0x8d, 0xd3, 0xab, 0xab, 0x74, 0xca, 0x85,\r\n  0x6b, 0x3c, 0x1d, 0x30, 0x8b, 0x78, 0x79, 0x70, 0x61, 0x65, 0x95, 0x68,\r\n  0x6c, 0xd1, 0x72, 0x35, 0x99, 0xd3, 0xdd, 0x6b, 0xe8, 0x74, 0x3a, 0x54,\r\n  0x98, 0x25, 0x32, 0x9e, 0xd0, 0x9c, 0xc4, 0xe6, 0x61, 0x3f, 0x36, 0x10,\r\n  0xd1, 0x5a, 0x8c, 0x9d, 0x35, 0xea, 0x05, 0x8a, 0xbd, 0x32, 0x6c, 0x78,\r\n  0x91, 0x67, 0x96, 0xdc, 0xb2, 0x2a, 0x85, 0x1c, 0xd2, 0x2a, 0xb7, 0x6f,\r\n  0x48, 0xa4, 0x21, 0x9d, 0x2b, 0x1b, 0xbb, 0x5a, 0xda, 0x78, 0x23, 0x1c,\r\n  0xcc, 0x6c, 0xb8, 0xbc, 0x59, 0xda, 0x4a, 0x9b, 0x7e, 0x23, 0xca, 0x8f,\r\n  0xa6, 0x53, 0xe0, 0xe4, 0x9d, 0x7f, 0x7d, 0x3e, 0x8a, 0x8e, 0xb9, 0x25,\r\n  0xe9, 0x93, 0xea, 0xad, 0x70, 0xb9, 0xd0, 0xef, 0x68, 0xb0, 0xd7, 0x7c,\r\n  0x7f, 0x9d, 0x15, 0xfc, 0x2f, 0xb4, 0xa6, 0xbf, 0x14, 0x2f, 0x2b, 0x7e,\r\n  0x5b, 0xff, 0x2a, 0x35, 0x64, 0xa0, 0xe9, 0x73, 0xfc, 0x9d, 0x8e, 0x0a,\r\n  0x69, 0x53, 0x6e, 0x99, 0xfc, 0x17, 0xf2, 0xa2, 0x46, 0xa5, 0x23, 0x6f,\r\n  0x46, 0xa4, 0x64, 0x41, 0x55, 0x5a, 0x3e, 0x60, 0xfd, 0x02, 0xd9, 0x28,\r\n  0xea, 0xa4, 0x34, 0x10, 0x6c, 0x2d, 0xdd, 0x7e, 0x0e, 0x8e, 0x27, 0xe7,\r\n  0xaa, 0x10, 0x12, 0x99, 0x22, 0x51, 0xf0, 0x62, 0xae, 0x51, 0x4f, 0x71,\r\n  0x50, 0x94, 0x49, 0xe3, 0xb8, 0x06, 0xe6, 0x98, 0xfd, 0x82, 0xad, 0x68,\r\n  0xee, 0x0b, 0x29, 0x2d, 0xb4, 0x04, 0xa3, 0x8d, 0xff, 0x17, 0xf4, 0xf2,\r\n  0x50, 0x6c, 0x66, 0x3e, 0x02, 0x00,\r\n};\r\n#define BUF_SIZE 0x10000\r\nstatic voidpf zalloc_func(voidpf opaque, unsigned int items, unsigned int size)\r\n{\r\n  (void) opaque;\r\n  /* not a typo, keep it calloc() */\r\n  return (voidpf) calloc(items, size);\r\n}\r\nstatic void zfree_func(voidpf opaque, voidpf ptr)\r\n{\r\n  (void) opaque;\r\n  free(ptr);\r\n}\r\n/* Decompress and send to stdout a gzip-compressed buffer */\r\nvoid hugehelp(void)\r\n{\r\n  unsigned char* buf;\r\n  int status,headerlen;\r\n  z_stream z;\r\n\r\n  /* Make sure no gzip options are set */\r\n  if (hugehelpgz[3] & 0xfe)\r\n    return;\r\n\r\n  headerlen = 10;\r\n  memset(&z, 0, sizeof(z_stream));\r\n  z.zalloc = (alloc_func)zalloc_func;\r\n  z.zfree = (free_func)zfree_func;\r\n  z.avail_in = (unsigned int)(sizeof(hugehelpgz) - headerlen);\r\n  z.next_in = (unsigned char *)hugehelpgz + headerlen;\r\n\r\n  if (inflateInit2(&z, -MAX_WBITS) != Z_OK)\r\n    return;\r\n\r\n  buf = malloc(BUF_SIZE);\r\n  if (buf) {\r\n    while(1) {\r\n      z.avail_out = BUF_SIZE;\r\n      z.next_out = buf;\r\n      status = inflate(&z, Z_SYNC_FLUSH);\r\n      if (status == Z_OK || status == Z_STREAM_END) {\r\n        fwrite(buf, BUF_SIZE - z.avail_out, 1, stdout);\r\n        if (status == Z_STREAM_END)\r\n          break;\r\n      }\r\n      else\r\n        break;    /* Error */\r\n    }\r\n    free(buf);\r\n  }\r\n  inflateEnd(&z);\r\n}\r\n#endif /* USE_MANUAL */\r\n#endif /* HAVE_LIBZ */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_hugehelp.h",
    "content": "#ifndef HEADER_CURL_TOOL_HUGEHELP_H\r\n#define HEADER_CURL_TOOL_HUGEHELP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nvoid hugehelp(void);\r\n\r\n#endif /* HEADER_CURL_TOOL_HUGEHELP_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_libinfo.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_libinfo.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/* global variable definitions, for libcurl run-time info */\r\n\r\ncurl_version_info_data *curlinfo = NULL;\r\nlong built_in_protos = 0;\r\n\r\n/*\r\n * libcurl_info_init: retrieves run-time information about libcurl,\r\n * setting a global pointer 'curlinfo' to libcurl's run-time info\r\n * struct, and a global bit pattern 'built_in_protos' composed of\r\n * CURLPROTO_* bits indicating which protocols are actually built\r\n * into library being used.\r\n */\r\n\r\nCURLcode get_libcurl_info(void)\r\n{\r\n  static struct proto_name_pattern {\r\n    const char *proto_name;\r\n    long        proto_pattern;\r\n  } const possibly_built_in[] = {\r\n    { \"dict\",   CURLPROTO_DICT   },\r\n    { \"file\",   CURLPROTO_FILE   },\r\n    { \"ftp\",    CURLPROTO_FTP    },\r\n    { \"ftps\",   CURLPROTO_FTPS   },\r\n    { \"gopher\", CURLPROTO_GOPHER },\r\n    { \"http\",   CURLPROTO_HTTP   },\r\n    { \"https\",  CURLPROTO_HTTPS  },\r\n    { \"imap\",   CURLPROTO_IMAP   },\r\n    { \"imaps\",  CURLPROTO_IMAPS  },\r\n    { \"ldap\",   CURLPROTO_LDAP   },\r\n    { \"ldaps\",  CURLPROTO_LDAPS  },\r\n    { \"pop3\",   CURLPROTO_POP3   },\r\n    { \"pop3s\",  CURLPROTO_POP3S  },\r\n    { \"rtmp\",   CURLPROTO_RTMP   },\r\n    { \"rtsp\",   CURLPROTO_RTSP   },\r\n    { \"scp\",    CURLPROTO_SCP    },\r\n    { \"sftp\",   CURLPROTO_SFTP   },\r\n    { \"smtp\",   CURLPROTO_SMTP   },\r\n    { \"smtps\",  CURLPROTO_SMTPS  },\r\n    { \"telnet\", CURLPROTO_TELNET },\r\n    { \"tftp\",   CURLPROTO_TFTP   },\r\n    {  NULL,    0                }\r\n  };\r\n\r\n  struct proto_name_pattern const *p;\r\n  const char *const *proto;\r\n\r\n  /* Pointer to libcurl's run-time version information */\r\n  curlinfo = curl_version_info(CURLVERSION_NOW);\r\n  if(!curlinfo)\r\n    return CURLE_FAILED_INIT;\r\n\r\n  /* Build CURLPROTO_* bit pattern with libcurl's built-in protocols */\r\n  built_in_protos = 0;\r\n  if(curlinfo->protocols) {\r\n    for(proto = curlinfo->protocols; *proto; proto++) {\r\n      for(p = possibly_built_in; p->proto_name; p++) {\r\n        if(curlx_raw_equal(*proto, p->proto_name)) {\r\n          built_in_protos |= p->proto_pattern;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_libinfo.h",
    "content": "#ifndef HEADER_CURL_TOOL_LIBINFO_H\r\n#define HEADER_CURL_TOOL_LIBINFO_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/* global variable declarations, for libcurl run-time info */\r\n\r\nextern curl_version_info_data *curlinfo;\r\nextern long built_in_protos;\r\n\r\nCURLcode get_libcurl_info(void);\r\n\r\n#endif /* HEADER_CURL_TOOL_LIBINFO_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_main.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include <sys/stat.h>\r\n\r\n#ifdef HAVE_SIGNAL_H\r\n#include <signal.h>\r\n#endif\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_convert.h\"\r\n#include \"tool_operate.h\"\r\n#include \"tool_panykey.h\"\r\n#include \"tool_vms.h\"\r\n#include \"tool_main.h\"\r\n\r\n/*\r\n * This is low-level hard-hacking memory leak tracking and similar. Using\r\n * the library level code from this client-side is ugly, but we do this\r\n * anyway for convenience.\r\n */\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef __VMS\r\n/*\r\n * vms_show is a global variable, used in main() as parameter for\r\n * function vms_special_exit() to allow proper curl tool exiting.\r\n * Its value may be set in other tool_*.c source files thanks to\r\n * forward declaration present in tool_vms.h\r\n */\r\nstatic int vms_show = 0;\r\n#endif\r\n\r\n/*\r\n * Ensure that file descriptors 0, 1 and 2 (stdin, stdout, stderr) are\r\n * open before starting to run.  Otherwise, the first three network\r\n * sockets opened by curl could be used for input sources, downloaded data\r\n * or error logs as they will effectively be stdin, stdout and/or stderr.\r\n */\r\nstatic void main_checkfds(void)\r\n{\r\n#ifdef HAVE_PIPE\r\n  int fd[2] = { STDIN_FILENO, STDIN_FILENO };\r\n  while(fd[0] == STDIN_FILENO ||\r\n        fd[0] == STDOUT_FILENO ||\r\n        fd[0] == STDERR_FILENO ||\r\n        fd[1] == STDIN_FILENO ||\r\n        fd[1] == STDOUT_FILENO ||\r\n        fd[1] == STDERR_FILENO)\r\n    if(pipe(fd) < 0)\r\n      return;   /* Out of handles. This isn't really a big problem now, but\r\n                   will be when we try to create a socket later. */\r\n  close(fd[0]);\r\n  close(fd[1]);\r\n#endif\r\n}\r\n\r\n/*\r\n** curl tool main function.\r\n*/\r\nint main(int argc, char *argv[])\r\n{\r\n  int res;\r\n  struct Configurable config;\r\n\r\n  memset(&config, 0, sizeof(struct Configurable));\r\n\r\n  config.errors = stderr; /* default errors to stderr */\r\n\r\n  main_checkfds();\r\n\r\n#if defined(HAVE_SIGNAL) && defined(SIGPIPE)\r\n  (void)signal(SIGPIPE, SIG_IGN);\r\n#endif\r\n\r\n  res = operate(&config, argc, argv);\r\n\r\n#ifdef __SYMBIAN32__\r\n  if(config.showerror)\r\n    tool_pressanykey();\r\n#endif\r\n\r\n  free_config_fields(&config);\r\n\r\n#ifdef __NOVELL_LIBC__\r\n  if(getenv(\"_IN_NETWARE_BASH_\") == NULL)\r\n    tool_pressanykey();\r\n#endif\r\n\r\n#ifdef __VMS\r\n  vms_special_exit(res, vms_show);\r\n#else\r\n  return res;\r\n#endif\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_main.h",
    "content": "#ifndef HEADER_CURL_TOOL_MAIN_H\r\n#define HEADER_CURL_TOOL_MAIN_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define DEFAULT_MAXREDIRS  50L\r\n\r\n#define RETRY_SLEEP_DEFAULT 1000L   /* ms */\r\n#define RETRY_SLEEP_MAX     600000L /* ms == 10 minutes */\r\n\r\n#ifndef STDIN_FILENO\r\n#  define STDIN_FILENO  fileno(stdin)\r\n#endif\r\n\r\n#ifndef STDOUT_FILENO\r\n#  define STDOUT_FILENO  fileno(stdout)\r\n#endif\r\n\r\n#ifndef STDERR_FILENO\r\n#  define STDERR_FILENO  fileno(stderr)\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_MAIN_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_metalink.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef USE_METALINK\r\n\r\n#include <sys/stat.h>\r\n\r\n#ifdef HAVE_FCNTL_H\r\n#  include <fcntl.h>\r\n#endif\r\n\r\n#ifdef USE_SSLEAY\r\n#  ifdef USE_OPENSSL\r\n#    include <openssl/md5.h>\r\n#    include <openssl/sha.h>\r\n#  else\r\n#    include <md5.h>\r\n#    include <sha.h>\r\n#  endif\r\n#elif defined(USE_GNUTLS_NETTLE)\r\n#  include <nettle/md5.h>\r\n#  include <nettle/sha.h>\r\n#  define MD5_CTX    struct md5_ctx\r\n#  define SHA_CTX    struct sha1_ctx\r\n#  define SHA256_CTX struct sha256_ctx\r\n#elif defined(USE_GNUTLS)\r\n#  include <gcrypt.h>\r\n#  define MD5_CTX    gcry_md_hd_t\r\n#  define SHA_CTX    gcry_md_hd_t\r\n#  define SHA256_CTX gcry_md_hd_t\r\n#elif defined(USE_NSS)\r\n#  include <nss.h>\r\n#  include <pk11pub.h>\r\n#  define MD5_CTX    void *\r\n#  define SHA_CTX    void *\r\n#  define SHA256_CTX void *\r\n#  ifdef HAVE_NSS_INITCONTEXT\r\n     static NSSInitContext *nss_context;\r\n#  endif\r\n#elif defined(__MAC_10_4) || defined(__IPHONE_5_0)\r\n/* For Apple operating systems: CommonCrypto has the functions we need.\r\n   The library's headers are even backward-compatible with OpenSSL's\r\n   headers as long as we define COMMON_DIGEST_FOR_OPENSSL first.\r\n\r\n   These functions are available on Tiger and later, as well as iOS 5.0\r\n   and later. If you're building for an older cat, well, sorry. */\r\n#  define COMMON_DIGEST_FOR_OPENSSL\r\n#  include <CommonCrypto/CommonDigest.h>\r\n#elif defined(_WIN32)\r\n/* For Windows: If no other crypto library is provided, we fallback\r\n   to the hash functions provided within the Microsoft Windows CryptoAPI */\r\n#  include <wincrypt.h>\r\n/* Custom structure in order to store the required provider and hash handle */\r\nstruct win32_crypto_hash {\r\n  HCRYPTPROV hCryptProv;\r\n  HCRYPTHASH hHash;\r\n};\r\n/* Custom Microsoft AES Cryptographic Provider defines required for MinGW */\r\n#  ifndef ALG_SID_SHA_256\r\n#    define ALG_SID_SHA_256  12\r\n#  endif\r\n#  ifndef CALG_SHA_256\r\n#    define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)\r\n#  endif\r\n#  define MD5_CTX    struct win32_crypto_hash\r\n#  define SHA_CTX    struct win32_crypto_hash\r\n#  define SHA256_CTX struct win32_crypto_hash\r\n#else\r\n#  error \"Can't compile METALINK support without a crypto library.\"\r\n#endif\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_getparam.h\"\r\n#include \"tool_paramhlp.h\"\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_metalink.h\"\r\n#include \"tool_msgs.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/* Copied from tool_getparam.c */\r\n#define GetStr(str,val) do { \\\r\n  if(*(str)) { \\\r\n    free(*(str)); \\\r\n    *(str) = NULL; \\\r\n  } \\\r\n  if((val)) \\\r\n    *(str) = strdup((val)); \\\r\n  if(!(val)) \\\r\n    return PARAM_NO_MEM; \\\r\n} WHILE_FALSE\r\n\r\n#ifdef USE_GNUTLS_NETTLE\r\n\r\nstatic int MD5_Init(MD5_CTX *ctx)\r\n{\r\n  md5_init(ctx);\r\n  return 1;\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX *ctx,\r\n                       const unsigned char *input,\r\n                       unsigned int inputLen)\r\n{\r\n  md5_update(ctx, inputLen, input);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)\r\n{\r\n  md5_digest(ctx, 16, digest);\r\n}\r\n\r\nstatic int SHA1_Init(SHA_CTX *ctx)\r\n{\r\n  sha1_init(ctx);\r\n  return 1;\r\n}\r\n\r\nstatic void SHA1_Update(SHA_CTX *ctx,\r\n                        const unsigned char *input,\r\n                        unsigned int inputLen)\r\n{\r\n  sha1_update(ctx, inputLen, input);\r\n}\r\n\r\nstatic void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)\r\n{\r\n  sha1_digest(ctx, 20, digest);\r\n}\r\n\r\nstatic int SHA256_Init(SHA256_CTX *ctx)\r\n{\r\n  sha256_init(ctx);\r\n  return 1;\r\n}\r\n\r\nstatic void SHA256_Update(SHA256_CTX *ctx,\r\n                          const unsigned char *input,\r\n                          unsigned int inputLen)\r\n{\r\n  sha256_update(ctx, inputLen, input);\r\n}\r\n\r\nstatic void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)\r\n{\r\n  sha256_digest(ctx, 32, digest);\r\n}\r\n\r\n#elif defined(USE_GNUTLS)\r\n\r\nstatic int MD5_Init(MD5_CTX *ctx)\r\n{\r\n  gcry_md_open(ctx, GCRY_MD_MD5, 0);\r\n  return 1;\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX *ctx,\r\n                       const unsigned char *input,\r\n                       unsigned int inputLen)\r\n{\r\n  gcry_md_write(*ctx, input, inputLen);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)\r\n{\r\n  memcpy(digest, gcry_md_read(*ctx, 0), 16);\r\n  gcry_md_close(*ctx);\r\n}\r\n\r\nstatic int SHA1_Init(SHA_CTX *ctx)\r\n{\r\n  gcry_md_open(ctx, GCRY_MD_SHA1, 0);\r\n  return 1;\r\n}\r\n\r\nstatic void SHA1_Update(SHA_CTX *ctx,\r\n                        const unsigned char *input,\r\n                        unsigned int inputLen)\r\n{\r\n  gcry_md_write(*ctx, input, inputLen);\r\n}\r\n\r\nstatic void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)\r\n{\r\n  memcpy(digest, gcry_md_read(*ctx, 0), 20);\r\n  gcry_md_close(*ctx);\r\n}\r\n\r\nstatic int SHA256_Init(SHA256_CTX *ctx)\r\n{\r\n  gcry_md_open(ctx, GCRY_MD_SHA256, 0);\r\n  return 1;\r\n}\r\n\r\nstatic void SHA256_Update(SHA256_CTX *ctx,\r\n                          const unsigned char *input,\r\n                          unsigned int inputLen)\r\n{\r\n  gcry_md_write(*ctx, input, inputLen);\r\n}\r\n\r\nstatic void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)\r\n{\r\n  memcpy(digest, gcry_md_read(*ctx, 0), 32);\r\n  gcry_md_close(*ctx);\r\n}\r\n\r\n#elif defined(USE_NSS)\r\n\r\nstatic int nss_hash_init(void **pctx, SECOidTag hash_alg)\r\n{\r\n  PK11Context *ctx;\r\n\r\n  /* we have to initialize NSS if not initialized alraedy */\r\n#ifdef HAVE_NSS_INITCONTEXT\r\n  if(!NSS_IsInitialized() && !nss_context) {\r\n    static NSSInitParameters params;\r\n    params.length = sizeof params;\r\n    nss_context = NSS_InitContext(\"\", \"\", \"\", \"\", &params, NSS_INIT_READONLY\r\n        | NSS_INIT_NOCERTDB   | NSS_INIT_NOMODDB       | NSS_INIT_FORCEOPEN\r\n        | NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD);\r\n  }\r\n#endif\r\n\r\n  ctx = PK11_CreateDigestContext(hash_alg);\r\n  if(!ctx)\r\n    return /* failure */ 0;\r\n\r\n  if(PK11_DigestBegin(ctx) != SECSuccess) {\r\n    PK11_DestroyContext(ctx, PR_TRUE);\r\n    return /* failure */ 0;\r\n  }\r\n\r\n  *pctx = ctx;\r\n  return /* success */ 1;\r\n}\r\n\r\nstatic void nss_hash_final(void **pctx, unsigned char *out, unsigned int len)\r\n{\r\n  PK11Context *ctx = *pctx;\r\n  unsigned int outlen;\r\n  PK11_DigestFinal(ctx, out, &outlen, len);\r\n  PK11_DestroyContext(ctx, PR_TRUE);\r\n}\r\n\r\nstatic int MD5_Init(MD5_CTX *pctx)\r\n{\r\n  return nss_hash_init(pctx, SEC_OID_MD5);\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX *pctx,\r\n                       const unsigned char *input,\r\n                       unsigned int input_len)\r\n{\r\n  PK11_DigestOp(*pctx, input, input_len);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX *pctx)\r\n{\r\n  nss_hash_final(pctx, digest, 16);\r\n}\r\n\r\nstatic int SHA1_Init(SHA_CTX *pctx)\r\n{\r\n  return nss_hash_init(pctx, SEC_OID_SHA1);\r\n}\r\n\r\nstatic void SHA1_Update(SHA_CTX *pctx,\r\n                        const unsigned char *input,\r\n                        unsigned int input_len)\r\n{\r\n  PK11_DigestOp(*pctx, input, input_len);\r\n}\r\n\r\nstatic void SHA1_Final(unsigned char digest[20], SHA_CTX *pctx)\r\n{\r\n  nss_hash_final(pctx, digest, 20);\r\n}\r\n\r\nstatic int SHA256_Init(SHA256_CTX *pctx)\r\n{\r\n  return nss_hash_init(pctx, SEC_OID_SHA256);\r\n}\r\n\r\nstatic void SHA256_Update(SHA256_CTX *pctx,\r\n                          const unsigned char *input,\r\n                          unsigned int input_len)\r\n{\r\n  PK11_DigestOp(*pctx, input, input_len);\r\n}\r\n\r\nstatic void SHA256_Final(unsigned char digest[32], SHA256_CTX *pctx)\r\n{\r\n  nss_hash_final(pctx, digest, 32);\r\n}\r\n\r\n#elif defined(_WIN32) && !defined(USE_SSLEAY)\r\n\r\nstatic void win32_crypto_final(struct win32_crypto_hash *ctx,\r\n                               unsigned char *digest,\r\n                               unsigned int digestLen)\r\n{\r\n  unsigned long length;\r\n  CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0);\r\n  if(length == digestLen)\r\n    CryptGetHashParam(ctx->hHash, HP_HASHVAL, digest, &length, 0);\r\n  if(ctx->hHash)\r\n    CryptDestroyHash(ctx->hHash);\r\n  if(ctx->hCryptProv)\r\n    CryptReleaseContext(ctx->hCryptProv, 0);\r\n}\r\n\r\nstatic int MD5_Init(MD5_CTX *ctx)\r\n{\r\n  if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,\r\n                         PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {\r\n    CryptCreateHash(ctx->hCryptProv, CALG_MD5, 0, 0, &ctx->hHash);\r\n  }\r\n  return 1;\r\n}\r\n\r\nstatic void MD5_Update(MD5_CTX *ctx,\r\n                       const unsigned char *input,\r\n                       unsigned int inputLen)\r\n{\r\n  CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);\r\n}\r\n\r\nstatic void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)\r\n{\r\n  win32_crypto_final(ctx, digest, 16);\r\n}\r\n\r\nstatic int SHA1_Init(SHA_CTX *ctx)\r\n{\r\n  if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,\r\n                         PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {\r\n    CryptCreateHash(ctx->hCryptProv, CALG_SHA1, 0, 0, &ctx->hHash);\r\n  }\r\n  return 1;\r\n}\r\n\r\nstatic void SHA1_Update(SHA_CTX *ctx,\r\n                        const unsigned char *input,\r\n                        unsigned int inputLen)\r\n{\r\n  CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);\r\n}\r\n\r\nstatic void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)\r\n{\r\n  win32_crypto_final(ctx, digest, 20);\r\n}\r\n\r\nstatic int SHA256_Init(SHA256_CTX *ctx)\r\n{\r\n  if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,\r\n                         PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {\r\n    CryptCreateHash(ctx->hCryptProv, CALG_SHA_256, 0, 0, &ctx->hHash);\r\n  }\r\n  return 1;\r\n}\r\n\r\nstatic void SHA256_Update(SHA256_CTX *ctx,\r\n                          const unsigned char *input,\r\n                          unsigned int inputLen)\r\n{\r\n  CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);\r\n}\r\n\r\nstatic void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)\r\n{\r\n  win32_crypto_final(ctx, digest, 32);\r\n}\r\n\r\n#endif /* CRYPTO LIBS */\r\n\r\nconst digest_params MD5_DIGEST_PARAMS[] = {\r\n  {\r\n    (Curl_digest_init_func) MD5_Init,\r\n    (Curl_digest_update_func) MD5_Update,\r\n    (Curl_digest_final_func) MD5_Final,\r\n    sizeof(MD5_CTX),\r\n    16\r\n  }\r\n};\r\n\r\nconst digest_params SHA1_DIGEST_PARAMS[] = {\r\n  {\r\n    (Curl_digest_init_func) SHA1_Init,\r\n    (Curl_digest_update_func) SHA1_Update,\r\n    (Curl_digest_final_func) SHA1_Final,\r\n    sizeof(SHA_CTX),\r\n    20\r\n  }\r\n};\r\n\r\nconst digest_params SHA256_DIGEST_PARAMS[] = {\r\n  {\r\n    (Curl_digest_init_func) SHA256_Init,\r\n    (Curl_digest_update_func) SHA256_Update,\r\n    (Curl_digest_final_func) SHA256_Final,\r\n    sizeof(SHA256_CTX),\r\n    32\r\n  }\r\n};\r\n\r\nstatic const metalink_digest_def SHA256_DIGEST_DEF[] = {\r\n  {\"sha-256\", SHA256_DIGEST_PARAMS}\r\n};\r\n\r\nstatic const metalink_digest_def SHA1_DIGEST_DEF[] = {\r\n  {\"sha-1\", SHA1_DIGEST_PARAMS}\r\n};\r\n\r\nstatic const metalink_digest_def MD5_DIGEST_DEF[] = {\r\n  {\"md5\", MD5_DIGEST_PARAMS}\r\n};\r\n\r\n/*\r\n * The alias of supported hash functions in the order by preference\r\n * (basically stronger hash comes first). We included \"sha-256\" and\r\n * \"sha256\". The former is the name defined in the IANA registry named\r\n * \"Hash Function Textual Names\". The latter is widely (and\r\n * historically) used in Metalink version 3.\r\n */\r\nstatic const metalink_digest_alias digest_aliases[] = {\r\n  {\"sha-256\", SHA256_DIGEST_DEF},\r\n  {\"sha256\", SHA256_DIGEST_DEF},\r\n  {\"sha-1\", SHA1_DIGEST_DEF},\r\n  {\"sha1\", SHA1_DIGEST_DEF},\r\n  {\"md5\", MD5_DIGEST_DEF},\r\n  {NULL, NULL}\r\n};\r\n\r\ndigest_context *Curl_digest_init(const digest_params *dparams)\r\n{\r\n  digest_context *ctxt;\r\n\r\n  /* Create digest context */\r\n  ctxt = malloc(sizeof *ctxt);\r\n\r\n  if(!ctxt)\r\n    return ctxt;\r\n\r\n  ctxt->digest_hashctx = malloc(dparams->digest_ctxtsize);\r\n\r\n  if(!ctxt->digest_hashctx) {\r\n    free(ctxt);\r\n    return NULL;\r\n  }\r\n\r\n  ctxt->digest_hash = dparams;\r\n\r\n  if(dparams->digest_init(ctxt->digest_hashctx) != 1) {\r\n    free(ctxt);\r\n    return NULL;\r\n  }\r\n\r\n  return ctxt;\r\n}\r\n\r\nint Curl_digest_update(digest_context *context,\r\n                       const unsigned char *data,\r\n                       unsigned int len)\r\n{\r\n  (*context->digest_hash->digest_update)(context->digest_hashctx, data, len);\r\n\r\n  return 0;\r\n}\r\n\r\nint Curl_digest_final(digest_context *context, unsigned char *result)\r\n{\r\n  (*context->digest_hash->digest_final)(result, context->digest_hashctx);\r\n\r\n  free(context->digest_hashctx);\r\n  free(context);\r\n\r\n  return 0;\r\n}\r\n\r\nstatic unsigned char hex_to_uint(const char *s)\r\n{\r\n  int v[2];\r\n  int i;\r\n  for(i = 0; i < 2; ++i) {\r\n    v[i] = Curl_raw_toupper(s[i]);\r\n    if('0' <= v[i] && v[i] <= '9') {\r\n      v[i] -= '0';\r\n    }\r\n    else if('A' <= v[i] && v[i] <= 'Z') {\r\n      v[i] -= 'A'-10;\r\n    }\r\n  }\r\n  return (unsigned char)((v[0] << 4) | v[1]);\r\n}\r\n\r\n/*\r\n * Check checksum of file denoted by filename. The expected hash value\r\n * is given in hex_hash which is hex-encoded string.\r\n *\r\n * This function returns 1 if it succeeds or one of the following\r\n * integers:\r\n *\r\n * 0:\r\n *   Checksum didn't match.\r\n * -1:\r\n *   Could not open file; or could not read data from file.\r\n * -2:\r\n *   Hash algorithm not available.\r\n */\r\nstatic int check_hash(const char *filename,\r\n                      const metalink_digest_def *digest_def,\r\n                      const unsigned char *digest, FILE *error)\r\n{\r\n  unsigned char *result;\r\n  digest_context *dctx;\r\n  int check_ok, flags, fd;\r\n\r\n  flags = O_RDONLY;\r\n#ifdef O_BINARY\r\n  /* O_BINARY is required in order to avoid binary EOF in text mode */\r\n  flags |= O_BINARY;\r\n#endif\r\n\r\n  fd = open(filename, flags);\r\n  if(fd == -1) {\r\n    fprintf(error, \"Metalink: validating (%s) [%s] FAILED (%s)\\n\", filename,\r\n            digest_def->hash_name, strerror(errno));\r\n    return -1;\r\n  }\r\n\r\n  dctx = Curl_digest_init(digest_def->dparams);\r\n  if(!dctx) {\r\n    fprintf(error, \"Metalink: validating (%s) [%s] FAILED (%s)\\n\", filename,\r\n            digest_def->hash_name, \"failed to initialize hash algorithm\");\r\n    close(fd);\r\n    return -2;\r\n  }\r\n\r\n  result = malloc(digest_def->dparams->digest_resultlen);\r\n  while(1) {\r\n    unsigned char buf[4096];\r\n    ssize_t len = read(fd, buf, sizeof(buf));\r\n    if(len == 0) {\r\n      break;\r\n    }\r\n    else if(len == -1) {\r\n      fprintf(error, \"Metalink: validating (%s) [%s] FAILED (%s)\\n\", filename,\r\n              digest_def->hash_name, strerror(errno));\r\n      Curl_digest_final(dctx, result);\r\n      close(fd);\r\n      return -1;\r\n    }\r\n    Curl_digest_update(dctx, buf, (unsigned int)len);\r\n  }\r\n  Curl_digest_final(dctx, result);\r\n  check_ok = memcmp(result, digest,\r\n                    digest_def->dparams->digest_resultlen) == 0;\r\n  /* sha*sum style verdict output */\r\n  if(check_ok)\r\n    fprintf(error, \"Metalink: validating (%s) [%s] OK\\n\", filename,\r\n            digest_def->hash_name);\r\n  else\r\n    fprintf(error, \"Metalink: validating (%s) [%s] FAILED (digest mismatch)\\n\",\r\n            filename, digest_def->hash_name);\r\n\r\n  free(result);\r\n  close(fd);\r\n  return check_ok;\r\n}\r\n\r\nint metalink_check_hash(struct Configurable *config,\r\n                        metalinkfile *mlfile,\r\n                        const char *filename)\r\n{\r\n  int rv;\r\n  fprintf(config->errors, \"Metalink: validating (%s)...\\n\", filename);\r\n  if(mlfile->checksum == NULL) {\r\n    fprintf(config->errors,\r\n            \"Metalink: validating (%s) FAILED (digest missing)\\n\",\r\n            filename);\r\n    return -2;\r\n  }\r\n  rv = check_hash(filename, mlfile->checksum->digest_def,\r\n                  mlfile->checksum->digest, config->errors);\r\n  return rv;\r\n}\r\n\r\nstatic metalink_checksum *new_metalink_checksum_from_hex_digest\r\n(const metalink_digest_def *digest_def, const char *hex_digest)\r\n{\r\n  metalink_checksum *chksum;\r\n  unsigned char *digest;\r\n  size_t i;\r\n  size_t len = strlen(hex_digest);\r\n  digest = malloc(len/2);\r\n  for(i = 0; i < len; i += 2) {\r\n    digest[i/2] = hex_to_uint(hex_digest+i);\r\n  }\r\n  chksum = malloc(sizeof(metalink_checksum));\r\n  chksum->digest_def = digest_def;\r\n  chksum->digest = digest;\r\n  return chksum;\r\n}\r\n\r\nstatic metalink_resource *new_metalink_resource(const char *url)\r\n{\r\n  metalink_resource *res;\r\n  res = malloc(sizeof(metalink_resource));\r\n  res->next = NULL;\r\n  res->url = strdup(url);\r\n  return res;\r\n}\r\n\r\n/* Returns nonzero if hex_digest is properly formatted; that is each\r\n   letter is in [0-9A-Za-z] and the length of the string equals to the\r\n   result length of digest * 2. */\r\nstatic int check_hex_digest(const char *hex_digest,\r\n                            const metalink_digest_def *digest_def)\r\n{\r\n  size_t i;\r\n  for(i = 0; hex_digest[i]; ++i) {\r\n    char c = hex_digest[i];\r\n    if(!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') ||\r\n         ('A' <= c && c <= 'Z'))) {\r\n      return 0;\r\n    }\r\n  }\r\n  return digest_def->dparams->digest_resultlen * 2 == i;\r\n}\r\n\r\nstatic metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)\r\n{\r\n  metalinkfile *f;\r\n  f = (metalinkfile*)malloc(sizeof(metalinkfile));\r\n  f->next = NULL;\r\n  f->filename = strdup(fileinfo->name);\r\n  f->checksum = NULL;\r\n  f->resource = NULL;\r\n  if(fileinfo->checksums) {\r\n    const metalink_digest_alias *digest_alias;\r\n    for(digest_alias = digest_aliases; digest_alias->alias_name;\r\n        ++digest_alias) {\r\n      metalink_checksum_t **p;\r\n      for(p = fileinfo->checksums; *p; ++p) {\r\n        if(Curl_raw_equal(digest_alias->alias_name, (*p)->type) &&\r\n           check_hex_digest((*p)->hash, digest_alias->digest_def)) {\r\n          f->checksum =\r\n            new_metalink_checksum_from_hex_digest(digest_alias->digest_def,\r\n                                                  (*p)->hash);\r\n          break;\r\n        }\r\n      }\r\n      if(f->checksum) {\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  if(fileinfo->resources) {\r\n    metalink_resource_t **p;\r\n    metalink_resource root, *tail;\r\n    root.next = NULL;\r\n    tail = &root;\r\n    for(p = fileinfo->resources; *p; ++p) {\r\n      metalink_resource *res;\r\n      /* Filter by type if it is non-NULL. In Metalink v3, type\r\n         includes the type of the resource. In curl, we are only\r\n         interested in HTTP, HTTPS and FTP. In addition to them,\r\n         Metalink v3 file may contain bittorrent type URL, which\r\n         points to the BitTorrent metainfo file. We ignore it here.\r\n         In Metalink v4, type was deprecated and all\r\n         fileinfo->resources point to the target file. BitTorrent\r\n         metainfo file URL may be appeared in fileinfo->metaurls.\r\n      */\r\n      if((*p)->type == NULL ||\r\n         Curl_raw_equal((*p)->type, \"http\") ||\r\n         Curl_raw_equal((*p)->type, \"https\") ||\r\n         Curl_raw_equal((*p)->type, \"ftp\") ||\r\n         Curl_raw_equal((*p)->type, \"ftps\")) {\r\n        res = new_metalink_resource((*p)->url);\r\n        tail->next = res;\r\n        tail = res;\r\n      }\r\n    }\r\n    f->resource = root.next;\r\n  }\r\n  return f;\r\n}\r\n\r\nint parse_metalink(struct Configurable *config, struct OutStruct *outs,\r\n                   const char *metalink_url)\r\n{\r\n  metalink_error_t r;\r\n  metalink_t* metalink;\r\n  metalink_file_t **files;\r\n  bool warnings = FALSE;\r\n\r\n  /* metlaink_parse_final deletes outs->metalink_parser */\r\n  r = metalink_parse_final(outs->metalink_parser, NULL, 0, &metalink);\r\n  outs->metalink_parser = NULL;\r\n  if(r != 0) {\r\n    return -1;\r\n  }\r\n  if(metalink->files == NULL) {\r\n    fprintf(config->errors, \"Metalink: parsing (%s) WARNING \"\r\n            \"(missing or invalid file name)\\n\",\r\n            metalink_url);\r\n    metalink_delete(metalink);\r\n    return -1;\r\n  }\r\n  for(files = metalink->files; *files; ++files) {\r\n    struct getout *url;\r\n    /* Skip an entry which has no resource. */\r\n    if(!(*files)->resources) {\r\n      fprintf(config->errors, \"Metalink: parsing (%s) WARNING \"\r\n              \"(missing or invalid resource)\\n\",\r\n              metalink_url, (*files)->name);\r\n      continue;\r\n    }\r\n    if(config->url_get ||\r\n       ((config->url_get = config->url_list) != NULL)) {\r\n      /* there's a node here, if it already is filled-in continue to\r\n         find an \"empty\" node */\r\n      while(config->url_get && (config->url_get->flags & GETOUT_URL))\r\n        config->url_get = config->url_get->next;\r\n    }\r\n\r\n    /* now there might or might not be an available node to fill in! */\r\n\r\n    if(config->url_get)\r\n      /* existing node */\r\n      url = config->url_get;\r\n    else\r\n      /* there was no free node, create one! */\r\n      url = new_getout(config);\r\n\r\n    if(url) {\r\n      metalinkfile *mlfile;\r\n      mlfile = new_metalinkfile(*files);\r\n      if(!mlfile->checksum) {\r\n        warnings = TRUE;\r\n        fprintf(config->errors, \"Metalink: parsing (%s) WARNING \"\r\n                \"(digest missing)\\n\",\r\n                metalink_url);\r\n      }\r\n      /* Set name as url */\r\n      GetStr(&url->url, mlfile->filename);\r\n\r\n      /* set flag metalink here */\r\n      url->flags |= GETOUT_URL | GETOUT_METALINK;\r\n\r\n      if(config->metalinkfile_list) {\r\n        config->metalinkfile_last->next = mlfile;\r\n        config->metalinkfile_last = mlfile;\r\n      }\r\n      else {\r\n        config->metalinkfile_list = config->metalinkfile_last = mlfile;\r\n      }\r\n    }\r\n  }\r\n  metalink_delete(metalink);\r\n  return (warnings) ? -2 : 0;\r\n}\r\n\r\nsize_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,\r\n                         void *userdata)\r\n{\r\n  struct OutStruct *outs = userdata;\r\n  struct Configurable *config = outs->config;\r\n  int rv;\r\n\r\n  /*\r\n   * Once that libcurl has called back tool_write_cb() the returned value\r\n   * is checked against the amount that was intended to be written, if\r\n   * it does not match then it fails with CURLE_WRITE_ERROR. So at this\r\n   * point returning a value different from sz*nmemb indicates failure.\r\n   */\r\n  const size_t failure = (sz * nmemb) ? 0 : 1;\r\n\r\n  if(!config)\r\n    return failure;\r\n\r\n  rv = metalink_parse_update(outs->metalink_parser, buffer, sz *nmemb);\r\n  if(rv == 0)\r\n    return sz * nmemb;\r\n  else {\r\n    fprintf(config->errors, \"Metalink: parsing FAILED\\n\");\r\n    return failure;\r\n  }\r\n}\r\n\r\n/*\r\n * Returns nonzero if content_type includes mediatype.\r\n */\r\nstatic int check_content_type(const char *content_type, const char *media_type)\r\n{\r\n  const char *ptr = content_type;\r\n  size_t media_type_len = strlen(media_type);\r\n  for(; *ptr && (*ptr == ' ' || *ptr == '\\t'); ++ptr);\r\n  if(!*ptr) {\r\n    return 0;\r\n  }\r\n  return Curl_raw_nequal(ptr, media_type, media_type_len) &&\r\n    (*(ptr+media_type_len) == '\\0' || *(ptr+media_type_len) == ' ' ||\r\n     *(ptr+media_type_len) == '\\t' || *(ptr+media_type_len) == ';');\r\n}\r\n\r\nint check_metalink_content_type(const char *content_type)\r\n{\r\n  return check_content_type(content_type, \"application/metalink+xml\");\r\n}\r\n\r\nint count_next_metalink_resource(metalinkfile *mlfile)\r\n{\r\n  int count = 0;\r\n  metalink_resource *res;\r\n  for(res = mlfile->resource; res; res = res->next, ++count);\r\n  return count;\r\n}\r\n\r\nstatic void delete_metalink_checksum(metalink_checksum *chksum)\r\n{\r\n  if(chksum == NULL) {\r\n    return;\r\n  }\r\n  Curl_safefree(chksum->digest);\r\n  Curl_safefree(chksum);\r\n}\r\n\r\nstatic void delete_metalink_resource(metalink_resource *res)\r\n{\r\n  if(res == NULL) {\r\n    return;\r\n  }\r\n  Curl_safefree(res->url);\r\n  Curl_safefree(res);\r\n}\r\n\r\nstatic void delete_metalinkfile(metalinkfile *mlfile)\r\n{\r\n  metalink_resource *res;\r\n  if(mlfile == NULL) {\r\n    return;\r\n  }\r\n  Curl_safefree(mlfile->filename);\r\n  delete_metalink_checksum(mlfile->checksum);\r\n  for(res = mlfile->resource; res;) {\r\n    metalink_resource *next;\r\n    next = res->next;\r\n    delete_metalink_resource(res);\r\n    res = next;\r\n  }\r\n  Curl_safefree(mlfile);\r\n}\r\n\r\nvoid clean_metalink(struct Configurable *config)\r\n{\r\n  while(config->metalinkfile_list) {\r\n    metalinkfile *mlfile = config->metalinkfile_list;\r\n    config->metalinkfile_list = config->metalinkfile_list->next;\r\n    delete_metalinkfile(mlfile);\r\n  }\r\n  config->metalinkfile_last = 0;\r\n}\r\n\r\nvoid metalink_cleanup(void)\r\n{\r\n#if defined(USE_NSS) && defined(HAVE_NSS_INITCONTEXT)\r\n  if(nss_context) {\r\n    NSS_ShutdownContext(nss_context);\r\n    nss_context = NULL;\r\n  }\r\n#endif\r\n}\r\n\r\n#endif /* USE_METALINK */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_metalink.h",
    "content": "#ifndef HEADER_CURL_TOOL_METALINK_H\r\n#define HEADER_CURL_TOOL_METALINK_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/* returns 1 for success, 0 otherwise (we use OpenSSL *_Init fncs directly) */\r\ntypedef int (* Curl_digest_init_func)(void *context);\r\n\r\ntypedef void (* Curl_digest_update_func)(void *context,\r\n                                         const unsigned char *data,\r\n                                         unsigned int len);\r\ntypedef void (* Curl_digest_final_func)(unsigned char *result, void *context);\r\n\r\ntypedef struct {\r\n  Curl_digest_init_func     digest_init;   /* Initialize context procedure */\r\n  Curl_digest_update_func   digest_update; /* Update context with data */\r\n  Curl_digest_final_func    digest_final;  /* Get final result procedure */\r\n  unsigned int           digest_ctxtsize;  /* Context structure size */\r\n  unsigned int           digest_resultlen; /* Result length (bytes) */\r\n} digest_params;\r\n\r\ntypedef struct {\r\n  const digest_params   *digest_hash;      /* Hash function definition */\r\n  void                  *digest_hashctx;   /* Hash function context */\r\n} digest_context;\r\n\r\ndigest_context * Curl_digest_init(const digest_params *dparams);\r\nint Curl_digest_update(digest_context *context,\r\n                       const unsigned char *data,\r\n                       unsigned int len);\r\nint Curl_digest_final(digest_context *context, unsigned char *result);\r\n\r\ntypedef struct {\r\n  const char *hash_name;\r\n  const digest_params *dparams;\r\n} metalink_digest_def;\r\n\r\ntypedef struct {\r\n  const char *alias_name;\r\n  const metalink_digest_def *digest_def;\r\n} metalink_digest_alias;\r\n\r\ntypedef struct metalink_checksum {\r\n  const metalink_digest_def *digest_def;\r\n  /* raw digest value, not ascii hex digest */\r\n  unsigned char *digest;\r\n} metalink_checksum;\r\n\r\ntypedef struct metalink_resource {\r\n  struct metalink_resource *next;\r\n  char *url;\r\n} metalink_resource;\r\n\r\ntypedef struct metalinkfile {\r\n  struct metalinkfile *next;\r\n  char *filename;\r\n  metalink_checksum *checksum;\r\n  metalink_resource *resource;\r\n} metalinkfile;\r\n\r\n#ifdef USE_METALINK\r\n\r\n/*\r\n * curl requires libmetalink 0.1.0 or newer\r\n */\r\n#define CURL_REQ_LIBMETALINK_MAJOR  0\r\n#define CURL_REQ_LIBMETALINK_MINOR  1\r\n#define CURL_REQ_LIBMETALINK_PATCH  0\r\n\r\n#define CURL_REQ_LIBMETALINK_VERS  ((CURL_REQ_LIBMETALINK_MAJOR * 10000) + \\\r\n                                    (CURL_REQ_LIBMETALINK_MINOR * 100) + \\\r\n                                     CURL_REQ_LIBMETALINK_PATCH)\r\n\r\nextern const digest_params MD5_DIGEST_PARAMS[1];\r\nextern const digest_params SHA1_DIGEST_PARAMS[1];\r\nextern const digest_params SHA256_DIGEST_PARAMS[1];\r\n\r\n#include <metalink/metalink.h>\r\n\r\n/*\r\n * Counts the resource in the metalinkfile.\r\n */\r\nint count_next_metalink_resource(metalinkfile *mlfile);\r\nvoid clean_metalink(struct Configurable *config);\r\n\r\n/*\r\n * Performs final parse operation and extracts information from\r\n * Metalink and creates metalinkfile structs.\r\n *\r\n * This function returns 0 if it succeeds without warnings, or one of\r\n * the following negative error codes:\r\n *\r\n * -1: Parsing failed; or no file is found\r\n * -2: Parsing succeeded with some warnings.\r\n */\r\nint parse_metalink(struct Configurable *config, struct OutStruct *outs,\r\n                   const char *metalink_url);\r\n\r\n/*\r\n * Callback function for CURLOPT_WRITEFUNCTION\r\n */\r\nsize_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,\r\n                         void *userdata);\r\n\r\n/*\r\n * Returns nonzero if content_type includes \"application/metalink+xml\"\r\n * media-type. The check is done in case-insensitive manner.\r\n */\r\nint check_metalink_content_type(const char *content_type);\r\n\r\n/*\r\n * Check checksum of file denoted by filename.\r\n *\r\n * This function returns 1 if the checksum matches or one of the\r\n * following integers:\r\n *\r\n * 0:\r\n *   Checksum didn't match.\r\n * -1:\r\n *   Could not open file; or could not read data from file.\r\n * -2:\r\n *   No checksum in Metalink supported, hash algorithm not available, or\r\n *   Metalink does not contain checksum.\r\n */\r\nint metalink_check_hash(struct Configurable *config,\r\n                        metalinkfile *mlfile,\r\n                        const char *filename);\r\n\r\n/*\r\n * Release resources allocated at global scope.\r\n */\r\nvoid metalink_cleanup(void);\r\n\r\n#else /* USE_METALINK */\r\n\r\n#define count_next_metalink_resource(x)  0\r\n#define clean_metalink(x)  Curl_nop_stmt\r\n\r\n#endif /* USE_METALINK */\r\n\r\n#endif /* HEADER_CURL_TOOL_METALINK_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_mfiles.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"tool_mfiles.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nstatic void AppendNode(struct multi_files **first,\r\n                       struct multi_files **last,\r\n                       struct multi_files  *new)\r\n{\r\n  DEBUGASSERT(((*first) && (*last)) || ((!*first) && (!*last)));\r\n\r\n  if(*last)\r\n    (*last)->next = new;\r\n  else\r\n    *first = new;\r\n  *last = new;\r\n}\r\n\r\n/*\r\n * AddMultiFiles: Add a new list node possibly followed with a type_name.\r\n *\r\n * multi_first argument is the address of a pointer to the first element\r\n * of the multi_files linked list. A NULL pointer indicates empty list.\r\n *\r\n * multi_last argument is the address of a pointer to the last element\r\n * of the multi_files linked list. A NULL pointer indicates empty list.\r\n *\r\n * Pointers stored in multi_first and multi_last are modified while\r\n * function is executed. An out of memory condition free's the whole\r\n * list and returns with pointers stored in multi_first and multi_last\r\n * set to NULL and a NULL function result.\r\n *\r\n * Function returns same pointer as stored at multi_last.\r\n */\r\n\r\nstruct multi_files *AddMultiFiles(const char *file_name,\r\n                                  const char *type_name,\r\n                                  const char *show_filename,\r\n                                  struct multi_files **multi_first,\r\n                                  struct multi_files **multi_last)\r\n{\r\n  struct multi_files *multi;\r\n  struct multi_files *multi_type;\r\n  struct multi_files *multi_name;\r\n\r\n  multi = calloc(1, sizeof(struct multi_files));\r\n  if(multi) {\r\n    multi->form.option = CURLFORM_FILE;\r\n    multi->form.value = file_name;\r\n    AppendNode(multi_first, multi_last, multi);\r\n  }\r\n  else {\r\n    FreeMultiInfo(multi_first, multi_last);\r\n    return NULL;\r\n  }\r\n\r\n  if(type_name) {\r\n    multi_type = calloc(1, sizeof(struct multi_files));\r\n    if(multi_type) {\r\n      multi_type->form.option = CURLFORM_CONTENTTYPE;\r\n      multi_type->form.value = type_name;\r\n      AppendNode(multi_first, multi_last, multi_type);\r\n    }\r\n    else {\r\n      FreeMultiInfo(multi_first, multi_last);\r\n      return NULL;\r\n    }\r\n  }\r\n\r\n  if(show_filename) {\r\n    multi_name = calloc(1, sizeof(struct multi_files));\r\n    if(multi_name) {\r\n      multi_name->form.option = CURLFORM_FILENAME;\r\n      multi_name->form.value = show_filename;\r\n      AppendNode(multi_first, multi_last, multi_name);\r\n    }\r\n    else {\r\n      FreeMultiInfo(multi_first, multi_last);\r\n      return NULL;\r\n    }\r\n  }\r\n\r\n  return *multi_last;\r\n}\r\n\r\n/*\r\n * FreeMultiInfo: Free the items of the list.\r\n */\r\n\r\nvoid FreeMultiInfo(struct multi_files **multi_first,\r\n                   struct multi_files **multi_last)\r\n{\r\n  struct multi_files *next;\r\n  struct multi_files *item = *multi_first;\r\n\r\n  while(item) {\r\n    next = item->next;\r\n    Curl_safefree(item);\r\n    item = next;\r\n  }\r\n  *multi_first = NULL;\r\n  if(multi_last)\r\n    *multi_last = NULL;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_mfiles.h",
    "content": "#ifndef HEADER_CURL_TOOL_MFILES_H\r\n#define HEADER_CURL_TOOL_MFILES_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/*\r\n * Structure for storing the information needed to build\r\n * a multiple files section.\r\n */\r\n\r\nstruct multi_files {\r\n  struct curl_forms   form;\r\n  struct multi_files *next;\r\n};\r\n\r\nstruct multi_files *AddMultiFiles(const char *file_name,\r\n                                  const char *type_name,\r\n                                  const char *show_filename,\r\n                                  struct multi_files **multi_first,\r\n                                  struct multi_files **multi_last);\r\n\r\nvoid FreeMultiInfo(struct multi_files **multi_first,\r\n                   struct multi_files **multi_last);\r\n\r\n#endif /* HEADER_CURL_TOOL_MFILES_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_msgs.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_msgs.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#define WARN_PREFIX \"Warning: \"\r\n#define WARN_TEXTWIDTH (79 - (int)strlen(WARN_PREFIX))\r\n\r\n/*\r\n * Emit warning formatted message on configured 'errors' stream unless\r\n * mute (--silent) was selected.\r\n */\r\n\r\nvoid warnf(struct Configurable *config, const char *fmt, ...)\r\n{\r\n  if(!config->mute) {\r\n    va_list ap;\r\n    int len;\r\n    char *ptr;\r\n    char print_buffer[256];\r\n\r\n    va_start(ap, fmt);\r\n    len = vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap);\r\n    va_end(ap);\r\n\r\n    ptr = print_buffer;\r\n    while(len > 0) {\r\n      fputs(WARN_PREFIX, config->errors);\r\n\r\n      if(len > (int)WARN_TEXTWIDTH) {\r\n        int cut = WARN_TEXTWIDTH-1;\r\n\r\n        while(!ISSPACE(ptr[cut]) && cut) {\r\n          cut--;\r\n        }\r\n        if(0 == cut)\r\n          /* not a single cutting position was found, just cut it at the\r\n             max text width then! */\r\n          cut = WARN_TEXTWIDTH-1;\r\n\r\n        (void)fwrite(ptr, cut + 1, 1, config->errors);\r\n        fputs(\"\\n\", config->errors);\r\n        ptr += cut+1; /* skip the space too */\r\n        len -= cut;\r\n      }\r\n      else {\r\n        fputs(ptr, config->errors);\r\n        len = 0;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/*\r\n * Emit help formatted message on given stream.\r\n */\r\n\r\nvoid helpf(FILE *errors, const char *fmt, ...)\r\n{\r\n  va_list ap;\r\n  if(fmt) {\r\n    va_start(ap, fmt);\r\n    fputs(\"curl: \", errors); /* prefix it */\r\n    vfprintf(errors, fmt, ap);\r\n    va_end(ap);\r\n  }\r\n  fprintf(errors, \"curl: try 'curl --help' \"\r\n#ifdef USE_MANUAL\r\n          \"or 'curl --manual' \"\r\n#endif\r\n          \"for more information\\n\");\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_msgs.h",
    "content": "#ifndef HEADER_CURL_TOOL_MSGS_H\r\n#define HEADER_CURL_TOOL_MSGS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nvoid warnf(struct Configurable *config, const char *fmt, ...);\r\n\r\nvoid helpf(FILE *errors, const char *fmt, ...);\r\n\r\n#endif /* HEADER_CURL_TOOL_MSGS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_operate.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef HAVE_FCNTL_H\r\n#  include <fcntl.h>\r\n#endif\r\n\r\n#ifdef HAVE_UTIME_H\r\n#  include <utime.h>\r\n#elif defined(HAVE_SYS_UTIME_H)\r\n#  include <sys/utime.h>\r\n#endif\r\n\r\n#ifdef HAVE_LOCALE_H\r\n#  include <locale.h>\r\n#endif\r\n\r\n#ifdef HAVE_NETINET_TCP_H\r\n#  include <netinet/tcp.h>\r\n#endif\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_binmode.h\"\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_cb_dbg.h\"\r\n#include \"tool_cb_hdr.h\"\r\n#include \"tool_cb_prg.h\"\r\n#include \"tool_cb_rea.h\"\r\n#include \"tool_cb_see.h\"\r\n#include \"tool_cb_wrt.h\"\r\n#include \"tool_dirhie.h\"\r\n#include \"tool_doswin.h\"\r\n#include \"tool_easysrc.h\"\r\n#include \"tool_getparam.h\"\r\n#include \"tool_helpers.h\"\r\n#include \"tool_homedir.h\"\r\n#include \"tool_libinfo.h\"\r\n#include \"tool_main.h\"\r\n#include \"tool_metalink.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_operate.h\"\r\n#include \"tool_operhlp.h\"\r\n#include \"tool_parsecfg.h\"\r\n#include \"tool_setopt.h\"\r\n#include \"tool_sleep.h\"\r\n#include \"tool_urlglob.h\"\r\n#include \"tool_util.h\"\r\n#include \"tool_writeenv.h\"\r\n#include \"tool_writeout.h\"\r\n#include \"tool_xattr.h\"\r\n#include \"tool_vms.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#define CURLseparator  \"--_curl_--\"\r\n\r\n#ifndef O_BINARY\r\n/* since O_BINARY as used in bitmasks, setting it to zero makes it usable in\r\n   source code but yet it doesn't ruin anything */\r\n#  define O_BINARY 0\r\n#endif\r\n\r\n#define CURL_CA_CERT_ERRORMSG1                                              \\\r\n  \"More details here: http://curl.haxx.se/docs/sslcerts.html\\n\\n\"           \\\r\n  \"curl performs SSL certificate verification by default, \"                 \\\r\n  \"using a \\\"bundle\\\"\\n\"                                                    \\\r\n  \" of Certificate Authority (CA) public keys (CA certs). If the default\\n\" \\\r\n  \" bundle file isn't adequate, you can specify an alternate file\\n\"        \\\r\n  \" using the --cacert option.\\n\"\r\n\r\n#define CURL_CA_CERT_ERRORMSG2                                              \\\r\n  \"If this HTTPS server uses a certificate signed by a CA represented in\\n\" \\\r\n  \" the bundle, the certificate verification probably failed due to a\\n\"    \\\r\n  \" problem with the certificate (it might be expired, or the name might\\n\" \\\r\n  \" not match the domain name in the URL).\\n\"                               \\\r\n  \"If you'd like to turn off curl's verification of the certificate, use\\n\" \\\r\n  \" the -k (or --insecure) option.\\n\"\r\n\r\nstatic int is_fatal_error(int code)\r\n{\r\n  switch(code) {\r\n  /* TODO: Should CURLE_SSL_CACERT be included as critical error ? */\r\n  case CURLE_FAILED_INIT:\r\n  case CURLE_OUT_OF_MEMORY:\r\n  case CURLE_UNKNOWN_OPTION:\r\n  case CURLE_FUNCTION_NOT_FOUND:\r\n  case CURLE_BAD_FUNCTION_ARGUMENT:\r\n    /* critical error */\r\n    return 1;\r\n  default:\r\n    break;\r\n  }\r\n  /* no error or not critical */\r\n  return 0;\r\n}\r\n\r\nint operate(struct Configurable *config, int argc, argv_item_t argv[])\r\n{\r\n  char errorbuffer[CURL_ERROR_SIZE];\r\n  struct ProgressData progressbar;\r\n  struct getout *urlnode;\r\n\r\n  struct HdrCbData hdrcbdata;\r\n  struct OutStruct heads;\r\n\r\n  metalinkfile *mlfile_last = NULL;\r\n\r\n  CURL *curl = NULL;\r\n  char *httpgetfields = NULL;\r\n\r\n  bool stillflags;\r\n  int res = 0;\r\n  int i;\r\n\r\n  bool orig_noprogress;\r\n  bool orig_isatty;\r\n\r\n  errorbuffer[0] = '\\0';\r\n  /* default headers output stream is stdout */\r\n  memset(&hdrcbdata, 0, sizeof(struct HdrCbData));\r\n  memset(&heads, 0, sizeof(struct OutStruct));\r\n  heads.stream = stdout;\r\n  heads.config = config;\r\n\r\n  memory_tracking_init();\r\n\r\n  /*\r\n  ** Initialize curl library - do not call any libcurl functions before\r\n  ** this point. Note that the memory_tracking_init() magic above is an\r\n  ** exception, but then that's not part of the official public API.\r\n  */\r\n  if(main_init() != CURLE_OK) {\r\n    helpf(config->errors, \"error initializing curl library\\n\");\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* Get libcurl info right away */\r\n  if(get_libcurl_info() != CURLE_OK) {\r\n    helpf(config->errors, \"error retrieving curl library information\\n\");\r\n    main_free();\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n\r\n  /* Get a curl handle to use for all forthcoming curl transfers */\r\n  curl = curl_easy_init();\r\n  if(!curl) {\r\n    helpf(config->errors, \"error initializing curl easy handle\\n\");\r\n    main_free();\r\n    return CURLE_FAILED_INIT;\r\n  }\r\n  config->easy = curl;\r\n\r\n  /*\r\n  ** Beyond this point no return'ing from this function allowed.\r\n  ** Jump to label 'quit_curl' in order to abandon this function\r\n  ** from outside of nested loops further down below.\r\n  */\r\n\r\n  /* setup proper locale from environment */\r\n#ifdef HAVE_SETLOCALE\r\n  setlocale(LC_ALL, \"\");\r\n#endif\r\n\r\n  /* inits */\r\n  config->postfieldsize = -1;\r\n  config->showerror = -1; /* will show errors */\r\n  config->use_httpget = FALSE;\r\n  config->create_dirs = FALSE;\r\n  config->maxredirs = DEFAULT_MAXREDIRS;\r\n  config->proto = CURLPROTO_ALL; /* FIXME: better to read from library */\r\n  config->proto_present = FALSE;\r\n  config->proto_redir =\r\n    CURLPROTO_ALL & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */\r\n  config->proto_redir_present = FALSE;\r\n\r\n  if((argc > 1) &&\r\n     (!curlx_strnequal(\"--\", argv[1], 2) && (argv[1][0] == '-')) &&\r\n     strchr(argv[1], 'q')) {\r\n    /*\r\n     * The first flag, that is not a verbose name, but a shortname\r\n     * and it includes the 'q' flag!\r\n     */\r\n    ;\r\n  }\r\n  else {\r\n    parseconfig(NULL, config); /* ignore possible failure */\r\n  }\r\n\r\n  if((argc < 2)  && !config->url_list) {\r\n    helpf(config->errors, NULL);\r\n    res = CURLE_FAILED_INIT;\r\n    goto quit_curl;\r\n  }\r\n\r\n  /* Parse options */\r\n  for(i = 1, stillflags = TRUE; i < argc; i++) {\r\n    if(stillflags &&\r\n       ('-' == argv[i][0])) {\r\n      char *nextarg;\r\n      bool passarg;\r\n      char *orig_opt = argv[i];\r\n\r\n      char *flag = argv[i];\r\n\r\n      if(curlx_strequal(\"--\", argv[i]))\r\n        /* this indicates the end of the flags and thus enables the\r\n           following (URL) argument to start with -. */\r\n        stillflags = FALSE;\r\n      else {\r\n        nextarg = (i < (argc-1)) ? argv[i+1] : NULL;\r\n\r\n        res = getparameter(flag, nextarg, &passarg, config);\r\n        if(res) {\r\n          int retval = CURLE_OK;\r\n          if(res != PARAM_HELP_REQUESTED) {\r\n            const char *reason = param2text(res);\r\n            helpf(config->errors, \"option %s: %s\\n\", orig_opt, reason);\r\n            retval = CURLE_FAILED_INIT;\r\n          }\r\n          res = retval;\r\n          goto quit_curl;\r\n        }\r\n\r\n        if(passarg) /* we're supposed to skip this */\r\n          i++;\r\n      }\r\n    }\r\n    else {\r\n      bool used;\r\n      /* just add the URL please */\r\n      res = getparameter((char *)\"--url\", argv[i], &used, config);\r\n      if(res)\r\n        goto quit_curl;\r\n    }\r\n  }\r\n\r\n  if((!config->url_list || !config->url_list->url) && !config->list_engines) {\r\n    helpf(config->errors, \"no URL specified!\\n\");\r\n    res = CURLE_FAILED_INIT;\r\n    goto quit_curl;\r\n  }\r\n\r\n  if(!config->useragent)\r\n    config->useragent = my_useragent();\r\n  if(!config->useragent) {\r\n    helpf(config->errors, \"out of memory\\n\");\r\n    res = CURLE_OUT_OF_MEMORY;\r\n    goto quit_curl;\r\n  }\r\n\r\n  /* On WIN32 we can't set the path to curl-ca-bundle.crt\r\n   * at compile time. So we look here for the file in two ways:\r\n   * 1: look at the environment variable CURL_CA_BUNDLE for a path\r\n   * 2: if #1 isn't found, use the windows API function SearchPath()\r\n   *    to find it along the app's path (includes app's dir and CWD)\r\n   *\r\n   * We support the environment variable thing for non-Windows platforms\r\n   * too. Just for the sake of it.\r\n   */\r\n  if(!config->cacert &&\r\n     !config->capath &&\r\n     !config->insecure_ok) {\r\n    char *env;\r\n    env = curlx_getenv(\"CURL_CA_BUNDLE\");\r\n    if(env) {\r\n      config->cacert = strdup(env);\r\n      if(!config->cacert) {\r\n        curl_free(env);\r\n        helpf(config->errors, \"out of memory\\n\");\r\n        res = CURLE_OUT_OF_MEMORY;\r\n        goto quit_curl;\r\n      }\r\n    }\r\n    else {\r\n      env = curlx_getenv(\"SSL_CERT_DIR\");\r\n      if(env) {\r\n        config->capath = strdup(env);\r\n        if(!config->capath) {\r\n          curl_free(env);\r\n          helpf(config->errors, \"out of memory\\n\");\r\n          res = CURLE_OUT_OF_MEMORY;\r\n          goto quit_curl;\r\n        }\r\n      }\r\n      else {\r\n        env = curlx_getenv(\"SSL_CERT_FILE\");\r\n        if(env) {\r\n          config->cacert = strdup(env);\r\n          if(!config->cacert) {\r\n            curl_free(env);\r\n            helpf(config->errors, \"out of memory\\n\");\r\n            res = CURLE_OUT_OF_MEMORY;\r\n            goto quit_curl;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    if(env)\r\n      curl_free(env);\r\n#ifdef WIN32\r\n    else {\r\n      res = FindWin32CACert(config, \"curl-ca-bundle.crt\");\r\n      if(res)\r\n        goto quit_curl;\r\n    }\r\n#endif\r\n  }\r\n\r\n  if(config->postfields) {\r\n    if(config->use_httpget) {\r\n      /* Use the postfields data for a http get */\r\n      httpgetfields = strdup(config->postfields);\r\n      Curl_safefree(config->postfields);\r\n      if(!httpgetfields) {\r\n        helpf(config->errors, \"out of memory\\n\");\r\n        res = CURLE_OUT_OF_MEMORY;\r\n        goto quit_curl;\r\n      }\r\n      if(SetHTTPrequest(config,\r\n                        (config->no_body?HTTPREQ_HEAD:HTTPREQ_GET),\r\n                        &config->httpreq)) {\r\n        res = PARAM_BAD_USE;\r\n        goto quit_curl;\r\n      }\r\n    }\r\n    else {\r\n      if(SetHTTPrequest(config, HTTPREQ_SIMPLEPOST, &config->httpreq)) {\r\n        res = PARAM_BAD_USE;\r\n        goto quit_curl;\r\n      }\r\n    }\r\n  }\r\n\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n  res = easysrc_init();\r\n  if(res) {\r\n    helpf(config->errors, \"out of memory\\n\");\r\n    goto quit_curl;\r\n  }\r\n#endif\r\n\r\n  if(config->list_engines) {\r\n    struct curl_slist *engines = NULL;\r\n    curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines);\r\n    list_engines(engines);\r\n    curl_slist_free_all(engines);\r\n    res = CURLE_OK;\r\n    goto quit_curl;\r\n  }\r\n\r\n  /* Single header file for all URLs */\r\n  if(config->headerfile) {\r\n    /* open file for output: */\r\n    if(!curlx_strequal(config->headerfile, \"-\")) {\r\n      FILE *newfile = fopen(config->headerfile, \"wb\");\r\n      if(!newfile) {\r\n        warnf(config, \"Failed to open %s\\n\", config->headerfile);\r\n        res = CURLE_WRITE_ERROR;\r\n        goto quit_curl;\r\n      }\r\n      else {\r\n        heads.filename = config->headerfile;\r\n        heads.s_isreg = TRUE;\r\n        heads.fopened = TRUE;\r\n        heads.stream = newfile;\r\n      }\r\n    }\r\n  }\r\n\r\n  /* save the values of noprogress and isatty to restore them later on */\r\n  orig_noprogress = config->noprogress;\r\n  orig_isatty = config->isatty;\r\n\r\n  /*\r\n  ** Nested loops start here.\r\n  */\r\n\r\n  /* loop through the list of given URLs */\r\n\r\n  for(urlnode = config->url_list; urlnode; urlnode = urlnode->next) {\r\n\r\n    int up; /* upload file counter within a single upload glob */\r\n    char *infiles; /* might be a glob pattern */\r\n    char *outfiles;\r\n    int infilenum;\r\n    URLGlob *inglob;\r\n\r\n    int metalink = 0; /* nonzero for metalink download. */\r\n    metalinkfile *mlfile;\r\n    metalink_resource *mlres;\r\n\r\n    outfiles = NULL;\r\n    infilenum = 1;\r\n    inglob = NULL;\r\n\r\n    if(urlnode->flags & GETOUT_METALINK) {\r\n      metalink = 1;\r\n      if(mlfile_last == NULL) {\r\n        mlfile_last = config->metalinkfile_list;\r\n      }\r\n      mlfile = mlfile_last;\r\n      mlfile_last = mlfile_last->next;\r\n      mlres = mlfile->resource;\r\n    }\r\n    else {\r\n      mlfile = NULL;\r\n      mlres = NULL;\r\n    }\r\n\r\n    /* urlnode->url is the full URL (it might be NULL) */\r\n\r\n    if(!urlnode->url) {\r\n      /* This node has no URL. Free node data without destroying the\r\n         node itself nor modifying next pointer and continue to next */\r\n      Curl_safefree(urlnode->outfile);\r\n      Curl_safefree(urlnode->infile);\r\n      urlnode->flags = 0;\r\n      continue; /* next URL please */\r\n    }\r\n\r\n    /* save outfile pattern before expansion */\r\n    if(urlnode->outfile) {\r\n      outfiles = strdup(urlnode->outfile);\r\n      if(!outfiles) {\r\n        helpf(config->errors, \"out of memory\\n\");\r\n        res = CURLE_OUT_OF_MEMORY;\r\n        break;\r\n      }\r\n    }\r\n\r\n    infiles = urlnode->infile;\r\n\r\n    if(!config->globoff && infiles) {\r\n      /* Unless explicitly shut off */\r\n      res = glob_url(&inglob, infiles, &infilenum,\r\n                     config->showerror?config->errors:NULL);\r\n      if(res) {\r\n        Curl_safefree(outfiles);\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* Here's the loop for uploading multiple files within the same\r\n       single globbed string. If no upload, we enter the loop once anyway. */\r\n    for(up = 0 ; up < infilenum; up++) {\r\n\r\n      char *uploadfile; /* a single file, never a glob */\r\n      int separator;\r\n      URLGlob *urls;\r\n      int urlnum;\r\n\r\n      uploadfile = NULL;\r\n      urls = NULL;\r\n      urlnum = 0;\r\n\r\n      if(!up && !infiles)\r\n        Curl_nop_stmt;\r\n      else {\r\n        if(inglob) {\r\n          res = glob_next_url(&uploadfile, inglob);\r\n          if(res == CURLE_OUT_OF_MEMORY)\r\n            helpf(config->errors, \"out of memory\\n\");\r\n        }\r\n        else if(!up) {\r\n          uploadfile = strdup(infiles);\r\n          if(!uploadfile) {\r\n            helpf(config->errors, \"out of memory\\n\");\r\n            res = CURLE_OUT_OF_MEMORY;\r\n          }\r\n        }\r\n        else\r\n          uploadfile = NULL;\r\n        if(!uploadfile)\r\n          break;\r\n      }\r\n\r\n      if(metalink) {\r\n        /* For Metalink download, we don't use glob. Instead we use\r\n           the number of resources as urlnum. */\r\n        urlnum = count_next_metalink_resource(mlfile);\r\n      }\r\n      else\r\n      if(!config->globoff) {\r\n        /* Unless explicitly shut off, we expand '{...}' and '[...]'\r\n           expressions and return total number of URLs in pattern set */\r\n        res = glob_url(&urls, urlnode->url, &urlnum,\r\n                       config->showerror?config->errors:NULL);\r\n        if(res) {\r\n          Curl_safefree(uploadfile);\r\n          break;\r\n        }\r\n      }\r\n      else\r\n        urlnum = 1; /* without globbing, this is a single URL */\r\n\r\n      /* if multiple files extracted to stdout, insert separators! */\r\n      separator= ((!outfiles || curlx_strequal(outfiles, \"-\")) && urlnum > 1);\r\n\r\n      /* Here's looping around each globbed URL */\r\n      for(i = 0 ; i < urlnum; i++) {\r\n\r\n        int infd;\r\n        bool infdopen;\r\n        char *outfile;\r\n        struct OutStruct outs;\r\n        struct InStruct input;\r\n        struct timeval retrystart;\r\n        curl_off_t uploadfilesize;\r\n        long retry_numretries;\r\n        long retry_sleep_default;\r\n        long retry_sleep;\r\n        char *this_url;\r\n        int metalink_next_res = 0;\r\n\r\n        outfile = NULL;\r\n        infdopen = FALSE;\r\n        infd = STDIN_FILENO;\r\n        uploadfilesize = -1; /* -1 means unknown */\r\n\r\n        /* default output stream is stdout */\r\n        memset(&outs, 0, sizeof(struct OutStruct));\r\n        outs.stream = stdout;\r\n        outs.config = config;\r\n\r\n        if(metalink) {\r\n          /* For Metalink download, use name in Metalink file as\r\n             filename. */\r\n          outfile = strdup(mlfile->filename);\r\n          if(!outfile) {\r\n            res = CURLE_OUT_OF_MEMORY;\r\n            goto show_error;\r\n          }\r\n          this_url = strdup(mlres->url);\r\n          if(!this_url) {\r\n            res = CURLE_OUT_OF_MEMORY;\r\n            goto show_error;\r\n          }\r\n        }\r\n        else {\r\n          if(urls) {\r\n            res = glob_next_url(&this_url, urls);\r\n            if(res)\r\n              goto show_error;\r\n          }\r\n          else if(!i) {\r\n            this_url = strdup(urlnode->url);\r\n            if(!this_url) {\r\n              res = CURLE_OUT_OF_MEMORY;\r\n              goto show_error;\r\n            }\r\n          }\r\n          else\r\n            this_url = NULL;\r\n          if(!this_url)\r\n            break;\r\n\r\n          if(outfiles) {\r\n            outfile = strdup(outfiles);\r\n            if(!outfile) {\r\n              res = CURLE_OUT_OF_MEMORY;\r\n              goto show_error;\r\n            }\r\n          }\r\n        }\r\n\r\n        if(((urlnode->flags&GETOUT_USEREMOTE) ||\r\n            (outfile && !curlx_strequal(\"-\", outfile))) &&\r\n           (metalink || !config->use_metalink)) {\r\n\r\n          /*\r\n           * We have specified a file name to store the result in, or we have\r\n           * decided we want to use the remote file name.\r\n           */\r\n\r\n          if(!outfile) {\r\n            /* extract the file name from the URL */\r\n            res = get_url_file_name(&outfile, this_url);\r\n            if(res)\r\n              goto show_error;\r\n            if((!outfile || !*outfile) && !config->content_disposition) {\r\n              helpf(config->errors, \"Remote file name has no length!\\n\");\r\n              res = CURLE_WRITE_ERROR;\r\n              goto quit_urls;\r\n            }\r\n#if defined(MSDOS) || defined(WIN32)\r\n            /* For DOS and WIN32, we do some major replacing of\r\n               bad characters in the file name before using it */\r\n            outfile = sanitize_dos_name(outfile);\r\n            if(!outfile) {\r\n              res = CURLE_OUT_OF_MEMORY;\r\n              goto show_error;\r\n            }\r\n#endif /* MSDOS || WIN32 */\r\n          }\r\n          else if(urls) {\r\n            /* fill '#1' ... '#9' terms from URL pattern */\r\n            char *storefile = outfile;\r\n            res = glob_match_url(&outfile, storefile, urls);\r\n            Curl_safefree(storefile);\r\n            if(res) {\r\n              /* bad globbing */\r\n              warnf(config, \"bad output glob!\\n\");\r\n              goto quit_urls;\r\n            }\r\n          }\r\n\r\n          /* Create the directory hierarchy, if not pre-existent to a multiple\r\n             file output call */\r\n\r\n          if(config->create_dirs || metalink) {\r\n            res = create_dir_hierarchy(outfile, config->errors);\r\n            /* create_dir_hierarchy shows error upon CURLE_WRITE_ERROR */\r\n            if(res == CURLE_WRITE_ERROR)\r\n              goto quit_urls;\r\n            if(res) {\r\n              goto show_error;\r\n            }\r\n          }\r\n\r\n          if((urlnode->flags & GETOUT_USEREMOTE)\r\n             && config->content_disposition) {\r\n            /* Our header callback MIGHT set the filename */\r\n            DEBUGASSERT(!outs.filename);\r\n          }\r\n\r\n          if(config->resume_from_current) {\r\n            /* We're told to continue from where we are now. Get the size\r\n               of the file as it is now and open it for append instead */\r\n            struct_stat fileinfo;\r\n            /* VMS -- Danger, the filesize is only valid for stream files */\r\n            if(0 == stat(outfile, &fileinfo))\r\n              /* set offset to current file size: */\r\n              config->resume_from = fileinfo.st_size;\r\n            else\r\n              /* let offset be 0 */\r\n              config->resume_from = 0;\r\n          }\r\n\r\n          if(config->resume_from) {\r\n            /* open file for output: */\r\n            FILE *file = fopen(outfile, config->resume_from?\"ab\":\"wb\");\r\n            if(!file) {\r\n              helpf(config->errors, \"Can't open '%s'!\\n\", outfile);\r\n              res = CURLE_WRITE_ERROR;\r\n              goto quit_urls;\r\n            }\r\n            outs.fopened = TRUE;\r\n            outs.stream = file;\r\n            outs.init = config->resume_from;\r\n          }\r\n          else {\r\n            outs.stream = NULL; /* open when needed */\r\n          }\r\n          outs.filename = outfile;\r\n          outs.s_isreg = TRUE;\r\n        }\r\n\r\n        if(uploadfile && !stdin_upload(uploadfile)) {\r\n          /*\r\n           * We have specified a file to upload and it isn't \"-\".\r\n           */\r\n          struct_stat fileinfo;\r\n\r\n          this_url = add_file_name_to_url(curl, this_url, uploadfile);\r\n          if(!this_url) {\r\n            res = CURLE_OUT_OF_MEMORY;\r\n            goto show_error;\r\n          }\r\n          /* VMS Note:\r\n           *\r\n           * Reading binary from files can be a problem...  Only FIXED, VAR\r\n           * etc WITHOUT implied CC will work Others need a \\n appended to a\r\n           * line\r\n           *\r\n           * - Stat gives a size but this is UNRELIABLE in VMS As a f.e. a\r\n           * fixed file with implied CC needs to have a byte added for every\r\n           * record processed, this can by derived from Filesize & recordsize\r\n           * for VARiable record files the records need to be counted!  for\r\n           * every record add 1 for linefeed and subtract 2 for the record\r\n           * header for VARIABLE header files only the bare record data needs\r\n           * to be considered with one appended if implied CC\r\n           */\r\n\r\n          infd = open(uploadfile, O_RDONLY | O_BINARY);\r\n          if((infd == -1) || fstat(infd, &fileinfo)) {\r\n            helpf(config->errors, \"Can't open '%s'!\\n\", uploadfile);\r\n            if(infd != -1) {\r\n              close(infd);\r\n              infd = STDIN_FILENO;\r\n            }\r\n            res = CURLE_READ_ERROR;\r\n            goto quit_urls;\r\n          }\r\n          infdopen = TRUE;\r\n\r\n          /* we ignore file size for char/block devices, sockets, etc. */\r\n          if(S_ISREG(fileinfo.st_mode))\r\n            uploadfilesize = fileinfo.st_size;\r\n\r\n        }\r\n        else if(uploadfile && stdin_upload(uploadfile)) {\r\n          /* count to see if there are more than one auth bit set\r\n             in the authtype field */\r\n          int authbits = 0;\r\n          int bitcheck = 0;\r\n          while(bitcheck < 32) {\r\n            if(config->authtype & (1UL << bitcheck++)) {\r\n              authbits++;\r\n              if(authbits > 1) {\r\n                /* more than one, we're done! */\r\n                break;\r\n              }\r\n            }\r\n          }\r\n\r\n          /*\r\n           * If the user has also selected --anyauth or --proxy-anyauth\r\n           * we should warn him/her.\r\n           */\r\n          if(config->proxyanyauth || (authbits>1)) {\r\n            warnf(config,\r\n                  \"Using --anyauth or --proxy-anyauth with upload from stdin\"\r\n                  \" involves a big risk of it not working. Use a temporary\"\r\n                  \" file or a fixed auth type instead!\\n\");\r\n          }\r\n\r\n          DEBUGASSERT(infdopen == FALSE);\r\n          DEBUGASSERT(infd == STDIN_FILENO);\r\n\r\n          set_binmode(stdin);\r\n          if(curlx_strequal(uploadfile, \".\")) {\r\n            if(curlx_nonblock((curl_socket_t)infd, TRUE) < 0)\r\n              warnf(config,\r\n                    \"fcntl failed on fd=%d: %s\\n\", infd, strerror(errno));\r\n          }\r\n        }\r\n\r\n        if(uploadfile && config->resume_from_current)\r\n          config->resume_from = -1; /* -1 will then force get-it-yourself */\r\n\r\n        if(output_expected(this_url, uploadfile)\r\n           && outs.stream && isatty(fileno(outs.stream)))\r\n          /* we send the output to a tty, therefore we switch off the progress\r\n             meter */\r\n          config->noprogress = config->isatty = TRUE;\r\n        else {\r\n          /* progress meter is per download, so restore config\r\n             values */\r\n          config->noprogress = orig_noprogress;\r\n          config->isatty = orig_isatty;\r\n        }\r\n\r\n        if(urlnum > 1 && !(config->mute)) {\r\n          fprintf(config->errors, \"\\n[%d/%d]: %s --> %s\\n\",\r\n                  i+1, urlnum, this_url, outfile ? outfile : \"<stdout>\");\r\n          if(separator)\r\n            printf(\"%s%s\\n\", CURLseparator, this_url);\r\n        }\r\n        if(httpgetfields) {\r\n          char *urlbuffer;\r\n          /* Find out whether the url contains a file name */\r\n          const char *pc = strstr(this_url, \"://\");\r\n          char sep = '?';\r\n          if(pc)\r\n            pc += 3;\r\n          else\r\n            pc = this_url;\r\n\r\n          pc = strrchr(pc, '/'); /* check for a slash */\r\n\r\n          if(pc) {\r\n            /* there is a slash present in the URL */\r\n\r\n            if(strchr(pc, '?'))\r\n              /* Ouch, there's already a question mark in the URL string, we\r\n                 then append the data with an ampersand separator instead! */\r\n              sep='&';\r\n          }\r\n          /*\r\n           * Then append ? followed by the get fields to the url.\r\n           */\r\n          urlbuffer = malloc(strlen(this_url) + strlen(httpgetfields) + 3);\r\n          if(!urlbuffer) {\r\n            res = CURLE_OUT_OF_MEMORY;\r\n            goto show_error;\r\n          }\r\n          if(pc)\r\n            sprintf(urlbuffer, \"%s%c%s\", this_url, sep, httpgetfields);\r\n          else\r\n            /* Append  / before the ? to create a well-formed url\r\n               if the url contains a hostname only\r\n            */\r\n            sprintf(urlbuffer, \"%s/?%s\", this_url, httpgetfields);\r\n\r\n          Curl_safefree(this_url); /* free previous URL */\r\n          this_url = urlbuffer; /* use our new URL instead! */\r\n        }\r\n\r\n        if(!config->errors)\r\n          config->errors = stderr;\r\n\r\n        if((!outfile || !strcmp(outfile, \"-\")) && !config->use_ascii) {\r\n          /* We get the output to stdout and we have not got the ASCII/text\r\n             flag, then set stdout to be binary */\r\n          set_binmode(stdout);\r\n        }\r\n\r\n        if(config->tcp_nodelay)\r\n          my_setopt(curl, CURLOPT_TCP_NODELAY, 1);\r\n\r\n        /* where to store */\r\n        my_setopt(curl, CURLOPT_WRITEDATA, &outs);\r\n        if(metalink || !config->use_metalink)\r\n          /* what call to write */\r\n          my_setopt(curl, CURLOPT_WRITEFUNCTION, tool_write_cb);\r\n#ifdef USE_METALINK\r\n        else\r\n          /* Set Metalink specific write callback function to parse\r\n             XML data progressively. */\r\n          my_setopt(curl, CURLOPT_WRITEFUNCTION, metalink_write_cb);\r\n#endif /* USE_METALINK */\r\n\r\n        /* for uploads */\r\n        input.fd = infd;\r\n        input.config = config;\r\n        /* Note that if CURLOPT_READFUNCTION is fread (the default), then\r\n         * lib/telnet.c will Curl_poll() on the input file descriptor\r\n         * rather then calling the READFUNCTION at regular intervals.\r\n         * The circumstances in which it is preferable to enable this\r\n         * behaviour, by omitting to set the READFUNCTION & READDATA options,\r\n         * have not been determined.\r\n         */\r\n        my_setopt(curl, CURLOPT_READDATA, &input);\r\n        /* what call to read */\r\n        my_setopt(curl, CURLOPT_READFUNCTION, tool_read_cb);\r\n\r\n        /* in 7.18.0, the CURLOPT_SEEKFUNCTION/DATA pair is taking over what\r\n           CURLOPT_IOCTLFUNCTION/DATA pair previously provided for seeking */\r\n        my_setopt(curl, CURLOPT_SEEKDATA, &input);\r\n        my_setopt(curl, CURLOPT_SEEKFUNCTION, tool_seek_cb);\r\n\r\n        if(config->recvpersecond)\r\n          /* tell libcurl to use a smaller sized buffer as it allows us to\r\n             make better sleeps! 7.9.9 stuff! */\r\n          my_setopt(curl, CURLOPT_BUFFERSIZE, config->recvpersecond);\r\n\r\n        /* size of uploaded file: */\r\n        if(uploadfilesize != -1)\r\n          my_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize);\r\n        my_setopt_str(curl, CURLOPT_URL, this_url);     /* what to fetch */\r\n        my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress);\r\n        if(config->no_body) {\r\n          my_setopt(curl, CURLOPT_NOBODY, 1);\r\n          my_setopt(curl, CURLOPT_HEADER, 1);\r\n        }\r\n        /* If --metalink is used, we ignore --include (headers in\r\n           output) option because mixing headers to the body will\r\n           confuse XML parser and/or hash check will fail. */\r\n        else if(!config->use_metalink)\r\n          my_setopt(curl, CURLOPT_HEADER, config->include_headers);\r\n\r\n#if !defined(CURL_DISABLE_PROXY)\r\n        {\r\n          /* TODO: Make this a run-time check instead of compile-time one. */\r\n\r\n          my_setopt_str(curl, CURLOPT_PROXY, config->proxy);\r\n          my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);\r\n\r\n          /* new in libcurl 7.3 */\r\n          my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel);\r\n\r\n          /* new in libcurl 7.5 */\r\n          if(config->proxy)\r\n            my_setopt_enum(curl, CURLOPT_PROXYTYPE, config->proxyver);\r\n\r\n          /* new in libcurl 7.10 */\r\n          if(config->socksproxy) {\r\n            my_setopt_str(curl, CURLOPT_PROXY, config->socksproxy);\r\n            my_setopt_enum(curl, CURLOPT_PROXYTYPE, config->socksver);\r\n          }\r\n\r\n          /* new in libcurl 7.10.6 */\r\n          if(config->proxyanyauth)\r\n            my_setopt_bitmask(curl, CURLOPT_PROXYAUTH,\r\n                              (long) CURLAUTH_ANY);\r\n          else if(config->proxynegotiate)\r\n            my_setopt_bitmask(curl, CURLOPT_PROXYAUTH,\r\n                              (long) CURLAUTH_GSSNEGOTIATE);\r\n          else if(config->proxyntlm)\r\n            my_setopt_bitmask(curl, CURLOPT_PROXYAUTH,\r\n                              (long) CURLAUTH_NTLM);\r\n          else if(config->proxydigest)\r\n            my_setopt_bitmask(curl, CURLOPT_PROXYAUTH,\r\n                              (long) CURLAUTH_DIGEST);\r\n          else if(config->proxybasic)\r\n            my_setopt_bitmask(curl, CURLOPT_PROXYAUTH,\r\n                              (long) CURLAUTH_BASIC);\r\n\r\n          /* new in libcurl 7.19.4 */\r\n          my_setopt(curl, CURLOPT_NOPROXY, config->noproxy);\r\n        }\r\n#endif\r\n\r\n        my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror);\r\n        my_setopt(curl, CURLOPT_UPLOAD, uploadfile?TRUE:FALSE);\r\n        my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly);\r\n        my_setopt(curl, CURLOPT_APPEND, config->ftp_append);\r\n\r\n        if(config->netrc_opt)\r\n          my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);\r\n        else if(config->netrc || config->netrc_file)\r\n          my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_REQUIRED);\r\n        else\r\n          my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_IGNORED);\r\n\r\n        if(config->netrc_file)\r\n          my_setopt(curl, CURLOPT_NETRC_FILE, config->netrc_file);\r\n\r\n        my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii);\r\n        my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd);\r\n        my_setopt_str(curl, CURLOPT_RANGE, config->range);\r\n        my_setopt(curl, CURLOPT_ERRORBUFFER, errorbuffer);\r\n        my_setopt(curl, CURLOPT_TIMEOUT, config->timeout);\r\n\r\n        if(built_in_protos & CURLPROTO_HTTP) {\r\n\r\n          long postRedir = 0;\r\n\r\n          my_setopt(curl, CURLOPT_FOLLOWLOCATION,\r\n                    config->followlocation);\r\n          my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH,\r\n                    config->unrestricted_auth);\r\n\r\n          switch(config->httpreq) {\r\n          case HTTPREQ_SIMPLEPOST:\r\n            my_setopt_str(curl, CURLOPT_POSTFIELDS,\r\n                          config->postfields);\r\n            my_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE,\r\n                      config->postfieldsize);\r\n            break;\r\n          case HTTPREQ_POST:\r\n            my_setopt_httppost(curl, CURLOPT_HTTPPOST, config->httppost);\r\n            break;\r\n          default:\r\n            break;\r\n          }\r\n\r\n          my_setopt_str(curl, CURLOPT_REFERER, config->referer);\r\n          my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer);\r\n          my_setopt_str(curl, CURLOPT_USERAGENT, config->useragent);\r\n          my_setopt_slist(curl, CURLOPT_HTTPHEADER, config->headers);\r\n\r\n          /* new in libcurl 7.5 */\r\n          my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs);\r\n\r\n          /* new in libcurl 7.9.1 */\r\n          if(config->httpversion)\r\n            my_setopt_enum(curl, CURLOPT_HTTP_VERSION, config->httpversion);\r\n\r\n          /* new in libcurl 7.10.6 (default is Basic) */\r\n          if(config->authtype)\r\n            my_setopt_bitmask(curl, CURLOPT_HTTPAUTH, (long) config->authtype);\r\n\r\n          /* curl 7.19.1 (the 301 version existed in 7.18.2),\r\n             303 was added in 7.26.0 */\r\n          if(config->post301)\r\n            postRedir |= CURL_REDIR_POST_301;\r\n          if(config->post302)\r\n            postRedir |= CURL_REDIR_POST_302;\r\n          if(config->post303)\r\n            postRedir |= CURL_REDIR_POST_303;\r\n          my_setopt(curl, CURLOPT_POSTREDIR, postRedir);\r\n\r\n          /* new in libcurl 7.21.6 */\r\n          if(config->encoding)\r\n            my_setopt_str(curl, CURLOPT_ACCEPT_ENCODING, \"\");\r\n\r\n          /* new in libcurl 7.21.6 */\r\n          if(config->tr_encoding)\r\n            my_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1);\r\n\r\n        } /* (built_in_protos & CURLPROTO_HTTP) */\r\n\r\n        my_setopt_str(curl, CURLOPT_FTPPORT, config->ftpport);\r\n        my_setopt(curl, CURLOPT_LOW_SPEED_LIMIT,\r\n                  config->low_speed_limit);\r\n        my_setopt(curl, CURLOPT_LOW_SPEED_TIME, config->low_speed_time);\r\n        my_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE,\r\n                  config->sendpersecond);\r\n        my_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE,\r\n                  config->recvpersecond);\r\n        my_setopt(curl, CURLOPT_RESUME_FROM_LARGE,\r\n                  config->use_resume?config->resume_from:0);\r\n\r\n        my_setopt(curl, CURLOPT_SSLCERT, config->cert);\r\n        my_setopt_str(curl, CURLOPT_SSLCERTTYPE, config->cert_type);\r\n        my_setopt(curl, CURLOPT_SSLKEY, config->key);\r\n        my_setopt_str(curl, CURLOPT_SSLKEYTYPE, config->key_type);\r\n        my_setopt_str(curl, CURLOPT_KEYPASSWD, config->key_passwd);\r\n\r\n        if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) {\r\n\r\n          /* SSH and SSL private key uses same command-line option */\r\n          /* new in libcurl 7.16.1 */\r\n          my_setopt_str(curl, CURLOPT_SSH_PRIVATE_KEYFILE, config->key);\r\n          /* new in libcurl 7.16.1 */\r\n          my_setopt_str(curl, CURLOPT_SSH_PUBLIC_KEYFILE, config->pubkey);\r\n\r\n          /* new in libcurl 7.17.1: SSH host key md5 checking allows us\r\n             to fail if we are not talking to who we think we should */\r\n          my_setopt_str(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,\r\n                        config->hostpubmd5);\r\n        }\r\n\r\n        if(config->cacert)\r\n          my_setopt_str(curl, CURLOPT_CAINFO, config->cacert);\r\n        if(config->capath)\r\n          my_setopt_str(curl, CURLOPT_CAPATH, config->capath);\r\n        if(config->crlfile)\r\n          my_setopt_str(curl, CURLOPT_CRLFILE, config->crlfile);\r\n\r\n        if(curlinfo->features & CURL_VERSION_SSL) {\r\n          if(config->insecure_ok) {\r\n            my_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);\r\n            my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);\r\n          }\r\n          else {\r\n            my_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);\r\n            /* libcurl default is strict verifyhost -> 2L   */\r\n            /* my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L); */\r\n          }\r\n        }\r\n\r\n        if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) {\r\n          if(!config->insecure_ok) {\r\n            char *home;\r\n            char *file;\r\n            res = CURLE_OUT_OF_MEMORY;\r\n            home = homedir();\r\n            if(home) {\r\n              file = aprintf(\"%s/%sssh/known_hosts\", home, DOT_CHAR);\r\n              if(file) {\r\n                /* new in curl 7.19.6 */\r\n                res = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file);\r\n                curl_free(file);\r\n                if(res == CURLE_UNKNOWN_OPTION)\r\n                  /* libssh2 version older than 1.1.1 */\r\n                  res = CURLE_OK;\r\n              }\r\n              Curl_safefree(home);\r\n            }\r\n            if(res)\r\n              goto show_error;\r\n          }\r\n        }\r\n\r\n        if(config->no_body || config->remote_time) {\r\n          /* no body or use remote time */\r\n          my_setopt(curl, CURLOPT_FILETIME, TRUE);\r\n        }\r\n\r\n        my_setopt(curl, CURLOPT_CRLF, config->crlf);\r\n        my_setopt_slist(curl, CURLOPT_QUOTE, config->quote);\r\n        my_setopt_slist(curl, CURLOPT_POSTQUOTE, config->postquote);\r\n        my_setopt_slist(curl, CURLOPT_PREQUOTE, config->prequote);\r\n\r\n#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)\r\n        {\r\n          /* TODO: Make this a run-time check instead of compile-time one. */\r\n\r\n          if(config->cookie)\r\n            my_setopt_str(curl, CURLOPT_COOKIE, config->cookie);\r\n\r\n          if(config->cookiefile)\r\n            my_setopt_str(curl, CURLOPT_COOKIEFILE, config->cookiefile);\r\n\r\n          /* new in libcurl 7.9 */\r\n          if(config->cookiejar)\r\n            my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar);\r\n\r\n          /* new in libcurl 7.9.7 */\r\n          my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession);\r\n        }\r\n#endif\r\n\r\n        my_setopt_enum(curl, CURLOPT_SSLVERSION, config->ssl_version);\r\n        my_setopt_enum(curl, CURLOPT_TIMECONDITION, config->timecond);\r\n        my_setopt(curl, CURLOPT_TIMEVALUE, config->condtime);\r\n        my_setopt_str(curl, CURLOPT_CUSTOMREQUEST, config->customrequest);\r\n        my_setopt(curl, CURLOPT_STDERR, config->errors);\r\n\r\n        /* three new ones in libcurl 7.3: */\r\n        my_setopt_str(curl, CURLOPT_INTERFACE, config->iface);\r\n        my_setopt_str(curl, CURLOPT_KRBLEVEL, config->krblevel);\r\n\r\n        progressbarinit(&progressbar, config);\r\n        if((config->progressmode == CURL_PROGRESS_BAR) &&\r\n           !config->noprogress && !config->mute) {\r\n          /* we want the alternative style, then we have to implement it\r\n             ourselves! */\r\n          my_setopt(curl, CURLOPT_PROGRESSFUNCTION, tool_progress_cb);\r\n          my_setopt(curl, CURLOPT_PROGRESSDATA, &progressbar);\r\n        }\r\n\r\n        /* new in libcurl 7.6.2: */\r\n        my_setopt_slist(curl, CURLOPT_TELNETOPTIONS, config->telnet_options);\r\n\r\n        /* new in libcurl 7.7: */\r\n        my_setopt_str(curl, CURLOPT_RANDOM_FILE, config->random_file);\r\n        my_setopt(curl, CURLOPT_EGDSOCKET, config->egd_file);\r\n        my_setopt(curl, CURLOPT_CONNECTTIMEOUT, config->connecttimeout);\r\n\r\n        if(config->cipher_list)\r\n          my_setopt_str(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list);\r\n\r\n        /* new in libcurl 7.9.2: */\r\n        if(config->disable_epsv)\r\n          /* disable it */\r\n          my_setopt(curl, CURLOPT_FTP_USE_EPSV, FALSE);\r\n\r\n        /* new in libcurl 7.10.5 */\r\n        if(config->disable_eprt)\r\n          /* disable it */\r\n          my_setopt(curl, CURLOPT_FTP_USE_EPRT, FALSE);\r\n\r\n        if(config->tracetype != TRACE_NONE) {\r\n          my_setopt(curl, CURLOPT_DEBUGFUNCTION, tool_debug_cb);\r\n          my_setopt(curl, CURLOPT_DEBUGDATA, config);\r\n          my_setopt(curl, CURLOPT_VERBOSE, TRUE);\r\n        }\r\n\r\n        /* new in curl 7.9.3 */\r\n        if(config->engine) {\r\n          res = res_setopt_str(curl, CURLOPT_SSLENGINE, config->engine);\r\n          if(res)\r\n            goto show_error;\r\n          my_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1);\r\n        }\r\n\r\n        /* new in curl 7.10.7, extended in 7.19.4 but this only sets 0 or 1 */\r\n        my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,\r\n                  config->ftp_create_dirs);\r\n\r\n        /* new in curl 7.10.8 */\r\n        if(config->max_filesize)\r\n          my_setopt(curl, CURLOPT_MAXFILESIZE_LARGE,\r\n                    config->max_filesize);\r\n\r\n        if(4 == config->ip_version)\r\n          my_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);\r\n        else if(6 == config->ip_version)\r\n          my_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);\r\n        else\r\n          my_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);\r\n\r\n        /* new in curl 7.15.5 */\r\n        if(config->ftp_ssl_reqd)\r\n          my_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);\r\n\r\n        /* new in curl 7.11.0 */\r\n        else if(config->ftp_ssl)\r\n          my_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);\r\n\r\n        /* new in curl 7.16.0 */\r\n        else if(config->ftp_ssl_control)\r\n          my_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL);\r\n\r\n        /* new in curl 7.16.1 */\r\n        if(config->ftp_ssl_ccc)\r\n          my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, config->ftp_ssl_ccc_mode);\r\n\r\n#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)\r\n        {\r\n          /* TODO: Make this a run-time check instead of compile-time one. */\r\n\r\n          /* new in curl 7.19.4 */\r\n          if(config->socks5_gssapi_service)\r\n            my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE,\r\n                          config->socks5_gssapi_service);\r\n\r\n          /* new in curl 7.19.4 */\r\n          if(config->socks5_gssapi_nec)\r\n            my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_NEC,\r\n                          config->socks5_gssapi_nec);\r\n        }\r\n#endif\r\n        /* curl 7.13.0 */\r\n        my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);\r\n\r\n        my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl);\r\n\r\n        /* curl 7.14.2 */\r\n        my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip);\r\n\r\n        /* curl 7.15.1 */\r\n        my_setopt(curl, CURLOPT_FTP_FILEMETHOD, config->ftp_filemethod);\r\n\r\n        /* curl 7.15.2 */\r\n        if(config->localport) {\r\n          my_setopt(curl, CURLOPT_LOCALPORT, config->localport);\r\n          my_setopt_str(curl, CURLOPT_LOCALPORTRANGE,\r\n                        config->localportrange);\r\n        }\r\n\r\n        /* curl 7.15.5 */\r\n        my_setopt_str(curl, CURLOPT_FTP_ALTERNATIVE_TO_USER,\r\n                      config->ftp_alternative_to_user);\r\n\r\n        /* curl 7.16.0 */\r\n        if(config->disable_sessionid)\r\n          my_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE,\r\n                    !config->disable_sessionid);\r\n\r\n        /* curl 7.16.2 */\r\n        if(config->raw) {\r\n          my_setopt(curl, CURLOPT_HTTP_CONTENT_DECODING, FALSE);\r\n          my_setopt(curl, CURLOPT_HTTP_TRANSFER_DECODING, FALSE);\r\n        }\r\n\r\n        /* curl 7.17.1 */\r\n        if(!config->nokeepalive) {\r\n          my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);\r\n          if(config->alivetime != 0) {\r\n#if !defined(TCP_KEEPIDLE) || !defined(TCP_KEEPINTVL)\r\n            warnf(config, \"Keep-alive functionality somewhat crippled due to \"\r\n                \"missing support in your operating system!\\n\");\r\n#endif\r\n            my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);\r\n            my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);\r\n          }\r\n        }\r\n        else\r\n          my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 0L);\r\n\r\n        /* curl 7.20.0 */\r\n        if(config->tftp_blksize)\r\n          my_setopt(curl, CURLOPT_TFTP_BLKSIZE, config->tftp_blksize);\r\n\r\n        if(config->mail_from)\r\n          my_setopt_str(curl, CURLOPT_MAIL_FROM, config->mail_from);\r\n\r\n        if(config->mail_rcpt)\r\n          my_setopt_slist(curl, CURLOPT_MAIL_RCPT, config->mail_rcpt);\r\n\r\n        /* curl 7.20.x */\r\n        if(config->ftp_pret)\r\n          my_setopt(curl, CURLOPT_FTP_USE_PRET, TRUE);\r\n\r\n        if(config->proto_present)\r\n          my_setopt_flags(curl, CURLOPT_PROTOCOLS, config->proto);\r\n        if(config->proto_redir_present)\r\n          my_setopt_flags(curl, CURLOPT_REDIR_PROTOCOLS, config->proto_redir);\r\n\r\n        if(config->content_disposition\r\n           && (urlnode->flags & GETOUT_USEREMOTE)\r\n           && (checkprefix(\"http://\", this_url) ||\r\n               checkprefix(\"https://\", this_url)))\r\n          hdrcbdata.honor_cd_filename = TRUE;\r\n        else\r\n          hdrcbdata.honor_cd_filename = FALSE;\r\n\r\n        hdrcbdata.outs = &outs;\r\n        hdrcbdata.heads = &heads;\r\n\r\n        my_setopt(curl, CURLOPT_HEADERFUNCTION, tool_header_cb);\r\n        my_setopt(curl, CURLOPT_HEADERDATA, &hdrcbdata);\r\n\r\n        if(config->resolve)\r\n          /* new in 7.21.3 */\r\n          my_setopt_slist(curl, CURLOPT_RESOLVE, config->resolve);\r\n\r\n        /* new in 7.21.4 */\r\n        if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) {\r\n          if(config->tls_username)\r\n            my_setopt_str(curl, CURLOPT_TLSAUTH_USERNAME,\r\n                          config->tls_username);\r\n          if(config->tls_password)\r\n            my_setopt_str(curl, CURLOPT_TLSAUTH_PASSWORD,\r\n                          config->tls_password);\r\n          if(config->tls_authtype)\r\n            my_setopt_str(curl, CURLOPT_TLSAUTH_TYPE,\r\n                          config->tls_authtype);\r\n        }\r\n\r\n        /* new in 7.22.0 */\r\n        if(config->gssapi_delegation)\r\n          my_setopt_str(curl, CURLOPT_GSSAPI_DELEGATION,\r\n                        config->gssapi_delegation);\r\n\r\n        /* new in 7.25.0 */\r\n        if(config->ssl_allow_beast)\r\n          my_setopt(curl, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_ALLOW_BEAST);\r\n\r\n        if(config->mail_auth)\r\n          my_setopt_str(curl, CURLOPT_MAIL_AUTH, config->mail_auth);\r\n\r\n        /* initialize retry vars for loop below */\r\n        retry_sleep_default = (config->retry_delay) ?\r\n          config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */\r\n\r\n        retry_numretries = config->req_retry;\r\n        retry_sleep = retry_sleep_default; /* ms */\r\n        retrystart = tvnow();\r\n\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n        res = easysrc_perform();\r\n        if(res) {\r\n          goto show_error;\r\n        }\r\n#endif\r\n\r\n        for(;;) {\r\n#ifdef USE_METALINK\r\n          if(!metalink && config->use_metalink) {\r\n            /* If outs.metalink_parser is non-NULL, delete it first. */\r\n            if(outs.metalink_parser)\r\n              metalink_parser_context_delete(outs.metalink_parser);\r\n            outs.metalink_parser = metalink_parser_context_new();\r\n            if(outs.metalink_parser == NULL) {\r\n              res = CURLE_OUT_OF_MEMORY;\r\n              goto show_error;\r\n            }\r\n            fprintf(config->errors, \"Metalink: parsing (%s) metalink/XML...\\n\",\r\n                    this_url);\r\n          }\r\n          else if(metalink)\r\n            fprintf(config->errors, \"Metalink: fetching (%s) from (%s)...\\n\",\r\n                    mlfile->filename, this_url);\r\n#endif /* USE_METALINK */\r\n\r\n          res = curl_easy_perform(curl);\r\n\r\n          if(outs.is_cd_filename && outs.stream && !config->mute &&\r\n             outs.filename)\r\n            printf(\"curl: Saved to filename '%s'\\n\", outs.filename);\r\n\r\n          /* if retry-max-time is non-zero, make sure we haven't exceeded the\r\n             time */\r\n          if(retry_numretries &&\r\n             (!config->retry_maxtime ||\r\n              (tvdiff(tvnow(), retrystart) <\r\n               config->retry_maxtime*1000L)) ) {\r\n            enum {\r\n              RETRY_NO,\r\n              RETRY_TIMEOUT,\r\n              RETRY_HTTP,\r\n              RETRY_FTP,\r\n              RETRY_LAST /* not used */\r\n            } retry = RETRY_NO;\r\n            long response;\r\n            if((CURLE_OPERATION_TIMEDOUT == res) ||\r\n               (CURLE_COULDNT_RESOLVE_HOST == res) ||\r\n               (CURLE_COULDNT_RESOLVE_PROXY == res) ||\r\n               (CURLE_FTP_ACCEPT_TIMEOUT == res))\r\n              /* retry timeout always */\r\n              retry = RETRY_TIMEOUT;\r\n            else if((CURLE_OK == res) ||\r\n                    (config->failonerror &&\r\n                     (CURLE_HTTP_RETURNED_ERROR == res))) {\r\n              /* If it returned OK. _or_ failonerror was enabled and it\r\n                 returned due to such an error, check for HTTP transient\r\n                 errors to retry on. */\r\n              char *effective_url = NULL;\r\n              curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);\r\n              if(effective_url &&\r\n                 checkprefix(\"http\", effective_url)) {\r\n                /* This was HTTP(S) */\r\n                curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);\r\n\r\n                switch(response) {\r\n                case 500: /* Internal Server Error */\r\n                case 502: /* Bad Gateway */\r\n                case 503: /* Service Unavailable */\r\n                case 504: /* Gateway Timeout */\r\n                  retry = RETRY_HTTP;\r\n                  /*\r\n                   * At this point, we have already written data to the output\r\n                   * file (or terminal). If we write to a file, we must rewind\r\n                   * or close/re-open the file so that the next attempt starts\r\n                   * over from the beginning.\r\n                   *\r\n                   * TODO: similar action for the upload case. We might need\r\n                   * to start over reading from a previous point if we have\r\n                   * uploaded something when this was returned.\r\n                   */\r\n                  break;\r\n                }\r\n              }\r\n            } /* if CURLE_OK */\r\n            else if(res) {\r\n              curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);\r\n\r\n              if(response/100 == 4)\r\n                /*\r\n                 * This is typically when the FTP server only allows a certain\r\n                 * amount of users and we are not one of them.  All 4xx codes\r\n                 * are transient.\r\n                 */\r\n                retry = RETRY_FTP;\r\n            }\r\n\r\n            if(retry) {\r\n              static const char * const m[]={\r\n                NULL, \"timeout\", \"HTTP error\", \"FTP error\"\r\n              };\r\n              warnf(config, \"Transient problem: %s \"\r\n                    \"Will retry in %ld seconds. \"\r\n                    \"%ld retries left.\\n\",\r\n                    m[retry], retry_sleep/1000L, retry_numretries);\r\n\r\n              tool_go_sleep(retry_sleep);\r\n              retry_numretries--;\r\n              if(!config->retry_delay) {\r\n                retry_sleep *= 2;\r\n                if(retry_sleep > RETRY_SLEEP_MAX)\r\n                  retry_sleep = RETRY_SLEEP_MAX;\r\n              }\r\n              if(outs.bytes && outs.filename) {\r\n                /* We have written data to a output file, we truncate file\r\n                 */\r\n                if(!config->mute)\r\n                  fprintf(config->errors, \"Throwing away %\"\r\n                          CURL_FORMAT_CURL_OFF_T \" bytes\\n\",\r\n                          outs.bytes);\r\n                fflush(outs.stream);\r\n                /* truncate file at the position where we started appending */\r\n#ifdef HAVE_FTRUNCATE\r\n                if(ftruncate( fileno(outs.stream), outs.init)) {\r\n                  /* when truncate fails, we can't just append as then we'll\r\n                     create something strange, bail out */\r\n                  if(!config->mute)\r\n                    fprintf(config->errors,\r\n                            \"failed to truncate, exiting\\n\");\r\n                  res = CURLE_WRITE_ERROR;\r\n                  goto quit_urls;\r\n                }\r\n                /* now seek to the end of the file, the position where we\r\n                   just truncated the file in a large file-safe way */\r\n                fseek(outs.stream, 0, SEEK_END);\r\n#else\r\n                /* ftruncate is not available, so just reposition the file\r\n                   to the location we would have truncated it. This won't\r\n                   work properly with large files on 32-bit systems, but\r\n                   most of those will have ftruncate. */\r\n                fseek(outs.stream, (long)outs.init, SEEK_SET);\r\n#endif\r\n                outs.bytes = 0; /* clear for next round */\r\n              }\r\n              continue; /* curl_easy_perform loop */\r\n            }\r\n          } /* if retry_numretries */\r\n          else if(metalink) {\r\n            /* Metalink: Decide to try the next resource or\r\n               not. Basically, we want to try the next resource if\r\n               download was not successful. */\r\n            long response;\r\n            if(CURLE_OK == res) {\r\n              /* TODO We want to try next resource when download was\r\n                 not successful. How to know that? */\r\n              char *effective_url = NULL;\r\n              curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);\r\n              if(effective_url &&\r\n                 curlx_strnequal(effective_url, \"http\", 4)) {\r\n                /* This was HTTP(S) */\r\n                curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);\r\n                if(response != 200 && response != 206) {\r\n                  metalink_next_res = 1;\r\n                  fprintf(config->errors,\r\n                          \"Metalink: fetching (%s) from (%s) FAILED \"\r\n                          \"(HTTP status code %d)\\n\",\r\n                          mlfile->filename, this_url, response);\r\n                }\r\n              }\r\n            }\r\n            else {\r\n              metalink_next_res = 1;\r\n              fprintf(config->errors,\r\n                      \"Metalink: fetching (%s) from (%s) FAILED (%s)\\n\",\r\n                      mlfile->filename, this_url,\r\n                      (errorbuffer[0]) ?\r\n                      errorbuffer : curl_easy_strerror((CURLcode)res));\r\n            }\r\n          }\r\n          if(metalink && !metalink_next_res)\r\n            fprintf(config->errors, \"Metalink: fetching (%s) from (%s) OK\\n\",\r\n                    mlfile->filename, this_url);\r\n\r\n          /* In all ordinary cases, just break out of loop here */\r\n          break; /* curl_easy_perform loop */\r\n\r\n        }\r\n\r\n        if((config->progressmode == CURL_PROGRESS_BAR) &&\r\n           progressbar.calls)\r\n          /* if the custom progress bar has been displayed, we output a\r\n             newline here */\r\n          fputs(\"\\n\", progressbar.out);\r\n\r\n        if(config->writeout)\r\n          ourWriteOut(curl, &outs, config->writeout);\r\n\r\n        if(config->writeenv)\r\n          ourWriteEnv(curl);\r\n\r\n        /*\r\n        ** Code within this loop may jump directly here to label 'show_error'\r\n        ** in order to display an error message for CURLcode stored in 'res'\r\n        ** variable and exit loop once that necessary writing and cleanup\r\n        ** in label 'quit_urls' has been done.\r\n        */\r\n\r\n        show_error:\r\n\r\n#ifdef __VMS\r\n        if(is_vms_shell()) {\r\n          /* VMS DCL shell behavior */\r\n          if(!config->showerror)\r\n            vms_show = VMSSTS_HIDE;\r\n        }\r\n        else\r\n#endif\r\n        if(res && config->showerror) {\r\n          fprintf(config->errors, \"curl: (%d) %s\\n\", res, (errorbuffer[0]) ?\r\n                  errorbuffer : curl_easy_strerror((CURLcode)res));\r\n          if(res == CURLE_SSL_CACERT)\r\n            fprintf(config->errors, \"%s%s\",\r\n                    CURL_CA_CERT_ERRORMSG1, CURL_CA_CERT_ERRORMSG2);\r\n        }\r\n\r\n        /* Fall through comment to 'quit_urls' label */\r\n\r\n        /*\r\n        ** Upon error condition and always that a message has already been\r\n        ** displayed, code within this loop may jump directly here to label\r\n        ** 'quit_urls' otherwise it should jump to 'show_error' label above.\r\n        **\r\n        ** When 'res' variable is _not_ CURLE_OK loop will exit once that\r\n        ** all code following 'quit_urls' has been executed. Otherwise it\r\n        ** will loop to the beginning from where it may exit if there are\r\n        ** no more urls left.\r\n        */\r\n\r\n        quit_urls:\r\n\r\n        /* Set file extended attributes */\r\n        if(!res && config->xattr && outs.fopened && outs.stream) {\r\n          int rc = fwrite_xattr(curl, fileno(outs.stream));\r\n          if(rc)\r\n            warnf(config, \"Error setting extended attributes: %s\\n\",\r\n                  strerror(errno));\r\n        }\r\n\r\n        /* Close the file */\r\n        if(outs.fopened && outs.stream) {\r\n          int rc = fclose(outs.stream);\r\n          if(!res && rc) {\r\n            /* something went wrong in the writing process */\r\n            res = CURLE_WRITE_ERROR;\r\n            fprintf(config->errors, \"(%d) Failed writing body\\n\", res);\r\n          }\r\n        }\r\n        else if(!outs.s_isreg && outs.stream) {\r\n          /* Dump standard stream buffered data */\r\n          int rc = fflush(outs.stream);\r\n          if(!res && rc) {\r\n            /* something went wrong in the writing process */\r\n            res = CURLE_WRITE_ERROR;\r\n            fprintf(config->errors, \"(%d) Failed writing body\\n\", res);\r\n          }\r\n        }\r\n\r\n#ifdef __AMIGA__\r\n        if(!res && outs.s_isreg && outs.filename) {\r\n          /* Set the url (up to 80 chars) as comment for the file */\r\n          if(strlen(url) > 78)\r\n            url[79] = '\\0';\r\n          SetComment(outs.filename, url);\r\n        }\r\n#endif\r\n\r\n#ifdef HAVE_UTIME\r\n        /* File time can only be set _after_ the file has been closed */\r\n        if(!res && config->remote_time && outs.s_isreg && outs.filename) {\r\n          /* Ask libcurl if we got a remote file time */\r\n          long filetime = -1;\r\n          curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);\r\n          if(filetime >= 0) {\r\n            struct utimbuf times;\r\n            times.actime = (time_t)filetime;\r\n            times.modtime = (time_t)filetime;\r\n            utime(outs.filename, &times); /* set the time we got */\r\n          }\r\n        }\r\n#endif\r\n\r\n#ifdef USE_METALINK\r\n        if(!metalink && config->use_metalink && res == CURLE_OK) {\r\n          int rv = parse_metalink(config, &outs, this_url);\r\n          if(rv == 0)\r\n            fprintf(config->errors, \"Metalink: parsing (%s) OK\\n\", this_url);\r\n          else if(rv == -1)\r\n            fprintf(config->errors, \"Metalink: parsing (%s) FAILED\\n\",\r\n                    this_url);\r\n        }\r\n        else if(metalink && res == CURLE_OK && !metalink_next_res) {\r\n          int rv = metalink_check_hash(config, mlfile, outs.filename);\r\n          if(rv == 0) {\r\n            metalink_next_res = 1;\r\n          }\r\n        }\r\n#endif /* USE_METALINK */\r\n\r\n        /* No more business with this output struct */\r\n        if(outs.alloc_filename)\r\n          Curl_safefree(outs.filename);\r\n#ifdef USE_METALINK\r\n        if(outs.metalink_parser)\r\n          metalink_parser_context_delete(outs.metalink_parser);\r\n#endif /* USE_METALINK */\r\n        memset(&outs, 0, sizeof(struct OutStruct));\r\n        hdrcbdata.outs = NULL;\r\n\r\n        /* Free loop-local allocated memory and close loop-local opened fd */\r\n\r\n        Curl_safefree(outfile);\r\n        Curl_safefree(this_url);\r\n\r\n        if(infdopen)\r\n          close(infd);\r\n\r\n        if(metalink) {\r\n          /* Should exit if error is fatal. */\r\n          if(is_fatal_error(res)) {\r\n            break;\r\n          }\r\n          if(!metalink_next_res)\r\n            break;\r\n          mlres = mlres->next;\r\n          if(mlres == NULL)\r\n            /* TODO If metalink_next_res is 1 and mlres is NULL,\r\n             * set res to error code\r\n             */\r\n            break;\r\n        }\r\n        else\r\n        if(urlnum > 1) {\r\n          /* when url globbing, exit loop upon critical error */\r\n          if(is_fatal_error(res))\r\n            break;\r\n        }\r\n        else if(res)\r\n          /* when not url globbing, exit loop upon any error */\r\n          break;\r\n\r\n      } /* loop to the next URL */\r\n\r\n      /* Free loop-local allocated memory */\r\n\r\n      Curl_safefree(uploadfile);\r\n\r\n      if(urls) {\r\n        /* Free list of remaining URLs */\r\n        glob_cleanup(urls);\r\n        urls = NULL;\r\n      }\r\n\r\n      if(infilenum > 1) {\r\n        /* when file globbing, exit loop upon critical error */\r\n        if(is_fatal_error(res))\r\n          break;\r\n      }\r\n      else if(res)\r\n        /* when not file globbing, exit loop upon any error */\r\n        break;\r\n\r\n    } /* loop to the next globbed upload file */\r\n\r\n    /* Free loop-local allocated memory */\r\n\r\n    Curl_safefree(outfiles);\r\n\r\n    if(inglob) {\r\n      /* Free list of globbed upload files */\r\n      glob_cleanup(inglob);\r\n      inglob = NULL;\r\n    }\r\n\r\n    /* Free this URL node data without destroying the\r\n       the node itself nor modifying next pointer. */\r\n    Curl_safefree(urlnode->url);\r\n    Curl_safefree(urlnode->outfile);\r\n    Curl_safefree(urlnode->infile);\r\n    urlnode->flags = 0;\r\n\r\n    /*\r\n    ** Bail out upon critical errors\r\n    */\r\n    if(is_fatal_error(res))\r\n      goto quit_curl;\r\n\r\n  } /* for-loop through all URLs */\r\n\r\n  /*\r\n  ** Nested loops end here.\r\n  */\r\n\r\n  quit_curl:\r\n\r\n  /* Free function-local referenced allocated memory */\r\n  Curl_safefree(httpgetfields);\r\n\r\n  /* Free list of given URLs */\r\n  clean_getout(config);\r\n\r\n  /* Cleanup the curl handle now that our\r\n     progressbar struct is still in scope */\r\n  if(curl) {\r\n    curl_easy_cleanup(curl);\r\n    config->easy = curl = NULL;\r\n  }\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n  easysrc_cleanup();\r\n#endif\r\n\r\n  hdrcbdata.heads = NULL;\r\n\r\n  /* Close function-local opened file descriptors */\r\n\r\n  if(heads.fopened && heads.stream)\r\n    fclose(heads.stream);\r\n  if(heads.alloc_filename)\r\n    Curl_safefree(heads.filename);\r\n\r\n  if(config->trace_fopened && config->trace_stream)\r\n    fclose(config->trace_stream);\r\n\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n  /* Dump the libcurl code if previously enabled.\r\n     NOTE: that this function relies on config->errors amongst other things\r\n     so not everything can be closed and cleaned before this is called */\r\n  dumpeasysrc(config);\r\n#endif\r\n\r\n  if(config->errors_fopened && config->errors)\r\n    fclose(config->errors);\r\n\r\n  /* Release metalink related resources here */\r\n  clean_metalink(config);\r\n\r\n  main_free(); /* cleanup */\r\n\r\n  return res;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_operate.h",
    "content": "#ifndef HEADER_CURL_TOOL_OPERATE_H\r\n#define HEADER_CURL_TOOL_OPERATE_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nint operate(struct Configurable *config, int argc, argv_item_t argv[]);\r\n\r\n#endif /* HEADER_CURL_TOOL_OPERATE_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_operhlp.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_convert.h\"\r\n#include \"tool_operhlp.h\"\r\n#include \"tool_version.h\"\r\n\r\n#ifdef USE_METALINK\r\n/* import the declaration of metalink_cleanup() */\r\n#  include \"tool_metalink.h\"\r\n#endif\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/*\r\n * my_useragent: returns allocated string with default user agent\r\n */\r\nchar *my_useragent(void)\r\n{\r\n  return strdup( CURL_NAME \"/\" CURL_VERSION );\r\n}\r\n\r\n/*\r\n * Print list of OpenSSL supported engines\r\n */\r\nvoid list_engines(const struct curl_slist *engines)\r\n{\r\n  puts(\"Build-time engines:\");\r\n  if(!engines) {\r\n    puts(\"  <none>\");\r\n    return;\r\n  }\r\n  for(; engines; engines = engines->next)\r\n    printf(\"  %s\\n\", engines->data);\r\n}\r\n\r\nvoid clean_getout(struct Configurable *config)\r\n{\r\n  struct getout *next;\r\n  struct getout *node = config->url_list;\r\n\r\n  while(node) {\r\n    next = node->next;\r\n    Curl_safefree(node->url);\r\n    Curl_safefree(node->outfile);\r\n    Curl_safefree(node->infile);\r\n    Curl_safefree(node);\r\n    node = next;\r\n  }\r\n  config->url_list = NULL;\r\n}\r\n\r\nbool output_expected(const char *url, const char *uploadfile)\r\n{\r\n  if(!uploadfile)\r\n    return TRUE;  /* download */\r\n  if(checkprefix(\"http://\", url) || checkprefix(\"https://\", url))\r\n    return TRUE;   /* HTTP(S) upload */\r\n\r\n  return FALSE; /* non-HTTP upload, probably no output should be expected */\r\n}\r\n\r\nbool stdin_upload(const char *uploadfile)\r\n{\r\n  return (curlx_strequal(uploadfile, \"-\") ||\r\n          curlx_strequal(uploadfile, \".\")) ? TRUE : FALSE;\r\n}\r\n\r\n/*\r\n * Adds the file name to the URL if it doesn't already have one.\r\n * url will be freed before return if the returned pointer is different\r\n */\r\nchar *add_file_name_to_url(CURL *curl, char *url, const char *filename)\r\n{\r\n  /* If no file name part is given in the URL, we add this file name */\r\n  char *ptr = strstr(url, \"://\");\r\n  if(ptr)\r\n    ptr += 3;\r\n  else\r\n    ptr = url;\r\n  ptr = strrchr(ptr, '/');\r\n  if(!ptr || !strlen(++ptr)) {\r\n    /* The URL has no file name part, add the local file name. In order\r\n       to be able to do so, we have to create a new URL in another\r\n       buffer.*/\r\n\r\n    /* We only want the part of the local path that is on the right\r\n       side of the rightmost slash and backslash. */\r\n    const char *filep = strrchr(filename, '/');\r\n    char *file2 = strrchr(filep?filep:filename, '\\\\');\r\n    char *encfile;\r\n\r\n    if(file2)\r\n      filep = file2 + 1;\r\n    else if(filep)\r\n      filep++;\r\n    else\r\n      filep = filename;\r\n\r\n    /* URL encode the file name */\r\n    encfile = curl_easy_escape(curl, filep, 0 /* use strlen */);\r\n    if(encfile) {\r\n      char *urlbuffer = malloc(strlen(url) + strlen(encfile) + 3);\r\n      if(!urlbuffer) {\r\n        curl_free(encfile);\r\n        Curl_safefree(url);\r\n        return NULL;\r\n      }\r\n      if(ptr)\r\n        /* there is a trailing slash on the URL */\r\n        sprintf(urlbuffer, \"%s%s\", url, encfile);\r\n      else\r\n        /* there is no trailing slash on the URL */\r\n        sprintf(urlbuffer, \"%s/%s\", url, encfile);\r\n\r\n      curl_free(encfile);\r\n      Curl_safefree(url);\r\n\r\n      url = urlbuffer; /* use our new URL instead! */\r\n    }\r\n  }\r\n  return url;\r\n}\r\n\r\n/* Extracts the name portion of the URL.\r\n * Returns a pointer to a heap-allocated string or NULL if\r\n * no name part, at location indicated by first argument.\r\n */\r\nCURLcode get_url_file_name(char **filename, const char *url)\r\n{\r\n  const char *pc;\r\n\r\n  *filename = NULL;\r\n\r\n  /* Find and get the remote file name */\r\n  pc = strstr(url, \"://\");\r\n  if(pc)\r\n    pc += 3;\r\n  else\r\n    pc = url;\r\n  pc = strrchr(pc, '/');\r\n\r\n  if(pc) {\r\n    /* duplicate the string beyond the slash */\r\n    pc++;\r\n    if(*pc) {\r\n      *filename = strdup(pc);\r\n      if(!*filename)\r\n        return CURLE_OUT_OF_MEMORY;\r\n    }\r\n  }\r\n\r\n  /* in case we built debug enabled, we allow an environment variable\r\n   * named CURL_TESTDIR to prefix the given file name to put it into a\r\n   * specific directory\r\n   */\r\n#ifdef DEBUGBUILD\r\n  {\r\n    char *tdir = curlx_getenv(\"CURL_TESTDIR\");\r\n    if(tdir) {\r\n      char buffer[512]; /* suitably large */\r\n      snprintf(buffer, sizeof(buffer), \"%s/%s\", tdir, *filename);\r\n      Curl_safefree(*filename);\r\n      *filename = strdup(buffer); /* clone the buffer */\r\n      curl_free(tdir);\r\n    }\r\n  }\r\n#endif\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\n/*\r\n * This is the main global constructor for the app. Call this before\r\n * _any_ libcurl usage. If this fails, *NO* libcurl functions may be\r\n * used, or havoc may be the result.\r\n */\r\nCURLcode main_init(void)\r\n{\r\n#if defined(__DJGPP__) || defined(__GO32__)\r\n  /* stop stat() wasting time */\r\n  _djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;\r\n#endif\r\n\r\n  return curl_global_init(CURL_GLOBAL_DEFAULT);\r\n}\r\n\r\n/*\r\n * This is the main global destructor for the app. Call this after\r\n * _all_ libcurl usage is done.\r\n */\r\nvoid main_free(void)\r\n{\r\n  curl_global_cleanup();\r\n  convert_cleanup();\r\n#ifdef USE_METALINK\r\n  metalink_cleanup();\r\n#endif\r\n}\r\n\r\n#ifdef CURLDEBUG\r\nvoid memory_tracking_init(void)\r\n{\r\n  char *env;\r\n  /* if CURL_MEMDEBUG is set, this starts memory tracking message logging */\r\n  env = curlx_getenv(\"CURL_MEMDEBUG\");\r\n  if(env) {\r\n    /* use the value as file name */\r\n    char fname[CURL_MT_LOGFNAME_BUFSIZE];\r\n    if(strlen(env) >= CURL_MT_LOGFNAME_BUFSIZE)\r\n      env[CURL_MT_LOGFNAME_BUFSIZE-1] = '\\0';\r\n    strcpy(fname, env);\r\n    curl_free(env);\r\n    curl_memdebug(fname);\r\n    /* this weird stuff here is to make curl_free() get called\r\n       before curl_memdebug() as otherwise memory tracking will\r\n       log a free() without an alloc! */\r\n  }\r\n  /* if CURL_MEMLIMIT is set, this enables fail-on-alloc-number-N feature */\r\n  env = curlx_getenv(\"CURL_MEMLIMIT\");\r\n  if(env) {\r\n    char *endptr;\r\n    long num = strtol(env, &endptr, 10);\r\n    if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))\r\n      curl_memlimit(num);\r\n    curl_free(env);\r\n  }\r\n}\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_operhlp.h",
    "content": "#ifndef HEADER_CURL_TOOL_OPERHLP_H\r\n#define HEADER_CURL_TOOL_OPERHLP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nchar *my_useragent(void);\r\n\r\nvoid list_engines(const struct curl_slist *engines);\r\n\r\nvoid clean_getout(struct Configurable *config);\r\n\r\nbool output_expected(const char *url, const char *uploadfile);\r\n\r\nbool stdin_upload(const char *uploadfile);\r\n\r\nchar *add_file_name_to_url(CURL *curl, char *url, const char *filename);\r\n\r\nCURLcode get_url_file_name(char **filename, const char *url);\r\n\r\nCURLcode main_init(void);\r\n\r\nvoid main_free(void);\r\n\r\n#ifdef CURLDEBUG\r\nvoid memory_tracking_init(void);\r\n#else\r\n#  define memory_tracking_init() Curl_nop_stmt\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_OPERHLP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_panykey.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#if defined(__SYMBIAN32__) || defined(NETWARE)\r\n\r\n#ifdef NETWARE\r\n#  ifdef __NOVELL_LIBC__\r\n#    include <screen.h>\r\n#  else\r\n#    include <nwconio.h>\r\n#  endif\r\n#endif\r\n\r\n#include \"tool_panykey.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nvoid tool_pressanykey(void)\r\n{\r\n#if defined(__SYMBIAN32__)\r\n  getchar();\r\n#elif defined(NETWARE)\r\n  pressanykey();\r\n#endif\r\n}\r\n\r\n#endif /* __SYMBIAN32__ || NETWARE */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_panykey.h",
    "content": "#ifndef HEADER_CURL_TOOL_PANYKEY_H\r\n#define HEADER_CURL_TOOL_PANYKEY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#if defined(__SYMBIAN32__) || defined(NETWARE)\r\n\r\nvoid tool_pressanykey(void);\r\n\r\n#else\r\n\r\n#define tool_pressanykey() Curl_nop_stmt\r\n\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_PANYKEY_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_paramhlp.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"rawstr.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_getparam.h\"\r\n#include \"tool_getpass.h\"\r\n#include \"tool_homedir.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_paramhlp.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nstruct getout *new_getout(struct Configurable *config)\r\n{\r\n  struct getout *node = calloc(1, sizeof(struct getout));\r\n  struct getout *last = config->url_last;\r\n  if(node) {\r\n    /* append this new node last in the list */\r\n    if(last)\r\n      last->next = node;\r\n    else\r\n      config->url_list = node; /* first node */\r\n\r\n    /* move the last pointer */\r\n    config->url_last = node;\r\n\r\n    node->flags = config->default_node_flags;\r\n  }\r\n  return node;\r\n}\r\n\r\nParameterError file2string(char **bufp, FILE *file)\r\n{\r\n  char buffer[256];\r\n  char *ptr;\r\n  char *string = NULL;\r\n  size_t stringlen = 0;\r\n  size_t buflen;\r\n\r\n  if(file) {\r\n    while(fgets(buffer, sizeof(buffer), file)) {\r\n      if((ptr = strchr(buffer, '\\r')) != NULL)\r\n        *ptr = '\\0';\r\n      if((ptr = strchr(buffer, '\\n')) != NULL)\r\n        *ptr = '\\0';\r\n      buflen = strlen(buffer);\r\n      if((ptr = realloc(string, stringlen+buflen+1)) == NULL) {\r\n        Curl_safefree(string);\r\n        return PARAM_NO_MEM;\r\n      }\r\n      string = ptr;\r\n      strcpy(string+stringlen, buffer);\r\n      stringlen += buflen;\r\n    }\r\n  }\r\n  *bufp = string;\r\n  return PARAM_OK;\r\n}\r\n\r\nParameterError file2memory(char **bufp, size_t *size, FILE *file)\r\n{\r\n  char *newbuf;\r\n  char *buffer = NULL;\r\n  size_t alloc = 512;\r\n  size_t nused = 0;\r\n  size_t nread;\r\n\r\n  if(file) {\r\n    do {\r\n      if(!buffer || (alloc == nused)) {\r\n        /* size_t overflow detection for huge files */\r\n        if(alloc+1 > ((size_t)-1)/2) {\r\n          Curl_safefree(buffer);\r\n          return PARAM_NO_MEM;\r\n        }\r\n        alloc *= 2;\r\n        /* allocate an extra char, reserved space, for null termination */\r\n        if((newbuf = realloc(buffer, alloc+1)) == NULL) {\r\n          Curl_safefree(buffer);\r\n          return PARAM_NO_MEM;\r\n        }\r\n        buffer = newbuf;\r\n      }\r\n      nread = fread(buffer+nused, 1, alloc-nused, file);\r\n      nused += nread;\r\n    } while(nread);\r\n    /* null terminate the buffer in case it's used as a string later */\r\n    buffer[nused] = '\\0';\r\n    /* free trailing slack space, if possible */\r\n    if(alloc != nused) {\r\n      if((newbuf = realloc(buffer, nused+1)) == NULL) {\r\n        Curl_safefree(buffer);\r\n        return PARAM_NO_MEM;\r\n      }\r\n      buffer = newbuf;\r\n    }\r\n    /* discard buffer if nothing was read */\r\n    if(!nused) {\r\n      Curl_safefree(buffer); /* no string */\r\n    }\r\n  }\r\n  *size = nused;\r\n  *bufp = buffer;\r\n  return PARAM_OK;\r\n}\r\n\r\nvoid cleanarg(char *str)\r\n{\r\n#ifdef HAVE_WRITABLE_ARGV\r\n  /* now that GetStr has copied the contents of nextarg, wipe the next\r\n   * argument out so that the username:password isn't displayed in the\r\n   * system process list */\r\n  if(str) {\r\n    size_t len = strlen(str);\r\n    memset(str, ' ', len);\r\n  }\r\n#else\r\n  (void)str;\r\n#endif\r\n}\r\n\r\n/*\r\n * Parse the string and write the long in the given address. Return PARAM_OK\r\n * on success, otherwise a parameter specific error enum.\r\n *\r\n * Since this function gets called with the 'nextarg' pointer from within the\r\n * getparameter a lot, we must check it for NULL before accessing the str\r\n * data.\r\n */\r\n\r\nParameterError str2num(long *val, const char *str)\r\n{\r\n  if(str) {\r\n    char *endptr;\r\n    long num = strtol(str, &endptr, 10);\r\n    if((endptr != str) && (endptr == str + strlen(str))) {\r\n      *val = num;\r\n      return PARAM_OK;  /* Ok */\r\n    }\r\n  }\r\n  return PARAM_BAD_NUMERIC; /* badness */\r\n}\r\n\r\n/*\r\n * Parse the string and write the long in the given address. Return PARAM_OK\r\n * on success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS!\r\n *\r\n * Since this function gets called with the 'nextarg' pointer from within the\r\n * getparameter a lot, we must check it for NULL before accessing the str\r\n * data.\r\n */\r\n\r\nParameterError str2unum(long *val, const char *str)\r\n{\r\n  if(str[0]=='-')\r\n    return PARAM_NEGATIVE_NUMERIC; /* badness */\r\n  return str2num(val, str);\r\n}\r\n\r\n/*\r\n * Parse the string and modify the long in the given address. Return\r\n * non-zero on failure, zero on success.\r\n *\r\n * The string is a list of protocols\r\n *\r\n * Since this function gets called with the 'nextarg' pointer from within the\r\n * getparameter a lot, we must check it for NULL before accessing the str\r\n * data.\r\n */\r\n\r\nlong proto2num(struct Configurable *config, long *val, const char *str)\r\n{\r\n  char *buffer;\r\n  const char *sep = \",\";\r\n  char *token;\r\n\r\n  static struct sprotos {\r\n    const char *name;\r\n    long bit;\r\n  } const protos[] = {\r\n    { \"all\", CURLPROTO_ALL },\r\n    { \"http\", CURLPROTO_HTTP },\r\n    { \"https\", CURLPROTO_HTTPS },\r\n    { \"ftp\", CURLPROTO_FTP },\r\n    { \"ftps\", CURLPROTO_FTPS },\r\n    { \"scp\", CURLPROTO_SCP },\r\n    { \"sftp\", CURLPROTO_SFTP },\r\n    { \"telnet\", CURLPROTO_TELNET },\r\n    { \"ldap\", CURLPROTO_LDAP },\r\n    { \"ldaps\", CURLPROTO_LDAPS },\r\n    { \"dict\", CURLPROTO_DICT },\r\n    { \"file\", CURLPROTO_FILE },\r\n    { \"tftp\", CURLPROTO_TFTP },\r\n    { \"imap\", CURLPROTO_IMAP },\r\n    { \"imaps\", CURLPROTO_IMAPS },\r\n    { \"pop3\", CURLPROTO_POP3 },\r\n    { \"pop3s\", CURLPROTO_POP3S },\r\n    { \"smtp\", CURLPROTO_SMTP },\r\n    { \"smtps\", CURLPROTO_SMTPS },\r\n    { \"rtsp\", CURLPROTO_RTSP },\r\n    { \"gopher\", CURLPROTO_GOPHER },\r\n    { NULL, 0 }\r\n  };\r\n\r\n  if(!str)\r\n    return 1;\r\n\r\n  buffer = strdup(str); /* because strtok corrupts it */\r\n  if(!buffer)\r\n    return 1;\r\n\r\n  for(token = strtok(buffer, sep);\r\n      token;\r\n      token = strtok(NULL, sep)) {\r\n    enum e_action { allow, deny, set } action = allow;\r\n\r\n    struct sprotos const *pp;\r\n\r\n    /* Process token modifiers */\r\n    while(!ISALNUM(*token)) { /* may be NULL if token is all modifiers */\r\n      switch (*token++) {\r\n      case '=':\r\n        action = set;\r\n        break;\r\n      case '-':\r\n        action = deny;\r\n        break;\r\n      case '+':\r\n        action = allow;\r\n        break;\r\n      default: /* Includes case of terminating NULL */\r\n        Curl_safefree(buffer);\r\n        return 1;\r\n      }\r\n    }\r\n\r\n    for(pp=protos; pp->name; pp++) {\r\n      if(curlx_raw_equal(token, pp->name)) {\r\n        switch (action) {\r\n        case deny:\r\n          *val &= ~(pp->bit);\r\n          break;\r\n        case allow:\r\n          *val |= pp->bit;\r\n          break;\r\n        case set:\r\n          *val = pp->bit;\r\n          break;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n\r\n    if(!(pp->name)) { /* unknown protocol */\r\n      /* If they have specified only this protocol, we say treat it as\r\n         if no protocols are allowed */\r\n      if(action == set)\r\n        *val = 0;\r\n      warnf(config, \"unrecognized protocol '%s'\\n\", token);\r\n    }\r\n  }\r\n  Curl_safefree(buffer);\r\n  return 0;\r\n}\r\n\r\n/**\r\n * Parses the given string looking for an offset (which may be a\r\n * larger-than-integer value). The offset CANNOT be negative!\r\n *\r\n * @param val  the offset to populate\r\n * @param str  the buffer containing the offset\r\n * @return PARAM_OK if successful, a parameter specific error enum if failure.\r\n */\r\nParameterError str2offset(curl_off_t *val, const char *str)\r\n{\r\n  char *endptr;\r\n  if(str[0] == '-')\r\n    /* offsets aren't negative, this indicates weird input */\r\n    return PARAM_NEGATIVE_NUMERIC;\r\n\r\n#if(CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)\r\n  *val = curlx_strtoofft(str, &endptr, 0);\r\n  if((*val == CURL_OFF_T_MAX || *val == CURL_OFF_T_MIN) && (ERRNO == ERANGE))\r\n    return PARAM_BAD_NUMERIC;\r\n#else\r\n  *val = strtol(str, &endptr, 0);\r\n  if((*val == LONG_MIN || *val == LONG_MAX) && ERRNO == ERANGE)\r\n    return PARAM_BAD_NUMERIC;\r\n#endif\r\n  if((endptr != str) && (endptr == str + strlen(str)))\r\n    return PARAM_OK;\r\n\r\n  return PARAM_BAD_NUMERIC;\r\n}\r\n\r\nParameterError checkpasswd(const char *kind, /* for what purpose */\r\n                           char **userpwd)   /* pointer to allocated string */\r\n{\r\n  char *ptr;\r\n\r\n  if(!*userpwd)\r\n    return PARAM_OK;\r\n\r\n  ptr = strchr(*userpwd, ':');\r\n  if(!ptr) {\r\n    /* no password present, prompt for one */\r\n    char passwd[256] = \"\";\r\n    char prompt[256];\r\n    size_t passwdlen;\r\n    size_t userlen = strlen(*userpwd);\r\n    char *passptr;\r\n\r\n    /* build a nice-looking prompt */\r\n    curlx_msnprintf(prompt, sizeof(prompt),\r\n                    \"Enter %s password for user '%s':\",\r\n                    kind, *userpwd);\r\n\r\n    /* get password */\r\n    getpass_r(prompt, passwd, sizeof(passwd));\r\n    passwdlen = strlen(passwd);\r\n\r\n    /* extend the allocated memory area to fit the password too */\r\n    passptr = realloc(*userpwd,\r\n                      passwdlen + 1 + /* an extra for the colon */\r\n                      userlen + 1);   /* an extra for the zero */\r\n    if(!passptr)\r\n      return PARAM_NO_MEM;\r\n\r\n    /* append the password separated with a colon */\r\n    passptr[userlen] = ':';\r\n    memcpy(&passptr[userlen+1], passwd, passwdlen+1);\r\n    *userpwd = passptr;\r\n  }\r\n  return PARAM_OK;\r\n}\r\n\r\nParameterError add2list(struct curl_slist **list, const char *ptr)\r\n{\r\n  struct curl_slist *newlist = curl_slist_append(*list, ptr);\r\n  if(newlist)\r\n    *list = newlist;\r\n  else\r\n    return PARAM_NO_MEM;\r\n\r\n  return PARAM_OK;\r\n}\r\n\r\nint ftpfilemethod(struct Configurable *config, const char *str)\r\n{\r\n  if(curlx_raw_equal(\"singlecwd\", str))\r\n    return CURLFTPMETHOD_SINGLECWD;\r\n  if(curlx_raw_equal(\"nocwd\", str))\r\n    return CURLFTPMETHOD_NOCWD;\r\n  if(curlx_raw_equal(\"multicwd\", str))\r\n    return CURLFTPMETHOD_MULTICWD;\r\n  warnf(config, \"unrecognized ftp file method '%s', using default\\n\", str);\r\n  return CURLFTPMETHOD_MULTICWD;\r\n}\r\n\r\nint ftpcccmethod(struct Configurable *config, const char *str)\r\n{\r\n  if(curlx_raw_equal(\"passive\", str))\r\n    return CURLFTPSSL_CCC_PASSIVE;\r\n  if(curlx_raw_equal(\"active\", str))\r\n    return CURLFTPSSL_CCC_ACTIVE;\r\n  warnf(config, \"unrecognized ftp CCC method '%s', using default\\n\", str);\r\n  return CURLFTPSSL_CCC_PASSIVE;\r\n}\r\n\r\nlong delegation(struct Configurable *config, char *str)\r\n{\r\n  if(curlx_raw_equal(\"none\", str))\r\n    return CURLGSSAPI_DELEGATION_NONE;\r\n  if(curlx_raw_equal(\"policy\", str))\r\n    return CURLGSSAPI_DELEGATION_POLICY_FLAG;\r\n  if(curlx_raw_equal(\"always\", str))\r\n    return CURLGSSAPI_DELEGATION_FLAG;\r\n  warnf(config, \"unrecognized delegation method '%s', using none\\n\", str);\r\n  return CURLGSSAPI_DELEGATION_NONE;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_paramhlp.h",
    "content": "#ifndef HEADER_CURL_TOOL_PARAMHLP_H\r\n#define HEADER_CURL_TOOL_PARAMHLP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nstruct getout *new_getout(struct Configurable *config);\r\n\r\nParameterError file2string(char **bufp, FILE *file);\r\n\r\nParameterError file2memory(char **bufp, size_t *size, FILE *file);\r\n\r\nvoid cleanarg(char *str);\r\n\r\nParameterError str2num(long *val, const char *str);\r\nParameterError str2unum(long *val, const char *str);\r\n\r\nlong proto2num(struct Configurable *config, long *val, const char *str);\r\n\r\nParameterError str2offset(curl_off_t *val, const char *str);\r\n\r\nParameterError checkpasswd(const char *kind, char **userpwd);\r\n\r\nParameterError add2list(struct curl_slist **list, const char *ptr);\r\n\r\nint ftpfilemethod(struct Configurable *config, const char *str);\r\n\r\nint ftpcccmethod(struct Configurable *config, const char *str);\r\n\r\nlong delegation(struct Configurable *config, char *str);\r\n\r\n#endif /* HEADER_CURL_TOOL_PARAMHLP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_parsecfg.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_getparam.h\"\r\n#include \"tool_helpers.h\"\r\n#include \"tool_homedir.h\"\r\n#include \"tool_msgs.h\"\r\n#include \"tool_parsecfg.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#define CURLRC DOT_CHAR \"curlrc\"\r\n#define ISSEP(x) (((x) == '=') || ((x) == ':'))\r\n\r\nstatic const char *unslashquote(const char *line, char *param);\r\nstatic char *my_get_line(FILE *fp);\r\n\r\n/* return 0 on everything-is-fine, and non-zero otherwise */\r\nint parseconfig(const char *filename,\r\n                struct Configurable *config)\r\n{\r\n  int res;\r\n  FILE *file;\r\n  char filebuffer[512];\r\n  bool usedarg;\r\n  char *home;\r\n  int rc = 0;\r\n\r\n  if(!filename || !*filename) {\r\n    /* NULL or no file name attempts to load .curlrc from the homedir! */\r\n\r\n#ifndef __AMIGA__\r\n    filename = CURLRC;   /* sensible default */\r\n    home = homedir();    /* portable homedir finder */\r\n    if(home) {\r\n      if(strlen(home) < (sizeof(filebuffer) - strlen(CURLRC))) {\r\n        snprintf(filebuffer, sizeof(filebuffer),\r\n                 \"%s%s%s\", home, DIR_CHAR, CURLRC);\r\n\r\n#ifdef WIN32\r\n        /* Check if the file exists - if not, try CURLRC in the same\r\n         * directory as our executable\r\n         */\r\n        file = fopen(filebuffer, \"r\");\r\n        if(file != NULL) {\r\n          fclose(file);\r\n          filename = filebuffer;\r\n        }\r\n        else {\r\n          /* Get the filename of our executable. GetModuleFileName is\r\n           * already declared via inclusions done in setup header file.\r\n           * We assume that we are using the ASCII version here.\r\n           */\r\n          int n = GetModuleFileName(0, filebuffer, sizeof(filebuffer));\r\n          if(n > 0 && n < (int)sizeof(filebuffer)) {\r\n            /* We got a valid filename - get the directory part */\r\n            char *lastdirchar = strrchr(filebuffer, '\\\\');\r\n            if(lastdirchar) {\r\n              size_t remaining;\r\n              *lastdirchar = 0;\r\n              /* If we have enough space, build the RC filename */\r\n              remaining = sizeof(filebuffer) - strlen(filebuffer);\r\n              if(strlen(CURLRC) < remaining - 1) {\r\n                snprintf(lastdirchar, remaining,\r\n                         \"%s%s\", DIR_CHAR, CURLRC);\r\n                /* Don't bother checking if it exists - we do\r\n                 * that later\r\n                 */\r\n                filename = filebuffer;\r\n              }\r\n            }\r\n          }\r\n        }\r\n#else /* WIN32 */\r\n        filename = filebuffer;\r\n#endif /* WIN32 */\r\n      }\r\n      Curl_safefree(home); /* we've used it, now free it */\r\n    }\r\n\r\n# else /* __AMIGA__ */\r\n    /* On AmigaOS all the config files are into env:\r\n     */\r\n    filename = \"ENV:\" CURLRC;\r\n\r\n#endif\r\n  }\r\n\r\n  if(strcmp(filename,\"-\"))\r\n    file = fopen(filename, \"r\");\r\n  else\r\n    file = stdin;\r\n\r\n  if(file) {\r\n    char *line;\r\n    char *aline;\r\n    char *option;\r\n    char *param;\r\n    int lineno = 0;\r\n    bool alloced_param;\r\n\r\n    while(NULL != (aline = my_get_line(file))) {\r\n      lineno++;\r\n      line = aline;\r\n      alloced_param=FALSE;\r\n\r\n      /* line with # in the first non-blank column is a comment! */\r\n      while(*line && ISSPACE(*line))\r\n        line++;\r\n\r\n      switch(*line) {\r\n      case '#':\r\n      case '/':\r\n      case '\\r':\r\n      case '\\n':\r\n      case '*':\r\n      case '\\0':\r\n        Curl_safefree(aline);\r\n        continue;\r\n      }\r\n\r\n      /* the option keywords starts here */\r\n      option = line;\r\n      while(*line && !ISSPACE(*line) && !ISSEP(*line))\r\n        line++;\r\n      /* ... and has ended here */\r\n\r\n      if(*line)\r\n        *line++ = '\\0'; /* zero terminate, we have a local copy of the data */\r\n\r\n#ifdef DEBUG_CONFIG\r\n      fprintf(stderr, \"GOT: %s\\n\", option);\r\n#endif\r\n\r\n      /* pass spaces and separator(s) */\r\n      while(*line && (ISSPACE(*line) || ISSEP(*line)))\r\n        line++;\r\n\r\n      /* the parameter starts here (unless quoted) */\r\n      if(*line == '\\\"') {\r\n        /* quoted parameter, do the quote dance */\r\n        line++;\r\n        param = malloc(strlen(line) + 1); /* parameter */\r\n        if(!param) {\r\n          /* out of memory */\r\n          Curl_safefree(aline);\r\n          rc = 1;\r\n          break;\r\n        }\r\n        alloced_param = TRUE;\r\n        (void)unslashquote(line, param);\r\n      }\r\n      else {\r\n        param = line; /* parameter starts here */\r\n        while(*line && !ISSPACE(*line))\r\n          line++;\r\n        *line = '\\0'; /* zero terminate */\r\n      }\r\n\r\n      if(param && !*param) {\r\n        /* do this so getparameter can check for required parameters.\r\n           Otherwise it always thinks there's a parameter. */\r\n        if(alloced_param)\r\n          Curl_safefree(param);\r\n        param = NULL;\r\n      }\r\n\r\n#ifdef DEBUG_CONFIG\r\n      fprintf(stderr, \"PARAM: \\\"%s\\\"\\n\",(param ? param : \"(null)\"));\r\n#endif\r\n      res = getparameter(option, param, &usedarg, config);\r\n\r\n      if(param && *param && !usedarg)\r\n        /* we passed in a parameter that wasn't used! */\r\n        res = PARAM_GOT_EXTRA_PARAMETER;\r\n\r\n      if(res != PARAM_OK) {\r\n        /* the help request isn't really an error */\r\n        if(!strcmp(filename, \"-\")) {\r\n          filename = (char *)\"<stdin>\";\r\n        }\r\n        if(PARAM_HELP_REQUESTED != res) {\r\n          const char *reason = param2text(res);\r\n          warnf(config, \"%s:%d: warning: '%s' %s\\n\",\r\n                filename, lineno, option, reason);\r\n        }\r\n      }\r\n\r\n      if(alloced_param)\r\n        Curl_safefree(param);\r\n\r\n      Curl_safefree(aline);\r\n    }\r\n    if(file != stdin)\r\n      fclose(file);\r\n  }\r\n  else\r\n    rc = 1; /* couldn't open the file */\r\n\r\n  return rc;\r\n}\r\n\r\n/*\r\n * Copies the string from line to the buffer at param, unquoting\r\n * backslash-quoted characters and NUL-terminating the output string.\r\n * Stops at the first non-backslash-quoted double quote character or the\r\n * end of the input string. param must be at least as long as the input\r\n * string.  Returns the pointer after the last handled input character.\r\n */\r\nstatic const char *unslashquote(const char *line, char *param)\r\n{\r\n  while(*line && (*line != '\\\"')) {\r\n    if(*line == '\\\\') {\r\n      char out;\r\n      line++;\r\n\r\n      /* default is to output the letter after the backslash */\r\n      switch(out = *line) {\r\n      case '\\0':\r\n        continue; /* this'll break out of the loop */\r\n      case 't':\r\n        out = '\\t';\r\n        break;\r\n      case 'n':\r\n        out = '\\n';\r\n        break;\r\n      case 'r':\r\n        out = '\\r';\r\n        break;\r\n      case 'v':\r\n        out = '\\v';\r\n        break;\r\n      }\r\n      *param++ = out;\r\n      line++;\r\n    }\r\n    else\r\n      *param++ = *line++;\r\n  }\r\n  *param = '\\0'; /* always zero terminate */\r\n  return line;\r\n}\r\n\r\n/*\r\n * Reads a line from the given file, ensuring is NUL terminated.\r\n * The pointer must be freed by the caller.\r\n * NULL is returned on an out of memory condition.\r\n */\r\nstatic char *my_get_line(FILE *fp)\r\n{\r\n  char buf[4096];\r\n  char *nl = NULL;\r\n  char *retval = NULL;\r\n\r\n  do {\r\n    if(NULL == fgets(buf, sizeof(buf), fp))\r\n      break;\r\n    if(!retval) {\r\n      retval = strdup(buf);\r\n      if(!retval)\r\n        return NULL;\r\n    }\r\n    else {\r\n      char *ptr;\r\n      ptr = realloc(retval, strlen(retval) + strlen(buf) + 1);\r\n      if(!ptr) {\r\n        Curl_safefree(retval);\r\n        return NULL;\r\n      }\r\n      retval = ptr;\r\n      strcat(retval, buf);\r\n    }\r\n    nl = strchr(retval, '\\n');\r\n  } while(!nl);\r\n\r\n  if(nl)\r\n    *nl = '\\0';\r\n\r\n  return retval;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_parsecfg.h",
    "content": "#ifndef HEADER_CURL_TOOL_PARSECFG_H\r\n#define HEADER_CURL_TOOL_PARSECFG_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nint parseconfig(const char *filename,\r\n                struct Configurable *config);\r\n\r\n#endif /* HEADER_CURL_TOOL_PARSECFG_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_sdecls.h",
    "content": "#ifndef HEADER_CURL_TOOL_SDECLS_H\r\n#define HEADER_CURL_TOOL_SDECLS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n#ifdef USE_METALINK\r\n#  include <metalink/metalink.h>\r\n#endif /* USE_METALINK */\r\n\r\n/*\r\n * OutStruct variables keep track of information relative to curl's\r\n * output writing, which may take place to a standard stream or a file.\r\n *\r\n * 'filename' member is either a pointer to a file name string or NULL\r\n * when dealing with a standard stream.\r\n *\r\n * 'alloc_filename' member is TRUE when string pointed by 'filename' has been\r\n * dynamically allocated and 'belongs' to this OutStruct, otherwise FALSE.\r\n *\r\n * 'is_cd_filename' member is TRUE when string pointed by 'filename' has been\r\n * set using a server-specified Content-Disposition filename, otherwise FALSE.\r\n *\r\n * 's_isreg' member is TRUE when output goes to a regular file, this also\r\n * implies that output is 'seekable' and 'appendable' and also that member\r\n * 'filename' points to file name's string. For any standard stream member\r\n * 's_isreg' will be FALSE.\r\n *\r\n * 'fopened' member is TRUE when output goes to a regular file and it\r\n * has been fopen'ed, requiring it to be closed later on. In any other\r\n * case this is FALSE.\r\n *\r\n * 'stream' member is a pointer to a stream controlling object as returned\r\n * from a 'fopen' call or a standard stream.\r\n *\r\n * 'config' member is a pointer to associated 'Configurable' struct.\r\n *\r\n * 'bytes' member represents amount written so far.\r\n *\r\n * 'init' member holds original file size or offset at which truncation is\r\n * taking place. Always zero unless appending to a non-empty regular file.\r\n *\r\n * 'metalink_parser' member is a pointer to Metalink XML parser\r\n * context.\r\n */\r\n\r\nstruct OutStruct {\r\n  char *filename;\r\n  bool alloc_filename;\r\n  bool is_cd_filename;\r\n  bool s_isreg;\r\n  bool fopened;\r\n  FILE *stream;\r\n  struct Configurable *config;\r\n  curl_off_t bytes;\r\n  curl_off_t init;\r\n#ifdef USE_METALINK\r\n  metalink_parser_context_t *metalink_parser;\r\n#endif /* USE_METALINK */\r\n};\r\n\r\n\r\n/*\r\n * InStruct variables keep track of information relative to curl's\r\n * input reading, which may take place from stdin or from some file.\r\n *\r\n * 'fd' member is either 'stdin' file descriptor number STDIN_FILENO\r\n * or a file descriptor as returned from an 'open' call for some file.\r\n *\r\n * 'config' member is a pointer to associated 'Configurable' struct.\r\n */\r\n\r\nstruct InStruct {\r\n  int fd;\r\n  struct Configurable *config;\r\n};\r\n\r\n\r\n/*\r\n * A linked list of these 'getout' nodes contain URL's to fetch,\r\n * as well as information relative to where URL contents should\r\n * be stored or which file should be uploaded.\r\n */\r\n\r\nstruct getout {\r\n  struct getout *next;      /* next one */\r\n  char          *url;       /* the URL we deal with */\r\n  char          *outfile;   /* where to store the output */\r\n  char          *infile;    /* file to upload, if GETOUT_UPLOAD is set */\r\n  int            flags;     /* options - composed of GETOUT_* bits */\r\n};\r\n\r\n#define GETOUT_OUTFILE    (1<<0)  /* set when outfile is deemed done */\r\n#define GETOUT_URL        (1<<1)  /* set when URL is deemed done */\r\n#define GETOUT_USEREMOTE  (1<<2)  /* use remote file name locally */\r\n#define GETOUT_UPLOAD     (1<<3)  /* if set, -T has been used */\r\n#define GETOUT_NOUPLOAD   (1<<4)  /* if set, -T \"\" has been used */\r\n#define GETOUT_METALINK   (1<<5)  /* set when Metalink download */\r\n\r\n/*\r\n * 'trace' enumeration represents curl's output look'n feel possibilities.\r\n */\r\n\r\ntypedef enum {\r\n  TRACE_NONE,  /* no trace/verbose output at all */\r\n  TRACE_BIN,   /* tcpdump inspired look */\r\n  TRACE_ASCII, /* like *BIN but without the hex output */\r\n  TRACE_PLAIN  /* -v/--verbose type */\r\n} trace;\r\n\r\n\r\n/*\r\n * 'HttpReq' enumeration represents HTTP request types.\r\n */\r\n\r\ntypedef enum {\r\n  HTTPREQ_UNSPEC,  /* first in list */\r\n  HTTPREQ_GET,\r\n  HTTPREQ_HEAD,\r\n  HTTPREQ_POST,\r\n  HTTPREQ_SIMPLEPOST,\r\n  HTTPREQ_CUSTOM,\r\n  HTTPREQ_LAST     /* last in list */\r\n} HttpReq;\r\n\r\n\r\n/*\r\n * Complete struct declarations which have Configurable struct members,\r\n * just in case this header is directly included in some source file.\r\n */\r\n\r\n#include \"tool_cfgable.h\"\r\n\r\n#endif /* HEADER_CURL_TOOL_SDECLS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_setopt.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n/* use our own printf() functions */\r\n#include \"curlx.h\"\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_easysrc.h\"\r\n#include \"tool_setopt.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n/* Lookup tables for converting setopt values back to symbols */\r\n/* For enums, values may be in any order. */\r\n/* For bit masks, put combinations first, then single bits, */\r\n/* and finally any \"NONE\" value. */\r\n\r\n#define NV(e) {#e, e}\r\n#define NV1(e, v) {#e, (v)}\r\n#define NVEND {NULL, 0}         /* sentinel to mark end of list */\r\n\r\nconst NameValue setopt_nv_CURLPROXY[] = {\r\n  NV(CURLPROXY_HTTP),\r\n  NV(CURLPROXY_HTTP_1_0),\r\n  NV(CURLPROXY_SOCKS4),\r\n  NV(CURLPROXY_SOCKS5),\r\n  NV(CURLPROXY_SOCKS4A),\r\n  NV(CURLPROXY_SOCKS5_HOSTNAME),\r\n  NVEND,\r\n};\r\n\r\nconst NameValueUnsigned setopt_nv_CURLAUTH[] = {\r\n  NV(CURLAUTH_ANY),             /* combination */\r\n  NV(CURLAUTH_ANYSAFE),         /* combination */\r\n  NV(CURLAUTH_BASIC),\r\n  NV(CURLAUTH_DIGEST),\r\n  NV(CURLAUTH_GSSNEGOTIATE),\r\n  NV(CURLAUTH_NTLM),\r\n  NV(CURLAUTH_DIGEST_IE),\r\n  NV(CURLAUTH_NTLM_WB),\r\n  NV(CURLAUTH_ONLY),\r\n  NV(CURLAUTH_NONE),\r\n  NVEND,\r\n};\r\n\r\nconst NameValue setopt_nv_CURL_HTTP_VERSION[] = {\r\n  NV(CURL_HTTP_VERSION_NONE),\r\n  NV(CURL_HTTP_VERSION_1_0),\r\n  NV(CURL_HTTP_VERSION_1_1),\r\n  NVEND,\r\n};\r\n\r\nconst NameValue setopt_nv_CURL_SSLVERSION[] = {\r\n  NV(CURL_SSLVERSION_DEFAULT),\r\n  NV(CURL_SSLVERSION_TLSv1),\r\n  NV(CURL_SSLVERSION_SSLv2),\r\n  NV(CURL_SSLVERSION_SSLv3),\r\n  NVEND,\r\n};\r\n\r\nconst NameValue setopt_nv_CURL_TIMECOND[] = {\r\n  NV(CURL_TIMECOND_IFMODSINCE),\r\n  NV(CURL_TIMECOND_IFUNMODSINCE),\r\n  NV(CURL_TIMECOND_LASTMOD),\r\n  NV(CURL_TIMECOND_NONE),\r\n  NVEND,\r\n};\r\n\r\nconst NameValue setopt_nv_CURLFTPSSL_CCC[] = {\r\n  NV(CURLFTPSSL_CCC_NONE),\r\n  NV(CURLFTPSSL_CCC_PASSIVE),\r\n  NV(CURLFTPSSL_CCC_ACTIVE),\r\n  NVEND,\r\n};\r\n\r\n/* These mappings essentially triplicated - see\r\n * tool_libinfo.c and tool_paramhlp.c */\r\nconst NameValue setopt_nv_CURLPROTO[] = {\r\n  NV(CURLPROTO_ALL),            /* combination */\r\n  NV(CURLPROTO_DICT),\r\n  NV(CURLPROTO_FILE),\r\n  NV(CURLPROTO_FTP),\r\n  NV(CURLPROTO_FTPS),\r\n  NV(CURLPROTO_GOPHER),\r\n  NV(CURLPROTO_HTTP),\r\n  NV(CURLPROTO_HTTPS),\r\n  NV(CURLPROTO_IMAP),\r\n  NV(CURLPROTO_IMAPS),\r\n  NV(CURLPROTO_LDAP),\r\n  NV(CURLPROTO_LDAPS),\r\n  NV(CURLPROTO_POP3),\r\n  NV(CURLPROTO_POP3S),\r\n  NV(CURLPROTO_RTSP),\r\n  NV(CURLPROTO_SCP),\r\n  NV(CURLPROTO_SFTP),\r\n  NV(CURLPROTO_SMTP),\r\n  NV(CURLPROTO_SMTPS),\r\n  NV(CURLPROTO_TELNET),\r\n  NV(CURLPROTO_TFTP),\r\n  NVEND,\r\n};\r\n\r\n/* These options have non-zero default values. */\r\nstatic const NameValue setopt_nv_CURLNONZERODEFAULTS[] = {\r\n  NV1(CURLOPT_SSL_VERIFYPEER, 1),\r\n  NV1(CURLOPT_SSL_VERIFYHOST, 1),\r\n  NVEND\r\n};\r\n\r\n/* Format and add code; jump to nomem on malloc error */\r\n#define ADD(args) do { \\\r\n  ret = easysrc_add args; \\\r\n  if(ret) \\\r\n    goto nomem; \\\r\n} WHILE_FALSE\r\n#define ADDF(args) do { \\\r\n  ret = easysrc_addf args; \\\r\n  if(ret) \\\r\n    goto nomem; \\\r\n} WHILE_FALSE\r\n\r\n#define DECL0(s) ADD((&easysrc_decl, s))\r\n#define DECL1(f,a) ADDF((&easysrc_decl, f,a))\r\n\r\n#define DATA0(s) ADD((&easysrc_data, s))\r\n#define DATA1(f,a) ADDF((&easysrc_data, f,a))\r\n#define DATA2(f,a,b) ADDF((&easysrc_data, f,a,b))\r\n#define DATA3(f,a,b,c) ADDF((&easysrc_data, f,a,b,c))\r\n\r\n#define CODE0(s) ADD((&easysrc_code, s))\r\n#define CODE1(f,a) ADDF((&easysrc_code, f,a))\r\n#define CODE2(f,a,b) ADDF((&easysrc_code, f,a,b))\r\n#define CODE3(f,a,b,c) ADDF((&easysrc_code, f,a,b,c))\r\n\r\n#define CLEAN0(s) ADD((&easysrc_clean, s))\r\n#define CLEAN1(f,a) ADDF((&easysrc_clean, f,a))\r\n\r\n#define REM0(s) ADD((&easysrc_toohard, s))\r\n#define REM1(f,a) ADDF((&easysrc_toohard, f,a))\r\n#define REM2(f,a,b) ADDF((&easysrc_toohard, f,a,b))\r\n\r\n/* Escape string to C string syntax.  Return NULL if out of memory.\r\n * Is this correct for those wacky EBCDIC guys? */\r\nstatic char *c_escape(const char *str)\r\n{\r\n  size_t len = 0;\r\n  const char *s;\r\n  unsigned char c;\r\n  char *escaped, *e;\r\n  /* Allocate space based on worst-case */\r\n  len = strlen(str);\r\n  escaped = malloc(4 * len + 1);\r\n  if(!escaped)\r\n    return NULL;\r\n\r\n  e = escaped;\r\n  for(s=str; (c=*s) != '\\0'; s++) {\r\n    if(c=='\\n') {\r\n      strcpy(e, \"\\\\n\");\r\n      e += 2;\r\n    }\r\n    else if(c=='\\r') {\r\n      strcpy(e, \"\\\\r\");\r\n      e += 2;\r\n    }\r\n    else if(c=='\\t') {\r\n      strcpy(e, \"\\\\t\");\r\n      e += 2;\r\n    }\r\n    else if(c=='\\\\') {\r\n      strcpy(e, \"\\\\\\\\\");\r\n      e += 2;\r\n    }\r\n    else if(c=='\"') {\r\n      strcpy(e, \"\\\\\\\"\");\r\n      e += 2;\r\n    }\r\n    else if(! isprint(c)) {\r\n      sprintf(e, \"\\\\%03o\", c);\r\n      e += 4;\r\n    }\r\n    else\r\n      *e++ = c;\r\n  }\r\n  *e = '\\0';\r\n  return escaped;\r\n}\r\n\r\n/* setopt wrapper for enum types */\r\nCURLcode tool_setopt_enum(CURL *curl, struct Configurable *config,\r\n                          const char *name, CURLoption tag,\r\n                          const NameValue *nvlist, long lval)\r\n{\r\n  CURLcode ret = CURLE_OK;\r\n  bool skip = FALSE;\r\n\r\n  ret = curl_easy_setopt(curl, tag, lval);\r\n  if(!lval)\r\n    skip = TRUE;\r\n\r\n  if(config->libcurl && !skip && !ret) {\r\n    /* we only use this for real if --libcurl was used */\r\n    const NameValue *nv = NULL;\r\n    for(nv=nvlist; nv->name; nv++) {\r\n      if(nv->value == lval) break; /* found it */\r\n    }\r\n    if(! nv->name) {\r\n      /* If no definition was found, output an explicit value.\r\n       * This could happen if new values are defined and used\r\n       * but the NameValue list is not updated. */\r\n      CODE2(\"curl_easy_setopt(hnd, %s, %ldL);\", name, lval);\r\n    }\r\n    else {\r\n      CODE2(\"curl_easy_setopt(hnd, %s, (long)%s);\", name, nv->name);\r\n    }\r\n  }\r\n\r\n nomem:\r\n  return ret;\r\n}\r\n\r\n/* setopt wrapper for flags */\r\nCURLcode tool_setopt_flags(CURL *curl, struct Configurable *config,\r\n                           const char *name, CURLoption tag,\r\n                           const NameValue *nvlist, long lval)\r\n{\r\n  CURLcode ret = CURLE_OK;\r\n  bool skip = FALSE;\r\n\r\n  ret = curl_easy_setopt(curl, tag, lval);\r\n  if(!lval)\r\n    skip = TRUE;\r\n\r\n  if(config->libcurl && !skip && !ret) {\r\n    /* we only use this for real if --libcurl was used */\r\n    char preamble[80];          /* should accommodate any symbol name */\r\n    long rest = lval;           /* bits not handled yet */\r\n    const NameValue *nv = NULL;\r\n    snprintf(preamble, sizeof(preamble),\r\n             \"curl_easy_setopt(hnd, %s, \", name);\r\n    for(nv=nvlist; nv->name; nv++) {\r\n      if((nv->value & ~ rest) == 0) {\r\n        /* all value flags contained in rest */\r\n        rest &= ~ nv->value;    /* remove bits handled here */\r\n        CODE3(\"%s(long)%s%s\",\r\n              preamble, nv->name, rest ? \" |\" : \");\");\r\n        if(!rest)\r\n          break;                /* handled them all */\r\n        /* replace with all spaces for continuation line */\r\n        sprintf(preamble, \"%*s\", strlen(preamble), \"\");\r\n      }\r\n    }\r\n    /* If any bits have no definition, output an explicit value.\r\n     * This could happen if new bits are defined and used\r\n     * but the NameValue list is not updated. */\r\n    if(rest)\r\n      CODE2(\"%s%ldL);\", preamble, rest);\r\n  }\r\n\r\n nomem:\r\n  return ret;\r\n}\r\n\r\n/* setopt wrapper for bitmasks */\r\nCURLcode tool_setopt_bitmask(CURL *curl, struct Configurable *config,\r\n                             const char *name, CURLoption tag,\r\n                             const NameValueUnsigned *nvlist,\r\n                             long lval)\r\n{\r\n  CURLcode ret = CURLE_OK;\r\n  bool skip = FALSE;\r\n\r\n  ret = curl_easy_setopt(curl, tag, lval);\r\n  if(!lval)\r\n    skip = TRUE;\r\n\r\n  if(config->libcurl && !skip && !ret) {\r\n    /* we only use this for real if --libcurl was used */\r\n    char preamble[80];\r\n    unsigned long rest = (unsigned long)lval;\r\n    const NameValueUnsigned *nv = NULL;\r\n    snprintf(preamble, sizeof(preamble),\r\n             \"curl_easy_setopt(hnd, %s, \", name);\r\n    for(nv=nvlist; nv->name; nv++) {\r\n      if((nv->value & ~ rest) == 0) {\r\n        /* all value flags contained in rest */\r\n        rest &= ~ nv->value;    /* remove bits handled here */\r\n        CODE3(\"%s(long)%s%s\",\r\n              preamble, nv->name, rest ? \" |\" : \");\");\r\n        if(!rest)\r\n          break;                /* handled them all */\r\n        /* replace with all spaces for continuation line */\r\n        sprintf(preamble, \"%*s\", strlen(preamble), \"\");\r\n      }\r\n    }\r\n    /* If any bits have no definition, output an explicit value.\r\n     * This could happen if new bits are defined and used\r\n     * but the NameValue list is not updated. */\r\n    if(rest)\r\n      CODE2(\"%s%luUL);\", preamble, rest);\r\n  }\r\n\r\n nomem:\r\n  return ret;\r\n}\r\n\r\n/* setopt wrapper for CURLOPT_HTTPPOST */\r\nCURLcode tool_setopt_httppost(CURL *curl, struct Configurable *config,\r\n                              const char *name, CURLoption tag,\r\n                              struct curl_httppost *post)\r\n{\r\n  CURLcode ret = CURLE_OK;\r\n  char *escaped = NULL;\r\n  bool skip = FALSE;\r\n\r\n  ret = curl_easy_setopt(curl, tag, post);\r\n  if(!post)\r\n    skip = TRUE;\r\n\r\n  if(config->libcurl && !skip && !ret) {\r\n    struct curl_httppost *pp, *p;\r\n    int i;\r\n    /* May use several httppost lists, if multiple POST actions */\r\n    i = ++ easysrc_form_count;\r\n    DECL1(\"struct curl_httppost *post%d;\", i);\r\n    DATA1(\"post%d = NULL;\", i);\r\n    CLEAN1(\"curl_formfree(post%d);\", i);\r\n    CLEAN1(\"post%d = NULL;\", i);\r\n    if(i == 1)\r\n      DECL0(\"struct curl_httppost *postend;\");\r\n    DATA0(\"postend = NULL;\");\r\n    for(p=post; p; p=p->next) {\r\n      DATA1(\"curl_formadd(&post%d, &postend,\", i);\r\n      DATA1(\"             CURLFORM_COPYNAME, \\\"%s\\\",\", p->name);\r\n      for(pp=p; pp; pp=pp->more) {\r\n        /* May be several files uploaded for one name;\r\n         * these are linked through the 'more' pointer */\r\n        Curl_safefree(escaped);\r\n        escaped = c_escape(pp->contents);\r\n        if(!escaped) {\r\n          ret = CURLE_OUT_OF_MEMORY;\r\n          goto nomem;\r\n        }\r\n        if(pp->flags & HTTPPOST_FILENAME) {\r\n          /* file upload as for -F @filename */\r\n          DATA1(\"             CURLFORM_FILE, \\\"%s\\\",\", escaped);\r\n        }\r\n        else if(pp->flags & HTTPPOST_READFILE) {\r\n          /* content from file as for -F <filename */\r\n          DATA1(\"             CURLFORM_FILECONTENT, \\\"%s\\\",\", escaped);\r\n        }\r\n        else\r\n          DATA1(\"             CURLFORM_COPYCONTENTS, \\\"%s\\\",\", escaped);\r\n        if(pp->showfilename) {\r\n          Curl_safefree(escaped);\r\n          escaped = c_escape(pp->showfilename);\r\n          if(!escaped) {\r\n            ret = CURLE_OUT_OF_MEMORY;\r\n            goto nomem;\r\n          }\r\n          DATA1(\"             CURLFORM_FILENAME, \\\"%s\\\",\", escaped);\r\n        }\r\n        if(pp->contenttype) {\r\n          Curl_safefree(escaped);\r\n          escaped = c_escape(pp->contenttype);\r\n          if(!escaped) {\r\n            ret = CURLE_OUT_OF_MEMORY;\r\n            goto nomem;\r\n          }\r\n          DATA1(\"             CURLFORM_CONTENTTYPE, \\\"%s\\\",\", escaped);\r\n        }\r\n      }\r\n      DATA0(\"             CURLFORM_END);\");\r\n    }\r\n    CODE2(\"curl_easy_setopt(hnd, %s, post%d);\", name, i);\r\n  }\r\n\r\n nomem:\r\n  Curl_safefree(escaped);\r\n  return ret;\r\n}\r\n\r\n/* setopt wrapper for curl_slist options */\r\nCURLcode tool_setopt_slist(CURL *curl, struct Configurable *config,\r\n                           const char *name, CURLoption tag,\r\n                           struct curl_slist *list)\r\n{\r\n  CURLcode ret = CURLE_OK;\r\n  char *escaped = NULL;\r\n  bool skip = FALSE;\r\n\r\n  ret = curl_easy_setopt(curl, tag, list);\r\n  if(!list)\r\n    skip = TRUE;\r\n\r\n  if(config->libcurl && !skip && !ret) {\r\n    struct curl_slist *s;\r\n    int i;\r\n    /* May need several slist variables, so invent name */\r\n    i = ++ easysrc_slist_count;\r\n    DECL1(\"struct curl_slist *slist%d;\", i);\r\n    DATA1(\"slist%d = NULL;\", i);\r\n    CLEAN1(\"curl_slist_free_all(slist%d);\", i);\r\n    CLEAN1(\"slist%d = NULL;\", i);\r\n    for(s=list; s; s=s->next) {\r\n      Curl_safefree(escaped);\r\n      escaped = c_escape(s->data);\r\n      if(!escaped) {\r\n        ret = CURLE_OUT_OF_MEMORY;\r\n        goto nomem;\r\n      }\r\n      DATA3(\"slist%d = curl_slist_append(slist%d, \\\"%s\\\");\", i, i, escaped);\r\n    }\r\n    CODE2(\"curl_easy_setopt(hnd, %s, slist%d);\", name, i);\r\n  }\r\n\r\n nomem:\r\n  Curl_safefree(escaped);\r\n  return ret;\r\n}\r\n\r\n/* generic setopt wrapper for all other options.\r\n * Some type information is encoded in the tag value. */\r\nCURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,\r\n                     const char *name, CURLoption tag, ...)\r\n{\r\n  va_list arg;\r\n  char buf[256];\r\n  const char *value = NULL;\r\n  bool remark = FALSE;\r\n  bool skip = FALSE;\r\n  bool escape = FALSE;\r\n  char *escaped = NULL;\r\n  CURLcode ret = CURLE_OK;\r\n\r\n  va_start(arg, tag);\r\n\r\n  if(tag < CURLOPTTYPE_OBJECTPOINT) {\r\n    /* Value is expected to be a long */\r\n    long lval = va_arg(arg, long);\r\n    long defval = 0L;\r\n    const NameValue *nv = NULL;\r\n    for(nv=setopt_nv_CURLNONZERODEFAULTS; nv->name; nv++) {\r\n      if(!strcmp(name, nv->name)) {\r\n        defval = nv->value;\r\n        break; /* found it */\r\n      }\r\n    }\r\n\r\n    snprintf(buf, sizeof(buf), \"%ldL\", lval);\r\n    value = buf;\r\n    ret = curl_easy_setopt(curl, tag, lval);\r\n    if(lval == defval)\r\n      skip = TRUE;\r\n  }\r\n  else if(tag < CURLOPTTYPE_OFF_T) {\r\n    /* Value is some sort of object pointer */\r\n    void *pval = va_arg(arg, void *);\r\n\r\n    /* function pointers are never printable */\r\n    if(tag >= CURLOPTTYPE_FUNCTIONPOINT) {\r\n      if(pval) {\r\n        value = \"functionpointer\";\r\n        remark = TRUE;\r\n      }\r\n      else\r\n        skip = TRUE;\r\n    }\r\n\r\n    else if(pval && str) {\r\n      value = (char *)pval;\r\n      escape = TRUE;\r\n    }\r\n    else if(pval) {\r\n      value = \"objectpointer\";\r\n      remark = TRUE;\r\n    }\r\n    else\r\n      skip = TRUE;\r\n\r\n    ret = curl_easy_setopt(curl, tag, pval);\r\n\r\n  }\r\n  else {\r\n    /* Value is expected to be curl_off_t */\r\n    curl_off_t oval = va_arg(arg, curl_off_t);\r\n    snprintf(buf, sizeof(buf),\r\n             \"(curl_off_t)%\" CURL_FORMAT_CURL_OFF_T, oval);\r\n    value = buf;\r\n    ret = curl_easy_setopt(curl, tag, oval);\r\n\r\n    if(!oval)\r\n      skip = TRUE;\r\n  }\r\n\r\n  va_end(arg);\r\n\r\n  if(config->libcurl && !skip && !ret) {\r\n    /* we only use this for real if --libcurl was used */\r\n\r\n    if(remark)\r\n      REM2(\"%s set to a %s\", name, value);\r\n    else {\r\n      if(escape) {\r\n        escaped = c_escape(value);\r\n        if(!escaped) {\r\n          ret = CURLE_OUT_OF_MEMORY;\r\n          goto nomem;\r\n        }\r\n        CODE2(\"curl_easy_setopt(hnd, %s, \\\"%s\\\");\", name, escaped);\r\n      }\r\n      else\r\n        CODE2(\"curl_easy_setopt(hnd, %s, %s);\", name, value);\r\n    }\r\n  }\r\n\r\n nomem:\r\n  Curl_safefree(escaped);\r\n  return ret;\r\n}\r\n\r\n#endif /* CURL_DISABLE_LIBCURL_OPTION */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_setopt.h",
    "content": "#ifndef HEADER_CURL_TOOL_SETOPT_H\r\n#define HEADER_CURL_TOOL_SETOPT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n/*\r\n * Macros used in operate()\r\n */\r\n\r\n#define SETOPT_CHECK(v) do { \\\r\n  res = (v); \\\r\n  if(res) \\\r\n    goto show_error; \\\r\n} WHILE_FALSE\r\n\r\n#ifndef CURL_DISABLE_LIBCURL_OPTION\r\n\r\n/* Associate symbolic names with option values */\r\ntypedef struct {\r\n  const char *name;\r\n  long value;\r\n} NameValue;\r\n\r\ntypedef struct {\r\n  const char *name;\r\n  unsigned long value;\r\n} NameValueUnsigned;\r\n\r\nextern const NameValue setopt_nv_CURLPROXY[];\r\nextern const NameValue setopt_nv_CURL_HTTP_VERSION[];\r\nextern const NameValue setopt_nv_CURL_SSLVERSION[];\r\nextern const NameValue setopt_nv_CURL_TIMECOND[];\r\nextern const NameValue setopt_nv_CURLFTPSSL_CCC[];\r\nextern const NameValue setopt_nv_CURLPROTO[];\r\nextern const NameValueUnsigned setopt_nv_CURLAUTH[];\r\n\r\n/* Map options to NameValue sets */\r\n#define setopt_nv_CURLOPT_HTTP_VERSION setopt_nv_CURL_HTTP_VERSION\r\n#define setopt_nv_CURLOPT_HTTPAUTH setopt_nv_CURLAUTH\r\n#define setopt_nv_CURLOPT_SSLVERSION setopt_nv_CURL_SSLVERSION\r\n#define setopt_nv_CURLOPT_TIMECONDITION setopt_nv_CURL_TIMECOND\r\n#define setopt_nv_CURLOPT_FTP_SSL_CCC setopt_nv_CURLFTPSSL_CCC\r\n#define setopt_nv_CURLOPT_PROTOCOLS setopt_nv_CURLPROTO\r\n#define setopt_nv_CURLOPT_REDIR_PROTOCOLS setopt_nv_CURLPROTO\r\n#define setopt_nv_CURLOPT_PROXYTYPE setopt_nv_CURLPROXY\r\n#define setopt_nv_CURLOPT_PROXYAUTH setopt_nv_CURLAUTH\r\n\r\n/* Intercept setopt calls for --libcurl */\r\n\r\nCURLcode tool_setopt_enum(CURL *curl, struct Configurable *config,\r\n                          const char *name, CURLoption tag,\r\n                          const NameValue *nv, long lval);\r\nCURLcode tool_setopt_flags(CURL *curl, struct Configurable *config,\r\n                           const char *name, CURLoption tag,\r\n                           const NameValue *nv, long lval);\r\nCURLcode tool_setopt_bitmask(CURL *curl, struct Configurable *config,\r\n                             const char *name, CURLoption tag,\r\n                             const NameValueUnsigned *nv, long lval);\r\nCURLcode tool_setopt_httppost(CURL *curl, struct Configurable *config,\r\n                              const char *name, CURLoption tag,\r\n                              struct curl_httppost *httppost);\r\nCURLcode tool_setopt_slist(CURL *curl, struct Configurable *config,\r\n                           const char *name, CURLoption tag,\r\n                           struct curl_slist *list);\r\nCURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,\r\n                     const char *name, CURLoption tag, ...);\r\n\r\n#define my_setopt(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt(x, FALSE, config, #y, y, z))\r\n\r\n#define my_setopt_str(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt(x, TRUE, config, #y, y, z))\r\n\r\n#define my_setopt_enum(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt_enum(x, config, #y, y, setopt_nv_ ## y, z))\r\n\r\n#define my_setopt_flags(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt_flags(x, config, #y, y, setopt_nv_ ## y, z))\r\n\r\n#define my_setopt_bitmask(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt_bitmask(x, config, #y, y, setopt_nv_ ## y, z))\r\n\r\n#define my_setopt_httppost(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt_httppost(x, config, #y, y, z))\r\n\r\n#define my_setopt_slist(x,y,z) \\\r\n  SETOPT_CHECK(tool_setopt_slist(x, config, #y, y, z))\r\n\r\n#define res_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)\r\n\r\n#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, config, #y, y, z)\r\n\r\n#else /* CURL_DISABLE_LIBCURL_OPTION */\r\n\r\n/* No --libcurl, so pass options directly to library */\r\n\r\n#define my_setopt(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define my_setopt_str(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define my_setopt_enum(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define my_setopt_flags(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define my_setopt_bitmask(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define my_setopt_httppost(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define my_setopt_slist(x,y,z) \\\r\n  SETOPT_CHECK(curl_easy_setopt(x, y, z))\r\n\r\n#define res_setopt(x,y,z) curl_easy_setopt(x,y,z)\r\n\r\n#define res_setopt_str(x,y,z) curl_easy_setopt(x,y,z)\r\n\r\n#endif /* CURL_DISABLE_LIBCURL_OPTION */\r\n\r\n#endif /* HEADER_CURL_TOOL_SETOPT_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_setup.h",
    "content": "#ifndef HEADER_CURL_TOOL_SETUP_H\r\n#define HEADER_CURL_TOOL_SETUP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#define CURL_NO_OLDIES\r\n\r\n/*\r\n * curl_setup.h may define preprocessor macros such as _FILE_OFFSET_BITS and\r\n * _LARGE_FILES in order to support files larger than 2 GB. On platforms\r\n * where this happens it is mandatory that these macros are defined before\r\n * any system header file is included, otherwise file handling function\r\n * prototypes will be misdeclared and curl tool may not build properly;\r\n * therefore we must include curl_setup.h before curl.h when building curl.\r\n */\r\n\r\n#include \"curl_setup.h\" /* from the lib directory */\r\n\r\n/*\r\n * curl tool certainly uses libcurl's external interface.\r\n */\r\n\r\n#include <curl/curl.h> /* external interface */\r\n\r\n/*\r\n * Platform specific stuff.\r\n */\r\n\r\n#if defined(macintosh) && defined(__MRC__)\r\n#  define main(x,y) curl_main(x,y)\r\n#endif\r\n\r\n#ifdef TPF\r\n#  undef select\r\n   /* change which select is used for the curl command line tool */\r\n#  define select(a,b,c,d,e) tpf_select_bsd(a,b,c,d,e)\r\n   /* and turn off the progress meter */\r\n#  define CONF_DEFAULT (0|CONF_NOPROGRESS)\r\n#endif\r\n\r\n#ifndef OS\r\n#  define OS \"unknown\"\r\n#endif\r\n\r\n#ifndef UNPRINTABLE_CHAR\r\n   /* define what to use for unprintable characters */\r\n#  define UNPRINTABLE_CHAR '.'\r\n#endif\r\n\r\n#ifndef HAVE_STRDUP\r\n#  include \"strdup.h\"\r\n#  define strdup(ptr) curlx_strdup(ptr)\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_SETUP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_sleep.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef HAVE_SYS_SELECT_H\r\n#  include <sys/select.h>\r\n#endif\r\n\r\n#ifdef HAVE_SYS_POLL_H\r\n#  include <sys/poll.h>\r\n#elif defined(HAVE_POLL_H)\r\n#  include <poll.h>\r\n#endif\r\n\r\n#ifdef MSDOS\r\n#  include <dos.h>\r\n#endif\r\n\r\n#include \"tool_sleep.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nvoid tool_go_sleep(long ms)\r\n{\r\n#if defined(MSDOS)\r\n  delay(ms);\r\n#elif defined(WIN32)\r\n  Sleep(ms);\r\n#elif defined(HAVE_POLL_FINE)\r\n  poll((void *)0, 0, (int)ms);\r\n#else\r\n  struct timeval timeout;\r\n  timeout.tv_sec = ms / 1000L;\r\n  ms = ms % 1000L;\r\n  timeout.tv_usec = ms * 1000L;\r\n  select(0, NULL,  NULL, NULL, &timeout);\r\n#endif\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_sleep.h",
    "content": "#ifndef HEADER_CURL_TOOL_SLEEP_H\r\n#define HEADER_CURL_TOOL_SLEEP_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nvoid tool_go_sleep(long ms);\r\n\r\n#endif /* HEADER_CURL_TOOL_SLEEP_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_urlglob.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"tool_urlglob.h\"\r\n#include \"tool_vms.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\ntypedef enum {\r\n  GLOB_OK,\r\n  GLOB_NO_MEM,\r\n  GLOB_ERROR\r\n} GlobCode;\r\n\r\n/*\r\n * glob_word()\r\n *\r\n * Input a full globbed string, set the forth argument to the amount of\r\n * strings we get out of this. Return GlobCode.\r\n */\r\nstatic GlobCode glob_word(URLGlob *, /* object anchor */\r\n                          char *,    /* globbed string */\r\n                          size_t,       /* position */\r\n                          int *);    /* returned number of strings */\r\n\r\nstatic GlobCode glob_set(URLGlob *glob, char *pattern,\r\n                         size_t pos, int *amount)\r\n{\r\n  /* processes a set expression with the point behind the opening '{'\r\n     ','-separated elements are collected until the next closing '}'\r\n  */\r\n  URLPattern *pat;\r\n  GlobCode res;\r\n  bool done = FALSE;\r\n  char* buf = glob->glob_buffer;\r\n\r\n  pat = &glob->pattern[glob->size / 2];\r\n  /* patterns 0,1,2,... correspond to size=1,3,5,... */\r\n  pat->type = UPTSet;\r\n  pat->content.Set.size = 0;\r\n  pat->content.Set.ptr_s = 0;\r\n  pat->content.Set.elements = NULL;\r\n\r\n  if(++glob->size > (GLOB_PATTERN_NUM*2)) {\r\n    snprintf(glob->errormsg, sizeof(glob->errormsg), \"too many globs used\\n\");\r\n    return GLOB_ERROR;\r\n  }\r\n\r\n  while(!done) {\r\n    switch (*pattern) {\r\n    case '\\0':                  /* URL ended while set was still open */\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"unmatched brace at pos %zu\\n\", pos);\r\n      return GLOB_ERROR;\r\n\r\n    case '{':\r\n    case '[':                   /* no nested expressions at this time */\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"nested braces not supported at pos %zu\\n\", pos);\r\n      return GLOB_ERROR;\r\n\r\n    case ',':\r\n    case '}':                           /* set element completed */\r\n      *buf = '\\0';\r\n      if(pat->content.Set.elements) {\r\n        char **new_arr = realloc(pat->content.Set.elements,\r\n                                 (pat->content.Set.size + 1) * sizeof(char*));\r\n        if(!new_arr) {\r\n          short elem;\r\n          for(elem = 0; elem < pat->content.Set.size; elem++)\r\n            Curl_safefree(pat->content.Set.elements[elem]);\r\n          Curl_safefree(pat->content.Set.elements);\r\n          pat->content.Set.ptr_s = 0;\r\n          pat->content.Set.size = 0;\r\n        }\r\n        pat->content.Set.elements = new_arr;\r\n      }\r\n      else\r\n        pat->content.Set.elements = malloc(sizeof(char*));\r\n      if(!pat->content.Set.elements) {\r\n        snprintf(glob->errormsg, sizeof(glob->errormsg), \"out of memory\\n\");\r\n        return GLOB_NO_MEM;\r\n      }\r\n      pat->content.Set.elements[pat->content.Set.size] =\r\n        strdup(glob->glob_buffer);\r\n      if(!pat->content.Set.elements[pat->content.Set.size]) {\r\n        short elem;\r\n        for(elem = 0; elem < pat->content.Set.size; elem++)\r\n          Curl_safefree(pat->content.Set.elements[elem]);\r\n        Curl_safefree(pat->content.Set.elements);\r\n        pat->content.Set.ptr_s = 0;\r\n        pat->content.Set.size = 0;\r\n        snprintf(glob->errormsg, sizeof(glob->errormsg), \"out of memory\\n\");\r\n        return GLOB_NO_MEM;\r\n      }\r\n      ++pat->content.Set.size;\r\n\r\n      if(*pattern == '}') {\r\n        /* entire set pattern completed */\r\n        int wordamount;\r\n\r\n        /* always check for a literal (may be \"\") between patterns */\r\n        res = glob_word(glob, ++pattern, ++pos, &wordamount);\r\n        if(res) {\r\n          short elem;\r\n          for(elem = 0; elem < pat->content.Set.size; elem++)\r\n            Curl_safefree(pat->content.Set.elements[elem]);\r\n          Curl_safefree(pat->content.Set.elements);\r\n          pat->content.Set.ptr_s = 0;\r\n          pat->content.Set.size = 0;\r\n          return res;\r\n        }\r\n\r\n        *amount = pat->content.Set.size * wordamount;\r\n\r\n        done = TRUE;\r\n        continue;\r\n      }\r\n\r\n      buf = glob->glob_buffer;\r\n      ++pattern;\r\n      ++pos;\r\n      break;\r\n\r\n    case ']':                           /* illegal closing bracket */\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"illegal pattern at pos %zu\\n\", pos);\r\n      return GLOB_ERROR;\r\n\r\n    case '\\\\':                          /* escaped character, skip '\\' */\r\n      if(pattern[1]) {\r\n        ++pattern;\r\n        ++pos;\r\n      }\r\n      /* intentional fallthrough */\r\n    default:\r\n      *buf++ = *pattern++;              /* copy character to set element */\r\n      ++pos;\r\n    }\r\n  }\r\n  return GLOB_OK;\r\n}\r\n\r\nstatic GlobCode glob_range(URLGlob *glob, char *pattern,\r\n                           size_t pos, int *amount)\r\n{\r\n  /* processes a range expression with the point behind the opening '['\r\n     - char range: e.g. \"a-z]\", \"B-Q]\"\r\n     - num range: e.g. \"0-9]\", \"17-2000]\"\r\n     - num range with leading zeros: e.g. \"001-999]\"\r\n     expression is checked for well-formedness and collected until the next ']'\r\n  */\r\n  URLPattern *pat;\r\n  char *c;\r\n  char sep;\r\n  char sep2;\r\n  int step;\r\n  int rc;\r\n  GlobCode res;\r\n  int wordamount = 1;\r\n\r\n  pat = &glob->pattern[glob->size / 2];\r\n  /* patterns 0,1,2,... correspond to size=1,3,5,... */\r\n  if(++glob->size > (GLOB_PATTERN_NUM*2)) {\r\n    snprintf(glob->errormsg, sizeof(glob->errormsg), \"too many globs used\\n\");\r\n    return GLOB_ERROR;\r\n  }\r\n\r\n  if(ISALPHA(*pattern)) {\r\n    /* character range detected */\r\n    char min_c;\r\n    char max_c;\r\n\r\n    pat->type = UPTCharRange;\r\n\r\n    rc = sscanf(pattern, \"%c-%c%c%d%c\", &min_c, &max_c, &sep, &step, &sep2);\r\n\r\n    if((rc < 3) || (min_c >= max_c) || ((max_c - min_c) > ('z' - 'a'))) {\r\n      /* the pattern is not well-formed */\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"error: bad range specification after pos %zu\\n\", pos);\r\n      return GLOB_ERROR;\r\n    }\r\n\r\n    /* check the (first) separating character */\r\n    if((sep != ']') && (sep != ':')) {\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"error: unsupported character (%c) after range at pos %zu\\n\",\r\n               sep, pos);\r\n      return GLOB_ERROR;\r\n    }\r\n\r\n    /* if there was a \":[num]\" thing, use that as step or else use 1 */\r\n    pat->content.CharRange.step =\r\n      ((sep == ':') && (rc == 5) && (sep2 == ']')) ? step : 1;\r\n\r\n    pat->content.CharRange.ptr_c = pat->content.CharRange.min_c = min_c;\r\n    pat->content.CharRange.max_c = max_c;\r\n  }\r\n  else if(ISDIGIT(*pattern)) {\r\n    /* numeric range detected */\r\n    int min_n;\r\n    int max_n;\r\n\r\n    pat->type = UPTNumRange;\r\n    pat->content.NumRange.padlength = 0;\r\n\r\n    rc = sscanf(pattern, \"%d-%d%c%d%c\", &min_n, &max_n, &sep, &step, &sep2);\r\n\r\n    if((rc < 2) || (min_n > max_n)) {\r\n      /* the pattern is not well-formed */\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"error: bad range specification after pos %zu\\n\", pos);\r\n      return GLOB_ERROR;\r\n    }\r\n    pat->content.NumRange.ptr_n = pat->content.NumRange.min_n = min_n;\r\n    pat->content.NumRange.max_n = max_n;\r\n\r\n    /* if there was a \":[num]\" thing, use that as step or else use 1 */\r\n    pat->content.NumRange.step =\r\n      ((sep == ':') && (rc == 5) && (sep2 == ']')) ? step : 1;\r\n\r\n    if(*pattern == '0') {\r\n      /* leading zero specified */\r\n      c = pattern;\r\n      while(ISDIGIT(*c)) {\r\n        c++;\r\n        ++pat->content.NumRange.padlength; /* padding length is set for all\r\n                                              instances of this pattern */\r\n      }\r\n    }\r\n  }\r\n  else {\r\n    snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n             \"illegal character in range specification at pos %zu\\n\", pos);\r\n    return GLOB_ERROR;\r\n  }\r\n\r\n  c = (char*)strchr(pattern, ']'); /* continue after next ']' */\r\n  if(c)\r\n    c++;\r\n  else {\r\n    snprintf(glob->errormsg, sizeof(glob->errormsg), \"missing ']'\");\r\n    return GLOB_ERROR; /* missing ']' */\r\n  }\r\n\r\n  /* always check for a literal (may be \"\") between patterns */\r\n\r\n  res = glob_word(glob, c, pos + (c - pattern), &wordamount);\r\n  if(res == GLOB_ERROR) {\r\n    wordamount = 1;\r\n    res = GLOB_OK;\r\n  }\r\n\r\n  if(!res) {\r\n    if(pat->type == UPTCharRange)\r\n      *amount = wordamount * (pat->content.CharRange.max_c -\r\n                              pat->content.CharRange.min_c + 1);\r\n    else\r\n      *amount = wordamount * (pat->content.NumRange.max_n -\r\n                              pat->content.NumRange.min_n + 1);\r\n  }\r\n\r\n  return res; /* GLOB_OK or GLOB_NO_MEM */\r\n}\r\n\r\nstatic GlobCode glob_word(URLGlob *glob, char *pattern,\r\n                          size_t pos, int *amount)\r\n{\r\n  /* processes a literal string component of a URL\r\n     special characters '{' and '[' branch to set/range processing functions\r\n   */\r\n  char* buf = glob->glob_buffer;\r\n  size_t litindex;\r\n  GlobCode res = GLOB_OK;\r\n\r\n  *amount = 1; /* default is one single string */\r\n\r\n  while(*pattern != '\\0' && *pattern != '{' && *pattern != '[') {\r\n    if(*pattern == '}' || *pattern == ']') {\r\n      snprintf(glob->errormsg, sizeof(glob->errormsg),\r\n               \"unmatched close brace/bracket at pos %zu\\n\", pos);\r\n      return GLOB_ERROR;\r\n    }\r\n\r\n    /* only allow \\ to escape known \"special letters\" */\r\n    if(*pattern == '\\\\' &&\r\n        (*(pattern+1) == '{' || *(pattern+1) == '[' ||\r\n         *(pattern+1) == '}' || *(pattern+1) == ']') ) {\r\n\r\n      /* escape character, skip '\\' */\r\n      ++pattern;\r\n      ++pos;\r\n    }\r\n    *buf++ = *pattern++; /* copy character to literal */\r\n    ++pos;\r\n  }\r\n  *buf = '\\0';\r\n  litindex = glob->size / 2;\r\n  /* literals 0,1,2,... correspond to size=0,2,4,... */\r\n  glob->literal[litindex] = strdup(glob->glob_buffer);\r\n  if(!glob->literal[litindex]) {\r\n    snprintf(glob->errormsg, sizeof(glob->errormsg), \"out of memory\\n\");\r\n    return GLOB_NO_MEM;\r\n  }\r\n  ++glob->size;\r\n\r\n  switch (*pattern) {\r\n  case '\\0':\r\n    /* singular URL processed  */\r\n    break;\r\n\r\n  case '{':\r\n    /* process set pattern */\r\n    res = glob_set(glob, ++pattern, ++pos, amount);\r\n    break;\r\n\r\n  case '[':\r\n    /* process range pattern */\r\n    res = glob_range(glob, ++pattern, ++pos, amount);\r\n    break;\r\n  }\r\n\r\n  if(res)\r\n    Curl_safefree(glob->literal[litindex]);\r\n\r\n  return res;\r\n}\r\n\r\nint glob_url(URLGlob** glob, char* url, int *urlnum, FILE *error)\r\n{\r\n  /*\r\n   * We can deal with any-size, just make a buffer with the same length\r\n   * as the specified URL!\r\n   */\r\n  URLGlob *glob_expand;\r\n  int amount;\r\n  char *glob_buffer;\r\n  GlobCode res;\r\n\r\n  *glob = NULL;\r\n\r\n  glob_buffer = malloc(strlen(url) + 1);\r\n  if(!glob_buffer)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  glob_expand = calloc(1, sizeof(URLGlob));\r\n  if(!glob_expand) {\r\n    Curl_safefree(glob_buffer);\r\n    return CURLE_OUT_OF_MEMORY;\r\n  }\r\n  glob_expand->size = 0;\r\n  glob_expand->urllen = strlen(url);\r\n  glob_expand->glob_buffer = glob_buffer;\r\n  glob_expand->beenhere = 0;\r\n\r\n  res = glob_word(glob_expand, url, 1, &amount);\r\n  if(!res)\r\n    *urlnum = amount;\r\n  else {\r\n    if(error && glob_expand->errormsg[0]) {\r\n      /* send error description to the error-stream */\r\n      fprintf(error, \"curl: (%d) [globbing] %s\",\r\n              (res == GLOB_NO_MEM) ? CURLE_OUT_OF_MEMORY : CURLE_URL_MALFORMAT,\r\n              glob_expand->errormsg);\r\n    }\r\n    /* it failed, we cleanup */\r\n    Curl_safefree(glob_buffer);\r\n    Curl_safefree(glob_expand);\r\n    *urlnum = 1;\r\n    return (res == GLOB_NO_MEM) ? CURLE_OUT_OF_MEMORY : CURLE_URL_MALFORMAT;\r\n  }\r\n\r\n  *glob = glob_expand;\r\n  return CURLE_OK;\r\n}\r\n\r\nvoid glob_cleanup(URLGlob* glob)\r\n{\r\n  size_t i;\r\n  int elem;\r\n\r\n  for(i = glob->size - 1; i < glob->size; --i) {\r\n    if(!(i & 1)) {     /* even indexes contain literals */\r\n      Curl_safefree(glob->literal[i/2]);\r\n    }\r\n    else {              /* odd indexes contain sets or ranges */\r\n      if((glob->pattern[i/2].type == UPTSet) &&\r\n         (glob->pattern[i/2].content.Set.elements)) {\r\n        for(elem = glob->pattern[i/2].content.Set.size - 1;\r\n             elem >= 0;\r\n             --elem) {\r\n          Curl_safefree(glob->pattern[i/2].content.Set.elements[elem]);\r\n        }\r\n        Curl_safefree(glob->pattern[i/2].content.Set.elements);\r\n      }\r\n    }\r\n  }\r\n  Curl_safefree(glob->glob_buffer);\r\n  Curl_safefree(glob);\r\n}\r\n\r\nint glob_next_url(char **globbed, URLGlob *glob)\r\n{\r\n  URLPattern *pat;\r\n  char *lit;\r\n  size_t i;\r\n  size_t j;\r\n  size_t len;\r\n  size_t buflen = glob->urllen + 1;\r\n  char *buf = glob->glob_buffer;\r\n\r\n  *globbed = NULL;\r\n\r\n  if(!glob->beenhere)\r\n    glob->beenhere = 1;\r\n  else {\r\n    bool carry = TRUE;\r\n\r\n    /* implement a counter over the index ranges of all patterns,\r\n       starting with the rightmost pattern */\r\n    for(i = glob->size / 2 - 1; carry && (i < glob->size); --i) {\r\n      carry = FALSE;\r\n      pat = &glob->pattern[i];\r\n      switch (pat->type) {\r\n      case UPTSet:\r\n        if((pat->content.Set.elements) &&\r\n           (++pat->content.Set.ptr_s == pat->content.Set.size)) {\r\n          pat->content.Set.ptr_s = 0;\r\n          carry = TRUE;\r\n        }\r\n        break;\r\n      case UPTCharRange:\r\n        pat->content.CharRange.ptr_c = (char)(pat->content.CharRange.step +\r\n                           (int)((unsigned char)pat->content.CharRange.ptr_c));\r\n        if(pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) {\r\n          pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;\r\n          carry = TRUE;\r\n        }\r\n        break;\r\n      case UPTNumRange:\r\n        pat->content.NumRange.ptr_n += pat->content.NumRange.step;\r\n        if(pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) {\r\n          pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;\r\n          carry = TRUE;\r\n        }\r\n        break;\r\n      default:\r\n        printf(\"internal error: invalid pattern type (%d)\\n\", (int)pat->type);\r\n        return CURLE_FAILED_INIT;\r\n      }\r\n    }\r\n    if(carry) {         /* first pattern ptr has run into overflow, done! */\r\n      /* TODO: verify if this should actally return CURLE_OK. */\r\n      return CURLE_OK; /* CURLE_OK to match previous behavior */\r\n    }\r\n  }\r\n\r\n  for(j = 0; j < glob->size; ++j) {\r\n    if(!(j&1)) {              /* every other term (j even) is a literal */\r\n      lit = glob->literal[j/2];\r\n      len = snprintf(buf, buflen, \"%s\", lit);\r\n      buf += len;\r\n      buflen -= len;\r\n    }\r\n    else {                              /* the rest (i odd) are patterns */\r\n      pat = &glob->pattern[j/2];\r\n      switch(pat->type) {\r\n      case UPTSet:\r\n        if(pat->content.Set.elements) {\r\n          len = strlen(pat->content.Set.elements[pat->content.Set.ptr_s]);\r\n          snprintf(buf, buflen, \"%s\",\r\n                   pat->content.Set.elements[pat->content.Set.ptr_s]);\r\n          buf += len;\r\n          buflen -= len;\r\n        }\r\n        break;\r\n      case UPTCharRange:\r\n        *buf++ = pat->content.CharRange.ptr_c;\r\n        break;\r\n      case UPTNumRange:\r\n        len = snprintf(buf, buflen, \"%0*d\",\r\n                       pat->content.NumRange.padlength,\r\n                       pat->content.NumRange.ptr_n);\r\n        buf += len;\r\n        buflen -= len;\r\n        break;\r\n      default:\r\n        printf(\"internal error: invalid pattern type (%d)\\n\", (int)pat->type);\r\n        return CURLE_FAILED_INIT;\r\n      }\r\n    }\r\n  }\r\n  *buf = '\\0';\r\n\r\n  *globbed = strdup(glob->glob_buffer);\r\n  if(!*globbed)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  return CURLE_OK;\r\n}\r\n\r\nint glob_match_url(char **result, char *filename, URLGlob *glob)\r\n{\r\n  char *target;\r\n  size_t allocsize;\r\n  char numbuf[18];\r\n  char *appendthis = NULL;\r\n  size_t appendlen = 0;\r\n  size_t stringlen = 0;\r\n\r\n  *result = NULL;\r\n\r\n  /* We cannot use the glob_buffer for storage here since the filename may\r\n   * be longer than the URL we use. We allocate a good start size, then\r\n   * we need to realloc in case of need.\r\n   */\r\n  allocsize = strlen(filename) + 1; /* make it at least one byte to store the\r\n                                       trailing zero */\r\n  target = malloc(allocsize);\r\n  if(!target)\r\n    return CURLE_OUT_OF_MEMORY;\r\n\r\n  while(*filename) {\r\n    if(*filename == '#' && ISDIGIT(filename[1])) {\r\n      unsigned long i;\r\n      char *ptr = filename;\r\n      unsigned long num = strtoul(&filename[1], &filename, 10);\r\n      i = num - 1UL;\r\n\r\n      if(num && (i <= glob->size / 2)) {\r\n        URLPattern pat = glob->pattern[i];\r\n        switch (pat.type) {\r\n        case UPTSet:\r\n          if(pat.content.Set.elements) {\r\n            appendthis = pat.content.Set.elements[pat.content.Set.ptr_s];\r\n            appendlen =\r\n              strlen(pat.content.Set.elements[pat.content.Set.ptr_s]);\r\n          }\r\n          break;\r\n        case UPTCharRange:\r\n          numbuf[0] = pat.content.CharRange.ptr_c;\r\n          numbuf[1] = 0;\r\n          appendthis = numbuf;\r\n          appendlen = 1;\r\n          break;\r\n        case UPTNumRange:\r\n          snprintf(numbuf, sizeof(numbuf), \"%0*d\",\r\n                   pat.content.NumRange.padlength,\r\n                   pat.content.NumRange.ptr_n);\r\n          appendthis = numbuf;\r\n          appendlen = strlen(numbuf);\r\n          break;\r\n        default:\r\n          printf(\"internal error: invalid pattern type (%d)\\n\",\r\n                 (int)pat.type);\r\n          Curl_safefree(target);\r\n          return CURLE_FAILED_INIT;\r\n        }\r\n      }\r\n      else {\r\n        /* #[num] out of range, use the #[num] in the output */\r\n        filename = ptr;\r\n        appendthis = filename++;\r\n        appendlen = 1;\r\n      }\r\n    }\r\n    else {\r\n      appendthis = filename++;\r\n      appendlen = 1;\r\n    }\r\n    if(appendlen + stringlen >= allocsize) {\r\n      char *newstr;\r\n      /* we append a single byte to allow for the trailing byte to be appended\r\n         at the end of this function outside the while() loop */\r\n      allocsize = (appendlen + stringlen) * 2;\r\n      newstr = realloc(target, allocsize + 1);\r\n      if(!newstr) {\r\n        Curl_safefree(target);\r\n        return CURLE_OUT_OF_MEMORY;\r\n      }\r\n      target = newstr;\r\n    }\r\n    memcpy(&target[stringlen], appendthis, appendlen);\r\n    stringlen += appendlen;\r\n  }\r\n  target[stringlen]= '\\0';\r\n  *result = target;\r\n  return CURLE_OK;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_urlglob.h",
    "content": "#ifndef HEADER_CURL_TOOL_URLGLOB_H\r\n#define HEADER_CURL_TOOL_URLGLOB_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\ntypedef enum {\r\n  UPTSet = 1,\r\n  UPTCharRange,\r\n  UPTNumRange\r\n} URLPatternType;\r\n\r\ntypedef struct {\r\n  URLPatternType type;\r\n  union {\r\n    struct {\r\n      char **elements;\r\n      short size;\r\n      short ptr_s;\r\n    } Set;\r\n    struct {\r\n      char min_c;\r\n      char max_c;\r\n      char ptr_c;\r\n      int step;\r\n    } CharRange;\r\n    struct {\r\n      int min_n;\r\n      int max_n;\r\n      short padlength;\r\n      int ptr_n;\r\n      int step;\r\n    } NumRange ;\r\n  } content;\r\n} URLPattern;\r\n\r\n/* the total number of globs supported */\r\n#define GLOB_PATTERN_NUM 9\r\n\r\ntypedef struct {\r\n  char *literal[10];\r\n  URLPattern pattern[GLOB_PATTERN_NUM+1];\r\n  size_t size;\r\n  size_t urllen;\r\n  char *glob_buffer;\r\n  char beenhere;\r\n  char errormsg[80]; /* error message buffer */\r\n} URLGlob;\r\n\r\nint glob_url(URLGlob**, char*, int *, FILE *);\r\nint glob_next_url(char **, URLGlob *);\r\nint glob_match_url(char **, char*, URLGlob *);\r\nvoid glob_cleanup(URLGlob* glob);\r\n\r\n#endif /* HEADER_CURL_TOOL_URLGLOB_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_util.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#include \"tool_util.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#if defined(WIN32) && !defined(MSDOS)\r\n\r\nstruct timeval tool_tvnow(void)\r\n{\r\n  /*\r\n  ** GetTickCount() is available on _all_ Windows versions from W95 up\r\n  ** to nowadays. Returns milliseconds elapsed since last system boot,\r\n  ** increases monotonically and wraps once 49.7 days have elapsed.\r\n  */\r\n  struct timeval now;\r\n  DWORD milliseconds = GetTickCount();\r\n  now.tv_sec = milliseconds / 1000;\r\n  now.tv_usec = (milliseconds % 1000) * 1000;\r\n  return now;\r\n}\r\n\r\n#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)\r\n\r\nstruct timeval tool_tvnow(void)\r\n{\r\n  /*\r\n  ** clock_gettime() is granted to be increased monotonically when the\r\n  ** monotonic clock is queried. Time starting point is unspecified, it\r\n  ** could be the system start-up time, the Epoch, or something else,\r\n  ** in any case the time starting point does not change once that the\r\n  ** system has started up.\r\n  */\r\n  struct timeval now;\r\n  struct timespec tsnow;\r\n  if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {\r\n    now.tv_sec = tsnow.tv_sec;\r\n    now.tv_usec = tsnow.tv_nsec / 1000;\r\n  }\r\n  /*\r\n  ** Even when the configure process has truly detected monotonic clock\r\n  ** availability, it might happen that it is not actually available at\r\n  ** run-time. When this occurs simply fallback to other time source.\r\n  */\r\n#ifdef HAVE_GETTIMEOFDAY\r\n  else\r\n    (void)gettimeofday(&now, NULL);\r\n#else\r\n  else {\r\n    now.tv_sec = (long)time(NULL);\r\n    now.tv_usec = 0;\r\n  }\r\n#endif\r\n  return now;\r\n}\r\n\r\n#elif defined(HAVE_GETTIMEOFDAY)\r\n\r\nstruct timeval tool_tvnow(void)\r\n{\r\n  /*\r\n  ** gettimeofday() is not granted to be increased monotonically, due to\r\n  ** clock drifting and external source time synchronization it can jump\r\n  ** forward or backward in time.\r\n  */\r\n  struct timeval now;\r\n  (void)gettimeofday(&now, NULL);\r\n  return now;\r\n}\r\n\r\n#else\r\n\r\nstruct timeval tool_tvnow(void)\r\n{\r\n  /*\r\n  ** time() returns the value of time in seconds since the Epoch.\r\n  */\r\n  struct timeval now;\r\n  now.tv_sec = (long)time(NULL);\r\n  now.tv_usec = 0;\r\n  return now;\r\n}\r\n\r\n#endif\r\n\r\n/*\r\n * Make sure that the first argument is the more recent time, as otherwise\r\n * we'll get a weird negative time-diff back...\r\n *\r\n * Returns: the time difference in number of milliseconds.\r\n */\r\nlong tool_tvdiff(struct timeval newer, struct timeval older)\r\n{\r\n  return (newer.tv_sec-older.tv_sec)*1000+\r\n    (newer.tv_usec-older.tv_usec)/1000;\r\n}\r\n\r\n/*\r\n * Same as tool_tvdiff but with full usec resolution.\r\n *\r\n * Returns: the time difference in seconds with subsecond resolution.\r\n */\r\ndouble tool_tvdiff_secs(struct timeval newer, struct timeval older)\r\n{\r\n  if(newer.tv_sec != older.tv_sec)\r\n    return (double)(newer.tv_sec-older.tv_sec)+\r\n      (double)(newer.tv_usec-older.tv_usec)/1000000.0;\r\n  else\r\n    return (double)(newer.tv_usec-older.tv_usec)/1000000.0;\r\n}\r\n\r\n/* return the number of seconds in the given input timeval struct */\r\nlong tool_tvlong(struct timeval t1)\r\n{\r\n  return t1.tv_sec;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_util.h",
    "content": "#ifndef HEADER_CURL_TOOL_UTIL_H\r\n#define HEADER_CURL_TOOL_UTIL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nstruct timeval tool_tvnow(void);\r\n\r\n/*\r\n * Make sure that the first argument (t1) is the more recent time and t2 is\r\n * the older time, as otherwise you get a weird negative time-diff back...\r\n *\r\n * Returns: the time difference in number of milliseconds.\r\n */\r\nlong tool_tvdiff(struct timeval t1, struct timeval t2);\r\n\r\n/*\r\n * Same as tool_tvdiff but with full usec resolution.\r\n *\r\n * Returns: the time difference in seconds with subsecond resolution.\r\n */\r\ndouble tool_tvdiff_secs(struct timeval t1, struct timeval t2);\r\n\r\nlong tool_tvlong(struct timeval t1);\r\n\r\n#undef tvnow\r\n#undef tvdiff\r\n#undef tvdiff_secs\r\n#undef tvlong\r\n\r\n#define tvnow()           tool_tvnow()\r\n#define tvdiff(a,b)       tool_tvdiff((a), (b))\r\n#define tvdiff_secs(a,b)  tool_tvdiff_secs((a), (b))\r\n#define tvlong(a)         tool_tvlong((a))\r\n\r\n#endif /* HEADER_CURL_TOOL_UTIL_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_version.h",
    "content": "#ifndef HEADER_CURL_TOOL_VERSION_H\r\n#define HEADER_CURL_TOOL_VERSION_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include <curl/curlver.h>\r\n\r\n#define CURL_NAME \"curl\"\r\n#define CURL_COPYRIGHT LIBCURL_COPYRIGHT\r\n#define CURL_VERSION \"7.29.0\"\r\n#define CURL_VERSION_MAJOR LIBCURL_VERSION_MAJOR\r\n#define CURL_VERSION_MINOR LIBCURL_VERSION_MINOR\r\n#define CURL_VERSION_PATCH LIBCURL_VERSION_PATCH\r\n#define CURL_ID CURL_NAME \" \" CURL_VERSION \" (\" OS \") \"\r\n\r\n#endif /* HEADER_CURL_TOOL_VERSION_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_vms.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef __VMS\r\n\r\n#if defined(__DECC) && !defined(__VAX) && \\\r\n    defined(__CRTL_VER) && (__CRTL_VER >= 70301000)\r\n#include <unixlib.h>\r\n#endif\r\n\r\n#define ENABLE_CURLX_PRINTF\r\n#include \"curlx.h\"\r\n\r\n#include \"curlmsg_vms.h\"\r\n#include \"tool_vms.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nvoid decc$__posix_exit(int __status);\r\nvoid decc$exit(int __status);\r\n\r\nstatic int vms_shell = -1;\r\n\r\n/* VMS has a DCL shell and and also has Unix shells ported to it.\r\n * When curl is running under a Unix shell, we want it to be as much\r\n * like Unix as possible.\r\n */\r\nint is_vms_shell(void)\r\n{\r\n  char *shell;\r\n\r\n  /* Have we checked the shell yet? */\r\n  if(vms_shell >= 0)\r\n    return vms_shell;\r\n\r\n  shell = getenv(\"SHELL\");\r\n\r\n  /* No shell, means DCL */\r\n  if(shell == NULL) {\r\n    vms_shell = 1;\r\n    return 1;\r\n  }\r\n\r\n  /* Have to make sure some one did not set shell to DCL */\r\n  if(strcmp(shell, \"DCL\") == 0) {\r\n    vms_shell = 1;\r\n    return 1;\r\n  }\r\n\r\n  vms_shell = 0;\r\n  return 0;\r\n}\r\n\r\n/*\r\n * VMS has two exit() routines.  When running under a Unix style shell, then\r\n * Unix style and the __posix_exit() routine is used.\r\n *\r\n * When running under the DCL shell, then the VMS encoded codes and decc$exit()\r\n * is used.\r\n *\r\n * We can not use exit() or return a code from main() because the actual\r\n * routine called depends on both the compiler version, compile options, and\r\n * feature macro settings, and one of the exit routines is hidden at compile\r\n * time.\r\n *\r\n * Since we want Curl to work properly under the VMS DCL shell and Unix\r\n * shells under VMS, this routine should compile correctly regardless of\r\n * the settings.\r\n */\r\n\r\nvoid vms_special_exit(int code, int vms_show)\r\n{\r\n  int vms_code;\r\n\r\n  /* The Posix exit mode is only available after VMS 7.0 */\r\n#if __CRTL_VER >= 70000000\r\n  if(is_vms_shell() == 0) {\r\n    decc$__posix_exit(code);\r\n  }\r\n#endif\r\n\r\n  if(code > CURL_LAST) {   /* If CURL_LAST exceeded then */\r\n    vms_code = CURL_LAST;  /* curlmsg.h is out of sync.  */\r\n  }\r\n  else {\r\n    vms_code = vms_cond[code] | vms_show;\r\n  }\r\n  decc$exit(vms_code);\r\n}\r\n\r\n#if defined(__DECC) && !defined(__VAX) && \\\r\n    defined(__CRTL_VER) && (__CRTL_VER >= 70301000)\r\n\r\n/*\r\n * 2004-09-19 SMS.\r\n *\r\n * decc_init()\r\n *\r\n * On non-VAX systems, use LIB$INITIALIZE to set a collection of C\r\n * RTL features without using the DECC$* logical name method, nor\r\n * requiring the user to define the corresponding logical names.\r\n */\r\n\r\n/* Structure to hold a DECC$* feature name and its desired value. */\r\ntypedef struct {\r\n  char *name;\r\n  int value;\r\n} decc_feat_t;\r\n\r\n/* Array of DECC$* feature names and their desired values. */\r\nstatic decc_feat_t decc_feat_array[] = {\r\n  /* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */\r\n  { \"DECC$ARGV_PARSE_STYLE\", 1 },\r\n  /* Preserve case for file names on ODS5 disks. */\r\n  { \"DECC$EFS_CASE_PRESERVE\", 1 },\r\n  /* Enable multiple dots (and most characters) in ODS5 file names,\r\n     while preserving VMS-ness of \";version\". */\r\n  { \"DECC$EFS_CHARSET\", 1 },\r\n  /* List terminator. */\r\n  { (char *)NULL, 0 }\r\n};\r\n\r\n/* Flag to sense if decc_init() was called. */\r\nstatic int decc_init_done = -1;\r\n\r\n/* LIB$INITIALIZE initialization function. */\r\nstatic void decc_init(void)\r\n{\r\n  int feat_index;\r\n  int feat_value;\r\n  int feat_value_max;\r\n  int feat_value_min;\r\n  int i;\r\n  int sts;\r\n\r\n  /* Set the global flag to indicate that LIB$INITIALIZE worked. */\r\n  decc_init_done = 1;\r\n\r\n  /* Loop through all items in the decc_feat_array[]. */\r\n  for(i = 0; decc_feat_array[i].name != NULL; i++) {\r\n\r\n    /* Get the feature index. */\r\n    feat_index = decc$feature_get_index( decc_feat_array[i].name);\r\n\r\n    if(feat_index >= 0) {\r\n      /* Valid item.  Collect its properties. */\r\n      feat_value = decc$feature_get_value( feat_index, 1);\r\n      feat_value_min = decc$feature_get_value( feat_index, 2);\r\n      feat_value_max = decc$feature_get_value( feat_index, 3);\r\n\r\n      if((decc_feat_array[i].value >= feat_value_min) &&\r\n         (decc_feat_array[i].value <= feat_value_max)) {\r\n        /* Valid value.  Set it if necessary. */\r\n        if(feat_value != decc_feat_array[i].value) {\r\n          sts = decc$feature_set_value( feat_index, 1,\r\n                                        decc_feat_array[i].value);\r\n        }\r\n      }\r\n      else {\r\n        /* Invalid DECC feature value. */\r\n        printf(\" INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\\n\",\r\n               feat_value,\r\n               feat_value_min, decc_feat_array[i].name, feat_value_max);\r\n      }\r\n    }\r\n    else {\r\n      /* Invalid DECC feature name. */\r\n      printf(\" UNKNOWN DECC FEATURE: %s.\\n\", decc_feat_array[i].name);\r\n    }\r\n\r\n  }\r\n}\r\n\r\n/* Get \"decc_init()\" into a valid, loaded LIB$INITIALIZE PSECT. */\r\n\r\n#pragma nostandard\r\n\r\n/* Establish the LIB$INITIALIZE PSECTs, with proper alignment and\r\n   other attributes.  Note that \"nopic\" is significant only on VAX. */\r\n#pragma extern_model save\r\n#pragma extern_model strict_refdef \"LIB$INITIALIZ\" 2, nopic, nowrt\r\nconst int spare[8] = {0};\r\n#pragma extern_model strict_refdef \"LIB$INITIALIZE\" 2, nopic, nowrt\r\nvoid (*const x_decc_init)() = decc_init;\r\n#pragma extern_model restore\r\n\r\n/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */\r\n#pragma extern_model save\r\nint LIB$INITIALIZE(void);\r\n#pragma extern_model strict_refdef\r\nint dmy_lib$initialize = (int) LIB$INITIALIZE;\r\n#pragma extern_model restore\r\n\r\n#pragma standard\r\n\r\n#endif /* __DECC && !__VAX && __CRTL_VER && __CRTL_VER >= 70301000 */\r\n\r\n#endif /* __VMS */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_vms.h",
    "content": "#ifndef HEADER_CURL_TOOL_VMS_H\r\n#define HEADER_CURL_TOOL_VMS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef __VMS\r\n\r\n/*\r\n * Forward-declaration of global variable vms_show defined\r\n * in tool_main.c, used in main() as parameter for function\r\n * vms_special_exit() to allow proper curl tool exiting.\r\n */\r\nextern int vms_show;\r\n\r\nint is_vms_shell(void);\r\nvoid vms_special_exit(int code, int vms_show);\r\n\r\n#undef exit\r\n#define exit(__code) vms_special_exit((__code), (0))\r\n\r\n#define  VMS_STS(c,f,e,s) (((c&0xF)<<28)|((f&0xFFF)<<16)|((e&0x1FFF)<3)|(s&7))\r\n#define  VMSSTS_HIDE  VMS_STS(1,0,0,0)\r\n\r\n#endif /* __VMS */\r\n\r\n#endif /* HEADER_CURL_TOOL_VMS_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_writeenv.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef USE_ENVIRONMENT\r\n\r\n#ifdef __riscos__\r\n#  include <kernel.h>\r\n#endif\r\n\r\n#define _MPRINTF_REPLACE /* use our functions only */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"tool_writeenv.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\nstatic const struct\r\n{\r\n  const char * name;\r\n  CURLINFO id;\r\n  enum {\r\n    writeenv_NONE,\r\n    writeenv_DOUBLE,\r\n    writeenv_LONG,\r\n    writeenv_STRING\r\n  } type;\r\n} variables[14] =\r\n{\r\n  {\"curl_url_effective\", CURLINFO_EFFECTIVE_URL, writeenv_STRING},\r\n  {\"curl_http_code\", CURLINFO_RESPONSE_CODE, writeenv_LONG},\r\n  {\"curl_time_total\", CURLINFO_TOTAL_TIME, writeenv_DOUBLE},\r\n  {\"curl_time_namelookup\", CURLINFO_NAMELOOKUP_TIME, writeenv_DOUBLE},\r\n  {\"curl_time_connect\", CURLINFO_CONNECT_TIME, writeenv_DOUBLE},\r\n  {\"curl_time_pretransfer\", CURLINFO_PRETRANSFER_TIME, writeenv_DOUBLE},\r\n  {\"curl_time_starttransfer\", CURLINFO_STARTTRANSFER_TIME, writeenv_DOUBLE},\r\n  {\"curl_size_header\", CURLINFO_HEADER_SIZE, writeenv_LONG},\r\n  {\"curl_size_request\", CURLINFO_REQUEST_SIZE, writeenv_LONG},\r\n  {\"curl_size_download\", CURLINFO_SIZE_DOWNLOAD, writeenv_DOUBLE},\r\n  {\"curl_size_upload\", CURLINFO_SIZE_UPLOAD, writeenv_DOUBLE},\r\n  {\"curl_speed_download\", CURLINFO_SPEED_DOWNLOAD, writeenv_DOUBLE},\r\n  {\"curl_speed_upload\", CURLINFO_SPEED_UPLOAD, writeenv_DOUBLE},\r\n  {NULL, 0, writeenv_NONE}\r\n };\r\n\r\nstatic void internalSetEnv(const char * name, char * value)\r\n{\r\n  /* Add your OS-specific code here. */\r\n#ifdef __riscos__\r\n  _kernel_setenv(name, value);\r\n#elif defined (CURLDEBUG)\r\n  curl_memlog(\"ENV %s = %s\\n\", name, value);\r\n#endif\r\n  return;\r\n}\r\n\r\nvoid ourWriteEnv(CURL *curl)\r\n{\r\n  unsigned int i;\r\n  char *string, numtext[10];\r\n  long longinfo;\r\n  double doubleinfo;\r\n\r\n  for(i=0; variables[i].name; i++) {\r\n    switch (variables[i].type) {\r\n    case writeenv_STRING:\r\n      if(curl_easy_getinfo(curl, variables[i].id, &string) == CURLE_OK)\r\n        internalSetEnv(variables[i].name, string);\r\n      else\r\n        internalSetEnv(variables[i].name, NULL);\r\n      break;\r\n\r\n    case writeenv_LONG:\r\n      if(curl_easy_getinfo(curl, variables[i].id, &longinfo) == CURLE_OK) {\r\n        curl_msprintf(numtext, \"%5ld\", longinfo);\r\n        internalSetEnv(variables[i].name, numtext);\r\n      }\r\n      else\r\n        internalSetEnv(variables[i].name, NULL);\r\n      break;\r\n    case writeenv_DOUBLE:\r\n      if(curl_easy_getinfo(curl, variables[i].id, &doubleinfo) == CURLE_OK) {\r\n        curl_msprintf(numtext, \"%6.2f\", doubleinfo);\r\n        internalSetEnv(variables[i].name, numtext);\r\n      }\r\n      else\r\n        internalSetEnv(variables[i].name, NULL);\r\n      break;\r\n    default:\r\n      break;\r\n    }\r\n  }\r\n\r\n  return;\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_writeenv.h",
    "content": "#ifndef HEADER_CURL_TOOL_WRITEENV_H\r\n#define HEADER_CURL_TOOL_WRITEENV_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef USE_ENVIRONMENT\r\n\r\nvoid ourWriteEnv(CURL *curl);\r\n\r\n#else\r\n#  define ourWriteEnv(x)  Curl_nop_stmt\r\n#endif\r\n\r\n#endif /* HEADER_CURL_TOOL_WRITEENV_H */\r\n\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_writeout.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */\r\n#include <curl/mprintf.h>\r\n\r\n#include \"tool_cfgable.h\"\r\n#include \"tool_writeout.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\ntypedef enum {\r\n  VAR_NONE,       /* must be the first */\r\n  VAR_TOTAL_TIME,\r\n  VAR_NAMELOOKUP_TIME,\r\n  VAR_CONNECT_TIME,\r\n  VAR_APPCONNECT_TIME,\r\n  VAR_PRETRANSFER_TIME,\r\n  VAR_STARTTRANSFER_TIME,\r\n  VAR_SIZE_DOWNLOAD,\r\n  VAR_SIZE_UPLOAD,\r\n  VAR_SPEED_DOWNLOAD,\r\n  VAR_SPEED_UPLOAD,\r\n  VAR_HTTP_CODE,\r\n  VAR_HTTP_CODE_PROXY,\r\n  VAR_HEADER_SIZE,\r\n  VAR_REQUEST_SIZE,\r\n  VAR_EFFECTIVE_URL,\r\n  VAR_CONTENT_TYPE,\r\n  VAR_NUM_CONNECTS,\r\n  VAR_REDIRECT_TIME,\r\n  VAR_REDIRECT_COUNT,\r\n  VAR_FTP_ENTRY_PATH,\r\n  VAR_REDIRECT_URL,\r\n  VAR_SSL_VERIFY_RESULT,\r\n  VAR_EFFECTIVE_FILENAME,\r\n  VAR_PRIMARY_IP,\r\n  VAR_PRIMARY_PORT,\r\n  VAR_LOCAL_IP,\r\n  VAR_LOCAL_PORT,\r\n  VAR_NUM_OF_VARS /* must be the last */\r\n} replaceid;\r\n\r\nstruct variable {\r\n  const char *name;\r\n  replaceid id;\r\n};\r\n\r\n\r\nstatic const struct variable replacements[]={\r\n  {\"url_effective\", VAR_EFFECTIVE_URL},\r\n  {\"http_code\", VAR_HTTP_CODE},\r\n  {\"response_code\", VAR_HTTP_CODE},\r\n  {\"http_connect\", VAR_HTTP_CODE_PROXY},\r\n  {\"time_total\", VAR_TOTAL_TIME},\r\n  {\"time_namelookup\", VAR_NAMELOOKUP_TIME},\r\n  {\"time_connect\", VAR_CONNECT_TIME},\r\n  {\"time_appconnect\", VAR_APPCONNECT_TIME},\r\n  {\"time_pretransfer\", VAR_PRETRANSFER_TIME},\r\n  {\"time_starttransfer\", VAR_STARTTRANSFER_TIME},\r\n  {\"size_header\", VAR_HEADER_SIZE},\r\n  {\"size_request\", VAR_REQUEST_SIZE},\r\n  {\"size_download\", VAR_SIZE_DOWNLOAD},\r\n  {\"size_upload\", VAR_SIZE_UPLOAD},\r\n  {\"speed_download\", VAR_SPEED_DOWNLOAD},\r\n  {\"speed_upload\", VAR_SPEED_UPLOAD},\r\n  {\"content_type\", VAR_CONTENT_TYPE},\r\n  {\"num_connects\", VAR_NUM_CONNECTS},\r\n  {\"time_redirect\", VAR_REDIRECT_TIME},\r\n  {\"num_redirects\", VAR_REDIRECT_COUNT},\r\n  {\"ftp_entry_path\", VAR_FTP_ENTRY_PATH},\r\n  {\"redirect_url\", VAR_REDIRECT_URL},\r\n  {\"ssl_verify_result\", VAR_SSL_VERIFY_RESULT},\r\n  {\"filename_effective\", VAR_EFFECTIVE_FILENAME},\r\n  {\"remote_ip\", VAR_PRIMARY_IP},\r\n  {\"remote_port\", VAR_PRIMARY_PORT},\r\n  {\"local_ip\", VAR_LOCAL_IP},\r\n  {\"local_port\", VAR_LOCAL_PORT},\r\n  {NULL, VAR_NONE}\r\n};\r\n\r\nvoid ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)\r\n{\r\n  FILE *stream = stdout;\r\n  const char *ptr = writeinfo;\r\n  char *stringp;\r\n  long longinfo;\r\n  double doubleinfo;\r\n\r\n  while(ptr && *ptr) {\r\n    if('%' == *ptr) {\r\n      if('%' == ptr[1]) {\r\n        /* an escaped %-letter */\r\n        fputc('%', stream);\r\n        ptr += 2;\r\n      }\r\n      else {\r\n        /* this is meant as a variable to output */\r\n        char *end;\r\n        char keepit;\r\n        int i;\r\n        if(('{' == ptr[1]) && ((end = strchr(ptr, '}')) != NULL)) {\r\n          bool match = FALSE;\r\n          ptr += 2; /* pass the % and the { */\r\n          keepit = *end;\r\n          *end = 0; /* zero terminate */\r\n          for(i = 0; replacements[i].name; i++) {\r\n            if(curl_strequal(ptr, replacements[i].name)) {\r\n              match = TRUE;\r\n              switch(replacements[i].id) {\r\n              case VAR_EFFECTIVE_URL:\r\n                if((CURLE_OK ==\r\n                    curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &stringp))\r\n                   && stringp)\r\n                  fputs(stringp, stream);\r\n                break;\r\n              case VAR_HTTP_CODE:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &longinfo))\r\n                  fprintf(stream, \"%03ld\", longinfo);\r\n                break;\r\n              case VAR_HTTP_CODE_PROXY:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE,\r\n                                     &longinfo))\r\n                  fprintf(stream, \"%03ld\", longinfo);\r\n                break;\r\n              case VAR_HEADER_SIZE:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              case VAR_REQUEST_SIZE:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              case VAR_NUM_CONNECTS:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              case VAR_REDIRECT_COUNT:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              case VAR_REDIRECT_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_TOTAL_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_NAMELOOKUP_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_CONNECT_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_APPCONNECT_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_PRETRANSFER_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_STARTTRANSFER_TIME:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_SIZE_UPLOAD:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &doubleinfo))\r\n                  fprintf(stream, \"%.0f\", doubleinfo);\r\n                break;\r\n              case VAR_SIZE_DOWNLOAD:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.0f\", doubleinfo);\r\n                break;\r\n              case VAR_SPEED_DOWNLOAD:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD,\r\n                                     &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_SPEED_UPLOAD:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))\r\n                  fprintf(stream, \"%.3f\", doubleinfo);\r\n                break;\r\n              case VAR_CONTENT_TYPE:\r\n                if((CURLE_OK ==\r\n                    curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &stringp))\r\n                   && stringp)\r\n                  fputs(stringp, stream);\r\n                break;\r\n              case VAR_FTP_ENTRY_PATH:\r\n                if((CURLE_OK ==\r\n                    curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &stringp))\r\n                   && stringp)\r\n                  fputs(stringp, stream);\r\n                break;\r\n              case VAR_REDIRECT_URL:\r\n                if((CURLE_OK ==\r\n                    curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &stringp))\r\n                   && stringp)\r\n                  fputs(stringp, stream);\r\n                break;\r\n              case VAR_SSL_VERIFY_RESULT:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT,\r\n                                     &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              case VAR_EFFECTIVE_FILENAME:\r\n                if(outs->filename)\r\n                  fprintf(stream, \"%s\", outs->filename);\r\n                break;\r\n              case VAR_PRIMARY_IP:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP,\r\n                                     &stringp))\r\n                  fprintf(stream, \"%s\", stringp);\r\n                break;\r\n              case VAR_PRIMARY_PORT:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT,\r\n                                     &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              case VAR_LOCAL_IP:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_LOCAL_IP,\r\n                                     &stringp))\r\n                  fprintf(stream, \"%s\", stringp);\r\n                break;\r\n              case VAR_LOCAL_PORT:\r\n                if(CURLE_OK ==\r\n                   curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT,\r\n                                     &longinfo))\r\n                  fprintf(stream, \"%ld\", longinfo);\r\n                break;\r\n              default:\r\n                break;\r\n              }\r\n              break;\r\n            }\r\n          }\r\n          if(!match) {\r\n            fprintf(stderr, \"curl: unknown --write-out variable: '%s'\\n\", ptr);\r\n          }\r\n          ptr = end + 1; /* pass the end */\r\n          *end = keepit;\r\n        }\r\n        else {\r\n          /* illegal syntax, then just output the characters that are used */\r\n          fputc('%', stream);\r\n          fputc(ptr[1], stream);\r\n          ptr += 2;\r\n        }\r\n      }\r\n    }\r\n    else if('\\\\' == *ptr) {\r\n      switch(ptr[1]) {\r\n      case 'r':\r\n        fputc('\\r', stream);\r\n        break;\r\n      case 'n':\r\n        fputc('\\n', stream);\r\n        break;\r\n      case 't':\r\n        fputc('\\t', stream);\r\n        break;\r\n      default:\r\n        /* unknown, just output this */\r\n        fputc(*ptr, stream);\r\n        fputc(ptr[1], stream);\r\n        break;\r\n      }\r\n      ptr += 2;\r\n    }\r\n    else {\r\n      fputc(*ptr, stream);\r\n      ptr++;\r\n    }\r\n  }\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_writeout.h",
    "content": "#ifndef HEADER_CURL_TOOL_WRITEOUT_H\r\n#define HEADER_CURL_TOOL_WRITEOUT_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nvoid ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo);\r\n\r\n#endif /* HEADER_CURL_TOOL_WRITEOUT_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_xattr.c",
    "content": "/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\n#ifdef HAVE_FSETXATTR\r\n#  include <sys/xattr.h> /* header from libc, not from libattr */\r\n#endif\r\n\r\n#include \"tool_xattr.h\"\r\n\r\n#include \"memdebug.h\" /* keep this as LAST include */\r\n\r\n#ifdef HAVE_FSETXATTR\r\n\r\n/* mapping table of curl metadata to extended attribute names */\r\nstatic const struct xattr_mapping {\r\n  const char *attr; /* name of the xattr */\r\n  CURLINFO info;\r\n} mappings[] = {\r\n  /* mappings proposed by\r\n   * http://freedesktop.org/wiki/CommonExtendedAttributes\r\n   */\r\n  { \"user.xdg.origin.url\", CURLINFO_EFFECTIVE_URL },\r\n  { \"user.mime_type\",      CURLINFO_CONTENT_TYPE },\r\n  { NULL,                  CURLINFO_NONE } /* last element, abort loop here */\r\n};\r\n\r\n/* store metadata from the curl request alongside the downloaded\r\n * file using extended attributes\r\n */\r\nint fwrite_xattr(CURL *curl, int fd)\r\n{\r\n  int i = 0;\r\n  int err = 0;\r\n  /* loop through all xattr-curlinfo pairs and abort on a set error */\r\n  while(err == 0 && mappings[i].attr != NULL) {\r\n    char *value = NULL;\r\n    CURLcode rc = curl_easy_getinfo(curl, mappings[i].info, &value);\r\n    if(rc == CURLE_OK && value) {\r\n#ifdef HAVE_FSETXATTR_6\r\n      err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0, 0);\r\n#elif defined(HAVE_FSETXATTR_5)\r\n      err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0);\r\n#endif\r\n    }\r\n    i++;\r\n  }\r\n  return err;\r\n}\r\n#else\r\nint fwrite_xattr(CURL *curl, int fd)\r\n{\r\n  (void)curl;\r\n  (void)fd;\r\n  return 0;\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/tool_xattr.h",
    "content": "#ifndef HEADER_CURL_TOOL_XATTR_H\r\n#define HEADER_CURL_TOOL_XATTR_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#include \"tool_setup.h\"\r\n\r\nint fwrite_xattr(CURL *curl, int fd);\r\n\r\n#endif /* HEADER_CURL_TOOL_XATTR_H */\r\n"
  },
  {
    "path": "Engine/libs/curl-7.29.0-minimal/src/version.h",
    "content": "#ifndef HEADER_CURL_VERSION_H\r\n#define HEADER_CURL_VERSION_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <curl/curlver.h>\r\n\r\n#define CURL_NAME \"curl\"\r\n#define CURL_COPYRIGHT LIBCURL_COPYRIGHT\r\n#define CURL_VERSION \"7.22.0\"\r\n#define CURL_VERSION_MAJOR LIBCURL_VERSION_MAJOR\r\n#define CURL_VERSION_MINOR LIBCURL_VERSION_MINOR\r\n#define CURL_VERSION_PATCH LIBCURL_VERSION_PATCH\r\n#define CURL_ID CURL_NAME \" \" CURL_VERSION \" (\" OS \") \"\r\n\r\n#endif /* HEADER_CURL_VERSION_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/config/ftconfig.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftconfig.h                                                             */\r\n/*                                                                         */\r\n/*    ANSI-specific configuration file (specification only).               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006-2008, 2010-2011 by                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This header file contains a number of macro definitions that are used */\r\n  /* by the rest of the engine.  Most of the macros here are automatically */\r\n  /* determined at compile time, and you should not need to change it to   */\r\n  /* port FreeType, except to compile the library with a non-ANSI          */\r\n  /* compiler.                                                             */\r\n  /*                                                                       */\r\n  /* Note however that if some specific modifications are needed, we       */\r\n  /* advise you to place a modified copy in your build directory.          */\r\n  /*                                                                       */\r\n  /* The build directory is usually `freetype/builds/<system>', and        */\r\n  /* contains system-specific files that are always included first when    */\r\n  /* building the library.                                                 */\r\n  /*                                                                       */\r\n  /* This ANSI version should stay in `include/freetype/config'.           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __FTCONFIG_H__\r\n#define __FTCONFIG_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_OPTIONS_H\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*               PLATFORM-SPECIFIC CONFIGURATION MACROS                  */\r\n  /*                                                                       */\r\n  /* These macros can be toggled to suit a specific system.  The current   */\r\n  /* ones are defaults used to compile FreeType in an ANSI C environment   */\r\n  /* (16bit compilers are also supported).  Copy this file to your own     */\r\n  /* `freetype/builds/<system>' directory, and edit it to port the engine. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* There are systems (like the Texas Instruments 'C54x) where a `char' */\r\n  /* has 16 bits.  ANSI C says that sizeof(char) is always 1.  Since an  */\r\n  /* `int' has 16 bits also for this system, sizeof(int) gives 1 which   */\r\n  /* is probably unexpected.                                             */\r\n  /*                                                                     */\r\n  /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a      */\r\n  /* `char' type.                                                        */\r\n\r\n#ifndef FT_CHAR_BIT\r\n#define FT_CHAR_BIT  CHAR_BIT\r\n#endif\r\n\r\n\r\n  /* The size of an `int' type.  */\r\n#if                                 FT_UINT_MAX == 0xFFFFUL\r\n#define FT_SIZEOF_INT  (16 / FT_CHAR_BIT)\r\n#elif                               FT_UINT_MAX == 0xFFFFFFFFUL\r\n#define FT_SIZEOF_INT  (32 / FT_CHAR_BIT)\r\n#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL\r\n#define FT_SIZEOF_INT  (64 / FT_CHAR_BIT)\r\n#else\r\n#error \"Unsupported size of `int' type!\"\r\n#endif\r\n\r\n  /* The size of a `long' type.  A five-byte `long' (as used e.g. on the */\r\n  /* DM642) is recognized but avoided.                                   */\r\n#if                                  FT_ULONG_MAX == 0xFFFFFFFFUL\r\n#define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)\r\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL\r\n#define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)\r\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL\r\n#define FT_SIZEOF_LONG  (64 / FT_CHAR_BIT)\r\n#else\r\n#error \"Unsupported size of `long' type!\"\r\n#endif\r\n\r\n\r\n  /* FT_UNUSED is a macro used to indicate that a given parameter is not  */\r\n  /* used -- this is only used to get rid of unpleasant compiler warnings */\r\n#ifndef FT_UNUSED\r\n#define FT_UNUSED( arg )  ( (arg) = (arg) )\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                     AUTOMATIC CONFIGURATION MACROS                    */\r\n  /*                                                                       */\r\n  /* These macros are computed from the ones defined above.  Don't touch   */\r\n  /* their definition, unless you know precisely what you are doing.  No   */\r\n  /* porter should need to mess with them.                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Mac support                                                           */\r\n  /*                                                                       */\r\n  /*   This is the only necessary change, so it is defined here instead    */\r\n  /*   providing a new configuration file.                                 */\r\n  /*                                                                       */\r\n#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )\r\n  /* no Carbon frameworks for 64bit 10.4.x */\r\n  /* AvailabilityMacros.h is available since Mac OS X 10.2,        */\r\n  /* so guess the system version by maximum errno before inclusion */\r\n#include <errno.h>\r\n#ifdef ECANCELED /* defined since 10.2 */\r\n#include \"AvailabilityMacros.h\"\r\n#endif\r\n#if defined( __LP64__ ) && \\\r\n    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )\r\n#undef FT_MACINTOSH\r\n#endif\r\n\r\n#elif defined( __SC__ ) || defined( __MRC__ )\r\n  /* Classic MacOS compilers */\r\n#include \"ConditionalMacros.h\"\r\n#if TARGET_OS_MAC\r\n#define FT_MACINTOSH 1\r\n#endif\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Int16                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for a 16bit signed integer type.                         */\r\n  /*                                                                       */\r\n  typedef signed short  FT_Int16;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UInt16                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for a 16bit unsigned integer type.                       */\r\n  /*                                                                       */\r\n  typedef unsigned short  FT_UInt16;\r\n\r\n  /* */\r\n\r\n\r\n  /* this #if 0 ... #endif clause is for documentation purposes */\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Int32                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for a 32bit signed integer type.  The size depends on    */\r\n  /*    the configuration.                                                 */\r\n  /*                                                                       */\r\n  typedef signed XXX  FT_Int32;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UInt32                                                          */\r\n  /*                                                                       */\r\n  /*    A typedef for a 32bit unsigned integer type.  The size depends on  */\r\n  /*    the configuration.                                                 */\r\n  /*                                                                       */\r\n  typedef unsigned XXX  FT_UInt32;\r\n\r\n  /* */\r\n\r\n#endif\r\n\r\n#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)\r\n\r\n  typedef signed int      FT_Int32;\r\n  typedef unsigned int    FT_UInt32;\r\n\r\n#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)\r\n\r\n  typedef signed long     FT_Int32;\r\n  typedef unsigned long   FT_UInt32;\r\n\r\n#else\r\n#error \"no 32bit type found -- please check your configuration files\"\r\n#endif\r\n\r\n\r\n  /* look up an integer type that is at least 32 bits */\r\n#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)\r\n\r\n  typedef int            FT_Fast;\r\n  typedef unsigned int   FT_UFast;\r\n\r\n#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)\r\n\r\n  typedef long           FT_Fast;\r\n  typedef unsigned long  FT_UFast;\r\n\r\n#endif\r\n\r\n\r\n  /* determine whether we have a 64-bit int type for platforms without */\r\n  /* Autoconf                                                          */\r\n#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)\r\n\r\n  /* FT_LONG64 must be defined if a 64-bit type is available */\r\n#define FT_LONG64\r\n#define FT_INT64  long\r\n\r\n#elif defined( _MSC_VER ) && _MSC_VER >= 900  /* Visual C++ (and Intel C++) */\r\n\r\n  /* this compiler provides the __int64 type */\r\n#define FT_LONG64\r\n#define FT_INT64  __int64\r\n\r\n#elif defined( __BORLANDC__ )  /* Borland C++ */\r\n\r\n  /* XXXX: We should probably check the value of __BORLANDC__ in order */\r\n  /*       to test the compiler version.                               */\r\n\r\n  /* this compiler provides the __int64 type */\r\n#define FT_LONG64\r\n#define FT_INT64  __int64\r\n\r\n#elif defined( __WATCOMC__ )   /* Watcom C++ */\r\n\r\n  /* Watcom doesn't provide 64-bit data types */\r\n\r\n#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */\r\n\r\n#define FT_LONG64\r\n#define FT_INT64  long long int\r\n\r\n#elif defined( __GNUC__ )\r\n\r\n  /* GCC provides the `long long' type */\r\n#define FT_LONG64\r\n#define FT_INT64  long long int\r\n\r\n#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A 64-bit data type will create compilation problems if you compile    */\r\n  /* in strict ANSI mode.  To avoid them, we disable its use if __STDC__   */\r\n  /* is defined.  You can however ignore this rule by defining the         */\r\n  /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro.                     */\r\n  /*                                                                       */\r\n#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )\r\n\r\n#ifdef __STDC__\r\n\r\n  /* undefine the 64-bit macros in strict ANSI compilation mode */\r\n#undef FT_LONG64\r\n#undef FT_INT64\r\n\r\n#endif /* __STDC__ */\r\n\r\n#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */\r\n\r\n\r\n#define FT_BEGIN_STMNT  do {\r\n#define FT_END_STMNT    } while ( 0 )\r\n#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT\r\n\r\n\r\n#ifndef  FT_CONFIG_OPTION_NO_ASSEMBLER\r\n  /* Provide assembler fragments for performance-critical functions. */\r\n  /* These must be defined `static __inline__' with GCC.             */\r\n\r\n#if defined( __CC_ARM ) || defined( __ARMCC__ )  /* RVCT */\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_arm\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline FT_Int32\r\n  FT_MulFix_arm( FT_Int32  a,\r\n                 FT_Int32  b )\r\n  {\r\n    register FT_Int32  t, t2;\r\n\r\n\r\n    __asm\r\n    {\r\n      smull t2, t,  b,  a           /* (lo=t2,hi=t) = a*b */\r\n      mov   a,  t,  asr #31         /* a   = (hi >> 31) */\r\n      add   a,  a,  #0x8000         /* a  += 0x8000 */\r\n      adds  t2, t2, a               /* t2 += a */\r\n      adc   t,  t,  #0              /* t  += carry */\r\n      mov   a,  t2, lsr #16         /* a   = t2 >> 16 */\r\n      orr   a,  a,  t,  lsl #16     /* a  |= t << 16 */\r\n    }\r\n    return a;\r\n  }\r\n\r\n#endif /* __CC_ARM || __ARMCC__ */\r\n\r\n\r\n#ifdef __GNUC__\r\n\r\n#if defined( __arm__ ) && !defined( __thumb__ )    && \\\r\n    !( defined( __CC_ARM ) || defined( __ARMCC__ ) )\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_arm\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline__ FT_Int32\r\n  FT_MulFix_arm( FT_Int32  a,\r\n                 FT_Int32  b )\r\n  {\r\n    register FT_Int32  t, t2;\r\n\r\n\r\n    __asm__ __volatile__ (\r\n      \"smull  %1, %2, %4, %3\\n\\t\"       /* (lo=%1,hi=%2) = a*b */\r\n      \"mov    %0, %2, asr #31\\n\\t\"      /* %0  = (hi >> 31) */\r\n      \"add    %0, %0, #0x8000\\n\\t\"      /* %0 += 0x8000 */\r\n      \"adds   %1, %1, %0\\n\\t\"           /* %1 += %0 */\r\n      \"adc    %2, %2, #0\\n\\t\"           /* %2 += carry */\r\n      \"mov    %0, %1, lsr #16\\n\\t\"      /* %0  = %1 >> 16 */\r\n      \"orr    %0, %0, %2, lsl #16\\n\\t\"  /* %0 |= %2 << 16 */\r\n      : \"=r\"(a), \"=&r\"(t2), \"=&r\"(t)\r\n      : \"r\"(a), \"r\"(b)\r\n      : \"cc\" );\r\n    return a;\r\n  }\r\n\r\n#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */\r\n\r\n#if defined( __i386__ )\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_i386\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline__ FT_Int32\r\n  FT_MulFix_i386( FT_Int32  a,\r\n                  FT_Int32  b )\r\n  {\r\n    register FT_Int32  result;\r\n\r\n\r\n    __asm__ __volatile__ (\r\n      \"imul  %%edx\\n\"\r\n      \"movl  %%edx, %%ecx\\n\"\r\n      \"sarl  $31, %%ecx\\n\"\r\n      \"addl  $0x8000, %%ecx\\n\"\r\n      \"addl  %%ecx, %%eax\\n\"\r\n      \"adcl  $0, %%edx\\n\"\r\n      \"shrl  $16, %%eax\\n\"\r\n      \"shll  $16, %%edx\\n\"\r\n      \"addl  %%edx, %%eax\\n\"\r\n      : \"=a\"(result), \"=d\"(b)\r\n      : \"a\"(a), \"d\"(b)\r\n      : \"%ecx\", \"cc\" );\r\n    return result;\r\n  }\r\n\r\n#endif /* i386 */\r\n\r\n#endif /* __GNUC__ */\r\n\r\n\r\n#ifdef _MSC_VER /* Visual C++ */\r\n\r\n#ifdef _M_IX86\r\n\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_i386\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline FT_Int32\r\n  FT_MulFix_i386( FT_Int32  a,\r\n                  FT_Int32  b )\r\n  {\r\n    register FT_Int32  result;\r\n\r\n    __asm\r\n    {\r\n      mov eax, a\r\n      mov edx, b\r\n      imul edx\r\n      mov ecx, edx\r\n      sar ecx, 31\r\n      add ecx, 8000h\r\n      add eax, ecx\r\n      adc edx, 0\r\n      shr eax, 16\r\n      shl edx, 16\r\n      add eax, edx\r\n      mov result, eax\r\n    }\r\n    return result;\r\n  }\r\n\r\n#endif /* _M_IX86 */\r\n\r\n#endif /* _MSC_VER */\r\n\r\n#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_INLINE_MULFIX\r\n#ifdef FT_MULFIX_ASSEMBLER\r\n#define FT_MULFIX_INLINED  FT_MULFIX_ASSEMBLER\r\n#endif\r\n#endif\r\n\r\n\r\n#ifdef FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#define FT_LOCAL( x )      static  x\r\n#define FT_LOCAL_DEF( x )  static  x\r\n\r\n#else\r\n\r\n#ifdef __cplusplus\r\n#define FT_LOCAL( x )      extern \"C\"  x\r\n#define FT_LOCAL_DEF( x )  extern \"C\"  x\r\n#else\r\n#define FT_LOCAL( x )      extern  x\r\n#define FT_LOCAL_DEF( x )  x\r\n#endif\r\n\r\n#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */\r\n\r\n\r\n#ifndef FT_BASE\r\n\r\n#ifdef __cplusplus\r\n#define FT_BASE( x )  extern \"C\"  x\r\n#else\r\n#define FT_BASE( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_BASE */\r\n\r\n\r\n#ifndef FT_BASE_DEF\r\n\r\n#ifdef __cplusplus\r\n#define FT_BASE_DEF( x )  x\r\n#else\r\n#define FT_BASE_DEF( x )  x\r\n#endif\r\n\r\n#endif /* !FT_BASE_DEF */\r\n\r\n\r\n#ifndef FT_EXPORT\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXPORT( x )  extern \"C\"  x\r\n#else\r\n#define FT_EXPORT( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_EXPORT */\r\n\r\n\r\n#ifndef FT_EXPORT_DEF\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXPORT_DEF( x )  extern \"C\"  x\r\n#else\r\n#define FT_EXPORT_DEF( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_EXPORT_DEF */\r\n\r\n\r\n#ifndef FT_EXPORT_VAR\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXPORT_VAR( x )  extern \"C\"  x\r\n#else\r\n#define FT_EXPORT_VAR( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_EXPORT_VAR */\r\n\r\n  /* The following macros are needed to compile the library with a   */\r\n  /* C++ compiler and with 16bit compilers.                          */\r\n  /*                                                                 */\r\n\r\n  /* This is special.  Within C++, you must specify `extern \"C\"' for */\r\n  /* functions which are used via function pointers, and you also    */\r\n  /* must do that for structures which contain function pointers to  */\r\n  /* assure C linkage -- it's not possible to have (local) anonymous */\r\n  /* functions which are accessed by (global) function pointers.     */\r\n  /*                                                                 */\r\n  /*                                                                 */\r\n  /* FT_CALLBACK_DEF is used to _define_ a callback function.        */\r\n  /*                                                                 */\r\n  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */\r\n  /* contains pointers to callback functions.                        */\r\n  /*                                                                 */\r\n  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */\r\n  /* that contains pointers to callback functions.                   */\r\n  /*                                                                 */\r\n  /*                                                                 */\r\n  /* Some 16bit compilers have to redefine these macros to insert    */\r\n  /* the infamous `_cdecl' or `__fastcall' declarations.             */\r\n  /*                                                                 */\r\n#ifndef FT_CALLBACK_DEF\r\n#ifdef __cplusplus\r\n#define FT_CALLBACK_DEF( x )  extern \"C\"  x\r\n#else\r\n#define FT_CALLBACK_DEF( x )  static  x\r\n#endif\r\n#endif /* FT_CALLBACK_DEF */\r\n\r\n#ifndef FT_CALLBACK_TABLE\r\n#ifdef __cplusplus\r\n#define FT_CALLBACK_TABLE      extern \"C\"\r\n#define FT_CALLBACK_TABLE_DEF  extern \"C\"\r\n#else\r\n#define FT_CALLBACK_TABLE      extern\r\n#define FT_CALLBACK_TABLE_DEF  /* nothing */\r\n#endif\r\n#endif /* FT_CALLBACK_TABLE */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTCONFIG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/config/ftheader.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftheader.h                                                             */\r\n/*                                                                         */\r\n/*    Build macros of the FreeType 2 library.                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2008, 2010, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#ifndef __FT_HEADER_H__\r\n#define __FT_HEADER_H__\r\n\r\n\r\n  /*@***********************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_BEGIN_HEADER                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro is used in association with @FT_END_HEADER in header    */\r\n  /*    files to ensure that the declarations within are properly          */\r\n  /*    encapsulated in an `extern \"C\" { .. }' block when included from a  */\r\n  /*    C++ compiler.                                                      */\r\n  /*                                                                       */\r\n#ifdef __cplusplus\r\n#define FT_BEGIN_HEADER  extern \"C\" {\r\n#else\r\n#define FT_BEGIN_HEADER  /* nothing */\r\n#endif\r\n\r\n\r\n  /*@***********************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_END_HEADER                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro is used in association with @FT_BEGIN_HEADER in header  */\r\n  /*    files to ensure that the declarations within are properly          */\r\n  /*    encapsulated in an `extern \"C\" { .. }' block when included from a  */\r\n  /*    C++ compiler.                                                      */\r\n  /*                                                                       */\r\n#ifdef __cplusplus\r\n#define FT_END_HEADER  }\r\n#else\r\n#define FT_END_HEADER  /* nothing */\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Aliases for the FreeType 2 public and configuration files.            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    header_file_macros                                                 */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Header File Macros                                                 */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Macro definitions used to #include specific header files.          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The following macros are defined to the name of specific           */\r\n  /*    FreeType~2 header files.  They can be used directly in #include    */\r\n  /*    statements as in:                                                  */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      #include FT_FREETYPE_H                                           */\r\n  /*      #include FT_MULTIPLE_MASTERS_H                                   */\r\n  /*      #include FT_GLYPH_H                                              */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    There are several reasons why we are now using macros to name      */\r\n  /*    public header files.  The first one is that such macros are not    */\r\n  /*    limited to the infamous 8.3~naming rule required by DOS (and       */\r\n  /*    `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h').   */\r\n  /*                                                                       */\r\n  /*    The second reason is that it allows for more flexibility in the    */\r\n  /*    way FreeType~2 is installed on a given system.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* configuration files */\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_CONFIG_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   FreeType~2 configuration data.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_CONFIG_H\r\n#define FT_CONFIG_CONFIG_H  <freetype/config/ftconfig.h>\r\n#endif\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_STANDARD_LIBRARY_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   FreeType~2 interface to the standard C library functions.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_STANDARD_LIBRARY_H\r\n#define FT_CONFIG_STANDARD_LIBRARY_H  <freetype/config/ftstdlib.h>\r\n#endif\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_OPTIONS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   FreeType~2 project-specific configuration options.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_OPTIONS_H\r\n#define FT_CONFIG_OPTIONS_H  <freetype/config/ftoption.h>\r\n#endif\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_MODULES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list of FreeType~2 modules that are statically linked to new library\r\n   *   instances in @FT_Init_FreeType.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_MODULES_H\r\n#define FT_CONFIG_MODULES_H  <freetype/config/ftmodule.h>\r\n#endif\r\n\r\n  /* */\r\n\r\n  /* public headers */\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_FREETYPE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   base FreeType~2 API.\r\n   *\r\n   */\r\n#define FT_FREETYPE_H  <freetype/freetype.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ERRORS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list of FreeType~2 error codes (and messages).\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_ERRORS_H  <freetype/fterrors.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MODULE_ERRORS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list of FreeType~2 module error offsets (and messages).\r\n   *\r\n   */\r\n#define FT_MODULE_ERRORS_H  <freetype/ftmoderr.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SYSTEM_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 interface to low-level operations (i.e., memory management\r\n   *   and stream i/o).\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_SYSTEM_H  <freetype/ftsystem.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IMAGE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing type\r\n   *   definitions related to glyph images (i.e., bitmaps, outlines,\r\n   *   scan-converter parameters).\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_IMAGE_H  <freetype/ftimage.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TYPES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   basic data types defined by FreeType~2.\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_TYPES_H  <freetype/fttypes.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LIST_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list management API of FreeType~2.\r\n   *\r\n   *   (Most applications will never need to include this file.)\r\n   *\r\n   */\r\n#define FT_LIST_H  <freetype/ftlist.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_OUTLINE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   scalable outline management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_OUTLINE_H  <freetype/ftoutln.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SIZES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API which manages multiple @FT_Size objects per face.\r\n   *\r\n   */\r\n#define FT_SIZES_H  <freetype/ftsizes.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MODULE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   module management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_MODULE_H  <freetype/ftmodapi.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_RENDER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   renderer module management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_RENDER_H  <freetype/ftrender.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_AUTOHINTER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   structures and macros related to the auto-hinting module.\r\n   *\r\n   */\r\n#define FT_AUTOHINTER_H  <freetype/ftautoh.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TYPE1_TABLES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   types and API specific to the Type~1 format.\r\n   *\r\n   */\r\n#define FT_TYPE1_TABLES_H  <freetype/t1tables.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRUETYPE_IDS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   enumeration values which identify name strings, languages, encodings,\r\n   *   etc.  This file really contains a _large_ set of constant macro\r\n   *   definitions, taken from the TrueType and OpenType specifications.\r\n   *\r\n   */\r\n#define FT_TRUETYPE_IDS_H  <freetype/ttnameid.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRUETYPE_TABLES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   types and API specific to the TrueType (as well as OpenType) format.\r\n   *\r\n   */\r\n#define FT_TRUETYPE_TABLES_H  <freetype/tttables.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRUETYPE_TAGS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of TrueType four-byte `tags' which identify blocks in\r\n   *   SFNT-based font formats (i.e., TrueType and OpenType).\r\n   *\r\n   */\r\n#define FT_TRUETYPE_TAGS_H  <freetype/tttags.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BDF_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which accesses BDF-specific strings from a\r\n   *   face.\r\n   *\r\n   */\r\n#define FT_BDF_H  <freetype/ftbdf.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CID_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which access CID font information from a\r\n   *   face.\r\n   *\r\n   */\r\n#define FT_CID_H  <freetype/ftcid.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GZIP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports gzip-compressed files.\r\n   *\r\n   */\r\n#define FT_GZIP_H  <freetype/ftgzip.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LZW_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports LZW-compressed files.\r\n   *\r\n   */\r\n#define FT_LZW_H  <freetype/ftlzw.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BZIP2_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports bzip2-compressed files.\r\n   *\r\n   */\r\n#define FT_BZIP2_H  <freetype/ftbzip2.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_WINFONTS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports Windows FNT files.\r\n   *\r\n   */\r\n#define FT_WINFONTS_H   <freetype/ftwinfnt.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GLYPH_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional glyph management component.\r\n   *\r\n   */\r\n#define FT_GLYPH_H  <freetype/ftglyph.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BITMAP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional bitmap conversion component.\r\n   *\r\n   */\r\n#define FT_BITMAP_H  <freetype/ftbitmap.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BBOX_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional exact bounding box computation routines.\r\n   *\r\n   */\r\n#define FT_BBOX_H  <freetype/ftbbox.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional FreeType~2 cache sub-system.\r\n   *\r\n   */\r\n#define FT_CACHE_H  <freetype/ftcache.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_IMAGE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   `glyph image' API of the FreeType~2 cache sub-system.\r\n   *\r\n   *   It is used to define a cache for @FT_Glyph elements.  You can also\r\n   *   use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to\r\n   *   store small glyph bitmaps, as it will use less memory.\r\n   *\r\n   *   This macro is deprecated.  Simply include @FT_CACHE_H to have all\r\n   *   glyph image-related cache declarations.\r\n   *\r\n   */\r\n#define FT_CACHE_IMAGE_H  FT_CACHE_H\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_SMALL_BITMAPS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   `small bitmaps' API of the FreeType~2 cache sub-system.\r\n   *\r\n   *   It is used to define a cache for small glyph bitmaps in a relatively\r\n   *   memory-efficient way.  You can also use the API defined in\r\n   *   @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,\r\n   *   including scalable outlines.\r\n   *\r\n   *   This macro is deprecated.  Simply include @FT_CACHE_H to have all\r\n   *   small bitmaps-related cache declarations.\r\n   *\r\n   */\r\n#define FT_CACHE_SMALL_BITMAPS_H  FT_CACHE_H\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_CHARMAP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   `charmap' API of the FreeType~2 cache sub-system.\r\n   *\r\n   *   This macro is deprecated.  Simply include @FT_CACHE_H to have all\r\n   *   charmap-based cache declarations.\r\n   *\r\n   */\r\n#define FT_CACHE_CHARMAP_H  FT_CACHE_H\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MAC_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   Macintosh-specific FreeType~2 API.  The latter is used to access\r\n   *   fonts embedded in resource forks.\r\n   *\r\n   *   This header file must be explicitly included by client applications\r\n   *   compiled on the Mac (note that the base API still works though).\r\n   *\r\n   */\r\n#define FT_MAC_H  <freetype/ftmac.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MULTIPLE_MASTERS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional multiple-masters management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_MULTIPLE_MASTERS_H  <freetype/ftmm.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SFNT_NAMES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional FreeType~2 API which accesses embedded `name' strings in\r\n   *   SFNT-based font formats (i.e., TrueType and OpenType).\r\n   *\r\n   */\r\n#define FT_SFNT_NAMES_H  <freetype/ftsnames.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_OPENTYPE_VALIDATE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional FreeType~2 API which validates OpenType tables (BASE, GDEF,\r\n   *   GPOS, GSUB, JSTF).\r\n   *\r\n   */\r\n#define FT_OPENTYPE_VALIDATE_H  <freetype/ftotval.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GX_VALIDATE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,\r\n   *   mort, morx, bsln, just, kern, opbd, trak, prop).\r\n   *\r\n   */\r\n#define FT_GX_VALIDATE_H  <freetype/ftgxval.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_PFR_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which accesses PFR-specific data.\r\n   *\r\n   */\r\n#define FT_PFR_H  <freetype/ftpfr.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_STROKER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which provides functions to stroke outline paths.\r\n   */\r\n#define FT_STROKER_H  <freetype/ftstroke.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SYNTHESIS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs artificial obliquing and emboldening.\r\n   */\r\n#define FT_SYNTHESIS_H  <freetype/ftsynth.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_XFREE86_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which provides functions specific to the XFree86 and\r\n   *   X.Org X11 servers.\r\n   */\r\n#define FT_XFREE86_H  <freetype/ftxf86.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRIGONOMETRY_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs trigonometric computations (e.g.,\r\n   *   cosines and arc tangents).\r\n   */\r\n#define FT_TRIGONOMETRY_H  <freetype/fttrigon.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LCD_FILTER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs color filtering for subpixel rendering.\r\n   */\r\n#define FT_LCD_FILTER_H  <freetype/ftlcdfil.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_UNPATENTED_HINTING_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs color filtering for subpixel rendering.\r\n   */\r\n#define FT_UNPATENTED_HINTING_H  <freetype/ttunpat.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_INCREMENTAL_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs color filtering for subpixel rendering.\r\n   */\r\n#define FT_INCREMENTAL_H  <freetype/ftincrem.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GASP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which returns entries from the TrueType GASP table.\r\n   */\r\n#define FT_GASP_H  <freetype/ftgasp.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ADVANCES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which returns individual and ranged glyph advances.\r\n   */\r\n#define FT_ADVANCES_H  <freetype/ftadvanc.h>\r\n\r\n\r\n  /* */\r\n\r\n#define FT_ERROR_DEFINITIONS_H  <freetype/fterrdef.h>\r\n\r\n\r\n  /* The internals of the cache sub-system are no longer exposed.  We */\r\n  /* default to FT_CACHE_H at the moment just in case, but we know of */\r\n  /* no rogue client that uses them.                                  */\r\n  /*                                                                  */\r\n#define FT_CACHE_MANAGER_H           <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_MRU_H      <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_MANAGER_H  <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_CACHE_H    <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_GLYPH_H    <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_IMAGE_H    <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_SBITS_H    <freetype/ftcache.h>\r\n\r\n\r\n#define FT_INCREMENTAL_H          <freetype/ftincrem.h>\r\n\r\n#define FT_TRUETYPE_UNPATENTED_H  <freetype/ttunpat.h>\r\n\r\n\r\n  /*\r\n   * Include internal headers definitions from <freetype/internal/...>\r\n   * only when building the library.\r\n   */\r\n#ifdef FT2_BUILD_LIBRARY\r\n#define  FT_INTERNAL_INTERNAL_H  <freetype/internal/internal.h>\r\n#include FT_INTERNAL_INTERNAL_H\r\n#endif /* FT2_BUILD_LIBRARY */\r\n\r\n\r\n#endif /* __FT2_BUILD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/config/ftmodule.h",
    "content": "/*\r\n *  This file registers the FreeType modules compiled into the library.\r\n *\r\n *  If you use GNU make, this file IS NOT USED!  Instead, it is created in\r\n *  the objects directory (normally `<topdir>/objs/') based on information\r\n *  from `<topdir>/modules.cfg'.\r\n *\r\n *  Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile\r\n *  FreeType without GNU make.\r\n *\r\n */\r\n\r\nFT_USE_MODULE( FT_Module_Class, autofit_module_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )\r\nFT_USE_MODULE( FT_Module_Class, psaux_module_class )\r\nFT_USE_MODULE( FT_Module_Class, psnames_module_class )\r\nFT_USE_MODULE( FT_Module_Class, pshinter_module_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )\r\nFT_USE_MODULE( FT_Module_Class, sfnt_module_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )\r\n\r\n/* EOF */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/config/ftoption.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftoption.h                                                             */\r\n/*                                                                         */\r\n/*    User-selectable configuration macros (specification only).           */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTOPTION_H__\r\n#define __FTOPTION_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                 USER-SELECTABLE CONFIGURATION MACROS                  */\r\n  /*                                                                       */\r\n  /* This file contains the default configuration macro definitions for    */\r\n  /* a standard build of the FreeType library.  There are three ways to    */\r\n  /* use this file to build project-specific versions of the library:      */\r\n  /*                                                                       */\r\n  /*  - You can modify this file by hand, but this is not recommended in   */\r\n  /*    cases where you would like to build several versions of the        */\r\n  /*    library from a single source directory.                            */\r\n  /*                                                                       */\r\n  /*  - You can put a copy of this file in your build directory, more      */\r\n  /*    precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD'   */\r\n  /*    is the name of a directory that is included _before_ the FreeType  */\r\n  /*    include path during compilation.                                   */\r\n  /*                                                                       */\r\n  /*    The default FreeType Makefiles and Jamfiles use the build          */\r\n  /*    directory `builds/<system>' by default, but you can easily change  */\r\n  /*    that for your own projects.                                        */\r\n  /*                                                                       */\r\n  /*  - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it    */\r\n  /*    slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to       */\r\n  /*    locate this file during the build.  For example,                   */\r\n  /*                                                                       */\r\n  /*      #define FT_CONFIG_OPTIONS_H  <myftoptions.h>                     */\r\n  /*      #include <freetype/config/ftheader.h>                            */\r\n  /*                                                                       */\r\n  /*    will use `$BUILD/myftoptions.h' instead of this file for macro     */\r\n  /*    definitions.                                                       */\r\n  /*                                                                       */\r\n  /*    Note also that you can similarly pre-define the macro              */\r\n  /*    FT_CONFIG_MODULES_H used to locate the file listing of the modules */\r\n  /*    that are statically linked to the library at compile time.  By     */\r\n  /*    default, this file is <freetype/config/ftmodule.h>.                */\r\n  /*                                                                       */\r\n  /*  We highly recommend using the third method whenever possible.        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /**** G E N E R A L   F R E E T Y P E   2   C O N F I G U R A T I O N ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Uncomment the line below if you want to activate sub-pixel rendering  */\r\n  /* (a.k.a. LCD rendering, or ClearType) in this build of the library.    */\r\n  /*                                                                       */\r\n  /* Note that this feature is covered by several Microsoft patents        */\r\n  /* and should not be activated in any default build of the library.      */\r\n  /*                                                                       */\r\n  /* This macro has no impact on the FreeType API, only on its             */\r\n  /* _implementation_.  For example, using FT_RENDER_MODE_LCD when calling */\r\n  /* FT_Render_Glyph still generates a bitmap that is 3 times wider than   */\r\n  /* the original size in case this macro isn't defined; however, each     */\r\n  /* triplet of subpixels has R=G=B.                                       */\r\n  /*                                                                       */\r\n  /* This is done to allow FreeType clients to run unmodified, forcing     */\r\n  /* them to display normal gray-level anti-aliased glyphs.                */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Many compilers provide a non-ANSI 64-bit data type that can be used   */\r\n  /* by FreeType to speed up some computations.  However, this will create */\r\n  /* some problems when compiling the library in strict ANSI mode.         */\r\n  /*                                                                       */\r\n  /* For this reason, the use of 64-bit integers is normally disabled when */\r\n  /* the __STDC__ macro is defined.  You can however disable this by       */\r\n  /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here.                 */\r\n  /*                                                                       */\r\n  /* For most compilers, this will only create compilation warnings when   */\r\n  /* building the library.                                                 */\r\n  /*                                                                       */\r\n  /* ObNote: The compiler-specific 64-bit integers are detected in the     */\r\n  /*         file `ftconfig.h' either statically or through the            */\r\n  /*         `configure' script on supported platforms.                    */\r\n  /*                                                                       */\r\n#undef FT_CONFIG_OPTION_FORCE_INT64\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* If this macro is defined, do not try to use an assembler version of   */\r\n  /* performance-critical functions (e.g. FT_MulFix).  You should only do  */\r\n  /* that to verify that the assembler function works properly, or to      */\r\n  /* execute benchmark tests of the various implementations.               */\r\n/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* If this macro is defined, try to use an inlined assembler version of  */\r\n  /* the `FT_MulFix' function, which is a `hotspot' when loading and       */\r\n  /* hinting glyphs, and which should be executed as fast as possible.     */\r\n  /*                                                                       */\r\n  /* Note that if your compiler or CPU is not supported, this will default */\r\n  /* to the standard and portable implementation found in `ftcalc.c'.      */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_INLINE_MULFIX\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* LZW-compressed file support.                                          */\r\n  /*                                                                       */\r\n  /*   FreeType now handles font files that have been compressed with the  */\r\n  /*   `compress' program.  This is mostly used to parse many of the PCF   */\r\n  /*   files that come with various X11 distributions.  The implementation */\r\n  /*   uses NetBSD's `zopen' to partially uncompress the file on the fly   */\r\n  /*   (see src/lzw/ftgzip.c).                                             */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want to enable this `feature'.             */\r\n  /*                                                                       */\r\n/*#define FT_CONFIG_OPTION_USE_LZW */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Gzip-compressed file support.                                         */\r\n  /*                                                                       */\r\n  /*   FreeType now handles font files that have been compressed with the  */\r\n  /*   `gzip' program.  This is mostly used to parse many of the PCF files */\r\n  /*   that come with XFree86.  The implementation uses `zlib' to          */\r\n  /*   partially uncompress the file on the fly (see src/gzip/ftgzip.c).   */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want to enable this `feature'.  See also   */\r\n  /*   the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below.                       */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_USE_ZLIB */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ZLib library selection                                                */\r\n  /*                                                                       */\r\n  /*   This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined.  */\r\n  /*   It allows FreeType's `ftgzip' component to link to the system's     */\r\n  /*   installation of the ZLib library.  This is useful on systems like   */\r\n  /*   Unix or VMS where it generally is already available.                */\r\n  /*                                                                       */\r\n  /*   If you let it undefined, the component will use its own copy        */\r\n  /*   of the zlib sources instead.  These have been modified to be        */\r\n  /*   included directly within the component and *not* export external    */\r\n  /*   function names.  This allows you to link any program with FreeType  */\r\n  /*   _and_ ZLib without linking conflicts.                               */\r\n  /*                                                                       */\r\n  /*   Do not #undef this macro here since the build system might define   */\r\n  /*   it for certain configurations only.                                 */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Bzip2-compressed file support.                                        */\r\n  /*                                                                       */\r\n  /*   FreeType now handles font files that have been compressed with the  */\r\n  /*   `bzip2' program.  This is mostly used to parse many of the PCF      */\r\n  /*   files that come with XFree86.  The implementation uses `libbz2' to  */\r\n  /*   partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */\r\n  /*   Contrary to gzip, bzip2 currently is not included and need to use   */\r\n  /*   the system available bzip2 implementation.                          */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want to enable this `feature'.             */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_USE_BZIP2 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define to disable the use of file stream functions and types, FILE,   */\r\n  /* fopen() etc.  Enables the use of smaller system libraries on embedded */\r\n  /* systems that have multiple system libraries, some with or without     */\r\n  /* file stream support, in the cases where file stream support is not    */\r\n  /* necessary such as memory loading of font files.                       */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DLL export compilation                                                */\r\n  /*                                                                       */\r\n  /*   When compiling FreeType as a DLL, some systems/compilers need a     */\r\n  /*   special keyword in front OR after the return type of function       */\r\n  /*   declarations.                                                       */\r\n  /*                                                                       */\r\n  /*   Two macros are used within the FreeType source code to define       */\r\n  /*   exported library functions: FT_EXPORT and FT_EXPORT_DEF.            */\r\n  /*                                                                       */\r\n  /*     FT_EXPORT( return_type )                                          */\r\n  /*                                                                       */\r\n  /*       is used in a function declaration, as in                        */\r\n  /*                                                                       */\r\n  /*         FT_EXPORT( FT_Error )                                         */\r\n  /*         FT_Init_FreeType( FT_Library*  alibrary );                    */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*     FT_EXPORT_DEF( return_type )                                      */\r\n  /*                                                                       */\r\n  /*       is used in a function definition, as in                         */\r\n  /*                                                                       */\r\n  /*         FT_EXPORT_DEF( FT_Error )                                     */\r\n  /*         FT_Init_FreeType( FT_Library*  alibrary )                     */\r\n  /*         {                                                             */\r\n  /*           ... some code ...                                           */\r\n  /*           return FT_Err_Ok;                                           */\r\n  /*         }                                                             */\r\n  /*                                                                       */\r\n  /*   You can provide your own implementation of FT_EXPORT and            */\r\n  /*   FT_EXPORT_DEF here if you want.  If you leave them undefined, they  */\r\n  /*   will be later automatically defined as `extern return_type' to      */\r\n  /*   allow normal compilation.                                           */\r\n  /*                                                                       */\r\n  /*   Do not #undef these macros here since the build system might define */\r\n  /*   them for certain configurations only.                               */\r\n  /*                                                                       */\r\n/* #define FT_EXPORT(x)      extern x */\r\n/* #define FT_EXPORT_DEF(x)  x */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Glyph Postscript Names handling                                       */\r\n  /*                                                                       */\r\n  /*   By default, FreeType 2 is compiled with the `psnames' module.  This */\r\n  /*   module is in charge of converting a glyph name string into a        */\r\n  /*   Unicode value, or return a Macintosh standard glyph name for the    */\r\n  /*   use with the TrueType `post' table.                                 */\r\n  /*                                                                       */\r\n  /*   Undefine this macro if you do not want `psnames' compiled in your   */\r\n  /*   build of FreeType.  This has the following effects:                 */\r\n  /*                                                                       */\r\n  /*   - The TrueType driver will provide its own set of glyph names,      */\r\n  /*     if you build it to support postscript names in the TrueType       */\r\n  /*     `post' table.                                                     */\r\n  /*                                                                       */\r\n  /*   - The Type 1 driver will not be able to synthesize a Unicode        */\r\n  /*     charmap out of the glyphs found in the fonts.                     */\r\n  /*                                                                       */\r\n  /*   You would normally undefine this configuration macro when building  */\r\n  /*   a version of FreeType that doesn't contain a Type 1 or CFF driver.  */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Postscript Names to Unicode Values support                            */\r\n  /*                                                                       */\r\n  /*   By default, FreeType 2 is built with the `PSNames' module compiled  */\r\n  /*   in.  Among other things, the module is used to convert a glyph name */\r\n  /*   into a Unicode value.  This is especially useful in order to        */\r\n  /*   synthesize on the fly a Unicode charmap from the CFF/Type 1 driver  */\r\n  /*   through a big table named the `Adobe Glyph List' (AGL).             */\r\n  /*                                                                       */\r\n  /*   Undefine this macro if you do not want the Adobe Glyph List         */\r\n  /*   compiled in your `PSNames' module.  The Type 1 driver will not be   */\r\n  /*   able to synthesize a Unicode charmap out of the glyphs found in the */\r\n  /*   fonts.                                                              */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Support for Mac fonts                                                 */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want support for outline fonts in Mac      */\r\n  /*   format (mac dfont, mac resource, macbinary containing a mac         */\r\n  /*   resource) on non-Mac platforms.                                     */\r\n  /*                                                                       */\r\n  /*   Note that the `FOND' resource isn't checked.                        */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_MAC_FONTS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Guessing methods to access embedded resource forks                    */\r\n  /*                                                                       */\r\n  /*   Enable extra Mac fonts support on non-Mac platforms (e.g.           */\r\n  /*   GNU/Linux).                                                         */\r\n  /*                                                                       */\r\n  /*   Resource forks which include fonts data are stored sometimes in     */\r\n  /*   locations which users or developers don't expected.  In some cases, */\r\n  /*   resource forks start with some offset from the head of a file.  In  */\r\n  /*   other cases, the actual resource fork is stored in file different   */\r\n  /*   from what the user specifies.  If this option is activated,         */\r\n  /*   FreeType tries to guess whether such offsets or different file      */\r\n  /*   names must be used.                                                 */\r\n  /*                                                                       */\r\n  /*   Note that normal, direct access of resource forks is controlled via */\r\n  /*   the FT_CONFIG_OPTION_MAC_FONTS option.                              */\r\n  /*                                                                       */\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Allow the use of FT_Incremental_Interface to load typefaces that      */\r\n  /* contain no glyph data, but supply it via a callback function.         */\r\n  /* This is required by clients supporting document formats which         */\r\n  /* supply font data incrementally as the document is parsed, such        */\r\n  /* as the Ghostscript interpreter for the PostScript language.           */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The size in bytes of the render pool used by the scan-line converter  */\r\n  /* to do all of its work.                                                */\r\n  /*                                                                       */\r\n  /* This must be greater than 4KByte if you use FreeType to rasterize     */\r\n  /* glyphs; otherwise, you may set it to zero to avoid unnecessary        */\r\n  /* allocation of the render pool.                                        */\r\n  /*                                                                       */\r\n#define FT_RENDER_POOL_SIZE  16384L\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FT_MAX_MODULES                                                        */\r\n  /*                                                                       */\r\n  /*   The maximum number of modules that can be registered in a single    */\r\n  /*   FreeType library object.  32 is the default.                        */\r\n  /*                                                                       */\r\n#define FT_MAX_MODULES  32\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Debug level                                                           */\r\n  /*                                                                       */\r\n  /*   FreeType can be compiled in debug or trace mode.  In debug mode,    */\r\n  /*   errors are reported through the `ftdebug' component.  In trace      */\r\n  /*   mode, additional messages are sent to the standard output during    */\r\n  /*   execution.                                                          */\r\n  /*                                                                       */\r\n  /*   Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode.     */\r\n  /*   Define FT_DEBUG_LEVEL_TRACE to build it in trace mode.              */\r\n  /*                                                                       */\r\n  /*   Don't define any of these macros to compile in `release' mode!      */\r\n  /*                                                                       */\r\n  /*   Do not #undef these macros here since the build system might define */\r\n  /*   them for certain configurations only.                               */\r\n  /*                                                                       */\r\n/* #define FT_DEBUG_LEVEL_ERROR */\r\n/* #define FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Autofitter debugging                                                  */\r\n  /*                                                                       */\r\n  /*   If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to     */\r\n  /*   control the autofitter behaviour for debugging purposes with global */\r\n  /*   boolean variables (consequently, you should *never* enable this     */\r\n  /*   while compiling in `release' mode):                                 */\r\n  /*                                                                       */\r\n  /*     _af_debug_disable_horz_hints                                      */\r\n  /*     _af_debug_disable_vert_hints                                      */\r\n  /*     _af_debug_disable_blue_hints                                      */\r\n  /*                                                                       */\r\n  /*   Additionally, the following functions provide dumps of various      */\r\n  /*   internal autofit structures to stdout (using `printf'):             */\r\n  /*                                                                       */\r\n  /*     af_glyph_hints_dump_points                                        */\r\n  /*     af_glyph_hints_dump_segments                                      */\r\n  /*     af_glyph_hints_dump_edges                                         */\r\n  /*                                                                       */\r\n  /*   As an argument, they use another global variable:                   */\r\n  /*                                                                       */\r\n  /*     _af_debug_hints                                                   */\r\n  /*                                                                       */\r\n  /*   Please have a look at the `ftgrid' demo program to see how those    */\r\n  /*   variables and macros should be used.                                */\r\n  /*                                                                       */\r\n  /*   Do not #undef these macros here since the build system might define */\r\n  /*   them for certain configurations only.                               */\r\n  /*                                                                       */\r\n/* #define FT_DEBUG_AUTOFIT */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Memory Debugging                                                      */\r\n  /*                                                                       */\r\n  /*   FreeType now comes with an integrated memory debugger that is       */\r\n  /*   capable of detecting simple errors like memory leaks or double      */\r\n  /*   deletes.  To compile it within your build of the library, you       */\r\n  /*   should define FT_DEBUG_MEMORY here.                                 */\r\n  /*                                                                       */\r\n  /*   Note that the memory debugger is only activated at runtime when     */\r\n  /*   when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */\r\n  /*                                                                       */\r\n  /*   Do not #undef this macro here since the build system might define   */\r\n  /*   it for certain configurations only.                                 */\r\n  /*                                                                       */\r\n/* #define FT_DEBUG_MEMORY */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Module errors                                                         */\r\n  /*                                                                       */\r\n  /*   If this macro is set (which is _not_ the default), the higher byte  */\r\n  /*   of an error code gives the module in which the error has occurred,  */\r\n  /*   while the lower byte is the real error code.                        */\r\n  /*                                                                       */\r\n  /*   Setting this macro makes sense for debugging purposes only, since   */\r\n  /*   it would break source compatibility of certain programs that use    */\r\n  /*   FreeType 2.                                                         */\r\n  /*                                                                       */\r\n  /*   More details can be found in the files ftmoderr.h and fterrors.h.   */\r\n  /*                                                                       */\r\n#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Position Independent Code                                             */\r\n  /*                                                                       */\r\n  /*   If this macro is set (which is _not_ the default), FreeType2 will   */\r\n  /*   avoid creating constants that require address fixups.  Instead the  */\r\n  /*   constants will be moved into a struct and additional intialization  */\r\n  /*   code will be used.                                                  */\r\n  /*                                                                       */\r\n  /*   Setting this macro is needed for systems that prohibit address      */\r\n  /*   fixups, such as BREW.                                               */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****        S F N T   D R I V E R    C O N F I G U R A T I O N       ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support       */\r\n  /* embedded bitmaps in all formats using the SFNT module (namely         */\r\n  /* TrueType & OpenType).                                                 */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to    */\r\n  /* load and enumerate the glyph Postscript names in a TrueType or        */\r\n  /* OpenType file.                                                        */\r\n  /*                                                                       */\r\n  /* Note that when you do not compile the `PSNames' module by undefining  */\r\n  /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will   */\r\n  /* contain additional code used to read the PS Names table from a font.  */\r\n  /*                                                                       */\r\n  /* (By default, the module uses `PSNames' to extract glyph names.)       */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to       */\r\n  /* access the internal name table in a SFNT-based format like TrueType   */\r\n  /* or OpenType.  The name table contains various strings used to         */\r\n  /* describe the font, like family name, copyright, version, etc.  It     */\r\n  /* does not contain any glyph name though.                               */\r\n  /*                                                                       */\r\n  /* Accessing SFNT names is done through the functions declared in        */\r\n  /* `freetype/ftsnames.h'.                                                */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_SFNT_NAMES\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TrueType CMap support                                                 */\r\n  /*                                                                       */\r\n  /*   Here you can fine-tune which TrueType CMap table format shall be    */\r\n  /*   supported.                                                          */\r\n#define TT_CONFIG_CMAP_FORMAT_0\r\n#define TT_CONFIG_CMAP_FORMAT_2\r\n#define TT_CONFIG_CMAP_FORMAT_4\r\n#define TT_CONFIG_CMAP_FORMAT_6\r\n#define TT_CONFIG_CMAP_FORMAT_8\r\n#define TT_CONFIG_CMAP_FORMAT_10\r\n#define TT_CONFIG_CMAP_FORMAT_12\r\n#define TT_CONFIG_CMAP_FORMAT_13\r\n#define TT_CONFIG_CMAP_FORMAT_14\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****    T R U E T Y P E   D R I V E R    C O N F I G U R A T I O N   ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile   */\r\n  /* a bytecode interpreter in the TrueType driver.                        */\r\n  /*                                                                       */\r\n  /* By undefining this, you will only compile the code necessary to load  */\r\n  /* TrueType glyphs without hinting.                                      */\r\n  /*                                                                       */\r\n  /*   Do not #undef this macro here, since the build system might         */\r\n  /*   define it for certain configurations only.                          */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile       */\r\n  /* EXPERIMENTAL subpixel hinting support into the TrueType driver.  This */\r\n  /* replaces the native TrueType hinting mechanism when anything but      */\r\n  /* FT_RENDER_MODE_MONO is requested.                                     */\r\n  /*                                                                       */\r\n  /* Enabling this causes the TrueType driver to ignore instructions under */\r\n  /* certain conditions.  This is done in accordance with the guide here,  */\r\n  /* with some minor differences:                                          */\r\n  /*                                                                       */\r\n  /*  http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */\r\n  /*                                                                       */\r\n  /* By undefining this, you only compile the code necessary to hint       */\r\n  /* TrueType glyphs with native TT hinting.                               */\r\n  /*                                                                       */\r\n  /*   This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be    */\r\n  /*   defined.                                                            */\r\n  /*                                                                       */\r\n/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */\r\n  /* of the TrueType bytecode interpreter is used that doesn't implement   */\r\n  /* any of the patented opcodes and algorithms.  The patents related to   */\r\n  /* TrueType hinting have expired worldwide since May 2010; this option   */\r\n  /* is now deprecated.                                                    */\r\n  /*                                                                       */\r\n  /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored*  */\r\n  /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words,  */\r\n  /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                */\r\n  /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */\r\n  /*                                                                       */\r\n  /* This macro is only useful for a small number of font files (mostly    */\r\n  /* for Asian scripts) that require bytecode interpretation to properly   */\r\n  /* load glyphs.  For all other fonts, this produces unpleasant results,  */\r\n  /* thus the unpatented interpreter is never used to load glyphs from     */\r\n  /* TrueType fonts unless one of the following two options is used.       */\r\n  /*                                                                       */\r\n  /*   - The unpatented interpreter is explicitly activated by the user    */\r\n  /*     through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag         */\r\n  /*     when opening the FT_Face.                                         */\r\n  /*                                                                       */\r\n  /*   - FreeType detects that the FT_Face corresponds to one of the       */\r\n  /*     `trick' fonts (e.g., `Mingliu') it knows about.  The font engine  */\r\n  /*     contains a hard-coded list of font names and other matching       */\r\n  /*     parameters (see function `tt_face_init' in file                   */\r\n  /*     `src/truetype/ttobjs.c').                                         */\r\n  /*                                                                       */\r\n  /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */\r\n  /*                                                                       */\r\n  /*   {                                                                   */\r\n  /*     FT_Parameter  parameter;                                          */\r\n  /*     FT_Open_Args  open_args;                                          */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*     parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING;                  */\r\n  /*                                                                       */\r\n  /*     open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;         */\r\n  /*     open_args.pathname   = my_font_pathname;                          */\r\n  /*     open_args.num_params = 1;                                         */\r\n  /*     open_args.params     = &parameter;                                */\r\n  /*                                                                       */\r\n  /*     error = FT_Open_Face( library, &open_args, index, &face );        */\r\n  /*     ...                                                               */\r\n  /*   }                                                                   */\r\n  /*                                                                       */\r\n/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType    */\r\n  /* bytecode interpreter with a huge switch statement, rather than a call */\r\n  /* table.  This results in smaller and faster code for a number of       */\r\n  /* architectures.                                                        */\r\n  /*                                                                       */\r\n  /* Note however that on some compiler/processor combinations, undefining */\r\n  /* this macro will generate faster, though larger, code.                 */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_INTERPRETER_SWITCH\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the        */\r\n  /* TrueType glyph loader to use Apple's definition of how to handle      */\r\n  /* component offsets in composite glyphs.                                */\r\n  /*                                                                       */\r\n  /* Apple and MS disagree on the default behavior of component offsets    */\r\n  /* in composites.  Apple says that they should be scaled by the scaling  */\r\n  /* factors in the transformation matrix (roughly, it's more complex)     */\r\n  /* while MS says they should not.  OpenType defines two bits in the      */\r\n  /* composite flags array which can be used to disambiguate, but old      */\r\n  /* fonts will not have them.                                             */\r\n  /*                                                                       */\r\n  /*   http://www.microsoft.com/typography/otspec/glyf.htm                 */\r\n  /*   http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html                 */\r\n  /*                                                                       */\r\n#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include         */\r\n  /* support for Apple's distortable font technology (fvar, gvar, cvar,    */\r\n  /* and avar tables).  This has many similarities to Type 1 Multiple      */\r\n  /* Masters support.                                                      */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_BDF if you want to include support for        */\r\n  /* an embedded `BDF ' table within SFNT-based bitmap formats.            */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_BDF\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****      T Y P E 1   D R I V E R    C O N F I G U R A T I O N       ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and       */\r\n  /* arrays in the Type 1 stream (see t1load.c).  A minimum of 4 is        */\r\n  /* required.                                                             */\r\n  /*                                                                       */\r\n#define T1_MAX_DICT_DEPTH  5\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine   */\r\n  /* calls during glyph loading.                                           */\r\n  /*                                                                       */\r\n#define T1_MAX_SUBRS_CALLS  16\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity.  A     */\r\n  /* minimum of 16 is required.                                            */\r\n  /*                                                                       */\r\n  /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */\r\n  /*                                                                       */\r\n#define T1_MAX_CHARSTRINGS_OPERANDS  256\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define this configuration macro if you want to prevent the            */\r\n  /* compilation of `t1afm', which is in charge of reading Type 1 AFM      */\r\n  /* files into an existing face.  Note that if set, the T1 driver will be */\r\n  /* unable to produce kerning distances.                                  */\r\n  /*                                                                       */\r\n#undef T1_CONFIG_OPTION_NO_AFM\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define this configuration macro if you want to prevent the            */\r\n  /* compilation of the Multiple Masters font support in the Type 1        */\r\n  /* driver.                                                               */\r\n  /*                                                                       */\r\n#undef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****    A U T O F I T   M O D U L E    C O N F I G U R A T I O N     ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Compile autofit module with CJK (Chinese, Japanese, Korean) script    */\r\n  /* support.                                                              */\r\n  /*                                                                       */\r\n#define AF_CONFIG_OPTION_CJK\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Compile autofit module with Indic script support.                     */\r\n  /*                                                                       */\r\n#define AF_CONFIG_OPTION_INDIC\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Compile autofit module with warp hinting.  The idea of the warping    */\r\n  /* code is to slightly scale and shift a glyph within a single dimension */\r\n  /* so that as much of its segments are aligned (more or less) on the     */\r\n  /* grid.  To find out the optimal scaling and shifting value, various    */\r\n  /* parameter combinations are tried and scored.                          */\r\n  /*                                                                       */\r\n  /* This experimental option is only active if the render mode is         */\r\n  /* FT_RENDER_MODE_LIGHT.                                                 */\r\n  /*                                                                       */\r\n/* #define AF_CONFIG_OPTION_USE_WARPER */\r\n\r\n  /* */\r\n\r\n\r\n  /*\r\n   * Define this variable if you want to keep the layout of internal\r\n   * structures that was used prior to FreeType 2.2.  This also compiles in\r\n   * a few obsolete functions to avoid linking problems on typical Unix\r\n   * distributions.\r\n   *\r\n   * For embedded systems or building a new distribution from scratch, it\r\n   * is recommended to disable the macro since it reduces the library's code\r\n   * size and activates a few memory-saving optimizations as well.\r\n   */\r\n#define FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n\r\n  /*\r\n   *  To detect legacy cache-lookup call from a rogue client (<= 2.1.7),\r\n   *  we restrict the number of charmaps in a font.  The current API of\r\n   *  FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API\r\n   *  takes charcode only.  To determine the passed value is for cmap_index\r\n   *  or charcode, the possible cmap_index is restricted not to exceed\r\n   *  the minimum possible charcode by a rogue client.  It is also very\r\n   *  unlikely that a rogue client is interested in Unicode values 0 to 15.\r\n   *\r\n   *  NOTE: The original threshold was 4 deduced from popular number of\r\n   *        cmap subtables in UCS-4 TrueType fonts, but now it is not\r\n   *        irregular for OpenType fonts to have more than 4 subtables,\r\n   *        because variation selector subtables are available for Apple\r\n   *        and Microsoft platforms.\r\n   */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_MAX_CHARMAP_CACHEABLE 15\r\n#endif\r\n\r\n\r\n  /*\r\n   * This macro is defined if either unpatented or native TrueType\r\n   * hinting is requested by the definitions above.\r\n   */\r\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n#define  TT_USE_BYTECODE_INTERPRETER\r\n#undef   TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#define  TT_USE_BYTECODE_INTERPRETER\r\n#endif\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTOPTION_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/config/ftstdlib.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstdlib.h                                                             */\r\n/*                                                                         */\r\n/*    ANSI-specific library and header configuration file (specification   */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 2002-2007, 2009, 2011-2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to group all #includes to the ANSI C library that   */\r\n  /* FreeType normally requires.  It also defines macros to rename the     */\r\n  /* standard functions within the FreeType source code.                   */\r\n  /*                                                                       */\r\n  /* Load a file which defines __FTSTDLIB_H__ before this one to override  */\r\n  /* it.                                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTSTDLIB_H__\r\n#define __FTSTDLIB_H__\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#define ft_ptrdiff_t  ptrdiff_t\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                           integer limits                           */\r\n  /*                                                                    */\r\n  /* UINT_MAX and ULONG_MAX are used to automatically compute the size  */\r\n  /* of `int' and `long' in bytes at compile-time.  So far, this works  */\r\n  /* for all platforms the library has been tested on.                  */\r\n  /*                                                                    */\r\n  /* Note that on the extremely rare platforms that do not provide      */\r\n  /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some    */\r\n  /* old Crays where `int' is 36 bits), we do not make any guarantee    */\r\n  /* about the correct behaviour of FT2 with all fonts.                 */\r\n  /*                                                                    */\r\n  /* In these case, `ftconfig.h' will refuse to compile anyway with a   */\r\n  /* message like `couldn't find 32-bit type' or something similar.     */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <limits.h>\r\n\r\n#define FT_CHAR_BIT    CHAR_BIT\r\n#define FT_USHORT_MAX  USHRT_MAX\r\n#define FT_INT_MAX     INT_MAX\r\n#define FT_INT_MIN     INT_MIN\r\n#define FT_UINT_MAX    UINT_MAX\r\n#define FT_ULONG_MAX   ULONG_MAX\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                 character and string processing                    */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <string.h>\r\n\r\n#define ft_memchr   memchr\r\n#define ft_memcmp   memcmp\r\n#define ft_memcpy   memcpy\r\n#define ft_memmove  memmove\r\n#define ft_memset   memset\r\n#define ft_strcat   strcat\r\n#define ft_strcmp   strcmp\r\n#define ft_strcpy   strcpy\r\n#define ft_strlen   strlen\r\n#define ft_strncmp  strncmp\r\n#define ft_strncpy  strncpy\r\n#define ft_strrchr  strrchr\r\n#define ft_strstr   strstr\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                           file handling                            */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <stdio.h>\r\n\r\n#define FT_FILE     FILE\r\n#define ft_fclose   fclose\r\n#define ft_fopen    fopen\r\n#define ft_fread    fread\r\n#define ft_fseek    fseek\r\n#define ft_ftell    ftell\r\n#define ft_sprintf  sprintf\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                             sorting                                */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <stdlib.h>\r\n\r\n#define ft_qsort  qsort\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                        memory allocation                           */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#define ft_scalloc   calloc\r\n#define ft_sfree     free\r\n#define ft_smalloc   malloc\r\n#define ft_srealloc  realloc\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                          miscellaneous                             */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#define ft_atol   atol\r\n#define ft_labs   labs\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                         execution control                          */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <setjmp.h>\r\n\r\n#define ft_jmp_buf     jmp_buf  /* note: this cannot be a typedef since */\r\n                                /*       jmp_buf is defined as a macro  */\r\n                                /*       on certain platforms           */\r\n\r\n#define ft_longjmp     longjmp\r\n#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */\r\n\r\n\r\n  /* the following is only used for debugging purposes, i.e., if */\r\n  /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined    */\r\n\r\n#include <stdarg.h>\r\n\r\n\r\n#endif /* __FTSTDLIB_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/freetype.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  freetype.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType high-level API and common types (specification only).       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FREETYPE_H__\r\n#define __FREETYPE_H__\r\n\r\n\r\n#ifndef FT_FREETYPE_H\r\n#error \"`ft2build.h' hasn't been included yet!\"\r\n#error \"Please always use macros to include FreeType header files.\"\r\n#error \"Example:\"\r\n#error \"  #include <ft2build.h>\"\r\n#error \"  #include FT_FREETYPE_H\"\r\n#endif\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_ERRORS_H\r\n#include FT_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    user_allocation                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    User allocation                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How client applications should allocate FreeType data structures.  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType assumes that structures allocated by the user and passed  */\r\n  /*    as arguments are zeroed out except for the actual data.  In other  */\r\n  /*    words, it is recommended to use `calloc' (or variants of it)       */\r\n  /*    instead of `malloc' for allocation.                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                        B A S I C   T Y P E S                          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    base_interface                                                     */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Base Interface                                                     */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    The FreeType~2 base font interface.                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section describes the public high-level API of FreeType~2.    */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_Library                                                         */\r\n  /*    FT_Face                                                            */\r\n  /*    FT_Size                                                            */\r\n  /*    FT_GlyphSlot                                                       */\r\n  /*    FT_CharMap                                                         */\r\n  /*    FT_Encoding                                                        */\r\n  /*                                                                       */\r\n  /*    FT_FaceRec                                                         */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_SCALABLE                                              */\r\n  /*    FT_FACE_FLAG_FIXED_SIZES                                           */\r\n  /*    FT_FACE_FLAG_FIXED_WIDTH                                           */\r\n  /*    FT_FACE_FLAG_HORIZONTAL                                            */\r\n  /*    FT_FACE_FLAG_VERTICAL                                              */\r\n  /*    FT_FACE_FLAG_SFNT                                                  */\r\n  /*    FT_FACE_FLAG_KERNING                                               */\r\n  /*    FT_FACE_FLAG_MULTIPLE_MASTERS                                      */\r\n  /*    FT_FACE_FLAG_GLYPH_NAMES                                           */\r\n  /*    FT_FACE_FLAG_EXTERNAL_STREAM                                       */\r\n  /*    FT_FACE_FLAG_FAST_GLYPHS                                           */\r\n  /*    FT_FACE_FLAG_HINTER                                                */\r\n  /*                                                                       */\r\n  /*    FT_STYLE_FLAG_BOLD                                                 */\r\n  /*    FT_STYLE_FLAG_ITALIC                                               */\r\n  /*                                                                       */\r\n  /*    FT_SizeRec                                                         */\r\n  /*    FT_Size_Metrics                                                    */\r\n  /*                                                                       */\r\n  /*    FT_GlyphSlotRec                                                    */\r\n  /*    FT_Glyph_Metrics                                                   */\r\n  /*    FT_SubGlyph                                                        */\r\n  /*                                                                       */\r\n  /*    FT_Bitmap_Size                                                     */\r\n  /*                                                                       */\r\n  /*    FT_Init_FreeType                                                   */\r\n  /*    FT_Done_FreeType                                                   */\r\n  /*                                                                       */\r\n  /*    FT_New_Face                                                        */\r\n  /*    FT_Done_Face                                                       */\r\n  /*    FT_New_Memory_Face                                                 */\r\n  /*    FT_Open_Face                                                       */\r\n  /*    FT_Open_Args                                                       */\r\n  /*    FT_Parameter                                                       */\r\n  /*    FT_Attach_File                                                     */\r\n  /*    FT_Attach_Stream                                                   */\r\n  /*                                                                       */\r\n  /*    FT_Set_Char_Size                                                   */\r\n  /*    FT_Set_Pixel_Sizes                                                 */\r\n  /*    FT_Request_Size                                                    */\r\n  /*    FT_Select_Size                                                     */\r\n  /*    FT_Size_Request_Type                                               */\r\n  /*    FT_Size_Request                                                    */\r\n  /*    FT_Set_Transform                                                   */\r\n  /*    FT_Load_Glyph                                                      */\r\n  /*    FT_Get_Char_Index                                                  */\r\n  /*    FT_Get_Name_Index                                                  */\r\n  /*    FT_Load_Char                                                       */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_MEMORY                                                     */\r\n  /*    FT_OPEN_STREAM                                                     */\r\n  /*    FT_OPEN_PATHNAME                                                   */\r\n  /*    FT_OPEN_DRIVER                                                     */\r\n  /*    FT_OPEN_PARAMS                                                     */\r\n  /*                                                                       */\r\n  /*    FT_LOAD_DEFAULT                                                    */\r\n  /*    FT_LOAD_RENDER                                                     */\r\n  /*    FT_LOAD_MONOCHROME                                                 */\r\n  /*    FT_LOAD_LINEAR_DESIGN                                              */\r\n  /*    FT_LOAD_NO_SCALE                                                   */\r\n  /*    FT_LOAD_NO_HINTING                                                 */\r\n  /*    FT_LOAD_NO_BITMAP                                                  */\r\n  /*    FT_LOAD_CROP_BITMAP                                                */\r\n  /*                                                                       */\r\n  /*    FT_LOAD_VERTICAL_LAYOUT                                            */\r\n  /*    FT_LOAD_IGNORE_TRANSFORM                                           */\r\n  /*    FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH                                */\r\n  /*    FT_LOAD_FORCE_AUTOHINT                                             */\r\n  /*    FT_LOAD_NO_RECURSE                                                 */\r\n  /*    FT_LOAD_PEDANTIC                                                   */\r\n  /*                                                                       */\r\n  /*    FT_LOAD_TARGET_NORMAL                                              */\r\n  /*    FT_LOAD_TARGET_LIGHT                                               */\r\n  /*    FT_LOAD_TARGET_MONO                                                */\r\n  /*    FT_LOAD_TARGET_LCD                                                 */\r\n  /*    FT_LOAD_TARGET_LCD_V                                               */\r\n  /*                                                                       */\r\n  /*    FT_Render_Glyph                                                    */\r\n  /*    FT_Render_Mode                                                     */\r\n  /*    FT_Get_Kerning                                                     */\r\n  /*    FT_Kerning_Mode                                                    */\r\n  /*    FT_Get_Track_Kerning                                               */\r\n  /*    FT_Get_Glyph_Name                                                  */\r\n  /*    FT_Get_Postscript_Name                                             */\r\n  /*                                                                       */\r\n  /*    FT_CharMapRec                                                      */\r\n  /*    FT_Select_Charmap                                                  */\r\n  /*    FT_Set_Charmap                                                     */\r\n  /*    FT_Get_Charmap_Index                                               */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING                                    */\r\n  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING                             */\r\n  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING                              */\r\n  /*    FT_FSTYPE_EDITABLE_EMBEDDING                                       */\r\n  /*    FT_FSTYPE_NO_SUBSETTING                                            */\r\n  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY                                    */\r\n  /*                                                                       */\r\n  /*    FT_Get_FSType_Flags                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Glyph_Metrics                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the metrics of a single glyph.  The      */\r\n  /*    values are expressed in 26.6 fractional pixel format; if the flag  */\r\n  /*    @FT_LOAD_NO_SCALE has been used while loading the glyph, values    */\r\n  /*    are expressed in font units instead.                               */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    width ::                                                           */\r\n  /*      The glyph's width.                                               */\r\n  /*                                                                       */\r\n  /*    height ::                                                          */\r\n  /*      The glyph's height.                                              */\r\n  /*                                                                       */\r\n  /*    horiBearingX ::                                                    */\r\n  /*      Left side bearing for horizontal layout.                         */\r\n  /*                                                                       */\r\n  /*    horiBearingY ::                                                    */\r\n  /*      Top side bearing for horizontal layout.                          */\r\n  /*                                                                       */\r\n  /*    horiAdvance ::                                                     */\r\n  /*      Advance width for horizontal layout.                             */\r\n  /*                                                                       */\r\n  /*    vertBearingX ::                                                    */\r\n  /*      Left side bearing for vertical layout.                           */\r\n  /*                                                                       */\r\n  /*    vertBearingY ::                                                    */\r\n  /*      Top side bearing for vertical layout.  Larger positive values    */\r\n  /*      mean further below the vertical glyph origin.                    */\r\n  /*                                                                       */\r\n  /*    vertAdvance ::                                                     */\r\n  /*      Advance height for vertical layout.  Positive values mean the    */\r\n  /*      glyph has a positive advance downward.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If not disabled with @FT_LOAD_NO_HINTING, the values represent     */\r\n  /*    dimensions of the hinted glyph (in case hinting is applicable).    */\r\n  /*                                                                       */\r\n  /*    Stroking a glyph with an outside border does not increase          */\r\n  /*    `horiAdvance' or `vertAdvance'; you have to manually adjust these  */\r\n  /*    values to account for the added width and height.                  */\r\n  /*                                                                       */\r\n  typedef struct  FT_Glyph_Metrics_\r\n  {\r\n    FT_Pos  width;\r\n    FT_Pos  height;\r\n\r\n    FT_Pos  horiBearingX;\r\n    FT_Pos  horiBearingY;\r\n    FT_Pos  horiAdvance;\r\n\r\n    FT_Pos  vertBearingX;\r\n    FT_Pos  vertBearingY;\r\n    FT_Pos  vertAdvance;\r\n\r\n  } FT_Glyph_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Bitmap_Size                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure models the metrics of a bitmap strike (i.e., a set  */\r\n  /*    of glyphs for a given point size and resolution) in a bitmap font. */\r\n  /*    It is used for the `available_sizes' field of @FT_Face.            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    height :: The vertical distance, in pixels, between two            */\r\n  /*              consecutive baselines.  It is always positive.           */\r\n  /*                                                                       */\r\n  /*    width  :: The average width, in pixels, of all glyphs in the       */\r\n  /*              strike.                                                  */\r\n  /*                                                                       */\r\n  /*    size   :: The nominal size of the strike in 26.6 fractional        */\r\n  /*              points.  This field is not very useful.                  */\r\n  /*                                                                       */\r\n  /*    x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional   */\r\n  /*              pixels.                                                  */\r\n  /*                                                                       */\r\n  /*    y_ppem :: The vertical ppem (nominal height) in 26.6 fractional    */\r\n  /*              pixels.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Windows FNT:                                                       */\r\n  /*      The nominal size given in a FNT font is not reliable.  Thus when */\r\n  /*      the driver finds it incorrect, it sets `size' to some calculated */\r\n  /*      values and sets `x_ppem' and `y_ppem' to the pixel width and     */\r\n  /*      height given in the font, respectively.                          */\r\n  /*                                                                       */\r\n  /*    TrueType embedded bitmaps:                                         */\r\n  /*      `size', `width', and `height' values are not contained in the    */\r\n  /*      bitmap strike itself.  They are computed from the global font    */\r\n  /*      parameters.                                                      */\r\n  /*                                                                       */\r\n  typedef struct  FT_Bitmap_Size_\r\n  {\r\n    FT_Short  height;\r\n    FT_Short  width;\r\n\r\n    FT_Pos    size;\r\n\r\n    FT_Pos    x_ppem;\r\n    FT_Pos    y_ppem;\r\n\r\n  } FT_Bitmap_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                     O B J E C T   C L A S S E S                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Library                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a FreeType library instance.  Each `library' is        */\r\n  /*    completely independent from the others; it is the `root' of a set  */\r\n  /*    of objects like fonts, faces, sizes, etc.                          */\r\n  /*                                                                       */\r\n  /*    It also embeds a memory manager (see @FT_Memory), as well as a     */\r\n  /*    scan-line converter object (see @FT_Raster).                       */\r\n  /*                                                                       */\r\n  /*    For multi-threading applications each thread should have its own   */\r\n  /*    FT_Library object.                                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Library objects are normally created by @FT_Init_FreeType, and     */\r\n  /*    destroyed with @FT_Done_FreeType.                                  */\r\n  /*                                                                       */\r\n  typedef struct FT_LibraryRec_  *FT_Library;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Module                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given FreeType module object.  Each module can be a  */\r\n  /*    font driver, a renderer, or anything else that provides services   */\r\n  /*    to the formers.                                                    */\r\n  /*                                                                       */\r\n  typedef struct FT_ModuleRec_*  FT_Module;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Driver                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given FreeType font driver object.  Each font driver */\r\n  /*    is a special module capable of creating faces from font files.     */\r\n  /*                                                                       */\r\n  typedef struct FT_DriverRec_*  FT_Driver;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Renderer                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given FreeType renderer.  A renderer is a special    */\r\n  /*    module in charge of converting a glyph image to a bitmap, when     */\r\n  /*    necessary.  Each renderer supports a given glyph image format, and */\r\n  /*    one or more target surface depths.                                 */\r\n  /*                                                                       */\r\n  typedef struct FT_RendererRec_*  FT_Renderer;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Face                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given typographic face object.  A face object models */\r\n  /*    a given typeface, in a given style.                                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Each face object also owns a single @FT_GlyphSlot object, as well  */\r\n  /*    as one or more @FT_Size objects.                                   */\r\n  /*                                                                       */\r\n  /*    Use @FT_New_Face or @FT_Open_Face to create a new face object from */\r\n  /*    a given filepathname or a custom input stream.                     */\r\n  /*                                                                       */\r\n  /*    Use @FT_Done_Face to destroy it (along with its slot and sizes).   */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_FaceRec for the publicly accessible fields of a given face */\r\n  /*    object.                                                            */\r\n  /*                                                                       */\r\n  typedef struct FT_FaceRec_*  FT_Face;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Size                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an object used to model a face scaled to a given       */\r\n  /*    character size.                                                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Each @FT_Face has an _active_ @FT_Size object that is used by      */\r\n  /*    functions like @FT_Load_Glyph to determine the scaling             */\r\n  /*    transformation which is used to load and hint glyphs and metrics.  */\r\n  /*                                                                       */\r\n  /*    You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes,                */\r\n  /*    @FT_Request_Size or even @FT_Select_Size to change the content     */\r\n  /*    (i.e., the scaling values) of the active @FT_Size.                 */\r\n  /*                                                                       */\r\n  /*    You can use @FT_New_Size to create additional size objects for a   */\r\n  /*    given @FT_Face, but they won't be used by other functions until    */\r\n  /*    you activate it through @FT_Activate_Size.  Only one size can be   */\r\n  /*    activated at any given time per face.                              */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_SizeRec for the publicly accessible fields of a given size */\r\n  /*    object.                                                            */\r\n  /*                                                                       */\r\n  typedef struct FT_SizeRec_*  FT_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_GlyphSlot                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given `glyph slot'.  A slot is a container where it  */\r\n  /*    is possible to load any of the glyphs contained in its parent      */\r\n  /*    face.                                                              */\r\n  /*                                                                       */\r\n  /*    In other words, each time you call @FT_Load_Glyph or               */\r\n  /*    @FT_Load_Char, the slot's content is erased by the new glyph data, */\r\n  /*    i.e., the glyph's metrics, its image (bitmap or outline), and      */\r\n  /*    other control information.                                         */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_GlyphSlotRec for the publicly accessible glyph fields.     */\r\n  /*                                                                       */\r\n  typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_CharMap                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given character map.  A charmap is used to translate */\r\n  /*    character codes in a given encoding into glyph indexes for its     */\r\n  /*    parent's face.  Some font formats may provide several charmaps per */\r\n  /*    font.                                                              */\r\n  /*                                                                       */\r\n  /*    Each face object owns zero or more charmaps, but only one of them  */\r\n  /*    can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char.   */\r\n  /*                                                                       */\r\n  /*    The list of available charmaps in a face is available through the  */\r\n  /*    `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec.   */\r\n  /*                                                                       */\r\n  /*    The currently active charmap is available as `face->charmap'.      */\r\n  /*    You should call @FT_Set_Charmap to change it.                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    When a new face is created (either through @FT_New_Face or         */\r\n  /*    @FT_Open_Face), the library looks for a Unicode charmap within     */\r\n  /*    the list and automatically activates it.                           */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_CharMapRec for the publicly accessible fields of a given   */\r\n  /*    character map.                                                     */\r\n  /*                                                                       */\r\n  typedef struct FT_CharMapRec_*  FT_CharMap;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_ENC_TAG                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro converts four-letter tags into an unsigned long.  It is */\r\n  /*    used to define `encoding' identifiers (see @FT_Encoding).          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */\r\n  /*    should redefine this macro in case of problems to something like   */\r\n  /*    this:                                                              */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      #define FT_ENC_TAG( value, a, b, c, d )  value                   */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    to get a simple enumeration without assigning special numbers.     */\r\n  /*                                                                       */\r\n\r\n#ifndef FT_ENC_TAG\r\n#define FT_ENC_TAG( value, a, b, c, d )         \\\r\n          value = ( ( (FT_UInt32)(a) << 24 ) |  \\\r\n                    ( (FT_UInt32)(b) << 16 ) |  \\\r\n                    ( (FT_UInt32)(c) <<  8 ) |  \\\r\n                      (FT_UInt32)(d)         )\r\n\r\n#endif /* FT_ENC_TAG */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Encoding                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used to specify character sets supported by         */\r\n  /*    charmaps.  Used in the @FT_Select_Charmap API function.            */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Despite the name, this enumeration lists specific character        */\r\n  /*    repertories (i.e., charsets), and not text encoding methods (e.g., */\r\n  /*    UTF-8, UTF-16, etc.).                                              */\r\n  /*                                                                       */\r\n  /*    Other encodings might be defined in the future.                    */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_ENCODING_NONE ::                                                */\r\n  /*      The encoding value~0 is reserved.                                */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_UNICODE ::                                             */\r\n  /*      Corresponds to the Unicode character set.  This value covers     */\r\n  /*      all versions of the Unicode repertoire, including ASCII and      */\r\n  /*      Latin-1.  Most fonts include a Unicode charmap, but not all      */\r\n  /*      of them.                                                         */\r\n  /*                                                                       */\r\n  /*      For example, if you want to access Unicode value U+1F028 (and    */\r\n  /*      the font contains it), use value 0x1F028 as the input value for  */\r\n  /*      @FT_Get_Char_Index.                                              */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_SYMBOL ::                                           */\r\n  /*      Corresponds to the Microsoft Symbol encoding, used to encode     */\r\n  /*      mathematical symbols in the 32..255 character code range.  For   */\r\n  /*      more information, see `http://www.ceviz.net/symbol.htm'.         */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_SJIS ::                                                */\r\n  /*      Corresponds to Japanese SJIS encoding.  More info at             */\r\n  /*      at `http://langsupport.japanreference.com/encoding.shtml'.       */\r\n  /*      See note on multi-byte encodings below.                          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_GB2312 ::                                              */\r\n  /*      Corresponds to an encoding system for Simplified Chinese as used */\r\n  /*      used in mainland China.                                          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_BIG5 ::                                                */\r\n  /*      Corresponds to an encoding system for Traditional Chinese as     */\r\n  /*      used in Taiwan and Hong Kong.                                    */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_WANSUNG ::                                             */\r\n  /*      Corresponds to the Korean encoding system known as Wansung.      */\r\n  /*      For more information see                                         */\r\n  /*      `http://www.microsoft.com/typography/unicode/949.txt'.           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_JOHAB ::                                               */\r\n  /*      The Korean standard character set (KS~C 5601-1992), which        */\r\n  /*      corresponds to MS Windows code page 1361.  This character set    */\r\n  /*      includes all possible Hangeul character combinations.            */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_LATIN_1 ::                                       */\r\n  /*      Corresponds to a Latin-1 encoding as defined in a Type~1         */\r\n  /*      PostScript font.  It is limited to 256 character codes.          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_STANDARD ::                                      */\r\n  /*      Corresponds to the Adobe Standard encoding, as found in Type~1,  */\r\n  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */\r\n  /*      codes.                                                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_EXPERT ::                                        */\r\n  /*      Corresponds to the Adobe Expert encoding, as found in Type~1,    */\r\n  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */\r\n  /*      codes.                                                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_CUSTOM ::                                        */\r\n  /*      Corresponds to a custom encoding, as found in Type~1, CFF, and   */\r\n  /*      OpenType/CFF fonts.  It is limited to 256 character codes.       */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_APPLE_ROMAN ::                                         */\r\n  /*      Corresponds to the 8-bit Apple roman encoding.  Many TrueType    */\r\n  /*      and OpenType fonts contain a charmap for this encoding, since    */\r\n  /*      older versions of Mac OS are able to use it.                     */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_OLD_LATIN_2 ::                                         */\r\n  /*      This value is deprecated and was never used nor reported by      */\r\n  /*      FreeType.  Don't use or test for it.                             */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_SJIS ::                                             */\r\n  /*      Same as FT_ENCODING_SJIS.  Deprecated.                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_GB2312 ::                                           */\r\n  /*      Same as FT_ENCODING_GB2312.  Deprecated.                         */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_BIG5 ::                                             */\r\n  /*      Same as FT_ENCODING_BIG5.  Deprecated.                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_WANSUNG ::                                          */\r\n  /*      Same as FT_ENCODING_WANSUNG.  Deprecated.                        */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_JOHAB ::                                            */\r\n  /*      Same as FT_ENCODING_JOHAB.  Deprecated.                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    By default, FreeType automatically synthesizes a Unicode charmap   */\r\n  /*    for PostScript fonts, using their glyph names dictionaries.        */\r\n  /*    However, it also reports the encodings defined explicitly in the   */\r\n  /*    font file, for the cases when they are needed, with the Adobe      */\r\n  /*    values as well.                                                    */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap  */\r\n  /*    is neither Unicode nor ISO-8859-1 (otherwise it is set to          */\r\n  /*    FT_ENCODING_UNICODE).  Use @FT_Get_BDF_Charset_ID to find out      */\r\n  /*    which encoding is really present.  If, for example, the            */\r\n  /*    `cs_registry' field is `KOI8' and the `cs_encoding' field is `R',  */\r\n  /*    the font is encoded in KOI8-R.                                     */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_NONE is always set (with a single exception) by the    */\r\n  /*    winfonts driver.  Use @FT_Get_WinFNT_Header and examine the        */\r\n  /*    `charset' field of the @FT_WinFNT_HeaderRec structure to find out  */\r\n  /*    which encoding is really present.  For example,                    */\r\n  /*    @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for       */\r\n  /*    Russian).                                                          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */\r\n  /*    and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to  */\r\n  /*    FT_ENCODING_APPLE_ROMAN).                                          */\r\n  /*                                                                       */\r\n  /*    If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function       */\r\n  /*    @FT_Get_CMap_Language_ID  to query the Mac language ID which may   */\r\n  /*    be needed to be able to distinguish Apple encoding variants.  See  */\r\n  /*                                                                       */\r\n  /*      http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT  */\r\n  /*                                                                       */\r\n  /*    to get an idea how to do that.  Basically, if the language ID      */\r\n  /*    is~0, don't use it, otherwise subtract 1 from the language ID.     */\r\n  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */\r\n  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */\r\n  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */\r\n  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */\r\n  /*    variant the Arabic encoding.                                       */\r\n  /*                                                                       */\r\n  typedef enum  FT_Encoding_\r\n  {\r\n    FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),\r\n    FT_ENC_TAG( FT_ENCODING_UNICODE,   'u', 'n', 'i', 'c' ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_SJIS,    's', 'j', 'i', 's' ),\r\n    FT_ENC_TAG( FT_ENCODING_GB2312,  'g', 'b', ' ', ' ' ),\r\n    FT_ENC_TAG( FT_ENCODING_BIG5,    'b', 'i', 'g', '5' ),\r\n    FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),\r\n    FT_ENC_TAG( FT_ENCODING_JOHAB,   'j', 'o', 'h', 'a' ),\r\n\r\n    /* for backwards compatibility */\r\n    FT_ENCODING_MS_SJIS    = FT_ENCODING_SJIS,\r\n    FT_ENCODING_MS_GB2312  = FT_ENCODING_GB2312,\r\n    FT_ENCODING_MS_BIG5    = FT_ENCODING_BIG5,\r\n    FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,\r\n    FT_ENCODING_MS_JOHAB   = FT_ENCODING_JOHAB,\r\n\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT,   'A', 'D', 'B', 'E' ),\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM,   'A', 'D', 'B', 'C' ),\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1,  'l', 'a', 't', '1' ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )\r\n\r\n  } FT_Encoding;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_encoding_xxx                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    These constants are deprecated; use the corresponding @FT_Encoding */\r\n  /*    values instead.                                                    */\r\n  /*                                                                       */\r\n#define ft_encoding_none            FT_ENCODING_NONE\r\n#define ft_encoding_unicode         FT_ENCODING_UNICODE\r\n#define ft_encoding_symbol          FT_ENCODING_MS_SYMBOL\r\n#define ft_encoding_latin_1         FT_ENCODING_ADOBE_LATIN_1\r\n#define ft_encoding_latin_2         FT_ENCODING_OLD_LATIN_2\r\n#define ft_encoding_sjis            FT_ENCODING_SJIS\r\n#define ft_encoding_gb2312          FT_ENCODING_GB2312\r\n#define ft_encoding_big5            FT_ENCODING_BIG5\r\n#define ft_encoding_wansung         FT_ENCODING_WANSUNG\r\n#define ft_encoding_johab           FT_ENCODING_JOHAB\r\n\r\n#define ft_encoding_adobe_standard  FT_ENCODING_ADOBE_STANDARD\r\n#define ft_encoding_adobe_expert    FT_ENCODING_ADOBE_EXPERT\r\n#define ft_encoding_adobe_custom    FT_ENCODING_ADOBE_CUSTOM\r\n#define ft_encoding_apple_roman     FT_ENCODING_APPLE_ROMAN\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_CharMapRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The base charmap structure.                                        */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face        :: A handle to the parent face object.                 */\r\n  /*                                                                       */\r\n  /*    encoding    :: An @FT_Encoding tag identifying the charmap.  Use   */\r\n  /*                   this with @FT_Select_Charmap.                       */\r\n  /*                                                                       */\r\n  /*    platform_id :: An ID number describing the platform for the        */\r\n  /*                   following encoding ID.  This comes directly from    */\r\n  /*                   the TrueType specification and should be emulated   */\r\n  /*                   for other formats.                                  */\r\n  /*                                                                       */\r\n  /*    encoding_id :: A platform specific encoding number.  This also     */\r\n  /*                   comes from the TrueType specification and should be */\r\n  /*                   emulated similarly.                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_CharMapRec_\r\n  {\r\n    FT_Face      face;\r\n    FT_Encoding  encoding;\r\n    FT_UShort    platform_id;\r\n    FT_UShort    encoding_id;\r\n\r\n  } FT_CharMapRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                 B A S E   O B J E C T   C L A S S E S                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Face_Internal                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to an `FT_Face_InternalRec' structure, used to    */\r\n  /*    model private data of a given @FT_Face object.                     */\r\n  /*                                                                       */\r\n  /*    This structure might change between releases of FreeType~2 and is  */\r\n  /*    not generally available to client applications.                    */\r\n  /*                                                                       */\r\n  typedef struct FT_Face_InternalRec_*  FT_Face_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_FaceRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType root face class structure.  A face object models a        */\r\n  /*    typeface in a font file.                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_faces           :: The number of faces in the font file.  Some */\r\n  /*                           font formats can have multiple faces in     */\r\n  /*                           a font file.                                */\r\n  /*                                                                       */\r\n  /*    face_index          :: The index of the face in the font file.  It */\r\n  /*                           is set to~0 if there is only one face in    */\r\n  /*                           the font file.                              */\r\n  /*                                                                       */\r\n  /*    face_flags          :: A set of bit flags that give important      */\r\n  /*                           information about the face; see             */\r\n  /*                           @FT_FACE_FLAG_XXX for the details.          */\r\n  /*                                                                       */\r\n  /*    style_flags         :: A set of bit flags indicating the style of  */\r\n  /*                           the face; see @FT_STYLE_FLAG_XXX for the    */\r\n  /*                           details.                                    */\r\n  /*                                                                       */\r\n  /*    num_glyphs          :: The number of glyphs in the face.  If the   */\r\n  /*                           face is scalable and has sbits (see         */\r\n  /*                           `num_fixed_sizes'), it is set to the number */\r\n  /*                           of outline glyphs.                          */\r\n  /*                                                                       */\r\n  /*                           For CID-keyed fonts, this value gives the   */\r\n  /*                           highest CID used in the font.               */\r\n  /*                                                                       */\r\n  /*    family_name         :: The face's family name.  This is an ASCII   */\r\n  /*                           string, usually in English, which describes */\r\n  /*                           the typeface's family (like `Times New      */\r\n  /*                           Roman', `Bodoni', `Garamond', etc).  This   */\r\n  /*                           is a least common denominator used to list  */\r\n  /*                           fonts.  Some formats (TrueType & OpenType)  */\r\n  /*                           provide localized and Unicode versions of   */\r\n  /*                           this string.  Applications should use the   */\r\n  /*                           format specific interface to access them.   */\r\n  /*                           Can be NULL (e.g., in fonts embedded in a   */\r\n  /*                           PDF file).                                  */\r\n  /*                                                                       */\r\n  /*    style_name          :: The face's style name.  This is an ASCII    */\r\n  /*                           string, usually in English, which describes */\r\n  /*                           the typeface's style (like `Italic',        */\r\n  /*                           `Bold', `Condensed', etc).  Not all font    */\r\n  /*                           formats provide a style name, so this field */\r\n  /*                           is optional, and can be set to NULL.  As    */\r\n  /*                           for `family_name', some formats provide     */\r\n  /*                           localized and Unicode versions of this      */\r\n  /*                           string.  Applications should use the format */\r\n  /*                           specific interface to access them.          */\r\n  /*                                                                       */\r\n  /*    num_fixed_sizes     :: The number of bitmap strikes in the face.   */\r\n  /*                           Even if the face is scalable, there might   */\r\n  /*                           still be bitmap strikes, which are called   */\r\n  /*                           `sbits' in that case.                       */\r\n  /*                                                                       */\r\n  /*    available_sizes     :: An array of @FT_Bitmap_Size for all bitmap  */\r\n  /*                           strikes in the face.  It is set to NULL if  */\r\n  /*                           there is no bitmap strike.                  */\r\n  /*                                                                       */\r\n  /*    num_charmaps        :: The number of charmaps in the face.         */\r\n  /*                                                                       */\r\n  /*    charmaps            :: An array of the charmaps of the face.       */\r\n  /*                                                                       */\r\n  /*    generic             :: A field reserved for client uses.  See the  */\r\n  /*                           @FT_Generic type description.               */\r\n  /*                                                                       */\r\n  /*    bbox                :: The font bounding box.  Coordinates are     */\r\n  /*                           expressed in font units (see                */\r\n  /*                           `units_per_EM').  The box is large enough   */\r\n  /*                           to contain any glyph from the font.  Thus,  */\r\n  /*                           `bbox.yMax' can be seen as the `maximum     */\r\n  /*                           ascender', and `bbox.yMin' as the `minimum  */\r\n  /*                           descender'.  Only relevant for scalable     */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*                           Note that the bounding box might be off by  */\r\n  /*                           (at least) one pixel for hinted fonts.  See */\r\n  /*                           @FT_Size_Metrics for further discussion.    */\r\n  /*                                                                       */\r\n  /*    units_per_EM        :: The number of font units per EM square for  */\r\n  /*                           this face.  This is typically 2048 for      */\r\n  /*                           TrueType fonts, and 1000 for Type~1 fonts.  */\r\n  /*                           Only relevant for scalable formats.         */\r\n  /*                                                                       */\r\n  /*    ascender            :: The typographic ascender of the face,       */\r\n  /*                           expressed in font units.  For font formats  */\r\n  /*                           not having this information, it is set to   */\r\n  /*                           `bbox.yMax'.  Only relevant for scalable    */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*    descender           :: The typographic descender of the face,      */\r\n  /*                           expressed in font units.  For font formats  */\r\n  /*                           not having this information, it is set to   */\r\n  /*                           `bbox.yMin'.  Note that this field is       */\r\n  /*                           usually negative.  Only relevant for        */\r\n  /*                           scalable formats.                           */\r\n  /*                                                                       */\r\n  /*    height              :: The height is the vertical distance         */\r\n  /*                           between two consecutive baselines,          */\r\n  /*                           expressed in font units.  It is always      */\r\n  /*                           positive.  Only relevant for scalable       */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*    max_advance_width   :: The maximum advance width, in font units,   */\r\n  /*                           for all glyphs in this face.  This can be   */\r\n  /*                           used to make word wrapping computations     */\r\n  /*                           faster.  Only relevant for scalable         */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*    max_advance_height  :: The maximum advance height, in font units,  */\r\n  /*                           for all glyphs in this face.  This is only  */\r\n  /*                           relevant for vertical layouts, and is set   */\r\n  /*                           to `height' for fonts that do not provide   */\r\n  /*                           vertical metrics.  Only relevant for        */\r\n  /*                           scalable formats.                           */\r\n  /*                                                                       */\r\n  /*    underline_position  :: The position, in font units, of the         */\r\n  /*                           underline line for this face.  It is the    */\r\n  /*                           center of the underlining stem.  Only       */\r\n  /*                           relevant for scalable formats.              */\r\n  /*                                                                       */\r\n  /*    underline_thickness :: The thickness, in font units, of the        */\r\n  /*                           underline for this face.  Only relevant for */\r\n  /*                           scalable formats.                           */\r\n  /*                                                                       */\r\n  /*    glyph               :: The face's associated glyph slot(s).        */\r\n  /*                                                                       */\r\n  /*    size                :: The current active size for this face.      */\r\n  /*                                                                       */\r\n  /*    charmap             :: The current active charmap for this face.   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Fields may be changed after a call to @FT_Attach_File or           */\r\n  /*    @FT_Attach_Stream.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_FaceRec_\r\n  {\r\n    FT_Long           num_faces;\r\n    FT_Long           face_index;\r\n\r\n    FT_Long           face_flags;\r\n    FT_Long           style_flags;\r\n\r\n    FT_Long           num_glyphs;\r\n\r\n    FT_String*        family_name;\r\n    FT_String*        style_name;\r\n\r\n    FT_Int            num_fixed_sizes;\r\n    FT_Bitmap_Size*   available_sizes;\r\n\r\n    FT_Int            num_charmaps;\r\n    FT_CharMap*       charmaps;\r\n\r\n    FT_Generic        generic;\r\n\r\n    /*# The following member variables (down to `underline_thickness') */\r\n    /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size    */\r\n    /*# for bitmap fonts.                                              */\r\n    FT_BBox           bbox;\r\n\r\n    FT_UShort         units_per_EM;\r\n    FT_Short          ascender;\r\n    FT_Short          descender;\r\n    FT_Short          height;\r\n\r\n    FT_Short          max_advance_width;\r\n    FT_Short          max_advance_height;\r\n\r\n    FT_Short          underline_position;\r\n    FT_Short          underline_thickness;\r\n\r\n    FT_GlyphSlot      glyph;\r\n    FT_Size           size;\r\n    FT_CharMap        charmap;\r\n\r\n    /*@private begin */\r\n\r\n    FT_Driver         driver;\r\n    FT_Memory         memory;\r\n    FT_Stream         stream;\r\n\r\n    FT_ListRec        sizes_list;\r\n\r\n    FT_Generic        autohint;   /* face-specific auto-hinter data */\r\n    void*             extensions; /* unused                         */\r\n\r\n    FT_Face_Internal  internal;\r\n\r\n    /*@private end */\r\n\r\n  } FT_FaceRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_FACE_FLAG_XXX                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit flags used in the `face_flags' field of the          */\r\n  /*    @FT_FaceRec structure.  They inform client applications of         */\r\n  /*    properties of the corresponding face.                              */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_FACE_FLAG_SCALABLE ::                                           */\r\n  /*      Indicates that the face contains outline glyphs.  This doesn't   */\r\n  /*      prevent bitmap strikes, i.e., a face can have both this and      */\r\n  /*      and @FT_FACE_FLAG_FIXED_SIZES set.                               */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_FIXED_SIZES ::                                        */\r\n  /*      Indicates that the face contains bitmap strikes.  See also the   */\r\n  /*      `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec.   */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_FIXED_WIDTH ::                                        */\r\n  /*      Indicates that the face contains fixed-width characters (like    */\r\n  /*      Courier, Lucido, MonoType, etc.).                                */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_SFNT ::                                               */\r\n  /*      Indicates that the face uses the `sfnt' storage scheme.  For     */\r\n  /*      now, this means TrueType and OpenType.                           */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_HORIZONTAL ::                                         */\r\n  /*      Indicates that the face contains horizontal glyph metrics.  This */\r\n  /*      should be set for all common formats.                            */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_VERTICAL ::                                           */\r\n  /*      Indicates that the face contains vertical glyph metrics.  This   */\r\n  /*      is only available in some formats, not all of them.              */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_KERNING ::                                            */\r\n  /*      Indicates that the face contains kerning information.  If set,   */\r\n  /*      the kerning distance can be retrieved through the function       */\r\n  /*      @FT_Get_Kerning.  Otherwise the function always return the       */\r\n  /*      vector (0,0).  Note that FreeType doesn't handle kerning data    */\r\n  /*      from the `GPOS' table (as present in some OpenType fonts).       */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_FAST_GLYPHS ::                                        */\r\n  /*      THIS FLAG IS DEPRECATED.  DO NOT USE OR TEST IT.                 */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_MULTIPLE_MASTERS ::                                   */\r\n  /*      Indicates that the font contains multiple masters and is capable */\r\n  /*      of interpolating between them.  See the multiple-masters         */\r\n  /*      specific API for details.                                        */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_GLYPH_NAMES ::                                        */\r\n  /*      Indicates that the font contains glyph names that can be         */\r\n  /*      retrieved through @FT_Get_Glyph_Name.  Note that some TrueType   */\r\n  /*      fonts contain broken glyph name tables.  Use the function        */\r\n  /*      @FT_Has_PS_Glyph_Names when needed.                              */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_EXTERNAL_STREAM ::                                    */\r\n  /*      Used internally by FreeType to indicate that a face's stream was */\r\n  /*      provided by the client application and should not be destroyed   */\r\n  /*      when @FT_Done_Face is called.  Don't read or test this flag.     */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_HINTER ::                                             */\r\n  /*      Set if the font driver has a hinting machine of its own.  For    */\r\n  /*      example, with TrueType fonts, it makes sense to use data from    */\r\n  /*      the SFNT `gasp' table only if the native TrueType hinting engine */\r\n  /*      (with the bytecode interpreter) is available and active.         */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_CID_KEYED ::                                          */\r\n  /*      Set if the font is CID-keyed.  In that case, the font is not     */\r\n  /*      accessed by glyph indices but by CID values.  For subsetted      */\r\n  /*      CID-keyed fonts this has the consequence that not all index      */\r\n  /*      values are a valid argument to FT_Load_Glyph.  Only the CID      */\r\n  /*      values for which corresponding glyphs in the subsetted font      */\r\n  /*      exist make FT_Load_Glyph return successfully; in all other cases */\r\n  /*      you get an `FT_Err_Invalid_Argument' error.                      */\r\n  /*                                                                       */\r\n  /*      Note that CID-keyed fonts which are in an SFNT wrapper don't     */\r\n  /*      have this flag set since the glyphs are accessed in the normal   */\r\n  /*      way (using contiguous indices); the `CID-ness' isn't visible to  */\r\n  /*      the application.                                                 */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_TRICKY ::                                             */\r\n  /*      Set if the font is `tricky', this is, it always needs the        */\r\n  /*      font format's native hinting engine to get a reasonable result.  */\r\n  /*      A typical example is the Chinese font `mingli.ttf' which uses    */\r\n  /*      TrueType bytecode instructions to move and scale all of its      */\r\n  /*      subglyphs.                                                       */\r\n  /*                                                                       */\r\n  /*      It is not possible to autohint such fonts using                  */\r\n  /*      @FT_LOAD_FORCE_AUTOHINT; it will also ignore                     */\r\n  /*      @FT_LOAD_NO_HINTING.  You have to set both @FT_LOAD_NO_HINTING   */\r\n  /*      and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */\r\n  /*      probably never want this except for demonstration purposes.      */\r\n  /*                                                                       */\r\n  /*      Currently, there are about a dozen TrueType fonts in the list of */\r\n  /*      tricky fonts; they are hard-coded in file `ttobjs.c'.            */\r\n  /*                                                                       */\r\n#define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )\r\n#define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )\r\n#define FT_FACE_FLAG_FIXED_WIDTH       ( 1L <<  2 )\r\n#define FT_FACE_FLAG_SFNT              ( 1L <<  3 )\r\n#define FT_FACE_FLAG_HORIZONTAL        ( 1L <<  4 )\r\n#define FT_FACE_FLAG_VERTICAL          ( 1L <<  5 )\r\n#define FT_FACE_FLAG_KERNING           ( 1L <<  6 )\r\n#define FT_FACE_FLAG_FAST_GLYPHS       ( 1L <<  7 )\r\n#define FT_FACE_FLAG_MULTIPLE_MASTERS  ( 1L <<  8 )\r\n#define FT_FACE_FLAG_GLYPH_NAMES       ( 1L <<  9 )\r\n#define FT_FACE_FLAG_EXTERNAL_STREAM   ( 1L << 10 )\r\n#define FT_FACE_FLAG_HINTER            ( 1L << 11 )\r\n#define FT_FACE_FLAG_CID_KEYED         ( 1L << 12 )\r\n#define FT_FACE_FLAG_TRICKY            ( 1L << 13 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_HORIZONTAL( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains\r\n   *   horizontal metrics (this is true for all font formats though).\r\n   *\r\n   * @also:\r\n   *   @FT_HAS_VERTICAL can be used to check for vertical metrics.\r\n   *\r\n   */\r\n#define FT_HAS_HORIZONTAL( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_VERTICAL( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains real\r\n   *   vertical metrics (and not only synthesized ones).\r\n   *\r\n   */\r\n#define FT_HAS_VERTICAL( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_VERTICAL )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_KERNING( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains kerning\r\n   *   data that can be accessed with @FT_Get_Kerning.\r\n   *\r\n   */\r\n#define FT_HAS_KERNING( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_KERNING )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_SCALABLE( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a scalable\r\n   *   font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,\r\n   *   and PFR font formats.\r\n   *\r\n   */\r\n#define FT_IS_SCALABLE( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_SCALABLE )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_SFNT( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a font\r\n   *   whose format is based on the SFNT storage scheme.  This usually\r\n   *   means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded\r\n   *   bitmap fonts.\r\n   *\r\n   *   If this macro is true, all functions defined in @FT_SFNT_NAMES_H and\r\n   *   @FT_TRUETYPE_TABLES_H are available.\r\n   *\r\n   */\r\n#define FT_IS_SFNT( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_SFNT )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_FIXED_WIDTH( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a font face\r\n   *   that contains fixed-width (or `monospace', `fixed-pitch', etc.)\r\n   *   glyphs.\r\n   *\r\n   */\r\n#define FT_IS_FIXED_WIDTH( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_FIXED_SIZES( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains some\r\n   *   embedded bitmaps.  See the `available_sizes' field of the\r\n   *   @FT_FaceRec structure.\r\n   *\r\n   */\r\n#define FT_HAS_FIXED_SIZES( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_FAST_GLYPHS( face )\r\n   *\r\n   * @description:\r\n   *   Deprecated.\r\n   *\r\n   */\r\n#define FT_HAS_FAST_GLYPHS( face )  0\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_GLYPH_NAMES( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains some glyph\r\n   *   names that can be accessed through @FT_Get_Glyph_Name.\r\n   *\r\n   */\r\n#define FT_HAS_GLYPH_NAMES( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_MULTIPLE_MASTERS( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains some\r\n   *   multiple masters.  The functions provided by @FT_MULTIPLE_MASTERS_H\r\n   *   are then available to choose the exact design you want.\r\n   *\r\n   */\r\n#define FT_HAS_MULTIPLE_MASTERS( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_CID_KEYED( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a CID-keyed\r\n   *   font.  See the discussion of @FT_FACE_FLAG_CID_KEYED for more\r\n   *   details.\r\n   *\r\n   *   If this macro is true, all functions defined in @FT_CID_H are\r\n   *   available.\r\n   *\r\n   */\r\n#define FT_IS_CID_KEYED( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_CID_KEYED )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_TRICKY( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face represents a `tricky' font.\r\n   *   See the discussion of @FT_FACE_FLAG_TRICKY for more details.\r\n   *\r\n   */\r\n#define FT_IS_TRICKY( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_TRICKY )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    FT_STYLE_FLAG_XXX                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit-flags used to indicate the style of a given face.    */\r\n  /*    These are used in the `style_flags' field of @FT_FaceRec.          */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_STYLE_FLAG_ITALIC ::                                            */\r\n  /*      Indicates that a given face style is italic or oblique.          */\r\n  /*                                                                       */\r\n  /*    FT_STYLE_FLAG_BOLD ::                                              */\r\n  /*      Indicates that a given face is bold.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The style information as provided by FreeType is very basic.  More */\r\n  /*    details are beyond the scope and should be done on a higher level  */\r\n  /*    (for example, by analyzing various fields of the `OS/2' table in   */\r\n  /*    SFNT based fonts).                                                 */\r\n  /*                                                                       */\r\n#define FT_STYLE_FLAG_ITALIC  ( 1 << 0 )\r\n#define FT_STYLE_FLAG_BOLD    ( 1 << 1 )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Size_Internal                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to an `FT_Size_InternalRec' structure, used to    */\r\n  /*    model private data of a given @FT_Size object.                     */\r\n  /*                                                                       */\r\n  typedef struct FT_Size_InternalRec_*  FT_Size_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_Metrics                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The size metrics structure gives the metrics of a size object.     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x_ppem       :: The width of the scaled EM square in pixels, hence */\r\n  /*                    the term `ppem' (pixels per EM).  It is also       */\r\n  /*                    referred to as `nominal width'.                    */\r\n  /*                                                                       */\r\n  /*    y_ppem       :: The height of the scaled EM square in pixels,      */\r\n  /*                    hence the term `ppem' (pixels per EM).  It is also */\r\n  /*                    referred to as `nominal height'.                   */\r\n  /*                                                                       */\r\n  /*    x_scale      :: A 16.16 fractional scaling value used to convert   */\r\n  /*                    horizontal metrics from font units to 26.6         */\r\n  /*                    fractional pixels.  Only relevant for scalable     */\r\n  /*                    font formats.                                      */\r\n  /*                                                                       */\r\n  /*    y_scale      :: A 16.16 fractional scaling value used to convert   */\r\n  /*                    vertical metrics from font units to 26.6           */\r\n  /*                    fractional pixels.  Only relevant for scalable     */\r\n  /*                    font formats.                                      */\r\n  /*                                                                       */\r\n  /*    ascender     :: The ascender in 26.6 fractional pixels.  See       */\r\n  /*                    @FT_FaceRec for the details.                       */\r\n  /*                                                                       */\r\n  /*    descender    :: The descender in 26.6 fractional pixels.  See      */\r\n  /*                    @FT_FaceRec for the details.                       */\r\n  /*                                                                       */\r\n  /*    height       :: The height in 26.6 fractional pixels.  See         */\r\n  /*                    @FT_FaceRec for the details.                       */\r\n  /*                                                                       */\r\n  /*    max_advance  :: The maximum advance width in 26.6 fractional       */\r\n  /*                    pixels.  See @FT_FaceRec for the details.          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The scaling values, if relevant, are determined first during a     */\r\n  /*    size changing operation.  The remaining fields are then set by the */\r\n  /*    driver.  For scalable formats, they are usually set to scaled      */\r\n  /*    values of the corresponding fields in @FT_FaceRec.                 */\r\n  /*                                                                       */\r\n  /*    Note that due to glyph hinting, these values might not be exact    */\r\n  /*    for certain fonts.  Thus they must be treated as unreliable        */\r\n  /*    with an error margin of at least one pixel!                        */\r\n  /*                                                                       */\r\n  /*    Indeed, the only way to get the exact metrics is to render _all_   */\r\n  /*    glyphs.  As this would be a definite performance hit, it is up to  */\r\n  /*    client applications to perform such computations.                  */\r\n  /*                                                                       */\r\n  /*    The FT_Size_Metrics structure is valid for bitmap fonts also.      */\r\n  /*                                                                       */\r\n  typedef struct  FT_Size_Metrics_\r\n  {\r\n    FT_UShort  x_ppem;      /* horizontal pixels per EM               */\r\n    FT_UShort  y_ppem;      /* vertical pixels per EM                 */\r\n\r\n    FT_Fixed   x_scale;     /* scaling values used to convert font    */\r\n    FT_Fixed   y_scale;     /* units to 26.6 fractional pixels        */\r\n\r\n    FT_Pos     ascender;    /* ascender in 26.6 frac. pixels          */\r\n    FT_Pos     descender;   /* descender in 26.6 frac. pixels         */\r\n    FT_Pos     height;      /* text height in 26.6 frac. pixels       */\r\n    FT_Pos     max_advance; /* max horizontal advance, in 26.6 pixels */\r\n\r\n  } FT_Size_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_SizeRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType root size class structure.  A size object models a face   */\r\n  /*    object at a given size.                                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face    :: Handle to the parent face object.                       */\r\n  /*                                                                       */\r\n  /*    generic :: A typeless pointer, which is unused by the FreeType     */\r\n  /*               library or any of its drivers.  It can be used by       */\r\n  /*               client applications to link their own data to each size */\r\n  /*               object.                                                 */\r\n  /*                                                                       */\r\n  /*    metrics :: Metrics for this size object.  This field is read-only. */\r\n  /*                                                                       */\r\n  typedef struct  FT_SizeRec_\r\n  {\r\n    FT_Face           face;      /* parent face object              */\r\n    FT_Generic        generic;   /* generic pointer for client uses */\r\n    FT_Size_Metrics   metrics;   /* size metrics                    */\r\n    FT_Size_Internal  internal;\r\n\r\n  } FT_SizeRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_SubGlyph                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The subglyph structure is an internal object used to describe      */\r\n  /*    subglyphs (for example, in the case of composites).                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The subglyph implementation is not part of the high-level API,     */\r\n  /*    hence the forward structure declaration.                           */\r\n  /*                                                                       */\r\n  /*    You can however retrieve subglyph information with                 */\r\n  /*    @FT_Get_SubGlyph_Info.                                             */\r\n  /*                                                                       */\r\n  typedef struct FT_SubGlyphRec_*  FT_SubGlyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Slot_Internal                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to an `FT_Slot_InternalRec' structure, used to    */\r\n  /*    model private data of a given @FT_GlyphSlot object.                */\r\n  /*                                                                       */\r\n  typedef struct FT_Slot_InternalRec_*  FT_Slot_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_GlyphSlotRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType root glyph slot class structure.  A glyph slot is a       */\r\n  /*    container where individual glyphs can be loaded, be they in        */\r\n  /*    outline or bitmap format.                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    library           :: A handle to the FreeType library instance     */\r\n  /*                         this slot belongs to.                         */\r\n  /*                                                                       */\r\n  /*    face              :: A handle to the parent face object.           */\r\n  /*                                                                       */\r\n  /*    next              :: In some cases (like some font tools), several */\r\n  /*                         glyph slots per face object can be a good     */\r\n  /*                         thing.  As this is rare, the glyph slots are  */\r\n  /*                         listed through a direct, single-linked list   */\r\n  /*                         using its `next' field.                       */\r\n  /*                                                                       */\r\n  /*    generic           :: A typeless pointer which is unused by the     */\r\n  /*                         FreeType library or any of its drivers.  It   */\r\n  /*                         can be used by client applications to link    */\r\n  /*                         their own data to each glyph slot object.     */\r\n  /*                                                                       */\r\n  /*    metrics           :: The metrics of the last loaded glyph in the   */\r\n  /*                         slot.  The returned values depend on the last */\r\n  /*                         load flags (see the @FT_Load_Glyph API        */\r\n  /*                         function) and can be expressed either in 26.6 */\r\n  /*                         fractional pixels or font units.              */\r\n  /*                                                                       */\r\n  /*                         Note that even when the glyph image is        */\r\n  /*                         transformed, the metrics are not.             */\r\n  /*                                                                       */\r\n  /*    linearHoriAdvance :: The advance width of the unhinted glyph.      */\r\n  /*                         Its value is expressed in 16.16 fractional    */\r\n  /*                         pixels, unless @FT_LOAD_LINEAR_DESIGN is set  */\r\n  /*                         when loading the glyph.  This field can be    */\r\n  /*                         important to perform correct WYSIWYG layout.  */\r\n  /*                         Only relevant for outline glyphs.             */\r\n  /*                                                                       */\r\n  /*    linearVertAdvance :: The advance height of the unhinted glyph.     */\r\n  /*                         Its value is expressed in 16.16 fractional    */\r\n  /*                         pixels, unless @FT_LOAD_LINEAR_DESIGN is set  */\r\n  /*                         when loading the glyph.  This field can be    */\r\n  /*                         important to perform correct WYSIWYG layout.  */\r\n  /*                         Only relevant for outline glyphs.             */\r\n  /*                                                                       */\r\n  /*    advance           :: This shorthand is, depending on               */\r\n  /*                         @FT_LOAD_IGNORE_TRANSFORM, the transformed    */\r\n  /*                         advance width for the glyph (in 26.6          */\r\n  /*                         fractional pixel format).  As specified with  */\r\n  /*                         @FT_LOAD_VERTICAL_LAYOUT, it uses either the  */\r\n  /*                         `horiAdvance' or the `vertAdvance' value of   */\r\n  /*                         `metrics' field.                              */\r\n  /*                                                                       */\r\n  /*    format            :: This field indicates the format of the image  */\r\n  /*                         contained in the glyph slot.  Typically       */\r\n  /*                         @FT_GLYPH_FORMAT_BITMAP,                      */\r\n  /*                         @FT_GLYPH_FORMAT_OUTLINE, or                  */\r\n  /*                         @FT_GLYPH_FORMAT_COMPOSITE, but others are    */\r\n  /*                         possible.                                     */\r\n  /*                                                                       */\r\n  /*    bitmap            :: This field is used as a bitmap descriptor     */\r\n  /*                         when the slot format is                       */\r\n  /*                         @FT_GLYPH_FORMAT_BITMAP.  Note that the       */\r\n  /*                         address and content of the bitmap buffer can  */\r\n  /*                         change between calls of @FT_Load_Glyph and a  */\r\n  /*                         few other functions.                          */\r\n  /*                                                                       */\r\n  /*    bitmap_left       :: This is the bitmap's left bearing expressed   */\r\n  /*                         in integer pixels.  Of course, this is only   */\r\n  /*                         valid if the format is                        */\r\n  /*                         @FT_GLYPH_FORMAT_BITMAP.                      */\r\n  /*                                                                       */\r\n  /*    bitmap_top        :: This is the bitmap's top bearing expressed in */\r\n  /*                         integer pixels.  Remember that this is the    */\r\n  /*                         distance from the baseline to the top-most    */\r\n  /*                         glyph scanline, upwards y~coordinates being   */\r\n  /*                         *positive*.                                   */\r\n  /*                                                                       */\r\n  /*    outline           :: The outline descriptor for the current glyph  */\r\n  /*                         image if its format is                        */\r\n  /*                         @FT_GLYPH_FORMAT_OUTLINE.  Once a glyph is    */\r\n  /*                         loaded, `outline' can be transformed,         */\r\n  /*                         distorted, embolded, etc.  However, it must   */\r\n  /*                         not be freed.                                 */\r\n  /*                                                                       */\r\n  /*    num_subglyphs     :: The number of subglyphs in a composite glyph. */\r\n  /*                         This field is only valid for the composite    */\r\n  /*                         glyph format that should normally only be     */\r\n  /*                         loaded with the @FT_LOAD_NO_RECURSE flag.     */\r\n  /*                         For now this is internal to FreeType.         */\r\n  /*                                                                       */\r\n  /*    subglyphs         :: An array of subglyph descriptors for          */\r\n  /*                         composite glyphs.  There are `num_subglyphs'  */\r\n  /*                         elements in there.  Currently internal to     */\r\n  /*                         FreeType.                                     */\r\n  /*                                                                       */\r\n  /*    control_data      :: Certain font drivers can also return the      */\r\n  /*                         control data for a given glyph image (e.g.    */\r\n  /*                         TrueType bytecode, Type~1 charstrings, etc.). */\r\n  /*                         This field is a pointer to such data.         */\r\n  /*                                                                       */\r\n  /*    control_len       :: This is the length in bytes of the control    */\r\n  /*                         data.                                         */\r\n  /*                                                                       */\r\n  /*    other             :: Really wicked formats can use this pointer to */\r\n  /*                         present their own glyph image to client       */\r\n  /*                         applications.  Note that the application      */\r\n  /*                         needs to know about the image format.         */\r\n  /*                                                                       */\r\n  /*    lsb_delta         :: The difference between hinted and unhinted    */\r\n  /*                         left side bearing while autohinting is        */\r\n  /*                         active.  Zero otherwise.                      */\r\n  /*                                                                       */\r\n  /*    rsb_delta         :: The difference between hinted and unhinted    */\r\n  /*                         right side bearing while autohinting is       */\r\n  /*                         active.  Zero otherwise.                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If @FT_Load_Glyph is called with default flags (see                */\r\n  /*    @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in   */\r\n  /*    its native format (e.g., an outline glyph for TrueType and Type~1  */\r\n  /*    formats).                                                          */\r\n  /*                                                                       */\r\n  /*    This image can later be converted into a bitmap by calling         */\r\n  /*    @FT_Render_Glyph.  This function finds the current renderer for    */\r\n  /*    the native image's format, then invokes it.                        */\r\n  /*                                                                       */\r\n  /*    The renderer is in charge of transforming the native image through */\r\n  /*    the slot's face transformation fields, then converting it into a   */\r\n  /*    bitmap that is returned in `slot->bitmap'.                         */\r\n  /*                                                                       */\r\n  /*    Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */\r\n  /*    to specify the position of the bitmap relative to the current pen  */\r\n  /*    position (e.g., coordinates (0,0) on the baseline).  Of course,    */\r\n  /*    `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP.         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Here a small pseudo code fragment which shows how to use           */\r\n  /*    `lsb_delta' and `rsb_delta':                                       */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      FT_Pos  origin_x       = 0;                                      */\r\n  /*      FT_Pos  prev_rsb_delta = 0;                                      */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      for all glyphs do                                                */\r\n  /*        <compute kern between current and previous glyph and add it to */\r\n  /*         `origin_x'>                                                   */\r\n  /*                                                                       */\r\n  /*        <load glyph with `FT_Load_Glyph'>                              */\r\n  /*                                                                       */\r\n  /*        if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 )           */\r\n  /*          origin_x -= 64;                                              */\r\n  /*        else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 )      */\r\n  /*          origin_x += 64;                                              */\r\n  /*                                                                       */\r\n  /*        prev_rsb_delta = face->glyph->rsb_delta;                       */\r\n  /*                                                                       */\r\n  /*        <save glyph image, or render glyph, or ...>                    */\r\n  /*                                                                       */\r\n  /*        origin_x += face->glyph->advance.x;                            */\r\n  /*      endfor                                                           */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  typedef struct  FT_GlyphSlotRec_\r\n  {\r\n    FT_Library        library;\r\n    FT_Face           face;\r\n    FT_GlyphSlot      next;\r\n    FT_UInt           reserved;       /* retained for binary compatibility */\r\n    FT_Generic        generic;\r\n\r\n    FT_Glyph_Metrics  metrics;\r\n    FT_Fixed          linearHoriAdvance;\r\n    FT_Fixed          linearVertAdvance;\r\n    FT_Vector         advance;\r\n\r\n    FT_Glyph_Format   format;\r\n\r\n    FT_Bitmap         bitmap;\r\n    FT_Int            bitmap_left;\r\n    FT_Int            bitmap_top;\r\n\r\n    FT_Outline        outline;\r\n\r\n    FT_UInt           num_subglyphs;\r\n    FT_SubGlyph       subglyphs;\r\n\r\n    void*             control_data;\r\n    long              control_len;\r\n\r\n    FT_Pos            lsb_delta;\r\n    FT_Pos            rsb_delta;\r\n\r\n    void*             other;\r\n\r\n    FT_Slot_Internal  internal;\r\n\r\n  } FT_GlyphSlotRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                         F U N C T I O N S                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Init_FreeType                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a new FreeType library object.  The set of modules      */\r\n  /*    that are registered by this function is determined at build time.  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    alibrary :: A handle to a new library object.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In case you want to provide your own memory allocating routines,   */\r\n  /*    use @FT_New_Library instead, followed by a call to                 */\r\n  /*    @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module).  */\r\n  /*                                                                       */\r\n  /*    For multi-threading applications each thread should have its own   */\r\n  /*    FT_Library object.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Init_FreeType( FT_Library  *alibrary );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_FreeType                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a given FreeType library object and all of its children,   */\r\n  /*    including resources, drivers, faces, sizes, etc.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to the target library object.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_FreeType( FT_Library  library );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_OPEN_XXX                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit-field constants used within the `flags' field of the */\r\n  /*    @FT_Open_Args structure.                                           */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_OPEN_MEMORY   :: This is a memory-based stream.                 */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_STREAM   :: Copy the stream from the `stream' field.       */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_PATHNAME :: Create a new input stream from a C~path        */\r\n  /*                        name.                                          */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_DRIVER   :: Use the `driver' field.                        */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_PARAMS   :: Use the `num_params' and `params' fields.      */\r\n  /*                                                                       */\r\n  /*    ft_open_memory   :: Deprecated; use @FT_OPEN_MEMORY instead.       */\r\n  /*                                                                       */\r\n  /*    ft_open_stream   :: Deprecated; use @FT_OPEN_STREAM instead.       */\r\n  /*                                                                       */\r\n  /*    ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead.     */\r\n  /*                                                                       */\r\n  /*    ft_open_driver   :: Deprecated; use @FT_OPEN_DRIVER instead.       */\r\n  /*                                                                       */\r\n  /*    ft_open_params   :: Deprecated; use @FT_OPEN_PARAMS instead.       */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */\r\n  /*    flags are mutually exclusive.                                      */\r\n  /*                                                                       */\r\n#define FT_OPEN_MEMORY    0x1\r\n#define FT_OPEN_STREAM    0x2\r\n#define FT_OPEN_PATHNAME  0x4\r\n#define FT_OPEN_DRIVER    0x8\r\n#define FT_OPEN_PARAMS    0x10\r\n\r\n#define ft_open_memory    FT_OPEN_MEMORY     /* deprecated */\r\n#define ft_open_stream    FT_OPEN_STREAM     /* deprecated */\r\n#define ft_open_pathname  FT_OPEN_PATHNAME   /* deprecated */\r\n#define ft_open_driver    FT_OPEN_DRIVER     /* deprecated */\r\n#define ft_open_params    FT_OPEN_PARAMS     /* deprecated */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Parameter                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to pass more or less generic parameters to */\r\n  /*    @FT_Open_Face.                                                     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    tag  :: A four-byte identification tag.                            */\r\n  /*                                                                       */\r\n  /*    data :: A pointer to the parameter data.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The ID and function of parameters are driver-specific.  See the    */\r\n  /*    various FT_PARAM_TAG_XXX flags for more information.               */\r\n  /*                                                                       */\r\n  typedef struct  FT_Parameter_\r\n  {\r\n    FT_ULong    tag;\r\n    FT_Pointer  data;\r\n\r\n  } FT_Parameter;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Open_Args                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to indicate how to open a new font file or        */\r\n  /*    stream.  A pointer to such a structure can be used as a parameter  */\r\n  /*    for the functions @FT_Open_Face and @FT_Attach_Stream.             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    flags       :: A set of bit flags indicating how to use the        */\r\n  /*                   structure.                                          */\r\n  /*                                                                       */\r\n  /*    memory_base :: The first byte of the file in memory.               */\r\n  /*                                                                       */\r\n  /*    memory_size :: The size in bytes of the file in memory.            */\r\n  /*                                                                       */\r\n  /*    pathname    :: A pointer to an 8-bit file pathname.                */\r\n  /*                                                                       */\r\n  /*    stream      :: A handle to a source stream object.                 */\r\n  /*                                                                       */\r\n  /*    driver      :: This field is exclusively used by @FT_Open_Face;    */\r\n  /*                   it simply specifies the font driver to use to open  */\r\n  /*                   the face.  If set to~0, FreeType tries to load the  */\r\n  /*                   face with each one of the drivers in its list.      */\r\n  /*                                                                       */\r\n  /*    num_params  :: The number of extra parameters.                     */\r\n  /*                                                                       */\r\n  /*    params      :: Extra parameters passed to the font driver when     */\r\n  /*                   opening a new face.                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream type is determined by the contents of `flags' which     */\r\n  /*    are tested in the following order by @FT_Open_Face:                */\r\n  /*                                                                       */\r\n  /*    If the `FT_OPEN_MEMORY' bit is set, assume that this is a          */\r\n  /*    memory file of `memory_size' bytes, located at `memory_address'.   */\r\n  /*    The data are are not copied, and the client is responsible for     */\r\n  /*    releasing and destroying them _after_ the corresponding call to    */\r\n  /*    @FT_Done_Face.                                                     */\r\n  /*                                                                       */\r\n  /*    Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a       */\r\n  /*    custom input stream `stream' is used.                              */\r\n  /*                                                                       */\r\n  /*    Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this  */\r\n  /*    is a normal file and use `pathname' to open it.                    */\r\n  /*                                                                       */\r\n  /*    If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to    */\r\n  /*    open the file with the driver whose handler is in `driver'.        */\r\n  /*                                                                       */\r\n  /*    If the `FT_OPEN_PARAMS' bit is set, the parameters given by        */\r\n  /*    `num_params' and `params' is used.  They are ignored otherwise.    */\r\n  /*                                                                       */\r\n  /*    Ideally, both the `pathname' and `params' fields should be tagged  */\r\n  /*    as `const'; this is missing for API backwards compatibility.  In   */\r\n  /*    other words, applications should treat them as read-only.          */\r\n  /*                                                                       */\r\n  typedef struct  FT_Open_Args_\r\n  {\r\n    FT_UInt         flags;\r\n    const FT_Byte*  memory_base;\r\n    FT_Long         memory_size;\r\n    FT_String*      pathname;\r\n    FT_Stream       stream;\r\n    FT_Module       driver;\r\n    FT_Int          num_params;\r\n    FT_Parameter*   params;\r\n\r\n  } FT_Open_Args;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Open_Face to open a font by its pathname.  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    pathname   :: A path to the font file.                             */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the font.  The first    */\r\n  /*                  face has index~0.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.  If `face_index' is   */\r\n  /*                  greater than or equal to zero, it must be non-NULL.  */\r\n  /*                  See @FT_Open_Face for more details.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face( FT_Library   library,\r\n               const char*  filepathname,\r\n               FT_Long      face_index,\r\n               FT_Face     *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Memory_Face                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Open_Face to open a font which has been    */\r\n  /*    loaded into memory.                                                */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    file_base  :: A pointer to the beginning of the font data.         */\r\n  /*                                                                       */\r\n  /*    file_size  :: The size of the memory chunk used by the font data.  */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the font.  The first    */\r\n  /*                  face has index~0.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.  If `face_index' is   */\r\n  /*                  greater than or equal to zero, it must be non-NULL.  */\r\n  /*                  See @FT_Open_Face for more details.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You must not deallocate the memory before calling @FT_Done_Face.   */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Memory_Face( FT_Library      library,\r\n                      const FT_Byte*  file_base,\r\n                      FT_Long         file_size,\r\n                      FT_Long         face_index,\r\n                      FT_Face        *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Open_Face                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a face object from a given resource described by            */\r\n  /*    @FT_Open_Args.                                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    args       :: A pointer to an `FT_Open_Args' structure which must  */\r\n  /*                  be filled by the caller.                             */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the font.  The first    */\r\n  /*                  face has index~0.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.  If `face_index' is   */\r\n  /*                  greater than or equal to zero, it must be non-NULL.  */\r\n  /*                  See note below.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Unlike FreeType 1.x, this function automatically creates a glyph   */\r\n  /*    slot for the face object which can be accessed directly through    */\r\n  /*    `face->glyph'.                                                     */\r\n  /*                                                                       */\r\n  /*    FT_Open_Face can be used to quickly check whether the font         */\r\n  /*    format of a given font resource is supported by FreeType.  If the  */\r\n  /*    `face_index' field is negative, the function's return value is~0   */\r\n  /*    if the font format is recognized, or non-zero otherwise;           */\r\n  /*    the function returns a more or less empty face handle in `*aface'  */\r\n  /*    (if `aface' isn't NULL).  The only useful field in this special    */\r\n  /*    case is `face->num_faces' which gives the number of faces within   */\r\n  /*    the font file.  After examination, the returned @FT_Face structure */\r\n  /*    should be deallocated with a call to @FT_Done_Face.                */\r\n  /*                                                                       */\r\n  /*    Each new face object created with this function also owns a        */\r\n  /*    default @FT_Size object, accessible as `face->size'.               */\r\n  /*                                                                       */\r\n  /*    One @FT_Library instance can have multiple face objects, this is,  */\r\n  /*    @FT_Open_Face and its siblings can be called multiple times using  */\r\n  /*    the same `library' argument.                                       */\r\n  /*                                                                       */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Face.                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Open_Face( FT_Library           library,\r\n                const FT_Open_Args*  args,\r\n                FT_Long              face_index,\r\n                FT_Face             *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Attach_File                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Attach_Stream to attach a file.            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face         :: The target face object.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    filepathname :: The pathname.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Attach_File( FT_Face      face,\r\n                  const char*  filepathname );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Attach_Stream                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    `Attach' data to a face object.  Normally, this is used to read    */\r\n  /*    additional information for the face object.  For example, you can  */\r\n  /*    attach an AFM file that comes with a Type~1 font to get the        */\r\n  /*    kerning values and other metrics.                                  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The target face object.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    parameters :: A pointer to @FT_Open_Args which must be filled by   */\r\n  /*                  the caller.                                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The meaning of the `attach' (i.e., what really happens when the    */\r\n  /*    new file is read) is not fixed by FreeType itself.  It really      */\r\n  /*    depends on the font format (and thus the font driver).             */\r\n  /*                                                                       */\r\n  /*    Client applications are expected to know what they are doing       */\r\n  /*    when invoking this function.  Most drivers simply do not implement */\r\n  /*    file attachments.                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Attach_Stream( FT_Face        face,\r\n                    FT_Open_Args*  parameters );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Reference_Face                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A counter gets initialized to~1 at the time an @FT_Face structure  */\r\n  /*    is created.  This function increments the counter.  @FT_Done_Face  */\r\n  /*    then only destroys a face if the counter is~1, otherwise it simply */\r\n  /*    decrements the counter.                                            */\r\n  /*                                                                       */\r\n  /*    This function helps in managing life-cycles of structures which    */\r\n  /*    reference @FT_Face objects.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to a target face object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.4.2                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Reference_Face( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Face                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard a given face object, as well as all of its child slots and */\r\n  /*    sizes.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to a target face object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Face.                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_Face( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Select_Size                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select a bitmap strike.                                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face         :: A handle to a target face object.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    strike_index :: The index of the bitmap strike in the              */\r\n  /*                    `available_sizes' field of @FT_FaceRec structure.  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Select_Size( FT_Face  face,\r\n                  FT_Int   strike_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Size_Request_Type                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type that lists the supported size request types.   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_SIZE_REQUEST_TYPE_NOMINAL ::                                    */\r\n  /*      The nominal size.  The `units_per_EM' field of @FT_FaceRec is    */\r\n  /*      used to determine both scaling values.                           */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_REAL_DIM ::                                   */\r\n  /*      The real dimension.  The sum of the the `ascender' and (minus    */\r\n  /*      of) the `descender' fields of @FT_FaceRec are used to determine  */\r\n  /*      both scaling values.                                             */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_BBOX ::                                       */\r\n  /*      The font bounding box.  The width and height of the `bbox' field */\r\n  /*      of @FT_FaceRec are used to determine the horizontal and vertical */\r\n  /*      scaling value, respectively.                                     */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_CELL ::                                       */\r\n  /*      The `max_advance_width' field of @FT_FaceRec is used to          */\r\n  /*      determine the horizontal scaling value; the vertical scaling     */\r\n  /*      value is determined the same way as                              */\r\n  /*      @FT_SIZE_REQUEST_TYPE_REAL_DIM does.  Finally, both scaling      */\r\n  /*      values are set to the smaller one.  This type is useful if you   */\r\n  /*      want to specify the font size for, say, a window of a given      */\r\n  /*      dimension and 80x24 cells.                                       */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_SCALES ::                                     */\r\n  /*      Specify the scaling values directly.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The above descriptions only apply to scalable formats.  For bitmap */\r\n  /*    formats, the behaviour is up to the driver.                        */\r\n  /*                                                                       */\r\n  /*    See the note section of @FT_Size_Metrics if you wonder how size    */\r\n  /*    requesting relates to scaling values.                              */\r\n  /*                                                                       */\r\n  typedef enum  FT_Size_Request_Type_\r\n  {\r\n    FT_SIZE_REQUEST_TYPE_NOMINAL,\r\n    FT_SIZE_REQUEST_TYPE_REAL_DIM,\r\n    FT_SIZE_REQUEST_TYPE_BBOX,\r\n    FT_SIZE_REQUEST_TYPE_CELL,\r\n    FT_SIZE_REQUEST_TYPE_SCALES,\r\n\r\n    FT_SIZE_REQUEST_TYPE_MAX\r\n\r\n  } FT_Size_Request_Type;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_RequestRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a size request.                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    type           :: See @FT_Size_Request_Type.                       */\r\n  /*                                                                       */\r\n  /*    width          :: The desired width.                               */\r\n  /*                                                                       */\r\n  /*    height         :: The desired height.                              */\r\n  /*                                                                       */\r\n  /*    horiResolution :: The horizontal resolution.  If set to zero,      */\r\n  /*                      `width' is treated as a 26.6 fractional pixel    */\r\n  /*                      value.                                           */\r\n  /*                                                                       */\r\n  /*    vertResolution :: The vertical resolution.  If set to zero,        */\r\n  /*                      `height' is treated as a 26.6 fractional pixel   */\r\n  /*                      value.                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If `width' is zero, then the horizontal scaling value is set equal */\r\n  /*    to the vertical scaling value, and vice versa.                     */\r\n  /*                                                                       */\r\n  typedef struct  FT_Size_RequestRec_\r\n  {\r\n    FT_Size_Request_Type  type;\r\n    FT_Long               width;\r\n    FT_Long               height;\r\n    FT_UInt               horiResolution;\r\n    FT_UInt               vertResolution;\r\n\r\n  } FT_Size_RequestRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_Request                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a size request structure.                              */\r\n  /*                                                                       */\r\n  typedef struct FT_Size_RequestRec_  *FT_Size_Request;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Request_Size                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Resize the scale of the active @FT_Size object in a face.          */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face :: A handle to a target face object.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    req  :: A pointer to a @FT_Size_RequestRec.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Although drivers may select the bitmap strike matching the         */\r\n  /*    request, you should not rely on this if you intend to select a     */\r\n  /*    particular bitmap strike.  Use @FT_Select_Size instead in that     */\r\n  /*    case.                                                              */\r\n  /*                                                                       */\r\n  /*    The relation between the requested size and the resulting glyph    */\r\n  /*    size is dependent entirely on how the size is defined in the       */\r\n  /*    source face.  The font designer chooses the final size of each     */\r\n  /*    glyph relative to this size.  For more information refer to        */\r\n  /*    `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Request_Size( FT_Face          face,\r\n                   FT_Size_Request  req );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Char_Size                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Request_Size to request the nominal size   */\r\n  /*    (in points).                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face            :: A handle to a target face object.               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    char_width      :: The nominal width, in 26.6 fractional points.   */\r\n  /*                                                                       */\r\n  /*    char_height     :: The nominal height, in 26.6 fractional points.  */\r\n  /*                                                                       */\r\n  /*    horz_resolution :: The horizontal resolution in dpi.               */\r\n  /*                                                                       */\r\n  /*    vert_resolution :: The vertical resolution in dpi.                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If either the character width or height is zero, it is set equal   */\r\n  /*    to the other value.                                                */\r\n  /*                                                                       */\r\n  /*    If either the horizontal or vertical resolution is zero, it is set */\r\n  /*    equal to the other value.                                          */\r\n  /*                                                                       */\r\n  /*    A character width or height smaller than 1pt is set to 1pt; if     */\r\n  /*    both resolution values are zero, they are set to 72dpi.            */\r\n  /*                                                                       */\r\n  /*    Don't use this function if you are using the FreeType cache API.   */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Char_Size( FT_Face     face,\r\n                    FT_F26Dot6  char_width,\r\n                    FT_F26Dot6  char_height,\r\n                    FT_UInt     horz_resolution,\r\n                    FT_UInt     vert_resolution );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Pixel_Sizes                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Request_Size to request the nominal size   */\r\n  /*    (in pixels).                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face         :: A handle to the target face object.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    pixel_width  :: The nominal width, in pixels.                      */\r\n  /*                                                                       */\r\n  /*    pixel_height :: The nominal height, in pixels.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should not rely on the resulting glyphs matching, or being     */\r\n  /*    constrained, to this pixel size.  Refer to @FT_Request_Size to     */\r\n  /*    understand how requested sizes relate to actual sizes.             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Pixel_Sizes( FT_Face  face,\r\n                      FT_UInt  pixel_width,\r\n                      FT_UInt  pixel_height );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Load_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to load a single glyph into the glyph slot of a    */\r\n  /*    face object.                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face        :: A handle to the target face object where the glyph  */\r\n  /*                   is loaded.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph_index :: The index of the glyph in the font file.  For       */\r\n  /*                   CID-keyed fonts (either in PS or in CFF format)     */\r\n  /*                   this argument specifies the CID value.              */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   @FT_LOAD_XXX constants can be used to control the   */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The loaded glyph may be transformed.  See @FT_Set_Transform for    */\r\n  /*    the details.                                                       */\r\n  /*                                                                       */\r\n  /*    For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is        */\r\n  /*    returned for invalid CID values (this is, for CID values which     */\r\n  /*    don't have a corresponding glyph in the font).  See the discussion */\r\n  /*    of the @FT_FACE_FLAG_CID_KEYED flag for more details.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Load_Glyph( FT_Face   face,\r\n                 FT_UInt   glyph_index,\r\n                 FT_Int32  load_flags );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Load_Char                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to load a single glyph into the glyph slot of a    */\r\n  /*    face object, according to its character code.                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face        :: A handle to a target face object where the glyph    */\r\n  /*                   is loaded.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    char_code   :: The glyph's character code, according to the        */\r\n  /*                   current charmap used in the face.                   */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   @FT_LOAD_XXX constants can be used to control the   */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Load_Char( FT_Face   face,\r\n                FT_ULong  char_code,\r\n                FT_Int32  load_flags );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_LOAD_XXX\r\n   *\r\n   * @description:\r\n   *   A list of bit-field constants used with @FT_Load_Glyph to indicate\r\n   *   what kind of operations to perform during glyph loading.\r\n   *\r\n   * @values:\r\n   *   FT_LOAD_DEFAULT ::\r\n   *     Corresponding to~0, this value is used as the default glyph load\r\n   *     operation.  In this case, the following happens:\r\n   *\r\n   *     1. FreeType looks for a bitmap for the glyph corresponding to the\r\n   *        face's current size.  If one is found, the function returns.\r\n   *        The bitmap data can be accessed from the glyph slot (see note\r\n   *        below).\r\n   *\r\n   *     2. If no embedded bitmap is searched or found, FreeType looks for a\r\n   *        scalable outline.  If one is found, it is loaded from the font\r\n   *        file, scaled to device pixels, then `hinted' to the pixel grid\r\n   *        in order to optimize it.  The outline data can be accessed from\r\n   *        the glyph slot (see note below).\r\n   *\r\n   *     Note that by default, the glyph loader doesn't render outlines into\r\n   *     bitmaps.  The following flags are used to modify this default\r\n   *     behaviour to more specific and useful cases.\r\n   *\r\n   *   FT_LOAD_NO_SCALE ::\r\n   *     Don't scale the loaded outline glyph but keep it in font units.\r\n   *\r\n   *     This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and\r\n   *     unsets @FT_LOAD_RENDER.\r\n   *\r\n   *     If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using\r\n   *     FT_LOAD_NO_SCALE usually yields meaningless outlines because the\r\n   *     subglyphs must be scaled and positioned with hinting instructions. \r\n   *     This can be solved by loading the font without FT_LOAD_NO_SCALE and\r\n   *     setting the character size to `font->units_per_EM'.\r\n   *\r\n   *   FT_LOAD_NO_HINTING ::\r\n   *     Disable hinting.  This generally generates `blurrier' bitmap glyphs\r\n   *     when the glyph are rendered in any of the anti-aliased modes.  See\r\n   *     also the note below.\r\n   *\r\n   *     This flag is implied by @FT_LOAD_NO_SCALE.\r\n   *\r\n   *   FT_LOAD_RENDER ::\r\n   *     Call @FT_Render_Glyph after the glyph is loaded.  By default, the\r\n   *     glyph is rendered in @FT_RENDER_MODE_NORMAL mode.  This can be\r\n   *     overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.\r\n   *\r\n   *     This flag is unset by @FT_LOAD_NO_SCALE.\r\n   *\r\n   *   FT_LOAD_NO_BITMAP ::\r\n   *     Ignore bitmap strikes when loading.  Bitmap-only fonts ignore this\r\n   *     flag.\r\n   *\r\n   *     @FT_LOAD_NO_SCALE always sets this flag.\r\n   *\r\n   *   FT_LOAD_VERTICAL_LAYOUT ::\r\n   *     Load the glyph for vertical text layout.  In particular, the\r\n   *     `advance' value in the @FT_GlyphSlotRec structure is set to the\r\n   *     `vertAdvance' value of the `metrics' field.\r\n   *\r\n   *     In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use\r\n   *     this flag currently.  Reason is that in this case vertical metrics\r\n   *     get synthesized, and those values are not always consistent across\r\n   *     various font formats.\r\n   *\r\n   *   FT_LOAD_FORCE_AUTOHINT ::\r\n   *     Indicates that the auto-hinter is preferred over the font's native\r\n   *     hinter.  See also the note below.\r\n   *\r\n   *   FT_LOAD_CROP_BITMAP ::\r\n   *     Indicates that the font driver should crop the loaded bitmap glyph\r\n   *     (i.e., remove all space around its black bits).  Not all drivers\r\n   *     implement this.\r\n   *\r\n   *   FT_LOAD_PEDANTIC ::\r\n   *     Indicates that the font driver should perform pedantic verifications\r\n   *     during glyph loading.  This is mostly used to detect broken glyphs\r\n   *     in fonts.  By default, FreeType tries to handle broken fonts also.\r\n   *\r\n   *     In particular, errors from the TrueType bytecode engine are not\r\n   *     passed to the application if this flag is not set; this might\r\n   *     result in partially hinted or distorted glyphs in case a glyph's\r\n   *     bytecode is buggy.\r\n   *\r\n   *   FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::\r\n   *     Ignored.  Deprecated.\r\n   *\r\n   *   FT_LOAD_NO_RECURSE ::\r\n   *     This flag is only used internally.  It merely indicates that the\r\n   *     font driver should not load composite glyphs recursively.  Instead,\r\n   *     it should set the `num_subglyph' and `subglyphs' values of the\r\n   *     glyph slot accordingly, and set `glyph->format' to\r\n   *     @FT_GLYPH_FORMAT_COMPOSITE.\r\n   *\r\n   *     The description of sub-glyphs is not available to client\r\n   *     applications for now.\r\n   *\r\n   *     This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.\r\n   *\r\n   *   FT_LOAD_IGNORE_TRANSFORM ::\r\n   *     Indicates that the transform matrix set by @FT_Set_Transform should\r\n   *     be ignored.\r\n   *\r\n   *   FT_LOAD_MONOCHROME ::\r\n   *     This flag is used with @FT_LOAD_RENDER to indicate that you want to\r\n   *     render an outline glyph to a 1-bit monochrome bitmap glyph, with\r\n   *     8~pixels packed into each byte of the bitmap data.\r\n   *\r\n   *     Note that this has no effect on the hinting algorithm used.  You\r\n   *     should rather use @FT_LOAD_TARGET_MONO so that the\r\n   *     monochrome-optimized hinting algorithm is used.\r\n   *\r\n   *   FT_LOAD_LINEAR_DESIGN ::\r\n   *     Indicates that the `linearHoriAdvance' and `linearVertAdvance'\r\n   *     fields of @FT_GlyphSlotRec should be kept in font units.  See\r\n   *     @FT_GlyphSlotRec for details.\r\n   *\r\n   *   FT_LOAD_NO_AUTOHINT ::\r\n   *     Disable auto-hinter.  See also the note below.\r\n   *\r\n   * @note:\r\n   *   By default, hinting is enabled and the font's native hinter (see\r\n   *   @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter.  You can\r\n   *   disable hinting by setting @FT_LOAD_NO_HINTING or change the\r\n   *   precedence by setting @FT_LOAD_FORCE_AUTOHINT.  You can also set\r\n   *   @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be\r\n   *   used at all.\r\n   *\r\n   *   See the description of @FT_FACE_FLAG_TRICKY for a special exception\r\n   *   (affecting only a handful of Asian fonts).\r\n   *\r\n   *   Besides deciding which hinter to use, you can also decide which\r\n   *   hinting algorithm to use.  See @FT_LOAD_TARGET_XXX for details.\r\n   *\r\n   *   Note that the auto-hinter needs a valid Unicode cmap (either a native\r\n   *   one or synthesized by FreeType) for producing correct results.  If a\r\n   *   font provides an incorrect mapping (for example, assigning the\r\n   *   character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a\r\n   *   mathematical integral sign), the auto-hinter might produce useless\r\n   *   results.\r\n   *\r\n   */\r\n#define FT_LOAD_DEFAULT                      0x0\r\n#define FT_LOAD_NO_SCALE                     ( 1L << 0 )\r\n#define FT_LOAD_NO_HINTING                   ( 1L << 1 )\r\n#define FT_LOAD_RENDER                       ( 1L << 2 )\r\n#define FT_LOAD_NO_BITMAP                    ( 1L << 3 )\r\n#define FT_LOAD_VERTICAL_LAYOUT              ( 1L << 4 )\r\n#define FT_LOAD_FORCE_AUTOHINT               ( 1L << 5 )\r\n#define FT_LOAD_CROP_BITMAP                  ( 1L << 6 )\r\n#define FT_LOAD_PEDANTIC                     ( 1L << 7 )\r\n#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH  ( 1L << 9 )\r\n#define FT_LOAD_NO_RECURSE                   ( 1L << 10 )\r\n#define FT_LOAD_IGNORE_TRANSFORM             ( 1L << 11 )\r\n#define FT_LOAD_MONOCHROME                   ( 1L << 12 )\r\n#define FT_LOAD_LINEAR_DESIGN                ( 1L << 13 )\r\n#define FT_LOAD_NO_AUTOHINT                  ( 1L << 15 )\r\n\r\n  /* */\r\n\r\n  /* used internally only by certain font drivers! */\r\n#define FT_LOAD_ADVANCE_ONLY                 ( 1L << 8 )\r\n#define FT_LOAD_SBITS_ONLY                   ( 1L << 14 )\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_LOAD_TARGET_XXX\r\n   *\r\n   * @description:\r\n   *   A list of values that are used to select a specific hinting algorithm\r\n   *   to use by the hinter.  You should OR one of these values to your\r\n   *   `load_flags' when calling @FT_Load_Glyph.\r\n   *\r\n   *   Note that font's native hinters may ignore the hinting algorithm you\r\n   *   have specified (e.g., the TrueType bytecode interpreter).  You can set\r\n   *   @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.\r\n   *\r\n   *   Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it\r\n   *   always implies @FT_LOAD_FORCE_AUTOHINT.\r\n   *\r\n   * @values:\r\n   *   FT_LOAD_TARGET_NORMAL ::\r\n   *     This corresponds to the default hinting algorithm, optimized for\r\n   *     standard gray-level rendering.  For monochrome output, use\r\n   *     @FT_LOAD_TARGET_MONO instead.\r\n   *\r\n   *   FT_LOAD_TARGET_LIGHT ::\r\n   *     A lighter hinting algorithm for non-monochrome modes.  Many\r\n   *     generated glyphs are more fuzzy but better resemble its original\r\n   *     shape.  A bit like rendering on Mac OS~X.\r\n   *\r\n   *     As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.\r\n   *\r\n   *   FT_LOAD_TARGET_MONO ::\r\n   *     Strong hinting algorithm that should only be used for monochrome\r\n   *     output.  The result is probably unpleasant if the glyph is rendered\r\n   *     in non-monochrome modes.\r\n   *\r\n   *   FT_LOAD_TARGET_LCD ::\r\n   *     A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally\r\n   *     decimated LCD displays.\r\n   *\r\n   *   FT_LOAD_TARGET_LCD_V ::\r\n   *     A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically\r\n   *     decimated LCD displays.\r\n   *\r\n   * @note:\r\n   *   You should use only _one_ of the FT_LOAD_TARGET_XXX values in your\r\n   *   `load_flags'.  They can't be ORed.\r\n   *\r\n   *   If @FT_LOAD_RENDER is also set, the glyph is rendered in the\r\n   *   corresponding mode (i.e., the mode which matches the used algorithm\r\n   *   best).  An exeption is FT_LOAD_TARGET_MONO since it implies\r\n   *   @FT_LOAD_MONOCHROME.\r\n   *\r\n   *   You can use a hinting algorithm that doesn't correspond to the same\r\n   *   rendering mode.  As an example, it is possible to use the `light'\r\n   *   hinting algorithm and have the results rendered in horizontal LCD\r\n   *   pixel mode, with code like\r\n   *\r\n   *     {\r\n   *       FT_Load_Glyph( face, glyph_index,\r\n   *                      load_flags | FT_LOAD_TARGET_LIGHT );\r\n   *\r\n   *       FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );\r\n   *     }\r\n   *\r\n   */\r\n#define FT_LOAD_TARGET_( x )   ( (FT_Int32)( (x) & 15 ) << 16 )\r\n\r\n#define FT_LOAD_TARGET_NORMAL  FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )\r\n#define FT_LOAD_TARGET_LIGHT   FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )\r\n#define FT_LOAD_TARGET_MONO    FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )\r\n#define FT_LOAD_TARGET_LCD     FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )\r\n#define FT_LOAD_TARGET_LCD_V   FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LOAD_TARGET_MODE\r\n   *\r\n   * @description:\r\n   *   Return the @FT_Render_Mode corresponding to a given\r\n   *   @FT_LOAD_TARGET_XXX value.\r\n   *\r\n   */\r\n#define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Transform                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to set the transformation that is applied to glyph */\r\n  /*    images when they are loaded into a glyph slot through              */\r\n  /*    @FT_Load_Glyph.                                                    */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the source face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix :: A pointer to the transformation's 2x2 matrix.  Use~0 for */\r\n  /*              the identity matrix.                                     */\r\n  /*    delta  :: A pointer to the translation vector.  Use~0 for the null */\r\n  /*              vector.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The transformation is only applied to scalable image formats after */\r\n  /*    the glyph has been loaded.  It means that hinting is unaltered by  */\r\n  /*    the transformation and is performed on the character size given in */\r\n  /*    the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes.         */\r\n  /*                                                                       */\r\n  /*    Note that this also transforms the `face.glyph.advance' field, but */\r\n  /*    *not* the values in `face.glyph.metrics'.                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Set_Transform( FT_Face     face,\r\n                    FT_Matrix*  matrix,\r\n                    FT_Vector*  delta );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Render_Mode                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type that lists the render modes supported by       */\r\n  /*    FreeType~2.  Each mode corresponds to a specific type of scanline  */\r\n  /*    conversion performed on the outline.                               */\r\n  /*                                                                       */\r\n  /*    For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode'     */\r\n  /*    field in the @FT_GlyphSlotRec structure gives the format of the    */\r\n  /*    returned bitmap.                                                   */\r\n  /*                                                                       */\r\n  /*    All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity.   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_RENDER_MODE_NORMAL ::                                           */\r\n  /*      This is the default render mode; it corresponds to 8-bit         */\r\n  /*      anti-aliased bitmaps.                                            */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_LIGHT ::                                            */\r\n  /*      This is equivalent to @FT_RENDER_MODE_NORMAL.  It is only        */\r\n  /*      defined as a separate value because render modes are also used   */\r\n  /*      indirectly to define hinting algorithm selectors.  See           */\r\n  /*      @FT_LOAD_TARGET_XXX for details.                                 */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_MONO ::                                             */\r\n  /*      This mode corresponds to 1-bit bitmaps (with 2~levels of         */\r\n  /*      opacity).                                                        */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_LCD ::                                              */\r\n  /*      This mode corresponds to horizontal RGB and BGR sub-pixel        */\r\n  /*      displays like LCD screens.  It produces 8-bit bitmaps that are   */\r\n  /*      3~times the width of the original glyph outline in pixels, and   */\r\n  /*      which use the @FT_PIXEL_MODE_LCD mode.                           */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_LCD_V ::                                            */\r\n  /*      This mode corresponds to vertical RGB and BGR sub-pixel displays */\r\n  /*      (like PDA screens, rotated LCD displays, etc.).  It produces     */\r\n  /*      8-bit bitmaps that are 3~times the height of the original        */\r\n  /*      glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode.   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */\r\n  /*    filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */\r\n  /*    (not active in the default builds).  It is up to the caller to     */\r\n  /*    either call @FT_Library_SetLcdFilter (if available) or do the      */\r\n  /*    filtering itself.                                                  */\r\n  /*                                                                       */\r\n  /*    The selected render mode only affects vector glyphs of a font.     */\r\n  /*    Embedded bitmaps often have a different pixel mode like            */\r\n  /*    @FT_PIXEL_MODE_MONO.  You can use @FT_Bitmap_Convert to transform  */\r\n  /*    them into 8-bit pixmaps.                                           */\r\n  /*                                                                       */\r\n  typedef enum  FT_Render_Mode_\r\n  {\r\n    FT_RENDER_MODE_NORMAL = 0,\r\n    FT_RENDER_MODE_LIGHT,\r\n    FT_RENDER_MODE_MONO,\r\n    FT_RENDER_MODE_LCD,\r\n    FT_RENDER_MODE_LCD_V,\r\n\r\n    FT_RENDER_MODE_MAX\r\n\r\n  } FT_Render_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_render_mode_xxx                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    These constants are deprecated.  Use the corresponding             */\r\n  /*    @FT_Render_Mode values instead.                                    */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL                */\r\n  /*    ft_render_mode_mono   :: see @FT_RENDER_MODE_MONO                  */\r\n  /*                                                                       */\r\n#define ft_render_mode_normal  FT_RENDER_MODE_NORMAL\r\n#define ft_render_mode_mono    FT_RENDER_MODE_MONO\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Render_Glyph                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a given glyph image to a bitmap.  It does so by inspecting */\r\n  /*    the glyph image format, finding the relevant renderer, and         */\r\n  /*    invoking it.                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    slot        :: A handle to the glyph slot containing the image to  */\r\n  /*                   convert.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    render_mode :: This is the render mode used to render the glyph    */\r\n  /*                   image into a bitmap.  See @FT_Render_Mode for a     */\r\n  /*                   list of possible values.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Render_Glyph( FT_GlyphSlot    slot,\r\n                   FT_Render_Mode  render_mode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Kerning_Mode                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used to specify which kerning values to return in   */\r\n  /*    @FT_Get_Kerning.                                                   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_KERNING_DEFAULT  :: Return scaled and grid-fitted kerning       */\r\n  /*                           distances (value is~0).                     */\r\n  /*                                                                       */\r\n  /*    FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning    */\r\n  /*                           distances.                                  */\r\n  /*                                                                       */\r\n  /*    FT_KERNING_UNSCALED :: Return the kerning vector in original font  */\r\n  /*                           units.                                      */\r\n  /*                                                                       */\r\n  typedef enum  FT_Kerning_Mode_\r\n  {\r\n    FT_KERNING_DEFAULT  = 0,\r\n    FT_KERNING_UNFITTED,\r\n    FT_KERNING_UNSCALED\r\n\r\n  } FT_Kerning_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    ft_kerning_default                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This constant is deprecated.  Please use @FT_KERNING_DEFAULT       */\r\n  /*    instead.                                                           */\r\n  /*                                                                       */\r\n#define ft_kerning_default   FT_KERNING_DEFAULT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    ft_kerning_unfitted                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This constant is deprecated.  Please use @FT_KERNING_UNFITTED      */\r\n  /*    instead.                                                           */\r\n  /*                                                                       */\r\n#define ft_kerning_unfitted  FT_KERNING_UNFITTED\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    ft_kerning_unscaled                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This constant is deprecated.  Please use @FT_KERNING_UNSCALED      */\r\n  /*    instead.                                                           */\r\n  /*                                                                       */\r\n#define ft_kerning_unscaled  FT_KERNING_UNSCALED\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Kerning                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the kerning vector between two glyphs of a same face.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to a source face object.                   */\r\n  /*                                                                       */\r\n  /*    left_glyph  :: The index of the left glyph in the kern pair.       */\r\n  /*                                                                       */\r\n  /*    right_glyph :: The index of the right glyph in the kern pair.      */\r\n  /*                                                                       */\r\n  /*    kern_mode   :: See @FT_Kerning_Mode for more information.          */\r\n  /*                   Determines the scale and dimension of the returned  */\r\n  /*                   kerning vector.                                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    akerning    :: The kerning vector.  This is either in font units   */\r\n  /*                   or in pixels (26.6 format) for scalable formats,    */\r\n  /*                   and in pixels for fixed-sizes formats.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only horizontal layouts (left-to-right & right-to-left) are        */\r\n  /*    supported by this method.  Other layouts, or more sophisticated    */\r\n  /*    kernings, are out of the scope of this API function -- they can be */\r\n  /*    implemented through format-specific interfaces.                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Kerning( FT_Face     face,\r\n                  FT_UInt     left_glyph,\r\n                  FT_UInt     right_glyph,\r\n                  FT_UInt     kern_mode,\r\n                  FT_Vector  *akerning );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Track_Kerning                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the track kerning for a given face object at a given size.  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to a source face object.                    */\r\n  /*                                                                       */\r\n  /*    point_size :: The point size in 16.16 fractional points.           */\r\n  /*                                                                       */\r\n  /*    degree     :: The degree of tightness.  Increasingly negative      */\r\n  /*                  values represent tighter track kerning, while        */\r\n  /*                  increasingly positive values represent looser track  */\r\n  /*                  kerning.  Value zero means no track kerning.         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    akerning   :: The kerning in 16.16 fractional points, to be        */\r\n  /*                  uniformly applied between all glyphs.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Currently, only the Type~1 font driver supports track kerning,     */\r\n  /*    using data from AFM files (if attached with @FT_Attach_File or     */\r\n  /*    @FT_Attach_Stream).                                                */\r\n  /*                                                                       */\r\n  /*    Only very few AFM files come with track kerning data; please refer */\r\n  /*    to the Adobe's AFM specification for more details.                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Track_Kerning( FT_Face    face,\r\n                        FT_Fixed   point_size,\r\n                        FT_Int     degree,\r\n                        FT_Fixed*  akerning );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Glyph_Name                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the ASCII name of a given glyph in a face.  This only     */\r\n  /*    works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to a source face object.                   */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The glyph index.                                    */\r\n  /*                                                                       */\r\n  /*    buffer_max  :: The maximum number of bytes available in the        */\r\n  /*                   buffer.                                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    buffer      :: A pointer to a target buffer where the name is      */\r\n  /*                   copied to.                                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An error is returned if the face doesn't provide glyph names or if */\r\n  /*    the glyph index is invalid.  In all cases of failure, the first    */\r\n  /*    byte of `buffer' is set to~0 to indicate an empty name.            */\r\n  /*                                                                       */\r\n  /*    The glyph name is truncated to fit within the buffer if it is too  */\r\n  /*    long.  The returned string is always zero-terminated.              */\r\n  /*                                                                       */\r\n  /*    Be aware that FreeType reorders glyph indices internally so that   */\r\n  /*    glyph index~0 always corresponds to the `missing glyph' (called    */\r\n  /*    `.notdef').                                                        */\r\n  /*                                                                       */\r\n  /*    This function is not compiled within the library if the config     */\r\n  /*    macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in              */\r\n  /*    `include/freetype/config/ftoptions.h'.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Glyph_Name( FT_Face     face,\r\n                     FT_UInt     glyph_index,\r\n                     FT_Pointer  buffer,\r\n                     FT_UInt     buffer_max );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Postscript_Name                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the ASCII PostScript name of a given face, if available.  */\r\n  /*    This only works with PostScript and TrueType fonts.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face object.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to the face's PostScript name.  NULL if unavailable.     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned pointer is owned by the face and is destroyed with    */\r\n  /*    it.                                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( const char* )\r\n  FT_Get_Postscript_Name( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Select_Charmap                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select a given charmap by its encoding tag (as listed in           */\r\n  /*    `freetype.h').                                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face     :: A handle to the source face object.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    encoding :: A handle to the selected encoding.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function returns an error if no charmap in the face           */\r\n  /*    corresponds to the encoding queried here.                          */\r\n  /*                                                                       */\r\n  /*    Because many fonts contain more than a single cmap for Unicode     */\r\n  /*    encoding, this function has some special code to select the one    */\r\n  /*    which covers Unicode best (`best' in the sense that a UCS-4 cmap   */\r\n  /*    is preferred to a UCS-2 cmap).  It is thus preferable to           */\r\n  /*    @FT_Set_Charmap in this case.                                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Select_Charmap( FT_Face      face,\r\n                     FT_Encoding  encoding );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Charmap                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select a given charmap for character code to glyph index mapping.  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face    :: A handle to the source face object.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charmap :: A handle to the selected charmap.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function returns an error if the charmap is not part of       */\r\n  /*    the face (i.e., if it is not listed in the `face->charmaps'        */\r\n  /*    table).                                                            */\r\n  /*                                                                       */\r\n  /*    It also fails if a type~14 charmap is selected.                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Charmap( FT_Face     face,\r\n                  FT_CharMap  charmap );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Get_Charmap_Index\r\n   *\r\n   * @description:\r\n   *   Retrieve index of a given charmap.\r\n   *\r\n   * @input:\r\n   *   charmap ::\r\n   *     A handle to a charmap.\r\n   *\r\n   * @return:\r\n   *   The index into the array of character maps within the face to which\r\n   *   `charmap' belongs.  If an error occurs, -1 is returned.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Get_Charmap_Index( FT_CharMap  charmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Char_Index                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the glyph index of a given character code.  This function   */\r\n  /*    uses a charmap object to do the mapping.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the source face object.                    */\r\n  /*                                                                       */\r\n  /*    charcode :: The character code.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The glyph index.  0~means `undefined character code'.              */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If you use FreeType to manipulate the contents of font files       */\r\n  /*    directly, be aware that the glyph index returned by this function  */\r\n  /*    doesn't always correspond to the internal indices used within the  */\r\n  /*    file.  This is done to ensure that value~0 always corresponds to   */\r\n  /*    the `missing glyph'.  If the first glyph is not named `.notdef',   */\r\n  /*    then for Type~1 and Type~42 fonts, `.notdef' will be moved into    */\r\n  /*    the glyph ID~0 position, and whatever was there will be moved to   */\r\n  /*    the position `.notdef' had.  For Type~1 fonts, if there is no      */\r\n  /*    `.notdef' glyph at all, then one will be created at index~0 and    */\r\n  /*    whatever was there will be moved to the last index -- Type~42      */\r\n  /*    fonts are considered invalid under this condition.                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Get_Char_Index( FT_Face   face,\r\n                     FT_ULong  charcode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_First_Char                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to return the first character code in the    */\r\n  /*    current charmap of a given face.  It also returns the              */\r\n  /*    corresponding glyph index.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: A handle to the source face object.                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    agindex :: Glyph index of first character code.  0~if charmap is   */\r\n  /*               empty.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The charmap's first character code.                                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should use this function with @FT_Get_Next_Char to be able to  */\r\n  /*    parse all character codes available in a given charmap.  The code  */\r\n  /*    should look like this:                                             */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      FT_ULong  charcode;                                              */\r\n  /*      FT_UInt   gindex;                                                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      charcode = FT_Get_First_Char( face, &gindex );                   */\r\n  /*      while ( gindex != 0 )                                            */\r\n  /*      {                                                                */\r\n  /*        ... do something with (charcode,gindex) pair ...               */\r\n  /*                                                                       */\r\n  /*        charcode = FT_Get_Next_Char( face, charcode, &gindex );        */\r\n  /*      }                                                                */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Note that `*agindex' is set to~0 if the charmap is empty.  The     */\r\n  /*    result itself can be~0 in two cases: if the charmap is empty or    */\r\n  /*    if the value~0 is the first valid character code.                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ULong )\r\n  FT_Get_First_Char( FT_Face   face,\r\n                     FT_UInt  *agindex );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Next_Char                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to return the next character code in the     */\r\n  /*    current charmap of a given face following the value `char_code',   */\r\n  /*    as well as the corresponding glyph index.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face      :: A handle to the source face object.                   */\r\n  /*    char_code :: The starting character code.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    agindex   :: Glyph index of next character code.  0~if charmap     */\r\n  /*                 is empty.                                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The charmap's next character code.                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should use this function with @FT_Get_First_Char to walk       */\r\n  /*    over all character codes available in a given charmap.  See the    */\r\n  /*    note for this function for a simple code example.                  */\r\n  /*                                                                       */\r\n  /*    Note that `*agindex' is set to~0 when there are no more codes in   */\r\n  /*    the charmap.                                                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ULong )\r\n  FT_Get_Next_Char( FT_Face    face,\r\n                    FT_ULong   char_code,\r\n                    FT_UInt   *agindex );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Name_Index                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the glyph index of a given glyph name.  This function uses  */\r\n  /*    driver specific objects to do the translation.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to the source face object.                  */\r\n  /*                                                                       */\r\n  /*    glyph_name :: The glyph name.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The glyph index.  0~means `undefined character code'.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Get_Name_Index( FT_Face     face,\r\n                     FT_String*  glyph_name );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SUBGLYPH_FLAG_XXX\r\n   *\r\n   * @description:\r\n   *   A list of constants used to describe subglyphs.  Please refer to the\r\n   *   TrueType specification for the meaning of the various flags.\r\n   *\r\n   * @values:\r\n   *   FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::\r\n   *   FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::\r\n   *   FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::\r\n   *   FT_SUBGLYPH_FLAG_SCALE ::\r\n   *   FT_SUBGLYPH_FLAG_XY_SCALE ::\r\n   *   FT_SUBGLYPH_FLAG_2X2 ::\r\n   *   FT_SUBGLYPH_FLAG_USE_MY_METRICS ::\r\n   *\r\n   */\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2\r\n#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4\r\n#define FT_SUBGLYPH_FLAG_SCALE                   8\r\n#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40\r\n#define FT_SUBGLYPH_FLAG_2X2                  0x80\r\n#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Get_SubGlyph_Info\r\n   *\r\n   * @description:\r\n   *   Retrieve a description of a given subglyph.  Only use it if\r\n   *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is\r\n   *   returned otherwise.\r\n   *\r\n   * @input:\r\n   *   glyph ::\r\n   *     The source glyph slot.\r\n   *\r\n   *   sub_index ::\r\n   *     The index of the subglyph.  Must be less than\r\n   *     `glyph->num_subglyphs'.\r\n   *\r\n   * @output:\r\n   *   p_index ::\r\n   *     The glyph index of the subglyph.\r\n   *\r\n   *   p_flags ::\r\n   *     The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.\r\n   *\r\n   *   p_arg1 ::\r\n   *     The subglyph's first argument (if any).\r\n   *\r\n   *   p_arg2 ::\r\n   *     The subglyph's second argument (if any).\r\n   *\r\n   *   p_transform ::\r\n   *     The subglyph transformation (if any).\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be\r\n   *   interpreted depending on the flags returned in `*p_flags'.  See the\r\n   *   TrueType specification for details.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,\r\n                        FT_UInt       sub_index,\r\n                        FT_Int       *p_index,\r\n                        FT_UInt      *p_flags,\r\n                        FT_Int       *p_arg1,\r\n                        FT_Int       *p_arg2,\r\n                        FT_Matrix    *p_transform );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_FSTYPE_XXX                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit flags used in the `fsType' field of the OS/2 table   */\r\n  /*    in a TrueType or OpenType font and the `FSType' entry in a         */\r\n  /*    PostScript font.  These bit flags are returned by                  */\r\n  /*    @FT_Get_FSType_Flags; they inform client applications of embedding */\r\n  /*    and subsetting restrictions associated with a font.                */\r\n  /*                                                                       */\r\n  /*    See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for  */\r\n  /*    more details.                                                      */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING ::                                 */\r\n  /*      Fonts with no fsType bit set may be embedded and permanently     */\r\n  /*      installed on the remote system by an application.                */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING ::                          */\r\n  /*      Fonts that have only this bit set must not be modified, embedded */\r\n  /*      or exchanged in any manner without first obtaining permission of */\r\n  /*      the font software copyright owner.                               */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING ::                           */\r\n  /*      If this bit is set, the font may be embedded and temporarily     */\r\n  /*      loaded on the remote system.  Documents containing Preview &     */\r\n  /*      Print fonts must be opened `read-only'; no edits can be applied  */\r\n  /*      to the document.                                                 */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_EDITABLE_EMBEDDING ::                                    */\r\n  /*      If this bit is set, the font may be embedded but must only be    */\r\n  /*      installed temporarily on other systems.  In contrast to Preview  */\r\n  /*      & Print fonts, documents containing editable fonts may be opened */\r\n  /*      for reading, editing is permitted, and changes may be saved.     */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_NO_SUBSETTING ::                                         */\r\n  /*      If this bit is set, the font may not be subsetted prior to       */\r\n  /*      embedding.                                                       */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY ::                                 */\r\n  /*      If this bit is set, only bitmaps contained in the font may be    */\r\n  /*      embedded; no outline data may be embedded.  If there are no      */\r\n  /*      bitmaps available in the font, then the font is unembeddable.    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    While the fsType flags can indicate that a font may be embedded, a */\r\n  /*    license with the font vendor may be separately required to use the */\r\n  /*    font in this way.                                                  */\r\n  /*                                                                       */\r\n#define FT_FSTYPE_INSTALLABLE_EMBEDDING         0x0000\r\n#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING  0x0002\r\n#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING   0x0004\r\n#define FT_FSTYPE_EDITABLE_EMBEDDING            0x0008\r\n#define FT_FSTYPE_NO_SUBSETTING                 0x0100\r\n#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY         0x0200\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_FSType_Flags                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the fsType flags for a font.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face object.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The fsType flags, @FT_FSTYPE_XXX.                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Use this function rather than directly reading the `fs_type' field */\r\n  /*    in the @PS_FontInfoRec structure which is only guaranteed to       */\r\n  /*    return the correct results for Type~1 fonts.                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.8                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UShort )\r\n  FT_Get_FSType_Flags( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    glyph_variants                                                     */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Glyph Variants                                                     */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    The FreeType~2 interface to Unicode Ideographic Variation          */\r\n  /*    Sequences (IVS), using the SFNT cmap format~14.                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Many CJK characters have variant forms.  They are a sort of grey   */\r\n  /*    area somewhere between being totally irrelevant and semantically   */\r\n  /*    distinct; for this reason, the Unicode consortium decided to       */\r\n  /*    introduce Ideographic Variation Sequences (IVS), consisting of a   */\r\n  /*    Unicode base character and one of 240 variant selectors            */\r\n  /*    (U+E0100-U+E01EF), instead of further extending the already huge   */\r\n  /*    code range for CJK characters.                                     */\r\n  /*                                                                       */\r\n  /*    An IVS is registered and unique; for further details please refer  */\r\n  /*    to Unicode Technical Standard #37, the Ideographic Variation       */\r\n  /*    Database:                                                          */\r\n  /*                                                                       */\r\n  /*      http://www.unicode.org/reports/tr37/                             */\r\n  /*                                                                       */\r\n  /*    To date (November 2012), the character with the most variants is   */\r\n  /*    U+9089, having 31 such IVS.                                        */\r\n  /*                                                                       */\r\n  /*    Adobe and MS decided to support IVS with a new cmap subtable       */\r\n  /*    (format~14).  It is an odd subtable because it is not a mapping of */\r\n  /*    input code points to glyphs, but contains lists of all variants    */\r\n  /*    supported by the font.                                             */\r\n  /*                                                                       */\r\n  /*    A variant may be either `default' or `non-default'.  A default     */\r\n  /*    variant is the one you will get for that code point if you look it */\r\n  /*    up in the standard Unicode cmap.  A non-default variant is a       */\r\n  /*    different glyph.                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetCharVariantIndex                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the glyph index of a given character code as modified by    */\r\n  /*    the variation selector.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    charcode ::                                                        */\r\n  /*      The character code point in Unicode.                             */\r\n  /*                                                                       */\r\n  /*    variantSelector ::                                                 */\r\n  /*      The Unicode code point of the variation selector.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The glyph index.  0~means either `undefined character code', or    */\r\n  /*    `undefined selector code', or `no variation selector cmap          */\r\n  /*    subtable', or `current CharMap is not Unicode'.                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If you use FreeType to manipulate the contents of font files       */\r\n  /*    directly, be aware that the glyph index returned by this function  */\r\n  /*    doesn't always correspond to the internal indices used within      */\r\n  /*    the file.  This is done to ensure that value~0 always corresponds  */\r\n  /*    to the `missing glyph'.                                            */\r\n  /*                                                                       */\r\n  /*    This function is only meaningful if                                */\r\n  /*      a) the font has a variation selector cmap sub table,             */\r\n  /*    and                                                                */\r\n  /*      b) the current charmap has a Unicode encoding.                   */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Face_GetCharVariantIndex( FT_Face   face,\r\n                               FT_ULong  charcode,\r\n                               FT_ULong  variantSelector );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetCharVariantIsDefault                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check whether this variant of this Unicode character is the one to */\r\n  /*    be found in the `cmap'.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    charcode ::                                                        */\r\n  /*      The character codepoint in Unicode.                              */\r\n  /*                                                                       */\r\n  /*    variantSelector ::                                                 */\r\n  /*      The Unicode codepoint of the variation selector.                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    1~if found in the standard (Unicode) cmap, 0~if found in the       */\r\n  /*    variation selector cmap, or -1 if it is not a variant.             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is only meaningful if the font has a variation       */\r\n  /*    selector cmap subtable.                                            */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Face_GetCharVariantIsDefault( FT_Face   face,\r\n                                   FT_ULong  charcode,\r\n                                   FT_ULong  variantSelector );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetVariantSelectors                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a zero-terminated list of Unicode variant selectors found   */\r\n  /*    in the font.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to an array of selector code points, or NULL if there is */\r\n  /*    no valid variant selector cmap subtable.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The last item in the array is~0; the array is owned by the         */\r\n  /*    @FT_Face object but can be overwritten or released on the next     */\r\n  /*    call to a FreeType function.                                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt32* )\r\n  FT_Face_GetVariantSelectors( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetVariantsOfChar                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a zero-terminated list of Unicode variant selectors found   */\r\n  /*    for the specified character code.                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    charcode ::                                                        */\r\n  /*      The character codepoint in Unicode.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to an array of variant selector code points which are    */\r\n  /*    active for the given character, or NULL if the corresponding list  */\r\n  /*    is empty.                                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The last item in the array is~0; the array is owned by the         */\r\n  /*    @FT_Face object but can be overwritten or released on the next     */\r\n  /*    call to a FreeType function.                                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt32* )\r\n  FT_Face_GetVariantsOfChar( FT_Face   face,\r\n                             FT_ULong  charcode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetCharsOfVariant                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a zero-terminated list of Unicode character codes found for */\r\n  /*    the specified variant selector.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    variantSelector ::                                                 */\r\n  /*      The variant selector code point in Unicode.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A list of all the code points which are specified by this selector */\r\n  /*    (both default and non-default codes are returned) or NULL if there */\r\n  /*    is no valid cmap or the variant selector is invalid.               */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The last item in the array is~0; the array is owned by the         */\r\n  /*    @FT_Face object but can be overwritten or released on the next     */\r\n  /*    call to a FreeType function.                                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt32* )\r\n  FT_Face_GetCharsOfVariant( FT_Face   face,\r\n                             FT_ULong  variantSelector );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    computations                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Computations                                                       */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Crunching fixed numbers and vectors.                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains various functions used to perform            */\r\n  /*    computations on 16.16 fixed-float numbers or 2d vectors.           */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_MulDiv                                                          */\r\n  /*    FT_MulFix                                                          */\r\n  /*    FT_DivFix                                                          */\r\n  /*    FT_RoundFix                                                        */\r\n  /*    FT_CeilFix                                                         */\r\n  /*    FT_FloorFix                                                        */\r\n  /*    FT_Vector_Transform                                                */\r\n  /*    FT_Matrix_Multiply                                                 */\r\n  /*    FT_Matrix_Invert                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_MulDiv                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation `(a*b)/c'   */\r\n  /*    with maximum accuracy (it uses a 64-bit intermediate integer       */\r\n  /*    whenever necessary).                                               */\r\n  /*                                                                       */\r\n  /*    This function isn't necessarily as fast as some processor specific */\r\n  /*    operations, but is at least completely portable.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.                                        */\r\n  /*    c :: The divisor.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*b)/c'.  This function never traps when trying to */\r\n  /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */\r\n  /*    on the signs of `a' and `b'.                                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_MulDiv( FT_Long  a,\r\n             FT_Long  b,\r\n             FT_Long  c );\r\n\r\n\r\n  /* */\r\n\r\n  /* The following #if 0 ... #endif is for the documentation formatter, */\r\n  /* hiding the internal `FT_MULFIX_INLINED' macro.                     */\r\n\r\n#if 0\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_MulFix                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation             */\r\n  /*    `(a*b)/0x10000' with maximum accuracy.  Most of the time this is   */\r\n  /*    used to multiply a given value by a 16.16 fixed float factor.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */\r\n  /*         possible (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*b)/0x10000'.                                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function has been optimized for the case where the absolute   */\r\n  /*    value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */\r\n  /*    As this happens mainly when scaling from notional units to         */\r\n  /*    fractional pixels in FreeType, it resulted in noticeable speed     */\r\n  /*    improvements between versions 2.x and 1.x.                         */\r\n  /*                                                                       */\r\n  /*    As a conclusion, always try to place a 16.16 factor as the         */\r\n  /*    _second_ argument of this function; this can make a great          */\r\n  /*    difference.                                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_MulFix( FT_Long  a,\r\n             FT_Long  b );\r\n\r\n  /* */\r\n#endif\r\n\r\n#ifdef FT_MULFIX_INLINED\r\n#define FT_MulFix( a, b )  FT_MULFIX_INLINED( a, b )\r\n#else\r\n  FT_EXPORT( FT_Long )\r\n  FT_MulFix( FT_Long  a,\r\n             FT_Long  b );\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_DivFix                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation             */\r\n  /*    `(a*0x10000)/b' with maximum accuracy.  Most of the time, this is  */\r\n  /*    used to divide a given value by a 16.16 fixed float factor.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */\r\n  /*         possible (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*0x10000)/b'.                                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The optimization for FT_DivFix() is simple: If (a~<<~16) fits in   */\r\n  /*    32~bits, then the division is computed directly.  Otherwise, we    */\r\n  /*    use a specialized version of @FT_MulDiv.                           */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_DivFix( FT_Long  a,\r\n             FT_Long  b );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_RoundFix                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to round a 16.16 fixed number.         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The number to be rounded.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a + 0x8000) & -0x10000'.                           */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_RoundFix( FT_Fixed  a );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_CeilFix                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to compute the ceiling function of a   */\r\n  /*    16.16 fixed number.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The number for which the ceiling function is to be computed.  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a + 0x10000 - 1) & -0x10000'.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_CeilFix( FT_Fixed  a );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_FloorFix                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to compute the floor function of a     */\r\n  /*    16.16 fixed number.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The number for which the floor function is to be computed.    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `a & -0x10000'.                                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_FloorFix( FT_Fixed  a );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Vector_Transform                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Transform a single vector through a 2x2 matrix.                    */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    vector :: The target vector to transform.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix :: A pointer to the source 2x2 matrix.                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The result is undefined if either `vector' or `matrix' is invalid. */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Transform( FT_Vector*        vec,\r\n                       const FT_Matrix*  matrix );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    version                                                            */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    FreeType Version                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Functions and macros related to FreeType versions.                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Note that those functions and macros are of limited use because    */\r\n  /*    even a new release of FreeType with only documentation changes     */\r\n  /*    increases the version number.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FREETYPE_XXX\r\n   *\r\n   * @description:\r\n   *   These three macros identify the FreeType source code version.\r\n   *   Use @FT_Library_Version to access them at runtime.\r\n   *\r\n   * @values:\r\n   *   FREETYPE_MAJOR :: The major version number.\r\n   *   FREETYPE_MINOR :: The minor version number.\r\n   *   FREETYPE_PATCH :: The patch level.\r\n   *\r\n   * @note:\r\n   *   The version number of FreeType if built as a dynamic link library\r\n   *   with the `libtool' package is _not_ controlled by these three\r\n   *   macros.\r\n   *\r\n   */\r\n#define FREETYPE_MAJOR  2\r\n#define FREETYPE_MINOR  4\r\n#define FREETYPE_PATCH  11\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Library_Version                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the version of the FreeType library being used.  This is    */\r\n  /*    useful when dynamically linking to the library, since one cannot   */\r\n  /*    use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and               */\r\n  /*    @FREETYPE_PATCH.                                                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A source library handle.                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amajor  :: The major version number.                               */\r\n  /*                                                                       */\r\n  /*    aminor  :: The minor version number.                               */\r\n  /*                                                                       */\r\n  /*    apatch  :: The patch version number.                               */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The reason why this function takes a `library' argument is because */\r\n  /*    certain programs implement library initialization in a custom way  */\r\n  /*    that doesn't use @FT_Init_FreeType.                                */\r\n  /*                                                                       */\r\n  /*    In such cases, the library version might not be available before   */\r\n  /*    the library object has been created.                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Library_Version( FT_Library   library,\r\n                      FT_Int      *amajor,\r\n                      FT_Int      *aminor,\r\n                      FT_Int      *apatch );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_CheckTrueTypePatents                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parse all bytecode instructions of a TrueType font file to check   */\r\n  /*    whether any of the patented opcodes are used.  This is only useful */\r\n  /*    if you want to be able to use the unpatented hinter with           */\r\n  /*    fonts that do *not* use these opcodes.                             */\r\n  /*                                                                       */\r\n  /*    Note that this function parses *all* glyph instructions in the     */\r\n  /*    font file, which may be slow.                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A face handle.                                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    1~if this is a TrueType font that uses one of the patented         */\r\n  /*    opcodes, 0~otherwise.                                              */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since May 2010, TrueType hinting is no longer patented.            */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.5                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Bool )\r\n  FT_Face_CheckTrueTypePatents( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_SetUnpatentedHinting                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Enable or disable the unpatented hinter for a given face.          */\r\n  /*    Only enable it if you have determined that the face doesn't        */\r\n  /*    use any patented opcodes (see @FT_Face_CheckTrueTypePatents).      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face  :: A face handle.                                            */\r\n  /*                                                                       */\r\n  /*    value :: New boolean setting.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The old setting value.  This will always be false if this is not   */\r\n  /*    an SFNT font, or if the unpatented hinter is not compiled in this  */\r\n  /*    instance of the library.                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since May 2010, TrueType hinting is no longer patented.            */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.5                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Bool )\r\n  FT_Face_SetUnpatentedHinting( FT_Face  face,\r\n                                FT_Bool  value );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FREETYPE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftadvanc.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftadvanc.h                                                             */\r\n/*                                                                         */\r\n/*    Quick computation of advance widths (specification only).            */\r\n/*                                                                         */\r\n/*  Copyright 2008 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTADVANC_H__\r\n#define __FTADVANC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @section:\r\n   *   quick_advance\r\n   *\r\n   * @title:\r\n   *   Quick retrieval of advance values\r\n   *\r\n   * @abstract:\r\n   *   Retrieve horizontal and vertical advance values without processing\r\n   *   glyph outlines, if possible.\r\n   *\r\n   * @description:\r\n   *   This section contains functions to quickly extract advance values\r\n   *   without handling glyph outlines, if possible.\r\n   */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    FT_ADVANCE_FLAG_FAST_ONLY                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A bit-flag to be OR-ed with the `flags' parameter of the           */\r\n  /*    @FT_Get_Advance and @FT_Get_Advances functions.                    */\r\n  /*                                                                       */\r\n  /*    If set, it indicates that you want these functions to fail if the  */\r\n  /*    corresponding hinting mode or font driver doesn't allow for very   */\r\n  /*    quick advance computation.                                         */\r\n  /*                                                                       */\r\n  /*    Typically, glyphs which are either unscaled, unhinted, bitmapped,  */\r\n  /*    or light-hinted can have their advance width computed very         */\r\n  /*    quickly.                                                           */\r\n  /*                                                                       */\r\n  /*    Normal and bytecode hinted modes, which require loading, scaling,  */\r\n  /*    and hinting of the glyph outline, are extremely slow by            */\r\n  /*    comparison.                                                        */\r\n  /*                                                                       */\r\n#define FT_ADVANCE_FLAG_FAST_ONLY  0x20000000UL\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Advance                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the advance value of a given glyph outline in an          */\r\n  /*    @FT_Face.  By default, the unhinted advance is returned in font    */\r\n  /*    units.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: The source @FT_Face handle.                          */\r\n  /*                                                                       */\r\n  /*    gindex     :: The glyph index.                                     */\r\n  /*                                                                       */\r\n  /*    load_flags :: A set of bit flags similar to those used when        */\r\n  /*                  calling @FT_Load_Glyph, used to determine what kind  */\r\n  /*                  of advances you need.                                */\r\n  /* <Output>                                                              */\r\n  /*    padvance :: The advance value, in either font units or 16.16       */\r\n  /*                format.                                                */\r\n  /*                                                                       */\r\n  /*                If @FT_LOAD_VERTICAL_LAYOUT is set, this is the        */\r\n  /*                vertical advance corresponding to a vertical layout.   */\r\n  /*                Otherwise, it is the horizontal advance in a           */\r\n  /*                horizontal layout.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */\r\n  /*    if the corresponding font backend doesn't have a quick way to      */\r\n  /*    retrieve the advances.                                             */\r\n  /*                                                                       */\r\n  /*    A scaled advance is returned in 16.16 format but isn't transformed */\r\n  /*    by the affine transformation specified by @FT_Set_Transform.       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Advance( FT_Face    face,\r\n                  FT_UInt    gindex,\r\n                  FT_Int32   load_flags,\r\n                  FT_Fixed  *padvance );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Advances                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the advance values of several glyph outlines in an        */\r\n  /*    @FT_Face.  By default, the unhinted advances are returned in font  */\r\n  /*    units.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: The source @FT_Face handle.                         */\r\n  /*                                                                       */\r\n  /*    start       :: The first glyph index.                              */\r\n  /*                                                                       */\r\n  /*    count       :: The number of advance values you want to retrieve.  */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A set of bit flags similar to those used when       */\r\n  /*                   calling @FT_Load_Glyph.                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    padvance :: The advances, in either font units or 16.16 format.    */\r\n  /*                This array must contain at least `count' elements.     */\r\n  /*                                                                       */\r\n  /*                If @FT_LOAD_VERTICAL_LAYOUT is set, these are the      */\r\n  /*                vertical advances corresponding to a vertical layout.  */\r\n  /*                Otherwise, they are the horizontal advances in a       */\r\n  /*                horizontal layout.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */\r\n  /*    if the corresponding font backend doesn't have a quick way to      */\r\n  /*    retrieve the advances.                                             */\r\n  /*                                                                       */\r\n  /*    Scaled advances are returned in 16.16 format but aren't            */\r\n  /*    transformed by the affine transformation specified by              */\r\n  /*    @FT_Set_Transform.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Advances( FT_Face    face,\r\n                   FT_UInt    start,\r\n                   FT_UInt    count,\r\n                   FT_Int32   load_flags,\r\n                   FT_Fixed  *padvances );\r\n\r\n/* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTADVANC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftautoh.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftautoh.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for controlling the auto-hinter (specification only).   */\r\n/*                                                                         */\r\n/*  Copyright 2012 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTAUTOH_H__\r\n#define __FTAUTOH_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @section:\r\n   *   auto_hinter\r\n   *\r\n   * @title:\r\n   *   The auto-hinter\r\n   *\r\n   * @abstract:\r\n   *   Controlling the auto-hinting module.\r\n   *\r\n   * @description:\r\n   *   While FreeType's auto-hinter doesn't expose API functions by itself,\r\n   *   it is possible to control its behaviour with @FT_Property_Set and\r\n   *   @FT_Property_Get.  The following lists the available properties\r\n   *   together with the necessary macros and structures.\r\n   *\r\n   *   Note that the auto-hinter's module name is `autofitter' for\r\n   *   historical reasons.\r\n   *\r\n   */\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @property:\r\n   *   glyph-to-script-map\r\n   *\r\n   * @description:\r\n   *   The auto-hinter provides various script modules to hint glyphs.\r\n   *   Examples of supported scripts are Latin or CJK.  Before a glyph is\r\n   *   auto-hinted, the Unicode character map of the font gets examined, and\r\n   *   the script is then determined based on Unicode character ranges, see\r\n   *   below.\r\n   *\r\n   *   OpenType fonts, however, often provide much more glyphs than\r\n   *   character codes (small caps, superscripts, ligatures, swashes, etc.),\r\n   *   to be controlled by so-called `features'.  Handling OpenType features\r\n   *   can be quite complicated and thus needs a separate library on top of\r\n   *   FreeType.\r\n   *\r\n   *   The mapping between glyph indices and scripts (in the auto-hinter\r\n   *   sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an\r\n   *   array with `num_glyphs' elements, as found in the font's @FT_Face\r\n   *   structure.  The `glyph-to-script-map' property returns a pointer to\r\n   *   this array which can be modified as needed.  Note that the\r\n   *   modification should happen before the first glyph gets processed by\r\n   *   the auto-hinter so that the global analysis of the font shapes\r\n   *   actually uses the modified mapping.\r\n   *\r\n   *   The following example code demonstrates how to access it (omitting\r\n   *   the error handling).\r\n   *\r\n   *   {\r\n   *     FT_Library                library;\r\n   *     FT_Face                   face;\r\n   *     FT_Prop_GlyphToScriptMap  prop;\r\n   *\r\n   *\r\n   *     FT_Init_FreeType( &library );\r\n   *     FT_New_Face( library, \"foo.ttf\", 0, &face );\r\n   *\r\n   *     prop.face = face;\r\n   *\r\n   *     FT_Property_Get( library, \"autofitter\",\r\n   *                               \"glyph-to-script-map\", &prop );\r\n   *\r\n   *     // adjust `prop.map' as needed right here\r\n   *\r\n   *     FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );\r\n   *   }\r\n   *\r\n   */\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_AUTOHINTER_SCRIPT_XXX\r\n   *\r\n   * @description:\r\n   *   A list of constants used for the @glyph-to-script-map property to\r\n   *   specify the script submodule the auto-hinter should use for hinting a\r\n   *   particular glyph.\r\n   *\r\n   * @values:\r\n   *   FT_AUTOHINTER_SCRIPT_NONE ::\r\n   *     Don't auto-hint this glyph.\r\n   *\r\n   *   FT_AUTOHINTER_SCRIPT_LATIN ::\r\n   *     Apply the latin auto-hinter.  For the auto-hinter, `latin' is a\r\n   *     very broad term, including Cyrillic and Greek also since characters\r\n   *     from those scripts share the same design constraints.\r\n   *\r\n   *     By default, characters from the following Unicode ranges are\r\n   *     assigned to this submodule.\r\n   *\r\n   *     {\r\n   *       U+0020 - U+007F  // Basic Latin (no control characters)\r\n   *       U+00A0 - U+00FF  // Latin-1 Supplement (no control characters)\r\n   *       U+0100 - U+017F  // Latin Extended-A\r\n   *       U+0180 - U+024F  // Latin Extended-B\r\n   *       U+0250 - U+02AF  // IPA Extensions\r\n   *       U+02B0 - U+02FF  // Spacing Modifier Letters\r\n   *       U+0300 - U+036F  // Combining Diacritical Marks\r\n   *       U+0370 - U+03FF  // Greek and Coptic\r\n   *       U+0400 - U+04FF  // Cyrillic\r\n   *       U+0500 - U+052F  // Cyrillic Supplement\r\n   *       U+1D00 - U+1D7F  // Phonetic Extensions\r\n   *       U+1D80 - U+1DBF  // Phonetic Extensions Supplement\r\n   *       U+1DC0 - U+1DFF  // Combining Diacritical Marks Supplement\r\n   *       U+1E00 - U+1EFF  // Latin Extended Additional\r\n   *       U+1F00 - U+1FFF  // Greek Extended\r\n   *       U+2000 - U+206F  // General Punctuation\r\n   *       U+2070 - U+209F  // Superscripts and Subscripts\r\n   *       U+20A0 - U+20CF  // Currency Symbols\r\n   *       U+2150 - U+218F  // Number Forms\r\n   *       U+2460 - U+24FF  // Enclosed Alphanumerics\r\n   *       U+2C60 - U+2C7F  // Latin Extended-C\r\n   *       U+2DE0 - U+2DFF  // Cyrillic Extended-A\r\n   *       U+2E00 - U+2E7F  // Supplemental Punctuation\r\n   *       U+A640 - U+A69F  // Cyrillic Extended-B\r\n   *       U+A720 - U+A7FF  // Latin Extended-D\r\n   *       U+FB00 - U+FB06  // Alphab. Present. Forms (Latin Ligatures)\r\n   *      U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols\r\n   *      U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement\r\n   *     }\r\n   *\r\n   *   FT_AUTOHINTER_SCRIPT_CJK ::\r\n   *     Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old\r\n   *     Vietnamese, and some other scripts.\r\n   *\r\n   *     By default, characters from the following Unicode ranges are\r\n   *     assigned to this submodule.\r\n   *\r\n   *     {\r\n   *       U+1100 - U+11FF  // Hangul Jamo\r\n   *       U+2E80 - U+2EFF  // CJK Radicals Supplement\r\n   *       U+2F00 - U+2FDF  // Kangxi Radicals\r\n   *       U+2FF0 - U+2FFF  // Ideographic Description Characters\r\n   *       U+3000 - U+303F  // CJK Symbols and Punctuation\r\n   *       U+3040 - U+309F  // Hiragana\r\n   *       U+30A0 - U+30FF  // Katakana\r\n   *       U+3100 - U+312F  // Bopomofo\r\n   *       U+3130 - U+318F  // Hangul Compatibility Jamo\r\n   *       U+3190 - U+319F  // Kanbun\r\n   *       U+31A0 - U+31BF  // Bopomofo Extended\r\n   *       U+31C0 - U+31EF  // CJK Strokes\r\n   *       U+31F0 - U+31FF  // Katakana Phonetic Extensions\r\n   *       U+3200 - U+32FF  // Enclosed CJK Letters and Months\r\n   *       U+3300 - U+33FF  // CJK Compatibility\r\n   *       U+3400 - U+4DBF  // CJK Unified Ideographs Extension A\r\n   *       U+4DC0 - U+4DFF  // Yijing Hexagram Symbols\r\n   *       U+4E00 - U+9FFF  // CJK Unified Ideographs\r\n   *       U+A960 - U+A97F  // Hangul Jamo Extended-A\r\n   *       U+AC00 - U+D7AF  // Hangul Syllables\r\n   *       U+D7B0 - U+D7FF  // Hangul Jamo Extended-B\r\n   *       U+F900 - U+FAFF  // CJK Compatibility Ideographs\r\n   *       U+FE10 - U+FE1F  // Vertical forms\r\n   *       U+FE30 - U+FE4F  // CJK Compatibility Forms\r\n   *       U+FF00 - U+FFEF  // Halfwidth and Fullwidth Forms\r\n   *      U+1B000 - U+1B0FF // Kana Supplement\r\n   *      U+1D300 - U+1D35F // Tai Xuan Hing Symbols\r\n   *      U+1F200 - U+1F2FF // Enclosed Ideographic Supplement\r\n   *      U+20000 - U+2A6DF // CJK Unified Ideographs Extension B\r\n   *      U+2A700 - U+2B73F // CJK Unified Ideographs Extension C\r\n   *      U+2B740 - U+2B81F // CJK Unified Ideographs Extension D\r\n   *      U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement\r\n   *     }\r\n   *\r\n   *   FT_AUTOHINTER_SCRIPT_INDIC ::\r\n   *     Apply the indic auto-hinter, covering all major scripts from the\r\n   *     Indian sub-continent and some other related scripts like Thai, Lao,\r\n   *     or Tibetan.\r\n   *\r\n   *     By default, characters from the following Unicode ranges are\r\n   *     assigned to this submodule.\r\n   *\r\n   *     {\r\n   *       U+0900 - U+0DFF  // Indic Range\r\n   *       U+0F00 - U+0FFF  // Tibetan\r\n   *       U+1900 - U+194F  // Limbu\r\n   *       U+1B80 - U+1BBF  // Sundanese\r\n   *       U+1C80 - U+1CDF  // Meetei Mayak\r\n   *       U+A800 - U+A82F  // Syloti Nagri \r\n   *      U+11800 - U+118DF // Sharada\r\n   *     }\r\n   *\r\n   *     Note that currently Indic support is rudimentary only, missing blue\r\n   *     zone support.\r\n   *\r\n   */\r\n#define FT_AUTOHINTER_SCRIPT_NONE   0\r\n#define FT_AUTOHINTER_SCRIPT_LATIN  1\r\n#define FT_AUTOHINTER_SCRIPT_CJK    2\r\n#define FT_AUTOHINTER_SCRIPT_INDIC  3\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Prop_GlyphToScriptMap\r\n   *\r\n   * @description:\r\n   *   The data exchange structure for the @glyph-to-script-map property.\r\n   *\r\n   */\r\n   typedef struct  FT_Prop_GlyphToScriptMap_\r\n   {\r\n     FT_Face   face;\r\n     FT_Byte*  map;\r\n\r\n   } FT_Prop_GlyphToScriptMap;\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @property:\r\n   *   fallback-script\r\n   *\r\n   * @description:\r\n   *   If no auto-hinter script module can be assigned to a glyph, a\r\n   *   fallback script gets assigned to it (see also the\r\n   *   @glyph-to-script-map property).  By default, this is\r\n   *   @FT_AUTOHINTER_SCRIPT_CJK.  Using the `fallback-script' property,\r\n   *   this fallback value can be changed.\r\n   *\r\n   *   {\r\n   *     FT_Library  library;\r\n   *     FT_UInt     fallback_script = FT_AUTOHINTER_SCRIPT_NONE;\r\n   *\r\n   *\r\n   *     FT_Init_FreeType( &library );\r\n   *\r\n   *     FT_Property_Set( library, \"autofitter\",\r\n   *                               \"fallback-script\", &fallback_script );\r\n   *   }\r\n   *\r\n   * @note:\r\n   *   This property can be used with @FT_Property_Get also.\r\n   *\r\n   *   It's important to use the right timing for changing this value: The\r\n   *   creation of the glyph-to-script map which eventually uses the\r\n   *   fallback script value gets triggered either by setting or reading a\r\n   *   face-specific property like @glyph-to-script-map, or by auto-hinting\r\n   *   any glyph from that face.  In particular, if you have already created\r\n   *   an @FT_Face structure but not loaded any glyph (using the\r\n   *   auto-hinter), a change of the fallback glyph will affect this face.\r\n   *\r\n   */\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @property:\r\n   *   increase-x-height\r\n   *\r\n   * @description:\r\n   *   For ppem values in the range 6~<= ppem <= `increase-x-height', round\r\n   *   up the font's x~height much more often than normally.  If the value\r\n   *   is set to~0, which is the default, this feature is switched off.  Use\r\n   *   this property to improve the legibility of small font sizes if\r\n   *   necessary.\r\n   *\r\n   *   {\r\n   *     FT_Library               library;\r\n   *     FT_Face                  face;\r\n   *     FT_Prop_IncreaseXHeight  prop;\r\n   *\r\n   *\r\n   *     FT_Init_FreeType( &library );\r\n   *     FT_New_Face( library, \"foo.ttf\", 0, &face );\r\n   *     FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );\r\n   *\r\n   *     prop.face  = face;\r\n   *     prop.limit = 14;\r\n   *\r\n   *     FT_Property_Set( library, \"autofitter\",\r\n   *                               \"increase-x-height\", &prop );\r\n   *   }\r\n   *\r\n   * @note:\r\n   *   This property can be used with @FT_Property_Get also.\r\n   *\r\n   *   Set this value right after calling @FT_Set_Char_Size, but before\r\n   *   loading any glyph (using the auto-hinter).\r\n   *\r\n   */\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Prop_IncreaseXHeight\r\n   *\r\n   * @description:\r\n   *   The data exchange structure for the @increase-x-height property.\r\n   *\r\n   */\r\n   typedef struct  FT_Prop_IncreaseXHeight_\r\n   {\r\n     FT_Face  face;\r\n     FT_UInt  limit;\r\n\r\n   } FT_Prop_IncreaseXHeight;\r\n\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTAUTOH_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftbbox.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbbox.h                                                               */\r\n/*                                                                         */\r\n/*    FreeType exact bbox computation (specification).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2007, 2011 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This component has a _single_ role: to compute exact outline bounding */\r\n  /* boxes.                                                                */\r\n  /*                                                                       */\r\n  /* It is separated from the rest of the engine for various technical     */\r\n  /* reasons.  It may well be integrated in `ftoutln' later.               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTBBOX_H__\r\n#define __FTBBOX_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    outline_processing                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Get_BBox                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Compute the exact bounding box of an outline.  This is slower      */\r\n  /*    than computing the control box.  However, it uses an advanced      */\r\n  /*    algorithm which returns _very_ quickly when the two boxes          */\r\n  /*    coincide.  Otherwise, the outline Bézier arcs are traversed to     */\r\n  /*    extract their extrema.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline :: A pointer to the source outline.                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    abbox   :: The outline's exact bounding box.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If the font is tricky and the glyph has been loaded with           */\r\n  /*    @FT_LOAD_NO_SCALE, the resulting BBox is meaningless.  To get      */\r\n  /*    reasonable values for the BBox it is necessary to load the glyph   */\r\n  /*    at a large ppem value (so that the hinting instructions can        */\r\n  /*    properly shift and scale the subglyphs), then extracting the BBox  */\r\n  /*    which can be eventually converted back to font units.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Get_BBox( FT_Outline*  outline,\r\n                       FT_BBox     *abbox );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBBOX_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftbdf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbdf.h                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing BDF-specific strings (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006, 2009 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTBDF_H__\r\n#define __FTBDF_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    bdf_fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    BDF and PCF Files                                                  */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    BDF and PCF specific API.                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of functions specific to BDF */\r\n  /*    and PCF fonts.                                                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @enum:\r\n   *    FT_PropertyType\r\n   *\r\n   * @description:\r\n   *    A list of BDF property types.\r\n   *\r\n   * @values:\r\n   *    BDF_PROPERTY_TYPE_NONE ::\r\n   *      Value~0 is used to indicate a missing property.\r\n   *\r\n   *    BDF_PROPERTY_TYPE_ATOM ::\r\n   *      Property is a string atom.\r\n   *\r\n   *    BDF_PROPERTY_TYPE_INTEGER ::\r\n   *      Property is a 32-bit signed integer.\r\n   *\r\n   *    BDF_PROPERTY_TYPE_CARDINAL ::\r\n   *      Property is a 32-bit unsigned integer.\r\n   */\r\n  typedef enum  BDF_PropertyType_\r\n  {\r\n    BDF_PROPERTY_TYPE_NONE     = 0,\r\n    BDF_PROPERTY_TYPE_ATOM     = 1,\r\n    BDF_PROPERTY_TYPE_INTEGER  = 2,\r\n    BDF_PROPERTY_TYPE_CARDINAL = 3\r\n\r\n  } BDF_PropertyType;\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @type:\r\n   *    BDF_Property\r\n   *\r\n   * @description:\r\n   *    A handle to a @BDF_PropertyRec structure to model a given\r\n   *    BDF/PCF property.\r\n   */\r\n  typedef struct BDF_PropertyRec_*  BDF_Property;\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @struct:\r\n  *    BDF_PropertyRec\r\n  *\r\n  * @description:\r\n  *    This structure models a given BDF/PCF property.\r\n  *\r\n  * @fields:\r\n  *    type ::\r\n  *      The property type.\r\n  *\r\n  *    u.atom ::\r\n  *      The atom string, if type is @BDF_PROPERTY_TYPE_ATOM.\r\n  *\r\n  *    u.integer ::\r\n  *      A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.\r\n  *\r\n  *    u.cardinal ::\r\n  *      An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.\r\n  */\r\n  typedef struct  BDF_PropertyRec_\r\n  {\r\n    BDF_PropertyType  type;\r\n    union {\r\n      const char*     atom;\r\n      FT_Int32        integer;\r\n      FT_UInt32       cardinal;\r\n\r\n    } u;\r\n\r\n  } BDF_PropertyRec;\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_BDF_Charset_ID\r\n  *\r\n  * @description:\r\n  *    Retrieve a BDF font character set identity, according to\r\n  *    the BDF specification.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  * @output:\r\n  *    acharset_encoding ::\r\n  *       Charset encoding, as a C~string, owned by the face.\r\n  *\r\n  *    acharset_registry ::\r\n  *       Charset registry, as a C~string, owned by the face.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function only works with BDF faces, returning an error otherwise.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_BDF_Charset_ID( FT_Face       face,\r\n                         const char*  *acharset_encoding,\r\n                         const char*  *acharset_registry );\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_BDF_Property\r\n  *\r\n  * @description:\r\n  *    Retrieve a BDF property from a BDF or PCF font file.\r\n  *\r\n  * @input:\r\n  *    face :: A handle to the input face.\r\n  *\r\n  *    name :: The property name.\r\n  *\r\n  * @output:\r\n  *    aproperty :: The property.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function works with BDF _and_ PCF fonts.  It returns an error\r\n  *   otherwise.  It also returns an error if the property is not in the\r\n  *   font.\r\n  *\r\n  *   A `property' is a either key-value pair within the STARTPROPERTIES\r\n  *   ... ENDPROPERTIES block of a BDF font or a key-value pair from the\r\n  *   `info->props' array within a `FontRec' structure of a PCF font.\r\n  *\r\n  *   Integer properties are always stored as `signed' within PCF fonts;\r\n  *   consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value\r\n  *   for BDF fonts only.\r\n  *\r\n  *   In case of error, `aproperty->type' is always set to\r\n  *   @BDF_PROPERTY_TYPE_NONE.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_BDF_Property( FT_Face           face,\r\n                       const char*       prop_name,\r\n                       BDF_PropertyRec  *aproperty );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBDF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftbitmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbitmap.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType utility functions for bitmaps (specification).              */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2008 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTBITMAP_H__\r\n#define __FTBITMAP_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    bitmap_handling                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Bitmap Handling                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Handling FT_Bitmap objects.                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains functions for converting FT_Bitmap objects.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_New                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a pointer to an @FT_Bitmap structure.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    abitmap :: A pointer to the bitmap structure.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Bitmap_New( FT_Bitmap  *abitmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Copy                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Copy a bitmap into another one.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a library object.                           */\r\n  /*                                                                       */\r\n  /*    source  :: A handle to the source bitmap.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target  :: A handle to the target bitmap.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Copy( FT_Library        library,\r\n                  const FT_Bitmap  *source,\r\n                  FT_Bitmap        *target);\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Embolden                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Embolden a bitmap.  The new bitmap will be about `xStrength'       */\r\n  /*    pixels wider and `yStrength' pixels higher.  The left and bottom   */\r\n  /*    borders are kept unchanged.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library   :: A handle to a library object.                         */\r\n  /*                                                                       */\r\n  /*    xStrength :: How strong the glyph is emboldened horizontally.      */\r\n  /*                 Expressed in 26.6 pixel format.                       */\r\n  /*                                                                       */\r\n  /*    yStrength :: How strong the glyph is emboldened vertically.        */\r\n  /*                 Expressed in 26.6 pixel format.                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    bitmap    :: A handle to the target bitmap.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The current implementation restricts `xStrength' to be less than   */\r\n  /*    or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.      */\r\n  /*                                                                       */\r\n  /*    If you want to embolden the bitmap owned by a @FT_GlyphSlotRec,    */\r\n  /*    you should call @FT_GlyphSlot_Own_Bitmap on the slot first.        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Embolden( FT_Library  library,\r\n                      FT_Bitmap*  bitmap,\r\n                      FT_Pos      xStrength,\r\n                      FT_Pos      yStrength );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Convert                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a  */\r\n  /*    bitmap object with depth 8bpp, making the number of used bytes per */\r\n  /*    line (a.k.a. the `pitch') a multiple of `alignment'.               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library   :: A handle to a library object.                         */\r\n  /*                                                                       */\r\n  /*    source    :: The source bitmap.                                    */\r\n  /*                                                                       */\r\n  /*    alignment :: The pitch of the bitmap is a multiple of this         */\r\n  /*                 parameter.  Common values are 1, 2, or 4.             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target    :: The target bitmap.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    It is possible to call @FT_Bitmap_Convert multiple times without   */\r\n  /*    calling @FT_Bitmap_Done (the memory is simply reallocated).        */\r\n  /*                                                                       */\r\n  /*    Use @FT_Bitmap_Done to finally remove the bitmap object.           */\r\n  /*                                                                       */\r\n  /*    The `library' argument is taken to have access to FreeType's       */\r\n  /*    memory handling functions.                                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Convert( FT_Library        library,\r\n                     const FT_Bitmap  *source,\r\n                     FT_Bitmap        *target,\r\n                     FT_Int            alignment );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GlyphSlot_Own_Bitmap                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Make sure that a glyph slot owns `slot->bitmap'.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot :: The glyph slot.                                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is to be used in combination with                    */\r\n  /*    @FT_Bitmap_Embolden.                                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Done                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a bitmap object created with @FT_Bitmap_New.               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a library object.                           */\r\n  /*                                                                       */\r\n  /*    bitmap  :: The bitmap object to be freed.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `library' argument is taken to have access to FreeType's       */\r\n  /*    memory handling functions.                                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Done( FT_Library  library,\r\n                  FT_Bitmap  *bitmap );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBITMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftbzip2.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbzip2.h                                                              */\r\n/*                                                                         */\r\n/*    Bzip2-compressed stream support.                                     */\r\n/*                                                                         */\r\n/*  Copyright 2010 by                                                      */\r\n/*  Joel Klinghed.                                                         */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTBZIP2_H__\r\n#define __FTBZIP2_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    bzip2                                                              */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    BZIP2 Streams                                                      */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Using bzip2-compressed font files.                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of Bzip2-specific functions. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Stream_OpenBzip2\r\n  *\r\n  * @description:\r\n  *   Open a new stream to parse bzip2-compressed font files.  This is\r\n  *   mainly used to support the compressed `*.pcf.bz2' fonts that come\r\n  *   with XFree86.\r\n  *\r\n  * @input:\r\n  *   stream ::\r\n  *     The target embedding stream.\r\n  *\r\n  *   source ::\r\n  *     The source stream.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   The source stream must be opened _before_ calling this function.\r\n  *\r\n  *   Calling the internal function `FT_Stream_Close' on the new stream will\r\n  *   *not* call `FT_Stream_Close' on the source stream.  None of the stream\r\n  *   objects will be released to the heap.\r\n  *\r\n  *   The stream implementation is very basic and resets the decompression\r\n  *   process each time seeking backwards is needed within the stream.\r\n  *\r\n  *   In certain builds of the library, bzip2 compression recognition is\r\n  *   automatically handled when calling @FT_New_Face or @FT_Open_Face.\r\n  *   This means that if no font driver is capable of handling the raw\r\n  *   compressed file, the library will try to open a bzip2 compressed stream\r\n  *   from it and re-open the face with it.\r\n  *\r\n  *   This function may return `FT_Err_Unimplemented_Feature' if your build\r\n  *   of FreeType was not compiled with bzip2 support.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stream_OpenBzip2( FT_Stream  stream,\r\n                       FT_Stream  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBZIP2_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftcache.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcache.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType Cache subsystem (specification).                            */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCACHE_H__\r\n#define __FTCACHE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_GLYPH_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * <Section>\r\n   *    cache_subsystem\r\n   *\r\n   * <Title>\r\n   *    Cache Sub-System\r\n   *\r\n   * <Abstract>\r\n   *    How to cache face, size, and glyph data with FreeType~2.\r\n   *\r\n   * <Description>\r\n   *   This section describes the FreeType~2 cache sub-system, which is used\r\n   *   to limit the number of concurrently opened @FT_Face and @FT_Size\r\n   *   objects, as well as caching information like character maps and glyph\r\n   *   images while limiting their maximum memory usage.\r\n   *\r\n   *   Note that all types and functions begin with the `FTC_' prefix.\r\n   *\r\n   *   The cache is highly portable and thus doesn't know anything about the\r\n   *   fonts installed on your system, or how to access them.  This implies\r\n   *   the following scheme:\r\n   *\r\n   *   First, available or installed font faces are uniquely identified by\r\n   *   @FTC_FaceID values, provided to the cache by the client.  Note that\r\n   *   the cache only stores and compares these values, and doesn't try to\r\n   *   interpret them in any way.\r\n   *\r\n   *   Second, the cache calls, only when needed, a client-provided function\r\n   *   to convert an @FTC_FaceID into a new @FT_Face object.  The latter is\r\n   *   then completely managed by the cache, including its termination\r\n   *   through @FT_Done_Face.  To monitor termination of face objects, the\r\n   *   finalizer callback in the `generic' field of the @FT_Face object can\r\n   *   be used, which might also be used to store the @FTC_FaceID of the\r\n   *   face.\r\n   *\r\n   *   Clients are free to map face IDs to anything else.  The most simple\r\n   *   usage is to associate them to a (pathname,face_index) pair that is\r\n   *   used to call @FT_New_Face.  However, more complex schemes are also\r\n   *   possible.\r\n   *\r\n   *   Note that for the cache to work correctly, the face ID values must be\r\n   *   *persistent*, which means that the contents they point to should not\r\n   *   change at runtime, or that their value should not become invalid.\r\n   *\r\n   *   If this is unavoidable (e.g., when a font is uninstalled at runtime),\r\n   *   you should call @FTC_Manager_RemoveFaceID as soon as possible, to let\r\n   *   the cache get rid of any references to the old @FTC_FaceID it may\r\n   *   keep internally.  Failure to do so will lead to incorrect behaviour\r\n   *   or even crashes.\r\n   *\r\n   *   To use the cache, start with calling @FTC_Manager_New to create a new\r\n   *   @FTC_Manager object, which models a single cache instance.  You can\r\n   *   then look up @FT_Face and @FT_Size objects with\r\n   *   @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.\r\n   *\r\n   *   If you want to use the charmap caching, call @FTC_CMapCache_New, then\r\n   *   later use @FTC_CMapCache_Lookup to perform the equivalent of\r\n   *   @FT_Get_Char_Index, only much faster.\r\n   *\r\n   *   If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then\r\n   *   later use @FTC_ImageCache_Lookup to retrieve the corresponding\r\n   *   @FT_Glyph objects from the cache.\r\n   *\r\n   *   If you need lots of small bitmaps, it is much more memory efficient\r\n   *   to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup.  This\r\n   *   returns @FTC_SBitRec structures, which are used to store small\r\n   *   bitmaps directly.  (A small bitmap is one whose metrics and\r\n   *   dimensions all fit into 8-bit integers).\r\n   *\r\n   *   We hope to also provide a kerning cache in the near future.\r\n   *\r\n   *\r\n   * <Order>\r\n   *   FTC_Manager\r\n   *   FTC_FaceID\r\n   *   FTC_Face_Requester\r\n   *\r\n   *   FTC_Manager_New\r\n   *   FTC_Manager_Reset\r\n   *   FTC_Manager_Done\r\n   *   FTC_Manager_LookupFace\r\n   *   FTC_Manager_LookupSize\r\n   *   FTC_Manager_RemoveFaceID\r\n   *\r\n   *   FTC_Node\r\n   *   FTC_Node_Unref\r\n   *\r\n   *   FTC_ImageCache\r\n   *   FTC_ImageCache_New\r\n   *   FTC_ImageCache_Lookup\r\n   *\r\n   *   FTC_SBit\r\n   *   FTC_SBitCache\r\n   *   FTC_SBitCache_New\r\n   *   FTC_SBitCache_Lookup\r\n   *\r\n   *   FTC_CMapCache\r\n   *   FTC_CMapCache_New\r\n   *   FTC_CMapCache_Lookup\r\n   *\r\n   *************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    BASIC TYPE DEFINITIONS                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type: FTC_FaceID\r\n   *\r\n   * @description:\r\n   *   An opaque pointer type that is used to identity face objects.  The\r\n   *   contents of such objects is application-dependent.\r\n   *\r\n   *   These pointers are typically used to point to a user-defined\r\n   *   structure containing a font file path, and face index.\r\n   *\r\n   * @note:\r\n   *   Never use NULL as a valid @FTC_FaceID.\r\n   *\r\n   *   Face IDs are passed by the client to the cache manager, which calls,\r\n   *   when needed, the @FTC_Face_Requester to translate them into new\r\n   *   @FT_Face objects.\r\n   *\r\n   *   If the content of a given face ID changes at runtime, or if the value\r\n   *   becomes invalid (e.g., when uninstalling a font), you should\r\n   *   immediately call @FTC_Manager_RemoveFaceID before any other cache\r\n   *   function.\r\n   *\r\n   *   Failure to do so will result in incorrect behaviour or even\r\n   *   memory leaks and crashes.\r\n   */\r\n  typedef FT_Pointer  FTC_FaceID;\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FTC_Face_Requester\r\n   *\r\n   * @description:\r\n   *   A callback function provided by client applications.  It is used by\r\n   *   the cache manager to translate a given @FTC_FaceID into a new valid\r\n   *   @FT_Face object, on demand.\r\n   *\r\n   * <Input>\r\n   *   face_id ::\r\n   *     The face ID to resolve.\r\n   *\r\n   *   library ::\r\n   *     A handle to a FreeType library object.\r\n   *\r\n   *   req_data ::\r\n   *     Application-provided request data (see note below).\r\n   *\r\n   * <Output>\r\n   *   aface ::\r\n   *     A new @FT_Face handle.\r\n   *\r\n   * <Return>\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * <Note>\r\n   *   The third parameter `req_data' is the same as the one passed by the\r\n   *   client when @FTC_Manager_New is called.\r\n   *\r\n   *   The face requester should not perform funny things on the returned\r\n   *   face object, like creating a new @FT_Size for it, or setting a\r\n   *   transformation through @FT_Set_Transform!\r\n   */\r\n  typedef FT_Error\r\n  (*FTC_Face_Requester)( FTC_FaceID  face_id,\r\n                         FT_Library  library,\r\n                         FT_Pointer  request_data,\r\n                         FT_Face*    aface );\r\n\r\n /* */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /* these macros are incompatible with LLP64, should not be used */\r\n\r\n#define FT_POINTER_TO_ULONG( p )  ( (FT_ULong)(FT_Pointer)(p) )\r\n\r\n#define FTC_FACE_ID_HASH( i )                                \\\r\n          ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^   \\\r\n                       ( FT_POINTER_TO_ULONG( i ) << 7 ) ) )\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      CACHE MANAGER OBJECT                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_Manager                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This object corresponds to one instance of the cache-subsystem.    */\r\n  /*    It is used to cache one or more @FT_Face objects, along with       */\r\n  /*    corresponding @FT_Size objects.                                    */\r\n  /*                                                                       */\r\n  /*    The manager intentionally limits the total number of opened        */\r\n  /*    @FT_Face and @FT_Size objects to control memory usage.  See the    */\r\n  /*    `max_faces' and `max_sizes' parameters of @FTC_Manager_New.        */\r\n  /*                                                                       */\r\n  /*    The manager is also used to cache `nodes' of various types while   */\r\n  /*    limiting their total memory usage.                                 */\r\n  /*                                                                       */\r\n  /*    All limitations are enforced by keeping lists of managed objects   */\r\n  /*    in most-recently-used order, and flushing old nodes to make room   */\r\n  /*    for new ones.                                                      */\r\n  /*                                                                       */\r\n  typedef struct FTC_ManagerRec_*  FTC_Manager;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_Node                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to a cache node object.  Each cache node is       */\r\n  /*    reference-counted.  A node with a count of~0 might be flushed      */\r\n  /*    out of a full cache whenever a lookup request is performed.        */\r\n  /*                                                                       */\r\n  /*    If you look up nodes, you have the ability to `acquire' them,      */\r\n  /*    i.e., to increment their reference count.  This will prevent the   */\r\n  /*    node from being flushed out of the cache until you explicitly      */\r\n  /*    `release' it (see @FTC_Node_Unref).                                */\r\n  /*                                                                       */\r\n  /*    See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup.         */\r\n  /*                                                                       */\r\n  typedef struct FTC_NodeRec_*  FTC_Node;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_New                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new cache manager.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library   :: The parent FreeType library handle to use.            */\r\n  /*                                                                       */\r\n  /*    max_faces :: Maximum number of opened @FT_Face objects managed by  */\r\n  /*                 this cache instance.  Use~0 for defaults.             */\r\n  /*                                                                       */\r\n  /*    max_sizes :: Maximum number of opened @FT_Size objects managed by  */\r\n  /*                 this cache instance.  Use~0 for defaults.             */\r\n  /*                                                                       */\r\n  /*    max_bytes :: Maximum number of bytes to use for cached data nodes. */\r\n  /*                 Use~0 for defaults.  Note that this value does not    */\r\n  /*                 account for managed @FT_Face and @FT_Size objects.    */\r\n  /*                                                                       */\r\n  /*    requester :: An application-provided callback used to translate    */\r\n  /*                 face IDs into real @FT_Face objects.                  */\r\n  /*                                                                       */\r\n  /*    req_data  :: A generic pointer that is passed to the requester     */\r\n  /*                 each time it is called (see @FTC_Face_Requester).     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amanager  :: A handle to a new manager object.  0~in case of       */\r\n  /*                 failure.                                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_New( FT_Library          library,\r\n                   FT_UInt             max_faces,\r\n                   FT_UInt             max_sizes,\r\n                   FT_ULong            max_bytes,\r\n                   FTC_Face_Requester  requester,\r\n                   FT_Pointer          req_data,\r\n                   FTC_Manager        *amanager );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_Reset                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Empty a given cache manager.  This simply gets rid of all the      */\r\n  /*    currently cached @FT_Face and @FT_Size objects within the manager. */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    manager :: A handle to the manager.                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FTC_Manager_Reset( FTC_Manager  manager );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_Done                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a given manager after emptying it.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the target cache manager object.            */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FTC_Manager_Done( FTC_Manager  manager );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_LookupFace                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the @FT_Face object that corresponds to a given face ID   */\r\n  /*    through a cache manager.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the cache manager.                          */\r\n  /*                                                                       */\r\n  /*    face_id :: The ID of the face object.                              */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface   :: A handle to the face object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned @FT_Face object is always owned by the manager.  You  */\r\n  /*    should never try to discard it yourself.                           */\r\n  /*                                                                       */\r\n  /*    The @FT_Face object doesn't necessarily have a current size object */\r\n  /*    (i.e., face->size can be 0).  If you need a specific `font size',  */\r\n  /*    use @FTC_Manager_LookupSize instead.                               */\r\n  /*                                                                       */\r\n  /*    Never change the face's transformation matrix (i.e., never call    */\r\n  /*    the @FT_Set_Transform function) on a returned face!  If you need   */\r\n  /*    to transform glyphs, do it yourself after glyph loading.           */\r\n  /*                                                                       */\r\n  /*    When you perform a lookup, out-of-memory errors are detected       */\r\n  /*    _within_ the lookup and force incremental flushes of the cache     */\r\n  /*    until enough memory is released for the lookup to succeed.         */\r\n  /*                                                                       */\r\n  /*    If a lookup fails with `FT_Err_Out_Of_Memory' the cache has        */\r\n  /*    already been completely flushed, and still no memory was available */\r\n  /*    for the operation.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_LookupFace( FTC_Manager  manager,\r\n                          FTC_FaceID   face_id,\r\n                          FT_Face     *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_ScalerRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to describe a given character size in either      */\r\n  /*    pixels or points to the cache manager.  See                        */\r\n  /*    @FTC_Manager_LookupSize.                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face_id :: The source face ID.                                     */\r\n  /*                                                                       */\r\n  /*    width   :: The character width.                                    */\r\n  /*                                                                       */\r\n  /*    height  :: The character height.                                   */\r\n  /*                                                                       */\r\n  /*    pixel   :: A Boolean.  If 1, the `width' and `height' fields are   */\r\n  /*               interpreted as integer pixel character sizes.           */\r\n  /*               Otherwise, they are expressed as 1/64th of points.      */\r\n  /*                                                                       */\r\n  /*    x_res   :: Only used when `pixel' is value~0 to indicate the       */\r\n  /*               horizontal resolution in dpi.                           */\r\n  /*                                                                       */\r\n  /*    y_res   :: Only used when `pixel' is value~0 to indicate the       */\r\n  /*               vertical resolution in dpi.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This type is mainly used to retrieve @FT_Size objects through the  */\r\n  /*    cache manager.                                                     */\r\n  /*                                                                       */\r\n  typedef struct  FTC_ScalerRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_UInt     width;\r\n    FT_UInt     height;\r\n    FT_Int      pixel;\r\n    FT_UInt     x_res;\r\n    FT_UInt     y_res;\r\n\r\n  } FTC_ScalerRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_Scaler                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an @FTC_ScalerRec structure.                           */\r\n  /*                                                                       */\r\n  typedef struct FTC_ScalerRec_*  FTC_Scaler;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_LookupSize                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the @FT_Size object that corresponds to a given           */\r\n  /*    @FTC_ScalerRec pointer through a cache manager.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the cache manager.                          */\r\n  /*                                                                       */\r\n  /*    scaler  :: A scaler handle.                                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    asize   :: A handle to the size object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned @FT_Size object is always owned by the manager.  You  */\r\n  /*    should never try to discard it by yourself.                        */\r\n  /*                                                                       */\r\n  /*    You can access the parent @FT_Face object simply as `size->face'   */\r\n  /*    if you need it.  Note that this object is also owned by the        */\r\n  /*    manager.                                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    When you perform a lookup, out-of-memory errors are detected       */\r\n  /*    _within_ the lookup and force incremental flushes of the cache     */\r\n  /*    until enough memory is released for the lookup to succeed.         */\r\n  /*                                                                       */\r\n  /*    If a lookup fails with `FT_Err_Out_Of_Memory' the cache has        */\r\n  /*    already been completely flushed, and still no memory is available  */\r\n  /*    for the operation.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_LookupSize( FTC_Manager  manager,\r\n                          FTC_Scaler   scaler,\r\n                          FT_Size     *asize );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Node_Unref                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Decrement a cache node's internal reference count.  When the count */\r\n  /*    reaches 0, it is not destroyed but becomes eligible for subsequent */\r\n  /*    cache flushes.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    node    :: The cache node handle.                                  */\r\n  /*                                                                       */\r\n  /*    manager :: The cache manager handle.                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FTC_Node_Unref( FTC_Node     node,\r\n                  FTC_Manager  manager );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FTC_Manager_RemoveFaceID\r\n   *\r\n   * @description:\r\n   *   A special function used to indicate to the cache manager that\r\n   *   a given @FTC_FaceID is no longer valid, either because its\r\n   *   content changed, or because it was deallocated or uninstalled.\r\n   *\r\n   * @input:\r\n   *   manager ::\r\n   *     The cache manager handle.\r\n   *\r\n   *   face_id ::\r\n   *     The @FTC_FaceID to be removed.\r\n   *\r\n   * @note:\r\n   *   This function flushes all nodes from the cache corresponding to this\r\n   *   `face_id', with the exception of nodes with a non-null reference\r\n   *   count.\r\n   *\r\n   *   Such nodes are however modified internally so as to never appear\r\n   *   in later lookups with the same `face_id' value, and to be immediately\r\n   *   destroyed when released by all their users.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FTC_Manager_RemoveFaceID( FTC_Manager  manager,\r\n                            FTC_FaceID   face_id );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cache_subsystem                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FTC_CMapCache\r\n   *\r\n   * @description:\r\n   *   An opaque handle used to model a charmap cache.  This cache is to\r\n   *   hold character codes -> glyph indices mappings.\r\n   *\r\n   */\r\n  typedef struct FTC_CMapCacheRec_*  FTC_CMapCache;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FTC_CMapCache_New\r\n   *\r\n   * @description:\r\n   *   Create a new charmap cache.\r\n   *\r\n   * @input:\r\n   *   manager ::\r\n   *     A handle to the cache manager.\r\n   *\r\n   * @output:\r\n   *   acache ::\r\n   *     A new cache handle.  NULL in case of error.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   Like all other caches, this one will be destroyed with the cache\r\n   *   manager.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_CMapCache_New( FTC_Manager     manager,\r\n                     FTC_CMapCache  *acache );\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *   FTC_CMapCache_Lookup\r\n   *\r\n   * @description:\r\n   *   Translate a character code into a glyph index, using the charmap\r\n   *   cache.\r\n   *\r\n   * @input:\r\n   *   cache ::\r\n   *     A charmap cache handle.\r\n   *\r\n   *   face_id ::\r\n   *     The source face ID.\r\n   *\r\n   *   cmap_index ::\r\n   *     The index of the charmap in the source face.  Any negative value\r\n   *     means to use the cache @FT_Face's default charmap.\r\n   *\r\n   *   char_code ::\r\n   *     The character code (in the corresponding charmap).\r\n   *\r\n   * @return:\r\n   *    Glyph index.  0~means `no glyph'.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_UInt )\r\n  FTC_CMapCache_Lookup( FTC_CMapCache  cache,\r\n                        FTC_FaceID     face_id,\r\n                        FT_Int         cmap_index,\r\n                        FT_UInt32      char_code );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cache_subsystem                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       IMAGE CACHE OBJECT                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FTC_ImageTypeRec\r\n   *\r\n   * @description:\r\n   *   A structure used to model the type of images in a glyph cache.\r\n   *\r\n   * @fields:\r\n   *   face_id ::\r\n   *     The face ID.\r\n   *\r\n   *   width ::\r\n   *     The width in pixels.\r\n   *\r\n   *   height ::\r\n   *     The height in pixels.\r\n   *\r\n   *   flags ::\r\n   *     The load flags, as in @FT_Load_Glyph.\r\n   *\r\n   */\r\n  typedef struct  FTC_ImageTypeRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_Int      width;\r\n    FT_Int      height;\r\n    FT_Int32    flags;\r\n\r\n  } FTC_ImageTypeRec;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FTC_ImageType\r\n   *\r\n   * @description:\r\n   *   A handle to an @FTC_ImageTypeRec structure.\r\n   *\r\n   */\r\n  typedef struct FTC_ImageTypeRec_*  FTC_ImageType;\r\n\r\n\r\n  /* */\r\n\r\n\r\n#define FTC_IMAGE_TYPE_COMPARE( d1, d2 )      \\\r\n          ( (d1)->face_id == (d2)->face_id && \\\r\n            (d1)->width   == (d2)->width   && \\\r\n            (d1)->flags   == (d2)->flags   )\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /* this macro is incompatible with LLP64, should not be used */\r\n\r\n#define FTC_IMAGE_TYPE_HASH( d )                          \\\r\n          (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id )  ^ \\\r\n                      ( (d)->width << 8 ) ^ (d)->height ^ \\\r\n                      ( (d)->flags << 4 )               )\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_ImageCache                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an glyph image cache object.  They are designed to     */\r\n  /*    hold many distinct glyph images while not exceeding a certain      */\r\n  /*    memory threshold.                                                  */\r\n  /*                                                                       */\r\n  typedef struct FTC_ImageCacheRec_*  FTC_ImageCache;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_ImageCache_New                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new glyph image cache.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: The parent manager for the image cache.                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acache  :: A handle to the new glyph image cache object.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_ImageCache_New( FTC_Manager      manager,\r\n                      FTC_ImageCache  *acache );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_ImageCache_Lookup                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve a given glyph image from a glyph image cache.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache  :: A handle to the source glyph image cache.                */\r\n  /*                                                                       */\r\n  /*    type   :: A pointer to a glyph image type descriptor.              */\r\n  /*                                                                       */\r\n  /*    gindex :: The glyph index to retrieve.                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aglyph :: The corresponding @FT_Glyph object.  0~in case of        */\r\n  /*              failure.                                                 */\r\n  /*                                                                       */\r\n  /*    anode  :: Used to return the address of of the corresponding cache */\r\n  /*              node after incrementing its reference count (see note    */\r\n  /*              below).                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned glyph is owned and managed by the glyph image cache.  */\r\n  /*    Never try to transform or discard it manually!  You can however    */\r\n  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the glyph image, after increasing its reference    */\r\n  /*    count.  This ensures that the node (as well as the @FT_Glyph) will */\r\n  /*    always be kept in the cache until you call @FTC_Node_Unref to      */\r\n  /*    `release' it.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the @FT_Glyph could be flushed out of the cache on the next   */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_ImageCache_Lookup( FTC_ImageCache  cache,\r\n                         FTC_ImageType   type,\r\n                         FT_UInt         gindex,\r\n                         FT_Glyph       *aglyph,\r\n                         FTC_Node       *anode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_ImageCache_LookupScaler                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec    */\r\n  /*    to specify the face ID and its size.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache      :: A handle to the source glyph image cache.            */\r\n  /*                                                                       */\r\n  /*    scaler     :: A pointer to a scaler descriptor.                    */\r\n  /*                                                                       */\r\n  /*    load_flags :: The corresponding load flags.                        */\r\n  /*                                                                       */\r\n  /*    gindex     :: The glyph index to retrieve.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aglyph     :: The corresponding @FT_Glyph object.  0~in case of    */\r\n  /*                  failure.                                             */\r\n  /*                                                                       */\r\n  /*    anode      :: Used to return the address of of the corresponding   */\r\n  /*                  cache node after incrementing its reference count    */\r\n  /*                  (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned glyph is owned and managed by the glyph image cache.  */\r\n  /*    Never try to transform or discard it manually!  You can however    */\r\n  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the glyph image, after increasing its reference    */\r\n  /*    count.  This ensures that the node (as well as the @FT_Glyph) will */\r\n  /*    always be kept in the cache until you call @FTC_Node_Unref to      */\r\n  /*    `release' it.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the @FT_Glyph could be flushed out of the cache on the next   */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  /*    Calls to @FT_Set_Char_Size and friends have no effect on cached    */\r\n  /*    glyphs; you should always use the FreeType cache API instead.      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_ImageCache_LookupScaler( FTC_ImageCache  cache,\r\n                               FTC_Scaler      scaler,\r\n                               FT_ULong        load_flags,\r\n                               FT_UInt         gindex,\r\n                               FT_Glyph       *aglyph,\r\n                               FTC_Node       *anode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_SBit                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a small bitmap descriptor.  See the @FTC_SBitRec       */\r\n  /*    structure for details.                                             */\r\n  /*                                                                       */\r\n  typedef struct FTC_SBitRec_*  FTC_SBit;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_SBitRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very compact structure used to describe a small glyph bitmap.    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    width     :: The bitmap width in pixels.                           */\r\n  /*                                                                       */\r\n  /*    height    :: The bitmap height in pixels.                          */\r\n  /*                                                                       */\r\n  /*    left      :: The horizontal distance from the pen position to the  */\r\n  /*                 left bitmap border (a.k.a. `left side bearing', or    */\r\n  /*                 `lsb').                                               */\r\n  /*                                                                       */\r\n  /*    top       :: The vertical distance from the pen position (on the   */\r\n  /*                 baseline) to the upper bitmap border (a.k.a. `top     */\r\n  /*                 side bearing').  The distance is positive for upwards */\r\n  /*                 y~coordinates.                                        */\r\n  /*                                                                       */\r\n  /*    format    :: The format of the glyph bitmap (monochrome or gray).  */\r\n  /*                                                                       */\r\n  /*    max_grays :: Maximum gray level value (in the range 1 to~255).     */\r\n  /*                                                                       */\r\n  /*    pitch     :: The number of bytes per bitmap line.  May be positive */\r\n  /*                 or negative.                                          */\r\n  /*                                                                       */\r\n  /*    xadvance  :: The horizontal advance width in pixels.               */\r\n  /*                                                                       */\r\n  /*    yadvance  :: The vertical advance height in pixels.                */\r\n  /*                                                                       */\r\n  /*    buffer    :: A pointer to the bitmap pixels.                       */\r\n  /*                                                                       */\r\n  typedef struct  FTC_SBitRec_\r\n  {\r\n    FT_Byte   width;\r\n    FT_Byte   height;\r\n    FT_Char   left;\r\n    FT_Char   top;\r\n\r\n    FT_Byte   format;\r\n    FT_Byte   max_grays;\r\n    FT_Short  pitch;\r\n    FT_Char   xadvance;\r\n    FT_Char   yadvance;\r\n\r\n    FT_Byte*  buffer;\r\n\r\n  } FTC_SBitRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_SBitCache                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a small bitmap cache.  These are special cache objects */\r\n  /*    used to store small glyph bitmaps (and anti-aliased pixmaps) in a  */\r\n  /*    much more efficient way than the traditional glyph image cache     */\r\n  /*    implemented by @FTC_ImageCache.                                    */\r\n  /*                                                                       */\r\n  typedef struct FTC_SBitCacheRec_*  FTC_SBitCache;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_SBitCache_New                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new cache to store small glyph bitmaps.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the source cache manager.                   */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBitCache_New( FTC_Manager     manager,\r\n                     FTC_SBitCache  *acache );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_SBitCache_Lookup                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Look up a given small glyph bitmap in a given sbit cache and       */\r\n  /*    `lock' it to prevent its flushing from the cache until needed.     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache  :: A handle to the source sbit cache.                       */\r\n  /*                                                                       */\r\n  /*    type   :: A pointer to the glyph image type descriptor.            */\r\n  /*                                                                       */\r\n  /*    gindex :: The glyph index.                                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sbit   :: A handle to a small bitmap descriptor.                   */\r\n  /*                                                                       */\r\n  /*    anode  :: Used to return the address of of the corresponding cache */\r\n  /*              node after incrementing its reference count (see note    */\r\n  /*              below).                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The small bitmap descriptor and its bit buffer are owned by the    */\r\n  /*    cache and should never be freed by the application.  They might    */\r\n  /*    as well disappear from memory on the next cache lookup, so don't   */\r\n  /*    treat them as persistent data.                                     */\r\n  /*                                                                       */\r\n  /*    The descriptor's `buffer' field is set to~0 to indicate a missing  */\r\n  /*    glyph bitmap.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the bitmap, after increasing its reference count.  */\r\n  /*    This ensures that the node (as well as the image) will always be   */\r\n  /*    kept in the cache until you call @FTC_Node_Unref to `release' it.  */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the bitmap could be flushed out of the cache on the next      */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBitCache_Lookup( FTC_SBitCache    cache,\r\n                        FTC_ImageType    type,\r\n                        FT_UInt          gindex,\r\n                        FTC_SBit        *sbit,\r\n                        FTC_Node        *anode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_SBitCache_LookupScaler                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec     */\r\n  /*    to specify the face ID and its size.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache      :: A handle to the source sbit cache.                   */\r\n  /*                                                                       */\r\n  /*    scaler     :: A pointer to the scaler descriptor.                  */\r\n  /*                                                                       */\r\n  /*    load_flags :: The corresponding load flags.                        */\r\n  /*                                                                       */\r\n  /*    gindex     :: The glyph index.                                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sbit       :: A handle to a small bitmap descriptor.               */\r\n  /*                                                                       */\r\n  /*    anode      :: Used to return the address of of the corresponding   */\r\n  /*                  cache node after incrementing its reference count    */\r\n  /*                  (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The small bitmap descriptor and its bit buffer are owned by the    */\r\n  /*    cache and should never be freed by the application.  They might    */\r\n  /*    as well disappear from memory on the next cache lookup, so don't   */\r\n  /*    treat them as persistent data.                                     */\r\n  /*                                                                       */\r\n  /*    The descriptor's `buffer' field is set to~0 to indicate a missing  */\r\n  /*    glyph bitmap.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the bitmap, after increasing its reference count.  */\r\n  /*    This ensures that the node (as well as the image) will always be   */\r\n  /*    kept in the cache until you call @FTC_Node_Unref to `release' it.  */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the bitmap could be flushed out of the cache on the next      */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBitCache_LookupScaler( FTC_SBitCache  cache,\r\n                              FTC_Scaler     scaler,\r\n                              FT_ULong       load_flags,\r\n                              FT_UInt        gindex,\r\n                              FTC_SBit      *sbit,\r\n                              FTC_Node      *anode );\r\n\r\n\r\n /* */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*@***********************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_FontRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to describe a given `font' to the cache    */\r\n  /*    manager.  Note that a `font' is the combination of a given face    */\r\n  /*    with a given character size.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face_id    :: The ID of the face to use.                           */\r\n  /*                                                                       */\r\n  /*    pix_width  :: The character width in integer pixels.               */\r\n  /*                                                                       */\r\n  /*    pix_height :: The character height in integer pixels.              */\r\n  /*                                                                       */\r\n  typedef struct  FTC_FontRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_UShort   pix_width;\r\n    FT_UShort   pix_height;\r\n\r\n  } FTC_FontRec;\r\n\r\n\r\n  /* */\r\n\r\n\r\n#define FTC_FONT_COMPARE( f1, f2 )                  \\\r\n          ( (f1)->face_id    == (f2)->face_id    && \\\r\n            (f1)->pix_width  == (f2)->pix_width  && \\\r\n            (f1)->pix_height == (f2)->pix_height )\r\n\r\n  /* this macro is incompatible with LLP64, should not be used */\r\n#define FTC_FONT_HASH( f )                              \\\r\n          (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \\\r\n                       ((f)->pix_width << 8)          ^ \\\r\n                       ((f)->pix_height)              )\r\n\r\n  typedef FTC_FontRec*  FTC_Font;\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_Lookup_Face( FTC_Manager  manager,\r\n                           FTC_FaceID   face_id,\r\n                           FT_Face     *aface );\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_Lookup_Size( FTC_Manager  manager,\r\n                           FTC_Font     font,\r\n                           FT_Face     *aface,\r\n                           FT_Size     *asize );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCACHE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftchapters.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/* This file defines the structure of the FreeType reference.              */\r\n/* It is used by the python script which generates the HTML files.         */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    general_remarks                                                      */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    General Remarks                                                      */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    user_allocation                                                      */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    core_api                                                             */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Core API                                                             */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    version                                                              */\r\n/*    basic_types                                                          */\r\n/*    base_interface                                                       */\r\n/*    glyph_variants                                                       */\r\n/*    glyph_management                                                     */\r\n/*    mac_specific                                                         */\r\n/*    sizes_management                                                     */\r\n/*    header_file_macros                                                   */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    format_specific                                                      */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Format-Specific API                                                  */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    multiple_masters                                                     */\r\n/*    truetype_tables                                                      */\r\n/*    type1_tables                                                         */\r\n/*    sfnt_names                                                           */\r\n/*    bdf_fonts                                                            */\r\n/*    cid_fonts                                                            */\r\n/*    pfr_fonts                                                            */\r\n/*    winfnt_fonts                                                         */\r\n/*    font_formats                                                         */\r\n/*    gasp_table                                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    auto_hinter                                                          */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    The Auto-Hinter                                                      */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    auto_hinter                                                          */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    cache_subsystem                                                      */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Cache Sub-System                                                     */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    cache_subsystem                                                      */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    support_api                                                          */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Support API                                                          */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    computations                                                         */\r\n/*    list_processing                                                      */\r\n/*    outline_processing                                                   */\r\n/*    quick_advance                                                        */\r\n/*    bitmap_handling                                                      */\r\n/*    raster                                                               */\r\n/*    glyph_stroker                                                        */\r\n/*    system_interface                                                     */\r\n/*    module_management                                                    */\r\n/*    gzip                                                                 */\r\n/*    lzw                                                                  */\r\n/*    bzip2                                                                */\r\n/*    lcd_filtering                                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftcid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcid.h                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing CID font information (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal.                  */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCID_H__\r\n#define __FTCID_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cid_fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    CID Fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    CID-keyed font specific API.                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of CID-keyed font specific   */\r\n  /*    functions.                                                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_CID_Registry_Ordering_Supplement\r\n   *\r\n   * @description:\r\n   *    Retrieve the Registry/Ordering/Supplement triple (also known as the\r\n   *    \"R/O/S\") from a CID-keyed font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       A handle to the input face.\r\n   *\r\n   * @output:\r\n   *    registry ::\r\n   *       The registry, as a C~string, owned by the face.\r\n   *\r\n   *    ordering ::\r\n   *       The ordering, as a C~string, owned by the face.\r\n   *\r\n   *    supplement ::\r\n   *       The supplement.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    This function only works with CID faces, returning an error\r\n   *    otherwise.\r\n   *\r\n   * @since:\r\n   *    2.3.6\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_CID_Registry_Ordering_Supplement( FT_Face       face,\r\n                                           const char*  *registry,\r\n                                           const char*  *ordering,\r\n                                           FT_Int       *supplement);\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_CID_Is_Internally_CID_Keyed\r\n   *\r\n   * @description:\r\n   *    Retrieve the type of the input face, CID keyed or not.  In\r\n   *    constrast to the @FT_IS_CID_KEYED macro this function returns\r\n   *    successfully also for CID-keyed fonts in an SNFT wrapper.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       A handle to the input face.\r\n   *\r\n   * @output:\r\n   *    is_cid ::\r\n   *       The type of the face as an @FT_Bool.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    This function only works with CID faces and OpenType fonts,\r\n   *    returning an error otherwise.\r\n   *\r\n   * @since:\r\n   *    2.3.9\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_CID_Is_Internally_CID_Keyed( FT_Face   face,\r\n                                      FT_Bool  *is_cid );\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_CID_From_Glyph_Index\r\n   *\r\n   * @description:\r\n   *    Retrieve the CID of the input glyph index.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       A handle to the input face.\r\n   *\r\n   *    glyph_index ::\r\n   *       The input glyph index.\r\n   *\r\n   * @output:\r\n   *    cid ::\r\n   *       The CID as an @FT_UInt.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    This function only works with CID faces and OpenType fonts,\r\n   *    returning an error otherwise.\r\n   *\r\n   * @since:\r\n   *    2.3.9\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_CID_From_Glyph_Index( FT_Face   face,\r\n                               FT_UInt   glyph_index,\r\n                               FT_UInt  *cid );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/fterrdef.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fterrdef.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType error codes (specification).                                */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2004, 2006, 2007, 2010-2012 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                LIST OF ERROR CODES/MESSAGES             *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n  /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */\r\n  /* including this file.                                           */\r\n\r\n\r\n  /* generic errors */\r\n\r\n  FT_NOERRORDEF_( Ok,                                        0x00, \\\r\n                  \"no error\" )\r\n\r\n  FT_ERRORDEF_( Cannot_Open_Resource,                        0x01, \\\r\n                \"cannot open resource\" )\r\n  FT_ERRORDEF_( Unknown_File_Format,                         0x02, \\\r\n                \"unknown file format\" )\r\n  FT_ERRORDEF_( Invalid_File_Format,                         0x03, \\\r\n                \"broken file\" )\r\n  FT_ERRORDEF_( Invalid_Version,                             0x04, \\\r\n                \"invalid FreeType version\" )\r\n  FT_ERRORDEF_( Lower_Module_Version,                        0x05, \\\r\n                \"module version is too low\" )\r\n  FT_ERRORDEF_( Invalid_Argument,                            0x06, \\\r\n                \"invalid argument\" )\r\n  FT_ERRORDEF_( Unimplemented_Feature,                       0x07, \\\r\n                \"unimplemented feature\" )\r\n  FT_ERRORDEF_( Invalid_Table,                               0x08, \\\r\n                \"broken table\" )\r\n  FT_ERRORDEF_( Invalid_Offset,                              0x09, \\\r\n                \"broken offset within table\" )\r\n  FT_ERRORDEF_( Array_Too_Large,                             0x0A, \\\r\n                \"array allocation size too large\" )\r\n  FT_ERRORDEF_( Missing_Module,                              0x0B, \\\r\n                \"missing module\" )\r\n  FT_ERRORDEF_( Missing_Property,                            0x0C, \\\r\n                \"missing property\" )\r\n\r\n  /* glyph/character errors */\r\n\r\n  FT_ERRORDEF_( Invalid_Glyph_Index,                         0x10, \\\r\n                \"invalid glyph index\" )\r\n  FT_ERRORDEF_( Invalid_Character_Code,                      0x11, \\\r\n                \"invalid character code\" )\r\n  FT_ERRORDEF_( Invalid_Glyph_Format,                        0x12, \\\r\n                \"unsupported glyph image format\" )\r\n  FT_ERRORDEF_( Cannot_Render_Glyph,                         0x13, \\\r\n                \"cannot render this glyph format\" )\r\n  FT_ERRORDEF_( Invalid_Outline,                             0x14, \\\r\n                \"invalid outline\" )\r\n  FT_ERRORDEF_( Invalid_Composite,                           0x15, \\\r\n                \"invalid composite glyph\" )\r\n  FT_ERRORDEF_( Too_Many_Hints,                              0x16, \\\r\n                \"too many hints\" )\r\n  FT_ERRORDEF_( Invalid_Pixel_Size,                          0x17, \\\r\n                \"invalid pixel size\" )\r\n\r\n  /* handle errors */\r\n\r\n  FT_ERRORDEF_( Invalid_Handle,                              0x20, \\\r\n                \"invalid object handle\" )\r\n  FT_ERRORDEF_( Invalid_Library_Handle,                      0x21, \\\r\n                \"invalid library handle\" )\r\n  FT_ERRORDEF_( Invalid_Driver_Handle,                       0x22, \\\r\n                \"invalid module handle\" )\r\n  FT_ERRORDEF_( Invalid_Face_Handle,                         0x23, \\\r\n                \"invalid face handle\" )\r\n  FT_ERRORDEF_( Invalid_Size_Handle,                         0x24, \\\r\n                \"invalid size handle\" )\r\n  FT_ERRORDEF_( Invalid_Slot_Handle,                         0x25, \\\r\n                \"invalid glyph slot handle\" )\r\n  FT_ERRORDEF_( Invalid_CharMap_Handle,                      0x26, \\\r\n                \"invalid charmap handle\" )\r\n  FT_ERRORDEF_( Invalid_Cache_Handle,                        0x27, \\\r\n                \"invalid cache manager handle\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Handle,                       0x28, \\\r\n                \"invalid stream handle\" )\r\n\r\n  /* driver errors */\r\n\r\n  FT_ERRORDEF_( Too_Many_Drivers,                            0x30, \\\r\n                \"too many modules\" )\r\n  FT_ERRORDEF_( Too_Many_Extensions,                         0x31, \\\r\n                \"too many extensions\" )\r\n\r\n  /* memory errors */\r\n\r\n  FT_ERRORDEF_( Out_Of_Memory,                               0x40, \\\r\n                \"out of memory\" )\r\n  FT_ERRORDEF_( Unlisted_Object,                             0x41, \\\r\n                \"unlisted object\" )\r\n\r\n  /* stream errors */\r\n\r\n  FT_ERRORDEF_( Cannot_Open_Stream,                          0x51, \\\r\n                \"cannot open stream\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Seek,                         0x52, \\\r\n                \"invalid stream seek\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Skip,                         0x53, \\\r\n                \"invalid stream skip\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Read,                         0x54, \\\r\n                \"invalid stream read\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Operation,                    0x55, \\\r\n                \"invalid stream operation\" )\r\n  FT_ERRORDEF_( Invalid_Frame_Operation,                     0x56, \\\r\n                \"invalid frame operation\" )\r\n  FT_ERRORDEF_( Nested_Frame_Access,                         0x57, \\\r\n                \"nested frame access\" )\r\n  FT_ERRORDEF_( Invalid_Frame_Read,                          0x58, \\\r\n                \"invalid frame read\" )\r\n\r\n  /* raster errors */\r\n\r\n  FT_ERRORDEF_( Raster_Uninitialized,                        0x60, \\\r\n                \"raster uninitialized\" )\r\n  FT_ERRORDEF_( Raster_Corrupted,                            0x61, \\\r\n                \"raster corrupted\" )\r\n  FT_ERRORDEF_( Raster_Overflow,                             0x62, \\\r\n                \"raster overflow\" )\r\n  FT_ERRORDEF_( Raster_Negative_Height,                      0x63, \\\r\n                \"negative height while rastering\" )\r\n\r\n  /* cache errors */\r\n\r\n  FT_ERRORDEF_( Too_Many_Caches,                             0x70, \\\r\n                \"too many registered caches\" )\r\n\r\n  /* TrueType and SFNT errors */\r\n\r\n  FT_ERRORDEF_( Invalid_Opcode,                              0x80, \\\r\n                \"invalid opcode\" )\r\n  FT_ERRORDEF_( Too_Few_Arguments,                           0x81, \\\r\n                \"too few arguments\" )\r\n  FT_ERRORDEF_( Stack_Overflow,                              0x82, \\\r\n                \"stack overflow\" )\r\n  FT_ERRORDEF_( Code_Overflow,                               0x83, \\\r\n                \"code overflow\" )\r\n  FT_ERRORDEF_( Bad_Argument,                                0x84, \\\r\n                \"bad argument\" )\r\n  FT_ERRORDEF_( Divide_By_Zero,                              0x85, \\\r\n                \"division by zero\" )\r\n  FT_ERRORDEF_( Invalid_Reference,                           0x86, \\\r\n                \"invalid reference\" )\r\n  FT_ERRORDEF_( Debug_OpCode,                                0x87, \\\r\n                \"found debug opcode\" )\r\n  FT_ERRORDEF_( ENDF_In_Exec_Stream,                         0x88, \\\r\n                \"found ENDF opcode in execution stream\" )\r\n  FT_ERRORDEF_( Nested_DEFS,                                 0x89, \\\r\n                \"nested DEFS\" )\r\n  FT_ERRORDEF_( Invalid_CodeRange,                           0x8A, \\\r\n                \"invalid code range\" )\r\n  FT_ERRORDEF_( Execution_Too_Long,                          0x8B, \\\r\n                \"execution context too long\" )\r\n  FT_ERRORDEF_( Too_Many_Function_Defs,                      0x8C, \\\r\n                \"too many function definitions\" )\r\n  FT_ERRORDEF_( Too_Many_Instruction_Defs,                   0x8D, \\\r\n                \"too many instruction definitions\" )\r\n  FT_ERRORDEF_( Table_Missing,                               0x8E, \\\r\n                \"SFNT font table missing\" )\r\n  FT_ERRORDEF_( Horiz_Header_Missing,                        0x8F, \\\r\n                \"horizontal header (hhea) table missing\" )\r\n  FT_ERRORDEF_( Locations_Missing,                           0x90, \\\r\n                \"locations (loca) table missing\" )\r\n  FT_ERRORDEF_( Name_Table_Missing,                          0x91, \\\r\n                \"name table missing\" )\r\n  FT_ERRORDEF_( CMap_Table_Missing,                          0x92, \\\r\n                \"character map (cmap) table missing\" )\r\n  FT_ERRORDEF_( Hmtx_Table_Missing,                          0x93, \\\r\n                \"horizontal metrics (hmtx) table missing\" )\r\n  FT_ERRORDEF_( Post_Table_Missing,                          0x94, \\\r\n                \"PostScript (post) table missing\" )\r\n  FT_ERRORDEF_( Invalid_Horiz_Metrics,                       0x95, \\\r\n                \"invalid horizontal metrics\" )\r\n  FT_ERRORDEF_( Invalid_CharMap_Format,                      0x96, \\\r\n                \"invalid character map (cmap) format\" )\r\n  FT_ERRORDEF_( Invalid_PPem,                                0x97, \\\r\n                \"invalid ppem value\" )\r\n  FT_ERRORDEF_( Invalid_Vert_Metrics,                        0x98, \\\r\n                \"invalid vertical metrics\" )\r\n  FT_ERRORDEF_( Could_Not_Find_Context,                      0x99, \\\r\n                \"could not find context\" )\r\n  FT_ERRORDEF_( Invalid_Post_Table_Format,                   0x9A, \\\r\n                \"invalid PostScript (post) table format\" )\r\n  FT_ERRORDEF_( Invalid_Post_Table,                          0x9B, \\\r\n                \"invalid PostScript (post) table\" )\r\n\r\n  /* CFF, CID, and Type 1 errors */\r\n\r\n  FT_ERRORDEF_( Syntax_Error,                                0xA0, \\\r\n                \"opcode syntax error\" )\r\n  FT_ERRORDEF_( Stack_Underflow,                             0xA1, \\\r\n                \"argument stack underflow\" )\r\n  FT_ERRORDEF_( Ignore,                                      0xA2, \\\r\n                \"ignore\" )\r\n  FT_ERRORDEF_( No_Unicode_Glyph_Name,                       0xA3, \\\r\n                \"no Unicode glyph name found\" )\r\n\r\n  /* BDF errors */\r\n\r\n  FT_ERRORDEF_( Missing_Startfont_Field,                     0xB0, \\\r\n                \"`STARTFONT' field missing\" )\r\n  FT_ERRORDEF_( Missing_Font_Field,                          0xB1, \\\r\n                \"`FONT' field missing\" )\r\n  FT_ERRORDEF_( Missing_Size_Field,                          0xB2, \\\r\n                \"`SIZE' field missing\" )\r\n  FT_ERRORDEF_( Missing_Fontboundingbox_Field,               0xB3, \\\r\n                \"`FONTBOUNDINGBOX' field missing\" )\r\n  FT_ERRORDEF_( Missing_Chars_Field,                         0xB4, \\\r\n                \"`CHARS' field missing\" )\r\n  FT_ERRORDEF_( Missing_Startchar_Field,                     0xB5, \\\r\n                \"`STARTCHAR' field missing\" )\r\n  FT_ERRORDEF_( Missing_Encoding_Field,                      0xB6, \\\r\n                \"`ENCODING' field missing\" )\r\n  FT_ERRORDEF_( Missing_Bbx_Field,                           0xB7, \\\r\n                \"`BBX' field missing\" )\r\n  FT_ERRORDEF_( Bbx_Too_Big,                                 0xB8, \\\r\n                \"`BBX' too big\" )\r\n  FT_ERRORDEF_( Corrupted_Font_Header,                       0xB9, \\\r\n                \"Font header corrupted or missing fields\" )\r\n  FT_ERRORDEF_( Corrupted_Font_Glyphs,                       0xBA, \\\r\n                \"Font glyphs corrupted or missing fields\" )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/fterrors.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fterrors.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType error code handling (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2007 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This special header file is used to define the handling of FT2        */\r\n  /* enumeration constants.  It can also be used to generate error message */\r\n  /* strings with a small macro trick explained below.                     */\r\n  /*                                                                       */\r\n  /* I - Error Formats                                                     */\r\n  /* -----------------                                                     */\r\n  /*                                                                       */\r\n  /*   The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be   */\r\n  /*   defined in ftoption.h in order to make the higher byte indicate     */\r\n  /*   the module where the error has happened (this is not compatible     */\r\n  /*   with standard builds of FreeType 2).  You can then use the macro    */\r\n  /*   FT_ERROR_BASE macro to extract the generic error code from an       */\r\n  /*   FT_Error value.                                                     */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* II - Error Message strings                                            */\r\n  /* --------------------------                                            */\r\n  /*                                                                       */\r\n  /*   The error definitions below are made through special macros that    */\r\n  /*   allow client applications to build a table of error message strings */\r\n  /*   if they need it.  The strings are not included in a normal build of */\r\n  /*   FreeType 2 to save space (most client applications do not use       */\r\n  /*   them).                                                              */\r\n  /*                                                                       */\r\n  /*   To do so, you have to define the following macros before including  */\r\n  /*   this file:                                                          */\r\n  /*                                                                       */\r\n  /*   FT_ERROR_START_LIST ::                                              */\r\n  /*     This macro is called before anything else to define the start of  */\r\n  /*     the error list.  It is followed by several FT_ERROR_DEF calls     */\r\n  /*     (see below).                                                      */\r\n  /*                                                                       */\r\n  /*   FT_ERROR_DEF( e, v, s ) ::                                          */\r\n  /*     This macro is called to define one single error.                  */\r\n  /*     `e' is the error code identifier (e.g. FT_Err_Invalid_Argument).  */\r\n  /*     `v' is the error numerical value.                                 */\r\n  /*     `s' is the corresponding error string.                            */\r\n  /*                                                                       */\r\n  /*   FT_ERROR_END_LIST ::                                                */\r\n  /*     This macro ends the list.                                         */\r\n  /*                                                                       */\r\n  /*   Additionally, you have to undefine __FTERRORS_H__ before #including */\r\n  /*   this file.                                                          */\r\n  /*                                                                       */\r\n  /*   Here is a simple example:                                           */\r\n  /*                                                                       */\r\n  /*     {                                                                 */\r\n  /*       #undef __FTERRORS_H__                                           */\r\n  /*       #define FT_ERRORDEF( e, v, s )  { e, s },                       */\r\n  /*       #define FT_ERROR_START_LIST     {                               */\r\n  /*       #define FT_ERROR_END_LIST       { 0, 0 } };                     */\r\n  /*                                                                       */\r\n  /*       const struct                                                    */\r\n  /*       {                                                               */\r\n  /*         int          err_code;                                        */\r\n  /*         const char*  err_msg;                                         */\r\n  /*       } ft_errors[] =                                                 */\r\n  /*                                                                       */\r\n  /*       #include FT_ERRORS_H                                            */\r\n  /*     }                                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTERRORS_H__\r\n#define __FTERRORS_H__\r\n\r\n\r\n  /* include module base error codes */\r\n#include FT_MODULE_ERRORS_H\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                       SETUP MACROS                      *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#undef  FT_NEED_EXTERN_C\r\n\r\n#undef  FT_ERR_XCAT\r\n#undef  FT_ERR_CAT\r\n\r\n#define FT_ERR_XCAT( x, y )  x ## y\r\n#define FT_ERR_CAT( x, y )   FT_ERR_XCAT( x, y )\r\n\r\n\r\n  /* FT_ERR_PREFIX is used as a prefix for error identifiers. */\r\n  /* By default, we use `FT_Err_'.                            */\r\n  /*                                                          */\r\n#ifndef FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  FT_Err_\r\n#endif\r\n\r\n\r\n  /* FT_ERR_BASE is used as the base for module-specific errors. */\r\n  /*                                                             */\r\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\r\n\r\n#ifndef FT_ERR_BASE\r\n#define FT_ERR_BASE  FT_Mod_Err_Base\r\n#endif\r\n\r\n#else\r\n\r\n#undef FT_ERR_BASE\r\n#define FT_ERR_BASE  0\r\n\r\n#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */\r\n\r\n\r\n  /* If FT_ERRORDEF is not defined, we need to define a simple */\r\n  /* enumeration type.                                         */\r\n  /*                                                           */\r\n#ifndef FT_ERRORDEF\r\n\r\n#define FT_ERRORDEF( e, v, s )  e = v,\r\n#define FT_ERROR_START_LIST     enum {\r\n#define FT_ERROR_END_LIST       FT_ERR_CAT( FT_ERR_PREFIX, Max ) };\r\n\r\n#ifdef __cplusplus\r\n#define FT_NEED_EXTERN_C\r\n  extern \"C\" {\r\n#endif\r\n\r\n#endif /* !FT_ERRORDEF */\r\n\r\n\r\n  /* this macro is used to define an error */\r\n#define FT_ERRORDEF_( e, v, s )   \\\r\n          FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )\r\n\r\n  /* this is only used for <module>_Err_Ok, which must be 0! */\r\n#define FT_NOERRORDEF_( e, v, s ) \\\r\n          FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )\r\n\r\n\r\n#ifdef FT_ERROR_START_LIST\r\n  FT_ERROR_START_LIST\r\n#endif\r\n\r\n\r\n  /* now include the error codes */\r\n#include FT_ERROR_DEFINITIONS_H\r\n\r\n\r\n#ifdef FT_ERROR_END_LIST\r\n  FT_ERROR_END_LIST\r\n#endif\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                      SIMPLE CLEANUP                     *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n#ifdef FT_NEED_EXTERN_C\r\n  }\r\n#endif\r\n\r\n#undef FT_ERROR_START_LIST\r\n#undef FT_ERROR_END_LIST\r\n\r\n#undef FT_ERRORDEF\r\n#undef FT_ERRORDEF_\r\n#undef FT_NOERRORDEF_\r\n\r\n#undef FT_NEED_EXTERN_C\r\n#undef FT_ERR_BASE\r\n\r\n  /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */\r\n#ifndef FT_KEEP_ERR_PREFIX\r\n#undef FT_ERR_PREFIX\r\n#else\r\n#undef FT_KEEP_ERR_PREFIX\r\n#endif\r\n\r\n#endif /* __FTERRORS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftgasp.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgasp.h                                                               */\r\n/*                                                                         */\r\n/*    Access of TrueType's `gasp' table (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2008, 2011 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef _FT_GASP_H_\r\n#define _FT_GASP_H_\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @section:\r\n   *   gasp_table\r\n   *\r\n   * @title:\r\n   *   Gasp Table\r\n   *\r\n   * @abstract:\r\n   *   Retrieving TrueType `gasp' table entries.\r\n   *\r\n   * @description:\r\n   *   The function @FT_Get_Gasp can be used to query a TrueType or OpenType\r\n   *   font for specific entries in its `gasp' table, if any.  This is\r\n   *   mainly useful when implementing native TrueType hinting with the\r\n   *   bytecode interpreter to duplicate the Windows text rendering results.\r\n   */\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_GASP_XXX\r\n   *\r\n   * @description:\r\n   *   A list of values and/or bit-flags returned by the @FT_Get_Gasp\r\n   *   function.\r\n   *\r\n   * @values:\r\n   *   FT_GASP_NO_TABLE ::\r\n   *     This special value means that there is no GASP table in this face.\r\n   *     It is up to the client to decide what to do.\r\n   *\r\n   *   FT_GASP_DO_GRIDFIT ::\r\n   *     Grid-fitting and hinting should be performed at the specified ppem.\r\n   *     This *really* means TrueType bytecode interpretation.  If this bit\r\n   *     is not set, no hinting gets applied.\r\n   *\r\n   *   FT_GASP_DO_GRAY ::\r\n   *     Anti-aliased rendering should be performed at the specified ppem.\r\n   *     If not set, do monochrome rendering.\r\n   *\r\n   *   FT_GASP_SYMMETRIC_SMOOTHING ::\r\n   *     If set, smoothing along multiple axes must be used with ClearType.\r\n   *\r\n   *   FT_GASP_SYMMETRIC_GRIDFIT ::\r\n   *     Grid-fitting must be used with ClearType's symmetric smoothing.\r\n   *\r\n   * @note:\r\n   *   The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be\r\n   *   used for standard font rasterization only.  Independently of that,\r\n   *   `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to\r\n   *   be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and\r\n   *   `FT_GASP_DO_GRAY' are consequently ignored).\r\n   *\r\n   *   `ClearType' is Microsoft's implementation of LCD rendering, partly\r\n   *   protected by patents.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n#define FT_GASP_NO_TABLE               -1\r\n#define FT_GASP_DO_GRIDFIT           0x01\r\n#define FT_GASP_DO_GRAY              0x02\r\n#define FT_GASP_SYMMETRIC_SMOOTHING  0x08\r\n#define FT_GASP_SYMMETRIC_GRIDFIT    0x10\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Get_Gasp\r\n   *\r\n   * @description:\r\n   *   Read the `gasp' table from a TrueType or OpenType font file and\r\n   *   return the entry corresponding to a given character pixel size.\r\n   *\r\n   * @input:\r\n   *   face :: The source face handle.\r\n   *   ppem :: The vertical character pixel size.\r\n   *\r\n   * @return:\r\n   *   Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no\r\n   *   `gasp' table in the face.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Get_Gasp( FT_Face  face,\r\n               FT_UInt  ppem );\r\n\r\n/* */\r\n\r\n#endif /* _FT_GASP_H_ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftglyph.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftglyph.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType convenience functions to handle glyphs (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2006, 2008, 2009, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file contains the definition of several convenience functions    */\r\n  /* that can be used by client applications to easily retrieve glyph      */\r\n  /* bitmaps and outlines from a given face.                               */\r\n  /*                                                                       */\r\n  /* These functions should be optional if you are writing a font server   */\r\n  /* or text layout engine on top of FreeType.  However, they are pretty   */\r\n  /* handy for many other simple uses of the library.                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTGLYPH_H__\r\n#define __FTGLYPH_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    glyph_management                                                   */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Glyph Management                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Generic interface to manage individual glyph data.                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains definitions used to manage glyph data        */\r\n  /*    through generic FT_Glyph objects.  Each of them can contain a      */\r\n  /*    bitmap, a vector outline, or even images in other formats.         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* forward declaration to a private type */\r\n  typedef struct FT_Glyph_Class_  FT_Glyph_Class;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Glyph                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Handle to an object used to model generic glyph images.  It is a   */\r\n  /*    pointer to the @FT_GlyphRec structure and can contain a glyph      */\r\n  /*    bitmap or pointer.                                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Glyph objects are not owned by the library.  You must thus release */\r\n  /*    them manually (through @FT_Done_Glyph) _before_ calling            */\r\n  /*    @FT_Done_FreeType.                                                 */\r\n  /*                                                                       */\r\n  typedef struct FT_GlyphRec_*  FT_Glyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_GlyphRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The root glyph structure contains a given glyph image plus its     */\r\n  /*    advance width in 16.16 fixed float format.                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    library :: A handle to the FreeType library object.                */\r\n  /*                                                                       */\r\n  /*    clazz   :: A pointer to the glyph's class.  Private.               */\r\n  /*                                                                       */\r\n  /*    format  :: The format of the glyph's image.                        */\r\n  /*                                                                       */\r\n  /*    advance :: A 16.16 vector that gives the glyph's advance width.    */\r\n  /*                                                                       */\r\n  typedef struct  FT_GlyphRec_\r\n  {\r\n    FT_Library             library;\r\n    const FT_Glyph_Class*  clazz;\r\n    FT_Glyph_Format        format;\r\n    FT_Vector              advance;\r\n\r\n  } FT_GlyphRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_BitmapGlyph                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an object used to model a bitmap glyph image.  This is */\r\n  /*    a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.     */\r\n  /*                                                                       */\r\n  typedef struct FT_BitmapGlyphRec_*  FT_BitmapGlyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_BitmapGlyphRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used for bitmap glyph images.  This really is a        */\r\n  /*    `sub-class' of @FT_GlyphRec.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root   :: The root @FT_Glyph fields.                               */\r\n  /*                                                                       */\r\n  /*    left   :: The left-side bearing, i.e., the horizontal distance     */\r\n  /*              from the current pen position to the left border of the  */\r\n  /*              glyph bitmap.                                            */\r\n  /*                                                                       */\r\n  /*    top    :: The top-side bearing, i.e., the vertical distance from   */\r\n  /*              the current pen position to the top border of the glyph  */\r\n  /*              bitmap.  This distance is positive for upwards~y!        */\r\n  /*                                                                       */\r\n  /*    bitmap :: A descriptor for the bitmap.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have       */\r\n  /*    `glyph->format == FT_GLYPH_FORMAT_BITMAP'.  This lets you access   */\r\n  /*    the bitmap's contents easily.                                      */\r\n  /*                                                                       */\r\n  /*    The corresponding pixel buffer is always owned by @FT_BitmapGlyph  */\r\n  /*    and is thus created and destroyed with it.                         */\r\n  /*                                                                       */\r\n  typedef struct  FT_BitmapGlyphRec_\r\n  {\r\n    FT_GlyphRec  root;\r\n    FT_Int       left;\r\n    FT_Int       top;\r\n    FT_Bitmap    bitmap;\r\n\r\n  } FT_BitmapGlyphRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_OutlineGlyph                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an object used to model an outline glyph image.  This  */\r\n  /*    is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */\r\n  /*                                                                       */\r\n  typedef struct FT_OutlineGlyphRec_*  FT_OutlineGlyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_OutlineGlyphRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used for outline (vectorial) glyph images.  This       */\r\n  /*    really is a `sub-class' of @FT_GlyphRec.                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root    :: The root @FT_Glyph fields.                              */\r\n  /*                                                                       */\r\n  /*    outline :: A descriptor for the outline.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have      */\r\n  /*    `glyph->format == FT_GLYPH_FORMAT_OUTLINE'.  This lets you access  */\r\n  /*    the outline's content easily.                                      */\r\n  /*                                                                       */\r\n  /*    As the outline is extracted from a glyph slot, its coordinates are */\r\n  /*    expressed normally in 26.6 pixels, unless the flag                 */\r\n  /*    @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */\r\n  /*                                                                       */\r\n  /*    The outline's tables are always owned by the object and are        */\r\n  /*    destroyed with it.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_OutlineGlyphRec_\r\n  {\r\n    FT_GlyphRec  root;\r\n    FT_Outline   outline;\r\n\r\n  } FT_OutlineGlyphRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Glyph                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to extract a glyph image from a slot.  Note that   */\r\n  /*    the created @FT_Glyph object must be released with @FT_Done_Glyph. */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot   :: A handle to the source glyph slot.                       */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aglyph :: A handle to the glyph object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Glyph( FT_GlyphSlot  slot,\r\n                FT_Glyph     *aglyph );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_Copy                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to copy a glyph image.  Note that the created      */\r\n  /*    @FT_Glyph object must be released with @FT_Done_Glyph.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    source :: A handle to the source glyph object.                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target :: A handle to the target glyph object.  0~in case of       */\r\n  /*              error.                                                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_Copy( FT_Glyph   source,\r\n                 FT_Glyph  *target );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_Transform                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Transform a glyph image if its format is scalable.                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    glyph  :: A handle to the target glyph object.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix :: A pointer to a 2x2 matrix to apply.                      */\r\n  /*                                                                       */\r\n  /*    delta  :: A pointer to a 2d vector to apply.  Coordinates are      */\r\n  /*              expressed in 1/64th of a pixel.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code (if not 0, the glyph format is not scalable).  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The 2x2 transformation matrix is also applied to the glyph's       */\r\n  /*    advance vector.                                                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_Transform( FT_Glyph    glyph,\r\n                      FT_Matrix*  matrix,\r\n                      FT_Vector*  delta );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Glyph_BBox_Mode                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The mode how the values of @FT_Glyph_Get_CBox are returned.        */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_GLYPH_BBOX_UNSCALED ::                                          */\r\n  /*      Return unscaled font units.                                      */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_SUBPIXELS ::                                         */\r\n  /*      Return unfitted 26.6 coordinates.                                */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_GRIDFIT ::                                           */\r\n  /*      Return grid-fitted 26.6 coordinates.                             */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_TRUNCATE ::                                          */\r\n  /*      Return coordinates in integer pixels.                            */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_PIXELS ::                                            */\r\n  /*      Return grid-fitted pixel coordinates.                            */\r\n  /*                                                                       */\r\n  typedef enum  FT_Glyph_BBox_Mode_\r\n  {\r\n    FT_GLYPH_BBOX_UNSCALED  = 0,\r\n    FT_GLYPH_BBOX_SUBPIXELS = 0,\r\n    FT_GLYPH_BBOX_GRIDFIT   = 1,\r\n    FT_GLYPH_BBOX_TRUNCATE  = 2,\r\n    FT_GLYPH_BBOX_PIXELS    = 3\r\n\r\n  } FT_Glyph_BBox_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_glyph_bbox_xxx                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    These constants are deprecated.  Use the corresponding             */\r\n  /*    @FT_Glyph_BBox_Mode values instead.                                */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*   ft_glyph_bbox_unscaled  :: See @FT_GLYPH_BBOX_UNSCALED.             */\r\n  /*   ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS.            */\r\n  /*   ft_glyph_bbox_gridfit   :: See @FT_GLYPH_BBOX_GRIDFIT.              */\r\n  /*   ft_glyph_bbox_truncate  :: See @FT_GLYPH_BBOX_TRUNCATE.             */\r\n  /*   ft_glyph_bbox_pixels    :: See @FT_GLYPH_BBOX_PIXELS.               */\r\n  /*                                                                       */\r\n#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED\r\n#define ft_glyph_bbox_subpixels  FT_GLYPH_BBOX_SUBPIXELS\r\n#define ft_glyph_bbox_gridfit    FT_GLYPH_BBOX_GRIDFIT\r\n#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE\r\n#define ft_glyph_bbox_pixels     FT_GLYPH_BBOX_PIXELS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_Get_CBox                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a glyph's `control box'.  The control box encloses all the  */\r\n  /*    outline's points, including Bézier control points.  Though it      */\r\n  /*    coincides with the exact bounding box for most glyphs, it can be   */\r\n  /*    slightly larger in some situations (like when rotating an outline  */\r\n  /*    which contains Bézier outside arcs).                               */\r\n  /*                                                                       */\r\n  /*    Computing the control box is very fast, while getting the bounding */\r\n  /*    box can take much more time as it needs to walk over all segments  */\r\n  /*    and arcs in the outline.  To get the latter, you can use the       */\r\n  /*    `ftbbox' component which is dedicated to this single task.         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph :: A handle to the source glyph object.                      */\r\n  /*                                                                       */\r\n  /*    mode  :: The mode which indicates how to interpret the returned    */\r\n  /*             bounding box values.                                      */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acbox :: The glyph coordinate bounding box.  Coordinates are       */\r\n  /*             expressed in 1/64th of pixels if it is grid-fitted.       */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Coordinates are relative to the glyph origin, using the y~upwards  */\r\n  /*    convention.                                                        */\r\n  /*                                                                       */\r\n  /*    If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode'   */\r\n  /*    must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font        */\r\n  /*    units in 26.6 pixel format.  The value @FT_GLYPH_BBOX_SUBPIXELS    */\r\n  /*    is another name for this constant.                                 */\r\n  /*                                                                       */\r\n  /*    If the font is tricky and the glyph has been loaded with           */\r\n  /*    @FT_LOAD_NO_SCALE, the resulting CBox is meaningless.  To get      */\r\n  /*    reasonable values for the CBox it is necessary to load the glyph   */\r\n  /*    at a large ppem value (so that the hinting instructions can        */\r\n  /*    properly shift and scale the subglyphs), then extracting the CBox  */\r\n  /*    which can be eventually converted back to font units.              */\r\n  /*                                                                       */\r\n  /*    Note that the maximum coordinates are exclusive, which means that  */\r\n  /*    one can compute the width and height of the glyph image (be it in  */\r\n  /*    integer or 26.6 pixels) as:                                        */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      width  = bbox.xMax - bbox.xMin;                                  */\r\n  /*      height = bbox.yMax - bbox.yMin;                                  */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Note also that for 26.6 coordinates, if `bbox_mode' is set to      */\r\n  /*    @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted,  */\r\n  /*    which corresponds to:                                              */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      bbox.xMin = FLOOR(bbox.xMin);                                    */\r\n  /*      bbox.yMin = FLOOR(bbox.yMin);                                    */\r\n  /*      bbox.xMax = CEILING(bbox.xMax);                                  */\r\n  /*      bbox.yMax = CEILING(bbox.yMax);                                  */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    To get the bbox in pixel coordinates, set `bbox_mode' to           */\r\n  /*    @FT_GLYPH_BBOX_TRUNCATE.                                           */\r\n  /*                                                                       */\r\n  /*    To get the bbox in grid-fitted pixel coordinates, set `bbox_mode'  */\r\n  /*    to @FT_GLYPH_BBOX_PIXELS.                                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Glyph_Get_CBox( FT_Glyph  glyph,\r\n                     FT_UInt   bbox_mode,\r\n                     FT_BBox  *acbox );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_To_Bitmap                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a given glyph object to a bitmap glyph object.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    the_glyph   :: A pointer to a handle to the target glyph.          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    render_mode :: An enumeration that describes how the data is       */\r\n  /*                   rendered.                                           */\r\n  /*                                                                       */\r\n  /*    origin      :: A pointer to a vector used to translate the glyph   */\r\n  /*                   image before rendering.  Can be~0 (if no            */\r\n  /*                   translation).  The origin is expressed in           */\r\n  /*                   26.6 pixels.                                        */\r\n  /*                                                                       */\r\n  /*    destroy     :: A boolean that indicates that the original glyph    */\r\n  /*                   image should be destroyed by this function.  It is  */\r\n  /*                   never destroyed in case of error.                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does nothing if the glyph format isn't scalable.     */\r\n  /*                                                                       */\r\n  /*    The glyph image is translated with the `origin' vector before      */\r\n  /*    rendering.                                                         */\r\n  /*                                                                       */\r\n  /*    The first parameter is a pointer to an @FT_Glyph handle, that will */\r\n  /*    be _replaced_ by this function (with newly allocated data).        */\r\n  /*    Typically, you would use (omitting error handling):                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      {                                                                */\r\n  /*        FT_Glyph        glyph;                                         */\r\n  /*        FT_BitmapGlyph  glyph_bitmap;                                  */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*        // load glyph                                                  */\r\n  /*        error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT );     */\r\n  /*                                                                       */\r\n  /*        // extract glyph image                                         */\r\n  /*        error = FT_Get_Glyph( face->glyph, &glyph );                   */\r\n  /*                                                                       */\r\n  /*        // convert to a bitmap (default render mode + destroying old)  */\r\n  /*        if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )                 */\r\n  /*        {                                                              */\r\n  /*          error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,   */\r\n  /*                                      0, 1 );                          */\r\n  /*          if ( error ) // `glyph' unchanged                            */\r\n  /*            ...                                                        */\r\n  /*        }                                                              */\r\n  /*                                                                       */\r\n  /*        // access bitmap content by typecasting                        */\r\n  /*        glyph_bitmap = (FT_BitmapGlyph)glyph;                          */\r\n  /*                                                                       */\r\n  /*        // do funny stuff with it, like blitting/drawing               */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        // discard glyph image (bitmap or not)                         */\r\n  /*        FT_Done_Glyph( glyph );                                        */\r\n  /*      }                                                                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*    Here another example, again without error handling:                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      {                                                                */\r\n  /*        FT_Glyph  glyphs[MAX_GLYPHS]                                   */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */\r\n  /*          error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||       */\r\n  /*                  FT_Get_Glyph ( face->glyph, &glyph[idx] );           */\r\n  /*                                                                       */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */\r\n  /*        {                                                              */\r\n  /*          FT_Glyph  bitmap = glyphs[idx];                              */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*          ...                                                          */\r\n  /*                                                                       */\r\n  /*          // after this call, `bitmap' no longer points into           */\r\n  /*          // the `glyphs' array (and the old value isn't destroyed)    */\r\n  /*          FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );    */\r\n  /*                                                                       */\r\n  /*          ...                                                          */\r\n  /*                                                                       */\r\n  /*          FT_Done_Glyph( bitmap );                                     */\r\n  /*        }                                                              */\r\n  /*                                                                       */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */\r\n  /*          FT_Done_Glyph( glyphs[idx] );                                */\r\n  /*      }                                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,\r\n                      FT_Render_Mode  render_mode,\r\n                      FT_Vector*      origin,\r\n                      FT_Bool         destroy );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a given glyph.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph :: A handle to the target glyph object.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Done_Glyph( FT_Glyph  glyph );\r\n\r\n  /* */\r\n\r\n\r\n  /* other helpful functions */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    computations                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Matrix_Multiply                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Perform the matrix operation `b = a*b'.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: A pointer to matrix `a'.                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    b :: A pointer to matrix `b'.                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The result is undefined if either `a' or `b' is zero.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Matrix_Multiply( const FT_Matrix*  a,\r\n                      FT_Matrix*        b );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Matrix_Invert                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Invert a 2x2 matrix.  Return an error if it can't be inverted.     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */\r\n  /*              case of error.                                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Matrix_Invert( FT_Matrix*  matrix );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGLYPH_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftgxval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgxval.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating TrueTypeGX/AAT tables (specification).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006 by                                          */\r\n/*  Masatake YAMATO, Redhat K.K,                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGXVAL_H__\r\n#define __FTGXVAL_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    gx_validation                                                      */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    TrueTypeGX/AAT Validation                                          */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    An API to validate TrueTypeGX/AAT tables.                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of functions to validate     */\r\n  /*    some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd,  */\r\n  /*    trak, prop, lcar).                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* Warning: Use FT_VALIDATE_XXX to validate a table.                     */\r\n  /*          Following definitions are for gxvalid developers.            */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#define FT_VALIDATE_feat_INDEX     0\r\n#define FT_VALIDATE_mort_INDEX     1\r\n#define FT_VALIDATE_morx_INDEX     2\r\n#define FT_VALIDATE_bsln_INDEX     3\r\n#define FT_VALIDATE_just_INDEX     4\r\n#define FT_VALIDATE_kern_INDEX     5\r\n#define FT_VALIDATE_opbd_INDEX     6\r\n#define FT_VALIDATE_trak_INDEX     7\r\n#define FT_VALIDATE_prop_INDEX     8\r\n#define FT_VALIDATE_lcar_INDEX     9\r\n#define FT_VALIDATE_GX_LAST_INDEX  FT_VALIDATE_lcar_INDEX\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_VALIDATE_GX_LENGTH\r\n   *\r\n   * @description:\r\n   *   The number of tables checked in this module.  Use it as a parameter\r\n   *   for the `table-length' argument of function @FT_TrueTypeGX_Validate.\r\n   */\r\n#define FT_VALIDATE_GX_LENGTH     (FT_VALIDATE_GX_LAST_INDEX + 1)\r\n\r\n  /* */\r\n\r\n  /* Up to 0x1000 is used by otvalid.\r\n     Ox2xxx is reserved for feature OT extension. */\r\n#define FT_VALIDATE_GX_START 0x4000\r\n#define FT_VALIDATE_GX_BITFIELD( tag )                  \\\r\n  ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @enum:\r\n  *    FT_VALIDATE_GXXXX\r\n  *\r\n  * @description:\r\n  *    A list of bit-field constants used with @FT_TrueTypeGX_Validate to\r\n  *    indicate which TrueTypeGX/AAT Type tables should be validated.\r\n  *\r\n  * @values:\r\n  *    FT_VALIDATE_feat ::\r\n  *      Validate `feat' table.\r\n  *\r\n  *    FT_VALIDATE_mort ::\r\n  *      Validate `mort' table.\r\n  *\r\n  *    FT_VALIDATE_morx ::\r\n  *      Validate `morx' table.\r\n  *\r\n  *    FT_VALIDATE_bsln ::\r\n  *      Validate `bsln' table.\r\n  *\r\n  *    FT_VALIDATE_just ::\r\n  *      Validate `just' table.\r\n  *\r\n  *    FT_VALIDATE_kern ::\r\n  *      Validate `kern' table.\r\n  *\r\n  *    FT_VALIDATE_opbd ::\r\n  *      Validate `opbd' table.\r\n  *\r\n  *    FT_VALIDATE_trak ::\r\n  *      Validate `trak' table.\r\n  *\r\n  *    FT_VALIDATE_prop ::\r\n  *      Validate `prop' table.\r\n  *\r\n  *    FT_VALIDATE_lcar ::\r\n  *      Validate `lcar' table.\r\n  *\r\n  *    FT_VALIDATE_GX ::\r\n  *      Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,\r\n  *      opbd, trak, prop and lcar).\r\n  *\r\n  */\r\n\r\n#define FT_VALIDATE_feat  FT_VALIDATE_GX_BITFIELD( feat )\r\n#define FT_VALIDATE_mort  FT_VALIDATE_GX_BITFIELD( mort )\r\n#define FT_VALIDATE_morx  FT_VALIDATE_GX_BITFIELD( morx )\r\n#define FT_VALIDATE_bsln  FT_VALIDATE_GX_BITFIELD( bsln )\r\n#define FT_VALIDATE_just  FT_VALIDATE_GX_BITFIELD( just )\r\n#define FT_VALIDATE_kern  FT_VALIDATE_GX_BITFIELD( kern )\r\n#define FT_VALIDATE_opbd  FT_VALIDATE_GX_BITFIELD( opbd )\r\n#define FT_VALIDATE_trak  FT_VALIDATE_GX_BITFIELD( trak )\r\n#define FT_VALIDATE_prop  FT_VALIDATE_GX_BITFIELD( prop )\r\n#define FT_VALIDATE_lcar  FT_VALIDATE_GX_BITFIELD( lcar )\r\n\r\n#define FT_VALIDATE_GX  ( FT_VALIDATE_feat | \\\r\n                          FT_VALIDATE_mort | \\\r\n                          FT_VALIDATE_morx | \\\r\n                          FT_VALIDATE_bsln | \\\r\n                          FT_VALIDATE_just | \\\r\n                          FT_VALIDATE_kern | \\\r\n                          FT_VALIDATE_opbd | \\\r\n                          FT_VALIDATE_trak | \\\r\n                          FT_VALIDATE_prop | \\\r\n                          FT_VALIDATE_lcar )\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_TrueTypeGX_Validate\r\n  *\r\n  * @description:\r\n  *    Validate various TrueTypeGX tables to assure that all offsets and\r\n  *    indices are valid.  The idea is that a higher-level library which\r\n  *    actually does the text layout can access those tables without\r\n  *    error checking (which can be quite time consuming).\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    validation_flags ::\r\n  *       A bit field which specifies the tables to be validated.  See\r\n  *       @FT_VALIDATE_GXXXX for possible values.\r\n  *\r\n  *    table_length ::\r\n  *       The size of the `tables' array.  Normally, @FT_VALIDATE_GX_LENGTH\r\n  *       should be passed.\r\n  *\r\n  * @output:\r\n  *    tables ::\r\n  *       The array where all validated sfnt tables are stored.\r\n  *       The array itself must be allocated by a client.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function only works with TrueTypeGX fonts, returning an error\r\n  *   otherwise.\r\n  *\r\n  *   After use, the application should deallocate the buffers pointed to by\r\n  *   each `tables' element, by calling @FT_TrueTypeGX_Free.  A NULL value\r\n  *   indicates that the table either doesn't exist in the font, the\r\n  *   application hasn't asked for validation, or the validator doesn't have\r\n  *   the ability to validate the sfnt table.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_TrueTypeGX_Validate( FT_Face   face,\r\n                          FT_UInt   validation_flags,\r\n                          FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],\r\n                          FT_UInt   table_length );\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_TrueTypeGX_Free\r\n  *\r\n  * @description:\r\n  *    Free the buffer allocated by TrueTypeGX validator.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    table ::\r\n  *       The pointer to the buffer allocated by\r\n  *       @FT_TrueTypeGX_Validate.\r\n  *\r\n  * @note:\r\n  *   This function must be used to free the buffer allocated by\r\n  *   @FT_TrueTypeGX_Validate only.\r\n  */\r\n  FT_EXPORT( void )\r\n  FT_TrueTypeGX_Free( FT_Face   face,\r\n                      FT_Bytes  table );\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @enum:\r\n  *    FT_VALIDATE_CKERNXXX\r\n  *\r\n  * @description:\r\n  *    A list of bit-field constants used with @FT_ClassicKern_Validate\r\n  *    to indicate the classic kern dialect or dialects.  If the selected\r\n  *    type doesn't fit, @FT_ClassicKern_Validate regards the table as\r\n  *    invalid.\r\n  *\r\n  * @values:\r\n  *    FT_VALIDATE_MS ::\r\n  *      Handle the `kern' table as a classic Microsoft kern table.\r\n  *\r\n  *    FT_VALIDATE_APPLE ::\r\n  *      Handle the `kern' table as a classic Apple kern table.\r\n  *\r\n  *    FT_VALIDATE_CKERN ::\r\n  *      Handle the `kern' as either classic Apple or Microsoft kern table.\r\n  */\r\n#define FT_VALIDATE_MS     ( FT_VALIDATE_GX_START << 0 )\r\n#define FT_VALIDATE_APPLE  ( FT_VALIDATE_GX_START << 1 )\r\n\r\n#define FT_VALIDATE_CKERN  ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_ClassicKern_Validate\r\n  *\r\n  * @description:\r\n  *    Validate classic (16-bit format) kern table to assure that the offsets\r\n  *    and indices are valid.  The idea is that a higher-level library which\r\n  *    actually does the text layout can access those tables without error\r\n  *    checking (which can be quite time consuming).\r\n  *\r\n  *    The `kern' table validator in @FT_TrueTypeGX_Validate deals with both\r\n  *    the new 32-bit format and the classic 16-bit format, while\r\n  *    FT_ClassicKern_Validate only supports the classic 16-bit format.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    validation_flags ::\r\n  *       A bit field which specifies the dialect to be validated.  See\r\n  *       @FT_VALIDATE_CKERNXXX for possible values.\r\n  *\r\n  * @output:\r\n  *    ckern_table ::\r\n  *       A pointer to the kern table.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   After use, the application should deallocate the buffers pointed to by\r\n  *   `ckern_table', by calling @FT_ClassicKern_Free.  A NULL value\r\n  *   indicates that the table doesn't exist in the font.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_ClassicKern_Validate( FT_Face    face,\r\n                           FT_UInt    validation_flags,\r\n                           FT_Bytes  *ckern_table );\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_ClassicKern_Free\r\n  *\r\n  * @description:\r\n  *    Free the buffer allocated by classic Kern validator.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    table ::\r\n  *       The pointer to the buffer that is allocated by\r\n  *       @FT_ClassicKern_Validate.\r\n  *\r\n  * @note:\r\n  *   This function must be used to free the buffer allocated by\r\n  *   @FT_ClassicKern_Validate only.\r\n  */\r\n  FT_EXPORT( void )\r\n  FT_ClassicKern_Free( FT_Face   face,\r\n                       FT_Bytes  table );\r\n\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGXVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftgzip.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgzip.h                                                               */\r\n/*                                                                         */\r\n/*    Gzip-compressed stream support.                                      */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGZIP_H__\r\n#define __FTGZIP_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    gzip                                                               */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    GZIP Streams                                                       */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Using gzip-compressed font files.                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of Gzip-specific functions.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Stream_OpenGzip\r\n  *\r\n  * @description:\r\n  *   Open a new stream to parse gzip-compressed font files.  This is\r\n  *   mainly used to support the compressed `*.pcf.gz' fonts that come\r\n  *   with XFree86.\r\n  *\r\n  * @input:\r\n  *   stream ::\r\n  *     The target embedding stream.\r\n  *\r\n  *   source ::\r\n  *     The source stream.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   The source stream must be opened _before_ calling this function.\r\n  *\r\n  *   Calling the internal function `FT_Stream_Close' on the new stream will\r\n  *   *not* call `FT_Stream_Close' on the source stream.  None of the stream\r\n  *   objects will be released to the heap.\r\n  *\r\n  *   The stream implementation is very basic and resets the decompression\r\n  *   process each time seeking backwards is needed within the stream.\r\n  *\r\n  *   In certain builds of the library, gzip compression recognition is\r\n  *   automatically handled when calling @FT_New_Face or @FT_Open_Face.\r\n  *   This means that if no font driver is capable of handling the raw\r\n  *   compressed file, the library will try to open a gzipped stream from\r\n  *   it and re-open the face with it.\r\n  *\r\n  *   This function may return `FT_Err_Unimplemented_Feature' if your build\r\n  *   of FreeType was not compiled with zlib support.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stream_OpenGzip( FT_Stream  stream,\r\n                      FT_Stream  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGZIP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftimage.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftimage.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType glyph image formats and default raster interface            */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */\r\n/*            2010 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Note: A `raster' is simply a scan-line converter, used to render      */\r\n  /*       FT_Outlines into FT_Bitmaps.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTIMAGE_H__\r\n#define __FTIMAGE_H__\r\n\r\n\r\n  /* _STANDALONE_ is from ftgrays.c */\r\n#ifndef _STANDALONE_\r\n#include <ft2build.h>\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Pos                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The type FT_Pos is used to store vectorial coordinates.  Depending */\r\n  /*    on the context, these can represent distances in integer font      */\r\n  /*    units, or 16.16, or 26.6 fixed float pixel coordinates.            */\r\n  /*                                                                       */\r\n  typedef signed long  FT_Pos;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Vector                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to store a 2D vector; coordinates are of   */\r\n  /*    the FT_Pos type.                                                   */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x :: The horizontal coordinate.                                    */\r\n  /*    y :: The vertical coordinate.                                      */\r\n  /*                                                                       */\r\n  typedef struct  FT_Vector_\r\n  {\r\n    FT_Pos  x;\r\n    FT_Pos  y;\r\n\r\n  } FT_Vector;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_BBox                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold an outline's bounding box, i.e., the      */\r\n  /*    coordinates of its extrema in the horizontal and vertical          */\r\n  /*    directions.                                                        */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    xMin :: The horizontal minimum (left-most).                        */\r\n  /*                                                                       */\r\n  /*    yMin :: The vertical minimum (bottom-most).                        */\r\n  /*                                                                       */\r\n  /*    xMax :: The horizontal maximum (right-most).                       */\r\n  /*                                                                       */\r\n  /*    yMax :: The vertical maximum (top-most).                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The bounding box is specified with the coordinates of the lower    */\r\n  /*    left and the upper right corner.  In PostScript, those values are  */\r\n  /*    often called (llx,lly) and (urx,ury), respectively.                */\r\n  /*                                                                       */\r\n  /*    If `yMin' is negative, this value gives the glyph's descender.     */\r\n  /*    Otherwise, the glyph doesn't descend below the baseline.           */\r\n  /*    Similarly, if `ymax' is positive, this value gives the glyph's     */\r\n  /*    ascender.                                                          */\r\n  /*                                                                       */\r\n  /*    `xMin' gives the horizontal distance from the glyph's origin to    */\r\n  /*    the left edge of the glyph's bounding box.  If `xMin' is negative, */\r\n  /*    the glyph extends to the left of the origin.                       */\r\n  /*                                                                       */\r\n  typedef struct  FT_BBox_\r\n  {\r\n    FT_Pos  xMin, yMin;\r\n    FT_Pos  xMax, yMax;\r\n\r\n  } FT_BBox;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Pixel_Mode                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type used to describe the format of pixels in a     */\r\n  /*    given bitmap.  Note that additional formats may be added in the    */\r\n  /*    future.                                                            */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_PIXEL_MODE_NONE ::                                              */\r\n  /*      Value~0 is reserved.                                             */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_MONO ::                                              */\r\n  /*      A monochrome bitmap, using 1~bit per pixel.  Note that pixels    */\r\n  /*      are stored in most-significant order (MSB), which means that     */\r\n  /*      the left-most pixel in a byte has value 128.                     */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_GRAY ::                                              */\r\n  /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */\r\n  /*      images.  Each pixel is stored in one byte.  Note that the number */\r\n  /*      of `gray' levels is stored in the `num_grays' field of the       */\r\n  /*      @FT_Bitmap structure (it generally is 256).                      */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_GRAY2 ::                                             */\r\n  /*      A 2-bit per pixel bitmap, used to represent embedded             */\r\n  /*      anti-aliased bitmaps in font files according to the OpenType     */\r\n  /*      specification.  We haven't found a single font using this        */\r\n  /*      format, however.                                                 */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_GRAY4 ::                                             */\r\n  /*      A 4-bit per pixel bitmap, representing embedded anti-aliased     */\r\n  /*      bitmaps in font files according to the OpenType specification.   */\r\n  /*      We haven't found a single font using this format, however.       */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_LCD ::                                               */\r\n  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */\r\n  /*      used for display on LCD displays; the bitmap is three times      */\r\n  /*      wider than the original glyph image.  See also                   */\r\n  /*      @FT_RENDER_MODE_LCD.                                             */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_LCD_V ::                                             */\r\n  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */\r\n  /*      used for display on rotated LCD displays; the bitmap is three    */\r\n  /*      times taller than the original glyph image.  See also            */\r\n  /*      @FT_RENDER_MODE_LCD_V.                                           */\r\n  /*                                                                       */\r\n  typedef enum  FT_Pixel_Mode_\r\n  {\r\n    FT_PIXEL_MODE_NONE = 0,\r\n    FT_PIXEL_MODE_MONO,\r\n    FT_PIXEL_MODE_GRAY,\r\n    FT_PIXEL_MODE_GRAY2,\r\n    FT_PIXEL_MODE_GRAY4,\r\n    FT_PIXEL_MODE_LCD,\r\n    FT_PIXEL_MODE_LCD_V,\r\n\r\n    FT_PIXEL_MODE_MAX      /* do not remove */\r\n\r\n  } FT_Pixel_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_pixel_mode_xxx                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of deprecated constants.  Use the corresponding             */\r\n  /*    @FT_Pixel_Mode values instead.                                     */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_pixel_mode_none  :: See @FT_PIXEL_MODE_NONE.                    */\r\n  /*    ft_pixel_mode_mono  :: See @FT_PIXEL_MODE_MONO.                    */\r\n  /*    ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY.                    */\r\n  /*    ft_pixel_mode_pal2  :: See @FT_PIXEL_MODE_GRAY2.                   */\r\n  /*    ft_pixel_mode_pal4  :: See @FT_PIXEL_MODE_GRAY4.                   */\r\n  /*                                                                       */\r\n#define ft_pixel_mode_none   FT_PIXEL_MODE_NONE\r\n#define ft_pixel_mode_mono   FT_PIXEL_MODE_MONO\r\n#define ft_pixel_mode_grays  FT_PIXEL_MODE_GRAY\r\n#define ft_pixel_mode_pal2   FT_PIXEL_MODE_GRAY2\r\n#define ft_pixel_mode_pal4   FT_PIXEL_MODE_GRAY4\r\n\r\n /* */\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Palette_Mode                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT!                           */\r\n  /*                                                                       */\r\n  /*    An enumeration type to describe the format of a bitmap palette,    */\r\n  /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_palette_mode_rgb  :: The palette is an array of 3-byte RGB      */\r\n  /*                            records.                                   */\r\n  /*                                                                       */\r\n  /*    ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA     */\r\n  /*                            records.                                   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by       */\r\n  /*    FreeType, these types are not handled by the library itself.       */\r\n  /*                                                                       */\r\n  typedef enum  FT_Palette_Mode_\r\n  {\r\n    ft_palette_mode_rgb = 0,\r\n    ft_palette_mode_rgba,\r\n\r\n    ft_palette_mode_max   /* do not remove */\r\n\r\n  } FT_Palette_Mode;\r\n\r\n  /* */\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Bitmap                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to describe a bitmap or pixmap to the raster.     */\r\n  /*    Note that we now manage pixmaps of various depths through the      */\r\n  /*    `pixel_mode' field.                                                */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    rows         :: The number of bitmap rows.                         */\r\n  /*                                                                       */\r\n  /*    width        :: The number of pixels in bitmap row.                */\r\n  /*                                                                       */\r\n  /*    pitch        :: The pitch's absolute value is the number of bytes  */\r\n  /*                    taken by one bitmap row, including padding.        */\r\n  /*                    However, the pitch is positive when the bitmap has */\r\n  /*                    a `down' flow, and negative when it has an `up'    */\r\n  /*                    flow.  In all cases, the pitch is an offset to add */\r\n  /*                    to a bitmap pointer in order to go down one row.   */\r\n  /*                                                                       */\r\n  /*                    Note that `padding' means the alignment of a       */\r\n  /*                    bitmap to a byte border, and FreeType functions    */\r\n  /*                    normally align to the smallest possible integer    */\r\n  /*                    value.                                             */\r\n  /*                                                                       */\r\n  /*                    For the B/W rasterizer, `pitch' is always an even  */\r\n  /*                    number.                                            */\r\n  /*                                                                       */\r\n  /*                    To change the pitch of a bitmap (say, to make it a */\r\n  /*                    multiple of 4), use @FT_Bitmap_Convert.            */\r\n  /*                    Alternatively, you might use callback functions to */\r\n  /*                    directly render to the application's surface; see  */\r\n  /*                    the file `example2.cpp' in the tutorial for a      */\r\n  /*                    demonstration.                                     */\r\n  /*                                                                       */\r\n  /*    buffer       :: A typeless pointer to the bitmap buffer.  This     */\r\n  /*                    value should be aligned on 32-bit boundaries in    */\r\n  /*                    most cases.                                        */\r\n  /*                                                                       */\r\n  /*    num_grays    :: This field is only used with                       */\r\n  /*                    @FT_PIXEL_MODE_GRAY; it gives the number of gray   */\r\n  /*                    levels used in the bitmap.                         */\r\n  /*                                                                       */\r\n  /*    pixel_mode   :: The pixel mode, i.e., how pixel bits are stored.   */\r\n  /*                    See @FT_Pixel_Mode for possible values.            */\r\n  /*                                                                       */\r\n  /*    palette_mode :: This field is intended for paletted pixel modes;   */\r\n  /*                    it indicates how the palette is stored.  Not       */\r\n  /*                    used currently.                                    */\r\n  /*                                                                       */\r\n  /*    palette      :: A typeless pointer to the bitmap palette; this     */\r\n  /*                    field is intended for paletted pixel modes.  Not   */\r\n  /*                    used currently.                                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*   For now, the only pixel modes supported by FreeType are mono and    */\r\n  /*   grays.  However, drivers might be added in the future to support    */\r\n  /*   more `colorful' options.                                            */\r\n  /*                                                                       */\r\n  typedef struct  FT_Bitmap_\r\n  {\r\n    int             rows;\r\n    int             width;\r\n    int             pitch;\r\n    unsigned char*  buffer;\r\n    short           num_grays;\r\n    char            pixel_mode;\r\n    char            palette_mode;\r\n    void*           palette;\r\n\r\n  } FT_Bitmap;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    outline_processing                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Outline                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure is used to describe an outline to the scan-line     */\r\n  /*    converter.                                                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    n_contours :: The number of contours in the outline.               */\r\n  /*                                                                       */\r\n  /*    n_points   :: The number of points in the outline.                 */\r\n  /*                                                                       */\r\n  /*    points     :: A pointer to an array of `n_points' @FT_Vector       */\r\n  /*                  elements, giving the outline's point coordinates.    */\r\n  /*                                                                       */\r\n  /*    tags       :: A pointer to an array of `n_points' chars, giving    */\r\n  /*                  each outline point's type.                           */\r\n  /*                                                                       */\r\n  /*                  If bit~0 is unset, the point is `off' the curve,     */\r\n  /*                  i.e., a Bézier control point, while it is `on' if    */\r\n  /*                  set.                                                 */\r\n  /*                                                                       */\r\n  /*                  Bit~1 is meaningful for `off' points only.  If set,  */\r\n  /*                  it indicates a third-order Bézier arc control point; */\r\n  /*                  and a second-order control point if unset.           */\r\n  /*                                                                       */\r\n  /*                  If bit~2 is set, bits 5-7 contain the drop-out mode  */\r\n  /*                  (as defined in the OpenType specification; the value */\r\n  /*                  is the same as the argument to the SCANMODE          */\r\n  /*                  instruction).                                        */\r\n  /*                                                                       */\r\n  /*                  Bits 3 and~4 are reserved for internal purposes.     */\r\n  /*                                                                       */\r\n  /*    contours   :: An array of `n_contours' shorts, giving the end      */\r\n  /*                  point of each contour within the outline.  For       */\r\n  /*                  example, the first contour is defined by the points  */\r\n  /*                  `0' to `contours[0]', the second one is defined by   */\r\n  /*                  the points `contours[0]+1' to `contours[1]', etc.    */\r\n  /*                                                                       */\r\n  /*    flags      :: A set of bit flags used to characterize the outline  */\r\n  /*                  and give hints to the scan-converter and hinter on   */\r\n  /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The B/W rasterizer only checks bit~2 in the `tags' array for the   */\r\n  /*    first point of each contour.  The drop-out mode as given with      */\r\n  /*    @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and       */\r\n  /*    @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden.           */\r\n  /*                                                                       */\r\n  typedef struct  FT_Outline_\r\n  {\r\n    short       n_contours;      /* number of contours in glyph        */\r\n    short       n_points;        /* number of points in the glyph      */\r\n\r\n    FT_Vector*  points;          /* the outline's points               */\r\n    char*       tags;            /* the points flags                   */\r\n    short*      contours;        /* the contour end points             */\r\n\r\n    int         flags;           /* outline masks                      */\r\n\r\n  } FT_Outline;\r\n\r\n  /* Following limits must be consistent with */\r\n  /* FT_Outline.{n_contours,n_points}         */\r\n#define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX\r\n#define FT_OUTLINE_POINTS_MAX    SHRT_MAX\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_OUTLINE_FLAGS                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit-field constants use for the flags in an outline's    */\r\n  /*    `flags' field.                                                     */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_OUTLINE_NONE ::                                                 */\r\n  /*      Value~0 is reserved.                                             */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_OWNER ::                                                */\r\n  /*      If set, this flag indicates that the outline's field arrays      */\r\n  /*      (i.e., `points', `flags', and `contours') are `owned' by the     */\r\n  /*      outline object, and should thus be freed when it is destroyed.   */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_EVEN_ODD_FILL ::                                        */\r\n  /*      By default, outlines are filled using the non-zero winding rule. */\r\n  /*      If set to 1, the outline will be filled using the even-odd fill  */\r\n  /*      rule (only works with the smooth rasterizer).                    */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_REVERSE_FILL ::                                         */\r\n  /*      By default, outside contours of an outline are oriented in       */\r\n  /*      clock-wise direction, as defined in the TrueType specification.  */\r\n  /*      This flag is set if the outline uses the opposite direction      */\r\n  /*      (typically for Type~1 fonts).  This flag is ignored by the scan  */\r\n  /*      converter.                                                       */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_IGNORE_DROPOUTS ::                                      */\r\n  /*      By default, the scan converter will try to detect drop-outs in   */\r\n  /*      an outline and correct the glyph bitmap to ensure consistent     */\r\n  /*      shape continuity.  If set, this flag hints the scan-line         */\r\n  /*      converter to ignore such cases.  See below for more information. */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_SMART_DROPOUTS ::                                       */\r\n  /*      Select smart dropout control.  If unset, use simple dropout      */\r\n  /*      control.  Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See    */\r\n  /*      below for more information.                                      */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_INCLUDE_STUBS ::                                        */\r\n  /*      If set, turn pixels on for `stubs', otherwise exclude them.      */\r\n  /*      Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See below for    */\r\n  /*      more information.                                                */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_HIGH_PRECISION ::                                       */\r\n  /*      This flag indicates that the scan-line converter should try to   */\r\n  /*      convert this outline to bitmaps with the highest possible        */\r\n  /*      quality.  It is typically set for small character sizes.  Note   */\r\n  /*      that this is only a hint that might be completely ignored by a   */\r\n  /*      given scan-converter.                                            */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_SINGLE_PASS ::                                          */\r\n  /*      This flag is set to force a given scan-converter to only use a   */\r\n  /*      single pass over the outline to render a bitmap glyph image.     */\r\n  /*      Normally, it is set for very large character sizes.  It is only  */\r\n  /*      a hint that might be completely ignored by a given               */\r\n  /*      scan-converter.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */\r\n  /*    and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth            */\r\n  /*    rasterizer.                                                        */\r\n  /*                                                                       */\r\n  /*    There exists a second mechanism to pass the drop-out mode to the   */\r\n  /*    B/W rasterizer; see the `tags' field in @FT_Outline.               */\r\n  /*                                                                       */\r\n  /*    Please refer to the description of the `SCANTYPE' instruction in   */\r\n  /*    the OpenType specification (in file `ttinst1.doc') how simple      */\r\n  /*    drop-outs, smart drop-outs, and stubs are defined.                 */\r\n  /*                                                                       */\r\n#define FT_OUTLINE_NONE             0x0\r\n#define FT_OUTLINE_OWNER            0x1\r\n#define FT_OUTLINE_EVEN_ODD_FILL    0x2\r\n#define FT_OUTLINE_REVERSE_FILL     0x4\r\n#define FT_OUTLINE_IGNORE_DROPOUTS  0x8\r\n#define FT_OUTLINE_SMART_DROPOUTS   0x10\r\n#define FT_OUTLINE_INCLUDE_STUBS    0x20\r\n\r\n#define FT_OUTLINE_HIGH_PRECISION   0x100\r\n#define FT_OUTLINE_SINGLE_PASS      0x200\r\n\r\n\r\n /*************************************************************************\r\n  *\r\n  * @enum:\r\n  *   ft_outline_flags\r\n  *\r\n  * @description:\r\n  *   These constants are deprecated.  Please use the corresponding\r\n  *   @FT_OUTLINE_FLAGS values.\r\n  *\r\n  * @values:\r\n  *   ft_outline_none            :: See @FT_OUTLINE_NONE.\r\n  *   ft_outline_owner           :: See @FT_OUTLINE_OWNER.\r\n  *   ft_outline_even_odd_fill   :: See @FT_OUTLINE_EVEN_ODD_FILL.\r\n  *   ft_outline_reverse_fill    :: See @FT_OUTLINE_REVERSE_FILL.\r\n  *   ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.\r\n  *   ft_outline_high_precision  :: See @FT_OUTLINE_HIGH_PRECISION.\r\n  *   ft_outline_single_pass     :: See @FT_OUTLINE_SINGLE_PASS.\r\n  */\r\n#define ft_outline_none             FT_OUTLINE_NONE\r\n#define ft_outline_owner            FT_OUTLINE_OWNER\r\n#define ft_outline_even_odd_fill    FT_OUTLINE_EVEN_ODD_FILL\r\n#define ft_outline_reverse_fill     FT_OUTLINE_REVERSE_FILL\r\n#define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS\r\n#define ft_outline_high_precision   FT_OUTLINE_HIGH_PRECISION\r\n#define ft_outline_single_pass      FT_OUTLINE_SINGLE_PASS\r\n\r\n  /* */\r\n\r\n#define FT_CURVE_TAG( flag )  ( flag & 3 )\r\n\r\n#define FT_CURVE_TAG_ON            1\r\n#define FT_CURVE_TAG_CONIC         0\r\n#define FT_CURVE_TAG_CUBIC         2\r\n\r\n#define FT_CURVE_TAG_HAS_SCANMODE  4\r\n\r\n#define FT_CURVE_TAG_TOUCH_X       8  /* reserved for the TrueType hinter */\r\n#define FT_CURVE_TAG_TOUCH_Y      16  /* reserved for the TrueType hinter */\r\n\r\n#define FT_CURVE_TAG_TOUCH_BOTH    ( FT_CURVE_TAG_TOUCH_X | \\\r\n                                     FT_CURVE_TAG_TOUCH_Y )\r\n\r\n#define FT_Curve_Tag_On       FT_CURVE_TAG_ON\r\n#define FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC\r\n#define FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC\r\n#define FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X\r\n#define FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_MoveToFunc                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `move  */\r\n  /*    to' function during outline walking/decomposition.                 */\r\n  /*                                                                       */\r\n  /*    A `move to' is emitted to start a new contour in an outline.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    to   :: A pointer to the target point of the `move to'.            */\r\n  /*                                                                       */\r\n  /*    user :: A typeless pointer which is passed from the caller of the  */\r\n  /*            decomposition function.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_MoveToFunc)( const FT_Vector*  to,\r\n                            void*             user );\r\n\r\n#define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_LineToFunc                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `line  */\r\n  /*    to' function during outline walking/decomposition.                 */\r\n  /*                                                                       */\r\n  /*    A `line to' is emitted to indicate a segment in the outline.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    to   :: A pointer to the target point of the `line to'.            */\r\n  /*                                                                       */\r\n  /*    user :: A typeless pointer which is passed from the caller of the  */\r\n  /*            decomposition function.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_LineToFunc)( const FT_Vector*  to,\r\n                            void*             user );\r\n\r\n#define FT_Outline_LineTo_Func  FT_Outline_LineToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_ConicToFunc                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `conic */\r\n  /*    to' function during outline walking or decomposition.              */\r\n  /*                                                                       */\r\n  /*    A `conic to' is emitted to indicate a second-order Bézier arc in   */\r\n  /*    the outline.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    control :: An intermediate control point between the last position */\r\n  /*               and the new target in `to'.                             */\r\n  /*                                                                       */\r\n  /*    to      :: A pointer to the target end point of the conic arc.     */\r\n  /*                                                                       */\r\n  /*    user    :: A typeless pointer which is passed from the caller of   */\r\n  /*               the decomposition function.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_ConicToFunc)( const FT_Vector*  control,\r\n                             const FT_Vector*  to,\r\n                             void*             user );\r\n\r\n#define FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_CubicToFunc                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `cubic */\r\n  /*    to' function during outline walking or decomposition.              */\r\n  /*                                                                       */\r\n  /*    A `cubic to' is emitted to indicate a third-order Bézier arc.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    control1 :: A pointer to the first Bézier control point.           */\r\n  /*                                                                       */\r\n  /*    control2 :: A pointer to the second Bézier control point.          */\r\n  /*                                                                       */\r\n  /*    to       :: A pointer to the target end point.                     */\r\n  /*                                                                       */\r\n  /*    user     :: A typeless pointer which is passed from the caller of  */\r\n  /*                the decomposition function.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,\r\n                             const FT_Vector*  control2,\r\n                             const FT_Vector*  to,\r\n                             void*             user );\r\n\r\n#define FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Outline_Funcs                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure to hold various function pointers used during outline  */\r\n  /*    decomposition in order to emit segments, conic, and cubic Béziers. */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    move_to  :: The `move to' emitter.                                 */\r\n  /*                                                                       */\r\n  /*    line_to  :: The segment emitter.                                   */\r\n  /*                                                                       */\r\n  /*    conic_to :: The second-order Bézier arc emitter.                   */\r\n  /*                                                                       */\r\n  /*    cubic_to :: The third-order Bézier arc emitter.                    */\r\n  /*                                                                       */\r\n  /*    shift    :: The shift that is applied to coordinates before they   */\r\n  /*                are sent to the emitter.                               */\r\n  /*                                                                       */\r\n  /*    delta    :: The delta that is applied to coordinates before they   */\r\n  /*                are sent to the emitter, but after the shift.          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The point coordinates sent to the emitters are the transformed     */\r\n  /*    version of the original coordinates (this is important for high    */\r\n  /*    accuracy during scan-conversion).  The transformation is simple:   */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      x' = (x << shift) - delta                                        */\r\n  /*      y' = (x << shift) - delta                                        */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Set the values of `shift' and `delta' to~0 to get the original     */\r\n  /*    point coordinates.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_Outline_Funcs_\r\n  {\r\n    FT_Outline_MoveToFunc   move_to;\r\n    FT_Outline_LineToFunc   line_to;\r\n    FT_Outline_ConicToFunc  conic_to;\r\n    FT_Outline_CubicToFunc  cubic_to;\r\n\r\n    int                     shift;\r\n    FT_Pos                  delta;\r\n\r\n  } FT_Outline_Funcs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_IMAGE_TAG                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro converts four-letter tags to an unsigned long type.     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */\r\n  /*    should redefine this macro in case of problems to something like   */\r\n  /*    this:                                                              */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  value         */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    to get a simple enumeration without assigning special numbers.     */\r\n  /*                                                                       */\r\n#ifndef FT_IMAGE_TAG\r\n#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  \\\r\n          value = ( ( (unsigned long)_x1 << 24 ) | \\\r\n                    ( (unsigned long)_x2 << 16 ) | \\\r\n                    ( (unsigned long)_x3 << 8  ) | \\\r\n                      (unsigned long)_x4         )\r\n#endif /* FT_IMAGE_TAG */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Glyph_Format                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type used to describe the format of a given glyph   */\r\n  /*    image.  Note that this version of FreeType only supports two image */\r\n  /*    formats, even though future font drivers will be able to register  */\r\n  /*    their own format.                                                  */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_GLYPH_FORMAT_NONE ::                                            */\r\n  /*      The value~0 is reserved.                                         */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */\r\n  /*      The glyph image is a composite of several other images.  This    */\r\n  /*      format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to   */\r\n  /*      report compound glyphs (like accented characters).               */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_BITMAP ::                                          */\r\n  /*      The glyph image is a bitmap, and can be described as an          */\r\n  /*      @FT_Bitmap.  You generally need to access the `bitmap' field of  */\r\n  /*      the @FT_GlyphSlotRec structure to read it.                       */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_OUTLINE ::                                         */\r\n  /*      The glyph image is a vectorial outline made of line segments     */\r\n  /*      and Bézier arcs; it can be described as an @FT_Outline; you      */\r\n  /*      generally want to access the `outline' field of the              */\r\n  /*      @FT_GlyphSlotRec structure to read it.                           */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */\r\n  /*      The glyph image is a vectorial path with no inside and outside   */\r\n  /*      contours.  Some Type~1 fonts, like those in the Hershey family,  */\r\n  /*      contain glyphs in this format.  These are described as           */\r\n  /*      @FT_Outline, but FreeType isn't currently capable of rendering   */\r\n  /*      them correctly.                                                  */\r\n  /*                                                                       */\r\n  typedef enum  FT_Glyph_Format_\r\n  {\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),\r\n\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP,    'b', 'i', 't', 's' ),\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE,   'o', 'u', 't', 'l' ),\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' )\r\n\r\n  } FT_Glyph_Format;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_glyph_format_xxx                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of deprecated constants.  Use the corresponding             */\r\n  /*    @FT_Glyph_Format values instead.                                   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_glyph_format_none      :: See @FT_GLYPH_FORMAT_NONE.            */\r\n  /*    ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE.       */\r\n  /*    ft_glyph_format_bitmap    :: See @FT_GLYPH_FORMAT_BITMAP.          */\r\n  /*    ft_glyph_format_outline   :: See @FT_GLYPH_FORMAT_OUTLINE.         */\r\n  /*    ft_glyph_format_plotter   :: See @FT_GLYPH_FORMAT_PLOTTER.         */\r\n  /*                                                                       */\r\n#define ft_glyph_format_none       FT_GLYPH_FORMAT_NONE\r\n#define ft_glyph_format_composite  FT_GLYPH_FORMAT_COMPOSITE\r\n#define ft_glyph_format_bitmap     FT_GLYPH_FORMAT_BITMAP\r\n#define ft_glyph_format_outline    FT_GLYPH_FORMAT_OUTLINE\r\n#define ft_glyph_format_plotter    FT_GLYPH_FORMAT_PLOTTER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****            R A S T E R   D E F I N I T I O N S                *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A raster is a scan converter, in charge of rendering an outline into  */\r\n  /* a a bitmap.  This section contains the public API for rasters.        */\r\n  /*                                                                       */\r\n  /* Note that in FreeType 2, all rasters are now encapsulated within      */\r\n  /* specific modules called `renderers'.  See `freetype/ftrender.h' for   */\r\n  /* more details on renderers.                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    raster                                                             */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Scanline Converter                                                 */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How vectorial outlines are converted into bitmaps and pixmaps.     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains technical definitions.                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Raster                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle (pointer) to a raster object.  Each object can be used    */\r\n  /*    independently to convert an outline into a bitmap or pixmap.       */\r\n  /*                                                                       */\r\n  typedef struct FT_RasterRec_*  FT_Raster;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Span                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a single span of gray (or black) pixels  */\r\n  /*    when rendering a monochrome or anti-aliased bitmap.                */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x        :: The span's horizontal start position.                  */\r\n  /*                                                                       */\r\n  /*    len      :: The span's length in pixels.                           */\r\n  /*                                                                       */\r\n  /*    coverage :: The span color/coverage, ranging from 0 (background)   */\r\n  /*                to 255 (foreground).  Only used for anti-aliased       */\r\n  /*                rendering.                                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This structure is used by the span drawing callback type named     */\r\n  /*    @FT_SpanFunc which takes the y~coordinate of the span as a         */\r\n  /*    a parameter.                                                       */\r\n  /*                                                                       */\r\n  /*    The coverage value is always between 0 and 255.  If you want less  */\r\n  /*    gray values, the callback function has to reduce them.             */\r\n  /*                                                                       */\r\n  typedef struct  FT_Span_\r\n  {\r\n    short           x;\r\n    unsigned short  len;\r\n    unsigned char   coverage;\r\n\r\n  } FT_Span;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_SpanFunc                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used as a call-back by the anti-aliased renderer in     */\r\n  /*    order to let client applications draw themselves the gray pixel    */\r\n  /*    spans on each scan line.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y     :: The scanline's y~coordinate.                              */\r\n  /*                                                                       */\r\n  /*    count :: The number of spans to draw on this scanline.             */\r\n  /*                                                                       */\r\n  /*    spans :: A table of `count' spans to draw on the scanline.         */\r\n  /*                                                                       */\r\n  /*    user  :: User-supplied data that is passed to the callback.        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This callback allows client applications to directly render the    */\r\n  /*    gray spans of the anti-aliased bitmap to any kind of surfaces.     */\r\n  /*                                                                       */\r\n  /*    This can be used to write anti-aliased outlines directly to a      */\r\n  /*    given background bitmap, and even perform translucency.            */\r\n  /*                                                                       */\r\n  /*    Note that the `count' field cannot be greater than a fixed value   */\r\n  /*    defined by the `FT_MAX_GRAY_SPANS' configuration macro in          */\r\n  /*    `ftoption.h'.  By default, this value is set to~32, which means    */\r\n  /*    that if there are more than 32~spans on a given scanline, the      */\r\n  /*    callback is called several times with the same `y' parameter in    */\r\n  /*    order to draw all callbacks.                                       */\r\n  /*                                                                       */\r\n  /*    Otherwise, the callback is only called once per scan-line, and     */\r\n  /*    only for those scanlines that do have `gray' pixels on them.       */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_SpanFunc)( int             y,\r\n                  int             count,\r\n                  const FT_Span*  spans,\r\n                  void*           user );\r\n\r\n#define FT_Raster_Span_Func  FT_SpanFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_BitTest_Func                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */\r\n  /*                                                                       */\r\n  /*    A function used as a call-back by the monochrome scan-converter    */\r\n  /*    to test whether a given target pixel is already set to the drawing */\r\n  /*    `color'.  These tests are crucial to implement drop-out control    */\r\n  /*    per-se the TrueType spec.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y     :: The pixel's y~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    x     :: The pixel's x~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    user  :: User-supplied data that is passed to the callback.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   1~if the pixel is `set', 0~otherwise.                               */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_BitTest_Func)( int    y,\r\n                             int    x,\r\n                             void*  user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_BitSet_Func                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */\r\n  /*                                                                       */\r\n  /*    A function used as a call-back by the monochrome scan-converter    */\r\n  /*    to set an individual target pixel.  This is crucial to implement   */\r\n  /*    drop-out control according to the TrueType specification.          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y     :: The pixel's y~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    x     :: The pixel's x~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    user  :: User-supplied data that is passed to the callback.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    1~if the pixel is `set', 0~otherwise.                              */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Raster_BitSet_Func)( int    y,\r\n                            int    x,\r\n                            void*  user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_RASTER_FLAG_XXX                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit flag constants as used in the `flags' field of a     */\r\n  /*    @FT_Raster_Params structure.                                       */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_RASTER_FLAG_DEFAULT :: This value is 0.                         */\r\n  /*                                                                       */\r\n  /*    FT_RASTER_FLAG_AA      :: This flag is set to indicate that an     */\r\n  /*                              anti-aliased glyph image should be       */\r\n  /*                              generated.  Otherwise, it will be        */\r\n  /*                              monochrome (1-bit).                      */\r\n  /*                                                                       */\r\n  /*    FT_RASTER_FLAG_DIRECT  :: This flag is set to indicate direct      */\r\n  /*                              rendering.  In this mode, client         */\r\n  /*                              applications must provide their own span */\r\n  /*                              callback.  This lets them directly       */\r\n  /*                              draw or compose over an existing bitmap. */\r\n  /*                              If this bit is not set, the target       */\r\n  /*                              pixmap's buffer _must_ be zeroed before  */\r\n  /*                              rendering.                               */\r\n  /*                                                                       */\r\n  /*                              Note that for now, direct rendering is   */\r\n  /*                              only possible with anti-aliased glyphs.  */\r\n  /*                                                                       */\r\n  /*    FT_RASTER_FLAG_CLIP    :: This flag is only used in direct         */\r\n  /*                              rendering mode.  If set, the output will */\r\n  /*                              be clipped to a box specified in the     */\r\n  /*                              `clip_box' field of the                  */\r\n  /*                              @FT_Raster_Params structure.             */\r\n  /*                                                                       */\r\n  /*                              Note that by default, the glyph bitmap   */\r\n  /*                              is clipped to the target pixmap, except  */\r\n  /*                              in direct rendering mode where all spans */\r\n  /*                              are generated if no clipping box is set. */\r\n  /*                                                                       */\r\n#define FT_RASTER_FLAG_DEFAULT  0x0\r\n#define FT_RASTER_FLAG_AA       0x1\r\n#define FT_RASTER_FLAG_DIRECT   0x2\r\n#define FT_RASTER_FLAG_CLIP     0x4\r\n\r\n  /* deprecated */\r\n#define ft_raster_flag_default  FT_RASTER_FLAG_DEFAULT\r\n#define ft_raster_flag_aa       FT_RASTER_FLAG_AA\r\n#define ft_raster_flag_direct   FT_RASTER_FLAG_DIRECT\r\n#define ft_raster_flag_clip     FT_RASTER_FLAG_CLIP\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Raster_Params                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure to hold the arguments used by a raster's render        */\r\n  /*    function.                                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    target      :: The target bitmap.                                  */\r\n  /*                                                                       */\r\n  /*    source      :: A pointer to the source glyph image (e.g., an       */\r\n  /*                   @FT_Outline).                                       */\r\n  /*                                                                       */\r\n  /*    flags       :: The rendering flags.                                */\r\n  /*                                                                       */\r\n  /*    gray_spans  :: The gray span drawing callback.                     */\r\n  /*                                                                       */\r\n  /*    black_spans :: The black span drawing callback.  UNIMPLEMENTED!    */\r\n  /*                                                                       */\r\n  /*    bit_test    :: The bit test callback.  UNIMPLEMENTED!              */\r\n  /*                                                                       */\r\n  /*    bit_set     :: The bit set callback.  UNIMPLEMENTED!               */\r\n  /*                                                                       */\r\n  /*    user        :: User-supplied data that is passed to each drawing   */\r\n  /*                   callback.                                           */\r\n  /*                                                                       */\r\n  /*    clip_box    :: An optional clipping box.  It is only used in       */\r\n  /*                   direct rendering mode.  Note that coordinates here  */\r\n  /*                   should be expressed in _integer_ pixels (and not in */\r\n  /*                   26.6 fixed-point units).                            */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA    */\r\n  /*    bit flag is set in the `flags' field, otherwise a monochrome       */\r\n  /*    bitmap is generated.                                               */\r\n  /*                                                                       */\r\n  /*    If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the      */\r\n  /*    raster will call the `gray_spans' callback to draw gray pixel      */\r\n  /*    spans, in the case of an aa glyph bitmap, it will call             */\r\n  /*    `black_spans', and `bit_test' and `bit_set' in the case of a       */\r\n  /*    monochrome bitmap.  This allows direct composition over a          */\r\n  /*    pre-existing bitmap through user-provided callbacks to perform the */\r\n  /*    span drawing/composition.                                          */\r\n  /*                                                                       */\r\n  /*    Note that the `bit_test' and `bit_set' callbacks are required when */\r\n  /*    rendering a monochrome bitmap, as they are crucial to implement    */\r\n  /*    correct drop-out control as defined in the TrueType specification. */\r\n  /*                                                                       */\r\n  typedef struct  FT_Raster_Params_\r\n  {\r\n    const FT_Bitmap*        target;\r\n    const void*             source;\r\n    int                     flags;\r\n    FT_SpanFunc             gray_spans;\r\n    FT_SpanFunc             black_spans;  /* doesn't work! */\r\n    FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */\r\n    FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */\r\n    void*                   user;\r\n    FT_BBox                 clip_box;\r\n\r\n  } FT_Raster_Params;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_NewFunc                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to create a new raster object.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the memory allocator.                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    raster :: A handle to the new raster object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `memory' parameter is a typeless pointer in order to avoid     */\r\n  /*    un-wanted dependencies on the rest of the FreeType code.  In       */\r\n  /*    practice, it is an @FT_Memory object, i.e., a handle to the        */\r\n  /*    standard FreeType memory allocator.  However, this field can be    */\r\n  /*    completely ignored by a given raster implementation.               */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_NewFunc)( void*       memory,\r\n                        FT_Raster*  raster );\r\n\r\n#define FT_Raster_New_Func  FT_Raster_NewFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_DoneFunc                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to destroy a given raster object.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster :: A handle to the raster object.                           */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Raster_DoneFunc)( FT_Raster  raster );\r\n\r\n#define FT_Raster_Done_Func  FT_Raster_DoneFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_ResetFunc                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType provides an area of memory called the `render pool',      */\r\n  /*    available to all registered rasters.  This pool can be freely used */\r\n  /*    during a given scan-conversion but is shared by all rasters.  Its  */\r\n  /*    content is thus transient.                                         */\r\n  /*                                                                       */\r\n  /*    This function is called each time the render pool changes, or just */\r\n  /*    after a new raster object is created.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster    :: A handle to the new raster object.                    */\r\n  /*                                                                       */\r\n  /*    pool_base :: The address in memory of the render pool.             */\r\n  /*                                                                       */\r\n  /*    pool_size :: The size in bytes of the render pool.                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Rasters can ignore the render pool and rely on dynamic memory      */\r\n  /*    allocation if they want to (a handle to the memory allocator is    */\r\n  /*    passed to the raster constructor).  However, this is not           */\r\n  /*    recommended for efficiency purposes.                               */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Raster_ResetFunc)( FT_Raster       raster,\r\n                          unsigned char*  pool_base,\r\n                          unsigned long   pool_size );\r\n\r\n#define FT_Raster_Reset_Func  FT_Raster_ResetFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_SetModeFunc                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is a generic facility to change modes or attributes  */\r\n  /*    in a given raster.  This can be used for debugging purposes, or    */\r\n  /*    simply to allow implementation-specific `features' in a given      */\r\n  /*    raster module.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster :: A handle to the new raster object.                       */\r\n  /*                                                                       */\r\n  /*    mode   :: A 4-byte tag used to name the mode or property.          */\r\n  /*                                                                       */\r\n  /*    args   :: A pointer to the new mode/property to use.               */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_SetModeFunc)( FT_Raster      raster,\r\n                            unsigned long  mode,\r\n                            void*          args );\r\n\r\n#define FT_Raster_Set_Mode_Func  FT_Raster_SetModeFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_RenderFunc                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Invoke a given raster to scan-convert a given glyph image into a   */\r\n  /*    target bitmap.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster :: A handle to the raster object.                           */\r\n  /*                                                                       */\r\n  /*    params :: A pointer to an @FT_Raster_Params structure used to      */\r\n  /*              store the rendering parameters.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The exact format of the source image depends on the raster's glyph */\r\n  /*    format defined in its @FT_Raster_Funcs structure.  It can be an    */\r\n  /*    @FT_Outline or anything else in order to support a large array of  */\r\n  /*    glyph formats.                                                     */\r\n  /*                                                                       */\r\n  /*    Note also that the render function can fail and return a           */\r\n  /*    `FT_Err_Unimplemented_Feature' error code if the raster used does  */\r\n  /*    not support direct composition.                                    */\r\n  /*                                                                       */\r\n  /*    XXX: For now, the standard raster doesn't support direct           */\r\n  /*         composition but this should change for the final release (see */\r\n  /*         the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c'    */\r\n  /*         for examples of distinct implementations which support direct */\r\n  /*         composition).                                                 */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_RenderFunc)( FT_Raster                raster,\r\n                           const FT_Raster_Params*  params );\r\n\r\n#define FT_Raster_Render_Func  FT_Raster_RenderFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Raster_Funcs                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   A structure used to describe a given raster class to the library.   */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    glyph_format  :: The supported glyph format for this raster.       */\r\n  /*                                                                       */\r\n  /*    raster_new    :: The raster constructor.                           */\r\n  /*                                                                       */\r\n  /*    raster_reset  :: Used to reset the render pool within the raster.  */\r\n  /*                                                                       */\r\n  /*    raster_render :: A function to render a glyph into a given bitmap. */\r\n  /*                                                                       */\r\n  /*    raster_done   :: The raster destructor.                            */\r\n  /*                                                                       */\r\n  typedef struct  FT_Raster_Funcs_\r\n  {\r\n    FT_Glyph_Format        glyph_format;\r\n    FT_Raster_NewFunc      raster_new;\r\n    FT_Raster_ResetFunc    raster_reset;\r\n    FT_Raster_SetModeFunc  raster_set_mode;\r\n    FT_Raster_RenderFunc   raster_render;\r\n    FT_Raster_DoneFunc     raster_done;\r\n\r\n  } FT_Raster_Funcs;\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTIMAGE_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftincrem.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftincrem.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType incremental loading (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006, 2007, 2008, 2010 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTINCREM_H__\r\n#define __FTINCREM_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @section:\r\n   *    incremental\r\n   *\r\n   * @title:\r\n   *    Incremental Loading\r\n   *\r\n   * @abstract:\r\n   *    Custom Glyph Loading.\r\n   *\r\n   * @description:\r\n   *   This section contains various functions used to perform so-called\r\n   *   `incremental' glyph loading.  This is a mode where all glyphs loaded\r\n   *   from a given @FT_Face are provided by the client application,\r\n   *\r\n   *   Apart from that, all other tables are loaded normally from the font\r\n   *   file.  This mode is useful when FreeType is used within another\r\n   *   engine, e.g., a PostScript Imaging Processor.\r\n   *\r\n   *   To enable this mode, you must use @FT_Open_Face, passing an\r\n   *   @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an\r\n   *   @FT_Incremental_Interface value.  See the comments for\r\n   *   @FT_Incremental_InterfaceRec for an example.\r\n   *\r\n   */\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental\r\n   *\r\n   * @description:\r\n   *   An opaque type describing a user-provided object used to implement\r\n   *   `incremental' glyph loading within FreeType.  This is used to support\r\n   *   embedded fonts in certain environments (e.g., PostScript interpreters),\r\n   *   where the glyph data isn't in the font file, or must be overridden by\r\n   *   different values.\r\n   *\r\n   * @note:\r\n   *   It is up to client applications to create and implement @FT_Incremental\r\n   *   objects, as long as they provide implementations for the methods\r\n   *   @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc\r\n   *   and @FT_Incremental_GetGlyphMetricsFunc.\r\n   *\r\n   *   See the description of @FT_Incremental_InterfaceRec to understand how\r\n   *   to use incremental objects with FreeType.\r\n   *\r\n   */\r\n  typedef struct FT_IncrementalRec_*  FT_Incremental;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_MetricsRec\r\n   *\r\n   * @description:\r\n   *   A small structure used to contain the basic glyph metrics returned\r\n   *   by the @FT_Incremental_GetGlyphMetricsFunc method.\r\n   *\r\n   * @fields:\r\n   *   bearing_x ::\r\n   *     Left bearing, in font units.\r\n   *\r\n   *   bearing_y ::\r\n   *     Top bearing, in font units.\r\n   *\r\n   *   advance ::\r\n   *     Horizontal component of glyph advance, in font units.\r\n   *\r\n   *   advance_v ::\r\n   *     Vertical component of glyph advance, in font units.\r\n   *\r\n   * @note:\r\n   *   These correspond to horizontal or vertical metrics depending on the\r\n   *   value of the `vertical' argument to the function\r\n   *   @FT_Incremental_GetGlyphMetricsFunc.\r\n   *\r\n   */\r\n  typedef struct  FT_Incremental_MetricsRec_\r\n  {\r\n    FT_Long  bearing_x;\r\n    FT_Long  bearing_y;\r\n    FT_Long  advance;\r\n    FT_Long  advance_v;     /* since 2.3.12 */\r\n\r\n  } FT_Incremental_MetricsRec;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_Metrics\r\n   *\r\n   * @description:\r\n   *   A handle to an @FT_Incremental_MetricsRec structure.\r\n   *\r\n   */\r\n   typedef struct FT_Incremental_MetricsRec_*  FT_Incremental_Metrics;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_GetGlyphDataFunc\r\n   *\r\n   * @description:\r\n   *   A function called by FreeType to access a given glyph's data bytes\r\n   *   during @FT_Load_Glyph or @FT_Load_Char if incremental loading is\r\n   *   enabled.\r\n   *\r\n   *   Note that the format of the glyph's data bytes depends on the font\r\n   *   file format.  For TrueType, it must correspond to the raw bytes within\r\n   *   the `glyf' table.  For PostScript formats, it must correspond to the\r\n   *   *unencrypted* charstring bytes, without any `lenIV' header.  It is\r\n   *   undefined for any other format.\r\n   *\r\n   * @input:\r\n   *   incremental ::\r\n   *     Handle to an opaque @FT_Incremental handle provided by the client\r\n   *     application.\r\n   *\r\n   *   glyph_index ::\r\n   *     Index of relevant glyph.\r\n   *\r\n   * @output:\r\n   *   adata ::\r\n   *     A structure describing the returned glyph data bytes (which will be\r\n   *     accessed as a read-only byte block).\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   If this function returns successfully the method\r\n   *   @FT_Incremental_FreeGlyphDataFunc will be called later to release\r\n   *   the data bytes.\r\n   *\r\n   *   Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for\r\n   *   compound glyphs.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental  incremental,\r\n                                      FT_UInt         glyph_index,\r\n                                      FT_Data*        adata );\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_FreeGlyphDataFunc\r\n   *\r\n   * @description:\r\n   *   A function used to release the glyph data bytes returned by a\r\n   *   successful call to @FT_Incremental_GetGlyphDataFunc.\r\n   *\r\n   * @input:\r\n   *   incremental ::\r\n   *     A handle to an opaque @FT_Incremental handle provided by the client\r\n   *     application.\r\n   *\r\n   *   data ::\r\n   *     A structure describing the glyph data bytes (which will be accessed\r\n   *     as a read-only byte block).\r\n   *\r\n   */\r\n  typedef void\r\n  (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental  incremental,\r\n                                       FT_Data*        data );\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_GetGlyphMetricsFunc\r\n   *\r\n   * @description:\r\n   *   A function used to retrieve the basic metrics of a given glyph index\r\n   *   before accessing its data.  This is necessary because, in certain\r\n   *   formats like TrueType, the metrics are stored in a different place from\r\n   *   the glyph images proper.\r\n   *\r\n   * @input:\r\n   *   incremental ::\r\n   *     A handle to an opaque @FT_Incremental handle provided by the client\r\n   *     application.\r\n   *\r\n   *   glyph_index ::\r\n   *     Index of relevant glyph.\r\n   *\r\n   *   vertical ::\r\n   *     If true, return vertical metrics.\r\n   *\r\n   *   ametrics ::\r\n   *     This parameter is used for both input and output.\r\n   *     The original glyph metrics, if any, in font units.  If metrics are\r\n   *     not available all the values must be set to zero.\r\n   *\r\n   * @output:\r\n   *   ametrics ::\r\n   *     The replacement glyph metrics in font units.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*FT_Incremental_GetGlyphMetricsFunc)\r\n                      ( FT_Incremental              incremental,\r\n                        FT_UInt                     glyph_index,\r\n                        FT_Bool                     vertical,\r\n                        FT_Incremental_MetricsRec  *ametrics );\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_FuncsRec\r\n   *\r\n   * @description:\r\n   *   A table of functions for accessing fonts that load data\r\n   *   incrementally.  Used in @FT_Incremental_InterfaceRec.\r\n   *\r\n   * @fields:\r\n   *   get_glyph_data ::\r\n   *     The function to get glyph data.  Must not be null.\r\n   *\r\n   *   free_glyph_data ::\r\n   *     The function to release glyph data.  Must not be null.\r\n   *\r\n   *   get_glyph_metrics ::\r\n   *     The function to get glyph metrics.  May be null if the font does\r\n   *     not provide overriding glyph metrics.\r\n   *\r\n   */\r\n  typedef struct  FT_Incremental_FuncsRec_\r\n  {\r\n    FT_Incremental_GetGlyphDataFunc     get_glyph_data;\r\n    FT_Incremental_FreeGlyphDataFunc    free_glyph_data;\r\n    FT_Incremental_GetGlyphMetricsFunc  get_glyph_metrics;\r\n\r\n  } FT_Incremental_FuncsRec;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_InterfaceRec\r\n   *\r\n   * @description:\r\n   *   A structure to be used with @FT_Open_Face to indicate that the user\r\n   *   wants to support incremental glyph loading.  You should use it with\r\n   *   @FT_PARAM_TAG_INCREMENTAL as in the following example:\r\n   *\r\n   *     {\r\n   *       FT_Incremental_InterfaceRec  inc_int;\r\n   *       FT_Parameter                 parameter;\r\n   *       FT_Open_Args                 open_args;\r\n   *\r\n   *\r\n   *       // set up incremental descriptor\r\n   *       inc_int.funcs  = my_funcs;\r\n   *       inc_int.object = my_object;\r\n   *\r\n   *       // set up optional parameter\r\n   *       parameter.tag  = FT_PARAM_TAG_INCREMENTAL;\r\n   *       parameter.data = &inc_int;\r\n   *\r\n   *       // set up FT_Open_Args structure\r\n   *       open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;\r\n   *       open_args.pathname   = my_font_pathname;\r\n   *       open_args.num_params = 1;\r\n   *       open_args.params     = &parameter; // we use one optional argument\r\n   *\r\n   *       // open the font\r\n   *       error = FT_Open_Face( library, &open_args, index, &face );\r\n   *       ...\r\n   *     }\r\n   *\r\n   */\r\n  typedef struct  FT_Incremental_InterfaceRec_\r\n  {\r\n    const FT_Incremental_FuncsRec*  funcs;\r\n    FT_Incremental                  object;\r\n\r\n  } FT_Incremental_InterfaceRec;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_Interface\r\n   *\r\n   * @description:\r\n   *   A pointer to an @FT_Incremental_InterfaceRec structure.\r\n   *\r\n   */\r\n  typedef FT_Incremental_InterfaceRec*   FT_Incremental_Interface;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @constant:\r\n   *   FT_PARAM_TAG_INCREMENTAL\r\n   *\r\n   * @description:\r\n   *   A constant used as the tag of @FT_Parameter structures to indicate\r\n   *   an incremental loading object to be used by FreeType.\r\n   *\r\n   */\r\n#define FT_PARAM_TAG_INCREMENTAL  FT_MAKE_TAG( 'i', 'n', 'c', 'r' )\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTINCREM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftlcdfil.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlcdfil.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for color filtering of subpixel bitmap glyphs           */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2007, 2008, 2010 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FT_LCD_FILTER_H__\r\n#define __FT_LCD_FILTER_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @section:\r\n   *   lcd_filtering\r\n   *\r\n   * @title:\r\n   *   LCD Filtering\r\n   *\r\n   * @abstract:\r\n   *   Reduce color fringes of LCD-optimized bitmaps.\r\n   *\r\n   * @description:\r\n   *   The @FT_Library_SetLcdFilter API can be used to specify a low-pass\r\n   *   filter which is then applied to LCD-optimized bitmaps generated\r\n   *   through @FT_Render_Glyph.  This is useful to reduce color fringes\r\n   *   which would occur with unfiltered rendering.\r\n   *\r\n   *   Note that no filter is active by default, and that this function is\r\n   *   *not* implemented in default builds of the library.  You need to\r\n   *   #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file\r\n   *   in order to activate it.\r\n   */\r\n\r\n\r\n  /****************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_LcdFilter\r\n   *\r\n   * @description:\r\n   *   A list of values to identify various types of LCD filters.\r\n   *\r\n   * @values:\r\n   *   FT_LCD_FILTER_NONE ::\r\n   *     Do not perform filtering.  When used with subpixel rendering, this\r\n   *     results in sometimes severe color fringes.\r\n   *\r\n   *   FT_LCD_FILTER_DEFAULT ::\r\n   *     The default filter reduces color fringes considerably, at the cost\r\n   *     of a slight blurriness in the output.\r\n   *\r\n   *   FT_LCD_FILTER_LIGHT ::\r\n   *     The light filter is a variant that produces less blurriness at the\r\n   *     cost of slightly more color fringes than the default one.  It might\r\n   *     be better, depending on taste, your monitor, or your personal vision.\r\n   *\r\n   *   FT_LCD_FILTER_LEGACY ::\r\n   *     This filter corresponds to the original libXft color filter.  It\r\n   *     provides high contrast output but can exhibit really bad color\r\n   *     fringes if glyphs are not extremely well hinted to the pixel grid.\r\n   *     In other words, it only works well if the TrueType bytecode\r\n   *     interpreter is enabled *and* high-quality hinted fonts are used.\r\n   *\r\n   *     This filter is only provided for comparison purposes, and might be\r\n   *     disabled or stay unsupported in the future.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n  typedef enum  FT_LcdFilter_\r\n  {\r\n    FT_LCD_FILTER_NONE    = 0,\r\n    FT_LCD_FILTER_DEFAULT = 1,\r\n    FT_LCD_FILTER_LIGHT   = 2,\r\n    FT_LCD_FILTER_LEGACY  = 16,\r\n\r\n    FT_LCD_FILTER_MAX   /* do not remove */\r\n\r\n  } FT_LcdFilter;\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Library_SetLcdFilter\r\n   *\r\n   * @description:\r\n   *   This function is used to apply color filtering to LCD decimated\r\n   *   bitmaps, like the ones used when calling @FT_Render_Glyph with\r\n   *   @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.\r\n   *\r\n   * @input:\r\n   *   library ::\r\n   *     A handle to the target library instance.\r\n   *\r\n   *   filter ::\r\n   *     The filter type.\r\n   *\r\n   *     You can use @FT_LCD_FILTER_NONE here to disable this feature, or\r\n   *     @FT_LCD_FILTER_DEFAULT to use a default filter that should work\r\n   *     well on most LCD screens.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   This feature is always disabled by default.  Clients must make an\r\n   *   explicit call to this function with a `filter' value other than\r\n   *   @FT_LCD_FILTER_NONE in order to enable it.\r\n   *\r\n   *   Due to *PATENTS* covering subpixel rendering, this function doesn't\r\n   *   do anything except returning `FT_Err_Unimplemented_Feature' if the\r\n   *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not\r\n   *   defined in your build of the library, which should correspond to all\r\n   *   default builds of FreeType.\r\n   *\r\n   *   The filter affects glyph bitmaps rendered through @FT_Render_Glyph,\r\n   *   @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char.\r\n   *\r\n   *   It does _not_ affect the output of @FT_Outline_Render and\r\n   *   @FT_Outline_Get_Bitmap.\r\n   *\r\n   *   If this feature is activated, the dimensions of LCD glyph bitmaps are\r\n   *   either larger or taller than the dimensions of the corresponding\r\n   *   outline with regards to the pixel grid.  For example, for\r\n   *   @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and\r\n   *   up to 3~pixels to the right.\r\n   *\r\n   *   The bitmap offset values are adjusted correctly, so clients shouldn't\r\n   *   need to modify their layout and glyph positioning code when enabling\r\n   *   the filter.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Library_SetLcdFilter( FT_Library    library,\r\n                           FT_LcdFilter  filter );\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Library_SetLcdFilterWeights\r\n   *\r\n   * @description:\r\n   *   Use this function to override the filter weights selected by\r\n   *   @FT_Library_SetLcdFilter.  By default, FreeType uses the quintuple\r\n   *   (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10,\r\n   *   0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and\r\n   *   FT_LCD_FILTER_LEGACY.\r\n   *\r\n   * @input:\r\n   *   library ::\r\n   *     A handle to the target library instance.\r\n   *\r\n   *   weights ::\r\n   *     A pointer to an array; the function copies the first five bytes and\r\n   *     uses them to specify the filter weights.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   Due to *PATENTS* covering subpixel rendering, this function doesn't\r\n   *   do anything except returning `FT_Err_Unimplemented_Feature' if the\r\n   *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not\r\n   *   defined in your build of the library, which should correspond to all\r\n   *   default builds of FreeType.\r\n   *\r\n   *   This function must be called after @FT_Library_SetLcdFilter to have\r\n   *   any effect.\r\n   *\r\n   * @since:\r\n   *   2.4.0\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Library_SetLcdFilterWeights( FT_Library      library,\r\n                                  unsigned char  *weights );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FT_LCD_FILTER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftlist.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlist.h                                                               */\r\n/*                                                                         */\r\n/*    Generic list support for FreeType (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2007, 2010 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  This file implements functions relative to list processing.  Its     */\r\n  /*  data structures are defined in `freetype.h'.                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTLIST_H__\r\n#define __FTLIST_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    list_processing                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    List Processing                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Simple management of lists.                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains various definitions related to list          */\r\n  /*    processing using doubly-linked nodes.                              */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_List                                                            */\r\n  /*    FT_ListNode                                                        */\r\n  /*    FT_ListRec                                                         */\r\n  /*    FT_ListNodeRec                                                     */\r\n  /*                                                                       */\r\n  /*    FT_List_Add                                                        */\r\n  /*    FT_List_Insert                                                     */\r\n  /*    FT_List_Find                                                       */\r\n  /*    FT_List_Remove                                                     */\r\n  /*    FT_List_Up                                                         */\r\n  /*    FT_List_Iterate                                                    */\r\n  /*    FT_List_Iterator                                                   */\r\n  /*    FT_List_Finalize                                                   */\r\n  /*    FT_List_Destructor                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Find                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Find the list node for a given listed object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*    data :: The address of the listed object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    List node.  NULL if it wasn't found.                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ListNode )\r\n  FT_List_Find( FT_List  list,\r\n                void*    data );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Add                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Append an element to the end of a list.                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*    node :: The node to append.                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Add( FT_List      list,\r\n               FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Insert                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Insert an element at the head of a list.                           */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to parent list.                                  */\r\n  /*    node :: The node to insert.                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Insert( FT_List      list,\r\n                  FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Remove                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Remove a node from a list.  This function doesn't check whether    */\r\n  /*    the node is in the list!                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    node :: The node to remove.                                        */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Remove( FT_List      list,\r\n                  FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Up                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Move a node to the head/top of a list.  Used to maintain LRU       */\r\n  /*    lists.                                                             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*    node :: The node to move.                                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Up( FT_List      list,\r\n              FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_List_Iterator                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An FT_List iterator function which is called during a list parse   */\r\n  /*    by @FT_List_Iterate.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    node :: The current iteration list node.                           */\r\n  /*                                                                       */\r\n  /*    user :: A typeless pointer passed to @FT_List_Iterate.             */\r\n  /*            Can be used to point to the iteration's state.             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_List_Iterator)( FT_ListNode  node,\r\n                       void*        user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Iterate                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parse a list and calls a given iterator function on each element.  */\r\n  /*    Note that parsing is stopped as soon as one of the iterator calls  */\r\n  /*    returns a non-zero value.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    list     :: A handle to the list.                                  */\r\n  /*    iterator :: An iterator function, called on each node of the list. */\r\n  /*    user     :: A user-supplied field which is passed as the second    */\r\n  /*                argument to the iterator.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result (a FreeType error code) of the last iterator call.      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_List_Iterate( FT_List           list,\r\n                   FT_List_Iterator  iterator,\r\n                   void*             user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_List_Destructor                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An @FT_List iterator function which is called during a list        */\r\n  /*    finalization by @FT_List_Finalize to destroy all elements in a     */\r\n  /*    given list.                                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    system :: The current system object.                               */\r\n  /*                                                                       */\r\n  /*    data   :: The current object to destroy.                           */\r\n  /*                                                                       */\r\n  /*    user   :: A typeless pointer passed to @FT_List_Iterate.  It can   */\r\n  /*              be used to point to the iteration's state.               */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_List_Destructor)( FT_Memory  memory,\r\n                         void*      data,\r\n                         void*      user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Finalize                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy all elements in the list as well as the list itself.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    list    :: A handle to the list.                                   */\r\n  /*                                                                       */\r\n  /*    destroy :: A list destructor that will be applied to each element  */\r\n  /*               of the list.                                            */\r\n  /*                                                                       */\r\n  /*    memory  :: The current memory object which handles deallocation.   */\r\n  /*                                                                       */\r\n  /*    user    :: A user-supplied field which is passed as the last       */\r\n  /*               argument to the destructor.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function expects that all nodes added by @FT_List_Add or      */\r\n  /*    @FT_List_Insert have been dynamically allocated.                   */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Finalize( FT_List             list,\r\n                    FT_List_Destructor  destroy,\r\n                    FT_Memory           memory,\r\n                    void*               user );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTLIST_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftlzw.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlzw.h                                                                */\r\n/*                                                                         */\r\n/*    LZW-compressed stream support.                                       */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTLZW_H__\r\n#define __FTLZW_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    lzw                                                                */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    LZW Streams                                                        */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Using LZW-compressed font files.                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of LZW-specific functions.   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n /************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Stream_OpenLZW\r\n  *\r\n  * @description:\r\n  *   Open a new stream to parse LZW-compressed font files.  This is\r\n  *   mainly used to support the compressed `*.pcf.Z' fonts that come\r\n  *   with XFree86.\r\n  *\r\n  * @input:\r\n  *   stream :: The target embedding stream.\r\n  *\r\n  *   source :: The source stream.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   The source stream must be opened _before_ calling this function.\r\n  *\r\n  *   Calling the internal function `FT_Stream_Close' on the new stream will\r\n  *   *not* call `FT_Stream_Close' on the source stream.  None of the stream\r\n  *   objects will be released to the heap.\r\n  *\r\n  *   The stream implementation is very basic and resets the decompression\r\n  *   process each time seeking backwards is needed within the stream\r\n  *\r\n  *   In certain builds of the library, LZW compression recognition is\r\n  *   automatically handled when calling @FT_New_Face or @FT_Open_Face.\r\n  *   This means that if no font driver is capable of handling the raw\r\n  *   compressed file, the library will try to open a LZW stream from it\r\n  *   and re-open the face with it.\r\n  *\r\n  *   This function may return `FT_Err_Unimplemented_Feature' if your build\r\n  *   of FreeType was not compiled with LZW support.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stream_OpenLZW( FT_Stream  stream,\r\n                     FT_Stream  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTLZW_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftmac.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmac.h                                                                */\r\n/*                                                                         */\r\n/*    Additional Mac-specific API.                                         */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2004, 2006, 2007 by                               */\r\n/*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* NOTE: Include this file after <freetype/freetype.h> and after any       */\r\n/*       Mac-specific headers (because this header uses Mac types such as  */\r\n/*       Handle, FSSpec, FSRef, etc.)                                      */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMAC_H__\r\n#define __FTMAC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n/* gcc-3.4.1 and later can warn about functions tagged as deprecated */\r\n#ifndef FT_DEPRECATED_ATTRIBUTE\r\n#if defined(__GNUC__)                                               && \\\r\n    ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))\r\n#define FT_DEPRECATED_ATTRIBUTE  __attribute__((deprecated))\r\n#else\r\n#define FT_DEPRECATED_ATTRIBUTE\r\n#endif\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    mac_specific                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Mac Specific Interface                                             */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Only available on the Macintosh.                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The following definitions are only available if FreeType is        */\r\n  /*    compiled on a Macintosh.                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FOND                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new face object from a FOND resource.                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fond       :: A FOND resource.                                     */\r\n  /*                                                                       */\r\n  /*    face_index :: Only supported for the -1 `sanity check' special     */\r\n  /*                  case.                                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Notes>                                                               */\r\n  /*    This function can be used to create @FT_Face objects from fonts    */\r\n  /*    that are installed in the system as follows.                       */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      fond = GetResource( 'FOND', fontName );                          */\r\n  /*      error = FT_New_Face_From_FOND( library, fond, 0, &face );        */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face_From_FOND( FT_Library  library,\r\n                         Handle      fond,\r\n                         FT_Long     face_index,\r\n                         FT_Face    *aface )\r\n                       FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GetFile_From_Mac_Name                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return an FSSpec for the disk file containing the named font.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fontName   :: Mac OS name of the font (e.g., Times New Roman       */\r\n  /*                  Bold).                                               */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    pathSpec   :: FSSpec to the file.  For passing to                  */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /*    face_index :: Index of the face.  For passing to                   */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GetFile_From_Mac_Name( const char*  fontName,\r\n                            FSSpec*      pathSpec,\r\n                            FT_Long*     face_index )\r\n                          FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GetFile_From_Mac_ATS_Name                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return an FSSpec for the disk file containing the named font.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fontName   :: Mac OS name of the font in ATS framework.            */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    pathSpec   :: FSSpec to the file. For passing to                   */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /*    face_index :: Index of the face. For passing to                    */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GetFile_From_Mac_ATS_Name( const char*  fontName,\r\n                                FSSpec*      pathSpec,\r\n                                FT_Long*     face_index )\r\n                              FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GetFilePath_From_Mac_ATS_Name                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a pathname of the disk file and face index for given font   */\r\n  /*    name which is handled by ATS framework.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fontName    :: Mac OS name of the font in ATS framework.           */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    path        :: Buffer to store pathname of the file.  For passing  */\r\n  /*                   to @FT_New_Face.  The client must allocate this     */\r\n  /*                   buffer before calling this function.                */\r\n  /*                                                                       */\r\n  /*    maxPathSize :: Lengths of the buffer `path' that client allocated. */\r\n  /*                                                                       */\r\n  /*    face_index  :: Index of the face.  For passing to @FT_New_Face.    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GetFilePath_From_Mac_ATS_Name( const char*  fontName,\r\n                                    UInt8*       path,\r\n                                    UInt32       maxPathSize,\r\n                                    FT_Long*     face_index )\r\n                                  FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FSSpec                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new face object from a given resource and typeface index  */\r\n  /*    using an FSSpec to the font file.                                  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    spec       :: FSSpec to the font file.                             */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the resource.  The      */\r\n  /*                  first face has index~0.                              */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    @FT_New_Face_From_FSSpec is identical to @FT_New_Face except       */\r\n  /*    it accepts an FSSpec instead of a path.                            */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face_From_FSSpec( FT_Library     library,\r\n                           const FSSpec  *spec,\r\n                           FT_Long        face_index,\r\n                           FT_Face       *aface )\r\n                         FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FSRef                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new face object from a given resource and typeface index  */\r\n  /*    using an FSRef to the font file.                                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    spec       :: FSRef to the font file.                              */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the resource.  The      */\r\n  /*                  first face has index~0.                              */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    @FT_New_Face_From_FSRef is identical to @FT_New_Face except        */\r\n  /*    it accepts an FSRef instead of a path.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face_From_FSRef( FT_Library    library,\r\n                          const FSRef  *ref,\r\n                          FT_Long       face_index,\r\n                          FT_Face      *aface )\r\n                        FT_DEPRECATED_ATTRIBUTE;\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTMAC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftmm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmm.h                                                                 */\r\n/*                                                                         */\r\n/*    FreeType Multiple Master font interface (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2004, 2006, 2009 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMM_H__\r\n#define __FTMM_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TYPE1_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    multiple_masters                                                   */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Multiple Masters                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How to manage Multiple Masters fonts.                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The following types and functions are used to manage Multiple      */\r\n  /*    Master fonts, i.e., the selection of specific design instances by  */\r\n  /*    setting design axis coordinates.                                   */\r\n  /*                                                                       */\r\n  /*    George Williams has extended this interface to make it work with   */\r\n  /*    both Type~1 Multiple Masters fonts and GX distortable (var)        */\r\n  /*    fonts.  Some of these routines only work with MM fonts, others     */\r\n  /*    will work with both types.  They are similar enough that a         */\r\n  /*    consistent interface makes sense.                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_MM_Axis                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to model a given axis in design space for  */\r\n  /*    Multiple Masters fonts.                                            */\r\n  /*                                                                       */\r\n  /*    This structure can't be used for GX var fonts.                     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    name    :: The axis's name.                                        */\r\n  /*                                                                       */\r\n  /*    minimum :: The axis's minimum design coordinate.                   */\r\n  /*                                                                       */\r\n  /*    maximum :: The axis's maximum design coordinate.                   */\r\n  /*                                                                       */\r\n  typedef struct  FT_MM_Axis_\r\n  {\r\n    FT_String*  name;\r\n    FT_Long     minimum;\r\n    FT_Long     maximum;\r\n\r\n  } FT_MM_Axis;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Multi_Master                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the axes and space of a Multiple Masters */\r\n  /*    font.                                                              */\r\n  /*                                                                       */\r\n  /*    This structure can't be used for GX var fonts.                     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_axis    :: Number of axes.  Cannot exceed~4.                   */\r\n  /*                                                                       */\r\n  /*    num_designs :: Number of designs; should be normally 2^num_axis    */\r\n  /*                   even though the Type~1 specification strangely      */\r\n  /*                   allows for intermediate designs to be present. This */\r\n  /*                   number cannot exceed~16.                            */\r\n  /*                                                                       */\r\n  /*    axis        :: A table of axis descriptors.                        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Multi_Master_\r\n  {\r\n    FT_UInt     num_axis;\r\n    FT_UInt     num_designs;\r\n    FT_MM_Axis  axis[T1_MAX_MM_AXIS];\r\n\r\n  } FT_Multi_Master;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Var_Axis                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to model a given axis in design space for  */\r\n  /*    Multiple Masters and GX var fonts.                                 */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    name    :: The axis's name.                                        */\r\n  /*               Not always meaningful for GX.                           */\r\n  /*                                                                       */\r\n  /*    minimum :: The axis's minimum design coordinate.                   */\r\n  /*                                                                       */\r\n  /*    def     :: The axis's default design coordinate.                   */\r\n  /*               FreeType computes meaningful default values for MM; it  */\r\n  /*               is then an integer value, not in 16.16 format.          */\r\n  /*                                                                       */\r\n  /*    maximum :: The axis's maximum design coordinate.                   */\r\n  /*                                                                       */\r\n  /*    tag     :: The axis's tag (the GX equivalent to `name').           */\r\n  /*               FreeType provides default values for MM if possible.    */\r\n  /*                                                                       */\r\n  /*    strid   :: The entry in `name' table (another GX version of        */\r\n  /*               `name').                                                */\r\n  /*               Not meaningful for MM.                                  */\r\n  /*                                                                       */\r\n  typedef struct  FT_Var_Axis_\r\n  {\r\n    FT_String*  name;\r\n\r\n    FT_Fixed    minimum;\r\n    FT_Fixed    def;\r\n    FT_Fixed    maximum;\r\n\r\n    FT_ULong    tag;\r\n    FT_UInt     strid;\r\n\r\n  } FT_Var_Axis;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Var_Named_Style                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to model a named style in a GX var font.   */\r\n  /*                                                                       */\r\n  /*    This structure can't be used for MM fonts.                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    coords :: The design coordinates for this style.                   */\r\n  /*              This is an array with one entry for each axis.           */\r\n  /*                                                                       */\r\n  /*    strid  :: The entry in `name' table identifying this style.        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Var_Named_Style_\r\n  {\r\n    FT_Fixed*  coords;\r\n    FT_UInt    strid;\r\n\r\n  } FT_Var_Named_Style;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_MM_Var                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the axes and space of a Multiple Masters */\r\n  /*    or GX var distortable font.                                        */\r\n  /*                                                                       */\r\n  /*    Some fields are specific to one format and not to the other.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_axis        :: The number of axes.  The maximum value is~4 for */\r\n  /*                       MM; no limit in GX.                             */\r\n  /*                                                                       */\r\n  /*    num_designs     :: The number of designs; should be normally       */\r\n  /*                       2^num_axis for MM fonts.  Not meaningful for GX */\r\n  /*                       (where every glyph could have a different       */\r\n  /*                       number of designs).                             */\r\n  /*                                                                       */\r\n  /*    num_namedstyles :: The number of named styles; only meaningful for */\r\n  /*                       GX which allows certain design coordinates to   */\r\n  /*                       have a string ID (in the `name' table)          */\r\n  /*                       associated with them.  The font can tell the    */\r\n  /*                       user that, for example, Weight=1.5 is `Bold'.   */\r\n  /*                                                                       */\r\n  /*    axis            :: A table of axis descriptors.                    */\r\n  /*                       GX fonts contain slightly more data than MM.    */\r\n  /*                                                                       */\r\n  /*    namedstyles     :: A table of named styles.                        */\r\n  /*                       Only meaningful with GX.                        */\r\n  /*                                                                       */\r\n  typedef struct  FT_MM_Var_\r\n  {\r\n    FT_UInt              num_axis;\r\n    FT_UInt              num_designs;\r\n    FT_UInt              num_namedstyles;\r\n    FT_Var_Axis*         axis;\r\n    FT_Var_Named_Style*  namedstyle;\r\n\r\n  } FT_MM_Var;\r\n\r\n\r\n  /* */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Multi_Master                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the Multiple Master descriptor of a given font.           */\r\n  /*                                                                       */\r\n  /*    This function can't be used with GX fonts.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: A handle to the source face.                            */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amaster :: The Multiple Masters descriptor.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Multi_Master( FT_Face           face,\r\n                       FT_Multi_Master  *amaster );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_MM_Var                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the Multiple Master/GX var descriptor of a given font.    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: A handle to the source face.                            */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amaster :: The Multiple Masters/GX var descriptor.                 */\r\n  /*               Allocates a data structure, which the user must free    */\r\n  /*               (a single call to FT_FREE will do it).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_MM_Var( FT_Face      face,\r\n                 FT_MM_Var*  *amaster );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_MM_Design_Coordinates                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    For Multiple Masters fonts, choose an interpolated font design     */\r\n  /*    through design coordinates.                                        */\r\n  /*                                                                       */\r\n  /*    This function can't be used with GX fonts.                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: A handle to the source face.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: The number of design coordinates (must be equal to   */\r\n  /*                  the number of axes in the font).                     */\r\n  /*                                                                       */\r\n  /*    coords     :: An array of design coordinates.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_MM_Design_Coordinates( FT_Face   face,\r\n                                FT_UInt   num_coords,\r\n                                FT_Long*  coords );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Var_Design_Coordinates                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    For Multiple Master or GX Var fonts, choose an interpolated font   */\r\n  /*    design through design coordinates.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: A handle to the source face.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: The number of design coordinates (must be equal to   */\r\n  /*                  the number of axes in the font).                     */\r\n  /*                                                                       */\r\n  /*    coords     :: An array of design coordinates.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Var_Design_Coordinates( FT_Face    face,\r\n                                 FT_UInt    num_coords,\r\n                                 FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_MM_Blend_Coordinates                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    For Multiple Masters and GX var fonts, choose an interpolated font */\r\n  /*    design through normalized blend coordinates.                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: A handle to the source face.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: The number of design coordinates (must be equal to   */\r\n  /*                  the number of axes in the font).                     */\r\n  /*                                                                       */\r\n  /*    coords     :: The design coordinates array (each element must be   */\r\n  /*                  between 0 and 1.0).                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_MM_Blend_Coordinates( FT_Face    face,\r\n                               FT_UInt    num_coords,\r\n                               FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Var_Blend_Coordinates                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is another name of @FT_Set_MM_Blend_Coordinates.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Var_Blend_Coordinates( FT_Face    face,\r\n                                FT_UInt    num_coords,\r\n                                FT_Fixed*  coords );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTMM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftmodapi.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmodapi.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType modules public interface (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2006, 2008-2010, 2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMODAPI_H__\r\n#define __FTMODAPI_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    module_management                                                  */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Module Management                                                  */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How to add, upgrade, remove, and control modules from FreeType.    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The definitions below are used to manage modules within FreeType.  */\r\n  /*    Modules can be added, upgraded, and removed at runtime.            */\r\n  /*    Additionally, some module properties can be controlled also.       */\r\n  /*                                                                       */\r\n  /*    Here is a list of possible values of the `module_name' field in    */\r\n  /*    the @FT_Module_Class structure.                                    */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      autofitter                                                       */\r\n  /*      bdf                                                              */\r\n  /*      cff                                                              */\r\n  /*      gxvalid                                                          */\r\n  /*      otvalid                                                          */\r\n  /*      pcf                                                              */\r\n  /*      pfr                                                              */\r\n  /*      psaux                                                            */\r\n  /*      pshinter                                                         */\r\n  /*      psnames                                                          */\r\n  /*      raster1, raster5                                                 */\r\n  /*      sfnt                                                             */\r\n  /*      smooth, smooth-lcd, smooth-lcdv                                  */\r\n  /*      truetype                                                         */\r\n  /*      type1                                                            */\r\n  /*      type42                                                           */\r\n  /*      t1cid                                                            */\r\n  /*      winfonts                                                         */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Note that the FreeType Cache sub-system is not a FreeType module.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* module bit flags */\r\n#define FT_MODULE_FONT_DRIVER         1  /* this module is a font driver  */\r\n#define FT_MODULE_RENDERER            2  /* this module is a renderer     */\r\n#define FT_MODULE_HINTER              4  /* this module is a glyph hinter */\r\n#define FT_MODULE_STYLER              8  /* this module is a styler       */\r\n\r\n#define FT_MODULE_DRIVER_SCALABLE     0x100   /* the driver supports      */\r\n                                              /* scalable fonts           */\r\n#define FT_MODULE_DRIVER_NO_OUTLINES  0x200   /* the driver does not      */\r\n                                              /* support vector outlines  */\r\n#define FT_MODULE_DRIVER_HAS_HINTER   0x400   /* the driver provides its  */\r\n                                              /* own hinter               */\r\n\r\n\r\n  /* deprecated values */\r\n#define ft_module_font_driver         FT_MODULE_FONT_DRIVER\r\n#define ft_module_renderer            FT_MODULE_RENDERER\r\n#define ft_module_hinter              FT_MODULE_HINTER\r\n#define ft_module_styler              FT_MODULE_STYLER\r\n\r\n#define ft_module_driver_scalable     FT_MODULE_DRIVER_SCALABLE\r\n#define ft_module_driver_no_outlines  FT_MODULE_DRIVER_NO_OUTLINES\r\n#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER\r\n\r\n\r\n  typedef FT_Pointer  FT_Module_Interface;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Constructor                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to initialize (not create) a new module object.    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module :: The module to initialize.                                */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_Module_Constructor)( FT_Module  module );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Destructor                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to finalize (not destroy) a given module object.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module :: The module to finalize.                                  */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Module_Destructor)( FT_Module  module );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Requester                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to query a given module for a specific interface.  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module :: The module to be searched.                               */\r\n  /*                                                                       */\r\n  /*    name ::   The name of the interface in the module.                 */\r\n  /*                                                                       */\r\n  typedef FT_Module_Interface\r\n  (*FT_Module_Requester)( FT_Module    module,\r\n                          const char*  name );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Module_Class                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The module class descriptor.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    module_flags    :: Bit flags describing the module.                */\r\n  /*                                                                       */\r\n  /*    module_size     :: The size of one module object/instance in       */\r\n  /*                       bytes.                                          */\r\n  /*                                                                       */\r\n  /*    module_name     :: The name of the module.                         */\r\n  /*                                                                       */\r\n  /*    module_version  :: The version, as a 16.16 fixed number            */\r\n  /*                       (major.minor).                                  */\r\n  /*                                                                       */\r\n  /*    module_requires :: The version of FreeType this module requires,   */\r\n  /*                       as a 16.16 fixed number (major.minor).  Starts  */\r\n  /*                       at version 2.0, i.e., 0x20000.                  */\r\n  /*                                                                       */\r\n  /*    module_init     :: The initializing function.                      */\r\n  /*                                                                       */\r\n  /*    module_done     :: The finalizing function.                        */\r\n  /*                                                                       */\r\n  /*    get_interface   :: The interface requesting function.              */\r\n  /*                                                                       */\r\n  typedef struct  FT_Module_Class_\r\n  {\r\n    FT_ULong               module_flags;\r\n    FT_Long                module_size;\r\n    const FT_String*       module_name;\r\n    FT_Fixed               module_version;\r\n    FT_Fixed               module_requires;\r\n\r\n    const void*            module_interface;\r\n\r\n    FT_Module_Constructor  module_init;\r\n    FT_Module_Destructor   module_done;\r\n    FT_Module_Requester    get_interface;\r\n\r\n  } FT_Module_Class;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Add_Module                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Add a new module to a given library instance.                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library :: A handle to the library object.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    clazz   :: A pointer to class descriptor for the module.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An error will be returned if a module already exists by that name, */\r\n  /*    or if the module requires a version of FreeType that is too great. */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Add_Module( FT_Library              library,\r\n                 const FT_Module_Class*  clazz );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Module                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Find a module by its name.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library     :: A handle to the library object.                     */\r\n  /*                                                                       */\r\n  /*    module_name :: The module's name (as an ASCII string).             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A module handle.  0~if none was found.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    FreeType's internal modules aren't documented very well, and you   */\r\n  /*    should look up the source code for details.                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Module )\r\n  FT_Get_Module( FT_Library   library,\r\n                 const char*  module_name );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Remove_Module                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Remove a given module from a library instance.                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library :: A handle to a library object.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module  :: A handle to a module object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The module object is destroyed by the function in case of success. */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Remove_Module( FT_Library  library,\r\n                    FT_Module   module );\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Property_Set\r\n   *\r\n   * @description:\r\n   *    Set a property for a given module.\r\n   *\r\n   * @input:\r\n   *    library ::\r\n   *       A handle to the library the module is part of.\r\n   *\r\n   *    module_name ::\r\n   *       The module name.\r\n   *\r\n   *    property_name ::\r\n   *       The property name.  Properties are described in the `Synopsis'\r\n   *       subsection of the module's documentation.\r\n   *\r\n   *       Note that only a few modules have properties.\r\n   *\r\n   *    value ::\r\n   *       A generic pointer to a variable or structure which gives the new\r\n   *       value of the property.  The exact definition of `value' is\r\n   *       dependent on the property; see the `Synopsis' subsection of the\r\n   *       module's documentation.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    If `module_name' isn't a valid module name, or `property_name'\r\n   *    doesn't specify a valid property, or if `value' doesn't represent a\r\n   *    valid value for the given property, an error is returned.\r\n   *\r\n   *    The following example sets property `bar' (a simple integer) in\r\n   *    module `foo' to value~1.\r\n   *\r\n   *    {\r\n   *      FT_UInt  bar;\r\n   *\r\n   *\r\n   *      bar = 1;\r\n   *      FT_Property_Set( library, \"foo\", \"bar\", &bar );\r\n   *    }\r\n   *\r\n   *    It is not possible to set properties of the FreeType Cache\r\n   *    sub-system with FT_Property_Set; use @FTC_Property_Set instead.\r\n   *\r\n   *  @since:\r\n   *    2.4.11\r\n   *\r\n   */\r\n  FT_Error\r\n  FT_Property_Set( FT_Library        library,\r\n                   const FT_String*  module_name,\r\n                   const FT_String*  property_name,\r\n                   const void*       value );\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Property_Get\r\n   *\r\n   * @description:\r\n   *    Get a module's property value.\r\n   *\r\n   * @input:\r\n   *    library ::\r\n   *       A handle to the library the module is part of.\r\n   *\r\n   *    module_name ::\r\n   *       The module name.\r\n   *\r\n   *    property_name ::\r\n   *       The property name.  Properties are described in the `Synopsis'\r\n   *       subsection of the module's documentation.\r\n   *\r\n   * @inout:\r\n   *    value ::\r\n   *       A generic pointer to a variable or structure which gives the\r\n   *       value of the property.  The exact definition of `value' is\r\n   *       dependent on the property; see the `Synopsis' subsection of the\r\n   *       module's documentation.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    If `module_name' isn't a valid module name, or `property_name'\r\n   *    doesn't specify a valid property, or if `value' doesn't represent a\r\n   *    valid value for the given property, an error is returned.\r\n   *\r\n   *    The following example gets property `baz' (a range) in module `foo'.\r\n   *\r\n   *    {\r\n   *      typedef  range_\r\n   *      {\r\n   *        FT_Int32  min;\r\n   *        FT_Int32  max;\r\n   *\r\n   *      } range;\r\n   *\r\n   *      range  baz;\r\n   *\r\n   *\r\n   *      FT_Property_Get( library, \"foo\", \"baz\", &baz );\r\n   *    }\r\n   *\r\n   *    It is not possible to retrieve properties of the FreeType Cache\r\n   *    sub-system with FT_Property_Get; use @FTC_Property_Get instead.\r\n   *\r\n   *  @since:\r\n   *    2.4.11\r\n   *\r\n   */\r\n  FT_Error\r\n  FT_Property_Get( FT_Library        library,\r\n                   const FT_String*  module_name,\r\n                   const FT_String*  property_name,\r\n                   void*             value );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Reference_Library                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A counter gets initialized to~1 at the time an @FT_Library         */\r\n  /*    structure is created.  This function increments the counter.       */\r\n  /*    @FT_Done_Library then only destroys a library if the counter is~1, */\r\n  /*    otherwise it simply decrements the counter.                        */\r\n  /*                                                                       */\r\n  /*    This function helps in managing life-cycles of structures which    */\r\n  /*    reference @FT_Library objects.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a target library object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.4.2                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Reference_Library( FT_Library  library );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Library                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to create a new FreeType library instance    */\r\n  /*    from a given memory object.  It is thus possible to use libraries  */\r\n  /*    with distinct memory allocators within the same program.           */\r\n  /*                                                                       */\r\n  /*    Normally, you would call this function (followed by a call to      */\r\n  /*    @FT_Add_Default_Modules or a series of calls to @FT_Add_Module)    */\r\n  /*    instead of @FT_Init_FreeType to initialize the FreeType library.   */\r\n  /*                                                                       */\r\n  /*    Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a      */\r\n  /*    library instance.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory   :: A handle to the original memory object.                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    alibrary :: A pointer to handle of a new library object.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Library.                                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Library( FT_Memory    memory,\r\n                  FT_Library  *alibrary );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Library                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard a given library object.  This closes all drivers and       */\r\n  /*    discards all resource objects.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to the target library.                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Library.                                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_Library( FT_Library  library );\r\n\r\n/* */\r\n\r\n  typedef void\r\n  (*FT_DebugHook_Func)( void*  arg );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Debug_Hook                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set a debug hook function for debugging the interpreter of a font  */\r\n  /*    format.                                                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hook_index :: The index of the debug hook.  You should use the     */\r\n  /*                  values defined in `ftobjs.h', e.g.,                  */\r\n  /*                  `FT_DEBUG_HOOK_TRUETYPE'.                            */\r\n  /*                                                                       */\r\n  /*    debug_hook :: The function used to debug the interpreter.          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Currently, four debug hook slots are available, but only two (for  */\r\n  /*    the TrueType and the Type~1 interpreter) are defined.              */\r\n  /*                                                                       */\r\n  /*    Since the internal headers of FreeType are no longer installed,    */\r\n  /*    the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly.      */\r\n  /*    This is a bug and will be fixed in a forthcoming release.          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Set_Debug_Hook( FT_Library         library,\r\n                     FT_UInt            hook_index,\r\n                     FT_DebugHook_Func  debug_hook );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Add_Default_Modules                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Add the set of default drivers to a given library object.          */\r\n  /*    This is only useful when you create a library object with          */\r\n  /*    @FT_New_Library (usually to plug a custom memory manager).         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library :: A handle to a new library object.                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Add_Default_Modules( FT_Library  library );\r\n\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @section:\r\n   *   truetype_engine\r\n   *\r\n   * @title:\r\n   *   The TrueType Engine\r\n   *\r\n   * @abstract:\r\n   *   TrueType bytecode support.\r\n   *\r\n   * @description:\r\n   *   This section contains a function used to query the level of TrueType\r\n   *   bytecode support compiled in this version of the library.\r\n   *\r\n   */\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   *  @enum:\r\n   *     FT_TrueTypeEngineType\r\n   *\r\n   *  @description:\r\n   *     A list of values describing which kind of TrueType bytecode\r\n   *     engine is implemented in a given FT_Library instance.  It is used\r\n   *     by the @FT_Get_TrueType_Engine_Type function.\r\n   *\r\n   *  @values:\r\n   *     FT_TRUETYPE_ENGINE_TYPE_NONE ::\r\n   *       The library doesn't implement any kind of bytecode interpreter.\r\n   *\r\n   *     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::\r\n   *       The library implements a bytecode interpreter that doesn't\r\n   *       support the patented operations of the TrueType virtual machine.\r\n   *\r\n   *       Its main use is to load certain Asian fonts which position and\r\n   *       scale glyph components with bytecode instructions.  It produces\r\n   *       bad output for most other fonts.\r\n   *\r\n   *     FT_TRUETYPE_ENGINE_TYPE_PATENTED ::\r\n   *       The library implements a bytecode interpreter that covers\r\n   *       the full instruction set of the TrueType virtual machine (this\r\n   *       was governed by patents until May 2010, hence the name).\r\n   *\r\n   *  @since:\r\n   *     2.2\r\n   *\r\n   */\r\n  typedef enum  FT_TrueTypeEngineType_\r\n  {\r\n    FT_TRUETYPE_ENGINE_TYPE_NONE = 0,\r\n    FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,\r\n    FT_TRUETYPE_ENGINE_TYPE_PATENTED\r\n\r\n  } FT_TrueTypeEngineType;\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   *  @func:\r\n   *     FT_Get_TrueType_Engine_Type\r\n   *\r\n   *  @description:\r\n   *     Return an @FT_TrueTypeEngineType value to indicate which level of\r\n   *     the TrueType virtual machine a given library instance supports.\r\n   *\r\n   *  @input:\r\n   *     library ::\r\n   *       A library instance.\r\n   *\r\n   *  @return:\r\n   *     A value indicating which level is supported.\r\n   *\r\n   *  @since:\r\n   *     2.2\r\n   *\r\n   */\r\n  FT_EXPORT( FT_TrueTypeEngineType )\r\n  FT_Get_TrueType_Engine_Type( FT_Library  library );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTMODAPI_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftmoderr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmoderr.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType module error offsets (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2004, 2005, 2010 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the FreeType module error offsets.        */\r\n  /*                                                                       */\r\n  /* The lower byte gives the error code, the higher byte gives the        */\r\n  /* module.  The base module has error offset 0.  For example, the error  */\r\n  /* `FT_Err_Invalid_File_Format' has value 0x003, the error               */\r\n  /* `TT_Err_Invalid_File_Format' has value 0x1103, the error              */\r\n  /* `T1_Err_Invalid_File_Format' has value 0x1203, etc.                   */\r\n  /*                                                                       */\r\n  /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h   */\r\n  /* to make the higher byte always zero (disabling the module error       */\r\n  /* mechanism).                                                           */\r\n  /*                                                                       */\r\n  /* It can also be used to create a module error message table easily     */\r\n  /* with something like                                                   */\r\n  /*                                                                       */\r\n  /*   {                                                                   */\r\n  /*     #undef __FTMODERR_H__                                             */\r\n  /*     #define FT_MODERRDEF( e, v, s )  { FT_Mod_Err_ ## e, s },         */\r\n  /*     #define FT_MODERR_START_LIST     {                                */\r\n  /*     #define FT_MODERR_END_LIST       { 0, 0 } };                      */\r\n  /*                                                                       */\r\n  /*     const struct                                                      */\r\n  /*     {                                                                 */\r\n  /*       int          mod_err_offset;                                    */\r\n  /*       const char*  mod_err_msg                                        */\r\n  /*     } ft_mod_errors[] =                                               */\r\n  /*                                                                       */\r\n  /*     #include FT_MODULE_ERRORS_H                                       */\r\n  /*   }                                                                   */\r\n  /*                                                                       */\r\n  /* To use such a table, all errors must be ANDed with 0xFF00 to remove   */\r\n  /* the error code.                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTMODERR_H__\r\n#define __FTMODERR_H__\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                       SETUP MACROS                      *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#undef  FT_NEED_EXTERN_C\r\n\r\n#ifndef FT_MODERRDEF\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\r\n#define FT_MODERRDEF( e, v, s )  FT_Mod_Err_ ## e = v,\r\n#else\r\n#define FT_MODERRDEF( e, v, s )  FT_Mod_Err_ ## e = 0,\r\n#endif\r\n\r\n#define FT_MODERR_START_LIST  enum {\r\n#define FT_MODERR_END_LIST    FT_Mod_Err_Max };\r\n\r\n#ifdef __cplusplus\r\n#define FT_NEED_EXTERN_C\r\n  extern \"C\" {\r\n#endif\r\n\r\n#endif /* !FT_MODERRDEF */\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****               LIST MODULE ERROR BASES                   *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#ifdef FT_MODERR_START_LIST\r\n  FT_MODERR_START_LIST\r\n#endif\r\n\r\n\r\n  FT_MODERRDEF( Base,      0x000, \"base module\" )\r\n  FT_MODERRDEF( Autofit,   0x100, \"autofitter module\" )\r\n  FT_MODERRDEF( BDF,       0x200, \"BDF module\" )\r\n  FT_MODERRDEF( Bzip2,     0x300, \"Bzip2 module\" )\r\n  FT_MODERRDEF( Cache,     0x400, \"cache module\" )\r\n  FT_MODERRDEF( CFF,       0x500, \"CFF module\" )\r\n  FT_MODERRDEF( CID,       0x600, \"CID module\" )\r\n  FT_MODERRDEF( Gzip,      0x700, \"Gzip module\" )\r\n  FT_MODERRDEF( LZW,       0x800, \"LZW module\" )\r\n  FT_MODERRDEF( OTvalid,   0x900, \"OpenType validation module\" )\r\n  FT_MODERRDEF( PCF,       0xA00, \"PCF module\" )\r\n  FT_MODERRDEF( PFR,       0xB00, \"PFR module\" )\r\n  FT_MODERRDEF( PSaux,     0xC00, \"PS auxiliary module\" )\r\n  FT_MODERRDEF( PShinter,  0xD00, \"PS hinter module\" )\r\n  FT_MODERRDEF( PSnames,   0xE00, \"PS names module\" )\r\n  FT_MODERRDEF( Raster,    0xF00, \"raster module\" )\r\n  FT_MODERRDEF( SFNT,     0x1000, \"SFNT module\" )\r\n  FT_MODERRDEF( Smooth,   0x1100, \"smooth raster module\" )\r\n  FT_MODERRDEF( TrueType, 0x1200, \"TrueType module\" )\r\n  FT_MODERRDEF( Type1,    0x1300, \"Type 1 module\" )\r\n  FT_MODERRDEF( Type42,   0x1400, \"Type 42 module\" )\r\n  FT_MODERRDEF( Winfonts, 0x1500, \"Windows FON/FNT module\" )\r\n\r\n\r\n#ifdef FT_MODERR_END_LIST\r\n  FT_MODERR_END_LIST\r\n#endif\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                      CLEANUP                            *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#ifdef FT_NEED_EXTERN_C\r\n  }\r\n#endif\r\n\r\n#undef FT_MODERR_START_LIST\r\n#undef FT_MODERR_END_LIST\r\n#undef FT_MODERRDEF\r\n#undef FT_NEED_EXTERN_C\r\n\r\n\r\n#endif /* __FTMODERR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftotval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftotval.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating OpenType tables (specification).         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2007 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/*                                                                         */\r\n/* Warning: This module might be moved to a different library in the       */\r\n/*          future to avoid a tight dependency between FreeType and the    */\r\n/*          OpenType specification.                                        */\r\n/*                                                                         */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTOTVAL_H__\r\n#define __FTOTVAL_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    ot_validation                                                      */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    OpenType Validation                                                */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    An API to validate OpenType tables.                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of functions to validate     */\r\n  /*    some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @enum:\r\n  *    FT_VALIDATE_OTXXX\r\n  *\r\n  * @description:\r\n  *    A list of bit-field constants used with @FT_OpenType_Validate to\r\n  *    indicate which OpenType tables should be validated.\r\n  *\r\n  * @values:\r\n  *    FT_VALIDATE_BASE ::\r\n  *      Validate BASE table.\r\n  *\r\n  *    FT_VALIDATE_GDEF ::\r\n  *      Validate GDEF table.\r\n  *\r\n  *    FT_VALIDATE_GPOS ::\r\n  *      Validate GPOS table.\r\n  *\r\n  *    FT_VALIDATE_GSUB ::\r\n  *      Validate GSUB table.\r\n  *\r\n  *    FT_VALIDATE_JSTF ::\r\n  *      Validate JSTF table.\r\n  *\r\n  *    FT_VALIDATE_MATH ::\r\n  *      Validate MATH table.\r\n  *\r\n  *    FT_VALIDATE_OT ::\r\n  *      Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).\r\n  *\r\n  */\r\n#define FT_VALIDATE_BASE  0x0100\r\n#define FT_VALIDATE_GDEF  0x0200\r\n#define FT_VALIDATE_GPOS  0x0400\r\n#define FT_VALIDATE_GSUB  0x0800\r\n#define FT_VALIDATE_JSTF  0x1000\r\n#define FT_VALIDATE_MATH  0x2000\r\n\r\n#define FT_VALIDATE_OT  FT_VALIDATE_BASE | \\\r\n                        FT_VALIDATE_GDEF | \\\r\n                        FT_VALIDATE_GPOS | \\\r\n                        FT_VALIDATE_GSUB | \\\r\n                        FT_VALIDATE_JSTF | \\\r\n                        FT_VALIDATE_MATH\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_OpenType_Validate\r\n  *\r\n  * @description:\r\n  *    Validate various OpenType tables to assure that all offsets and\r\n  *    indices are valid.  The idea is that a higher-level library which\r\n  *    actually does the text layout can access those tables without\r\n  *    error checking (which can be quite time consuming).\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    validation_flags ::\r\n  *       A bit field which specifies the tables to be validated.  See\r\n  *       @FT_VALIDATE_OTXXX for possible values.\r\n  *\r\n  * @output:\r\n  *    BASE_table ::\r\n  *       A pointer to the BASE table.\r\n  *\r\n  *    GDEF_table ::\r\n  *       A pointer to the GDEF table.\r\n  *\r\n  *    GPOS_table ::\r\n  *       A pointer to the GPOS table.\r\n  *\r\n  *    GSUB_table ::\r\n  *       A pointer to the GSUB table.\r\n  *\r\n  *    JSTF_table ::\r\n  *       A pointer to the JSTF table.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function only works with OpenType fonts, returning an error\r\n  *   otherwise.\r\n  *\r\n  *   After use, the application should deallocate the five tables with\r\n  *   @FT_OpenType_Free.  A NULL value indicates that the table either\r\n  *   doesn't exist in the font, or the application hasn't asked for\r\n  *   validation.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_OpenType_Validate( FT_Face    face,\r\n                        FT_UInt    validation_flags,\r\n                        FT_Bytes  *BASE_table,\r\n                        FT_Bytes  *GDEF_table,\r\n                        FT_Bytes  *GPOS_table,\r\n                        FT_Bytes  *GSUB_table,\r\n                        FT_Bytes  *JSTF_table );\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_OpenType_Free\r\n  *\r\n  * @description:\r\n  *    Free the buffer allocated by OpenType validator.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    table ::\r\n  *       The pointer to the buffer that is allocated by\r\n  *       @FT_OpenType_Validate.\r\n  *\r\n  * @note:\r\n  *   This function must be used to free the buffer allocated by\r\n  *   @FT_OpenType_Validate only.\r\n  */\r\n  FT_EXPORT( void )\r\n  FT_OpenType_Free( FT_Face   face,\r\n                    FT_Bytes  table );\r\n\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTOTVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftoutln.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftoutln.h                                                              */\r\n/*                                                                         */\r\n/*    Support for the FT_Outline type used to store glyph shapes of        */\r\n/*    most scalable font formats (specification).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2005-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTOUTLN_H__\r\n#define __FTOUTLN_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    outline_processing                                                 */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Outline Processing                                                 */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Functions to create, transform, and render vectorial glyph images. */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains routines used to create and destroy scalable */\r\n  /*    glyph images known as `outlines'.  These can also be measured,     */\r\n  /*    transformed, and converted into bitmaps and pixmaps.               */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_Outline                                                         */\r\n  /*    FT_OUTLINE_FLAGS                                                   */\r\n  /*    FT_Outline_New                                                     */\r\n  /*    FT_Outline_Done                                                    */\r\n  /*    FT_Outline_Copy                                                    */\r\n  /*    FT_Outline_Translate                                               */\r\n  /*    FT_Outline_Transform                                               */\r\n  /*    FT_Outline_Embolden                                                */\r\n  /*    FT_Outline_EmboldenXY                                              */\r\n  /*    FT_Outline_Reverse                                                 */\r\n  /*    FT_Outline_Check                                                   */\r\n  /*                                                                       */\r\n  /*    FT_Outline_Get_CBox                                                */\r\n  /*    FT_Outline_Get_BBox                                                */\r\n  /*                                                                       */\r\n  /*    FT_Outline_Get_Bitmap                                              */\r\n  /*    FT_Outline_Render                                                  */\r\n  /*                                                                       */\r\n  /*    FT_Outline_Decompose                                               */\r\n  /*    FT_Outline_Funcs                                                   */\r\n  /*    FT_Outline_MoveTo_Func                                             */\r\n  /*    FT_Outline_LineTo_Func                                             */\r\n  /*    FT_Outline_ConicTo_Func                                            */\r\n  /*    FT_Outline_CubicTo_Func                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Decompose                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Walk over an outline's structure to decompose it into individual   */\r\n  /*    segments and Bézier arcs.  This function also emits `move to'      */\r\n  /*    operations to indicate the start of new contours in the outline.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline        :: A pointer to the source target.                  */\r\n  /*                                                                       */\r\n  /*    func_interface :: A table of `emitters', i.e., function pointers   */\r\n  /*                      called during decomposition to indicate path     */\r\n  /*                      operations.                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    user           :: A typeless pointer which is passed to each       */\r\n  /*                      emitter during the decomposition.  It can be     */\r\n  /*                      used to store the state during the               */\r\n  /*                      decomposition.                                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Decompose( FT_Outline*              outline,\r\n                        const FT_Outline_Funcs*  func_interface,\r\n                        void*                    user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_New                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new outline of a given size.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library     :: A handle to the library object from where the       */\r\n  /*                   outline is allocated.  Note however that the new    */\r\n  /*                   outline will *not* necessarily be *freed*, when     */\r\n  /*                   destroying the library, by @FT_Done_FreeType.       */\r\n  /*                                                                       */\r\n  /*    numPoints   :: The maximum number of points within the outline.    */\r\n  /*                                                                       */\r\n  /*    numContours :: The maximum number of contours within the outline.  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    anoutline   :: A handle to the new outline.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The reason why this function takes a `library' parameter is simply */\r\n  /*    to use the library's memory allocator.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_New( FT_Library   library,\r\n                  FT_UInt      numPoints,\r\n                  FT_Int       numContours,\r\n                  FT_Outline  *anoutline );\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_New_Internal( FT_Memory    memory,\r\n                           FT_UInt      numPoints,\r\n                           FT_Int       numContours,\r\n                           FT_Outline  *anoutline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Done                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy an outline created with @FT_Outline_New.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle of the library object used to allocate the     */\r\n  /*               outline.                                                */\r\n  /*                                                                       */\r\n  /*    outline :: A pointer to the outline object to be discarded.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If the outline's `owner' field is not set, only the outline        */\r\n  /*    descriptor will be released.                                       */\r\n  /*                                                                       */\r\n  /*    The reason why this function takes an `library' parameter is       */\r\n  /*    simply to use ft_mem_free().                                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Done( FT_Library   library,\r\n                   FT_Outline*  outline );\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Done_Internal( FT_Memory    memory,\r\n                            FT_Outline*  outline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Check                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check the contents of an outline descriptor.                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline :: A handle to a source outline.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Check( FT_Outline*  outline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Get_CBox                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return an outline's `control box'.  The control box encloses all   */\r\n  /*    the outline's points, including Bézier control points.  Though it  */\r\n  /*    coincides with the exact bounding box for most glyphs, it can be   */\r\n  /*    slightly larger in some situations (like when rotating an outline  */\r\n  /*    which contains Bézier outside arcs).                               */\r\n  /*                                                                       */\r\n  /*    Computing the control box is very fast, while getting the bounding */\r\n  /*    box can take much more time as it needs to walk over all segments  */\r\n  /*    and arcs in the outline.  To get the latter, you can use the       */\r\n  /*    `ftbbox' component which is dedicated to this single task.         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline :: A pointer to the source outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acbox   :: The outline's control box.                              */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See @FT_Glyph_Get_CBox for a discussion of tricky fonts.           */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Get_CBox( const FT_Outline*  outline,\r\n                       FT_BBox           *acbox );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Translate                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Apply a simple translation to the points of an outline.            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline :: A pointer to the target outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    xOffset :: The horizontal offset.                                  */\r\n  /*                                                                       */\r\n  /*    yOffset :: The vertical offset.                                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Translate( const FT_Outline*  outline,\r\n                        FT_Pos             xOffset,\r\n                        FT_Pos             yOffset );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Copy                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Copy an outline into another one.  Both objects must have the      */\r\n  /*    same sizes (number of points & number of contours) when this       */\r\n  /*    function is called.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    source :: A handle to the source outline.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target :: A handle to the target outline.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Copy( const FT_Outline*  source,\r\n                   FT_Outline        *target );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Transform                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Apply a simple 2x2 matrix to all of an outline's points.  Useful   */\r\n  /*    for applying rotations, slanting, flipping, etc.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline :: A pointer to the target outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix  :: A pointer to the transformation matrix.                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You can use @FT_Outline_Translate if you need to translate the     */\r\n  /*    outline's points.                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Transform( const FT_Outline*  outline,\r\n                        const FT_Matrix*   matrix );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Embolden                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Embolden an outline.  The new outline will be at most 4~times      */\r\n  /*    `strength' pixels wider and higher.  You may think of the left and */\r\n  /*    bottom borders as unchanged.                                       */\r\n  /*                                                                       */\r\n  /*    Negative `strength' values to reduce the outline thickness are     */\r\n  /*    possible also.                                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline  :: A handle to the target outline.                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    strength :: How strong the glyph is emboldened.  Expressed in      */\r\n  /*                26.6 pixel format.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The used algorithm to increase or decrease the thickness of the    */\r\n  /*    glyph doesn't change the number of points; this means that certain */\r\n  /*    situations like acute angles or intersections are sometimes        */\r\n  /*    handled incorrectly.                                               */\r\n  /*                                                                       */\r\n  /*    If you need `better' metrics values you should call                */\r\n  /*    @FT_Outline_Get_CBox or @FT_Outline_Get_BBox.                      */\r\n  /*                                                                       */\r\n  /*    Example call:                                                      */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );                   */\r\n  /*      if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE )             */\r\n  /*        FT_Outline_Embolden( &face->slot->outline, strength );         */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Embolden( FT_Outline*  outline,\r\n                       FT_Pos       strength );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_EmboldenXY                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Embolden an outline.  The new outline will be `xstrength' pixels   */\r\n  /*    wider and `ystrength' pixels higher.  Otherwise, it is similar to  */\r\n  /*    @FT_Outline_Embolden, which uses the same strength in both         */\r\n  /*    directions.                                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_EmboldenXY( FT_Outline*  outline,\r\n                         FT_Pos       xstrength,\r\n                         FT_Pos       ystrength );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Reverse                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Reverse the drawing direction of an outline.  This is used to      */\r\n  /*    ensure consistent fill conventions for mirrored glyphs.            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline :: A pointer to the target outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in     */\r\n  /*    the outline's `flags' field.                                       */\r\n  /*                                                                       */\r\n  /*    It shouldn't be used by a normal client application, unless it     */\r\n  /*    knows what it is doing.                                            */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Reverse( FT_Outline*  outline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Get_Bitmap                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Render an outline within a bitmap.  The outline's image is simply  */\r\n  /*    OR-ed to the target bitmap.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a FreeType library object.                  */\r\n  /*                                                                       */\r\n  /*    outline :: A pointer to the source outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    abitmap :: A pointer to the target bitmap descriptor.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does NOT CREATE the bitmap, it only renders an       */\r\n  /*    outline image within the one you pass to it!  Consequently, the    */\r\n  /*    various fields in `abitmap' should be set accordingly.             */\r\n  /*                                                                       */\r\n  /*    It will use the raster corresponding to the default glyph format.  */\r\n  /*                                                                       */\r\n  /*    The value of the `num_grays' field in `abitmap' is ignored.  If    */\r\n  /*    you select the gray-level rasterizer, and you want less than 256   */\r\n  /*    gray levels, you have to use @FT_Outline_Render directly.          */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Get_Bitmap( FT_Library        library,\r\n                         FT_Outline*       outline,\r\n                         const FT_Bitmap  *abitmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Render                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Render an outline within a bitmap using the current scan-convert.  */\r\n  /*    This function uses an @FT_Raster_Params structure as an argument,  */\r\n  /*    allowing advanced features like direct composition, translucency,  */\r\n  /*    etc.                                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a FreeType library object.                  */\r\n  /*                                                                       */\r\n  /*    outline :: A pointer to the source outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    params  :: A pointer to an @FT_Raster_Params structure used to     */\r\n  /*               describe the rendering operation.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should know what you are doing and how @FT_Raster_Params works */\r\n  /*    to use this function.                                              */\r\n  /*                                                                       */\r\n  /*    The field `params.source' will be set to `outline' before the scan */\r\n  /*    converter is called, which means that the value you give to it is  */\r\n  /*    actually ignored.                                                  */\r\n  /*                                                                       */\r\n  /*    The gray-level rasterizer always uses 256 gray levels.  If you     */\r\n  /*    want less gray levels, you have to provide your own span callback. */\r\n  /*    See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the   */\r\n  /*    @FT_Raster_Params structure for more details.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Render( FT_Library         library,\r\n                     FT_Outline*        outline,\r\n                     FT_Raster_Params*  params );\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @enum:\r\n  *   FT_Orientation\r\n  *\r\n  * @description:\r\n  *   A list of values used to describe an outline's contour orientation.\r\n  *\r\n  *   The TrueType and PostScript specifications use different conventions\r\n  *   to determine whether outline contours should be filled or unfilled.\r\n  *\r\n  * @values:\r\n  *   FT_ORIENTATION_TRUETYPE ::\r\n  *     According to the TrueType specification, clockwise contours must\r\n  *     be filled, and counter-clockwise ones must be unfilled.\r\n  *\r\n  *   FT_ORIENTATION_POSTSCRIPT ::\r\n  *     According to the PostScript specification, counter-clockwise contours\r\n  *     must be filled, and clockwise ones must be unfilled.\r\n  *\r\n  *   FT_ORIENTATION_FILL_RIGHT ::\r\n  *     This is identical to @FT_ORIENTATION_TRUETYPE, but is used to\r\n  *     remember that in TrueType, everything that is to the right of\r\n  *     the drawing direction of a contour must be filled.\r\n  *\r\n  *   FT_ORIENTATION_FILL_LEFT ::\r\n  *     This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to\r\n  *     remember that in PostScript, everything that is to the left of\r\n  *     the drawing direction of a contour must be filled.\r\n  *\r\n  *   FT_ORIENTATION_NONE ::\r\n  *     The orientation cannot be determined.  That is, different parts of\r\n  *     the glyph have different orientation.\r\n  *\r\n  */\r\n  typedef enum  FT_Orientation_\r\n  {\r\n    FT_ORIENTATION_TRUETYPE   = 0,\r\n    FT_ORIENTATION_POSTSCRIPT = 1,\r\n    FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,\r\n    FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT,\r\n    FT_ORIENTATION_NONE\r\n\r\n  } FT_Orientation;\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Outline_Get_Orientation\r\n  *\r\n  * @description:\r\n  *   This function analyzes a glyph outline and tries to compute its\r\n  *   fill orientation (see @FT_Orientation).  This is done by computing\r\n  *   the direction of each global horizontal and/or vertical extrema\r\n  *   within the outline.\r\n  *\r\n  *   Note that this will return @FT_ORIENTATION_TRUETYPE for empty\r\n  *   outlines.\r\n  *\r\n  * @input:\r\n  *   outline ::\r\n  *     A handle to the source outline.\r\n  *\r\n  * @return:\r\n  *   The orientation.\r\n  *\r\n  */\r\n  FT_EXPORT( FT_Orientation )\r\n  FT_Outline_Get_Orientation( FT_Outline*  outline );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTOUTLN_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftpfr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpfr.h                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing PFR-specific data (specification only).   */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006, 2008, 2009 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTPFR_H__\r\n#define __FTPFR_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    pfr_fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    PFR Fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    PFR/TrueDoc specific API.                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of PFR-specific functions.   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_PFR_Metrics\r\n  *\r\n  * @description:\r\n  *    Return the outline and metrics resolutions of a given PFR face.\r\n  *\r\n  * @input:\r\n  *    face :: Handle to the input face.  It can be a non-PFR face.\r\n  *\r\n  * @output:\r\n  *    aoutline_resolution ::\r\n  *      Outline resolution.  This is equivalent to `face->units_per_EM'\r\n  *      for non-PFR fonts.  Optional (parameter can be NULL).\r\n  *\r\n  *    ametrics_resolution ::\r\n  *      Metrics resolution.  This is equivalent to `outline_resolution'\r\n  *      for non-PFR fonts.  Optional (parameter can be NULL).\r\n  *\r\n  *    ametrics_x_scale ::\r\n  *      A 16.16 fixed-point number used to scale distance expressed\r\n  *      in metrics units to device sub-pixels.  This is equivalent to\r\n  *      `face->size->x_scale', but for metrics only.  Optional (parameter\r\n  *      can be NULL).\r\n  *\r\n  *    ametrics_y_scale ::\r\n  *      Same as `ametrics_x_scale' but for the vertical direction.\r\n  *      optional (parameter can be NULL).\r\n  *\r\n  * @return:\r\n  *    FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   If the input face is not a PFR, this function will return an error.\r\n  *   However, in all cases, it will return valid values.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PFR_Metrics( FT_Face    face,\r\n                      FT_UInt   *aoutline_resolution,\r\n                      FT_UInt   *ametrics_resolution,\r\n                      FT_Fixed  *ametrics_x_scale,\r\n                      FT_Fixed  *ametrics_y_scale );\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_PFR_Kerning\r\n  *\r\n  * @description:\r\n  *    Return the kerning pair corresponding to two glyphs in a PFR face.\r\n  *    The distance is expressed in metrics units, unlike the result of\r\n  *    @FT_Get_Kerning.\r\n  *\r\n  * @input:\r\n  *    face  :: A handle to the input face.\r\n  *\r\n  *    left  :: Index of the left glyph.\r\n  *\r\n  *    right :: Index of the right glyph.\r\n  *\r\n  * @output:\r\n  *    avector :: A kerning vector.\r\n  *\r\n  * @return:\r\n  *    FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *    This function always return distances in original PFR metrics\r\n  *    units.  This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED\r\n  *    mode, which always returns distances converted to outline units.\r\n  *\r\n  *    You can use the value of the `x_scale' and `y_scale' parameters\r\n  *    returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PFR_Kerning( FT_Face     face,\r\n                      FT_UInt     left,\r\n                      FT_UInt     right,\r\n                      FT_Vector  *avector );\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_PFR_Advance\r\n  *\r\n  * @description:\r\n  *    Return a given glyph advance, expressed in original metrics units,\r\n  *    from a PFR font.\r\n  *\r\n  * @input:\r\n  *    face   :: A handle to the input face.\r\n  *\r\n  *    gindex :: The glyph index.\r\n  *\r\n  * @output:\r\n  *    aadvance :: The glyph advance in metrics units.\r\n  *\r\n  * @return:\r\n  *    FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *    You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics\r\n  *    to convert the advance to device sub-pixels (i.e., 1/64th of pixels).\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PFR_Advance( FT_Face   face,\r\n                      FT_UInt   gindex,\r\n                      FT_Pos   *aadvance );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTPFR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftrender.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrender.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType renderer modules public interface (specification).          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2005, 2006, 2010 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTRENDER_H__\r\n#define __FTRENDER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n#include FT_GLYPH_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    module_management                                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* create a new glyph object */\r\n  typedef FT_Error\r\n  (*FT_Glyph_InitFunc)( FT_Glyph      glyph,\r\n                        FT_GlyphSlot  slot );\r\n\r\n  /* destroys a given glyph object */\r\n  typedef void\r\n  (*FT_Glyph_DoneFunc)( FT_Glyph  glyph );\r\n\r\n  typedef void\r\n  (*FT_Glyph_TransformFunc)( FT_Glyph          glyph,\r\n                             const FT_Matrix*  matrix,\r\n                             const FT_Vector*  delta );\r\n\r\n  typedef void\r\n  (*FT_Glyph_GetBBoxFunc)( FT_Glyph  glyph,\r\n                           FT_BBox*  abbox );\r\n\r\n  typedef FT_Error\r\n  (*FT_Glyph_CopyFunc)( FT_Glyph   source,\r\n                        FT_Glyph   target );\r\n\r\n  typedef FT_Error\r\n  (*FT_Glyph_PrepareFunc)( FT_Glyph      glyph,\r\n                           FT_GlyphSlot  slot );\r\n\r\n/* deprecated */\r\n#define FT_Glyph_Init_Func       FT_Glyph_InitFunc\r\n#define FT_Glyph_Done_Func       FT_Glyph_DoneFunc\r\n#define FT_Glyph_Transform_Func  FT_Glyph_TransformFunc\r\n#define FT_Glyph_BBox_Func       FT_Glyph_GetBBoxFunc\r\n#define FT_Glyph_Copy_Func       FT_Glyph_CopyFunc\r\n#define FT_Glyph_Prepare_Func    FT_Glyph_PrepareFunc\r\n\r\n\r\n  struct  FT_Glyph_Class_\r\n  {\r\n    FT_Long                 glyph_size;\r\n    FT_Glyph_Format         glyph_format;\r\n    FT_Glyph_InitFunc       glyph_init;\r\n    FT_Glyph_DoneFunc       glyph_done;\r\n    FT_Glyph_CopyFunc       glyph_copy;\r\n    FT_Glyph_TransformFunc  glyph_transform;\r\n    FT_Glyph_GetBBoxFunc    glyph_bbox;\r\n    FT_Glyph_PrepareFunc    glyph_prepare;\r\n  };\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Renderer_RenderFunc)( FT_Renderer       renderer,\r\n                             FT_GlyphSlot      slot,\r\n                             FT_UInt           mode,\r\n                             const FT_Vector*  origin );\r\n\r\n  typedef FT_Error\r\n  (*FT_Renderer_TransformFunc)( FT_Renderer       renderer,\r\n                                FT_GlyphSlot      slot,\r\n                                const FT_Matrix*  matrix,\r\n                                const FT_Vector*  delta );\r\n\r\n\r\n  typedef void\r\n  (*FT_Renderer_GetCBoxFunc)( FT_Renderer   renderer,\r\n                              FT_GlyphSlot  slot,\r\n                              FT_BBox*      cbox );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Renderer_SetModeFunc)( FT_Renderer  renderer,\r\n                              FT_ULong     mode_tag,\r\n                              FT_Pointer   mode_ptr );\r\n\r\n/* deprecated identifiers */\r\n#define FTRenderer_render  FT_Renderer_RenderFunc\r\n#define FTRenderer_transform  FT_Renderer_TransformFunc\r\n#define FTRenderer_getCBox  FT_Renderer_GetCBoxFunc\r\n#define FTRenderer_setMode  FT_Renderer_SetModeFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Renderer_Class                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The renderer module class descriptor.                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root            :: The root @FT_Module_Class fields.               */\r\n  /*                                                                       */\r\n  /*    glyph_format    :: The glyph image format this renderer handles.   */\r\n  /*                                                                       */\r\n  /*    render_glyph    :: A method used to render the image that is in a  */\r\n  /*                       given glyph slot into a bitmap.                 */\r\n  /*                                                                       */\r\n  /*    transform_glyph :: A method used to transform the image that is in */\r\n  /*                       a given glyph slot.                             */\r\n  /*                                                                       */\r\n  /*    get_glyph_cbox  :: A method used to access the glyph's cbox.       */\r\n  /*                                                                       */\r\n  /*    set_mode        :: A method used to pass additional parameters.    */\r\n  /*                                                                       */\r\n  /*    raster_class    :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.    */\r\n  /*                       This is a pointer to its raster's class.        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Renderer_Class_\r\n  {\r\n    FT_Module_Class            root;\r\n\r\n    FT_Glyph_Format            glyph_format;\r\n\r\n    FT_Renderer_RenderFunc     render_glyph;\r\n    FT_Renderer_TransformFunc  transform_glyph;\r\n    FT_Renderer_GetCBoxFunc    get_glyph_cbox;\r\n    FT_Renderer_SetModeFunc    set_mode;\r\n\r\n    FT_Raster_Funcs*           raster_class;\r\n\r\n  } FT_Renderer_Class;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Renderer                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the current renderer for a given glyph format.            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to the library object.                         */\r\n  /*                                                                       */\r\n  /*    format  :: The glyph format.                                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A renderer handle.  0~if none found.                               */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An error will be returned if a module already exists by that name, */\r\n  /*    or if the module requires a version of FreeType that is too great. */\r\n  /*                                                                       */\r\n  /*    To add a new renderer, simply use @FT_Add_Module.  To retrieve a   */\r\n  /*    renderer by its name, use @FT_Get_Module.                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Renderer )\r\n  FT_Get_Renderer( FT_Library       library,\r\n                   FT_Glyph_Format  format );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Renderer                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set the current renderer to use, and set additional mode.          */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    renderer   :: A handle to the renderer object.                     */\r\n  /*                                                                       */\r\n  /*    num_params :: The number of additional parameters.                 */\r\n  /*                                                                       */\r\n  /*    parameters :: Additional parameters.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In case of success, the renderer will be used to convert glyph     */\r\n  /*    images in the renderer's known format into bitmaps.                */\r\n  /*                                                                       */\r\n  /*    This doesn't change the current renderer for other formats.        */\r\n  /*                                                                       */\r\n  /*    Currently, only the B/W renderer, if compiled with                 */\r\n  /*    FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels               */\r\n  /*    anti-aliasing mode; this option must be set directly in            */\r\n  /*    `ftraster.c' and is undefined by default) accepts a single tag     */\r\n  /*    `pal5' to set its gray palette as a character string with          */\r\n  /*    5~elements.  Consequently, the third and fourth argument are zero  */\r\n  /*    normally.                                                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Renderer( FT_Library     library,\r\n                   FT_Renderer    renderer,\r\n                   FT_UInt        num_params,\r\n                   FT_Parameter*  parameters );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTRENDER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftsizes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsizes.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType size objects management (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2004, 2006, 2009 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Typical application would normally not need to use these functions.   */\r\n  /* However, they have been placed in a public API for the rare cases     */\r\n  /* where they are needed.                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTSIZES_H__\r\n#define __FTSIZES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    sizes_management                                                   */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Size Management                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Managing multiple sizes per face.                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    When creating a new face object (e.g., with @FT_New_Face), an      */\r\n  /*    @FT_Size object is automatically created and used to store all     */\r\n  /*    pixel-size dependent information, available in the `face->size'    */\r\n  /*    field.                                                             */\r\n  /*                                                                       */\r\n  /*    It is however possible to create more sizes for a given face,      */\r\n  /*    mostly in order to manage several character pixel sizes of the     */\r\n  /*    same font family and style.  See @FT_New_Size and @FT_Done_Size.   */\r\n  /*                                                                       */\r\n  /*    Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only           */\r\n  /*    modify the contents of the current `active' size; you thus need    */\r\n  /*    to use @FT_Activate_Size to change it.                             */\r\n  /*                                                                       */\r\n  /*    99% of applications won't need the functions provided here,        */\r\n  /*    especially if they use the caching sub-system, so be cautious      */\r\n  /*    when using these.                                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Size                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new size object from a given face object.                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to a parent face object.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    asize :: A handle to a new size object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You need to call @FT_Activate_Size in order to select the new size */\r\n  /*    for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size,      */\r\n  /*    @FT_Load_Glyph, @FT_Load_Char, etc.                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Size( FT_Face   face,\r\n               FT_Size*  size );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Size                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard a given size object.  Note that @FT_Done_Face              */\r\n  /*    automatically discards all size objects allocated with             */\r\n  /*    @FT_New_Size.                                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size :: A handle to a target size object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_Size( FT_Size  size );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Activate_Size                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Even though it is possible to create several size objects for a    */\r\n  /*    given face (see @FT_New_Size for details), functions like          */\r\n  /*    @FT_Load_Glyph or @FT_Load_Char only use the one which has been    */\r\n  /*    activated last to determine the `current character pixel size'.    */\r\n  /*                                                                       */\r\n  /*    This function can be used to `activate' a previously created size  */\r\n  /*    object.                                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size :: A handle to a target size object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If `face' is the size's parent face object, this function changes  */\r\n  /*    the value of `face->size' to the input size handle.                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Activate_Size( FT_Size  size );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSIZES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftsnames.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsnames.h                                                             */\r\n/*                                                                         */\r\n/*    Simple interface to access SFNT name tables (which are used          */\r\n/*    to hold font names, copyright info, notices, etc.) (specification).  */\r\n/*                                                                         */\r\n/*    This is _not_ used to retrieve glyph names!                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FT_SFNT_NAMES_H__\r\n#define __FT_SFNT_NAMES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    sfnt_names                                                         */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    SFNT Names                                                         */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Access the names embedded in TrueType and OpenType files.          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The TrueType and OpenType specifications allow the inclusion of    */\r\n  /*    a special `names table' in font files.  This table contains        */\r\n  /*    textual (and internationalized) information regarding the font,    */\r\n  /*    like family name, copyright, version, etc.                         */\r\n  /*                                                                       */\r\n  /*    The definitions below are used to access them if available.        */\r\n  /*                                                                       */\r\n  /*    Note that this has nothing to do with glyph names!                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_SfntName                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model an SFNT `name' table entry.              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    platform_id :: The platform ID for `string'.                       */\r\n  /*                                                                       */\r\n  /*    encoding_id :: The encoding ID for `string'.                       */\r\n  /*                                                                       */\r\n  /*    language_id :: The language ID for `string'.                       */\r\n  /*                                                                       */\r\n  /*    name_id     :: An identifier for `string'.                         */\r\n  /*                                                                       */\r\n  /*    string      :: The `name' string.  Note that its format differs    */\r\n  /*                   depending on the (platform,encoding) pair.  It can  */\r\n  /*                   be a Pascal String, a UTF-16 one, etc.              */\r\n  /*                                                                       */\r\n  /*                   Generally speaking, the string is not               */\r\n  /*                   zero-terminated.  Please refer to the TrueType      */\r\n  /*                   specification for details.                          */\r\n  /*                                                                       */\r\n  /*    string_len  :: The length of `string' in bytes.                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Possible values for `platform_id', `encoding_id', `language_id',   */\r\n  /*    and `name_id' are given in the file `ttnameid.h'.  For details     */\r\n  /*    please refer to the TrueType or OpenType specification.            */\r\n  /*                                                                       */\r\n  /*    See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX,       */\r\n  /*    @TT_ISO_ID_XXX, and @TT_MS_ID_XXX.                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_SfntName_\r\n  {\r\n    FT_UShort  platform_id;\r\n    FT_UShort  encoding_id;\r\n    FT_UShort  language_id;\r\n    FT_UShort  name_id;\r\n\r\n    FT_Byte*   string;      /* this string is *not* null-terminated! */\r\n    FT_UInt    string_len;  /* in bytes */\r\n\r\n  } FT_SfntName;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Sfnt_Name_Count                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the number of name strings in the SFNT `name' table.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The number of strings in the `name' table.                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Get_Sfnt_Name_Count( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Sfnt_Name                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve a string of the SFNT `name' table for a given index.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face  :: A handle to the source face.                              */\r\n  /*                                                                       */\r\n  /*    idx   :: The index of the `name' string.                           */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aname :: The indexed @FT_SfntName structure.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `string' array returned in the `aname' structure is not        */\r\n  /*    null-terminated.  The application should deallocate it if it is no */\r\n  /*    longer in use.                                                     */\r\n  /*                                                                       */\r\n  /*    Use @FT_Get_Sfnt_Name_Count to get the total number of available   */\r\n  /*    `name' table entries, then do a loop until you get the right       */\r\n  /*    platform, encoding, and name ID.                                   */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Sfnt_Name( FT_Face       face,\r\n                    FT_UInt       idx,\r\n                    FT_SfntName  *aname );\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @constant:\r\n   *   FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY\r\n   *\r\n   * @description:\r\n   *   A constant used as the tag of @FT_Parameter structures to make\r\n   *   FT_Open_Face() ignore preferred family subfamily names in `name'\r\n   *   table since OpenType version 1.4.  For backwards compatibility with\r\n   *   legacy systems which has 4-face-per-family restriction.\r\n   *\r\n   */\r\n#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY  FT_MAKE_TAG( 'i', 'g', 'p', 'f' )\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @constant:\r\n   *   FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY\r\n   *\r\n   * @description:\r\n   *   A constant used as the tag of @FT_Parameter structures to make\r\n   *   FT_Open_Face() ignore preferred subfamily names in `name' table since\r\n   *   OpenType version 1.4.  For backwards compatibility with legacy\r\n   *   systems which has 4-face-per-family restriction.\r\n   *\r\n   */\r\n#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY  FT_MAKE_TAG( 'i', 'g', 'p', 's' )\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FT_SFNT_NAMES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftstroke.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstroke.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType path stroker (specification).                               */\r\n/*                                                                         */\r\n/*  Copyright 2002-2006, 2008, 2009, 2011-2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FT_STROKE_H__\r\n#define __FT_STROKE_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_OUTLINE_H\r\n#include FT_GLYPH_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n /************************************************************************\r\n  *\r\n  * @section:\r\n  *    glyph_stroker\r\n  *\r\n  * @title:\r\n  *    Glyph Stroker\r\n  *\r\n  * @abstract:\r\n  *    Generating bordered and stroked glyphs.\r\n  *\r\n  * @description:\r\n  *    This component generates stroked outlines of a given vectorial\r\n  *    glyph.  It also allows you to retrieve the `outside' and/or the\r\n  *    `inside' borders of the stroke.\r\n  *\r\n  *    This can be useful to generate `bordered' glyph, i.e., glyphs\r\n  *    displayed with a coloured (and anti-aliased) border around their\r\n  *    shape.\r\n  */\r\n\r\n\r\n /**************************************************************\r\n  *\r\n  * @type:\r\n  *   FT_Stroker\r\n  *\r\n  * @description:\r\n  *   Opaque handler to a path stroker object.\r\n  */\r\n  typedef struct FT_StrokerRec_*  FT_Stroker;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_Stroker_LineJoin\r\n   *\r\n   * @description:\r\n   *   These values determine how two joining lines are rendered\r\n   *   in a stroker.\r\n   *\r\n   * @values:\r\n   *   FT_STROKER_LINEJOIN_ROUND ::\r\n   *     Used to render rounded line joins.  Circular arcs are used\r\n   *     to join two lines smoothly.\r\n   *\r\n   *   FT_STROKER_LINEJOIN_BEVEL ::\r\n   *     Used to render beveled line joins.  The outer corner of\r\n   *     the joined lines is filled by enclosing the triangular\r\n   *     region of the corner with a straight line between the\r\n   *     outer corners of each stroke.\r\n   *\r\n   *   FT_STROKER_LINEJOIN_MITER_FIXED ::\r\n   *     Used to render mitered line joins, with fixed bevels if the\r\n   *     miter limit is exceeded.  The outer edges of the strokes\r\n   *     for the two segments are extended until they meet at an\r\n   *     angle.  If the segments meet at too sharp an angle (such\r\n   *     that the miter would extend from the intersection of the\r\n   *     segments a distance greater than the product of the miter\r\n   *     limit value and the border radius), then a bevel join (see\r\n   *     above) is used instead.  This prevents long spikes being\r\n   *     created.  FT_STROKER_LINEJOIN_MITER_FIXED generates a miter\r\n   *     line join as used in PostScript and PDF.\r\n   *\r\n   *   FT_STROKER_LINEJOIN_MITER_VARIABLE ::\r\n   *   FT_STROKER_LINEJOIN_MITER ::\r\n   *     Used to render mitered line joins, with variable bevels if\r\n   *     the miter limit is exceeded.  The intersection of the\r\n   *     strokes is clipped at a line perpendicular to the bisector\r\n   *     of the angle between the strokes, at the distance from the\r\n   *     intersection of the segments equal to the product of the\r\n   *     miter limit value and the border radius.  This prevents\r\n   *     long spikes being created.\r\n   *     FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line\r\n   *     join as used in XPS.  FT_STROKER_LINEJOIN_MITER is an alias\r\n   *     for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for\r\n   *     backwards compatibility.\r\n   */\r\n  typedef enum  FT_Stroker_LineJoin_\r\n  {\r\n    FT_STROKER_LINEJOIN_ROUND          = 0,\r\n    FT_STROKER_LINEJOIN_BEVEL          = 1,\r\n    FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,\r\n    FT_STROKER_LINEJOIN_MITER          = FT_STROKER_LINEJOIN_MITER_VARIABLE,\r\n    FT_STROKER_LINEJOIN_MITER_FIXED    = 3\r\n\r\n  } FT_Stroker_LineJoin;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_Stroker_LineCap\r\n   *\r\n   * @description:\r\n   *   These values determine how the end of opened sub-paths are\r\n   *   rendered in a stroke.\r\n   *\r\n   * @values:\r\n   *   FT_STROKER_LINECAP_BUTT ::\r\n   *     The end of lines is rendered as a full stop on the last\r\n   *     point itself.\r\n   *\r\n   *   FT_STROKER_LINECAP_ROUND ::\r\n   *     The end of lines is rendered as a half-circle around the\r\n   *     last point.\r\n   *\r\n   *   FT_STROKER_LINECAP_SQUARE ::\r\n   *     The end of lines is rendered as a square around the\r\n   *     last point.\r\n   */\r\n  typedef enum  FT_Stroker_LineCap_\r\n  {\r\n    FT_STROKER_LINECAP_BUTT = 0,\r\n    FT_STROKER_LINECAP_ROUND,\r\n    FT_STROKER_LINECAP_SQUARE\r\n\r\n  } FT_Stroker_LineCap;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_StrokerBorder\r\n   *\r\n   * @description:\r\n   *   These values are used to select a given stroke border\r\n   *   in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.\r\n   *\r\n   * @values:\r\n   *   FT_STROKER_BORDER_LEFT ::\r\n   *     Select the left border, relative to the drawing direction.\r\n   *\r\n   *   FT_STROKER_BORDER_RIGHT ::\r\n   *     Select the right border, relative to the drawing direction.\r\n   *\r\n   * @note:\r\n   *   Applications are generally interested in the `inside' and `outside'\r\n   *   borders.  However, there is no direct mapping between these and the\r\n   *   `left' and `right' ones, since this really depends on the glyph's\r\n   *   drawing orientation, which varies between font formats.\r\n   *\r\n   *   You can however use @FT_Outline_GetInsideBorder and\r\n   *   @FT_Outline_GetOutsideBorder to get these.\r\n   */\r\n  typedef enum  FT_StrokerBorder_\r\n  {\r\n    FT_STROKER_BORDER_LEFT = 0,\r\n    FT_STROKER_BORDER_RIGHT\r\n\r\n  } FT_StrokerBorder;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Outline_GetInsideBorder\r\n   *\r\n   * @description:\r\n   *   Retrieve the @FT_StrokerBorder value corresponding to the\r\n   *   `inside' borders of a given outline.\r\n   *\r\n   * @input:\r\n   *   outline ::\r\n   *     The source outline handle.\r\n   *\r\n   * @return:\r\n   *   The border index.  @FT_STROKER_BORDER_RIGHT for empty or invalid\r\n   *   outlines.\r\n   */\r\n  FT_EXPORT( FT_StrokerBorder )\r\n  FT_Outline_GetInsideBorder( FT_Outline*  outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Outline_GetOutsideBorder\r\n   *\r\n   * @description:\r\n   *   Retrieve the @FT_StrokerBorder value corresponding to the\r\n   *   `outside' borders of a given outline.\r\n   *\r\n   * @input:\r\n   *   outline ::\r\n   *     The source outline handle.\r\n   *\r\n   * @return:\r\n   *   The border index.  @FT_STROKER_BORDER_LEFT for empty or invalid\r\n   *   outlines.\r\n   */\r\n  FT_EXPORT( FT_StrokerBorder )\r\n  FT_Outline_GetOutsideBorder( FT_Outline*  outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_New\r\n   *\r\n   * @description:\r\n   *   Create a new stroker object.\r\n   *\r\n   * @input:\r\n   *   library ::\r\n   *     FreeType library handle.\r\n   *\r\n   * @output:\r\n   *   astroker ::\r\n   *     A new stroker object handle.  NULL in case of error.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_New( FT_Library   library,\r\n                  FT_Stroker  *astroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Set\r\n   *\r\n   * @description:\r\n   *   Reset a stroker object's attributes.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   radius ::\r\n   *     The border radius.\r\n   *\r\n   *   line_cap ::\r\n   *     The line cap style.\r\n   *\r\n   *   line_join ::\r\n   *     The line join style.\r\n   *\r\n   *   miter_limit ::\r\n   *     The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and\r\n   *     FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles,\r\n   *     expressed as 16.16 fixed point value.\r\n   *\r\n   * @note:\r\n   *   The radius is expressed in the same units as the outline\r\n   *   coordinates.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Set( FT_Stroker           stroker,\r\n                  FT_Fixed             radius,\r\n                  FT_Stroker_LineCap   line_cap,\r\n                  FT_Stroker_LineJoin  line_join,\r\n                  FT_Fixed             miter_limit );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Rewind\r\n   *\r\n   * @description:\r\n   *   Reset a stroker object without changing its attributes.\r\n   *   You should call this function before beginning a new\r\n   *   series of calls to @FT_Stroker_BeginSubPath or\r\n   *   @FT_Stroker_EndSubPath.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Rewind( FT_Stroker  stroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_ParseOutline\r\n   *\r\n   * @description:\r\n   *   A convenience function used to parse a whole outline with\r\n   *   the stroker.  The resulting outline(s) can be retrieved\r\n   *   later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   outline ::\r\n   *     The source outline.\r\n   *\r\n   *   opened ::\r\n   *     A boolean.  If~1, the outline is treated as an open path instead\r\n   *     of a closed one.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   If `opened' is~0 (the default), the outline is treated as a closed\r\n   *   path, and the stroker generates two distinct `border' outlines.\r\n   *\r\n   *   If `opened' is~1, the outline is processed as an open path, and the\r\n   *   stroker generates a single `stroke' outline.\r\n   *\r\n   *   This function calls @FT_Stroker_Rewind automatically.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_ParseOutline( FT_Stroker   stroker,\r\n                           FT_Outline*  outline,\r\n                           FT_Bool      opened );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_BeginSubPath\r\n   *\r\n   * @description:\r\n   *   Start a new sub-path in the stroker.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the start vector.\r\n   *\r\n   *   open ::\r\n   *     A boolean.  If~1, the sub-path is treated as an open one.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   This function is useful when you need to stroke a path that is\r\n   *   not stored as an @FT_Outline object.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_BeginSubPath( FT_Stroker  stroker,\r\n                           FT_Vector*  to,\r\n                           FT_Bool     open );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_EndSubPath\r\n   *\r\n   * @description:\r\n   *   Close the current sub-path in the stroker.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function after @FT_Stroker_BeginSubPath.\r\n   *   If the subpath was not `opened', this function `draws' a\r\n   *   single line segment to the start position when needed.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_EndSubPath( FT_Stroker  stroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_LineTo\r\n   *\r\n   * @description:\r\n   *   `Draw' a single line segment in the stroker's current sub-path,\r\n   *   from the last position.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the destination point.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function between @FT_Stroker_BeginSubPath and\r\n   *   @FT_Stroker_EndSubPath.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_LineTo( FT_Stroker  stroker,\r\n                     FT_Vector*  to );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_ConicTo\r\n   *\r\n   * @description:\r\n   *   `Draw' a single quadratic Bézier in the stroker's current sub-path,\r\n   *   from the last position.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   control ::\r\n   *     A pointer to a Bézier control point.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the destination point.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function between @FT_Stroker_BeginSubPath and\r\n   *   @FT_Stroker_EndSubPath.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_ConicTo( FT_Stroker  stroker,\r\n                      FT_Vector*  control,\r\n                      FT_Vector*  to );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_CubicTo\r\n   *\r\n   * @description:\r\n   *   `Draw' a single cubic Bézier in the stroker's current sub-path,\r\n   *   from the last position.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   control1 ::\r\n   *     A pointer to the first Bézier control point.\r\n   *\r\n   *   control2 ::\r\n   *     A pointer to second Bézier control point.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the destination point.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function between @FT_Stroker_BeginSubPath and\r\n   *   @FT_Stroker_EndSubPath.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_CubicTo( FT_Stroker  stroker,\r\n                      FT_Vector*  control1,\r\n                      FT_Vector*  control2,\r\n                      FT_Vector*  to );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_GetBorderCounts\r\n   *\r\n   * @description:\r\n   *   Call this function once you have finished parsing your paths\r\n   *   with the stroker.  It returns the number of points and\r\n   *   contours necessary to export one of the `border' or `stroke'\r\n   *   outlines generated by the stroker.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   border ::\r\n   *     The border index.\r\n   *\r\n   * @output:\r\n   *   anum_points ::\r\n   *     The number of points.\r\n   *\r\n   *   anum_contours ::\r\n   *     The number of contours.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   When an outline, or a sub-path, is `closed', the stroker generates\r\n   *   two independent `border' outlines, named `left' and `right'.\r\n   *\r\n   *   When the outline, or a sub-path, is `opened', the stroker merges\r\n   *   the `border' outlines with caps.  The `left' border receives all\r\n   *   points, while the `right' border becomes empty.\r\n   *\r\n   *   Use the function @FT_Stroker_GetCounts instead if you want to\r\n   *   retrieve the counts associated to both borders.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_GetBorderCounts( FT_Stroker        stroker,\r\n                              FT_StrokerBorder  border,\r\n                              FT_UInt          *anum_points,\r\n                              FT_UInt          *anum_contours );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_ExportBorder\r\n   *\r\n   * @description:\r\n   *   Call this function after @FT_Stroker_GetBorderCounts to\r\n   *   export the corresponding border to your own @FT_Outline\r\n   *   structure.\r\n   *\r\n   *   Note that this function appends the border points and\r\n   *   contours to your outline, but does not try to resize its\r\n   *   arrays.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   border ::\r\n   *     The border index.\r\n   *\r\n   *   outline ::\r\n   *     The target outline handle.\r\n   *\r\n   * @note:\r\n   *   Always call this function after @FT_Stroker_GetBorderCounts to\r\n   *   get sure that there is enough room in your @FT_Outline object to\r\n   *   receive all new data.\r\n   *\r\n   *   When an outline, or a sub-path, is `closed', the stroker generates\r\n   *   two independent `border' outlines, named `left' and `right'\r\n   *\r\n   *   When the outline, or a sub-path, is `opened', the stroker merges\r\n   *   the `border' outlines with caps. The `left' border receives all\r\n   *   points, while the `right' border becomes empty.\r\n   *\r\n   *   Use the function @FT_Stroker_Export instead if you want to\r\n   *   retrieve all borders at once.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_ExportBorder( FT_Stroker        stroker,\r\n                           FT_StrokerBorder  border,\r\n                           FT_Outline*       outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_GetCounts\r\n   *\r\n   * @description:\r\n   *   Call this function once you have finished parsing your paths\r\n   *   with the stroker.  It returns the number of points and\r\n   *   contours necessary to export all points/borders from the stroked\r\n   *   outline/path.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   * @output:\r\n   *   anum_points ::\r\n   *     The number of points.\r\n   *\r\n   *   anum_contours ::\r\n   *     The number of contours.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_GetCounts( FT_Stroker  stroker,\r\n                        FT_UInt    *anum_points,\r\n                        FT_UInt    *anum_contours );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Export\r\n   *\r\n   * @description:\r\n   *   Call this function after @FT_Stroker_GetBorderCounts to\r\n   *   export all borders to your own @FT_Outline structure.\r\n   *\r\n   *   Note that this function appends the border points and\r\n   *   contours to your outline, but does not try to resize its\r\n   *   arrays.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   outline ::\r\n   *     The target outline handle.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Export( FT_Stroker   stroker,\r\n                     FT_Outline*  outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Done\r\n   *\r\n   * @description:\r\n   *   Destroy a stroker object.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     A stroker handle.  Can be NULL.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Done( FT_Stroker  stroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Glyph_Stroke\r\n   *\r\n   * @description:\r\n   *   Stroke a given outline glyph object with a given stroker.\r\n   *\r\n   * @inout:\r\n   *   pglyph ::\r\n   *     Source glyph handle on input, new glyph handle on output.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     A stroker handle.\r\n   *\r\n   *   destroy ::\r\n   *     A Boolean.  If~1, the source glyph object is destroyed\r\n   *     on success.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   The source glyph is untouched in case of error.\r\n   *\r\n   *   Adding stroke may yield a significantly wider and taller glyph\r\n   *   depending on how large of a radius was used to stroke the glyph.  You\r\n   *   may need to manually adjust horizontal and vertical advance amounts\r\n   *   to account for this added size.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_Stroke( FT_Glyph    *pglyph,\r\n                   FT_Stroker   stroker,\r\n                   FT_Bool      destroy );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Glyph_StrokeBorder\r\n   *\r\n   * @description:\r\n   *   Stroke a given outline glyph object with a given stroker, but\r\n   *   only return either its inside or outside border.\r\n   *\r\n   * @inout:\r\n   *   pglyph ::\r\n   *     Source glyph handle on input, new glyph handle on output.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     A stroker handle.\r\n   *\r\n   *   inside ::\r\n   *     A Boolean.  If~1, return the inside border, otherwise\r\n   *     the outside border.\r\n   *\r\n   *   destroy ::\r\n   *     A Boolean.  If~1, the source glyph object is destroyed\r\n   *     on success.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   The source glyph is untouched in case of error.\r\n   *\r\n   *   Adding stroke may yield a significantly wider and taller glyph\r\n   *   depending on how large of a radius was used to stroke the glyph.  You\r\n   *   may need to manually adjust horizontal and vertical advance amounts\r\n   *   to account for this added size.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_StrokeBorder( FT_Glyph    *pglyph,\r\n                         FT_Stroker   stroker,\r\n                         FT_Bool      inside,\r\n                         FT_Bool      destroy );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FT_STROKE_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftsynth.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsynth.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType synthesizing code for emboldening and slanting              */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2006, 2008, 2012 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*********                                                       *********/\r\n  /*********        WARNING, THIS IS ALPHA CODE!  THIS API         *********/\r\n  /*********    IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE    *********/\r\n  /*********            FREETYPE DEVELOPMENT TEAM                  *********/\r\n  /*********                                                       *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Main reason for not lifting the functions in this module to a  */\r\n  /* `standard' API is that the used parameters for emboldening and */\r\n  /* slanting are not configurable.  Consider the functions as a    */\r\n  /* code resource which should be copied into the application and  */\r\n  /* adapted to the particular needs.                               */\r\n\r\n\r\n#ifndef __FTSYNTH_H__\r\n#define __FTSYNTH_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /* Embolden a glyph by a `reasonable' value (which is highly a matter of */\r\n  /* taste).  This function is actually a convenience function, providing  */\r\n  /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden.           */\r\n  /*                                                                       */\r\n  /* For emboldened outlines the height, width, and advance metrics are    */\r\n  /* increased by the strength of the emboldening.  You can also call      */\r\n  /* @FT_Outline_Get_CBox to get precise values.                           */\r\n  FT_EXPORT( void )\r\n  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );\r\n\r\n  /* Slant an outline glyph to the right by about 12 degrees. */\r\n  FT_EXPORT( void )\r\n  FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSYNTH_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftsystem.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsystem.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType low-level system interface definition (specification).      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2005, 2010 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTSYSTEM_H__\r\n#define __FTSYSTEM_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*   system_interface                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*   System Interface                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*   How FreeType manages memory and i/o.                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   This section contains various definitions related to memory         */\r\n  /*   management and i/o access.  You need to understand this             */\r\n  /*   information if you want to use a custom memory manager or you own   */\r\n  /*   i/o streams.                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                  M E M O R Y   M A N A G E M E N T                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Memory\r\n   *\r\n   * @description:\r\n   *   A handle to a given memory manager object, defined with an\r\n   *   @FT_MemoryRec structure.\r\n   *\r\n   */\r\n  typedef struct FT_MemoryRec_*  FT_Memory;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Alloc_Func\r\n   *\r\n   * @description:\r\n   *   A function used to allocate `size' bytes from `memory'.\r\n   *\r\n   * @input:\r\n   *   memory ::\r\n   *     A handle to the source memory manager.\r\n   *\r\n   *   size ::\r\n   *     The size in bytes to allocate.\r\n   *\r\n   * @return:\r\n   *   Address of new memory block.  0~in case of failure.\r\n   *\r\n   */\r\n  typedef void*\r\n  (*FT_Alloc_Func)( FT_Memory  memory,\r\n                    long       size );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Free_Func\r\n   *\r\n   * @description:\r\n   *   A function used to release a given block of memory.\r\n   *\r\n   * @input:\r\n   *   memory ::\r\n   *     A handle to the source memory manager.\r\n   *\r\n   *   block ::\r\n   *     The address of the target memory block.\r\n   *\r\n   */\r\n  typedef void\r\n  (*FT_Free_Func)( FT_Memory  memory,\r\n                   void*      block );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Realloc_Func\r\n   *\r\n   * @description:\r\n   *   A function used to re-allocate a given block of memory.\r\n   *\r\n   * @input:\r\n   *   memory ::\r\n   *     A handle to the source memory manager.\r\n   *\r\n   *   cur_size ::\r\n   *     The block's current size in bytes.\r\n   *\r\n   *   new_size ::\r\n   *     The block's requested new size.\r\n   *\r\n   *   block ::\r\n   *     The block's current address.\r\n   *\r\n   * @return:\r\n   *   New block address.  0~in case of memory shortage.\r\n   *\r\n   * @note:\r\n   *   In case of error, the old block must still be available.\r\n   *\r\n   */\r\n  typedef void*\r\n  (*FT_Realloc_Func)( FT_Memory  memory,\r\n                      long       cur_size,\r\n                      long       new_size,\r\n                      void*      block );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_MemoryRec\r\n   *\r\n   * @description:\r\n   *   A structure used to describe a given memory manager to FreeType~2.\r\n   *\r\n   * @fields:\r\n   *   user ::\r\n   *     A generic typeless pointer for user data.\r\n   *\r\n   *   alloc ::\r\n   *     A pointer type to an allocation function.\r\n   *\r\n   *   free ::\r\n   *     A pointer type to an memory freeing function.\r\n   *\r\n   *   realloc ::\r\n   *     A pointer type to a reallocation function.\r\n   *\r\n   */\r\n  struct  FT_MemoryRec_\r\n  {\r\n    void*            user;\r\n    FT_Alloc_Func    alloc;\r\n    FT_Free_Func     free;\r\n    FT_Realloc_Func  realloc;\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                       I / O   M A N A G E M E N T                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Stream\r\n   *\r\n   * @description:\r\n   *   A handle to an input stream.\r\n   *\r\n   */\r\n  typedef struct FT_StreamRec_*  FT_Stream;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_StreamDesc\r\n   *\r\n   * @description:\r\n   *   A union type used to store either a long or a pointer.  This is used\r\n   *   to store a file descriptor or a `FILE*' in an input stream.\r\n   *\r\n   */\r\n  typedef union  FT_StreamDesc_\r\n  {\r\n    long   value;\r\n    void*  pointer;\r\n\r\n  } FT_StreamDesc;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Stream_IoFunc\r\n   *\r\n   * @description:\r\n   *   A function used to seek and read data from a given input stream.\r\n   *\r\n   * @input:\r\n   *   stream ::\r\n   *     A handle to the source stream.\r\n   *\r\n   *   offset ::\r\n   *     The offset of read in stream (always from start).\r\n   *\r\n   *   buffer ::\r\n   *     The address of the read buffer.\r\n   *\r\n   *   count ::\r\n   *     The number of bytes to read from the stream.\r\n   *\r\n   * @return:\r\n   *   The number of bytes effectively read by the stream.\r\n   *\r\n   * @note:\r\n   *   This function might be called to perform a seek or skip operation\r\n   *   with a `count' of~0.  A non-zero return value then indicates an\r\n   *   error.\r\n   *\r\n   */\r\n  typedef unsigned long\r\n  (*FT_Stream_IoFunc)( FT_Stream       stream,\r\n                       unsigned long   offset,\r\n                       unsigned char*  buffer,\r\n                       unsigned long   count );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Stream_CloseFunc\r\n   *\r\n   * @description:\r\n   *   A function used to close a given input stream.\r\n   *\r\n   * @input:\r\n   *  stream ::\r\n   *     A handle to the target stream.\r\n   *\r\n   */\r\n  typedef void\r\n  (*FT_Stream_CloseFunc)( FT_Stream  stream );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_StreamRec\r\n   *\r\n   * @description:\r\n   *   A structure used to describe an input stream.\r\n   *\r\n   * @input:\r\n   *   base ::\r\n   *     For memory-based streams, this is the address of the first stream\r\n   *     byte in memory.  This field should always be set to NULL for\r\n   *     disk-based streams.\r\n   *\r\n   *   size ::\r\n   *     The stream size in bytes.\r\n   *\r\n   *   pos ::\r\n   *     The current position within the stream.\r\n   *\r\n   *   descriptor ::\r\n   *     This field is a union that can hold an integer or a pointer.  It is\r\n   *     used by stream implementations to store file descriptors or `FILE*'\r\n   *     pointers.\r\n   *\r\n   *   pathname ::\r\n   *     This field is completely ignored by FreeType.  However, it is often\r\n   *     useful during debugging to use it to store the stream's filename\r\n   *     (where available).\r\n   *\r\n   *   read ::\r\n   *     The stream's input function.\r\n   *\r\n   *   close ::\r\n   *     The stream's close function.\r\n   *\r\n   *   memory ::\r\n   *     The memory manager to use to preload frames.  This is set\r\n   *     internally by FreeType and shouldn't be touched by stream\r\n   *     implementations.\r\n   *\r\n   *   cursor ::\r\n   *     This field is set and used internally by FreeType when parsing\r\n   *     frames.\r\n   *\r\n   *   limit ::\r\n   *     This field is set and used internally by FreeType when parsing\r\n   *     frames.\r\n   *\r\n   */\r\n  typedef struct  FT_StreamRec_\r\n  {\r\n    unsigned char*       base;\r\n    unsigned long        size;\r\n    unsigned long        pos;\r\n\r\n    FT_StreamDesc        descriptor;\r\n    FT_StreamDesc        pathname;\r\n    FT_Stream_IoFunc     read;\r\n    FT_Stream_CloseFunc  close;\r\n\r\n    FT_Memory            memory;\r\n    unsigned char*       cursor;\r\n    unsigned char*       limit;\r\n\r\n  } FT_StreamRec;\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSYSTEM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/fttrigon.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttrigon.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType trigonometric functions (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2003, 2005, 2007 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTTRIGON_H__\r\n#define __FTTRIGON_H__\r\n\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*   computations                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Angle\r\n   *\r\n   * @description:\r\n   *   This type is used to model angle values in FreeType.  Note that the\r\n   *   angle is a 16.16 fixed float value expressed in degrees.\r\n   *\r\n   */\r\n  typedef FT_Fixed  FT_Angle;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_PI\r\n   *\r\n   * @description:\r\n   *   The angle pi expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_PI  ( 180L << 16 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_2PI\r\n   *\r\n   * @description:\r\n   *   The angle 2*pi expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_2PI  ( FT_ANGLE_PI * 2 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_PI2\r\n   *\r\n   * @description:\r\n   *   The angle pi/2 expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_PI2  ( FT_ANGLE_PI / 2 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_PI4\r\n   *\r\n   * @description:\r\n   *   The angle pi/4 expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_PI4  ( FT_ANGLE_PI / 4 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Sin\r\n   *\r\n   * @description:\r\n   *   Return the sinus of a given angle in fixed point format.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The input angle.\r\n   *\r\n   * @return:\r\n   *   The sinus value.\r\n   *\r\n   * @note:\r\n   *   If you need both the sinus and cosinus for a given angle, use the\r\n   *   function @FT_Vector_Unit.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Sin( FT_Angle  angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Cos\r\n   *\r\n   * @description:\r\n   *   Return the cosinus of a given angle in fixed point format.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The input angle.\r\n   *\r\n   * @return:\r\n   *   The cosinus value.\r\n   *\r\n   * @note:\r\n   *   If you need both the sinus and cosinus for a given angle, use the\r\n   *   function @FT_Vector_Unit.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Cos( FT_Angle  angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Tan\r\n   *\r\n   * @description:\r\n   *   Return the tangent of a given angle in fixed point format.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The input angle.\r\n   *\r\n   * @return:\r\n   *   The tangent value.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Tan( FT_Angle  angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Atan2\r\n   *\r\n   * @description:\r\n   *   Return the arc-tangent corresponding to a given vector (x,y) in\r\n   *   the 2d plane.\r\n   *\r\n   * @input:\r\n   *   x ::\r\n   *     The horizontal vector coordinate.\r\n   *\r\n   *   y ::\r\n   *     The vertical vector coordinate.\r\n   *\r\n   * @return:\r\n   *   The arc-tangent value (i.e. angle).\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Angle )\r\n  FT_Atan2( FT_Fixed  x,\r\n            FT_Fixed  y );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Angle_Diff\r\n   *\r\n   * @description:\r\n   *   Return the difference between two angles.  The result is always\r\n   *   constrained to the ]-PI..PI] interval.\r\n   *\r\n   * @input:\r\n   *   angle1 ::\r\n   *     First angle.\r\n   *\r\n   *   angle2 ::\r\n   *     Second angle.\r\n   *\r\n   * @return:\r\n   *   Constrained value of `value2-value1'.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Angle )\r\n  FT_Angle_Diff( FT_Angle  angle1,\r\n                 FT_Angle  angle2 );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Unit\r\n   *\r\n   * @description:\r\n   *   Return the unit vector corresponding to a given angle.  After the\r\n   *   call, the value of `vec.x' will be `sin(angle)', and the value of\r\n   *   `vec.y' will be `cos(angle)'.\r\n   *\r\n   *   This function is useful to retrieve both the sinus and cosinus of a\r\n   *   given angle quickly.\r\n   *\r\n   * @output:\r\n   *   vec ::\r\n   *     The address of target vector.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The address of angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Unit( FT_Vector*  vec,\r\n                  FT_Angle    angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Rotate\r\n   *\r\n   * @description:\r\n   *   Rotate a vector by a given angle.\r\n   *\r\n   * @inout:\r\n   *   vec ::\r\n   *     The address of target vector.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The address of angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Rotate( FT_Vector*  vec,\r\n                    FT_Angle    angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Length\r\n   *\r\n   * @description:\r\n   *   Return the length of a given vector.\r\n   *\r\n   * @input:\r\n   *   vec ::\r\n   *     The address of target vector.\r\n   *\r\n   * @return:\r\n   *   The vector length, expressed in the same units that the original\r\n   *   vector coordinates.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Vector_Length( FT_Vector*  vec );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Polarize\r\n   *\r\n   * @description:\r\n   *   Compute both the length and angle of a given vector.\r\n   *\r\n   * @input:\r\n   *   vec ::\r\n   *     The address of source vector.\r\n   *\r\n   * @output:\r\n   *   length ::\r\n   *     The vector length.\r\n   *\r\n   *   angle ::\r\n   *     The vector angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Polarize( FT_Vector*  vec,\r\n                      FT_Fixed   *length,\r\n                      FT_Angle   *angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_From_Polar\r\n   *\r\n   * @description:\r\n   *   Compute vector coordinates from a length and angle.\r\n   *\r\n   * @output:\r\n   *   vec ::\r\n   *     The address of source vector.\r\n   *\r\n   * @input:\r\n   *   length ::\r\n   *     The vector length.\r\n   *\r\n   *   angle ::\r\n   *     The vector angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_From_Polar( FT_Vector*  vec,\r\n                        FT_Fixed    length,\r\n                        FT_Angle    angle );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTTRIGON_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/fttypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttypes.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType simple types definitions (specification only).              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2004, 2006-2009, 2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTTYPES_H__\r\n#define __FTTYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_SYSTEM_H\r\n#include FT_IMAGE_H\r\n\r\n#include <stddef.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Basic Data Types                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    The basic data types defined by the library.                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the basic data types defined by FreeType~2,  */\r\n  /*    ranging from simple scalar types to bitmap descriptors.  More      */\r\n  /*    font-specific structures are defined in a different section.       */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_Byte                                                            */\r\n  /*    FT_Bytes                                                           */\r\n  /*    FT_Char                                                            */\r\n  /*    FT_Int                                                             */\r\n  /*    FT_UInt                                                            */\r\n  /*    FT_Int16                                                           */\r\n  /*    FT_UInt16                                                          */\r\n  /*    FT_Int32                                                           */\r\n  /*    FT_UInt32                                                          */\r\n  /*    FT_Short                                                           */\r\n  /*    FT_UShort                                                          */\r\n  /*    FT_Long                                                            */\r\n  /*    FT_ULong                                                           */\r\n  /*    FT_Bool                                                            */\r\n  /*    FT_Offset                                                          */\r\n  /*    FT_PtrDist                                                         */\r\n  /*    FT_String                                                          */\r\n  /*    FT_Tag                                                             */\r\n  /*    FT_Error                                                           */\r\n  /*    FT_Fixed                                                           */\r\n  /*    FT_Pointer                                                         */\r\n  /*    FT_Pos                                                             */\r\n  /*    FT_Vector                                                          */\r\n  /*    FT_BBox                                                            */\r\n  /*    FT_Matrix                                                          */\r\n  /*    FT_FWord                                                           */\r\n  /*    FT_UFWord                                                          */\r\n  /*    FT_F2Dot14                                                         */\r\n  /*    FT_UnitVector                                                      */\r\n  /*    FT_F26Dot6                                                         */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*    FT_Generic                                                         */\r\n  /*    FT_Generic_Finalizer                                               */\r\n  /*                                                                       */\r\n  /*    FT_Bitmap                                                          */\r\n  /*    FT_Pixel_Mode                                                      */\r\n  /*    FT_Palette_Mode                                                    */\r\n  /*    FT_Glyph_Format                                                    */\r\n  /*    FT_IMAGE_TAG                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Bool                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef of unsigned char, used for simple booleans.  As usual,   */\r\n  /*    values 1 and~0 represent true and false, respectively.             */\r\n  /*                                                                       */\r\n  typedef unsigned char  FT_Bool;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_FWord                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A signed 16-bit integer used to store a distance in original font  */\r\n  /*    units.                                                             */\r\n  /*                                                                       */\r\n  typedef signed short  FT_FWord;   /* distance in FUnits */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UFWord                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An unsigned 16-bit integer used to store a distance in original    */\r\n  /*    font units.                                                        */\r\n  /*                                                                       */\r\n  typedef unsigned short  FT_UFWord;  /* unsigned distance */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Char                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for the _signed_ char type.                       */\r\n  /*                                                                       */\r\n  typedef signed char  FT_Char;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Byte                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for the _unsigned_ char type.                     */\r\n  /*                                                                       */\r\n  typedef unsigned char  FT_Byte;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Bytes                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for constant memory areas.                               */\r\n  /*                                                                       */\r\n  typedef const FT_Byte*  FT_Bytes;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Tag                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for 32-bit tags (as used in the SFNT format).            */\r\n  /*                                                                       */\r\n  typedef FT_UInt32  FT_Tag;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_String                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for the char type, usually used for strings.      */\r\n  /*                                                                       */\r\n  typedef char  FT_String;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Short                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for signed short.                                        */\r\n  /*                                                                       */\r\n  typedef signed short  FT_Short;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UShort                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for unsigned short.                                      */\r\n  /*                                                                       */\r\n  typedef unsigned short  FT_UShort;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Int                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for the int type.                                        */\r\n  /*                                                                       */\r\n  typedef signed int  FT_Int;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UInt                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for the unsigned int type.                               */\r\n  /*                                                                       */\r\n  typedef unsigned int  FT_UInt;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Long                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for signed long.                                         */\r\n  /*                                                                       */\r\n  typedef signed long  FT_Long;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_ULong                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for unsigned long.                                       */\r\n  /*                                                                       */\r\n  typedef unsigned long  FT_ULong;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_F2Dot14                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A signed 2.14 fixed float type used for unit vectors.              */\r\n  /*                                                                       */\r\n  typedef signed short  FT_F2Dot14;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_F26Dot6                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A signed 26.6 fixed float type used for vectorial pixel            */\r\n  /*    coordinates.                                                       */\r\n  /*                                                                       */\r\n  typedef signed long  FT_F26Dot6;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Fixed                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This type is used to store 16.16 fixed float values, like scaling  */\r\n  /*    values or matrix coefficients.                                     */\r\n  /*                                                                       */\r\n  typedef signed long  FT_Fixed;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Error                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The FreeType error code type.  A value of~0 is always interpreted  */\r\n  /*    as a successful operation.                                         */\r\n  /*                                                                       */\r\n  typedef int  FT_Error;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Pointer                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for a typeless pointer.                           */\r\n  /*                                                                       */\r\n  typedef void*  FT_Pointer;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Offset                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is equivalent to the ANSI~C `size_t' type, i.e., the largest  */\r\n  /*    _unsigned_ integer type used to express a file size or position,   */\r\n  /*    or a memory block size.                                            */\r\n  /*                                                                       */\r\n  typedef size_t  FT_Offset;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_PtrDist                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the       */\r\n  /*    largest _signed_ integer type used to express the distance         */\r\n  /*    between two pointers.                                              */\r\n  /*                                                                       */\r\n  typedef ft_ptrdiff_t  FT_PtrDist;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_UnitVector                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to store a 2D vector unit vector.  Uses    */\r\n  /*    FT_F2Dot14 types.                                                  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x :: Horizontal coordinate.                                        */\r\n  /*                                                                       */\r\n  /*    y :: Vertical coordinate.                                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_UnitVector_\r\n  {\r\n    FT_F2Dot14  x;\r\n    FT_F2Dot14  y;\r\n\r\n  } FT_UnitVector;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Matrix                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to store a 2x2 matrix.  Coefficients are   */\r\n  /*    in 16.16 fixed float format.  The computation performed is:        */\r\n  /*                                                                       */\r\n  /*       {                                                               */\r\n  /*          x' = x*xx + y*xy                                             */\r\n  /*          y' = x*yx + y*yy                                             */\r\n  /*       }                                                               */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    xx :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  /*    xy :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  /*    yx :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  /*    yy :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_Matrix_\r\n  {\r\n    FT_Fixed  xx, xy;\r\n    FT_Fixed  yx, yy;\r\n\r\n  } FT_Matrix;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Data                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Read-only binary data represented as a pointer and a length.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    pointer :: The data.                                               */\r\n  /*                                                                       */\r\n  /*    length  :: The length of the data in bytes.                        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Data_\r\n  {\r\n    const FT_Byte*  pointer;\r\n    FT_Int          length;\r\n\r\n  } FT_Data;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Generic_Finalizer                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Describe a function used to destroy the `client' data of any       */\r\n  /*    FreeType object.  See the description of the @FT_Generic type for  */\r\n  /*    details of usage.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    The address of the FreeType object which is under finalization.    */\r\n  /*    Its client data is accessed through its `generic' field.           */\r\n  /*                                                                       */\r\n  typedef void  (*FT_Generic_Finalizer)(void*  object);\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Generic                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Client applications often need to associate their own data to a    */\r\n  /*    variety of FreeType core objects.  For example, a text layout API  */\r\n  /*    might want to associate a glyph cache to a given size object.      */\r\n  /*                                                                       */\r\n  /*    Some FreeType object contains a `generic' field, of type           */\r\n  /*    FT_Generic, which usage is left to client applications and font    */\r\n  /*    servers.                                                           */\r\n  /*                                                                       */\r\n  /*    It can be used to store a pointer to client-specific data, as well */\r\n  /*    as the address of a `finalizer' function, which will be called by  */\r\n  /*    FreeType when the object is destroyed (for example, the previous   */\r\n  /*    client example would put the address of the glyph cache destructor */\r\n  /*    in the `finalizer' field).                                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    data      :: A typeless pointer to any client-specified data. This */\r\n  /*                 field is completely ignored by the FreeType library.  */\r\n  /*                                                                       */\r\n  /*    finalizer :: A pointer to a `generic finalizer' function, which    */\r\n  /*                 will be called when the object is destroyed.  If this */\r\n  /*                 field is set to NULL, no code will be called.         */\r\n  /*                                                                       */\r\n  typedef struct  FT_Generic_\r\n  {\r\n    void*                 data;\r\n    FT_Generic_Finalizer  finalizer;\r\n\r\n  } FT_Generic;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_MAKE_TAG                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro converts four-letter tags which are used to label       */\r\n  /*    TrueType tables into an unsigned long to be used within FreeType.  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The produced values *must* be 32-bit integers.  Don't redefine     */\r\n  /*    this macro.                                                        */\r\n  /*                                                                       */\r\n#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \\\r\n          (FT_Tag)                        \\\r\n          ( ( (FT_ULong)_x1 << 24 ) |     \\\r\n            ( (FT_ULong)_x2 << 16 ) |     \\\r\n            ( (FT_ULong)_x3 <<  8 ) |     \\\r\n              (FT_ULong)_x4         )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                    L I S T   M A N A G E M E N T                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    list_processing                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_ListNode                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*     Many elements and objects in FreeType are listed through an       */\r\n  /*     @FT_List record (see @FT_ListRec).  As its name suggests, an      */\r\n  /*     FT_ListNode is a handle to a single list element.                 */\r\n  /*                                                                       */\r\n  typedef struct FT_ListNodeRec_*  FT_ListNode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_List                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a list record (see @FT_ListRec).                       */\r\n  /*                                                                       */\r\n  typedef struct FT_ListRec_*  FT_List;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_ListNodeRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold a single list element.                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    prev :: The previous element in the list.  NULL if first.          */\r\n  /*                                                                       */\r\n  /*    next :: The next element in the list.  NULL if last.               */\r\n  /*                                                                       */\r\n  /*    data :: A typeless pointer to the listed object.                   */\r\n  /*                                                                       */\r\n  typedef struct  FT_ListNodeRec_\r\n  {\r\n    FT_ListNode  prev;\r\n    FT_ListNode  next;\r\n    void*        data;\r\n\r\n  } FT_ListNodeRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_ListRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold a simple doubly-linked list.  These are   */\r\n  /*    used in many parts of FreeType.                                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    head :: The head (first element) of doubly-linked list.            */\r\n  /*                                                                       */\r\n  /*    tail :: The tail (last element) of doubly-linked list.             */\r\n  /*                                                                       */\r\n  typedef struct  FT_ListRec_\r\n  {\r\n    FT_ListNode  head;\r\n    FT_ListNode  tail;\r\n\r\n  } FT_ListRec;\r\n\r\n\r\n  /* */\r\n\r\n#define FT_IS_EMPTY( list )  ( (list).head == 0 )\r\n\r\n  /* return base error code (without module-specific prefix) */\r\n#define FT_ERROR_BASE( x )    ( (x) & 0xFF )\r\n\r\n  /* return module error code */\r\n#define FT_ERROR_MODULE( x )  ( (x) & 0xFF00U )\r\n\r\n#define FT_BOOL( x )  ( (FT_Bool)( x ) )\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftwinfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftwinfnt.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for accessing Windows fnt-specific data.                */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2008 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTWINFNT_H__\r\n#define __FTWINFNT_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    winfnt_fonts                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Window FNT Files                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Windows FNT specific API.                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of Windows FNT specific      */\r\n  /*    functions.                                                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_WinFNT_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `charset' byte in\r\n   *   @FT_WinFNT_HeaderRec.  Exact mapping tables for the various cpXXXX\r\n   *   encodings (except for cp1361) can be found at ftp://ftp.unicode.org\r\n   *   in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory.  cp1361 is\r\n   *   roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.\r\n   *\r\n   * @values:\r\n   *   FT_WinFNT_ID_DEFAULT ::\r\n   *     This is used for font enumeration and font creation as a\r\n   *     `don't care' value.  Valid font files don't contain this value.\r\n   *     When querying for information about the character set of the font\r\n   *     that is currently selected into a specified device context, this\r\n   *     return value (of the related Windows API) simply denotes failure.\r\n   *\r\n   *   FT_WinFNT_ID_SYMBOL ::\r\n   *     There is no known mapping table available.\r\n   *\r\n   *   FT_WinFNT_ID_MAC ::\r\n   *     Mac Roman encoding.\r\n   *\r\n   *   FT_WinFNT_ID_OEM ::\r\n   *     From Michael Pöttgen <michael@poettgen.de>:\r\n   *\r\n   *       The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM\r\n   *       is used for the charset of vector fonts, like `modern.fon',\r\n   *       `roman.fon', and `script.fon' on Windows.\r\n   *\r\n   *       The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value\r\n   *       specifies a character set that is operating-system dependent.\r\n   *\r\n   *       The `IFIMETRICS' documentation from the `Windows Driver\r\n   *       Development Kit' says: This font supports an OEM-specific\r\n   *       character set.  The OEM character set is system dependent.\r\n   *\r\n   *       In general OEM, as opposed to ANSI (i.e., cp1252), denotes the\r\n   *       second default codepage that most international versions of\r\n   *       Windows have.  It is one of the OEM codepages from\r\n   *\r\n   *         http://www.microsoft.com/globaldev/reference/cphome.mspx,\r\n   *\r\n   *       and is used for the `DOS boxes', to support legacy applications.\r\n   *       A German Windows version for example usually uses ANSI codepage\r\n   *       1252 and OEM codepage 850.\r\n   *\r\n   *   FT_WinFNT_ID_CP874 ::\r\n   *     A superset of Thai TIS 620 and ISO 8859-11.\r\n   *\r\n   *   FT_WinFNT_ID_CP932 ::\r\n   *     A superset of Japanese Shift-JIS (with minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP936 ::\r\n   *     A superset of simplified Chinese GB 2312-1980 (with different\r\n   *     ordering and minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP949 ::\r\n   *     A superset of Korean Hangul KS~C 5601-1987 (with different\r\n   *     ordering and minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP950 ::\r\n   *     A superset of traditional Chinese Big~5 ETen (with different\r\n   *     ordering and minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP1250 ::\r\n   *     A superset of East European ISO 8859-2 (with slightly different\r\n   *     ordering).\r\n   *\r\n   *   FT_WinFNT_ID_CP1251 ::\r\n   *     A superset of Russian ISO 8859-5 (with different ordering).\r\n   *\r\n   *   FT_WinFNT_ID_CP1252 ::\r\n   *     ANSI encoding.  A superset of ISO 8859-1.\r\n   *\r\n   *   FT_WinFNT_ID_CP1253 ::\r\n   *     A superset of Greek ISO 8859-7 (with minor modifications).\r\n   *\r\n   *   FT_WinFNT_ID_CP1254 ::\r\n   *     A superset of Turkish ISO 8859-9.\r\n   *\r\n   *   FT_WinFNT_ID_CP1255 ::\r\n   *     A superset of Hebrew ISO 8859-8 (with some modifications).\r\n   *\r\n   *   FT_WinFNT_ID_CP1256 ::\r\n   *     A superset of Arabic ISO 8859-6 (with different ordering).\r\n   *\r\n   *   FT_WinFNT_ID_CP1257 ::\r\n   *     A superset of Baltic ISO 8859-13 (with some deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP1258 ::\r\n   *     For Vietnamese.  This encoding doesn't cover all necessary\r\n   *     characters.\r\n   *\r\n   *   FT_WinFNT_ID_CP1361 ::\r\n   *     Korean (Johab).\r\n   */\r\n\r\n#define FT_WinFNT_ID_CP1252    0\r\n#define FT_WinFNT_ID_DEFAULT   1\r\n#define FT_WinFNT_ID_SYMBOL    2\r\n#define FT_WinFNT_ID_MAC      77\r\n#define FT_WinFNT_ID_CP932   128\r\n#define FT_WinFNT_ID_CP949   129\r\n#define FT_WinFNT_ID_CP1361  130\r\n#define FT_WinFNT_ID_CP936   134\r\n#define FT_WinFNT_ID_CP950   136\r\n#define FT_WinFNT_ID_CP1253  161\r\n#define FT_WinFNT_ID_CP1254  162\r\n#define FT_WinFNT_ID_CP1258  163\r\n#define FT_WinFNT_ID_CP1255  177\r\n#define FT_WinFNT_ID_CP1256  178\r\n#define FT_WinFNT_ID_CP1257  186\r\n#define FT_WinFNT_ID_CP1251  204\r\n#define FT_WinFNT_ID_CP874   222\r\n#define FT_WinFNT_ID_CP1250  238\r\n#define FT_WinFNT_ID_OEM     255\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_WinFNT_HeaderRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Windows FNT Header info.                                           */\r\n  /*                                                                       */\r\n  typedef struct  FT_WinFNT_HeaderRec_\r\n  {\r\n    FT_UShort  version;\r\n    FT_ULong   file_size;\r\n    FT_Byte    copyright[60];\r\n    FT_UShort  file_type;\r\n    FT_UShort  nominal_point_size;\r\n    FT_UShort  vertical_resolution;\r\n    FT_UShort  horizontal_resolution;\r\n    FT_UShort  ascent;\r\n    FT_UShort  internal_leading;\r\n    FT_UShort  external_leading;\r\n    FT_Byte    italic;\r\n    FT_Byte    underline;\r\n    FT_Byte    strike_out;\r\n    FT_UShort  weight;\r\n    FT_Byte    charset;\r\n    FT_UShort  pixel_width;\r\n    FT_UShort  pixel_height;\r\n    FT_Byte    pitch_and_family;\r\n    FT_UShort  avg_width;\r\n    FT_UShort  max_width;\r\n    FT_Byte    first_char;\r\n    FT_Byte    last_char;\r\n    FT_Byte    default_char;\r\n    FT_Byte    break_char;\r\n    FT_UShort  bytes_per_row;\r\n    FT_ULong   device_offset;\r\n    FT_ULong   face_name_offset;\r\n    FT_ULong   bits_pointer;\r\n    FT_ULong   bits_offset;\r\n    FT_Byte    reserved;\r\n    FT_ULong   flags;\r\n    FT_UShort  A_space;\r\n    FT_UShort  B_space;\r\n    FT_UShort  C_space;\r\n    FT_UShort  color_table_offset;\r\n    FT_ULong   reserved1[4];\r\n\r\n  } FT_WinFNT_HeaderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_WinFNT_Header                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an @FT_WinFNT_HeaderRec structure.                     */\r\n  /*                                                                       */\r\n  typedef struct FT_WinFNT_HeaderRec_*  FT_WinFNT_Header;\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_WinFNT_Header\r\n   *\r\n   * @description:\r\n   *    Retrieve a Windows FNT font info header.\r\n   *\r\n   * @input:\r\n   *    face    :: A handle to the input face.\r\n   *\r\n   * @output:\r\n   *    aheader :: The WinFNT header.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   This function only works with Windows FNT faces, returning an error\r\n   *   otherwise.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_WinFNT_Header( FT_Face               face,\r\n                        FT_WinFNT_HeaderRec  *aheader );\r\n\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTWINFNT_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ftxf86.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftxf86.h                                                               */\r\n/*                                                                         */\r\n/*    Support functions for X11.                                           */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006, 2007 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTXF86_H__\r\n#define __FTXF86_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*   font_formats                                                        */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*   Font Formats                                                        */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*   Getting the font format.                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   The single function in this section can be used to get the font     */\r\n  /*   format.  Note that this information is not needed normally;         */\r\n  /*   however, there are special cases (like in PDF devices) where it is  */\r\n  /*   important to differentiate, in spite of FreeType's uniform API.     */\r\n  /*                                                                       */\r\n  /*   This function is in the X11/xf86 namespace for historical reasons   */\r\n  /*   and in no way depends on that windowing system.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*   FT_Get_X11_Font_Format                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   Return a string describing the format of a given face, using values */\r\n  /*   which can be used as an X11 FONT_PROPERTY.  Possible values are     */\r\n  /*   `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */\r\n  /*   `PFR', and `Windows~FNT'.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*   face ::                                                             */\r\n  /*     Input face handle.                                                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   Font format string.  NULL in case of error.                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( const char* )\r\n  FT_Get_X11_Font_Format( FT_Face  face );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTXF86_H__ */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/autohint.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  autohint.h                                                             */\r\n/*                                                                         */\r\n/*    High-level `autohint' module-specific interface (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2007, 2009, 2012 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The auto-hinter is used to load and automatically hint glyphs if a    */\r\n  /* format-specific hinter isn't available.                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __AUTOHINT_H__\r\n#define __AUTOHINT_H__\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A small technical note regarding automatic hinting in order to        */\r\n  /* clarify this module interface.                                        */\r\n  /*                                                                       */\r\n  /* An automatic hinter might compute two kinds of data for a given face: */\r\n  /*                                                                       */\r\n  /* - global hints: Usually some metrics that describe global properties  */\r\n  /*                 of the face.  It is computed by scanning more or less */\r\n  /*                 aggressively the glyphs in the face, and thus can be  */\r\n  /*                 very slow to compute (even if the size of global      */\r\n  /*                 hints is really small).                               */\r\n  /*                                                                       */\r\n  /* - glyph hints:  These describe some important features of the glyph   */\r\n  /*                 outline, as well as how to align them.  They are      */\r\n  /*                 generally much faster to compute than global hints.   */\r\n  /*                                                                       */\r\n  /* The current FreeType auto-hinter does a pretty good job while         */\r\n  /* performing fast computations for both global and glyph hints.         */\r\n  /* However, we might be interested in introducing more complex and       */\r\n  /* powerful algorithms in the future, like the one described in the John */\r\n  /* D. Hobby paper, which unfortunately requires a lot more horsepower.   */\r\n  /*                                                                       */\r\n  /* Because a sufficiently sophisticated font management system would     */\r\n  /* typically implement an LRU cache of opened face objects to reduce     */\r\n  /* memory usage, it is a good idea to be able to avoid recomputing       */\r\n  /* global hints every time the same face is re-opened.                   */\r\n  /*                                                                       */\r\n  /* We thus provide the ability to cache global hints outside of the face */\r\n  /* object, in order to speed up font re-opening time.  Of course, this   */\r\n  /* feature is purely optional, so most client programs won't even notice */\r\n  /* it.                                                                   */\r\n  /*                                                                       */\r\n  /* I initially thought that it would be a good idea to cache the glyph   */\r\n  /* hints too.  However, my general idea now is that if you really need   */\r\n  /* to cache these too, you are simply in need of a new font format,      */\r\n  /* where all this information could be stored within the font file and   */\r\n  /* decoded on the fly.                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef struct FT_AutoHinterRec_  *FT_AutoHinter;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlobalGetFunc                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the global hints computed for a given face object.  The   */\r\n  /*    resulting data is dissociated from the face and will survive a     */\r\n  /*    call to FT_Done_Face().  It must be discarded through the API      */\r\n  /*    FT_AutoHinter_GlobalDoneFunc().                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hinter       :: A handle to the source auto-hinter.                */\r\n  /*                                                                       */\r\n  /*    face         :: A handle to the source face object.                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    global_hints :: A typeless pointer to the global hints.            */\r\n  /*                                                                       */\r\n  /*    global_len   :: The size in bytes of the global hints.             */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter  hinter,\r\n                                  FT_Face        face,\r\n                                  void**         global_hints,\r\n                                  long*          global_len );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlobalDoneFunc                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard the global hints retrieved through                         */\r\n  /*    FT_AutoHinter_GlobalGetFunc().  This is the only way these hints   */\r\n  /*    are freed from memory.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hinter :: A handle to the auto-hinter module.                      */\r\n  /*                                                                       */\r\n  /*    global :: A pointer to retrieved global hints to discard.          */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter  hinter,\r\n                                   void*          global );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlobalResetFunc                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to recompute the global metrics in a given   */\r\n  /*    font.  This is useful when global font data changes (e.g. Multiple */\r\n  /*    Masters fonts where blend coordinates change).                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hinter :: A handle to the source auto-hinter.                      */\r\n  /*                                                                       */\r\n  /*    face   :: A handle to the face.                                    */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter  hinter,\r\n                                    FT_Face        face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlyphLoadFunc                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to load, scale, and automatically hint a     */\r\n  /*    glyph from a given face.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to the face.                               */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The glyph index.                                    */\r\n  /*                                                                       */\r\n  /*    load_flags  :: The load flags.                                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is capable of loading composite glyphs by hinting    */\r\n  /*    each sub-glyph independently (which improves quality).             */\r\n  /*                                                                       */\r\n  /*    It will call the font driver with @FT_Load_Glyph, with             */\r\n  /*    @FT_LOAD_NO_SCALE set.                                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter  hinter,\r\n                                  FT_GlyphSlot   slot,\r\n                                  FT_Size        size,\r\n                                  FT_UInt        glyph_index,\r\n                                  FT_Int32       load_flags );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_AutoHinter_InterfaceRec                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The auto-hinter module's interface.                                */\r\n  /*                                                                       */\r\n  typedef struct  FT_AutoHinter_InterfaceRec_\r\n  {\r\n    FT_AutoHinter_GlobalResetFunc  reset_face;\r\n    FT_AutoHinter_GlobalGetFunc    get_global_hints;\r\n    FT_AutoHinter_GlobalDoneFunc   done_global_hints;\r\n    FT_AutoHinter_GlyphLoadFunc    load_glyph;\r\n\r\n  } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_AUTOHINTER_INTERFACE(       \\\r\n          class_,                             \\\r\n          reset_face_,                        \\\r\n          get_global_hints_,                  \\\r\n          done_global_hints_,                 \\\r\n          load_glyph_ )                       \\\r\n  FT_CALLBACK_TABLE_DEF                       \\\r\n  const FT_AutoHinter_InterfaceRec  class_ =  \\\r\n  {                                           \\\r\n    reset_face_,                              \\\r\n    get_global_hints_,                        \\\r\n    done_global_hints_,                       \\\r\n    load_glyph_                               \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_AUTOHINTER_INTERFACE(                            \\\r\n          class_,                                                  \\\r\n          reset_face_,                                             \\\r\n          get_global_hints_,                                       \\\r\n          done_global_hints_,                                      \\\r\n          load_glyph_ )                                            \\\r\n  void                                                             \\\r\n  FT_Init_Class_ ## class_( FT_Library                   library,  \\\r\n                            FT_AutoHinter_InterfaceRec*  clazz )   \\\r\n  {                                                                \\\r\n    FT_UNUSED( library );                                          \\\r\n                                                                   \\\r\n    clazz->reset_face        = reset_face_;                        \\\r\n    clazz->get_global_hints  = get_global_hints_;                  \\\r\n    clazz->done_global_hints = done_global_hints_;                 \\\r\n    clazz->load_glyph        = load_glyph_;                        \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AUTOHINT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftcalc.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcalc.h                                                               */\r\n/*                                                                         */\r\n/*    Arithmetic computations (specification).                             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2008, 2009, 2012 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCALC_H__\r\n#define __FTCALC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_FixedSqrt                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the square root of a 16.16 fixed point value.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    x :: The value to compute the root for.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `sqrt(x)'.                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is not very fast.                                    */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Int32 )\r\n  FT_SqrtFixed( FT_Int32  x );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Sqrt32                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the square root of an Int32 integer (which will be        */\r\n  /*    handled as an unsigned long value).                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    x :: The value to compute the root for.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `sqrt(x)'.                                           */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Int32 )\r\n  FT_Sqrt32( FT_Int32  x );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FT_MulDiv() and FT_MulFix() are declared in freetype.h.               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_MulDiv_No_Round                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation `(a*b)/c'   */\r\n  /*    (without rounding) with maximum accuracy (it uses a 64-bit         */\r\n  /*    intermediate integer whenever necessary).                          */\r\n  /*                                                                       */\r\n  /*    This function isn't necessarily as fast as some processor specific */\r\n  /*    operations, but is at least completely portable.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.                                        */\r\n  /*    c :: The divisor.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*b)/c'.  This function never traps when trying to */\r\n  /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */\r\n  /*    on the signs of `a' and `b'.                                       */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Long )\r\n  FT_MulDiv_No_Round( FT_Long  a,\r\n                      FT_Long  b,\r\n                      FT_Long  c );\r\n\r\n\r\n  /*\r\n   *  A variant of FT_Matrix_Multiply which scales its result afterwards.\r\n   *  The idea is that both `a' and `b' are scaled by factors of 10 so that\r\n   *  the values are as precise as possible to get a correct result during\r\n   *  the 64bit multiplication.  Let `sa' and `sb' be the scaling factors of\r\n   *  `a' and `b', respectively, then the scaling factor of the result is\r\n   *  `sa*sb'.\r\n   */\r\n  FT_BASE( void )\r\n  FT_Matrix_Multiply_Scaled( const FT_Matrix*  a,\r\n                             FT_Matrix        *b,\r\n                             FT_Long           scaling );\r\n\r\n\r\n  /*\r\n   *  A variant of FT_Vector_Transform.  See comments for\r\n   *  FT_Matrix_Multiply_Scaled.\r\n   */\r\n\r\n  FT_BASE( void )\r\n  FT_Vector_Transform_Scaled( FT_Vector*        vector,\r\n                              const FT_Matrix*  matrix,\r\n                              FT_Long           scaling );\r\n\r\n\r\n  /*\r\n   *  Return -1, 0, or +1, depending on the orientation of a given corner.\r\n   *  We use the Cartesian coordinate system, with positive vertical values\r\n   *  going upwards.  The function returns +1 if the corner turns to the\r\n   *  left, -1 to the right, and 0 for undecidable cases.\r\n   */\r\n  FT_BASE( FT_Int )\r\n  ft_corner_orientation( FT_Pos  in_x,\r\n                         FT_Pos  in_y,\r\n                         FT_Pos  out_x,\r\n                         FT_Pos  out_y );\r\n\r\n  /*\r\n   *  Return TRUE if a corner is flat or nearly flat.  This is equivalent to\r\n   *  saying that the angle difference between the `in' and `out' vectors is\r\n   *  very small.\r\n   */\r\n  FT_BASE( FT_Int )\r\n  ft_corner_is_flat( FT_Pos  in_x,\r\n                     FT_Pos  in_y,\r\n                     FT_Pos  out_x,\r\n                     FT_Pos  out_y );\r\n\r\n\r\n#define INT_TO_F26DOT6( x )    ( (FT_Long)(x) << 6  )\r\n#define INT_TO_F2DOT14( x )    ( (FT_Long)(x) << 14 )\r\n#define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )\r\n#define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )\r\n#define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )\r\n#define FIXED_TO_INT( x )      ( FT_RoundFix( x ) >> 16 )\r\n\r\n#define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \\\r\n                                        : ( -( ( 32 - (x) ) & -64 ) ) )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCALC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftdebug.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdebug.h                                                              */\r\n/*                                                                         */\r\n/*    Debugging and logging component (specification).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/*                                                                         */\r\n/*  IMPORTANT: A description of FreeType's debugging support can be        */\r\n/*             found in `docs/DEBUG.TXT'.  Read it if you need to use or   */\r\n/*             understand this code.                                       */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTDEBUG_H__\r\n#define __FTDEBUG_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */\r\n  /* is already defined; this simplifies the following #ifdefs            */\r\n  /*                                                                      */\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n#undef  FT_DEBUG_LEVEL_ERROR\r\n#define FT_DEBUG_LEVEL_ERROR\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the trace enums as well as the trace levels array when they    */\r\n  /* are needed.                                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n#define FT_TRACE_DEF( x )  trace_ ## x ,\r\n\r\n  /* defining the enumeration */\r\n  typedef enum  FT_Trace_\r\n  {\r\n#include FT_INTERNAL_TRACE_H\r\n    trace_count\r\n\r\n  } FT_Trace;\r\n\r\n\r\n  /* defining the array of trace levels, provided by `src/base/ftdebug.c' */\r\n  extern int  ft_trace_levels[trace_count];\r\n\r\n#undef FT_TRACE_DEF\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the FT_TRACE macro                                             */\r\n  /*                                                                       */\r\n  /* IMPORTANT!                                                            */\r\n  /*                                                                       */\r\n  /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */\r\n  /* value before using any TRACE macro.                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n#define FT_TRACE( level, varformat )                      \\\r\n          do                                              \\\r\n          {                                               \\\r\n            if ( ft_trace_levels[FT_COMPONENT] >= level ) \\\r\n              FT_Message varformat;                       \\\r\n          } while ( 0 )\r\n\r\n#else /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n#define FT_TRACE( level, varformat )  do { } while ( 0 )      /* nothing */\r\n\r\n#endif /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Trace_Get_Count                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the number of available trace components.                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The number of trace components.  0 if FreeType 2 is not built with */\r\n  /*    FT_DEBUG_LEVEL_TRACE definition.                                   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function may be useful if you want to access elements of      */\r\n  /*    the internal `ft_trace_levels' array by an index.                  */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Int )\r\n  FT_Trace_Get_Count( void );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Trace_Get_Name                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the name of a trace component.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    The index of the trace component.                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The name of the trace component.  This is a statically allocated   */\r\n  /*    C string, so do not free it after use.  NULL if FreeType 2 is not  */\r\n  /*    built with FT_DEBUG_LEVEL_TRACE definition.                        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Use @FT_Trace_Get_Count to get the number of available trace       */\r\n  /*    components.                                                        */\r\n  /*                                                                       */\r\n  /*    This function may be useful if you want to control FreeType 2's    */\r\n  /*    debug level in your application.                                   */\r\n  /*                                                                       */\r\n  FT_BASE( const char * )\r\n  FT_Trace_Get_Name( FT_Int  idx );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* You need two opening and closing parentheses!                         */\r\n  /*                                                                       */\r\n  /* Example: FT_TRACE0(( \"Value is %i\", foo ))                            */\r\n  /*                                                                       */\r\n  /* Output of the FT_TRACEX macros is sent to stderr.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#define FT_TRACE0( varformat )  FT_TRACE( 0, varformat )\r\n#define FT_TRACE1( varformat )  FT_TRACE( 1, varformat )\r\n#define FT_TRACE2( varformat )  FT_TRACE( 2, varformat )\r\n#define FT_TRACE3( varformat )  FT_TRACE( 3, varformat )\r\n#define FT_TRACE4( varformat )  FT_TRACE( 4, varformat )\r\n#define FT_TRACE5( varformat )  FT_TRACE( 5, varformat )\r\n#define FT_TRACE6( varformat )  FT_TRACE( 6, varformat )\r\n#define FT_TRACE7( varformat )  FT_TRACE( 7, varformat )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the FT_ERROR macro.                                            */\r\n  /*                                                                       */\r\n  /* Output of this macro is sent to stderr.                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n#define FT_ERROR( varformat )  FT_Message  varformat\r\n\r\n#else  /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n#define FT_ERROR( varformat )  do { } while ( 0 )      /* nothing */\r\n\r\n#endif /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the FT_ASSERT macro.                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n#define FT_ASSERT( condition )                                      \\\r\n          do                                                        \\\r\n          {                                                         \\\r\n            if ( !( condition ) )                                   \\\r\n              FT_Panic( \"assertion failed on line %d of file %s\\n\", \\\r\n                        __LINE__, __FILE__ );                       \\\r\n          } while ( 0 )\r\n\r\n#else /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n#define FT_ASSERT( condition )  do { } while ( 0 )\r\n\r\n#endif /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define `FT_Message' and `FT_Panic' when needed.                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n#include \"stdio.h\"  /* for vfprintf() */\r\n\r\n  /* print a message */\r\n  FT_BASE( void )\r\n  FT_Message( const char*  fmt,\r\n              ... );\r\n\r\n  /* print a message and exit */\r\n  FT_BASE( void )\r\n  FT_Panic( const char*  fmt,\r\n            ... );\r\n\r\n#endif /* FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n  FT_BASE( void )\r\n  ft_debug_init( void );\r\n\r\n\r\n#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */\r\n\r\n  /* We disable the warning `conditional expression is constant' here */\r\n  /* in order to compile cleanly with the maximum level of warnings.  */\r\n#pragma warning( disable : 4127 )\r\n\r\n#endif /* _MSC_VER */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTDEBUG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftdriver.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdriver.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType font driver interface (specification).                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2006, 2008, 2011-2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTDRIVER_H__\r\n#define __FTDRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_InitFunc)( FT_Stream      stream,\r\n                       FT_Face        face,\r\n                       FT_Int         typeface_index,\r\n                       FT_Int         num_params,\r\n                       FT_Parameter*  parameters );\r\n\r\n  typedef void\r\n  (*FT_Face_DoneFunc)( FT_Face  face );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_InitFunc)( FT_Size  size );\r\n\r\n  typedef void\r\n  (*FT_Size_DoneFunc)( FT_Size  size );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Slot_InitFunc)( FT_GlyphSlot  slot );\r\n\r\n  typedef void\r\n  (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_RequestFunc)( FT_Size          size,\r\n                          FT_Size_Request  req );\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_SelectFunc)( FT_Size   size,\r\n                         FT_ULong  size_index );\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_ResetPointsFunc)( FT_Size     size,\r\n                              FT_F26Dot6  char_width,\r\n                              FT_F26Dot6  char_height,\r\n                              FT_UInt     horz_resolution,\r\n                              FT_UInt     vert_resolution );\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_ResetPixelsFunc)( FT_Size  size,\r\n                              FT_UInt  pixel_width,\r\n                              FT_UInt  pixel_height );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  typedef FT_Error\r\n  (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,\r\n                       FT_Size       size,\r\n                       FT_UInt       glyph_index,\r\n                       FT_Int32      load_flags );\r\n\r\n\r\n  typedef FT_UInt\r\n  (*FT_CharMap_CharIndexFunc)( FT_CharMap  charmap,\r\n                               FT_Long     charcode );\r\n\r\n  typedef FT_Long\r\n  (*FT_CharMap_CharNextFunc)( FT_CharMap  charmap,\r\n                              FT_Long     charcode );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_GetKerningFunc)( FT_Face     face,\r\n                             FT_UInt     left_glyph,\r\n                             FT_UInt     right_glyph,\r\n                             FT_Vector*  kerning );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_AttachFunc)( FT_Face    face,\r\n                         FT_Stream  stream );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_GetAdvancesFunc)( FT_Face    face,\r\n                              FT_UInt    first,\r\n                              FT_UInt    count,\r\n                              FT_Int32   flags,\r\n                              FT_Fixed*  advances );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Driver_ClassRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The font driver class.  This structure mostly contains pointers to */\r\n  /*    driver methods.                                                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root             :: The parent module.                             */\r\n  /*                                                                       */\r\n  /*    face_object_size :: The size of a face object in bytes.            */\r\n  /*                                                                       */\r\n  /*    size_object_size :: The size of a size object in bytes.            */\r\n  /*                                                                       */\r\n  /*    slot_object_size :: The size of a glyph object in bytes.           */\r\n  /*                                                                       */\r\n  /*    init_face        :: The format-specific face constructor.          */\r\n  /*                                                                       */\r\n  /*    done_face        :: The format-specific face destructor.           */\r\n  /*                                                                       */\r\n  /*    init_size        :: The format-specific size constructor.          */\r\n  /*                                                                       */\r\n  /*    done_size        :: The format-specific size destructor.           */\r\n  /*                                                                       */\r\n  /*    init_slot        :: The format-specific slot constructor.          */\r\n  /*                                                                       */\r\n  /*    done_slot        :: The format-specific slot destructor.           */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*    load_glyph       :: A function handle to load a glyph to a slot.   */\r\n  /*                        This field is mandatory!                       */\r\n  /*                                                                       */\r\n  /*    get_kerning      :: A function handle to return the unscaled       */\r\n  /*                        kerning for a given pair of glyphs.  Can be    */\r\n  /*                        set to 0 if the format doesn't support         */\r\n  /*                        kerning.                                       */\r\n  /*                                                                       */\r\n  /*    attach_file      :: This function handle is used to read           */\r\n  /*                        additional data for a face from another        */\r\n  /*                        file/stream.  For example, this can be used to */\r\n  /*                        add data from AFM or PFM files on a Type 1     */\r\n  /*                        face, or a CIDMap on a CID-keyed face.         */\r\n  /*                                                                       */\r\n  /*    get_advances     :: A function handle used to return advance       */\r\n  /*                        widths of `count' glyphs (in font units),      */\r\n  /*                        starting at `first'.  The `vertical' flag must */\r\n  /*                        be set to get vertical advance heights.  The   */\r\n  /*                        `advances' buffer is caller-allocated.         */\r\n  /*                        The idea of this function is to be able to     */\r\n  /*                        perform device-independent text layout without */\r\n  /*                        loading a single glyph image.                  */\r\n  /*                                                                       */\r\n  /*    request_size     :: A handle to a function used to request the new */\r\n  /*                        character size.  Can be set to 0 if the        */\r\n  /*                        scaling done in the base layer suffices.       */\r\n  /*                                                                       */\r\n  /*    select_size      :: A handle to a function used to select a new    */\r\n  /*                        fixed size.  It is used only if                */\r\n  /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */\r\n  /*                        to 0 if the scaling done in the base layer     */\r\n  /*                        suffices.                                      */\r\n  /* <Note>                                                                */\r\n  /*    Most function pointers, with the exception of `load_glyph', can be */\r\n  /*    set to 0 to indicate a default behaviour.                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_Driver_ClassRec_\r\n  {\r\n    FT_Module_Class          root;\r\n\r\n    FT_Long                  face_object_size;\r\n    FT_Long                  size_object_size;\r\n    FT_Long                  slot_object_size;\r\n\r\n    FT_Face_InitFunc         init_face;\r\n    FT_Face_DoneFunc         done_face;\r\n\r\n    FT_Size_InitFunc         init_size;\r\n    FT_Size_DoneFunc         done_size;\r\n\r\n    FT_Slot_InitFunc         init_slot;\r\n    FT_Slot_DoneFunc         done_slot;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n    FT_Size_ResetPointsFunc  set_char_sizes;\r\n    FT_Size_ResetPixelsFunc  set_pixel_sizes;\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    FT_Slot_LoadFunc         load_glyph;\r\n\r\n    FT_Face_GetKerningFunc   get_kerning;\r\n    FT_Face_AttachFunc       attach_file;\r\n    FT_Face_GetAdvancesFunc  get_advances;\r\n\r\n    /* since version 2.2 */\r\n    FT_Size_RequestFunc      request_size;\r\n    FT_Size_SelectFunc       select_size;\r\n\r\n  } FT_Driver_ClassRec, *FT_Driver_Class;\r\n\r\n\r\n  /*\r\n   *  The following functions are used as stubs for `set_char_sizes' and\r\n   *  `set_pixel_sizes'; the code uses `request_size' and `select_size'\r\n   *  functions instead.\r\n   *\r\n   *  Implementation is in `src/base/ftobjs.c'.\r\n   */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_BASE( FT_Error )\r\n  ft_stub_set_char_sizes( FT_Size     size,\r\n                          FT_F26Dot6  width,\r\n                          FT_F26Dot6  height,\r\n                          FT_UInt     horz_res,\r\n                          FT_UInt     vert_res );\r\n\r\n  FT_BASE( FT_Error )\r\n  ft_stub_set_pixel_sizes( FT_Size  size,\r\n                           FT_UInt  width,\r\n                           FT_UInt  height );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DECLARE_DRIVER                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to create a forward declaration of an FT_Driver_ClassRec      */\r\n  /*    struct instance.                                                   */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_DRIVER                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Driver_ClassRec struct.       */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */\r\n  /*    called with a pointer where the allocated structure is returned.   */\r\n  /*    And when it is no longer needed a `destroy' function needs to be   */\r\n  /*    called to release that allocation.                                 */\r\n  /*                                                                       */\r\n  /*    `fcinit.c' (ft_create_default_module_classes) already contains a   */\r\n  /*    mechanism to call these functions for the default modules          */\r\n  /*    described in `ftmodule.h'.                                         */\r\n  /*                                                                       */\r\n  /*    Notice that the created `create' and `destroy' functions call      */\r\n  /*    `pic_init' and `pic_free' to allow you to manually allocate and    */\r\n  /*    initialize any additional global data, like a module specific      */\r\n  /*    interface, and put them in the global pic container defined in     */\r\n  /*    `ftpic.h'.  If you don't need them just implement the functions as */\r\n  /*    empty to resolve the link error.  Also the `pic_init' and          */\r\n  /*    `pic_free' functions should be declared in `pic.h', to be referred */\r\n  /*    by driver definition calling `FT_DEFINE_DRIVER' in following.      */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro is     */\r\n  /*    used).                                                             */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \\\r\n          a_, b_,\r\n#else\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ )  /* empty */\r\n#endif\r\n\r\n#define FT_DECLARE_DRIVER( class_ )  \\\r\n  FT_CALLBACK_TABLE                   \\\r\n  const FT_Driver_ClassRec  class_;\r\n\r\n#define FT_DEFINE_DRIVER(                                    \\\r\n          class_,                                            \\\r\n          flags_,                                            \\\r\n          size_,                                             \\\r\n          name_,                                             \\\r\n          version_,                                          \\\r\n          requires_,                                         \\\r\n          interface_,                                        \\\r\n          init_,                                             \\\r\n          done_,                                             \\\r\n          get_interface_,                                    \\\r\n          face_object_size_,                                 \\\r\n          size_object_size_,                                 \\\r\n          slot_object_size_,                                 \\\r\n          init_face_,                                        \\\r\n          done_face_,                                        \\\r\n          init_size_,                                        \\\r\n          done_size_,                                        \\\r\n          init_slot_,                                        \\\r\n          done_slot_,                                        \\\r\n          old_set_char_sizes_,                               \\\r\n          old_set_pixel_sizes_,                              \\\r\n          load_glyph_,                                       \\\r\n          get_kerning_,                                      \\\r\n          attach_file_,                                      \\\r\n          get_advances_,                                     \\\r\n          request_size_,                                     \\\r\n          select_size_ )                                     \\\r\n  FT_CALLBACK_TABLE_DEF                                      \\\r\n  const FT_Driver_ClassRec  class_ =                         \\\r\n  {                                                          \\\r\n    FT_DEFINE_ROOT_MODULE( flags_,                           \\\r\n                           size_,                            \\\r\n                           name_,                            \\\r\n                           version_,                         \\\r\n                           requires_,                        \\\r\n                           interface_,                       \\\r\n                           init_,                            \\\r\n                           done_,                            \\\r\n                           get_interface_ )                  \\\r\n                                                             \\\r\n    face_object_size_,                                       \\\r\n    size_object_size_,                                       \\\r\n    slot_object_size_,                                       \\\r\n                                                             \\\r\n    init_face_,                                              \\\r\n    done_face_,                                              \\\r\n                                                             \\\r\n    init_size_,                                              \\\r\n    done_size_,                                              \\\r\n                                                             \\\r\n    init_slot_,                                              \\\r\n    done_slot_,                                              \\\r\n                                                             \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_,    \\\r\n                                     old_set_pixel_sizes_ )  \\\r\n                                                             \\\r\n    load_glyph_,                                             \\\r\n                                                             \\\r\n    get_kerning_,                                            \\\r\n    attach_file_,                                            \\\r\n    get_advances_,                                           \\\r\n                                                             \\\r\n    request_size_,                                           \\\r\n    select_size_                                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ )  \\\r\n          clazz->set_char_sizes  = a_;             \\\r\n          clazz->set_pixel_sizes = b_;\r\n#else\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ )  /* empty */\r\n#endif\r\n\r\n#define FT_DECLARE_DRIVER( class_ )  FT_DECLARE_MODULE( class_ )\r\n\r\n#define FT_DEFINE_DRIVER(                                        \\\r\n          class_,                                                \\\r\n          flags_,                                                \\\r\n          size_,                                                 \\\r\n          name_,                                                 \\\r\n          version_,                                              \\\r\n          requires_,                                             \\\r\n          interface_,                                            \\\r\n          init_,                                                 \\\r\n          done_,                                                 \\\r\n          get_interface_,                                        \\\r\n          face_object_size_,                                     \\\r\n          size_object_size_,                                     \\\r\n          slot_object_size_,                                     \\\r\n          init_face_,                                            \\\r\n          done_face_,                                            \\\r\n          init_size_,                                            \\\r\n          done_size_,                                            \\\r\n          init_slot_,                                            \\\r\n          done_slot_,                                            \\\r\n          old_set_char_sizes_,                                   \\\r\n          old_set_pixel_sizes_,                                  \\\r\n          load_glyph_,                                           \\\r\n          get_kerning_,                                          \\\r\n          attach_file_,                                          \\\r\n          get_advances_,                                         \\\r\n          request_size_,                                         \\\r\n          select_size_ )                                         \\\r\n  void                                                           \\\r\n  FT_Destroy_Class_ ## class_( FT_Library        library,        \\\r\n                               FT_Module_Class*  clazz )         \\\r\n  {                                                              \\\r\n    FT_Memory        memory = library->memory;                   \\\r\n    FT_Driver_Class  dclazz = (FT_Driver_Class)clazz;            \\\r\n                                                                 \\\r\n                                                                 \\\r\n    class_ ## _pic_free( library );                              \\\r\n    if ( dclazz )                                                \\\r\n      FT_FREE( dclazz );                                         \\\r\n  }                                                              \\\r\n                                                                 \\\r\n                                                                 \\\r\n  FT_Error                                                       \\\r\n  FT_Create_Class_ ## class_( FT_Library         library,        \\\r\n                              FT_Module_Class**  output_class )  \\\r\n  {                                                              \\\r\n    FT_Driver_Class  clazz  = NULL;                              \\\r\n    FT_Error         error;                                      \\\r\n    FT_Memory        memory = library->memory;                   \\\r\n                                                                 \\\r\n                                                                 \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \\\r\n      return error;                                              \\\r\n                                                                 \\\r\n    error = class_ ## _pic_init( library );                      \\\r\n    if ( error )                                                 \\\r\n    {                                                            \\\r\n      FT_FREE( clazz );                                          \\\r\n      return error;                                              \\\r\n    }                                                            \\\r\n                                                                 \\\r\n    FT_DEFINE_ROOT_MODULE( flags_,                               \\\r\n                           size_,                                \\\r\n                           name_,                                \\\r\n                           version_,                             \\\r\n                           requires_,                            \\\r\n                           interface_,                           \\\r\n                           init_,                                \\\r\n                           done_,                                \\\r\n                           get_interface_ )                      \\\r\n                                                                 \\\r\n    clazz->face_object_size = face_object_size_;                 \\\r\n    clazz->size_object_size = size_object_size_;                 \\\r\n    clazz->slot_object_size = slot_object_size_;                 \\\r\n                                                                 \\\r\n    clazz->init_face        = init_face_;                        \\\r\n    clazz->done_face        = done_face_;                        \\\r\n                                                                 \\\r\n    clazz->init_size        = init_size_;                        \\\r\n    clazz->done_size        = done_size_;                        \\\r\n                                                                 \\\r\n    clazz->init_slot        = init_slot_;                        \\\r\n    clazz->done_slot        = done_slot_;                        \\\r\n                                                                 \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_,        \\\r\n                                     old_set_pixel_sizes_ )      \\\r\n                                                                 \\\r\n    clazz->load_glyph       = load_glyph_;                       \\\r\n                                                                 \\\r\n    clazz->get_kerning      = get_kerning_;                      \\\r\n    clazz->attach_file      = attach_file_;                      \\\r\n    clazz->get_advances     = get_advances_;                     \\\r\n                                                                 \\\r\n    clazz->request_size     = request_size_;                     \\\r\n    clazz->select_size      = select_size_;                      \\\r\n                                                                 \\\r\n    *output_class = (FT_Module_Class*)clazz;                     \\\r\n                                                                 \\\r\n    return FT_Err_Ok;                                            \\\r\n  }\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftgloadr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgloadr.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph loader (specification).                           */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2005, 2006 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGLOADR_H__\r\n#define __FTGLOADR_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_GlyphLoader                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The glyph loader is an internal object used to load several glyphs */\r\n  /*    together (for example, in the case of composites).                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The glyph loader implementation is not part of the high-level API, */\r\n  /*    hence the forward structure declaration.                           */\r\n  /*                                                                       */\r\n  typedef struct FT_GlyphLoaderRec_*  FT_GlyphLoader ;\r\n\r\n\r\n#if 0  /* moved to freetype.h in version 2.2 */\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2\r\n#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4\r\n#define FT_SUBGLYPH_FLAG_SCALE                   8\r\n#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40\r\n#define FT_SUBGLYPH_FLAG_2X2                  0x80\r\n#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200\r\n#endif\r\n\r\n\r\n  typedef struct  FT_SubGlyphRec_\r\n  {\r\n    FT_Int     index;\r\n    FT_UShort  flags;\r\n    FT_Int     arg1;\r\n    FT_Int     arg2;\r\n    FT_Matrix  transform;\r\n\r\n  } FT_SubGlyphRec;\r\n\r\n\r\n  typedef struct  FT_GlyphLoadRec_\r\n  {\r\n    FT_Outline   outline;       /* outline                   */\r\n    FT_Vector*   extra_points;  /* extra points table        */\r\n    FT_Vector*   extra_points2; /* second extra points table */\r\n    FT_UInt      num_subglyphs; /* number of subglyphs       */\r\n    FT_SubGlyph  subglyphs;     /* subglyphs                 */\r\n\r\n  } FT_GlyphLoadRec, *FT_GlyphLoad;\r\n\r\n\r\n  typedef struct  FT_GlyphLoaderRec_\r\n  {\r\n    FT_Memory        memory;\r\n    FT_UInt          max_points;\r\n    FT_UInt          max_contours;\r\n    FT_UInt          max_subglyphs;\r\n    FT_Bool          use_extra;\r\n\r\n    FT_GlyphLoadRec  base;\r\n    FT_GlyphLoadRec  current;\r\n\r\n    void*            other;            /* for possible future extension? */\r\n\r\n  } FT_GlyphLoaderRec;\r\n\r\n\r\n  /* create new empty glyph loader */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_New( FT_Memory        memory,\r\n                      FT_GlyphLoader  *aloader );\r\n\r\n  /* add an extra points table to a glyph loader */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CreateExtra( FT_GlyphLoader  loader );\r\n\r\n  /* destroy a glyph loader */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Done( FT_GlyphLoader  loader );\r\n\r\n  /* reset a glyph loader (frees everything int it) */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Reset( FT_GlyphLoader  loader );\r\n\r\n  /* rewind a glyph loader */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Rewind( FT_GlyphLoader  loader );\r\n\r\n  /* check that there is enough space to add `n_points' and `n_contours' */\r\n  /* to the glyph loader                                                 */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CheckPoints( FT_GlyphLoader  loader,\r\n                              FT_UInt         n_points,\r\n                              FT_UInt         n_contours );\r\n\r\n\r\n#define FT_GLYPHLOADER_CHECK_P( _loader, _count )                         \\\r\n   ( (_count) == 0 || ((_loader)->base.outline.n_points    +              \\\r\n                       (_loader)->current.outline.n_points +              \\\r\n                       (unsigned long)(_count)) <= (_loader)->max_points )\r\n\r\n#define FT_GLYPHLOADER_CHECK_C( _loader, _count )                          \\\r\n  ( (_count) == 0 || ((_loader)->base.outline.n_contours    +              \\\r\n                      (_loader)->current.outline.n_contours +              \\\r\n                      (unsigned long)(_count)) <= (_loader)->max_contours )\r\n\r\n#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \\\r\n  ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \\\r\n      FT_GLYPHLOADER_CHECK_C( _loader, _contours ) )                   \\\r\n    ? 0                                                                \\\r\n    : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )\r\n\r\n\r\n  /* check that there is enough space to add `n_subs' sub-glyphs to */\r\n  /* a glyph loader                                                 */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader  loader,\r\n                                 FT_UInt         n_subs );\r\n\r\n  /* prepare a glyph loader, i.e. empty the current glyph */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Prepare( FT_GlyphLoader  loader );\r\n\r\n  /* add the current glyph to the base glyph */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Add( FT_GlyphLoader  loader );\r\n\r\n  /* copy points from one glyph loader to another */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CopyPoints( FT_GlyphLoader  target,\r\n                             FT_GlyphLoader  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGLOADR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftmemory.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmemory.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType memory management macros (specification).               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMEMORY_H__\r\n#define __FTMEMORY_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_SET_ERROR                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro is used to set an implicit `error' variable to a given  */\r\n  /*    expression's value (usually a function call), and convert it to a  */\r\n  /*    boolean which is set whenever the value is != 0.                   */\r\n  /*                                                                       */\r\n#undef  FT_SET_ERROR\r\n#define FT_SET_ERROR( expression ) \\\r\n          ( ( error = (expression) ) != 0 )\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                           M E M O R Y                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*\r\n   *  C++ refuses to handle statements like p = (void*)anything, with `p' a\r\n   *  typed pointer.  Since we don't have a `typeof' operator in standard\r\n   *  C++, we have to use a template to emulate it.\r\n   */\r\n\r\n#ifdef __cplusplus\r\n\r\n  extern \"C++\"\r\n  template <typename T> inline T*\r\n  cplusplus_typeof(        T*,\r\n                    void  *v )\r\n  {\r\n    return static_cast <T*> ( v );\r\n  }\r\n\r\n#define FT_ASSIGNP( p, val )  (p) = cplusplus_typeof( (p), (val) )\r\n\r\n#else\r\n\r\n#define FT_ASSIGNP( p, val )  (p) = (val)\r\n\r\n#endif\r\n\r\n\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n\r\n  FT_BASE( const char* )  _ft_debug_file;\r\n  FT_BASE( long )         _ft_debug_lineno;\r\n\r\n#define FT_DEBUG_INNER( exp )  ( _ft_debug_file   = __FILE__, \\\r\n                                 _ft_debug_lineno = __LINE__, \\\r\n                                 (exp) )\r\n\r\n#define FT_ASSIGNP_INNER( p, exp )  ( _ft_debug_file   = __FILE__, \\\r\n                                      _ft_debug_lineno = __LINE__, \\\r\n                                      FT_ASSIGNP( p, exp ) )\r\n\r\n#else /* !FT_DEBUG_MEMORY */\r\n\r\n#define FT_DEBUG_INNER( exp )       (exp)\r\n#define FT_ASSIGNP_INNER( p, exp )  FT_ASSIGNP( p, exp )\r\n\r\n#endif /* !FT_DEBUG_MEMORY */\r\n\r\n\r\n  /*\r\n   *  The allocation functions return a pointer, and the error code\r\n   *  is written to through the `p_error' parameter.  See below for\r\n   *  for documentation.\r\n   */\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_alloc( FT_Memory  memory,\r\n                FT_Long    size,\r\n                FT_Error  *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_qalloc( FT_Memory  memory,\r\n                 FT_Long    size,\r\n                 FT_Error  *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_realloc( FT_Memory  memory,\r\n                  FT_Long    item_size,\r\n                  FT_Long    cur_count,\r\n                  FT_Long    new_count,\r\n                  void*      block,\r\n                  FT_Error  *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_qrealloc( FT_Memory  memory,\r\n                   FT_Long    item_size,\r\n                   FT_Long    cur_count,\r\n                   FT_Long    new_count,\r\n                   void*      block,\r\n                   FT_Error  *p_error );\r\n\r\n  FT_BASE( void )\r\n  ft_mem_free( FT_Memory    memory,\r\n               const void*  P );\r\n\r\n\r\n#define FT_MEM_ALLOC( ptr, size )                                         \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) )\r\n\r\n#define FT_MEM_FREE( ptr )                \\\r\n          FT_BEGIN_STMNT                  \\\r\n            ft_mem_free( memory, (ptr) ); \\\r\n            (ptr) = NULL;                 \\\r\n          FT_END_STMNT\r\n\r\n#define FT_MEM_NEW( ptr )                        \\\r\n          FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )\r\n\r\n#define FT_MEM_REALLOC( ptr, cursz, newsz )                        \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1,        \\\r\n                                                 (cursz), (newsz), \\\r\n                                                 (ptr), &error ) )\r\n\r\n#define FT_MEM_QALLOC( ptr, size )                                         \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) )\r\n\r\n#define FT_MEM_QNEW( ptr )                        \\\r\n          FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )\r\n\r\n#define FT_MEM_QREALLOC( ptr, cursz, newsz )                         \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1,        \\\r\n                                                  (cursz), (newsz), \\\r\n                                                  (ptr), &error ) )\r\n\r\n#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz )                             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \\\r\n                                                  (cursz), (newsz),          \\\r\n                                                  (ptr), &error ) )\r\n\r\n#define FT_MEM_ALLOC_MULT( ptr, count, item_size )                    \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \\\r\n                                                 0, (count),          \\\r\n                                                 NULL, &error ) )\r\n\r\n#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz )            \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz),    \\\r\n                                                 (oldcnt), (newcnt), \\\r\n                                                 (ptr), &error ) )\r\n\r\n#define FT_MEM_QALLOC_MULT( ptr, count, item_size )                    \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \\\r\n                                                  0, (count),          \\\r\n                                                  NULL, &error ) )\r\n\r\n#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz)             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz),    \\\r\n                                                  (oldcnt), (newcnt), \\\r\n                                                  (ptr), &error ) )\r\n\r\n\r\n#define FT_MEM_SET_ERROR( cond )  ( (cond), error != 0 )\r\n\r\n\r\n#define FT_MEM_SET( dest, byte, count )     ft_memset( dest, byte, count )\r\n\r\n#define FT_MEM_COPY( dest, source, count )  ft_memcpy( dest, source, count )\r\n\r\n#define FT_MEM_MOVE( dest, source, count )  ft_memmove( dest, source, count )\r\n\r\n\r\n#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )\r\n\r\n#define FT_ZERO( p )                FT_MEM_ZERO( p, sizeof ( *(p) ) )\r\n\r\n\r\n#define FT_ARRAY_ZERO( dest, count )                        \\\r\n          FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) )\r\n\r\n#define FT_ARRAY_COPY( dest, source, count )                        \\\r\n          FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) )\r\n\r\n#define FT_ARRAY_MOVE( dest, source, count )                        \\\r\n          FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )\r\n\r\n\r\n  /*\r\n   *  Return the maximum number of addressable elements in an array.\r\n   *  We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid\r\n   *  any problems.\r\n   */\r\n#define FT_ARRAY_MAX( ptr )           ( FT_INT_MAX / sizeof ( *(ptr) ) )\r\n\r\n#define FT_ARRAY_CHECK( ptr, count )  ( (count) <= FT_ARRAY_MAX( ptr ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The following functions macros expect that their pointer argument is  */\r\n  /* _typed_ in order to automatically compute array element sizes.        */\r\n  /*                                                                       */\r\n\r\n#define FT_MEM_NEW_ARRAY( ptr, count )                                      \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \\\r\n                                                 0, (count),                \\\r\n                                                 NULL, &error ) )\r\n\r\n#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz )                             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \\\r\n                                                 (cursz), (newsz),          \\\r\n                                                 (ptr), &error ) )\r\n\r\n#define FT_MEM_QNEW_ARRAY( ptr, count )                                      \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \\\r\n                                                  0, (count),                \\\r\n                                                  NULL, &error ) )\r\n\r\n#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz )                             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \\\r\n                                                  (cursz), (newsz),          \\\r\n                                                  (ptr), &error ) )\r\n\r\n\r\n#define FT_ALLOC( ptr, size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )\r\n\r\n#define FT_REALLOC( ptr, cursz, newsz )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )\r\n\r\n#define FT_ALLOC_MULT( ptr, count, item_size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )\r\n\r\n#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz )              \\\r\n          FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt,      \\\r\n                                                 newcnt, itmsz ) )\r\n\r\n#define FT_QALLOC( ptr, size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )\r\n\r\n#define FT_QREALLOC( ptr, cursz, newsz )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )\r\n\r\n#define FT_QALLOC_MULT( ptr, count, item_size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )\r\n\r\n#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz )              \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt,      \\\r\n                                                  newcnt, itmsz ) )\r\n\r\n#define FT_FREE( ptr )  FT_MEM_FREE( ptr )\r\n\r\n#define FT_NEW( ptr )  FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )\r\n\r\n#define FT_NEW_ARRAY( ptr, count )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\r\n\r\n#define FT_RENEW_ARRAY( ptr, curcnt, newcnt )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\r\n\r\n#define FT_QNEW( ptr )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )\r\n\r\n#define FT_QNEW_ARRAY( ptr, count )                          \\\r\n          FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\r\n\r\n#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt )                          \\\r\n          FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_Alloc( FT_Memory  memory,\r\n            FT_Long    size,\r\n            void*     *P );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_QAlloc( FT_Memory  memory,\r\n             FT_Long    size,\r\n             void*     *p );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_Realloc( FT_Memory  memory,\r\n              FT_Long    current,\r\n              FT_Long    size,\r\n              void*     *P );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_QRealloc( FT_Memory  memory,\r\n               FT_Long    current,\r\n               FT_Long    size,\r\n               void*     *p );\r\n\r\n  FT_BASE( void )\r\n  FT_Free( FT_Memory  memory,\r\n           void*     *P );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_strdup( FT_Memory    memory,\r\n                 const char*  str,\r\n                 FT_Error    *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_dup( FT_Memory    memory,\r\n              const void*  address,\r\n              FT_ULong     size,\r\n              FT_Error    *p_error );\r\n\r\n#define FT_MEM_STRDUP( dst, str )                                            \\\r\n          (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )\r\n\r\n#define FT_STRDUP( dst, str )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )\r\n\r\n#define FT_MEM_DUP( dst, address, size )                                    \\\r\n          (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )\r\n\r\n#define FT_DUP( dst, address, size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )\r\n\r\n\r\n  /* Return >= 1 if a truncation occurs.            */\r\n  /* Return 0 if the source string fits the buffer. */\r\n  /* This is *not* the same as strlcpy().           */\r\n  FT_BASE( FT_Int )\r\n  ft_mem_strcpyn( char*        dst,\r\n                  const char*  src,\r\n                  FT_ULong     size );\r\n\r\n#define FT_STRCPYN( dst, src, size )                                         \\\r\n          ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTMEMORY_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftobjs.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType private base classes (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2008, 2010, 2012 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  This file contains the definition of all internal FreeType classes.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTOBJS_H__\r\n#define __FTOBJS_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_RENDER_H\r\n#include FT_SIZES_H\r\n#include FT_LCD_FILTER_H\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_GLYPH_LOADER_H\r\n#include FT_INTERNAL_DRIVER_H\r\n#include FT_INTERNAL_AUTOHINT_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_INTERNAL_PIC_H\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n#include FT_INCREMENTAL_H\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Some generic definitions.                                             */\r\n  /*                                                                       */\r\n#ifndef TRUE\r\n#define TRUE  1\r\n#endif\r\n\r\n#ifndef FALSE\r\n#define FALSE  0\r\n#endif\r\n\r\n#ifndef NULL\r\n#define NULL  (void*)0\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The min and max functions missing in C.  As usual, be careful not to  */\r\n  /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */\r\n  /*                                                                       */\r\n#define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )\r\n#define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )\r\n\r\n#define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )\r\n\r\n\r\n#define FT_PAD_FLOOR( x, n )  ( (x) & ~((n)-1) )\r\n#define FT_PAD_ROUND( x, n )  FT_PAD_FLOOR( (x) + ((n)/2), n )\r\n#define FT_PAD_CEIL( x, n )   FT_PAD_FLOOR( (x) + ((n)-1), n )\r\n\r\n#define FT_PIX_FLOOR( x )     ( (x) & ~63 )\r\n#define FT_PIX_ROUND( x )     FT_PIX_FLOOR( (x) + 32 )\r\n#define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )\r\n\r\n\r\n  /*\r\n   *  Return the highest power of 2 that is <= value; this correspond to\r\n   *  the highest bit in a given 32-bit value.\r\n   */\r\n  FT_BASE( FT_UInt32 )\r\n  ft_highpow2( FT_UInt32  value );\r\n\r\n\r\n  /*\r\n   *  character classification functions -- since these are used to parse\r\n   *  font files, we must not use those in <ctypes.h> which are\r\n   *  locale-dependent\r\n   */\r\n#define  ft_isdigit( x )   ( ( (unsigned)(x) - '0' ) < 10U )\r\n\r\n#define  ft_isxdigit( x )  ( ( (unsigned)(x) - '0' ) < 10U || \\\r\n                             ( (unsigned)(x) - 'a' ) < 6U  || \\\r\n                             ( (unsigned)(x) - 'A' ) < 6U  )\r\n\r\n  /* the next two macros assume ASCII representation */\r\n#define  ft_isupper( x )  ( ( (unsigned)(x) - 'A' ) < 26U )\r\n#define  ft_islower( x )  ( ( (unsigned)(x) - 'a' ) < 26U )\r\n\r\n#define  ft_isalpha( x )  ( ft_isupper( x ) || ft_islower( x ) )\r\n#define  ft_isalnum( x )  ( ft_isdigit( x ) || ft_isalpha( x ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                       C H A R M A P S                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* handle to internal charmap object */\r\n  typedef struct FT_CMapRec_*              FT_CMap;\r\n\r\n  /* handle to charmap class structure */\r\n  typedef const struct FT_CMap_ClassRec_*  FT_CMap_Class;\r\n\r\n  /* internal charmap object structure */\r\n  typedef struct  FT_CMapRec_\r\n  {\r\n    FT_CharMapRec  charmap;\r\n    FT_CMap_Class  clazz;\r\n\r\n  } FT_CMapRec;\r\n\r\n  /* typecase any pointer to a charmap handle */\r\n#define FT_CMAP( x )              ((FT_CMap)( x ))\r\n\r\n  /* obvious macros */\r\n#define FT_CMAP_PLATFORM_ID( x )  FT_CMAP( x )->charmap.platform_id\r\n#define FT_CMAP_ENCODING_ID( x )  FT_CMAP( x )->charmap.encoding_id\r\n#define FT_CMAP_ENCODING( x )     FT_CMAP( x )->charmap.encoding\r\n#define FT_CMAP_FACE( x )         FT_CMAP( x )->charmap.face\r\n\r\n\r\n  /* class method definitions */\r\n  typedef FT_Error\r\n  (*FT_CMap_InitFunc)( FT_CMap     cmap,\r\n                       FT_Pointer  init_data );\r\n\r\n  typedef void\r\n  (*FT_CMap_DoneFunc)( FT_CMap  cmap );\r\n\r\n  typedef FT_UInt\r\n  (*FT_CMap_CharIndexFunc)( FT_CMap    cmap,\r\n                            FT_UInt32  char_code );\r\n\r\n  typedef FT_UInt\r\n  (*FT_CMap_CharNextFunc)( FT_CMap     cmap,\r\n                           FT_UInt32  *achar_code );\r\n\r\n  typedef FT_UInt\r\n  (*FT_CMap_CharVarIndexFunc)( FT_CMap    cmap,\r\n                               FT_CMap    unicode_cmap,\r\n                               FT_UInt32  char_code,\r\n                               FT_UInt32  variant_selector );\r\n\r\n  typedef FT_Bool\r\n  (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap    cmap,\r\n                                   FT_UInt32  char_code,\r\n                                   FT_UInt32  variant_selector );\r\n\r\n  typedef FT_UInt32 *\r\n  (*FT_CMap_VariantListFunc)( FT_CMap    cmap,\r\n                              FT_Memory  mem );\r\n\r\n  typedef FT_UInt32 *\r\n  (*FT_CMap_CharVariantListFunc)( FT_CMap    cmap,\r\n                                  FT_Memory  mem,\r\n                                  FT_UInt32  char_code );\r\n\r\n  typedef FT_UInt32 *\r\n  (*FT_CMap_VariantCharListFunc)( FT_CMap    cmap,\r\n                                  FT_Memory  mem,\r\n                                  FT_UInt32  variant_selector );\r\n\r\n\r\n  typedef struct  FT_CMap_ClassRec_\r\n  {\r\n    FT_ULong               size;\r\n    FT_CMap_InitFunc       init;\r\n    FT_CMap_DoneFunc       done;\r\n    FT_CMap_CharIndexFunc  char_index;\r\n    FT_CMap_CharNextFunc   char_next;\r\n\r\n    /* Subsequent entries are special ones for format 14 -- the variant */\r\n    /* selector subtable which behaves like no other                    */\r\n\r\n    FT_CMap_CharVarIndexFunc      char_var_index;\r\n    FT_CMap_CharVarIsDefaultFunc  char_var_default;\r\n    FT_CMap_VariantListFunc       variant_list;\r\n    FT_CMap_CharVariantListFunc   charvariant_list;\r\n    FT_CMap_VariantCharListFunc   variantchar_list;\r\n\r\n  } FT_CMap_ClassRec;\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DECLARE_CMAP_CLASS( class_ )              \\\r\n  FT_CALLBACK_TABLE const  FT_CMap_ClassRec class_;\r\n\r\n#define FT_DEFINE_CMAP_CLASS(       \\\r\n          class_,                   \\\r\n          size_,                    \\\r\n          init_,                    \\\r\n          done_,                    \\\r\n          char_index_,              \\\r\n          char_next_,               \\\r\n          char_var_index_,          \\\r\n          char_var_default_,        \\\r\n          variant_list_,            \\\r\n          charvariant_list_,        \\\r\n          variantchar_list_ )       \\\r\n  FT_CALLBACK_TABLE_DEF             \\\r\n  const FT_CMap_ClassRec  class_ =  \\\r\n  {                                 \\\r\n    size_,                          \\\r\n    init_,                          \\\r\n    done_,                          \\\r\n    char_index_,                    \\\r\n    char_next_,                     \\\r\n    char_var_index_,                \\\r\n    char_var_default_,              \\\r\n    variant_list_,                  \\\r\n    charvariant_list_,              \\\r\n    variantchar_list_               \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DECLARE_CMAP_CLASS( class_ )                  \\\r\n  void                                                   \\\r\n  FT_Init_Class_ ## class_( FT_Library         library,  \\\r\n                            FT_CMap_ClassRec*  clazz );\r\n\r\n#define FT_DEFINE_CMAP_CLASS(                            \\\r\n          class_,                                        \\\r\n          size_,                                         \\\r\n          init_,                                         \\\r\n          done_,                                         \\\r\n          char_index_,                                   \\\r\n          char_next_,                                    \\\r\n          char_var_index_,                               \\\r\n          char_var_default_,                             \\\r\n          variant_list_,                                 \\\r\n          charvariant_list_,                             \\\r\n          variantchar_list_ )                            \\\r\n  void                                                   \\\r\n  FT_Init_Class_ ## class_( FT_Library         library,  \\\r\n                            FT_CMap_ClassRec*  clazz )   \\\r\n  {                                                      \\\r\n    FT_UNUSED( library );                                \\\r\n                                                         \\\r\n    clazz->size             = size_;                     \\\r\n    clazz->init             = init_;                     \\\r\n    clazz->done             = done_;                     \\\r\n    clazz->char_index       = char_index_;               \\\r\n    clazz->char_next        = char_next_;                \\\r\n    clazz->char_var_index   = char_var_index_;           \\\r\n    clazz->char_var_default = char_var_default_;         \\\r\n    clazz->variant_list     = variant_list_;             \\\r\n    clazz->charvariant_list = charvariant_list_;         \\\r\n    clazz->variantchar_list = variantchar_list_;         \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /* create a new charmap and add it to charmap->face */\r\n  FT_BASE( FT_Error )\r\n  FT_CMap_New( FT_CMap_Class  clazz,\r\n               FT_Pointer     init_data,\r\n               FT_CharMap     charmap,\r\n               FT_CMap       *acmap );\r\n\r\n  /* destroy a charmap and remove it from face's list */\r\n  FT_BASE( void )\r\n  FT_CMap_Done( FT_CMap  cmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Face_InternalRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure contains the internal fields of each FT_Face        */\r\n  /*    object.  These fields may change between different releases of     */\r\n  /*    FreeType.                                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    max_points ::                                                      */\r\n  /*      The maximum number of points used to store the vectorial outline */\r\n  /*      of any glyph in this face.  If this value cannot be known in     */\r\n  /*      advance, or if the face isn't scalable, this should be set to 0. */\r\n  /*      Only relevant for scalable formats.                              */\r\n  /*                                                                       */\r\n  /*    max_contours ::                                                    */\r\n  /*      The maximum number of contours used to store the vectorial       */\r\n  /*      outline of any glyph in this face.  If this value cannot be      */\r\n  /*      known in advance, or if the face isn't scalable, this should be  */\r\n  /*      set to 0.  Only relevant for scalable formats.                   */\r\n  /*                                                                       */\r\n  /*    transform_matrix ::                                                */\r\n  /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */\r\n  /*      outlines after they are loaded from the font.  Only used by the  */\r\n  /*      convenience functions.                                           */\r\n  /*                                                                       */\r\n  /*    transform_delta ::                                                 */\r\n  /*      A translation vector used to transform glyph outlines after they */\r\n  /*      are loaded from the font.  Only used by the convenience          */\r\n  /*      functions.                                                       */\r\n  /*                                                                       */\r\n  /*    transform_flags ::                                                 */\r\n  /*      Some flags used to classify the transform.  Only used by the     */\r\n  /*      convenience functions.                                           */\r\n  /*                                                                       */\r\n  /*    services ::                                                        */\r\n  /*      A cache for frequently used services.  It should be only         */\r\n  /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */\r\n  /*                                                                       */\r\n  /*    incremental_interface ::                                           */\r\n  /*      If non-null, the interface through which glyph data and metrics  */\r\n  /*      are loaded incrementally for faces that do not provide all of    */\r\n  /*      this data when first opened.  This field exists only if          */\r\n  /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */\r\n  /*                                                                       */\r\n  /*    ignore_unpatented_hinter ::                                        */\r\n  /*      This boolean flag instructs the glyph loader to ignore the       */\r\n  /*      native font hinter, if one is found.  This is exclusively used   */\r\n  /*      in the case when the unpatented hinter is compiled within the    */\r\n  /*      library.                                                         */\r\n  /*                                                                       */\r\n  /*    refcount ::                                                        */\r\n  /*      A counter initialized to~1 at the time an @FT_Face structure is  */\r\n  /*      created.  @FT_Reference_Face increments this counter, and        */\r\n  /*      @FT_Done_Face only destroys a face if the counter is~1,          */\r\n  /*      otherwise it simply decrements it.                               */\r\n  /*                                                                       */\r\n  typedef struct  FT_Face_InternalRec_\r\n  {\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_UShort           reserved1;\r\n    FT_Short            reserved2;\r\n#endif\r\n    FT_Matrix           transform_matrix;\r\n    FT_Vector           transform_delta;\r\n    FT_Int              transform_flags;\r\n\r\n    FT_ServiceCacheRec  services;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_Incremental_InterfaceRec*  incremental_interface;\r\n#endif\r\n\r\n    FT_Bool             ignore_unpatented_hinter;\r\n    FT_UInt             refcount;\r\n\r\n  } FT_Face_InternalRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Slot_InternalRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure contains the internal fields of each FT_GlyphSlot   */\r\n  /*    object.  These fields may change between different releases of     */\r\n  /*    FreeType.                                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    loader            :: The glyph loader object used to load outlines */\r\n  /*                         into the glyph slot.                          */\r\n  /*                                                                       */\r\n  /*    flags             :: Possible values are zero or                   */\r\n  /*                         FT_GLYPH_OWN_BITMAP.  The latter indicates    */\r\n  /*                         that the FT_GlyphSlot structure owns the      */\r\n  /*                         bitmap buffer.                                */\r\n  /*                                                                       */\r\n  /*    glyph_transformed :: Boolean.  Set to TRUE when the loaded glyph   */\r\n  /*                         must be transformed through a specific        */\r\n  /*                         font transformation.  This is _not_ the same  */\r\n  /*                         as the face transform set through             */\r\n  /*                         FT_Set_Transform().                           */\r\n  /*                                                                       */\r\n  /*    glyph_matrix      :: The 2x2 matrix corresponding to the glyph     */\r\n  /*                         transformation, if necessary.                 */\r\n  /*                                                                       */\r\n  /*    glyph_delta       :: The 2d translation vector corresponding to    */\r\n  /*                         the glyph transformation, if necessary.       */\r\n  /*                                                                       */\r\n  /*    glyph_hints       :: Format-specific glyph hints management.       */\r\n  /*                                                                       */\r\n\r\n#define FT_GLYPH_OWN_BITMAP  0x1\r\n\r\n  typedef struct  FT_Slot_InternalRec_\r\n  {\r\n    FT_GlyphLoader  loader;\r\n    FT_UInt         flags;\r\n    FT_Bool         glyph_transformed;\r\n    FT_Matrix       glyph_matrix;\r\n    FT_Vector       glyph_delta;\r\n    void*           glyph_hints;\r\n\r\n  } FT_GlyphSlot_InternalRec;\r\n\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_InternalRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure contains the internal fields of each FT_Size        */\r\n  /*    object.  Currently, it's empty.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  typedef struct  FT_Size_InternalRec_\r\n  {\r\n    /* empty */\r\n\r\n  } FT_Size_InternalRec;\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                         M O D U L E S                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_ModuleRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A module object instance.                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    clazz   :: A pointer to the module's class.                        */\r\n  /*                                                                       */\r\n  /*    library :: A handle to the parent library object.                  */\r\n  /*                                                                       */\r\n  /*    memory  :: A handle to the memory manager.                         */\r\n  /*                                                                       */\r\n  typedef struct  FT_ModuleRec_\r\n  {\r\n    FT_Module_Class*  clazz;\r\n    FT_Library        library;\r\n    FT_Memory         memory;\r\n\r\n  } FT_ModuleRec;\r\n\r\n\r\n  /* typecast an object to an FT_Module */\r\n#define FT_MODULE( x )          ((FT_Module)( x ))\r\n#define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz\r\n#define FT_MODULE_LIBRARY( x )  FT_MODULE( x )->library\r\n#define FT_MODULE_MEMORY( x )   FT_MODULE( x )->memory\r\n\r\n\r\n#define FT_MODULE_IS_DRIVER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                    FT_MODULE_FONT_DRIVER )\r\n\r\n#define FT_MODULE_IS_RENDERER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                      FT_MODULE_RENDERER )\r\n\r\n#define FT_MODULE_IS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                    FT_MODULE_HINTER )\r\n\r\n#define FT_MODULE_IS_STYLER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                    FT_MODULE_STYLER )\r\n\r\n#define FT_DRIVER_IS_SCALABLE( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                      FT_MODULE_DRIVER_SCALABLE )\r\n\r\n#define FT_DRIVER_USES_OUTLINES( x )  !( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                         FT_MODULE_DRIVER_NO_OUTLINES )\r\n\r\n#define FT_DRIVER_HAS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                     FT_MODULE_DRIVER_HAS_HINTER )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Module_Interface                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finds a module and returns its specific interface as a typeless    */\r\n  /*    pointer.                                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library     :: A handle to the library object.                     */\r\n  /*                                                                       */\r\n  /*    module_name :: The module's name (as an ASCII string).             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A module-specific interface if available, 0 otherwise.             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should better be familiar with FreeType internals to know      */\r\n  /*    which module to look for, and what its interface is :-)            */\r\n  /*                                                                       */\r\n  FT_BASE( const void* )\r\n  FT_Get_Module_Interface( FT_Library   library,\r\n                           const char*  mod_name );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_module_get_service( FT_Module    module,\r\n                         const char*  service_id );\r\n\r\n  /* */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****   F A C E,   S I Z E   &   G L Y P H   S L O T   O B J E C T S  ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* a few macros used to perform easy typecasts with minimal brain damage */\r\n\r\n#define FT_FACE( x )          ((FT_Face)(x))\r\n#define FT_SIZE( x )          ((FT_Size)(x))\r\n#define FT_SLOT( x )          ((FT_GlyphSlot)(x))\r\n\r\n#define FT_FACE_DRIVER( x )   FT_FACE( x )->driver\r\n#define FT_FACE_LIBRARY( x )  FT_FACE_DRIVER( x )->root.library\r\n#define FT_FACE_MEMORY( x )   FT_FACE( x )->memory\r\n#define FT_FACE_STREAM( x )   FT_FACE( x )->stream\r\n\r\n#define FT_SIZE_FACE( x )     FT_SIZE( x )->face\r\n#define FT_SLOT_FACE( x )     FT_SLOT( x )->face\r\n\r\n#define FT_FACE_SLOT( x )     FT_FACE( x )->glyph\r\n#define FT_FACE_SIZE( x )     FT_FACE( x )->size\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_GlyphSlot                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    It is sometimes useful to have more than one glyph slot for a      */\r\n  /*    given face object.  This function is used to create additional     */\r\n  /*    slots.  All of them are automatically discarded when the face is   */\r\n  /*    destroyed.                                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face  :: A handle to a parent face object.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aslot :: A handle to a new glyph slot object.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Error )\r\n  FT_New_GlyphSlot( FT_Face        face,\r\n                    FT_GlyphSlot  *aslot );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_GlyphSlot                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroys a given glyph slot.  Remember however that all slots are  */\r\n  /*    automatically destroyed with its parent.  Using this function is   */\r\n  /*    not always mandatory.                                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot :: A handle to a target glyph slot.                           */\r\n  /*                                                                       */\r\n  FT_BASE( void )\r\n  FT_Done_GlyphSlot( FT_GlyphSlot  slot );\r\n\r\n /* */\r\n\r\n#define FT_REQUEST_WIDTH( req )                                            \\\r\n          ( (req)->horiResolution                                          \\\r\n              ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \\\r\n              : (req)->width )\r\n\r\n#define FT_REQUEST_HEIGHT( req )                                            \\\r\n          ( (req)->vertResolution                                           \\\r\n              ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \\\r\n              : (req)->height )\r\n\r\n\r\n  /* Set the metrics according to a bitmap strike. */\r\n  FT_BASE( void )\r\n  FT_Select_Metrics( FT_Face   face,\r\n                     FT_ULong  strike_index );\r\n\r\n\r\n  /* Set the metrics according to a size request. */\r\n  FT_BASE( void )\r\n  FT_Request_Metrics( FT_Face          face,\r\n                      FT_Size_Request  req );\r\n\r\n\r\n  /* Match a size request against `available_sizes'. */\r\n  FT_BASE( FT_Error )\r\n  FT_Match_Size( FT_Face          face,\r\n                 FT_Size_Request  req,\r\n                 FT_Bool          ignore_width,\r\n                 FT_ULong*        size_index );\r\n\r\n\r\n  /* Use the horizontal metrics to synthesize the vertical metrics. */\r\n  /* If `advance' is zero, it is also synthesized.                  */\r\n  FT_BASE( void )\r\n  ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,\r\n                                  FT_Pos             advance );\r\n\r\n\r\n  /* Free the bitmap of a given glyphslot when needed (i.e., only when it */\r\n  /* was allocated with ft_glyphslot_alloc_bitmap).                       */\r\n  FT_BASE( void )\r\n  ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );\r\n\r\n\r\n  /* Allocate a new bitmap buffer in a glyph slot. */\r\n  FT_BASE( FT_Error )\r\n  ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,\r\n                             FT_ULong      size );\r\n\r\n\r\n  /* Set the bitmap buffer in a glyph slot to a given pointer.  The buffer */\r\n  /* will not be freed by a later call to ft_glyphslot_free_bitmap.        */\r\n  FT_BASE( void )\r\n  ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,\r\n                           FT_Byte*      buffer );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                        R E N D E R E R S                        ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#define FT_RENDERER( x )      ((FT_Renderer)( x ))\r\n#define FT_GLYPH( x )         ((FT_Glyph)( x ))\r\n#define FT_BITMAP_GLYPH( x )  ((FT_BitmapGlyph)( x ))\r\n#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))\r\n\r\n\r\n  typedef struct  FT_RendererRec_\r\n  {\r\n    FT_ModuleRec            root;\r\n    FT_Renderer_Class*      clazz;\r\n    FT_Glyph_Format         glyph_format;\r\n    FT_Glyph_Class          glyph_class;\r\n\r\n    FT_Raster               raster;\r\n    FT_Raster_Render_Func   raster_render;\r\n    FT_Renderer_RenderFunc  render;\r\n\r\n  } FT_RendererRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                    F O N T   D R I V E R S                      ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* typecast a module into a driver easily */\r\n#define FT_DRIVER( x )        ((FT_Driver)(x))\r\n\r\n  /* typecast a module as a driver, and get its driver class */\r\n#define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_DriverRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The root font driver class.  A font driver is responsible for      */\r\n  /*    managing and loading font files of a given format.                 */\r\n  /*                                                                       */\r\n  /*  <Fields>                                                             */\r\n  /*     root         :: Contains the fields of the root module class.     */\r\n  /*                                                                       */\r\n  /*     clazz        :: A pointer to the font driver's class.  Note that  */\r\n  /*                     this is NOT root.clazz.  `class' wasn't used      */\r\n  /*                     as it is a reserved word in C++.                  */\r\n  /*                                                                       */\r\n  /*     faces_list   :: The list of faces currently opened by this        */\r\n  /*                     driver.                                           */\r\n  /*                                                                       */\r\n  /*     glyph_loader :: The glyph loader for all faces managed by this    */\r\n  /*                     driver.  This object isn't defined for unscalable */\r\n  /*                     formats.                                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_DriverRec_\r\n  {\r\n    FT_ModuleRec     root;\r\n    FT_Driver_Class  clazz;\r\n    FT_ListRec       faces_list;\r\n    FT_GlyphLoader   glyph_loader;\r\n\r\n  } FT_DriverRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                       L I B R A R I E S                         ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* This hook is used by the TrueType debugger.  It must be set to an */\r\n  /* alternate truetype bytecode interpreter function.                 */\r\n#define FT_DEBUG_HOOK_TRUETYPE            0\r\n\r\n\r\n  /* Set this debug hook to a non-null pointer to force unpatented hinting */\r\n  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */\r\n  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */\r\n  /* during debugging.                                                     */\r\n#define FT_DEBUG_HOOK_UNPATENTED_HINTING  1\r\n\r\n\r\n  typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,\r\n                                            FT_Render_Mode  render_mode,\r\n                                            FT_Library      library );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_LibraryRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The FreeType library class.  This is the root of all FreeType      */\r\n  /*    data.  Use FT_New_Library() to create a library object, and        */\r\n  /*    FT_Done_Library() to discard it and all child objects.             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory           :: The library's memory object.  Manages memory   */\r\n  /*                        allocation.                                    */\r\n  /*                                                                       */\r\n  /*    version_major    :: The major version number of the library.       */\r\n  /*                                                                       */\r\n  /*    version_minor    :: The minor version number of the library.       */\r\n  /*                                                                       */\r\n  /*    version_patch    :: The current patch level of the library.        */\r\n  /*                                                                       */\r\n  /*    num_modules      :: The number of modules currently registered     */\r\n  /*                        within this library.  This is set to 0 for new */\r\n  /*                        libraries.  New modules are added through the  */\r\n  /*                        FT_Add_Module() API function.                  */\r\n  /*                                                                       */\r\n  /*    modules          :: A table used to store handles to the currently */\r\n  /*                        registered modules. Note that each font driver */\r\n  /*                        contains a list of its opened faces.           */\r\n  /*                                                                       */\r\n  /*    renderers        :: The list of renderers currently registered     */\r\n  /*                        within the library.                            */\r\n  /*                                                                       */\r\n  /*    cur_renderer     :: The current outline renderer.  This is a       */\r\n  /*                        shortcut used to avoid parsing the list on     */\r\n  /*                        each call to FT_Outline_Render().  It is a     */\r\n  /*                        handle to the current renderer for the         */\r\n  /*                        FT_GLYPH_FORMAT_OUTLINE format.                */\r\n  /*                                                                       */\r\n  /*    auto_hinter      :: XXX                                            */\r\n  /*                                                                       */\r\n  /*    raster_pool      :: The raster object's render pool.  This can     */\r\n  /*                        ideally be changed dynamically at run-time.    */\r\n  /*                                                                       */\r\n  /*    raster_pool_size :: The size of the render pool in bytes.          */\r\n  /*                                                                       */\r\n  /*    debug_hooks      :: XXX                                            */\r\n  /*                                                                       */\r\n  /*    lcd_filter       :: If subpixel rendering is activated, the        */\r\n  /*                        selected LCD filter mode.                      */\r\n  /*                                                                       */\r\n  /*    lcd_extra        :: If subpixel rendering is activated, the number */\r\n  /*                        of extra pixels needed for the LCD filter.     */\r\n  /*                                                                       */\r\n  /*    lcd_weights      :: If subpixel rendering is activated, the LCD    */\r\n  /*                        filter weights, if any.                        */\r\n  /*                                                                       */\r\n  /*    lcd_filter_func  :: If subpixel rendering is activated, the LCD    */\r\n  /*                        filtering callback function.                   */\r\n  /*                                                                       */\r\n  /*    pic_container    :: Contains global structs and tables, instead    */\r\n  /*                        of defining them globallly.                    */\r\n  /*                                                                       */\r\n  /*    refcount         :: A counter initialized to~1 at the time an      */\r\n  /*                        @FT_Library structure is created.              */\r\n  /*                        @FT_Reference_Library increments this counter, */\r\n  /*                        and @FT_Done_Library only destroys a library   */\r\n  /*                        if the counter is~1, otherwise it simply       */\r\n  /*                        decrements it.                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_LibraryRec_\r\n  {\r\n    FT_Memory          memory;           /* library's memory manager */\r\n\r\n    FT_Int             version_major;\r\n    FT_Int             version_minor;\r\n    FT_Int             version_patch;\r\n\r\n    FT_UInt            num_modules;\r\n    FT_Module          modules[FT_MAX_MODULES];  /* module objects  */\r\n\r\n    FT_ListRec         renderers;        /* list of renderers        */\r\n    FT_Renderer        cur_renderer;     /* current outline renderer */\r\n    FT_Module          auto_hinter;\r\n\r\n    FT_Byte*           raster_pool;      /* scan-line conversion */\r\n                                         /* render pool          */\r\n    FT_ULong           raster_pool_size; /* size of render pool in bytes */\r\n\r\n    FT_DebugHook_Func  debug_hooks[4];\r\n\r\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n    FT_LcdFilter             lcd_filter;\r\n    FT_Int                   lcd_extra;        /* number of extra pixels */\r\n    FT_Byte                  lcd_weights[7];   /* filter weights, if any */\r\n    FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */\r\n#endif\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    FT_PIC_Container   pic_container;\r\n#endif\r\n\r\n    FT_UInt            refcount;\r\n\r\n  } FT_LibraryRec;\r\n\r\n\r\n  FT_BASE( FT_Renderer )\r\n  FT_Lookup_Renderer( FT_Library       library,\r\n                      FT_Glyph_Format  format,\r\n                      FT_ListNode*     node );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_Render_Glyph_Internal( FT_Library      library,\r\n                            FT_GlyphSlot    slot,\r\n                            FT_Render_Mode  render_mode );\r\n\r\n  typedef const char*\r\n  (*FT_Face_GetPostscriptNameFunc)( FT_Face  face );\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_GetGlyphNameFunc)( FT_Face     face,\r\n                               FT_UInt     glyph_index,\r\n                               FT_Pointer  buffer,\r\n                               FT_UInt     buffer_max );\r\n\r\n  typedef FT_UInt\r\n  (*FT_Face_GetGlyphNameIndexFunc)( FT_Face     face,\r\n                                    FT_String*  glyph_name );\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Memory                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Creates a new memory object.                                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to the new memory object.  0 in case of error.           */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Memory )\r\n  FT_New_Memory( void );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Memory                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discards memory manager.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the memory manager.                          */\r\n  /*                                                                       */\r\n  FT_BASE( void )\r\n  FT_Done_Memory( FT_Memory  memory );\r\n\r\n#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\r\n\r\n\r\n  /* Define default raster's interface.  The default raster is located in  */\r\n  /* `src/base/ftraster.c'.                                                */\r\n  /*                                                                       */\r\n  /* Client applications can register new rasters through the              */\r\n  /* FT_Set_Raster() API.                                                  */\r\n\r\n#ifndef FT_NO_DEFAULT_RASTER\r\n  FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                      P I C   S U P P O R T                      ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* PIC support macros for ftimage.h */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_OUTLINE_FUNCS                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Outline_Funcs struct.         */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */\r\n  /*    be called with a pre-allocated structure to be filled.             */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_OUTLINE_FUNCS(           \\\r\n          class_,                          \\\r\n          move_to_,                        \\\r\n          line_to_,                        \\\r\n          conic_to_,                       \\\r\n          cubic_to_,                       \\\r\n          shift_,                          \\\r\n          delta_ )                         \\\r\n  static const  FT_Outline_Funcs class_ =  \\\r\n  {                                        \\\r\n    move_to_,                              \\\r\n    line_to_,                              \\\r\n    conic_to_,                             \\\r\n    cubic_to_,                             \\\r\n    shift_,                                \\\r\n    delta_                                 \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_OUTLINE_FUNCS(                     \\\r\n          class_,                                    \\\r\n          move_to_,                                  \\\r\n          line_to_,                                  \\\r\n          conic_to_,                                 \\\r\n          cubic_to_,                                 \\\r\n          shift_,                                    \\\r\n          delta_ )                                   \\\r\n  static FT_Error                                    \\\r\n  Init_Class_ ## class_( FT_Outline_Funcs*  clazz )  \\\r\n  {                                                  \\\r\n    clazz->move_to  = move_to_;                      \\\r\n    clazz->line_to  = line_to_;                      \\\r\n    clazz->conic_to = conic_to_;                     \\\r\n    clazz->cubic_to = cubic_to_;                     \\\r\n    clazz->shift    = shift_;                        \\\r\n    clazz->delta    = delta_;                        \\\r\n                                                     \\\r\n    return FT_Err_Ok;                                \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_RASTER_FUNCS                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Raster_Funcs struct.          */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */\r\n  /*    be called with a pre-allocated structure to be filled.             */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_RASTER_FUNCS(    \\\r\n          class_,                  \\\r\n          glyph_format_,           \\\r\n          raster_new_,             \\\r\n          raster_reset_,           \\\r\n          raster_set_mode_,        \\\r\n          raster_render_,          \\\r\n          raster_done_ )           \\\r\n  const FT_Raster_Funcs  class_ =  \\\r\n  {                                \\\r\n    glyph_format_,                 \\\r\n    raster_new_,                   \\\r\n    raster_reset_,                 \\\r\n    raster_set_mode_,              \\\r\n    raster_render_,                \\\r\n    raster_done_                   \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_RASTER_FUNCS(                        \\\r\n          class_,                                      \\\r\n          glyph_format_,                               \\\r\n          raster_new_,                                 \\\r\n          raster_reset_,                               \\\r\n          raster_set_mode_,                            \\\r\n          raster_render_,                              \\\r\n          raster_done_ )                               \\\r\n  void                                                 \\\r\n  FT_Init_Class_ ## class_( FT_Raster_Funcs*  clazz )  \\\r\n  {                                                    \\\r\n    clazz->glyph_format    = glyph_format_;            \\\r\n    clazz->raster_new      = raster_new_;              \\\r\n    clazz->raster_reset    = raster_reset_;            \\\r\n    clazz->raster_set_mode = raster_set_mode_;         \\\r\n    clazz->raster_render   = raster_render_;           \\\r\n    clazz->raster_done     = raster_done_;             \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /* PIC support macros for ftrender.h */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_GLYPH                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Glyph_Class struct.           */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */\r\n  /*    be called with a pre-allocated stcture to be filled.               */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_GLYPH(          \\\r\n          class_,                 \\\r\n          size_,                  \\\r\n          format_,                \\\r\n          init_,                  \\\r\n          done_,                  \\\r\n          copy_,                  \\\r\n          transform_,             \\\r\n          bbox_,                  \\\r\n          prepare_ )              \\\r\n  FT_CALLBACK_TABLE_DEF           \\\r\n  const FT_Glyph_Class  class_ =  \\\r\n  {                               \\\r\n    size_,                        \\\r\n    format_,                      \\\r\n    init_,                        \\\r\n    done_,                        \\\r\n    copy_,                        \\\r\n    transform_,                   \\\r\n    bbox_,                        \\\r\n    prepare_                      \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_GLYPH(                              \\\r\n          class_,                                     \\\r\n          size_,                                      \\\r\n          format_,                                    \\\r\n          init_,                                      \\\r\n          done_,                                      \\\r\n          copy_,                                      \\\r\n          transform_,                                 \\\r\n          bbox_,                                      \\\r\n          prepare_ )                                  \\\r\n  void                                                \\\r\n  FT_Init_Class_ ## class_( FT_Glyph_Class*  clazz )  \\\r\n  {                                                   \\\r\n    clazz->glyph_size      = size_;                   \\\r\n    clazz->glyph_format    = format_;                 \\\r\n    clazz->glyph_init      = init_;                   \\\r\n    clazz->glyph_done      = done_;                   \\\r\n    clazz->glyph_copy      = copy_;                   \\\r\n    clazz->glyph_transform = transform_;              \\\r\n    clazz->glyph_bbox      = bbox_;                   \\\r\n    clazz->glyph_prepare   = prepare_;                \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DECLARE_RENDERER                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to create a forward declaration of a                          */\r\n  /*    FT_Renderer_Class struct instance.                                 */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_RENDERER                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Renderer_Class struct.        */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need  */\r\n  /*    to be called with a pointer where the allocated structure is       */\r\n  /*    returned.  And when it is no longer needed a `destroy' function    */\r\n  /*    needs to be called to release that allocation.                     */\r\n  /*    `fcinit.c' (ft_create_default_module_classes) already contains     */\r\n  /*    a mechanism to call these functions for the default modules        */\r\n  /*    described in `ftmodule.h'.                                         */\r\n  /*                                                                       */\r\n  /*    Notice that the created `create' and `destroy' functions call      */\r\n  /*    `pic_init' and `pic_free' to allow you to manually allocate and    */\r\n  /*    initialize any additional global data, like a module specific      */\r\n  /*    interface, and put them in the global pic container defined in     */\r\n  /*    `ftpic.h'.  If you don't need them just implement the functions as */\r\n  /*    empty to resolve the link error.  Also the `pic_init' and          */\r\n  /*    `pic_free' functions should be declared in `pic.h', to be referred */\r\n  /*    by the renderer definition calling `FT_DEFINE_RENDERER' in the     */\r\n  /*    following.                                                         */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DECLARE_RENDERER( class_ )               \\\r\n  FT_EXPORT_VAR( const FT_Renderer_Class ) class_;\r\n\r\n#define FT_DEFINE_RENDERER(                  \\\r\n          class_,                            \\\r\n          flags_,                            \\\r\n          size_,                             \\\r\n          name_,                             \\\r\n          version_,                          \\\r\n          requires_,                         \\\r\n          interface_,                        \\\r\n          init_,                             \\\r\n          done_,                             \\\r\n          get_interface_,                    \\\r\n          glyph_format_,                     \\\r\n          render_glyph_,                     \\\r\n          transform_glyph_,                  \\\r\n          get_glyph_cbox_,                   \\\r\n          set_mode_,                         \\\r\n          raster_class_ )                    \\\r\n  FT_CALLBACK_TABLE_DEF                      \\\r\n  const FT_Renderer_Class  class_ =          \\\r\n  {                                          \\\r\n    FT_DEFINE_ROOT_MODULE( flags_,           \\\r\n                           size_,            \\\r\n                           name_,            \\\r\n                           version_,         \\\r\n                           requires_,        \\\r\n                           interface_,       \\\r\n                           init_,            \\\r\n                           done_,            \\\r\n                           get_interface_ )  \\\r\n    glyph_format_,                           \\\r\n                                             \\\r\n    render_glyph_,                           \\\r\n    transform_glyph_,                        \\\r\n    get_glyph_cbox_,                         \\\r\n    set_mode_,                               \\\r\n                                             \\\r\n    raster_class_                            \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DECLARE_RENDERER( class_ )  FT_DECLARE_MODULE( class_ )\r\n\r\n#define FT_DEFINE_RENDERER(                                      \\\r\n          class_,                                                \\\r\n          flags_,                                                \\\r\n          size_,                                                 \\\r\n          name_,                                                 \\\r\n          version_,                                              \\\r\n          requires_,                                             \\\r\n          interface_,                                            \\\r\n          init_,                                                 \\\r\n          done_,                                                 \\\r\n          get_interface_,                                        \\\r\n          glyph_format_,                                         \\\r\n          render_glyph_,                                         \\\r\n          transform_glyph_,                                      \\\r\n          get_glyph_cbox_,                                       \\\r\n          set_mode_,                                             \\\r\n          raster_class_ )                                        \\\r\n  void                                                           \\\r\n  FT_Destroy_Class_ ## class_( FT_Library        library,        \\\r\n                               FT_Module_Class*  clazz )         \\\r\n  {                                                              \\\r\n    FT_Renderer_Class*  rclazz = (FT_Renderer_Class*)clazz;      \\\r\n    FT_Memory           memory = library->memory;                \\\r\n                                                                 \\\r\n                                                                 \\\r\n    class_ ## _pic_free( library );                              \\\r\n    if ( rclazz )                                                \\\r\n      FT_FREE( rclazz );                                         \\\r\n  }                                                              \\\r\n                                                                 \\\r\n                                                                 \\\r\n  FT_Error                                                       \\\r\n  FT_Create_Class_ ## class_( FT_Library         library,        \\\r\n                              FT_Module_Class**  output_class )  \\\r\n  {                                                              \\\r\n    FT_Renderer_Class*  clazz = NULL;                            \\\r\n    FT_Error            error;                                   \\\r\n    FT_Memory           memory = library->memory;                \\\r\n                                                                 \\\r\n                                                                 \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \\\r\n      return error;                                              \\\r\n                                                                 \\\r\n    error = class_ ## _pic_init( library );                      \\\r\n    if ( error )                                                 \\\r\n    {                                                            \\\r\n      FT_FREE( clazz );                                          \\\r\n      return error;                                              \\\r\n    }                                                            \\\r\n                                                                 \\\r\n    FT_DEFINE_ROOT_MODULE( flags_,                               \\\r\n                           size_,                                \\\r\n                           name_,                                \\\r\n                           version_,                             \\\r\n                           requires_,                            \\\r\n                           interface_,                           \\\r\n                           init_,                                \\\r\n                           done_,                                \\\r\n                           get_interface_ )                      \\\r\n                                                                 \\\r\n    clazz->glyph_format    = glyph_format_;                      \\\r\n                                                                 \\\r\n    clazz->render_glyph    = render_glyph_;                      \\\r\n    clazz->transform_glyph = transform_glyph_;                   \\\r\n    clazz->get_glyph_cbox  = get_glyph_cbox_;                    \\\r\n    clazz->set_mode        = set_mode_;                          \\\r\n                                                                 \\\r\n    clazz->raster_class    = raster_class_;                      \\\r\n                                                                 \\\r\n    *output_class = (FT_Module_Class*)clazz;                     \\\r\n                                                                 \\\r\n    return FT_Err_Ok;                                            \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /* PIC support macros for ftmodapi.h **/\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Creator                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to create (allocate) a new module class object.    */\r\n  /*    The object's members are initialized, but the module itself is     */\r\n  /*    not.                                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory       :: A handle to the memory manager.                    */\r\n  /*    output_class :: Initialized with the newly allocated class.        */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_Module_Creator)( FT_Memory          memory,\r\n                        FT_Module_Class**  output_class );\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Destroyer                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to destroy (deallocate) a module class object.     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the memory manager.                          */\r\n  /*    clazz  :: Module class to destroy.                                 */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Module_Destroyer)( FT_Memory         memory,\r\n                          FT_Module_Class*  clazz );\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DECLARE_MODULE                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to create a forward declaration of a                          */\r\n  /*    FT_Module_Class struct instance.                                   */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_MODULE                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of an FT_Module_Class struct.       */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to   */\r\n  /*    be called with a pointer where the allocated structure is          */\r\n  /*    returned.  And when it is no longer needed a `destroy' function    */\r\n  /*    needs to be called to release that allocation.                     */\r\n  /*    `fcinit.c' (ft_create_default_module_classes) already contains     */\r\n  /*    a mechanism to call these functions for the default modules        */\r\n  /*    described in `ftmodule.h'.                                         */\r\n  /*                                                                       */\r\n  /*    Notice that the created `create' and `destroy' functions call      */\r\n  /*    `pic_init' and `pic_free' to allow you to manually allocate and    */\r\n  /*    initialize any additional global data, like a module specific      */\r\n  /*    interface, and put them in the global pic container defined in     */\r\n  /*    `ftpic.h'.  If you don't need them just implement the functions as */\r\n  /*    empty to resolve the link error.  Also the `pic_init' and          */\r\n  /*    `pic_free' functions should be declared in `pic.h', to be referred */\r\n  /*    by the module definition calling `FT_DEFINE_MODULE' in the         */\r\n  /*    following.                                                         */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_ROOT_MODULE                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of an FT_Module_Class struct inside */\r\n  /*    another struct that contains it or in a function that initializes  */\r\n  /*    that containing struct.                                            */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DECLARE_MODULE( class_ )  \\\r\n  FT_CALLBACK_TABLE                  \\\r\n  const FT_Module_Class  class_;\r\n\r\n#define FT_DEFINE_ROOT_MODULE(  \\\r\n          flags_,               \\\r\n          size_,                \\\r\n          name_,                \\\r\n          version_,             \\\r\n          requires_,            \\\r\n          interface_,           \\\r\n          init_,                \\\r\n          done_,                \\\r\n          get_interface_ )      \\\r\n  {                             \\\r\n    flags_,                     \\\r\n    size_,                      \\\r\n                                \\\r\n    name_,                      \\\r\n    version_,                   \\\r\n    requires_,                  \\\r\n                                \\\r\n    interface_,                 \\\r\n                                \\\r\n    init_,                      \\\r\n    done_,                      \\\r\n    get_interface_,             \\\r\n  },\r\n\r\n#define FT_DEFINE_MODULE(         \\\r\n          class_,                 \\\r\n          flags_,                 \\\r\n          size_,                  \\\r\n          name_,                  \\\r\n          version_,               \\\r\n          requires_,              \\\r\n          interface_,             \\\r\n          init_,                  \\\r\n          done_,                  \\\r\n          get_interface_ )        \\\r\n  FT_CALLBACK_TABLE_DEF           \\\r\n  const FT_Module_Class class_ =  \\\r\n  {                               \\\r\n    flags_,                       \\\r\n    size_,                        \\\r\n                                  \\\r\n    name_,                        \\\r\n    version_,                     \\\r\n    requires_,                    \\\r\n                                  \\\r\n    interface_,                   \\\r\n                                  \\\r\n    init_,                        \\\r\n    done_,                        \\\r\n    get_interface_,               \\\r\n  };\r\n\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DECLARE_MODULE( class_ )                               \\\r\n  FT_Error                                                        \\\r\n  FT_Create_Class_ ## class_( FT_Library         library,         \\\r\n                              FT_Module_Class**  output_class );  \\\r\n  void                                                            \\\r\n  FT_Destroy_Class_ ## class_( FT_Library        library,         \\\r\n                               FT_Module_Class*  clazz );\r\n\r\n#define FT_DEFINE_ROOT_MODULE(                      \\\r\n          flags_,                                   \\\r\n          size_,                                    \\\r\n          name_,                                    \\\r\n          version_,                                 \\\r\n          requires_,                                \\\r\n          interface_,                               \\\r\n          init_,                                    \\\r\n          done_,                                    \\\r\n          get_interface_ )                          \\\r\n    clazz->root.module_flags     = flags_;          \\\r\n    clazz->root.module_size      = size_;           \\\r\n    clazz->root.module_name      = name_;           \\\r\n    clazz->root.module_version   = version_;        \\\r\n    clazz->root.module_requires  = requires_;       \\\r\n                                                    \\\r\n    clazz->root.module_interface = interface_;      \\\r\n                                                    \\\r\n    clazz->root.module_init      = init_;           \\\r\n    clazz->root.module_done      = done_;           \\\r\n    clazz->root.get_interface    = get_interface_;\r\n\r\n#define FT_DEFINE_MODULE(                                        \\\r\n          class_,                                                \\\r\n          flags_,                                                \\\r\n          size_,                                                 \\\r\n          name_,                                                 \\\r\n          version_,                                              \\\r\n          requires_,                                             \\\r\n          interface_,                                            \\\r\n          init_,                                                 \\\r\n          done_,                                                 \\\r\n          get_interface_ )                                       \\\r\n  void                                                           \\\r\n  FT_Destroy_Class_ ## class_( FT_Library        library,        \\\r\n                               FT_Module_Class*  clazz )         \\\r\n  {                                                              \\\r\n    FT_Memory memory = library->memory;                          \\\r\n                                                                 \\\r\n                                                                 \\\r\n    class_ ## _pic_free( library );                              \\\r\n    if ( clazz )                                                 \\\r\n      FT_FREE( clazz );                                          \\\r\n  }                                                              \\\r\n                                                                 \\\r\n                                                                 \\\r\n  FT_Error                                                       \\\r\n  FT_Create_Class_ ## class_( FT_Library         library,        \\\r\n                              FT_Module_Class**  output_class )  \\\r\n  {                                                              \\\r\n    FT_Memory         memory = library->memory;                  \\\r\n    FT_Module_Class*  clazz  = NULL;                             \\\r\n    FT_Error          error;                                     \\\r\n                                                                 \\\r\n                                                                 \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \\\r\n      return error;                                              \\\r\n    error = class_ ## _pic_init( library );                      \\\r\n    if ( error )                                                 \\\r\n    {                                                            \\\r\n      FT_FREE( clazz );                                          \\\r\n      return error;                                              \\\r\n    }                                                            \\\r\n                                                                 \\\r\n    clazz->module_flags     = flags_;                            \\\r\n    clazz->module_size      = size_;                             \\\r\n    clazz->module_name      = name_;                             \\\r\n    clazz->module_version   = version_;                          \\\r\n    clazz->module_requires  = requires_;                         \\\r\n                                                                 \\\r\n    clazz->module_interface = interface_;                        \\\r\n                                                                 \\\r\n    clazz->module_init      = init_;                             \\\r\n    clazz->module_done      = done_;                             \\\r\n    clazz->get_interface    = get_interface_;                    \\\r\n                                                                 \\\r\n    *output_class = clazz;                                       \\\r\n                                                                 \\\r\n    return FT_Err_Ok;                                            \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTOBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpic.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services (declaration).       */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Modules that ordinarily have const global data that need address     */\r\n  /*  can instead define pointers here.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTPIC_H__\r\n#define __FTPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  typedef struct  FT_PIC_Container_\r\n  {\r\n    /* pic containers for base */\r\n    void*  base;\r\n\r\n    /* pic containers for modules */\r\n    void*  autofit;\r\n    void*  cff;\r\n    void*  pshinter;\r\n    void*  psnames;\r\n    void*  raster;\r\n    void*  sfnt;\r\n    void*  smooth;\r\n    void*  truetype;\r\n\r\n  } FT_PIC_Container;\r\n\r\n\r\n  /* Initialize the various function tables, structs, etc. */\r\n  /* stored in the container.                              */\r\n  FT_BASE( FT_Error )\r\n  ft_pic_container_init( FT_Library  library );\r\n\r\n\r\n  /* Destroy the contents of the container. */\r\n  FT_BASE( void )\r\n  ft_pic_container_destroy( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftrfork.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrfork.h                                                              */\r\n/*                                                                         */\r\n/*    Embedded resource forks accessor (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006, 2007, 2012 by                                    */\r\n/*  Masatake YAMATO and Redhat K.K.                                        */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/* Development of the code in this file is support of                      */\r\n/* Information-technology Promotion Agency, Japan.                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTRFORK_H__\r\n#define __FTRFORK_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* Number of guessing rules supported in `FT_Raccess_Guess'.            */\r\n  /* Don't forget to increment the number if you add a new guessing rule. */\r\n#define FT_RACCESS_N_RULES  9\r\n\r\n\r\n  /* A structure to describe a reference in a resource by its resource ID */\r\n  /* and internal offset.  The `POST' resource expects to be concatenated */\r\n  /* by the order of resource IDs instead of its appearance in the file.  */\r\n\r\n  typedef struct  FT_RFork_Ref_\r\n  {\r\n    FT_UShort  res_id;\r\n    FT_ULong   offset;\r\n\r\n  } FT_RFork_Ref;\r\n\r\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n  typedef FT_Error\r\n  (*ft_raccess_guess_func)( FT_Library  library,\r\n                            FT_Stream   stream,\r\n                            char       *base_file_name,\r\n                            char      **result_file_name,\r\n                            FT_Long    *result_offset );\r\n\r\n  typedef enum  FT_RFork_Rule_ {\r\n    FT_RFork_Rule_invalid = -2,\r\n    FT_RFork_Rule_uknown, /* -1 */\r\n    FT_RFork_Rule_apple_double,\r\n    FT_RFork_Rule_apple_single,\r\n    FT_RFork_Rule_darwin_ufs_export,\r\n    FT_RFork_Rule_darwin_newvfs,\r\n    FT_RFork_Rule_darwin_hfsplus,\r\n    FT_RFork_Rule_vfat,\r\n    FT_RFork_Rule_linux_cap,\r\n    FT_RFork_Rule_linux_double,\r\n    FT_RFork_Rule_linux_netatalk\r\n  } FT_RFork_Rule;\r\n\r\n  /* For fast translation between rule index and rule type,\r\n   * the macros FT_RFORK_xxx should be kept consistent with\r\n   * the raccess_guess_funcs table\r\n   */\r\n  typedef struct ft_raccess_guess_rec_ {\r\n    ft_raccess_guess_func  func;\r\n    FT_RFork_Rule          type;\r\n  } ft_raccess_guess_rec;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n  /* this array is a storage in non-PIC mode, so ; is needed in END */\r\n#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type )  \\\r\n          const type name[] = {\r\n#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix )  \\\r\n          { raccess_guess_ ## func_suffix,                           \\\r\n            FT_RFork_Rule_ ## type_suffix },\r\n#define CONST_FT_RFORK_RULE_ARRAY_END  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* this array is a function in PIC mode, so no ; is needed in END */\r\n#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type )  \\\r\n          void                                         \\\r\n          FT_Init_ ## name( type*  storage )           \\\r\n          {                                            \\\r\n            type*  local = storage;                    \\\r\n                                                       \\\r\n                                                       \\\r\n            int  i = 0;\r\n#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix )  \\\r\n          local[i].func = raccess_guess_ ## func_suffix;             \\\r\n          local[i].type = FT_RFork_Rule_ ## type_suffix;             \\\r\n          i++;\r\n#define CONST_FT_RFORK_RULE_ARRAY_END  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Raccess_Guess                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Guess a file name and offset where the actual resource fork is     */\r\n  /*    stored.  The macro FT_RACCESS_N_RULES holds the number of          */\r\n  /*    guessing rules;  the guessed result for the Nth rule is            */\r\n  /*    represented as a triplet: a new file name (new_names[N]), a file   */\r\n  /*    offset (offsets[N]), and an error code (errors[N]).                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library ::                                                         */\r\n  /*      A FreeType library instance.                                     */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      A file stream containing the resource fork.                      */\r\n  /*                                                                       */\r\n  /*    base_name ::                                                       */\r\n  /*      The (base) file name of the resource fork used for some          */\r\n  /*      guessing rules.                                                  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    new_names ::                                                       */\r\n  /*      An array of guessed file names in which the resource forks may   */\r\n  /*      exist.  If `new_names[N]' is NULL, the guessed file name is      */\r\n  /*      equal to `base_name'.                                            */\r\n  /*                                                                       */\r\n  /*    offsets ::                                                         */\r\n  /*      An array of guessed file offsets.  `offsets[N]' holds the file   */\r\n  /*      offset of the possible start of the resource fork in file        */\r\n  /*      `new_names[N]'.                                                  */\r\n  /*                                                                       */\r\n  /*    errors ::                                                          */\r\n  /*      An array of FreeType error codes.  `errors[N]' is the error      */\r\n  /*      code of Nth guessing rule function.  If `errors[N]' is not       */\r\n  /*      FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless.      */\r\n  /*                                                                       */\r\n  FT_BASE( void )\r\n  FT_Raccess_Guess( FT_Library  library,\r\n                    FT_Stream   stream,\r\n                    char*       base_name,\r\n                    char**      new_names,\r\n                    FT_Long*    offsets,\r\n                    FT_Error*   errors );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Raccess_Get_HeaderInfo                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the information from the header of resource fork.  The         */\r\n  /*    information includes the file offset where the resource map        */\r\n  /*    starts, and the file offset where the resource data starts.        */\r\n  /*    `FT_Raccess_Get_DataOffsets' requires these two data.              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library ::                                                         */\r\n  /*      A FreeType library instance.                                     */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      A file stream containing the resource fork.                      */\r\n  /*                                                                       */\r\n  /*    rfork_offset ::                                                    */\r\n  /*      The file offset where the resource fork starts.                  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    map_offset ::                                                      */\r\n  /*      The file offset where the resource map starts.                   */\r\n  /*                                                                       */\r\n  /*    rdata_pos ::                                                       */\r\n  /*      The file offset where the resource data starts.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  FT_Err_Ok means success.                     */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Error )\r\n  FT_Raccess_Get_HeaderInfo( FT_Library  library,\r\n                             FT_Stream   stream,\r\n                             FT_Long     rfork_offset,\r\n                             FT_Long    *map_offset,\r\n                             FT_Long    *rdata_pos );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Raccess_Get_DataOffsets                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the data offsets for a tag in a resource fork.  Offsets are    */\r\n  /*    stored in an array because, in some cases, resources in a resource */\r\n  /*    fork have the same tag.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library ::                                                         */\r\n  /*      A FreeType library instance.                                     */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      A file stream containing the resource fork.                      */\r\n  /*                                                                       */\r\n  /*    map_offset ::                                                      */\r\n  /*      The file offset where the resource map starts.                   */\r\n  /*                                                                       */\r\n  /*    rdata_pos ::                                                       */\r\n  /*      The file offset where the resource data starts.                  */\r\n  /*                                                                       */\r\n  /*    tag ::                                                             */\r\n  /*      The resource tag.                                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    offsets ::                                                         */\r\n  /*      The stream offsets for the resource data specified by `tag'.     */\r\n  /*      This array is allocated by the function, so you have to call     */\r\n  /*      @ft_mem_free after use.                                          */\r\n  /*                                                                       */\r\n  /*    count ::                                                           */\r\n  /*      The length of offsets array.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  FT_Err_Ok means success.                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Normally you should use `FT_Raccess_Get_HeaderInfo' to get the     */\r\n  /*    value for `map_offset' and `rdata_pos'.                            */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Error )\r\n  FT_Raccess_Get_DataOffsets( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              FT_Long     map_offset,\r\n                              FT_Long     rdata_pos,\r\n                              FT_Long     tag,\r\n                              FT_Long   **offsets,\r\n                              FT_Long    *count );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTRFORK_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftserv.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftserv.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType services (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 2003-2007, 2009, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Each module can export one or more `services'.  Each service is      */\r\n  /*  identified by a constant string and modeled by a pointer; the latter */\r\n  /*  generally corresponds to a structure containing function pointers.   */\r\n  /*                                                                       */\r\n  /*  Note that a service's data cannot be a mere function pointer because */\r\n  /*  in C it is possible that function pointers might be implemented      */\r\n  /*  differently than data pointers (e.g. 48 bits instead of 32).         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTSERV_H__\r\n#define __FTSERV_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */\r\n\r\n  /* we disable the warning `conditional expression is constant' here */\r\n  /* in order to compile cleanly with the maximum level of warnings   */\r\n#pragma warning( disable : 4127 )\r\n\r\n#endif /* _MSC_VER */\r\n\r\n  /*\r\n   * @macro:\r\n   *   FT_FACE_FIND_SERVICE\r\n   *\r\n   * @description:\r\n   *   This macro is used to look up a service from a face's driver module.\r\n   *\r\n   * @input:\r\n   *   face ::\r\n   *     The source face handle.\r\n   *\r\n   *   id ::\r\n   *     A string describing the service as defined in the service's\r\n   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\r\n   *     `multi-masters').  It is automatically prefixed with\r\n   *     `FT_SERVICE_ID_'.\r\n   *\r\n   * @output:\r\n   *   ptr ::\r\n   *     A variable that receives the service pointer.  Will be NULL\r\n   *     if not found.\r\n   */\r\n#ifdef __cplusplus\r\n\r\n#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \\\r\n  FT_BEGIN_STMNT                                                            \\\r\n    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );             \\\r\n    FT_Pointer   _tmp_  = NULL;                                             \\\r\n    FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                              \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( module->clazz->get_interface )                                     \\\r\n      _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\r\n    *_pptr_ = _tmp_;                                                        \\\r\n  FT_END_STMNT\r\n\r\n#else /* !C++ */\r\n\r\n#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \\\r\n  FT_BEGIN_STMNT                                                            \\\r\n    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );              \\\r\n    FT_Pointer  _tmp_  = NULL;                                              \\\r\n                                                                            \\\r\n    if ( module->clazz->get_interface )                                     \\\r\n      _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\r\n    ptr = _tmp_;                                                            \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !C++ */\r\n\r\n\r\n  /*\r\n   * @macro:\r\n   *   FT_FACE_FIND_GLOBAL_SERVICE\r\n   *\r\n   * @description:\r\n   *   This macro is used to look up a service from all modules.\r\n   *\r\n   * @input:\r\n   *   face ::\r\n   *     The source face handle.\r\n   *\r\n   *   id ::\r\n   *     A string describing the service as defined in the service's\r\n   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\r\n   *     `multi-masters').  It is automatically prefixed with\r\n   *     `FT_SERVICE_ID_'.\r\n   *\r\n   * @output:\r\n   *   ptr ::\r\n   *     A variable that receives the service pointer.  Will be NULL\r\n   *     if not found.\r\n   */\r\n#ifdef __cplusplus\r\n\r\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \\\r\n  FT_BEGIN_STMNT                                                   \\\r\n    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );    \\\r\n    FT_Pointer   _tmp_;                                            \\\r\n    FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                     \\\r\n                                                                   \\\r\n                                                                   \\\r\n    _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \\\r\n    *_pptr_ = _tmp_;                                               \\\r\n  FT_END_STMNT\r\n\r\n#else /* !C++ */\r\n\r\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \\\r\n  FT_BEGIN_STMNT                                                   \\\r\n    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );     \\\r\n    FT_Pointer  _tmp_;                                             \\\r\n                                                                   \\\r\n                                                                   \\\r\n    _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \\\r\n    ptr   = _tmp_;                                                 \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !C++ */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****         S E R V I C E   D E S C R I P T O R S                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  The following structure is used to _describe_ a given service\r\n   *  to the library.  This is useful to build simple static service lists.\r\n   */\r\n  typedef struct  FT_ServiceDescRec_\r\n  {\r\n    const char*  serv_id;     /* service name         */\r\n    const void*  serv_data;   /* service pointer/data */\r\n\r\n  } FT_ServiceDescRec;\r\n\r\n  typedef const FT_ServiceDescRec*  FT_ServiceDesc;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_SERVICEDESCREC1                                          */\r\n  /*    FT_DEFINE_SERVICEDESCREC2                                          */\r\n  /*    FT_DEFINE_SERVICEDESCREC3                                          */\r\n  /*    FT_DEFINE_SERVICEDESCREC4                                          */\r\n  /*    FT_DEFINE_SERVICEDESCREC5                                          */\r\n  /*    FT_DEFINE_SERVICEDESCREC6                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an array of FT_ServiceDescRec structures.       */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a `create' function needs to  */\r\n  /*    be called with a pointer to return an allocated array.  As soon as */\r\n  /*    it is no longer needed, a `destroy' function needs to be called to */\r\n  /*    release that allocation.                                           */\r\n  /*                                                                       */\r\n  /*    These functions should be manually called from the `pic_init' and  */\r\n  /*    `pic_free' functions of your module (see FT_DEFINE_MODULE).        */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the array will be         */\r\n  /*    allocated in the global scope (or the scope where the macro is     */\r\n  /*    used).                                                             */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICEDESCREC1( class_,                                  \\\r\n                                   serv_id_1, serv_data_1 )                 \\\r\n  static const FT_ServiceDescRec  class_[] =                                \\\r\n  {                                                                         \\\r\n    { serv_id_1, serv_data_1 },                                             \\\r\n    { NULL, NULL }                                                          \\\r\n  };\r\n\r\n#define FT_DEFINE_SERVICEDESCREC2( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2 )                 \\\r\n  static const FT_ServiceDescRec  class_[] =                                \\\r\n  {                                                                         \\\r\n    { serv_id_1, serv_data_1 },                                             \\\r\n    { serv_id_2, serv_data_2 },                                             \\\r\n    { NULL, NULL }                                                          \\\r\n  };\r\n\r\n#define FT_DEFINE_SERVICEDESCREC3( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3 )                 \\\r\n  static const FT_ServiceDescRec  class_[] =                                \\\r\n  {                                                                         \\\r\n    { serv_id_1, serv_data_1 },                                             \\\r\n    { serv_id_2, serv_data_2 },                                             \\\r\n    { serv_id_3, serv_data_3 },                                             \\\r\n    { NULL, NULL }                                                          \\\r\n  };\r\n\r\n#define FT_DEFINE_SERVICEDESCREC4( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3,                  \\\r\n                                   serv_id_4, serv_data_4 )                 \\\r\n  static const FT_ServiceDescRec  class_[] =                                \\\r\n  {                                                                         \\\r\n    { serv_id_1, serv_data_1 },                                             \\\r\n    { serv_id_2, serv_data_2 },                                             \\\r\n    { serv_id_3, serv_data_3 },                                             \\\r\n    { serv_id_4, serv_data_4 },                                             \\\r\n    { NULL, NULL }                                                          \\\r\n  };\r\n\r\n#define FT_DEFINE_SERVICEDESCREC5( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3,                  \\\r\n                                   serv_id_4, serv_data_4,                  \\\r\n                                   serv_id_5, serv_data_5 )                 \\\r\n  static const FT_ServiceDescRec  class_[] =                                \\\r\n  {                                                                         \\\r\n    { serv_id_1, serv_data_1 },                                             \\\r\n    { serv_id_2, serv_data_2 },                                             \\\r\n    { serv_id_3, serv_data_3 },                                             \\\r\n    { serv_id_4, serv_data_4 },                                             \\\r\n    { serv_id_5, serv_data_5 },                                             \\\r\n    { NULL, NULL }                                                          \\\r\n  };\r\n\r\n#define FT_DEFINE_SERVICEDESCREC6( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3,                  \\\r\n                                   serv_id_4, serv_data_4,                  \\\r\n                                   serv_id_5, serv_data_5,                  \\\r\n                                   serv_id_6, serv_data_6 )                 \\\r\n  static const FT_ServiceDescRec  class_[] =                                \\\r\n  {                                                                         \\\r\n    { serv_id_1, serv_data_1 },                                             \\\r\n    { serv_id_2, serv_data_2 },                                             \\\r\n    { serv_id_3, serv_data_3 },                                             \\\r\n    { serv_id_4, serv_data_4 },                                             \\\r\n    { serv_id_5, serv_data_5 },                                             \\\r\n    { serv_id_6, serv_data_6 },                                             \\\r\n    { NULL, NULL }                                                          \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICEDESCREC1( class_,                                  \\\r\n                                   serv_id_1, serv_data_1 )                 \\\r\n  void                                                                      \\\r\n  FT_Destroy_Class_ ## class_( FT_Library          library,                 \\\r\n                               FT_ServiceDescRec*  clazz )                  \\\r\n  {                                                                         \\\r\n    FT_Memory  memory = library->memory;                                    \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( clazz )                                                            \\\r\n      FT_FREE( clazz );                                                     \\\r\n  }                                                                         \\\r\n                                                                            \\\r\n  FT_Error                                                                  \\\r\n  FT_Create_Class_ ## class_( FT_Library           library,                 \\\r\n                              FT_ServiceDescRec**  output_class )           \\\r\n  {                                                                         \\\r\n    FT_ServiceDescRec*  clazz  = NULL;                                      \\\r\n    FT_Error            error;                                              \\\r\n    FT_Memory           memory = library->memory;                           \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 2 ) )                         \\\r\n      return error;                                                         \\\r\n                                                                            \\\r\n    clazz[0].serv_id   = serv_id_1;                                         \\\r\n    clazz[0].serv_data = serv_data_1;                                       \\\r\n    clazz[1].serv_id   = NULL;                                              \\\r\n    clazz[1].serv_data = NULL;                                              \\\r\n                                                                            \\\r\n    *output_class = clazz;                                                  \\\r\n                                                                            \\\r\n    return FT_Err_Ok;                                                       \\\r\n  }\r\n\r\n#define FT_DEFINE_SERVICEDESCREC2( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2 )                 \\\r\n  void                                                                      \\\r\n  FT_Destroy_Class_ ## class_( FT_Library          library,                 \\\r\n                               FT_ServiceDescRec*  clazz )                  \\\r\n  {                                                                         \\\r\n    FT_Memory  memory = library->memory;                                    \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( clazz )                                                            \\\r\n      FT_FREE( clazz );                                                     \\\r\n  }                                                                         \\\r\n                                                                            \\\r\n  FT_Error                                                                  \\\r\n  FT_Create_Class_ ## class_( FT_Library           library,                 \\\r\n                              FT_ServiceDescRec**  output_class )           \\\r\n  {                                                                         \\\r\n    FT_ServiceDescRec*  clazz  = NULL;                                      \\\r\n    FT_Error            error;                                              \\\r\n    FT_Memory           memory = library->memory;                           \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) )                         \\\r\n      return error;                                                         \\\r\n                                                                            \\\r\n    clazz[0].serv_id   = serv_id_1;                                         \\\r\n    clazz[0].serv_data = serv_data_1;                                       \\\r\n    clazz[1].serv_id   = serv_id_2;                                         \\\r\n    clazz[1].serv_data = serv_data_2;                                       \\\r\n    clazz[2].serv_id   = NULL;                                              \\\r\n    clazz[2].serv_data = NULL;                                              \\\r\n                                                                            \\\r\n    *output_class = clazz;                                                  \\\r\n                                                                            \\\r\n    return FT_Err_Ok;                                                       \\\r\n  }\r\n\r\n#define FT_DEFINE_SERVICEDESCREC3( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3 )                 \\\r\n  void                                                                      \\\r\n  FT_Destroy_Class_ ## class_( FT_Library          library,                 \\\r\n                               FT_ServiceDescRec*  clazz )                  \\\r\n  {                                                                         \\\r\n    FT_Memory  memory = library->memory;                                    \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( clazz )                                                            \\\r\n      FT_FREE( clazz );                                                     \\\r\n  }                                                                         \\\r\n                                                                            \\\r\n  FT_Error                                                                  \\\r\n  FT_Create_Class_ ## class_( FT_Library           library,                 \\\r\n                              FT_ServiceDescRec**  output_class )           \\\r\n  {                                                                         \\\r\n    FT_ServiceDescRec*  clazz  = NULL;                                      \\\r\n    FT_Error            error;                                              \\\r\n    FT_Memory           memory = library->memory;                           \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) )                         \\\r\n      return error;                                                         \\\r\n                                                                            \\\r\n    clazz[0].serv_id   = serv_id_1;                                         \\\r\n    clazz[0].serv_data = serv_data_1;                                       \\\r\n    clazz[1].serv_id   = serv_id_2;                                         \\\r\n    clazz[1].serv_data = serv_data_2;                                       \\\r\n    clazz[2].serv_id   = serv_id_3;                                         \\\r\n    clazz[2].serv_data = serv_data_3;                                       \\\r\n    clazz[3].serv_id   = NULL;                                              \\\r\n    clazz[3].serv_data = NULL;                                              \\\r\n                                                                            \\\r\n    *output_class = clazz;                                                  \\\r\n                                                                            \\\r\n    return FT_Err_Ok;                                                       \\\r\n  }\r\n\r\n#define FT_DEFINE_SERVICEDESCREC4( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3,                  \\\r\n                                   serv_id_4, serv_data_4 )                 \\\r\n  void                                                                      \\\r\n  FT_Destroy_Class_ ## class_( FT_Library          library,                 \\\r\n                               FT_ServiceDescRec*  clazz )                  \\\r\n  {                                                                         \\\r\n    FT_Memory  memory = library->memory;                                    \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( clazz )                                                            \\\r\n      FT_FREE( clazz );                                                     \\\r\n  }                                                                         \\\r\n                                                                            \\\r\n  FT_Error                                                                  \\\r\n  FT_Create_Class_ ## class_( FT_Library           library,                 \\\r\n                              FT_ServiceDescRec**  output_class )           \\\r\n  {                                                                         \\\r\n    FT_ServiceDescRec*  clazz  = NULL;                                      \\\r\n    FT_Error            error;                                              \\\r\n    FT_Memory           memory = library->memory;                           \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) )                         \\\r\n      return error;                                                         \\\r\n                                                                            \\\r\n    clazz[0].serv_id   = serv_id_1;                                         \\\r\n    clazz[0].serv_data = serv_data_1;                                       \\\r\n    clazz[1].serv_id   = serv_id_2;                                         \\\r\n    clazz[1].serv_data = serv_data_2;                                       \\\r\n    clazz[2].serv_id   = serv_id_3;                                         \\\r\n    clazz[2].serv_data = serv_data_3;                                       \\\r\n    clazz[3].serv_id   = serv_id_4;                                         \\\r\n    clazz[3].serv_data = serv_data_4;                                       \\\r\n    clazz[4].serv_id   = NULL;                                              \\\r\n    clazz[4].serv_data = NULL;                                              \\\r\n                                                                            \\\r\n    *output_class = clazz;                                                  \\\r\n                                                                            \\\r\n    return FT_Err_Ok;                                                       \\\r\n  }\r\n\r\n#define FT_DEFINE_SERVICEDESCREC5( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3,                  \\\r\n                                   serv_id_4, serv_data_4,                  \\\r\n                                   serv_id_5, serv_data_5 )                 \\\r\n  void                                                                      \\\r\n  FT_Destroy_Class_ ## class_( FT_Library          library,                 \\\r\n                               FT_ServiceDescRec*  clazz )                  \\\r\n  {                                                                         \\\r\n    FT_Memory  memory = library->memory;                                    \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( clazz )                                                            \\\r\n      FT_FREE( clazz );                                                     \\\r\n  }                                                                         \\\r\n                                                                            \\\r\n  FT_Error                                                                  \\\r\n  FT_Create_Class_ ## class_( FT_Library           library,                 \\\r\n                              FT_ServiceDescRec**  output_class )           \\\r\n  {                                                                         \\\r\n    FT_ServiceDescRec*  clazz  = NULL;                                      \\\r\n    FT_Error            error;                                              \\\r\n    FT_Memory           memory = library->memory;                           \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) )                         \\\r\n      return error;                                                         \\\r\n                                                                            \\\r\n    clazz[0].serv_id   = serv_id_1;                                         \\\r\n    clazz[0].serv_data = serv_data_1;                                       \\\r\n    clazz[1].serv_id   = serv_id_2;                                         \\\r\n    clazz[1].serv_data = serv_data_2;                                       \\\r\n    clazz[2].serv_id   = serv_id_3;                                         \\\r\n    clazz[2].serv_data = serv_data_3;                                       \\\r\n    clazz[3].serv_id   = serv_id_4;                                         \\\r\n    clazz[3].serv_data = serv_data_4;                                       \\\r\n    clazz[4].serv_id   = serv_id_5;                                         \\\r\n    clazz[4].serv_data = serv_data_5;                                       \\\r\n    clazz[5].serv_id   = NULL;                                              \\\r\n    clazz[5].serv_data = NULL;                                              \\\r\n                                                                            \\\r\n    *output_class = clazz;                                                  \\\r\n                                                                            \\\r\n    return FT_Err_Ok;                                                       \\\r\n  }\r\n\r\n#define FT_DEFINE_SERVICEDESCREC6( class_,                                  \\\r\n                                   serv_id_1, serv_data_1,                  \\\r\n                                   serv_id_2, serv_data_2,                  \\\r\n                                   serv_id_3, serv_data_3,                  \\\r\n                                   serv_id_4, serv_data_4,                  \\\r\n                                   serv_id_5, serv_data_5,                  \\\r\n                                   serv_id_6, serv_data_6 )                 \\\r\n  void                                                                      \\\r\n  FT_Destroy_Class_ ## class_( FT_Library          library,                 \\\r\n                               FT_ServiceDescRec*  clazz )                  \\\r\n  {                                                                         \\\r\n    FT_Memory  memory = library->memory;                                    \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( clazz )                                                            \\\r\n      FT_FREE( clazz );                                                     \\\r\n  }                                                                         \\\r\n                                                                            \\\r\n  FT_Error                                                                  \\\r\n  FT_Create_Class_ ## class_( FT_Library           library,                 \\\r\n                              FT_ServiceDescRec**  output_class)            \\\r\n  {                                                                         \\\r\n    FT_ServiceDescRec*  clazz  = NULL;                                      \\\r\n    FT_Error            error;                                              \\\r\n    FT_Memory           memory = library->memory;                           \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) )                         \\\r\n      return error;                                                         \\\r\n                                                                            \\\r\n    clazz[0].serv_id   = serv_id_1;                                         \\\r\n    clazz[0].serv_data = serv_data_1;                                       \\\r\n    clazz[1].serv_id   = serv_id_2;                                         \\\r\n    clazz[1].serv_data = serv_data_2;                                       \\\r\n    clazz[2].serv_id   = serv_id_3;                                         \\\r\n    clazz[2].serv_data = serv_data_3;                                       \\\r\n    clazz[3].serv_id   = serv_id_4;                                         \\\r\n    clazz[3].serv_data = serv_data_4;                                       \\\r\n    clazz[4].serv_id   = serv_id_5;                                         \\\r\n    clazz[4].serv_data = serv_data_5;                                       \\\r\n    clazz[5].serv_id   = serv_id_6;                                         \\\r\n    clazz[5].serv_data = serv_data_6;                                       \\\r\n    clazz[6].serv_id   = NULL;                                              \\\r\n    clazz[6].serv_data = NULL;                                              \\\r\n                                                                            \\\r\n    *output_class = clazz;                                                  \\\r\n                                                                            \\\r\n    return FT_Err_Ok;                                                       \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /*\r\n   *  Parse a list of FT_ServiceDescRec descriptors and look for\r\n   *  a specific service by ID.  Note that the last element in the\r\n   *  array must be { NULL, NULL }, and that the function should\r\n   *  return NULL if the service isn't available.\r\n   *\r\n   *  This function can be used by modules to implement their\r\n   *  `get_service' method.\r\n   */\r\n  FT_BASE( FT_Pointer )\r\n  ft_service_list_lookup( FT_ServiceDesc  service_descriptors,\r\n                          const char*     service_id );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****             S E R V I C E S   C A C H E                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  This structure is used to store a cache for several frequently used\r\n   *  services.  It is the type of `face->internal->services'.  You\r\n   *  should only use FT_FACE_LOOKUP_SERVICE to access it.\r\n   *\r\n   *  All fields should have the type FT_Pointer to relax compilation\r\n   *  dependencies.  We assume the developer isn't completely stupid.\r\n   *\r\n   *  Each field must be named `service_XXXX' where `XXX' corresponds to\r\n   *  the correct FT_SERVICE_ID_XXXX macro.  See the definition of\r\n   *  FT_FACE_LOOKUP_SERVICE below how this is implemented.\r\n   *\r\n   */\r\n  typedef struct  FT_ServiceCacheRec_\r\n  {\r\n    FT_Pointer  service_POSTSCRIPT_FONT_NAME;\r\n    FT_Pointer  service_MULTI_MASTERS;\r\n    FT_Pointer  service_GLYPH_DICT;\r\n    FT_Pointer  service_PFR_METRICS;\r\n    FT_Pointer  service_WINFNT;\r\n\r\n  } FT_ServiceCacheRec, *FT_ServiceCache;\r\n\r\n\r\n  /*\r\n   *  A magic number used within the services cache.\r\n   */\r\n#define FT_SERVICE_UNAVAILABLE  ((FT_Pointer)~1)  /* magic number */\r\n\r\n\r\n  /*\r\n   * @macro:\r\n   *   FT_FACE_LOOKUP_SERVICE\r\n   *\r\n   * @description:\r\n   *   This macro is used to lookup a service from a face's driver module\r\n   *   using its cache.\r\n   *\r\n   * @input:\r\n   *   face::\r\n   *     The source face handle containing the cache.\r\n   *\r\n   *   field ::\r\n   *     The field name in the cache.\r\n   *\r\n   *   id ::\r\n   *     The service ID.\r\n   *\r\n   * @output:\r\n   *   ptr ::\r\n   *     A variable receiving the service data.  NULL if not available.\r\n   */\r\n#ifdef __cplusplus\r\n\r\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \\\r\n  FT_BEGIN_STMNT                                               \\\r\n    FT_Pointer   svc;                                          \\\r\n    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                   \\\r\n                                                               \\\r\n                                                               \\\r\n    svc = FT_FACE( face )->internal->services. service_ ## id; \\\r\n    if ( svc == FT_SERVICE_UNAVAILABLE )                       \\\r\n      svc = NULL;                                              \\\r\n    else if ( svc == NULL )                                    \\\r\n    {                                                          \\\r\n      FT_FACE_FIND_SERVICE( face, svc, id );                   \\\r\n                                                               \\\r\n      FT_FACE( face )->internal->services. service_ ## id =    \\\r\n        (FT_Pointer)( svc != NULL ? svc                        \\\r\n                                  : FT_SERVICE_UNAVAILABLE );  \\\r\n    }                                                          \\\r\n    *Pptr = svc;                                               \\\r\n  FT_END_STMNT\r\n\r\n#else /* !C++ */\r\n\r\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \\\r\n  FT_BEGIN_STMNT                                               \\\r\n    FT_Pointer  svc;                                           \\\r\n                                                               \\\r\n                                                               \\\r\n    svc = FT_FACE( face )->internal->services. service_ ## id; \\\r\n    if ( svc == FT_SERVICE_UNAVAILABLE )                       \\\r\n      svc = NULL;                                              \\\r\n    else if ( svc == NULL )                                    \\\r\n    {                                                          \\\r\n      FT_FACE_FIND_SERVICE( face, svc, id );                   \\\r\n                                                               \\\r\n      FT_FACE( face )->internal->services. service_ ## id =    \\\r\n        (FT_Pointer)( svc != NULL ? svc                        \\\r\n                                  : FT_SERVICE_UNAVAILABLE );  \\\r\n    }                                                          \\\r\n    ptr = svc;                                                 \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !C++ */\r\n\r\n  /*\r\n   *  A macro used to define new service structure types.\r\n   */\r\n\r\n#define FT_DEFINE_SERVICE( name )            \\\r\n  typedef struct FT_Service_ ## name ## Rec_ \\\r\n    FT_Service_ ## name ## Rec ;             \\\r\n  typedef struct FT_Service_ ## name ## Rec_ \\\r\n    const * FT_Service_ ## name ;            \\\r\n  struct FT_Service_ ## name ## Rec_\r\n\r\n  /* */\r\n\r\n  /*\r\n   *  The header files containing the services.\r\n   */\r\n\r\n#define FT_SERVICE_BDF_H                <freetype/internal/services/svbdf.h>\r\n#define FT_SERVICE_CID_H                <freetype/internal/services/svcid.h>\r\n#define FT_SERVICE_GLYPH_DICT_H         <freetype/internal/services/svgldict.h>\r\n#define FT_SERVICE_GX_VALIDATE_H        <freetype/internal/services/svgxval.h>\r\n#define FT_SERVICE_KERNING_H            <freetype/internal/services/svkern.h>\r\n#define FT_SERVICE_MULTIPLE_MASTERS_H   <freetype/internal/services/svmm.h>\r\n#define FT_SERVICE_OPENTYPE_VALIDATE_H  <freetype/internal/services/svotval.h>\r\n#define FT_SERVICE_PFR_H                <freetype/internal/services/svpfr.h>\r\n#define FT_SERVICE_POSTSCRIPT_CMAPS_H   <freetype/internal/services/svpscmap.h>\r\n#define FT_SERVICE_POSTSCRIPT_INFO_H    <freetype/internal/services/svpsinfo.h>\r\n#define FT_SERVICE_POSTSCRIPT_NAME_H    <freetype/internal/services/svpostnm.h>\r\n#define FT_SERVICE_PROPERTIES_H         <freetype/internal/services/svprop.h>\r\n#define FT_SERVICE_SFNT_H               <freetype/internal/services/svsfnt.h>\r\n#define FT_SERVICE_TRUETYPE_ENGINE_H    <freetype/internal/services/svtteng.h>\r\n#define FT_SERVICE_TT_CMAP_H            <freetype/internal/services/svttcmap.h>\r\n#define FT_SERVICE_WINFNT_H             <freetype/internal/services/svwinfnt.h>\r\n#define FT_SERVICE_XFREE86_NAME_H       <freetype/internal/services/svxf86nm.h>\r\n#define FT_SERVICE_TRUETYPE_GLYF_H      <freetype/internal/services/svttglyf.h>\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSERV_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftstream.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstream.h                                                             */\r\n/*                                                                         */\r\n/*    Stream handling (specification).                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2004-2006, 2011 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTSTREAM_H__\r\n#define __FTSTREAM_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_SYSTEM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* format of an 8-bit frame_op value:           */\r\n  /*                                              */\r\n  /* bit  76543210                                */\r\n  /*      xxxxxxes                                */\r\n  /*                                              */\r\n  /* s is set to 1 if the value is signed.        */\r\n  /* e is set to 1 if the value is little-endian. */\r\n  /* xxx is a command.                            */\r\n\r\n#define FT_FRAME_OP_SHIFT         2\r\n#define FT_FRAME_OP_SIGNED        1\r\n#define FT_FRAME_OP_LITTLE        2\r\n#define FT_FRAME_OP_COMMAND( x )  ( x >> FT_FRAME_OP_SHIFT )\r\n\r\n#define FT_MAKE_FRAME_OP( command, little, sign ) \\\r\n          ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )\r\n\r\n#define FT_FRAME_OP_END    0\r\n#define FT_FRAME_OP_START  1  /* start a new frame     */\r\n#define FT_FRAME_OP_BYTE   2  /* read 1-byte value     */\r\n#define FT_FRAME_OP_SHORT  3  /* read 2-byte value     */\r\n#define FT_FRAME_OP_LONG   4  /* read 4-byte value     */\r\n#define FT_FRAME_OP_OFF3   5  /* read 3-byte value     */\r\n#define FT_FRAME_OP_BYTES  6  /* read a bytes sequence */\r\n\r\n\r\n  typedef enum  FT_Frame_Op_\r\n  {\r\n    ft_frame_end       = 0,\r\n    ft_frame_start     = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),\r\n\r\n    ft_frame_byte      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 0 ),\r\n    ft_frame_schar     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 1 ),\r\n\r\n    ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),\r\n    ft_frame_short_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),\r\n    ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),\r\n    ft_frame_short_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),\r\n\r\n    ft_frame_ulong_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),\r\n    ft_frame_long_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),\r\n    ft_frame_ulong_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),\r\n    ft_frame_long_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),\r\n\r\n    ft_frame_uoff3_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),\r\n    ft_frame_off3_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),\r\n    ft_frame_uoff3_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),\r\n    ft_frame_off3_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),\r\n\r\n    ft_frame_bytes     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),\r\n    ft_frame_skip      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )\r\n\r\n  } FT_Frame_Op;\r\n\r\n\r\n  typedef struct  FT_Frame_Field_\r\n  {\r\n    FT_Byte    value;\r\n    FT_Byte    size;\r\n    FT_UShort  offset;\r\n\r\n  } FT_Frame_Field;\r\n\r\n\r\n  /* Construct an FT_Frame_Field out of a structure type and a field name. */\r\n  /* The structure type must be set in the FT_STRUCTURE macro before       */\r\n  /* calling the FT_FRAME_START() macro.                                   */\r\n  /*                                                                       */\r\n#define FT_FIELD_SIZE( f ) \\\r\n          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )\r\n\r\n#define FT_FIELD_SIZE_DELTA( f ) \\\r\n          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )\r\n\r\n#define FT_FIELD_OFFSET( f ) \\\r\n          (FT_UShort)( offsetof( FT_STRUCTURE, f ) )\r\n\r\n#define FT_FRAME_FIELD( frame_op, field ) \\\r\n          {                               \\\r\n            frame_op,                     \\\r\n            FT_FIELD_SIZE( field ),       \\\r\n            FT_FIELD_OFFSET( field )      \\\r\n          }\r\n\r\n#define FT_MAKE_EMPTY_FIELD( frame_op )  { frame_op, 0, 0 }\r\n\r\n#define FT_FRAME_START( size )   { ft_frame_start, 0, size }\r\n#define FT_FRAME_END             { ft_frame_end, 0, 0 }\r\n\r\n#define FT_FRAME_LONG( f )       FT_FRAME_FIELD( ft_frame_long_be, f )\r\n#define FT_FRAME_ULONG( f )      FT_FRAME_FIELD( ft_frame_ulong_be, f )\r\n#define FT_FRAME_SHORT( f )      FT_FRAME_FIELD( ft_frame_short_be, f )\r\n#define FT_FRAME_USHORT( f )     FT_FRAME_FIELD( ft_frame_ushort_be, f )\r\n#define FT_FRAME_OFF3( f )       FT_FRAME_FIELD( ft_frame_off3_be, f )\r\n#define FT_FRAME_UOFF3( f )      FT_FRAME_FIELD( ft_frame_uoff3_be, f )\r\n#define FT_FRAME_BYTE( f )       FT_FRAME_FIELD( ft_frame_byte, f )\r\n#define FT_FRAME_CHAR( f )       FT_FRAME_FIELD( ft_frame_schar, f )\r\n\r\n#define FT_FRAME_LONG_LE( f )    FT_FRAME_FIELD( ft_frame_long_le, f )\r\n#define FT_FRAME_ULONG_LE( f )   FT_FRAME_FIELD( ft_frame_ulong_le, f )\r\n#define FT_FRAME_SHORT_LE( f )   FT_FRAME_FIELD( ft_frame_short_le, f )\r\n#define FT_FRAME_USHORT_LE( f )  FT_FRAME_FIELD( ft_frame_ushort_le, f )\r\n#define FT_FRAME_OFF3_LE( f )    FT_FRAME_FIELD( ft_frame_off3_le, f )\r\n#define FT_FRAME_UOFF3_LE( f )   FT_FRAME_FIELD( ft_frame_uoff3_le, f )\r\n\r\n#define FT_FRAME_SKIP_LONG       { ft_frame_long_be, 0, 0 }\r\n#define FT_FRAME_SKIP_SHORT      { ft_frame_short_be, 0, 0 }\r\n#define FT_FRAME_SKIP_BYTE       { ft_frame_byte, 0, 0 }\r\n\r\n#define FT_FRAME_BYTES( field, count ) \\\r\n          {                            \\\r\n            ft_frame_bytes,            \\\r\n            count,                     \\\r\n            FT_FIELD_OFFSET( field )   \\\r\n          }\r\n\r\n#define FT_FRAME_SKIP_BYTES( count )  { ft_frame_skip, count, 0 }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */\r\n  /* type `char*' or equivalent (1-byte elements).                         */\r\n  /*                                                                       */\r\n\r\n#define FT_BYTE_( p, i )  ( ((const FT_Byte*)(p))[(i)] )\r\n#define FT_INT8_( p, i )  ( ((const FT_Char*)(p))[(i)] )\r\n\r\n#define FT_INT16( x )   ( (FT_Int16)(x)  )\r\n#define FT_UINT16( x )  ( (FT_UInt16)(x) )\r\n#define FT_INT32( x )   ( (FT_Int32)(x)  )\r\n#define FT_UINT32( x )  ( (FT_UInt32)(x) )\r\n\r\n#define FT_BYTE_I16( p, i, s )  ( FT_INT16(  FT_BYTE_( p, i ) ) << (s) )\r\n#define FT_BYTE_U16( p, i, s )  ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )\r\n#define FT_BYTE_I32( p, i, s )  ( FT_INT32(  FT_BYTE_( p, i ) ) << (s) )\r\n#define FT_BYTE_U32( p, i, s )  ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )\r\n\r\n#define FT_INT8_I16( p, i, s )  ( FT_INT16(  FT_INT8_( p, i ) ) << (s) )\r\n#define FT_INT8_U16( p, i, s )  ( FT_UINT16( FT_INT8_( p, i ) ) << (s) )\r\n#define FT_INT8_I32( p, i, s )  ( FT_INT32(  FT_INT8_( p, i ) ) << (s) )\r\n#define FT_INT8_U32( p, i, s )  ( FT_UINT32( FT_INT8_( p, i ) ) << (s) )\r\n\r\n\r\n#define FT_PEEK_SHORT( p )  FT_INT16( FT_INT8_I16( p, 0, 8) | \\\r\n                                      FT_BYTE_I16( p, 1, 0) )\r\n\r\n#define FT_PEEK_USHORT( p )  FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \\\r\n                                        FT_BYTE_U16( p, 1, 0 ) )\r\n\r\n#define FT_PEEK_LONG( p )  FT_INT32( FT_INT8_I32( p, 0, 24 ) | \\\r\n                                     FT_BYTE_I32( p, 1, 16 ) | \\\r\n                                     FT_BYTE_I32( p, 2,  8 ) | \\\r\n                                     FT_BYTE_I32( p, 3,  0 ) )\r\n\r\n#define FT_PEEK_ULONG( p )  FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \\\r\n                                       FT_BYTE_U32( p, 1, 16 ) | \\\r\n                                       FT_BYTE_U32( p, 2,  8 ) | \\\r\n                                       FT_BYTE_U32( p, 3,  0 ) )\r\n\r\n#define FT_PEEK_OFF3( p )  FT_INT32( FT_INT8_I32( p, 0, 16 ) | \\\r\n                                     FT_BYTE_I32( p, 1,  8 ) | \\\r\n                                     FT_BYTE_I32( p, 2,  0 ) )\r\n\r\n#define FT_PEEK_UOFF3( p )  FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \\\r\n                                       FT_BYTE_U32( p, 1,  8 ) | \\\r\n                                       FT_BYTE_U32( p, 2,  0 ) )\r\n\r\n#define FT_PEEK_SHORT_LE( p )  FT_INT16( FT_INT8_I16( p, 1, 8 ) | \\\r\n                                         FT_BYTE_I16( p, 0, 0 ) )\r\n\r\n#define FT_PEEK_USHORT_LE( p )  FT_UINT16( FT_BYTE_U16( p, 1, 8 ) |  \\\r\n                                           FT_BYTE_U16( p, 0, 0 ) )\r\n\r\n#define FT_PEEK_LONG_LE( p )  FT_INT32( FT_INT8_I32( p, 3, 24 ) | \\\r\n                                        FT_BYTE_I32( p, 2, 16 ) | \\\r\n                                        FT_BYTE_I32( p, 1,  8 ) | \\\r\n                                        FT_BYTE_I32( p, 0,  0 ) )\r\n\r\n#define FT_PEEK_ULONG_LE( p )  FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \\\r\n                                          FT_BYTE_U32( p, 2, 16 ) | \\\r\n                                          FT_BYTE_U32( p, 1,  8 ) | \\\r\n                                          FT_BYTE_U32( p, 0,  0 ) )\r\n\r\n#define FT_PEEK_OFF3_LE( p )  FT_INT32( FT_INT8_I32( p, 2, 16 ) | \\\r\n                                        FT_BYTE_I32( p, 1,  8 ) | \\\r\n                                        FT_BYTE_I32( p, 0,  0 ) )\r\n\r\n#define FT_PEEK_UOFF3_LE( p )  FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \\\r\n                                          FT_BYTE_U32( p, 1,  8 ) | \\\r\n                                          FT_BYTE_U32( p, 0,  0 ) )\r\n\r\n\r\n#define FT_NEXT_CHAR( buffer )       \\\r\n          ( (signed char)*buffer++ )\r\n\r\n#define FT_NEXT_BYTE( buffer )         \\\r\n          ( (unsigned char)*buffer++ )\r\n\r\n#define FT_NEXT_SHORT( buffer )                                   \\\r\n          ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_USHORT( buffer )                                            \\\r\n          ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_OFF3( buffer )                                  \\\r\n          ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_UOFF3( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_LONG( buffer )                                  \\\r\n          ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )\r\n\r\n#define FT_NEXT_ULONG( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )\r\n\r\n\r\n#define FT_NEXT_SHORT_LE( buffer )                                   \\\r\n          ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_USHORT_LE( buffer )                                            \\\r\n          ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_OFF3_LE( buffer )                                  \\\r\n          ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_UOFF3_LE( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_LONG_LE( buffer )                                  \\\r\n          ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )\r\n\r\n#define FT_NEXT_ULONG_LE( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Each GET_xxxx() macro uses an implicit `stream' variable.             */\r\n  /*                                                                       */\r\n#if 0\r\n#define FT_GET_MACRO( type )    FT_NEXT_ ## type ( stream->cursor )\r\n\r\n#define FT_GET_CHAR()       FT_GET_MACRO( CHAR )\r\n#define FT_GET_BYTE()       FT_GET_MACRO( BYTE )\r\n#define FT_GET_SHORT()      FT_GET_MACRO( SHORT )\r\n#define FT_GET_USHORT()     FT_GET_MACRO( USHORT )\r\n#define FT_GET_OFF3()       FT_GET_MACRO( OFF3 )\r\n#define FT_GET_UOFF3()      FT_GET_MACRO( UOFF3 )\r\n#define FT_GET_LONG()       FT_GET_MACRO( LONG )\r\n#define FT_GET_ULONG()      FT_GET_MACRO( ULONG )\r\n#define FT_GET_TAG4()       FT_GET_MACRO( ULONG )\r\n\r\n#define FT_GET_SHORT_LE()   FT_GET_MACRO( SHORT_LE )\r\n#define FT_GET_USHORT_LE()  FT_GET_MACRO( USHORT_LE )\r\n#define FT_GET_LONG_LE()    FT_GET_MACRO( LONG_LE )\r\n#define FT_GET_ULONG_LE()   FT_GET_MACRO( ULONG_LE )\r\n\r\n#else\r\n#define FT_GET_MACRO( func, type )        ( (type)func( stream ) )\r\n\r\n#define FT_GET_CHAR()       FT_GET_MACRO( FT_Stream_GetChar, FT_Char )\r\n#define FT_GET_BYTE()       FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )\r\n#define FT_GET_SHORT()      FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )\r\n#define FT_GET_USHORT()     FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )\r\n#define FT_GET_OFF3()       FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )\r\n#define FT_GET_UOFF3()      FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )\r\n#define FT_GET_LONG()       FT_GET_MACRO( FT_Stream_GetULong, FT_Long )\r\n#define FT_GET_ULONG()      FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )\r\n#define FT_GET_TAG4()       FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )\r\n\r\n#define FT_GET_SHORT_LE()   FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )\r\n#define FT_GET_USHORT_LE()  FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )\r\n#define FT_GET_LONG_LE()    FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )\r\n#define FT_GET_ULONG_LE()   FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )\r\n#endif\r\n\r\n#define FT_READ_MACRO( func, type, var )        \\\r\n          ( var = (type)func( stream, &error ), \\\r\n            error != FT_Err_Ok )\r\n\r\n#define FT_READ_BYTE( var )       FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )\r\n#define FT_READ_CHAR( var )       FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )\r\n#define FT_READ_SHORT( var )      FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )\r\n#define FT_READ_USHORT( var )     FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )\r\n#define FT_READ_OFF3( var )       FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )\r\n#define FT_READ_UOFF3( var )      FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )\r\n#define FT_READ_LONG( var )       FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )\r\n#define FT_READ_ULONG( var )      FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )\r\n\r\n#define FT_READ_SHORT_LE( var )   FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )\r\n#define FT_READ_USHORT_LE( var )  FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )\r\n#define FT_READ_LONG_LE( var )    FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )\r\n#define FT_READ_ULONG_LE( var )   FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\r\n\r\n  /* initialize a stream for reading a regular system stream */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Open( FT_Stream    stream,\r\n                  const char*  filepathname );\r\n\r\n#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\r\n\r\n\r\n  /* create a new (input) stream from an FT_Open_Args structure */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_New( FT_Library           library,\r\n                 const FT_Open_Args*  args,\r\n                 FT_Stream           *astream );\r\n\r\n  /* free a stream */\r\n  FT_BASE( void )\r\n  FT_Stream_Free( FT_Stream  stream,\r\n                  FT_Int     external );\r\n\r\n  /* initialize a stream for reading in-memory data */\r\n  FT_BASE( void )\r\n  FT_Stream_OpenMemory( FT_Stream       stream,\r\n                        const FT_Byte*  base,\r\n                        FT_ULong        size );\r\n\r\n  /* close a stream (does not destroy the stream structure) */\r\n  FT_BASE( void )\r\n  FT_Stream_Close( FT_Stream  stream );\r\n\r\n\r\n  /* seek within a stream. position is relative to start of stream */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Seek( FT_Stream  stream,\r\n                  FT_ULong   pos );\r\n\r\n  /* skip bytes in a stream */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Skip( FT_Stream  stream,\r\n                  FT_Long    distance );\r\n\r\n  /* return current stream position */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_Pos( FT_Stream  stream );\r\n\r\n  /* read bytes from a stream into a user-allocated buffer, returns an */\r\n  /* error if not all bytes could be read.                             */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Read( FT_Stream  stream,\r\n                  FT_Byte*   buffer,\r\n                  FT_ULong   count );\r\n\r\n  /* read bytes from a stream at a given position */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_ReadAt( FT_Stream  stream,\r\n                    FT_ULong   pos,\r\n                    FT_Byte*   buffer,\r\n                    FT_ULong   count );\r\n\r\n  /* try to read bytes at the end of a stream; return number of bytes */\r\n  /* really available                                                 */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_TryRead( FT_Stream  stream,\r\n                     FT_Byte*   buffer,\r\n                     FT_ULong   count );\r\n\r\n  /* Enter a frame of `count' consecutive bytes in a stream.  Returns an */\r\n  /* error if the frame could not be read/accessed.  The caller can use  */\r\n  /* the FT_Stream_Get_XXX functions to retrieve frame data without      */\r\n  /* error checks.                                                       */\r\n  /*                                                                     */\r\n  /* You must _always_ call FT_Stream_ExitFrame() once you have entered  */\r\n  /* a stream frame!                                                     */\r\n  /*                                                                     */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_EnterFrame( FT_Stream  stream,\r\n                        FT_ULong   count );\r\n\r\n  /* exit a stream frame */\r\n  FT_BASE( void )\r\n  FT_Stream_ExitFrame( FT_Stream  stream );\r\n\r\n  /* Extract a stream frame.  If the stream is disk-based, a heap block */\r\n  /* is allocated and the frame bytes are read into it.  If the stream  */\r\n  /* is memory-based, this function simply set a pointer to the data.   */\r\n  /*                                                                    */\r\n  /* Useful to optimize access to memory-based streams transparently.   */\r\n  /*                                                                    */\r\n  /* All extracted frames must be `freed' with a call to the function   */\r\n  /* FT_Stream_ReleaseFrame().                                          */\r\n  /*                                                                    */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_ExtractFrame( FT_Stream  stream,\r\n                          FT_ULong   count,\r\n                          FT_Byte**  pbytes );\r\n\r\n  /* release an extract frame (see FT_Stream_ExtractFrame) */\r\n  FT_BASE( void )\r\n  FT_Stream_ReleaseFrame( FT_Stream  stream,\r\n                          FT_Byte**  pbytes );\r\n\r\n  /* read a byte from an entered frame */\r\n  FT_BASE( FT_Char )\r\n  FT_Stream_GetChar( FT_Stream  stream );\r\n\r\n  /* read a 16-bit big-endian unsigned integer from an entered frame */\r\n  FT_BASE( FT_UShort )\r\n  FT_Stream_GetUShort( FT_Stream  stream );\r\n\r\n  /* read a 24-bit big-endian unsigned integer from an entered frame */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_GetUOffset( FT_Stream  stream );\r\n\r\n  /* read a 32-bit big-endian unsigned integer from an entered frame */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_GetULong( FT_Stream  stream );\r\n\r\n  /* read a 16-bit little-endian unsigned integer from an entered frame */\r\n  FT_BASE( FT_UShort )\r\n  FT_Stream_GetUShortLE( FT_Stream  stream );\r\n\r\n  /* read a 32-bit little-endian unsigned integer from an entered frame */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_GetULongLE( FT_Stream  stream );\r\n\r\n\r\n  /* read a byte from a stream */\r\n  FT_BASE( FT_Char )\r\n  FT_Stream_ReadChar( FT_Stream  stream,\r\n                      FT_Error*  error );\r\n\r\n  /* read a 16-bit big-endian unsigned integer from a stream */\r\n  FT_BASE( FT_UShort )\r\n  FT_Stream_ReadUShort( FT_Stream  stream,\r\n                        FT_Error*  error );\r\n\r\n  /* read a 24-bit big-endian unsigned integer from a stream */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_ReadUOffset( FT_Stream  stream,\r\n                         FT_Error*  error );\r\n\r\n  /* read a 32-bit big-endian integer from a stream */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_ReadULong( FT_Stream  stream,\r\n                       FT_Error*  error );\r\n\r\n  /* read a 16-bit little-endian unsigned integer from a stream */\r\n  FT_BASE( FT_UShort )\r\n  FT_Stream_ReadUShortLE( FT_Stream  stream,\r\n                          FT_Error*  error );\r\n\r\n  /* read a 32-bit little-endian unsigned integer from a stream */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_ReadULongLE( FT_Stream  stream,\r\n                         FT_Error*  error );\r\n\r\n  /* Read a structure from a stream.  The structure must be described */\r\n  /* by an array of FT_Frame_Field records.                           */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_ReadFields( FT_Stream              stream,\r\n                        const FT_Frame_Field*  fields,\r\n                        void*                  structure );\r\n\r\n\r\n#define FT_STREAM_POS()           \\\r\n          FT_Stream_Pos( stream )\r\n\r\n#define FT_STREAM_SEEK( position )                           \\\r\n          FT_SET_ERROR( FT_Stream_Seek( stream, position ) )\r\n\r\n#define FT_STREAM_SKIP( distance )                           \\\r\n          FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )\r\n\r\n#define FT_STREAM_READ( buffer, count )                   \\\r\n          FT_SET_ERROR( FT_Stream_Read( stream,           \\\r\n                                        (FT_Byte*)buffer, \\\r\n                                        count ) )\r\n\r\n#define FT_STREAM_READ_AT( position, buffer, count )         \\\r\n          FT_SET_ERROR( FT_Stream_ReadAt( stream,            \\\r\n                                           position,         \\\r\n                                           (FT_Byte*)buffer, \\\r\n                                           count ) )\r\n\r\n#define FT_STREAM_READ_FIELDS( fields, object )                          \\\r\n          FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )\r\n\r\n\r\n#define FT_FRAME_ENTER( size )                                       \\\r\n          FT_SET_ERROR(                                              \\\r\n            FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )\r\n\r\n#define FT_FRAME_EXIT()                 \\\r\n          FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )\r\n\r\n#define FT_FRAME_EXTRACT( size, bytes )                                       \\\r\n          FT_SET_ERROR(                                                       \\\r\n            FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size,             \\\r\n                                                    (FT_Byte**)&(bytes) ) ) )\r\n\r\n#define FT_FRAME_RELEASE( bytes )                                         \\\r\n          FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream,                 \\\r\n                                                  (FT_Byte**)&(bytes) ) )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSTREAM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/fttrace.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttrace.h                                                              */\r\n/*                                                                         */\r\n/*    Tracing handling (specification only).                               */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2004-2007, 2009, 2011-2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /* definitions of trace levels for FreeType 2 */\r\n\r\n  /* the first level must always be `trace_any' */\r\nFT_TRACE_DEF( any )\r\n\r\n  /* base components */\r\nFT_TRACE_DEF( calc )      /* calculations            (ftcalc.c)   */\r\nFT_TRACE_DEF( memory )    /* memory manager          (ftobjs.c)   */\r\nFT_TRACE_DEF( stream )    /* stream manager          (ftstream.c) */\r\nFT_TRACE_DEF( io )        /* i/o interface           (ftsystem.c) */\r\nFT_TRACE_DEF( list )      /* list management         (ftlist.c)   */\r\nFT_TRACE_DEF( init )      /* initialization          (ftinit.c)   */\r\nFT_TRACE_DEF( objs )      /* base objects            (ftobjs.c)   */\r\nFT_TRACE_DEF( outline )   /* outline management      (ftoutln.c)  */\r\nFT_TRACE_DEF( glyph )     /* glyph management        (ftglyph.c)  */\r\nFT_TRACE_DEF( gloader )   /* glyph loader            (ftgloadr.c) */\r\n\r\nFT_TRACE_DEF( raster )    /* monochrome rasterizer   (ftraster.c) */\r\nFT_TRACE_DEF( smooth )    /* anti-aliasing raster    (ftgrays.c)  */\r\nFT_TRACE_DEF( mm )        /* MM interface            (ftmm.c)     */\r\nFT_TRACE_DEF( raccess )   /* resource fork accessor  (ftrfork.c)  */\r\nFT_TRACE_DEF( synth )     /* bold/slant synthesizer  (ftsynth.c)  */\r\n\r\n  /* Cache sub-system */\r\nFT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc.) */\r\n\r\n  /* SFNT driver components */\r\nFT_TRACE_DEF( sfdriver )  /* SFNT font driver        (sfdriver.c) */\r\nFT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */\r\nFT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */\r\nFT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */\r\nFT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */\r\nFT_TRACE_DEF( ttmtx )     /* metrics-related tables  (ttmtx.c)    */\r\nFT_TRACE_DEF( ttpost )    /* PS table processing     (ttpost.c)   */\r\nFT_TRACE_DEF( ttsbit )    /* TrueType sbit handling  (ttsbit.c)   */\r\nFT_TRACE_DEF( ttbdf )     /* TrueType embedded BDF   (ttbdf.c)    */\r\n\r\n  /* TrueType driver components */\r\nFT_TRACE_DEF( ttdriver )  /* TT font driver          (ttdriver.c) */\r\nFT_TRACE_DEF( ttgload )   /* TT glyph loader         (ttgload.c)  */\r\nFT_TRACE_DEF( ttinterp )  /* bytecode interpreter    (ttinterp.c) */\r\nFT_TRACE_DEF( ttobjs )    /* TT objects manager      (ttobjs.c)   */\r\nFT_TRACE_DEF( ttpload )   /* TT data/program loader  (ttpload.c)  */\r\nFT_TRACE_DEF( ttgxvar )   /* TrueType GX var handler (ttgxvar.c)  */\r\n\r\n  /* Type 1 driver components */\r\nFT_TRACE_DEF( t1afm )\r\nFT_TRACE_DEF( t1driver )\r\nFT_TRACE_DEF( t1gload )\r\nFT_TRACE_DEF( t1hint )\r\nFT_TRACE_DEF( t1load )\r\nFT_TRACE_DEF( t1objs )\r\nFT_TRACE_DEF( t1parse )\r\n\r\n  /* PostScript helper module `psaux' */\r\nFT_TRACE_DEF( t1decode )\r\nFT_TRACE_DEF( psobjs )\r\nFT_TRACE_DEF( psconv )\r\n\r\n  /* PostScript hinting module `pshinter' */\r\nFT_TRACE_DEF( pshrec )\r\nFT_TRACE_DEF( pshalgo1 )\r\nFT_TRACE_DEF( pshalgo2 )\r\n\r\n  /* Type 2 driver components */\r\nFT_TRACE_DEF( cffdriver )\r\nFT_TRACE_DEF( cffgload )\r\nFT_TRACE_DEF( cffload )\r\nFT_TRACE_DEF( cffobjs )\r\nFT_TRACE_DEF( cffparse )\r\n\r\n  /* Type 42 driver component */\r\nFT_TRACE_DEF( t42 )\r\n\r\n  /* CID driver components */\r\nFT_TRACE_DEF( cidafm )\r\nFT_TRACE_DEF( ciddriver )\r\nFT_TRACE_DEF( cidgload )\r\nFT_TRACE_DEF( cidload )\r\nFT_TRACE_DEF( cidobjs )\r\nFT_TRACE_DEF( cidparse )\r\n\r\n  /* Windows font component */\r\nFT_TRACE_DEF( winfnt )\r\n\r\n  /* PCF font components */\r\nFT_TRACE_DEF( pcfdriver )\r\nFT_TRACE_DEF( pcfread )\r\n\r\n  /* BDF font components */\r\nFT_TRACE_DEF( bdfdriver )\r\nFT_TRACE_DEF( bdflib )\r\n\r\n  /* PFR font component */\r\nFT_TRACE_DEF( pfr )\r\n\r\n  /* OpenType validation components */\r\nFT_TRACE_DEF( otvmodule )\r\nFT_TRACE_DEF( otvcommon )\r\nFT_TRACE_DEF( otvbase )\r\nFT_TRACE_DEF( otvgdef )\r\nFT_TRACE_DEF( otvgpos )\r\nFT_TRACE_DEF( otvgsub )\r\nFT_TRACE_DEF( otvjstf )\r\nFT_TRACE_DEF( otvmath )\r\n\r\n  /* TrueTypeGX/AAT validation components */\r\nFT_TRACE_DEF( gxvmodule )\r\nFT_TRACE_DEF( gxvcommon )\r\nFT_TRACE_DEF( gxvfeat )\r\nFT_TRACE_DEF( gxvmort )\r\nFT_TRACE_DEF( gxvmorx )\r\nFT_TRACE_DEF( gxvbsln )\r\nFT_TRACE_DEF( gxvjust )\r\nFT_TRACE_DEF( gxvkern )\r\nFT_TRACE_DEF( gxvopbd )\r\nFT_TRACE_DEF( gxvtrak )\r\nFT_TRACE_DEF( gxvprop )\r\nFT_TRACE_DEF( gxvlcar )\r\n\r\n  /* autofit components */\r\nFT_TRACE_DEF( afmodule )\r\nFT_TRACE_DEF( afhints )\r\nFT_TRACE_DEF( afcjk )\r\nFT_TRACE_DEF( aflatin )\r\nFT_TRACE_DEF( aflatin2 )\r\nFT_TRACE_DEF( afwarp )\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/ftvalid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftvalid.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType validation support (specification).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTVALID_H__\r\n#define __FTVALID_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_STANDARD_LIBRARY_H   /* for ft_setjmp and ft_longjmp */\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                    V A L I D A T I O N                          ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* handle to a validation object */\r\n  typedef struct FT_ValidatorRec_ volatile*  FT_Validator;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* There are three distinct validation levels defined here:              */\r\n  /*                                                                       */\r\n  /* FT_VALIDATE_DEFAULT ::                                                */\r\n  /*   A table that passes this validation level can be used reliably by   */\r\n  /*   FreeType.  It generally means that all offsets have been checked to */\r\n  /*   prevent out-of-bound reads, that array counts are correct, etc.     */\r\n  /*                                                                       */\r\n  /* FT_VALIDATE_TIGHT ::                                                  */\r\n  /*   A table that passes this validation level can be used reliably and  */\r\n  /*   doesn't contain invalid data.  For example, a charmap table that    */\r\n  /*   returns invalid glyph indices will not pass, even though it can     */\r\n  /*   be used with FreeType in default mode (the library will simply      */\r\n  /*   return an error later when trying to load the glyph).               */\r\n  /*                                                                       */\r\n  /*   It also checks that fields which must be a multiple of 2, 4, or 8,  */\r\n  /*   don't have incorrect values, etc.                                   */\r\n  /*                                                                       */\r\n  /* FT_VALIDATE_PARANOID ::                                               */\r\n  /*   Only for font debugging.  Checks that a table follows the           */\r\n  /*   specification by 100%.  Very few fonts will be able to pass this    */\r\n  /*   level anyway but it can be useful for certain tools like font       */\r\n  /*   editors/converters.                                                 */\r\n  /*                                                                       */\r\n  typedef enum  FT_ValidationLevel_\r\n  {\r\n    FT_VALIDATE_DEFAULT = 0,\r\n    FT_VALIDATE_TIGHT,\r\n    FT_VALIDATE_PARANOID\r\n\r\n  } FT_ValidationLevel;\r\n\r\n\r\n  /* validator structure */\r\n  typedef struct  FT_ValidatorRec_\r\n  {\r\n    const FT_Byte*      base;        /* address of table in memory       */\r\n    const FT_Byte*      limit;       /* `base' + sizeof(table) in memory */\r\n    FT_ValidationLevel  level;       /* validation level                 */\r\n    FT_Error            error;       /* error returned. 0 means success  */\r\n\r\n    ft_jmp_buf          jump_buffer; /* used for exception handling      */\r\n\r\n  } FT_ValidatorRec;\r\n\r\n\r\n#define FT_VALIDATOR( x )  ((FT_Validator)( x ))\r\n\r\n\r\n  FT_BASE( void )\r\n  ft_validator_init( FT_Validator        valid,\r\n                     const FT_Byte*      base,\r\n                     const FT_Byte*      limit,\r\n                     FT_ValidationLevel  level );\r\n\r\n  /* Do not use this. It's broken and will cause your validator to crash */\r\n  /* if you run it on an invalid font.                                   */\r\n  FT_BASE( FT_Int )\r\n  ft_validator_run( FT_Validator  valid );\r\n\r\n  /* Sets the error field in a validator, then calls `longjmp' to return */\r\n  /* to high-level caller.  Using `setjmp/longjmp' avoids many stupid    */\r\n  /* error checks within the validation routines.                        */\r\n  /*                                                                     */\r\n  FT_BASE( void )\r\n  ft_validator_error( FT_Validator  valid,\r\n                      FT_Error      error );\r\n\r\n\r\n  /* Calls ft_validate_error.  Assumes that the `valid' local variable */\r\n  /* holds a pointer to the current validator object.                  */\r\n  /*                                                                   */\r\n  /* Use preprocessor prescan to pass FT_ERR_PREFIX.                   */\r\n  /*                                                                   */\r\n#define FT_INVALID( _prefix, _error )  FT_INVALID_( _prefix, _error )\r\n#define FT_INVALID_( _prefix, _error ) \\\r\n          ft_validator_error( valid, _prefix ## _error )\r\n\r\n  /* called when a broken table is detected */\r\n#define FT_INVALID_TOO_SHORT \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Table )\r\n\r\n  /* called when an invalid offset is detected */\r\n#define FT_INVALID_OFFSET \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Offset )\r\n\r\n  /* called when an invalid format/value is detected */\r\n#define FT_INVALID_FORMAT \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Table )\r\n\r\n  /* called when an invalid glyph index is detected */\r\n#define FT_INVALID_GLYPH_ID \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Glyph_Index )\r\n\r\n  /* called when an invalid field value is detected */\r\n#define FT_INVALID_DATA \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Table )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTVALID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/internal.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  internal.h                                                             */\r\n/*                                                                         */\r\n/*    Internal header files (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is automatically included by `ft2build.h'.                  */\r\n  /* Do not include it manually!                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>\r\n#define FT_INTERNAL_PIC_H                 <freetype/internal/ftpic.h>\r\n#define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>\r\n#define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>\r\n#define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>\r\n#define FT_INTERNAL_CALC_H                <freetype/internal/ftcalc.h>\r\n#define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdriver.h>\r\n#define FT_INTERNAL_TRACE_H               <freetype/internal/fttrace.h>\r\n#define FT_INTERNAL_GLYPH_LOADER_H        <freetype/internal/ftgloadr.h>\r\n#define FT_INTERNAL_SFNT_H                <freetype/internal/sfnt.h>\r\n#define FT_INTERNAL_SERVICE_H             <freetype/internal/ftserv.h>\r\n#define FT_INTERNAL_RFORK_H               <freetype/internal/ftrfork.h>\r\n#define FT_INTERNAL_VALIDATE_H            <freetype/internal/ftvalid.h>\r\n\r\n#define FT_INTERNAL_TRUETYPE_TYPES_H      <freetype/internal/tttypes.h>\r\n#define FT_INTERNAL_TYPE1_TYPES_H         <freetype/internal/t1types.h>\r\n\r\n#define FT_INTERNAL_POSTSCRIPT_AUX_H      <freetype/internal/psaux.h>\r\n#define FT_INTERNAL_POSTSCRIPT_HINTS_H    <freetype/internal/pshints.h>\r\n#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H  <freetype/internal/psglobal.h>\r\n\r\n#define FT_INTERNAL_AUTOHINT_H            <freetype/internal/autohint.h>\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/psaux.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psaux.h                                                                */\r\n/*                                                                         */\r\n/*    Auxiliary functions and data structures related to PostScript fonts  */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006, 2008, 2009, 2012 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSAUX_H__\r\n#define __PSAUX_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                             T1_TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct PS_TableRec_*              PS_Table;\r\n  typedef const struct PS_Table_FuncsRec_*  PS_Table_Funcs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_Table_FuncsRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A set of function pointers to manage PS_Table objects.             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    table_init    :: Used to initialize a table.                       */\r\n  /*                                                                       */\r\n  /*    table_done    :: Finalizes resp. destroy a given table.            */\r\n  /*                                                                       */\r\n  /*    table_add     :: Adds a new object to a table.                     */\r\n  /*                                                                       */\r\n  /*    table_release :: Releases table data, then finalizes it.           */\r\n  /*                                                                       */\r\n  typedef struct  PS_Table_FuncsRec_\r\n  {\r\n    FT_Error\r\n    (*init)( PS_Table   table,\r\n             FT_Int     count,\r\n             FT_Memory  memory );\r\n\r\n    void\r\n    (*done)( PS_Table  table );\r\n\r\n    FT_Error\r\n    (*add)( PS_Table    table,\r\n            FT_Int      idx,\r\n            void*       object,\r\n            FT_PtrDist  length );\r\n\r\n    void\r\n    (*release)( PS_Table  table );\r\n\r\n  } PS_Table_FuncsRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_TableRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A PS_Table is a simple object used to store an array of objects in */\r\n  /*    a single memory block.                                             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    block     :: The address in memory of the growheap's block.  This  */\r\n  /*                 can change between two object adds, due to            */\r\n  /*                 reallocation.                                         */\r\n  /*                                                                       */\r\n  /*    cursor    :: The current top of the grow heap within its block.    */\r\n  /*                                                                       */\r\n  /*    capacity  :: The current size of the heap block.  Increments by    */\r\n  /*                 1kByte chunks.                                        */\r\n  /*                                                                       */\r\n  /*    max_elems :: The maximum number of elements in table.              */\r\n  /*                                                                       */\r\n  /*    num_elems :: The current number of elements in table.              */\r\n  /*                                                                       */\r\n  /*    elements  :: A table of element addresses within the block.        */\r\n  /*                                                                       */\r\n  /*    lengths   :: A table of element sizes within the block.            */\r\n  /*                                                                       */\r\n  /*    memory    :: The object used for memory operations                 */\r\n  /*                 (alloc/realloc).                                      */\r\n  /*                                                                       */\r\n  /*    funcs     :: A table of method pointers for this object.           */\r\n  /*                                                                       */\r\n  typedef struct  PS_TableRec_\r\n  {\r\n    FT_Byte*           block;          /* current memory block           */\r\n    FT_Offset          cursor;         /* current cursor in memory block */\r\n    FT_Offset          capacity;       /* current size of memory block   */\r\n    FT_Long            init;\r\n\r\n    FT_Int             max_elems;\r\n    FT_Int             num_elems;\r\n    FT_Byte**          elements;       /* addresses of table elements */\r\n    FT_PtrDist*        lengths;        /* lengths of table elements   */\r\n\r\n    FT_Memory          memory;\r\n    PS_Table_FuncsRec  funcs;\r\n\r\n  } PS_TableRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       T1 FIELDS & TOKENS                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct PS_ParserRec_*  PS_Parser;\r\n\r\n  typedef struct T1_TokenRec_*   T1_Token;\r\n\r\n  typedef struct T1_FieldRec_*   T1_Field;\r\n\r\n\r\n  /* simple enumeration type used to identify token types */\r\n  typedef enum  T1_TokenType_\r\n  {\r\n    T1_TOKEN_TYPE_NONE = 0,\r\n    T1_TOKEN_TYPE_ANY,\r\n    T1_TOKEN_TYPE_STRING,\r\n    T1_TOKEN_TYPE_ARRAY,\r\n    T1_TOKEN_TYPE_KEY, /* aka `name' */\r\n\r\n    /* do not remove */\r\n    T1_TOKEN_TYPE_MAX\r\n\r\n  } T1_TokenType;\r\n\r\n\r\n  /* a simple structure used to identify tokens */\r\n  typedef struct  T1_TokenRec_\r\n  {\r\n    FT_Byte*      start;   /* first character of token in input stream */\r\n    FT_Byte*      limit;   /* first character after the token          */\r\n    T1_TokenType  type;    /* type of token                            */\r\n\r\n  } T1_TokenRec;\r\n\r\n\r\n  /* enumeration type used to identify object fields */\r\n  typedef enum  T1_FieldType_\r\n  {\r\n    T1_FIELD_TYPE_NONE = 0,\r\n    T1_FIELD_TYPE_BOOL,\r\n    T1_FIELD_TYPE_INTEGER,\r\n    T1_FIELD_TYPE_FIXED,\r\n    T1_FIELD_TYPE_FIXED_1000,\r\n    T1_FIELD_TYPE_STRING,\r\n    T1_FIELD_TYPE_KEY,\r\n    T1_FIELD_TYPE_BBOX,\r\n    T1_FIELD_TYPE_INTEGER_ARRAY,\r\n    T1_FIELD_TYPE_FIXED_ARRAY,\r\n    T1_FIELD_TYPE_CALLBACK,\r\n\r\n    /* do not remove */\r\n    T1_FIELD_TYPE_MAX\r\n\r\n  } T1_FieldType;\r\n\r\n\r\n  typedef enum  T1_FieldLocation_\r\n  {\r\n    T1_FIELD_LOCATION_CID_INFO,\r\n    T1_FIELD_LOCATION_FONT_DICT,\r\n    T1_FIELD_LOCATION_FONT_EXTRA,\r\n    T1_FIELD_LOCATION_FONT_INFO,\r\n    T1_FIELD_LOCATION_PRIVATE,\r\n    T1_FIELD_LOCATION_BBOX,\r\n    T1_FIELD_LOCATION_LOADER,\r\n    T1_FIELD_LOCATION_FACE,\r\n    T1_FIELD_LOCATION_BLEND,\r\n\r\n    /* do not remove */\r\n    T1_FIELD_LOCATION_MAX\r\n\r\n  } T1_FieldLocation;\r\n\r\n\r\n  typedef void\r\n  (*T1_Field_ParseFunc)( FT_Face     face,\r\n                         FT_Pointer  parser );\r\n\r\n\r\n  /* structure type used to model object fields */\r\n  typedef struct  T1_FieldRec_\r\n  {\r\n    const char*         ident;        /* field identifier               */\r\n    T1_FieldLocation    location;\r\n    T1_FieldType        type;         /* type of field                  */\r\n    T1_Field_ParseFunc  reader;\r\n    FT_UInt             offset;       /* offset of field in object      */\r\n    FT_Byte             size;         /* size of field in bytes         */\r\n    FT_UInt             array_max;    /* maximum number of elements for */\r\n                                      /* array                          */\r\n    FT_UInt             count_offset; /* offset of element count for    */\r\n                                      /* arrays; must not be zero if in */\r\n                                      /* use -- in other words, a       */\r\n                                      /* `num_FOO' element must not     */\r\n                                      /* start the used structure if we */\r\n                                      /* parse a `FOO' array            */\r\n    FT_UInt             dict;         /* where we expect it             */\r\n  } T1_FieldRec;\r\n\r\n#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */\r\n#define T1_FIELD_DICT_PRIVATE  ( 1 << 1 )\r\n\r\n\r\n\r\n#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \\\r\n          {                                                 \\\r\n            _ident, T1CODE, _type,                          \\\r\n            0,                                              \\\r\n            FT_FIELD_OFFSET( _fname ),                      \\\r\n            FT_FIELD_SIZE( _fname ),                        \\\r\n            0, 0,                                           \\\r\n            _dict                                           \\\r\n          },\r\n\r\n#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \\\r\n          {                                             \\\r\n            _ident, T1CODE, T1_FIELD_TYPE_CALLBACK,     \\\r\n            (T1_Field_ParseFunc)_reader,                \\\r\n            0, 0,                                       \\\r\n            0, 0,                                       \\\r\n            _dict                                       \\\r\n          },\r\n\r\n#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \\\r\n          {                                                      \\\r\n            _ident, T1CODE, _type,                               \\\r\n            0,                                                   \\\r\n            FT_FIELD_OFFSET( _fname ),                           \\\r\n            FT_FIELD_SIZE_DELTA( _fname ),                       \\\r\n            _max,                                                \\\r\n            FT_FIELD_OFFSET( num_ ## _fname ),                   \\\r\n            _dict                                                \\\r\n          },\r\n\r\n#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \\\r\n          {                                                       \\\r\n            _ident, T1CODE, _type,                                \\\r\n            0,                                                    \\\r\n            FT_FIELD_OFFSET( _fname ),                            \\\r\n            FT_FIELD_SIZE_DELTA( _fname ),                        \\\r\n            _max, 0,                                              \\\r\n            _dict                                                 \\\r\n          },\r\n\r\n\r\n#define T1_FIELD_BOOL( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )\r\n\r\n#define T1_FIELD_NUM( _ident, _fname, _dict )                                 \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )\r\n\r\n#define T1_FIELD_FIXED( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )\r\n\r\n#define T1_FIELD_FIXED_1000( _ident, _fname, _dict )                     \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \\\r\n                               _dict )\r\n\r\n#define T1_FIELD_STRING( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )\r\n\r\n#define T1_FIELD_KEY( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )\r\n\r\n#define T1_FIELD_BBOX( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )\r\n\r\n\r\n#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict )         \\\r\n          T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\r\n                              _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict )     \\\r\n          T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\r\n                              _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict )         \\\r\n          T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\r\n                               _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict )     \\\r\n          T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\r\n                               _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_CALLBACK( _ident, _name, _dict )       \\\r\n          T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            T1 PARSER                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef const struct PS_Parser_FuncsRec_*  PS_Parser_Funcs;\r\n\r\n  typedef struct  PS_Parser_FuncsRec_\r\n  {\r\n    void\r\n    (*init)( PS_Parser  parser,\r\n             FT_Byte*   base,\r\n             FT_Byte*   limit,\r\n             FT_Memory  memory );\r\n\r\n    void\r\n    (*done)( PS_Parser  parser );\r\n\r\n    void\r\n    (*skip_spaces)( PS_Parser  parser );\r\n    void\r\n    (*skip_PS_token)( PS_Parser  parser );\r\n\r\n    FT_Long\r\n    (*to_int)( PS_Parser  parser );\r\n    FT_Fixed\r\n    (*to_fixed)( PS_Parser  parser,\r\n                 FT_Int     power_ten );\r\n\r\n    FT_Error\r\n    (*to_bytes)( PS_Parser  parser,\r\n                 FT_Byte*   bytes,\r\n                 FT_Offset  max_bytes,\r\n                 FT_Long*   pnum_bytes,\r\n                 FT_Bool    delimiters );\r\n\r\n    FT_Int\r\n    (*to_coord_array)( PS_Parser  parser,\r\n                       FT_Int     max_coords,\r\n                       FT_Short*  coords );\r\n    FT_Int\r\n    (*to_fixed_array)( PS_Parser  parser,\r\n                       FT_Int     max_values,\r\n                       FT_Fixed*  values,\r\n                       FT_Int     power_ten );\r\n\r\n    void\r\n    (*to_token)( PS_Parser  parser,\r\n                 T1_Token   token );\r\n    void\r\n    (*to_token_array)( PS_Parser  parser,\r\n                       T1_Token   tokens,\r\n                       FT_UInt    max_tokens,\r\n                       FT_Int*    pnum_tokens );\r\n\r\n    FT_Error\r\n    (*load_field)( PS_Parser       parser,\r\n                   const T1_Field  field,\r\n                   void**          objects,\r\n                   FT_UInt         max_objects,\r\n                   FT_ULong*       pflags );\r\n\r\n    FT_Error\r\n    (*load_field_table)( PS_Parser       parser,\r\n                         const T1_Field  field,\r\n                         void**          objects,\r\n                         FT_UInt         max_objects,\r\n                         FT_ULong*       pflags );\r\n\r\n  } PS_Parser_FuncsRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_ParserRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A PS_Parser is an object used to parse a Type 1 font very quickly. */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    cursor :: The current position in the text.                        */\r\n  /*                                                                       */\r\n  /*    base   :: Start of the processed text.                             */\r\n  /*                                                                       */\r\n  /*    limit  :: End of the processed text.                               */\r\n  /*                                                                       */\r\n  /*    error  :: The last error returned.                                 */\r\n  /*                                                                       */\r\n  /*    memory :: The object used for memory operations (alloc/realloc).   */\r\n  /*                                                                       */\r\n  /*    funcs  :: A table of functions for the parser.                     */\r\n  /*                                                                       */\r\n  typedef struct  PS_ParserRec_\r\n  {\r\n    FT_Byte*   cursor;\r\n    FT_Byte*   base;\r\n    FT_Byte*   limit;\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n    PS_Parser_FuncsRec  funcs;\r\n\r\n  } PS_ParserRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         T1 BUILDER                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct T1_BuilderRec_*  T1_Builder;\r\n\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Check_Points_Func)( T1_Builder  builder,\r\n                                   FT_Int      count );\r\n\r\n  typedef void\r\n  (*T1_Builder_Add_Point_Func)( T1_Builder  builder,\r\n                                FT_Pos      x,\r\n                                FT_Pos      y,\r\n                                FT_Byte     flag );\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Add_Point1_Func)( T1_Builder  builder,\r\n                                 FT_Pos      x,\r\n                                 FT_Pos      y );\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Add_Contour_Func)( T1_Builder  builder );\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Start_Point_Func)( T1_Builder  builder,\r\n                                  FT_Pos      x,\r\n                                  FT_Pos      y );\r\n\r\n  typedef void\r\n  (*T1_Builder_Close_Contour_Func)( T1_Builder  builder );\r\n\r\n\r\n  typedef const struct T1_Builder_FuncsRec_*  T1_Builder_Funcs;\r\n\r\n  typedef struct  T1_Builder_FuncsRec_\r\n  {\r\n    void\r\n    (*init)( T1_Builder    builder,\r\n             FT_Face       face,\r\n             FT_Size       size,\r\n             FT_GlyphSlot  slot,\r\n             FT_Bool       hinting );\r\n\r\n    void\r\n    (*done)( T1_Builder   builder );\r\n\r\n    T1_Builder_Check_Points_Func   check_points;\r\n    T1_Builder_Add_Point_Func      add_point;\r\n    T1_Builder_Add_Point1_Func     add_point1;\r\n    T1_Builder_Add_Contour_Func    add_contour;\r\n    T1_Builder_Start_Point_Func    start_point;\r\n    T1_Builder_Close_Contour_Func  close_contour;\r\n\r\n  } T1_Builder_FuncsRec;\r\n\r\n\r\n  /* an enumeration type to handle charstring parsing states */\r\n  typedef enum  T1_ParseState_\r\n  {\r\n    T1_Parse_Start,\r\n    T1_Parse_Have_Width,\r\n    T1_Parse_Have_Moveto,\r\n    T1_Parse_Have_Path\r\n\r\n  } T1_ParseState;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Structure>                                                           */\r\n  /*    T1_BuilderRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*     A structure used during glyph loading to store its outline.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory       :: The current memory object.                         */\r\n  /*                                                                       */\r\n  /*    face         :: The current face object.                           */\r\n  /*                                                                       */\r\n  /*    glyph        :: The current glyph slot.                            */\r\n  /*                                                                       */\r\n  /*    loader       :: XXX                                                */\r\n  /*                                                                       */\r\n  /*    base         :: The base glyph outline.                            */\r\n  /*                                                                       */\r\n  /*    current      :: The current glyph outline.                         */\r\n  /*                                                                       */\r\n  /*    max_points   :: maximum points in builder outline                  */\r\n  /*                                                                       */\r\n  /*    max_contours :: Maximum number of contours in builder outline.     */\r\n  /*                                                                       */\r\n  /*    pos_x        :: The horizontal translation (if composite glyph).   */\r\n  /*                                                                       */\r\n  /*    pos_y        :: The vertical translation (if composite glyph).     */\r\n  /*                                                                       */\r\n  /*    left_bearing :: The left side bearing point.                       */\r\n  /*                                                                       */\r\n  /*    advance      :: The horizontal advance vector.                     */\r\n  /*                                                                       */\r\n  /*    bbox         :: Unused.                                            */\r\n  /*                                                                       */\r\n  /*    parse_state  :: An enumeration which controls the charstring       */\r\n  /*                    parsing state.                                     */\r\n  /*                                                                       */\r\n  /*    load_points  :: If this flag is not set, no points are loaded.     */\r\n  /*                                                                       */\r\n  /*    no_recurse   :: Set but not used.                                  */\r\n  /*                                                                       */\r\n  /*    metrics_only :: A boolean indicating that we only want to compute  */\r\n  /*                    the metrics of a given glyph, not load all of its  */\r\n  /*                    points.                                            */\r\n  /*                                                                       */\r\n  /*    funcs        :: An array of function pointers for the builder.     */\r\n  /*                                                                       */\r\n  typedef struct  T1_BuilderRec_\r\n  {\r\n    FT_Memory       memory;\r\n    FT_Face         face;\r\n    FT_GlyphSlot    glyph;\r\n    FT_GlyphLoader  loader;\r\n    FT_Outline*     base;\r\n    FT_Outline*     current;\r\n\r\n    FT_Pos          pos_x;\r\n    FT_Pos          pos_y;\r\n\r\n    FT_Vector       left_bearing;\r\n    FT_Vector       advance;\r\n\r\n    FT_BBox         bbox;          /* bounding box */\r\n    T1_ParseState   parse_state;\r\n    FT_Bool         load_points;\r\n    FT_Bool         no_recurse;\r\n\r\n    FT_Bool         metrics_only;\r\n\r\n    void*           hints_funcs;    /* hinter-specific */\r\n    void*           hints_globals;  /* hinter-specific */\r\n\r\n    T1_Builder_FuncsRec  funcs;\r\n\r\n  } T1_BuilderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         T1 DECODER                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine   */\r\n  /* calls during glyph loading.                                           */\r\n  /*                                                                       */\r\n#define T1_MAX_SUBRS_CALLS  8\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity.  A     */\r\n  /* minimum of 16 is required.                                            */\r\n  /*                                                                       */\r\n#define T1_MAX_CHARSTRINGS_OPERANDS  32\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  typedef struct  T1_Decoder_ZoneRec_\r\n  {\r\n    FT_Byte*  cursor;\r\n    FT_Byte*  base;\r\n    FT_Byte*  limit;\r\n\r\n  } T1_Decoder_ZoneRec, *T1_Decoder_Zone;\r\n\r\n\r\n  typedef struct T1_DecoderRec_*              T1_Decoder;\r\n  typedef const struct T1_Decoder_FuncsRec_*  T1_Decoder_Funcs;\r\n\r\n\r\n  typedef FT_Error\r\n  (*T1_Decoder_Callback)( T1_Decoder  decoder,\r\n                          FT_UInt     glyph_index );\r\n\r\n\r\n  typedef struct  T1_Decoder_FuncsRec_\r\n  {\r\n    FT_Error\r\n    (*init)( T1_Decoder           decoder,\r\n             FT_Face              face,\r\n             FT_Size              size,\r\n             FT_GlyphSlot         slot,\r\n             FT_Byte**            glyph_names,\r\n             PS_Blend             blend,\r\n             FT_Bool              hinting,\r\n             FT_Render_Mode       hint_mode,\r\n             T1_Decoder_Callback  callback );\r\n\r\n    void\r\n    (*done)( T1_Decoder  decoder );\r\n\r\n    FT_Error\r\n    (*parse_charstrings)( T1_Decoder  decoder,\r\n                          FT_Byte*    base,\r\n                          FT_UInt     len );\r\n\r\n  } T1_Decoder_FuncsRec;\r\n\r\n\r\n  typedef struct  T1_DecoderRec_\r\n  {\r\n    T1_BuilderRec        builder;\r\n\r\n    FT_Long              stack[T1_MAX_CHARSTRINGS_OPERANDS];\r\n    FT_Long*             top;\r\n\r\n    T1_Decoder_ZoneRec   zones[T1_MAX_SUBRS_CALLS + 1];\r\n    T1_Decoder_Zone      zone;\r\n\r\n    FT_Service_PsCMaps   psnames;      /* for seac */\r\n    FT_UInt              num_glyphs;\r\n    FT_Byte**            glyph_names;\r\n\r\n    FT_Int               lenIV;        /* internal for sub routine calls */\r\n    FT_UInt              num_subrs;\r\n    FT_Byte**            subrs;\r\n    FT_PtrDist*          subrs_len;    /* array of subrs length (optional) */\r\n\r\n    FT_Matrix            font_matrix;\r\n    FT_Vector            font_offset;\r\n\r\n    FT_Int               flex_state;\r\n    FT_Int               num_flex_vectors;\r\n    FT_Vector            flex_vectors[7];\r\n\r\n    PS_Blend             blend;       /* for multiple master support */\r\n\r\n    FT_Render_Mode       hint_mode;\r\n\r\n    T1_Decoder_Callback  parse_callback;\r\n    T1_Decoder_FuncsRec  funcs;\r\n\r\n    FT_Long*             buildchar;\r\n    FT_UInt              len_buildchar;\r\n\r\n    FT_Bool              seac;\r\n\r\n  } T1_DecoderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            AFM PARSER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct AFM_ParserRec_*  AFM_Parser;\r\n\r\n  typedef struct  AFM_Parser_FuncsRec_\r\n  {\r\n    FT_Error\r\n    (*init)( AFM_Parser  parser,\r\n             FT_Memory   memory,\r\n             FT_Byte*    base,\r\n             FT_Byte*    limit );\r\n\r\n    void\r\n    (*done)( AFM_Parser  parser );\r\n\r\n    FT_Error\r\n    (*parse)( AFM_Parser  parser );\r\n\r\n  } AFM_Parser_FuncsRec;\r\n\r\n\r\n  typedef struct AFM_StreamRec_*  AFM_Stream;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    AFM_ParserRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An AFM_Parser is a parser for the AFM files.                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory    :: The object used for memory operations (alloc and      */\r\n  /*                 realloc).                                             */\r\n  /*                                                                       */\r\n  /*    stream    :: This is an opaque object.                             */\r\n  /*                                                                       */\r\n  /*    FontInfo  :: The result will be stored here.                       */\r\n  /*                                                                       */\r\n  /*    get_index :: A user provided function to get a glyph index by its  */\r\n  /*                 name.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  AFM_ParserRec_\r\n  {\r\n    FT_Memory     memory;\r\n    AFM_Stream    stream;\r\n\r\n    AFM_FontInfo  FontInfo;\r\n\r\n    FT_Int\r\n    (*get_index)( const char*  name,\r\n                  FT_Offset    len,\r\n                  void*        user_data );\r\n\r\n    void*         user_data;\r\n\r\n  } AFM_ParserRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     TYPE1 CHARMAPS                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef const struct T1_CMap_ClassesRec_*  T1_CMap_Classes;\r\n\r\n  typedef struct T1_CMap_ClassesRec_\r\n  {\r\n    FT_CMap_Class  standard;\r\n    FT_CMap_Class  expert;\r\n    FT_CMap_Class  custom;\r\n    FT_CMap_Class  unicode;\r\n\r\n  } T1_CMap_ClassesRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        PSAux Module Interface                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  PSAux_ServiceRec_\r\n  {\r\n    /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */\r\n    const PS_Table_FuncsRec*    ps_table_funcs;\r\n    const PS_Parser_FuncsRec*   ps_parser_funcs;\r\n    const T1_Builder_FuncsRec*  t1_builder_funcs;\r\n    const T1_Decoder_FuncsRec*  t1_decoder_funcs;\r\n\r\n    void\r\n    (*t1_decrypt)( FT_Byte*   buffer,\r\n                   FT_Offset  length,\r\n                   FT_UShort  seed );\r\n\r\n    T1_CMap_Classes  t1_cmap_classes;\r\n\r\n    /* fields after this comment line were added after version 2.1.10 */\r\n    const AFM_Parser_FuncsRec*  afm_parser_funcs;\r\n\r\n  } PSAux_ServiceRec, *PSAux_Service;\r\n\r\n  /* backwards-compatible type definition */\r\n  typedef PSAux_ServiceRec   PSAux_Interface;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                 Some convenience functions                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define IS_PS_NEWLINE( ch ) \\\r\n  ( (ch) == '\\r' ||         \\\r\n    (ch) == '\\n' )\r\n\r\n#define IS_PS_SPACE( ch )  \\\r\n  ( (ch) == ' '         || \\\r\n    IS_PS_NEWLINE( ch ) || \\\r\n    (ch) == '\\t'        || \\\r\n    (ch) == '\\f'        || \\\r\n    (ch) == '\\0' )\r\n\r\n#define IS_PS_SPECIAL( ch )       \\\r\n  ( (ch) == '/'                || \\\r\n    (ch) == '(' || (ch) == ')' || \\\r\n    (ch) == '<' || (ch) == '>' || \\\r\n    (ch) == '[' || (ch) == ']' || \\\r\n    (ch) == '{' || (ch) == '}' || \\\r\n    (ch) == '%'                )\r\n\r\n#define IS_PS_DELIM( ch )  \\\r\n  ( IS_PS_SPACE( ch )   || \\\r\n    IS_PS_SPECIAL( ch ) )\r\n\r\n#define IS_PS_DIGIT( ch )        \\\r\n  ( (ch) >= '0' && (ch) <= '9' )\r\n\r\n#define IS_PS_XDIGIT( ch )            \\\r\n  ( IS_PS_DIGIT( ch )              || \\\r\n    ( (ch) >= 'A' && (ch) <= 'F' ) || \\\r\n    ( (ch) >= 'a' && (ch) <= 'f' ) )\r\n\r\n#define IS_PS_BASE85( ch )       \\\r\n  ( (ch) >= '!' && (ch) <= 'u' )\r\n\r\n#define IS_PS_TOKEN( cur, limit, token )                                \\\r\n  ( (char)(cur)[0] == (token)[0]                                     && \\\r\n    ( (cur) + sizeof ( (token) ) == (limit) ||                          \\\r\n      ( (cur) + sizeof( (token) ) < (limit)          &&                 \\\r\n        IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) )             && \\\r\n    ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSAUX_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/pshints.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshints.h                                                              */\r\n/*                                                                         */\r\n/*    Interface to Postscript-specific (Type 1 and Type 2) hints           */\r\n/*    recorders (specification only).  These are used to support native    */\r\n/*    T1/T2 hints in the `type1', `cid', and `cff' font drivers.           */\r\n/*                                                                         */\r\n/*  Copyright 2001-2003, 2005-2007, 2009, 2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSHINTS_H__\r\n#define __PSHINTS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TYPE1_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****               INTERNAL REPRESENTATION OF GLOBALS              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct PSH_GlobalsRec_*  PSH_Globals;\r\n\r\n  typedef FT_Error\r\n  (*PSH_Globals_NewFunc)( FT_Memory     memory,\r\n                          T1_Private*   private_dict,\r\n                          PSH_Globals*  aglobals );\r\n\r\n  typedef FT_Error\r\n  (*PSH_Globals_SetScaleFunc)( PSH_Globals  globals,\r\n                               FT_Fixed     x_scale,\r\n                               FT_Fixed     y_scale,\r\n                               FT_Fixed     x_delta,\r\n                               FT_Fixed     y_delta );\r\n\r\n  typedef void\r\n  (*PSH_Globals_DestroyFunc)( PSH_Globals  globals );\r\n\r\n\r\n  typedef struct  PSH_Globals_FuncsRec_\r\n  {\r\n    PSH_Globals_NewFunc       create;\r\n    PSH_Globals_SetScaleFunc  set_scale;\r\n    PSH_Globals_DestroyFunc   destroy;\r\n\r\n  } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  PUBLIC TYPE 1 HINTS RECORDER                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T1_Hints\r\n   *\r\n   * @description:\r\n   *   This is a handle to an opaque structure used to record glyph hints\r\n   *   from a Type 1 character glyph character string.\r\n   *\r\n   *   The methods used to operate on this object are defined by the\r\n   *   @T1_Hints_FuncsRec structure.  Recording glyph hints is normally\r\n   *   achieved through the following scheme:\r\n   *\r\n   *   - Open a new hint recording session by calling the `open' method.\r\n   *     This rewinds the recorder and prepare it for new input.\r\n   *\r\n   *   - For each hint found in the glyph charstring, call the corresponding\r\n   *     method (`stem', `stem3', or `reset').  Note that these functions do\r\n   *     not return an error code.\r\n   *\r\n   *   - Close the recording session by calling the `close' method.  It\r\n   *     returns an error code if the hints were invalid or something\r\n   *     strange happened (e.g., memory shortage).\r\n   *\r\n   *   The hints accumulated in the object can later be used by the\r\n   *   PostScript hinter.\r\n   *\r\n   */\r\n  typedef struct T1_HintsRec_*  T1_Hints;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T1_Hints_Funcs\r\n   *\r\n   * @description:\r\n   *   A pointer to the @T1_Hints_FuncsRec structure that defines the API of\r\n   *   a given @T1_Hints object.\r\n   *\r\n   */\r\n  typedef const struct T1_Hints_FuncsRec_*  T1_Hints_Funcs;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_OpenFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to prepare it for a new Type 1\r\n   *   hints recording session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   * @note:\r\n   *   You should always call the @T1_Hints_CloseFunc method in order to\r\n   *   close an opened recording session.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_OpenFunc)( T1_Hints  hints );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_SetStemFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to record a new horizontal or\r\n   *   vertical stem.  This corresponds to the Type 1 `hstem' and `vstem'\r\n   *   operators.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   dimension ::\r\n   *     0 for horizontal stems (hstem), 1 for vertical ones (vstem).\r\n   *\r\n   *   coords ::\r\n   *     Array of 2 coordinates in 16.16 format, used as (position,length)\r\n   *     stem descriptor.\r\n   *\r\n   * @note:\r\n   *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use\r\n   *   horizontal coordinates (x) for vertical stems (dim=1).\r\n   *\r\n   *   `coords[0]' is the absolute stem position (lowest coordinate);\r\n   *   `coords[1]' is the length.\r\n   *\r\n   *   The length can be negative, in which case it must be either -20 or\r\n   *   -21.  It is interpreted as a `ghost' stem, according to the Type 1\r\n   *   specification.\r\n   *\r\n   *   If the length is -21 (corresponding to a bottom ghost stem), then\r\n   *   the real stem position is `coords[0]+coords[1]'.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_SetStemFunc)( T1_Hints   hints,\r\n                           FT_UInt    dimension,\r\n                           FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_SetStem3Func\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to record three\r\n   *   counter-controlled horizontal or vertical stems at once.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   dimension ::\r\n   *     0 for horizontal stems, 1 for vertical ones.\r\n   *\r\n   *   coords ::\r\n   *     An array of 6 values in 16.16 format, holding 3 (position,length)\r\n   *     pairs for the counter-controlled stems.\r\n   *\r\n   * @note:\r\n   *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use\r\n   *   horizontal coordinates (x) for vertical stems (dim=1).\r\n   *\r\n   *   The lengths cannot be negative (ghost stems are never\r\n   *   counter-controlled).\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_SetStem3Func)( T1_Hints   hints,\r\n                            FT_UInt    dimension,\r\n                            FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_ResetFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to reset the stems hints in a\r\n   *   recording session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The index of the last point in the input glyph in which the\r\n   *     previously defined hints apply.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_ResetFunc)( T1_Hints  hints,\r\n                         FT_UInt   end_point );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_CloseFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to close a hint recording\r\n   *   session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The index of the last point in the input glyph.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   The error code is set to indicate that an error occurred during the\r\n   *   recording session.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T1_Hints_CloseFunc)( T1_Hints  hints,\r\n                         FT_UInt   end_point );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_ApplyFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to apply hints to the\r\n   *   corresponding glyph outline.  Must be called once all hints have been\r\n   *   recorded.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   outline ::\r\n   *     A pointer to the target outline descriptor.\r\n   *\r\n   *   globals ::\r\n   *     The hinter globals for this font.\r\n   *\r\n   *   hint_mode ::\r\n   *     Hinting information.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   On input, all points within the outline are in font coordinates. On\r\n   *   output, they are in 1/64th of pixels.\r\n   *\r\n   *   The scaling transformation is taken from the `globals' object which\r\n   *   must correspond to the same font as the glyph.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T1_Hints_ApplyFunc)( T1_Hints        hints,\r\n                         FT_Outline*     outline,\r\n                         PSH_Globals     globals,\r\n                         FT_Render_Mode  hint_mode );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   T1_Hints_FuncsRec\r\n   *\r\n   * @description:\r\n   *   The structure used to provide the API to @T1_Hints objects.\r\n   *\r\n   * @fields:\r\n   *   hints ::\r\n   *     A handle to the T1 Hints recorder.\r\n   *\r\n   *   open ::\r\n   *     The function to open a recording session.\r\n   *\r\n   *   close ::\r\n   *     The function to close a recording session.\r\n   *\r\n   *   stem ::\r\n   *     The function to set a simple stem.\r\n   *\r\n   *   stem3 ::\r\n   *     The function to set counter-controlled stems.\r\n   *\r\n   *   reset ::\r\n   *     The function to reset stem hints.\r\n   *\r\n   *   apply ::\r\n   *     The function to apply the hints to the corresponding glyph outline.\r\n   *\r\n   */\r\n  typedef struct  T1_Hints_FuncsRec_\r\n  {\r\n    T1_Hints               hints;\r\n    T1_Hints_OpenFunc      open;\r\n    T1_Hints_CloseFunc     close;\r\n    T1_Hints_SetStemFunc   stem;\r\n    T1_Hints_SetStem3Func  stem3;\r\n    T1_Hints_ResetFunc     reset;\r\n    T1_Hints_ApplyFunc     apply;\r\n\r\n  } T1_Hints_FuncsRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  PUBLIC TYPE 2 HINTS RECORDER                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T2_Hints\r\n   *\r\n   * @description:\r\n   *   This is a handle to an opaque structure used to record glyph hints\r\n   *   from a Type 2 character glyph character string.\r\n   *\r\n   *   The methods used to operate on this object are defined by the\r\n   *   @T2_Hints_FuncsRec structure.  Recording glyph hints is normally\r\n   *   achieved through the following scheme:\r\n   *\r\n   *   - Open a new hint recording session by calling the `open' method.\r\n   *     This rewinds the recorder and prepare it for new input.\r\n   *\r\n   *   - For each hint found in the glyph charstring, call the corresponding\r\n   *     method (`stems', `hintmask', `counters').  Note that these\r\n   *     functions do not return an error code.\r\n   *\r\n   *   - Close the recording session by calling the `close' method.  It\r\n   *     returns an error code if the hints were invalid or something\r\n   *     strange happened (e.g., memory shortage).\r\n   *\r\n   *   The hints accumulated in the object can later be used by the\r\n   *   Postscript hinter.\r\n   *\r\n   */\r\n  typedef struct T2_HintsRec_*  T2_Hints;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T2_Hints_Funcs\r\n   *\r\n   * @description:\r\n   *   A pointer to the @T2_Hints_FuncsRec structure that defines the API of\r\n   *   a given @T2_Hints object.\r\n   *\r\n   */\r\n  typedef const struct T2_Hints_FuncsRec_*  T2_Hints_Funcs;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_OpenFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to prepare it for a new Type 2\r\n   *   hints recording session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   * @note:\r\n   *   You should always call the @T2_Hints_CloseFunc method in order to\r\n   *   close an opened recording session.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_OpenFunc)( T2_Hints  hints );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_StemsFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to set the table of stems in\r\n   *   either the vertical or horizontal dimension.  Equivalent to the\r\n   *   `hstem', `vstem', `hstemhm', and `vstemhm' Type 2 operators.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   dimension ::\r\n   *     0 for horizontal stems (hstem), 1 for vertical ones (vstem).\r\n   *\r\n   *   count ::\r\n   *     The number of stems.\r\n   *\r\n   *   coords ::\r\n   *     An array of `count' (position,length) pairs in 16.16 format.\r\n   *\r\n   * @note:\r\n   *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use\r\n   *   horizontal coordinates (x) for vertical stems (dim=1).\r\n   *\r\n   *   There are `2*count' elements in the `coords' array.  Each even\r\n   *   element is an absolute position in font units, each odd element is a\r\n   *   length in font units.\r\n   *\r\n   *   A length can be negative, in which case it must be either -20 or\r\n   *   -21.  It is interpreted as a `ghost' stem, according to the Type 1\r\n   *   specification.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_StemsFunc)( T2_Hints   hints,\r\n                         FT_UInt    dimension,\r\n                         FT_UInt    count,\r\n                         FT_Fixed*  coordinates );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_MaskFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to set a given hintmask (this\r\n   *   corresponds to the `hintmask' Type 2 operator).\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The glyph index of the last point to which the previously defined\r\n   *     or activated hints apply.\r\n   *\r\n   *   bit_count ::\r\n   *     The number of bits in the hint mask.\r\n   *\r\n   *   bytes ::\r\n   *     An array of bytes modelling the hint mask.\r\n   *\r\n   * @note:\r\n   *   If the hintmask starts the charstring (before any glyph point\r\n   *   definition), the value of `end_point' should be 0.\r\n   *\r\n   *   `bit_count' is the number of meaningful bits in the `bytes' array; it\r\n   *   must be equal to the total number of hints defined so far (i.e.,\r\n   *   horizontal+verticals).\r\n   *\r\n   *   The `bytes' array can come directly from the Type 2 charstring and\r\n   *   respects the same format.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_MaskFunc)( T2_Hints        hints,\r\n                        FT_UInt         end_point,\r\n                        FT_UInt         bit_count,\r\n                        const FT_Byte*  bytes );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_CounterFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to set a given counter mask\r\n   *   (this corresponds to the `hintmask' Type 2 operator).\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     A glyph index of the last point to which the previously defined or\r\n   *     active hints apply.\r\n   *\r\n   *   bit_count ::\r\n   *     The number of bits in the hint mask.\r\n   *\r\n   *   bytes ::\r\n   *     An array of bytes modelling the hint mask.\r\n   *\r\n   * @note:\r\n   *   If the hintmask starts the charstring (before any glyph point\r\n   *   definition), the value of `end_point' should be 0.\r\n   *\r\n   *   `bit_count' is the number of meaningful bits in the `bytes' array; it\r\n   *   must be equal to the total number of hints defined so far (i.e.,\r\n   *   horizontal+verticals).\r\n   *\r\n   *    The `bytes' array can come directly from the Type 2 charstring and\r\n   *    respects the same format.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_CounterFunc)( T2_Hints        hints,\r\n                           FT_UInt         bit_count,\r\n                           const FT_Byte*  bytes );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_CloseFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to close a hint recording\r\n   *   session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The index of the last point in the input glyph.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   The error code is set to indicate that an error occurred during the\r\n   *   recording session.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T2_Hints_CloseFunc)( T2_Hints  hints,\r\n                         FT_UInt   end_point );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_ApplyFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to apply hints to the\r\n   *   corresponding glyph outline.  Must be called after the `close'\r\n   *   method.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   outline ::\r\n   *     A pointer to the target outline descriptor.\r\n   *\r\n   *   globals ::\r\n   *     The hinter globals for this font.\r\n   *\r\n   *   hint_mode ::\r\n   *     Hinting information.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   On input, all points within the outline are in font coordinates. On\r\n   *   output, they are in 1/64th of pixels.\r\n   *\r\n   *   The scaling transformation is taken from the `globals' object which\r\n   *   must correspond to the same font than the glyph.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T2_Hints_ApplyFunc)( T2_Hints        hints,\r\n                         FT_Outline*     outline,\r\n                         PSH_Globals     globals,\r\n                         FT_Render_Mode  hint_mode );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   T2_Hints_FuncsRec\r\n   *\r\n   * @description:\r\n   *   The structure used to provide the API to @T2_Hints objects.\r\n   *\r\n   * @fields:\r\n   *   hints ::\r\n   *     A handle to the T2 hints recorder object.\r\n   *\r\n   *   open ::\r\n   *     The function to open a recording session.\r\n   *\r\n   *   close ::\r\n   *     The function to close a recording session.\r\n   *\r\n   *   stems ::\r\n   *     The function to set the dimension's stems table.\r\n   *\r\n   *   hintmask ::\r\n   *     The function to set hint masks.\r\n   *\r\n   *   counter ::\r\n   *     The function to set counter masks.\r\n   *\r\n   *   apply ::\r\n   *     The function to apply the hints on the corresponding glyph outline.\r\n   *\r\n   */\r\n  typedef struct  T2_Hints_FuncsRec_\r\n  {\r\n    T2_Hints              hints;\r\n    T2_Hints_OpenFunc     open;\r\n    T2_Hints_CloseFunc    close;\r\n    T2_Hints_StemsFunc    stems;\r\n    T2_Hints_MaskFunc     hintmask;\r\n    T2_Hints_CounterFunc  counter;\r\n    T2_Hints_ApplyFunc    apply;\r\n\r\n  } T2_Hints_FuncsRec;\r\n\r\n\r\n  /* */\r\n\r\n\r\n  typedef struct  PSHinter_Interface_\r\n  {\r\n    PSH_Globals_Funcs  (*get_globals_funcs)( FT_Module  module );\r\n    T1_Hints_Funcs     (*get_t1_funcs)     ( FT_Module  module );\r\n    T2_Hints_Funcs     (*get_t2_funcs)     ( FT_Module  module );\r\n\r\n  } PSHinter_Interface;\r\n\r\n  typedef PSHinter_Interface*  PSHinter_Service;\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_PSHINTER_INTERFACE(        \\\r\n          class_,                            \\\r\n          get_globals_funcs_,                \\\r\n          get_t1_funcs_,                     \\\r\n          get_t2_funcs_ )                    \\\r\n  static const PSHinter_Interface  class_ =  \\\r\n  {                                          \\\r\n    get_globals_funcs_,                      \\\r\n    get_t1_funcs_,                           \\\r\n    get_t2_funcs_                            \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_PSHINTER_INTERFACE(                      \\\r\n          class_,                                          \\\r\n          get_globals_funcs_,                              \\\r\n          get_t1_funcs_,                                   \\\r\n          get_t2_funcs_ )                                  \\\r\n  void                                                     \\\r\n  FT_Init_Class_ ## class_( FT_Library           library,  \\\r\n                            PSHinter_Interface*  clazz )   \\\r\n  {                                                        \\\r\n    FT_UNUSED( library );                                  \\\r\n                                                           \\\r\n    clazz->get_globals_funcs = get_globals_funcs_;         \\\r\n    clazz->get_t1_funcs      = get_t1_funcs_;              \\\r\n    clazz->get_t2_funcs      = get_t2_funcs_;              \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSHINTS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svbdf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svbdf.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType BDF services (specification).                           */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2009, 2012 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVBDF_H__\r\n#define __SVBDF_H__\r\n\r\n#include FT_BDF_H\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_BDF  \"bdf\"\r\n\r\n  typedef FT_Error\r\n  (*FT_BDF_GetCharsetIdFunc)( FT_Face       face,\r\n                              const char*  *acharset_encoding,\r\n                              const char*  *acharset_registry );\r\n\r\n  typedef FT_Error\r\n  (*FT_BDF_GetPropertyFunc)( FT_Face           face,\r\n                             const char*       prop_name,\r\n                             BDF_PropertyRec  *aproperty );\r\n\r\n\r\n  FT_DEFINE_SERVICE( BDF )\r\n  {\r\n    FT_BDF_GetCharsetIdFunc  get_charset_id;\r\n    FT_BDF_GetPropertyFunc   get_property;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_BDFRec( class_,                                \\\r\n                                  get_charset_id_,                       \\\r\n                                  get_property_ )                        \\\r\n  static const FT_Service_BDFRec  class_ =                               \\\r\n  {                                                                      \\\r\n    get_charset_id_, get_property_                                       \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_BDFRec( class_,                                \\\r\n                                  get_charset_id_,                       \\\r\n                                  get_property_ )                        \\\r\n  void                                                                   \\\r\n  FT_Init_Class_ ## class_( FT_Service_BDFRec*  clazz )                  \\\r\n  {                                                                      \\\r\n    clazz->get_charset_id = get_charset_id_;                             \\\r\n    clazz->get_property   = get_property_;                               \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVBDF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svcid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svcid.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType CID font services (specification).                      */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2009, 2012 by Derek Clegg, Michael Toftdal.            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVCID_H__\r\n#define __SVCID_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_CID  \"CID\"\r\n\r\n  typedef FT_Error\r\n  (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face       face,\r\n                                               const char*  *registry,\r\n                                               const char*  *ordering,\r\n                                               FT_Int       *supplement );\r\n  typedef FT_Error\r\n  (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face   face,\r\n                                         FT_Bool  *is_cid );\r\n  typedef FT_Error\r\n  (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face   face,\r\n                                      FT_UInt   glyph_index,\r\n                                      FT_UInt  *cid );\r\n\r\n  FT_DEFINE_SERVICE( CID )\r\n  {\r\n    FT_CID_GetRegistryOrderingSupplementFunc  get_ros;\r\n    FT_CID_GetIsInternallyCIDKeyedFunc        get_is_cid;\r\n    FT_CID_GetCIDFromGlyphIndexFunc           get_cid_from_glyph_index;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_CIDREC( class_,                                   \\\r\n                                  get_ros_,                                 \\\r\n                                  get_is_cid_,                              \\\r\n                                  get_cid_from_glyph_index_ )               \\\r\n  static const FT_Service_CIDRec class_ =                                   \\\r\n  {                                                                         \\\r\n    get_ros_, get_is_cid_, get_cid_from_glyph_index_                        \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_CIDREC( class_,                                   \\\r\n                                  get_ros_,                                 \\\r\n                                  get_is_cid_,                              \\\r\n                                  get_cid_from_glyph_index_ )               \\\r\n  void                                                                      \\\r\n  FT_Init_Class_ ## class_( FT_Library          library,                    \\\r\n                            FT_Service_CIDRec*  clazz )                     \\\r\n  {                                                                         \\\r\n    FT_UNUSED( library );                                                   \\\r\n                                                                            \\\r\n    clazz->get_ros                  = get_ros_;                             \\\r\n    clazz->get_is_cid               = get_is_cid_;                          \\\r\n    clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_;            \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVCID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svgldict.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svgldict.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph dictionary services (specification).              */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2009, 2012 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVGLDICT_H__\r\n#define __SVGLDICT_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  A service used to retrieve glyph names, as well as to find the\r\n   *  index of a given glyph name in a font.\r\n   *\r\n   */\r\n\r\n#define FT_SERVICE_ID_GLYPH_DICT  \"glyph-dict\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_GlyphDict_GetNameFunc)( FT_Face     face,\r\n                               FT_UInt     glyph_index,\r\n                               FT_Pointer  buffer,\r\n                               FT_UInt     buffer_max );\r\n\r\n  typedef FT_UInt\r\n  (*FT_GlyphDict_NameIndexFunc)( FT_Face     face,\r\n                                 FT_String*  glyph_name );\r\n\r\n\r\n  FT_DEFINE_SERVICE( GlyphDict )\r\n  {\r\n    FT_GlyphDict_GetNameFunc    get_name;\r\n    FT_GlyphDict_NameIndexFunc  name_index;  /* optional */\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_,                        \\\r\n                                        get_name_,                     \\\r\n                                        name_index_)                   \\\r\n  static const FT_Service_GlyphDictRec  class_ =                       \\\r\n  {                                                                    \\\r\n    get_name_, name_index_                                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_,                        \\\r\n                                        get_name_,                     \\\r\n                                        name_index_)                   \\\r\n  void                                                                 \\\r\n  FT_Init_Class_ ## class_( FT_Library                library,         \\\r\n                            FT_Service_GlyphDictRec*  clazz )          \\\r\n  {                                                                    \\\r\n    FT_UNUSED( library );                                              \\\r\n                                                                       \\\r\n    clazz->get_name   = get_name_;                                     \\\r\n    clazz->name_index = name_index_;                                   \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVGLDICT_H__ */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svgxval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svgxval.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating TrueTypeGX/AAT tables (specification).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by                                                */\r\n/*  Masatake YAMATO, Red Hat K.K.,                                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVGXVAL_H__\r\n#define __SVGXVAL_H__\r\n\r\n#include FT_GX_VALIDATE_H\r\n#include FT_INTERNAL_VALIDATE_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_GX_VALIDATE           \"truetypegx-validate\"\r\n#define FT_SERVICE_ID_CLASSICKERN_VALIDATE  \"classickern-validate\"\r\n\r\n  typedef FT_Error\r\n  (*gxv_validate_func)( FT_Face   face,\r\n                        FT_UInt   gx_flags,\r\n                        FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],\r\n                        FT_UInt   table_length );\r\n\r\n\r\n  typedef FT_Error\r\n  (*ckern_validate_func)( FT_Face   face,\r\n                          FT_UInt   ckern_flags,\r\n                          FT_Bytes  *ckern_table );\r\n\r\n\r\n  FT_DEFINE_SERVICE( GXvalidate )\r\n  {\r\n    gxv_validate_func  validate;\r\n  };\r\n\r\n  FT_DEFINE_SERVICE( CKERNvalidate )\r\n  {\r\n    ckern_validate_func  validate;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVGXVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svkern.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svkern.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType Kerning service (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2006 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVKERN_H__\r\n#define __SVKERN_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#define FT_SERVICE_ID_KERNING  \"kerning\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Kerning_TrackGetFunc)( FT_Face    face,\r\n                              FT_Fixed   point_size,\r\n                              FT_Int     degree,\r\n                              FT_Fixed*  akerning );\r\n\r\n  FT_DEFINE_SERVICE( Kerning )\r\n  {\r\n    FT_Kerning_TrackGetFunc  get_track;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVKERN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svmm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svmm.h                                                                 */\r\n/*                                                                         */\r\n/*    The FreeType Multiple Masters and GX var services (specification).   */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2009, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVMM_H__\r\n#define __SVMM_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  A service used to manage multiple-masters data in a given face.\r\n   *\r\n   *  See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).\r\n   *\r\n   */\r\n\r\n#define FT_SERVICE_ID_MULTI_MASTERS  \"multi-masters\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Get_MM_Func)( FT_Face           face,\r\n                     FT_Multi_Master*  master );\r\n\r\n  typedef FT_Error\r\n  (*FT_Get_MM_Var_Func)( FT_Face      face,\r\n                         FT_MM_Var*  *master );\r\n\r\n  typedef FT_Error\r\n  (*FT_Set_MM_Design_Func)( FT_Face   face,\r\n                            FT_UInt   num_coords,\r\n                            FT_Long*  coords );\r\n\r\n  typedef FT_Error\r\n  (*FT_Set_Var_Design_Func)( FT_Face    face,\r\n                             FT_UInt    num_coords,\r\n                             FT_Fixed*  coords );\r\n\r\n  typedef FT_Error\r\n  (*FT_Set_MM_Blend_Func)( FT_Face   face,\r\n                           FT_UInt   num_coords,\r\n                           FT_Long*  coords );\r\n\r\n\r\n  FT_DEFINE_SERVICE( MultiMasters )\r\n  {\r\n    FT_Get_MM_Func          get_mm;\r\n    FT_Set_MM_Design_Func   set_mm_design;\r\n    FT_Set_MM_Blend_Func    set_mm_blend;\r\n    FT_Get_MM_Var_Func      get_mm_var;\r\n    FT_Set_Var_Design_Func  set_var_design;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_,                          \\\r\n                                           get_mm_,                         \\\r\n                                           set_mm_design_,                  \\\r\n                                           set_mm_blend_,                   \\\r\n                                           get_mm_var_,                     \\\r\n                                           set_var_design_ )                \\\r\n  static const FT_Service_MultiMastersRec  class_ =                         \\\r\n  {                                                                         \\\r\n    get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_    \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_,                          \\\r\n                                           get_mm_,                         \\\r\n                                           set_mm_design_,                  \\\r\n                                           set_mm_blend_,                   \\\r\n                                           get_mm_var_,                     \\\r\n                                           set_var_design_ )                \\\r\n  void                                                                      \\\r\n  FT_Init_Class_ ## class_( FT_Service_MultiMastersRec*  clazz )            \\\r\n  {                                                                         \\\r\n    clazz->get_mm         = get_mm_;                                        \\\r\n    clazz->set_mm_design  = set_mm_design_;                                 \\\r\n    clazz->set_mm_blend   = set_mm_blend_;                                  \\\r\n    clazz->get_mm_var     = get_mm_var_;                                    \\\r\n    clazz->set_var_design = set_var_design_;                                \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVMM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svotval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svotval.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType OpenType validation service (specification).            */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVOTVAL_H__\r\n#define __SVOTVAL_H__\r\n\r\n#include FT_OPENTYPE_VALIDATE_H\r\n#include FT_INTERNAL_VALIDATE_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_OPENTYPE_VALIDATE  \"opentype-validate\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*otv_validate_func)( FT_Face volatile  face,\r\n                        FT_UInt           ot_flags,\r\n                        FT_Bytes         *base,\r\n                        FT_Bytes         *gdef,\r\n                        FT_Bytes         *gpos,\r\n                        FT_Bytes         *gsub,\r\n                        FT_Bytes         *jstf );\r\n\r\n\r\n  FT_DEFINE_SERVICE( OTvalidate )\r\n  {\r\n    otv_validate_func  validate;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVOTVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svpfr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpfr.h                                                                */\r\n/*                                                                         */\r\n/*    Internal PFR service functions (specification).                      */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPFR_H__\r\n#define __SVPFR_H__\r\n\r\n#include FT_PFR_H\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_PFR_METRICS  \"pfr-metrics\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_PFR_GetMetricsFunc)( FT_Face    face,\r\n                            FT_UInt   *aoutline,\r\n                            FT_UInt   *ametrics,\r\n                            FT_Fixed  *ax_scale,\r\n                            FT_Fixed  *ay_scale );\r\n\r\n  typedef FT_Error\r\n  (*FT_PFR_GetKerningFunc)( FT_Face     face,\r\n                            FT_UInt     left,\r\n                            FT_UInt     right,\r\n                            FT_Vector  *avector );\r\n\r\n  typedef FT_Error\r\n  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,\r\n                            FT_UInt   gindex,\r\n                            FT_Pos   *aadvance );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PfrMetrics )\r\n  {\r\n    FT_PFR_GetMetricsFunc  get_metrics;\r\n    FT_PFR_GetKerningFunc  get_kerning;\r\n    FT_PFR_GetAdvanceFunc  get_advance;\r\n\r\n  };\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVPFR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svpostnm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpostnm.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType PostScript name services (specification).               */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2007, 2009, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPOSTNM_H__\r\n#define __SVPOSTNM_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*\r\n   *  A trivial service used to retrieve the PostScript name of a given\r\n   *  font when available.  The `get_name' field should never be NULL.\r\n   *\r\n   *  The corresponding function can return NULL to indicate that the\r\n   *  PostScript name is not available.\r\n   *\r\n   *  The name is owned by the face and will be destroyed with it.\r\n   */\r\n\r\n#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME  \"postscript-font-name\"\r\n\r\n\r\n  typedef const char*\r\n  (*FT_PsName_GetFunc)( FT_Face  face );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PsFontName )\r\n  {\r\n    FT_PsName_GetFunc  get_ps_font_name;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \\\r\n  static const FT_Service_PsFontNameRec  class_ =                    \\\r\n  {                                                                  \\\r\n    get_ps_font_name_                                                \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \\\r\n  void                                                               \\\r\n  FT_Init_Class_ ## class_( FT_Library                 library,      \\\r\n                            FT_Service_PsFontNameRec*  clazz )       \\\r\n  {                                                                  \\\r\n    FT_UNUSED( library );                                            \\\r\n                                                                     \\\r\n    clazz->get_ps_font_name = get_ps_font_name_;                     \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPOSTNM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svprop.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svprop.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType property service (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 2012 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPROP_H__\r\n#define __SVPROP_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_PROPERTIES  \"properties\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Properties_SetFunc)( FT_Module    module,\r\n                            const char*  property_name,\r\n                            const void*  value );\r\n\r\n  typedef FT_Error\r\n  (*FT_Properties_GetFunc)( FT_Module    module,\r\n                            const char*  property_name,\r\n                            void*        value );\r\n\r\n\r\n  FT_DEFINE_SERVICE( Properties )\r\n  {\r\n    FT_Properties_SetFunc  set_property;\r\n    FT_Properties_GetFunc  get_property;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PROPERTIESREC( class_,          \\\r\n                                         set_property_,   \\\r\n                                         get_property_ )  \\\r\n  static const FT_Service_PropertiesRec  class_ =         \\\r\n  {                                                       \\\r\n    set_property_,                                        \\\r\n    get_property_                                         \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_PROPERTIESREC( class_,                \\\r\n                                         set_property_,         \\\r\n                                         get_property_ )        \\\r\n  void                                                          \\\r\n  FT_Init_Class_ ## class_( FT_Service_PropertiesRec*  clazz )  \\\r\n  {                                                             \\\r\n    clazz->set_property = set_property_;                        \\\r\n    clazz->get_property = get_property_;                        \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPROP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svpscmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpscmap.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType PostScript charmap service (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2006, 2009, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPSCMAP_H__\r\n#define __SVPSCMAP_H__\r\n\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_POSTSCRIPT_CMAPS  \"postscript-cmaps\"\r\n\r\n\r\n  /*\r\n   *  Adobe glyph name to unicode value.\r\n   */\r\n  typedef FT_UInt32\r\n  (*PS_Unicode_ValueFunc)( const char*  glyph_name );\r\n\r\n  /*\r\n   *  Macintosh name id to glyph name.  NULL if invalid index.\r\n   */\r\n  typedef const char*\r\n  (*PS_Macintosh_NameFunc)( FT_UInt  name_index );\r\n\r\n  /*\r\n   *  Adobe standard string ID to glyph name.  NULL if invalid index.\r\n   */\r\n  typedef const char*\r\n  (*PS_Adobe_Std_StringsFunc)( FT_UInt  string_index );\r\n\r\n\r\n  /*\r\n   *  Simple unicode -> glyph index charmap built from font glyph names\r\n   *  table.\r\n   */\r\n  typedef struct  PS_UniMap_\r\n  {\r\n    FT_UInt32  unicode;      /* bit 31 set: is glyph variant */\r\n    FT_UInt    glyph_index;\r\n\r\n  } PS_UniMap;\r\n\r\n\r\n  typedef struct PS_UnicodesRec_*  PS_Unicodes;\r\n\r\n  typedef struct  PS_UnicodesRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_UInt     num_maps;\r\n    PS_UniMap*  maps;\r\n\r\n  } PS_UnicodesRec;\r\n\r\n\r\n  /*\r\n   *  A function which returns a glyph name for a given index.  Returns\r\n   *  NULL if invalid index.\r\n   */\r\n  typedef const char*\r\n  (*PS_GetGlyphNameFunc)( FT_Pointer  data,\r\n                          FT_UInt     string_index );\r\n\r\n  /*\r\n   *  A function used to release the glyph name returned by\r\n   *  PS_GetGlyphNameFunc, when needed\r\n   */\r\n  typedef void\r\n  (*PS_FreeGlyphNameFunc)( FT_Pointer  data,\r\n                           const char*  name );\r\n\r\n  typedef FT_Error\r\n  (*PS_Unicodes_InitFunc)( FT_Memory             memory,\r\n                           PS_Unicodes           unicodes,\r\n                           FT_UInt               num_glyphs,\r\n                           PS_GetGlyphNameFunc   get_glyph_name,\r\n                           PS_FreeGlyphNameFunc  free_glyph_name,\r\n                           FT_Pointer            glyph_data );\r\n\r\n  typedef FT_UInt\r\n  (*PS_Unicodes_CharIndexFunc)( PS_Unicodes  unicodes,\r\n                                FT_UInt32    unicode );\r\n\r\n  typedef FT_UInt32\r\n  (*PS_Unicodes_CharNextFunc)( PS_Unicodes  unicodes,\r\n                               FT_UInt32   *unicode );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PsCMaps )\r\n  {\r\n    PS_Unicode_ValueFunc       unicode_value;\r\n\r\n    PS_Unicodes_InitFunc       unicodes_init;\r\n    PS_Unicodes_CharIndexFunc  unicodes_char_index;\r\n    PS_Unicodes_CharNextFunc   unicodes_char_next;\r\n\r\n    PS_Macintosh_NameFunc      macintosh_name;\r\n    PS_Adobe_Std_StringsFunc   adobe_std_strings;\r\n    const unsigned short*      adobe_std_encoding;\r\n    const unsigned short*      adobe_expert_encoding;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PSCMAPSREC( class_,                               \\\r\n                                      unicode_value_,                       \\\r\n                                      unicodes_init_,                       \\\r\n                                      unicodes_char_index_,                 \\\r\n                                      unicodes_char_next_,                  \\\r\n                                      macintosh_name_,                      \\\r\n                                      adobe_std_strings_,                   \\\r\n                                      adobe_std_encoding_,                  \\\r\n                                      adobe_expert_encoding_ )              \\\r\n  static const FT_Service_PsCMapsRec  class_ =                              \\\r\n  {                                                                         \\\r\n    unicode_value_, unicodes_init_,                                         \\\r\n    unicodes_char_index_, unicodes_char_next_, macintosh_name_,             \\\r\n    adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_         \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_PSCMAPSREC( class_,                               \\\r\n                                      unicode_value_,                       \\\r\n                                      unicodes_init_,                       \\\r\n                                      unicodes_char_index_,                 \\\r\n                                      unicodes_char_next_,                  \\\r\n                                      macintosh_name_,                      \\\r\n                                      adobe_std_strings_,                   \\\r\n                                      adobe_std_encoding_,                  \\\r\n                                      adobe_expert_encoding_ )              \\\r\n  void                                                                      \\\r\n  FT_Init_Class_ ## class_( FT_Library              library,                \\\r\n                            FT_Service_PsCMapsRec*  clazz )                 \\\r\n  {                                                                         \\\r\n    FT_UNUSED( library );                                                   \\\r\n                                                                            \\\r\n    clazz->unicode_value         = unicode_value_;                          \\\r\n    clazz->unicodes_init         = unicodes_init_;                          \\\r\n    clazz->unicodes_char_index   = unicodes_char_index_;                    \\\r\n    clazz->unicodes_char_next    = unicodes_char_next_;                     \\\r\n    clazz->macintosh_name        = macintosh_name_;                         \\\r\n    clazz->adobe_std_strings     = adobe_std_strings_;                      \\\r\n    clazz->adobe_std_encoding    = adobe_std_encoding_;                     \\\r\n    clazz->adobe_expert_encoding = adobe_expert_encoding_;                  \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPSCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svpsinfo.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpsinfo.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType PostScript info service (specification).                */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2009, 2011, 2012 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPSINFO_H__\r\n#define __SVPSINFO_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_POSTSCRIPT_INFO  \"postscript-info\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*PS_GetFontInfoFunc)( FT_Face          face,\r\n                         PS_FontInfoRec*  afont_info );\r\n\r\n  typedef FT_Error\r\n  (*PS_GetFontExtraFunc)( FT_Face           face,\r\n                          PS_FontExtraRec*  afont_extra );\r\n\r\n  typedef FT_Int\r\n  (*PS_HasGlyphNamesFunc)( FT_Face  face );\r\n\r\n  typedef FT_Error\r\n  (*PS_GetFontPrivateFunc)( FT_Face         face,\r\n                            PS_PrivateRec*  afont_private );\r\n\r\n  typedef FT_Long\r\n  (*PS_GetFontValueFunc)( FT_Face       face,\r\n                          PS_Dict_Keys  key,\r\n                          FT_UInt       idx,\r\n                          void         *value,\r\n                          FT_Long       value_len );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PsInfo )\r\n  {\r\n    PS_GetFontInfoFunc     ps_get_font_info;\r\n    PS_GetFontExtraFunc    ps_get_font_extra;\r\n    PS_HasGlyphNamesFunc   ps_has_glyph_names;\r\n    PS_GetFontPrivateFunc  ps_get_font_private;\r\n    PS_GetFontValueFunc    ps_get_font_value;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PSINFOREC( class_,                     \\\r\n                                     get_font_info_,             \\\r\n                                     ps_get_font_extra_,         \\\r\n                                     has_glyph_names_,           \\\r\n                                     get_font_private_,          \\\r\n                                     get_font_value_ )           \\\r\n  static const FT_Service_PsInfoRec  class_ =                    \\\r\n  {                                                              \\\r\n    get_font_info_, ps_get_font_extra_, has_glyph_names_,        \\\r\n    get_font_private_, get_font_value_                           \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_PSINFOREC( class_,                     \\\r\n                                     get_font_info_,             \\\r\n                                     ps_get_font_extra_,         \\\r\n                                     has_glyph_names_,           \\\r\n                                     get_font_private_,          \\\r\n                                     get_font_value_ )           \\\r\n  void                                                           \\\r\n  FT_Init_Class_ ## class_( FT_Library             library,      \\\r\n                            FT_Service_PsInfoRec*  clazz )       \\\r\n  {                                                              \\\r\n    FT_UNUSED( library );                                        \\\r\n                                                                 \\\r\n    clazz->ps_get_font_info    = get_font_info_;                 \\\r\n    clazz->ps_get_font_extra   = ps_get_font_extra_;             \\\r\n    clazz->ps_has_glyph_names  = has_glyph_names_;               \\\r\n    clazz->ps_get_font_private = get_font_private_;              \\\r\n    clazz->ps_get_font_value   = get_font_value_;                \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPSINFO_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svsfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svsfnt.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType SFNT table loading service (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2009, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVSFNT_H__\r\n#define __SVSFNT_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  SFNT table loading service.\r\n   */\r\n\r\n#define FT_SERVICE_ID_SFNT_TABLE  \"sfnt-table\"\r\n\r\n\r\n  /*\r\n   * Used to implement FT_Load_Sfnt_Table().\r\n   */\r\n  typedef FT_Error\r\n  (*FT_SFNT_TableLoadFunc)( FT_Face    face,\r\n                            FT_ULong   tag,\r\n                            FT_Long    offset,\r\n                            FT_Byte*   buffer,\r\n                            FT_ULong*  length );\r\n\r\n  /*\r\n   * Used to implement FT_Get_Sfnt_Table().\r\n   */\r\n  typedef void*\r\n  (*FT_SFNT_TableGetFunc)( FT_Face      face,\r\n                           FT_Sfnt_Tag  tag );\r\n\r\n\r\n  /*\r\n   * Used to implement FT_Sfnt_Table_Info().\r\n   */\r\n  typedef FT_Error\r\n  (*FT_SFNT_TableInfoFunc)( FT_Face    face,\r\n                            FT_UInt    idx,\r\n                            FT_ULong  *tag,\r\n                            FT_ULong  *offset,\r\n                            FT_ULong  *length );\r\n\r\n\r\n  FT_DEFINE_SERVICE( SFNT_Table )\r\n  {\r\n    FT_SFNT_TableLoadFunc  load_table;\r\n    FT_SFNT_TableGetFunc   get_table;\r\n    FT_SFNT_TableInfoFunc  table_info;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ )  \\\r\n  static const FT_Service_SFNT_TableRec  class_ =                      \\\r\n  {                                                                    \\\r\n    load_, get_, info_                                                 \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \\\r\n  void                                                                \\\r\n  FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec*  clazz )        \\\r\n  {                                                                   \\\r\n    clazz->load_table = load_;                                        \\\r\n    clazz->get_table  = get_;                                         \\\r\n    clazz->table_info = info_;                                        \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVSFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svttcmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svttcmap.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType TrueType/sfnt cmap extra information service.           */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  Masatake YAMATO, Redhat K.K.                                           */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2008, 2009, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/* Development of this service is support of\r\n   Information-technology Promotion Agency, Japan. */\r\n\r\n#ifndef __SVTTCMAP_H__\r\n#define __SVTTCMAP_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_TT_CMAP  \"tt-cmaps\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_CMapInfo                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to store TrueType/sfnt specific cmap information  */\r\n  /*    which is not covered by the generic @FT_CharMap structure.  This   */\r\n  /*    structure can be accessed with the @FT_Get_TT_CMap_Info function.  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    language ::                                                        */\r\n  /*      The language ID used in Mac fonts.  Definitions of values are in */\r\n  /*      freetype/ttnameid.h.                                             */\r\n  /*                                                                       */\r\n  /*    format ::                                                          */\r\n  /*      The cmap format.  OpenType 1.5 defines the formats 0 (byte       */\r\n  /*      encoding table), 2~(high-byte mapping through table), 4~(segment */\r\n  /*      mapping to delta values), 6~(trimmed table mapping), 8~(mixed    */\r\n  /*      16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented   */\r\n  /*      coverage), and 14 (Unicode Variation Sequences).                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_CMapInfo_\r\n  {\r\n    FT_ULong  language;\r\n    FT_Long   format;\r\n\r\n  } TT_CMapInfo;\r\n\r\n\r\n  typedef FT_Error\r\n  (*TT_CMap_Info_GetFunc)( FT_CharMap    charmap,\r\n                           TT_CMapInfo  *cmap_info );\r\n\r\n\r\n  FT_DEFINE_SERVICE( TTCMaps )\r\n  {\r\n    TT_CMap_Info_GetFunc  get_cmap_info;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ )  \\\r\n  static const FT_Service_TTCMapsRec  class_ =                  \\\r\n  {                                                             \\\r\n    get_cmap_info_                                              \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ )  \\\r\n  void                                                          \\\r\n  FT_Init_Class_ ## class_( FT_Library              library,    \\\r\n                            FT_Service_TTCMapsRec*  clazz )     \\\r\n  {                                                             \\\r\n    FT_UNUSED( library );                                       \\\r\n                                                                \\\r\n    clazz->get_cmap_info = get_cmap_info_;                      \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVTTCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svtteng.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svtteng.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType TrueType engine query service (specification).          */\r\n/*                                                                         */\r\n/*  Copyright 2006 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVTTENG_H__\r\n#define __SVTTENG_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  SFNT table loading service.\r\n   */\r\n\r\n#define FT_SERVICE_ID_TRUETYPE_ENGINE  \"truetype-engine\"\r\n\r\n  /*\r\n   * Used to implement FT_Get_TrueType_Engine_Type\r\n   */\r\n\r\n  FT_DEFINE_SERVICE( TrueTypeEngine )\r\n  {\r\n    FT_TrueTypeEngineType  engine_type;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVTTENG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svttglyf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svttglyf.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType TrueType glyph service.                                 */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2009, 2012 by David Turner.                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#ifndef __SVTTGLYF_H__\r\n#define __SVTTGLYF_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_TT_GLYF  \"tt-glyf\"\r\n\r\n\r\n  typedef FT_ULong\r\n  (*TT_Glyf_GetLocationFunc)( FT_Face    face,\r\n                              FT_UInt    gindex,\r\n                              FT_ULong  *psize );\r\n\r\n  FT_DEFINE_SERVICE( TTGlyf )\r\n  {\r\n    TT_Glyf_GetLocationFunc  get_location;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ )  \\\r\n  static const FT_Service_TTGlyfRec  class_ =                 \\\r\n  {                                                           \\\r\n    get_location_                                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ )  \\\r\n  void                                                        \\\r\n  FT_Init_Class_ ## class_( FT_Service_TTGlyfRec*  clazz )    \\\r\n  {                                                           \\\r\n    clazz->get_location = get_location_;                      \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVTTGLYF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svwinfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svwinfnt.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType Windows FNT/FONT service (specification).               */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVWINFNT_H__\r\n#define __SVWINFNT_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_WINFONTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_WINFNT  \"winfonts\"\r\n\r\n  typedef FT_Error\r\n  (*FT_WinFnt_GetHeaderFunc)( FT_Face               face,\r\n                              FT_WinFNT_HeaderRec  *aheader );\r\n\r\n\r\n  FT_DEFINE_SERVICE( WinFnt )\r\n  {\r\n    FT_WinFnt_GetHeaderFunc  get_header;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVWINFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/services/svxf86nm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svxf86nm.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType XFree86 services (specification only).                  */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVXF86NM_H__\r\n#define __SVXF86NM_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  A trivial service used to return the name of a face's font driver,\r\n   *  according to the XFree86 nomenclature.  Note that the service data\r\n   *  is a simple constant string pointer.\r\n   */\r\n\r\n#define FT_SERVICE_ID_XF86_NAME  \"xf86-driver-name\"\r\n\r\n#define FT_XF86_FORMAT_TRUETYPE  \"TrueType\"\r\n#define FT_XF86_FORMAT_TYPE_1    \"Type 1\"\r\n#define FT_XF86_FORMAT_BDF       \"BDF\"\r\n#define FT_XF86_FORMAT_PCF       \"PCF\"\r\n#define FT_XF86_FORMAT_TYPE_42   \"Type 42\"\r\n#define FT_XF86_FORMAT_CID       \"CID Type 1\"\r\n#define FT_XF86_FORMAT_CFF       \"CFF\"\r\n#define FT_XF86_FORMAT_PFR       \"PFR\"\r\n#define FT_XF86_FORMAT_WINFNT    \"Windows FNT\"\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVXF86NM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/sfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfnt.h                                                                 */\r\n/*                                                                         */\r\n/*    High-level `sfnt' driver interface (specification).                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2009, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SFNT_H__\r\n#define __SFNT_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Init_Face_Func                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    First part of the SFNT face object initialization.  This finds     */\r\n  /*    the face in a SFNT file or collection, and load its format tag in  */\r\n  /*    face->format_tag.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the TrueType font, if we are opening a  */\r\n  /*                  collection.                                          */\r\n  /*                                                                       */\r\n  /*    num_params :: The number of additional parameters.                 */\r\n  /*                                                                       */\r\n  /*    params     :: Optional additional parameters.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the font file's origin.               */\r\n  /*                                                                       */\r\n  /*    This function recognizes fonts embedded in a `TrueType             */\r\n  /*    collection'.                                                       */\r\n  /*                                                                       */\r\n  /*    Once the format tag has been validated by the font driver, it      */\r\n  /*    should then call the TT_Load_Face_Func() callback to read the rest */\r\n  /*    of the SFNT tables in the object.                                  */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Init_Face_Func)( FT_Stream      stream,\r\n                        TT_Face        face,\r\n                        FT_Int         face_index,\r\n                        FT_Int         num_params,\r\n                        FT_Parameter*  params );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Face_Func                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Second part of the SFNT face object initialization.  This loads    */\r\n  /*    the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the    */\r\n  /*    face object.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the TrueType font, if we are opening a  */\r\n  /*                  collection.                                          */\r\n  /*                                                                       */\r\n  /*    num_params :: The number of additional parameters.                 */\r\n  /*                                                                       */\r\n  /*    params     :: Optional additional parameters.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function must be called after TT_Init_Face_Func().            */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Face_Func)( FT_Stream      stream,\r\n                        TT_Face        face,\r\n                        FT_Int         face_index,\r\n                        FT_Int         num_params,\r\n                        FT_Parameter*  params );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Done_Face_Func                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A callback used to delete the common SFNT data from a face.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the target face object.                        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does NOT destroy the face object.                    */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*TT_Done_Face_Func)( TT_Face  face );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_SFNT_HeaderRec_Func                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the header of a SFNT font file.  Supports collections.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the TrueType font, if we are opening a  */\r\n  /*                  collection.                                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sfnt       :: The SFNT header.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the font file's origin.               */\r\n  /*                                                                       */\r\n  /*    This function recognizes fonts embedded in a `TrueType             */\r\n  /*    collection'.                                                       */\r\n  /*                                                                       */\r\n  /*    This function checks that the header is valid by looking at the    */\r\n  /*    values of `search_range', `entry_selector', and `range_shift'.     */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_SFNT_HeaderRec_Func)( TT_Face      face,\r\n                                  FT_Stream    stream,\r\n                                  FT_Long      face_index,\r\n                                  SFNT_Header  sfnt );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Directory_Func                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the table directory into a face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /*    sfnt   :: The SFNT header.                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be on the first byte after the 4-byte font  */\r\n  /*    format tag.  This is the case just after a call to                 */\r\n  /*    TT_Load_Format_Tag().                                              */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Directory_Func)( TT_Face      face,\r\n                             FT_Stream    stream,\r\n                             SFNT_Header  sfnt );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Any_Func                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load any font table into client memory.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: The face object to look for.                             */\r\n  /*                                                                       */\r\n  /*    tag    :: The tag of table to load.  Use the value 0 if you want   */\r\n  /*              to access the whole font file, else set this parameter   */\r\n  /*              to a valid TrueType table tag that you can forge with    */\r\n  /*              the MAKE_TT_TAG macro.                                   */\r\n  /*                                                                       */\r\n  /*    offset :: The starting offset in the table (or the file if         */\r\n  /*              tag == 0).                                               */\r\n  /*                                                                       */\r\n  /*    length :: The address of the decision variable:                    */\r\n  /*                                                                       */\r\n  /*                If length == NULL:                                     */\r\n  /*                  Loads the whole table.  Returns an error if          */\r\n  /*                  `offset' == 0!                                       */\r\n  /*                                                                       */\r\n  /*                If *length == 0:                                       */\r\n  /*                  Exits immediately; returning the length of the given */\r\n  /*                  table or of the font file, depending on the value of */\r\n  /*                  `tag'.                                               */\r\n  /*                                                                       */\r\n  /*                If *length != 0:                                       */\r\n  /*                  Loads the next `length' bytes of table or font,      */\r\n  /*                  starting at offset `offset' (in table or font too).  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    buffer :: The address of target buffer.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    TrueType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Any_Func)( TT_Face    face,\r\n                       FT_ULong   tag,\r\n                       FT_Long    offset,\r\n                       FT_Byte   *buffer,\r\n                       FT_ULong*  length );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Find_SBit_Image_Func                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check whether an embedded bitmap (an `sbit') exists for a given    */\r\n  /*    glyph, at a given strike.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    glyph_index   :: The glyph index.                                  */\r\n  /*                                                                       */\r\n  /*    strike_index  :: The current strike index.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    arange        :: The SBit range containing the glyph index.        */\r\n  /*                                                                       */\r\n  /*    astrike       :: The SBit strike containing the glyph index.       */\r\n  /*                                                                       */\r\n  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns                    */\r\n  /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */\r\n  /*    glyph.                                                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Find_SBit_Image_Func)( TT_Face          face,\r\n                              FT_UInt          glyph_index,\r\n                              FT_ULong         strike_index,\r\n                              TT_SBit_Range   *arange,\r\n                              TT_SBit_Strike  *astrike,\r\n                              FT_ULong        *aglyph_offset );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_SBit_Metrics_Func                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the big metrics for a given embedded bitmap.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream      :: The input stream.                                   */\r\n  /*                                                                       */\r\n  /*    range       :: The SBit range containing the glyph.                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    big_metrics :: A big SBit metrics structure for the glyph.         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be positioned at the glyph's offset within  */\r\n  /*    the `EBDT' table before the call.                                  */\r\n  /*                                                                       */\r\n  /*    If the image format uses variable metrics, the stream cursor is    */\r\n  /*    positioned just after the metrics header in the `EBDT' table on    */\r\n  /*    function exit.                                                     */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_SBit_Metrics_Func)( FT_Stream        stream,\r\n                                TT_SBit_Range    range,\r\n                                TT_SBit_Metrics  metrics );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_SBit_Image_Func                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load a given glyph sbit image from the font resource.  This also   */\r\n  /*    returns its metrics.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      The target face object.                                          */\r\n  /*                                                                       */\r\n  /*    strike_index ::                                                    */\r\n  /*      The strike index.                                                */\r\n  /*                                                                       */\r\n  /*    glyph_index ::                                                     */\r\n  /*      The current glyph index.                                         */\r\n  /*                                                                       */\r\n  /*    load_flags ::                                                      */\r\n  /*      The current load flags.                                          */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      The input stream.                                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amap ::                                                            */\r\n  /*      The target pixmap.                                               */\r\n  /*                                                                       */\r\n  /*    ametrics ::                                                        */\r\n  /*      A big sbit metrics structure for the glyph image.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    glyph sbit exists for the index.                                   */\r\n  /*                                                                       */\r\n  /*  <Note>                                                               */\r\n  /*    The `map.buffer' field is always freed before the glyph is loaded. */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_SBit_Image_Func)( TT_Face              face,\r\n                              FT_ULong             strike_index,\r\n                              FT_UInt              glyph_index,\r\n                              FT_UInt              load_flags,\r\n                              FT_Stream            stream,\r\n                              FT_Bitmap           *amap,\r\n                              TT_SBit_MetricsRec  *ametrics );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Set_SBit_Strike_OldFunc                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select an sbit strike for a given size request.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    req           :: The size request.                                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    astrike_index :: The index of the sbit strike.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    sbit strike exists for the selected ppem values.                   */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Set_SBit_Strike_OldFunc)( TT_Face    face,\r\n                                 FT_UInt    x_ppem,\r\n                                 FT_UInt    y_ppem,\r\n                                 FT_ULong*  astrike_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_CharMap_Load_Func                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads a given TrueType character map into memory.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the parent face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the current stream object.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    cmap   :: A pointer to a cmap object.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The function assumes that the stream is already in use (i.e.,      */\r\n  /*    opened).  In case of error, all partially allocated tables are     */\r\n  /*    released.                                                          */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_CharMap_Load_Func)( TT_Face    face,\r\n                           void*      cmap,\r\n                           FT_Stream  input );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_CharMap_Free_Func                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroys a character mapping table.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the parent face object.                        */\r\n  /*                                                                       */\r\n  /*    cmap :: A handle to a cmap object.                                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_CharMap_Free_Func)( TT_Face       face,\r\n                           void*         cmap );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Set_SBit_Strike_Func                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select an sbit strike for a given size request.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    req           :: The size request.                                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    astrike_index :: The index of the sbit strike.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    sbit strike exists for the selected ppem values.                   */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Set_SBit_Strike_Func)( TT_Face          face,\r\n                              FT_Size_Request  req,\r\n                              FT_ULong*        astrike_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Strike_Metrics_Func                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the metrics of a given strike.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    strike_index  :: The strike index.                                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    metrics       :: the metrics of the strike.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    such sbit strike exists.                                           */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Strike_Metrics_Func)( TT_Face           face,\r\n                                  FT_ULong          strike_index,\r\n                                  FT_Size_Metrics*  metrics );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Get_PS_Name_Func                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the PostScript glyph name of a glyph.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    idx  :: The glyph index.                                           */\r\n  /*                                                                       */\r\n  /*    PSname :: The address of a string pointer.  Will be NULL in case   */\r\n  /*              of error, otherwise it is a pointer to the glyph name.   */\r\n  /*                                                                       */\r\n  /*              You must not modify the returned string!                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Get_PS_Name_Func)( TT_Face      face,\r\n                          FT_UInt      idx,\r\n                          FT_String**  PSname );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Metrics_Func                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load a metrics table, which is a table with a horizontal and a     */\r\n  /*    vertical version.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the target face object.                    */\r\n  /*                                                                       */\r\n  /*    stream   :: The input stream.                                      */\r\n  /*                                                                       */\r\n  /*    vertical :: A boolean flag.  If set, load the vertical one.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Metrics_Func)( TT_Face    face,\r\n                           FT_Stream  stream,\r\n                           FT_Bool    vertical );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Get_Metrics_Func                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the horizontal or vertical header in a face object.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the target face object.                    */\r\n  /*                                                                       */\r\n  /*    stream   :: The input stream.                                      */\r\n  /*                                                                       */\r\n  /*    vertical :: A boolean flag.  If set, load vertical metrics.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Get_Metrics_Func)( TT_Face     face,\r\n                          FT_Bool     vertical,\r\n                          FT_UInt     gindex,\r\n                          FT_Short*   abearing,\r\n                          FT_UShort*  aadvance );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Table_Func                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load a given TrueType table.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The function uses `face->goto_table' to seek the stream to the     */\r\n  /*    start of the table, except while loading the font directory.       */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Table_Func)( TT_Face    face,\r\n                         FT_Stream  stream );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Free_Table_Func                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Free a given TrueType table.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the target face object.                        */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*TT_Free_Table_Func)( TT_Face  face );\r\n\r\n\r\n  /*\r\n   * @functype:\r\n   *    TT_Face_GetKerningFunc\r\n   *\r\n   * @description:\r\n   *    Return the horizontal kerning value between two glyphs.\r\n   *\r\n   * @input:\r\n   *    face        :: A handle to the source face object.\r\n   *    left_glyph  :: The left glyph index.\r\n   *    right_glyph :: The right glyph index.\r\n   *\r\n   * @return:\r\n   *    The kerning value in font units.\r\n   */\r\n  typedef FT_Int\r\n  (*TT_Face_GetKerningFunc)( TT_Face  face,\r\n                             FT_UInt  left_glyph,\r\n                             FT_UInt  right_glyph );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    SFNT_Interface                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure holds pointers to the functions used to load and    */\r\n  /*    free the basic tables that are required in a `sfnt' font file.     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Check the various xxx_Func() descriptions for details.             */\r\n  /*                                                                       */\r\n  typedef struct  SFNT_Interface_\r\n  {\r\n    TT_Loader_GotoTableFunc      goto_table;\r\n\r\n    TT_Init_Face_Func            init_face;\r\n    TT_Load_Face_Func            load_face;\r\n    TT_Done_Face_Func            done_face;\r\n    FT_Module_Requester          get_interface;\r\n\r\n    TT_Load_Any_Func             load_any;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_Load_SFNT_HeaderRec_Func  load_sfnt_header;\r\n    TT_Load_Directory_Func       load_directory;\r\n#endif\r\n\r\n    /* these functions are called by `load_face' but they can also  */\r\n    /* be called from external modules, if there is a need to do so */\r\n    TT_Load_Table_Func           load_head;\r\n    TT_Load_Metrics_Func         load_hhea;\r\n    TT_Load_Table_Func           load_cmap;\r\n    TT_Load_Table_Func           load_maxp;\r\n    TT_Load_Table_Func           load_os2;\r\n    TT_Load_Table_Func           load_post;\r\n\r\n    TT_Load_Table_Func           load_name;\r\n    TT_Free_Table_Func           free_name;\r\n\r\n    /* optional tables */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_Load_Table_Func           load_hdmx_stub;\r\n    TT_Free_Table_Func           free_hdmx_stub;\r\n#endif\r\n\r\n    /* this field was called `load_kerning' up to version 2.1.10 */\r\n    TT_Load_Table_Func           load_kern;\r\n\r\n    TT_Load_Table_Func           load_gasp;\r\n    TT_Load_Table_Func           load_pclt;\r\n\r\n    /* see `ttload.h'; this field was called `load_bitmap_header' up to */\r\n    /* version 2.1.10                                                   */\r\n    TT_Load_Table_Func           load_bhed;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n    /* see `ttsbit.h' */\r\n    TT_Set_SBit_Strike_OldFunc   set_sbit_strike_stub;\r\n    TT_Load_Table_Func           load_sbits_stub;\r\n\r\n    /*\r\n     *  The following two fields appeared in version 2.1.8, and were placed\r\n     *  between `load_sbits' and `load_sbit_image'.  We support them as a\r\n     *  special exception since they are used by Xfont library within the\r\n     *  X.Org xserver, and because the probability that other rogue clients\r\n     *  use the other version 2.1.7 fields below is _extremely_ low.\r\n     *\r\n     *  Note that this forces us to disable an interesting memory-saving\r\n     *  optimization though...\r\n     */\r\n\r\n    TT_Find_SBit_Image_Func      find_sbit_image;\r\n    TT_Load_SBit_Metrics_Func    load_sbit_metrics;\r\n\r\n#endif\r\n\r\n    TT_Load_SBit_Image_Func      load_sbit_image;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_Free_Table_Func           free_sbits_stub;\r\n#endif\r\n\r\n    /* see `ttpost.h' */\r\n    TT_Get_PS_Name_Func          get_psname;\r\n    TT_Free_Table_Func           free_psnames;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_CharMap_Load_Func         load_charmap_stub;\r\n    TT_CharMap_Free_Func         free_charmap_stub;\r\n#endif\r\n\r\n    /* starting here, the structure differs from version 2.1.7 */\r\n\r\n    /* this field was introduced in version 2.1.8, named `get_psname' */\r\n    TT_Face_GetKerningFunc       get_kerning;\r\n\r\n    /* new elements introduced after version 2.1.10 */\r\n\r\n    /* load the font directory, i.e., the offset table and */\r\n    /* the table directory                                 */\r\n    TT_Load_Table_Func           load_font_dir;\r\n    TT_Load_Metrics_Func         load_hmtx;\r\n\r\n    TT_Load_Table_Func           load_eblc;\r\n    TT_Free_Table_Func           free_eblc;\r\n\r\n    TT_Set_SBit_Strike_Func      set_sbit_strike;\r\n    TT_Load_Strike_Metrics_Func  load_strike_metrics;\r\n\r\n    TT_Get_Metrics_Func          get_metrics;\r\n\r\n  } SFNT_Interface;\r\n\r\n\r\n  /* transitional */\r\n  typedef SFNT_Interface*   SFNT_Service;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a )  \\\r\n          a,\r\n#else\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a )  /* empty */\r\n#endif\r\n\r\n#define FT_INTERNAL( a ) \\\r\n          a,\r\n\r\n#define FT_DEFINE_SFNT_INTERFACE(                            \\\r\n          class_,                                            \\\r\n          goto_table_,                                       \\\r\n          init_face_,                                        \\\r\n          load_face_,                                        \\\r\n          done_face_,                                        \\\r\n          get_interface_,                                    \\\r\n          load_any_,                                         \\\r\n          load_sfnt_header_,                                 \\\r\n          load_directory_,                                   \\\r\n          load_head_,                                        \\\r\n          load_hhea_,                                        \\\r\n          load_cmap_,                                        \\\r\n          load_maxp_,                                        \\\r\n          load_os2_,                                         \\\r\n          load_post_,                                        \\\r\n          load_name_,                                        \\\r\n          free_name_,                                        \\\r\n          load_hdmx_stub_,                                   \\\r\n          free_hdmx_stub_,                                   \\\r\n          load_kern_,                                        \\\r\n          load_gasp_,                                        \\\r\n          load_pclt_,                                        \\\r\n          load_bhed_,                                        \\\r\n          set_sbit_strike_stub_,                             \\\r\n          load_sbits_stub_,                                  \\\r\n          find_sbit_image_,                                  \\\r\n          load_sbit_metrics_,                                \\\r\n          load_sbit_image_,                                  \\\r\n          free_sbits_stub_,                                  \\\r\n          get_psname_,                                       \\\r\n          free_psnames_,                                     \\\r\n          load_charmap_stub_,                                \\\r\n          free_charmap_stub_,                                \\\r\n          get_kerning_,                                      \\\r\n          load_font_dir_,                                    \\\r\n          load_hmtx_,                                        \\\r\n          load_eblc_,                                        \\\r\n          free_eblc_,                                        \\\r\n          set_sbit_strike_,                                  \\\r\n          load_strike_metrics_,                              \\\r\n          get_metrics_ )                                     \\\r\n  static const SFNT_Interface  class_ =                      \\\r\n  {                                                          \\\r\n    FT_INTERNAL( goto_table_ )                               \\\r\n    FT_INTERNAL( init_face_ )                                \\\r\n    FT_INTERNAL( load_face_ )                                \\\r\n    FT_INTERNAL( done_face_ )                                \\\r\n    FT_INTERNAL( get_interface_ )                            \\\r\n    FT_INTERNAL( load_any_ )                                 \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header_ )      \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory_ )        \\\r\n    FT_INTERNAL( load_head_ )                                \\\r\n    FT_INTERNAL( load_hhea_ )                                \\\r\n    FT_INTERNAL( load_cmap_ )                                \\\r\n    FT_INTERNAL( load_maxp_ )                                \\\r\n    FT_INTERNAL( load_os2_ )                                 \\\r\n    FT_INTERNAL( load_post_ )                                \\\r\n    FT_INTERNAL( load_name_ )                                \\\r\n    FT_INTERNAL( free_name_ )                                \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub_ )        \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub_ )        \\\r\n    FT_INTERNAL( load_kern_ )                                \\\r\n    FT_INTERNAL( load_gasp_ )                                \\\r\n    FT_INTERNAL( load_pclt_ )                                \\\r\n    FT_INTERNAL( load_bhed_ )                                \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub_ )  \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub_ )       \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image_ )       \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics_ )     \\\r\n    FT_INTERNAL( load_sbit_image_ )                          \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub_ )       \\\r\n    FT_INTERNAL( get_psname_ )                               \\\r\n    FT_INTERNAL( free_psnames_ )                             \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub_ )     \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub_ )     \\\r\n    FT_INTERNAL( get_kerning_ )                              \\\r\n    FT_INTERNAL( load_font_dir_ )                            \\\r\n    FT_INTERNAL( load_hmtx_ )                                \\\r\n    FT_INTERNAL( load_eblc_ )                                \\\r\n    FT_INTERNAL( free_eblc_ )                                \\\r\n    FT_INTERNAL( set_sbit_strike_ )                          \\\r\n    FT_INTERNAL( load_strike_metrics_ )                      \\\r\n    FT_INTERNAL( get_metrics_ )                              \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ )  \\\r\n          clazz->a = a_;\r\n#else\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ )  /* empty */\r\n#endif\r\n\r\n#define FT_INTERNAL( a, a_ )  \\\r\n          clazz->a = a_;\r\n\r\n#define FT_DEFINE_SFNT_INTERFACE(                             \\\r\n          class_,                                             \\\r\n          goto_table_,                                        \\\r\n          init_face_,                                         \\\r\n          load_face_,                                         \\\r\n          done_face_,                                         \\\r\n          get_interface_,                                     \\\r\n          load_any_,                                          \\\r\n          load_sfnt_header_,                                  \\\r\n          load_directory_,                                    \\\r\n          load_head_,                                         \\\r\n          load_hhea_,                                         \\\r\n          load_cmap_,                                         \\\r\n          load_maxp_,                                         \\\r\n          load_os2_,                                          \\\r\n          load_post_,                                         \\\r\n          load_name_,                                         \\\r\n          free_name_,                                         \\\r\n          load_hdmx_stub_,                                    \\\r\n          free_hdmx_stub_,                                    \\\r\n          load_kern_,                                         \\\r\n          load_gasp_,                                         \\\r\n          load_pclt_,                                         \\\r\n          load_bhed_,                                         \\\r\n          set_sbit_strike_stub_,                              \\\r\n          load_sbits_stub_,                                   \\\r\n          find_sbit_image_,                                   \\\r\n          load_sbit_metrics_,                                 \\\r\n          load_sbit_image_,                                   \\\r\n          free_sbits_stub_,                                   \\\r\n          get_psname_,                                        \\\r\n          free_psnames_,                                      \\\r\n          load_charmap_stub_,                                 \\\r\n          free_charmap_stub_,                                 \\\r\n          get_kerning_,                                       \\\r\n          load_font_dir_,                                     \\\r\n          load_hmtx_,                                         \\\r\n          load_eblc_,                                         \\\r\n          free_eblc_,                                         \\\r\n          set_sbit_strike_,                                   \\\r\n          load_strike_metrics_,                               \\\r\n          get_metrics_ )                                      \\\r\n  void                                                        \\\r\n  FT_Init_Class_ ## class_( FT_Library       library,         \\\r\n                            SFNT_Interface*  clazz )          \\\r\n  {                                                           \\\r\n    FT_UNUSED( library );                                     \\\r\n                                                              \\\r\n    FT_INTERNAL( goto_table, goto_table_ )                    \\\r\n    FT_INTERNAL( init_face, init_face_ )                      \\\r\n    FT_INTERNAL( load_face, load_face_ )                      \\\r\n    FT_INTERNAL( done_face, done_face_ )                      \\\r\n    FT_INTERNAL( get_interface, get_interface_ )              \\\r\n    FT_INTERNAL( load_any, load_any_ )                        \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header,         \\\r\n                                    load_sfnt_header_ )       \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory,           \\\r\n                                    load_directory_ )         \\\r\n    FT_INTERNAL( load_head, load_head_ )                      \\\r\n    FT_INTERNAL( load_hhea, load_hhea_ )                      \\\r\n    FT_INTERNAL( load_cmap, load_cmap_ )                      \\\r\n    FT_INTERNAL( load_maxp, load_maxp_ )                      \\\r\n    FT_INTERNAL( load_os2, load_os2_ )                        \\\r\n    FT_INTERNAL( load_post, load_post_ )                      \\\r\n    FT_INTERNAL( load_name, load_name_ )                      \\\r\n    FT_INTERNAL( free_name, free_name_ )                      \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub,           \\\r\n                                    load_hdmx_stub_ )         \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub,           \\\r\n                                    free_hdmx_stub_ )         \\\r\n    FT_INTERNAL( load_kern, load_kern_ )                      \\\r\n    FT_INTERNAL( load_gasp, load_gasp_ )                      \\\r\n    FT_INTERNAL( load_pclt, load_pclt_ )                      \\\r\n    FT_INTERNAL( load_bhed, load_bhed_ )                      \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub,     \\\r\n                                    set_sbit_strike_stub_ )   \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub,          \\\r\n                                    load_sbits_stub_ )        \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image,          \\\r\n                                    find_sbit_image_ )        \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics,        \\\r\n                                    load_sbit_metrics_ )      \\\r\n    FT_INTERNAL( load_sbit_image, load_sbit_image_ )          \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub,          \\\r\n                                    free_sbits_stub_ )        \\\r\n    FT_INTERNAL( get_psname, get_psname_ )                    \\\r\n    FT_INTERNAL( free_psnames, free_psnames_ )                \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub,        \\\r\n                                    load_charmap_stub_ )      \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub,        \\\r\n                                    free_charmap_stub_ )      \\\r\n    FT_INTERNAL( get_kerning, get_kerning_ )                  \\\r\n    FT_INTERNAL( load_font_dir, load_font_dir_ )              \\\r\n    FT_INTERNAL( load_hmtx, load_hmtx_ )                      \\\r\n    FT_INTERNAL( load_eblc, load_eblc_ )                      \\\r\n    FT_INTERNAL( free_eblc, free_eblc_ )                      \\\r\n    FT_INTERNAL( set_sbit_strike, set_sbit_strike_ )          \\\r\n    FT_INTERNAL( load_strike_metrics, load_strike_metrics_ )  \\\r\n    FT_INTERNAL( get_metrics, get_metrics_ )                  \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/t1types.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1types.h                                                              */\r\n/*                                                                         */\r\n/*    Basic Type1/Type2 type definitions and interface (specification      */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006, 2008, 2009, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1TYPES_H__\r\n#define __T1TYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TYPE1_TABLES_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***              REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS              ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_EncodingRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling a custom encoding.                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_chars  :: The number of character codes in the encoding.       */\r\n  /*                  Usually 256.                                         */\r\n  /*                                                                       */\r\n  /*    code_first :: The lowest valid character code in the encoding.     */\r\n  /*                                                                       */\r\n  /*    code_last  :: The highest valid character code in the encoding     */\r\n  /*                  + 1. When equal to code_first there are no valid     */\r\n  /*                  character codes.                                     */\r\n  /*                                                                       */\r\n  /*    char_index :: An array of corresponding glyph indices.             */\r\n  /*                                                                       */\r\n  /*    char_name  :: An array of corresponding glyph names.               */\r\n  /*                                                                       */\r\n  typedef struct  T1_EncodingRecRec_\r\n  {\r\n    FT_Int       num_chars;\r\n    FT_Int       code_first;\r\n    FT_Int       code_last;\r\n\r\n    FT_UShort*   char_index;\r\n    FT_String**  char_name;\r\n\r\n  } T1_EncodingRec, *T1_Encoding;\r\n\r\n\r\n  /* used to hold extra data of PS_FontInfoRec that\r\n   * cannot be stored in the publicly defined structure.\r\n   *\r\n   * Note these can't be blended with multiple-masters.\r\n   */\r\n  typedef struct  PS_FontExtraRec_\r\n  {\r\n    FT_UShort  fs_type;\r\n\r\n  } PS_FontExtraRec;\r\n\r\n\r\n  typedef struct  T1_FontRec_\r\n  {\r\n    PS_FontInfoRec   font_info;         /* font info dictionary   */\r\n    PS_FontExtraRec  font_extra;        /* font info extra fields */\r\n    PS_PrivateRec    private_dict;      /* private dictionary     */\r\n    FT_String*       font_name;         /* top-level dictionary   */\r\n\r\n    T1_EncodingType  encoding_type;\r\n    T1_EncodingRec   encoding;\r\n\r\n    FT_Byte*         subrs_block;\r\n    FT_Byte*         charstrings_block;\r\n    FT_Byte*         glyph_names_block;\r\n\r\n    FT_Int           num_subrs;\r\n    FT_Byte**        subrs;\r\n    FT_PtrDist*      subrs_len;\r\n\r\n    FT_Int           num_glyphs;\r\n    FT_String**      glyph_names;       /* array of glyph names       */\r\n    FT_Byte**        charstrings;       /* array of glyph charstrings */\r\n    FT_PtrDist*      charstrings_len;\r\n\r\n    FT_Byte          paint_type;\r\n    FT_Byte          font_type;\r\n    FT_Matrix        font_matrix;\r\n    FT_Vector        font_offset;\r\n    FT_BBox          font_bbox;\r\n    FT_Long          font_id;\r\n\r\n    FT_Fixed         stroke_width;\r\n\r\n  } T1_FontRec, *T1_Font;\r\n\r\n\r\n  typedef struct  CID_SubrsRec_\r\n  {\r\n    FT_UInt    num_subrs;\r\n    FT_Byte**  code;\r\n\r\n  } CID_SubrsRec, *CID_Subrs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                AFM FONT INFORMATION STRUCTURES                    ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  AFM_TrackKernRec_\r\n  {\r\n    FT_Int    degree;\r\n    FT_Fixed  min_ptsize;\r\n    FT_Fixed  min_kern;\r\n    FT_Fixed  max_ptsize;\r\n    FT_Fixed  max_kern;\r\n\r\n  } AFM_TrackKernRec, *AFM_TrackKern;\r\n\r\n  typedef struct  AFM_KernPairRec_\r\n  {\r\n    FT_Int  index1;\r\n    FT_Int  index2;\r\n    FT_Int  x;\r\n    FT_Int  y;\r\n\r\n  } AFM_KernPairRec, *AFM_KernPair;\r\n\r\n  typedef struct  AFM_FontInfoRec_\r\n  {\r\n    FT_Bool        IsCIDFont;\r\n    FT_BBox        FontBBox;\r\n    FT_Fixed       Ascender;\r\n    FT_Fixed       Descender;\r\n    AFM_TrackKern  TrackKerns;   /* free if non-NULL */\r\n    FT_Int         NumTrackKern;\r\n    AFM_KernPair   KernPairs;    /* free if non-NULL */\r\n    FT_Int         NumKernPair;\r\n\r\n  } AFM_FontInfoRec, *AFM_FontInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                ORIGINAL T1_FACE CLASS DEFINITION                  ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct T1_FaceRec_*   T1_Face;\r\n  typedef struct CID_FaceRec_*  CID_Face;\r\n\r\n\r\n  typedef struct  T1_FaceRec_\r\n  {\r\n    FT_FaceRec      root;\r\n    T1_FontRec      type1;\r\n    const void*     psnames;\r\n    const void*     psaux;\r\n    const void*     afm_data;\r\n    FT_CharMapRec   charmaprecs[2];\r\n    FT_CharMap      charmaps[2];\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    PS_Unicodes     unicode_map;\r\n#endif\r\n\r\n    /* support for Multiple Masters fonts */\r\n    PS_Blend        blend;\r\n\r\n    /* undocumented, optional: indices of subroutines that express      */\r\n    /* the NormalizeDesignVector and the ConvertDesignVector procedure, */\r\n    /* respectively, as Type 2 charstrings; -1 if keywords not present  */\r\n    FT_Int           ndv_idx;\r\n    FT_Int           cdv_idx;\r\n\r\n    /* undocumented, optional: has the same meaning as len_buildchar */\r\n    /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25    */\r\n    FT_UInt          len_buildchar;\r\n    FT_Long*         buildchar;\r\n\r\n    /* since version 2.1 - interface to PostScript hinter */\r\n    const void*     pshinter;\r\n\r\n  } T1_FaceRec;\r\n\r\n\r\n  typedef struct  CID_FaceRec_\r\n  {\r\n    FT_FaceRec       root;\r\n    void*            psnames;\r\n    void*            psaux;\r\n    CID_FaceInfoRec  cid;\r\n    PS_FontExtraRec  font_extra;\r\n#if 0\r\n    void*            afm_data;\r\n#endif\r\n    CID_Subrs        subrs;\r\n\r\n    /* since version 2.1 - interface to PostScript hinter */\r\n    void*            pshinter;\r\n\r\n    /* since version 2.1.8, but was originally positioned after `afm_data' */\r\n    FT_Byte*         binary_data; /* used if hex data has been converted */\r\n    FT_Stream        cid_stream;\r\n\r\n  } CID_FaceRec;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1TYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/internal/tttypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tttypes.h                                                              */\r\n/*                                                                         */\r\n/*    Basic SFNT/TrueType type definitions and interface (specification    */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2004-2008, 2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTTYPES_H__\r\n#define __TTTYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include FT_MULTIPLE_MASTERS_H\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***             REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TTC_HeaderRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    TrueType collection header.  This table contains the offsets of    */\r\n  /*    the font headers of each distinct TrueType face in the file.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    tag     :: Must be `ttc ' to indicate a TrueType collection.       */\r\n  /*                                                                       */\r\n  /*    version :: The version number.                                     */\r\n  /*                                                                       */\r\n  /*    count   :: The number of faces in the collection.  The             */\r\n  /*               specification says this should be an unsigned long, but */\r\n  /*               we use a signed long since we need the value -1 for     */\r\n  /*               specific purposes.                                      */\r\n  /*                                                                       */\r\n  /*    offsets :: The offsets of the font headers, one per face.          */\r\n  /*                                                                       */\r\n  typedef struct  TTC_HeaderRec_\r\n  {\r\n    FT_ULong   tag;\r\n    FT_Fixed   version;\r\n    FT_Long    count;\r\n    FT_ULong*  offsets;\r\n\r\n  } TTC_HeaderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    SFNT_HeaderRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    SFNT file format header.                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    format_tag     :: The font format tag.                             */\r\n  /*                                                                       */\r\n  /*    num_tables     :: The number of tables in file.                    */\r\n  /*                                                                       */\r\n  /*    search_range   :: Must be `16 * (max power of 2 <= num_tables)'.   */\r\n  /*                                                                       */\r\n  /*    entry_selector :: Must be log2 of `search_range / 16'.             */\r\n  /*                                                                       */\r\n  /*    range_shift    :: Must be `num_tables * 16 - search_range'.        */\r\n  /*                                                                       */\r\n  typedef struct  SFNT_HeaderRec_\r\n  {\r\n    FT_ULong   format_tag;\r\n    FT_UShort  num_tables;\r\n    FT_UShort  search_range;\r\n    FT_UShort  entry_selector;\r\n    FT_UShort  range_shift;\r\n\r\n    FT_ULong   offset;  /* not in file */\r\n\r\n  } SFNT_HeaderRec, *SFNT_Header;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_TableRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure describes a given table of a TrueType font.         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Tag      :: A four-bytes tag describing the table.                 */\r\n  /*                                                                       */\r\n  /*    CheckSum :: The table checksum.  This value can be ignored.        */\r\n  /*                                                                       */\r\n  /*    Offset   :: The offset of the table from the start of the TrueType */\r\n  /*                font in its resource.                                  */\r\n  /*                                                                       */\r\n  /*    Length   :: The table length (in bytes).                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_TableRec_\r\n  {\r\n    FT_ULong  Tag;        /*        table type */\r\n    FT_ULong  CheckSum;   /*    table checksum */\r\n    FT_ULong  Offset;     /* table file offset */\r\n    FT_ULong  Length;     /*      table length */\r\n\r\n  } TT_TableRec, *TT_Table;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_LongMetricsRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling the long metrics of the `hmtx' and `vmtx'     */\r\n  /*    TrueType tables.  The values are expressed in font units.          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    advance :: The advance width or height for the glyph.              */\r\n  /*                                                                       */\r\n  /*    bearing :: The left-side or top-side bearing for the glyph.        */\r\n  /*                                                                       */\r\n  typedef struct  TT_LongMetricsRec_\r\n  {\r\n    FT_UShort  advance;\r\n    FT_Short   bearing;\r\n\r\n  } TT_LongMetricsRec, *TT_LongMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_ShortMetrics                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple type to model the short metrics of the `hmtx' and `vmtx'  */\r\n  /*    tables.                                                            */\r\n  /*                                                                       */\r\n  typedef FT_Short  TT_ShortMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_NameEntryRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling TrueType name records.  Name records are used */\r\n  /*    to store important strings like family name, style name,           */\r\n  /*    copyright, etc. in _localized_ versions (i.e., language, encoding, */\r\n  /*    etc).                                                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    platformID   :: The ID of the name's encoding platform.            */\r\n  /*                                                                       */\r\n  /*    encodingID   :: The platform-specific ID for the name's encoding.  */\r\n  /*                                                                       */\r\n  /*    languageID   :: The platform-specific ID for the name's language.  */\r\n  /*                                                                       */\r\n  /*    nameID       :: The ID specifying what kind of name this is.       */\r\n  /*                                                                       */\r\n  /*    stringLength :: The length of the string in bytes.                 */\r\n  /*                                                                       */\r\n  /*    stringOffset :: The offset to the string in the `name' table.      */\r\n  /*                                                                       */\r\n  /*    string       :: A pointer to the string's bytes.  Note that these  */\r\n  /*                    are usually UTF-16 encoded characters.             */\r\n  /*                                                                       */\r\n  typedef struct  TT_NameEntryRec_\r\n  {\r\n    FT_UShort  platformID;\r\n    FT_UShort  encodingID;\r\n    FT_UShort  languageID;\r\n    FT_UShort  nameID;\r\n    FT_UShort  stringLength;\r\n    FT_ULong   stringOffset;\r\n\r\n    /* this last field is not defined in the spec */\r\n    /* but used by the FreeType engine            */\r\n\r\n    FT_Byte*   string;\r\n\r\n  } TT_NameEntryRec, *TT_NameEntry;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_NameTableRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling the TrueType name table.                      */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    format         :: The format of the name table.                    */\r\n  /*                                                                       */\r\n  /*    numNameRecords :: The number of names in table.                    */\r\n  /*                                                                       */\r\n  /*    storageOffset  :: The offset of the name table in the `name'       */\r\n  /*                      TrueType table.                                  */\r\n  /*                                                                       */\r\n  /*    names          :: An array of name records.                        */\r\n  /*                                                                       */\r\n  /*    stream         :: the file's input stream.                         */\r\n  /*                                                                       */\r\n  typedef struct  TT_NameTableRec_\r\n  {\r\n    FT_UShort         format;\r\n    FT_UInt           numNameRecords;\r\n    FT_UInt           storageOffset;\r\n    TT_NameEntryRec*  names;\r\n    FT_Stream         stream;\r\n\r\n  } TT_NameTableRec, *TT_NameTable;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***             OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_GaspRangeRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A tiny structure used to model a gasp range according to the       */\r\n  /*    TrueType specification.                                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    maxPPEM  :: The maximum ppem value to which `gaspFlag' applies.    */\r\n  /*                                                                       */\r\n  /*    gaspFlag :: A flag describing the grid-fitting and anti-aliasing   */\r\n  /*                modes to be used.                                      */\r\n  /*                                                                       */\r\n  typedef struct  TT_GaspRangeRec_\r\n  {\r\n    FT_UShort  maxPPEM;\r\n    FT_UShort  gaspFlag;\r\n\r\n  } TT_GaspRangeRec, *TT_GaspRange;\r\n\r\n\r\n#define TT_GASP_GRIDFIT  0x01\r\n#define TT_GASP_DOGRAY   0x02\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_GaspRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling the TrueType `gasp' table used to specify     */\r\n  /*    grid-fitting and anti-aliasing behaviour.                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    version    :: The version number.                                  */\r\n  /*                                                                       */\r\n  /*    numRanges  :: The number of gasp ranges in table.                  */\r\n  /*                                                                       */\r\n  /*    gaspRanges :: An array of gasp ranges.                             */\r\n  /*                                                                       */\r\n  typedef struct  TT_Gasp_\r\n  {\r\n    FT_UShort     version;\r\n    FT_UShort     numRanges;\r\n    TT_GaspRange  gaspRanges;\r\n\r\n  } TT_GaspRec;\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_HdmxEntryRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A small structure used to model the pre-computed widths of a given */\r\n  /*    size.  They are found in the `hdmx' table.                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    ppem      :: The pixels per EM value at which these metrics apply. */\r\n  /*                                                                       */\r\n  /*    max_width :: The maximum advance width for this metric.            */\r\n  /*                                                                       */\r\n  /*    widths    :: An array of widths.  Note: These are 8-bit bytes.     */\r\n  /*                                                                       */\r\n  typedef struct  TT_HdmxEntryRec_\r\n  {\r\n    FT_Byte   ppem;\r\n    FT_Byte   max_width;\r\n    FT_Byte*  widths;\r\n\r\n  } TT_HdmxEntryRec, *TT_HdmxEntry;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_HdmxRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the `hdmx' table, which contains         */\r\n  /*    pre-computed widths for a set of given sizes/dimensions.           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    version     :: The version number.                                 */\r\n  /*                                                                       */\r\n  /*    num_records :: The number of hdmx records.                         */\r\n  /*                                                                       */\r\n  /*    records     :: An array of hdmx records.                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_HdmxRec_\r\n  {\r\n    FT_UShort     version;\r\n    FT_Short      num_records;\r\n    TT_HdmxEntry  records;\r\n\r\n  } TT_HdmxRec, *TT_Hdmx;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Kern0_PairRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a kerning pair for the kerning table     */\r\n  /*    format 0.  The engine now loads this table if it finds one in the  */\r\n  /*    font file.                                                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    left  :: The index of the left glyph in pair.                      */\r\n  /*                                                                       */\r\n  /*    right :: The index of the right glyph in pair.                     */\r\n  /*                                                                       */\r\n  /*    value :: The kerning distance.  A positive value spaces the        */\r\n  /*             glyphs, a negative one makes them closer.                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_Kern0_PairRec_\r\n  {\r\n    FT_UShort  left;   /* index of left  glyph in pair */\r\n    FT_UShort  right;  /* index of right glyph in pair */\r\n    FT_FWord   value;  /* kerning value                */\r\n\r\n  } TT_Kern0_PairRec, *TT_Kern0_Pair;\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                    EMBEDDED BITMAPS SUPPORT                       ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_MetricsRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold the big metrics of a given glyph bitmap   */\r\n  /*    in a TrueType or OpenType font.  These are usually found in the    */\r\n  /*    `EBDT' (Microsoft) or `bloc' (Apple) table.                        */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    height       :: The glyph height in pixels.                        */\r\n  /*                                                                       */\r\n  /*    width        :: The glyph width in pixels.                         */\r\n  /*                                                                       */\r\n  /*    horiBearingX :: The horizontal left bearing.                       */\r\n  /*                                                                       */\r\n  /*    horiBearingY :: The horizontal top bearing.                        */\r\n  /*                                                                       */\r\n  /*    horiAdvance  :: The horizontal advance.                            */\r\n  /*                                                                       */\r\n  /*    vertBearingX :: The vertical left bearing.                         */\r\n  /*                                                                       */\r\n  /*    vertBearingY :: The vertical top bearing.                          */\r\n  /*                                                                       */\r\n  /*    vertAdvance  :: The vertical advance.                              */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_MetricsRec_\r\n  {\r\n    FT_Byte  height;\r\n    FT_Byte  width;\r\n\r\n    FT_Char  horiBearingX;\r\n    FT_Char  horiBearingY;\r\n    FT_Byte  horiAdvance;\r\n\r\n    FT_Char  vertBearingX;\r\n    FT_Char  vertBearingY;\r\n    FT_Byte  vertAdvance;\r\n\r\n  } TT_SBit_MetricsRec, *TT_SBit_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_SmallMetricsRec                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold the small metrics of a given glyph bitmap */\r\n  /*    in a TrueType or OpenType font.  These are usually found in the    */\r\n  /*    `EBDT' (Microsoft) or the `bdat' (Apple) table.                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    height   :: The glyph height in pixels.                            */\r\n  /*                                                                       */\r\n  /*    width    :: The glyph width in pixels.                             */\r\n  /*                                                                       */\r\n  /*    bearingX :: The left-side bearing.                                 */\r\n  /*                                                                       */\r\n  /*    bearingY :: The top-side bearing.                                  */\r\n  /*                                                                       */\r\n  /*    advance  :: The advance width or height.                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_Small_Metrics_\r\n  {\r\n    FT_Byte  height;\r\n    FT_Byte  width;\r\n\r\n    FT_Char  bearingX;\r\n    FT_Char  bearingY;\r\n    FT_Byte  advance;\r\n\r\n  } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_LineMetricsRec                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to describe the text line metrics of a given      */\r\n  /*    bitmap strike, for either a horizontal or vertical layout.         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    ascender                :: The ascender in pixels.                 */\r\n  /*                                                                       */\r\n  /*    descender               :: The descender in pixels.                */\r\n  /*                                                                       */\r\n  /*    max_width               :: The maximum glyph width in pixels.      */\r\n  /*                                                                       */\r\n  /*    caret_slope_enumerator  :: Rise of the caret slope, typically set  */\r\n  /*                               to 1 for non-italic fonts.              */\r\n  /*                                                                       */\r\n  /*    caret_slope_denominator :: Rise of the caret slope, typically set  */\r\n  /*                               to 0 for non-italic fonts.              */\r\n  /*                                                                       */\r\n  /*    caret_offset            :: Offset in pixels to move the caret for  */\r\n  /*                               proper positioning.                     */\r\n  /*                                                                       */\r\n  /*    min_origin_SB           :: Minimum of horiBearingX (resp.          */\r\n  /*                               vertBearingY).                          */\r\n  /*    min_advance_SB          :: Minimum of                              */\r\n  /*                                                                       */\r\n  /*                                 horizontal advance -                  */\r\n  /*                                   ( horiBearingX + width )            */\r\n  /*                                                                       */\r\n  /*                               resp.                                   */\r\n  /*                                                                       */\r\n  /*                                 vertical advance -                    */\r\n  /*                                   ( vertBearingY + height )           */\r\n  /*                                                                       */\r\n  /*    max_before_BL           :: Maximum of horiBearingY (resp.          */\r\n  /*                               vertBearingY).                          */\r\n  /*                                                                       */\r\n  /*    min_after_BL            :: Minimum of                              */\r\n  /*                                                                       */\r\n  /*                                 horiBearingY - height                 */\r\n  /*                                                                       */\r\n  /*                               resp.                                   */\r\n  /*                                                                       */\r\n  /*                                 vertBearingX - width                  */\r\n  /*                                                                       */\r\n  /*    pads                    :: Unused (to make the size of the record  */\r\n  /*                               a multiple of 32 bits.                  */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_LineMetricsRec_\r\n  {\r\n    FT_Char  ascender;\r\n    FT_Char  descender;\r\n    FT_Byte  max_width;\r\n    FT_Char  caret_slope_numerator;\r\n    FT_Char  caret_slope_denominator;\r\n    FT_Char  caret_offset;\r\n    FT_Char  min_origin_SB;\r\n    FT_Char  min_advance_SB;\r\n    FT_Char  max_before_BL;\r\n    FT_Char  min_after_BL;\r\n    FT_Char  pads[2];\r\n\r\n  } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_RangeRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A TrueType/OpenType subIndexTable as defined in the `EBLC'         */\r\n  /*    (Microsoft) or `bloc' (Apple) tables.                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    first_glyph   :: The first glyph index in the range.               */\r\n  /*                                                                       */\r\n  /*    last_glyph    :: The last glyph index in the range.                */\r\n  /*                                                                       */\r\n  /*    index_format  :: The format of index table.  Valid values are 1    */\r\n  /*                     to 5.                                             */\r\n  /*                                                                       */\r\n  /*    image_format  :: The format of `EBDT' image data.                  */\r\n  /*                                                                       */\r\n  /*    image_offset  :: The offset to image data in `EBDT'.               */\r\n  /*                                                                       */\r\n  /*    image_size    :: For index formats 2 and 5.  This is the size in   */\r\n  /*                     bytes of each glyph bitmap.                       */\r\n  /*                                                                       */\r\n  /*    big_metrics   :: For index formats 2 and 5.  This is the big       */\r\n  /*                     metrics for each glyph bitmap.                    */\r\n  /*                                                                       */\r\n  /*    num_glyphs    :: For index formats 4 and 5.  This is the number of */\r\n  /*                     glyphs in the code array.                         */\r\n  /*                                                                       */\r\n  /*    glyph_offsets :: For index formats 1 and 3.                        */\r\n  /*                                                                       */\r\n  /*    glyph_codes   :: For index formats 4 and 5.                        */\r\n  /*                                                                       */\r\n  /*    table_offset  :: The offset of the index table in the `EBLC'       */\r\n  /*                     table.  Only used during strike loading.          */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_RangeRec_\r\n  {\r\n    FT_UShort           first_glyph;\r\n    FT_UShort           last_glyph;\r\n\r\n    FT_UShort           index_format;\r\n    FT_UShort           image_format;\r\n    FT_ULong            image_offset;\r\n\r\n    FT_ULong            image_size;\r\n    TT_SBit_MetricsRec  metrics;\r\n    FT_ULong            num_glyphs;\r\n\r\n    FT_ULong*           glyph_offsets;\r\n    FT_UShort*          glyph_codes;\r\n\r\n    FT_ULong            table_offset;\r\n\r\n  } TT_SBit_RangeRec, *TT_SBit_Range;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_StrikeRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used describe a given bitmap strike in the `EBLC'      */\r\n  /*    (Microsoft) or `bloc' (Apple) tables.                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*   num_index_ranges :: The number of index ranges.                     */\r\n  /*                                                                       */\r\n  /*   index_ranges     :: An array of glyph index ranges.                 */\r\n  /*                                                                       */\r\n  /*   color_ref        :: Unused.  `color_ref' is put in for future       */\r\n  /*                       enhancements, but these fields are already      */\r\n  /*                       in use by other platforms (e.g. Newton).        */\r\n  /*                       For details, please see                         */\r\n  /*                                                                       */\r\n  /*                         http://fonts.apple.com/                       */\r\n  /*                                TTRefMan/RM06/Chap6bloc.html           */\r\n  /*                                                                       */\r\n  /*   hori             :: The line metrics for horizontal layouts.        */\r\n  /*                                                                       */\r\n  /*   vert             :: The line metrics for vertical layouts.          */\r\n  /*                                                                       */\r\n  /*   start_glyph      :: The lowest glyph index for this strike.         */\r\n  /*                                                                       */\r\n  /*   end_glyph        :: The highest glyph index for this strike.        */\r\n  /*                                                                       */\r\n  /*   x_ppem           :: The number of horizontal pixels per EM.         */\r\n  /*                                                                       */\r\n  /*   y_ppem           :: The number of vertical pixels per EM.           */\r\n  /*                                                                       */\r\n  /*   bit_depth        :: The bit depth.  Valid values are 1, 2, 4,       */\r\n  /*                       and 8.                                          */\r\n  /*                                                                       */\r\n  /*   flags            :: Is this a vertical or horizontal strike?  For   */\r\n  /*                       details, please see                             */\r\n  /*                                                                       */\r\n  /*                         http://fonts.apple.com/                       */\r\n  /*                                TTRefMan/RM06/Chap6bloc.html           */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_StrikeRec_\r\n  {\r\n    FT_Int                  num_ranges;\r\n    TT_SBit_Range           sbit_ranges;\r\n    FT_ULong                ranges_offset;\r\n\r\n    FT_ULong                color_ref;\r\n\r\n    TT_SBit_LineMetricsRec  hori;\r\n    TT_SBit_LineMetricsRec  vert;\r\n\r\n    FT_UShort               start_glyph;\r\n    FT_UShort               end_glyph;\r\n\r\n    FT_Byte                 x_ppem;\r\n    FT_Byte                 y_ppem;\r\n\r\n    FT_Byte                 bit_depth;\r\n    FT_Char                 flags;\r\n\r\n  } TT_SBit_StrikeRec, *TT_SBit_Strike;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_ComponentRec                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure to describe a compound sbit element.            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    glyph_code :: The element's glyph index.                           */\r\n  /*                                                                       */\r\n  /*    x_offset   :: The element's left bearing.                          */\r\n  /*                                                                       */\r\n  /*    y_offset   :: The element's top bearing.                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_ComponentRec_\r\n  {\r\n    FT_UShort  glyph_code;\r\n    FT_Char    x_offset;\r\n    FT_Char    y_offset;\r\n\r\n  } TT_SBit_ComponentRec, *TT_SBit_Component;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_ScaleRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used describe a given bitmap scaling table, as defined */\r\n  /*    in the `EBSC' table.                                               */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    hori              :: The horizontal line metrics.                  */\r\n  /*                                                                       */\r\n  /*    vert              :: The vertical line metrics.                    */\r\n  /*                                                                       */\r\n  /*    x_ppem            :: The number of horizontal pixels per EM.       */\r\n  /*                                                                       */\r\n  /*    y_ppem            :: The number of vertical pixels per EM.         */\r\n  /*                                                                       */\r\n  /*    x_ppem_substitute :: Substitution x_ppem value.                    */\r\n  /*                                                                       */\r\n  /*    y_ppem_substitute :: Substitution y_ppem value.                    */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_ScaleRec_\r\n  {\r\n    TT_SBit_LineMetricsRec  hori;\r\n    TT_SBit_LineMetricsRec  vert;\r\n\r\n    FT_Byte                 x_ppem;\r\n    FT_Byte                 y_ppem;\r\n\r\n    FT_Byte                 x_ppem_substitute;\r\n    FT_Byte                 y_ppem_substitute;\r\n\r\n  } TT_SBit_ScaleRec, *TT_SBit_Scale;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                  POSTSCRIPT GLYPH NAMES SUPPORT                   ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Post_20Rec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Postscript names sub-table, format 2.0.  Stores the PS name of     */\r\n  /*    each glyph in the font face.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_glyphs    :: The number of named glyphs in the table.          */\r\n  /*                                                                       */\r\n  /*    num_names     :: The number of PS names stored in the table.       */\r\n  /*                                                                       */\r\n  /*    glyph_indices :: The indices of the glyphs in the names arrays.    */\r\n  /*                                                                       */\r\n  /*    glyph_names   :: The PS names not in Mac Encoding.                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_Post_20Rec_\r\n  {\r\n    FT_UShort   num_glyphs;\r\n    FT_UShort   num_names;\r\n    FT_UShort*  glyph_indices;\r\n    FT_Char**   glyph_names;\r\n\r\n  } TT_Post_20Rec, *TT_Post_20;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Post_25Rec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Postscript names sub-table, format 2.5.  Stores the PS name of     */\r\n  /*    each glyph in the font face.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_glyphs :: The number of glyphs in the table.                   */\r\n  /*                                                                       */\r\n  /*    offsets    :: An array of signed offsets in a normal Mac           */\r\n  /*                  Postscript name encoding.                            */\r\n  /*                                                                       */\r\n  typedef struct  TT_Post_25_\r\n  {\r\n    FT_UShort  num_glyphs;\r\n    FT_Char*   offsets;\r\n\r\n  } TT_Post_25Rec, *TT_Post_25;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Post_NamesRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Postscript names table, either format 2.0 or 2.5.                  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    loaded    :: A flag to indicate whether the PS names are loaded.   */\r\n  /*                                                                       */\r\n  /*    format_20 :: The sub-table used for format 2.0.                    */\r\n  /*                                                                       */\r\n  /*    format_25 :: The sub-table used for format 2.5.                    */\r\n  /*                                                                       */\r\n  typedef struct  TT_Post_NamesRec_\r\n  {\r\n    FT_Bool  loaded;\r\n\r\n    union\r\n    {\r\n      TT_Post_20Rec  format_20;\r\n      TT_Post_25Rec  format_25;\r\n\r\n    } names;\r\n\r\n  } TT_Post_NamesRec, *TT_Post_Names;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                    GX VARIATION TABLE SUPPORT                     ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n  typedef struct GX_BlendRec_  *GX_Blend;\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***              EMBEDDED BDF PROPERTIES TABLE SUPPORT                ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   * These types are used to support a `BDF ' table that isn't part of the\r\n   * official TrueType specification.  It is mainly used in SFNT-based\r\n   * bitmap fonts that were generated from a set of BDF fonts.\r\n   *\r\n   * The format of the table is as follows.\r\n   *\r\n   *   USHORT   version      `BDF ' table version number, should be 0x0001.\r\n   *   USHORT   strikeCount  Number of strikes (bitmap sizes) in this table.\r\n   *   ULONG    stringTable  Offset (from start of BDF table) to string\r\n   *                         table.\r\n   *\r\n   * This is followed by an array of `strikeCount' descriptors, having the\r\n   * following format.\r\n   *\r\n   *   USHORT   ppem         Vertical pixels per EM for this strike.\r\n   *   USHORT   numItems     Number of items for this strike (properties and\r\n   *                         atoms).  Maximum is 255.\r\n   *\r\n   * This array in turn is followed by `strikeCount' value sets.  Each\r\n   * `value set' is an array of `numItems' items with the following format.\r\n   *\r\n   *   ULONG    item_name    Offset in string table to item name.\r\n   *   USHORT   item_type    The item type.  Possible values are\r\n   *                            0 => string (e.g., COMMENT)\r\n   *                            1 => atom   (e.g., FONT or even SIZE)\r\n   *                            2 => int32\r\n   *                            3 => uint32\r\n   *                         0x10 => A flag to indicate a properties.  This\r\n   *                                 is ORed with the above values.\r\n   *   ULONG    item_value   For strings  => Offset into string table without\r\n   *                                         the corresponding double quotes.\r\n   *                         For atoms    => Offset into string table.\r\n   *                         For integers => Direct value.\r\n   *\r\n   * All strings in the string table consist of bytes and are\r\n   * zero-terminated.\r\n   *\r\n   */\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n\r\n  typedef struct  TT_BDFRec_\r\n  {\r\n    FT_Byte*   table;\r\n    FT_Byte*   table_end;\r\n    FT_Byte*   strings;\r\n    FT_ULong   strings_size;\r\n    FT_UInt    num_strikes;\r\n    FT_Bool    loaded;\r\n\r\n  } TT_BDFRec, *TT_BDF;\r\n\r\n#endif /* TT_CONFIG_OPTION_BDF */\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                  ORIGINAL TT_FACE CLASS DEFINITION                ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This structure/class is defined here because it is common to the      */\r\n  /* following formats: TTF, OpenType-TT, and OpenType-CFF.                */\r\n  /*                                                                       */\r\n  /* Note, however, that the classes TT_Size and TT_GlyphSlot are not      */\r\n  /* shared between font drivers, and are thus defined in `ttobjs.h'.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_Face                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a TrueType face/font object.  A TT_Face encapsulates   */\r\n  /*    the resolution and scaling independent parts of a TrueType font    */\r\n  /*    resource.                                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The TT_Face structure is also used as a `parent class' for the     */\r\n  /*    OpenType-CFF class (T2_Face).                                      */\r\n  /*                                                                       */\r\n  typedef struct TT_FaceRec_*  TT_Face;\r\n\r\n\r\n  /* a function type used for the truetype bytecode interpreter hooks */\r\n  typedef FT_Error\r\n  (*TT_Interpreter)( void*  exec_context );\r\n\r\n  /* forward declaration */\r\n  typedef struct TT_LoaderRec_*  TT_Loader;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_GotoTableFunc                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Seeks a stream to the start of a given TrueType table.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    tag    :: A 4-byte tag used to name the table.                     */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    length :: The length of the table in bytes.  Set to 0 if not       */\r\n  /*              needed.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the font file's origin.               */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Loader_GotoTableFunc)( TT_Face    face,\r\n                              FT_ULong   tag,\r\n                              FT_Stream  stream,\r\n                              FT_ULong*  length );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_StartGlyphFunc                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Seeks a stream to the start of a given glyph element, and opens a  */\r\n  /*    frame for it.                                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    loader      :: The current TrueType glyph loader object.           */\r\n  /*                                                                       */\r\n  /*    glyph index :: The index of the glyph to access.                   */\r\n  /*                                                                       */\r\n  /*    offset      :: The offset of the glyph according to the            */\r\n  /*                   `locations' table.                                  */\r\n  /*                                                                       */\r\n  /*    byte_count  :: The size of the frame in bytes.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is normally equivalent to FT_STREAM_SEEK(offset)     */\r\n  /*    followed by FT_FRAME_ENTER(byte_count) with the loader's stream,   */\r\n  /*    but alternative formats (e.g. compressed ones) might use something */\r\n  /*    different.                                                         */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Loader_StartGlyphFunc)( TT_Loader  loader,\r\n                               FT_UInt    glyph_index,\r\n                               FT_ULong   offset,\r\n                               FT_UInt    byte_count );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_ReadGlyphFunc                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Reads one glyph element (its header, a simple glyph, or a          */\r\n  /*    composite) from the loader's current stream frame.                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    loader :: The current TrueType glyph loader object.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Loader_ReadGlyphFunc)( TT_Loader  loader );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_EndGlyphFunc                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Closes the current loader stream frame for the glyph.              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    loader :: The current TrueType glyph loader object.                */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*TT_Loader_EndGlyphFunc)( TT_Loader  loader );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                         TrueType Face Type                            */\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Face                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The TrueType face class.  These objects model the resolution and   */\r\n  /*    point-size independent data found in a TrueType font file.         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root                 :: The base FT_Face structure, managed by the */\r\n  /*                            base layer.                                */\r\n  /*                                                                       */\r\n  /*    ttc_header           :: The TrueType collection header, used when  */\r\n  /*                            the file is a `ttc' rather than a `ttf'.   */\r\n  /*                            For ordinary font files, the field         */\r\n  /*                            `ttc_header.count' is set to 0.            */\r\n  /*                                                                       */\r\n  /*    format_tag           :: The font format tag.                       */\r\n  /*                                                                       */\r\n  /*    num_tables           :: The number of TrueType tables in this font */\r\n  /*                            file.                                      */\r\n  /*                                                                       */\r\n  /*    dir_tables           :: The directory of TrueType tables for this  */\r\n  /*                            font file.                                 */\r\n  /*                                                                       */\r\n  /*    header               :: The font's font header (`head' table).     */\r\n  /*                            Read on font opening.                      */\r\n  /*                                                                       */\r\n  /*    horizontal           :: The font's horizontal header (`hhea'       */\r\n  /*                            table).  This field also contains the      */\r\n  /*                            associated horizontal metrics table        */\r\n  /*                            (`hmtx').                                  */\r\n  /*                                                                       */\r\n  /*    max_profile          :: The font's maximum profile table.  Read on */\r\n  /*                            font opening.  Note that some maximum      */\r\n  /*                            values cannot be taken directly from this  */\r\n  /*                            table.  We thus define additional fields   */\r\n  /*                            below to hold the computed maxima.         */\r\n  /*                                                                       */\r\n  /*    vertical_info        :: A boolean which is set when the font file  */\r\n  /*                            contains vertical metrics.  If not, the    */\r\n  /*                            value of the `vertical' field is           */\r\n  /*                            undefined.                                 */\r\n  /*                                                                       */\r\n  /*    vertical             :: The font's vertical header (`vhea' table). */\r\n  /*                            This field also contains the associated    */\r\n  /*                            vertical metrics table (`vmtx'), if found. */\r\n  /*                            IMPORTANT: The contents of this field is   */\r\n  /*                            undefined if the `verticalInfo' field is   */\r\n  /*                            unset.                                     */\r\n  /*                                                                       */\r\n  /*    num_names            :: The number of name records within this     */\r\n  /*                            TrueType font.                             */\r\n  /*                                                                       */\r\n  /*    name_table           :: The table of name records (`name').        */\r\n  /*                                                                       */\r\n  /*    os2                  :: The font's OS/2 table (`OS/2').            */\r\n  /*                                                                       */\r\n  /*    postscript           :: The font's PostScript table (`post'        */\r\n  /*                            table).  The PostScript glyph names are    */\r\n  /*                            not loaded by the driver on face opening.  */\r\n  /*                            See the `ttpost' module for more details.  */\r\n  /*                                                                       */\r\n  /*    cmap_table           :: Address of the face's `cmap' SFNT table    */\r\n  /*                            in memory (it's an extracted frame).       */\r\n  /*                                                                       */\r\n  /*    cmap_size            :: The size in bytes of the `cmap_table'      */\r\n  /*                            described above.                           */\r\n  /*                                                                       */\r\n  /*    goto_table           :: A function called by each TrueType table   */\r\n  /*                            loader to position a stream's cursor to    */\r\n  /*                            the start of a given table according to    */\r\n  /*                            its tag.  It defaults to TT_Goto_Face but  */\r\n  /*                            can be different for strange formats (e.g. */\r\n  /*                            Type 42).                                  */\r\n  /*                                                                       */\r\n  /*    access_glyph_frame   :: A function used to access the frame of a   */\r\n  /*                            given glyph within the face's font file.   */\r\n  /*                                                                       */\r\n  /*    forget_glyph_frame   :: A function used to forget the frame of a   */\r\n  /*                            given glyph when all data has been loaded. */\r\n  /*                                                                       */\r\n  /*    read_glyph_header    :: A function used to read a glyph header.    */\r\n  /*                            It must be called between an `access' and  */\r\n  /*                            `forget'.                                  */\r\n  /*                                                                       */\r\n  /*    read_simple_glyph    :: A function used to read a simple glyph.    */\r\n  /*                            It must be called after the header was     */\r\n  /*                            read, and before the `forget'.             */\r\n  /*                                                                       */\r\n  /*    read_composite_glyph :: A function used to read a composite glyph. */\r\n  /*                            It must be called after the header was     */\r\n  /*                            read, and before the `forget'.             */\r\n  /*                                                                       */\r\n  /*    sfnt                 :: A pointer to the SFNT service.             */\r\n  /*                                                                       */\r\n  /*    psnames              :: A pointer to the PostScript names service. */\r\n  /*                                                                       */\r\n  /*    hdmx                 :: The face's horizontal device metrics       */\r\n  /*                            (`hdmx' table).  This table is optional in */\r\n  /*                            TrueType/OpenType fonts.                   */\r\n  /*                                                                       */\r\n  /*    gasp                 :: The grid-fitting and scaling properties    */\r\n  /*                            table (`gasp').  This table is optional in */\r\n  /*                            TrueType/OpenType fonts.                   */\r\n  /*                                                                       */\r\n  /*    pclt                 :: The `pclt' SFNT table.                     */\r\n  /*                                                                       */\r\n  /*    num_sbit_strikes     :: The number of sbit strikes, i.e., bitmap   */\r\n  /*                            sizes, embedded in this font.              */\r\n  /*                                                                       */\r\n  /*    sbit_strikes         :: An array of sbit strikes embedded in this  */\r\n  /*                            font.  This table is optional in a         */\r\n  /*                            TrueType/OpenType font.                    */\r\n  /*                                                                       */\r\n  /*    num_sbit_scales      :: The number of sbit scales for this font.   */\r\n  /*                                                                       */\r\n  /*    sbit_scales          :: Array of sbit scales embedded in this      */\r\n  /*                            font.  This table is optional in a         */\r\n  /*                            TrueType/OpenType font.                    */\r\n  /*                                                                       */\r\n  /*    postscript_names     :: A table used to store the Postscript names */\r\n  /*                            of  the glyphs for this font.  See the     */\r\n  /*                            file  `ttconfig.h' for comments on the     */\r\n  /*                            TT_CONFIG_OPTION_POSTSCRIPT_NAMES option.  */\r\n  /*                                                                       */\r\n  /*    num_locations        :: The number of glyph locations in this      */\r\n  /*                            TrueType file.  This should be             */\r\n  /*                            identical to the number of glyphs.         */\r\n  /*                            Ignored for Type 2 fonts.                  */\r\n  /*                                                                       */\r\n  /*    glyph_locations      :: An array of longs.  These are offsets to   */\r\n  /*                            glyph data within the `glyf' table.        */\r\n  /*                            Ignored for Type 2 font faces.             */\r\n  /*                                                                       */\r\n  /*    glyf_len             :: The length of the `glyf' table.  Needed    */\r\n  /*                            for malformed `loca' tables.               */\r\n  /*                                                                       */\r\n  /*    font_program_size    :: Size in bytecodes of the face's font       */\r\n  /*                            program.  0 if none defined.  Ignored for  */\r\n  /*                            Type 2 fonts.                              */\r\n  /*                                                                       */\r\n  /*    font_program         :: The face's font program (bytecode stream)  */\r\n  /*                            executed at load time, also used during    */\r\n  /*                            glyph rendering.  Comes from the `fpgm'    */\r\n  /*                            table.  Ignored for Type 2 font fonts.     */\r\n  /*                                                                       */\r\n  /*    cvt_program_size     :: The size in bytecodes of the face's cvt    */\r\n  /*                            program.  Ignored for Type 2 fonts.        */\r\n  /*                                                                       */\r\n  /*    cvt_program          :: The face's cvt program (bytecode stream)   */\r\n  /*                            executed each time an instance/size is     */\r\n  /*                            changed/reset.  Comes from the `prep'      */\r\n  /*                            table.  Ignored for Type 2 fonts.          */\r\n  /*                                                                       */\r\n  /*    cvt_size             :: Size of the control value table (in        */\r\n  /*                            entries).   Ignored for Type 2 fonts.      */\r\n  /*                                                                       */\r\n  /*    cvt                  :: The face's original control value table.   */\r\n  /*                            Coordinates are expressed in unscaled font */\r\n  /*                            units.  Comes from the `cvt ' table.       */\r\n  /*                            Ignored for Type 2 fonts.                  */\r\n  /*                                                                       */\r\n  /*    num_kern_pairs       :: The number of kerning pairs present in the */\r\n  /*                            font file.  The engine only loads the      */\r\n  /*                            first horizontal format 0 kern table it    */\r\n  /*                            finds in the font file.  Ignored for       */\r\n  /*                            Type 2 fonts.                              */\r\n  /*                                                                       */\r\n  /*    kern_table_index     :: The index of the kerning table in the font */\r\n  /*                            kerning directory.  Ignored for Type 2     */\r\n  /*                            fonts.                                     */\r\n  /*                                                                       */\r\n  /*    interpreter          :: A pointer to the TrueType bytecode         */\r\n  /*                            interpreters field is also used to hook    */\r\n  /*                            the debugger in `ttdebug'.                 */\r\n  /*                                                                       */\r\n  /*    unpatented_hinting   :: If true, use only unpatented methods in    */\r\n  /*                            the bytecode interpreter.                  */\r\n  /*                                                                       */\r\n  /*    doblend              :: A boolean which is set if the font should  */\r\n  /*                            be blended (this is for GX var).           */\r\n  /*                                                                       */\r\n  /*    blend                :: Contains the data needed to control GX     */\r\n  /*                            variation tables (rather like Multiple     */\r\n  /*                            Master data).                              */\r\n  /*                                                                       */\r\n  /*    extra                :: Reserved for third-party font drivers.     */\r\n  /*                                                                       */\r\n  /*    postscript_name      :: The PS name of the font.  Used by the      */\r\n  /*                            postscript name service.                   */\r\n  /*                                                                       */\r\n  typedef struct  TT_FaceRec_\r\n  {\r\n    FT_FaceRec            root;\r\n\r\n    TTC_HeaderRec         ttc_header;\r\n\r\n    FT_ULong              format_tag;\r\n    FT_UShort             num_tables;\r\n    TT_Table              dir_tables;\r\n\r\n    TT_Header             header;       /* TrueType header table          */\r\n    TT_HoriHeader         horizontal;   /* TrueType horizontal header     */\r\n\r\n    TT_MaxProfile         max_profile;\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_ULong              max_components;  /* stubbed to 0 */\r\n#endif\r\n\r\n    FT_Bool               vertical_info;\r\n    TT_VertHeader         vertical;     /* TT Vertical header, if present */\r\n\r\n    FT_UShort             num_names;    /* number of name records  */\r\n    TT_NameTableRec       name_table;   /* name table              */\r\n\r\n    TT_OS2                os2;          /* TrueType OS/2 table            */\r\n    TT_Postscript         postscript;   /* TrueType Postscript table      */\r\n\r\n    FT_Byte*              cmap_table;   /* extracted `cmap' table */\r\n    FT_ULong              cmap_size;\r\n\r\n    TT_Loader_GotoTableFunc   goto_table;\r\n\r\n    TT_Loader_StartGlyphFunc  access_glyph_frame;\r\n    TT_Loader_EndGlyphFunc    forget_glyph_frame;\r\n    TT_Loader_ReadGlyphFunc   read_glyph_header;\r\n    TT_Loader_ReadGlyphFunc   read_simple_glyph;\r\n    TT_Loader_ReadGlyphFunc   read_composite_glyph;\r\n\r\n    /* a typeless pointer to the SFNT_Interface table used to load */\r\n    /* the basic TrueType tables in the face object                */\r\n    void*                 sfnt;\r\n\r\n    /* a typeless pointer to the FT_Service_PsCMapsRec table used to */\r\n    /* handle glyph names <-> unicode & Mac values                   */\r\n    void*                 psnames;\r\n\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* Optional TrueType/OpenType tables                                   */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    /* horizontal device metrics */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_HdmxRec            hdmx;\r\n#endif\r\n\r\n    /* grid-fitting and scaling table */\r\n    TT_GaspRec            gasp;                 /* the `gasp' table */\r\n\r\n    /* PCL 5 table */\r\n    TT_PCLT               pclt;\r\n\r\n    /* embedded bitmaps support */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_ULong              num_sbit_strikes;\r\n    TT_SBit_Strike        sbit_strikes;\r\n#endif\r\n\r\n    FT_ULong              num_sbit_scales;\r\n    TT_SBit_Scale         sbit_scales;\r\n\r\n    /* postscript names table */\r\n    TT_Post_NamesRec      postscript_names;\r\n\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* TrueType-specific fields (ignored by the OTF-Type2 driver)          */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    /* the glyph locations */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_UShort             num_locations_stub;\r\n    FT_Long*              glyph_locations_stub;\r\n#endif\r\n\r\n    /* the font program, if any */\r\n    FT_ULong              font_program_size;\r\n    FT_Byte*              font_program;\r\n\r\n    /* the cvt program, if any */\r\n    FT_ULong              cvt_program_size;\r\n    FT_Byte*              cvt_program;\r\n\r\n    /* the original, unscaled, control value table */\r\n    FT_ULong              cvt_size;\r\n    FT_Short*             cvt;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    /* the format 0 kerning table, if any */\r\n    FT_Int                num_kern_pairs;\r\n    FT_Int                kern_table_index;\r\n    TT_Kern0_Pair         kern_pairs;\r\n#endif\r\n\r\n    /* A pointer to the bytecode interpreter to use.  This is also */\r\n    /* used to hook the debugger for the `ttdebug' utility.        */\r\n    TT_Interpreter        interpreter;\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    /* Use unpatented hinting only. */\r\n    FT_Bool               unpatented_hinting;\r\n#endif\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* Other tables or fields. This is used by derivative formats like     */\r\n    /* OpenType.                                                           */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    FT_Generic            extra;\r\n\r\n    const char*           postscript_name;\r\n\r\n    /* since version 2.1.8, but was originally placed after */\r\n    /* `glyph_locations_stub'                               */\r\n    FT_ULong              glyf_len;\r\n\r\n    /* since version 2.1.8, but was originally placed before `extra' */\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    FT_Bool               doblend;\r\n    GX_Blend              blend;\r\n#endif\r\n\r\n    /* since version 2.2 */\r\n\r\n    FT_Byte*              horz_metrics;\r\n    FT_ULong              horz_metrics_size;\r\n\r\n    FT_Byte*              vert_metrics;\r\n    FT_ULong              vert_metrics_size;\r\n\r\n    FT_ULong              num_locations; /* in broken TTF, gid > 0xFFFF */\r\n    FT_Byte*              glyph_locations;\r\n\r\n    FT_Byte*              hdmx_table;\r\n    FT_ULong              hdmx_table_size;\r\n    FT_UInt               hdmx_record_count;\r\n    FT_ULong              hdmx_record_size;\r\n    FT_Byte*              hdmx_record_sizes;\r\n\r\n    FT_Byte*              sbit_table;\r\n    FT_ULong              sbit_table_size;\r\n    FT_UInt               sbit_num_strikes;\r\n\r\n    FT_Byte*              kern_table;\r\n    FT_ULong              kern_table_size;\r\n    FT_UInt               num_kern_tables;\r\n    FT_UInt32             kern_avail_bits;\r\n    FT_UInt32             kern_order_bits;\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n    TT_BDFRec             bdf;\r\n#endif /* TT_CONFIG_OPTION_BDF */\r\n\r\n    /* since 2.3.0 */\r\n    FT_ULong              horz_metrics_offset;\r\n    FT_ULong              vert_metrics_offset;\r\n\r\n  } TT_FaceRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  <Struct>                                                             */\r\n  /*     TT_GlyphZoneRec                                                   */\r\n  /*                                                                       */\r\n  /*  <Description>                                                        */\r\n  /*     A glyph zone is used to load, scale and hint glyph outline        */\r\n  /*     coordinates.                                                      */\r\n  /*                                                                       */\r\n  /*  <Fields>                                                             */\r\n  /*     memory       :: A handle to the memory manager.                   */\r\n  /*                                                                       */\r\n  /*     max_points   :: The maximum size in points of the zone.           */\r\n  /*                                                                       */\r\n  /*     max_contours :: Max size in links contours of the zone.           */\r\n  /*                                                                       */\r\n  /*     n_points     :: The current number of points in the zone.         */\r\n  /*                                                                       */\r\n  /*     n_contours   :: The current number of contours in the zone.       */\r\n  /*                                                                       */\r\n  /*     org          :: The original glyph coordinates (font              */\r\n  /*                     units/scaled).                                    */\r\n  /*                                                                       */\r\n  /*     cur          :: The current glyph coordinates (scaled/hinted).    */\r\n  /*                                                                       */\r\n  /*     tags         :: The point control tags.                           */\r\n  /*                                                                       */\r\n  /*     contours     :: The contours end points.                          */\r\n  /*                                                                       */\r\n  /*     first_point  :: Offset of the current subglyph's first point.     */\r\n  /*                                                                       */\r\n  typedef struct  TT_GlyphZoneRec_\r\n  {\r\n    FT_Memory   memory;\r\n    FT_UShort   max_points;\r\n    FT_UShort   max_contours;\r\n    FT_UShort   n_points;    /* number of points in zone    */\r\n    FT_Short    n_contours;  /* number of contours          */\r\n\r\n    FT_Vector*  org;         /* original point coordinates  */\r\n    FT_Vector*  cur;         /* current point coordinates   */\r\n    FT_Vector*  orus;        /* original (unscaled) point coordinates */\r\n\r\n    FT_Byte*    tags;        /* current touch flags         */\r\n    FT_UShort*  contours;    /* contour end points          */\r\n\r\n    FT_UShort   first_point; /* offset of first (#0) point  */\r\n\r\n  } TT_GlyphZoneRec, *TT_GlyphZone;\r\n\r\n\r\n  /* handle to execution context */\r\n  typedef struct TT_ExecContextRec_*  TT_ExecContext;\r\n\r\n  /* glyph loader structure */\r\n  typedef struct  TT_LoaderRec_\r\n  {\r\n    FT_Face          face;\r\n    FT_Size          size;\r\n    FT_GlyphSlot     glyph;\r\n    FT_GlyphLoader   gloader;\r\n\r\n    FT_ULong         load_flags;\r\n    FT_UInt          glyph_index;\r\n\r\n    FT_Stream        stream;\r\n    FT_Int           byte_len;\r\n\r\n    FT_Short         n_contours;\r\n    FT_BBox          bbox;\r\n    FT_Int           left_bearing;\r\n    FT_Int           advance;\r\n    FT_Int           linear;\r\n    FT_Bool          linear_def;\r\n    FT_Bool          preserve_pps;\r\n    FT_Vector        pp1;\r\n    FT_Vector        pp2;\r\n\r\n    FT_ULong         glyf_offset;\r\n\r\n    /* the zone where we load our glyphs */\r\n    TT_GlyphZoneRec  base;\r\n    TT_GlyphZoneRec  zone;\r\n\r\n    TT_ExecContext   exec;\r\n    FT_Byte*         instructions;\r\n    FT_ULong         ins_pos;\r\n\r\n    /* for possible extensibility in other formats */\r\n    void*            other;\r\n\r\n    /* since version 2.1.8 */\r\n    FT_Int           top_bearing;\r\n    FT_Int           vadvance;\r\n    FT_Vector        pp3;\r\n    FT_Vector        pp4;\r\n\r\n    /* since version 2.2.1 */\r\n    FT_Byte*         cursor;\r\n    FT_Byte*         limit;\r\n\r\n  } TT_LoaderRec;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/t1tables.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1tables.h                                                             */\r\n/*                                                                         */\r\n/*    Basic Type 1/Type 2 tables definitions and interface (specification  */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006, 2008, 2009, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1TABLES_H__\r\n#define __T1TABLES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    type1_tables                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Type 1 Tables                                                      */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Type~1 (PostScript) specific font tables.                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the definition of Type 1-specific tables,    */\r\n  /*    including structures related to other PostScript font formats.     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */\r\n  /* structures in order to support Multiple Master fonts.               */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_FontInfoRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a Type~1 or Type~2 FontInfo dictionary.  */\r\n  /*    Note that for Multiple Master fonts, each instance has its own     */\r\n  /*    FontInfo dictionary.                                               */\r\n  /*                                                                       */\r\n  typedef struct  PS_FontInfoRec_\r\n  {\r\n    FT_String*  version;\r\n    FT_String*  notice;\r\n    FT_String*  full_name;\r\n    FT_String*  family_name;\r\n    FT_String*  weight;\r\n    FT_Long     italic_angle;\r\n    FT_Bool     is_fixed_pitch;\r\n    FT_Short    underline_position;\r\n    FT_UShort   underline_thickness;\r\n\r\n  } PS_FontInfoRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_FontInfo                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @PS_FontInfoRec structure.                           */\r\n  /*                                                                       */\r\n  typedef struct PS_FontInfoRec_*  PS_FontInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_FontInfo                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This type is equivalent to @PS_FontInfoRec.  It is deprecated but  */\r\n  /*    kept to maintain source compatibility between various versions of  */\r\n  /*    FreeType.                                                          */\r\n  /*                                                                       */\r\n  typedef PS_FontInfoRec  T1_FontInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_PrivateRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a Type~1 or Type~2 private dictionary.   */\r\n  /*    Note that for Multiple Master fonts, each instance has its own     */\r\n  /*    Private dictionary.                                                */\r\n  /*                                                                       */\r\n  typedef struct  PS_PrivateRec_\r\n  {\r\n    FT_Int     unique_id;\r\n    FT_Int     lenIV;\r\n\r\n    FT_Byte    num_blue_values;\r\n    FT_Byte    num_other_blues;\r\n    FT_Byte    num_family_blues;\r\n    FT_Byte    num_family_other_blues;\r\n\r\n    FT_Short   blue_values[14];\r\n    FT_Short   other_blues[10];\r\n\r\n    FT_Short   family_blues      [14];\r\n    FT_Short   family_other_blues[10];\r\n\r\n    FT_Fixed   blue_scale;\r\n    FT_Int     blue_shift;\r\n    FT_Int     blue_fuzz;\r\n\r\n    FT_UShort  standard_width[1];\r\n    FT_UShort  standard_height[1];\r\n\r\n    FT_Byte    num_snap_widths;\r\n    FT_Byte    num_snap_heights;\r\n    FT_Bool    force_bold;\r\n    FT_Bool    round_stem_up;\r\n\r\n    FT_Short   snap_widths [13];  /* including std width  */\r\n    FT_Short   snap_heights[13];  /* including std height */\r\n\r\n    FT_Fixed   expansion_factor;\r\n\r\n    FT_Long    language_group;\r\n    FT_Long    password;\r\n\r\n    FT_Short   min_feature[2];\r\n\r\n  } PS_PrivateRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_Private                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @PS_PrivateRec structure.                            */\r\n  /*                                                                       */\r\n  typedef struct PS_PrivateRec_*  PS_Private;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_Private                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   This type is equivalent to @PS_PrivateRec.  It is deprecated but    */\r\n  /*   kept to maintain source compatibility between various versions of   */\r\n  /*   FreeType.                                                           */\r\n  /*                                                                       */\r\n  typedef PS_PrivateRec  T1_Private;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    T1_Blend_Flags                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A set of flags used to indicate which fields are present in a      */\r\n  /*    given blend dictionary (font info or private).  Used to support    */\r\n  /*    Multiple Masters fonts.                                            */\r\n  /*                                                                       */\r\n  typedef enum  T1_Blend_Flags_\r\n  {\r\n    /*# required fields in a FontInfo blend dictionary */\r\n    T1_BLEND_UNDERLINE_POSITION = 0,\r\n    T1_BLEND_UNDERLINE_THICKNESS,\r\n    T1_BLEND_ITALIC_ANGLE,\r\n\r\n    /*# required fields in a Private blend dictionary */\r\n    T1_BLEND_BLUE_VALUES,\r\n    T1_BLEND_OTHER_BLUES,\r\n    T1_BLEND_STANDARD_WIDTH,\r\n    T1_BLEND_STANDARD_HEIGHT,\r\n    T1_BLEND_STEM_SNAP_WIDTHS,\r\n    T1_BLEND_STEM_SNAP_HEIGHTS,\r\n    T1_BLEND_BLUE_SCALE,\r\n    T1_BLEND_BLUE_SHIFT,\r\n    T1_BLEND_FAMILY_BLUES,\r\n    T1_BLEND_FAMILY_OTHER_BLUES,\r\n    T1_BLEND_FORCE_BOLD,\r\n\r\n    /*# never remove */\r\n    T1_BLEND_MAX\r\n\r\n  } T1_Blend_Flags;\r\n\r\n  /* */\r\n\r\n\r\n  /*# backwards compatible definitions */\r\n#define t1_blend_underline_position   T1_BLEND_UNDERLINE_POSITION\r\n#define t1_blend_underline_thickness  T1_BLEND_UNDERLINE_THICKNESS\r\n#define t1_blend_italic_angle         T1_BLEND_ITALIC_ANGLE\r\n#define t1_blend_blue_values          T1_BLEND_BLUE_VALUES\r\n#define t1_blend_other_blues          T1_BLEND_OTHER_BLUES\r\n#define t1_blend_standard_widths      T1_BLEND_STANDARD_WIDTH\r\n#define t1_blend_standard_height      T1_BLEND_STANDARD_HEIGHT\r\n#define t1_blend_stem_snap_widths     T1_BLEND_STEM_SNAP_WIDTHS\r\n#define t1_blend_stem_snap_heights    T1_BLEND_STEM_SNAP_HEIGHTS\r\n#define t1_blend_blue_scale           T1_BLEND_BLUE_SCALE\r\n#define t1_blend_blue_shift           T1_BLEND_BLUE_SHIFT\r\n#define t1_blend_family_blues         T1_BLEND_FAMILY_BLUES\r\n#define t1_blend_family_other_blues   T1_BLEND_FAMILY_OTHER_BLUES\r\n#define t1_blend_force_bold           T1_BLEND_FORCE_BOLD\r\n#define t1_blend_max                  T1_BLEND_MAX\r\n\r\n\r\n  /* maximum number of Multiple Masters designs, as defined in the spec */\r\n#define T1_MAX_MM_DESIGNS     16\r\n\r\n  /* maximum number of Multiple Masters axes, as defined in the spec */\r\n#define T1_MAX_MM_AXIS        4\r\n\r\n  /* maximum number of elements in a design map */\r\n#define T1_MAX_MM_MAP_POINTS  20\r\n\r\n\r\n  /* this structure is used to store the BlendDesignMap entry for an axis */\r\n  typedef struct  PS_DesignMap_\r\n  {\r\n    FT_Byte    num_points;\r\n    FT_Long*   design_points;\r\n    FT_Fixed*  blend_points;\r\n\r\n  } PS_DesignMapRec, *PS_DesignMap;\r\n\r\n  /* backwards-compatible definition */\r\n  typedef PS_DesignMapRec  T1_DesignMap;\r\n\r\n\r\n  typedef struct  PS_BlendRec_\r\n  {\r\n    FT_UInt          num_designs;\r\n    FT_UInt          num_axis;\r\n\r\n    FT_String*       axis_names[T1_MAX_MM_AXIS];\r\n    FT_Fixed*        design_pos[T1_MAX_MM_DESIGNS];\r\n    PS_DesignMapRec  design_map[T1_MAX_MM_AXIS];\r\n\r\n    FT_Fixed*        weight_vector;\r\n    FT_Fixed*        default_weight_vector;\r\n\r\n    PS_FontInfo      font_infos[T1_MAX_MM_DESIGNS + 1];\r\n    PS_Private       privates  [T1_MAX_MM_DESIGNS + 1];\r\n\r\n    FT_ULong         blend_bitflags;\r\n\r\n    FT_BBox*         bboxes    [T1_MAX_MM_DESIGNS + 1];\r\n\r\n    /* since 2.3.0 */\r\n\r\n    /* undocumented, optional: the default design instance;   */\r\n    /* corresponds to default_weight_vector --                */\r\n    /* num_default_design_vector == 0 means it is not present */\r\n    /* in the font and associated metrics files               */\r\n    FT_UInt          default_design_vector[T1_MAX_MM_DESIGNS];\r\n    FT_UInt          num_default_design_vector;\r\n\r\n  } PS_BlendRec, *PS_Blend;\r\n\r\n\r\n  /* backwards-compatible definition */\r\n  typedef PS_BlendRec  T1_Blend;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceDictRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to represent data in a CID top-level dictionary.  */\r\n  /*                                                                       */\r\n  typedef struct  CID_FaceDictRec_\r\n  {\r\n    PS_PrivateRec  private_dict;\r\n\r\n    FT_UInt        len_buildchar;\r\n    FT_Fixed       forcebold_threshold;\r\n    FT_Pos         stroke_width;\r\n    FT_Fixed       expansion_factor;\r\n\r\n    FT_Byte        paint_type;\r\n    FT_Byte        font_type;\r\n    FT_Matrix      font_matrix;\r\n    FT_Vector      font_offset;\r\n\r\n    FT_UInt        num_subrs;\r\n    FT_ULong       subrmap_offset;\r\n    FT_Int         sd_bytes;\r\n\r\n  } CID_FaceDictRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceDict                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @CID_FaceDictRec structure.                          */\r\n  /*                                                                       */\r\n  typedef struct CID_FaceDictRec_*  CID_FaceDict;\r\n\r\n  /* */\r\n\r\n\r\n  /* backwards-compatible definition */\r\n  typedef CID_FaceDictRec  CID_FontDict;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceInfoRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to represent CID Face information.                */\r\n  /*                                                                       */\r\n  typedef struct  CID_FaceInfoRec_\r\n  {\r\n    FT_String*      cid_font_name;\r\n    FT_Fixed        cid_version;\r\n    FT_Int          cid_font_type;\r\n\r\n    FT_String*      registry;\r\n    FT_String*      ordering;\r\n    FT_Int          supplement;\r\n\r\n    PS_FontInfoRec  font_info;\r\n    FT_BBox         font_bbox;\r\n    FT_ULong        uid_base;\r\n\r\n    FT_Int          num_xuid;\r\n    FT_ULong        xuid[16];\r\n\r\n    FT_ULong        cidmap_offset;\r\n    FT_Int          fd_bytes;\r\n    FT_Int          gd_bytes;\r\n    FT_ULong        cid_count;\r\n\r\n    FT_Int          num_dicts;\r\n    CID_FaceDict    font_dicts;\r\n\r\n    FT_ULong        data_offset;\r\n\r\n  } CID_FaceInfoRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceInfo                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @CID_FaceInfoRec structure.                          */\r\n  /*                                                                       */\r\n  typedef struct CID_FaceInfoRec_*  CID_FaceInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_Info                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   This type is equivalent to @CID_FaceInfoRec.  It is deprecated but  */\r\n  /*   kept to maintain source compatibility between various versions of   */\r\n  /*   FreeType.                                                           */\r\n  /*                                                                       */\r\n  typedef CID_FaceInfoRec  CID_Info;\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Has_PS_Glyph_Names\r\n   *\r\n   * @description:\r\n   *    Return true if a given face provides reliable PostScript glyph\r\n   *    names.  This is similar to using the @FT_HAS_GLYPH_NAMES macro,\r\n   *    except that certain fonts (mostly TrueType) contain incorrect\r\n   *    glyph name tables.\r\n   *\r\n   *    When this function returns true, the caller is sure that the glyph\r\n   *    names returned by @FT_Get_Glyph_Name are reliable.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       face handle\r\n   *\r\n   * @return:\r\n   *    Boolean.  True if glyph names are reliable.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Has_PS_Glyph_Names( FT_Face  face );\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_PS_Font_Info\r\n   *\r\n   * @description:\r\n   *    Retrieve the @PS_FontInfoRec structure corresponding to a given\r\n   *    PostScript font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       PostScript face handle.\r\n   *\r\n   * @output:\r\n   *    afont_info ::\r\n   *       Output font info structure pointer.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    The string pointers within the font info structure are owned by\r\n   *    the face and don't need to be freed by the caller.\r\n   *\r\n   *    If the font's format is not PostScript-based, this function will\r\n   *    return the `FT_Err_Invalid_Argument' error code.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PS_Font_Info( FT_Face      face,\r\n                       PS_FontInfo  afont_info );\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_PS_Font_Private\r\n   *\r\n   * @description:\r\n   *    Retrieve the @PS_PrivateRec structure corresponding to a given\r\n   *    PostScript font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       PostScript face handle.\r\n   *\r\n   * @output:\r\n   *    afont_private ::\r\n   *       Output private dictionary structure pointer.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    The string pointers within the @PS_PrivateRec structure are owned by\r\n   *    the face and don't need to be freed by the caller.\r\n   *\r\n   *    If the font's format is not PostScript-based, this function returns\r\n   *    the `FT_Err_Invalid_Argument' error code.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PS_Font_Private( FT_Face     face,\r\n                          PS_Private  afont_private );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    T1_EncodingType                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration describing the `Encoding' entry in a Type 1         */\r\n  /*    dictionary.                                                        */\r\n  /*                                                                       */\r\n  typedef enum  T1_EncodingType_\r\n  {\r\n    T1_ENCODING_TYPE_NONE = 0,\r\n    T1_ENCODING_TYPE_ARRAY,\r\n    T1_ENCODING_TYPE_STANDARD,\r\n    T1_ENCODING_TYPE_ISOLATIN1,\r\n    T1_ENCODING_TYPE_EXPERT\r\n\r\n  } T1_EncodingType;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    PS_Dict_Keys                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used in calls to @FT_Get_PS_Font_Value to identify  */\r\n  /*    the Type~1 dictionary entry to retrieve.                           */\r\n  /*                                                                       */\r\n  typedef enum  PS_Dict_Keys_\r\n  {\r\n    /* conventionally in the font dictionary */\r\n    PS_DICT_FONT_TYPE,              /* FT_Byte         */\r\n    PS_DICT_FONT_MATRIX,            /* FT_Fixed        */\r\n    PS_DICT_FONT_BBOX,              /* FT_Fixed        */\r\n    PS_DICT_PAINT_TYPE,             /* FT_Byte         */\r\n    PS_DICT_FONT_NAME,              /* FT_String*      */\r\n    PS_DICT_UNIQUE_ID,              /* FT_Int          */\r\n    PS_DICT_NUM_CHAR_STRINGS,       /* FT_Int          */\r\n    PS_DICT_CHAR_STRING_KEY,        /* FT_String*      */\r\n    PS_DICT_CHAR_STRING,            /* FT_String*      */\r\n    PS_DICT_ENCODING_TYPE,          /* T1_EncodingType */\r\n    PS_DICT_ENCODING_ENTRY,         /* FT_String*      */\r\n\r\n    /* conventionally in the font Private dictionary */\r\n    PS_DICT_NUM_SUBRS,              /* FT_Int     */\r\n    PS_DICT_SUBR,                   /* FT_String* */\r\n    PS_DICT_STD_HW,                 /* FT_UShort  */\r\n    PS_DICT_STD_VW,                 /* FT_UShort  */\r\n    PS_DICT_NUM_BLUE_VALUES,        /* FT_Byte    */\r\n    PS_DICT_BLUE_VALUE,             /* FT_Short   */\r\n    PS_DICT_BLUE_FUZZ,              /* FT_Int     */\r\n    PS_DICT_NUM_OTHER_BLUES,        /* FT_Byte    */\r\n    PS_DICT_OTHER_BLUE,             /* FT_Short   */\r\n    PS_DICT_NUM_FAMILY_BLUES,       /* FT_Byte    */\r\n    PS_DICT_FAMILY_BLUE,            /* FT_Short   */\r\n    PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte    */\r\n    PS_DICT_FAMILY_OTHER_BLUE,      /* FT_Short   */\r\n    PS_DICT_BLUE_SCALE,             /* FT_Fixed   */\r\n    PS_DICT_BLUE_SHIFT,             /* FT_Int     */\r\n    PS_DICT_NUM_STEM_SNAP_H,        /* FT_Byte    */\r\n    PS_DICT_STEM_SNAP_H,            /* FT_Short   */\r\n    PS_DICT_NUM_STEM_SNAP_V,        /* FT_Byte    */\r\n    PS_DICT_STEM_SNAP_V,            /* FT_Short   */\r\n    PS_DICT_FORCE_BOLD,             /* FT_Bool    */\r\n    PS_DICT_RND_STEM_UP,            /* FT_Bool    */\r\n    PS_DICT_MIN_FEATURE,            /* FT_Short   */\r\n    PS_DICT_LEN_IV,                 /* FT_Int     */\r\n    PS_DICT_PASSWORD,               /* FT_Long    */\r\n    PS_DICT_LANGUAGE_GROUP,         /* FT_Long    */\r\n\r\n    /* conventionally in the font FontInfo dictionary */\r\n    PS_DICT_VERSION,                /* FT_String* */\r\n    PS_DICT_NOTICE,                 /* FT_String* */\r\n    PS_DICT_FULL_NAME,              /* FT_String* */\r\n    PS_DICT_FAMILY_NAME,            /* FT_String* */\r\n    PS_DICT_WEIGHT,                 /* FT_String* */\r\n    PS_DICT_IS_FIXED_PITCH,         /* FT_Bool    */\r\n    PS_DICT_UNDERLINE_POSITION,     /* FT_Short   */\r\n    PS_DICT_UNDERLINE_THICKNESS,    /* FT_UShort  */\r\n    PS_DICT_FS_TYPE,                /* FT_UShort  */\r\n    PS_DICT_ITALIC_ANGLE,           /* FT_Long    */\r\n\r\n    PS_DICT_MAX = PS_DICT_ITALIC_ANGLE\r\n\r\n  } PS_Dict_Keys;\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_PS_Font_Value\r\n   *\r\n   * @description:\r\n   *    Retrieve the value for the supplied key from a PostScript font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       PostScript face handle.\r\n   *\r\n   *    key ::\r\n   *       An enumeration value representing the dictionary key to retrieve.\r\n   *\r\n   *    idx ::\r\n   *       For array values, this specifies the index to be returned.\r\n   *\r\n   *    value ::\r\n   *       A pointer to memory into which to write the value.\r\n   *\r\n   *    valen_len ::\r\n   *       The size, in bytes, of the memory supplied for the value.\r\n   *\r\n   * @output:\r\n   *    value ::\r\n   *       The value matching the above key, if it exists.\r\n   *\r\n   * @return:\r\n   *    The amount of memory (in bytes) required to hold the requested\r\n   *    value (if it exists, -1 otherwise).\r\n   *\r\n   * @note:\r\n   *    The values returned are not pointers into the internal structures of\r\n   *    the face, but are `fresh' copies, so that the memory containing them\r\n   *    belongs to the calling application.  This also enforces the\r\n   *    `read-only' nature of these values, i.e., this function cannot be\r\n   *    used to manipulate the face.\r\n   *\r\n   *    `value' is a void pointer because the values returned can be of\r\n   *    various types.\r\n   *\r\n   *    If either `value' is NULL or `value_len' is too small, just the\r\n   *    required memory size for the requested entry is returned.\r\n   *\r\n   *    The `idx' parameter is used, not only to retrieve elements of, for\r\n   *    example, the FontMatrix or FontBBox, but also to retrieve name keys\r\n   *    from the CharStrings dictionary, and the charstrings themselves.  It\r\n   *    is ignored for atomic values.\r\n   *\r\n   *    PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000.  To\r\n   *    get the value as in the font stream, you need to divide by\r\n   *    65536000.0 (to remove the FT_Fixed scale, and the x1000 scale).\r\n   *\r\n   *    IMPORTANT: Only key/value pairs read by the FreeType interpreter can\r\n   *    be retrieved.  So, for example, PostScript procedures such as NP,\r\n   *    ND, and RD are not available.  Arbitrary keys are, obviously, not be\r\n   *    available either.\r\n   *\r\n   *    If the font's format is not PostScript-based, this function returns\r\n   *    the `FT_Err_Invalid_Argument' error code.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Long )\r\n  FT_Get_PS_Font_Value( FT_Face       face,\r\n                        PS_Dict_Keys  key,\r\n                        FT_UInt       idx,\r\n                        void         *value,\r\n                        FT_Long       value_len );\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1TABLES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ttnameid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttnameid.h                                                             */\r\n/*                                                                         */\r\n/*    TrueType name ID definitions (specification only).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006-2008, 2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTNAMEID_H__\r\n#define __TTNAMEID_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    truetype_tables                                                    */\r\n  /*                                                                       */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values for the `platform' identifier code in the name        */\r\n  /* records of the TTF `name' table.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_PLATFORM_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `platform_id' identifier code in\r\n   *   @FT_CharMapRec and @FT_SfntName structures.\r\n   *\r\n   * @values:\r\n   *   TT_PLATFORM_APPLE_UNICODE ::\r\n   *     Used by Apple to indicate a Unicode character map and/or name entry.\r\n   *     See @TT_APPLE_ID_XXX for corresponding `encoding_id' values.  Note\r\n   *     that name entries in this format are coded as big-endian UCS-2\r\n   *     character codes _only_.\r\n   *\r\n   *   TT_PLATFORM_MACINTOSH ::\r\n   *     Used by Apple to indicate a MacOS-specific charmap and/or name entry.\r\n   *     See @TT_MAC_ID_XXX for corresponding `encoding_id' values.  Note that\r\n   *     most TrueType fonts contain an Apple roman charmap to be usable on\r\n   *     MacOS systems (even if they contain a Microsoft charmap as well).\r\n   *\r\n   *   TT_PLATFORM_ISO ::\r\n   *     This value was used to specify ISO/IEC 10646 charmaps.  It is however\r\n   *     now deprecated.  See @TT_ISO_ID_XXX for a list of corresponding\r\n   *     `encoding_id' values.\r\n   *\r\n   *   TT_PLATFORM_MICROSOFT ::\r\n   *     Used by Microsoft to indicate Windows-specific charmaps.  See\r\n   *     @TT_MS_ID_XXX for a list of corresponding `encoding_id' values.\r\n   *     Note that most fonts contain a Unicode charmap using\r\n   *     (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS).\r\n   *\r\n   *   TT_PLATFORM_CUSTOM ::\r\n   *     Used to indicate application-specific charmaps.\r\n   *\r\n   *   TT_PLATFORM_ADOBE ::\r\n   *     This value isn't part of any font format specification, but is used\r\n   *     by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec\r\n   *     structure.  See @TT_ADOBE_ID_XXX.\r\n   */\r\n\r\n#define TT_PLATFORM_APPLE_UNICODE  0\r\n#define TT_PLATFORM_MACINTOSH      1\r\n#define TT_PLATFORM_ISO            2 /* deprecated */\r\n#define TT_PLATFORM_MICROSOFT      3\r\n#define TT_PLATFORM_CUSTOM         4\r\n#define TT_PLATFORM_ADOBE          7 /* artificial */\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_APPLE_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.\r\n   *\r\n   * @values:\r\n   *   TT_APPLE_ID_DEFAULT ::\r\n   *     Unicode version 1.0.\r\n   *\r\n   *   TT_APPLE_ID_UNICODE_1_1 ::\r\n   *     Unicode 1.1; specifies Hangul characters starting at U+34xx.\r\n   *\r\n   *   TT_APPLE_ID_ISO_10646 ::\r\n   *     Deprecated (identical to preceding).\r\n   *\r\n   *   TT_APPLE_ID_UNICODE_2_0 ::\r\n   *     Unicode 2.0 and beyond (UTF-16 BMP only).\r\n   *\r\n   *   TT_APPLE_ID_UNICODE_32 ::\r\n   *     Unicode 3.1 and beyond, using UTF-32.\r\n   *\r\n   *   TT_APPLE_ID_VARIANT_SELECTOR ::\r\n   *     From Adobe, not Apple.  Not a normal cmap.  Specifies variations\r\n   *     on a real cmap.\r\n   */\r\n\r\n#define TT_APPLE_ID_DEFAULT           0 /* Unicode 1.0 */\r\n#define TT_APPLE_ID_UNICODE_1_1       1 /* specify Hangul at U+34xx */\r\n#define TT_APPLE_ID_ISO_10646         2 /* deprecated */\r\n#define TT_APPLE_ID_UNICODE_2_0       3 /* or later */\r\n#define TT_APPLE_ID_UNICODE_32        4 /* 2.0 or later, full repertoire */\r\n#define TT_APPLE_ID_VARIANT_SELECTOR  5 /* variation selector data */\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_MAC_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_MACINTOSH charmaps and name entries.\r\n   *\r\n   * @values:\r\n   *   TT_MAC_ID_ROMAN ::\r\n   *   TT_MAC_ID_JAPANESE ::\r\n   *   TT_MAC_ID_TRADITIONAL_CHINESE ::\r\n   *   TT_MAC_ID_KOREAN ::\r\n   *   TT_MAC_ID_ARABIC ::\r\n   *   TT_MAC_ID_HEBREW ::\r\n   *   TT_MAC_ID_GREEK ::\r\n   *   TT_MAC_ID_RUSSIAN ::\r\n   *   TT_MAC_ID_RSYMBOL ::\r\n   *   TT_MAC_ID_DEVANAGARI ::\r\n   *   TT_MAC_ID_GURMUKHI ::\r\n   *   TT_MAC_ID_GUJARATI ::\r\n   *   TT_MAC_ID_ORIYA ::\r\n   *   TT_MAC_ID_BENGALI ::\r\n   *   TT_MAC_ID_TAMIL ::\r\n   *   TT_MAC_ID_TELUGU ::\r\n   *   TT_MAC_ID_KANNADA ::\r\n   *   TT_MAC_ID_MALAYALAM ::\r\n   *   TT_MAC_ID_SINHALESE ::\r\n   *   TT_MAC_ID_BURMESE ::\r\n   *   TT_MAC_ID_KHMER ::\r\n   *   TT_MAC_ID_THAI ::\r\n   *   TT_MAC_ID_LAOTIAN ::\r\n   *   TT_MAC_ID_GEORGIAN ::\r\n   *   TT_MAC_ID_ARMENIAN ::\r\n   *   TT_MAC_ID_MALDIVIAN ::\r\n   *   TT_MAC_ID_SIMPLIFIED_CHINESE ::\r\n   *   TT_MAC_ID_TIBETAN ::\r\n   *   TT_MAC_ID_MONGOLIAN ::\r\n   *   TT_MAC_ID_GEEZ ::\r\n   *   TT_MAC_ID_SLAVIC ::\r\n   *   TT_MAC_ID_VIETNAMESE ::\r\n   *   TT_MAC_ID_SINDHI ::\r\n   *   TT_MAC_ID_UNINTERP ::\r\n   */\r\n\r\n#define TT_MAC_ID_ROMAN                 0\r\n#define TT_MAC_ID_JAPANESE              1\r\n#define TT_MAC_ID_TRADITIONAL_CHINESE   2\r\n#define TT_MAC_ID_KOREAN                3\r\n#define TT_MAC_ID_ARABIC                4\r\n#define TT_MAC_ID_HEBREW                5\r\n#define TT_MAC_ID_GREEK                 6\r\n#define TT_MAC_ID_RUSSIAN               7\r\n#define TT_MAC_ID_RSYMBOL               8\r\n#define TT_MAC_ID_DEVANAGARI            9\r\n#define TT_MAC_ID_GURMUKHI             10\r\n#define TT_MAC_ID_GUJARATI             11\r\n#define TT_MAC_ID_ORIYA                12\r\n#define TT_MAC_ID_BENGALI              13\r\n#define TT_MAC_ID_TAMIL                14\r\n#define TT_MAC_ID_TELUGU               15\r\n#define TT_MAC_ID_KANNADA              16\r\n#define TT_MAC_ID_MALAYALAM            17\r\n#define TT_MAC_ID_SINHALESE            18\r\n#define TT_MAC_ID_BURMESE              19\r\n#define TT_MAC_ID_KHMER                20\r\n#define TT_MAC_ID_THAI                 21\r\n#define TT_MAC_ID_LAOTIAN              22\r\n#define TT_MAC_ID_GEORGIAN             23\r\n#define TT_MAC_ID_ARMENIAN             24\r\n#define TT_MAC_ID_MALDIVIAN            25\r\n#define TT_MAC_ID_SIMPLIFIED_CHINESE   25\r\n#define TT_MAC_ID_TIBETAN              26\r\n#define TT_MAC_ID_MONGOLIAN            27\r\n#define TT_MAC_ID_GEEZ                 28\r\n#define TT_MAC_ID_SLAVIC               29\r\n#define TT_MAC_ID_VIETNAMESE           30\r\n#define TT_MAC_ID_SINDHI               31\r\n#define TT_MAC_ID_UNINTERP             32\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_ISO_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_ISO charmaps and name entries.\r\n   *\r\n   *   Their use is now deprecated.\r\n   *\r\n   * @values:\r\n   *   TT_ISO_ID_7BIT_ASCII ::\r\n   *     ASCII.\r\n   *   TT_ISO_ID_10646 ::\r\n   *     ISO/10646.\r\n   *   TT_ISO_ID_8859_1 ::\r\n   *     Also known as Latin-1.\r\n   */\r\n\r\n#define TT_ISO_ID_7BIT_ASCII  0\r\n#define TT_ISO_ID_10646       1\r\n#define TT_ISO_ID_8859_1      2\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_MS_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_MICROSOFT charmaps and name entries.\r\n   *\r\n   * @values:\r\n   *   TT_MS_ID_SYMBOL_CS ::\r\n   *     Corresponds to Microsoft symbol encoding. See\r\n   *     @FT_ENCODING_MS_SYMBOL.\r\n   *\r\n   *   TT_MS_ID_UNICODE_CS ::\r\n   *     Corresponds to a Microsoft WGL4 charmap, matching Unicode.  See\r\n   *     @FT_ENCODING_UNICODE.\r\n   *\r\n   *   TT_MS_ID_SJIS ::\r\n   *     Corresponds to SJIS Japanese encoding.  See @FT_ENCODING_SJIS.\r\n   *\r\n   *   TT_MS_ID_GB2312 ::\r\n   *     Corresponds to Simplified Chinese as used in Mainland China.  See\r\n   *     @FT_ENCODING_GB2312.\r\n   *\r\n   *   TT_MS_ID_BIG_5 ::\r\n   *     Corresponds to Traditional Chinese as used in Taiwan and Hong Kong.\r\n   *     See @FT_ENCODING_BIG5.\r\n   *\r\n   *   TT_MS_ID_WANSUNG ::\r\n   *     Corresponds to Korean Wansung encoding.  See @FT_ENCODING_WANSUNG.\r\n   *\r\n   *   TT_MS_ID_JOHAB ::\r\n   *     Corresponds to Johab encoding.  See @FT_ENCODING_JOHAB.\r\n   *\r\n   *   TT_MS_ID_UCS_4 ::\r\n   *     Corresponds to UCS-4 or UTF-32 charmaps.  This has been added to\r\n   *     the OpenType specification version 1.4 (mid-2001.)\r\n   */\r\n\r\n#define TT_MS_ID_SYMBOL_CS    0\r\n#define TT_MS_ID_UNICODE_CS   1\r\n#define TT_MS_ID_SJIS         2\r\n#define TT_MS_ID_GB2312       3\r\n#define TT_MS_ID_BIG_5        4\r\n#define TT_MS_ID_WANSUNG      5\r\n#define TT_MS_ID_JOHAB        6\r\n#define TT_MS_ID_UCS_4       10\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_ADOBE_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_ADOBE charmaps.  This is a FreeType-specific extension!\r\n   *\r\n   * @values:\r\n   *   TT_ADOBE_ID_STANDARD ::\r\n   *     Adobe standard encoding.\r\n   *   TT_ADOBE_ID_EXPERT ::\r\n   *     Adobe expert encoding.\r\n   *   TT_ADOBE_ID_CUSTOM ::\r\n   *     Adobe custom encoding.\r\n   *   TT_ADOBE_ID_LATIN_1 ::\r\n   *     Adobe Latin~1 encoding.\r\n   */\r\n\r\n#define TT_ADOBE_ID_STANDARD  0\r\n#define TT_ADOBE_ID_EXPERT    1\r\n#define TT_ADOBE_ID_CUSTOM    2\r\n#define TT_ADOBE_ID_LATIN_1   3\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values of the language identifier field in the name records  */\r\n  /* of the TTF `name' table if the `platform' identifier code is          */\r\n  /* TT_PLATFORM_MACINTOSH.  These values are also used as return values   */\r\n  /* for function @FT_Get_CMap_Language_ID.                                */\r\n  /*                                                                       */\r\n  /* The canonical source for the Apple assigned Language ID's is at       */\r\n  /*                                                                       */\r\n  /*   https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html      */\r\n  /*                                                                       */\r\n#define TT_MAC_LANGID_ENGLISH                       0\r\n#define TT_MAC_LANGID_FRENCH                        1\r\n#define TT_MAC_LANGID_GERMAN                        2\r\n#define TT_MAC_LANGID_ITALIAN                       3\r\n#define TT_MAC_LANGID_DUTCH                         4\r\n#define TT_MAC_LANGID_SWEDISH                       5\r\n#define TT_MAC_LANGID_SPANISH                       6\r\n#define TT_MAC_LANGID_DANISH                        7\r\n#define TT_MAC_LANGID_PORTUGUESE                    8\r\n#define TT_MAC_LANGID_NORWEGIAN                     9\r\n#define TT_MAC_LANGID_HEBREW                       10\r\n#define TT_MAC_LANGID_JAPANESE                     11\r\n#define TT_MAC_LANGID_ARABIC                       12\r\n#define TT_MAC_LANGID_FINNISH                      13\r\n#define TT_MAC_LANGID_GREEK                        14\r\n#define TT_MAC_LANGID_ICELANDIC                    15\r\n#define TT_MAC_LANGID_MALTESE                      16\r\n#define TT_MAC_LANGID_TURKISH                      17\r\n#define TT_MAC_LANGID_CROATIAN                     18\r\n#define TT_MAC_LANGID_CHINESE_TRADITIONAL          19\r\n#define TT_MAC_LANGID_URDU                         20\r\n#define TT_MAC_LANGID_HINDI                        21\r\n#define TT_MAC_LANGID_THAI                         22\r\n#define TT_MAC_LANGID_KOREAN                       23\r\n#define TT_MAC_LANGID_LITHUANIAN                   24\r\n#define TT_MAC_LANGID_POLISH                       25\r\n#define TT_MAC_LANGID_HUNGARIAN                    26\r\n#define TT_MAC_LANGID_ESTONIAN                     27\r\n#define TT_MAC_LANGID_LETTISH                      28\r\n#define TT_MAC_LANGID_SAAMISK                      29\r\n#define TT_MAC_LANGID_FAEROESE                     30\r\n#define TT_MAC_LANGID_FARSI                        31\r\n#define TT_MAC_LANGID_RUSSIAN                      32\r\n#define TT_MAC_LANGID_CHINESE_SIMPLIFIED           33\r\n#define TT_MAC_LANGID_FLEMISH                      34\r\n#define TT_MAC_LANGID_IRISH                        35\r\n#define TT_MAC_LANGID_ALBANIAN                     36\r\n#define TT_MAC_LANGID_ROMANIAN                     37\r\n#define TT_MAC_LANGID_CZECH                        38\r\n#define TT_MAC_LANGID_SLOVAK                       39\r\n#define TT_MAC_LANGID_SLOVENIAN                    40\r\n#define TT_MAC_LANGID_YIDDISH                      41\r\n#define TT_MAC_LANGID_SERBIAN                      42\r\n#define TT_MAC_LANGID_MACEDONIAN                   43\r\n#define TT_MAC_LANGID_BULGARIAN                    44\r\n#define TT_MAC_LANGID_UKRAINIAN                    45\r\n#define TT_MAC_LANGID_BYELORUSSIAN                 46\r\n#define TT_MAC_LANGID_UZBEK                        47\r\n#define TT_MAC_LANGID_KAZAKH                       48\r\n#define TT_MAC_LANGID_AZERBAIJANI                  49\r\n#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT  49\r\n#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT    50\r\n#define TT_MAC_LANGID_ARMENIAN                     51\r\n#define TT_MAC_LANGID_GEORGIAN                     52\r\n#define TT_MAC_LANGID_MOLDAVIAN                    53\r\n#define TT_MAC_LANGID_KIRGHIZ                      54\r\n#define TT_MAC_LANGID_TAJIKI                       55\r\n#define TT_MAC_LANGID_TURKMEN                      56\r\n#define TT_MAC_LANGID_MONGOLIAN                    57\r\n#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT   57\r\n#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT    58\r\n#define TT_MAC_LANGID_PASHTO                       59\r\n#define TT_MAC_LANGID_KURDISH                      60\r\n#define TT_MAC_LANGID_KASHMIRI                     61\r\n#define TT_MAC_LANGID_SINDHI                       62\r\n#define TT_MAC_LANGID_TIBETAN                      63\r\n#define TT_MAC_LANGID_NEPALI                       64\r\n#define TT_MAC_LANGID_SANSKRIT                     65\r\n#define TT_MAC_LANGID_MARATHI                      66\r\n#define TT_MAC_LANGID_BENGALI                      67\r\n#define TT_MAC_LANGID_ASSAMESE                     68\r\n#define TT_MAC_LANGID_GUJARATI                     69\r\n#define TT_MAC_LANGID_PUNJABI                      70\r\n#define TT_MAC_LANGID_ORIYA                        71\r\n#define TT_MAC_LANGID_MALAYALAM                    72\r\n#define TT_MAC_LANGID_KANNADA                      73\r\n#define TT_MAC_LANGID_TAMIL                        74\r\n#define TT_MAC_LANGID_TELUGU                       75\r\n#define TT_MAC_LANGID_SINHALESE                    76\r\n#define TT_MAC_LANGID_BURMESE                      77\r\n#define TT_MAC_LANGID_KHMER                        78\r\n#define TT_MAC_LANGID_LAO                          79\r\n#define TT_MAC_LANGID_VIETNAMESE                   80\r\n#define TT_MAC_LANGID_INDONESIAN                   81\r\n#define TT_MAC_LANGID_TAGALOG                      82\r\n#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT           83\r\n#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT          84\r\n#define TT_MAC_LANGID_AMHARIC                      85\r\n#define TT_MAC_LANGID_TIGRINYA                     86\r\n#define TT_MAC_LANGID_GALLA                        87\r\n#define TT_MAC_LANGID_SOMALI                       88\r\n#define TT_MAC_LANGID_SWAHILI                      89\r\n#define TT_MAC_LANGID_RUANDA                       90\r\n#define TT_MAC_LANGID_RUNDI                        91\r\n#define TT_MAC_LANGID_CHEWA                        92\r\n#define TT_MAC_LANGID_MALAGASY                     93\r\n#define TT_MAC_LANGID_ESPERANTO                    94\r\n#define TT_MAC_LANGID_WELSH                       128\r\n#define TT_MAC_LANGID_BASQUE                      129\r\n#define TT_MAC_LANGID_CATALAN                     130\r\n#define TT_MAC_LANGID_LATIN                       131\r\n#define TT_MAC_LANGID_QUECHUA                     132\r\n#define TT_MAC_LANGID_GUARANI                     133\r\n#define TT_MAC_LANGID_AYMARA                      134\r\n#define TT_MAC_LANGID_TATAR                       135\r\n#define TT_MAC_LANGID_UIGHUR                      136\r\n#define TT_MAC_LANGID_DZONGKHA                    137\r\n#define TT_MAC_LANGID_JAVANESE                    138\r\n#define TT_MAC_LANGID_SUNDANESE                   139\r\n\r\n\r\n#if 0  /* these seem to be errors that have been dropped */\r\n\r\n#define TT_MAC_LANGID_SCOTTISH_GAELIC             140\r\n#define TT_MAC_LANGID_IRISH_GAELIC                141\r\n\r\n#endif\r\n\r\n\r\n  /* The following codes are new as of 2000-03-10 */\r\n#define TT_MAC_LANGID_GALICIAN                    140\r\n#define TT_MAC_LANGID_AFRIKAANS                   141\r\n#define TT_MAC_LANGID_BRETON                      142\r\n#define TT_MAC_LANGID_INUKTITUT                   143\r\n#define TT_MAC_LANGID_SCOTTISH_GAELIC             144\r\n#define TT_MAC_LANGID_MANX_GAELIC                 145\r\n#define TT_MAC_LANGID_IRISH_GAELIC                146\r\n#define TT_MAC_LANGID_TONGAN                      147\r\n#define TT_MAC_LANGID_GREEK_POLYTONIC             148\r\n#define TT_MAC_LANGID_GREELANDIC                  149\r\n#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT    150\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values of the language identifier field in the name records  */\r\n  /* of the TTF `name' table if the `platform' identifier code is          */\r\n  /* TT_PLATFORM_MICROSOFT.                                                */\r\n  /*                                                                       */\r\n  /* The canonical source for the MS assigned LCIDs is                     */\r\n  /*                                                                       */\r\n  /*   http://www.microsoft.com/globaldev/reference/lcid-all.mspx          */\r\n  /*                                                                       */\r\n\r\n#define TT_MS_LANGID_ARABIC_GENERAL                    0x0001\r\n#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA               0x0401\r\n#define TT_MS_LANGID_ARABIC_IRAQ                       0x0801\r\n#define TT_MS_LANGID_ARABIC_EGYPT                      0x0c01\r\n#define TT_MS_LANGID_ARABIC_LIBYA                      0x1001\r\n#define TT_MS_LANGID_ARABIC_ALGERIA                    0x1401\r\n#define TT_MS_LANGID_ARABIC_MOROCCO                    0x1801\r\n#define TT_MS_LANGID_ARABIC_TUNISIA                    0x1c01\r\n#define TT_MS_LANGID_ARABIC_OMAN                       0x2001\r\n#define TT_MS_LANGID_ARABIC_YEMEN                      0x2401\r\n#define TT_MS_LANGID_ARABIC_SYRIA                      0x2801\r\n#define TT_MS_LANGID_ARABIC_JORDAN                     0x2c01\r\n#define TT_MS_LANGID_ARABIC_LEBANON                    0x3001\r\n#define TT_MS_LANGID_ARABIC_KUWAIT                     0x3401\r\n#define TT_MS_LANGID_ARABIC_UAE                        0x3801\r\n#define TT_MS_LANGID_ARABIC_BAHRAIN                    0x3c01\r\n#define TT_MS_LANGID_ARABIC_QATAR                      0x4001\r\n#define TT_MS_LANGID_BULGARIAN_BULGARIA                0x0402\r\n#define TT_MS_LANGID_CATALAN_SPAIN                     0x0403\r\n#define TT_MS_LANGID_CHINESE_GENERAL                   0x0004\r\n#define TT_MS_LANGID_CHINESE_TAIWAN                    0x0404\r\n#define TT_MS_LANGID_CHINESE_PRC                       0x0804\r\n#define TT_MS_LANGID_CHINESE_HONG_KONG                 0x0c04\r\n#define TT_MS_LANGID_CHINESE_SINGAPORE                 0x1004\r\n\r\n#if 1  /* this looks like the correct value */\r\n#define TT_MS_LANGID_CHINESE_MACAU                     0x1404\r\n#else  /* but beware, Microsoft may change its mind...\r\n          the most recent Word reference has the following: */\r\n#define TT_MS_LANGID_CHINESE_MACAU  TT_MS_LANGID_CHINESE_HONG_KONG\r\n#endif\r\n\r\n#if 0  /* used only with .NET `cultures'; commented out */\r\n#define TT_MS_LANGID_CHINESE_TRADITIONAL               0x7C04\r\n#endif\r\n\r\n#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC              0x0405\r\n#define TT_MS_LANGID_DANISH_DENMARK                    0x0406\r\n#define TT_MS_LANGID_GERMAN_GERMANY                    0x0407\r\n#define TT_MS_LANGID_GERMAN_SWITZERLAND                0x0807\r\n#define TT_MS_LANGID_GERMAN_AUSTRIA                    0x0c07\r\n#define TT_MS_LANGID_GERMAN_LUXEMBOURG                 0x1007\r\n#define TT_MS_LANGID_GERMAN_LIECHTENSTEI               0x1407\r\n#define TT_MS_LANGID_GREEK_GREECE                      0x0408\r\n\r\n  /* don't ask what this one means... It is commented out currently. */\r\n#if 0\r\n#define TT_MS_LANGID_GREEK_GREECE2                     0x2008\r\n#endif\r\n\r\n#define TT_MS_LANGID_ENGLISH_GENERAL                   0x0009\r\n#define TT_MS_LANGID_ENGLISH_UNITED_STATES             0x0409\r\n#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM            0x0809\r\n#define TT_MS_LANGID_ENGLISH_AUSTRALIA                 0x0c09\r\n#define TT_MS_LANGID_ENGLISH_CANADA                    0x1009\r\n#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND               0x1409\r\n#define TT_MS_LANGID_ENGLISH_IRELAND                   0x1809\r\n#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA              0x1c09\r\n#define TT_MS_LANGID_ENGLISH_JAMAICA                   0x2009\r\n#define TT_MS_LANGID_ENGLISH_CARIBBEAN                 0x2409\r\n#define TT_MS_LANGID_ENGLISH_BELIZE                    0x2809\r\n#define TT_MS_LANGID_ENGLISH_TRINIDAD                  0x2c09\r\n#define TT_MS_LANGID_ENGLISH_ZIMBABWE                  0x3009\r\n#define TT_MS_LANGID_ENGLISH_PHILIPPINES               0x3409\r\n#define TT_MS_LANGID_ENGLISH_INDONESIA                 0x3809\r\n#define TT_MS_LANGID_ENGLISH_HONG_KONG                 0x3c09\r\n#define TT_MS_LANGID_ENGLISH_INDIA                     0x4009\r\n#define TT_MS_LANGID_ENGLISH_MALAYSIA                  0x4409\r\n#define TT_MS_LANGID_ENGLISH_SINGAPORE                 0x4809\r\n#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT    0x040a\r\n#define TT_MS_LANGID_SPANISH_MEXICO                    0x080a\r\n#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT  0x0c0a\r\n#define TT_MS_LANGID_SPANISH_GUATEMALA                 0x100a\r\n#define TT_MS_LANGID_SPANISH_COSTA_RICA                0x140a\r\n#define TT_MS_LANGID_SPANISH_PANAMA                    0x180a\r\n#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC        0x1c0a\r\n#define TT_MS_LANGID_SPANISH_VENEZUELA                 0x200a\r\n#define TT_MS_LANGID_SPANISH_COLOMBIA                  0x240a\r\n#define TT_MS_LANGID_SPANISH_PERU                      0x280a\r\n#define TT_MS_LANGID_SPANISH_ARGENTINA                 0x2c0a\r\n#define TT_MS_LANGID_SPANISH_ECUADOR                   0x300a\r\n#define TT_MS_LANGID_SPANISH_CHILE                     0x340a\r\n#define TT_MS_LANGID_SPANISH_URUGUAY                   0x380a\r\n#define TT_MS_LANGID_SPANISH_PARAGUAY                  0x3c0a\r\n#define TT_MS_LANGID_SPANISH_BOLIVIA                   0x400a\r\n#define TT_MS_LANGID_SPANISH_EL_SALVADOR               0x440a\r\n#define TT_MS_LANGID_SPANISH_HONDURAS                  0x480a\r\n#define TT_MS_LANGID_SPANISH_NICARAGUA                 0x4c0a\r\n#define TT_MS_LANGID_SPANISH_PUERTO_RICO               0x500a\r\n#define TT_MS_LANGID_SPANISH_UNITED_STATES             0x540a\r\n  /* The following ID blatantly violate MS specs by using a */\r\n  /* sublanguage > 0x1F.                                    */\r\n#define TT_MS_LANGID_SPANISH_LATIN_AMERICA             0xE40aU\r\n#define TT_MS_LANGID_FINNISH_FINLAND                   0x040b\r\n#define TT_MS_LANGID_FRENCH_FRANCE                     0x040c\r\n#define TT_MS_LANGID_FRENCH_BELGIUM                    0x080c\r\n#define TT_MS_LANGID_FRENCH_CANADA                     0x0c0c\r\n#define TT_MS_LANGID_FRENCH_SWITZERLAND                0x100c\r\n#define TT_MS_LANGID_FRENCH_LUXEMBOURG                 0x140c\r\n#define TT_MS_LANGID_FRENCH_MONACO                     0x180c\r\n#define TT_MS_LANGID_FRENCH_WEST_INDIES                0x1c0c\r\n#define TT_MS_LANGID_FRENCH_REUNION                    0x200c\r\n#define TT_MS_LANGID_FRENCH_CONGO                      0x240c\r\n  /* which was formerly: */\r\n#define TT_MS_LANGID_FRENCH_ZAIRE  TT_MS_LANGID_FRENCH_CONGO\r\n#define TT_MS_LANGID_FRENCH_SENEGAL                    0x280c\r\n#define TT_MS_LANGID_FRENCH_CAMEROON                   0x2c0c\r\n#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE              0x300c\r\n#define TT_MS_LANGID_FRENCH_MALI                       0x340c\r\n#define TT_MS_LANGID_FRENCH_MOROCCO                    0x380c\r\n#define TT_MS_LANGID_FRENCH_HAITI                      0x3c0c\r\n  /* and another violation of the spec (see 0xE40aU) */\r\n#define TT_MS_LANGID_FRENCH_NORTH_AFRICA               0xE40cU\r\n#define TT_MS_LANGID_HEBREW_ISRAEL                     0x040d\r\n#define TT_MS_LANGID_HUNGARIAN_HUNGARY                 0x040e\r\n#define TT_MS_LANGID_ICELANDIC_ICELAND                 0x040f\r\n#define TT_MS_LANGID_ITALIAN_ITALY                     0x0410\r\n#define TT_MS_LANGID_ITALIAN_SWITZERLAND               0x0810\r\n#define TT_MS_LANGID_JAPANESE_JAPAN                    0x0411\r\n#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA     0x0412\r\n#define TT_MS_LANGID_KOREAN_JOHAB_KOREA                0x0812\r\n#define TT_MS_LANGID_DUTCH_NETHERLANDS                 0x0413\r\n#define TT_MS_LANGID_DUTCH_BELGIUM                     0x0813\r\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL           0x0414\r\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK          0x0814\r\n#define TT_MS_LANGID_POLISH_POLAND                     0x0415\r\n#define TT_MS_LANGID_PORTUGUESE_BRAZIL                 0x0416\r\n#define TT_MS_LANGID_PORTUGUESE_PORTUGAL               0x0816\r\n#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND        0x0417\r\n#define TT_MS_LANGID_ROMANIAN_ROMANIA                  0x0418\r\n#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA                0x0818\r\n#define TT_MS_LANGID_RUSSIAN_RUSSIA                    0x0419\r\n#define TT_MS_LANGID_RUSSIAN_MOLDAVIA                  0x0819\r\n#define TT_MS_LANGID_CROATIAN_CROATIA                  0x041a\r\n#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN              0x081a\r\n#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC           0x0c1a\r\n\r\n#if 0  /* this used to be this value, but it looks like we were wrong */\r\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA        0x101a\r\n#else  /* current sources say */\r\n#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA       0x101a\r\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA        0x141a\r\n       /* and XPsp2 Platform SDK added (2004-07-26) */\r\n       /* Names are shortened to be significant within 40 chars. */\r\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN         0x181a\r\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC      0x181a\r\n#endif\r\n\r\n#define TT_MS_LANGID_SLOVAK_SLOVAKIA                   0x041b\r\n#define TT_MS_LANGID_ALBANIAN_ALBANIA                  0x041c\r\n#define TT_MS_LANGID_SWEDISH_SWEDEN                    0x041d\r\n#define TT_MS_LANGID_SWEDISH_FINLAND                   0x081d\r\n#define TT_MS_LANGID_THAI_THAILAND                     0x041e\r\n#define TT_MS_LANGID_TURKISH_TURKEY                    0x041f\r\n#define TT_MS_LANGID_URDU_PAKISTAN                     0x0420\r\n#define TT_MS_LANGID_URDU_INDIA                        0x0820\r\n#define TT_MS_LANGID_INDONESIAN_INDONESIA              0x0421\r\n#define TT_MS_LANGID_UKRAINIAN_UKRAINE                 0x0422\r\n#define TT_MS_LANGID_BELARUSIAN_BELARUS                0x0423\r\n#define TT_MS_LANGID_SLOVENE_SLOVENIA                  0x0424\r\n#define TT_MS_LANGID_ESTONIAN_ESTONIA                  0x0425\r\n#define TT_MS_LANGID_LATVIAN_LATVIA                    0x0426\r\n#define TT_MS_LANGID_LITHUANIAN_LITHUANIA              0x0427\r\n#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA      0x0827\r\n#define TT_MS_LANGID_TAJIK_TAJIKISTAN                  0x0428\r\n#define TT_MS_LANGID_FARSI_IRAN                        0x0429\r\n#define TT_MS_LANGID_VIETNAMESE_VIET_NAM               0x042a\r\n#define TT_MS_LANGID_ARMENIAN_ARMENIA                  0x042b\r\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN            0x042c\r\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC         0x082c\r\n#define TT_MS_LANGID_BASQUE_SPAIN                      0x042d\r\n#define TT_MS_LANGID_SORBIAN_GERMANY                   0x042e\r\n#define TT_MS_LANGID_MACEDONIAN_MACEDONIA              0x042f\r\n#define TT_MS_LANGID_SUTU_SOUTH_AFRICA                 0x0430\r\n#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA               0x0431\r\n#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA               0x0432\r\n#define TT_MS_LANGID_VENDA_SOUTH_AFRICA                0x0433\r\n#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA                0x0434\r\n#define TT_MS_LANGID_ZULU_SOUTH_AFRICA                 0x0435\r\n#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA            0x0436\r\n#define TT_MS_LANGID_GEORGIAN_GEORGIA                  0x0437\r\n#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS           0x0438\r\n#define TT_MS_LANGID_HINDI_INDIA                       0x0439\r\n#define TT_MS_LANGID_MALTESE_MALTA                     0x043a\r\n  /* Added by XPsp2 Platform SDK (2004-07-26) */\r\n#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY              0x043b\r\n#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN              0x083b\r\n#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND             0x0C3b\r\n#define TT_MS_LANGID_SAMI_LULE_NORWAY                  0x103b\r\n#define TT_MS_LANGID_SAMI_LULE_SWEDEN                  0x143b\r\n#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY              0x183b\r\n#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN              0x1C3b\r\n#define TT_MS_LANGID_SAMI_SKOLT_FINLAND                0x203b\r\n#define TT_MS_LANGID_SAMI_INARI_FINLAND                0x243b\r\n  /* ... and we also keep our old identifier... */\r\n#define TT_MS_LANGID_SAAMI_LAPONIA                     0x043b\r\n\r\n#if 0 /* this seems to be a previous inversion */\r\n#define TT_MS_LANGID_IRISH_GAELIC_IRELAND              0x043c\r\n#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM    0x083c\r\n#else\r\n#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM    0x083c\r\n#define TT_MS_LANGID_IRISH_GAELIC_IRELAND              0x043c\r\n#endif\r\n\r\n#define TT_MS_LANGID_YIDDISH_GERMANY                   0x043d\r\n#define TT_MS_LANGID_MALAY_MALAYSIA                    0x043e\r\n#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM           0x083e\r\n#define TT_MS_LANGID_KAZAK_KAZAKSTAN                   0x043f\r\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440\r\n  /* alias declared in Windows 2000 */\r\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \\\r\n          TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN\r\n\r\n#define TT_MS_LANGID_SWAHILI_KENYA                     0x0441\r\n#define TT_MS_LANGID_TURKMEN_TURKMENISTAN              0x0442\r\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN            0x0443\r\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC         0x0843\r\n#define TT_MS_LANGID_TATAR_TATARSTAN                   0x0444\r\n#define TT_MS_LANGID_BENGALI_INDIA                     0x0445\r\n#define TT_MS_LANGID_BENGALI_BANGLADESH                0x0845\r\n#define TT_MS_LANGID_PUNJABI_INDIA                     0x0446\r\n#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN           0x0846\r\n#define TT_MS_LANGID_GUJARATI_INDIA                    0x0447\r\n#define TT_MS_LANGID_ORIYA_INDIA                       0x0448\r\n#define TT_MS_LANGID_TAMIL_INDIA                       0x0449\r\n#define TT_MS_LANGID_TELUGU_INDIA                      0x044a\r\n#define TT_MS_LANGID_KANNADA_INDIA                     0x044b\r\n#define TT_MS_LANGID_MALAYALAM_INDIA                   0x044c\r\n#define TT_MS_LANGID_ASSAMESE_INDIA                    0x044d\r\n#define TT_MS_LANGID_MARATHI_INDIA                     0x044e\r\n#define TT_MS_LANGID_SANSKRIT_INDIA                    0x044f\r\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450\r\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN      0x0850\r\n#define TT_MS_LANGID_TIBETAN_CHINA                     0x0451\r\n  /* Don't use the next constant!  It has            */\r\n  /*   (1) the wrong spelling (Dzonghka)             */\r\n  /*   (2) Microsoft doesn't officially define it -- */\r\n  /*       at least it is not in the List of Local   */\r\n  /*       ID Values.                                */\r\n  /*   (3) Dzongkha is not the same language as      */\r\n  /*       Tibetan, so merging it is wrong anyway.   */\r\n  /*                                                 */\r\n  /* TT_MS_LANGID_TIBETAN_BHUTAN is correct, BTW.    */\r\n#define TT_MS_LANGID_DZONGHKA_BHUTAN                   0x0851\r\n\r\n#if 0\r\n  /* the following used to be defined */\r\n#define TT_MS_LANGID_TIBETAN_BHUTAN                    0x0451\r\n  /* ... but it was changed; */\r\n#else\r\n  /* So we will continue to #define it, but with the correct value */\r\n#define TT_MS_LANGID_TIBETAN_BHUTAN   TT_MS_LANGID_DZONGHKA_BHUTAN\r\n#endif\r\n\r\n#define TT_MS_LANGID_WELSH_WALES                       0x0452\r\n#define TT_MS_LANGID_KHMER_CAMBODIA                    0x0453\r\n#define TT_MS_LANGID_LAO_LAOS                          0x0454\r\n#define TT_MS_LANGID_BURMESE_MYANMAR                   0x0455\r\n#define TT_MS_LANGID_GALICIAN_SPAIN                    0x0456\r\n#define TT_MS_LANGID_KONKANI_INDIA                     0x0457\r\n#define TT_MS_LANGID_MANIPURI_INDIA  /* Bengali */     0x0458\r\n#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */         0x0459\r\n#define TT_MS_LANGID_SINDHI_PAKISTAN                   0x0859\r\n  /* Missing a LCID for Sindhi in Devanagari script */\r\n#define TT_MS_LANGID_SYRIAC_SYRIA                      0x045a\r\n#define TT_MS_LANGID_SINHALESE_SRI_LANKA               0x045b\r\n#define TT_MS_LANGID_CHEROKEE_UNITED_STATES            0x045c\r\n#define TT_MS_LANGID_INUKTITUT_CANADA                  0x045d\r\n#define TT_MS_LANGID_AMHARIC_ETHIOPIA                  0x045e\r\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */    0x045f\r\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN           0x085f\r\n  /* Missing a LCID for Tifinagh script */\r\n#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */    0x0460\r\n  /* Spelled this way by XPsp2 Platform SDK (2004-07-26) */\r\n  /* script is yet unclear... might be Arabic, Nagari or Sharada */\r\n#define TT_MS_LANGID_KASHMIRI_SASIA                    0x0860\r\n  /* ... and aliased (by MS) for compatibility reasons. */\r\n#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA\r\n#define TT_MS_LANGID_NEPALI_NEPAL                      0x0461\r\n#define TT_MS_LANGID_NEPALI_INDIA                      0x0861\r\n#define TT_MS_LANGID_FRISIAN_NETHERLANDS               0x0462\r\n#define TT_MS_LANGID_PASHTO_AFGHANISTAN                0x0463\r\n#define TT_MS_LANGID_FILIPINO_PHILIPPINES              0x0464\r\n#define TT_MS_LANGID_DHIVEHI_MALDIVES                  0x0465\r\n  /* alias declared in Windows 2000 */\r\n#define TT_MS_LANGID_DIVEHI_MALDIVES  TT_MS_LANGID_DHIVEHI_MALDIVES\r\n#define TT_MS_LANGID_EDO_NIGERIA                       0x0466\r\n#define TT_MS_LANGID_FULFULDE_NIGERIA                  0x0467\r\n#define TT_MS_LANGID_HAUSA_NIGERIA                     0x0468\r\n#define TT_MS_LANGID_IBIBIO_NIGERIA                    0x0469\r\n#define TT_MS_LANGID_YORUBA_NIGERIA                    0x046a\r\n#define TT_MS_LANGID_QUECHUA_BOLIVIA                   0x046b\r\n#define TT_MS_LANGID_QUECHUA_ECUADOR                   0x086b\r\n#define TT_MS_LANGID_QUECHUA_PERU                      0x0c6b\r\n#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA               0x046c\r\n  /* Also spelled by XPsp2 Platform SDK (2004-07-26) */\r\n#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \\\r\n          TT_MS_LANGID_SEPEDI_SOUTH_AFRICA\r\n  /* language codes 0x046d, 0x046e and 0x046f are (still) unknown. */\r\n#define TT_MS_LANGID_IGBO_NIGERIA                      0x0470\r\n#define TT_MS_LANGID_KANURI_NIGERIA                    0x0471\r\n#define TT_MS_LANGID_OROMO_ETHIOPIA                    0x0472\r\n#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA                 0x0473\r\n#define TT_MS_LANGID_TIGRIGNA_ERYTHREA                 0x0873\r\n  /* also spelled in the `Passport SDK' list as: */\r\n#define TT_MS_LANGID_TIGRIGNA_ERYTREA  TT_MS_LANGID_TIGRIGNA_ERYTHREA\r\n#define TT_MS_LANGID_GUARANI_PARAGUAY                  0x0474\r\n#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES            0x0475\r\n#define TT_MS_LANGID_LATIN                             0x0476\r\n#define TT_MS_LANGID_SOMALI_SOMALIA                    0x0477\r\n  /* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */\r\n  /*       not written (but OTOH the peculiar writing system is worth     */\r\n  /*       studying).                                                     */\r\n#define TT_MS_LANGID_YI_CHINA                          0x0478\r\n#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES   0x0479\r\n  /* language codes from 0x047a to 0x047f are (still) unknown. */\r\n#define TT_MS_LANGID_UIGHUR_CHINA                      0x0480\r\n#define TT_MS_LANGID_MAORI_NEW_ZEALAND                 0x0481\r\n\r\n#if 0  /* not deemed useful for fonts */\r\n#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE            0x04ff\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values of the `name' identifier field in the name records of */\r\n  /* the TTF `name' table.  These values are platform independent.         */\r\n  /*                                                                       */\r\n#define TT_NAME_ID_COPYRIGHT            0\r\n#define TT_NAME_ID_FONT_FAMILY          1\r\n#define TT_NAME_ID_FONT_SUBFAMILY       2\r\n#define TT_NAME_ID_UNIQUE_ID            3\r\n#define TT_NAME_ID_FULL_NAME            4\r\n#define TT_NAME_ID_VERSION_STRING       5\r\n#define TT_NAME_ID_PS_NAME              6\r\n#define TT_NAME_ID_TRADEMARK            7\r\n\r\n  /* the following values are from the OpenType spec */\r\n#define TT_NAME_ID_MANUFACTURER         8\r\n#define TT_NAME_ID_DESIGNER             9\r\n#define TT_NAME_ID_DESCRIPTION          10\r\n#define TT_NAME_ID_VENDOR_URL           11\r\n#define TT_NAME_ID_DESIGNER_URL         12\r\n#define TT_NAME_ID_LICENSE              13\r\n#define TT_NAME_ID_LICENSE_URL          14\r\n  /* number 15 is reserved */\r\n#define TT_NAME_ID_PREFERRED_FAMILY     16\r\n#define TT_NAME_ID_PREFERRED_SUBFAMILY  17\r\n#define TT_NAME_ID_MAC_FULL_NAME        18\r\n\r\n  /* The following code is new as of 2000-01-21 */\r\n#define TT_NAME_ID_SAMPLE_TEXT          19\r\n\r\n  /* This is new in OpenType 1.3 */\r\n#define TT_NAME_ID_CID_FINDFONT_NAME    20\r\n\r\n  /* This is new in OpenType 1.5 */\r\n#define TT_NAME_ID_WWS_FAMILY           21\r\n#define TT_NAME_ID_WWS_SUBFAMILY        22\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table.     */\r\n  /*                                                                       */\r\n  /* Updated 08-Nov-2008.                                                  */\r\n  /*                                                                       */\r\n\r\n  /* Bit  0   Basic Latin */\r\n#define TT_UCR_BASIC_LATIN                     (1L <<  0) /* U+0020-U+007E */\r\n  /* Bit  1   C1 Controls and Latin-1 Supplement */\r\n#define TT_UCR_LATIN1_SUPPLEMENT               (1L <<  1) /* U+0080-U+00FF */\r\n  /* Bit  2   Latin Extended-A */\r\n#define TT_UCR_LATIN_EXTENDED_A                (1L <<  2) /* U+0100-U+017F */\r\n  /* Bit  3   Latin Extended-B */\r\n#define TT_UCR_LATIN_EXTENDED_B                (1L <<  3) /* U+0180-U+024F */\r\n  /* Bit  4   IPA Extensions                 */\r\n  /*          Phonetic Extensions            */\r\n  /*          Phonetic Extensions Supplement */\r\n#define TT_UCR_IPA_EXTENSIONS                  (1L <<  4) /* U+0250-U+02AF */\r\n                                                          /* U+1D00-U+1D7F */\r\n                                                          /* U+1D80-U+1DBF */\r\n  /* Bit  5   Spacing Modifier Letters */\r\n  /*          Modifier Tone Letters    */\r\n#define TT_UCR_SPACING_MODIFIER                (1L <<  5) /* U+02B0-U+02FF */\r\n                                                          /* U+A700-U+A71F */\r\n  /* Bit  6   Combining Diacritical Marks            */\r\n  /*          Combining Diacritical Marks Supplement */\r\n#define TT_UCR_COMBINING_DIACRITICS            (1L <<  6) /* U+0300-U+036F */\r\n                                                          /* U+1DC0-U+1DFF */\r\n  /* Bit  7   Greek and Coptic */\r\n#define TT_UCR_GREEK                           (1L <<  7) /* U+0370-U+03FF */\r\n  /* Bit  8   Coptic */\r\n#define TT_UCR_COPTIC                          (1L <<  8) /* U+2C80-U+2CFF */\r\n  /* Bit  9   Cyrillic            */\r\n  /*          Cyrillic Supplement */\r\n  /*          Cyrillic Extended-A */\r\n  /*          Cyrillic Extended-B */\r\n#define TT_UCR_CYRILLIC                        (1L <<  9) /* U+0400-U+04FF */\r\n                                                          /* U+0500-U+052F */\r\n                                                          /* U+2DE0-U+2DFF */\r\n                                                          /* U+A640-U+A69F */\r\n  /* Bit 10   Armenian */\r\n#define TT_UCR_ARMENIAN                        (1L << 10) /* U+0530-U+058F */\r\n  /* Bit 11   Hebrew */\r\n#define TT_UCR_HEBREW                          (1L << 11) /* U+0590-U+05FF */\r\n  /* Bit 12   Vai */\r\n#define TT_UCR_VAI                             (1L << 12) /* U+A500-U+A63F */\r\n  /* Bit 13   Arabic            */\r\n  /*          Arabic Supplement */\r\n#define TT_UCR_ARABIC                          (1L << 13) /* U+0600-U+06FF */\r\n                                                          /* U+0750-U+077F */\r\n  /* Bit 14   NKo */\r\n#define TT_UCR_NKO                             (1L << 14) /* U+07C0-U+07FF */\r\n  /* Bit 15   Devanagari */\r\n#define TT_UCR_DEVANAGARI                      (1L << 15) /* U+0900-U+097F */\r\n  /* Bit 16   Bengali */\r\n#define TT_UCR_BENGALI                         (1L << 16) /* U+0980-U+09FF */\r\n  /* Bit 17   Gurmukhi */\r\n#define TT_UCR_GURMUKHI                        (1L << 17) /* U+0A00-U+0A7F */\r\n  /* Bit 18   Gujarati */\r\n#define TT_UCR_GUJARATI                        (1L << 18) /* U+0A80-U+0AFF */\r\n  /* Bit 19   Oriya */\r\n#define TT_UCR_ORIYA                           (1L << 19) /* U+0B00-U+0B7F */\r\n  /* Bit 20   Tamil */\r\n#define TT_UCR_TAMIL                           (1L << 20) /* U+0B80-U+0BFF */\r\n  /* Bit 21   Telugu */\r\n#define TT_UCR_TELUGU                          (1L << 21) /* U+0C00-U+0C7F */\r\n  /* Bit 22   Kannada */\r\n#define TT_UCR_KANNADA                         (1L << 22) /* U+0C80-U+0CFF */\r\n  /* Bit 23   Malayalam */\r\n#define TT_UCR_MALAYALAM                       (1L << 23) /* U+0D00-U+0D7F */\r\n  /* Bit 24   Thai */\r\n#define TT_UCR_THAI                            (1L << 24) /* U+0E00-U+0E7F */\r\n  /* Bit 25   Lao */\r\n#define TT_UCR_LAO                             (1L << 25) /* U+0E80-U+0EFF */\r\n  /* Bit 26   Georgian            */\r\n  /*          Georgian Supplement */\r\n#define TT_UCR_GEORGIAN                        (1L << 26) /* U+10A0-U+10FF */\r\n                                                          /* U+2D00-U+2D2F */\r\n  /* Bit 27   Balinese */\r\n#define TT_UCR_BALINESE                        (1L << 27) /* U+1B00-U+1B7F */\r\n  /* Bit 28   Hangul Jamo */\r\n#define TT_UCR_HANGUL_JAMO                     (1L << 28) /* U+1100-U+11FF */\r\n  /* Bit 29   Latin Extended Additional */\r\n  /*          Latin Extended-C          */\r\n  /*          Latin Extended-D          */\r\n#define TT_UCR_LATIN_EXTENDED_ADDITIONAL       (1L << 29) /* U+1E00-U+1EFF */\r\n                                                          /* U+2C60-U+2C7F */\r\n                                                          /* U+A720-U+A7FF */\r\n  /* Bit 30   Greek Extended */\r\n#define TT_UCR_GREEK_EXTENDED                  (1L << 30) /* U+1F00-U+1FFF */\r\n  /* Bit 31   General Punctuation      */\r\n  /*          Supplemental Punctuation */\r\n#define TT_UCR_GENERAL_PUNCTUATION             (1L << 31) /* U+2000-U+206F */\r\n                                                          /* U+2E00-U+2E7F */\r\n  /* Bit 32   Superscripts And Subscripts */\r\n#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS         (1L <<  0) /* U+2070-U+209F */\r\n  /* Bit 33   Currency Symbols */\r\n#define TT_UCR_CURRENCY_SYMBOLS                (1L <<  1) /* U+20A0-U+20CF */\r\n  /* Bit 34   Combining Diacritical Marks For Symbols */\r\n#define TT_UCR_COMBINING_DIACRITICS_SYMB       (1L <<  2) /* U+20D0-U+20FF */\r\n  /* Bit 35   Letterlike Symbols */\r\n#define TT_UCR_LETTERLIKE_SYMBOLS              (1L <<  3) /* U+2100-U+214F */\r\n  /* Bit 36   Number Forms */\r\n#define TT_UCR_NUMBER_FORMS                    (1L <<  4) /* U+2150-U+218F */\r\n  /* Bit 37   Arrows                           */\r\n  /*          Supplemental Arrows-A            */\r\n  /*          Supplemental Arrows-B            */\r\n  /*          Miscellaneous Symbols and Arrows */\r\n#define TT_UCR_ARROWS                          (1L <<  5) /* U+2190-U+21FF */\r\n                                                          /* U+27F0-U+27FF */\r\n                                                          /* U+2900-U+297F */\r\n                                                          /* U+2B00-U+2BFF */\r\n  /* Bit 38   Mathematical Operators               */\r\n  /*          Supplemental Mathematical Operators  */\r\n  /*          Miscellaneous Mathematical Symbols-A */\r\n  /*          Miscellaneous Mathematical Symbols-B */\r\n#define TT_UCR_MATHEMATICAL_OPERATORS          (1L <<  6) /* U+2200-U+22FF */\r\n                                                          /* U+2A00-U+2AFF */\r\n                                                          /* U+27C0-U+27EF */\r\n                                                          /* U+2980-U+29FF */\r\n  /* Bit 39 Miscellaneous Technical */\r\n#define TT_UCR_MISCELLANEOUS_TECHNICAL         (1L <<  7) /* U+2300-U+23FF */\r\n  /* Bit 40   Control Pictures */\r\n#define TT_UCR_CONTROL_PICTURES                (1L <<  8) /* U+2400-U+243F */\r\n  /* Bit 41   Optical Character Recognition */\r\n#define TT_UCR_OCR                             (1L <<  9) /* U+2440-U+245F */\r\n  /* Bit 42   Enclosed Alphanumerics */\r\n#define TT_UCR_ENCLOSED_ALPHANUMERICS          (1L << 10) /* U+2460-U+24FF */\r\n  /* Bit 43   Box Drawing */\r\n#define TT_UCR_BOX_DRAWING                     (1L << 11) /* U+2500-U+257F */\r\n  /* Bit 44   Block Elements */\r\n#define TT_UCR_BLOCK_ELEMENTS                  (1L << 12) /* U+2580-U+259F */\r\n  /* Bit 45   Geometric Shapes */\r\n#define TT_UCR_GEOMETRIC_SHAPES                (1L << 13) /* U+25A0-U+25FF */\r\n  /* Bit 46   Miscellaneous Symbols */\r\n#define TT_UCR_MISCELLANEOUS_SYMBOLS           (1L << 14) /* U+2600-U+26FF */\r\n  /* Bit 47   Dingbats */\r\n#define TT_UCR_DINGBATS                        (1L << 15) /* U+2700-U+27BF */\r\n  /* Bit 48   CJK Symbols and Punctuation */\r\n#define TT_UCR_CJK_SYMBOLS                     (1L << 16) /* U+3000-U+303F */\r\n  /* Bit 49   Hiragana */\r\n#define TT_UCR_HIRAGANA                        (1L << 17) /* U+3040-U+309F */\r\n  /* Bit 50   Katakana                     */\r\n  /*          Katakana Phonetic Extensions */\r\n#define TT_UCR_KATAKANA                        (1L << 18) /* U+30A0-U+30FF */\r\n                                                          /* U+31F0-U+31FF */\r\n  /* Bit 51   Bopomofo          */\r\n  /*          Bopomofo Extended */\r\n#define TT_UCR_BOPOMOFO                        (1L << 19) /* U+3100-U+312F */\r\n                                                          /* U+31A0-U+31BF */\r\n  /* Bit 52   Hangul Compatibility Jamo */\r\n#define TT_UCR_HANGUL_COMPATIBILITY_JAMO       (1L << 20) /* U+3130-U+318F */\r\n  /* Bit 53   Phags-Pa */\r\n#define TT_UCR_CJK_MISC                        (1L << 21) /* U+A840-U+A87F */\r\n#define TT_UCR_KANBUN  TT_UCR_CJK_MISC /* deprecated */\r\n#define TT_UCR_PHAGSPA\r\n  /* Bit 54   Enclosed CJK Letters and Months */\r\n#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS     (1L << 22) /* U+3200-U+32FF */\r\n  /* Bit 55   CJK Compatibility */\r\n#define TT_UCR_CJK_COMPATIBILITY               (1L << 23) /* U+3300-U+33FF */\r\n  /* Bit 56   Hangul Syllables */\r\n#define TT_UCR_HANGUL                          (1L << 24) /* U+AC00-U+D7A3 */\r\n  /* Bit 57   High Surrogates              */\r\n  /*          High Private Use Surrogates  */\r\n  /*          Low Surrogates               */\r\n  /*                                       */\r\n  /* According to OpenType specs v.1.3+,   */\r\n  /* setting bit 57 implies that there is  */\r\n  /* at least one codepoint beyond the     */\r\n  /* Basic Multilingual Plane that is      */\r\n  /* supported by this font.  So it really */\r\n  /* means >= U+10000                      */\r\n#define TT_UCR_SURROGATES                      (1L << 25) /* U+D800-U+DB7F */\r\n                                                          /* U+DB80-U+DBFF */\r\n                                                          /* U+DC00-U+DFFF */\r\n#define TT_UCR_NON_PLANE_0  TT_UCR_SURROGATES\r\n  /* Bit 58  Phoenician */\r\n#define TT_UCR_PHOENICIAN                      (1L << 26) /*U+10900-U+1091F*/\r\n  /* Bit 59   CJK Unified Ideographs             */\r\n  /*          CJK Radicals Supplement            */\r\n  /*          Kangxi Radicals                    */\r\n  /*          Ideographic Description Characters */\r\n  /*          CJK Unified Ideographs Extension A */\r\n  /*          CJK Unified Ideographs Extension B */\r\n  /*          Kanbun                             */\r\n#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS          (1L << 27) /* U+4E00-U+9FFF */\r\n                                                          /* U+2E80-U+2EFF */\r\n                                                          /* U+2F00-U+2FDF */\r\n                                                          /* U+2FF0-U+2FFF */\r\n                                                          /* U+3400-U+4DB5 */\r\n                                                          /*U+20000-U+2A6DF*/\r\n                                                          /* U+3190-U+319F */\r\n  /* Bit 60   Private Use */\r\n#define TT_UCR_PRIVATE_USE                     (1L << 28) /* U+E000-U+F8FF */\r\n  /* Bit 61   CJK Strokes                             */\r\n  /*          CJK Compatibility Ideographs            */\r\n  /*          CJK Compatibility Ideographs Supplement */\r\n#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS    (1L << 29) /* U+31C0-U+31EF */\r\n                                                          /* U+F900-U+FAFF */\r\n                                                          /*U+2F800-U+2FA1F*/\r\n  /* Bit 62   Alphabetic Presentation Forms */\r\n#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS   (1L << 30) /* U+FB00-U+FB4F */\r\n  /* Bit 63   Arabic Presentation Forms-A */\r\n#define TT_UCR_ARABIC_PRESENTATIONS_A          (1L << 31) /* U+FB50-U+FDFF */\r\n  /* Bit 64   Combining Half Marks */\r\n#define TT_UCR_COMBINING_HALF_MARKS            (1L <<  0) /* U+FE20-U+FE2F */\r\n  /* Bit 65   Vertical forms          */\r\n  /*          CJK Compatibility Forms */\r\n#define TT_UCR_CJK_COMPATIBILITY_FORMS         (1L <<  1) /* U+FE10-U+FE1F */\r\n                                                          /* U+FE30-U+FE4F */\r\n  /* Bit 66   Small Form Variants */\r\n#define TT_UCR_SMALL_FORM_VARIANTS             (1L <<  2) /* U+FE50-U+FE6F */\r\n  /* Bit 67   Arabic Presentation Forms-B */\r\n#define TT_UCR_ARABIC_PRESENTATIONS_B          (1L <<  3) /* U+FE70-U+FEFE */\r\n  /* Bit 68   Halfwidth and Fullwidth Forms */\r\n#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS       (1L <<  4) /* U+FF00-U+FFEF */\r\n  /* Bit 69   Specials */\r\n#define TT_UCR_SPECIALS                        (1L <<  5) /* U+FFF0-U+FFFD */\r\n  /* Bit 70   Tibetan */\r\n#define TT_UCR_TIBETAN                         (1L <<  6) /* U+0F00-U+0FFF */\r\n  /* Bit 71   Syriac */\r\n#define TT_UCR_SYRIAC                          (1L <<  7) /* U+0700-U+074F */\r\n  /* Bit 72   Thaana */\r\n#define TT_UCR_THAANA                          (1L <<  8) /* U+0780-U+07BF */\r\n  /* Bit 73   Sinhala */\r\n#define TT_UCR_SINHALA                         (1L <<  9) /* U+0D80-U+0DFF */\r\n  /* Bit 74   Myanmar */\r\n#define TT_UCR_MYANMAR                         (1L << 10) /* U+1000-U+109F */\r\n  /* Bit 75   Ethiopic            */\r\n  /*          Ethiopic Supplement */\r\n  /*          Ethiopic Extended   */\r\n#define TT_UCR_ETHIOPIC                        (1L << 11) /* U+1200-U+137F */\r\n                                                          /* U+1380-U+139F */\r\n                                                          /* U+2D80-U+2DDF */\r\n  /* Bit 76   Cherokee */\r\n#define TT_UCR_CHEROKEE                        (1L << 12) /* U+13A0-U+13FF */\r\n  /* Bit 77   Unified Canadian Aboriginal Syllabics */\r\n#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS   (1L << 13) /* U+1400-U+167F */\r\n  /* Bit 78   Ogham */\r\n#define TT_UCR_OGHAM                           (1L << 14) /* U+1680-U+169F */\r\n  /* Bit 79   Runic */\r\n#define TT_UCR_RUNIC                           (1L << 15) /* U+16A0-U+16FF */\r\n  /* Bit 80   Khmer         */\r\n  /*          Khmer Symbols */\r\n#define TT_UCR_KHMER                           (1L << 16) /* U+1780-U+17FF */\r\n                                                          /* U+19E0-U+19FF */\r\n  /* Bit 81   Mongolian */\r\n#define TT_UCR_MONGOLIAN                       (1L << 17) /* U+1800-U+18AF */\r\n  /* Bit 82   Braille Patterns */\r\n#define TT_UCR_BRAILLE                         (1L << 18) /* U+2800-U+28FF */\r\n  /* Bit 83   Yi Syllables */\r\n  /*          Yi Radicals  */\r\n#define TT_UCR_YI                              (1L << 19) /* U+A000-U+A48F */\r\n                                                          /* U+A490-U+A4CF */\r\n  /* Bit 84   Tagalog  */\r\n  /*          Hanunoo  */\r\n  /*          Buhid    */\r\n  /*          Tagbanwa */\r\n#define TT_UCR_PHILIPPINE                      (1L << 20) /* U+1700-U+171F */\r\n                                                          /* U+1720-U+173F */\r\n                                                          /* U+1740-U+175F */\r\n                                                          /* U+1760-U+177F */\r\n  /* Bit 85   Old Italic */\r\n#define TT_UCR_OLD_ITALIC                      (1L << 21) /*U+10300-U+1032F*/\r\n  /* Bit 86   Gothic */\r\n#define TT_UCR_GOTHIC                          (1L << 22) /*U+10330-U+1034F*/\r\n  /* Bit 87   Deseret */\r\n#define TT_UCR_DESERET                         (1L << 23) /*U+10400-U+1044F*/\r\n  /* Bit 88   Byzantine Musical Symbols      */\r\n  /*          Musical Symbols                */\r\n  /*          Ancient Greek Musical Notation */\r\n#define TT_UCR_MUSICAL_SYMBOLS                 (1L << 24) /*U+1D000-U+1D0FF*/\r\n                                                          /*U+1D100-U+1D1FF*/\r\n                                                          /*U+1D200-U+1D24F*/\r\n  /* Bit 89   Mathematical Alphanumeric Symbols */\r\n#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS       (1L << 25) /*U+1D400-U+1D7FF*/\r\n  /* Bit 90   Private Use (plane 15) */\r\n  /*          Private Use (plane 16) */\r\n#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY       (1L << 26) /*U+F0000-U+FFFFD*/\r\n                                                        /*U+100000-U+10FFFD*/\r\n  /* Bit 91   Variation Selectors            */\r\n  /*          Variation Selectors Supplement */\r\n#define TT_UCR_VARIATION_SELECTORS             (1L << 27) /* U+FE00-U+FE0F */\r\n                                                          /*U+E0100-U+E01EF*/\r\n  /* Bit 92   Tags */\r\n#define TT_UCR_TAGS                            (1L << 28) /*U+E0000-U+E007F*/\r\n  /* Bit 93   Limbu */\r\n#define TT_UCR_LIMBU                           (1L << 29) /* U+1900-U+194F */\r\n  /* Bit 94   Tai Le */\r\n#define TT_UCR_TAI_LE                          (1L << 30) /* U+1950-U+197F */\r\n  /* Bit 95   New Tai Lue */\r\n#define TT_UCR_NEW_TAI_LUE                     (1L << 31) /* U+1980-U+19DF */\r\n  /* Bit 96   Buginese */\r\n#define TT_UCR_BUGINESE                        (1L <<  0) /* U+1A00-U+1A1F */\r\n  /* Bit 97   Glagolitic */\r\n#define TT_UCR_GLAGOLITIC                      (1L <<  1) /* U+2C00-U+2C5F */\r\n  /* Bit 98   Tifinagh */\r\n#define TT_UCR_TIFINAGH                        (1L <<  2) /* U+2D30-U+2D7F */\r\n  /* Bit 99   Yijing Hexagram Symbols */\r\n#define TT_UCR_YIJING                          (1L <<  3) /* U+4DC0-U+4DFF */\r\n  /* Bit 100  Syloti Nagri */\r\n#define TT_UCR_SYLOTI_NAGRI                    (1L <<  4) /* U+A800-U+A82F */\r\n  /* Bit 101  Linear B Syllabary */\r\n  /*          Linear B Ideograms */\r\n  /*          Aegean Numbers     */\r\n#define TT_UCR_LINEAR_B                        (1L <<  5) /*U+10000-U+1007F*/\r\n                                                          /*U+10080-U+100FF*/\r\n                                                          /*U+10100-U+1013F*/\r\n  /* Bit 102  Ancient Greek Numbers */\r\n#define TT_UCR_ANCIENT_GREEK_NUMBERS           (1L <<  6) /*U+10140-U+1018F*/\r\n  /* Bit 103  Ugaritic */\r\n#define TT_UCR_UGARITIC                        (1L <<  7) /*U+10380-U+1039F*/\r\n  /* Bit 104  Old Persian */\r\n#define TT_UCR_OLD_PERSIAN                     (1L <<  8) /*U+103A0-U+103DF*/\r\n  /* Bit 105  Shavian */\r\n#define TT_UCR_SHAVIAN                         (1L <<  9) /*U+10450-U+1047F*/\r\n  /* Bit 106  Osmanya */\r\n#define TT_UCR_OSMANYA                         (1L << 10) /*U+10480-U+104AF*/\r\n  /* Bit 107  Cypriot Syllabary */\r\n#define TT_UCR_CYPRIOT_SYLLABARY               (1L << 11) /*U+10800-U+1083F*/\r\n  /* Bit 108  Kharoshthi */\r\n#define TT_UCR_KHAROSHTHI                      (1L << 12) /*U+10A00-U+10A5F*/\r\n  /* Bit 109  Tai Xuan Jing Symbols */\r\n#define TT_UCR_TAI_XUAN_JING                   (1L << 13) /*U+1D300-U+1D35F*/\r\n  /* Bit 110  Cuneiform                         */\r\n  /*          Cuneiform Numbers and Punctuation */\r\n#define TT_UCR_CUNEIFORM                       (1L << 14) /*U+12000-U+123FF*/\r\n                                                          /*U+12400-U+1247F*/\r\n  /* Bit 111  Counting Rod Numerals */\r\n#define TT_UCR_COUNTING_ROD_NUMERALS           (1L << 15) /*U+1D360-U+1D37F*/\r\n  /* Bit 112  Sundanese */\r\n#define TT_UCR_SUNDANESE                       (1L << 16) /* U+1B80-U+1BBF */\r\n  /* Bit 113  Lepcha */\r\n#define TT_UCR_LEPCHA                          (1L << 17) /* U+1C00-U+1C4F */\r\n  /* Bit 114  Ol Chiki */\r\n#define TT_UCR_OL_CHIKI                        (1L << 18) /* U+1C50-U+1C7F */\r\n  /* Bit 115  Saurashtra */\r\n#define TT_UCR_SAURASHTRA                      (1L << 19) /* U+A880-U+A8DF */\r\n  /* Bit 116  Kayah Li */\r\n#define TT_UCR_KAYAH_LI                        (1L << 20) /* U+A900-U+A92F */\r\n  /* Bit 117  Rejang */\r\n#define TT_UCR_REJANG                          (1L << 21) /* U+A930-U+A95F */\r\n  /* Bit 118  Cham */\r\n#define TT_UCR_CHAM                            (1L << 22) /* U+AA00-U+AA5F */\r\n  /* Bit 119  Ancient Symbols */\r\n#define TT_UCR_ANCIENT_SYMBOLS                 (1L << 23) /*U+10190-U+101CF*/\r\n  /* Bit 120  Phaistos Disc */\r\n#define TT_UCR_PHAISTOS_DISC                   (1L << 24) /*U+101D0-U+101FF*/\r\n  /* Bit 121  Carian */\r\n  /*          Lycian */\r\n  /*          Lydian */\r\n#define TT_UCR_OLD_ANATOLIAN                   (1L << 25) /*U+102A0-U+102DF*/\r\n                                                          /*U+10280-U+1029F*/\r\n                                                          /*U+10920-U+1093F*/\r\n  /* Bit 122  Domino Tiles  */\r\n  /*          Mahjong Tiles */\r\n#define TT_UCR_GAME_TILES                      (1L << 26) /*U+1F030-U+1F09F*/\r\n                                                          /*U+1F000-U+1F02F*/\r\n  /* Bit 123-127 Reserved for process-internal usage */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Some compilers have a very limited length of identifiers.             */\r\n  /*                                                                       */\r\n#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ )\r\n#define HAVE_LIMIT_ON_IDENTS\r\n#endif\r\n\r\n\r\n#ifndef HAVE_LIMIT_ON_IDENTS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Here some alias #defines in order to be clearer.                      */\r\n  /*                                                                       */\r\n  /* These are not always #defined to stay within the 31~character limit   */\r\n  /* which some compilers have.                                            */\r\n  /*                                                                       */\r\n  /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern  */\r\n  /* Borland compilers (read: from BC++ 3.1 on) can increase this limit.   */\r\n  /* If you get a warning with such a compiler, use the -i40 switch.       */\r\n  /*                                                                       */\r\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_A      \\\r\n         TT_UCR_ARABIC_PRESENTATIONS_A\r\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_B      \\\r\n         TT_UCR_ARABIC_PRESENTATIONS_B\r\n\r\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS      \\\r\n         TT_UCR_COMBINING_DIACRITICS\r\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \\\r\n         TT_UCR_COMBINING_DIACRITICS_SYMB\r\n\r\n\r\n#endif /* !HAVE_LIMIT_ON_IDENTS */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTNAMEID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/tttables.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tttables.h                                                             */\r\n/*                                                                         */\r\n/*    Basic SFNT/TrueType tables definitions and interface                 */\r\n/*    (specification only).                                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2005, 2008-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTTABLES_H__\r\n#define __TTTABLES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    truetype_tables                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    TrueType Tables                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    TrueType specific table types and functions.                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the definition of TrueType-specific tables   */\r\n  /*    as well as some routines used to access and process them.          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Header                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType font header table.  All       */\r\n  /*    fields follow the TrueType specification.                          */\r\n  /*                                                                       */\r\n  typedef struct  TT_Header_\r\n  {\r\n    FT_Fixed   Table_Version;\r\n    FT_Fixed   Font_Revision;\r\n\r\n    FT_Long    CheckSum_Adjust;\r\n    FT_Long    Magic_Number;\r\n\r\n    FT_UShort  Flags;\r\n    FT_UShort  Units_Per_EM;\r\n\r\n    FT_Long    Created [2];\r\n    FT_Long    Modified[2];\r\n\r\n    FT_Short   xMin;\r\n    FT_Short   yMin;\r\n    FT_Short   xMax;\r\n    FT_Short   yMax;\r\n\r\n    FT_UShort  Mac_Style;\r\n    FT_UShort  Lowest_Rec_PPEM;\r\n\r\n    FT_Short   Font_Direction;\r\n    FT_Short   Index_To_Loc_Format;\r\n    FT_Short   Glyph_Data_Format;\r\n\r\n  } TT_Header;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_HoriHeader                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType horizontal header, the `hhea' */\r\n  /*    table, as well as the corresponding horizontal metrics table,      */\r\n  /*    i.e., the `hmtx' table.                                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Version                :: The table version.                       */\r\n  /*                                                                       */\r\n  /*    Ascender               :: The font's ascender, i.e., the distance  */\r\n  /*                              from the baseline to the top-most of all */\r\n  /*                              glyph points found in the font.          */\r\n  /*                                                                       */\r\n  /*                              This value is invalid in many fonts, as  */\r\n  /*                              it is usually set by the font designer,  */\r\n  /*                              and often reflects only a portion of the */\r\n  /*                              glyphs found in the font (maybe ASCII).  */\r\n  /*                                                                       */\r\n  /*                              You should use the `sTypoAscender' field */\r\n  /*                              of the OS/2 table instead if you want    */\r\n  /*                              the correct one.                         */\r\n  /*                                                                       */\r\n  /*    Descender              :: The font's descender, i.e., the distance */\r\n  /*                              from the baseline to the bottom-most of  */\r\n  /*                              all glyph points found in the font.  It  */\r\n  /*                              is negative.                             */\r\n  /*                                                                       */\r\n  /*                              This value is invalid in many fonts, as  */\r\n  /*                              it is usually set by the font designer,  */\r\n  /*                              and often reflects only a portion of the */\r\n  /*                              glyphs found in the font (maybe ASCII).  */\r\n  /*                                                                       */\r\n  /*                              You should use the `sTypoDescender'      */\r\n  /*                              field of the OS/2 table instead if you   */\r\n  /*                              want the correct one.                    */\r\n  /*                                                                       */\r\n  /*    Line_Gap               :: The font's line gap, i.e., the distance  */\r\n  /*                              to add to the ascender and descender to  */\r\n  /*                              get the BTB, i.e., the                   */\r\n  /*                              baseline-to-baseline distance for the    */\r\n  /*                              font.                                    */\r\n  /*                                                                       */\r\n  /*    advance_Width_Max      :: This field is the maximum of all advance */\r\n  /*                              widths found in the font.  It can be     */\r\n  /*                              used to compute the maximum width of an  */\r\n  /*                              arbitrary string of text.                */\r\n  /*                                                                       */\r\n  /*    min_Left_Side_Bearing  :: The minimum left side bearing of all     */\r\n  /*                              glyphs within the font.                  */\r\n  /*                                                                       */\r\n  /*    min_Right_Side_Bearing :: The minimum right side bearing of all    */\r\n  /*                              glyphs within the font.                  */\r\n  /*                                                                       */\r\n  /*    xMax_Extent            :: The maximum horizontal extent (i.e., the */\r\n  /*                              `width' of a glyph's bounding box) for   */\r\n  /*                              all glyphs in the font.                  */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Rise       :: The rise coefficient of the cursor's     */\r\n  /*                              slope of the cursor (slope=rise/run).    */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Run        :: The run coefficient of the cursor's      */\r\n  /*                              slope.                                   */\r\n  /*                                                                       */\r\n  /*    Reserved               :: 8~reserved bytes.                        */\r\n  /*                                                                       */\r\n  /*    metric_Data_Format     :: Always~0.                                */\r\n  /*                                                                       */\r\n  /*    number_Of_HMetrics     :: Number of HMetrics entries in the `hmtx' */\r\n  /*                              table -- this value can be smaller than  */\r\n  /*                              the total number of glyphs in the font.  */\r\n  /*                                                                       */\r\n  /*    long_metrics           :: A pointer into the `hmtx' table.         */\r\n  /*                                                                       */\r\n  /*    short_metrics          :: A pointer into the `hmtx' table.         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should   */\r\n  /*               be identical except for the names of their fields which */\r\n  /*               are different.                                          */\r\n  /*                                                                       */\r\n  /*               This ensures that a single function in the `ttload'     */\r\n  /*               module is able to read both the horizontal and vertical */\r\n  /*               headers.                                                */\r\n  /*                                                                       */\r\n  typedef struct  TT_HoriHeader_\r\n  {\r\n    FT_Fixed   Version;\r\n    FT_Short   Ascender;\r\n    FT_Short   Descender;\r\n    FT_Short   Line_Gap;\r\n\r\n    FT_UShort  advance_Width_Max;      /* advance width maximum */\r\n\r\n    FT_Short   min_Left_Side_Bearing;  /* minimum left-sb       */\r\n    FT_Short   min_Right_Side_Bearing; /* minimum right-sb      */\r\n    FT_Short   xMax_Extent;            /* xmax extents          */\r\n    FT_Short   caret_Slope_Rise;\r\n    FT_Short   caret_Slope_Run;\r\n    FT_Short   caret_Offset;\r\n\r\n    FT_Short   Reserved[4];\r\n\r\n    FT_Short   metric_Data_Format;\r\n    FT_UShort  number_Of_HMetrics;\r\n\r\n    /* The following fields are not defined by the TrueType specification */\r\n    /* but they are used to connect the metrics header to the relevant    */\r\n    /* `HMTX' table.                                                      */\r\n\r\n    void*      long_metrics;\r\n    void*      short_metrics;\r\n\r\n  } TT_HoriHeader;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_VertHeader                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType vertical header, the `vhea'   */\r\n  /*    table, as well as the corresponding vertical metrics table, i.e.,  */\r\n  /*    the `vmtx' table.                                                  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Version                 :: The table version.                      */\r\n  /*                                                                       */\r\n  /*    Ascender                :: The font's ascender, i.e., the distance */\r\n  /*                               from the baseline to the top-most of    */\r\n  /*                               all glyph points found in the font.     */\r\n  /*                                                                       */\r\n  /*                               This value is invalid in many fonts, as */\r\n  /*                               it is usually set by the font designer, */\r\n  /*                               and often reflects only a portion of    */\r\n  /*                               the glyphs found in the font (maybe     */\r\n  /*                               ASCII).                                 */\r\n  /*                                                                       */\r\n  /*                               You should use the `sTypoAscender'      */\r\n  /*                               field of the OS/2 table instead if you  */\r\n  /*                               want the correct one.                   */\r\n  /*                                                                       */\r\n  /*    Descender               :: The font's descender, i.e., the         */\r\n  /*                               distance from the baseline to the       */\r\n  /*                               bottom-most of all glyph points found   */\r\n  /*                               in the font.  It is negative.           */\r\n  /*                                                                       */\r\n  /*                               This value is invalid in many fonts, as */\r\n  /*                               it is usually set by the font designer, */\r\n  /*                               and often reflects only a portion of    */\r\n  /*                               the glyphs found in the font (maybe     */\r\n  /*                               ASCII).                                 */\r\n  /*                                                                       */\r\n  /*                               You should use the `sTypoDescender'     */\r\n  /*                               field of the OS/2 table instead if you  */\r\n  /*                               want the correct one.                   */\r\n  /*                                                                       */\r\n  /*    Line_Gap                :: The font's line gap, i.e., the distance */\r\n  /*                               to add to the ascender and descender to */\r\n  /*                               get the BTB, i.e., the                  */\r\n  /*                               baseline-to-baseline distance for the   */\r\n  /*                               font.                                   */\r\n  /*                                                                       */\r\n  /*    advance_Height_Max      :: This field is the maximum of all        */\r\n  /*                               advance heights found in the font.  It  */\r\n  /*                               can be used to compute the maximum      */\r\n  /*                               height of an arbitrary string of text.  */\r\n  /*                                                                       */\r\n  /*    min_Top_Side_Bearing    :: The minimum top side bearing of all     */\r\n  /*                               glyphs within the font.                 */\r\n  /*                                                                       */\r\n  /*    min_Bottom_Side_Bearing :: The minimum bottom side bearing of all  */\r\n  /*                               glyphs within the font.                 */\r\n  /*                                                                       */\r\n  /*    yMax_Extent             :: The maximum vertical extent (i.e., the  */\r\n  /*                               `height' of a glyph's bounding box) for */\r\n  /*                               all glyphs in the font.                 */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Rise        :: The rise coefficient of the cursor's    */\r\n  /*                               slope of the cursor (slope=rise/run).   */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Run         :: The run coefficient of the cursor's     */\r\n  /*                               slope.                                  */\r\n  /*                                                                       */\r\n  /*    caret_Offset            :: The cursor's offset for slanted fonts.  */\r\n  /*                               This value is `reserved' in vmtx        */\r\n  /*                               version 1.0.                            */\r\n  /*                                                                       */\r\n  /*    Reserved                :: 8~reserved bytes.                       */\r\n  /*                                                                       */\r\n  /*    metric_Data_Format      :: Always~0.                               */\r\n  /*                                                                       */\r\n  /*    number_Of_HMetrics      :: Number of VMetrics entries in the       */\r\n  /*                               `vmtx' table -- this value can be       */\r\n  /*                               smaller than the total number of glyphs */\r\n  /*                               in the font.                            */\r\n  /*                                                                       */\r\n  /*    long_metrics           :: A pointer into the `vmtx' table.         */\r\n  /*                                                                       */\r\n  /*    short_metrics          :: A pointer into the `vmtx' table.         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should   */\r\n  /*               be identical except for the names of their fields which */\r\n  /*               are different.                                          */\r\n  /*                                                                       */\r\n  /*               This ensures that a single function in the `ttload'     */\r\n  /*               module is able to read both the horizontal and vertical */\r\n  /*               headers.                                                */\r\n  /*                                                                       */\r\n  typedef struct  TT_VertHeader_\r\n  {\r\n    FT_Fixed   Version;\r\n    FT_Short   Ascender;\r\n    FT_Short   Descender;\r\n    FT_Short   Line_Gap;\r\n\r\n    FT_UShort  advance_Height_Max;      /* advance height maximum */\r\n\r\n    FT_Short   min_Top_Side_Bearing;    /* minimum left-sb or top-sb       */\r\n    FT_Short   min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb   */\r\n    FT_Short   yMax_Extent;             /* xmax or ymax extents            */\r\n    FT_Short   caret_Slope_Rise;\r\n    FT_Short   caret_Slope_Run;\r\n    FT_Short   caret_Offset;\r\n\r\n    FT_Short   Reserved[4];\r\n\r\n    FT_Short   metric_Data_Format;\r\n    FT_UShort  number_Of_VMetrics;\r\n\r\n    /* The following fields are not defined by the TrueType specification */\r\n    /* but they're used to connect the metrics header to the relevant     */\r\n    /* `HMTX' or `VMTX' table.                                            */\r\n\r\n    void*      long_metrics;\r\n    void*      short_metrics;\r\n\r\n  } TT_VertHeader;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_OS2                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType OS/2 table. This is the long  */\r\n  /*    table version.  All fields comply to the TrueType specification.   */\r\n  /*                                                                       */\r\n  /*    Note that we now support old Mac fonts which do not include an     */\r\n  /*    OS/2 table.  In this case, the `version' field is always set to    */\r\n  /*    0xFFFF.                                                            */\r\n  /*                                                                       */\r\n  typedef struct  TT_OS2_\r\n  {\r\n    FT_UShort  version;                /* 0x0001 - more or 0xFFFF */\r\n    FT_Short   xAvgCharWidth;\r\n    FT_UShort  usWeightClass;\r\n    FT_UShort  usWidthClass;\r\n    FT_Short   fsType;\r\n    FT_Short   ySubscriptXSize;\r\n    FT_Short   ySubscriptYSize;\r\n    FT_Short   ySubscriptXOffset;\r\n    FT_Short   ySubscriptYOffset;\r\n    FT_Short   ySuperscriptXSize;\r\n    FT_Short   ySuperscriptYSize;\r\n    FT_Short   ySuperscriptXOffset;\r\n    FT_Short   ySuperscriptYOffset;\r\n    FT_Short   yStrikeoutSize;\r\n    FT_Short   yStrikeoutPosition;\r\n    FT_Short   sFamilyClass;\r\n\r\n    FT_Byte    panose[10];\r\n\r\n    FT_ULong   ulUnicodeRange1;        /* Bits 0-31   */\r\n    FT_ULong   ulUnicodeRange2;        /* Bits 32-63  */\r\n    FT_ULong   ulUnicodeRange3;        /* Bits 64-95  */\r\n    FT_ULong   ulUnicodeRange4;        /* Bits 96-127 */\r\n\r\n    FT_Char    achVendID[4];\r\n\r\n    FT_UShort  fsSelection;\r\n    FT_UShort  usFirstCharIndex;\r\n    FT_UShort  usLastCharIndex;\r\n    FT_Short   sTypoAscender;\r\n    FT_Short   sTypoDescender;\r\n    FT_Short   sTypoLineGap;\r\n    FT_UShort  usWinAscent;\r\n    FT_UShort  usWinDescent;\r\n\r\n    /* only version 1 tables: */\r\n\r\n    FT_ULong   ulCodePageRange1;       /* Bits 0-31   */\r\n    FT_ULong   ulCodePageRange2;       /* Bits 32-63  */\r\n\r\n    /* only version 2 tables: */\r\n\r\n    FT_Short   sxHeight;\r\n    FT_Short   sCapHeight;\r\n    FT_UShort  usDefaultChar;\r\n    FT_UShort  usBreakChar;\r\n    FT_UShort  usMaxContext;\r\n\r\n  } TT_OS2;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Postscript                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType PostScript table.  All fields */\r\n  /*    comply to the TrueType specification.  This structure does not     */\r\n  /*    reference the PostScript glyph names, which can be nevertheless    */\r\n  /*    accessed with the `ttpost' module.                                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_Postscript_\r\n  {\r\n    FT_Fixed  FormatType;\r\n    FT_Fixed  italicAngle;\r\n    FT_Short  underlinePosition;\r\n    FT_Short  underlineThickness;\r\n    FT_ULong  isFixedPitch;\r\n    FT_ULong  minMemType42;\r\n    FT_ULong  maxMemType42;\r\n    FT_ULong  minMemType1;\r\n    FT_ULong  maxMemType1;\r\n\r\n    /* Glyph names follow in the file, but we don't   */\r\n    /* load them by default.  See the ttpost.c file.  */\r\n\r\n  } TT_Postscript;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_PCLT                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType PCLT table.  All fields       */\r\n  /*    comply to the TrueType specification.                              */\r\n  /*                                                                       */\r\n  typedef struct  TT_PCLT_\r\n  {\r\n    FT_Fixed   Version;\r\n    FT_ULong   FontNumber;\r\n    FT_UShort  Pitch;\r\n    FT_UShort  xHeight;\r\n    FT_UShort  Style;\r\n    FT_UShort  TypeFamily;\r\n    FT_UShort  CapHeight;\r\n    FT_UShort  SymbolSet;\r\n    FT_Char    TypeFace[16];\r\n    FT_Char    CharacterComplement[8];\r\n    FT_Char    FileName[6];\r\n    FT_Char    StrokeWeight;\r\n    FT_Char    WidthType;\r\n    FT_Byte    SerifStyle;\r\n    FT_Byte    Reserved;\r\n\r\n  } TT_PCLT;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_MaxProfile                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The maximum profile is a table containing many max values which    */\r\n  /*    can be used to pre-allocate arrays.  This ensures that no memory   */\r\n  /*    allocation occurs during a glyph load.                             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    version               :: The version number.                       */\r\n  /*                                                                       */\r\n  /*    numGlyphs             :: The number of glyphs in this TrueType     */\r\n  /*                             font.                                     */\r\n  /*                                                                       */\r\n  /*    maxPoints             :: The maximum number of points in a         */\r\n  /*                             non-composite TrueType glyph.  See also   */\r\n  /*                             the structure element                     */\r\n  /*                             `maxCompositePoints'.                     */\r\n  /*                                                                       */\r\n  /*    maxContours           :: The maximum number of contours in a       */\r\n  /*                             non-composite TrueType glyph.  See also   */\r\n  /*                             the structure element                     */\r\n  /*                             `maxCompositeContours'.                   */\r\n  /*                                                                       */\r\n  /*    maxCompositePoints    :: The maximum number of points in a         */\r\n  /*                             composite TrueType glyph.  See also the   */\r\n  /*                             structure element `maxPoints'.            */\r\n  /*                                                                       */\r\n  /*    maxCompositeContours  :: The maximum number of contours in a       */\r\n  /*                             composite TrueType glyph.  See also the   */\r\n  /*                             structure element `maxContours'.          */\r\n  /*                                                                       */\r\n  /*    maxZones              :: The maximum number of zones used for      */\r\n  /*                             glyph hinting.                            */\r\n  /*                                                                       */\r\n  /*    maxTwilightPoints     :: The maximum number of points in the       */\r\n  /*                             twilight zone used for glyph hinting.     */\r\n  /*                                                                       */\r\n  /*    maxStorage            :: The maximum number of elements in the     */\r\n  /*                             storage area used for glyph hinting.      */\r\n  /*                                                                       */\r\n  /*    maxFunctionDefs       :: The maximum number of function            */\r\n  /*                             definitions in the TrueType bytecode for  */\r\n  /*                             this font.                                */\r\n  /*                                                                       */\r\n  /*    maxInstructionDefs    :: The maximum number of instruction         */\r\n  /*                             definitions in the TrueType bytecode for  */\r\n  /*                             this font.                                */\r\n  /*                                                                       */\r\n  /*    maxStackElements      :: The maximum number of stack elements used */\r\n  /*                             during bytecode interpretation.           */\r\n  /*                                                                       */\r\n  /*    maxSizeOfInstructions :: The maximum number of TrueType opcodes    */\r\n  /*                             used for glyph hinting.                   */\r\n  /*                                                                       */\r\n  /*    maxComponentElements  :: The maximum number of simple (i.e., non-  */\r\n  /*                             composite) glyphs in a composite glyph.   */\r\n  /*                                                                       */\r\n  /*    maxComponentDepth     :: The maximum nesting depth of composite    */\r\n  /*                             glyphs.                                   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This structure is only used during font loading.                   */\r\n  /*                                                                       */\r\n  typedef struct  TT_MaxProfile_\r\n  {\r\n    FT_Fixed   version;\r\n    FT_UShort  numGlyphs;\r\n    FT_UShort  maxPoints;\r\n    FT_UShort  maxContours;\r\n    FT_UShort  maxCompositePoints;\r\n    FT_UShort  maxCompositeContours;\r\n    FT_UShort  maxZones;\r\n    FT_UShort  maxTwilightPoints;\r\n    FT_UShort  maxStorage;\r\n    FT_UShort  maxFunctionDefs;\r\n    FT_UShort  maxInstructionDefs;\r\n    FT_UShort  maxStackElements;\r\n    FT_UShort  maxSizeOfInstructions;\r\n    FT_UShort  maxComponentElements;\r\n    FT_UShort  maxComponentDepth;\r\n\r\n  } TT_MaxProfile;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Sfnt_Tag                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used to specify the index of an SFNT table.         */\r\n  /*    Used in the @FT_Get_Sfnt_Table API function.                       */\r\n  /*                                                                       */\r\n  typedef enum  FT_Sfnt_Tag_\r\n  {\r\n    ft_sfnt_head = 0,    /* TT_Header     */\r\n    ft_sfnt_maxp = 1,    /* TT_MaxProfile */\r\n    ft_sfnt_os2  = 2,    /* TT_OS2        */\r\n    ft_sfnt_hhea = 3,    /* TT_HoriHeader */\r\n    ft_sfnt_vhea = 4,    /* TT_VertHeader */\r\n    ft_sfnt_post = 5,    /* TT_Postscript */\r\n    ft_sfnt_pclt = 6,    /* TT_PCLT       */\r\n\r\n    sfnt_max   /* internal end mark */\r\n\r\n  } FT_Sfnt_Tag;\r\n\r\n  /* */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Sfnt_Table                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a pointer to a given SFNT table within a face.              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source.                                    */\r\n  /*                                                                       */\r\n  /*    tag  :: The index of the SFNT table.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A type-less pointer to the table.  This will be~0 in case of       */\r\n  /*    error, or if the corresponding table was not found *OR* loaded     */\r\n  /*    from the file.                                                     */\r\n  /*                                                                       */\r\n  /*    Use a typecast according to `tag' to access the structure          */\r\n  /*    elements.                                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The table is owned by the face object and disappears with it.      */\r\n  /*                                                                       */\r\n  /*    This function is only useful to access SFNT tables that are loaded */\r\n  /*    by the sfnt, truetype, and opentype drivers.  See @FT_Sfnt_Tag for */\r\n  /*    a list.                                                            */\r\n  /*                                                                       */\r\n  /*    Here an example how to access the `vhea' table:                    */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      TT_VertHeader*  vert_header;                                     */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      vert_header =                                                    */\r\n  /*        (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea );       */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( void* )\r\n  FT_Get_Sfnt_Table( FT_Face      face,\r\n                     FT_Sfnt_Tag  tag );\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Load_Sfnt_Table\r\n  *\r\n  * @description:\r\n  *   Load any font table into client memory.\r\n  *\r\n  * @input:\r\n  *   face ::\r\n  *     A handle to the source face.\r\n  *\r\n  *   tag ::\r\n  *     The four-byte tag of the table to load.  Use the value~0 if you want\r\n  *     to access the whole font file.  Otherwise, you can use one of the\r\n  *     definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new\r\n  *     one with @FT_MAKE_TAG.\r\n  *\r\n  *   offset ::\r\n  *     The starting offset in the table (or file if tag == 0).\r\n  *\r\n  * @output:\r\n  *   buffer ::\r\n  *     The target buffer address.  The client must ensure that the memory\r\n  *     array is big enough to hold the data.\r\n  *\r\n  * @inout:\r\n  *   length ::\r\n  *     If the `length' parameter is NULL, then try to load the whole table.\r\n  *     Return an error code if it fails.\r\n  *\r\n  *     Else, if `*length' is~0, exit immediately while returning the\r\n  *     table's (or file) full size in it.\r\n  *\r\n  *     Else the number of bytes to read from the table or file, from the\r\n  *     starting offset.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   If you need to determine the table's length you should first call this\r\n  *   function with `*length' set to~0, as in the following example:\r\n  *\r\n  *     {\r\n  *       FT_ULong  length = 0;\r\n  *\r\n  *\r\n  *       error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );\r\n  *       if ( error ) { ... table does not exist ... }\r\n  *\r\n  *       buffer = malloc( length );\r\n  *       if ( buffer == NULL ) { ... not enough memory ... }\r\n  *\r\n  *       error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );\r\n  *       if ( error ) { ... could not load table ... }\r\n  *     }\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Load_Sfnt_Table( FT_Face    face,\r\n                      FT_ULong   tag,\r\n                      FT_Long    offset,\r\n                      FT_Byte*   buffer,\r\n                      FT_ULong*  length );\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Sfnt_Table_Info\r\n  *\r\n  * @description:\r\n  *   Return information on an SFNT table.\r\n  *\r\n  * @input:\r\n  *   face ::\r\n  *     A handle to the source face.\r\n  *\r\n  *   table_index ::\r\n  *     The index of an SFNT table.  The function returns\r\n  *     FT_Err_Table_Missing for an invalid value.\r\n  *\r\n  * @inout:\r\n  *   tag ::\r\n  *     The name tag of the SFNT table.  If the value is NULL, `table_index'\r\n  *     is ignored, and `length' returns the number of SFNT tables in the\r\n  *     font.\r\n  *\r\n  * @output:\r\n  *   length ::\r\n  *     The length of the SFNT table (or the number of SFNT tables, depending\r\n  *     on `tag').\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   While parsing fonts, FreeType handles SFNT tables with length zero as\r\n  *   missing.\r\n  *\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Sfnt_Table_Info( FT_Face    face,\r\n                      FT_UInt    table_index,\r\n                      FT_ULong  *tag,\r\n                      FT_ULong  *length );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_CMap_Language_ID                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return TrueType/sfnt specific cmap language ID.  Definitions of    */\r\n  /*    language ID values are in `freetype/ttnameid.h'.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charmap ::                                                         */\r\n  /*      The target charmap.                                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The language ID of `charmap'.  If `charmap' doesn't belong to a    */\r\n  /*    TrueType/sfnt face, just return~0 as the default value.            */\r\n  /*                                                                       */\r\n  /*    For a format~14 cmap (to access Unicode IVS), the return value is  */\r\n  /*    0xFFFFFFFF.                                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ULong )\r\n  FT_Get_CMap_Language_ID( FT_CharMap  charmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_CMap_Format                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return TrueType/sfnt specific cmap format.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charmap ::                                                         */\r\n  /*      The target charmap.                                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The format of `charmap'.  If `charmap' doesn't belong to a         */\r\n  /*    TrueType/sfnt face, return -1.                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_Get_CMap_Format( FT_CharMap  charmap );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTTABLES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/tttags.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tttags.h                                                               */\r\n/*                                                                         */\r\n/*    Tags for TrueType and OpenType tables (specification only).          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2004, 2005, 2007, 2008 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTAGS_H__\r\n#define __TTAGS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define TTAG_avar  FT_MAKE_TAG( 'a', 'v', 'a', 'r' )\r\n#define TTAG_BASE  FT_MAKE_TAG( 'B', 'A', 'S', 'E' )\r\n#define TTAG_bdat  FT_MAKE_TAG( 'b', 'd', 'a', 't' )\r\n#define TTAG_BDF   FT_MAKE_TAG( 'B', 'D', 'F', ' ' )\r\n#define TTAG_bhed  FT_MAKE_TAG( 'b', 'h', 'e', 'd' )\r\n#define TTAG_bloc  FT_MAKE_TAG( 'b', 'l', 'o', 'c' )\r\n#define TTAG_bsln  FT_MAKE_TAG( 'b', 's', 'l', 'n' )\r\n#define TTAG_CFF   FT_MAKE_TAG( 'C', 'F', 'F', ' ' )\r\n#define TTAG_CID   FT_MAKE_TAG( 'C', 'I', 'D', ' ' )\r\n#define TTAG_cmap  FT_MAKE_TAG( 'c', 'm', 'a', 'p' )\r\n#define TTAG_cvar  FT_MAKE_TAG( 'c', 'v', 'a', 'r' )\r\n#define TTAG_cvt   FT_MAKE_TAG( 'c', 'v', 't', ' ' )\r\n#define TTAG_DSIG  FT_MAKE_TAG( 'D', 'S', 'I', 'G' )\r\n#define TTAG_EBDT  FT_MAKE_TAG( 'E', 'B', 'D', 'T' )\r\n#define TTAG_EBLC  FT_MAKE_TAG( 'E', 'B', 'L', 'C' )\r\n#define TTAG_EBSC  FT_MAKE_TAG( 'E', 'B', 'S', 'C' )\r\n#define TTAG_feat  FT_MAKE_TAG( 'f', 'e', 'a', 't' )\r\n#define TTAG_FOND  FT_MAKE_TAG( 'F', 'O', 'N', 'D' )\r\n#define TTAG_fpgm  FT_MAKE_TAG( 'f', 'p', 'g', 'm' )\r\n#define TTAG_fvar  FT_MAKE_TAG( 'f', 'v', 'a', 'r' )\r\n#define TTAG_gasp  FT_MAKE_TAG( 'g', 'a', 's', 'p' )\r\n#define TTAG_GDEF  FT_MAKE_TAG( 'G', 'D', 'E', 'F' )\r\n#define TTAG_glyf  FT_MAKE_TAG( 'g', 'l', 'y', 'f' )\r\n#define TTAG_GPOS  FT_MAKE_TAG( 'G', 'P', 'O', 'S' )\r\n#define TTAG_GSUB  FT_MAKE_TAG( 'G', 'S', 'U', 'B' )\r\n#define TTAG_gvar  FT_MAKE_TAG( 'g', 'v', 'a', 'r' )\r\n#define TTAG_hdmx  FT_MAKE_TAG( 'h', 'd', 'm', 'x' )\r\n#define TTAG_head  FT_MAKE_TAG( 'h', 'e', 'a', 'd' )\r\n#define TTAG_hhea  FT_MAKE_TAG( 'h', 'h', 'e', 'a' )\r\n#define TTAG_hmtx  FT_MAKE_TAG( 'h', 'm', 't', 'x' )\r\n#define TTAG_JSTF  FT_MAKE_TAG( 'J', 'S', 'T', 'F' )\r\n#define TTAG_just  FT_MAKE_TAG( 'j', 'u', 's', 't' )\r\n#define TTAG_kern  FT_MAKE_TAG( 'k', 'e', 'r', 'n' )\r\n#define TTAG_lcar  FT_MAKE_TAG( 'l', 'c', 'a', 'r' )\r\n#define TTAG_loca  FT_MAKE_TAG( 'l', 'o', 'c', 'a' )\r\n#define TTAG_LTSH  FT_MAKE_TAG( 'L', 'T', 'S', 'H' )\r\n#define TTAG_LWFN  FT_MAKE_TAG( 'L', 'W', 'F', 'N' )\r\n#define TTAG_MATH  FT_MAKE_TAG( 'M', 'A', 'T', 'H' )\r\n#define TTAG_maxp  FT_MAKE_TAG( 'm', 'a', 'x', 'p' )\r\n#define TTAG_META  FT_MAKE_TAG( 'M', 'E', 'T', 'A' )\r\n#define TTAG_MMFX  FT_MAKE_TAG( 'M', 'M', 'F', 'X' )\r\n#define TTAG_MMSD  FT_MAKE_TAG( 'M', 'M', 'S', 'D' )\r\n#define TTAG_mort  FT_MAKE_TAG( 'm', 'o', 'r', 't' )\r\n#define TTAG_morx  FT_MAKE_TAG( 'm', 'o', 'r', 'x' )\r\n#define TTAG_name  FT_MAKE_TAG( 'n', 'a', 'm', 'e' )\r\n#define TTAG_opbd  FT_MAKE_TAG( 'o', 'p', 'b', 'd' )\r\n#define TTAG_OS2   FT_MAKE_TAG( 'O', 'S', '/', '2' )\r\n#define TTAG_OTTO  FT_MAKE_TAG( 'O', 'T', 'T', 'O' )\r\n#define TTAG_PCLT  FT_MAKE_TAG( 'P', 'C', 'L', 'T' )\r\n#define TTAG_POST  FT_MAKE_TAG( 'P', 'O', 'S', 'T' )\r\n#define TTAG_post  FT_MAKE_TAG( 'p', 'o', 's', 't' )\r\n#define TTAG_prep  FT_MAKE_TAG( 'p', 'r', 'e', 'p' )\r\n#define TTAG_prop  FT_MAKE_TAG( 'p', 'r', 'o', 'p' )\r\n#define TTAG_sfnt  FT_MAKE_TAG( 's', 'f', 'n', 't' )\r\n#define TTAG_SING  FT_MAKE_TAG( 'S', 'I', 'N', 'G' )\r\n#define TTAG_trak  FT_MAKE_TAG( 't', 'r', 'a', 'k' )\r\n#define TTAG_true  FT_MAKE_TAG( 't', 'r', 'u', 'e' )\r\n#define TTAG_ttc   FT_MAKE_TAG( 't', 't', 'c', ' ' )\r\n#define TTAG_ttcf  FT_MAKE_TAG( 't', 't', 'c', 'f' )\r\n#define TTAG_TYP1  FT_MAKE_TAG( 'T', 'Y', 'P', '1' )\r\n#define TTAG_typ1  FT_MAKE_TAG( 't', 'y', 'p', '1' )\r\n#define TTAG_VDMX  FT_MAKE_TAG( 'V', 'D', 'M', 'X' )\r\n#define TTAG_vhea  FT_MAKE_TAG( 'v', 'h', 'e', 'a' )\r\n#define TTAG_vmtx  FT_MAKE_TAG( 'v', 'm', 't', 'x' )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTAGS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/freetype/ttunpat.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttunpat.h                                                              */\r\n/*                                                                         */\r\n/*    Definitions for the unpatented TrueType hinting system               */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  Written by Graham Asher <graham.asher@btinternet.com>                  */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTUNPAT_H__\r\n#define __TTUNPAT_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n /***************************************************************************\r\n  *\r\n  * @constant:\r\n  *   FT_PARAM_TAG_UNPATENTED_HINTING\r\n  *\r\n  * @description:\r\n  *   A constant used as the tag of an @FT_Parameter structure to indicate\r\n  *   that unpatented methods only should be used by the TrueType bytecode\r\n  *   interpreter for a typeface opened by @FT_Open_Face.\r\n  *\r\n  */\r\n#define FT_PARAM_TAG_UNPATENTED_HINTING  FT_MAKE_TAG( 'u', 'n', 'p', 'a' )\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __TTUNPAT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/include/ft2build.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ft2build.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType 2 build and setup macros.                                   */\r\n/*    (Generic version)                                                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2006 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file corresponds to the default `ft2build.h' file for            */\r\n  /* FreeType 2.  It uses the `freetype' include root.                     */\r\n  /*                                                                       */\r\n  /* Note that specific platforms might use a different configuration.     */\r\n  /* See builds/unix/ft2unix.h for an example.                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FT2_BUILD_GENERIC_H__\r\n#define __FT2_BUILD_GENERIC_H__\r\n\r\n#include <freetype/config/ftheader.h>\r\n\r\n#endif /* __FT2_BUILD_GENERIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/Jamfile",
    "content": "# FreeType 2 src Jamfile\r\n#\r\n# Copyright 2001, 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) ;\r\n\r\n# The file <freetype/internal/internal.h> is used to define macros that are\r\n# later used in #include statements.  It needs to be parsed in order to\r\n# record these definitions.\r\n#\r\nHDRMACRO  [ FT2_SubDir $(FT2_INCLUDE_DIR) internal internal.h ] ;\r\n\r\nfor xx in $(FT2_COMPONENTS)\r\n{\r\n  SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;\r\n}\r\n\r\n# end of src Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/Jamfile",
    "content": "# FreeType 2 src/autofit Jamfile\r\n#\r\n# Copyright 2003, 2004, 2005, 2006, 2007, 2009 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir FT2_TOP src autofit ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  # define FT2_AUTOFIT2 to enable experimental latin hinter replacement\r\n  if $(FT2_AUTOFIT2)\r\n  {\r\n    DEFINES += FT_OPTION_AUTOFIT2 ;\r\n  }\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = afangles afglobal afhints aflatin afcjk afindic afloader afmodule afdummy afwarp afpic ;\r\n\r\n    if $(FT2_AUTOFIT2)\r\n    {\r\n      _sources += aflatin2 ;\r\n    }\r\n  }\r\n  else\r\n  {\r\n    _sources = autofit ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/autofit Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afangles.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afangles.c                                                             */\r\n/*                                                                         */\r\n/*    Routines used to compute vector angles with limited accuracy         */\r\n/*    and very high speed.  It also contains sorting routines (body).      */\r\n/*                                                                         */\r\n/*  Copyright 2003-2006, 2011-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"aftypes.h\"\r\n\r\n\r\n#if 0\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  af_corner_is_flat( FT_Pos  x_in,\r\n                     FT_Pos  y_in,\r\n                     FT_Pos  x_out,\r\n                     FT_Pos  y_out )\r\n  {\r\n    FT_Pos  ax = x_in;\r\n    FT_Pos  ay = y_in;\r\n\r\n    FT_Pos  d_in, d_out, d_corner;\r\n\r\n\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_in = ax + ay;\r\n\r\n    ax = x_out;\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    ay = y_out;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_out = ax + ay;\r\n\r\n    ax = x_out + x_in;\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    ay = y_out + y_in;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_corner = ax + ay;\r\n\r\n    return ( d_in + d_out - d_corner ) < ( d_corner >> 4 );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  af_corner_orientation( FT_Pos  x_in,\r\n                         FT_Pos  y_in,\r\n                         FT_Pos  x_out,\r\n                         FT_Pos  y_out )\r\n  {\r\n    FT_Pos  delta;\r\n\r\n\r\n    delta = x_in * y_out - y_in * x_out;\r\n\r\n    if ( delta == 0 )\r\n      return 0;\r\n    else\r\n      return 1 - 2 * ( delta < 0 );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  /*\r\n   *  We are not using `af_angle_atan' anymore, but we keep the source\r\n   *  code below just in case...\r\n   */\r\n\r\n\r\n#if 0\r\n\r\n\r\n  /*\r\n   *  The trick here is to realize that we don't need a very accurate angle\r\n   *  approximation.  We are going to use the result of `af_angle_atan' to\r\n   *  only compare the sign of angle differences, or check whether its\r\n   *  magnitude is very small.\r\n   *\r\n   *  The approximation\r\n   *\r\n   *    dy * PI / (|dx|+|dy|)\r\n   *\r\n   *  should be enough, and much faster to compute.\r\n   */\r\n  FT_LOCAL_DEF( AF_Angle )\r\n  af_angle_atan( FT_Fixed  dx,\r\n                 FT_Fixed  dy )\r\n  {\r\n    AF_Angle  angle;\r\n    FT_Fixed  ax = dx;\r\n    FT_Fixed  ay = dy;\r\n\r\n\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n\r\n    ax += ay;\r\n\r\n    if ( ax == 0 )\r\n      angle = 0;\r\n    else\r\n    {\r\n      angle = ( AF_ANGLE_PI2 * dy ) / ( ax + ay );\r\n      if ( dx < 0 )\r\n      {\r\n        if ( angle >= 0 )\r\n          angle = AF_ANGLE_PI - angle;\r\n        else\r\n          angle = -AF_ANGLE_PI - angle;\r\n      }\r\n    }\r\n\r\n    return angle;\r\n  }\r\n\r\n\r\n#elif 0\r\n\r\n\r\n  /* the following table has been automatically generated with */\r\n  /* the `mather.py' Python script                             */\r\n\r\n#define AF_ATAN_BITS  8\r\n\r\n  static const FT_Byte  af_arctan[1L << AF_ATAN_BITS] =\r\n  {\r\n     0,  0,  1,  1,  1,  2,  2,  2,\r\n     3,  3,  3,  3,  4,  4,  4,  5,\r\n     5,  5,  6,  6,  6,  7,  7,  7,\r\n     8,  8,  8,  9,  9,  9, 10, 10,\r\n    10, 10, 11, 11, 11, 12, 12, 12,\r\n    13, 13, 13, 14, 14, 14, 14, 15,\r\n    15, 15, 16, 16, 16, 17, 17, 17,\r\n    18, 18, 18, 18, 19, 19, 19, 20,\r\n    20, 20, 21, 21, 21, 21, 22, 22,\r\n    22, 23, 23, 23, 24, 24, 24, 24,\r\n    25, 25, 25, 26, 26, 26, 26, 27,\r\n    27, 27, 28, 28, 28, 28, 29, 29,\r\n    29, 30, 30, 30, 30, 31, 31, 31,\r\n    31, 32, 32, 32, 33, 33, 33, 33,\r\n    34, 34, 34, 34, 35, 35, 35, 35,\r\n    36, 36, 36, 36, 37, 37, 37, 38,\r\n    38, 38, 38, 39, 39, 39, 39, 40,\r\n    40, 40, 40, 41, 41, 41, 41, 42,\r\n    42, 42, 42, 42, 43, 43, 43, 43,\r\n    44, 44, 44, 44, 45, 45, 45, 45,\r\n    46, 46, 46, 46, 46, 47, 47, 47,\r\n    47, 48, 48, 48, 48, 48, 49, 49,\r\n    49, 49, 50, 50, 50, 50, 50, 51,\r\n    51, 51, 51, 51, 52, 52, 52, 52,\r\n    52, 53, 53, 53, 53, 53, 54, 54,\r\n    54, 54, 54, 55, 55, 55, 55, 55,\r\n    56, 56, 56, 56, 56, 57, 57, 57,\r\n    57, 57, 57, 58, 58, 58, 58, 58,\r\n    59, 59, 59, 59, 59, 59, 60, 60,\r\n    60, 60, 60, 61, 61, 61, 61, 61,\r\n    61, 62, 62, 62, 62, 62, 62, 63,\r\n    63, 63, 63, 63, 63, 64, 64, 64\r\n  };\r\n\r\n\r\n  FT_LOCAL_DEF( AF_Angle )\r\n  af_angle_atan( FT_Fixed  dx,\r\n                 FT_Fixed  dy )\r\n  {\r\n    AF_Angle  angle;\r\n\r\n\r\n    /* check trivial cases */\r\n    if ( dy == 0 )\r\n    {\r\n      angle = 0;\r\n      if ( dx < 0 )\r\n        angle = AF_ANGLE_PI;\r\n      return angle;\r\n    }\r\n    else if ( dx == 0 )\r\n    {\r\n      angle = AF_ANGLE_PI2;\r\n      if ( dy < 0 )\r\n        angle = -AF_ANGLE_PI2;\r\n      return angle;\r\n    }\r\n\r\n    angle = 0;\r\n    if ( dx < 0 )\r\n    {\r\n      dx = -dx;\r\n      dy = -dy;\r\n      angle = AF_ANGLE_PI;\r\n    }\r\n\r\n    if ( dy < 0 )\r\n    {\r\n      FT_Pos  tmp;\r\n\r\n\r\n      tmp = dx;\r\n      dx  = -dy;\r\n      dy  = tmp;\r\n      angle -= AF_ANGLE_PI2;\r\n    }\r\n\r\n    if ( dx == 0 && dy == 0 )\r\n      return 0;\r\n\r\n    if ( dx == dy )\r\n      angle += AF_ANGLE_PI4;\r\n    else if ( dx > dy )\r\n      angle += af_arctan[FT_DivFix( dy, dx ) >> ( 16 - AF_ATAN_BITS )];\r\n    else\r\n      angle += AF_ANGLE_PI2 -\r\n               af_arctan[FT_DivFix( dx, dy ) >> ( 16 - AF_ATAN_BITS )];\r\n\r\n    if ( angle > AF_ANGLE_PI )\r\n      angle -= AF_ANGLE_2PI;\r\n\r\n    return angle;\r\n  }\r\n\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_sort_pos( FT_UInt  count,\r\n               FT_Pos*  table )\r\n  {\r\n    FT_UInt  i, j;\r\n    FT_Pos   swap;\r\n\r\n\r\n    for ( i = 1; i < count; i++ )\r\n    {\r\n      for ( j = i; j > 0; j-- )\r\n      {\r\n        if ( table[j] >= table[j - 1] )\r\n          break;\r\n\r\n        swap         = table[j];\r\n        table[j]     = table[j - 1];\r\n        table[j - 1] = swap;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_sort_and_quantize_widths( FT_UInt*  count,\r\n                               AF_Width  table,\r\n                               FT_Pos    threshold )\r\n  {\r\n    FT_UInt      i, j;\r\n    FT_UInt      cur_idx;\r\n    FT_Pos       cur_val;\r\n    FT_Pos       sum;\r\n    AF_WidthRec  swap;\r\n\r\n\r\n    if ( *count == 1 )\r\n      return;\r\n\r\n    /* sort */\r\n    for ( i = 1; i < *count; i++ )\r\n    {\r\n      for ( j = i; j > 0; j-- )\r\n      {\r\n        if ( table[j].org >= table[j - 1].org )\r\n          break;\r\n\r\n        swap         = table[j];\r\n        table[j]     = table[j - 1];\r\n        table[j - 1] = swap;\r\n      }\r\n    }\r\n\r\n    cur_idx = 0;\r\n    cur_val = table[cur_idx].org;\r\n\r\n    /* compute and use mean values for clusters not larger than  */\r\n    /* `threshold'; this is very primitive and might not yield   */\r\n    /* the best result, but normally, using reference character  */\r\n    /* `o', `*count' is 2, so the code below is fully sufficient */\r\n    for ( i = 1; i < *count; i++ )\r\n    {\r\n      if ( table[i].org - cur_val > threshold ||\r\n           i == *count - 1                    )\r\n      {\r\n        sum = 0;\r\n\r\n        /* fix loop for end of array */\r\n        if ( table[i].org - cur_val <= threshold &&\r\n             i == *count - 1                     )\r\n          i++;\r\n\r\n        for ( j = cur_idx; j < i; j++ )\r\n        {\r\n          sum         += table[j].org;\r\n          table[j].org = 0;\r\n        }\r\n        table[cur_idx].org = sum / j;\r\n\r\n        if ( i < *count - 1 )\r\n        {\r\n          cur_idx = i + 1;\r\n          cur_val = table[cur_idx].org;\r\n        }\r\n      }\r\n    }\r\n\r\n    cur_idx = 1;\r\n\r\n    /* compress array to remove zero values */\r\n    for ( i = 1; i < *count; i++ )\r\n    {\r\n      if ( table[i].org )\r\n        table[cur_idx++] = table[i];\r\n    }\r\n\r\n    *count = cur_idx;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afangles.h",
    "content": "/*\r\n *  afangles.h\r\n *\r\n *  This is a dummy file, used to please the build system.  It is never\r\n *  included by the auto-fitter sources.\r\n *\r\n */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afcjk.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afcjk.c                                                                */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for CJK script (body).                  */\r\n/*                                                                         */\r\n/*  Copyright 2006-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*\r\n   *  The algorithm is based on akito's autohint patch, available here:\r\n   *\r\n   *  http://www.kde.gr.jp/~akito/patch/freetype2/\r\n   *\r\n   */\r\n\r\n#include <ft2build.h>\r\n#include FT_ADVANCES_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"aftypes.h\"\r\n#include \"aflatin.h\"\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_CJK\r\n\r\n#undef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT\r\n\r\n#include \"afcjk.h\"\r\n#include \"aferrors.h\"\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n#include \"afwarp.h\"\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_afcjk\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****              C J K   G L O B A L   M E T R I C S              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Basically the Latin version with AF_CJKMetrics */\r\n  /* to replace AF_LatinMetrics.                    */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_cjk_metrics_init_widths( AF_CJKMetrics  metrics,\r\n                              FT_Face        face )\r\n  {\r\n    /* scan the array of segments in each direction */\r\n    AF_GlyphHintsRec  hints[1];\r\n\r\n\r\n    af_glyph_hints_init( hints, face->memory );\r\n\r\n    metrics->axis[AF_DIMENSION_HORZ].width_count = 0;\r\n    metrics->axis[AF_DIMENSION_VERT].width_count = 0;\r\n\r\n    {\r\n      FT_Error          error;\r\n      FT_UInt           glyph_index;\r\n      int               dim;\r\n      AF_CJKMetricsRec  dummy[1];\r\n      AF_Scaler         scaler = &dummy->root.scaler;\r\n\r\n\r\n      glyph_index = FT_Get_Char_Index( face,\r\n                                       metrics->root.clazz->standard_char );\r\n      if ( glyph_index == 0 )\r\n        goto Exit;\r\n\r\n      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );\r\n      if ( error || face->glyph->outline.n_points <= 0 )\r\n        goto Exit;\r\n\r\n      FT_ZERO( dummy );\r\n\r\n      dummy->units_per_em = metrics->units_per_em;\r\n\r\n      scaler->x_scale = 0x10000L;\r\n      scaler->y_scale = 0x10000L;\r\n      scaler->x_delta = 0;\r\n      scaler->y_delta = 0;\r\n\r\n      scaler->face        = face;\r\n      scaler->render_mode = FT_RENDER_MODE_NORMAL;\r\n      scaler->flags       = 0;\r\n\r\n      af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy );\r\n\r\n      error = af_glyph_hints_reload( hints, &face->glyph->outline );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n      {\r\n        AF_CJKAxis    axis    = &metrics->axis[dim];\r\n        AF_AxisHints  axhints = &hints->axis[dim];\r\n        AF_Segment    seg, limit, link;\r\n        FT_UInt       num_widths = 0;\r\n\r\n\r\n        error = af_latin_hints_compute_segments( hints, (AF_Dimension)dim );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        af_latin_hints_link_segments( hints, (AF_Dimension)dim );\r\n\r\n        seg   = axhints->segments;\r\n        limit = seg + axhints->num_segments;\r\n\r\n        for ( ; seg < limit; seg++ )\r\n        {\r\n          link = seg->link;\r\n\r\n          /* we only consider stem segments there! */\r\n          if ( link && link->link == seg && link > seg )\r\n          {\r\n            FT_Pos  dist;\r\n\r\n\r\n            dist = seg->pos - link->pos;\r\n            if ( dist < 0 )\r\n              dist = -dist;\r\n\r\n            if ( num_widths < AF_CJK_MAX_WIDTHS )\r\n              axis->widths[num_widths++].org = dist;\r\n          }\r\n        }\r\n\r\n        /* this also replaces multiple almost identical stem widths */\r\n        /* with a single one (the value 100 is heuristic) */\r\n        af_sort_and_quantize_widths( &num_widths, axis->widths,\r\n                                     dummy->units_per_em / 100 );\r\n        axis->width_count = num_widths;\r\n      }\r\n\r\n    Exit:\r\n      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n      {\r\n        AF_CJKAxis  axis = &metrics->axis[dim];\r\n        FT_Pos      stdw;\r\n\r\n\r\n        stdw = ( axis->width_count > 0 ) ? axis->widths[0].org\r\n                                         : AF_LATIN_CONSTANT( metrics, 50 );\r\n\r\n        /* let's try 20% of the smallest width */\r\n        axis->edge_distance_threshold = stdw / 5;\r\n        axis->standard_width          = stdw;\r\n        axis->extra_light             = 0;\r\n      }\r\n    }\r\n\r\n    af_glyph_hints_done( hints );\r\n  }\r\n\r\n\r\n#define AF_CJK_MAX_TEST_CHARACTERS  32\r\n\r\n\r\n  /* Each blue zone has two types of fill and unfill, this is, */\r\n  /* filling the entire glyph square or not.                   */\r\n\r\n  enum\r\n  {\r\n    AF_CJK_BLUE_TYPE_FILL,\r\n    AF_CJK_BLUE_TYPE_UNFILL,\r\n    AF_CJK_BLUE_TYPE_MAX\r\n  };\r\n\r\n\r\n  /* Put some common and representative Han Ideographs characters here. */\r\n  static const FT_ULong af_cjk_hani_blue_chars[AF_CJK_BLUE_MAX]\r\n                                              [AF_CJK_BLUE_TYPE_MAX]\r\n                                              [AF_CJK_MAX_TEST_CHARACTERS] =\r\n  {\r\n    {\r\n      {\r\n        0x4ED6, 0x4EEC, 0x4F60, 0x4F86, 0x5011, 0x5230, 0x548C, 0x5730,\r\n        0x5BF9, 0x5C0D, 0x5C31, 0x5E2D, 0x6211, 0x65F6, 0x6642, 0x6703,\r\n        0x6765, 0x70BA, 0x80FD, 0x8230, 0x8AAA, 0x8BF4, 0x8FD9, 0x9019,\r\n        0x9F4A /* top fill */\r\n      },\r\n      {\r\n        0x519B, 0x540C, 0x5DF2, 0x613F, 0x65E2, 0x661F, 0x662F, 0x666F,\r\n        0x6C11, 0x7167, 0x73B0, 0x73FE, 0x7406, 0x7528, 0x7F6E, 0x8981,\r\n        0x8ECD, 0x90A3, 0x914D, 0x91CC, 0x958B, 0x96F7, 0x9732, 0x9762,\r\n        0x987E /* top unfill */\r\n      }\r\n    },\r\n    {\r\n      {\r\n        0x4E2A, 0x4E3A, 0x4EBA, 0x4ED6, 0x4EE5, 0x4EEC, 0x4F60, 0x4F86,\r\n        0x500B, 0x5011, 0x5230, 0x548C, 0x5927, 0x5BF9, 0x5C0D, 0x5C31,\r\n        0x6211, 0x65F6, 0x6642, 0x6709, 0x6765, 0x70BA, 0x8981, 0x8AAA,\r\n        0x8BF4 /* bottom fill */\r\n      },\r\n      {\r\n        0x4E3B, 0x4E9B, 0x56E0, 0x5B83, 0x60F3, 0x610F, 0x7406, 0x751F,\r\n        0x7576, 0x770B, 0x7740, 0x7F6E, 0x8005, 0x81EA, 0x8457, 0x88E1,\r\n        0x8FC7, 0x8FD8, 0x8FDB, 0x9032, 0x904E, 0x9053, 0x9084, 0x91CC,\r\n        0x9762 /* bottom unfill */\r\n      }\r\n    },\r\n#ifndef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT\r\n      { {0x0000}, {0x0000} },\r\n      { {0x0000}, {0x0000} }\r\n#else\r\n    {\r\n      {\r\n        0x4E9B, 0x4EEC, 0x4F60, 0x4F86, 0x5011, 0x5230, 0x548C, 0x5730,\r\n        0x5979, 0x5C06, 0x5C07, 0x5C31, 0x5E74, 0x5F97, 0x60C5, 0x6700,\r\n        0x6837, 0x6A23, 0x7406, 0x80FD, 0x8AAA, 0x8BF4, 0x8FD9, 0x9019,\r\n        0x901A /* left fill */\r\n      },\r\n      {\r\n        0x5373, 0x5417, 0x5427, 0x542C, 0x5462, 0x54C1, 0x54CD, 0x55CE,\r\n        0x5E08, 0x5E2B, 0x6536, 0x65AD, 0x65B7, 0x660E, 0x773C, 0x9593,\r\n        0x95F4, 0x9645, 0x9648, 0x9650, 0x9664, 0x9673, 0x968F, 0x969B,\r\n        0x96A8 /* left unfill */\r\n      }\r\n    },\r\n    {\r\n      {\r\n        0x4E8B, 0x524D, 0x5B78, 0x5C06, 0x5C07, 0x60C5, 0x60F3, 0x6216,\r\n        0x653F, 0x65AF, 0x65B0, 0x6837, 0x6A23, 0x6C11, 0x6C92, 0x6CA1,\r\n        0x7136, 0x7279, 0x73B0, 0x73FE, 0x7403, 0x7B2C, 0x7D93, 0x8C01,\r\n        0x8D77 /* right fill */\r\n      },\r\n      {\r\n        0x4F8B, 0x5225, 0x522B, 0x5236, 0x52A8, 0x52D5, 0x5417, 0x55CE,\r\n        0x589E, 0x6307, 0x660E, 0x671D, 0x671F, 0x6784, 0x7269, 0x786E,\r\n        0x79CD, 0x8ABF, 0x8C03, 0x8CBB, 0x8D39, 0x90A3, 0x90FD, 0x9593,\r\n        0x95F4 /* right unfill */\r\n      }\r\n    }\r\n#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */\r\n  };\r\n\r\n\r\n  /* Calculate blue zones for all the CJK_BLUE_XXX's. */\r\n\r\n  static void\r\n  af_cjk_metrics_init_blues( AF_CJKMetrics   metrics,\r\n                             FT_Face         face,\r\n                             const FT_ULong  blue_chars\r\n                                               [AF_CJK_BLUE_MAX]\r\n                                               [AF_CJK_BLUE_TYPE_MAX]\r\n                                               [AF_CJK_MAX_TEST_CHARACTERS] )\r\n  {\r\n    FT_Pos        fills[AF_CJK_MAX_TEST_CHARACTERS];\r\n    FT_Pos        flats[AF_CJK_MAX_TEST_CHARACTERS];\r\n\r\n    FT_Int        num_fills;\r\n    FT_Int        num_flats;\r\n\r\n    FT_Int        bb;\r\n    AF_CJKBlue    blue;\r\n    FT_Error      error;\r\n    AF_CJKAxis    axis;\r\n    FT_GlyphSlot  glyph = face->glyph;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_String*  cjk_blue_name[AF_CJK_BLUE_MAX] = {\r\n      (FT_String*)\"top\",\r\n      (FT_String*)\"bottom\",\r\n      (FT_String*)\"left\",\r\n      (FT_String*)\"right\"\r\n    };\r\n    FT_String*  cjk_blue_type_name[AF_CJK_BLUE_TYPE_MAX] = {\r\n      (FT_String*)\"filled\",\r\n      (FT_String*)\"unfilled\"\r\n    };\r\n#endif\r\n\r\n\r\n    /* We compute the blues simply by loading each character from the */\r\n    /* `blue_chars[blues]' string, then computing its extreme points  */\r\n    /* (depending blue zone type etc.).                               */\r\n\r\n    FT_TRACE5(( \"cjk blue zones computation\\n\" ));\r\n    FT_TRACE5(( \"------------------------------------------------\\n\" ));\r\n\r\n    for ( bb = 0; bb < AF_CJK_BLUE_MAX; bb++ )\r\n    {\r\n      FT_Int   fill_type;\r\n      FT_Pos*  blue_ref;\r\n      FT_Pos*  blue_shoot;\r\n\r\n\r\n      num_fills = 0;\r\n      num_flats = 0;\r\n\r\n      for ( fill_type = 0; fill_type < AF_CJK_BLUE_TYPE_MAX; fill_type++ )\r\n      {\r\n        const FT_ULong*  p     = blue_chars[bb][fill_type];\r\n        const FT_ULong*  limit = p + AF_CJK_MAX_TEST_CHARACTERS;\r\n        FT_Bool          fill  = FT_BOOL(\r\n                                   fill_type == AF_CJK_BLUE_TYPE_FILL );\r\n\r\n\r\n        FT_TRACE5(( \"cjk blue %s/%s\\n\", cjk_blue_name[bb],\r\n                                        cjk_blue_type_name[fill_type] ));\r\n\r\n\r\n        for ( ; p < limit && *p; p++ )\r\n        {\r\n          FT_UInt     glyph_index;\r\n          FT_Pos      best_pos; /* same as points.y */\r\n          FT_Int      best_point;\r\n          FT_Vector*  points;\r\n\r\n\r\n          FT_TRACE5(( \"  U+%lX...\", *p ));\r\n\r\n          /* load the character in the face -- skip unknown or empty ones */\r\n          glyph_index = FT_Get_Char_Index( face, *p );\r\n          if ( glyph_index == 0 )\r\n          {\r\n            FT_TRACE5(( \"unavailable\\n\" ));\r\n            continue;\r\n          }\r\n\r\n          error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );\r\n          if ( error || glyph->outline.n_points <= 0 )\r\n          {\r\n            FT_TRACE5(( \"no outline\\n\" ));\r\n            continue;\r\n          }\r\n\r\n          /* now compute min or max point indices and coordinates */\r\n          points     = glyph->outline.points;\r\n          best_point = -1;\r\n          best_pos   = 0;  /* make compiler happy */\r\n\r\n          {\r\n            FT_Int  nn;\r\n            FT_Int  first = 0;\r\n            FT_Int  last  = -1;\r\n\r\n\r\n            for ( nn = 0;\r\n                  nn < glyph->outline.n_contours;\r\n                  first = last + 1, nn++ )\r\n            {\r\n              FT_Int  pp;\r\n\r\n\r\n              last = glyph->outline.contours[nn];\r\n\r\n              /* Avoid single-point contours since they are never       */\r\n              /* rasterized.  In some fonts, they correspond to mark    */\r\n              /* attachment points which are way outside of the glyph's */\r\n              /* real outline.                                          */\r\n              if ( last <= first )\r\n                continue;\r\n\r\n              switch ( bb )\r\n              {\r\n              case AF_CJK_BLUE_TOP:\r\n                for ( pp = first; pp <= last; pp++ )\r\n                  if ( best_point < 0 || points[pp].y > best_pos )\r\n                  {\r\n                    best_point = pp;\r\n                    best_pos   = points[pp].y;\r\n                  }\r\n                break;\r\n\r\n              case AF_CJK_BLUE_BOTTOM:\r\n                for ( pp = first; pp <= last; pp++ )\r\n                  if ( best_point < 0 || points[pp].y < best_pos )\r\n                  {\r\n                    best_point = pp;\r\n                    best_pos   = points[pp].y;\r\n                  }\r\n                break;\r\n\r\n              case AF_CJK_BLUE_LEFT:\r\n                for ( pp = first; pp <= last; pp++ )\r\n                  if ( best_point < 0 || points[pp].x < best_pos )\r\n                  {\r\n                    best_point = pp;\r\n                    best_pos   = points[pp].x;\r\n                  }\r\n                break;\r\n\r\n              case AF_CJK_BLUE_RIGHT:\r\n                for ( pp = first; pp <= last; pp++ )\r\n                  if ( best_point < 0 || points[pp].x > best_pos )\r\n                  {\r\n                    best_point = pp;\r\n                    best_pos   = points[pp].x;\r\n                  }\r\n                break;\r\n\r\n              default:\r\n                ;\r\n              }\r\n            }\r\n            FT_TRACE5(( \"best_pos=%5ld\\n\", best_pos ));\r\n          }\r\n\r\n          if ( fill )\r\n            fills[num_fills++] = best_pos;\r\n          else\r\n            flats[num_flats++] = best_pos;\r\n        }\r\n      }\r\n\r\n      if ( num_flats == 0 && num_fills == 0 )\r\n      {\r\n        /*\r\n         *  we couldn't find a single glyph to compute this blue zone,\r\n         *  we will simply ignore it then\r\n         */\r\n        FT_TRACE5(( \"empty\\n\" ));\r\n        continue;\r\n      }\r\n\r\n      /* we have computed the contents of the `fill' and `flats' tables, */\r\n      /* now determine the reference position of the blue --             */\r\n      /* we simply take the median value after a simple sort             */\r\n      af_sort_pos( num_flats, flats );\r\n      af_sort_pos( num_fills, fills );\r\n\r\n      if ( AF_CJK_BLUE_TOP == bb || AF_CJK_BLUE_BOTTOM == bb )\r\n        axis = &metrics->axis[AF_DIMENSION_VERT];\r\n      else\r\n        axis = &metrics->axis[AF_DIMENSION_HORZ];\r\n\r\n      blue       = & axis->blues[axis->blue_count];\r\n      blue_ref   = & blue->ref.org;\r\n      blue_shoot = & blue->shoot.org;\r\n\r\n      axis->blue_count++;\r\n      if ( num_flats == 0 )\r\n      {\r\n        *blue_ref   = fills[num_fills / 2];\r\n        *blue_shoot = fills[num_fills / 2];\r\n      }\r\n      else if ( num_fills == 0 )\r\n      {\r\n        *blue_ref   = flats[num_flats / 2];\r\n        *blue_shoot = flats[num_flats / 2];\r\n      }\r\n      else\r\n      {\r\n        *blue_ref   = fills[num_fills / 2];\r\n        *blue_shoot = flats[num_flats / 2];\r\n      }\r\n\r\n      /* make sure blue_ref >= blue_shoot for top/right or */\r\n      /* vice versa for bottom/left                        */\r\n      if ( *blue_shoot != *blue_ref )\r\n      {\r\n        FT_Pos   ref       = *blue_ref;\r\n        FT_Pos   shoot     = *blue_shoot;\r\n        FT_Bool  under_ref = FT_BOOL( shoot < ref );\r\n\r\n\r\n        if ( (AF_CJK_BLUE_TOP == bb || AF_CJK_BLUE_RIGHT == bb) ^ under_ref )\r\n          *blue_shoot = *blue_ref = ( shoot + ref ) / 2;\r\n      }\r\n\r\n      blue->flags = 0;\r\n      if ( AF_CJK_BLUE_TOP == bb )\r\n        blue->flags |= AF_CJK_BLUE_IS_TOP;\r\n      else if ( AF_CJK_BLUE_RIGHT == bb )\r\n        blue->flags |= AF_CJK_BLUE_IS_RIGHT;\r\n\r\n      FT_TRACE5(( \"-- cjk %s bluezone ref = %ld shoot = %ld\\n\",\r\n                  cjk_blue_name[bb], *blue_ref, *blue_shoot ));\r\n    }\r\n\r\n    return;\r\n  }\r\n\r\n\r\n  /* Basically the Latin version with type AF_CJKMetrics for metrics. */\r\n  FT_LOCAL_DEF( void )\r\n  af_cjk_metrics_check_digits( AF_CJKMetrics  metrics,\r\n                               FT_Face        face )\r\n  {\r\n    FT_UInt   i;\r\n    FT_Bool   started = 0, same_width = 1;\r\n    FT_Fixed  advance, old_advance = 0;\r\n\r\n\r\n    /* check whether all ASCII digits have the same advance width; */\r\n    /* digit `0' is 0x30 in all supported charmaps                 */\r\n    for ( i = 0x30; i <= 0x39; i++ )\r\n    {\r\n      FT_UInt  glyph_index;\r\n\r\n\r\n      glyph_index = FT_Get_Char_Index( face, i );\r\n      if ( glyph_index == 0 )\r\n        continue;\r\n\r\n      if ( FT_Get_Advance( face, glyph_index,\r\n                           FT_LOAD_NO_SCALE         |\r\n                           FT_LOAD_NO_HINTING       |\r\n                           FT_LOAD_IGNORE_TRANSFORM,\r\n                           &advance ) )\r\n        continue;\r\n\r\n      if ( started )\r\n      {\r\n        if ( advance != old_advance )\r\n        {\r\n          same_width = 0;\r\n          break;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        old_advance = advance;\r\n        started     = 1;\r\n      }\r\n    }\r\n\r\n    metrics->root.digits_have_same_width = same_width;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_cjk_metrics_init( AF_CJKMetrics  metrics,\r\n                       FT_Face        face )\r\n  {\r\n    FT_CharMap  oldmap = face->charmap;\r\n\r\n\r\n    metrics->units_per_em = face->units_per_EM;\r\n\r\n    if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )\r\n      face->charmap = NULL;\r\n    else\r\n    {\r\n      af_cjk_metrics_init_widths( metrics, face );\r\n      af_cjk_metrics_init_blues( metrics, face, af_cjk_hani_blue_chars );\r\n      af_cjk_metrics_check_digits( metrics, face );\r\n    }\r\n\r\n    FT_Set_Charmap( face, oldmap );\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  static void\r\n  af_cjk_metrics_scale_dim( AF_CJKMetrics  metrics,\r\n                            AF_Scaler      scaler,\r\n                            AF_Dimension   dim )\r\n  {\r\n    FT_Fixed    scale;\r\n    FT_Pos      delta;\r\n    AF_CJKAxis  axis;\r\n    FT_UInt     nn;\r\n\r\n\r\n    axis = &metrics->axis[dim];\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      scale = scaler->x_scale;\r\n      delta = scaler->x_delta;\r\n    }\r\n    else\r\n    {\r\n      scale = scaler->y_scale;\r\n      delta = scaler->y_delta;\r\n    }\r\n\r\n    if ( axis->org_scale == scale && axis->org_delta == delta )\r\n      return;\r\n\r\n    axis->org_scale = scale;\r\n    axis->org_delta = delta;\r\n\r\n    axis->scale = scale;\r\n    axis->delta = delta;\r\n\r\n    /* scale the blue zones */\r\n    for ( nn = 0; nn < axis->blue_count; nn++ )\r\n    {\r\n      AF_CJKBlue  blue = &axis->blues[nn];\r\n      FT_Pos      dist;\r\n\r\n\r\n      blue->ref.cur   = FT_MulFix( blue->ref.org, scale ) + delta;\r\n      blue->ref.fit   = blue->ref.cur;\r\n      blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta;\r\n      blue->shoot.fit = blue->shoot.cur;\r\n      blue->flags    &= ~AF_CJK_BLUE_ACTIVE;\r\n\r\n      /* a blue zone is only active if it is less than 3/4 pixels tall */\r\n      dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );\r\n      if ( dist <= 48 && dist >= -48 )\r\n      {\r\n        FT_Pos  delta1, delta2;\r\n\r\n\r\n        blue->ref.fit  = FT_PIX_ROUND( blue->ref.cur );\r\n\r\n        /* shoot is under shoot for cjk */\r\n        delta1 = FT_DivFix( blue->ref.fit, scale ) - blue->shoot.org;\r\n        delta2 = delta1;\r\n        if ( delta1 < 0 )\r\n          delta2 = -delta2;\r\n\r\n        delta2 = FT_MulFix( delta2, scale );\r\n\r\n        FT_TRACE5(( \"delta: %d\", delta1 ));\r\n        if ( delta2 < 32 )\r\n          delta2 = 0;\r\n#if 0\r\n        else if ( delta2 < 64 )\r\n          delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );\r\n#endif\r\n        else\r\n          delta2 = FT_PIX_ROUND( delta2 );\r\n        FT_TRACE5(( \"/%d\\n\", delta2 ));\r\n\r\n        if ( delta1 < 0 )\r\n          delta2 = -delta2;\r\n\r\n        blue->shoot.fit = blue->ref.fit - delta2;\r\n\r\n        FT_TRACE5(( \">> active cjk blue zone %c%d[%ld/%ld]: \"\r\n                     \"ref: cur=%.2f fit=%.2f shoot: cur=%.2f fit=%.2f\\n\",\r\n                       ( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V',\r\n                       nn, blue->ref.org, blue->shoot.org,\r\n                       blue->ref.cur / 64.0, blue->ref.fit / 64.0,\r\n                       blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 ));\r\n\r\n        blue->flags |= AF_CJK_BLUE_ACTIVE;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_cjk_metrics_scale( AF_CJKMetrics  metrics,\r\n                        AF_Scaler      scaler )\r\n  {\r\n    metrics->root.scaler = *scaler;\r\n\r\n    af_cjk_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );\r\n    af_cjk_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****              C J K   G L Y P H   A N A L Y S I S              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static FT_Error\r\n  af_cjk_hints_compute_segments( AF_GlyphHints  hints,\r\n                                 AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis          = &hints->axis[dim];\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    FT_Error      error;\r\n    AF_Segment    seg;\r\n\r\n\r\n    error = af_latin_hints_compute_segments( hints, dim );\r\n    if ( error )\r\n      return error;\r\n\r\n    /* a segment is round if it doesn't have successive */\r\n    /* on-curve points.                                 */\r\n    for ( seg = segments; seg < segment_limit; seg++ )\r\n    {\r\n      AF_Point  pt   = seg->first;\r\n      AF_Point  last = seg->last;\r\n      AF_Flags  f0   = (AF_Flags)(pt->flags & AF_FLAG_CONTROL);\r\n      AF_Flags  f1;\r\n\r\n\r\n      seg->flags &= ~AF_EDGE_ROUND;\r\n\r\n      for ( ; pt != last; f0 = f1 )\r\n      {\r\n        pt = pt->next;\r\n        f1 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL);\r\n\r\n        if ( !f0 && !f1 )\r\n          break;\r\n\r\n        if ( pt == last )\r\n          seg->flags |= AF_EDGE_ROUND;\r\n      }\r\n    }\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  static void\r\n  af_cjk_hints_link_segments( AF_GlyphHints  hints,\r\n                              AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis          = &hints->axis[dim];\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    AF_Direction  major_dir     = axis->major_dir;\r\n    AF_Segment    seg1, seg2;\r\n    FT_Pos        len_threshold;\r\n    FT_Pos        dist_threshold;\r\n\r\n\r\n    len_threshold = AF_LATIN_CONSTANT( hints->metrics, 8 );\r\n\r\n    dist_threshold = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale\r\n                                                  : hints->y_scale;\r\n    dist_threshold = FT_DivFix( 64 * 3, dist_threshold );\r\n\r\n    /* now compare each segment to the others */\r\n    for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n    {\r\n      /* the fake segments are for metrics hinting only */\r\n      if ( seg1->first == seg1->last )\r\n        continue;\r\n\r\n      if ( seg1->dir != major_dir )\r\n        continue;\r\n\r\n      for ( seg2 = segments; seg2 < segment_limit; seg2++ )\r\n        if ( seg2 != seg1 && seg1->dir + seg2->dir == 0 )\r\n        {\r\n          FT_Pos  dist = seg2->pos - seg1->pos;\r\n\r\n\r\n          if ( dist < 0 )\r\n            continue;\r\n\r\n          {\r\n            FT_Pos  min = seg1->min_coord;\r\n            FT_Pos  max = seg1->max_coord;\r\n            FT_Pos  len;\r\n\r\n\r\n            if ( min < seg2->min_coord )\r\n              min = seg2->min_coord;\r\n\r\n            if ( max > seg2->max_coord )\r\n              max = seg2->max_coord;\r\n\r\n            len = max - min;\r\n            if ( len >= len_threshold )\r\n            {\r\n              if ( dist * 8 < seg1->score * 9                        &&\r\n                   ( dist * 8 < seg1->score * 7 || seg1->len < len ) )\r\n              {\r\n                seg1->score = dist;\r\n                seg1->len   = len;\r\n                seg1->link  = seg2;\r\n              }\r\n\r\n              if ( dist * 8 < seg2->score * 9                        &&\r\n                   ( dist * 8 < seg2->score * 7 || seg2->len < len ) )\r\n              {\r\n                seg2->score = dist;\r\n                seg2->len   = len;\r\n                seg2->link  = seg1;\r\n              }\r\n            }\r\n          }\r\n        }\r\n    }\r\n\r\n    /*\r\n     *  now compute the `serif' segments\r\n     *\r\n     *  In Hanzi, some strokes are wider on one or both of the ends.\r\n     *  We either identify the stems on the ends as serifs or remove\r\n     *  the linkage, depending on the length of the stems.\r\n     *\r\n     */\r\n\r\n    {\r\n      AF_Segment  link1, link2;\r\n\r\n\r\n      for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n      {\r\n        link1 = seg1->link;\r\n        if ( !link1 || link1->link != seg1 || link1->pos <= seg1->pos )\r\n          continue;\r\n\r\n        if ( seg1->score >= dist_threshold )\r\n          continue;\r\n\r\n        for ( seg2 = segments; seg2 < segment_limit; seg2++ )\r\n        {\r\n          if ( seg2->pos > seg1->pos || seg1 == seg2 )\r\n            continue;\r\n\r\n          link2 = seg2->link;\r\n          if ( !link2 || link2->link != seg2 || link2->pos < link1->pos )\r\n            continue;\r\n\r\n          if ( seg1->pos == seg2->pos && link1->pos == link2->pos )\r\n            continue;\r\n\r\n          if ( seg2->score <= seg1->score || seg1->score * 4 <= seg2->score )\r\n            continue;\r\n\r\n          /* seg2 < seg1 < link1 < link2 */\r\n\r\n          if ( seg1->len >= seg2->len * 3 )\r\n          {\r\n            AF_Segment  seg;\r\n\r\n\r\n            for ( seg = segments; seg < segment_limit; seg++ )\r\n            {\r\n              AF_Segment  link = seg->link;\r\n\r\n\r\n              if ( link == seg2 )\r\n              {\r\n                seg->link  = 0;\r\n                seg->serif = link1;\r\n              }\r\n              else if ( link == link2 )\r\n              {\r\n                seg->link  = 0;\r\n                seg->serif = seg1;\r\n              }\r\n            }\r\n          }\r\n          else\r\n          {\r\n            seg1->link = link1->link = 0;\r\n\r\n            break;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n    {\r\n      seg2 = seg1->link;\r\n\r\n      if ( seg2 )\r\n      {\r\n        seg2->num_linked++;\r\n        if ( seg2->link != seg1 )\r\n        {\r\n          seg1->link = 0;\r\n\r\n          if ( seg2->score < dist_threshold || seg1->score < seg2->score * 4 )\r\n            seg1->serif = seg2->link;\r\n          else\r\n            seg2->num_linked--;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_cjk_hints_compute_edges( AF_GlyphHints  hints,\r\n                              AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis   = &hints->axis[dim];\r\n    FT_Error      error  = AF_Err_Ok;\r\n    FT_Memory     memory = hints->memory;\r\n    AF_CJKAxis    laxis  = &((AF_CJKMetrics)hints->metrics)->axis[dim];\r\n\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    AF_Segment    seg;\r\n\r\n    FT_Fixed      scale;\r\n    FT_Pos        edge_distance_threshold;\r\n\r\n\r\n    axis->num_edges = 0;\r\n\r\n    scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale\r\n                                         : hints->y_scale;\r\n\r\n    /*********************************************************************/\r\n    /*                                                                   */\r\n    /* We begin by generating a sorted table of edges for the current    */\r\n    /* direction.  To do so, we simply scan each segment and try to find */\r\n    /* an edge in our table that corresponds to its position.            */\r\n    /*                                                                   */\r\n    /* If no edge is found, we create and insert a new edge in the       */\r\n    /* sorted table.  Otherwise, we simply add the segment to the edge's */\r\n    /* list which is then processed in the second step to compute the    */\r\n    /* edge's properties.                                                */\r\n    /*                                                                   */\r\n    /* Note that the edges table is sorted along the segment/edge        */\r\n    /* position.                                                         */\r\n    /*                                                                   */\r\n    /*********************************************************************/\r\n\r\n    edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold,\r\n                                         scale );\r\n    if ( edge_distance_threshold > 64 / 4 )\r\n      edge_distance_threshold = FT_DivFix( 64 / 4, scale );\r\n    else\r\n      edge_distance_threshold = laxis->edge_distance_threshold;\r\n\r\n    for ( seg = segments; seg < segment_limit; seg++ )\r\n    {\r\n      AF_Edge  found = 0;\r\n      FT_Pos   best  = 0xFFFFU;\r\n      FT_Int   ee;\r\n\r\n\r\n      /* look for an edge corresponding to the segment */\r\n      for ( ee = 0; ee < axis->num_edges; ee++ )\r\n      {\r\n        AF_Edge  edge = axis->edges + ee;\r\n        FT_Pos   dist;\r\n\r\n\r\n        if ( edge->dir != seg->dir )\r\n          continue;\r\n\r\n        dist = seg->pos - edge->fpos;\r\n        if ( dist < 0 )\r\n          dist = -dist;\r\n\r\n        if ( dist < edge_distance_threshold && dist < best )\r\n        {\r\n          AF_Segment  link = seg->link;\r\n\r\n\r\n          /* check whether all linked segments of the candidate edge */\r\n          /* can make a single edge.                                 */\r\n          if ( link )\r\n          {\r\n            AF_Segment  seg1 = edge->first;\r\n            AF_Segment  link1;\r\n            FT_Pos      dist2 = 0;\r\n\r\n\r\n            do\r\n            {\r\n              link1 = seg1->link;\r\n              if ( link1 )\r\n              {\r\n                dist2 = AF_SEGMENT_DIST( link, link1 );\r\n                if ( dist2 >= edge_distance_threshold )\r\n                  break;\r\n              }\r\n\r\n            } while ( ( seg1 = seg1->edge_next ) != edge->first );\r\n\r\n            if ( dist2 >= edge_distance_threshold )\r\n              continue;\r\n          }\r\n\r\n          best  = dist;\r\n          found = edge;\r\n        }\r\n      }\r\n\r\n      if ( !found )\r\n      {\r\n        AF_Edge  edge;\r\n\r\n\r\n        /* insert a new edge in the list and */\r\n        /* sort according to the position    */\r\n        error = af_axis_hints_new_edge( axis, seg->pos,\r\n                                        (AF_Direction)seg->dir,\r\n                                        memory, &edge );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        /* add the segment to the new edge's list */\r\n        FT_ZERO( edge );\r\n\r\n        edge->first    = seg;\r\n        edge->last     = seg;\r\n        edge->fpos     = seg->pos;\r\n        edge->opos     = edge->pos = FT_MulFix( seg->pos, scale );\r\n        seg->edge_next = seg;\r\n        edge->dir      = seg->dir;\r\n      }\r\n      else\r\n      {\r\n        /* if an edge was found, simply add the segment to the edge's */\r\n        /* list                                                       */\r\n        seg->edge_next         = found->first;\r\n        found->last->edge_next = seg;\r\n        found->last            = seg;\r\n      }\r\n    }\r\n\r\n    /*********************************************************************/\r\n    /*                                                                   */\r\n    /* Good, we now compute each edge's properties according to segments */\r\n    /* found on its position.  Basically, these are as follows.          */\r\n    /*                                                                   */\r\n    /*  - edge's main direction                                          */\r\n    /*  - stem edge, serif edge or both (which defaults to stem then)    */\r\n    /*  - rounded edge, straight or both (which defaults to straight)    */\r\n    /*  - link for edge                                                  */\r\n    /*                                                                   */\r\n    /*********************************************************************/\r\n\r\n    /* first of all, set the `edge' field in each segment -- this is     */\r\n    /* required in order to compute edge links                           */\r\n    /*                                                                   */\r\n    /* Note that removing this loop and setting the `edge' field of each */\r\n    /* segment directly in the code above slows down execution speed for */\r\n    /* some reasons on platforms like the Sun.                           */\r\n\r\n    {\r\n      AF_Edge  edges      = axis->edges;\r\n      AF_Edge  edge_limit = edges + axis->num_edges;\r\n      AF_Edge  edge;\r\n\r\n\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        seg = edge->first;\r\n        if ( seg )\r\n          do\r\n          {\r\n            seg->edge = edge;\r\n            seg       = seg->edge_next;\r\n\r\n          } while ( seg != edge->first );\r\n      }\r\n\r\n      /* now compute each edge properties */\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        FT_Int  is_round    = 0;  /* does it contain round segments?    */\r\n        FT_Int  is_straight = 0;  /* does it contain straight segments? */\r\n\r\n\r\n        seg = edge->first;\r\n\r\n        do\r\n        {\r\n          FT_Bool  is_serif;\r\n\r\n\r\n          /* check for roundness of segment */\r\n          if ( seg->flags & AF_EDGE_ROUND )\r\n            is_round++;\r\n          else\r\n            is_straight++;\r\n\r\n          /* check for links -- if seg->serif is set, then seg->link must */\r\n          /* be ignored                                                   */\r\n          is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge );\r\n\r\n          if ( seg->link || is_serif )\r\n          {\r\n            AF_Edge     edge2;\r\n            AF_Segment  seg2;\r\n\r\n\r\n            edge2 = edge->link;\r\n            seg2  = seg->link;\r\n\r\n            if ( is_serif )\r\n            {\r\n              seg2  = seg->serif;\r\n              edge2 = edge->serif;\r\n            }\r\n\r\n            if ( edge2 )\r\n            {\r\n              FT_Pos  edge_delta;\r\n              FT_Pos  seg_delta;\r\n\r\n\r\n              edge_delta = edge->fpos - edge2->fpos;\r\n              if ( edge_delta < 0 )\r\n                edge_delta = -edge_delta;\r\n\r\n              seg_delta = AF_SEGMENT_DIST( seg, seg2 );\r\n\r\n              if ( seg_delta < edge_delta )\r\n                edge2 = seg2->edge;\r\n            }\r\n            else\r\n              edge2 = seg2->edge;\r\n\r\n            if ( is_serif )\r\n            {\r\n              edge->serif   = edge2;\r\n              edge2->flags |= AF_EDGE_SERIF;\r\n            }\r\n            else\r\n              edge->link  = edge2;\r\n          }\r\n\r\n          seg = seg->edge_next;\r\n\r\n        } while ( seg != edge->first );\r\n\r\n        /* set the round/straight flags */\r\n        edge->flags = AF_EDGE_NORMAL;\r\n\r\n        if ( is_round > 0 && is_round >= is_straight )\r\n          edge->flags |= AF_EDGE_ROUND;\r\n\r\n        /* get rid of serifs if link is set                 */\r\n        /* XXX: This gets rid of many unpleasant artefacts! */\r\n        /*      Example: the `c' in cour.pfa at size 13     */\r\n\r\n        if ( edge->serif && edge->link )\r\n          edge->serif = 0;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_cjk_hints_detect_features( AF_GlyphHints  hints,\r\n                                AF_Dimension   dim )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = af_cjk_hints_compute_segments( hints, dim );\r\n    if ( !error )\r\n    {\r\n      af_cjk_hints_link_segments( hints, dim );\r\n\r\n      error = af_cjk_hints_compute_edges( hints, dim );\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_cjk_hints_compute_blue_edges( AF_GlyphHints  hints,\r\n                                   AF_CJKMetrics  metrics,\r\n                                   AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis       = &hints->axis[dim];\r\n    AF_Edge       edge       = axis->edges;\r\n    AF_Edge       edge_limit = edge + axis->num_edges;\r\n    AF_CJKAxis    cjk        = &metrics->axis[dim];\r\n    FT_Fixed      scale      = cjk->scale;\r\n    FT_Pos        best_dist0;  /* initial threshold */\r\n\r\n\r\n    /* compute the initial threshold as a fraction of the EM size */\r\n    best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale );\r\n\r\n    if ( best_dist0 > 64 / 2 ) /* maximum 1/2 pixel */\r\n      best_dist0 = 64 / 2;\r\n\r\n    /* compute which blue zones are active, i.e. have their scaled */\r\n    /* size < 3/4 pixels                                           */\r\n\r\n    /* If the distant between an edge and a blue zone is shorter than */\r\n    /* best_dist0, set the blue zone for the edge.  Then search for   */\r\n    /* the blue zone with the smallest best_dist to the edge.         */\r\n\r\n    for ( ; edge < edge_limit; edge++ )\r\n    {\r\n      FT_UInt   bb;\r\n      AF_Width  best_blue = NULL;\r\n      FT_Pos    best_dist = best_dist0;\r\n\r\n\r\n      for ( bb = 0; bb < cjk->blue_count; bb++ )\r\n      {\r\n        AF_CJKBlue  blue = cjk->blues + bb;\r\n        FT_Bool     is_top_right_blue, is_major_dir;\r\n\r\n\r\n        /* skip inactive blue zones (i.e., those that are too small) */\r\n        if ( !( blue->flags & AF_CJK_BLUE_ACTIVE ) )\r\n          continue;\r\n\r\n        /* if it is a top zone, check for right edges -- if it is a bottom */\r\n        /* zone, check for left edges                                      */\r\n        /*                                                                 */\r\n        /* of course, that's for TrueType                                  */\r\n        is_top_right_blue  =\r\n          FT_BOOL( ( ( blue->flags & AF_CJK_BLUE_IS_TOP )   != 0 ) ||\r\n                   ( ( blue->flags & AF_CJK_BLUE_IS_RIGHT ) != 0 ) );\r\n        is_major_dir = FT_BOOL( edge->dir == axis->major_dir );\r\n\r\n        /* if it is a top zone, the edge must be against the major    */\r\n        /* direction; if it is a bottom zone, it must be in the major */\r\n        /* direction                                                  */\r\n        if ( is_top_right_blue ^ is_major_dir )\r\n        {\r\n          FT_Pos    dist;\r\n          AF_Width  compare;\r\n\r\n\r\n          /* Compare the edge to the closest blue zone type */\r\n          if ( FT_ABS( edge->fpos - blue->ref.org ) >\r\n               FT_ABS( edge->fpos - blue->shoot.org ) )\r\n            compare = &blue->shoot;\r\n          else\r\n            compare = &blue->ref;\r\n\r\n          dist = edge->fpos - compare->org;\r\n          if ( dist < 0 )\r\n            dist = -dist;\r\n\r\n          dist = FT_MulFix( dist, scale );\r\n          if ( dist < best_dist )\r\n          {\r\n            best_dist = dist;\r\n            best_blue = compare;\r\n          }\r\n        }\r\n      }\r\n\r\n      if ( best_blue )\r\n        edge->blue_edge = best_blue;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_cjk_hints_init( AF_GlyphHints  hints,\r\n                     AF_CJKMetrics  metrics )\r\n  {\r\n    FT_Render_Mode  mode;\r\n    FT_UInt32       scaler_flags, other_flags;\r\n\r\n\r\n    af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics );\r\n\r\n    /*\r\n     *  correct x_scale and y_scale when needed, since they may have\r\n     *  been modified af_cjk_scale_dim above\r\n     */\r\n    hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale;\r\n    hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta;\r\n    hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale;\r\n    hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta;\r\n\r\n    /* compute flags depending on render mode, etc. */\r\n    mode = metrics->root.scaler.render_mode;\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n    if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )\r\n      metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;\r\n#endif\r\n\r\n    scaler_flags = hints->scaler_flags;\r\n    other_flags  = 0;\r\n\r\n    /*\r\n     *  We snap the width of vertical stems for the monochrome and\r\n     *  horizontal LCD rendering targets only.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )\r\n      other_flags |= AF_LATIN_HINTS_HORZ_SNAP;\r\n\r\n    /*\r\n     *  We snap the width of horizontal stems for the monochrome and\r\n     *  vertical LCD rendering targets only.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )\r\n      other_flags |= AF_LATIN_HINTS_VERT_SNAP;\r\n\r\n    /*\r\n     *  We adjust stems to full pixels only if we don't use the `light' mode.\r\n     */\r\n    if ( mode != FT_RENDER_MODE_LIGHT )\r\n      other_flags |= AF_LATIN_HINTS_STEM_ADJUST;\r\n\r\n    if ( mode == FT_RENDER_MODE_MONO )\r\n      other_flags |= AF_LATIN_HINTS_MONO;\r\n\r\n    scaler_flags |= AF_SCALER_FLAG_NO_ADVANCE;\r\n\r\n    hints->scaler_flags = scaler_flags;\r\n    hints->other_flags  = other_flags;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****          C J K   G L Y P H   G R I D - F I T T I N G          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* snap a given width in scaled coordinates to one of the */\r\n  /* current standard widths                                */\r\n\r\n  static FT_Pos\r\n  af_cjk_snap_width( AF_Width  widths,\r\n                     FT_Int    count,\r\n                     FT_Pos    width )\r\n  {\r\n    int     n;\r\n    FT_Pos  best      = 64 + 32 + 2;\r\n    FT_Pos  reference = width;\r\n    FT_Pos  scaled;\r\n\r\n\r\n    for ( n = 0; n < count; n++ )\r\n    {\r\n      FT_Pos  w;\r\n      FT_Pos  dist;\r\n\r\n\r\n      w = widths[n].cur;\r\n      dist = width - w;\r\n      if ( dist < 0 )\r\n        dist = -dist;\r\n      if ( dist < best )\r\n      {\r\n        best      = dist;\r\n        reference = w;\r\n      }\r\n    }\r\n\r\n    scaled = FT_PIX_ROUND( reference );\r\n\r\n    if ( width >= reference )\r\n    {\r\n      if ( width < scaled + 48 )\r\n        width = reference;\r\n    }\r\n    else\r\n    {\r\n      if ( width > scaled - 48 )\r\n        width = reference;\r\n    }\r\n\r\n    return width;\r\n  }\r\n\r\n\r\n  /* compute the snapped width of a given stem */\r\n\r\n  static FT_Pos\r\n  af_cjk_compute_stem_width( AF_GlyphHints  hints,\r\n                             AF_Dimension   dim,\r\n                             FT_Pos         width,\r\n                             AF_Edge_Flags  base_flags,\r\n                             AF_Edge_Flags  stem_flags )\r\n  {\r\n    AF_CJKMetrics  metrics  = (AF_CJKMetrics) hints->metrics;\r\n    AF_CJKAxis     axis     = & metrics->axis[dim];\r\n    FT_Pos         dist     = width;\r\n    FT_Int         sign     = 0;\r\n    FT_Bool        vertical = FT_BOOL( dim == AF_DIMENSION_VERT );\r\n\r\n    FT_UNUSED( base_flags );\r\n    FT_UNUSED( stem_flags );\r\n\r\n\r\n    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) )\r\n      return width;\r\n\r\n    if ( dist < 0 )\r\n    {\r\n      dist = -width;\r\n      sign = 1;\r\n    }\r\n\r\n    if ( (  vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||\r\n         ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )\r\n    {\r\n      /* smooth hinting process: very lightly quantize the stem width */\r\n\r\n      if ( axis->width_count > 0 )\r\n      {\r\n        if ( FT_ABS( dist - axis->widths[0].cur ) < 40 )\r\n        {\r\n          dist = axis->widths[0].cur;\r\n          if ( dist < 48 )\r\n            dist = 48;\r\n\r\n          goto Done_Width;\r\n        }\r\n      }\r\n\r\n      if ( dist < 54 )\r\n        dist += ( 54 - dist ) / 2 ;\r\n      else if ( dist < 3 * 64 )\r\n      {\r\n        FT_Pos  delta;\r\n\r\n\r\n        delta  = dist & 63;\r\n        dist  &= -64;\r\n\r\n        if ( delta < 10 )\r\n          dist += delta;\r\n        else if ( delta < 22 )\r\n          dist += 10;\r\n        else if ( delta < 42 )\r\n          dist += delta;\r\n        else if ( delta < 54 )\r\n          dist += 54;\r\n        else\r\n          dist += delta;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* strong hinting process: snap the stem width to integer pixels */\r\n\r\n      dist = af_cjk_snap_width( axis->widths, axis->width_count, dist );\r\n\r\n      if ( vertical )\r\n      {\r\n        /* in the case of vertical hinting, always round */\r\n        /* the stem heights to integer pixels            */\r\n\r\n        if ( dist >= 64 )\r\n          dist = ( dist + 16 ) & ~63;\r\n        else\r\n          dist = 64;\r\n      }\r\n      else\r\n      {\r\n        if ( AF_LATIN_HINTS_DO_MONO( hints ) )\r\n        {\r\n          /* monochrome horizontal hinting: snap widths to integer pixels */\r\n          /* with a different threshold                                   */\r\n\r\n          if ( dist < 64 )\r\n            dist = 64;\r\n          else\r\n            dist = ( dist + 32 ) & ~63;\r\n        }\r\n        else\r\n        {\r\n          /* for horizontal anti-aliased hinting, we adopt a more subtle */\r\n          /* approach: we strengthen small stems, round stems whose size */\r\n          /* is between 1 and 2 pixels to an integer, otherwise nothing  */\r\n\r\n          if ( dist < 48 )\r\n            dist = ( dist + 64 ) >> 1;\r\n\r\n          else if ( dist < 128 )\r\n            dist = ( dist + 22 ) & ~63;\r\n          else\r\n            /* round otherwise to prevent color fringes in LCD mode */\r\n            dist = ( dist + 32 ) & ~63;\r\n        }\r\n      }\r\n    }\r\n\r\n  Done_Width:\r\n    if ( sign )\r\n      dist = -dist;\r\n\r\n    return dist;\r\n  }\r\n\r\n\r\n  /* align one stem edge relative to the previous stem edge */\r\n\r\n  static void\r\n  af_cjk_align_linked_edge( AF_GlyphHints  hints,\r\n                            AF_Dimension   dim,\r\n                            AF_Edge        base_edge,\r\n                            AF_Edge        stem_edge )\r\n  {\r\n    FT_Pos  dist = stem_edge->opos - base_edge->opos;\r\n\r\n    FT_Pos  fitted_width = af_cjk_compute_stem_width(\r\n                             hints, dim, dist,\r\n                             (AF_Edge_Flags)base_edge->flags,\r\n                             (AF_Edge_Flags)stem_edge->flags );\r\n\r\n\r\n    stem_edge->pos = base_edge->pos + fitted_width;\r\n  }\r\n\r\n\r\n  static void\r\n  af_cjk_align_serif_edge( AF_GlyphHints  hints,\r\n                           AF_Edge        base,\r\n                           AF_Edge        serif )\r\n  {\r\n    FT_UNUSED( hints );\r\n\r\n    serif->pos = base->pos + ( serif->opos - base->opos );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                    E D G E   H I N T I N G                      ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#define AF_LIGHT_MODE_MAX_HORZ_GAP    9\r\n#define AF_LIGHT_MODE_MAX_VERT_GAP   15\r\n#define AF_LIGHT_MODE_MAX_DELTA_ABS  14\r\n\r\n\r\n  static FT_Pos\r\n  af_hint_normal_stem( AF_GlyphHints  hints,\r\n                       AF_Edge        edge,\r\n                       AF_Edge        edge2,\r\n                       FT_Pos         anchor,\r\n                       AF_Dimension   dim )\r\n  {\r\n    FT_Pos  org_len, cur_len, org_center;\r\n    FT_Pos  cur_pos1, cur_pos2;\r\n    FT_Pos  d_off1, u_off1, d_off2, u_off2, delta;\r\n    FT_Pos  offset;\r\n    FT_Pos  threshold = 64;\r\n\r\n\r\n    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) )\r\n    {\r\n      if ( ( edge->flags  & AF_EDGE_ROUND ) &&\r\n           ( edge2->flags & AF_EDGE_ROUND ) )\r\n      {\r\n        if ( dim == AF_DIMENSION_VERT )\r\n          threshold = 64 - AF_LIGHT_MODE_MAX_HORZ_GAP;\r\n        else\r\n          threshold = 64 - AF_LIGHT_MODE_MAX_VERT_GAP;\r\n      }\r\n      else\r\n      {\r\n        if ( dim == AF_DIMENSION_VERT )\r\n          threshold = 64 - AF_LIGHT_MODE_MAX_HORZ_GAP / 3;\r\n        else\r\n          threshold = 64 - AF_LIGHT_MODE_MAX_VERT_GAP / 3;\r\n      }\r\n    }\r\n\r\n    org_len    = edge2->opos - edge->opos;\r\n    cur_len    = af_cjk_compute_stem_width( hints, dim, org_len,\r\n                                            (AF_Edge_Flags)edge->flags,\r\n                                            (AF_Edge_Flags)edge2->flags );\r\n\r\n    org_center = ( edge->opos + edge2->opos ) / 2 + anchor;\r\n    cur_pos1   = org_center - cur_len / 2;\r\n    cur_pos2   = cur_pos1 + cur_len;\r\n    d_off1     = cur_pos1 - FT_PIX_FLOOR( cur_pos1 );\r\n    d_off2     = cur_pos2 - FT_PIX_FLOOR( cur_pos2 );\r\n    u_off1     = 64 - d_off1;\r\n    u_off2     = 64 - d_off2;\r\n    delta      = 0;\r\n\r\n\r\n    if ( d_off1 == 0 || d_off2 == 0 )\r\n      goto Exit;\r\n\r\n    if ( cur_len <= threshold )\r\n    {\r\n      if ( d_off2 < cur_len )\r\n      {\r\n        if ( u_off1 <= d_off2 )\r\n          delta =  u_off1;\r\n        else\r\n          delta = -d_off2;\r\n      }\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    if ( threshold < 64 )\r\n    {\r\n      if ( d_off1 >= threshold || u_off1 >= threshold ||\r\n           d_off2 >= threshold || u_off2 >= threshold )\r\n        goto Exit;\r\n    }\r\n\r\n    offset = cur_len & 63;\r\n\r\n    if ( offset < 32 )\r\n    {\r\n      if ( u_off1 <= offset || d_off2 <= offset )\r\n        goto Exit;\r\n    }\r\n    else\r\n      offset = 64 - threshold;\r\n\r\n    d_off1 = threshold - u_off1;\r\n    u_off1 = u_off1    - offset;\r\n    u_off2 = threshold - d_off2;\r\n    d_off2 = d_off2    - offset;\r\n\r\n    if ( d_off1 <= u_off1 )\r\n      u_off1 = -d_off1;\r\n\r\n    if ( d_off2 <= u_off2 )\r\n      u_off2 = -d_off2;\r\n\r\n    if ( FT_ABS( u_off1 ) <= FT_ABS( u_off2 ) )\r\n      delta = u_off1;\r\n    else\r\n      delta = u_off2;\r\n\r\n  Exit:\r\n\r\n#if 1\r\n    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) )\r\n    {\r\n      if ( delta > AF_LIGHT_MODE_MAX_DELTA_ABS )\r\n        delta = AF_LIGHT_MODE_MAX_DELTA_ABS;\r\n      else if ( delta < -AF_LIGHT_MODE_MAX_DELTA_ABS )\r\n        delta = -AF_LIGHT_MODE_MAX_DELTA_ABS;\r\n    }\r\n#endif\r\n\r\n    cur_pos1 += delta;\r\n\r\n    if ( edge->opos < edge2->opos )\r\n    {\r\n      edge->pos  = cur_pos1;\r\n      edge2->pos = cur_pos1 + cur_len;\r\n    }\r\n    else\r\n    {\r\n      edge->pos  = cur_pos1 + cur_len;\r\n      edge2->pos = cur_pos1;\r\n    }\r\n\r\n    return delta;\r\n  }\r\n\r\n\r\n  static void\r\n  af_cjk_hint_edges( AF_GlyphHints  hints,\r\n                     AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis       = &hints->axis[dim];\r\n    AF_Edge       edges      = axis->edges;\r\n    AF_Edge       edge_limit = edges + axis->num_edges;\r\n    FT_PtrDist    n_edges;\r\n    AF_Edge       edge;\r\n    AF_Edge       anchor   = 0;\r\n    FT_Pos        delta    = 0;\r\n    FT_Int        skipped  = 0;\r\n    FT_Bool       has_last_stem = FALSE;\r\n    FT_Pos        last_stem_pos = 0;\r\n\r\n\r\n    /* we begin by aligning all stems relative to the blue zone */\r\n    FT_TRACE5(( \"==== cjk hinting %s edges =====\\n\",\r\n          dim == AF_DIMENSION_HORZ ? \"vertical\" : \"horizontal\" ));\r\n\r\n    if ( AF_HINTS_DO_BLUES( hints ) )\r\n    {\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        AF_Width  blue;\r\n        AF_Edge   edge1, edge2;\r\n\r\n\r\n        if ( edge->flags & AF_EDGE_DONE )\r\n          continue;\r\n\r\n        blue  = edge->blue_edge;\r\n        edge1 = NULL;\r\n        edge2 = edge->link;\r\n\r\n        if ( blue )\r\n        {\r\n          edge1 = edge;\r\n        }\r\n        else if ( edge2 && edge2->blue_edge )\r\n        {\r\n          blue  = edge2->blue_edge;\r\n          edge1 = edge2;\r\n          edge2 = edge;\r\n        }\r\n\r\n        if ( !edge1 )\r\n          continue;\r\n\r\n        FT_TRACE5(( \"CJKBLUE: edge %d @%d (opos=%.2f) snapped to (%.2f), \"\r\n                 \"was (%.2f)\\n\",\r\n                 edge1-edges, edge1->fpos, edge1->opos / 64.0, blue->fit / 64.0,\r\n                 edge1->pos / 64.0 ));\r\n\r\n        edge1->pos    = blue->fit;\r\n        edge1->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge2 && !edge2->blue_edge )\r\n        {\r\n          af_cjk_align_linked_edge( hints, dim, edge1, edge2 );\r\n          edge2->flags |= AF_EDGE_DONE;\r\n        }\r\n\r\n        if ( !anchor )\r\n          anchor = edge;\r\n      }\r\n    }\r\n\r\n    /* now we align all stem edges. */\r\n    for ( edge = edges; edge < edge_limit; edge++ )\r\n    {\r\n      AF_Edge  edge2;\r\n\r\n\r\n      if ( edge->flags & AF_EDGE_DONE )\r\n        continue;\r\n\r\n      /* skip all non-stem edges */\r\n      edge2 = edge->link;\r\n      if ( !edge2 )\r\n      {\r\n        skipped++;\r\n        continue;\r\n      }\r\n\r\n      /* Some CJK characters have so many stems that\r\n       * the hinter is likely to merge two adjacent ones.\r\n       * To solve this problem, if either edge of a stem\r\n       * is too close to the previous one, we avoid\r\n       * aligning the two edges, but rather interpolate\r\n       * their locations at the end of this function in\r\n       * order to preserve the space between the stems.\r\n       */\r\n      if ( has_last_stem                       &&\r\n           ( edge->pos  < last_stem_pos + 64 ||\r\n             edge2->pos < last_stem_pos + 64 ) )\r\n      {\r\n        skipped++;\r\n        continue;\r\n      }\r\n\r\n      /* now align the stem */\r\n      /* this should not happen, but it's better to be safe */\r\n      if ( edge2->blue_edge )\r\n      {\r\n        FT_TRACE5(( \"ASSERTION FAILED for edge %d\\n\", edge2-edges ));\r\n\r\n        af_cjk_align_linked_edge( hints, dim, edge2, edge );\r\n        edge->flags |= AF_EDGE_DONE;\r\n        continue;\r\n      }\r\n\r\n      if ( edge2 < edge )\r\n      {\r\n        af_cjk_align_linked_edge( hints, dim, edge2, edge );\r\n        edge->flags |= AF_EDGE_DONE;\r\n        /* We rarely reaches here it seems;\r\n         * usually the two edges belonging\r\n         * to one stem are marked as DONE together\r\n         */\r\n        has_last_stem = TRUE;\r\n        last_stem_pos = edge->pos;\r\n        continue;\r\n      }\r\n\r\n      if ( dim != AF_DIMENSION_VERT && !anchor )\r\n      {\r\n\r\n#if 0\r\n        if ( fixedpitch )\r\n        {\r\n          AF_Edge     left  = edge;\r\n          AF_Edge     right = edge_limit - 1;\r\n          AF_EdgeRec  left1, left2, right1, right2;\r\n          FT_Pos      target, center1, center2;\r\n          FT_Pos      delta1, delta2, d1, d2;\r\n\r\n\r\n          while ( right > left && !right->link )\r\n            right--;\r\n\r\n          left1  = *left;\r\n          left2  = *left->link;\r\n          right1 = *right->link;\r\n          right2 = *right;\r\n\r\n          delta  = ( ( ( hinter->pp2.x + 32 ) & -64 ) - hinter->pp2.x ) / 2;\r\n          target = left->opos + ( right->opos - left->opos ) / 2 + delta - 16;\r\n\r\n          delta1  = delta;\r\n          delta1 += af_hint_normal_stem( hints, left, left->link,\r\n                                         delta1, 0 );\r\n\r\n          if ( left->link != right )\r\n            af_hint_normal_stem( hints, right->link, right, delta1, 0 );\r\n\r\n          center1 = left->pos + ( right->pos - left->pos ) / 2;\r\n\r\n          if ( center1 >= target )\r\n            delta2 = delta - 32;\r\n          else\r\n            delta2 = delta + 32;\r\n\r\n          delta2 += af_hint_normal_stem( hints, &left1, &left2, delta2, 0 );\r\n\r\n          if ( delta1 != delta2 )\r\n          {\r\n            if ( left->link != right )\r\n              af_hint_normal_stem( hints, &right1, &right2, delta2, 0 );\r\n\r\n            center2 = left1.pos + ( right2.pos - left1.pos ) / 2;\r\n\r\n            d1 = center1 - target;\r\n            d2 = center2 - target;\r\n\r\n            if ( FT_ABS( d2 ) < FT_ABS( d1 ) )\r\n            {\r\n              left->pos       = left1.pos;\r\n              left->link->pos = left2.pos;\r\n\r\n              if ( left->link != right )\r\n              {\r\n                right->link->pos = right1.pos;\r\n                right->pos       = right2.pos;\r\n              }\r\n\r\n              delta1 = delta2;\r\n            }\r\n          }\r\n\r\n          delta               = delta1;\r\n          right->link->flags |= AF_EDGE_DONE;\r\n          right->flags       |= AF_EDGE_DONE;\r\n        }\r\n        else\r\n\r\n#endif /* 0 */\r\n\r\n          delta = af_hint_normal_stem( hints, edge, edge2, 0,\r\n                                       AF_DIMENSION_HORZ );\r\n      }\r\n      else\r\n        af_hint_normal_stem( hints, edge, edge2, delta, dim );\r\n\r\n#if 0\r\n      printf( \"stem (%d,%d) adjusted (%.1f,%.1f)\\n\",\r\n               edge - edges, edge2 - edges,\r\n               ( edge->pos - edge->opos ) / 64.0,\r\n               ( edge2->pos - edge2->opos ) / 64.0 );\r\n#endif\r\n\r\n      anchor = edge;\r\n      edge->flags  |= AF_EDGE_DONE;\r\n      edge2->flags |= AF_EDGE_DONE;\r\n      has_last_stem = TRUE;\r\n      last_stem_pos = edge2->pos;\r\n    }\r\n\r\n    /* make sure that lowercase m's maintain their symmetry */\r\n\r\n    /* In general, lowercase m's have six vertical edges if they are sans */\r\n    /* serif, or twelve if they are with serifs.  This implementation is  */\r\n    /* based on that assumption, and seems to work very well with most    */\r\n    /* faces.  However, if for a certain face this assumption is not      */\r\n    /* true, the m is just rendered like before.  In addition, any stem   */\r\n    /* correction will only be applied to symmetrical glyphs (even if the */\r\n    /* glyph is not an m), so the potential for unwanted distortion is    */\r\n    /* relatively low.                                                    */\r\n\r\n    /* We don't handle horizontal edges since we can't easily assure that */\r\n    /* the third (lowest) stem aligns with the base line; it might end up */\r\n    /* one pixel higher or lower.                                         */\r\n\r\n    n_edges = edge_limit - edges;\r\n    if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) )\r\n    {\r\n      AF_Edge  edge1, edge2, edge3;\r\n      FT_Pos   dist1, dist2, span;\r\n\r\n\r\n      if ( n_edges == 6 )\r\n      {\r\n        edge1 = edges;\r\n        edge2 = edges + 2;\r\n        edge3 = edges + 4;\r\n      }\r\n      else\r\n      {\r\n        edge1 = edges + 1;\r\n        edge2 = edges + 5;\r\n        edge3 = edges + 9;\r\n      }\r\n\r\n      dist1 = edge2->opos - edge1->opos;\r\n      dist2 = edge3->opos - edge2->opos;\r\n\r\n      span = dist1 - dist2;\r\n      if ( span < 0 )\r\n        span = -span;\r\n\r\n      if ( edge1->link == edge1 + 1 &&\r\n           edge2->link == edge2 + 1 &&\r\n           edge3->link == edge3 + 1 && span < 8 )\r\n      {\r\n        delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );\r\n        edge3->pos -= delta;\r\n        if ( edge3->link )\r\n          edge3->link->pos -= delta;\r\n\r\n        /* move the serifs along with the stem */\r\n        if ( n_edges == 12 )\r\n        {\r\n          ( edges + 8 )->pos -= delta;\r\n          ( edges + 11 )->pos -= delta;\r\n        }\r\n\r\n        edge3->flags |= AF_EDGE_DONE;\r\n        if ( edge3->link )\r\n          edge3->link->flags |= AF_EDGE_DONE;\r\n      }\r\n    }\r\n\r\n    if ( !skipped )\r\n      return;\r\n\r\n    /*\r\n     *  now hint the remaining edges (serifs and single) in order\r\n     *  to complete our processing\r\n     */\r\n    for ( edge = edges; edge < edge_limit; edge++ )\r\n    {\r\n      if ( edge->flags & AF_EDGE_DONE )\r\n        continue;\r\n\r\n      if ( edge->serif )\r\n      {\r\n        af_cjk_align_serif_edge( hints, edge->serif, edge );\r\n        edge->flags |= AF_EDGE_DONE;\r\n        skipped--;\r\n      }\r\n    }\r\n\r\n    if ( !skipped )\r\n      return;\r\n\r\n    for ( edge = edges; edge < edge_limit; edge++ )\r\n    {\r\n      AF_Edge  before, after;\r\n\r\n\r\n      if ( edge->flags & AF_EDGE_DONE )\r\n        continue;\r\n\r\n      before = after = edge;\r\n\r\n      while ( --before >= edges )\r\n        if ( before->flags & AF_EDGE_DONE )\r\n          break;\r\n\r\n      while ( ++after < edge_limit )\r\n        if ( after->flags & AF_EDGE_DONE )\r\n          break;\r\n\r\n      if ( before >= edges || after < edge_limit )\r\n      {\r\n        if ( before < edges )\r\n          af_cjk_align_serif_edge( hints, after, edge );\r\n        else if ( after >= edge_limit )\r\n          af_cjk_align_serif_edge( hints, before, edge );\r\n        else\r\n        {\r\n          if ( after->fpos == before->fpos )\r\n            edge->pos = before->pos;\r\n          else\r\n            edge->pos = before->pos +\r\n                        FT_MulDiv( edge->fpos - before->fpos,\r\n                                   after->pos - before->pos,\r\n                                   after->fpos - before->fpos );\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  af_cjk_align_edge_points( AF_GlyphHints  hints,\r\n                            AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis       = & hints->axis[dim];\r\n    AF_Edge       edges      = axis->edges;\r\n    AF_Edge       edge_limit = edges + axis->num_edges;\r\n    AF_Edge       edge;\r\n    FT_Bool       snapping;\r\n\r\n\r\n    snapping = FT_BOOL( ( dim == AF_DIMENSION_HORZ             &&\r\n                          AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) )  ||\r\n                        ( dim == AF_DIMENSION_VERT             &&\r\n                          AF_LATIN_HINTS_DO_VERT_SNAP( hints ) )  );\r\n\r\n    for ( edge = edges; edge < edge_limit; edge++ )\r\n    {\r\n      /* move the points of each segment     */\r\n      /* in each edge to the edge's position */\r\n      AF_Segment  seg = edge->first;\r\n\r\n\r\n      if ( snapping )\r\n      {\r\n        do\r\n        {\r\n          AF_Point  point = seg->first;\r\n\r\n\r\n          for (;;)\r\n          {\r\n            if ( dim == AF_DIMENSION_HORZ )\r\n            {\r\n              point->x      = edge->pos;\r\n              point->flags |= AF_FLAG_TOUCH_X;\r\n            }\r\n            else\r\n            {\r\n              point->y      = edge->pos;\r\n              point->flags |= AF_FLAG_TOUCH_Y;\r\n            }\r\n\r\n            if ( point == seg->last )\r\n              break;\r\n\r\n            point = point->next;\r\n          }\r\n\r\n          seg = seg->edge_next;\r\n\r\n        } while ( seg != edge->first );\r\n      }\r\n      else\r\n      {\r\n        FT_Pos  delta = edge->pos - edge->opos;\r\n\r\n\r\n        do\r\n        {\r\n          AF_Point  point = seg->first;\r\n\r\n\r\n          for (;;)\r\n          {\r\n            if ( dim == AF_DIMENSION_HORZ )\r\n            {\r\n              point->x     += delta;\r\n              point->flags |= AF_FLAG_TOUCH_X;\r\n            }\r\n            else\r\n            {\r\n              point->y     += delta;\r\n              point->flags |= AF_FLAG_TOUCH_Y;\r\n            }\r\n\r\n            if ( point == seg->last )\r\n              break;\r\n\r\n            point = point->next;\r\n          }\r\n\r\n          seg = seg->edge_next;\r\n\r\n        } while ( seg != edge->first );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_cjk_hints_apply( AF_GlyphHints  hints,\r\n                      FT_Outline*    outline,\r\n                      AF_CJKMetrics  metrics )\r\n  {\r\n    FT_Error  error;\r\n    int       dim;\r\n\r\n    FT_UNUSED( metrics );\r\n\r\n\r\n    error = af_glyph_hints_reload( hints, outline );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* analyze glyph outline */\r\n    if ( AF_HINTS_DO_HORIZONTAL( hints ) )\r\n    {\r\n      error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      af_cjk_hints_compute_blue_edges( hints, metrics, AF_DIMENSION_HORZ );\r\n    }\r\n\r\n    if ( AF_HINTS_DO_VERTICAL( hints ) )\r\n    {\r\n      error = af_cjk_hints_detect_features( hints, AF_DIMENSION_VERT );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      af_cjk_hints_compute_blue_edges( hints, metrics, AF_DIMENSION_VERT );\r\n    }\r\n\r\n    /* grid-fit the outline */\r\n    for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n    {\r\n      if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||\r\n           ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) )   )\r\n      {\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n        if ( dim == AF_DIMENSION_HORZ                                  &&\r\n             metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL )\r\n        {\r\n          AF_WarperRec  warper;\r\n          FT_Fixed      scale;\r\n          FT_Pos        delta;\r\n\r\n\r\n          af_warper_compute( &warper, hints, (AF_Dimension)dim,\r\n                             &scale, &delta );\r\n          af_glyph_hints_scale_dim( hints, (AF_Dimension)dim,\r\n                                    scale, delta );\r\n          continue;\r\n        }\r\n#endif /* AF_CONFIG_OPTION_USE_WARPER */\r\n\r\n        af_cjk_hint_edges( hints, (AF_Dimension)dim );\r\n        af_cjk_align_edge_points( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim );\r\n      }\r\n    }\r\n\r\n#if 0\r\n    af_glyph_hints_dump_points( hints );\r\n    af_glyph_hints_dump_segments( hints );\r\n    af_glyph_hints_dump_edges( hints );\r\n#endif\r\n\r\n    af_glyph_hints_save( hints, outline );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                C J K   S C R I P T   C L A S S                *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* this corresponds to Unicode 6.0 */\r\n\r\n  static const AF_Script_UniRangeRec  af_cjk_uniranges[] =\r\n  {\r\n    AF_UNIRANGE_REC(  0x1100UL,  0x11FFUL ),  /* Hangul Jamo                             */\r\n    AF_UNIRANGE_REC(  0x2E80UL,  0x2EFFUL ),  /* CJK Radicals Supplement                 */\r\n    AF_UNIRANGE_REC(  0x2F00UL,  0x2FDFUL ),  /* Kangxi Radicals                         */\r\n    AF_UNIRANGE_REC(  0x2FF0UL,  0x2FFFUL ),  /* Ideographic Description Characters      */\r\n    AF_UNIRANGE_REC(  0x3000UL,  0x303FUL ),  /* CJK Symbols and Punctuation             */\r\n    AF_UNIRANGE_REC(  0x3040UL,  0x309FUL ),  /* Hiragana                                */\r\n    AF_UNIRANGE_REC(  0x30A0UL,  0x30FFUL ),  /* Katakana                                */\r\n    AF_UNIRANGE_REC(  0x3100UL,  0x312FUL ),  /* Bopomofo                                */\r\n    AF_UNIRANGE_REC(  0x3130UL,  0x318FUL ),  /* Hangul Compatibility Jamo               */\r\n    AF_UNIRANGE_REC(  0x3190UL,  0x319FUL ),  /* Kanbun                                  */\r\n    AF_UNIRANGE_REC(  0x31A0UL,  0x31BFUL ),  /* Bopomofo Extended                       */\r\n    AF_UNIRANGE_REC(  0x31C0UL,  0x31EFUL ),  /* CJK Strokes                             */\r\n    AF_UNIRANGE_REC(  0x31F0UL,  0x31FFUL ),  /* Katakana Phonetic Extensions            */\r\n    AF_UNIRANGE_REC(  0x3200UL,  0x32FFUL ),  /* Enclosed CJK Letters and Months         */\r\n    AF_UNIRANGE_REC(  0x3300UL,  0x33FFUL ),  /* CJK Compatibility                       */\r\n    AF_UNIRANGE_REC(  0x3400UL,  0x4DBFUL ),  /* CJK Unified Ideographs Extension A      */\r\n    AF_UNIRANGE_REC(  0x4DC0UL,  0x4DFFUL ),  /* Yijing Hexagram Symbols                 */\r\n    AF_UNIRANGE_REC(  0x4E00UL,  0x9FFFUL ),  /* CJK Unified Ideographs                  */\r\n    AF_UNIRANGE_REC(  0xA960UL,  0xA97FUL ),  /* Hangul Jamo Extended-A                  */\r\n    AF_UNIRANGE_REC(  0xAC00UL,  0xD7AFUL ),  /* Hangul Syllables                        */\r\n    AF_UNIRANGE_REC(  0xD7B0UL,  0xD7FFUL ),  /* Hangul Jamo Extended-B                  */\r\n    AF_UNIRANGE_REC(  0xF900UL,  0xFAFFUL ),  /* CJK Compatibility Ideographs            */\r\n    AF_UNIRANGE_REC(  0xFE10UL,  0xFE1FUL ),  /* Vertical forms                          */\r\n    AF_UNIRANGE_REC(  0xFE30UL,  0xFE4FUL ),  /* CJK Compatibility Forms                 */\r\n    AF_UNIRANGE_REC(  0xFF00UL,  0xFFEFUL ),  /* Halfwidth and Fullwidth Forms           */\r\n    AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ),  /* Kana Supplement                         */\r\n    AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ),  /* Tai Xuan Hing Symbols                   */\r\n    AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ),  /* Enclosed Ideographic Supplement         */\r\n    AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ),  /* CJK Unified Ideographs Extension B      */\r\n    AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ),  /* CJK Unified Ideographs Extension C      */\r\n    AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ),  /* CJK Unified Ideographs Extension D      */\r\n    AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ),  /* CJK Compatibility Ideographs Supplement */\r\n    AF_UNIRANGE_REC(       0UL,       0UL )\r\n  };\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class,\r\n    AF_SCRIPT_CJK,\r\n    af_cjk_uniranges,\r\n    0x7530, /* 田 */\r\n\r\n    sizeof ( AF_CJKMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) af_cjk_metrics_init,\r\n    (AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   af_cjk_hints_init,\r\n    (AF_Script_ApplyHintsFunc)  af_cjk_hints_apply\r\n  )\r\n\r\n#else /* !AF_CONFIG_OPTION_CJK */\r\n\r\n  static const AF_Script_UniRangeRec  af_cjk_uniranges[] =\r\n  {\r\n    AF_UNIRANGE_REC( 0UL, 0UL )\r\n  };\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class,\r\n    AF_SCRIPT_CJK,\r\n    af_cjk_uniranges,\r\n    0,\r\n\r\n    sizeof ( AF_CJKMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) NULL,\r\n    (AF_Script_ScaleMetricsFunc)NULL,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   NULL,\r\n    (AF_Script_ApplyHintsFunc)  NULL\r\n  )\r\n\r\n#endif /* !AF_CONFIG_OPTION_CJK */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afcjk.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afcjk.h                                                                */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for CJK script (specification).         */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2007, 2011, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFCJK_H__\r\n#define __AFCJK_H__\r\n\r\n#include \"afhints.h\"\r\n#include \"aflatin.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* the CJK-specific script class */\r\n\r\n  AF_DECLARE_SCRIPT_CLASS( af_cjk_script_class )\r\n\r\n  /* CJK (global) metrics management */\r\n\r\n  /*\r\n   *  CJK glyphs tend to fill the square.  So we have both vertical and\r\n   *  horizontal blue zones.  But some glyphs have flat bounding strokes that\r\n   *  leave some space between neighbour glyphs.\r\n   */\r\n  enum\r\n  {\r\n    AF_CJK_BLUE_TOP,\r\n    AF_CJK_BLUE_BOTTOM,\r\n    AF_CJK_BLUE_LEFT,\r\n    AF_CJK_BLUE_RIGHT,\r\n\r\n    AF_CJK_BLUE_MAX\r\n  };\r\n\r\n\r\n#define AF_CJK_MAX_WIDTHS  16\r\n#define AF_CJK_MAX_BLUES   AF_CJK_BLUE_MAX\r\n\r\n\r\n  enum\r\n  {\r\n    AF_CJK_BLUE_ACTIVE     = 1 << 0,\r\n    AF_CJK_BLUE_IS_TOP     = 1 << 1,\r\n    AF_CJK_BLUE_IS_RIGHT   = 1 << 2,\r\n    AF_CJK_BLUE_ADJUSTMENT = 1 << 3,  /* used for scale adjustment */\r\n                                      /* optimization              */\r\n    AF_CJK_BLUE_FLAG_MAX\r\n  };\r\n\r\n\r\n  typedef struct  AF_CJKBlueRec_\r\n  {\r\n    AF_WidthRec  ref;\r\n    AF_WidthRec  shoot; /* undershoot */\r\n    FT_UInt      flags;\r\n\r\n  } AF_CJKBlueRec, *AF_CJKBlue;\r\n\r\n\r\n  typedef struct  AF_CJKAxisRec_\r\n  {\r\n    FT_Fixed       scale;\r\n    FT_Pos         delta;\r\n\r\n    FT_UInt        width_count;\r\n    AF_WidthRec    widths[AF_CJK_MAX_WIDTHS];\r\n    FT_Pos         edge_distance_threshold;\r\n    FT_Pos         standard_width;\r\n    FT_Bool        extra_light;\r\n\r\n    /* used for horizontal metrics too for CJK */\r\n    FT_Bool        control_overshoot;\r\n    FT_UInt        blue_count;\r\n    AF_CJKBlueRec  blues[AF_CJK_BLUE_MAX];\r\n\r\n    FT_Fixed       org_scale;\r\n    FT_Pos         org_delta;\r\n\r\n  } AF_CJKAxisRec, *AF_CJKAxis;\r\n\r\n\r\n  typedef struct  AF_CJKMetricsRec_\r\n  {\r\n    AF_ScriptMetricsRec  root;\r\n    FT_UInt              units_per_em;\r\n    AF_CJKAxisRec        axis[AF_DIMENSION_MAX];\r\n\r\n  } AF_CJKMetricsRec, *AF_CJKMetrics;\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_CJK\r\n  FT_LOCAL( FT_Error )\r\n  af_cjk_metrics_init( AF_CJKMetrics  metrics,\r\n                       FT_Face        face );\r\n\r\n  FT_LOCAL( void )\r\n  af_cjk_metrics_scale( AF_CJKMetrics  metrics,\r\n                        AF_Scaler      scaler );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_cjk_hints_init( AF_GlyphHints  hints,\r\n                     AF_CJKMetrics  metrics );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_cjk_hints_apply( AF_GlyphHints  hints,\r\n                      FT_Outline*    outline,\r\n                      AF_CJKMetrics  metrics );\r\n\r\n  /* shared; called from afindic.c */\r\n  FT_LOCAL( void )\r\n  af_cjk_metrics_check_digits( AF_CJKMetrics  metrics,\r\n                               FT_Face        face );\r\n\r\n  FT_LOCAL( void )\r\n  af_cjk_metrics_init_widths( AF_CJKMetrics  metrics,\r\n                              FT_Face        face );\r\n#endif /* AF_CONFIG_OPTION_CJK */\r\n\r\n\r\n/* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFCJK_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afdummy.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afdummy.c                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter dummy routines to be used if no hinting should be        */\r\n/*    performed (body).                                                    */\r\n/*                                                                         */\r\n/*  Copyright 2003-2005, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"afdummy.h\"\r\n#include \"afhints.h\"\r\n#include \"aferrors.h\"\r\n\r\n\r\n  static FT_Error\r\n  af_dummy_hints_init( AF_GlyphHints     hints,\r\n                       AF_ScriptMetrics  metrics )\r\n  {\r\n    af_glyph_hints_rescale( hints,\r\n                            metrics );\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_dummy_hints_apply( AF_GlyphHints  hints,\r\n                        FT_Outline*    outline )\r\n  {\r\n    FT_UNUSED( hints );\r\n    FT_UNUSED( outline );\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_dummy_script_class,\r\n    AF_SCRIPT_DUMMY,\r\n    NULL,\r\n    0,\r\n\r\n    sizeof ( AF_ScriptMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) NULL,\r\n    (AF_Script_ScaleMetricsFunc)NULL,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   af_dummy_hints_init,\r\n    (AF_Script_ApplyHintsFunc)  af_dummy_hints_apply\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afdummy.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afdummy.h                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter dummy routines to be used if no hinting should be        */\r\n/*    performed (specification).                                           */\r\n/*                                                                         */\r\n/*  Copyright 2003-2005, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFDUMMY_H__\r\n#define __AFDUMMY_H__\r\n\r\n#include \"aftypes.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n /*  A dummy script metrics class used when no hinting should\r\n  *  be performed.  This is the default for non-latin glyphs!\r\n  */\r\n\r\n  AF_DECLARE_SCRIPT_CLASS( af_dummy_script_class )\r\n\r\n/* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __AFDUMMY_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/aferrors.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  aferrors.h                                                             */\r\n/*                                                                         */\r\n/*    Autofitter error codes (specification only).                         */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the Autofitter error enumeration          */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __AFERRORS_H__\r\n#define __AFERRORS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  AF_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Autofit\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __AFERRORS_H__ */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afglobal.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afglobal.c                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter routines to compute global hinting values (body).        */\r\n/*                                                                         */\r\n/*  Copyright 2003-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"afglobal.h\"\r\n#include \"afdummy.h\"\r\n#include \"aflatin.h\"\r\n#include \"afcjk.h\"\r\n#include \"afindic.h\"\r\n#include \"afpic.h\"\r\n\r\n#include \"aferrors.h\"\r\n\r\n#ifdef FT_OPTION_AUTOFIT2\r\n#include \"aflatin2.h\"\r\n#endif\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n  /* when updating this table, don't forget to update          */\r\n  /* AF_SCRIPT_CLASSES_COUNT and autofit_module_class_pic_init */\r\n\r\n  /* populate this list when you add new scripts */\r\n  static AF_ScriptClass const  af_script_classes[] =\r\n  {\r\n    &af_dummy_script_class,\r\n#ifdef FT_OPTION_AUTOFIT2\r\n    &af_latin2_script_class,\r\n#endif\r\n    &af_latin_script_class,\r\n    &af_cjk_script_class,\r\n    &af_indic_script_class,\r\n    NULL  /* do not remove */\r\n  };\r\n\r\n#endif /* !FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /* Compute the script index of each glyph within a given face. */\r\n\r\n  static FT_Error\r\n  af_face_globals_compute_script_coverage( AF_FaceGlobals  globals )\r\n  {\r\n    FT_Error    error       = AF_Err_Ok;\r\n    FT_Face     face        = globals->face;\r\n    FT_CharMap  old_charmap = face->charmap;\r\n    FT_Byte*    gscripts    = globals->glyph_scripts;\r\n    FT_UInt     ss;\r\n    FT_UInt     i;\r\n\r\n\r\n    /* the value AF_SCRIPT_NONE means `uncovered glyph' */\r\n    FT_MEM_SET( globals->glyph_scripts,\r\n                AF_SCRIPT_NONE,\r\n                globals->glyph_count );\r\n\r\n    error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );\r\n    if ( error )\r\n    {\r\n     /*\r\n      *  Ignore this error; we simply use the fallback script.\r\n      *  XXX: Shouldn't we rather disable hinting?\r\n      */\r\n      error = AF_Err_Ok;\r\n      goto Exit;\r\n    }\r\n\r\n    /* scan each script in a Unicode charmap */\r\n    for ( ss = 0; AF_SCRIPT_CLASSES_GET[ss]; ss++ )\r\n    {\r\n      AF_ScriptClass      clazz = AF_SCRIPT_CLASSES_GET[ss];\r\n      AF_Script_UniRange  range;\r\n\r\n\r\n      if ( clazz->script_uni_ranges == NULL )\r\n        continue;\r\n\r\n      /*\r\n       *  Scan all Unicode points in the range and set the corresponding\r\n       *  glyph script index.\r\n       */\r\n      for ( range = clazz->script_uni_ranges; range->first != 0; range++ )\r\n      {\r\n        FT_ULong  charcode = range->first;\r\n        FT_UInt   gindex;\r\n\r\n\r\n        gindex = FT_Get_Char_Index( face, charcode );\r\n\r\n        if ( gindex != 0                             &&\r\n             gindex < (FT_ULong)globals->glyph_count &&\r\n             gscripts[gindex] == AF_SCRIPT_NONE )\r\n          gscripts[gindex] = (FT_Byte)ss;\r\n\r\n        for (;;)\r\n        {\r\n          charcode = FT_Get_Next_Char( face, charcode, &gindex );\r\n\r\n          if ( gindex == 0 || charcode > range->last )\r\n            break;\r\n\r\n          if ( gindex < (FT_ULong)globals->glyph_count &&\r\n               gscripts[gindex] == AF_SCRIPT_NONE )\r\n            gscripts[gindex] = (FT_Byte)ss;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* mark ASCII digits */\r\n    for ( i = 0x30; i <= 0x39; i++ )\r\n    {\r\n      FT_UInt  gindex = FT_Get_Char_Index( face, i );\r\n\r\n\r\n      if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )\r\n        gscripts[gindex] |= AF_DIGIT;\r\n    }\r\n\r\n  Exit:\r\n    /*\r\n     *  By default, all uncovered glyphs are set to the fallback script.\r\n     *  XXX: Shouldn't we disable hinting or do something similar?\r\n     */\r\n    if ( globals->module->fallback_script != AF_SCRIPT_NONE )\r\n    {\r\n      FT_Long  nn;\r\n\r\n\r\n      for ( nn = 0; nn < globals->glyph_count; nn++ )\r\n      {\r\n        if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_NONE )\r\n        {\r\n          gscripts[nn] &= ~AF_SCRIPT_NONE;\r\n          gscripts[nn] |= globals->module->fallback_script;\r\n        }\r\n      }\r\n    }\r\n\r\n    FT_Set_Charmap( face, old_charmap );\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_face_globals_new( FT_Face          face,\r\n                       AF_FaceGlobals  *aglobals,\r\n                       AF_Module        module )\r\n  {\r\n    FT_Error        error;\r\n    FT_Memory       memory;\r\n    AF_FaceGlobals  globals = NULL;\r\n\r\n\r\n    memory = face->memory;\r\n\r\n    if ( FT_ALLOC( globals, sizeof ( *globals ) +\r\n                            face->num_glyphs * sizeof ( FT_Byte ) ) )\r\n      goto Exit;\r\n\r\n    globals->face          = face;\r\n    globals->glyph_count   = face->num_glyphs;\r\n    globals->glyph_scripts = (FT_Byte*)( globals + 1 );\r\n    globals->module        = module;\r\n\r\n    error = af_face_globals_compute_script_coverage( globals );\r\n    if ( error )\r\n    {\r\n      af_face_globals_free( globals );\r\n      globals = NULL;\r\n    }\r\n\r\n    globals->increase_x_height = AF_PROP_INCREASE_X_HEIGHT_MAX;\r\n\r\n  Exit:\r\n    *aglobals = globals;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_face_globals_free( AF_FaceGlobals  globals )\r\n  {\r\n    if ( globals )\r\n    {\r\n      FT_Memory  memory = globals->face->memory;\r\n      FT_UInt    nn;\r\n\r\n\r\n      for ( nn = 0; nn < AF_SCRIPT_MAX; nn++ )\r\n      {\r\n        if ( globals->metrics[nn] )\r\n        {\r\n          AF_ScriptClass  clazz = AF_SCRIPT_CLASSES_GET[nn];\r\n\r\n\r\n          FT_ASSERT( globals->metrics[nn]->clazz == clazz );\r\n\r\n          if ( clazz->script_metrics_done )\r\n            clazz->script_metrics_done( globals->metrics[nn] );\r\n\r\n          FT_FREE( globals->metrics[nn] );\r\n        }\r\n      }\r\n\r\n      globals->glyph_count   = 0;\r\n      globals->glyph_scripts = NULL;  /* no need to free this one! */\r\n      globals->face          = NULL;\r\n\r\n      FT_FREE( globals );\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_face_globals_get_metrics( AF_FaceGlobals     globals,\r\n                               FT_UInt            gindex,\r\n                               FT_UInt            options,\r\n                               AF_ScriptMetrics  *ametrics )\r\n  {\r\n    AF_ScriptMetrics  metrics = NULL;\r\n    FT_UInt           gidx;\r\n    AF_ScriptClass    clazz;\r\n    FT_UInt           script     = options & 15;\r\n    const FT_Offset   script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) /\r\n                                     sizeof ( AF_SCRIPT_CLASSES_GET[0] );\r\n    FT_Error          error      = AF_Err_Ok;\r\n\r\n\r\n    if ( gindex >= (FT_ULong)globals->glyph_count )\r\n    {\r\n      error = AF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    gidx = script;\r\n    if ( gidx == 0 || gidx + 1 >= script_max )\r\n      gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_NONE;\r\n\r\n    clazz = AF_SCRIPT_CLASSES_GET[gidx];\r\n    if ( script == 0 )\r\n      script = clazz->script;\r\n\r\n    metrics = globals->metrics[clazz->script];\r\n    if ( metrics == NULL )\r\n    {\r\n      /* create the global metrics object if necessary */\r\n      FT_Memory  memory = globals->face->memory;\r\n\r\n\r\n      if ( FT_ALLOC( metrics, clazz->script_metrics_size ) )\r\n        goto Exit;\r\n\r\n      metrics->clazz   = clazz;\r\n      metrics->globals = globals;\r\n\r\n      if ( clazz->script_metrics_init )\r\n      {\r\n        error = clazz->script_metrics_init( metrics, globals->face );\r\n        if ( error )\r\n        {\r\n          if ( clazz->script_metrics_done )\r\n            clazz->script_metrics_done( metrics );\r\n\r\n          FT_FREE( metrics );\r\n          goto Exit;\r\n        }\r\n      }\r\n\r\n      globals->metrics[clazz->script] = metrics;\r\n    }\r\n\r\n  Exit:\r\n    *ametrics = metrics;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  af_face_globals_is_digit( AF_FaceGlobals  globals,\r\n                            FT_UInt         gindex )\r\n  {\r\n    if ( gindex < (FT_ULong)globals->glyph_count )\r\n      return (FT_Bool)( globals->glyph_scripts[gindex] & AF_DIGIT );\r\n\r\n    return (FT_Bool)0;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afglobal.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afglobal.h                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter routines to compute global hinting values                */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2003-2005, 2007, 2009, 2011-2012 by                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFGLOBAL_H__\r\n#define __AFGLOBAL_H__\r\n\r\n\r\n#include \"aftypes.h\"\r\n#include \"afmodule.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  Default values and flags for both autofitter globals (found in\r\n   *  AF_ModuleRec) and face globals (in AF_FaceGlobalsRec).\r\n   */\r\n\r\n  /* index of fallback script in `af_script_classes' */\r\n#define AF_SCRIPT_FALLBACK  2\r\n  /* a bit mask indicating an uncovered glyph        */\r\n#define AF_SCRIPT_NONE      0x7F\r\n  /* if this flag is set, we have an ASCII digit     */\r\n#define AF_DIGIT            0x80\r\n\r\n  /* `increase-x-height' property */\r\n#define AF_PROP_INCREASE_X_HEIGHT_MIN  6\r\n#define AF_PROP_INCREASE_X_HEIGHT_MAX  0\r\n\r\n\r\n  /************************************************************************/\r\n  /************************************************************************/\r\n  /*****                                                              *****/\r\n  /*****                  F A C E   G L O B A L S                     *****/\r\n  /*****                                                              *****/\r\n  /************************************************************************/\r\n  /************************************************************************/\r\n\r\n\r\n  /*\r\n   *  Note that glyph_scripts[] is used to map each glyph into\r\n   *  an index into the `af_script_classes' array.\r\n   *\r\n   */\r\n  typedef struct  AF_FaceGlobalsRec_\r\n  {\r\n    FT_Face           face;\r\n    FT_Long           glyph_count;    /* same as face->num_glyphs */\r\n    FT_Byte*          glyph_scripts;\r\n\r\n    /* per-face auto-hinter properties */\r\n    FT_UInt           increase_x_height;\r\n\r\n    AF_ScriptMetrics  metrics[AF_SCRIPT_MAX];\r\n\r\n    AF_Module         module;         /* to access global properties */\r\n\r\n  } AF_FaceGlobalsRec;\r\n\r\n\r\n  /*\r\n   *  model the global hints data for a given face, decomposed into\r\n   *  script-specific items\r\n   */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_face_globals_new( FT_Face          face,\r\n                       AF_FaceGlobals  *aglobals,\r\n                       AF_Module        module );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_face_globals_get_metrics( AF_FaceGlobals     globals,\r\n                               FT_UInt            gindex,\r\n                               FT_UInt            options,\r\n                               AF_ScriptMetrics  *ametrics );\r\n\r\n  FT_LOCAL( void )\r\n  af_face_globals_free( AF_FaceGlobals  globals );\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  af_face_globals_is_digit( AF_FaceGlobals  globals,\r\n                            FT_UInt         gindex );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFGLOBAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afhints.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afhints.c                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 2003-2007, 2009-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"afhints.h\"\r\n#include \"aferrors.h\"\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_afhints\r\n\r\n\r\n  /* Get new segment for given axis. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_axis_hints_new_segment( AF_AxisHints  axis,\r\n                             FT_Memory     memory,\r\n                             AF_Segment   *asegment )\r\n  {\r\n    FT_Error    error   = AF_Err_Ok;\r\n    AF_Segment  segment = NULL;\r\n\r\n\r\n    if ( axis->num_segments >= axis->max_segments )\r\n    {\r\n      FT_Int  old_max = axis->max_segments;\r\n      FT_Int  new_max = old_max;\r\n      FT_Int  big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) );\r\n\r\n\r\n      if ( old_max >= big_max )\r\n      {\r\n        error = AF_Err_Out_Of_Memory;\r\n        goto Exit;\r\n      }\r\n\r\n      new_max += ( new_max >> 2 ) + 4;\r\n      if ( new_max < old_max || new_max > big_max )\r\n        new_max = big_max;\r\n\r\n      if ( FT_RENEW_ARRAY( axis->segments, old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      axis->max_segments = new_max;\r\n    }\r\n\r\n    segment = axis->segments + axis->num_segments++;\r\n\r\n  Exit:\r\n    *asegment = segment;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Get new edge for given axis, direction, and position. */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_axis_hints_new_edge( AF_AxisHints  axis,\r\n                          FT_Int        fpos,\r\n                          AF_Direction  dir,\r\n                          FT_Memory     memory,\r\n                          AF_Edge      *anedge )\r\n  {\r\n    FT_Error  error = AF_Err_Ok;\r\n    AF_Edge   edge  = NULL;\r\n    AF_Edge   edges;\r\n\r\n\r\n    if ( axis->num_edges >= axis->max_edges )\r\n    {\r\n      FT_Int  old_max = axis->max_edges;\r\n      FT_Int  new_max = old_max;\r\n      FT_Int  big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) );\r\n\r\n\r\n      if ( old_max >= big_max )\r\n      {\r\n        error = AF_Err_Out_Of_Memory;\r\n        goto Exit;\r\n      }\r\n\r\n      new_max += ( new_max >> 2 ) + 4;\r\n      if ( new_max < old_max || new_max > big_max )\r\n        new_max = big_max;\r\n\r\n      if ( FT_RENEW_ARRAY( axis->edges, old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      axis->max_edges = new_max;\r\n    }\r\n\r\n    edges = axis->edges;\r\n    edge  = edges + axis->num_edges;\r\n\r\n    while ( edge > edges )\r\n    {\r\n      if ( edge[-1].fpos < fpos )\r\n        break;\r\n\r\n      /* we want the edge with same position and minor direction */\r\n      /* to appear before those in the major one in the list     */\r\n      if ( edge[-1].fpos == fpos && dir == axis->major_dir )\r\n        break;\r\n\r\n      edge[0] = edge[-1];\r\n      edge--;\r\n    }\r\n\r\n    axis->num_edges++;\r\n\r\n    FT_ZERO( edge );\r\n    edge->fpos = (FT_Short)fpos;\r\n    edge->dir  = (FT_Char)dir;\r\n\r\n  Exit:\r\n    *anedge = edge;\r\n    return error;\r\n  }\r\n\r\n\r\n#ifdef FT_DEBUG_AUTOFIT\r\n\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n  static const char*\r\n  af_dir_str( AF_Direction  dir )\r\n  {\r\n    const char*  result;\r\n\r\n\r\n    switch ( dir )\r\n    {\r\n    case AF_DIR_UP:\r\n      result = \"up\";\r\n      break;\r\n    case AF_DIR_DOWN:\r\n      result = \"down\";\r\n      break;\r\n    case AF_DIR_LEFT:\r\n      result = \"left\";\r\n      break;\r\n    case AF_DIR_RIGHT:\r\n      result = \"right\";\r\n      break;\r\n    default:\r\n      result = \"none\";\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n#define AF_INDEX_NUM( ptr, base )  ( (ptr) ? ( (ptr) - (base) ) : -1 )\r\n\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n  void\r\n  af_glyph_hints_dump_points( AF_GlyphHints  hints )\r\n  {\r\n    AF_Point  points = hints->points;\r\n    AF_Point  limit  = points + hints->num_points;\r\n    AF_Point  point;\r\n\r\n\r\n    FT_TRACE7(( \"Table of points:\\n\"\r\n                \"  [ index |  xorg |  yorg | xscale | yscale\"\r\n                \" |  xfit |  yfit |  flags ]\\n\" ));\r\n\r\n    for ( point = points; point < limit; point++ )\r\n      FT_TRACE7(( \"  [ %5d | %5d | %5d | %6.2f | %6.2f\"\r\n                  \" | %5.2f | %5.2f | %c%c%c%c%c%c ]\\n\",\r\n                  point - points,\r\n                  point->fx,\r\n                  point->fy,\r\n                  point->ox / 64.0,\r\n                  point->oy / 64.0,\r\n                  point->x / 64.0,\r\n                  point->y / 64.0,\r\n                  ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ',\r\n                  ( point->flags & AF_FLAG_INFLECTION )         ? 'i' : ' ',\r\n                  ( point->flags & AF_FLAG_EXTREMA_X )          ? '<' : ' ',\r\n                  ( point->flags & AF_FLAG_EXTREMA_Y )          ? 'v' : ' ',\r\n                  ( point->flags & AF_FLAG_ROUND_X )            ? '(' : ' ',\r\n                  ( point->flags & AF_FLAG_ROUND_Y )            ? 'u' : ' '));\r\n    FT_TRACE7(( \"\\n\" ));\r\n  }\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n\r\n  static const char*\r\n  af_edge_flags_to_string( AF_Edge_Flags  flags )\r\n  {\r\n    static char  temp[32];\r\n    int          pos = 0;\r\n\r\n\r\n    if ( flags & AF_EDGE_ROUND )\r\n    {\r\n      ft_memcpy( temp + pos, \"round\", 5 );\r\n      pos += 5;\r\n    }\r\n    if ( flags & AF_EDGE_SERIF )\r\n    {\r\n      if ( pos > 0 )\r\n        temp[pos++] = ' ';\r\n      ft_memcpy( temp + pos, \"serif\", 5 );\r\n      pos += 5;\r\n    }\r\n    if ( pos == 0 )\r\n      return \"normal\";\r\n\r\n    temp[pos] = '\\0';\r\n\r\n    return temp;\r\n  }\r\n\r\n\r\n  /* Dump the array of linked segments. */\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n  void\r\n  af_glyph_hints_dump_segments( AF_GlyphHints  hints )\r\n  {\r\n    FT_Int  dimension;\r\n\r\n\r\n    for ( dimension = 1; dimension >= 0; dimension-- )\r\n    {\r\n      AF_AxisHints  axis     = &hints->axis[dimension];\r\n      AF_Point      points   = hints->points;\r\n      AF_Edge       edges    = axis->edges;\r\n      AF_Segment    segments = axis->segments;\r\n      AF_Segment    limit    = segments + axis->num_segments;\r\n      AF_Segment    seg;\r\n\r\n\r\n      FT_TRACE7(( \"Table of %s segments:\\n\",\r\n                  dimension == AF_DIMENSION_HORZ ? \"vertical\"\r\n                                                 : \"horizontal\" ));\r\n      if (axis->num_segments)\r\n        FT_TRACE7(( \"  [ index |  pos  |  dir  | from\"\r\n                    \" |  to  | link | serif | edge\"\r\n                    \" | height | extra |    flags    ]\\n\" ));\r\n      else\r\n        FT_TRACE7(( \"  (none)\\n\" ));\r\n\r\n      for ( seg = segments; seg < limit; seg++ )\r\n        FT_TRACE7(( \"  [ %5d | %5.2g | %5s | %4d\"\r\n                    \" | %4d | %4d | %5d | %4d\"\r\n                    \" | %6d | %5d | %11s ]\\n\",\r\n                    seg - segments,\r\n                    dimension == AF_DIMENSION_HORZ\r\n                                 ? (int)seg->first->ox / 64.0\r\n                                 : (int)seg->first->oy / 64.0,\r\n                    af_dir_str( (AF_Direction)seg->dir ),\r\n                    AF_INDEX_NUM( seg->first, points ),\r\n                    AF_INDEX_NUM( seg->last, points ),\r\n                    AF_INDEX_NUM( seg->link, segments ),\r\n                    AF_INDEX_NUM( seg->serif, segments ),\r\n                    AF_INDEX_NUM( seg->edge, edges ),\r\n                    seg->height,\r\n                    seg->height - ( seg->max_coord - seg->min_coord ),\r\n                    af_edge_flags_to_string( (AF_Edge_Flags)seg->flags ) ));\r\n      FT_TRACE7(( \"\\n\" ));\r\n    }\r\n  }\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n\r\n  /* Fetch number of segments. */\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n  FT_Error\r\n  af_glyph_hints_get_num_segments( AF_GlyphHints  hints,\r\n                                   FT_Int         dimension,\r\n                                   FT_Int*        num_segments )\r\n  {\r\n    AF_Dimension  dim;\r\n    AF_AxisHints  axis;\r\n\r\n\r\n    dim = ( dimension == 0 ) ? AF_DIMENSION_HORZ : AF_DIMENSION_VERT;\r\n\r\n    axis          = &hints->axis[dim];\r\n    *num_segments = axis->num_segments;\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n\r\n  /* Fetch offset of segments into user supplied offset array. */\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n  FT_Error\r\n  af_glyph_hints_get_segment_offset( AF_GlyphHints  hints,\r\n                                     FT_Int         dimension,\r\n                                     FT_Int         idx,\r\n                                     FT_Pos*        offset )\r\n  {\r\n    AF_Dimension  dim;\r\n    AF_AxisHints  axis;\r\n    AF_Segment    seg;\r\n\r\n\r\n    if ( !offset )\r\n      return AF_Err_Invalid_Argument;\r\n\r\n    dim = ( dimension == 0 ) ? AF_DIMENSION_HORZ : AF_DIMENSION_VERT;\r\n\r\n    axis = &hints->axis[dim];\r\n\r\n    if ( idx < 0 || idx >= axis->num_segments )\r\n      return AF_Err_Invalid_Argument;\r\n\r\n    seg     = &axis->segments[idx];\r\n    *offset = (dim == AF_DIMENSION_HORZ) ? seg->first->ox\r\n                                         : seg->first->oy;\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n\r\n  /* Dump the array of linked edges. */\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n  void\r\n  af_glyph_hints_dump_edges( AF_GlyphHints  hints )\r\n  {\r\n    FT_Int  dimension;\r\n\r\n\r\n    for ( dimension = 1; dimension >= 0; dimension-- )\r\n    {\r\n      AF_AxisHints  axis  = &hints->axis[dimension];\r\n      AF_Edge       edges = axis->edges;\r\n      AF_Edge       limit = edges + axis->num_edges;\r\n      AF_Edge       edge;\r\n\r\n\r\n      /*\r\n       *  note: AF_DIMENSION_HORZ corresponds to _vertical_ edges\r\n       *        since they have a constant X coordinate.\r\n       */\r\n      FT_TRACE7(( \"Table of %s edges:\\n\",\r\n                  dimension == AF_DIMENSION_HORZ ? \"vertical\"\r\n                                                 : \"horizontal\" ));\r\n      if ( axis->num_edges )\r\n        FT_TRACE7(( \"  [ index |  pos  |  dir  | link\"\r\n                    \" | serif | blue | opos  |  pos  |    flags    ]\\n\" ));\r\n      else\r\n        FT_TRACE7(( \"  (none)\\n\" ));\r\n\r\n      for ( edge = edges; edge < limit; edge++ )\r\n        FT_TRACE7(( \"  [ %5d | %5.2g | %5s | %4d\"\r\n                    \" | %5d |   %c  | %5.2f | %5.2f | %11s ]\\n\",\r\n                    edge - edges,\r\n                    (int)edge->opos / 64.0,\r\n                    af_dir_str( (AF_Direction)edge->dir ),\r\n                    AF_INDEX_NUM( edge->link, edges ),\r\n                    AF_INDEX_NUM( edge->serif, edges ),\r\n                    edge->blue_edge ? 'y' : 'n',\r\n                    edge->opos / 64.0,\r\n                    edge->pos / 64.0,\r\n                    af_edge_flags_to_string( (AF_Edge_Flags)edge->flags ) ));\r\n      FT_TRACE7(( \"\\n\" ));\r\n    }\r\n  }\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n#else /* !FT_DEBUG_AUTOFIT */\r\n\r\n  /* these empty stubs are only used to link the `ftgrid' test program */\r\n  /* if debugging is disabled                                          */\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n\r\n  void\r\n  af_glyph_hints_dump_points( AF_GlyphHints  hints )\r\n  {\r\n    FT_UNUSED( hints );\r\n  }\r\n\r\n\r\n  void\r\n  af_glyph_hints_dump_segments( AF_GlyphHints  hints )\r\n  {\r\n    FT_UNUSED( hints );\r\n  }\r\n\r\n\r\n  FT_Error\r\n  af_glyph_hints_get_num_segments( AF_GlyphHints  hints,\r\n                                   FT_Int         dimension,\r\n                                   FT_Int*        num_segments )\r\n  {\r\n    FT_UNUSED( hints );\r\n    FT_UNUSED( dimension );\r\n    FT_UNUSED( num_segments );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_Error\r\n  af_glyph_hints_get_segment_offset( AF_GlyphHints  hints,\r\n                                     FT_Int         dimension,\r\n                                     FT_Int         idx,\r\n                                     FT_Pos*        offset )\r\n  {\r\n    FT_UNUSED( hints );\r\n    FT_UNUSED( dimension );\r\n    FT_UNUSED( idx );\r\n    FT_UNUSED( offset );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  void\r\n  af_glyph_hints_dump_edges( AF_GlyphHints  hints )\r\n  {\r\n    FT_UNUSED( hints );\r\n  }\r\n\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n#endif /* !FT_DEBUG_AUTOFIT */\r\n\r\n\r\n  /* Compute the direction value of a given vector. */\r\n\r\n  FT_LOCAL_DEF( AF_Direction )\r\n  af_direction_compute( FT_Pos  dx,\r\n                        FT_Pos  dy )\r\n  {\r\n    FT_Pos        ll, ss;  /* long and short arm lengths */\r\n    AF_Direction  dir;     /* candidate direction        */\r\n\r\n\r\n    if ( dy >= dx )\r\n    {\r\n      if ( dy >= -dx )\r\n      {\r\n        dir = AF_DIR_UP;\r\n        ll  = dy;\r\n        ss  = dx;\r\n      }\r\n      else\r\n      {\r\n        dir = AF_DIR_LEFT;\r\n        ll  = -dx;\r\n        ss  = dy;\r\n      }\r\n    }\r\n    else /* dy < dx */\r\n    {\r\n      if ( dy >= -dx )\r\n      {\r\n        dir = AF_DIR_RIGHT;\r\n        ll  = dx;\r\n        ss  = dy;\r\n      }\r\n      else\r\n      {\r\n        dir = AF_DIR_DOWN;\r\n        ll  = dy;\r\n        ss  = dx;\r\n      }\r\n    }\r\n\r\n    /* return no direction if arm lengths differ too much            */\r\n    /* (value 14 is heuristic, corresponding to approx. 4.1 degrees) */\r\n    ss *= 14;\r\n    if ( FT_ABS( ll ) <= FT_ABS( ss ) )\r\n      dir = AF_DIR_NONE;\r\n\r\n    return dir;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_init( AF_GlyphHints  hints,\r\n                       FT_Memory      memory )\r\n  {\r\n    FT_ZERO( hints );\r\n    hints->memory = memory;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_done( AF_GlyphHints  hints )\r\n  {\r\n    FT_Memory  memory = hints->memory;\r\n    int        dim;\r\n\r\n\r\n    if ( !( hints && hints->memory ) )\r\n      return;\r\n\r\n    /*\r\n     *  note that we don't need to free the segment and edge\r\n     *  buffers since they are really within the hints->points array\r\n     */\r\n    for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n    {\r\n      AF_AxisHints  axis = &hints->axis[dim];\r\n\r\n\r\n      axis->num_segments = 0;\r\n      axis->max_segments = 0;\r\n      FT_FREE( axis->segments );\r\n\r\n      axis->num_edges = 0;\r\n      axis->max_edges = 0;\r\n      FT_FREE( axis->edges );\r\n    }\r\n\r\n    FT_FREE( hints->contours );\r\n    hints->max_contours = 0;\r\n    hints->num_contours = 0;\r\n\r\n    FT_FREE( hints->points );\r\n    hints->num_points = 0;\r\n    hints->max_points = 0;\r\n\r\n    hints->memory = NULL;\r\n  }\r\n\r\n\r\n  /* Reset metrics. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_rescale( AF_GlyphHints     hints,\r\n                          AF_ScriptMetrics  metrics )\r\n  {\r\n    hints->metrics      = metrics;\r\n    hints->scaler_flags = metrics->scaler.flags;\r\n  }\r\n\r\n\r\n  /* Recompute all AF_Point in AF_GlyphHints from the definitions */\r\n  /* in a source outline.                                         */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_glyph_hints_reload( AF_GlyphHints  hints,\r\n                         FT_Outline*    outline )\r\n  {\r\n    FT_Error   error   = AF_Err_Ok;\r\n    AF_Point   points;\r\n    FT_UInt    old_max, new_max;\r\n    FT_Fixed   x_scale = hints->x_scale;\r\n    FT_Fixed   y_scale = hints->y_scale;\r\n    FT_Pos     x_delta = hints->x_delta;\r\n    FT_Pos     y_delta = hints->y_delta;\r\n    FT_Memory  memory  = hints->memory;\r\n\r\n\r\n    hints->num_points   = 0;\r\n    hints->num_contours = 0;\r\n\r\n    hints->axis[0].num_segments = 0;\r\n    hints->axis[0].num_edges    = 0;\r\n    hints->axis[1].num_segments = 0;\r\n    hints->axis[1].num_edges    = 0;\r\n\r\n    /* first of all, reallocate the contours array if necessary */\r\n    new_max = (FT_UInt)outline->n_contours;\r\n    old_max = hints->max_contours;\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */\r\n\r\n      if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      hints->max_contours = new_max;\r\n    }\r\n\r\n    /*\r\n     *  then reallocate the points arrays if necessary --\r\n     *  note that we reserve two additional point positions, used to\r\n     *  hint metrics appropriately\r\n     */\r\n    new_max = (FT_UInt)( outline->n_points + 2 );\r\n    old_max = hints->max_points;\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = ( new_max + 2 + 7 ) & ~7; /* round up to a multiple of 8 */\r\n\r\n      if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      hints->max_points = new_max;\r\n    }\r\n\r\n    hints->num_points   = outline->n_points;\r\n    hints->num_contours = outline->n_contours;\r\n\r\n    /* We can't rely on the value of `FT_Outline.flags' to know the fill   */\r\n    /* direction used for a glyph, given that some fonts are broken (e.g., */\r\n    /* the Arphic ones).  We thus recompute it each time we need to.       */\r\n    /*                                                                     */\r\n    hints->axis[AF_DIMENSION_HORZ].major_dir = AF_DIR_UP;\r\n    hints->axis[AF_DIMENSION_VERT].major_dir = AF_DIR_LEFT;\r\n\r\n    if ( FT_Outline_Get_Orientation( outline ) == FT_ORIENTATION_POSTSCRIPT )\r\n    {\r\n      hints->axis[AF_DIMENSION_HORZ].major_dir = AF_DIR_DOWN;\r\n      hints->axis[AF_DIMENSION_VERT].major_dir = AF_DIR_RIGHT;\r\n    }\r\n\r\n    hints->x_scale = x_scale;\r\n    hints->y_scale = y_scale;\r\n    hints->x_delta = x_delta;\r\n    hints->y_delta = y_delta;\r\n\r\n    hints->xmin_delta = 0;\r\n    hints->xmax_delta = 0;\r\n\r\n    points = hints->points;\r\n    if ( hints->num_points == 0 )\r\n      goto Exit;\r\n\r\n    {\r\n      AF_Point  point;\r\n      AF_Point  point_limit = points + hints->num_points;\r\n\r\n\r\n      /* compute coordinates & Bezier flags, next and prev */\r\n      {\r\n        FT_Vector*  vec           = outline->points;\r\n        char*       tag           = outline->tags;\r\n        AF_Point    end           = points + outline->contours[0];\r\n        AF_Point    prev          = end;\r\n        FT_Int      contour_index = 0;\r\n\r\n\r\n        for ( point = points; point < point_limit; point++, vec++, tag++ )\r\n        {\r\n          point->fx = (FT_Short)vec->x;\r\n          point->fy = (FT_Short)vec->y;\r\n          point->ox = point->x = FT_MulFix( vec->x, x_scale ) + x_delta;\r\n          point->oy = point->y = FT_MulFix( vec->y, y_scale ) + y_delta;\r\n\r\n          switch ( FT_CURVE_TAG( *tag ) )\r\n          {\r\n          case FT_CURVE_TAG_CONIC:\r\n            point->flags = AF_FLAG_CONIC;\r\n            break;\r\n          case FT_CURVE_TAG_CUBIC:\r\n            point->flags = AF_FLAG_CUBIC;\r\n            break;\r\n          default:\r\n            point->flags = AF_FLAG_NONE;\r\n          }\r\n\r\n          point->prev = prev;\r\n          prev->next  = point;\r\n          prev        = point;\r\n\r\n          if ( point == end )\r\n          {\r\n            if ( ++contour_index < outline->n_contours )\r\n            {\r\n              end  = points + outline->contours[contour_index];\r\n              prev = end;\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      /* set up the contours array */\r\n      {\r\n        AF_Point*  contour       = hints->contours;\r\n        AF_Point*  contour_limit = contour + hints->num_contours;\r\n        short*     end           = outline->contours;\r\n        short      idx           = 0;\r\n\r\n\r\n        for ( ; contour < contour_limit; contour++, end++ )\r\n        {\r\n          contour[0] = points + idx;\r\n          idx        = (short)( end[0] + 1 );\r\n        }\r\n      }\r\n\r\n      /* compute directions of in & out vectors */\r\n      {\r\n        AF_Point      first  = points;\r\n        AF_Point      prev   = NULL;\r\n        FT_Pos        in_x   = 0;\r\n        FT_Pos        in_y   = 0;\r\n        AF_Direction  in_dir = AF_DIR_NONE;\r\n\r\n\r\n        for ( point = points; point < point_limit; point++ )\r\n        {\r\n          AF_Point  next;\r\n          FT_Pos    out_x, out_y;\r\n\r\n\r\n          if ( point == first )\r\n          {\r\n            prev   = first->prev;\r\n            in_x   = first->fx - prev->fx;\r\n            in_y   = first->fy - prev->fy;\r\n            in_dir = af_direction_compute( in_x, in_y );\r\n            first  = prev + 1;\r\n          }\r\n\r\n          point->in_dir = (FT_Char)in_dir;\r\n\r\n          next  = point->next;\r\n          out_x = next->fx - point->fx;\r\n          out_y = next->fy - point->fy;\r\n\r\n          in_dir         = af_direction_compute( out_x, out_y );\r\n          point->out_dir = (FT_Char)in_dir;\r\n\r\n          /* check for weak points */\r\n\r\n          if ( point->flags & AF_FLAG_CONTROL )\r\n          {\r\n          Is_Weak_Point:\r\n            point->flags |= AF_FLAG_WEAK_INTERPOLATION;\r\n          }\r\n          else if ( point->out_dir == point->in_dir )\r\n          {\r\n            if ( point->out_dir != AF_DIR_NONE )\r\n              goto Is_Weak_Point;\r\n\r\n            if ( ft_corner_is_flat( in_x, in_y, out_x, out_y ) )\r\n              goto Is_Weak_Point;\r\n          }\r\n          else if ( point->in_dir == -point->out_dir )\r\n            goto Is_Weak_Point;\r\n\r\n          in_x = out_x;\r\n          in_y = out_y;\r\n          prev = point;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Store the hinted outline in an FT_Outline structure. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_save( AF_GlyphHints  hints,\r\n                       FT_Outline*    outline )\r\n  {\r\n    AF_Point    point = hints->points;\r\n    AF_Point    limit = point + hints->num_points;\r\n    FT_Vector*  vec   = outline->points;\r\n    char*       tag   = outline->tags;\r\n\r\n\r\n    for ( ; point < limit; point++, vec++, tag++ )\r\n    {\r\n      vec->x = point->x;\r\n      vec->y = point->y;\r\n\r\n      if ( point->flags & AF_FLAG_CONIC )\r\n        tag[0] = FT_CURVE_TAG_CONIC;\r\n      else if ( point->flags & AF_FLAG_CUBIC )\r\n        tag[0] = FT_CURVE_TAG_CUBIC;\r\n      else\r\n        tag[0] = FT_CURVE_TAG_ON;\r\n    }\r\n  }\r\n\r\n\r\n  /****************************************************************\r\n   *\r\n   *                     EDGE POINT GRID-FITTING\r\n   *\r\n   ****************************************************************/\r\n\r\n\r\n  /* Align all points of an edge to the same coordinate value, */\r\n  /* either horizontally or vertically.                        */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_align_edge_points( AF_GlyphHints  hints,\r\n                                    AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis          = & hints->axis[dim];\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    AF_Segment    seg;\r\n\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      for ( seg = segments; seg < segment_limit; seg++ )\r\n      {\r\n        AF_Edge   edge = seg->edge;\r\n        AF_Point  point, first, last;\r\n\r\n\r\n        if ( edge == NULL )\r\n          continue;\r\n\r\n        first = seg->first;\r\n        last  = seg->last;\r\n        point = first;\r\n        for (;;)\r\n        {\r\n          point->x      = edge->pos;\r\n          point->flags |= AF_FLAG_TOUCH_X;\r\n\r\n          if ( point == last )\r\n            break;\r\n\r\n          point = point->next;\r\n        }\r\n      }\r\n    }\r\n    else\r\n    {\r\n      for ( seg = segments; seg < segment_limit; seg++ )\r\n      {\r\n        AF_Edge   edge = seg->edge;\r\n        AF_Point  point, first, last;\r\n\r\n\r\n        if ( edge == NULL )\r\n          continue;\r\n\r\n        first = seg->first;\r\n        last  = seg->last;\r\n        point = first;\r\n        for (;;)\r\n        {\r\n          point->y      = edge->pos;\r\n          point->flags |= AF_FLAG_TOUCH_Y;\r\n\r\n          if ( point == last )\r\n            break;\r\n\r\n          point = point->next;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /****************************************************************\r\n   *\r\n   *                    STRONG POINT INTERPOLATION\r\n   *\r\n   ****************************************************************/\r\n\r\n\r\n  /* Hint the strong points -- this is equivalent to the TrueType `IP' */\r\n  /* hinting instruction.                                              */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_align_strong_points( AF_GlyphHints  hints,\r\n                                      AF_Dimension   dim )\r\n  {\r\n    AF_Point      points      = hints->points;\r\n    AF_Point      point_limit = points + hints->num_points;\r\n    AF_AxisHints  axis        = &hints->axis[dim];\r\n    AF_Edge       edges       = axis->edges;\r\n    AF_Edge       edge_limit  = edges + axis->num_edges;\r\n    AF_Flags      touch_flag;\r\n\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n      touch_flag = AF_FLAG_TOUCH_X;\r\n    else\r\n      touch_flag  = AF_FLAG_TOUCH_Y;\r\n\r\n    if ( edges < edge_limit )\r\n    {\r\n      AF_Point  point;\r\n      AF_Edge   edge;\r\n\r\n\r\n      for ( point = points; point < point_limit; point++ )\r\n      {\r\n        FT_Pos  u, ou, fu;  /* point position */\r\n        FT_Pos  delta;\r\n\r\n\r\n        if ( point->flags & touch_flag )\r\n          continue;\r\n\r\n        /* if this point is candidate to weak interpolation, we       */\r\n        /* interpolate it after all strong points have been processed */\r\n\r\n        if (  ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) &&\r\n             !( point->flags & AF_FLAG_INFLECTION )         )\r\n          continue;\r\n\r\n        if ( dim == AF_DIMENSION_VERT )\r\n        {\r\n          u  = point->fy;\r\n          ou = point->oy;\r\n        }\r\n        else\r\n        {\r\n          u  = point->fx;\r\n          ou = point->ox;\r\n        }\r\n\r\n        fu = u;\r\n\r\n        /* is the point before the first edge? */\r\n        edge  = edges;\r\n        delta = edge->fpos - u;\r\n        if ( delta >= 0 )\r\n        {\r\n          u = edge->pos - ( edge->opos - ou );\r\n          goto Store_Point;\r\n        }\r\n\r\n        /* is the point after the last edge? */\r\n        edge  = edge_limit - 1;\r\n        delta = u - edge->fpos;\r\n        if ( delta >= 0 )\r\n        {\r\n          u = edge->pos + ( ou - edge->opos );\r\n          goto Store_Point;\r\n        }\r\n\r\n        {\r\n          FT_PtrDist  min, max, mid;\r\n          FT_Pos      fpos;\r\n\r\n\r\n          /* find enclosing edges */\r\n          min = 0;\r\n          max = edge_limit - edges;\r\n\r\n#if 1\r\n          /* for a small number of edges, a linear search is better */\r\n          if ( max <= 8 )\r\n          {\r\n            FT_PtrDist  nn;\r\n\r\n\r\n            for ( nn = 0; nn < max; nn++ )\r\n              if ( edges[nn].fpos >= u )\r\n                break;\r\n\r\n            if ( edges[nn].fpos == u )\r\n            {\r\n              u = edges[nn].pos;\r\n              goto Store_Point;\r\n            }\r\n            min = nn;\r\n          }\r\n          else\r\n#endif\r\n          while ( min < max )\r\n          {\r\n            mid  = ( max + min ) >> 1;\r\n            edge = edges + mid;\r\n            fpos = edge->fpos;\r\n\r\n            if ( u < fpos )\r\n              max = mid;\r\n            else if ( u > fpos )\r\n              min = mid + 1;\r\n            else\r\n            {\r\n              /* we are on the edge */\r\n              u = edge->pos;\r\n              goto Store_Point;\r\n            }\r\n          }\r\n\r\n          /* point is not on an edge */\r\n          {\r\n            AF_Edge  before = edges + min - 1;\r\n            AF_Edge  after  = edges + min + 0;\r\n\r\n\r\n            /* assert( before && after && before != after ) */\r\n            if ( before->scale == 0 )\r\n              before->scale = FT_DivFix( after->pos - before->pos,\r\n                                         after->fpos - before->fpos );\r\n\r\n            u = before->pos + FT_MulFix( fu - before->fpos,\r\n                                         before->scale );\r\n          }\r\n        }\r\n\r\n      Store_Point:\r\n        /* save the point position */\r\n        if ( dim == AF_DIMENSION_HORZ )\r\n          point->x = u;\r\n        else\r\n          point->y = u;\r\n\r\n        point->flags |= touch_flag;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /****************************************************************\r\n   *\r\n   *                    WEAK POINT INTERPOLATION\r\n   *\r\n   ****************************************************************/\r\n\r\n\r\n  /* Shift the original coordinates of all points between `p1' and */\r\n  /* `p2' to get hinted coordinates, using the same difference as  */\r\n  /* given by `ref'.                                               */\r\n\r\n  static void\r\n  af_iup_shift( AF_Point  p1,\r\n                AF_Point  p2,\r\n                AF_Point  ref )\r\n  {\r\n    AF_Point  p;\r\n    FT_Pos    delta = ref->u - ref->v;\r\n\r\n\r\n    if ( delta == 0 )\r\n      return;\r\n\r\n    for ( p = p1; p < ref; p++ )\r\n      p->u = p->v + delta;\r\n\r\n    for ( p = ref + 1; p <= p2; p++ )\r\n      p->u = p->v + delta;\r\n  }\r\n\r\n\r\n  /* Interpolate the original coordinates of all points between `p1' and  */\r\n  /* `p2' to get hinted coordinates, using `ref1' and `ref2' as the       */\r\n  /* reference points.  The `u' and `v' members are the current and       */\r\n  /* original coordinate values, respectively.                            */\r\n  /*                                                                      */\r\n  /* Details can be found in the TrueType bytecode specification.         */\r\n\r\n  static void\r\n  af_iup_interp( AF_Point  p1,\r\n                 AF_Point  p2,\r\n                 AF_Point  ref1,\r\n                 AF_Point  ref2 )\r\n  {\r\n    AF_Point  p;\r\n    FT_Pos    u;\r\n    FT_Pos    v1 = ref1->v;\r\n    FT_Pos    v2 = ref2->v;\r\n    FT_Pos    d1 = ref1->u - v1;\r\n    FT_Pos    d2 = ref2->u - v2;\r\n\r\n\r\n    if ( p1 > p2 )\r\n      return;\r\n\r\n    if ( v1 == v2 )\r\n    {\r\n      for ( p = p1; p <= p2; p++ )\r\n      {\r\n        u = p->v;\r\n\r\n        if ( u <= v1 )\r\n          u += d1;\r\n        else\r\n          u += d2;\r\n\r\n        p->u = u;\r\n      }\r\n      return;\r\n    }\r\n\r\n    if ( v1 < v2 )\r\n    {\r\n      for ( p = p1; p <= p2; p++ )\r\n      {\r\n        u = p->v;\r\n\r\n        if ( u <= v1 )\r\n          u += d1;\r\n        else if ( u >= v2 )\r\n          u += d2;\r\n        else\r\n          u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 );\r\n\r\n        p->u = u;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      for ( p = p1; p <= p2; p++ )\r\n      {\r\n        u = p->v;\r\n\r\n        if ( u <= v2 )\r\n          u += d2;\r\n        else if ( u >= v1 )\r\n          u += d1;\r\n        else\r\n          u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 );\r\n\r\n        p->u = u;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* Hint the weak points -- this is equivalent to the TrueType `IUP' */\r\n  /* hinting instruction.                                             */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_align_weak_points( AF_GlyphHints  hints,\r\n                                    AF_Dimension   dim )\r\n  {\r\n    AF_Point   points        = hints->points;\r\n    AF_Point   point_limit   = points + hints->num_points;\r\n    AF_Point*  contour       = hints->contours;\r\n    AF_Point*  contour_limit = contour + hints->num_contours;\r\n    AF_Flags   touch_flag;\r\n    AF_Point   point;\r\n    AF_Point   end_point;\r\n    AF_Point   first_point;\r\n\r\n\r\n    /* PASS 1: Move segment points to edge positions */\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      touch_flag = AF_FLAG_TOUCH_X;\r\n\r\n      for ( point = points; point < point_limit; point++ )\r\n      {\r\n        point->u = point->x;\r\n        point->v = point->ox;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      touch_flag = AF_FLAG_TOUCH_Y;\r\n\r\n      for ( point = points; point < point_limit; point++ )\r\n      {\r\n        point->u = point->y;\r\n        point->v = point->oy;\r\n      }\r\n    }\r\n\r\n    point = points;\r\n\r\n    for ( ; contour < contour_limit; contour++ )\r\n    {\r\n      AF_Point  first_touched, last_touched;\r\n\r\n\r\n      point       = *contour;\r\n      end_point   = point->prev;\r\n      first_point = point;\r\n\r\n      /* find first touched point */\r\n      for (;;)\r\n      {\r\n        if ( point > end_point )  /* no touched point in contour */\r\n          goto NextContour;\r\n\r\n        if ( point->flags & touch_flag )\r\n          break;\r\n\r\n        point++;\r\n      }\r\n\r\n      first_touched = point;\r\n      last_touched  = point;\r\n\r\n      for (;;)\r\n      {\r\n        FT_ASSERT( point <= end_point                 &&\r\n                   ( point->flags & touch_flag ) != 0 );\r\n\r\n        /* skip any touched neighbours */\r\n        while ( point < end_point                    &&\r\n                ( point[1].flags & touch_flag ) != 0 )\r\n          point++;\r\n\r\n        last_touched = point;\r\n\r\n        /* find the next touched point, if any */\r\n        point++;\r\n        for (;;)\r\n        {\r\n          if ( point > end_point )\r\n            goto EndContour;\r\n\r\n          if ( ( point->flags & touch_flag ) != 0 )\r\n            break;\r\n\r\n          point++;\r\n        }\r\n\r\n        /* interpolate between last_touched and point */\r\n        af_iup_interp( last_touched + 1, point - 1,\r\n                       last_touched, point );\r\n      }\r\n\r\n    EndContour:\r\n      /* special case: only one point was touched */\r\n      if ( last_touched == first_touched )\r\n        af_iup_shift( first_point, end_point, first_touched );\r\n\r\n      else /* interpolate the last part */\r\n      {\r\n        if ( last_touched < end_point )\r\n          af_iup_interp( last_touched + 1, end_point,\r\n                         last_touched, first_touched );\r\n\r\n        if ( first_touched > points )\r\n          af_iup_interp( first_point, first_touched - 1,\r\n                         last_touched, first_touched );\r\n      }\r\n\r\n    NextContour:\r\n      ;\r\n    }\r\n\r\n    /* now save the interpolated values back to x/y */\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      for ( point = points; point < point_limit; point++ )\r\n        point->x = point->u;\r\n    }\r\n    else\r\n    {\r\n      for ( point = points; point < point_limit; point++ )\r\n        point->y = point->u;\r\n    }\r\n  }\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n\r\n  /* Apply (small) warp scale and warp delta for given dimension. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_glyph_hints_scale_dim( AF_GlyphHints  hints,\r\n                            AF_Dimension   dim,\r\n                            FT_Fixed       scale,\r\n                            FT_Pos         delta )\r\n  {\r\n    AF_Point  points       = hints->points;\r\n    AF_Point  points_limit = points + hints->num_points;\r\n    AF_Point  point;\r\n\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      for ( point = points; point < points_limit; point++ )\r\n        point->x = FT_MulFix( point->fx, scale ) + delta;\r\n    }\r\n    else\r\n    {\r\n      for ( point = points; point < points_limit; point++ )\r\n        point->y = FT_MulFix( point->fy, scale ) + delta;\r\n    }\r\n  }\r\n\r\n#endif /* AF_CONFIG_OPTION_USE_WARPER */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afhints.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afhints.h                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2003-2008, 2010-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFHINTS_H__\r\n#define __AFHINTS_H__\r\n\r\n#include \"aftypes.h\"\r\n\r\n#define xxAF_SORT_SEGMENTS\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*\r\n   *  The definition of outline glyph hints.  These are shared by all\r\n   *  script analysis routines (until now).\r\n   */\r\n\r\n  typedef enum  AF_Dimension_\r\n  {\r\n    AF_DIMENSION_HORZ = 0,  /* x coordinates,                    */\r\n                            /* i.e., vertical segments & edges   */\r\n    AF_DIMENSION_VERT = 1,  /* y coordinates,                    */\r\n                            /* i.e., horizontal segments & edges */\r\n\r\n    AF_DIMENSION_MAX  /* do not remove */\r\n\r\n  } AF_Dimension;\r\n\r\n\r\n  /* hint directions -- the values are computed so that two vectors are */\r\n  /* in opposite directions iff `dir1 + dir2 == 0'                      */\r\n  typedef enum  AF_Direction_\r\n  {\r\n    AF_DIR_NONE  =  4,\r\n    AF_DIR_RIGHT =  1,\r\n    AF_DIR_LEFT  = -1,\r\n    AF_DIR_UP    =  2,\r\n    AF_DIR_DOWN  = -2\r\n\r\n  } AF_Direction;\r\n\r\n\r\n  /*\r\n   *  The following explanations are mostly taken from the article\r\n   *\r\n   *    Real-Time Grid Fitting of Typographic Outlines\r\n   *\r\n   *  by David Turner and Werner Lemberg\r\n   *\r\n   *   http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf\r\n   *\r\n   *\r\n   *  Segments\r\n   *\r\n   *    `af_{cjk,latin,...}_hints_compute_segments' are the functions to\r\n   *    find segments in an outline.  A segment is a series of consecutive\r\n   *    points that are approximately aligned along a coordinate axis.  The\r\n   *    analysis to do so is specific to a script.\r\n   *\r\n   *    A segment must have at least two points, except in the case of\r\n   *    `fake' segments that are generated to hint metrics appropriately,\r\n   *    and which consist of a single point.\r\n   *\r\n   *\r\n   *  Edges\r\n   *\r\n   *    As soon as segments are defined, the auto-hinter groups them into\r\n   *    edges.  An edge corresponds to a single position on the main\r\n   *    dimension that collects one or more segments (allowing for a small\r\n   *    threshold).\r\n   *\r\n   *    The auto-hinter first tries to grid fit edges, then to align\r\n   *    segments on the edges unless it detects that they form a serif.\r\n   *\r\n   *    `af_{cjk,latin,...}_hints_compute_edges' are the functions to find\r\n   *    edges; they are specific to a script.\r\n   *\r\n   *\r\n   *                      A          H\r\n   *                       |        |\r\n   *                       |        |\r\n   *                       |        |\r\n   *                       |        |\r\n   *         C             |        |             F\r\n   *          +------<-----+        +-----<------+\r\n   *          |             B      G             |\r\n   *          |                                  |\r\n   *          |                                  |\r\n   *          +--------------->------------------+\r\n   *         D                                    E\r\n   *\r\n   *\r\n   *  Stems\r\n   *\r\n   *    Segments need to be `linked' to other ones in order to detect stems.\r\n   *    A stem is made of two segments that face each other in opposite\r\n   *    directions and that are sufficiently close to each other.  Using\r\n   *    vocabulary from the TrueType specification, stem segments form a\r\n   *    `black distance'.\r\n   *\r\n   *    In the above ASCII drawing, the horizontal segments are BC, DE, and\r\n   *    FG; the vertical segments are AB, CD, EF, and GH.\r\n   *\r\n   *    Each segment has at most one `best' candidate to form a black\r\n   *    distance, or no candidate at all.  Notice that two distinct segments\r\n   *    can have the same candidate, which frequently means a serif.\r\n   *\r\n   *    A stem is recognized by the following condition:\r\n   *\r\n   *      best segment_1 = segment_2 && best segment_2 = segment_1\r\n   *\r\n   *    The best candidate is stored in field `link' in structure\r\n   *    `AF_Segment'.\r\n   *\r\n   *    Stems are detected by `af_{cjk,latin,...}_hint_edges'.\r\n   *\r\n   *    In the above ASCII drawing, the best candidate for both AB and CD is\r\n   *    GH, while the best candidate for GH is AB.  Similarly, the best\r\n   *    candidate for EF and GH is AB, while the best candidate for AB is\r\n   *    GH.\r\n   *\r\n   *\r\n   *  Serifs\r\n   *\r\n   *    On the opposite, a serif has\r\n   *\r\n   *      best segment_1 = segment_2 && best segment_2 != segment_1\r\n   *\r\n   *    where segment_1 corresponds to the serif segment (CD and EF in the\r\n   *    above ASCII drawing).\r\n   *\r\n   *    The best candidate is stored in field `serif' in structure\r\n   *    `AF_Segment' (and `link' is set to NULL).\r\n   *\r\n   *    Serifs are detected by `af_{cjk,latin,...}_hint_edges'.\r\n   *\r\n   *\r\n   *  Touched points\r\n   *\r\n   *    A point is called `touched' if it has been processed somehow by the\r\n   *    auto-hinter.  It basically means that it shouldn't be moved again\r\n   *    (or moved only under certain constraints to preserve the already\r\n   *    applied processing).\r\n   *\r\n   *\r\n   *  Flat and round segments\r\n   *\r\n   *    Segments are `round' or `flat', depending on the series of points\r\n   *    that define them.  A segment is round if the next and previous point\r\n   *    of an extremum (which can be either a single point or sequence of\r\n   *    points) are both conic or cubic control points.  Otherwise, a\r\n   *    segment with an extremum is flat.\r\n   *\r\n   *\r\n   *  Strong Points\r\n   *\r\n   *    Experience has shown that points which are not part of an edge need\r\n   *    to be interpolated linearly between their two closest edges, even if\r\n   *    these are not part of the contour of those particular points.\r\n   *    Typical candidates for this are\r\n   *\r\n   *    - angle points (i.e., points where the `in' and `out' direction\r\n   *      differ greatly)\r\n   *\r\n   *    - inflection points (i.e., where the `in' and `out' angles are the\r\n   *      same, but the curvature changes sign)\r\n   *\r\n   *    `af_glyph_hints_align_strong_points' is the function which takes\r\n   *    care of such situations; it is equivalent to the TrueType `IP'\r\n   *    hinting instruction.\r\n   *\r\n   *\r\n   *  Weak Points\r\n   *\r\n   *    Other points in the outline must be interpolated using the\r\n   *    coordinates of their previous and next unfitted contour neighbours.\r\n   *    These are called `weak points' and are touched by the function\r\n   *    `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP'\r\n   *    hinting instruction.  Typical candidates are control points and\r\n   *    points on the contour without a major direction.\r\n   *\r\n   *    The major effect is to reduce possible distortion caused by\r\n   *    alignment of edges and strong points, thus weak points are processed\r\n   *    after strong points.\r\n   */\r\n\r\n\r\n  /* point hint flags */\r\n  typedef enum  AF_Flags_\r\n  {\r\n    AF_FLAG_NONE = 0,\r\n\r\n    /* point type flags */\r\n    AF_FLAG_CONIC   = 1 << 0,\r\n    AF_FLAG_CUBIC   = 1 << 1,\r\n    AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,\r\n\r\n    /* point extremum flags */\r\n    AF_FLAG_EXTREMA_X = 1 << 2,\r\n    AF_FLAG_EXTREMA_Y = 1 << 3,\r\n\r\n    /* point roundness flags */\r\n    AF_FLAG_ROUND_X = 1 << 4,\r\n    AF_FLAG_ROUND_Y = 1 << 5,\r\n\r\n    /* point touch flags */\r\n    AF_FLAG_TOUCH_X = 1 << 6,\r\n    AF_FLAG_TOUCH_Y = 1 << 7,\r\n\r\n    /* candidates for weak interpolation have this flag set */\r\n    AF_FLAG_WEAK_INTERPOLATION = 1 << 8,\r\n\r\n    /* all inflection points in the outline have this flag set */\r\n    AF_FLAG_INFLECTION = 1 << 9\r\n\r\n  } AF_Flags;\r\n\r\n\r\n  /* edge hint flags */\r\n  typedef enum  AF_Edge_Flags_\r\n  {\r\n    AF_EDGE_NORMAL = 0,\r\n    AF_EDGE_ROUND  = 1 << 0,\r\n    AF_EDGE_SERIF  = 1 << 1,\r\n    AF_EDGE_DONE   = 1 << 2\r\n\r\n  } AF_Edge_Flags;\r\n\r\n\r\n  typedef struct AF_PointRec_*    AF_Point;\r\n  typedef struct AF_SegmentRec_*  AF_Segment;\r\n  typedef struct AF_EdgeRec_*     AF_Edge;\r\n\r\n\r\n  typedef struct  AF_PointRec_\r\n  {\r\n    FT_UShort  flags;    /* point flags used by hinter   */\r\n    FT_Char    in_dir;   /* direction of inwards vector  */\r\n    FT_Char    out_dir;  /* direction of outwards vector */\r\n\r\n    FT_Pos     ox, oy;   /* original, scaled position                   */\r\n    FT_Short   fx, fy;   /* original, unscaled position (in font units) */\r\n    FT_Pos     x, y;     /* current position                            */\r\n    FT_Pos     u, v;     /* current (x,y) or (y,x) depending on context */\r\n\r\n    AF_Point   next;     /* next point in contour     */\r\n    AF_Point   prev;     /* previous point in contour */\r\n\r\n  } AF_PointRec;\r\n\r\n\r\n  typedef struct  AF_SegmentRec_\r\n  {\r\n    FT_Byte     flags;       /* edge/segment flags for this segment */\r\n    FT_Char     dir;         /* segment direction                   */\r\n    FT_Short    pos;         /* position of segment                 */\r\n    FT_Short    min_coord;   /* minimum coordinate of segment       */\r\n    FT_Short    max_coord;   /* maximum coordinate of segment       */\r\n    FT_Short    height;      /* the hinted segment height           */\r\n\r\n    AF_Edge     edge;        /* the segment's parent edge           */\r\n    AF_Segment  edge_next;   /* link to next segment in parent edge */\r\n\r\n    AF_Segment  link;        /* (stem) link segment        */\r\n    AF_Segment  serif;       /* primary segment for serifs */\r\n    FT_Pos      num_linked;  /* number of linked segments  */\r\n    FT_Pos      score;       /* used during stem matching  */\r\n    FT_Pos      len;         /* used during stem matching  */\r\n\r\n    AF_Point    first;       /* first point in edge segment */\r\n    AF_Point    last;        /* last point in edge segment  */\r\n\r\n  } AF_SegmentRec;\r\n\r\n\r\n  typedef struct  AF_EdgeRec_\r\n  {\r\n    FT_Short    fpos;       /* original, unscaled position (in font units) */\r\n    FT_Pos      opos;       /* original, scaled position                   */\r\n    FT_Pos      pos;        /* current position                            */\r\n\r\n    FT_Byte     flags;      /* edge flags                                   */\r\n    FT_Char     dir;        /* edge direction                               */\r\n    FT_Fixed    scale;      /* used to speed up interpolation between edges */\r\n\r\n    AF_Width    blue_edge;  /* non-NULL if this is a blue edge */\r\n    AF_Edge     link;       /* link edge                       */\r\n    AF_Edge     serif;      /* primary edge for serifs         */\r\n    FT_Short    num_linked; /* number of linked edges          */\r\n    FT_Int      score;      /* used during stem matching       */\r\n\r\n    AF_Segment  first;      /* first segment in edge */\r\n    AF_Segment  last;       /* last segment in edge  */\r\n\r\n  } AF_EdgeRec;\r\n\r\n\r\n  typedef struct  AF_AxisHintsRec_\r\n  {\r\n    FT_Int        num_segments; /* number of used segments      */\r\n    FT_Int        max_segments; /* number of allocated segments */\r\n    AF_Segment    segments;     /* segments array               */\r\n#ifdef AF_SORT_SEGMENTS\r\n    FT_Int        mid_segments;\r\n#endif\r\n\r\n    FT_Int        num_edges;    /* number of used edges      */\r\n    FT_Int        max_edges;    /* number of allocated edges */\r\n    AF_Edge       edges;        /* edges array               */\r\n\r\n    AF_Direction  major_dir;    /* either vertical or horizontal */\r\n\r\n  } AF_AxisHintsRec, *AF_AxisHints;\r\n\r\n\r\n  typedef struct  AF_GlyphHintsRec_\r\n  {\r\n    FT_Memory         memory;\r\n\r\n    FT_Fixed          x_scale;\r\n    FT_Pos            x_delta;\r\n\r\n    FT_Fixed          y_scale;\r\n    FT_Pos            y_delta;\r\n\r\n    FT_Int            max_points;    /* number of allocated points */\r\n    FT_Int            num_points;    /* number of used points      */\r\n    AF_Point          points;        /* points array               */\r\n\r\n    FT_Int            max_contours;  /* number of allocated contours */\r\n    FT_Int            num_contours;  /* number of used contours      */\r\n    AF_Point*         contours;      /* contours array               */\r\n\r\n    AF_AxisHintsRec   axis[AF_DIMENSION_MAX];\r\n\r\n    FT_UInt32         scaler_flags;  /* copy of scaler flags     */\r\n    FT_UInt32         other_flags;   /* free for script-specific */\r\n                                     /* implementations          */\r\n    AF_ScriptMetrics  metrics;\r\n\r\n    FT_Pos            xmin_delta;    /* used for warping */\r\n    FT_Pos            xmax_delta;\r\n\r\n  } AF_GlyphHintsRec;\r\n\r\n\r\n#define AF_HINTS_TEST_SCALER( h, f )  ( (h)->scaler_flags & (f) )\r\n#define AF_HINTS_TEST_OTHER( h, f )   ( (h)->other_flags  & (f) )\r\n\r\n\r\n#ifdef FT_DEBUG_AUTOFIT\r\n\r\n#define AF_HINTS_DO_HORIZONTAL( h )                                     \\\r\n          ( !_af_debug_disable_horz_hints                            && \\\r\n            !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) )\r\n\r\n#define AF_HINTS_DO_VERTICAL( h )                                     \\\r\n          ( !_af_debug_disable_vert_hints                          && \\\r\n            !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) )\r\n\r\n#define AF_HINTS_DO_ADVANCE( h )                                \\\r\n          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )\r\n\r\n#define AF_HINTS_DO_BLUES( h )  ( !_af_debug_disable_blue_hints )\r\n\r\n#else /* !FT_DEBUG_AUTOFIT */\r\n\r\n#define AF_HINTS_DO_HORIZONTAL( h )                                \\\r\n          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL )\r\n\r\n#define AF_HINTS_DO_VERTICAL( h )                                \\\r\n          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL )\r\n\r\n#define AF_HINTS_DO_ADVANCE( h )                                \\\r\n          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )\r\n\r\n#define AF_HINTS_DO_BLUES( h )  1\r\n\r\n#endif /* !FT_DEBUG_AUTOFIT */\r\n\r\n\r\n  FT_LOCAL( AF_Direction )\r\n  af_direction_compute( FT_Pos  dx,\r\n                        FT_Pos  dy );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_axis_hints_new_segment( AF_AxisHints  axis,\r\n                             FT_Memory     memory,\r\n                             AF_Segment   *asegment );\r\n\r\n  FT_LOCAL( FT_Error)\r\n  af_axis_hints_new_edge( AF_AxisHints  axis,\r\n                          FT_Int        fpos,\r\n                          AF_Direction  dir,\r\n                          FT_Memory     memory,\r\n                          AF_Edge      *edge );\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_init( AF_GlyphHints  hints,\r\n                       FT_Memory      memory );\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_rescale( AF_GlyphHints     hints,\r\n                          AF_ScriptMetrics  metrics );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_glyph_hints_reload( AF_GlyphHints  hints,\r\n                         FT_Outline*    outline );\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_save( AF_GlyphHints  hints,\r\n                       FT_Outline*    outline );\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_align_edge_points( AF_GlyphHints  hints,\r\n                                    AF_Dimension   dim );\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_align_strong_points( AF_GlyphHints  hints,\r\n                                      AF_Dimension   dim );\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_align_weak_points( AF_GlyphHints  hints,\r\n                                    AF_Dimension   dim );\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_scale_dim( AF_GlyphHints  hints,\r\n                            AF_Dimension   dim,\r\n                            FT_Fixed       scale,\r\n                            FT_Pos         delta );\r\n#endif\r\n\r\n  FT_LOCAL( void )\r\n  af_glyph_hints_done( AF_GlyphHints  hints );\r\n\r\n/* */\r\n\r\n#define AF_SEGMENT_LEN( seg )          ( (seg)->max_coord - (seg)->min_coord )\r\n\r\n#define AF_SEGMENT_DIST( seg1, seg2 )  ( ( (seg1)->pos > (seg2)->pos )   \\\r\n                                           ? (seg1)->pos - (seg2)->pos   \\\r\n                                           : (seg2)->pos - (seg1)->pos )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFHINTS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afindic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afindic.c                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for Indic scripts (body).               */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2011, 2012 by                                          */\r\n/*  Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.    */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"aftypes.h\"\r\n#include \"aflatin.h\"\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_INDIC\r\n\r\n#include \"afindic.h\"\r\n#include \"aferrors.h\"\r\n#include \"afcjk.h\"\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n#include \"afwarp.h\"\r\n#endif\r\n\r\n\r\n  static FT_Error\r\n  af_indic_metrics_init( AF_CJKMetrics  metrics,\r\n                         FT_Face        face )\r\n  {\r\n    /* skip blue zone init in CJK routines */\r\n    FT_CharMap  oldmap = face->charmap;\r\n\r\n\r\n    metrics->units_per_em = face->units_per_EM;\r\n\r\n    if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )\r\n      face->charmap = NULL;\r\n    else\r\n    {\r\n      af_cjk_metrics_init_widths( metrics, face );\r\n#if 0\r\n      /* either need indic specific blue_chars[] or just skip blue zones */\r\n      af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars );\r\n#endif\r\n      af_cjk_metrics_check_digits( metrics, face );\r\n    }\r\n\r\n    FT_Set_Charmap( face, oldmap );\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  static void\r\n  af_indic_metrics_scale( AF_CJKMetrics  metrics,\r\n                          AF_Scaler      scaler )\r\n  {\r\n    /* use CJK routines */\r\n    af_cjk_metrics_scale( metrics, scaler );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_indic_hints_init( AF_GlyphHints  hints,\r\n                       AF_CJKMetrics  metrics )\r\n  {\r\n    /* use CJK routines */\r\n    return af_cjk_hints_init( hints, metrics );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_indic_hints_apply( AF_GlyphHints  hints,\r\n                        FT_Outline*    outline,\r\n                        AF_CJKMetrics  metrics )\r\n  {\r\n    /* use CJK routines */\r\n    return af_cjk_hints_apply( hints, outline, metrics );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                I N D I C   S C R I P T   C L A S S            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  static const AF_Script_UniRangeRec  af_indic_uniranges[] =\r\n  {\r\n#if 0\r\n    AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ),  /* why this? */\r\n#endif\r\n    AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL),    /* Indic Range */\r\n    AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL),    /* Tibetan */\r\n    AF_UNIRANGE_REC( 0x1900UL, 0x194FUL),    /* Limbu */\r\n    AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL),    /* Sundanese */\r\n    AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL),    /* Meetei Mayak */\r\n    AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL),    /* Syloti Nagri */\r\n    AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL),  /* Sharada */\r\n    AF_UNIRANGE_REC(      0UL,      0UL)\r\n  };\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,\r\n    AF_SCRIPT_INDIC,\r\n    af_indic_uniranges,\r\n    'o', /* XXX */\r\n\r\n    sizeof ( AF_CJKMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) af_indic_metrics_init,\r\n    (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   af_indic_hints_init,\r\n    (AF_Script_ApplyHintsFunc)  af_indic_hints_apply\r\n  )\r\n\r\n#else /* !AF_CONFIG_OPTION_INDIC */\r\n\r\n  static const AF_Script_UniRangeRec  af_indic_uniranges[] =\r\n  {\r\n    { 0, 0 }\r\n  };\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,\r\n    AF_SCRIPT_INDIC,\r\n    af_indic_uniranges,\r\n    0,\r\n\r\n    sizeof ( AF_CJKMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) NULL,\r\n    (AF_Script_ScaleMetricsFunc)NULL,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   NULL,\r\n    (AF_Script_ApplyHintsFunc)  NULL\r\n  )\r\n\r\n#endif /* !AF_CONFIG_OPTION_INDIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afindic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afindic.h                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for Indic scripts (specification).      */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2012 by                                                */\r\n/*  Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.    */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFINDIC_H__\r\n#define __AFINDIC_H__\r\n\r\n#include \"afhints.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* the Indic-specific script class */\r\n\r\n  AF_DECLARE_SCRIPT_CLASS( af_indic_script_class )\r\n\r\n\r\n/* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFINDIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/aflatin.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  aflatin.c                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for latin script (body).                */\r\n/*                                                                         */\r\n/*  Copyright 2003-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_ADVANCES_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"afglobal.h\"\r\n#include \"aflatin.h\"\r\n#include \"aferrors.h\"\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n#include \"afwarp.h\"\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_aflatin\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****            L A T I N   G L O B A L   M E T R I C S            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Find segments and links, compute all stem widths, and initialize */\r\n  /* standard width and height for the glyph with given charcode.     */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin_metrics_init_widths( AF_LatinMetrics  metrics,\r\n                                FT_Face          face )\r\n  {\r\n    /* scan the array of segments in each direction */\r\n    AF_GlyphHintsRec  hints[1];\r\n\r\n\r\n    FT_TRACE5(( \"standard widths computation\\n\"\r\n                \"===========================\\n\\n\" ));\r\n\r\n    af_glyph_hints_init( hints, face->memory );\r\n\r\n    metrics->axis[AF_DIMENSION_HORZ].width_count = 0;\r\n    metrics->axis[AF_DIMENSION_VERT].width_count = 0;\r\n\r\n    {\r\n      FT_Error            error;\r\n      FT_UInt             glyph_index;\r\n      int                 dim;\r\n      AF_LatinMetricsRec  dummy[1];\r\n      AF_Scaler           scaler = &dummy->root.scaler;\r\n\r\n\r\n      glyph_index = FT_Get_Char_Index( face,\r\n                                       metrics->root.clazz->standard_char );\r\n      if ( glyph_index == 0 )\r\n        goto Exit;\r\n\r\n      FT_TRACE5(( \"standard character: 0x%X (glyph index %d)\\n\",\r\n                  metrics->root.clazz->standard_char, glyph_index ));\r\n\r\n      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );\r\n      if ( error || face->glyph->outline.n_points <= 0 )\r\n        goto Exit;\r\n\r\n      FT_ZERO( dummy );\r\n\r\n      dummy->units_per_em = metrics->units_per_em;\r\n\r\n      scaler->x_scale = 0x10000L;\r\n      scaler->y_scale = 0x10000L;\r\n      scaler->x_delta = 0;\r\n      scaler->y_delta = 0;\r\n\r\n      scaler->face        = face;\r\n      scaler->render_mode = FT_RENDER_MODE_NORMAL;\r\n      scaler->flags       = 0;\r\n\r\n      af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy );\r\n\r\n      error = af_glyph_hints_reload( hints, &face->glyph->outline );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n      {\r\n        AF_LatinAxis  axis    = &metrics->axis[dim];\r\n        AF_AxisHints  axhints = &hints->axis[dim];\r\n        AF_Segment    seg, limit, link;\r\n        FT_UInt       num_widths = 0;\r\n\r\n\r\n        error = af_latin_hints_compute_segments( hints,\r\n                                                 (AF_Dimension)dim );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        af_latin_hints_link_segments( hints,\r\n                                      (AF_Dimension)dim );\r\n\r\n        seg   = axhints->segments;\r\n        limit = seg + axhints->num_segments;\r\n\r\n        for ( ; seg < limit; seg++ )\r\n        {\r\n          link = seg->link;\r\n\r\n          /* we only consider stem segments there! */\r\n          if ( link && link->link == seg && link > seg )\r\n          {\r\n            FT_Pos  dist;\r\n\r\n\r\n            dist = seg->pos - link->pos;\r\n            if ( dist < 0 )\r\n              dist = -dist;\r\n\r\n            if ( num_widths < AF_LATIN_MAX_WIDTHS )\r\n              axis->widths[num_widths++].org = dist;\r\n          }\r\n        }\r\n\r\n        /* this also replaces multiple almost identical stem widths */\r\n        /* with a single one (the value 100 is heuristic) */\r\n        af_sort_and_quantize_widths( &num_widths, axis->widths,\r\n                                     dummy->units_per_em / 100 );\r\n        axis->width_count = num_widths;\r\n      }\r\n\r\n  Exit:\r\n      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n      {\r\n        AF_LatinAxis  axis = &metrics->axis[dim];\r\n        FT_Pos        stdw;\r\n\r\n\r\n        stdw = ( axis->width_count > 0 )\r\n                 ? axis->widths[0].org\r\n                 : AF_LATIN_CONSTANT( metrics, 50 );\r\n\r\n        /* let's try 20% of the smallest width */\r\n        axis->edge_distance_threshold = stdw / 5;\r\n        axis->standard_width          = stdw;\r\n        axis->extra_light             = 0;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        {\r\n          FT_UInt  i;\r\n\r\n\r\n          FT_TRACE5(( \"%s widths:\\n\",\r\n                      dim == AF_DIMENSION_VERT ? \"horizontal\"\r\n                                               : \"vertical\" ));\r\n\r\n          FT_TRACE5(( \"  %d (standard)\", axis->standard_width ));\r\n          for ( i = 1; i < axis->width_count; i++ )\r\n            FT_TRACE5(( \" %d\", axis->widths[i].org ));\r\n\r\n          FT_TRACE5(( \"\\n\" ));\r\n        }\r\n#endif\r\n      }\r\n    }\r\n\r\n    FT_TRACE5(( \"\\n\" ));\r\n\r\n    af_glyph_hints_done( hints );\r\n  }\r\n\r\n\r\n\r\n#define AF_LATIN_MAX_TEST_CHARACTERS  12\r\n\r\n\r\n  static const char af_latin_blue_chars[AF_LATIN_MAX_BLUES]\r\n                                       [AF_LATIN_MAX_TEST_CHARACTERS + 1] =\r\n  {\r\n    \"THEZOCQS\",\r\n    \"HEZLOCUS\",\r\n    \"fijkdbh\",\r\n    \"xzroesc\",\r\n    \"xzroesc\",\r\n    \"pqgjy\"\r\n  };\r\n\r\n\r\n  /* Find all blue zones.  Flat segments give the reference points, */\r\n  /* round segments the overshoot positions.                        */\r\n\r\n  static void\r\n  af_latin_metrics_init_blues( AF_LatinMetrics  metrics,\r\n                               FT_Face          face )\r\n  {\r\n    FT_Pos        flats [AF_LATIN_MAX_TEST_CHARACTERS];\r\n    FT_Pos        rounds[AF_LATIN_MAX_TEST_CHARACTERS];\r\n    FT_Int        num_flats;\r\n    FT_Int        num_rounds;\r\n    FT_Int        bb;\r\n    AF_LatinBlue  blue;\r\n    FT_Error      error;\r\n    AF_LatinAxis  axis  = &metrics->axis[AF_DIMENSION_VERT];\r\n    FT_Outline    outline;\r\n\r\n\r\n    /* we compute the blues simply by loading each character from the    */\r\n    /* `af_latin_blue_chars[blues]' string, then finding its top-most or */\r\n    /* bottom-most points (depending on `AF_IS_TOP_BLUE')                */\r\n\r\n    FT_TRACE5(( \"blue zones computation\\n\"\r\n                \"======================\\n\\n\" ));\r\n\r\n    for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )\r\n    {\r\n      const char*  p     = af_latin_blue_chars[bb];\r\n      const char*  limit = p + AF_LATIN_MAX_TEST_CHARACTERS;\r\n      FT_Pos*      blue_ref;\r\n      FT_Pos*      blue_shoot;\r\n\r\n\r\n      FT_TRACE5(( \"blue zone %d:\\n\", bb ));\r\n\r\n      num_flats  = 0;\r\n      num_rounds = 0;\r\n\r\n      for ( ; p < limit && *p; p++ )\r\n      {\r\n        FT_UInt     glyph_index;\r\n        FT_Pos      best_y;                            /* same as points.y */\r\n        FT_Int      best_point, best_contour_first, best_contour_last;\r\n        FT_Vector*  points;\r\n        FT_Bool     round = 0;\r\n\r\n\r\n        /* load the character in the face -- skip unknown or empty ones */\r\n        glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );\r\n        if ( glyph_index == 0 )\r\n          continue;\r\n\r\n        error   = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );\r\n        outline = face->glyph->outline;\r\n        if ( error || outline.n_points <= 0 )\r\n          continue;\r\n\r\n        /* now compute min or max point indices and coordinates */\r\n        points             = outline.points;\r\n        best_point         = -1;\r\n        best_y             = 0;  /* make compiler happy */\r\n        best_contour_first = 0;  /* ditto */\r\n        best_contour_last  = 0;  /* ditto */\r\n\r\n        {\r\n          FT_Int  nn;\r\n          FT_Int  first = 0;\r\n          FT_Int  last  = -1;\r\n\r\n\r\n          for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ )\r\n          {\r\n            FT_Int  old_best_point = best_point;\r\n            FT_Int  pp;\r\n\r\n\r\n            last = outline.contours[nn];\r\n\r\n            /* Avoid single-point contours since they are never rasterized. */\r\n            /* In some fonts, they correspond to mark attachment points     */\r\n            /* which are way outside of the glyph's real outline.           */\r\n            if ( last <= first )\r\n              continue;\r\n\r\n            if ( AF_LATIN_IS_TOP_BLUE( bb ) )\r\n            {\r\n              for ( pp = first; pp <= last; pp++ )\r\n                if ( best_point < 0 || points[pp].y > best_y )\r\n                {\r\n                  best_point = pp;\r\n                  best_y     = points[pp].y;\r\n                }\r\n            }\r\n            else\r\n            {\r\n              for ( pp = first; pp <= last; pp++ )\r\n                if ( best_point < 0 || points[pp].y < best_y )\r\n                {\r\n                  best_point = pp;\r\n                  best_y     = points[pp].y;\r\n                }\r\n            }\r\n\r\n            if ( best_point != old_best_point )\r\n            {\r\n              best_contour_first = first;\r\n              best_contour_last  = last;\r\n            }\r\n          }\r\n          FT_TRACE5(( \"  %c  %ld\", *p, best_y ));\r\n        }\r\n\r\n        /* now check whether the point belongs to a straight or round   */\r\n        /* segment; we first need to find in which contour the extremum */\r\n        /* lies, then inspect its previous and next points              */\r\n        if ( best_point >= 0 )\r\n        {\r\n          FT_Pos  best_x = points[best_point].x;\r\n          FT_Int  prev, next;\r\n          FT_Int  best_on_point_first, best_on_point_last;\r\n          FT_Pos  dist;\r\n\r\n\r\n          if ( FT_CURVE_TAG( outline.tags[best_point] ) == FT_CURVE_TAG_ON )\r\n          {\r\n            best_on_point_first = best_point;\r\n            best_on_point_last  = best_point;\r\n          }\r\n          else\r\n          {\r\n            best_on_point_first = -1;\r\n            best_on_point_last  = -1;\r\n          }\r\n\r\n          /* look for the previous and next points that are not on the */\r\n          /* same Y coordinate, then threshold the `closeness'...      */\r\n          prev = best_point;\r\n          next = prev;\r\n\r\n          do\r\n          {\r\n            if ( prev > best_contour_first )\r\n              prev--;\r\n            else\r\n              prev = best_contour_last;\r\n\r\n            dist = FT_ABS( points[prev].y - best_y );\r\n            /* accept a small distance or a small angle (both values are */\r\n            /* heuristic; value 20 corresponds to approx. 2.9 degrees)   */\r\n            if ( dist > 5 )\r\n              if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )\r\n                break;\r\n\r\n            if ( FT_CURVE_TAG( outline.tags[prev] ) == FT_CURVE_TAG_ON )\r\n            {\r\n              best_on_point_first = prev;\r\n              if ( best_on_point_last < 0 )\r\n                best_on_point_last = prev;\r\n            }\r\n\r\n          } while ( prev != best_point );\r\n\r\n          do\r\n          {\r\n            if ( next < best_contour_last )\r\n              next++;\r\n            else\r\n              next = best_contour_first;\r\n\r\n            dist = FT_ABS( points[next].y - best_y );\r\n            if ( dist > 5 )\r\n              if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )\r\n                break;\r\n\r\n            if ( FT_CURVE_TAG( outline.tags[next] ) == FT_CURVE_TAG_ON )\r\n            {\r\n              best_on_point_last = next;\r\n              if ( best_on_point_first < 0 )\r\n                best_on_point_first = next;\r\n            }\r\n\r\n          } while ( next != best_point );\r\n\r\n          /* now set the `round' flag depending on the segment's kind */\r\n          /* (value 8 is heuristic)                                   */\r\n          if ( best_on_point_first >= 0                               &&\r\n               best_on_point_last >= 0                                &&\r\n               (FT_UInt)( FT_ABS( points[best_on_point_last].x -\r\n                                  points[best_on_point_first].x ) ) >\r\n                 metrics->units_per_em / 8                            )\r\n            round = 0;\r\n          else\r\n            round = FT_BOOL(\r\n              FT_CURVE_TAG( outline.tags[prev] ) != FT_CURVE_TAG_ON ||\r\n              FT_CURVE_TAG( outline.tags[next] ) != FT_CURVE_TAG_ON );\r\n\r\n          FT_TRACE5(( \" (%s)\\n\", round ? \"round\" : \"flat\" ));\r\n        }\r\n\r\n        if ( round )\r\n          rounds[num_rounds++] = best_y;\r\n        else\r\n          flats[num_flats++]   = best_y;\r\n      }\r\n\r\n      if ( num_flats == 0 && num_rounds == 0 )\r\n      {\r\n        /*\r\n         *  we couldn't find a single glyph to compute this blue zone,\r\n         *  we will simply ignore it then\r\n         */\r\n        FT_TRACE5(( \"  empty\\n\" ));\r\n        continue;\r\n      }\r\n\r\n      /* we have computed the contents of the `rounds' and `flats' tables, */\r\n      /* now determine the reference and overshoot position of the blue -- */\r\n      /* we simply take the median value after a simple sort               */\r\n      af_sort_pos( num_rounds, rounds );\r\n      af_sort_pos( num_flats,  flats );\r\n\r\n      blue       = &axis->blues[axis->blue_count];\r\n      blue_ref   = &blue->ref.org;\r\n      blue_shoot = &blue->shoot.org;\r\n\r\n      axis->blue_count++;\r\n\r\n      if ( num_flats == 0 )\r\n      {\r\n        *blue_ref   =\r\n        *blue_shoot = rounds[num_rounds / 2];\r\n      }\r\n      else if ( num_rounds == 0 )\r\n      {\r\n        *blue_ref   =\r\n        *blue_shoot = flats[num_flats / 2];\r\n      }\r\n      else\r\n      {\r\n        *blue_ref   = flats[num_flats / 2];\r\n        *blue_shoot = rounds[num_rounds / 2];\r\n      }\r\n\r\n      /* there are sometimes problems: if the overshoot position of top     */\r\n      /* zones is under its reference position, or the opposite for bottom  */\r\n      /* zones.  We must thus check everything there and correct the errors */\r\n      if ( *blue_shoot != *blue_ref )\r\n      {\r\n        FT_Pos   ref      = *blue_ref;\r\n        FT_Pos   shoot    = *blue_shoot;\r\n        FT_Bool  over_ref = FT_BOOL( shoot > ref );\r\n\r\n\r\n        if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref )\r\n        {\r\n          *blue_ref   =\r\n          *blue_shoot = ( shoot + ref ) / 2;\r\n\r\n          FT_TRACE5(( \"  [overshoot smaller than reference,\"\r\n                      \" taking mean value]\\n\" ));\r\n        }\r\n      }\r\n\r\n      blue->flags = 0;\r\n      if ( AF_LATIN_IS_TOP_BLUE( bb ) )\r\n        blue->flags |= AF_LATIN_BLUE_TOP;\r\n\r\n      /*\r\n       * The following flag is used later to adjust the y and x scales\r\n       * in order to optimize the pixel grid alignment of the top of small\r\n       * letters.\r\n       */\r\n      if ( bb == AF_LATIN_BLUE_SMALL_TOP )\r\n        blue->flags |= AF_LATIN_BLUE_ADJUSTMENT;\r\n\r\n      FT_TRACE5(( \"    -> reference = %ld\\n\"\r\n                  \"       overshoot = %ld\\n\",\r\n                  *blue_ref, *blue_shoot ));\r\n    }\r\n\r\n    FT_TRACE5(( \"\\n\" ));\r\n\r\n    return;\r\n  }\r\n\r\n\r\n  /* Check whether all ASCII digits have the same advance width. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin_metrics_check_digits( AF_LatinMetrics  metrics,\r\n                                 FT_Face          face )\r\n  {\r\n    FT_UInt   i;\r\n    FT_Bool   started = 0, same_width = 1;\r\n    FT_Fixed  advance, old_advance = 0;\r\n\r\n\r\n    /* digit `0' is 0x30 in all supported charmaps */\r\n    for ( i = 0x30; i <= 0x39; i++ )\r\n    {\r\n      FT_UInt  glyph_index;\r\n\r\n\r\n      glyph_index = FT_Get_Char_Index( face, i );\r\n      if ( glyph_index == 0 )\r\n        continue;\r\n\r\n      if ( FT_Get_Advance( face, glyph_index,\r\n                           FT_LOAD_NO_SCALE         |\r\n                           FT_LOAD_NO_HINTING       |\r\n                           FT_LOAD_IGNORE_TRANSFORM,\r\n                           &advance ) )\r\n        continue;\r\n\r\n      if ( started )\r\n      {\r\n        if ( advance != old_advance )\r\n        {\r\n          same_width = 0;\r\n          break;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        old_advance = advance;\r\n        started     = 1;\r\n      }\r\n    }\r\n\r\n    metrics->root.digits_have_same_width = same_width;\r\n  }\r\n\r\n\r\n  /* Initialize global metrics. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin_metrics_init( AF_LatinMetrics  metrics,\r\n                         FT_Face          face )\r\n  {\r\n    FT_CharMap  oldmap = face->charmap;\r\n\r\n\r\n    metrics->units_per_em = face->units_per_EM;\r\n\r\n    if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )\r\n    {\r\n      af_latin_metrics_init_widths( metrics, face );\r\n      af_latin_metrics_init_blues( metrics, face );\r\n      af_latin_metrics_check_digits( metrics, face );\r\n    }\r\n\r\n    FT_Set_Charmap( face, oldmap );\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  /* Adjust scaling value, then scale and shift widths   */\r\n  /* and blue zones (if applicable) for given dimension. */\r\n\r\n  static void\r\n  af_latin_metrics_scale_dim( AF_LatinMetrics  metrics,\r\n                              AF_Scaler        scaler,\r\n                              AF_Dimension     dim )\r\n  {\r\n    FT_Fixed      scale;\r\n    FT_Pos        delta;\r\n    AF_LatinAxis  axis;\r\n    FT_UInt       nn;\r\n\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      scale = scaler->x_scale;\r\n      delta = scaler->x_delta;\r\n    }\r\n    else\r\n    {\r\n      scale = scaler->y_scale;\r\n      delta = scaler->y_delta;\r\n    }\r\n\r\n    axis = &metrics->axis[dim];\r\n\r\n    if ( axis->org_scale == scale && axis->org_delta == delta )\r\n      return;\r\n\r\n    axis->org_scale = scale;\r\n    axis->org_delta = delta;\r\n\r\n    /*\r\n     * correct X and Y scale to optimize the alignment of the top of small\r\n     * letters to the pixel grid\r\n     */\r\n    {\r\n      AF_LatinAxis  Axis = &metrics->axis[AF_DIMENSION_VERT];\r\n      AF_LatinBlue  blue = NULL;\r\n\r\n\r\n      for ( nn = 0; nn < Axis->blue_count; nn++ )\r\n      {\r\n        if ( Axis->blues[nn].flags & AF_LATIN_BLUE_ADJUSTMENT )\r\n        {\r\n          blue = &Axis->blues[nn];\r\n          break;\r\n        }\r\n      }\r\n\r\n      if ( blue )\r\n      {\r\n        FT_Pos   scaled;\r\n        FT_Pos   threshold;\r\n        FT_Pos   fitted;\r\n        FT_UInt  limit;\r\n        FT_UInt  ppem;\r\n\r\n\r\n        scaled    = FT_MulFix( blue->shoot.org, scaler->y_scale );\r\n        ppem      = metrics->root.scaler.face->size->metrics.x_ppem;\r\n        limit     = metrics->root.globals->increase_x_height;\r\n        threshold = 40;\r\n\r\n        /* if the `increase-x-height' property is active, */\r\n        /* we round up much more often                    */\r\n        if ( limit                                 &&\r\n             ppem <= limit                         &&\r\n             ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN )\r\n          threshold = 52;\r\n\r\n        fitted = ( scaled + threshold ) & ~63;\r\n\r\n        if ( scaled != fitted )\r\n        {\r\n#if 0\r\n          if ( dim == AF_DIMENSION_HORZ )\r\n          {\r\n            if ( fitted < scaled )\r\n              scale -= scale / 50;  /* scale *= 0.98 */\r\n          }\r\n          else\r\n#endif\r\n          if ( dim == AF_DIMENSION_VERT )\r\n            scale = FT_MulDiv( scale, fitted, scaled );\r\n        }\r\n      }\r\n    }\r\n\r\n    axis->scale = scale;\r\n    axis->delta = delta;\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      metrics->root.scaler.x_scale = scale;\r\n      metrics->root.scaler.x_delta = delta;\r\n    }\r\n    else\r\n    {\r\n      metrics->root.scaler.y_scale = scale;\r\n      metrics->root.scaler.y_delta = delta;\r\n    }\r\n\r\n    /* scale the widths */\r\n    for ( nn = 0; nn < axis->width_count; nn++ )\r\n    {\r\n      AF_Width  width = axis->widths + nn;\r\n\r\n\r\n      width->cur = FT_MulFix( width->org, scale );\r\n      width->fit = width->cur;\r\n    }\r\n\r\n    /* an extra-light axis corresponds to a standard width that is */\r\n    /* smaller than 5/8 pixels                                     */\r\n    axis->extra_light =\r\n      (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 );\r\n\r\n    if ( dim == AF_DIMENSION_VERT )\r\n    {\r\n      /* scale the blue zones */\r\n      for ( nn = 0; nn < axis->blue_count; nn++ )\r\n      {\r\n        AF_LatinBlue  blue = &axis->blues[nn];\r\n        FT_Pos        dist;\r\n\r\n\r\n        blue->ref.cur   = FT_MulFix( blue->ref.org, scale ) + delta;\r\n        blue->ref.fit   = blue->ref.cur;\r\n        blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta;\r\n        blue->shoot.fit = blue->shoot.cur;\r\n        blue->flags    &= ~AF_LATIN_BLUE_ACTIVE;\r\n\r\n        /* a blue zone is only active if it is less than 3/4 pixels tall */\r\n        dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );\r\n        if ( dist <= 48 && dist >= -48 )\r\n        {\r\n#if 0\r\n          FT_Pos  delta1;\r\n#endif\r\n          FT_Pos  delta2;\r\n\r\n\r\n          /* use discrete values for blue zone widths */\r\n\r\n#if 0\r\n\r\n          /* generic, original code */\r\n          delta1 = blue->shoot.org - blue->ref.org;\r\n          delta2 = delta1;\r\n          if ( delta1 < 0 )\r\n            delta2 = -delta2;\r\n\r\n          delta2 = FT_MulFix( delta2, scale );\r\n\r\n          if ( delta2 < 32 )\r\n            delta2 = 0;\r\n          else if ( delta2 < 64 )\r\n            delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );\r\n          else\r\n            delta2 = FT_PIX_ROUND( delta2 );\r\n\r\n          if ( delta1 < 0 )\r\n            delta2 = -delta2;\r\n\r\n          blue->ref.fit   = FT_PIX_ROUND( blue->ref.cur );\r\n          blue->shoot.fit = blue->ref.fit + delta2;\r\n\r\n#else\r\n\r\n          /* simplified version due to abs(dist) <= 48 */\r\n          delta2 = dist;\r\n          if ( dist < 0 )\r\n            delta2 = -delta2;\r\n\r\n          if ( delta2 < 32 )\r\n            delta2 = 0;\r\n          else if ( delta < 48 )\r\n            delta2 = 32;\r\n          else\r\n            delta2 = 64;\r\n\r\n          if ( dist < 0 )\r\n            delta2 = -delta2;\r\n\r\n          blue->ref.fit   = FT_PIX_ROUND( blue->ref.cur );\r\n          blue->shoot.fit = blue->ref.fit - delta2;\r\n\r\n#endif\r\n\r\n          blue->flags |= AF_LATIN_BLUE_ACTIVE;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* Scale global values in both directions. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin_metrics_scale( AF_LatinMetrics  metrics,\r\n                          AF_Scaler        scaler )\r\n  {\r\n    metrics->root.scaler.render_mode = scaler->render_mode;\r\n    metrics->root.scaler.face        = scaler->face;\r\n    metrics->root.scaler.flags       = scaler->flags;\r\n\r\n    af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );\r\n    af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****           L A T I N   G L Y P H   A N A L Y S I S             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Walk over all contours and compute its segments. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin_hints_compute_segments( AF_GlyphHints  hints,\r\n                                   AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints   axis          = &hints->axis[dim];\r\n    FT_Memory      memory        = hints->memory;\r\n    FT_Error       error         = AF_Err_Ok;\r\n    AF_Segment     segment       = NULL;\r\n    AF_SegmentRec  seg0;\r\n    AF_Point*      contour       = hints->contours;\r\n    AF_Point*      contour_limit = contour + hints->num_contours;\r\n    AF_Direction   major_dir, segment_dir;\r\n\r\n\r\n    FT_ZERO( &seg0 );\r\n    seg0.score = 32000;\r\n    seg0.flags = AF_EDGE_NORMAL;\r\n\r\n    major_dir   = (AF_Direction)FT_ABS( axis->major_dir );\r\n    segment_dir = major_dir;\r\n\r\n    axis->num_segments = 0;\r\n\r\n    /* set up (u,v) in each point */\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      AF_Point  point = hints->points;\r\n      AF_Point  limit = point + hints->num_points;\r\n\r\n\r\n      for ( ; point < limit; point++ )\r\n      {\r\n        point->u = point->fx;\r\n        point->v = point->fy;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      AF_Point  point = hints->points;\r\n      AF_Point  limit = point + hints->num_points;\r\n\r\n\r\n      for ( ; point < limit; point++ )\r\n      {\r\n        point->u = point->fy;\r\n        point->v = point->fx;\r\n      }\r\n    }\r\n\r\n    /* do each contour separately */\r\n    for ( ; contour < contour_limit; contour++ )\r\n    {\r\n      AF_Point  point   =  contour[0];\r\n      AF_Point  last    =  point->prev;\r\n      int       on_edge =  0;\r\n      FT_Pos    min_pos =  32000;  /* minimum segment pos != min_coord */\r\n      FT_Pos    max_pos = -32000;  /* maximum segment pos != max_coord */\r\n      FT_Bool   passed;\r\n\r\n\r\n      if ( point == last )  /* skip singletons -- just in case */\r\n        continue;\r\n\r\n      if ( FT_ABS( last->out_dir )  == major_dir &&\r\n           FT_ABS( point->out_dir ) == major_dir )\r\n      {\r\n        /* we are already on an edge, try to locate its start */\r\n        last = point;\r\n\r\n        for (;;)\r\n        {\r\n          point = point->prev;\r\n          if ( FT_ABS( point->out_dir ) != major_dir )\r\n          {\r\n            point = point->next;\r\n            break;\r\n          }\r\n          if ( point == last )\r\n            break;\r\n        }\r\n      }\r\n\r\n      last   = point;\r\n      passed = 0;\r\n\r\n      for (;;)\r\n      {\r\n        FT_Pos  u, v;\r\n\r\n\r\n        if ( on_edge )\r\n        {\r\n          u = point->u;\r\n          if ( u < min_pos )\r\n            min_pos = u;\r\n          if ( u > max_pos )\r\n            max_pos = u;\r\n\r\n          if ( point->out_dir != segment_dir || point == last )\r\n          {\r\n            /* we are just leaving an edge; record a new segment! */\r\n            segment->last = point;\r\n            segment->pos  = (FT_Short)( ( min_pos + max_pos ) >> 1 );\r\n\r\n            /* a segment is round if either its first or last point */\r\n            /* is a control point                                   */\r\n            if ( ( segment->first->flags | point->flags ) &\r\n                 AF_FLAG_CONTROL                          )\r\n              segment->flags |= AF_EDGE_ROUND;\r\n\r\n            /* compute segment size */\r\n            min_pos = max_pos = point->v;\r\n\r\n            v = segment->first->v;\r\n            if ( v < min_pos )\r\n              min_pos = v;\r\n            if ( v > max_pos )\r\n              max_pos = v;\r\n\r\n            segment->min_coord = (FT_Short)min_pos;\r\n            segment->max_coord = (FT_Short)max_pos;\r\n            segment->height    = (FT_Short)( segment->max_coord -\r\n                                             segment->min_coord );\r\n\r\n            on_edge = 0;\r\n            segment = NULL;\r\n            /* fall through */\r\n          }\r\n        }\r\n\r\n        /* now exit if we are at the start/end point */\r\n        if ( point == last )\r\n        {\r\n          if ( passed )\r\n            break;\r\n          passed = 1;\r\n        }\r\n\r\n        if ( !on_edge && FT_ABS( point->out_dir ) == major_dir )\r\n        {\r\n          /* this is the start of a new segment! */\r\n          segment_dir = (AF_Direction)point->out_dir;\r\n\r\n          /* clear all segment fields */\r\n          error = af_axis_hints_new_segment( axis, memory, &segment );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          segment[0]        = seg0;\r\n          segment->dir      = (FT_Char)segment_dir;\r\n          min_pos = max_pos = point->u;\r\n          segment->first    = point;\r\n          segment->last     = point;\r\n          on_edge           = 1;\r\n        }\r\n\r\n        point = point->next;\r\n      }\r\n\r\n    } /* contours */\r\n\r\n\r\n    /* now slightly increase the height of segments if this makes */\r\n    /* sense -- this is used to better detect and ignore serifs   */\r\n    {\r\n      AF_Segment  segments     = axis->segments;\r\n      AF_Segment  segments_end = segments + axis->num_segments;\r\n\r\n\r\n      for ( segment = segments; segment < segments_end; segment++ )\r\n      {\r\n        AF_Point  first   = segment->first;\r\n        AF_Point  last    = segment->last;\r\n        FT_Pos    first_v = first->v;\r\n        FT_Pos    last_v  = last->v;\r\n\r\n\r\n        if ( first == last )\r\n          continue;\r\n\r\n        if ( first_v < last_v )\r\n        {\r\n          AF_Point  p;\r\n\r\n\r\n          p = first->prev;\r\n          if ( p->v < first_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( first_v - p->v ) >> 1 ) );\r\n\r\n          p = last->next;\r\n          if ( p->v > last_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( p->v - last_v ) >> 1 ) );\r\n        }\r\n        else\r\n        {\r\n          AF_Point  p;\r\n\r\n\r\n          p = first->prev;\r\n          if ( p->v > first_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( p->v - first_v ) >> 1 ) );\r\n\r\n          p = last->next;\r\n          if ( p->v < last_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( last_v - p->v ) >> 1 ) );\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Link segments to form stems and serifs. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin_hints_link_segments( AF_GlyphHints  hints,\r\n                                AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis          = &hints->axis[dim];\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    FT_Pos        len_threshold, len_score;\r\n    AF_Segment    seg1, seg2;\r\n\r\n\r\n    len_threshold = AF_LATIN_CONSTANT( hints->metrics, 8 );\r\n    if ( len_threshold == 0 )\r\n      len_threshold = 1;\r\n\r\n    len_score = AF_LATIN_CONSTANT( hints->metrics, 6000 );\r\n\r\n    /* now compare each segment to the others */\r\n    for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n    {\r\n      /* the fake segments are introduced to hint the metrics -- */\r\n      /* we must never link them to anything                     */\r\n      if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )\r\n        continue;\r\n\r\n      /* search for stems having opposite directions, */\r\n      /* with seg1 to the `left' of seg2              */\r\n      for ( seg2 = segments; seg2 < segment_limit; seg2++ )\r\n      {\r\n        FT_Pos  pos1 = seg1->pos;\r\n        FT_Pos  pos2 = seg2->pos;\r\n\r\n\r\n        if ( seg1->dir + seg2->dir == 0 && pos2 > pos1 )\r\n        {\r\n          /* compute distance between the two segments */\r\n          FT_Pos  dist = pos2 - pos1;\r\n          FT_Pos  min  = seg1->min_coord;\r\n          FT_Pos  max  = seg1->max_coord;\r\n          FT_Pos  len, score;\r\n\r\n\r\n          if ( min < seg2->min_coord )\r\n            min = seg2->min_coord;\r\n\r\n          if ( max > seg2->max_coord )\r\n            max = seg2->max_coord;\r\n\r\n          /* compute maximum coordinate difference of the two segments */\r\n          len = max - min;\r\n          if ( len >= len_threshold )\r\n          {\r\n            /* small coordinate differences cause a higher score, and     */\r\n            /* segments with a greater distance cause a higher score also */\r\n            score = dist + len_score / len;\r\n\r\n            /* and we search for the smallest score */\r\n            /* of the sum of the two values         */\r\n            if ( score < seg1->score )\r\n            {\r\n              seg1->score = score;\r\n              seg1->link  = seg2;\r\n            }\r\n\r\n            if ( score < seg2->score )\r\n            {\r\n              seg2->score = score;\r\n              seg2->link  = seg1;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    /* now compute the `serif' segments, cf. explanations in `afhints.h' */\r\n    for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n    {\r\n      seg2 = seg1->link;\r\n\r\n      if ( seg2 )\r\n      {\r\n        if ( seg2->link != seg1 )\r\n        {\r\n          seg1->link  = 0;\r\n          seg1->serif = seg2->link;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* Link segments to edges, using feature analysis for selection. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin_hints_compute_edges( AF_GlyphHints  hints,\r\n                                AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis   = &hints->axis[dim];\r\n    FT_Error      error  = AF_Err_Ok;\r\n    FT_Memory     memory = hints->memory;\r\n    AF_LatinAxis  laxis  = &((AF_LatinMetrics)hints->metrics)->axis[dim];\r\n\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    AF_Segment    seg;\r\n\r\n#if 0\r\n    AF_Direction  up_dir;\r\n#endif\r\n    FT_Fixed      scale;\r\n    FT_Pos        edge_distance_threshold;\r\n    FT_Pos        segment_length_threshold;\r\n\r\n\r\n    axis->num_edges = 0;\r\n\r\n    scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale\r\n                                         : hints->y_scale;\r\n\r\n#if 0\r\n    up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP\r\n                                          : AF_DIR_RIGHT;\r\n#endif\r\n\r\n    /*\r\n     *  We ignore all segments that are less than 1 pixel in length\r\n     *  to avoid many problems with serif fonts.  We compute the\r\n     *  corresponding threshold in font units.\r\n     */\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n        segment_length_threshold = FT_DivFix( 64, hints->y_scale );\r\n    else\r\n        segment_length_threshold = 0;\r\n\r\n    /*********************************************************************/\r\n    /*                                                                   */\r\n    /* We begin by generating a sorted table of edges for the current    */\r\n    /* direction.  To do so, we simply scan each segment and try to find */\r\n    /* an edge in our table that corresponds to its position.            */\r\n    /*                                                                   */\r\n    /* If no edge is found, we create and insert a new edge in the       */\r\n    /* sorted table.  Otherwise, we simply add the segment to the edge's */\r\n    /* list which gets processed in the second step to compute the       */\r\n    /* edge's properties.                                                */\r\n    /*                                                                   */\r\n    /* Note that the table of edges is sorted along the segment/edge     */\r\n    /* position.                                                         */\r\n    /*                                                                   */\r\n    /*********************************************************************/\r\n\r\n    /* assure that edge distance threshold is at most 0.25px */\r\n    edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold,\r\n                                         scale );\r\n    if ( edge_distance_threshold > 64 / 4 )\r\n      edge_distance_threshold = 64 / 4;\r\n\r\n    edge_distance_threshold = FT_DivFix( edge_distance_threshold,\r\n                                         scale );\r\n\r\n    for ( seg = segments; seg < segment_limit; seg++ )\r\n    {\r\n      AF_Edge  found = NULL;\r\n      FT_Int   ee;\r\n\r\n\r\n      if ( seg->height < segment_length_threshold )\r\n        continue;\r\n\r\n      /* A special case for serif edges: If they are smaller than */\r\n      /* 1.5 pixels we ignore them.                               */\r\n      if ( seg->serif                                     &&\r\n           2 * seg->height < 3 * segment_length_threshold )\r\n        continue;\r\n\r\n      /* look for an edge corresponding to the segment */\r\n      for ( ee = 0; ee < axis->num_edges; ee++ )\r\n      {\r\n        AF_Edge  edge = axis->edges + ee;\r\n        FT_Pos   dist;\r\n\r\n\r\n        dist = seg->pos - edge->fpos;\r\n        if ( dist < 0 )\r\n          dist = -dist;\r\n\r\n        if ( dist < edge_distance_threshold && edge->dir == seg->dir )\r\n        {\r\n          found = edge;\r\n          break;\r\n        }\r\n      }\r\n\r\n      if ( !found )\r\n      {\r\n        AF_Edge  edge;\r\n\r\n\r\n        /* insert a new edge in the list and */\r\n        /* sort according to the position    */\r\n        error = af_axis_hints_new_edge( axis, seg->pos,\r\n                                        (AF_Direction)seg->dir,\r\n                                        memory, &edge );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        /* add the segment to the new edge's list */\r\n        FT_ZERO( edge );\r\n\r\n        edge->first    = seg;\r\n        edge->last     = seg;\r\n        edge->dir      = seg->dir;\r\n        edge->fpos     = seg->pos;\r\n        edge->opos     = FT_MulFix( seg->pos, scale );\r\n        edge->pos      = edge->opos;\r\n        seg->edge_next = seg;\r\n      }\r\n      else\r\n      {\r\n        /* if an edge was found, simply add the segment to the edge's */\r\n        /* list                                                       */\r\n        seg->edge_next         = found->first;\r\n        found->last->edge_next = seg;\r\n        found->last            = seg;\r\n      }\r\n    }\r\n\r\n\r\n    /******************************************************************/\r\n    /*                                                                */\r\n    /* Good, we now compute each edge's properties according to the   */\r\n    /* segments found on its position.  Basically, these are          */\r\n    /*                                                                */\r\n    /*  - the edge's main direction                                   */\r\n    /*  - stem edge, serif edge or both (which defaults to stem then) */\r\n    /*  - rounded edge, straight or both (which defaults to straight) */\r\n    /*  - link for edge                                               */\r\n    /*                                                                */\r\n    /******************************************************************/\r\n\r\n    /* first of all, set the `edge' field in each segment -- this is */\r\n    /* required in order to compute edge links                       */\r\n\r\n    /*\r\n     * Note that removing this loop and setting the `edge' field of each\r\n     * segment directly in the code above slows down execution speed for\r\n     * some reasons on platforms like the Sun.\r\n     */\r\n    {\r\n      AF_Edge  edges      = axis->edges;\r\n      AF_Edge  edge_limit = edges + axis->num_edges;\r\n      AF_Edge  edge;\r\n\r\n\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        seg = edge->first;\r\n        if ( seg )\r\n          do\r\n          {\r\n            seg->edge = edge;\r\n            seg       = seg->edge_next;\r\n\r\n          } while ( seg != edge->first );\r\n      }\r\n\r\n      /* now compute each edge properties */\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        FT_Int  is_round    = 0;  /* does it contain round segments?    */\r\n        FT_Int  is_straight = 0;  /* does it contain straight segments? */\r\n#if 0\r\n        FT_Pos  ups         = 0;  /* number of upwards segments         */\r\n        FT_Pos  downs       = 0;  /* number of downwards segments       */\r\n#endif\r\n\r\n\r\n        seg = edge->first;\r\n\r\n        do\r\n        {\r\n          FT_Bool  is_serif;\r\n\r\n\r\n          /* check for roundness of segment */\r\n          if ( seg->flags & AF_EDGE_ROUND )\r\n            is_round++;\r\n          else\r\n            is_straight++;\r\n\r\n#if 0\r\n          /* check for segment direction */\r\n          if ( seg->dir == up_dir )\r\n            ups   += seg->max_coord - seg->min_coord;\r\n          else\r\n            downs += seg->max_coord - seg->min_coord;\r\n#endif\r\n\r\n          /* check for links -- if seg->serif is set, then seg->link must */\r\n          /* be ignored                                                   */\r\n          is_serif = (FT_Bool)( seg->serif               &&\r\n                                seg->serif->edge         &&\r\n                                seg->serif->edge != edge );\r\n\r\n          if ( ( seg->link && seg->link->edge != NULL ) || is_serif )\r\n          {\r\n            AF_Edge     edge2;\r\n            AF_Segment  seg2;\r\n\r\n\r\n            edge2 = edge->link;\r\n            seg2  = seg->link;\r\n\r\n            if ( is_serif )\r\n            {\r\n              seg2  = seg->serif;\r\n              edge2 = edge->serif;\r\n            }\r\n\r\n            if ( edge2 )\r\n            {\r\n              FT_Pos  edge_delta;\r\n              FT_Pos  seg_delta;\r\n\r\n\r\n              edge_delta = edge->fpos - edge2->fpos;\r\n              if ( edge_delta < 0 )\r\n                edge_delta = -edge_delta;\r\n\r\n              seg_delta = seg->pos - seg2->pos;\r\n              if ( seg_delta < 0 )\r\n                seg_delta = -seg_delta;\r\n\r\n              if ( seg_delta < edge_delta )\r\n                edge2 = seg2->edge;\r\n            }\r\n            else\r\n              edge2 = seg2->edge;\r\n\r\n            if ( is_serif )\r\n            {\r\n              edge->serif   = edge2;\r\n              edge2->flags |= AF_EDGE_SERIF;\r\n            }\r\n            else\r\n              edge->link  = edge2;\r\n          }\r\n\r\n          seg = seg->edge_next;\r\n\r\n        } while ( seg != edge->first );\r\n\r\n        /* set the round/straight flags */\r\n        edge->flags = AF_EDGE_NORMAL;\r\n\r\n        if ( is_round > 0 && is_round >= is_straight )\r\n          edge->flags |= AF_EDGE_ROUND;\r\n\r\n#if 0\r\n        /* set the edge's main direction */\r\n        edge->dir = AF_DIR_NONE;\r\n\r\n        if ( ups > downs )\r\n          edge->dir = (FT_Char)up_dir;\r\n\r\n        else if ( ups < downs )\r\n          edge->dir = (FT_Char)-up_dir;\r\n\r\n        else if ( ups == downs )\r\n          edge->dir = 0;  /* both up and down! */\r\n#endif\r\n\r\n        /* get rid of serifs if link is set                 */\r\n        /* XXX: This gets rid of many unpleasant artefacts! */\r\n        /*      Example: the `c' in cour.pfa at size 13     */\r\n\r\n        if ( edge->serif && edge->link )\r\n          edge->serif = 0;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Detect segments and edges for given dimension. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin_hints_detect_features( AF_GlyphHints  hints,\r\n                                  AF_Dimension   dim )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = af_latin_hints_compute_segments( hints, dim );\r\n    if ( !error )\r\n    {\r\n      af_latin_hints_link_segments( hints, dim );\r\n\r\n      error = af_latin_hints_compute_edges( hints, dim );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Compute all edges which lie within blue zones. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin_hints_compute_blue_edges( AF_GlyphHints    hints,\r\n                                     AF_LatinMetrics  metrics )\r\n  {\r\n    AF_AxisHints  axis       = &hints->axis[AF_DIMENSION_VERT];\r\n    AF_Edge       edge       = axis->edges;\r\n    AF_Edge       edge_limit = edge + axis->num_edges;\r\n    AF_LatinAxis  latin      = &metrics->axis[AF_DIMENSION_VERT];\r\n    FT_Fixed      scale      = latin->scale;\r\n\r\n\r\n    /* compute which blue zones are active, i.e. have their scaled */\r\n    /* size < 3/4 pixels                                           */\r\n\r\n    /* for each horizontal edge search the blue zone which is closest */\r\n    for ( ; edge < edge_limit; edge++ )\r\n    {\r\n      FT_UInt   bb;\r\n      AF_Width  best_blue = NULL;\r\n      FT_Pos    best_dist;  /* initial threshold */\r\n\r\n\r\n      /* compute the initial threshold as a fraction of the EM size */\r\n      /* (the value 40 is heuristic)                                */\r\n      best_dist = FT_MulFix( metrics->units_per_em / 40, scale );\r\n\r\n      /* assure a minimum distance of 0.5px */\r\n      if ( best_dist > 64 / 2 )\r\n        best_dist = 64 / 2;\r\n\r\n      for ( bb = 0; bb < latin->blue_count; bb++ )\r\n      {\r\n        AF_LatinBlue  blue = latin->blues + bb;\r\n        FT_Bool       is_top_blue, is_major_dir;\r\n\r\n\r\n        /* skip inactive blue zones (i.e., those that are too large) */\r\n        if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) )\r\n          continue;\r\n\r\n        /* if it is a top zone, check for right edges -- if it is a bottom */\r\n        /* zone, check for left edges                                      */\r\n        /*                                                                 */\r\n        /* of course, that's for TrueType                                  */\r\n        is_top_blue  = (FT_Byte)( ( blue->flags & AF_LATIN_BLUE_TOP ) != 0 );\r\n        is_major_dir = FT_BOOL( edge->dir == axis->major_dir );\r\n\r\n        /* if it is a top zone, the edge must be against the major    */\r\n        /* direction; if it is a bottom zone, it must be in the major */\r\n        /* direction                                                  */\r\n        if ( is_top_blue ^ is_major_dir )\r\n        {\r\n          FT_Pos  dist;\r\n\r\n\r\n          /* first of all, compare it to the reference position */\r\n          dist = edge->fpos - blue->ref.org;\r\n          if ( dist < 0 )\r\n            dist = -dist;\r\n\r\n          dist = FT_MulFix( dist, scale );\r\n          if ( dist < best_dist )\r\n          {\r\n            best_dist = dist;\r\n            best_blue = &blue->ref;\r\n          }\r\n\r\n          /* now compare it to the overshoot position and check whether */\r\n          /* the edge is rounded, and whether the edge is over the      */\r\n          /* reference position of a top zone, or under the reference   */\r\n          /* position of a bottom zone                                  */\r\n          if ( edge->flags & AF_EDGE_ROUND && dist != 0 )\r\n          {\r\n            FT_Bool  is_under_ref = FT_BOOL( edge->fpos < blue->ref.org );\r\n\r\n\r\n            if ( is_top_blue ^ is_under_ref )\r\n            {\r\n              dist = edge->fpos - blue->shoot.org;\r\n              if ( dist < 0 )\r\n                dist = -dist;\r\n\r\n              dist = FT_MulFix( dist, scale );\r\n              if ( dist < best_dist )\r\n              {\r\n                best_dist = dist;\r\n                best_blue = &blue->shoot;\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      if ( best_blue )\r\n        edge->blue_edge = best_blue;\r\n    }\r\n  }\r\n\r\n\r\n  /* Initalize hinting engine. */\r\n\r\n  static FT_Error\r\n  af_latin_hints_init( AF_GlyphHints    hints,\r\n                       AF_LatinMetrics  metrics )\r\n  {\r\n    FT_Render_Mode  mode;\r\n    FT_UInt32       scaler_flags, other_flags;\r\n    FT_Face         face = metrics->root.scaler.face;\r\n\r\n\r\n    af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics );\r\n\r\n    /*\r\n     *  correct x_scale and y_scale if needed, since they may have\r\n     *  been modified by `af_latin_metrics_scale_dim' above\r\n     */\r\n    hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale;\r\n    hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta;\r\n    hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale;\r\n    hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta;\r\n\r\n    /* compute flags depending on render mode, etc. */\r\n    mode = metrics->root.scaler.render_mode;\r\n\r\n#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */\r\n    if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )\r\n      metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;\r\n#endif\r\n\r\n    scaler_flags = hints->scaler_flags;\r\n    other_flags  = 0;\r\n\r\n    /*\r\n     *  We snap the width of vertical stems for the monochrome and\r\n     *  horizontal LCD rendering targets only.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )\r\n      other_flags |= AF_LATIN_HINTS_HORZ_SNAP;\r\n\r\n    /*\r\n     *  We snap the width of horizontal stems for the monochrome and\r\n     *  vertical LCD rendering targets only.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )\r\n      other_flags |= AF_LATIN_HINTS_VERT_SNAP;\r\n\r\n    /*\r\n     *  We adjust stems to full pixels only if we don't use the `light' mode.\r\n     */\r\n    if ( mode != FT_RENDER_MODE_LIGHT )\r\n      other_flags |= AF_LATIN_HINTS_STEM_ADJUST;\r\n\r\n    if ( mode == FT_RENDER_MODE_MONO )\r\n      other_flags |= AF_LATIN_HINTS_MONO;\r\n\r\n    /*\r\n     *  In `light' hinting mode we disable horizontal hinting completely.\r\n     *  We also do it if the face is italic.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_LIGHT                      ||\r\n         ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )\r\n      scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;\r\n\r\n    hints->scaler_flags = scaler_flags;\r\n    hints->other_flags  = other_flags;\r\n\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****        L A T I N   G L Y P H   G R I D - F I T T I N G        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* Snap a given width in scaled coordinates to one of the */\r\n  /* current standard widths.                               */\r\n\r\n  static FT_Pos\r\n  af_latin_snap_width( AF_Width  widths,\r\n                       FT_Int    count,\r\n                       FT_Pos    width )\r\n  {\r\n    int     n;\r\n    FT_Pos  best      = 64 + 32 + 2;\r\n    FT_Pos  reference = width;\r\n    FT_Pos  scaled;\r\n\r\n\r\n    for ( n = 0; n < count; n++ )\r\n    {\r\n      FT_Pos  w;\r\n      FT_Pos  dist;\r\n\r\n\r\n      w = widths[n].cur;\r\n      dist = width - w;\r\n      if ( dist < 0 )\r\n        dist = -dist;\r\n      if ( dist < best )\r\n      {\r\n        best      = dist;\r\n        reference = w;\r\n      }\r\n    }\r\n\r\n    scaled = FT_PIX_ROUND( reference );\r\n\r\n    if ( width >= reference )\r\n    {\r\n      if ( width < scaled + 48 )\r\n        width = reference;\r\n    }\r\n    else\r\n    {\r\n      if ( width > scaled - 48 )\r\n        width = reference;\r\n    }\r\n\r\n    return width;\r\n  }\r\n\r\n\r\n  /* Compute the snapped width of a given stem, ignoring very thin ones. */\r\n  /* There is a lot of voodoo in this function; changing the hard-coded  */\r\n  /* parameters influence the whole hinting process.                     */\r\n\r\n  static FT_Pos\r\n  af_latin_compute_stem_width( AF_GlyphHints  hints,\r\n                               AF_Dimension   dim,\r\n                               FT_Pos         width,\r\n                               AF_Edge_Flags  base_flags,\r\n                               AF_Edge_Flags  stem_flags )\r\n  {\r\n    AF_LatinMetrics  metrics  = (AF_LatinMetrics) hints->metrics;\r\n    AF_LatinAxis     axis     = & metrics->axis[dim];\r\n    FT_Pos           dist     = width;\r\n    FT_Int           sign     = 0;\r\n    FT_Int           vertical = ( dim == AF_DIMENSION_VERT );\r\n\r\n\r\n    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) ||\r\n         axis->extra_light                       )\r\n      return width;\r\n\r\n    if ( dist < 0 )\r\n    {\r\n      dist = -width;\r\n      sign = 1;\r\n    }\r\n\r\n    if ( (  vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||\r\n         ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )\r\n    {\r\n      /* smooth hinting process: very lightly quantize the stem width */\r\n\r\n      /* leave the widths of serifs alone */\r\n      if ( ( stem_flags & AF_EDGE_SERIF ) &&\r\n           vertical                       &&\r\n           ( dist < 3 * 64 )              )\r\n        goto Done_Width;\r\n\r\n      else if ( base_flags & AF_EDGE_ROUND )\r\n      {\r\n        if ( dist < 80 )\r\n          dist = 64;\r\n      }\r\n      else if ( dist < 56 )\r\n        dist = 56;\r\n\r\n      if ( axis->width_count > 0 )\r\n      {\r\n        FT_Pos  delta;\r\n\r\n\r\n        /* compare to standard width */\r\n        delta = dist - axis->widths[0].cur;\r\n\r\n        if ( delta < 0 )\r\n          delta = -delta;\r\n\r\n        if ( delta < 40 )\r\n        {\r\n          dist = axis->widths[0].cur;\r\n          if ( dist < 48 )\r\n            dist = 48;\r\n\r\n          goto Done_Width;\r\n        }\r\n\r\n        if ( dist < 3 * 64 )\r\n        {\r\n          delta  = dist & 63;\r\n          dist  &= -64;\r\n\r\n          if ( delta < 10 )\r\n            dist += delta;\r\n\r\n          else if ( delta < 32 )\r\n            dist += 10;\r\n\r\n          else if ( delta < 54 )\r\n            dist += 54;\r\n\r\n          else\r\n            dist += delta;\r\n        }\r\n        else\r\n          dist = ( dist + 32 ) & ~63;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* strong hinting process: snap the stem width to integer pixels */\r\n\r\n      FT_Pos  org_dist = dist;\r\n\r\n\r\n      dist = af_latin_snap_width( axis->widths, axis->width_count, dist );\r\n\r\n      if ( vertical )\r\n      {\r\n        /* in the case of vertical hinting, always round */\r\n        /* the stem heights to integer pixels            */\r\n\r\n        if ( dist >= 64 )\r\n          dist = ( dist + 16 ) & ~63;\r\n        else\r\n          dist = 64;\r\n      }\r\n      else\r\n      {\r\n        if ( AF_LATIN_HINTS_DO_MONO( hints ) )\r\n        {\r\n          /* monochrome horizontal hinting: snap widths to integer pixels */\r\n          /* with a different threshold                                   */\r\n\r\n          if ( dist < 64 )\r\n            dist = 64;\r\n          else\r\n            dist = ( dist + 32 ) & ~63;\r\n        }\r\n        else\r\n        {\r\n          /* for horizontal anti-aliased hinting, we adopt a more subtle */\r\n          /* approach: we strengthen small stems, round stems whose size */\r\n          /* is between 1 and 2 pixels to an integer, otherwise nothing  */\r\n\r\n          if ( dist < 48 )\r\n            dist = ( dist + 64 ) >> 1;\r\n\r\n          else if ( dist < 128 )\r\n          {\r\n            /* We only round to an integer width if the corresponding */\r\n            /* distortion is less than 1/4 pixel.  Otherwise this     */\r\n            /* makes everything worse since the diagonals, which are  */\r\n            /* not hinted, appear a lot bolder or thinner than the    */\r\n            /* vertical stems.                                        */\r\n\r\n            FT_Pos  delta;\r\n\r\n\r\n            dist = ( dist + 22 ) & ~63;\r\n            delta = dist - org_dist;\r\n            if ( delta < 0 )\r\n              delta = -delta;\r\n\r\n            if (delta >= 16)\r\n            {\r\n              dist = org_dist;\r\n              if ( dist < 48 )\r\n                dist = ( dist + 64 ) >> 1;\r\n            }\r\n          }\r\n          else\r\n            /* round otherwise to prevent color fringes in LCD mode */\r\n            dist = ( dist + 32 ) & ~63;\r\n        }\r\n      }\r\n    }\r\n\r\n  Done_Width:\r\n    if ( sign )\r\n      dist = -dist;\r\n\r\n    return dist;\r\n  }\r\n\r\n\r\n  /* Align one stem edge relative to the previous stem edge. */\r\n\r\n  static void\r\n  af_latin_align_linked_edge( AF_GlyphHints  hints,\r\n                              AF_Dimension   dim,\r\n                              AF_Edge        base_edge,\r\n                              AF_Edge        stem_edge )\r\n  {\r\n    FT_Pos  dist = stem_edge->opos - base_edge->opos;\r\n\r\n    FT_Pos  fitted_width = af_latin_compute_stem_width(\r\n                             hints, dim, dist,\r\n                             (AF_Edge_Flags)base_edge->flags,\r\n                             (AF_Edge_Flags)stem_edge->flags );\r\n\r\n\r\n    stem_edge->pos = base_edge->pos + fitted_width;\r\n\r\n    FT_TRACE5(( \"  LINK: edge %d (opos=%.2f) linked to %.2f,\"\r\n                \" dist was %.2f, now %.2f\\n\",\r\n                stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0,\r\n                stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));\r\n  }\r\n\r\n\r\n  /* Shift the coordinates of the `serif' edge by the same amount */\r\n  /* as the corresponding `base' edge has been moved already.     */\r\n\r\n  static void\r\n  af_latin_align_serif_edge( AF_GlyphHints  hints,\r\n                             AF_Edge        base,\r\n                             AF_Edge        serif )\r\n  {\r\n    FT_UNUSED( hints );\r\n\r\n    serif->pos = base->pos + ( serif->opos - base->opos );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                    E D G E   H I N T I N G                      ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* The main grid-fitting routine. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin_hint_edges( AF_GlyphHints  hints,\r\n                       AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis       = &hints->axis[dim];\r\n    AF_Edge       edges      = axis->edges;\r\n    AF_Edge       edge_limit = edges + axis->num_edges;\r\n    FT_PtrDist    n_edges;\r\n    AF_Edge       edge;\r\n    AF_Edge       anchor     = NULL;\r\n    FT_Int        has_serifs = 0;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_UInt       num_actions = 0;\r\n#endif\r\n\r\n\r\n    FT_TRACE5(( \"%s edge hinting\\n\",\r\n                dim == AF_DIMENSION_VERT ? \"horizontal\" : \"vertical\" ));\r\n\r\n    /* we begin by aligning all stems relative to the blue zone */\r\n    /* if needed -- that's only for horizontal edges            */\r\n\r\n    if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES( hints ) )\r\n    {\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        AF_Width  blue;\r\n        AF_Edge   edge1, edge2; /* these edges form the stem to check */\r\n\r\n\r\n        if ( edge->flags & AF_EDGE_DONE )\r\n          continue;\r\n\r\n        blue  = edge->blue_edge;\r\n        edge1 = NULL;\r\n        edge2 = edge->link;\r\n\r\n        if ( blue )\r\n          edge1 = edge;\r\n\r\n        /* flip edges if the other stem is aligned to a blue zone */\r\n        else if ( edge2 && edge2->blue_edge )\r\n        {\r\n          blue  = edge2->blue_edge;\r\n          edge1 = edge2;\r\n          edge2 = edge;\r\n        }\r\n\r\n        if ( !edge1 )\r\n          continue;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        if (!anchor)\r\n          FT_TRACE5(( \"  BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f,\"\r\n                      \" was %.2f (anchor=edge %d)\\n\",\r\n                      edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,\r\n                      edge1->pos / 64.0, edge - edges ));\r\n        else\r\n          FT_TRACE5(( \"  BLUE: edge %d (opos=%.2f) snapped to %.2f,\"\r\n                      \" was %.2f\\n\",\r\n                      edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,\r\n                      edge1->pos / 64.0 ));\r\n\r\n        num_actions++;\r\n#endif\r\n\r\n        edge1->pos    = blue->fit;\r\n        edge1->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge2 && !edge2->blue_edge )\r\n        {\r\n          af_latin_align_linked_edge( hints, dim, edge1, edge2 );\r\n          edge2->flags |= AF_EDGE_DONE;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n          num_actions++;\r\n#endif\r\n        }\r\n\r\n        if ( !anchor )\r\n          anchor = edge;\r\n      }\r\n    }\r\n\r\n    /* now we align all other stem edges, trying to maintain the */\r\n    /* relative order of stems in the glyph                      */\r\n    for ( edge = edges; edge < edge_limit; edge++ )\r\n    {\r\n      AF_Edge  edge2;\r\n\r\n\r\n      if ( edge->flags & AF_EDGE_DONE )\r\n        continue;\r\n\r\n      /* skip all non-stem edges */\r\n      edge2 = edge->link;\r\n      if ( !edge2 )\r\n      {\r\n        has_serifs++;\r\n        continue;\r\n      }\r\n\r\n      /* now align the stem */\r\n\r\n      /* this should not happen, but it's better to be safe */\r\n      if ( edge2->blue_edge )\r\n      {\r\n        FT_TRACE5(( \"  ASSERTION FAILED for edge %d\\n\", edge2-edges ));\r\n\r\n        af_latin_align_linked_edge( hints, dim, edge2, edge );\r\n        edge->flags |= AF_EDGE_DONE;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        num_actions++;\r\n#endif\r\n        continue;\r\n      }\r\n\r\n      if ( !anchor )\r\n      {\r\n        /* if we reach this if clause, no stem has been aligned yet */\r\n\r\n        FT_Pos  org_len, org_center, cur_len;\r\n        FT_Pos  cur_pos1, error1, error2, u_off, d_off;\r\n\r\n\r\n        org_len = edge2->opos - edge->opos;\r\n        cur_len = af_latin_compute_stem_width(\r\n                    hints, dim, org_len,\r\n                    (AF_Edge_Flags)edge->flags,\r\n                    (AF_Edge_Flags)edge2->flags );\r\n\r\n        /* some voodoo to specially round edges for small stem widths; */\r\n        /* the idea is to align the center of a stem, then shifting    */\r\n        /* the stem edges to suitable positions                        */\r\n        if ( cur_len <= 64 )\r\n        {\r\n          /* width <= 1px */\r\n          u_off = 32;\r\n          d_off = 32;\r\n        }\r\n        else\r\n        {\r\n          /* 1px < width < 1.5px */\r\n          u_off = 38;\r\n          d_off = 26;\r\n        }\r\n\r\n        if ( cur_len < 96 )\r\n        {\r\n          org_center = edge->opos + ( org_len >> 1 );\r\n          cur_pos1   = FT_PIX_ROUND( org_center );\r\n\r\n          error1 = org_center - ( cur_pos1 - u_off );\r\n          if ( error1 < 0 )\r\n            error1 = -error1;\r\n\r\n          error2 = org_center - ( cur_pos1 + d_off );\r\n          if ( error2 < 0 )\r\n            error2 = -error2;\r\n\r\n          if ( error1 < error2 )\r\n            cur_pos1 -= u_off;\r\n          else\r\n            cur_pos1 += d_off;\r\n\r\n          edge->pos  = cur_pos1 - cur_len / 2;\r\n          edge2->pos = edge->pos + cur_len;\r\n        }\r\n        else\r\n          edge->pos = FT_PIX_ROUND( edge->opos );\r\n\r\n        anchor       = edge;\r\n        edge->flags |= AF_EDGE_DONE;\r\n\r\n        FT_TRACE5(( \"  ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)\"\r\n                    \" snapped to %.2f and %.2f\\n\",\r\n                    edge - edges, edge->opos / 64.0,\r\n                    edge2 - edges, edge2->opos / 64.0,\r\n                    edge->pos / 64.0, edge2->pos / 64.0 ));\r\n\r\n        af_latin_align_linked_edge( hints, dim, edge, edge2 );\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        num_actions += 2;\r\n#endif\r\n      }\r\n      else\r\n      {\r\n        FT_Pos  org_pos, org_len, org_center, cur_len;\r\n        FT_Pos  cur_pos1, cur_pos2, delta1, delta2;\r\n\r\n\r\n        org_pos    = anchor->pos + ( edge->opos - anchor->opos );\r\n        org_len    = edge2->opos - edge->opos;\r\n        org_center = org_pos + ( org_len >> 1 );\r\n\r\n        cur_len = af_latin_compute_stem_width(\r\n                    hints, dim, org_len,\r\n                    (AF_Edge_Flags)edge->flags,\r\n                    (AF_Edge_Flags)edge2->flags );\r\n\r\n        if ( edge2->flags & AF_EDGE_DONE )\r\n        {\r\n          FT_TRACE5(( \"  ADJUST: edge %d (pos=%.2f) moved to %.2f\\n\",\r\n                      edge - edges, edge->pos / 64.0,\r\n                      ( edge2->pos - cur_len ) / 64.0 ));\r\n\r\n          edge->pos = edge2->pos - cur_len;\r\n        }\r\n\r\n        else if ( cur_len < 96 )\r\n        {\r\n          FT_Pos  u_off, d_off;\r\n\r\n\r\n          cur_pos1 = FT_PIX_ROUND( org_center );\r\n\r\n          if (cur_len <= 64 )\r\n          {\r\n            u_off = 32;\r\n            d_off = 32;\r\n          }\r\n          else\r\n          {\r\n            u_off = 38;\r\n            d_off = 26;\r\n          }\r\n\r\n          delta1 = org_center - ( cur_pos1 - u_off );\r\n          if ( delta1 < 0 )\r\n            delta1 = -delta1;\r\n\r\n          delta2 = org_center - ( cur_pos1 + d_off );\r\n          if ( delta2 < 0 )\r\n            delta2 = -delta2;\r\n\r\n          if ( delta1 < delta2 )\r\n            cur_pos1 -= u_off;\r\n          else\r\n            cur_pos1 += d_off;\r\n\r\n          edge->pos  = cur_pos1 - cur_len / 2;\r\n          edge2->pos = cur_pos1 + cur_len / 2;\r\n\r\n          FT_TRACE5(( \"  STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)\"\r\n                      \" snapped to %.2f and %.2f\\n\",\r\n                      edge - edges, edge->opos / 64.0,\r\n                      edge2 - edges, edge2->opos / 64.0,\r\n                      edge->pos / 64.0, edge2->pos / 64.0 ));\r\n        }\r\n\r\n        else\r\n        {\r\n          org_pos    = anchor->pos + ( edge->opos - anchor->opos );\r\n          org_len    = edge2->opos - edge->opos;\r\n          org_center = org_pos + ( org_len >> 1 );\r\n\r\n          cur_len    = af_latin_compute_stem_width(\r\n                         hints, dim, org_len,\r\n                         (AF_Edge_Flags)edge->flags,\r\n                         (AF_Edge_Flags)edge2->flags );\r\n\r\n          cur_pos1 = FT_PIX_ROUND( org_pos );\r\n          delta1   = cur_pos1 + ( cur_len >> 1 ) - org_center;\r\n          if ( delta1 < 0 )\r\n            delta1 = -delta1;\r\n\r\n          cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len;\r\n          delta2   = cur_pos2 + ( cur_len >> 1 ) - org_center;\r\n          if ( delta2 < 0 )\r\n            delta2 = -delta2;\r\n\r\n          edge->pos  = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;\r\n          edge2->pos = edge->pos + cur_len;\r\n\r\n          FT_TRACE5(( \"  STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)\"\r\n                      \" snapped to %.2f and %.2f\\n\",\r\n                      edge - edges, edge->opos / 64.0,\r\n                      edge2 - edges, edge2->opos / 64.0,\r\n                      edge->pos / 64.0, edge2->pos / 64.0 ));\r\n        }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        num_actions++;\r\n#endif\r\n\r\n        edge->flags  |= AF_EDGE_DONE;\r\n        edge2->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge > edges && edge->pos < edge[-1].pos )\r\n        {\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n          FT_TRACE5(( \"  BOUND: edge %d (pos=%.2f) moved to %.2f\\n\",\r\n                      edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));\r\n\r\n          num_actions++;\r\n#endif\r\n\r\n          edge->pos = edge[-1].pos;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* make sure that lowercase m's maintain their symmetry */\r\n\r\n    /* In general, lowercase m's have six vertical edges if they are sans */\r\n    /* serif, or twelve if they are with serifs.  This implementation is  */\r\n    /* based on that assumption, and seems to work very well with most    */\r\n    /* faces.  However, if for a certain face this assumption is not      */\r\n    /* true, the m is just rendered like before.  In addition, any stem   */\r\n    /* correction will only be applied to symmetrical glyphs (even if the */\r\n    /* glyph is not an m), so the potential for unwanted distortion is    */\r\n    /* relatively low.                                                    */\r\n\r\n    /* We don't handle horizontal edges since we can't easily assure that */\r\n    /* the third (lowest) stem aligns with the base line; it might end up */\r\n    /* one pixel higher or lower.                                         */\r\n\r\n    n_edges = edge_limit - edges;\r\n    if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) )\r\n    {\r\n      AF_Edge  edge1, edge2, edge3;\r\n      FT_Pos   dist1, dist2, span, delta;\r\n\r\n\r\n      if ( n_edges == 6 )\r\n      {\r\n        edge1 = edges;\r\n        edge2 = edges + 2;\r\n        edge3 = edges + 4;\r\n      }\r\n      else\r\n      {\r\n        edge1 = edges + 1;\r\n        edge2 = edges + 5;\r\n        edge3 = edges + 9;\r\n      }\r\n\r\n      dist1 = edge2->opos - edge1->opos;\r\n      dist2 = edge3->opos - edge2->opos;\r\n\r\n      span = dist1 - dist2;\r\n      if ( span < 0 )\r\n        span = -span;\r\n\r\n      if ( span < 8 )\r\n      {\r\n        delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );\r\n        edge3->pos -= delta;\r\n        if ( edge3->link )\r\n          edge3->link->pos -= delta;\r\n\r\n        /* move the serifs along with the stem */\r\n        if ( n_edges == 12 )\r\n        {\r\n          ( edges + 8 )->pos -= delta;\r\n          ( edges + 11 )->pos -= delta;\r\n        }\r\n\r\n        edge3->flags |= AF_EDGE_DONE;\r\n        if ( edge3->link )\r\n          edge3->link->flags |= AF_EDGE_DONE;\r\n      }\r\n    }\r\n\r\n    if ( has_serifs || !anchor )\r\n    {\r\n      /*\r\n       *  now hint the remaining edges (serifs and single) in order\r\n       *  to complete our processing\r\n       */\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        FT_Pos  delta;\r\n\r\n\r\n        if ( edge->flags & AF_EDGE_DONE )\r\n          continue;\r\n\r\n        delta = 1000;\r\n\r\n        if ( edge->serif )\r\n        {\r\n          delta = edge->serif->opos - edge->opos;\r\n          if ( delta < 0 )\r\n            delta = -delta;\r\n        }\r\n\r\n        if ( delta < 64 + 16 )\r\n        {\r\n          af_latin_align_serif_edge( hints, edge->serif, edge );\r\n          FT_TRACE5(( \"  SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)\"\r\n                      \" aligned to %.2f\\n\",\r\n                      edge - edges, edge->opos / 64.0,\r\n                      edge->serif - edges, edge->serif->opos / 64.0,\r\n                      edge->pos / 64.0 ));\r\n        }\r\n        else if ( !anchor )\r\n        {\r\n          edge->pos = FT_PIX_ROUND( edge->opos );\r\n          anchor    = edge;\r\n          FT_TRACE5(( \"  SERIF_ANCHOR: edge %d (opos=%.2f)\"\r\n                      \" snapped to %.2f\\n\",\r\n                      edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));\r\n        }\r\n        else\r\n        {\r\n          AF_Edge  before, after;\r\n\r\n\r\n          for ( before = edge - 1; before >= edges; before-- )\r\n            if ( before->flags & AF_EDGE_DONE )\r\n              break;\r\n\r\n          for ( after = edge + 1; after < edge_limit; after++ )\r\n            if ( after->flags & AF_EDGE_DONE )\r\n              break;\r\n\r\n          if ( before >= edges && before < edge   &&\r\n               after < edge_limit && after > edge )\r\n          {\r\n            if ( after->opos == before->opos )\r\n              edge->pos = before->pos;\r\n            else\r\n              edge->pos = before->pos +\r\n                          FT_MulDiv( edge->opos - before->opos,\r\n                                     after->pos - before->pos,\r\n                                     after->opos - before->opos );\r\n\r\n            FT_TRACE5(( \"  SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f\"\r\n                        \" from %d (opos=%.2f)\\n\",\r\n                        edge - edges, edge->opos / 64.0,\r\n                        edge->pos / 64.0,\r\n                        before - edges, before->opos / 64.0 ));\r\n          }\r\n          else\r\n          {\r\n            edge->pos = anchor->pos +\r\n                        ( ( edge->opos - anchor->opos + 16 ) & ~31 );\r\n            FT_TRACE5(( \"  SERIF_LINK2: edge %d (opos=%.2f)\"\r\n                        \" snapped to %.2f\\n\",\r\n                        edge - edges, edge->opos / 64.0, edge->pos / 64.0 ));\r\n          }\r\n        }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        num_actions++;\r\n#endif\r\n        edge->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge > edges && edge->pos < edge[-1].pos )\r\n        {\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n          FT_TRACE5(( \"  BOUND: edge %d (pos=%.2f) moved to %.2f\\n\",\r\n                      edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));\r\n\r\n          num_actions++;\r\n#endif\r\n          edge->pos = edge[-1].pos;\r\n        }\r\n\r\n        if ( edge + 1 < edge_limit        &&\r\n             edge[1].flags & AF_EDGE_DONE &&\r\n             edge->pos > edge[1].pos      )\r\n        {\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n          FT_TRACE5(( \"  BOUND: edge %d (pos=%.2f) moved to %.2f\\n\",\r\n                      edge - edges, edge->pos / 64.0, edge[1].pos / 64.0 ));\r\n\r\n          num_actions++;\r\n#endif\r\n\r\n          edge->pos = edge[1].pos;\r\n        }\r\n      }\r\n    }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    if ( !num_actions )\r\n      FT_TRACE5(( \"  (none)\\n\" ));\r\n    FT_TRACE5(( \"\\n\" ));\r\n#endif\r\n  }\r\n\r\n\r\n  /* Apply the complete hinting algorithm to a latin glyph. */\r\n\r\n  static FT_Error\r\n  af_latin_hints_apply( AF_GlyphHints    hints,\r\n                        FT_Outline*      outline,\r\n                        AF_LatinMetrics  metrics )\r\n  {\r\n    FT_Error  error;\r\n    int       dim;\r\n\r\n\r\n    error = af_glyph_hints_reload( hints, outline );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* analyze glyph outline */\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n    if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||\r\n         AF_HINTS_DO_HORIZONTAL( hints )                          )\r\n#else\r\n    if ( AF_HINTS_DO_HORIZONTAL( hints ) )\r\n#endif\r\n    {\r\n      error = af_latin_hints_detect_features( hints, AF_DIMENSION_HORZ );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( AF_HINTS_DO_VERTICAL( hints ) )\r\n    {\r\n      error = af_latin_hints_detect_features( hints, AF_DIMENSION_VERT );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      af_latin_hints_compute_blue_edges( hints, metrics );\r\n    }\r\n\r\n    /* grid-fit the outline */\r\n    for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n    {\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n      if ( dim == AF_DIMENSION_HORZ                                 &&\r\n           metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT )\r\n      {\r\n        AF_WarperRec  warper;\r\n        FT_Fixed      scale;\r\n        FT_Pos        delta;\r\n\r\n\r\n        af_warper_compute( &warper, hints, (AF_Dimension)dim,\r\n                           &scale, &delta );\r\n        af_glyph_hints_scale_dim( hints, (AF_Dimension)dim,\r\n                                  scale, delta );\r\n        continue;\r\n      }\r\n#endif\r\n\r\n      if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||\r\n           ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) )   )\r\n      {\r\n        af_latin_hint_edges( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim );\r\n      }\r\n    }\r\n    af_glyph_hints_save( hints, outline );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****              L A T I N   S C R I P T   C L A S S              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* XXX: this should probably fine tuned to differentiate better between */\r\n  /*      scripts...                                                      */\r\n\r\n  static const AF_Script_UniRangeRec  af_latin_uniranges[] =\r\n  {\r\n    AF_UNIRANGE_REC(  0x0020UL,  0x007FUL ),  /* Basic Latin (no control chars) */\r\n    AF_UNIRANGE_REC(  0x00A0UL,  0x00FFUL ),  /* Latin-1 Supplement (no control chars) */\r\n    AF_UNIRANGE_REC(  0x0100UL,  0x017FUL ),  /* Latin Extended-A */\r\n    AF_UNIRANGE_REC(  0x0180UL,  0x024FUL ),  /* Latin Extended-B */\r\n    AF_UNIRANGE_REC(  0x0250UL,  0x02AFUL ),  /* IPA Extensions */\r\n    AF_UNIRANGE_REC(  0x02B0UL,  0x02FFUL ),  /* Spacing Modifier Letters */\r\n    AF_UNIRANGE_REC(  0x0300UL,  0x036FUL ),  /* Combining Diacritical Marks */\r\n    AF_UNIRANGE_REC(  0x0370UL,  0x03FFUL ),  /* Greek and Coptic */\r\n    AF_UNIRANGE_REC(  0x0400UL,  0x04FFUL ),  /* Cyrillic */\r\n    AF_UNIRANGE_REC(  0x0500UL,  0x052FUL ),  /* Cyrillic Supplement */\r\n    AF_UNIRANGE_REC(  0x1D00UL,  0x1D7FUL ),  /* Phonetic Extensions */\r\n    AF_UNIRANGE_REC(  0x1D80UL,  0x1DBFUL ),  /* Phonetic Extensions Supplement */\r\n    AF_UNIRANGE_REC(  0x1DC0UL,  0x1DFFUL ),  /* Combining Diacritical Marks Supplement */\r\n    AF_UNIRANGE_REC(  0x1E00UL,  0x1EFFUL ),  /* Latin Extended Additional */\r\n    AF_UNIRANGE_REC(  0x1F00UL,  0x1FFFUL ),  /* Greek Extended */\r\n    AF_UNIRANGE_REC(  0x2000UL,  0x206FUL ),  /* General Punctuation */\r\n    AF_UNIRANGE_REC(  0x2070UL,  0x209FUL ),  /* Superscripts and Subscripts */\r\n    AF_UNIRANGE_REC(  0x20A0UL,  0x20CFUL ),  /* Currency Symbols */\r\n    AF_UNIRANGE_REC(  0x2150UL,  0x218FUL ),  /* Number Forms */\r\n    AF_UNIRANGE_REC(  0x2460UL,  0x24FFUL ),  /* Enclosed Alphanumerics */\r\n    AF_UNIRANGE_REC(  0x2C60UL,  0x2C7FUL ),  /* Latin Extended-C */\r\n    AF_UNIRANGE_REC(  0x2DE0UL,  0x2DFFUL ),  /* Cyrillic Extended-A */\r\n    AF_UNIRANGE_REC(  0x2E00UL,  0x2E7FUL ),  /* Supplemental Punctuation */\r\n    AF_UNIRANGE_REC(  0xA640UL,  0xA69FUL ),  /* Cyrillic Extended-B */\r\n    AF_UNIRANGE_REC(  0xA720UL,  0xA7FFUL ),  /* Latin Extended-D */\r\n    AF_UNIRANGE_REC(  0xFB00UL,  0xFB06UL ),  /* Alphab. Present. Forms (Latin Ligs) */\r\n    AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ),  /* Mathematical Alphanumeric Symbols */\r\n    AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ),  /* Enclosed Alphanumeric Supplement */\r\n    AF_UNIRANGE_REC(       0UL,       0UL )\r\n  };\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_latin_script_class,\r\n    AF_SCRIPT_LATIN,\r\n    af_latin_uniranges,\r\n    'o',\r\n\r\n    sizeof ( AF_LatinMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) af_latin_metrics_init,\r\n    (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   af_latin_hints_init,\r\n    (AF_Script_ApplyHintsFunc)  af_latin_hints_apply\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/aflatin.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  aflatin.h                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for latin script (specification).       */\r\n/*                                                                         */\r\n/*  Copyright 2003-2007, 2009, 2011-2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFLATIN_H__\r\n#define __AFLATIN_H__\r\n\r\n#include \"afhints.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* the latin-specific script class */\r\n\r\n  AF_DECLARE_SCRIPT_CLASS( af_latin_script_class )\r\n\r\n\r\n  /* constants are given with units_per_em == 2048 in mind */\r\n#define AF_LATIN_CONSTANT( metrics, c )                                      \\\r\n  ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****            L A T I N   G L O B A L   M E T R I C S            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*\r\n   *  The following declarations could be embedded in the file `aflatin.c';\r\n   *  they have been made semi-public to allow alternate script hinters to\r\n   *  re-use some of them.\r\n   */\r\n\r\n\r\n  /* Latin (global) metrics management */\r\n\r\n  enum\r\n  {\r\n    AF_LATIN_BLUE_CAPITAL_TOP,\r\n    AF_LATIN_BLUE_CAPITAL_BOTTOM,\r\n    AF_LATIN_BLUE_SMALL_F_TOP,\r\n    AF_LATIN_BLUE_SMALL_TOP,\r\n    AF_LATIN_BLUE_SMALL_BOTTOM,\r\n    AF_LATIN_BLUE_SMALL_MINOR,\r\n\r\n    AF_LATIN_BLUE_MAX\r\n  };\r\n\r\n\r\n#define AF_LATIN_IS_TOP_BLUE( b )  ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \\\r\n                                     (b) == AF_LATIN_BLUE_SMALL_F_TOP || \\\r\n                                     (b) == AF_LATIN_BLUE_SMALL_TOP   )\r\n\r\n#define AF_LATIN_MAX_WIDTHS  16\r\n#define AF_LATIN_MAX_BLUES   AF_LATIN_BLUE_MAX\r\n\r\n\r\n  enum\r\n  {\r\n    AF_LATIN_BLUE_ACTIVE     = 1 << 0,  /* set if zone height is <= 3/4px */\r\n    AF_LATIN_BLUE_TOP        = 1 << 1,  /* result of AF_LATIN_IS_TOP_BLUE */\r\n    AF_LATIN_BLUE_ADJUSTMENT = 1 << 2,  /* used for scale adjustment      */\r\n                                        /* optimization                   */\r\n    AF_LATIN_BLUE_FLAG_MAX\r\n  };\r\n\r\n\r\n  typedef struct  AF_LatinBlueRec_\r\n  {\r\n    AF_WidthRec  ref;\r\n    AF_WidthRec  shoot;\r\n    FT_UInt      flags;\r\n\r\n  } AF_LatinBlueRec, *AF_LatinBlue;\r\n\r\n\r\n  typedef struct  AF_LatinAxisRec_\r\n  {\r\n    FT_Fixed         scale;\r\n    FT_Pos           delta;\r\n\r\n    FT_UInt          width_count;                 /* number of used widths */\r\n    AF_WidthRec      widths[AF_LATIN_MAX_WIDTHS]; /* widths array          */\r\n    FT_Pos           edge_distance_threshold;   /* used for creating edges */\r\n    FT_Pos           standard_width;         /* the default stem thickness */\r\n    FT_Bool          extra_light;         /* is standard width very light? */\r\n\r\n    /* ignored for horizontal metrics */\r\n    FT_UInt          blue_count;\r\n    AF_LatinBlueRec  blues[AF_LATIN_BLUE_MAX];\r\n\r\n    FT_Fixed         org_scale;\r\n    FT_Pos           org_delta;\r\n\r\n  } AF_LatinAxisRec, *AF_LatinAxis;\r\n\r\n\r\n  typedef struct  AF_LatinMetricsRec_\r\n  {\r\n    AF_ScriptMetricsRec  root;\r\n    FT_UInt              units_per_em;\r\n    AF_LatinAxisRec      axis[AF_DIMENSION_MAX];\r\n\r\n  } AF_LatinMetricsRec, *AF_LatinMetrics;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_latin_metrics_init( AF_LatinMetrics  metrics,\r\n                         FT_Face          face );\r\n\r\n  FT_LOCAL( void )\r\n  af_latin_metrics_scale( AF_LatinMetrics  metrics,\r\n                          AF_Scaler        scaler );\r\n\r\n  FT_LOCAL( void )\r\n  af_latin_metrics_init_widths( AF_LatinMetrics  metrics,\r\n                                FT_Face          face );\r\n\r\n  FT_LOCAL( void )\r\n  af_latin_metrics_check_digits( AF_LatinMetrics  metrics,\r\n                                 FT_Face          face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****           L A T I N   G L Y P H   A N A L Y S I S             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  enum\r\n  {\r\n    AF_LATIN_HINTS_HORZ_SNAP   = 1 << 0, /* enable stem width snapping  */\r\n    AF_LATIN_HINTS_VERT_SNAP   = 1 << 1, /* enable stem height snapping */\r\n    AF_LATIN_HINTS_STEM_ADJUST = 1 << 2, /* enable stem width/height    */\r\n                                         /* adjustment                  */\r\n    AF_LATIN_HINTS_MONO        = 1 << 3  /* indicate monochrome         */\r\n                                         /* rendering                   */\r\n  };\r\n\r\n\r\n#define AF_LATIN_HINTS_DO_HORZ_SNAP( h )             \\\r\n  AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )\r\n\r\n#define AF_LATIN_HINTS_DO_VERT_SNAP( h )             \\\r\n  AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )\r\n\r\n#define AF_LATIN_HINTS_DO_STEM_ADJUST( h )             \\\r\n  AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )\r\n\r\n#define AF_LATIN_HINTS_DO_MONO( h )             \\\r\n  AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )\r\n\r\n\r\n  /*\r\n   *  The next functions shouldn't normally be exported.  However, other\r\n   *  scripts might like to use these functions as-is.\r\n   */\r\n  FT_LOCAL( FT_Error )\r\n  af_latin_hints_compute_segments( AF_GlyphHints  hints,\r\n                                   AF_Dimension   dim );\r\n\r\n  FT_LOCAL( void )\r\n  af_latin_hints_link_segments( AF_GlyphHints  hints,\r\n                                AF_Dimension   dim );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_latin_hints_compute_edges( AF_GlyphHints  hints,\r\n                                AF_Dimension   dim );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_latin_hints_detect_features( AF_GlyphHints  hints,\r\n                                  AF_Dimension   dim );\r\n\r\n/* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFLATIN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/aflatin2.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  aflatin2.c                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for latin script (body).                */\r\n/*                                                                         */\r\n/*  Copyright 2003-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include FT_ADVANCES_H\r\n\r\n#include \"afglobal.h\"\r\n#include \"aflatin.h\"\r\n#include \"aflatin2.h\"\r\n#include \"aferrors.h\"\r\n\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n#include \"afwarp.h\"\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_aflatin2\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin2_hints_compute_segments( AF_GlyphHints  hints,\r\n                                    AF_Dimension   dim );\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_hints_link_segments( AF_GlyphHints  hints,\r\n                                 AF_Dimension   dim );\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****            L A T I N   G L O B A L   M E T R I C S            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_metrics_init_widths( AF_LatinMetrics  metrics,\r\n                                 FT_Face          face )\r\n  {\r\n    /* scan the array of segments in each direction */\r\n    AF_GlyphHintsRec  hints[1];\r\n\r\n\r\n    af_glyph_hints_init( hints, face->memory );\r\n\r\n    metrics->axis[AF_DIMENSION_HORZ].width_count = 0;\r\n    metrics->axis[AF_DIMENSION_VERT].width_count = 0;\r\n\r\n    {\r\n      FT_Error             error;\r\n      FT_UInt              glyph_index;\r\n      int                  dim;\r\n      AF_LatinMetricsRec   dummy[1];\r\n      AF_Scaler            scaler = &dummy->root.scaler;\r\n\r\n\r\n      glyph_index = FT_Get_Char_Index( face,\r\n                                       metrics->root.clazz->standard_char );\r\n      if ( glyph_index == 0 )\r\n        goto Exit;\r\n\r\n      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );\r\n      if ( error || face->glyph->outline.n_points <= 0 )\r\n        goto Exit;\r\n\r\n      FT_ZERO( dummy );\r\n\r\n      dummy->units_per_em = metrics->units_per_em;\r\n      scaler->x_scale     = scaler->y_scale = 0x10000L;\r\n      scaler->x_delta     = scaler->y_delta = 0;\r\n      scaler->face        = face;\r\n      scaler->render_mode = FT_RENDER_MODE_NORMAL;\r\n      scaler->flags       = 0;\r\n\r\n      af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy );\r\n\r\n      error = af_glyph_hints_reload( hints, &face->glyph->outline );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n      {\r\n        AF_LatinAxis  axis    = &metrics->axis[dim];\r\n        AF_AxisHints  axhints = &hints->axis[dim];\r\n        AF_Segment    seg, limit, link;\r\n        FT_UInt       num_widths = 0;\r\n\r\n\r\n        error = af_latin2_hints_compute_segments( hints,\r\n                                                 (AF_Dimension)dim );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        af_latin2_hints_link_segments( hints,\r\n                                      (AF_Dimension)dim );\r\n\r\n        seg   = axhints->segments;\r\n        limit = seg + axhints->num_segments;\r\n\r\n        for ( ; seg < limit; seg++ )\r\n        {\r\n          link = seg->link;\r\n\r\n          /* we only consider stem segments there! */\r\n          if ( link && link->link == seg && link > seg )\r\n          {\r\n            FT_Pos  dist;\r\n\r\n\r\n            dist = seg->pos - link->pos;\r\n            if ( dist < 0 )\r\n              dist = -dist;\r\n\r\n            if ( num_widths < AF_LATIN_MAX_WIDTHS )\r\n              axis->widths[num_widths++].org = dist;\r\n          }\r\n        }\r\n\r\n        af_sort_widths( num_widths, axis->widths );\r\n        axis->width_count = num_widths;\r\n      }\r\n\r\n  Exit:\r\n      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n      {\r\n        AF_LatinAxis  axis = &metrics->axis[dim];\r\n        FT_Pos        stdw;\r\n\r\n\r\n        stdw = ( axis->width_count > 0 )\r\n                 ? axis->widths[0].org\r\n                 : AF_LATIN_CONSTANT( metrics, 50 );\r\n\r\n        /* let's try 20% of the smallest width */\r\n        axis->edge_distance_threshold = stdw / 5;\r\n        axis->standard_width          = stdw;\r\n        axis->extra_light             = 0;\r\n      }\r\n    }\r\n\r\n    af_glyph_hints_done( hints );\r\n  }\r\n\r\n\r\n\r\n#define AF_LATIN_MAX_TEST_CHARACTERS  12\r\n\r\n\r\n  static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES]\r\n                                        [AF_LATIN_MAX_TEST_CHARACTERS+1] =\r\n  {\r\n    \"THEZOCQS\",\r\n    \"HEZLOCUS\",\r\n    \"fijkdbh\",\r\n    \"xzroesc\",\r\n    \"xzroesc\",\r\n    \"pqgjy\"\r\n  };\r\n\r\n\r\n  static void\r\n  af_latin2_metrics_init_blues( AF_LatinMetrics  metrics,\r\n                                FT_Face          face )\r\n  {\r\n    FT_Pos        flats [AF_LATIN_MAX_TEST_CHARACTERS];\r\n    FT_Pos        rounds[AF_LATIN_MAX_TEST_CHARACTERS];\r\n    FT_Int        num_flats;\r\n    FT_Int        num_rounds;\r\n    FT_Int        bb;\r\n    AF_LatinBlue  blue;\r\n    FT_Error      error;\r\n    AF_LatinAxis  axis  = &metrics->axis[AF_DIMENSION_VERT];\r\n    FT_GlyphSlot  glyph = face->glyph;\r\n\r\n\r\n    /* we compute the blues simply by loading each character from the     */\r\n    /* 'af_latin2_blue_chars[blues]' string, then compute its top-most or */\r\n    /* bottom-most points (depending on `AF_IS_TOP_BLUE')                 */\r\n\r\n    FT_TRACE5(( \"blue zones computation\\n\"\r\n                \"======================\\n\\n\" ));\r\n\r\n    for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )\r\n    {\r\n      const char*  p     = af_latin2_blue_chars[bb];\r\n      const char*  limit = p + AF_LATIN_MAX_TEST_CHARACTERS;\r\n      FT_Pos*      blue_ref;\r\n      FT_Pos*      blue_shoot;\r\n\r\n\r\n      FT_TRACE5(( \"blue zone %d:\\n\", bb ));\r\n\r\n      num_flats  = 0;\r\n      num_rounds = 0;\r\n\r\n      for ( ; p < limit && *p; p++ )\r\n      {\r\n        FT_UInt     glyph_index;\r\n        FT_Int      best_point, best_y, best_first, best_last;\r\n        FT_Vector*  points;\r\n        FT_Bool     round;\r\n\r\n\r\n        /* load the character in the face -- skip unknown or empty ones */\r\n        glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );\r\n        if ( glyph_index == 0 )\r\n          continue;\r\n\r\n        error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );\r\n        if ( error || glyph->outline.n_points <= 0 )\r\n          continue;\r\n\r\n        /* now compute min or max point indices and coordinates */\r\n        points      = glyph->outline.points;\r\n        best_point  = -1;\r\n        best_y      = 0;  /* make compiler happy */\r\n        best_first  = 0;  /* ditto */\r\n        best_last   = 0;  /* ditto */\r\n\r\n        {\r\n          FT_Int  nn;\r\n          FT_Int  first = 0;\r\n          FT_Int  last  = -1;\r\n\r\n\r\n          for ( nn = 0; nn < glyph->outline.n_contours; first = last+1, nn++ )\r\n          {\r\n            FT_Int  old_best_point = best_point;\r\n            FT_Int  pp;\r\n\r\n\r\n            last = glyph->outline.contours[nn];\r\n\r\n            /* Avoid single-point contours since they are never rasterized. */\r\n            /* In some fonts, they correspond to mark attachment points     */\r\n            /* which are way outside of the glyph's real outline.           */\r\n            if ( last == first )\r\n                continue;\r\n\r\n            if ( AF_LATIN_IS_TOP_BLUE( bb ) )\r\n            {\r\n              for ( pp = first; pp <= last; pp++ )\r\n                if ( best_point < 0 || points[pp].y > best_y )\r\n                {\r\n                  best_point = pp;\r\n                  best_y     = points[pp].y;\r\n                }\r\n            }\r\n            else\r\n            {\r\n              for ( pp = first; pp <= last; pp++ )\r\n                if ( best_point < 0 || points[pp].y < best_y )\r\n                {\r\n                  best_point = pp;\r\n                  best_y     = points[pp].y;\r\n                }\r\n            }\r\n\r\n            if ( best_point != old_best_point )\r\n            {\r\n              best_first = first;\r\n              best_last  = last;\r\n            }\r\n          }\r\n          FT_TRACE5(( \"  %c  %d\", *p, best_y ));\r\n        }\r\n\r\n        /* now check whether the point belongs to a straight or round   */\r\n        /* segment; we first need to find in which contour the extremum */\r\n        /* lies, then inspect its previous and next points              */\r\n        {\r\n          FT_Pos  best_x = points[best_point].x;\r\n          FT_Int  start, end, prev, next;\r\n          FT_Pos  dist;\r\n\r\n\r\n          /* now look for the previous and next points that are not on the */\r\n          /* same Y coordinate.  Threshold the `closeness'...              */\r\n          start = end = best_point;\r\n\r\n          do\r\n          {\r\n            prev = start - 1;\r\n            if ( prev < best_first )\r\n              prev = best_last;\r\n\r\n            dist = FT_ABS( points[prev].y - best_y );\r\n            /* accept a small distance or a small angle (both values are */\r\n            /* heuristic; value 20 corresponds to approx. 2.9 degrees)   */\r\n            if ( dist > 5 )\r\n              if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )\r\n                break;\r\n\r\n            start = prev;\r\n\r\n          } while ( start != best_point );\r\n\r\n          do\r\n          {\r\n            next = end + 1;\r\n            if ( next > best_last )\r\n              next = best_first;\r\n\r\n            dist = FT_ABS( points[next].y - best_y );\r\n            if ( dist > 5 )\r\n              if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )\r\n                break;\r\n\r\n            end = next;\r\n\r\n          } while ( end != best_point );\r\n\r\n          /* now, set the `round' flag depending on the segment's kind */\r\n          round = FT_BOOL(\r\n            FT_CURVE_TAG( glyph->outline.tags[start] ) != FT_CURVE_TAG_ON ||\r\n            FT_CURVE_TAG( glyph->outline.tags[ end ] ) != FT_CURVE_TAG_ON );\r\n\r\n          FT_TRACE5(( \" (%s)\\n\", round ? \"round\" : \"flat\" ));\r\n        }\r\n\r\n        if ( round )\r\n          rounds[num_rounds++] = best_y;\r\n        else\r\n          flats[num_flats++]   = best_y;\r\n      }\r\n\r\n      if ( num_flats == 0 && num_rounds == 0 )\r\n      {\r\n        /*\r\n         *  we couldn't find a single glyph to compute this blue zone,\r\n         *  we will simply ignore it then\r\n         */\r\n        FT_TRACE5(( \"  empty\\n\" ));\r\n        continue;\r\n      }\r\n\r\n      /* we have computed the contents of the `rounds' and `flats' tables, */\r\n      /* now determine the reference and overshoot position of the blue -- */\r\n      /* we simply take the median value after a simple sort               */\r\n      af_sort_pos( num_rounds, rounds );\r\n      af_sort_pos( num_flats,  flats );\r\n\r\n      blue       = & axis->blues[axis->blue_count];\r\n      blue_ref   = & blue->ref.org;\r\n      blue_shoot = & blue->shoot.org;\r\n\r\n      axis->blue_count++;\r\n\r\n      if ( num_flats == 0 )\r\n      {\r\n        *blue_ref   =\r\n        *blue_shoot = rounds[num_rounds / 2];\r\n      }\r\n      else if ( num_rounds == 0 )\r\n      {\r\n        *blue_ref   =\r\n        *blue_shoot = flats[num_flats / 2];\r\n      }\r\n      else\r\n      {\r\n        *blue_ref   = flats[num_flats / 2];\r\n        *blue_shoot = rounds[num_rounds / 2];\r\n      }\r\n\r\n      /* there are sometimes problems: if the overshoot position of top     */\r\n      /* zones is under its reference position, or the opposite for bottom  */\r\n      /* zones.  We must thus check everything there and correct the errors */\r\n      if ( *blue_shoot != *blue_ref )\r\n      {\r\n        FT_Pos   ref      = *blue_ref;\r\n        FT_Pos   shoot    = *blue_shoot;\r\n        FT_Bool  over_ref = FT_BOOL( shoot > ref );\r\n\r\n\r\n        if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref )\r\n        {\r\n          *blue_ref   =\r\n          *blue_shoot = ( shoot + ref ) / 2;\r\n\r\n          FT_TRACE5(( \"  [overshoot smaller than reference,\"\r\n                      \" taking mean value]\\n\" ));\r\n        }\r\n      }\r\n\r\n      blue->flags = 0;\r\n      if ( AF_LATIN_IS_TOP_BLUE( bb ) )\r\n        blue->flags |= AF_LATIN_BLUE_TOP;\r\n\r\n      /*\r\n       * The following flags is used later to adjust the y and x scales\r\n       * in order to optimize the pixel grid alignment of the top of small\r\n       * letters.\r\n       */\r\n      if ( bb == AF_LATIN_BLUE_SMALL_TOP )\r\n        blue->flags |= AF_LATIN_BLUE_ADJUSTMENT;\r\n\r\n      FT_TRACE5(( \"    -> reference = %ld\\n\"\r\n                  \"       overshoot = %ld\\n\",\r\n                  *blue_ref, *blue_shoot ));\r\n    }\r\n\r\n    return;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_metrics_check_digits( AF_LatinMetrics  metrics,\r\n                                  FT_Face          face )\r\n  {\r\n    FT_UInt   i;\r\n    FT_Bool   started = 0, same_width = 1;\r\n    FT_Fixed  advance, old_advance = 0;\r\n\r\n\r\n    /* check whether all ASCII digits have the same advance width; */\r\n    /* digit `0' is 0x30 in all supported charmaps                 */\r\n    for ( i = 0x30; i <= 0x39; i++ )\r\n    {\r\n      FT_UInt  glyph_index;\r\n\r\n\r\n      glyph_index = FT_Get_Char_Index( face, i );\r\n      if ( glyph_index == 0 )\r\n        continue;\r\n\r\n      if ( FT_Get_Advance( face, glyph_index,\r\n                           FT_LOAD_NO_SCALE         |\r\n                           FT_LOAD_NO_HINTING       |\r\n                           FT_LOAD_IGNORE_TRANSFORM,\r\n                           &advance ) )\r\n        continue;\r\n\r\n      if ( started )\r\n      {\r\n        if ( advance != old_advance )\r\n        {\r\n          same_width = 0;\r\n          break;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        old_advance = advance;\r\n        started     = 1;\r\n      }\r\n    }\r\n\r\n    metrics->root.digits_have_same_width = same_width;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin2_metrics_init( AF_LatinMetrics  metrics,\r\n                          FT_Face          face )\r\n  {\r\n    FT_Error    error = AF_Err_Ok;\r\n    FT_CharMap  oldmap = face->charmap;\r\n    FT_UInt     ee;\r\n\r\n    static const FT_Encoding  latin_encodings[] =\r\n    {\r\n      FT_ENCODING_UNICODE,\r\n      FT_ENCODING_APPLE_ROMAN,\r\n      FT_ENCODING_ADOBE_STANDARD,\r\n      FT_ENCODING_ADOBE_LATIN_1,\r\n      FT_ENCODING_NONE  /* end of list */\r\n    };\r\n\r\n\r\n    metrics->units_per_em = face->units_per_EM;\r\n\r\n    /* do we have a latin charmap in there? */\r\n    for ( ee = 0; latin_encodings[ee] != FT_ENCODING_NONE; ee++ )\r\n    {\r\n      error = FT_Select_Charmap( face, latin_encodings[ee] );\r\n      if ( !error )\r\n        break;\r\n    }\r\n\r\n    if ( !error )\r\n    {\r\n      af_latin2_metrics_init_widths( metrics, face );\r\n      af_latin2_metrics_init_blues( metrics, face );\r\n      af_latin2_metrics_check_digits( metrics, face );\r\n    }\r\n\r\n    FT_Set_Charmap( face, oldmap );\r\n    return AF_Err_Ok;\r\n  }\r\n\r\n\r\n  static void\r\n  af_latin2_metrics_scale_dim( AF_LatinMetrics  metrics,\r\n                               AF_Scaler        scaler,\r\n                               AF_Dimension     dim )\r\n  {\r\n    FT_Fixed      scale;\r\n    FT_Pos        delta;\r\n    AF_LatinAxis  axis;\r\n    FT_UInt       nn;\r\n\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      scale = scaler->x_scale;\r\n      delta = scaler->x_delta;\r\n    }\r\n    else\r\n    {\r\n      scale = scaler->y_scale;\r\n      delta = scaler->y_delta;\r\n    }\r\n\r\n    axis = &metrics->axis[dim];\r\n\r\n    if ( axis->org_scale == scale && axis->org_delta == delta )\r\n      return;\r\n\r\n    axis->org_scale = scale;\r\n    axis->org_delta = delta;\r\n\r\n    /*\r\n     * correct Y scale to optimize the alignment of the top of small\r\n     * letters to the pixel grid\r\n     */\r\n    if ( dim == AF_DIMENSION_VERT )\r\n    {\r\n      AF_LatinAxis  vaxis = &metrics->axis[AF_DIMENSION_VERT];\r\n      AF_LatinBlue  blue = NULL;\r\n\r\n\r\n      for ( nn = 0; nn < vaxis->blue_count; nn++ )\r\n      {\r\n        if ( vaxis->blues[nn].flags & AF_LATIN_BLUE_ADJUSTMENT )\r\n        {\r\n          blue = &vaxis->blues[nn];\r\n          break;\r\n        }\r\n      }\r\n\r\n      if ( blue )\r\n      {\r\n        FT_Pos   scaled;\r\n        FT_Pos   threshold;\r\n        FT_Pos   fitted;\r\n        FT_UInt  limit;\r\n        FT_UInt  ppem;\r\n\r\n\r\n        scaled    = FT_MulFix( blue->shoot.org, scaler->y_scale );\r\n        ppem      = metrics->root.scaler.face->size->metrics.x_ppem;\r\n        limit     = metrics->root.globals->increase_x_height;\r\n        threshold = 40;\r\n\r\n        /* if the `increase-x-height' property is active, */\r\n        /* we round up much more often                    */\r\n        if ( limit                                 &&\r\n             ppem <= limit                         &&\r\n             ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN )\r\n          threshold = 52;\r\n\r\n        fitted = ( scaled + threshold ) & ~63;\r\n\r\n#if 1\r\n        if ( scaled != fitted )\r\n        {\r\n          scale = FT_MulDiv( scale, fitted, scaled );\r\n          FT_TRACE5(( \"== scaled x-top = %.2g\"\r\n                      \"  fitted = %.2g, scaling = %.4g\\n\",\r\n                      scaled / 64.0, fitted / 64.0,\r\n                      ( fitted * 1.0 ) / scaled ));\r\n        }\r\n#endif\r\n      }\r\n    }\r\n\r\n    axis->scale = scale;\r\n    axis->delta = delta;\r\n\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      metrics->root.scaler.x_scale = scale;\r\n      metrics->root.scaler.x_delta = delta;\r\n    }\r\n    else\r\n    {\r\n      metrics->root.scaler.y_scale = scale;\r\n      metrics->root.scaler.y_delta = delta;\r\n    }\r\n\r\n    /* scale the standard widths */\r\n    for ( nn = 0; nn < axis->width_count; nn++ )\r\n    {\r\n      AF_Width  width = axis->widths + nn;\r\n\r\n\r\n      width->cur = FT_MulFix( width->org, scale );\r\n      width->fit = width->cur;\r\n    }\r\n\r\n    /* an extra-light axis corresponds to a standard width that is */\r\n    /* smaller than 5/8 pixels                                     */\r\n    axis->extra_light =\r\n      (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 );\r\n\r\n    if ( dim == AF_DIMENSION_VERT )\r\n    {\r\n      /* scale the blue zones */\r\n      for ( nn = 0; nn < axis->blue_count; nn++ )\r\n      {\r\n        AF_LatinBlue  blue = &axis->blues[nn];\r\n        FT_Pos        dist;\r\n\r\n\r\n        blue->ref.cur   = FT_MulFix( blue->ref.org, scale ) + delta;\r\n        blue->ref.fit   = blue->ref.cur;\r\n        blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta;\r\n        blue->shoot.fit = blue->shoot.cur;\r\n        blue->flags    &= ~AF_LATIN_BLUE_ACTIVE;\r\n\r\n        /* a blue zone is only active if it is less than 3/4 pixels tall */\r\n        dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );\r\n        if ( dist <= 48 && dist >= -48 )\r\n        {\r\n          FT_Pos  delta1, delta2;\r\n\r\n          delta1 = blue->shoot.org - blue->ref.org;\r\n          delta2 = delta1;\r\n          if ( delta1 < 0 )\r\n            delta2 = -delta2;\r\n\r\n          delta2 = FT_MulFix( delta2, scale );\r\n\r\n          if ( delta2 < 32 )\r\n            delta2 = 0;\r\n          else if ( delta2 < 64 )\r\n            delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );\r\n          else\r\n            delta2 = FT_PIX_ROUND( delta2 );\r\n\r\n          if ( delta1 < 0 )\r\n            delta2 = -delta2;\r\n\r\n          blue->ref.fit   = FT_PIX_ROUND( blue->ref.cur );\r\n          blue->shoot.fit = blue->ref.fit + delta2;\r\n\r\n          FT_TRACE5(( \">> activating blue zone %d:\"\r\n                      \"  ref.cur=%.2g ref.fit=%.2g\"\r\n                      \"  shoot.cur=%.2g shoot.fit=%.2g\\n\",\r\n                      nn, blue->ref.cur / 64.0, blue->ref.fit / 64.0,\r\n                      blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 ));\r\n\r\n          blue->flags |= AF_LATIN_BLUE_ACTIVE;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_metrics_scale( AF_LatinMetrics  metrics,\r\n                           AF_Scaler        scaler )\r\n  {\r\n    metrics->root.scaler.render_mode = scaler->render_mode;\r\n    metrics->root.scaler.face        = scaler->face;\r\n    metrics->root.scaler.flags       = scaler->flags;\r\n\r\n    af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );\r\n    af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****           L A T I N   G L Y P H   A N A L Y S I S             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define  SORT_SEGMENTS\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin2_hints_compute_segments( AF_GlyphHints  hints,\r\n                                    AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis          = &hints->axis[dim];\r\n    FT_Memory     memory        = hints->memory;\r\n    FT_Error      error         = AF_Err_Ok;\r\n    AF_Segment    segment       = NULL;\r\n    AF_SegmentRec seg0;\r\n    AF_Point*     contour       = hints->contours;\r\n    AF_Point*     contour_limit = contour + hints->num_contours;\r\n    AF_Direction  major_dir, segment_dir;\r\n\r\n\r\n    FT_ZERO( &seg0 );\r\n    seg0.score = 32000;\r\n    seg0.flags = AF_EDGE_NORMAL;\r\n\r\n    major_dir   = (AF_Direction)FT_ABS( axis->major_dir );\r\n    segment_dir = major_dir;\r\n\r\n    axis->num_segments = 0;\r\n\r\n    /* set up (u,v) in each point */\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      AF_Point  point = hints->points;\r\n      AF_Point  limit = point + hints->num_points;\r\n\r\n\r\n      for ( ; point < limit; point++ )\r\n      {\r\n        point->u = point->fx;\r\n        point->v = point->fy;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      AF_Point  point = hints->points;\r\n      AF_Point  limit = point + hints->num_points;\r\n\r\n\r\n      for ( ; point < limit; point++ )\r\n      {\r\n        point->u = point->fy;\r\n        point->v = point->fx;\r\n      }\r\n    }\r\n\r\n    /* do each contour separately */\r\n    for ( ; contour < contour_limit; contour++ )\r\n    {\r\n      AF_Point  point   =  contour[0];\r\n      AF_Point  start   =  point;\r\n      AF_Point  last    =  point->prev;\r\n\r\n\r\n      if ( point == last )  /* skip singletons -- just in case */\r\n        continue;\r\n\r\n      /* already on an edge ?, backtrack to find its start */\r\n      if ( FT_ABS( point->in_dir ) == major_dir )\r\n      {\r\n        point = point->prev;\r\n\r\n        while ( point->in_dir == start->in_dir )\r\n          point = point->prev;\r\n      }\r\n      else  /* otherwise, find first segment start, if any */\r\n      {\r\n        while ( FT_ABS( point->out_dir ) != major_dir )\r\n        {\r\n          point = point->next;\r\n\r\n          if ( point == start )\r\n            goto NextContour;\r\n        }\r\n      }\r\n\r\n      start = point;\r\n\r\n      for  (;;)\r\n      {\r\n        AF_Point  first;\r\n        FT_Pos    min_u, min_v, max_u, max_v;\r\n\r\n        /* we're at the start of a new segment */\r\n        FT_ASSERT( FT_ABS( point->out_dir ) == major_dir &&\r\n                           point->in_dir != point->out_dir );\r\n        first = point;\r\n\r\n        min_u = max_u = point->u;\r\n        min_v = max_v = point->v;\r\n\r\n        point = point->next;\r\n\r\n        while ( point->out_dir == first->out_dir )\r\n        {\r\n          point = point->next;\r\n\r\n          if ( point->u < min_u )\r\n            min_u = point->u;\r\n\r\n          if ( point->u > max_u )\r\n            max_u = point->u;\r\n        }\r\n\r\n        if ( point->v < min_v )\r\n          min_v = point->v;\r\n\r\n        if ( point->v > max_v )\r\n          max_v = point->v;\r\n\r\n        /* record new segment */\r\n        error = af_axis_hints_new_segment( axis, memory, &segment );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        segment[0]         = seg0;\r\n        segment->dir       = first->out_dir;\r\n        segment->first     = first;\r\n        segment->last      = point;\r\n        segment->pos       = (FT_Short)(( min_u + max_u ) >> 1);\r\n        segment->min_coord = (FT_Short) min_v;\r\n        segment->max_coord = (FT_Short) max_v;\r\n        segment->height    = (FT_Short)(max_v - min_v);\r\n\r\n        /* a segment is round if it doesn't have successive */\r\n        /* on-curve points.                                 */\r\n        {\r\n          AF_Point  pt   = first;\r\n          AF_Point  last = point;\r\n          AF_Flags  f0   = (AF_Flags)(pt->flags & AF_FLAG_CONTROL);\r\n          AF_Flags  f1;\r\n\r\n\r\n          segment->flags &= ~AF_EDGE_ROUND;\r\n\r\n          for ( ; pt != last; f0 = f1 )\r\n          {\r\n            pt = pt->next;\r\n            f1 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL);\r\n\r\n            if ( !f0 && !f1 )\r\n              break;\r\n\r\n            if ( pt == last )\r\n              segment->flags |= AF_EDGE_ROUND;\r\n          }\r\n        }\r\n\r\n       /* this can happen in the case of a degenerate contour\r\n        * e.g. a 2-point vertical contour\r\n        */\r\n        if ( point == start )\r\n          break;\r\n\r\n        /* jump to the start of the next segment, if any */\r\n        while ( FT_ABS(point->out_dir) != major_dir )\r\n        {\r\n          point = point->next;\r\n\r\n          if ( point == start )\r\n            goto NextContour;\r\n        }\r\n      }\r\n\r\n    NextContour:\r\n      ;\r\n    } /* contours */\r\n\r\n    /* now slightly increase the height of segments when this makes */\r\n    /* sense -- this is used to better detect and ignore serifs     */\r\n    {\r\n      AF_Segment  segments     = axis->segments;\r\n      AF_Segment  segments_end = segments + axis->num_segments;\r\n\r\n\r\n      for ( segment = segments; segment < segments_end; segment++ )\r\n      {\r\n        AF_Point  first   = segment->first;\r\n        AF_Point  last    = segment->last;\r\n        AF_Point  p;\r\n        FT_Pos    first_v = first->v;\r\n        FT_Pos    last_v  = last->v;\r\n\r\n\r\n        if ( first == last )\r\n          continue;\r\n\r\n        if ( first_v < last_v )\r\n        {\r\n          p = first->prev;\r\n          if ( p->v < first_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( first_v - p->v ) >> 1 ) );\r\n\r\n          p = last->next;\r\n          if ( p->v > last_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( p->v - last_v ) >> 1 ) );\r\n        }\r\n        else\r\n        {\r\n          p = first->prev;\r\n          if ( p->v > first_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( p->v - first_v ) >> 1 ) );\r\n\r\n          p = last->next;\r\n          if ( p->v < last_v )\r\n            segment->height = (FT_Short)( segment->height +\r\n                                          ( ( last_v - p->v ) >> 1 ) );\r\n        }\r\n      }\r\n    }\r\n\r\n#ifdef AF_SORT_SEGMENTS\r\n   /* place all segments with a negative direction to the start\r\n    * of the array, used to speed up segment linking later...\r\n    */\r\n    {\r\n      AF_Segment  segments = axis->segments;\r\n      FT_UInt     count    = axis->num_segments;\r\n      FT_UInt     ii, jj;\r\n\r\n      for (ii = 0; ii < count; ii++)\r\n      {\r\n        if ( segments[ii].dir > 0 )\r\n        {\r\n          for (jj = ii+1; jj < count; jj++)\r\n          {\r\n            if ( segments[jj].dir < 0 )\r\n            {\r\n              AF_SegmentRec  tmp;\r\n\r\n              tmp          = segments[ii];\r\n              segments[ii] = segments[jj];\r\n              segments[jj] = tmp;\r\n\r\n              break;\r\n            }\r\n          }\r\n\r\n          if ( jj == count )\r\n            break;\r\n        }\r\n      }\r\n      axis->mid_segments = ii;\r\n    }\r\n#endif\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_hints_link_segments( AF_GlyphHints  hints,\r\n                                 AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis          = &hints->axis[dim];\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n#ifdef AF_SORT_SEGMENTS\r\n    AF_Segment    segment_mid   = segments + axis->mid_segments;\r\n#endif\r\n    FT_Pos        len_threshold, len_score;\r\n    AF_Segment    seg1, seg2;\r\n\r\n\r\n    len_threshold = AF_LATIN_CONSTANT( hints->metrics, 8 );\r\n    if ( len_threshold == 0 )\r\n      len_threshold = 1;\r\n\r\n    len_score = AF_LATIN_CONSTANT( hints->metrics, 6000 );\r\n\r\n#ifdef AF_SORT_SEGMENTS\r\n    for ( seg1 = segments; seg1 < segment_mid; seg1++ )\r\n    {\r\n      if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )\r\n        continue;\r\n\r\n      for ( seg2 = segment_mid; seg2 < segment_limit; seg2++ )\r\n#else\r\n    /* now compare each segment to the others */\r\n    for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n    {\r\n      /* the fake segments are introduced to hint the metrics -- */\r\n      /* we must never link them to anything                     */\r\n      if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )\r\n        continue;\r\n\r\n      for ( seg2 = segments; seg2 < segment_limit; seg2++ )\r\n        if ( seg1->dir + seg2->dir == 0 && seg2->pos > seg1->pos )\r\n#endif\r\n        {\r\n          FT_Pos  pos1 = seg1->pos;\r\n          FT_Pos  pos2 = seg2->pos;\r\n          FT_Pos  dist = pos2 - pos1;\r\n\r\n\r\n          if ( dist < 0 )\r\n            continue;\r\n\r\n          {\r\n            FT_Pos  min = seg1->min_coord;\r\n            FT_Pos  max = seg1->max_coord;\r\n            FT_Pos  len, score;\r\n\r\n\r\n            if ( min < seg2->min_coord )\r\n              min = seg2->min_coord;\r\n\r\n            if ( max > seg2->max_coord )\r\n              max = seg2->max_coord;\r\n\r\n            len = max - min;\r\n            if ( len >= len_threshold )\r\n            {\r\n              score = dist + len_score / len;\r\n              if ( score < seg1->score )\r\n              {\r\n                seg1->score = score;\r\n                seg1->link  = seg2;\r\n              }\r\n\r\n              if ( score < seg2->score )\r\n              {\r\n                seg2->score = score;\r\n                seg2->link  = seg1;\r\n              }\r\n            }\r\n          }\r\n        }\r\n    }\r\n#if 0\r\n    }\r\n#endif\r\n\r\n    /* now, compute the `serif' segments */\r\n    for ( seg1 = segments; seg1 < segment_limit; seg1++ )\r\n    {\r\n      seg2 = seg1->link;\r\n\r\n      if ( seg2 )\r\n      {\r\n        if ( seg2->link != seg1 )\r\n        {\r\n          seg1->link  = 0;\r\n          seg1->serif = seg2->link;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin2_hints_compute_edges( AF_GlyphHints  hints,\r\n                                 AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis   = &hints->axis[dim];\r\n    FT_Error      error  = AF_Err_Ok;\r\n    FT_Memory     memory = hints->memory;\r\n    AF_LatinAxis  laxis  = &((AF_LatinMetrics)hints->metrics)->axis[dim];\r\n\r\n    AF_Segment    segments      = axis->segments;\r\n    AF_Segment    segment_limit = segments + axis->num_segments;\r\n    AF_Segment    seg;\r\n\r\n    AF_Direction  up_dir;\r\n    FT_Fixed      scale;\r\n    FT_Pos        edge_distance_threshold;\r\n    FT_Pos        segment_length_threshold;\r\n\r\n\r\n    axis->num_edges = 0;\r\n\r\n    scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale\r\n                                         : hints->y_scale;\r\n\r\n    up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP\r\n                                          : AF_DIR_RIGHT;\r\n\r\n    /*\r\n     *  We want to ignore very small (mostly serif) segments, we do that\r\n     *  by ignoring those that whose length is less than a given fraction\r\n     *  of the standard width. If there is no standard width, we ignore\r\n     *  those that are less than a given size in pixels\r\n     *\r\n     *  also, unlink serif segments that are linked to segments farther\r\n     *  than 50% of the standard width\r\n     */\r\n    if ( dim == AF_DIMENSION_HORZ )\r\n    {\r\n      if ( laxis->width_count > 0 )\r\n        segment_length_threshold = (laxis->standard_width * 10 ) >> 4;\r\n      else\r\n        segment_length_threshold = FT_DivFix( 64, hints->y_scale );\r\n    }\r\n    else\r\n      segment_length_threshold = 0;\r\n\r\n    /*********************************************************************/\r\n    /*                                                                   */\r\n    /* We will begin by generating a sorted table of edges for the       */\r\n    /* current direction.  To do so, we simply scan each segment and try */\r\n    /* to find an edge in our table that corresponds to its position.    */\r\n    /*                                                                   */\r\n    /* If no edge is found, we create and insert a new edge in the       */\r\n    /* sorted table.  Otherwise, we simply add the segment to the edge's */\r\n    /* list which will be processed in the second step to compute the    */\r\n    /* edge's properties.                                                */\r\n    /*                                                                   */\r\n    /* Note that the edges table is sorted along the segment/edge        */\r\n    /* position.                                                         */\r\n    /*                                                                   */\r\n    /*********************************************************************/\r\n\r\n    edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold,\r\n                                         scale );\r\n    if ( edge_distance_threshold > 64 / 4 )\r\n      edge_distance_threshold = 64 / 4;\r\n\r\n    edge_distance_threshold = FT_DivFix( edge_distance_threshold,\r\n                                         scale );\r\n\r\n    for ( seg = segments; seg < segment_limit; seg++ )\r\n    {\r\n      AF_Edge  found = 0;\r\n      FT_Int   ee;\r\n\r\n\r\n      if ( seg->height < segment_length_threshold )\r\n        continue;\r\n\r\n      /* A special case for serif edges: If they are smaller than */\r\n      /* 1.5 pixels we ignore them.                               */\r\n      if ( seg->serif )\r\n      {\r\n        FT_Pos  dist = seg->serif->pos - seg->pos;\r\n\r\n        if (dist < 0)\r\n          dist = -dist;\r\n\r\n        if (dist >= laxis->standard_width >> 1)\r\n        {\r\n          /* unlink this serif, it is too distant from its reference stem */\r\n          seg->serif = NULL;\r\n        }\r\n        else if ( 2*seg->height < 3 * segment_length_threshold )\r\n          continue;\r\n      }\r\n\r\n      /* look for an edge corresponding to the segment */\r\n      for ( ee = 0; ee < axis->num_edges; ee++ )\r\n      {\r\n        AF_Edge  edge = axis->edges + ee;\r\n        FT_Pos   dist;\r\n\r\n\r\n        dist = seg->pos - edge->fpos;\r\n        if ( dist < 0 )\r\n          dist = -dist;\r\n\r\n        if ( dist < edge_distance_threshold && edge->dir == seg->dir )\r\n        {\r\n          found = edge;\r\n          break;\r\n        }\r\n      }\r\n\r\n      if ( !found )\r\n      {\r\n        AF_Edge   edge;\r\n\r\n\r\n        /* insert a new edge in the list and */\r\n        /* sort according to the position    */\r\n        error = af_axis_hints_new_edge( axis, seg->pos, seg->dir,\r\n                                        memory, &edge );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        /* add the segment to the new edge's list */\r\n        FT_ZERO( edge );\r\n\r\n        edge->first    = seg;\r\n        edge->last     = seg;\r\n        edge->fpos     = seg->pos;\r\n        edge->dir      = seg->dir;\r\n        edge->opos     = edge->pos = FT_MulFix( seg->pos, scale );\r\n        seg->edge_next = seg;\r\n      }\r\n      else\r\n      {\r\n        /* if an edge was found, simply add the segment to the edge's */\r\n        /* list                                                       */\r\n        seg->edge_next         = found->first;\r\n        found->last->edge_next = seg;\r\n        found->last            = seg;\r\n      }\r\n    }\r\n\r\n\r\n    /*********************************************************************/\r\n    /*                                                                   */\r\n    /* Good, we will now compute each edge's properties according to     */\r\n    /* segments found on its position.  Basically, these are:            */\r\n    /*                                                                   */\r\n    /*  - edge's main direction                                          */\r\n    /*  - stem edge, serif edge or both (which defaults to stem then)    */\r\n    /*  - rounded edge, straight or both (which defaults to straight)    */\r\n    /*  - link for edge                                                  */\r\n    /*                                                                   */\r\n    /*********************************************************************/\r\n\r\n    /* first of all, set the `edge' field in each segment -- this is */\r\n    /* required in order to compute edge links                       */\r\n\r\n    /*\r\n     * Note that removing this loop and setting the `edge' field of each\r\n     * segment directly in the code above slows down execution speed for\r\n     * some reasons on platforms like the Sun.\r\n     */\r\n    {\r\n      AF_Edge  edges      = axis->edges;\r\n      AF_Edge  edge_limit = edges + axis->num_edges;\r\n      AF_Edge  edge;\r\n\r\n\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        seg = edge->first;\r\n        if ( seg )\r\n          do\r\n          {\r\n            seg->edge = edge;\r\n            seg       = seg->edge_next;\r\n\r\n          } while ( seg != edge->first );\r\n      }\r\n\r\n      /* now, compute each edge properties */\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        FT_Int  is_round    = 0;  /* does it contain round segments?    */\r\n        FT_Int  is_straight = 0;  /* does it contain straight segments? */\r\n#if 0\r\n        FT_Pos  ups         = 0;  /* number of upwards segments         */\r\n        FT_Pos  downs       = 0;  /* number of downwards segments       */\r\n#endif\r\n\r\n\r\n        seg = edge->first;\r\n\r\n        do\r\n        {\r\n          FT_Bool  is_serif;\r\n\r\n\r\n          /* check for roundness of segment */\r\n          if ( seg->flags & AF_EDGE_ROUND )\r\n            is_round++;\r\n          else\r\n            is_straight++;\r\n\r\n#if 0\r\n          /* check for segment direction */\r\n          if ( seg->dir == up_dir )\r\n            ups   += seg->max_coord-seg->min_coord;\r\n          else\r\n            downs += seg->max_coord-seg->min_coord;\r\n#endif\r\n\r\n          /* check for links -- if seg->serif is set, then seg->link must */\r\n          /* be ignored                                                   */\r\n          is_serif = (FT_Bool)( seg->serif               &&\r\n                                seg->serif->edge         &&\r\n                                seg->serif->edge != edge );\r\n\r\n          if ( ( seg->link && seg->link->edge != NULL ) || is_serif )\r\n          {\r\n            AF_Edge     edge2;\r\n            AF_Segment  seg2;\r\n\r\n\r\n            edge2 = edge->link;\r\n            seg2  = seg->link;\r\n\r\n            if ( is_serif )\r\n            {\r\n              seg2  = seg->serif;\r\n              edge2 = edge->serif;\r\n            }\r\n\r\n            if ( edge2 )\r\n            {\r\n              FT_Pos  edge_delta;\r\n              FT_Pos  seg_delta;\r\n\r\n\r\n              edge_delta = edge->fpos - edge2->fpos;\r\n              if ( edge_delta < 0 )\r\n                edge_delta = -edge_delta;\r\n\r\n              seg_delta = seg->pos - seg2->pos;\r\n              if ( seg_delta < 0 )\r\n                seg_delta = -seg_delta;\r\n\r\n              if ( seg_delta < edge_delta )\r\n                edge2 = seg2->edge;\r\n            }\r\n            else\r\n              edge2 = seg2->edge;\r\n\r\n            if ( is_serif )\r\n            {\r\n              edge->serif   = edge2;\r\n              edge2->flags |= AF_EDGE_SERIF;\r\n            }\r\n            else\r\n              edge->link  = edge2;\r\n          }\r\n\r\n          seg = seg->edge_next;\r\n\r\n        } while ( seg != edge->first );\r\n\r\n        /* set the round/straight flags */\r\n        edge->flags = AF_EDGE_NORMAL;\r\n\r\n        if ( is_round > 0 && is_round >= is_straight )\r\n          edge->flags |= AF_EDGE_ROUND;\r\n\r\n#if 0\r\n        /* set the edge's main direction */\r\n        edge->dir = AF_DIR_NONE;\r\n\r\n        if ( ups > downs )\r\n          edge->dir = (FT_Char)up_dir;\r\n\r\n        else if ( ups < downs )\r\n          edge->dir = (FT_Char)-up_dir;\r\n\r\n        else if ( ups == downs )\r\n          edge->dir = 0;  /* both up and down! */\r\n#endif\r\n\r\n        /* gets rid of serifs if link is set                */\r\n        /* XXX: This gets rid of many unpleasant artefacts! */\r\n        /*      Example: the `c' in cour.pfa at size 13     */\r\n\r\n        if ( edge->serif && edge->link )\r\n          edge->serif = 0;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_latin2_hints_detect_features( AF_GlyphHints  hints,\r\n                                   AF_Dimension   dim )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = af_latin2_hints_compute_segments( hints, dim );\r\n    if ( !error )\r\n    {\r\n      af_latin2_hints_link_segments( hints, dim );\r\n\r\n      error = af_latin2_hints_compute_edges( hints, dim );\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_hints_compute_blue_edges( AF_GlyphHints    hints,\r\n                                      AF_LatinMetrics  metrics )\r\n  {\r\n    AF_AxisHints  axis       = &hints->axis[AF_DIMENSION_VERT];\r\n    AF_Edge       edge       = axis->edges;\r\n    AF_Edge       edge_limit = edge + axis->num_edges;\r\n    AF_LatinAxis  latin      = &metrics->axis[AF_DIMENSION_VERT];\r\n    FT_Fixed      scale      = latin->scale;\r\n    FT_Pos        best_dist0;  /* initial threshold */\r\n\r\n\r\n    /* compute the initial threshold as a fraction of the EM size */\r\n    best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale );\r\n\r\n    if ( best_dist0 > 64 / 2 )\r\n      best_dist0 = 64 / 2;\r\n\r\n    /* compute which blue zones are active, i.e. have their scaled */\r\n    /* size < 3/4 pixels                                           */\r\n\r\n    /* for each horizontal edge search the blue zone which is closest */\r\n    for ( ; edge < edge_limit; edge++ )\r\n    {\r\n      FT_Int    bb;\r\n      AF_Width  best_blue = NULL;\r\n      FT_Pos    best_dist = best_dist0;\r\n\r\n      for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )\r\n      {\r\n        AF_LatinBlue  blue = latin->blues + bb;\r\n        FT_Bool       is_top_blue, is_major_dir;\r\n\r\n\r\n        /* skip inactive blue zones (i.e., those that are too small) */\r\n        if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) )\r\n          continue;\r\n\r\n        /* if it is a top zone, check for right edges -- if it is a bottom */\r\n        /* zone, check for left edges                                      */\r\n        /*                                                                 */\r\n        /* of course, that's for TrueType                                  */\r\n        is_top_blue  = (FT_Byte)( ( blue->flags & AF_LATIN_BLUE_TOP ) != 0 );\r\n        is_major_dir = FT_BOOL( edge->dir == axis->major_dir );\r\n\r\n        /* if it is a top zone, the edge must be against the major    */\r\n        /* direction; if it is a bottom zone, it must be in the major */\r\n        /* direction                                                  */\r\n        if ( is_top_blue ^ is_major_dir )\r\n        {\r\n          FT_Pos     dist;\r\n          AF_Width   compare;\r\n\r\n\r\n          /* if it's a rounded edge, compare it to the overshoot position */\r\n          /* if it's a flat edge, compare it to the reference position    */\r\n          if ( edge->flags & AF_EDGE_ROUND )\r\n            compare = &blue->shoot;\r\n          else\r\n            compare = &blue->ref;\r\n\r\n          dist = edge->fpos - compare->org;\r\n          if (dist < 0)\r\n            dist = -dist;\r\n\r\n          dist = FT_MulFix( dist, scale );\r\n          if ( dist < best_dist )\r\n          {\r\n            best_dist = dist;\r\n            best_blue = compare;\r\n          }\r\n\r\n#if 0\r\n          /* now, compare it to the overshoot position if the edge is     */\r\n          /* rounded, and if the edge is over the reference position of a */\r\n          /* top zone, or under the reference position of a bottom zone   */\r\n          if ( edge->flags & AF_EDGE_ROUND && dist != 0 )\r\n          {\r\n            FT_Bool  is_under_ref = FT_BOOL( edge->fpos < blue->ref.org );\r\n\r\n\r\n            if ( is_top_blue ^ is_under_ref )\r\n            {\r\n              blue = latin->blues + bb;\r\n              dist = edge->fpos - blue->shoot.org;\r\n              if ( dist < 0 )\r\n                dist = -dist;\r\n\r\n              dist = FT_MulFix( dist, scale );\r\n              if ( dist < best_dist )\r\n              {\r\n                best_dist = dist;\r\n                best_blue = & blue->shoot;\r\n              }\r\n            }\r\n          }\r\n#endif\r\n        }\r\n      }\r\n\r\n      if ( best_blue )\r\n        edge->blue_edge = best_blue;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_latin2_hints_init( AF_GlyphHints    hints,\r\n                        AF_LatinMetrics  metrics )\r\n  {\r\n    FT_Render_Mode  mode;\r\n    FT_UInt32       scaler_flags, other_flags;\r\n    FT_Face         face = metrics->root.scaler.face;\r\n\r\n\r\n    af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics );\r\n\r\n    /*\r\n     *  correct x_scale and y_scale if needed, since they may have\r\n     *  been modified `af_latin2_metrics_scale_dim' above\r\n     */\r\n    hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale;\r\n    hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta;\r\n    hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale;\r\n    hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta;\r\n\r\n    /* compute flags depending on render mode, etc. */\r\n    mode = metrics->root.scaler.render_mode;\r\n\r\n#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */\r\n    if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )\r\n    {\r\n      metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;\r\n    }\r\n#endif\r\n\r\n    scaler_flags = hints->scaler_flags;\r\n    other_flags  = 0;\r\n\r\n    /*\r\n     *  We snap the width of vertical stems for the monochrome and\r\n     *  horizontal LCD rendering targets only.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )\r\n      other_flags |= AF_LATIN_HINTS_HORZ_SNAP;\r\n\r\n    /*\r\n     *  We snap the width of horizontal stems for the monochrome and\r\n     *  vertical LCD rendering targets only.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )\r\n      other_flags |= AF_LATIN_HINTS_VERT_SNAP;\r\n\r\n    /*\r\n     *  We adjust stems to full pixels only if we don't use the `light' mode.\r\n     */\r\n    if ( mode != FT_RENDER_MODE_LIGHT )\r\n      other_flags |= AF_LATIN_HINTS_STEM_ADJUST;\r\n\r\n    if ( mode == FT_RENDER_MODE_MONO )\r\n      other_flags |= AF_LATIN_HINTS_MONO;\r\n\r\n    /*\r\n     *  In `light' hinting mode we disable horizontal hinting completely.\r\n     *  We also do it if the face is italic.\r\n     */\r\n    if ( mode == FT_RENDER_MODE_LIGHT                    ||\r\n         (face->style_flags & FT_STYLE_FLAG_ITALIC) != 0 )\r\n      scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;\r\n\r\n    hints->scaler_flags = scaler_flags;\r\n    hints->other_flags  = other_flags;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****        L A T I N   G L Y P H   G R I D - F I T T I N G        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* snap a given width in scaled coordinates to one of the */\r\n  /* current standard widths                                */\r\n\r\n  static FT_Pos\r\n  af_latin2_snap_width( AF_Width  widths,\r\n                        FT_Int    count,\r\n                        FT_Pos    width )\r\n  {\r\n    int     n;\r\n    FT_Pos  best      = 64 + 32 + 2;\r\n    FT_Pos  reference = width;\r\n    FT_Pos  scaled;\r\n\r\n\r\n    for ( n = 0; n < count; n++ )\r\n    {\r\n      FT_Pos  w;\r\n      FT_Pos  dist;\r\n\r\n\r\n      w = widths[n].cur;\r\n      dist = width - w;\r\n      if ( dist < 0 )\r\n        dist = -dist;\r\n      if ( dist < best )\r\n      {\r\n        best      = dist;\r\n        reference = w;\r\n      }\r\n    }\r\n\r\n    scaled = FT_PIX_ROUND( reference );\r\n\r\n    if ( width >= reference )\r\n    {\r\n      if ( width < scaled + 48 )\r\n        width = reference;\r\n    }\r\n    else\r\n    {\r\n      if ( width > scaled - 48 )\r\n        width = reference;\r\n    }\r\n\r\n    return width;\r\n  }\r\n\r\n\r\n  /* compute the snapped width of a given stem */\r\n\r\n  static FT_Pos\r\n  af_latin2_compute_stem_width( AF_GlyphHints  hints,\r\n                                AF_Dimension   dim,\r\n                                FT_Pos         width,\r\n                                AF_Edge_Flags  base_flags,\r\n                                AF_Edge_Flags  stem_flags )\r\n  {\r\n    AF_LatinMetrics  metrics  = (AF_LatinMetrics) hints->metrics;\r\n    AF_LatinAxis     axis     = & metrics->axis[dim];\r\n    FT_Pos           dist     = width;\r\n    FT_Int           sign     = 0;\r\n    FT_Int           vertical = ( dim == AF_DIMENSION_VERT );\r\n\r\n\r\n    FT_UNUSED(base_flags);\r\n\r\n    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) ||\r\n          axis->extra_light                      )\r\n      return width;\r\n\r\n    if ( dist < 0 )\r\n    {\r\n      dist = -width;\r\n      sign = 1;\r\n    }\r\n\r\n    if ( (  vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||\r\n         ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )\r\n    {\r\n      /* smooth hinting process: very lightly quantize the stem width */\r\n\r\n      /* leave the widths of serifs alone */\r\n\r\n      if ( ( stem_flags & AF_EDGE_SERIF ) && vertical && ( dist < 3 * 64 ) )\r\n        goto Done_Width;\r\n\r\n#if 0\r\n      else if ( ( base_flags & AF_EDGE_ROUND ) )\r\n      {\r\n        if ( dist < 80 )\r\n          dist = 64;\r\n      }\r\n      else if ( dist < 56 )\r\n        dist = 56;\r\n#endif\r\n      if ( axis->width_count > 0 )\r\n      {\r\n        FT_Pos  delta;\r\n\r\n\r\n        /* compare to standard width */\r\n        if ( axis->width_count > 0 )\r\n        {\r\n          delta = dist - axis->widths[0].cur;\r\n\r\n          if ( delta < 0 )\r\n            delta = -delta;\r\n\r\n          if ( delta < 40 )\r\n          {\r\n            dist = axis->widths[0].cur;\r\n            if ( dist < 48 )\r\n              dist = 48;\r\n\r\n            goto Done_Width;\r\n          }\r\n        }\r\n\r\n        if ( dist < 3 * 64 )\r\n        {\r\n          delta  = dist & 63;\r\n          dist  &= -64;\r\n\r\n          if ( delta < 10 )\r\n            dist += delta;\r\n\r\n          else if ( delta < 32 )\r\n            dist += 10;\r\n\r\n          else if ( delta < 54 )\r\n            dist += 54;\r\n\r\n          else\r\n            dist += delta;\r\n        }\r\n        else\r\n          dist = ( dist + 32 ) & ~63;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* strong hinting process: snap the stem width to integer pixels */\r\n      FT_Pos  org_dist = dist;\r\n\r\n\r\n      dist = af_latin2_snap_width( axis->widths, axis->width_count, dist );\r\n\r\n      if ( vertical )\r\n      {\r\n        /* in the case of vertical hinting, always round */\r\n        /* the stem heights to integer pixels            */\r\n\r\n        if ( dist >= 64 )\r\n          dist = ( dist + 16 ) & ~63;\r\n        else\r\n          dist = 64;\r\n      }\r\n      else\r\n      {\r\n        if ( AF_LATIN_HINTS_DO_MONO( hints ) )\r\n        {\r\n          /* monochrome horizontal hinting: snap widths to integer pixels */\r\n          /* with a different threshold                                   */\r\n\r\n          if ( dist < 64 )\r\n            dist = 64;\r\n          else\r\n            dist = ( dist + 32 ) & ~63;\r\n        }\r\n        else\r\n        {\r\n          /* for horizontal anti-aliased hinting, we adopt a more subtle */\r\n          /* approach: we strengthen small stems, round stems whose size */\r\n          /* is between 1 and 2 pixels to an integer, otherwise nothing  */\r\n\r\n          if ( dist < 48 )\r\n            dist = ( dist + 64 ) >> 1;\r\n\r\n          else if ( dist < 128 )\r\n          {\r\n            /* We only round to an integer width if the corresponding */\r\n            /* distortion is less than 1/4 pixel.  Otherwise this     */\r\n            /* makes everything worse since the diagonals, which are  */\r\n            /* not hinted, appear a lot bolder or thinner than the    */\r\n            /* vertical stems.                                        */\r\n\r\n            FT_Int  delta;\r\n\r\n\r\n            dist = ( dist + 22 ) & ~63;\r\n            delta = dist - org_dist;\r\n            if ( delta < 0 )\r\n              delta = -delta;\r\n\r\n            if (delta >= 16)\r\n            {\r\n              dist = org_dist;\r\n              if ( dist < 48 )\r\n                dist = ( dist + 64 ) >> 1;\r\n            }\r\n          }\r\n          else\r\n            /* round otherwise to prevent color fringes in LCD mode */\r\n            dist = ( dist + 32 ) & ~63;\r\n        }\r\n      }\r\n    }\r\n\r\n  Done_Width:\r\n    if ( sign )\r\n      dist = -dist;\r\n\r\n    return dist;\r\n  }\r\n\r\n\r\n  /* align one stem edge relative to the previous stem edge */\r\n\r\n  static void\r\n  af_latin2_align_linked_edge( AF_GlyphHints  hints,\r\n                               AF_Dimension   dim,\r\n                               AF_Edge        base_edge,\r\n                               AF_Edge        stem_edge )\r\n  {\r\n    FT_Pos  dist = stem_edge->opos - base_edge->opos;\r\n\r\n    FT_Pos  fitted_width = af_latin2_compute_stem_width(\r\n                             hints, dim, dist,\r\n                             (AF_Edge_Flags)base_edge->flags,\r\n                             (AF_Edge_Flags)stem_edge->flags );\r\n\r\n\r\n    stem_edge->pos = base_edge->pos + fitted_width;\r\n\r\n    FT_TRACE5(( \"LINK: edge %d (opos=%.2f) linked to (%.2f), \"\r\n                \"dist was %.2f, now %.2f\\n\",\r\n                stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0,\r\n                stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));\r\n  }\r\n\r\n\r\n  static void\r\n  af_latin2_align_serif_edge( AF_GlyphHints  hints,\r\n                              AF_Edge        base,\r\n                              AF_Edge        serif )\r\n  {\r\n    FT_UNUSED( hints );\r\n\r\n    serif->pos = base->pos + (serif->opos - base->opos);\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                    E D G E   H I N T I N G                      ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_latin2_hint_edges( AF_GlyphHints  hints,\r\n                        AF_Dimension   dim )\r\n  {\r\n    AF_AxisHints  axis       = &hints->axis[dim];\r\n    AF_Edge       edges      = axis->edges;\r\n    AF_Edge       edge_limit = edges + axis->num_edges;\r\n    AF_Edge       edge;\r\n    AF_Edge       anchor     = 0;\r\n    FT_Int        has_serifs = 0;\r\n    FT_Pos        anchor_drift = 0;\r\n\r\n\r\n\r\n    FT_TRACE5(( \"==== hinting %s edges =====\\n\",\r\n                dim == AF_DIMENSION_HORZ ? \"vertical\" : \"horizontal\" ));\r\n\r\n    /* we begin by aligning all stems relative to the blue zone */\r\n    /* if needed -- that's only for horizontal edges            */\r\n\r\n    if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES( hints ) )\r\n    {\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        AF_Width  blue;\r\n        AF_Edge   edge1, edge2;\r\n\r\n\r\n        if ( edge->flags & AF_EDGE_DONE )\r\n          continue;\r\n\r\n        blue  = edge->blue_edge;\r\n        edge1 = NULL;\r\n        edge2 = edge->link;\r\n\r\n        if ( blue )\r\n        {\r\n          edge1 = edge;\r\n        }\r\n        else if ( edge2 && edge2->blue_edge )\r\n        {\r\n          blue  = edge2->blue_edge;\r\n          edge1 = edge2;\r\n          edge2 = edge;\r\n        }\r\n\r\n        if ( !edge1 )\r\n          continue;\r\n\r\n        FT_TRACE5(( \"BLUE: edge %d (opos=%.2f) snapped to (%.2f), \"\r\n                    \"was (%.2f)\\n\",\r\n                    edge1-edges, edge1->opos / 64.0, blue->fit / 64.0,\r\n                    edge1->pos / 64.0 ));\r\n\r\n        edge1->pos    = blue->fit;\r\n        edge1->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge2 && !edge2->blue_edge )\r\n        {\r\n          af_latin2_align_linked_edge( hints, dim, edge1, edge2 );\r\n          edge2->flags |= AF_EDGE_DONE;\r\n        }\r\n\r\n        if ( !anchor )\r\n        {\r\n          anchor = edge;\r\n\r\n          anchor_drift = (anchor->pos - anchor->opos);\r\n          if (edge2)\r\n            anchor_drift = (anchor_drift + (edge2->pos - edge2->opos)) >> 1;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* now we will align all stem edges, trying to maintain the */\r\n    /* relative order of stems in the glyph                     */\r\n    for ( edge = edges; edge < edge_limit; edge++ )\r\n    {\r\n      AF_Edge  edge2;\r\n\r\n\r\n      if ( edge->flags & AF_EDGE_DONE )\r\n        continue;\r\n\r\n      /* skip all non-stem edges */\r\n      edge2 = edge->link;\r\n      if ( !edge2 )\r\n      {\r\n        has_serifs++;\r\n        continue;\r\n      }\r\n\r\n      /* now align the stem */\r\n\r\n      /* this should not happen, but it's better to be safe */\r\n      if ( edge2->blue_edge )\r\n      {\r\n        FT_TRACE5(( \"ASSERTION FAILED for edge %d\\n\", edge2-edges ));\r\n\r\n        af_latin2_align_linked_edge( hints, dim, edge2, edge );\r\n        edge->flags |= AF_EDGE_DONE;\r\n        continue;\r\n      }\r\n\r\n      if ( !anchor )\r\n      {\r\n        FT_Pos  org_len, org_center, cur_len;\r\n        FT_Pos  cur_pos1, error1, error2, u_off, d_off;\r\n\r\n\r\n        org_len = edge2->opos - edge->opos;\r\n        cur_len = af_latin2_compute_stem_width(\r\n                    hints, dim, org_len,\r\n                    (AF_Edge_Flags)edge->flags,\r\n                    (AF_Edge_Flags)edge2->flags );\r\n        if ( cur_len <= 64 )\r\n          u_off = d_off = 32;\r\n        else\r\n        {\r\n          u_off = 38;\r\n          d_off = 26;\r\n        }\r\n\r\n        if ( cur_len < 96 )\r\n        {\r\n          org_center = edge->opos + ( org_len >> 1 );\r\n\r\n          cur_pos1   = FT_PIX_ROUND( org_center );\r\n\r\n          error1 = org_center - ( cur_pos1 - u_off );\r\n          if ( error1 < 0 )\r\n            error1 = -error1;\r\n\r\n          error2 = org_center - ( cur_pos1 + d_off );\r\n          if ( error2 < 0 )\r\n            error2 = -error2;\r\n\r\n          if ( error1 < error2 )\r\n            cur_pos1 -= u_off;\r\n          else\r\n            cur_pos1 += d_off;\r\n\r\n          edge->pos  = cur_pos1 - cur_len / 2;\r\n          edge2->pos = edge->pos + cur_len;\r\n        }\r\n        else\r\n          edge->pos = FT_PIX_ROUND( edge->opos );\r\n\r\n        FT_TRACE5(( \"ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)\"\r\n                    \" snapped to (%.2f) (%.2f)\\n\",\r\n                    edge-edges, edge->opos / 64.0,\r\n                    edge2-edges, edge2->opos / 64.0,\r\n                    edge->pos / 64.0, edge2->pos / 64.0 ));\r\n        anchor = edge;\r\n\r\n        edge->flags |= AF_EDGE_DONE;\r\n\r\n        af_latin2_align_linked_edge( hints, dim, edge, edge2 );\r\n\r\n        edge2->flags |= AF_EDGE_DONE;\r\n\r\n        anchor_drift = ( (anchor->pos - anchor->opos) +\r\n                         (edge2->pos - edge2->opos)) >> 1;\r\n\r\n        FT_TRACE5(( \"DRIFT: %.2f\\n\", anchor_drift/64.0 ));\r\n      }\r\n      else\r\n      {\r\n        FT_Pos   org_pos, org_len, org_center, cur_center, cur_len;\r\n        FT_Pos   org_left, org_right;\r\n\r\n\r\n        org_pos    = edge->opos + anchor_drift;\r\n        org_len    = edge2->opos - edge->opos;\r\n        org_center = org_pos + ( org_len >> 1 );\r\n\r\n        cur_len = af_latin2_compute_stem_width(\r\n                   hints, dim, org_len,\r\n                   (AF_Edge_Flags)edge->flags,\r\n                   (AF_Edge_Flags)edge2->flags );\r\n\r\n        org_left  = org_pos + ((org_len - cur_len) >> 1);\r\n        org_right = org_pos + ((org_len + cur_len) >> 1);\r\n\r\n        FT_TRACE5(( \"ALIGN: left=%.2f right=%.2f \",\r\n                    org_left / 64.0, org_right / 64.0 ));\r\n        cur_center = org_center;\r\n\r\n        if ( edge2->flags & AF_EDGE_DONE )\r\n        {\r\n          FT_TRACE5(( \"\\n\" ));\r\n          edge->pos = edge2->pos - cur_len;\r\n        }\r\n        else\r\n        {\r\n         /* we want to compare several displacement, and choose\r\n          * the one that increases fitness while minimizing\r\n          * distortion as well\r\n          */\r\n          FT_Pos   displacements[6], scores[6], org, fit, delta;\r\n          FT_UInt  count = 0;\r\n\r\n          /* note: don't even try to fit tiny stems */\r\n          if ( cur_len < 32 )\r\n          {\r\n            FT_TRACE5(( \"tiny stem\\n\" ));\r\n            goto AlignStem;\r\n          }\r\n\r\n          /* if the span is within a single pixel, don't touch it */\r\n          if ( FT_PIX_FLOOR(org_left) == FT_PIX_CEIL(org_right) )\r\n          {\r\n            FT_TRACE5(( \"single pixel stem\\n\" ));\r\n            goto AlignStem;\r\n          }\r\n\r\n          if (cur_len <= 96)\r\n          {\r\n           /* we want to avoid the absolute worst case which is\r\n            * when the left and right edges of the span each represent\r\n            * about 50% of the gray. we'd better want to change this\r\n            * to 25/75%, since this is much more pleasant to the eye with\r\n            * very acceptable distortion\r\n            */\r\n            FT_Pos  frac_left  = (org_left) & 63;\r\n            FT_Pos  frac_right = (org_right) & 63;\r\n\r\n            if ( frac_left  >= 22 && frac_left  <= 42 &&\r\n                 frac_right >= 22 && frac_right <= 42 )\r\n            {\r\n              org = frac_left;\r\n              fit = (org <= 32) ? 16 : 48;\r\n              delta = FT_ABS(fit - org);\r\n              displacements[count] = fit - org;\r\n              scores[count++]      = delta;\r\n              FT_TRACE5(( \"dispA=%.2f (%d) \", (fit - org) / 64.0, delta ));\r\n\r\n              org = frac_right;\r\n              fit = (org <= 32) ? 16 : 48;\r\n              delta = FT_ABS(fit - org);\r\n              displacements[count] = fit - org;\r\n              scores[count++]     = delta;\r\n              FT_TRACE5(( \"dispB=%.2f (%d) \", (fit - org) / 64.0, delta ));\r\n            }\r\n          }\r\n\r\n          /* snapping the left edge to the grid */\r\n          org   = org_left;\r\n          fit   = FT_PIX_ROUND(org);\r\n          delta = FT_ABS(fit - org);\r\n          displacements[count] = fit - org;\r\n          scores[count++]      = delta;\r\n          FT_TRACE5(( \"dispC=%.2f (%d) \", (fit - org) / 64.0, delta ));\r\n\r\n          /* snapping the right edge to the grid */\r\n          org   = org_right;\r\n          fit   = FT_PIX_ROUND(org);\r\n          delta = FT_ABS(fit - org);\r\n          displacements[count] = fit - org;\r\n          scores[count++]      = delta;\r\n          FT_TRACE5(( \"dispD=%.2f (%d) \", (fit - org) / 64.0, delta ));\r\n\r\n          /* now find the best displacement */\r\n          {\r\n            FT_Pos  best_score = scores[0];\r\n            FT_Pos  best_disp  = displacements[0];\r\n            FT_UInt nn;\r\n\r\n            for (nn = 1; nn < count; nn++)\r\n            {\r\n              if (scores[nn] < best_score)\r\n              {\r\n                best_score = scores[nn];\r\n                best_disp  = displacements[nn];\r\n              }\r\n            }\r\n\r\n            cur_center = org_center + best_disp;\r\n          }\r\n          FT_TRACE5(( \"\\n\" ));\r\n        }\r\n\r\n      AlignStem:\r\n        edge->pos  = cur_center - (cur_len >> 1);\r\n        edge2->pos = edge->pos + cur_len;\r\n\r\n        FT_TRACE5(( \"STEM1: %d (opos=%.2f) to %d (opos=%.2f)\"\r\n                    \" snapped to (%.2f) and (%.2f),\"\r\n                    \" org_len=%.2f cur_len=%.2f\\n\",\r\n                    edge-edges, edge->opos / 64.0,\r\n                    edge2-edges, edge2->opos / 64.0,\r\n                    edge->pos / 64.0, edge2->pos / 64.0,\r\n                    org_len / 64.0, cur_len / 64.0 ));\r\n\r\n        edge->flags  |= AF_EDGE_DONE;\r\n        edge2->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge > edges && edge->pos < edge[-1].pos )\r\n        {\r\n          FT_TRACE5(( \"BOUND: %d (pos=%.2f) to (%.2f)\\n\",\r\n                      edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));\r\n          edge->pos = edge[-1].pos;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* make sure that lowercase m's maintain their symmetry */\r\n\r\n    /* In general, lowercase m's have six vertical edges if they are sans */\r\n    /* serif, or twelve if they are with serifs.  This implementation is  */\r\n    /* based on that assumption, and seems to work very well with most    */\r\n    /* faces.  However, if for a certain face this assumption is not      */\r\n    /* true, the m is just rendered like before.  In addition, any stem   */\r\n    /* correction will only be applied to symmetrical glyphs (even if the */\r\n    /* glyph is not an m), so the potential for unwanted distortion is    */\r\n    /* relatively low.                                                    */\r\n\r\n    /* We don't handle horizontal edges since we can't easily assure that */\r\n    /* the third (lowest) stem aligns with the base line; it might end up */\r\n    /* one pixel higher or lower.                                         */\r\n\r\n#if 0\r\n    {\r\n      FT_Int  n_edges = edge_limit - edges;\r\n\r\n\r\n      if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) )\r\n      {\r\n        AF_Edge  edge1, edge2, edge3;\r\n        FT_Pos   dist1, dist2, span, delta;\r\n\r\n\r\n        if ( n_edges == 6 )\r\n        {\r\n          edge1 = edges;\r\n          edge2 = edges + 2;\r\n          edge3 = edges + 4;\r\n        }\r\n        else\r\n        {\r\n          edge1 = edges + 1;\r\n          edge2 = edges + 5;\r\n          edge3 = edges + 9;\r\n        }\r\n\r\n        dist1 = edge2->opos - edge1->opos;\r\n        dist2 = edge3->opos - edge2->opos;\r\n\r\n        span = dist1 - dist2;\r\n        if ( span < 0 )\r\n          span = -span;\r\n\r\n        if ( span < 8 )\r\n        {\r\n          delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );\r\n          edge3->pos -= delta;\r\n          if ( edge3->link )\r\n            edge3->link->pos -= delta;\r\n\r\n          /* move the serifs along with the stem */\r\n          if ( n_edges == 12 )\r\n          {\r\n            ( edges + 8 )->pos -= delta;\r\n            ( edges + 11 )->pos -= delta;\r\n          }\r\n\r\n          edge3->flags |= AF_EDGE_DONE;\r\n          if ( edge3->link )\r\n            edge3->link->flags |= AF_EDGE_DONE;\r\n        }\r\n      }\r\n    }\r\n#endif\r\n\r\n    if ( has_serifs || !anchor )\r\n    {\r\n      /*\r\n       *  now hint the remaining edges (serifs and single) in order\r\n       *  to complete our processing\r\n       */\r\n      for ( edge = edges; edge < edge_limit; edge++ )\r\n      {\r\n        FT_Pos  delta;\r\n\r\n\r\n        if ( edge->flags & AF_EDGE_DONE )\r\n          continue;\r\n\r\n        delta = 1000;\r\n\r\n        if ( edge->serif )\r\n        {\r\n          delta = edge->serif->opos - edge->opos;\r\n          if ( delta < 0 )\r\n            delta = -delta;\r\n        }\r\n\r\n        if ( delta < 64 + 16 )\r\n        {\r\n          af_latin2_align_serif_edge( hints, edge->serif, edge );\r\n          FT_TRACE5(( \"SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)\"\r\n                      \" aligned to (%.2f)\\n\",\r\n                      edge-edges, edge->opos / 64.0,\r\n                      edge->serif - edges, edge->serif->opos / 64.0,\r\n                      edge->pos / 64.0 ));\r\n        }\r\n        else if ( !anchor )\r\n        {\r\n          FT_TRACE5(( \"SERIF_ANCHOR: edge %d (opos=%.2f)\"\r\n                      \" snapped to (%.2f)\\n\",\r\n                      edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));\r\n          edge->pos = FT_PIX_ROUND( edge->opos );\r\n          anchor    = edge;\r\n        }\r\n        else\r\n        {\r\n          AF_Edge  before, after;\r\n\r\n\r\n          for ( before = edge - 1; before >= edges; before-- )\r\n            if ( before->flags & AF_EDGE_DONE )\r\n              break;\r\n\r\n          for ( after = edge + 1; after < edge_limit; after++ )\r\n            if ( after->flags & AF_EDGE_DONE )\r\n              break;\r\n\r\n          if ( before >= edges && before < edge   &&\r\n               after < edge_limit && after > edge )\r\n          {\r\n            if ( after->opos == before->opos )\r\n              edge->pos = before->pos;\r\n            else\r\n              edge->pos = before->pos +\r\n                          FT_MulDiv( edge->opos - before->opos,\r\n                                     after->pos - before->pos,\r\n                                     after->opos - before->opos );\r\n            FT_TRACE5(( \"SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)\"\r\n                        \" from %d (opos=%.2f)\\n\",\r\n                        edge-edges, edge->opos / 64.0, edge->pos / 64.0,\r\n                        before - edges, before->opos / 64.0 ));\r\n          }\r\n          else\r\n          {\r\n            edge->pos = anchor->pos +\r\n                        ( ( edge->opos - anchor->opos + 16 ) & ~31 );\r\n\r\n            FT_TRACE5(( \"SERIF_LINK2: edge %d (opos=%.2f)\"\r\n                        \" snapped to (%.2f)\\n\",\r\n                        edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));\r\n          }\r\n        }\r\n\r\n        edge->flags |= AF_EDGE_DONE;\r\n\r\n        if ( edge > edges && edge->pos < edge[-1].pos )\r\n          edge->pos = edge[-1].pos;\r\n\r\n        if ( edge + 1 < edge_limit        &&\r\n             edge[1].flags & AF_EDGE_DONE &&\r\n             edge->pos > edge[1].pos      )\r\n          edge->pos = edge[1].pos;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  af_latin2_hints_apply( AF_GlyphHints    hints,\r\n                         FT_Outline*      outline,\r\n                         AF_LatinMetrics  metrics )\r\n  {\r\n    FT_Error  error;\r\n    int       dim;\r\n\r\n\r\n    error = af_glyph_hints_reload( hints, outline );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* analyze glyph outline */\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n    if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||\r\n         AF_HINTS_DO_HORIZONTAL( hints ) )\r\n#else\r\n    if ( AF_HINTS_DO_HORIZONTAL( hints ) )\r\n#endif\r\n    {\r\n      error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( AF_HINTS_DO_VERTICAL( hints ) )\r\n    {\r\n      error = af_latin2_hints_detect_features( hints, AF_DIMENSION_VERT );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      af_latin2_hints_compute_blue_edges( hints, metrics );\r\n    }\r\n\r\n    /* grid-fit the outline */\r\n    for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )\r\n    {\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n      if ( ( dim == AF_DIMENSION_HORZ &&\r\n             metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) )\r\n      {\r\n        AF_WarperRec  warper;\r\n        FT_Fixed      scale;\r\n        FT_Pos        delta;\r\n\r\n\r\n        af_warper_compute( &warper, hints, dim, &scale, &delta );\r\n        af_glyph_hints_scale_dim( hints, dim, scale, delta );\r\n        continue;\r\n      }\r\n#endif\r\n\r\n      if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||\r\n           ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) )   )\r\n      {\r\n        af_latin2_hint_edges( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim );\r\n        af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim );\r\n      }\r\n    }\r\n    af_glyph_hints_save( hints, outline );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****              L A T I N   S C R I P T   C L A S S              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  static const AF_Script_UniRangeRec  af_latin2_uniranges[] =\r\n  {\r\n    AF_UNIRANGE_REC( 32UL,  127UL ),    /* TODO: Add new Unicode ranges here! */\r\n    AF_UNIRANGE_REC( 160UL, 255UL ),\r\n    AF_UNIRANGE_REC( 0UL,   0UL )\r\n  };\r\n\r\n\r\n  AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class,\r\n    AF_SCRIPT_LATIN2,\r\n    af_latin2_uniranges,\r\n    'o',\r\n\r\n    sizeof ( AF_LatinMetricsRec ),\r\n\r\n    (AF_Script_InitMetricsFunc) af_latin2_metrics_init,\r\n    (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale,\r\n    (AF_Script_DoneMetricsFunc) NULL,\r\n\r\n    (AF_Script_InitHintsFunc)   af_latin2_hints_init,\r\n    (AF_Script_ApplyHintsFunc)  af_latin2_hints_apply\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/aflatin2.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  aflatin2.h                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter hinting routines for latin script (specification).       */\r\n/*                                                                         */\r\n/*  Copyright 2003-2007, 2012 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFLATIN2_H__\r\n#define __AFLATIN2_H__\r\n\r\n#include \"afhints.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* the latin-specific script class */\r\n\r\n  AF_DECLARE_SCRIPT_CLASS( af_latin2_script_class )\r\n\r\n/* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFLATIN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afloader.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afloader.c                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter glyph loading routines (body).                           */\r\n/*                                                                         */\r\n/*  Copyright 2003-2009, 2011-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"afglobal.h\"\r\n#include \"afloader.h\"\r\n#include \"afhints.h\"\r\n#include \"aferrors.h\"\r\n#include \"afmodule.h\"\r\n\r\n\r\n  /* Initialize glyph loader. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_loader_init( AF_Module  module )\r\n  {\r\n    AF_Loader  loader = module->loader;\r\n    FT_Memory  memory = module->root.library->memory;\r\n\r\n\r\n    FT_ZERO( loader );\r\n\r\n    af_glyph_hints_init( &loader->hints, memory );\r\n#ifdef FT_DEBUG_AUTOFIT\r\n    _af_debug_hints = &loader->hints;\r\n#endif\r\n    return FT_GlyphLoader_New( memory, &loader->gloader );\r\n  }\r\n\r\n\r\n  /* Reset glyph loader and compute globals if necessary. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_loader_reset( AF_Module  module,\r\n                   FT_Face    face )\r\n  {\r\n    FT_Error   error  = AF_Err_Ok;\r\n    AF_Loader  loader = module->loader;\r\n\r\n\r\n    loader->face    = face;\r\n    loader->globals = (AF_FaceGlobals)face->autohint.data;\r\n\r\n    FT_GlyphLoader_Rewind( loader->gloader );\r\n\r\n    if ( loader->globals == NULL )\r\n    {\r\n      error = af_face_globals_new( face, &loader->globals, module );\r\n      if ( !error )\r\n      {\r\n        face->autohint.data =\r\n          (FT_Pointer)loader->globals;\r\n        face->autohint.finalizer =\r\n          (FT_Generic_Finalizer)af_face_globals_free;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Finalize glyph loader. */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_loader_done( AF_Module  module )\r\n  {\r\n    AF_Loader  loader = module->loader;\r\n\r\n\r\n    af_glyph_hints_done( &loader->hints );\r\n\r\n    loader->face    = NULL;\r\n    loader->globals = NULL;\r\n\r\n#ifdef FT_DEBUG_AUTOFIT\r\n    _af_debug_hints = NULL;\r\n#endif\r\n    FT_GlyphLoader_Done( loader->gloader );\r\n    loader->gloader = NULL;\r\n  }\r\n\r\n\r\n  /* Load a single glyph component.  This routine calls itself */\r\n  /* recursively, if necessary, and does the main work of      */\r\n  /* `af_loader_load_glyph.'                                   */\r\n\r\n  static FT_Error\r\n  af_loader_load_g( AF_Loader  loader,\r\n                    AF_Scaler  scaler,\r\n                    FT_UInt    glyph_index,\r\n                    FT_Int32   load_flags,\r\n                    FT_UInt    depth )\r\n  {\r\n    FT_Error          error;\r\n    FT_Face           face     = loader->face;\r\n    FT_GlyphLoader    gloader  = loader->gloader;\r\n    AF_ScriptMetrics  metrics  = loader->metrics;\r\n    AF_GlyphHints     hints    = &loader->hints;\r\n    FT_GlyphSlot      slot     = face->glyph;\r\n    FT_Slot_Internal  internal = slot->internal;\r\n    FT_Int32          flags;\r\n\r\n\r\n    flags = load_flags | FT_LOAD_LINEAR_DESIGN;\r\n    error = FT_Load_Glyph( face, glyph_index, flags );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    loader->transformed = internal->glyph_transformed;\r\n    if ( loader->transformed )\r\n    {\r\n      FT_Matrix  inverse;\r\n\r\n\r\n      loader->trans_matrix = internal->glyph_matrix;\r\n      loader->trans_delta  = internal->glyph_delta;\r\n\r\n      inverse = loader->trans_matrix;\r\n      FT_Matrix_Invert( &inverse );\r\n      FT_Vector_Transform( &loader->trans_delta, &inverse );\r\n    }\r\n\r\n    switch ( slot->format )\r\n    {\r\n    case FT_GLYPH_FORMAT_OUTLINE:\r\n      /* translate the loaded glyph when an internal transform is needed */\r\n      if ( loader->transformed )\r\n        FT_Outline_Translate( &slot->outline,\r\n                              loader->trans_delta.x,\r\n                              loader->trans_delta.y );\r\n\r\n      /* copy the outline points in the loader's current                */\r\n      /* extra points which are used to keep original glyph coordinates */\r\n      error = FT_GLYPHLOADER_CHECK_POINTS( gloader,\r\n                                           slot->outline.n_points + 4,\r\n                                           slot->outline.n_contours );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      FT_ARRAY_COPY( gloader->current.outline.points,\r\n                     slot->outline.points,\r\n                     slot->outline.n_points );\r\n\r\n      FT_ARRAY_COPY( gloader->current.outline.contours,\r\n                     slot->outline.contours,\r\n                     slot->outline.n_contours );\r\n\r\n      FT_ARRAY_COPY( gloader->current.outline.tags,\r\n                     slot->outline.tags,\r\n                     slot->outline.n_points );\r\n\r\n      gloader->current.outline.n_points   = slot->outline.n_points;\r\n      gloader->current.outline.n_contours = slot->outline.n_contours;\r\n\r\n      /* compute original horizontal phantom points (and ignore */\r\n      /* vertical ones)                                         */\r\n      loader->pp1.x = hints->x_delta;\r\n      loader->pp1.y = hints->y_delta;\r\n      loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,\r\n                                 hints->x_scale ) + hints->x_delta;\r\n      loader->pp2.y = hints->y_delta;\r\n\r\n      /* be sure to check for spacing glyphs */\r\n      if ( slot->outline.n_points == 0 )\r\n        goto Hint_Metrics;\r\n\r\n      /* now load the slot image into the auto-outline and run the */\r\n      /* automatic hinting process                                 */\r\n      if ( metrics->clazz->script_hints_apply )\r\n        metrics->clazz->script_hints_apply( hints,\r\n                                            &gloader->current.outline,\r\n                                            metrics );\r\n\r\n      /* we now need to adjust the metrics according to the change in */\r\n      /* width/positioning that occurred during the hinting process   */\r\n      if ( scaler->render_mode != FT_RENDER_MODE_LIGHT )\r\n      {\r\n        FT_Pos        old_rsb, old_lsb, new_lsb;\r\n        FT_Pos        pp1x_uh, pp2x_uh;\r\n        AF_AxisHints  axis  = &hints->axis[AF_DIMENSION_HORZ];\r\n        AF_Edge       edge1 = axis->edges;         /* leftmost edge  */\r\n        AF_Edge       edge2 = edge1 +\r\n                              axis->num_edges - 1; /* rightmost edge */\r\n\r\n\r\n        if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )\r\n        {\r\n          old_rsb = loader->pp2.x - edge2->opos;\r\n          old_lsb = edge1->opos;\r\n          new_lsb = edge1->pos;\r\n\r\n          /* remember unhinted values to later account */\r\n          /* for rounding errors                       */\r\n\r\n          pp1x_uh = new_lsb    - old_lsb;\r\n          pp2x_uh = edge2->pos + old_rsb;\r\n\r\n          /* prefer too much space over too little space */\r\n          /* for very small sizes                        */\r\n\r\n          if ( old_lsb < 24 )\r\n            pp1x_uh -= 8;\r\n\r\n          if ( old_rsb < 24 )\r\n            pp2x_uh += 8;\r\n\r\n          loader->pp1.x = FT_PIX_ROUND( pp1x_uh );\r\n          loader->pp2.x = FT_PIX_ROUND( pp2x_uh );\r\n\r\n          if ( loader->pp1.x >= new_lsb && old_lsb > 0 )\r\n            loader->pp1.x -= 64;\r\n\r\n          if ( loader->pp2.x <= edge2->pos && old_rsb > 0 )\r\n            loader->pp2.x += 64;\r\n\r\n          slot->lsb_delta = loader->pp1.x - pp1x_uh;\r\n          slot->rsb_delta = loader->pp2.x - pp2x_uh;\r\n        }\r\n        else\r\n        {\r\n          FT_Pos  pp1x = loader->pp1.x;\r\n          FT_Pos  pp2x = loader->pp2.x;\r\n\r\n\r\n          loader->pp1.x = FT_PIX_ROUND( pp1x );\r\n          loader->pp2.x = FT_PIX_ROUND( pp2x );\r\n\r\n          slot->lsb_delta = loader->pp1.x - pp1x;\r\n          slot->rsb_delta = loader->pp2.x - pp2x;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        FT_Pos  pp1x = loader->pp1.x;\r\n        FT_Pos  pp2x = loader->pp2.x;\r\n\r\n\r\n        loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );\r\n        loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );\r\n\r\n        slot->lsb_delta = loader->pp1.x - pp1x;\r\n        slot->rsb_delta = loader->pp2.x - pp2x;\r\n      }\r\n\r\n      /* good, we simply add the glyph to our loader's base */\r\n      FT_GlyphLoader_Add( gloader );\r\n      break;\r\n\r\n    case FT_GLYPH_FORMAT_COMPOSITE:\r\n      {\r\n        FT_UInt      nn, num_subglyphs = slot->num_subglyphs;\r\n        FT_UInt      num_base_subgs, start_point;\r\n        FT_SubGlyph  subglyph;\r\n\r\n\r\n        start_point = gloader->base.outline.n_points;\r\n\r\n        /* first of all, copy the subglyph descriptors in the glyph loader */\r\n        error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        FT_ARRAY_COPY( gloader->current.subglyphs,\r\n                       slot->subglyphs,\r\n                       num_subglyphs );\r\n\r\n        gloader->current.num_subglyphs = num_subglyphs;\r\n        num_base_subgs                 = gloader->base.num_subglyphs;\r\n\r\n        /* now read each subglyph independently */\r\n        for ( nn = 0; nn < num_subglyphs; nn++ )\r\n        {\r\n          FT_Vector  pp1, pp2;\r\n          FT_Pos     x, y;\r\n          FT_UInt    num_points, num_new_points, num_base_points;\r\n\r\n\r\n          /* gloader.current.subglyphs can change during glyph loading due */\r\n          /* to re-allocation -- we must recompute the current subglyph on */\r\n          /* each iteration                                                */\r\n          subglyph = gloader->base.subglyphs + num_base_subgs + nn;\r\n\r\n          pp1 = loader->pp1;\r\n          pp2 = loader->pp2;\r\n\r\n          num_base_points = gloader->base.outline.n_points;\r\n\r\n          error = af_loader_load_g( loader, scaler, subglyph->index,\r\n                                    load_flags, depth + 1 );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          /* recompute subglyph pointer */\r\n          subglyph = gloader->base.subglyphs + num_base_subgs + nn;\r\n\r\n          if ( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS )\r\n          {\r\n            pp1 = loader->pp1;\r\n            pp2 = loader->pp2;\r\n          }\r\n          else\r\n          {\r\n            loader->pp1 = pp1;\r\n            loader->pp2 = pp2;\r\n          }\r\n\r\n          num_points     = gloader->base.outline.n_points;\r\n          num_new_points = num_points - num_base_points;\r\n\r\n          /* now perform the transformation required for this subglyph */\r\n\r\n          if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE    |\r\n                                   FT_SUBGLYPH_FLAG_XY_SCALE |\r\n                                   FT_SUBGLYPH_FLAG_2X2      ) )\r\n          {\r\n            FT_Vector*  cur   = gloader->base.outline.points +\r\n                                num_base_points;\r\n            FT_Vector*  limit = cur + num_new_points;\r\n\r\n\r\n            for ( ; cur < limit; cur++ )\r\n              FT_Vector_Transform( cur, &subglyph->transform );\r\n          }\r\n\r\n          /* apply offset */\r\n\r\n          if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) )\r\n          {\r\n            FT_Int      k = subglyph->arg1;\r\n            FT_UInt     l = subglyph->arg2;\r\n            FT_Vector*  p1;\r\n            FT_Vector*  p2;\r\n\r\n\r\n            if ( start_point + k >= num_base_points         ||\r\n                               l >= (FT_UInt)num_new_points )\r\n            {\r\n              error = AF_Err_Invalid_Composite;\r\n              goto Exit;\r\n            }\r\n\r\n            l += num_base_points;\r\n\r\n            /* for now, only use the current point coordinates; */\r\n            /* we eventually may consider another approach      */\r\n            p1 = gloader->base.outline.points + start_point + k;\r\n            p2 = gloader->base.outline.points + start_point + l;\r\n\r\n            x = p1->x - p2->x;\r\n            y = p1->y - p2->y;\r\n          }\r\n          else\r\n          {\r\n            x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta;\r\n            y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta;\r\n\r\n            x = FT_PIX_ROUND( x );\r\n            y = FT_PIX_ROUND( y );\r\n          }\r\n\r\n          {\r\n            FT_Outline  dummy = gloader->base.outline;\r\n\r\n\r\n            dummy.points  += num_base_points;\r\n            dummy.n_points = (short)num_new_points;\r\n\r\n            FT_Outline_Translate( &dummy, x, y );\r\n          }\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      /* we don't support other formats (yet?) */\r\n      error = AF_Err_Unimplemented_Feature;\r\n    }\r\n\r\n  Hint_Metrics:\r\n    if ( depth == 0 )\r\n    {\r\n      FT_BBox    bbox;\r\n      FT_Vector  vvector;\r\n\r\n\r\n      vvector.x = slot->metrics.vertBearingX - slot->metrics.horiBearingX;\r\n      vvector.y = slot->metrics.vertBearingY - slot->metrics.horiBearingY;\r\n      vvector.x = FT_MulFix( vvector.x, metrics->scaler.x_scale );\r\n      vvector.y = FT_MulFix( vvector.y, metrics->scaler.y_scale );\r\n\r\n      /* transform the hinted outline if needed */\r\n      if ( loader->transformed )\r\n      {\r\n        FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );\r\n        FT_Vector_Transform( &vvector, &loader->trans_matrix );\r\n      }\r\n#if 1\r\n      /* we must translate our final outline by -pp1.x and compute */\r\n      /* the new metrics                                           */\r\n      if ( loader->pp1.x )\r\n        FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );\r\n#endif\r\n      FT_Outline_Get_CBox( &gloader->base.outline, &bbox );\r\n\r\n      bbox.xMin = FT_PIX_FLOOR( bbox.xMin );\r\n      bbox.yMin = FT_PIX_FLOOR( bbox.yMin );\r\n      bbox.xMax = FT_PIX_CEIL(  bbox.xMax );\r\n      bbox.yMax = FT_PIX_CEIL(  bbox.yMax );\r\n\r\n      slot->metrics.width        = bbox.xMax - bbox.xMin;\r\n      slot->metrics.height       = bbox.yMax - bbox.yMin;\r\n      slot->metrics.horiBearingX = bbox.xMin;\r\n      slot->metrics.horiBearingY = bbox.yMax;\r\n\r\n      slot->metrics.vertBearingX = FT_PIX_FLOOR( bbox.xMin + vvector.x );\r\n      slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );\r\n\r\n      /* for mono-width fonts (like Andale, Courier, etc.) we need */\r\n      /* to keep the original rounded advance width; ditto for     */\r\n      /* digits if all have the same advance width                 */\r\n#if 0\r\n      if ( !FT_IS_FIXED_WIDTH( slot->face ) )\r\n        slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;\r\n      else\r\n        slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,\r\n                                               x_scale );\r\n#else\r\n      if ( scaler->render_mode != FT_RENDER_MODE_LIGHT                      &&\r\n           ( FT_IS_FIXED_WIDTH( slot->face )                              ||\r\n             ( af_face_globals_is_digit( loader->globals, glyph_index ) &&\r\n               metrics->digits_have_same_width                          ) ) )\r\n      {\r\n        slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,\r\n                                               metrics->scaler.x_scale );\r\n\r\n        /* Set delta values to 0.  Otherwise code that uses them is */\r\n        /* going to ruin the fixed advance width.                   */\r\n        slot->lsb_delta = 0;\r\n        slot->rsb_delta = 0;\r\n      }\r\n      else\r\n      {\r\n        /* non-spacing glyphs must stay as-is */\r\n        if ( slot->metrics.horiAdvance )\r\n          slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;\r\n      }\r\n#endif\r\n\r\n      slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,\r\n                                             metrics->scaler.y_scale );\r\n\r\n      slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );\r\n      slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance );\r\n\r\n      /* now copy outline into glyph slot */\r\n      FT_GlyphLoader_Rewind( internal->loader );\r\n      error = FT_GlyphLoader_CopyPoints( internal->loader, gloader );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* reassign all outline fields except flags to protect them */\r\n      slot->outline.n_contours = internal->loader->base.outline.n_contours;\r\n      slot->outline.n_points   = internal->loader->base.outline.n_points;\r\n      slot->outline.points     = internal->loader->base.outline.points;\r\n      slot->outline.tags       = internal->loader->base.outline.tags;\r\n      slot->outline.contours   = internal->loader->base.outline.contours;\r\n\r\n      slot->format  = FT_GLYPH_FORMAT_OUTLINE;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Load a glyph. */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  af_loader_load_glyph( AF_Module  module,\r\n                        FT_Face    face,\r\n                        FT_UInt    gindex,\r\n                        FT_Int32   load_flags )\r\n  {\r\n    FT_Error      error;\r\n    FT_Size       size   = face->size;\r\n    AF_Loader     loader = module->loader;\r\n    AF_ScalerRec  scaler;\r\n\r\n\r\n    if ( !size )\r\n      return AF_Err_Invalid_Argument;\r\n\r\n    FT_ZERO( &scaler );\r\n\r\n    scaler.face    = face;\r\n    scaler.x_scale = size->metrics.x_scale;\r\n    scaler.x_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */\r\n    scaler.y_scale = size->metrics.y_scale;\r\n    scaler.y_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */\r\n\r\n    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );\r\n    scaler.flags       = 0;  /* XXX: fix this */\r\n\r\n    error = af_loader_reset( module, face );\r\n    if ( !error )\r\n    {\r\n      AF_ScriptMetrics  metrics;\r\n      FT_UInt           options = 0;\r\n\r\n\r\n#ifdef FT_OPTION_AUTOFIT2\r\n      /* XXX: undocumented hook to activate the latin2 hinter */\r\n      if ( load_flags & ( 1UL << 20 ) )\r\n        options = 2;\r\n#endif\r\n\r\n      error = af_face_globals_get_metrics( loader->globals, gindex,\r\n                                           options, &metrics );\r\n      if ( !error )\r\n      {\r\n        loader->metrics = metrics;\r\n\r\n        if ( metrics->clazz->script_metrics_scale )\r\n          metrics->clazz->script_metrics_scale( metrics, &scaler );\r\n        else\r\n          metrics->scaler = scaler;\r\n\r\n        load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;\r\n        load_flags &= ~FT_LOAD_RENDER;\r\n\r\n        if ( metrics->clazz->script_hints_init )\r\n        {\r\n          error = metrics->clazz->script_hints_init( &loader->hints,\r\n                                                     metrics );\r\n          if ( error )\r\n            goto Exit;\r\n        }\r\n\r\n        error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );\r\n      }\r\n    }\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afloader.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afloader.h                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter glyph loading routines (specification).                  */\r\n/*                                                                         */\r\n/*  Copyright 2003-2005, 2011-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFLOADER_H__\r\n#define __AFLOADER_H__\r\n\r\n#include \"afhints.h\"\r\n#include \"afglobal.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  typedef struct AF_ModuleRec_*  AF_Module;\r\n\r\n  /*\r\n   *  The autofitter module's (global) data structure to communicate with\r\n   *  actual fonts.  If necessary, `local' data like the current face, the\r\n   *  current face's auto-hint data, or the current glyph's parameters\r\n   *  relevant to auto-hinting are `swapped in'.  Cf. functions like\r\n   *  `af_loader_reset' and `af_loader_load_g'.\r\n   */\r\n\r\n  typedef struct  AF_LoaderRec_\r\n  {\r\n    /* current face data */\r\n    FT_Face           face;\r\n    AF_FaceGlobals    globals;\r\n\r\n    /* current glyph data */\r\n    FT_GlyphLoader    gloader;\r\n    AF_GlyphHintsRec  hints;\r\n    AF_ScriptMetrics  metrics;\r\n    FT_Bool           transformed;\r\n    FT_Matrix         trans_matrix;\r\n    FT_Vector         trans_delta;\r\n    FT_Vector         pp1;\r\n    FT_Vector         pp2;\r\n    /* we don't handle vertical phantom points */\r\n\r\n  } AF_LoaderRec, *AF_Loader;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_loader_init( AF_Module  module );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_loader_reset( AF_Module  module,\r\n                   FT_Face    face );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  af_loader_done( AF_Module  module );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  af_loader_load_glyph( AF_Module  module,\r\n                        FT_Face    face,\r\n                        FT_UInt    gindex,\r\n                        FT_Int32   load_flags );\r\n\r\n/* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFLOADER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afmodule.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afmodule.c                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter module implementation (body).                            */\r\n/*                                                                         */\r\n/*  Copyright 2003-2006, 2009, 2011-2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"afglobal.h\"\r\n#include \"afmodule.h\"\r\n#include \"afloader.h\"\r\n#include \"aferrors.h\"\r\n#include \"afpic.h\"\r\n\r\n#ifdef FT_DEBUG_AUTOFIT\r\n  int    _af_debug_disable_horz_hints;\r\n  int    _af_debug_disable_vert_hints;\r\n  int    _af_debug_disable_blue_hints;\r\n  void*  _af_debug_hints;\r\n#endif\r\n\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_AUTOHINTER_H\r\n#include FT_SERVICE_PROPERTIES_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_afmodule\r\n\r\n\r\n  FT_Error\r\n  af_property_get_face_globals( FT_Face          face,\r\n                                AF_FaceGlobals*  aglobals,\r\n                                AF_Module        module )\r\n  {\r\n    FT_Error        error = AF_Err_Ok;\r\n    AF_FaceGlobals  globals;\r\n\r\n\r\n    if ( !face )\r\n      return AF_Err_Invalid_Argument;\r\n\r\n    globals = (AF_FaceGlobals)face->autohint.data;\r\n    if ( !globals )\r\n    {\r\n      /* trigger computation of the global script data */\r\n      /* in case it hasn't been done yet               */\r\n      error = af_face_globals_new( face, &globals, module );\r\n      if ( !error )\r\n      {\r\n        face->autohint.data =\r\n          (FT_Pointer)globals;\r\n        face->autohint.finalizer =\r\n          (FT_Generic_Finalizer)af_face_globals_free;\r\n      }\r\n    }\r\n\r\n    if ( !error )\r\n      *aglobals = globals;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_Error\r\n  af_property_set( FT_Module    ft_module,\r\n                   const char*  property_name,\r\n                   const void*  value )\r\n  {\r\n    FT_Error   error  = AF_Err_Ok;\r\n    AF_Module  module = (AF_Module)ft_module;\r\n\r\n\r\n    if ( !ft_strcmp( property_name, \"fallback-script\" ) )\r\n    {\r\n      FT_UInt*  fallback_script = (FT_UInt*)value;\r\n\r\n\r\n      module->fallback_script = *fallback_script;\r\n\r\n      return error;\r\n    }\r\n    else if ( !ft_strcmp( property_name, \"increase-x-height\" ) )\r\n    {\r\n      FT_Prop_IncreaseXHeight*  prop = (FT_Prop_IncreaseXHeight*)value;\r\n      AF_FaceGlobals            globals;\r\n\r\n\r\n      error = af_property_get_face_globals( prop->face, &globals, module );\r\n      if ( !error )\r\n        globals->increase_x_height = prop->limit;\r\n\r\n      return error;\r\n    }\r\n\r\n    FT_TRACE0(( \"af_property_get: missing property `%s'\\n\",\r\n                property_name ));\r\n    return AF_Err_Missing_Property;\r\n  }\r\n\r\n\r\n  FT_Error\r\n  af_property_get( FT_Module    ft_module,\r\n                   const char*  property_name,\r\n                   void*        value )\r\n  {\r\n    FT_Error   error           = AF_Err_Ok;\r\n    AF_Module  module          = (AF_Module)ft_module;\r\n    FT_UInt    fallback_script = module->fallback_script;\r\n\r\n\r\n    if ( !ft_strcmp( property_name, \"glyph-to-script-map\" ) )\r\n    {\r\n      FT_Prop_GlyphToScriptMap*  prop = (FT_Prop_GlyphToScriptMap*)value;\r\n      AF_FaceGlobals             globals;\r\n\r\n\r\n      error = af_property_get_face_globals( prop->face, &globals, module );\r\n      if ( !error )\r\n        prop->map = globals->glyph_scripts;\r\n\r\n      return error;\r\n    }\r\n    else if ( !ft_strcmp( property_name, \"fallback-script\" ) )\r\n    {\r\n      FT_UInt*  val = (FT_UInt*)value;\r\n\r\n\r\n      *val = fallback_script;\r\n\r\n      return error;\r\n    }\r\n    else if ( !ft_strcmp( property_name, \"increase-x-height\" ) )\r\n    {\r\n      FT_Prop_IncreaseXHeight*  prop = (FT_Prop_IncreaseXHeight*)value;\r\n      AF_FaceGlobals            globals;\r\n\r\n\r\n      error = af_property_get_face_globals( prop->face, &globals, module );\r\n      if ( !error )\r\n        prop->limit = globals->increase_x_height;\r\n\r\n      return error;\r\n    }\r\n\r\n\r\n    FT_TRACE0(( \"af_property_get: missing property `%s'\\n\",\r\n                property_name ));\r\n    return AF_Err_Missing_Property;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_PROPERTIESREC(\r\n    af_service_properties,\r\n    (FT_Properties_SetFunc)af_property_set,\r\n    (FT_Properties_GetFunc)af_property_get )\r\n\r\n\r\n  FT_DEFINE_SERVICEDESCREC1(\r\n    af_services,\r\n    FT_SERVICE_ID_PROPERTIES, &AF_SERVICE_PROPERTIES_GET )\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  af_get_interface( FT_Module    module,\r\n                    const char*  module_interface )\r\n  {\r\n    /* AF_SERVICES_GET derefers `library' in PIC mode */\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    FT_Library  library;\r\n\r\n\r\n    if ( !module )\r\n      return NULL;\r\n    library = module->library;\r\n    if ( !library )\r\n      return NULL;\r\n#else\r\n    FT_UNUSED( module );\r\n#endif\r\n\r\n    return ft_service_list_lookup( AF_SERVICES_GET, module_interface );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  af_autofitter_init( AF_Module  module )\r\n  {\r\n    module->fallback_script = AF_SCRIPT_FALLBACK;\r\n\r\n    return af_loader_init( module );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  af_autofitter_done( AF_Module  module )\r\n  {\r\n    af_loader_done( module );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  af_autofitter_load_glyph( AF_Module     module,\r\n                            FT_GlyphSlot  slot,\r\n                            FT_Size       size,\r\n                            FT_UInt       glyph_index,\r\n                            FT_Int32      load_flags )\r\n  {\r\n    FT_UNUSED( size );\r\n\r\n    return af_loader_load_glyph( module, slot->face,\r\n                                 glyph_index, load_flags );\r\n  }\r\n\r\n\r\n  FT_DEFINE_AUTOHINTER_INTERFACE(\r\n    af_autofitter_interface,\r\n    NULL,                                                    /* reset_face */\r\n    NULL,                                              /* get_global_hints */\r\n    NULL,                                             /* done_global_hints */\r\n    (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph )  /* load_glyph */\r\n\r\n\r\n  FT_DEFINE_MODULE(\r\n    autofit_module_class,\r\n\r\n    FT_MODULE_HINTER,\r\n    sizeof ( AF_ModuleRec ),\r\n\r\n    \"autofitter\",\r\n    0x10000L,   /* version 1.0 of the autofitter  */\r\n    0x20000L,   /* requires FreeType 2.0 or above */\r\n\r\n    (const void*)&AF_INTERFACE_GET,\r\n\r\n    (FT_Module_Constructor)af_autofitter_init,\r\n    (FT_Module_Destructor) af_autofitter_done,\r\n    (FT_Module_Requester)  af_get_interface )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afmodule.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afmodule.h                                                             */\r\n/*                                                                         */\r\n/*    Auto-fitter module implementation (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2005 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFMODULE_H__\r\n#define __AFMODULE_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_MODULE_H\r\n\r\n#include \"afloader.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  This is the `extended' FT_Module structure which holds the\r\n   *  autofitter's global data.  Right before hinting a glyph, the data\r\n   *  specific to the glyph's face (blue zones, stem widths, etc.) are\r\n   *  loaded into `loader' (see function `af_loader_reset').\r\n   */\r\n\r\n  typedef struct  AF_ModuleRec_\r\n  {\r\n    FT_ModuleRec  root;\r\n\r\n    FT_UInt       fallback_script;\r\n\r\n    AF_LoaderRec  loader[1];\r\n\r\n  } AF_ModuleRec;\r\n\r\n\r\nFT_DECLARE_MODULE(autofit_module_class)\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFMODULE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afpic.c                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for autofit module.  */\r\n/*                                                                         */\r\n/*  Copyright 2009-2012 by                                                 */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"afpic.h\"\r\n#include \"aferrors.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from afmodule.c */\r\n  FT_Error\r\n  FT_Create_Class_af_services( FT_Library           library,\r\n                               FT_ServiceDescRec**  output_class );\r\n\r\n  void\r\n  FT_Destroy_Class_af_services( FT_Library          library,\r\n                                FT_ServiceDescRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_af_service_properties( FT_Service_PropertiesRec*  clazz );\r\n\r\n  void FT_Init_Class_af_autofitter_interface(\r\n    FT_Library                   library,\r\n    FT_AutoHinter_InterfaceRec*  clazz );\r\n\r\n\r\n  /* forward declaration of PIC init functions from script classes */\r\n#include \"aflatin.h\"\r\n#ifdef FT_OPTION_AUTOFIT2\r\n#include \"aflatin2.h\"\r\n#endif\r\n#include \"afcjk.h\"\r\n#include \"afdummy.h\"\r\n#include \"afindic.h\"\r\n\r\n\r\n  void\r\n  autofit_module_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    if ( pic_container->autofit )\r\n    {\r\n      AFModulePIC*  container = (AFModulePIC*)pic_container->autofit;\r\n\r\n\r\n      if ( container->af_services )\r\n        FT_Destroy_Class_af_services( library,\r\n                                      container->af_services );\r\n      container->af_services = NULL;\r\n\r\n      FT_FREE( container );\r\n      pic_container->autofit = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  autofit_module_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_UInt            ss;\r\n    FT_Error           error         = AF_Err_Ok;\r\n    AFModulePIC*       container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->autofit = container;\r\n\r\n    /* initialize pointer table -                       */\r\n    /* this is how the module usually expects this data */\r\n    error = FT_Create_Class_af_services( library,\r\n                                         &container->af_services );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_Init_Class_af_service_properties( &container->af_service_properties );\r\n\r\n    for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ )\r\n    {\r\n      container->af_script_classes[ss] =\r\n        &container->af_script_classes_rec[ss];\r\n    }\r\n    container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL;\r\n\r\n    /* add call to initialization function when you add new scripts */\r\n    ss = 0;\r\n    FT_Init_Class_af_dummy_script_class(\r\n      &container->af_script_classes_rec[ss++] );\r\n#ifdef FT_OPTION_AUTOFIT2\r\n    FT_Init_Class_af_latin2_script_class(\r\n      &container->af_script_classes_rec[ss++] );\r\n#endif\r\n    FT_Init_Class_af_latin_script_class(\r\n      &container->af_script_classes_rec[ss++] );\r\n    FT_Init_Class_af_cjk_script_class(\r\n      &container->af_script_classes_rec[ss++] );\r\n    FT_Init_Class_af_indic_script_class(\r\n      &container->af_script_classes_rec[ss++] );\r\n\r\n    FT_Init_Class_af_autofitter_interface(\r\n      library, &container->af_autofitter_interface );\r\n\r\n  Exit:\r\n    if ( error )\r\n      autofit_module_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afpic.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for autofit module.  */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2011-2012 by                                           */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFPIC_H__\r\n#define __AFPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define AF_SERVICES_GET            af_services\r\n#define AF_SERVICE_PROPERTIES_GET  af_service_properties\r\n\r\n#define AF_SCRIPT_CLASSES_GET      af_script_classes\r\n#define AF_INTERFACE_GET           af_autofitter_interface\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* some include files required for members of AFModulePIC */\r\n#include FT_SERVICE_PROPERTIES_H\r\n\r\n#include \"aftypes.h\"\r\n\r\n  /* increase these when you add new scripts, */\r\n  /* and update autofit_module_class_pic_init */\r\n#ifdef FT_OPTION_AUTOFIT2\r\n#define AF_SCRIPT_CLASSES_COUNT  6\r\n#else\r\n#define AF_SCRIPT_CLASSES_COUNT  5\r\n#endif\r\n\r\n#define AF_SCRIPT_CLASSES_REC_COUNT  ( AF_SCRIPT_CLASSES_COUNT - 1 )\r\n\r\n\r\n  typedef struct  AFModulePIC_\r\n  {\r\n    FT_ServiceDescRec*          af_services;\r\n    FT_Service_PropertiesRec    af_service_properties;\r\n\r\n    AF_ScriptClass              af_script_classes[AF_SCRIPT_CLASSES_COUNT];\r\n    AF_ScriptClassRec           af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT];\r\n    FT_AutoHinter_InterfaceRec  af_autofitter_interface;\r\n\r\n  } AFModulePIC;\r\n\r\n\r\n#define GET_PIC( lib )  \\\r\n          ( (AFModulePIC*)((lib)->pic_container.autofit) )\r\n\r\n#define AF_SERVICES_GET  \\\r\n          ( GET_PIC( library )->af_services )\r\n#define AF_SERVICE_PROPERTIES_GET  \\\r\n          ( GET_PIC( library)->af_service_properties )\r\n\r\n#define AF_SCRIPT_CLASSES_GET  \\\r\n          ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_script_classes )\r\n#define AF_INTERFACE_GET  \\\r\n          ( GET_PIC( library )->af_autofitter_interface )\r\n\r\n\r\n  /* see afpic.c for the implementation */\r\n  void\r\n  autofit_module_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  autofit_module_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/aftypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  aftypes.h                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter types (specification only).                              */\r\n/*                                                                         */\r\n/*  Copyright 2003-2009, 2011-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   *  The auto-fitter is a complete rewrite of the old auto-hinter.\r\n   *  Its main feature is the ability to differentiate between different\r\n   *  scripts in order to apply language-specific rules.\r\n   *\r\n   *  The code has also been compartmentized into several entities that\r\n   *  should make algorithmic experimentation easier than with the old\r\n   *  code.\r\n   *\r\n   *  Finally, we get rid of the Catharon license, since this code is\r\n   *  released under the FreeType one.\r\n   *\r\n   *************************************************************************/\r\n\r\n\r\n#ifndef __AFTYPES_H__\r\n#define __AFTYPES_H__\r\n\r\n#include <ft2build.h>\r\n\r\n#include FT_FREETYPE_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    D E B U G G I N G                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_AUTOFIT\r\n\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\nextern int    _af_debug_disable_horz_hints;\r\nextern int    _af_debug_disable_vert_hints;\r\nextern int    _af_debug_disable_blue_hints;\r\nextern void*  _af_debug_hints;\r\n\r\n#endif /* FT_DEBUG_AUTOFIT */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                 U T I L I T Y   S T U F F                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  AF_WidthRec_\r\n  {\r\n    FT_Pos  org;  /* original position/width in font units              */\r\n    FT_Pos  cur;  /* current/scaled position/width in device sub-pixels */\r\n    FT_Pos  fit;  /* current/fitted position/width in device sub-pixels */\r\n\r\n  } AF_WidthRec, *AF_Width;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  af_sort_pos( FT_UInt  count,\r\n               FT_Pos*  table );\r\n\r\n  FT_LOCAL( void )\r\n  af_sort_and_quantize_widths( FT_UInt*  count,\r\n                               AF_Width  widths,\r\n                               FT_Pos    threshold );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                   A N G L E   T Y P E S                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  The auto-fitter doesn't need a very high angular accuracy;\r\n   *  this allows us to speed up some computations considerably with a\r\n   *  light Cordic algorithm (see afangles.c).\r\n   */\r\n\r\n  typedef FT_Int  AF_Angle;\r\n\r\n\r\n#define AF_ANGLE_PI   256\r\n#define AF_ANGLE_2PI  ( AF_ANGLE_PI * 2 )\r\n#define AF_ANGLE_PI2  ( AF_ANGLE_PI / 2 )\r\n#define AF_ANGLE_PI4  ( AF_ANGLE_PI / 4 )\r\n\r\n\r\n#if 0\r\n  /*\r\n   *  compute the angle of a given 2-D vector\r\n   */\r\n  FT_LOCAL( AF_Angle )\r\n  af_angle_atan( FT_Pos  dx,\r\n                 FT_Pos  dy );\r\n\r\n\r\n  /*\r\n   *  compute `angle2 - angle1'; the result is always within\r\n   *  the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1]\r\n   */\r\n  FT_LOCAL( AF_Angle )\r\n  af_angle_diff( AF_Angle  angle1,\r\n                 AF_Angle  angle2 );\r\n#endif /* 0 */\r\n\r\n\r\n#define AF_ANGLE_DIFF( result, angle1, angle2 ) \\\r\n  FT_BEGIN_STMNT                                \\\r\n    AF_Angle  _delta = (angle2) - (angle1);     \\\r\n                                                \\\r\n                                                \\\r\n    _delta %= AF_ANGLE_2PI;                     \\\r\n    if ( _delta < 0 )                           \\\r\n      _delta += AF_ANGLE_2PI;                   \\\r\n                                                \\\r\n    if ( _delta > AF_ANGLE_PI )                 \\\r\n      _delta -= AF_ANGLE_2PI;                   \\\r\n                                                \\\r\n    result = _delta;                            \\\r\n  FT_END_STMNT\r\n\r\n\r\n  /*  opaque handle to glyph-specific hints -- see `afhints.h' for more\r\n   *  details\r\n   */\r\n  typedef struct AF_GlyphHintsRec_*  AF_GlyphHints;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       S C A L E R S                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  A scaler models the target pixel device that will receive the\r\n   *  auto-hinted glyph image.\r\n   */\r\n\r\n  typedef enum  AF_ScalerFlags_\r\n  {\r\n    AF_SCALER_FLAG_NO_HORIZONTAL = 1,  /* disable horizontal hinting */\r\n    AF_SCALER_FLAG_NO_VERTICAL   = 2,  /* disable vertical hinting   */\r\n    AF_SCALER_FLAG_NO_ADVANCE    = 4   /* disable advance hinting    */\r\n\r\n  } AF_ScalerFlags;\r\n\r\n\r\n  typedef struct  AF_ScalerRec_\r\n  {\r\n    FT_Face         face;        /* source font face                        */\r\n    FT_Fixed        x_scale;     /* from font units to 1/64th device pixels */\r\n    FT_Fixed        y_scale;     /* from font units to 1/64th device pixels */\r\n    FT_Pos          x_delta;     /* in 1/64th device pixels                 */\r\n    FT_Pos          y_delta;     /* in 1/64th device pixels                 */\r\n    FT_Render_Mode  render_mode; /* monochrome, anti-aliased, LCD, etc.     */\r\n    FT_UInt32       flags;       /* additional control flags, see above     */\r\n\r\n  } AF_ScalerRec, *AF_Scaler;\r\n\r\n\r\n#define AF_SCALER_EQUAL_SCALES( a, b )      \\\r\n          ( (a)->x_scale == (b)->x_scale && \\\r\n            (a)->y_scale == (b)->y_scale && \\\r\n            (a)->x_delta == (b)->x_delta && \\\r\n            (a)->y_delta == (b)->y_delta )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       S C R I P T S                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  The list of known scripts.  Each different script corresponds to the\r\n   *  following information:\r\n   *\r\n   *   - A set of Unicode ranges to test whether the face supports the\r\n   *     script.\r\n   *\r\n   *   - A specific global analyzer that will compute global metrics\r\n   *     specific to the script.\r\n   *\r\n   *   - A specific glyph analyzer that will compute segments and\r\n   *     edges for each glyph covered by the script.\r\n   *\r\n   *   - A specific grid-fitting algorithm that will distort the\r\n   *     scaled glyph outline according to the results of the glyph\r\n   *     analyzer.\r\n   *\r\n   *  Note that a given analyzer and/or grid-fitting algorithm can be\r\n   *  used by more than one script.\r\n   */\r\n\r\n  typedef enum  AF_Script_\r\n  {\r\n    AF_SCRIPT_DUMMY = 0,\r\n    AF_SCRIPT_LATIN = 1,\r\n    AF_SCRIPT_CJK   = 2,\r\n    AF_SCRIPT_INDIC = 3,\r\n#ifdef FT_OPTION_AUTOFIT2\r\n    AF_SCRIPT_LATIN2 = 4,\r\n#endif\r\n\r\n    /* add new scripts here.  Don't forget to update the list in */\r\n    /* `afglobal.c'.                                             */\r\n\r\n    AF_SCRIPT_MAX   /* do not remove */\r\n\r\n  } AF_Script;\r\n\r\n\r\n  typedef struct AF_ScriptClassRec_ const*  AF_ScriptClass;\r\n  typedef struct AF_FaceGlobalsRec_*        AF_FaceGlobals;\r\n\r\n  typedef struct  AF_ScriptMetricsRec_\r\n  {\r\n    AF_ScriptClass  clazz;\r\n    AF_ScalerRec    scaler;\r\n    FT_Bool         digits_have_same_width;\r\n\r\n    AF_FaceGlobals  globals;    /* to access properties */\r\n\r\n  } AF_ScriptMetricsRec, *AF_ScriptMetrics;\r\n\r\n\r\n  /*  This function parses an FT_Face to compute global metrics for\r\n   *  a specific script.\r\n   */\r\n  typedef FT_Error\r\n  (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics  metrics,\r\n                                FT_Face           face );\r\n\r\n  typedef void\r\n  (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics  metrics,\r\n                                 AF_Scaler         scaler );\r\n\r\n  typedef void\r\n  (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics  metrics );\r\n\r\n\r\n  typedef FT_Error\r\n  (*AF_Script_InitHintsFunc)( AF_GlyphHints     hints,\r\n                              AF_ScriptMetrics  metrics );\r\n\r\n  typedef void\r\n  (*AF_Script_ApplyHintsFunc)( AF_GlyphHints     hints,\r\n                               FT_Outline*       outline,\r\n                               AF_ScriptMetrics  metrics );\r\n\r\n\r\n  typedef struct  AF_Script_UniRangeRec_\r\n  {\r\n    FT_UInt32  first;\r\n    FT_UInt32  last;\r\n\r\n  } AF_Script_UniRangeRec;\r\n\r\n#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) }\r\n\r\n  typedef const AF_Script_UniRangeRec  *AF_Script_UniRange;\r\n\r\n\r\n  typedef struct  AF_ScriptClassRec_\r\n  {\r\n    AF_Script           script;\r\n    AF_Script_UniRange  script_uni_ranges; /* last must be { 0, 0 }        */\r\n    FT_UInt32           standard_char;     /* for default width and height */\r\n\r\n    FT_Offset                   script_metrics_size;\r\n    AF_Script_InitMetricsFunc   script_metrics_init;\r\n    AF_Script_ScaleMetricsFunc  script_metrics_scale;\r\n    AF_Script_DoneMetricsFunc   script_metrics_done;\r\n\r\n    AF_Script_InitHintsFunc     script_hints_init;\r\n    AF_Script_ApplyHintsFunc    script_hints_apply;\r\n\r\n  } AF_ScriptClassRec;\r\n\r\n\r\n  /* Declare and define vtables for classes */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define AF_DECLARE_SCRIPT_CLASS( script_class ) \\\r\n  FT_CALLBACK_TABLE const AF_ScriptClassRec     \\\r\n  script_class;\r\n\r\n#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char,   \\\r\n                                m_size,                                    \\\r\n                                m_init, m_scale, m_done, h_init, h_apply ) \\\r\n  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec  script_class =            \\\r\n  {                                                                        \\\r\n    script_,                                                               \\\r\n    ranges,                                                                \\\r\n    def_char,                                                              \\\r\n                                                                           \\\r\n    m_size,                                                                \\\r\n                                                                           \\\r\n    m_init,                                                                \\\r\n    m_scale,                                                               \\\r\n    m_done,                                                                \\\r\n                                                                           \\\r\n    h_init,                                                                \\\r\n    h_apply                                                                \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define AF_DECLARE_SCRIPT_CLASS( script_class )             \\\r\n  FT_LOCAL( void )                                          \\\r\n  FT_Init_Class_ ## script_class( AF_ScriptClassRec*  ac );\r\n\r\n#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char,   \\\r\n                                m_size,                                    \\\r\n                                m_init, m_scale, m_done, h_init, h_apply ) \\\r\n  FT_LOCAL_DEF( void )                                                     \\\r\n  FT_Init_Class_ ## script_class( AF_ScriptClassRec*  ac )                 \\\r\n  {                                                                        \\\r\n    ac->script               = script_;                                    \\\r\n    ac->script_uni_ranges    = ranges;                                     \\\r\n    ac->default_char         = def_char;                                   \\\r\n                                                                           \\\r\n    ac->script_metrics_size  = m_size;                                     \\\r\n                                                                           \\\r\n    ac->script_metrics_init  = m_init;                                     \\\r\n    ac->script_metrics_scale = m_scale;                                    \\\r\n    ac->script_metrics_done  = m_done;                                     \\\r\n                                                                           \\\r\n    ac->script_hints_init    = h_init;                                     \\\r\n    ac->script_hints_apply   = h_apply;                                    \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afwarp.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afwarp.c                                                               */\r\n/*                                                                         */\r\n/*    Auto-fitter warping algorithm (body).                                */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2007, 2011 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*\r\n   *  The idea of the warping code is to slightly scale and shift a glyph\r\n   *  within a single dimension so that as much of its segments are aligned\r\n   *  (more or less) on the grid.  To find out the optimal scaling and\r\n   *  shifting value, various parameter combinations are tried and scored.\r\n   */\r\n\r\n#include \"afwarp.h\"\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_afwarp\r\n\r\n\r\n  /* The weights cover the range 0/64 - 63/64 of a pixel.  Obviously, */\r\n  /* values around a half pixel (which means exactly between two grid */\r\n  /* lines) gets the worst weight.                                    */\r\n#if 1\r\n  static const AF_WarpScore\r\n  af_warper_weights[64] =\r\n  {\r\n    35, 32, 30, 25, 20, 15, 12, 10,  5,  1,  0,  0,  0,  0,  0,  0,\r\n     0,  0,  0,  0,  0,  0, -1, -2, -5, -8,-10,-10,-20,-20,-30,-30,\r\n\r\n   -30,-30,-20,-20,-10,-10, -8, -5, -2, -1,  0,  0,  0,  0,  0,  0,\r\n     0,  0,  0,  0,  0,  0,  0,  1,  5, 10, 12, 15, 20, 25, 30, 32,\r\n  };\r\n#else\r\n  static const AF_WarpScore\r\n  af_warper_weights[64] =\r\n  {\r\n    30, 20, 10,  5,  4,  4,  3,  2,  1,  0,  0,  0,  0,  0,  0,  0,\r\n     0,  0,  0,  0,  0,  0,  0, -1, -2, -2, -5, -5,-10,-10,-15,-20,\r\n\r\n   -20,-15,-15,-10,-10, -5, -5, -2, -2, -1,  0,  0,  0,  0,  0,  0,\r\n     0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  4,  5, 10, 20,\r\n  };\r\n#endif\r\n\r\n\r\n  /* Score segments for a given `scale' and `delta' in the range */\r\n  /* `xx1' to `xx2', and store the best result in `warper'.  If  */\r\n  /* the new best score is equal to the old one, prefer the      */\r\n  /* value with a smaller distortion (around `base_distort').    */\r\n\r\n  static void\r\n  af_warper_compute_line_best( AF_Warper     warper,\r\n                               FT_Fixed      scale,\r\n                               FT_Pos        delta,\r\n                               FT_Pos        xx1,\r\n                               FT_Pos        xx2,\r\n                               AF_WarpScore  base_distort,\r\n                               AF_Segment    segments,\r\n                               FT_UInt       num_segments )\r\n  {\r\n    FT_Int        idx_min, idx_max, idx0;\r\n    FT_UInt       nn;\r\n    AF_WarpScore  scores[65];\r\n\r\n\r\n    for ( nn = 0; nn < 65; nn++ )\r\n      scores[nn] = 0;\r\n\r\n    idx0 = xx1 - warper->t1;\r\n\r\n    /* compute minimum and maximum indices */\r\n    {\r\n      FT_Pos  xx1min = warper->x1min;\r\n      FT_Pos  xx1max = warper->x1max;\r\n      FT_Pos  w      = xx2 - xx1;\r\n\r\n\r\n      if ( xx1min + w < warper->x2min )\r\n        xx1min = warper->x2min - w;\r\n\r\n      xx1max = warper->x1max;\r\n      if ( xx1max + w > warper->x2max )\r\n        xx1max = warper->x2max - w;\r\n\r\n      idx_min = xx1min - warper->t1;\r\n      idx_max = xx1max - warper->t1;\r\n\r\n      if ( idx_min < 0 || idx_min > idx_max || idx_max > 64 )\r\n      {\r\n        FT_TRACE5(( \"invalid indices:\\n\"\r\n                    \"  min=%d max=%d, xx1=%ld xx2=%ld,\\n\"\r\n                    \"  x1min=%ld x1max=%ld, x2min=%ld x2max=%ld\\n\",\r\n                    idx_min, idx_max, xx1, xx2,\r\n                    warper->x1min, warper->x1max,\r\n                    warper->x2min, warper->x2max ));\r\n        return;\r\n      }\r\n    }\r\n\r\n    for ( nn = 0; nn < num_segments; nn++ )\r\n    {\r\n      FT_Pos  len = segments[nn].max_coord - segments[nn].min_coord;\r\n      FT_Pos  y0  = FT_MulFix( segments[nn].pos, scale ) + delta;\r\n      FT_Pos  y   = y0 + ( idx_min - idx0 );\r\n      FT_Int  idx;\r\n\r\n\r\n      /* score the length of the segments for the given range */\r\n      for ( idx = idx_min; idx <= idx_max; idx++, y++ )\r\n        scores[idx] += af_warper_weights[y & 63] * len;\r\n    }\r\n\r\n    /* find best score */\r\n    {\r\n      FT_Int  idx;\r\n\r\n\r\n      for ( idx = idx_min; idx <= idx_max; idx++ )\r\n      {\r\n        AF_WarpScore  score = scores[idx];\r\n        AF_WarpScore  distort = base_distort + ( idx - idx0 );\r\n\r\n\r\n        if ( score > warper->best_score         ||\r\n             ( score == warper->best_score    &&\r\n               distort < warper->best_distort ) )\r\n        {\r\n          warper->best_score   = score;\r\n          warper->best_distort = distort;\r\n          warper->best_scale   = scale;\r\n          warper->best_delta   = delta + ( idx - idx0 );\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* Compute optimal scaling and delta values for a given glyph and */\r\n  /* dimension.                                                     */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  af_warper_compute( AF_Warper      warper,\r\n                     AF_GlyphHints  hints,\r\n                     AF_Dimension   dim,\r\n                     FT_Fixed      *a_scale,\r\n                     FT_Pos        *a_delta )\r\n  {\r\n    AF_AxisHints  axis;\r\n    AF_Point      points;\r\n\r\n    FT_Fixed      org_scale;\r\n    FT_Pos        org_delta;\r\n\r\n    FT_UInt       nn, num_points, num_segments;\r\n    FT_Int        X1, X2;\r\n    FT_Int        w;\r\n\r\n    AF_WarpScore  base_distort;\r\n    AF_Segment    segments;\r\n\r\n\r\n    /* get original scaling transformation */\r\n    if ( dim == AF_DIMENSION_VERT )\r\n    {\r\n      org_scale = hints->y_scale;\r\n      org_delta = hints->y_delta;\r\n    }\r\n    else\r\n    {\r\n      org_scale = hints->x_scale;\r\n      org_delta = hints->x_delta;\r\n    }\r\n\r\n    warper->best_scale   = org_scale;\r\n    warper->best_delta   = org_delta;\r\n    warper->best_score   = INT_MIN;\r\n    warper->best_distort = 0;\r\n\r\n    axis         = &hints->axis[dim];\r\n    segments     = axis->segments;\r\n    num_segments = axis->num_segments;\r\n    points       = hints->points;\r\n    num_points   = hints->num_points;\r\n\r\n    *a_scale = org_scale;\r\n    *a_delta = org_delta;\r\n\r\n    /* get X1 and X2, minimum and maximum in original coordinates */\r\n    if ( num_segments < 1 )\r\n      return;\r\n\r\n#if 1\r\n    X1 = X2 = points[0].fx;\r\n    for ( nn = 1; nn < num_points; nn++ )\r\n    {\r\n      FT_Int  X = points[nn].fx;\r\n\r\n\r\n      if ( X < X1 )\r\n        X1 = X;\r\n      if ( X > X2 )\r\n        X2 = X;\r\n    }\r\n#else\r\n    X1 = X2 = segments[0].pos;\r\n    for ( nn = 1; nn < num_segments; nn++ )\r\n    {\r\n      FT_Int  X = segments[nn].pos;\r\n\r\n\r\n      if ( X < X1 )\r\n        X1 = X;\r\n      if ( X > X2 )\r\n        X2 = X;\r\n    }\r\n#endif\r\n\r\n    if ( X1 >= X2 )\r\n      return;\r\n\r\n    warper->x1 = FT_MulFix( X1, org_scale ) + org_delta;\r\n    warper->x2 = FT_MulFix( X2, org_scale ) + org_delta;\r\n\r\n    warper->t1 = AF_WARPER_FLOOR( warper->x1 );\r\n    warper->t2 = AF_WARPER_CEIL( warper->x2 );\r\n\r\n    /* examine a half pixel wide range around the maximum coordinates */\r\n    warper->x1min = warper->x1 & ~31;\r\n    warper->x1max = warper->x1min + 32;\r\n    warper->x2min = warper->x2 & ~31;\r\n    warper->x2max = warper->x2min + 32;\r\n\r\n    if ( warper->x1max > warper->x2 )\r\n      warper->x1max = warper->x2;\r\n\r\n    if ( warper->x2min < warper->x1 )\r\n      warper->x2min = warper->x1;\r\n\r\n    warper->w0 = warper->x2 - warper->x1;\r\n\r\n    if ( warper->w0 <= 64 )\r\n    {\r\n      warper->x1max = warper->x1;\r\n      warper->x2min = warper->x2;\r\n    }\r\n\r\n    /* examine (at most) a pixel wide range around the natural width */\r\n    warper->wmin = warper->x2min - warper->x1max;\r\n    warper->wmax = warper->x2max - warper->x1min;\r\n\r\n#if 1\r\n    /* some heuristics to reduce the number of widths to be examined */\r\n    {\r\n      int  margin = 16;\r\n\r\n\r\n      if ( warper->w0 <= 128 )\r\n      {\r\n         margin = 8;\r\n         if ( warper->w0 <= 96 )\r\n           margin = 4;\r\n      }\r\n\r\n      if ( warper->wmin < warper->w0 - margin )\r\n        warper->wmin = warper->w0 - margin;\r\n\r\n      if ( warper->wmax > warper->w0 + margin )\r\n        warper->wmax = warper->w0 + margin;\r\n    }\r\n\r\n    if ( warper->wmin < warper->w0 * 3 / 4 )\r\n      warper->wmin = warper->w0 * 3 / 4;\r\n\r\n    if ( warper->wmax > warper->w0 * 5 / 4 )\r\n      warper->wmax = warper->w0 * 5 / 4;\r\n#else\r\n    /* no scaling, just translation */\r\n    warper->wmin = warper->wmax = warper->w0;\r\n#endif\r\n\r\n    for ( w = warper->wmin; w <= warper->wmax; w++ )\r\n    {\r\n      FT_Fixed  new_scale;\r\n      FT_Pos    new_delta;\r\n      FT_Pos    xx1, xx2;\r\n\r\n\r\n      /* compute min and max positions for given width,       */\r\n      /* assuring that they stay within the coordinate ranges */\r\n      xx1 = warper->x1;\r\n      xx2 = warper->x2;\r\n      if ( w >= warper->w0 )\r\n      {\r\n        xx1 -= w - warper->w0;\r\n        if ( xx1 < warper->x1min )\r\n        {\r\n          xx2 += warper->x1min - xx1;\r\n          xx1  = warper->x1min;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        xx1 -= w - warper->w0;\r\n        if ( xx1 > warper->x1max )\r\n        {\r\n          xx2 -= xx1 - warper->x1max;\r\n          xx1  = warper->x1max;\r\n        }\r\n      }\r\n\r\n      if ( xx1 < warper->x1 )\r\n        base_distort = warper->x1 - xx1;\r\n      else\r\n        base_distort = xx1 - warper->x1;\r\n\r\n      if ( xx2 < warper->x2 )\r\n        base_distort += warper->x2 - xx2;\r\n      else\r\n        base_distort += xx2 - warper->x2;\r\n\r\n      /* give base distortion a greater weight while scoring */\r\n      base_distort *= 10;\r\n\r\n      new_scale = org_scale + FT_DivFix( w - warper->w0, X2 - X1 );\r\n      new_delta = xx1 - FT_MulFix( X1, new_scale );\r\n\r\n      af_warper_compute_line_best( warper, new_scale, new_delta, xx1, xx2,\r\n                                   base_distort,\r\n                                   segments, num_segments );\r\n    }\r\n\r\n    {\r\n      FT_Fixed  best_scale = warper->best_scale;\r\n      FT_Pos    best_delta = warper->best_delta;\r\n\r\n\r\n      hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale )\r\n                          + best_delta;\r\n      hints->xmax_delta = FT_MulFix( X2, best_scale - org_scale )\r\n                          + best_delta;\r\n\r\n      *a_scale = best_scale;\r\n      *a_delta = best_delta;\r\n    }\r\n  }\r\n\r\n#else /* !AF_CONFIG_OPTION_USE_WARPER */\r\n\r\n  /* ANSI C doesn't like empty source files */\r\n  typedef int  _af_warp_dummy;\r\n\r\n#endif /* !AF_CONFIG_OPTION_USE_WARPER */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/afwarp.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afwarp.h                                                               */\r\n/*                                                                         */\r\n/*    Auto-fitter warping algorithm (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2007 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFWARP_H__\r\n#define __AFWARP_H__\r\n\r\n#include \"afhints.h\"\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#define AF_WARPER_SCALE\r\n\r\n#define AF_WARPER_FLOOR( x )  ( (x) & ~63 )\r\n#define AF_WARPER_CEIL( x )   AF_WARPER_FLOOR( (x) + 63 )\r\n\r\n\r\n  typedef FT_Int32  AF_WarpScore;\r\n\r\n  typedef struct  AF_WarperRec_\r\n  {\r\n    FT_Pos        x1, x2;\r\n    FT_Pos        t1, t2;\r\n    FT_Pos        x1min, x1max;\r\n    FT_Pos        x2min, x2max;\r\n    FT_Pos        w0, wmin, wmax;\r\n\r\n    FT_Fixed      best_scale;\r\n    FT_Pos        best_delta;\r\n    AF_WarpScore  best_score;\r\n    AF_WarpScore  best_distort;\r\n\r\n  } AF_WarperRec, *AF_Warper;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  af_warper_compute( AF_Warper      warper,\r\n                     AF_GlyphHints  hints,\r\n                     AF_Dimension   dim,\r\n                     FT_Fixed      *a_scale,\r\n                     FT_Fixed      *a_delta );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __AFWARP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/autofit.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  autofit.c                                                              */\r\n/*                                                                         */\r\n/*    Auto-fitter module (body).                                           */\r\n/*                                                                         */\r\n/*  Copyright 2003-2007, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n#include <ft2build.h>\r\n#include \"afpic.c\"\r\n#include \"afangles.c\"\r\n#include \"afglobal.c\"\r\n#include \"afhints.c\"\r\n\r\n#include \"afdummy.c\"\r\n#include \"aflatin.c\"\r\n#ifdef FT_OPTION_AUTOFIT2\r\n#include \"aflatin2.c\"\r\n#endif\r\n#include \"afcjk.c\"\r\n#include \"afindic.c\"\r\n\r\n#include \"afloader.c\"\r\n#include \"afmodule.c\"\r\n\r\n#ifdef AF_CONFIG_OPTION_USE_WARPER\r\n#include \"afwarp.c\"\r\n#endif\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/module.mk",
    "content": "#\r\n# FreeType 2 auto-fitter module definition\r\n#\r\n\r\n\r\n# Copyright 2003, 2004, 2005, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += AUTOFIT_MODULE\r\n\r\ndefine AUTOFIT_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, autofit_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)autofit   $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/autofit/rules.mk",
    "content": "#\r\n# FreeType 2 auto-fitter module configuration rules\r\n#\r\n\r\n\r\n# Copyright 2003, 2004, 2005, 2006, 2007, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# AUTOF driver directory\r\n#\r\nAUTOF_DIR := $(SRC_DIR)/autofit\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nAUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR))\r\n\r\n\r\n# AUTOF driver sources (i.e., C files)\r\n#\r\nAUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \\\r\n                 $(AUTOF_DIR)/afcjk.c    \\\r\n                 $(AUTOF_DIR)/afdummy.c  \\\r\n                 $(AUTOF_DIR)/afglobal.c \\\r\n                 $(AUTOF_DIR)/afhints.c  \\\r\n                 $(AUTOF_DIR)/afindic.c  \\\r\n                 $(AUTOF_DIR)/aflatin.c  \\\r\n                 $(AUTOF_DIR)/afloader.c \\\r\n                 $(AUTOF_DIR)/afmodule.c \\\r\n                 $(AUTOF_DIR)/afpic.c    \\\r\n                 $(AUTOF_DIR)/afwarp.c\r\n\r\n# AUTOF driver headers\r\n#\r\nAUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h)  \\\r\n               $(AUTOF_DIR)/aferrors.h \\\r\n               $(AUTOF_DIR)/aftypes.h\r\n\r\n\r\n# AUTOF driver object(s)\r\n#\r\n#   AUTOF_DRV_OBJ_M is used during `multi' builds.\r\n#   AUTOF_DRV_OBJ_S is used during `single' builds.\r\n#\r\nAUTOF_DRV_OBJ_M := $(AUTOF_DRV_SRC:$(AUTOF_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nAUTOF_DRV_OBJ_S := $(OBJ_DIR)/autofit.$O\r\n\r\n# AUTOF driver source file for single build\r\n#\r\nAUTOF_DRV_SRC_S := $(AUTOF_DIR)/autofit.c\r\n\r\n\r\n# AUTOF driver - single object\r\n#\r\n$(AUTOF_DRV_OBJ_S): $(AUTOF_DRV_SRC_S) $(AUTOF_DRV_SRC) \\\r\n                   $(FREETYPE_H) $(AUTOF_DRV_H)\r\n\t$(AUTOF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(AUTOF_DRV_SRC_S))\r\n\r\n\r\n# AUTOF driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(AUTOF_DIR)/%.c $(FREETYPE_H) $(AUTOF_DRV_H)\r\n\t$(AUTOF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(AUTOF_DRV_OBJ_S)\r\nDRV_OBJS_M += $(AUTOF_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/Jamfile",
    "content": "# FreeType 2 src/base Jamfile\r\n#\r\n# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) base ;\r\n\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = ftadvanc ftcalc   ftdbgmem ftgloadr\r\n               ftobjs   ftoutln  ftrfork  ftsnames\r\n               ftstream fttrigon ftutil\r\n               basepic  ftpic\r\n               ;\r\n  }\r\n  else\r\n  {\r\n    _sources = ftbase ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# Add the optional/replaceable files.\r\n#\r\n{\r\n  local  _sources = bbox   bdf    bitmap debug  gasp\r\n                    glyph  gxval  init   lcdfil mm\r\n                    otval  pfr    stroke synth  system\r\n                    type1  winfnt xf86   patent\r\n                    ;\r\n\r\n  Library  $(FT2_LIB) : ft$(_sources).c ;\r\n}\r\n\r\n# Add Macintosh-specific file to the library when necessary.\r\n#\r\nif $(MAC)\r\n{\r\n  Library  $(FT2_LIB) : ftmac.c ;\r\n}\r\nelse if $(OS) = MACOSX\r\n{\r\n  if $(FT2_MULTI)\r\n  {\r\n    Library  $(FT2_LIB) : ftmac.c ;\r\n  }\r\n}\r\n\r\n# end of src/base Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/basepic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  basepic.c                                                              */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for base.            */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"basepic.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from ftglyph.c */\r\n  void\r\n  FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class*  clazz );\r\n\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n  /* forward declaration of PIC init function from ftrfork.c */\r\n  /* (not modularized)                                       */\r\n  void\r\n  FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec*  record );\r\n#endif\r\n\r\n  /* forward declaration of PIC init functions from ftinit.c */\r\n  FT_Error\r\n  ft_create_default_module_classes( FT_Library  library );\r\n\r\n  void\r\n  ft_destroy_default_module_classes( FT_Library  library );\r\n\r\n\r\n  void\r\n  ft_base_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    if ( pic_container->base )\r\n    {\r\n      /* destroy default module classes            */\r\n      /* (in case FT_Add_Default_Modules was used) */\r\n      ft_destroy_default_module_classes( library );\r\n\r\n      FT_FREE( pic_container->base );\r\n      pic_container->base = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  ft_base_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = FT_Err_Ok;\r\n    BasePIC*           container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->base = container;\r\n\r\n    /* initialize default modules list and pointers */\r\n    error = ft_create_default_module_classes( library );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* initialize pointer table -                       */\r\n    /* this is how the module usually expects this data */\r\n    FT_Init_Class_ft_outline_glyph_class(\r\n      &container->ft_outline_glyph_class );\r\n    FT_Init_Class_ft_bitmap_glyph_class(\r\n      &container->ft_bitmap_glyph_class );\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n    FT_Init_Table_raccess_guess_table(\r\n      (ft_raccess_guess_rec*)&container->ft_raccess_guess_table );\r\n#endif\r\n\r\nExit:\r\n    if( error )\r\n      ft_base_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/basepic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  basepic.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for base.            */\r\n/*                                                                         */\r\n/*  Copyright 2009 by                                                      */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __BASEPIC_H__\r\n#define __BASEPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class\r\n#define FT_BITMAP_GLYPH_CLASS_GET  &ft_bitmap_glyph_class\r\n#define FT_DEFAULT_MODULES_GET     ft_default_modules\r\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table\r\n#endif\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#include FT_GLYPH_H\r\n\r\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n#include FT_INTERNAL_RFORK_H\r\n#endif\r\n\r\n\r\n  typedef struct BasePIC_\r\n  {\r\n    FT_Module_Class** default_module_classes;\r\n    FT_Glyph_Class ft_outline_glyph_class;\r\n    FT_Glyph_Class ft_bitmap_glyph_class;\r\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n    ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES];\r\n#endif\r\n  } BasePIC;\r\n\r\n#define GET_PIC(lib)                  ((BasePIC*)((lib)->pic_container.base))\r\n#define FT_OUTLINE_GLYPH_CLASS_GET    (&GET_PIC(library)->ft_outline_glyph_class)\r\n#define FT_BITMAP_GLYPH_CLASS_GET     (&GET_PIC(library)->ft_bitmap_glyph_class)\r\n#define FT_DEFAULT_MODULES_GET        (GET_PIC(library)->default_module_classes)\r\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n#define FT_RACCESS_GUESS_TABLE_GET    (GET_PIC(library)->ft_raccess_guess_table)\r\n#endif\r\n\r\n  /* see basepic.c for the implementation. */\r\n  void\r\n  ft_base_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  ft_base_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __BASEPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftadvanc.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftadvanc.c                                                             */\r\n/*                                                                         */\r\n/*    Quick computation of advance widths (body).                          */\r\n/*                                                                         */\r\n/*  Copyright 2008, 2009, 2011 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_ADVANCES_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\n  static FT_Error\r\n  _ft_face_scale_advances( FT_Face    face,\r\n                           FT_Fixed*  advances,\r\n                           FT_UInt    count,\r\n                           FT_Int32   flags )\r\n  {\r\n    FT_Fixed  scale;\r\n    FT_UInt   nn;\r\n\r\n\r\n    if ( flags & FT_LOAD_NO_SCALE )\r\n      return FT_Err_Ok;\r\n\r\n    if ( face->size == NULL )\r\n      return FT_Err_Invalid_Size_Handle;\r\n\r\n    if ( flags & FT_LOAD_VERTICAL_LAYOUT )\r\n      scale = face->size->metrics.y_scale;\r\n    else\r\n      scale = face->size->metrics.x_scale;\r\n\r\n    /* this must be the same scaling as to get linear{Hori,Vert}Advance */\r\n    /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c)        */\r\n\r\n    for ( nn = 0; nn < count; nn++ )\r\n      advances[nn] = FT_MulDiv( advances[nn], scale, 64 );\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n   /* at the moment, we can perform fast advance retrieval only in */\r\n   /* the following cases:                                         */\r\n   /*                                                              */\r\n   /*  - unscaled load                                             */\r\n   /*  - unhinted load                                             */\r\n   /*  - light-hinted load                                         */\r\n\r\n#define LOAD_ADVANCE_FAST_CHECK( flags )                            \\\r\n          ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING )    || \\\r\n            FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT )\r\n\r\n\r\n  /* documentation is in ftadvanc.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Advance( FT_Face    face,\r\n                  FT_UInt    gindex,\r\n                  FT_Int32   flags,\r\n                  FT_Fixed  *padvance )\r\n  {\r\n    FT_Face_GetAdvancesFunc  func;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( gindex >= (FT_UInt)face->num_glyphs )\r\n      return FT_Err_Invalid_Glyph_Index;\r\n\r\n    func = face->driver->clazz->get_advances;\r\n    if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )\r\n    {\r\n      FT_Error  error;\r\n\r\n\r\n      error = func( face, gindex, 1, flags, padvance );\r\n      if ( !error )\r\n        return _ft_face_scale_advances( face, padvance, 1, flags );\r\n\r\n      if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )\r\n        return error;\r\n    }\r\n\r\n    return FT_Get_Advances( face, gindex, 1, flags, padvance );\r\n  }\r\n\r\n\r\n  /* documentation is in ftadvanc.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Advances( FT_Face    face,\r\n                   FT_UInt    start,\r\n                   FT_UInt    count,\r\n                   FT_Int32   flags,\r\n                   FT_Fixed  *padvances )\r\n  {\r\n    FT_Face_GetAdvancesFunc  func;\r\n    FT_UInt                  num, end, nn;\r\n    FT_Error                 error = FT_Err_Ok;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    num = (FT_UInt)face->num_glyphs;\r\n    end = start + count;\r\n    if ( start >= num || end < start || end > num )\r\n      return FT_Err_Invalid_Glyph_Index;\r\n\r\n    if ( count == 0 )\r\n      return FT_Err_Ok;\r\n\r\n    func = face->driver->clazz->get_advances;\r\n    if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )\r\n    {\r\n      error = func( face, start, count, flags, padvances );\r\n      if ( !error )\r\n        return _ft_face_scale_advances( face, padvances, count, flags );\r\n\r\n      if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )\r\n        return error;\r\n    }\r\n\r\n    error = FT_Err_Ok;\r\n\r\n    if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )\r\n      return FT_Err_Unimplemented_Feature;\r\n\r\n    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;\r\n    for ( nn = 0; nn < count; nn++ )\r\n    {\r\n      error = FT_Load_Glyph( face, start + nn, flags );\r\n      if ( error )\r\n        break;\r\n\r\n      /* scale from 26.6 to 16.16 */\r\n      padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )\r\n                      ? face->glyph->advance.y << 10\r\n                      : face->glyph->advance.x << 10;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftapi.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftapi.c                                                                */\r\n/*                                                                         */\r\n/*    The FreeType compatibility functions (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_LIST_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_OUTLINE_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                 C O M P A T I B I L I T Y                       ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* backwards compatibility API */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_New_Memory_Stream( FT_Library  library,\r\n                        FT_Byte*    base,\r\n                        FT_ULong    size,\r\n                        FT_Stream   stream )\r\n  {\r\n    FT_UNUSED( library );\r\n\r\n    FT_Stream_OpenMemory( stream, base, size );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Seek_Stream( FT_Stream  stream,\r\n                  FT_ULong   pos )\r\n  {\r\n    return FT_Stream_Seek( stream, pos );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Skip_Stream( FT_Stream  stream,\r\n                  FT_Long    distance )\r\n  {\r\n    return FT_Stream_Skip( stream, distance );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Read_Stream( FT_Stream  stream,\r\n                  FT_Byte*   buffer,\r\n                  FT_ULong   count )\r\n  {\r\n    return FT_Stream_Read( stream, buffer, count );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Read_Stream_At( FT_Stream  stream,\r\n                     FT_ULong   pos,\r\n                     FT_Byte*   buffer,\r\n                     FT_ULong   count )\r\n  {\r\n    return FT_Stream_ReadAt( stream, pos, buffer, count );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Extract_Frame( FT_Stream  stream,\r\n                    FT_ULong   count,\r\n                    FT_Byte**  pbytes )\r\n  {\r\n    return FT_Stream_ExtractFrame( stream, count, pbytes );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Release_Frame( FT_Stream  stream,\r\n                    FT_Byte**  pbytes )\r\n  {\r\n    FT_Stream_ReleaseFrame( stream, pbytes );\r\n  }\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Access_Frame( FT_Stream  stream,\r\n                   FT_ULong   count )\r\n  {\r\n    return FT_Stream_EnterFrame( stream, count );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Forget_Frame( FT_Stream  stream )\r\n  {\r\n    FT_Stream_ExitFrame( stream );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftbase.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbase.c                                                               */\r\n/*                                                                         */\r\n/*    Single object library component (body only).                         */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n#define  FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include \"ftpic.c\"\r\n#include \"basepic.c\"\r\n#include \"ftadvanc.c\"\r\n#include \"ftcalc.c\"\r\n#include \"ftdbgmem.c\"\r\n#include \"ftgloadr.c\"\r\n#include \"ftobjs.c\"\r\n#include \"ftoutln.c\"\r\n#include \"ftrfork.c\"\r\n#include \"ftsnames.c\"\r\n#include \"ftstream.c\"\r\n#include \"fttrigon.c\"\r\n#include \"ftutil.c\"\r\n\r\n#ifdef FT_MACINTOSH\r\n#include \"ftmac.c\"\r\n#endif\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftbase.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbase.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType private functions used in base module (specification).  */\r\n/*                                                                         */\r\n/*  Copyright 2008, 2010 by                                                */\r\n/*  David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTBASE_H__\r\n#define __FTBASE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */\r\n  /* font, and try to load a face specified by the face_index.            */\r\n  FT_LOCAL( FT_Error )\r\n  open_face_PS_from_sfnt_stream( FT_Library     library,\r\n                                 FT_Stream      stream,\r\n                                 FT_Long        face_index,\r\n                                 FT_Int         num_params,\r\n                                 FT_Parameter  *params,\r\n                                 FT_Face       *aface );\r\n\r\n\r\n  /* Create a new FT_Face given a buffer and a driver name. */\r\n  /* From ftmac.c.                                          */\r\n  FT_LOCAL( FT_Error )\r\n  open_face_from_buffer( FT_Library   library,\r\n                         FT_Byte*     base,\r\n                         FT_ULong     size,\r\n                         FT_Long      face_index,\r\n                         const char*  driver_name,\r\n                         FT_Face     *aface );\r\n\r\n\r\n#if  defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \\\r\n    !defined( FT_MACINTOSH )\r\n  /* Mac OS X/Darwin kernel often changes recommended method to access */\r\n  /* the resource fork and older methods makes the kernel issue the    */\r\n  /* warning of deprecated method.  To calm it down, the methods based */\r\n  /* on Darwin VFS should be grouped and skip the rest methods after   */\r\n  /* the case the resource is opened but found to lack a font in it.   */\r\n  FT_LOCAL( FT_Bool )\r\n  ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt  rule_index );\r\n#endif\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBASE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftbbox.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbbox.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType bbox computation (body).                                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2006, 2010 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used        */\r\n/*  modified and distributed under the terms of the FreeType project       */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This component has a _single_ role: to compute exact outline bounding */\r\n  /* boxes.                                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_BBOX_H\r\n#include FT_IMAGE_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\n  typedef struct  TBBox_Rec_\r\n  {\r\n    FT_Vector  last;\r\n    FT_BBox    bbox;\r\n\r\n  } TBBox_Rec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    BBox_Move_To                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used as a `move_to' and `line_to' emitter during  */\r\n  /*    FT_Outline_Decompose().  It simply records the destination point   */\r\n  /*    in `user->last'; no further computations are necessary since we    */\r\n  /*    use the cbox as the starting bbox which must be refined.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    to   :: A pointer to the destination vector.                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    user :: A pointer to the current walk context.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Always 0.  Needed for the interface only.                          */\r\n  /*                                                                       */\r\n  static int\r\n  BBox_Move_To( FT_Vector*  to,\r\n                TBBox_Rec*  user )\r\n  {\r\n    user->last = *to;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n#define CHECK_X( p, bbox )  \\\r\n          ( p->x < bbox.xMin || p->x > bbox.xMax )\r\n\r\n#define CHECK_Y( p, bbox )  \\\r\n          ( p->y < bbox.yMin || p->y > bbox.yMax )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    BBox_Conic_Check                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finds the extrema of a 1-dimensional conic Bezier curve and update */\r\n  /*    a bounding range.  This version uses direct computation, as it     */\r\n  /*    doesn't need square roots.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y1  :: The start coordinate.                                       */\r\n  /*                                                                       */\r\n  /*    y2  :: The coordinate of the control point.                        */\r\n  /*                                                                       */\r\n  /*    y3  :: The end coordinate.                                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    min :: The address of the current minimum.                         */\r\n  /*                                                                       */\r\n  /*    max :: The address of the current maximum.                         */\r\n  /*                                                                       */\r\n  static void\r\n  BBox_Conic_Check( FT_Pos   y1,\r\n                    FT_Pos   y2,\r\n                    FT_Pos   y3,\r\n                    FT_Pos*  min,\r\n                    FT_Pos*  max )\r\n  {\r\n    if ( y1 <= y3 && y2 == y1 )     /* flat arc */\r\n      goto Suite;\r\n\r\n    if ( y1 < y3 )\r\n    {\r\n      if ( y2 >= y1 && y2 <= y3 )   /* ascending arc */\r\n        goto Suite;\r\n    }\r\n    else\r\n    {\r\n      if ( y2 >= y3 && y2 <= y1 )   /* descending arc */\r\n      {\r\n        y2 = y1;\r\n        y1 = y3;\r\n        y3 = y2;\r\n        goto Suite;\r\n      }\r\n    }\r\n\r\n    y1 = y3 = y1 - FT_MulDiv( y2 - y1, y2 - y1, y1 - 2*y2 + y3 );\r\n\r\n  Suite:\r\n    if ( y1 < *min ) *min = y1;\r\n    if ( y3 > *max ) *max = y3;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    BBox_Conic_To                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used as a `conic_to' emitter during               */\r\n  /*    FT_Outline_Decompose().  It checks a conic Bezier curve with the   */\r\n  /*    current bounding box, and computes its extrema if necessary to     */\r\n  /*    update it.                                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    control :: A pointer to a control point.                           */\r\n  /*                                                                       */\r\n  /*    to      :: A pointer to the destination vector.                    */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    user    :: The address of the current walk context.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Always 0.  Needed for the interface only.                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In the case of a non-monotonous arc, we compute directly the       */\r\n  /*    extremum coordinates, as it is sufficiently fast.                  */\r\n  /*                                                                       */\r\n  static int\r\n  BBox_Conic_To( FT_Vector*  control,\r\n                 FT_Vector*  to,\r\n                 TBBox_Rec*  user )\r\n  {\r\n    /* we don't need to check `to' since it is always an `on' point, thus */\r\n    /* within the bbox                                                    */\r\n\r\n    if ( CHECK_X( control, user->bbox ) )\r\n      BBox_Conic_Check( user->last.x,\r\n                        control->x,\r\n                        to->x,\r\n                        &user->bbox.xMin,\r\n                        &user->bbox.xMax );\r\n\r\n    if ( CHECK_Y( control, user->bbox ) )\r\n      BBox_Conic_Check( user->last.y,\r\n                        control->y,\r\n                        to->y,\r\n                        &user->bbox.yMin,\r\n                        &user->bbox.yMax );\r\n\r\n    user->last = *to;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    BBox_Cubic_Check                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finds the extrema of a 1-dimensional cubic Bezier curve and        */\r\n  /*    updates a bounding range.  This version uses splitting because we  */\r\n  /*    don't want to use square roots and extra accuracy.                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    p1  :: The start coordinate.                                       */\r\n  /*                                                                       */\r\n  /*    p2  :: The coordinate of the first control point.                  */\r\n  /*                                                                       */\r\n  /*    p3  :: The coordinate of the second control point.                 */\r\n  /*                                                                       */\r\n  /*    p4  :: The end coordinate.                                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    min :: The address of the current minimum.                         */\r\n  /*                                                                       */\r\n  /*    max :: The address of the current maximum.                         */\r\n  /*                                                                       */\r\n\r\n#if 0\r\n\r\n  static void\r\n  BBox_Cubic_Check( FT_Pos   p1,\r\n                    FT_Pos   p2,\r\n                    FT_Pos   p3,\r\n                    FT_Pos   p4,\r\n                    FT_Pos*  min,\r\n                    FT_Pos*  max )\r\n  {\r\n    FT_Pos  stack[32*3 + 1], *arc;\r\n\r\n\r\n    arc = stack;\r\n\r\n    arc[0] = p1;\r\n    arc[1] = p2;\r\n    arc[2] = p3;\r\n    arc[3] = p4;\r\n\r\n    do\r\n    {\r\n      FT_Pos  y1 = arc[0];\r\n      FT_Pos  y2 = arc[1];\r\n      FT_Pos  y3 = arc[2];\r\n      FT_Pos  y4 = arc[3];\r\n\r\n\r\n      if ( y1 == y4 )\r\n      {\r\n        if ( y1 == y2 && y1 == y3 )                         /* flat */\r\n          goto Test;\r\n      }\r\n      else if ( y1 < y4 )\r\n      {\r\n        if ( y2 >= y1 && y2 <= y4 && y3 >= y1 && y3 <= y4 ) /* ascending */\r\n          goto Test;\r\n      }\r\n      else\r\n      {\r\n        if ( y2 >= y4 && y2 <= y1 && y3 >= y4 && y3 <= y1 ) /* descending */\r\n        {\r\n          y2 = y1;\r\n          y1 = y4;\r\n          y4 = y2;\r\n          goto Test;\r\n        }\r\n      }\r\n\r\n      /* unknown direction -- split the arc in two */\r\n      arc[6] = y4;\r\n      arc[1] = y1 = ( y1 + y2 ) / 2;\r\n      arc[5] = y4 = ( y4 + y3 ) / 2;\r\n      y2 = ( y2 + y3 ) / 2;\r\n      arc[2] = y1 = ( y1 + y2 ) / 2;\r\n      arc[4] = y4 = ( y4 + y2 ) / 2;\r\n      arc[3] = ( y1 + y4 ) / 2;\r\n\r\n      arc += 3;\r\n      goto Suite;\r\n\r\n   Test:\r\n      if ( y1 < *min ) *min = y1;\r\n      if ( y4 > *max ) *max = y4;\r\n      arc -= 3;\r\n\r\n    Suite:\r\n      ;\r\n    } while ( arc >= stack );\r\n  }\r\n\r\n#else\r\n\r\n  static void\r\n  test_cubic_extrema( FT_Pos    y1,\r\n                      FT_Pos    y2,\r\n                      FT_Pos    y3,\r\n                      FT_Pos    y4,\r\n                      FT_Fixed  u,\r\n                      FT_Pos*   min,\r\n                      FT_Pos*   max )\r\n  {\r\n /* FT_Pos    a = y4 - 3*y3 + 3*y2 - y1; */\r\n    FT_Pos    b = y3 - 2*y2 + y1;\r\n    FT_Pos    c = y2 - y1;\r\n    FT_Pos    d = y1;\r\n    FT_Pos    y;\r\n    FT_Fixed  uu;\r\n\r\n    FT_UNUSED ( y4 );\r\n\r\n\r\n    /* The polynomial is                      */\r\n    /*                                        */\r\n    /*    P(x) = a*x^3 + 3b*x^2 + 3c*x + d  , */\r\n    /*                                        */\r\n    /*   dP/dx = 3a*x^2 + 6b*x + 3c         . */\r\n    /*                                        */\r\n    /* However, we also have                  */\r\n    /*                                        */\r\n    /*   dP/dx(u) = 0                       , */\r\n    /*                                        */\r\n    /* which implies by subtraction that      */\r\n    /*                                        */\r\n    /*   P(u) = b*u^2 + 2c*u + d            . */\r\n\r\n    if ( u > 0 && u < 0x10000L )\r\n    {\r\n      uu = FT_MulFix( u, u );\r\n      y  = d + FT_MulFix( c, 2*u ) + FT_MulFix( b, uu );\r\n\r\n      if ( y < *min ) *min = y;\r\n      if ( y > *max ) *max = y;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  BBox_Cubic_Check( FT_Pos   y1,\r\n                    FT_Pos   y2,\r\n                    FT_Pos   y3,\r\n                    FT_Pos   y4,\r\n                    FT_Pos*  min,\r\n                    FT_Pos*  max )\r\n  {\r\n    /* always compare first and last points */\r\n    if      ( y1 < *min )  *min = y1;\r\n    else if ( y1 > *max )  *max = y1;\r\n\r\n    if      ( y4 < *min )  *min = y4;\r\n    else if ( y4 > *max )  *max = y4;\r\n\r\n    /* now, try to see if there are split points here */\r\n    if ( y1 <= y4 )\r\n    {\r\n      /* flat or ascending arc test */\r\n      if ( y1 <= y2 && y2 <= y4 && y1 <= y3 && y3 <= y4 )\r\n        return;\r\n    }\r\n    else /* y1 > y4 */\r\n    {\r\n      /* descending arc test */\r\n      if ( y1 >= y2 && y2 >= y4 && y1 >= y3 && y3 >= y4 )\r\n        return;\r\n    }\r\n\r\n    /* There are some split points.  Find them. */\r\n    {\r\n      FT_Pos    a = y4 - 3*y3 + 3*y2 - y1;\r\n      FT_Pos    b = y3 - 2*y2 + y1;\r\n      FT_Pos    c = y2 - y1;\r\n      FT_Pos    d;\r\n      FT_Fixed  t;\r\n\r\n\r\n      /* We need to solve `ax^2+2bx+c' here, without floating points!      */\r\n      /* The trick is to normalize to a different representation in order  */\r\n      /* to use our 16.16 fixed point routines.                            */\r\n      /*                                                                   */\r\n      /* We compute FT_MulFix(b,b) and FT_MulFix(a,c) after normalization. */\r\n      /* These values must fit into a single 16.16 value.                  */\r\n      /*                                                                   */\r\n      /* We normalize a, b, and c to `8.16' fixed float values to ensure   */\r\n      /* that its product is held in a `16.16' value.                      */\r\n\r\n      {\r\n        FT_ULong  t1, t2;\r\n        int       shift = 0;\r\n\r\n\r\n        /* The following computation is based on the fact that for   */\r\n        /* any value `y', if `n' is the position of the most         */\r\n        /* significant bit of `abs(y)' (starting from 0 for the      */\r\n        /* least significant bit), then `y' is in the range          */\r\n        /*                                                           */\r\n        /*   -2^n..2^n-1                                             */\r\n        /*                                                           */\r\n        /* We want to shift `a', `b', and `c' concurrently in order  */\r\n        /* to ensure that they all fit in 8.16 values, which maps    */\r\n        /* to the integer range `-2^23..2^23-1'.                     */\r\n        /*                                                           */\r\n        /* Necessarily, we need to shift `a', `b', and `c' so that   */\r\n        /* the most significant bit of its absolute values is at     */\r\n        /* _most_ at position 23.                                    */\r\n        /*                                                           */\r\n        /* We begin by computing `t1' as the bitwise `OR' of the     */\r\n        /* absolute values of `a', `b', `c'.                         */\r\n\r\n        t1  = (FT_ULong)( ( a >= 0 ) ? a : -a );\r\n        t2  = (FT_ULong)( ( b >= 0 ) ? b : -b );\r\n        t1 |= t2;\r\n        t2  = (FT_ULong)( ( c >= 0 ) ? c : -c );\r\n        t1 |= t2;\r\n\r\n        /* Now we can be sure that the most significant bit of `t1'  */\r\n        /* is the most significant bit of either `a', `b', or `c',   */\r\n        /* depending on the greatest integer range of the particular */\r\n        /* variable.                                                 */\r\n        /*                                                           */\r\n        /* Next, we compute the `shift', by shifting `t1' as many    */\r\n        /* times as necessary to move its MSB to position 23.  This  */\r\n        /* corresponds to a value of `t1' that is in the range       */\r\n        /* 0x40_0000..0x7F_FFFF.                                     */\r\n        /*                                                           */\r\n        /* Finally, we shift `a', `b', and `c' by the same amount.   */\r\n        /* This ensures that all values are now in the range         */\r\n        /* -2^23..2^23, i.e., they are now expressed as 8.16         */\r\n        /* fixed-float numbers.  This also means that we are using   */\r\n        /* 24 bits of precision to compute the zeros, independently  */\r\n        /* of the range of the original polynomial coefficients.     */\r\n        /*                                                           */\r\n        /* This algorithm should ensure reasonably accurate values   */\r\n        /* for the zeros.  Note that they are only expressed with    */\r\n        /* 16 bits when computing the extrema (the zeros need to     */\r\n        /* be in 0..1 exclusive to be considered part of the arc).   */\r\n\r\n        if ( t1 == 0 )  /* all coefficients are 0! */\r\n          return;\r\n\r\n        if ( t1 > 0x7FFFFFUL )\r\n        {\r\n          do\r\n          {\r\n            shift++;\r\n            t1 >>= 1;\r\n\r\n          } while ( t1 > 0x7FFFFFUL );\r\n\r\n          /* this loses some bits of precision, but we use 24 of them */\r\n          /* for the computation anyway                               */\r\n          a >>= shift;\r\n          b >>= shift;\r\n          c >>= shift;\r\n        }\r\n        else if ( t1 < 0x400000UL )\r\n        {\r\n          do\r\n          {\r\n            shift++;\r\n            t1 <<= 1;\r\n\r\n          } while ( t1 < 0x400000UL );\r\n\r\n          a <<= shift;\r\n          b <<= shift;\r\n          c <<= shift;\r\n        }\r\n      }\r\n\r\n      /* handle a == 0 */\r\n      if ( a == 0 )\r\n      {\r\n        if ( b != 0 )\r\n        {\r\n          t = - FT_DivFix( c, b ) / 2;\r\n          test_cubic_extrema( y1, y2, y3, y4, t, min, max );\r\n        }\r\n      }\r\n      else\r\n      {\r\n        /* solve the equation now */\r\n        d = FT_MulFix( b, b ) - FT_MulFix( a, c );\r\n        if ( d < 0 )\r\n          return;\r\n\r\n        if ( d == 0 )\r\n        {\r\n          /* there is a single split point at -b/a */\r\n          t = - FT_DivFix( b, a );\r\n          test_cubic_extrema( y1, y2, y3, y4, t, min, max );\r\n        }\r\n        else\r\n        {\r\n          /* there are two solutions; we need to filter them */\r\n          d = FT_SqrtFixed( (FT_Int32)d );\r\n          t = - FT_DivFix( b - d, a );\r\n          test_cubic_extrema( y1, y2, y3, y4, t, min, max );\r\n\r\n          t = - FT_DivFix( b + d, a );\r\n          test_cubic_extrema( y1, y2, y3, y4, t, min, max );\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    BBox_Cubic_To                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used as a `cubic_to' emitter during               */\r\n  /*    FT_Outline_Decompose().  It checks a cubic Bezier curve with the   */\r\n  /*    current bounding box, and computes its extrema if necessary to     */\r\n  /*    update it.                                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    control1 :: A pointer to the first control point.                  */\r\n  /*                                                                       */\r\n  /*    control2 :: A pointer to the second control point.                 */\r\n  /*                                                                       */\r\n  /*    to       :: A pointer to the destination vector.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    user     :: The address of the current walk context.               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Always 0.  Needed for the interface only.                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In the case of a non-monotonous arc, we don't compute directly     */\r\n  /*    extremum coordinates, we subdivide instead.                        */\r\n  /*                                                                       */\r\n  static int\r\n  BBox_Cubic_To( FT_Vector*  control1,\r\n                 FT_Vector*  control2,\r\n                 FT_Vector*  to,\r\n                 TBBox_Rec*  user )\r\n  {\r\n    /* we don't need to check `to' since it is always an `on' point, thus */\r\n    /* within the bbox                                                    */\r\n\r\n    if ( CHECK_X( control1, user->bbox ) ||\r\n         CHECK_X( control2, user->bbox ) )\r\n      BBox_Cubic_Check( user->last.x,\r\n                        control1->x,\r\n                        control2->x,\r\n                        to->x,\r\n                        &user->bbox.xMin,\r\n                        &user->bbox.xMax );\r\n\r\n    if ( CHECK_Y( control1, user->bbox ) ||\r\n         CHECK_Y( control2, user->bbox ) )\r\n      BBox_Cubic_Check( user->last.y,\r\n                        control1->y,\r\n                        control2->y,\r\n                        to->y,\r\n                        &user->bbox.yMin,\r\n                        &user->bbox.yMax );\r\n\r\n    user->last = *to;\r\n\r\n    return 0;\r\n  }\r\n\r\nFT_DEFINE_OUTLINE_FUNCS(bbox_interface,\r\n    (FT_Outline_MoveTo_Func) BBox_Move_To,\r\n    (FT_Outline_LineTo_Func) BBox_Move_To,\r\n    (FT_Outline_ConicTo_Func)BBox_Conic_To,\r\n    (FT_Outline_CubicTo_Func)BBox_Cubic_To,\r\n    0, 0\r\n  )\r\n\r\n  /* documentation is in ftbbox.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Get_BBox( FT_Outline*  outline,\r\n                       FT_BBox     *abbox )\r\n  {\r\n    FT_BBox     cbox;\r\n    FT_BBox     bbox;\r\n    FT_Vector*  vec;\r\n    FT_UShort   n;\r\n\r\n\r\n    if ( !abbox )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    if ( !outline )\r\n      return FT_Err_Invalid_Outline;\r\n\r\n    /* if outline is empty, return (0,0,0,0) */\r\n    if ( outline->n_points == 0 || outline->n_contours <= 0 )\r\n    {\r\n      abbox->xMin = abbox->xMax = 0;\r\n      abbox->yMin = abbox->yMax = 0;\r\n      return 0;\r\n    }\r\n\r\n    /* We compute the control box as well as the bounding box of  */\r\n    /* all `on' points in the outline.  Then, if the two boxes    */\r\n    /* coincide, we exit immediately.                             */\r\n\r\n    vec = outline->points;\r\n    bbox.xMin = bbox.xMax = cbox.xMin = cbox.xMax = vec->x;\r\n    bbox.yMin = bbox.yMax = cbox.yMin = cbox.yMax = vec->y;\r\n    vec++;\r\n\r\n    for ( n = 1; n < outline->n_points; n++ )\r\n    {\r\n      FT_Pos  x = vec->x;\r\n      FT_Pos  y = vec->y;\r\n\r\n\r\n      /* update control box */\r\n      if ( x < cbox.xMin ) cbox.xMin = x;\r\n      if ( x > cbox.xMax ) cbox.xMax = x;\r\n\r\n      if ( y < cbox.yMin ) cbox.yMin = y;\r\n      if ( y > cbox.yMax ) cbox.yMax = y;\r\n\r\n      if ( FT_CURVE_TAG( outline->tags[n] ) == FT_CURVE_TAG_ON )\r\n      {\r\n        /* update bbox for `on' points only */\r\n        if ( x < bbox.xMin ) bbox.xMin = x;\r\n        if ( x > bbox.xMax ) bbox.xMax = x;\r\n\r\n        if ( y < bbox.yMin ) bbox.yMin = y;\r\n        if ( y > bbox.yMax ) bbox.yMax = y;\r\n      }\r\n\r\n      vec++;\r\n    }\r\n\r\n    /* test two boxes for equality */\r\n    if ( cbox.xMin < bbox.xMin || cbox.xMax > bbox.xMax ||\r\n         cbox.yMin < bbox.yMin || cbox.yMax > bbox.yMax )\r\n    {\r\n      /* the two boxes are different, now walk over the outline to */\r\n      /* get the Bezier arc extrema.                               */\r\n\r\n      FT_Error   error;\r\n      TBBox_Rec  user;\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n      FT_Outline_Funcs bbox_interface;\r\n      Init_Class_bbox_interface(&bbox_interface);\r\n#endif\r\n\r\n      user.bbox = bbox;\r\n\r\n      error = FT_Outline_Decompose( outline, &bbox_interface, &user );\r\n      if ( error )\r\n        return error;\r\n\r\n      *abbox = user.bbox;\r\n    }\r\n    else\r\n      *abbox = bbox;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftbdf.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbdf.c                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing BDF-specific strings (body).              */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_BDF_H\r\n\r\n\r\n  /* documentation is in ftbdf.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_BDF_Charset_ID( FT_Face       face,\r\n                         const char*  *acharset_encoding,\r\n                         const char*  *acharset_registry )\r\n  {\r\n    FT_Error     error;\r\n    const char*  encoding = NULL;\r\n    const char*  registry = NULL;\r\n\r\n\r\n    error = FT_Err_Invalid_Argument;\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_BDF  service;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, BDF );\r\n\r\n      if ( service && service->get_charset_id )\r\n        error = service->get_charset_id( face, &encoding, &registry );\r\n    }\r\n\r\n    if ( acharset_encoding )\r\n      *acharset_encoding = encoding;\r\n\r\n    if ( acharset_registry )\r\n      *acharset_registry = registry;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftbdf.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_BDF_Property( FT_Face           face,\r\n                       const char*       prop_name,\r\n                       BDF_PropertyRec  *aproperty )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = FT_Err_Invalid_Argument;\r\n\r\n    aproperty->type = BDF_PROPERTY_TYPE_NONE;\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_BDF  service;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, BDF );\r\n\r\n      if ( service && service->get_property )\r\n        error = service->get_property( face, prop_name, aproperty );\r\n    }\r\n\r\n    return  error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftbitmap.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbitmap.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType utility functions for bitmaps (body).                       */\r\n/*                                                                         */\r\n/*  Copyright 2004-2009, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_BITMAP_H\r\n#include FT_IMAGE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\n  static\r\n  const FT_Bitmap  null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 };\r\n\r\n\r\n  /* documentation is in ftbitmap.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Bitmap_New( FT_Bitmap  *abitmap )\r\n  {\r\n    *abitmap = null_bitmap;\r\n  }\r\n\r\n\r\n  /* documentation is in ftbitmap.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Bitmap_Copy( FT_Library        library,\r\n                  const FT_Bitmap  *source,\r\n                  FT_Bitmap        *target)\r\n  {\r\n    FT_Memory  memory = library->memory;\r\n    FT_Error   error  = FT_Err_Ok;\r\n    FT_Int     pitch  = source->pitch;\r\n    FT_ULong   size;\r\n\r\n\r\n    if ( source == target )\r\n      return FT_Err_Ok;\r\n\r\n    if ( source->buffer == NULL )\r\n    {\r\n      *target = *source;\r\n\r\n      return FT_Err_Ok;\r\n    }\r\n\r\n    if ( pitch < 0 )\r\n      pitch = -pitch;\r\n    size = (FT_ULong)( pitch * source->rows );\r\n\r\n    if ( target->buffer )\r\n    {\r\n      FT_Int    target_pitch = target->pitch;\r\n      FT_ULong  target_size;\r\n\r\n\r\n      if ( target_pitch < 0  )\r\n        target_pitch = -target_pitch;\r\n      target_size = (FT_ULong)( target_pitch * target->rows );\r\n\r\n      if ( target_size != size )\r\n        (void)FT_QREALLOC( target->buffer, target_size, size );\r\n    }\r\n    else\r\n      (void)FT_QALLOC( target->buffer, size );\r\n\r\n    if ( !error )\r\n    {\r\n      unsigned char *p;\r\n\r\n\r\n      p = target->buffer;\r\n      *target = *source;\r\n      target->buffer = p;\r\n\r\n      FT_MEM_COPY( target->buffer, source->buffer, size );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_bitmap_assure_buffer( FT_Memory   memory,\r\n                           FT_Bitmap*  bitmap,\r\n                           FT_UInt     xpixels,\r\n                           FT_UInt     ypixels )\r\n  {\r\n    FT_Error        error;\r\n    int             pitch;\r\n    int             new_pitch;\r\n    FT_UInt         bpp;\r\n    FT_Int          i, width, height;\r\n    unsigned char*  buffer = NULL;\r\n\r\n\r\n    width  = bitmap->width;\r\n    height = bitmap->rows;\r\n    pitch  = bitmap->pitch;\r\n    if ( pitch < 0 )\r\n      pitch = -pitch;\r\n\r\n    switch ( bitmap->pixel_mode )\r\n    {\r\n    case FT_PIXEL_MODE_MONO:\r\n      bpp       = 1;\r\n      new_pitch = ( width + xpixels + 7 ) >> 3;\r\n      break;\r\n    case FT_PIXEL_MODE_GRAY2:\r\n      bpp       = 2;\r\n      new_pitch = ( width + xpixels + 3 ) >> 2;\r\n      break;\r\n    case FT_PIXEL_MODE_GRAY4:\r\n      bpp       = 4;\r\n      new_pitch = ( width + xpixels + 1 ) >> 1;\r\n      break;\r\n    case FT_PIXEL_MODE_GRAY:\r\n    case FT_PIXEL_MODE_LCD:\r\n    case FT_PIXEL_MODE_LCD_V:\r\n      bpp       = 8;\r\n      new_pitch = ( width + xpixels );\r\n      break;\r\n    default:\r\n      return FT_Err_Invalid_Glyph_Format;\r\n    }\r\n\r\n    /* if no need to allocate memory */\r\n    if ( ypixels == 0 && new_pitch <= pitch )\r\n    {\r\n      /* zero the padding */\r\n      FT_Int  bit_width = pitch * 8;\r\n      FT_Int  bit_last  = ( width + xpixels ) * bpp;\r\n\r\n\r\n      if ( bit_last < bit_width )\r\n      {\r\n        FT_Byte*  line  = bitmap->buffer + ( bit_last >> 3 );\r\n        FT_Byte*  end   = bitmap->buffer + pitch;\r\n        FT_Int    shift = bit_last & 7;\r\n        FT_UInt   mask  = 0xFF00U >> shift;\r\n        FT_Int    count = height;\r\n\r\n\r\n        for ( ; count > 0; count--, line += pitch, end += pitch )\r\n        {\r\n          FT_Byte*  write = line;\r\n\r\n\r\n          if ( shift > 0 )\r\n          {\r\n            write[0] = (FT_Byte)( write[0] & mask );\r\n            write++;\r\n          }\r\n          if ( write < end )\r\n            FT_MEM_ZERO( write, end-write );\r\n        }\r\n      }\r\n\r\n      return FT_Err_Ok;\r\n    }\r\n\r\n    if ( FT_QALLOC_MULT( buffer, new_pitch, bitmap->rows + ypixels ) )\r\n      return error;\r\n\r\n    if ( bitmap->pitch > 0 )\r\n    {\r\n      FT_Int  len = ( width * bpp + 7 ) >> 3;\r\n\r\n\r\n      for ( i = 0; i < bitmap->rows; i++ )\r\n        FT_MEM_COPY( buffer + new_pitch * ( ypixels + i ),\r\n                     bitmap->buffer + pitch * i, len );\r\n    }\r\n    else\r\n    {\r\n      FT_Int  len = ( width * bpp + 7 ) >> 3;\r\n\r\n\r\n      for ( i = 0; i < bitmap->rows; i++ )\r\n        FT_MEM_COPY( buffer + new_pitch * i,\r\n                     bitmap->buffer + pitch * i, len );\r\n    }\r\n\r\n    FT_FREE( bitmap->buffer );\r\n    bitmap->buffer = buffer;\r\n\r\n    if ( bitmap->pitch < 0 )\r\n      new_pitch = -new_pitch;\r\n\r\n    /* set pitch only, width and height are left untouched */\r\n    bitmap->pitch = new_pitch;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftbitmap.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Bitmap_Embolden( FT_Library  library,\r\n                      FT_Bitmap*  bitmap,\r\n                      FT_Pos      xStrength,\r\n                      FT_Pos      yStrength )\r\n  {\r\n    FT_Error        error;\r\n    unsigned char*  p;\r\n    FT_Int          i, x, y, pitch;\r\n    FT_Int          xstr, ystr;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !bitmap || !bitmap->buffer )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||\r\n         ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;\r\n    ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;\r\n\r\n    if ( xstr == 0 && ystr == 0 )\r\n      return FT_Err_Ok;\r\n    else if ( xstr < 0 || ystr < 0 )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    switch ( bitmap->pixel_mode )\r\n    {\r\n    case FT_PIXEL_MODE_GRAY2:\r\n    case FT_PIXEL_MODE_GRAY4:\r\n      {\r\n        FT_Bitmap  tmp;\r\n        FT_Int     align;\r\n\r\n\r\n        if ( bitmap->pixel_mode == FT_PIXEL_MODE_GRAY2 )\r\n          align = ( bitmap->width + xstr + 3 ) / 4;\r\n        else\r\n          align = ( bitmap->width + xstr + 1 ) / 2;\r\n\r\n        FT_Bitmap_New( &tmp );\r\n\r\n        error = FT_Bitmap_Convert( library, bitmap, &tmp, align );\r\n        if ( error )\r\n          return error;\r\n\r\n        FT_Bitmap_Done( library, bitmap );\r\n        *bitmap = tmp;\r\n      }\r\n      break;\r\n\r\n    case FT_PIXEL_MODE_MONO:\r\n      if ( xstr > 8 )\r\n        xstr = 8;\r\n      break;\r\n\r\n    case FT_PIXEL_MODE_LCD:\r\n      xstr *= 3;\r\n      break;\r\n\r\n    case FT_PIXEL_MODE_LCD_V:\r\n      ystr *= 3;\r\n      break;\r\n    }\r\n\r\n    error = ft_bitmap_assure_buffer( library->memory, bitmap, xstr, ystr );\r\n    if ( error )\r\n      return error;\r\n\r\n    pitch = bitmap->pitch;\r\n    if ( pitch > 0 )\r\n      p = bitmap->buffer + pitch * ystr;\r\n    else\r\n    {\r\n      pitch = -pitch;\r\n      p = bitmap->buffer + pitch * ( bitmap->rows - 1 );\r\n    }\r\n\r\n    /* for each row */\r\n    for ( y = 0; y < bitmap->rows ; y++ )\r\n    {\r\n      /*\r\n       * Horizontally:\r\n       *\r\n       * From the last pixel on, make each pixel or'ed with the\r\n       * `xstr' pixels before it.\r\n       */\r\n      for ( x = pitch - 1; x >= 0; x-- )\r\n      {\r\n        unsigned char tmp;\r\n\r\n\r\n        tmp = p[x];\r\n        for ( i = 1; i <= xstr; i++ )\r\n        {\r\n          if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO )\r\n          {\r\n            p[x] |= tmp >> i;\r\n\r\n            /* the maximum value of 8 for `xstr' comes from here */\r\n            if ( x > 0 )\r\n              p[x] |= p[x - 1] << ( 8 - i );\r\n\r\n#if 0\r\n            if ( p[x] == 0xff )\r\n              break;\r\n#endif\r\n          }\r\n          else\r\n          {\r\n            if ( x - i >= 0 )\r\n            {\r\n              if ( p[x] + p[x - i] > bitmap->num_grays - 1 )\r\n              {\r\n                p[x] = (unsigned char)(bitmap->num_grays - 1);\r\n                break;\r\n              }\r\n              else\r\n              {\r\n                p[x] = (unsigned char)(p[x] + p[x-i]);\r\n                if ( p[x] == bitmap->num_grays - 1 )\r\n                  break;\r\n              }\r\n            }\r\n            else\r\n              break;\r\n          }\r\n        }\r\n      }\r\n\r\n      /*\r\n       * Vertically:\r\n       *\r\n       * Make the above `ystr' rows or'ed with it.\r\n       */\r\n      for ( x = 1; x <= ystr; x++ )\r\n      {\r\n        unsigned char*  q;\r\n\r\n\r\n        q = p - bitmap->pitch * x;\r\n        for ( i = 0; i < pitch; i++ )\r\n          q[i] |= p[i];\r\n      }\r\n\r\n      p += bitmap->pitch;\r\n    }\r\n\r\n    bitmap->width += xstr;\r\n    bitmap->rows += ystr;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftbitmap.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Bitmap_Convert( FT_Library        library,\r\n                     const FT_Bitmap  *source,\r\n                     FT_Bitmap        *target,\r\n                     FT_Int            alignment )\r\n  {\r\n    FT_Error   error = FT_Err_Ok;\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    memory = library->memory;\r\n\r\n    switch ( source->pixel_mode )\r\n    {\r\n    case FT_PIXEL_MODE_MONO:\r\n    case FT_PIXEL_MODE_GRAY:\r\n    case FT_PIXEL_MODE_GRAY2:\r\n    case FT_PIXEL_MODE_GRAY4:\r\n    case FT_PIXEL_MODE_LCD:\r\n    case FT_PIXEL_MODE_LCD_V:\r\n      {\r\n        FT_Int   pad;\r\n        FT_Long  old_size;\r\n\r\n\r\n        old_size = target->rows * target->pitch;\r\n        if ( old_size < 0 )\r\n          old_size = -old_size;\r\n\r\n        target->pixel_mode = FT_PIXEL_MODE_GRAY;\r\n        target->rows       = source->rows;\r\n        target->width      = source->width;\r\n\r\n        pad = 0;\r\n        if ( alignment > 0 )\r\n        {\r\n          pad = source->width % alignment;\r\n          if ( pad != 0 )\r\n            pad = alignment - pad;\r\n        }\r\n\r\n        target->pitch = source->width + pad;\r\n\r\n        if ( target->pitch > 0                                     &&\r\n             (FT_ULong)target->rows > FT_ULONG_MAX / target->pitch )\r\n          return FT_Err_Invalid_Argument;\r\n\r\n        if ( target->rows * target->pitch > old_size             &&\r\n             FT_QREALLOC( target->buffer,\r\n                          old_size, target->rows * target->pitch ) )\r\n          return error;\r\n      }\r\n      break;\r\n\r\n    default:\r\n      error = FT_Err_Invalid_Argument;\r\n    }\r\n\r\n    switch ( source->pixel_mode )\r\n    {\r\n    case FT_PIXEL_MODE_MONO:\r\n      {\r\n        FT_Byte*  s = source->buffer;\r\n        FT_Byte*  t = target->buffer;\r\n        FT_Int    i;\r\n\r\n\r\n        target->num_grays = 2;\r\n\r\n        for ( i = source->rows; i > 0; i-- )\r\n        {\r\n          FT_Byte*  ss = s;\r\n          FT_Byte*  tt = t;\r\n          FT_Int    j;\r\n\r\n\r\n          /* get the full bytes */\r\n          for ( j = source->width >> 3; j > 0; j-- )\r\n          {\r\n            FT_Int  val = ss[0]; /* avoid a byte->int cast on each line */\r\n\r\n\r\n            tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );\r\n            tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );\r\n            tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );\r\n            tt[3] = (FT_Byte)( ( val & 0x10 ) >> 4 );\r\n            tt[4] = (FT_Byte)( ( val & 0x08 ) >> 3 );\r\n            tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 );\r\n            tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 );\r\n            tt[7] = (FT_Byte)(   val & 0x01 );\r\n\r\n            tt += 8;\r\n            ss += 1;\r\n          }\r\n\r\n          /* get remaining pixels (if any) */\r\n          j = source->width & 7;\r\n          if ( j > 0 )\r\n          {\r\n            FT_Int  val = *ss;\r\n\r\n\r\n            for ( ; j > 0; j-- )\r\n            {\r\n              tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7);\r\n              val <<= 1;\r\n              tt   += 1;\r\n            }\r\n          }\r\n\r\n          s += source->pitch;\r\n          t += target->pitch;\r\n        }\r\n      }\r\n      break;\r\n\r\n\r\n    case FT_PIXEL_MODE_GRAY:\r\n    case FT_PIXEL_MODE_LCD:\r\n    case FT_PIXEL_MODE_LCD_V:\r\n      {\r\n        FT_Int    width   = source->width;\r\n        FT_Byte*  s       = source->buffer;\r\n        FT_Byte*  t       = target->buffer;\r\n        FT_Int    s_pitch = source->pitch;\r\n        FT_Int    t_pitch = target->pitch;\r\n        FT_Int    i;\r\n\r\n\r\n        target->num_grays = 256;\r\n\r\n        for ( i = source->rows; i > 0; i-- )\r\n        {\r\n          FT_ARRAY_COPY( t, s, width );\r\n\r\n          s += s_pitch;\r\n          t += t_pitch;\r\n        }\r\n      }\r\n      break;\r\n\r\n\r\n    case FT_PIXEL_MODE_GRAY2:\r\n      {\r\n        FT_Byte*  s = source->buffer;\r\n        FT_Byte*  t = target->buffer;\r\n        FT_Int    i;\r\n\r\n\r\n        target->num_grays = 4;\r\n\r\n        for ( i = source->rows; i > 0; i-- )\r\n        {\r\n          FT_Byte*  ss = s;\r\n          FT_Byte*  tt = t;\r\n          FT_Int    j;\r\n\r\n\r\n          /* get the full bytes */\r\n          for ( j = source->width >> 2; j > 0; j-- )\r\n          {\r\n            FT_Int  val = ss[0];\r\n\r\n\r\n            tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 );\r\n            tt[1] = (FT_Byte)( ( val & 0x30 ) >> 4 );\r\n            tt[2] = (FT_Byte)( ( val & 0x0C ) >> 2 );\r\n            tt[3] = (FT_Byte)( ( val & 0x03 ) );\r\n\r\n            ss += 1;\r\n            tt += 4;\r\n          }\r\n\r\n          j = source->width & 3;\r\n          if ( j > 0 )\r\n          {\r\n            FT_Int  val = ss[0];\r\n\r\n\r\n            for ( ; j > 0; j-- )\r\n            {\r\n              tt[0]  = (FT_Byte)( ( val & 0xC0 ) >> 6 );\r\n              val  <<= 2;\r\n              tt    += 1;\r\n            }\r\n          }\r\n\r\n          s += source->pitch;\r\n          t += target->pitch;\r\n        }\r\n      }\r\n      break;\r\n\r\n\r\n    case FT_PIXEL_MODE_GRAY4:\r\n      {\r\n        FT_Byte*  s = source->buffer;\r\n        FT_Byte*  t = target->buffer;\r\n        FT_Int    i;\r\n\r\n\r\n        target->num_grays = 16;\r\n\r\n        for ( i = source->rows; i > 0; i-- )\r\n        {\r\n          FT_Byte*  ss = s;\r\n          FT_Byte*  tt = t;\r\n          FT_Int    j;\r\n\r\n\r\n          /* get the full bytes */\r\n          for ( j = source->width >> 1; j > 0; j-- )\r\n          {\r\n            FT_Int  val = ss[0];\r\n\r\n\r\n            tt[0] = (FT_Byte)( ( val & 0xF0 ) >> 4 );\r\n            tt[1] = (FT_Byte)( ( val & 0x0F ) );\r\n\r\n            ss += 1;\r\n            tt += 2;\r\n          }\r\n\r\n          if ( source->width & 1 )\r\n            tt[0] = (FT_Byte)( ( ss[0] & 0xF0 ) >> 4 );\r\n\r\n          s += source->pitch;\r\n          t += target->pitch;\r\n        }\r\n      }\r\n      break;\r\n\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftbitmap.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot )\r\n  {\r\n    if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP   &&\r\n         !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )\r\n    {\r\n      FT_Bitmap  bitmap;\r\n      FT_Error   error;\r\n\r\n\r\n      FT_Bitmap_New( &bitmap );\r\n      error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );\r\n      if ( error )\r\n        return error;\r\n\r\n      slot->bitmap = bitmap;\r\n      slot->internal->flags |= FT_GLYPH_OWN_BITMAP;\r\n    }\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftbitmap.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Bitmap_Done( FT_Library  library,\r\n                  FT_Bitmap  *bitmap )\r\n  {\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !bitmap )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    memory = library->memory;\r\n\r\n    FT_FREE( bitmap->buffer );\r\n    *bitmap = null_bitmap;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftcalc.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcalc.c                                                               */\r\n/*                                                                         */\r\n/*    Arithmetic computations (body).                                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2008, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Support for 1-complement arithmetic has been totally dropped in this  */\r\n  /* release.  You can still write your own code if you need it.           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Implementing basic computation routines.                              */\r\n  /*                                                                       */\r\n  /* FT_MulDiv(), FT_MulFix(), FT_DivFix(), FT_RoundFix(), FT_CeilFix(),   */\r\n  /* and FT_FloorFix() are declared in freetype.h.                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_GLYPH_H\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#ifdef FT_MULFIX_INLINED\r\n#undef FT_MulFix\r\n#endif\r\n\r\n/* we need to define a 64-bits data type here */\r\n\r\n#ifdef FT_LONG64\r\n\r\n  typedef FT_INT64  FT_Int64;\r\n\r\n#else\r\n\r\n  typedef struct  FT_Int64_\r\n  {\r\n    FT_UInt32  lo;\r\n    FT_UInt32  hi;\r\n\r\n  } FT_Int64;\r\n\r\n#endif /* FT_LONG64 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_calc\r\n\r\n\r\n  /* The following three functions are available regardless of whether */\r\n  /* FT_LONG64 is defined.                                             */\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_RoundFix( FT_Fixed  a )\r\n  {\r\n    return ( a >= 0 ) ?   ( a + 0x8000L ) & ~0xFFFFL\r\n                      : -((-a + 0x8000L ) & ~0xFFFFL );\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_CeilFix( FT_Fixed  a )\r\n  {\r\n    return ( a >= 0 ) ?   ( a + 0xFFFFL ) & ~0xFFFFL\r\n                      : -((-a + 0xFFFFL ) & ~0xFFFFL );\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_FloorFix( FT_Fixed  a )\r\n  {\r\n    return ( a >= 0 ) ?   a & ~0xFFFFL\r\n                      : -((-a) & ~0xFFFFL );\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_EXPORT_DEF( FT_Int32 )\r\n  FT_Sqrt32( FT_Int32  x )\r\n  {\r\n    FT_UInt32  val, root, newroot, mask;\r\n\r\n\r\n    root = 0;\r\n    mask = (FT_UInt32)0x40000000UL;\r\n    val  = (FT_UInt32)x;\r\n\r\n    do\r\n    {\r\n      newroot = root + mask;\r\n      if ( newroot <= val )\r\n      {\r\n        val -= newroot;\r\n        root = newroot + mask;\r\n      }\r\n\r\n      root >>= 1;\r\n      mask >>= 2;\r\n\r\n    } while ( mask != 0 );\r\n\r\n    return root;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n#ifdef FT_LONG64\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_MulDiv( FT_Long  a,\r\n             FT_Long  b,\r\n             FT_Long  c )\r\n  {\r\n    FT_Int   s;\r\n    FT_Long  d;\r\n\r\n\r\n    s = 1;\r\n    if ( a < 0 ) { a = -a; s = -1; }\r\n    if ( b < 0 ) { b = -b; s = -s; }\r\n    if ( c < 0 ) { c = -c; s = -s; }\r\n\r\n    d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c\r\n                         : 0x7FFFFFFFL );\r\n\r\n    return ( s > 0 ) ? d : -d;\r\n  }\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_BASE_DEF( FT_Long )\r\n  FT_MulDiv_No_Round( FT_Long  a,\r\n                      FT_Long  b,\r\n                      FT_Long  c )\r\n  {\r\n    FT_Int   s;\r\n    FT_Long  d;\r\n\r\n\r\n    s = 1;\r\n    if ( a < 0 ) { a = -a; s = -1; }\r\n    if ( b < 0 ) { b = -b; s = -s; }\r\n    if ( c < 0 ) { c = -c; s = -s; }\r\n\r\n    d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c\r\n                         : 0x7FFFFFFFL );\r\n\r\n    return ( s > 0 ) ? d : -d;\r\n  }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_MulFix( FT_Long  a,\r\n             FT_Long  b )\r\n  {\r\n#ifdef FT_MULFIX_ASSEMBLER\r\n\r\n    return FT_MULFIX_ASSEMBLER( a, b );\r\n\r\n#else\r\n\r\n    FT_Int   s = 1;\r\n    FT_Long  c;\r\n\r\n\r\n    if ( a < 0 )\r\n    {\r\n      a = -a;\r\n      s = -1;\r\n    }\r\n\r\n    if ( b < 0 )\r\n    {\r\n      b = -b;\r\n      s = -s;\r\n    }\r\n\r\n    c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );\r\n\r\n    return ( s > 0 ) ? c : -c;\r\n\r\n#endif /* FT_MULFIX_ASSEMBLER */\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_DivFix( FT_Long  a,\r\n             FT_Long  b )\r\n  {\r\n    FT_Int32   s;\r\n    FT_UInt32  q;\r\n\r\n    s = 1;\r\n    if ( a < 0 ) { a = -a; s = -1; }\r\n    if ( b < 0 ) { b = -b; s = -s; }\r\n\r\n    if ( b == 0 )\r\n      /* check for division by 0 */\r\n      q = 0x7FFFFFFFL;\r\n    else\r\n      /* compute result directly */\r\n      q = (FT_UInt32)( ( ( (FT_Int64)a << 16 ) + ( b >> 1 ) ) / b );\r\n\r\n    return ( s < 0 ? -(FT_Long)q : (FT_Long)q );\r\n  }\r\n\r\n\r\n#else /* !FT_LONG64 */\r\n\r\n\r\n  static void\r\n  ft_multo64( FT_UInt32  x,\r\n              FT_UInt32  y,\r\n              FT_Int64  *z )\r\n  {\r\n    FT_UInt32  lo1, hi1, lo2, hi2, lo, hi, i1, i2;\r\n\r\n\r\n    lo1 = x & 0x0000FFFFU;  hi1 = x >> 16;\r\n    lo2 = y & 0x0000FFFFU;  hi2 = y >> 16;\r\n\r\n    lo = lo1 * lo2;\r\n    i1 = lo1 * hi2;\r\n    i2 = lo2 * hi1;\r\n    hi = hi1 * hi2;\r\n\r\n    /* Check carry overflow of i1 + i2 */\r\n    i1 += i2;\r\n    hi += (FT_UInt32)( i1 < i2 ) << 16;\r\n\r\n    hi += i1 >> 16;\r\n    i1  = i1 << 16;\r\n\r\n    /* Check carry overflow of i1 + lo */\r\n    lo += i1;\r\n    hi += ( lo < i1 );\r\n\r\n    z->lo = lo;\r\n    z->hi = hi;\r\n  }\r\n\r\n\r\n  static FT_UInt32\r\n  ft_div64by32( FT_UInt32  hi,\r\n                FT_UInt32  lo,\r\n                FT_UInt32  y )\r\n  {\r\n    FT_UInt32  r, q;\r\n    FT_Int     i;\r\n\r\n\r\n    q = 0;\r\n    r = hi;\r\n\r\n    if ( r >= y )\r\n      return (FT_UInt32)0x7FFFFFFFL;\r\n\r\n    i = 32;\r\n    do\r\n    {\r\n      r <<= 1;\r\n      q <<= 1;\r\n      r  |= lo >> 31;\r\n\r\n      if ( r >= y )\r\n      {\r\n        r -= y;\r\n        q |= 1;\r\n      }\r\n      lo <<= 1;\r\n    } while ( --i );\r\n\r\n    return q;\r\n  }\r\n\r\n\r\n  static void\r\n  FT_Add64( FT_Int64*  x,\r\n            FT_Int64*  y,\r\n            FT_Int64  *z )\r\n  {\r\n    register FT_UInt32  lo, hi;\r\n\r\n\r\n    lo = x->lo + y->lo;\r\n    hi = x->hi + y->hi + ( lo < x->lo );\r\n\r\n    z->lo = lo;\r\n    z->hi = hi;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  /* The FT_MulDiv function has been optimized thanks to ideas from      */\r\n  /* Graham Asher.  The trick is to optimize computation when everything */\r\n  /* fits within 32-bits (a rather common case).                         */\r\n  /*                                                                     */\r\n  /*  we compute 'a*b+c/2', then divide it by 'c'. (positive values)     */\r\n  /*                                                                     */\r\n  /*  46340 is FLOOR(SQRT(2^31-1)).                                      */\r\n  /*                                                                     */\r\n  /*  if ( a <= 46340 && b <= 46340 ) then ( a*b <= 0x7FFEA810 )         */\r\n  /*                                                                     */\r\n  /*  0x7FFFFFFF - 0x7FFEA810 = 0x157F0                                  */\r\n  /*                                                                     */\r\n  /*  if ( c < 0x157F0*2 ) then ( a*b+c/2 <= 0x7FFFFFFF )                */\r\n  /*                                                                     */\r\n  /*  and 2*0x157F0 = 176096                                             */\r\n  /*                                                                     */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_MulDiv( FT_Long  a,\r\n             FT_Long  b,\r\n             FT_Long  c )\r\n  {\r\n    long  s;\r\n\r\n\r\n    /* XXX: this function does not allow 64-bit arguments */\r\n    if ( a == 0 || b == c )\r\n      return a;\r\n\r\n    s  = a; a = FT_ABS( a );\r\n    s ^= b; b = FT_ABS( b );\r\n    s ^= c; c = FT_ABS( c );\r\n\r\n    if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )\r\n      a = ( a * b + ( c >> 1 ) ) / c;\r\n\r\n    else if ( (FT_Int32)c > 0 )\r\n    {\r\n      FT_Int64  temp, temp2;\r\n\r\n\r\n      ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );\r\n\r\n      temp2.hi = 0;\r\n      temp2.lo = (FT_UInt32)(c >> 1);\r\n      FT_Add64( &temp, &temp2, &temp );\r\n      a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );\r\n    }\r\n    else\r\n      a = 0x7FFFFFFFL;\r\n\r\n    return ( s < 0 ? -a : a );\r\n  }\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  FT_BASE_DEF( FT_Long )\r\n  FT_MulDiv_No_Round( FT_Long  a,\r\n                      FT_Long  b,\r\n                      FT_Long  c )\r\n  {\r\n    long  s;\r\n\r\n\r\n    if ( a == 0 || b == c )\r\n      return a;\r\n\r\n    s  = a; a = FT_ABS( a );\r\n    s ^= b; b = FT_ABS( b );\r\n    s ^= c; c = FT_ABS( c );\r\n\r\n    if ( a <= 46340L && b <= 46340L && c > 0 )\r\n      a = a * b / c;\r\n\r\n    else if ( (FT_Int32)c > 0 )\r\n    {\r\n      FT_Int64  temp;\r\n\r\n\r\n      ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );\r\n      a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );\r\n    }\r\n    else\r\n      a = 0x7FFFFFFFL;\r\n\r\n    return ( s < 0 ? -a : a );\r\n  }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_MulFix( FT_Long  a,\r\n             FT_Long  b )\r\n  {\r\n#ifdef FT_MULFIX_ASSEMBLER\r\n\r\n    return FT_MULFIX_ASSEMBLER( a, b );\r\n\r\n#elif 0\r\n\r\n    /*\r\n     *  This code is nonportable.  See comment below.\r\n     *\r\n     *  However, on a platform where right-shift of a signed quantity fills\r\n     *  the leftmost bits by copying the sign bit, it might be faster.\r\n     */\r\n\r\n    FT_Long   sa, sb;\r\n    FT_ULong  ua, ub;\r\n\r\n\r\n    if ( a == 0 || b == 0x10000L )\r\n      return a;\r\n\r\n    /*\r\n     *  This is a clever way of converting a signed number `a' into its\r\n     *  absolute value (stored back into `a') and its sign.  The sign is\r\n     *  stored in `sa'; 0 means `a' was positive or zero, and -1 means `a'\r\n     *  was negative.  (Similarly for `b' and `sb').\r\n     *\r\n     *  Unfortunately, it doesn't work (at least not portably).\r\n     *\r\n     *  It makes the assumption that right-shift on a negative signed value\r\n     *  fills the leftmost bits by copying the sign bit.  This is wrong.\r\n     *  According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,\r\n     *  the result of right-shift of a negative signed value is\r\n     *  implementation-defined.  At least one implementation fills the\r\n     *  leftmost bits with 0s (i.e., it is exactly the same as an unsigned\r\n     *  right shift).  This means that when `a' is negative, `sa' ends up\r\n     *  with the value 1 rather than -1.  After that, everything else goes\r\n     *  wrong.\r\n     */\r\n    sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );\r\n    a  = ( a ^ sa ) - sa;\r\n    sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );\r\n    b  = ( b ^ sb ) - sb;\r\n\r\n    ua = (FT_ULong)a;\r\n    ub = (FT_ULong)b;\r\n\r\n    if ( ua <= 2048 && ub <= 1048576L )\r\n      ua = ( ua * ub + 0x8000U ) >> 16;\r\n    else\r\n    {\r\n      FT_ULong  al = ua & 0xFFFFU;\r\n\r\n\r\n      ua = ( ua >> 16 ) * ub +  al * ( ub >> 16 ) +\r\n           ( ( al * ( ub & 0xFFFFU ) + 0x8000U ) >> 16 );\r\n    }\r\n\r\n    sa ^= sb,\r\n    ua  = (FT_ULong)(( ua ^ sa ) - sa);\r\n\r\n    return (FT_Long)ua;\r\n\r\n#else /* 0 */\r\n\r\n    FT_Long   s;\r\n    FT_ULong  ua, ub;\r\n\r\n\r\n    if ( a == 0 || b == 0x10000L )\r\n      return a;\r\n\r\n    s  = a; a = FT_ABS( a );\r\n    s ^= b; b = FT_ABS( b );\r\n\r\n    ua = (FT_ULong)a;\r\n    ub = (FT_ULong)b;\r\n\r\n    if ( ua <= 2048 && ub <= 1048576L )\r\n      ua = ( ua * ub + 0x8000UL ) >> 16;\r\n    else\r\n    {\r\n      FT_ULong  al = ua & 0xFFFFUL;\r\n\r\n\r\n      ua = ( ua >> 16 ) * ub +  al * ( ub >> 16 ) +\r\n           ( ( al * ( ub & 0xFFFFUL ) + 0x8000UL ) >> 16 );\r\n    }\r\n\r\n    return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua );\r\n\r\n#endif /* 0 */\r\n\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_DivFix( FT_Long  a,\r\n             FT_Long  b )\r\n  {\r\n    FT_Int32   s;\r\n    FT_UInt32  q;\r\n\r\n\r\n    /* XXX: this function does not allow 64-bit arguments */\r\n    s  = (FT_Int32)a; a = FT_ABS( a );\r\n    s ^= (FT_Int32)b; b = FT_ABS( b );\r\n\r\n    if ( (FT_UInt32)b == 0 )\r\n    {\r\n      /* check for division by 0 */\r\n      q = (FT_UInt32)0x7FFFFFFFL;\r\n    }\r\n    else if ( ( a >> 16 ) == 0 )\r\n    {\r\n      /* compute result directly */\r\n      q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b;\r\n    }\r\n    else\r\n    {\r\n      /* we need more bits; we have to do it by hand */\r\n      FT_Int64  temp, temp2;\r\n\r\n\r\n      temp.hi  = (FT_Int32) ( a >> 16 );\r\n      temp.lo  = (FT_UInt32)( a << 16 );\r\n      temp2.hi = 0;\r\n      temp2.lo = (FT_UInt32)( b >> 1 );\r\n      FT_Add64( &temp, &temp2, &temp );\r\n      q = ft_div64by32( temp.hi, temp.lo, (FT_Int32)b );\r\n    }\r\n\r\n    return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_MulTo64( FT_Int32   x,\r\n              FT_Int32   y,\r\n              FT_Int64  *z )\r\n  {\r\n    FT_Int32  s;\r\n\r\n\r\n    s  = x; x = FT_ABS( x );\r\n    s ^= y; y = FT_ABS( y );\r\n\r\n    ft_multo64( x, y, z );\r\n\r\n    if ( s < 0 )\r\n    {\r\n      z->lo = (FT_UInt32)-(FT_Int32)z->lo;\r\n      z->hi = ~z->hi + !( z->lo );\r\n    }\r\n  }\r\n\r\n\r\n  /* apparently, the second version of this code is not compiled correctly */\r\n  /* on Mac machines with the MPW C compiler..  tsk, tsk, tsk...           */\r\n\r\n#if 1\r\n\r\n  FT_EXPORT_DEF( FT_Int32 )\r\n  FT_Div64by32( FT_Int64*  x,\r\n                FT_Int32   y )\r\n  {\r\n    FT_Int32   s;\r\n    FT_UInt32  q, r, i, lo;\r\n\r\n\r\n    s  = x->hi;\r\n    if ( s < 0 )\r\n    {\r\n      x->lo = (FT_UInt32)-(FT_Int32)x->lo;\r\n      x->hi = ~x->hi + !x->lo;\r\n    }\r\n    s ^= y;  y = FT_ABS( y );\r\n\r\n    /* Shortcut */\r\n    if ( x->hi == 0 )\r\n    {\r\n      if ( y > 0 )\r\n        q = x->lo / y;\r\n      else\r\n        q = 0x7FFFFFFFL;\r\n\r\n      return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );\r\n    }\r\n\r\n    r  = x->hi;\r\n    lo = x->lo;\r\n\r\n    if ( r >= (FT_UInt32)y ) /* we know y is to be treated as unsigned here */\r\n      return ( s < 0 ? 0x80000001UL : 0x7FFFFFFFUL );\r\n                             /* Return Max/Min Int32 if division overflow. */\r\n                             /* This includes division by zero!            */\r\n    q = 0;\r\n    for ( i = 0; i < 32; i++ )\r\n    {\r\n      r <<= 1;\r\n      q <<= 1;\r\n      r  |= lo >> 31;\r\n\r\n      if ( r >= (FT_UInt32)y )\r\n      {\r\n        r -= y;\r\n        q |= 1;\r\n      }\r\n      lo <<= 1;\r\n    }\r\n\r\n    return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );\r\n  }\r\n\r\n#else /* 0 */\r\n\r\n  FT_EXPORT_DEF( FT_Int32 )\r\n  FT_Div64by32( FT_Int64*  x,\r\n                FT_Int32   y )\r\n  {\r\n    FT_Int32   s;\r\n    FT_UInt32  q;\r\n\r\n\r\n    s  = x->hi;\r\n    if ( s < 0 )\r\n    {\r\n      x->lo = (FT_UInt32)-(FT_Int32)x->lo;\r\n      x->hi = ~x->hi + !x->lo;\r\n    }\r\n    s ^= y;  y = FT_ABS( y );\r\n\r\n    /* Shortcut */\r\n    if ( x->hi == 0 )\r\n    {\r\n      if ( y > 0 )\r\n        q = ( x->lo + ( y >> 1 ) ) / y;\r\n      else\r\n        q = 0x7FFFFFFFL;\r\n\r\n      return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );\r\n    }\r\n\r\n    q = ft_div64by32( x->hi, x->lo, y );\r\n\r\n    return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n#endif /* 0 */\r\n\r\n\r\n#endif /* FT_LONG64 */\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Matrix_Multiply( const FT_Matrix*  a,\r\n                      FT_Matrix        *b )\r\n  {\r\n    FT_Fixed  xx, xy, yx, yy;\r\n\r\n\r\n    if ( !a || !b )\r\n      return;\r\n\r\n    xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );\r\n    xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );\r\n    yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );\r\n    yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );\r\n\r\n    b->xx = xx;  b->xy = xy;\r\n    b->yx = yx;  b->yy = yy;\r\n  }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Matrix_Invert( FT_Matrix*  matrix )\r\n  {\r\n    FT_Pos  delta, xx, yy;\r\n\r\n\r\n    if ( !matrix )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* compute discriminant */\r\n    delta = FT_MulFix( matrix->xx, matrix->yy ) -\r\n            FT_MulFix( matrix->xy, matrix->yx );\r\n\r\n    if ( !delta )\r\n      return FT_Err_Invalid_Argument;  /* matrix can't be inverted */\r\n\r\n    matrix->xy = - FT_DivFix( matrix->xy, delta );\r\n    matrix->yx = - FT_DivFix( matrix->yx, delta );\r\n\r\n    xx = matrix->xx;\r\n    yy = matrix->yy;\r\n\r\n    matrix->xx = FT_DivFix( yy, delta );\r\n    matrix->yy = FT_DivFix( xx, delta );\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Matrix_Multiply_Scaled( const FT_Matrix*  a,\r\n                             FT_Matrix        *b,\r\n                             FT_Long           scaling )\r\n  {\r\n    FT_Fixed  xx, xy, yx, yy;\r\n\r\n    FT_Long   val = 0x10000L * scaling;\r\n\r\n\r\n    if ( !a || !b )\r\n      return;\r\n\r\n    xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val );\r\n    xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val );\r\n    yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val );\r\n    yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val );\r\n\r\n    b->xx = xx;  b->xy = xy;\r\n    b->yx = yx;  b->yy = yy;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Vector_Transform_Scaled( FT_Vector*        vector,\r\n                              const FT_Matrix*  matrix,\r\n                              FT_Long           scaling )\r\n  {\r\n    FT_Pos   xz, yz;\r\n\r\n    FT_Long  val = 0x10000L * scaling;\r\n\r\n\r\n    if ( !vector || !matrix )\r\n      return;\r\n\r\n    xz = FT_MulDiv( vector->x, matrix->xx, val ) +\r\n         FT_MulDiv( vector->y, matrix->xy, val );\r\n\r\n    yz = FT_MulDiv( vector->x, matrix->yx, val ) +\r\n         FT_MulDiv( vector->y, matrix->yy, val );\r\n\r\n    vector->x = xz;\r\n    vector->y = yz;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_BASE_DEF( FT_Int32 )\r\n  FT_SqrtFixed( FT_Int32  x )\r\n  {\r\n    FT_UInt32  root, rem_hi, rem_lo, test_div;\r\n    FT_Int     count;\r\n\r\n\r\n    root = 0;\r\n\r\n    if ( x > 0 )\r\n    {\r\n      rem_hi = 0;\r\n      rem_lo = x;\r\n      count  = 24;\r\n      do\r\n      {\r\n        rem_hi   = ( rem_hi << 2 ) | ( rem_lo >> 30 );\r\n        rem_lo <<= 2;\r\n        root   <<= 1;\r\n        test_div = ( root << 1 ) + 1;\r\n\r\n        if ( rem_hi >= test_div )\r\n        {\r\n          rem_hi -= test_div;\r\n          root   += 1;\r\n        }\r\n      } while ( --count );\r\n    }\r\n\r\n    return (FT_Int32)root;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_BASE_DEF( FT_Int )\r\n  ft_corner_orientation( FT_Pos  in_x,\r\n                         FT_Pos  in_y,\r\n                         FT_Pos  out_x,\r\n                         FT_Pos  out_y )\r\n  {\r\n    FT_Long  result; /* avoid overflow on 16-bit system */\r\n\r\n\r\n    /* deal with the trivial cases quickly */\r\n    if ( in_y == 0 )\r\n    {\r\n      if ( in_x >= 0 )\r\n        result = out_y;\r\n      else\r\n        result = -out_y;\r\n    }\r\n    else if ( in_x == 0 )\r\n    {\r\n      if ( in_y >= 0 )\r\n        result = -out_x;\r\n      else\r\n        result = out_x;\r\n    }\r\n    else if ( out_y == 0 )\r\n    {\r\n      if ( out_x >= 0 )\r\n        result = in_y;\r\n      else\r\n        result = -in_y;\r\n    }\r\n    else if ( out_x == 0 )\r\n    {\r\n      if ( out_y >= 0 )\r\n        result = -in_x;\r\n      else\r\n        result =  in_x;\r\n    }\r\n    else /* general case */\r\n    {\r\n#ifdef FT_LONG64\r\n\r\n      FT_Int64  delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x;\r\n\r\n\r\n      if ( delta == 0 )\r\n        result = 0;\r\n      else\r\n        result = 1 - 2 * ( delta < 0 );\r\n\r\n#else\r\n\r\n      FT_Int64  z1, z2;\r\n\r\n\r\n      /* XXX: this function does not allow 64-bit arguments */\r\n      ft_multo64( (FT_Int32)in_x, (FT_Int32)out_y, &z1 );\r\n      ft_multo64( (FT_Int32)in_y, (FT_Int32)out_x, &z2 );\r\n\r\n      if ( z1.hi > z2.hi )\r\n        result = +1;\r\n      else if ( z1.hi < z2.hi )\r\n        result = -1;\r\n      else if ( z1.lo > z2.lo )\r\n        result = +1;\r\n      else if ( z1.lo < z2.lo )\r\n        result = -1;\r\n      else\r\n        result = 0;\r\n\r\n#endif\r\n    }\r\n\r\n    /* XXX: only the sign of return value, +1/0/-1 must be used */\r\n    return (FT_Int)result;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcalc.h */\r\n\r\n  FT_BASE_DEF( FT_Int )\r\n  ft_corner_is_flat( FT_Pos  in_x,\r\n                     FT_Pos  in_y,\r\n                     FT_Pos  out_x,\r\n                     FT_Pos  out_y )\r\n  {\r\n    FT_Pos  ax = in_x;\r\n    FT_Pos  ay = in_y;\r\n\r\n    FT_Pos  d_in, d_out, d_corner;\r\n\r\n\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_in = ax + ay;\r\n\r\n    ax = out_x;\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    ay = out_y;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_out = ax + ay;\r\n\r\n    ax = out_x + in_x;\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    ay = out_y + in_y;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_corner = ax + ay;\r\n\r\n    return ( d_in + d_out - d_corner ) < ( d_corner >> 4 );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftcid.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcid.c                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing CID font information.                     */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2009 by Derek Clegg, Michael Toftdal.                  */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CID_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_CID_H\r\n\r\n\r\n  /* documentation is in ftcid.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_CID_Registry_Ordering_Supplement( FT_Face       face,\r\n                                           const char*  *registry,\r\n                                           const char*  *ordering,\r\n                                           FT_Int       *supplement)\r\n  {\r\n    FT_Error     error;\r\n    const char*  r = NULL;\r\n    const char*  o = NULL;\r\n    FT_Int       s = 0;\r\n\r\n\r\n    error = FT_Err_Invalid_Argument;\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_CID  service;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, CID );\r\n\r\n      if ( service && service->get_ros )\r\n        error = service->get_ros( face, &r, &o, &s );\r\n    }\r\n\r\n    if ( registry )\r\n      *registry = r;\r\n\r\n    if ( ordering )\r\n      *ordering = o;\r\n\r\n    if ( supplement )\r\n      *supplement = s;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_CID_Is_Internally_CID_Keyed( FT_Face   face,\r\n                                      FT_Bool  *is_cid )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n    FT_Bool   ic = 0;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_CID  service;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, CID );\r\n\r\n      if ( service && service->get_is_cid )\r\n        error = service->get_is_cid( face, &ic);\r\n    }\r\n\r\n    if ( is_cid )\r\n      *is_cid = ic;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_CID_From_Glyph_Index( FT_Face   face,\r\n                               FT_UInt   glyph_index,\r\n                               FT_UInt  *cid )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n    FT_UInt   c = 0;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_CID  service;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, CID );\r\n\r\n      if ( service && service->get_cid_from_glyph_index )\r\n        error = service->get_cid_from_glyph_index( face, glyph_index, &c);\r\n    }\r\n\r\n    if ( cid )\r\n      *cid = c;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftdbgmem.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdbgmem.c                                                             */\r\n/*                                                                         */\r\n/*    Memory debugger (body).                                              */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2009 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_SYSTEM_H\r\n#include FT_ERRORS_H\r\n#include FT_TYPES_H\r\n\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n\r\n#define  KEEPALIVE /* `Keep alive' means that freed blocks aren't released\r\n                    * to the heap.  This is useful to detect double-frees\r\n                    * or weird heap corruption, but it uses large amounts of\r\n                    * memory, however.\r\n                    */\r\n\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n  FT_BASE_DEF( const char* )  _ft_debug_file   = 0;\r\n  FT_BASE_DEF( long )         _ft_debug_lineno = 0;\r\n\r\n  extern void\r\n  FT_DumpMemory( FT_Memory  memory );\r\n\r\n\r\n  typedef struct FT_MemSourceRec_*  FT_MemSource;\r\n  typedef struct FT_MemNodeRec_*    FT_MemNode;\r\n  typedef struct FT_MemTableRec_*   FT_MemTable;\r\n\r\n\r\n#define FT_MEM_VAL( addr )  ((FT_PtrDist)(FT_Pointer)( addr ))\r\n\r\n  /*\r\n   *  This structure holds statistics for a single allocation/release\r\n   *  site.  This is useful to know where memory operations happen the\r\n   *  most.\r\n   */\r\n  typedef struct  FT_MemSourceRec_\r\n  {\r\n    const char*   file_name;\r\n    long          line_no;\r\n\r\n    FT_Long       cur_blocks;   /* current number of allocated blocks */\r\n    FT_Long       max_blocks;   /* max. number of allocated blocks    */\r\n    FT_Long       all_blocks;   /* total number of blocks allocated   */\r\n\r\n    FT_Long       cur_size;     /* current cumulative allocated size */\r\n    FT_Long       max_size;     /* maximum cumulative allocated size */\r\n    FT_Long       all_size;     /* total cumulative allocated size   */\r\n\r\n    FT_Long       cur_max;      /* current maximum allocated size */\r\n\r\n    FT_UInt32     hash;\r\n    FT_MemSource  link;\r\n\r\n  } FT_MemSourceRec;\r\n\r\n\r\n  /*\r\n   *  We don't need a resizable array for the memory sources, because\r\n   *  their number is pretty limited within FreeType.\r\n   */\r\n#define FT_MEM_SOURCE_BUCKETS  128\r\n\r\n  /*\r\n   *  This structure holds information related to a single allocated\r\n   *  memory block.  If KEEPALIVE is defined, blocks that are freed by\r\n   *  FreeType are never released to the system.  Instead, their `size'\r\n   *  field is set to -size.  This is mainly useful to detect double frees,\r\n   *  at the price of large memory footprint during execution.\r\n   */\r\n  typedef struct  FT_MemNodeRec_\r\n  {\r\n    FT_Byte*      address;\r\n    FT_Long       size;     /* < 0 if the block was freed */\r\n\r\n    FT_MemSource  source;\r\n\r\n#ifdef KEEPALIVE\r\n    const char*   free_file_name;\r\n    FT_Long       free_line_no;\r\n#endif\r\n\r\n    FT_MemNode    link;\r\n\r\n  } FT_MemNodeRec;\r\n\r\n\r\n  /*\r\n   *  The global structure, containing compound statistics and all hash\r\n   *  tables.\r\n   */\r\n  typedef struct  FT_MemTableRec_\r\n  {\r\n    FT_ULong         size;\r\n    FT_ULong         nodes;\r\n    FT_MemNode*      buckets;\r\n\r\n    FT_ULong         alloc_total;\r\n    FT_ULong         alloc_current;\r\n    FT_ULong         alloc_max;\r\n    FT_ULong         alloc_count;\r\n\r\n    FT_Bool          bound_total;\r\n    FT_ULong         alloc_total_max;\r\n\r\n    FT_Bool          bound_count;\r\n    FT_ULong         alloc_count_max;\r\n\r\n    FT_MemSource     sources[FT_MEM_SOURCE_BUCKETS];\r\n\r\n    FT_Bool          keep_alive;\r\n\r\n    FT_Memory        memory;\r\n    FT_Pointer       memory_user;\r\n    FT_Alloc_Func    alloc;\r\n    FT_Free_Func     free;\r\n    FT_Realloc_Func  realloc;\r\n\r\n  } FT_MemTableRec;\r\n\r\n\r\n#define FT_MEM_SIZE_MIN  7\r\n#define FT_MEM_SIZE_MAX  13845163\r\n\r\n#define FT_FILENAME( x )  ((x) ? (x) : \"unknown file\")\r\n\r\n\r\n  /*\r\n   *  Prime numbers are ugly to handle.  It would be better to implement\r\n   *  L-Hashing, which is 10% faster and doesn't require divisions.\r\n   */\r\n  static const FT_UInt  ft_mem_primes[] =\r\n  {\r\n    7,\r\n    11,\r\n    19,\r\n    37,\r\n    73,\r\n    109,\r\n    163,\r\n    251,\r\n    367,\r\n    557,\r\n    823,\r\n    1237,\r\n    1861,\r\n    2777,\r\n    4177,\r\n    6247,\r\n    9371,\r\n    14057,\r\n    21089,\r\n    31627,\r\n    47431,\r\n    71143,\r\n    106721,\r\n    160073,\r\n    240101,\r\n    360163,\r\n    540217,\r\n    810343,\r\n    1215497,\r\n    1823231,\r\n    2734867,\r\n    4102283,\r\n    6153409,\r\n    9230113,\r\n    13845163,\r\n  };\r\n\r\n\r\n  static FT_ULong\r\n  ft_mem_closest_prime( FT_ULong  num )\r\n  {\r\n    FT_UInt  i;\r\n\r\n\r\n    for ( i = 0;\r\n          i < sizeof ( ft_mem_primes ) / sizeof ( ft_mem_primes[0] ); i++ )\r\n      if ( ft_mem_primes[i] > num )\r\n        return ft_mem_primes[i];\r\n\r\n    return FT_MEM_SIZE_MAX;\r\n  }\r\n\r\n\r\n  extern void\r\n  ft_mem_debug_panic( const char*  fmt,\r\n                      ... )\r\n  {\r\n    va_list  ap;\r\n\r\n\r\n    printf( \"FreeType.Debug: \" );\r\n\r\n    va_start( ap, fmt );\r\n    vprintf( fmt, ap );\r\n    va_end( ap );\r\n\r\n    printf( \"\\n\" );\r\n    exit( EXIT_FAILURE );\r\n  }\r\n\r\n\r\n  static FT_Pointer\r\n  ft_mem_table_alloc( FT_MemTable  table,\r\n                      FT_Long      size )\r\n  {\r\n    FT_Memory   memory = table->memory;\r\n    FT_Pointer  block;\r\n\r\n\r\n    memory->user = table->memory_user;\r\n    block = table->alloc( memory, size );\r\n    memory->user = table;\r\n\r\n    return block;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_mem_table_free( FT_MemTable  table,\r\n                     FT_Pointer   block )\r\n  {\r\n    FT_Memory  memory = table->memory;\r\n\r\n\r\n    memory->user = table->memory_user;\r\n    table->free( memory, block );\r\n    memory->user = table;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_mem_table_resize( FT_MemTable  table )\r\n  {\r\n    FT_ULong  new_size;\r\n\r\n\r\n    new_size = ft_mem_closest_prime( table->nodes );\r\n    if ( new_size != table->size )\r\n    {\r\n      FT_MemNode*  new_buckets;\r\n      FT_ULong     i;\r\n\r\n\r\n      new_buckets = (FT_MemNode *)\r\n                      ft_mem_table_alloc( table,\r\n                                          new_size * sizeof ( FT_MemNode ) );\r\n      if ( new_buckets == NULL )\r\n        return;\r\n\r\n      FT_ARRAY_ZERO( new_buckets, new_size );\r\n\r\n      for ( i = 0; i < table->size; i++ )\r\n      {\r\n        FT_MemNode  node, next, *pnode;\r\n        FT_PtrDist  hash;\r\n\r\n\r\n        node = table->buckets[i];\r\n        while ( node )\r\n        {\r\n          next  = node->link;\r\n          hash  = FT_MEM_VAL( node->address ) % new_size;\r\n          pnode = new_buckets + hash;\r\n\r\n          node->link = pnode[0];\r\n          pnode[0]   = node;\r\n\r\n          node = next;\r\n        }\r\n      }\r\n\r\n      if ( table->buckets )\r\n        ft_mem_table_free( table, table->buckets );\r\n\r\n      table->buckets = new_buckets;\r\n      table->size    = new_size;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_MemTable\r\n  ft_mem_table_new( FT_Memory  memory )\r\n  {\r\n    FT_MemTable  table;\r\n\r\n\r\n    table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );\r\n    if ( table == NULL )\r\n      goto Exit;\r\n\r\n    FT_ZERO( table );\r\n\r\n    table->size  = FT_MEM_SIZE_MIN;\r\n    table->nodes = 0;\r\n\r\n    table->memory = memory;\r\n\r\n    table->memory_user = memory->user;\r\n\r\n    table->alloc   = memory->alloc;\r\n    table->realloc = memory->realloc;\r\n    table->free    = memory->free;\r\n\r\n    table->buckets = (FT_MemNode *)\r\n                       memory->alloc( memory,\r\n                                      table->size * sizeof ( FT_MemNode ) );\r\n    if ( table->buckets )\r\n      FT_ARRAY_ZERO( table->buckets, table->size );\r\n    else\r\n    {\r\n      memory->free( memory, table );\r\n      table = NULL;\r\n    }\r\n\r\n  Exit:\r\n    return table;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_mem_table_destroy( FT_MemTable  table )\r\n  {\r\n    FT_ULong  i;\r\n\r\n\r\n    FT_DumpMemory( table->memory );\r\n\r\n    if ( table )\r\n    {\r\n      FT_Long   leak_count = 0;\r\n      FT_ULong  leaks      = 0;\r\n\r\n\r\n      /* remove all blocks from the table, revealing leaked ones */\r\n      for ( i = 0; i < table->size; i++ )\r\n      {\r\n        FT_MemNode  *pnode = table->buckets + i, next, node = *pnode;\r\n\r\n\r\n        while ( node )\r\n        {\r\n          next       = node->link;\r\n          node->link = 0;\r\n\r\n          if ( node->size > 0 )\r\n          {\r\n            printf(\r\n              \"leaked memory block at address %p, size %8ld in (%s:%ld)\\n\",\r\n              node->address, node->size,\r\n              FT_FILENAME( node->source->file_name ),\r\n              node->source->line_no );\r\n\r\n            leak_count++;\r\n            leaks += node->size;\r\n\r\n            ft_mem_table_free( table, node->address );\r\n          }\r\n\r\n          node->address = NULL;\r\n          node->size    = 0;\r\n\r\n          ft_mem_table_free( table, node );\r\n          node = next;\r\n        }\r\n        table->buckets[i] = 0;\r\n      }\r\n\r\n      ft_mem_table_free( table, table->buckets );\r\n      table->buckets = NULL;\r\n\r\n      table->size  = 0;\r\n      table->nodes = 0;\r\n\r\n      /* remove all sources */\r\n      for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )\r\n      {\r\n        FT_MemSource  source, next;\r\n\r\n\r\n        for ( source = table->sources[i]; source != NULL; source = next )\r\n        {\r\n          next = source->link;\r\n          ft_mem_table_free( table, source );\r\n        }\r\n\r\n        table->sources[i] = NULL;\r\n      }\r\n\r\n      printf(\r\n        \"FreeType: total memory allocations = %ld\\n\", table->alloc_total );\r\n      printf(\r\n        \"FreeType: maximum memory footprint = %ld\\n\", table->alloc_max );\r\n\r\n      ft_mem_table_free( table, table );\r\n\r\n      if ( leak_count > 0 )\r\n        ft_mem_debug_panic(\r\n          \"FreeType: %ld bytes of memory leaked in %ld blocks\\n\",\r\n          leaks, leak_count );\r\n\r\n      printf( \"FreeType: no memory leaks detected\\n\" );\r\n    }\r\n  }\r\n\r\n\r\n  static FT_MemNode*\r\n  ft_mem_table_get_nodep( FT_MemTable  table,\r\n                          FT_Byte*     address )\r\n  {\r\n    FT_PtrDist   hash;\r\n    FT_MemNode  *pnode, node;\r\n\r\n\r\n    hash  = FT_MEM_VAL( address );\r\n    pnode = table->buckets + ( hash % table->size );\r\n\r\n    for (;;)\r\n    {\r\n      node = pnode[0];\r\n      if ( !node )\r\n        break;\r\n\r\n      if ( node->address == address )\r\n        break;\r\n\r\n      pnode = &node->link;\r\n    }\r\n    return pnode;\r\n  }\r\n\r\n\r\n  static FT_MemSource\r\n  ft_mem_table_get_source( FT_MemTable  table )\r\n  {\r\n    FT_UInt32     hash;\r\n    FT_MemSource  node, *pnode;\r\n\r\n\r\n    /* cast to FT_PtrDist first since void* can be larger */\r\n    /* than FT_UInt32 and GCC 4.1.1 emits a warning       */\r\n    hash  = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file +\r\n              (FT_UInt32)( 5 * _ft_debug_lineno );\r\n    pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];\r\n\r\n    for ( ;; )\r\n    {\r\n      node = *pnode;\r\n      if ( node == NULL )\r\n        break;\r\n\r\n      if ( node->file_name == _ft_debug_file &&\r\n           node->line_no   == _ft_debug_lineno   )\r\n        goto Exit;\r\n\r\n      pnode = &node->link;\r\n    }\r\n\r\n    node = (FT_MemSource)ft_mem_table_alloc( table, sizeof ( *node ) );\r\n    if ( node == NULL )\r\n      ft_mem_debug_panic(\r\n        \"not enough memory to perform memory debugging\\n\" );\r\n\r\n    node->file_name = _ft_debug_file;\r\n    node->line_no   = _ft_debug_lineno;\r\n\r\n    node->cur_blocks = 0;\r\n    node->max_blocks = 0;\r\n    node->all_blocks = 0;\r\n\r\n    node->cur_size   = 0;\r\n    node->max_size   = 0;\r\n    node->all_size   = 0;\r\n\r\n    node->cur_max    = 0;\r\n\r\n    node->link = NULL;\r\n    node->hash = hash;\r\n    *pnode     = node;\r\n\r\n  Exit:\r\n    return node;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_mem_table_set( FT_MemTable  table,\r\n                    FT_Byte*     address,\r\n                    FT_ULong     size,\r\n                    FT_Long      delta )\r\n  {\r\n    FT_MemNode  *pnode, node;\r\n\r\n\r\n    if ( table )\r\n    {\r\n      FT_MemSource  source;\r\n\r\n\r\n      pnode = ft_mem_table_get_nodep( table, address );\r\n      node  = *pnode;\r\n      if ( node )\r\n      {\r\n        if ( node->size < 0 )\r\n        {\r\n          /* This block was already freed.  Our memory is now completely */\r\n          /* corrupted!                                                  */\r\n          /* This can only happen in keep-alive mode.                    */\r\n          ft_mem_debug_panic(\r\n            \"memory heap corrupted (allocating freed block)\" );\r\n        }\r\n        else\r\n        {\r\n          /* This block was already allocated.  This means that our memory */\r\n          /* is also corrupted!                                            */\r\n          ft_mem_debug_panic(\r\n            \"memory heap corrupted (re-allocating allocated block at\"\r\n            \" %p, of size %ld)\\n\"\r\n            \"org=%s:%d new=%s:%d\\n\",\r\n            node->address, node->size,\r\n            FT_FILENAME( node->source->file_name ), node->source->line_no,\r\n            FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );\r\n        }\r\n      }\r\n\r\n      /* we need to create a new node in this table */\r\n      node = (FT_MemNode)ft_mem_table_alloc( table, sizeof ( *node ) );\r\n      if ( node == NULL )\r\n        ft_mem_debug_panic( \"not enough memory to run memory tests\" );\r\n\r\n      node->address = address;\r\n      node->size    = size;\r\n      node->source  = source = ft_mem_table_get_source( table );\r\n\r\n      if ( delta == 0 )\r\n      {\r\n        /* this is an allocation */\r\n        source->all_blocks++;\r\n        source->cur_blocks++;\r\n        if ( source->cur_blocks > source->max_blocks )\r\n          source->max_blocks = source->cur_blocks;\r\n      }\r\n\r\n      if ( size > (FT_ULong)source->cur_max )\r\n        source->cur_max = size;\r\n\r\n      if ( delta != 0 )\r\n      {\r\n        /* we are growing or shrinking a reallocated block */\r\n        source->cur_size     += delta;\r\n        table->alloc_current += delta;\r\n      }\r\n      else\r\n      {\r\n        /* we are allocating a new block */\r\n        source->cur_size     += size;\r\n        table->alloc_current += size;\r\n      }\r\n\r\n      source->all_size += size;\r\n\r\n      if ( source->cur_size > source->max_size )\r\n        source->max_size = source->cur_size;\r\n\r\n      node->free_file_name = NULL;\r\n      node->free_line_no   = 0;\r\n\r\n      node->link = pnode[0];\r\n\r\n      pnode[0] = node;\r\n      table->nodes++;\r\n\r\n      table->alloc_total += size;\r\n\r\n      if ( table->alloc_current > table->alloc_max )\r\n        table->alloc_max = table->alloc_current;\r\n\r\n      if ( table->nodes * 3 < table->size  ||\r\n           table->size  * 3 < table->nodes )\r\n        ft_mem_table_resize( table );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  ft_mem_table_remove( FT_MemTable  table,\r\n                       FT_Byte*     address,\r\n                       FT_Long      delta )\r\n  {\r\n    if ( table )\r\n    {\r\n      FT_MemNode  *pnode, node;\r\n\r\n\r\n      pnode = ft_mem_table_get_nodep( table, address );\r\n      node  = *pnode;\r\n      if ( node )\r\n      {\r\n        FT_MemSource  source;\r\n\r\n\r\n        if ( node->size < 0 )\r\n          ft_mem_debug_panic(\r\n            \"freeing memory block at %p more than once at (%s:%ld)\\n\"\r\n            \"block allocated at (%s:%ld) and released at (%s:%ld)\",\r\n            address,\r\n            FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,\r\n            FT_FILENAME( node->source->file_name ), node->source->line_no,\r\n            FT_FILENAME( node->free_file_name ), node->free_line_no );\r\n\r\n        /* scramble the node's content for additional safety */\r\n        FT_MEM_SET( address, 0xF3, node->size );\r\n\r\n        if ( delta == 0 )\r\n        {\r\n          source = node->source;\r\n\r\n          source->cur_blocks--;\r\n          source->cur_size -= node->size;\r\n\r\n          table->alloc_current -= node->size;\r\n        }\r\n\r\n        if ( table->keep_alive )\r\n        {\r\n          /* we simply invert the node's size to indicate that the node */\r\n          /* was freed.                                                 */\r\n          node->size           = -node->size;\r\n          node->free_file_name = _ft_debug_file;\r\n          node->free_line_no   = _ft_debug_lineno;\r\n        }\r\n        else\r\n        {\r\n          table->nodes--;\r\n\r\n          *pnode = node->link;\r\n\r\n          node->size   = 0;\r\n          node->source = NULL;\r\n\r\n          ft_mem_table_free( table, node );\r\n\r\n          if ( table->nodes * 3 < table->size  ||\r\n               table->size  * 3 < table->nodes )\r\n            ft_mem_table_resize( table );\r\n        }\r\n      }\r\n      else\r\n        ft_mem_debug_panic(\r\n          \"trying to free unknown block at %p in (%s:%ld)\\n\",\r\n          address,\r\n          FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );\r\n    }\r\n  }\r\n\r\n\r\n  extern FT_Pointer\r\n  ft_mem_debug_alloc( FT_Memory  memory,\r\n                      FT_Long    size )\r\n  {\r\n    FT_MemTable  table = (FT_MemTable)memory->user;\r\n    FT_Byte*     block;\r\n\r\n\r\n    if ( size <= 0 )\r\n      ft_mem_debug_panic( \"negative block size allocation (%ld)\", size );\r\n\r\n    /* return NULL if the maximum number of allocations was reached */\r\n    if ( table->bound_count                           &&\r\n         table->alloc_count >= table->alloc_count_max )\r\n      return NULL;\r\n\r\n    /* return NULL if this allocation would overflow the maximum heap size */\r\n    if ( table->bound_total                                             &&\r\n         table->alloc_total_max - table->alloc_current > (FT_ULong)size )\r\n      return NULL;\r\n\r\n    block = (FT_Byte *)ft_mem_table_alloc( table, size );\r\n    if ( block )\r\n    {\r\n      ft_mem_table_set( table, block, (FT_ULong)size, 0 );\r\n\r\n      table->alloc_count++;\r\n    }\r\n\r\n    _ft_debug_file   = \"<unknown>\";\r\n    _ft_debug_lineno = 0;\r\n\r\n    return (FT_Pointer)block;\r\n  }\r\n\r\n\r\n  extern void\r\n  ft_mem_debug_free( FT_Memory   memory,\r\n                     FT_Pointer  block )\r\n  {\r\n    FT_MemTable  table = (FT_MemTable)memory->user;\r\n\r\n\r\n    if ( block == NULL )\r\n      ft_mem_debug_panic( \"trying to free NULL in (%s:%ld)\",\r\n                          FT_FILENAME( _ft_debug_file ),\r\n                          _ft_debug_lineno );\r\n\r\n    ft_mem_table_remove( table, (FT_Byte*)block, 0 );\r\n\r\n    if ( !table->keep_alive )\r\n      ft_mem_table_free( table, block );\r\n\r\n    table->alloc_count--;\r\n\r\n    _ft_debug_file   = \"<unknown>\";\r\n    _ft_debug_lineno = 0;\r\n  }\r\n\r\n\r\n  extern FT_Pointer\r\n  ft_mem_debug_realloc( FT_Memory   memory,\r\n                        FT_Long     cur_size,\r\n                        FT_Long     new_size,\r\n                        FT_Pointer  block )\r\n  {\r\n    FT_MemTable  table = (FT_MemTable)memory->user;\r\n    FT_MemNode   node, *pnode;\r\n    FT_Pointer   new_block;\r\n    FT_Long      delta;\r\n\r\n    const char*  file_name = FT_FILENAME( _ft_debug_file );\r\n    FT_Long      line_no   = _ft_debug_lineno;\r\n\r\n\r\n    /* unlikely, but possible */\r\n    if ( new_size == cur_size )\r\n      return block;\r\n\r\n    /* the following is valid according to ANSI C */\r\n#if 0\r\n    if ( block == NULL || cur_size == 0 )\r\n      ft_mem_debug_panic( \"trying to reallocate NULL in (%s:%ld)\",\r\n                          file_name, line_no );\r\n#endif\r\n\r\n    /* while the following is allowed in ANSI C also, we abort since */\r\n    /* such case should be handled by FreeType.                      */\r\n    if ( new_size <= 0 )\r\n      ft_mem_debug_panic(\r\n        \"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)\",\r\n        block, cur_size, file_name, line_no );\r\n\r\n    /* check `cur_size' value */\r\n    pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );\r\n    node  = *pnode;\r\n    if ( !node )\r\n      ft_mem_debug_panic(\r\n        \"trying to reallocate unknown block at %p in (%s:%ld)\",\r\n        block, file_name, line_no );\r\n\r\n    if ( node->size <= 0 )\r\n      ft_mem_debug_panic(\r\n        \"trying to reallocate freed block at %p in (%s:%ld)\",\r\n        block, file_name, line_no );\r\n\r\n    if ( node->size != cur_size )\r\n      ft_mem_debug_panic( \"invalid ft_realloc request for %p. cur_size is \"\r\n                          \"%ld instead of %ld in (%s:%ld)\",\r\n                          block, cur_size, node->size, file_name, line_no );\r\n\r\n    /* return NULL if the maximum number of allocations was reached */\r\n    if ( table->bound_count                           &&\r\n         table->alloc_count >= table->alloc_count_max )\r\n      return NULL;\r\n\r\n    delta = (FT_Long)( new_size - cur_size );\r\n\r\n    /* return NULL if this allocation would overflow the maximum heap size */\r\n    if ( delta > 0                                                       &&\r\n         table->bound_total                                              &&\r\n         table->alloc_current + (FT_ULong)delta > table->alloc_total_max )\r\n      return NULL;\r\n\r\n    new_block = (FT_Byte *)ft_mem_table_alloc( table, new_size );\r\n    if ( new_block == NULL )\r\n      return NULL;\r\n\r\n    ft_mem_table_set( table, (FT_Byte*)new_block, new_size, delta );\r\n\r\n    ft_memcpy( new_block, block, cur_size < new_size ? cur_size : new_size );\r\n\r\n    ft_mem_table_remove( table, (FT_Byte*)block, delta );\r\n\r\n    _ft_debug_file   = \"<unknown>\";\r\n    _ft_debug_lineno = 0;\r\n\r\n    if ( !table->keep_alive )\r\n      ft_mem_table_free( table, block );\r\n\r\n    return new_block;\r\n  }\r\n\r\n\r\n  extern FT_Int\r\n  ft_mem_debug_init( FT_Memory  memory )\r\n  {\r\n    FT_MemTable  table;\r\n    FT_Int       result = 0;\r\n\r\n\r\n    if ( getenv( \"FT2_DEBUG_MEMORY\" ) )\r\n    {\r\n      table = ft_mem_table_new( memory );\r\n      if ( table )\r\n      {\r\n        const char*  p;\r\n\r\n\r\n        memory->user    = table;\r\n        memory->alloc   = ft_mem_debug_alloc;\r\n        memory->realloc = ft_mem_debug_realloc;\r\n        memory->free    = ft_mem_debug_free;\r\n\r\n        p = getenv( \"FT2_ALLOC_TOTAL_MAX\" );\r\n        if ( p != NULL )\r\n        {\r\n          FT_Long   total_max = ft_atol( p );\r\n\r\n\r\n          if ( total_max > 0 )\r\n          {\r\n            table->bound_total     = 1;\r\n            table->alloc_total_max = (FT_ULong)total_max;\r\n          }\r\n        }\r\n\r\n        p = getenv( \"FT2_ALLOC_COUNT_MAX\" );\r\n        if ( p != NULL )\r\n        {\r\n          FT_Long  total_count = ft_atol( p );\r\n\r\n\r\n          if ( total_count > 0 )\r\n          {\r\n            table->bound_count     = 1;\r\n            table->alloc_count_max = (FT_ULong)total_count;\r\n          }\r\n        }\r\n\r\n        p = getenv( \"FT2_KEEP_ALIVE\" );\r\n        if ( p != NULL )\r\n        {\r\n          FT_Long  keep_alive = ft_atol( p );\r\n\r\n\r\n          if ( keep_alive > 0 )\r\n            table->keep_alive = 1;\r\n        }\r\n\r\n        result = 1;\r\n      }\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  extern void\r\n  ft_mem_debug_done( FT_Memory  memory )\r\n  {\r\n    FT_MemTable  table = (FT_MemTable)memory->user;\r\n\r\n\r\n    if ( table )\r\n    {\r\n      memory->free    = table->free;\r\n      memory->realloc = table->realloc;\r\n      memory->alloc   = table->alloc;\r\n\r\n      ft_mem_table_destroy( table );\r\n      memory->user = NULL;\r\n    }\r\n  }\r\n\r\n\r\n\r\n  static int\r\n  ft_mem_source_compare( const void*  p1,\r\n                         const void*  p2 )\r\n  {\r\n    FT_MemSource  s1 = *(FT_MemSource*)p1;\r\n    FT_MemSource  s2 = *(FT_MemSource*)p2;\r\n\r\n\r\n    if ( s2->max_size > s1->max_size )\r\n      return 1;\r\n    else if ( s2->max_size < s1->max_size )\r\n      return -1;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  extern void\r\n  FT_DumpMemory( FT_Memory  memory )\r\n  {\r\n    FT_MemTable  table = (FT_MemTable)memory->user;\r\n\r\n\r\n    if ( table )\r\n    {\r\n      FT_MemSource*  bucket = table->sources;\r\n      FT_MemSource*  limit  = bucket + FT_MEM_SOURCE_BUCKETS;\r\n      FT_MemSource*  sources;\r\n      FT_UInt        nn, count;\r\n      const char*    fmt;\r\n\r\n\r\n      count = 0;\r\n      for ( ; bucket < limit; bucket++ )\r\n      {\r\n        FT_MemSource  source = *bucket;\r\n\r\n\r\n        for ( ; source; source = source->link )\r\n          count++;\r\n      }\r\n\r\n      sources = (FT_MemSource*)ft_mem_table_alloc(\r\n                                 table, sizeof ( *sources ) * count );\r\n\r\n      count = 0;\r\n      for ( bucket = table->sources; bucket < limit; bucket++ )\r\n      {\r\n        FT_MemSource  source = *bucket;\r\n\r\n\r\n        for ( ; source; source = source->link )\r\n          sources[count++] = source;\r\n      }\r\n\r\n      ft_qsort( sources, count, sizeof ( *sources ), ft_mem_source_compare );\r\n\r\n      printf( \"FreeType Memory Dump: \"\r\n              \"current=%ld max=%ld total=%ld count=%ld\\n\",\r\n              table->alloc_current, table->alloc_max,\r\n              table->alloc_total, table->alloc_count );\r\n      printf( \" block  block    sizes    sizes    sizes   source\\n\" );\r\n      printf( \" count   high      sum  highsum      max   location\\n\" );\r\n      printf( \"-------------------------------------------------\\n\" );\r\n\r\n      fmt = \"%6ld %6ld %8ld %8ld %8ld %s:%d\\n\";\r\n\r\n      for ( nn = 0; nn < count; nn++ )\r\n      {\r\n        FT_MemSource  source = sources[nn];\r\n\r\n\r\n        printf( fmt,\r\n                source->cur_blocks, source->max_blocks,\r\n                source->cur_size, source->max_size, source->cur_max,\r\n                FT_FILENAME( source->file_name ),\r\n                source->line_no );\r\n      }\r\n      printf( \"------------------------------------------------\\n\" );\r\n\r\n      ft_mem_table_free( table, sources );\r\n    }\r\n  }\r\n\r\n#else  /* !FT_DEBUG_MEMORY */\r\n\r\n  /* ANSI C doesn't like empty source files */\r\n  typedef int  _debug_mem_dummy;\r\n\r\n#endif /* !FT_DEBUG_MEMORY */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftdebug.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdebug.c                                                              */\r\n/*                                                                         */\r\n/*    Debugging and logging component (body).                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2008 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This component contains various macros and functions used to ease the */\r\n  /* debugging of the FreeType engine.  Its main purpose is in assertion   */\r\n  /* checking, tracing, and error detection.                               */\r\n  /*                                                                       */\r\n  /* There are now three debugging modes:                                  */\r\n  /*                                                                       */\r\n  /* - trace mode                                                          */\r\n  /*                                                                       */\r\n  /*   Error and trace messages are sent to the log file (which can be the */\r\n  /*   standard error output).                                             */\r\n  /*                                                                       */\r\n  /* - error mode                                                          */\r\n  /*                                                                       */\r\n  /*   Only error messages are generated.                                  */\r\n  /*                                                                       */\r\n  /* - release mode:                                                       */\r\n  /*                                                                       */\r\n  /*   No error message is sent or generated.  The code is free from any   */\r\n  /*   debugging parts.                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n  /* documentation is in ftdebug.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Message( const char*  fmt, ... )\r\n  {\r\n    va_list  ap;\r\n\r\n\r\n    va_start( ap, fmt );\r\n    vfprintf( stderr, fmt, ap );\r\n    va_end( ap );\r\n  }\r\n\r\n\r\n  /* documentation is in ftdebug.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Panic( const char*  fmt, ... )\r\n  {\r\n    va_list  ap;\r\n\r\n\r\n    va_start( ap, fmt );\r\n    vfprintf( stderr, fmt, ap );\r\n    va_end( ap );\r\n\r\n    exit( EXIT_FAILURE );\r\n  }\r\n\r\n#endif /* FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n  /* array of trace levels, initialized to 0 */\r\n  int  ft_trace_levels[trace_count];\r\n\r\n\r\n  /* define array of trace toggle names */\r\n#define FT_TRACE_DEF( x )  #x ,\r\n\r\n  static const char*  ft_trace_toggles[trace_count + 1] =\r\n  {\r\n#include FT_INTERNAL_TRACE_H\r\n    NULL\r\n  };\r\n\r\n#undef FT_TRACE_DEF\r\n\r\n\r\n  /* documentation is in ftdebug.h */\r\n\r\n  FT_BASE_DEF( FT_Int )\r\n  FT_Trace_Get_Count( void )\r\n  {\r\n    return trace_count;\r\n  }\r\n\r\n\r\n  /* documentation is in ftdebug.h */\r\n\r\n  FT_BASE_DEF( const char * )\r\n  FT_Trace_Get_Name( FT_Int  idx )\r\n  {\r\n    int  max = FT_Trace_Get_Count();\r\n\r\n\r\n    if ( idx < max )\r\n      return ft_trace_toggles[idx];\r\n    else\r\n      return NULL;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Initialize the tracing sub-system.  This is done by retrieving the    */\r\n  /* value of the `FT2_DEBUG' environment variable.  It must be a list of  */\r\n  /* toggles, separated by spaces, `;', or `,'.  Example:                  */\r\n  /*                                                                       */\r\n  /*    export FT2_DEBUG=\"any:3 memory:7 stream:5\"                         */\r\n  /*                                                                       */\r\n  /* This requests that all levels be set to 3, except the trace level for */\r\n  /* the memory and stream components which are set to 7 and 5,            */\r\n  /* respectively.                                                         */\r\n  /*                                                                       */\r\n  /* See the file <include/freetype/internal/fttrace.h> for details of the */\r\n  /* available toggle names.                                               */\r\n  /*                                                                       */\r\n  /* The level must be between 0 and 7; 0 means quiet (except for serious  */\r\n  /* runtime errors), and 7 means _very_ verbose.                          */\r\n  /*                                                                       */\r\n  FT_BASE_DEF( void )\r\n  ft_debug_init( void )\r\n  {\r\n    const char*  ft2_debug = getenv( \"FT2_DEBUG\" );\r\n\r\n\r\n    if ( ft2_debug )\r\n    {\r\n      const char*  p = ft2_debug;\r\n      const char*  q;\r\n\r\n\r\n      for ( ; *p; p++ )\r\n      {\r\n        /* skip leading whitespace and separators */\r\n        if ( *p == ' ' || *p == '\\t' || *p == ',' || *p == ';' || *p == '=' )\r\n          continue;\r\n\r\n        /* read toggle name, followed by ':' */\r\n        q = p;\r\n        while ( *p && *p != ':' )\r\n          p++;\r\n\r\n        if ( *p == ':' && p > q )\r\n        {\r\n          FT_Int  n, i, len = (FT_Int)( p - q );\r\n          FT_Int  level = -1, found = -1;\r\n\r\n\r\n          for ( n = 0; n < trace_count; n++ )\r\n          {\r\n            const char*  toggle = ft_trace_toggles[n];\r\n\r\n\r\n            for ( i = 0; i < len; i++ )\r\n            {\r\n              if ( toggle[i] != q[i] )\r\n                break;\r\n            }\r\n\r\n            if ( i == len && toggle[i] == 0 )\r\n            {\r\n              found = n;\r\n              break;\r\n            }\r\n          }\r\n\r\n          /* read level */\r\n          p++;\r\n          if ( *p )\r\n          {\r\n            level = *p++ - '0';\r\n            if ( level < 0 || level > 7 )\r\n              level = -1;\r\n          }\r\n\r\n          if ( found >= 0 && level >= 0 )\r\n          {\r\n            if ( found == trace_any )\r\n            {\r\n              /* special case for `any' */\r\n              for ( n = 0; n < trace_count; n++ )\r\n                ft_trace_levels[n] = level;\r\n            }\r\n            else\r\n              ft_trace_levels[found] = level;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n#else  /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_debug_init( void )\r\n  {\r\n    /* nothing */\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Int )\r\n  FT_Trace_Get_Count( void )\r\n  {\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( const char * )\r\n  FT_Trace_Get_Name( FT_Int  idx )\r\n  {\r\n    FT_UNUSED( idx );\r\n\r\n    return NULL;\r\n  }\r\n\r\n\r\n#endif /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftfstype.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftfstype.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType utility file to access FSType data (body).                  */\r\n/*                                                                         */\r\n/*  Copyright 2008, 2009 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_TYPE1_TABLES_H\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UShort )\r\n  FT_Get_FSType_Flags( FT_Face  face )\r\n  {\r\n    TT_OS2*  os2;\r\n\r\n\r\n    /* first, try to get the fs_type directly from the font */\r\n    if ( face )\r\n    {\r\n      FT_Service_PsInfo  service = NULL;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );\r\n\r\n      if ( service && service->ps_get_font_extra )\r\n      {\r\n        PS_FontExtraRec  extra;\r\n\r\n\r\n        if ( !service->ps_get_font_extra( face, &extra ) &&\r\n             extra.fs_type != 0                          )\r\n          return extra.fs_type;\r\n      }\r\n    }\r\n\r\n    /* look at FSType before fsType for Type42 */\r\n\r\n    if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL &&\r\n         os2->version != 0xFFFFU                                           )\r\n      return os2->fsType;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftgasp.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgasp.c                                                               */\r\n/*                                                                         */\r\n/*    Access of TrueType's `gasp' table (body).                            */\r\n/*                                                                         */\r\n/*  Copyright 2007 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_GASP_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Int )\r\n  FT_Get_Gasp( FT_Face  face,\r\n               FT_UInt  ppem )\r\n  {\r\n    FT_Int  result = FT_GASP_NO_TABLE;\r\n\r\n\r\n    if ( face && FT_IS_SFNT( face ) )\r\n    {\r\n      TT_Face  ttface = (TT_Face)face;\r\n\r\n\r\n      if ( ttface->gasp.numRanges > 0 )\r\n      {\r\n        TT_GaspRange  range     = ttface->gasp.gaspRanges;\r\n        TT_GaspRange  range_end = range + ttface->gasp.numRanges;\r\n\r\n\r\n        while ( ppem > range->maxPPEM )\r\n        {\r\n          range++;\r\n          if ( range >= range_end )\r\n            goto Exit;\r\n        }\r\n\r\n        result = range->gaspFlag;\r\n\r\n        /* ensure that we don't have spurious bits */\r\n        if ( ttface->gasp.version == 0 )\r\n          result &= 3;\r\n      }\r\n    }\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftgloadr.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgloadr.c                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph loader (body).                                    */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2005, 2006, 2010 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_GLYPH_LOADER_H\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gloader\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                                                               *****/\r\n  /*****                    G L Y P H   L O A D E R                    *****/\r\n  /*****                                                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The glyph loader is a simple object which is used to load a set of    */\r\n  /* glyphs easily.  It is critical for the correct loading of composites. */\r\n  /*                                                                       */\r\n  /* Ideally, one can see it as a stack of abstract `glyph' objects.       */\r\n  /*                                                                       */\r\n  /*   loader.base     Is really the bottom of the stack.  It describes a  */\r\n  /*                   single glyph image made of the juxtaposition of     */\r\n  /*                   several glyphs (those `in the stack').              */\r\n  /*                                                                       */\r\n  /*   loader.current  Describes the top of the stack, on which a new      */\r\n  /*                   glyph can be loaded.                                */\r\n  /*                                                                       */\r\n  /*   Rewind          Clears the stack.                                   */\r\n  /*   Prepare         Set up `loader.current' for addition of a new glyph */\r\n  /*                   image.                                              */\r\n  /*   Add             Add the `current' glyph image to the `base' one,    */\r\n  /*                   and prepare for another one.                        */\r\n  /*                                                                       */\r\n  /* The glyph loader is now a base object.  Each driver used to           */\r\n  /* re-implement it in one way or the other, which wasted code and        */\r\n  /* energy.                                                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* create a new glyph loader */\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_GlyphLoader_New( FT_Memory        memory,\r\n                      FT_GlyphLoader  *aloader )\r\n  {\r\n    FT_GlyphLoader  loader = NULL;\r\n    FT_Error        error;\r\n\r\n\r\n    if ( !FT_NEW( loader ) )\r\n    {\r\n      loader->memory = memory;\r\n      *aloader       = loader;\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  /* rewind the glyph loader - reset counters to 0 */\r\n  FT_BASE_DEF( void )\r\n  FT_GlyphLoader_Rewind( FT_GlyphLoader  loader )\r\n  {\r\n    FT_GlyphLoad  base    = &loader->base;\r\n    FT_GlyphLoad  current = &loader->current;\r\n\r\n\r\n    base->outline.n_points   = 0;\r\n    base->outline.n_contours = 0;\r\n    base->num_subglyphs      = 0;\r\n\r\n    *current = *base;\r\n  }\r\n\r\n\r\n  /* reset the glyph loader, frees all allocated tables */\r\n  /* and starts from zero                               */\r\n  FT_BASE_DEF( void )\r\n  FT_GlyphLoader_Reset( FT_GlyphLoader  loader )\r\n  {\r\n    FT_Memory memory = loader->memory;\r\n\r\n\r\n    FT_FREE( loader->base.outline.points );\r\n    FT_FREE( loader->base.outline.tags );\r\n    FT_FREE( loader->base.outline.contours );\r\n    FT_FREE( loader->base.extra_points );\r\n    FT_FREE( loader->base.subglyphs );\r\n\r\n    loader->base.extra_points2 = NULL;\r\n\r\n    loader->max_points    = 0;\r\n    loader->max_contours  = 0;\r\n    loader->max_subglyphs = 0;\r\n\r\n    FT_GlyphLoader_Rewind( loader );\r\n  }\r\n\r\n\r\n  /* delete a glyph loader */\r\n  FT_BASE_DEF( void )\r\n  FT_GlyphLoader_Done( FT_GlyphLoader  loader )\r\n  {\r\n    if ( loader )\r\n    {\r\n      FT_Memory memory = loader->memory;\r\n\r\n\r\n      FT_GlyphLoader_Reset( loader );\r\n      FT_FREE( loader );\r\n    }\r\n  }\r\n\r\n\r\n  /* re-adjust the `current' outline fields */\r\n  static void\r\n  FT_GlyphLoader_Adjust_Points( FT_GlyphLoader  loader )\r\n  {\r\n    FT_Outline*  base    = &loader->base.outline;\r\n    FT_Outline*  current = &loader->current.outline;\r\n\r\n\r\n    current->points   = base->points   + base->n_points;\r\n    current->tags     = base->tags     + base->n_points;\r\n    current->contours = base->contours + base->n_contours;\r\n\r\n    /* handle extra points table - if any */\r\n    if ( loader->use_extra )\r\n    {\r\n      loader->current.extra_points  = loader->base.extra_points +\r\n                                      base->n_points;\r\n\r\n      loader->current.extra_points2 = loader->base.extra_points2 +\r\n                                      base->n_points;\r\n    }\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_GlyphLoader_CreateExtra( FT_GlyphLoader  loader )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = loader->memory;\r\n\r\n\r\n    if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) )\r\n    {\r\n      loader->use_extra          = 1;\r\n      loader->base.extra_points2 = loader->base.extra_points +\r\n                                   loader->max_points;\r\n\r\n      FT_GlyphLoader_Adjust_Points( loader );\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  /* re-adjust the `current' subglyphs field */\r\n  static void\r\n  FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader  loader )\r\n  {\r\n    FT_GlyphLoad  base    = &loader->base;\r\n    FT_GlyphLoad  current = &loader->current;\r\n\r\n\r\n    current->subglyphs = base->subglyphs + base->num_subglyphs;\r\n  }\r\n\r\n\r\n  /* Ensure that we can add `n_points' and `n_contours' to our glyph.      */\r\n  /* This function reallocates its outline tables if necessary.  Note that */\r\n  /* it DOESN'T change the number of points within the loader!             */\r\n  /*                                                                       */\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_GlyphLoader_CheckPoints( FT_GlyphLoader  loader,\r\n                              FT_UInt         n_points,\r\n                              FT_UInt         n_contours )\r\n  {\r\n    FT_Memory    memory  = loader->memory;\r\n    FT_Error     error   = FT_Err_Ok;\r\n    FT_Outline*  base    = &loader->base.outline;\r\n    FT_Outline*  current = &loader->current.outline;\r\n    FT_Bool      adjust  = 0;\r\n\r\n    FT_UInt      new_max, old_max;\r\n\r\n\r\n    /* check points & tags */\r\n    new_max = base->n_points + current->n_points + n_points;\r\n    old_max = loader->max_points;\r\n\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = FT_PAD_CEIL( new_max, 8 );\r\n\r\n      if ( new_max > FT_OUTLINE_POINTS_MAX )\r\n        return FT_Err_Array_Too_Large;\r\n\r\n      if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||\r\n           FT_RENEW_ARRAY( base->tags,   old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      if ( loader->use_extra )\r\n      {\r\n        if ( FT_RENEW_ARRAY( loader->base.extra_points,\r\n                             old_max * 2, new_max * 2 ) )\r\n          goto Exit;\r\n\r\n        FT_ARRAY_MOVE( loader->base.extra_points + new_max,\r\n                       loader->base.extra_points + old_max,\r\n                       old_max );\r\n\r\n        loader->base.extra_points2 = loader->base.extra_points + new_max;\r\n      }\r\n\r\n      adjust = 1;\r\n      loader->max_points = new_max;\r\n    }\r\n\r\n    /* check contours */\r\n    old_max = loader->max_contours;\r\n    new_max = base->n_contours + current->n_contours +\r\n              n_contours;\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = FT_PAD_CEIL( new_max, 4 );\r\n\r\n      if ( new_max > FT_OUTLINE_CONTOURS_MAX )\r\n        return FT_Err_Array_Too_Large;\r\n\r\n      if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      adjust = 1;\r\n      loader->max_contours = new_max;\r\n    }\r\n\r\n    if ( adjust )\r\n      FT_GlyphLoader_Adjust_Points( loader );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Ensure that we can add `n_subglyphs' to our glyph. this function */\r\n  /* reallocates its subglyphs table if necessary.  Note that it DOES */\r\n  /* NOT change the number of subglyphs within the loader!            */\r\n  /*                                                                  */\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader  loader,\r\n                                 FT_UInt         n_subs )\r\n  {\r\n    FT_Memory     memory = loader->memory;\r\n    FT_Error      error  = FT_Err_Ok;\r\n    FT_UInt       new_max, old_max;\r\n\r\n    FT_GlyphLoad  base    = &loader->base;\r\n    FT_GlyphLoad  current = &loader->current;\r\n\r\n\r\n    new_max = base->num_subglyphs + current->num_subglyphs + n_subs;\r\n    old_max = loader->max_subglyphs;\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = FT_PAD_CEIL( new_max, 2 );\r\n      if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )\r\n        goto Exit;\r\n\r\n      loader->max_subglyphs = new_max;\r\n\r\n      FT_GlyphLoader_Adjust_Subglyphs( loader );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* prepare loader for the addition of a new glyph on top of the base one */\r\n  FT_BASE_DEF( void )\r\n  FT_GlyphLoader_Prepare( FT_GlyphLoader  loader )\r\n  {\r\n    FT_GlyphLoad  current = &loader->current;\r\n\r\n\r\n    current->outline.n_points   = 0;\r\n    current->outline.n_contours = 0;\r\n    current->num_subglyphs      = 0;\r\n\r\n    FT_GlyphLoader_Adjust_Points   ( loader );\r\n    FT_GlyphLoader_Adjust_Subglyphs( loader );\r\n  }\r\n\r\n\r\n  /* add current glyph to the base image -- and prepare for another */\r\n  FT_BASE_DEF( void )\r\n  FT_GlyphLoader_Add( FT_GlyphLoader  loader )\r\n  {\r\n    FT_GlyphLoad  base;\r\n    FT_GlyphLoad  current;\r\n\r\n    FT_UInt       n_curr_contours;\r\n    FT_UInt       n_base_points;\r\n    FT_UInt       n;\r\n\r\n\r\n    if ( !loader )\r\n      return;\r\n\r\n    base    = &loader->base;\r\n    current = &loader->current;\r\n\r\n    n_curr_contours = current->outline.n_contours;\r\n    n_base_points   = base->outline.n_points;\r\n\r\n    base->outline.n_points =\r\n      (short)( base->outline.n_points + current->outline.n_points );\r\n    base->outline.n_contours =\r\n      (short)( base->outline.n_contours + current->outline.n_contours );\r\n\r\n    base->num_subglyphs += current->num_subglyphs;\r\n\r\n    /* adjust contours count in newest outline */\r\n    for ( n = 0; n < n_curr_contours; n++ )\r\n      current->outline.contours[n] =\r\n        (short)( current->outline.contours[n] + n_base_points );\r\n\r\n    /* prepare for another new glyph image */\r\n    FT_GlyphLoader_Prepare( loader );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_GlyphLoader_CopyPoints( FT_GlyphLoader  target,\r\n                             FT_GlyphLoader  source )\r\n  {\r\n    FT_Error  error;\r\n    FT_UInt   num_points   = source->base.outline.n_points;\r\n    FT_UInt   num_contours = source->base.outline.n_contours;\r\n\r\n\r\n    error = FT_GlyphLoader_CheckPoints( target, num_points, num_contours );\r\n    if ( !error )\r\n    {\r\n      FT_Outline*  out = &target->base.outline;\r\n      FT_Outline*  in  = &source->base.outline;\r\n\r\n\r\n      FT_ARRAY_COPY( out->points, in->points,\r\n                     num_points );\r\n      FT_ARRAY_COPY( out->tags, in->tags,\r\n                     num_points );\r\n      FT_ARRAY_COPY( out->contours, in->contours,\r\n                     num_contours );\r\n\r\n      /* do we need to copy the extra points? */\r\n      if ( target->use_extra && source->use_extra )\r\n      {\r\n        FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points,\r\n                       num_points );\r\n        FT_ARRAY_COPY( target->base.extra_points2, source->base.extra_points2,\r\n                       num_points );\r\n      }\r\n\r\n      out->n_points   = (short)num_points;\r\n      out->n_contours = (short)num_contours;\r\n\r\n      FT_GlyphLoader_Adjust_Points( target );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftglyph.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftglyph.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType convenience functions to handle glyphs (body).              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2005, 2007, 2008, 2010, 2012 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  This file contains the definition of several convenience functions   */\r\n  /*  that can be used by client applications to easily retrieve glyph     */\r\n  /*  bitmaps and outlines from a given face.                              */\r\n  /*                                                                       */\r\n  /*  These functions should be optional if you are writing a font server  */\r\n  /*  or text layout engine on top of FreeType.  However, they are pretty  */\r\n  /*  handy for many other simple uses of the library.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_GLYPH_H\r\n#include FT_OUTLINE_H\r\n#include FT_BITMAP_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#include \"basepic.h\"\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_glyph\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****   FT_BitmapGlyph support                                        ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ft_bitmap_glyph_init( FT_Glyph      bitmap_glyph,\r\n                        FT_GlyphSlot  slot )\r\n  {\r\n    FT_BitmapGlyph  glyph   = (FT_BitmapGlyph)bitmap_glyph;\r\n    FT_Error        error   = FT_Err_Ok;\r\n    FT_Library      library = FT_GLYPH( glyph )->library;\r\n\r\n\r\n    if ( slot->format != FT_GLYPH_FORMAT_BITMAP )\r\n    {\r\n      error = FT_Err_Invalid_Glyph_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    glyph->left = slot->bitmap_left;\r\n    glyph->top  = slot->bitmap_top;\r\n\r\n    /* do lazy copying whenever possible */\r\n    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )\r\n    {\r\n      glyph->bitmap = slot->bitmap;\r\n      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;\r\n    }\r\n    else\r\n    {\r\n      FT_Bitmap_New( &glyph->bitmap );\r\n      error = FT_Bitmap_Copy( library, &slot->bitmap, &glyph->bitmap );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ft_bitmap_glyph_copy( FT_Glyph  bitmap_source,\r\n                        FT_Glyph  bitmap_target )\r\n  {\r\n    FT_Library      library = bitmap_source->library;\r\n    FT_BitmapGlyph  source  = (FT_BitmapGlyph)bitmap_source;\r\n    FT_BitmapGlyph  target  = (FT_BitmapGlyph)bitmap_target;\r\n\r\n\r\n    target->left = source->left;\r\n    target->top  = source->top;\r\n\r\n    return FT_Bitmap_Copy( library, &source->bitmap, &target->bitmap );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ft_bitmap_glyph_done( FT_Glyph  bitmap_glyph )\r\n  {\r\n    FT_BitmapGlyph  glyph   = (FT_BitmapGlyph)bitmap_glyph;\r\n    FT_Library      library = FT_GLYPH( glyph )->library;\r\n\r\n\r\n    FT_Bitmap_Done( library, &glyph->bitmap );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ft_bitmap_glyph_bbox( FT_Glyph  bitmap_glyph,\r\n                        FT_BBox*  cbox )\r\n  {\r\n    FT_BitmapGlyph  glyph = (FT_BitmapGlyph)bitmap_glyph;\r\n\r\n\r\n    cbox->xMin = glyph->left << 6;\r\n    cbox->xMax = cbox->xMin + ( glyph->bitmap.width << 6 );\r\n    cbox->yMax = glyph->top << 6;\r\n    cbox->yMin = cbox->yMax - ( glyph->bitmap.rows << 6 );\r\n  }\r\n\r\n\r\n  FT_DEFINE_GLYPH(ft_bitmap_glyph_class,\r\n    sizeof ( FT_BitmapGlyphRec ),\r\n    FT_GLYPH_FORMAT_BITMAP,\r\n\r\n    ft_bitmap_glyph_init,\r\n    ft_bitmap_glyph_done,\r\n    ft_bitmap_glyph_copy,\r\n    0,                          /* FT_Glyph_TransformFunc */\r\n    ft_bitmap_glyph_bbox,\r\n    0                           /* FT_Glyph_PrepareFunc   */\r\n  )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****   FT_OutlineGlyph support                                       ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ft_outline_glyph_init( FT_Glyph      outline_glyph,\r\n                         FT_GlyphSlot  slot )\r\n  {\r\n    FT_OutlineGlyph  glyph   = (FT_OutlineGlyph)outline_glyph;\r\n    FT_Error         error   = FT_Err_Ok;\r\n    FT_Library       library = FT_GLYPH( glyph )->library;\r\n    FT_Outline*      source  = &slot->outline;\r\n    FT_Outline*      target  = &glyph->outline;\r\n\r\n\r\n    /* check format in glyph slot */\r\n    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )\r\n    {\r\n      error = FT_Err_Invalid_Glyph_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* allocate new outline */\r\n    error = FT_Outline_New( library, source->n_points, source->n_contours,\r\n                            &glyph->outline );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_Outline_Copy( source, target );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ft_outline_glyph_done( FT_Glyph  outline_glyph )\r\n  {\r\n    FT_OutlineGlyph  glyph = (FT_OutlineGlyph)outline_glyph;\r\n\r\n\r\n    FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ft_outline_glyph_copy( FT_Glyph  outline_source,\r\n                         FT_Glyph  outline_target )\r\n  {\r\n    FT_OutlineGlyph  source  = (FT_OutlineGlyph)outline_source;\r\n    FT_OutlineGlyph  target  = (FT_OutlineGlyph)outline_target;\r\n    FT_Error         error;\r\n    FT_Library       library = FT_GLYPH( source )->library;\r\n\r\n\r\n    error = FT_Outline_New( library, source->outline.n_points,\r\n                            source->outline.n_contours, &target->outline );\r\n    if ( !error )\r\n      FT_Outline_Copy( &source->outline, &target->outline );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ft_outline_glyph_transform( FT_Glyph          outline_glyph,\r\n                              const FT_Matrix*  matrix,\r\n                              const FT_Vector*  delta )\r\n  {\r\n    FT_OutlineGlyph  glyph = (FT_OutlineGlyph)outline_glyph;\r\n\r\n\r\n    if ( matrix )\r\n      FT_Outline_Transform( &glyph->outline, matrix );\r\n\r\n    if ( delta )\r\n      FT_Outline_Translate( &glyph->outline, delta->x, delta->y );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ft_outline_glyph_bbox( FT_Glyph  outline_glyph,\r\n                         FT_BBox*  bbox )\r\n  {\r\n    FT_OutlineGlyph  glyph = (FT_OutlineGlyph)outline_glyph;\r\n\r\n\r\n    FT_Outline_Get_CBox( &glyph->outline, bbox );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ft_outline_glyph_prepare( FT_Glyph      outline_glyph,\r\n                            FT_GlyphSlot  slot )\r\n  {\r\n    FT_OutlineGlyph  glyph = (FT_OutlineGlyph)outline_glyph;\r\n\r\n\r\n    slot->format         = FT_GLYPH_FORMAT_OUTLINE;\r\n    slot->outline        = glyph->outline;\r\n    slot->outline.flags &= ~FT_OUTLINE_OWNER;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_GLYPH( ft_outline_glyph_class,\r\n    sizeof ( FT_OutlineGlyphRec ),\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    ft_outline_glyph_init,\r\n    ft_outline_glyph_done,\r\n    ft_outline_glyph_copy,\r\n    ft_outline_glyph_transform,\r\n    ft_outline_glyph_bbox,\r\n    ft_outline_glyph_prepare\r\n  )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****   FT_Glyph class and API                                        ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n   static FT_Error\r\n   ft_new_glyph( FT_Library             library,\r\n                 const FT_Glyph_Class*  clazz,\r\n                 FT_Glyph*              aglyph )\r\n   {\r\n     FT_Memory  memory = library->memory;\r\n     FT_Error   error;\r\n     FT_Glyph   glyph  = NULL;\r\n\r\n\r\n     *aglyph = 0;\r\n\r\n     if ( !FT_ALLOC( glyph, clazz->glyph_size ) )\r\n     {\r\n       glyph->library = library;\r\n       glyph->clazz   = clazz;\r\n       glyph->format  = clazz->glyph_format;\r\n\r\n       *aglyph = glyph;\r\n     }\r\n\r\n     return error;\r\n   }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Glyph_Copy( FT_Glyph   source,\r\n                 FT_Glyph  *target )\r\n  {\r\n    FT_Glyph               copy;\r\n    FT_Error               error;\r\n    const FT_Glyph_Class*  clazz;\r\n\r\n\r\n    /* check arguments */\r\n    if ( !target )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    *target = 0;\r\n\r\n    if ( !source || !source->clazz )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    clazz = source->clazz;\r\n    error = ft_new_glyph( source->library, clazz, &copy );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    copy->advance = source->advance;\r\n    copy->format  = source->format;\r\n\r\n    if ( clazz->glyph_copy )\r\n      error = clazz->glyph_copy( source, copy );\r\n\r\n    if ( error )\r\n      FT_Done_Glyph( copy );\r\n    else\r\n      *target = copy;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Glyph( FT_GlyphSlot  slot,\r\n                FT_Glyph     *aglyph )\r\n  {\r\n    FT_Library  library;\r\n    FT_Error    error;\r\n    FT_Glyph    glyph;\r\n\r\n    const FT_Glyph_Class*  clazz = 0;\r\n\r\n\r\n    if ( !slot )\r\n      return FT_Err_Invalid_Slot_Handle;\r\n\r\n    library = slot->library;\r\n\r\n    if ( !aglyph )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* if it is a bitmap, that's easy :-) */\r\n    if ( slot->format == FT_GLYPH_FORMAT_BITMAP )\r\n      clazz = FT_BITMAP_GLYPH_CLASS_GET;\r\n\r\n    /* if it is an outline */\r\n    else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )\r\n      clazz = FT_OUTLINE_GLYPH_CLASS_GET;\r\n\r\n    else\r\n    {\r\n      /* try to find a renderer that supports the glyph image format */\r\n      FT_Renderer  render = FT_Lookup_Renderer( library, slot->format, 0 );\r\n\r\n\r\n      if ( render )\r\n        clazz = &render->glyph_class;\r\n    }\r\n\r\n    if ( !clazz )\r\n    {\r\n      error = FT_Err_Invalid_Glyph_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* create FT_Glyph object */\r\n    error = ft_new_glyph( library, clazz, &glyph );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* copy advance while converting it to 16.16 format */\r\n    glyph->advance.x = slot->advance.x << 10;\r\n    glyph->advance.y = slot->advance.y << 10;\r\n\r\n    /* now import the image from the glyph slot */\r\n    error = clazz->glyph_init( glyph, slot );\r\n\r\n    /* if an error occurred, destroy the glyph */\r\n    if ( error )\r\n      FT_Done_Glyph( glyph );\r\n    else\r\n      *aglyph = glyph;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Glyph_Transform( FT_Glyph    glyph,\r\n                      FT_Matrix*  matrix,\r\n                      FT_Vector*  delta )\r\n  {\r\n    const FT_Glyph_Class*  clazz;\r\n    FT_Error               error = FT_Err_Ok;\r\n\r\n\r\n    if ( !glyph || !glyph->clazz )\r\n      error = FT_Err_Invalid_Argument;\r\n    else\r\n    {\r\n      clazz = glyph->clazz;\r\n      if ( clazz->glyph_transform )\r\n      {\r\n        /* transform glyph image */\r\n        clazz->glyph_transform( glyph, matrix, delta );\r\n\r\n        /* transform advance vector */\r\n        if ( matrix )\r\n          FT_Vector_Transform( &glyph->advance, matrix );\r\n      }\r\n      else\r\n        error = FT_Err_Invalid_Glyph_Format;\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Glyph_Get_CBox( FT_Glyph  glyph,\r\n                     FT_UInt   bbox_mode,\r\n                     FT_BBox  *acbox )\r\n  {\r\n    const FT_Glyph_Class*  clazz;\r\n\r\n\r\n    if ( !acbox )\r\n      return;\r\n\r\n    acbox->xMin = acbox->yMin = acbox->xMax = acbox->yMax = 0;\r\n\r\n    if ( !glyph || !glyph->clazz )\r\n      return;\r\n    else\r\n    {\r\n      clazz = glyph->clazz;\r\n      if ( !clazz->glyph_bbox )\r\n        return;\r\n      else\r\n      {\r\n        /* retrieve bbox in 26.6 coordinates */\r\n        clazz->glyph_bbox( glyph, acbox );\r\n\r\n        /* perform grid fitting if needed */\r\n        if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||\r\n             bbox_mode == FT_GLYPH_BBOX_PIXELS  )\r\n        {\r\n          acbox->xMin = FT_PIX_FLOOR( acbox->xMin );\r\n          acbox->yMin = FT_PIX_FLOOR( acbox->yMin );\r\n          acbox->xMax = FT_PIX_CEIL( acbox->xMax );\r\n          acbox->yMax = FT_PIX_CEIL( acbox->yMax );\r\n        }\r\n\r\n        /* convert to integer pixels if needed */\r\n        if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE ||\r\n             bbox_mode == FT_GLYPH_BBOX_PIXELS   )\r\n        {\r\n          acbox->xMin >>= 6;\r\n          acbox->yMin >>= 6;\r\n          acbox->xMax >>= 6;\r\n          acbox->yMax >>= 6;\r\n        }\r\n      }\r\n    }\r\n    return;\r\n  }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,\r\n                      FT_Render_Mode  render_mode,\r\n                      FT_Vector*      origin,\r\n                      FT_Bool         destroy )\r\n  {\r\n    FT_GlyphSlotRec           dummy;\r\n    FT_GlyphSlot_InternalRec  dummy_internal;\r\n    FT_Error                  error = FT_Err_Ok;\r\n    FT_Glyph                  b, glyph;\r\n    FT_BitmapGlyph            bitmap = NULL;\r\n    const FT_Glyph_Class*     clazz;\r\n\r\n    /* FT_BITMAP_GLYPH_CLASS_GET derefers `library' in PIC mode */\r\n    FT_Library                library;\r\n\r\n\r\n    /* check argument */\r\n    if ( !the_glyph )\r\n      goto Bad;\r\n    glyph = *the_glyph;\r\n    if ( !glyph )\r\n      goto Bad;\r\n\r\n    clazz   = glyph->clazz;\r\n    library = glyph->library;\r\n    if ( !library || !clazz )\r\n      goto Bad;\r\n\r\n    /* when called with a bitmap glyph, do nothing and return successfully */\r\n    if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )\r\n      goto Exit;\r\n\r\n    if ( !clazz->glyph_prepare )\r\n      goto Bad;\r\n\r\n    /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */\r\n    /* then calling FT_Render_Glyph_Internal()                            */\r\n\r\n    FT_MEM_ZERO( &dummy, sizeof ( dummy ) );\r\n    FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) );\r\n    dummy.internal = &dummy_internal;\r\n    dummy.library  = library;\r\n    dummy.format   = clazz->glyph_format;\r\n\r\n    /* create result bitmap glyph */\r\n    error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b );\r\n    if ( error )\r\n      goto Exit;\r\n    bitmap = (FT_BitmapGlyph)b;\r\n\r\n#if 1\r\n    /* if `origin' is set, translate the glyph image */\r\n    if ( origin )\r\n      FT_Glyph_Transform( glyph, 0, origin );\r\n#else\r\n    FT_UNUSED( origin );\r\n#endif\r\n\r\n    /* prepare dummy slot for rendering */\r\n    error = clazz->glyph_prepare( glyph, &dummy );\r\n    if ( !error )\r\n      error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );\r\n\r\n#if 1\r\n    if ( !destroy && origin )\r\n    {\r\n      FT_Vector  v;\r\n\r\n\r\n      v.x = -origin->x;\r\n      v.y = -origin->y;\r\n      FT_Glyph_Transform( glyph, 0, &v );\r\n    }\r\n#endif\r\n\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* in case of success, copy the bitmap to the glyph bitmap */\r\n    error = ft_bitmap_glyph_init( (FT_Glyph)bitmap, &dummy );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* copy advance */\r\n    bitmap->root.advance = glyph->advance;\r\n\r\n    if ( destroy )\r\n      FT_Done_Glyph( glyph );\r\n\r\n    *the_glyph = FT_GLYPH( bitmap );\r\n\r\n  Exit:\r\n    if ( error && bitmap )\r\n      FT_Done_Glyph( FT_GLYPH( bitmap ) );\r\n\r\n    return error;\r\n\r\n  Bad:\r\n    error = FT_Err_Invalid_Argument;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /* documentation is in ftglyph.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Done_Glyph( FT_Glyph  glyph )\r\n  {\r\n    if ( glyph )\r\n    {\r\n      FT_Memory              memory = glyph->library->memory;\r\n      const FT_Glyph_Class*  clazz  = glyph->clazz;\r\n\r\n\r\n      if ( clazz->glyph_done )\r\n        clazz->glyph_done( glyph );\r\n\r\n      FT_FREE( glyph );\r\n    }\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftgxval.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgxval.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating TrueTyepGX/AAT tables (body).            */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2010 by                                    */\r\n/*  Masatake YAMATO, Redhat K.K,                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_GX_VALIDATE_H\r\n\r\n\r\n  /* documentation is in ftgxval.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_TrueTypeGX_Validate( FT_Face   face,\r\n                          FT_UInt   validation_flags,\r\n                          FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],\r\n                          FT_UInt   table_length )\r\n  {\r\n    FT_Service_GXvalidate  service;\r\n    FT_Error               error;\r\n\r\n\r\n    if ( !face )\r\n    {\r\n      error = FT_Err_Invalid_Face_Handle;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( tables == NULL )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE );\r\n\r\n    if ( service )\r\n      error = service->validate( face,\r\n                                 validation_flags,\r\n                                 tables,\r\n                                 table_length );\r\n    else\r\n      error = FT_Err_Unimplemented_Feature;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_TrueTypeGX_Free( FT_Face   face,\r\n                      FT_Bytes  table )\r\n  {\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n    FT_FREE( table );\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_ClassicKern_Validate( FT_Face    face,\r\n                           FT_UInt    validation_flags,\r\n                           FT_Bytes  *ckern_table )\r\n  {\r\n    FT_Service_CKERNvalidate  service;\r\n    FT_Error                  error;\r\n\r\n\r\n    if ( !face )\r\n    {\r\n      error = FT_Err_Invalid_Face_Handle;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( ckern_table == NULL )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, service, CLASSICKERN_VALIDATE );\r\n\r\n    if ( service )\r\n      error = service->validate( face,\r\n                                 validation_flags,\r\n                                 ckern_table );\r\n    else\r\n      error = FT_Err_Unimplemented_Feature;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_ClassicKern_Free( FT_Face   face,\r\n                       FT_Bytes  table )\r\n  {\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n    FT_FREE( table );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftinit.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftinit.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType initialization layer (body).                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2005, 2007, 2009, 2012 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  The purpose of this file is to implement the following two           */\r\n  /*  functions:                                                           */\r\n  /*                                                                       */\r\n  /*  FT_Add_Default_Modules():                                            */\r\n  /*     This function is used to add the set of default modules to a      */\r\n  /*     fresh new library object.  The set is taken from the header file  */\r\n  /*     `freetype/config/ftmodule.h'.  See the document `FreeType 2.0     */\r\n  /*     Build System' for more information.                               */\r\n  /*                                                                       */\r\n  /*  FT_Init_FreeType():                                                  */\r\n  /*     This function creates a system object for the current platform,   */\r\n  /*     builds a library out of it, then calls FT_Default_Drivers().      */\r\n  /*                                                                       */\r\n  /*  Note that even if FT_Init_FreeType() uses the implementation of the  */\r\n  /*  system object defined at build time, client applications are still   */\r\n  /*  able to provide their own `ftsystem.c'.                              */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_MODULE_H\r\n#include \"basepic.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_init\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n\r\n#undef  FT_USE_MODULE\r\n#ifdef __cplusplus\r\n#define FT_USE_MODULE( type, x )  extern \"C\" const type  x;\r\n#else\r\n#define FT_USE_MODULE( type, x )  extern const type  x;\r\n#endif\r\n\r\n#include FT_CONFIG_MODULES_H\r\n\r\n#undef  FT_USE_MODULE\r\n#define FT_USE_MODULE( type, x )  (const FT_Module_Class*)&(x),\r\n\r\n  static\r\n  const FT_Module_Class*  const ft_default_modules[] =\r\n  {\r\n#include FT_CONFIG_MODULES_H\r\n    0\r\n  };\r\n\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXTERNC  extern \"C\"\r\n#else\r\n#define FT_EXTERNC  extern\r\n#endif\r\n\r\n  /* declare the module's class creation/destruction functions */\r\n#undef  FT_USE_MODULE\r\n#define FT_USE_MODULE( type, x )                            \\\r\n  FT_EXTERNC FT_Error                                       \\\r\n  FT_Create_Class_ ## x( FT_Library         library,        \\\r\n                         FT_Module_Class*  *output_class ); \\\r\n  FT_EXTERNC void                                           \\\r\n  FT_Destroy_Class_ ## x( FT_Library        library,        \\\r\n                          FT_Module_Class*  clazz );\r\n\r\n#include FT_CONFIG_MODULES_H\r\n\r\n  /* count all module classes */\r\n#undef  FT_USE_MODULE\r\n#define FT_USE_MODULE( type, x )  MODULE_CLASS_ ## x,\r\n\r\n  enum\r\n  {\r\n#include FT_CONFIG_MODULES_H\r\n    FT_NUM_MODULE_CLASSES\r\n  };\r\n\r\n  /* destroy all module classes */\r\n#undef  FT_USE_MODULE\r\n#define FT_USE_MODULE( type, x )                   \\\r\n  if ( classes[i] )                                \\\r\n  {                                                \\\r\n    FT_Destroy_Class_ ## x( library, classes[i] ); \\\r\n  }                                                \\\r\n  i++;\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_destroy_default_module_classes( FT_Library  library )\r\n  {\r\n    FT_Module_Class*  *classes;\r\n    FT_Memory          memory;\r\n    FT_UInt            i;\r\n    BasePIC*           pic_container = (BasePIC*)library->pic_container.base;\r\n\r\n\r\n    if ( !pic_container->default_module_classes )\r\n      return;\r\n\r\n    memory  = library->memory;\r\n    classes = pic_container->default_module_classes;\r\n    i       = 0;\r\n\r\n#include FT_CONFIG_MODULES_H\r\n\r\n    FT_FREE( classes );\r\n    pic_container->default_module_classes = 0;\r\n  }\r\n\r\n\r\n  /* initialize all module classes and the pointer table */\r\n#undef  FT_USE_MODULE\r\n#define FT_USE_MODULE( type, x )                     \\\r\n  error = FT_Create_Class_ ## x( library, &clazz );  \\\r\n  if ( error )                                       \\\r\n    goto Exit;                                       \\\r\n  classes[i++] = clazz;\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  ft_create_default_module_classes( FT_Library  library )\r\n  {\r\n    FT_Error           error;\r\n    FT_Memory          memory;\r\n    FT_Module_Class*  *classes = NULL;\r\n    FT_Module_Class*   clazz;\r\n    FT_UInt            i;\r\n    BasePIC*           pic_container = (BasePIC*)library->pic_container.base;\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    pic_container->default_module_classes = 0;\r\n\r\n    if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * \r\n                              ( FT_NUM_MODULE_CLASSES + 1 ) ) )\r\n      return error;\r\n\r\n    /* initialize all pointers to 0, especially the last one */\r\n    for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ )\r\n      classes[i] = 0;\r\n    classes[FT_NUM_MODULE_CLASSES] = 0;\r\n\r\n    i = 0;\r\n\r\n#include FT_CONFIG_MODULES_H\r\n\r\n  Exit:\r\n    if ( error )\r\n      ft_destroy_default_module_classes( library );\r\n    else\r\n      pic_container->default_module_classes = classes;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Add_Default_Modules( FT_Library  library )\r\n  {\r\n    FT_Error                       error;\r\n    const FT_Module_Class* const*  cur;\r\n\r\n\r\n    /* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    if ( !library )\r\n      return;\r\n#endif\r\n\r\n    /* GCC 4.6 warns the type difference:\r\n     *   FT_Module_Class** != const FT_Module_Class* const*\r\n     */\r\n    cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET;\r\n\r\n    /* test for valid `library' delayed to FT_Add_Module() */\r\n    while ( *cur )\r\n    {\r\n      error = FT_Add_Module( library, *cur );\r\n      /* notify errors, but don't stop */\r\n      if ( error )\r\n        FT_TRACE0(( \"FT_Add_Default_Module:\"\r\n                    \" Cannot install `%s', error = 0x%x\\n\",\r\n                    (*cur)->module_name, error ));\r\n      cur++;\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Init_FreeType( FT_Library  *alibrary )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n\r\n    /* First of all, allocate a new system object -- this function is part */\r\n    /* of the system-specific component, i.e. `ftsystem.c'.                */\r\n\r\n    memory = FT_New_Memory();\r\n    if ( !memory )\r\n    {\r\n      FT_ERROR(( \"FT_Init_FreeType: cannot find memory manager\\n\" ));\r\n      return FT_Err_Unimplemented_Feature;\r\n    }\r\n\r\n    /* build a library out of it, then fill it with the set of */\r\n    /* default drivers.                                        */\r\n\r\n    error = FT_New_Library( memory, alibrary );\r\n    if ( error )\r\n      FT_Done_Memory( memory );\r\n    else\r\n      FT_Add_Default_Modules( *alibrary );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Done_FreeType( FT_Library  library )\r\n  {\r\n    if ( library )\r\n    {\r\n      FT_Memory  memory = library->memory;\r\n\r\n\r\n      /* Discard the library object */\r\n      FT_Done_Library( library );\r\n\r\n      /* discard memory manager */\r\n      FT_Done_Memory( memory );\r\n    }\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftlcdfil.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlcdfil.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for color filtering of subpixel bitmap glyphs (body).   */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2008, 2009, 2010 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_LCD_FILTER_H\r\n#include FT_IMAGE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n\r\n/* define USE_LEGACY to implement the legacy filter */\r\n#define  USE_LEGACY\r\n\r\n  /* FIR filter used by the default and light filters */\r\n  static void\r\n  _ft_lcd_filter_fir( FT_Bitmap*      bitmap,\r\n                      FT_Render_Mode  mode,\r\n                      FT_Library      library )\r\n  {\r\n    FT_Byte*  weights = library->lcd_weights;\r\n    FT_UInt   width   = (FT_UInt)bitmap->width;\r\n    FT_UInt   height  = (FT_UInt)bitmap->rows;\r\n\r\n\r\n    /* horizontal in-place FIR filter */\r\n    if ( mode == FT_RENDER_MODE_LCD && width >= 4 )\r\n    {\r\n      FT_Byte*  line = bitmap->buffer;\r\n\r\n\r\n      for ( ; height > 0; height--, line += bitmap->pitch )\r\n      {\r\n        FT_UInt  fir[5];\r\n        FT_UInt  val1, xx;\r\n\r\n\r\n        val1   = line[0];\r\n        fir[0] = weights[2] * val1;\r\n        fir[1] = weights[3] * val1;\r\n        fir[2] = weights[4] * val1;\r\n        fir[3] = 0;\r\n        fir[4] = 0;\r\n\r\n        val1    = line[1];\r\n        fir[0] += weights[1] * val1;\r\n        fir[1] += weights[2] * val1;\r\n        fir[2] += weights[3] * val1;\r\n        fir[3] += weights[4] * val1;\r\n\r\n        for ( xx = 2; xx < width; xx++ )\r\n        {\r\n          FT_UInt  val, pix;\r\n\r\n\r\n          val    = line[xx];\r\n          pix    = fir[0] + weights[0] * val;\r\n          fir[0] = fir[1] + weights[1] * val;\r\n          fir[1] = fir[2] + weights[2] * val;\r\n          fir[2] = fir[3] + weights[3] * val;\r\n          fir[3] =          weights[4] * val;\r\n\r\n          pix        >>= 8;\r\n          pix         |= -( pix >> 8 );\r\n          line[xx - 2] = (FT_Byte)pix;\r\n        }\r\n\r\n        {\r\n          FT_UInt  pix;\r\n\r\n\r\n          pix          = fir[0] >> 8;\r\n          pix         |= -( pix >> 8 );\r\n          line[xx - 2] = (FT_Byte)pix;\r\n\r\n          pix          = fir[1] >> 8;\r\n          pix         |= -( pix >> 8 );\r\n          line[xx - 1] = (FT_Byte)pix;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* vertical in-place FIR filter */\r\n    else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )\r\n    {\r\n      FT_Byte*  column = bitmap->buffer;\r\n      FT_Int    pitch  = bitmap->pitch;\r\n\r\n\r\n      for ( ; width > 0; width--, column++ )\r\n      {\r\n        FT_Byte*  col = column;\r\n        FT_UInt   fir[5];\r\n        FT_UInt   val1, yy;\r\n\r\n\r\n        val1   = col[0];\r\n        fir[0] = weights[2] * val1;\r\n        fir[1] = weights[3] * val1;\r\n        fir[2] = weights[4] * val1;\r\n        fir[3] = 0;\r\n        fir[4] = 0;\r\n        col   += pitch;\r\n\r\n        val1    = col[0];\r\n        fir[0] += weights[1] * val1;\r\n        fir[1] += weights[2] * val1;\r\n        fir[2] += weights[3] * val1;\r\n        fir[3] += weights[4] * val1;\r\n        col    += pitch;\r\n\r\n        for ( yy = 2; yy < height; yy++ )\r\n        {\r\n          FT_UInt  val, pix;\r\n\r\n\r\n          val    = col[0];\r\n          pix    = fir[0] + weights[0] * val;\r\n          fir[0] = fir[1] + weights[1] * val;\r\n          fir[1] = fir[2] + weights[2] * val;\r\n          fir[2] = fir[3] + weights[3] * val;\r\n          fir[3] =          weights[4] * val;\r\n\r\n          pix           >>= 8;\r\n          pix            |= -( pix >> 8 );\r\n          col[-2 * pitch] = (FT_Byte)pix;\r\n          col            += pitch;\r\n        }\r\n\r\n        {\r\n          FT_UInt  pix;\r\n\r\n\r\n          pix             = fir[0] >> 8;\r\n          pix            |= -( pix >> 8 );\r\n          col[-2 * pitch] = (FT_Byte)pix;\r\n\r\n          pix         = fir[1] >> 8;\r\n          pix        |= -( pix >> 8 );\r\n          col[-pitch] = (FT_Byte)pix;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n#ifdef USE_LEGACY\r\n\r\n  /* intra-pixel filter used by the legacy filter */\r\n  static void\r\n  _ft_lcd_filter_legacy( FT_Bitmap*      bitmap,\r\n                         FT_Render_Mode  mode,\r\n                         FT_Library      library )\r\n  {\r\n    FT_UInt  width  = (FT_UInt)bitmap->width;\r\n    FT_UInt  height = (FT_UInt)bitmap->rows;\r\n    FT_Int   pitch  = bitmap->pitch;\r\n\r\n    static const int  filters[3][3] =\r\n    {\r\n      { 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 },\r\n      { 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 },\r\n      { 65538 * 1/13, 65538 * 1/6, 65538 * 9/13 }\r\n    };\r\n\r\n    FT_UNUSED( library );\r\n\r\n\r\n    /* horizontal in-place intra-pixel filter */\r\n    if ( mode == FT_RENDER_MODE_LCD && width >= 3 )\r\n    {\r\n      FT_Byte*  line = bitmap->buffer;\r\n\r\n\r\n      for ( ; height > 0; height--, line += pitch )\r\n      {\r\n        FT_UInt  xx;\r\n\r\n\r\n        for ( xx = 0; xx < width; xx += 3 )\r\n        {\r\n          FT_UInt  r = 0;\r\n          FT_UInt  g = 0;\r\n          FT_UInt  b = 0;\r\n          FT_UInt  p;\r\n\r\n\r\n          p  = line[xx];\r\n          r += filters[0][0] * p;\r\n          g += filters[0][1] * p;\r\n          b += filters[0][2] * p;\r\n\r\n          p  = line[xx + 1];\r\n          r += filters[1][0] * p;\r\n          g += filters[1][1] * p;\r\n          b += filters[1][2] * p;\r\n\r\n          p  = line[xx + 2];\r\n          r += filters[2][0] * p;\r\n          g += filters[2][1] * p;\r\n          b += filters[2][2] * p;\r\n\r\n          line[xx]     = (FT_Byte)( r / 65536 );\r\n          line[xx + 1] = (FT_Byte)( g / 65536 );\r\n          line[xx + 2] = (FT_Byte)( b / 65536 );\r\n        }\r\n      }\r\n    }\r\n    else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 )\r\n    {\r\n      FT_Byte*  column = bitmap->buffer;\r\n\r\n\r\n      for ( ; width > 0; width--, column++ )\r\n      {\r\n        FT_Byte*  col     = column;\r\n        FT_Byte*  col_end = col + height * pitch;\r\n\r\n\r\n        for ( ; col < col_end; col += 3 * pitch )\r\n        {\r\n          FT_UInt  r = 0;\r\n          FT_UInt  g = 0;\r\n          FT_UInt  b = 0;\r\n          FT_UInt  p;\r\n\r\n\r\n          p  = col[0];\r\n          r += filters[0][0] * p;\r\n          g += filters[0][1] * p;\r\n          b += filters[0][2] * p;\r\n\r\n          p  = col[pitch];\r\n          r += filters[1][0] * p;\r\n          g += filters[1][1] * p;\r\n          b += filters[1][2] * p;\r\n\r\n          p  = col[pitch * 2];\r\n          r += filters[2][0] * p;\r\n          g += filters[2][1] * p;\r\n          b += filters[2][2] * p;\r\n\r\n          col[0]         = (FT_Byte)( r / 65536 );\r\n          col[pitch]     = (FT_Byte)( g / 65536 );\r\n          col[2 * pitch] = (FT_Byte)( b / 65536 );\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n#endif /* USE_LEGACY */\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Library_SetLcdFilterWeights( FT_Library      library,\r\n                                  unsigned char  *weights )\r\n  {\r\n    if ( !library || !weights )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    ft_memcpy( library->lcd_weights, weights, 5 );\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Library_SetLcdFilter( FT_Library    library,\r\n                           FT_LcdFilter  filter )\r\n  {\r\n    static const FT_Byte  light_filter[5] =\r\n                            { 0x00, 0x55, 0x56, 0x55, 0x00 };\r\n    /* the values here sum up to a value larger than 256, */\r\n    /* providing a cheap gamma correction                 */\r\n    static const FT_Byte  default_filter[5] =\r\n                            { 0x10, 0x40, 0x70, 0x40, 0x10 };\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    switch ( filter )\r\n    {\r\n    case FT_LCD_FILTER_NONE:\r\n      library->lcd_filter_func = NULL;\r\n      library->lcd_extra       = 0;\r\n      break;\r\n\r\n    case FT_LCD_FILTER_DEFAULT:\r\n#if defined( FT_FORCE_LEGACY_LCD_FILTER )\r\n\r\n      library->lcd_filter_func = _ft_lcd_filter_legacy;\r\n      library->lcd_extra       = 0;\r\n\r\n#elif defined( FT_FORCE_LIGHT_LCD_FILTER )\r\n\r\n      ft_memcpy( library->lcd_weights, light_filter, 5 );\r\n      library->lcd_filter_func = _ft_lcd_filter_fir;\r\n      library->lcd_extra       = 2;\r\n\r\n#else\r\n\r\n      ft_memcpy( library->lcd_weights, default_filter, 5 );\r\n      library->lcd_filter_func = _ft_lcd_filter_fir;\r\n      library->lcd_extra       = 2;\r\n\r\n#endif\r\n\r\n      break;\r\n\r\n    case FT_LCD_FILTER_LIGHT:\r\n      ft_memcpy( library->lcd_weights, light_filter, 5 );\r\n      library->lcd_filter_func = _ft_lcd_filter_fir;\r\n      library->lcd_extra       = 2;\r\n      break;\r\n\r\n#ifdef USE_LEGACY\r\n\r\n    case FT_LCD_FILTER_LEGACY:\r\n      library->lcd_filter_func = _ft_lcd_filter_legacy;\r\n      library->lcd_extra       = 0;\r\n      break;\r\n\r\n#endif\r\n\r\n    default:\r\n      return FT_Err_Invalid_Argument;\r\n    }\r\n\r\n    library->lcd_filter = filter;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Library_SetLcdFilterWeights( FT_Library      library,\r\n                                  unsigned char  *weights )\r\n  {\r\n    FT_UNUSED( library );\r\n    FT_UNUSED( weights );\r\n\r\n    return FT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Library_SetLcdFilter( FT_Library    library,\r\n                           FT_LcdFilter  filter )\r\n  {\r\n    FT_UNUSED( library );\r\n    FT_UNUSED( filter );\r\n\r\n    return FT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftmac.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmac.c                                                                */\r\n/*                                                                         */\r\n/*    Mac FOND support.  Written by just@letterror.com.                    */\r\n/*  Heavily modified by mpsuzuki, George Williams, and Sean McBride.       */\r\n/*                                                                         */\r\n/*  This file is for Mac OS X only; see builds/mac/ftoldmac.c for          */\r\n/*  classic platforms built by MPW.                                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,         */\r\n/*            2009 by                                                      */\r\n/*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*\r\n    Notes\r\n\r\n    Mac suitcase files can (and often do!) contain multiple fonts.  To\r\n    support this I use the face_index argument of FT_(Open|New)_Face()\r\n    functions, and pretend the suitcase file is a collection.\r\n\r\n    Warning: fbit and NFNT bitmap resources are not supported yet.  In old\r\n    sfnt fonts, bitmap glyph data for each size is stored in each `NFNT'\r\n    resources instead of the `bdat' table in the sfnt resource.  Therefore,\r\n    face->num_fixed_sizes is set to 0, because bitmap data in `NFNT'\r\n    resource is unavailable at present.\r\n\r\n    The Mac FOND support works roughly like this:\r\n\r\n    - Check whether the offered stream points to a Mac suitcase file.  This\r\n      is done by checking the file type: it has to be 'FFIL' or 'tfil'.  The\r\n      stream that gets passed to our init_face() routine is a stdio stream,\r\n      which isn't usable for us, since the FOND resources live in the\r\n      resource fork.  So we just grab the stream->pathname field.\r\n\r\n    - Read the FOND resource into memory, then check whether there is a\r\n      TrueType font and/or(!) a Type 1 font available.\r\n\r\n    - If there is a Type 1 font available (as a separate `LWFN' file), read\r\n      its data into memory, massage it slightly so it becomes PFB data, wrap\r\n      it into a memory stream, load the Type 1 driver and delegate the rest\r\n      of the work to it by calling FT_Open_Face().  (XXX TODO: after this\r\n      has been done, the kerning data from the FOND resource should be\r\n      appended to the face: On the Mac there are usually no AFM files\r\n      available.  However, this is tricky since we need to map Mac char\r\n      codes to ps glyph names to glyph ID's...)\r\n\r\n    - If there is a TrueType font (an `sfnt' resource), read it into memory,\r\n      wrap it into a memory stream, load the TrueType driver and delegate\r\n      the rest of the work to it, by calling FT_Open_Face().\r\n\r\n    - Some suitcase fonts (notably Onyx) might point the `LWFN' file to\r\n      itself, even though it doesn't contains `POST' resources.  To handle\r\n      this special case without opening the file an extra time, we just\r\n      ignore errors from the `LWFN' and fallback to the `sfnt' if both are\r\n      available.\r\n  */\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include \"ftbase.h\"\r\n\r\n  /* This is for Mac OS X.  Without redefinition, OS_INLINE */\r\n  /* expands to `static inline' which doesn't survive the   */\r\n  /* -ansi compilation flag of GCC.                         */\r\n#if !HAVE_ANSI_OS_INLINE\r\n#undef  OS_INLINE\r\n#define OS_INLINE  static __inline__\r\n#endif\r\n\r\n  /* `configure' checks the availability of `ResourceIndex' strictly */\r\n  /* and sets HAVE_TYPE_RESOURCE_INDEX 1 or 0 always.  If it is      */\r\n  /* not set (e.g., a build without `configure'), the availability   */\r\n  /* is guessed from the SDK version.                                */\r\n#ifndef HAVE_TYPE_RESOURCE_INDEX\r\n#if !defined( MAC_OS_X_VERSION_10_5 ) || \\\r\n    ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 )\r\n#define HAVE_TYPE_RESOURCE_INDEX 0\r\n#else\r\n#define HAVE_TYPE_RESOURCE_INDEX 1\r\n#endif\r\n#endif /* !HAVE_TYPE_RESOURCE_INDEX */\r\n\r\n#if ( HAVE_TYPE_RESOURCE_INDEX == 0 )\r\n  typedef short  ResourceIndex;\r\n#endif\r\n\r\n#include <CoreServices/CoreServices.h>\r\n#include <ApplicationServices/ApplicationServices.h>\r\n#include <sys/syslimits.h> /* PATH_MAX */\r\n\r\n  /* Don't want warnings about our own use of deprecated functions. */\r\n#define FT_DEPRECATED_ATTRIBUTE\r\n\r\n#include FT_MAC_H\r\n\r\n#ifndef kATSOptionFlagsUnRestrictedScope /* since Mac OS X 10.1 */\r\n#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault\r\n#endif\r\n\r\n\r\n  /* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over\r\n     TrueType in case *both* are available (this is not common,\r\n     but it *is* possible). */\r\n#ifndef PREFER_LWFN\r\n#define PREFER_LWFN  1\r\n#endif\r\n\r\n\r\n#ifdef FT_MACINTOSH\r\n\r\n  /* This function is deprecated because FSSpec is deprecated in Mac OS X  */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_GetFile_From_Mac_Name( const char*  fontName,\r\n                            FSSpec*      pathSpec,\r\n                            FT_Long*     face_index )\r\n  {\r\n    FT_UNUSED( fontName );\r\n    FT_UNUSED( pathSpec );\r\n    FT_UNUSED( face_index );\r\n\r\n    return FT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  /* Private function.                                         */\r\n  /* The FSSpec type has been discouraged for a long time,     */\r\n  /* unfortunately an FSRef replacement API for                */\r\n  /* ATSFontGetFileSpecification() is only available in        */\r\n  /* Mac OS X 10.5 and later.                                  */\r\n  static OSStatus\r\n  FT_ATSFontGetFileReference( ATSFontRef  ats_font_id,\r\n                              FSRef*      ats_font_ref )\r\n  {\r\n#if defined( MAC_OS_X_VERSION_10_5 ) && \\\r\n    ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )\r\n\r\n    OSStatus  err;\r\n\r\n    err = ATSFontGetFileReference( ats_font_id, ats_font_ref );\r\n\r\n    return err;\r\n#elif __LP64__ /* No 64bit Carbon API on legacy platforms */\r\n    FT_UNUSED( ats_font_id );\r\n    FT_UNUSED( ats_font_ref );\r\n\r\n\r\n    return fnfErr;\r\n#else /* 32bit Carbon API on legacy platforms */\r\n    OSStatus  err;\r\n    FSSpec    spec;\r\n\r\n\r\n    err = ATSFontGetFileSpecification( ats_font_id, &spec );\r\n    if ( noErr == err )\r\n      err = FSpMakeFSRef( &spec, ats_font_ref );\r\n\r\n    return err;\r\n#endif\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  FT_GetFileRef_From_Mac_ATS_Name( const char*  fontName,\r\n                                   FSRef*       ats_font_ref,\r\n                                   FT_Long*     face_index )\r\n  {\r\n    CFStringRef  cf_fontName;\r\n    ATSFontRef   ats_font_id;\r\n\r\n\r\n    *face_index = 0;\r\n\r\n    cf_fontName = CFStringCreateWithCString( NULL, fontName,\r\n                                             kCFStringEncodingMacRoman );\r\n    ats_font_id = ATSFontFindFromName( cf_fontName,\r\n                                       kATSOptionFlagsUnRestrictedScope );\r\n    CFRelease( cf_fontName );\r\n\r\n    if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    /* face_index calculation by searching preceding fontIDs */\r\n    /* with same FSRef                                       */\r\n    {\r\n      ATSFontRef  id2 = ats_font_id - 1;\r\n      FSRef       ref2;\r\n\r\n\r\n      while ( id2 > 0 )\r\n      {\r\n        if ( noErr != FT_ATSFontGetFileReference( id2, &ref2 ) )\r\n          break;\r\n        if ( noErr != FSCompareFSRefs( ats_font_ref, &ref2 ) )\r\n          break;\r\n\r\n        id2 --;\r\n      }\r\n      *face_index = ats_font_id - ( id2 + 1 );\r\n    }\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_GetFilePath_From_Mac_ATS_Name( const char*  fontName,\r\n                                    UInt8*       path,\r\n                                    UInt32       maxPathSize,\r\n                                    FT_Long*     face_index )\r\n  {\r\n    FSRef     ref;\r\n    FT_Error  err;\r\n\r\n\r\n    err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index );\r\n    if ( FT_Err_Ok != err )\r\n      return err;\r\n\r\n    if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* This function is deprecated because FSSpec is deprecated in Mac OS X  */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_GetFile_From_Mac_ATS_Name( const char*  fontName,\r\n                                FSSpec*      pathSpec,\r\n                                FT_Long*     face_index )\r\n  {\r\n#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \\\r\n      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )\r\n    FT_UNUSED( fontName );\r\n    FT_UNUSED( pathSpec );\r\n    FT_UNUSED( face_index );\r\n\r\n    return FT_Err_Unimplemented_Feature;\r\n#else\r\n    FSRef     ref;\r\n    FT_Error  err;\r\n\r\n\r\n    err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index );\r\n    if ( FT_Err_Ok != err )\r\n      return err;\r\n\r\n    if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL,\r\n                                    pathSpec, NULL ) )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    return FT_Err_Ok;\r\n#endif\r\n  }\r\n\r\n\r\n  static OSErr\r\n  FT_FSPathMakeRes( const UInt8*    pathname,\r\n                    ResFileRefNum*  res )\r\n  {\r\n    OSErr  err;\r\n    FSRef  ref;\r\n\r\n\r\n    if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    /* at present, no support for dfont format */\r\n    err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res );\r\n    if ( noErr == err )\r\n      return err;\r\n\r\n    /* fallback to original resource-fork font */\r\n    *res = FSOpenResFile( &ref, fsRdPerm );\r\n    err  = ResError();\r\n\r\n    return err;\r\n  }\r\n\r\n\r\n  /* Return the file type for given pathname */\r\n  static OSType\r\n  get_file_type_from_path( const UInt8*  pathname )\r\n  {\r\n    FSRef          ref;\r\n    FSCatalogInfo  info;\r\n\r\n\r\n    if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )\r\n      return ( OSType ) 0;\r\n\r\n    if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoFinderInfo, &info,\r\n                                    NULL, NULL, NULL ) )\r\n      return ( OSType ) 0;\r\n\r\n    return ((FInfo *)(info.finderInfo))->fdType;\r\n  }\r\n\r\n\r\n  /* Given a PostScript font name, create the Macintosh LWFN file name. */\r\n  static void\r\n  create_lwfn_name( char*   ps_name,\r\n                    Str255  lwfn_file_name )\r\n  {\r\n    int       max = 5, count = 0;\r\n    FT_Byte*  p = lwfn_file_name;\r\n    FT_Byte*  q = (FT_Byte*)ps_name;\r\n\r\n\r\n    lwfn_file_name[0] = 0;\r\n\r\n    while ( *q )\r\n    {\r\n      if ( ft_isupper( *q ) )\r\n      {\r\n        if ( count )\r\n          max = 3;\r\n        count = 0;\r\n      }\r\n      if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) )\r\n      {\r\n        *++p = *q;\r\n        lwfn_file_name[0]++;\r\n        count++;\r\n      }\r\n      q++;\r\n    }\r\n  }\r\n\r\n\r\n  static short\r\n  count_faces_sfnt( char*  fond_data )\r\n  {\r\n    /* The count is 1 greater than the value in the FOND.  */\r\n    /* Isn't that cute? :-)                                */\r\n\r\n    return EndianS16_BtoN( *( (short*)( fond_data +\r\n                                        sizeof ( FamRec ) ) ) ) + 1;\r\n  }\r\n\r\n\r\n  static short\r\n  count_faces_scalable( char*  fond_data )\r\n  {\r\n    AsscEntry*  assoc;\r\n    FamRec*     fond;\r\n    short       i, face, face_all;\r\n\r\n\r\n    fond     = (FamRec*)fond_data;\r\n    face_all = EndianS16_BtoN( *( (short *)( fond_data +\r\n                                             sizeof ( FamRec ) ) ) ) + 1;\r\n    assoc    = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );\r\n    face     = 0;\r\n\r\n    for ( i = 0; i < face_all; i++ )\r\n    {\r\n      if ( 0 == EndianS16_BtoN( assoc[i].fontSize ) )\r\n        face++;\r\n    }\r\n    return face;\r\n  }\r\n\r\n\r\n  /* Look inside the FOND data, answer whether there should be an SFNT\r\n     resource, and answer the name of a possible LWFN Type 1 file.\r\n\r\n     Thanks to Paul Miller (paulm@profoundeffects.com) for the fix\r\n     to load a face OTHER than the first one in the FOND!\r\n  */\r\n\r\n\r\n  static void\r\n  parse_fond( char*   fond_data,\r\n              short*  have_sfnt,\r\n              ResID*  sfnt_id,\r\n              Str255  lwfn_file_name,\r\n              short   face_index )\r\n  {\r\n    AsscEntry*  assoc;\r\n    AsscEntry*  base_assoc;\r\n    FamRec*     fond;\r\n\r\n\r\n    *sfnt_id          = 0;\r\n    *have_sfnt        = 0;\r\n    lwfn_file_name[0] = 0;\r\n\r\n    fond       = (FamRec*)fond_data;\r\n    assoc      = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );\r\n    base_assoc = assoc;\r\n\r\n    /* the maximum faces in a FOND is 48, size of StyleTable.indexes[] */\r\n    if ( 47 < face_index )\r\n      return;\r\n\r\n    /* Let's do a little range checking before we get too excited here */\r\n    if ( face_index < count_faces_sfnt( fond_data ) )\r\n    {\r\n      assoc += face_index;        /* add on the face_index! */\r\n\r\n      /* if the face at this index is not scalable,\r\n         fall back to the first one (old behavior) */\r\n      if ( EndianS16_BtoN( assoc->fontSize ) == 0 )\r\n      {\r\n        *have_sfnt = 1;\r\n        *sfnt_id   = EndianS16_BtoN( assoc->fontID );\r\n      }\r\n      else if ( base_assoc->fontSize == 0 )\r\n      {\r\n        *have_sfnt = 1;\r\n        *sfnt_id   = EndianS16_BtoN( base_assoc->fontID );\r\n      }\r\n    }\r\n\r\n    if ( EndianS32_BtoN( fond->ffStylOff ) )\r\n    {\r\n      unsigned char*  p = (unsigned char*)fond_data;\r\n      StyleTable*     style;\r\n      unsigned short  string_count;\r\n      char            ps_name[256];\r\n      unsigned char*  names[64];\r\n      int             i;\r\n\r\n\r\n      p += EndianS32_BtoN( fond->ffStylOff );\r\n      style = (StyleTable*)p;\r\n      p += sizeof ( StyleTable );\r\n      string_count = EndianS16_BtoN( *(short*)(p) );\r\n      p += sizeof ( short );\r\n\r\n      for ( i = 0; i < string_count && i < 64; i++ )\r\n      {\r\n        names[i] = p;\r\n        p       += names[i][0];\r\n        p++;\r\n      }\r\n\r\n      {\r\n        size_t  ps_name_len = (size_t)names[0][0];\r\n\r\n\r\n        if ( ps_name_len != 0 )\r\n        {\r\n          ft_memcpy(ps_name, names[0] + 1, ps_name_len);\r\n          ps_name[ps_name_len] = 0;\r\n        }\r\n        if ( style->indexes[face_index] > 1 &&\r\n             style->indexes[face_index] <= FT_MIN( string_count, 64 ) )\r\n        {\r\n          unsigned char*  suffixes = names[style->indexes[face_index] - 1];\r\n\r\n\r\n          for ( i = 1; i <= suffixes[0]; i++ )\r\n          {\r\n            unsigned char*  s;\r\n            size_t          j = suffixes[i] - 1;\r\n\r\n\r\n            if ( j < string_count && ( s = names[j] ) != NULL )\r\n            {\r\n              size_t  s_len = (size_t)s[0];\r\n\r\n\r\n              if ( s_len != 0 && ps_name_len + s_len < sizeof ( ps_name ) )\r\n              {\r\n                ft_memcpy( ps_name + ps_name_len, s + 1, s_len );\r\n                ps_name_len += s_len;\r\n                ps_name[ps_name_len] = 0;\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      create_lwfn_name( ps_name, lwfn_file_name );\r\n    }\r\n  }\r\n\r\n\r\n  static  FT_Error\r\n  lookup_lwfn_by_fond( const UInt8*      path_fond,\r\n                       ConstStr255Param  base_lwfn,\r\n                       UInt8*            path_lwfn,\r\n                       size_t            path_size )\r\n  {\r\n    FSRef   ref, par_ref;\r\n    size_t  dirname_len;\r\n\r\n\r\n    /* Pathname for FSRef can be in various formats: HFS, HFS+, and POSIX. */\r\n    /* We should not extract parent directory by string manipulation.      */\r\n\r\n    if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,\r\n                                    NULL, NULL, NULL, &par_ref ) )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* now we have absolute dirname in path_lwfn */\r\n    ft_strcat( (char *)path_lwfn, \"/\" );\r\n    dirname_len = ft_strlen( (char *)path_lwfn );\r\n    ft_strcat( (char *)path_lwfn, (char *)base_lwfn + 1 );\r\n    path_lwfn[dirname_len + base_lwfn[0]] = '\\0';\r\n\r\n    if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,\r\n                                    NULL, NULL, NULL, NULL ) )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static short\r\n  count_faces( Handle        fond,\r\n               const UInt8*  pathname )\r\n  {\r\n    ResID     sfnt_id;\r\n    short     have_sfnt, have_lwfn;\r\n    Str255    lwfn_file_name;\r\n    UInt8     buff[PATH_MAX];\r\n    FT_Error  err;\r\n    short     num_faces;\r\n\r\n\r\n    have_sfnt = have_lwfn = 0;\r\n\r\n    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );\r\n\r\n    if ( lwfn_file_name[0] )\r\n    {\r\n      err = lookup_lwfn_by_fond( pathname, lwfn_file_name,\r\n                                 buff, sizeof ( buff )  );\r\n      if ( FT_Err_Ok == err )\r\n        have_lwfn = 1;\r\n    }\r\n\r\n    if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )\r\n      num_faces = 1;\r\n    else\r\n      num_faces = count_faces_scalable( *fond );\r\n\r\n    return num_faces;\r\n  }\r\n\r\n\r\n  /* Read Type 1 data from the POST resources inside the LWFN file,\r\n     return a PFB buffer.  This is somewhat convoluted because the FT2\r\n     PFB parser wants the ASCII header as one chunk, and the LWFN\r\n     chunks are often not organized that way, so we glue chunks\r\n     of the same type together. */\r\n  static FT_Error\r\n  read_lwfn( FT_Memory      memory,\r\n             ResFileRefNum  res,\r\n             FT_Byte**      pfb_data,\r\n             FT_ULong*      size )\r\n  {\r\n    FT_Error       error = FT_Err_Ok;\r\n    ResID          res_id;\r\n    unsigned char  *buffer, *p, *size_p = NULL;\r\n    FT_ULong       total_size = 0;\r\n    FT_ULong       old_total_size = 0;\r\n    FT_ULong       post_size, pfb_chunk_size;\r\n    Handle         post_data;\r\n    char           code, last_code;\r\n\r\n\r\n    UseResFile( res );\r\n\r\n    /* First pass: load all POST resources, and determine the size of */\r\n    /* the output buffer.                                             */\r\n    res_id    = 501;\r\n    last_code = -1;\r\n\r\n    for (;;)\r\n    {\r\n      post_data = Get1Resource( TTAG_POST, res_id++ );\r\n      if ( post_data == NULL )\r\n        break;  /* we are done */\r\n\r\n      code = (*post_data)[0];\r\n\r\n      if ( code != last_code )\r\n      {\r\n        if ( code == 5 )\r\n          total_size += 2; /* just the end code */\r\n        else\r\n          total_size += 6; /* code + 4 bytes chunk length */\r\n      }\r\n\r\n      total_size += GetHandleSize( post_data ) - 2;\r\n      last_code = code;\r\n\r\n      /* detect integer overflows */\r\n      if ( total_size < old_total_size )\r\n      {\r\n        error = FT_Err_Array_Too_Large;\r\n        goto Error;\r\n      }\r\n\r\n      old_total_size = total_size;\r\n    }\r\n\r\n    if ( FT_ALLOC( buffer, (FT_Long)total_size ) )\r\n      goto Error;\r\n\r\n    /* Second pass: append all POST data to the buffer, add PFB fields. */\r\n    /* Glue all consecutive chunks of the same type together.           */\r\n    p              = buffer;\r\n    res_id         = 501;\r\n    last_code      = -1;\r\n    pfb_chunk_size = 0;\r\n\r\n    for (;;)\r\n    {\r\n      post_data = Get1Resource( TTAG_POST, res_id++ );\r\n      if ( post_data == NULL )\r\n        break;  /* we are done */\r\n\r\n      post_size = (FT_ULong)GetHandleSize( post_data ) - 2;\r\n      code = (*post_data)[0];\r\n\r\n      if ( code != last_code )\r\n      {\r\n        if ( last_code != -1 )\r\n        {\r\n          /* we are done adding a chunk, fill in the size field */\r\n          if ( size_p != NULL )\r\n          {\r\n            *size_p++ = (FT_Byte)(   pfb_chunk_size         & 0xFF );\r\n            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 8  ) & 0xFF );\r\n            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 16 ) & 0xFF );\r\n            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 24 ) & 0xFF );\r\n          }\r\n          pfb_chunk_size = 0;\r\n        }\r\n\r\n        *p++ = 0x80;\r\n        if ( code == 5 )\r\n          *p++ = 0x03;  /* the end */\r\n        else if ( code == 2 )\r\n          *p++ = 0x02;  /* binary segment */\r\n        else\r\n          *p++ = 0x01;  /* ASCII segment */\r\n\r\n        if ( code != 5 )\r\n        {\r\n          size_p = p;   /* save for later */\r\n          p += 4;       /* make space for size field */\r\n        }\r\n      }\r\n\r\n      ft_memcpy( p, *post_data + 2, post_size );\r\n      pfb_chunk_size += post_size;\r\n      p += post_size;\r\n      last_code = code;\r\n    }\r\n\r\n    *pfb_data = buffer;\r\n    *size = total_size;\r\n\r\n  Error:\r\n    CloseResFile( res );\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Create a new FT_Face from a file path to an LWFN file. */\r\n  static FT_Error\r\n  FT_New_Face_From_LWFN( FT_Library    library,\r\n                         const UInt8*  pathname,\r\n                         FT_Long       face_index,\r\n                         FT_Face*      aface )\r\n  {\r\n    FT_Byte*       pfb_data;\r\n    FT_ULong       pfb_size;\r\n    FT_Error       error;\r\n    ResFileRefNum  res;\r\n\r\n\r\n    if ( noErr != FT_FSPathMakeRes( pathname, &res ) )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    pfb_data = NULL;\r\n    pfb_size = 0;\r\n    error = read_lwfn( library->memory, res, &pfb_data, &pfb_size );\r\n    CloseResFile( res ); /* PFB is already loaded, useless anymore */\r\n    if ( error )\r\n      return error;\r\n\r\n    return open_face_from_buffer( library,\r\n                                  pfb_data,\r\n                                  pfb_size,\r\n                                  face_index,\r\n                                  \"type1\",\r\n                                  aface );\r\n  }\r\n\r\n\r\n  /* Create a new FT_Face from an SFNT resource, specified by res ID. */\r\n  static FT_Error\r\n  FT_New_Face_From_SFNT( FT_Library  library,\r\n                         ResID       sfnt_id,\r\n                         FT_Long     face_index,\r\n                         FT_Face*    aface )\r\n  {\r\n    Handle     sfnt = NULL;\r\n    FT_Byte*   sfnt_data;\r\n    size_t     sfnt_size;\r\n    FT_Error   error  = FT_Err_Ok;\r\n    FT_Memory  memory = library->memory;\r\n    int        is_cff, is_sfnt_ps;\r\n\r\n\r\n    sfnt = GetResource( TTAG_sfnt, sfnt_id );\r\n    if ( sfnt == NULL )\r\n      return FT_Err_Invalid_Handle;\r\n\r\n    sfnt_size = (FT_ULong)GetHandleSize( sfnt );\r\n    if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )\r\n    {\r\n      ReleaseResource( sfnt );\r\n      return error;\r\n    }\r\n\r\n    ft_memcpy( sfnt_data, *sfnt, sfnt_size );\r\n    ReleaseResource( sfnt );\r\n\r\n    is_cff     = sfnt_size > 4 && !ft_memcmp( sfnt_data, \"OTTO\", 4 );\r\n    is_sfnt_ps = sfnt_size > 4 && !ft_memcmp( sfnt_data, \"typ1\", 4 );\r\n\r\n    if ( is_sfnt_ps )\r\n    {\r\n      FT_Stream  stream;\r\n\r\n\r\n      if ( FT_NEW( stream ) )\r\n        goto Try_OpenType;\r\n\r\n      FT_Stream_OpenMemory( stream, sfnt_data, sfnt_size );\r\n      if ( !open_face_PS_from_sfnt_stream( library,\r\n                                           stream,\r\n                                           face_index,\r\n                                           0, NULL,\r\n                                           aface ) )\r\n      {\r\n        FT_Stream_Close( stream );\r\n        FT_FREE( stream );\r\n        FT_FREE( sfnt_data );\r\n        goto Exit;\r\n      }\r\n\r\n      FT_FREE( stream );\r\n    }\r\n  Try_OpenType:\r\n    error = open_face_from_buffer( library,\r\n                                   sfnt_data,\r\n                                   sfnt_size,\r\n                                   face_index,\r\n                                   is_cff ? \"cff\" : \"truetype\",\r\n                                   aface );\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Create a new FT_Face from a file path to a suitcase file. */\r\n  static FT_Error\r\n  FT_New_Face_From_Suitcase( FT_Library    library,\r\n                             const UInt8*  pathname,\r\n                             FT_Long       face_index,\r\n                             FT_Face*      aface )\r\n  {\r\n    FT_Error       error = FT_Err_Cannot_Open_Resource;\r\n    ResFileRefNum  res_ref;\r\n    ResourceIndex  res_index;\r\n    Handle         fond;\r\n    short          num_faces_in_res, num_faces_in_fond;\r\n\r\n\r\n    if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    UseResFile( res_ref );\r\n    if ( ResError() )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    num_faces_in_res = 0;\r\n    for ( res_index = 1; ; ++res_index )\r\n    {\r\n      fond = Get1IndResource( TTAG_FOND, res_index );\r\n      if ( ResError() )\r\n        break;\r\n\r\n      num_faces_in_fond  = count_faces( fond, pathname );\r\n      num_faces_in_res  += num_faces_in_fond;\r\n\r\n      if ( 0 <= face_index && face_index < num_faces_in_fond && error )\r\n        error = FT_New_Face_From_FOND( library, fond, face_index, aface );\r\n\r\n      face_index -= num_faces_in_fond;\r\n    }\r\n\r\n    CloseResFile( res_ref );\r\n    if ( FT_Err_Ok == error && NULL != aface && NULL != *aface )\r\n      (*aface)->num_faces = num_faces_in_res;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmac.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Face_From_FOND( FT_Library  library,\r\n                         Handle      fond,\r\n                         FT_Long     face_index,\r\n                         FT_Face*    aface )\r\n  {\r\n    short     have_sfnt, have_lwfn = 0;\r\n    ResID     sfnt_id, fond_id;\r\n    OSType    fond_type;\r\n    Str255    fond_name;\r\n    Str255    lwfn_file_name;\r\n    UInt8     path_lwfn[PATH_MAX];\r\n    OSErr     err;\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n\r\n    GetResInfo( fond, &fond_id, &fond_type, fond_name );\r\n    if ( ResError() != noErr || fond_type != TTAG_FOND )\r\n      return FT_Err_Invalid_File_Format;\r\n\r\n    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );\r\n\r\n    if ( lwfn_file_name[0] )\r\n    {\r\n      ResFileRefNum  res;\r\n\r\n\r\n      res = HomeResFile( fond );\r\n      if ( noErr != ResError() )\r\n        goto found_no_lwfn_file;\r\n\r\n      {\r\n        UInt8  path_fond[PATH_MAX];\r\n        FSRef  ref;\r\n\r\n\r\n        err = FSGetForkCBInfo( res, kFSInvalidVolumeRefNum,\r\n                               NULL, NULL, NULL, &ref, NULL );\r\n        if ( noErr != err )\r\n          goto found_no_lwfn_file;\r\n\r\n        err = FSRefMakePath( &ref, path_fond, sizeof ( path_fond ) );\r\n        if ( noErr != err )\r\n          goto found_no_lwfn_file;\r\n\r\n        error = lookup_lwfn_by_fond( path_fond, lwfn_file_name,\r\n                                     path_lwfn, sizeof ( path_lwfn ) );\r\n        if ( FT_Err_Ok == error )\r\n          have_lwfn = 1;\r\n      }\r\n    }\r\n\r\n    if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )\r\n      error = FT_New_Face_From_LWFN( library,\r\n                                     path_lwfn,\r\n                                     face_index,\r\n                                     aface );\r\n    else\r\n      error = FT_Err_Unknown_File_Format;\r\n\r\n  found_no_lwfn_file:\r\n    if ( have_sfnt && FT_Err_Ok != error )\r\n      error = FT_New_Face_From_SFNT( library,\r\n                                     sfnt_id,\r\n                                     face_index,\r\n                                     aface );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Common function to load a new FT_Face from a resource file. */\r\n  static FT_Error\r\n  FT_New_Face_From_Resource( FT_Library    library,\r\n                             const UInt8*  pathname,\r\n                             FT_Long       face_index,\r\n                             FT_Face*      aface )\r\n  {\r\n    OSType    file_type;\r\n    FT_Error  error;\r\n\r\n\r\n    /* LWFN is a (very) specific file format, check for it explicitly */\r\n    file_type = get_file_type_from_path( pathname );\r\n    if ( file_type == TTAG_LWFN )\r\n      return FT_New_Face_From_LWFN( library, pathname, face_index, aface );\r\n\r\n    /* Otherwise the file type doesn't matter (there are more than  */\r\n    /* `FFIL' and `tfil').  Just try opening it as a font suitcase; */\r\n    /* if it works, fine.                                           */\r\n\r\n    error = FT_New_Face_From_Suitcase( library, pathname, face_index, aface );\r\n    if ( error == 0 )\r\n      return error;\r\n\r\n    /* let it fall through to normal loader (.ttf, .otf, etc.); */\r\n    /* we signal this by returning no error and no FT_Face      */\r\n    *aface = NULL;\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is the Mac-specific implementation of FT_New_Face.  In        */\r\n  /*    addition to the standard FT_New_Face() functionality, it also      */\r\n  /*    accepts pathnames to Mac suitcase files.  For further              */\r\n  /*    documentation see the original FT_New_Face() in freetype.h.        */\r\n  /*                                                                       */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Face( FT_Library   library,\r\n               const char*  pathname,\r\n               FT_Long      face_index,\r\n               FT_Face*     aface )\r\n  {\r\n    FT_Open_Args  args;\r\n    FT_Error      error;\r\n\r\n\r\n    /* test for valid `library' and `aface' delayed to FT_Open_Face() */\r\n    if ( !pathname )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    error  = FT_Err_Ok;\r\n    *aface = NULL;\r\n\r\n    /* try resourcefork based font: LWFN, FFIL */\r\n    error = FT_New_Face_From_Resource( library, (UInt8 *)pathname,\r\n                                       face_index, aface );\r\n    if ( error != 0 || *aface != NULL )\r\n      return error;\r\n\r\n    /* let it fall through to normal loader (.ttf, .otf, etc.) */\r\n    args.flags    = FT_OPEN_PATHNAME;\r\n    args.pathname = (char*)pathname;\r\n    return FT_Open_Face( library, &args, face_index, aface );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FSRef                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FT_New_Face_From_FSRef is identical to FT_New_Face except it       */\r\n  /*    accepts an FSRef instead of a path.                                */\r\n  /*                                                                       */\r\n  /* This function is deprecated because Carbon data types (FSRef)         */\r\n  /* are not cross-platform, and thus not suitable for the freetype API.   */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Face_From_FSRef( FT_Library    library,\r\n                          const FSRef*  ref,\r\n                          FT_Long       face_index,\r\n                          FT_Face*      aface )\r\n  {\r\n    FT_Error      error;\r\n    FT_Open_Args  args;\r\n    OSErr   err;\r\n    UInt8   pathname[PATH_MAX];\r\n\r\n\r\n    if ( !ref )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    err = FSRefMakePath( ref, pathname, sizeof ( pathname ) );\r\n    if ( err )\r\n      error = FT_Err_Cannot_Open_Resource;\r\n\r\n    error = FT_New_Face_From_Resource( library, pathname, face_index, aface );\r\n    if ( error != 0 || *aface != NULL )\r\n      return error;\r\n\r\n    /* fallback to datafork font */\r\n    args.flags    = FT_OPEN_PATHNAME;\r\n    args.pathname = (char*)pathname;\r\n    return FT_Open_Face( library, &args, face_index, aface );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FSSpec                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FT_New_Face_From_FSSpec is identical to FT_New_Face except it      */\r\n  /*    accepts an FSSpec instead of a path.                               */\r\n  /*                                                                       */\r\n  /* This function is deprecated because FSSpec is deprecated in Mac OS X  */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Face_From_FSSpec( FT_Library     library,\r\n                           const FSSpec*  spec,\r\n                           FT_Long        face_index,\r\n                           FT_Face*       aface )\r\n  {\r\n#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \\\r\n      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )\r\n    FT_UNUSED( library );\r\n    FT_UNUSED( spec );\r\n    FT_UNUSED( face_index );\r\n    FT_UNUSED( aface );\r\n\r\n    return FT_Err_Unimplemented_Feature;\r\n#else\r\n    FSRef  ref;\r\n\r\n\r\n    if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )\r\n      return FT_Err_Invalid_Argument;\r\n    else\r\n      return FT_New_Face_From_FSRef( library, &ref, face_index, aface );\r\n#endif\r\n  }\r\n\r\n#endif /* FT_MACINTOSH */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftmm.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmm.c                                                                 */\r\n/*                                                                         */\r\n/*    Multiple Master font support (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2004, 2009 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MULTIPLE_MASTERS_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_MULTIPLE_MASTERS_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_mm\r\n\r\n\r\n  static FT_Error\r\n  ft_face_get_mm_service( FT_Face                   face,\r\n                          FT_Service_MultiMasters  *aservice )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    *aservice = NULL;\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    error = FT_Err_Invalid_Argument;\r\n\r\n    if ( FT_HAS_MULTIPLE_MASTERS( face ) )\r\n    {\r\n      FT_FACE_LOOKUP_SERVICE( face,\r\n                              *aservice,\r\n                              MULTI_MASTERS );\r\n\r\n      if ( *aservice )\r\n        error = FT_Err_Ok;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmm.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Multi_Master( FT_Face           face,\r\n                       FT_Multi_Master  *amaster )\r\n  {\r\n    FT_Error                 error;\r\n    FT_Service_MultiMasters  service;\r\n\r\n\r\n    error = ft_face_get_mm_service( face, &service );\r\n    if ( !error )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      if ( service->get_mm )\r\n        error = service->get_mm( face, amaster );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmm.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_MM_Var( FT_Face      face,\r\n                 FT_MM_Var*  *amaster )\r\n  {\r\n    FT_Error                 error;\r\n    FT_Service_MultiMasters  service;\r\n\r\n\r\n    error = ft_face_get_mm_service( face, &service );\r\n    if ( !error )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      if ( service->get_mm_var )\r\n        error = service->get_mm_var( face, amaster );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmm.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_MM_Design_Coordinates( FT_Face   face,\r\n                                FT_UInt   num_coords,\r\n                                FT_Long*  coords )\r\n  {\r\n    FT_Error                 error;\r\n    FT_Service_MultiMasters  service;\r\n\r\n\r\n    error = ft_face_get_mm_service( face, &service );\r\n    if ( !error )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      if ( service->set_mm_design )\r\n        error = service->set_mm_design( face, num_coords, coords );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmm.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_Var_Design_Coordinates( FT_Face    face,\r\n                                 FT_UInt    num_coords,\r\n                                 FT_Fixed*  coords )\r\n  {\r\n    FT_Error                 error;\r\n    FT_Service_MultiMasters  service;\r\n\r\n\r\n    error = ft_face_get_mm_service( face, &service );\r\n    if ( !error )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      if ( service->set_var_design )\r\n        error = service->set_var_design( face, num_coords, coords );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmm.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_MM_Blend_Coordinates( FT_Face    face,\r\n                               FT_UInt    num_coords,\r\n                               FT_Fixed*  coords )\r\n  {\r\n    FT_Error                 error;\r\n    FT_Service_MultiMasters  service;\r\n\r\n\r\n    error = ft_face_get_mm_service( face, &service );\r\n    if ( !error )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      if ( service->set_mm_blend )\r\n         error = service->set_mm_blend( face, num_coords, coords );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmm.h */\r\n\r\n  /* This is exactly the same as the previous function.  It exists for */\r\n  /* orthogonality.                                                    */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_Var_Blend_Coordinates( FT_Face    face,\r\n                                FT_UInt    num_coords,\r\n                                FT_Fixed*  coords )\r\n  {\r\n    FT_Error                 error;\r\n    FT_Service_MultiMasters  service;\r\n\r\n\r\n    error = ft_face_get_mm_service( face, &service );\r\n    if ( !error )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      if ( service->set_mm_blend )\r\n         error = service->set_mm_blend( face, num_coords, coords );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftobjs.c                                                               */\r\n/*                                                                         */\r\n/*    The FreeType private base classes (body).                            */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_LIST_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_VALIDATE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_RFORK_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H    /* for SFNT_Load_Table_Func */\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n#include FT_SERVICE_PROPERTIES_H\r\n#include FT_SERVICE_SFNT_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n#include FT_SERVICE_TT_CMAP_H\r\n#include FT_SERVICE_KERNING_H\r\n#include FT_SERVICE_TRUETYPE_ENGINE_H\r\n\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n#include \"ftbase.h\"\r\n#endif\r\n\r\n#define GRID_FIT_METRICS\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_service_list_lookup( FT_ServiceDesc  service_descriptors,\r\n                          const char*     service_id )\r\n  {\r\n    FT_Pointer      result = NULL;\r\n    FT_ServiceDesc  desc   = service_descriptors;\r\n\r\n\r\n    if ( desc && service_id )\r\n    {\r\n      for ( ; desc->serv_id != NULL; desc++ )\r\n      {\r\n        if ( ft_strcmp( desc->serv_id, service_id ) == 0 )\r\n        {\r\n          result = (FT_Pointer)desc->serv_data;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_validator_init( FT_Validator        valid,\r\n                     const FT_Byte*      base,\r\n                     const FT_Byte*      limit,\r\n                     FT_ValidationLevel  level )\r\n  {\r\n    valid->base  = base;\r\n    valid->limit = limit;\r\n    valid->level = level;\r\n    valid->error = FT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Int )\r\n  ft_validator_run( FT_Validator  valid )\r\n  {\r\n    /* This function doesn't work!  None should call it. */\r\n    FT_UNUSED( valid );\r\n\r\n    return -1;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_validator_error( FT_Validator  valid,\r\n                      FT_Error      error )\r\n  {\r\n    /* since the cast below also disables the compiler's */\r\n    /* type check, we introduce a dummy variable, which  */\r\n    /* will be optimized away                            */\r\n    volatile ft_jmp_buf* jump_buffer = &valid->jump_buffer;\r\n\r\n\r\n    valid->error = error;\r\n\r\n    /* throw away volatileness; use `jump_buffer' or the  */\r\n    /* compiler may warn about an unused local variable   */\r\n    ft_longjmp( *(ft_jmp_buf*) jump_buffer, 1 );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                           S T R E A M                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* create a new input stream from an FT_Open_Args structure */\r\n  /*                                                          */\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_New( FT_Library           library,\r\n                 const FT_Open_Args*  args,\r\n                 FT_Stream           *astream )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n    FT_Stream  stream = NULL;\r\n\r\n\r\n    *astream = 0;\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !args )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    memory = library->memory;\r\n\r\n    if ( FT_NEW( stream ) )\r\n      goto Exit;\r\n\r\n    stream->memory = memory;\r\n\r\n    if ( args->flags & FT_OPEN_MEMORY )\r\n    {\r\n      /* create a memory-based stream */\r\n      FT_Stream_OpenMemory( stream,\r\n                            (const FT_Byte*)args->memory_base,\r\n                            args->memory_size );\r\n    }\r\n\r\n#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT\r\n\r\n    else if ( args->flags & FT_OPEN_PATHNAME )\r\n    {\r\n      /* create a normal system stream */\r\n      error = FT_Stream_Open( stream, args->pathname );\r\n      stream->pathname.pointer = args->pathname;\r\n    }\r\n    else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )\r\n    {\r\n      /* use an existing, user-provided stream */\r\n\r\n      /* in this case, we do not need to allocate a new stream object */\r\n      /* since the caller is responsible for closing it himself       */\r\n      FT_FREE( stream );\r\n      stream = args->stream;\r\n    }\r\n\r\n#endif\r\n\r\n    else\r\n      error = FT_Err_Invalid_Argument;\r\n\r\n    if ( error )\r\n      FT_FREE( stream );\r\n    else\r\n      stream->memory = memory;  /* just to be certain */\r\n\r\n    *astream = stream;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Stream_Free( FT_Stream  stream,\r\n                  FT_Int     external )\r\n  {\r\n    if ( stream )\r\n    {\r\n      FT_Memory  memory = stream->memory;\r\n\r\n\r\n      FT_Stream_Close( stream );\r\n\r\n      if ( !external )\r\n        FT_FREE( stream );\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_objs\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****               FACE, SIZE & GLYPH SLOT OBJECTS                   ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  static FT_Error\r\n  ft_glyphslot_init( FT_GlyphSlot  slot )\r\n  {\r\n    FT_Driver         driver   = slot->face->driver;\r\n    FT_Driver_Class   clazz    = driver->clazz;\r\n    FT_Memory         memory   = driver->root.memory;\r\n    FT_Error          error    = FT_Err_Ok;\r\n    FT_Slot_Internal  internal = NULL;\r\n\r\n\r\n    slot->library = driver->root.library;\r\n\r\n    if ( FT_NEW( internal ) )\r\n      goto Exit;\r\n\r\n    slot->internal = internal;\r\n\r\n    if ( FT_DRIVER_USES_OUTLINES( driver ) )\r\n      error = FT_GlyphLoader_New( memory, &internal->loader );\r\n\r\n    if ( !error && clazz->init_slot )\r\n      error = clazz->init_slot( slot );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_glyphslot_free_bitmap( FT_GlyphSlot  slot )\r\n  {\r\n    if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )\r\n    {\r\n      FT_Memory  memory = FT_FACE_MEMORY( slot->face );\r\n\r\n\r\n      FT_FREE( slot->bitmap.buffer );\r\n      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;\r\n    }\r\n    else\r\n    {\r\n      /* assume that the bitmap buffer was stolen or not */\r\n      /* allocated from the heap                         */\r\n      slot->bitmap.buffer = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,\r\n                           FT_Byte*      buffer )\r\n  {\r\n    ft_glyphslot_free_bitmap( slot );\r\n\r\n    slot->bitmap.buffer = buffer;\r\n\r\n    FT_ASSERT( (slot->internal->flags & FT_GLYPH_OWN_BITMAP) == 0 );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,\r\n                             FT_ULong      size )\r\n  {\r\n    FT_Memory  memory = FT_FACE_MEMORY( slot->face );\r\n    FT_Error   error;\r\n\r\n\r\n    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )\r\n      FT_FREE( slot->bitmap.buffer );\r\n    else\r\n      slot->internal->flags |= FT_GLYPH_OWN_BITMAP;\r\n\r\n    (void)FT_ALLOC( slot->bitmap.buffer, size );\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_glyphslot_clear( FT_GlyphSlot  slot )\r\n  {\r\n    /* free bitmap if needed */\r\n    ft_glyphslot_free_bitmap( slot );\r\n\r\n    /* clear all public fields in the glyph slot */\r\n    FT_ZERO( &slot->metrics );\r\n    FT_ZERO( &slot->outline );\r\n\r\n    slot->bitmap.width      = 0;\r\n    slot->bitmap.rows       = 0;\r\n    slot->bitmap.pitch      = 0;\r\n    slot->bitmap.pixel_mode = 0;\r\n    /* `slot->bitmap.buffer' has been handled by ft_glyphslot_free_bitmap */\r\n\r\n    slot->bitmap_left   = 0;\r\n    slot->bitmap_top    = 0;\r\n    slot->num_subglyphs = 0;\r\n    slot->subglyphs     = 0;\r\n    slot->control_data  = 0;\r\n    slot->control_len   = 0;\r\n    slot->other         = 0;\r\n    slot->format        = FT_GLYPH_FORMAT_NONE;\r\n\r\n    slot->linearHoriAdvance = 0;\r\n    slot->linearVertAdvance = 0;\r\n    slot->lsb_delta         = 0;\r\n    slot->rsb_delta         = 0;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_glyphslot_done( FT_GlyphSlot  slot )\r\n  {\r\n    FT_Driver        driver = slot->face->driver;\r\n    FT_Driver_Class  clazz  = driver->clazz;\r\n    FT_Memory        memory = driver->root.memory;\r\n\r\n\r\n    if ( clazz->done_slot )\r\n      clazz->done_slot( slot );\r\n\r\n    /* free bitmap buffer if needed */\r\n    ft_glyphslot_free_bitmap( slot );\r\n\r\n    /* slot->internal might be NULL in out-of-memory situations */\r\n    if ( slot->internal )\r\n    {\r\n      /* free glyph loader */\r\n      if ( FT_DRIVER_USES_OUTLINES( driver ) )\r\n      {\r\n        FT_GlyphLoader_Done( slot->internal->loader );\r\n        slot->internal->loader = 0;\r\n      }\r\n\r\n      FT_FREE( slot->internal );\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_New_GlyphSlot( FT_Face        face,\r\n                    FT_GlyphSlot  *aslot )\r\n  {\r\n    FT_Error         error;\r\n    FT_Driver        driver;\r\n    FT_Driver_Class  clazz;\r\n    FT_Memory        memory;\r\n    FT_GlyphSlot     slot = NULL;\r\n\r\n\r\n    if ( !face || !face->driver )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    driver = face->driver;\r\n    clazz  = driver->clazz;\r\n    memory = driver->root.memory;\r\n\r\n    FT_TRACE4(( \"FT_New_GlyphSlot: Creating new slot object\\n\" ));\r\n    if ( !FT_ALLOC( slot, clazz->slot_object_size ) )\r\n    {\r\n      slot->face = face;\r\n\r\n      error = ft_glyphslot_init( slot );\r\n      if ( error )\r\n      {\r\n        ft_glyphslot_done( slot );\r\n        FT_FREE( slot );\r\n        goto Exit;\r\n      }\r\n\r\n      slot->next  = face->glyph;\r\n      face->glyph = slot;\r\n\r\n      if ( aslot )\r\n        *aslot = slot;\r\n    }\r\n    else if ( aslot )\r\n      *aslot = 0;\r\n\r\n\r\n  Exit:\r\n    FT_TRACE4(( \"FT_New_GlyphSlot: Return %d\\n\", error ));\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Done_GlyphSlot( FT_GlyphSlot  slot )\r\n  {\r\n    if ( slot )\r\n    {\r\n      FT_Driver     driver = slot->face->driver;\r\n      FT_Memory     memory = driver->root.memory;\r\n      FT_GlyphSlot  prev;\r\n      FT_GlyphSlot  cur;\r\n\r\n\r\n      /* Remove slot from its parent face's list */\r\n      prev = NULL;\r\n      cur  = slot->face->glyph;\r\n\r\n      while ( cur )\r\n      {\r\n        if ( cur == slot )\r\n        {\r\n          if ( !prev )\r\n            slot->face->glyph = cur->next;\r\n          else\r\n            prev->next = cur->next;\r\n\r\n          /* finalize client-specific data */\r\n          if ( slot->generic.finalizer )\r\n            slot->generic.finalizer( slot );\r\n\r\n          ft_glyphslot_done( slot );\r\n          FT_FREE( slot );\r\n          break;\r\n        }\r\n        prev = cur;\r\n        cur  = cur->next;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Set_Transform( FT_Face     face,\r\n                    FT_Matrix*  matrix,\r\n                    FT_Vector*  delta )\r\n  {\r\n    FT_Face_Internal  internal;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    internal = face->internal;\r\n\r\n    internal->transform_flags = 0;\r\n\r\n    if ( !matrix )\r\n    {\r\n      internal->transform_matrix.xx = 0x10000L;\r\n      internal->transform_matrix.xy = 0;\r\n      internal->transform_matrix.yx = 0;\r\n      internal->transform_matrix.yy = 0x10000L;\r\n      matrix = &internal->transform_matrix;\r\n    }\r\n    else\r\n      internal->transform_matrix = *matrix;\r\n\r\n    /* set transform_flags bit flag 0 if `matrix' isn't the identity */\r\n    if ( ( matrix->xy | matrix->yx ) ||\r\n         matrix->xx != 0x10000L      ||\r\n         matrix->yy != 0x10000L      )\r\n      internal->transform_flags |= 1;\r\n\r\n    if ( !delta )\r\n    {\r\n      internal->transform_delta.x = 0;\r\n      internal->transform_delta.y = 0;\r\n      delta = &internal->transform_delta;\r\n    }\r\n    else\r\n      internal->transform_delta = *delta;\r\n\r\n    /* set transform_flags bit flag 1 if `delta' isn't the null vector */\r\n    if ( delta->x | delta->y )\r\n      internal->transform_flags |= 2;\r\n  }\r\n\r\n\r\n  static FT_Renderer\r\n  ft_lookup_glyph_renderer( FT_GlyphSlot  slot );\r\n\r\n\r\n#ifdef GRID_FIT_METRICS\r\n  static void\r\n  ft_glyphslot_grid_fit_metrics( FT_GlyphSlot  slot,\r\n                                 FT_Bool       vertical )\r\n  {\r\n    FT_Glyph_Metrics*  metrics = &slot->metrics;\r\n    FT_Pos             right, bottom;\r\n\r\n\r\n    if ( vertical )\r\n    {\r\n      metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );\r\n      metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );\r\n\r\n      right  = FT_PIX_CEIL( metrics->vertBearingX + metrics->width );\r\n      bottom = FT_PIX_CEIL( metrics->vertBearingY + metrics->height );\r\n\r\n      metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );\r\n      metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );\r\n\r\n      metrics->width  = right - metrics->vertBearingX;\r\n      metrics->height = bottom - metrics->vertBearingY;\r\n    }\r\n    else\r\n    {\r\n      metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );\r\n      metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );\r\n\r\n      right  = FT_PIX_CEIL ( metrics->horiBearingX + metrics->width );\r\n      bottom = FT_PIX_FLOOR( metrics->horiBearingY - metrics->height );\r\n\r\n      metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );\r\n      metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );\r\n\r\n      metrics->width  = right - metrics->horiBearingX;\r\n      metrics->height = metrics->horiBearingY - bottom;\r\n    }\r\n\r\n    metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );\r\n    metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );\r\n  }\r\n#endif /* GRID_FIT_METRICS */\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Load_Glyph( FT_Face   face,\r\n                 FT_UInt   glyph_index,\r\n                 FT_Int32  load_flags )\r\n  {\r\n    FT_Error      error;\r\n    FT_Driver     driver;\r\n    FT_GlyphSlot  slot;\r\n    FT_Library    library;\r\n    FT_Bool       autohint = FALSE;\r\n    FT_Module     hinter;\r\n    TT_Face       ttface = (TT_Face)face;\r\n\r\n\r\n    if ( !face || !face->size || !face->glyph )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    /* The validity test for `glyph_index' is performed by the */\r\n    /* font drivers.                                           */\r\n\r\n    slot = face->glyph;\r\n    ft_glyphslot_clear( slot );\r\n\r\n    driver  = face->driver;\r\n    library = driver->root.library;\r\n    hinter  = library->auto_hinter;\r\n\r\n    /* resolve load flags dependencies */\r\n\r\n    if ( load_flags & FT_LOAD_NO_RECURSE )\r\n      load_flags |= FT_LOAD_NO_SCALE         |\r\n                    FT_LOAD_IGNORE_TRANSFORM;\r\n\r\n    if ( load_flags & FT_LOAD_NO_SCALE )\r\n    {\r\n      load_flags |= FT_LOAD_NO_HINTING |\r\n                    FT_LOAD_NO_BITMAP;\r\n\r\n      load_flags &= ~FT_LOAD_RENDER;\r\n    }\r\n\r\n    /*\r\n     * Determine whether we need to auto-hint or not.\r\n     * The general rules are:\r\n     *\r\n     * - Do only auto-hinting if we have a hinter module, a scalable font\r\n     *   format dealing with outlines, and no transforms except simple\r\n     *   slants and/or rotations by integer multiples of 90 degrees.\r\n     *\r\n     * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't\r\n     *   have a native font hinter.\r\n     *\r\n     * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't\r\n     *   any hinting bytecode in the TrueType/OpenType font.\r\n     *\r\n     * - Exception: The font is `tricky' and requires the native hinter to\r\n     *   load properly.\r\n     */\r\n\r\n    if ( hinter                                           &&\r\n         !( load_flags & FT_LOAD_NO_HINTING )             &&\r\n         !( load_flags & FT_LOAD_NO_AUTOHINT )            &&\r\n         FT_DRIVER_IS_SCALABLE( driver )                  &&\r\n         FT_DRIVER_USES_OUTLINES( driver )                &&\r\n         !FT_IS_TRICKY( face )                            &&\r\n         ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM )    ||\r\n           ( face->internal->transform_matrix.yx == 0 &&\r\n             face->internal->transform_matrix.xx != 0 ) ||\r\n           ( face->internal->transform_matrix.xx == 0 &&\r\n             face->internal->transform_matrix.yx != 0 ) ) )\r\n    {\r\n      if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||\r\n           !FT_DRIVER_HAS_HINTER( driver )         )\r\n        autohint = TRUE;\r\n      else\r\n      {\r\n        FT_Render_Mode  mode = FT_LOAD_TARGET_MODE( load_flags );\r\n\r\n\r\n        /* the check for `num_locations' assures that we actually    */\r\n        /* test for instructions in a TTF and not in a CFF-based OTF */\r\n        if ( mode == FT_RENDER_MODE_LIGHT                       ||\r\n             face->internal->ignore_unpatented_hinter           ||\r\n             ( FT_IS_SFNT( face )                             &&\r\n               ttface->num_locations                          &&\r\n               ttface->max_profile.maxSizeOfInstructions == 0 ) )\r\n          autohint = TRUE;\r\n      }\r\n    }\r\n\r\n    if ( autohint )\r\n    {\r\n      FT_AutoHinter_Interface  hinting;\r\n\r\n\r\n      /* try to load embedded bitmaps first if available            */\r\n      /*                                                            */\r\n      /* XXX: This is really a temporary hack that should disappear */\r\n      /*      promptly with FreeType 2.1!                           */\r\n      /*                                                            */\r\n      if ( FT_HAS_FIXED_SIZES( face )             &&\r\n          ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )\r\n      {\r\n        error = driver->clazz->load_glyph( slot, face->size,\r\n                                           glyph_index,\r\n                                           load_flags | FT_LOAD_SBITS_ONLY );\r\n\r\n        if ( !error && slot->format == FT_GLYPH_FORMAT_BITMAP )\r\n          goto Load_Ok;\r\n      }\r\n\r\n      {\r\n        FT_Face_Internal  internal        = face->internal;\r\n        FT_Int            transform_flags = internal->transform_flags;\r\n\r\n\r\n        /* since the auto-hinter calls FT_Load_Glyph by itself, */\r\n        /* make sure that glyphs aren't transformed             */\r\n        internal->transform_flags = 0;\r\n\r\n        /* load auto-hinted outline */\r\n        hinting = (FT_AutoHinter_Interface)hinter->clazz->module_interface;\r\n\r\n        error   = hinting->load_glyph( (FT_AutoHinter)hinter,\r\n                                       slot, face->size,\r\n                                       glyph_index, load_flags );\r\n\r\n        internal->transform_flags = transform_flags;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      error = driver->clazz->load_glyph( slot,\r\n                                         face->size,\r\n                                         glyph_index,\r\n                                         load_flags );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )\r\n      {\r\n        /* check that the loaded outline is correct */\r\n        error = FT_Outline_Check( &slot->outline );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n#ifdef GRID_FIT_METRICS\r\n        if ( !( load_flags & FT_LOAD_NO_HINTING ) )\r\n          ft_glyphslot_grid_fit_metrics( slot,\r\n              FT_BOOL( load_flags & FT_LOAD_VERTICAL_LAYOUT ) );\r\n#endif\r\n      }\r\n    }\r\n\r\n  Load_Ok:\r\n    /* compute the advance */\r\n    if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n    {\r\n      slot->advance.x = 0;\r\n      slot->advance.y = slot->metrics.vertAdvance;\r\n    }\r\n    else\r\n    {\r\n      slot->advance.x = slot->metrics.horiAdvance;\r\n      slot->advance.y = 0;\r\n    }\r\n\r\n    /* compute the linear advance in 16.16 pixels */\r\n    if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&\r\n         ( FT_IS_SCALABLE( face ) )                  )\r\n    {\r\n      FT_Size_Metrics*  metrics = &face->size->metrics;\r\n\r\n\r\n      /* it's tricky! */\r\n      slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,\r\n                                           metrics->x_scale, 64 );\r\n\r\n      slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,\r\n                                           metrics->y_scale, 64 );\r\n    }\r\n\r\n    if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )\r\n    {\r\n      FT_Face_Internal  internal = face->internal;\r\n\r\n\r\n      /* now, transform the glyph image if needed */\r\n      if ( internal->transform_flags )\r\n      {\r\n        /* get renderer */\r\n        FT_Renderer  renderer = ft_lookup_glyph_renderer( slot );\r\n\r\n\r\n        if ( renderer )\r\n          error = renderer->clazz->transform_glyph(\r\n                                     renderer, slot,\r\n                                     &internal->transform_matrix,\r\n                                     &internal->transform_delta );\r\n        else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )\r\n        {\r\n          /* apply `standard' transformation if no renderer is available */\r\n          if ( internal->transform_flags & 1 )\r\n            FT_Outline_Transform( &slot->outline,\r\n                                  &internal->transform_matrix );\r\n\r\n          if ( internal->transform_flags & 2 )\r\n            FT_Outline_Translate( &slot->outline,\r\n                                  internal->transform_delta.x,\r\n                                  internal->transform_delta.y );\r\n        }\r\n\r\n        /* transform advance */\r\n        FT_Vector_Transform( &slot->advance, &internal->transform_matrix );\r\n      }\r\n    }\r\n\r\n    FT_TRACE5(( \"  x advance: %d\\n\" , slot->advance.x ));\r\n    FT_TRACE5(( \"  y advance: %d\\n\" , slot->advance.y ));\r\n\r\n    FT_TRACE5(( \"  linear x advance: %d\\n\" , slot->linearHoriAdvance ));\r\n    FT_TRACE5(( \"  linear y advance: %d\\n\" , slot->linearVertAdvance ));\r\n\r\n    /* do we need to render the image now? */\r\n    if ( !error                                    &&\r\n         slot->format != FT_GLYPH_FORMAT_BITMAP    &&\r\n         slot->format != FT_GLYPH_FORMAT_COMPOSITE &&\r\n         load_flags & FT_LOAD_RENDER )\r\n    {\r\n      FT_Render_Mode  mode = FT_LOAD_TARGET_MODE( load_flags );\r\n\r\n\r\n      if ( mode == FT_RENDER_MODE_NORMAL      &&\r\n           (load_flags & FT_LOAD_MONOCHROME ) )\r\n        mode = FT_RENDER_MODE_MONO;\r\n\r\n      error = FT_Render_Glyph( slot, mode );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Load_Char( FT_Face   face,\r\n                FT_ULong  char_code,\r\n                FT_Int32  load_flags )\r\n  {\r\n    FT_UInt  glyph_index;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    glyph_index = (FT_UInt)char_code;\r\n    if ( face->charmap )\r\n      glyph_index = FT_Get_Char_Index( face, char_code );\r\n\r\n    return FT_Load_Glyph( face, glyph_index, load_flags );\r\n  }\r\n\r\n\r\n  /* destructor for sizes list */\r\n  static void\r\n  destroy_size( FT_Memory  memory,\r\n                FT_Size    size,\r\n                FT_Driver  driver )\r\n  {\r\n    /* finalize client-specific data */\r\n    if ( size->generic.finalizer )\r\n      size->generic.finalizer( size );\r\n\r\n    /* finalize format-specific stuff */\r\n    if ( driver->clazz->done_size )\r\n      driver->clazz->done_size( size );\r\n\r\n    FT_FREE( size->internal );\r\n    FT_FREE( size );\r\n  }\r\n\r\n\r\n  static void\r\n  ft_cmap_done_internal( FT_CMap  cmap );\r\n\r\n\r\n  static void\r\n  destroy_charmaps( FT_Face    face,\r\n                    FT_Memory  memory )\r\n  {\r\n    FT_Int  n;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    for ( n = 0; n < face->num_charmaps; n++ )\r\n    {\r\n      FT_CMap  cmap = FT_CMAP( face->charmaps[n] );\r\n\r\n\r\n      ft_cmap_done_internal( cmap );\r\n\r\n      face->charmaps[n] = NULL;\r\n    }\r\n\r\n    FT_FREE( face->charmaps );\r\n    face->num_charmaps = 0;\r\n  }\r\n\r\n\r\n  /* destructor for faces list */\r\n  static void\r\n  destroy_face( FT_Memory  memory,\r\n                FT_Face    face,\r\n                FT_Driver  driver )\r\n  {\r\n    FT_Driver_Class  clazz = driver->clazz;\r\n\r\n\r\n    /* discard auto-hinting data */\r\n    if ( face->autohint.finalizer )\r\n      face->autohint.finalizer( face->autohint.data );\r\n\r\n    /* Discard glyph slots for this face.                           */\r\n    /* Beware!  FT_Done_GlyphSlot() changes the field `face->glyph' */\r\n    while ( face->glyph )\r\n      FT_Done_GlyphSlot( face->glyph );\r\n\r\n    /* discard all sizes for this face */\r\n    FT_List_Finalize( &face->sizes_list,\r\n                      (FT_List_Destructor)destroy_size,\r\n                      memory,\r\n                      driver );\r\n    face->size = 0;\r\n\r\n    /* now discard client data */\r\n    if ( face->generic.finalizer )\r\n      face->generic.finalizer( face );\r\n\r\n    /* discard charmaps */\r\n    destroy_charmaps( face, memory );\r\n\r\n    /* finalize format-specific stuff */\r\n    if ( clazz->done_face )\r\n      clazz->done_face( face );\r\n\r\n    /* close the stream for this face if needed */\r\n    FT_Stream_Free(\r\n      face->stream,\r\n      ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );\r\n\r\n    face->stream = 0;\r\n\r\n    /* get rid of it */\r\n    if ( face->internal )\r\n    {\r\n      FT_FREE( face->internal );\r\n    }\r\n    FT_FREE( face );\r\n  }\r\n\r\n\r\n  static void\r\n  Destroy_Driver( FT_Driver  driver )\r\n  {\r\n    FT_List_Finalize( &driver->faces_list,\r\n                      (FT_List_Destructor)destroy_face,\r\n                      driver->root.memory,\r\n                      driver );\r\n\r\n    /* check whether we need to drop the driver's glyph loader */\r\n    if ( FT_DRIVER_USES_OUTLINES( driver ) )\r\n      FT_GlyphLoader_Done( driver->glyph_loader );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    find_unicode_charmap                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function finds a Unicode charmap, if there is one.            */\r\n  /*    And if there is more than one, it tries to favour the more         */\r\n  /*    extensive one, i.e., one that supports UCS-4 against those which   */\r\n  /*    are limited to the BMP (said UCS-2 encoding.)                      */\r\n  /*                                                                       */\r\n  /*    This function is called from open_face() (just below), and also    */\r\n  /*    from FT_Select_Charmap( ..., FT_ENCODING_UNICODE ).                */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  find_unicode_charmap( FT_Face  face )\r\n  {\r\n    FT_CharMap*  first;\r\n    FT_CharMap*  cur;\r\n\r\n\r\n    /* caller should have already checked that `face' is valid */\r\n    FT_ASSERT( face );\r\n\r\n    first = face->charmaps;\r\n\r\n    if ( !first )\r\n      return FT_Err_Invalid_CharMap_Handle;\r\n\r\n    /*\r\n     *  The original TrueType specification(s) only specified charmap\r\n     *  formats that are capable of mapping 8 or 16 bit character codes to\r\n     *  glyph indices.\r\n     *\r\n     *  However, recent updates to the Apple and OpenType specifications\r\n     *  introduced new formats that are capable of mapping 32-bit character\r\n     *  codes as well.  And these are already used on some fonts, mainly to\r\n     *  map non-BMP Asian ideographs as defined in Unicode.\r\n     *\r\n     *  For compatibility purposes, these fonts generally come with\r\n     *  *several* Unicode charmaps:\r\n     *\r\n     *   - One of them in the \"old\" 16-bit format, that cannot access\r\n     *     all glyphs in the font.\r\n     *\r\n     *   - Another one in the \"new\" 32-bit format, that can access all\r\n     *     the glyphs.\r\n     *\r\n     *  This function has been written to always favor a 32-bit charmap\r\n     *  when found.  Otherwise, a 16-bit one is returned when found.\r\n     */\r\n\r\n    /* Since the `interesting' table, with IDs (3,10), is normally the */\r\n    /* last one, we loop backwards.  This loses with type1 fonts with  */\r\n    /* non-BMP characters (<.0001%), this wins with .ttf with non-BMP  */\r\n    /* chars (.01% ?), and this is the same about 99.99% of the time!  */\r\n\r\n    cur = first + face->num_charmaps;  /* points after the last one */\r\n\r\n    for ( ; --cur >= first; )\r\n    {\r\n      if ( cur[0]->encoding == FT_ENCODING_UNICODE )\r\n      {\r\n        /* XXX If some new encodings to represent UCS-4 are added, */\r\n        /*     they should be added here.                          */\r\n        if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&\r\n               cur[0]->encoding_id == TT_MS_ID_UCS_4        )     ||\r\n             ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&\r\n               cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32    ) )\r\n        {\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n          if ( cur - first > FT_MAX_CHARMAP_CACHEABLE )\r\n          {\r\n            FT_ERROR(( \"find_unicode_charmap: UCS-4 cmap is found \"\r\n                       \"at too late position (%d)\\n\", cur - first ));\r\n            continue;\r\n          }\r\n#endif\r\n          face->charmap = cur[0];\r\n          return FT_Err_Ok;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* We do not have any UCS-4 charmap.                */\r\n    /* Do the loop again and search for UCS-2 charmaps. */\r\n    cur = first + face->num_charmaps;\r\n\r\n    for ( ; --cur >= first; )\r\n    {\r\n      if ( cur[0]->encoding == FT_ENCODING_UNICODE )\r\n      {\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n        if ( cur - first > FT_MAX_CHARMAP_CACHEABLE )\r\n        {\r\n          FT_ERROR(( \"find_unicode_charmap: UCS-2 cmap is found \"\r\n                     \"at too late position (%d)\\n\", cur - first ));\r\n          continue;\r\n        }\r\n#endif\r\n        face->charmap = cur[0];\r\n        return FT_Err_Ok;\r\n      }\r\n    }\r\n\r\n    return FT_Err_Invalid_CharMap_Handle;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    find_variant_selector_charmap                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function finds the variant selector charmap, if there is one. */\r\n  /*    There can only be one (platform=0, specific=5, format=14).         */\r\n  /*                                                                       */\r\n  static FT_CharMap\r\n  find_variant_selector_charmap( FT_Face  face )\r\n  {\r\n    FT_CharMap*  first;\r\n    FT_CharMap*  end;\r\n    FT_CharMap*  cur;\r\n\r\n\r\n    /* caller should have already checked that `face' is valid */\r\n    FT_ASSERT( face );\r\n\r\n    first = face->charmaps;\r\n\r\n    if ( !first )\r\n      return NULL;\r\n\r\n    end = first + face->num_charmaps;  /* points after the last one */\r\n\r\n    for ( cur = first; cur < end; ++cur )\r\n    {\r\n      if ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE    &&\r\n           cur[0]->encoding_id == TT_APPLE_ID_VARIANT_SELECTOR &&\r\n           FT_Get_CMap_Format( cur[0] ) == 14                  )\r\n      {\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n        if ( cur - first > FT_MAX_CHARMAP_CACHEABLE )\r\n        {\r\n          FT_ERROR(( \"find_unicode_charmap: UVS cmap is found \"\r\n                     \"at too late position (%d)\\n\", cur - first ));\r\n          continue;\r\n        }\r\n#endif\r\n        return cur[0];\r\n      }\r\n    }\r\n\r\n    return NULL;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    open_face                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function does some work for FT_Open_Face().                   */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  open_face( FT_Driver      driver,\r\n             FT_Stream      stream,\r\n             FT_Long        face_index,\r\n             FT_Int         num_params,\r\n             FT_Parameter*  params,\r\n             FT_Face       *aface )\r\n  {\r\n    FT_Memory         memory;\r\n    FT_Driver_Class   clazz;\r\n    FT_Face           face = 0;\r\n    FT_Error          error, error2;\r\n    FT_Face_Internal  internal = NULL;\r\n\r\n\r\n    clazz  = driver->clazz;\r\n    memory = driver->root.memory;\r\n\r\n    /* allocate the face object and perform basic initialization */\r\n    if ( FT_ALLOC( face, clazz->face_object_size ) )\r\n      goto Fail;\r\n\r\n    if ( FT_NEW( internal ) )\r\n      goto Fail;\r\n\r\n    face->internal = internal;\r\n\r\n    face->driver   = driver;\r\n    face->memory   = memory;\r\n    face->stream   = stream;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    {\r\n      int  i;\r\n\r\n\r\n      face->internal->incremental_interface = 0;\r\n      for ( i = 0; i < num_params && !face->internal->incremental_interface;\r\n            i++ )\r\n        if ( params[i].tag == FT_PARAM_TAG_INCREMENTAL )\r\n          face->internal->incremental_interface =\r\n            (FT_Incremental_Interface)params[i].data;\r\n    }\r\n#endif\r\n\r\n    if ( clazz->init_face )\r\n      error = clazz->init_face( stream,\r\n                                face,\r\n                                (FT_Int)face_index,\r\n                                num_params,\r\n                                params );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    /* select Unicode charmap by default */\r\n    error2 = find_unicode_charmap( face );\r\n\r\n    /* if no Unicode charmap can be found, FT_Err_Invalid_CharMap_Handle */\r\n    /* is returned.                                                      */\r\n\r\n    /* no error should happen, but we want to play safe */\r\n    if ( error2 && error2 != FT_Err_Invalid_CharMap_Handle )\r\n    {\r\n      error = error2;\r\n      goto Fail;\r\n    }\r\n\r\n    *aface = face;\r\n\r\n  Fail:\r\n    if ( error )\r\n    {\r\n      destroy_charmaps( face, memory );\r\n      if ( clazz->done_face )\r\n        clazz->done_face( face );\r\n      FT_FREE( internal );\r\n      FT_FREE( face );\r\n      *aface = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* there's a Mac-specific extended implementation of FT_New_Face() */\r\n  /* in src/base/ftmac.c                                             */\r\n\r\n#ifndef FT_MACINTOSH\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Face( FT_Library   library,\r\n               const char*  pathname,\r\n               FT_Long      face_index,\r\n               FT_Face     *aface )\r\n  {\r\n    FT_Open_Args  args;\r\n\r\n\r\n    /* test for valid `library' and `aface' delayed to FT_Open_Face() */\r\n    if ( !pathname )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    args.flags    = FT_OPEN_PATHNAME;\r\n    args.pathname = (char*)pathname;\r\n    args.stream   = NULL;\r\n\r\n    return FT_Open_Face( library, &args, face_index, aface );\r\n  }\r\n\r\n#endif\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Memory_Face( FT_Library      library,\r\n                      const FT_Byte*  file_base,\r\n                      FT_Long         file_size,\r\n                      FT_Long         face_index,\r\n                      FT_Face        *aface )\r\n  {\r\n    FT_Open_Args  args;\r\n\r\n\r\n    /* test for valid `library' and `face' delayed to FT_Open_Face() */\r\n    if ( !file_base )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    args.flags       = FT_OPEN_MEMORY;\r\n    args.memory_base = file_base;\r\n    args.memory_size = file_size;\r\n    args.stream      = NULL;\r\n\r\n    return FT_Open_Face( library, &args, face_index, aface );\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n\r\n  /* The behavior here is very similar to that in base/ftmac.c, but it     */\r\n  /* is designed to work on non-mac systems, so no mac specific calls.     */\r\n  /*                                                                       */\r\n  /* We look at the file and determine if it is a mac dfont file or a mac  */\r\n  /* resource file, or a macbinary file containing a mac resource file.    */\r\n  /*                                                                       */\r\n  /* Unlike ftmac I'm not going to look at a `FOND'.  I don't really see   */\r\n  /* the point, especially since there may be multiple `FOND' resources.   */\r\n  /* Instead I'll just look for `sfnt' and `POST' resources, ordered as    */\r\n  /* they occur in the file.                                               */\r\n  /*                                                                       */\r\n  /* Note that multiple `POST' resources do not mean multiple postscript   */\r\n  /* fonts; they all get jammed together to make what is essentially a     */\r\n  /* pfb file.                                                             */\r\n  /*                                                                       */\r\n  /* We aren't interested in `NFNT' or `FONT' bitmap resources.            */\r\n  /*                                                                       */\r\n  /* As soon as we get an `sfnt' load it into memory and pass it off to    */\r\n  /* FT_Open_Face.                                                         */\r\n  /*                                                                       */\r\n  /* If we have a (set of) `POST' resources, massage them into a (memory)  */\r\n  /* pfb file and pass that to FT_Open_Face.  (As with ftmac.c I'm not     */\r\n  /* going to try to save the kerning info.  After all that lives in the   */\r\n  /* `FOND' which isn't in the file containing the `POST' resources so     */\r\n  /* we don't really have access to it.                                    */\r\n\r\n\r\n  /* Finalizer for a memory stream; gets called by FT_Done_Face(). */\r\n  /* It frees the memory it uses.                                  */\r\n  /* From ftmac.c.                                                 */\r\n  static void\r\n  memory_stream_close( FT_Stream  stream )\r\n  {\r\n    FT_Memory  memory = stream->memory;\r\n\r\n\r\n    FT_FREE( stream->base );\r\n\r\n    stream->size  = 0;\r\n    stream->base  = 0;\r\n    stream->close = 0;\r\n  }\r\n\r\n\r\n  /* Create a new memory stream from a buffer and a size. */\r\n  /* From ftmac.c.                                        */\r\n  static FT_Error\r\n  new_memory_stream( FT_Library           library,\r\n                     FT_Byte*             base,\r\n                     FT_ULong             size,\r\n                     FT_Stream_CloseFunc  close,\r\n                     FT_Stream           *astream )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n    FT_Stream  stream = NULL;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !base )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    *astream = 0;\r\n    memory = library->memory;\r\n    if ( FT_NEW( stream ) )\r\n      goto Exit;\r\n\r\n    FT_Stream_OpenMemory( stream, base, size );\r\n\r\n    stream->close = close;\r\n\r\n    *astream = stream;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Create a new FT_Face given a buffer and a driver name. */\r\n  /* from ftmac.c */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  open_face_from_buffer( FT_Library   library,\r\n                         FT_Byte*     base,\r\n                         FT_ULong     size,\r\n                         FT_Long      face_index,\r\n                         const char*  driver_name,\r\n                         FT_Face     *aface )\r\n  {\r\n    FT_Open_Args  args;\r\n    FT_Error      error;\r\n    FT_Stream     stream = NULL;\r\n    FT_Memory     memory = library->memory;\r\n\r\n\r\n    error = new_memory_stream( library,\r\n                               base,\r\n                               size,\r\n                               memory_stream_close,\r\n                               &stream );\r\n    if ( error )\r\n    {\r\n      FT_FREE( base );\r\n      return error;\r\n    }\r\n\r\n    args.flags = FT_OPEN_STREAM;\r\n    args.stream = stream;\r\n    if ( driver_name )\r\n    {\r\n      args.flags = args.flags | FT_OPEN_DRIVER;\r\n      args.driver = FT_Get_Module( library, driver_name );\r\n    }\r\n\r\n#ifdef FT_MACINTOSH\r\n    /* At this point, face_index has served its purpose;      */\r\n    /* whoever calls this function has already used it to     */\r\n    /* locate the correct font data.  We should not propagate */\r\n    /* this index to FT_Open_Face() (unless it is negative).  */\r\n\r\n    if ( face_index > 0 )\r\n      face_index = 0;\r\n#endif\r\n\r\n    error = FT_Open_Face( library, &args, face_index, aface );\r\n\r\n    if ( error == FT_Err_Ok )\r\n      (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;\r\n    else\r\n#ifdef FT_MACINTOSH\r\n      FT_Stream_Free( stream, 0 );\r\n#else\r\n    {\r\n      FT_Stream_Close( stream );\r\n      FT_FREE( stream );\r\n    }\r\n#endif\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Look up `TYP1' or `CID ' table from sfnt table directory.       */\r\n  /* `offset' and `length' must exclude the binary header in tables. */\r\n\r\n  /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */\r\n  /* format too.  Here, since we can't expect that the TrueType font */\r\n  /* driver is loaded unconditially, we must parse the font by       */\r\n  /* ourselves.  We are only interested in the name of the table and */\r\n  /* the offset.                                                     */\r\n\r\n  static FT_Error\r\n  ft_lookup_PS_in_sfnt_stream( FT_Stream  stream,\r\n                               FT_Long    face_index,\r\n                               FT_ULong*  offset,\r\n                               FT_ULong*  length,\r\n                               FT_Bool*   is_sfnt_cid )\r\n  {\r\n    FT_Error   error;\r\n    FT_UShort  numTables;\r\n    FT_Long    pstable_index;\r\n    FT_ULong   tag;\r\n    int        i;\r\n\r\n\r\n    *offset = 0;\r\n    *length = 0;\r\n    *is_sfnt_cid = FALSE;\r\n\r\n    /* TODO: support for sfnt-wrapped PS/CID in TTC format */\r\n\r\n    /* version check for 'typ1' (should be ignored?) */\r\n    if ( FT_READ_ULONG( tag ) )\r\n      return error;\r\n    if ( tag != TTAG_typ1 )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    if ( FT_READ_USHORT( numTables ) )\r\n      return error;\r\n    if ( FT_STREAM_SKIP( 2 * 3 ) ) /* skip binary search header */\r\n      return error;\r\n\r\n    pstable_index = -1;\r\n    *is_sfnt_cid  = FALSE;\r\n\r\n    for ( i = 0; i < numTables; i++ )\r\n    {\r\n      if ( FT_READ_ULONG( tag )     || FT_STREAM_SKIP( 4 )      ||\r\n           FT_READ_ULONG( *offset ) || FT_READ_ULONG( *length ) )\r\n        return error;\r\n\r\n      if ( tag == TTAG_CID )\r\n      {\r\n        pstable_index++;\r\n        *offset += 22;\r\n        *length -= 22;\r\n        *is_sfnt_cid = TRUE;\r\n        if ( face_index < 0 )\r\n          return FT_Err_Ok;\r\n      }\r\n      else if ( tag == TTAG_TYP1 )\r\n      {\r\n        pstable_index++;\r\n        *offset += 24;\r\n        *length -= 24;\r\n        *is_sfnt_cid = FALSE;\r\n        if ( face_index < 0 )\r\n          return FT_Err_Ok;\r\n      }\r\n      if ( face_index >= 0 && pstable_index == face_index )\r\n        return FT_Err_Ok;\r\n    }\r\n    return FT_Err_Table_Missing;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  open_face_PS_from_sfnt_stream( FT_Library     library,\r\n                                 FT_Stream      stream,\r\n                                 FT_Long        face_index,\r\n                                 FT_Int         num_params,\r\n                                 FT_Parameter  *params,\r\n                                 FT_Face       *aface )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = library->memory;\r\n    FT_ULong   offset, length;\r\n    FT_Long    pos;\r\n    FT_Bool    is_sfnt_cid;\r\n    FT_Byte*   sfnt_ps = NULL;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n\r\n\r\n    pos = FT_Stream_Pos( stream );\r\n\r\n    error = ft_lookup_PS_in_sfnt_stream( stream,\r\n                                         face_index,\r\n                                         &offset,\r\n                                         &length,\r\n                                         &is_sfnt_cid );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_Stream_Seek( stream, pos + offset ) )\r\n      goto Exit;\r\n\r\n    if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )\r\n      goto Exit;\r\n\r\n    error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = open_face_from_buffer( library,\r\n                                   sfnt_ps,\r\n                                   length,\r\n                                   face_index < 0 ? face_index : 0,\r\n                                   is_sfnt_cid ? \"cid\" : \"type1\",\r\n                                   aface );\r\n  Exit:\r\n    {\r\n      FT_Error  error1;\r\n\r\n\r\n      if ( error == FT_Err_Unknown_File_Format )\r\n      {\r\n        error1 = FT_Stream_Seek( stream, pos );\r\n        if ( error1 )\r\n          return error1;\r\n      }\r\n\r\n      return error;\r\n    }\r\n  }\r\n\r\n\r\n#ifndef FT_MACINTOSH\r\n\r\n  /* The resource header says we've got resource_cnt `POST' (type1) */\r\n  /* resources in this file.  They all need to be coalesced into    */\r\n  /* one lump which gets passed on to the type1 driver.             */\r\n  /* Here can be only one PostScript font in a file so face_index   */\r\n  /* must be 0 (or -1).                                             */\r\n  /*                                                                */\r\n  static FT_Error\r\n  Mac_Read_POST_Resource( FT_Library  library,\r\n                          FT_Stream   stream,\r\n                          FT_Long    *offsets,\r\n                          FT_Long     resource_cnt,\r\n                          FT_Long     face_index,\r\n                          FT_Face    *aface )\r\n  {\r\n    FT_Error   error  = FT_Err_Cannot_Open_Resource;\r\n    FT_Memory  memory = library->memory;\r\n    FT_Byte*   pfb_data = NULL;\r\n    int        i, type, flags;\r\n    FT_Long    len;\r\n    FT_Long    pfb_len, pfb_pos, pfb_lenpos;\r\n    FT_Long    rlen, temp;\r\n\r\n\r\n    if ( face_index == -1 )\r\n      face_index = 0;\r\n    if ( face_index != 0 )\r\n      return error;\r\n\r\n    /* Find the length of all the POST resources, concatenated.  Assume */\r\n    /* worst case (each resource in its own section).                   */\r\n    pfb_len = 0;\r\n    for ( i = 0; i < resource_cnt; ++i )\r\n    {\r\n      error = FT_Stream_Seek( stream, offsets[i] );\r\n      if ( error )\r\n        goto Exit;\r\n      if ( FT_READ_LONG( temp ) )\r\n        goto Exit;\r\n      pfb_len += temp + 6;\r\n    }\r\n\r\n    if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )\r\n      goto Exit;\r\n\r\n    pfb_data[0] = 0x80;\r\n    pfb_data[1] = 1;            /* Ascii section */\r\n    pfb_data[2] = 0;            /* 4-byte length, fill in later */\r\n    pfb_data[3] = 0;\r\n    pfb_data[4] = 0;\r\n    pfb_data[5] = 0;\r\n    pfb_pos     = 6;\r\n    pfb_lenpos  = 2;\r\n\r\n    len = 0;\r\n    type = 1;\r\n    for ( i = 0; i < resource_cnt; ++i )\r\n    {\r\n      error = FT_Stream_Seek( stream, offsets[i] );\r\n      if ( error )\r\n        goto Exit2;\r\n      if ( FT_READ_LONG( rlen ) )\r\n        goto Exit;\r\n      if ( FT_READ_USHORT( flags ) )\r\n        goto Exit;\r\n      FT_TRACE3(( \"POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\\n\",\r\n                   i, offsets[i], rlen, flags ));\r\n\r\n      /* postpone the check of rlen longer than buffer until FT_Stream_Read() */\r\n      if ( ( flags >> 8 ) == 0 )        /* Comment, should not be loaded */\r\n        continue;\r\n\r\n      /* the flags are part of the resource, so rlen >= 2.  */\r\n      /* but some fonts declare rlen = 0 for empty fragment */\r\n      if ( rlen > 2 )\r\n        rlen -= 2;\r\n      else\r\n        rlen = 0;\r\n\r\n      if ( ( flags >> 8 ) == type )\r\n        len += rlen;\r\n      else\r\n      {\r\n        if ( pfb_lenpos + 3 > pfb_len + 2 )\r\n          goto Exit2;\r\n        pfb_data[pfb_lenpos    ] = (FT_Byte)( len );\r\n        pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );\r\n        pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );\r\n        pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );\r\n\r\n        if ( ( flags >> 8 ) == 5 )      /* End of font mark */\r\n          break;\r\n\r\n        if ( pfb_pos + 6 > pfb_len + 2 )\r\n          goto Exit2;\r\n        pfb_data[pfb_pos++] = 0x80;\r\n\r\n        type = flags >> 8;\r\n        len = rlen;\r\n\r\n        pfb_data[pfb_pos++] = (FT_Byte)type;\r\n        pfb_lenpos          = pfb_pos;\r\n        pfb_data[pfb_pos++] = 0;        /* 4-byte length, fill in later */\r\n        pfb_data[pfb_pos++] = 0;\r\n        pfb_data[pfb_pos++] = 0;\r\n        pfb_data[pfb_pos++] = 0;\r\n      }\r\n\r\n      error = FT_Err_Cannot_Open_Resource;\r\n      if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )\r\n        goto Exit2;\r\n\r\n      error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );\r\n      if ( error )\r\n        goto Exit2;\r\n      pfb_pos += rlen;\r\n    }\r\n\r\n    if ( pfb_pos + 2 > pfb_len + 2 )\r\n      goto Exit2;\r\n    pfb_data[pfb_pos++] = 0x80;\r\n    pfb_data[pfb_pos++] = 3;\r\n\r\n    if ( pfb_lenpos + 3 > pfb_len + 2 )\r\n      goto Exit2;\r\n    pfb_data[pfb_lenpos    ] = (FT_Byte)( len );\r\n    pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );\r\n    pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );\r\n    pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );\r\n\r\n    return open_face_from_buffer( library,\r\n                                  pfb_data,\r\n                                  pfb_pos,\r\n                                  face_index,\r\n                                  \"type1\",\r\n                                  aface );\r\n\r\n  Exit2:\r\n    FT_FREE( pfb_data );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* The resource header says we've got resource_cnt `sfnt'      */\r\n  /* (TrueType/OpenType) resources in this file.  Look through   */\r\n  /* them for the one indicated by face_index, load it into mem, */\r\n  /* pass it on the the truetype driver and return it.           */\r\n  /*                                                             */\r\n  static FT_Error\r\n  Mac_Read_sfnt_Resource( FT_Library  library,\r\n                          FT_Stream   stream,\r\n                          FT_Long    *offsets,\r\n                          FT_Long     resource_cnt,\r\n                          FT_Long     face_index,\r\n                          FT_Face    *aface )\r\n  {\r\n    FT_Memory  memory = library->memory;\r\n    FT_Byte*   sfnt_data = NULL;\r\n    FT_Error   error;\r\n    FT_Long    flag_offset;\r\n    FT_Long    rlen;\r\n    int        is_cff;\r\n    FT_Long    face_index_in_resource = 0;\r\n\r\n\r\n    if ( face_index == -1 )\r\n      face_index = 0;\r\n    if ( face_index >= resource_cnt )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    flag_offset = offsets[face_index];\r\n    error = FT_Stream_Seek( stream, flag_offset );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_READ_LONG( rlen ) )\r\n      goto Exit;\r\n    if ( rlen == -1 )\r\n      return FT_Err_Cannot_Open_Resource;\r\n\r\n    error = open_face_PS_from_sfnt_stream( library,\r\n                                           stream,\r\n                                           face_index,\r\n                                           0, NULL,\r\n                                           aface );\r\n    if ( !error )\r\n      goto Exit;\r\n\r\n    /* rewind sfnt stream before open_face_PS_from_sfnt_stream() */\r\n    if ( FT_Stream_Seek( stream, flag_offset + 4 ) )\r\n      goto Exit;\r\n\r\n    if ( FT_ALLOC( sfnt_data, (FT_Long)rlen ) )\r\n      return error;\r\n    error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    is_cff = rlen > 4 && !ft_memcmp( sfnt_data, \"OTTO\", 4 );\r\n    error = open_face_from_buffer( library,\r\n                                   sfnt_data,\r\n                                   rlen,\r\n                                   face_index_in_resource,\r\n                                   is_cff ? \"cff\" : \"truetype\",\r\n                                   aface );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Check for a valid resource fork header, or a valid dfont    */\r\n  /* header.  In a resource fork the first 16 bytes are repeated */\r\n  /* at the location specified by bytes 4-7.  In a dfont bytes   */\r\n  /* 4-7 point to 16 bytes of zeroes instead.                    */\r\n  /*                                                             */\r\n  static FT_Error\r\n  IsMacResource( FT_Library  library,\r\n                 FT_Stream   stream,\r\n                 FT_Long     resource_offset,\r\n                 FT_Long     face_index,\r\n                 FT_Face    *aface )\r\n  {\r\n    FT_Memory  memory = library->memory;\r\n    FT_Error   error;\r\n    FT_Long    map_offset, rdara_pos;\r\n    FT_Long    *data_offsets;\r\n    FT_Long    count;\r\n\r\n\r\n    error = FT_Raccess_Get_HeaderInfo( library, stream, resource_offset,\r\n                                       &map_offset, &rdara_pos );\r\n    if ( error )\r\n      return error;\r\n\r\n    error = FT_Raccess_Get_DataOffsets( library, stream,\r\n                                        map_offset, rdara_pos,\r\n                                        TTAG_POST,\r\n                                        &data_offsets, &count );\r\n    if ( !error )\r\n    {\r\n      error = Mac_Read_POST_Resource( library, stream, data_offsets, count,\r\n                                      face_index, aface );\r\n      FT_FREE( data_offsets );\r\n      /* POST exists in an LWFN providing a single face */\r\n      if ( !error )\r\n        (*aface)->num_faces = 1;\r\n      return error;\r\n    }\r\n\r\n    error = FT_Raccess_Get_DataOffsets( library, stream,\r\n                                        map_offset, rdara_pos,\r\n                                        TTAG_sfnt,\r\n                                        &data_offsets, &count );\r\n    if ( !error )\r\n    {\r\n      FT_Long  face_index_internal = face_index % count;\r\n\r\n\r\n      error = Mac_Read_sfnt_Resource( library, stream, data_offsets, count,\r\n                                      face_index_internal, aface );\r\n      FT_FREE( data_offsets );\r\n      if ( !error )\r\n        (*aface)->num_faces = count;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Check for a valid macbinary header, and if we find one   */\r\n  /* check that the (flattened) resource fork in it is valid. */\r\n  /*                                                          */\r\n  static FT_Error\r\n  IsMacBinary( FT_Library  library,\r\n               FT_Stream   stream,\r\n               FT_Long     face_index,\r\n               FT_Face    *aface )\r\n  {\r\n    unsigned char  header[128];\r\n    FT_Error       error;\r\n    FT_Long        dlen, offset;\r\n\r\n\r\n    if ( NULL == stream )\r\n      return FT_Err_Invalid_Stream_Operation;\r\n\r\n    error = FT_Stream_Seek( stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = FT_Stream_Read( stream, (FT_Byte*)header, 128 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if (            header[ 0] !=  0 ||\r\n                    header[74] !=  0 ||\r\n                    header[82] !=  0 ||\r\n                    header[ 1] ==  0 ||\r\n                    header[ 1] >  33 ||\r\n                    header[63] !=  0 ||\r\n         header[2 + header[1]] !=  0 )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    dlen = ( header[0x53] << 24 ) |\r\n           ( header[0x54] << 16 ) |\r\n           ( header[0x55] <<  8 ) |\r\n             header[0x56];\r\n#if 0\r\n    rlen = ( header[0x57] << 24 ) |\r\n           ( header[0x58] << 16 ) |\r\n           ( header[0x59] <<  8 ) |\r\n             header[0x5a];\r\n#endif /* 0 */\r\n    offset = 128 + ( ( dlen + 127 ) & ~127 );\r\n\r\n    return IsMacResource( library, stream, offset, face_index, aface );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  load_face_in_embedded_rfork( FT_Library           library,\r\n                               FT_Stream            stream,\r\n                               FT_Long              face_index,\r\n                               FT_Face             *aface,\r\n                               const FT_Open_Args  *args )\r\n  {\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_raccess\r\n\r\n    FT_Memory  memory = library->memory;\r\n    FT_Error   error  = FT_Err_Unknown_File_Format;\r\n    int        i;\r\n\r\n    char *     file_names[FT_RACCESS_N_RULES];\r\n    FT_Long    offsets[FT_RACCESS_N_RULES];\r\n    FT_Error   errors[FT_RACCESS_N_RULES];\r\n    FT_Bool    is_darwin_vfs, vfs_rfork_has_no_font = FALSE; /* not tested */\r\n\r\n    FT_Open_Args  args2;\r\n    FT_Stream     stream2 = 0;\r\n\r\n\r\n    FT_Raccess_Guess( library, stream,\r\n                      args->pathname, file_names, offsets, errors );\r\n\r\n    for ( i = 0; i < FT_RACCESS_N_RULES; i++ )\r\n    {\r\n      is_darwin_vfs = ft_raccess_rule_by_darwin_vfs( library, i );\r\n      if ( is_darwin_vfs && vfs_rfork_has_no_font )\r\n      {\r\n        FT_TRACE3(( \"Skip rule %d: darwin vfs resource fork\"\r\n                    \" is already checked and\"\r\n                    \" no font is found\\n\", i ));\r\n        continue;\r\n      }\r\n\r\n      if ( errors[i] )\r\n      {\r\n        FT_TRACE3(( \"Error[%d] has occurred in rule %d\\n\", errors[i], i ));\r\n        continue;\r\n      }\r\n\r\n      args2.flags    = FT_OPEN_PATHNAME;\r\n      args2.pathname = file_names[i] ? file_names[i] : args->pathname;\r\n\r\n      FT_TRACE3(( \"Try rule %d: %s (offset=%d) ...\",\r\n                  i, args2.pathname, offsets[i] ));\r\n\r\n      error = FT_Stream_New( library, &args2, &stream2 );\r\n      if ( is_darwin_vfs && error == FT_Err_Cannot_Open_Stream )\r\n        vfs_rfork_has_no_font = TRUE;\r\n\r\n      if ( error )\r\n      {\r\n        FT_TRACE3(( \"failed\\n\" ));\r\n        continue;\r\n      }\r\n\r\n      error = IsMacResource( library, stream2, offsets[i],\r\n                             face_index, aface );\r\n      FT_Stream_Free( stream2, 0 );\r\n\r\n      FT_TRACE3(( \"%s\\n\", error ? \"failed\": \"successful\" ));\r\n\r\n      if ( !error )\r\n          break;\r\n      else if ( is_darwin_vfs )\r\n          vfs_rfork_has_no_font = TRUE;\r\n    }\r\n\r\n    for (i = 0; i < FT_RACCESS_N_RULES; i++)\r\n    {\r\n      if ( file_names[i] )\r\n        FT_FREE( file_names[i] );\r\n    }\r\n\r\n    /* Caller (load_mac_face) requires FT_Err_Unknown_File_Format. */\r\n    if ( error )\r\n      error = FT_Err_Unknown_File_Format;\r\n\r\n    return error;\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_objs\r\n\r\n  }\r\n\r\n\r\n  /* Check for some macintosh formats without Carbon framework.    */\r\n  /* Is this a macbinary file?  If so look at the resource fork.   */\r\n  /* Is this a mac dfont file?                                     */\r\n  /* Is this an old style resource fork? (in data)                 */\r\n  /* Else call load_face_in_embedded_rfork to try extra rules      */\r\n  /* (defined in `ftrfork.c').                                     */\r\n  /*                                                               */\r\n  static FT_Error\r\n  load_mac_face( FT_Library           library,\r\n                 FT_Stream            stream,\r\n                 FT_Long              face_index,\r\n                 FT_Face             *aface,\r\n                 const FT_Open_Args  *args )\r\n  {\r\n    FT_Error error;\r\n    FT_UNUSED( args );\r\n\r\n\r\n    error = IsMacBinary( library, stream, face_index, aface );\r\n    if ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format )\r\n    {\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_raccess\r\n\r\n      FT_TRACE3(( \"Try as dfont: %s ...\", args->pathname ));\r\n\r\n      error = IsMacResource( library, stream, 0, face_index, aface );\r\n\r\n      FT_TRACE3(( \"%s\\n\", error ? \"failed\" : \"successful\" ));\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_objs\r\n\r\n    }\r\n\r\n    if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format      ||\r\n           FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) &&\r\n         ( args->flags & FT_OPEN_PATHNAME )                            )\r\n      error = load_face_in_embedded_rfork( library, stream,\r\n                                           face_index, aface, args );\r\n    return error;\r\n  }\r\n#endif\r\n\r\n#endif  /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Open_Face( FT_Library           library,\r\n                const FT_Open_Args*  args,\r\n                FT_Long              face_index,\r\n                FT_Face             *aface )\r\n  {\r\n    FT_Error     error;\r\n    FT_Driver    driver;\r\n    FT_Memory    memory;\r\n    FT_Stream    stream = NULL;\r\n    FT_Face      face   = NULL;\r\n    FT_ListNode  node   = NULL;\r\n    FT_Bool      external_stream;\r\n    FT_Module*   cur;\r\n    FT_Module*   limit;\r\n\r\n\r\n    /* test for valid `library' delayed to */\r\n    /* FT_Stream_New()                     */\r\n\r\n    if ( ( !aface && face_index >= 0 ) || !args )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) &&\r\n                               args->stream                     );\r\n\r\n    /* create input stream */\r\n    error = FT_Stream_New( library, args, &stream );\r\n    if ( error )\r\n      goto Fail3;\r\n\r\n    memory = library->memory;\r\n\r\n    /* If the font driver is specified in the `args' structure, use */\r\n    /* it.  Otherwise, we scan the list of registered drivers.      */\r\n    if ( ( args->flags & FT_OPEN_DRIVER ) && args->driver )\r\n    {\r\n      driver = FT_DRIVER( args->driver );\r\n\r\n      /* not all modules are drivers, so check... */\r\n      if ( FT_MODULE_IS_DRIVER( driver ) )\r\n      {\r\n        FT_Int         num_params = 0;\r\n        FT_Parameter*  params     = 0;\r\n\r\n\r\n        if ( args->flags & FT_OPEN_PARAMS )\r\n        {\r\n          num_params = args->num_params;\r\n          params     = args->params;\r\n        }\r\n\r\n        error = open_face( driver, stream, face_index,\r\n                           num_params, params, &face );\r\n        if ( !error )\r\n          goto Success;\r\n      }\r\n      else\r\n        error = FT_Err_Invalid_Handle;\r\n\r\n      FT_Stream_Free( stream, external_stream );\r\n      goto Fail;\r\n    }\r\n    else\r\n    {\r\n      error = FT_Err_Missing_Module;\r\n\r\n      /* check each font driver for an appropriate format */\r\n      cur   = library->modules;\r\n      limit = cur + library->num_modules;\r\n\r\n      for ( ; cur < limit; cur++ )\r\n      {\r\n        /* not all modules are font drivers, so check... */\r\n        if ( FT_MODULE_IS_DRIVER( cur[0] ) )\r\n        {\r\n          FT_Int         num_params = 0;\r\n          FT_Parameter*  params     = 0;\r\n\r\n\r\n          driver = FT_DRIVER( cur[0] );\r\n\r\n          if ( args->flags & FT_OPEN_PARAMS )\r\n          {\r\n            num_params = args->num_params;\r\n            params     = args->params;\r\n          }\r\n\r\n          error = open_face( driver, stream, face_index,\r\n                             num_params, params, &face );\r\n          if ( !error )\r\n            goto Success;\r\n\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n          if ( ft_strcmp( cur[0]->clazz->module_name, \"truetype\" ) == 0 &&\r\n               FT_ERROR_BASE( error ) == FT_Err_Table_Missing           )\r\n          {\r\n            /* TrueType but essential tables are missing */\r\n            if ( FT_Stream_Seek( stream, 0 ) )\r\n              break;\r\n\r\n            error = open_face_PS_from_sfnt_stream( library,\r\n                                                   stream,\r\n                                                   face_index,\r\n                                                   num_params,\r\n                                                   params,\r\n                                                   aface );\r\n            if ( !error )\r\n            {\r\n              FT_Stream_Free( stream, external_stream );\r\n              return error;\r\n            }\r\n          }\r\n#endif\r\n\r\n          if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )\r\n            goto Fail3;\r\n        }\r\n      }\r\n\r\n    Fail3:\r\n      /* If we are on the mac, and we get an                          */\r\n      /* FT_Err_Invalid_Stream_Operation it may be because we have an */\r\n      /* empty data fork, so we need to check the resource fork.      */\r\n      if ( FT_ERROR_BASE( error ) != FT_Err_Cannot_Open_Stream       &&\r\n           FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format      &&\r\n           FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation )\r\n        goto Fail2;\r\n\r\n#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )\r\n      error = load_mac_face( library, stream, face_index, aface, args );\r\n      if ( !error )\r\n      {\r\n        /* We don't want to go to Success here.  We've already done that. */\r\n        /* On the other hand, if we succeeded we still need to close this */\r\n        /* stream (we opened a different stream which extracted the       */\r\n        /* interesting information out of this stream here.  That stream  */\r\n        /* will still be open and the face will point to it).             */\r\n        FT_Stream_Free( stream, external_stream );\r\n        return error;\r\n      }\r\n\r\n      if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )\r\n        goto Fail2;\r\n#endif  /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */\r\n\r\n      /* no driver is able to handle this format */\r\n      error = FT_Err_Unknown_File_Format;\r\n\r\n  Fail2:\r\n      FT_Stream_Free( stream, external_stream );\r\n      goto Fail;\r\n    }\r\n\r\n  Success:\r\n    FT_TRACE4(( \"FT_Open_Face: New face object, adding to list\\n\" ));\r\n\r\n    /* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */\r\n    if ( external_stream )\r\n      face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;\r\n\r\n    /* add the face object to its driver's list */\r\n    if ( FT_NEW( node ) )\r\n      goto Fail;\r\n\r\n    node->data = face;\r\n    /* don't assume driver is the same as face->driver, so use */\r\n    /* face->driver instead.                                   */\r\n    FT_List_Add( &face->driver->faces_list, node );\r\n\r\n    /* now allocate a glyph slot object for the face */\r\n    FT_TRACE4(( \"FT_Open_Face: Creating glyph slot\\n\" ));\r\n\r\n    if ( face_index >= 0 )\r\n    {\r\n      error = FT_New_GlyphSlot( face, NULL );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* finally, allocate a size object for the face */\r\n      {\r\n        FT_Size  size;\r\n\r\n\r\n        FT_TRACE4(( \"FT_Open_Face: Creating size object\\n\" ));\r\n\r\n        error = FT_New_Size( face, &size );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        face->size = size;\r\n      }\r\n    }\r\n\r\n    /* some checks */\r\n\r\n    if ( FT_IS_SCALABLE( face ) )\r\n    {\r\n      if ( face->height < 0 )\r\n        face->height = (FT_Short)-face->height;\r\n\r\n      if ( !FT_HAS_VERTICAL( face ) )\r\n        face->max_advance_height = (FT_Short)face->height;\r\n    }\r\n\r\n    if ( FT_HAS_FIXED_SIZES( face ) )\r\n    {\r\n      FT_Int  i;\r\n\r\n\r\n      for ( i = 0; i < face->num_fixed_sizes; i++ )\r\n      {\r\n        FT_Bitmap_Size*  bsize = face->available_sizes + i;\r\n\r\n\r\n        if ( bsize->height < 0 )\r\n          bsize->height = (FT_Short)-bsize->height;\r\n        if ( bsize->x_ppem < 0 )\r\n          bsize->x_ppem = (FT_Short)-bsize->x_ppem;\r\n        if ( bsize->y_ppem < 0 )\r\n          bsize->y_ppem = -bsize->y_ppem;\r\n      }\r\n    }\r\n\r\n    /* initialize internal face data */\r\n    {\r\n      FT_Face_Internal  internal = face->internal;\r\n\r\n\r\n      internal->transform_matrix.xx = 0x10000L;\r\n      internal->transform_matrix.xy = 0;\r\n      internal->transform_matrix.yx = 0;\r\n      internal->transform_matrix.yy = 0x10000L;\r\n\r\n      internal->transform_delta.x = 0;\r\n      internal->transform_delta.y = 0;\r\n\r\n      internal->refcount = 1;\r\n    }\r\n\r\n    if ( aface )\r\n      *aface = face;\r\n    else\r\n      FT_Done_Face( face );\r\n\r\n    goto Exit;\r\n\r\n  Fail:\r\n    FT_Done_Face( face );\r\n\r\n  Exit:\r\n    FT_TRACE4(( \"FT_Open_Face: Return %d\\n\", error ));\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Attach_File( FT_Face      face,\r\n                  const char*  filepathname )\r\n  {\r\n    FT_Open_Args  open;\r\n\r\n\r\n    /* test for valid `face' delayed to FT_Attach_Stream() */\r\n\r\n    if ( !filepathname )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    open.stream   = NULL;\r\n    open.flags    = FT_OPEN_PATHNAME;\r\n    open.pathname = (char*)filepathname;\r\n\r\n    return FT_Attach_Stream( face, &open );\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Attach_Stream( FT_Face        face,\r\n                    FT_Open_Args*  parameters )\r\n  {\r\n    FT_Stream  stream;\r\n    FT_Error   error;\r\n    FT_Driver  driver;\r\n\r\n    FT_Driver_Class  clazz;\r\n\r\n\r\n    /* test for valid `parameters' delayed to FT_Stream_New() */\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    driver = face->driver;\r\n    if ( !driver )\r\n      return FT_Err_Invalid_Driver_Handle;\r\n\r\n    error = FT_Stream_New( driver->root.library, parameters, &stream );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* we implement FT_Attach_Stream in each driver through the */\r\n    /* `attach_file' interface                                  */\r\n\r\n    error = FT_Err_Unimplemented_Feature;\r\n    clazz = driver->clazz;\r\n    if ( clazz->attach_file )\r\n      error = clazz->attach_file( face, stream );\r\n\r\n    /* close the attached stream */\r\n    FT_Stream_Free( stream,\r\n                    (FT_Bool)( parameters->stream &&\r\n                               ( parameters->flags & FT_OPEN_STREAM ) ) );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Reference_Face( FT_Face  face )\r\n  {\r\n    face->internal->refcount++;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Done_Face( FT_Face  face )\r\n  {\r\n    FT_Error     error;\r\n    FT_Driver    driver;\r\n    FT_Memory    memory;\r\n    FT_ListNode  node;\r\n\r\n\r\n    error = FT_Err_Invalid_Face_Handle;\r\n    if ( face && face->driver )\r\n    {\r\n      face->internal->refcount--;\r\n      if ( face->internal->refcount > 0 )\r\n        error = FT_Err_Ok;\r\n      else\r\n      {\r\n        driver = face->driver;\r\n        memory = driver->root.memory;\r\n\r\n        /* find face in driver's list */\r\n        node = FT_List_Find( &driver->faces_list, face );\r\n        if ( node )\r\n        {\r\n          /* remove face object from the driver's list */\r\n          FT_List_Remove( &driver->faces_list, node );\r\n          FT_FREE( node );\r\n\r\n          /* now destroy the object proper */\r\n          destroy_face( memory, face, driver );\r\n          error = FT_Err_Ok;\r\n        }\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Size( FT_Face   face,\r\n               FT_Size  *asize )\r\n  {\r\n    FT_Error         error;\r\n    FT_Memory        memory;\r\n    FT_Driver        driver;\r\n    FT_Driver_Class  clazz;\r\n\r\n    FT_Size          size = 0;\r\n    FT_ListNode      node = 0;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( !asize )\r\n      return FT_Err_Invalid_Size_Handle;\r\n\r\n    if ( !face->driver )\r\n      return FT_Err_Invalid_Driver_Handle;\r\n\r\n    *asize = 0;\r\n\r\n    driver = face->driver;\r\n    clazz  = driver->clazz;\r\n    memory = face->memory;\r\n\r\n    /* Allocate new size object and perform basic initialisation */\r\n    if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) )\r\n      goto Exit;\r\n\r\n    size->face = face;\r\n\r\n    /* for now, do not use any internal fields in size objects */\r\n    size->internal = 0;\r\n\r\n    if ( clazz->init_size )\r\n      error = clazz->init_size( size );\r\n\r\n    /* in case of success, add to the face's list */\r\n    if ( !error )\r\n    {\r\n      *asize     = size;\r\n      node->data = size;\r\n      FT_List_Add( &face->sizes_list, node );\r\n    }\r\n\r\n  Exit:\r\n    if ( error )\r\n    {\r\n      FT_FREE( node );\r\n      FT_FREE( size );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Done_Size( FT_Size  size )\r\n  {\r\n    FT_Error     error;\r\n    FT_Driver    driver;\r\n    FT_Memory    memory;\r\n    FT_Face      face;\r\n    FT_ListNode  node;\r\n\r\n\r\n    if ( !size )\r\n      return FT_Err_Invalid_Size_Handle;\r\n\r\n    face = size->face;\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    driver = face->driver;\r\n    if ( !driver )\r\n      return FT_Err_Invalid_Driver_Handle;\r\n\r\n    memory = driver->root.memory;\r\n\r\n    error = FT_Err_Ok;\r\n    node  = FT_List_Find( &face->sizes_list, size );\r\n    if ( node )\r\n    {\r\n      FT_List_Remove( &face->sizes_list, node );\r\n      FT_FREE( node );\r\n\r\n      if ( face->size == size )\r\n      {\r\n        face->size = 0;\r\n        if ( face->sizes_list.head )\r\n          face->size = (FT_Size)(face->sizes_list.head->data);\r\n      }\r\n\r\n      destroy_size( memory, size, driver );\r\n    }\r\n    else\r\n      error = FT_Err_Invalid_Size_Handle;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Match_Size( FT_Face          face,\r\n                 FT_Size_Request  req,\r\n                 FT_Bool          ignore_width,\r\n                 FT_ULong*        size_index )\r\n  {\r\n    FT_Int   i;\r\n    FT_Long  w, h;\r\n\r\n\r\n    if ( !FT_HAS_FIXED_SIZES( face ) )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    /* FT_Bitmap_Size doesn't provide enough info... */\r\n    if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )\r\n      return FT_Err_Unimplemented_Feature;\r\n\r\n    w = FT_REQUEST_WIDTH ( req );\r\n    h = FT_REQUEST_HEIGHT( req );\r\n\r\n    if ( req->width && !req->height )\r\n      h = w;\r\n    else if ( !req->width && req->height )\r\n      w = h;\r\n\r\n    w = FT_PIX_ROUND( w );\r\n    h = FT_PIX_ROUND( h );\r\n\r\n    for ( i = 0; i < face->num_fixed_sizes; i++ )\r\n    {\r\n      FT_Bitmap_Size*  bsize = face->available_sizes + i;\r\n\r\n\r\n      if ( h != FT_PIX_ROUND( bsize->y_ppem ) )\r\n        continue;\r\n\r\n      if ( w == FT_PIX_ROUND( bsize->x_ppem ) || ignore_width )\r\n      {\r\n        if ( size_index )\r\n          *size_index = (FT_ULong)i;\r\n\r\n        return FT_Err_Ok;\r\n      }\r\n    }\r\n\r\n    return FT_Err_Invalid_Pixel_Size;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,\r\n                                  FT_Pos             advance )\r\n  {\r\n    FT_Pos  height = metrics->height;\r\n\r\n\r\n    /* compensate for glyph with bbox above/below the baseline */\r\n    if ( metrics->horiBearingY < 0 )\r\n    {\r\n      if ( height < metrics->horiBearingY )\r\n        height = metrics->horiBearingY;\r\n    }\r\n    else if ( metrics->horiBearingY > 0 )\r\n      height -= metrics->horiBearingY;\r\n\r\n    /* the factor 1.2 is a heuristical value */\r\n    if ( !advance )\r\n      advance = height * 12 / 10;\r\n\r\n    metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2;\r\n    metrics->vertBearingY = ( advance - height ) / 2;\r\n    metrics->vertAdvance  = advance;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_recompute_scaled_metrics( FT_Face           face,\r\n                               FT_Size_Metrics*  metrics )\r\n  {\r\n    /* Compute root ascender, descender, test height, and max_advance */\r\n\r\n#ifdef GRID_FIT_METRICS\r\n    metrics->ascender    = FT_PIX_CEIL( FT_MulFix( face->ascender,\r\n                                                   metrics->y_scale ) );\r\n\r\n    metrics->descender   = FT_PIX_FLOOR( FT_MulFix( face->descender,\r\n                                                    metrics->y_scale ) );\r\n\r\n    metrics->height      = FT_PIX_ROUND( FT_MulFix( face->height,\r\n                                                    metrics->y_scale ) );\r\n\r\n    metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,\r\n                                                    metrics->x_scale ) );\r\n#else /* !GRID_FIT_METRICS */\r\n    metrics->ascender    = FT_MulFix( face->ascender,\r\n                                      metrics->y_scale );\r\n\r\n    metrics->descender   = FT_MulFix( face->descender,\r\n                                      metrics->y_scale );\r\n\r\n    metrics->height      = FT_MulFix( face->height,\r\n                                      metrics->y_scale );\r\n\r\n    metrics->max_advance = FT_MulFix( face->max_advance_width,\r\n                                      metrics->x_scale );\r\n#endif /* !GRID_FIT_METRICS */\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Select_Metrics( FT_Face   face,\r\n                     FT_ULong  strike_index )\r\n  {\r\n    FT_Size_Metrics*  metrics;\r\n    FT_Bitmap_Size*   bsize;\r\n\r\n\r\n    metrics = &face->size->metrics;\r\n    bsize   = face->available_sizes + strike_index;\r\n\r\n    metrics->x_ppem = (FT_UShort)( ( bsize->x_ppem + 32 ) >> 6 );\r\n    metrics->y_ppem = (FT_UShort)( ( bsize->y_ppem + 32 ) >> 6 );\r\n\r\n    if ( FT_IS_SCALABLE( face ) )\r\n    {\r\n      metrics->x_scale = FT_DivFix( bsize->x_ppem,\r\n                                    face->units_per_EM );\r\n      metrics->y_scale = FT_DivFix( bsize->y_ppem,\r\n                                    face->units_per_EM );\r\n\r\n      ft_recompute_scaled_metrics( face, metrics );\r\n    }\r\n    else\r\n    {\r\n      metrics->x_scale     = 1L << 16;\r\n      metrics->y_scale     = 1L << 16;\r\n      metrics->ascender    = bsize->y_ppem;\r\n      metrics->descender   = 0;\r\n      metrics->height      = bsize->height << 6;\r\n      metrics->max_advance = bsize->x_ppem;\r\n    }\r\n\r\n    FT_TRACE5(( \"FT_Select_Metrics:\\n\" ));\r\n    FT_TRACE5(( \"  x scale: %d (%f)\\n\",\r\n                metrics->x_scale, metrics->x_scale / 65536.0 ));\r\n    FT_TRACE5(( \"  y scale: %d (%f)\\n\",\r\n                metrics->y_scale, metrics->y_scale / 65536.0 ));\r\n    FT_TRACE5(( \"  ascender: %f\\n\",    metrics->ascender / 64.0 ));\r\n    FT_TRACE5(( \"  descender: %f\\n\",   metrics->descender / 64.0 ));\r\n    FT_TRACE5(( \"  height: %f\\n\",      metrics->height / 64.0 ));\r\n    FT_TRACE5(( \"  max advance: %f\\n\", metrics->max_advance / 64.0 ));\r\n    FT_TRACE5(( \"  x ppem: %d\\n\",      metrics->x_ppem ));\r\n    FT_TRACE5(( \"  y ppem: %d\\n\",      metrics->y_ppem ));\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Request_Metrics( FT_Face          face,\r\n                      FT_Size_Request  req )\r\n  {\r\n    FT_Size_Metrics*  metrics;\r\n\r\n\r\n    metrics = &face->size->metrics;\r\n\r\n    if ( FT_IS_SCALABLE( face ) )\r\n    {\r\n      FT_Long  w = 0, h = 0, scaled_w = 0, scaled_h = 0;\r\n\r\n\r\n      switch ( req->type )\r\n      {\r\n      case FT_SIZE_REQUEST_TYPE_NOMINAL:\r\n        w = h = face->units_per_EM;\r\n        break;\r\n\r\n      case FT_SIZE_REQUEST_TYPE_REAL_DIM:\r\n        w = h = face->ascender - face->descender;\r\n        break;\r\n\r\n      case FT_SIZE_REQUEST_TYPE_BBOX:\r\n        w = face->bbox.xMax - face->bbox.xMin;\r\n        h = face->bbox.yMax - face->bbox.yMin;\r\n        break;\r\n\r\n      case FT_SIZE_REQUEST_TYPE_CELL:\r\n        w = face->max_advance_width;\r\n        h = face->ascender - face->descender;\r\n        break;\r\n\r\n      case FT_SIZE_REQUEST_TYPE_SCALES:\r\n        metrics->x_scale = (FT_Fixed)req->width;\r\n        metrics->y_scale = (FT_Fixed)req->height;\r\n        if ( !metrics->x_scale )\r\n          metrics->x_scale = metrics->y_scale;\r\n        else if ( !metrics->y_scale )\r\n          metrics->y_scale = metrics->x_scale;\r\n        goto Calculate_Ppem;\r\n\r\n      case FT_SIZE_REQUEST_TYPE_MAX:\r\n        break;\r\n      }\r\n\r\n      /* to be on the safe side */\r\n      if ( w < 0 )\r\n        w = -w;\r\n\r\n      if ( h < 0 )\r\n        h = -h;\r\n\r\n      scaled_w = FT_REQUEST_WIDTH ( req );\r\n      scaled_h = FT_REQUEST_HEIGHT( req );\r\n\r\n      /* determine scales */\r\n      if ( req->width )\r\n      {\r\n        metrics->x_scale = FT_DivFix( scaled_w, w );\r\n\r\n        if ( req->height )\r\n        {\r\n          metrics->y_scale = FT_DivFix( scaled_h, h );\r\n\r\n          if ( req->type == FT_SIZE_REQUEST_TYPE_CELL )\r\n          {\r\n            if ( metrics->y_scale > metrics->x_scale )\r\n              metrics->y_scale = metrics->x_scale;\r\n            else\r\n              metrics->x_scale = metrics->y_scale;\r\n          }\r\n        }\r\n        else\r\n        {\r\n          metrics->y_scale = metrics->x_scale;\r\n          scaled_h = FT_MulDiv( scaled_w, h, w );\r\n        }\r\n      }\r\n      else\r\n      {\r\n        metrics->x_scale = metrics->y_scale = FT_DivFix( scaled_h, h );\r\n        scaled_w = FT_MulDiv( scaled_h, w, h );\r\n      }\r\n\r\n  Calculate_Ppem:\r\n      /* calculate the ppems */\r\n      if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )\r\n      {\r\n        scaled_w = FT_MulFix( face->units_per_EM, metrics->x_scale );\r\n        scaled_h = FT_MulFix( face->units_per_EM, metrics->y_scale );\r\n      }\r\n\r\n      metrics->x_ppem = (FT_UShort)( ( scaled_w + 32 ) >> 6 );\r\n      metrics->y_ppem = (FT_UShort)( ( scaled_h + 32 ) >> 6 );\r\n\r\n      ft_recompute_scaled_metrics( face, metrics );\r\n    }\r\n    else\r\n    {\r\n      FT_ZERO( metrics );\r\n      metrics->x_scale = 1L << 16;\r\n      metrics->y_scale = 1L << 16;\r\n    }\r\n\r\n    FT_TRACE5(( \"FT_Request_Metrics:\\n\" ));\r\n    FT_TRACE5(( \"  x scale: %d (%f)\\n\",\r\n                metrics->x_scale, metrics->x_scale / 65536.0 ));\r\n    FT_TRACE5(( \"  y scale: %d (%f)\\n\",\r\n                metrics->y_scale, metrics->y_scale / 65536.0 ));\r\n    FT_TRACE5(( \"  ascender: %f\\n\",    metrics->ascender / 64.0 ));\r\n    FT_TRACE5(( \"  descender: %f\\n\",   metrics->descender / 64.0 ));\r\n    FT_TRACE5(( \"  height: %f\\n\",      metrics->height / 64.0 ));\r\n    FT_TRACE5(( \"  max advance: %f\\n\", metrics->max_advance / 64.0 ));\r\n    FT_TRACE5(( \"  x ppem: %d\\n\",      metrics->x_ppem ));\r\n    FT_TRACE5(( \"  y ppem: %d\\n\",      metrics->y_ppem ));\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Select_Size( FT_Face  face,\r\n                  FT_Int   strike_index )\r\n  {\r\n    FT_Driver_Class  clazz;\r\n\r\n\r\n    if ( !face || !FT_HAS_FIXED_SIZES( face ) )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( strike_index < 0 || strike_index >= face->num_fixed_sizes )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    clazz = face->driver->clazz;\r\n\r\n    if ( clazz->select_size )\r\n    {\r\n      FT_Error  error;\r\n\r\n\r\n      error = clazz->select_size( face->size, (FT_ULong)strike_index );\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n      {\r\n        FT_Size_Metrics*  metrics = &face->size->metrics;\r\n\r\n\r\n        FT_TRACE5(( \"FT_Select_Size (font driver's `select_size'):\\n\" ));\r\n        FT_TRACE5(( \"  x scale: %d (%f)\\n\",\r\n                    metrics->x_scale, metrics->x_scale / 65536.0 ));\r\n        FT_TRACE5(( \"  y scale: %d (%f)\\n\",\r\n                    metrics->y_scale, metrics->y_scale / 65536.0 ));\r\n        FT_TRACE5(( \"  ascender: %f\\n\",    metrics->ascender / 64.0 ));\r\n        FT_TRACE5(( \"  descender: %f\\n\",   metrics->descender / 64.0 ));\r\n        FT_TRACE5(( \"  height: %f\\n\",      metrics->height / 64.0 ));\r\n        FT_TRACE5(( \"  max advance: %f\\n\", metrics->max_advance / 64.0 ));\r\n        FT_TRACE5(( \"  x ppem: %d\\n\",      metrics->x_ppem ));\r\n        FT_TRACE5(( \"  y ppem: %d\\n\",      metrics->y_ppem ));\r\n      }\r\n#endif\r\n\r\n      return error;\r\n    }\r\n\r\n    FT_Select_Metrics( face, (FT_ULong)strike_index );\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Request_Size( FT_Face          face,\r\n                   FT_Size_Request  req )\r\n  {\r\n    FT_Driver_Class  clazz;\r\n    FT_ULong         strike_index;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( !req || req->width < 0 || req->height < 0 ||\r\n         req->type >= FT_SIZE_REQUEST_TYPE_MAX )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    clazz = face->driver->clazz;\r\n\r\n    if ( clazz->request_size )\r\n    {\r\n      FT_Error  error;\r\n\r\n\r\n      error = clazz->request_size( face->size, req );\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n      {\r\n        FT_Size_Metrics*  metrics = &face->size->metrics;\r\n\r\n\r\n        FT_TRACE5(( \"FT_Request_Size (font driver's `request_size'):\\n\" ));\r\n        FT_TRACE5(( \"  x scale: %d (%f)\\n\",\r\n                    metrics->x_scale, metrics->x_scale / 65536.0 ));\r\n        FT_TRACE5(( \"  y scale: %d (%f)\\n\",\r\n                    metrics->y_scale, metrics->y_scale / 65536.0 ));\r\n        FT_TRACE5(( \"  ascender: %f\\n\",    metrics->ascender / 64.0 ));\r\n        FT_TRACE5(( \"  descender: %f\\n\",   metrics->descender / 64.0 ));\r\n        FT_TRACE5(( \"  height: %f\\n\",      metrics->height / 64.0 ));\r\n        FT_TRACE5(( \"  max advance: %f\\n\", metrics->max_advance / 64.0 ));\r\n        FT_TRACE5(( \"  x ppem: %d\\n\",      metrics->x_ppem ));\r\n        FT_TRACE5(( \"  y ppem: %d\\n\",      metrics->y_ppem ));\r\n      }\r\n#endif\r\n\r\n      return error;\r\n    }\r\n\r\n    /*\r\n     * The reason that a driver doesn't have `request_size' defined is\r\n     * either that the scaling here suffices or that the supported formats\r\n     * are bitmap-only and size matching is not implemented.\r\n     *\r\n     * In the latter case, a simple size matching is done.\r\n     */\r\n    if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) )\r\n    {\r\n      FT_Error  error;\r\n\r\n\r\n      error = FT_Match_Size( face, req, 0, &strike_index );\r\n      if ( error )\r\n        return error;\r\n\r\n      FT_TRACE3(( \"FT_Request_Size: bitmap strike %lu matched\\n\",\r\n                  strike_index ));\r\n\r\n      return FT_Select_Size( face, (FT_Int)strike_index );\r\n    }\r\n\r\n    FT_Request_Metrics( face, req );\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_Char_Size( FT_Face     face,\r\n                    FT_F26Dot6  char_width,\r\n                    FT_F26Dot6  char_height,\r\n                    FT_UInt     horz_resolution,\r\n                    FT_UInt     vert_resolution )\r\n  {\r\n    FT_Size_RequestRec  req;\r\n\r\n\r\n    if ( !char_width )\r\n      char_width = char_height;\r\n    else if ( !char_height )\r\n      char_height = char_width;\r\n\r\n    if ( !horz_resolution )\r\n      horz_resolution = vert_resolution;\r\n    else if ( !vert_resolution )\r\n      vert_resolution = horz_resolution;\r\n\r\n    if ( char_width  < 1 * 64 )\r\n      char_width  = 1 * 64;\r\n    if ( char_height < 1 * 64 )\r\n      char_height = 1 * 64;\r\n\r\n    if ( !horz_resolution )\r\n      horz_resolution = vert_resolution = 72;\r\n\r\n    req.type           = FT_SIZE_REQUEST_TYPE_NOMINAL;\r\n    req.width          = char_width;\r\n    req.height         = char_height;\r\n    req.horiResolution = horz_resolution;\r\n    req.vertResolution = vert_resolution;\r\n\r\n    return FT_Request_Size( face, &req );\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_Pixel_Sizes( FT_Face  face,\r\n                      FT_UInt  pixel_width,\r\n                      FT_UInt  pixel_height )\r\n  {\r\n    FT_Size_RequestRec  req;\r\n\r\n\r\n    if ( pixel_width == 0 )\r\n      pixel_width = pixel_height;\r\n    else if ( pixel_height == 0 )\r\n      pixel_height = pixel_width;\r\n\r\n    if ( pixel_width  < 1 )\r\n      pixel_width  = 1;\r\n    if ( pixel_height < 1 )\r\n      pixel_height = 1;\r\n\r\n    /* use `>=' to avoid potential compiler warning on 16bit platforms */\r\n    if ( pixel_width  >= 0xFFFFU )\r\n      pixel_width  = 0xFFFFU;\r\n    if ( pixel_height >= 0xFFFFU )\r\n      pixel_height = 0xFFFFU;\r\n\r\n    req.type           = FT_SIZE_REQUEST_TYPE_NOMINAL;\r\n    req.width          = pixel_width << 6;\r\n    req.height         = pixel_height << 6;\r\n    req.horiResolution = 0;\r\n    req.vertResolution = 0;\r\n\r\n    return FT_Request_Size( face, &req );\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Kerning( FT_Face     face,\r\n                  FT_UInt     left_glyph,\r\n                  FT_UInt     right_glyph,\r\n                  FT_UInt     kern_mode,\r\n                  FT_Vector  *akerning )\r\n  {\r\n    FT_Error   error = FT_Err_Ok;\r\n    FT_Driver  driver;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( !akerning )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    driver = face->driver;\r\n\r\n    akerning->x = 0;\r\n    akerning->y = 0;\r\n\r\n    if ( driver->clazz->get_kerning )\r\n    {\r\n      error = driver->clazz->get_kerning( face,\r\n                                          left_glyph,\r\n                                          right_glyph,\r\n                                          akerning );\r\n      if ( !error )\r\n      {\r\n        if ( kern_mode != FT_KERNING_UNSCALED )\r\n        {\r\n          akerning->x = FT_MulFix( akerning->x, face->size->metrics.x_scale );\r\n          akerning->y = FT_MulFix( akerning->y, face->size->metrics.y_scale );\r\n\r\n          if ( kern_mode != FT_KERNING_UNFITTED )\r\n          {\r\n            /* we scale down kerning values for small ppem values */\r\n            /* to avoid that rounding makes them too big.         */\r\n            /* `25' has been determined heuristically.            */\r\n            if ( face->size->metrics.x_ppem < 25 )\r\n              akerning->x = FT_MulDiv( akerning->x,\r\n                                       face->size->metrics.x_ppem, 25 );\r\n            if ( face->size->metrics.y_ppem < 25 )\r\n              akerning->y = FT_MulDiv( akerning->y,\r\n                                       face->size->metrics.y_ppem, 25 );\r\n\r\n            akerning->x = FT_PIX_ROUND( akerning->x );\r\n            akerning->y = FT_PIX_ROUND( akerning->y );\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Track_Kerning( FT_Face    face,\r\n                        FT_Fixed   point_size,\r\n                        FT_Int     degree,\r\n                        FT_Fixed*  akerning )\r\n  {\r\n    FT_Service_Kerning  service;\r\n    FT_Error            error = FT_Err_Ok;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( !akerning )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    FT_FACE_FIND_SERVICE( face, service, KERNING );\r\n    if ( !service )\r\n      return FT_Err_Unimplemented_Feature;\r\n\r\n    error = service->get_track( face,\r\n                                point_size,\r\n                                degree,\r\n                                akerning );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Select_Charmap( FT_Face      face,\r\n                     FT_Encoding  encoding )\r\n  {\r\n    FT_CharMap*  cur;\r\n    FT_CharMap*  limit;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    if ( encoding == FT_ENCODING_NONE )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* FT_ENCODING_UNICODE is special.  We try to find the `best' Unicode */\r\n    /* charmap available, i.e., one with UCS-4 characters, if possible.   */\r\n    /*                                                                    */\r\n    /* This is done by find_unicode_charmap() above, to share code.       */\r\n    if ( encoding == FT_ENCODING_UNICODE )\r\n      return find_unicode_charmap( face );\r\n\r\n    cur = face->charmaps;\r\n    if ( !cur )\r\n      return FT_Err_Invalid_CharMap_Handle;\r\n\r\n    limit = cur + face->num_charmaps;\r\n\r\n    for ( ; cur < limit; cur++ )\r\n    {\r\n      if ( cur[0]->encoding == encoding )\r\n      {\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n        if ( cur - face->charmaps > FT_MAX_CHARMAP_CACHEABLE )\r\n        {\r\n          FT_ERROR(( \"FT_Select_Charmap: requested charmap is found (%d), \"\r\n                     \"but in too late position to cache\\n\",\r\n                     cur - face->charmaps ));\r\n          continue;\r\n        }\r\n#endif\r\n        face->charmap = cur[0];\r\n        return 0;\r\n      }\r\n    }\r\n\r\n    return FT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_Charmap( FT_Face     face,\r\n                  FT_CharMap  charmap )\r\n  {\r\n    FT_CharMap*  cur;\r\n    FT_CharMap*  limit;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    cur = face->charmaps;\r\n    if ( !cur )\r\n      return FT_Err_Invalid_CharMap_Handle;\r\n    if ( FT_Get_CMap_Format( charmap ) == 14 )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    limit = cur + face->num_charmaps;\r\n\r\n    for ( ; cur < limit; cur++ )\r\n    {\r\n      if ( cur[0] == charmap )\r\n      {\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n        if ( cur - face->charmaps > FT_MAX_CHARMAP_CACHEABLE )\r\n        {\r\n          FT_ERROR(( \"FT_Set_Charmap: requested charmap is found (%d), \"\r\n                     \"but in too late position to cache\\n\",\r\n                     cur - face->charmaps ));\r\n          continue;\r\n        }\r\n#endif\r\n        face->charmap = cur[0];\r\n        return 0;\r\n      }\r\n    }\r\n    return FT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Int )\r\n  FT_Get_Charmap_Index( FT_CharMap  charmap )\r\n  {\r\n    FT_Int  i;\r\n\r\n\r\n    if ( !charmap || !charmap->face )\r\n      return -1;\r\n\r\n    for ( i = 0; i < charmap->face->num_charmaps; i++ )\r\n      if ( charmap->face->charmaps[i] == charmap )\r\n        break;\r\n\r\n    FT_ASSERT( i < charmap->face->num_charmaps );\r\n\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n    if ( i > FT_MAX_CHARMAP_CACHEABLE )\r\n    {\r\n      FT_ERROR(( \"FT_Get_Charmap_Index: requested charmap is found (%d), \"\r\n                 \"but in too late position to cache\\n\",\r\n                 i ));\r\n      return -i;\r\n    }\r\n#endif\r\n    return i;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_cmap_done_internal( FT_CMap  cmap )\r\n  {\r\n    FT_CMap_Class  clazz  = cmap->clazz;\r\n    FT_Face        face   = cmap->charmap.face;\r\n    FT_Memory      memory = FT_FACE_MEMORY(face);\r\n\r\n\r\n    if ( clazz->done )\r\n      clazz->done( cmap );\r\n\r\n    FT_FREE( cmap );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_CMap_Done( FT_CMap  cmap )\r\n  {\r\n    if ( cmap )\r\n    {\r\n      FT_Face    face   = cmap->charmap.face;\r\n      FT_Memory  memory = FT_FACE_MEMORY( face );\r\n      FT_Error   error;\r\n      FT_Int     i, j;\r\n\r\n\r\n      for ( i = 0; i < face->num_charmaps; i++ )\r\n      {\r\n        if ( (FT_CMap)face->charmaps[i] == cmap )\r\n        {\r\n          FT_CharMap  last_charmap = face->charmaps[face->num_charmaps - 1];\r\n\r\n\r\n          if ( FT_RENEW_ARRAY( face->charmaps,\r\n                               face->num_charmaps,\r\n                               face->num_charmaps - 1 ) )\r\n            return;\r\n\r\n          /* remove it from our list of charmaps */\r\n          for ( j = i + 1; j < face->num_charmaps; j++ )\r\n          {\r\n            if ( j == face->num_charmaps - 1 )\r\n              face->charmaps[j - 1] = last_charmap;\r\n            else\r\n              face->charmaps[j - 1] = face->charmaps[j];\r\n          }\r\n\r\n          face->num_charmaps--;\r\n\r\n          if ( (FT_CMap)face->charmap == cmap )\r\n            face->charmap = NULL;\r\n\r\n          ft_cmap_done_internal( cmap );\r\n\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_CMap_New( FT_CMap_Class  clazz,\r\n               FT_Pointer     init_data,\r\n               FT_CharMap     charmap,\r\n               FT_CMap       *acmap )\r\n  {\r\n    FT_Error   error = FT_Err_Ok;\r\n    FT_Face    face;\r\n    FT_Memory  memory;\r\n    FT_CMap    cmap = NULL;\r\n\r\n\r\n    if ( clazz == NULL || charmap == NULL || charmap->face == NULL )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    face   = charmap->face;\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n    if ( !FT_ALLOC( cmap, clazz->size ) )\r\n    {\r\n      cmap->charmap = *charmap;\r\n      cmap->clazz   = clazz;\r\n\r\n      if ( clazz->init )\r\n      {\r\n        error = clazz->init( cmap, init_data );\r\n        if ( error )\r\n          goto Fail;\r\n      }\r\n\r\n      /* add it to our list of charmaps */\r\n      if ( FT_RENEW_ARRAY( face->charmaps,\r\n                           face->num_charmaps,\r\n                           face->num_charmaps + 1 ) )\r\n        goto Fail;\r\n\r\n      face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap;\r\n    }\r\n\r\n  Exit:\r\n    if ( acmap )\r\n      *acmap = cmap;\r\n\r\n    return error;\r\n\r\n  Fail:\r\n    ft_cmap_done_internal( cmap );\r\n    cmap = NULL;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt )\r\n  FT_Get_Char_Index( FT_Face   face,\r\n                     FT_ULong  charcode )\r\n  {\r\n    FT_UInt  result = 0;\r\n\r\n\r\n    if ( face && face->charmap )\r\n    {\r\n      FT_CMap  cmap = FT_CMAP( face->charmap );\r\n\r\n\r\n      if ( charcode > 0xFFFFFFFFUL )\r\n      {\r\n        FT_TRACE1(( \"FT_Get_Char_Index: too large charcode\" ));\r\n        FT_TRACE1(( \" 0x%x is truncated\\n\", charcode ));\r\n      }\r\n      result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_ULong )\r\n  FT_Get_First_Char( FT_Face   face,\r\n                     FT_UInt  *agindex )\r\n  {\r\n    FT_ULong  result = 0;\r\n    FT_UInt   gindex = 0;\r\n\r\n\r\n    if ( face && face->charmap && face->num_glyphs )\r\n    {\r\n      gindex = FT_Get_Char_Index( face, 0 );\r\n      if ( gindex == 0 || gindex >= (FT_UInt)face->num_glyphs )\r\n        result = FT_Get_Next_Char( face, 0, &gindex );\r\n    }\r\n\r\n    if ( agindex )\r\n      *agindex = gindex;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_ULong )\r\n  FT_Get_Next_Char( FT_Face   face,\r\n                    FT_ULong  charcode,\r\n                    FT_UInt  *agindex )\r\n  {\r\n    FT_ULong  result = 0;\r\n    FT_UInt   gindex = 0;\r\n\r\n\r\n    if ( face && face->charmap && face->num_glyphs )\r\n    {\r\n      FT_UInt32  code = (FT_UInt32)charcode;\r\n      FT_CMap    cmap = FT_CMAP( face->charmap );\r\n\r\n\r\n      do {\r\n        gindex = cmap->clazz->char_next( cmap, &code );\r\n      } while ( gindex >= (FT_UInt)face->num_glyphs );\r\n\r\n      result = ( gindex == 0 ) ? 0 : code;\r\n    }\r\n\r\n    if ( agindex )\r\n      *agindex = gindex;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt )\r\n  FT_Face_GetCharVariantIndex( FT_Face   face,\r\n                               FT_ULong  charcode,\r\n                               FT_ULong  variantSelector )\r\n  {\r\n    FT_UInt  result = 0;\r\n\r\n\r\n    if ( face && face->charmap &&\r\n        face->charmap->encoding == FT_ENCODING_UNICODE )\r\n    {\r\n      FT_CharMap  charmap = find_variant_selector_charmap( face );\r\n      FT_CMap     ucmap = FT_CMAP( face->charmap );\r\n\r\n\r\n      if ( charmap != NULL )\r\n      {\r\n        FT_CMap  vcmap = FT_CMAP( charmap );\r\n\r\n\r\n        if ( charcode > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"FT_Get_Char_Index: too large charcode\" ));\r\n          FT_TRACE1(( \" 0x%x is truncated\\n\", charcode ));\r\n        }\r\n        if ( variantSelector > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"FT_Get_Char_Index: too large variantSelector\" ));\r\n          FT_TRACE1(( \" 0x%x is truncated\\n\", variantSelector ));\r\n        }\r\n\r\n        result = vcmap->clazz->char_var_index( vcmap, ucmap,\r\n                                               (FT_UInt32)charcode,\r\n                                               (FT_UInt32)variantSelector );\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Int )\r\n  FT_Face_GetCharVariantIsDefault( FT_Face   face,\r\n                                   FT_ULong  charcode,\r\n                                   FT_ULong  variantSelector )\r\n  {\r\n    FT_Int  result = -1;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_CharMap  charmap = find_variant_selector_charmap( face );\r\n\r\n\r\n      if ( charmap != NULL )\r\n      {\r\n        FT_CMap  vcmap = FT_CMAP( charmap );\r\n\r\n\r\n        if ( charcode > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"FT_Get_Char_Index: too large charcode\" ));\r\n          FT_TRACE1(( \" 0x%x is truncated\\n\", charcode ));\r\n        }\r\n        if ( variantSelector > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"FT_Get_Char_Index: too large variantSelector\" ));\r\n          FT_TRACE1(( \" 0x%x is truncated\\n\", variantSelector ));\r\n        }\r\n\r\n        result = vcmap->clazz->char_var_default( vcmap,\r\n                                                 (FT_UInt32)charcode,\r\n                                                 (FT_UInt32)variantSelector );\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt32* )\r\n  FT_Face_GetVariantSelectors( FT_Face  face )\r\n  {\r\n    FT_UInt32  *result = NULL;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_CharMap  charmap = find_variant_selector_charmap( face );\r\n\r\n\r\n      if ( charmap != NULL )\r\n      {\r\n        FT_CMap    vcmap  = FT_CMAP( charmap );\r\n        FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n        result = vcmap->clazz->variant_list( vcmap, memory );\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt32* )\r\n  FT_Face_GetVariantsOfChar( FT_Face   face,\r\n                             FT_ULong  charcode )\r\n  {\r\n    FT_UInt32  *result = NULL;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_CharMap  charmap = find_variant_selector_charmap( face );\r\n\r\n\r\n      if ( charmap != NULL )\r\n      {\r\n        FT_CMap    vcmap  = FT_CMAP( charmap );\r\n        FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n        if ( charcode > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"FT_Get_Char_Index: too large charcode\" ));\r\n          FT_TRACE1(( \" 0x%x is truncated\\n\", charcode ));\r\n        }\r\n\r\n        result = vcmap->clazz->charvariant_list( vcmap, memory,\r\n                                                 (FT_UInt32)charcode );\r\n      }\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt32* )\r\n  FT_Face_GetCharsOfVariant( FT_Face   face,\r\n                             FT_ULong  variantSelector )\r\n  {\r\n    FT_UInt32  *result = NULL;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_CharMap  charmap = find_variant_selector_charmap( face );\r\n\r\n\r\n      if ( charmap != NULL )\r\n      {\r\n        FT_CMap    vcmap  = FT_CMAP( charmap );\r\n        FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n        if ( variantSelector > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"FT_Get_Char_Index: too large variantSelector\" ));\r\n          FT_TRACE1(( \" 0x%x is truncated\\n\", variantSelector ));\r\n        }\r\n\r\n        result = vcmap->clazz->variantchar_list( vcmap, memory,\r\n                                                 (FT_UInt32)variantSelector );\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt )\r\n  FT_Get_Name_Index( FT_Face     face,\r\n                     FT_String*  glyph_name )\r\n  {\r\n    FT_UInt  result = 0;\r\n\r\n\r\n    if ( face && FT_HAS_GLYPH_NAMES( face ) )\r\n    {\r\n      FT_Service_GlyphDict  service;\r\n\r\n\r\n      FT_FACE_LOOKUP_SERVICE( face,\r\n                              service,\r\n                              GLYPH_DICT );\r\n\r\n      if ( service && service->name_index )\r\n        result = service->name_index( face, glyph_name );\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Glyph_Name( FT_Face     face,\r\n                     FT_UInt     glyph_index,\r\n                     FT_Pointer  buffer,\r\n                     FT_UInt     buffer_max )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n\r\n\r\n    /* clean up buffer */\r\n    if ( buffer && buffer_max > 0 )\r\n      ((FT_Byte*)buffer)[0] = 0;\r\n\r\n    if ( face                                     &&\r\n         (FT_Long)glyph_index <= face->num_glyphs &&\r\n         FT_HAS_GLYPH_NAMES( face )               )\r\n    {\r\n      FT_Service_GlyphDict  service;\r\n\r\n\r\n      FT_FACE_LOOKUP_SERVICE( face,\r\n                              service,\r\n                              GLYPH_DICT );\r\n\r\n      if ( service && service->get_name )\r\n        error = service->get_name( face, glyph_index, buffer, buffer_max );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( const char* )\r\n  FT_Get_Postscript_Name( FT_Face  face )\r\n  {\r\n    const char*  result = NULL;\r\n\r\n\r\n    if ( !face )\r\n      goto Exit;\r\n\r\n    if ( !result )\r\n    {\r\n      FT_Service_PsFontName  service;\r\n\r\n\r\n      FT_FACE_LOOKUP_SERVICE( face,\r\n                              service,\r\n                              POSTSCRIPT_FONT_NAME );\r\n\r\n      if ( service && service->get_ps_font_name )\r\n        result = service->get_ps_font_name( face );\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in tttables.h */\r\n\r\n  FT_EXPORT_DEF( void* )\r\n  FT_Get_Sfnt_Table( FT_Face      face,\r\n                     FT_Sfnt_Tag  tag )\r\n  {\r\n    void*                  table = 0;\r\n    FT_Service_SFNT_Table  service;\r\n\r\n\r\n    if ( face && FT_IS_SFNT( face ) )\r\n    {\r\n      FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );\r\n      if ( service != NULL )\r\n        table = service->get_table( face, tag );\r\n    }\r\n\r\n    return table;\r\n  }\r\n\r\n\r\n  /* documentation is in tttables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Load_Sfnt_Table( FT_Face    face,\r\n                      FT_ULong   tag,\r\n                      FT_Long    offset,\r\n                      FT_Byte*   buffer,\r\n                      FT_ULong*  length )\r\n  {\r\n    FT_Service_SFNT_Table  service;\r\n\r\n\r\n    if ( !face || !FT_IS_SFNT( face ) )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );\r\n    if ( service == NULL )\r\n      return FT_Err_Unimplemented_Feature;\r\n\r\n    return service->load_table( face, tag, offset, buffer, length );\r\n  }\r\n\r\n\r\n  /* documentation is in tttables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Sfnt_Table_Info( FT_Face    face,\r\n                      FT_UInt    table_index,\r\n                      FT_ULong  *tag,\r\n                      FT_ULong  *length )\r\n  {\r\n    FT_Service_SFNT_Table  service;\r\n    FT_ULong               offset;\r\n\r\n\r\n    if ( !face || !FT_IS_SFNT( face ) )\r\n      return FT_Err_Invalid_Face_Handle;\r\n\r\n    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );\r\n    if ( service == NULL )\r\n      return FT_Err_Unimplemented_Feature;\r\n\r\n    return service->table_info( face, table_index, tag, &offset, length );\r\n  }\r\n\r\n\r\n  /* documentation is in tttables.h */\r\n\r\n  FT_EXPORT_DEF( FT_ULong )\r\n  FT_Get_CMap_Language_ID( FT_CharMap  charmap )\r\n  {\r\n    FT_Service_TTCMaps  service;\r\n    FT_Face             face;\r\n    TT_CMapInfo         cmap_info;\r\n\r\n\r\n    if ( !charmap || !charmap->face )\r\n      return 0;\r\n\r\n    face = charmap->face;\r\n    FT_FACE_FIND_SERVICE( face, service, TT_CMAP );\r\n    if ( service == NULL )\r\n      return 0;\r\n    if ( service->get_cmap_info( charmap, &cmap_info ))\r\n      return 0;\r\n\r\n    return cmap_info.language;\r\n  }\r\n\r\n\r\n  /* documentation is in tttables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_Get_CMap_Format( FT_CharMap  charmap )\r\n  {\r\n    FT_Service_TTCMaps  service;\r\n    FT_Face             face;\r\n    TT_CMapInfo         cmap_info;\r\n\r\n\r\n    if ( !charmap || !charmap->face )\r\n      return -1;\r\n\r\n    face = charmap->face;\r\n    FT_FACE_FIND_SERVICE( face, service, TT_CMAP );\r\n    if ( service == NULL )\r\n      return -1;\r\n    if ( service->get_cmap_info( charmap, &cmap_info ))\r\n      return -1;\r\n\r\n    return cmap_info.format;\r\n  }\r\n\r\n\r\n  /* documentation is in ftsizes.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Activate_Size( FT_Size  size )\r\n  {\r\n    FT_Face  face;\r\n\r\n\r\n    if ( size == NULL )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    face = size->face;\r\n    if ( face == NULL || face->driver == NULL )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* we don't need anything more complex than that; all size objects */\r\n    /* are already listed by the face                                  */\r\n    face->size = size;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                        R E N D E R E R S                        ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* lookup a renderer by glyph format in the library's list */\r\n  FT_BASE_DEF( FT_Renderer )\r\n  FT_Lookup_Renderer( FT_Library       library,\r\n                      FT_Glyph_Format  format,\r\n                      FT_ListNode*     node )\r\n  {\r\n    FT_ListNode  cur;\r\n    FT_Renderer  result = 0;\r\n\r\n\r\n    if ( !library )\r\n      goto Exit;\r\n\r\n    cur = library->renderers.head;\r\n\r\n    if ( node )\r\n    {\r\n      if ( *node )\r\n        cur = (*node)->next;\r\n      *node = 0;\r\n    }\r\n\r\n    while ( cur )\r\n    {\r\n      FT_Renderer  renderer = FT_RENDERER( cur->data );\r\n\r\n\r\n      if ( renderer->glyph_format == format )\r\n      {\r\n        if ( node )\r\n          *node = cur;\r\n\r\n        result = renderer;\r\n        break;\r\n      }\r\n      cur = cur->next;\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n  static FT_Renderer\r\n  ft_lookup_glyph_renderer( FT_GlyphSlot  slot )\r\n  {\r\n    FT_Face      face    = slot->face;\r\n    FT_Library   library = FT_FACE_LIBRARY( face );\r\n    FT_Renderer  result  = library->cur_renderer;\r\n\r\n\r\n    if ( !result || result->glyph_format != slot->format )\r\n      result = FT_Lookup_Renderer( library, slot->format, 0 );\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_set_current_renderer( FT_Library  library )\r\n  {\r\n    FT_Renderer  renderer;\r\n\r\n\r\n    renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE, 0 );\r\n    library->cur_renderer = renderer;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_add_renderer( FT_Module  module )\r\n  {\r\n    FT_Library   library = module->library;\r\n    FT_Memory    memory  = library->memory;\r\n    FT_Error     error;\r\n    FT_ListNode  node    = NULL;\r\n\r\n\r\n    if ( FT_NEW( node ) )\r\n      goto Exit;\r\n\r\n    {\r\n      FT_Renderer         render = FT_RENDERER( module );\r\n      FT_Renderer_Class*  clazz  = (FT_Renderer_Class*)module->clazz;\r\n\r\n\r\n      render->clazz        = clazz;\r\n      render->glyph_format = clazz->glyph_format;\r\n\r\n      /* allocate raster object if needed */\r\n      if ( clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&\r\n           clazz->raster_class->raster_new                )\r\n      {\r\n        error = clazz->raster_class->raster_new( memory, &render->raster );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        render->raster_render = clazz->raster_class->raster_render;\r\n        render->render        = clazz->render_glyph;\r\n      }\r\n\r\n      /* add to list */\r\n      node->data = module;\r\n      FT_List_Add( &library->renderers, node );\r\n\r\n      ft_set_current_renderer( library );\r\n    }\r\n\r\n  Fail:\r\n    if ( error )\r\n      FT_FREE( node );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_remove_renderer( FT_Module  module )\r\n  {\r\n    FT_Library   library = module->library;\r\n    FT_Memory    memory  = library->memory;\r\n    FT_ListNode  node;\r\n\r\n\r\n    node = FT_List_Find( &library->renderers, module );\r\n    if ( node )\r\n    {\r\n      FT_Renderer  render = FT_RENDERER( module );\r\n\r\n\r\n      /* release raster object, if any */\r\n      if ( render->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&\r\n           render->raster                                         )\r\n        render->clazz->raster_class->raster_done( render->raster );\r\n\r\n      /* remove from list */\r\n      FT_List_Remove( &library->renderers, node );\r\n      FT_FREE( node );\r\n\r\n      ft_set_current_renderer( library );\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in ftrender.h */\r\n\r\n  FT_EXPORT_DEF( FT_Renderer )\r\n  FT_Get_Renderer( FT_Library       library,\r\n                   FT_Glyph_Format  format )\r\n  {\r\n    /* test for valid `library' delayed to FT_Lookup_Renderer() */\r\n\r\n    return FT_Lookup_Renderer( library, format, 0 );\r\n  }\r\n\r\n\r\n  /* documentation is in ftrender.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Set_Renderer( FT_Library     library,\r\n                   FT_Renderer    renderer,\r\n                   FT_UInt        num_params,\r\n                   FT_Parameter*  parameters )\r\n  {\r\n    FT_ListNode  node;\r\n    FT_Error     error = FT_Err_Ok;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !renderer )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    node = FT_List_Find( &library->renderers, renderer );\r\n    if ( !node )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_List_Up( &library->renderers, node );\r\n\r\n    if ( renderer->glyph_format == FT_GLYPH_FORMAT_OUTLINE )\r\n      library->cur_renderer = renderer;\r\n\r\n    if ( num_params > 0 )\r\n    {\r\n      FT_Renderer_SetModeFunc  set_mode = renderer->clazz->set_mode;\r\n\r\n\r\n      for ( ; num_params > 0; num_params-- )\r\n      {\r\n        error = set_mode( renderer, parameters->tag, parameters->data );\r\n        if ( error )\r\n          break;\r\n        parameters++;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Render_Glyph_Internal( FT_Library      library,\r\n                            FT_GlyphSlot    slot,\r\n                            FT_Render_Mode  render_mode )\r\n  {\r\n    FT_Error     error = FT_Err_Ok;\r\n    FT_Renderer  renderer;\r\n\r\n\r\n    /* if it is already a bitmap, no need to do anything */\r\n    switch ( slot->format )\r\n    {\r\n    case FT_GLYPH_FORMAT_BITMAP:   /* already a bitmap, don't do anything */\r\n      break;\r\n\r\n    default:\r\n      {\r\n        FT_ListNode  node   = 0;\r\n        FT_Bool      update = 0;\r\n\r\n\r\n        /* small shortcut for the very common case */\r\n        if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )\r\n        {\r\n          renderer = library->cur_renderer;\r\n          node     = library->renderers.head;\r\n        }\r\n        else\r\n          renderer = FT_Lookup_Renderer( library, slot->format, &node );\r\n\r\n        error = FT_Err_Unimplemented_Feature;\r\n        while ( renderer )\r\n        {\r\n          error = renderer->render( renderer, slot, render_mode, NULL );\r\n          if ( !error                                               ||\r\n               FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph )\r\n            break;\r\n\r\n          /* FT_Err_Cannot_Render_Glyph is returned if the render mode   */\r\n          /* is unsupported by the current renderer for this glyph image */\r\n          /* format.                                                     */\r\n\r\n          /* now, look for another renderer that supports the same */\r\n          /* format.                                               */\r\n          renderer = FT_Lookup_Renderer( library, slot->format, &node );\r\n          update   = 1;\r\n        }\r\n\r\n        /* if we changed the current renderer for the glyph image format */\r\n        /* we need to select it as the next current one                  */\r\n        if ( !error && update && renderer )\r\n          FT_Set_Renderer( library, renderer, 0, 0 );\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Render_Glyph( FT_GlyphSlot    slot,\r\n                   FT_Render_Mode  render_mode )\r\n  {\r\n    FT_Library  library;\r\n\r\n\r\n    if ( !slot || !slot->face )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    library = FT_FACE_LIBRARY( slot->face );\r\n\r\n    return FT_Render_Glyph_Internal( library, slot, render_mode );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                         M O D U L E S                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Destroy_Module                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroys a given module object.  For drivers, this also destroys   */\r\n  /*    all child faces.                                                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    module :: A handle to the target driver object.                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The driver _must_ be LOCKED!                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Destroy_Module( FT_Module  module )\r\n  {\r\n    FT_Memory         memory  = module->memory;\r\n    FT_Module_Class*  clazz   = module->clazz;\r\n    FT_Library        library = module->library;\r\n\r\n\r\n    if ( library && library->auto_hinter == module )\r\n      library->auto_hinter = 0;\r\n\r\n    /* if the module is a renderer */\r\n    if ( FT_MODULE_IS_RENDERER( module ) )\r\n      ft_remove_renderer( module );\r\n\r\n    /* if the module is a font driver, add some steps */\r\n    if ( FT_MODULE_IS_DRIVER( module ) )\r\n      Destroy_Driver( FT_DRIVER( module ) );\r\n\r\n    /* finalize the module object */\r\n    if ( clazz->module_done )\r\n      clazz->module_done( module );\r\n\r\n    /* discard it */\r\n    FT_FREE( module );\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Add_Module( FT_Library              library,\r\n                 const FT_Module_Class*  clazz )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n    FT_Module  module;\r\n    FT_UInt    nn;\r\n\r\n\r\n#define FREETYPE_VER_FIXED  ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \\\r\n                                FREETYPE_MINOR                  )\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !clazz )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* check freetype version */\r\n    if ( clazz->module_requires > FREETYPE_VER_FIXED )\r\n      return FT_Err_Invalid_Version;\r\n\r\n    /* look for a module with the same name in the library's table */\r\n    for ( nn = 0; nn < library->num_modules; nn++ )\r\n    {\r\n      module = library->modules[nn];\r\n      if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 )\r\n      {\r\n        /* this installed module has the same name, compare their versions */\r\n        if ( clazz->module_version <= module->clazz->module_version )\r\n          return FT_Err_Lower_Module_Version;\r\n\r\n        /* remove the module from our list, then exit the loop to replace */\r\n        /* it by our new version..                                        */\r\n        FT_Remove_Module( library, module );\r\n        break;\r\n      }\r\n    }\r\n\r\n    memory = library->memory;\r\n    error  = FT_Err_Ok;\r\n\r\n    if ( library->num_modules >= FT_MAX_MODULES )\r\n    {\r\n      error = FT_Err_Too_Many_Drivers;\r\n      goto Exit;\r\n    }\r\n\r\n    /* allocate module object */\r\n    if ( FT_ALLOC( module, clazz->module_size ) )\r\n      goto Exit;\r\n\r\n    /* base initialization */\r\n    module->library = library;\r\n    module->memory  = memory;\r\n    module->clazz   = (FT_Module_Class*)clazz;\r\n\r\n    /* check whether the module is a renderer - this must be performed */\r\n    /* before the normal module initialization                         */\r\n    if ( FT_MODULE_IS_RENDERER( module ) )\r\n    {\r\n      /* add to the renderers list */\r\n      error = ft_add_renderer( module );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n\r\n    /* is the module a auto-hinter? */\r\n    if ( FT_MODULE_IS_HINTER( module ) )\r\n      library->auto_hinter = module;\r\n\r\n    /* if the module is a font driver */\r\n    if ( FT_MODULE_IS_DRIVER( module ) )\r\n    {\r\n      /* allocate glyph loader if needed */\r\n      FT_Driver  driver = FT_DRIVER( module );\r\n\r\n\r\n      driver->clazz = (FT_Driver_Class)module->clazz;\r\n      if ( FT_DRIVER_USES_OUTLINES( driver ) )\r\n      {\r\n        error = FT_GlyphLoader_New( memory, &driver->glyph_loader );\r\n        if ( error )\r\n          goto Fail;\r\n      }\r\n    }\r\n\r\n    if ( clazz->module_init )\r\n    {\r\n      error = clazz->module_init( module );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n\r\n    /* add module to the library's table */\r\n    library->modules[library->num_modules++] = module;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    if ( FT_MODULE_IS_DRIVER( module ) )\r\n    {\r\n      FT_Driver  driver = FT_DRIVER( module );\r\n\r\n\r\n      if ( FT_DRIVER_USES_OUTLINES( driver ) )\r\n        FT_GlyphLoader_Done( driver->glyph_loader );\r\n    }\r\n\r\n    if ( FT_MODULE_IS_RENDERER( module ) )\r\n    {\r\n      FT_Renderer  renderer = FT_RENDERER( module );\r\n\r\n\r\n      if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&\r\n           renderer->raster                                         )\r\n        renderer->clazz->raster_class->raster_done( renderer->raster );\r\n    }\r\n\r\n    FT_FREE( module );\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_Module )\r\n  FT_Get_Module( FT_Library   library,\r\n                 const char*  module_name )\r\n  {\r\n    FT_Module   result = 0;\r\n    FT_Module*  cur;\r\n    FT_Module*  limit;\r\n\r\n\r\n    if ( !library || !module_name )\r\n      return result;\r\n\r\n    cur   = library->modules;\r\n    limit = cur + library->num_modules;\r\n\r\n    for ( ; cur < limit; cur++ )\r\n      if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 )\r\n      {\r\n        result = cur[0];\r\n        break;\r\n      }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( const void* )\r\n  FT_Get_Module_Interface( FT_Library   library,\r\n                           const char*  mod_name )\r\n  {\r\n    FT_Module  module;\r\n\r\n\r\n    /* test for valid `library' delayed to FT_Get_Module() */\r\n\r\n    module = FT_Get_Module( library, mod_name );\r\n\r\n    return module ? module->clazz->module_interface : 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_module_get_service( FT_Module    module,\r\n                         const char*  service_id )\r\n  {\r\n    FT_Pointer  result = NULL;\r\n\r\n\r\n    if ( module )\r\n    {\r\n      FT_ASSERT( module->clazz && module->clazz->get_interface );\r\n\r\n      /* first, look for the service in the module */\r\n      if ( module->clazz->get_interface )\r\n        result = module->clazz->get_interface( module, service_id );\r\n\r\n      if ( result == NULL )\r\n      {\r\n        /* we didn't find it, look in all other modules then */\r\n        FT_Library  library = module->library;\r\n        FT_Module*  cur     = library->modules;\r\n        FT_Module*  limit   = cur + library->num_modules;\r\n\r\n\r\n        for ( ; cur < limit; cur++ )\r\n        {\r\n          if ( cur[0] != module )\r\n          {\r\n            FT_ASSERT( cur[0]->clazz );\r\n\r\n            if ( cur[0]->clazz->get_interface )\r\n            {\r\n              result = cur[0]->clazz->get_interface( cur[0], service_id );\r\n              if ( result != NULL )\r\n                break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Remove_Module( FT_Library  library,\r\n                    FT_Module   module )\r\n  {\r\n    /* try to find the module from the table, then remove it from there */\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( module )\r\n    {\r\n      FT_Module*  cur   = library->modules;\r\n      FT_Module*  limit = cur + library->num_modules;\r\n\r\n\r\n      for ( ; cur < limit; cur++ )\r\n      {\r\n        if ( cur[0] == module )\r\n        {\r\n          /* remove it from the table */\r\n          library->num_modules--;\r\n          limit--;\r\n          while ( cur < limit )\r\n          {\r\n            cur[0] = cur[1];\r\n            cur++;\r\n          }\r\n          limit[0] = 0;\r\n\r\n          /* destroy the module */\r\n          Destroy_Module( module );\r\n\r\n          return FT_Err_Ok;\r\n        }\r\n      }\r\n    }\r\n    return FT_Err_Invalid_Driver_Handle;\r\n  }\r\n\r\n\r\n  FT_Error\r\n  ft_property_do( FT_Library        library,\r\n                  const FT_String*  module_name,\r\n                  const FT_String*  property_name,\r\n                  void*             value,\r\n                  FT_Bool           set )\r\n  {\r\n    FT_Module*           cur;\r\n    FT_Module*           limit;\r\n    FT_Module_Interface  interface;\r\n\r\n    FT_Service_Properties  service;\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n    const FT_String*  set_name  = \"FT_Property_Set\";\r\n    const FT_String*  get_name  = \"FT_Property_Get\";\r\n    const FT_String*  func_name = set ? set_name : get_name;\r\n#endif\r\n\r\n    FT_Bool  missing_func;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !module_name || !property_name || !value )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    cur   = library->modules;\r\n    limit = cur + library->num_modules;\r\n\r\n    /* search module */\r\n    for ( ; cur < limit; cur++ )\r\n      if ( !ft_strcmp( cur[0]->clazz->module_name, module_name ) )\r\n        break;\r\n\r\n    if ( cur == limit )\r\n    {\r\n      FT_ERROR(( \"%s: can't find module `%s'\\n\",\r\n                 func_name, module_name ));\r\n      return FT_Err_Missing_Module;\r\n    }\r\n\r\n    /* check whether we have a service interface */\r\n    if ( !cur[0]->clazz->get_interface )\r\n    {\r\n      FT_ERROR(( \"%s: module `%s' doesn't support properties\\n\",\r\n                 func_name, module_name ));\r\n      return FT_Err_Unimplemented_Feature;\r\n    }\r\n\r\n    /* search property service */\r\n    interface = cur[0]->clazz->get_interface( cur[0],\r\n                                              FT_SERVICE_ID_PROPERTIES );\r\n    if ( !interface )\r\n    {\r\n      FT_ERROR(( \"%s: module `%s' doesn't support properties\\n\",\r\n                 func_name, module_name ));\r\n      return FT_Err_Unimplemented_Feature;\r\n    }\r\n\r\n    service = (FT_Service_Properties)interface;\r\n\r\n    if ( set )\r\n      missing_func = !service->set_property;\r\n    else\r\n      missing_func = !service->get_property;\r\n\r\n    if ( missing_func )\r\n    {\r\n      FT_ERROR(( \"%s: property service of module `%s' is broken\\n\",\r\n                 func_name, module_name ));\r\n      return FT_Err_Unimplemented_Feature;\r\n    }\r\n\r\n    return set ? service->set_property( cur[0], property_name, value )\r\n               : service->get_property( cur[0], property_name, value );\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_Error\r\n  FT_Property_Set( FT_Library        library,\r\n                   const FT_String*  module_name,\r\n                   const FT_String*  property_name,\r\n                   const void*       value )\r\n  {\r\n    return ft_property_do( library,\r\n                           module_name,\r\n                           property_name,\r\n                           (void*)value,\r\n                           TRUE );\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_Error\r\n  FT_Property_Get( FT_Library        library,\r\n                   const FT_String*  module_name,\r\n                   const FT_String*  property_name,\r\n                   void*             value )\r\n  {\r\n    return ft_property_do( library,\r\n                           module_name,\r\n                           property_name,\r\n                           value,\r\n                           FALSE );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                         L I B R A R Y                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Reference_Library( FT_Library  library )\r\n  {\r\n    library->refcount++;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_New_Library( FT_Memory    memory,\r\n                  FT_Library  *alibrary )\r\n  {\r\n    FT_Library  library = NULL;\r\n    FT_Error    error;\r\n\r\n\r\n    if ( !memory )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n    /* init debugging support */\r\n    ft_debug_init();\r\n#endif\r\n\r\n    /* first of all, allocate the library object */\r\n    if ( FT_NEW( library ) )\r\n      return error;\r\n\r\n    library->memory = memory;\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    /* initialize position independent code containers */\r\n    error = ft_pic_container_init( library );\r\n    if ( error )\r\n      goto Fail;\r\n#endif\r\n\r\n    /* allocate the render pool */\r\n    library->raster_pool_size = FT_RENDER_POOL_SIZE;\r\n#if FT_RENDER_POOL_SIZE > 0\r\n    if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )\r\n      goto Fail;\r\n#endif\r\n\r\n    library->version_major = FREETYPE_MAJOR;\r\n    library->version_minor = FREETYPE_MINOR;\r\n    library->version_patch = FREETYPE_PATCH;\r\n\r\n    library->refcount = 1;\r\n\r\n    /* That's ok now */\r\n    *alibrary = library;\r\n\r\n    return FT_Err_Ok;\r\n\r\n  Fail:\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    ft_pic_container_destroy( library );\r\n#endif\r\n    FT_FREE( library );\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Library_Version( FT_Library   library,\r\n                      FT_Int      *amajor,\r\n                      FT_Int      *aminor,\r\n                      FT_Int      *apatch )\r\n  {\r\n    FT_Int  major = 0;\r\n    FT_Int  minor = 0;\r\n    FT_Int  patch = 0;\r\n\r\n\r\n    if ( library )\r\n    {\r\n      major = library->version_major;\r\n      minor = library->version_minor;\r\n      patch = library->version_patch;\r\n    }\r\n\r\n    if ( amajor )\r\n      *amajor = major;\r\n\r\n    if ( aminor )\r\n      *aminor = minor;\r\n\r\n    if ( apatch )\r\n      *apatch = patch;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Done_Library( FT_Library  library )\r\n  {\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    library->refcount--;\r\n    if ( library->refcount > 0 )\r\n      goto Exit;\r\n\r\n    memory = library->memory;\r\n\r\n    /*\r\n     * Close all faces in the library.  If we don't do this, we can have\r\n     * some subtle memory leaks.\r\n     *\r\n     * Example:\r\n     *\r\n     *  - the cff font driver uses the pshinter module in cff_size_done\r\n     *  - if the pshinter module is destroyed before the cff font driver,\r\n     *    opened FT_Face objects managed by the driver are not properly\r\n     *    destroyed, resulting in a memory leak\r\n     *\r\n     * Some faces are dependent on other faces, like Type42 faces that\r\n     * depend on TrueType faces synthesized internally.\r\n     *\r\n     * The order of drivers should be specified in driver_name[].\r\n     */\r\n    {\r\n      FT_UInt      m, n;\r\n      const char*  driver_name[] = { \"type42\", NULL };\r\n\r\n\r\n      for ( m = 0;\r\n            m < sizeof ( driver_name ) / sizeof ( driver_name[0] );\r\n            m++ )\r\n      {\r\n        for ( n = 0; n < library->num_modules; n++ )\r\n        {\r\n          FT_Module    module      = library->modules[n];\r\n          const char*  module_name = module->clazz->module_name;\r\n          FT_List      faces;\r\n\r\n\r\n          if ( driver_name[m]                                &&\r\n               ft_strcmp( module_name, driver_name[m] ) != 0 )\r\n            continue;\r\n\r\n          if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )\r\n            continue;\r\n\r\n          FT_TRACE7(( \"FT_Done_Library: close faces for %s\\n\", module_name ));\r\n\r\n          faces = &FT_DRIVER( module )->faces_list;\r\n          while ( faces->head )\r\n          {\r\n            FT_Done_Face( FT_FACE( faces->head->data ) );\r\n            if ( faces->head )\r\n              FT_TRACE0(( \"FT_Done_Library: failed to free some faces\\n\" ));\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Close all other modules in the library */\r\n#if 1\r\n    /* XXX Modules are removed in the reversed order so that  */\r\n    /* type42 module is removed before truetype module.  This */\r\n    /* avoids double free in some occasions.  It is a hack.   */\r\n    while ( library->num_modules > 0 )\r\n      FT_Remove_Module( library,\r\n                        library->modules[library->num_modules - 1] );\r\n#else\r\n    {\r\n      FT_UInt  n;\r\n\r\n\r\n      for ( n = 0; n < library->num_modules; n++ )\r\n      {\r\n        FT_Module  module = library->modules[n];\r\n\r\n\r\n        if ( module )\r\n        {\r\n          Destroy_Module( module );\r\n          library->modules[n] = 0;\r\n        }\r\n      }\r\n    }\r\n#endif\r\n\r\n    /* Destroy raster objects */\r\n    FT_FREE( library->raster_pool );\r\n    library->raster_pool_size = 0;\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    /* Destroy pic container contents */\r\n    ft_pic_container_destroy( library );\r\n#endif\r\n\r\n    FT_FREE( library );\r\n\r\n  Exit:\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Set_Debug_Hook( FT_Library         library,\r\n                     FT_UInt            hook_index,\r\n                     FT_DebugHook_Func  debug_hook )\r\n  {\r\n    if ( library && debug_hook &&\r\n         hook_index <\r\n           ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )\r\n      library->debug_hooks[hook_index] = debug_hook;\r\n  }\r\n\r\n\r\n  /* documentation is in ftmodapi.h */\r\n\r\n  FT_EXPORT_DEF( FT_TrueTypeEngineType )\r\n  FT_Get_TrueType_Engine_Type( FT_Library  library )\r\n  {\r\n    FT_TrueTypeEngineType  result = FT_TRUETYPE_ENGINE_TYPE_NONE;\r\n\r\n\r\n    if ( library )\r\n    {\r\n      FT_Module  module = FT_Get_Module( library, \"truetype\" );\r\n\r\n\r\n      if ( module )\r\n      {\r\n        FT_Service_TrueTypeEngine  service;\r\n\r\n\r\n        service = (FT_Service_TrueTypeEngine)\r\n                    ft_module_get_service( module,\r\n                                           FT_SERVICE_ID_TRUETYPE_ENGINE );\r\n        if ( service )\r\n          result = service->engine_type;\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  ft_stub_set_char_sizes( FT_Size     size,\r\n                          FT_F26Dot6  width,\r\n                          FT_F26Dot6  height,\r\n                          FT_UInt     horz_res,\r\n                          FT_UInt     vert_res )\r\n  {\r\n    FT_Size_RequestRec  req;\r\n    FT_Driver           driver = size->face->driver;\r\n\r\n\r\n    if ( driver->clazz->request_size )\r\n    {\r\n      req.type   = FT_SIZE_REQUEST_TYPE_NOMINAL;\r\n      req.width  = width;\r\n      req.height = height;\r\n\r\n      if ( horz_res == 0 )\r\n        horz_res = vert_res;\r\n\r\n      if ( vert_res == 0 )\r\n        vert_res = horz_res;\r\n\r\n      if ( horz_res == 0 )\r\n        horz_res = vert_res = 72;\r\n\r\n      req.horiResolution = horz_res;\r\n      req.vertResolution = vert_res;\r\n\r\n      return driver->clazz->request_size( size, &req );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  ft_stub_set_pixel_sizes( FT_Size  size,\r\n                           FT_UInt  width,\r\n                           FT_UInt  height )\r\n  {\r\n    FT_Size_RequestRec  req;\r\n    FT_Driver           driver = size->face->driver;\r\n\r\n\r\n    if ( driver->clazz->request_size )\r\n    {\r\n      req.type           = FT_SIZE_REQUEST_TYPE_NOMINAL;\r\n      req.width          = width  << 6;\r\n      req.height         = height << 6;\r\n      req.horiResolution = 0;\r\n      req.vertResolution = 0;\r\n\r\n      return driver->clazz->request_size( size, &req );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,\r\n                        FT_UInt       sub_index,\r\n                        FT_Int       *p_index,\r\n                        FT_UInt      *p_flags,\r\n                        FT_Int       *p_arg1,\r\n                        FT_Int       *p_arg2,\r\n                        FT_Matrix    *p_transform )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n\r\n\r\n    if ( glyph                                      &&\r\n         glyph->subglyphs                           &&\r\n         glyph->format == FT_GLYPH_FORMAT_COMPOSITE &&\r\n         sub_index < glyph->num_subglyphs           )\r\n    {\r\n      FT_SubGlyph  subg = glyph->subglyphs + sub_index;\r\n\r\n\r\n      *p_index     = subg->index;\r\n      *p_flags     = subg->flags;\r\n      *p_arg1      = subg->arg1;\r\n      *p_arg2      = subg->arg2;\r\n      *p_transform = subg->transform;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftotval.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftotval.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating OpenType tables (body).                  */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006, 2008, 2010 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_OPENTYPE_VALIDATE_H\r\n#include FT_OPENTYPE_VALIDATE_H\r\n\r\n\r\n  /* documentation is in ftotval.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_OpenType_Validate( FT_Face    face,\r\n                        FT_UInt    validation_flags,\r\n                        FT_Bytes  *BASE_table,\r\n                        FT_Bytes  *GDEF_table,\r\n                        FT_Bytes  *GPOS_table,\r\n                        FT_Bytes  *GSUB_table,\r\n                        FT_Bytes  *JSTF_table )\r\n  {\r\n    FT_Service_OTvalidate  service;\r\n    FT_Error               error;\r\n\r\n\r\n    if ( !face )\r\n    {\r\n      error = FT_Err_Invalid_Face_Handle;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( !( BASE_table &&\r\n            GDEF_table &&\r\n            GPOS_table &&\r\n            GSUB_table &&\r\n            JSTF_table ) )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, service, OPENTYPE_VALIDATE );\r\n\r\n    if ( service )\r\n      error = service->validate( face,\r\n                                 validation_flags,\r\n                                 BASE_table,\r\n                                 GDEF_table,\r\n                                 GPOS_table,\r\n                                 GSUB_table,\r\n                                 JSTF_table );\r\n    else\r\n      error = FT_Err_Unimplemented_Feature;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_OpenType_Free( FT_Face   face,\r\n                    FT_Bytes  table )\r\n  {\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n    FT_FREE( table );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftoutln.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftoutln.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType outline management (body).                                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2008, 2010, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* All functions are declared in freetype.h.                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_TRIGONOMETRY_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_outline\r\n\r\n\r\n  static\r\n  const FT_Outline  null_outline = { 0, 0, 0, 0, 0, 0 };\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Decompose( FT_Outline*              outline,\r\n                        const FT_Outline_Funcs*  func_interface,\r\n                        void*                    user )\r\n  {\r\n#undef SCALED\r\n#define SCALED( x )  ( ( (x) << shift ) - delta )\r\n\r\n    FT_Vector   v_last;\r\n    FT_Vector   v_control;\r\n    FT_Vector   v_start;\r\n\r\n    FT_Vector*  point;\r\n    FT_Vector*  limit;\r\n    char*       tags;\r\n\r\n    FT_Error    error;\r\n\r\n    FT_Int   n;         /* index of contour in outline     */\r\n    FT_UInt  first;     /* index of first point in contour */\r\n    FT_Int   tag;       /* current point's state           */\r\n\r\n    FT_Int   shift;\r\n    FT_Pos   delta;\r\n\r\n\r\n    if ( !outline || !func_interface )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    shift = func_interface->shift;\r\n    delta = func_interface->delta;\r\n    first = 0;\r\n\r\n    for ( n = 0; n < outline->n_contours; n++ )\r\n    {\r\n      FT_Int  last;  /* index of last point in contour */\r\n\r\n\r\n      FT_TRACE5(( \"FT_Outline_Decompose: Outline %d\\n\", n ));\r\n\r\n      last = outline->contours[n];\r\n      if ( last < 0 )\r\n        goto Invalid_Outline;\r\n      limit = outline->points + last;\r\n\r\n      v_start   = outline->points[first];\r\n      v_start.x = SCALED( v_start.x );\r\n      v_start.y = SCALED( v_start.y );\r\n\r\n      v_last   = outline->points[last];\r\n      v_last.x = SCALED( v_last.x );\r\n      v_last.y = SCALED( v_last.y );\r\n\r\n      v_control = v_start;\r\n\r\n      point = outline->points + first;\r\n      tags  = outline->tags   + first;\r\n      tag   = FT_CURVE_TAG( tags[0] );\r\n\r\n      /* A contour cannot start with a cubic control point! */\r\n      if ( tag == FT_CURVE_TAG_CUBIC )\r\n        goto Invalid_Outline;\r\n\r\n      /* check first point to determine origin */\r\n      if ( tag == FT_CURVE_TAG_CONIC )\r\n      {\r\n        /* first point is conic control.  Yes, this happens. */\r\n        if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )\r\n        {\r\n          /* start at last point if it is on the curve */\r\n          v_start = v_last;\r\n          limit--;\r\n        }\r\n        else\r\n        {\r\n          /* if both first and last points are conic,         */\r\n          /* start at their middle and record its position    */\r\n          /* for closure                                      */\r\n          v_start.x = ( v_start.x + v_last.x ) / 2;\r\n          v_start.y = ( v_start.y + v_last.y ) / 2;\r\n\r\n          v_last = v_start;\r\n        }\r\n        point--;\r\n        tags--;\r\n      }\r\n\r\n      FT_TRACE5(( \"  move to (%.2f, %.2f)\\n\",\r\n                  v_start.x / 64.0, v_start.y / 64.0 ));\r\n      error = func_interface->move_to( &v_start, user );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      while ( point < limit )\r\n      {\r\n        point++;\r\n        tags++;\r\n\r\n        tag = FT_CURVE_TAG( tags[0] );\r\n        switch ( tag )\r\n        {\r\n        case FT_CURVE_TAG_ON:  /* emit a single line_to */\r\n          {\r\n            FT_Vector  vec;\r\n\r\n\r\n            vec.x = SCALED( point->x );\r\n            vec.y = SCALED( point->y );\r\n\r\n            FT_TRACE5(( \"  line to (%.2f, %.2f)\\n\",\r\n                        vec.x / 64.0, vec.y / 64.0 ));\r\n            error = func_interface->line_to( &vec, user );\r\n            if ( error )\r\n              goto Exit;\r\n            continue;\r\n          }\r\n\r\n        case FT_CURVE_TAG_CONIC:  /* consume conic arcs */\r\n          v_control.x = SCALED( point->x );\r\n          v_control.y = SCALED( point->y );\r\n\r\n        Do_Conic:\r\n          if ( point < limit )\r\n          {\r\n            FT_Vector  vec;\r\n            FT_Vector  v_middle;\r\n\r\n\r\n            point++;\r\n            tags++;\r\n            tag = FT_CURVE_TAG( tags[0] );\r\n\r\n            vec.x = SCALED( point->x );\r\n            vec.y = SCALED( point->y );\r\n\r\n            if ( tag == FT_CURVE_TAG_ON )\r\n            {\r\n              FT_TRACE5(( \"  conic to (%.2f, %.2f)\"\r\n                          \" with control (%.2f, %.2f)\\n\",\r\n                          vec.x / 64.0, vec.y / 64.0,\r\n                          v_control.x / 64.0, v_control.y / 64.0 ));\r\n              error = func_interface->conic_to( &v_control, &vec, user );\r\n              if ( error )\r\n                goto Exit;\r\n              continue;\r\n            }\r\n\r\n            if ( tag != FT_CURVE_TAG_CONIC )\r\n              goto Invalid_Outline;\r\n\r\n            v_middle.x = ( v_control.x + vec.x ) / 2;\r\n            v_middle.y = ( v_control.y + vec.y ) / 2;\r\n\r\n            FT_TRACE5(( \"  conic to (%.2f, %.2f)\"\r\n                        \" with control (%.2f, %.2f)\\n\",\r\n                        v_middle.x / 64.0, v_middle.y / 64.0,\r\n                        v_control.x / 64.0, v_control.y / 64.0 ));\r\n            error = func_interface->conic_to( &v_control, &v_middle, user );\r\n            if ( error )\r\n              goto Exit;\r\n\r\n            v_control = vec;\r\n            goto Do_Conic;\r\n          }\r\n\r\n          FT_TRACE5(( \"  conic to (%.2f, %.2f)\"\r\n                      \" with control (%.2f, %.2f)\\n\",\r\n                      v_start.x / 64.0, v_start.y / 64.0,\r\n                      v_control.x / 64.0, v_control.y / 64.0 ));\r\n          error = func_interface->conic_to( &v_control, &v_start, user );\r\n          goto Close;\r\n\r\n        default:  /* FT_CURVE_TAG_CUBIC */\r\n          {\r\n            FT_Vector  vec1, vec2;\r\n\r\n\r\n            if ( point + 1 > limit                             ||\r\n                 FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )\r\n              goto Invalid_Outline;\r\n\r\n            point += 2;\r\n            tags  += 2;\r\n\r\n            vec1.x = SCALED( point[-2].x );\r\n            vec1.y = SCALED( point[-2].y );\r\n\r\n            vec2.x = SCALED( point[-1].x );\r\n            vec2.y = SCALED( point[-1].y );\r\n\r\n            if ( point <= limit )\r\n            {\r\n              FT_Vector  vec;\r\n\r\n\r\n              vec.x = SCALED( point->x );\r\n              vec.y = SCALED( point->y );\r\n\r\n              FT_TRACE5(( \"  cubic to (%.2f, %.2f)\"\r\n                          \" with controls (%.2f, %.2f) and (%.2f, %.2f)\\n\",\r\n                          vec.x / 64.0, vec.y / 64.0,\r\n                          vec1.x / 64.0, vec1.y / 64.0,\r\n                          vec2.x / 64.0, vec2.y / 64.0 ));\r\n              error = func_interface->cubic_to( &vec1, &vec2, &vec, user );\r\n              if ( error )\r\n                goto Exit;\r\n              continue;\r\n            }\r\n\r\n            FT_TRACE5(( \"  cubic to (%.2f, %.2f)\"\r\n                        \" with controls (%.2f, %.2f) and (%.2f, %.2f)\\n\",\r\n                        v_start.x / 64.0, v_start.y / 64.0,\r\n                        vec1.x / 64.0, vec1.y / 64.0,\r\n                        vec2.x / 64.0, vec2.y / 64.0 ));\r\n            error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );\r\n            goto Close;\r\n          }\r\n        }\r\n      }\r\n\r\n      /* close the contour with a line segment */\r\n      FT_TRACE5(( \"  line to (%.2f, %.2f)\\n\",\r\n                  v_start.x / 64.0, v_start.y / 64.0 ));\r\n      error = func_interface->line_to( &v_start, user );\r\n\r\n    Close:\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      first = last + 1;\r\n    }\r\n\r\n    FT_TRACE5(( \"FT_Outline_Decompose: Done\\n\", n ));\r\n    return FT_Err_Ok;\r\n\r\n  Exit:\r\n    FT_TRACE5(( \"FT_Outline_Decompose: Error %d\\n\", error ));\r\n    return error;\r\n\r\n  Invalid_Outline:\r\n    return FT_Err_Invalid_Outline;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_New_Internal( FT_Memory    memory,\r\n                           FT_UInt      numPoints,\r\n                           FT_Int       numContours,\r\n                           FT_Outline  *anoutline )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    if ( !anoutline || !memory )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    *anoutline = null_outline;\r\n\r\n    if ( FT_NEW_ARRAY( anoutline->points,   numPoints   ) ||\r\n         FT_NEW_ARRAY( anoutline->tags,     numPoints   ) ||\r\n         FT_NEW_ARRAY( anoutline->contours, numContours ) )\r\n      goto Fail;\r\n\r\n    anoutline->n_points    = (FT_UShort)numPoints;\r\n    anoutline->n_contours  = (FT_Short)numContours;\r\n    anoutline->flags      |= FT_OUTLINE_OWNER;\r\n\r\n    return FT_Err_Ok;\r\n\r\n  Fail:\r\n    anoutline->flags |= FT_OUTLINE_OWNER;\r\n    FT_Outline_Done_Internal( memory, anoutline );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_New( FT_Library   library,\r\n                  FT_UInt      numPoints,\r\n                  FT_Int       numContours,\r\n                  FT_Outline  *anoutline )\r\n  {\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    return FT_Outline_New_Internal( library->memory, numPoints,\r\n                                    numContours, anoutline );\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Check( FT_Outline*  outline )\r\n  {\r\n    if ( outline )\r\n    {\r\n      FT_Int  n_points   = outline->n_points;\r\n      FT_Int  n_contours = outline->n_contours;\r\n      FT_Int  end0, end;\r\n      FT_Int  n;\r\n\r\n\r\n      /* empty glyph? */\r\n      if ( n_points == 0 && n_contours == 0 )\r\n        return 0;\r\n\r\n      /* check point and contour counts */\r\n      if ( n_points <= 0 || n_contours <= 0 )\r\n        goto Bad;\r\n\r\n      end0 = end = -1;\r\n      for ( n = 0; n < n_contours; n++ )\r\n      {\r\n        end = outline->contours[n];\r\n\r\n        /* note that we don't accept empty contours */\r\n        if ( end <= end0 || end >= n_points )\r\n          goto Bad;\r\n\r\n        end0 = end;\r\n      }\r\n\r\n      if ( end != n_points - 1 )\r\n        goto Bad;\r\n\r\n      /* XXX: check the tags array */\r\n      return 0;\r\n    }\r\n\r\n  Bad:\r\n    return FT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Copy( const FT_Outline*  source,\r\n                   FT_Outline        *target )\r\n  {\r\n    FT_Int  is_owner;\r\n\r\n\r\n    if ( !source            || !target            ||\r\n         source->n_points   != target->n_points   ||\r\n         source->n_contours != target->n_contours )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    if ( source == target )\r\n      return FT_Err_Ok;\r\n\r\n    FT_ARRAY_COPY( target->points, source->points, source->n_points );\r\n\r\n    FT_ARRAY_COPY( target->tags, source->tags, source->n_points );\r\n\r\n    FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );\r\n\r\n    /* copy all flags, except the `FT_OUTLINE_OWNER' one */\r\n    is_owner      = target->flags & FT_OUTLINE_OWNER;\r\n    target->flags = source->flags;\r\n\r\n    target->flags &= ~FT_OUTLINE_OWNER;\r\n    target->flags |= is_owner;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Done_Internal( FT_Memory    memory,\r\n                            FT_Outline*  outline )\r\n  {\r\n    if ( memory && outline )\r\n    {\r\n      if ( outline->flags & FT_OUTLINE_OWNER )\r\n      {\r\n        FT_FREE( outline->points   );\r\n        FT_FREE( outline->tags     );\r\n        FT_FREE( outline->contours );\r\n      }\r\n      *outline = null_outline;\r\n\r\n      return FT_Err_Ok;\r\n    }\r\n    else\r\n      return FT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Done( FT_Library   library,\r\n                   FT_Outline*  outline )\r\n  {\r\n    /* check for valid `outline' in FT_Outline_Done_Internal() */\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    return FT_Outline_Done_Internal( library->memory, outline );\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Outline_Get_CBox( const FT_Outline*  outline,\r\n                       FT_BBox           *acbox )\r\n  {\r\n    FT_Pos  xMin, yMin, xMax, yMax;\r\n\r\n\r\n    if ( outline && acbox )\r\n    {\r\n      if ( outline->n_points == 0 )\r\n      {\r\n        xMin = 0;\r\n        yMin = 0;\r\n        xMax = 0;\r\n        yMax = 0;\r\n      }\r\n      else\r\n      {\r\n        FT_Vector*  vec   = outline->points;\r\n        FT_Vector*  limit = vec + outline->n_points;\r\n\r\n\r\n        xMin = xMax = vec->x;\r\n        yMin = yMax = vec->y;\r\n        vec++;\r\n\r\n        for ( ; vec < limit; vec++ )\r\n        {\r\n          FT_Pos  x, y;\r\n\r\n\r\n          x = vec->x;\r\n          if ( x < xMin ) xMin = x;\r\n          if ( x > xMax ) xMax = x;\r\n\r\n          y = vec->y;\r\n          if ( y < yMin ) yMin = y;\r\n          if ( y > yMax ) yMax = y;\r\n        }\r\n      }\r\n      acbox->xMin = xMin;\r\n      acbox->xMax = xMax;\r\n      acbox->yMin = yMin;\r\n      acbox->yMax = yMax;\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Outline_Translate( const FT_Outline*  outline,\r\n                        FT_Pos             xOffset,\r\n                        FT_Pos             yOffset )\r\n  {\r\n    FT_UShort   n;\r\n    FT_Vector*  vec;\r\n\r\n\r\n    if ( !outline )\r\n      return;\r\n\r\n    vec = outline->points;\r\n\r\n    for ( n = 0; n < outline->n_points; n++ )\r\n    {\r\n      vec->x += xOffset;\r\n      vec->y += yOffset;\r\n      vec++;\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Outline_Reverse( FT_Outline*  outline )\r\n  {\r\n    FT_UShort  n;\r\n    FT_Int     first, last;\r\n\r\n\r\n    if ( !outline )\r\n      return;\r\n\r\n    first = 0;\r\n\r\n    for ( n = 0; n < outline->n_contours; n++ )\r\n    {\r\n      last  = outline->contours[n];\r\n\r\n      /* reverse point table */\r\n      {\r\n        FT_Vector*  p = outline->points + first;\r\n        FT_Vector*  q = outline->points + last;\r\n        FT_Vector   swap;\r\n\r\n\r\n        while ( p < q )\r\n        {\r\n          swap = *p;\r\n          *p   = *q;\r\n          *q   = swap;\r\n          p++;\r\n          q--;\r\n        }\r\n      }\r\n\r\n      /* reverse tags table */\r\n      {\r\n        char*  p = outline->tags + first;\r\n        char*  q = outline->tags + last;\r\n        char   swap;\r\n\r\n\r\n        while ( p < q )\r\n        {\r\n          swap = *p;\r\n          *p   = *q;\r\n          *q   = swap;\r\n          p++;\r\n          q--;\r\n        }\r\n      }\r\n\r\n      first = last + 1;\r\n    }\r\n\r\n    outline->flags ^= FT_OUTLINE_REVERSE_FILL;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Render( FT_Library         library,\r\n                     FT_Outline*        outline,\r\n                     FT_Raster_Params*  params )\r\n  {\r\n    FT_Error     error;\r\n    FT_Bool      update = FALSE;\r\n    FT_Renderer  renderer;\r\n    FT_ListNode  node;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Library_Handle;\r\n\r\n    if ( !outline || !params )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    renderer = library->cur_renderer;\r\n    node     = library->renderers.head;\r\n\r\n    params->source = (void*)outline;\r\n\r\n    error = FT_Err_Cannot_Render_Glyph;\r\n    while ( renderer )\r\n    {\r\n      error = renderer->raster_render( renderer->raster, params );\r\n      if ( !error || FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph )\r\n        break;\r\n\r\n      /* FT_Err_Cannot_Render_Glyph is returned if the render mode   */\r\n      /* is unsupported by the current renderer for this glyph image */\r\n      /* format                                                      */\r\n\r\n      /* now, look for another renderer that supports the same */\r\n      /* format                                                */\r\n      renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,\r\n                                     &node );\r\n      update   = TRUE;\r\n    }\r\n\r\n    /* if we changed the current renderer for the glyph image format */\r\n    /* we need to select it as the next current one                  */\r\n    if ( !error && update && renderer )\r\n      FT_Set_Renderer( library, renderer, 0, 0 );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Get_Bitmap( FT_Library        library,\r\n                         FT_Outline*       outline,\r\n                         const FT_Bitmap  *abitmap )\r\n  {\r\n    FT_Raster_Params  params;\r\n\r\n\r\n    if ( !abitmap )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    /* other checks are delayed to FT_Outline_Render() */\r\n\r\n    params.target = abitmap;\r\n    params.flags  = 0;\r\n\r\n    if ( abitmap->pixel_mode == FT_PIXEL_MODE_GRAY  ||\r\n         abitmap->pixel_mode == FT_PIXEL_MODE_LCD   ||\r\n         abitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )\r\n      params.flags |= FT_RASTER_FLAG_AA;\r\n\r\n    return FT_Outline_Render( library, outline, &params );\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Vector_Transform( FT_Vector*        vector,\r\n                       const FT_Matrix*  matrix )\r\n  {\r\n    FT_Pos  xz, yz;\r\n\r\n\r\n    if ( !vector || !matrix )\r\n      return;\r\n\r\n    xz = FT_MulFix( vector->x, matrix->xx ) +\r\n         FT_MulFix( vector->y, matrix->xy );\r\n\r\n    yz = FT_MulFix( vector->x, matrix->yx ) +\r\n         FT_MulFix( vector->y, matrix->yy );\r\n\r\n    vector->x = xz;\r\n    vector->y = yz;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Outline_Transform( const FT_Outline*  outline,\r\n                        const FT_Matrix*   matrix )\r\n  {\r\n    FT_Vector*  vec;\r\n    FT_Vector*  limit;\r\n\r\n\r\n    if ( !outline || !matrix )\r\n      return;\r\n\r\n    vec   = outline->points;\r\n    limit = vec + outline->n_points;\r\n\r\n    for ( ; vec < limit; vec++ )\r\n      FT_Vector_Transform( vec, matrix );\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n#define FT_OUTLINE_GET_CONTOUR( outline, c, first, last )  \\\r\n  do {                                                     \\\r\n    (first) = ( c > 0 ) ? (outline)->points +              \\\r\n                            (outline)->contours[c - 1] + 1 \\\r\n                        : (outline)->points;               \\\r\n    (last) = (outline)->points + (outline)->contours[c];   \\\r\n  } while ( 0 )\r\n\r\n\r\n  /* Is a point in some contour?                     */\r\n  /*                                                 */\r\n  /* We treat every point of the contour as if it    */\r\n  /* it were ON.  That is, we allow false positives, */\r\n  /* but disallow false negatives.  (XXX really?)    */\r\n  static FT_Bool\r\n  ft_contour_has( FT_Outline*  outline,\r\n                  FT_Short     c,\r\n                  FT_Vector*   point )\r\n  {\r\n    FT_Vector*  first;\r\n    FT_Vector*  last;\r\n    FT_Vector*  a;\r\n    FT_Vector*  b;\r\n    FT_UInt     n = 0;\r\n\r\n\r\n    FT_OUTLINE_GET_CONTOUR( outline, c, first, last );\r\n\r\n    for ( a = first; a <= last; a++ )\r\n    {\r\n      FT_Pos  x;\r\n      FT_Int  intersect;\r\n\r\n\r\n      b = ( a == last ) ? first : a + 1;\r\n\r\n      intersect = ( a->y - point->y ) ^ ( b->y - point->y );\r\n\r\n      /* a and b are on the same side */\r\n      if ( intersect >= 0 )\r\n      {\r\n        if ( intersect == 0 && a->y == point->y )\r\n        {\r\n          if ( ( a->x <= point->x && b->x >= point->x ) ||\r\n               ( a->x >= point->x && b->x <= point->x ) )\r\n            return 1;\r\n        }\r\n\r\n        continue;\r\n      }\r\n\r\n      x = a->x + ( b->x - a->x ) * (point->y - a->y ) / ( b->y - a->y );\r\n\r\n      if ( x < point->x )\r\n        n++;\r\n      else if ( x == point->x )\r\n        return 1;\r\n    }\r\n\r\n    return n & 1;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  ft_contour_enclosed( FT_Outline*  outline,\r\n                       FT_UShort    c )\r\n  {\r\n    FT_Vector*  first;\r\n    FT_Vector*  last;\r\n    FT_Short    i;\r\n\r\n\r\n    FT_OUTLINE_GET_CONTOUR( outline, c, first, last );\r\n\r\n    for ( i = 0; i < outline->n_contours; i++ )\r\n    {\r\n      if ( i != c && ft_contour_has( outline, i, first ) )\r\n      {\r\n        FT_Vector*  pt;\r\n\r\n\r\n        for ( pt = first + 1; pt <= last; pt++ )\r\n          if ( !ft_contour_has( outline, i, pt ) )\r\n            return 0;\r\n\r\n        return 1;\r\n      }\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /* This version differs from the public one in that each */\r\n  /* part (contour not enclosed in another contour) of the */\r\n  /* outline is checked for orientation.  This is          */\r\n  /* necessary for some buggy CJK fonts.                   */\r\n  static FT_Orientation\r\n  ft_outline_get_orientation( FT_Outline*  outline )\r\n  {\r\n    FT_Short        i;\r\n    FT_Vector*      first;\r\n    FT_Vector*      last;\r\n    FT_Orientation  orient = FT_ORIENTATION_NONE;\r\n\r\n\r\n    first = outline->points;\r\n    for ( i = 0; i < outline->n_contours; i++, first = last + 1 )\r\n    {\r\n      FT_Vector*  point;\r\n      FT_Vector*  xmin_point;\r\n      FT_Pos      xmin;\r\n\r\n\r\n      last = outline->points + outline->contours[i];\r\n\r\n      /* skip degenerate contours */\r\n      if ( last < first + 2 )\r\n        continue;\r\n\r\n      if ( ft_contour_enclosed( outline, i ) )\r\n        continue;\r\n\r\n      xmin       = first->x;\r\n      xmin_point = first;\r\n\r\n      for ( point = first + 1; point <= last; point++ )\r\n      {\r\n        if ( point->x < xmin )\r\n        {\r\n          xmin       = point->x;\r\n          xmin_point = point;\r\n        }\r\n      }\r\n\r\n      /* check the orientation of the contour */\r\n      {\r\n        FT_Vector*      prev;\r\n        FT_Vector*      next;\r\n        FT_Orientation  o;\r\n\r\n\r\n        prev = ( xmin_point == first ) ? last : xmin_point - 1;\r\n        next = ( xmin_point == last ) ? first : xmin_point + 1;\r\n\r\n        if ( FT_Atan2( prev->x - xmin_point->x, prev->y - xmin_point->y ) >\r\n             FT_Atan2( next->x - xmin_point->x, next->y - xmin_point->y ) )\r\n          o = FT_ORIENTATION_POSTSCRIPT;\r\n        else\r\n          o = FT_ORIENTATION_TRUETYPE;\r\n\r\n        if ( orient == FT_ORIENTATION_NONE )\r\n          orient = o;\r\n        else if ( orient != o )\r\n          return FT_ORIENTATION_NONE;\r\n      }\r\n    }\r\n\r\n    return orient;\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_Embolden( FT_Outline*  outline,\r\n                       FT_Pos       strength )\r\n  {\r\n    return FT_Outline_EmboldenXY( outline, strength, strength );\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Outline_EmboldenXY( FT_Outline*  outline,\r\n                         FT_Pos       xstrength,\r\n                         FT_Pos       ystrength )\r\n  {\r\n    FT_Vector*  points;\r\n    FT_Vector   v_prev, v_first, v_next, v_cur;\r\n    FT_Int      c, n, first;\r\n    FT_Int      orientation;\r\n\r\n\r\n    if ( !outline )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    xstrength /= 2;\r\n    ystrength /= 2;\r\n    if ( xstrength == 0 && ystrength == 0 )\r\n      return FT_Err_Ok;\r\n\r\n    orientation = FT_Outline_Get_Orientation( outline );\r\n    if ( orientation == FT_ORIENTATION_NONE )\r\n    {\r\n      if ( outline->n_contours )\r\n        return FT_Err_Invalid_Argument;\r\n      else\r\n        return FT_Err_Ok;\r\n    }\r\n\r\n    points = outline->points;\r\n\r\n    first = 0;\r\n    for ( c = 0; c < outline->n_contours; c++ )\r\n    {\r\n      FT_Vector  in, out, shift;\r\n      FT_Fixed   l_in, l_out, l, q, d;\r\n      int        last = outline->contours[c];\r\n\r\n\r\n      v_first = points[first];\r\n      v_prev  = points[last];\r\n      v_cur   = v_first;\r\n\r\n      /* compute the incoming vector and its length */\r\n      in.x = v_cur.x - v_prev.x;\r\n      in.y = v_cur.y - v_prev.y;\r\n      l_in = FT_Vector_Length( &in );\r\n\r\n      for ( n = first; n <= last; n++ )\r\n      {\r\n        if ( n < last )\r\n          v_next = points[n + 1];\r\n        else\r\n          v_next = v_first;\r\n\r\n        /* compute the outgoing vector and its length */\r\n        out.x = v_next.x - v_cur.x;\r\n        out.y = v_next.y - v_cur.y;\r\n        l_out = FT_Vector_Length( &out );\r\n\r\n        d = l_in * l_out + in.x * out.x + in.y * out.y;\r\n\r\n        /* shift only if turn is less then ~160 degrees */\r\n        if ( 16 * d > l_in * l_out )\r\n        {\r\n          /* shift components are aligned along bisector        */\r\n          /* and directed according to the outline orientation. */\r\n          shift.x = l_out * in.y + l_in * out.y;\r\n          shift.y = l_out * in.x + l_in * out.x;\r\n\r\n          if ( orientation == FT_ORIENTATION_TRUETYPE )\r\n            shift.x = -shift.x;\r\n          else\r\n            shift.y = -shift.y;\r\n\r\n          /* threshold strength to better handle collapsing segments */\r\n          l = FT_MIN( l_in, l_out );\r\n          q = out.x * in.y - out.y * in.x;\r\n          if ( orientation == FT_ORIENTATION_TRUETYPE )\r\n            q = -q;\r\n\r\n          if ( FT_MulDiv( xstrength, q, l ) < d )\r\n            shift.x = FT_MulDiv( shift.x, xstrength, d );\r\n          else\r\n            shift.x = FT_MulDiv( shift.x, l, q );\r\n\r\n          \r\n          if ( FT_MulDiv( ystrength, q, l ) < d )\r\n            shift.y = FT_MulDiv( shift.y, ystrength, d );\r\n          else\r\n            shift.y = FT_MulDiv( shift.y, l, q );\r\n        }\r\n        else\r\n          shift.x = shift.y = 0;\r\n\r\n        outline->points[n].x = v_cur.x + xstrength + shift.x;\r\n        outline->points[n].y = v_cur.y + ystrength + shift.y;\r\n\r\n        in    = out;\r\n        l_in  = l_out;\r\n        v_cur = v_next;\r\n      }\r\n\r\n      first = last + 1;\r\n    }\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* documentation is in ftoutln.h */\r\n\r\n  FT_EXPORT_DEF( FT_Orientation )\r\n  FT_Outline_Get_Orientation( FT_Outline*  outline )\r\n  {\r\n    FT_Vector*  points;\r\n    FT_Vector   v_prev, v_cur;\r\n    FT_Int      c, n, first;\r\n    FT_Pos      area = 0;\r\n\r\n\r\n    if ( !outline || outline->n_points <= 0 )\r\n      return FT_ORIENTATION_TRUETYPE;\r\n\r\n    /* We use the nonzero winding rule to find the orientation.       */\r\n    /* Since glyph outlines behave much more `regular' than arbitrary */\r\n    /* cubic or quadratic curves, this test deals with the polygon    */\r\n    /* only which is spanned up by the control points.                */\r\n\r\n    points = outline->points;\r\n\r\n    first = 0;\r\n    for ( c = 0; c < outline->n_contours; c++ )\r\n    {\r\n      FT_Int  last = outline->contours[c];\r\n\r\n\r\n      v_prev = points[last];\r\n\r\n      for ( n = first; n <= last; n++ )\r\n      {\r\n        v_cur = points[n];\r\n        area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x );\r\n        v_prev = v_cur;\r\n      }\r\n\r\n      first = last + 1;\r\n    }\r\n\r\n    if ( area > 0 )\r\n      return FT_ORIENTATION_POSTSCRIPT;\r\n    else if ( area < 0 )\r\n      return FT_ORIENTATION_TRUETYPE;\r\n    else\r\n      return FT_ORIENTATION_NONE;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftpatent.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpatent.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for checking patented TrueType bytecode instructions    */\r\n/*    (body).                                                              */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2008, 2010 by David Turner.                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_SERVICE_SFNT_H\r\n#include FT_SERVICE_TRUETYPE_GLYF_H\r\n\r\n\r\n  static FT_Bool\r\n  _tt_check_patents_in_range( FT_Stream  stream,\r\n                              FT_ULong   size )\r\n  {\r\n    FT_Bool   result = FALSE;\r\n    FT_Error  error;\r\n    FT_Bytes  p, end;\r\n\r\n\r\n    if ( FT_FRAME_ENTER( size ) )\r\n      return 0;\r\n\r\n    p   = stream->cursor;\r\n    end = p + size;\r\n\r\n    while ( p < end )\r\n    {\r\n      switch (p[0])\r\n      {\r\n      case 0x06:  /* SPvTL // */\r\n      case 0x07:  /* SPvTL +  */\r\n      case 0x08:  /* SFvTL // */\r\n      case 0x09:  /* SFvTL +  */\r\n      case 0x0A:  /* SPvFS    */\r\n      case 0x0B:  /* SFvFS    */\r\n        result = TRUE;\r\n        goto Exit;\r\n\r\n      case 0x40:\r\n        if ( p + 1 >= end )\r\n          goto Exit;\r\n\r\n        p += p[1] + 2;\r\n        break;\r\n\r\n      case 0x41:\r\n        if ( p + 1 >= end )\r\n          goto Exit;\r\n\r\n        p += p[1] * 2 + 2;\r\n        break;\r\n\r\n      case 0x71:  /* DELTAP2 */\r\n      case 0x72:  /* DELTAP3 */\r\n      case 0x73:  /* DELTAC0 */\r\n      case 0x74:  /* DELTAC1 */\r\n      case 0x75:  /* DELTAC2 */\r\n        result = TRUE;\r\n        goto Exit;\r\n\r\n      case 0xB0:\r\n      case 0xB1:\r\n      case 0xB2:\r\n      case 0xB3:\r\n      case 0xB4:\r\n      case 0xB5:\r\n      case 0xB6:\r\n      case 0xB7:\r\n        p += ( p[0] - 0xB0 ) + 2;\r\n        break;\r\n\r\n      case 0xB8:\r\n      case 0xB9:\r\n      case 0xBA:\r\n      case 0xBB:\r\n      case 0xBC:\r\n      case 0xBD:\r\n      case 0xBE:\r\n      case 0xBF:\r\n        p += ( p[0] - 0xB8 ) * 2 + 3;\r\n        break;\r\n\r\n      default:\r\n        p += 1;\r\n        break;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    FT_UNUSED( error );\r\n    FT_FRAME_EXIT();\r\n    return result;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  _tt_check_patents_in_table( FT_Face   face,\r\n                              FT_ULong  tag )\r\n  {\r\n    FT_Stream              stream = face->stream;\r\n    FT_Error               error  = FT_Err_Ok;\r\n    FT_Service_SFNT_Table  service;\r\n    FT_Bool                result = FALSE;\r\n\r\n\r\n    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );\r\n\r\n    if ( service )\r\n    {\r\n      FT_UInt   i = 0;\r\n      FT_ULong  tag_i = 0, offset_i = 0, length_i = 0;\r\n\r\n\r\n      for ( i = 0; !error && tag_i != tag ; i++ )\r\n        error = service->table_info( face, i,\r\n                                     &tag_i, &offset_i, &length_i );\r\n\r\n      if ( error                      ||\r\n           FT_STREAM_SEEK( offset_i ) )\r\n        goto Exit;\r\n\r\n      result = _tt_check_patents_in_range( stream, length_i );\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  _tt_face_check_patents( FT_Face  face )\r\n  {\r\n    FT_Stream  stream = face->stream;\r\n    FT_UInt    gindex;\r\n    FT_Error   error;\r\n    FT_Bool    result;\r\n\r\n    FT_Service_TTGlyf  service;\r\n\r\n\r\n    result = _tt_check_patents_in_table( face, TTAG_fpgm );\r\n    if ( result )\r\n      goto Exit;\r\n\r\n    result = _tt_check_patents_in_table( face, TTAG_prep );\r\n    if ( result )\r\n      goto Exit;\r\n\r\n    FT_FACE_FIND_SERVICE( face, service, TT_GLYF );\r\n    if ( service == NULL )\r\n      goto Exit;\r\n\r\n    for ( gindex = 0; gindex < (FT_UInt)face->num_glyphs; gindex++ )\r\n    {\r\n      FT_ULong  offset, num_ins, size;\r\n      FT_Int    num_contours;\r\n\r\n\r\n      offset = service->get_location( face, gindex, &size );\r\n      if ( size == 0 )\r\n        continue;\r\n\r\n      if ( FT_STREAM_SEEK( offset )      ||\r\n           FT_READ_SHORT( num_contours ) )\r\n        continue;\r\n\r\n      if ( num_contours >= 0 )  /* simple glyph */\r\n      {\r\n        if ( FT_STREAM_SKIP( 8 + num_contours * 2 ) )\r\n          continue;\r\n      }\r\n      else  /* compound glyph */\r\n      {\r\n        FT_Bool  has_instr = 0;\r\n\r\n\r\n        if ( FT_STREAM_SKIP( 8 ) )\r\n          continue;\r\n\r\n        /* now read each component */\r\n        for (;;)\r\n        {\r\n          FT_UInt  flags, toskip;\r\n\r\n\r\n          if( FT_READ_USHORT( flags ) )\r\n            break;\r\n\r\n          toskip = 2 + 1 + 1;\r\n\r\n          if ( ( flags & ( 1 << 0 ) ) != 0 )       /* ARGS_ARE_WORDS */\r\n            toskip += 2;\r\n\r\n          if ( ( flags & ( 1 << 3 ) ) != 0 )       /* WE_HAVE_A_SCALE */\r\n            toskip += 2;\r\n          else if ( ( flags & ( 1 << 6 ) ) != 0 )  /* WE_HAVE_X_Y_SCALE */\r\n            toskip += 4;\r\n          else if ( ( flags & ( 1 << 7 ) ) != 0 )  /* WE_HAVE_A_2x2 */\r\n            toskip += 8;\r\n\r\n          if ( ( flags & ( 1 << 8 ) ) != 0 )       /* WE_HAVE_INSTRUCTIONS */\r\n            has_instr = 1;\r\n\r\n          if ( FT_STREAM_SKIP( toskip ) )\r\n            goto NextGlyph;\r\n\r\n          if ( ( flags & ( 1 << 5 ) ) == 0 )       /* MORE_COMPONENTS */\r\n            break;\r\n        }\r\n\r\n        if ( !has_instr )\r\n          goto NextGlyph;\r\n      }\r\n\r\n      if ( FT_READ_USHORT( num_ins ) )\r\n        continue;\r\n\r\n      result = _tt_check_patents_in_range( stream, num_ins );\r\n      if ( result )\r\n        goto Exit;\r\n\r\n    NextGlyph:\r\n      ;\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Bool )\r\n  FT_Face_CheckTrueTypePatents( FT_Face  face )\r\n  {\r\n    FT_Bool  result = FALSE;\r\n\r\n\r\n    if ( face && FT_IS_SFNT( face ) )\r\n      result = _tt_face_check_patents( face );\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  FT_EXPORT_DEF( FT_Bool )\r\n  FT_Face_SetUnpatentedHinting( FT_Face  face,\r\n                                FT_Bool  value )\r\n  {\r\n    FT_Bool  result = FALSE;\r\n\r\n\r\n#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \\\r\n    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )\r\n    if ( face && FT_IS_SFNT( face ) )\r\n    {\r\n      result = !face->internal->ignore_unpatented_hinter;\r\n      face->internal->ignore_unpatented_hinter = !value;\r\n    }\r\n#else\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( value );\r\n#endif\r\n\r\n    return result;\r\n  }\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftpfr.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpfr.c                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing PFR-specific data (body).                 */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2008, 2010 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_PFR_H\r\n\r\n\r\n  /* check the format */\r\n  static FT_Service_PfrMetrics\r\n  ft_pfr_check( FT_Face  face )\r\n  {\r\n    FT_Service_PfrMetrics  service = NULL;\r\n\r\n\r\n    if ( face )\r\n      FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );\r\n\r\n    return service;\r\n  }\r\n\r\n\r\n  /* documentation is in ftpfr.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_PFR_Metrics( FT_Face    face,\r\n                      FT_UInt   *aoutline_resolution,\r\n                      FT_UInt   *ametrics_resolution,\r\n                      FT_Fixed  *ametrics_x_scale,\r\n                      FT_Fixed  *ametrics_y_scale )\r\n  {\r\n    FT_Error               error = FT_Err_Ok;\r\n    FT_Service_PfrMetrics  service;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    service = ft_pfr_check( face );\r\n    if ( service )\r\n    {\r\n      error = service->get_metrics( face,\r\n                                    aoutline_resolution,\r\n                                    ametrics_resolution,\r\n                                    ametrics_x_scale,\r\n                                    ametrics_y_scale );\r\n    }\r\n    else\r\n    {\r\n      FT_Fixed  x_scale, y_scale;\r\n\r\n\r\n      /* this is not a PFR font */\r\n      if ( aoutline_resolution )\r\n        *aoutline_resolution = face->units_per_EM;\r\n\r\n      if ( ametrics_resolution )\r\n        *ametrics_resolution = face->units_per_EM;\r\n\r\n      x_scale = y_scale = 0x10000L;\r\n      if ( face->size )\r\n      {\r\n        x_scale = face->size->metrics.x_scale;\r\n        y_scale = face->size->metrics.y_scale;\r\n      }\r\n\r\n      if ( ametrics_x_scale )\r\n        *ametrics_x_scale = x_scale;\r\n\r\n      if ( ametrics_y_scale )\r\n        *ametrics_y_scale = y_scale;\r\n\r\n      error = FT_Err_Unknown_File_Format;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftpfr.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_PFR_Kerning( FT_Face     face,\r\n                      FT_UInt     left,\r\n                      FT_UInt     right,\r\n                      FT_Vector  *avector )\r\n  {\r\n    FT_Error               error;\r\n    FT_Service_PfrMetrics  service;\r\n\r\n\r\n    if ( !face )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    service = ft_pfr_check( face );\r\n    if ( service )\r\n      error = service->get_kerning( face, left, right, avector );\r\n    else\r\n      error = FT_Get_Kerning( face, left, right,\r\n                              FT_KERNING_UNSCALED, avector );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftpfr.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_PFR_Advance( FT_Face   face,\r\n                      FT_UInt   gindex,\r\n                      FT_Pos   *aadvance )\r\n  {\r\n    FT_Error               error;\r\n    FT_Service_PfrMetrics  service;\r\n\r\n\r\n    service = ft_pfr_check( face );\r\n    if ( service )\r\n    {\r\n      error = service->get_advance( face, gindex, aadvance );\r\n    }\r\n    else\r\n      /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */\r\n      error = FT_Err_Invalid_Argument;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpic.c                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services (body).              */\r\n/*                                                                         */\r\n/*  Copyright 2009 by                                                      */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"basepic.h\"\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* documentation is in ftpic.h */\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  ft_pic_container_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n    FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) );\r\n\r\n    error = ft_base_pic_init( library );\r\n    if ( error )\r\n      return error;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* Destroy the contents of the container. */\r\n  FT_BASE_DEF( void )\r\n  ft_pic_container_destroy( FT_Library  library )\r\n  {\r\n    ft_base_pic_free( library );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftrfork.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrfork.c                                                              */\r\n/*                                                                         */\r\n/*    Embedded resource forks accessor (body).                             */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by                  */\r\n/*  Masatake YAMATO and Redhat K.K.                                        */\r\n/*                                                                         */\r\n/*  FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are     */\r\n/*  derived from ftobjs.c.                                                 */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/* Development of the code in this file is support of                      */\r\n/* Information-technology Promotion Agency, Japan.                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_RFORK_H\r\n#include \"basepic.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_raccess\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****               Resource fork directory access                    ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Raccess_Get_HeaderInfo( FT_Library  library,\r\n                             FT_Stream   stream,\r\n                             FT_Long     rfork_offset,\r\n                             FT_Long    *map_offset,\r\n                             FT_Long    *rdata_pos )\r\n  {\r\n    FT_Error       error;\r\n    unsigned char  head[16], head2[16];\r\n    FT_Long        map_pos, rdata_len;\r\n    int            allzeros, allmatch, i;\r\n    FT_Long        type_list;\r\n\r\n    FT_UNUSED( library );\r\n\r\n\r\n    error = FT_Stream_Seek( stream, rfork_offset );\r\n    if ( error )\r\n      return error;\r\n\r\n    error = FT_Stream_Read( stream, (FT_Byte *)head, 16 );\r\n    if ( error )\r\n      return error;\r\n\r\n    *rdata_pos = rfork_offset + ( ( head[0] << 24 ) |\r\n                                  ( head[1] << 16 ) |\r\n                                  ( head[2] <<  8 ) |\r\n                                    head[3]         );\r\n    map_pos    = rfork_offset + ( ( head[4] << 24 ) |\r\n                                  ( head[5] << 16 ) |\r\n                                  ( head[6] <<  8 ) |\r\n                                    head[7]         );\r\n    rdata_len = ( head[ 8] << 24 ) |\r\n                ( head[ 9] << 16 ) |\r\n                ( head[10] <<  8 ) |\r\n                  head[11];\r\n\r\n    /* map_len = head[12] .. head[15] */\r\n\r\n    if ( *rdata_pos + rdata_len != map_pos || map_pos == rfork_offset )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    error = FT_Stream_Seek( stream, map_pos );\r\n    if ( error )\r\n      return error;\r\n\r\n    head2[15] = (FT_Byte)( head[15] + 1 );       /* make it be different */\r\n\r\n    error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 );\r\n    if ( error )\r\n      return error;\r\n\r\n    allzeros = 1;\r\n    allmatch = 1;\r\n    for ( i = 0; i < 16; ++i )\r\n    {\r\n      if ( head2[i] != 0 )\r\n        allzeros = 0;\r\n      if ( head2[i] != head[i] )\r\n        allmatch = 0;\r\n    }\r\n    if ( !allzeros && !allmatch )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    /* If we have reached this point then it is probably a mac resource */\r\n    /* file.  Now, does it contain any interesting resources?           */\r\n    /* Skip handle to next resource map, the file resource number, and  */\r\n    /* attributes.                                                      */\r\n    (void)FT_STREAM_SKIP( 4        /* skip handle to next resource map */\r\n                          + 2      /* skip file resource number */\r\n                          + 2 );   /* skip attributes */\r\n\r\n    if ( FT_READ_USHORT( type_list ) )\r\n      return error;\r\n    if ( type_list == -1 )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    error = FT_Stream_Seek( stream, map_pos + type_list );\r\n    if ( error )\r\n      return error;\r\n\r\n    *map_offset = map_pos + type_list;\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static int\r\n  ft_raccess_sort_ref_by_id( FT_RFork_Ref*  a,\r\n                             FT_RFork_Ref*  b )\r\n  {\r\n    if ( a->res_id < b->res_id )\r\n      return -1;\r\n    else if ( a->res_id > b->res_id )\r\n      return 1;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Raccess_Get_DataOffsets( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              FT_Long     map_offset,\r\n                              FT_Long     rdata_pos,\r\n                              FT_Long     tag,\r\n                              FT_Long   **offsets,\r\n                              FT_Long    *count )\r\n  {\r\n    FT_Error      error;\r\n    int           i, j, cnt, subcnt;\r\n    FT_Long       tag_internal, rpos;\r\n    FT_Memory     memory = library->memory;\r\n    FT_Long       temp;\r\n    FT_Long       *offsets_internal = NULL;\r\n    FT_RFork_Ref  *ref = NULL;\r\n\r\n\r\n    error = FT_Stream_Seek( stream, map_offset );\r\n    if ( error )\r\n      return error;\r\n\r\n    if ( FT_READ_USHORT( cnt ) )\r\n      return error;\r\n    cnt++;\r\n\r\n    for ( i = 0; i < cnt; ++i )\r\n    {\r\n      if ( FT_READ_LONG( tag_internal ) ||\r\n           FT_READ_USHORT( subcnt )     ||\r\n           FT_READ_USHORT( rpos )       )\r\n        return error;\r\n\r\n      FT_TRACE2(( \"Resource tags: %c%c%c%c\\n\",\r\n                  (char)( 0xff & ( tag_internal >> 24 ) ),\r\n                  (char)( 0xff & ( tag_internal >> 16 ) ),\r\n                  (char)( 0xff & ( tag_internal >>  8 ) ),\r\n                  (char)( 0xff & ( tag_internal >>  0 ) ) ));\r\n\r\n      if ( tag_internal == tag )\r\n      {\r\n        *count = subcnt + 1;\r\n        rpos  += map_offset;\r\n\r\n        error = FT_Stream_Seek( stream, rpos );\r\n        if ( error )\r\n          return error;\r\n\r\n        if ( FT_NEW_ARRAY( ref, *count ) )\r\n          return error;\r\n\r\n        for ( j = 0; j < *count; ++j )\r\n        {\r\n          if ( FT_READ_USHORT( ref[j].res_id ) )\r\n            goto Exit;\r\n          if ( FT_STREAM_SKIP( 2 ) ) /* resource name */\r\n            goto Exit;\r\n          if ( FT_READ_LONG( temp ) )\r\n            goto Exit;\r\n          if ( FT_STREAM_SKIP( 4 ) ) /* mbz */\r\n            goto Exit;\r\n\r\n          ref[j].offset = temp & 0xFFFFFFL;\r\n        }\r\n\r\n        ft_qsort( ref, *count, sizeof ( FT_RFork_Ref ),\r\n                  ( int(*)(const void*, const void*) )\r\n                  ft_raccess_sort_ref_by_id );\r\n\r\n        if ( FT_NEW_ARRAY( offsets_internal, *count ) )\r\n          goto Exit;\r\n\r\n        /* XXX: duplicated reference ID,\r\n         *      gap between reference IDs are acceptable?\r\n         *      further investigation on Apple implementation is needed.\r\n         */\r\n        for ( j = 0; j < *count; ++j )\r\n          offsets_internal[j] = rdata_pos + ref[j].offset;\r\n\r\n        *offsets = offsets_internal;\r\n        error    = FT_Err_Ok;\r\n\r\n      Exit:\r\n        FT_FREE( ref );\r\n        return error;\r\n      }\r\n    }\r\n\r\n    return FT_Err_Cannot_Open_Resource;\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                     Guessing functions                          ****/\r\n  /****                                                                 ****/\r\n  /****            When you add a new guessing function,                ****/\r\n  /****           update FT_RACCESS_N_RULES in ftrfork.h.               ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static FT_Error\r\n  raccess_guess_apple_double( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              char       *base_file_name,\r\n                              char      **result_file_name,\r\n                              FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_apple_single( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              char       *base_file_name,\r\n                              char      **result_file_name,\r\n                              FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_darwin_ufs_export( FT_Library  library,\r\n                                   FT_Stream   stream,\r\n                                   char       *base_file_name,\r\n                                   char      **result_file_name,\r\n                                   FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_darwin_newvfs( FT_Library  library,\r\n                               FT_Stream   stream,\r\n                               char       *base_file_name,\r\n                               char      **result_file_name,\r\n                               FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_darwin_hfsplus( FT_Library  library,\r\n                                FT_Stream   stream,\r\n                                char       *base_file_name,\r\n                                char      **result_file_name,\r\n                                FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_vfat( FT_Library  library,\r\n                      FT_Stream   stream,\r\n                      char       *base_file_name,\r\n                      char      **result_file_name,\r\n                      FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_cap( FT_Library  library,\r\n                           FT_Stream   stream,\r\n                           char       *base_file_name,\r\n                           char      **result_file_name,\r\n                           FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_double( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              char       *base_file_name,\r\n                              char      **result_file_name,\r\n                              FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_netatalk( FT_Library  library,\r\n                                FT_Stream   stream,\r\n                                char       *base_file_name,\r\n                                char      **result_file_name,\r\n                                FT_Long    *result_offset );\r\n\r\n\r\n  CONST_FT_RFORK_RULE_ARRAY_BEGIN(ft_raccess_guess_table,\r\n                                  ft_raccess_guess_rec)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_double,      apple_double)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_single,      apple_single)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_ufs_export, darwin_ufs_export)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_newvfs,     darwin_newvfs)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_hfsplus,    darwin_hfsplus)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(vfat,              vfat)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_cap,         linux_cap)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_double,      linux_double)\r\n  CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_netatalk,    linux_netatalk)\r\n  CONST_FT_RFORK_RULE_ARRAY_END\r\n\r\n\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                       Helper functions                          ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n\r\n  static FT_Error\r\n  raccess_guess_apple_generic( FT_Library  library,\r\n                               FT_Stream   stream,\r\n                               char       *base_file_name,\r\n                               FT_Int32    magic,\r\n                               FT_Long    *result_offset );\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_double_from_file_name( FT_Library  library,\r\n                                             char *      file_name,\r\n                                             FT_Long    *result_offset );\r\n\r\n  static char *\r\n  raccess_make_file_name( FT_Memory    memory,\r\n                          const char  *original_name,\r\n                          const char  *insertion );\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Raccess_Guess( FT_Library  library,\r\n                    FT_Stream   stream,\r\n                    char*       base_name,\r\n                    char      **new_names,\r\n                    FT_Long    *offsets,\r\n                    FT_Error   *errors )\r\n  {\r\n    FT_Int  i;\r\n\r\n\r\n    for ( i = 0; i < FT_RACCESS_N_RULES; i++ )\r\n    {\r\n      new_names[i] = NULL;\r\n      if ( NULL != stream )\r\n        errors[i] = FT_Stream_Seek( stream, 0 );\r\n      else\r\n        errors[i] = FT_Err_Ok;\r\n\r\n      if ( errors[i] )\r\n        continue ;\r\n\r\n      errors[i] = (FT_RACCESS_GUESS_TABLE_GET[i].func)( library,\r\n                                                 stream, base_name,\r\n                                                 &(new_names[i]),\r\n                                                 &(offsets[i]) );\r\n    }\r\n\r\n    return;\r\n  }\r\n\r\n\r\n#ifndef FT_MACINTOSH\r\n  static FT_RFork_Rule\r\n  raccess_get_rule_type_from_rule_index( FT_Library  library,\r\n                                         FT_UInt     rule_index )\r\n  {\r\n    FT_UNUSED( library );\r\n\r\n    if ( rule_index >= FT_RACCESS_N_RULES )\r\n      return FT_RFork_Rule_invalid;\r\n\r\n    return FT_RACCESS_GUESS_TABLE_GET[rule_index].type;\r\n  }\r\n\r\n\r\n  /*\r\n   * For this function, refer ftbase.h.\r\n   */\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  ft_raccess_rule_by_darwin_vfs( FT_Library  library,\r\n                                 FT_UInt     rule_index )\r\n  {\r\n    switch( raccess_get_rule_type_from_rule_index( library, rule_index ) )\r\n    {\r\n      case FT_RFork_Rule_darwin_newvfs:\r\n      case FT_RFork_Rule_darwin_hfsplus:\r\n        return TRUE;\r\n\r\n      default:\r\n        return FALSE;\r\n    }\r\n  }\r\n#endif\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_apple_double( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              char       *base_file_name,\r\n                              char      **result_file_name,\r\n                              FT_Long    *result_offset )\r\n  {\r\n    FT_Int32  magic = ( 0x00 << 24 ) |\r\n                      ( 0x05 << 16 ) |\r\n                      ( 0x16 <<  8 ) |\r\n                        0x07;\r\n\r\n\r\n    *result_file_name = NULL;\r\n    if ( NULL == stream )\r\n      return FT_Err_Cannot_Open_Stream;\r\n\r\n    return raccess_guess_apple_generic( library, stream, base_file_name,\r\n                                        magic, result_offset );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_apple_single( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              char       *base_file_name,\r\n                              char      **result_file_name,\r\n                              FT_Long    *result_offset )\r\n  {\r\n    FT_Int32  magic = ( 0x00 << 24 ) |\r\n                      ( 0x05 << 16 ) |\r\n                      ( 0x16 <<  8 ) |\r\n                        0x00;\r\n\r\n\r\n    *result_file_name = NULL;\r\n    if ( NULL == stream )\r\n      return FT_Err_Cannot_Open_Stream;\r\n\r\n    return raccess_guess_apple_generic( library, stream, base_file_name,\r\n                                        magic, result_offset );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_darwin_ufs_export( FT_Library  library,\r\n                                   FT_Stream   stream,\r\n                                   char       *base_file_name,\r\n                                   char      **result_file_name,\r\n                                   FT_Long    *result_offset )\r\n  {\r\n    char*      newpath;\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory  = library->memory;\r\n    newpath = raccess_make_file_name( memory, base_file_name, \"._\" );\r\n    if ( !newpath )\r\n      return FT_Err_Out_Of_Memory;\r\n\r\n    error = raccess_guess_linux_double_from_file_name( library, newpath,\r\n                                                       result_offset );\r\n    if ( !error )\r\n      *result_file_name = newpath;\r\n    else\r\n      FT_FREE( newpath );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_darwin_hfsplus( FT_Library  library,\r\n                                FT_Stream   stream,\r\n                                char       *base_file_name,\r\n                                char      **result_file_name,\r\n                                FT_Long    *result_offset )\r\n  {\r\n    /*\r\n      Only meaningful on systems with hfs+ drivers (or Macs).\r\n     */\r\n    FT_Error   error;\r\n    char*      newpath = NULL;\r\n    FT_Memory  memory;\r\n    FT_Long    base_file_len = ft_strlen( base_file_name );\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    if ( base_file_len + 6 > FT_INT_MAX )\r\n      return FT_Err_Array_Too_Large;\r\n\r\n    if ( FT_ALLOC( newpath, base_file_len + 6 ) )\r\n      return error;\r\n\r\n    FT_MEM_COPY( newpath, base_file_name, base_file_len );\r\n    FT_MEM_COPY( newpath + base_file_len, \"/rsrc\", 6 );\r\n\r\n    *result_file_name = newpath;\r\n    *result_offset    = 0;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_darwin_newvfs( FT_Library  library,\r\n                               FT_Stream   stream,\r\n                               char       *base_file_name,\r\n                               char      **result_file_name,\r\n                               FT_Long    *result_offset )\r\n  {\r\n    /*\r\n      Only meaningful on systems with Mac OS X (> 10.1).\r\n     */\r\n    FT_Error   error;\r\n    char*      newpath = NULL;\r\n    FT_Memory  memory;\r\n    FT_Long    base_file_len = ft_strlen( base_file_name );\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    if ( base_file_len + 18 > FT_INT_MAX )\r\n      return FT_Err_Array_Too_Large;\r\n\r\n    if ( FT_ALLOC( newpath, base_file_len + 18 ) )\r\n      return error;\r\n\r\n    FT_MEM_COPY( newpath, base_file_name, base_file_len );\r\n    FT_MEM_COPY( newpath + base_file_len, \"/..namedfork/rsrc\", 18 );\r\n\r\n    *result_file_name = newpath;\r\n    *result_offset    = 0;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_vfat( FT_Library  library,\r\n                      FT_Stream   stream,\r\n                      char       *base_file_name,\r\n                      char      **result_file_name,\r\n                      FT_Long    *result_offset )\r\n  {\r\n    char*      newpath;\r\n    FT_Memory  memory;\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    newpath = raccess_make_file_name( memory, base_file_name,\r\n                                      \"resource.frk/\" );\r\n    if ( !newpath )\r\n      return FT_Err_Out_Of_Memory;\r\n\r\n    *result_file_name = newpath;\r\n    *result_offset    = 0;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_cap( FT_Library  library,\r\n                           FT_Stream   stream,\r\n                           char       *base_file_name,\r\n                           char      **result_file_name,\r\n                           FT_Long    *result_offset )\r\n  {\r\n    char*      newpath;\r\n    FT_Memory  memory;\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    newpath = raccess_make_file_name( memory, base_file_name, \".resource/\" );\r\n    if ( !newpath )\r\n      return FT_Err_Out_Of_Memory;\r\n\r\n    *result_file_name = newpath;\r\n    *result_offset    = 0;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_double( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              char       *base_file_name,\r\n                              char      **result_file_name,\r\n                              FT_Long    *result_offset )\r\n  {\r\n    char*      newpath;\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    newpath = raccess_make_file_name( memory, base_file_name, \"%\" );\r\n    if ( !newpath )\r\n      return FT_Err_Out_Of_Memory;\r\n\r\n    error = raccess_guess_linux_double_from_file_name( library, newpath,\r\n                                                       result_offset );\r\n    if ( !error )\r\n      *result_file_name = newpath;\r\n    else\r\n      FT_FREE( newpath );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_netatalk( FT_Library  library,\r\n                                FT_Stream   stream,\r\n                                char       *base_file_name,\r\n                                char      **result_file_name,\r\n                                FT_Long    *result_offset )\r\n  {\r\n    char*      newpath;\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    memory = library->memory;\r\n\r\n    newpath = raccess_make_file_name( memory, base_file_name,\r\n                                      \".AppleDouble/\" );\r\n    if ( !newpath )\r\n      return FT_Err_Out_Of_Memory;\r\n\r\n    error = raccess_guess_linux_double_from_file_name( library, newpath,\r\n                                                       result_offset );\r\n    if ( !error )\r\n      *result_file_name = newpath;\r\n    else\r\n      FT_FREE( newpath );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_apple_generic( FT_Library  library,\r\n                               FT_Stream   stream,\r\n                               char       *base_file_name,\r\n                               FT_Int32    magic,\r\n                               FT_Long    *result_offset )\r\n  {\r\n    FT_Int32   magic_from_stream;\r\n    FT_Error   error;\r\n    FT_Int32   version_number = 0;\r\n    FT_UShort  n_of_entries;\r\n\r\n    int        i;\r\n    FT_UInt32  entry_id, entry_offset, entry_length = 0;\r\n\r\n    const FT_UInt32  resource_fork_entry_id = 0x2;\r\n\r\n    FT_UNUSED( library );\r\n    FT_UNUSED( base_file_name );\r\n    FT_UNUSED( version_number );\r\n    FT_UNUSED( entry_length   );\r\n\r\n\r\n    if ( FT_READ_LONG( magic_from_stream ) )\r\n      return error;\r\n    if ( magic_from_stream != magic )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    if ( FT_READ_LONG( version_number ) )\r\n      return error;\r\n\r\n    /* filler */\r\n    error = FT_Stream_Skip( stream, 16 );\r\n    if ( error )\r\n      return error;\r\n\r\n    if ( FT_READ_USHORT( n_of_entries ) )\r\n      return error;\r\n    if ( n_of_entries == 0 )\r\n      return FT_Err_Unknown_File_Format;\r\n\r\n    for ( i = 0; i < n_of_entries; i++ )\r\n    {\r\n      if ( FT_READ_LONG( entry_id ) )\r\n        return error;\r\n      if ( entry_id == resource_fork_entry_id )\r\n      {\r\n        if ( FT_READ_LONG( entry_offset ) ||\r\n             FT_READ_LONG( entry_length ) )\r\n          continue;\r\n        *result_offset = entry_offset;\r\n\r\n        return FT_Err_Ok;\r\n      }\r\n      else\r\n      {\r\n        error = FT_Stream_Skip( stream, 4 + 4 );    /* offset + length */\r\n        if ( error )\r\n          return error;\r\n      }\r\n    }\r\n\r\n    return FT_Err_Unknown_File_Format;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  raccess_guess_linux_double_from_file_name( FT_Library  library,\r\n                                             char       *file_name,\r\n                                             FT_Long    *result_offset )\r\n  {\r\n    FT_Open_Args  args2;\r\n    FT_Stream     stream2;\r\n    char *        nouse = NULL;\r\n    FT_Error      error;\r\n\r\n\r\n    args2.flags    = FT_OPEN_PATHNAME;\r\n    args2.pathname = file_name;\r\n    error = FT_Stream_New( library, &args2, &stream2 );\r\n    if ( error )\r\n      return error;\r\n\r\n    error = raccess_guess_apple_double( library, stream2, file_name,\r\n                                        &nouse, result_offset );\r\n\r\n    FT_Stream_Free( stream2, 0 );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static char*\r\n  raccess_make_file_name( FT_Memory    memory,\r\n                          const char  *original_name,\r\n                          const char  *insertion )\r\n  {\r\n    char*        new_name = NULL;\r\n    const char*  tmp;\r\n    const char*  slash;\r\n    size_t       new_length;\r\n    FT_Error     error = FT_Err_Ok;\r\n\r\n    FT_UNUSED( error );\r\n\r\n\r\n    new_length = ft_strlen( original_name ) + ft_strlen( insertion );\r\n    if ( FT_ALLOC( new_name, new_length + 1 ) )\r\n      return NULL;\r\n\r\n    tmp = ft_strrchr( original_name, '/' );\r\n    if ( tmp )\r\n    {\r\n      ft_strncpy( new_name, original_name, tmp - original_name + 1 );\r\n      new_name[tmp - original_name + 1] = '\\0';\r\n      slash = tmp + 1;\r\n    }\r\n    else\r\n    {\r\n      slash       = original_name;\r\n      new_name[0] = '\\0';\r\n    }\r\n\r\n    ft_strcat( new_name, insertion );\r\n    ft_strcat( new_name, slash );\r\n\r\n    return new_name;\r\n  }\r\n\r\n\r\n#else   /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                  Dummy function; just sets errors                     */\r\n  /*************************************************************************/\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Raccess_Guess( FT_Library  library,\r\n                    FT_Stream   stream,\r\n                    char       *base_name,\r\n                    char      **new_names,\r\n                    FT_Long    *offsets,\r\n                    FT_Error   *errors )\r\n  {\r\n    FT_Int  i;\r\n\r\n    FT_UNUSED( library );\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( base_name );\r\n\r\n\r\n    for ( i = 0; i < FT_RACCESS_N_RULES; i++ )\r\n    {\r\n      new_names[i] = NULL;\r\n      offsets[i]   = 0;\r\n      errors[i]    = FT_Err_Unimplemented_Feature;\r\n    }\r\n  }\r\n\r\n\r\n#endif  /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftsnames.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsnames.c                                                             */\r\n/*                                                                         */\r\n/*    Simple interface to access SFNT name tables (which are used          */\r\n/*    to hold font names, copyright info, notices, etc.) (body).           */\r\n/*                                                                         */\r\n/*    This is _not_ used to retrieve glyph names!                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2009 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_SFNT_NAMES_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_SFNT_NAMES\r\n\r\n\r\n  /* documentation is in ftsnames.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt )\r\n  FT_Get_Sfnt_Name_Count( FT_Face  face )\r\n  {\r\n    return ( face && FT_IS_SFNT( face ) ) ? ((TT_Face)face)->num_names : 0;\r\n  }\r\n\r\n\r\n  /* documentation is in ftsnames.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_Sfnt_Name( FT_Face       face,\r\n                    FT_UInt       idx,\r\n                    FT_SfntName  *aname )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n\r\n\r\n    if ( aname && face && FT_IS_SFNT( face ) )\r\n    {\r\n      TT_Face  ttface = (TT_Face)face;\r\n\r\n\r\n      if ( idx < (FT_UInt)ttface->num_names )\r\n      {\r\n        TT_NameEntryRec*  entry = ttface->name_table.names + idx;\r\n\r\n\r\n        /* load name on demand */\r\n        if ( entry->stringLength > 0 && entry->string == NULL )\r\n        {\r\n          FT_Memory  memory = face->memory;\r\n          FT_Stream  stream = face->stream;\r\n\r\n\r\n          if ( FT_NEW_ARRAY  ( entry->string, entry->stringLength ) ||\r\n               FT_STREAM_SEEK( entry->stringOffset )                ||\r\n               FT_STREAM_READ( entry->string, entry->stringLength ) )\r\n          {\r\n            FT_FREE( entry->string );\r\n            entry->stringLength = 0;\r\n          }\r\n        }\r\n\r\n        aname->platform_id = entry->platformID;\r\n        aname->encoding_id = entry->encodingID;\r\n        aname->language_id = entry->languageID;\r\n        aname->name_id     = entry->nameID;\r\n        aname->string      = (FT_Byte*)entry->string;\r\n        aname->string_len  = entry->stringLength;\r\n\r\n        error = FT_Err_Ok;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#endif /* TT_CONFIG_OPTION_SFNT_NAMES */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftstream.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstream.c                                                             */\r\n/*                                                                         */\r\n/*    I/O stream support (body).                                           */\r\n/*                                                                         */\r\n/*  Copyright 2000-2002, 2004-2006, 2008-2011 by                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_stream\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Stream_OpenMemory( FT_Stream       stream,\r\n                        const FT_Byte*  base,\r\n                        FT_ULong        size )\r\n  {\r\n    stream->base   = (FT_Byte*) base;\r\n    stream->size   = size;\r\n    stream->pos    = 0;\r\n    stream->cursor = 0;\r\n    stream->read   = 0;\r\n    stream->close  = 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Stream_Close( FT_Stream  stream )\r\n  {\r\n    if ( stream && stream->close )\r\n      stream->close( stream );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_Seek( FT_Stream  stream,\r\n                  FT_ULong   pos )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n\r\n    if ( stream->read )\r\n    {\r\n      if ( stream->read( stream, pos, 0, 0 ) )\r\n      {\r\n        FT_ERROR(( \"FT_Stream_Seek:\"\r\n                   \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n                   pos, stream->size ));\r\n\r\n        error = FT_Err_Invalid_Stream_Operation;\r\n      }\r\n    }\r\n    /* note that seeking to the first position after the file is valid */\r\n    else if ( pos > stream->size )\r\n    {\r\n      FT_ERROR(( \"FT_Stream_Seek:\"\r\n                 \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n                 pos, stream->size ));\r\n\r\n      error = FT_Err_Invalid_Stream_Operation;\r\n    }\r\n\r\n    if ( !error )\r\n      stream->pos = pos;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_Skip( FT_Stream  stream,\r\n                  FT_Long    distance )\r\n  {\r\n    if ( distance < 0 )\r\n      return FT_Err_Invalid_Stream_Operation;\r\n\r\n    return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Long )\r\n  FT_Stream_Pos( FT_Stream  stream )\r\n  {\r\n    return stream->pos;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_Read( FT_Stream  stream,\r\n                  FT_Byte*   buffer,\r\n                  FT_ULong   count )\r\n  {\r\n    return FT_Stream_ReadAt( stream, stream->pos, buffer, count );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_ReadAt( FT_Stream  stream,\r\n                    FT_ULong   pos,\r\n                    FT_Byte*   buffer,\r\n                    FT_ULong   count )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n    FT_ULong  read_bytes;\r\n\r\n\r\n    if ( pos >= stream->size )\r\n    {\r\n      FT_ERROR(( \"FT_Stream_ReadAt:\"\r\n                 \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n                 pos, stream->size ));\r\n\r\n      return FT_Err_Invalid_Stream_Operation;\r\n    }\r\n\r\n    if ( stream->read )\r\n      read_bytes = stream->read( stream, pos, buffer, count );\r\n    else\r\n    {\r\n      read_bytes = stream->size - pos;\r\n      if ( read_bytes > count )\r\n        read_bytes = count;\r\n\r\n      FT_MEM_COPY( buffer, stream->base + pos, read_bytes );\r\n    }\r\n\r\n    stream->pos = pos + read_bytes;\r\n\r\n    if ( read_bytes < count )\r\n    {\r\n      FT_ERROR(( \"FT_Stream_ReadAt:\"\r\n                 \" invalid read; expected %lu bytes, got %lu\\n\",\r\n                 count, read_bytes ));\r\n\r\n      error = FT_Err_Invalid_Stream_Operation;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_TryRead( FT_Stream  stream,\r\n                     FT_Byte*   buffer,\r\n                     FT_ULong   count )\r\n  {\r\n    FT_ULong  read_bytes = 0;\r\n\r\n\r\n    if ( stream->pos >= stream->size )\r\n      goto Exit;\r\n\r\n    if ( stream->read )\r\n      read_bytes = stream->read( stream, stream->pos, buffer, count );\r\n    else\r\n    {\r\n      read_bytes = stream->size - stream->pos;\r\n      if ( read_bytes > count )\r\n        read_bytes = count;\r\n\r\n      FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );\r\n    }\r\n\r\n    stream->pos += read_bytes;\r\n\r\n  Exit:\r\n    return read_bytes;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_ExtractFrame( FT_Stream  stream,\r\n                          FT_ULong   count,\r\n                          FT_Byte**  pbytes )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = FT_Stream_EnterFrame( stream, count );\r\n    if ( !error )\r\n    {\r\n      *pbytes = (FT_Byte*)stream->cursor;\r\n\r\n      /* equivalent to FT_Stream_ExitFrame(), with no memory block release */\r\n      stream->cursor = 0;\r\n      stream->limit  = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Stream_ReleaseFrame( FT_Stream  stream,\r\n                          FT_Byte**  pbytes )\r\n  {\r\n    if ( stream && stream->read )\r\n    {\r\n      FT_Memory  memory = stream->memory;\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n      ft_mem_free( memory, *pbytes );\r\n      *pbytes = NULL;\r\n#else\r\n      FT_FREE( *pbytes );\r\n#endif\r\n    }\r\n    *pbytes = 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_EnterFrame( FT_Stream  stream,\r\n                        FT_ULong   count )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n    FT_ULong  read_bytes;\r\n\r\n\r\n    /* check for nested frame access */\r\n    FT_ASSERT( stream && stream->cursor == 0 );\r\n\r\n    if ( stream->read )\r\n    {\r\n      /* allocate the frame in memory */\r\n      FT_Memory  memory = stream->memory;\r\n\r\n\r\n      /* simple sanity check */\r\n      if ( count > stream->size )\r\n      {\r\n        FT_ERROR(( \"FT_Stream_EnterFrame:\"\r\n                   \" frame size (%lu) larger than stream size (%lu)\\n\",\r\n                   count, stream->size ));\r\n\r\n        error = FT_Err_Invalid_Stream_Operation;\r\n        goto Exit;\r\n      }\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n      /* assume _ft_debug_file and _ft_debug_lineno are already set */\r\n      stream->base = (unsigned char*)ft_mem_qalloc( memory, count, &error );\r\n      if ( error )\r\n        goto Exit;\r\n#else\r\n      if ( FT_QALLOC( stream->base, count ) )\r\n        goto Exit;\r\n#endif\r\n      /* read it */\r\n      read_bytes = stream->read( stream, stream->pos,\r\n                                 stream->base, count );\r\n      if ( read_bytes < count )\r\n      {\r\n        FT_ERROR(( \"FT_Stream_EnterFrame:\"\r\n                   \" invalid read; expected %lu bytes, got %lu\\n\",\r\n                   count, read_bytes ));\r\n\r\n        FT_FREE( stream->base );\r\n        error = FT_Err_Invalid_Stream_Operation;\r\n      }\r\n      stream->cursor = stream->base;\r\n      stream->limit  = stream->cursor + count;\r\n      stream->pos   += read_bytes;\r\n    }\r\n    else\r\n    {\r\n      /* check current and new position */\r\n      if ( stream->pos >= stream->size        ||\r\n           stream->size - stream->pos < count )\r\n      {\r\n        FT_ERROR(( \"FT_Stream_EnterFrame:\"\r\n                   \" invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\\n\",\r\n                   stream->pos, count, stream->size ));\r\n\r\n        error = FT_Err_Invalid_Stream_Operation;\r\n        goto Exit;\r\n      }\r\n\r\n      /* set cursor */\r\n      stream->cursor = stream->base + stream->pos;\r\n      stream->limit  = stream->cursor + count;\r\n      stream->pos   += count;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Stream_ExitFrame( FT_Stream  stream )\r\n  {\r\n    /* IMPORTANT: The assertion stream->cursor != 0 was removed, given    */\r\n    /*            that it is possible to access a frame of length 0 in    */\r\n    /*            some weird fonts (usually, when accessing an array of   */\r\n    /*            0 records, like in some strange kern tables).           */\r\n    /*                                                                    */\r\n    /*  In this case, the loader code handles the 0-length table          */\r\n    /*  gracefully; however, stream.cursor is really set to 0 by the      */\r\n    /*  FT_Stream_EnterFrame() call, and this is not an error.            */\r\n    /*                                                                    */\r\n    FT_ASSERT( stream );\r\n\r\n    if ( stream->read )\r\n    {\r\n      FT_Memory  memory = stream->memory;\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n      ft_mem_free( memory, stream->base );\r\n      stream->base = NULL;\r\n#else\r\n      FT_FREE( stream->base );\r\n#endif\r\n    }\r\n    stream->cursor = 0;\r\n    stream->limit  = 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Char )\r\n  FT_Stream_GetChar( FT_Stream  stream )\r\n  {\r\n    FT_Char  result;\r\n\r\n\r\n    FT_ASSERT( stream && stream->cursor );\r\n\r\n    result = 0;\r\n    if ( stream->cursor < stream->limit )\r\n      result = *stream->cursor++;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_UShort )\r\n  FT_Stream_GetUShort( FT_Stream  stream )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_Short  result;\r\n\r\n\r\n    FT_ASSERT( stream && stream->cursor );\r\n\r\n    result         = 0;\r\n    p              = stream->cursor;\r\n    if ( p + 1 < stream->limit )\r\n      result       = FT_NEXT_USHORT( p );\r\n    stream->cursor = p;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_UShort )\r\n  FT_Stream_GetUShortLE( FT_Stream  stream )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_Short  result;\r\n\r\n\r\n    FT_ASSERT( stream && stream->cursor );\r\n\r\n    result         = 0;\r\n    p              = stream->cursor;\r\n    if ( p + 1 < stream->limit )\r\n      result       = FT_NEXT_USHORT_LE( p );\r\n    stream->cursor = p;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_GetUOffset( FT_Stream  stream )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_Long   result;\r\n\r\n\r\n    FT_ASSERT( stream && stream->cursor );\r\n\r\n    result         = 0;\r\n    p              = stream->cursor;\r\n    if ( p + 2 < stream->limit )\r\n      result       = FT_NEXT_UOFF3( p );\r\n    stream->cursor = p;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_GetULong( FT_Stream  stream )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_Long   result;\r\n\r\n\r\n    FT_ASSERT( stream && stream->cursor );\r\n\r\n    result         = 0;\r\n    p              = stream->cursor;\r\n    if ( p + 3 < stream->limit )\r\n      result       = FT_NEXT_ULONG( p );\r\n    stream->cursor = p;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_GetULongLE( FT_Stream  stream )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_Long   result;\r\n\r\n\r\n    FT_ASSERT( stream && stream->cursor );\r\n\r\n    result         = 0;\r\n    p              = stream->cursor;\r\n    if ( p + 3 < stream->limit )\r\n      result       = FT_NEXT_ULONG_LE( p );\r\n    stream->cursor = p;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Char )\r\n  FT_Stream_ReadChar( FT_Stream  stream,\r\n                      FT_Error*  error )\r\n  {\r\n    FT_Byte  result = 0;\r\n\r\n\r\n    FT_ASSERT( stream );\r\n\r\n    *error = FT_Err_Ok;\r\n\r\n    if ( stream->read )\r\n    {\r\n      if ( stream->read( stream, stream->pos, &result, 1L ) != 1L )\r\n        goto Fail;\r\n    }\r\n    else\r\n    {\r\n      if ( stream->pos < stream->size )\r\n        result = stream->base[stream->pos];\r\n      else\r\n        goto Fail;\r\n    }\r\n    stream->pos++;\r\n\r\n    return result;\r\n\r\n  Fail:\r\n    *error = FT_Err_Invalid_Stream_Operation;\r\n    FT_ERROR(( \"FT_Stream_ReadChar:\"\r\n               \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n               stream->pos, stream->size ));\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_UShort )\r\n  FT_Stream_ReadUShort( FT_Stream  stream,\r\n                       FT_Error*  error )\r\n  {\r\n    FT_Byte   reads[2];\r\n    FT_Byte*  p = 0;\r\n    FT_Short  result = 0;\r\n\r\n\r\n    FT_ASSERT( stream );\r\n\r\n    *error = FT_Err_Ok;\r\n\r\n    if ( stream->pos + 1 < stream->size )\r\n    {\r\n      if ( stream->read )\r\n      {\r\n        if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )\r\n          goto Fail;\r\n\r\n        p = reads;\r\n      }\r\n      else\r\n      {\r\n        p = stream->base + stream->pos;\r\n      }\r\n\r\n      if ( p )\r\n        result = FT_NEXT_USHORT( p );\r\n    }\r\n    else\r\n      goto Fail;\r\n\r\n    stream->pos += 2;\r\n\r\n    return result;\r\n\r\n  Fail:\r\n    *error = FT_Err_Invalid_Stream_Operation;\r\n    FT_ERROR(( \"FT_Stream_ReadUShort:\"\r\n               \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n               stream->pos, stream->size ));\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_UShort )\r\n  FT_Stream_ReadUShortLE( FT_Stream  stream,\r\n                         FT_Error*  error )\r\n  {\r\n    FT_Byte   reads[2];\r\n    FT_Byte*  p = 0;\r\n    FT_Short  result = 0;\r\n\r\n\r\n    FT_ASSERT( stream );\r\n\r\n    *error = FT_Err_Ok;\r\n\r\n    if ( stream->pos + 1 < stream->size )\r\n    {\r\n      if ( stream->read )\r\n      {\r\n        if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )\r\n          goto Fail;\r\n\r\n        p = reads;\r\n      }\r\n      else\r\n      {\r\n        p = stream->base + stream->pos;\r\n      }\r\n\r\n      if ( p )\r\n        result = FT_NEXT_USHORT_LE( p );\r\n    }\r\n    else\r\n      goto Fail;\r\n\r\n    stream->pos += 2;\r\n\r\n    return result;\r\n\r\n  Fail:\r\n    *error = FT_Err_Invalid_Stream_Operation;\r\n    FT_ERROR(( \"FT_Stream_ReadUShortLE:\"\r\n               \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n               stream->pos, stream->size ));\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_ReadUOffset( FT_Stream  stream,\r\n                        FT_Error*  error )\r\n  {\r\n    FT_Byte   reads[3];\r\n    FT_Byte*  p = 0;\r\n    FT_Long   result = 0;\r\n\r\n\r\n    FT_ASSERT( stream );\r\n\r\n    *error = FT_Err_Ok;\r\n\r\n    if ( stream->pos + 2 < stream->size )\r\n    {\r\n      if ( stream->read )\r\n      {\r\n        if (stream->read( stream, stream->pos, reads, 3L ) != 3L )\r\n          goto Fail;\r\n\r\n        p = reads;\r\n      }\r\n      else\r\n      {\r\n        p = stream->base + stream->pos;\r\n      }\r\n\r\n      if ( p )\r\n        result = FT_NEXT_UOFF3( p );\r\n    }\r\n    else\r\n      goto Fail;\r\n\r\n    stream->pos += 3;\r\n\r\n    return result;\r\n\r\n  Fail:\r\n    *error = FT_Err_Invalid_Stream_Operation;\r\n    FT_ERROR(( \"FT_Stream_ReadUOffset:\"\r\n               \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n               stream->pos, stream->size ));\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_ReadULong( FT_Stream  stream,\r\n                      FT_Error*  error )\r\n  {\r\n    FT_Byte   reads[4];\r\n    FT_Byte*  p = 0;\r\n    FT_Long   result = 0;\r\n\r\n\r\n    FT_ASSERT( stream );\r\n\r\n    *error = FT_Err_Ok;\r\n\r\n    if ( stream->pos + 3 < stream->size )\r\n    {\r\n      if ( stream->read )\r\n      {\r\n        if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )\r\n          goto Fail;\r\n\r\n        p = reads;\r\n      }\r\n      else\r\n      {\r\n        p = stream->base + stream->pos;\r\n      }\r\n\r\n      if ( p )\r\n        result = FT_NEXT_ULONG( p );\r\n    }\r\n    else\r\n      goto Fail;\r\n\r\n    stream->pos += 4;\r\n\r\n    return result;\r\n\r\n  Fail:\r\n    *error = FT_Err_Invalid_Stream_Operation;\r\n    FT_ERROR(( \"FT_Stream_ReadULong:\"\r\n               \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n               stream->pos, stream->size ));\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_ULong )\r\n  FT_Stream_ReadULongLE( FT_Stream  stream,\r\n                        FT_Error*  error )\r\n  {\r\n    FT_Byte   reads[4];\r\n    FT_Byte*  p = 0;\r\n    FT_Long   result = 0;\r\n\r\n\r\n    FT_ASSERT( stream );\r\n\r\n    *error = FT_Err_Ok;\r\n\r\n    if ( stream->pos + 3 < stream->size )\r\n    {\r\n      if ( stream->read )\r\n      {\r\n        if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )\r\n          goto Fail;\r\n\r\n        p = reads;\r\n      }\r\n      else\r\n      {\r\n        p = stream->base + stream->pos;\r\n      }\r\n\r\n      if ( p )\r\n        result = FT_NEXT_ULONG_LE( p );\r\n    }\r\n    else\r\n      goto Fail;\r\n\r\n    stream->pos += 4;\r\n\r\n    return result;\r\n\r\n  Fail:\r\n    *error = FT_Err_Invalid_Stream_Operation;\r\n    FT_ERROR(( \"FT_Stream_ReadULongLE:\"\r\n               \" invalid i/o; pos = 0x%lx, size = 0x%lx\\n\",\r\n               stream->pos, stream->size ));\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_ReadFields( FT_Stream              stream,\r\n                        const FT_Frame_Field*  fields,\r\n                        void*                  structure )\r\n  {\r\n    FT_Error  error;\r\n    FT_Bool   frame_accessed = 0;\r\n    FT_Byte*  cursor;\r\n\r\n    if ( !fields || !stream )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    cursor = stream->cursor;\r\n\r\n    error = FT_Err_Ok;\r\n    do\r\n    {\r\n      FT_ULong  value;\r\n      FT_Int    sign_shift;\r\n      FT_Byte*  p;\r\n\r\n\r\n      switch ( fields->value )\r\n      {\r\n      case ft_frame_start:  /* access a new frame */\r\n        error = FT_Stream_EnterFrame( stream, fields->offset );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        frame_accessed = 1;\r\n        cursor         = stream->cursor;\r\n        fields++;\r\n        continue;  /* loop! */\r\n\r\n      case ft_frame_bytes:  /* read a byte sequence */\r\n      case ft_frame_skip:   /* skip some bytes      */\r\n        {\r\n          FT_UInt  len = fields->size;\r\n\r\n\r\n          if ( cursor + len > stream->limit )\r\n          {\r\n            error = FT_Err_Invalid_Stream_Operation;\r\n            goto Exit;\r\n          }\r\n\r\n          if ( fields->value == ft_frame_bytes )\r\n          {\r\n            p = (FT_Byte*)structure + fields->offset;\r\n            FT_MEM_COPY( p, cursor, len );\r\n          }\r\n          cursor += len;\r\n          fields++;\r\n          continue;\r\n        }\r\n\r\n      case ft_frame_byte:\r\n      case ft_frame_schar:  /* read a single byte */\r\n        value = FT_NEXT_BYTE(cursor);\r\n        sign_shift = 24;\r\n        break;\r\n\r\n      case ft_frame_short_be:\r\n      case ft_frame_ushort_be:  /* read a 2-byte big-endian short */\r\n        value = FT_NEXT_USHORT(cursor);\r\n        sign_shift = 16;\r\n        break;\r\n\r\n      case ft_frame_short_le:\r\n      case ft_frame_ushort_le:  /* read a 2-byte little-endian short */\r\n        value = FT_NEXT_USHORT_LE(cursor);\r\n        sign_shift = 16;\r\n        break;\r\n\r\n      case ft_frame_long_be:\r\n      case ft_frame_ulong_be:  /* read a 4-byte big-endian long */\r\n        value = FT_NEXT_ULONG(cursor);\r\n        sign_shift = 0;\r\n        break;\r\n\r\n      case ft_frame_long_le:\r\n      case ft_frame_ulong_le:  /* read a 4-byte little-endian long */\r\n        value = FT_NEXT_ULONG_LE(cursor);\r\n        sign_shift = 0;\r\n        break;\r\n\r\n      case ft_frame_off3_be:\r\n      case ft_frame_uoff3_be:  /* read a 3-byte big-endian long */\r\n        value = FT_NEXT_UOFF3(cursor);\r\n        sign_shift = 8;\r\n        break;\r\n\r\n      case ft_frame_off3_le:\r\n      case ft_frame_uoff3_le:  /* read a 3-byte little-endian long */\r\n        value = FT_NEXT_UOFF3_LE(cursor);\r\n        sign_shift = 8;\r\n        break;\r\n\r\n      default:\r\n        /* otherwise, exit the loop */\r\n        stream->cursor = cursor;\r\n        goto Exit;\r\n      }\r\n\r\n      /* now, compute the signed value is necessary */\r\n      if ( fields->value & FT_FRAME_OP_SIGNED )\r\n        value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift );\r\n\r\n      /* finally, store the value in the object */\r\n\r\n      p = (FT_Byte*)structure + fields->offset;\r\n      switch ( fields->size )\r\n      {\r\n      case (8 / FT_CHAR_BIT):\r\n        *(FT_Byte*)p = (FT_Byte)value;\r\n        break;\r\n\r\n      case (16 / FT_CHAR_BIT):\r\n        *(FT_UShort*)p = (FT_UShort)value;\r\n        break;\r\n\r\n      case (32 / FT_CHAR_BIT):\r\n        *(FT_UInt32*)p = (FT_UInt32)value;\r\n        break;\r\n\r\n      default:  /* for 64-bit systems */\r\n        *(FT_ULong*)p = (FT_ULong)value;\r\n      }\r\n\r\n      /* go to next field */\r\n      fields++;\r\n    }\r\n    while ( 1 );\r\n\r\n  Exit:\r\n    /* close the frame if it was opened by this read */\r\n    if ( frame_accessed )\r\n      FT_Stream_ExitFrame( stream );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftstroke.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstroke.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType path stroker (body).                                        */\r\n/*                                                                         */\r\n/*  Copyright 2002-2006, 2008-2011 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_STROKER_H\r\n#include FT_TRIGONOMETRY_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_StrokerBorder )\r\n  FT_Outline_GetInsideBorder( FT_Outline*  outline )\r\n  {\r\n    FT_Orientation  o = FT_Outline_Get_Orientation( outline );\r\n\r\n\r\n    return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT\r\n                                        : FT_STROKER_BORDER_LEFT;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_StrokerBorder )\r\n  FT_Outline_GetOutsideBorder( FT_Outline*  outline )\r\n  {\r\n    FT_Orientation  o = FT_Outline_Get_Orientation( outline );\r\n\r\n\r\n    return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_LEFT\r\n                                        : FT_STROKER_BORDER_RIGHT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      BEZIER COMPUTATIONS                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define FT_SMALL_CONIC_THRESHOLD  ( FT_ANGLE_PI / 6 )\r\n#define FT_SMALL_CUBIC_THRESHOLD  ( FT_ANGLE_PI / 8 )\r\n\r\n#define FT_EPSILON  2\r\n\r\n#define FT_IS_SMALL( x )  ( (x) > -FT_EPSILON && (x) < FT_EPSILON )\r\n\r\n\r\n  static FT_Pos\r\n  ft_pos_abs( FT_Pos  x )\r\n  {\r\n    return x >= 0 ? x : -x;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_conic_split( FT_Vector*  base )\r\n  {\r\n    FT_Pos  a, b;\r\n\r\n\r\n    base[4].x = base[2].x;\r\n    b = base[1].x;\r\n    a = base[3].x = ( base[2].x + b ) / 2;\r\n    b = base[1].x = ( base[0].x + b ) / 2;\r\n    base[2].x = ( a + b ) / 2;\r\n\r\n    base[4].y = base[2].y;\r\n    b = base[1].y;\r\n    a = base[3].y = ( base[2].y + b ) / 2;\r\n    b = base[1].y = ( base[0].y + b ) / 2;\r\n    base[2].y = ( a + b ) / 2;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  ft_conic_is_small_enough( FT_Vector*  base,\r\n                            FT_Angle   *angle_in,\r\n                            FT_Angle   *angle_out )\r\n  {\r\n    FT_Vector  d1, d2;\r\n    FT_Angle   theta;\r\n    FT_Int     close1, close2;\r\n\r\n\r\n    d1.x = base[1].x - base[2].x;\r\n    d1.y = base[1].y - base[2].y;\r\n    d2.x = base[0].x - base[1].x;\r\n    d2.y = base[0].y - base[1].y;\r\n\r\n    close1 = FT_IS_SMALL( d1.x ) && FT_IS_SMALL( d1.y );\r\n    close2 = FT_IS_SMALL( d2.x ) && FT_IS_SMALL( d2.y );\r\n\r\n    if ( close1 )\r\n    {\r\n      if ( close2 )\r\n      {\r\n        /* basically a point;                      */\r\n        /* do nothing to retain original direction */\r\n      }\r\n      else\r\n      {\r\n        *angle_in  =\r\n        *angle_out = FT_Atan2( d2.x, d2.y );\r\n      }\r\n    }\r\n    else /* !close1 */\r\n    {\r\n      if ( close2 )\r\n      {\r\n        *angle_in  =\r\n        *angle_out = FT_Atan2( d1.x, d1.y );\r\n      }\r\n      else\r\n      {\r\n        *angle_in  = FT_Atan2( d1.x, d1.y );\r\n        *angle_out = FT_Atan2( d2.x, d2.y );\r\n      }\r\n    }\r\n\r\n    theta = ft_pos_abs( FT_Angle_Diff( *angle_in, *angle_out ) );\r\n\r\n    return FT_BOOL( theta < FT_SMALL_CONIC_THRESHOLD );\r\n  }\r\n\r\n\r\n  static void\r\n  ft_cubic_split( FT_Vector*  base )\r\n  {\r\n    FT_Pos  a, b, c, d;\r\n\r\n\r\n    base[6].x = base[3].x;\r\n    c = base[1].x;\r\n    d = base[2].x;\r\n    base[1].x = a = ( base[0].x + c ) / 2;\r\n    base[5].x = b = ( base[3].x + d ) / 2;\r\n    c = ( c + d ) / 2;\r\n    base[2].x = a = ( a + c ) / 2;\r\n    base[4].x = b = ( b + c ) / 2;\r\n    base[3].x = ( a + b ) / 2;\r\n\r\n    base[6].y = base[3].y;\r\n    c = base[1].y;\r\n    d = base[2].y;\r\n    base[1].y = a = ( base[0].y + c ) / 2;\r\n    base[5].y = b = ( base[3].y + d ) / 2;\r\n    c = ( c + d ) / 2;\r\n    base[2].y = a = ( a + c ) / 2;\r\n    base[4].y = b = ( b + c ) / 2;\r\n    base[3].y = ( a + b ) / 2;\r\n  }\r\n\r\n\r\n  /* Return the average of `angle1' and `angle2'.            */\r\n  /* This gives correct result even if `angle1' and `angle2' */\r\n  /* have opposite signs.                                    */\r\n  static FT_Angle\r\n  ft_angle_mean( FT_Angle  angle1,\r\n                 FT_Angle  angle2 )\r\n  {\r\n    return angle1 + FT_Angle_Diff( angle1, angle2 ) / 2;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  ft_cubic_is_small_enough( FT_Vector*  base,\r\n                            FT_Angle   *angle_in,\r\n                            FT_Angle   *angle_mid,\r\n                            FT_Angle   *angle_out )\r\n  {\r\n    FT_Vector  d1, d2, d3;\r\n    FT_Angle   theta1, theta2;\r\n    FT_Int     close1, close2, close3;\r\n\r\n\r\n    d1.x = base[2].x - base[3].x;\r\n    d1.y = base[2].y - base[3].y;\r\n    d2.x = base[1].x - base[2].x;\r\n    d2.y = base[1].y - base[2].y;\r\n    d3.x = base[0].x - base[1].x;\r\n    d3.y = base[0].y - base[1].y;\r\n\r\n    close1 = FT_IS_SMALL( d1.x ) && FT_IS_SMALL( d1.y );\r\n    close2 = FT_IS_SMALL( d2.x ) && FT_IS_SMALL( d2.y );\r\n    close3 = FT_IS_SMALL( d3.x ) && FT_IS_SMALL( d3.y );\r\n\r\n    if ( close1 )\r\n    {\r\n      if ( close2 )\r\n      {\r\n        if ( close3 )\r\n        {\r\n          /* basically a point;                      */\r\n          /* do nothing to retain original direction */\r\n        }\r\n        else /* !close3 */\r\n        {\r\n          *angle_in  =\r\n          *angle_mid =\r\n          *angle_out = FT_Atan2( d3.x, d3.y );\r\n        }\r\n      }\r\n      else /* !close2 */\r\n      {\r\n        if ( close3 )\r\n        {\r\n          *angle_in  =\r\n          *angle_mid =\r\n          *angle_out = FT_Atan2( d2.x, d2.y );\r\n        }\r\n        else /* !close3 */\r\n        {\r\n          *angle_in  =\r\n          *angle_mid = FT_Atan2( d2.x, d2.y );\r\n          *angle_out = FT_Atan2( d3.x, d3.y );\r\n        }\r\n      }\r\n    }\r\n    else /* !close1 */\r\n    {\r\n      if ( close2 )\r\n      {\r\n        if ( close3 )\r\n        {\r\n          *angle_in  =\r\n          *angle_mid =\r\n          *angle_out = FT_Atan2( d1.x, d1.y );\r\n        }\r\n        else /* !close3 */\r\n        {\r\n          *angle_in  = FT_Atan2( d1.x, d1.y );\r\n          *angle_out = FT_Atan2( d3.x, d3.y );\r\n          *angle_mid = ft_angle_mean( *angle_in, *angle_out );\r\n        }\r\n      }\r\n      else /* !close2 */\r\n      {\r\n        if ( close3 )\r\n        {\r\n          *angle_in  = FT_Atan2( d1.x, d1.y );\r\n          *angle_mid =\r\n          *angle_out = FT_Atan2( d2.x, d2.y );\r\n        }\r\n        else /* !close3 */\r\n        {\r\n          *angle_in  = FT_Atan2( d1.x, d1.y );\r\n          *angle_mid = FT_Atan2( d2.x, d2.y );\r\n          *angle_out = FT_Atan2( d3.x, d3.y );\r\n        }\r\n      }\r\n    }\r\n\r\n    theta1 = ft_pos_abs( FT_Angle_Diff( *angle_in,  *angle_mid ) );\r\n    theta2 = ft_pos_abs( FT_Angle_Diff( *angle_mid, *angle_out ) );\r\n\r\n    return FT_BOOL( theta1 < FT_SMALL_CUBIC_THRESHOLD &&\r\n                    theta2 < FT_SMALL_CUBIC_THRESHOLD );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       STROKE BORDERS                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef enum  FT_StrokeTags_\r\n  {\r\n    FT_STROKE_TAG_ON    = 1,   /* on-curve point  */\r\n    FT_STROKE_TAG_CUBIC = 2,   /* cubic off-point */\r\n    FT_STROKE_TAG_BEGIN = 4,   /* sub-path start  */\r\n    FT_STROKE_TAG_END   = 8    /* sub-path end    */\r\n\r\n  } FT_StrokeTags;\r\n\r\n#define  FT_STROKE_TAG_BEGIN_END  ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END )\r\n\r\n  typedef struct  FT_StrokeBorderRec_\r\n  {\r\n    FT_UInt     num_points;\r\n    FT_UInt     max_points;\r\n    FT_Vector*  points;\r\n    FT_Byte*    tags;\r\n    FT_Bool     movable;  /* TRUE for ends of lineto borders */\r\n    FT_Int      start;    /* index of current sub-path start point */\r\n    FT_Memory   memory;\r\n    FT_Bool     valid;\r\n\r\n  } FT_StrokeBorderRec, *FT_StrokeBorder;\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_grow( FT_StrokeBorder  border,\r\n                         FT_UInt          new_points )\r\n  {\r\n    FT_UInt   old_max = border->max_points;\r\n    FT_UInt   new_max = border->num_points + new_points;\r\n    FT_Error  error   = FT_Err_Ok;\r\n\r\n\r\n    if ( new_max > old_max )\r\n    {\r\n      FT_UInt    cur_max = old_max;\r\n      FT_Memory  memory  = border->memory;\r\n\r\n\r\n      while ( cur_max < new_max )\r\n        cur_max += ( cur_max >> 1 ) + 16;\r\n\r\n      if ( FT_RENEW_ARRAY( border->points, old_max, cur_max ) ||\r\n           FT_RENEW_ARRAY( border->tags,   old_max, cur_max ) )\r\n        goto Exit;\r\n\r\n      border->max_points = cur_max;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_stroke_border_close( FT_StrokeBorder  border,\r\n                          FT_Bool          reverse )\r\n  {\r\n    FT_UInt  start = border->start;\r\n    FT_UInt  count = border->num_points;\r\n\r\n\r\n    FT_ASSERT( border->start >= 0 );\r\n\r\n    /* don't record empty paths! */\r\n    if ( count <= start + 1U )\r\n      border->num_points = start;\r\n    else\r\n    {\r\n      /* copy the last point to the start of this sub-path, since */\r\n      /* it contains the `adjusted' starting coordinates          */\r\n      border->num_points    = --count;\r\n      border->points[start] = border->points[count];\r\n\r\n      if ( reverse )\r\n      {\r\n        /* reverse the points */\r\n        {\r\n          FT_Vector*  vec1 = border->points + start + 1;\r\n          FT_Vector*  vec2 = border->points + count - 1;\r\n\r\n\r\n          for ( ; vec1 < vec2; vec1++, vec2-- )\r\n          {\r\n            FT_Vector  tmp;\r\n\r\n\r\n            tmp   = *vec1;\r\n            *vec1 = *vec2;\r\n            *vec2 = tmp;\r\n          }\r\n        }\r\n\r\n        /* then the tags */\r\n        {\r\n          FT_Byte*  tag1 = border->tags + start + 1;\r\n          FT_Byte*  tag2 = border->tags + count - 1;\r\n\r\n\r\n          for ( ; tag1 < tag2; tag1++, tag2-- )\r\n          {\r\n            FT_Byte  tmp;\r\n\r\n\r\n            tmp   = *tag1;\r\n            *tag1 = *tag2;\r\n            *tag2 = tmp;\r\n          }\r\n        }\r\n      }\r\n\r\n      border->tags[start    ] |= FT_STROKE_TAG_BEGIN;\r\n      border->tags[count - 1] |= FT_STROKE_TAG_END;\r\n    }\r\n\r\n    border->start   = -1;\r\n    border->movable = FALSE;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_lineto( FT_StrokeBorder  border,\r\n                           FT_Vector*       to,\r\n                           FT_Bool          movable )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n\r\n    FT_ASSERT( border->start >= 0 );\r\n\r\n    if ( border->movable )\r\n    {\r\n      /* move last point */\r\n      border->points[border->num_points - 1] = *to;\r\n    }\r\n    else\r\n    {\r\n      /* don't add zero-length lineto */\r\n      if ( border->num_points > 0                                          &&\r\n           FT_IS_SMALL( border->points[border->num_points - 1].x - to->x ) &&\r\n           FT_IS_SMALL( border->points[border->num_points - 1].y - to->y ) )\r\n        return error;\r\n\r\n      /* add one point */\r\n      error = ft_stroke_border_grow( border, 1 );\r\n      if ( !error )\r\n      {\r\n        FT_Vector*  vec = border->points + border->num_points;\r\n        FT_Byte*    tag = border->tags   + border->num_points;\r\n\r\n\r\n        vec[0] = *to;\r\n        tag[0] = FT_STROKE_TAG_ON;\r\n\r\n        border->num_points += 1;\r\n      }\r\n    }\r\n    border->movable = movable;\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_conicto( FT_StrokeBorder  border,\r\n                            FT_Vector*       control,\r\n                            FT_Vector*       to )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    FT_ASSERT( border->start >= 0 );\r\n\r\n    error = ft_stroke_border_grow( border, 2 );\r\n    if ( !error )\r\n    {\r\n      FT_Vector*  vec = border->points + border->num_points;\r\n      FT_Byte*    tag = border->tags   + border->num_points;\r\n\r\n\r\n      vec[0] = *control;\r\n      vec[1] = *to;\r\n\r\n      tag[0] = 0;\r\n      tag[1] = FT_STROKE_TAG_ON;\r\n\r\n      border->num_points += 2;\r\n    }\r\n\r\n    border->movable = FALSE;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_cubicto( FT_StrokeBorder  border,\r\n                            FT_Vector*       control1,\r\n                            FT_Vector*       control2,\r\n                            FT_Vector*       to )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    FT_ASSERT( border->start >= 0 );\r\n\r\n    error = ft_stroke_border_grow( border, 3 );\r\n    if ( !error )\r\n    {\r\n      FT_Vector*  vec = border->points + border->num_points;\r\n      FT_Byte*    tag = border->tags   + border->num_points;\r\n\r\n\r\n      vec[0] = *control1;\r\n      vec[1] = *control2;\r\n      vec[2] = *to;\r\n\r\n      tag[0] = FT_STROKE_TAG_CUBIC;\r\n      tag[1] = FT_STROKE_TAG_CUBIC;\r\n      tag[2] = FT_STROKE_TAG_ON;\r\n\r\n      border->num_points += 3;\r\n    }\r\n\r\n    border->movable = FALSE;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#define FT_ARC_CUBIC_ANGLE  ( FT_ANGLE_PI / 2 )\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_arcto( FT_StrokeBorder  border,\r\n                          FT_Vector*       center,\r\n                          FT_Fixed         radius,\r\n                          FT_Angle         angle_start,\r\n                          FT_Angle         angle_diff )\r\n  {\r\n    FT_Angle   total, angle, step, rotate, next, theta;\r\n    FT_Vector  a, b, a2, b2;\r\n    FT_Fixed   length;\r\n    FT_Error   error = FT_Err_Ok;\r\n\r\n\r\n    /* compute start point */\r\n    FT_Vector_From_Polar( &a, radius, angle_start );\r\n    a.x += center->x;\r\n    a.y += center->y;\r\n\r\n    total  = angle_diff;\r\n    angle  = angle_start;\r\n    rotate = ( angle_diff >= 0 ) ? FT_ANGLE_PI2 : -FT_ANGLE_PI2;\r\n\r\n    while ( total != 0 )\r\n    {\r\n      step = total;\r\n      if ( step > FT_ARC_CUBIC_ANGLE )\r\n        step = FT_ARC_CUBIC_ANGLE;\r\n\r\n      else if ( step < -FT_ARC_CUBIC_ANGLE )\r\n        step = -FT_ARC_CUBIC_ANGLE;\r\n\r\n      next  = angle + step;\r\n      theta = step;\r\n      if ( theta < 0 )\r\n        theta = -theta;\r\n\r\n      theta >>= 1;\r\n\r\n      /* compute end point */\r\n      FT_Vector_From_Polar( &b, radius, next );\r\n      b.x += center->x;\r\n      b.y += center->y;\r\n\r\n      /* compute first and second control points */\r\n      length = FT_MulDiv( radius, FT_Sin( theta ) * 4,\r\n                          ( 0x10000L + FT_Cos( theta ) ) * 3 );\r\n\r\n      FT_Vector_From_Polar( &a2, length, angle + rotate );\r\n      a2.x += a.x;\r\n      a2.y += a.y;\r\n\r\n      FT_Vector_From_Polar( &b2, length, next - rotate );\r\n      b2.x += b.x;\r\n      b2.y += b.y;\r\n\r\n      /* add cubic arc */\r\n      error = ft_stroke_border_cubicto( border, &a2, &b2, &b );\r\n      if ( error )\r\n        break;\r\n\r\n      /* process the rest of the arc ?? */\r\n      a      = b;\r\n      total -= step;\r\n      angle  = next;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_moveto( FT_StrokeBorder  border,\r\n                           FT_Vector*       to )\r\n  {\r\n    /* close current open path if any ? */\r\n    if ( border->start >= 0 )\r\n      ft_stroke_border_close( border, FALSE );\r\n\r\n    border->start = border->num_points;\r\n    border->movable = FALSE;\r\n\r\n    return ft_stroke_border_lineto( border, to, FALSE );\r\n  }\r\n\r\n\r\n  static void\r\n  ft_stroke_border_init( FT_StrokeBorder  border,\r\n                         FT_Memory        memory )\r\n  {\r\n    border->memory = memory;\r\n    border->points = NULL;\r\n    border->tags   = NULL;\r\n\r\n    border->num_points = 0;\r\n    border->max_points = 0;\r\n    border->start      = -1;\r\n    border->valid      = FALSE;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_stroke_border_reset( FT_StrokeBorder  border )\r\n  {\r\n    border->num_points = 0;\r\n    border->start      = -1;\r\n    border->valid      = FALSE;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_stroke_border_done( FT_StrokeBorder  border )\r\n  {\r\n    FT_Memory  memory = border->memory;\r\n\r\n\r\n    FT_FREE( border->points );\r\n    FT_FREE( border->tags );\r\n\r\n    border->num_points = 0;\r\n    border->max_points = 0;\r\n    border->start      = -1;\r\n    border->valid      = FALSE;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroke_border_get_counts( FT_StrokeBorder  border,\r\n                               FT_UInt         *anum_points,\r\n                               FT_UInt         *anum_contours )\r\n  {\r\n    FT_Error  error        = FT_Err_Ok;\r\n    FT_UInt   num_points   = 0;\r\n    FT_UInt   num_contours = 0;\r\n\r\n    FT_UInt     count      = border->num_points;\r\n    FT_Vector*  point      = border->points;\r\n    FT_Byte*    tags       = border->tags;\r\n    FT_Int      in_contour = 0;\r\n\r\n\r\n    for ( ; count > 0; count--, num_points++, point++, tags++ )\r\n    {\r\n      if ( tags[0] & FT_STROKE_TAG_BEGIN )\r\n      {\r\n        if ( in_contour != 0 )\r\n          goto Fail;\r\n\r\n        in_contour = 1;\r\n      }\r\n      else if ( in_contour == 0 )\r\n        goto Fail;\r\n\r\n      if ( tags[0] & FT_STROKE_TAG_END )\r\n      {\r\n        in_contour = 0;\r\n        num_contours++;\r\n      }\r\n    }\r\n\r\n    if ( in_contour != 0 )\r\n      goto Fail;\r\n\r\n    border->valid = TRUE;\r\n\r\n  Exit:\r\n    *anum_points   = num_points;\r\n    *anum_contours = num_contours;\r\n    return error;\r\n\r\n  Fail:\r\n    num_points   = 0;\r\n    num_contours = 0;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_stroke_border_export( FT_StrokeBorder  border,\r\n                           FT_Outline*      outline )\r\n  {\r\n    /* copy point locations */\r\n    FT_ARRAY_COPY( outline->points + outline->n_points,\r\n                   border->points,\r\n                   border->num_points );\r\n\r\n    /* copy tags */\r\n    {\r\n      FT_UInt   count = border->num_points;\r\n      FT_Byte*  read  = border->tags;\r\n      FT_Byte*  write = (FT_Byte*)outline->tags + outline->n_points;\r\n\r\n\r\n      for ( ; count > 0; count--, read++, write++ )\r\n      {\r\n        if ( *read & FT_STROKE_TAG_ON )\r\n          *write = FT_CURVE_TAG_ON;\r\n        else if ( *read & FT_STROKE_TAG_CUBIC )\r\n          *write = FT_CURVE_TAG_CUBIC;\r\n        else\r\n          *write = FT_CURVE_TAG_CONIC;\r\n      }\r\n    }\r\n\r\n    /* copy contours */\r\n    {\r\n      FT_UInt    count = border->num_points;\r\n      FT_Byte*   tags  = border->tags;\r\n      FT_Short*  write = outline->contours + outline->n_contours;\r\n      FT_Short   idx   = (FT_Short)outline->n_points;\r\n\r\n\r\n      for ( ; count > 0; count--, tags++, idx++ )\r\n      {\r\n        if ( *tags & FT_STROKE_TAG_END )\r\n        {\r\n          *write++ = idx;\r\n          outline->n_contours++;\r\n        }\r\n      }\r\n    }\r\n\r\n    outline->n_points = (short)( outline->n_points + border->num_points );\r\n\r\n    FT_ASSERT( FT_Outline_Check( outline ) == 0 );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           STROKER                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define FT_SIDE_TO_ROTATE( s )   ( FT_ANGLE_PI2 - (s) * FT_ANGLE_PI )\r\n\r\n  typedef struct  FT_StrokerRec_\r\n  {\r\n    FT_Angle             angle_in;             /* direction into curr join */\r\n    FT_Angle             angle_out;            /* direction out of join  */\r\n    FT_Vector            center;               /* current position */\r\n    FT_Fixed             line_length;          /* length of last lineto */\r\n    FT_Bool              first_point;          /* is this the start? */\r\n    FT_Bool              subpath_open;         /* is the subpath open? */\r\n    FT_Angle             subpath_angle;        /* subpath start direction */\r\n    FT_Vector            subpath_start;        /* subpath start position */\r\n    FT_Fixed             subpath_line_length;  /* subpath start lineto len */\r\n    FT_Bool              handle_wide_strokes;  /* use wide strokes logic? */\r\n\r\n    FT_Stroker_LineCap   line_cap;\r\n    FT_Stroker_LineJoin  line_join;\r\n    FT_Stroker_LineJoin  line_join_saved;\r\n    FT_Fixed             miter_limit;\r\n    FT_Fixed             radius;\r\n\r\n    FT_StrokeBorderRec   borders[2];\r\n    FT_Library           library;\r\n\r\n  } FT_StrokerRec;\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_New( FT_Library   library,\r\n                  FT_Stroker  *astroker )\r\n  {\r\n    FT_Error    error;           /* assigned in FT_NEW */\r\n    FT_Memory   memory;\r\n    FT_Stroker  stroker = NULL;\r\n\r\n\r\n    if ( !library )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    memory = library->memory;\r\n\r\n    if ( !FT_NEW( stroker ) )\r\n    {\r\n      stroker->library = library;\r\n\r\n      ft_stroke_border_init( &stroker->borders[0], memory );\r\n      ft_stroke_border_init( &stroker->borders[1], memory );\r\n    }\r\n\r\n    *astroker = stroker;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Stroker_Set( FT_Stroker           stroker,\r\n                  FT_Fixed             radius,\r\n                  FT_Stroker_LineCap   line_cap,\r\n                  FT_Stroker_LineJoin  line_join,\r\n                  FT_Fixed             miter_limit )\r\n  {\r\n    stroker->radius      = radius;\r\n    stroker->line_cap    = line_cap;\r\n    stroker->line_join   = line_join;\r\n    stroker->miter_limit = miter_limit;\r\n\r\n    /* ensure miter limit has sensible value */\r\n    if ( stroker->miter_limit < 0x10000 )\r\n      stroker->miter_limit = 0x10000;\r\n\r\n    /* save line join style:                                           */\r\n    /* line join style can be temporarily changed when stroking curves */\r\n    stroker->line_join_saved = line_join;\r\n\r\n    FT_Stroker_Rewind( stroker );\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Stroker_Rewind( FT_Stroker  stroker )\r\n  {\r\n    if ( stroker )\r\n    {\r\n      ft_stroke_border_reset( &stroker->borders[0] );\r\n      ft_stroke_border_reset( &stroker->borders[1] );\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Stroker_Done( FT_Stroker  stroker )\r\n  {\r\n    if ( stroker )\r\n    {\r\n      FT_Memory  memory = stroker->library->memory;\r\n\r\n\r\n      ft_stroke_border_done( &stroker->borders[0] );\r\n      ft_stroke_border_done( &stroker->borders[1] );\r\n\r\n      stroker->library = NULL;\r\n      FT_FREE( stroker );\r\n    }\r\n  }\r\n\r\n\r\n  /* create a circular arc at a corner or cap */\r\n  static FT_Error\r\n  ft_stroker_arcto( FT_Stroker  stroker,\r\n                    FT_Int      side )\r\n  {\r\n    FT_Angle         total, rotate;\r\n    FT_Fixed         radius = stroker->radius;\r\n    FT_Error         error  = FT_Err_Ok;\r\n    FT_StrokeBorder  border = stroker->borders + side;\r\n\r\n\r\n    rotate = FT_SIDE_TO_ROTATE( side );\r\n\r\n    total = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );\r\n    if ( total == FT_ANGLE_PI )\r\n      total = -rotate * 2;\r\n\r\n    error = ft_stroke_border_arcto( border,\r\n                                    &stroker->center,\r\n                                    radius,\r\n                                    stroker->angle_in + rotate,\r\n                                    total );\r\n    border->movable = FALSE;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* add a cap at the end of an opened path */\r\n  static FT_Error\r\n  ft_stroker_cap( FT_Stroker  stroker,\r\n                  FT_Angle    angle,\r\n                  FT_Int      side )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n\r\n    if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND )\r\n    {\r\n      /* add a round cap */\r\n      stroker->angle_in  = angle;\r\n      stroker->angle_out = angle + FT_ANGLE_PI;\r\n\r\n      error = ft_stroker_arcto( stroker, side );\r\n    }\r\n    else if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE )\r\n    {\r\n      /* add a square cap */\r\n      FT_Vector        delta, delta2;\r\n      FT_Angle         rotate = FT_SIDE_TO_ROTATE( side );\r\n      FT_Fixed         radius = stroker->radius;\r\n      FT_StrokeBorder  border = stroker->borders + side;\r\n\r\n\r\n      FT_Vector_From_Polar( &delta2, radius, angle + rotate );\r\n      FT_Vector_From_Polar( &delta,  radius, angle );\r\n\r\n      delta.x += stroker->center.x + delta2.x;\r\n      delta.y += stroker->center.y + delta2.y;\r\n\r\n      error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      FT_Vector_From_Polar( &delta2, radius, angle - rotate );\r\n      FT_Vector_From_Polar( &delta,  radius, angle );\r\n\r\n      delta.x += delta2.x + stroker->center.x;\r\n      delta.y += delta2.y + stroker->center.y;\r\n\r\n      error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n    }\r\n    else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT )\r\n    {\r\n      /* add a butt ending */\r\n      FT_Vector        delta;\r\n      FT_Angle         rotate = FT_SIDE_TO_ROTATE( side );\r\n      FT_Fixed         radius = stroker->radius;\r\n      FT_StrokeBorder  border = stroker->borders + side;\r\n\r\n\r\n      FT_Vector_From_Polar( &delta, radius, angle + rotate );\r\n\r\n      delta.x += stroker->center.x;\r\n      delta.y += stroker->center.y;\r\n\r\n      error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      FT_Vector_From_Polar( &delta, radius, angle - rotate );\r\n\r\n      delta.x += stroker->center.x;\r\n      delta.y += stroker->center.y;\r\n\r\n      error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* process an inside corner, i.e. compute intersection */\r\n  static FT_Error\r\n  ft_stroker_inside( FT_Stroker  stroker,\r\n                     FT_Int      side,\r\n                     FT_Fixed    line_length )\r\n  {\r\n    FT_StrokeBorder  border = stroker->borders + side;\r\n    FT_Angle         phi, theta, rotate;\r\n    FT_Fixed         length, thcos;\r\n    FT_Vector        delta;\r\n    FT_Error         error = FT_Err_Ok;\r\n    FT_Bool          intersect;          /* use intersection of lines? */\r\n\r\n\r\n    rotate = FT_SIDE_TO_ROTATE( side );\r\n\r\n    theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;\r\n\r\n    /* Only intersect borders if between two lineto's and both */\r\n    /* lines are long enough (line_length is zero for curves). */\r\n    if ( !border->movable || line_length == 0 )\r\n      intersect = FALSE;\r\n    else\r\n    {\r\n      /* compute minimum required length of lines */\r\n      FT_Fixed  min_length = ft_pos_abs( FT_MulFix( stroker->radius,\r\n                                                    FT_Tan( theta ) ) );\r\n\r\n\r\n      intersect = FT_BOOL( stroker->line_length >= min_length &&\r\n                           line_length          >= min_length );\r\n    }\r\n\r\n    if ( !intersect )\r\n    {\r\n      FT_Vector_From_Polar( &delta, stroker->radius,\r\n                            stroker->angle_out + rotate );\r\n      delta.x += stroker->center.x;\r\n      delta.y += stroker->center.y;\r\n\r\n      border->movable = FALSE;\r\n    }\r\n    else\r\n    {\r\n      /* compute median angle */\r\n      phi = stroker->angle_in + theta;\r\n\r\n      thcos = FT_Cos( theta );\r\n\r\n      length = FT_DivFix( stroker->radius, thcos );\r\n\r\n      FT_Vector_From_Polar( &delta, length, phi + rotate );\r\n      delta.x += stroker->center.x;\r\n      delta.y += stroker->center.y;\r\n    }\r\n\r\n    error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* process an outside corner, i.e. compute bevel/miter/round */\r\n  static FT_Error\r\n  ft_stroker_outside( FT_Stroker  stroker,\r\n                      FT_Int      side,\r\n                      FT_Fixed    line_length )\r\n  {\r\n    FT_StrokeBorder  border = stroker->borders + side;\r\n    FT_Error         error;\r\n    FT_Angle         rotate;\r\n\r\n\r\n    if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND )\r\n      error = ft_stroker_arcto( stroker, side );\r\n    else\r\n    {\r\n      /* this is a mitered (pointed) or beveled (truncated) corner */\r\n      FT_Fixed  sigma = 0, radius = stroker->radius;\r\n      FT_Angle  theta = 0, phi = 0;\r\n      FT_Fixed  thcos = 0;\r\n      FT_Bool   bevel, fixed_bevel;\r\n\r\n\r\n      rotate = FT_SIDE_TO_ROTATE( side );\r\n\r\n      bevel =\r\n        FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_BEVEL );\r\n\r\n      fixed_bevel =\r\n        FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_MITER_VARIABLE );\r\n\r\n      if ( !bevel )\r\n      {\r\n        theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );\r\n\r\n        if ( theta == FT_ANGLE_PI )\r\n        {\r\n          theta = rotate;\r\n          phi   = stroker->angle_in;\r\n        }\r\n        else\r\n        {\r\n          theta /= 2;\r\n          phi    = stroker->angle_in + theta + rotate;\r\n        }\r\n\r\n        thcos = FT_Cos( theta );\r\n        sigma = FT_MulFix( stroker->miter_limit, thcos );\r\n\r\n        /* is miter limit exceeded? */\r\n        if ( sigma < 0x10000L )\r\n        {\r\n          /* don't create variable bevels for very small deviations; */\r\n          /* FT_Sin(x) = 0 for x <= 57                               */\r\n          if ( fixed_bevel || ft_pos_abs( theta ) > 57 )\r\n            bevel = TRUE;\r\n        }\r\n      }\r\n\r\n      if ( bevel )  /* this is a bevel (broken angle) */\r\n      {\r\n        if ( fixed_bevel )\r\n        {\r\n          /* the outer corners are simply joined together */\r\n          FT_Vector  delta;\r\n\r\n\r\n          /* add bevel */\r\n          FT_Vector_From_Polar( &delta,\r\n                                radius,\r\n                                stroker->angle_out + rotate );\r\n          delta.x += stroker->center.x;\r\n          delta.y += stroker->center.y;\r\n\r\n          border->movable = FALSE;\r\n          error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n        }\r\n        else /* variable bevel */\r\n        {\r\n          /* the miter is truncated */\r\n          FT_Vector  middle, delta;\r\n          FT_Fixed   length;\r\n\r\n\r\n          /* compute middle point */\r\n          FT_Vector_From_Polar( &middle,\r\n                                FT_MulFix( radius, stroker->miter_limit ),\r\n                                phi );\r\n          middle.x += stroker->center.x;\r\n          middle.y += stroker->center.y;\r\n\r\n          /* compute first angle point */\r\n          length = FT_MulDiv( radius, 0x10000L - sigma,\r\n                              ft_pos_abs( FT_Sin( theta ) ) );\r\n\r\n          FT_Vector_From_Polar( &delta, length, phi + rotate );\r\n          delta.x += middle.x;\r\n          delta.y += middle.y;\r\n\r\n          error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          /* compute second angle point */\r\n          FT_Vector_From_Polar( &delta, length, phi - rotate );\r\n          delta.x += middle.x;\r\n          delta.y += middle.y;\r\n\r\n          error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          /* finally, add an end point; only needed if not lineto */\r\n          /* (line_length is zero for curves)                     */\r\n          if ( line_length == 0 )\r\n          {\r\n            FT_Vector_From_Polar( &delta,\r\n                                  radius,\r\n                                  stroker->angle_out + rotate );\r\n\r\n            delta.x += stroker->center.x;\r\n            delta.y += stroker->center.y;\r\n\r\n            error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n          }\r\n        }\r\n      }\r\n      else /* this is a miter (intersection) */\r\n      {\r\n        FT_Fixed   length;\r\n        FT_Vector  delta;\r\n\r\n\r\n        length = FT_DivFix( stroker->radius, thcos );\r\n\r\n        FT_Vector_From_Polar( &delta, length, phi );\r\n        delta.x += stroker->center.x;\r\n        delta.y += stroker->center.y;\r\n\r\n        error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        /* now add an end point; only needed if not lineto */\r\n        /* (line_length is zero for curves)                */\r\n        if ( line_length == 0 )\r\n        {\r\n          FT_Vector_From_Polar( &delta,\r\n                                stroker->radius,\r\n                                stroker->angle_out + rotate );\r\n          delta.x += stroker->center.x;\r\n          delta.y += stroker->center.y;\r\n\r\n          error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroker_process_corner( FT_Stroker  stroker,\r\n                             FT_Fixed    line_length )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n    FT_Angle  turn;\r\n    FT_Int    inside_side;\r\n\r\n\r\n    turn = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );\r\n\r\n    /* no specific corner processing is required if the turn is 0 */\r\n    if ( turn == 0 )\r\n      goto Exit;\r\n\r\n    /* when we turn to the right, the inside side is 0 */\r\n    inside_side = 0;\r\n\r\n    /* otherwise, the inside side is 1 */\r\n    if ( turn < 0 )\r\n      inside_side = 1;\r\n\r\n    /* process the inside side */\r\n    error = ft_stroker_inside( stroker, inside_side, line_length );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* process the outside side */\r\n    error = ft_stroker_outside( stroker, 1 - inside_side, line_length );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* add two points to the left and right borders corresponding to the */\r\n  /* start of the subpath                                              */\r\n  static FT_Error\r\n  ft_stroker_subpath_start( FT_Stroker  stroker,\r\n                            FT_Angle    start_angle,\r\n                            FT_Fixed    line_length )\r\n  {\r\n    FT_Vector        delta;\r\n    FT_Vector        point;\r\n    FT_Error         error;\r\n    FT_StrokeBorder  border;\r\n\r\n\r\n    FT_Vector_From_Polar( &delta, stroker->radius,\r\n                          start_angle + FT_ANGLE_PI2 );\r\n\r\n    point.x = stroker->center.x + delta.x;\r\n    point.y = stroker->center.y + delta.y;\r\n\r\n    border = stroker->borders;\r\n    error = ft_stroke_border_moveto( border, &point );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    point.x = stroker->center.x - delta.x;\r\n    point.y = stroker->center.y - delta.y;\r\n\r\n    border++;\r\n    error = ft_stroke_border_moveto( border, &point );\r\n\r\n    /* save angle, position, and line length for last join */\r\n    /* (line_length is zero for curves)                    */\r\n    stroker->subpath_angle       = start_angle;\r\n    stroker->first_point         = FALSE;\r\n    stroker->subpath_line_length = line_length;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_LineTo( FT_Stroker  stroker,\r\n                     FT_Vector*  to )\r\n  {\r\n    FT_Error         error = FT_Err_Ok;\r\n    FT_StrokeBorder  border;\r\n    FT_Vector        delta;\r\n    FT_Angle         angle;\r\n    FT_Int           side;\r\n    FT_Fixed         line_length;\r\n\r\n\r\n    delta.x = to->x - stroker->center.x;\r\n    delta.y = to->y - stroker->center.y;\r\n\r\n    /* a zero-length lineto is a no-op; avoid creating a spurious corner */\r\n    if ( delta.x == 0 && delta.y == 0 )\r\n       goto Exit;\r\n\r\n    /* compute length of line */\r\n    line_length = FT_Vector_Length( &delta );\r\n\r\n    angle = FT_Atan2( delta.x, delta.y );\r\n    FT_Vector_From_Polar( &delta, stroker->radius, angle + FT_ANGLE_PI2 );\r\n\r\n    /* process corner if necessary */\r\n    if ( stroker->first_point )\r\n    {\r\n      /* This is the first segment of a subpath.  We need to     */\r\n      /* add a point to each border at their respective starting */\r\n      /* point locations.                                        */\r\n      error = ft_stroker_subpath_start( stroker, angle, line_length );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n    else\r\n    {\r\n      /* process the current corner */\r\n      stroker->angle_out = angle;\r\n      error = ft_stroker_process_corner( stroker, line_length );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* now add a line segment to both the `inside' and `outside' paths */\r\n    for ( border = stroker->borders, side = 1; side >= 0; side--, border++ )\r\n    {\r\n      FT_Vector  point;\r\n\r\n\r\n      point.x = to->x + delta.x;\r\n      point.y = to->y + delta.y;\r\n\r\n      /* the ends of lineto borders are movable */\r\n      error = ft_stroke_border_lineto( border, &point, TRUE );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      delta.x = -delta.x;\r\n      delta.y = -delta.y;\r\n    }\r\n\r\n    stroker->angle_in    = angle;\r\n    stroker->center      = *to;\r\n    stroker->line_length = line_length;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_ConicTo( FT_Stroker  stroker,\r\n                      FT_Vector*  control,\r\n                      FT_Vector*  to )\r\n  {\r\n    FT_Error    error = FT_Err_Ok;\r\n    FT_Vector   bez_stack[34];\r\n    FT_Vector*  arc;\r\n    FT_Vector*  limit = bez_stack + 30;\r\n    FT_Bool     first_arc = TRUE;\r\n\r\n\r\n    /* if all control points are coincident, this is a no-op; */\r\n    /* avoid creating a spurious corner                       */\r\n    if ( FT_IS_SMALL( stroker->center.x - control->x ) &&\r\n         FT_IS_SMALL( stroker->center.y - control->y ) &&\r\n         FT_IS_SMALL( control->x        - to->x      ) &&\r\n         FT_IS_SMALL( control->y        - to->y      ) )\r\n    {\r\n       stroker->center = *to;\r\n       goto Exit;\r\n    }\r\n\r\n    arc    = bez_stack;\r\n    arc[0] = *to;\r\n    arc[1] = *control;\r\n    arc[2] = stroker->center;\r\n\r\n    while ( arc >= bez_stack )\r\n    {\r\n      FT_Angle  angle_in, angle_out;\r\n\r\n\r\n      /* initialize with current direction */\r\n      angle_in = angle_out = stroker->angle_in;\r\n\r\n      if ( arc < limit                                             &&\r\n           !ft_conic_is_small_enough( arc, &angle_in, &angle_out ) )\r\n      {\r\n        if ( stroker->first_point )\r\n          stroker->angle_in = angle_in;\r\n\r\n        ft_conic_split( arc );\r\n        arc += 2;\r\n        continue;\r\n      }\r\n\r\n      if ( first_arc )\r\n      {\r\n        first_arc = FALSE;\r\n\r\n        /* process corner if necessary */\r\n        if ( stroker->first_point )\r\n          error = ft_stroker_subpath_start( stroker, angle_in, 0 );\r\n        else\r\n        {\r\n          stroker->angle_out = angle_in;\r\n          error = ft_stroker_process_corner( stroker, 0 );\r\n        }\r\n      }\r\n      else if ( ft_pos_abs( FT_Angle_Diff( stroker->angle_in, angle_in ) ) >\r\n                  FT_SMALL_CONIC_THRESHOLD / 4                             )\r\n      {\r\n        /* if the deviation from one arc to the next is too great, */\r\n        /* add a round corner                                      */\r\n        stroker->center    = arc[2];\r\n        stroker->angle_out = angle_in;\r\n        stroker->line_join = FT_STROKER_LINEJOIN_ROUND;\r\n\r\n        error = ft_stroker_process_corner( stroker, 0 );\r\n\r\n        /* reinstate line join style */\r\n        stroker->line_join = stroker->line_join_saved;\r\n      }\r\n\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* the arc's angle is small enough; we can add it directly to each */\r\n      /* border                                                          */\r\n      {\r\n        FT_Vector        ctrl, end;\r\n        FT_Angle         theta, phi, rotate, alpha0 = 0;\r\n        FT_Fixed         length;\r\n        FT_StrokeBorder  border;\r\n        FT_Int           side;\r\n\r\n\r\n        theta  = FT_Angle_Diff( angle_in, angle_out ) / 2;\r\n        phi    = angle_in + theta;\r\n        length = FT_DivFix( stroker->radius, FT_Cos( theta ) );\r\n\r\n        /* compute direction of original arc */\r\n        if ( stroker->handle_wide_strokes )\r\n          alpha0 = FT_Atan2( arc[0].x - arc[2].x, arc[0].y - arc[2].y );\r\n\r\n        for ( border = stroker->borders, side = 0;\r\n              side <= 1;\r\n              side++, border++ )\r\n        {\r\n          rotate = FT_SIDE_TO_ROTATE( side );\r\n\r\n          /* compute control point */\r\n          FT_Vector_From_Polar( &ctrl, length, phi + rotate );\r\n          ctrl.x += arc[1].x;\r\n          ctrl.y += arc[1].y;\r\n\r\n          /* compute end point */\r\n          FT_Vector_From_Polar( &end, stroker->radius, angle_out + rotate );\r\n          end.x += arc[0].x;\r\n          end.y += arc[0].y;\r\n\r\n          if ( stroker->handle_wide_strokes )\r\n          {\r\n            FT_Vector  start;\r\n            FT_Angle   alpha1;\r\n\r\n\r\n            /* determine whether the border radius is greater than the */\r\n            /* radius of curvature of the original arc                 */\r\n            start = border->points[border->num_points - 1];\r\n\r\n            alpha1 = FT_Atan2( end.x - start.x, end.y - start.y );\r\n\r\n            /* is the direction of the border arc opposite to */\r\n            /* that of the original arc? */\r\n            if ( ft_pos_abs( FT_Angle_Diff( alpha0, alpha1 ) ) >\r\n                   FT_ANGLE_PI / 2                             )\r\n            {\r\n              FT_Angle   beta, gamma;\r\n              FT_Vector  bvec, delta;\r\n              FT_Fixed   blen, sinA, sinB, alen;\r\n\r\n\r\n              /* use the sine rule to find the intersection point */\r\n              beta  = FT_Atan2( arc[2].x - start.x, arc[2].y - start.y );\r\n              gamma = FT_Atan2( arc[0].x - end.x,   arc[0].y - end.y );\r\n\r\n              bvec.x = end.x - start.x;\r\n              bvec.y = end.y - start.y;\r\n\r\n              blen = FT_Vector_Length( &bvec );\r\n\r\n              sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) );\r\n              sinB = ft_pos_abs( FT_Sin( beta - gamma ) );\r\n\r\n              alen = FT_MulDiv( blen, sinA, sinB );\r\n\r\n              FT_Vector_From_Polar( &delta, alen, beta );\r\n              delta.x += start.x;\r\n              delta.y += start.y;\r\n\r\n              /* circumnavigate the negative sector backwards */\r\n              border->movable = FALSE;\r\n              error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n              if ( error )\r\n                goto Exit;\r\n              error = ft_stroke_border_lineto( border, &end, FALSE );\r\n              if ( error )\r\n                goto Exit;\r\n              error = ft_stroke_border_conicto( border, &ctrl, &start );\r\n              if ( error )\r\n                goto Exit;\r\n              /* and then move to the endpoint */\r\n              error = ft_stroke_border_lineto( border, &end, FALSE );\r\n              if ( error )\r\n                goto Exit;\r\n\r\n              continue;\r\n            }\r\n\r\n            /* else fall through */\r\n          }\r\n\r\n          /* simply add an arc */\r\n          error = ft_stroke_border_conicto( border, &ctrl, &end );\r\n          if ( error )\r\n            goto Exit;\r\n        }\r\n      }\r\n\r\n      arc -= 2;\r\n\r\n      stroker->angle_in = angle_out;\r\n    }\r\n\r\n    stroker->center = *to;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_CubicTo( FT_Stroker  stroker,\r\n                      FT_Vector*  control1,\r\n                      FT_Vector*  control2,\r\n                      FT_Vector*  to )\r\n  {\r\n    FT_Error    error = FT_Err_Ok;\r\n    FT_Vector   bez_stack[37];\r\n    FT_Vector*  arc;\r\n    FT_Vector*  limit = bez_stack + 32;\r\n    FT_Bool     first_arc = TRUE;\r\n\r\n\r\n    /* if all control points are coincident, this is a no-op; */\r\n    /* avoid creating a spurious corner */\r\n    if ( FT_IS_SMALL( stroker->center.x - control1->x ) &&\r\n         FT_IS_SMALL( stroker->center.y - control1->y ) &&\r\n         FT_IS_SMALL( control1->x       - control2->x ) &&\r\n         FT_IS_SMALL( control1->y       - control2->y ) &&\r\n         FT_IS_SMALL( control2->x       - to->x       ) &&\r\n         FT_IS_SMALL( control2->y       - to->y       ) )\r\n    {\r\n       stroker->center = *to;\r\n       goto Exit;\r\n    }\r\n\r\n    arc    = bez_stack;\r\n    arc[0] = *to;\r\n    arc[1] = *control2;\r\n    arc[2] = *control1;\r\n    arc[3] = stroker->center;\r\n\r\n    while ( arc >= bez_stack )\r\n    {\r\n      FT_Angle  angle_in, angle_mid, angle_out;\r\n\r\n\r\n      /* initialize with current direction */\r\n      angle_in = angle_out = angle_mid = stroker->angle_in;\r\n\r\n      if ( arc < limit                                         &&\r\n           !ft_cubic_is_small_enough( arc, &angle_in,\r\n                                      &angle_mid, &angle_out ) )\r\n      {\r\n        if ( stroker->first_point )\r\n          stroker->angle_in = angle_in;\r\n\r\n        ft_cubic_split( arc );\r\n        arc += 3;\r\n        continue;\r\n      }\r\n\r\n      if ( first_arc )\r\n      {\r\n        first_arc = FALSE;\r\n\r\n        /* process corner if necessary */\r\n        if ( stroker->first_point )\r\n          error = ft_stroker_subpath_start( stroker, angle_in, 0 );\r\n        else\r\n        {\r\n          stroker->angle_out = angle_in;\r\n          error = ft_stroker_process_corner( stroker, 0 );\r\n        }\r\n      }\r\n      else if ( ft_pos_abs( FT_Angle_Diff( stroker->angle_in, angle_in ) ) >\r\n                  FT_SMALL_CUBIC_THRESHOLD / 4                             )\r\n      {\r\n        /* if the deviation from one arc to the next is too great, */\r\n        /* add a round corner                                      */\r\n        stroker->center    = arc[3];\r\n        stroker->angle_out = angle_in;\r\n        stroker->line_join = FT_STROKER_LINEJOIN_ROUND;\r\n\r\n        error = ft_stroker_process_corner( stroker, 0 );\r\n\r\n        /* reinstate line join style */\r\n        stroker->line_join = stroker->line_join_saved;\r\n      }\r\n\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* the arc's angle is small enough; we can add it directly to each */\r\n      /* border                                                          */\r\n      {\r\n        FT_Vector        ctrl1, ctrl2, end;\r\n        FT_Angle         theta1, phi1, theta2, phi2, rotate, alpha0 = 0;\r\n        FT_Fixed         length1, length2;\r\n        FT_StrokeBorder  border;\r\n        FT_Int           side;\r\n\r\n\r\n        theta1  = FT_Angle_Diff( angle_in,  angle_mid ) / 2;\r\n        theta2  = FT_Angle_Diff( angle_mid, angle_out ) / 2;\r\n        phi1    = ft_angle_mean( angle_in,  angle_mid );\r\n        phi2    = ft_angle_mean( angle_mid, angle_out );\r\n        length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) );\r\n        length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) );\r\n\r\n        /* compute direction of original arc */\r\n        if ( stroker->handle_wide_strokes )\r\n          alpha0 = FT_Atan2( arc[0].x - arc[3].x, arc[0].y - arc[3].y );\r\n\r\n        for ( border = stroker->borders, side = 0;\r\n              side <= 1;\r\n              side++, border++ )\r\n        {\r\n          rotate = FT_SIDE_TO_ROTATE( side );\r\n\r\n          /* compute control points */\r\n          FT_Vector_From_Polar( &ctrl1, length1, phi1 + rotate );\r\n          ctrl1.x += arc[2].x;\r\n          ctrl1.y += arc[2].y;\r\n\r\n          FT_Vector_From_Polar( &ctrl2, length2, phi2 + rotate );\r\n          ctrl2.x += arc[1].x;\r\n          ctrl2.y += arc[1].y;\r\n\r\n          /* compute end point */\r\n          FT_Vector_From_Polar( &end, stroker->radius, angle_out + rotate );\r\n          end.x += arc[0].x;\r\n          end.y += arc[0].y;\r\n\r\n          if ( stroker->handle_wide_strokes )\r\n          {\r\n            FT_Vector  start;\r\n            FT_Angle   alpha1;\r\n\r\n\r\n            /* determine whether the border radius is greater than the */\r\n            /* radius of curvature of the original arc                 */\r\n            start = border->points[border->num_points - 1];\r\n\r\n            alpha1 = FT_Atan2( end.x - start.x, end.y - start.y );\r\n\r\n            /* is the direction of the border arc opposite to */\r\n            /* that of the original arc? */\r\n            if ( ft_pos_abs( FT_Angle_Diff( alpha0, alpha1 ) ) >\r\n                   FT_ANGLE_PI / 2                             )\r\n            {\r\n              FT_Angle   beta, gamma;\r\n              FT_Vector  bvec, delta;\r\n              FT_Fixed   blen, sinA, sinB, alen;\r\n\r\n\r\n              /* use the sine rule to find the intersection point */\r\n              beta  = FT_Atan2( arc[3].x - start.x, arc[3].y - start.y );\r\n              gamma = FT_Atan2( arc[0].x - end.x,   arc[0].y - end.y );\r\n\r\n              bvec.x = end.x - start.x;\r\n              bvec.y = end.y - start.y;\r\n\r\n              blen = FT_Vector_Length( &bvec );\r\n\r\n              sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) );\r\n              sinB = ft_pos_abs( FT_Sin( beta - gamma ) );\r\n\r\n              alen = FT_MulDiv( blen, sinA, sinB );\r\n\r\n              FT_Vector_From_Polar( &delta, alen, beta );\r\n              delta.x += start.x;\r\n              delta.y += start.y;\r\n\r\n              /* circumnavigate the negative sector backwards */\r\n              border->movable = FALSE;\r\n              error = ft_stroke_border_lineto( border, &delta, FALSE );\r\n              if ( error )\r\n                goto Exit;\r\n              error = ft_stroke_border_lineto( border, &end, FALSE );\r\n              if ( error )\r\n                goto Exit;\r\n              error = ft_stroke_border_cubicto( border,\r\n                                                &ctrl2,\r\n                                                &ctrl1,\r\n                                                &start );\r\n              if ( error )\r\n                goto Exit;\r\n              /* and then move to the endpoint */\r\n              error = ft_stroke_border_lineto( border, &end, FALSE );\r\n              if ( error )\r\n                goto Exit;\r\n\r\n              continue;\r\n            }\r\n\r\n            /* else fall through */\r\n          }\r\n\r\n          /* simply add an arc */\r\n          error = ft_stroke_border_cubicto( border, &ctrl1, &ctrl2, &end );\r\n          if ( error )\r\n            goto Exit;\r\n        }\r\n      }\r\n\r\n      arc -= 3;\r\n\r\n      stroker->angle_in = angle_out;\r\n    }\r\n\r\n    stroker->center = *to;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_BeginSubPath( FT_Stroker  stroker,\r\n                           FT_Vector*  to,\r\n                           FT_Bool     open )\r\n  {\r\n    /* We cannot process the first point, because there is not enough      */\r\n    /* information regarding its corner/cap.  The latter will be processed */\r\n    /* in the `FT_Stroker_EndSubPath' routine.                             */\r\n    /*                                                                     */\r\n    stroker->first_point  = TRUE;\r\n    stroker->center       = *to;\r\n    stroker->subpath_open = open;\r\n\r\n    /* Determine if we need to check whether the border radius is greater */\r\n    /* than the radius of curvature of a curve, to handle this case       */\r\n    /* specially.  This is only required if bevel joins or butt caps may  */\r\n    /* be created, because round & miter joins and round & square caps    */\r\n    /* cover the negative sector created with wide strokes.               */\r\n    stroker->handle_wide_strokes =\r\n      FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_ROUND  ||\r\n               ( stroker->subpath_open                        &&\r\n                 stroker->line_cap == FT_STROKER_LINECAP_BUTT ) );\r\n\r\n    /* record the subpath start point for each border */\r\n    stroker->subpath_start = *to;\r\n\r\n    stroker->angle_in = 0;\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_stroker_add_reverse_left( FT_Stroker  stroker,\r\n                               FT_Bool     open )\r\n  {\r\n    FT_StrokeBorder  right = stroker->borders + 0;\r\n    FT_StrokeBorder  left  = stroker->borders + 1;\r\n    FT_Int           new_points;\r\n    FT_Error         error = FT_Err_Ok;\r\n\r\n\r\n    FT_ASSERT( left->start >= 0 );\r\n\r\n    new_points = left->num_points - left->start;\r\n    if ( new_points > 0 )\r\n    {\r\n      error = ft_stroke_border_grow( right, (FT_UInt)new_points );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      {\r\n        FT_Vector*  dst_point = right->points + right->num_points;\r\n        FT_Byte*    dst_tag   = right->tags   + right->num_points;\r\n        FT_Vector*  src_point = left->points  + left->num_points - 1;\r\n        FT_Byte*    src_tag   = left->tags    + left->num_points - 1;\r\n\r\n\r\n        while ( src_point >= left->points + left->start )\r\n        {\r\n          *dst_point = *src_point;\r\n          *dst_tag   = *src_tag;\r\n\r\n          if ( open )\r\n            dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END;\r\n          else\r\n          {\r\n            FT_Byte  ttag =\r\n                       (FT_Byte)( dst_tag[0] & FT_STROKE_TAG_BEGIN_END );\r\n\r\n\r\n            /* switch begin/end tags if necessary */\r\n            if ( ttag == FT_STROKE_TAG_BEGIN ||\r\n                 ttag == FT_STROKE_TAG_END   )\r\n              dst_tag[0] ^= FT_STROKE_TAG_BEGIN_END;\r\n          }\r\n\r\n          src_point--;\r\n          src_tag--;\r\n          dst_point++;\r\n          dst_tag++;\r\n        }\r\n      }\r\n\r\n      left->num_points   = left->start;\r\n      right->num_points += new_points;\r\n\r\n      right->movable = FALSE;\r\n      left->movable  = FALSE;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  /* there's a lot of magic in this function! */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_EndSubPath( FT_Stroker  stroker )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n\r\n    if ( stroker->subpath_open )\r\n    {\r\n      FT_StrokeBorder  right = stroker->borders;\r\n\r\n\r\n      /* All right, this is an opened path, we need to add a cap between */\r\n      /* right & left, add the reverse of left, then add a final cap     */\r\n      /* between left & right.                                           */\r\n      error = ft_stroker_cap( stroker, stroker->angle_in, 0 );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* add reversed points from `left' to `right' */\r\n      error = ft_stroker_add_reverse_left( stroker, TRUE );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* now add the final cap */\r\n      stroker->center = stroker->subpath_start;\r\n      error = ft_stroker_cap( stroker,\r\n                              stroker->subpath_angle + FT_ANGLE_PI, 0 );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* Now end the right subpath accordingly.  The left one is */\r\n      /* rewind and doesn't need further processing.             */\r\n      ft_stroke_border_close( right, FALSE );\r\n    }\r\n    else\r\n    {\r\n      FT_Angle  turn;\r\n      FT_Int    inside_side;\r\n\r\n\r\n      /* close the path if needed */\r\n      if ( stroker->center.x != stroker->subpath_start.x ||\r\n           stroker->center.y != stroker->subpath_start.y )\r\n      {\r\n         error = FT_Stroker_LineTo( stroker, &stroker->subpath_start );\r\n         if ( error )\r\n           goto Exit;\r\n      }\r\n\r\n      /* process the corner */\r\n      stroker->angle_out = stroker->subpath_angle;\r\n      turn               = FT_Angle_Diff( stroker->angle_in,\r\n                                          stroker->angle_out );\r\n\r\n      /* no specific corner processing is required if the turn is 0 */\r\n      if ( turn != 0 )\r\n      {\r\n        /* when we turn to the right, the inside side is 0 */\r\n        inside_side = 0;\r\n\r\n        /* otherwise, the inside side is 1 */\r\n        if ( turn < 0 )\r\n          inside_side = 1;\r\n\r\n        error = ft_stroker_inside( stroker,\r\n                                   inside_side,\r\n                                   stroker->subpath_line_length );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        /* process the outside side */\r\n        error = ft_stroker_outside( stroker,\r\n                                    1 - inside_side,\r\n                                    stroker->subpath_line_length );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n\r\n      /* then end our two subpaths */\r\n      ft_stroke_border_close( stroker->borders + 0, FALSE );\r\n      ft_stroke_border_close( stroker->borders + 1, TRUE );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_GetBorderCounts( FT_Stroker        stroker,\r\n                              FT_StrokerBorder  border,\r\n                              FT_UInt          *anum_points,\r\n                              FT_UInt          *anum_contours )\r\n  {\r\n    FT_UInt   num_points = 0, num_contours = 0;\r\n    FT_Error  error;\r\n\r\n\r\n    if ( !stroker || border > 1 )\r\n    {\r\n      error = FT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    error = ft_stroke_border_get_counts( stroker->borders + border,\r\n                                         &num_points, &num_contours );\r\n  Exit:\r\n    if ( anum_points )\r\n      *anum_points = num_points;\r\n\r\n    if ( anum_contours )\r\n      *anum_contours = num_contours;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_GetCounts( FT_Stroker  stroker,\r\n                        FT_UInt    *anum_points,\r\n                        FT_UInt    *anum_contours )\r\n  {\r\n    FT_UInt   count1, count2, num_points   = 0;\r\n    FT_UInt   count3, count4, num_contours = 0;\r\n    FT_Error  error;\r\n\r\n\r\n    error = ft_stroke_border_get_counts( stroker->borders + 0,\r\n                                         &count1, &count2 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = ft_stroke_border_get_counts( stroker->borders + 1,\r\n                                         &count3, &count4 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    num_points   = count1 + count3;\r\n    num_contours = count2 + count4;\r\n\r\n  Exit:\r\n    *anum_points   = num_points;\r\n    *anum_contours = num_contours;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Stroker_ExportBorder( FT_Stroker        stroker,\r\n                           FT_StrokerBorder  border,\r\n                           FT_Outline*       outline )\r\n  {\r\n    if ( border == FT_STROKER_BORDER_LEFT  ||\r\n         border == FT_STROKER_BORDER_RIGHT )\r\n    {\r\n      FT_StrokeBorder  sborder = & stroker->borders[border];\r\n\r\n\r\n      if ( sborder->valid )\r\n        ft_stroke_border_export( sborder, outline );\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Stroker_Export( FT_Stroker   stroker,\r\n                     FT_Outline*  outline )\r\n  {\r\n    FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_LEFT, outline );\r\n    FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_RIGHT, outline );\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  /*\r\n   *  The following is very similar to FT_Outline_Decompose, except\r\n   *  that we do support opened paths, and do not scale the outline.\r\n   */\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stroker_ParseOutline( FT_Stroker   stroker,\r\n                           FT_Outline*  outline,\r\n                           FT_Bool      opened )\r\n  {\r\n    FT_Vector   v_last;\r\n    FT_Vector   v_control;\r\n    FT_Vector   v_start;\r\n\r\n    FT_Vector*  point;\r\n    FT_Vector*  limit;\r\n    char*       tags;\r\n\r\n    FT_Error    error;\r\n\r\n    FT_Int      n;         /* index of contour in outline     */\r\n    FT_UInt     first;     /* index of first point in contour */\r\n    FT_Int      tag;       /* current point's state           */\r\n\r\n\r\n    if ( !outline || !stroker )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    FT_Stroker_Rewind( stroker );\r\n\r\n    first = 0;\r\n\r\n    for ( n = 0; n < outline->n_contours; n++ )\r\n    {\r\n      FT_UInt  last;  /* index of last point in contour */\r\n\r\n\r\n      last  = outline->contours[n];\r\n      limit = outline->points + last;\r\n\r\n      /* skip empty points; we don't stroke these */\r\n      if ( last <= first )\r\n      {\r\n        first = last + 1;\r\n        continue;\r\n      }\r\n\r\n      v_start = outline->points[first];\r\n      v_last  = outline->points[last];\r\n\r\n      v_control = v_start;\r\n\r\n      point = outline->points + first;\r\n      tags  = outline->tags   + first;\r\n      tag   = FT_CURVE_TAG( tags[0] );\r\n\r\n      /* A contour cannot start with a cubic control point! */\r\n      if ( tag == FT_CURVE_TAG_CUBIC )\r\n        goto Invalid_Outline;\r\n\r\n      /* check first point to determine origin */\r\n      if ( tag == FT_CURVE_TAG_CONIC )\r\n      {\r\n        /* First point is conic control.  Yes, this happens. */\r\n        if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )\r\n        {\r\n          /* start at last point if it is on the curve */\r\n          v_start = v_last;\r\n          limit--;\r\n        }\r\n        else\r\n        {\r\n          /* if both first and last points are conic, */\r\n          /* start at their middle                    */\r\n          v_start.x = ( v_start.x + v_last.x ) / 2;\r\n          v_start.y = ( v_start.y + v_last.y ) / 2;\r\n        }\r\n        point--;\r\n        tags--;\r\n      }\r\n\r\n      error = FT_Stroker_BeginSubPath( stroker, &v_start, opened );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      while ( point < limit )\r\n      {\r\n        point++;\r\n        tags++;\r\n\r\n        tag = FT_CURVE_TAG( tags[0] );\r\n        switch ( tag )\r\n        {\r\n        case FT_CURVE_TAG_ON:  /* emit a single line_to */\r\n          {\r\n            FT_Vector  vec;\r\n\r\n\r\n            vec.x = point->x;\r\n            vec.y = point->y;\r\n\r\n            error = FT_Stroker_LineTo( stroker, &vec );\r\n            if ( error )\r\n              goto Exit;\r\n            continue;\r\n          }\r\n\r\n        case FT_CURVE_TAG_CONIC:  /* consume conic arcs */\r\n          v_control.x = point->x;\r\n          v_control.y = point->y;\r\n\r\n        Do_Conic:\r\n          if ( point < limit )\r\n          {\r\n            FT_Vector  vec;\r\n            FT_Vector  v_middle;\r\n\r\n\r\n            point++;\r\n            tags++;\r\n            tag = FT_CURVE_TAG( tags[0] );\r\n\r\n            vec = point[0];\r\n\r\n            if ( tag == FT_CURVE_TAG_ON )\r\n            {\r\n              error = FT_Stroker_ConicTo( stroker, &v_control, &vec );\r\n              if ( error )\r\n                goto Exit;\r\n              continue;\r\n            }\r\n\r\n            if ( tag != FT_CURVE_TAG_CONIC )\r\n              goto Invalid_Outline;\r\n\r\n            v_middle.x = ( v_control.x + vec.x ) / 2;\r\n            v_middle.y = ( v_control.y + vec.y ) / 2;\r\n\r\n            error = FT_Stroker_ConicTo( stroker, &v_control, &v_middle );\r\n            if ( error )\r\n              goto Exit;\r\n\r\n            v_control = vec;\r\n            goto Do_Conic;\r\n          }\r\n\r\n          error = FT_Stroker_ConicTo( stroker, &v_control, &v_start );\r\n          goto Close;\r\n\r\n        default:  /* FT_CURVE_TAG_CUBIC */\r\n          {\r\n            FT_Vector  vec1, vec2;\r\n\r\n\r\n            if ( point + 1 > limit                             ||\r\n                 FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )\r\n              goto Invalid_Outline;\r\n\r\n            point += 2;\r\n            tags  += 2;\r\n\r\n            vec1 = point[-2];\r\n            vec2 = point[-1];\r\n\r\n            if ( point <= limit )\r\n            {\r\n              FT_Vector  vec;\r\n\r\n\r\n              vec = point[0];\r\n\r\n              error = FT_Stroker_CubicTo( stroker, &vec1, &vec2, &vec );\r\n              if ( error )\r\n                goto Exit;\r\n              continue;\r\n            }\r\n\r\n            error = FT_Stroker_CubicTo( stroker, &vec1, &vec2, &v_start );\r\n            goto Close;\r\n          }\r\n        }\r\n      }\r\n\r\n    Close:\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* don't try to end the path if no segments have been generated */\r\n      if ( !stroker->first_point )\r\n      {\r\n        error = FT_Stroker_EndSubPath( stroker );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n\r\n      first = last + 1;\r\n    }\r\n\r\n    return FT_Err_Ok;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Invalid_Outline:\r\n    return FT_Err_Invalid_Outline;\r\n  }\r\n\r\n\r\n  /* declare an extern to access `ft_outline_glyph_class' globally     */\r\n  /* allocated  in `ftglyph.c', and use the FT_OUTLINE_GLYPH_CLASS_GET */\r\n  /* macro to access it when FT_CONFIG_OPTION_PIC is defined           */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n  extern const FT_Glyph_Class  ft_outline_glyph_class;\r\n#endif\r\n#include \"basepic.h\"\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Glyph_Stroke( FT_Glyph    *pglyph,\r\n                   FT_Stroker   stroker,\r\n                   FT_Bool      destroy )\r\n  {\r\n    FT_Error    error   = FT_Err_Invalid_Argument;\r\n    FT_Glyph    glyph   = NULL;\r\n    FT_Library  library = stroker->library;\r\n\r\n    FT_UNUSED( library );\r\n\r\n\r\n    if ( pglyph == NULL )\r\n      goto Exit;\r\n\r\n    glyph = *pglyph;\r\n    if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )\r\n      goto Exit;\r\n\r\n    {\r\n      FT_Glyph  copy;\r\n\r\n\r\n      error = FT_Glyph_Copy( glyph, &copy );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      glyph = copy;\r\n    }\r\n\r\n    {\r\n      FT_OutlineGlyph  oglyph  = (FT_OutlineGlyph)glyph;\r\n      FT_Outline*      outline = &oglyph->outline;\r\n      FT_UInt          num_points, num_contours;\r\n\r\n\r\n      error = FT_Stroker_ParseOutline( stroker, outline, FALSE );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      (void)FT_Stroker_GetCounts( stroker, &num_points, &num_contours );\r\n\r\n      FT_Outline_Done( glyph->library, outline );\r\n\r\n      error = FT_Outline_New( glyph->library,\r\n                              num_points, num_contours, outline );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      outline->n_points   = 0;\r\n      outline->n_contours = 0;\r\n\r\n      FT_Stroker_Export( stroker, outline );\r\n    }\r\n\r\n    if ( destroy )\r\n      FT_Done_Glyph( *pglyph );\r\n\r\n    *pglyph = glyph;\r\n    goto Exit;\r\n\r\n  Fail:\r\n    FT_Done_Glyph( glyph );\r\n    glyph = NULL;\r\n\r\n    if ( !destroy )\r\n      *pglyph = NULL;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftstroke.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Glyph_StrokeBorder( FT_Glyph    *pglyph,\r\n                         FT_Stroker   stroker,\r\n                         FT_Bool      inside,\r\n                         FT_Bool      destroy )\r\n  {\r\n    FT_Error    error   = FT_Err_Invalid_Argument;\r\n    FT_Glyph    glyph   = NULL;\r\n    FT_Library  library = stroker->library;\r\n\r\n    FT_UNUSED( library );\r\n\r\n\r\n    if ( pglyph == NULL )\r\n      goto Exit;\r\n\r\n    glyph = *pglyph;\r\n    if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )\r\n      goto Exit;\r\n\r\n    {\r\n      FT_Glyph  copy;\r\n\r\n\r\n      error = FT_Glyph_Copy( glyph, &copy );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      glyph = copy;\r\n    }\r\n\r\n    {\r\n      FT_OutlineGlyph   oglyph  = (FT_OutlineGlyph)glyph;\r\n      FT_StrokerBorder  border;\r\n      FT_Outline*       outline = &oglyph->outline;\r\n      FT_UInt           num_points, num_contours;\r\n\r\n\r\n      border = FT_Outline_GetOutsideBorder( outline );\r\n      if ( inside )\r\n      {\r\n        if ( border == FT_STROKER_BORDER_LEFT )\r\n          border = FT_STROKER_BORDER_RIGHT;\r\n        else\r\n          border = FT_STROKER_BORDER_LEFT;\r\n      }\r\n\r\n      error = FT_Stroker_ParseOutline( stroker, outline, FALSE );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      (void)FT_Stroker_GetBorderCounts( stroker, border,\r\n                                        &num_points, &num_contours );\r\n\r\n      FT_Outline_Done( glyph->library, outline );\r\n\r\n      error = FT_Outline_New( glyph->library,\r\n                              num_points,\r\n                              num_contours,\r\n                              outline );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      outline->n_points   = 0;\r\n      outline->n_contours = 0;\r\n\r\n      FT_Stroker_ExportBorder( stroker, border, outline );\r\n    }\r\n\r\n    if ( destroy )\r\n      FT_Done_Glyph( *pglyph );\r\n\r\n    *pglyph = glyph;\r\n    goto Exit;\r\n\r\n  Fail:\r\n    FT_Done_Glyph( glyph );\r\n    glyph = NULL;\r\n\r\n    if ( !destroy )\r\n      *pglyph = NULL;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftsynth.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsynth.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType synthesizing code for emboldening and slanting (body).      */\r\n/*                                                                         */\r\n/*  Copyright 2000-2006, 2010, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_SYNTHESIS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_OUTLINE_H\r\n#include FT_BITMAP_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_synth\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****   EXPERIMENTAL OBLIQUING SUPPORT                                ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* documentation is in ftsynth.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_GlyphSlot_Oblique( FT_GlyphSlot  slot )\r\n  {\r\n    FT_Matrix    transform;\r\n    FT_Outline*  outline = &slot->outline;\r\n\r\n\r\n    /* only oblique outline glyphs */\r\n    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )\r\n      return;\r\n\r\n    /* we don't touch the advance width */\r\n\r\n    /* For italic, simply apply a shear transform, with an angle */\r\n    /* of about 12 degrees.                                      */\r\n\r\n    transform.xx = 0x10000L;\r\n    transform.yx = 0x00000L;\r\n\r\n    transform.xy = 0x0366AL;\r\n    transform.yy = 0x10000L;\r\n\r\n    FT_Outline_Transform( outline, &transform );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****   EXPERIMENTAL EMBOLDENING SUPPORT                              ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* documentation is in ftsynth.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )\r\n  {\r\n    FT_Library  library = slot->library;\r\n    FT_Face     face    = slot->face;\r\n    FT_Error    error;\r\n    FT_Pos      xstr, ystr;\r\n\r\n\r\n    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&\r\n         slot->format != FT_GLYPH_FORMAT_BITMAP  )\r\n      return;\r\n\r\n    /* some reasonable strength */\r\n    xstr = FT_MulFix( face->units_per_EM,\r\n                      face->size->metrics.y_scale ) / 24;\r\n    ystr = xstr;\r\n\r\n    if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )\r\n    {\r\n      /* ignore error */\r\n      (void)FT_Outline_EmboldenXY( &slot->outline, xstr, ystr );\r\n    }\r\n    else /* slot->format == FT_GLYPH_FORMAT_BITMAP */\r\n    {\r\n      /* round to full pixels */\r\n      xstr &= ~63;\r\n      if ( xstr == 0 )\r\n        xstr = 1 << 6;\r\n      ystr &= ~63;\r\n\r\n      /*\r\n       * XXX: overflow check for 16-bit system, for compatibility\r\n       *      with FT_GlyphSlot_Embolden() since freetype-2.1.10.\r\n       *      unfortunately, this function return no informations\r\n       *      about the cause of error.\r\n       */\r\n      if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )\r\n      {\r\n        FT_TRACE1(( \"FT_GlyphSlot_Embolden:\" ));\r\n        FT_TRACE1(( \"too strong embolding parameter ystr=%d\\n\", ystr ));\r\n        return;\r\n      }\r\n      error = FT_GlyphSlot_Own_Bitmap( slot );\r\n      if ( error )\r\n        return;\r\n\r\n      error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );\r\n      if ( error )\r\n        return;\r\n    }\r\n\r\n    if ( slot->advance.x )\r\n      slot->advance.x += xstr;\r\n\r\n    if ( slot->advance.y )\r\n      slot->advance.y += ystr;\r\n\r\n    slot->metrics.width       += xstr;\r\n    slot->metrics.height      += ystr;\r\n    slot->metrics.horiAdvance += xstr;\r\n    slot->metrics.vertAdvance += ystr;\r\n\r\n    /* XXX: 16-bit overflow case must be excluded before here */\r\n    if ( slot->format == FT_GLYPH_FORMAT_BITMAP )\r\n      slot->bitmap_top += (FT_Int)( ystr >> 6 );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftsystem.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsystem.c                                                             */\r\n/*                                                                         */\r\n/*    ANSI-specific FreeType low-level system interface (body).            */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2006, 2008-2011 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file contains the default interface used by FreeType to access   */\r\n  /* low-level, i.e. memory management, i/o access as well as thread       */\r\n  /* synchronisation.  It can be replaced by user-specific routines if     */\r\n  /* necessary.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_SYSTEM_H\r\n#include FT_ERRORS_H\r\n#include FT_TYPES_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                       MEMORY MANAGEMENT INTERFACE                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* It is not necessary to do any error checking for the                  */\r\n  /* allocation-related functions.  This will be done by the higher level  */\r\n  /* routines like ft_mem_alloc() or ft_mem_realloc().                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_alloc                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The memory allocation function.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A pointer to the memory object.                          */\r\n  /*                                                                       */\r\n  /*    size   :: The requested size in bytes.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The address of newly allocated block.                              */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( void* )\r\n  ft_alloc( FT_Memory  memory,\r\n            long       size )\r\n  {\r\n    FT_UNUSED( memory );\r\n\r\n    return ft_smalloc( size );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_realloc                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The memory reallocation function.                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory   :: A pointer to the memory object.                        */\r\n  /*                                                                       */\r\n  /*    cur_size :: The current size of the allocated memory block.        */\r\n  /*                                                                       */\r\n  /*    new_size :: The newly requested size in bytes.                     */\r\n  /*                                                                       */\r\n  /*    block    :: The current address of the block in memory.            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The address of the reallocated memory block.                       */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( void* )\r\n  ft_realloc( FT_Memory  memory,\r\n              long       cur_size,\r\n              long       new_size,\r\n              void*      block )\r\n  {\r\n    FT_UNUSED( memory );\r\n    FT_UNUSED( cur_size );\r\n\r\n    return ft_srealloc( block, new_size );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_free                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The memory release function.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory  :: A pointer to the memory object.                         */\r\n  /*                                                                       */\r\n  /*    block   :: The address of block in memory to be freed.             */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( void )\r\n  ft_free( FT_Memory  memory,\r\n           void*      block )\r\n  {\r\n    FT_UNUSED( memory );\r\n\r\n    ft_sfree( block );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                     RESOURCE MANAGEMENT INTERFACE                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_io\r\n\r\n  /* We use the macro STREAM_FILE for convenience to extract the       */\r\n  /* system-specific stream handle from a given FreeType stream object */\r\n#define STREAM_FILE( stream )  ( (FT_FILE*)stream->descriptor.pointer )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_ansi_stream_close                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The function to close a stream.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: A pointer to the stream object.                          */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( void )\r\n  ft_ansi_stream_close( FT_Stream  stream )\r\n  {\r\n    ft_fclose( STREAM_FILE( stream ) );\r\n\r\n    stream->descriptor.pointer = NULL;\r\n    stream->size               = 0;\r\n    stream->base               = 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_ansi_stream_io                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The function to open a stream.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: A pointer to the stream object.                          */\r\n  /*                                                                       */\r\n  /*    offset :: The position in the data stream to start reading.        */\r\n  /*                                                                       */\r\n  /*    buffer :: The address of buffer to store the read data.            */\r\n  /*                                                                       */\r\n  /*    count  :: The number of bytes to read from the stream.             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The number of bytes actually read.  If `count' is zero (this is,   */\r\n  /*    the function is used for seeking), a non-zero return value         */\r\n  /*    indicates an error.                                                */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( unsigned long )\r\n  ft_ansi_stream_io( FT_Stream       stream,\r\n                     unsigned long   offset,\r\n                     unsigned char*  buffer,\r\n                     unsigned long   count )\r\n  {\r\n    FT_FILE*  file;\r\n\r\n\r\n    if ( !count && offset > stream->size )\r\n      return 1;\r\n\r\n    file = STREAM_FILE( stream );\r\n\r\n    if ( stream->pos != offset )\r\n      ft_fseek( file, offset, SEEK_SET );\r\n\r\n    return (unsigned long)ft_fread( buffer, 1, count, file );\r\n  }\r\n\r\n\r\n  /* documentation is in ftstream.h */\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Stream_Open( FT_Stream    stream,\r\n                  const char*  filepathname )\r\n  {\r\n    FT_FILE*  file;\r\n\r\n\r\n    if ( !stream )\r\n      return FT_Err_Invalid_Stream_Handle;\r\n\r\n    stream->descriptor.pointer = NULL;\r\n    stream->pathname.pointer   = (char*)filepathname;\r\n    stream->base               = 0;\r\n    stream->pos                = 0;\r\n    stream->read               = NULL;\r\n    stream->close              = NULL;\r\n\r\n    file = ft_fopen( filepathname, \"rb\" );\r\n    if ( !file )\r\n    {\r\n      FT_ERROR(( \"FT_Stream_Open:\"\r\n                 \" could not open `%s'\\n\", filepathname ));\r\n\r\n      return FT_Err_Cannot_Open_Resource;\r\n    }\r\n\r\n    ft_fseek( file, 0, SEEK_END );\r\n    stream->size = ft_ftell( file );\r\n    if ( !stream->size )\r\n    {\r\n      FT_ERROR(( \"FT_Stream_Open:\" ));\r\n      FT_ERROR(( \" opened `%s' but zero-sized\\n\", filepathname ));\r\n      ft_fclose( file );\r\n      return FT_Err_Cannot_Open_Stream;\r\n    }\r\n    ft_fseek( file, 0, SEEK_SET );\r\n\r\n    stream->descriptor.pointer = file;\r\n    stream->read  = ft_ansi_stream_io;\r\n    stream->close = ft_ansi_stream_close;\r\n\r\n    FT_TRACE1(( \"FT_Stream_Open:\" ));\r\n    FT_TRACE1(( \" opened `%s' (%d bytes) successfully\\n\",\r\n                filepathname, stream->size ));\r\n\r\n    return FT_Err_Ok;\r\n  }\r\n\r\n#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n\r\n  extern FT_Int\r\n  ft_mem_debug_init( FT_Memory  memory );\r\n\r\n  extern void\r\n  ft_mem_debug_done( FT_Memory  memory );\r\n\r\n#endif\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( FT_Memory )\r\n  FT_New_Memory( void )\r\n  {\r\n    FT_Memory  memory;\r\n\r\n\r\n    memory = (FT_Memory)ft_smalloc( sizeof ( *memory ) );\r\n    if ( memory )\r\n    {\r\n      memory->user    = 0;\r\n      memory->alloc   = ft_alloc;\r\n      memory->realloc = ft_realloc;\r\n      memory->free    = ft_free;\r\n#ifdef FT_DEBUG_MEMORY\r\n      ft_mem_debug_init( memory );\r\n#endif\r\n    }\r\n\r\n    return memory;\r\n  }\r\n\r\n\r\n  /* documentation is in ftobjs.h */\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Done_Memory( FT_Memory  memory )\r\n  {\r\n#ifdef FT_DEBUG_MEMORY\r\n    ft_mem_debug_done( memory );\r\n#endif\r\n    ft_sfree( memory );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/fttrigon.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttrigon.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType trigonometric functions (body).                             */\r\n/*                                                                         */\r\n/*  Copyright 2001-2005, 2012 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_TRIGONOMETRY_H\r\n\r\n\r\n#ifdef FT_LONG64\r\n  typedef FT_INT64  FT_Int64;\r\n#endif\r\n\r\n\r\n  /* the Cordic shrink factor 0.607252935008887 * 2^32 */\r\n#define FT_TRIG_SCALE    0x9B74EDA8UL\r\n\r\n  /* the following is 0.607252935008887 * 2^30 */\r\n#define FT_TRIG_COSCALE  0x26DD3B6AUL\r\n\r\n  /* this table was generated for FT_PI = 180L << 16, i.e. degrees */\r\n#define FT_TRIG_MAX_ITERS  23\r\n\r\n  static const FT_Fixed\r\n  ft_trig_arctan_table[23] =\r\n  {\r\n    2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L, 58666L,\r\n    29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L,\r\n    57L, 29L, 14L, 7L, 4L, 2L, 1L\r\n  };\r\n\r\n\r\n#ifdef FT_LONG64\r\n\r\n  /* multiply a given value by the CORDIC shrink factor */\r\n  static FT_Fixed\r\n  ft_trig_downscale( FT_Fixed  val )\r\n  {\r\n    FT_Fixed  s;\r\n    FT_Int64  v;\r\n\r\n\r\n    s   = val;\r\n    val = ( val >= 0 ) ? val : -val;\r\n\r\n    v   = ( val * (FT_Int64)FT_TRIG_SCALE ) + 0x100000000UL;\r\n    val = (FT_Fixed)( v >> 32 );\r\n\r\n    return ( s >= 0 ) ? val : -val;\r\n  }\r\n\r\n#else /* !FT_LONG64 */\r\n\r\n  /* multiply a given value by the CORDIC shrink factor */\r\n  static FT_Fixed\r\n  ft_trig_downscale( FT_Fixed  val )\r\n  {\r\n    FT_Fixed   s;\r\n    FT_UInt32  v1, v2, k1, k2, hi, lo1, lo2, lo3;\r\n\r\n\r\n    s   = val;\r\n    val = ( val >= 0 ) ? val : -val;\r\n\r\n    v1 = (FT_UInt32)val >> 16;\r\n    v2 = (FT_UInt32)( val & 0xFFFFL );\r\n\r\n    k1 = (FT_UInt32)FT_TRIG_SCALE >> 16;           /* constant */\r\n    k2 = (FT_UInt32)( FT_TRIG_SCALE & 0xFFFFL );   /* constant */\r\n\r\n    hi   = k1 * v1;\r\n    lo1  = k1 * v2 + k2 * v1;       /* can't overflow */\r\n\r\n    lo2  = ( k2 * v2 ) >> 16;\r\n    lo3  = ( lo1 >= lo2 ) ? lo1 : lo2;\r\n    lo1 += lo2;\r\n\r\n    hi  += lo1 >> 16;\r\n    if ( lo1 < lo3 )\r\n      hi += (FT_UInt32)0x10000UL;\r\n\r\n    val  = (FT_Fixed)hi;\r\n\r\n    return ( s >= 0 ) ? val : -val;\r\n  }\r\n\r\n#endif /* !FT_LONG64 */\r\n\r\n\r\n  static FT_Int\r\n  ft_trig_prenorm( FT_Vector*  vec )\r\n  {\r\n    FT_Fixed  x, y, z;\r\n    FT_Int    shift;\r\n\r\n\r\n    x = vec->x;\r\n    y = vec->y;\r\n\r\n    z     = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y );\r\n    shift = 0;\r\n\r\n#if 1\r\n    /* determine msb bit index in `shift' */\r\n    if ( z >= ( 1L << 16 ) )\r\n    {\r\n      z     >>= 16;\r\n      shift  += 16;\r\n    }\r\n    if ( z >= ( 1L << 8 ) )\r\n    {\r\n      z     >>= 8;\r\n      shift  += 8;\r\n    }\r\n    if ( z >= ( 1L << 4 ) )\r\n    {\r\n      z     >>= 4;\r\n      shift  += 4;\r\n    }\r\n    if ( z >= ( 1L << 2 ) )\r\n    {\r\n      z     >>= 2;\r\n      shift  += 2;\r\n    }\r\n    if ( z >= ( 1L << 1 ) )\r\n    {\r\n      z    >>= 1;\r\n      shift += 1;\r\n    }\r\n\r\n    if ( shift <= 27 )\r\n    {\r\n      shift  = 27 - shift;\r\n      vec->x = x << shift;\r\n      vec->y = y << shift;\r\n    }\r\n    else\r\n    {\r\n      shift -= 27;\r\n      vec->x = x >> shift;\r\n      vec->y = y >> shift;\r\n      shift  = -shift;\r\n    }\r\n\r\n#else /* 0 */\r\n\r\n    if ( z < ( 1L << 27 ) )\r\n    {\r\n      do\r\n      {\r\n        shift++;\r\n        z <<= 1;\r\n      } while ( z < ( 1L << 27 ) );\r\n      vec->x = x << shift;\r\n      vec->y = y << shift;\r\n    }\r\n    else if ( z > ( 1L << 28 ) )\r\n    {\r\n      do\r\n      {\r\n        shift++;\r\n        z >>= 1;\r\n      } while ( z > ( 1L << 28 ) );\r\n\r\n      vec->x = x >> shift;\r\n      vec->y = y >> shift;\r\n      shift  = -shift;\r\n    }\r\n\r\n#endif /* 0 */\r\n\r\n    return shift;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_trig_pseudo_rotate( FT_Vector*  vec,\r\n                         FT_Angle    theta )\r\n  {\r\n    FT_Int           i;\r\n    FT_Fixed         x, y, xtemp;\r\n    const FT_Fixed  *arctanptr;\r\n\r\n\r\n    x = vec->x;\r\n    y = vec->y;\r\n\r\n    /* Get angle between -90 and 90 degrees */\r\n    while ( theta <= -FT_ANGLE_PI2 )\r\n    {\r\n      x = -x;\r\n      y = -y;\r\n      theta += FT_ANGLE_PI;\r\n    }\r\n\r\n    while ( theta > FT_ANGLE_PI2 )\r\n    {\r\n      x = -x;\r\n      y = -y;\r\n      theta -= FT_ANGLE_PI;\r\n    }\r\n\r\n    arctanptr = ft_trig_arctan_table;\r\n\r\n    /* Pseudorotations, with right shifts */\r\n    i = 0;\r\n    do\r\n    {\r\n      if ( theta < 0 )\r\n      {\r\n        xtemp  = x + ( y >> i );\r\n        y      = y - ( x >> i );\r\n        x      = xtemp;\r\n        theta += *arctanptr++;\r\n      }\r\n      else\r\n      {\r\n        xtemp  = x - ( y >> i );\r\n        y      = y + ( x >> i );\r\n        x      = xtemp;\r\n        theta -= *arctanptr++;\r\n      }\r\n    } while ( ++i < FT_TRIG_MAX_ITERS );\r\n\r\n    vec->x = x;\r\n    vec->y = y;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_trig_pseudo_polarize( FT_Vector*  vec )\r\n  {\r\n    FT_Angle         theta;\r\n    FT_Int           i;\r\n    FT_Fixed         x, y, xtemp;\r\n    const FT_Fixed  *arctanptr;\r\n\r\n\r\n    x = vec->x;\r\n    y = vec->y;\r\n\r\n    /* Get the vector into the right half plane */\r\n    theta = 0;\r\n    if ( x < 0 )\r\n    {\r\n      x = -x;\r\n      y = -y;\r\n      theta = 2 * FT_ANGLE_PI2;\r\n    }\r\n\r\n    if ( y > 0 )\r\n      theta = - theta;\r\n\r\n    arctanptr = ft_trig_arctan_table;\r\n\r\n    /* Pseudorotations, with right shifts */\r\n    i = 0;\r\n    do\r\n    {\r\n      if ( y > 0 )\r\n      {\r\n        xtemp  = x + ( y >> i );\r\n        y      = y - ( x >> i );\r\n        x      = xtemp;\r\n        theta += *arctanptr++;\r\n      }\r\n      else\r\n      {\r\n        xtemp  = x - ( y >> i );\r\n        y      = y + ( x >> i );\r\n        x      = xtemp;\r\n        theta -= *arctanptr++;\r\n      }\r\n    } while ( ++i < FT_TRIG_MAX_ITERS );\r\n\r\n    /* round theta */\r\n    if ( theta >= 0 )\r\n      theta = FT_PAD_ROUND( theta, 32 );\r\n    else\r\n      theta = -FT_PAD_ROUND( -theta, 32 );\r\n\r\n    vec->x = x;\r\n    vec->y = theta;\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_Cos( FT_Angle  angle )\r\n  {\r\n    FT_Vector  v;\r\n\r\n\r\n    v.x = FT_TRIG_COSCALE >> 2;\r\n    v.y = 0;\r\n    ft_trig_pseudo_rotate( &v, angle );\r\n\r\n    return v.x / ( 1 << 12 );\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_Sin( FT_Angle  angle )\r\n  {\r\n    return FT_Cos( FT_ANGLE_PI2 - angle );\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_Tan( FT_Angle  angle )\r\n  {\r\n    FT_Vector  v;\r\n\r\n\r\n    v.x = FT_TRIG_COSCALE >> 2;\r\n    v.y = 0;\r\n    ft_trig_pseudo_rotate( &v, angle );\r\n\r\n    return FT_DivFix( v.y, v.x );\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( FT_Angle )\r\n  FT_Atan2( FT_Fixed  dx,\r\n            FT_Fixed  dy )\r\n  {\r\n    FT_Vector  v;\r\n\r\n\r\n    if ( dx == 0 && dy == 0 )\r\n      return 0;\r\n\r\n    v.x = dx;\r\n    v.y = dy;\r\n    ft_trig_prenorm( &v );\r\n    ft_trig_pseudo_polarize( &v );\r\n\r\n    return v.y;\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Vector_Unit( FT_Vector*  vec,\r\n                  FT_Angle    angle )\r\n  {\r\n    vec->x = FT_TRIG_COSCALE >> 2;\r\n    vec->y = 0;\r\n    ft_trig_pseudo_rotate( vec, angle );\r\n    vec->x >>= 12;\r\n    vec->y >>= 12;\r\n  }\r\n\r\n\r\n  /* these macros return 0 for positive numbers,\r\n     and -1 for negative ones */\r\n#define FT_SIGN_LONG( x )   ( (x) >> ( FT_SIZEOF_LONG * 8 - 1 ) )\r\n#define FT_SIGN_INT( x )    ( (x) >> ( FT_SIZEOF_INT * 8 - 1 ) )\r\n#define FT_SIGN_INT32( x )  ( (x) >> 31 )\r\n#define FT_SIGN_INT16( x )  ( (x) >> 15 )\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Vector_Rotate( FT_Vector*  vec,\r\n                    FT_Angle    angle )\r\n  {\r\n    FT_Int     shift;\r\n    FT_Vector  v;\r\n\r\n\r\n    v.x   = vec->x;\r\n    v.y   = vec->y;\r\n\r\n    if ( angle && ( v.x != 0 || v.y != 0 ) )\r\n    {\r\n      shift = ft_trig_prenorm( &v );\r\n      ft_trig_pseudo_rotate( &v, angle );\r\n      v.x = ft_trig_downscale( v.x );\r\n      v.y = ft_trig_downscale( v.y );\r\n\r\n      if ( shift > 0 )\r\n      {\r\n        FT_Int32  half = (FT_Int32)1L << ( shift - 1 );\r\n\r\n\r\n        vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;\r\n        vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;\r\n      }\r\n      else\r\n      {\r\n        shift  = -shift;\r\n        vec->x = v.x << shift;\r\n        vec->y = v.y << shift;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( FT_Fixed )\r\n  FT_Vector_Length( FT_Vector*  vec )\r\n  {\r\n    FT_Int     shift;\r\n    FT_Vector  v;\r\n\r\n\r\n    v = *vec;\r\n\r\n    /* handle trivial cases */\r\n    if ( v.x == 0 )\r\n    {\r\n      return ( v.y >= 0 ) ? v.y : -v.y;\r\n    }\r\n    else if ( v.y == 0 )\r\n    {\r\n      return ( v.x >= 0 ) ? v.x : -v.x;\r\n    }\r\n\r\n    /* general case */\r\n    shift = ft_trig_prenorm( &v );\r\n    ft_trig_pseudo_polarize( &v );\r\n\r\n    v.x = ft_trig_downscale( v.x );\r\n\r\n    if ( shift > 0 )\r\n      return ( v.x + ( 1 << ( shift - 1 ) ) ) >> shift;\r\n\r\n    return v.x << -shift;\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Vector_Polarize( FT_Vector*  vec,\r\n                      FT_Fixed   *length,\r\n                      FT_Angle   *angle )\r\n  {\r\n    FT_Int     shift;\r\n    FT_Vector  v;\r\n\r\n\r\n    v = *vec;\r\n\r\n    if ( v.x == 0 && v.y == 0 )\r\n      return;\r\n\r\n    shift = ft_trig_prenorm( &v );\r\n    ft_trig_pseudo_polarize( &v );\r\n\r\n    v.x = ft_trig_downscale( v.x );\r\n\r\n    *length = ( shift >= 0 ) ? ( v.x >> shift ) : ( v.x << -shift );\r\n    *angle  = v.y;\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_Vector_From_Polar( FT_Vector*  vec,\r\n                        FT_Fixed    length,\r\n                        FT_Angle    angle )\r\n  {\r\n    vec->x = length;\r\n    vec->y = 0;\r\n\r\n    FT_Vector_Rotate( vec, angle );\r\n  }\r\n\r\n\r\n  /* documentation is in fttrigon.h */\r\n\r\n  FT_EXPORT_DEF( FT_Angle )\r\n  FT_Angle_Diff( FT_Angle  angle1,\r\n                 FT_Angle  angle2 )\r\n  {\r\n    FT_Angle  delta = angle2 - angle1;\r\n\r\n\r\n    delta %= FT_ANGLE_2PI;\r\n    if ( delta < 0 )\r\n      delta += FT_ANGLE_2PI;\r\n\r\n    if ( delta > FT_ANGLE_PI )\r\n      delta -= FT_ANGLE_2PI;\r\n\r\n    return delta;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/fttype1.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttype1.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType utility file for PS names support (body).                   */\r\n/*                                                                         */\r\n/*  Copyright 2002-2004, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n\r\n\r\n  /* documentation is in t1tables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_PS_Font_Info( FT_Face          face,\r\n                       PS_FontInfoRec*  afont_info )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_PsInfo  service = NULL;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );\r\n\r\n      if ( service && service->ps_get_font_info )\r\n        error = service->ps_get_font_info( face, afont_info );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in t1tables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Int )\r\n  FT_Has_PS_Glyph_Names( FT_Face  face )\r\n  {\r\n    FT_Int             result  = 0;\r\n    FT_Service_PsInfo  service = NULL;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );\r\n\r\n      if ( service && service->ps_has_glyph_names )\r\n        result = service->ps_has_glyph_names( face );\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* documentation is in t1tables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_PS_Font_Private( FT_Face         face,\r\n                          PS_PrivateRec*  afont_private )\r\n  {\r\n    FT_Error  error = FT_Err_Invalid_Argument;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_Service_PsInfo  service = NULL;\r\n\r\n\r\n      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );\r\n\r\n      if ( service && service->ps_get_font_private )\r\n        error = service->ps_get_font_private( face, afont_private );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in t1tables.h */\r\n\r\n  FT_EXPORT_DEF( FT_Long )\r\n  FT_Get_PS_Font_Value( FT_Face       face,\r\n                        PS_Dict_Keys  key,\r\n                        FT_UInt       idx,\r\n                        void         *value,\r\n                        FT_Long       value_len )\r\n  {\r\n    FT_Int             result  = 0;\r\n    FT_Service_PsInfo  service = NULL;\r\n\r\n\r\n    if ( face )\r\n    {\r\n      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );\r\n\r\n      if ( service && service->ps_get_font_value )\r\n        result = service->ps_get_font_value( face, key, idx,\r\n                                             value, value_len );\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftutil.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftutil.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType utility file for memory and list management (body).         */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2004, 2005, 2006, 2007 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_LIST_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_memory\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                                                               *****/\r\n  /*****               M E M O R Y   M A N A G E M E N T               *****/\r\n  /*****                                                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_mem_alloc( FT_Memory  memory,\r\n                FT_Long    size,\r\n                FT_Error  *p_error )\r\n  {\r\n    FT_Error    error;\r\n    FT_Pointer  block = ft_mem_qalloc( memory, size, &error );\r\n\r\n    if ( !error && size > 0 )\r\n      FT_MEM_ZERO( block, size );\r\n\r\n    *p_error = error;\r\n    return block;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_mem_qalloc( FT_Memory  memory,\r\n                 FT_Long    size,\r\n                 FT_Error  *p_error )\r\n  {\r\n    FT_Error    error = FT_Err_Ok;\r\n    FT_Pointer  block = NULL;\r\n\r\n\r\n    if ( size > 0 )\r\n    {\r\n      block = memory->alloc( memory, size );\r\n      if ( block == NULL )\r\n        error = FT_Err_Out_Of_Memory;\r\n    }\r\n    else if ( size < 0 )\r\n    {\r\n      /* may help catch/prevent security issues */\r\n      error = FT_Err_Invalid_Argument;\r\n    }\r\n\r\n    *p_error = error;\r\n    return block;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_mem_realloc( FT_Memory  memory,\r\n                  FT_Long    item_size,\r\n                  FT_Long    cur_count,\r\n                  FT_Long    new_count,\r\n                  void*      block,\r\n                  FT_Error  *p_error )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n    block = ft_mem_qrealloc( memory, item_size,\r\n                             cur_count, new_count, block, &error );\r\n    if ( !error && new_count > cur_count )\r\n      FT_MEM_ZERO( (char*)block + cur_count * item_size,\r\n                   ( new_count - cur_count ) * item_size );\r\n\r\n    *p_error = error;\r\n    return block;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_mem_qrealloc( FT_Memory  memory,\r\n                   FT_Long    item_size,\r\n                   FT_Long    cur_count,\r\n                   FT_Long    new_count,\r\n                   void*      block,\r\n                   FT_Error  *p_error )\r\n  {\r\n    FT_Error  error = FT_Err_Ok;\r\n\r\n\r\n    /* Note that we now accept `item_size == 0' as a valid parameter, in\r\n     * order to cover very weird cases where an ALLOC_MULT macro would be\r\n     * called.\r\n     */\r\n    if ( cur_count < 0 || new_count < 0 || item_size < 0 )\r\n    {\r\n      /* may help catch/prevent nasty security issues */\r\n      error = FT_Err_Invalid_Argument;\r\n    }\r\n    else if ( new_count == 0 || item_size == 0 )\r\n    {\r\n      ft_mem_free( memory, block );\r\n      block = NULL;\r\n    }\r\n    else if ( new_count > FT_INT_MAX/item_size )\r\n    {\r\n      error = FT_Err_Array_Too_Large;\r\n    }\r\n    else if ( cur_count == 0 )\r\n    {\r\n      FT_ASSERT( block == NULL );\r\n\r\n      block = ft_mem_alloc( memory, new_count*item_size, &error );\r\n    }\r\n    else\r\n    {\r\n      FT_Pointer  block2;\r\n      FT_Long     cur_size = cur_count*item_size;\r\n      FT_Long     new_size = new_count*item_size;\r\n\r\n\r\n      block2 = memory->realloc( memory, cur_size, new_size, block );\r\n      if ( block2 == NULL )\r\n        error = FT_Err_Out_Of_Memory;\r\n      else\r\n        block = block2;\r\n    }\r\n\r\n    *p_error = error;\r\n    return block;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_mem_free( FT_Memory   memory,\r\n               const void *P )\r\n  {\r\n    if ( P )\r\n      memory->free( memory, (void*)P );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_mem_dup( FT_Memory    memory,\r\n              const void*  address,\r\n              FT_ULong     size,\r\n              FT_Error    *p_error )\r\n  {\r\n    FT_Error    error;\r\n    FT_Pointer  p = ft_mem_qalloc( memory, size, &error );\r\n\r\n\r\n    if ( !error && address )\r\n      ft_memcpy( p, address, size );\r\n\r\n    *p_error = error;\r\n    return p;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Pointer )\r\n  ft_mem_strdup( FT_Memory    memory,\r\n                 const char*  str,\r\n                 FT_Error    *p_error )\r\n  {\r\n    FT_ULong  len = str ? (FT_ULong)ft_strlen( str ) + 1\r\n                        : 0;\r\n\r\n\r\n    return ft_mem_dup( memory, str, len, p_error );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Int )\r\n  ft_mem_strcpyn( char*        dst,\r\n                  const char*  src,\r\n                  FT_ULong     size )\r\n  {\r\n    while ( size > 1 && *src != 0 )\r\n    {\r\n      *dst++ = *src++;\r\n      size--;\r\n    }\r\n\r\n    *dst = 0;  /* always zero-terminate */\r\n\r\n    return *src != 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                                                               *****/\r\n  /*****            D O U B L Y   L I N K E D   L I S T S              *****/\r\n  /*****                                                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_list\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( FT_ListNode )\r\n  FT_List_Find( FT_List  list,\r\n                void*    data )\r\n  {\r\n    FT_ListNode  cur;\r\n\r\n\r\n    cur = list->head;\r\n    while ( cur )\r\n    {\r\n      if ( cur->data == data )\r\n        return cur;\r\n\r\n      cur = cur->next;\r\n    }\r\n\r\n    return (FT_ListNode)0;\r\n  }\r\n\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_List_Add( FT_List      list,\r\n               FT_ListNode  node )\r\n  {\r\n    FT_ListNode  before = list->tail;\r\n\r\n\r\n    node->next = 0;\r\n    node->prev = before;\r\n\r\n    if ( before )\r\n      before->next = node;\r\n    else\r\n      list->head = node;\r\n\r\n    list->tail = node;\r\n  }\r\n\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_List_Insert( FT_List      list,\r\n                  FT_ListNode  node )\r\n  {\r\n    FT_ListNode  after = list->head;\r\n\r\n\r\n    node->next = after;\r\n    node->prev = 0;\r\n\r\n    if ( !after )\r\n      list->tail = node;\r\n    else\r\n      after->prev = node;\r\n\r\n    list->head = node;\r\n  }\r\n\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_List_Remove( FT_List      list,\r\n                  FT_ListNode  node )\r\n  {\r\n    FT_ListNode  before, after;\r\n\r\n\r\n    before = node->prev;\r\n    after  = node->next;\r\n\r\n    if ( before )\r\n      before->next = after;\r\n    else\r\n      list->head = after;\r\n\r\n    if ( after )\r\n      after->prev = before;\r\n    else\r\n      list->tail = before;\r\n  }\r\n\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_List_Up( FT_List      list,\r\n              FT_ListNode  node )\r\n  {\r\n    FT_ListNode  before, after;\r\n\r\n\r\n    before = node->prev;\r\n    after  = node->next;\r\n\r\n    /* check whether we are already on top of the list */\r\n    if ( !before )\r\n      return;\r\n\r\n    before->next = after;\r\n\r\n    if ( after )\r\n      after->prev = before;\r\n    else\r\n      list->tail = before;\r\n\r\n    node->prev       = 0;\r\n    node->next       = list->head;\r\n    list->head->prev = node;\r\n    list->head       = node;\r\n  }\r\n\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_List_Iterate( FT_List            list,\r\n                   FT_List_Iterator   iterator,\r\n                   void*              user )\r\n  {\r\n    FT_ListNode  cur   = list->head;\r\n    FT_Error     error = FT_Err_Ok;\r\n\r\n\r\n    while ( cur )\r\n    {\r\n      FT_ListNode  next = cur->next;\r\n\r\n\r\n      error = iterator( cur, user );\r\n      if ( error )\r\n        break;\r\n\r\n      cur = next;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftlist.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FT_List_Finalize( FT_List             list,\r\n                    FT_List_Destructor  destroy,\r\n                    FT_Memory           memory,\r\n                    void*               user )\r\n  {\r\n    FT_ListNode  cur;\r\n\r\n\r\n    cur = list->head;\r\n    while ( cur )\r\n    {\r\n      FT_ListNode  next = cur->next;\r\n      void*        data = cur->data;\r\n\r\n\r\n      if ( destroy )\r\n        destroy( memory, data, user );\r\n\r\n      FT_FREE( cur );\r\n      cur = next;\r\n    }\r\n\r\n    list->head = 0;\r\n    list->tail = 0;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_UInt32 )\r\n  ft_highpow2( FT_UInt32  value )\r\n  {\r\n    FT_UInt32  value2;\r\n\r\n\r\n    /*\r\n     *  We simply clear the lowest bit in each iteration.  When\r\n     *  we reach 0, we know that the previous value was our result.\r\n     */\r\n    for ( ;; )\r\n    {\r\n      value2 = value & (value - 1);  /* clear lowest bit */\r\n      if ( value2 == 0 )\r\n        break;\r\n\r\n      value = value2;\r\n    }\r\n    return value;\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Alloc( FT_Memory  memory,\r\n            FT_Long    size,\r\n            void*     *P )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    (void)FT_ALLOC( *P, size );\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_QAlloc( FT_Memory  memory,\r\n             FT_Long    size,\r\n             void*     *p )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    (void)FT_QALLOC( *p, size );\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_Realloc( FT_Memory  memory,\r\n              FT_Long    current,\r\n              FT_Long    size,\r\n              void*     *P )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    (void)FT_REALLOC( *P, current, size );\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( FT_Error )\r\n  FT_QRealloc( FT_Memory  memory,\r\n               FT_Long    current,\r\n               FT_Long    size,\r\n               void*     *p )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    (void)FT_QREALLOC( *p, current, size );\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Free( FT_Memory  memory,\r\n           void*     *P )\r\n  {\r\n    if ( *P )\r\n      FT_MEM_FREE( *P );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftwinfnt.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftwinfnt.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for accessing Windows FNT specific info (body).         */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_WINFONTS_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_WINFNT_H\r\n\r\n\r\n  /* documentation is in ftwinfnt.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Get_WinFNT_Header( FT_Face               face,\r\n                        FT_WinFNT_HeaderRec  *header )\r\n  {\r\n    FT_Service_WinFnt  service;\r\n    FT_Error           error;\r\n\r\n\r\n    error = FT_Err_Invalid_Argument;\r\n\r\n    if ( face != NULL )\r\n    {\r\n      FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );\r\n\r\n      if ( service != NULL )\r\n      {\r\n        error = service->get_header( face, header );\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/ftxf86.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftxf86.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType utility file for X11 support (body).                        */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_XFREE86_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n\r\n\r\n  /* documentation is in ftxf86.h */\r\n\r\n  FT_EXPORT_DEF( const char* )\r\n  FT_Get_X11_Font_Format( FT_Face  face )\r\n  {\r\n    const char*  result = NULL;\r\n\r\n\r\n    if ( face )\r\n      FT_FACE_FIND_SERVICE( face, result, XF86_NAME );\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/base/rules.mk",
    "content": "#\r\n# FreeType 2 base layer configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# It sets the following variables which are used by the master Makefile\r\n# after the call:\r\n#\r\n#   BASE_OBJ_S:   The single-object base layer.\r\n#   BASE_OBJ_M:   A list of all objects for a multiple-objects build.\r\n#   BASE_EXT_OBJ: A list of base layer extensions, i.e., components found\r\n#                 in `freetype/src/base' which are not compiled within the\r\n#                 base layer proper.\r\n\r\n\r\nBASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)\r\n\r\n\r\n# Base layer sources\r\n#\r\n#   ftsystem, ftinit, and ftdebug are handled by freetype.mk\r\n#\r\n# All files listed here should be included in `ftbase.c' (for a `single'\r\n# build).\r\n#\r\nBASE_SRC := $(BASE_DIR)/ftadvanc.c \\\r\n            $(BASE_DIR)/ftcalc.c   \\\r\n            $(BASE_DIR)/ftdbgmem.c \\\r\n            $(BASE_DIR)/ftgloadr.c \\\r\n            $(BASE_DIR)/ftobjs.c   \\\r\n            $(BASE_DIR)/ftoutln.c  \\\r\n            $(BASE_DIR)/ftrfork.c  \\\r\n            $(BASE_DIR)/ftsnames.c \\\r\n            $(BASE_DIR)/ftstream.c \\\r\n            $(BASE_DIR)/fttrigon.c \\\r\n            $(BASE_DIR)/ftutil.c\r\n\r\n\r\nifneq ($(ftmac_c),)\r\n  BASE_SRC += $(BASE_DIR)/$(ftmac_c)\r\nendif\r\n\r\nBASE_H := $(BASE_DIR)/ftbase.h\r\n\r\n# Base layer `extensions' sources\r\n#\r\n# An extension is added to the library file as a separate object.  It is\r\n# then linked to the final executable only if one of its symbols is used by\r\n# the application.\r\n#\r\nBASE_EXT_SRC := $(patsubst %,$(BASE_DIR)/%,$(BASE_EXTENSIONS))\r\n\r\n# Default extensions objects\r\n#\r\nBASE_EXT_OBJ := $(BASE_EXT_SRC:$(BASE_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\n\r\n\r\n# Base layer object(s)\r\n#\r\n#   BASE_OBJ_M is used during `multi' builds (each base source file compiles\r\n#   to a single object file).\r\n#\r\n#   BASE_OBJ_S is used during `single' builds (the whole base layer is\r\n#   compiled as a single object file using ftbase.c).\r\n#\r\nBASE_OBJ_M := $(BASE_SRC:$(BASE_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nBASE_OBJ_S := $(OBJ_DIR)/ftbase.$O\r\n\r\n# Base layer root source file for single build\r\n#\r\nBASE_SRC_S := $(BASE_DIR)/ftbase.c\r\n\r\n\r\n# Base layer - single object build\r\n#\r\n$(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H) $(BASE_H)\r\n\t$(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BASE_SRC_S))\r\n\r\n\r\n# Multiple objects build + extensions\r\n#\r\n$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H) $(BASE_H)\r\n\t$(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/Jamfile",
    "content": "# FreeType 2 src/bdf Jamfile\r\n#\r\n# Copyright 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) bdf ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = bdfdrivr bdflib ;\r\n  }\r\n  else\r\n  {\r\n    _sources = bdf ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/bdf Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/README",
    "content": "                  FreeType font driver for BDF fonts\r\n\r\n                       Francesco Zappa Nardelli\r\n                  <francesco.zappa.nardelli@ens.fr>\r\n\r\n\r\nIntroduction\r\n************\r\n\r\nBDF (Bitmap Distribution Format) is a bitmap font format defined by Adobe,\r\nwhich is intended to be easily understood by both humans and computers.\r\nThis code implements a BDF driver for the FreeType library, following the\r\nAdobe Specification V 2.2.  The specification of the BDF font format is\r\navailable from Adobe's web site:\r\n\r\n  http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf\r\n\r\nMany good bitmap fonts in bdf format come with XFree86 (www.XFree86.org).\r\nThey do not define vertical metrics, because the X Consortium BDF\r\nspecification has removed them.\r\n\r\n\r\nEncodings\r\n*********\r\n\r\nThe variety of encodings that accompanies bdf fonts appears to encompass the\r\nsmall set defined in freetype.h.  On the other hand, two properties that\r\nspecify encoding and registry are usually defined in bdf fonts.\r\n\r\nI decided to make these two properties directly accessible, leaving to the\r\nclient application the work of interpreting them.  For instance:\r\n\r\n\r\n  #include FT_INTERNAL_BDF_TYPES_H\r\n\r\n  FT_Face          face;\r\n  BDF_Public_Face  bdfface;\r\n\r\n\r\n  FT_New_Face( library, ..., &face );\r\n\r\n  bdfface = (BDF_Public_Face)face;\r\n\r\n  if ( ( bdfface->charset_registry == \"ISO10646\" ) &&\r\n       ( bdfface->charset_encoding == \"1\" )        )\r\n    [..]\r\n\r\n\r\nThus the driver always exports `ft_encoding_none' as face->charmap.encoding.\r\nFT_Get_Char_Index's behavior is unmodified, that is, it converts the ULong\r\nvalue given as argument into the corresponding glyph number.\r\n\r\nIf the two properties are not available, Adobe Standard Encoding should be\r\nassumed.\r\n\r\n\r\nAnti-Aliased Bitmaps\r\n********************\r\n\r\nThe driver supports an extension to the BDF format as used in Mark Leisher's\r\nxmbdfed bitmap font editor.  Microsoft's SBIT tool expects bitmap fonts in\r\nthat format for adding anti-aliased them to TrueType fonts.  It introduces a\r\nfourth field to the `SIZE' keyword which gives the bpp value (bits per\r\npixel) of the glyph data in the font.  Possible values are 1 (the default),\r\n2 (four gray levels), 4 (16 gray levels), and 8 (256 gray levels).  The\r\ndriver returns either a bitmap with 1 bit per pixel or a pixmap with 8bits\r\nper pixel (using 4, 16, and 256 gray levels, respectively).\r\n\r\n\r\nKnown problems\r\n**************\r\n\r\n- A font is entirely loaded into memory.  Obviously, this is not the Right\r\n  Thing(TM).  If you have big fonts I suggest you convert them into PCF\r\n  format (using the bdftopcf utility): the PCF font drive of FreeType can\r\n  perform incremental glyph loading.\r\n\r\nWhen I have some time, I will implement on-demand glyph parsing.\r\n\r\n- Except for encodings properties, client applications have no visibility of\r\n  the PCF_Face object.  This means that applications cannot directly access\r\n  font tables and must trust FreeType.\r\n\r\n- Currently, glyph names are ignored.\r\n\r\n  I plan to give full visibility of the BDF_Face object in an upcoming\r\n  revision of the driver, thus implementing also glyph names.\r\n\r\n- As I have never seen a BDF font that defines vertical metrics, vertical\r\n  metrics are (parsed and) discarded.  If you own a BDF font that defines\r\n  vertical metrics, please let me know (I will implement them in 5-10\r\n  minutes).\r\n\r\n\r\nLicense\r\n*******\r\n\r\nCopyright (C) 2001-2002 by Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n\"Software\"), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n*** Portions of the driver (that is, bdflib.c and bdf.h):\r\n\r\nCopyright 2000 Computing Research Labs, New Mexico State University\r\nCopyright 2001-2002, 2011 Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a\r\ncopy of this software and associated documentation files (the \"Software\"),\r\nto deal in the Software without restriction, including without limitation\r\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\r\nand/or sell copies of the Software, and to permit persons to whom the\r\nSoftware is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r\nTHE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT\r\nOR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR\r\nTHE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n\r\nCredits\r\n*******\r\n\r\nThis driver is based on excellent Mark Leisher's bdf library.  If you\r\nfind something good in this driver you should probably thank him, not\r\nme.\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/bdf.c",
    "content": "/*  bdf.c\r\n\r\n    FreeType font driver for bdf files\r\n\r\n    Copyright (C) 2001, 2002 by\r\n    Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"bdflib.c\"\r\n#include \"bdfdrivr.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/bdf.h",
    "content": "/*\r\n * Copyright 2000 Computing Research Labs, New Mexico State University\r\n * Copyright 2001-2004, 2011 Francesco Zappa Nardelli\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the \"Software\"),\r\n * to deal in the Software without restriction, including without limitation\r\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n * and/or sell copies of the Software, and to permit persons to whom the\r\n * Software is furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r\n * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY\r\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT\r\n * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR\r\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n\r\n#ifndef __BDF_H__\r\n#define __BDF_H__\r\n\r\n\r\n/*\r\n * Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher\r\n */\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n/* Imported from bdfP.h */\r\n\r\n#define _bdf_glyph_modified( map, e )                 \\\r\n          ( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) )\r\n#define _bdf_set_glyph_modified( map, e )              \\\r\n          ( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) )\r\n#define _bdf_clear_glyph_modified( map, e )             \\\r\n          ( (map)[(e) >> 5] &= ~( 1 << ( (e) & 31 ) ) )\r\n\r\n/* end of bdfP.h */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* BDF font options macros and types.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define BDF_CORRECT_METRICS  0x01 /* Correct invalid metrics when loading. */\r\n#define BDF_KEEP_COMMENTS    0x02 /* Preserve the font comments.           */\r\n#define BDF_KEEP_UNENCODED   0x04 /* Keep the unencoded glyphs.            */\r\n#define BDF_PROPORTIONAL     0x08 /* Font has proportional spacing.        */\r\n#define BDF_MONOWIDTH        0x10 /* Font has mono width.                  */\r\n#define BDF_CHARCELL         0x20 /* Font has charcell spacing.            */\r\n\r\n#define BDF_ALL_SPACING  ( BDF_PROPORTIONAL | \\\r\n                           BDF_MONOWIDTH    | \\\r\n                           BDF_CHARCELL     )\r\n\r\n#define BDF_DEFAULT_LOAD_OPTIONS  ( BDF_CORRECT_METRICS | \\\r\n                                    BDF_KEEP_COMMENTS   | \\\r\n                                    BDF_KEEP_UNENCODED  | \\\r\n                                    BDF_PROPORTIONAL    )\r\n\r\n\r\n  typedef struct  bdf_options_t_\r\n  {\r\n    int            correct_metrics;\r\n    int            keep_unencoded;\r\n    int            keep_comments;\r\n    int            font_spacing;\r\n\r\n  } bdf_options_t;\r\n\r\n\r\n  /* Callback function type for unknown configuration options. */\r\n  typedef int\r\n  (*bdf_options_callback_t)( bdf_options_t*  opts,\r\n                             char**          params,\r\n                             unsigned long   nparams,\r\n                             void*           client_data );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* BDF font property macros and types.                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define BDF_ATOM      1\r\n#define BDF_INTEGER   2\r\n#define BDF_CARDINAL  3\r\n\r\n\r\n  /* This structure represents a particular property of a font. */\r\n  /* There are a set of defaults and each font has their own.   */\r\n  typedef struct  bdf_property_t_\r\n  {\r\n    char*  name;         /* Name of the property.   */\r\n    int    format;       /* Format of the property. */\r\n    int    builtin;      /* A builtin property.     */\r\n    union\r\n    {\r\n      char*          atom;\r\n      long           l;\r\n      unsigned long  ul;\r\n\r\n    } value;             /* Value of the property.  */\r\n\r\n  } bdf_property_t;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* BDF font metric and glyph types.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct  bdf_bbx_t_\r\n  {\r\n    unsigned short  width;\r\n    unsigned short  height;\r\n\r\n    short           x_offset;\r\n    short           y_offset;\r\n\r\n    short           ascent;\r\n    short           descent;\r\n\r\n  } bdf_bbx_t;\r\n\r\n\r\n  typedef struct  bdf_glyph_t_\r\n  {\r\n    char*           name;        /* Glyph name.                          */\r\n    long            encoding;    /* Glyph encoding.                      */\r\n    unsigned short  swidth;      /* Scalable width.                      */\r\n    unsigned short  dwidth;      /* Device width.                        */\r\n    bdf_bbx_t       bbx;         /* Glyph bounding box.                  */\r\n    unsigned char*  bitmap;      /* Glyph bitmap.                        */\r\n    unsigned long   bpr;         /* Number of bytes used per row.        */\r\n    unsigned short  bytes;       /* Number of bytes used for the bitmap. */\r\n\r\n  } bdf_glyph_t;\r\n\r\n\r\n  typedef struct  _hashnode_\r\n  {\r\n    const char*  key;\r\n    size_t       data;\r\n\r\n  } _hashnode, *hashnode;\r\n\r\n\r\n  typedef struct  hashtable_\r\n  {\r\n    int        limit;\r\n    int        size;\r\n    int        used;\r\n    hashnode*  table;\r\n\r\n  } hashtable;\r\n\r\n\r\n  typedef struct  bdf_glyphlist_t_\r\n  {\r\n    unsigned short  pad;          /* Pad to 4-byte boundary.              */\r\n    unsigned short  bpp;          /* Bits per pixel.                      */\r\n    long            start;        /* Beginning encoding value of glyphs.  */\r\n    long            end;          /* Ending encoding value of glyphs.     */\r\n    bdf_glyph_t*    glyphs;       /* Glyphs themselves.                   */\r\n    unsigned long   glyphs_size;  /* Glyph structures allocated.          */\r\n    unsigned long   glyphs_used;  /* Glyph structures used.               */\r\n    bdf_bbx_t       bbx;          /* Overall bounding box of glyphs.      */\r\n\r\n  } bdf_glyphlist_t;\r\n\r\n\r\n  typedef struct  bdf_font_t_\r\n  {\r\n    char*            name;           /* Name of the font.                   */\r\n    bdf_bbx_t        bbx;            /* Font bounding box.                  */\r\n\r\n    long             point_size;     /* Point size of the font.             */\r\n    unsigned long    resolution_x;   /* Font horizontal resolution.         */\r\n    unsigned long    resolution_y;   /* Font vertical resolution.           */\r\n\r\n    int              spacing;        /* Font spacing value.                 */\r\n\r\n    unsigned short   monowidth;      /* Logical width for monowidth font.   */\r\n\r\n    long             default_char;   /* Encoding of the default glyph.      */\r\n\r\n    long             font_ascent;    /* Font ascent.                        */\r\n    long             font_descent;   /* Font descent.                       */\r\n\r\n    unsigned long    glyphs_size;    /* Glyph structures allocated.         */\r\n    unsigned long    glyphs_used;    /* Glyph structures used.              */\r\n    bdf_glyph_t*     glyphs;         /* Glyphs themselves.                  */\r\n\r\n    unsigned long    unencoded_size; /* Unencoded glyph struct. allocated.  */\r\n    unsigned long    unencoded_used; /* Unencoded glyph struct. used.       */\r\n    bdf_glyph_t*     unencoded;      /* Unencoded glyphs themselves.        */\r\n\r\n    unsigned long    props_size;     /* Font properties allocated.          */\r\n    unsigned long    props_used;     /* Font properties used.               */\r\n    bdf_property_t*  props;          /* Font properties themselves.         */\r\n\r\n    char*            comments;       /* Font comments.                      */\r\n    unsigned long    comments_len;   /* Length of comment string.           */\r\n\r\n    bdf_glyphlist_t  overflow;       /* Storage used for glyph insertion.   */\r\n\r\n    void*            internal;       /* Internal data for the font.         */\r\n\r\n    /* The size of the next two arrays must be in sync with the */\r\n    /* size of the `have' array in the `bdf_parse_t' structure. */\r\n    unsigned long    nmod[34816];    /* Bitmap indicating modified glyphs.  */\r\n    unsigned long    umod[34816];    /* Bitmap indicating modified          */\r\n                                     /* unencoded glyphs.                   */\r\n    unsigned short   modified;       /* Boolean indicating font modified.   */\r\n    unsigned short   bpp;            /* Bits per pixel.                     */\r\n\r\n    FT_Memory        memory;\r\n\r\n    bdf_property_t*  user_props;\r\n    unsigned long    nuser_props;\r\n    hashtable        proptbl;\r\n\r\n  } bdf_font_t;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Types for load/save callbacks.                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Error codes. */\r\n#define BDF_MISSING_START       -1\r\n#define BDF_MISSING_FONTNAME    -2\r\n#define BDF_MISSING_SIZE        -3\r\n#define BDF_MISSING_CHARS       -4\r\n#define BDF_MISSING_STARTCHAR   -5\r\n#define BDF_MISSING_ENCODING    -6\r\n#define BDF_MISSING_BBX         -7\r\n\r\n#define BDF_OUT_OF_MEMORY      -20\r\n\r\n#define BDF_INVALID_LINE      -100\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* BDF font API.                                                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( FT_Error )\r\n  bdf_load_font( FT_Stream       stream,\r\n                 FT_Memory       memory,\r\n                 bdf_options_t*  opts,\r\n                 bdf_font_t*    *font );\r\n\r\n  FT_LOCAL( void )\r\n  bdf_free_font( bdf_font_t*  font );\r\n\r\n  FT_LOCAL( bdf_property_t * )\r\n  bdf_get_property( char*        name,\r\n                    bdf_font_t*  font );\r\n\r\n  FT_LOCAL( bdf_property_t * )\r\n  bdf_get_font_property( bdf_font_t*  font,\r\n                         const char*  name );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __BDF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/bdfdrivr.c",
    "content": "/*  bdfdrivr.c\r\n\r\n    FreeType font driver for bdf files\r\n\r\n    Copyright (C) 2001-2008, 2011 by\r\n    Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n#include <ft2build.h>\r\n\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_BDF_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n#include FT_SERVICE_BDF_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n\r\n#include \"bdf.h\"\r\n#include \"bdfdrivr.h\"\r\n\r\n#include \"bdferror.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_bdfdriver\r\n\r\n\r\n  typedef struct  BDF_CMapRec_\r\n  {\r\n    FT_CMapRec        cmap;\r\n    FT_ULong          num_encodings; /* ftobjs.h: FT_CMap->clazz->size */\r\n    BDF_encoding_el*  encodings;\r\n\r\n  } BDF_CMapRec, *BDF_CMap;\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  bdf_cmap_init( FT_CMap     bdfcmap,\r\n                 FT_Pointer  init_data )\r\n  {\r\n    BDF_CMap  cmap = (BDF_CMap)bdfcmap;\r\n    BDF_Face  face = (BDF_Face)FT_CMAP_FACE( cmap );\r\n    FT_UNUSED( init_data );\r\n\r\n\r\n    cmap->num_encodings = face->bdffont->glyphs_used;\r\n    cmap->encodings     = face->en_table;\r\n\r\n    return BDF_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  bdf_cmap_done( FT_CMap  bdfcmap )\r\n  {\r\n    BDF_CMap  cmap = (BDF_CMap)bdfcmap;\r\n\r\n\r\n    cmap->encodings     = NULL;\r\n    cmap->num_encodings = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  bdf_cmap_char_index( FT_CMap    bdfcmap,\r\n                       FT_UInt32  charcode )\r\n  {\r\n    BDF_CMap          cmap      = (BDF_CMap)bdfcmap;\r\n    BDF_encoding_el*  encodings = cmap->encodings;\r\n    FT_ULong          min, max, mid; /* num_encodings */\r\n    FT_UShort         result    = 0; /* encodings->glyph */\r\n\r\n\r\n    min = 0;\r\n    max = cmap->num_encodings;\r\n\r\n    while ( min < max )\r\n    {\r\n      FT_ULong  code;\r\n\r\n\r\n      mid  = ( min + max ) >> 1;\r\n      code = encodings[mid].enc;\r\n\r\n      if ( charcode == code )\r\n      {\r\n        /* increase glyph index by 1 --              */\r\n        /* we reserve slot 0 for the undefined glyph */\r\n        result = encodings[mid].glyph + 1;\r\n        break;\r\n      }\r\n\r\n      if ( charcode < code )\r\n        max = mid;\r\n      else\r\n        min = mid + 1;\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  bdf_cmap_char_next( FT_CMap     bdfcmap,\r\n                      FT_UInt32  *acharcode )\r\n  {\r\n    BDF_CMap          cmap      = (BDF_CMap)bdfcmap;\r\n    BDF_encoding_el*  encodings = cmap->encodings;\r\n    FT_ULong          min, max, mid; /* num_encodings */\r\n    FT_UShort         result   = 0;  /* encodings->glyph */\r\n    FT_ULong          charcode = *acharcode + 1;\r\n\r\n\r\n    min = 0;\r\n    max = cmap->num_encodings;\r\n\r\n    while ( min < max )\r\n    {\r\n      FT_ULong  code; /* same as BDF_encoding_el.enc */\r\n\r\n\r\n      mid  = ( min + max ) >> 1;\r\n      code = encodings[mid].enc;\r\n\r\n      if ( charcode == code )\r\n      {\r\n        /* increase glyph index by 1 --              */\r\n        /* we reserve slot 0 for the undefined glyph */\r\n        result = encodings[mid].glyph + 1;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( charcode < code )\r\n        max = mid;\r\n      else\r\n        min = mid + 1;\r\n    }\r\n\r\n    charcode = 0;\r\n    if ( min < cmap->num_encodings )\r\n    {\r\n      charcode = encodings[min].enc;\r\n      result   = encodings[min].glyph + 1;\r\n    }\r\n\r\n  Exit:\r\n    if ( charcode > 0xFFFFFFFFUL )\r\n    {\r\n      FT_TRACE1(( \"bdf_cmap_char_next: charcode 0x%x > 32bit API\" ));\r\n      *acharcode = 0;\r\n      /* XXX: result should be changed to indicate an overflow error */\r\n    }\r\n    else\r\n      *acharcode = (FT_UInt32)charcode;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_CMap_ClassRec  bdf_cmap_class =\r\n  {\r\n    sizeof ( BDF_CMapRec ),\r\n    bdf_cmap_init,\r\n    bdf_cmap_done,\r\n    bdf_cmap_char_index,\r\n    bdf_cmap_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n  static FT_Error\r\n  bdf_interpret_style( BDF_Face  bdf )\r\n  {\r\n    FT_Error         error  = BDF_Err_Ok;\r\n    FT_Face          face   = FT_FACE( bdf );\r\n    FT_Memory        memory = face->memory;\r\n    bdf_font_t*      font   = bdf->bdffont;\r\n    bdf_property_t*  prop;\r\n\r\n    char*   strings[4] = { NULL, NULL, NULL, NULL };\r\n    size_t  nn, len, lengths[4];\r\n\r\n\r\n    face->style_flags = 0;\r\n\r\n    prop = bdf_get_font_property( font, (char *)\"SLANT\" );\r\n    if ( prop && prop->format == BDF_ATOM                             &&\r\n         prop->value.atom                                             &&\r\n         ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ||\r\n           *(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) )\r\n    {\r\n      face->style_flags |= FT_STYLE_FLAG_ITALIC;\r\n      strings[2] = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' )\r\n                   ? (char *)\"Oblique\"\r\n                   : (char *)\"Italic\";\r\n    }\r\n\r\n    prop = bdf_get_font_property( font, (char *)\"WEIGHT_NAME\" );\r\n    if ( prop && prop->format == BDF_ATOM                             &&\r\n         prop->value.atom                                             &&\r\n         ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) )\r\n    {\r\n      face->style_flags |= FT_STYLE_FLAG_BOLD;\r\n      strings[1] = (char *)\"Bold\";\r\n    }\r\n\r\n    prop = bdf_get_font_property( font, (char *)\"SETWIDTH_NAME\" );\r\n    if ( prop && prop->format == BDF_ATOM                              &&\r\n         prop->value.atom && *(prop->value.atom)                       &&\r\n         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )\r\n      strings[3] = (char *)(prop->value.atom);\r\n\r\n    prop = bdf_get_font_property( font, (char *)\"ADD_STYLE_NAME\" );\r\n    if ( prop && prop->format == BDF_ATOM                              &&\r\n         prop->value.atom && *(prop->value.atom)                       &&\r\n         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )\r\n      strings[0] = (char *)(prop->value.atom);\r\n\r\n    len = 0;\r\n\r\n    for ( len = 0, nn = 0; nn < 4; nn++ )\r\n    {\r\n      lengths[nn] = 0;\r\n      if ( strings[nn] )\r\n      {\r\n        lengths[nn] = ft_strlen( strings[nn] );\r\n        len        += lengths[nn] + 1;\r\n      }\r\n    }\r\n\r\n    if ( len == 0 )\r\n    {\r\n      strings[0] = (char *)\"Regular\";\r\n      lengths[0] = ft_strlen( strings[0] );\r\n      len        = lengths[0] + 1;\r\n    }\r\n\r\n    {\r\n      char*  s;\r\n\r\n\r\n      if ( FT_ALLOC( face->style_name, len ) )\r\n        return error;\r\n\r\n      s = face->style_name;\r\n\r\n      for ( nn = 0; nn < 4; nn++ )\r\n      {\r\n        char*  src = strings[nn];\r\n\r\n\r\n        len = lengths[nn];\r\n\r\n        if ( src == NULL )\r\n          continue;\r\n\r\n        /* separate elements with a space */\r\n        if ( s != face->style_name )\r\n          *s++ = ' ';\r\n\r\n        ft_memcpy( s, src, len );\r\n\r\n        /* need to convert spaces to dashes for */\r\n        /* add_style_name and setwidth_name     */\r\n        if ( nn == 0 || nn == 3 )\r\n        {\r\n          size_t  mm;\r\n\r\n\r\n          for ( mm = 0; mm < len; mm++ )\r\n            if ( s[mm] == ' ' )\r\n              s[mm] = '-';\r\n        }\r\n\r\n        s += len;\r\n      }\r\n      *s = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  BDF_Face_Done( FT_Face  bdfface )         /* BDF_Face */\r\n  {\r\n    BDF_Face   face = (BDF_Face)bdfface;\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n    bdf_free_font( face->bdffont );\r\n\r\n    FT_FREE( face->en_table );\r\n\r\n    FT_FREE( face->charset_encoding );\r\n    FT_FREE( face->charset_registry );\r\n    FT_FREE( bdfface->family_name );\r\n    FT_FREE( bdfface->style_name );\r\n\r\n    FT_FREE( bdfface->available_sizes );\r\n\r\n    FT_FREE( face->bdffont );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  BDF_Face_Init( FT_Stream      stream,\r\n                 FT_Face        bdfface,        /* BDF_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    FT_Error       error  = BDF_Err_Ok;\r\n    BDF_Face       face   = (BDF_Face)bdfface;\r\n    FT_Memory      memory = FT_FACE_MEMORY( face );\r\n\r\n    bdf_font_t*    font = NULL;\r\n    bdf_options_t  options;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n    FT_UNUSED( face_index );\r\n\r\n\r\n    FT_TRACE2(( \"BDF driver\\n\" ));\r\n\r\n    if ( FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    options.correct_metrics = 1;   /* FZ XXX: options semantics */\r\n    options.keep_unencoded  = 1;\r\n    options.keep_comments   = 0;\r\n    options.font_spacing    = BDF_PROPORTIONAL;\r\n\r\n    error = bdf_load_font( stream, memory, &options, &font );\r\n    if ( error == BDF_Err_Missing_Startfont_Field )\r\n    {\r\n      FT_TRACE2(( \"  not a BDF file\\n\" ));\r\n      goto Fail;\r\n    }\r\n    else if ( error )\r\n      goto Exit;\r\n\r\n    /* we have a bdf font: let's construct the face object */\r\n    face->bdffont = font;\r\n    {\r\n      bdf_property_t*  prop = NULL;\r\n\r\n\r\n      FT_TRACE4(( \"  number of glyphs: allocated %d (used %d)\\n\",\r\n                  font->glyphs_size,\r\n                  font->glyphs_used ));\r\n      FT_TRACE4(( \"  number of unencoded glyphs: allocated %d (used %d)\\n\",\r\n                  font->unencoded_size,\r\n                  font->unencoded_used ));\r\n\r\n      bdfface->num_faces  = 1;\r\n      bdfface->face_index = 0;\r\n      bdfface->face_flags = FT_FACE_FLAG_FIXED_SIZES |\r\n                            FT_FACE_FLAG_HORIZONTAL  |\r\n                            FT_FACE_FLAG_FAST_GLYPHS;\r\n\r\n      prop = bdf_get_font_property( font, \"SPACING\" );\r\n      if ( prop && prop->format == BDF_ATOM                             &&\r\n           prop->value.atom                                             &&\r\n           ( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' ||\r\n             *(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) )\r\n        bdfface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      /* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL   */\r\n      /* FZ XXX: I need a font to implement this */\r\n\r\n      prop = bdf_get_font_property( font, \"FAMILY_NAME\" );\r\n      if ( prop && prop->value.atom )\r\n      {\r\n        if ( FT_STRDUP( bdfface->family_name, prop->value.atom ) )\r\n          goto Exit;\r\n      }\r\n      else\r\n        bdfface->family_name = 0;\r\n\r\n      if ( ( error = bdf_interpret_style( face ) ) != 0 )\r\n        goto Exit;\r\n\r\n      /* the number of glyphs (with one slot for the undefined glyph */\r\n      /* at position 0 and all unencoded glyphs)                     */\r\n      bdfface->num_glyphs = font->glyphs_size + 1;\r\n\r\n      bdfface->num_fixed_sizes = 1;\r\n      if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) )\r\n        goto Exit;\r\n\r\n      {\r\n        FT_Bitmap_Size*  bsize = bdfface->available_sizes;\r\n        FT_Short         resolution_x = 0, resolution_y = 0;\r\n\r\n\r\n        FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );\r\n\r\n        bsize->height = (FT_Short)( font->font_ascent + font->font_descent );\r\n\r\n        prop = bdf_get_font_property( font, \"AVERAGE_WIDTH\" );\r\n        if ( prop )\r\n          bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );\r\n        else\r\n          bsize->width = (FT_Short)( bsize->height * 2/3 );\r\n\r\n        prop = bdf_get_font_property( font, \"POINT_SIZE\" );\r\n        if ( prop )\r\n          /* convert from 722.7 decipoints to 72 points per inch */\r\n          bsize->size =\r\n            (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );\r\n        else\r\n          bsize->size = bsize->width << 6;\r\n\r\n        prop = bdf_get_font_property( font, \"PIXEL_SIZE\" );\r\n        if ( prop )\r\n          bsize->y_ppem = (FT_Short)prop->value.l << 6;\r\n\r\n        prop = bdf_get_font_property( font, \"RESOLUTION_X\" );\r\n        if ( prop )\r\n          resolution_x = (FT_Short)prop->value.l;\r\n\r\n        prop = bdf_get_font_property( font, \"RESOLUTION_Y\" );\r\n        if ( prop )\r\n          resolution_y = (FT_Short)prop->value.l;\r\n\r\n        if ( bsize->y_ppem == 0 )\r\n        {\r\n          bsize->y_ppem = bsize->size;\r\n          if ( resolution_y )\r\n            bsize->y_ppem = bsize->y_ppem * resolution_y / 72;\r\n        }\r\n        if ( resolution_x && resolution_y )\r\n          bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;\r\n        else\r\n          bsize->x_ppem = bsize->y_ppem;\r\n      }\r\n\r\n      /* encoding table */\r\n      {\r\n        bdf_glyph_t*   cur = font->glyphs;\r\n        unsigned long  n;\r\n\r\n\r\n        if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) )\r\n          goto Exit;\r\n\r\n        face->default_glyph = 0;\r\n        for ( n = 0; n < font->glyphs_size; n++ )\r\n        {\r\n          (face->en_table[n]).enc = cur[n].encoding;\r\n          FT_TRACE4(( \"  idx %d, val 0x%lX\\n\", n, cur[n].encoding ));\r\n          (face->en_table[n]).glyph = (FT_Short)n;\r\n\r\n          if ( cur[n].encoding == font->default_char )\r\n          {\r\n            if ( n < FT_UINT_MAX )\r\n              face->default_glyph = (FT_UInt)n;\r\n            else\r\n              FT_TRACE1(( \"BDF_Face_Init:\"\r\n                          \" idx %d is too large for this system\\n\", n ));\r\n          }\r\n        }\r\n      }\r\n\r\n      /* charmaps */\r\n      {\r\n        bdf_property_t  *charset_registry = 0, *charset_encoding = 0;\r\n        FT_Bool          unicode_charmap  = 0;\r\n\r\n\r\n        charset_registry =\r\n          bdf_get_font_property( font, \"CHARSET_REGISTRY\" );\r\n        charset_encoding =\r\n          bdf_get_font_property( font, \"CHARSET_ENCODING\" );\r\n        if ( charset_registry && charset_encoding )\r\n        {\r\n          if ( charset_registry->format == BDF_ATOM &&\r\n               charset_encoding->format == BDF_ATOM &&\r\n               charset_registry->value.atom         &&\r\n               charset_encoding->value.atom         )\r\n          {\r\n            const char*  s;\r\n\r\n\r\n            if ( FT_STRDUP( face->charset_encoding,\r\n                            charset_encoding->value.atom ) ||\r\n                 FT_STRDUP( face->charset_registry,\r\n                            charset_registry->value.atom ) )\r\n              goto Exit;\r\n\r\n            /* Uh, oh, compare first letters manually to avoid dependency */\r\n            /* on locales.                                                */\r\n            s = face->charset_registry;\r\n            if ( ( s[0] == 'i' || s[0] == 'I' ) &&\r\n                 ( s[1] == 's' || s[1] == 'S' ) &&\r\n                 ( s[2] == 'o' || s[2] == 'O' ) )\r\n            {\r\n              s += 3;\r\n              if ( !ft_strcmp( s, \"10646\" )                      ||\r\n                   ( !ft_strcmp( s, \"8859\" ) &&\r\n                     !ft_strcmp( face->charset_encoding, \"1\" ) ) )\r\n              unicode_charmap = 1;\r\n            }\r\n\r\n            {\r\n              FT_CharMapRec  charmap;\r\n\r\n\r\n              charmap.face        = FT_FACE( face );\r\n              charmap.encoding    = FT_ENCODING_NONE;\r\n              /* initial platform/encoding should indicate unset status? */\r\n              charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;\r\n              charmap.encoding_id = TT_APPLE_ID_DEFAULT;\r\n\r\n              if ( unicode_charmap )\r\n              {\r\n                charmap.encoding    = FT_ENCODING_UNICODE;\r\n                charmap.platform_id = TT_PLATFORM_MICROSOFT;\r\n                charmap.encoding_id = TT_MS_ID_UNICODE_CS;\r\n              }\r\n\r\n              error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );\r\n\r\n#if 0\r\n              /* Select default charmap */\r\n              if ( bdfface->num_charmaps )\r\n                bdfface->charmap = bdfface->charmaps[0];\r\n#endif\r\n            }\r\n\r\n            goto Exit;\r\n          }\r\n        }\r\n\r\n        /* otherwise assume Adobe standard encoding */\r\n\r\n        {\r\n          FT_CharMapRec  charmap;\r\n\r\n\r\n          charmap.face        = FT_FACE( face );\r\n          charmap.encoding    = FT_ENCODING_ADOBE_STANDARD;\r\n          charmap.platform_id = TT_PLATFORM_ADOBE;\r\n          charmap.encoding_id = TT_ADOBE_ID_STANDARD;\r\n\r\n          error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );\r\n\r\n          /* Select default charmap */\r\n          if ( bdfface->num_charmaps )\r\n            bdfface->charmap = bdfface->charmaps[0];\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    BDF_Face_Done( bdfface );\r\n    return BDF_Err_Unknown_File_Format;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  BDF_Size_Select( FT_Size   size,\r\n                   FT_ULong  strike_index )\r\n  {\r\n    bdf_font_t*  bdffont = ( (BDF_Face)size->face )->bdffont;\r\n\r\n\r\n    FT_Select_Metrics( size->face, strike_index );\r\n\r\n    size->metrics.ascender    = bdffont->font_ascent << 6;\r\n    size->metrics.descender   = -bdffont->font_descent << 6;\r\n    size->metrics.max_advance = bdffont->bbx.width << 6;\r\n\r\n    return BDF_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  BDF_Size_Request( FT_Size          size,\r\n                    FT_Size_Request  req )\r\n  {\r\n    FT_Face          face    = size->face;\r\n    FT_Bitmap_Size*  bsize   = face->available_sizes;\r\n    bdf_font_t*      bdffont = ( (BDF_Face)face )->bdffont;\r\n    FT_Error         error   = BDF_Err_Invalid_Pixel_Size;\r\n    FT_Long          height;\r\n\r\n\r\n    height = FT_REQUEST_HEIGHT( req );\r\n    height = ( height + 32 ) >> 6;\r\n\r\n    switch ( req->type )\r\n    {\r\n    case FT_SIZE_REQUEST_TYPE_NOMINAL:\r\n      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )\r\n        error = BDF_Err_Ok;\r\n      break;\r\n\r\n    case FT_SIZE_REQUEST_TYPE_REAL_DIM:\r\n      if ( height == ( bdffont->font_ascent +\r\n                       bdffont->font_descent ) )\r\n        error = BDF_Err_Ok;\r\n      break;\r\n\r\n    default:\r\n      error = BDF_Err_Unimplemented_Feature;\r\n      break;\r\n    }\r\n\r\n    if ( error )\r\n      return error;\r\n    else\r\n      return BDF_Size_Select( size, 0 );\r\n  }\r\n\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  BDF_Glyph_Load( FT_GlyphSlot  slot,\r\n                  FT_Size       size,\r\n                  FT_UInt       glyph_index,\r\n                  FT_Int32      load_flags )\r\n  {\r\n    BDF_Face     bdf    = (BDF_Face)FT_SIZE_FACE( size );\r\n    FT_Face      face   = FT_FACE( bdf );\r\n    FT_Error     error  = BDF_Err_Ok;\r\n    FT_Bitmap*   bitmap = &slot->bitmap;\r\n    bdf_glyph_t  glyph;\r\n    int          bpp    = bdf->bdffont->bpp;\r\n\r\n    FT_UNUSED( load_flags );\r\n\r\n\r\n    if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )\r\n    {\r\n      error = BDF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* index 0 is the undefined glyph */\r\n    if ( glyph_index == 0 )\r\n      glyph_index = bdf->default_glyph;\r\n    else\r\n      glyph_index--;\r\n\r\n    /* slot, bitmap => freetype, glyph => bdflib */\r\n    glyph = bdf->bdffont->glyphs[glyph_index];\r\n\r\n    bitmap->rows  = glyph.bbx.height;\r\n    bitmap->width = glyph.bbx.width;\r\n    if ( glyph.bpr > INT_MAX )\r\n      FT_TRACE1(( \"BDF_Glyph_Load: too large pitch %d is truncated\\n\",\r\n                   glyph.bpr ));\r\n    bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */\r\n\r\n    /* note: we don't allocate a new array to hold the bitmap; */\r\n    /*       we can simply point to it                         */\r\n    ft_glyphslot_set_bitmap( slot, glyph.bitmap );\r\n\r\n    switch ( bpp )\r\n    {\r\n    case 1:\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_MONO;\r\n      break;\r\n    case 2:\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_GRAY2;\r\n      break;\r\n    case 4:\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_GRAY4;\r\n      break;\r\n    case 8:\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;\r\n      bitmap->num_grays  = 256;\r\n      break;\r\n    }\r\n\r\n    slot->format      = FT_GLYPH_FORMAT_BITMAP;\r\n    slot->bitmap_left = glyph.bbx.x_offset;\r\n    slot->bitmap_top  = glyph.bbx.ascent;\r\n\r\n    slot->metrics.horiAdvance  = glyph.dwidth << 6;\r\n    slot->metrics.horiBearingX = glyph.bbx.x_offset << 6;\r\n    slot->metrics.horiBearingY = glyph.bbx.ascent << 6;\r\n    slot->metrics.width        = bitmap->width << 6;\r\n    slot->metrics.height       = bitmap->rows << 6;\r\n\r\n    /*\r\n     * XXX DWIDTH1 and VVECTOR should be parsed and\r\n     * used here, provided such fonts do exist.\r\n     */\r\n    ft_synthesize_vertical_metrics( &slot->metrics,\r\n                                    bdf->bdffont->bbx.height << 6 );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n /*\r\n  *\r\n  *  BDF SERVICE\r\n  *\r\n  */\r\n\r\n  static FT_Error\r\n  bdf_get_bdf_property( BDF_Face          face,\r\n                        const char*       prop_name,\r\n                        BDF_PropertyRec  *aproperty )\r\n  {\r\n    bdf_property_t*  prop;\r\n\r\n\r\n    FT_ASSERT( face && face->bdffont );\r\n\r\n    prop = bdf_get_font_property( face->bdffont, prop_name );\r\n    if ( prop )\r\n    {\r\n      switch ( prop->format )\r\n      {\r\n      case BDF_ATOM:\r\n        aproperty->type   = BDF_PROPERTY_TYPE_ATOM;\r\n        aproperty->u.atom = prop->value.atom;\r\n        break;\r\n\r\n      case BDF_INTEGER:\r\n        if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )\r\n        {\r\n          FT_TRACE1(( \"bdf_get_bdf_property:\"\r\n                      \" too large integer 0x%x is truncated\\n\" ));\r\n        }\r\n        aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;\r\n        aproperty->u.integer = (FT_Int32)prop->value.l;\r\n        break;\r\n\r\n      case BDF_CARDINAL:\r\n        if ( prop->value.ul > 0xFFFFFFFFUL )\r\n        {\r\n          FT_TRACE1(( \"bdf_get_bdf_property:\"\r\n                      \" too large cardinal 0x%x is truncated\\n\" ));\r\n        }\r\n        aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;\r\n        aproperty->u.cardinal = (FT_UInt32)prop->value.ul;\r\n        break;\r\n\r\n      default:\r\n        goto Fail;\r\n      }\r\n      return 0;\r\n    }\r\n\r\n  Fail:\r\n    return BDF_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  bdf_get_charset_id( BDF_Face      face,\r\n                      const char*  *acharset_encoding,\r\n                      const char*  *acharset_registry )\r\n  {\r\n    *acharset_encoding = face->charset_encoding;\r\n    *acharset_registry = face->charset_registry;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static const FT_Service_BDFRec  bdf_service_bdf =\r\n  {\r\n    (FT_BDF_GetCharsetIdFunc)bdf_get_charset_id,\r\n    (FT_BDF_GetPropertyFunc) bdf_get_bdf_property\r\n  };\r\n\r\n\r\n /*\r\n  *\r\n  *  SERVICES LIST\r\n  *\r\n  */\r\n\r\n  static const FT_ServiceDescRec  bdf_services[] =\r\n  {\r\n    { FT_SERVICE_ID_BDF,       &bdf_service_bdf },\r\n    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_BDF },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  bdf_driver_requester( FT_Module    module,\r\n                        const char*  name )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( bdf_services, name );\r\n  }\r\n\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Driver_ClassRec  bdf_driver_class =\r\n  {\r\n    {\r\n      FT_MODULE_FONT_DRIVER         |\r\n      FT_MODULE_DRIVER_NO_OUTLINES,\r\n      sizeof ( FT_DriverRec ),\r\n\r\n      \"bdf\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,\r\n\r\n      0,                        /* FT_Module_Constructor */\r\n      0,                        /* FT_Module_Destructor  */\r\n      bdf_driver_requester\r\n    },\r\n\r\n    sizeof ( BDF_FaceRec ),\r\n    sizeof ( FT_SizeRec ),\r\n    sizeof ( FT_GlyphSlotRec ),\r\n\r\n    BDF_Face_Init,\r\n    BDF_Face_Done,\r\n    0,                          /* FT_Size_InitFunc */\r\n    0,                          /* FT_Size_DoneFunc */\r\n    0,                          /* FT_Slot_InitFunc */\r\n    0,                          /* FT_Slot_DoneFunc */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n    BDF_Glyph_Load,\r\n\r\n    0,                          /* FT_Face_GetKerningFunc  */\r\n    0,                          /* FT_Face_AttachFunc      */\r\n    0,                          /* FT_Face_GetAdvancesFunc */\r\n\r\n    BDF_Size_Request,\r\n    BDF_Size_Select\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/bdfdrivr.h",
    "content": "/*  bdfdrivr.h\r\n\r\n    FreeType font driver for bdf fonts\r\n\r\n  Copyright (C) 2001, 2002, 2003, 2004 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#ifndef __BDFDRIVR_H__\r\n#define __BDFDRIVR_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n#include \"bdf.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  typedef struct  BDF_encoding_el_\r\n  {\r\n    FT_ULong   enc;\r\n    FT_UShort  glyph;\r\n\r\n  } BDF_encoding_el;\r\n\r\n\r\n  typedef struct  BDF_FaceRec_\r\n  {\r\n    FT_FaceRec        root;\r\n\r\n    char*             charset_encoding;\r\n    char*             charset_registry;\r\n\r\n    bdf_font_t*       bdffont;\r\n\r\n    BDF_encoding_el*  en_table;\r\n\r\n    FT_CharMap        charmap_handle;\r\n    FT_CharMapRec     charmap;  /* a single charmap per face */\r\n\r\n    FT_UInt           default_glyph;\r\n\r\n  } BDF_FaceRec, *BDF_Face;\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Driver_ClassRec )  bdf_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __BDFDRIVR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/bdferror.h",
    "content": "/*\r\n * Copyright 2001, 2002, 2012 Francesco Zappa Nardelli\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the \"Software\"),\r\n * to deal in the Software without restriction, including without limitation\r\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n * and/or sell copies of the Software, and to permit persons to whom the\r\n * Software is furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r\n * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY\r\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT\r\n * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR\r\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the BDF error enumeration constants.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __BDFERROR_H__\r\n#define __BDFERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  BDF_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_BDF\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __BDFERROR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/bdflib.c",
    "content": "/*\r\n * Copyright 2000 Computing Research Labs, New Mexico State University\r\n * Copyright 2001-2012\r\n *   Francesco Zappa Nardelli\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the \"Software\"),\r\n * to deal in the Software without restriction, including without limitation\r\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n * and/or sell copies of the Software, and to permit persons to whom the\r\n * Software is furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r\n * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY\r\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT\r\n * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR\r\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  This file is based on bdf.c,v 1.22 2000/03/16 20:08:50               */\r\n  /*                                                                       */\r\n  /*  taken from Mark Leisher's xmbdfed package                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#include \"bdf.h\"\r\n#include \"bdferror.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_bdflib\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Default BDF font options.                                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static const bdf_options_t  _bdf_opts =\r\n  {\r\n    1,                /* Correct metrics.               */\r\n    1,                /* Preserve unencoded glyphs.     */\r\n    0,                /* Preserve comments.             */\r\n    BDF_PROPORTIONAL  /* Default spacing.               */\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Builtin BDF font properties.                                          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /* List of most properties that might appear in a font.  Doesn't include */\r\n  /* the RAW_* and AXIS_* properties in X11R6 polymorphic fonts.           */\r\n\r\n  static const bdf_property_t  _bdf_properties[] =\r\n  {\r\n    { (char *)\"ADD_STYLE_NAME\",          BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"AVERAGE_WIDTH\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"AVG_CAPITAL_WIDTH\",       BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"AVG_LOWERCASE_WIDTH\",     BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"CAP_HEIGHT\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"CHARSET_COLLECTIONS\",     BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"CHARSET_ENCODING\",        BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"CHARSET_REGISTRY\",        BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"COMMENT\",                 BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"COPYRIGHT\",               BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"DEFAULT_CHAR\",            BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"DESTINATION\",             BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"DEVICE_FONT_NAME\",        BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"END_SPACE\",               BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"FACE_NAME\",               BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"FAMILY_NAME\",             BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"FIGURE_WIDTH\",            BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"FONT\",                    BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"FONTNAME_REGISTRY\",       BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"FONT_ASCENT\",             BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"FONT_DESCENT\",            BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"FOUNDRY\",                 BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"FULL_NAME\",               BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"ITALIC_ANGLE\",            BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"MAX_SPACE\",               BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"MIN_SPACE\",               BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"NORM_SPACE\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"NOTICE\",                  BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"PIXEL_SIZE\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"POINT_SIZE\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"QUAD_WIDTH\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_ASCENT\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_AVERAGE_WIDTH\",       BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_AVG_CAPITAL_WIDTH\",   BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_AVG_LOWERCASE_WIDTH\", BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_CAP_HEIGHT\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_DESCENT\",             BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_END_SPACE\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_FIGURE_WIDTH\",        BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_MAX_SPACE\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_MIN_SPACE\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_NORM_SPACE\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_PIXEL_SIZE\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_POINT_SIZE\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_PIXELSIZE\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_POINTSIZE\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_QUAD_WIDTH\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SMALL_CAP_SIZE\",      BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_STRIKEOUT_ASCENT\",    BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_STRIKEOUT_DESCENT\",   BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SUBSCRIPT_SIZE\",      BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SUBSCRIPT_X\",         BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SUBSCRIPT_Y\",         BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SUPERSCRIPT_SIZE\",    BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SUPERSCRIPT_X\",       BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_SUPERSCRIPT_Y\",       BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_UNDERLINE_POSITION\",  BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_UNDERLINE_THICKNESS\", BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RAW_X_HEIGHT\",            BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RELATIVE_SETWIDTH\",       BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"RELATIVE_WEIGHT\",         BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"RESOLUTION\",              BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"RESOLUTION_X\",            BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"RESOLUTION_Y\",            BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"SETWIDTH_NAME\",           BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"SLANT\",                   BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"SMALL_CAP_SIZE\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SPACING\",                 BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"STRIKEOUT_ASCENT\",        BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"STRIKEOUT_DESCENT\",       BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SUBSCRIPT_SIZE\",          BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SUBSCRIPT_X\",             BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SUBSCRIPT_Y\",             BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SUPERSCRIPT_SIZE\",        BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SUPERSCRIPT_X\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"SUPERSCRIPT_Y\",           BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"UNDERLINE_POSITION\",      BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"UNDERLINE_THICKNESS\",     BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"WEIGHT\",                  BDF_CARDINAL, 1, { 0 } },\r\n    { (char *)\"WEIGHT_NAME\",             BDF_ATOM,     1, { 0 } },\r\n    { (char *)\"X_HEIGHT\",                BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"_MULE_BASELINE_OFFSET\",   BDF_INTEGER,  1, { 0 } },\r\n    { (char *)\"_MULE_RELATIVE_COMPOSE\",  BDF_INTEGER,  1, { 0 } },\r\n  };\r\n\r\n  static const unsigned long\r\n  _num_bdf_properties = sizeof ( _bdf_properties ) /\r\n                        sizeof ( _bdf_properties[0] );\r\n\r\n\r\n  /* Auto correction messages. */\r\n#define ACMSG1   \"FONT_ASCENT property missing.  \" \\\r\n                 \"Added `FONT_ASCENT %hd'.\\n\"\r\n#define ACMSG2   \"FONT_DESCENT property missing.  \" \\\r\n                 \"Added `FONT_DESCENT %hd'.\\n\"\r\n#define ACMSG3   \"Font width != actual width.  Old: %hd New: %hd.\\n\"\r\n#define ACMSG4   \"Font left bearing != actual left bearing.  \" \\\r\n                 \"Old: %hd New: %hd.\\n\"\r\n#define ACMSG5   \"Font ascent != actual ascent.  Old: %hd New: %hd.\\n\"\r\n#define ACMSG6   \"Font descent != actual descent.  Old: %hd New: %hd.\\n\"\r\n#define ACMSG7   \"Font height != actual height. Old: %hd New: %hd.\\n\"\r\n#define ACMSG8   \"Glyph scalable width (SWIDTH) adjustments made.\\n\"\r\n#define ACMSG9   \"SWIDTH field missing at line %ld.  Set automatically.\\n\"\r\n#define ACMSG10  \"DWIDTH field missing at line %ld.  Set to glyph width.\\n\"\r\n#define ACMSG11  \"SIZE bits per pixel field adjusted to %hd.\\n\"\r\n#define ACMSG12  \"Duplicate encoding %ld (%s) changed to unencoded.\\n\"\r\n#define ACMSG13  \"Glyph %ld extra rows removed.\\n\"\r\n#define ACMSG14  \"Glyph %ld extra columns removed.\\n\"\r\n#define ACMSG15  \"Incorrect glyph count: %ld indicated but %ld found.\\n\"\r\n#define ACMSG16  \"Glyph %ld missing columns padded with zero bits.\\n\"\r\n\r\n  /* Error messages. */\r\n#define ERRMSG1  \"[line %ld] Missing `%s' line.\\n\"\r\n#define ERRMSG2  \"[line %ld] Font header corrupted or missing fields.\\n\"\r\n#define ERRMSG3  \"[line %ld] Font glyphs corrupted or missing fields.\\n\"\r\n#define ERRMSG4  \"[line %ld] BBX too big.\\n\"\r\n#define ERRMSG5  \"[line %ld] `%s' value too big.\\n\"\r\n#define ERRMSG6  \"[line %ld] Input line too long.\\n\"\r\n#define ERRMSG7  \"[line %ld] Font name too long.\\n\"\r\n#define ERRMSG8  \"[line %ld] Invalid `%s' value.\\n\"\r\n#define ERRMSG9  \"[line %ld] Invalid keyword.\\n\"\r\n\r\n  /* Debug messages. */\r\n#define DBGMSG1  \"  [%6ld] %s\" /* no \\n */\r\n#define DBGMSG2  \" (0x%lX)\\n\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Hash table utilities for the properties.                              */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /* XXX: Replace this with FreeType's hash functions */\r\n\r\n\r\n#define INITIAL_HT_SIZE  241\r\n\r\n  typedef void\r\n  (*hash_free_func)( hashnode  node );\r\n\r\n  static hashnode*\r\n  hash_bucket( const char*  key,\r\n               hashtable*   ht )\r\n  {\r\n    const char*    kp  = key;\r\n    unsigned long  res = 0;\r\n    hashnode*      bp  = ht->table, *ndp;\r\n\r\n\r\n    /* Mocklisp hash function. */\r\n    while ( *kp )\r\n      res = ( res << 5 ) - res + *kp++;\r\n\r\n    ndp = bp + ( res % ht->size );\r\n    while ( *ndp )\r\n    {\r\n      kp = (*ndp)->key;\r\n      if ( kp[0] == key[0] && ft_strcmp( kp, key ) == 0 )\r\n        break;\r\n      ndp--;\r\n      if ( ndp < bp )\r\n        ndp = bp + ( ht->size - 1 );\r\n    }\r\n\r\n    return ndp;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  hash_rehash( hashtable*  ht,\r\n               FT_Memory   memory )\r\n  {\r\n    hashnode*  obp = ht->table, *bp, *nbp;\r\n    int        i, sz = ht->size;\r\n    FT_Error   error = BDF_Err_Ok;\r\n\r\n\r\n    ht->size <<= 1;\r\n    ht->limit  = ht->size / 3;\r\n\r\n    if ( FT_NEW_ARRAY( ht->table, ht->size ) )\r\n      goto Exit;\r\n\r\n    for ( i = 0, bp = obp; i < sz; i++, bp++ )\r\n    {\r\n      if ( *bp )\r\n      {\r\n        nbp = hash_bucket( (*bp)->key, ht );\r\n        *nbp = *bp;\r\n      }\r\n    }\r\n    FT_FREE( obp );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  hash_init( hashtable*  ht,\r\n             FT_Memory   memory )\r\n  {\r\n    int       sz = INITIAL_HT_SIZE;\r\n    FT_Error  error = BDF_Err_Ok;\r\n\r\n\r\n    ht->size  = sz;\r\n    ht->limit = sz / 3;\r\n    ht->used  = 0;\r\n\r\n    if ( FT_NEW_ARRAY( ht->table, sz ) )\r\n      goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  hash_free( hashtable*  ht,\r\n             FT_Memory   memory )\r\n  {\r\n    if ( ht != 0 )\r\n    {\r\n      int        i, sz = ht->size;\r\n      hashnode*  bp = ht->table;\r\n\r\n\r\n      for ( i = 0; i < sz; i++, bp++ )\r\n        FT_FREE( *bp );\r\n\r\n      FT_FREE( ht->table );\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  hash_insert( char*       key,\r\n               size_t      data,\r\n               hashtable*  ht,\r\n               FT_Memory   memory )\r\n  {\r\n    hashnode  nn, *bp = hash_bucket( key, ht );\r\n    FT_Error  error = BDF_Err_Ok;\r\n\r\n\r\n    nn = *bp;\r\n    if ( !nn )\r\n    {\r\n      if ( FT_NEW( nn ) )\r\n        goto Exit;\r\n      *bp = nn;\r\n\r\n      nn->key  = key;\r\n      nn->data = data;\r\n\r\n      if ( ht->used >= ht->limit )\r\n      {\r\n        error = hash_rehash( ht, memory );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n      ht->used++;\r\n    }\r\n    else\r\n      nn->data = data;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static hashnode\r\n  hash_lookup( const char* key,\r\n               hashtable*  ht )\r\n  {\r\n    hashnode *np = hash_bucket( key, ht );\r\n\r\n\r\n    return *np;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Utility types and functions.                                          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Function type for parsing lines of a BDF font. */\r\n\r\n  typedef FT_Error\r\n  (*_bdf_line_func_t)( char*          line,\r\n                       unsigned long  linelen,\r\n                       unsigned long  lineno,\r\n                       void*          call_data,\r\n                       void*          client_data );\r\n\r\n\r\n  /* List structure for splitting lines into fields. */\r\n\r\n  typedef struct  _bdf_list_t_\r\n  {\r\n    char**         field;\r\n    unsigned long  size;\r\n    unsigned long  used;\r\n    FT_Memory      memory;\r\n\r\n  } _bdf_list_t;\r\n\r\n\r\n  /* Structure used while loading BDF fonts. */\r\n\r\n  typedef struct  _bdf_parse_t_\r\n  {\r\n    unsigned long   flags;\r\n    unsigned long   cnt;\r\n    unsigned long   row;\r\n\r\n    short           minlb;\r\n    short           maxlb;\r\n    short           maxrb;\r\n    short           maxas;\r\n    short           maxds;\r\n\r\n    short           rbearing;\r\n\r\n    char*           glyph_name;\r\n    long            glyph_enc;\r\n\r\n    bdf_font_t*     font;\r\n    bdf_options_t*  opts;\r\n\r\n    unsigned long   have[34816]; /* must be in sync with `nmod' and `umod' */\r\n                                 /* arrays from `bdf_font_t' structure     */\r\n    _bdf_list_t     list;\r\n\r\n    FT_Memory       memory;\r\n\r\n  } _bdf_parse_t;\r\n\r\n\r\n#define setsbit( m, cc ) \\\r\n          ( m[(FT_Byte)(cc) >> 3] |= (FT_Byte)( 1 << ( (cc) & 7 ) ) )\r\n#define sbitset( m, cc ) \\\r\n          ( m[(FT_Byte)(cc) >> 3]  & ( 1 << ( (cc) & 7 ) ) )\r\n\r\n\r\n  static void\r\n  _bdf_list_init( _bdf_list_t*  list,\r\n                  FT_Memory     memory )\r\n  {\r\n    FT_ZERO( list );\r\n    list->memory = memory;\r\n  }\r\n\r\n\r\n  static void\r\n  _bdf_list_done( _bdf_list_t*  list )\r\n  {\r\n    FT_Memory  memory = list->memory;\r\n\r\n\r\n    if ( memory )\r\n    {\r\n      FT_FREE( list->field );\r\n      FT_ZERO( list );\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  _bdf_list_ensure( _bdf_list_t*   list,\r\n                    unsigned long  num_items ) /* same as _bdf_list_t.used */\r\n  {\r\n    FT_Error  error = BDF_Err_Ok;\r\n\r\n\r\n    if ( num_items > list->size )\r\n    {\r\n      unsigned long  oldsize = list->size; /* same as _bdf_list_t.size */\r\n      unsigned long  newsize = oldsize + ( oldsize >> 1 ) + 5;\r\n      unsigned long  bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );\r\n      FT_Memory      memory  = list->memory;\r\n\r\n\r\n      if ( oldsize == bigsize )\r\n      {\r\n        error = BDF_Err_Out_Of_Memory;\r\n        goto Exit;\r\n      }\r\n      else if ( newsize < oldsize || newsize > bigsize )\r\n        newsize = bigsize;\r\n\r\n      if ( FT_RENEW_ARRAY( list->field, oldsize, newsize ) )\r\n        goto Exit;\r\n\r\n      list->size = newsize;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  _bdf_list_shift( _bdf_list_t*   list,\r\n                   unsigned long  n )\r\n  {\r\n    unsigned long  i, u;\r\n\r\n\r\n    if ( list == 0 || list->used == 0 || n == 0 )\r\n      return;\r\n\r\n    if ( n >= list->used )\r\n    {\r\n      list->used = 0;\r\n      return;\r\n    }\r\n\r\n    for ( u = n, i = 0; u < list->used; i++, u++ )\r\n      list->field[i] = list->field[u];\r\n    list->used -= n;\r\n  }\r\n\r\n\r\n  /* An empty string for empty fields. */\r\n\r\n  static const char  empty[1] = { 0 };      /* XXX eliminate this */\r\n\r\n\r\n  static char *\r\n  _bdf_list_join( _bdf_list_t*    list,\r\n                  int             c,\r\n                  unsigned long  *alen )\r\n  {\r\n    unsigned long  i, j;\r\n    char           *fp, *dp;\r\n\r\n\r\n    *alen = 0;\r\n\r\n    if ( list == 0 || list->used == 0 )\r\n      return 0;\r\n\r\n    dp = list->field[0];\r\n    for ( i = j = 0; i < list->used; i++ )\r\n    {\r\n      fp = list->field[i];\r\n      while ( *fp )\r\n        dp[j++] = *fp++;\r\n\r\n      if ( i + 1 < list->used )\r\n        dp[j++] = (char)c;\r\n    }\r\n    if ( dp != empty )\r\n      dp[j] = 0;\r\n\r\n    *alen = j;\r\n    return dp;\r\n  }\r\n\r\n\r\n  /* The code below ensures that we have at least 4 + 1 `field' */\r\n  /* elements in `list' (which are possibly NULL) so that we    */\r\n  /* don't have to check the number of fields in most cases.    */\r\n\r\n  static FT_Error\r\n  _bdf_list_split( _bdf_list_t*   list,\r\n                   char*          separators,\r\n                   char*          line,\r\n                   unsigned long  linelen )\r\n  {\r\n    int       mult, final_empty;\r\n    char      *sp, *ep, *end;\r\n    char      seps[32];\r\n    FT_Error  error = BDF_Err_Ok;\r\n\r\n\r\n    /* Initialize the list. */\r\n    list->used = 0;\r\n    if ( list->size )\r\n    {\r\n      list->field[0] = (char*)empty;\r\n      list->field[1] = (char*)empty;\r\n      list->field[2] = (char*)empty;\r\n      list->field[3] = (char*)empty;\r\n      list->field[4] = (char*)empty;\r\n    }\r\n\r\n    /* If the line is empty, then simply return. */\r\n    if ( linelen == 0 || line[0] == 0 )\r\n      goto Exit;\r\n\r\n    /* In the original code, if the `separators' parameter is NULL or */\r\n    /* empty, the list is split into individual bytes.  We don't need */\r\n    /* this, so an error is signaled.                                 */\r\n    if ( separators == 0 || *separators == 0 )\r\n    {\r\n      error = BDF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Prepare the separator bitmap. */\r\n    FT_MEM_ZERO( seps, 32 );\r\n\r\n    /* If the very last character of the separator string is a plus, then */\r\n    /* set the `mult' flag to indicate that multiple separators should be */\r\n    /* collapsed into one.                                                */\r\n    for ( mult = 0, sp = separators; sp && *sp; sp++ )\r\n    {\r\n      if ( *sp == '+' && *( sp + 1 ) == 0 )\r\n        mult = 1;\r\n      else\r\n        setsbit( seps, *sp );\r\n    }\r\n\r\n    /* Break the line up into fields. */\r\n    for ( final_empty = 0, sp = ep = line, end = sp + linelen;\r\n          sp < end && *sp; )\r\n    {\r\n      /* Collect everything that is not a separator. */\r\n      for ( ; *ep && !sbitset( seps, *ep ); ep++ )\r\n        ;\r\n\r\n      /* Resize the list if necessary. */\r\n      if ( list->used == list->size )\r\n      {\r\n        error = _bdf_list_ensure( list, list->used + 1 );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n\r\n      /* Assign the field appropriately. */\r\n      list->field[list->used++] = ( ep > sp ) ? sp : (char*)empty;\r\n\r\n      sp = ep;\r\n\r\n      if ( mult )\r\n      {\r\n        /* If multiple separators should be collapsed, do it now by */\r\n        /* setting all the separator characters to 0.               */\r\n        for ( ; *ep && sbitset( seps, *ep ); ep++ )\r\n          *ep = 0;\r\n      }\r\n      else if ( *ep != 0 )\r\n        /* Don't collapse multiple separators by making them 0, so just */\r\n        /* make the one encountered 0.                                  */\r\n        *ep++ = 0;\r\n\r\n      final_empty = ( ep > sp && *ep == 0 );\r\n      sp = ep;\r\n    }\r\n\r\n    /* Finally, NULL-terminate the list. */\r\n    if ( list->used + final_empty >= list->size )\r\n    {\r\n      error = _bdf_list_ensure( list, list->used + final_empty + 1 );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( final_empty )\r\n      list->field[list->used++] = (char*)empty;\r\n\r\n    list->field[list->used] = 0;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n#define NO_SKIP  256  /* this value cannot be stored in a 'char' */\r\n\r\n\r\n  static FT_Error\r\n  _bdf_readstream( FT_Stream         stream,\r\n                   _bdf_line_func_t  callback,\r\n                   void*             client_data,\r\n                   unsigned long    *lno )\r\n  {\r\n    _bdf_line_func_t  cb;\r\n    unsigned long     lineno, buf_size;\r\n    int               refill, hold, to_skip;\r\n    ptrdiff_t         bytes, start, end, cursor, avail;\r\n    char*             buf = 0;\r\n    FT_Memory         memory = stream->memory;\r\n    FT_Error          error = BDF_Err_Ok;\r\n\r\n\r\n    if ( callback == 0 )\r\n    {\r\n      error = BDF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* initial size and allocation of the input buffer */\r\n    buf_size = 1024;\r\n\r\n    if ( FT_NEW_ARRAY( buf, buf_size ) )\r\n      goto Exit;\r\n\r\n    cb      = callback;\r\n    lineno  = 1;\r\n    buf[0]  = 0;\r\n    start   = 0;\r\n    end     = 0;\r\n    avail   = 0;\r\n    cursor  = 0;\r\n    refill  = 1;\r\n    to_skip = NO_SKIP;\r\n    bytes   = 0;        /* make compiler happy */\r\n\r\n    for (;;)\r\n    {\r\n      if ( refill )\r\n      {\r\n        bytes  = (ptrdiff_t)FT_Stream_TryRead(\r\n                   stream, (FT_Byte*)buf + cursor,\r\n                   (FT_ULong)( buf_size - cursor ) );\r\n        avail  = cursor + bytes;\r\n        cursor = 0;\r\n        refill = 0;\r\n      }\r\n\r\n      end = start;\r\n\r\n      /* should we skip an optional character like \\n or \\r? */\r\n      if ( start < avail && buf[start] == to_skip )\r\n      {\r\n        start  += 1;\r\n        to_skip = NO_SKIP;\r\n        continue;\r\n      }\r\n\r\n      /* try to find the end of the line */\r\n      while ( end < avail && buf[end] != '\\n' && buf[end] != '\\r' )\r\n        end++;\r\n\r\n      /* if we hit the end of the buffer, try shifting its content */\r\n      /* or even resizing it                                       */\r\n      if ( end >= avail )\r\n      {\r\n        if ( bytes == 0 )  /* last line in file doesn't end in \\r or \\n */\r\n          break;           /* ignore it then exit                       */\r\n\r\n        if ( start == 0 )\r\n        {\r\n          /* this line is definitely too long; try resizing the input */\r\n          /* buffer a bit to handle it.                               */\r\n          FT_ULong  new_size;\r\n\r\n\r\n          if ( buf_size >= 65536UL )  /* limit ourselves to 64KByte */\r\n          {\r\n            FT_ERROR(( \"_bdf_readstream: \" ERRMSG6, lineno ));\r\n            error = BDF_Err_Invalid_Argument;\r\n            goto Exit;\r\n          }\r\n\r\n          new_size = buf_size * 2;\r\n          if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) )\r\n            goto Exit;\r\n\r\n          cursor   = buf_size;\r\n          buf_size = new_size;\r\n        }\r\n        else\r\n        {\r\n          bytes = avail - start;\r\n\r\n          FT_MEM_COPY( buf, buf + start, bytes );\r\n\r\n          cursor = bytes;\r\n          avail -= bytes;\r\n          start  = 0;\r\n        }\r\n        refill = 1;\r\n        continue;\r\n      }\r\n\r\n      /* Temporarily NUL-terminate the line. */\r\n      hold     = buf[end];\r\n      buf[end] = 0;\r\n\r\n      /* XXX: Use encoding independent value for 0x1a */\r\n      if ( buf[start] != '#' && buf[start] != 0x1a && end > start )\r\n      {\r\n        error = (*cb)( buf + start, (unsigned long)( end - start ), lineno,\r\n                       (void*)&cb, client_data );\r\n        /* Redo if we have encountered CHARS without properties. */\r\n        if ( error == -1 )\r\n          error = (*cb)( buf + start, (unsigned long)( end - start ), lineno,\r\n                         (void*)&cb, client_data );\r\n        if ( error )\r\n          break;\r\n      }\r\n\r\n      lineno  += 1;\r\n      buf[end] = (char)hold;\r\n      start    = end + 1;\r\n\r\n      if ( hold == '\\n' )\r\n        to_skip = '\\r';\r\n      else if ( hold == '\\r' )\r\n        to_skip = '\\n';\r\n      else\r\n        to_skip = NO_SKIP;\r\n    }\r\n\r\n    *lno = lineno;\r\n\r\n  Exit:\r\n    FT_FREE( buf );\r\n    return error;\r\n  }\r\n\r\n\r\n  /* XXX: make this work with EBCDIC also */\r\n\r\n  static const unsigned char  a2i[128] =\r\n  {\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\r\n  };\r\n\r\n  static const unsigned char  odigits[32] =\r\n  {\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n  };\r\n\r\n  static const unsigned char  ddigits[32] =\r\n  {\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n  };\r\n\r\n  static const unsigned char  hdigits[32] =\r\n  {\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,\r\n    0x7e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n  };\r\n\r\n\r\n  /* Routine to convert an ASCII string into an unsigned long integer. */\r\n  static unsigned long\r\n  _bdf_atoul( char*   s,\r\n              char**  end,\r\n              int     base )\r\n  {\r\n    unsigned long         v;\r\n    const unsigned char*  dmap;\r\n\r\n\r\n    if ( s == 0 || *s == 0 )\r\n      return 0;\r\n\r\n    /* Make sure the radix is something recognizable.  Default to 10. */\r\n    switch ( base )\r\n    {\r\n    case 8:\r\n      dmap = odigits;\r\n      break;\r\n    case 16:\r\n      dmap = hdigits;\r\n      break;\r\n    default:\r\n      base = 10;\r\n      dmap = ddigits;\r\n      break;\r\n    }\r\n\r\n    /* Check for the special hex prefix. */\r\n    if ( *s == '0'                                  &&\r\n         ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )\r\n    {\r\n      base = 16;\r\n      dmap = hdigits;\r\n      s   += 2;\r\n    }\r\n\r\n    for ( v = 0; sbitset( dmap, *s ); s++ )\r\n      v = v * base + a2i[(int)*s];\r\n\r\n    if ( end != 0 )\r\n      *end = s;\r\n\r\n    return v;\r\n  }\r\n\r\n\r\n  /* Routine to convert an ASCII string into an signed long integer. */\r\n  static long\r\n  _bdf_atol( char*   s,\r\n             char**  end,\r\n             int     base )\r\n  {\r\n    long                  v, neg;\r\n    const unsigned char*  dmap;\r\n\r\n\r\n    if ( s == 0 || *s == 0 )\r\n      return 0;\r\n\r\n    /* Make sure the radix is something recognizable.  Default to 10. */\r\n    switch ( base )\r\n    {\r\n    case 8:\r\n      dmap = odigits;\r\n      break;\r\n    case 16:\r\n      dmap = hdigits;\r\n      break;\r\n    default:\r\n      base = 10;\r\n      dmap = ddigits;\r\n      break;\r\n    }\r\n\r\n    /* Check for a minus sign. */\r\n    neg = 0;\r\n    if ( *s == '-' )\r\n    {\r\n      s++;\r\n      neg = 1;\r\n    }\r\n\r\n    /* Check for the special hex prefix. */\r\n    if ( *s == '0'                                  &&\r\n         ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )\r\n    {\r\n      base = 16;\r\n      dmap = hdigits;\r\n      s   += 2;\r\n    }\r\n\r\n    for ( v = 0; sbitset( dmap, *s ); s++ )\r\n      v = v * base + a2i[(int)*s];\r\n\r\n    if ( end != 0 )\r\n      *end = s;\r\n\r\n    return ( !neg ) ? v : -v;\r\n  }\r\n\r\n\r\n  /* Routine to convert an ASCII string into an signed short integer. */\r\n  static short\r\n  _bdf_atos( char*   s,\r\n             char**  end,\r\n             int     base )\r\n  {\r\n    short                 v, neg;\r\n    const unsigned char*  dmap;\r\n\r\n\r\n    if ( s == 0 || *s == 0 )\r\n      return 0;\r\n\r\n    /* Make sure the radix is something recognizable.  Default to 10. */\r\n    switch ( base )\r\n    {\r\n    case 8:\r\n      dmap = odigits;\r\n      break;\r\n    case 16:\r\n      dmap = hdigits;\r\n      break;\r\n    default:\r\n      base = 10;\r\n      dmap = ddigits;\r\n      break;\r\n    }\r\n\r\n    /* Check for a minus. */\r\n    neg = 0;\r\n    if ( *s == '-' )\r\n    {\r\n      s++;\r\n      neg = 1;\r\n    }\r\n\r\n    /* Check for the special hex prefix. */\r\n    if ( *s == '0'                                  &&\r\n         ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )\r\n    {\r\n      base = 16;\r\n      dmap = hdigits;\r\n      s   += 2;\r\n    }\r\n\r\n    for ( v = 0; sbitset( dmap, *s ); s++ )\r\n      v = (short)( v * base + a2i[(int)*s] );\r\n\r\n    if ( end != 0 )\r\n      *end = s;\r\n\r\n    return (short)( ( !neg ) ? v : -v );\r\n  }\r\n\r\n\r\n  /* Routine to compare two glyphs by encoding so they can be sorted. */\r\n  static int\r\n  by_encoding( const void*  a,\r\n               const void*  b )\r\n  {\r\n    bdf_glyph_t  *c1, *c2;\r\n\r\n\r\n    c1 = (bdf_glyph_t *)a;\r\n    c2 = (bdf_glyph_t *)b;\r\n\r\n    if ( c1->encoding < c2->encoding )\r\n      return -1;\r\n\r\n    if ( c1->encoding > c2->encoding )\r\n      return 1;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  bdf_create_property( char*        name,\r\n                       int          format,\r\n                       bdf_font_t*  font )\r\n  {\r\n    size_t           n;\r\n    bdf_property_t*  p;\r\n    FT_Memory        memory = font->memory;\r\n    FT_Error         error = BDF_Err_Ok;\r\n\r\n\r\n    /* First check whether the property has        */\r\n    /* already been added or not.  If it has, then */\r\n    /* simply ignore it.                           */\r\n    if ( hash_lookup( name, &(font->proptbl) ) )\r\n      goto Exit;\r\n\r\n    if ( FT_RENEW_ARRAY( font->user_props,\r\n                         font->nuser_props,\r\n                         font->nuser_props + 1 ) )\r\n      goto Exit;\r\n\r\n    p = font->user_props + font->nuser_props;\r\n    FT_ZERO( p );\r\n\r\n    n = ft_strlen( name ) + 1;\r\n    if ( n > FT_ULONG_MAX )\r\n      return BDF_Err_Invalid_Argument;\r\n\r\n    if ( FT_NEW_ARRAY( p->name, n ) )\r\n      goto Exit;\r\n\r\n    FT_MEM_COPY( (char *)p->name, name, n );\r\n\r\n    p->format  = format;\r\n    p->builtin = 0;\r\n\r\n    n = _num_bdf_properties + font->nuser_props;\r\n\r\n    error = hash_insert( p->name, n, &(font->proptbl), memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    font->nuser_props++;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( bdf_property_t * )\r\n  bdf_get_property( char*        name,\r\n                    bdf_font_t*  font )\r\n  {\r\n    hashnode  hn;\r\n    size_t    propid;\r\n\r\n\r\n    if ( name == 0 || *name == 0 )\r\n      return 0;\r\n\r\n    if ( ( hn = hash_lookup( name, &(font->proptbl) ) ) == 0 )\r\n      return 0;\r\n\r\n    propid = hn->data;\r\n    if ( propid >= _num_bdf_properties )\r\n      return font->user_props + ( propid - _num_bdf_properties );\r\n\r\n    return (bdf_property_t*)_bdf_properties + propid;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* BDF font file parsing flags and functions.                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Parse flags. */\r\n\r\n#define _BDF_START      0x0001\r\n#define _BDF_FONT_NAME  0x0002\r\n#define _BDF_SIZE       0x0004\r\n#define _BDF_FONT_BBX   0x0008\r\n#define _BDF_PROPS      0x0010\r\n#define _BDF_GLYPHS     0x0020\r\n#define _BDF_GLYPH      0x0040\r\n#define _BDF_ENCODING   0x0080\r\n#define _BDF_SWIDTH     0x0100\r\n#define _BDF_DWIDTH     0x0200\r\n#define _BDF_BBX        0x0400\r\n#define _BDF_BITMAP     0x0800\r\n\r\n#define _BDF_SWIDTH_ADJ  0x1000\r\n\r\n#define _BDF_GLYPH_BITS ( _BDF_GLYPH    | \\\r\n                          _BDF_ENCODING | \\\r\n                          _BDF_SWIDTH   | \\\r\n                          _BDF_DWIDTH   | \\\r\n                          _BDF_BBX      | \\\r\n                          _BDF_BITMAP   )\r\n\r\n#define _BDF_GLYPH_WIDTH_CHECK   0x40000000UL\r\n#define _BDF_GLYPH_HEIGHT_CHECK  0x80000000UL\r\n\r\n\r\n  static FT_Error\r\n  _bdf_add_comment( bdf_font_t*    font,\r\n                    char*          comment,\r\n                    unsigned long  len )\r\n  {\r\n    char*      cp;\r\n    FT_Memory  memory = font->memory;\r\n    FT_Error   error = BDF_Err_Ok;\r\n\r\n\r\n    if ( FT_RENEW_ARRAY( font->comments,\r\n                         font->comments_len,\r\n                         font->comments_len + len + 1 ) )\r\n      goto Exit;\r\n\r\n    cp = font->comments + font->comments_len;\r\n\r\n    FT_MEM_COPY( cp, comment, len );\r\n    cp[len] = '\\n';\r\n\r\n    font->comments_len += len + 1;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Set the spacing from the font name if it exists, or set it to the */\r\n  /* default specified in the options.                                 */\r\n  static FT_Error\r\n  _bdf_set_default_spacing( bdf_font_t*     font,\r\n                            bdf_options_t*  opts,\r\n                            unsigned long   lineno )\r\n  {\r\n    size_t       len;\r\n    char         name[256];\r\n    _bdf_list_t  list;\r\n    FT_Memory    memory;\r\n    FT_Error     error = BDF_Err_Ok;\r\n\r\n\r\n    if ( font == 0 || font->name == 0 || font->name[0] == 0 )\r\n    {\r\n      error = BDF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    memory = font->memory;\r\n\r\n    _bdf_list_init( &list, memory );\r\n\r\n    font->spacing = opts->font_spacing;\r\n\r\n    len = ft_strlen( font->name ) + 1;\r\n    /* Limit ourselves to 256 characters in the font name. */\r\n    if ( len >= 256 )\r\n    {\r\n      FT_ERROR(( \"_bdf_set_default_spacing: \" ERRMSG7, lineno ));\r\n      error = BDF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_MEM_COPY( name, font->name, len );\r\n\r\n    error = _bdf_list_split( &list, (char *)\"-\", name, len );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    if ( list.used == 15 )\r\n    {\r\n      switch ( list.field[11][0] )\r\n      {\r\n      case 'C':\r\n      case 'c':\r\n        font->spacing = BDF_CHARCELL;\r\n        break;\r\n      case 'M':\r\n      case 'm':\r\n        font->spacing = BDF_MONOWIDTH;\r\n        break;\r\n      case 'P':\r\n      case 'p':\r\n        font->spacing = BDF_PROPORTIONAL;\r\n        break;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    _bdf_list_done( &list );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Determine whether the property is an atom or not.  If it is, then */\r\n  /* clean it up so the double quotes are removed if they exist.       */\r\n  static int\r\n  _bdf_is_atom( char*          line,\r\n                unsigned long  linelen,\r\n                char**         name,\r\n                char**         value,\r\n                bdf_font_t*    font )\r\n  {\r\n    int              hold;\r\n    char             *sp, *ep;\r\n    bdf_property_t*  p;\r\n\r\n\r\n    *name = sp = ep = line;\r\n\r\n    while ( *ep && *ep != ' ' && *ep != '\\t' )\r\n      ep++;\r\n\r\n    hold = -1;\r\n    if ( *ep )\r\n    {\r\n      hold = *ep;\r\n      *ep  = 0;\r\n    }\r\n\r\n    p = bdf_get_property( sp, font );\r\n\r\n    /* Restore the character that was saved before any return can happen. */\r\n    if ( hold != -1 )\r\n      *ep = (char)hold;\r\n\r\n    /* If the property exists and is not an atom, just return here. */\r\n    if ( p && p->format != BDF_ATOM )\r\n      return 0;\r\n\r\n    /* The property is an atom.  Trim all leading and trailing whitespace */\r\n    /* and double quotes for the atom value.                              */\r\n    sp = ep;\r\n    ep = line + linelen;\r\n\r\n    /* Trim the leading whitespace if it exists. */\r\n    if ( *sp )\r\n      *sp++ = 0;\r\n    while ( *sp                           &&\r\n            ( *sp == ' ' || *sp == '\\t' ) )\r\n      sp++;\r\n\r\n    /* Trim the leading double quote if it exists. */\r\n    if ( *sp == '\"' )\r\n      sp++;\r\n    *value = sp;\r\n\r\n    /* Trim the trailing whitespace if it exists. */\r\n    while ( ep > sp                                       &&\r\n            ( *( ep - 1 ) == ' ' || *( ep - 1 ) == '\\t' ) )\r\n      *--ep = 0;\r\n\r\n    /* Trim the trailing double quote if it exists. */\r\n    if ( ep > sp && *( ep - 1 ) == '\"' )\r\n      *--ep = 0;\r\n\r\n    return 1;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  _bdf_add_property( bdf_font_t*    font,\r\n                     char*          name,\r\n                     char*          value,\r\n                     unsigned long  lineno )\r\n  {\r\n    size_t          propid;\r\n    hashnode        hn;\r\n    bdf_property_t  *prop, *fp;\r\n    FT_Memory       memory = font->memory;\r\n    FT_Error        error = BDF_Err_Ok;\r\n\r\n\r\n    /* First, check whether the property already exists in the font. */\r\n    if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 )\r\n    {\r\n      /* The property already exists in the font, so simply replace */\r\n      /* the value of the property with the current value.          */\r\n      fp = font->props + hn->data;\r\n\r\n      switch ( fp->format )\r\n      {\r\n      case BDF_ATOM:\r\n        /* Delete the current atom if it exists. */\r\n        FT_FREE( fp->value.atom );\r\n\r\n        if ( value && value[0] != 0 )\r\n        {\r\n          if ( FT_STRDUP( fp->value.atom, value ) )\r\n            goto Exit;\r\n        }\r\n        break;\r\n\r\n      case BDF_INTEGER:\r\n        fp->value.l = _bdf_atol( value, 0, 10 );\r\n        break;\r\n\r\n      case BDF_CARDINAL:\r\n        fp->value.ul = _bdf_atoul( value, 0, 10 );\r\n        break;\r\n\r\n      default:\r\n        ;\r\n      }\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* See whether this property type exists yet or not. */\r\n    /* If not, create it.                                */\r\n    hn = hash_lookup( name, &(font->proptbl) );\r\n    if ( hn == 0 )\r\n    {\r\n      error = bdf_create_property( name, BDF_ATOM, font );\r\n      if ( error )\r\n        goto Exit;\r\n      hn = hash_lookup( name, &(font->proptbl) );\r\n    }\r\n\r\n    /* Allocate another property if this is overflow. */\r\n    if ( font->props_used == font->props_size )\r\n    {\r\n      if ( font->props_size == 0 )\r\n      {\r\n        if ( FT_NEW_ARRAY( font->props, 1 ) )\r\n          goto Exit;\r\n      }\r\n      else\r\n      {\r\n        if ( FT_RENEW_ARRAY( font->props,\r\n                             font->props_size,\r\n                             font->props_size + 1 ) )\r\n          goto Exit;\r\n      }\r\n\r\n      fp = font->props + font->props_size;\r\n      FT_MEM_ZERO( fp, sizeof ( bdf_property_t ) );\r\n      font->props_size++;\r\n    }\r\n\r\n    propid = hn->data;\r\n    if ( propid >= _num_bdf_properties )\r\n      prop = font->user_props + ( propid - _num_bdf_properties );\r\n    else\r\n      prop = (bdf_property_t*)_bdf_properties + propid;\r\n\r\n    fp = font->props + font->props_used;\r\n\r\n    fp->name    = prop->name;\r\n    fp->format  = prop->format;\r\n    fp->builtin = prop->builtin;\r\n\r\n    switch ( prop->format )\r\n    {\r\n    case BDF_ATOM:\r\n      fp->value.atom = 0;\r\n      if ( value != 0 && value[0] )\r\n      {\r\n        if ( FT_STRDUP( fp->value.atom, value ) )\r\n          goto Exit;\r\n      }\r\n      break;\r\n\r\n    case BDF_INTEGER:\r\n      fp->value.l = _bdf_atol( value, 0, 10 );\r\n      break;\r\n\r\n    case BDF_CARDINAL:\r\n      fp->value.ul = _bdf_atoul( value, 0, 10 );\r\n      break;\r\n    }\r\n\r\n    /* If the property happens to be a comment, then it doesn't need */\r\n    /* to be added to the internal hash table.                       */\r\n    if ( ft_memcmp( name, \"COMMENT\", 7 ) != 0 )\r\n    {\r\n      /* Add the property to the font property table. */\r\n      error = hash_insert( fp->name,\r\n                           font->props_used,\r\n                           (hashtable *)font->internal,\r\n                           memory );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    font->props_used++;\r\n\r\n    /* Some special cases need to be handled here.  The DEFAULT_CHAR       */\r\n    /* property needs to be located if it exists in the property list, the */\r\n    /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are        */\r\n    /* present, and the SPACING property should override the default       */\r\n    /* spacing.                                                            */\r\n    if ( ft_memcmp( name, \"DEFAULT_CHAR\", 12 ) == 0 )\r\n      font->default_char = fp->value.l;\r\n    else if ( ft_memcmp( name, \"FONT_ASCENT\", 11 ) == 0 )\r\n      font->font_ascent = fp->value.l;\r\n    else if ( ft_memcmp( name, \"FONT_DESCENT\", 12 ) == 0 )\r\n      font->font_descent = fp->value.l;\r\n    else if ( ft_memcmp( name, \"SPACING\", 7 ) == 0 )\r\n    {\r\n      if ( !fp->value.atom )\r\n      {\r\n        FT_ERROR(( \"_bdf_add_property: \" ERRMSG8, lineno, \"SPACING\" ));\r\n        error = BDF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' )\r\n        font->spacing = BDF_PROPORTIONAL;\r\n      else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' )\r\n        font->spacing = BDF_MONOWIDTH;\r\n      else if ( fp->value.atom[0] == 'c' || fp->value.atom[0] == 'C' )\r\n        font->spacing = BDF_CHARCELL;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static const unsigned char nibble_mask[8] =\r\n  {\r\n    0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE\r\n  };\r\n\r\n\r\n  /* Actually parse the glyph info and bitmaps. */\r\n  static FT_Error\r\n  _bdf_parse_glyphs( char*          line,\r\n                     unsigned long  linelen,\r\n                     unsigned long  lineno,\r\n                     void*          call_data,\r\n                     void*          client_data )\r\n  {\r\n    int                c, mask_index;\r\n    char*              s;\r\n    unsigned char*     bp;\r\n    unsigned long      i, slen, nibbles;\r\n\r\n    _bdf_parse_t*      p;\r\n    bdf_glyph_t*       glyph;\r\n    bdf_font_t*        font;\r\n\r\n    FT_Memory          memory;\r\n    FT_Error           error = BDF_Err_Ok;\r\n\r\n    FT_UNUSED( call_data );\r\n    FT_UNUSED( lineno );        /* only used in debug mode */\r\n\r\n\r\n    p = (_bdf_parse_t *)client_data;\r\n\r\n    font   = p->font;\r\n    memory = font->memory;\r\n\r\n    /* Check for a comment. */\r\n    if ( ft_memcmp( line, \"COMMENT\", 7 ) == 0 )\r\n    {\r\n      linelen -= 7;\r\n\r\n      s = line + 7;\r\n      if ( *s != 0 )\r\n      {\r\n        s++;\r\n        linelen--;\r\n      }\r\n      error = _bdf_add_comment( p->font, s, linelen );\r\n      goto Exit;\r\n    }\r\n\r\n    /* The very first thing expected is the number of glyphs. */\r\n    if ( !( p->flags & _BDF_GLYPHS ) )\r\n    {\r\n      if ( ft_memcmp( line, \"CHARS\", 5 ) != 0 )\r\n      {\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG1, lineno, \"CHARS\" ));\r\n        error = BDF_Err_Missing_Chars_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n      p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1], 0, 10 );\r\n\r\n      /* Make sure the number of glyphs is non-zero. */\r\n      if ( p->cnt == 0 )\r\n        font->glyphs_size = 64;\r\n\r\n      /* Limit ourselves to 1,114,112 glyphs in the font (this is the */\r\n      /* number of code points available in Unicode).                 */\r\n      if ( p->cnt >= 0x110000UL )\r\n      {\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG5, lineno, \"CHARS\" ));\r\n        error = BDF_Err_Invalid_Argument;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( FT_NEW_ARRAY( font->glyphs, font->glyphs_size ) )\r\n        goto Exit;\r\n\r\n      p->flags |= _BDF_GLYPHS;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the ENDFONT field. */\r\n    if ( ft_memcmp( line, \"ENDFONT\", 7 ) == 0 )\r\n    {\r\n      /* Sort the glyphs by encoding. */\r\n      ft_qsort( (char *)font->glyphs,\r\n                font->glyphs_used,\r\n                sizeof ( bdf_glyph_t ),\r\n                by_encoding );\r\n\r\n      p->flags &= ~_BDF_START;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the ENDCHAR field. */\r\n    if ( ft_memcmp( line, \"ENDCHAR\", 7 ) == 0 )\r\n    {\r\n      p->glyph_enc = 0;\r\n      p->flags    &= ~_BDF_GLYPH_BITS;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check whether a glyph is being scanned but should be */\r\n    /* ignored because it is an unencoded glyph.            */\r\n    if ( ( p->flags & _BDF_GLYPH )     &&\r\n         p->glyph_enc            == -1 &&\r\n         p->opts->keep_unencoded == 0  )\r\n      goto Exit;\r\n\r\n    /* Check for the STARTCHAR field. */\r\n    if ( ft_memcmp( line, \"STARTCHAR\", 9 ) == 0 )\r\n    {\r\n      /* Set the character name in the parse info first until the */\r\n      /* encoding can be checked for an unencoded character.      */\r\n      FT_FREE( p->glyph_name );\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      _bdf_list_shift( &p->list, 1 );\r\n\r\n      s = _bdf_list_join( &p->list, ' ', &slen );\r\n\r\n      if ( !s )\r\n      {\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG8, lineno, \"STARTCHAR\" ));\r\n        error = BDF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( FT_NEW_ARRAY( p->glyph_name, slen + 1 ) )\r\n        goto Exit;\r\n\r\n      FT_MEM_COPY( p->glyph_name, s, slen + 1 );\r\n\r\n      p->flags |= _BDF_GLYPH;\r\n\r\n      FT_TRACE4(( DBGMSG1, lineno, s ));\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the ENCODING field. */\r\n    if ( ft_memcmp( line, \"ENCODING\", 8 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_GLYPH ) )\r\n      {\r\n        /* Missing STARTCHAR field. */\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG1, lineno, \"STARTCHAR\" ));\r\n        error = BDF_Err_Missing_Startchar_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );\r\n\r\n      /* Normalize negative encoding values.  The specification only */\r\n      /* allows -1, but we can be more generous here.                */\r\n      if ( p->glyph_enc < -1 )\r\n        p->glyph_enc = -1;\r\n\r\n      /* Check for alternative encoding format. */\r\n      if ( p->glyph_enc == -1 && p->list.used > 2 )\r\n        p->glyph_enc = _bdf_atol( p->list.field[2], 0, 10 );\r\n\r\n      if ( p->glyph_enc < -1 )\r\n        p->glyph_enc = -1;\r\n\r\n      FT_TRACE4(( DBGMSG2, p->glyph_enc ));\r\n\r\n      /* Check that the encoding is in the Unicode range because  */\r\n      /* otherwise p->have (a bitmap with static size) overflows. */\r\n      if ( p->glyph_enc > 0                                      &&\r\n           (size_t)p->glyph_enc >= sizeof ( p->have ) /\r\n                                   sizeof ( unsigned long ) * 32 )\r\n      {\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG5, lineno, \"ENCODING\" ));\r\n        error = BDF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      /* Check whether this encoding has already been encountered. */\r\n      /* If it has then change it to unencoded so it gets added if */\r\n      /* indicated.                                                */\r\n      if ( p->glyph_enc >= 0 )\r\n      {\r\n        if ( _bdf_glyph_modified( p->have, p->glyph_enc ) )\r\n        {\r\n          /* Emit a message saying a glyph has been moved to the */\r\n          /* unencoded area.                                     */\r\n          FT_TRACE2(( \"_bdf_parse_glyphs: \" ACMSG12,\r\n                      p->glyph_enc, p->glyph_name ));\r\n          p->glyph_enc = -1;\r\n          font->modified = 1;\r\n        }\r\n        else\r\n          _bdf_set_glyph_modified( p->have, p->glyph_enc );\r\n      }\r\n\r\n      if ( p->glyph_enc >= 0 )\r\n      {\r\n        /* Make sure there are enough glyphs allocated in case the */\r\n        /* number of characters happen to be wrong.                */\r\n        if ( font->glyphs_used == font->glyphs_size )\r\n        {\r\n          if ( FT_RENEW_ARRAY( font->glyphs,\r\n                               font->glyphs_size,\r\n                               font->glyphs_size + 64 ) )\r\n            goto Exit;\r\n\r\n          font->glyphs_size += 64;\r\n        }\r\n\r\n        glyph           = font->glyphs + font->glyphs_used++;\r\n        glyph->name     = p->glyph_name;\r\n        glyph->encoding = p->glyph_enc;\r\n\r\n        /* Reset the initial glyph info. */\r\n        p->glyph_name = 0;\r\n      }\r\n      else\r\n      {\r\n        /* Unencoded glyph.  Check whether it should */\r\n        /* be added or not.                          */\r\n        if ( p->opts->keep_unencoded != 0 )\r\n        {\r\n          /* Allocate the next unencoded glyph. */\r\n          if ( font->unencoded_used == font->unencoded_size )\r\n          {\r\n            if ( FT_RENEW_ARRAY( font->unencoded ,\r\n                                 font->unencoded_size,\r\n                                 font->unencoded_size + 4 ) )\r\n              goto Exit;\r\n\r\n            font->unencoded_size += 4;\r\n          }\r\n\r\n          glyph           = font->unencoded + font->unencoded_used;\r\n          glyph->name     = p->glyph_name;\r\n          glyph->encoding = font->unencoded_used++;\r\n        }\r\n        else\r\n          /* Free up the glyph name if the unencoded shouldn't be */\r\n          /* kept.                                                */\r\n          FT_FREE( p->glyph_name );\r\n\r\n        p->glyph_name = 0;\r\n      }\r\n\r\n      /* Clear the flags that might be added when width and height are */\r\n      /* checked for consistency.                                      */\r\n      p->flags &= ~( _BDF_GLYPH_WIDTH_CHECK | _BDF_GLYPH_HEIGHT_CHECK );\r\n\r\n      p->flags |= _BDF_ENCODING;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Point at the glyph being constructed. */\r\n    if ( p->glyph_enc == -1 )\r\n      glyph = font->unencoded + ( font->unencoded_used - 1 );\r\n    else\r\n      glyph = font->glyphs + ( font->glyphs_used - 1 );\r\n\r\n    /* Check whether a bitmap is being constructed. */\r\n    if ( p->flags & _BDF_BITMAP )\r\n    {\r\n      /* If there are more rows than are specified in the glyph metrics, */\r\n      /* ignore the remaining lines.                                     */\r\n      if ( p->row >= (unsigned long)glyph->bbx.height )\r\n      {\r\n        if ( !( p->flags & _BDF_GLYPH_HEIGHT_CHECK ) )\r\n        {\r\n          FT_TRACE2(( \"_bdf_parse_glyphs: \" ACMSG13, glyph->encoding ));\r\n          p->flags |= _BDF_GLYPH_HEIGHT_CHECK;\r\n          font->modified = 1;\r\n        }\r\n\r\n        goto Exit;\r\n      }\r\n\r\n      /* Only collect the number of nibbles indicated by the glyph     */\r\n      /* metrics.  If there are more columns, they are simply ignored. */\r\n      nibbles = glyph->bpr << 1;\r\n      bp      = glyph->bitmap + p->row * glyph->bpr;\r\n\r\n      for ( i = 0; i < nibbles; i++ )\r\n      {\r\n        c = line[i];\r\n        if ( !sbitset( hdigits, c ) )\r\n          break;\r\n        *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );\r\n        if ( i + 1 < nibbles && ( i & 1 ) )\r\n          *++bp = 0;\r\n      }\r\n\r\n      /* If any line has not enough columns,            */\r\n      /* indicate they have been padded with zero bits. */\r\n      if ( i < nibbles                            &&\r\n           !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )\r\n      {\r\n        FT_TRACE2(( \"_bdf_parse_glyphs: \" ACMSG16, glyph->encoding ));\r\n        p->flags       |= _BDF_GLYPH_WIDTH_CHECK;\r\n        font->modified  = 1;\r\n      }\r\n\r\n      /* Remove possible garbage at the right. */\r\n      mask_index = ( glyph->bbx.width * p->font->bpp ) & 7;\r\n      if ( glyph->bbx.width )\r\n        *bp &= nibble_mask[mask_index];\r\n\r\n      /* If any line has extra columns, indicate they have been removed. */\r\n      if ( i == nibbles                           &&\r\n           sbitset( hdigits, line[nibbles] )      &&\r\n           !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )\r\n      {\r\n        FT_TRACE2(( \"_bdf_parse_glyphs: \" ACMSG14, glyph->encoding ));\r\n        p->flags       |= _BDF_GLYPH_WIDTH_CHECK;\r\n        font->modified  = 1;\r\n      }\r\n\r\n      p->row++;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Expect the SWIDTH (scalable width) field next. */\r\n    if ( ft_memcmp( line, \"SWIDTH\", 6 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_ENCODING ) )\r\n        goto Missing_Encoding;\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      glyph->swidth = (unsigned short)_bdf_atoul( p->list.field[1], 0, 10 );\r\n      p->flags |= _BDF_SWIDTH;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Expect the DWIDTH (scalable width) field next. */\r\n    if ( ft_memcmp( line, \"DWIDTH\", 6 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_ENCODING ) )\r\n        goto Missing_Encoding;\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      glyph->dwidth = (unsigned short)_bdf_atoul( p->list.field[1], 0, 10 );\r\n\r\n      if ( !( p->flags & _BDF_SWIDTH ) )\r\n      {\r\n        /* Missing SWIDTH field.  Emit an auto correction message and set */\r\n        /* the scalable width from the device width.                      */\r\n        FT_TRACE2(( \"_bdf_parse_glyphs: \" ACMSG9, lineno ));\r\n\r\n        glyph->swidth = (unsigned short)FT_MulDiv(\r\n                          glyph->dwidth, 72000L,\r\n                          (FT_Long)( font->point_size *\r\n                                     font->resolution_x ) );\r\n      }\r\n\r\n      p->flags |= _BDF_DWIDTH;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Expect the BBX field next. */\r\n    if ( ft_memcmp( line, \"BBX\", 3 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_ENCODING ) )\r\n        goto Missing_Encoding;\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      glyph->bbx.width    = _bdf_atos( p->list.field[1], 0, 10 );\r\n      glyph->bbx.height   = _bdf_atos( p->list.field[2], 0, 10 );\r\n      glyph->bbx.x_offset = _bdf_atos( p->list.field[3], 0, 10 );\r\n      glyph->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 );\r\n\r\n      /* Generate the ascent and descent of the character. */\r\n      glyph->bbx.ascent  = (short)( glyph->bbx.height + glyph->bbx.y_offset );\r\n      glyph->bbx.descent = (short)( -glyph->bbx.y_offset );\r\n\r\n      /* Determine the overall font bounding box as the characters are */\r\n      /* loaded so corrections can be done later if indicated.         */\r\n      p->maxas    = (short)FT_MAX( glyph->bbx.ascent, p->maxas );\r\n      p->maxds    = (short)FT_MAX( glyph->bbx.descent, p->maxds );\r\n\r\n      p->rbearing = (short)( glyph->bbx.width + glyph->bbx.x_offset );\r\n\r\n      p->maxrb    = (short)FT_MAX( p->rbearing, p->maxrb );\r\n      p->minlb    = (short)FT_MIN( glyph->bbx.x_offset, p->minlb );\r\n      p->maxlb    = (short)FT_MAX( glyph->bbx.x_offset, p->maxlb );\r\n\r\n      if ( !( p->flags & _BDF_DWIDTH ) )\r\n      {\r\n        /* Missing DWIDTH field.  Emit an auto correction message and set */\r\n        /* the device width to the glyph width.                           */\r\n        FT_TRACE2(( \"_bdf_parse_glyphs: \" ACMSG10, lineno ));\r\n        glyph->dwidth = glyph->bbx.width;\r\n      }\r\n\r\n      /* If the BDF_CORRECT_METRICS flag is set, then adjust the SWIDTH */\r\n      /* value if necessary.                                            */\r\n      if ( p->opts->correct_metrics != 0 )\r\n      {\r\n        /* Determine the point size of the glyph. */\r\n        unsigned short  sw = (unsigned short)FT_MulDiv(\r\n                               glyph->dwidth, 72000L,\r\n                               (FT_Long)( font->point_size *\r\n                                          font->resolution_x ) );\r\n\r\n\r\n        if ( sw != glyph->swidth )\r\n        {\r\n          glyph->swidth = sw;\r\n\r\n          if ( p->glyph_enc == -1 )\r\n            _bdf_set_glyph_modified( font->umod,\r\n                                     font->unencoded_used - 1 );\r\n          else\r\n            _bdf_set_glyph_modified( font->nmod, glyph->encoding );\r\n\r\n          p->flags       |= _BDF_SWIDTH_ADJ;\r\n          font->modified  = 1;\r\n        }\r\n      }\r\n\r\n      p->flags |= _BDF_BBX;\r\n      goto Exit;\r\n    }\r\n\r\n    /* And finally, gather up the bitmap. */\r\n    if ( ft_memcmp( line, \"BITMAP\", 6 ) == 0 )\r\n    {\r\n      unsigned long  bitmap_size;\r\n\r\n\r\n      if ( !( p->flags & _BDF_BBX ) )\r\n      {\r\n        /* Missing BBX field. */\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG1, lineno, \"BBX\" ));\r\n        error = BDF_Err_Missing_Bbx_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      /* Allocate enough space for the bitmap. */\r\n      glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3;\r\n\r\n      bitmap_size = glyph->bpr * glyph->bbx.height;\r\n      if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU )\r\n      {\r\n        FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG4, lineno ));\r\n        error = BDF_Err_Bbx_Too_Big;\r\n        goto Exit;\r\n      }\r\n      else\r\n        glyph->bytes = (unsigned short)bitmap_size;\r\n\r\n      if ( FT_NEW_ARRAY( glyph->bitmap, glyph->bytes ) )\r\n        goto Exit;\r\n\r\n      p->row    = 0;\r\n      p->flags |= _BDF_BITMAP;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG9, lineno ));\r\n    error = BDF_Err_Invalid_File_Format;\r\n    goto Exit;\r\n\r\n  Missing_Encoding:\r\n    /* Missing ENCODING field. */\r\n    FT_ERROR(( \"_bdf_parse_glyphs: \" ERRMSG1, lineno, \"ENCODING\" ));\r\n    error = BDF_Err_Missing_Encoding_Field;\r\n\r\n  Exit:\r\n    if ( error && ( p->flags & _BDF_GLYPH ) )\r\n      FT_FREE( p->glyph_name );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Load the font properties. */\r\n  static FT_Error\r\n  _bdf_parse_properties( char*          line,\r\n                         unsigned long  linelen,\r\n                         unsigned long  lineno,\r\n                         void*          call_data,\r\n                         void*          client_data )\r\n  {\r\n    unsigned long      vlen;\r\n    _bdf_line_func_t*  next;\r\n    _bdf_parse_t*      p;\r\n    char*              name;\r\n    char*              value;\r\n    char               nbuf[128];\r\n    FT_Error           error = BDF_Err_Ok;\r\n\r\n    FT_UNUSED( lineno );\r\n\r\n\r\n    next = (_bdf_line_func_t *)call_data;\r\n    p    = (_bdf_parse_t *)    client_data;\r\n\r\n    /* Check for the end of the properties. */\r\n    if ( ft_memcmp( line, \"ENDPROPERTIES\", 13 ) == 0 )\r\n    {\r\n      /* If the FONT_ASCENT or FONT_DESCENT properties have not been      */\r\n      /* encountered yet, then make sure they are added as properties and */\r\n      /* make sure they are set from the font bounding box info.          */\r\n      /*                                                                  */\r\n      /* This is *always* done regardless of the options, because X11     */\r\n      /* requires these two fields to compile fonts.                      */\r\n      if ( bdf_get_font_property( p->font, \"FONT_ASCENT\" ) == 0 )\r\n      {\r\n        p->font->font_ascent = p->font->bbx.ascent;\r\n        ft_sprintf( nbuf, \"%hd\", p->font->bbx.ascent );\r\n        error = _bdf_add_property( p->font, (char *)\"FONT_ASCENT\",\r\n                                   nbuf, lineno );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        FT_TRACE2(( \"_bdf_parse_properties: \" ACMSG1, p->font->bbx.ascent ));\r\n        p->font->modified = 1;\r\n      }\r\n\r\n      if ( bdf_get_font_property( p->font, \"FONT_DESCENT\" ) == 0 )\r\n      {\r\n        p->font->font_descent = p->font->bbx.descent;\r\n        ft_sprintf( nbuf, \"%hd\", p->font->bbx.descent );\r\n        error = _bdf_add_property( p->font, (char *)\"FONT_DESCENT\",\r\n                                   nbuf, lineno );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        FT_TRACE2(( \"_bdf_parse_properties: \" ACMSG2, p->font->bbx.descent ));\r\n        p->font->modified = 1;\r\n      }\r\n\r\n      p->flags &= ~_BDF_PROPS;\r\n      *next     = _bdf_parse_glyphs;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Ignore the _XFREE86_GLYPH_RANGES properties. */\r\n    if ( ft_memcmp( line, \"_XFREE86_GLYPH_RANGES\", 21 ) == 0 )\r\n      goto Exit;\r\n\r\n    /* Handle COMMENT fields and properties in a special way to preserve */\r\n    /* the spacing.                                                      */\r\n    if ( ft_memcmp( line, \"COMMENT\", 7 ) == 0 )\r\n    {\r\n      name = value = line;\r\n      value += 7;\r\n      if ( *value )\r\n        *value++ = 0;\r\n      error = _bdf_add_property( p->font, name, value, lineno );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n    else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) )\r\n    {\r\n      error = _bdf_add_property( p->font, name, value, lineno );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n    else\r\n    {\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n      name = p->list.field[0];\r\n\r\n      _bdf_list_shift( &p->list, 1 );\r\n      value = _bdf_list_join( &p->list, ' ', &vlen );\r\n\r\n      error = _bdf_add_property( p->font, name, value, lineno );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Load the font header. */\r\n  static FT_Error\r\n  _bdf_parse_start( char*          line,\r\n                    unsigned long  linelen,\r\n                    unsigned long  lineno,\r\n                    void*          call_data,\r\n                    void*          client_data )\r\n  {\r\n    unsigned long      slen;\r\n    _bdf_line_func_t*  next;\r\n    _bdf_parse_t*      p;\r\n    bdf_font_t*        font;\r\n    char               *s;\r\n\r\n    FT_Memory          memory = NULL;\r\n    FT_Error           error  = BDF_Err_Ok;\r\n\r\n    FT_UNUSED( lineno );            /* only used in debug mode */\r\n\r\n\r\n    next = (_bdf_line_func_t *)call_data;\r\n    p    = (_bdf_parse_t *)    client_data;\r\n\r\n    if ( p->font )\r\n      memory = p->font->memory;\r\n\r\n    /* Check for a comment.  This is done to handle those fonts that have */\r\n    /* comments before the STARTFONT line for some reason.                */\r\n    if ( ft_memcmp( line, \"COMMENT\", 7 ) == 0 )\r\n    {\r\n      if ( p->opts->keep_comments != 0 && p->font != 0 )\r\n      {\r\n        linelen -= 7;\r\n\r\n        s = line + 7;\r\n        if ( *s != 0 )\r\n        {\r\n          s++;\r\n          linelen--;\r\n        }\r\n\r\n        error = _bdf_add_comment( p->font, s, linelen );\r\n        if ( error )\r\n          goto Exit;\r\n        /* here font is not defined! */\r\n      }\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    if ( !( p->flags & _BDF_START ) )\r\n    {\r\n      memory = p->memory;\r\n\r\n      if ( ft_memcmp( line, \"STARTFONT\", 9 ) != 0 )\r\n      {\r\n        /* we don't emit an error message since this code gets */\r\n        /* explicitly caught one level higher                  */\r\n        error = BDF_Err_Missing_Startfont_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      p->flags = _BDF_START;\r\n      font = p->font = 0;\r\n\r\n      if ( FT_NEW( font ) )\r\n        goto Exit;\r\n      p->font = font;\r\n\r\n      font->memory = p->memory;\r\n      p->memory    = 0;\r\n\r\n      { /* setup */\r\n        size_t           i;\r\n        bdf_property_t*  prop;\r\n\r\n\r\n        error = hash_init( &(font->proptbl), memory );\r\n        if ( error )\r\n          goto Exit;\r\n        for ( i = 0, prop = (bdf_property_t*)_bdf_properties;\r\n              i < _num_bdf_properties; i++, prop++ )\r\n        {\r\n          error = hash_insert( prop->name, i,\r\n                               &(font->proptbl), memory );\r\n          if ( error )\r\n            goto Exit;\r\n        }\r\n      }\r\n\r\n      if ( FT_ALLOC( p->font->internal, sizeof ( hashtable ) ) )\r\n        goto Exit;\r\n      error = hash_init( (hashtable *)p->font->internal,memory );\r\n      if ( error )\r\n        goto Exit;\r\n      p->font->spacing      = p->opts->font_spacing;\r\n      p->font->default_char = -1;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the start of the properties. */\r\n    if ( ft_memcmp( line, \"STARTPROPERTIES\", 15 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_FONT_BBX ) )\r\n      {\r\n        /* Missing the FONTBOUNDINGBOX field. */\r\n        FT_ERROR(( \"_bdf_parse_start: \" ERRMSG1, lineno, \"FONTBOUNDINGBOX\" ));\r\n        error = BDF_Err_Missing_Fontboundingbox_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n      /* at this point, `p->font' can't be NULL */\r\n      p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 );\r\n\r\n      if ( FT_NEW_ARRAY( p->font->props, p->cnt ) )\r\n      {\r\n        p->font->props_size = 0;\r\n        goto Exit;\r\n      }\r\n\r\n      p->flags |= _BDF_PROPS;\r\n      *next     = _bdf_parse_properties;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the FONTBOUNDINGBOX field. */\r\n    if ( ft_memcmp( line, \"FONTBOUNDINGBOX\", 15 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_SIZE ) )\r\n      {\r\n        /* Missing the SIZE field. */\r\n        FT_ERROR(( \"_bdf_parse_start: \" ERRMSG1, lineno, \"SIZE\" ));\r\n        error = BDF_Err_Missing_Size_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      p->font->bbx.width  = _bdf_atos( p->list.field[1], 0, 10 );\r\n      p->font->bbx.height = _bdf_atos( p->list.field[2], 0, 10 );\r\n\r\n      p->font->bbx.x_offset = _bdf_atos( p->list.field[3], 0, 10 );\r\n      p->font->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 );\r\n\r\n      p->font->bbx.ascent  = (short)( p->font->bbx.height +\r\n                                      p->font->bbx.y_offset );\r\n\r\n      p->font->bbx.descent = (short)( -p->font->bbx.y_offset );\r\n\r\n      p->flags |= _BDF_FONT_BBX;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* The next thing to check for is the FONT field. */\r\n    if ( ft_memcmp( line, \"FONT\", 4 ) == 0 )\r\n    {\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n      _bdf_list_shift( &p->list, 1 );\r\n\r\n      s = _bdf_list_join( &p->list, ' ', &slen );\r\n\r\n      if ( !s )\r\n      {\r\n        FT_ERROR(( \"_bdf_parse_start: \" ERRMSG8, lineno, \"FONT\" ));\r\n        error = BDF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      /* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */\r\n      FT_FREE( p->font->name );\r\n\r\n      if ( FT_NEW_ARRAY( p->font->name, slen + 1 ) )\r\n        goto Exit;\r\n      FT_MEM_COPY( p->font->name, s, slen + 1 );\r\n\r\n      /* If the font name is an XLFD name, set the spacing to the one in  */\r\n      /* the font name.  If there is no spacing fall back on the default. */\r\n      error = _bdf_set_default_spacing( p->font, p->opts, lineno );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      p->flags |= _BDF_FONT_NAME;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the SIZE field. */\r\n    if ( ft_memcmp( line, \"SIZE\", 4 ) == 0 )\r\n    {\r\n      if ( !( p->flags & _BDF_FONT_NAME ) )\r\n      {\r\n        /* Missing the FONT field. */\r\n        FT_ERROR(( \"_bdf_parse_start: \" ERRMSG1, lineno, \"FONT\" ));\r\n        error = BDF_Err_Missing_Font_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      error = _bdf_list_split( &p->list, (char *)\" +\", line, linelen );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      p->font->point_size   = _bdf_atoul( p->list.field[1], 0, 10 );\r\n      p->font->resolution_x = _bdf_atoul( p->list.field[2], 0, 10 );\r\n      p->font->resolution_y = _bdf_atoul( p->list.field[3], 0, 10 );\r\n\r\n      /* Check for the bits per pixel field. */\r\n      if ( p->list.used == 5 )\r\n      {\r\n        unsigned short bitcount, i, shift;\r\n\r\n\r\n        p->font->bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 );\r\n\r\n        /* Only values 1, 2, 4, 8 are allowed. */\r\n        shift = p->font->bpp;\r\n        bitcount = 0;\r\n        for ( i = 0; shift > 0; i++ )\r\n        {\r\n          if ( shift & 1 )\r\n            bitcount = i;\r\n          shift >>= 1;\r\n        }\r\n\r\n        shift = (short)( ( bitcount > 3 ) ? 8 : ( 1 << bitcount ) );\r\n\r\n        if ( p->font->bpp > shift || p->font->bpp != shift )\r\n        {\r\n          /* select next higher value */\r\n          p->font->bpp = (unsigned short)( shift << 1 );\r\n          FT_TRACE2(( \"_bdf_parse_start: \" ACMSG11, p->font->bpp ));\r\n        }\r\n      }\r\n      else\r\n        p->font->bpp = 1;\r\n\r\n      p->flags |= _BDF_SIZE;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* Check for the CHARS field -- font properties are optional */\r\n    if ( ft_memcmp( line, \"CHARS\", 5 ) == 0 )\r\n    {\r\n      char  nbuf[128];\r\n\r\n\r\n      if ( !( p->flags & _BDF_FONT_BBX ) )\r\n      {\r\n        /* Missing the FONTBOUNDINGBOX field. */\r\n        FT_ERROR(( \"_bdf_parse_start: \" ERRMSG1, lineno, \"FONTBOUNDINGBOX\" ));\r\n        error = BDF_Err_Missing_Fontboundingbox_Field;\r\n        goto Exit;\r\n      }\r\n\r\n      /* Add the two standard X11 properties which are required */\r\n      /* for compiling fonts.                                   */\r\n      p->font->font_ascent = p->font->bbx.ascent;\r\n      ft_sprintf( nbuf, \"%hd\", p->font->bbx.ascent );\r\n      error = _bdf_add_property( p->font, (char *)\"FONT_ASCENT\",\r\n                                 nbuf, lineno );\r\n      if ( error )\r\n        goto Exit;\r\n      FT_TRACE2(( \"_bdf_parse_properties: \" ACMSG1, p->font->bbx.ascent ));\r\n\r\n      p->font->font_descent = p->font->bbx.descent;\r\n      ft_sprintf( nbuf, \"%hd\", p->font->bbx.descent );\r\n      error = _bdf_add_property( p->font, (char *)\"FONT_DESCENT\",\r\n                                 nbuf, lineno );\r\n      if ( error )\r\n        goto Exit;\r\n      FT_TRACE2(( \"_bdf_parse_properties: \" ACMSG2, p->font->bbx.descent ));\r\n\r\n      p->font->modified = 1;\r\n\r\n      *next = _bdf_parse_glyphs;\r\n\r\n      /* A special return value. */\r\n      error = -1;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_ERROR(( \"_bdf_parse_start: \" ERRMSG9, lineno ));\r\n    error = BDF_Err_Invalid_File_Format;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* API.                                                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  bdf_load_font( FT_Stream       stream,\r\n                 FT_Memory       extmemory,\r\n                 bdf_options_t*  opts,\r\n                 bdf_font_t*    *font )\r\n  {\r\n    unsigned long  lineno = 0; /* make compiler happy */\r\n    _bdf_parse_t   *p     = NULL;\r\n\r\n    FT_Memory      memory = extmemory;\r\n    FT_Error       error  = BDF_Err_Ok;\r\n\r\n\r\n    if ( FT_NEW( p ) )\r\n      goto Exit;\r\n\r\n    memory    = NULL;\r\n    p->opts   = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );\r\n    p->minlb  = 32767;\r\n    p->memory = extmemory;  /* only during font creation */\r\n\r\n    _bdf_list_init( &p->list, extmemory );\r\n\r\n    error = _bdf_readstream( stream, _bdf_parse_start,\r\n                             (void *)p, &lineno );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    if ( p->font != 0 )\r\n    {\r\n      /* If the font is not proportional, set the font's monowidth */\r\n      /* field to the width of the font bounding box.              */\r\n      memory = p->font->memory;\r\n\r\n      if ( p->font->spacing != BDF_PROPORTIONAL )\r\n        p->font->monowidth = p->font->bbx.width;\r\n\r\n      /* If the number of glyphs loaded is not that of the original count, */\r\n      /* indicate the difference.                                          */\r\n      if ( p->cnt != p->font->glyphs_used + p->font->unencoded_used )\r\n      {\r\n        FT_TRACE2(( \"bdf_load_font: \" ACMSG15, p->cnt,\r\n                    p->font->glyphs_used + p->font->unencoded_used ));\r\n        p->font->modified = 1;\r\n      }\r\n\r\n      /* Once the font has been loaded, adjust the overall font metrics if */\r\n      /* necessary.                                                        */\r\n      if ( p->opts->correct_metrics != 0 &&\r\n           ( p->font->glyphs_used > 0 || p->font->unencoded_used > 0 ) )\r\n      {\r\n        if ( p->maxrb - p->minlb != p->font->bbx.width )\r\n        {\r\n          FT_TRACE2(( \"bdf_load_font: \" ACMSG3,\r\n                      p->font->bbx.width, p->maxrb - p->minlb ));\r\n          p->font->bbx.width = (unsigned short)( p->maxrb - p->minlb );\r\n          p->font->modified  = 1;\r\n        }\r\n\r\n        if ( p->font->bbx.x_offset != p->minlb )\r\n        {\r\n          FT_TRACE2(( \"bdf_load_font: \" ACMSG4,\r\n                      p->font->bbx.x_offset, p->minlb ));\r\n          p->font->bbx.x_offset = p->minlb;\r\n          p->font->modified     = 1;\r\n        }\r\n\r\n        if ( p->font->bbx.ascent != p->maxas )\r\n        {\r\n          FT_TRACE2(( \"bdf_load_font: \" ACMSG5,\r\n                      p->font->bbx.ascent, p->maxas ));\r\n          p->font->bbx.ascent = p->maxas;\r\n          p->font->modified   = 1;\r\n        }\r\n\r\n        if ( p->font->bbx.descent != p->maxds )\r\n        {\r\n          FT_TRACE2(( \"bdf_load_font: \" ACMSG6,\r\n                      p->font->bbx.descent, p->maxds ));\r\n          p->font->bbx.descent  = p->maxds;\r\n          p->font->bbx.y_offset = (short)( -p->maxds );\r\n          p->font->modified     = 1;\r\n        }\r\n\r\n        if ( p->maxas + p->maxds != p->font->bbx.height )\r\n        {\r\n          FT_TRACE2(( \"bdf_load_font: \" ACMSG7,\r\n                      p->font->bbx.height, p->maxas + p->maxds ));\r\n          p->font->bbx.height = (unsigned short)( p->maxas + p->maxds );\r\n        }\r\n\r\n        if ( p->flags & _BDF_SWIDTH_ADJ )\r\n          FT_TRACE2(( \"bdf_load_font: \" ACMSG8 ));\r\n      }\r\n    }\r\n\r\n    if ( p->flags & _BDF_START )\r\n    {\r\n      /* The ENDFONT field was never reached or did not exist. */\r\n      if ( !( p->flags & _BDF_GLYPHS ) )\r\n      {\r\n        /* Error happened while parsing header. */\r\n        FT_ERROR(( \"bdf_load_font: \" ERRMSG2, lineno ));\r\n        error = BDF_Err_Corrupted_Font_Header;\r\n        goto Exit;\r\n      }\r\n      else\r\n      {\r\n        /* Error happened when parsing glyphs. */\r\n        FT_ERROR(( \"bdf_load_font: \" ERRMSG3, lineno ));\r\n        error = BDF_Err_Corrupted_Font_Glyphs;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    if ( p->font != 0 )\r\n    {\r\n      /* Make sure the comments are NULL terminated if they exist. */\r\n      memory = p->font->memory;\r\n\r\n      if ( p->font->comments_len > 0 )\r\n      {\r\n        if ( FT_RENEW_ARRAY( p->font->comments,\r\n                             p->font->comments_len,\r\n                             p->font->comments_len + 1 ) )\r\n          goto Fail;\r\n\r\n        p->font->comments[p->font->comments_len] = 0;\r\n      }\r\n    }\r\n    else if ( error == BDF_Err_Ok )\r\n      error = BDF_Err_Invalid_File_Format;\r\n\r\n    *font = p->font;\r\n\r\n  Exit:\r\n    if ( p )\r\n    {\r\n      _bdf_list_done( &p->list );\r\n\r\n      memory = extmemory;\r\n\r\n      FT_FREE( p );\r\n    }\r\n\r\n    return error;\r\n\r\n  Fail:\r\n    bdf_free_font( p->font );\r\n\r\n    memory = extmemory;\r\n\r\n    FT_FREE( p->font );\r\n\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  bdf_free_font( bdf_font_t*  font )\r\n  {\r\n    bdf_property_t*  prop;\r\n    unsigned long    i;\r\n    bdf_glyph_t*     glyphs;\r\n    FT_Memory        memory;\r\n\r\n\r\n    if ( font == 0 )\r\n      return;\r\n\r\n    memory = font->memory;\r\n\r\n    FT_FREE( font->name );\r\n\r\n    /* Free up the internal hash table of property names. */\r\n    if ( font->internal )\r\n    {\r\n      hash_free( (hashtable *)font->internal, memory );\r\n      FT_FREE( font->internal );\r\n    }\r\n\r\n    /* Free up the comment info. */\r\n    FT_FREE( font->comments );\r\n\r\n    /* Free up the properties. */\r\n    for ( i = 0; i < font->props_size; i++ )\r\n    {\r\n      if ( font->props[i].format == BDF_ATOM )\r\n        FT_FREE( font->props[i].value.atom );\r\n    }\r\n\r\n    FT_FREE( font->props );\r\n\r\n    /* Free up the character info. */\r\n    for ( i = 0, glyphs = font->glyphs;\r\n          i < font->glyphs_used; i++, glyphs++ )\r\n    {\r\n      FT_FREE( glyphs->name );\r\n      FT_FREE( glyphs->bitmap );\r\n    }\r\n\r\n    for ( i = 0, glyphs = font->unencoded; i < font->unencoded_used;\r\n          i++, glyphs++ )\r\n    {\r\n      FT_FREE( glyphs->name );\r\n      FT_FREE( glyphs->bitmap );\r\n    }\r\n\r\n    FT_FREE( font->glyphs );\r\n    FT_FREE( font->unencoded );\r\n\r\n    /* Free up the overflow storage if it was used. */\r\n    for ( i = 0, glyphs = font->overflow.glyphs;\r\n          i < font->overflow.glyphs_used; i++, glyphs++ )\r\n    {\r\n      FT_FREE( glyphs->name );\r\n      FT_FREE( glyphs->bitmap );\r\n    }\r\n\r\n    FT_FREE( font->overflow.glyphs );\r\n\r\n    /* bdf_cleanup */\r\n    hash_free( &(font->proptbl), memory );\r\n\r\n    /* Free up the user defined properties. */\r\n    for ( prop = font->user_props, i = 0;\r\n          i < font->nuser_props; i++, prop++ )\r\n    {\r\n      FT_FREE( prop->name );\r\n      if ( prop->format == BDF_ATOM )\r\n        FT_FREE( prop->value.atom );\r\n    }\r\n\r\n    FT_FREE( font->user_props );\r\n\r\n    /* FREE( font ); */ /* XXX Fixme */\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( bdf_property_t * )\r\n  bdf_get_font_property( bdf_font_t*  font,\r\n                         const char*  name )\r\n  {\r\n    hashnode  hn;\r\n\r\n\r\n    if ( font == 0 || font->props_size == 0 || name == 0 || *name == 0 )\r\n      return 0;\r\n\r\n    hn = hash_lookup( name, (hashtable *)font->internal );\r\n\r\n    return hn ? ( font->props + hn->data ) : 0;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/module.mk",
    "content": "#\r\n# FreeType 2 BDF module definition\r\n#\r\n\r\n# Copyright 2001, 2002, 2006 by\r\n# Francesco Zappa Nardelli\r\n#\r\n# Permission is hereby granted, free of charge, to any person obtaining a copy\r\n# of this software and associated documentation files (the \"Software\"), to deal\r\n# in the Software without restriction, including without limitation the rights\r\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n# copies of the Software, and to permit persons to whom the Software is\r\n# furnished to do so, subject to the following conditions:\r\n#\r\n# The above copyright notice and this permission notice shall be included in\r\n# all copies or substantial portions of the Software.\r\n#\r\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n# THE SOFTWARE.\r\n\r\n\r\nFTMODULE_H_COMMANDS += BDF_DRIVER\r\n\r\ndefine BDF_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, bdf_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)bdf       $(ECHO_DRIVER_DESC)bdf bitmap fonts$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bdf/rules.mk",
    "content": "#\r\n# FreeType 2 bdf driver configuration rules\r\n#\r\n\r\n\r\n# Copyright (C) 2001, 2002, 2003, 2008 by\r\n# Francesco Zappa Nardelli\r\n#\r\n# Permission is hereby granted, free of charge, to any person obtaining a copy\r\n# of this software and associated documentation files (the \"Software\"), to deal\r\n# in the Software without restriction, including without limitation the rights\r\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n# copies of the Software, and to permit persons to whom the Software is\r\n# furnished to do so, subject to the following conditions:\r\n#\r\n# The above copyright notice and this permission notice shall be included in\r\n# all copies or substantial portions of the Software.\r\n#\r\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n# THE SOFTWARE.\r\n\r\n\r\n\r\n\r\n# bdf driver directory\r\n#\r\nBDF_DIR := $(SRC_DIR)/bdf\r\n\r\n\r\nBDF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(BDF_DIR))\r\n\r\n\r\n# bdf driver sources (i.e., C files)\r\n#\r\nBDF_DRV_SRC := $(BDF_DIR)/bdflib.c \\\r\n               $(BDF_DIR)/bdfdrivr.c\r\n\r\n\r\n# bdf driver headers\r\n#\r\nBDF_DRV_H := $(BDF_DIR)/bdf.h \\\r\n             $(BDF_DIR)/bdfdrivr.h \\\r\n             $(BDF_DIR)/bdferror.h\r\n\r\n# bdf driver object(s)\r\n#\r\n#   BDF_DRV_OBJ_M is used during `multi' builds\r\n#   BDF_DRV_OBJ_S is used during `single' builds\r\n#\r\nBDF_DRV_OBJ_M := $(BDF_DRV_SRC:$(BDF_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nBDF_DRV_OBJ_S := $(OBJ_DIR)/bdf.$O\r\n\r\n# bdf driver source file for single build\r\n#\r\nBDF_DRV_SRC_S := $(BDF_DIR)/bdf.c\r\n\r\n\r\n# bdf driver - single object\r\n#\r\n$(BDF_DRV_OBJ_S): $(BDF_DRV_SRC_S) $(BDF_DRV_SRC) $(FREETYPE_H) $(BDF_DRV_H)\r\n\t$(BDF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BDF_DRV_SRC_S))\r\n\r\n\r\n# bdf driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(BDF_DIR)/%.c $(FREETYPE_H) $(BDF_DRV_H)\r\n\t$(BDF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(BDF_DRV_OBJ_S)\r\nDRV_OBJS_M += $(BDF_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bzip2/Jamfile",
    "content": "# FreeType 2 src/bzip2 Jamfile\r\n#\r\n# Copyright 2010 by\r\n# Joel Klinghed\r\n#\r\n# Based on src/lzw/Jamfile, Copyright 2004, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) bzip2 ;\r\n\r\nLibrary  $(FT2_LIB) : ftbzip2.c ;\r\n\r\n# end of src/bzip2 Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bzip2/ftbzip2.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbzip2.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType support for .bz2 compressed files.                          */\r\n/*                                                                         */\r\n/*  This optional component relies on libbz2.  It should mainly be used to */\r\n/*  parse compressed PCF fonts, as found with many X11 server              */\r\n/*  distributions.                                                         */\r\n/*                                                                         */\r\n/*  Copyright 2010, 2012 by                                                */\r\n/*  Joel Klinghed.                                                         */\r\n/*                                                                         */\r\n/*  Based on src/gzip/ftgzip.c, Copyright 2002 - 2010 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_BZIP2_H\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  Bzip2_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Bzip2\r\n\r\n#include FT_ERRORS_H\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_BZIP2\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"bzip2 code does not support PIC yet\"\r\n#endif\r\n\r\n#define BZ_NO_STDIO /* Do not need FILE */\r\n#include <bzlib.h>\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****           B Z I P 2   M E M O R Y   M A N A G E M E N T         *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n  /* it is better to use FreeType memory routines instead of raw\r\n     'malloc/free' */\r\n\r\n  typedef void *(* alloc_func)(void*, int, int);\r\n  typedef void (* free_func)(void*, void*);\r\n\r\n  static void*\r\n  ft_bzip2_alloc( FT_Memory  memory,\r\n                  int        items,\r\n                  int        size )\r\n  {\r\n    FT_ULong    sz = (FT_ULong)size * items;\r\n    FT_Error    error;\r\n    FT_Pointer  p  = NULL;\r\n\r\n\r\n    (void)FT_ALLOC( p, sz );\r\n    return p;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_bzip2_free( FT_Memory  memory,\r\n                 void*      address )\r\n  {\r\n    FT_MEM_FREE( address );\r\n  }\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****              B Z I P 2   F I L E   D E S C R I P T O R          *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n#define FT_BZIP2_BUFFER_SIZE  4096\r\n\r\n  typedef struct  FT_BZip2FileRec_\r\n  {\r\n    FT_Stream  source;         /* parent/source stream        */\r\n    FT_Stream  stream;         /* embedding stream            */\r\n    FT_Memory  memory;         /* memory allocator            */\r\n    bz_stream  bzstream;       /* bzlib input stream          */\r\n\r\n    FT_Byte    input[FT_BZIP2_BUFFER_SIZE];  /* input read buffer  */\r\n\r\n    FT_Byte    buffer[FT_BZIP2_BUFFER_SIZE]; /* output buffer      */\r\n    FT_ULong   pos;                          /* position in output */\r\n    FT_Byte*   cursor;\r\n    FT_Byte*   limit;\r\n\r\n  } FT_BZip2FileRec, *FT_BZip2File;\r\n\r\n\r\n  /* check and skip .bz2 header - we don't support `transparent' compression */\r\n  static FT_Error\r\n  ft_bzip2_check_header( FT_Stream  stream )\r\n  {\r\n    FT_Error  error = Bzip2_Err_Ok;\r\n    FT_Byte   head[4];\r\n\r\n\r\n    if ( FT_STREAM_SEEK( 0 )       ||\r\n         FT_STREAM_READ( head, 4 ) )\r\n      goto Exit;\r\n\r\n    /* head[0] && head[1] are the magic numbers;    */\r\n    /* head[2] is the version, and head[3] the blocksize */\r\n    if ( head[0] != 0x42  ||\r\n         head[1] != 0x5a  ||\r\n         head[2] != 0x68  )  /* only support bzip2 (huffman) */\r\n    {\r\n      error = Bzip2_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_bzip2_file_init( FT_BZip2File  zip,\r\n                      FT_Stream     stream,\r\n                      FT_Stream     source )\r\n  {\r\n    bz_stream*  bzstream = &zip->bzstream;\r\n    FT_Error    error    = Bzip2_Err_Ok;\r\n\r\n\r\n    zip->stream = stream;\r\n    zip->source = source;\r\n    zip->memory = stream->memory;\r\n\r\n    zip->limit  = zip->buffer + FT_BZIP2_BUFFER_SIZE;\r\n    zip->cursor = zip->limit;\r\n    zip->pos    = 0;\r\n\r\n    /* check .bz2 header */\r\n    {\r\n      stream = source;\r\n\r\n      error = ft_bzip2_check_header( stream );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      if ( FT_STREAM_SEEK( 0 ) )\r\n        goto Exit;\r\n    }\r\n\r\n    /* initialize bzlib */\r\n    bzstream->bzalloc = (alloc_func)ft_bzip2_alloc;\r\n    bzstream->bzfree  = (free_func) ft_bzip2_free;\r\n    bzstream->opaque  = zip->memory;\r\n\r\n    bzstream->avail_in = 0;\r\n    bzstream->next_in  = (char*)zip->buffer;\r\n\r\n    if ( BZ2_bzDecompressInit( bzstream, 0, 0 ) != BZ_OK ||\r\n         bzstream->next_in == NULL                       )\r\n      error = Bzip2_Err_Invalid_File_Format;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_bzip2_file_done( FT_BZip2File  zip )\r\n  {\r\n    bz_stream*  bzstream = &zip->bzstream;\r\n\r\n\r\n    BZ2_bzDecompressEnd( bzstream );\r\n\r\n    /* clear the rest */\r\n    bzstream->bzalloc   = NULL;\r\n    bzstream->bzfree    = NULL;\r\n    bzstream->opaque    = NULL;\r\n    bzstream->next_in   = NULL;\r\n    bzstream->next_out  = NULL;\r\n    bzstream->avail_in  = 0;\r\n    bzstream->avail_out = 0;\r\n\r\n    zip->memory = NULL;\r\n    zip->source = NULL;\r\n    zip->stream = NULL;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_bzip2_file_reset( FT_BZip2File  zip )\r\n  {\r\n    FT_Stream  stream = zip->source;\r\n    FT_Error   error;\r\n\r\n\r\n    if ( !FT_STREAM_SEEK( 0 ) )\r\n    {\r\n      bz_stream*  bzstream = &zip->bzstream;\r\n\r\n\r\n      BZ2_bzDecompressEnd( bzstream );\r\n\r\n      bzstream->avail_in  = 0;\r\n      bzstream->next_in   = (char*)zip->input;\r\n      bzstream->avail_out = 0;\r\n      bzstream->next_out  = (char*)zip->buffer;\r\n\r\n      zip->limit  = zip->buffer + FT_BZIP2_BUFFER_SIZE;\r\n      zip->cursor = zip->limit;\r\n      zip->pos    = 0;\r\n\r\n      BZ2_bzDecompressInit( bzstream, 0, 0 );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_bzip2_file_fill_input( FT_BZip2File  zip )\r\n  {\r\n    bz_stream*  bzstream = &zip->bzstream;\r\n    FT_Stream   stream    = zip->source;\r\n    FT_ULong    size;\r\n\r\n\r\n    if ( stream->read )\r\n    {\r\n      size = stream->read( stream, stream->pos, zip->input,\r\n                           FT_BZIP2_BUFFER_SIZE );\r\n      if ( size == 0 )\r\n        return Bzip2_Err_Invalid_Stream_Operation;\r\n    }\r\n    else\r\n    {\r\n      size = stream->size - stream->pos;\r\n      if ( size > FT_BZIP2_BUFFER_SIZE )\r\n        size = FT_BZIP2_BUFFER_SIZE;\r\n\r\n      if ( size == 0 )\r\n        return Bzip2_Err_Invalid_Stream_Operation;\r\n\r\n      FT_MEM_COPY( zip->input, stream->base + stream->pos, size );\r\n    }\r\n    stream->pos += size;\r\n\r\n    bzstream->next_in  = (char*)zip->input;\r\n    bzstream->avail_in = size;\r\n\r\n    return Bzip2_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_bzip2_file_fill_output( FT_BZip2File  zip )\r\n  {\r\n    bz_stream*  bzstream = &zip->bzstream;\r\n    FT_Error    error    = Bzip2_Err_Ok;\r\n\r\n\r\n    zip->cursor         = zip->buffer;\r\n    bzstream->next_out  = (char*)zip->cursor;\r\n    bzstream->avail_out = FT_BZIP2_BUFFER_SIZE;\r\n\r\n    while ( bzstream->avail_out > 0 )\r\n    {\r\n      int  err;\r\n\r\n\r\n      if ( bzstream->avail_in == 0 )\r\n      {\r\n        error = ft_bzip2_file_fill_input( zip );\r\n        if ( error )\r\n          break;\r\n      }\r\n\r\n      err = BZ2_bzDecompress( bzstream );\r\n\r\n      if ( err == BZ_STREAM_END )\r\n      {\r\n        zip->limit = (FT_Byte*)bzstream->next_out;\r\n        if ( zip->limit == zip->cursor )\r\n          error = Bzip2_Err_Invalid_Stream_Operation;\r\n        break;\r\n      }\r\n      else if ( err != BZ_OK )\r\n      {\r\n        error = Bzip2_Err_Invalid_Stream_Operation;\r\n        break;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* fill output buffer; `count' must be <= FT_BZIP2_BUFFER_SIZE */\r\n  static FT_Error\r\n  ft_bzip2_file_skip_output( FT_BZip2File  zip,\r\n                             FT_ULong      count )\r\n  {\r\n    FT_Error  error = Bzip2_Err_Ok;\r\n    FT_ULong  delta;\r\n\r\n\r\n    for (;;)\r\n    {\r\n      delta = (FT_ULong)( zip->limit - zip->cursor );\r\n      if ( delta >= count )\r\n        delta = count;\r\n\r\n      zip->cursor += delta;\r\n      zip->pos    += delta;\r\n\r\n      count -= delta;\r\n      if ( count == 0 )\r\n        break;\r\n\r\n      error = ft_bzip2_file_fill_output( zip );\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_bzip2_file_io( FT_BZip2File  zip,\r\n                    FT_ULong      pos,\r\n                    FT_Byte*      buffer,\r\n                    FT_ULong      count )\r\n  {\r\n    FT_ULong  result = 0;\r\n    FT_Error  error;\r\n\r\n\r\n    /* Reset inflate stream if we're seeking backwards.        */\r\n    /* Yes, that is not too efficient, but it saves memory :-) */\r\n    if ( pos < zip->pos )\r\n    {\r\n      error = ft_bzip2_file_reset( zip );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* skip unwanted bytes */\r\n    if ( pos > zip->pos )\r\n    {\r\n      error = ft_bzip2_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( count == 0 )\r\n      goto Exit;\r\n\r\n    /* now read the data */\r\n    for (;;)\r\n    {\r\n      FT_ULong  delta;\r\n\r\n\r\n      delta = (FT_ULong)( zip->limit - zip->cursor );\r\n      if ( delta >= count )\r\n        delta = count;\r\n\r\n      FT_MEM_COPY( buffer, zip->cursor, delta );\r\n      buffer      += delta;\r\n      result      += delta;\r\n      zip->cursor += delta;\r\n      zip->pos    += delta;\r\n\r\n      count -= delta;\r\n      if ( count == 0 )\r\n        break;\r\n\r\n      error = ft_bzip2_file_fill_output( zip );\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****               B Z   E M B E D D I N G   S T R E A M             *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n  static void\r\n  ft_bzip2_stream_close( FT_Stream  stream )\r\n  {\r\n    FT_BZip2File  zip    = (FT_BZip2File)stream->descriptor.pointer;\r\n    FT_Memory     memory = stream->memory;\r\n\r\n\r\n    if ( zip )\r\n    {\r\n      /* finalize bzip file descriptor */\r\n      ft_bzip2_file_done( zip );\r\n\r\n      FT_FREE( zip );\r\n\r\n      stream->descriptor.pointer = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_bzip2_stream_io( FT_Stream  stream,\r\n                      FT_ULong   pos,\r\n                      FT_Byte*   buffer,\r\n                      FT_ULong   count )\r\n  {\r\n    FT_BZip2File  zip = (FT_BZip2File)stream->descriptor.pointer;\r\n\r\n\r\n    return ft_bzip2_file_io( zip, pos, buffer, count );\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stream_OpenBzip2( FT_Stream  stream,\r\n                       FT_Stream  source )\r\n  {\r\n    FT_Error      error;\r\n    FT_Memory     memory = source->memory;\r\n    FT_BZip2File  zip = NULL;\r\n\r\n\r\n    /*\r\n     *  check the header right now; this prevents allocating unnecessary\r\n     *  objects when we don't need them\r\n     */\r\n    error = ft_bzip2_check_header( source );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_ZERO( stream );\r\n    stream->memory = memory;\r\n\r\n    if ( !FT_QNEW( zip ) )\r\n    {\r\n      error = ft_bzip2_file_init( zip, stream, source );\r\n      if ( error )\r\n      {\r\n        FT_FREE( zip );\r\n        goto Exit;\r\n      }\r\n\r\n      stream->descriptor.pointer = zip;\r\n    }\r\n\r\n    stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */\r\n    stream->pos   = 0;\r\n    stream->base  = 0;\r\n    stream->read  = ft_bzip2_stream_io;\r\n    stream->close = ft_bzip2_stream_close;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n#else  /* !FT_CONFIG_OPTION_USE_BZIP2 */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stream_OpenBzip2( FT_Stream  stream,\r\n                       FT_Stream  source )\r\n  {\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( source );\r\n\r\n    return Bzip2_Err_Unimplemented_Feature;\r\n  }\r\n\r\n#endif /* !FT_CONFIG_OPTION_USE_BZIP2 */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/bzip2/rules.mk",
    "content": "#\r\n# FreeType 2 BZIP2 support configuration rules\r\n#\r\n\r\n# Copyright 2010 by\r\n# Joel Klinghed.\r\n#\r\n# Based on src/lzw/rules.mk, Copyright 2004-2006 by\r\n# Albert Chin-A-Young.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# BZIP2 driver directory\r\n#\r\nBZIP2_DIR := $(SRC_DIR)/bzip2\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nBZIP2_COMPILE := $(FT_COMPILE)\r\n\r\n\r\n# BZIP2 support sources (i.e., C files)\r\n#\r\nBZIP2_DRV_SRC := $(BZIP2_DIR)/ftbzip2.c\r\n\r\n# BZIP2 driver object(s)\r\n#\r\n#   BZIP2_DRV_OBJ_M is used during `multi' builds\r\n#   BZIP2_DRV_OBJ_S is used during `single' builds\r\n#\r\nBZIP2_DRV_OBJ_M := $(OBJ_DIR)/ftbzip2.$O\r\nBZIP2_DRV_OBJ_S := $(OBJ_DIR)/ftbzip2.$O\r\n\r\n# BZIP2 support source file for single build\r\n#\r\nBZIP2_DRV_SRC_S := $(BZIP2_DIR)/ftbzip2.c\r\n\r\n\r\n# BZIP2 support - single object\r\n#\r\n$(BZIP2_DRV_OBJ_S): $(BZIP2_DRV_SRC_S) $(BZIP2_DRV_SRC) $(FREETYPE_H) $(BZIP2_DRV_H)\r\n\t$(BZIP2_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BZIP2_DRV_SRC_S))\r\n\r\n\r\n# BZIP2 support - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(BZIP2_DIR)/%.c $(FREETYPE_H) $(BZIP2_DRV_H)\r\n\t$(BZIP2_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(BZIP2_DRV_OBJ_S)\r\nDRV_OBJS_M += $(BZIP2_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/Jamfile",
    "content": "# FreeType 2 src/cache Jamfile\r\n#\r\n# Copyright 2001, 2003, 2004 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) cache ;\r\n\r\n# The file <freetype/ftcache.h> contains some macro definitions that are\r\n# later used in #include statements related to the cache sub-system.  It\r\n# needs to be parsed through a HDRMACRO rule for macro definitions.\r\n#\r\nHDRMACRO  [ FT2_SubDir  include ftcache.h ] ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = ftcmru\r\n               ftcmanag\r\n               ftccache\r\n               ftcglyph\r\n               ftcsbits\r\n               ftcimage\r\n               ftcbasic\r\n               ftccmap\r\n               ;\r\n  }\r\n  else\r\n  {\r\n    _sources = ftcache ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/cache Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcache.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcache.c                                                              */\r\n/*                                                                         */\r\n/*    The FreeType Caching sub-system (body only).                         */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"ftcmru.c\"\r\n#include \"ftcmanag.c\"\r\n#include \"ftccache.c\"\r\n#include \"ftccmap.c\"\r\n#include \"ftcglyph.c\"\r\n#include \"ftcimage.c\"\r\n#include \"ftcsbits.c\"\r\n#include \"ftcbasic.c\"\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcbasic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcbasic.c                                                             */\r\n/*                                                                         */\r\n/*    The FreeType basic cache interface (body).                           */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by            */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_CACHE_H\r\n#include \"ftcglyph.h\"\r\n#include \"ftcimage.h\"\r\n#include \"ftcsbits.h\"\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n#define FT_COMPONENT  trace_cache\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*\r\n   *  These structures correspond to the FTC_Font and FTC_ImageDesc types\r\n   *  that were defined in version 2.1.7.\r\n   */\r\n  typedef struct  FTC_OldFontRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_UShort   pix_width;\r\n    FT_UShort   pix_height;\r\n\r\n  } FTC_OldFontRec, *FTC_OldFont;\r\n\r\n\r\n  typedef struct  FTC_OldImageDescRec_\r\n  {\r\n    FTC_OldFontRec  font;\r\n    FT_UInt32       flags;\r\n\r\n  } FTC_OldImageDescRec, *FTC_OldImageDesc;\r\n\r\n\r\n  /*\r\n   *  Notice that FTC_OldImageDescRec and FTC_ImageTypeRec are nearly\r\n   *  identical, bit-wise.  The only difference is that the `width' and\r\n   *  `height' fields are expressed as 16-bit integers in the old structure,\r\n   *  and as normal `int' in the new one.\r\n   *\r\n   *  We are going to perform a weird hack to detect which structure is\r\n   *  being passed to the image and sbit caches.  If the new structure's\r\n   *  `width' is larger than 0x10000, we assume that we are really receiving\r\n   *  an FTC_OldImageDesc.\r\n   */\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*\r\n   *  Basic Families\r\n   *\r\n   */\r\n  typedef struct  FTC_BasicAttrRec_\r\n  {\r\n    FTC_ScalerRec  scaler;\r\n    FT_UInt        load_flags;\r\n\r\n  } FTC_BasicAttrRec, *FTC_BasicAttrs;\r\n\r\n#define FTC_BASIC_ATTR_COMPARE( a, b )                                 \\\r\n          FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \\\r\n                   (a)->load_flags == (b)->load_flags               )\r\n\r\n#define FTC_BASIC_ATTR_HASH( a )                                   \\\r\n          ( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags )\r\n\r\n\r\n  typedef struct  FTC_BasicQueryRec_\r\n  {\r\n    FTC_GQueryRec     gquery;\r\n    FTC_BasicAttrRec  attrs;\r\n\r\n  } FTC_BasicQueryRec, *FTC_BasicQuery;\r\n\r\n\r\n  typedef struct  FTC_BasicFamilyRec_\r\n  {\r\n    FTC_FamilyRec     family;\r\n    FTC_BasicAttrRec  attrs;\r\n\r\n  } FTC_BasicFamilyRec, *FTC_BasicFamily;\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Bool )\r\n  ftc_basic_family_compare( FTC_MruNode  ftcfamily,\r\n                            FT_Pointer   ftcquery )\r\n  {\r\n    FTC_BasicFamily  family = (FTC_BasicFamily)ftcfamily;\r\n    FTC_BasicQuery   query  = (FTC_BasicQuery)ftcquery;\r\n\r\n\r\n    return FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_basic_family_init( FTC_MruNode  ftcfamily,\r\n                         FT_Pointer   ftcquery,\r\n                         FT_Pointer   ftccache )\r\n  {\r\n    FTC_BasicFamily  family = (FTC_BasicFamily)ftcfamily;\r\n    FTC_BasicQuery   query  = (FTC_BasicQuery)ftcquery;\r\n    FTC_Cache        cache  = (FTC_Cache)ftccache;\r\n\r\n\r\n    FTC_Family_Init( FTC_FAMILY( family ), cache );\r\n    family->attrs = query->attrs;\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  ftc_basic_family_get_count( FTC_Family   ftcfamily,\r\n                              FTC_Manager  manager )\r\n  {\r\n    FTC_BasicFamily  family = (FTC_BasicFamily)ftcfamily;\r\n    FT_Error         error;\r\n    FT_Face          face;\r\n    FT_UInt          result = 0;\r\n\r\n\r\n    error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,\r\n                                    &face );\r\n\r\n    if ( error || !face )\r\n      return result;\r\n\r\n    if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )\r\n    {\r\n      FT_TRACE1(( \"ftc_basic_family_get_count: too large number of glyphs \" ));\r\n      FT_TRACE1(( \"in this face, truncated\\n\", face->num_glyphs ));\r\n    }\r\n\r\n    if ( !error )\r\n      result = (FT_UInt)face->num_glyphs;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_basic_family_load_bitmap( FTC_Family   ftcfamily,\r\n                                FT_UInt      gindex,\r\n                                FTC_Manager  manager,\r\n                                FT_Face     *aface )\r\n  {\r\n    FTC_BasicFamily  family = (FTC_BasicFamily)ftcfamily;\r\n    FT_Error         error;\r\n    FT_Size          size;\r\n\r\n\r\n    error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size );\r\n    if ( !error )\r\n    {\r\n      FT_Face  face = size->face;\r\n\r\n\r\n      error = FT_Load_Glyph( face, gindex,\r\n                             family->attrs.load_flags | FT_LOAD_RENDER );\r\n      if ( !error )\r\n        *aface = face;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_basic_family_load_glyph( FTC_Family  ftcfamily,\r\n                               FT_UInt     gindex,\r\n                               FTC_Cache   cache,\r\n                               FT_Glyph   *aglyph )\r\n  {\r\n    FTC_BasicFamily  family = (FTC_BasicFamily)ftcfamily;\r\n    FT_Error         error;\r\n    FTC_Scaler       scaler = &family->attrs.scaler;\r\n    FT_Face          face;\r\n    FT_Size          size;\r\n\r\n\r\n    /* we will now load the glyph image */\r\n    error = FTC_Manager_LookupSize( cache->manager,\r\n                                    scaler,\r\n                                    &size );\r\n    if ( !error )\r\n    {\r\n      face = size->face;\r\n\r\n      error = FT_Load_Glyph( face, gindex, family->attrs.load_flags );\r\n      if ( !error )\r\n      {\r\n        if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP  ||\r\n             face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )\r\n        {\r\n          /* ok, copy it */\r\n          FT_Glyph  glyph;\r\n\r\n\r\n          error = FT_Get_Glyph( face->glyph, &glyph );\r\n          if ( !error )\r\n          {\r\n            *aglyph = glyph;\r\n            goto Exit;\r\n          }\r\n        }\r\n        else\r\n          error = FTC_Err_Invalid_Argument;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Bool )\r\n  ftc_basic_gnode_compare_faceid( FTC_Node    ftcgnode,\r\n                                  FT_Pointer  ftcface_id,\r\n                                  FTC_Cache   cache,\r\n                                  FT_Bool*    list_changed )\r\n  {\r\n    FTC_GNode        gnode   = (FTC_GNode)ftcgnode;\r\n    FTC_FaceID       face_id = (FTC_FaceID)ftcface_id;\r\n    FTC_BasicFamily  family  = (FTC_BasicFamily)gnode->family;\r\n    FT_Bool          result;\r\n\r\n\r\n    if ( list_changed )\r\n      *list_changed = FALSE;\r\n    result = FT_BOOL( family->attrs.scaler.face_id == face_id );\r\n    if ( result )\r\n    {\r\n      /* we must call this function to avoid this node from appearing\r\n       * in later lookups with the same face_id!\r\n       */\r\n      FTC_GNode_UnselectFamily( gnode, cache );\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n /*\r\n  *\r\n  * basic image cache\r\n  *\r\n  */\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_IFamilyClassRec  ftc_basic_image_family_class =\r\n  {\r\n    {\r\n      sizeof ( FTC_BasicFamilyRec ),\r\n      ftc_basic_family_compare,\r\n      ftc_basic_family_init,\r\n      0,                        /* FTC_MruNode_ResetFunc */\r\n      0                         /* FTC_MruNode_DoneFunc  */\r\n    },\r\n    ftc_basic_family_load_glyph\r\n  };\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_GCacheClassRec  ftc_basic_image_cache_class =\r\n  {\r\n    {\r\n      ftc_inode_new,\r\n      ftc_inode_weight,\r\n      ftc_gnode_compare,\r\n      ftc_basic_gnode_compare_faceid,\r\n      ftc_inode_free,\r\n\r\n      sizeof ( FTC_GCacheRec ),\r\n      ftc_gcache_init,\r\n      ftc_gcache_done\r\n    },\r\n    (FTC_MruListClass)&ftc_basic_image_family_class\r\n  };\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_ImageCache_New( FTC_Manager      manager,\r\n                      FTC_ImageCache  *acache )\r\n  {\r\n    return FTC_GCache_New( manager, &ftc_basic_image_cache_class,\r\n                           (FTC_GCache*)acache );\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_ImageCache_Lookup( FTC_ImageCache  cache,\r\n                         FTC_ImageType   type,\r\n                         FT_UInt         gindex,\r\n                         FT_Glyph       *aglyph,\r\n                         FTC_Node       *anode )\r\n  {\r\n    FTC_BasicQueryRec  query;\r\n    FTC_Node           node = 0; /* make compiler happy */\r\n    FT_Error           error;\r\n    FT_PtrDist         hash;\r\n\r\n\r\n    /* some argument checks are delayed to FTC_Cache_Lookup */\r\n    if ( !aglyph )\r\n    {\r\n      error = FTC_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    *aglyph = NULL;\r\n    if ( anode )\r\n      *anode  = NULL;\r\n\r\n#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )\r\n\r\n    /*\r\n     *  This one is a major hack used to detect whether we are passed a\r\n     *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.\r\n     */\r\n    if ( (FT_ULong)type->width >= 0x10000L )\r\n    {\r\n      FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;\r\n\r\n\r\n      query.attrs.scaler.face_id = desc->font.face_id;\r\n      query.attrs.scaler.width   = desc->font.pix_width;\r\n      query.attrs.scaler.height  = desc->font.pix_height;\r\n      query.attrs.load_flags     = desc->flags;\r\n    }\r\n    else\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    {\r\n      if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )\r\n      {\r\n        FT_TRACE1(( \"FTC_ImageCache_Lookup: higher bits in load_flags\" ));\r\n        FT_TRACE1(( \"0x%x are dropped\\n\", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));\r\n      }\r\n\r\n      query.attrs.scaler.face_id = type->face_id;\r\n      query.attrs.scaler.width   = type->width;\r\n      query.attrs.scaler.height  = type->height;\r\n      query.attrs.load_flags     = (FT_UInt)type->flags;\r\n    }\r\n\r\n    query.attrs.scaler.pixel = 1;\r\n    query.attrs.scaler.x_res = 0;  /* make compilers happy */\r\n    query.attrs.scaler.y_res = 0;\r\n\r\n    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;\r\n\r\n#if 1  /* inlining is about 50% faster! */\r\n    FTC_GCACHE_LOOKUP_CMP( cache,\r\n                           ftc_basic_family_compare,\r\n                           FTC_GNode_Compare,\r\n                           hash, gindex,\r\n                           &query,\r\n                           node,\r\n                           error );\r\n#else\r\n    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),\r\n                               hash, gindex,\r\n                               FTC_GQUERY( &query ),\r\n                               &node );\r\n#endif\r\n    if ( !error )\r\n    {\r\n      *aglyph = FTC_INODE( node )->glyph;\r\n\r\n      if ( anode )\r\n      {\r\n        *anode = node;\r\n        node->ref_count++;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_ImageCache_LookupScaler( FTC_ImageCache  cache,\r\n                               FTC_Scaler      scaler,\r\n                               FT_ULong        load_flags,\r\n                               FT_UInt         gindex,\r\n                               FT_Glyph       *aglyph,\r\n                               FTC_Node       *anode )\r\n  {\r\n    FTC_BasicQueryRec  query;\r\n    FTC_Node           node = 0; /* make compiler happy */\r\n    FT_Error           error;\r\n    FT_PtrDist         hash;\r\n\r\n\r\n    /* some argument checks are delayed to FTC_Cache_Lookup */\r\n    if ( !aglyph || !scaler )\r\n    {\r\n      error = FTC_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    *aglyph = NULL;\r\n    if ( anode )\r\n      *anode  = NULL;\r\n\r\n    /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */\r\n    if ( load_flags > FT_UINT_MAX )\r\n    {\r\n      FT_TRACE1(( \"FTC_ImageCache_LookupScaler: higher bits in load_flags\" ));\r\n      FT_TRACE1(( \"0x%x are dropped\\n\", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));\r\n    }\r\n\r\n    query.attrs.scaler     = scaler[0];\r\n    query.attrs.load_flags = (FT_UInt)load_flags;\r\n\r\n    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;\r\n\r\n    FTC_GCACHE_LOOKUP_CMP( cache,\r\n                           ftc_basic_family_compare,\r\n                           FTC_GNode_Compare,\r\n                           hash, gindex,\r\n                           &query,\r\n                           node,\r\n                           error );\r\n    if ( !error )\r\n    {\r\n      *aglyph = FTC_INODE( node )->glyph;\r\n\r\n      if ( anode )\r\n      {\r\n        *anode = node;\r\n        node->ref_count++;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /* yet another backwards-legacy structure */\r\n  typedef struct  FTC_OldImage_Desc_\r\n  {\r\n    FTC_FontRec  font;\r\n    FT_UInt      image_type;\r\n\r\n  } FTC_OldImage_Desc;\r\n\r\n\r\n#define FTC_OLD_IMAGE_FORMAT( x )  ( (x) & 7 )\r\n\r\n\r\n#define ftc_old_image_format_bitmap    0x0000\r\n#define ftc_old_image_format_outline   0x0001\r\n\r\n#define ftc_old_image_format_mask      0x000F\r\n\r\n#define ftc_old_image_flag_monochrome  0x0010\r\n#define ftc_old_image_flag_unhinted    0x0020\r\n#define ftc_old_image_flag_autohinted  0x0040\r\n#define ftc_old_image_flag_unscaled    0x0080\r\n#define ftc_old_image_flag_no_sbits    0x0100\r\n\r\n  /* monochrome bitmap */\r\n#define ftc_old_image_mono             ftc_old_image_format_bitmap   | \\\r\n                                       ftc_old_image_flag_monochrome\r\n\r\n  /* anti-aliased bitmap */\r\n#define ftc_old_image_grays            ftc_old_image_format_bitmap\r\n\r\n  /* scaled outline */\r\n#define ftc_old_image_outline          ftc_old_image_format_outline\r\n\r\n\r\n  static void\r\n  ftc_image_type_from_old_desc( FTC_ImageType       typ,\r\n                                FTC_OldImage_Desc*  desc )\r\n  {\r\n    typ->face_id = desc->font.face_id;\r\n    typ->width   = desc->font.pix_width;\r\n    typ->height  = desc->font.pix_height;\r\n\r\n    /* convert image type flags to load flags */\r\n    {\r\n      FT_UInt  load_flags = FT_LOAD_DEFAULT;\r\n      FT_UInt  type       = desc->image_type;\r\n\r\n\r\n      /* determine load flags, depending on the font description's */\r\n      /* image type                                                */\r\n\r\n      if ( FTC_OLD_IMAGE_FORMAT( type ) == ftc_old_image_format_bitmap )\r\n      {\r\n        if ( type & ftc_old_image_flag_monochrome )\r\n          load_flags |= FT_LOAD_MONOCHROME;\r\n\r\n        /* disable embedded bitmaps loading if necessary */\r\n        if ( type & ftc_old_image_flag_no_sbits )\r\n          load_flags |= FT_LOAD_NO_BITMAP;\r\n      }\r\n      else\r\n      {\r\n        /* we want an outline, don't load embedded bitmaps */\r\n        load_flags |= FT_LOAD_NO_BITMAP;\r\n\r\n        if ( type & ftc_old_image_flag_unscaled )\r\n          load_flags |= FT_LOAD_NO_SCALE;\r\n      }\r\n\r\n      /* always render glyphs to bitmaps */\r\n      load_flags |= FT_LOAD_RENDER;\r\n\r\n      if ( type & ftc_old_image_flag_unhinted )\r\n        load_flags |= FT_LOAD_NO_HINTING;\r\n\r\n      if ( type & ftc_old_image_flag_autohinted )\r\n        load_flags |= FT_LOAD_FORCE_AUTOHINT;\r\n\r\n      typ->flags = load_flags;\r\n    }\r\n  }\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Image_Cache_New( FTC_Manager      manager,\r\n                       FTC_ImageCache  *acache );\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Image_Cache_Lookup( FTC_ImageCache      icache,\r\n                          FTC_OldImage_Desc*  desc,\r\n                          FT_UInt             gindex,\r\n                          FT_Glyph           *aglyph );\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_Image_Cache_New( FTC_Manager      manager,\r\n                       FTC_ImageCache  *acache )\r\n  {\r\n    return FTC_ImageCache_New( manager, (FTC_ImageCache*)acache );\r\n  }\r\n\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_Image_Cache_Lookup( FTC_ImageCache      icache,\r\n                          FTC_OldImage_Desc*  desc,\r\n                          FT_UInt             gindex,\r\n                          FT_Glyph           *aglyph )\r\n  {\r\n    FTC_ImageTypeRec  type0;\r\n\r\n\r\n    if ( !desc )\r\n      return FTC_Err_Invalid_Argument;\r\n\r\n    ftc_image_type_from_old_desc( &type0, desc );\r\n\r\n    return FTC_ImageCache_Lookup( (FTC_ImageCache)icache,\r\n                                   &type0,\r\n                                   gindex,\r\n                                   aglyph,\r\n                                   NULL );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n /*\r\n  *\r\n  * basic small bitmap cache\r\n  *\r\n  */\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_SFamilyClassRec  ftc_basic_sbit_family_class =\r\n  {\r\n    {\r\n      sizeof ( FTC_BasicFamilyRec ),\r\n      ftc_basic_family_compare,\r\n      ftc_basic_family_init,\r\n      0,                            /* FTC_MruNode_ResetFunc */\r\n      0                             /* FTC_MruNode_DoneFunc  */\r\n    },\r\n    ftc_basic_family_get_count,\r\n    ftc_basic_family_load_bitmap\r\n  };\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_GCacheClassRec  ftc_basic_sbit_cache_class =\r\n  {\r\n    {\r\n      ftc_snode_new,\r\n      ftc_snode_weight,\r\n      ftc_snode_compare,\r\n      ftc_basic_gnode_compare_faceid,\r\n      ftc_snode_free,\r\n\r\n      sizeof ( FTC_GCacheRec ),\r\n      ftc_gcache_init,\r\n      ftc_gcache_done\r\n    },\r\n    (FTC_MruListClass)&ftc_basic_sbit_family_class\r\n  };\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_SBitCache_New( FTC_Manager     manager,\r\n                     FTC_SBitCache  *acache )\r\n  {\r\n    return FTC_GCache_New( manager, &ftc_basic_sbit_cache_class,\r\n                           (FTC_GCache*)acache );\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_SBitCache_Lookup( FTC_SBitCache  cache,\r\n                        FTC_ImageType  type,\r\n                        FT_UInt        gindex,\r\n                        FTC_SBit      *ansbit,\r\n                        FTC_Node      *anode )\r\n  {\r\n    FT_Error           error;\r\n    FTC_BasicQueryRec  query;\r\n    FTC_Node           node = 0; /* make compiler happy */\r\n    FT_PtrDist         hash;\r\n\r\n\r\n    if ( anode )\r\n      *anode = NULL;\r\n\r\n    /* other argument checks delayed to FTC_Cache_Lookup */\r\n    if ( !ansbit )\r\n      return FTC_Err_Invalid_Argument;\r\n\r\n    *ansbit = NULL;\r\n\r\n#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )\r\n\r\n    /*  This one is a major hack used to detect whether we are passed a\r\n     *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.\r\n     */\r\n    if ( (FT_ULong)type->width >= 0x10000L )\r\n    {\r\n      FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;\r\n\r\n\r\n      query.attrs.scaler.face_id = desc->font.face_id;\r\n      query.attrs.scaler.width   = desc->font.pix_width;\r\n      query.attrs.scaler.height  = desc->font.pix_height;\r\n      query.attrs.load_flags     = desc->flags;\r\n    }\r\n    else\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    {\r\n      if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )\r\n      {\r\n        FT_TRACE1(( \"FTC_ImageCache_Lookup: higher bits in load_flags\" ));\r\n        FT_TRACE1(( \"0x%x are dropped\\n\", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));\r\n      }\r\n\r\n      query.attrs.scaler.face_id = type->face_id;\r\n      query.attrs.scaler.width   = type->width;\r\n      query.attrs.scaler.height  = type->height;\r\n      query.attrs.load_flags     = (FT_UInt)type->flags;\r\n    }\r\n\r\n    query.attrs.scaler.pixel = 1;\r\n    query.attrs.scaler.x_res = 0;  /* make compilers happy */\r\n    query.attrs.scaler.y_res = 0;\r\n\r\n    /* beware, the hash must be the same for all glyph ranges! */\r\n    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +\r\n           gindex / FTC_SBIT_ITEMS_PER_NODE;\r\n\r\n#if 1  /* inlining is about 50% faster! */\r\n    FTC_GCACHE_LOOKUP_CMP( cache,\r\n                           ftc_basic_family_compare,\r\n                           FTC_SNode_Compare,\r\n                           hash, gindex,\r\n                           &query,\r\n                           node,\r\n                           error );\r\n#else\r\n    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),\r\n                               hash,\r\n                               gindex,\r\n                               FTC_GQUERY( &query ),\r\n                               &node );\r\n#endif\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    *ansbit = FTC_SNODE( node )->sbits +\r\n              ( gindex - FTC_GNODE( node )->gindex );\r\n\r\n    if ( anode )\r\n    {\r\n      *anode = node;\r\n      node->ref_count++;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_SBitCache_LookupScaler( FTC_SBitCache  cache,\r\n                              FTC_Scaler     scaler,\r\n                              FT_ULong       load_flags,\r\n                              FT_UInt        gindex,\r\n                              FTC_SBit      *ansbit,\r\n                              FTC_Node      *anode )\r\n  {\r\n    FT_Error           error;\r\n    FTC_BasicQueryRec  query;\r\n    FTC_Node           node = 0; /* make compiler happy */\r\n    FT_PtrDist         hash;\r\n\r\n\r\n    if ( anode )\r\n        *anode = NULL;\r\n\r\n    /* other argument checks delayed to FTC_Cache_Lookup */\r\n    if ( !ansbit || !scaler )\r\n        return FTC_Err_Invalid_Argument;\r\n\r\n    *ansbit = NULL;\r\n\r\n    /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */\r\n    if ( load_flags > FT_UINT_MAX )\r\n    {\r\n      FT_TRACE1(( \"FTC_ImageCache_LookupScaler: higher bits in load_flags\" ));\r\n      FT_TRACE1(( \"0x%x are dropped\\n\", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));\r\n    }\r\n\r\n    query.attrs.scaler     = scaler[0];\r\n    query.attrs.load_flags = (FT_UInt)load_flags;\r\n\r\n    /* beware, the hash must be the same for all glyph ranges! */\r\n    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +\r\n             gindex / FTC_SBIT_ITEMS_PER_NODE;\r\n\r\n    FTC_GCACHE_LOOKUP_CMP( cache,\r\n                           ftc_basic_family_compare,\r\n                           FTC_SNode_Compare,\r\n                           hash, gindex,\r\n                           &query,\r\n                           node,\r\n                           error );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    *ansbit = FTC_SNODE( node )->sbits +\r\n              ( gindex - FTC_GNODE( node )->gindex );\r\n\r\n    if ( anode )\r\n    {\r\n      *anode = node;\r\n      node->ref_count++;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBit_Cache_New( FTC_Manager     manager,\r\n                      FTC_SBitCache  *acache );\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBit_Cache_Lookup( FTC_SBitCache       cache,\r\n                         FTC_OldImage_Desc*  desc,\r\n                         FT_UInt             gindex,\r\n                         FTC_SBit           *ansbit );\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_SBit_Cache_New( FTC_Manager     manager,\r\n                      FTC_SBitCache  *acache )\r\n  {\r\n    return FTC_SBitCache_New( manager, (FTC_SBitCache*)acache );\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_SBit_Cache_Lookup( FTC_SBitCache       cache,\r\n                         FTC_OldImage_Desc*  desc,\r\n                         FT_UInt             gindex,\r\n                         FTC_SBit           *ansbit )\r\n  {\r\n    FTC_ImageTypeRec  type0;\r\n\r\n\r\n    if ( !desc )\r\n      return FTC_Err_Invalid_Argument;\r\n\r\n    ftc_image_type_from_old_desc( &type0, desc );\r\n\r\n    return FTC_SBitCache_Lookup( (FTC_SBitCache)cache,\r\n                                  &type0,\r\n                                  gindex,\r\n                                  ansbit,\r\n                                  NULL );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftccache.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftccache.c                                                             */\r\n/*                                                                         */\r\n/*    The FreeType internal cache interface (body).                        */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010,   */\r\n/*            2011 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ftcmanag.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cache\r\n\r\n\r\n#define FTC_HASH_MAX_LOAD  2\r\n#define FTC_HASH_MIN_LOAD  1\r\n#define FTC_HASH_SUB_LOAD  ( FTC_HASH_MAX_LOAD - FTC_HASH_MIN_LOAD )\r\n\r\n  /* this one _must_ be a power of 2! */\r\n#define FTC_HASH_INITIAL_SIZE  8\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                   CACHE NODE DEFINITIONS                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* add a new node to the head of the manager's circular MRU list */\r\n  static void\r\n  ftc_node_mru_link( FTC_Node     node,\r\n                     FTC_Manager  manager )\r\n  {\r\n    void  *nl = &manager->nodes_list;\r\n\r\n\r\n    FTC_MruNode_Prepend( (FTC_MruNode*)nl,\r\n                         (FTC_MruNode)node );\r\n    manager->num_nodes++;\r\n  }\r\n\r\n\r\n  /* remove a node from the manager's MRU list */\r\n  static void\r\n  ftc_node_mru_unlink( FTC_Node     node,\r\n                       FTC_Manager  manager )\r\n  {\r\n    void  *nl = &manager->nodes_list;\r\n\r\n\r\n    FTC_MruNode_Remove( (FTC_MruNode*)nl,\r\n                        (FTC_MruNode)node );\r\n    manager->num_nodes--;\r\n  }\r\n\r\n\r\n#ifndef FTC_INLINE\r\n\r\n  /* move a node to the head of the manager's MRU list */\r\n  static void\r\n  ftc_node_mru_up( FTC_Node     node,\r\n                   FTC_Manager  manager )\r\n  {\r\n    FTC_MruNode_Up( (FTC_MruNode*)&manager->nodes_list,\r\n                    (FTC_MruNode)node );\r\n  }\r\n\r\n\r\n  /* get a top bucket for specified hash from cache,\r\n   * body for FTC_NODE__TOP_FOR_HASH( cache, hash )\r\n   */\r\n  FT_LOCAL_DEF( FTC_Node* )\r\n  ftc_get_top_node_for_hash( FTC_Cache   cache,\r\n                             FT_PtrDist  hash )\r\n  {\r\n    FTC_Node*  pnode;\r\n    FT_UInt    idx;\r\n\r\n\r\n    idx = (FT_UInt)( hash & cache->mask );\r\n    if ( idx < cache->p )\r\n      idx = (FT_UInt)( hash & ( 2 * cache->mask + 1 ) );\r\n    pnode = cache->buckets + idx;\r\n    return pnode;\r\n  }\r\n\r\n#endif /* !FTC_INLINE */\r\n\r\n\r\n  /* Note that this function cannot fail.  If we cannot re-size the\r\n   * buckets array appropriately, we simply degrade the hash table's\r\n   * performance!\r\n   */\r\n  static void\r\n  ftc_cache_resize( FTC_Cache  cache )\r\n  {\r\n    for (;;)\r\n    {\r\n      FTC_Node  node, *pnode;\r\n      FT_UFast  p     = cache->p;\r\n      FT_UFast  mask  = cache->mask;\r\n      FT_UFast  count = mask + p + 1;    /* number of buckets */\r\n\r\n\r\n      /* do we need to shrink the buckets array? */\r\n      if ( cache->slack < 0 )\r\n      {\r\n        FTC_Node  new_list = NULL;\r\n\r\n\r\n        /* try to expand the buckets array _before_ splitting\r\n         * the bucket lists\r\n         */\r\n        if ( p >= mask )\r\n        {\r\n          FT_Memory  memory = cache->memory;\r\n          FT_Error   error;\r\n\r\n\r\n          /* if we can't expand the array, leave immediately */\r\n          if ( FT_RENEW_ARRAY( cache->buckets,\r\n                               ( mask + 1 ) * 2, ( mask + 1 ) * 4 ) )\r\n            break;\r\n        }\r\n\r\n        /* split a single bucket */\r\n        pnode = cache->buckets + p;\r\n\r\n        for (;;)\r\n        {\r\n          node = *pnode;\r\n          if ( node == NULL )\r\n            break;\r\n\r\n          if ( node->hash & ( mask + 1 ) )\r\n          {\r\n            *pnode     = node->link;\r\n            node->link = new_list;\r\n            new_list   = node;\r\n          }\r\n          else\r\n            pnode = &node->link;\r\n        }\r\n\r\n        cache->buckets[p + mask + 1] = new_list;\r\n\r\n        cache->slack += FTC_HASH_MAX_LOAD;\r\n\r\n        if ( p >= mask )\r\n        {\r\n          cache->mask = 2 * mask + 1;\r\n          cache->p    = 0;\r\n        }\r\n        else\r\n          cache->p = p + 1;\r\n      }\r\n\r\n      /* do we need to expand the buckets array? */\r\n      else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD )\r\n      {\r\n        FT_UFast   old_index = p + mask;\r\n        FTC_Node*  pold;\r\n\r\n\r\n        if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE )\r\n          break;\r\n\r\n        if ( p == 0 )\r\n        {\r\n          FT_Memory  memory = cache->memory;\r\n          FT_Error   error;\r\n\r\n\r\n          /* if we can't shrink the array, leave immediately */\r\n          if ( FT_RENEW_ARRAY( cache->buckets,\r\n                               ( mask + 1 ) * 2, mask + 1 ) )\r\n            break;\r\n\r\n          cache->mask >>= 1;\r\n          p             = cache->mask;\r\n        }\r\n        else\r\n          p--;\r\n\r\n        pnode = cache->buckets + p;\r\n        while ( *pnode )\r\n          pnode = &(*pnode)->link;\r\n\r\n        pold   = cache->buckets + old_index;\r\n        *pnode = *pold;\r\n        *pold  = NULL;\r\n\r\n        cache->slack -= FTC_HASH_MAX_LOAD;\r\n        cache->p      = p;\r\n      }\r\n\r\n      /* otherwise, the hash table is balanced */\r\n      else\r\n        break;\r\n    }\r\n  }\r\n\r\n\r\n  /* remove a node from its cache's hash table */\r\n  static void\r\n  ftc_node_hash_unlink( FTC_Node   node0,\r\n                        FTC_Cache  cache )\r\n  {\r\n    FTC_Node  *pnode = FTC_NODE__TOP_FOR_HASH( cache, node0->hash );\r\n\r\n\r\n    for (;;)\r\n    {\r\n      FTC_Node  node = *pnode;\r\n\r\n\r\n      if ( node == NULL )\r\n      {\r\n        FT_TRACE0(( \"ftc_node_hash_unlink: unknown node\\n\" ));\r\n        return;\r\n      }\r\n\r\n      if ( node == node0 )\r\n        break;\r\n\r\n      pnode = &(*pnode)->link;\r\n    }\r\n\r\n    *pnode      = node0->link;\r\n    node0->link = NULL;\r\n\r\n    cache->slack++;\r\n    ftc_cache_resize( cache );\r\n  }\r\n\r\n\r\n  /* add a node to the `top' of its cache's hash table */\r\n  static void\r\n  ftc_node_hash_link( FTC_Node   node,\r\n                      FTC_Cache  cache )\r\n  {\r\n    FTC_Node  *pnode = FTC_NODE__TOP_FOR_HASH( cache, node->hash );\r\n\r\n\r\n    node->link = *pnode;\r\n    *pnode     = node;\r\n\r\n    cache->slack--;\r\n    ftc_cache_resize( cache );\r\n  }\r\n\r\n\r\n  /* remove a node from the cache manager */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n  FT_BASE_DEF( void )\r\n#else\r\n  FT_LOCAL_DEF( void )\r\n#endif\r\n  ftc_node_destroy( FTC_Node     node,\r\n                    FTC_Manager  manager )\r\n  {\r\n    FTC_Cache  cache;\r\n\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n    /* find node's cache */\r\n    if ( node->cache_index >= manager->num_caches )\r\n    {\r\n      FT_TRACE0(( \"ftc_node_destroy: invalid node handle\\n\" ));\r\n      return;\r\n    }\r\n#endif\r\n\r\n    cache = manager->caches[node->cache_index];\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n    if ( cache == NULL )\r\n    {\r\n      FT_TRACE0(( \"ftc_node_destroy: invalid node handle\\n\" ));\r\n      return;\r\n    }\r\n#endif\r\n\r\n    manager->cur_weight -= cache->clazz.node_weight( node, cache );\r\n\r\n    /* remove node from mru list */\r\n    ftc_node_mru_unlink( node, manager );\r\n\r\n    /* remove node from cache's hash table */\r\n    ftc_node_hash_unlink( node, cache );\r\n\r\n    /* now finalize it */\r\n    cache->clazz.node_free( node, cache );\r\n\r\n#if 0\r\n    /* check, just in case of general corruption :-) */\r\n    if ( manager->num_nodes == 0 )\r\n      FT_TRACE0(( \"ftc_node_destroy: invalid cache node count (%d)\\n\",\r\n                  manager->num_nodes ));\r\n#endif\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    ABSTRACT CACHE CLASS                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_Cache_Init( FTC_Cache  cache )\r\n  {\r\n    return ftc_cache_init( cache );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ftc_cache_init( FTC_Cache  cache )\r\n  {\r\n    FT_Memory  memory = cache->memory;\r\n    FT_Error   error;\r\n\r\n\r\n    cache->p     = 0;\r\n    cache->mask  = FTC_HASH_INITIAL_SIZE - 1;\r\n    cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD;\r\n\r\n    (void)FT_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 );\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  FTC_Cache_Clear( FTC_Cache  cache )\r\n  {\r\n    if ( cache && cache->buckets )\r\n    {\r\n      FTC_Manager  manager = cache->manager;\r\n      FT_UFast     i;\r\n      FT_UFast     count;\r\n\r\n\r\n      count = cache->p + cache->mask + 1;\r\n\r\n      for ( i = 0; i < count; i++ )\r\n      {\r\n        FTC_Node  *pnode = cache->buckets + i, next, node = *pnode;\r\n\r\n\r\n        while ( node )\r\n        {\r\n          next        = node->link;\r\n          node->link  = NULL;\r\n\r\n          /* remove node from mru list */\r\n          ftc_node_mru_unlink( node, manager );\r\n\r\n          /* now finalize it */\r\n          manager->cur_weight -= cache->clazz.node_weight( node, cache );\r\n\r\n          cache->clazz.node_free( node, cache );\r\n          node = next;\r\n        }\r\n        cache->buckets[i] = NULL;\r\n      }\r\n      ftc_cache_resize( cache );\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ftc_cache_done( FTC_Cache  cache )\r\n  {\r\n    if ( cache->memory )\r\n    {\r\n      FT_Memory  memory = cache->memory;\r\n\r\n\r\n      FTC_Cache_Clear( cache );\r\n\r\n      FT_FREE( cache->buckets );\r\n      cache->mask  = 0;\r\n      cache->p     = 0;\r\n      cache->slack = 0;\r\n\r\n      cache->memory = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_Cache_Done( FTC_Cache  cache )\r\n  {\r\n    ftc_cache_done( cache );\r\n  }\r\n\r\n\r\n  static void\r\n  ftc_cache_add( FTC_Cache  cache,\r\n                 FT_PtrDist hash,\r\n                 FTC_Node   node )\r\n  {\r\n    node->hash        = hash;\r\n    node->cache_index = (FT_UInt16)cache->index;\r\n    node->ref_count   = 0;\r\n\r\n    ftc_node_hash_link( node, cache );\r\n    ftc_node_mru_link( node, cache->manager );\r\n\r\n    {\r\n      FTC_Manager  manager = cache->manager;\r\n\r\n\r\n      manager->cur_weight += cache->clazz.node_weight( node, cache );\r\n\r\n      if ( manager->cur_weight >= manager->max_weight )\r\n      {\r\n        node->ref_count++;\r\n        FTC_Manager_Compress( manager );\r\n        node->ref_count--;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_Cache_NewNode( FTC_Cache   cache,\r\n                     FT_PtrDist  hash,\r\n                     FT_Pointer  query,\r\n                     FTC_Node   *anode )\r\n  {\r\n    FT_Error  error;\r\n    FTC_Node  node;\r\n\r\n\r\n    /*\r\n     * We use the FTC_CACHE_TRYLOOP macros to support out-of-memory\r\n     * errors (OOM) correctly, i.e., by flushing the cache progressively\r\n     * in order to make more room.\r\n     */\r\n\r\n    FTC_CACHE_TRYLOOP( cache )\r\n    {\r\n      error = cache->clazz.node_new( &node, query, cache );\r\n    }\r\n    FTC_CACHE_TRYLOOP_END( NULL );\r\n\r\n    if ( error )\r\n      node = NULL;\r\n    else\r\n    {\r\n     /* don't assume that the cache has the same number of buckets, since\r\n      * our allocation request might have triggered global cache flushing\r\n      */\r\n      ftc_cache_add( cache, hash, node );\r\n    }\r\n\r\n    *anode = node;\r\n    return error;\r\n  }\r\n\r\n\r\n#ifndef FTC_INLINE\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_Cache_Lookup( FTC_Cache   cache,\r\n                    FT_PtrDist  hash,\r\n                    FT_Pointer  query,\r\n                    FTC_Node   *anode )\r\n  {\r\n    FTC_Node*  bucket;\r\n    FTC_Node*  pnode;\r\n    FTC_Node   node;\r\n    FT_Error   error        = FTC_Err_Ok;\r\n    FT_Bool    list_changed = FALSE;\r\n\r\n    FTC_Node_CompareFunc  compare = cache->clazz.node_compare;\r\n\r\n\r\n    if ( cache == NULL || anode == NULL )\r\n      return FTC_Err_Invalid_Argument;\r\n\r\n    /* Go to the `top' node of the list sharing same masked hash */\r\n    bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash );\r\n\r\n    /* Lookup a node with exactly same hash and queried properties.  */\r\n    /* NOTE: _nodcomp() may change the linked list to reduce memory. */\r\n    for (;;)\r\n    {\r\n      node = *pnode;\r\n      if ( node == NULL )\r\n        goto NewNode;\r\n\r\n      if ( node->hash == hash                           &&\r\n           compare( node, query, cache, &list_changed ) )\r\n        break;\r\n\r\n      pnode = &node->link;\r\n    }\r\n\r\n    if ( list_changed )\r\n    {\r\n      /* Update bucket by modified linked list */\r\n      bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash );\r\n\r\n      /* Update pnode by modified linked list */\r\n      while ( *pnode != node )\r\n      {\r\n        if ( *pnode == NULL )\r\n        {\r\n          FT_ERROR(( \"FTC_Cache_Lookup: oops!!!  node missing\\n\" ));\r\n          goto NewNode;\r\n        }\r\n        else\r\n          pnode = &((*pnode)->link);\r\n      }\r\n    }\r\n\r\n    /* Reorder the list to move the found node to the `top' */\r\n    if ( node != *bucket )\r\n    {\r\n      *pnode     = node->link;\r\n      node->link = *bucket;\r\n      *bucket    = node;\r\n    }\r\n\r\n    /* move to head of MRU list */\r\n    {\r\n      FTC_Manager  manager = cache->manager;\r\n\r\n\r\n      if ( node != manager->nodes_list )\r\n        ftc_node_mru_up( node, manager );\r\n    }\r\n    *anode = node;\r\n\r\n    return error;\r\n\r\n  NewNode:\r\n    return FTC_Cache_NewNode( cache, hash, query, anode );\r\n  }\r\n\r\n#endif /* !FTC_INLINE */\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_Cache_RemoveFaceID( FTC_Cache   cache,\r\n                          FTC_FaceID  face_id )\r\n  {\r\n    FT_UFast     i, count;\r\n    FTC_Manager  manager = cache->manager;\r\n    FTC_Node     frees   = NULL;\r\n\r\n\r\n    count = cache->p + cache->mask + 1;\r\n    for ( i = 0; i < count; i++ )\r\n    {\r\n      FTC_Node*  bucket = cache->buckets + i;\r\n      FTC_Node*  pnode  = bucket;\r\n\r\n\r\n      for ( ;; )\r\n      {\r\n        FTC_Node  node = *pnode;\r\n        FT_Bool   list_changed = FALSE;\r\n\r\n\r\n        if ( node == NULL )\r\n          break;\r\n\r\n        if ( cache->clazz.node_remove_faceid( node, face_id,\r\n                                              cache, &list_changed ) )\r\n        {\r\n          *pnode     = node->link;\r\n          node->link = frees;\r\n          frees      = node;\r\n        }\r\n        else\r\n          pnode = &node->link;\r\n      }\r\n    }\r\n\r\n    /* remove all nodes in the free list */\r\n    while ( frees )\r\n    {\r\n      FTC_Node  node;\r\n\r\n\r\n      node  = frees;\r\n      frees = node->link;\r\n\r\n      manager->cur_weight -= cache->clazz.node_weight( node, cache );\r\n      ftc_node_mru_unlink( node, manager );\r\n\r\n      cache->clazz.node_free( node, cache );\r\n\r\n      cache->slack++;\r\n    }\r\n\r\n    ftc_cache_resize( cache );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftccache.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftccache.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType internal cache interface (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010,   */\r\n/*            2011 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCCACHE_H__\r\n#define __FTCCACHE_H__\r\n\r\n\r\n#include \"ftcmru.h\"\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#define _FTC_FACE_ID_HASH( i )                                                \\\r\n          ((FT_PtrDist)(( (FT_PtrDist)(i) >> 3 ) ^ ( (FT_PtrDist)(i) << 7 )))\r\n\r\n  /* handle to cache object */\r\n  typedef struct FTC_CacheRec_*  FTC_Cache;\r\n\r\n  /* handle to cache class */\r\n  typedef const struct FTC_CacheClassRec_*  FTC_CacheClass;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                   CACHE NODE DEFINITIONS                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Each cache controls one or more cache nodes.  Each node is part of    */\r\n  /* the global_lru list of the manager.  Its `data' field however is used */\r\n  /* as a reference count for now.                                         */\r\n  /*                                                                       */\r\n  /* A node can be anything, depending on the type of information held by  */\r\n  /* the cache.  It can be an individual glyph image, a set of bitmaps     */\r\n  /* glyphs for a given size, some metrics, etc.                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /* structure size should be 20 bytes on 32-bits machines */\r\n  typedef struct  FTC_NodeRec_\r\n  {\r\n    FTC_MruNodeRec  mru;          /* circular mru list pointer           */\r\n    FTC_Node        link;         /* used for hashing                    */\r\n    FT_PtrDist      hash;         /* used for hashing too                */\r\n    FT_UShort       cache_index;  /* index of cache the node belongs to  */\r\n    FT_Short        ref_count;    /* reference count for this node       */\r\n\r\n  } FTC_NodeRec;\r\n\r\n\r\n#define FTC_NODE( x )    ( (FTC_Node)(x) )\r\n#define FTC_NODE_P( x )  ( (FTC_Node*)(x) )\r\n\r\n#define FTC_NODE__NEXT( x )  FTC_NODE( (x)->mru.next )\r\n#define FTC_NODE__PREV( x )  FTC_NODE( (x)->mru.prev )\r\n\r\n#ifdef FTC_INLINE\r\n#define FTC_NODE__TOP_FOR_HASH( cache, hash )                     \\\r\n        ( ( cache )->buckets +                                    \\\r\n            ( ( ( ( hash ) &   ( cache )->mask ) < ( cache )->p ) \\\r\n              ? ( ( hash ) & ( ( cache )->mask * 2 + 1 ) )        \\\r\n              : ( ( hash ) &   ( cache )->mask ) ) )\r\n#else\r\n  FT_LOCAL( FTC_Node* )\r\n  ftc_get_top_node_for_hash( FTC_Cache   cache,\r\n                             FT_PtrDist  hash );\r\n#define FTC_NODE__TOP_FOR_HASH( cache, hash )            \\\r\n        ftc_get_top_node_for_hash( ( cache ), ( hash ) )\r\n#endif\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n  FT_BASE( void )\r\n  ftc_node_destroy( FTC_Node     node,\r\n                    FTC_Manager  manager );\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       CACHE DEFINITIONS                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* initialize a new cache node */\r\n  typedef FT_Error\r\n  (*FTC_Node_NewFunc)( FTC_Node    *pnode,\r\n                       FT_Pointer   query,\r\n                       FTC_Cache    cache );\r\n\r\n  typedef FT_Offset\r\n  (*FTC_Node_WeightFunc)( FTC_Node   node,\r\n                          FTC_Cache  cache );\r\n\r\n  /* compare a node to a given key pair */\r\n  typedef FT_Bool\r\n  (*FTC_Node_CompareFunc)( FTC_Node    node,\r\n                           FT_Pointer  key,\r\n                           FTC_Cache   cache,\r\n                           FT_Bool*    list_changed );\r\n\r\n\r\n  typedef void\r\n  (*FTC_Node_FreeFunc)( FTC_Node   node,\r\n                        FTC_Cache  cache );\r\n\r\n  typedef FT_Error\r\n  (*FTC_Cache_InitFunc)( FTC_Cache  cache );\r\n\r\n  typedef void\r\n  (*FTC_Cache_DoneFunc)( FTC_Cache  cache );\r\n\r\n\r\n  typedef struct  FTC_CacheClassRec_\r\n  {\r\n    FTC_Node_NewFunc      node_new;\r\n    FTC_Node_WeightFunc   node_weight;\r\n    FTC_Node_CompareFunc  node_compare;\r\n    FTC_Node_CompareFunc  node_remove_faceid;\r\n    FTC_Node_FreeFunc     node_free;\r\n\r\n    FT_Offset             cache_size;\r\n    FTC_Cache_InitFunc    cache_init;\r\n    FTC_Cache_DoneFunc    cache_done;\r\n\r\n  } FTC_CacheClassRec;\r\n\r\n\r\n  /* each cache really implements a dynamic hash table to manage its nodes */\r\n  typedef struct  FTC_CacheRec_\r\n  {\r\n    FT_UFast           p;\r\n    FT_UFast           mask;\r\n    FT_Long            slack;\r\n    FTC_Node*          buckets;\r\n\r\n    FTC_CacheClassRec  clazz;       /* local copy, for speed  */\r\n\r\n    FTC_Manager        manager;\r\n    FT_Memory          memory;\r\n    FT_UInt            index;       /* in manager's table     */\r\n\r\n    FTC_CacheClass     org_class;   /* original class pointer */\r\n\r\n  } FTC_CacheRec;\r\n\r\n\r\n#define FTC_CACHE( x )    ( (FTC_Cache)(x) )\r\n#define FTC_CACHE_P( x )  ( (FTC_Cache*)(x) )\r\n\r\n\r\n  /* default cache initialize */\r\n  FT_LOCAL( FT_Error )\r\n  FTC_Cache_Init( FTC_Cache  cache );\r\n\r\n  /* default cache finalizer */\r\n  FT_LOCAL( void )\r\n  FTC_Cache_Done( FTC_Cache  cache );\r\n\r\n  /* Call this function to look up the cache.  If no corresponding\r\n   * node is found, a new one is automatically created.  This function\r\n   * is capable of flushing the cache adequately to make room for the\r\n   * new cache object.\r\n   */\r\n\r\n#ifndef FTC_INLINE\r\n  FT_LOCAL( FT_Error )\r\n  FTC_Cache_Lookup( FTC_Cache   cache,\r\n                    FT_PtrDist  hash,\r\n                    FT_Pointer  query,\r\n                    FTC_Node   *anode );\r\n#endif\r\n\r\n  FT_LOCAL( FT_Error )\r\n  FTC_Cache_NewNode( FTC_Cache   cache,\r\n                     FT_PtrDist  hash,\r\n                     FT_Pointer  query,\r\n                     FTC_Node   *anode );\r\n\r\n  /* Remove all nodes that relate to a given face_id.  This is useful\r\n   * when un-installing fonts.  Note that if a cache node relates to\r\n   * the face_id but is locked (i.e., has `ref_count > 0'), the node\r\n   * will _not_ be destroyed, but its internal face_id reference will\r\n   * be modified.\r\n   *\r\n   * The final result will be that the node will never come back\r\n   * in further lookup requests, and will be flushed on demand from\r\n   * the cache normally when its reference count reaches 0.\r\n   */\r\n  FT_LOCAL( void )\r\n  FTC_Cache_RemoveFaceID( FTC_Cache   cache,\r\n                          FTC_FaceID  face_id );\r\n\r\n\r\n#ifdef FTC_INLINE\r\n\r\n#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \\\r\n  FT_BEGIN_STMNT                                                         \\\r\n    FTC_Node             *_bucket, *_pnode, _node;                       \\\r\n    FTC_Cache             _cache   = FTC_CACHE(cache);                   \\\r\n    FT_PtrDist            _hash    = (FT_PtrDist)(hash);                 \\\r\n    FTC_Node_CompareFunc  _nodcomp = (FTC_Node_CompareFunc)(nodecmp);    \\\r\n    FT_Bool               _list_changed = FALSE;                         \\\r\n                                                                         \\\r\n                                                                         \\\r\n    error = FTC_Err_Ok;                                                  \\\r\n    node  = NULL;                                                        \\\r\n                                                                         \\\r\n    /* Go to the `top' node of the list sharing same masked hash */      \\\r\n    _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash );          \\\r\n                                                                         \\\r\n    /* Look up a node with identical hash and queried properties.    */  \\\r\n    /* NOTE: _nodcomp() may change the linked list to reduce memory. */  \\\r\n    for (;;)                                                             \\\r\n    {                                                                    \\\r\n      _node = *_pnode;                                                   \\\r\n      if ( _node == NULL )                                               \\\r\n        goto _NewNode;                                                   \\\r\n                                                                         \\\r\n      if ( _node->hash == _hash                             &&           \\\r\n           _nodcomp( _node, query, _cache, &_list_changed ) )            \\\r\n        break;                                                           \\\r\n                                                                         \\\r\n      _pnode = &_node->link;                                             \\\r\n    }                                                                    \\\r\n                                                                         \\\r\n    if ( _list_changed )                                                 \\\r\n    {                                                                    \\\r\n      /* Update _bucket by possibly modified linked list */              \\\r\n      _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash );        \\\r\n                                                                         \\\r\n      /* Update _pnode by possibly modified linked list */               \\\r\n      while ( *_pnode != _node )                                         \\\r\n      {                                                                  \\\r\n        if ( *_pnode == NULL )                                           \\\r\n        {                                                                \\\r\n          FT_ERROR(( \"FTC_CACHE_LOOKUP_CMP: oops!!! node missing\\n\" ));  \\\r\n          goto _NewNode;                                                 \\\r\n        }                                                                \\\r\n        else                                                             \\\r\n          _pnode = &((*_pnode)->link);                                   \\\r\n      }                                                                  \\\r\n    }                                                                    \\\r\n                                                                         \\\r\n    /* Reorder the list to move the found node to the `top' */           \\\r\n    if ( _node != *_bucket )                                             \\\r\n    {                                                                    \\\r\n      *_pnode     = _node->link;                                         \\\r\n      _node->link = *_bucket;                                            \\\r\n      *_bucket    = _node;                                               \\\r\n    }                                                                    \\\r\n                                                                         \\\r\n    /* Update MRU list */                                                \\\r\n    {                                                                    \\\r\n      FTC_Manager  _manager = _cache->manager;                           \\\r\n      void*        _nl      = &_manager->nodes_list;                     \\\r\n                                                                         \\\r\n                                                                         \\\r\n      if ( _node != _manager->nodes_list )                               \\\r\n        FTC_MruNode_Up( (FTC_MruNode*)_nl,                               \\\r\n                        (FTC_MruNode)_node );                            \\\r\n    }                                                                    \\\r\n    goto _Ok;                                                            \\\r\n                                                                         \\\r\n  _NewNode:                                                              \\\r\n    error = FTC_Cache_NewNode( _cache, _hash, query, &_node );           \\\r\n                                                                         \\\r\n  _Ok:                                                                   \\\r\n    node = _node;                                                        \\\r\n  FT_END_STMNT\r\n\r\n#else /* !FTC_INLINE */\r\n\r\n#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \\\r\n  FT_BEGIN_STMNT                                                         \\\r\n    error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query,           \\\r\n                              (FTC_Node*)&(node) );                      \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !FTC_INLINE */\r\n\r\n\r\n  /*\r\n   * This macro, together with FTC_CACHE_TRYLOOP_END, defines a retry\r\n   * loop to flush the cache repeatedly in case of memory overflows.\r\n   *\r\n   * It is used when creating a new cache node, or within a lookup\r\n   * that needs to allocate data (e.g. the sbit cache lookup).\r\n   *\r\n   * Example:\r\n   *\r\n   *   {\r\n   *     FTC_CACHE_TRYLOOP( cache )\r\n   *       error = load_data( ... );\r\n   *     FTC_CACHE_TRYLOOP_END()\r\n   *   }\r\n   *\r\n   */\r\n#define FTC_CACHE_TRYLOOP( cache )                           \\\r\n  {                                                          \\\r\n    FTC_Manager  _try_manager = FTC_CACHE( cache )->manager; \\\r\n    FT_UInt      _try_count   = 4;                           \\\r\n                                                             \\\r\n                                                             \\\r\n    for (;;)                                                 \\\r\n    {                                                        \\\r\n      FT_UInt  _try_done;\r\n\r\n\r\n#define FTC_CACHE_TRYLOOP_END( list_changed )                     \\\r\n      if ( !error || error != FTC_Err_Out_Of_Memory )             \\\r\n        break;                                                    \\\r\n                                                                  \\\r\n      _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \\\r\n      if ( _try_done > 0 && ( list_changed ) )                    \\\r\n        *(FT_Bool*)( list_changed ) = TRUE;                       \\\r\n                                                                  \\\r\n      if ( _try_done == 0 )                                       \\\r\n        break;                                                    \\\r\n                                                                  \\\r\n      if ( _try_done == _try_count )                              \\\r\n      {                                                           \\\r\n        _try_count *= 2;                                          \\\r\n        if ( _try_count < _try_done              ||               \\\r\n            _try_count > _try_manager->num_nodes )                \\\r\n          _try_count = _try_manager->num_nodes;                   \\\r\n      }                                                           \\\r\n    }                                                             \\\r\n  }\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTCCACHE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftccback.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftccback.h                                                             */\r\n/*                                                                         */\r\n/*    Callback functions of the caching sub-system (specification only).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2011 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#ifndef __FTCCBACK_H__\r\n#define __FTCCBACK_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcmru.h\"\r\n#include \"ftcimage.h\"\r\n#include \"ftcmanag.h\"\r\n#include \"ftcglyph.h\"\r\n#include \"ftcsbits.h\"\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ftc_inode_free( FTC_Node   inode,\r\n                  FTC_Cache  cache );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ftc_inode_new( FTC_Node   *pinode,\r\n                 FT_Pointer  gquery,\r\n                 FTC_Cache   cache );\r\n\r\n  FT_LOCAL( FT_Offset )\r\n  ftc_inode_weight( FTC_Node   inode,\r\n                    FTC_Cache  cache );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ftc_snode_free( FTC_Node   snode,\r\n                  FTC_Cache  cache );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ftc_snode_new( FTC_Node   *psnode,\r\n                 FT_Pointer  gquery,\r\n                 FTC_Cache   cache );\r\n\r\n  FT_LOCAL( FT_Offset )\r\n  ftc_snode_weight( FTC_Node   snode,\r\n                    FTC_Cache  cache );\r\n\r\n  FT_LOCAL( FT_Bool )\r\n  ftc_snode_compare( FTC_Node    snode,\r\n                     FT_Pointer  gquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed );\r\n\r\n\r\n  FT_LOCAL( FT_Bool )\r\n  ftc_gnode_compare( FTC_Node    gnode,\r\n                     FT_Pointer  gquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ftc_gcache_init( FTC_Cache  cache );\r\n\r\n  FT_LOCAL( void )\r\n  ftc_gcache_done( FTC_Cache  cache );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ftc_cache_init( FTC_Cache  cache );\r\n\r\n  FT_LOCAL( void )\r\n  ftc_cache_done( FTC_Cache  cache );\r\n\r\n#ifndef FT_CONFIG_OPTION_OLD_INTERNALS\r\n  FT_LOCAL( void )\r\n  ftc_node_destroy( FTC_Node     node,\r\n                    FTC_Manager  manager );\r\n#endif\r\n\r\n#endif /* __FTCCBACK_H__ */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftccmap.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftccmap.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType CharMap cache (body)                                        */\r\n/*                                                                         */\r\n/*  Copyright 2000-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_CACHE_H\r\n#include \"ftcmanag.h\"\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cache\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  typedef enum  FTC_OldCMapType_\r\n  {\r\n    FTC_OLD_CMAP_BY_INDEX    = 0,\r\n    FTC_OLD_CMAP_BY_ENCODING = 1,\r\n    FTC_OLD_CMAP_BY_ID       = 2\r\n\r\n  } FTC_OldCMapType;\r\n\r\n\r\n  typedef struct  FTC_OldCMapIdRec_\r\n  {\r\n    FT_UInt  platform;\r\n    FT_UInt  encoding;\r\n\r\n  } FTC_OldCMapIdRec, *FTC_OldCMapId;\r\n\r\n\r\n  typedef struct  FTC_OldCMapDescRec_\r\n  {\r\n    FTC_FaceID       face_id;\r\n    FTC_OldCMapType  type;\r\n\r\n    union\r\n    {\r\n      FT_UInt           index;\r\n      FT_Encoding       encoding;\r\n      FTC_OldCMapIdRec  id;\r\n\r\n    } u;\r\n\r\n  } FTC_OldCMapDescRec, *FTC_OldCMapDesc;\r\n\r\n#endif /* FT_CONFIG_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Each FTC_CMapNode contains a simple array to map a range of character */\r\n  /* codes to equivalent glyph indices.                                    */\r\n  /*                                                                       */\r\n  /* For now, the implementation is very basic: Each node maps a range of  */\r\n  /* 128 consecutive character codes to their corresponding glyph indices. */\r\n  /*                                                                       */\r\n  /* We could do more complex things, but I don't think it is really very  */\r\n  /* useful.                                                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* number of glyph indices / character code per node */\r\n#define FTC_CMAP_INDICES_MAX  128\r\n\r\n  /* compute a query/node hash */\r\n#define FTC_CMAP_HASH( faceid, index, charcode )         \\\r\n          ( _FTC_FACE_ID_HASH( faceid ) + 211 * (index) + \\\r\n            ( (charcode) / FTC_CMAP_INDICES_MAX )      )\r\n\r\n  /* the charmap query */\r\n  typedef struct  FTC_CMapQueryRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_UInt     cmap_index;\r\n    FT_UInt32   char_code;\r\n\r\n  } FTC_CMapQueryRec, *FTC_CMapQuery;\r\n\r\n#define FTC_CMAP_QUERY( x )  ((FTC_CMapQuery)(x))\r\n#define FTC_CMAP_QUERY_HASH( x )                                         \\\r\n          FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )\r\n\r\n  /* the cmap cache node */\r\n  typedef struct  FTC_CMapNodeRec_\r\n  {\r\n    FTC_NodeRec  node;\r\n    FTC_FaceID   face_id;\r\n    FT_UInt      cmap_index;\r\n    FT_UInt32    first;                         /* first character in node */\r\n    FT_UInt16    indices[FTC_CMAP_INDICES_MAX]; /* array of glyph indices  */\r\n\r\n  } FTC_CMapNodeRec, *FTC_CMapNode;\r\n\r\n#define FTC_CMAP_NODE( x ) ( (FTC_CMapNode)( x ) )\r\n#define FTC_CMAP_NODE_HASH( x )                                      \\\r\n          FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )\r\n\r\n  /* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */\r\n  /* glyph indices haven't been queried through FT_Get_Glyph_Index() yet   */\r\n#define FTC_CMAP_UNKNOWN  (FT_UInt16)~0\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        CHARMAP NODES                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ftc_cmap_node_free( FTC_Node   ftcnode,\r\n                      FTC_Cache  cache )\r\n  {\r\n    FTC_CMapNode  node   = (FTC_CMapNode)ftcnode;\r\n    FT_Memory     memory = cache->memory;\r\n\r\n\r\n    FT_FREE( node );\r\n  }\r\n\r\n\r\n  /* initialize a new cmap node */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_cmap_node_new( FTC_Node   *ftcanode,\r\n                     FT_Pointer  ftcquery,\r\n                     FTC_Cache   cache )\r\n  {\r\n    FTC_CMapNode  *anode  = (FTC_CMapNode*)ftcanode;\r\n    FTC_CMapQuery  query  = (FTC_CMapQuery)ftcquery;\r\n    FT_Error       error;\r\n    FT_Memory      memory = cache->memory;\r\n    FTC_CMapNode   node   = NULL;\r\n    FT_UInt        nn;\r\n\r\n\r\n    if ( !FT_NEW( node ) )\r\n    {\r\n      node->face_id    = query->face_id;\r\n      node->cmap_index = query->cmap_index;\r\n      node->first      = (query->char_code / FTC_CMAP_INDICES_MAX) *\r\n                         FTC_CMAP_INDICES_MAX;\r\n\r\n      for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )\r\n        node->indices[nn] = FTC_CMAP_UNKNOWN;\r\n    }\r\n\r\n    *anode = node;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* compute the weight of a given cmap node */\r\n  FT_CALLBACK_DEF( FT_Offset )\r\n  ftc_cmap_node_weight( FTC_Node   cnode,\r\n                        FTC_Cache  cache )\r\n  {\r\n    FT_UNUSED( cnode );\r\n    FT_UNUSED( cache );\r\n\r\n    return sizeof ( *cnode );\r\n  }\r\n\r\n\r\n  /* compare a cmap node to a given query */\r\n  FT_CALLBACK_DEF( FT_Bool )\r\n  ftc_cmap_node_compare( FTC_Node    ftcnode,\r\n                         FT_Pointer  ftcquery,\r\n                         FTC_Cache   cache,\r\n                         FT_Bool*    list_changed )\r\n  {\r\n    FTC_CMapNode   node  = (FTC_CMapNode)ftcnode;\r\n    FTC_CMapQuery  query = (FTC_CMapQuery)ftcquery;\r\n    FT_UNUSED( cache );\r\n\r\n\r\n    if ( list_changed )\r\n      *list_changed = FALSE;\r\n    if ( node->face_id    == query->face_id    &&\r\n         node->cmap_index == query->cmap_index )\r\n    {\r\n      FT_UInt32  offset = (FT_UInt32)( query->char_code - node->first );\r\n\r\n\r\n      return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Bool )\r\n  ftc_cmap_node_remove_faceid( FTC_Node    ftcnode,\r\n                               FT_Pointer  ftcface_id,\r\n                               FTC_Cache   cache,\r\n                               FT_Bool*    list_changed )\r\n  {\r\n    FTC_CMapNode  node    = (FTC_CMapNode)ftcnode;\r\n    FTC_FaceID    face_id = (FTC_FaceID)ftcface_id;\r\n    FT_UNUSED( cache );\r\n\r\n\r\n    if ( list_changed )\r\n      *list_changed = FALSE;\r\n    return FT_BOOL( node->face_id == face_id );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GLYPH IMAGE CACHE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_CacheClassRec  ftc_cmap_cache_class =\r\n  {\r\n    ftc_cmap_node_new,\r\n    ftc_cmap_node_weight,\r\n    ftc_cmap_node_compare,\r\n    ftc_cmap_node_remove_faceid,\r\n    ftc_cmap_node_free,\r\n\r\n    sizeof ( FTC_CacheRec ),\r\n    ftc_cache_init,\r\n    ftc_cache_done,\r\n  };\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_CMapCache_New( FTC_Manager     manager,\r\n                     FTC_CMapCache  *acache )\r\n  {\r\n    return FTC_Manager_RegisterCache( manager,\r\n                                      &ftc_cmap_cache_class,\r\n                                      FTC_CACHE_P( acache ) );\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*\r\n   *  Unfortunately, it is not possible to support binary backwards\r\n   *  compatibility in the cmap cache.  The FTC_CMapCache_Lookup signature\r\n   *  changes were too deep, and there is no clever hackish way to detect\r\n   *  what kind of structure we are being passed.\r\n   *\r\n   *  On the other hand it seems that no production code is using this\r\n   *  function on Unix distributions.\r\n   */\r\n\r\n#endif\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_UInt )\r\n  FTC_CMapCache_Lookup( FTC_CMapCache  cmap_cache,\r\n                        FTC_FaceID     face_id,\r\n                        FT_Int         cmap_index,\r\n                        FT_UInt32      char_code )\r\n  {\r\n    FTC_Cache         cache = FTC_CACHE( cmap_cache );\r\n    FTC_CMapQueryRec  query;\r\n    FTC_Node          node;\r\n    FT_Error          error;\r\n    FT_UInt           gindex = 0;\r\n    FT_PtrDist        hash;\r\n    FT_Int            no_cmap_change = 0;\r\n\r\n\r\n    if ( cmap_index < 0 )\r\n    {\r\n      /* Treat a negative cmap index as a special value, meaning that you */\r\n      /* don't want to change the FT_Face's character map through this    */\r\n      /* call.  This can be useful if the face requester callback already */\r\n      /* sets the face's charmap to the appropriate value.                */\r\n\r\n      no_cmap_change = 1;\r\n      cmap_index     = 0;\r\n    }\r\n\r\n    if ( !cache )\r\n    {\r\n      FT_TRACE0(( \"FTC_CMapCache_Lookup: bad arguments, returning 0\\n\" ));\r\n      return 0;\r\n    }\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n    /*\r\n     * If cmap_index is greater than the maximum number of cachable\r\n     * charmaps, we assume the request is from a legacy rogue client\r\n     * using old internal header. See include/config/ftoption.h.\r\n     */\r\n    if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change )\r\n    {\r\n      FTC_OldCMapDesc  desc = (FTC_OldCMapDesc) face_id;\r\n\r\n\r\n      char_code     = (FT_UInt32)cmap_index;\r\n      query.face_id = desc->face_id;\r\n\r\n\r\n      switch ( desc->type )\r\n      {\r\n      case FTC_OLD_CMAP_BY_INDEX:\r\n        query.cmap_index = desc->u.index;\r\n        query.char_code  = (FT_UInt32)cmap_index;\r\n        break;\r\n\r\n      case FTC_OLD_CMAP_BY_ENCODING:\r\n        {\r\n          FT_Face  face;\r\n\r\n\r\n          error = FTC_Manager_LookupFace( cache->manager, desc->face_id,\r\n                                          &face );\r\n          if ( error )\r\n            return 0;\r\n\r\n          FT_Select_Charmap( face, desc->u.encoding );\r\n\r\n          return FT_Get_Char_Index( face, char_code );\r\n        }\r\n\r\n      default:\r\n        return 0;\r\n      }\r\n    }\r\n    else\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    {\r\n      query.face_id    = face_id;\r\n      query.cmap_index = (FT_UInt)cmap_index;\r\n      query.char_code  = char_code;\r\n    }\r\n\r\n    hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );\r\n\r\n#if 1\r\n    FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,\r\n                          node, error );\r\n#else\r\n    error = FTC_Cache_Lookup( cache, hash, &query, &node );\r\n#endif\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <\r\n                FTC_CMAP_INDICES_MAX );\r\n\r\n    /* something rotten can happen with rogue clients */\r\n    if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=\r\n                    FTC_CMAP_INDICES_MAX ) )\r\n      return 0; /* XXX: should return appropriate error */\r\n\r\n    gindex = FTC_CMAP_NODE( node )->indices[char_code -\r\n                                            FTC_CMAP_NODE( node )->first];\r\n    if ( gindex == FTC_CMAP_UNKNOWN )\r\n    {\r\n      FT_Face  face;\r\n\r\n\r\n      gindex = 0;\r\n\r\n      error = FTC_Manager_LookupFace( cache->manager,\r\n                                      FTC_CMAP_NODE( node )->face_id,\r\n                                      &face );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n      /* something rotten can happen with rogue clients */\r\n      if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE )\r\n        return 0; /* XXX: should return appropriate error */\r\n#endif\r\n\r\n      if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )\r\n      {\r\n        FT_CharMap  old, cmap  = NULL;\r\n\r\n\r\n        old  = face->charmap;\r\n        cmap = face->charmaps[cmap_index];\r\n\r\n        if ( old != cmap && !no_cmap_change )\r\n          FT_Set_Charmap( face, cmap );\r\n\r\n        gindex = FT_Get_Char_Index( face, char_code );\r\n\r\n        if ( old != cmap && !no_cmap_change )\r\n          FT_Set_Charmap( face, old );\r\n      }\r\n\r\n      FTC_CMAP_NODE( node )->indices[char_code -\r\n                                     FTC_CMAP_NODE( node )->first]\r\n        = (FT_UShort)gindex;\r\n    }\r\n\r\n  Exit:\r\n    return gindex;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcerror.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcerror.h                                                             */\r\n/*                                                                         */\r\n/*    Caching sub-system error codes (specification only).                 */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the caching sub-system error enumeration  */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __FTCERROR_H__\r\n#define __FTCERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  FTC_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Cache\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __FTCERROR_H__ */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcglyph.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcglyph.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType Glyph Image (FT_Glyph) cache (body).                        */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2004, 2006, 2009, 2011 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_CACHE_H\r\n#include \"ftcglyph.h\"\r\n#include FT_ERRORS_H\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n\r\n  /* create a new chunk node, setting its cache index and ref count */\r\n  FT_LOCAL_DEF( void )\r\n  FTC_GNode_Init( FTC_GNode   gnode,\r\n                  FT_UInt     gindex,\r\n                  FTC_Family  family )\r\n  {\r\n    gnode->family = family;\r\n    gnode->gindex = gindex;\r\n    family->num_nodes++;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_GNode_UnselectFamily( FTC_GNode  gnode,\r\n                            FTC_Cache  cache )\r\n  {\r\n    FTC_Family  family = gnode->family;\r\n\r\n\r\n    gnode->family = NULL;\r\n    if ( family && --family->num_nodes == 0 )\r\n      FTC_FAMILY_FREE( family, cache );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_GNode_Done( FTC_GNode  gnode,\r\n                  FTC_Cache  cache )\r\n  {\r\n    /* finalize the node */\r\n    gnode->gindex = 0;\r\n\r\n    FTC_GNode_UnselectFamily( gnode, cache );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  ftc_gnode_compare( FTC_Node    ftcgnode,\r\n                     FT_Pointer  ftcgquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed )\r\n  {\r\n    FTC_GNode   gnode  = (FTC_GNode)ftcgnode;\r\n    FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;\r\n    FT_UNUSED( cache );\r\n\r\n\r\n    if ( list_changed )\r\n      *list_changed = FALSE;\r\n    return FT_BOOL( gnode->family == gquery->family &&\r\n                    gnode->gindex == gquery->gindex );\r\n  }\r\n\r\n\r\n#ifdef FTC_INLINE\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  FTC_GNode_Compare( FTC_GNode   gnode,\r\n                     FTC_GQuery  gquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed )\r\n  {\r\n    return ftc_gnode_compare( FTC_NODE( gnode ), gquery,\r\n                              cache, list_changed );\r\n  }\r\n\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      CHUNK SETS                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_Family_Init( FTC_Family  family,\r\n                   FTC_Cache   cache )\r\n  {\r\n    FTC_GCacheClass  clazz = FTC_CACHE__GCACHE_CLASS( cache );\r\n\r\n\r\n    family->clazz     = clazz->family_class;\r\n    family->num_nodes = 0;\r\n    family->cache     = cache;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ftc_gcache_init( FTC_Cache  ftccache )\r\n  {\r\n    FTC_GCache  cache = (FTC_GCache)ftccache;\r\n    FT_Error    error;\r\n\r\n\r\n    error = FTC_Cache_Init( FTC_CACHE( cache ) );\r\n    if ( !error )\r\n    {\r\n      FTC_GCacheClass   clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;\r\n\r\n      FTC_MruList_Init( &cache->families,\r\n                        clazz->family_class,\r\n                        0,  /* no maximum here! */\r\n                        cache,\r\n                        FTC_CACHE( cache )->memory );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_GCache_Init( FTC_GCache  cache )\r\n  {\r\n    return ftc_gcache_init( FTC_CACHE( cache ) );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ftc_gcache_done( FTC_Cache  ftccache )\r\n  {\r\n    FTC_GCache  cache = (FTC_GCache)ftccache;\r\n\r\n\r\n    FTC_Cache_Done( (FTC_Cache)cache );\r\n    FTC_MruList_Done( &cache->families );\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_GCache_Done( FTC_GCache  cache )\r\n  {\r\n    ftc_gcache_done( FTC_CACHE( cache ) );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_GCache_New( FTC_Manager       manager,\r\n                  FTC_GCacheClass   clazz,\r\n                  FTC_GCache       *acache )\r\n  {\r\n    return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,\r\n                                      (FTC_Cache*)acache );\r\n  }\r\n\r\n\r\n#ifndef FTC_INLINE\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_GCache_Lookup( FTC_GCache   cache,\r\n                     FT_PtrDist   hash,\r\n                     FT_UInt      gindex,\r\n                     FTC_GQuery   query,\r\n                     FTC_Node    *anode )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    query->gindex = gindex;\r\n\r\n    FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );\r\n    if ( !error )\r\n    {\r\n      FTC_Family  family = query->family;\r\n\r\n\r\n      /* prevent the family from being destroyed too early when an        */\r\n      /* out-of-memory condition occurs during glyph node initialization. */\r\n      family->num_nodes++;\r\n\r\n      error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );\r\n\r\n      if ( --family->num_nodes == 0 )\r\n        FTC_FAMILY_FREE( family, cache );\r\n    }\r\n    return error;\r\n  }\r\n\r\n#endif /* !FTC_INLINE */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcglyph.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcglyph.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType abstract glyph cache (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2004, 2006, 2007, 2011 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*\r\n   *\r\n   *  FTC_GCache is an _abstract_ cache object optimized to store glyph\r\n   *  data.  It works as follows:\r\n   *\r\n   *   - It manages FTC_GNode objects. Each one of them can hold one or more\r\n   *     glyph `items'.  Item types are not specified in the FTC_GCache but\r\n   *     in classes that extend it.\r\n   *\r\n   *   - Glyph attributes, like face ID, character size, render mode, etc.,\r\n   *     can be grouped into abstract `glyph families'.  This avoids storing\r\n   *     the attributes within the FTC_GCache, since it is likely that many\r\n   *     FTC_GNodes will belong to the same family in typical uses.\r\n   *\r\n   *   - Each FTC_GNode is thus an FTC_Node with two additional fields:\r\n   *\r\n   *       * gindex: A glyph index, or the first index in a glyph range.\r\n   *       * family: A pointer to a glyph `family'.\r\n   *\r\n   *   - Family types are not fully specific in the FTC_Family type, but\r\n   *     by classes that extend it.\r\n   *\r\n   *  Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache.\r\n   *  They share an FTC_Family sub-class called FTC_BasicFamily which is\r\n   *  used to store the following data: face ID, pixel/point sizes, load\r\n   *  flags.  For more details see the file `src/cache/ftcbasic.c'.\r\n   *\r\n   *  Client applications can extend FTC_GNode with their own FTC_GNode\r\n   *  and FTC_Family sub-classes to implement more complex caches (e.g.,\r\n   *  handling automatic synthesis, like obliquing & emboldening, colored\r\n   *  glyphs, etc.).\r\n   *\r\n   *  See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and\r\n   *  `ftcsbits.h', which both extend FTC_GCache with additional\r\n   *  optimizations.\r\n   *\r\n   *  A typical FTC_GCache implementation must provide at least the\r\n   *  following:\r\n   *\r\n   *  - FTC_GNode sub-class, e.g. MyNode, with relevant methods:\r\n   *        my_node_new            (must call FTC_GNode_Init)\r\n   *        my_node_free           (must call FTC_GNode_Done)\r\n   *        my_node_compare        (must call FTC_GNode_Compare)\r\n   *        my_node_remove_faceid  (must call ftc_gnode_unselect in case\r\n   *                                of match)\r\n   *\r\n   *  - FTC_Family sub-class, e.g. MyFamily, with relevant methods:\r\n   *        my_family_compare\r\n   *        my_family_init\r\n   *        my_family_reset (optional)\r\n   *        my_family_done\r\n   *\r\n   *  - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query\r\n   *    data.\r\n   *\r\n   *  - Constant structures for a FTC_GNodeClass.\r\n   *\r\n   *  - MyCacheNew() can be implemented easily as a call to the convenience\r\n   *    function FTC_GCache_New.\r\n   *\r\n   *  - MyCacheLookup with a call to FTC_GCache_Lookup.  This function will\r\n   *    automatically:\r\n   *\r\n   *    - Search for the corresponding family in the cache, or create\r\n   *      a new one if necessary.  Put it in FTC_GQUERY(myquery).family\r\n   *\r\n   *    - Call FTC_Cache_Lookup.\r\n   *\r\n   *    If it returns NULL, you should create a new node, then call\r\n   *    ftc_cache_add as usual.\r\n   */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Important: The functions defined in this file are only used to        */\r\n  /*            implement an abstract glyph cache class.  You need to      */\r\n  /*            provide additional logic to implement a complete cache.    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*********                                                       *********/\r\n  /*********             WARNING, THIS IS BETA CODE.               *********/\r\n  /*********                                                       *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTCGLYPH_H__\r\n#define __FTCGLYPH_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ftcmanag.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n /*\r\n  *  We can group glyphs into `families'.  Each family correspond to a\r\n  *  given face ID, character size, transform, etc.\r\n  *\r\n  *  Families are implemented as MRU list nodes.  They are\r\n  *  reference-counted.\r\n  */\r\n\r\n  typedef struct  FTC_FamilyRec_\r\n  {\r\n    FTC_MruNodeRec    mrunode;\r\n    FT_UInt           num_nodes; /* current number of nodes in this family */\r\n    FTC_Cache         cache;\r\n    FTC_MruListClass  clazz;\r\n\r\n  } FTC_FamilyRec, *FTC_Family;\r\n\r\n#define  FTC_FAMILY(x)    ( (FTC_Family)(x) )\r\n#define  FTC_FAMILY_P(x)  ( (FTC_Family*)(x) )\r\n\r\n\r\n  typedef struct  FTC_GNodeRec_\r\n  {\r\n    FTC_NodeRec      node;\r\n    FTC_Family       family;\r\n    FT_UInt          gindex;\r\n\r\n  } FTC_GNodeRec, *FTC_GNode;\r\n\r\n#define FTC_GNODE( x )    ( (FTC_GNode)(x) )\r\n#define FTC_GNODE_P( x )  ( (FTC_GNode*)(x) )\r\n\r\n\r\n  typedef struct  FTC_GQueryRec_\r\n  {\r\n    FT_UInt      gindex;\r\n    FTC_Family   family;\r\n\r\n  } FTC_GQueryRec, *FTC_GQuery;\r\n\r\n#define FTC_GQUERY( x )  ( (FTC_GQuery)(x) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* These functions are exported so that they can be called from          */\r\n  /* user-provided cache classes; otherwise, they are really part of the   */\r\n  /* cache sub-system internals.                                           */\r\n  /*                                                                       */\r\n\r\n  /* must be called by derived FTC_Node_InitFunc routines */\r\n  FT_LOCAL( void )\r\n  FTC_GNode_Init( FTC_GNode   node,\r\n                  FT_UInt     gindex,  /* glyph index for node */\r\n                  FTC_Family  family );\r\n\r\n#ifdef FTC_INLINE\r\n\r\n  /* returns TRUE iff the query's glyph index correspond to the node;  */\r\n  /* this assumes that the `family' and `hash' fields of the query are */\r\n  /* already correctly set                                             */\r\n  FT_LOCAL( FT_Bool )\r\n  FTC_GNode_Compare( FTC_GNode   gnode,\r\n                     FTC_GQuery  gquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed );\r\n\r\n#endif\r\n\r\n  /* call this function to clear a node's family -- this is necessary */\r\n  /* to implement the `node_remove_faceid' cache method correctly     */\r\n  FT_LOCAL( void )\r\n  FTC_GNode_UnselectFamily( FTC_GNode  gnode,\r\n                            FTC_Cache  cache );\r\n\r\n  /* must be called by derived FTC_Node_DoneFunc routines */\r\n  FT_LOCAL( void )\r\n  FTC_GNode_Done( FTC_GNode  node,\r\n                  FTC_Cache  cache );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  FTC_Family_Init( FTC_Family  family,\r\n                   FTC_Cache   cache );\r\n\r\n  typedef struct FTC_GCacheRec_\r\n  {\r\n    FTC_CacheRec    cache;\r\n    FTC_MruListRec  families;\r\n\r\n  } FTC_GCacheRec, *FTC_GCache;\r\n\r\n#define FTC_GCACHE( x )  ((FTC_GCache)(x))\r\n\r\n\r\n#if 0\r\n  /* can be used as @FTC_Cache_InitFunc */\r\n  FT_LOCAL( FT_Error )\r\n  FTC_GCache_Init( FTC_GCache  cache );\r\n#endif\r\n\r\n\r\n#if 0\r\n  /* can be used as @FTC_Cache_DoneFunc */\r\n  FT_LOCAL( void )\r\n  FTC_GCache_Done( FTC_GCache  cache );\r\n#endif\r\n\r\n\r\n  /* the glyph cache class adds fields for the family implementation */\r\n  typedef struct  FTC_GCacheClassRec_\r\n  {\r\n    FTC_CacheClassRec  clazz;\r\n    FTC_MruListClass   family_class;\r\n\r\n  } FTC_GCacheClassRec;\r\n\r\n  typedef const FTC_GCacheClassRec*   FTC_GCacheClass;\r\n\r\n#define FTC_GCACHE_CLASS( x )  ((FTC_GCacheClass)(x))\r\n\r\n#define FTC_CACHE__GCACHE_CLASS( x ) \\\r\n          FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )\r\n#define FTC_CACHE__FAMILY_CLASS( x ) \\\r\n          ( (FTC_MruListClass)FTC_CACHE__GCACHE_CLASS( x )->family_class )\r\n\r\n\r\n  /* convenience function; use it instead of FTC_Manager_Register_Cache */\r\n  FT_LOCAL( FT_Error )\r\n  FTC_GCache_New( FTC_Manager       manager,\r\n                  FTC_GCacheClass   clazz,\r\n                  FTC_GCache       *acache );\r\n\r\n#ifndef FTC_INLINE\r\n  FT_LOCAL( FT_Error )\r\n  FTC_GCache_Lookup( FTC_GCache   cache,\r\n                     FT_PtrDist   hash,\r\n                     FT_UInt      gindex,\r\n                     FTC_GQuery   query,\r\n                     FTC_Node    *anode );\r\n#endif\r\n\r\n\r\n  /* */\r\n\r\n\r\n#define FTC_FAMILY_FREE( family, cache )                      \\\r\n          FTC_MruList_Remove( &FTC_GCACHE((cache))->families, \\\r\n                              (FTC_MruNode)(family) )\r\n\r\n\r\n#ifdef FTC_INLINE\r\n\r\n#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,                \\\r\n                               gindex, query, node, error )                 \\\r\n  FT_BEGIN_STMNT                                                            \\\r\n    FTC_GCache               _gcache   = FTC_GCACHE( cache );               \\\r\n    FTC_GQuery               _gquery   = (FTC_GQuery)( query );             \\\r\n    FTC_MruNode_CompareFunc  _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \\\r\n    FTC_MruNode              _mrunode;                                      \\\r\n                                                                            \\\r\n                                                                            \\\r\n    _gquery->gindex = (gindex);                                             \\\r\n                                                                            \\\r\n    FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare,         \\\r\n                            _mrunode, error );                              \\\r\n    _gquery->family = FTC_FAMILY( _mrunode );                               \\\r\n    if ( !error )                                                           \\\r\n    {                                                                       \\\r\n      FTC_Family  _gqfamily = _gquery->family;                              \\\r\n                                                                            \\\r\n                                                                            \\\r\n      _gqfamily->num_nodes++;                                               \\\r\n                                                                            \\\r\n      FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error );     \\\r\n                                                                            \\\r\n      if ( --_gqfamily->num_nodes == 0 )                                    \\\r\n        FTC_FAMILY_FREE( _gqfamily, _gcache );                              \\\r\n    }                                                                       \\\r\n  FT_END_STMNT\r\n  /* */\r\n\r\n#else /* !FTC_INLINE */\r\n\r\n#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,          \\\r\n                               gindex, query, node, error )           \\\r\n   FT_BEGIN_STMNT                                                     \\\r\n                                                                      \\\r\n     error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex,    \\\r\n                                FTC_GQUERY( query ), &node );         \\\r\n                                                                      \\\r\n   FT_END_STMNT\r\n\r\n#endif /* !FTC_INLINE */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTCGLYPH_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcimage.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcimage.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType Image cache (body).                                         */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2004, 2006, 2010 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcimage.h\"\r\n#include FT_INTERNAL_MEMORY_H\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n\r\n  /* finalize a given glyph image node */\r\n  FT_LOCAL_DEF( void )\r\n  ftc_inode_free( FTC_Node   ftcinode,\r\n                  FTC_Cache  cache )\r\n  {\r\n    FTC_INode  inode = (FTC_INode)ftcinode;\r\n    FT_Memory  memory = cache->memory;\r\n\r\n\r\n    if ( inode->glyph )\r\n    {\r\n      FT_Done_Glyph( inode->glyph );\r\n      inode->glyph = NULL;\r\n    }\r\n\r\n    FTC_GNode_Done( FTC_GNODE( inode ), cache );\r\n    FT_FREE( inode );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_INode_Free( FTC_INode  inode,\r\n                  FTC_Cache  cache )\r\n  {\r\n    ftc_inode_free( FTC_NODE( inode ), cache );\r\n  }\r\n\r\n\r\n  /* initialize a new glyph image node */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_INode_New( FTC_INode   *pinode,\r\n                 FTC_GQuery   gquery,\r\n                 FTC_Cache    cache )\r\n  {\r\n    FT_Memory  memory = cache->memory;\r\n    FT_Error   error;\r\n    FTC_INode  inode  = NULL;\r\n\r\n\r\n    if ( !FT_NEW( inode ) )\r\n    {\r\n      FTC_GNode         gnode  = FTC_GNODE( inode );\r\n      FTC_Family        family = gquery->family;\r\n      FT_UInt           gindex = gquery->gindex;\r\n      FTC_IFamilyClass  clazz  = FTC_CACHE__IFAMILY_CLASS( cache );\r\n\r\n\r\n      /* initialize its inner fields */\r\n      FTC_GNode_Init( gnode, gindex, family );\r\n\r\n      /* we will now load the glyph image */\r\n      error = clazz->family_load_glyph( family, gindex, cache,\r\n                                        &inode->glyph );\r\n      if ( error )\r\n      {\r\n        FTC_INode_Free( inode, cache );\r\n        inode = NULL;\r\n      }\r\n    }\r\n\r\n    *pinode = inode;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ftc_inode_new( FTC_Node   *ftcpinode,\r\n                 FT_Pointer  ftcgquery,\r\n                 FTC_Cache   cache )\r\n  {\r\n    FTC_INode  *pinode = (FTC_INode*)ftcpinode;\r\n    FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;\r\n\r\n\r\n    return FTC_INode_New( pinode, gquery, cache );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Offset )\r\n  ftc_inode_weight( FTC_Node   ftcinode,\r\n                    FTC_Cache  ftccache )\r\n  {\r\n    FTC_INode  inode = (FTC_INode)ftcinode;\r\n    FT_Offset  size  = 0;\r\n    FT_Glyph   glyph = inode->glyph;\r\n\r\n    FT_UNUSED( ftccache );\r\n\r\n\r\n    switch ( glyph->format )\r\n    {\r\n    case FT_GLYPH_FORMAT_BITMAP:\r\n      {\r\n        FT_BitmapGlyph  bitg;\r\n\r\n\r\n        bitg = (FT_BitmapGlyph)glyph;\r\n        size = bitg->bitmap.rows * ft_labs( bitg->bitmap.pitch ) +\r\n               sizeof ( *bitg );\r\n      }\r\n      break;\r\n\r\n    case FT_GLYPH_FORMAT_OUTLINE:\r\n      {\r\n        FT_OutlineGlyph  outg;\r\n\r\n\r\n        outg = (FT_OutlineGlyph)glyph;\r\n        size = outg->outline.n_points *\r\n                 ( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) +\r\n               outg->outline.n_contours * sizeof ( FT_Short ) +\r\n               sizeof ( *outg );\r\n      }\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    size += sizeof ( *inode );\r\n    return size;\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  FT_LOCAL_DEF( FT_Offset )\r\n  FTC_INode_Weight( FTC_INode  inode )\r\n  {\r\n    return ftc_inode_weight( FTC_NODE( inode ), NULL );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcimage.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcimage.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType Generic Image cache (specification)                         */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2006 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n /*\r\n  *  FTC_ICache is an _abstract_ cache used to store a single FT_Glyph\r\n  *  image per cache node.\r\n  *\r\n  *  FTC_ICache extends FTC_GCache.  For an implementation example,\r\n  *  see FTC_ImageCache in `src/cache/ftbasic.c'.\r\n  */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Each image cache really manages FT_Glyph objects.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTCIMAGE_H__\r\n#define __FTCIMAGE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcglyph.h\"\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* the FT_Glyph image node type - we store only 1 glyph per node */\r\n  typedef struct  FTC_INodeRec_\r\n  {\r\n    FTC_GNodeRec  gnode;\r\n    FT_Glyph      glyph;\r\n\r\n  } FTC_INodeRec, *FTC_INode;\r\n\r\n#define FTC_INODE( x )         ( (FTC_INode)( x ) )\r\n#define FTC_INODE_GINDEX( x )  FTC_GNODE(x)->gindex\r\n#define FTC_INODE_FAMILY( x )  FTC_GNODE(x)->family\r\n\r\n  typedef FT_Error\r\n  (*FTC_IFamily_LoadGlyphFunc)( FTC_Family  family,\r\n                                FT_UInt     gindex,\r\n                                FTC_Cache   cache,\r\n                                FT_Glyph   *aglyph );\r\n\r\n  typedef struct  FTC_IFamilyClassRec_\r\n  {\r\n    FTC_MruListClassRec        clazz;\r\n    FTC_IFamily_LoadGlyphFunc  family_load_glyph;\r\n\r\n  } FTC_IFamilyClassRec;\r\n\r\n  typedef const FTC_IFamilyClassRec*  FTC_IFamilyClass;\r\n\r\n#define FTC_IFAMILY_CLASS( x )  ((FTC_IFamilyClass)(x))\r\n\r\n#define FTC_CACHE__IFAMILY_CLASS( x ) \\\r\n          FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )\r\n\r\n\r\n  /* can be used as a @FTC_Node_FreeFunc */\r\n  FT_LOCAL( void )\r\n  FTC_INode_Free( FTC_INode  inode,\r\n                  FTC_Cache  cache );\r\n\r\n  /* Can be used as @FTC_Node_NewFunc.  `gquery.index' and `gquery.family'\r\n   * must be set correctly.  This function will call the `family_load_glyph'\r\n   * method to load the FT_Glyph into the cache node.\r\n   */\r\n  FT_LOCAL( FT_Error )\r\n  FTC_INode_New( FTC_INode   *pinode,\r\n                 FTC_GQuery   gquery,\r\n                 FTC_Cache    cache );\r\n\r\n#if 0\r\n  /* can be used as @FTC_Node_WeightFunc */\r\n  FT_LOCAL( FT_ULong )\r\n  FTC_INode_Weight( FTC_INode  inode );\r\n#endif\r\n\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCIMAGE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcmanag.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcmanag.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType Cache Manager (body).                                       */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcmanag.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_SIZES_H\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"cache system does not support PIC yet\"\r\n#endif\r\n\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cache\r\n\r\n#define FTC_LRU_GET_MANAGER( lru )  ( (FTC_Manager)(lru)->user_data )\r\n\r\n\r\n  static FT_Error\r\n  ftc_scaler_lookup_size( FTC_Manager  manager,\r\n                          FTC_Scaler   scaler,\r\n                          FT_Size     *asize )\r\n  {\r\n    FT_Face   face;\r\n    FT_Size   size = NULL;\r\n    FT_Error  error;\r\n\r\n\r\n    error = FTC_Manager_LookupFace( manager, scaler->face_id, &face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = FT_New_Size( face, &size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_Activate_Size( size );\r\n\r\n    if ( scaler->pixel )\r\n      error = FT_Set_Pixel_Sizes( face, scaler->width, scaler->height );\r\n    else\r\n      error = FT_Set_Char_Size( face, scaler->width, scaler->height,\r\n                                scaler->x_res, scaler->y_res );\r\n    if ( error )\r\n    {\r\n      FT_Done_Size( size );\r\n      size = NULL;\r\n    }\r\n\r\n  Exit:\r\n    *asize = size;\r\n    return error;\r\n  }\r\n\r\n\r\n  typedef struct  FTC_SizeNodeRec_\r\n  {\r\n    FTC_MruNodeRec  node;\r\n    FT_Size         size;\r\n    FTC_ScalerRec   scaler;\r\n\r\n  } FTC_SizeNodeRec, *FTC_SizeNode;\r\n\r\n#define FTC_SIZE_NODE( x ) ( (FTC_SizeNode)( x ) )\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ftc_size_node_done( FTC_MruNode  ftcnode,\r\n                      FT_Pointer   data )\r\n  {\r\n    FTC_SizeNode  node = (FTC_SizeNode)ftcnode;\r\n    FT_Size       size = node->size;\r\n    FT_UNUSED( data );\r\n\r\n\r\n    if ( size )\r\n      FT_Done_Size( size );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Bool )\r\n  ftc_size_node_compare( FTC_MruNode  ftcnode,\r\n                         FT_Pointer   ftcscaler )\r\n  {\r\n    FTC_SizeNode  node    = (FTC_SizeNode)ftcnode;\r\n    FTC_Scaler    scaler  = (FTC_Scaler)ftcscaler;\r\n    FTC_Scaler    scaler0 = &node->scaler;\r\n\r\n\r\n    if ( FTC_SCALER_COMPARE( scaler0, scaler ) )\r\n    {\r\n      FT_Activate_Size( node->size );\r\n      return 1;\r\n    }\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_size_node_init( FTC_MruNode  ftcnode,\r\n                      FT_Pointer   ftcscaler,\r\n                      FT_Pointer   ftcmanager )\r\n  {\r\n    FTC_SizeNode  node    = (FTC_SizeNode)ftcnode;\r\n    FTC_Scaler    scaler  = (FTC_Scaler)ftcscaler;\r\n    FTC_Manager   manager = (FTC_Manager)ftcmanager;\r\n\r\n\r\n    node->scaler = scaler[0];\r\n\r\n    return ftc_scaler_lookup_size( manager, scaler, &node->size );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_size_node_reset( FTC_MruNode  ftcnode,\r\n                       FT_Pointer   ftcscaler,\r\n                       FT_Pointer   ftcmanager )\r\n  {\r\n    FTC_SizeNode  node    = (FTC_SizeNode)ftcnode;\r\n    FTC_Scaler    scaler  = (FTC_Scaler)ftcscaler;\r\n    FTC_Manager   manager = (FTC_Manager)ftcmanager;\r\n\r\n\r\n    FT_Done_Size( node->size );\r\n\r\n    node->scaler = scaler[0];\r\n\r\n    return ftc_scaler_lookup_size( manager, scaler, &node->size );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_MruListClassRec  ftc_size_list_class =\r\n  {\r\n    sizeof ( FTC_SizeNodeRec ),\r\n    ftc_size_node_compare,\r\n    ftc_size_node_init,\r\n    ftc_size_node_reset,\r\n    ftc_size_node_done\r\n  };\r\n\r\n\r\n  /* helper function used by ftc_face_node_done */\r\n  static FT_Bool\r\n  ftc_size_node_compare_faceid( FTC_MruNode  ftcnode,\r\n                                FT_Pointer   ftcface_id )\r\n  {\r\n    FTC_SizeNode  node    = (FTC_SizeNode)ftcnode;\r\n    FTC_FaceID    face_id = (FTC_FaceID)ftcface_id;\r\n\r\n\r\n    return FT_BOOL( node->scaler.face_id == face_id );\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_Manager_LookupSize( FTC_Manager  manager,\r\n                          FTC_Scaler   scaler,\r\n                          FT_Size     *asize )\r\n  {\r\n    FT_Error     error;\r\n    FTC_MruNode  mrunode;\r\n\r\n\r\n    if ( asize == NULL )\r\n      return FTC_Err_Invalid_Argument;\r\n\r\n    *asize = NULL;\r\n\r\n    if ( !manager )\r\n      return FTC_Err_Invalid_Cache_Handle;\r\n\r\n#ifdef FTC_INLINE\r\n\r\n    FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare,\r\n                            mrunode, error );\r\n\r\n#else\r\n    error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode );\r\n#endif\r\n\r\n    if ( !error )\r\n      *asize = FTC_SIZE_NODE( mrunode )->size;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    FACE MRU IMPLEMENTATION                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  FTC_FaceNodeRec_\r\n  {\r\n    FTC_MruNodeRec  node;\r\n    FTC_FaceID      face_id;\r\n    FT_Face         face;\r\n\r\n  } FTC_FaceNodeRec, *FTC_FaceNode;\r\n\r\n#define FTC_FACE_NODE( x ) ( ( FTC_FaceNode )( x ) )\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ftc_face_node_init( FTC_MruNode  ftcnode,\r\n                      FT_Pointer   ftcface_id,\r\n                      FT_Pointer   ftcmanager )\r\n  {\r\n    FTC_FaceNode  node    = (FTC_FaceNode)ftcnode;\r\n    FTC_FaceID    face_id = (FTC_FaceID)ftcface_id;\r\n    FTC_Manager   manager = (FTC_Manager)ftcmanager;\r\n    FT_Error      error;\r\n\r\n\r\n    node->face_id = face_id;\r\n\r\n    error = manager->request_face( face_id,\r\n                                   manager->library,\r\n                                   manager->request_data,\r\n                                   &node->face );\r\n    if ( !error )\r\n    {\r\n      /* destroy initial size object; it will be re-created later */\r\n      if ( node->face->size )\r\n        FT_Done_Size( node->face->size );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  ftc_face_node_done( FTC_MruNode  ftcnode,\r\n                      FT_Pointer   ftcmanager )\r\n  {\r\n    FTC_FaceNode  node    = (FTC_FaceNode)ftcnode;\r\n    FTC_Manager   manager = (FTC_Manager)ftcmanager;\r\n\r\n\r\n    /* we must begin by removing all scalers for the target face */\r\n    /* from the manager's list                                   */\r\n    FTC_MruList_RemoveSelection( &manager->sizes,\r\n                                 ftc_size_node_compare_faceid,\r\n                                 node->face_id );\r\n\r\n    /* all right, we can discard the face now */\r\n    FT_Done_Face( node->face );\r\n    node->face    = NULL;\r\n    node->face_id = NULL;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Bool )\r\n  ftc_face_node_compare( FTC_MruNode  ftcnode,\r\n                         FT_Pointer   ftcface_id )\r\n  {\r\n    FTC_FaceNode  node    = (FTC_FaceNode)ftcnode;\r\n    FTC_FaceID    face_id = (FTC_FaceID)ftcface_id;\r\n\r\n\r\n    return FT_BOOL( node->face_id == face_id );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FTC_MruListClassRec  ftc_face_list_class =\r\n  {\r\n    sizeof ( FTC_FaceNodeRec),\r\n\r\n    ftc_face_node_compare,\r\n    ftc_face_node_init,\r\n    0,                          /* FTC_MruNode_ResetFunc */\r\n    ftc_face_node_done\r\n  };\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_Manager_LookupFace( FTC_Manager  manager,\r\n                          FTC_FaceID   face_id,\r\n                          FT_Face     *aface )\r\n  {\r\n    FT_Error     error;\r\n    FTC_MruNode  mrunode;\r\n\r\n\r\n    if ( aface == NULL )\r\n      return FTC_Err_Invalid_Argument;\r\n\r\n    *aface = NULL;\r\n\r\n    if ( !manager )\r\n      return FTC_Err_Invalid_Cache_Handle;\r\n\r\n    /* we break encapsulation for the sake of speed */\r\n#ifdef FTC_INLINE\r\n\r\n    FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare,\r\n                            mrunode, error );\r\n\r\n#else\r\n    error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode );\r\n#endif\r\n\r\n    if ( !error )\r\n      *aface = FTC_FACE_NODE( mrunode )->face;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    CACHE MANAGER ROUTINES                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_Manager_New( FT_Library          library,\r\n                   FT_UInt             max_faces,\r\n                   FT_UInt             max_sizes,\r\n                   FT_ULong            max_bytes,\r\n                   FTC_Face_Requester  requester,\r\n                   FT_Pointer          req_data,\r\n                   FTC_Manager        *amanager )\r\n  {\r\n    FT_Error     error;\r\n    FT_Memory    memory;\r\n    FTC_Manager  manager = 0;\r\n\r\n\r\n    if ( !library )\r\n      return FTC_Err_Invalid_Library_Handle;\r\n\r\n    memory = library->memory;\r\n\r\n    if ( FT_NEW( manager ) )\r\n      goto Exit;\r\n\r\n    if ( max_faces == 0 )\r\n      max_faces = FTC_MAX_FACES_DEFAULT;\r\n\r\n    if ( max_sizes == 0 )\r\n      max_sizes = FTC_MAX_SIZES_DEFAULT;\r\n\r\n    if ( max_bytes == 0 )\r\n      max_bytes = FTC_MAX_BYTES_DEFAULT;\r\n\r\n    manager->library      = library;\r\n    manager->memory       = memory;\r\n    manager->max_weight   = max_bytes;\r\n\r\n    manager->request_face = requester;\r\n    manager->request_data = req_data;\r\n\r\n    FTC_MruList_Init( &manager->faces,\r\n                      &ftc_face_list_class,\r\n                      max_faces,\r\n                      manager,\r\n                      memory );\r\n\r\n    FTC_MruList_Init( &manager->sizes,\r\n                      &ftc_size_list_class,\r\n                      max_sizes,\r\n                      manager,\r\n                      memory );\r\n\r\n    *amanager = manager;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FTC_Manager_Done( FTC_Manager  manager )\r\n  {\r\n    FT_Memory  memory;\r\n    FT_UInt    idx;\r\n\r\n\r\n    if ( !manager || !manager->library )\r\n      return;\r\n\r\n    memory = manager->memory;\r\n\r\n    /* now discard all caches */\r\n    for (idx = manager->num_caches; idx-- > 0; )\r\n    {\r\n      FTC_Cache  cache = manager->caches[idx];\r\n\r\n\r\n      if ( cache )\r\n      {\r\n        cache->clazz.cache_done( cache );\r\n        FT_FREE( cache );\r\n        manager->caches[idx] = NULL;\r\n      }\r\n    }\r\n    manager->num_caches = 0;\r\n\r\n    /* discard faces and sizes */\r\n    FTC_MruList_Done( &manager->sizes );\r\n    FTC_MruList_Done( &manager->faces );\r\n\r\n    manager->library = NULL;\r\n    manager->memory  = NULL;\r\n\r\n    FT_FREE( manager );\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FTC_Manager_Reset( FTC_Manager  manager )\r\n  {\r\n    if ( manager )\r\n    {\r\n      FTC_MruList_Reset( &manager->sizes );\r\n      FTC_MruList_Reset( &manager->faces );\r\n    }\r\n    /* XXX: FIXME: flush the caches? */\r\n  }\r\n\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n\r\n  static void\r\n  FTC_Manager_Check( FTC_Manager  manager )\r\n  {\r\n    FTC_Node  node, first;\r\n\r\n\r\n    first = manager->nodes_list;\r\n\r\n    /* check node weights */\r\n    if ( first )\r\n    {\r\n      FT_ULong  weight = 0;\r\n\r\n\r\n      node = first;\r\n\r\n      do\r\n      {\r\n        FTC_Cache  cache = manager->caches[node->cache_index];\r\n\r\n\r\n        if ( (FT_UInt)node->cache_index >= manager->num_caches )\r\n          FT_TRACE0(( \"FTC_Manager_Check: invalid node (cache index = %ld\\n\",\r\n                      node->cache_index ));\r\n        else\r\n          weight += cache->clazz.node_weight( node, cache );\r\n\r\n        node = FTC_NODE__NEXT( node );\r\n\r\n      } while ( node != first );\r\n\r\n      if ( weight != manager->cur_weight )\r\n        FT_TRACE0(( \"FTC_Manager_Check: invalid weight %ld instead of %ld\\n\",\r\n                    manager->cur_weight, weight ));\r\n    }\r\n\r\n    /* check circular list */\r\n    if ( first )\r\n    {\r\n      FT_UFast  count = 0;\r\n\r\n\r\n      node = first;\r\n      do\r\n      {\r\n        count++;\r\n        node = FTC_NODE__NEXT( node );\r\n\r\n      } while ( node != first );\r\n\r\n      if ( count != manager->num_nodes )\r\n        FT_TRACE0(( \"FTC_Manager_Check:\"\r\n                    \" invalid cache node count %d instead of %d\\n\",\r\n                    manager->num_nodes, count ));\r\n    }\r\n  }\r\n\r\n#endif /* FT_DEBUG_ERROR */\r\n\r\n\r\n  /* `Compress' the manager's data, i.e., get rid of old cache nodes */\r\n  /* that are not referenced anymore in order to limit the total     */\r\n  /* memory used by the cache.                                       */\r\n\r\n  /* documentation is in ftcmanag.h */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_Manager_Compress( FTC_Manager  manager )\r\n  {\r\n    FTC_Node   node, first;\r\n\r\n\r\n    if ( !manager )\r\n      return;\r\n\r\n    first = manager->nodes_list;\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n    FTC_Manager_Check( manager );\r\n\r\n    FT_TRACE0(( \"compressing, weight = %ld, max = %ld, nodes = %d\\n\",\r\n                manager->cur_weight, manager->max_weight,\r\n                manager->num_nodes ));\r\n#endif\r\n\r\n    if ( manager->cur_weight < manager->max_weight || first == NULL )\r\n      return;\r\n\r\n    /* go to last node -- it's a circular list */\r\n    node = FTC_NODE__PREV( first );\r\n    do\r\n    {\r\n      FTC_Node  prev;\r\n\r\n\r\n      prev = ( node == first ) ? NULL : FTC_NODE__PREV( node );\r\n\r\n      if ( node->ref_count <= 0 )\r\n        ftc_node_destroy( node, manager );\r\n\r\n      node = prev;\r\n\r\n    } while ( node && manager->cur_weight > manager->max_weight );\r\n  }\r\n\r\n\r\n  /* documentation is in ftcmanag.h */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_Manager_RegisterCache( FTC_Manager      manager,\r\n                             FTC_CacheClass   clazz,\r\n                             FTC_Cache       *acache )\r\n  {\r\n    FT_Error   error = FTC_Err_Invalid_Argument;\r\n    FTC_Cache  cache = NULL;\r\n\r\n\r\n    if ( manager && clazz && acache )\r\n    {\r\n      FT_Memory  memory = manager->memory;\r\n\r\n\r\n      if ( manager->num_caches >= FTC_MAX_CACHES )\r\n      {\r\n        error = FTC_Err_Too_Many_Caches;\r\n        FT_ERROR(( \"FTC_Manager_RegisterCache:\"\r\n                   \" too many registered caches\\n\" ));\r\n        goto Exit;\r\n      }\r\n\r\n      if ( !FT_ALLOC( cache, clazz->cache_size ) )\r\n      {\r\n        cache->manager   = manager;\r\n        cache->memory    = memory;\r\n        cache->clazz     = clazz[0];\r\n        cache->org_class = clazz;\r\n\r\n        /* THIS IS VERY IMPORTANT!  IT WILL WRETCH THE MANAGER */\r\n        /* IF IT IS NOT SET CORRECTLY                          */\r\n        cache->index = manager->num_caches;\r\n\r\n        error = clazz->cache_init( cache );\r\n        if ( error )\r\n        {\r\n          clazz->cache_done( cache );\r\n          FT_FREE( cache );\r\n          goto Exit;\r\n        }\r\n\r\n        manager->caches[manager->num_caches++] = cache;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    if ( acache )\r\n      *acache = cache;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  FTC_Manager_FlushN( FTC_Manager  manager,\r\n                      FT_UInt      count )\r\n  {\r\n    FTC_Node  first = manager->nodes_list;\r\n    FTC_Node  node;\r\n    FT_UInt   result;\r\n\r\n\r\n    /* try to remove `count' nodes from the list */\r\n    if ( first == NULL )  /* empty list! */\r\n      return 0;\r\n\r\n    /* go to last node - it's a circular list */\r\n    node = FTC_NODE__PREV(first);\r\n    for ( result = 0; result < count; )\r\n    {\r\n      FTC_Node  prev = FTC_NODE__PREV( node );\r\n\r\n\r\n      /* don't touch locked nodes */\r\n      if ( node->ref_count <= 0 )\r\n      {\r\n        ftc_node_destroy( node, manager );\r\n        result++;\r\n      }\r\n\r\n      if ( node == first )\r\n        break;\r\n\r\n      node = prev;\r\n    }\r\n    return  result;\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FTC_Manager_RemoveFaceID( FTC_Manager  manager,\r\n                            FTC_FaceID   face_id )\r\n  {\r\n    FT_UInt  nn;\r\n\r\n    /* this will remove all FTC_SizeNode that correspond to\r\n     * the face_id as well\r\n     */\r\n    FTC_MruList_RemoveSelection( &manager->faces,\r\n                                 ftc_face_node_compare,\r\n                                 face_id );\r\n\r\n    for ( nn = 0; nn < manager->num_caches; nn++ )\r\n      FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );\r\n  }\r\n\r\n\r\n  /* documentation is in ftcache.h */\r\n\r\n  FT_EXPORT_DEF( void )\r\n  FTC_Node_Unref( FTC_Node     node,\r\n                  FTC_Manager  manager )\r\n  {\r\n    if ( node && (FT_UInt)node->cache_index < manager->num_caches )\r\n      node->ref_count--;\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FTC_Manager_Lookup_Face( FTC_Manager  manager,\r\n                           FTC_FaceID   face_id,\r\n                           FT_Face     *aface )\r\n  {\r\n    return FTC_Manager_LookupFace( manager, face_id, aface );\r\n  }\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_Lookup_Size( FTC_Manager  manager,\r\n                           FTC_Font     font,\r\n                           FT_Face     *aface,\r\n                           FT_Size     *asize )\r\n  {\r\n    FTC_ScalerRec  scaler;\r\n    FT_Error       error;\r\n    FT_Size        size;\r\n    FT_Face        face;\r\n\r\n\r\n    scaler.face_id = font->face_id;\r\n    scaler.width   = font->pix_width;\r\n    scaler.height  = font->pix_height;\r\n    scaler.pixel   = TRUE;\r\n    scaler.x_res   = 0;\r\n    scaler.y_res   = 0;\r\n\r\n    error = FTC_Manager_LookupSize( manager, &scaler, &size );\r\n    if ( error )\r\n    {\r\n      face = NULL;\r\n      size = NULL;\r\n    }\r\n    else\r\n      face = size->face;\r\n\r\n    if ( aface )\r\n      *aface = face;\r\n\r\n    if ( asize )\r\n      *asize = size;\r\n\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcmanag.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcmanag.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType Cache Manager (specification).                              */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2004, 2006, 2010 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A cache manager is in charge of the following:                        */\r\n  /*                                                                       */\r\n  /*  - Maintain a mapping between generic FTC_FaceIDs and live FT_Face    */\r\n  /*    objects.  The mapping itself is performed through a user-provided  */\r\n  /*    callback.  However, the manager maintains a small cache of FT_Face */\r\n  /*    and FT_Size objects in order to speed up things considerably.      */\r\n  /*                                                                       */\r\n  /*  - Manage one or more cache objects.  Each cache is in charge of      */\r\n  /*    holding a varying number of `cache nodes'.  Each cache node        */\r\n  /*    represents a minimal amount of individually accessible cached      */\r\n  /*    data.  For example, a cache node can be an FT_Glyph image          */\r\n  /*    containing a vector outline, or some glyph metrics, or anything    */\r\n  /*    else.                                                              */\r\n  /*                                                                       */\r\n  /*    Each cache node has a certain size in bytes that is added to the   */\r\n  /*    total amount of `cache memory' within the manager.                 */\r\n  /*                                                                       */\r\n  /*    All cache nodes are located in a global LRU list, where the oldest */\r\n  /*    node is at the tail of the list.                                   */\r\n  /*                                                                       */\r\n  /*    Each node belongs to a single cache, and includes a reference      */\r\n  /*    count to avoid destroying it (due to caching).                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*********                                                       *********/\r\n  /*********             WARNING, THIS IS BETA CODE.               *********/\r\n  /*********                                                       *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTCMANAG_H__\r\n#define __FTCMANAG_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcmru.h\"\r\n#include \"ftccache.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cache_subsystem                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define FTC_MAX_FACES_DEFAULT  2\r\n#define FTC_MAX_SIZES_DEFAULT  4\r\n#define FTC_MAX_BYTES_DEFAULT  200000L  /* ~200kByte by default */\r\n\r\n  /* maximum number of caches registered in a single manager */\r\n#define FTC_MAX_CACHES         16\r\n\r\n\r\n  typedef struct  FTC_ManagerRec_\r\n  {\r\n    FT_Library          library;\r\n    FT_Memory           memory;\r\n\r\n    FTC_Node            nodes_list;\r\n    FT_ULong            max_weight;\r\n    FT_ULong            cur_weight;\r\n    FT_UInt             num_nodes;\r\n\r\n    FTC_Cache           caches[FTC_MAX_CACHES];\r\n    FT_UInt             num_caches;\r\n\r\n    FTC_MruListRec      faces;\r\n    FTC_MruListRec      sizes;\r\n\r\n    FT_Pointer          request_data;\r\n    FTC_Face_Requester  request_face;\r\n\r\n  } FTC_ManagerRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_Compress                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to check the state of the cache manager if   */\r\n  /*    its `num_bytes' field is greater than its `max_bytes' field.  It   */\r\n  /*    will flush as many old cache nodes as possible (ignoring cache     */\r\n  /*    nodes with a non-zero reference count).                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    manager :: A handle to the cache manager.                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Client applications should not call this function directly.  It is */\r\n  /*    normally invoked by specific cache implementations.                */\r\n  /*                                                                       */\r\n  /*    The reason this function is exported is to allow client-specific   */\r\n  /*    cache classes.                                                     */\r\n  /*                                                                       */\r\n  FT_LOCAL( void )\r\n  FTC_Manager_Compress( FTC_Manager  manager );\r\n\r\n\r\n  /* try to flush `count' old nodes from the cache; return the number\r\n   * of really flushed nodes\r\n   */\r\n  FT_LOCAL( FT_UInt )\r\n  FTC_Manager_FlushN( FTC_Manager  manager,\r\n                      FT_UInt      count );\r\n\r\n\r\n  /* this must be used internally for the moment */\r\n  FT_LOCAL( FT_Error )\r\n  FTC_Manager_RegisterCache( FTC_Manager      manager,\r\n                             FTC_CacheClass   clazz,\r\n                             FTC_Cache       *acache );\r\n\r\n /* */\r\n\r\n#define FTC_SCALER_COMPARE( a, b )                \\\r\n    ( (a)->face_id      == (b)->face_id      &&   \\\r\n      (a)->width        == (b)->width        &&   \\\r\n      (a)->height       == (b)->height       &&   \\\r\n      ((a)->pixel != 0) == ((b)->pixel != 0) &&   \\\r\n      ( (a)->pixel ||                             \\\r\n        ( (a)->x_res == (b)->x_res &&             \\\r\n          (a)->y_res == (b)->y_res ) ) )\r\n\r\n#define FTC_SCALER_HASH( q )                                 \\\r\n    ( _FTC_FACE_ID_HASH( (q)->face_id ) +                     \\\r\n      (q)->width + (q)->height*7 +                           \\\r\n      ( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCMANAG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcmru.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcmru.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType MRU support (body).                                         */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2006, 2009 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcmru.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"ftcerror.h\"\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruNode_Prepend( FTC_MruNode  *plist,\r\n                       FTC_MruNode   node )\r\n  {\r\n    FTC_MruNode  first = *plist;\r\n\r\n\r\n    if ( first )\r\n    {\r\n      FTC_MruNode  last = first->prev;\r\n\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n      {\r\n        FTC_MruNode  cnode = first;\r\n\r\n\r\n        do\r\n        {\r\n          if ( cnode == node )\r\n          {\r\n            fprintf( stderr, \"FTC_MruNode_Prepend: invalid action\\n\" );\r\n            exit( 2 );\r\n          }\r\n          cnode = cnode->next;\r\n\r\n        } while ( cnode != first );\r\n      }\r\n#endif\r\n\r\n      first->prev = node;\r\n      last->next  = node;\r\n      node->next  = first;\r\n      node->prev  = last;\r\n    }\r\n    else\r\n    {\r\n      node->next = node;\r\n      node->prev = node;\r\n    }\r\n    *plist = node;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruNode_Up( FTC_MruNode  *plist,\r\n                  FTC_MruNode   node )\r\n  {\r\n    FTC_MruNode  first = *plist;\r\n\r\n\r\n    FT_ASSERT( first != NULL );\r\n\r\n    if ( first != node )\r\n    {\r\n      FTC_MruNode  prev, next, last;\r\n\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n      {\r\n        FTC_MruNode  cnode = first;\r\n        do\r\n        {\r\n          if ( cnode == node )\r\n            goto Ok;\r\n          cnode = cnode->next;\r\n\r\n        } while ( cnode != first );\r\n\r\n        fprintf( stderr, \"FTC_MruNode_Up: invalid action\\n\" );\r\n        exit( 2 );\r\n      Ok:\r\n      }\r\n#endif\r\n      prev = node->prev;\r\n      next = node->next;\r\n\r\n      prev->next = next;\r\n      next->prev = prev;\r\n\r\n      last = first->prev;\r\n\r\n      last->next  = node;\r\n      first->prev = node;\r\n\r\n      node->next = first;\r\n      node->prev = last;\r\n\r\n      *plist = node;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruNode_Remove( FTC_MruNode  *plist,\r\n                      FTC_MruNode   node )\r\n  {\r\n    FTC_MruNode  first = *plist;\r\n    FTC_MruNode  prev, next;\r\n\r\n\r\n    FT_ASSERT( first != NULL );\r\n\r\n#ifdef FT_DEBUG_ERROR\r\n      {\r\n        FTC_MruNode  cnode = first;\r\n\r\n\r\n        do\r\n        {\r\n          if ( cnode == node )\r\n            goto Ok;\r\n          cnode = cnode->next;\r\n\r\n        } while ( cnode != first );\r\n\r\n        fprintf( stderr, \"FTC_MruNode_Remove: invalid action\\n\" );\r\n        exit( 2 );\r\n      Ok:\r\n      }\r\n#endif\r\n\r\n    prev = node->prev;\r\n    next = node->next;\r\n\r\n    prev->next = next;\r\n    next->prev = prev;\r\n\r\n    if ( node == next )\r\n    {\r\n      FT_ASSERT( first == node );\r\n      FT_ASSERT( prev  == node );\r\n\r\n      *plist = NULL;\r\n    }\r\n    else if ( node == first )\r\n      *plist = next;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruList_Init( FTC_MruList       list,\r\n                    FTC_MruListClass  clazz,\r\n                    FT_UInt           max_nodes,\r\n                    FT_Pointer        data,\r\n                    FT_Memory         memory )\r\n  {\r\n    list->num_nodes = 0;\r\n    list->max_nodes = max_nodes;\r\n    list->nodes     = NULL;\r\n    list->clazz     = *clazz;\r\n    list->data      = data;\r\n    list->memory    = memory;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruList_Reset( FTC_MruList  list )\r\n  {\r\n    while ( list->nodes )\r\n      FTC_MruList_Remove( list, list->nodes );\r\n\r\n    FT_ASSERT( list->num_nodes == 0 );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruList_Done( FTC_MruList  list )\r\n  {\r\n    FTC_MruList_Reset( list );\r\n  }\r\n\r\n\r\n#ifndef FTC_INLINE\r\n  FT_LOCAL_DEF( FTC_MruNode )\r\n  FTC_MruList_Find( FTC_MruList  list,\r\n                    FT_Pointer   key )\r\n  {\r\n    FTC_MruNode_CompareFunc  compare = list->clazz.node_compare;\r\n    FTC_MruNode              first, node;\r\n\r\n\r\n    first = list->nodes;\r\n    node  = NULL;\r\n\r\n    if ( first )\r\n    {\r\n      node = first;\r\n      do\r\n      {\r\n        if ( compare( node, key ) )\r\n        {\r\n          if ( node != first )\r\n            FTC_MruNode_Up( &list->nodes, node );\r\n\r\n          return node;\r\n        }\r\n\r\n        node = node->next;\r\n\r\n      } while ( node != first);\r\n    }\r\n\r\n    return NULL;\r\n  }\r\n#endif\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_MruList_New( FTC_MruList   list,\r\n                   FT_Pointer    key,\r\n                   FTC_MruNode  *anode )\r\n  {\r\n    FT_Error     error;\r\n    FTC_MruNode  node = NULL;\r\n    FT_Memory    memory = list->memory;\r\n\r\n\r\n    if ( list->num_nodes >= list->max_nodes && list->max_nodes > 0 )\r\n    {\r\n      node = list->nodes->prev;\r\n\r\n      FT_ASSERT( node );\r\n\r\n      if ( list->clazz.node_reset )\r\n      {\r\n        FTC_MruNode_Up( &list->nodes, node );\r\n\r\n        error = list->clazz.node_reset( node, key, list->data );\r\n        if ( !error )\r\n          goto Exit;\r\n      }\r\n\r\n      FTC_MruNode_Remove( &list->nodes, node );\r\n      list->num_nodes--;\r\n\r\n      if ( list->clazz.node_done )\r\n        list->clazz.node_done( node, list->data );\r\n    }\r\n    else if ( FT_ALLOC( node, list->clazz.node_size ) )\r\n      goto Exit;\r\n\r\n    error = list->clazz.node_init( node, key, list->data );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    FTC_MruNode_Prepend( &list->nodes, node );\r\n    list->num_nodes++;\r\n\r\n  Exit:\r\n    *anode = node;\r\n    return error;\r\n\r\n  Fail:\r\n    if ( list->clazz.node_done )\r\n      list->clazz.node_done( node, list->data );\r\n\r\n    FT_FREE( node );\r\n    goto Exit;\r\n  }\r\n\r\n\r\n#ifndef FTC_INLINE\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_MruList_Lookup( FTC_MruList   list,\r\n                      FT_Pointer    key,\r\n                      FTC_MruNode  *anode )\r\n  {\r\n    FTC_MruNode  node;\r\n\r\n\r\n    node = FTC_MruList_Find( list, key );\r\n    if ( node == NULL )\r\n      return FTC_MruList_New( list, key, anode );\r\n\r\n    *anode = node;\r\n    return 0;\r\n  }\r\n#endif /* FTC_INLINE */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruList_Remove( FTC_MruList  list,\r\n                      FTC_MruNode  node )\r\n  {\r\n    FTC_MruNode_Remove( &list->nodes, node );\r\n    list->num_nodes--;\r\n\r\n    {\r\n      FT_Memory  memory = list->memory;\r\n\r\n\r\n      if ( list->clazz.node_done )\r\n        list->clazz.node_done( node, list->data );\r\n\r\n      FT_FREE( node );\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_MruList_RemoveSelection( FTC_MruList              list,\r\n                               FTC_MruNode_CompareFunc  selection,\r\n                               FT_Pointer               key )\r\n  {\r\n    FTC_MruNode  first, node, next;\r\n\r\n\r\n    first = list->nodes;\r\n    while ( first && ( selection == NULL || selection( first, key ) ) )\r\n    {\r\n      FTC_MruList_Remove( list, first );\r\n      first = list->nodes;\r\n    }\r\n\r\n    if ( first )\r\n    {\r\n      node = first->next;\r\n      while ( node != first )\r\n      {\r\n        next = node->next;\r\n\r\n        if ( selection( node, key ) )\r\n          FTC_MruList_Remove( list, node );\r\n\r\n        node = next;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcmru.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcmru.h                                                               */\r\n/*                                                                         */\r\n/*    Simple MRU list-cache (specification).                               */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2004, 2005, 2006, 2010 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* An MRU is a list that cannot hold more than a certain number of       */\r\n  /* elements (`max_elements').  All elements in the list are sorted in    */\r\n  /* least-recently-used order, i.e., the `oldest' element is at the tail  */\r\n  /* of the list.                                                          */\r\n  /*                                                                       */\r\n  /* When doing a lookup (either through `Lookup()' or `Lookup_Node()'),   */\r\n  /* the list is searched for an element with the corresponding key.  If   */\r\n  /* it is found, the element is moved to the head of the list and is      */\r\n  /* returned.                                                             */\r\n  /*                                                                       */\r\n  /* If no corresponding element is found, the lookup routine will try to  */\r\n  /* obtain a new element with the relevant key.  If the list is already   */\r\n  /* full, the oldest element from the list is discarded and replaced by a */\r\n  /* new one; a new element is added to the list otherwise.                */\r\n  /*                                                                       */\r\n  /* Note that it is possible to pre-allocate the element list nodes.      */\r\n  /* This is handy if `max_elements' is sufficiently small, as it saves    */\r\n  /* allocations/releases during the lookup process.                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTCMRU_H__\r\n#define __FTCMRU_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n#define  xxFT_DEBUG_ERROR\r\n#define  FTC_INLINE\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  typedef struct FTC_MruNodeRec_*  FTC_MruNode;\r\n\r\n  typedef struct  FTC_MruNodeRec_\r\n  {\r\n    FTC_MruNode  next;\r\n    FTC_MruNode  prev;\r\n\r\n  } FTC_MruNodeRec;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruNode_Prepend( FTC_MruNode  *plist,\r\n                       FTC_MruNode   node );\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruNode_Up( FTC_MruNode  *plist,\r\n                  FTC_MruNode   node );\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruNode_Remove( FTC_MruNode  *plist,\r\n                      FTC_MruNode   node );\r\n\r\n\r\n  typedef struct FTC_MruListRec_*              FTC_MruList;\r\n\r\n  typedef struct FTC_MruListClassRec_ const *  FTC_MruListClass;\r\n\r\n\r\n  typedef FT_Bool\r\n  (*FTC_MruNode_CompareFunc)( FTC_MruNode  node,\r\n                              FT_Pointer   key );\r\n\r\n  typedef FT_Error\r\n  (*FTC_MruNode_InitFunc)( FTC_MruNode  node,\r\n                           FT_Pointer   key,\r\n                           FT_Pointer   data );\r\n\r\n  typedef FT_Error\r\n  (*FTC_MruNode_ResetFunc)( FTC_MruNode  node,\r\n                            FT_Pointer   key,\r\n                            FT_Pointer   data );\r\n\r\n  typedef void\r\n  (*FTC_MruNode_DoneFunc)( FTC_MruNode  node,\r\n                           FT_Pointer   data );\r\n\r\n\r\n  typedef struct  FTC_MruListClassRec_\r\n  {\r\n    FT_Offset                node_size;\r\n    FTC_MruNode_CompareFunc  node_compare;\r\n    FTC_MruNode_InitFunc     node_init;\r\n    FTC_MruNode_ResetFunc    node_reset;\r\n    FTC_MruNode_DoneFunc     node_done;\r\n\r\n  } FTC_MruListClassRec;\r\n\r\n  typedef struct  FTC_MruListRec_\r\n  {\r\n    FT_UInt              num_nodes;\r\n    FT_UInt              max_nodes;\r\n    FTC_MruNode          nodes;\r\n    FT_Pointer           data;\r\n    FTC_MruListClassRec  clazz;\r\n    FT_Memory            memory;\r\n\r\n  } FTC_MruListRec;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruList_Init( FTC_MruList       list,\r\n                    FTC_MruListClass  clazz,\r\n                    FT_UInt           max_nodes,\r\n                    FT_Pointer        data,\r\n                    FT_Memory         memory );\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruList_Reset( FTC_MruList  list );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruList_Done( FTC_MruList  list );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  FTC_MruList_New( FTC_MruList   list,\r\n                   FT_Pointer    key,\r\n                   FTC_MruNode  *anode );\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruList_Remove( FTC_MruList  list,\r\n                      FTC_MruNode  node );\r\n\r\n  FT_LOCAL( void )\r\n  FTC_MruList_RemoveSelection( FTC_MruList              list,\r\n                               FTC_MruNode_CompareFunc  selection,\r\n                               FT_Pointer               key );\r\n\r\n\r\n#ifdef FTC_INLINE\r\n\r\n#define FTC_MRULIST_LOOKUP_CMP( list, key, compare, node, error )           \\\r\n  FT_BEGIN_STMNT                                                            \\\r\n    FTC_MruNode*             _pfirst  = &(list)->nodes;                     \\\r\n    FTC_MruNode_CompareFunc  _compare = (FTC_MruNode_CompareFunc)(compare); \\\r\n    FTC_MruNode              _first, _node;                                 \\\r\n                                                                            \\\r\n                                                                            \\\r\n    error  = FTC_Err_Ok;                                                    \\\r\n    _first = *(_pfirst);                                                    \\\r\n    _node  = NULL;                                                          \\\r\n                                                                            \\\r\n    if ( _first )                                                           \\\r\n    {                                                                       \\\r\n      _node = _first;                                                       \\\r\n      do                                                                    \\\r\n      {                                                                     \\\r\n        if ( _compare( _node, (key) ) )                                     \\\r\n        {                                                                   \\\r\n          if ( _node != _first )                                            \\\r\n            FTC_MruNode_Up( _pfirst, _node );                               \\\r\n                                                                            \\\r\n          node = _node;                                                     \\\r\n          goto _MruOk;                                                      \\\r\n        }                                                                   \\\r\n        _node = _node->next;                                                \\\r\n                                                                            \\\r\n      } while ( _node != _first) ;                                          \\\r\n    }                                                                       \\\r\n                                                                            \\\r\n    error = FTC_MruList_New( (list), (key), (FTC_MruNode*)(void*)&(node) ); \\\r\n  _MruOk:                                                                   \\\r\n    ;                                                                       \\\r\n  FT_END_STMNT\r\n\r\n#define FTC_MRULIST_LOOKUP( list, key, node, error ) \\\r\n  FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error )\r\n\r\n#else  /* !FTC_INLINE */\r\n\r\n  FT_LOCAL( FTC_MruNode )\r\n  FTC_MruList_Find( FTC_MruList  list,\r\n                    FT_Pointer   key );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  FTC_MruList_Lookup( FTC_MruList   list,\r\n                      FT_Pointer    key,\r\n                      FTC_MruNode  *pnode );\r\n\r\n#define FTC_MRULIST_LOOKUP( list, key, node, error ) \\\r\n  error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) )\r\n\r\n#endif /* !FTC_INLINE */\r\n\r\n\r\n#define FTC_MRULIST_LOOP( list, node )        \\\r\n  FT_BEGIN_STMNT                              \\\r\n    FTC_MruNode  _first = (list)->nodes;      \\\r\n                                              \\\r\n                                              \\\r\n    if ( _first )                             \\\r\n    {                                         \\\r\n      FTC_MruNode  _node = _first;            \\\r\n                                              \\\r\n                                              \\\r\n      do                                      \\\r\n      {                                       \\\r\n        *(FTC_MruNode*)&(node) = _node;\r\n\r\n\r\n#define FTC_MRULIST_LOOP_END()               \\\r\n        _node = _node->next;                 \\\r\n                                             \\\r\n      } while ( _node != _first );           \\\r\n    }                                        \\\r\n  FT_END_STMNT\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTCMRU_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcsbits.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcsbits.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType sbits manager (body).                                       */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcsbits.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_ERRORS_H\r\n\r\n#include \"ftccback.h\"\r\n#include \"ftcerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cache\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     SBIT CACHE NODES                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  static FT_Error\r\n  ftc_sbit_copy_bitmap( FTC_SBit    sbit,\r\n                        FT_Bitmap*  bitmap,\r\n                        FT_Memory   memory )\r\n  {\r\n    FT_Error  error;\r\n    FT_Int    pitch = bitmap->pitch;\r\n    FT_ULong  size;\r\n\r\n\r\n    if ( pitch < 0 )\r\n      pitch = -pitch;\r\n\r\n    size = (FT_ULong)( pitch * bitmap->rows );\r\n\r\n    if ( !FT_ALLOC( sbit->buffer, size ) )\r\n      FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ftc_snode_free( FTC_Node   ftcsnode,\r\n                  FTC_Cache  cache )\r\n  {\r\n    FTC_SNode  snode  = (FTC_SNode)ftcsnode;\r\n    FTC_SBit   sbit   = snode->sbits;\r\n    FT_UInt    count  = snode->count;\r\n    FT_Memory  memory = cache->memory;\r\n\r\n\r\n    for ( ; count > 0; sbit++, count-- )\r\n      FT_FREE( sbit->buffer );\r\n\r\n    FTC_GNode_Done( FTC_GNODE( snode ), cache );\r\n\r\n    FT_FREE( snode );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FTC_SNode_Free( FTC_SNode  snode,\r\n                  FTC_Cache  cache )\r\n  {\r\n    ftc_snode_free( FTC_NODE( snode ), cache );\r\n  }\r\n\r\n\r\n  /*\r\n   *  This function tries to load a small bitmap within a given FTC_SNode.\r\n   *  Note that it returns a non-zero error code _only_ in the case of\r\n   *  out-of-memory condition.  For all other errors (e.g., corresponding\r\n   *  to a bad font file), this function will mark the sbit as `unavailable'\r\n   *  and return a value of 0.\r\n   *\r\n   *  You should also read the comment within the @ftc_snode_compare\r\n   *  function below to see how out-of-memory is handled during a lookup.\r\n   */\r\n  static FT_Error\r\n  ftc_snode_load( FTC_SNode    snode,\r\n                  FTC_Manager  manager,\r\n                  FT_UInt      gindex,\r\n                  FT_ULong    *asize )\r\n  {\r\n    FT_Error          error;\r\n    FTC_GNode         gnode  = FTC_GNODE( snode );\r\n    FTC_Family        family = gnode->family;\r\n    FT_Memory         memory = manager->memory;\r\n    FT_Face           face;\r\n    FTC_SBit          sbit;\r\n    FTC_SFamilyClass  clazz;\r\n\r\n\r\n    if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )\r\n    {\r\n      FT_ERROR(( \"ftc_snode_load: invalid glyph index\" ));\r\n      return FTC_Err_Invalid_Argument;\r\n    }\r\n\r\n    sbit  = snode->sbits + ( gindex - gnode->gindex );\r\n    clazz = (FTC_SFamilyClass)family->clazz;\r\n\r\n    sbit->buffer = 0;\r\n\r\n    error = clazz->family_load_glyph( family, gindex, manager, &face );\r\n    if ( error )\r\n      goto BadGlyph;\r\n\r\n    {\r\n      FT_Int        temp;\r\n      FT_GlyphSlot  slot   = face->glyph;\r\n      FT_Bitmap*    bitmap = &slot->bitmap;\r\n      FT_Pos        xadvance, yadvance; /* FT_GlyphSlot->advance.{x|y} */\r\n\r\n\r\n      if ( slot->format != FT_GLYPH_FORMAT_BITMAP )\r\n      {\r\n        FT_TRACE0(( \"ftc_snode_load:\"\r\n                    \" glyph loaded didn't return a bitmap\\n\" ));\r\n        goto BadGlyph;\r\n      }\r\n\r\n      /* Check that our values fit into 8-bit containers!       */\r\n      /* If this is not the case, our bitmap is too large       */\r\n      /* and we will leave it as `missing' with sbit.buffer = 0 */\r\n\r\n#define CHECK_CHAR( d )  ( temp = (FT_Char)d, temp == d )\r\n#define CHECK_BYTE( d )  ( temp = (FT_Byte)d, temp == d )\r\n\r\n      /* horizontal advance in pixels */\r\n      xadvance = ( slot->advance.x + 32 ) >> 6;\r\n      yadvance = ( slot->advance.y + 32 ) >> 6;\r\n\r\n      if ( !CHECK_BYTE( bitmap->rows  )     ||\r\n           !CHECK_BYTE( bitmap->width )     ||\r\n           !CHECK_CHAR( bitmap->pitch )     ||\r\n           !CHECK_CHAR( slot->bitmap_left ) ||\r\n           !CHECK_CHAR( slot->bitmap_top  ) ||\r\n           !CHECK_CHAR( xadvance )          ||\r\n           !CHECK_CHAR( yadvance )          )\r\n      {\r\n        FT_TRACE2(( \"ftc_snode_load:\"\r\n                    \" glyph too large for small bitmap cache\\n\"));\r\n        goto BadGlyph;\r\n      }\r\n\r\n      sbit->width     = (FT_Byte)bitmap->width;\r\n      sbit->height    = (FT_Byte)bitmap->rows;\r\n      sbit->pitch     = (FT_Char)bitmap->pitch;\r\n      sbit->left      = (FT_Char)slot->bitmap_left;\r\n      sbit->top       = (FT_Char)slot->bitmap_top;\r\n      sbit->xadvance  = (FT_Char)xadvance;\r\n      sbit->yadvance  = (FT_Char)yadvance;\r\n      sbit->format    = (FT_Byte)bitmap->pixel_mode;\r\n      sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);\r\n\r\n      /* copy the bitmap into a new buffer -- ignore error */\r\n      error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );\r\n\r\n      /* now, compute size */\r\n      if ( asize )\r\n        *asize = FT_ABS( sbit->pitch ) * sbit->height;\r\n\r\n    } /* glyph loading successful */\r\n\r\n    /* ignore the errors that might have occurred --   */\r\n    /* we mark unloaded glyphs with `sbit.buffer == 0' */\r\n    /* and `width == 255', `height == 0'               */\r\n    /*                                                 */\r\n    if ( error && error != FTC_Err_Out_Of_Memory )\r\n    {\r\n    BadGlyph:\r\n      sbit->width  = 255;\r\n      sbit->height = 0;\r\n      sbit->buffer = NULL;\r\n      error        = FTC_Err_Ok;\r\n      if ( asize )\r\n        *asize = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  FTC_SNode_New( FTC_SNode  *psnode,\r\n                 FTC_GQuery  gquery,\r\n                 FTC_Cache   cache )\r\n  {\r\n    FT_Memory   memory = cache->memory;\r\n    FT_Error    error;\r\n    FTC_SNode   snode  = NULL;\r\n    FT_UInt     gindex = gquery->gindex;\r\n    FTC_Family  family = gquery->family;\r\n\r\n    FTC_SFamilyClass  clazz = FTC_CACHE__SFAMILY_CLASS( cache );\r\n    FT_UInt           total;\r\n    FT_UInt           node_count;\r\n\r\n\r\n    total = clazz->family_get_count( family, cache->manager );\r\n    if ( total == 0 || gindex >= total )\r\n    {\r\n      error = FTC_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( !FT_NEW( snode ) )\r\n    {\r\n      FT_UInt  count, start;\r\n\r\n\r\n      start = gindex - ( gindex % FTC_SBIT_ITEMS_PER_NODE );\r\n      count = total - start;\r\n      if ( count > FTC_SBIT_ITEMS_PER_NODE )\r\n        count = FTC_SBIT_ITEMS_PER_NODE;\r\n\r\n      FTC_GNode_Init( FTC_GNODE( snode ), start, family );\r\n\r\n      snode->count = count;\r\n      for ( node_count = 0; node_count < count; node_count++ )\r\n      {\r\n        snode->sbits[node_count].width = 255;\r\n      }\r\n\r\n      error = ftc_snode_load( snode,\r\n                              cache->manager,\r\n                              gindex,\r\n                              NULL );\r\n      if ( error )\r\n      {\r\n        FTC_SNode_Free( snode, cache );\r\n        snode = NULL;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    *psnode = snode;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ftc_snode_new( FTC_Node   *ftcpsnode,\r\n                 FT_Pointer  ftcgquery,\r\n                 FTC_Cache   cache )\r\n  {\r\n    FTC_SNode  *psnode = (FTC_SNode*)ftcpsnode;\r\n    FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;\r\n\r\n\r\n    return FTC_SNode_New( psnode, gquery, cache );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Offset )\r\n  ftc_snode_weight( FTC_Node   ftcsnode,\r\n                    FTC_Cache  cache )\r\n  {\r\n    FTC_SNode  snode = (FTC_SNode)ftcsnode;\r\n    FT_UInt    count = snode->count;\r\n    FTC_SBit   sbit  = snode->sbits;\r\n    FT_Int     pitch;\r\n    FT_Offset  size;\r\n\r\n    FT_UNUSED( cache );\r\n\r\n\r\n    FT_ASSERT( snode->count <= FTC_SBIT_ITEMS_PER_NODE );\r\n\r\n    /* the node itself */\r\n    size = sizeof ( *snode );\r\n\r\n    for ( ; count > 0; count--, sbit++ )\r\n    {\r\n      if ( sbit->buffer )\r\n      {\r\n        pitch = sbit->pitch;\r\n        if ( pitch < 0 )\r\n          pitch = -pitch;\r\n\r\n        /* add the size of a given glyph image */\r\n        size += pitch * sbit->height;\r\n      }\r\n    }\r\n\r\n    return size;\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  FT_LOCAL_DEF( FT_Offset )\r\n  FTC_SNode_Weight( FTC_SNode  snode )\r\n  {\r\n    return ftc_snode_weight( FTC_NODE( snode ), NULL );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  ftc_snode_compare( FTC_Node    ftcsnode,\r\n                     FT_Pointer  ftcgquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed )\r\n  {\r\n    FTC_SNode   snode  = (FTC_SNode)ftcsnode;\r\n    FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;\r\n    FTC_GNode   gnode  = FTC_GNODE( snode );\r\n    FT_UInt     gindex = gquery->gindex;\r\n    FT_Bool     result;\r\n\r\n\r\n    if (list_changed)\r\n      *list_changed = FALSE;\r\n    result = FT_BOOL( gnode->family == gquery->family                    &&\r\n                      (FT_UInt)( gindex - gnode->gindex ) < snode->count );\r\n    if ( result )\r\n    {\r\n      /* check if we need to load the glyph bitmap now */\r\n      FTC_SBit  sbit = snode->sbits + ( gindex - gnode->gindex );\r\n\r\n\r\n      /*\r\n       *  The following code illustrates what to do when you want to\r\n       *  perform operations that may fail within a lookup function.\r\n       *\r\n       *  Here, we want to load a small bitmap on-demand; we thus\r\n       *  need to call the `ftc_snode_load' function which may return\r\n       *  a non-zero error code only when we are out of memory (OOM).\r\n       *\r\n       *  The correct thing to do is to use @FTC_CACHE_TRYLOOP and\r\n       *  @FTC_CACHE_TRYLOOP_END in order to implement a retry loop\r\n       *  that is capable of flushing the cache incrementally when\r\n       *  an OOM errors occur.\r\n       *\r\n       *  However, we need to `lock' the node before this operation to\r\n       *  prevent it from being flushed within the loop.\r\n       *\r\n       *  When we exit the loop, we unlock the node, then check the `error'\r\n       *  variable.  If it is non-zero, this means that the cache was\r\n       *  completely flushed and that no usable memory was found to load\r\n       *  the bitmap.\r\n       *\r\n       *  We then prefer to return a value of 0 (i.e., NO MATCH).  This\r\n       *  ensures that the caller will try to allocate a new node.\r\n       *  This operation consequently _fail_ and the lookup function\r\n       *  returns the appropriate OOM error code.\r\n       *\r\n       *  Note that `buffer == NULL && width == 255' is a hack used to\r\n       *  tag `unavailable' bitmaps in the array.  We should never try\r\n       *  to load these.\r\n       *\r\n       */\r\n\r\n      if ( sbit->buffer == NULL && sbit->width == 255 )\r\n      {\r\n        FT_ULong  size;\r\n        FT_Error  error;\r\n\r\n\r\n        ftcsnode->ref_count++;  /* lock node to prevent flushing */\r\n                                /* in retry loop                 */\r\n\r\n        FTC_CACHE_TRYLOOP( cache )\r\n        {\r\n          error = ftc_snode_load( snode, cache->manager, gindex, &size );\r\n        }\r\n        FTC_CACHE_TRYLOOP_END( list_changed );\r\n\r\n        ftcsnode->ref_count--;  /* unlock the node */\r\n\r\n        if ( error )\r\n          result = 0;\r\n        else\r\n          cache->manager->cur_weight += size;\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n#ifdef FTC_INLINE\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  FTC_SNode_Compare( FTC_SNode   snode,\r\n                     FTC_GQuery  gquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed )\r\n  {\r\n    return ftc_snode_compare( FTC_NODE( snode ), gquery,\r\n                              cache, list_changed );\r\n  }\r\n\r\n#endif\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/ftcsbits.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcsbits.h                                                             */\r\n/*                                                                         */\r\n/*    A small-bitmap cache (specification).                                */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2006, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCSBITS_H__\r\n#define __FTCSBITS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CACHE_H\r\n#include \"ftcglyph.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#define FTC_SBIT_ITEMS_PER_NODE  16\r\n\r\n  typedef struct  FTC_SNodeRec_\r\n  {\r\n    FTC_GNodeRec  gnode;\r\n    FT_UInt       count;\r\n    FTC_SBitRec   sbits[FTC_SBIT_ITEMS_PER_NODE];\r\n\r\n  } FTC_SNodeRec, *FTC_SNode;\r\n\r\n\r\n#define FTC_SNODE( x )         ( (FTC_SNode)( x ) )\r\n#define FTC_SNODE_GINDEX( x )  FTC_GNODE( x )->gindex\r\n#define FTC_SNODE_FAMILY( x )  FTC_GNODE( x )->family\r\n\r\n  typedef FT_UInt\r\n  (*FTC_SFamily_GetCountFunc)( FTC_Family   family,\r\n                               FTC_Manager  manager );\r\n\r\n  typedef FT_Error\r\n  (*FTC_SFamily_LoadGlyphFunc)( FTC_Family   family,\r\n                                FT_UInt      gindex,\r\n                                FTC_Manager  manager,\r\n                                FT_Face     *aface );\r\n\r\n  typedef struct  FTC_SFamilyClassRec_\r\n  {\r\n    FTC_MruListClassRec        clazz;\r\n    FTC_SFamily_GetCountFunc   family_get_count;\r\n    FTC_SFamily_LoadGlyphFunc  family_load_glyph;\r\n\r\n  } FTC_SFamilyClassRec;\r\n\r\n  typedef const FTC_SFamilyClassRec*  FTC_SFamilyClass;\r\n\r\n#define FTC_SFAMILY_CLASS( x )  ((FTC_SFamilyClass)(x))\r\n\r\n#define FTC_CACHE__SFAMILY_CLASS( x )  \\\r\n          FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class )\r\n\r\n\r\n  FT_LOCAL( void )\r\n  FTC_SNode_Free( FTC_SNode  snode,\r\n                  FTC_Cache  cache );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  FTC_SNode_New( FTC_SNode   *psnode,\r\n                 FTC_GQuery   gquery,\r\n                 FTC_Cache    cache );\r\n\r\n#if 0\r\n  FT_LOCAL( FT_ULong )\r\n  FTC_SNode_Weight( FTC_SNode  inode );\r\n#endif\r\n\r\n\r\n#ifdef FTC_INLINE\r\n\r\n  FT_LOCAL( FT_Bool )\r\n  FTC_SNode_Compare( FTC_SNode   snode,\r\n                     FTC_GQuery  gquery,\r\n                     FTC_Cache   cache,\r\n                     FT_Bool*    list_changed);\r\n\r\n#endif\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCSBITS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cache/rules.mk",
    "content": "#\r\n# FreeType 2 Cache configuration rules\r\n#\r\n\r\n\r\n# Copyright 2000, 2001, 2003, 2004, 2006, 2008 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# Cache driver directory\r\n#\r\nCACHE_DIR   := $(SRC_DIR)/cache\r\n\r\n# compilation flags for the driver\r\n#\r\nCACHE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CACHE_DIR))\r\n\r\n\r\n# Cache driver sources (i.e., C files)\r\n#\r\nCACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \\\r\n                 $(CACHE_DIR)/ftccache.c \\\r\n                 $(CACHE_DIR)/ftccmap.c  \\\r\n                 $(CACHE_DIR)/ftcglyph.c \\\r\n                 $(CACHE_DIR)/ftcimage.c \\\r\n                 $(CACHE_DIR)/ftcmanag.c \\\r\n                 $(CACHE_DIR)/ftcmru.c   \\\r\n                 $(CACHE_DIR)/ftcsbits.c\r\n\r\n# Cache driver headers\r\n#\r\nCACHE_DRV_H := $(CACHE_DIR)/ftccache.h \\\r\n               $(CACHE_DIR)/ftccback.h \\\r\n               $(CACHE_DIR)/ftcerror.h \\\r\n               $(CACHE_DIR)/ftcglyph.h \\\r\n               $(CACHE_DIR)/ftcimage.h \\\r\n               $(CACHE_DIR)/ftcmanag.h \\\r\n               $(CACHE_DIR)/ftcmru.h   \\\r\n               $(CACHE_DIR)/ftcsbits.h\r\n\r\n\r\n# Cache driver object(s)\r\n#\r\n#   CACHE_DRV_OBJ_M is used during `multi' builds.\r\n#   CACHE_DRV_OBJ_S is used during `single' builds.\r\n#\r\nCACHE_DRV_OBJ_M := $(CACHE_DRV_SRC:$(CACHE_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nCACHE_DRV_OBJ_S := $(OBJ_DIR)/ftcache.$O\r\n\r\n# Cache driver source file for single build\r\n#\r\nCACHE_DRV_SRC_S := $(CACHE_DIR)/ftcache.c\r\n\r\n\r\n# Cache driver - single object\r\n#\r\n$(CACHE_DRV_OBJ_S): $(CACHE_DRV_SRC_S) $(CACHE_DRV_SRC) \\\r\n                   $(FREETYPE_H) $(CACHE_DRV_H)\r\n\t$(CACHE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(CACHE_DRV_SRC_S))\r\n\r\n\r\n# Cache driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(CACHE_DIR)/%.c $(FREETYPE_H) $(CACHE_DRV_H)\r\n\t$(CACHE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(CACHE_DRV_OBJ_S)\r\nDRV_OBJS_M += $(CACHE_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/Jamfile",
    "content": "# FreeType 2 src/cff Jamfile\r\n#\r\n# Copyright 2001, 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) cff ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap cffpic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = cff ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/cff Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cff.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cff.c                                                                  */\r\n/*                                                                         */\r\n/*    FreeType OpenType driver component (body only).                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"cffpic.c\"\r\n#include \"cffdrivr.c\"\r\n#include \"cffparse.c\"\r\n#include \"cffload.c\"\r\n#include \"cffobjs.c\"\r\n#include \"cffgload.c\"\r\n#include \"cffcmap.c\"\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffcmap.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffcmap.c                                                              */\r\n/*                                                                         */\r\n/*    CFF character mapping table (cmap) support (body).                   */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2010 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"cffcmap.h\"\r\n#include \"cffload.h\"\r\n\r\n#include \"cfferrs.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****           CFF STANDARD (AND EXPERT) ENCODING CMAPS            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cff_cmap_encoding_init( CFF_CMapStd  cmap )\r\n  {\r\n    TT_Face       face     = (TT_Face)FT_CMAP_FACE( cmap );\r\n    CFF_Font      cff      = (CFF_Font)face->extra.data;\r\n    CFF_Encoding  encoding = &cff->encoding;\r\n\r\n\r\n    cmap->gids  = encoding->codes;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  cff_cmap_encoding_done( CFF_CMapStd  cmap )\r\n  {\r\n    cmap->gids  = NULL;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  cff_cmap_encoding_char_index( CFF_CMapStd  cmap,\r\n                                FT_UInt32    char_code )\r\n  {\r\n    FT_UInt  result = 0;\r\n\r\n\r\n    if ( char_code < 256 )\r\n      result = cmap->gids[char_code];\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  cff_cmap_encoding_char_next( CFF_CMapStd   cmap,\r\n                               FT_UInt32    *pchar_code )\r\n  {\r\n    FT_UInt    result    = 0;\r\n    FT_UInt32  char_code = *pchar_code;\r\n\r\n\r\n    *pchar_code = 0;\r\n\r\n    if ( char_code < 255 )\r\n    {\r\n      FT_UInt  code = (FT_UInt)(char_code + 1);\r\n\r\n\r\n      for (;;)\r\n      {\r\n        if ( code >= 256 )\r\n          break;\r\n\r\n        result = cmap->gids[code];\r\n        if ( result != 0 )\r\n        {\r\n          *pchar_code = code;\r\n          break;\r\n        }\r\n\r\n        code++;\r\n      }\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_DEFINE_CMAP_CLASS(cff_cmap_encoding_class_rec,\r\n    sizeof ( CFF_CMapStdRec ),\r\n\r\n    (FT_CMap_InitFunc)     cff_cmap_encoding_init,\r\n    (FT_CMap_DoneFunc)     cff_cmap_encoding_done,\r\n    (FT_CMap_CharIndexFunc)cff_cmap_encoding_char_index,\r\n    (FT_CMap_CharNextFunc) cff_cmap_encoding_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****              CFF SYNTHETIC UNICODE ENCODING CMAP              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_CALLBACK_DEF( const char* )\r\n  cff_sid_to_glyph_name( TT_Face  face,\r\n                         FT_UInt  idx )\r\n  {\r\n    CFF_Font     cff     = (CFF_Font)face->extra.data;\r\n    CFF_Charset  charset = &cff->charset;\r\n    FT_UInt      sid     = charset->sids[idx];\r\n\r\n\r\n    return cff_index_get_sid_string( cff, sid );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cff_cmap_unicode_init( PS_Unicodes  unicodes )\r\n  {\r\n    TT_Face             face    = (TT_Face)FT_CMAP_FACE( unicodes );\r\n    FT_Memory           memory  = FT_FACE_MEMORY( face );\r\n    CFF_Font            cff     = (CFF_Font)face->extra.data;\r\n    CFF_Charset         charset = &cff->charset;\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;\r\n\r\n\r\n    /* can't build Unicode map for CID-keyed font */\r\n    /* because we don't know glyph names.         */\r\n    if ( !charset->sids )\r\n      return CFF_Err_No_Unicode_Glyph_Name;\r\n\r\n    return psnames->unicodes_init( memory,\r\n                                   unicodes,\r\n                                   cff->num_glyphs,\r\n                                   (PS_GetGlyphNameFunc)&cff_sid_to_glyph_name,\r\n                                   (PS_FreeGlyphNameFunc)NULL,\r\n                                   (FT_Pointer)face );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  cff_cmap_unicode_done( PS_Unicodes  unicodes )\r\n  {\r\n    FT_Face    face   = FT_CMAP_FACE( unicodes );\r\n    FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n    FT_FREE( unicodes->maps );\r\n    unicodes->num_maps = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  cff_cmap_unicode_char_index( PS_Unicodes  unicodes,\r\n                               FT_UInt32    char_code )\r\n  {\r\n    TT_Face             face    = (TT_Face)FT_CMAP_FACE( unicodes );\r\n    CFF_Font            cff     = (CFF_Font)face->extra.data;\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;\r\n\r\n\r\n    return psnames->unicodes_char_index( unicodes, char_code );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  cff_cmap_unicode_char_next( PS_Unicodes  unicodes,\r\n                              FT_UInt32   *pchar_code )\r\n  {\r\n    TT_Face             face    = (TT_Face)FT_CMAP_FACE( unicodes );\r\n    CFF_Font            cff     = (CFF_Font)face->extra.data;\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;\r\n\r\n\r\n    return psnames->unicodes_char_next( unicodes, pchar_code );\r\n  }\r\n\r\n\r\n  FT_DEFINE_CMAP_CLASS(cff_cmap_unicode_class_rec,\r\n    sizeof ( PS_UnicodesRec ),\r\n\r\n    (FT_CMap_InitFunc)     cff_cmap_unicode_init,\r\n    (FT_CMap_DoneFunc)     cff_cmap_unicode_done,\r\n    (FT_CMap_CharIndexFunc)cff_cmap_unicode_char_index,\r\n    (FT_CMap_CharNextFunc) cff_cmap_unicode_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  )\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffcmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffcmap.h                                                              */\r\n/*                                                                         */\r\n/*    CFF character mapping table (cmap) support (specification).          */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFCMAP_H__\r\n#define __CFFCMAP_H__\r\n\r\n#include \"cffobjs.h\"\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****          TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* standard (and expert) encoding cmaps */\r\n  typedef struct CFF_CMapStdRec_*  CFF_CMapStd;\r\n\r\n  typedef struct  CFF_CMapStdRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_UShort*  gids;   /* up to 256 elements */\r\n\r\n  } CFF_CMapStdRec;\r\n\r\n\r\n  FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****               CFF SYNTHETIC UNICODE ENCODING CMAP             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* unicode (synthetic) cmaps */\r\n\r\n  FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffdrivr.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffdrivr.c                                                             */\r\n/*                                                                         */\r\n/*    OpenType font driver implementation (body).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_SERVICE_CID_H\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_TT_CMAP_H\r\n\r\n#include \"cffdrivr.h\"\r\n#include \"cffgload.h\"\r\n#include \"cffload.h\"\r\n#include \"cffcmap.h\"\r\n#include \"cffparse.h\"\r\n\r\n#include \"cfferrs.h\"\r\n#include \"cffpic.h\"\r\n\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cffdriver\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                          F A C E S                              ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#undef  PAIR_TAG\r\n#define PAIR_TAG( left, right )  ( ( (FT_ULong)left << 16 ) | \\\r\n                                     (FT_ULong)right        )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_get_kerning                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A driver method used to return the kerning vector between two      */\r\n  /*    glyphs of the same face.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to the source face object.                 */\r\n  /*                                                                       */\r\n  /*    left_glyph  :: The index of the left glyph in the kern pair.       */\r\n  /*                                                                       */\r\n  /*    right_glyph :: The index of the right glyph in the kern pair.      */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    kerning     :: The kerning vector.  This is in font units for      */\r\n  /*                   scalable formats, and in pixels for fixed-sizes     */\r\n  /*                   formats.                                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only horizontal layouts (left-to-right & right-to-left) are        */\r\n  /*    supported by this function.  Other layouts, or more sophisticated  */\r\n  /*    kernings, are out of scope of this method (the basic driver        */\r\n  /*    interface is meant to be simple).                                  */\r\n  /*                                                                       */\r\n  /*    They can be implemented by format-specific interfaces.             */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cff_get_kerning( FT_Face     ttface,          /* TT_Face */\r\n                   FT_UInt     left_glyph,\r\n                   FT_UInt     right_glyph,\r\n                   FT_Vector*  kerning )\r\n  {\r\n    TT_Face       face = (TT_Face)ttface;\r\n    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;\r\n\r\n\r\n    kerning->x = 0;\r\n    kerning->y = 0;\r\n\r\n    if ( sfnt )\r\n      kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n\r\n#undef PAIR_TAG\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_glyph_load                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A driver method used to load a glyph within a given glyph slot.    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot        :: A handle to the target slot object where the glyph  */\r\n  /*                   will be loaded.                                     */\r\n  /*                                                                       */\r\n  /*    size        :: A handle to the source face size at which the glyph */\r\n  /*                   must be scaled, loaded, etc.                        */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The index of the glyph in the font file.            */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   FT_LOAD_??? constants can be used to control the    */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cff_glyph_load( FT_GlyphSlot  cffslot,      /* CFF_GlyphSlot */\r\n                  FT_Size       cffsize,      /* CFF_Size      */\r\n                  FT_UInt       glyph_index,\r\n                  FT_Int32      load_flags )\r\n  {\r\n    FT_Error       error;\r\n    CFF_GlyphSlot  slot = (CFF_GlyphSlot)cffslot;\r\n    CFF_Size       size = (CFF_Size)cffsize;\r\n\r\n\r\n    if ( !slot )\r\n      return CFF_Err_Invalid_Slot_Handle;\r\n\r\n    /* check whether we want a scaled outline or bitmap */\r\n    if ( !size )\r\n      load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;\r\n\r\n    /* reset the size object if necessary */\r\n    if ( load_flags & FT_LOAD_NO_SCALE )\r\n      size = NULL;\r\n\r\n    if ( size )\r\n    {\r\n      /* these two objects must have the same parent */\r\n      if ( cffsize->face != cffslot->face )\r\n        return CFF_Err_Invalid_Face_Handle;\r\n    }\r\n\r\n    /* now load the glyph outline if necessary */\r\n    error = cff_slot_load( slot, size, glyph_index, load_flags );\r\n\r\n    /* force drop-out mode to 2 - irrelevant now */\r\n    /* slot->outline.dropout_mode = 2; */\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cff_get_advances( FT_Face    face,\r\n                    FT_UInt    start,\r\n                    FT_UInt    count,\r\n                    FT_Int32   flags,\r\n                    FT_Fixed*  advances )\r\n  {\r\n    FT_UInt       nn;\r\n    FT_Error      error = CFF_Err_Ok;\r\n    FT_GlyphSlot  slot  = face->glyph;\r\n\r\n\r\n    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;\r\n\r\n    for ( nn = 0; nn < count; nn++ )\r\n    {\r\n      error = cff_glyph_load( slot, face->size, start + nn, flags );\r\n      if ( error )\r\n        break;\r\n\r\n      advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )\r\n                     ? slot->linearVertAdvance\r\n                     : slot->linearHoriAdvance;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*\r\n   *  GLYPH DICT SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  cff_get_glyph_name( CFF_Face    face,\r\n                      FT_UInt     glyph_index,\r\n                      FT_Pointer  buffer,\r\n                      FT_UInt     buffer_max )\r\n  {\r\n    CFF_Font    font   = (CFF_Font)face->extra.data;\r\n    FT_String*  gname;\r\n    FT_UShort   sid;\r\n    FT_Error    error;\r\n\r\n\r\n    if ( !font->psnames )\r\n    {\r\n      FT_ERROR(( \"cff_get_glyph_name:\"\r\n                 \" cannot get glyph name from CFF & CEF fonts\\n\"\r\n                 \"                   \"\r\n                 \" without the `PSNames' module\\n\" ));\r\n      error = CFF_Err_Missing_Module;\r\n      goto Exit;\r\n    }\r\n\r\n    /* first, locate the sid in the charset table */\r\n    sid = font->charset.sids[glyph_index];\r\n\r\n    /* now, lookup the name itself */\r\n    gname = cff_index_get_sid_string( font, sid );\r\n\r\n    if ( gname )\r\n      FT_STRCPYN( buffer, gname, buffer_max );\r\n\r\n    error = CFF_Err_Ok;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  cff_get_name_index( CFF_Face    face,\r\n                      FT_String*  glyph_name )\r\n  {\r\n    CFF_Font            cff;\r\n    CFF_Charset         charset;\r\n    FT_Service_PsCMaps  psnames;\r\n    FT_String*          name;\r\n    FT_UShort           sid;\r\n    FT_UInt             i;\r\n\r\n\r\n    cff     = (CFF_FontRec *)face->extra.data;\r\n    charset = &cff->charset;\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );\r\n    if ( !psnames )\r\n      return 0;\r\n\r\n    for ( i = 0; i < cff->num_glyphs; i++ )\r\n    {\r\n      sid = charset->sids[i];\r\n\r\n      if ( sid > 390 )\r\n        name = cff_index_get_string( cff, sid - 391 );\r\n      else\r\n        name = (FT_String *)psnames->adobe_std_strings( sid );\r\n\r\n      if ( !name )\r\n        continue;\r\n\r\n      if ( !ft_strcmp( glyph_name, name ) )\r\n        return i;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,\r\n    (FT_GlyphDict_GetNameFunc)  cff_get_glyph_name,\r\n    (FT_GlyphDict_NameIndexFunc)cff_get_name_index\r\n  )\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT INFO SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Int\r\n  cff_ps_has_glyph_names( FT_Face  face )\r\n  {\r\n    return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_ps_get_font_info( CFF_Face         face,\r\n                        PS_FontInfoRec*  afont_info )\r\n  {\r\n    CFF_Font  cff   = (CFF_Font)face->extra.data;\r\n    FT_Error  error = CFF_Err_Ok;\r\n\r\n\r\n    if ( cff && cff->font_info == NULL )\r\n    {\r\n      CFF_FontRecDict  dict   = &cff->top_font.font_dict;\r\n      PS_FontInfoRec  *font_info = NULL;\r\n      FT_Memory        memory = face->root.memory;\r\n\r\n\r\n      if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )\r\n        goto Fail;\r\n\r\n      font_info->version     = cff_index_get_sid_string( cff,\r\n                                                         dict->version );\r\n      font_info->notice      = cff_index_get_sid_string( cff,\r\n                                                         dict->notice );\r\n      font_info->full_name   = cff_index_get_sid_string( cff,\r\n                                                         dict->full_name );\r\n      font_info->family_name = cff_index_get_sid_string( cff,\r\n                                                         dict->family_name );\r\n      font_info->weight      = cff_index_get_sid_string( cff,\r\n                                                         dict->weight );\r\n      font_info->italic_angle        = dict->italic_angle;\r\n      font_info->is_fixed_pitch      = dict->is_fixed_pitch;\r\n      font_info->underline_position  = (FT_Short)dict->underline_position;\r\n      font_info->underline_thickness = (FT_Short)dict->underline_thickness;\r\n\r\n      cff->font_info = font_info;\r\n    }\r\n\r\n    if ( cff )\r\n      *afont_info = *cff->font_info;\r\n\r\n  Fail:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info,\r\n    (PS_GetFontInfoFunc)   cff_ps_get_font_info,\r\n    (PS_GetFontExtraFunc)  NULL,\r\n    (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,\r\n    (PS_GetFontPrivateFunc)NULL,        /* unsupported with CFF fonts */\r\n    (PS_GetFontValueFunc)  NULL         /* not implemented            */\r\n  )\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT NAME SERVICE\r\n   *\r\n   */\r\n\r\n  static const char*\r\n  cff_get_ps_name( CFF_Face  face )\r\n  {\r\n    CFF_Font  cff = (CFF_Font)face->extra.data;\r\n\r\n\r\n    return (const char*)cff->font_name;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name,\r\n    (FT_PsName_GetFunc)cff_get_ps_name\r\n  )\r\n\r\n\r\n  /*\r\n   * TT CMAP INFO\r\n   *\r\n   * If the charmap is a synthetic Unicode encoding cmap or\r\n   * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO\r\n   * service defined in SFNT module.\r\n   *\r\n   * Otherwise call the service function in the sfnt module.\r\n   *\r\n   */\r\n  static FT_Error\r\n  cff_get_cmap_info( FT_CharMap    charmap,\r\n                     TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_CMap   cmap  = FT_CMAP( charmap );\r\n    FT_Error  error = CFF_Err_Ok;\r\n    FT_Face    face    = FT_CMAP_FACE( cmap );\r\n    FT_Library library = FT_FACE_LIBRARY( face );\r\n\r\n\r\n    cmap_info->language = 0;\r\n    cmap_info->format   = 0;\r\n\r\n    if ( cmap->clazz != &CFF_CMAP_ENCODING_CLASS_REC_GET &&\r\n         cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET  )\r\n    {\r\n      FT_Module           sfnt    = FT_Get_Module( library, \"sfnt\" );\r\n      FT_Service_TTCMaps  service =\r\n        (FT_Service_TTCMaps)ft_module_get_service( sfnt,\r\n                                                   FT_SERVICE_ID_TT_CMAP );\r\n\r\n\r\n      if ( service && service->get_cmap_info )\r\n        error = service->get_cmap_info( charmap, cmap_info );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,\r\n    (TT_CMap_Info_GetFunc)cff_get_cmap_info\r\n  )\r\n\r\n\r\n  /*\r\n   *  CID INFO SERVICE\r\n   *\r\n   */\r\n  static FT_Error\r\n  cff_get_ros( CFF_Face      face,\r\n               const char*  *registry,\r\n               const char*  *ordering,\r\n               FT_Int       *supplement )\r\n  {\r\n    FT_Error  error = CFF_Err_Ok;\r\n    CFF_Font  cff   = (CFF_Font)face->extra.data;\r\n\r\n\r\n    if ( cff )\r\n    {\r\n      CFF_FontRecDict  dict = &cff->top_font.font_dict;\r\n\r\n\r\n      if ( dict->cid_registry == 0xFFFFU )\r\n      {\r\n        error = CFF_Err_Invalid_Argument;\r\n        goto Fail;\r\n      }\r\n\r\n      if ( registry )\r\n      {\r\n        if ( cff->registry == NULL )\r\n          cff->registry = cff_index_get_sid_string( cff,\r\n                                                    dict->cid_registry );\r\n        *registry = cff->registry;\r\n      }\r\n\r\n      if ( ordering )\r\n      {\r\n        if ( cff->ordering == NULL )\r\n          cff->ordering = cff_index_get_sid_string( cff,\r\n                                                    dict->cid_ordering );\r\n        *ordering = cff->ordering;\r\n      }\r\n\r\n      /*\r\n       * XXX: According to Adobe TechNote #5176, the supplement in CFF\r\n       *      can be a real number. We truncate it to fit public API\r\n       *      since freetype-2.3.6.\r\n       */\r\n      if ( supplement )\r\n      {\r\n        if ( dict->cid_supplement < FT_INT_MIN ||\r\n             dict->cid_supplement > FT_INT_MAX )\r\n          FT_TRACE1(( \"cff_get_ros: too large supplement %d is truncated\\n\",\r\n                      dict->cid_supplement ));\r\n        *supplement = (FT_Int)dict->cid_supplement;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_get_is_cid( CFF_Face  face,\r\n                  FT_Bool  *is_cid )\r\n  {\r\n    FT_Error  error = CFF_Err_Ok;\r\n    CFF_Font  cff   = (CFF_Font)face->extra.data;\r\n\r\n\r\n    *is_cid = 0;\r\n\r\n    if ( cff )\r\n    {\r\n      CFF_FontRecDict  dict = &cff->top_font.font_dict;\r\n\r\n\r\n      if ( dict->cid_registry != 0xFFFFU )\r\n        *is_cid = 1;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_get_cid_from_glyph_index( CFF_Face  face,\r\n                                FT_UInt   glyph_index,\r\n                                FT_UInt  *cid )\r\n  {\r\n    FT_Error  error = CFF_Err_Ok;\r\n    CFF_Font  cff;\r\n\r\n\r\n    cff = (CFF_Font)face->extra.data;\r\n\r\n    if ( cff )\r\n    {\r\n      FT_UInt          c;\r\n      CFF_FontRecDict  dict = &cff->top_font.font_dict;\r\n\r\n\r\n      if ( dict->cid_registry == 0xFFFFU )\r\n      {\r\n        error = CFF_Err_Invalid_Argument;\r\n        goto Fail;\r\n      }\r\n\r\n      if ( glyph_index > cff->num_glyphs )\r\n      {\r\n        error = CFF_Err_Invalid_Argument;\r\n        goto Fail;\r\n      }\r\n\r\n      c = cff->charset.sids[glyph_index];\r\n\r\n      if ( cid )\r\n        *cid = c;\r\n    }\r\n\r\n  Fail:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info,\r\n    (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,\r\n    (FT_CID_GetIsInternallyCIDKeyedFunc)      cff_get_is_cid,\r\n    (FT_CID_GetCIDFromGlyphIndexFunc)         cff_get_cid_from_glyph_index\r\n  )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                D R I V E R  I N T E R F A C E                   ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES\r\n  FT_DEFINE_SERVICEDESCREC6(cff_services,\r\n    FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CFF,\r\n    FT_SERVICE_ID_POSTSCRIPT_INFO,      &CFF_SERVICE_PS_INFO_GET,\r\n    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,\r\n    FT_SERVICE_ID_GLYPH_DICT,           &CFF_SERVICE_GLYPH_DICT_GET,\r\n    FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,\r\n    FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET\r\n  )\r\n#else\r\n  FT_DEFINE_SERVICEDESCREC5(cff_services,\r\n    FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CFF,\r\n    FT_SERVICE_ID_POSTSCRIPT_INFO,      &CFF_SERVICE_PS_INFO_GET,\r\n    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,\r\n    FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,\r\n    FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET\r\n  )\r\n#endif\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  cff_get_interface( FT_Module    driver,       /* CFF_Driver */\r\n                     const char*  module_interface )\r\n  {\r\n    FT_Library           library;\r\n    FT_Module            sfnt;\r\n    FT_Module_Interface  result;\r\n\r\n\r\n    /* CFF_SERVICES_GET derefers `library' in PIC mode */\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    if ( !driver )\r\n      return NULL;\r\n    library = driver->library;\r\n    if ( !library )\r\n      return NULL;\r\n#endif\r\n\r\n    result = ft_service_list_lookup( CFF_SERVICES_GET, module_interface );\r\n    if ( result != NULL )\r\n      return result;\r\n\r\n    /* `driver' is not yet evaluated in non-PIC mode */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n    if ( !driver )\r\n      return NULL;\r\n    library = driver->library;\r\n    if ( !library )\r\n      return NULL;\r\n#endif\r\n\r\n    /* we pass our request to the `sfnt' module */\r\n    sfnt = FT_Get_Module( library, \"sfnt\" );\r\n\r\n    return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;\r\n  }\r\n\r\n\r\n  /* The FT_DriverInterface structure is defined in ftdriver.h. */\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n#define CFF_SIZE_SELECT cff_size_select\r\n#else\r\n#define CFF_SIZE_SELECT 0\r\n#endif\r\n\r\n  FT_DEFINE_DRIVER( cff_driver_class,\r\n\r\n      FT_MODULE_FONT_DRIVER       |\r\n      FT_MODULE_DRIVER_SCALABLE   |\r\n      FT_MODULE_DRIVER_HAS_HINTER,\r\n\r\n      sizeof ( CFF_DriverRec ),\r\n      \"cff\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,   /* module-specific interface */\r\n\r\n      cff_driver_init,\r\n      cff_driver_done,\r\n      cff_get_interface,\r\n\r\n    /* now the specific driver fields */\r\n    sizeof ( TT_FaceRec ),\r\n    sizeof ( CFF_SizeRec ),\r\n    sizeof ( CFF_GlyphSlotRec ),\r\n\r\n    cff_face_init,\r\n    cff_face_done,\r\n    cff_size_init,\r\n    cff_size_done,\r\n    cff_slot_init,\r\n    cff_slot_done,\r\n\r\n    ft_stub_set_char_sizes,  /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    cff_glyph_load,\r\n\r\n    cff_get_kerning,\r\n    0,                       /* FT_Face_AttachFunc */\r\n    cff_get_advances,\r\n\r\n    cff_size_request,\r\n\r\n    CFF_SIZE_SELECT\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffdrivr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffdrivr.h                                                             */\r\n/*                                                                         */\r\n/*    High-level OpenType driver interface (specification).                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFDRIVER_H__\r\n#define __CFFDRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_DECLARE_DRIVER( cff_driver_class )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cfferrs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cfferrs.h                                                              */\r\n/*                                                                         */\r\n/*    CFF error codes (specification only).                                */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the CFF error enumeration constants.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __CFFERRS_H__\r\n#define __CFFERRS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  CFF_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_CFF\r\n\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __CFFERRS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffgload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffgload.c                                                             */\r\n/*                                                                         */\r\n/*    OpenType Glyph Loader (body).                                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_OUTLINE_H\r\n\r\n#include \"cffobjs.h\"\r\n#include \"cffload.h\"\r\n#include \"cffgload.h\"\r\n\r\n#include \"cfferrs.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cffgload\r\n\r\n\r\n  typedef enum  CFF_Operator_\r\n  {\r\n    cff_op_unknown = 0,\r\n\r\n    cff_op_rmoveto,\r\n    cff_op_hmoveto,\r\n    cff_op_vmoveto,\r\n\r\n    cff_op_rlineto,\r\n    cff_op_hlineto,\r\n    cff_op_vlineto,\r\n\r\n    cff_op_rrcurveto,\r\n    cff_op_hhcurveto,\r\n    cff_op_hvcurveto,\r\n    cff_op_rcurveline,\r\n    cff_op_rlinecurve,\r\n    cff_op_vhcurveto,\r\n    cff_op_vvcurveto,\r\n\r\n    cff_op_flex,\r\n    cff_op_hflex,\r\n    cff_op_hflex1,\r\n    cff_op_flex1,\r\n\r\n    cff_op_endchar,\r\n\r\n    cff_op_hstem,\r\n    cff_op_vstem,\r\n    cff_op_hstemhm,\r\n    cff_op_vstemhm,\r\n\r\n    cff_op_hintmask,\r\n    cff_op_cntrmask,\r\n    cff_op_dotsection,  /* deprecated, acts as no-op */\r\n\r\n    cff_op_abs,\r\n    cff_op_add,\r\n    cff_op_sub,\r\n    cff_op_div,\r\n    cff_op_neg,\r\n    cff_op_random,\r\n    cff_op_mul,\r\n    cff_op_sqrt,\r\n\r\n    cff_op_blend,\r\n\r\n    cff_op_drop,\r\n    cff_op_exch,\r\n    cff_op_index,\r\n    cff_op_roll,\r\n    cff_op_dup,\r\n\r\n    cff_op_put,\r\n    cff_op_get,\r\n    cff_op_store,\r\n    cff_op_load,\r\n\r\n    cff_op_and,\r\n    cff_op_or,\r\n    cff_op_not,\r\n    cff_op_eq,\r\n    cff_op_ifelse,\r\n\r\n    cff_op_callsubr,\r\n    cff_op_callgsubr,\r\n    cff_op_return,\r\n\r\n    /* Type 1 opcodes: invalid but seen in real life */\r\n    cff_op_hsbw,\r\n    cff_op_closepath,\r\n    cff_op_callothersubr,\r\n    cff_op_pop,\r\n    cff_op_seac,\r\n    cff_op_sbw,\r\n    cff_op_setcurrentpoint,\r\n\r\n    /* do not remove */\r\n    cff_op_max\r\n\r\n  } CFF_Operator;\r\n\r\n\r\n#define CFF_COUNT_CHECK_WIDTH  0x80\r\n#define CFF_COUNT_EXACT        0x40\r\n#define CFF_COUNT_CLEAR_STACK  0x20\r\n\r\n  /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are  */\r\n  /* used for checking the width and requested numbers of arguments    */\r\n  /* only; they are set to zero afterwards                             */\r\n\r\n  /* the other two flags are informative only and unused currently     */\r\n\r\n  static const FT_Byte  cff_argument_counts[] =\r\n  {\r\n    0,  /* unknown */\r\n\r\n    2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */\r\n    1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,\r\n    1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,\r\n\r\n    0 | CFF_COUNT_CLEAR_STACK, /* rlineto */\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n\r\n    0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n    0 | CFF_COUNT_CLEAR_STACK,\r\n\r\n    13, /* flex */\r\n    7,\r\n    9,\r\n    11,\r\n\r\n    0 | CFF_COUNT_CHECK_WIDTH, /* endchar */\r\n\r\n    2 | CFF_COUNT_CHECK_WIDTH, /* hstem */\r\n    2 | CFF_COUNT_CHECK_WIDTH,\r\n    2 | CFF_COUNT_CHECK_WIDTH,\r\n    2 | CFF_COUNT_CHECK_WIDTH,\r\n\r\n    0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */\r\n    0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */\r\n    0, /* dotsection */\r\n\r\n    1, /* abs */\r\n    2,\r\n    2,\r\n    2,\r\n    1,\r\n    0,\r\n    2,\r\n    1,\r\n\r\n    1, /* blend */\r\n\r\n    1, /* drop */\r\n    2,\r\n    1,\r\n    2,\r\n    1,\r\n\r\n    2, /* put */\r\n    1,\r\n    4,\r\n    3,\r\n\r\n    2, /* and */\r\n    2,\r\n    1,\r\n    2,\r\n    4,\r\n\r\n    1, /* callsubr */\r\n    1,\r\n    0,\r\n\r\n    2, /* hsbw */\r\n    0,\r\n    0,\r\n    0,\r\n    5, /* seac */\r\n    4, /* sbw */\r\n    2  /* setcurrentpoint */\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**********                                                      *********/\r\n  /**********                                                      *********/\r\n  /**********             GENERIC CHARSTRING PARSING               *********/\r\n  /**********                                                      *********/\r\n  /**********                                                      *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_builder_init                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given glyph builder.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    builder :: A pointer to the glyph builder to initialize.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: The current face object.                                */\r\n  /*                                                                       */\r\n  /*    size    :: The current size object.                                */\r\n  /*                                                                       */\r\n  /*    glyph   :: The current glyph object.                               */\r\n  /*                                                                       */\r\n  /*    hinting :: Whether hinting is active.                              */\r\n  /*                                                                       */\r\n  static void\r\n  cff_builder_init( CFF_Builder*   builder,\r\n                    TT_Face        face,\r\n                    CFF_Size       size,\r\n                    CFF_GlyphSlot  glyph,\r\n                    FT_Bool        hinting )\r\n  {\r\n    builder->path_begun  = 0;\r\n    builder->load_points = 1;\r\n\r\n    builder->face   = face;\r\n    builder->glyph  = glyph;\r\n    builder->memory = face->root.memory;\r\n\r\n    if ( glyph )\r\n    {\r\n      FT_GlyphLoader  loader = glyph->root.internal->loader;\r\n\r\n\r\n      builder->loader  = loader;\r\n      builder->base    = &loader->base.outline;\r\n      builder->current = &loader->current.outline;\r\n      FT_GlyphLoader_Rewind( loader );\r\n\r\n      builder->hints_globals = 0;\r\n      builder->hints_funcs   = 0;\r\n\r\n      if ( hinting && size )\r\n      {\r\n        CFF_Internal  internal = (CFF_Internal)size->root.internal;\r\n\r\n\r\n        builder->hints_globals = (void *)internal->topfont;\r\n        builder->hints_funcs   = glyph->root.internal->glyph_hints;\r\n      }\r\n    }\r\n\r\n    builder->pos_x = 0;\r\n    builder->pos_y = 0;\r\n\r\n    builder->left_bearing.x = 0;\r\n    builder->left_bearing.y = 0;\r\n    builder->advance.x      = 0;\r\n    builder->advance.y      = 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_builder_done                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalizes a given glyph builder.  Its contents can still be used   */\r\n  /*    after the call, but the function saves important information       */\r\n  /*    within the corresponding glyph slot.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    builder :: A pointer to the glyph builder to finalize.             */\r\n  /*                                                                       */\r\n  static void\r\n  cff_builder_done( CFF_Builder*  builder )\r\n  {\r\n    CFF_GlyphSlot  glyph = builder->glyph;\r\n\r\n\r\n    if ( glyph )\r\n      glyph->root.outline = *builder->base;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_compute_bias                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the bias value in dependence of the number of glyph       */\r\n  /*    subroutines.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    in_charstring_type :: The `CharstringType' value of the top DICT   */\r\n  /*                          dictionary.                                  */\r\n  /*                                                                       */\r\n  /*    num_subrs          :: The number of glyph subroutines.             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The bias value.                                                    */\r\n  static FT_Int\r\n  cff_compute_bias( FT_Int   in_charstring_type,\r\n                    FT_UInt  num_subrs )\r\n  {\r\n    FT_Int  result;\r\n\r\n\r\n    if ( in_charstring_type == 1 )\r\n      result = 0;\r\n    else if ( num_subrs < 1240 )\r\n      result = 107;\r\n    else if ( num_subrs < 33900U )\r\n      result = 1131;\r\n    else\r\n      result = 32768U;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_decoder_init                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given glyph decoder.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    decoder :: A pointer to the glyph builder to initialize.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face      :: The current face object.                              */\r\n  /*                                                                       */\r\n  /*    size      :: The current size object.                              */\r\n  /*                                                                       */\r\n  /*    slot      :: The current glyph object.                             */\r\n  /*                                                                       */\r\n  /*    hinting   :: Whether hinting is active.                            */\r\n  /*                                                                       */\r\n  /*    hint_mode :: The hinting mode.                                     */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  cff_decoder_init( CFF_Decoder*    decoder,\r\n                    TT_Face         face,\r\n                    CFF_Size        size,\r\n                    CFF_GlyphSlot   slot,\r\n                    FT_Bool         hinting,\r\n                    FT_Render_Mode  hint_mode )\r\n  {\r\n    CFF_Font  cff = (CFF_Font)face->extra.data;\r\n\r\n\r\n    /* clear everything */\r\n    FT_MEM_ZERO( decoder, sizeof ( *decoder ) );\r\n\r\n    /* initialize builder */\r\n    cff_builder_init( &decoder->builder, face, size, slot, hinting );\r\n\r\n    /* initialize Type2 decoder */\r\n    decoder->cff          = cff;\r\n    decoder->num_globals  = cff->global_subrs_index.count;\r\n    decoder->globals      = cff->global_subrs;\r\n    decoder->globals_bias = cff_compute_bias(\r\n                              cff->top_font.font_dict.charstring_type,\r\n                              decoder->num_globals );\r\n\r\n    decoder->hint_mode    = hint_mode;\r\n  }\r\n\r\n\r\n  /* this function is used to select the subfont */\r\n  /* and the locals subrs array                  */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_decoder_prepare( CFF_Decoder*  decoder,\r\n                       CFF_Size      size,\r\n                       FT_UInt       glyph_index )\r\n  {\r\n    CFF_Builder  *builder = &decoder->builder;\r\n    CFF_Font      cff     = (CFF_Font)builder->face->extra.data;\r\n    CFF_SubFont   sub     = &cff->top_font;\r\n    FT_Error      error   = CFF_Err_Ok;\r\n\r\n\r\n    /* manage CID fonts */\r\n    if ( cff->num_subfonts )\r\n    {\r\n      FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select, glyph_index );\r\n\r\n\r\n      if ( fd_index >= cff->num_subfonts )\r\n      {\r\n        FT_TRACE4(( \"cff_decoder_prepare: invalid CID subfont index\\n\" ));\r\n        error = CFF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      FT_TRACE3(( \"glyph index %d (subfont %d):\\n\", glyph_index, fd_index ));\r\n\r\n      sub = cff->subfonts[fd_index];\r\n\r\n      if ( builder->hints_funcs && size )\r\n      {\r\n        CFF_Internal  internal = (CFF_Internal)size->root.internal;\r\n\r\n\r\n        /* for CFFs without subfonts, this value has already been set */\r\n        builder->hints_globals = (void *)internal->subfonts[fd_index];\r\n      }\r\n    }\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    else\r\n      FT_TRACE3(( \"glyph index %d:\\n\", glyph_index ));\r\n#endif\r\n\r\n    decoder->num_locals    = sub->local_subrs_index.count;\r\n    decoder->locals        = sub->local_subrs;\r\n    decoder->locals_bias   = cff_compute_bias(\r\n                               decoder->cff->top_font.font_dict.charstring_type,\r\n                               decoder->num_locals );\r\n\r\n    decoder->glyph_width   = sub->private_dict.default_width;\r\n    decoder->nominal_width = sub->private_dict.nominal_width;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* check that there is enough space for `count' more points */\r\n  static FT_Error\r\n  check_points( CFF_Builder*  builder,\r\n                FT_Int        count )\r\n  {\r\n    return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );\r\n  }\r\n\r\n\r\n  /* add a new point, do not check space */\r\n  static void\r\n  cff_builder_add_point( CFF_Builder*  builder,\r\n                         FT_Pos        x,\r\n                         FT_Pos        y,\r\n                         FT_Byte       flag )\r\n  {\r\n    FT_Outline*  outline = builder->current;\r\n\r\n\r\n    if ( builder->load_points )\r\n    {\r\n      FT_Vector*  point   = outline->points + outline->n_points;\r\n      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;\r\n\r\n\r\n      point->x = x >> 16;\r\n      point->y = y >> 16;\r\n      *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );\r\n    }\r\n\r\n    outline->n_points++;\r\n  }\r\n\r\n\r\n  /* check space for a new on-curve point, then add it */\r\n  static FT_Error\r\n  cff_builder_add_point1( CFF_Builder*  builder,\r\n                          FT_Pos        x,\r\n                          FT_Pos        y )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = check_points( builder, 1 );\r\n    if ( !error )\r\n      cff_builder_add_point( builder, x, y, 1 );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* check space for a new contour, then add it */\r\n  static FT_Error\r\n  cff_builder_add_contour( CFF_Builder*  builder )\r\n  {\r\n    FT_Outline*  outline = builder->current;\r\n    FT_Error     error;\r\n\r\n\r\n    if ( !builder->load_points )\r\n    {\r\n      outline->n_contours++;\r\n      return CFF_Err_Ok;\r\n    }\r\n\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );\r\n    if ( !error )\r\n    {\r\n      if ( outline->n_contours > 0 )\r\n        outline->contours[outline->n_contours - 1] =\r\n          (short)( outline->n_points - 1 );\r\n\r\n      outline->n_contours++;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* if a path was begun, add its first on-curve point */\r\n  static FT_Error\r\n  cff_builder_start_point( CFF_Builder*  builder,\r\n                           FT_Pos        x,\r\n                           FT_Pos        y )\r\n  {\r\n    FT_Error  error = CFF_Err_Ok;\r\n\r\n\r\n    /* test whether we are building a new contour */\r\n    if ( !builder->path_begun )\r\n    {\r\n      builder->path_begun = 1;\r\n      error = cff_builder_add_contour( builder );\r\n      if ( !error )\r\n        error = cff_builder_add_point1( builder, x, y );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* close the current contour */\r\n  static void\r\n  cff_builder_close_contour( CFF_Builder*  builder )\r\n  {\r\n    FT_Outline*  outline = builder->current;\r\n    FT_Int       first;\r\n\r\n\r\n    if ( !outline )\r\n      return;\r\n\r\n    first = outline->n_contours <= 1\r\n            ? 0 : outline->contours[outline->n_contours - 2] + 1;\r\n\r\n    /* We must not include the last point in the path if it */\r\n    /* is located on the first point.                       */\r\n    if ( outline->n_points > 1 )\r\n    {\r\n      FT_Vector*  p1      = outline->points + first;\r\n      FT_Vector*  p2      = outline->points + outline->n_points - 1;\r\n      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;\r\n\r\n\r\n      /* `delete' last point only if it coincides with the first    */\r\n      /* point and if it is not a control point (which can happen). */\r\n      if ( p1->x == p2->x && p1->y == p2->y )\r\n        if ( *control == FT_CURVE_TAG_ON )\r\n          outline->n_points--;\r\n    }\r\n\r\n    if ( outline->n_contours > 0 )\r\n    {\r\n      /* Don't add contours only consisting of one point, i.e., */\r\n      /* check whether begin point and last point are the same. */\r\n      if ( first == outline->n_points - 1 )\r\n      {\r\n        outline->n_contours--;\r\n        outline->n_points--;\r\n      }\r\n      else\r\n        outline->contours[outline->n_contours - 1] =\r\n          (short)( outline->n_points - 1 );\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Int\r\n  cff_lookup_glyph_by_stdcharcode( CFF_Font  cff,\r\n                                   FT_Int    charcode )\r\n  {\r\n    FT_UInt    n;\r\n    FT_UShort  glyph_sid;\r\n\r\n\r\n    /* CID-keyed fonts don't have glyph names */\r\n    if ( !cff->charset.sids )\r\n      return -1;\r\n\r\n    /* check range of standard char code */\r\n    if ( charcode < 0 || charcode > 255 )\r\n      return -1;\r\n\r\n    /* Get code to SID mapping from `cff_standard_encoding'. */\r\n    glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode );\r\n\r\n    for ( n = 0; n < cff->num_glyphs; n++ )\r\n    {\r\n      if ( cff->charset.sids[n] == glyph_sid )\r\n        return n;\r\n    }\r\n\r\n    return -1;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_get_glyph_data( TT_Face    face,\r\n                      FT_UInt    glyph_index,\r\n                      FT_Byte**  pointer,\r\n                      FT_ULong*  length )\r\n  {\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    /* For incremental fonts get the character data using the */\r\n    /* callback function.                                     */\r\n    if ( face->root.internal->incremental_interface )\r\n    {\r\n      FT_Data   data;\r\n      FT_Error  error =\r\n                  face->root.internal->incremental_interface->funcs->get_glyph_data(\r\n                    face->root.internal->incremental_interface->object,\r\n                    glyph_index, &data );\r\n\r\n\r\n      *pointer = (FT_Byte*)data.pointer;\r\n      *length = data.length;\r\n\r\n      return error;\r\n    }\r\n    else\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    {\r\n      CFF_Font  cff  = (CFF_Font)(face->extra.data);\r\n\r\n\r\n      return cff_index_access_element( &cff->charstrings_index, glyph_index,\r\n                                       pointer, length );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  cff_free_glyph_data( TT_Face    face,\r\n                       FT_Byte**  pointer,\r\n                       FT_ULong   length )\r\n  {\r\n#ifndef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_UNUSED( length );\r\n#endif\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    /* For incremental fonts get the character data using the */\r\n    /* callback function.                                     */\r\n    if ( face->root.internal->incremental_interface )\r\n    {\r\n      FT_Data data;\r\n\r\n\r\n      data.pointer = *pointer;\r\n      data.length  = length;\r\n\r\n      face->root.internal->incremental_interface->funcs->free_glyph_data(\r\n        face->root.internal->incremental_interface->object, &data );\r\n    }\r\n    else\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    {\r\n      CFF_Font  cff = (CFF_Font)(face->extra.data);\r\n\r\n\r\n      cff_index_forget_element( &cff->charstrings_index, pointer );\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_operator_seac( CFF_Decoder*  decoder,\r\n                     FT_Pos        asb,\r\n                     FT_Pos        adx,\r\n                     FT_Pos        ady,\r\n                     FT_Int        bchar,\r\n                     FT_Int        achar )\r\n  {\r\n    FT_Error      error;\r\n    CFF_Builder*  builder = &decoder->builder;\r\n    FT_Int        bchar_index, achar_index;\r\n    TT_Face       face = decoder->builder.face;\r\n    FT_Vector     left_bearing, advance;\r\n    FT_Byte*      charstring;\r\n    FT_ULong      charstring_len;\r\n    FT_Pos        glyph_width;\r\n\r\n\r\n    if ( decoder->seac )\r\n    {\r\n      FT_ERROR(( \"cff_operator_seac: invalid nested seac\\n\" ));\r\n      return CFF_Err_Syntax_Error;\r\n    }\r\n\r\n    adx += decoder->builder.left_bearing.x;\r\n    ady += decoder->builder.left_bearing.y;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    /* Incremental fonts don't necessarily have valid charsets.        */\r\n    /* They use the character code, not the glyph index, in this case. */\r\n    if ( face->root.internal->incremental_interface )\r\n    {\r\n      bchar_index = bchar;\r\n      achar_index = achar;\r\n    }\r\n    else\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n    {\r\n      CFF_Font cff = (CFF_Font)(face->extra.data);\r\n\r\n\r\n      bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar );\r\n      achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar );\r\n    }\r\n\r\n    if ( bchar_index < 0 || achar_index < 0 )\r\n    {\r\n      FT_ERROR(( \"cff_operator_seac:\"\r\n                 \" invalid seac character code arguments\\n\" ));\r\n      return CFF_Err_Syntax_Error;\r\n    }\r\n\r\n    /* If we are trying to load a composite glyph, do not load the */\r\n    /* accent character and return the array of subglyphs.         */\r\n    if ( builder->no_recurse )\r\n    {\r\n      FT_GlyphSlot    glyph  = (FT_GlyphSlot)builder->glyph;\r\n      FT_GlyphLoader  loader = glyph->internal->loader;\r\n      FT_SubGlyph     subg;\r\n\r\n\r\n      /* reallocate subglyph array if necessary */\r\n      error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      subg = loader->current.subglyphs;\r\n\r\n      /* subglyph 0 = base character */\r\n      subg->index = bchar_index;\r\n      subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |\r\n                    FT_SUBGLYPH_FLAG_USE_MY_METRICS;\r\n      subg->arg1  = 0;\r\n      subg->arg2  = 0;\r\n      subg++;\r\n\r\n      /* subglyph 1 = accent character */\r\n      subg->index = achar_index;\r\n      subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;\r\n      subg->arg1  = (FT_Int)( adx >> 16 );\r\n      subg->arg2  = (FT_Int)( ady >> 16 );\r\n\r\n      /* set up remaining glyph fields */\r\n      glyph->num_subglyphs = 2;\r\n      glyph->subglyphs     = loader->base.subglyphs;\r\n      glyph->format        = FT_GLYPH_FORMAT_COMPOSITE;\r\n\r\n      loader->current.num_subglyphs = 2;\r\n    }\r\n\r\n    FT_GlyphLoader_Prepare( builder->loader );\r\n\r\n    /* First load `bchar' in builder */\r\n    error = cff_get_glyph_data( face, bchar_index,\r\n                                &charstring, &charstring_len );\r\n    if ( !error )\r\n    {\r\n      /* the seac operator must not be nested */\r\n      decoder->seac = TRUE;\r\n      error = cff_decoder_parse_charstrings( decoder, charstring,\r\n                                             charstring_len );\r\n      decoder->seac = FALSE;\r\n\r\n      cff_free_glyph_data( face, &charstring, charstring_len );\r\n\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* Save the left bearing, advance and glyph width of the base */\r\n    /* character as they will be erased by the next load.         */\r\n\r\n    left_bearing = builder->left_bearing;\r\n    advance      = builder->advance;\r\n    glyph_width  = decoder->glyph_width;\r\n\r\n    builder->left_bearing.x = 0;\r\n    builder->left_bearing.y = 0;\r\n\r\n    builder->pos_x = adx - asb;\r\n    builder->pos_y = ady;\r\n\r\n    /* Now load `achar' on top of the base outline. */\r\n    error = cff_get_glyph_data( face, achar_index,\r\n                                &charstring, &charstring_len );\r\n    if ( !error )\r\n    {\r\n      /* the seac operator must not be nested */\r\n      decoder->seac = TRUE;\r\n      error = cff_decoder_parse_charstrings( decoder, charstring,\r\n                                             charstring_len );\r\n      decoder->seac = FALSE;\r\n\r\n      cff_free_glyph_data( face, &charstring, charstring_len );\r\n\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* Restore the left side bearing, advance and glyph width */\r\n    /* of the base character.                                 */\r\n    builder->left_bearing = left_bearing;\r\n    builder->advance      = advance;\r\n    decoder->glyph_width  = glyph_width;\r\n\r\n    builder->pos_x = 0;\r\n    builder->pos_y = 0;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cff_decoder_parse_charstrings                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parses a given Type 2 charstrings program.                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    decoder         :: The current Type 1 decoder.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charstring_base :: The base of the charstring stream.              */\r\n  /*                                                                       */\r\n  /*    charstring_len  :: The length in bytes of the charstring stream.   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_decoder_parse_charstrings( CFF_Decoder*  decoder,\r\n                                 FT_Byte*      charstring_base,\r\n                                 FT_ULong      charstring_len )\r\n  {\r\n    FT_Error           error;\r\n    CFF_Decoder_Zone*  zone;\r\n    FT_Byte*           ip;\r\n    FT_Byte*           limit;\r\n    CFF_Builder*       builder = &decoder->builder;\r\n    FT_Pos             x, y;\r\n    FT_Fixed           seed;\r\n    FT_Fixed*          stack;\r\n    FT_Int             charstring_type =\r\n                         decoder->cff->top_font.font_dict.charstring_type;\r\n\r\n    T2_Hints_Funcs     hinter;\r\n\r\n\r\n    /* set default width */\r\n    decoder->num_hints  = 0;\r\n    decoder->read_width = 1;\r\n\r\n    /* compute random seed from stack address of parameter */\r\n    seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed              ^\r\n                         (FT_PtrDist)(char*)&decoder           ^\r\n                         (FT_PtrDist)(char*)&charstring_base ) &\r\n                         FT_ULONG_MAX ) ;\r\n    seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;\r\n    if ( seed == 0 )\r\n      seed = 0x7384;\r\n\r\n    /* initialize the decoder */\r\n    decoder->top  = decoder->stack;\r\n    decoder->zone = decoder->zones;\r\n    zone          = decoder->zones;\r\n    stack         = decoder->top;\r\n\r\n    hinter = (T2_Hints_Funcs)builder->hints_funcs;\r\n\r\n    builder->path_begun = 0;\r\n\r\n    zone->base           = charstring_base;\r\n    limit = zone->limit  = charstring_base + charstring_len;\r\n    ip    = zone->cursor = zone->base;\r\n\r\n    error = CFF_Err_Ok;\r\n\r\n    x = builder->pos_x;\r\n    y = builder->pos_y;\r\n\r\n    /* begin hints recording session, if any */\r\n    if ( hinter )\r\n      hinter->open( hinter->hints );\r\n\r\n    /* now execute loop */\r\n    while ( ip < limit )\r\n    {\r\n      CFF_Operator  op;\r\n      FT_Byte       v;\r\n\r\n\r\n      /********************************************************************/\r\n      /*                                                                  */\r\n      /* Decode operator or operand                                       */\r\n      /*                                                                  */\r\n      v = *ip++;\r\n      if ( v >= 32 || v == 28 )\r\n      {\r\n        FT_Int    shift = 16;\r\n        FT_Int32  val;\r\n\r\n\r\n        /* this is an operand, push it on the stack */\r\n        if ( v == 28 )\r\n        {\r\n          if ( ip + 1 >= limit )\r\n            goto Syntax_Error;\r\n          val = (FT_Short)( ( (FT_Short)ip[0] << 8 ) | ip[1] );\r\n          ip += 2;\r\n        }\r\n        else if ( v < 247 )\r\n          val = (FT_Int32)v - 139;\r\n        else if ( v < 251 )\r\n        {\r\n          if ( ip >= limit )\r\n            goto Syntax_Error;\r\n          val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;\r\n        }\r\n        else if ( v < 255 )\r\n        {\r\n          if ( ip >= limit )\r\n            goto Syntax_Error;\r\n          val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;\r\n        }\r\n        else\r\n        {\r\n          if ( ip + 3 >= limit )\r\n            goto Syntax_Error;\r\n          val = ( (FT_Int32)ip[0] << 24 ) |\r\n                ( (FT_Int32)ip[1] << 16 ) |\r\n                ( (FT_Int32)ip[2] <<  8 ) |\r\n                            ip[3];\r\n          ip    += 4;\r\n          if ( charstring_type == 2 )\r\n            shift = 0;\r\n        }\r\n        if ( decoder->top - stack >= CFF_MAX_OPERANDS )\r\n          goto Stack_Overflow;\r\n\r\n        val           <<= shift;\r\n        *decoder->top++ = val;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        if ( !( val & 0xFFFFL ) )\r\n          FT_TRACE4(( \" %ld\", (FT_Int32)( val >> 16 ) ));\r\n        else\r\n          FT_TRACE4(( \" %.2f\", val / 65536.0 ));\r\n#endif\r\n\r\n      }\r\n      else\r\n      {\r\n        /* The specification says that normally arguments are to be taken */\r\n        /* from the bottom of the stack.  However, this seems not to be   */\r\n        /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */\r\n        /* arguments similar to a PS interpreter.                         */\r\n\r\n        FT_Fixed*  args     = decoder->top;\r\n        FT_Int     num_args = (FT_Int)( args - decoder->stack );\r\n        FT_Int     req_args;\r\n\r\n\r\n        /* find operator */\r\n        op = cff_op_unknown;\r\n\r\n        switch ( v )\r\n        {\r\n        case 1:\r\n          op = cff_op_hstem;\r\n          break;\r\n        case 3:\r\n          op = cff_op_vstem;\r\n          break;\r\n        case 4:\r\n          op = cff_op_vmoveto;\r\n          break;\r\n        case 5:\r\n          op = cff_op_rlineto;\r\n          break;\r\n        case 6:\r\n          op = cff_op_hlineto;\r\n          break;\r\n        case 7:\r\n          op = cff_op_vlineto;\r\n          break;\r\n        case 8:\r\n          op = cff_op_rrcurveto;\r\n          break;\r\n        case 9:\r\n          op = cff_op_closepath;\r\n          break;\r\n        case 10:\r\n          op = cff_op_callsubr;\r\n          break;\r\n        case 11:\r\n          op = cff_op_return;\r\n          break;\r\n        case 12:\r\n          {\r\n            if ( ip >= limit )\r\n              goto Syntax_Error;\r\n            v = *ip++;\r\n\r\n            switch ( v )\r\n            {\r\n            case 0:\r\n              op = cff_op_dotsection;\r\n              break;\r\n            case 1: /* this is actually the Type1 vstem3 operator */\r\n              op = cff_op_vstem;\r\n              break;\r\n            case 2: /* this is actually the Type1 hstem3 operator */\r\n              op = cff_op_hstem;\r\n              break;\r\n            case 3:\r\n              op = cff_op_and;\r\n              break;\r\n            case 4:\r\n              op = cff_op_or;\r\n              break;\r\n            case 5:\r\n              op = cff_op_not;\r\n              break;\r\n            case 6:\r\n              op = cff_op_seac;\r\n              break;\r\n            case 7:\r\n              op = cff_op_sbw;\r\n              break;\r\n            case 8:\r\n              op = cff_op_store;\r\n              break;\r\n            case 9:\r\n              op = cff_op_abs;\r\n              break;\r\n            case 10:\r\n              op = cff_op_add;\r\n              break;\r\n            case 11:\r\n              op = cff_op_sub;\r\n              break;\r\n            case 12:\r\n              op = cff_op_div;\r\n              break;\r\n            case 13:\r\n              op = cff_op_load;\r\n              break;\r\n            case 14:\r\n              op = cff_op_neg;\r\n              break;\r\n            case 15:\r\n              op = cff_op_eq;\r\n              break;\r\n            case 16:\r\n              op = cff_op_callothersubr;\r\n              break;\r\n            case 17:\r\n              op = cff_op_pop;\r\n              break;\r\n            case 18:\r\n              op = cff_op_drop;\r\n              break;\r\n            case 20:\r\n              op = cff_op_put;\r\n              break;\r\n            case 21:\r\n              op = cff_op_get;\r\n              break;\r\n            case 22:\r\n              op = cff_op_ifelse;\r\n              break;\r\n            case 23:\r\n              op = cff_op_random;\r\n              break;\r\n            case 24:\r\n              op = cff_op_mul;\r\n              break;\r\n            case 26:\r\n              op = cff_op_sqrt;\r\n              break;\r\n            case 27:\r\n              op = cff_op_dup;\r\n              break;\r\n            case 28:\r\n              op = cff_op_exch;\r\n              break;\r\n            case 29:\r\n              op = cff_op_index;\r\n              break;\r\n            case 30:\r\n              op = cff_op_roll;\r\n              break;\r\n            case 33:\r\n              op = cff_op_setcurrentpoint;\r\n              break;\r\n            case 34:\r\n              op = cff_op_hflex;\r\n              break;\r\n            case 35:\r\n              op = cff_op_flex;\r\n              break;\r\n            case 36:\r\n              op = cff_op_hflex1;\r\n              break;\r\n            case 37:\r\n              op = cff_op_flex1;\r\n              break;\r\n            default:\r\n              FT_TRACE4(( \" unknown op (12, %d)\\n\", v ));\r\n              break;\r\n            }\r\n          }\r\n          break;\r\n        case 13:\r\n          op = cff_op_hsbw;\r\n          break;\r\n        case 14:\r\n          op = cff_op_endchar;\r\n          break;\r\n        case 16:\r\n          op = cff_op_blend;\r\n          break;\r\n        case 18:\r\n          op = cff_op_hstemhm;\r\n          break;\r\n        case 19:\r\n          op = cff_op_hintmask;\r\n          break;\r\n        case 20:\r\n          op = cff_op_cntrmask;\r\n          break;\r\n        case 21:\r\n          op = cff_op_rmoveto;\r\n          break;\r\n        case 22:\r\n          op = cff_op_hmoveto;\r\n          break;\r\n        case 23:\r\n          op = cff_op_vstemhm;\r\n          break;\r\n        case 24:\r\n          op = cff_op_rcurveline;\r\n          break;\r\n        case 25:\r\n          op = cff_op_rlinecurve;\r\n          break;\r\n        case 26:\r\n          op = cff_op_vvcurveto;\r\n          break;\r\n        case 27:\r\n          op = cff_op_hhcurveto;\r\n          break;\r\n        case 29:\r\n          op = cff_op_callgsubr;\r\n          break;\r\n        case 30:\r\n          op = cff_op_vhcurveto;\r\n          break;\r\n        case 31:\r\n          op = cff_op_hvcurveto;\r\n          break;\r\n        default:\r\n          FT_TRACE4(( \" unknown op (%d)\\n\", v ));\r\n          break;\r\n        }\r\n\r\n        if ( op == cff_op_unknown )\r\n          continue;\r\n\r\n        /* check arguments */\r\n        req_args = cff_argument_counts[op];\r\n        if ( req_args & CFF_COUNT_CHECK_WIDTH )\r\n        {\r\n          if ( num_args > 0 && decoder->read_width )\r\n          {\r\n            /* If `nominal_width' is non-zero, the number is really a      */\r\n            /* difference against `nominal_width'.  Else, the number here  */\r\n            /* is truly a width, not a difference against `nominal_width'. */\r\n            /* If the font does not set `nominal_width', then              */\r\n            /* `nominal_width' defaults to zero, and so we can set         */\r\n            /* `glyph_width' to `nominal_width' plus number on the stack   */\r\n            /* -- for either case.                                         */\r\n\r\n            FT_Int  set_width_ok;\r\n\r\n\r\n            switch ( op )\r\n            {\r\n            case cff_op_hmoveto:\r\n            case cff_op_vmoveto:\r\n              set_width_ok = num_args & 2;\r\n              break;\r\n\r\n            case cff_op_hstem:\r\n            case cff_op_vstem:\r\n            case cff_op_hstemhm:\r\n            case cff_op_vstemhm:\r\n            case cff_op_rmoveto:\r\n            case cff_op_hintmask:\r\n            case cff_op_cntrmask:\r\n              set_width_ok = num_args & 1;\r\n              break;\r\n\r\n            case cff_op_endchar:\r\n              /* If there is a width specified for endchar, we either have */\r\n              /* 1 argument or 5 arguments.  We like to argue.             */\r\n              set_width_ok = ( num_args == 5 ) || ( num_args == 1 );\r\n              break;\r\n\r\n            default:\r\n              set_width_ok = 0;\r\n              break;\r\n            }\r\n\r\n            if ( set_width_ok )\r\n            {\r\n              decoder->glyph_width = decoder->nominal_width +\r\n                                       ( stack[0] >> 16 );\r\n\r\n              if ( decoder->width_only )\r\n              {\r\n                /* we only want the advance width; stop here */\r\n                break;\r\n              }\r\n\r\n              /* Consumed an argument. */\r\n              num_args--;\r\n            }\r\n          }\r\n\r\n          decoder->read_width = 0;\r\n          req_args            = 0;\r\n        }\r\n\r\n        req_args &= 0x000F;\r\n        if ( num_args < req_args )\r\n          goto Stack_Underflow;\r\n        args     -= req_args;\r\n        num_args -= req_args;\r\n\r\n        /* At this point, `args' points to the first argument of the  */\r\n        /* operand in case `req_args' isn't zero.  Otherwise, we have */\r\n        /* to adjust `args' manually.                                 */\r\n\r\n        /* Note that we only pop arguments from the stack which we    */\r\n        /* really need and can digest so that we can continue in case */\r\n        /* of superfluous stack elements.                             */\r\n\r\n        switch ( op )\r\n        {\r\n        case cff_op_hstem:\r\n        case cff_op_vstem:\r\n        case cff_op_hstemhm:\r\n        case cff_op_vstemhm:\r\n          /* the number of arguments is always even here */\r\n          FT_TRACE4((\r\n              op == cff_op_hstem   ? \" hstem\\n\"   :\r\n            ( op == cff_op_vstem   ? \" vstem\\n\"   :\r\n            ( op == cff_op_hstemhm ? \" hstemhm\\n\" : \" vstemhm\\n\" ) ) ));\r\n\r\n          if ( hinter )\r\n            hinter->stems( hinter->hints,\r\n                           ( op == cff_op_hstem || op == cff_op_hstemhm ),\r\n                           num_args / 2,\r\n                           args - ( num_args & ~1 ) );\r\n\r\n          decoder->num_hints += num_args / 2;\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_hintmask:\r\n        case cff_op_cntrmask:\r\n          FT_TRACE4(( op == cff_op_hintmask ? \" hintmask\" : \" cntrmask\" ));\r\n\r\n          /* implement vstem when needed --                        */\r\n          /* the specification doesn't say it, but this also works */\r\n          /* with the 'cntrmask' operator                          */\r\n          /*                                                       */\r\n          if ( num_args > 0 )\r\n          {\r\n            if ( hinter )\r\n              hinter->stems( hinter->hints,\r\n                             0,\r\n                             num_args / 2,\r\n                             args - ( num_args & ~1 ) );\r\n\r\n            decoder->num_hints += num_args / 2;\r\n          }\r\n\r\n          /* In a valid charstring there must be at least one byte */\r\n          /* after `hintmask' or `cntrmask' (e.g., for a `return'  */\r\n          /* instruction).  Additionally, there must be space for  */\r\n          /* `num_hints' bits.                                     */\r\n\r\n          if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit )\r\n            goto Syntax_Error;\r\n\r\n          if ( hinter )\r\n          {\r\n            if ( op == cff_op_hintmask )\r\n              hinter->hintmask( hinter->hints,\r\n                                builder->current->n_points,\r\n                                decoder->num_hints,\r\n                                ip );\r\n            else\r\n              hinter->counter( hinter->hints,\r\n                               decoder->num_hints,\r\n                               ip );\r\n          }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n          {\r\n            FT_UInt maskbyte;\r\n\r\n\r\n            FT_TRACE4(( \" (maskbytes:\" ));\r\n\r\n            for ( maskbyte = 0;\r\n                  maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 );\r\n                  maskbyte++, ip++ )\r\n              FT_TRACE4(( \" 0x%02X\", *ip ));\r\n\r\n            FT_TRACE4(( \")\\n\" ));\r\n          }\r\n#else\r\n          ip += ( decoder->num_hints + 7 ) >> 3;\r\n#endif\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_rmoveto:\r\n          FT_TRACE4(( \" rmoveto\\n\" ));\r\n\r\n          cff_builder_close_contour( builder );\r\n          builder->path_begun = 0;\r\n          x   += args[-2];\r\n          y   += args[-1];\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_vmoveto:\r\n          FT_TRACE4(( \" vmoveto\\n\" ));\r\n\r\n          cff_builder_close_contour( builder );\r\n          builder->path_begun = 0;\r\n          y   += args[-1];\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_hmoveto:\r\n          FT_TRACE4(( \" hmoveto\\n\" ));\r\n\r\n          cff_builder_close_contour( builder );\r\n          builder->path_begun = 0;\r\n          x   += args[-1];\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_rlineto:\r\n          FT_TRACE4(( \" rlineto\\n\" ));\r\n\r\n          if ( cff_builder_start_point ( builder, x, y ) ||\r\n               check_points( builder, num_args / 2 )     )\r\n            goto Fail;\r\n\r\n          if ( num_args < 2 )\r\n            goto Stack_Underflow;\r\n\r\n          args -= num_args & ~1;\r\n          while ( args < decoder->top )\r\n          {\r\n            x += args[0];\r\n            y += args[1];\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n            args += 2;\r\n          }\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_hlineto:\r\n        case cff_op_vlineto:\r\n          {\r\n            FT_Int  phase = ( op == cff_op_hlineto );\r\n\r\n\r\n            FT_TRACE4(( op == cff_op_hlineto ? \" hlineto\\n\"\r\n                                             : \" vlineto\\n\" ));\r\n\r\n            if ( num_args < 0 )\r\n              goto Stack_Underflow;\r\n\r\n            /* there exist subsetted fonts (found in PDFs) */\r\n            /* which call `hlineto' without arguments      */\r\n            if ( num_args == 0 )\r\n              break;\r\n\r\n            if ( cff_builder_start_point ( builder, x, y ) ||\r\n                 check_points( builder, num_args )         )\r\n              goto Fail;\r\n\r\n            args = stack;\r\n            while ( args < decoder->top )\r\n            {\r\n              if ( phase )\r\n                x += args[0];\r\n              else\r\n                y += args[0];\r\n\r\n              if ( cff_builder_add_point1( builder, x, y ) )\r\n                goto Fail;\r\n\r\n              args++;\r\n              phase ^= 1;\r\n            }\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_rrcurveto:\r\n          {\r\n            FT_Int  nargs;\r\n\r\n\r\n            FT_TRACE4(( \" rrcurveto\\n\" ));\r\n\r\n            if ( num_args < 6 )\r\n              goto Stack_Underflow;\r\n\r\n            nargs = num_args - num_args % 6;\r\n\r\n            if ( cff_builder_start_point ( builder, x, y ) ||\r\n                 check_points( builder, nargs / 2 )     )\r\n              goto Fail;\r\n\r\n            args -= nargs;\r\n            while ( args < decoder->top )\r\n            {\r\n              x += args[0];\r\n              y += args[1];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[2];\r\n              y += args[3];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[4];\r\n              y += args[5];\r\n              cff_builder_add_point( builder, x, y, 1 );\r\n              args += 6;\r\n            }\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_vvcurveto:\r\n          {\r\n            FT_Int  nargs;\r\n\r\n\r\n            FT_TRACE4(( \" vvcurveto\\n\" ));\r\n\r\n            if ( num_args < 4 )\r\n              goto Stack_Underflow;\r\n\r\n            /* if num_args isn't of the form 4n or 4n+1, */\r\n            /* we enforce it by clearing the second bit  */\r\n\r\n            nargs = num_args & ~2;\r\n\r\n            if ( cff_builder_start_point( builder, x, y ) )\r\n              goto Fail;\r\n\r\n            args -= nargs;\r\n\r\n            if ( nargs & 1 )\r\n            {\r\n              x += args[0];\r\n              args++;\r\n              nargs--;\r\n            }\r\n\r\n            if ( check_points( builder, 3 * ( nargs / 4 ) ) )\r\n              goto Fail;\r\n\r\n            while ( args < decoder->top )\r\n            {\r\n              y += args[0];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[1];\r\n              y += args[2];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              y += args[3];\r\n              cff_builder_add_point( builder, x, y, 1 );\r\n              args += 4;\r\n            }\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_hhcurveto:\r\n          {\r\n            FT_Int  nargs;\r\n\r\n\r\n            FT_TRACE4(( \" hhcurveto\\n\" ));\r\n\r\n            if ( num_args < 4 )\r\n              goto Stack_Underflow;\r\n\r\n            /* if num_args isn't of the form 4n or 4n+1, */\r\n            /* we enforce it by clearing the second bit  */\r\n\r\n            nargs = num_args & ~2;\r\n\r\n            if ( cff_builder_start_point( builder, x, y ) )\r\n              goto Fail;\r\n\r\n            args -= nargs;\r\n            if ( nargs & 1 )\r\n            {\r\n              y += args[0];\r\n              args++;\r\n              nargs--;\r\n            }\r\n\r\n            if ( check_points( builder, 3 * ( nargs / 4 ) ) )\r\n              goto Fail;\r\n\r\n            while ( args < decoder->top )\r\n            {\r\n              x += args[0];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[1];\r\n              y += args[2];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[3];\r\n              cff_builder_add_point( builder, x, y, 1 );\r\n              args += 4;\r\n            }\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_vhcurveto:\r\n        case cff_op_hvcurveto:\r\n          {\r\n            FT_Int  phase;\r\n            FT_Int  nargs;\r\n\r\n\r\n            FT_TRACE4(( op == cff_op_vhcurveto ? \" vhcurveto\\n\"\r\n                                               : \" hvcurveto\\n\" ));\r\n\r\n            if ( cff_builder_start_point( builder, x, y ) )\r\n              goto Fail;\r\n\r\n            if ( num_args < 4 )\r\n              goto Stack_Underflow;\r\n\r\n            /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */\r\n            /* we enforce it by clearing the second bit               */\r\n\r\n            nargs = num_args & ~2;\r\n\r\n            args -= nargs;\r\n            if ( check_points( builder, ( nargs / 4 ) * 3 ) )\r\n              goto Stack_Underflow;\r\n\r\n            phase = ( op == cff_op_hvcurveto );\r\n\r\n            while ( nargs >= 4 )\r\n            {\r\n              nargs -= 4;\r\n              if ( phase )\r\n              {\r\n                x += args[0];\r\n                cff_builder_add_point( builder, x, y, 0 );\r\n                x += args[1];\r\n                y += args[2];\r\n                cff_builder_add_point( builder, x, y, 0 );\r\n                y += args[3];\r\n                if ( nargs == 1 )\r\n                  x += args[4];\r\n                cff_builder_add_point( builder, x, y, 1 );\r\n              }\r\n              else\r\n              {\r\n                y += args[0];\r\n                cff_builder_add_point( builder, x, y, 0 );\r\n                x += args[1];\r\n                y += args[2];\r\n                cff_builder_add_point( builder, x, y, 0 );\r\n                x += args[3];\r\n                if ( nargs == 1 )\r\n                  y += args[4];\r\n                cff_builder_add_point( builder, x, y, 1 );\r\n              }\r\n              args  += 4;\r\n              phase ^= 1;\r\n            }\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_rlinecurve:\r\n          {\r\n            FT_Int  num_lines;\r\n            FT_Int  nargs;\r\n\r\n\r\n            FT_TRACE4(( \" rlinecurve\\n\" ));\r\n\r\n            if ( num_args < 8 )\r\n              goto Stack_Underflow;\r\n\r\n            nargs     = num_args & ~1;\r\n            num_lines = ( nargs - 6 ) / 2;\r\n\r\n            if ( cff_builder_start_point( builder, x, y ) ||\r\n                 check_points( builder, num_lines + 3 )   )\r\n              goto Fail;\r\n\r\n            args -= nargs;\r\n\r\n            /* first, add the line segments */\r\n            while ( num_lines > 0 )\r\n            {\r\n              x += args[0];\r\n              y += args[1];\r\n              cff_builder_add_point( builder, x, y, 1 );\r\n              args += 2;\r\n              num_lines--;\r\n            }\r\n\r\n            /* then the curve */\r\n            x += args[0];\r\n            y += args[1];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n            x += args[2];\r\n            y += args[3];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n            x += args[4];\r\n            y += args[5];\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_rcurveline:\r\n          {\r\n            FT_Int  num_curves;\r\n            FT_Int  nargs;\r\n\r\n\r\n            FT_TRACE4(( \" rcurveline\\n\" ));\r\n\r\n            if ( num_args < 8 )\r\n              goto Stack_Underflow;\r\n\r\n            nargs      = num_args - 2;\r\n            nargs      = nargs - nargs % 6 + 2;\r\n            num_curves = ( nargs - 2 ) / 6;\r\n\r\n            if ( cff_builder_start_point ( builder, x, y ) ||\r\n                 check_points( builder, num_curves * 3 + 2 ) )\r\n              goto Fail;\r\n\r\n            args -= nargs;\r\n\r\n            /* first, add the curves */\r\n            while ( num_curves > 0 )\r\n            {\r\n              x += args[0];\r\n              y += args[1];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[2];\r\n              y += args[3];\r\n              cff_builder_add_point( builder, x, y, 0 );\r\n              x += args[4];\r\n              y += args[5];\r\n              cff_builder_add_point( builder, x, y, 1 );\r\n              args += 6;\r\n              num_curves--;\r\n            }\r\n\r\n            /* then the final line */\r\n            x += args[0];\r\n            y += args[1];\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_hflex1:\r\n          {\r\n            FT_Pos start_y;\r\n\r\n\r\n            FT_TRACE4(( \" hflex1\\n\" ));\r\n\r\n            /* adding five more points: 4 control points, 1 on-curve point */\r\n            /* -- make sure we have enough space for the start point if it */\r\n            /* needs to be added                                           */\r\n            if ( cff_builder_start_point( builder, x, y ) ||\r\n                 check_points( builder, 6 )               )\r\n              goto Fail;\r\n\r\n            /* record the starting point's y position for later use */\r\n            start_y = y;\r\n\r\n            /* first control point */\r\n            x += args[0];\r\n            y += args[1];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* second control point */\r\n            x += args[2];\r\n            y += args[3];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* join point; on curve, with y-value the same as the last */\r\n            /* control point's y-value                                 */\r\n            x += args[4];\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n\r\n            /* third control point, with y-value the same as the join */\r\n            /* point's y-value                                        */\r\n            x += args[5];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* fourth control point */\r\n            x += args[6];\r\n            y += args[7];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* ending point, with y-value the same as the start   */\r\n            x += args[8];\r\n            y  = start_y;\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n\r\n            args = stack;\r\n            break;\r\n          }\r\n\r\n        case cff_op_hflex:\r\n          {\r\n            FT_Pos start_y;\r\n\r\n\r\n            FT_TRACE4(( \" hflex\\n\" ));\r\n\r\n            /* adding six more points; 4 control points, 2 on-curve points */\r\n            if ( cff_builder_start_point( builder, x, y ) ||\r\n                 check_points( builder, 6 )               )\r\n              goto Fail;\r\n\r\n            /* record the starting point's y-position for later use */\r\n            start_y = y;\r\n\r\n            /* first control point */\r\n            x += args[0];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* second control point */\r\n            x += args[1];\r\n            y += args[2];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* join point; on curve, with y-value the same as the last */\r\n            /* control point's y-value                                 */\r\n            x += args[3];\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n\r\n            /* third control point, with y-value the same as the join */\r\n            /* point's y-value                                        */\r\n            x += args[4];\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* fourth control point */\r\n            x += args[5];\r\n            y  = start_y;\r\n            cff_builder_add_point( builder, x, y, 0 );\r\n\r\n            /* ending point, with y-value the same as the start point's */\r\n            /* y-value -- we don't add this point, though               */\r\n            x += args[6];\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n\r\n            args = stack;\r\n            break;\r\n          }\r\n\r\n        case cff_op_flex1:\r\n          {\r\n            FT_Pos     start_x, start_y; /* record start x, y values for */\r\n                                         /* alter use                    */\r\n            FT_Fixed   dx = 0, dy = 0;   /* used in horizontal/vertical  */\r\n                                         /* algorithm below              */\r\n            FT_Int     horizontal, count;\r\n            FT_Fixed*  temp;\r\n\r\n\r\n            FT_TRACE4(( \" flex1\\n\" ));\r\n\r\n            /* adding six more points; 4 control points, 2 on-curve points */\r\n            if ( cff_builder_start_point( builder, x, y ) ||\r\n                 check_points( builder, 6 )               )\r\n              goto Fail;\r\n\r\n            /* record the starting point's x, y position for later use */\r\n            start_x = x;\r\n            start_y = y;\r\n\r\n            /* XXX: figure out whether this is supposed to be a horizontal */\r\n            /*      or vertical flex; the Type 2 specification is vague... */\r\n\r\n            temp = args;\r\n\r\n            /* grab up to the last argument */\r\n            for ( count = 5; count > 0; count-- )\r\n            {\r\n              dx += temp[0];\r\n              dy += temp[1];\r\n              temp += 2;\r\n            }\r\n\r\n            if ( dx < 0 )\r\n              dx = -dx;\r\n            if ( dy < 0 )\r\n              dy = -dy;\r\n\r\n            /* strange test, but here it is... */\r\n            horizontal = ( dx > dy );\r\n\r\n            for ( count = 5; count > 0; count-- )\r\n            {\r\n              x += args[0];\r\n              y += args[1];\r\n              cff_builder_add_point( builder, x, y,\r\n                                     (FT_Bool)( count == 3 ) );\r\n              args += 2;\r\n            }\r\n\r\n            /* is last operand an x- or y-delta? */\r\n            if ( horizontal )\r\n            {\r\n              x += args[0];\r\n              y  = start_y;\r\n            }\r\n            else\r\n            {\r\n              x  = start_x;\r\n              y += args[0];\r\n            }\r\n\r\n            cff_builder_add_point( builder, x, y, 1 );\r\n\r\n            args = stack;\r\n            break;\r\n           }\r\n\r\n        case cff_op_flex:\r\n          {\r\n            FT_UInt  count;\r\n\r\n\r\n            FT_TRACE4(( \" flex\\n\" ));\r\n\r\n            if ( cff_builder_start_point( builder, x, y ) ||\r\n                 check_points( builder, 6 )               )\r\n              goto Fail;\r\n\r\n            for ( count = 6; count > 0; count-- )\r\n            {\r\n              x += args[0];\r\n              y += args[1];\r\n              cff_builder_add_point( builder, x, y,\r\n                                     (FT_Bool)( count == 4 || count == 1 ) );\r\n              args += 2;\r\n            }\r\n\r\n            args = stack;\r\n          }\r\n          break;\r\n\r\n        case cff_op_seac:\r\n            FT_TRACE4(( \" seac\\n\" ));\r\n\r\n            error = cff_operator_seac( decoder,\r\n                                       args[0], args[1], args[2],\r\n                                       (FT_Int)( args[3] >> 16 ),\r\n                                       (FT_Int)( args[4] >> 16 ) );\r\n\r\n            /* add current outline to the glyph slot */\r\n            FT_GlyphLoader_Add( builder->loader );\r\n\r\n            /* return now! */\r\n            FT_TRACE4(( \"\\n\" ));\r\n            return error;\r\n\r\n        case cff_op_endchar:\r\n          FT_TRACE4(( \" endchar\\n\" ));\r\n\r\n          /* We are going to emulate the seac operator. */\r\n          if ( num_args >= 4 )\r\n          {\r\n            /* Save glyph width so that the subglyphs don't overwrite it. */\r\n            FT_Pos  glyph_width = decoder->glyph_width;\r\n\r\n\r\n            error = cff_operator_seac( decoder,\r\n                                       0L, args[-4], args[-3],\r\n                                       (FT_Int)( args[-2] >> 16 ),\r\n                                       (FT_Int)( args[-1] >> 16 ) );\r\n\r\n            decoder->glyph_width = glyph_width;\r\n          }\r\n          else\r\n          {\r\n            if ( !error )\r\n              error = CFF_Err_Ok;\r\n\r\n            cff_builder_close_contour( builder );\r\n\r\n            /* close hints recording session */\r\n            if ( hinter )\r\n            {\r\n              if ( hinter->close( hinter->hints,\r\n                                  builder->current->n_points ) )\r\n                goto Syntax_Error;\r\n\r\n              /* apply hints to the loaded glyph outline now */\r\n              hinter->apply( hinter->hints,\r\n                             builder->current,\r\n                             (PSH_Globals)builder->hints_globals,\r\n                             decoder->hint_mode );\r\n            }\r\n\r\n            /* add current outline to the glyph slot */\r\n            FT_GlyphLoader_Add( builder->loader );\r\n          }\r\n\r\n          /* return now! */\r\n          FT_TRACE4(( \"\\n\" ));\r\n          return error;\r\n\r\n        case cff_op_abs:\r\n          FT_TRACE4(( \" abs\\n\" ));\r\n\r\n          if ( args[0] < 0 )\r\n            args[0] = -args[0];\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_add:\r\n          FT_TRACE4(( \" add\\n\" ));\r\n\r\n          args[0] += args[1];\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_sub:\r\n          FT_TRACE4(( \" sub\\n\" ));\r\n\r\n          args[0] -= args[1];\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_div:\r\n          FT_TRACE4(( \" div\\n\" ));\r\n\r\n          args[0] = FT_DivFix( args[0], args[1] );\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_neg:\r\n          FT_TRACE4(( \" neg\\n\" ));\r\n\r\n          args[0] = -args[0];\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_random:\r\n          {\r\n            FT_Fixed  Rand;\r\n\r\n\r\n            FT_TRACE4(( \" rand\\n\" ));\r\n\r\n            Rand = seed;\r\n            if ( Rand >= 0x8000L )\r\n              Rand++;\r\n\r\n            args[0] = Rand;\r\n            seed    = FT_MulFix( seed, 0x10000L - seed );\r\n            if ( seed == 0 )\r\n              seed += 0x2873;\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_mul:\r\n          FT_TRACE4(( \" mul\\n\" ));\r\n\r\n          args[0] = FT_MulFix( args[0], args[1] );\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_sqrt:\r\n          FT_TRACE4(( \" sqrt\\n\" ));\r\n\r\n          if ( args[0] > 0 )\r\n          {\r\n            FT_Int    count = 9;\r\n            FT_Fixed  root  = args[0];\r\n            FT_Fixed  new_root;\r\n\r\n\r\n            for (;;)\r\n            {\r\n              new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1;\r\n              if ( new_root == root || count <= 0 )\r\n                break;\r\n              root = new_root;\r\n            }\r\n            args[0] = new_root;\r\n          }\r\n          else\r\n            args[0] = 0;\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_drop:\r\n          /* nothing */\r\n          FT_TRACE4(( \" drop\\n\" ));\r\n\r\n          break;\r\n\r\n        case cff_op_exch:\r\n          {\r\n            FT_Fixed  tmp;\r\n\r\n\r\n            FT_TRACE4(( \" exch\\n\" ));\r\n\r\n            tmp     = args[0];\r\n            args[0] = args[1];\r\n            args[1] = tmp;\r\n            args   += 2;\r\n          }\r\n          break;\r\n\r\n        case cff_op_index:\r\n          {\r\n            FT_Int  idx = (FT_Int)( args[0] >> 16 );\r\n\r\n\r\n            FT_TRACE4(( \" index\\n\" ));\r\n\r\n            if ( idx < 0 )\r\n              idx = 0;\r\n            else if ( idx > num_args - 2 )\r\n              idx = num_args - 2;\r\n            args[0] = args[-( idx + 1 )];\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_roll:\r\n          {\r\n            FT_Int  count = (FT_Int)( args[0] >> 16 );\r\n            FT_Int  idx   = (FT_Int)( args[1] >> 16 );\r\n\r\n\r\n            FT_TRACE4(( \" roll\\n\" ));\r\n\r\n            if ( count <= 0 )\r\n              count = 1;\r\n\r\n            args -= count;\r\n            if ( args < stack )\r\n              goto Stack_Underflow;\r\n\r\n            if ( idx >= 0 )\r\n            {\r\n              while ( idx > 0 )\r\n              {\r\n                FT_Fixed  tmp = args[count - 1];\r\n                FT_Int    i;\r\n\r\n\r\n                for ( i = count - 2; i >= 0; i-- )\r\n                  args[i + 1] = args[i];\r\n                args[0] = tmp;\r\n                idx--;\r\n              }\r\n            }\r\n            else\r\n            {\r\n              while ( idx < 0 )\r\n              {\r\n                FT_Fixed  tmp = args[0];\r\n                FT_Int    i;\r\n\r\n\r\n                for ( i = 0; i < count - 1; i++ )\r\n                  args[i] = args[i + 1];\r\n                args[count - 1] = tmp;\r\n                idx++;\r\n              }\r\n            }\r\n            args += count;\r\n          }\r\n          break;\r\n\r\n        case cff_op_dup:\r\n          FT_TRACE4(( \" dup\\n\" ));\r\n\r\n          args[1] = args[0];\r\n          args += 2;\r\n          break;\r\n\r\n        case cff_op_put:\r\n          {\r\n            FT_Fixed  val = args[0];\r\n            FT_Int    idx = (FT_Int)( args[1] >> 16 );\r\n\r\n\r\n            FT_TRACE4(( \" put\\n\" ));\r\n\r\n            if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )\r\n              decoder->buildchar[idx] = val;\r\n          }\r\n          break;\r\n\r\n        case cff_op_get:\r\n          {\r\n            FT_Int    idx = (FT_Int)( args[0] >> 16 );\r\n            FT_Fixed  val = 0;\r\n\r\n\r\n            FT_TRACE4(( \" get\\n\" ));\r\n\r\n            if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )\r\n              val = decoder->buildchar[idx];\r\n\r\n            args[0] = val;\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_store:\r\n          FT_TRACE4(( \" store\\n\"));\r\n\r\n          goto Unimplemented;\r\n\r\n        case cff_op_load:\r\n          FT_TRACE4(( \" load\\n\" ));\r\n\r\n          goto Unimplemented;\r\n\r\n        case cff_op_dotsection:\r\n          /* this operator is deprecated and ignored by the parser */\r\n          FT_TRACE4(( \" dotsection\\n\" ));\r\n          break;\r\n\r\n        case cff_op_closepath:\r\n          /* this is an invalid Type 2 operator; however, there        */\r\n          /* exist fonts which are incorrectly converted from probably */\r\n          /* Type 1 to CFF, and some parsers seem to accept it         */\r\n\r\n          FT_TRACE4(( \" closepath (invalid op)\\n\" ));\r\n\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_hsbw:\r\n          /* this is an invalid Type 2 operator; however, there        */\r\n          /* exist fonts which are incorrectly converted from probably */\r\n          /* Type 1 to CFF, and some parsers seem to accept it         */\r\n\r\n          FT_TRACE4(( \" hsbw (invalid op)\\n\" ));\r\n\r\n          decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 );\r\n\r\n          decoder->builder.left_bearing.x = args[0];\r\n          decoder->builder.left_bearing.y = 0;\r\n\r\n          x    = decoder->builder.pos_x + args[0];\r\n          y    = decoder->builder.pos_y;\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_sbw:\r\n          /* this is an invalid Type 2 operator; however, there        */\r\n          /* exist fonts which are incorrectly converted from probably */\r\n          /* Type 1 to CFF, and some parsers seem to accept it         */\r\n\r\n          FT_TRACE4(( \" sbw (invalid op)\\n\" ));\r\n\r\n          decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 );\r\n\r\n          decoder->builder.left_bearing.x = args[0];\r\n          decoder->builder.left_bearing.y = args[1];\r\n\r\n          x    = decoder->builder.pos_x + args[0];\r\n          y    = decoder->builder.pos_y + args[1];\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_setcurrentpoint:\r\n          /* this is an invalid Type 2 operator; however, there        */\r\n          /* exist fonts which are incorrectly converted from probably */\r\n          /* Type 1 to CFF, and some parsers seem to accept it         */\r\n\r\n          FT_TRACE4(( \" setcurrentpoint (invalid op)\\n\" ));\r\n\r\n          x    = decoder->builder.pos_x + args[0];\r\n          y    = decoder->builder.pos_y + args[1];\r\n          args = stack;\r\n          break;\r\n\r\n        case cff_op_callothersubr:\r\n          /* this is an invalid Type 2 operator; however, there        */\r\n          /* exist fonts which are incorrectly converted from probably */\r\n          /* Type 1 to CFF, and some parsers seem to accept it         */\r\n\r\n          FT_TRACE4(( \" callothersubr (invalid op)\\n\" ));\r\n\r\n          /* subsequent `pop' operands should add the arguments,       */\r\n          /* this is the implementation described for `unknown' other  */\r\n          /* subroutines in the Type1 spec.                            */\r\n          /*                                                           */\r\n          /* XXX Fix return arguments (see discussion below).          */\r\n          args -= 2 + ( args[-2] >> 16 );\r\n          if ( args < stack )\r\n            goto Stack_Underflow;\r\n          break;\r\n\r\n        case cff_op_pop:\r\n          /* this is an invalid Type 2 operator; however, there        */\r\n          /* exist fonts which are incorrectly converted from probably */\r\n          /* Type 1 to CFF, and some parsers seem to accept it         */\r\n\r\n          FT_TRACE4(( \" pop (invalid op)\\n\" ));\r\n\r\n          /* XXX Increasing `args' is wrong: After a certain number of */\r\n          /* `pop's we get a stack overflow.  Reason for doing it is   */\r\n          /* code like this (actually found in a CFF font):            */\r\n          /*                                                           */\r\n          /*   17 1 3 callothersubr                                    */\r\n          /*   pop                                                     */\r\n          /*   callsubr                                                */\r\n          /*                                                           */\r\n          /* Since we handle `callothersubr' as a no-op, and           */\r\n          /* `callsubr' needs at least one argument, `pop' can't be a  */\r\n          /* no-op too as it basically should be.                      */\r\n          /*                                                           */\r\n          /* The right solution would be to provide real support for   */\r\n          /* `callothersubr' as done in `t1decode.c', however, given   */\r\n          /* the fact that CFF fonts with `pop' are invalid, it is     */\r\n          /* questionable whether it is worth the time.                */\r\n          args++;\r\n          break;\r\n\r\n        case cff_op_and:\r\n          {\r\n            FT_Fixed  cond = args[0] && args[1];\r\n\r\n\r\n            FT_TRACE4(( \" and\\n\" ));\r\n\r\n            args[0] = cond ? 0x10000L : 0;\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_or:\r\n          {\r\n            FT_Fixed  cond = args[0] || args[1];\r\n\r\n\r\n            FT_TRACE4(( \" or\\n\" ));\r\n\r\n            args[0] = cond ? 0x10000L : 0;\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_eq:\r\n          {\r\n            FT_Fixed  cond = !args[0];\r\n\r\n\r\n            FT_TRACE4(( \" eq\\n\" ));\r\n\r\n            args[0] = cond ? 0x10000L : 0;\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_ifelse:\r\n          {\r\n            FT_Fixed  cond = ( args[2] <= args[3] );\r\n\r\n\r\n            FT_TRACE4(( \" ifelse\\n\" ));\r\n\r\n            if ( !cond )\r\n              args[0] = args[1];\r\n            args++;\r\n          }\r\n          break;\r\n\r\n        case cff_op_callsubr:\r\n          {\r\n            FT_UInt  idx = (FT_UInt)( ( args[0] >> 16 ) +\r\n                                      decoder->locals_bias );\r\n\r\n\r\n            FT_TRACE4(( \" callsubr(%d)\\n\", idx ));\r\n\r\n            if ( idx >= decoder->num_locals )\r\n            {\r\n              FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                         \" invalid local subr index\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )\r\n            {\r\n              FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                         \" too many nested subrs\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            zone->cursor = ip;  /* save current instruction pointer */\r\n\r\n            zone++;\r\n            zone->base   = decoder->locals[idx];\r\n            zone->limit  = decoder->locals[idx + 1];\r\n            zone->cursor = zone->base;\r\n\r\n            if ( !zone->base || zone->limit == zone->base )\r\n            {\r\n              FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                         \" invoking empty subrs\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            decoder->zone = zone;\r\n            ip            = zone->base;\r\n            limit         = zone->limit;\r\n          }\r\n          break;\r\n\r\n        case cff_op_callgsubr:\r\n          {\r\n            FT_UInt  idx = (FT_UInt)( ( args[0] >> 16 ) +\r\n                                      decoder->globals_bias );\r\n\r\n\r\n            FT_TRACE4(( \" callgsubr(%d)\\n\", idx ));\r\n\r\n            if ( idx >= decoder->num_globals )\r\n            {\r\n              FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                         \" invalid global subr index\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )\r\n            {\r\n              FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                         \" too many nested subrs\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            zone->cursor = ip;  /* save current instruction pointer */\r\n\r\n            zone++;\r\n            zone->base   = decoder->globals[idx];\r\n            zone->limit  = decoder->globals[idx + 1];\r\n            zone->cursor = zone->base;\r\n\r\n            if ( !zone->base || zone->limit == zone->base )\r\n            {\r\n              FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                         \" invoking empty subrs\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            decoder->zone = zone;\r\n            ip            = zone->base;\r\n            limit         = zone->limit;\r\n          }\r\n          break;\r\n\r\n        case cff_op_return:\r\n          FT_TRACE4(( \" return\\n\" ));\r\n\r\n          if ( decoder->zone <= decoder->zones )\r\n          {\r\n            FT_ERROR(( \"cff_decoder_parse_charstrings:\"\r\n                       \" unexpected return\\n\" ));\r\n            goto Syntax_Error;\r\n          }\r\n\r\n          decoder->zone--;\r\n          zone  = decoder->zone;\r\n          ip    = zone->cursor;\r\n          limit = zone->limit;\r\n          break;\r\n\r\n        default:\r\n        Unimplemented:\r\n          FT_ERROR(( \"Unimplemented opcode: %d\", ip[-1] ));\r\n\r\n          if ( ip[-1] == 12 )\r\n            FT_ERROR(( \" %d\", ip[0] ));\r\n          FT_ERROR(( \"\\n\" ));\r\n\r\n          return CFF_Err_Unimplemented_Feature;\r\n        }\r\n\r\n        decoder->top = args;\r\n\r\n        if ( decoder->top - stack >= CFF_MAX_OPERANDS )\r\n          goto Stack_Overflow;\r\n\r\n      } /* general operator processing */\r\n\r\n    } /* while ip < limit */\r\n\r\n    FT_TRACE4(( \"..end..\\n\\n\" ));\r\n\r\n  Fail:\r\n    return error;\r\n\r\n  Syntax_Error:\r\n    FT_TRACE4(( \"cff_decoder_parse_charstrings: syntax error\\n\" ));\r\n    return CFF_Err_Invalid_File_Format;\r\n\r\n  Stack_Underflow:\r\n    FT_TRACE4(( \"cff_decoder_parse_charstrings: stack underflow\\n\" ));\r\n    return CFF_Err_Too_Few_Arguments;\r\n\r\n  Stack_Overflow:\r\n    FT_TRACE4(( \"cff_decoder_parse_charstrings: stack overflow\\n\" ));\r\n    return CFF_Err_Stack_Overflow;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**********                                                      *********/\r\n  /**********                                                      *********/\r\n  /**********            COMPUTE THE MAXIMUM ADVANCE WIDTH         *********/\r\n  /**********                                                      *********/\r\n  /**********    The following code is in charge of computing      *********/\r\n  /**********    the maximum advance width of the font.  It        *********/\r\n  /**********    quickly processes each glyph charstring to        *********/\r\n  /**********    extract the value from either a `sbw' or `seac'   *********/\r\n  /**********    operator.                                         *********/\r\n  /**********                                                      *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#if 0 /* unused until we support pure CFF fonts */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_compute_max_advance( TT_Face  face,\r\n                           FT_Int*  max_advance )\r\n  {\r\n    FT_Error     error = CFF_Err_Ok;\r\n    CFF_Decoder  decoder;\r\n    FT_Int       glyph_index;\r\n    CFF_Font     cff = (CFF_Font)face->other;\r\n\r\n\r\n    *max_advance = 0;\r\n\r\n    /* Initialize load decoder */\r\n    cff_decoder_init( &decoder, face, 0, 0, 0, 0 );\r\n\r\n    decoder.builder.metrics_only = 1;\r\n    decoder.builder.load_points  = 0;\r\n\r\n    /* For each glyph, parse the glyph charstring and extract */\r\n    /* the advance width.                                     */\r\n    for ( glyph_index = 0; glyph_index < face->root.num_glyphs;\r\n          glyph_index++ )\r\n    {\r\n      FT_Byte*  charstring;\r\n      FT_ULong  charstring_len;\r\n\r\n\r\n      /* now get load the unscaled outline */\r\n      error = cff_get_glyph_data( face, glyph_index,\r\n                                  &charstring, &charstring_len );\r\n      if ( !error )\r\n      {\r\n        error = cff_decoder_prepare( &decoder, size, glyph_index );\r\n        if ( !error )\r\n          error = cff_decoder_parse_charstrings( &decoder,\r\n                                                 charstring,\r\n                                                 charstring_len );\r\n\r\n        cff_free_glyph_data( face, &charstring, &charstring_len );\r\n      }\r\n\r\n      /* ignore the error if one has occurred -- skip to next glyph */\r\n      error = CFF_Err_Ok;\r\n    }\r\n\r\n    *max_advance = decoder.builder.advance.x;\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_slot_load( CFF_GlyphSlot  glyph,\r\n                 CFF_Size       size,\r\n                 FT_UInt        glyph_index,\r\n                 FT_Int32       load_flags )\r\n  {\r\n    FT_Error     error;\r\n    CFF_Decoder  decoder;\r\n    TT_Face      face = (TT_Face)glyph->root.face;\r\n    FT_Bool      hinting, force_scaling;\r\n    CFF_Font     cff  = (CFF_Font)face->extra.data;\r\n\r\n    FT_Matrix    font_matrix;\r\n    FT_Vector    font_offset;\r\n\r\n\r\n    force_scaling = FALSE;\r\n\r\n    /* in a CID-keyed font, consider `glyph_index' as a CID and map */\r\n    /* it immediately to the real glyph_index -- if it isn't a      */\r\n    /* subsetted font, glyph_indices and CIDs are identical, though */\r\n    if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&\r\n         cff->charset.cids                               )\r\n    {\r\n      /* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */\r\n      if ( glyph_index != 0 )\r\n      {\r\n        glyph_index = cff_charset_cid_to_gindex( &cff->charset,\r\n                                                 glyph_index );\r\n        if ( glyph_index == 0 )\r\n          return CFF_Err_Invalid_Argument;\r\n      }\r\n    }\r\n    else if ( glyph_index >= cff->num_glyphs )\r\n      return CFF_Err_Invalid_Argument;\r\n\r\n    if ( load_flags & FT_LOAD_NO_RECURSE )\r\n      load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;\r\n\r\n    glyph->x_scale = 0x10000L;\r\n    glyph->y_scale = 0x10000L;\r\n    if ( size )\r\n    {\r\n      glyph->x_scale = size->root.metrics.x_scale;\r\n      glyph->y_scale = size->root.metrics.y_scale;\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n    /* try to load embedded bitmap if any              */\r\n    /*                                                 */\r\n    /* XXX: The convention should be emphasized in     */\r\n    /*      the documents because it can be confusing. */\r\n    if ( size )\r\n    {\r\n      CFF_Face      cff_face = (CFF_Face)size->root.face;\r\n      SFNT_Service  sfnt     = (SFNT_Service)cff_face->sfnt;\r\n      FT_Stream     stream   = cff_face->root.stream;\r\n\r\n\r\n      if ( size->strike_index != 0xFFFFFFFFUL      &&\r\n           sfnt->load_eblc                         &&\r\n           ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )\r\n      {\r\n        TT_SBit_MetricsRec  metrics;\r\n\r\n\r\n        error = sfnt->load_sbit_image( face,\r\n                                       size->strike_index,\r\n                                       glyph_index,\r\n                                       (FT_Int)load_flags,\r\n                                       stream,\r\n                                       &glyph->root.bitmap,\r\n                                       &metrics );\r\n\r\n        if ( !error )\r\n        {\r\n          glyph->root.outline.n_points   = 0;\r\n          glyph->root.outline.n_contours = 0;\r\n\r\n          glyph->root.metrics.width  = (FT_Pos)metrics.width  << 6;\r\n          glyph->root.metrics.height = (FT_Pos)metrics.height << 6;\r\n\r\n          glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;\r\n          glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;\r\n          glyph->root.metrics.horiAdvance  = (FT_Pos)metrics.horiAdvance  << 6;\r\n\r\n          glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;\r\n          glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;\r\n          glyph->root.metrics.vertAdvance  = (FT_Pos)metrics.vertAdvance  << 6;\r\n\r\n          glyph->root.format = FT_GLYPH_FORMAT_BITMAP;\r\n\r\n          if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n          {\r\n            glyph->root.bitmap_left = metrics.vertBearingX;\r\n            glyph->root.bitmap_top  = metrics.vertBearingY;\r\n          }\r\n          else\r\n          {\r\n            glyph->root.bitmap_left = metrics.horiBearingX;\r\n            glyph->root.bitmap_top  = metrics.horiBearingY;\r\n          }\r\n          return error;\r\n        }\r\n      }\r\n    }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n    /* return immediately if we only want the embedded bitmaps */\r\n    if ( load_flags & FT_LOAD_SBITS_ONLY )\r\n      return CFF_Err_Invalid_Argument;\r\n\r\n    /* if we have a CID subfont, use its matrix (which has already */\r\n    /* been multiplied with the root matrix)                       */\r\n\r\n    /* this scaling is only relevant if the PS hinter isn't active */\r\n    if ( cff->num_subfonts )\r\n    {\r\n      FT_ULong  top_upm, sub_upm;\r\n      FT_Byte   fd_index = cff_fd_select_get( &cff->fd_select,\r\n                                              glyph_index );\r\n\r\n      if ( fd_index >= cff->num_subfonts )\r\n        fd_index = (FT_Byte)( cff->num_subfonts - 1 );\r\n\r\n      top_upm = cff->top_font.font_dict.units_per_em;\r\n      sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em;\r\n\r\n\r\n      font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;\r\n      font_offset = cff->subfonts[fd_index]->font_dict.font_offset;\r\n\r\n      if ( top_upm != sub_upm )\r\n      {\r\n        glyph->x_scale = FT_MulDiv( glyph->x_scale, top_upm, sub_upm );\r\n        glyph->y_scale = FT_MulDiv( glyph->y_scale, top_upm, sub_upm );\r\n\r\n        force_scaling = TRUE;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      font_matrix = cff->top_font.font_dict.font_matrix;\r\n      font_offset = cff->top_font.font_dict.font_offset;\r\n    }\r\n\r\n    glyph->root.outline.n_points   = 0;\r\n    glyph->root.outline.n_contours = 0;\r\n\r\n    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 &&\r\n                       ( load_flags & FT_LOAD_NO_HINTING ) == 0 );\r\n\r\n    glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;  /* by default */\r\n\r\n    {\r\n      FT_Byte*  charstring;\r\n      FT_ULong  charstring_len;\r\n\r\n\r\n      cff_decoder_init( &decoder, face, size, glyph, hinting,\r\n                        FT_LOAD_TARGET_MODE( load_flags ) );\r\n\r\n      if ( load_flags & FT_LOAD_ADVANCE_ONLY )\r\n        decoder.width_only = TRUE;\r\n\r\n      decoder.builder.no_recurse =\r\n        (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );\r\n\r\n      /* now load the unscaled outline */\r\n      error = cff_get_glyph_data( face, glyph_index,\r\n                                  &charstring, &charstring_len );\r\n      if ( error )\r\n        goto Glyph_Build_Finished;\r\n\r\n      error = cff_decoder_prepare( &decoder, size, glyph_index );\r\n      if ( error )\r\n        goto Glyph_Build_Finished;\r\n\r\n      error = cff_decoder_parse_charstrings( &decoder,\r\n                                             charstring,\r\n                                             charstring_len );\r\n\r\n      cff_free_glyph_data( face, &charstring, charstring_len );\r\n\r\n      if ( error )\r\n        goto Glyph_Build_Finished;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n      /* Control data and length may not be available for incremental */\r\n      /* fonts.                                                       */\r\n      if ( face->root.internal->incremental_interface )\r\n      {\r\n        glyph->root.control_data = 0;\r\n        glyph->root.control_len = 0;\r\n      }\r\n      else\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n      /* We set control_data and control_len if charstrings is loaded. */\r\n      /* See how charstring loads at cff_index_access_element() in     */\r\n      /* cffload.c.                                                    */\r\n      {\r\n        CFF_Index  csindex = &cff->charstrings_index;\r\n\r\n\r\n        if ( csindex->offsets )\r\n        {\r\n          glyph->root.control_data = csindex->bytes +\r\n                                     csindex->offsets[glyph_index] - 1;\r\n          glyph->root.control_len  = charstring_len;\r\n        }\r\n      }\r\n\r\n  Glyph_Build_Finished:\r\n      /* save new glyph tables, if no error */\r\n      if ( !error )\r\n        cff_builder_done( &decoder.builder );\r\n      /* XXX: anything to do for broken glyph entry? */\r\n    }\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    /* Incremental fonts can optionally override the metrics. */\r\n    if ( !error                                                               &&\r\n         face->root.internal->incremental_interface                           &&\r\n         face->root.internal->incremental_interface->funcs->get_glyph_metrics )\r\n    {\r\n      FT_Incremental_MetricsRec  metrics;\r\n\r\n\r\n      metrics.bearing_x = decoder.builder.left_bearing.x;\r\n      metrics.bearing_y = 0;\r\n      metrics.advance   = decoder.builder.advance.x;\r\n      metrics.advance_v = decoder.builder.advance.y;\r\n\r\n      error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(\r\n                face->root.internal->incremental_interface->object,\r\n                glyph_index, FALSE, &metrics );\r\n\r\n      decoder.builder.left_bearing.x = metrics.bearing_x;\r\n      decoder.builder.advance.x      = metrics.advance;\r\n      decoder.builder.advance.y      = metrics.advance_v;\r\n    }\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    if ( !error )\r\n    {\r\n      /* Now, set the metrics -- this is rather simple, as   */\r\n      /* the left side bearing is the xMin, and the top side */\r\n      /* bearing the yMax.                                   */\r\n\r\n      /* For composite glyphs, return only left side bearing and */\r\n      /* advance width.                                          */\r\n      if ( load_flags & FT_LOAD_NO_RECURSE )\r\n      {\r\n        FT_Slot_Internal  internal = glyph->root.internal;\r\n\r\n\r\n        glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;\r\n        glyph->root.metrics.horiAdvance  = decoder.glyph_width;\r\n        internal->glyph_matrix           = font_matrix;\r\n        internal->glyph_delta            = font_offset;\r\n        internal->glyph_transformed      = 1;\r\n      }\r\n      else\r\n      {\r\n        FT_BBox            cbox;\r\n        FT_Glyph_Metrics*  metrics = &glyph->root.metrics;\r\n        FT_Vector          advance;\r\n        FT_Bool            has_vertical_info;\r\n\r\n\r\n        /* copy the _unscaled_ advance width */\r\n        metrics->horiAdvance                    = decoder.glyph_width;\r\n        glyph->root.linearHoriAdvance           = decoder.glyph_width;\r\n        glyph->root.internal->glyph_transformed = 0;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n        has_vertical_info = FT_BOOL( face->vertical_info                   &&\r\n                                     face->vertical.number_Of_VMetrics > 0 &&\r\n                                     face->vertical.long_metrics           );\r\n#else\r\n        has_vertical_info = FT_BOOL( face->vertical_info                   &&\r\n                                     face->vertical.number_Of_VMetrics > 0 );\r\n#endif\r\n\r\n        /* get the vertical metrics from the vtmx table if we have one */\r\n        if ( has_vertical_info )\r\n        {\r\n          FT_Short   vertBearingY = 0;\r\n          FT_UShort  vertAdvance  = 0;\r\n\r\n\r\n          ( (SFNT_Service)face->sfnt )->get_metrics( face, 1,\r\n                                                     glyph_index,\r\n                                                     &vertBearingY,\r\n                                                     &vertAdvance );\r\n          metrics->vertBearingY = vertBearingY;\r\n          metrics->vertAdvance  = vertAdvance;\r\n        }\r\n        else\r\n        {\r\n          /* make up vertical ones */\r\n          if ( face->os2.version != 0xFFFFU )\r\n            metrics->vertAdvance = (FT_Pos)( face->os2.sTypoAscender -\r\n                                             face->os2.sTypoDescender );\r\n          else\r\n            metrics->vertAdvance = (FT_Pos)( face->horizontal.Ascender -\r\n                                             face->horizontal.Descender );\r\n        }\r\n\r\n        glyph->root.linearVertAdvance = metrics->vertAdvance;\r\n\r\n        glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;\r\n\r\n        glyph->root.outline.flags = 0;\r\n        if ( size && size->root.metrics.y_ppem < 24 )\r\n          glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;\r\n\r\n        glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;\r\n\r\n        if ( !( font_matrix.xx == 0x10000L &&\r\n                font_matrix.yy == 0x10000L &&\r\n                font_matrix.xy == 0        &&\r\n                font_matrix.yx == 0        ) )\r\n          FT_Outline_Transform( &glyph->root.outline, &font_matrix );\r\n\r\n        if ( !( font_offset.x == 0 &&\r\n                font_offset.y == 0 ) )\r\n          FT_Outline_Translate( &glyph->root.outline,\r\n                                font_offset.x, font_offset.y );\r\n\r\n        advance.x = metrics->horiAdvance;\r\n        advance.y = 0;\r\n        FT_Vector_Transform( &advance, &font_matrix );\r\n        metrics->horiAdvance = advance.x + font_offset.x;\r\n\r\n        advance.x = 0;\r\n        advance.y = metrics->vertAdvance;\r\n        FT_Vector_Transform( &advance, &font_matrix );\r\n        metrics->vertAdvance = advance.y + font_offset.y;\r\n\r\n        if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )\r\n        {\r\n          /* scale the outline and the metrics */\r\n          FT_Int       n;\r\n          FT_Outline*  cur     = &glyph->root.outline;\r\n          FT_Vector*   vec     = cur->points;\r\n          FT_Fixed     x_scale = glyph->x_scale;\r\n          FT_Fixed     y_scale = glyph->y_scale;\r\n\r\n\r\n          /* First of all, scale the points */\r\n          if ( !hinting || !decoder.builder.hints_funcs )\r\n            for ( n = cur->n_points; n > 0; n--, vec++ )\r\n            {\r\n              vec->x = FT_MulFix( vec->x, x_scale );\r\n              vec->y = FT_MulFix( vec->y, y_scale );\r\n            }\r\n\r\n          /* Then scale the metrics */\r\n          metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );\r\n          metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );\r\n        }\r\n\r\n        /* compute the other metrics */\r\n        FT_Outline_Get_CBox( &glyph->root.outline, &cbox );\r\n\r\n        metrics->width  = cbox.xMax - cbox.xMin;\r\n        metrics->height = cbox.yMax - cbox.yMin;\r\n\r\n        metrics->horiBearingX = cbox.xMin;\r\n        metrics->horiBearingY = cbox.yMax;\r\n\r\n        if ( has_vertical_info )\r\n          metrics->vertBearingX = metrics->horiBearingX -\r\n                                    metrics->horiAdvance / 2;\r\n        else\r\n        {\r\n          if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n            ft_synthesize_vertical_metrics( metrics,\r\n                                            metrics->vertAdvance );\r\n        }\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffgload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffgload.h                                                             */\r\n/*                                                                         */\r\n/*    OpenType Glyph Loader (specification).                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFGLOAD_H__\r\n#define __CFFGLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include \"cffobjs.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define CFF_MAX_OPERANDS        48\r\n#define CFF_MAX_SUBRS_CALLS     32\r\n#define CFF_MAX_TRANS_ELEMENTS  32\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Structure>                                                           */\r\n  /*    CFF_Builder                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*     A structure used during glyph loading to store its outline.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory        :: The current memory object.                        */\r\n  /*                                                                       */\r\n  /*    face          :: The current face object.                          */\r\n  /*                                                                       */\r\n  /*    glyph         :: The current glyph slot.                           */\r\n  /*                                                                       */\r\n  /*    loader        :: The current glyph loader.                         */\r\n  /*                                                                       */\r\n  /*    base          :: The base glyph outline.                           */\r\n  /*                                                                       */\r\n  /*    current       :: The current glyph outline.                        */\r\n  /*                                                                       */\r\n  /*    pos_x         :: The horizontal translation (if composite glyph).  */\r\n  /*                                                                       */\r\n  /*    pos_y         :: The vertical translation (if composite glyph).    */\r\n  /*                                                                       */\r\n  /*    left_bearing  :: The left side bearing point.                      */\r\n  /*                                                                       */\r\n  /*    advance       :: The horizontal advance vector.                    */\r\n  /*                                                                       */\r\n  /*    bbox          :: Unused.                                           */\r\n  /*                                                                       */\r\n  /*    path_begun    :: A flag which indicates that a new path has begun. */\r\n  /*                                                                       */\r\n  /*    load_points   :: If this flag is not set, no points are loaded.    */\r\n  /*                                                                       */\r\n  /*    no_recurse    :: Set but not used.                                 */\r\n  /*                                                                       */\r\n  /*    metrics_only  :: A boolean indicating that we only want to compute */\r\n  /*                     the metrics of a given glyph, not load all of its */\r\n  /*                     points.                                           */\r\n  /*                                                                       */\r\n  /*    hints_funcs   :: Auxiliary pointer for hinting.                    */\r\n  /*                                                                       */\r\n  /*    hints_globals :: Auxiliary pointer for hinting.                    */\r\n  /*                                                                       */\r\n  typedef struct  CFF_Builder_\r\n  {\r\n    FT_Memory       memory;\r\n    TT_Face         face;\r\n    CFF_GlyphSlot   glyph;\r\n    FT_GlyphLoader  loader;\r\n    FT_Outline*     base;\r\n    FT_Outline*     current;\r\n\r\n    FT_Pos          pos_x;\r\n    FT_Pos          pos_y;\r\n\r\n    FT_Vector       left_bearing;\r\n    FT_Vector       advance;\r\n\r\n    FT_BBox         bbox;          /* bounding box */\r\n    FT_Bool         path_begun;\r\n    FT_Bool         load_points;\r\n    FT_Bool         no_recurse;\r\n\r\n    FT_Bool         metrics_only;\r\n\r\n    void*           hints_funcs;    /* hinter-specific */\r\n    void*           hints_globals;  /* hinter-specific */\r\n\r\n  } CFF_Builder;\r\n\r\n\r\n  /* execution context charstring zone */\r\n\r\n  typedef struct  CFF_Decoder_Zone_\r\n  {\r\n    FT_Byte*  base;\r\n    FT_Byte*  limit;\r\n    FT_Byte*  cursor;\r\n\r\n  } CFF_Decoder_Zone;\r\n\r\n\r\n  typedef struct  CFF_Decoder_\r\n  {\r\n    CFF_Builder        builder;\r\n    CFF_Font           cff;\r\n\r\n    FT_Fixed           stack[CFF_MAX_OPERANDS + 1];\r\n    FT_Fixed*          top;\r\n\r\n    CFF_Decoder_Zone   zones[CFF_MAX_SUBRS_CALLS + 1];\r\n    CFF_Decoder_Zone*  zone;\r\n\r\n    FT_Int             flex_state;\r\n    FT_Int             num_flex_vectors;\r\n    FT_Vector          flex_vectors[7];\r\n\r\n    FT_Pos             glyph_width;\r\n    FT_Pos             nominal_width;\r\n\r\n    FT_Bool            read_width;\r\n    FT_Bool            width_only;\r\n    FT_Int             num_hints;\r\n    FT_Fixed           buildchar[CFF_MAX_TRANS_ELEMENTS];\r\n\r\n    FT_UInt            num_locals;\r\n    FT_UInt            num_globals;\r\n\r\n    FT_Int             locals_bias;\r\n    FT_Int             globals_bias;\r\n\r\n    FT_Byte**          locals;\r\n    FT_Byte**          globals;\r\n\r\n    FT_Byte**          glyph_names;   /* for pure CFF fonts only  */\r\n    FT_UInt            num_glyphs;    /* number of glyphs in font */\r\n\r\n    FT_Render_Mode     hint_mode;\r\n\r\n    FT_Bool            seac;\r\n\r\n  } CFF_Decoder;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  cff_decoder_init( CFF_Decoder*    decoder,\r\n                    TT_Face         face,\r\n                    CFF_Size        size,\r\n                    CFF_GlyphSlot   slot,\r\n                    FT_Bool         hinting,\r\n                    FT_Render_Mode  hint_mode );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_decoder_prepare( CFF_Decoder*  decoder,\r\n                       CFF_Size      size,\r\n                       FT_UInt       glyph_index );\r\n\r\n#if 0  /* unused until we support pure CFF fonts */\r\n\r\n  /* Compute the maximum advance width of a font through quick parsing */\r\n  FT_LOCAL( FT_Error )\r\n  cff_compute_max_advance( TT_Face  face,\r\n                           FT_Int*  max_advance );\r\n\r\n#endif /* 0 */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_decoder_parse_charstrings( CFF_Decoder*  decoder,\r\n                                 FT_Byte*      charstring_base,\r\n                                 FT_ULong      charstring_len );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_slot_load( CFF_GlyphSlot  glyph,\r\n                 CFF_Size       size,\r\n                 FT_UInt        glyph_index,\r\n                 FT_Int32       load_flags );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFGLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffload.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType and CFF data/program tables loader (body).                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_TYPE1_TABLES_H\r\n\r\n#include \"cffload.h\"\r\n#include \"cffparse.h\"\r\n\r\n#include \"cfferrs.h\"\r\n\r\n\r\n#if 1\r\n\r\n  static const FT_UShort  cff_isoadobe_charset[229] =\r\n  {\r\n      0,   1,   2,   3,   4,   5,   6,   7,\r\n      8,   9,  10,  11,  12,  13,  14,  15,\r\n     16,  17,  18,  19,  20,  21,  22,  23,\r\n     24,  25,  26,  27,  28,  29,  30,  31,\r\n     32,  33,  34,  35,  36,  37,  38,  39,\r\n     40,  41,  42,  43,  44,  45,  46,  47,\r\n     48,  49,  50,  51,  52,  53,  54,  55,\r\n     56,  57,  58,  59,  60,  61,  62,  63,\r\n     64,  65,  66,  67,  68,  69,  70,  71,\r\n     72,  73,  74,  75,  76,  77,  78,  79,\r\n     80,  81,  82,  83,  84,  85,  86,  87,\r\n     88,  89,  90,  91,  92,  93,  94,  95,\r\n     96,  97,  98,  99, 100, 101, 102, 103,\r\n    104, 105, 106, 107, 108, 109, 110, 111,\r\n    112, 113, 114, 115, 116, 117, 118, 119,\r\n    120, 121, 122, 123, 124, 125, 126, 127,\r\n    128, 129, 130, 131, 132, 133, 134, 135,\r\n    136, 137, 138, 139, 140, 141, 142, 143,\r\n    144, 145, 146, 147, 148, 149, 150, 151,\r\n    152, 153, 154, 155, 156, 157, 158, 159,\r\n    160, 161, 162, 163, 164, 165, 166, 167,\r\n    168, 169, 170, 171, 172, 173, 174, 175,\r\n    176, 177, 178, 179, 180, 181, 182, 183,\r\n    184, 185, 186, 187, 188, 189, 190, 191,\r\n    192, 193, 194, 195, 196, 197, 198, 199,\r\n    200, 201, 202, 203, 204, 205, 206, 207,\r\n    208, 209, 210, 211, 212, 213, 214, 215,\r\n    216, 217, 218, 219, 220, 221, 222, 223,\r\n    224, 225, 226, 227, 228\r\n  };\r\n\r\n  static const FT_UShort  cff_expert_charset[166] =\r\n  {\r\n      0,   1, 229, 230, 231, 232, 233, 234,\r\n    235, 236, 237, 238,  13,  14,  15,  99,\r\n    239, 240, 241, 242, 243, 244, 245, 246,\r\n    247, 248,  27,  28, 249, 250, 251, 252,\r\n    253, 254, 255, 256, 257, 258, 259, 260,\r\n    261, 262, 263, 264, 265, 266, 109, 110,\r\n    267, 268, 269, 270, 271, 272, 273, 274,\r\n    275, 276, 277, 278, 279, 280, 281, 282,\r\n    283, 284, 285, 286, 287, 288, 289, 290,\r\n    291, 292, 293, 294, 295, 296, 297, 298,\r\n    299, 300, 301, 302, 303, 304, 305, 306,\r\n    307, 308, 309, 310, 311, 312, 313, 314,\r\n    315, 316, 317, 318, 158, 155, 163, 319,\r\n    320, 321, 322, 323, 324, 325, 326, 150,\r\n    164, 169, 327, 328, 329, 330, 331, 332,\r\n    333, 334, 335, 336, 337, 338, 339, 340,\r\n    341, 342, 343, 344, 345, 346, 347, 348,\r\n    349, 350, 351, 352, 353, 354, 355, 356,\r\n    357, 358, 359, 360, 361, 362, 363, 364,\r\n    365, 366, 367, 368, 369, 370, 371, 372,\r\n    373, 374, 375, 376, 377, 378\r\n  };\r\n\r\n  static const FT_UShort  cff_expertsubset_charset[87] =\r\n  {\r\n      0,   1, 231, 232, 235, 236, 237, 238,\r\n     13,  14,  15,  99, 239, 240, 241, 242,\r\n    243, 244, 245, 246, 247, 248,  27,  28,\r\n    249, 250, 251, 253, 254, 255, 256, 257,\r\n    258, 259, 260, 261, 262, 263, 264, 265,\r\n    266, 109, 110, 267, 268, 269, 270, 272,\r\n    300, 301, 302, 305, 314, 315, 158, 155,\r\n    163, 320, 321, 322, 323, 324, 325, 326,\r\n    150, 164, 169, 327, 328, 329, 330, 331,\r\n    332, 333, 334, 335, 336, 337, 338, 339,\r\n    340, 341, 342, 343, 344, 345, 346\r\n  };\r\n\r\n  static const FT_UShort  cff_standard_encoding[256] =\r\n  {\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      1,   2,   3,   4,   5,   6,   7,   8,\r\n      9,  10,  11,  12,  13,  14,  15,  16,\r\n     17,  18,  19,  20,  21,  22,  23,  24,\r\n     25,  26,  27,  28,  29,  30,  31,  32,\r\n     33,  34,  35,  36,  37,  38,  39,  40,\r\n     41,  42,  43,  44,  45,  46,  47,  48,\r\n     49,  50,  51,  52,  53,  54,  55,  56,\r\n     57,  58,  59,  60,  61,  62,  63,  64,\r\n     65,  66,  67,  68,  69,  70,  71,  72,\r\n     73,  74,  75,  76,  77,  78,  79,  80,\r\n     81,  82,  83,  84,  85,  86,  87,  88,\r\n     89,  90,  91,  92,  93,  94,  95,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,  96,  97,  98,  99, 100, 101, 102,\r\n    103, 104, 105, 106, 107, 108, 109, 110,\r\n      0, 111, 112, 113, 114,   0, 115, 116,\r\n    117, 118, 119, 120, 121, 122,   0, 123,\r\n      0, 124, 125, 126, 127, 128, 129, 130,\r\n    131,   0, 132, 133,   0, 134, 135, 136,\r\n    137,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0, 138,   0, 139,   0,   0,   0,   0,\r\n    140, 141, 142, 143,   0,   0,   0,   0,\r\n      0, 144,   0,   0,   0, 145,   0,   0,\r\n    146, 147, 148, 149,   0,   0,   0,   0\r\n  };\r\n\r\n  static const FT_UShort  cff_expert_encoding[256] =\r\n  {\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      1, 229, 230,   0, 231, 232, 233, 234,\r\n    235, 236, 237, 238,  13,  14,  15,  99,\r\n    239, 240, 241, 242, 243, 244, 245, 246,\r\n    247, 248,  27,  28, 249, 250, 251, 252,\r\n      0, 253, 254, 255, 256, 257,   0,   0,\r\n      0, 258,   0,   0, 259, 260, 261, 262,\r\n      0,   0, 263, 264, 265,   0, 266, 109,\r\n    110, 267, 268, 269,   0, 270, 271, 272,\r\n    273, 274, 275, 276, 277, 278, 279, 280,\r\n    281, 282, 283, 284, 285, 286, 287, 288,\r\n    289, 290, 291, 292, 293, 294, 295, 296,\r\n    297, 298, 299, 300, 301, 302, 303,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0,   0,   0,   0,   0,   0,   0,   0,\r\n      0, 304, 305, 306,   0,   0, 307, 308,\r\n    309, 310, 311,   0, 312,   0,   0, 312,\r\n      0,   0, 314, 315,   0,   0, 316, 317,\r\n    318,   0,   0,   0, 158, 155, 163, 319,\r\n    320, 321, 322, 323, 324, 325,   0,   0,\r\n    326, 150, 164, 169, 327, 328, 329, 330,\r\n    331, 332, 333, 334, 335, 336, 337, 338,\r\n    339, 340, 341, 342, 343, 344, 345, 346,\r\n    347, 348, 349, 350, 351, 352, 353, 354,\r\n    355, 356, 357, 358, 359, 360, 361, 362,\r\n    363, 364, 365, 366, 367, 368, 369, 370,\r\n    371, 372, 373, 374, 375, 376, 377, 378\r\n  };\r\n\r\n#endif /* 1 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UShort )\r\n  cff_get_standard_encoding( FT_UInt  charcode )\r\n  {\r\n    return (FT_UShort)( charcode < 256 ? cff_standard_encoding[charcode]\r\n                                       : 0 );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cffload\r\n\r\n\r\n  /* read an offset from the index's stream current position */\r\n  static FT_ULong\r\n  cff_index_read_offset( CFF_Index  idx,\r\n                         FT_Error  *errorp )\r\n  {\r\n    FT_Error   error;\r\n    FT_Stream  stream = idx->stream;\r\n    FT_Byte    tmp[4];\r\n    FT_ULong   result = 0;\r\n\r\n\r\n    if ( !FT_STREAM_READ( tmp, idx->off_size ) )\r\n    {\r\n      FT_Int  nn;\r\n\r\n\r\n      for ( nn = 0; nn < idx->off_size; nn++ )\r\n        result = ( result << 8 ) | tmp[nn];\r\n    }\r\n\r\n    *errorp = error;\r\n    return result;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_index_init( CFF_Index  idx,\r\n                  FT_Stream  stream,\r\n                  FT_Bool    load )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_UShort  count;\r\n\r\n\r\n    FT_MEM_ZERO( idx, sizeof ( *idx ) );\r\n\r\n    idx->stream = stream;\r\n    idx->start  = FT_STREAM_POS();\r\n    if ( !FT_READ_USHORT( count ) &&\r\n         count > 0                )\r\n    {\r\n      FT_Byte   offsize;\r\n      FT_ULong  size;\r\n\r\n\r\n      /* there is at least one element; read the offset size,           */\r\n      /* then access the offset table to compute the index's total size */\r\n      if ( FT_READ_BYTE( offsize ) )\r\n        goto Exit;\r\n\r\n      if ( offsize < 1 || offsize > 4 )\r\n      {\r\n        error = CFF_Err_Invalid_Table;\r\n        goto Exit;\r\n      }\r\n\r\n      idx->count    = count;\r\n      idx->off_size = offsize;\r\n      size          = (FT_ULong)( count + 1 ) * offsize;\r\n\r\n      idx->data_offset = idx->start + 3 + size;\r\n\r\n      if ( FT_STREAM_SKIP( size - offsize ) )\r\n        goto Exit;\r\n\r\n      size = cff_index_read_offset( idx, &error );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      if ( size == 0 )\r\n      {\r\n        error = CFF_Err_Invalid_Table;\r\n        goto Exit;\r\n      }\r\n\r\n      idx->data_size = --size;\r\n\r\n      if ( load )\r\n      {\r\n        /* load the data */\r\n        if ( FT_FRAME_EXTRACT( size, idx->bytes ) )\r\n          goto Exit;\r\n      }\r\n      else\r\n      {\r\n        /* skip the data */\r\n        if ( FT_STREAM_SKIP( size ) )\r\n          goto Exit;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    if ( error )\r\n      FT_FREE( idx->offsets );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  cff_index_done( CFF_Index  idx )\r\n  {\r\n    if ( idx->stream )\r\n    {\r\n      FT_Stream  stream = idx->stream;\r\n      FT_Memory  memory = stream->memory;\r\n\r\n\r\n      if ( idx->bytes )\r\n        FT_FRAME_RELEASE( idx->bytes );\r\n\r\n      FT_FREE( idx->offsets );\r\n      FT_MEM_ZERO( idx, sizeof ( *idx ) );\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_index_load_offsets( CFF_Index  idx )\r\n  {\r\n    FT_Error   error  = CFF_Err_Ok;\r\n    FT_Stream  stream = idx->stream;\r\n    FT_Memory  memory = stream->memory;\r\n\r\n\r\n    if ( idx->count > 0 && idx->offsets == NULL )\r\n    {\r\n      FT_Byte    offsize = idx->off_size;\r\n      FT_ULong   data_size;\r\n      FT_Byte*   p;\r\n      FT_Byte*   p_end;\r\n      FT_ULong*  poff;\r\n\r\n\r\n      data_size = (FT_ULong)( idx->count + 1 ) * offsize;\r\n\r\n      if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||\r\n           FT_STREAM_SEEK( idx->start + 3 )             ||\r\n           FT_FRAME_ENTER( data_size )                  )\r\n        goto Exit;\r\n\r\n      poff   = idx->offsets;\r\n      p      = (FT_Byte*)stream->cursor;\r\n      p_end  = p + data_size;\r\n\r\n      switch ( offsize )\r\n      {\r\n      case 1:\r\n        for ( ; p < p_end; p++, poff++ )\r\n          poff[0] = p[0];\r\n        break;\r\n\r\n      case 2:\r\n        for ( ; p < p_end; p += 2, poff++ )\r\n          poff[0] = FT_PEEK_USHORT( p );\r\n        break;\r\n\r\n      case 3:\r\n        for ( ; p < p_end; p += 3, poff++ )\r\n          poff[0] = FT_PEEK_OFF3( p );\r\n        break;\r\n\r\n      default:\r\n        for ( ; p < p_end; p += 4, poff++ )\r\n          poff[0] = FT_PEEK_ULONG( p );\r\n      }\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    if ( error )\r\n      FT_FREE( idx->offsets );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Allocate a table containing pointers to an index's elements. */\r\n  /* The `pool' argument makes this function convert the index    */\r\n  /* entries to C-style strings (this is, NULL-terminated).       */\r\n  static FT_Error\r\n  cff_index_get_pointers( CFF_Index   idx,\r\n                          FT_Byte***  table,\r\n                          FT_Byte**   pool )\r\n  {\r\n    FT_Error   error     = CFF_Err_Ok;\r\n    FT_Memory  memory    = idx->stream->memory;\r\n    FT_Byte**  t = NULL;\r\n    FT_Byte*   new_bytes = NULL;\r\n\r\n\r\n    *table = NULL;\r\n\r\n    if ( idx->offsets == NULL )\r\n    {\r\n      error = cff_index_load_offsets( idx );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( idx->count > 0                                        &&\r\n         !FT_NEW_ARRAY( t, idx->count + 1 )                    &&\r\n         ( !pool || !FT_ALLOC( new_bytes,\r\n                               idx->data_size + idx->count ) ) )\r\n    {\r\n      FT_ULong  n, cur_offset;\r\n      FT_ULong  extra = 0;\r\n      FT_Byte*  org_bytes = idx->bytes;\r\n\r\n\r\n      /* at this point, `idx->offsets' can't be NULL */\r\n      cur_offset = idx->offsets[0] - 1;\r\n\r\n      /* sanity check */\r\n      if ( cur_offset >= idx->data_size )\r\n      {\r\n        FT_TRACE0(( \"cff_index_get_pointers:\"\r\n                    \" invalid first offset value %d set to zero\\n\",\r\n                    cur_offset ));\r\n        cur_offset = 0;\r\n      }\r\n\r\n      if ( !pool )\r\n        t[0] = org_bytes + cur_offset;\r\n      else\r\n        t[0] = new_bytes + cur_offset;\r\n\r\n      for ( n = 1; n <= idx->count; n++ )\r\n      {\r\n        FT_ULong  next_offset = idx->offsets[n] - 1;\r\n\r\n\r\n        /* empty slot + two sanity checks for invalid offset tables */\r\n        if ( next_offset == 0                                    ||\r\n             next_offset < cur_offset                            ||\r\n             ( next_offset >= idx->data_size && n < idx->count ) )\r\n          next_offset = cur_offset;\r\n\r\n        if ( !pool )\r\n          t[n] = org_bytes + next_offset;\r\n        else\r\n        {\r\n          t[n] = new_bytes + next_offset + extra;\r\n\r\n          if ( next_offset != cur_offset )\r\n          {\r\n            FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] );\r\n            t[n][0] = '\\0';\r\n            t[n]   += 1;\r\n            extra++;\r\n          }\r\n        }\r\n\r\n        cur_offset = next_offset;\r\n      }\r\n      *table = t;\r\n\r\n      if ( pool )\r\n        *pool = new_bytes;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_index_access_element( CFF_Index  idx,\r\n                            FT_UInt    element,\r\n                            FT_Byte**  pbytes,\r\n                            FT_ULong*  pbyte_len )\r\n  {\r\n    FT_Error  error = CFF_Err_Ok;\r\n\r\n\r\n    if ( idx && idx->count > element )\r\n    {\r\n      /* compute start and end offsets */\r\n      FT_Stream  stream = idx->stream;\r\n      FT_ULong   off1, off2 = 0;\r\n\r\n\r\n      /* load offsets from file or the offset table */\r\n      if ( !idx->offsets )\r\n      {\r\n        FT_ULong  pos = element * idx->off_size;\r\n\r\n\r\n        if ( FT_STREAM_SEEK( idx->start + 3 + pos ) )\r\n          goto Exit;\r\n\r\n        off1 = cff_index_read_offset( idx, &error );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        if ( off1 != 0 )\r\n        {\r\n          do\r\n          {\r\n            element++;\r\n            off2 = cff_index_read_offset( idx, &error );\r\n          }\r\n          while ( off2 == 0 && element < idx->count );\r\n        }\r\n      }\r\n      else   /* use offsets table */\r\n      {\r\n        off1 = idx->offsets[element];\r\n        if ( off1 )\r\n        {\r\n          do\r\n          {\r\n            element++;\r\n            off2 = idx->offsets[element];\r\n\r\n          } while ( off2 == 0 && element < idx->count );\r\n        }\r\n      }\r\n\r\n      /* XXX: should check off2 does not exceed the end of this entry; */\r\n      /*      at present, only truncate off2 at the end of this stream */\r\n      if ( off2 > stream->size + 1                    ||\r\n           idx->data_offset > stream->size - off2 + 1 )\r\n      {\r\n        FT_ERROR(( \"cff_index_access_element:\"\r\n                   \" offset to next entry (%d)\"\r\n                   \" exceeds the end of stream (%d)\\n\",\r\n                   off2, stream->size - idx->data_offset + 1 ));\r\n        off2 = stream->size - idx->data_offset + 1;\r\n      }\r\n\r\n      /* access element */\r\n      if ( off1 && off2 > off1 )\r\n      {\r\n        *pbyte_len = off2 - off1;\r\n\r\n        if ( idx->bytes )\r\n        {\r\n          /* this index was completely loaded in memory, that's easy */\r\n          *pbytes = idx->bytes + off1 - 1;\r\n        }\r\n        else\r\n        {\r\n          /* this index is still on disk/file, access it through a frame */\r\n          if ( FT_STREAM_SEEK( idx->data_offset + off1 - 1 ) ||\r\n               FT_FRAME_EXTRACT( off2 - off1, *pbytes )      )\r\n            goto Exit;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        /* empty index element */\r\n        *pbytes    = 0;\r\n        *pbyte_len = 0;\r\n      }\r\n    }\r\n    else\r\n      error = CFF_Err_Invalid_Argument;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_index_forget_element( CFF_Index  idx,\r\n                            FT_Byte**  pbytes )\r\n  {\r\n    if ( idx->bytes == 0 )\r\n    {\r\n      FT_Stream  stream = idx->stream;\r\n\r\n\r\n      FT_FRAME_RELEASE( *pbytes );\r\n    }\r\n  }\r\n\r\n\r\n  /* get an entry from Name INDEX */\r\n  FT_LOCAL_DEF( FT_String* )\r\n  cff_index_get_name( CFF_Font  font,\r\n                      FT_UInt   element )\r\n  {\r\n    CFF_Index   idx = &font->name_index;\r\n    FT_Memory   memory = idx->stream->memory;\r\n    FT_Byte*    bytes;\r\n    FT_ULong    byte_len;\r\n    FT_Error    error;\r\n    FT_String*  name = 0;\r\n\r\n\r\n    error = cff_index_access_element( idx, element, &bytes, &byte_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( !FT_ALLOC( name, byte_len + 1 ) )\r\n    {\r\n      FT_MEM_COPY( name, bytes, byte_len );\r\n      name[byte_len] = 0;\r\n    }\r\n    cff_index_forget_element( idx, &bytes );\r\n\r\n  Exit:\r\n    return name;\r\n  }\r\n\r\n\r\n  /* get an entry from String INDEX */\r\n  FT_LOCAL_DEF( FT_String* )\r\n  cff_index_get_string( CFF_Font  font,\r\n                        FT_UInt   element )\r\n  {\r\n    return ( element < font->num_strings )\r\n             ? (FT_String*)font->strings[element]\r\n             : NULL;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_String* )\r\n  cff_index_get_sid_string( CFF_Font  font,\r\n                            FT_UInt   sid )\r\n  {\r\n    /* value 0xFFFFU indicates a missing dictionary entry */\r\n    if ( sid == 0xFFFFU )\r\n      return NULL;\r\n\r\n    /* if it is not a standard string, return it */\r\n    if ( sid > 390 )\r\n      return cff_index_get_string( font, sid - 391 );\r\n\r\n    /* CID-keyed CFF fonts don't have glyph names */\r\n    if ( !font->psnames )\r\n      return NULL;\r\n\r\n    /* this is a standard string */\r\n    return (FT_String *)font->psnames->adobe_std_strings( sid );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***   FD Select table support                                         ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  static void\r\n  CFF_Done_FD_Select( CFF_FDSelect  fdselect,\r\n                      FT_Stream     stream )\r\n  {\r\n    if ( fdselect->data )\r\n      FT_FRAME_RELEASE( fdselect->data );\r\n\r\n    fdselect->data_size   = 0;\r\n    fdselect->format      = 0;\r\n    fdselect->range_count = 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  CFF_Load_FD_Select( CFF_FDSelect  fdselect,\r\n                      FT_UInt       num_glyphs,\r\n                      FT_Stream     stream,\r\n                      FT_ULong      offset )\r\n  {\r\n    FT_Error  error;\r\n    FT_Byte   format;\r\n    FT_UInt   num_ranges;\r\n\r\n\r\n    /* read format */\r\n    if ( FT_STREAM_SEEK( offset ) || FT_READ_BYTE( format ) )\r\n      goto Exit;\r\n\r\n    fdselect->format      = format;\r\n    fdselect->cache_count = 0;   /* clear cache */\r\n\r\n    switch ( format )\r\n    {\r\n    case 0:     /* format 0, that's simple */\r\n      fdselect->data_size = num_glyphs;\r\n      goto Load_Data;\r\n\r\n    case 3:     /* format 3, a tad more complex */\r\n      if ( FT_READ_USHORT( num_ranges ) )\r\n        goto Exit;\r\n\r\n      fdselect->data_size = num_ranges * 3 + 2;\r\n\r\n    Load_Data:\r\n      if ( FT_FRAME_EXTRACT( fdselect->data_size, fdselect->data ) )\r\n        goto Exit;\r\n      break;\r\n\r\n    default:    /* hmm... that's wrong */\r\n      error = CFF_Err_Invalid_File_Format;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Byte )\r\n  cff_fd_select_get( CFF_FDSelect  fdselect,\r\n                     FT_UInt       glyph_index )\r\n  {\r\n    FT_Byte  fd = 0;\r\n\r\n\r\n    switch ( fdselect->format )\r\n    {\r\n    case 0:\r\n      fd = fdselect->data[glyph_index];\r\n      break;\r\n\r\n    case 3:\r\n      /* first, compare to cache */\r\n      if ( (FT_UInt)( glyph_index - fdselect->cache_first ) <\r\n                        fdselect->cache_count )\r\n      {\r\n        fd = fdselect->cache_fd;\r\n        break;\r\n      }\r\n\r\n      /* then, lookup the ranges array */\r\n      {\r\n        FT_Byte*  p       = fdselect->data;\r\n        FT_Byte*  p_limit = p + fdselect->data_size;\r\n        FT_Byte   fd2;\r\n        FT_UInt   first, limit;\r\n\r\n\r\n        first = FT_NEXT_USHORT( p );\r\n        do\r\n        {\r\n          if ( glyph_index < first )\r\n            break;\r\n\r\n          fd2   = *p++;\r\n          limit = FT_NEXT_USHORT( p );\r\n\r\n          if ( glyph_index < limit )\r\n          {\r\n            fd = fd2;\r\n\r\n            /* update cache */\r\n            fdselect->cache_first = first;\r\n            fdselect->cache_count = limit-first;\r\n            fdselect->cache_fd    = fd2;\r\n            break;\r\n          }\r\n          first = limit;\r\n\r\n        } while ( p < p_limit );\r\n      }\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    return fd;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***   CFF font support                                                ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static FT_Error\r\n  cff_charset_compute_cids( CFF_Charset  charset,\r\n                            FT_UInt      num_glyphs,\r\n                            FT_Memory    memory )\r\n  {\r\n    FT_Error   error   = CFF_Err_Ok;\r\n    FT_UInt    i;\r\n    FT_Long    j;\r\n    FT_UShort  max_cid = 0;\r\n\r\n\r\n    if ( charset->max_cid > 0 )\r\n      goto Exit;\r\n\r\n    for ( i = 0; i < num_glyphs; i++ )\r\n    {\r\n      if ( charset->sids[i] > max_cid )\r\n        max_cid = charset->sids[i];\r\n    }\r\n\r\n    if ( FT_NEW_ARRAY( charset->cids, (FT_ULong)max_cid + 1 ) )\r\n      goto Exit;\r\n\r\n    /* When multiple GIDs map to the same CID, we choose the lowest */\r\n    /* GID.  This is not described in any spec, but it matches the  */\r\n    /* behaviour of recent Acroread versions.                       */\r\n    for ( j = num_glyphs - 1; j >= 0 ; j-- )\r\n      charset->cids[charset->sids[j]] = (FT_UShort)j;\r\n\r\n    charset->max_cid    = max_cid;\r\n    charset->num_glyphs = num_glyphs;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  cff_charset_cid_to_gindex( CFF_Charset  charset,\r\n                             FT_UInt      cid )\r\n  {\r\n    FT_UInt  result = 0;\r\n\r\n\r\n    if ( cid <= charset->max_cid )\r\n      result = charset->cids[cid];\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  static void\r\n  cff_charset_free_cids( CFF_Charset  charset,\r\n                         FT_Memory    memory )\r\n  {\r\n    FT_FREE( charset->cids );\r\n    charset->max_cid = 0;\r\n  }\r\n\r\n\r\n  static void\r\n  cff_charset_done( CFF_Charset  charset,\r\n                    FT_Stream    stream )\r\n  {\r\n    FT_Memory  memory = stream->memory;\r\n\r\n\r\n    cff_charset_free_cids( charset, memory );\r\n\r\n    FT_FREE( charset->sids );\r\n    charset->format = 0;\r\n    charset->offset = 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_charset_load( CFF_Charset  charset,\r\n                    FT_UInt      num_glyphs,\r\n                    FT_Stream    stream,\r\n                    FT_ULong     base_offset,\r\n                    FT_ULong     offset,\r\n                    FT_Bool      invert )\r\n  {\r\n    FT_Memory  memory = stream->memory;\r\n    FT_Error   error  = CFF_Err_Ok;\r\n    FT_UShort  glyph_sid;\r\n\r\n\r\n    /* If the the offset is greater than 2, we have to parse the */\r\n    /* charset table.                                            */\r\n    if ( offset > 2 )\r\n    {\r\n      FT_UInt  j;\r\n\r\n\r\n      charset->offset = base_offset + offset;\r\n\r\n      /* Get the format of the table. */\r\n      if ( FT_STREAM_SEEK( charset->offset ) ||\r\n           FT_READ_BYTE( charset->format )   )\r\n        goto Exit;\r\n\r\n      /* Allocate memory for sids. */\r\n      if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )\r\n        goto Exit;\r\n\r\n      /* assign the .notdef glyph */\r\n      charset->sids[0] = 0;\r\n\r\n      switch ( charset->format )\r\n      {\r\n      case 0:\r\n        if ( num_glyphs > 0 )\r\n        {\r\n          if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )\r\n            goto Exit;\r\n\r\n          for ( j = 1; j < num_glyphs; j++ )\r\n            charset->sids[j] = FT_GET_USHORT();\r\n\r\n          FT_FRAME_EXIT();\r\n        }\r\n        break;\r\n\r\n      case 1:\r\n      case 2:\r\n        {\r\n          FT_UInt  nleft;\r\n          FT_UInt  i;\r\n\r\n\r\n          j = 1;\r\n\r\n          while ( j < num_glyphs )\r\n          {\r\n            /* Read the first glyph sid of the range. */\r\n            if ( FT_READ_USHORT( glyph_sid ) )\r\n              goto Exit;\r\n\r\n            /* Read the number of glyphs in the range.  */\r\n            if ( charset->format == 2 )\r\n            {\r\n              if ( FT_READ_USHORT( nleft ) )\r\n                goto Exit;\r\n            }\r\n            else\r\n            {\r\n              if ( FT_READ_BYTE( nleft ) )\r\n                goto Exit;\r\n            }\r\n\r\n            /* try to rescue some of the SIDs if `nleft' is too large */\r\n            if ( glyph_sid > 0xFFFFL - nleft )\r\n            {\r\n              FT_ERROR(( \"cff_charset_load: invalid SID range trimmed\"\r\n                         \" nleft=%d -> %d\\n\", nleft, 0xFFFFL - glyph_sid ));\r\n              nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );\r\n            }\r\n\r\n            /* Fill in the range of sids -- `nleft + 1' glyphs. */\r\n            for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )\r\n              charset->sids[j] = glyph_sid;\r\n          }\r\n        }\r\n        break;\r\n\r\n      default:\r\n        FT_ERROR(( \"cff_charset_load: invalid table format\\n\" ));\r\n        error = CFF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* Parse default tables corresponding to offset == 0, 1, or 2.  */\r\n      /* CFF specification intimates the following:                   */\r\n      /*                                                              */\r\n      /* In order to use a predefined charset, the following must be  */\r\n      /* true: The charset constructed for the glyphs in the font's   */\r\n      /* charstrings dictionary must match the predefined charset in  */\r\n      /* the first num_glyphs.                                        */\r\n\r\n      charset->offset = offset;  /* record charset type */\r\n\r\n      switch ( (FT_UInt)offset )\r\n      {\r\n      case 0:\r\n        if ( num_glyphs > 229 )\r\n        {\r\n          FT_ERROR(( \"cff_charset_load: implicit charset larger than\\n\"\r\n                     \"predefined charset (Adobe ISO-Latin)\\n\" ));\r\n          error = CFF_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        /* Allocate memory for sids. */\r\n        if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )\r\n          goto Exit;\r\n\r\n        /* Copy the predefined charset into the allocated memory. */\r\n        FT_ARRAY_COPY( charset->sids, cff_isoadobe_charset, num_glyphs );\r\n\r\n        break;\r\n\r\n      case 1:\r\n        if ( num_glyphs > 166 )\r\n        {\r\n          FT_ERROR(( \"cff_charset_load: implicit charset larger than\\n\"\r\n                     \"predefined charset (Adobe Expert)\\n\" ));\r\n          error = CFF_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        /* Allocate memory for sids. */\r\n        if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )\r\n          goto Exit;\r\n\r\n        /* Copy the predefined charset into the allocated memory.     */\r\n        FT_ARRAY_COPY( charset->sids, cff_expert_charset, num_glyphs );\r\n\r\n        break;\r\n\r\n      case 2:\r\n        if ( num_glyphs > 87 )\r\n        {\r\n          FT_ERROR(( \"cff_charset_load: implicit charset larger than\\n\"\r\n                     \"predefined charset (Adobe Expert Subset)\\n\" ));\r\n          error = CFF_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        /* Allocate memory for sids. */\r\n        if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )\r\n          goto Exit;\r\n\r\n        /* Copy the predefined charset into the allocated memory.     */\r\n        FT_ARRAY_COPY( charset->sids, cff_expertsubset_charset, num_glyphs );\r\n\r\n        break;\r\n\r\n      default:\r\n        error = CFF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    /* we have to invert the `sids' array for subsetted CID-keyed fonts */\r\n    if ( invert )\r\n      error = cff_charset_compute_cids( charset, num_glyphs, memory );\r\n\r\n  Exit:\r\n    /* Clean up if there was an error. */\r\n    if ( error )\r\n    {\r\n      FT_FREE( charset->sids );\r\n      FT_FREE( charset->cids );\r\n      charset->format = 0;\r\n      charset->offset = 0;\r\n      charset->sids   = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  cff_encoding_done( CFF_Encoding  encoding )\r\n  {\r\n    encoding->format = 0;\r\n    encoding->offset = 0;\r\n    encoding->count  = 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_encoding_load( CFF_Encoding  encoding,\r\n                     CFF_Charset   charset,\r\n                     FT_UInt       num_glyphs,\r\n                     FT_Stream     stream,\r\n                     FT_ULong      base_offset,\r\n                     FT_ULong      offset )\r\n  {\r\n    FT_Error   error = CFF_Err_Ok;\r\n    FT_UInt    count;\r\n    FT_UInt    j;\r\n    FT_UShort  glyph_sid;\r\n    FT_UInt    glyph_code;\r\n\r\n\r\n    /* Check for charset->sids.  If we do not have this, we fail. */\r\n    if ( !charset->sids )\r\n    {\r\n      error = CFF_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Zero out the code to gid/sid mappings. */\r\n    for ( j = 0; j < 256; j++ )\r\n    {\r\n      encoding->sids [j] = 0;\r\n      encoding->codes[j] = 0;\r\n    }\r\n\r\n    /* Note: The encoding table in a CFF font is indexed by glyph index;  */\r\n    /* the first encoded glyph index is 1.  Hence, we read the character  */\r\n    /* code (`glyph_code') at index j and make the assignment:            */\r\n    /*                                                                    */\r\n    /*    encoding->codes[glyph_code] = j + 1                             */\r\n    /*                                                                    */\r\n    /* We also make the assignment:                                       */\r\n    /*                                                                    */\r\n    /*    encoding->sids[glyph_code] = charset->sids[j + 1]               */\r\n    /*                                                                    */\r\n    /* This gives us both a code to GID and a code to SID mapping.        */\r\n\r\n    if ( offset > 1 )\r\n    {\r\n      encoding->offset = base_offset + offset;\r\n\r\n      /* we need to parse the table to determine its size */\r\n      if ( FT_STREAM_SEEK( encoding->offset ) ||\r\n           FT_READ_BYTE( encoding->format )   ||\r\n           FT_READ_BYTE( count )              )\r\n        goto Exit;\r\n\r\n      switch ( encoding->format & 0x7F )\r\n      {\r\n      case 0:\r\n        {\r\n          FT_Byte*  p;\r\n\r\n\r\n          /* By convention, GID 0 is always \".notdef\" and is never */\r\n          /* coded in the font.  Hence, the number of codes found  */\r\n          /* in the table is `count+1'.                            */\r\n          /*                                                       */\r\n          encoding->count = count + 1;\r\n\r\n          if ( FT_FRAME_ENTER( count ) )\r\n            goto Exit;\r\n\r\n          p = (FT_Byte*)stream->cursor;\r\n\r\n          for ( j = 1; j <= count; j++ )\r\n          {\r\n            glyph_code = *p++;\r\n\r\n            /* Make sure j is not too big. */\r\n            if ( j < num_glyphs )\r\n            {\r\n              /* Assign code to GID mapping. */\r\n              encoding->codes[glyph_code] = (FT_UShort)j;\r\n\r\n              /* Assign code to SID mapping. */\r\n              encoding->sids[glyph_code] = charset->sids[j];\r\n            }\r\n          }\r\n\r\n          FT_FRAME_EXIT();\r\n        }\r\n        break;\r\n\r\n      case 1:\r\n        {\r\n          FT_UInt  nleft;\r\n          FT_UInt  i = 1;\r\n          FT_UInt  k;\r\n\r\n\r\n          encoding->count = 0;\r\n\r\n          /* Parse the Format1 ranges. */\r\n          for ( j = 0;  j < count; j++, i += nleft )\r\n          {\r\n            /* Read the first glyph code of the range. */\r\n            if ( FT_READ_BYTE( glyph_code ) )\r\n              goto Exit;\r\n\r\n            /* Read the number of codes in the range. */\r\n            if ( FT_READ_BYTE( nleft ) )\r\n              goto Exit;\r\n\r\n            /* Increment nleft, so we read `nleft + 1' codes/sids. */\r\n            nleft++;\r\n\r\n            /* compute max number of character codes */\r\n            if ( (FT_UInt)nleft > encoding->count )\r\n              encoding->count = nleft;\r\n\r\n            /* Fill in the range of codes/sids. */\r\n            for ( k = i; k < nleft + i; k++, glyph_code++ )\r\n            {\r\n              /* Make sure k is not too big. */\r\n              if ( k < num_glyphs && glyph_code < 256 )\r\n              {\r\n                /* Assign code to GID mapping. */\r\n                encoding->codes[glyph_code] = (FT_UShort)k;\r\n\r\n                /* Assign code to SID mapping. */\r\n                encoding->sids[glyph_code] = charset->sids[k];\r\n              }\r\n            }\r\n          }\r\n\r\n          /* simple check; one never knows what can be found in a font */\r\n          if ( encoding->count > 256 )\r\n            encoding->count = 256;\r\n        }\r\n        break;\r\n\r\n      default:\r\n        FT_ERROR(( \"cff_encoding_load: invalid table format\\n\" ));\r\n        error = CFF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      /* Parse supplemental encodings, if any. */\r\n      if ( encoding->format & 0x80 )\r\n      {\r\n        FT_UInt  gindex;\r\n\r\n\r\n        /* count supplements */\r\n        if ( FT_READ_BYTE( count ) )\r\n          goto Exit;\r\n\r\n        for ( j = 0; j < count; j++ )\r\n        {\r\n          /* Read supplemental glyph code. */\r\n          if ( FT_READ_BYTE( glyph_code ) )\r\n            goto Exit;\r\n\r\n          /* Read the SID associated with this glyph code. */\r\n          if ( FT_READ_USHORT( glyph_sid ) )\r\n            goto Exit;\r\n\r\n          /* Assign code to SID mapping. */\r\n          encoding->sids[glyph_code] = glyph_sid;\r\n\r\n          /* First, look up GID which has been assigned to */\r\n          /* SID glyph_sid.                                */\r\n          for ( gindex = 0; gindex < num_glyphs; gindex++ )\r\n          {\r\n            if ( charset->sids[gindex] == glyph_sid )\r\n            {\r\n              encoding->codes[glyph_code] = (FT_UShort)gindex;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* We take into account the fact a CFF font can use a predefined */\r\n      /* encoding without containing all of the glyphs encoded by this */\r\n      /* encoding (see the note at the end of section 12 in the CFF    */\r\n      /* specification).                                               */\r\n\r\n      switch ( (FT_UInt)offset )\r\n      {\r\n      case 0:\r\n        /* First, copy the code to SID mapping. */\r\n        FT_ARRAY_COPY( encoding->sids, cff_standard_encoding, 256 );\r\n        goto Populate;\r\n\r\n      case 1:\r\n        /* First, copy the code to SID mapping. */\r\n        FT_ARRAY_COPY( encoding->sids, cff_expert_encoding, 256 );\r\n\r\n      Populate:\r\n        /* Construct code to GID mapping from code to SID mapping */\r\n        /* and charset.                                           */\r\n\r\n        encoding->count = 0;\r\n\r\n        error = cff_charset_compute_cids( charset, num_glyphs,\r\n                                          stream->memory );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        for ( j = 0; j < 256; j++ )\r\n        {\r\n          FT_UInt  sid = encoding->sids[j];\r\n          FT_UInt  gid = 0;\r\n\r\n\r\n          if ( sid )\r\n            gid = cff_charset_cid_to_gindex( charset, sid );\r\n\r\n          if ( gid != 0 )\r\n          {\r\n            encoding->codes[j] = (FT_UShort)gid;\r\n            encoding->count    = j + 1;\r\n          }\r\n          else\r\n          {\r\n            encoding->codes[j] = 0;\r\n            encoding->sids [j] = 0;\r\n          }\r\n        }\r\n        break;\r\n\r\n      default:\r\n        FT_ERROR(( \"cff_encoding_load: invalid table format\\n\" ));\r\n        error = CFF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n\r\n    /* Clean up if there was an error. */\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_subfont_load( CFF_SubFont  font,\r\n                    CFF_Index    idx,\r\n                    FT_UInt      font_index,\r\n                    FT_Stream    stream,\r\n                    FT_ULong     base_offset,\r\n                    FT_Library   library )\r\n  {\r\n    FT_Error         error;\r\n    CFF_ParserRec    parser;\r\n    FT_Byte*         dict = NULL;\r\n    FT_ULong         dict_len;\r\n    CFF_FontRecDict  top  = &font->font_dict;\r\n    CFF_Private      priv = &font->private_dict;\r\n\r\n\r\n    cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library );\r\n\r\n    /* set defaults */\r\n    FT_MEM_ZERO( top, sizeof ( *top ) );\r\n\r\n    top->underline_position  = -100L << 16;\r\n    top->underline_thickness = 50L << 16;\r\n    top->charstring_type     = 2;\r\n    top->font_matrix.xx      = 0x10000L;\r\n    top->font_matrix.yy      = 0x10000L;\r\n    top->cid_count           = 8720;\r\n\r\n    /* we use the implementation specific SID value 0xFFFF to indicate */\r\n    /* missing entries                                                 */\r\n    top->version             = 0xFFFFU;\r\n    top->notice              = 0xFFFFU;\r\n    top->copyright           = 0xFFFFU;\r\n    top->full_name           = 0xFFFFU;\r\n    top->family_name         = 0xFFFFU;\r\n    top->weight              = 0xFFFFU;\r\n    top->embedded_postscript = 0xFFFFU;\r\n\r\n    top->cid_registry        = 0xFFFFU;\r\n    top->cid_ordering        = 0xFFFFU;\r\n    top->cid_font_name       = 0xFFFFU;\r\n\r\n    error = cff_index_access_element( idx, font_index, &dict, &dict_len );\r\n    if ( !error )\r\n    {\r\n      FT_TRACE4(( \" top dictionary:\\n\" ));\r\n      error = cff_parser_run( &parser, dict, dict + dict_len );\r\n    }\r\n\r\n    cff_index_forget_element( idx, &dict );\r\n\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* if it is a CID font, we stop there */\r\n    if ( top->cid_registry != 0xFFFFU )\r\n      goto Exit;\r\n\r\n    /* parse the private dictionary, if any */\r\n    if ( top->private_offset && top->private_size )\r\n    {\r\n      /* set defaults */\r\n      FT_MEM_ZERO( priv, sizeof ( *priv ) );\r\n\r\n      priv->blue_shift       = 7;\r\n      priv->blue_fuzz        = 1;\r\n      priv->lenIV            = -1;\r\n      priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );\r\n      priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );\r\n\r\n      cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library );\r\n\r\n      if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||\r\n           FT_FRAME_ENTER( font->font_dict.private_size )                 )\r\n        goto Exit;\r\n\r\n      FT_TRACE4(( \" private dictionary:\\n\" ));\r\n      error = cff_parser_run( &parser,\r\n                              (FT_Byte*)stream->cursor,\r\n                              (FT_Byte*)stream->limit );\r\n      FT_FRAME_EXIT();\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* ensure that `num_blue_values' is even */\r\n      priv->num_blue_values &= ~1;\r\n    }\r\n\r\n    /* read the local subrs, if any */\r\n    if ( priv->local_subrs_offset )\r\n    {\r\n      if ( FT_STREAM_SEEK( base_offset + top->private_offset +\r\n                           priv->local_subrs_offset ) )\r\n        goto Exit;\r\n\r\n      error = cff_index_init( &font->local_subrs_index, stream, 1 );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      error = cff_index_get_pointers( &font->local_subrs_index,\r\n                                      &font->local_subrs, NULL );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  cff_subfont_done( FT_Memory    memory,\r\n                    CFF_SubFont  subfont )\r\n  {\r\n    if ( subfont )\r\n    {\r\n      cff_index_done( &subfont->local_subrs_index );\r\n      FT_FREE( subfont->local_subrs );\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_font_load( FT_Library library,\r\n                 FT_Stream  stream,\r\n                 FT_Int     face_index,\r\n                 CFF_Font   font,\r\n                 FT_Bool    pure_cff )\r\n  {\r\n    static const FT_Frame_Field  cff_header_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  CFF_FontRec\r\n\r\n      FT_FRAME_START( 4 ),\r\n        FT_FRAME_BYTE( version_major ),\r\n        FT_FRAME_BYTE( version_minor ),\r\n        FT_FRAME_BYTE( header_size ),\r\n        FT_FRAME_BYTE( absolute_offsize ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    FT_Error         error;\r\n    FT_Memory        memory = stream->memory;\r\n    FT_ULong         base_offset;\r\n    CFF_FontRecDict  dict;\r\n    CFF_IndexRec     string_index;\r\n    FT_Int           subfont_index;\r\n\r\n\r\n    FT_ZERO( font );\r\n    FT_ZERO( &string_index );\r\n\r\n    font->stream = stream;\r\n    font->memory = memory;\r\n    dict         = &font->top_font.font_dict;\r\n    base_offset  = FT_STREAM_POS();\r\n\r\n    /* read CFF font header */\r\n    if ( FT_STREAM_READ_FIELDS( cff_header_fields, font ) )\r\n      goto Exit;\r\n\r\n    /* check format */\r\n    if ( font->version_major   != 1 ||\r\n         font->header_size      < 4 ||\r\n         font->absolute_offsize > 4 )\r\n    {\r\n      FT_TRACE2(( \"  not a CFF font header\\n\" ));\r\n      error = CFF_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* skip the rest of the header */\r\n    if ( FT_STREAM_SKIP( font->header_size - 4 ) )\r\n      goto Exit;\r\n\r\n    /* read the name, top dict, string and global subrs index */\r\n    if ( FT_SET_ERROR( cff_index_init( &font->name_index,\r\n                                       stream, 0 ) )                  ||\r\n         FT_SET_ERROR( cff_index_init( &font->font_dict_index,\r\n                                       stream, 0 ) )                  ||\r\n         FT_SET_ERROR( cff_index_init( &string_index,\r\n                                       stream, 1 ) )                  ||\r\n         FT_SET_ERROR( cff_index_init( &font->global_subrs_index,\r\n                                       stream, 1 ) )                  ||\r\n         FT_SET_ERROR( cff_index_get_pointers( &string_index,\r\n                                               &font->strings,\r\n                                               &font->string_pool ) ) )\r\n      goto Exit;\r\n\r\n    font->num_strings = string_index.count;\r\n\r\n    if ( pure_cff )\r\n    {\r\n      /* well, we don't really forget the `disabled' fonts... */\r\n      subfont_index = face_index;\r\n\r\n      if ( subfont_index >= (FT_Int)font->name_index.count )\r\n      {\r\n        FT_ERROR(( \"cff_font_load:\"\r\n                   \" invalid subfont index for pure CFF font (%d)\\n\",\r\n                   subfont_index ));\r\n        error = CFF_Err_Invalid_Argument;\r\n        goto Exit;\r\n      }\r\n\r\n      font->num_faces = font->name_index.count;\r\n    }\r\n    else\r\n    {\r\n      subfont_index = 0;\r\n\r\n      if ( font->name_index.count > 1 )\r\n      {\r\n        FT_ERROR(( \"cff_font_load:\"\r\n                   \" invalid CFF font with multiple subfonts\\n\"\r\n                   \"              \"\r\n                   \" in SFNT wrapper\\n\" ));\r\n        error = CFF_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    /* in case of a font format check, simply exit now */\r\n    if ( face_index < 0 )\r\n      goto Exit;\r\n\r\n    /* now, parse the top-level font dictionary */\r\n    FT_TRACE4(( \"parsing top-level\\n\" ));\r\n    error = cff_subfont_load( &font->top_font,\r\n                              &font->font_dict_index,\r\n                              subfont_index,\r\n                              stream,\r\n                              base_offset,\r\n                              library );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) )\r\n      goto Exit;\r\n\r\n    error = cff_index_init( &font->charstrings_index, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* now, check for a CID font */\r\n    if ( dict->cid_registry != 0xFFFFU )\r\n    {\r\n      CFF_IndexRec  fd_index;\r\n      CFF_SubFont   sub = NULL;\r\n      FT_UInt       idx;\r\n\r\n\r\n      /* this is a CID-keyed font, we must now allocate a table of */\r\n      /* sub-fonts, then load each of them separately              */\r\n      if ( FT_STREAM_SEEK( base_offset + dict->cid_fd_array_offset ) )\r\n        goto Exit;\r\n\r\n      error = cff_index_init( &fd_index, stream, 0 );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      if ( fd_index.count > CFF_MAX_CID_FONTS )\r\n      {\r\n        FT_TRACE0(( \"cff_font_load: FD array too large in CID font\\n\" ));\r\n        goto Fail_CID;\r\n      }\r\n\r\n      /* allocate & read each font dict independently */\r\n      font->num_subfonts = fd_index.count;\r\n      if ( FT_NEW_ARRAY( sub, fd_index.count ) )\r\n        goto Fail_CID;\r\n\r\n      /* set up pointer table */\r\n      for ( idx = 0; idx < fd_index.count; idx++ )\r\n        font->subfonts[idx] = sub + idx;\r\n\r\n      /* now load each subfont independently */\r\n      for ( idx = 0; idx < fd_index.count; idx++ )\r\n      {\r\n        sub = font->subfonts[idx];\r\n        FT_TRACE4(( \"parsing subfont %u\\n\", idx ));\r\n        error = cff_subfont_load( sub, &fd_index, idx,\r\n                                  stream, base_offset, library );\r\n        if ( error )\r\n          goto Fail_CID;\r\n      }\r\n\r\n      /* now load the FD Select array */\r\n      error = CFF_Load_FD_Select( &font->fd_select,\r\n                                  font->charstrings_index.count,\r\n                                  stream,\r\n                                  base_offset + dict->cid_fd_select_offset );\r\n\r\n    Fail_CID:\r\n      cff_index_done( &fd_index );\r\n\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n    else\r\n      font->num_subfonts = 0;\r\n\r\n    /* read the charstrings index now */\r\n    if ( dict->charstrings_offset == 0 )\r\n    {\r\n      FT_ERROR(( \"cff_font_load: no charstrings offset\\n\" ));\r\n      error = CFF_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    font->num_glyphs = font->charstrings_index.count;\r\n\r\n    error = cff_index_get_pointers( &font->global_subrs_index,\r\n                                    &font->global_subrs, NULL );\r\n\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* read the Charset and Encoding tables if available */\r\n    if ( font->num_glyphs > 0 )\r\n    {\r\n      FT_Bool  invert = FT_BOOL( dict->cid_registry != 0xFFFFU && pure_cff );\r\n\r\n\r\n      error = cff_charset_load( &font->charset, font->num_glyphs, stream,\r\n                                base_offset, dict->charset_offset, invert );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* CID-keyed CFFs don't have an encoding */\r\n      if ( dict->cid_registry == 0xFFFFU )\r\n      {\r\n        error = cff_encoding_load( &font->encoding,\r\n                                   &font->charset,\r\n                                   font->num_glyphs,\r\n                                   stream,\r\n                                   base_offset,\r\n                                   dict->encoding_offset );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n    }\r\n\r\n    /* get the font name (/CIDFontName for CID-keyed fonts, */\r\n    /* /FontName otherwise)                                 */\r\n    font->font_name = cff_index_get_name( font, subfont_index );\r\n\r\n  Exit:\r\n    cff_index_done( &string_index );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_font_done( CFF_Font  font )\r\n  {\r\n    FT_Memory  memory = font->memory;\r\n    FT_UInt    idx;\r\n\r\n\r\n    cff_index_done( &font->global_subrs_index );\r\n    cff_index_done( &font->font_dict_index );\r\n    cff_index_done( &font->name_index );\r\n    cff_index_done( &font->charstrings_index );\r\n\r\n    /* release font dictionaries, but only if working with */\r\n    /* a CID keyed CFF font                                */\r\n    if ( font->num_subfonts > 0 )\r\n    {\r\n      for ( idx = 0; idx < font->num_subfonts; idx++ )\r\n        cff_subfont_done( memory, font->subfonts[idx] );\r\n\r\n      /* the subfonts array has been allocated as a single block */\r\n      FT_FREE( font->subfonts[0] );\r\n    }\r\n\r\n    cff_encoding_done( &font->encoding );\r\n    cff_charset_done( &font->charset, font->stream );\r\n\r\n    cff_subfont_done( memory, &font->top_font );\r\n\r\n    CFF_Done_FD_Select( &font->fd_select, font->stream );\r\n\r\n    FT_FREE( font->font_info );\r\n\r\n    FT_FREE( font->font_name );\r\n    FT_FREE( font->global_subrs );\r\n    FT_FREE( font->strings );\r\n    FT_FREE( font->string_pool );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffload.h                                                              */\r\n/*                                                                         */\r\n/*    OpenType & CFF data/program tables loader (specification).           */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2007, 2008, 2010 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFLOAD_H__\r\n#define __CFFLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"cfftypes.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  FT_LOCAL( FT_UShort )\r\n  cff_get_standard_encoding( FT_UInt  charcode );\r\n\r\n\r\n  FT_LOCAL( FT_String* )\r\n  cff_index_get_string( CFF_Font  font,\r\n                        FT_UInt   element );\r\n\r\n  FT_LOCAL( FT_String* )\r\n  cff_index_get_sid_string( CFF_Font  font,\r\n                            FT_UInt   sid );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_index_access_element( CFF_Index  idx,\r\n                            FT_UInt    element,\r\n                            FT_Byte**  pbytes,\r\n                            FT_ULong*  pbyte_len );\r\n\r\n  FT_LOCAL( void )\r\n  cff_index_forget_element( CFF_Index  idx,\r\n                            FT_Byte**  pbytes );\r\n\r\n  FT_LOCAL( FT_String* )\r\n  cff_index_get_name( CFF_Font  font,\r\n                      FT_UInt   element );\r\n\r\n\r\n  FT_LOCAL( FT_UInt )\r\n  cff_charset_cid_to_gindex( CFF_Charset  charset,\r\n                             FT_UInt      cid );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_font_load( FT_Library library,\r\n                 FT_Stream  stream,\r\n                 FT_Int     face_index,\r\n                 CFF_Font   font,\r\n                 FT_Bool    pure_cff );\r\n\r\n  FT_LOCAL( void )\r\n  cff_font_done( CFF_Font  font );\r\n\r\n\r\n  FT_LOCAL( FT_Byte )\r\n  cff_fd_select_get( CFF_FDSelect  fdselect,\r\n                     FT_UInt       glyph_index );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffobjs.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType objects manager (body).                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_ERRORS_H\r\n#include FT_TRUETYPE_IDS_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include \"cffobjs.h\"\r\n#include \"cffload.h\"\r\n#include \"cffcmap.h\"\r\n#include \"cfferrs.h\"\r\n#include \"cffpic.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cffobjs\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            SIZE FUNCTIONS                             */\r\n  /*                                                                       */\r\n  /*  Note that we store the global hints in the size's `internal' root    */\r\n  /*  field.                                                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static PSH_Globals_Funcs\r\n  cff_size_get_globals_funcs( CFF_Size  size )\r\n  {\r\n    CFF_Face          face     = (CFF_Face)size->root.face;\r\n    CFF_Font          font     = (CFF_Font)face->extra.data;\r\n    PSHinter_Service  pshinter = font->pshinter;\r\n    FT_Module         module;\r\n\r\n\r\n    module = FT_Get_Module( size->root.face->driver->root.library,\r\n                            \"pshinter\" );\r\n    return ( module && pshinter && pshinter->get_globals_funcs )\r\n           ? pshinter->get_globals_funcs( module )\r\n           : 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_size_done( FT_Size  cffsize )        /* CFF_Size */\r\n  {\r\n    CFF_Size      size     = (CFF_Size)cffsize;\r\n    CFF_Face      face     = (CFF_Face)size->root.face;\r\n    CFF_Font      font     = (CFF_Font)face->extra.data;\r\n    CFF_Internal  internal = (CFF_Internal)cffsize->internal;\r\n\r\n\r\n    if ( internal )\r\n    {\r\n      PSH_Globals_Funcs  funcs;\r\n\r\n\r\n      funcs = cff_size_get_globals_funcs( size );\r\n      if ( funcs )\r\n      {\r\n        FT_UInt  i;\r\n\r\n\r\n        funcs->destroy( internal->topfont );\r\n\r\n        for ( i = font->num_subfonts; i > 0; i-- )\r\n          funcs->destroy( internal->subfonts[i - 1] );\r\n      }\r\n\r\n      /* `internal' is freed by destroy_size (in ftobjs.c) */\r\n    }\r\n  }\r\n\r\n\r\n  /* CFF and Type 1 private dictionaries have slightly different      */\r\n  /* structures; we need to synthesize a Type 1 dictionary on the fly */\r\n\r\n  static void\r\n  cff_make_private_dict( CFF_SubFont  subfont,\r\n                         PS_Private   priv )\r\n  {\r\n    CFF_Private  cpriv = &subfont->private_dict;\r\n    FT_UInt      n, count;\r\n\r\n\r\n    FT_MEM_ZERO( priv, sizeof ( *priv ) );\r\n\r\n    count = priv->num_blue_values = cpriv->num_blue_values;\r\n    for ( n = 0; n < count; n++ )\r\n      priv->blue_values[n] = (FT_Short)cpriv->blue_values[n];\r\n\r\n    count = priv->num_other_blues = cpriv->num_other_blues;\r\n    for ( n = 0; n < count; n++ )\r\n      priv->other_blues[n] = (FT_Short)cpriv->other_blues[n];\r\n\r\n    count = priv->num_family_blues = cpriv->num_family_blues;\r\n    for ( n = 0; n < count; n++ )\r\n      priv->family_blues[n] = (FT_Short)cpriv->family_blues[n];\r\n\r\n    count = priv->num_family_other_blues = cpriv->num_family_other_blues;\r\n    for ( n = 0; n < count; n++ )\r\n      priv->family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];\r\n\r\n    priv->blue_scale = cpriv->blue_scale;\r\n    priv->blue_shift = (FT_Int)cpriv->blue_shift;\r\n    priv->blue_fuzz  = (FT_Int)cpriv->blue_fuzz;\r\n\r\n    priv->standard_width[0]  = (FT_UShort)cpriv->standard_width;\r\n    priv->standard_height[0] = (FT_UShort)cpriv->standard_height;\r\n\r\n    count = priv->num_snap_widths = cpriv->num_snap_widths;\r\n    for ( n = 0; n < count; n++ )\r\n      priv->snap_widths[n] = (FT_Short)cpriv->snap_widths[n];\r\n\r\n    count = priv->num_snap_heights = cpriv->num_snap_heights;\r\n    for ( n = 0; n < count; n++ )\r\n      priv->snap_heights[n] = (FT_Short)cpriv->snap_heights[n];\r\n\r\n    priv->force_bold     = cpriv->force_bold;\r\n    priv->language_group = cpriv->language_group;\r\n    priv->lenIV          = cpriv->lenIV;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_size_init( FT_Size  cffsize )         /* CFF_Size */\r\n  {\r\n    CFF_Size           size  = (CFF_Size)cffsize;\r\n    FT_Error           error = CFF_Err_Ok;\r\n    PSH_Globals_Funcs  funcs = cff_size_get_globals_funcs( size );\r\n\r\n\r\n    if ( funcs )\r\n    {\r\n      CFF_Face      face     = (CFF_Face)cffsize->face;\r\n      CFF_Font      font     = (CFF_Font)face->extra.data;\r\n      CFF_Internal  internal = NULL;\r\n\r\n      PS_PrivateRec  priv;\r\n      FT_Memory      memory = cffsize->face->memory;\r\n\r\n      FT_UInt  i;\r\n\r\n\r\n      if ( FT_NEW( internal ) )\r\n        goto Exit;\r\n\r\n      cff_make_private_dict( &font->top_font, &priv );\r\n      error = funcs->create( cffsize->face->memory, &priv,\r\n                             &internal->topfont );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      for ( i = font->num_subfonts; i > 0; i-- )\r\n      {\r\n        CFF_SubFont  sub = font->subfonts[i - 1];\r\n\r\n\r\n        cff_make_private_dict( sub, &priv );\r\n        error = funcs->create( cffsize->face->memory, &priv,\r\n                               &internal->subfonts[i - 1] );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n\r\n      cffsize->internal = (FT_Size_Internal)(void*)internal;\r\n    }\r\n\r\n    size->strike_index = 0xFFFFFFFFUL;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_size_select( FT_Size   size,\r\n                   FT_ULong  strike_index )\r\n  {\r\n    CFF_Size           cffsize = (CFF_Size)size;\r\n    PSH_Globals_Funcs  funcs;\r\n\r\n\r\n    cffsize->strike_index = strike_index;\r\n\r\n    FT_Select_Metrics( size->face, strike_index );\r\n\r\n    funcs = cff_size_get_globals_funcs( cffsize );\r\n\r\n    if ( funcs )\r\n    {\r\n      CFF_Face      face     = (CFF_Face)size->face;\r\n      CFF_Font      font     = (CFF_Font)face->extra.data;\r\n      CFF_Internal  internal = (CFF_Internal)size->internal;\r\n\r\n      FT_ULong  top_upm  = font->top_font.font_dict.units_per_em;\r\n      FT_UInt   i;\r\n\r\n\r\n      funcs->set_scale( internal->topfont,\r\n                        size->metrics.x_scale, size->metrics.y_scale,\r\n                        0, 0 );\r\n\r\n      for ( i = font->num_subfonts; i > 0; i-- )\r\n      {\r\n        CFF_SubFont  sub     = font->subfonts[i - 1];\r\n        FT_ULong     sub_upm = sub->font_dict.units_per_em;\r\n        FT_Pos       x_scale, y_scale;\r\n\r\n\r\n        if ( top_upm != sub_upm )\r\n        {\r\n          x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );\r\n          y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );\r\n        }\r\n        else\r\n        {\r\n          x_scale = size->metrics.x_scale;\r\n          y_scale = size->metrics.y_scale;\r\n        }\r\n\r\n        funcs->set_scale( internal->subfonts[i - 1],\r\n                          x_scale, y_scale, 0, 0 );\r\n      }\r\n    }\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_size_request( FT_Size          size,\r\n                    FT_Size_Request  req )\r\n  {\r\n    CFF_Size           cffsize = (CFF_Size)size;\r\n    PSH_Globals_Funcs  funcs;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n    if ( FT_HAS_FIXED_SIZES( size->face ) )\r\n    {\r\n      CFF_Face      cffface = (CFF_Face)size->face;\r\n      SFNT_Service  sfnt    = (SFNT_Service)cffface->sfnt;\r\n      FT_ULong      strike_index;\r\n\r\n\r\n      if ( sfnt->set_sbit_strike( cffface, req, &strike_index ) )\r\n        cffsize->strike_index = 0xFFFFFFFFUL;\r\n      else\r\n        return cff_size_select( size, strike_index );\r\n    }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n    FT_Request_Metrics( size->face, req );\r\n\r\n    funcs = cff_size_get_globals_funcs( cffsize );\r\n\r\n    if ( funcs )\r\n    {\r\n      CFF_Face      cffface  = (CFF_Face)size->face;\r\n      CFF_Font      font     = (CFF_Font)cffface->extra.data;\r\n      CFF_Internal  internal = (CFF_Internal)size->internal;\r\n\r\n      FT_ULong  top_upm  = font->top_font.font_dict.units_per_em;\r\n      FT_UInt   i;\r\n\r\n\r\n      funcs->set_scale( internal->topfont,\r\n                        size->metrics.x_scale, size->metrics.y_scale,\r\n                        0, 0 );\r\n\r\n      for ( i = font->num_subfonts; i > 0; i-- )\r\n      {\r\n        CFF_SubFont  sub     = font->subfonts[i - 1];\r\n        FT_ULong     sub_upm = sub->font_dict.units_per_em;\r\n        FT_Pos       x_scale, y_scale;\r\n\r\n\r\n        if ( top_upm != sub_upm )\r\n        {\r\n          x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );\r\n          y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );\r\n        }\r\n        else\r\n        {\r\n          x_scale = size->metrics.x_scale;\r\n          y_scale = size->metrics.y_scale;\r\n        }\r\n\r\n        funcs->set_scale( internal->subfonts[i - 1],\r\n                          x_scale, y_scale, 0, 0 );\r\n      }\r\n    }\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            SLOT  FUNCTIONS                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_slot_done( FT_GlyphSlot  slot )\r\n  {\r\n    slot->internal->glyph_hints = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_slot_init( FT_GlyphSlot  slot )\r\n  {\r\n    CFF_Face          face     = (CFF_Face)slot->face;\r\n    CFF_Font          font     = (CFF_Font)face->extra.data;\r\n    PSHinter_Service  pshinter = font->pshinter;\r\n\r\n\r\n    if ( pshinter )\r\n    {\r\n      FT_Module  module;\r\n\r\n\r\n      module = FT_Get_Module( slot->face->driver->root.library,\r\n                              \"pshinter\" );\r\n      if ( module )\r\n      {\r\n        T2_Hints_Funcs  funcs;\r\n\r\n\r\n        funcs = pshinter->get_t2_funcs( module );\r\n        slot->internal->glyph_hints = (void*)funcs;\r\n      }\r\n    }\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                           FACE  FUNCTIONS                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  static FT_String*\r\n  cff_strcpy( FT_Memory         memory,\r\n              const FT_String*  source )\r\n  {\r\n    FT_Error    error;\r\n    FT_String*  result;\r\n\r\n\r\n    (void)FT_STRDUP( result, source );\r\n\r\n    FT_UNUSED( error );\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* Strip all subset prefixes of the form `ABCDEF+'.  Usually, there */\r\n  /* is only one, but font names like `APCOOG+JFABTD+FuturaBQ-Bold'   */\r\n  /* have been seen in the wild.                                      */\r\n\r\n  static void\r\n  remove_subset_prefix( FT_String*  name )\r\n  {\r\n    FT_Int32  idx             = 0;\r\n    FT_Int32  length          = strlen( name ) + 1;\r\n    FT_Bool   continue_search = 1;\r\n\r\n\r\n    while ( continue_search )\r\n    {\r\n      if ( length >= 7 && name[6] == '+' )\r\n      {\r\n        for ( idx = 0; idx < 6; idx++ )\r\n        {\r\n          /* ASCII uppercase letters */\r\n          if ( !( 'A' <= name[idx] && name[idx] <= 'Z' ) )\r\n            continue_search = 0;\r\n        }\r\n\r\n        if ( continue_search )\r\n        {\r\n          for ( idx = 7; idx < length; idx++ )\r\n            name[idx - 7] = name[idx];\r\n          length -= 7;\r\n        }\r\n      }\r\n      else\r\n        continue_search = 0;\r\n    }\r\n  }\r\n\r\n\r\n  /* Remove the style part from the family name (if present). */\r\n\r\n  static void\r\n  remove_style( FT_String*        family_name,\r\n                const FT_String*  style_name )\r\n  {\r\n    FT_Int32  family_name_length, style_name_length;\r\n\r\n\r\n    family_name_length = strlen( family_name );\r\n    style_name_length  = strlen( style_name );\r\n\r\n    if ( family_name_length > style_name_length )\r\n    {\r\n      FT_Int  idx;\r\n\r\n\r\n      for ( idx = 1; idx <= style_name_length; ++idx )\r\n      {\r\n        if ( family_name[family_name_length - idx] !=\r\n             style_name[style_name_length - idx] )\r\n          break;\r\n      }\r\n\r\n      if ( idx > style_name_length )\r\n      {\r\n        /* family_name ends with style_name; remove it */\r\n        idx = family_name_length - style_name_length - 1;\r\n\r\n        /* also remove special characters     */\r\n        /* between real family name and style */\r\n        while ( idx > 0                     &&\r\n                ( family_name[idx] == '-' ||\r\n                  family_name[idx] == ' ' ||\r\n                  family_name[idx] == '_' ||\r\n                  family_name[idx] == '+' ) )\r\n          --idx;\r\n\r\n        if ( idx > 0 )\r\n          family_name[idx + 1] = '\\0';\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_face_init( FT_Stream      stream,\r\n                 FT_Face        cffface,        /* CFF_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    CFF_Face            face        = (CFF_Face)cffface;\r\n    FT_Error            error;\r\n    SFNT_Service        sfnt;\r\n    FT_Service_PsCMaps  psnames;\r\n    PSHinter_Service    pshinter;\r\n    FT_Bool             pure_cff    = 1;\r\n    FT_Bool             sfnt_format = 0;\r\n    FT_Library          library     = cffface->driver->root.library;\r\n\r\n\r\n    sfnt = (SFNT_Service)FT_Get_Module_Interface(\r\n             library, \"sfnt\" );\r\n    if ( !sfnt )\r\n    {\r\n      FT_ERROR(( \"cff_face_init: cannot access `sfnt' module\\n\" ));\r\n      error = CFF_Err_Missing_Module;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );\r\n\r\n    pshinter = (PSHinter_Service)FT_Get_Module_Interface(\r\n                 library, \"pshinter\" );\r\n\r\n    FT_TRACE2(( \"CFF driver\\n\" ));\r\n\r\n    /* create input stream from resource */\r\n    if ( FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    /* check whether we have a valid OpenType file */\r\n    error = sfnt->init_face( stream, face, face_index, num_params, params );\r\n    if ( !error )\r\n    {\r\n      if ( face->format_tag != TTAG_OTTO )  /* `OTTO'; OpenType/CFF font */\r\n      {\r\n        FT_TRACE2(( \"  not an OpenType/CFF font\\n\" ));\r\n        error = CFF_Err_Unknown_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      /* if we are performing a simple font format check, exit immediately */\r\n      if ( face_index < 0 )\r\n        return CFF_Err_Ok;\r\n\r\n      sfnt_format = 1;\r\n\r\n      /* now, the font can be either an OpenType/CFF font, or an SVG CEF */\r\n      /* font; in the latter case it doesn't have a `head' table         */\r\n      error = face->goto_table( face, TTAG_head, stream, 0 );\r\n      if ( !error )\r\n      {\r\n        pure_cff = 0;\r\n\r\n        /* load font directory */\r\n        error = sfnt->load_face( stream, face, face_index,\r\n                                 num_params, params );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n      else\r\n      {\r\n        /* load the `cmap' table explicitly */\r\n        error = sfnt->load_cmap( face, stream );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n\r\n      /* now load the CFF part of the file */\r\n      error = face->goto_table( face, TTAG_CFF, stream, 0 );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n    else\r\n    {\r\n      /* rewind to start of file; we are going to load a pure-CFF font */\r\n      if ( FT_STREAM_SEEK( 0 ) )\r\n        goto Exit;\r\n      error = CFF_Err_Ok;\r\n    }\r\n\r\n    /* now load and parse the CFF table in the file */\r\n    {\r\n      CFF_Font         cff = NULL;\r\n      CFF_FontRecDict  dict;\r\n      FT_Memory        memory = cffface->memory;\r\n      FT_Int32         flags;\r\n      FT_UInt          i;\r\n\r\n\r\n      if ( FT_NEW( cff ) )\r\n        goto Exit;\r\n\r\n      face->extra.data = cff;\r\n      error = cff_font_load( library, stream, face_index, cff, pure_cff );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      cff->pshinter = pshinter;\r\n      cff->psnames  = psnames;\r\n\r\n      cffface->face_index = face_index;\r\n\r\n      /* Complement the root flags with some interesting information. */\r\n      /* Note that this is only necessary for pure CFF and CEF fonts; */\r\n      /* SFNT based fonts use the `name' table instead.               */\r\n\r\n      cffface->num_glyphs = cff->num_glyphs;\r\n\r\n      dict = &cff->top_font.font_dict;\r\n\r\n      /* we need the `PSNames' module for CFF and CEF formats */\r\n      /* which aren't CID-keyed                               */\r\n      if ( dict->cid_registry == 0xFFFFU && !psnames )\r\n      {\r\n        FT_ERROR(( \"cff_face_init:\"\r\n                   \" cannot open CFF & CEF fonts\\n\"\r\n                   \"              \"\r\n                   \" without the `PSNames' module\\n\" ));\r\n        error = CFF_Err_Missing_Module;\r\n        goto Exit;\r\n      }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n      {\r\n        FT_UInt     idx;\r\n        FT_String*  s;\r\n\r\n\r\n        FT_TRACE4(( \"SIDs\\n\" ));\r\n\r\n        /* dump string index, including default strings for convenience */\r\n        for ( idx = 0; idx < cff->num_strings + 390; idx++ )\r\n        {\r\n          s = cff_index_get_sid_string( cff, idx );\r\n          if ( s )\r\n            FT_TRACE4((\"  %5d %s\\n\", idx, s ));\r\n        }\r\n      }\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n      if ( !dict->has_font_matrix )\r\n        dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;\r\n\r\n      /* Normalize the font matrix so that `matrix->xx' is 1; the */\r\n      /* scaling is done with `units_per_em' then (at this point, */\r\n      /* it already contains the scaling factor, but without      */\r\n      /* normalization of the matrix).                            */\r\n      /*                                                          */\r\n      /* Note that the offsets must be expressed in integer font  */\r\n      /* units.                                                   */\r\n\r\n      {\r\n        FT_Matrix*  matrix = &dict->font_matrix;\r\n        FT_Vector*  offset = &dict->font_offset;\r\n        FT_ULong*   upm    = &dict->units_per_em;\r\n        FT_Fixed    temp   = FT_ABS( matrix->yy );\r\n\r\n\r\n        if ( temp != 0x10000L )\r\n        {\r\n          *upm = FT_DivFix( *upm, temp );\r\n\r\n          matrix->xx = FT_DivFix( matrix->xx, temp );\r\n          matrix->yx = FT_DivFix( matrix->yx, temp );\r\n          matrix->xy = FT_DivFix( matrix->xy, temp );\r\n          matrix->yy = FT_DivFix( matrix->yy, temp );\r\n          offset->x  = FT_DivFix( offset->x,  temp );\r\n          offset->y  = FT_DivFix( offset->y,  temp );\r\n        }\r\n\r\n        offset->x >>= 16;\r\n        offset->y >>= 16;\r\n      }\r\n\r\n      for ( i = cff->num_subfonts; i > 0; i-- )\r\n      {\r\n        CFF_FontRecDict  sub = &cff->subfonts[i - 1]->font_dict;\r\n        CFF_FontRecDict  top = &cff->top_font.font_dict;\r\n\r\n        FT_Matrix*  matrix;\r\n        FT_Vector*  offset;\r\n        FT_ULong*   upm;\r\n        FT_Fixed    temp;\r\n\r\n\r\n        if ( sub->has_font_matrix )\r\n        {\r\n          FT_Long  scaling;\r\n\r\n\r\n          /* if we have a top-level matrix, */\r\n          /* concatenate the subfont matrix */\r\n\r\n          if ( top->has_font_matrix )\r\n          {\r\n            if ( top->units_per_em > 1 && sub->units_per_em > 1 )\r\n              scaling = FT_MIN( top->units_per_em, sub->units_per_em );\r\n            else\r\n              scaling = 1;\r\n\r\n            FT_Matrix_Multiply_Scaled( &top->font_matrix,\r\n                                       &sub->font_matrix,\r\n                                       scaling );\r\n            FT_Vector_Transform_Scaled( &sub->font_offset,\r\n                                        &top->font_matrix,\r\n                                        scaling );\r\n\r\n            sub->units_per_em = FT_MulDiv( sub->units_per_em,\r\n                                           top->units_per_em,\r\n                                           scaling );\r\n          }\r\n        }\r\n        else\r\n        {\r\n          sub->font_matrix = top->font_matrix;\r\n          sub->font_offset = top->font_offset;\r\n\r\n          sub->units_per_em = top->units_per_em;\r\n        }\r\n\r\n        matrix = &sub->font_matrix;\r\n        offset = &sub->font_offset;\r\n        upm    = &sub->units_per_em;\r\n        temp   = FT_ABS( matrix->yy );\r\n\r\n        if ( temp != 0x10000L )\r\n        {\r\n          *upm = FT_DivFix( *upm, temp );\r\n\r\n          matrix->xx = FT_DivFix( matrix->xx, temp );\r\n          matrix->yx = FT_DivFix( matrix->yx, temp );\r\n          matrix->xy = FT_DivFix( matrix->xy, temp );\r\n          matrix->yy = FT_DivFix( matrix->yy, temp );\r\n          offset->x  = FT_DivFix( offset->x,  temp );\r\n          offset->y  = FT_DivFix( offset->y,  temp );\r\n        }\r\n\r\n        offset->x >>= 16;\r\n        offset->y >>= 16;\r\n      }\r\n\r\n      if ( pure_cff )\r\n      {\r\n        char*  style_name = NULL;\r\n\r\n\r\n        /* set up num_faces */\r\n        cffface->num_faces = cff->num_faces;\r\n\r\n        /* compute number of glyphs */\r\n        if ( dict->cid_registry != 0xFFFFU )\r\n          cffface->num_glyphs = cff->charset.max_cid + 1;\r\n        else\r\n          cffface->num_glyphs = cff->charstrings_index.count;\r\n\r\n        /* set global bbox, as well as EM size */\r\n        cffface->bbox.xMin =   dict->font_bbox.xMin            >> 16;\r\n        cffface->bbox.yMin =   dict->font_bbox.yMin            >> 16;\r\n        /* no `U' suffix here to 0xFFFF! */\r\n        cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFF ) >> 16;\r\n        cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFF ) >> 16;\r\n\r\n        cffface->units_per_EM = (FT_UShort)( dict->units_per_em );\r\n\r\n        cffface->ascender  = (FT_Short)( cffface->bbox.yMax );\r\n        cffface->descender = (FT_Short)( cffface->bbox.yMin );\r\n\r\n        cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 );\r\n        if ( cffface->height < cffface->ascender - cffface->descender )\r\n          cffface->height = (FT_Short)( cffface->ascender - cffface->descender );\r\n\r\n        cffface->underline_position  =\r\n          (FT_Short)( dict->underline_position >> 16 );\r\n        cffface->underline_thickness =\r\n          (FT_Short)( dict->underline_thickness >> 16 );\r\n\r\n        /* retrieve font family & style name */\r\n        cffface->family_name = cff_index_get_name( cff, face_index );\r\n        if ( cffface->family_name )\r\n        {\r\n          char*  full   = cff_index_get_sid_string( cff,\r\n                                                    dict->full_name );\r\n          char*  fullp  = full;\r\n          char*  family = cffface->family_name;\r\n          char*  family_name = NULL;\r\n\r\n\r\n          remove_subset_prefix( cffface->family_name );\r\n\r\n          if ( dict->family_name )\r\n          {\r\n            family_name = cff_index_get_sid_string( cff,\r\n                                                    dict->family_name );\r\n            if ( family_name )\r\n              family = family_name;\r\n          }\r\n\r\n          /* We try to extract the style name from the full name.   */\r\n          /* We need to ignore spaces and dashes during the search. */\r\n          if ( full && family )\r\n          {\r\n            while ( *fullp )\r\n            {\r\n              /* skip common characters at the start of both strings */\r\n              if ( *fullp == *family )\r\n              {\r\n                family++;\r\n                fullp++;\r\n                continue;\r\n              }\r\n\r\n              /* ignore spaces and dashes in full name during comparison */\r\n              if ( *fullp == ' ' || *fullp == '-' )\r\n              {\r\n                fullp++;\r\n                continue;\r\n              }\r\n\r\n              /* ignore spaces and dashes in family name during comparison */\r\n              if ( *family == ' ' || *family == '-' )\r\n              {\r\n                family++;\r\n                continue;\r\n              }\r\n\r\n              if ( !*family && *fullp )\r\n              {\r\n                /* The full name begins with the same characters as the  */\r\n                /* family name, with spaces and dashes removed.  In this */\r\n                /* case, the remaining string in `fullp' will be used as */\r\n                /* the style name.                                       */\r\n                style_name = cff_strcpy( memory, fullp );\r\n\r\n                /* remove the style part from the family name (if present) */\r\n                remove_style( cffface->family_name, style_name );\r\n              }\r\n              break;\r\n            }\r\n          }\r\n        }\r\n        else\r\n        {\r\n          char  *cid_font_name =\r\n                   cff_index_get_sid_string( cff,\r\n                                             dict->cid_font_name );\r\n\r\n\r\n          /* do we have a `/FontName' for a CID-keyed font? */\r\n          if ( cid_font_name )\r\n            cffface->family_name = cff_strcpy( memory, cid_font_name );\r\n        }\r\n\r\n        if ( style_name )\r\n          cffface->style_name = style_name;\r\n        else\r\n          /* assume \"Regular\" style if we don't know better */\r\n          cffface->style_name = cff_strcpy( memory, (char *)\"Regular\" );\r\n\r\n        /*******************************************************************/\r\n        /*                                                                 */\r\n        /* Compute face flags.                                             */\r\n        /*                                                                 */\r\n        flags = FT_FACE_FLAG_SCALABLE   | /* scalable outlines */\r\n                FT_FACE_FLAG_HORIZONTAL | /* horizontal data   */\r\n                FT_FACE_FLAG_HINTER;      /* has native hinter */\r\n\r\n        if ( sfnt_format )\r\n          flags |= FT_FACE_FLAG_SFNT;\r\n\r\n        /* fixed width font? */\r\n        if ( dict->is_fixed_pitch )\r\n          flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n  /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */\r\n#if 0\r\n        /* kerning available? */\r\n        if ( face->kern_pairs )\r\n          flags |= FT_FACE_FLAG_KERNING;\r\n#endif\r\n\r\n        cffface->face_flags = flags;\r\n\r\n        /*******************************************************************/\r\n        /*                                                                 */\r\n        /* Compute style flags.                                            */\r\n        /*                                                                 */\r\n        flags = 0;\r\n\r\n        if ( dict->italic_angle )\r\n          flags |= FT_STYLE_FLAG_ITALIC;\r\n\r\n        {\r\n          char  *weight = cff_index_get_sid_string( cff,\r\n                                                    dict->weight );\r\n\r\n\r\n          if ( weight )\r\n            if ( !ft_strcmp( weight, \"Bold\"  ) ||\r\n                 !ft_strcmp( weight, \"Black\" ) )\r\n              flags |= FT_STYLE_FLAG_BOLD;\r\n        }\r\n\r\n        /* double check */\r\n        if ( !(flags & FT_STYLE_FLAG_BOLD) && cffface->style_name )\r\n          if ( !ft_strncmp( cffface->style_name, \"Bold\", 4 )  ||\r\n               !ft_strncmp( cffface->style_name, \"Black\", 5 ) )\r\n            flags |= FT_STYLE_FLAG_BOLD;\r\n\r\n        cffface->style_flags = flags;\r\n      }\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES\r\n      /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */\r\n      /* has unset this flag because of the 3.0 `post' table.          */\r\n      if ( dict->cid_registry == 0xFFFFU )\r\n        cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;\r\n#endif\r\n\r\n      if ( dict->cid_registry != 0xFFFFU && pure_cff )\r\n        cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;\r\n\r\n\r\n      /*******************************************************************/\r\n      /*                                                                 */\r\n      /* Compute char maps.                                              */\r\n      /*                                                                 */\r\n\r\n      /* Try to synthesize a Unicode charmap if there is none available */\r\n      /* already.  If an OpenType font contains a Unicode \"cmap\", we    */\r\n      /* will use it, whatever be in the CFF part of the file.          */\r\n      {\r\n        FT_CharMapRec  cmaprec;\r\n        FT_CharMap     cmap;\r\n        FT_UInt        nn;\r\n        CFF_Encoding   encoding = &cff->encoding;\r\n\r\n\r\n        for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ )\r\n        {\r\n          cmap = cffface->charmaps[nn];\r\n\r\n          /* Windows Unicode? */\r\n          if ( cmap->platform_id == TT_PLATFORM_MICROSOFT &&\r\n               cmap->encoding_id == TT_MS_ID_UNICODE_CS   )\r\n            goto Skip_Unicode;\r\n\r\n          /* Apple Unicode platform id? */\r\n          if ( cmap->platform_id == TT_PLATFORM_APPLE_UNICODE )\r\n            goto Skip_Unicode; /* Apple Unicode */\r\n        }\r\n\r\n        /* since CID-keyed fonts don't contain glyph names, we can't */\r\n        /* construct a cmap                                          */\r\n        if ( pure_cff && cff->top_font.font_dict.cid_registry != 0xFFFFU )\r\n          goto Exit;\r\n\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n        if ( nn + 1 > FT_MAX_CHARMAP_CACHEABLE )\r\n        {\r\n          FT_ERROR(( \"cff_face_init: no Unicode cmap is found, \"\r\n                     \"and too many subtables (%d) to add synthesized cmap\\n\",\r\n                     nn ));\r\n          goto Exit;\r\n        }\r\n#endif\r\n\r\n        /* we didn't find a Unicode charmap -- synthesize one */\r\n        cmaprec.face        = cffface;\r\n        cmaprec.platform_id = TT_PLATFORM_MICROSOFT;\r\n        cmaprec.encoding_id = TT_MS_ID_UNICODE_CS;\r\n        cmaprec.encoding    = FT_ENCODING_UNICODE;\r\n\r\n        nn = (FT_UInt)cffface->num_charmaps;\r\n\r\n        error = FT_CMap_New( &CFF_CMAP_UNICODE_CLASS_REC_GET, NULL,\r\n                             &cmaprec, NULL );\r\n        if ( error && FT_Err_No_Unicode_Glyph_Name != error )\r\n          goto Exit;\r\n        error = FT_Err_Ok;\r\n\r\n        /* if no Unicode charmap was previously selected, select this one */\r\n        if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )\r\n          cffface->charmap = cffface->charmaps[nn];\r\n\r\n      Skip_Unicode:\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n        if ( nn > FT_MAX_CHARMAP_CACHEABLE )\r\n        {\r\n          FT_ERROR(( \"cff_face_init: Unicode cmap is found, \"\r\n                     \"but too many preceding subtables (%d) to access\\n\",\r\n                     nn - 1 ));\r\n          goto Exit;\r\n        }\r\n#endif\r\n        if ( encoding->count > 0 )\r\n        {\r\n          FT_CMap_Class  clazz;\r\n\r\n\r\n          cmaprec.face        = cffface;\r\n          cmaprec.platform_id = TT_PLATFORM_ADOBE;  /* Adobe platform id */\r\n\r\n          if ( encoding->offset == 0 )\r\n          {\r\n            cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;\r\n            cmaprec.encoding    = FT_ENCODING_ADOBE_STANDARD;\r\n            clazz               = &CFF_CMAP_ENCODING_CLASS_REC_GET;\r\n          }\r\n          else if ( encoding->offset == 1 )\r\n          {\r\n            cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;\r\n            cmaprec.encoding    = FT_ENCODING_ADOBE_EXPERT;\r\n            clazz               = &CFF_CMAP_ENCODING_CLASS_REC_GET;\r\n          }\r\n          else\r\n          {\r\n            cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;\r\n            cmaprec.encoding    = FT_ENCODING_ADOBE_CUSTOM;\r\n            clazz               = &CFF_CMAP_ENCODING_CLASS_REC_GET;\r\n          }\r\n\r\n          error = FT_CMap_New( clazz, NULL, &cmaprec, NULL );\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_face_done( FT_Face  cffface )         /* CFF_Face */\r\n  {\r\n    CFF_Face      face = (CFF_Face)cffface;\r\n    FT_Memory     memory;\r\n    SFNT_Service  sfnt;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = cffface->memory;\r\n    sfnt   = (SFNT_Service)face->sfnt;\r\n\r\n    if ( sfnt )\r\n      sfnt->done_face( face );\r\n\r\n    {\r\n      CFF_Font  cff = (CFF_Font)face->extra.data;\r\n\r\n\r\n      if ( cff )\r\n      {\r\n        cff_font_done( cff );\r\n        FT_FREE( face->extra.data );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_driver_init( FT_Module  module )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_driver_done( FT_Module  module )\r\n  {\r\n    FT_UNUSED( module );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffobjs.h                                                              */\r\n/*                                                                         */\r\n/*    OpenType objects manager (specification).                            */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFOBJS_H__\r\n#define __CFFOBJS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"cfftypes.h\"\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CFF_Driver                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an OpenType driver object.                             */\r\n  /*                                                                       */\r\n  typedef struct CFF_DriverRec_*  CFF_Driver;\r\n\r\n  typedef TT_Face  CFF_Face;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CFF_Size                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an OpenType size object.                               */\r\n  /*                                                                       */\r\n  typedef struct  CFF_SizeRec_\r\n  {\r\n    FT_SizeRec  root;\r\n    FT_ULong    strike_index;    /* 0xFFFFFFFF to indicate invalid */\r\n\r\n  } CFF_SizeRec, *CFF_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CFF_GlyphSlot                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an OpenType glyph slot object.                         */\r\n  /*                                                                       */\r\n  typedef struct  CFF_GlyphSlotRec_\r\n  {\r\n    FT_GlyphSlotRec  root;\r\n\r\n    FT_Bool          hint;\r\n    FT_Bool          scaled;\r\n\r\n    FT_Fixed         x_scale;\r\n    FT_Fixed         y_scale;\r\n\r\n  } CFF_GlyphSlotRec, *CFF_GlyphSlot;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CFF_Internal                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The interface to the `internal' field of `FT_Size'.                */\r\n  /*                                                                       */\r\n  typedef struct  CFF_InternalRec_\r\n  {\r\n    PSH_Globals  topfont;\r\n    PSH_Globals  subfonts[CFF_MAX_CID_FONTS];\r\n\r\n  } CFF_InternalRec, *CFF_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Subglyph transformation record.                                       */\r\n  /*                                                                       */\r\n  typedef struct  CFF_Transform_\r\n  {\r\n    FT_Fixed    xx, xy;     /* transformation matrix coefficients */\r\n    FT_Fixed    yx, yy;\r\n    FT_F26Dot6  ox, oy;     /* offsets        */\r\n\r\n  } CFF_Transform;\r\n\r\n\r\n  /***********************************************************************/\r\n  /*                                                                     */\r\n  /* TrueType driver class.                                              */\r\n  /*                                                                     */\r\n  typedef struct  CFF_DriverRec_\r\n  {\r\n    FT_DriverRec  root;\r\n    void*         extension_component;\r\n\r\n  } CFF_DriverRec;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_size_init( FT_Size  size );           /* CFF_Size */\r\n\r\n  FT_LOCAL( void )\r\n  cff_size_done( FT_Size  size );           /* CFF_Size */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_size_request( FT_Size          size,\r\n                    FT_Size_Request  req );\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_size_select( FT_Size   size,\r\n                   FT_ULong  strike_index );\r\n\r\n#endif\r\n\r\n  FT_LOCAL( void )\r\n  cff_slot_done( FT_GlyphSlot  slot );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_slot_init( FT_GlyphSlot  slot );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Face functions                                                        */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  cff_face_init( FT_Stream      stream,\r\n                 FT_Face        face,           /* CFF_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params );\r\n\r\n  FT_LOCAL( void )\r\n  cff_face_done( FT_Face  face );               /* CFF_Face */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Driver functions                                                      */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  cff_driver_init( FT_Module  module );\r\n\r\n  FT_LOCAL( void )\r\n  cff_driver_done( FT_Module  module );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFOBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffparse.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffparse.c                                                             */\r\n/*                                                                         */\r\n/*    CFF token stream parser (body)                                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2007-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"cffparse.h\"\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"cfferrs.h\"\r\n#include \"cffpic.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cffparse\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cff_parser_init( CFF_Parser  parser,\r\n                   FT_UInt     code,\r\n                   void*       object,\r\n                   FT_Library  library)\r\n  {\r\n    FT_MEM_ZERO( parser, sizeof ( *parser ) );\r\n\r\n    parser->top         = parser->stack;\r\n    parser->object_code = code;\r\n    parser->object      = object;\r\n    parser->library     = library;\r\n  }\r\n\r\n\r\n  /* read an integer */\r\n  static FT_Long\r\n  cff_parse_integer( FT_Byte*  start,\r\n                     FT_Byte*  limit )\r\n  {\r\n    FT_Byte*  p   = start;\r\n    FT_Int    v   = *p++;\r\n    FT_Long   val = 0;\r\n\r\n\r\n    if ( v == 28 )\r\n    {\r\n      if ( p + 2 > limit )\r\n        goto Bad;\r\n\r\n      val = (FT_Short)( ( (FT_Int)p[0] << 8 ) | p[1] );\r\n      p  += 2;\r\n    }\r\n    else if ( v == 29 )\r\n    {\r\n      if ( p + 4 > limit )\r\n        goto Bad;\r\n\r\n      val = ( (FT_Long)p[0] << 24 ) |\r\n            ( (FT_Long)p[1] << 16 ) |\r\n            ( (FT_Long)p[2] <<  8 ) |\r\n                       p[3];\r\n      p += 4;\r\n    }\r\n    else if ( v < 247 )\r\n    {\r\n      val = v - 139;\r\n    }\r\n    else if ( v < 251 )\r\n    {\r\n      if ( p + 1 > limit )\r\n        goto Bad;\r\n\r\n      val = ( v - 247 ) * 256 + p[0] + 108;\r\n      p++;\r\n    }\r\n    else\r\n    {\r\n      if ( p + 1 > limit )\r\n        goto Bad;\r\n\r\n      val = -( v - 251 ) * 256 - p[0] - 108;\r\n      p++;\r\n    }\r\n\r\n  Exit:\r\n    return val;\r\n\r\n  Bad:\r\n    val = 0;\r\n    FT_TRACE4(( \"!!!END OF DATA:!!!\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  static const FT_Long power_tens[] =\r\n  {\r\n    1L,\r\n    10L,\r\n    100L,\r\n    1000L,\r\n    10000L,\r\n    100000L,\r\n    1000000L,\r\n    10000000L,\r\n    100000000L,\r\n    1000000000L\r\n  };\r\n\r\n\r\n  /* read a real */\r\n  static FT_Fixed\r\n  cff_parse_real( FT_Byte*  start,\r\n                  FT_Byte*  limit,\r\n                  FT_Long   power_ten,\r\n                  FT_Long*  scaling )\r\n  {\r\n    FT_Byte*  p = start;\r\n    FT_UInt   nib;\r\n    FT_UInt   phase;\r\n\r\n    FT_Long   result, number, exponent;\r\n    FT_Int    sign = 0, exponent_sign = 0, have_overflow = 0;\r\n    FT_Long   exponent_add, integer_length, fraction_length;\r\n\r\n\r\n    if ( scaling )\r\n      *scaling = 0;\r\n\r\n    result = 0;\r\n\r\n    number   = 0;\r\n    exponent = 0;\r\n\r\n    exponent_add    = 0;\r\n    integer_length  = 0;\r\n    fraction_length = 0;\r\n\r\n    /* First of all, read the integer part. */\r\n    phase = 4;\r\n\r\n    for (;;)\r\n    {\r\n      /* If we entered this iteration with phase == 4, we need to */\r\n      /* read a new byte.  This also skips past the initial 0x1E. */\r\n      if ( phase )\r\n      {\r\n        p++;\r\n\r\n        /* Make sure we don't read past the end. */\r\n        if ( p >= limit )\r\n          goto Bad;\r\n      }\r\n\r\n      /* Get the nibble. */\r\n      nib   = ( p[0] >> phase ) & 0xF;\r\n      phase = 4 - phase;\r\n\r\n      if ( nib == 0xE )\r\n        sign = 1;\r\n      else if ( nib > 9 )\r\n        break;\r\n      else\r\n      {\r\n        /* Increase exponent if we can't add the digit. */\r\n        if ( number >= 0xCCCCCCCL )\r\n          exponent_add++;\r\n        /* Skip leading zeros. */\r\n        else if ( nib || number )\r\n        {\r\n          integer_length++;\r\n          number = number * 10 + nib;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* Read fraction part, if any. */\r\n    if ( nib == 0xa )\r\n      for (;;)\r\n      {\r\n        /* If we entered this iteration with phase == 4, we need */\r\n        /* to read a new byte.                                   */\r\n        if ( phase )\r\n        {\r\n          p++;\r\n\r\n          /* Make sure we don't read past the end. */\r\n          if ( p >= limit )\r\n            goto Bad;\r\n        }\r\n\r\n        /* Get the nibble. */\r\n        nib   = ( p[0] >> phase ) & 0xF;\r\n        phase = 4 - phase;\r\n        if ( nib >= 10 )\r\n          break;\r\n\r\n        /* Skip leading zeros if possible. */\r\n        if ( !nib && !number )\r\n          exponent_add--;\r\n        /* Only add digit if we don't overflow. */\r\n        else if ( number < 0xCCCCCCCL && fraction_length < 9 )\r\n        {\r\n          fraction_length++;\r\n          number = number * 10 + nib;\r\n        }\r\n      }\r\n\r\n    /* Read exponent, if any. */\r\n    if ( nib == 12 )\r\n    {\r\n      exponent_sign = 1;\r\n      nib           = 11;\r\n    }\r\n\r\n    if ( nib == 11 )\r\n    {\r\n      for (;;)\r\n      {\r\n        /* If we entered this iteration with phase == 4, */\r\n        /* we need to read a new byte.                   */\r\n        if ( phase )\r\n        {\r\n          p++;\r\n\r\n          /* Make sure we don't read past the end. */\r\n          if ( p >= limit )\r\n            goto Bad;\r\n        }\r\n\r\n        /* Get the nibble. */\r\n        nib   = ( p[0] >> phase ) & 0xF;\r\n        phase = 4 - phase;\r\n        if ( nib >= 10 )\r\n          break;\r\n\r\n        /* Arbitrarily limit exponent. */\r\n        if ( exponent > 1000 )\r\n          have_overflow = 1;\r\n        else\r\n          exponent = exponent * 10 + nib;\r\n      }\r\n\r\n      if ( exponent_sign )\r\n        exponent = -exponent;\r\n    }\r\n\r\n    if ( !number )\r\n      goto Exit;\r\n\r\n    if ( have_overflow )\r\n    {\r\n      if ( exponent_sign )\r\n        goto Underflow;\r\n      else\r\n        goto Overflow;\r\n    }\r\n\r\n    /* We don't check `power_ten' and `exponent_add'. */\r\n    exponent += power_ten + exponent_add;\r\n\r\n    if ( scaling )\r\n    {\r\n      /* Only use `fraction_length'. */\r\n      fraction_length += integer_length;\r\n      exponent        += integer_length;\r\n\r\n      if ( fraction_length <= 5 )\r\n      {\r\n        if ( number > 0x7FFFL )\r\n        {\r\n          result   = FT_DivFix( number, 10 );\r\n          *scaling = exponent - fraction_length + 1;\r\n        }\r\n        else\r\n        {\r\n          if ( exponent > 0 )\r\n          {\r\n            FT_Long  new_fraction_length, shift;\r\n\r\n\r\n            /* Make `scaling' as small as possible. */\r\n            new_fraction_length = FT_MIN( exponent, 5 );\r\n            shift               = new_fraction_length - fraction_length;\r\n\r\n            if ( shift > 0 )\r\n            {\r\n              exponent -= new_fraction_length;\r\n              number   *= power_tens[shift];\r\n              if ( number > 0x7FFFL )\r\n              {\r\n                number   /= 10;\r\n                exponent += 1;\r\n              }\r\n            }\r\n            else\r\n              exponent -= fraction_length;\r\n          }\r\n          else\r\n            exponent -= fraction_length;\r\n\r\n          result   = number << 16;\r\n          *scaling = exponent;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        if ( ( number / power_tens[fraction_length - 5] ) > 0x7FFFL )\r\n        {\r\n          result   = FT_DivFix( number, power_tens[fraction_length - 4] );\r\n          *scaling = exponent - 4;\r\n        }\r\n        else\r\n        {\r\n          result   = FT_DivFix( number, power_tens[fraction_length - 5] );\r\n          *scaling = exponent - 5;\r\n        }\r\n      }\r\n    }\r\n    else\r\n    {\r\n      integer_length  += exponent;\r\n      fraction_length -= exponent;\r\n\r\n      if ( integer_length > 5 )\r\n        goto Overflow;\r\n      if ( integer_length < -5 )\r\n        goto Underflow;\r\n\r\n      /* Remove non-significant digits. */\r\n      if ( integer_length < 0 )\r\n      {\r\n        number          /= power_tens[-integer_length];\r\n        fraction_length += integer_length;\r\n      }\r\n\r\n      /* this can only happen if exponent was non-zero */\r\n      if ( fraction_length == 10 )\r\n      {\r\n        number          /= 10;\r\n        fraction_length -= 1;\r\n      }\r\n\r\n      /* Convert into 16.16 format. */\r\n      if ( fraction_length > 0 )\r\n      {\r\n        if ( ( number / power_tens[fraction_length] ) > 0x7FFFL )\r\n          goto Exit;\r\n\r\n        result = FT_DivFix( number, power_tens[fraction_length] );\r\n      }\r\n      else\r\n      {\r\n        number *= power_tens[-fraction_length];\r\n\r\n        if ( number > 0x7FFFL )\r\n          goto Overflow;\r\n\r\n        result = number << 16;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    if ( sign )\r\n      result = -result;\r\n\r\n    return result;\r\n\r\n  Overflow:\r\n    result = 0x7FFFFFFFL;\r\n    FT_TRACE4(( \"!!!OVERFLOW:!!!\" ));\r\n    goto Exit;\r\n\r\n  Underflow:\r\n    result = 0;\r\n    FT_TRACE4(( \"!!!UNDERFLOW:!!!\" ));\r\n    goto Exit;\r\n\r\n  Bad:\r\n    result = 0;\r\n    FT_TRACE4(( \"!!!END OF DATA:!!!\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /* read a number, either integer or real */\r\n  static FT_Long\r\n  cff_parse_num( FT_Byte**  d )\r\n  {\r\n    return **d == 30 ? ( cff_parse_real( d[0], d[1], 0, NULL ) >> 16 )\r\n                     :   cff_parse_integer( d[0], d[1] );\r\n  }\r\n\r\n\r\n  /* read a floating point number, either integer or real */\r\n  static FT_Fixed\r\n  do_fixed( FT_Byte**  d,\r\n            FT_Long    scaling )\r\n  {\r\n    if ( **d == 30 )\r\n      return cff_parse_real( d[0], d[1], scaling, NULL );\r\n    else\r\n    {\r\n      FT_Long  val = cff_parse_integer( d[0], d[1] );\r\n\r\n\r\n      if ( scaling )\r\n        val *= power_tens[scaling];\r\n\r\n      if ( val > 0x7FFF )\r\n      {\r\n        val = 0x7FFFFFFFL;\r\n        goto Overflow;\r\n      }\r\n      else if ( val < -0x7FFF )\r\n      {\r\n        val = -0x7FFFFFFFL;\r\n        goto Overflow;\r\n      }\r\n\r\n      return val << 16;\r\n\r\n    Overflow:\r\n      FT_TRACE4(( \"!!!OVERFLOW:!!!\" ));\r\n      return val;\r\n    }\r\n  }\r\n\r\n\r\n  /* read a floating point number, either integer or real */\r\n  static FT_Fixed\r\n  cff_parse_fixed( FT_Byte**  d )\r\n  {\r\n    return do_fixed( d, 0 );\r\n  }\r\n\r\n\r\n  /* read a floating point number, either integer or real, */\r\n  /* but return `10^scaling' times the number read in      */\r\n  static FT_Fixed\r\n  cff_parse_fixed_scaled( FT_Byte**  d,\r\n                          FT_Long    scaling )\r\n  {\r\n    return do_fixed( d, scaling );\r\n  }\r\n\r\n\r\n  /* read a floating point number, either integer or real,     */\r\n  /* and return it as precise as possible -- `scaling' returns */\r\n  /* the scaling factor (as a power of 10)                     */\r\n  static FT_Fixed\r\n  cff_parse_fixed_dynamic( FT_Byte**  d,\r\n                           FT_Long*   scaling )\r\n  {\r\n    FT_ASSERT( scaling );\r\n\r\n    if ( **d == 30 )\r\n      return cff_parse_real( d[0], d[1], 0, scaling );\r\n    else\r\n    {\r\n      FT_Long  number;\r\n      FT_Int   integer_length;\r\n\r\n\r\n      number = cff_parse_integer( d[0], d[1] );\r\n\r\n      if ( number > 0x7FFFL )\r\n      {\r\n        for ( integer_length = 5; integer_length < 10; integer_length++ )\r\n          if ( number < power_tens[integer_length] )\r\n            break;\r\n\r\n        if ( ( number / power_tens[integer_length - 5] ) > 0x7FFFL )\r\n        {\r\n          *scaling = integer_length - 4;\r\n          return FT_DivFix( number, power_tens[integer_length - 4] );\r\n        }\r\n        else\r\n        {\r\n          *scaling = integer_length - 5;\r\n          return FT_DivFix( number, power_tens[integer_length - 5] );\r\n        }\r\n      }\r\n      else\r\n      {\r\n        *scaling = 0;\r\n        return number << 16;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_parse_font_matrix( CFF_Parser  parser )\r\n  {\r\n    CFF_FontRecDict  dict   = (CFF_FontRecDict)parser->object;\r\n    FT_Matrix*       matrix = &dict->font_matrix;\r\n    FT_Vector*       offset = &dict->font_offset;\r\n    FT_ULong*        upm    = &dict->units_per_em;\r\n    FT_Byte**        data   = parser->stack;\r\n    FT_Error         error  = CFF_Err_Stack_Underflow;\r\n\r\n\r\n    if ( parser->top >= parser->stack + 6 )\r\n    {\r\n      FT_Long  scaling;\r\n\r\n\r\n      error = CFF_Err_Ok;\r\n\r\n      dict->has_font_matrix = TRUE;\r\n\r\n      /* We expect a well-formed font matrix, this is, the matrix elements */\r\n      /* `xx' and `yy' are of approximately the same magnitude.  To avoid  */\r\n      /* loss of precision, we use the magnitude of element `xx' to scale  */\r\n      /* all other elements.  The scaling factor is then contained in the  */\r\n      /* `units_per_em' value.                                             */\r\n\r\n      matrix->xx = cff_parse_fixed_dynamic( data++, &scaling );\r\n\r\n      scaling = -scaling;\r\n\r\n      if ( scaling < 0 || scaling > 9 )\r\n      {\r\n        /* Return default matrix in case of unlikely values. */\r\n\r\n        FT_TRACE1(( \"cff_parse_font_matrix:\"\r\n                    \" strange scaling value for xx element (%d),\\n\"\r\n                    \"                      \"\r\n                    \" using default matrix\\n\", scaling ));\r\n\r\n        matrix->xx = 0x10000L;\r\n        matrix->yx = 0;\r\n        matrix->xy = 0;\r\n        matrix->yy = 0x10000L;\r\n        offset->x  = 0;\r\n        offset->y  = 0;\r\n        *upm       = 1;\r\n\r\n        goto Exit;\r\n      }\r\n\r\n      matrix->yx = cff_parse_fixed_scaled( data++, scaling );\r\n      matrix->xy = cff_parse_fixed_scaled( data++, scaling );\r\n      matrix->yy = cff_parse_fixed_scaled( data++, scaling );\r\n      offset->x  = cff_parse_fixed_scaled( data++, scaling );\r\n      offset->y  = cff_parse_fixed_scaled( data,   scaling );\r\n\r\n      *upm = power_tens[scaling];\r\n\r\n      FT_TRACE4(( \" [%f %f %f %f %f %f]\\n\",\r\n                  (double)matrix->xx / *upm / 65536,\r\n                  (double)matrix->xy / *upm / 65536,\r\n                  (double)matrix->yx / *upm / 65536,\r\n                  (double)matrix->yy / *upm / 65536,\r\n                  (double)offset->x  / *upm / 65536,\r\n                  (double)offset->y  / *upm / 65536 ));\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_parse_font_bbox( CFF_Parser  parser )\r\n  {\r\n    CFF_FontRecDict  dict = (CFF_FontRecDict)parser->object;\r\n    FT_BBox*         bbox = &dict->font_bbox;\r\n    FT_Byte**        data = parser->stack;\r\n    FT_Error         error;\r\n\r\n\r\n    error = CFF_Err_Stack_Underflow;\r\n\r\n    if ( parser->top >= parser->stack + 4 )\r\n    {\r\n      bbox->xMin = FT_RoundFix( cff_parse_fixed( data++ ) );\r\n      bbox->yMin = FT_RoundFix( cff_parse_fixed( data++ ) );\r\n      bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) );\r\n      bbox->yMax = FT_RoundFix( cff_parse_fixed( data   ) );\r\n      error = CFF_Err_Ok;\r\n\r\n      FT_TRACE4(( \" [%d %d %d %d]\\n\",\r\n                  bbox->xMin / 65536,\r\n                  bbox->yMin / 65536,\r\n                  bbox->xMax / 65536,\r\n                  bbox->yMax / 65536 ));\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_parse_private_dict( CFF_Parser  parser )\r\n  {\r\n    CFF_FontRecDict  dict = (CFF_FontRecDict)parser->object;\r\n    FT_Byte**        data = parser->stack;\r\n    FT_Error         error;\r\n\r\n\r\n    error = CFF_Err_Stack_Underflow;\r\n\r\n    if ( parser->top >= parser->stack + 2 )\r\n    {\r\n      dict->private_size   = cff_parse_num( data++ );\r\n      dict->private_offset = cff_parse_num( data   );\r\n      FT_TRACE4(( \" %lu %lu\\n\",\r\n                  dict->private_size, dict->private_offset ));\r\n\r\n      error = CFF_Err_Ok;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cff_parse_cid_ros( CFF_Parser  parser )\r\n  {\r\n    CFF_FontRecDict  dict = (CFF_FontRecDict)parser->object;\r\n    FT_Byte**        data = parser->stack;\r\n    FT_Error         error;\r\n\r\n\r\n    error = CFF_Err_Stack_Underflow;\r\n\r\n    if ( parser->top >= parser->stack + 3 )\r\n    {\r\n      dict->cid_registry = (FT_UInt)cff_parse_num( data++ );\r\n      dict->cid_ordering = (FT_UInt)cff_parse_num( data++ );\r\n      if ( **data == 30 )\r\n        FT_TRACE1(( \"cff_parse_cid_ros: real supplement is rounded\\n\" ));\r\n      dict->cid_supplement = cff_parse_num( data );\r\n      if ( dict->cid_supplement < 0 )\r\n        FT_TRACE1(( \"cff_parse_cid_ros: negative supplement %d is found\\n\",\r\n                   dict->cid_supplement ));\r\n      error = CFF_Err_Ok;\r\n\r\n      FT_TRACE4(( \" %d %d %d\\n\",\r\n                  dict->cid_registry,\r\n                  dict->cid_ordering,\r\n                  dict->cid_supplement ));\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#define CFF_FIELD_NUM( code, name, id )             \\\r\n          CFF_FIELD( code, name, id, cff_kind_num )\r\n#define CFF_FIELD_FIXED( code, name, id )             \\\r\n          CFF_FIELD( code, name, id, cff_kind_fixed )\r\n#define CFF_FIELD_FIXED_1000( code, name, id )                 \\\r\n          CFF_FIELD( code, name, id, cff_kind_fixed_thousand )\r\n#define CFF_FIELD_STRING( code, name, id )             \\\r\n          CFF_FIELD( code, name, id, cff_kind_string )\r\n#define CFF_FIELD_BOOL( code, name, id )             \\\r\n          CFF_FIELD( code, name, id, cff_kind_bool )\r\n\r\n#define CFFCODE_TOPDICT  0x1000\r\n#define CFFCODE_PRIVATE  0x2000\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n\r\n#undef  CFF_FIELD\r\n#undef  CFF_FIELD_DELTA\r\n\r\n\r\n#ifndef FT_DEBUG_LEVEL_TRACE\r\n\r\n\r\n#define CFF_FIELD_CALLBACK( code, name, id ) \\\r\n          {                                  \\\r\n            cff_kind_callback,               \\\r\n            code | CFFCODE,                  \\\r\n            0, 0,                            \\\r\n            cff_parse_ ## name,              \\\r\n            0, 0                             \\\r\n          },\r\n\r\n#define CFF_FIELD( code, name, id, kind ) \\\r\n          {                               \\\r\n            kind,                         \\\r\n            code | CFFCODE,               \\\r\n            FT_FIELD_OFFSET( name ),      \\\r\n            FT_FIELD_SIZE( name ),        \\\r\n            0, 0, 0                       \\\r\n          },\r\n\r\n#define CFF_FIELD_DELTA( code, name, max, id ) \\\r\n          {                                    \\\r\n            cff_kind_delta,                    \\\r\n            code | CFFCODE,                    \\\r\n            FT_FIELD_OFFSET( name ),           \\\r\n            FT_FIELD_SIZE_DELTA( name ),       \\\r\n            0,                                 \\\r\n            max,                               \\\r\n            FT_FIELD_OFFSET( num_ ## name )    \\\r\n          },\r\n\r\n  static const CFF_Field_Handler  cff_field_handlers[] =\r\n  {\r\n\r\n#include \"cfftoken.h\"\r\n\r\n    { 0, 0, 0, 0, 0, 0, 0 }\r\n  };\r\n\r\n\r\n#else /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n\r\n#define CFF_FIELD_CALLBACK( code, name, id ) \\\r\n          {                                  \\\r\n            cff_kind_callback,               \\\r\n            code | CFFCODE,                  \\\r\n            0, 0,                            \\\r\n            cff_parse_ ## name,              \\\r\n            0, 0,                            \\\r\n            id                               \\\r\n          },\r\n\r\n#define CFF_FIELD( code, name, id, kind ) \\\r\n          {                               \\\r\n            kind,                         \\\r\n            code | CFFCODE,               \\\r\n            FT_FIELD_OFFSET( name ),      \\\r\n            FT_FIELD_SIZE( name ),        \\\r\n            0, 0, 0,                      \\\r\n            id                            \\\r\n          },\r\n\r\n#define CFF_FIELD_DELTA( code, name, max, id ) \\\r\n          {                                    \\\r\n            cff_kind_delta,                    \\\r\n            code | CFFCODE,                    \\\r\n            FT_FIELD_OFFSET( name ),           \\\r\n            FT_FIELD_SIZE_DELTA( name ),       \\\r\n            0,                                 \\\r\n            max,                               \\\r\n            FT_FIELD_OFFSET( num_ ## name ),   \\\r\n            id                                 \\\r\n          },\r\n\r\n  static const CFF_Field_Handler  cff_field_handlers[] =\r\n  {\r\n\r\n#include \"cfftoken.h\"\r\n\r\n    { 0, 0, 0, 0, 0, 0, 0, 0 }\r\n  };\r\n\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  void\r\n  FT_Destroy_Class_cff_field_handlers( FT_Library          library,\r\n                                       CFF_Field_Handler*  clazz )\r\n  {\r\n    FT_Memory  memory = library->memory;\r\n\r\n\r\n    if ( clazz )\r\n      FT_FREE( clazz );\r\n  }\r\n\r\n\r\n  FT_Error\r\n  FT_Create_Class_cff_field_handlers( FT_Library           library,\r\n                                      CFF_Field_Handler**  output_class )\r\n  {\r\n    CFF_Field_Handler*  clazz  = NULL;\r\n    FT_Error            error;\r\n    FT_Memory           memory = library->memory;\r\n\r\n    int  i = 0;\r\n\r\n\r\n#undef CFF_FIELD\r\n#define CFF_FIELD( code, name, id, kind ) i++;\r\n#undef CFF_FIELD_DELTA\r\n#define CFF_FIELD_DELTA( code, name, max, id ) i++;\r\n#undef CFF_FIELD_CALLBACK\r\n#define CFF_FIELD_CALLBACK( code, name, id ) i++;\r\n\r\n#include \"cfftoken.h\"\r\n\r\n    i++; /* { 0, 0, 0, 0, 0, 0, 0 } */\r\n\r\n    if ( FT_ALLOC( clazz, sizeof ( CFF_Field_Handler ) * i ) )\r\n      return error;\r\n\r\n    i = 0;\r\n\r\n\r\n#ifndef FT_DEBUG_LEVEL_TRACE\r\n\r\n\r\n#undef CFF_FIELD_CALLBACK\r\n#define CFF_FIELD_CALLBACK( code_, name_, id_ )        \\\r\n          clazz[i].kind         = cff_kind_callback;   \\\r\n          clazz[i].code         = code_ | CFFCODE;     \\\r\n          clazz[i].offset       = 0;                   \\\r\n          clazz[i].size         = 0;                   \\\r\n          clazz[i].reader       = cff_parse_ ## name_; \\\r\n          clazz[i].array_max    = 0;                   \\\r\n          clazz[i].count_offset = 0;                   \\\r\n          i++;\r\n\r\n#undef  CFF_FIELD\r\n#define CFF_FIELD( code_, name_, id_, kind_ )               \\\r\n          clazz[i].kind         = kind_;                    \\\r\n          clazz[i].code         = code_ | CFFCODE;          \\\r\n          clazz[i].offset       = FT_FIELD_OFFSET( name_ ); \\\r\n          clazz[i].size         = FT_FIELD_SIZE( name_ );   \\\r\n          clazz[i].reader       = 0;                        \\\r\n          clazz[i].array_max    = 0;                        \\\r\n          clazz[i].count_offset = 0;                        \\\r\n          i++;                                              \\\r\n\r\n#undef  CFF_FIELD_DELTA\r\n#define CFF_FIELD_DELTA( code_, name_, max_, id_ )                  \\\r\n          clazz[i].kind         = cff_kind_delta;                   \\\r\n          clazz[i].code         = code_ | CFFCODE;                  \\\r\n          clazz[i].offset       = FT_FIELD_OFFSET( name_ );         \\\r\n          clazz[i].size         = FT_FIELD_SIZE_DELTA( name_ );     \\\r\n          clazz[i].reader       = 0;                                \\\r\n          clazz[i].array_max    = max_;                             \\\r\n          clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \\\r\n          i++;\r\n\r\n#include \"cfftoken.h\"\r\n\r\n    clazz[i].kind         = 0;\r\n    clazz[i].code         = 0;\r\n    clazz[i].offset       = 0;\r\n    clazz[i].size         = 0;\r\n    clazz[i].reader       = 0;\r\n    clazz[i].array_max    = 0;\r\n    clazz[i].count_offset = 0;\r\n\r\n\r\n#else /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n#undef CFF_FIELD_CALLBACK\r\n#define CFF_FIELD_CALLBACK( code_, name_, id_ )        \\\r\n          clazz[i].kind         = cff_kind_callback;   \\\r\n          clazz[i].code         = code_ | CFFCODE;     \\\r\n          clazz[i].offset       = 0;                   \\\r\n          clazz[i].size         = 0;                   \\\r\n          clazz[i].reader       = cff_parse_ ## name_; \\\r\n          clazz[i].array_max    = 0;                   \\\r\n          clazz[i].count_offset = 0;                   \\\r\n          clazz[i].id           = id_;                 \\\r\n          i++;\r\n\r\n#undef  CFF_FIELD\r\n#define CFF_FIELD( code_, name_, id_, kind_ )               \\\r\n          clazz[i].kind         = kind_;                    \\\r\n          clazz[i].code         = code_ | CFFCODE;          \\\r\n          clazz[i].offset       = FT_FIELD_OFFSET( name_ ); \\\r\n          clazz[i].size         = FT_FIELD_SIZE( name_ );   \\\r\n          clazz[i].reader       = 0;                        \\\r\n          clazz[i].array_max    = 0;                        \\\r\n          clazz[i].count_offset = 0;                        \\\r\n          clazz[i].id           = id_;                      \\\r\n          i++;                                              \\\r\n\r\n#undef  CFF_FIELD_DELTA\r\n#define CFF_FIELD_DELTA( code_, name_, max_, id_ )                  \\\r\n          clazz[i].kind         = cff_kind_delta;                   \\\r\n          clazz[i].code         = code_ | CFFCODE;                  \\\r\n          clazz[i].offset       = FT_FIELD_OFFSET( name_ );         \\\r\n          clazz[i].size         = FT_FIELD_SIZE_DELTA( name_ );     \\\r\n          clazz[i].reader       = 0;                                \\\r\n          clazz[i].array_max    = max_;                             \\\r\n          clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \\\r\n          clazz[i].id           = id_;                              \\\r\n          i++;\r\n\r\n#include \"cfftoken.h\"\r\n\r\n    clazz[i].kind         = 0;\r\n    clazz[i].code         = 0;\r\n    clazz[i].offset       = 0;\r\n    clazz[i].size         = 0;\r\n    clazz[i].reader       = 0;\r\n    clazz[i].array_max    = 0;\r\n    clazz[i].count_offset = 0;\r\n    clazz[i].id           = 0;\r\n\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n    *output_class = clazz;\r\n\r\n    return CFF_Err_Ok;\r\n  }\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cff_parser_run( CFF_Parser  parser,\r\n                  FT_Byte*    start,\r\n                  FT_Byte*    limit )\r\n  {\r\n    FT_Byte*    p       = start;\r\n    FT_Error    error   = CFF_Err_Ok;\r\n    FT_Library  library = parser->library;\r\n    FT_UNUSED( library );\r\n\r\n\r\n    parser->top    = parser->stack;\r\n    parser->start  = start;\r\n    parser->limit  = limit;\r\n    parser->cursor = start;\r\n\r\n    while ( p < limit )\r\n    {\r\n      FT_UInt  v = *p;\r\n\r\n\r\n      if ( v >= 27 && v != 31 )\r\n      {\r\n        /* it's a number; we will push its position on the stack */\r\n        if ( parser->top - parser->stack >= CFF_MAX_STACK_DEPTH )\r\n          goto Stack_Overflow;\r\n\r\n        *parser->top ++ = p;\r\n\r\n        /* now, skip it */\r\n        if ( v == 30 )\r\n        {\r\n          /* skip real number */\r\n          p++;\r\n          for (;;)\r\n          {\r\n            /* An unterminated floating point number at the */\r\n            /* end of a dictionary is invalid but harmless. */\r\n            if ( p >= limit )\r\n              goto Exit;\r\n            v = p[0] >> 4;\r\n            if ( v == 15 )\r\n              break;\r\n            v = p[0] & 0xF;\r\n            if ( v == 15 )\r\n              break;\r\n            p++;\r\n          }\r\n        }\r\n        else if ( v == 28 )\r\n          p += 2;\r\n        else if ( v == 29 )\r\n          p += 4;\r\n        else if ( v > 246 )\r\n          p += 1;\r\n      }\r\n      else\r\n      {\r\n        /* This is not a number, hence it's an operator.  Compute its code */\r\n        /* and look for it in our current list.                            */\r\n\r\n        FT_UInt                   code;\r\n        FT_UInt                   num_args = (FT_UInt)\r\n                                             ( parser->top - parser->stack );\r\n        const CFF_Field_Handler*  field;\r\n\r\n\r\n        *parser->top = p;\r\n        code = v;\r\n        if ( v == 12 )\r\n        {\r\n          /* two byte operator */\r\n          p++;\r\n          if ( p >= limit )\r\n            goto Syntax_Error;\r\n\r\n          code = 0x100 | p[0];\r\n        }\r\n        code = code | parser->object_code;\r\n\r\n        for ( field = CFF_FIELD_HANDLERS_GET; field->kind; field++ )\r\n        {\r\n          if ( field->code == (FT_Int)code )\r\n          {\r\n            /* we found our field's handler; read it */\r\n            FT_Long   val;\r\n            FT_Byte*  q = (FT_Byte*)parser->object + field->offset;\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n            FT_TRACE4(( \"  %s\", field->id ));\r\n#endif\r\n\r\n            /* check that we have enough arguments -- except for */\r\n            /* delta encoded arrays, which can be empty          */\r\n            if ( field->kind != cff_kind_delta && num_args < 1 )\r\n              goto Stack_Underflow;\r\n\r\n            switch ( field->kind )\r\n            {\r\n            case cff_kind_bool:\r\n            case cff_kind_string:\r\n            case cff_kind_num:\r\n              val = cff_parse_num( parser->stack );\r\n              goto Store_Number;\r\n\r\n            case cff_kind_fixed:\r\n              val = cff_parse_fixed( parser->stack );\r\n              goto Store_Number;\r\n\r\n            case cff_kind_fixed_thousand:\r\n              val = cff_parse_fixed_scaled( parser->stack, 3 );\r\n\r\n            Store_Number:\r\n              switch ( field->size )\r\n              {\r\n              case (8 / FT_CHAR_BIT):\r\n                *(FT_Byte*)q = (FT_Byte)val;\r\n                break;\r\n\r\n              case (16 / FT_CHAR_BIT):\r\n                *(FT_Short*)q = (FT_Short)val;\r\n                break;\r\n\r\n              case (32 / FT_CHAR_BIT):\r\n                *(FT_Int32*)q = (FT_Int)val;\r\n                break;\r\n\r\n              default:  /* for 64-bit systems */\r\n                *(FT_Long*)q = val;\r\n              }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n              switch ( field->kind )\r\n              {\r\n              case cff_kind_bool:\r\n                FT_TRACE4(( \" %s\\n\", val ? \"true\" : \"false\" ));\r\n                break;\r\n\r\n              case cff_kind_string:\r\n                FT_TRACE4(( \" %ld (SID)\\n\", val ));\r\n                break;\r\n\r\n              case cff_kind_num:\r\n                FT_TRACE4(( \" %ld\\n\", val ));\r\n                break;\r\n\r\n              case cff_kind_fixed:\r\n                FT_TRACE4(( \" %f\\n\", (double)val / 65536 ));\r\n                break;\r\n\r\n              case cff_kind_fixed_thousand:\r\n                FT_TRACE4(( \" %f\\n\", (double)val / 65536 / 1000 ));\r\n\r\n              default:\r\n                ; /* never reached */\r\n              }\r\n#endif\r\n\r\n              break;\r\n\r\n            case cff_kind_delta:\r\n              {\r\n                FT_Byte*   qcount = (FT_Byte*)parser->object +\r\n                                      field->count_offset;\r\n\r\n                FT_Byte**  data = parser->stack;\r\n\r\n\r\n                if ( num_args > field->array_max )\r\n                  num_args = field->array_max;\r\n\r\n                FT_TRACE4(( \" [\" ));\r\n\r\n                /* store count */\r\n                *qcount = (FT_Byte)num_args;\r\n\r\n                val = 0;\r\n                while ( num_args > 0 )\r\n                {\r\n                  val += cff_parse_num( data++ );\r\n                  switch ( field->size )\r\n                  {\r\n                  case (8 / FT_CHAR_BIT):\r\n                    *(FT_Byte*)q = (FT_Byte)val;\r\n                    break;\r\n\r\n                  case (16 / FT_CHAR_BIT):\r\n                    *(FT_Short*)q = (FT_Short)val;\r\n                    break;\r\n\r\n                  case (32 / FT_CHAR_BIT):\r\n                    *(FT_Int32*)q = (FT_Int)val;\r\n                    break;\r\n\r\n                  default:  /* for 64-bit systems */\r\n                    *(FT_Long*)q = val;\r\n                  }\r\n\r\n                  FT_TRACE4(( \" %ld\", val ));\r\n\r\n                  q += field->size;\r\n                  num_args--;\r\n                }\r\n\r\n                FT_TRACE4(( \"]\\n\" ));\r\n              }\r\n              break;\r\n\r\n            default:  /* callback */\r\n              error = field->reader( parser );\r\n              if ( error )\r\n                goto Exit;\r\n            }\r\n            goto Found;\r\n          }\r\n        }\r\n\r\n        /* this is an unknown operator, or it is unsupported; */\r\n        /* we will ignore it for now.                         */\r\n\r\n      Found:\r\n        /* clear stack */\r\n        parser->top = parser->stack;\r\n      }\r\n      p++;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Stack_Overflow:\r\n    error = CFF_Err_Invalid_Argument;\r\n    goto Exit;\r\n\r\n  Stack_Underflow:\r\n    error = CFF_Err_Invalid_Argument;\r\n    goto Exit;\r\n\r\n  Syntax_Error:\r\n    error = CFF_Err_Invalid_Argument;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffparse.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffparse.h                                                             */\r\n/*                                                                         */\r\n/*    CFF token stream parser (specification)                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFF_PARSE_H__\r\n#define __CFF_PARSE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"cfftypes.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define CFF_MAX_STACK_DEPTH  96\r\n\r\n#define CFF_CODE_TOPDICT  0x1000\r\n#define CFF_CODE_PRIVATE  0x2000\r\n\r\n\r\n  typedef struct  CFF_ParserRec_\r\n  {\r\n    FT_Library library;\r\n    FT_Byte*   start;\r\n    FT_Byte*   limit;\r\n    FT_Byte*   cursor;\r\n\r\n    FT_Byte*   stack[CFF_MAX_STACK_DEPTH + 1];\r\n    FT_Byte**  top;\r\n\r\n    FT_UInt    object_code;\r\n    void*      object;\r\n\r\n  } CFF_ParserRec, *CFF_Parser;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  cff_parser_init( CFF_Parser  parser,\r\n                   FT_UInt     code,\r\n                   void*       object,\r\n                   FT_Library  library);\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cff_parser_run( CFF_Parser  parser,\r\n                  FT_Byte*    start,\r\n                  FT_Byte*    limit );\r\n\r\n\r\n  enum\r\n  {\r\n    cff_kind_none = 0,\r\n    cff_kind_num,\r\n    cff_kind_fixed,\r\n    cff_kind_fixed_thousand,\r\n    cff_kind_string,\r\n    cff_kind_bool,\r\n    cff_kind_delta,\r\n    cff_kind_callback,\r\n\r\n    cff_kind_max  /* do not remove */\r\n  };\r\n\r\n\r\n  /* now generate handlers for the most simple fields */\r\n  typedef FT_Error  (*CFF_Field_Reader)( CFF_Parser  parser );\r\n\r\n  typedef struct  CFF_Field_Handler_\r\n  {\r\n    int               kind;\r\n    int               code;\r\n    FT_UInt           offset;\r\n    FT_Byte           size;\r\n    CFF_Field_Reader  reader;\r\n    FT_UInt           array_max;\r\n    FT_UInt           count_offset;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    const char*       id;\r\n#endif\r\n\r\n  } CFF_Field_Handler;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __CFF_PARSE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffpic.c                                                               */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for cff module.      */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"cffcmap.h\"\r\n#include \"cffpic.h\"\r\n#include \"cfferrs.h\"\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from cffdrivr.c */\r\n  FT_Error\r\n  FT_Create_Class_cff_services(\r\n    FT_Library           library,\r\n    FT_ServiceDescRec**  output_class );\r\n\r\n  void\r\n  FT_Destroy_Class_cff_services(\r\n    FT_Library          library,\r\n    FT_ServiceDescRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_cff_service_ps_info(\r\n    FT_Library             library,\r\n    FT_Service_PsInfoRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_cff_service_glyph_dict(\r\n    FT_Library                library,\r\n    FT_Service_GlyphDictRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_cff_service_ps_name(\r\n    FT_Library                 library,\r\n    FT_Service_PsFontNameRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_cff_service_get_cmap_info(\r\n    FT_Library              library,\r\n    FT_Service_TTCMapsRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_cff_service_cid_info(\r\n    FT_Library          library,\r\n    FT_Service_CIDRec*  clazz );\r\n\r\n  /* forward declaration of PIC init functions from cffparse.c */\r\n  FT_Error\r\n  FT_Create_Class_cff_field_handlers(\r\n    FT_Library           library,\r\n    CFF_Field_Handler**  output_class );\r\n\r\n  void\r\n  FT_Destroy_Class_cff_field_handlers(\r\n    FT_Library          library,\r\n    CFF_Field_Handler*  clazz );\r\n\r\n  void\r\n  cff_driver_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory  memory = library->memory;\r\n\r\n\r\n    if ( pic_container->cff )\r\n    {\r\n      CffModulePIC*  container = ( CffModulePIC* )pic_container->cff;\r\n\r\n\r\n      if ( container->cff_services )\r\n        FT_Destroy_Class_cff_services( library,\r\n                                       container->cff_services );\r\n      container->cff_services = NULL;\r\n      if ( container->cff_field_handlers )\r\n        FT_Destroy_Class_cff_field_handlers(\r\n          library, container->cff_field_handlers );\r\n      container->cff_field_handlers = NULL;\r\n      FT_FREE( container );\r\n      pic_container->cff = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  cff_driver_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = CFF_Err_Ok;\r\n    CffModulePIC*      container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->cff = container;\r\n\r\n    /* initialize pointer table - this is how the module usually expects this data */\r\n    error = FT_Create_Class_cff_services( library,\r\n                                          &container->cff_services );\r\n    if ( error )\r\n      goto Exit;\r\n    error = FT_Create_Class_cff_field_handlers(\r\n              library, &container->cff_field_handlers );\r\n    if ( error )\r\n      goto Exit;\r\n    FT_Init_Class_cff_service_ps_info(\r\n      library, &container->cff_service_ps_info );\r\n    FT_Init_Class_cff_service_glyph_dict(\r\n      library, &container->cff_service_glyph_dict );\r\n    FT_Init_Class_cff_service_ps_name(\r\n      library, &container->cff_service_ps_name );\r\n    FT_Init_Class_cff_service_get_cmap_info(\r\n      library, &container->cff_service_get_cmap_info );\r\n    FT_Init_Class_cff_service_cid_info(\r\n      library, &container->cff_service_cid_info );\r\n    FT_Init_Class_cff_cmap_encoding_class_rec(\r\n      library, &container->cff_cmap_encoding_class_rec );\r\n    FT_Init_Class_cff_cmap_unicode_class_rec(\r\n      library, &container->cff_cmap_unicode_class_rec );\r\nExit:\r\n    if ( error )\r\n      cff_driver_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cffpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cffpic.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for cff module.      */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFPIC_H__\r\n#define __CFFPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define CFF_SERVICE_PS_INFO_GET          cff_service_ps_info\r\n#define CFF_SERVICE_GLYPH_DICT_GET       cff_service_glyph_dict\r\n#define CFF_SERVICE_PS_NAME_GET          cff_service_ps_name\r\n#define CFF_SERVICE_GET_CMAP_INFO_GET    cff_service_get_cmap_info\r\n#define CFF_SERVICE_CID_INFO_GET         cff_service_cid_info\r\n#define CFF_SERVICES_GET                 cff_services\r\n#define CFF_CMAP_ENCODING_CLASS_REC_GET  cff_cmap_encoding_class_rec\r\n#define CFF_CMAP_UNICODE_CLASS_REC_GET   cff_cmap_unicode_class_rec\r\n#define CFF_FIELD_HANDLERS_GET           cff_field_handlers\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n#include \"cffparse.h\"\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_TT_CMAP_H\r\n#include FT_SERVICE_CID_H\r\n\r\n\r\n  typedef struct  CffModulePIC_\r\n  {\r\n    FT_ServiceDescRec*        cff_services;\r\n    CFF_Field_Handler*        cff_field_handlers;\r\n    FT_Service_PsInfoRec      cff_service_ps_info;\r\n    FT_Service_GlyphDictRec   cff_service_glyph_dict;\r\n    FT_Service_PsFontNameRec  cff_service_ps_name;\r\n    FT_Service_TTCMapsRec     cff_service_get_cmap_info;\r\n    FT_Service_CIDRec         cff_service_cid_info;\r\n    FT_CMap_ClassRec          cff_cmap_encoding_class_rec;\r\n    FT_CMap_ClassRec          cff_cmap_unicode_class_rec;\r\n\r\n  } CffModulePIC;\r\n\r\n\r\n#define GET_PIC( lib )  \\\r\n          ( (CffModulePIC*)((lib)->pic_container.cff) )\r\n\r\n#define CFF_SERVICE_PS_INFO_GET  \\\r\n          ( GET_PIC( library )->cff_service_ps_info )\r\n#define CFF_SERVICE_GLYPH_DICT_GET  \\\r\n          ( GET_PIC( library )->cff_service_glyph_dict )\r\n#define CFF_SERVICE_PS_NAME_GET  \\\r\n          ( GET_PIC( library )->cff_service_ps_name )\r\n#define CFF_SERVICE_GET_CMAP_INFO_GET  \\\r\n          ( GET_PIC( library )->cff_service_get_cmap_info )\r\n#define CFF_SERVICE_CID_INFO_GET  \\\r\n          ( GET_PIC( library )->cff_service_cid_info )\r\n#define CFF_SERVICES_GET  \\\r\n          ( GET_PIC( library )->cff_services )\r\n#define CFF_CMAP_ENCODING_CLASS_REC_GET  \\\r\n          ( GET_PIC( library )->cff_cmap_encoding_class_rec )\r\n#define CFF_CMAP_UNICODE_CLASS_REC_GET  \\\r\n          ( GET_PIC( library )->cff_cmap_unicode_class_rec )\r\n#define CFF_FIELD_HANDLERS_GET  \\\r\n          ( GET_PIC( library )->cff_field_handlers )\r\n\r\n  /* see cffpic.c for the implementation */\r\n  void\r\n  cff_driver_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  cff_driver_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cfftoken.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cfftoken.h                                                             */\r\n/*                                                                         */\r\n/*    CFF token definitions (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  CFF_FontRecDictRec\r\n\r\n#undef  CFFCODE\r\n#define CFFCODE       CFFCODE_TOPDICT\r\n\r\n  CFF_FIELD_STRING  ( 0,     version,             \"Version\" )\r\n  CFF_FIELD_STRING  ( 1,     notice,              \"Notice\" )\r\n  CFF_FIELD_STRING  ( 0x100, copyright,           \"Copyright\" )\r\n  CFF_FIELD_STRING  ( 2,     full_name,           \"FullName\" )\r\n  CFF_FIELD_STRING  ( 3,     family_name,         \"FamilyName\" )\r\n  CFF_FIELD_STRING  ( 4,     weight,              \"Weight\" )\r\n  CFF_FIELD_BOOL    ( 0x101, is_fixed_pitch,      \"isFixedPitch\" )\r\n  CFF_FIELD_FIXED   ( 0x102, italic_angle,        \"ItalicAngle\" )\r\n  CFF_FIELD_FIXED   ( 0x103, underline_position,  \"UnderlinePosition\" )\r\n  CFF_FIELD_FIXED   ( 0x104, underline_thickness, \"UnderlineThickness\" )\r\n  CFF_FIELD_NUM     ( 0x105, paint_type,          \"PaintType\" )\r\n  CFF_FIELD_NUM     ( 0x106, charstring_type,     \"CharstringType\" )\r\n  CFF_FIELD_CALLBACK( 0x107, font_matrix,         \"FontMatrix\" )\r\n  CFF_FIELD_NUM     ( 13,    unique_id,           \"UniqueID\" )\r\n  CFF_FIELD_CALLBACK( 5,     font_bbox,           \"FontBBox\" )\r\n  CFF_FIELD_NUM     ( 0x108, stroke_width,        \"StrokeWidth\" )\r\n  CFF_FIELD_NUM     ( 15,    charset_offset,      \"charset\" )\r\n  CFF_FIELD_NUM     ( 16,    encoding_offset,     \"Encoding\" )\r\n  CFF_FIELD_NUM     ( 17,    charstrings_offset,  \"CharStrings\" )\r\n  CFF_FIELD_CALLBACK( 18,    private_dict,        \"Private\" )\r\n  CFF_FIELD_NUM     ( 0x114, synthetic_base,      \"SyntheticBase\" )\r\n  CFF_FIELD_STRING  ( 0x115, embedded_postscript, \"PostScript\" )\r\n\r\n#if 0\r\n  CFF_FIELD_STRING  ( 0x116, base_font_name,      \"BaseFontName\" )\r\n  CFF_FIELD_DELTA   ( 0x117, base_font_blend, 16, \"BaseFontBlend\" )\r\n  CFF_FIELD_CALLBACK( 0x118, multiple_master,     \"MultipleMaster\" )\r\n  CFF_FIELD_CALLBACK( 0x119, blend_axis_types,    \"BlendAxisTypes\" )\r\n#endif\r\n\r\n  CFF_FIELD_CALLBACK( 0x11E, cid_ros,              \"ROS\" )\r\n  CFF_FIELD_NUM     ( 0x11F, cid_font_version,     \"CIDFontVersion\" )\r\n  CFF_FIELD_NUM     ( 0x120, cid_font_revision,    \"CIDFontRevision\" )\r\n  CFF_FIELD_NUM     ( 0x121, cid_font_type,        \"CIDFontType\" )\r\n  CFF_FIELD_NUM     ( 0x122, cid_count,            \"CIDCount\" )\r\n  CFF_FIELD_NUM     ( 0x123, cid_uid_base,         \"UIDBase\" )\r\n  CFF_FIELD_NUM     ( 0x124, cid_fd_array_offset,  \"FDArray\" )\r\n  CFF_FIELD_NUM     ( 0x125, cid_fd_select_offset, \"FDSelect\" )\r\n  CFF_FIELD_STRING  ( 0x126, cid_font_name,        \"FontName\" )\r\n\r\n#if 0\r\n  CFF_FIELD_NUM     ( 0x127, chameleon, \"Chameleon\" )\r\n#endif\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  CFF_PrivateRec\r\n#undef  CFFCODE\r\n#define CFFCODE       CFFCODE_PRIVATE\r\n\r\n  CFF_FIELD_DELTA     ( 6,     blue_values, 14,        \"BlueValues\" )\r\n  CFF_FIELD_DELTA     ( 7,     other_blues, 10,        \"OtherBlues\" )\r\n  CFF_FIELD_DELTA     ( 8,     family_blues, 14,       \"FamilyBlues\" )\r\n  CFF_FIELD_DELTA     ( 9,     family_other_blues, 10, \"FamilyOtherBlues\" )\r\n  CFF_FIELD_FIXED_1000( 0x109, blue_scale,             \"BlueScale\" )\r\n  CFF_FIELD_NUM       ( 0x10A, blue_shift,             \"BlueShift\" )\r\n  CFF_FIELD_NUM       ( 0x10B, blue_fuzz,              \"BlueFuzz\" )\r\n  CFF_FIELD_NUM       ( 10,    standard_width,         \"StdHW\" )\r\n  CFF_FIELD_NUM       ( 11,    standard_height,        \"StdVW\" )\r\n  CFF_FIELD_DELTA     ( 0x10C, snap_widths, 13,        \"StemSnapH\" )\r\n  CFF_FIELD_DELTA     ( 0x10D, snap_heights, 13,       \"StemSnapV\" )\r\n  CFF_FIELD_BOOL      ( 0x10E, force_bold,             \"ForceBold\" )\r\n  CFF_FIELD_FIXED     ( 0x10F, force_bold_threshold,   \"ForceBoldThreshold\" )\r\n  CFF_FIELD_NUM       ( 0x110, lenIV,                  \"lenIV\" )\r\n  CFF_FIELD_NUM       ( 0x111, language_group,         \"LanguageGroup\" )\r\n  CFF_FIELD_FIXED     ( 0x112, expansion_factor,       \"ExpansionFactor\" )\r\n  CFF_FIELD_NUM       ( 0x113, initial_random_seed,    \"initialRandomSeed\" )\r\n  CFF_FIELD_NUM       ( 19,    local_subrs_offset,     \"Subrs\" )\r\n  CFF_FIELD_NUM       ( 20,    default_width,          \"defaultWidthX\" )\r\n  CFF_FIELD_NUM       ( 21,    nominal_width,          \"nominalWidthX\" )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/cfftypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cfftypes.h                                                             */\r\n/*                                                                         */\r\n/*    Basic OpenType/CFF type definitions and interface (specification     */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2006-2008, 2010-2011 by                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CFFTYPES_H__\r\n#define __CFFTYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TYPE1_TABLES_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CFF_IndexRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a CFF Index table.                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    stream      :: The source input stream.                            */\r\n  /*                                                                       */\r\n  /*    start       :: The position of the first index byte in the         */\r\n  /*                   input stream.                                       */\r\n  /*                                                                       */\r\n  /*    count       :: The number of elements in the index.                */\r\n  /*                                                                       */\r\n  /*    off_size    :: The size in bytes of object offsets in index.       */\r\n  /*                                                                       */\r\n  /*    data_offset :: The position of first data byte in the index's      */\r\n  /*                   bytes.                                              */\r\n  /*                                                                       */\r\n  /*    data_size   :: The size of the data table in this index.           */\r\n  /*                                                                       */\r\n  /*    offsets     :: A table of element offsets in the index.  Must be   */\r\n  /*                   loaded explicitly.                                  */\r\n  /*                                                                       */\r\n  /*    bytes       :: If the index is loaded in memory, its bytes.        */\r\n  /*                                                                       */\r\n  typedef struct  CFF_IndexRec_\r\n  {\r\n    FT_Stream  stream;\r\n    FT_ULong   start;\r\n    FT_UInt    count;\r\n    FT_Byte    off_size;\r\n    FT_ULong   data_offset;\r\n    FT_ULong   data_size;\r\n\r\n    FT_ULong*  offsets;\r\n    FT_Byte*   bytes;\r\n\r\n  } CFF_IndexRec, *CFF_Index;\r\n\r\n\r\n  typedef struct  CFF_EncodingRec_\r\n  {\r\n    FT_UInt     format;\r\n    FT_ULong    offset;\r\n\r\n    FT_UInt     count;\r\n    FT_UShort   sids [256];  /* avoid dynamic allocations */\r\n    FT_UShort   codes[256];\r\n\r\n  } CFF_EncodingRec, *CFF_Encoding;\r\n\r\n\r\n  typedef struct  CFF_CharsetRec_\r\n  {\r\n\r\n    FT_UInt     format;\r\n    FT_ULong    offset;\r\n\r\n    FT_UShort*  sids;\r\n    FT_UShort*  cids;       /* the inverse mapping of `sids'; only needed */\r\n                            /* for CID-keyed fonts                        */\r\n    FT_UInt     max_cid;\r\n    FT_UInt     num_glyphs;\r\n\r\n  } CFF_CharsetRec, *CFF_Charset;\r\n\r\n\r\n  typedef struct  CFF_FontRecDictRec_\r\n  {\r\n    FT_UInt    version;\r\n    FT_UInt    notice;\r\n    FT_UInt    copyright;\r\n    FT_UInt    full_name;\r\n    FT_UInt    family_name;\r\n    FT_UInt    weight;\r\n    FT_Bool    is_fixed_pitch;\r\n    FT_Fixed   italic_angle;\r\n    FT_Fixed   underline_position;\r\n    FT_Fixed   underline_thickness;\r\n    FT_Int     paint_type;\r\n    FT_Int     charstring_type;\r\n    FT_Matrix  font_matrix;\r\n    FT_Bool    has_font_matrix;\r\n    FT_ULong   units_per_em;  /* temporarily used as scaling value also */\r\n    FT_Vector  font_offset;\r\n    FT_ULong   unique_id;\r\n    FT_BBox    font_bbox;\r\n    FT_Pos     stroke_width;\r\n    FT_ULong   charset_offset;\r\n    FT_ULong   encoding_offset;\r\n    FT_ULong   charstrings_offset;\r\n    FT_ULong   private_offset;\r\n    FT_ULong   private_size;\r\n    FT_Long    synthetic_base;\r\n    FT_UInt    embedded_postscript;\r\n\r\n    /* these should only be used for the top-level font dictionary */\r\n    FT_UInt    cid_registry;\r\n    FT_UInt    cid_ordering;\r\n    FT_Long    cid_supplement;\r\n\r\n    FT_Long    cid_font_version;\r\n    FT_Long    cid_font_revision;\r\n    FT_Long    cid_font_type;\r\n    FT_ULong   cid_count;\r\n    FT_ULong   cid_uid_base;\r\n    FT_ULong   cid_fd_array_offset;\r\n    FT_ULong   cid_fd_select_offset;\r\n    FT_UInt    cid_font_name;\r\n\r\n  } CFF_FontRecDictRec, *CFF_FontRecDict;\r\n\r\n\r\n  typedef struct  CFF_PrivateRec_\r\n  {\r\n    FT_Byte   num_blue_values;\r\n    FT_Byte   num_other_blues;\r\n    FT_Byte   num_family_blues;\r\n    FT_Byte   num_family_other_blues;\r\n\r\n    FT_Pos    blue_values[14];\r\n    FT_Pos    other_blues[10];\r\n    FT_Pos    family_blues[14];\r\n    FT_Pos    family_other_blues[10];\r\n\r\n    FT_Fixed  blue_scale;\r\n    FT_Pos    blue_shift;\r\n    FT_Pos    blue_fuzz;\r\n    FT_Pos    standard_width;\r\n    FT_Pos    standard_height;\r\n\r\n    FT_Byte   num_snap_widths;\r\n    FT_Byte   num_snap_heights;\r\n    FT_Pos    snap_widths[13];\r\n    FT_Pos    snap_heights[13];\r\n    FT_Bool   force_bold;\r\n    FT_Fixed  force_bold_threshold;\r\n    FT_Int    lenIV;\r\n    FT_Int    language_group;\r\n    FT_Fixed  expansion_factor;\r\n    FT_Long   initial_random_seed;\r\n    FT_ULong  local_subrs_offset;\r\n    FT_Pos    default_width;\r\n    FT_Pos    nominal_width;\r\n\r\n  } CFF_PrivateRec, *CFF_Private;\r\n\r\n\r\n  typedef struct  CFF_FDSelectRec_\r\n  {\r\n    FT_Byte   format;\r\n    FT_UInt   range_count;\r\n\r\n    /* that's the table, taken from the file `as is' */\r\n    FT_Byte*  data;\r\n    FT_UInt   data_size;\r\n\r\n    /* small cache for format 3 only */\r\n    FT_UInt   cache_first;\r\n    FT_UInt   cache_count;\r\n    FT_Byte   cache_fd;\r\n\r\n  } CFF_FDSelectRec, *CFF_FDSelect;\r\n\r\n\r\n  /* A SubFont packs a font dict and a private dict together.  They are */\r\n  /* needed to support CID-keyed CFF fonts.                             */\r\n  typedef struct  CFF_SubFontRec_\r\n  {\r\n    CFF_FontRecDictRec  font_dict;\r\n    CFF_PrivateRec      private_dict;\r\n\r\n    CFF_IndexRec        local_subrs_index;\r\n    FT_Byte**           local_subrs; /* array of pointers into Local Subrs INDEX data */\r\n\r\n  } CFF_SubFontRec, *CFF_SubFont;\r\n\r\n\r\n#define CFF_MAX_CID_FONTS  256\r\n\r\n\r\n  typedef struct  CFF_FontRec_\r\n  {\r\n    FT_Stream        stream;\r\n    FT_Memory        memory;\r\n    FT_UInt          num_faces;\r\n    FT_UInt          num_glyphs;\r\n\r\n    FT_Byte          version_major;\r\n    FT_Byte          version_minor;\r\n    FT_Byte          header_size;\r\n    FT_Byte          absolute_offsize;\r\n\r\n\r\n    CFF_IndexRec     name_index;\r\n    CFF_IndexRec     top_dict_index;\r\n    CFF_IndexRec     global_subrs_index;\r\n\r\n    CFF_EncodingRec  encoding;\r\n    CFF_CharsetRec   charset;\r\n\r\n    CFF_IndexRec     charstrings_index;\r\n    CFF_IndexRec     font_dict_index;\r\n    CFF_IndexRec     private_index;\r\n    CFF_IndexRec     local_subrs_index;\r\n\r\n    FT_String*       font_name;\r\n\r\n    /* array of pointers into Global Subrs INDEX data */\r\n    FT_Byte**        global_subrs;\r\n\r\n    /* array of pointers into String INDEX data stored at string_pool */\r\n    FT_UInt          num_strings;\r\n    FT_Byte**        strings;\r\n    FT_Byte*         string_pool;\r\n\r\n    CFF_SubFontRec   top_font;\r\n    FT_UInt          num_subfonts;\r\n    CFF_SubFont      subfonts[CFF_MAX_CID_FONTS];\r\n\r\n    CFF_FDSelectRec  fd_select;\r\n\r\n    /* interface to PostScript hinter */\r\n    PSHinter_Service  pshinter;\r\n\r\n    /* interface to Postscript Names service */\r\n    FT_Service_PsCMaps  psnames;\r\n\r\n    /* since version 2.3.0 */\r\n    PS_FontInfoRec*  font_info;   /* font info dictionary */\r\n\r\n    /* since version 2.3.6 */\r\n    FT_String*       registry;\r\n    FT_String*       ordering;\r\n\r\n  } CFF_FontRec, *CFF_Font;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CFFTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/module.mk",
    "content": "#\r\n# FreeType 2 CFF module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += CFF_DRIVER\r\n\r\ndefine CFF_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, cff_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)cff       $(ECHO_DRIVER_DESC)OpenType fonts with extension *.otf$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cff/rules.mk",
    "content": "#\r\n# FreeType 2 OpenType/CFF driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# OpenType driver directory\r\n#\r\nCFF_DIR := $(SRC_DIR)/cff\r\n\r\n\r\nCFF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CFF_DIR))\r\n\r\n\r\n# CFF driver sources (i.e., C files)\r\n#\r\nCFF_DRV_SRC := $(CFF_DIR)/cffcmap.c  \\\r\n               $(CFF_DIR)/cffdrivr.c \\\r\n               $(CFF_DIR)/cffgload.c \\\r\n               $(CFF_DIR)/cffload.c  \\\r\n               $(CFF_DIR)/cffobjs.c  \\\r\n               $(CFF_DIR)/cffparse.c \\\r\n               $(CFF_DIR)/cffpic.c\r\n\r\n# CFF driver headers\r\n#\r\nCFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \\\r\n             $(CFF_DIR)/cfferrs.h   \\\r\n             $(CFF_DIR)/cfftoken.h  \\\r\n             $(CFF_DIR)/cfftypes.h\r\n\r\n\r\n# CFF driver object(s)\r\n#\r\n#   CFF_DRV_OBJ_M is used during `multi' builds\r\n#   CFF_DRV_OBJ_S is used during `single' builds\r\n#\r\nCFF_DRV_OBJ_M := $(CFF_DRV_SRC:$(CFF_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nCFF_DRV_OBJ_S := $(OBJ_DIR)/cff.$O\r\n\r\n# CFF driver source file for single build\r\n#\r\nCFF_DRV_SRC_S := $(CFF_DIR)/cff.c\r\n\r\n\r\n# CFF driver - single object\r\n#\r\n$(CFF_DRV_OBJ_S): $(CFF_DRV_SRC_S) $(CFF_DRV_SRC) $(FREETYPE_H) $(CFF_DRV_H)\r\n\t$(CFF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(CFF_DRV_SRC_S))\r\n\r\n\r\n# CFF driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(CFF_DIR)/%.c $(FREETYPE_H) $(CFF_DRV_H)\r\n\t$(CFF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(CFF_DRV_OBJ_S)\r\nDRV_OBJS_M += $(CFF_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/Jamfile",
    "content": "# FreeType 2 src/cid Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) cid ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = cidobjs cidload cidgload cidriver cidparse ;\r\n  }\r\n  else\r\n  {\r\n    _sources = type1cid ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/cid Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/ciderrs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ciderrs.h                                                              */\r\n/*                                                                         */\r\n/*    CID error codes (specification only).                                */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the CID error enumeration constants.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __CIDERRS_H__\r\n#define __CIDERRS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  CID_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_CID\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __CIDERRS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidgload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidgload.c                                                             */\r\n/*                                                                         */\r\n/*    CID-keyed Type1 Glyph Loader (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"cidload.h\"\r\n#include \"cidgload.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_CALC_H\r\n\r\n#include \"ciderrs.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cidgload\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cid_load_glyph( T1_Decoder  decoder,\r\n                  FT_UInt     glyph_index )\r\n  {\r\n    CID_Face       face = (CID_Face)decoder->builder.face;\r\n    CID_FaceInfo   cid  = &face->cid;\r\n    FT_Byte*       p;\r\n    FT_UInt        fd_select;\r\n    FT_Stream      stream       = face->cid_stream;\r\n    FT_Error       error        = CID_Err_Ok;\r\n    FT_Byte*       charstring   = 0;\r\n    FT_Memory      memory       = face->root.memory;\r\n    FT_ULong       glyph_length = 0;\r\n    PSAux_Service  psaux        = (PSAux_Service)face->psaux;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_Incremental_InterfaceRec *inc =\r\n                                  face->root.internal->incremental_interface;\r\n#endif\r\n\r\n\r\n    FT_TRACE4(( \"cid_load_glyph: glyph index %d\\n\", glyph_index ));\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    /* For incremental fonts get the character data using */\r\n    /* the callback function.                             */\r\n    if ( inc )\r\n    {\r\n      FT_Data  glyph_data;\r\n\r\n\r\n      error = inc->funcs->get_glyph_data( inc->object,\r\n                                          glyph_index, &glyph_data );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      p         = (FT_Byte*)glyph_data.pointer;\r\n      fd_select = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes );\r\n\r\n      if ( glyph_data.length != 0 )\r\n      {\r\n        glyph_length = glyph_data.length - cid->fd_bytes;\r\n        (void)FT_ALLOC( charstring, glyph_length );\r\n        if ( !error )\r\n          ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,\r\n                     glyph_length );\r\n      }\r\n\r\n      inc->funcs->free_glyph_data( inc->object, &glyph_data );\r\n\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    else\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    /* For ordinary fonts read the CID font dictionary index */\r\n    /* and charstring offset from the CIDMap.                */\r\n    {\r\n      FT_UInt   entry_len = cid->fd_bytes + cid->gd_bytes;\r\n      FT_ULong  off1;\r\n\r\n\r\n      if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +\r\n                           glyph_index * entry_len )               ||\r\n           FT_FRAME_ENTER( 2 * entry_len )                         )\r\n        goto Exit;\r\n\r\n      p            = (FT_Byte*)stream->cursor;\r\n      fd_select    = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );\r\n      off1         = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes );\r\n      p           += cid->fd_bytes;\r\n      glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;\r\n      FT_FRAME_EXIT();\r\n\r\n      if ( fd_select >= (FT_UInt)cid->num_dicts )\r\n      {\r\n        error = CID_Err_Invalid_Offset;\r\n        goto Exit;\r\n      }\r\n      if ( glyph_length == 0 )\r\n        goto Exit;\r\n      if ( FT_ALLOC( charstring, glyph_length ) )\r\n        goto Exit;\r\n      if ( FT_STREAM_READ_AT( cid->data_offset + off1,\r\n                              charstring, glyph_length ) )\r\n        goto Exit;\r\n    }\r\n\r\n    /* Now set up the subrs array and parse the charstrings. */\r\n    {\r\n      CID_FaceDict  dict;\r\n      CID_Subrs     cid_subrs = face->subrs + fd_select;\r\n      FT_Int        cs_offset;\r\n\r\n\r\n      /* Set up subrs */\r\n      decoder->num_subrs = cid_subrs->num_subrs;\r\n      decoder->subrs     = cid_subrs->code;\r\n      decoder->subrs_len = 0;\r\n\r\n      /* Set up font matrix */\r\n      dict                 = cid->font_dicts + fd_select;\r\n\r\n      decoder->font_matrix = dict->font_matrix;\r\n      decoder->font_offset = dict->font_offset;\r\n      decoder->lenIV       = dict->private_dict.lenIV;\r\n\r\n      /* Decode the charstring. */\r\n\r\n      /* Adjustment for seed bytes. */\r\n      cs_offset = ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );\r\n\r\n      /* Decrypt only if lenIV >= 0. */\r\n      if ( decoder->lenIV >= 0 )\r\n        psaux->t1_decrypt( charstring, glyph_length, 4330 );\r\n\r\n      error = decoder->funcs.parse_charstrings(\r\n                decoder, charstring + cs_offset,\r\n                (FT_Int)glyph_length - cs_offset );\r\n    }\r\n\r\n    FT_FREE( charstring );\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    /* Incremental fonts can optionally override the metrics. */\r\n    if ( !error && inc && inc->funcs->get_glyph_metrics )\r\n    {\r\n      FT_Incremental_MetricsRec  metrics;\r\n\r\n\r\n      metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );\r\n      metrics.bearing_y = 0;\r\n      metrics.advance   = FIXED_TO_INT( decoder->builder.advance.x );\r\n      metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );\r\n\r\n      error = inc->funcs->get_glyph_metrics( inc->object,\r\n                                             glyph_index, FALSE, &metrics );\r\n\r\n      decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );\r\n      decoder->builder.advance.x      = INT_TO_FIXED( metrics.advance );\r\n      decoder->builder.advance.y      = INT_TO_FIXED( metrics.advance_v );\r\n    }\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**********                                                      *********/\r\n  /**********                                                      *********/\r\n  /**********            COMPUTE THE MAXIMUM ADVANCE WIDTH         *********/\r\n  /**********                                                      *********/\r\n  /**********    The following code is in charge of computing      *********/\r\n  /**********    the maximum advance width of the font.  It        *********/\r\n  /**********    quickly processes each glyph charstring to        *********/\r\n  /**********    extract the value from either a `sbw' or `seac'   *********/\r\n  /**********    operator.                                         *********/\r\n  /**********                                                      *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_face_compute_max_advance( CID_Face  face,\r\n                                FT_Int*   max_advance )\r\n  {\r\n    FT_Error       error;\r\n    T1_DecoderRec  decoder;\r\n    FT_Int         glyph_index;\r\n\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n\r\n\r\n    *max_advance = 0;\r\n\r\n    /* Initialize load decoder */\r\n    error = psaux->t1_decoder_funcs->init( &decoder,\r\n                                           (FT_Face)face,\r\n                                           0, /* size       */\r\n                                           0, /* glyph slot */\r\n                                           0, /* glyph names! XXX */\r\n                                           0, /* blend == 0 */\r\n                                           0, /* hinting == 0 */\r\n                                           cid_load_glyph );\r\n    if ( error )\r\n      return error;\r\n\r\n    /* TODO: initialize decoder.len_buildchar and decoder.buildchar */\r\n    /*       if we ever support CID-keyed multiple master fonts     */\r\n\r\n    decoder.builder.metrics_only = 1;\r\n    decoder.builder.load_points  = 0;\r\n\r\n    /* for each glyph, parse the glyph charstring and extract */\r\n    /* the advance width                                      */\r\n    for ( glyph_index = 0; glyph_index < face->root.num_glyphs;\r\n          glyph_index++ )\r\n    {\r\n      /* now get load the unscaled outline */\r\n      error = cid_load_glyph( &decoder, glyph_index );\r\n      /* ignore the error if one occurred - skip to next glyph */\r\n    }\r\n\r\n    *max_advance = FIXED_TO_INT( decoder.builder.advance.x );\r\n\r\n    psaux->t1_decoder_funcs->done( &decoder );\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_slot_load_glyph( FT_GlyphSlot  cidglyph,      /* CID_GlyphSlot */\r\n                       FT_Size       cidsize,       /* CID_Size      */\r\n                       FT_UInt       glyph_index,\r\n                       FT_Int32      load_flags )\r\n  {\r\n    CID_GlyphSlot  glyph = (CID_GlyphSlot)cidglyph;\r\n    FT_Error       error;\r\n    T1_DecoderRec  decoder;\r\n    CID_Face       face = (CID_Face)cidglyph->face;\r\n    FT_Bool        hinting;\r\n\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n    FT_Matrix      font_matrix;\r\n    FT_Vector      font_offset;\r\n\r\n\r\n    if ( glyph_index >= (FT_UInt)face->root.num_glyphs )\r\n    {\r\n      error = CID_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( load_flags & FT_LOAD_NO_RECURSE )\r\n      load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;\r\n\r\n    glyph->x_scale = cidsize->metrics.x_scale;\r\n    glyph->y_scale = cidsize->metrics.y_scale;\r\n\r\n    cidglyph->outline.n_points   = 0;\r\n    cidglyph->outline.n_contours = 0;\r\n\r\n    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 &&\r\n                       ( load_flags & FT_LOAD_NO_HINTING ) == 0 );\r\n\r\n    cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;\r\n\r\n    error = psaux->t1_decoder_funcs->init( &decoder,\r\n                                           cidglyph->face,\r\n                                           cidsize,\r\n                                           cidglyph,\r\n                                           0, /* glyph names -- XXX */\r\n                                           0, /* blend == 0 */\r\n                                           hinting,\r\n                                           FT_LOAD_TARGET_MODE( load_flags ),\r\n                                           cid_load_glyph );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* TODO: initialize decoder.len_buildchar and decoder.buildchar */\r\n    /*       if we ever support CID-keyed multiple master fonts     */\r\n\r\n    /* set up the decoder */\r\n    decoder.builder.no_recurse = FT_BOOL(\r\n      ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );\r\n\r\n    error = cid_load_glyph( &decoder, glyph_index );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    font_matrix = decoder.font_matrix;\r\n    font_offset = decoder.font_offset;\r\n\r\n    /* save new glyph tables */\r\n    psaux->t1_decoder_funcs->done( &decoder );\r\n\r\n    /* now set the metrics -- this is rather simple, as    */\r\n    /* the left side bearing is the xMin, and the top side */\r\n    /* bearing the yMax                                    */\r\n    cidglyph->outline.flags &= FT_OUTLINE_OWNER;\r\n    cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;\r\n\r\n    /* for composite glyphs, return only left side bearing and */\r\n    /* advance width                                           */\r\n    if ( load_flags & FT_LOAD_NO_RECURSE )\r\n    {\r\n      FT_Slot_Internal  internal = cidglyph->internal;\r\n\r\n\r\n      cidglyph->metrics.horiBearingX =\r\n        FIXED_TO_INT( decoder.builder.left_bearing.x );\r\n      cidglyph->metrics.horiAdvance =\r\n        FIXED_TO_INT( decoder.builder.advance.x );\r\n\r\n      internal->glyph_matrix      = font_matrix;\r\n      internal->glyph_delta       = font_offset;\r\n      internal->glyph_transformed = 1;\r\n    }\r\n    else\r\n    {\r\n      FT_BBox            cbox;\r\n      FT_Glyph_Metrics*  metrics = &cidglyph->metrics;\r\n      FT_Vector          advance;\r\n\r\n\r\n      /* copy the _unscaled_ advance width */\r\n      metrics->horiAdvance =\r\n        FIXED_TO_INT( decoder.builder.advance.x );\r\n      cidglyph->linearHoriAdvance =\r\n        FIXED_TO_INT( decoder.builder.advance.x );\r\n      cidglyph->internal->glyph_transformed = 0;\r\n\r\n      /* make up vertical ones */\r\n      metrics->vertAdvance        = ( face->cid.font_bbox.yMax -\r\n                                      face->cid.font_bbox.yMin ) >> 16;\r\n      cidglyph->linearVertAdvance = metrics->vertAdvance;\r\n\r\n      cidglyph->format            = FT_GLYPH_FORMAT_OUTLINE;\r\n\r\n      if ( cidsize->metrics.y_ppem < 24 )\r\n        cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;\r\n\r\n      /* apply the font matrix */\r\n      FT_Outline_Transform( &cidglyph->outline, &font_matrix );\r\n\r\n      FT_Outline_Translate( &cidglyph->outline,\r\n                            font_offset.x,\r\n                            font_offset.y );\r\n\r\n      advance.x = metrics->horiAdvance;\r\n      advance.y = 0;\r\n      FT_Vector_Transform( &advance, &font_matrix );\r\n      metrics->horiAdvance = advance.x + font_offset.x;\r\n\r\n      advance.x = 0;\r\n      advance.y = metrics->vertAdvance;\r\n      FT_Vector_Transform( &advance, &font_matrix );\r\n      metrics->vertAdvance = advance.y + font_offset.y;\r\n\r\n      if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n      {\r\n        /* scale the outline and the metrics */\r\n        FT_Int       n;\r\n        FT_Outline*  cur = decoder.builder.base;\r\n        FT_Vector*   vec = cur->points;\r\n        FT_Fixed     x_scale = glyph->x_scale;\r\n        FT_Fixed     y_scale = glyph->y_scale;\r\n\r\n\r\n        /* First of all, scale the points */\r\n        if ( !hinting || !decoder.builder.hints_funcs )\r\n          for ( n = cur->n_points; n > 0; n--, vec++ )\r\n          {\r\n            vec->x = FT_MulFix( vec->x, x_scale );\r\n            vec->y = FT_MulFix( vec->y, y_scale );\r\n          }\r\n\r\n        /* Then scale the metrics */\r\n        metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );\r\n        metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );\r\n      }\r\n\r\n      /* compute the other metrics */\r\n      FT_Outline_Get_CBox( &cidglyph->outline, &cbox );\r\n\r\n      metrics->width  = cbox.xMax - cbox.xMin;\r\n      metrics->height = cbox.yMax - cbox.yMin;\r\n\r\n      metrics->horiBearingX = cbox.xMin;\r\n      metrics->horiBearingY = cbox.yMax;\r\n\r\n      if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n      {\r\n        /* make up vertical ones */\r\n        ft_synthesize_vertical_metrics( metrics,\r\n                                        metrics->vertAdvance );\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidgload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidgload.h                                                             */\r\n/*                                                                         */\r\n/*    OpenType Glyph Loader (specification).                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CIDGLOAD_H__\r\n#define __CIDGLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"cidobjs.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#if 0\r\n\r\n  /* Compute the maximum advance width of a font through quick parsing */\r\n  FT_LOCAL( FT_Error )\r\n  cid_face_compute_max_advance( CID_Face  face,\r\n                                FT_Int*   max_advance );\r\n\r\n#endif /* 0 */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_slot_load_glyph( FT_GlyphSlot  glyph,         /* CID_Glyph_Slot */\r\n                       FT_Size       size,          /* CID_Size       */\r\n                       FT_UInt       glyph_index,\r\n                       FT_Int32      load_flags );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CIDGLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidload.c                                                              */\r\n/*                                                                         */\r\n/*    CID-keyed Type1 font loader (body).                                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2009, 2011-2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_MULTIPLE_MASTERS_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\n#include \"cidload.h\"\r\n\r\n#include \"ciderrs.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cidload\r\n\r\n\r\n  /* read a single offset */\r\n  FT_LOCAL_DEF( FT_Long )\r\n  cid_get_offset( FT_Byte*  *start,\r\n                  FT_Byte    offsize )\r\n  {\r\n    FT_Long   result;\r\n    FT_Byte*  p = *start;\r\n\r\n\r\n    for ( result = 0; offsize > 0; offsize-- )\r\n    {\r\n      result <<= 8;\r\n      result  |= *p++;\r\n    }\r\n\r\n    *start = p;\r\n    return result;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    TYPE 1 SYMBOL PARSING                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  static FT_Error\r\n  cid_load_keyword( CID_Face        face,\r\n                    CID_Loader*     loader,\r\n                    const T1_Field  keyword )\r\n  {\r\n    FT_Error      error;\r\n    CID_Parser*   parser = &loader->parser;\r\n    FT_Byte*      object;\r\n    void*         dummy_object;\r\n    CID_FaceInfo  cid = &face->cid;\r\n\r\n\r\n    /* if the keyword has a dedicated callback, call it */\r\n    if ( keyword->type == T1_FIELD_TYPE_CALLBACK )\r\n    {\r\n      keyword->reader( (FT_Face)face, parser );\r\n      error = parser->root.error;\r\n      goto Exit;\r\n    }\r\n\r\n    /* we must now compute the address of our target object */\r\n    switch ( keyword->location )\r\n    {\r\n    case T1_FIELD_LOCATION_CID_INFO:\r\n      object = (FT_Byte*)cid;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_FONT_INFO:\r\n      object = (FT_Byte*)&cid->font_info;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_FONT_EXTRA:\r\n      object = (FT_Byte*)&face->font_extra;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_BBOX:\r\n      object = (FT_Byte*)&cid->font_bbox;\r\n      break;\r\n\r\n    default:\r\n      {\r\n        CID_FaceDict  dict;\r\n\r\n\r\n        if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts )\r\n        {\r\n          FT_ERROR(( \"cid_load_keyword: invalid use of `%s'\\n\",\r\n                     keyword->ident ));\r\n          error = CID_Err_Syntax_Error;\r\n          goto Exit;\r\n        }\r\n\r\n        dict = cid->font_dicts + parser->num_dict;\r\n        switch ( keyword->location )\r\n        {\r\n        case T1_FIELD_LOCATION_PRIVATE:\r\n          object = (FT_Byte*)&dict->private_dict;\r\n          break;\r\n\r\n        default:\r\n          object = (FT_Byte*)dict;\r\n        }\r\n      }\r\n    }\r\n\r\n    dummy_object = object;\r\n\r\n    /* now, load the keyword data in the object's field(s) */\r\n    if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY ||\r\n         keyword->type == T1_FIELD_TYPE_FIXED_ARRAY   )\r\n      error = cid_parser_load_field_table( &loader->parser, keyword,\r\n                                           &dummy_object );\r\n    else\r\n      error = cid_parser_load_field( &loader->parser,\r\n                                     keyword, &dummy_object );\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  cid_parse_font_matrix( CID_Face     face,\r\n                         CID_Parser*  parser )\r\n  {\r\n    FT_Matrix*    matrix;\r\n    FT_Vector*    offset;\r\n    CID_FaceDict  dict;\r\n    FT_Face       root = (FT_Face)&face->root;\r\n    FT_Fixed      temp[6];\r\n    FT_Fixed      temp_scale;\r\n\r\n\r\n    if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )\r\n    {\r\n      dict   = face->cid.font_dicts + parser->num_dict;\r\n      matrix = &dict->font_matrix;\r\n      offset = &dict->font_offset;\r\n\r\n      (void)cid_parser_to_fixed_array( parser, 6, temp, 3 );\r\n\r\n      temp_scale = FT_ABS( temp[3] );\r\n\r\n      /* Set Units per EM based on FontMatrix values.  We set the value to */\r\n      /* 1000 / temp_scale, because temp_scale was already multiplied by   */\r\n      /* 1000 (in t1_tofixed, from psobjs.c).                              */\r\n\r\n      root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );\r\n\r\n      /* we need to scale the values by 1.0/temp[3] */\r\n      if ( temp_scale != 0x10000L )\r\n      {\r\n        temp[0] = FT_DivFix( temp[0], temp_scale );\r\n        temp[1] = FT_DivFix( temp[1], temp_scale );\r\n        temp[2] = FT_DivFix( temp[2], temp_scale );\r\n        temp[4] = FT_DivFix( temp[4], temp_scale );\r\n        temp[5] = FT_DivFix( temp[5], temp_scale );\r\n        temp[3] = 0x10000L;\r\n      }\r\n\r\n      matrix->xx = temp[0];\r\n      matrix->yx = temp[1];\r\n      matrix->xy = temp[2];\r\n      matrix->yy = temp[3];\r\n\r\n      /* note that the font offsets are expressed in integer font units */\r\n      offset->x  = temp[4] >> 16;\r\n      offset->y  = temp[5] >> 16;\r\n    }\r\n\r\n    return CID_Err_Ok;      /* this is a callback function; */\r\n                            /* we must return an error code */\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  parse_fd_array( CID_Face     face,\r\n                  CID_Parser*  parser )\r\n  {\r\n    CID_FaceInfo  cid    = &face->cid;\r\n    FT_Memory     memory = face->root.memory;\r\n    FT_Error      error  = CID_Err_Ok;\r\n    FT_Long       num_dicts;\r\n\r\n\r\n    num_dicts = cid_parser_to_int( parser );\r\n\r\n    if ( !cid->font_dicts )\r\n    {\r\n      FT_Int  n;\r\n\r\n\r\n      if ( FT_NEW_ARRAY( cid->font_dicts, num_dicts ) )\r\n        goto Exit;\r\n\r\n      cid->num_dicts = (FT_UInt)num_dicts;\r\n\r\n      /* don't forget to set a few defaults */\r\n      for ( n = 0; n < cid->num_dicts; n++ )\r\n      {\r\n        CID_FaceDict  dict = cid->font_dicts + n;\r\n\r\n\r\n        /* default value for lenIV */\r\n        dict->private_dict.lenIV = 4;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* by mistake, `expansion_factor' appears both in PS_PrivateRec */\r\n  /* and CID_FaceDictRec (both are public header files and can't  */\r\n  /* changed); we simply copy the value                           */\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  parse_expansion_factor( CID_Face     face,\r\n                          CID_Parser*  parser )\r\n  {\r\n    CID_FaceDict  dict;\r\n\r\n\r\n    if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )\r\n    {\r\n      dict = face->cid.font_dicts + parser->num_dict;\r\n\r\n      dict->expansion_factor              = cid_parser_to_fixed( parser, 0 );\r\n      dict->private_dict.expansion_factor = dict->expansion_factor;\r\n    }\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n\r\n  static\r\n  const T1_FieldRec  cid_field_records[] =\r\n  {\r\n\r\n#include \"cidtoken.h\"\r\n\r\n    T1_FIELD_CALLBACK( \"FDArray\",         parse_fd_array, 0 )\r\n    T1_FIELD_CALLBACK( \"FontMatrix\",      cid_parse_font_matrix, 0 )\r\n    T1_FIELD_CALLBACK( \"ExpansionFactor\", parse_expansion_factor, 0 )\r\n\r\n    { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }\r\n  };\r\n\r\n\r\n  static FT_Error\r\n  cid_parse_dict( CID_Face     face,\r\n                  CID_Loader*  loader,\r\n                  FT_Byte*     base,\r\n                  FT_Long      size )\r\n  {\r\n    CID_Parser*  parser = &loader->parser;\r\n\r\n\r\n    parser->root.cursor = base;\r\n    parser->root.limit  = base + size;\r\n    parser->root.error  = CID_Err_Ok;\r\n\r\n    {\r\n      FT_Byte*  cur   = base;\r\n      FT_Byte*  limit = cur + size;\r\n\r\n\r\n      for (;;)\r\n      {\r\n        FT_Byte*  newlimit;\r\n\r\n\r\n        parser->root.cursor = cur;\r\n        cid_parser_skip_spaces( parser );\r\n\r\n        if ( parser->root.cursor >= limit )\r\n          newlimit = limit - 1 - 17;\r\n        else\r\n          newlimit = parser->root.cursor - 17;\r\n\r\n        /* look for `%ADOBeginFontDict' */\r\n        for ( ; cur < newlimit; cur++ )\r\n        {\r\n          if ( *cur == '%'                                            &&\r\n               ft_strncmp( (char*)cur, \"%ADOBeginFontDict\", 17 ) == 0 )\r\n          {\r\n            /* if /FDArray was found, then cid->num_dicts is > 0, and */\r\n            /* we can start increasing parser->num_dict               */\r\n            if ( face->cid.num_dicts > 0 )\r\n              parser->num_dict++;\r\n          }\r\n        }\r\n\r\n        cur = parser->root.cursor;\r\n        /* no error can occur in cid_parser_skip_spaces */\r\n        if ( cur >= limit )\r\n          break;\r\n\r\n        cid_parser_skip_PS_token( parser );\r\n        if ( parser->root.cursor >= limit || parser->root.error )\r\n          break;\r\n\r\n        /* look for immediates */\r\n        if ( *cur == '/' && cur + 2 < limit )\r\n        {\r\n          FT_PtrDist  len;\r\n\r\n\r\n          cur++;\r\n          len = parser->root.cursor - cur;\r\n\r\n          if ( len > 0 && len < 22 )\r\n          {\r\n            /* now compare the immediate name to the keyword table */\r\n            T1_Field  keyword = (T1_Field)cid_field_records;\r\n\r\n\r\n            for (;;)\r\n            {\r\n              FT_Byte*  name;\r\n\r\n\r\n              name = (FT_Byte*)keyword->ident;\r\n              if ( !name )\r\n                break;\r\n\r\n              if ( cur[0] == name[0]                                 &&\r\n                   len == (FT_PtrDist)ft_strlen( (const char*)name ) )\r\n              {\r\n                FT_PtrDist  n;\r\n\r\n\r\n                for ( n = 1; n < len; n++ )\r\n                  if ( cur[n] != name[n] )\r\n                    break;\r\n\r\n                if ( n >= len )\r\n                {\r\n                  /* we found it - run the parsing callback */\r\n                  parser->root.error = cid_load_keyword( face,\r\n                                                         loader,\r\n                                                         keyword );\r\n                  if ( parser->root.error )\r\n                    return parser->root.error;\r\n                  break;\r\n                }\r\n              }\r\n              keyword++;\r\n            }\r\n          }\r\n        }\r\n\r\n        cur = parser->root.cursor;\r\n      }\r\n    }\r\n    return parser->root.error;\r\n  }\r\n\r\n\r\n  /* read the subrmap and the subrs of each font dict */\r\n  static FT_Error\r\n  cid_read_subrs( CID_Face  face )\r\n  {\r\n    CID_FaceInfo   cid    = &face->cid;\r\n    FT_Memory      memory = face->root.memory;\r\n    FT_Stream      stream = face->cid_stream;\r\n    FT_Error       error;\r\n    FT_Int         n;\r\n    CID_Subrs      subr;\r\n    FT_UInt        max_offsets = 0;\r\n    FT_ULong*      offsets = 0;\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n\r\n\r\n    if ( FT_NEW_ARRAY( face->subrs, cid->num_dicts ) )\r\n      goto Exit;\r\n\r\n    subr = face->subrs;\r\n    for ( n = 0; n < cid->num_dicts; n++, subr++ )\r\n    {\r\n      CID_FaceDict  dict  = cid->font_dicts + n;\r\n      FT_Int        lenIV = dict->private_dict.lenIV;\r\n      FT_UInt       count, num_subrs = dict->num_subrs;\r\n      FT_ULong      data_len;\r\n      FT_Byte*      p;\r\n\r\n\r\n      /* Check for possible overflow. */\r\n      if ( num_subrs == FT_UINT_MAX )\r\n      {\r\n        error = CID_Err_Syntax_Error;\r\n        goto Fail;\r\n      }\r\n\r\n      /* reallocate offsets array if needed */\r\n      if ( num_subrs + 1 > max_offsets )\r\n      {\r\n        FT_UInt  new_max = FT_PAD_CEIL( num_subrs + 1, 4 );\r\n\r\n\r\n        if ( new_max <= max_offsets )\r\n        {\r\n          error = CID_Err_Syntax_Error;\r\n          goto Fail;\r\n        }\r\n\r\n        if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )\r\n          goto Fail;\r\n\r\n        max_offsets = new_max;\r\n      }\r\n\r\n      /* read the subrmap's offsets */\r\n      if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||\r\n           FT_FRAME_ENTER( ( num_subrs + 1 ) * dict->sd_bytes )      )\r\n        goto Fail;\r\n\r\n      p = (FT_Byte*)stream->cursor;\r\n      for ( count = 0; count <= num_subrs; count++ )\r\n        offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );\r\n\r\n      FT_FRAME_EXIT();\r\n\r\n      /* offsets must be ordered */\r\n      for ( count = 1; count <= num_subrs; count++ )\r\n        if ( offsets[count - 1] > offsets[count] )\r\n          goto Fail;\r\n\r\n      /* now, compute the size of subrs charstrings, */\r\n      /* allocate, and read them                     */\r\n      data_len = offsets[num_subrs] - offsets[0];\r\n\r\n      if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||\r\n               FT_ALLOC( subr->code[0], data_len )   )\r\n        goto Fail;\r\n\r\n      if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||\r\n           FT_STREAM_READ( subr->code[0], data_len )  )\r\n        goto Fail;\r\n\r\n      /* set up pointers */\r\n      for ( count = 1; count <= num_subrs; count++ )\r\n      {\r\n        FT_ULong  len;\r\n\r\n\r\n        len               = offsets[count] - offsets[count - 1];\r\n        subr->code[count] = subr->code[count - 1] + len;\r\n      }\r\n\r\n      /* decrypt subroutines, but only if lenIV >= 0 */\r\n      if ( lenIV >= 0 )\r\n      {\r\n        for ( count = 0; count < num_subrs; count++ )\r\n        {\r\n          FT_ULong  len;\r\n\r\n\r\n          len = offsets[count + 1] - offsets[count];\r\n          psaux->t1_decrypt( subr->code[count], len, 4330 );\r\n        }\r\n      }\r\n\r\n      subr->num_subrs = num_subrs;\r\n    }\r\n\r\n  Exit:\r\n    FT_FREE( offsets );\r\n    return error;\r\n\r\n  Fail:\r\n    if ( face->subrs )\r\n    {\r\n      for ( n = 0; n < cid->num_dicts; n++ )\r\n      {\r\n        if ( face->subrs[n].code )\r\n          FT_FREE( face->subrs[n].code[0] );\r\n\r\n        FT_FREE( face->subrs[n].code );\r\n      }\r\n      FT_FREE( face->subrs );\r\n    }\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  static void\r\n  cid_init_loader( CID_Loader*  loader,\r\n                   CID_Face     face )\r\n  {\r\n    FT_UNUSED( face );\r\n\r\n    FT_MEM_ZERO( loader, sizeof ( *loader ) );\r\n  }\r\n\r\n\r\n  static  void\r\n  cid_done_loader( CID_Loader*  loader )\r\n  {\r\n    CID_Parser*  parser = &loader->parser;\r\n\r\n\r\n    /* finalize parser */\r\n    cid_parser_done( parser );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cid_hex_to_binary( FT_Byte*  data,\r\n                     FT_Long   data_len,\r\n                     FT_ULong  offset,\r\n                     CID_Face  face )\r\n  {\r\n    FT_Stream  stream = face->root.stream;\r\n    FT_Error   error;\r\n\r\n    FT_Byte    buffer[256];\r\n    FT_Byte   *p, *plimit;\r\n    FT_Byte   *d, *dlimit;\r\n    FT_Byte    val;\r\n\r\n    FT_Bool    upper_nibble, done;\r\n\r\n\r\n    if ( FT_STREAM_SEEK( offset ) )\r\n      goto Exit;\r\n\r\n    d      = data;\r\n    dlimit = d + data_len;\r\n    p      = buffer;\r\n    plimit = p;\r\n\r\n    upper_nibble = 1;\r\n    done         = 0;\r\n\r\n    while ( d < dlimit )\r\n    {\r\n      if ( p >= plimit )\r\n      {\r\n        FT_ULong  oldpos = FT_STREAM_POS();\r\n        FT_ULong  size   = stream->size - oldpos;\r\n\r\n\r\n        if ( size == 0 )\r\n        {\r\n          error = CID_Err_Syntax_Error;\r\n          goto Exit;\r\n        }\r\n\r\n        if ( FT_STREAM_READ( buffer, 256 > size ? size : 256 ) )\r\n          goto Exit;\r\n        p      = buffer;\r\n        plimit = p + FT_STREAM_POS() - oldpos;\r\n      }\r\n\r\n      if ( ft_isdigit( *p ) )\r\n        val = (FT_Byte)( *p - '0' );\r\n      else if ( *p >= 'a' && *p <= 'f' )\r\n        val = (FT_Byte)( *p - 'a' );\r\n      else if ( *p >= 'A' && *p <= 'F' )\r\n        val = (FT_Byte)( *p - 'A' + 10 );\r\n      else if ( *p == ' '  ||\r\n                *p == '\\t' ||\r\n                *p == '\\r' ||\r\n                *p == '\\n' ||\r\n                *p == '\\f' ||\r\n                *p == '\\0' )\r\n      {\r\n        p++;\r\n        continue;\r\n      }\r\n      else if ( *p == '>' )\r\n      {\r\n        val  = 0;\r\n        done = 1;\r\n      }\r\n      else\r\n      {\r\n        error = CID_Err_Syntax_Error;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( upper_nibble )\r\n        *d = (FT_Byte)( val << 4 );\r\n      else\r\n      {\r\n        *d = (FT_Byte)( *d + val );\r\n        d++;\r\n      }\r\n\r\n      upper_nibble = (FT_Byte)( 1 - upper_nibble );\r\n\r\n      if ( done )\r\n        break;\r\n\r\n      p++;\r\n    }\r\n\r\n    error = CID_Err_Ok;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_face_open( CID_Face  face,\r\n                 FT_Int    face_index )\r\n  {\r\n    CID_Loader   loader;\r\n    CID_Parser*  parser;\r\n    FT_Memory    memory = face->root.memory;\r\n    FT_Error     error;\r\n\r\n\r\n    cid_init_loader( &loader, face );\r\n\r\n    parser = &loader.parser;\r\n    error = cid_parser_new( parser, face->root.stream, face->root.memory,\r\n                            (PSAux_Service)face->psaux );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = cid_parse_dict( face, &loader,\r\n                            parser->postscript,\r\n                            parser->postscript_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( face_index < 0 )\r\n      goto Exit;\r\n\r\n    if ( FT_NEW( face->cid_stream ) )\r\n      goto Exit;\r\n\r\n    if ( parser->binary_length )\r\n    {\r\n      /* we must convert the data section from hexadecimal to binary */\r\n      if ( FT_ALLOC( face->binary_data, parser->binary_length )         ||\r\n           cid_hex_to_binary( face->binary_data, parser->binary_length,\r\n                              parser->data_offset, face )               )\r\n        goto Exit;\r\n\r\n      FT_Stream_OpenMemory( face->cid_stream,\r\n                            face->binary_data, parser->binary_length );\r\n      face->cid.data_offset = 0;\r\n    }\r\n    else\r\n    {\r\n      *face->cid_stream     = *face->root.stream;\r\n      face->cid.data_offset = loader.parser.data_offset;\r\n    }\r\n\r\n    error = cid_read_subrs( face );\r\n\r\n  Exit:\r\n    cid_done_loader( &loader );\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidload.h                                                              */\r\n/*                                                                         */\r\n/*    CID-keyed Type1 font loader (specification).                         */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CIDLOAD_H__\r\n#define __CIDLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_STREAM_H\r\n#include \"cidparse.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef struct  CID_Loader_\r\n  {\r\n    CID_Parser  parser;          /* parser used to read the stream */\r\n    FT_Int      num_chars;       /* number of characters in encoding */\r\n\r\n  } CID_Loader;\r\n\r\n\r\n  FT_LOCAL( FT_Long )\r\n  cid_get_offset( FT_Byte**  start,\r\n                  FT_Byte    offsize );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_face_open( CID_Face  face,\r\n                 FT_Int    face_index );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CIDLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidobjs.c                                                              */\r\n/*                                                                         */\r\n/*    CID objects manager (body).                                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2008, 2010-2011 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n#include \"cidgload.h\"\r\n#include \"cidload.h\"\r\n\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n#include \"ciderrs.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cidobjs\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            SLOT  FUNCTIONS                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cid_slot_done( FT_GlyphSlot  slot )\r\n  {\r\n    slot->internal->glyph_hints = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_slot_init( FT_GlyphSlot  slot )\r\n  {\r\n    CID_Face          face;\r\n    PSHinter_Service  pshinter;\r\n\r\n\r\n    face     = (CID_Face)slot->face;\r\n    pshinter = (PSHinter_Service)face->pshinter;\r\n\r\n    if ( pshinter )\r\n    {\r\n      FT_Module  module;\r\n\r\n\r\n      module = FT_Get_Module( slot->face->driver->root.library,\r\n                              \"pshinter\" );\r\n      if ( module )\r\n      {\r\n        T1_Hints_Funcs  funcs;\r\n\r\n\r\n        funcs = pshinter->get_t1_funcs( module );\r\n        slot->internal->glyph_hints = (void*)funcs;\r\n      }\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                           SIZE  FUNCTIONS                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static PSH_Globals_Funcs\r\n  cid_size_get_globals_funcs( CID_Size  size )\r\n  {\r\n    CID_Face          face     = (CID_Face)size->root.face;\r\n    PSHinter_Service  pshinter = (PSHinter_Service)face->pshinter;\r\n    FT_Module         module;\r\n\r\n\r\n    module = FT_Get_Module( size->root.face->driver->root.library,\r\n                            \"pshinter\" );\r\n    return ( module && pshinter && pshinter->get_globals_funcs )\r\n           ? pshinter->get_globals_funcs( module )\r\n           : 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cid_size_done( FT_Size  cidsize )         /* CID_Size */\r\n  {\r\n    CID_Size  size = (CID_Size)cidsize;\r\n\r\n\r\n    if ( cidsize->internal )\r\n    {\r\n      PSH_Globals_Funcs  funcs;\r\n\r\n\r\n      funcs = cid_size_get_globals_funcs( size );\r\n      if ( funcs )\r\n        funcs->destroy( (PSH_Globals)cidsize->internal );\r\n\r\n      cidsize->internal = 0;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_size_init( FT_Size  cidsize )     /* CID_Size */\r\n  {\r\n    CID_Size           size  = (CID_Size)cidsize;\r\n    FT_Error           error = CID_Err_Ok;\r\n    PSH_Globals_Funcs  funcs = cid_size_get_globals_funcs( size );\r\n\r\n\r\n    if ( funcs )\r\n    {\r\n      PSH_Globals   globals;\r\n      CID_Face      face = (CID_Face)cidsize->face;\r\n      CID_FaceDict  dict = face->cid.font_dicts + face->root.face_index;\r\n      PS_Private    priv = &dict->private_dict;\r\n\r\n\r\n      error = funcs->create( cidsize->face->memory, priv, &globals );\r\n      if ( !error )\r\n        cidsize->internal = (FT_Size_Internal)(void*)globals;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_size_request( FT_Size          size,\r\n                    FT_Size_Request  req )\r\n  {\r\n    PSH_Globals_Funcs  funcs;\r\n\r\n\r\n    FT_Request_Metrics( size->face, req );\r\n\r\n    funcs = cid_size_get_globals_funcs( (CID_Size)size );\r\n\r\n    if ( funcs )\r\n      funcs->set_scale( (PSH_Globals)size->internal,\r\n                        size->metrics.x_scale,\r\n                        size->metrics.y_scale,\r\n                        0, 0 );\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                           FACE  FUNCTIONS                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cid_face_done                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalizes a given face object.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A pointer to the face object to destroy.                   */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  cid_face_done( FT_Face  cidface )         /* CID_Face */\r\n  {\r\n    CID_Face      face = (CID_Face)cidface;\r\n    FT_Memory     memory;\r\n    CID_FaceInfo  cid;\r\n    PS_FontInfo   info;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    cid    = &face->cid;\r\n    info   = &cid->font_info;\r\n    memory = cidface->memory;\r\n\r\n    /* release subrs */\r\n    if ( face->subrs )\r\n    {\r\n      FT_Int  n;\r\n\r\n\r\n      for ( n = 0; n < cid->num_dicts; n++ )\r\n      {\r\n        CID_Subrs  subr = face->subrs + n;\r\n\r\n\r\n        if ( subr->code )\r\n        {\r\n          FT_FREE( subr->code[0] );\r\n          FT_FREE( subr->code );\r\n        }\r\n      }\r\n\r\n      FT_FREE( face->subrs );\r\n    }\r\n\r\n    /* release FontInfo strings */\r\n    FT_FREE( info->version );\r\n    FT_FREE( info->notice );\r\n    FT_FREE( info->full_name );\r\n    FT_FREE( info->family_name );\r\n    FT_FREE( info->weight );\r\n\r\n    /* release font dictionaries */\r\n    FT_FREE( cid->font_dicts );\r\n    cid->num_dicts = 0;\r\n\r\n    /* release other strings */\r\n    FT_FREE( cid->cid_font_name );\r\n    FT_FREE( cid->registry );\r\n    FT_FREE( cid->ordering );\r\n\r\n    cidface->family_name = 0;\r\n    cidface->style_name  = 0;\r\n\r\n    FT_FREE( face->binary_data );\r\n    FT_FREE( face->cid_stream );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cid_face_init                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given CID face object.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     :: The source font stream.                              */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the font face in the resource.          */\r\n  /*                                                                       */\r\n  /*    num_params :: Number of additional generic parameters.  Ignored.   */\r\n  /*                                                                       */\r\n  /*    params     :: Additional generic parameters.  Ignored.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The newly built face object.                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_face_init( FT_Stream      stream,\r\n                 FT_Face        cidface,        /* CID_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    CID_Face          face = (CID_Face)cidface;\r\n    FT_Error          error;\r\n    PSAux_Service     psaux;\r\n    PSHinter_Service  pshinter;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    cidface->num_faces = 1;\r\n\r\n    psaux = (PSAux_Service)face->psaux;\r\n    if ( !psaux )\r\n    {\r\n      psaux = (PSAux_Service)FT_Get_Module_Interface(\r\n                FT_FACE_LIBRARY( face ), \"psaux\" );\r\n\r\n      if ( !psaux )\r\n      {\r\n        FT_ERROR(( \"cid_face_init: cannot access `psaux' module\\n\" ));\r\n        error = CID_Err_Missing_Module;\r\n        goto Exit;\r\n      }\r\n\r\n      face->psaux = psaux;\r\n    }\r\n\r\n    pshinter = (PSHinter_Service)face->pshinter;\r\n    if ( !pshinter )\r\n    {\r\n      pshinter = (PSHinter_Service)FT_Get_Module_Interface(\r\n                   FT_FACE_LIBRARY( face ), \"pshinter\" );\r\n\r\n      face->pshinter = pshinter;\r\n    }\r\n\r\n    FT_TRACE2(( \"CID driver\\n\" ));\r\n\r\n    /* open the tokenizer; this will also check the font format */\r\n    if ( FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    error = cid_face_open( face, face_index );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* if we just wanted to check the format, leave successfully now */\r\n    if ( face_index < 0 )\r\n      goto Exit;\r\n\r\n    /* check the face index */\r\n    /* XXX: handle CID fonts with more than a single face */\r\n    if ( face_index != 0 )\r\n    {\r\n      FT_ERROR(( \"cid_face_init: invalid face index\\n\" ));\r\n      error = CID_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now load the font program into the face object */\r\n\r\n    /* initialize the face object fields */\r\n\r\n    /* set up root face fields */\r\n    {\r\n      CID_FaceInfo  cid  = &face->cid;\r\n      PS_FontInfo   info = &cid->font_info;\r\n\r\n\r\n      cidface->num_glyphs   = cid->cid_count;\r\n      cidface->num_charmaps = 0;\r\n\r\n      cidface->face_index = face_index;\r\n      cidface->face_flags = FT_FACE_FLAG_SCALABLE   | /* scalable outlines */\r\n                            FT_FACE_FLAG_HORIZONTAL | /* horizontal data   */\r\n                            FT_FACE_FLAG_HINTER;      /* has native hinter */\r\n\r\n      if ( info->is_fixed_pitch )\r\n        cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      /* XXX: TODO: add kerning with .afm support */\r\n\r\n      /* get style name -- be careful, some broken fonts only */\r\n      /* have a /FontName dictionary entry!                   */\r\n      cidface->family_name = info->family_name;\r\n      /* assume \"Regular\" style if we don't know better */\r\n      cidface->style_name = (char *)\"Regular\";\r\n      if ( cidface->family_name )\r\n      {\r\n        char*  full   = info->full_name;\r\n        char*  family = cidface->family_name;\r\n\r\n\r\n        if ( full )\r\n        {\r\n          while ( *full )\r\n          {\r\n            if ( *full == *family )\r\n            {\r\n              family++;\r\n              full++;\r\n            }\r\n            else\r\n            {\r\n              if ( *full == ' ' || *full == '-' )\r\n                full++;\r\n              else if ( *family == ' ' || *family == '-' )\r\n                family++;\r\n              else\r\n              {\r\n                if ( !*family )\r\n                  cidface->style_name = full;\r\n                break;\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n      else\r\n      {\r\n        /* do we have a `/FontName'? */\r\n        if ( cid->cid_font_name )\r\n          cidface->family_name = cid->cid_font_name;\r\n      }\r\n\r\n      /* compute style flags */\r\n      cidface->style_flags = 0;\r\n      if ( info->italic_angle )\r\n        cidface->style_flags |= FT_STYLE_FLAG_ITALIC;\r\n      if ( info->weight )\r\n      {\r\n        if ( !ft_strcmp( info->weight, \"Bold\"  ) ||\r\n             !ft_strcmp( info->weight, \"Black\" ) )\r\n          cidface->style_flags |= FT_STYLE_FLAG_BOLD;\r\n      }\r\n\r\n      /* no embedded bitmap support */\r\n      cidface->num_fixed_sizes = 0;\r\n      cidface->available_sizes = 0;\r\n\r\n      cidface->bbox.xMin =   cid->font_bbox.xMin            >> 16;\r\n      cidface->bbox.yMin =   cid->font_bbox.yMin            >> 16;\r\n      /* no `U' suffix here to 0xFFFF! */\r\n      cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;\r\n      cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;\r\n\r\n      if ( !cidface->units_per_EM )\r\n        cidface->units_per_EM = 1000;\r\n\r\n      cidface->ascender  = (FT_Short)( cidface->bbox.yMax );\r\n      cidface->descender = (FT_Short)( cidface->bbox.yMin );\r\n\r\n      cidface->height = (FT_Short)( ( cidface->units_per_EM * 12 ) / 10 );\r\n      if ( cidface->height < cidface->ascender - cidface->descender )\r\n        cidface->height = (FT_Short)( cidface->ascender - cidface->descender );\r\n\r\n      cidface->underline_position  = (FT_Short)info->underline_position;\r\n      cidface->underline_thickness = (FT_Short)info->underline_thickness;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cid_driver_init                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given CID driver object.                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target driver object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_driver_init( FT_Module  driver )\r\n  {\r\n    FT_UNUSED( driver );\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    cid_driver_done                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalizes a given CID driver.                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target CID driver.                       */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  cid_driver_done( FT_Module  driver )\r\n  {\r\n    FT_UNUSED( driver );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidobjs.h                                                              */\r\n/*                                                                         */\r\n/*    CID objects manager (specification).                                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2006 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CIDOBJS_H__\r\n#define __CIDOBJS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* The following structures must be defined by the hinter */\r\n  typedef struct CID_Size_Hints_   CID_Size_Hints;\r\n  typedef struct CID_Glyph_Hints_  CID_Glyph_Hints;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CID_Driver                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 driver object.                                */\r\n  /*                                                                       */\r\n  typedef struct CID_DriverRec_*  CID_Driver;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CID_Size                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 size object.                                  */\r\n  /*                                                                       */\r\n  typedef struct CID_SizeRec_*  CID_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CID_GlyphSlot                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 glyph slot object.                            */\r\n  /*                                                                       */\r\n  typedef struct CID_GlyphSlotRec_*  CID_GlyphSlot;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    CID_CharMap                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 character mapping object.                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The Type 1 format doesn't use a charmap but an encoding table.     */\r\n  /*    The driver is responsible for making up charmap objects            */\r\n  /*    corresponding to these tables.                                     */\r\n  /*                                                                       */\r\n  typedef struct CID_CharMapRec_*  CID_CharMap;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* HERE BEGINS THE TYPE 1 SPECIFIC STUFF                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct  CID_SizeRec_\r\n  {\r\n    FT_SizeRec  root;\r\n    FT_Bool     valid;\r\n\r\n  } CID_SizeRec;\r\n\r\n\r\n  typedef struct  CID_GlyphSlotRec_\r\n  {\r\n    FT_GlyphSlotRec  root;\r\n\r\n    FT_Bool          hint;\r\n    FT_Bool          scaled;\r\n\r\n    FT_Fixed         x_scale;\r\n    FT_Fixed         y_scale;\r\n\r\n  } CID_GlyphSlotRec;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  cid_slot_done( FT_GlyphSlot  slot );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_slot_init( FT_GlyphSlot  slot );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  cid_size_done( FT_Size  size );       /* CID_Size */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_size_init( FT_Size  size );       /* CID_Size */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_size_request( FT_Size          size,      /* CID_Size */\r\n                    FT_Size_Request  req );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_face_init( FT_Stream      stream,\r\n                 FT_Face        face,           /* CID_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params );\r\n\r\n  FT_LOCAL( void )\r\n  cid_face_done( FT_Face  face );               /* CID_Face */\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_driver_init( FT_Module  driver );\r\n\r\n  FT_LOCAL( void )\r\n  cid_driver_done( FT_Module  driver );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CIDOBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidparse.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidparse.c                                                             */\r\n/*                                                                         */\r\n/*    CID-keyed Type1 parser (body).                                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n#include \"cidparse.h\"\r\n\r\n#include \"ciderrs.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_cidparse\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    INPUT STREAM PARSER                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  cid_parser_new( CID_Parser*    parser,\r\n                  FT_Stream      stream,\r\n                  FT_Memory      memory,\r\n                  PSAux_Service  psaux )\r\n  {\r\n    FT_Error  error;\r\n    FT_ULong  base_offset, offset, ps_len;\r\n    FT_Byte   *cur, *limit;\r\n    FT_Byte   *arg1, *arg2;\r\n\r\n\r\n    FT_MEM_ZERO( parser, sizeof ( *parser ) );\r\n    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );\r\n\r\n    parser->stream = stream;\r\n\r\n    base_offset = FT_STREAM_POS();\r\n\r\n    /* first of all, check the font format in the header */\r\n    if ( FT_FRAME_ENTER( 31 ) )\r\n      goto Exit;\r\n\r\n    if ( ft_strncmp( (char *)stream->cursor,\r\n                     \"%!PS-Adobe-3.0 Resource-CIDFont\", 31 ) )\r\n    {\r\n      FT_TRACE2(( \"  not a CID-keyed font\\n\" ));\r\n      error = CID_Err_Unknown_File_Format;\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n    if ( error )\r\n      goto Exit;\r\n\r\n  Again:\r\n    /* now, read the rest of the file until we find */\r\n    /* `StartData' or `/sfnts'                      */\r\n    {\r\n      FT_Byte   buffer[256 + 10];\r\n      FT_Long   read_len = 256 + 10; /* same as signed FT_Stream->size */\r\n      FT_Byte*  p        = buffer;\r\n\r\n\r\n      for ( offset = FT_STREAM_POS(); ; offset += 256 )\r\n      {\r\n        FT_Long  stream_len; /* same as signed FT_Stream->size */\r\n\r\n\r\n        stream_len = stream->size - FT_STREAM_POS();\r\n        if ( stream_len == 0 )\r\n        {\r\n          FT_TRACE2(( \"cid_parser_new: no `StartData' keyword found\\n\" ));\r\n          error = CID_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        read_len = FT_MIN( read_len, stream_len );\r\n        if ( FT_STREAM_READ( p, read_len ) )\r\n          goto Exit;\r\n\r\n        if ( read_len < 256 )\r\n          p[read_len]  = '\\0';\r\n\r\n        limit = p + read_len - 10;\r\n\r\n        for ( p = buffer; p < limit; p++ )\r\n        {\r\n          if ( p[0] == 'S' && ft_strncmp( (char*)p, \"StartData\", 9 ) == 0 )\r\n          {\r\n            /* save offset of binary data after `StartData' */\r\n            offset += p - buffer + 10;\r\n            goto Found;\r\n          }\r\n          else if ( p[1] == 's' && ft_strncmp( (char*)p, \"/sfnts\", 6 ) == 0 )\r\n          {\r\n            offset += p - buffer + 7;\r\n            goto Found;\r\n          }\r\n        }\r\n\r\n        FT_MEM_MOVE( buffer, p, 10 );\r\n        read_len = 256;\r\n        p = buffer + 10;\r\n      }\r\n    }\r\n\r\n  Found:\r\n    /* We have found the start of the binary data or the `/sfnts' token. */\r\n    /* Now rewind and extract the frame corresponding to this PostScript */\r\n    /* section.                                                          */\r\n\r\n    ps_len = offset - base_offset;\r\n    if ( FT_STREAM_SEEK( base_offset )                  ||\r\n         FT_FRAME_EXTRACT( ps_len, parser->postscript ) )\r\n      goto Exit;\r\n\r\n    parser->data_offset    = offset;\r\n    parser->postscript_len = ps_len;\r\n    parser->root.base      = parser->postscript;\r\n    parser->root.cursor    = parser->postscript;\r\n    parser->root.limit     = parser->root.cursor + ps_len;\r\n    parser->num_dict       = -1;\r\n\r\n    /* Finally, we check whether `StartData' or `/sfnts' was real --  */\r\n    /* it could be in a comment or string.  We also get the arguments */\r\n    /* of `StartData' to find out whether the data is represented in  */\r\n    /* binary or hex format.                                          */\r\n\r\n    arg1 = parser->root.cursor;\r\n    cid_parser_skip_PS_token( parser );\r\n    cid_parser_skip_spaces  ( parser );\r\n    arg2 = parser->root.cursor;\r\n    cid_parser_skip_PS_token( parser );\r\n    cid_parser_skip_spaces  ( parser );\r\n\r\n    limit = parser->root.limit;\r\n    cur   = parser->root.cursor;\r\n\r\n    while ( cur < limit )\r\n    {\r\n      if ( parser->root.error )\r\n      {\r\n        error = parser->root.error;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( cur[0] == 'S' && ft_strncmp( (char*)cur, \"StartData\", 9 ) == 0 )\r\n      {\r\n        if ( ft_strncmp( (char*)arg1, \"(Hex)\", 5 ) == 0 )\r\n          parser->binary_length = ft_atol( (const char *)arg2 );\r\n\r\n        limit = parser->root.limit;\r\n        cur   = parser->root.cursor;\r\n        goto Exit;\r\n      }\r\n      else if ( cur[1] == 's' && ft_strncmp( (char*)cur, \"/sfnts\", 6 ) == 0 )\r\n      {\r\n        FT_TRACE2(( \"cid_parser_new: cannot handle Type 11 fonts\\n\" ));\r\n        error = CID_Err_Unknown_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      cid_parser_skip_PS_token( parser );\r\n      cid_parser_skip_spaces  ( parser );\r\n      arg1 = arg2;\r\n      arg2 = cur;\r\n      cur  = parser->root.cursor;\r\n    }\r\n\r\n    /* we haven't found the correct `StartData'; go back and continue */\r\n    /* searching                                                      */\r\n    FT_FRAME_RELEASE( parser->postscript );\r\n    if ( !FT_STREAM_SEEK( offset ) )\r\n      goto Again;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  cid_parser_done( CID_Parser*  parser )\r\n  {\r\n    /* always free the private dictionary */\r\n    if ( parser->postscript )\r\n    {\r\n      FT_Stream  stream = parser->stream;\r\n\r\n\r\n      FT_FRAME_RELEASE( parser->postscript );\r\n    }\r\n    parser->root.funcs.done( &parser->root );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidparse.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidparse.h                                                             */\r\n/*                                                                         */\r\n/*    CID-keyed Type1 parser (specification).                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CIDPARSE_H__\r\n#define __CIDPARSE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_Parser                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A CID_Parser is an object used to parse a Type 1 fonts very        */\r\n  /*    quickly.                                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root           :: The root PS_ParserRec fields.                    */\r\n  /*                                                                       */\r\n  /*    stream         :: The current input stream.                        */\r\n  /*                                                                       */\r\n  /*    postscript     :: A pointer to the data to be parsed.              */\r\n  /*                                                                       */\r\n  /*    postscript_len :: The length of the data to be parsed.             */\r\n  /*                                                                       */\r\n  /*    data_offset    :: The start position of the binary data (i.e., the */\r\n  /*                      end of the data to be parsed.                    */\r\n  /*                                                                       */\r\n  /*    binary_length  :: The length of the data after the `StartData'     */\r\n  /*                      command if the data format is hexadecimal.       */\r\n  /*                                                                       */\r\n  /*    cid            :: A structure which holds the information about    */\r\n  /*                      the current font.                                */\r\n  /*                                                                       */\r\n  /*    num_dict       :: The number of font dictionaries.                 */\r\n  /*                                                                       */\r\n  typedef struct  CID_Parser_\r\n  {\r\n    PS_ParserRec  root;\r\n    FT_Stream     stream;\r\n\r\n    FT_Byte*      postscript;\r\n    FT_Long       postscript_len;\r\n\r\n    FT_ULong      data_offset;\r\n\r\n    FT_Long       binary_length;\r\n\r\n    CID_FaceInfo  cid;\r\n    FT_Int        num_dict;\r\n\r\n  } CID_Parser;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  cid_parser_new( CID_Parser*    parser,\r\n                  FT_Stream      stream,\r\n                  FT_Memory      memory,\r\n                  PSAux_Service  psaux );\r\n\r\n  FT_LOCAL( void )\r\n  cid_parser_done( CID_Parser*  parser );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            PARSING ROUTINES                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#define cid_parser_skip_spaces( p ) \\\r\n          (p)->root.funcs.skip_spaces( &(p)->root )\r\n#define cid_parser_skip_PS_token( p ) \\\r\n          (p)->root.funcs.skip_PS_token( &(p)->root )\r\n\r\n#define cid_parser_to_int( p )        (p)->root.funcs.to_int( &(p)->root )\r\n#define cid_parser_to_fixed( p, t )   (p)->root.funcs.to_fixed( &(p)->root, t )\r\n\r\n#define cid_parser_to_coord_array( p, m, c )                          \\\r\n          (p)->root.funcs.to_coord_array( &(p)->root, m, c )\r\n#define cid_parser_to_fixed_array( p, m, f, t )                          \\\r\n          (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )\r\n#define cid_parser_to_token( p, t )                         \\\r\n          (p)->root.funcs.to_token( &(p)->root, t )\r\n#define cid_parser_to_token_array( p, t, m, c )                          \\\r\n          (p)->root.funcs.to_token_array( &(p)->root, t, m, c )\r\n\r\n#define cid_parser_load_field( p, f, o )                              \\\r\n          (p)->root.funcs.load_field( &(p)->root, f, o, 0, 0 )\r\n#define cid_parser_load_field_table( p, f, o )                              \\\r\n          (p)->root.funcs.load_field_table( &(p)->root, f, o, 0, 0 )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CIDPARSE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidriver.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidriver.c                                                             */\r\n/*                                                                         */\r\n/*    CID driver interface (body).                                         */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006, 2008, 2009, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"cidriver.h\"\r\n#include \"cidgload.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"ciderrs.h\"\r\n\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n#include FT_SERVICE_CID_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ciddriver\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT NAME SERVICE\r\n   *\r\n   */\r\n\r\n  static const char*\r\n  cid_get_postscript_name( CID_Face  face )\r\n  {\r\n    const char*  result = face->cid.cid_font_name;\r\n\r\n\r\n    if ( result && result[0] == '/' )\r\n      result++;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  static const FT_Service_PsFontNameRec  cid_service_ps_name =\r\n  {\r\n    (FT_PsName_GetFunc) cid_get_postscript_name\r\n  };\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT INFO SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  cid_ps_get_font_info( FT_Face          face,\r\n                        PS_FontInfoRec*  afont_info )\r\n  {\r\n    *afont_info = ((CID_Face)face)->cid.font_info;\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n  static FT_Error\r\n  cid_ps_get_font_extra( FT_Face          face,\r\n                        PS_FontExtraRec*  afont_extra )\r\n  {\r\n    *afont_extra = ((CID_Face)face)->font_extra;\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n  static const FT_Service_PsInfoRec  cid_service_ps_info =\r\n  {\r\n    (PS_GetFontInfoFunc)   cid_ps_get_font_info,\r\n    (PS_GetFontExtraFunc)  cid_ps_get_font_extra,\r\n    (PS_HasGlyphNamesFunc) NULL,        /* unsupported with CID fonts */\r\n    (PS_GetFontPrivateFunc)NULL,        /* unsupported                */\r\n    (PS_GetFontValueFunc)  NULL         /* not implemented            */\r\n  };\r\n\r\n\r\n  /*\r\n   *  CID INFO SERVICE\r\n   *\r\n   */\r\n  static FT_Error\r\n  cid_get_ros( CID_Face      face,\r\n               const char*  *registry,\r\n               const char*  *ordering,\r\n               FT_Int       *supplement )\r\n  {\r\n    CID_FaceInfo  cid = &face->cid;\r\n\r\n\r\n    if ( registry )\r\n      *registry = cid->registry;\r\n\r\n    if ( ordering )\r\n      *ordering = cid->ordering;\r\n\r\n    if ( supplement )\r\n      *supplement = cid->supplement;\r\n\r\n    return CID_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cid_get_is_cid( CID_Face  face,\r\n                  FT_Bool  *is_cid )\r\n  {\r\n    FT_Error  error = CID_Err_Ok;\r\n    FT_UNUSED( face );\r\n\r\n\r\n    if ( is_cid )\r\n      *is_cid = 1; /* cid driver is only used for CID keyed fonts */\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  cid_get_cid_from_glyph_index( CID_Face  face,\r\n                                FT_UInt   glyph_index,\r\n                                FT_UInt  *cid )\r\n  {\r\n    FT_Error  error = CID_Err_Ok;\r\n    FT_UNUSED( face );\r\n\r\n\r\n    if ( cid )\r\n      *cid = glyph_index; /* identity mapping */\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static const FT_Service_CIDRec  cid_service_cid_info =\r\n  {\r\n     (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,\r\n     (FT_CID_GetIsInternallyCIDKeyedFunc)      cid_get_is_cid,\r\n     (FT_CID_GetCIDFromGlyphIndexFunc)         cid_get_cid_from_glyph_index\r\n  };\r\n\r\n\r\n  /*\r\n   *  SERVICE LIST\r\n   *\r\n   */\r\n\r\n  static const FT_ServiceDescRec  cid_services[] =\r\n  {\r\n    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CID },\r\n    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },\r\n    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &cid_service_ps_info },\r\n    { FT_SERVICE_ID_CID,                  &cid_service_cid_info },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  cid_get_interface( FT_Module    module,\r\n                     const char*  cid_interface )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( cid_services, cid_interface );\r\n  }\r\n\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Driver_ClassRec  t1cid_driver_class =\r\n  {\r\n    /* first of all, the FT_Module_Class fields */\r\n    {\r\n      FT_MODULE_FONT_DRIVER       |\r\n      FT_MODULE_DRIVER_SCALABLE   |\r\n      FT_MODULE_DRIVER_HAS_HINTER,\r\n\r\n      sizeof ( FT_DriverRec ),\r\n      \"t1cid\",   /* module name           */\r\n      0x10000L,  /* version 1.0 of driver */\r\n      0x20000L,  /* requires FreeType 2.0 */\r\n\r\n      0,\r\n\r\n      cid_driver_init,\r\n      cid_driver_done,\r\n      cid_get_interface\r\n    },\r\n\r\n    /* then the other font drivers fields */\r\n    sizeof ( CID_FaceRec ),\r\n    sizeof ( CID_SizeRec ),\r\n    sizeof ( CID_GlyphSlotRec ),\r\n\r\n    cid_face_init,\r\n    cid_face_done,\r\n\r\n    cid_size_init,\r\n    cid_size_done,\r\n    cid_slot_init,\r\n    cid_slot_done,\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n\r\n    cid_slot_load_glyph,\r\n\r\n    0,                      /* FT_Face_GetKerningFunc  */\r\n    0,                      /* FT_Face_AttachFunc      */\r\n\r\n    0,                      /* FT_Face_GetAdvancesFunc */\r\n\r\n    cid_size_request,\r\n    0                       /* FT_Size_SelectFunc      */\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidriver.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidriver.h                                                             */\r\n/*                                                                         */\r\n/*    High-level CID driver interface (specification).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __CIDRIVER_H__\r\n#define __CIDRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_CALLBACK_TABLE\r\n  const FT_Driver_ClassRec  t1cid_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __CIDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/cidtoken.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  cidtoken.h                                                             */\r\n/*                                                                         */\r\n/*    CID token definitions (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  CID_FaceInfoRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_CID_INFO\r\n\r\n  T1_FIELD_KEY   ( \"CIDFontName\",    cid_font_name, 0 )\r\n  T1_FIELD_FIXED ( \"CIDFontVersion\", cid_version,   0 )\r\n  T1_FIELD_NUM   ( \"CIDFontType\",    cid_font_type, 0 )\r\n  T1_FIELD_STRING( \"Registry\",       registry,      0 )\r\n  T1_FIELD_STRING( \"Ordering\",       ordering,      0 )\r\n  T1_FIELD_NUM   ( \"Supplement\",     supplement,    0 )\r\n  T1_FIELD_NUM   ( \"UIDBase\",        uid_base,      0 )\r\n  T1_FIELD_NUM   ( \"CIDMapOffset\",   cidmap_offset, 0 )\r\n  T1_FIELD_NUM   ( \"FDBytes\",        fd_bytes,      0 )\r\n  T1_FIELD_NUM   ( \"GDBytes\",        gd_bytes,      0 )\r\n  T1_FIELD_NUM   ( \"CIDCount\",       cid_count,     0 )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_FontInfoRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_INFO\r\n\r\n  T1_FIELD_STRING( \"version\",            version,             0 )\r\n  T1_FIELD_STRING( \"Notice\",             notice,              0 )\r\n  T1_FIELD_STRING( \"FullName\",           full_name,           0 )\r\n  T1_FIELD_STRING( \"FamilyName\",         family_name,         0 )\r\n  T1_FIELD_STRING( \"Weight\",             weight,              0 )\r\n  T1_FIELD_NUM   ( \"ItalicAngle\",        italic_angle,        0 )\r\n  T1_FIELD_BOOL  ( \"isFixedPitch\",       is_fixed_pitch,      0 )\r\n  T1_FIELD_NUM   ( \"UnderlinePosition\",  underline_position,  0 )\r\n  T1_FIELD_NUM   ( \"UnderlineThickness\", underline_thickness, 0 )\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_FontExtraRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_EXTRA\r\n\r\n  T1_FIELD_NUM   ( \"FSType\",             fs_type,             0 )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  CID_FaceDictRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_DICT\r\n\r\n  T1_FIELD_NUM  ( \"PaintType\",          paint_type,          0 )\r\n  T1_FIELD_NUM  ( \"FontType\",           font_type,           0 )\r\n  T1_FIELD_NUM  ( \"SubrMapOffset\",      subrmap_offset,      0 )\r\n  T1_FIELD_NUM  ( \"SDBytes\",            sd_bytes,            0 )\r\n  T1_FIELD_NUM  ( \"SubrCount\",          num_subrs,           0 )\r\n  T1_FIELD_NUM  ( \"lenBuildCharArray\",  len_buildchar,       0 )\r\n  T1_FIELD_FIXED( \"ForceBoldThreshold\", forcebold_threshold, 0 )\r\n  T1_FIELD_FIXED( \"StrokeWidth\",        stroke_width,        0 )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_PrivateRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_PRIVATE\r\n\r\n  T1_FIELD_NUM       ( \"UniqueID\",         unique_id,      0 )\r\n  T1_FIELD_NUM       ( \"lenIV\",            lenIV,          0 )\r\n  T1_FIELD_NUM       ( \"LanguageGroup\",    language_group, 0 )\r\n  T1_FIELD_NUM       ( \"password\",         password,       0 )\r\n\r\n  T1_FIELD_FIXED_1000( \"BlueScale\",        blue_scale,     0 )\r\n  T1_FIELD_NUM       ( \"BlueShift\",        blue_shift,     0 )\r\n  T1_FIELD_NUM       ( \"BlueFuzz\",         blue_fuzz,      0 )\r\n\r\n  T1_FIELD_NUM_TABLE ( \"BlueValues\",       blue_values,        14, 0 )\r\n  T1_FIELD_NUM_TABLE ( \"OtherBlues\",       other_blues,        10, 0 )\r\n  T1_FIELD_NUM_TABLE ( \"FamilyBlues\",      family_blues,       14, 0 )\r\n  T1_FIELD_NUM_TABLE ( \"FamilyOtherBlues\", family_other_blues, 10, 0 )\r\n\r\n  T1_FIELD_NUM_TABLE2( \"StdHW\",            standard_width,      1, 0 )\r\n  T1_FIELD_NUM_TABLE2( \"StdVW\",            standard_height,     1, 0 )\r\n  T1_FIELD_NUM_TABLE2( \"MinFeature\",       min_feature,         2, 0 )\r\n\r\n  T1_FIELD_NUM_TABLE ( \"StemSnapH\",        snap_widths,        12, 0 )\r\n  T1_FIELD_NUM_TABLE ( \"StemSnapV\",        snap_heights,       12, 0 )\r\n\r\n  T1_FIELD_BOOL      ( \"ForceBold\",        force_bold,          0 )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  FT_BBox\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_BBOX\r\n\r\n  T1_FIELD_BBOX( \"FontBBox\", xMin, 0 )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/module.mk",
    "content": "#\r\n# FreeType 2 CID module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += TYPE1CID_DRIVER\r\n\r\ndefine TYPE1CID_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, t1cid_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)cid       $(ECHO_DRIVER_DESC)Postscript CID-keyed fonts, no known extension$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/rules.mk",
    "content": "#\r\n# FreeType 2 CID driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# CID driver directory\r\n#\r\nCID_DIR := $(SRC_DIR)/cid\r\n\r\n\r\nCID_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CID_DIR))\r\n\r\n\r\n# CID driver sources (i.e., C files)\r\n#\r\nCID_DRV_SRC := $(CID_DIR)/cidparse.c \\\r\n               $(CID_DIR)/cidload.c  \\\r\n               $(CID_DIR)/cidriver.c \\\r\n               $(CID_DIR)/cidgload.c \\\r\n               $(CID_DIR)/cidobjs.c\r\n\r\n# CID driver headers\r\n#\r\nCID_DRV_H := $(CID_DRV_SRC:%.c=%.h) \\\r\n             $(CID_DIR)/cidtoken.h  \\\r\n             $(CID_DIR)/ciderrs.h\r\n\r\n\r\n# CID driver object(s)\r\n#\r\n#   CID_DRV_OBJ_M is used during `multi' builds\r\n#   CID_DRV_OBJ_S is used during `single' builds\r\n#\r\nCID_DRV_OBJ_M := $(CID_DRV_SRC:$(CID_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nCID_DRV_OBJ_S := $(OBJ_DIR)/type1cid.$O\r\n\r\n# CID driver source file for single build\r\n#\r\nCID_DRV_SRC_S := $(CID_DIR)/type1cid.c\r\n\r\n\r\n# CID driver - single object\r\n#\r\n$(CID_DRV_OBJ_S): $(CID_DRV_SRC_S) $(CID_DRV_SRC) $(FREETYPE_H) $(CID_DRV_H)\r\n\t$(CID_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(CID_DRV_SRC_S))\r\n\r\n\r\n# CID driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(CID_DIR)/%.c $(FREETYPE_H) $(CID_DRV_H)\r\n\t$(CID_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(CID_DRV_OBJ_S)\r\nDRV_OBJS_M += $(CID_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/cid/type1cid.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  type1cid.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType OpenType driver component (body only).                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"cidparse.c\"\r\n#include \"cidload.c\"\r\n#include \"cidobjs.c\"\r\n#include \"cidriver.c\"\r\n#include \"cidgload.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/ftdebug.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdebug.c                                                              */\r\n/*                                                                         */\r\n/*    Debugging and logging component for Win32 (body).                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2005, 2008, 2009 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This component contains various macros and functions used to ease the */\r\n  /* debugging of the FreeType engine.  Its main purpose is in assertion   */\r\n  /* checking, tracing, and error detection.                               */\r\n  /*                                                                       */\r\n  /* There are now three debugging modes:                                  */\r\n  /*                                                                       */\r\n  /* - trace mode                                                          */\r\n  /*                                                                       */\r\n  /*   Error and trace messages are sent to the log file (which can be the */\r\n  /*   standard error output).                                             */\r\n  /*                                                                       */\r\n  /* - error mode                                                          */\r\n  /*                                                                       */\r\n  /*   Only error messages are generated.                                  */\r\n  /*                                                                       */\r\n  /* - release mode:                                                       */\r\n  /*                                                                       */\r\n  /*   No error message is sent or generated.  The code is free from any   */\r\n  /*   debugging parts.                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n\r\n#include <stdarg.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#include <windows.h>\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Message( const char*  fmt, ... )\r\n  {\r\n    static char  buf[8192];\r\n    va_list      ap;\r\n\r\n\r\n    va_start( ap, fmt );\r\n    vprintf( fmt, ap );\r\n    /* send the string to the debugger as well */\r\n    vsprintf( buf, fmt, ap );\r\n    OutputDebugStringA( buf );\r\n    va_end( ap );\r\n  }\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  FT_Panic( const char*  fmt, ... )\r\n  {\r\n    static char  buf[8192];\r\n    va_list      ap;\r\n\r\n\r\n    va_start( ap, fmt );\r\n    vsprintf( buf, fmt, ap );\r\n    OutputDebugStringA( buf );\r\n    va_end( ap );\r\n\r\n    exit( EXIT_FAILURE );\r\n  }\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n\r\n  /* array of trace levels, initialized to 0 */\r\n  int  ft_trace_levels[trace_count];\r\n\r\n  /* define array of trace toggle names */\r\n#define FT_TRACE_DEF( x )  #x ,\r\n\r\n  static const char*  ft_trace_toggles[trace_count + 1] =\r\n  {\r\n#include FT_INTERNAL_TRACE_H\r\n    NULL\r\n  };\r\n\r\n#undef FT_TRACE_DEF\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Initialize the tracing sub-system.  This is done by retrieving the    */\r\n  /* value of the \"FT2_DEBUG\" environment variable.  It must be a list of  */\r\n  /* toggles, separated by spaces, `;' or `,'.  Example:                   */\r\n  /*                                                                       */\r\n  /*    \"any:3 memory:6 stream:5\"                                          */\r\n  /*                                                                       */\r\n  /* This will request that all levels be set to 3, except the trace level */\r\n  /* for the memory and stream components which are set to 6 and 5,        */\r\n  /* respectively.                                                         */\r\n  /*                                                                       */\r\n  /* See the file <freetype/internal/fttrace.h> for details of the         */\r\n  /* available toggle names.                                               */\r\n  /*                                                                       */\r\n  /* The level must be between 0 and 6; 0 means quiet (except for serious  */\r\n  /* runtime errors), and 6 means _very_ verbose.                          */\r\n  /*                                                                       */\r\n  FT_BASE_DEF( void )\r\n  ft_debug_init( void )\r\n  {\r\n    const char*  ft2_debug = getenv( \"FT2_DEBUG\" );\r\n\r\n\r\n    if ( ft2_debug )\r\n    {\r\n      const char*  p = ft2_debug;\r\n      const char*  q;\r\n\r\n\r\n      for ( ; *p; p++ )\r\n      {\r\n        /* skip leading whitespace and separators */\r\n        if ( *p == ' ' || *p == '\\t' || *p == ',' || *p == ';' || *p == '=' )\r\n          continue;\r\n\r\n        /* read toggle name, followed by ':' */\r\n        q = p;\r\n        while ( *p && *p != ':' )\r\n          p++;\r\n\r\n        if ( *p == ':' && p > q )\r\n        {\r\n          int  n, i, len = p - q;\r\n          int  level = -1, found = -1;\r\n\r\n\r\n          for ( n = 0; n < trace_count; n++ )\r\n          {\r\n            const char*  toggle = ft_trace_toggles[n];\r\n\r\n\r\n            for ( i = 0; i < len; i++ )\r\n            {\r\n              if ( toggle[i] != q[i] )\r\n                break;\r\n            }\r\n\r\n            if ( i == len && toggle[i] == 0 )\r\n            {\r\n              found = n;\r\n              break;\r\n            }\r\n          }\r\n\r\n          /* read level */\r\n          p++;\r\n          if ( *p )\r\n          {\r\n            level = *p++ - '0';\r\n            if ( level < 0 || level > 7 )\r\n              level = -1;\r\n          }\r\n\r\n          if ( found >= 0 && level >= 0 )\r\n          {\r\n            if ( found == trace_any )\r\n            {\r\n              /* special case for \"any\" */\r\n              for ( n = 0; n < trace_count; n++ )\r\n                ft_trace_levels[n] = level;\r\n            }\r\n            else\r\n              ft_trace_levels[found] = level;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n#else  /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  FT_BASE_DEF( void )\r\n  ft_debug_init( void )\r\n  {\r\n    /* nothing */\r\n  }\r\n\r\n\r\n#endif /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n#endif /* FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/Jamfile",
    "content": "# FreeType 2 src/gxvalid Jamfile\r\n#\r\n# Copyright 2005 by\r\n# suzuki toshiya, Masatake YAMATO and Red Hat K.K.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) gxvalid ;\r\n\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = gxvcommn gxvfeat  gxvbsln  gxvtrak  gxvopbd  gxvprop\r\n               gxvmort  gxvmort0 gxvmort1 gxvmort2 gxvmort4 gxvmort5\r\n               gxvmorx  gxvmorx0 gxvmorx1 gxvmorx2 gxvmorx4 gxvmorx5\r\n               gxvlcar  gxvkern  gxvmod   gxvjust  ;\r\n  }\r\n  else\r\n  {\r\n    _sources = gxvalid ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/gxvalid Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/README",
    "content": "gxvalid: TrueType GX validator\r\n==============================\r\n\r\n\r\n1. What is this\r\n---------------\r\n\r\n  `gxvalid' is a module to  validate TrueType GX tables: a collection of\r\n  additional tables  in TrueType  font which are  used by  `QuickDraw GX\r\n  Text',  Apple Advanced  Typography  (AAT).  In  addition, gxvalid  can\r\n  validates `kern'  tables which have  been extended for AAT.   Like the\r\n  otvalid  module,   gxvalid  uses  Freetype   2's  validator  framework\r\n  (ftvalid).\r\n\r\n  You can link gxvalid with your program; before running your own layout\r\n  engine, gxvalid validates a font  file.  As the result, you can remove\r\n  error-checking code  from the layout  engine.  It is also  possible to\r\n  use  gxvalid  as a  stand-alone  font  validator;  the `ftvalid'  test\r\n  program  included  in the  ft2demo  bundle  calls gxvalid  internally.\r\n  A stand-alone font validator may be useful for font developers.\r\n\r\n  This documents documents the following issues.\r\n\r\n  - supported TrueType GX tables\r\n  - fundamental validation limitations\r\n  - permissive error handling of broken GX tables\r\n  - `kern' table issue.\r\n\r\n\r\n2. Supported tables\r\n-------------------\r\n\r\n  The following GX tables are currently supported.\r\n\r\n    bsln\r\n    feat\r\n    just\r\n    kern(*)\r\n    lcar\r\n    mort\r\n    morx\r\n    opbd\r\n    prop\r\n    trak\r\n\r\n  The following GX tables are currently unsupported.\r\n\r\n    cvar\r\n    fdsc\r\n    fmtx\r\n    fvar\r\n    gvar\r\n    Zapf\r\n\r\n  The following GX tables won't be supported.\r\n\r\n    acnt(**)\r\n    hsty(***)\r\n\r\n  The following undocumented tables in TrueType fonts designed for Apple\r\n  platform aren't handled either.\r\n\r\n    addg\r\n    CVTM\r\n    TPNM\r\n    umif\r\n\r\n\r\n  *)   The `kern'  validator handles both  the classic and the  new kern\r\n       formats;  the former  is supported  on both  Microsoft  and Apple\r\n       platforms, while the latter is supported on Apple platforms.\r\n\r\n  **)  `acnt' tables are not supported by currently available Apple font\r\n       tools.\r\n\r\n  ***) There  is  one more  Apple  extension,  `hsty',  but  it  is  for\r\n       Newton-OS, not GX  (Newton-OS is a platform by  Apple, but it can\r\n       use  sfnt- housed bitmap  fonts only).   Therefore, it  should be\r\n       excluded  from  `Apple  platform'  in the  context  of  TrueType.\r\n       gxvalid ignores it as Apple font tools do so.\r\n\r\n\r\n  We have  checked 183  fonts bundled with  MacOS 9.1, MacOS  9.2, MacOS\r\n  10.0, MacOS X 10.1, MSIE  for MacOS, and AppleWorks 6.0.  In addition,\r\n  we have  checked 67 Dynalab fonts  (designed for MacOS)  and 189 Ricoh\r\n  fonts (designed for Windows and  MacOS dual platforms).  The number of\r\n  fonts including TrueType GX tables are as follows.\r\n\r\n    bsln:  76\r\n    feat: 191\r\n    just:  84\r\n    kern:  59\r\n    lcar:   4\r\n    mort: 326\r\n    morx:  19\r\n    opbd:   4\r\n    prop: 114\r\n    trak:  16\r\n\r\n  Dynalab  and Ricoh fonts  don't have  GX tables  except of  `feat' and\r\n  `mort'.\r\n\r\n\r\n3. Fundamental validation limitations\r\n-------------------------------------\r\n\r\n  TrueType  GX  provides  layout   information  to  libraries  for  font\r\n  rasterizers  and text layout.   gxvalid can  check whether  the layout\r\n  data in  a font is conformant  to the TrueType GX  format specified by\r\n  Apple.  But gxvalid cannot check  a how QuickDraw GX/AAT renderer uses\r\n  the stored information.\r\n\r\n  3-1. Validation of State Machine activity\r\n  -----------------------------------------\r\n\r\n    QuickDraw GX/AAT uses a `State Machine' to provide `stateful' layout\r\n    features,  and TrueType GX  stores the  state transition  diagram of\r\n    this `State  Machine' in a  `StateTable' data structure.   While the\r\n    State  Machine receives  a series  of glyph  IDs, the  State Machine\r\n    starts with `start  of text' state, walks around  various states and\r\n    generates various  layout information  to the  renderer, and finally\r\n    reaches the `end of text' state.\r\n\r\n    gxvalid can check essential errors like:\r\n\r\n      - possibility of state transitions to undefined states\r\n      - existence of glyph  IDs that the State Machine  doesn't know how\r\n        to handle\r\n      - the  State Machine  cannot compute  the layout  information from\r\n        given diagram\r\n\r\n    These errors  can be  checked within finite  steps, and  without the\r\n    State Machine itself, because these are `expression' errors of state\r\n    transition diagram.\r\n\r\n    There  is no  limitation  about  how long  the  State Machine  walks\r\n    around,  so validation  of  the algorithm  in  the state  transition\r\n    diagram requires infinite  steps, even if we had  a State Machine in\r\n    gxvalid.   Therefore, the  following errors  and problems  cannot be\r\n    checked.\r\n\r\n      - existence of states which the State Machine never transits to\r\n      - the  possibility that the  State Machine  never reaches  `end of\r\n        text'\r\n      - the possibility of stack underflow/overflow in the State Machine\r\n        (in  ligature  and  contextual  glyph substitutions,  the  State\r\n        Machine can store 16 glyphs onto its stack)\r\n\r\n    In addition, gxvalid doesn't check `temporary glyph IDs' used in the\r\n    chained State Machines  (in `mort' and `morx' tables).   If a layout\r\n    feature  is  implemented by  a  single  State  Machine, a  glyph  ID\r\n    converted by the State Machine is passed to the glyph renderer, thus\r\n    it  should not  point to  an undefined  glyph ID.   But if  a layout\r\n    feature is implemented by  chained State Machines, a component State\r\n    Machine  (if it  is  not the  final  one) is  permitted to  generate\r\n    undefined glyph IDs for temporary use, because it is handled by next\r\n    component State Machine and not  by the glyph renderer.  To validate\r\n    such temporary glyph IDs, gxvalid must stack all undefined glyph IDs\r\n    which  can occur in  the output  of the  previous State  Machine and\r\n    search  them in  the  `ClassTable' structure  of  the current  State\r\n    Machine.  It is too complex to  list all possible glyph IDs from the\r\n    StateTable, especially from a ligature substitution table.\r\n\r\n  3-2. Validation of relationship between multiple layout features\r\n  ----------------------------------------------------------------\r\n\r\n    gxvalid does  not validate the relationship  between multiple layout\r\n    features at all.\r\n\r\n    If  multiple layout  features  are defined  in  TrueType GX  tables,\r\n    possible  interactions,  overrides,  and  conflicts  between  layout\r\n    features are implicitly  given in the font too.   For example, there\r\n    are several predefined spacing control features:\r\n\r\n      - Text Spacing          (Proportional/Monospace/Half-width/Normal)\r\n      - Number Spacing        (Monospaced-numbers/Proportional-numbers)\r\n      - Kana Spacing          (Full-width/Proportional)\r\n      - Ideographic Spacing   (Full-width/Proportional)\r\n      - CJK Roman Spacing     (Half-width/Proportional/Default-roman\r\n                               /Full-width-roman/Proportional)\r\n\r\n    If all  layout features are  independently managed, we  can activate\r\n    inconsistent  typographic rules  like  `Text Spacing=Monospace'  and\r\n    `Ideographic Spacing=Proportional' at the same time.\r\n\r\n    The combinations  of layout features  is managed by a  32bit integer\r\n    (one bit each for selector  setting), so we can define relationships\r\n    between  up  to 32  features,  theoretically.   But  if one  feature\r\n    setting  affects  another   feature  setting,  we  need  typographic\r\n    priority  rules to  validate the  relationship.   Unfortunately, the\r\n    TrueType GX format specification does not give such information even\r\n    for predefined features.\r\n\r\n\r\n4. Permissive error handling of broken GX tables\r\n------------------------------------------------\r\n\r\n  When  Apple's font  rendering system  finds an  inconsistency,  like a\r\n  specification  violation or  an  unspecified value  in  a TrueType  GX\r\n  table, it does not always  return error.  In most cases, the rendering\r\n  engine silently  ignores such wrong  values or even whole  tables.  In\r\n  fact, MacOS is shipped with  fonts including broken GX/AAT tables, but\r\n  no harmful  effects due to  `officially broken' fonts are  observed by\r\n  end-users.\r\n\r\n  gxvalid  is designed  to continue  the validation  process as  long as\r\n  possible.  When gxvalid find wrong  values, gxvalid warns it at least,\r\n  and takes  a fallback procedure  if possible.  The  fallback procedure\r\n  depends on the debug level.\r\n\r\n  We used the following three tools to investigate Apple's error handling.\r\n\r\n    - FontValidator  (for MacOS 8.5 - 9.2)  resource fork font\r\n    - ftxvalidator   (for MacOS X 10.1 -)   dfont or naked-sfnt\r\n    - ftxdumperfuser (for MacOS X 10.1 -)   dfont or naked-sfnt\r\n\r\n  However, all tests were done on a PowerPC based Macintosh; at present,\r\n  we have not checked those tools on a m68k-based Macintosh.\r\n\r\n  In total, we checked 183 fonts  bundled to MacOS 9.1, MacOS 9.2, MacOS\r\n  10.0, MacOS X  10.1, MSIE for MacOS, and  AppleWorks 6.0.  These fonts\r\n  are distributed  officially, but many broken GX/AAT  tables were found\r\n  by Apple's font tools.  In the following, we list typical violation of\r\n  the GX specification, in fonts officially distributed with those Apple\r\n  systems.\r\n\r\n  4-1. broken BinSrchHeader (19/183)\r\n  ----------------------------------\r\n\r\n    `BinSrchHeader' is  a header of a  data array for  m68k platforms to\r\n    access memory efficiently.  Although  there are only two independent\r\n    parameters  for real  (`unitSize' and  `nUnits'),  BinSrchHeader has\r\n    three additional parameters which  can be calculated from `unitSize'\r\n    and  `nUnits',  for  fast  setup.   Apple  font  tools  ignore  them\r\n    silently, so gxvalid warns if it finds and inconsistency, and always\r\n    continues  validation.    The  additional  parameters   are  ignored\r\n    regardless of the consistency.\r\n\r\n      19  fonts include  such  inconsistencies; all  breaks  are in  the\r\n      BinSrchHeader structure of the `kern' table.\r\n\r\n  4-2. too-short LookupTable (5/183)\r\n  ----------------------------------\r\n\r\n    LookupTable format 0  is a simple array to get a  value from a given\r\n    GID (glyph  ID); the index of  this array is a  GID too.  Therefore,\r\n    the length  of the array is expected  to be same as  the maximum GID\r\n    value defined  in the `maxp' table,  but there are  some fonts whose\r\n    LookupTable format 0 is too  short to cover all GIDs.  FontValidator\r\n    ignores  this error silently,  ftxvalidator and  ftxdumperfuser both\r\n    warn and continue.  Similar problems are found in format 3 subtables\r\n    of `kern'.  gxvalid  warns always and abort if  the validation level\r\n    is set to FT_VALIDATE_PARANOID.\r\n\r\n      5 fonts include too-short kern format 0 subtables.\r\n      1 font includes too-short kern format 3 subtable.\r\n\r\n  4-3. broken LookupTable format 2 (1/183)\r\n  ----------------------------------------\r\n\r\n    LookupTable  format  2,  subformat  4  covers the  GID  space  by  a\r\n    collection  of  segments which  are  specified  by `firstGlyph'  and\r\n    `lastGlyph'.   Some  fonts  store  `firstGlyph' and  `lastGlyph'  in\r\n    reverse order,  so the segment specification is  broken.  Apple font\r\n    tools ignore this error silently;  a broken segment is ignored as if\r\n    it  did not  exist.   gxvalid  warns and  normalize  the segment  at\r\n    FT_VALIDATE_DEFAULT, or ignore  the segment at FT_VALIDATE_TIGHT, or\r\n    abort at FT_VALIDATE_PARANOID.\r\n\r\n      1 font includes broken LookupTable format 2, in the `just' table.\r\n\r\n    *) It seems  that all fonts manufactured by  ITC for AppleWorks have\r\n       this error.\r\n\r\n  4-4. bad bracketing in glyph property (14/183)\r\n  ----------------------------------------------\r\n\r\n    GX/AAT defines a  `bracketing' property of the glyphs  in the `prop'\r\n    table,  to control layout  features of  strings enclosed  inside and\r\n    outside  of   brackets.   Some  fonts   give  inappropriate  bracket\r\n    properties  to glyphs.   Apple  font tools  warn  about this  error;\r\n    gxvalid warns too and aborts at FT_VALIDATE_PARANOID.\r\n\r\n      14 fonts include wrong bracket properties.\r\n\r\n\r\n  4-5. invalid feature number (117/183)\r\n  -------------------------------------\r\n\r\n    The GX/AAT extension can  include 255 different layout features, but\r\n    popular      layout      features      are      predefined      (see\r\n    http://developer.apple.com/fonts/Registry/index.html).   Some  fonts\r\n    include feature  numbers which are incompatible  with the predefined\r\n    feature registry.\r\n\r\n    In our survey, there are 140 fonts including `feat' table.\r\n\r\n    a) 67 fonts use a feature number which should not be used.\r\n    b) 117 fonts set the wrong feature range (nSetting).  This is mostly\r\n       found in the `mort' and `morx' tables.\r\n\r\n    Apple  font tools give  no warning,  although they  cannot recognize\r\n    what  the feature  is.   At FT_VALIDATE_DEFAULT,  gxvalid warns  but\r\n    continues in both cases (a, b).  At FT_VALIDATE_TIGHT, gxvalid warns\r\n    and aborts for (a), but continues for (b).  At FT_VALIDATE_PARANOID,\r\n    gxvalid warns and aborts in both cases (a, b).\r\n\r\n  4-6. invalid prop version (10/183)\r\n  ----------------------------------\r\n\r\n    As most TrueType GX tables, the `prop' table must start with a 32bit\r\n    version identifier: 0x00010000,  0x00020000 or 0x00030000.  But some\r\n    fonts  store nonsense binary  data instead.   When Apple  font tools\r\n    find them, they abort the processing immediately, and the data which\r\n    follows is unhandled.  gxvalid does the same.\r\n\r\n      10 fonts include broken `prop' version.\r\n\r\n    All  of these  fonts are  classic  TrueType fonts  for the  Japanese\r\n    script, manufactured by Apple.\r\n\r\n  4-7. unknown resource name (2/183)\r\n  ------------------------------------\r\n\r\n    NOTE: THIS IS NOT A TRUETYPE GX ERROR.\r\n\r\n    If  a TrueType  font is  stored  in the  resource fork  or in  dfont\r\n    format, the data must be tagged as `sfnt' in the resource fork index\r\n    to invoke TrueType font handler for the data.  But the TrueType font\r\n    data  in   `Keyboard.dfont'  is  tagged   as  `kbd',  and   that  in\r\n    `LastResort.dfont' is tagged as  `lst'.  Apple font tools can detect\r\n    that the data is in  TrueType format and successfully validate them.\r\n    Maybe  this is possible  because they  are known  to be  dfont.  The\r\n    current  implementation  of the  resource  fork  driver of  FreeType\r\n    cannot do that, thus gxvalid cannot validate them.\r\n\r\n      2 fonts use an unknown tag for the TrueType font resource.\r\n\r\n5. `kern' table issues\r\n----------------------\r\n\r\n  In common terminology of TrueType, `kern' is classified as a basic and\r\n  platform-independent table.  But there are Apple extensions of `kern',\r\n  and  there is  an  extension which  requires  a GX  state machine  for\r\n  contextual kerning.   Therefore, gxvalid includes  a special validator\r\n  for  `kern' tables.   Unfortunately, there  is no  exact  algorithm to\r\n  check Apple's extension, so  gxvalid includes a heuristic algorithm to\r\n  find  the proper validation  routines for  all possible  data formats,\r\n  including    the   data    format   for    Microsoft.     By   calling\r\n  classic_kern_validate() instead of gxv_validate(), you can specify the\r\n  `kern' format  explicitly.  However, current  FreeType2 uses Microsoft\r\n  `kern' format  only, others  are ignored (and  should be handled  in a\r\n  library one level higher than FreeType).\r\n\r\n  5-1. History\r\n  ------------\r\n\r\n    The original  16bit version of `kern'  was designed by  Apple in the\r\n    pre-GX  era, and  it was  also approved  by  Microsoft.  Afterwards,\r\n    Apple designed a  new 32bit version of the  `kern' table.  According\r\n    to  the documentation, the  difference between  the 16bit  and 32bit\r\n    version is only the size of  variables in the `kern' header.  In the\r\n    following,  we call  the original  16bit version  as  `classic', and\r\n    32bit version as `new'.\r\n\r\n  5-2. Versions and dialects which should be differentiated\r\n  ---------------------------------------------------------\r\n\r\n    The `kern' table  consists of a table header  and several subtables.\r\n    The version number  which identifies a `classic' or  a `new' version\r\n    is  explicitly   written  in  the   table  header,  but   there  are\r\n    undocumented  differences between  Microsoft's and  Apple's formats.\r\n    It is  called a `dialect' in  the following.  There  are three cases\r\n    which  should  be  handled:   the  new  Apple-dialect,  the  classic\r\n    Apple-dialect,  and the classic  Microsoft-dialect.  An  analysis of\r\n    the formats and the auto detection algorithm of gxvalid is described\r\n    in the following.\r\n\r\n    5-2-1. Version detection: classic and new kern\r\n    ----------------------------------------------\r\n\r\n      According  to Apple  TrueType  specification, there  are only  two\r\n      differences between the classic and the new:\r\n\r\n        - The `kern' table header starts with the version number.\r\n          The classic version starts with 0x0000 (16bit),\r\n          the new version starts with 0x00010000 (32bit).\r\n\r\n        - In the  `kern' table header,  the number of  subtables follows\r\n          the version number.\r\n          In the classic version, it is stored as a 16bit value.\r\n          In the new version, it is stored as a 32bit value.\r\n\r\n      From Apple font tool's output (DumpKERN is also tested in addition\r\n      to  the  three  Apple  font  tools in  above),  there  is  another\r\n      undocumented difference.  In the  new version, the subtable header\r\n      includes a 16bit variable  named `tupleIndex' which does not exist\r\n      in the classic version.\r\n\r\n      The new version  can store all subtable formats (0,  1, 2, and 3),\r\n      but the Apple TrueType specification does not mention the subtable\r\n      formats available in the classic version.\r\n\r\n    5-2-2. Available subtable formats in classic version\r\n    ----------------------------------------------------\r\n\r\n      Although the  Apple TrueType  specification recommends to  use the\r\n      classic version in  the case if the font is  designed for both the\r\n      Apple and Microsoft platforms,  it does not document the available\r\n      subtable formats in the classic version.\r\n\r\n      According  to the Microsoft  TrueType specification,  the subtable\r\n      format  assured for  Windows  and OS/2  support  is only  subtable\r\n      format  0.  The  Microsoft TrueType  specification  also describes\r\n      subtable format  2, but does  not mention which  platforms support\r\n      it.  Aubtable formats 1, 3,  and higher are documented as reserved\r\n      for future use.  Therefore, the classic version can store subtable\r\n      formats 0 and 2, at least.  `ttfdump.exe', a font tool provided by\r\n      Microsoft,  ignores the  subtable format  written in  the subtable\r\n      header, and parses the table as if all subtables are in format 0.\r\n\r\n      `kern'  subtable format  1  uses  a StateTable,  so  it cannot  be\r\n      utilized without a GX  State Machine.  Therefore, it is reasonable\r\n      to assume  that format 1 (and  3) were introduced  after Apple had\r\n      introduced GX and moved to the new 32bit version.\r\n\r\n    5-2-3. Apple and Microsoft dialects\r\n    -----------------------------------\r\n\r\n      The  `kern' subtable  has  a 16bit  `coverage'  field to  describe\r\n      kerning attributes, but bit interpretations by Apple and Microsoft\r\n      are different:  For example, Apple  uses bits 0-7 to  identify the\r\n      subtable, while Microsoft uses bits 8-15.\r\n\r\n      In  addition, due  to the  output of  DumpKERN  and FontValidator,\r\n      Apple's bit interpretations of coverage in classic and new version\r\n      are  incompatible also.   In  summary, there  are three  dialects:\r\n      classic Apple  dialect, classic  Microsoft dialect, and  new Apple\r\n      dialect.  The classic Microsoft  dialect and the new Apple dialect\r\n      are documented  by each vendors' TrueType  font specification, but\r\n      the documentation for classic Apple dialect is not available.\r\n\r\n      For example,  in the  new Apple dialect,  bit 15 is  documented as\r\n      `set to  1 if  the kerning  is vertical'.  On  the other  hand, in\r\n      classic Microsoft dialect, bit 1 is documented as `set to 1 if the\r\n      kerning  is  horizontal'.   From   the  outputs  of  DumpKERN  and\r\n      FontValidator, classic  Apple dialect recognizes  15 as `set  to 1\r\n      when  the kerning  is horizontal'.   From the  results  of similar\r\n      experiments, classic Apple dialect  seems to be the Endian reverse\r\n      of the classic Microsoft dialect.\r\n\r\n      As a  conclusion it must be  noted that no font  tool can identify\r\n      classic Apple dialect or classic Microsoft dialect automatically.\r\n\r\n    5-2-4. gxvalid auto dialect detection algorithm\r\n    -----------------------------------------------\r\n\r\n      The first 16  bits of the `kern' table are  enough to identify the\r\n      version:\r\n\r\n        - if  the first  16  bits are  0x0000,  the `kern'  table is  in\r\n          classic Apple dialect or classic Microsoft dialect\r\n        - if the first 16 bits are  0x0001, and next 16 bits are 0x0000,\r\n          the kern table is in new Apple dialect.\r\n\r\n      If the `kern'  table is a classic one,  the 16bit `coverage' field\r\n      is checked next.   Firstly, the coverage bits are  decoded for the\r\n      classic Apple dialect using the following bit masks (this is based\r\n      on DumpKERN output):\r\n\r\n        0x8000: 1=horizontal, 0=vertical\r\n        0x4000: not used\r\n        0x2000: 1=cross-stream, 0=normal\r\n        0x1FF0: reserved\r\n        0x000F: subtable format\r\n\r\n      If  any  of  reserved  bits  are  set  or  the  subtable  bits  is\r\n      interpreted as format 1 or 3, we take it as `impossible in classic\r\n      Apple dialect' and retry, using the classic Microsoft dialect.\r\n\r\n        The most popular coverage in new Apple-dialect:         0x8000,\r\n        The most popular coverage in classic Apple-dialect:     0x0000,\r\n        The most popular coverage in classic Microsoft dialect: 0x0001.\r\n\r\n  5-3. Tested fonts\r\n  -----------------\r\n\r\n    We checked  59 fonts  bundled with MacOS  and 38 fonts  bundled with\r\n    Windows, where all font include a `kern' table.\r\n\r\n      - fonts bundled with MacOS\r\n        * new Apple dialect\r\n          format 0: 18\r\n          format 2:  1\r\n          format 3:  1\r\n        * classic Apple dialect\r\n          format 0: 14\r\n        * classic Microsoft dialect\r\n          format 0: 15\r\n\r\n      - fonts bundled with Windows\r\n        * classic Microsoft dialect\r\n          format 0: 38\r\n\r\n    It looks strange that classic Microsoft-dialect fonts are bundled to\r\n    MacOS: they come from MSIE for MacOS, except of MarkerFelt.dfont.\r\n\r\n\r\n  ACKNOWLEDGEMENT\r\n  ---------------\r\n\r\n  Some parts of gxvalid are  derived from both the `gxlayout' module and\r\n  the `otvalid'  module.  Development of  gxlayout was supported  by the\r\n  Information-technology Promotion Agency(IPA), Japan.\r\n\r\n  The detailed analysis of undefined  glyph ID utilization in `mort' and\r\n  `morx' tables is provided by George Williams.\r\n\r\n------------------------------------------------------------------------\r\n\r\nCopyright 2004, 2005, 2007 by\r\nsuzuki toshiya, Masatake YAMATO, Red hat K.K.,\r\nDavid Turner, Robert Wilhelm, and Werner Lemberg.\r\n\r\nThis  file is  part  of the  FreeType  project, and  may  only be  used,\r\nmodified,  and  distributed under  the  terms  of  the FreeType  project\r\nlicense, LICENSE.TXT.  By continuing  to use, modify, or distribute this\r\nfile  you indicate that  you have  read the  license and  understand and\r\naccept it fully.\r\n\r\n\r\n--- end of README ---\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvalid.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvalid.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType validator for TrueTypeGX/AAT tables (body only).            */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n\r\n#include \"gxvfeat.c\"\r\n#include \"gxvcommn.c\"\r\n#include \"gxvbsln.c\"\r\n#include \"gxvtrak.c\"\r\n#include \"gxvjust.c\"\r\n#include \"gxvmort.c\"\r\n#include \"gxvmort0.c\"\r\n#include \"gxvmort1.c\"\r\n#include \"gxvmort2.c\"\r\n#include \"gxvmort4.c\"\r\n#include \"gxvmort5.c\"\r\n#include \"gxvmorx.c\"\r\n#include \"gxvmorx0.c\"\r\n#include \"gxvmorx1.c\"\r\n#include \"gxvmorx2.c\"\r\n#include \"gxvmorx4.c\"\r\n#include \"gxvmorx5.c\"\r\n#include \"gxvkern.c\"\r\n#include \"gxvopbd.c\"\r\n#include \"gxvprop.c\"\r\n#include \"gxvlcar.c\"\r\n#include \"gxvmod.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvalid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvalid.h                                                              */\r\n/*                                                                         */\r\n/*    TrueTyeeGX/AAT table validation (specification only).                */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __GXVALID_H__\r\n#define __GXVALID_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#include \"gxverror.h\"          /* must come before FT_INTERNAL_VALIDATE_H */\r\n\r\n#include FT_INTERNAL_VALIDATE_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( void )\r\n  gxv_feat_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  gxv_bsln_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  gxv_trak_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_just_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_morx_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_kern_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_kern_validate_classic( FT_Bytes      table,\r\n                             FT_Face       face,\r\n                             FT_Int        dialect_flags,\r\n                             FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_opbd_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_prop_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_lcar_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  valid );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __GXVALID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvbsln.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvbsln.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT bsln table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvbsln\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define GXV_BSLN_VALUE_COUNT  32\r\n#define GXV_BSLN_VALUE_EMPTY  0xFFFFU\r\n\r\n\r\n  typedef struct  GXV_bsln_DataRec_\r\n  {\r\n    FT_Bytes   ctlPoints_p;\r\n    FT_UShort  defaultBaseline;\r\n\r\n  } GXV_bsln_DataRec, *GXV_bsln_Data;\r\n\r\n\r\n#define GXV_BSLN_DATA( field )  GXV_TABLE_DATA( bsln, field )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_bsln_LookupValue_validate( FT_UShort            glyph,\r\n                                 GXV_LookupValueCPtr  value_p,\r\n                                 GXV_Validator        valid )\r\n  {\r\n    FT_UShort   v = value_p->u;\r\n    FT_UShort*  ctlPoints;\r\n\r\n    FT_UNUSED( glyph );\r\n\r\n\r\n    GXV_NAME_ENTER( \"lookup value\" );\r\n\r\n    if ( v >= GXV_BSLN_VALUE_COUNT )\r\n      FT_INVALID_DATA;\r\n\r\n    ctlPoints = (FT_UShort*)GXV_BSLN_DATA( ctlPoints_p );\r\n    if ( ctlPoints && ctlPoints[v] == GXV_BSLN_VALUE_EMPTY )\r\n      FT_INVALID_DATA;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*\r\n    +===============+ --------+\r\n    | lookup header |         |\r\n    +===============+         |\r\n    | BinSrchHeader |         |\r\n    +===============+         |\r\n    | lastGlyph[0]  |         |\r\n    +---------------+         |\r\n    | firstGlyph[0] |         |    head of lookup table\r\n    +---------------+         |             +\r\n    | offset[0]     |    ->   |          offset            [byte]\r\n    +===============+         |             +\r\n    | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]\r\n    +---------------+         |\r\n    | firstGlyph[1] |         |\r\n    +---------------+         |\r\n    | offset[1]     |         |\r\n    +===============+         |\r\n                              |\r\n    ...                       |\r\n                              |\r\n    16bit value array         |\r\n    +===============+         |\r\n    |     value     | <-------+\r\n    ...\r\n  */\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_bsln_LookupFmt4_transit( FT_UShort            relative_gindex,\r\n                               GXV_LookupValueCPtr  base_value_p,\r\n                               FT_Bytes             lookuptbl_limit,\r\n                               GXV_Validator        valid )\r\n  {\r\n    FT_Bytes             p;\r\n    FT_Bytes             limit;\r\n    FT_UShort            offset;\r\n    GXV_LookupValueDesc  value;\r\n\r\n    /* XXX: check range ? */\r\n    offset = (FT_UShort)( base_value_p->u +\r\n                          ( relative_gindex * sizeof ( FT_UShort ) ) );\r\n\r\n    p     = valid->lookuptbl_head + offset;\r\n    limit = lookuptbl_limit;\r\n    GXV_LIMIT_CHECK( 2 );\r\n\r\n    value.u = FT_NEXT_USHORT( p );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_bsln_parts_fmt0_validate( FT_Bytes       tables,\r\n                                FT_Bytes       limit,\r\n                                GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = tables;\r\n\r\n\r\n    GXV_NAME_ENTER( \"parts format 0\" );\r\n\r\n    /* deltas */\r\n    GXV_LIMIT_CHECK( 2 * GXV_BSLN_VALUE_COUNT );\r\n\r\n    valid->table_data = NULL;      /* No ctlPoints here. */\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_bsln_parts_fmt1_validate( FT_Bytes       tables,\r\n                                FT_Bytes       limit,\r\n                                GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = tables;\r\n\r\n\r\n    GXV_NAME_ENTER( \"parts format 1\" );\r\n\r\n    /* deltas */\r\n    gxv_bsln_parts_fmt0_validate( p, limit, valid );\r\n\r\n    /* mappingData */\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_bsln_LookupValue_validate;\r\n    valid->lookupfmt4_trans = gxv_bsln_LookupFmt4_transit;\r\n    gxv_LookupTable_validate( p + 2 * GXV_BSLN_VALUE_COUNT,\r\n                              limit,\r\n                              valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_bsln_parts_fmt2_validate( FT_Bytes       tables,\r\n                                FT_Bytes       limit,\r\n                                GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = tables;\r\n\r\n    FT_UShort  stdGlyph;\r\n    FT_UShort  ctlPoint;\r\n    FT_Int     i;\r\n\r\n    FT_UShort  defaultBaseline = GXV_BSLN_DATA( defaultBaseline );\r\n\r\n\r\n    GXV_NAME_ENTER( \"parts format 2\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 + ( 2 * GXV_BSLN_VALUE_COUNT ) );\r\n\r\n    /* stdGlyph */\r\n    stdGlyph = FT_NEXT_USHORT( p );\r\n    GXV_TRACE(( \" (stdGlyph = %u)\\n\", stdGlyph ));\r\n\r\n    gxv_glyphid_validate( stdGlyph, valid );\r\n\r\n    /* Record the position of ctlPoints */\r\n    GXV_BSLN_DATA( ctlPoints_p ) = p;\r\n\r\n    /* ctlPoints */\r\n    for ( i = 0; i < GXV_BSLN_VALUE_COUNT; i++ )\r\n    {\r\n      ctlPoint = FT_NEXT_USHORT( p );\r\n      if ( ctlPoint == GXV_BSLN_VALUE_EMPTY )\r\n      {\r\n        if ( i == defaultBaseline )\r\n          FT_INVALID_DATA;\r\n      }\r\n      else\r\n        gxv_ctlPoint_validate( stdGlyph, (FT_Short)ctlPoint, valid );\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_bsln_parts_fmt3_validate( FT_Bytes       tables,\r\n                                FT_Bytes       limit,\r\n                                GXV_Validator  valid)\r\n  {\r\n    FT_Bytes  p = tables;\r\n\r\n\r\n    GXV_NAME_ENTER( \"parts format 3\" );\r\n\r\n    /* stdGlyph + ctlPoints */\r\n    gxv_bsln_parts_fmt2_validate( p, limit, valid );\r\n\r\n    /* mappingData */\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_bsln_LookupValue_validate;\r\n    valid->lookupfmt4_trans = gxv_bsln_LookupFmt4_transit;\r\n    gxv_LookupTable_validate( p + ( 2 + 2 * GXV_BSLN_VALUE_COUNT ),\r\n                              limit,\r\n                              valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         bsln TABLE                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_bsln_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n\r\n    GXV_bsln_DataRec  bslnrec;\r\n    GXV_bsln_Data     bsln = &bslnrec;\r\n\r\n    FT_Bytes  p     = table;\r\n    FT_Bytes  limit = 0;\r\n\r\n    FT_ULong   version;\r\n    FT_UShort  format;\r\n    FT_UShort  defaultBaseline;\r\n\r\n    GXV_Validate_Func  fmt_funcs_table [] =\r\n    {\r\n      gxv_bsln_parts_fmt0_validate,\r\n      gxv_bsln_parts_fmt1_validate,\r\n      gxv_bsln_parts_fmt2_validate,\r\n      gxv_bsln_parts_fmt3_validate,\r\n    };\r\n\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = bsln;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `bsln' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 + 2 );\r\n    version         = FT_NEXT_ULONG( p );\r\n    format          = FT_NEXT_USHORT( p );\r\n    defaultBaseline = FT_NEXT_USHORT( p );\r\n\r\n    /* only version 1.0 is defined (1996) */\r\n    if ( version != 0x00010000UL )\r\n      FT_INVALID_FORMAT;\r\n\r\n    /* only format 1, 2, 3 are defined (1996) */\r\n    GXV_TRACE(( \" (format = %d)\\n\", format ));\r\n    if ( format > 3 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    if ( defaultBaseline > 31 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    bsln->defaultBaseline = defaultBaseline;\r\n\r\n    fmt_funcs_table[format]( p, limit, valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* arch-tag: ebe81143-fdaa-4c68-a4d1-b57227daa3bc\r\n   (do not change this comment) */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvcommn.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvcommn.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT common tables validation (body).                      */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2009, 2010                                       */\r\n/*  by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvcommon\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       16bit offset sorter                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static int\r\n  gxv_compare_ushort_offset( FT_UShort*  a,\r\n                             FT_UShort*  b )\r\n  {\r\n    if ( *a < *b )\r\n      return -1;\r\n    else if ( *a > *b )\r\n      return 1;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_set_length_by_ushort_offset( FT_UShort*     offset,\r\n                                   FT_UShort**    length,\r\n                                   FT_UShort*     buff,\r\n                                   FT_UInt        nmemb,\r\n                                   FT_UShort      limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    FT_UInt  i;\r\n\r\n\r\n    for ( i = 0; i < nmemb; i++ )\r\n      *(length[i]) = 0;\r\n\r\n    for ( i = 0; i < nmemb; i++ )\r\n      buff[i] = offset[i];\r\n    buff[nmemb] = limit;\r\n\r\n    ft_qsort( buff, ( nmemb + 1 ), sizeof ( FT_UShort ),\r\n              ( int(*)(const void*, const void*) )gxv_compare_ushort_offset );\r\n\r\n    if ( buff[nmemb] > limit )\r\n      FT_INVALID_OFFSET;\r\n\r\n    for ( i = 0; i < nmemb; i++ )\r\n    {\r\n      FT_UInt  j;\r\n\r\n\r\n      for ( j = 0; j < nmemb; j++ )\r\n        if ( buff[j] == offset[i] )\r\n          break;\r\n\r\n      if ( j == nmemb )\r\n        FT_INVALID_OFFSET;\r\n\r\n      *(length[i]) = (FT_UShort)( buff[j + 1] - buff[j] );\r\n\r\n      if ( 0 != offset[i] && 0 == *(length[i]) )\r\n        FT_INVALID_OFFSET;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       32bit offset sorter                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static int\r\n  gxv_compare_ulong_offset( FT_ULong*  a,\r\n                            FT_ULong*  b )\r\n  {\r\n    if ( *a < *b )\r\n      return -1;\r\n    else if ( *a > *b )\r\n      return 1;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_set_length_by_ulong_offset( FT_ULong*      offset,\r\n                                  FT_ULong**     length,\r\n                                  FT_ULong*      buff,\r\n                                  FT_UInt        nmemb,\r\n                                  FT_ULong       limit,\r\n                                  GXV_Validator  valid)\r\n  {\r\n    FT_UInt  i;\r\n\r\n\r\n    for ( i = 0; i < nmemb; i++ )\r\n      *(length[i]) = 0;\r\n\r\n    for ( i = 0; i < nmemb; i++ )\r\n      buff[i] = offset[i];\r\n    buff[nmemb] = limit;\r\n\r\n    ft_qsort( buff, ( nmemb + 1 ), sizeof ( FT_ULong ),\r\n              ( int(*)(const void*, const void*) )gxv_compare_ulong_offset );\r\n\r\n    if ( buff[nmemb] > limit )\r\n      FT_INVALID_OFFSET;\r\n\r\n    for ( i = 0; i < nmemb; i++ )\r\n    {\r\n      FT_UInt  j;\r\n\r\n\r\n      for ( j = 0; j < nmemb; j++ )\r\n        if ( buff[j] == offset[i] )\r\n          break;\r\n\r\n      if ( j == nmemb )\r\n        FT_INVALID_OFFSET;\r\n\r\n      *(length[i]) = buff[j + 1] - buff[j];\r\n\r\n      if ( 0 != offset[i] && 0 == *(length[i]) )\r\n        FT_INVALID_OFFSET;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****               scan value array and get min & max              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_array_getlimits_byte( FT_Bytes       table,\r\n                            FT_Bytes       limit,\r\n                            FT_Byte*       min,\r\n                            FT_Byte*       max,\r\n                            GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    *min = 0xFF;\r\n    *max = 0x00;\r\n\r\n    while ( p < limit )\r\n    {\r\n      FT_Byte  val;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 1 );\r\n      val = FT_NEXT_BYTE( p );\r\n\r\n      *min = (FT_Byte)FT_MIN( *min, val );\r\n      *max = (FT_Byte)FT_MAX( *max, val );\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_array_getlimits_ushort( FT_Bytes       table,\r\n                              FT_Bytes       limit,\r\n                              FT_UShort*     min,\r\n                              FT_UShort*     max,\r\n                              GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    *min = 0xFFFFU;\r\n    *max = 0x0000;\r\n\r\n    while ( p < limit )\r\n    {\r\n      FT_UShort  val;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 );\r\n      val = FT_NEXT_USHORT( p );\r\n\r\n      *min = (FT_Byte)FT_MIN( *min, val );\r\n      *max = (FT_Byte)FT_MAX( *max, val );\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       BINSEARCHHEADER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  GXV_BinSrchHeader_\r\n  {\r\n    FT_UShort  unitSize;\r\n    FT_UShort  nUnits;\r\n    FT_UShort  searchRange;\r\n    FT_UShort  entrySelector;\r\n    FT_UShort  rangeShift;\r\n\r\n  } GXV_BinSrchHeader;\r\n\r\n\r\n  static void\r\n  gxv_BinSrchHeader_check_consistency( GXV_BinSrchHeader*  binSrchHeader,\r\n                                       GXV_Validator       valid )\r\n  {\r\n    FT_UShort  searchRange;\r\n    FT_UShort  entrySelector;\r\n    FT_UShort  rangeShift;\r\n\r\n\r\n    if ( binSrchHeader->unitSize == 0 )\r\n      FT_INVALID_DATA;\r\n\r\n    if ( binSrchHeader->nUnits == 0 )\r\n    {\r\n      if ( binSrchHeader->searchRange   == 0 &&\r\n           binSrchHeader->entrySelector == 0 &&\r\n           binSrchHeader->rangeShift    == 0 )\r\n        return;\r\n      else\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    for ( searchRange = 1, entrySelector = 1;\r\n          ( searchRange * 2 ) <= binSrchHeader->nUnits &&\r\n            searchRange < 0x8000U;\r\n          searchRange *= 2, entrySelector++ )\r\n      ;\r\n\r\n    entrySelector--;\r\n    searchRange = (FT_UShort)( searchRange * binSrchHeader->unitSize );\r\n    rangeShift  = (FT_UShort)( binSrchHeader->nUnits * binSrchHeader->unitSize\r\n                               - searchRange );\r\n\r\n    if ( searchRange   != binSrchHeader->searchRange   ||\r\n         entrySelector != binSrchHeader->entrySelector ||\r\n         rangeShift    != binSrchHeader->rangeShift    )\r\n    {\r\n      GXV_TRACE(( \"Inconsistency found in BinSrchHeader\\n\" ));\r\n      GXV_TRACE(( \"originally: unitSize=%d, nUnits=%d, \"\r\n                  \"searchRange=%d, entrySelector=%d, \"\r\n                  \"rangeShift=%d\\n\",\r\n                  binSrchHeader->unitSize, binSrchHeader->nUnits,\r\n                  binSrchHeader->searchRange, binSrchHeader->entrySelector,\r\n                  binSrchHeader->rangeShift ));\r\n      GXV_TRACE(( \"calculated: unitSize=%d, nUnits=%d, \"\r\n                  \"searchRange=%d, entrySelector=%d, \"\r\n                  \"rangeShift=%d\\n\",\r\n                  binSrchHeader->unitSize, binSrchHeader->nUnits,\r\n                  searchRange, entrySelector, rangeShift ));\r\n\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n  }\r\n\r\n\r\n  /*\r\n   * parser & validator of BinSrchHeader\r\n   * which is used in LookupTable format 2, 4, 6.\r\n   *\r\n   * Essential parameters (unitSize, nUnits) are returned by\r\n   * given pointer, others (searchRange, entrySelector, rangeShift)\r\n   * can be calculated by essential parameters, so they are just\r\n   * validated and discarded.\r\n   *\r\n   * However, wrong values in searchRange, entrySelector, rangeShift\r\n   * won't cause fatal errors, because these parameters might be\r\n   * only used in old m68k font driver in MacOS.\r\n   *   -- suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>\r\n   */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_BinSrchHeader_validate( FT_Bytes       table,\r\n                              FT_Bytes       limit,\r\n                              FT_UShort*     unitSize_p,\r\n                              FT_UShort*     nUnits_p,\r\n                              GXV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    GXV_BinSrchHeader  binSrchHeader;\r\n\r\n\r\n    GXV_NAME_ENTER( \"BinSrchHeader validate\" );\r\n\r\n    if ( *unitSize_p == 0 )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 );\r\n      binSrchHeader.unitSize =  FT_NEXT_USHORT( p );\r\n    }\r\n    else\r\n      binSrchHeader.unitSize = *unitSize_p;\r\n\r\n    if ( *nUnits_p == 0 )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 );\r\n      binSrchHeader.nUnits = FT_NEXT_USHORT( p );\r\n    }\r\n    else\r\n      binSrchHeader.nUnits = *nUnits_p;\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 );\r\n    binSrchHeader.searchRange   = FT_NEXT_USHORT( p );\r\n    binSrchHeader.entrySelector = FT_NEXT_USHORT( p );\r\n    binSrchHeader.rangeShift    = FT_NEXT_USHORT( p );\r\n    GXV_TRACE(( \"nUnits %d\\n\", binSrchHeader.nUnits ));\r\n\r\n    gxv_BinSrchHeader_check_consistency( &binSrchHeader, valid );\r\n\r\n    if ( *unitSize_p == 0 )\r\n      *unitSize_p = binSrchHeader.unitSize;\r\n\r\n    if ( *nUnits_p == 0 )\r\n      *nUnits_p = binSrchHeader.nUnits;\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         LOOKUP TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define GXV_LOOKUP_VALUE_LOAD( P, SIGNSPEC )                   \\\r\n          ( P += 2, gxv_lookup_value_load( P - 2, SIGNSPEC ) )\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_lookup_value_load( FT_Bytes  p,\r\n                         int       signspec )\r\n  {\r\n    GXV_LookupValueDesc  v;\r\n\r\n\r\n    if ( signspec == GXV_LOOKUPVALUE_UNSIGNED )\r\n      v.u = FT_NEXT_USHORT( p );\r\n    else\r\n      v.s = FT_NEXT_SHORT( p );\r\n\r\n    return v;\r\n  }\r\n\r\n\r\n#define GXV_UNITSIZE_VALIDATE( FORMAT, UNITSIZE, NUNITS, CORRECTSIZE ) \\\r\n          FT_BEGIN_STMNT                                               \\\r\n            if ( UNITSIZE != CORRECTSIZE )                             \\\r\n            {                                                          \\\r\n              FT_ERROR(( \"unitSize=%d differs from\"                    \\\r\n                         \" expected unitSize=%d\"                       \\\r\n                         \" in LookupTable %s\\n\",                       \\\r\n                          UNITSIZE, CORRECTSIZE, FORMAT ));            \\\r\n              if ( UNITSIZE != 0 && NUNITS != 0 )                      \\\r\n              {                                                        \\\r\n                FT_ERROR(( \" cannot validate anymore\\n\" ));            \\\r\n                FT_INVALID_FORMAT;                                     \\\r\n              }                                                        \\\r\n              else                                                     \\\r\n                FT_ERROR(( \" forcibly continues\\n\" ));                 \\\r\n            }                                                          \\\r\n          FT_END_STMNT\r\n\r\n\r\n  /* ================= Simple Array Format 0 Lookup Table ================ */\r\n  static void\r\n  gxv_LookupTable_fmt0_validate( FT_Bytes       table,\r\n                                 FT_Bytes       limit,\r\n                                 GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  i;\r\n\r\n    GXV_LookupValueDesc  value;\r\n\r\n\r\n    GXV_NAME_ENTER( \"LookupTable format 0\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 * valid->face->num_glyphs );\r\n\r\n    for ( i = 0; i < valid->face->num_glyphs; i++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 );\r\n      if ( p + 2 >= limit )     /* some fonts have too-short fmt0 array */\r\n      {\r\n        GXV_TRACE(( \"too short, glyphs %d - %d are missing\\n\",\r\n                    i, valid->face->num_glyphs ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n        break;\r\n      }\r\n\r\n      value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );\r\n      valid->lookupval_func( i, &value, valid );\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ================= Segment Single Format 2 Loolup Table ============== */\r\n  /*\r\n   * Apple spec says:\r\n   *\r\n   *   To guarantee that a binary search terminates, you must include one or\r\n   *   more special `end of search table' values at the end of the data to\r\n   *   be searched.  The number of termination values that need to be\r\n   *   included is table-specific.  The value that indicates binary search\r\n   *   termination is 0xFFFF.\r\n   *\r\n   * The problem is that nUnits does not include this end-marker.  It's\r\n   * quite difficult to discriminate whether the following 0xFFFF comes from\r\n   * the end-marker or some next data.\r\n   *\r\n   *   -- suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>\r\n   */\r\n  static void\r\n  gxv_LookupTable_fmt2_skip_endmarkers( FT_Bytes       table,\r\n                                        FT_UShort      unitSize,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    while ( ( p + 4 ) < valid->root->limit )\r\n    {\r\n      if ( p[0] != 0xFF || p[1] != 0xFF || /* lastGlyph */\r\n           p[2] != 0xFF || p[3] != 0xFF )  /* firstGlyph */\r\n        break;\r\n      p += unitSize;\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_LookupTable_fmt2_validate( FT_Bytes       table,\r\n                                 FT_Bytes       limit,\r\n                                 GXV_Validator  valid )\r\n  {\r\n    FT_Bytes             p = table;\r\n    FT_UShort            gid;\r\n\r\n    FT_UShort            unitSize;\r\n    FT_UShort            nUnits;\r\n    FT_UShort            unit;\r\n    FT_UShort            lastGlyph;\r\n    FT_UShort            firstGlyph;\r\n    GXV_LookupValueDesc  value;\r\n\r\n\r\n    GXV_NAME_ENTER( \"LookupTable format 2\" );\r\n\r\n    unitSize = nUnits = 0;\r\n    gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid );\r\n    p += valid->subtable_length;\r\n\r\n    GXV_UNITSIZE_VALIDATE( \"format2\", unitSize, nUnits, 6 );\r\n\r\n    for ( unit = 0, gid = 0; unit < nUnits; unit++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 + 2 + 2 );\r\n      lastGlyph  = FT_NEXT_USHORT( p );\r\n      firstGlyph = FT_NEXT_USHORT( p );\r\n      value      = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );\r\n\r\n      gxv_glyphid_validate( firstGlyph, valid );\r\n      gxv_glyphid_validate( lastGlyph, valid );\r\n\r\n      if ( lastGlyph < gid )\r\n      {\r\n        GXV_TRACE(( \"reverse ordered segment specification:\"\r\n                    \" lastGlyph[%d]=%d < lastGlyph[%d]=%d\\n\",\r\n                    unit, lastGlyph, unit - 1 , gid ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n      }\r\n\r\n      if ( lastGlyph < firstGlyph )\r\n      {\r\n        GXV_TRACE(( \"reverse ordered range specification at unit %d:\",\r\n                    \" lastGlyph %d < firstGlyph %d \",\r\n                    unit, lastGlyph, firstGlyph ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n\r\n        if ( valid->root->level == FT_VALIDATE_TIGHT )\r\n          continue;     /* ftxvalidator silently skips such an entry */\r\n\r\n        FT_TRACE4(( \"continuing with exchanged values\\n\" ));\r\n        gid        = firstGlyph;\r\n        firstGlyph = lastGlyph;\r\n        lastGlyph  = gid;\r\n      }\r\n\r\n      for ( gid = firstGlyph; gid <= lastGlyph; gid++ )\r\n        valid->lookupval_func( gid, &value, valid );\r\n    }\r\n\r\n    gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );\r\n    p += valid->subtable_length;\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ================= Segment Array Format 4 Lookup Table =============== */\r\n  static void\r\n  gxv_LookupTable_fmt4_validate( FT_Bytes       table,\r\n                                 FT_Bytes       limit,\r\n                                 GXV_Validator  valid )\r\n  {\r\n    FT_Bytes             p = table;\r\n    FT_UShort            unit;\r\n    FT_UShort            gid;\r\n\r\n    FT_UShort            unitSize;\r\n    FT_UShort            nUnits;\r\n    FT_UShort            lastGlyph;\r\n    FT_UShort            firstGlyph;\r\n    GXV_LookupValueDesc  base_value;\r\n    GXV_LookupValueDesc  value;\r\n\r\n\r\n    GXV_NAME_ENTER( \"LookupTable format 4\" );\r\n\r\n    unitSize = nUnits = 0;\r\n    gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid );\r\n    p += valid->subtable_length;\r\n\r\n    GXV_UNITSIZE_VALIDATE( \"format4\", unitSize, nUnits, 6 );\r\n\r\n    for ( unit = 0, gid = 0; unit < nUnits; unit++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 + 2 );\r\n      lastGlyph  = FT_NEXT_USHORT( p );\r\n      firstGlyph = FT_NEXT_USHORT( p );\r\n\r\n      gxv_glyphid_validate( firstGlyph, valid );\r\n      gxv_glyphid_validate( lastGlyph, valid );\r\n\r\n      if ( lastGlyph < gid )\r\n      {\r\n        GXV_TRACE(( \"reverse ordered segment specification:\"\r\n                    \" lastGlyph[%d]=%d < lastGlyph[%d]=%d\\n\",\r\n                    unit, lastGlyph, unit - 1 , gid ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n      }\r\n\r\n      if ( lastGlyph < firstGlyph )\r\n      {\r\n        GXV_TRACE(( \"reverse ordered range specification at unit %d:\",\r\n                    \" lastGlyph %d < firstGlyph %d \",\r\n                    unit, lastGlyph, firstGlyph ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n\r\n        if ( valid->root->level == FT_VALIDATE_TIGHT )\r\n          continue; /* ftxvalidator silently skips such an entry */\r\n\r\n        FT_TRACE4(( \"continuing with exchanged values\\n\" ));\r\n        gid        = firstGlyph;\r\n        firstGlyph = lastGlyph;\r\n        lastGlyph  = gid;\r\n      }\r\n\r\n      GXV_LIMIT_CHECK( 2 );\r\n      base_value = GXV_LOOKUP_VALUE_LOAD( p, GXV_LOOKUPVALUE_UNSIGNED );\r\n\r\n      for ( gid = firstGlyph; gid <= lastGlyph; gid++ )\r\n      {\r\n        value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ),\r\n                                         &base_value,\r\n                                         limit,\r\n                                         valid );\r\n\r\n        valid->lookupval_func( gid, &value, valid );\r\n      }\r\n    }\r\n\r\n    gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );\r\n    p += valid->subtable_length;\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ================= Segment Table Format 6 Lookup Table =============== */\r\n  static void\r\n  gxv_LookupTable_fmt6_skip_endmarkers( FT_Bytes       table,\r\n                                        FT_UShort      unitSize,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    while ( p < valid->root->limit )\r\n    {\r\n      if ( p[0] != 0xFF || p[1] != 0xFF )\r\n        break;\r\n      p += unitSize;\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_LookupTable_fmt6_validate( FT_Bytes       table,\r\n                                 FT_Bytes       limit,\r\n                                 GXV_Validator  valid )\r\n  {\r\n    FT_Bytes             p = table;\r\n    FT_UShort            unit;\r\n    FT_UShort            prev_glyph;\r\n\r\n    FT_UShort            unitSize;\r\n    FT_UShort            nUnits;\r\n    FT_UShort            glyph;\r\n    GXV_LookupValueDesc  value;\r\n\r\n\r\n    GXV_NAME_ENTER( \"LookupTable format 6\" );\r\n\r\n    unitSize = nUnits = 0;\r\n    gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid );\r\n    p += valid->subtable_length;\r\n\r\n    GXV_UNITSIZE_VALIDATE( \"format6\", unitSize, nUnits, 4 );\r\n\r\n    for ( unit = 0, prev_glyph = 0; unit < nUnits; unit++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 + 2 );\r\n      glyph = FT_NEXT_USHORT( p );\r\n      value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );\r\n\r\n      if ( gxv_glyphid_validate( glyph, valid ) )\r\n        GXV_TRACE(( \" endmarker found within defined range\"\r\n                    \" (entry %d < nUnits=%d)\\n\",\r\n                    unit, nUnits ));\r\n\r\n      if ( prev_glyph > glyph )\r\n      {\r\n        GXV_TRACE(( \"current gid 0x%04x < previous gid 0x%04x\\n\",\r\n                    glyph, prev_glyph ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n      }\r\n      prev_glyph = glyph;\r\n\r\n      valid->lookupval_func( glyph, &value, valid );\r\n    }\r\n\r\n    gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid );\r\n    p += valid->subtable_length;\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ================= Trimmed Array Format 8 Lookup Table =============== */\r\n  static void\r\n  gxv_LookupTable_fmt8_validate( FT_Bytes       table,\r\n                                 FT_Bytes       limit,\r\n                                 GXV_Validator  valid )\r\n  {\r\n    FT_Bytes              p = table;\r\n    FT_UShort             i;\r\n\r\n    GXV_LookupValueDesc   value;\r\n    FT_UShort             firstGlyph;\r\n    FT_UShort             glyphCount;\r\n\r\n\r\n    GXV_NAME_ENTER( \"LookupTable format 8\" );\r\n\r\n    /* firstGlyph + glyphCount */\r\n    GXV_LIMIT_CHECK( 2 + 2 );\r\n    firstGlyph = FT_NEXT_USHORT( p );\r\n    glyphCount = FT_NEXT_USHORT( p );\r\n\r\n    gxv_glyphid_validate( firstGlyph, valid );\r\n    gxv_glyphid_validate( (FT_UShort)( firstGlyph + glyphCount ), valid );\r\n\r\n    /* valueArray */\r\n    for ( i = 0; i < glyphCount; i++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 );\r\n      value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );\r\n      valid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, valid );\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_LookupTable_validate( FT_Bytes       table,\r\n                            FT_Bytes       limit,\r\n                            GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  format;\r\n\r\n    GXV_Validate_Func  fmt_funcs_table[] =\r\n    {\r\n      gxv_LookupTable_fmt0_validate, /* 0 */\r\n      NULL,                          /* 1 */\r\n      gxv_LookupTable_fmt2_validate, /* 2 */\r\n      NULL,                          /* 3 */\r\n      gxv_LookupTable_fmt4_validate, /* 4 */\r\n      NULL,                          /* 5 */\r\n      gxv_LookupTable_fmt6_validate, /* 6 */\r\n      NULL,                          /* 7 */\r\n      gxv_LookupTable_fmt8_validate, /* 8 */\r\n    };\r\n\r\n    GXV_Validate_Func  func;\r\n\r\n\r\n    GXV_NAME_ENTER( \"LookupTable\" );\r\n\r\n    /* lookuptbl_head may be used in fmt4 transit function. */\r\n    valid->lookuptbl_head = table;\r\n\r\n    /* format */\r\n    GXV_LIMIT_CHECK( 2 );\r\n    format = FT_NEXT_USHORT( p );\r\n    GXV_TRACE(( \" (format %d)\\n\", format ));\r\n\r\n    if ( format > 8 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    func = fmt_funcs_table[format];\r\n    if ( func == NULL )\r\n      FT_INVALID_FORMAT;\r\n\r\n    func( p, limit, valid );\r\n    p += valid->subtable_length;\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          Glyph ID                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  gxv_glyphid_validate( FT_UShort      gid,\r\n                        GXV_Validator  valid )\r\n  {\r\n    FT_Face  face;\r\n\r\n\r\n    if ( gid == 0xFFFFU )\r\n    {\r\n      GXV_EXIT;\r\n      return 1;\r\n    }\r\n\r\n    face = valid->face;\r\n    if ( face->num_glyphs < gid )\r\n    {\r\n      GXV_TRACE(( \" gxv_glyphid_check() gid overflow: num_glyphs %d < %d\\n\",\r\n                  face->num_glyphs, gid ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        CONTROL POINT                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_ctlPoint_validate( FT_UShort      gid,\r\n                         FT_Short       ctl_point,\r\n                         GXV_Validator  valid )\r\n  {\r\n    FT_Face       face;\r\n    FT_Error      error;\r\n\r\n    FT_GlyphSlot  glyph;\r\n    FT_Outline    outline;\r\n    short         n_points;\r\n\r\n\r\n    face = valid->face;\r\n\r\n    error = FT_Load_Glyph( face,\r\n                           gid,\r\n                           FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM );\r\n    if ( error )\r\n      FT_INVALID_GLYPH_ID;\r\n\r\n    glyph    = face->glyph;\r\n    outline  = glyph->outline;\r\n    n_points = outline.n_points;\r\n\r\n\r\n    if ( !( ctl_point < n_points ) )\r\n      FT_INVALID_DATA;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          SFNT NAME                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_sfntName_validate( FT_UShort      name_index,\r\n                         FT_UShort      min_index,\r\n                         FT_UShort      max_index,\r\n                         GXV_Validator  valid )\r\n  {\r\n    FT_SfntName  name;\r\n    FT_UInt      i;\r\n    FT_UInt      nnames;\r\n\r\n\r\n    GXV_NAME_ENTER( \"sfntName\" );\r\n\r\n    if ( name_index < min_index || max_index < name_index )\r\n      FT_INVALID_FORMAT;\r\n\r\n    nnames = FT_Get_Sfnt_Name_Count( valid->face );\r\n    for ( i = 0; i < nnames; i++ )\r\n    {\r\n      if ( FT_Get_Sfnt_Name( valid->face, i, &name ) != GXV_Err_Ok )\r\n        continue ;\r\n\r\n      if ( name.name_id == name_index )\r\n        goto Out;\r\n    }\r\n\r\n    GXV_TRACE(( \"  nameIndex = %d (UNTITLED)\\n\", name_index ));\r\n    FT_INVALID_DATA;\r\n    goto Exit;  /* make compiler happy */\r\n\r\n  Out:\r\n    FT_TRACE1(( \"  nameIndex = %d (\", name_index ));\r\n    GXV_TRACE_HEXDUMP_SFNTNAME( name );\r\n    FT_TRACE1(( \")\\n\" ));\r\n\r\n  Exit:\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          STATE TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* -------------------------- Class Table --------------------------- */\r\n\r\n  /*\r\n   * highestClass specifies how many classes are defined in this\r\n   * Class Subtable.  Apple spec does not mention whether undefined\r\n   * holes in the class (e.g.: 0-3 are predefined, 4 is unused, 5 is used)\r\n   * are permitted.  At present, holes in a defined class are not checked.\r\n   *   -- suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>\r\n   */\r\n\r\n  static void\r\n  gxv_ClassTable_validate( FT_Bytes       table,\r\n                           FT_UShort*     length_p,\r\n                           FT_UShort      stateSize,\r\n                           FT_Byte*       maxClassID_p,\r\n                           GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p     = table;\r\n    FT_Bytes   limit = table + *length_p;\r\n    FT_UShort  firstGlyph;\r\n    FT_UShort  nGlyphs;\r\n\r\n\r\n    GXV_NAME_ENTER( \"ClassTable\" );\r\n\r\n    *maxClassID_p = 3;  /* Classes 0, 2, and 3 are predefined */\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 );\r\n    firstGlyph = FT_NEXT_USHORT( p );\r\n    nGlyphs    = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \" (firstGlyph = %d, nGlyphs = %d)\\n\", firstGlyph, nGlyphs ));\r\n\r\n    if ( !nGlyphs )\r\n      goto Out;\r\n\r\n    gxv_glyphid_validate( (FT_UShort)( firstGlyph + nGlyphs ), valid );\r\n\r\n    {\r\n      FT_Byte    nGlyphInClass[256];\r\n      FT_Byte    classID;\r\n      FT_UShort  i;\r\n\r\n\r\n      ft_memset( nGlyphInClass, 0, 256 );\r\n\r\n\r\n      for ( i = 0; i < nGlyphs; i++ )\r\n      {\r\n        GXV_LIMIT_CHECK( 1 );\r\n        classID = FT_NEXT_BYTE( p );\r\n        switch ( classID )\r\n        {\r\n          /* following classes should not appear in class array */\r\n        case 0:             /* end of text */\r\n        case 2:             /* out of bounds */\r\n        case 3:             /* end of line */\r\n          FT_INVALID_DATA;\r\n          break;\r\n\r\n        case 1:             /* out of bounds */\r\n        default:            /* user-defined: 4 - ( stateSize - 1 ) */\r\n          if ( classID >= stateSize )\r\n            FT_INVALID_DATA;   /* assign glyph to undefined state */\r\n\r\n          nGlyphInClass[classID]++;\r\n          break;\r\n        }\r\n      }\r\n      *length_p = (FT_UShort)( p - table );\r\n\r\n      /* scan max ClassID in use */\r\n      for ( i = 0; i < stateSize; i++ )\r\n        if ( ( 3 < i ) && ( nGlyphInClass[i] > 0 ) )\r\n          *maxClassID_p = (FT_Byte)i;  /* XXX: Check Range? */\r\n    }\r\n\r\n  Out:\r\n    GXV_TRACE(( \"Declared stateSize=0x%02x, Used maxClassID=0x%02x\\n\",\r\n                stateSize, *maxClassID_p ));\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* --------------------------- State Array ----------------------------- */\r\n\r\n  static void\r\n  gxv_StateArray_validate( FT_Bytes       table,\r\n                           FT_UShort*     length_p,\r\n                           FT_Byte        maxClassID,\r\n                           FT_UShort      stateSize,\r\n                           FT_Byte*       maxState_p,\r\n                           FT_Byte*       maxEntry_p,\r\n                           GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_Bytes  limit = table + *length_p;\r\n    FT_Byte   clazz;\r\n    FT_Byte   entry;\r\n\r\n    FT_UNUSED( stateSize ); /* for the non-debugging case */\r\n\r\n\r\n    GXV_NAME_ENTER( \"StateArray\" );\r\n\r\n    GXV_TRACE(( \"parse %d bytes by stateSize=%d maxClassID=%d\\n\",\r\n                (int)(*length_p), stateSize, (int)(maxClassID) ));\r\n\r\n    /*\r\n     * 2 states are predefined and must be described in StateArray:\r\n     * state 0 (start of text), 1 (start of line)\r\n     */\r\n    GXV_LIMIT_CHECK( ( 1 + maxClassID ) * 2 );\r\n\r\n    *maxState_p = 0;\r\n    *maxEntry_p = 0;\r\n\r\n    /* read if enough to read another state */\r\n    while ( p + ( 1 + maxClassID ) <= limit )\r\n    {\r\n      (*maxState_p)++;\r\n      for ( clazz = 0; clazz <= maxClassID; clazz++ )\r\n      {\r\n        entry = FT_NEXT_BYTE( p );\r\n        *maxEntry_p = (FT_Byte)FT_MAX( *maxEntry_p, entry );\r\n      }\r\n    }\r\n    GXV_TRACE(( \"parsed: maxState=%d, maxEntry=%d\\n\",\r\n                *maxState_p, *maxEntry_p ));\r\n\r\n    *length_p = (FT_UShort)( p - table );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* --------------------------- Entry Table ----------------------------- */\r\n\r\n  static void\r\n  gxv_EntryTable_validate( FT_Bytes       table,\r\n                           FT_UShort*     length_p,\r\n                           FT_Byte        maxEntry,\r\n                           FT_UShort      stateArray,\r\n                           FT_UShort      stateArray_length,\r\n                           FT_Byte        maxClassID,\r\n                           FT_Bytes       statetable_table,\r\n                           FT_Bytes       statetable_limit,\r\n                           GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p     = table;\r\n    FT_Bytes  limit = table + *length_p;\r\n    FT_Byte   entry;\r\n    FT_Byte   state;\r\n    FT_Int    entrySize = 2 + 2 + GXV_GLYPHOFFSET_SIZE( statetable );\r\n\r\n    GXV_XStateTable_GlyphOffsetDesc  glyphOffset;\r\n\r\n\r\n    GXV_NAME_ENTER( \"EntryTable\" );\r\n\r\n    GXV_TRACE(( \"maxEntry=%d entrySize=%d\\n\", maxEntry, entrySize ));\r\n\r\n    if ( ( maxEntry + 1 ) * entrySize > *length_p )\r\n    {\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_TOO_SHORT );\r\n\r\n      /* ftxvalidator and FontValidator both warn and continue */\r\n      maxEntry = (FT_Byte)( *length_p / entrySize - 1 );\r\n      GXV_TRACE(( \"too large maxEntry, shrinking to %d fit EntryTable length\\n\",\r\n                  maxEntry ));\r\n    }\r\n\r\n    for ( entry = 0; entry <= maxEntry; entry++ )\r\n    {\r\n      FT_UShort  newState;\r\n      FT_UShort  flags;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 + 2 );\r\n      newState = FT_NEXT_USHORT( p );\r\n      flags    = FT_NEXT_USHORT( p );\r\n\r\n\r\n      if ( newState < stateArray                     ||\r\n           stateArray + stateArray_length < newState )\r\n      {\r\n        GXV_TRACE(( \" newState offset 0x%04x is out of stateArray\\n\",\r\n                    newState ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n        continue;\r\n      }\r\n\r\n      if ( 0 != ( ( newState - stateArray ) % ( 1 + maxClassID ) ) )\r\n      {\r\n        GXV_TRACE(( \" newState offset 0x%04x is not aligned to %d-classes\\n\",\r\n                    newState,  1 + maxClassID ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n        continue;\r\n      }\r\n\r\n      state = (FT_Byte)( ( newState - stateArray ) / ( 1 + maxClassID ) );\r\n\r\n      switch ( GXV_GLYPHOFFSET_FMT( statetable ) )\r\n      {\r\n      case GXV_GLYPHOFFSET_NONE:\r\n        glyphOffset.uc = 0;  /* make compiler happy */\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_UCHAR:\r\n        glyphOffset.uc = FT_NEXT_BYTE( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_CHAR:\r\n        glyphOffset.c = FT_NEXT_CHAR( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_USHORT:\r\n        glyphOffset.u = FT_NEXT_USHORT( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_SHORT:\r\n        glyphOffset.s = FT_NEXT_SHORT( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_ULONG:\r\n        glyphOffset.ul = FT_NEXT_ULONG( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_LONG:\r\n        glyphOffset.l = FT_NEXT_LONG( p );\r\n        break;\r\n\r\n      default:\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT );\r\n        goto Exit;\r\n      }\r\n\r\n      if ( NULL != valid->statetable.entry_validate_func )\r\n        valid->statetable.entry_validate_func( state,\r\n                                               flags,\r\n                                               &glyphOffset,\r\n                                               statetable_table,\r\n                                               statetable_limit,\r\n                                               valid );\r\n    }\r\n\r\n  Exit:\r\n    *length_p = (FT_UShort)( p - table );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* =========================== State Table ============================= */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_StateTable_subtable_setup( FT_UShort      table_size,\r\n                                 FT_UShort      classTable,\r\n                                 FT_UShort      stateArray,\r\n                                 FT_UShort      entryTable,\r\n                                 FT_UShort*     classTable_length_p,\r\n                                 FT_UShort*     stateArray_length_p,\r\n                                 FT_UShort*     entryTable_length_p,\r\n                                 GXV_Validator  valid )\r\n  {\r\n    FT_UShort   o[3];\r\n    FT_UShort*  l[3];\r\n    FT_UShort   buff[4];\r\n\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n\r\n    gxv_set_length_by_ushort_offset( o, l, buff, 3, table_size, valid );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_StateTable_validate( FT_Bytes       table,\r\n                           FT_Bytes       limit,\r\n                           GXV_Validator  valid )\r\n  {\r\n    FT_UShort   stateSize;\r\n    FT_UShort   classTable;     /* offset to Class(Sub)Table */\r\n    FT_UShort   stateArray;     /* offset to StateArray */\r\n    FT_UShort   entryTable;     /* offset to EntryTable */\r\n\r\n    FT_UShort   classTable_length;\r\n    FT_UShort   stateArray_length;\r\n    FT_UShort   entryTable_length;\r\n    FT_Byte     maxClassID;\r\n    FT_Byte     maxState;\r\n    FT_Byte     maxEntry;\r\n\r\n    GXV_StateTable_Subtable_Setup_Func  setup_func;\r\n\r\n    FT_Bytes    p = table;\r\n\r\n\r\n    GXV_NAME_ENTER( \"StateTable\" );\r\n\r\n    GXV_TRACE(( \"StateTable header\\n\" ));\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 + 2 );\r\n    stateSize  = FT_NEXT_USHORT( p );\r\n    classTable = FT_NEXT_USHORT( p );\r\n    stateArray = FT_NEXT_USHORT( p );\r\n    entryTable = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \"stateSize=0x%04x\\n\", stateSize ));\r\n    GXV_TRACE(( \"offset to classTable=0x%04x\\n\", classTable ));\r\n    GXV_TRACE(( \"offset to stateArray=0x%04x\\n\", stateArray ));\r\n    GXV_TRACE(( \"offset to entryTable=0x%04x\\n\", entryTable ));\r\n\r\n    if ( stateSize > 0xFF )\r\n      FT_INVALID_DATA;\r\n\r\n    if ( valid->statetable.optdata_load_func != NULL )\r\n      valid->statetable.optdata_load_func( p, limit, valid );\r\n\r\n    if ( valid->statetable.subtable_setup_func != NULL)\r\n      setup_func = valid->statetable.subtable_setup_func;\r\n    else\r\n      setup_func = gxv_StateTable_subtable_setup;\r\n\r\n    setup_func( (FT_UShort)( limit - table ),\r\n                classTable,\r\n                stateArray,\r\n                entryTable,\r\n                &classTable_length,\r\n                &stateArray_length,\r\n                &entryTable_length,\r\n                valid );\r\n\r\n    GXV_TRACE(( \"StateTable Subtables\\n\" ));\r\n\r\n    if ( classTable != 0 )\r\n      gxv_ClassTable_validate( table + classTable,\r\n                               &classTable_length,\r\n                               stateSize,\r\n                               &maxClassID,\r\n                               valid );\r\n    else\r\n      maxClassID = (FT_Byte)( stateSize - 1 );\r\n\r\n    if ( stateArray != 0 )\r\n      gxv_StateArray_validate( table + stateArray,\r\n                               &stateArray_length,\r\n                               maxClassID,\r\n                               stateSize,\r\n                               &maxState,\r\n                               &maxEntry,\r\n                               valid );\r\n    else\r\n    {\r\n      maxState = 1;     /* 0:start of text, 1:start of line are predefined */\r\n      maxEntry = 0;\r\n    }\r\n\r\n    if ( maxEntry > 0 && entryTable == 0 )\r\n      FT_INVALID_OFFSET;\r\n\r\n    if ( entryTable != 0 )\r\n      gxv_EntryTable_validate( table + entryTable,\r\n                               &entryTable_length,\r\n                               maxEntry,\r\n                               stateArray,\r\n                               stateArray_length,\r\n                               maxClassID,\r\n                               table,\r\n                               limit,\r\n                               valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ================= eXtended State Table (for morx) =================== */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_XStateTable_subtable_setup( FT_ULong       table_size,\r\n                                  FT_ULong       classTable,\r\n                                  FT_ULong       stateArray,\r\n                                  FT_ULong       entryTable,\r\n                                  FT_ULong*      classTable_length_p,\r\n                                  FT_ULong*      stateArray_length_p,\r\n                                  FT_ULong*      entryTable_length_p,\r\n                                  GXV_Validator  valid )\r\n  {\r\n    FT_ULong   o[3];\r\n    FT_ULong*  l[3];\r\n    FT_ULong   buff[4];\r\n\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n\r\n    gxv_set_length_by_ulong_offset( o, l, buff, 3, table_size, valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_XClassTable_lookupval_validate( FT_UShort            glyph,\r\n                                      GXV_LookupValueCPtr  value_p,\r\n                                      GXV_Validator        valid )\r\n  {\r\n    FT_UNUSED( glyph );\r\n\r\n    if ( value_p->u >= valid->xstatetable.nClasses )\r\n      FT_INVALID_DATA;\r\n    if ( value_p->u > valid->xstatetable.maxClassID )\r\n      valid->xstatetable.maxClassID = value_p->u;\r\n  }\r\n\r\n\r\n  /*\r\n    +===============+ --------+\r\n    | lookup header |         |\r\n    +===============+         |\r\n    | BinSrchHeader |         |\r\n    +===============+         |\r\n    | lastGlyph[0]  |         |\r\n    +---------------+         |\r\n    | firstGlyph[0] |         |    head of lookup table\r\n    +---------------+         |             +\r\n    | offset[0]     |    ->   |          offset            [byte]\r\n    +===============+         |             +\r\n    | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]\r\n    +---------------+         |\r\n    | firstGlyph[1] |         |\r\n    +---------------+         |\r\n    | offset[1]     |         |\r\n    +===============+         |\r\n                              |\r\n     ....                     |\r\n                              |\r\n    16bit value array         |\r\n    +===============+         |\r\n    |     value     | <-------+\r\n     ....\r\n  */\r\n  static GXV_LookupValueDesc\r\n  gxv_XClassTable_lookupfmt4_transit( FT_UShort            relative_gindex,\r\n                                      GXV_LookupValueCPtr  base_value_p,\r\n                                      FT_Bytes             lookuptbl_limit,\r\n                                      GXV_Validator        valid )\r\n  {\r\n    FT_Bytes             p;\r\n    FT_Bytes             limit;\r\n    FT_UShort            offset;\r\n    GXV_LookupValueDesc  value;\r\n\r\n    /* XXX: check range? */\r\n    offset = (FT_UShort)( base_value_p->u +\r\n                          relative_gindex * sizeof ( FT_UShort ) );\r\n\r\n    p     = valid->lookuptbl_head + offset;\r\n    limit = lookuptbl_limit;\r\n\r\n    GXV_LIMIT_CHECK ( 2 );\r\n    value.u = FT_NEXT_USHORT( p );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_XStateArray_validate( FT_Bytes       table,\r\n                            FT_ULong*      length_p,\r\n                            FT_UShort      maxClassID,\r\n                            FT_ULong       stateSize,\r\n                            FT_UShort*     maxState_p,\r\n                            FT_UShort*     maxEntry_p,\r\n                            GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_Bytes   limit = table + *length_p;\r\n    FT_UShort  clazz;\r\n    FT_UShort  entry;\r\n\r\n    FT_UNUSED( stateSize ); /* for the non-debugging case */\r\n\r\n\r\n    GXV_NAME_ENTER( \"XStateArray\" );\r\n\r\n    GXV_TRACE(( \"parse % 3d bytes by stateSize=% 3d maxClassID=% 3d\\n\",\r\n                (int)(*length_p), stateSize, (int)(maxClassID) ));\r\n\r\n    /*\r\n     * 2 states are predefined and must be described:\r\n     * state 0 (start of text), 1 (start of line)\r\n     */\r\n    GXV_LIMIT_CHECK( ( 1 + maxClassID ) * 2 * 2 );\r\n\r\n    *maxState_p = 0;\r\n    *maxEntry_p = 0;\r\n\r\n    /* read if enough to read another state */\r\n    while ( p + ( ( 1 + maxClassID ) * 2 ) <= limit )\r\n    {\r\n      (*maxState_p)++;\r\n      for ( clazz = 0; clazz <= maxClassID; clazz++ )\r\n      {\r\n        entry = FT_NEXT_USHORT( p );\r\n        *maxEntry_p = (FT_UShort)FT_MAX( *maxEntry_p, entry );\r\n      }\r\n    }\r\n    GXV_TRACE(( \"parsed: maxState=%d, maxEntry=%d\\n\",\r\n                *maxState_p, *maxEntry_p ));\r\n\r\n    *length_p = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_XEntryTable_validate( FT_Bytes       table,\r\n                            FT_ULong*      length_p,\r\n                            FT_UShort      maxEntry,\r\n                            FT_ULong       stateArray_length,\r\n                            FT_UShort      maxClassID,\r\n                            FT_Bytes       xstatetable_table,\r\n                            FT_Bytes       xstatetable_limit,\r\n                            GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_Bytes   limit = table + *length_p;\r\n    FT_UShort  entry;\r\n    FT_UShort  state;\r\n    FT_Int     entrySize = 2 + 2 + GXV_GLYPHOFFSET_SIZE( xstatetable );\r\n\r\n\r\n    GXV_NAME_ENTER( \"XEntryTable\" );\r\n    GXV_TRACE(( \"maxEntry=%d entrySize=%d\\n\", maxEntry, entrySize ));\r\n\r\n    if ( ( p + ( maxEntry + 1 ) * entrySize ) > limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    for (entry = 0; entry <= maxEntry ; entry++ )\r\n    {\r\n      FT_UShort                        newState_idx;\r\n      FT_UShort                        flags;\r\n      GXV_XStateTable_GlyphOffsetDesc  glyphOffset;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 + 2 );\r\n      newState_idx = FT_NEXT_USHORT( p );\r\n      flags        = FT_NEXT_USHORT( p );\r\n\r\n      if ( stateArray_length < (FT_ULong)( newState_idx * 2 ) )\r\n      {\r\n        GXV_TRACE(( \"  newState index 0x%04x points out of stateArray\\n\",\r\n                    newState_idx ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n      }\r\n\r\n      state = (FT_UShort)( newState_idx / ( 1 + maxClassID ) );\r\n      if ( 0 != ( newState_idx % ( 1 + maxClassID ) ) )\r\n      {\r\n        FT_TRACE4(( \"-> new state = %d (supposed)\\n\"\r\n                    \"but newState index 0x%04x is not aligned to %d-classes\\n\",\r\n                    state, newState_idx,  1 + maxClassID ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n      }\r\n\r\n      switch ( GXV_GLYPHOFFSET_FMT( xstatetable ) )\r\n      {\r\n      case GXV_GLYPHOFFSET_NONE:\r\n        glyphOffset.uc = 0; /* make compiler happy */\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_UCHAR:\r\n        glyphOffset.uc = FT_NEXT_BYTE( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_CHAR:\r\n        glyphOffset.c = FT_NEXT_CHAR( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_USHORT:\r\n        glyphOffset.u = FT_NEXT_USHORT( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_SHORT:\r\n        glyphOffset.s = FT_NEXT_SHORT( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_ULONG:\r\n        glyphOffset.ul = FT_NEXT_ULONG( p );\r\n        break;\r\n\r\n      case GXV_GLYPHOFFSET_LONG:\r\n        glyphOffset.l = FT_NEXT_LONG( p );\r\n        break;\r\n\r\n      default:\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT );\r\n        goto Exit;\r\n      }\r\n\r\n      if ( NULL != valid->xstatetable.entry_validate_func )\r\n        valid->xstatetable.entry_validate_func( state,\r\n                                                flags,\r\n                                                &glyphOffset,\r\n                                                xstatetable_table,\r\n                                                xstatetable_limit,\r\n                                                valid );\r\n    }\r\n\r\n  Exit:\r\n    *length_p = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_XStateTable_validate( FT_Bytes       table,\r\n                            FT_Bytes       limit,\r\n                            GXV_Validator  valid )\r\n  {\r\n    /* StateHeader members */\r\n    FT_ULong   classTable;      /* offset to Class(Sub)Table */\r\n    FT_ULong   stateArray;      /* offset to StateArray */\r\n    FT_ULong   entryTable;      /* offset to EntryTable */\r\n\r\n    FT_ULong   classTable_length;\r\n    FT_ULong   stateArray_length;\r\n    FT_ULong   entryTable_length;\r\n    FT_UShort  maxState;\r\n    FT_UShort  maxEntry;\r\n\r\n    GXV_XStateTable_Subtable_Setup_Func  setup_func;\r\n\r\n    FT_Bytes   p = table;\r\n\r\n\r\n    GXV_NAME_ENTER( \"XStateTable\" );\r\n\r\n    GXV_TRACE(( \"XStateTable header\\n\" ));\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 );\r\n    valid->xstatetable.nClasses = FT_NEXT_ULONG( p );\r\n    classTable = FT_NEXT_ULONG( p );\r\n    stateArray = FT_NEXT_ULONG( p );\r\n    entryTable = FT_NEXT_ULONG( p );\r\n\r\n    GXV_TRACE(( \"nClasses =0x%08x\\n\", valid->xstatetable.nClasses ));\r\n    GXV_TRACE(( \"offset to classTable=0x%08x\\n\", classTable ));\r\n    GXV_TRACE(( \"offset to stateArray=0x%08x\\n\", stateArray ));\r\n    GXV_TRACE(( \"offset to entryTable=0x%08x\\n\", entryTable ));\r\n\r\n    if ( valid->xstatetable.nClasses > 0xFFFFU )\r\n      FT_INVALID_DATA;\r\n\r\n    GXV_TRACE(( \"StateTable Subtables\\n\" ));\r\n\r\n    if ( valid->xstatetable.optdata_load_func != NULL )\r\n      valid->xstatetable.optdata_load_func( p, limit, valid );\r\n\r\n    if ( valid->xstatetable.subtable_setup_func != NULL )\r\n      setup_func = valid->xstatetable.subtable_setup_func;\r\n    else\r\n      setup_func = gxv_XStateTable_subtable_setup;\r\n\r\n    setup_func( limit - table,\r\n                classTable,\r\n                stateArray,\r\n                entryTable,\r\n                &classTable_length,\r\n                &stateArray_length,\r\n                &entryTable_length,\r\n                valid );\r\n\r\n    if ( classTable != 0 )\r\n    {\r\n      valid->xstatetable.maxClassID = 0;\r\n      valid->lookupval_sign         = GXV_LOOKUPVALUE_UNSIGNED;\r\n      valid->lookupval_func         = gxv_XClassTable_lookupval_validate;\r\n      valid->lookupfmt4_trans       = gxv_XClassTable_lookupfmt4_transit;\r\n      gxv_LookupTable_validate( table + classTable,\r\n                                table + classTable + classTable_length,\r\n                                valid );\r\n      if ( valid->subtable_length < classTable_length )\r\n        classTable_length = valid->subtable_length;\r\n    }\r\n    else\r\n    {\r\n      /* XXX: check range? */\r\n      valid->xstatetable.maxClassID =\r\n        (FT_UShort)( valid->xstatetable.nClasses - 1 );\r\n    }\r\n\r\n    if ( stateArray != 0 )\r\n      gxv_XStateArray_validate( table + stateArray,\r\n                                &stateArray_length,\r\n                                valid->xstatetable.maxClassID,\r\n                                valid->xstatetable.nClasses,\r\n                                &maxState,\r\n                                &maxEntry,\r\n                                valid );\r\n    else\r\n    {\r\n      maxState = 1; /* 0:start of text, 1:start of line are predefined */\r\n      maxEntry = 0;\r\n    }\r\n\r\n    if ( maxEntry > 0 && entryTable == 0 )\r\n      FT_INVALID_OFFSET;\r\n\r\n    if ( entryTable != 0 )\r\n      gxv_XEntryTable_validate( table + entryTable,\r\n                                &entryTable_length,\r\n                                maxEntry,\r\n                                stateArray_length,\r\n                                valid->xstatetable.maxClassID,\r\n                                table,\r\n                                limit,\r\n                                valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        Table overlapping                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static int\r\n  gxv_compare_ranges( FT_Bytes  table1_start,\r\n                      FT_ULong  table1_length,\r\n                      FT_Bytes  table2_start,\r\n                      FT_ULong  table2_length )\r\n  {\r\n    if ( table1_start == table2_start )\r\n    {\r\n      if ( ( table1_length == 0 || table2_length == 0 ) )\r\n        goto Out;\r\n    }\r\n    else if ( table1_start < table2_start )\r\n    {\r\n      if ( ( table1_start + table1_length ) <= table2_start )\r\n        goto Out;\r\n    }\r\n    else if ( table1_start > table2_start )\r\n    {\r\n      if ( ( table1_start >= table2_start + table2_length ) )\r\n        goto Out;\r\n    }\r\n    return 1;\r\n\r\n  Out:\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_odtect_add_range( FT_Bytes          start,\r\n                        FT_ULong          length,\r\n                        const FT_String*  name,\r\n                        GXV_odtect_Range  odtect )\r\n  {\r\n    odtect->range[odtect->nRanges].start  = start;\r\n    odtect->range[odtect->nRanges].length = length;\r\n    odtect->range[odtect->nRanges].name   = (FT_String*)name;\r\n    odtect->nRanges++;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_odtect_validate( GXV_odtect_Range  odtect,\r\n                       GXV_Validator     valid )\r\n  {\r\n    FT_UInt  i, j;\r\n\r\n\r\n    GXV_NAME_ENTER( \"check overlap among multi ranges\" );\r\n\r\n    for ( i = 0; i < odtect->nRanges; i++ )\r\n      for ( j = 0; j < i; j++ )\r\n        if ( 0 != gxv_compare_ranges( odtect->range[i].start,\r\n                                      odtect->range[i].length,\r\n                                      odtect->range[j].start,\r\n                                      odtect->range[j].length ) )\r\n        {\r\n          if ( odtect->range[i].name || odtect->range[j].name )\r\n            GXV_TRACE(( \"found overlap between range %d and range %d\\n\",\r\n                        i, j ));\r\n          else\r\n            GXV_TRACE(( \"found overlap between `%s' and `%s\\'\\n\",\r\n                        odtect->range[i].name,\r\n                        odtect->range[j].name ));\r\n          FT_INVALID_OFFSET;\r\n        }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvcommn.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvcommn.h                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT common tables validation (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2012                                             */\r\n/*  by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*\r\n   * keywords in variable naming\r\n   * ---------------------------\r\n   *  table: Of type FT_Bytes, pointing to the start of this table/subtable.\r\n   *  limit: Of type FT_Bytes, pointing to the end of this table/subtable,\r\n   *         including padding for alignment.\r\n   *  offset: Of type FT_UInt, the number of octets from the start to target.\r\n   *  length: Of type FT_UInt, the number of octets from the start to the\r\n   *          end in this table/subtable, including padding for alignment.\r\n   *\r\n   *  _MIN, _MAX: Should be added to the tail of macros, as INT_MIN, etc.\r\n   */\r\n\r\n\r\n#ifndef __GXVCOMMN_H__\r\n#define __GXVCOMMN_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"gxvalid.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_SFNT_NAMES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* some variables are not evaluated or only used in trace */\r\n\r\n#ifdef  FT_DEBUG_LEVEL_TRACE\r\n#define GXV_LOAD_TRACE_VARS\r\n#else\r\n#undef  GXV_LOAD_TRACE_VARS\r\n#endif\r\n\r\n#undef GXV_LOAD_UNUSED_VARS /* debug purpose */\r\n\r\n#define IS_PARANOID_VALIDATION          ( valid->root->level >= FT_VALIDATE_PARANOID )\r\n#define GXV_SET_ERR_IF_PARANOID( err )  { if ( IS_PARANOID_VALIDATION ) ( err ); }\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         VALIDATION                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct GXV_ValidatorRec_*  GXV_Validator;\r\n\r\n\r\n#define DUMMY_LIMIT 0\r\n\r\n  typedef void\r\n  (*GXV_Validate_Func)( FT_Bytes       table,\r\n                        FT_Bytes       limit,\r\n                        GXV_Validator  valid );\r\n\r\n\r\n  /* ====================== LookupTable Validator ======================== */\r\n\r\n  typedef union  GXV_LookupValueDesc_\r\n  {\r\n    FT_UShort u;\r\n    FT_Short  s;\r\n\r\n  } GXV_LookupValueDesc;\r\n\r\n  typedef const GXV_LookupValueDesc* GXV_LookupValueCPtr;\r\n\r\n  typedef enum  GXV_LookupValue_SignSpec_\r\n  {\r\n    GXV_LOOKUPVALUE_UNSIGNED = 0,\r\n    GXV_LOOKUPVALUE_SIGNED\r\n\r\n  } GXV_LookupValue_SignSpec;\r\n\r\n\r\n  typedef void\r\n  (*GXV_Lookup_Value_Validate_Func)( FT_UShort            glyph,\r\n                                     GXV_LookupValueCPtr  value_p,\r\n                                     GXV_Validator        valid );\r\n\r\n  typedef GXV_LookupValueDesc\r\n  (*GXV_Lookup_Fmt4_Transit_Func)( FT_UShort            relative_gindex,\r\n                                   GXV_LookupValueCPtr  base_value_p,\r\n                                   FT_Bytes             lookuptbl_limit,\r\n                                   GXV_Validator        valid );\r\n\r\n\r\n  /* ====================== StateTable Validator ========================= */\r\n\r\n  typedef enum  GXV_GlyphOffset_Format_\r\n  {\r\n    GXV_GLYPHOFFSET_NONE   = -1,\r\n    GXV_GLYPHOFFSET_UCHAR  = 2,\r\n    GXV_GLYPHOFFSET_CHAR,\r\n    GXV_GLYPHOFFSET_USHORT = 4,\r\n    GXV_GLYPHOFFSET_SHORT,\r\n    GXV_GLYPHOFFSET_ULONG  = 8,\r\n    GXV_GLYPHOFFSET_LONG\r\n\r\n  } GXV_GlyphOffset_Format;\r\n\r\n\r\n#define GXV_GLYPHOFFSET_FMT( table )           \\\r\n        ( valid->table.entry_glyphoffset_fmt )\r\n\r\n#define GXV_GLYPHOFFSET_SIZE( table )              \\\r\n        ( valid->table.entry_glyphoffset_fmt / 2 )\r\n\r\n\r\n  /* ----------------------- 16bit StateTable ---------------------------- */\r\n\r\n  typedef union  GXV_StateTable_GlyphOffsetDesc_\r\n  {\r\n    FT_Byte    uc;\r\n    FT_UShort  u;       /* same as GXV_LookupValueDesc */\r\n    FT_ULong   ul;\r\n    FT_Char    c;\r\n    FT_Short   s;       /* same as GXV_LookupValueDesc */\r\n    FT_Long    l;\r\n\r\n  } GXV_StateTable_GlyphOffsetDesc;\r\n\r\n  typedef const GXV_StateTable_GlyphOffsetDesc* GXV_StateTable_GlyphOffsetCPtr;\r\n\r\n  typedef void\r\n  (*GXV_StateTable_Subtable_Setup_Func)( FT_UShort      table_size,\r\n                                         FT_UShort      classTable,\r\n                                         FT_UShort      stateArray,\r\n                                         FT_UShort      entryTable,\r\n                                         FT_UShort*     classTable_length_p,\r\n                                         FT_UShort*     stateArray_length_p,\r\n                                         FT_UShort*     entryTable_length_p,\r\n                                         GXV_Validator  valid );\r\n\r\n  typedef void\r\n  (*GXV_StateTable_Entry_Validate_Func)(\r\n     FT_Byte                         state,\r\n     FT_UShort                       flags,\r\n     GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n     FT_Bytes                        statetable_table,\r\n     FT_Bytes                        statetable_limit,\r\n     GXV_Validator                   valid );\r\n\r\n  typedef void\r\n  (*GXV_StateTable_OptData_Load_Func)( FT_Bytes       table,\r\n                                       FT_Bytes       limit,\r\n                                       GXV_Validator  valid );\r\n\r\n  typedef struct  GXV_StateTable_ValidatorRec_\r\n  {\r\n    GXV_GlyphOffset_Format              entry_glyphoffset_fmt;\r\n    void*                               optdata;\r\n\r\n    GXV_StateTable_Subtable_Setup_Func  subtable_setup_func;\r\n    GXV_StateTable_Entry_Validate_Func  entry_validate_func;\r\n    GXV_StateTable_OptData_Load_Func    optdata_load_func;\r\n\r\n  } GXV_StateTable_ValidatorRec, *GXV_StateTable_ValidatorRecData;\r\n\r\n\r\n  /* ---------------------- 32bit XStateTable ---------------------------- */\r\n\r\n  typedef GXV_StateTable_GlyphOffsetDesc  GXV_XStateTable_GlyphOffsetDesc;\r\n\r\n  typedef const GXV_XStateTable_GlyphOffsetDesc* GXV_XStateTable_GlyphOffsetCPtr;\r\n\r\n  typedef void\r\n  (*GXV_XStateTable_Subtable_Setup_Func)( FT_ULong       table_size,\r\n                                          FT_ULong       classTable,\r\n                                          FT_ULong       stateArray,\r\n                                          FT_ULong       entryTable,\r\n                                          FT_ULong*      classTable_length_p,\r\n                                          FT_ULong*      stateArray_length_p,\r\n                                          FT_ULong*      entryTable_length_p,\r\n                                          GXV_Validator  valid );\r\n\r\n  typedef void\r\n  (*GXV_XStateTable_Entry_Validate_Func)(\r\n     FT_UShort                       state,\r\n     FT_UShort                       flags,\r\n     GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n     FT_Bytes                        xstatetable_table,\r\n     FT_Bytes                        xstatetable_limit,\r\n     GXV_Validator                   valid );\r\n\r\n\r\n  typedef GXV_StateTable_OptData_Load_Func  GXV_XStateTable_OptData_Load_Func;\r\n\r\n\r\n  typedef struct  GXV_XStateTable_ValidatorRec_\r\n  {\r\n    int                                  entry_glyphoffset_fmt;\r\n    void*                                optdata;\r\n\r\n    GXV_XStateTable_Subtable_Setup_Func  subtable_setup_func;\r\n    GXV_XStateTable_Entry_Validate_Func  entry_validate_func;\r\n    GXV_XStateTable_OptData_Load_Func    optdata_load_func;\r\n\r\n    FT_ULong                             nClasses;\r\n    FT_UShort                            maxClassID;\r\n\r\n  } GXV_XStateTable_ValidatorRec, *GXV_XStateTable_ValidatorRecData;\r\n\r\n\r\n  /* ===================================================================== */\r\n\r\n  typedef struct  GXV_ValidatorRec_\r\n  {\r\n    FT_Validator  root;\r\n\r\n    FT_Face       face;\r\n    void*         table_data;\r\n\r\n    FT_ULong      subtable_length;\r\n\r\n    GXV_LookupValue_SignSpec        lookupval_sign;\r\n    GXV_Lookup_Value_Validate_Func  lookupval_func;\r\n    GXV_Lookup_Fmt4_Transit_Func    lookupfmt4_trans;\r\n    FT_Bytes                        lookuptbl_head;\r\n\r\n    FT_UShort  min_gid;\r\n    FT_UShort  max_gid;\r\n\r\n    GXV_StateTable_ValidatorRec     statetable;\r\n    GXV_XStateTable_ValidatorRec    xstatetable;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_UInt             debug_indent;\r\n    const FT_String*    debug_function_name[3];\r\n#endif\r\n\r\n  } GXV_ValidatorRec;\r\n\r\n\r\n#define GXV_TABLE_DATA( tag, field )                           \\\r\n        ( ( (GXV_ ## tag ## _Data)valid->table_data )->field )\r\n\r\n#undef  FT_INVALID_\r\n#define FT_INVALID_( _prefix, _error )                         \\\r\n          ft_validator_error( valid->root, _prefix ## _error )\r\n\r\n#define GXV_LIMIT_CHECK( _count )                                     \\\r\n          FT_BEGIN_STMNT                                              \\\r\n            if ( p + _count > ( limit? limit : valid->root->limit ) ) \\\r\n              FT_INVALID_TOO_SHORT;                                   \\\r\n          FT_END_STMNT\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n#define GXV_INIT  valid->debug_indent = 0\r\n\r\n#define GXV_NAME_ENTER( name )                             \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            valid->debug_indent += 2;                      \\\r\n            FT_TRACE4(( \"%*.s\", valid->debug_indent, 0 )); \\\r\n            FT_TRACE4(( \"%s table\\n\", name ));             \\\r\n          FT_END_STMNT\r\n\r\n#define GXV_EXIT  valid->debug_indent -= 2\r\n\r\n#define GXV_TRACE( s )                                     \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            FT_TRACE4(( \"%*.s\", valid->debug_indent, 0 )); \\\r\n            FT_TRACE4( s );                                \\\r\n          FT_END_STMNT\r\n\r\n#else /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n#define GXV_INIT                do { } while ( 0 )\r\n#define GXV_NAME_ENTER( name )  do { } while ( 0 )\r\n#define GXV_EXIT                do { } while ( 0 )\r\n\r\n#define GXV_TRACE( s )          do { } while ( 0 )\r\n\r\n#endif  /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    32bit alignment checking                   *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define GXV_32BIT_ALIGNMENT_VALIDATE( a ) \\\r\n          FT_BEGIN_STMNT                  \\\r\n            {                             \\\r\n              if ( (a) & 3 )              \\\r\n                FT_INVALID_OFFSET ;       \\\r\n            }                             \\\r\n          FT_END_STMNT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    Dumping Binary Data                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define GXV_TRACE_HEXDUMP( p, len )                     \\\r\n          FT_BEGIN_STMNT                                \\\r\n            {                                           \\\r\n              FT_Bytes  b;                              \\\r\n                                                        \\\r\n                                                        \\\r\n              for ( b = p; b < (FT_Bytes)p + len; b++ ) \\\r\n                FT_TRACE1((\"\\\\x%02x\", *b)) ;            \\\r\n            }                                           \\\r\n          FT_END_STMNT\r\n\r\n#define GXV_TRACE_HEXDUMP_C( p, len )                   \\\r\n          FT_BEGIN_STMNT                                \\\r\n            {                                           \\\r\n              FT_Bytes  b;                              \\\r\n                                                        \\\r\n                                                        \\\r\n              for ( b = p; b < (FT_Bytes)p + len; b++ ) \\\r\n                if ( 0x40 < *b && *b < 0x7e )           \\\r\n                  FT_TRACE1((\"%c\", *b)) ;               \\\r\n                else                                    \\\r\n                  FT_TRACE1((\"\\\\x%02x\", *b)) ;          \\\r\n            }                                           \\\r\n          FT_END_STMNT\r\n\r\n#define GXV_TRACE_HEXDUMP_SFNTNAME( n )               \\\r\n          GXV_TRACE_HEXDUMP( n.string, n.string_len )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         LOOKUP TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  gxv_BinSrchHeader_validate( FT_Bytes       p,\r\n                              FT_Bytes       limit,\r\n                              FT_UShort*     unitSize_p,\r\n                              FT_UShort*     nUnits_p,\r\n                              GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_LookupTable_validate( FT_Bytes       table,\r\n                            FT_Bytes       limit,\r\n                            GXV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          Glyph ID                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( FT_Int )\r\n  gxv_glyphid_validate( FT_UShort      gid,\r\n                        GXV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        CONTROL POINT                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  gxv_ctlPoint_validate( FT_UShort      gid,\r\n                         FT_Short       ctl_point,\r\n                         GXV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          SFNT NAME                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  gxv_sfntName_validate( FT_UShort      name_index,\r\n                         FT_UShort      min_index,\r\n                         FT_UShort      max_index,\r\n                         GXV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          STATE TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  gxv_StateTable_subtable_setup( FT_UShort      table_size,\r\n                                 FT_UShort      classTable,\r\n                                 FT_UShort      stateArray,\r\n                                 FT_UShort      entryTable,\r\n                                 FT_UShort*     classTable_length_p,\r\n                                 FT_UShort*     stateArray_length_p,\r\n                                 FT_UShort*     entryTable_length_p,\r\n                                 GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_XStateTable_subtable_setup( FT_ULong       table_size,\r\n                                  FT_ULong       classTable,\r\n                                  FT_ULong       stateArray,\r\n                                  FT_ULong       entryTable,\r\n                                  FT_ULong*      classTable_length_p,\r\n                                  FT_ULong*      stateArray_length_p,\r\n                                  FT_ULong*      entryTable_length_p,\r\n                                  GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_StateTable_validate( FT_Bytes       table,\r\n                           FT_Bytes       limit,\r\n                           GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_XStateTable_validate( FT_Bytes       table,\r\n                            FT_Bytes       limit,\r\n                            GXV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                 UTILITY MACROS AND FUNCTIONS                  *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  gxv_array_getlimits_byte( FT_Bytes       table,\r\n                            FT_Bytes       limit,\r\n                            FT_Byte*       min,\r\n                            FT_Byte*       max,\r\n                            GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_array_getlimits_ushort( FT_Bytes       table,\r\n                              FT_Bytes       limit,\r\n                              FT_UShort*     min,\r\n                              FT_UShort*     max,\r\n                              GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_set_length_by_ushort_offset( FT_UShort*     offset,\r\n                                   FT_UShort**    length,\r\n                                   FT_UShort*     buff,\r\n                                   FT_UInt        nmemb,\r\n                                   FT_UShort      limit,\r\n                                   GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_set_length_by_ulong_offset( FT_ULong*      offset,\r\n                                  FT_ULong**     length,\r\n                                  FT_ULong*      buff,\r\n                                  FT_UInt        nmemb,\r\n                                  FT_ULong       limit,\r\n                                  GXV_Validator  valid);\r\n\r\n\r\n#define GXV_SUBTABLE_OFFSET_CHECK( _offset )          \\\r\n          FT_BEGIN_STMNT                              \\\r\n            if ( (_offset) > valid->subtable_length ) \\\r\n              FT_INVALID_OFFSET;                      \\\r\n          FT_END_STMNT\r\n\r\n#define GXV_SUBTABLE_LIMIT_CHECK( _count )                  \\\r\n          FT_BEGIN_STMNT                                    \\\r\n            if ( ( p + (_count) - valid->subtable_start ) > \\\r\n                   valid->subtable_length )                 \\\r\n              FT_INVALID_TOO_SHORT;                         \\\r\n          FT_END_STMNT\r\n\r\n#define GXV_USHORT_TO_SHORT( _us )                                    \\\r\n          ( ( 0x8000U < ( _us ) ) ? ( ( _us ) - 0x8000U ) : ( _us ) )\r\n\r\n#define GXV_STATETABLE_HEADER_SIZE  ( 2 + 2 + 2 + 2 )\r\n#define GXV_STATEHEADER_SIZE        GXV_STATETABLE_HEADER_SIZE\r\n\r\n#define GXV_XSTATETABLE_HEADER_SIZE  ( 4 + 4 + 4 + 4 )\r\n#define GXV_XSTATEHEADER_SIZE        GXV_XSTATETABLE_HEADER_SIZE\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        Table overlapping                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  GXV_odtect_DataRec_\r\n  {\r\n    FT_Bytes    start;\r\n    FT_ULong    length;\r\n    FT_String*  name;\r\n\r\n  } GXV_odtect_DataRec,  *GXV_odtect_Data;\r\n\r\n  typedef struct  GXV_odtect_RangeRec_\r\n  {\r\n    FT_UInt          nRanges;\r\n    GXV_odtect_Data  range;\r\n\r\n  } GXV_odtect_RangeRec, *GXV_odtect_Range;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  gxv_odtect_add_range( FT_Bytes          start,\r\n                        FT_ULong          length,\r\n                        const FT_String*  name,\r\n                        GXV_odtect_Range  odtect );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_odtect_validate( GXV_odtect_Range  odtect,\r\n                       GXV_Validator     valid );\r\n\r\n\r\n#define GXV_ODTECT( n, odtect )                              \\\r\n          GXV_odtect_DataRec   odtect ## _range[n];          \\\r\n          GXV_odtect_RangeRec  odtect ## _rec = { 0, NULL }; \\\r\n          GXV_odtect_Range     odtect = NULL\r\n\r\n#define GXV_ODTECT_INIT( odtect )                      \\\r\n          FT_BEGIN_STMNT                               \\\r\n            odtect ## _rec.nRanges = 0;                \\\r\n            odtect ## _rec.range   = odtect ## _range; \\\r\n            odtect                 = & odtect ## _rec; \\\r\n          FT_END_STMNT\r\n\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __GXVCOMMN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxverror.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxverror.h                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT validation module error codes (specification only).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2012                                             */\r\n/*    by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the OpenType validation module error      */\r\n  /* enumeration constants.                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __GXVERROR_H__\r\n#define __GXVERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  GXV_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_GXV\r\n\r\n#define FT_KEEP_ERR_PREFIX\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __GXVERROR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvfeat.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvfeat.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT feat table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2008, 2012 by                                    */\r\n/*  suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n#include \"gxvfeat.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvfeat\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  GXV_feat_DataRec_\r\n  {\r\n    FT_UInt    reserved_size;\r\n    FT_UShort  feature;\r\n    FT_UShort  setting;\r\n\r\n  } GXV_feat_DataRec, *GXV_feat_Data;\r\n\r\n\r\n#define GXV_FEAT_DATA( field )  GXV_TABLE_DATA( feat, field )\r\n\r\n\r\n  typedef enum  GXV_FeatureFlagsMask_\r\n  {\r\n    GXV_FEAT_MASK_EXCLUSIVE_SETTINGS = 0x8000U,\r\n    GXV_FEAT_MASK_DYNAMIC_DEFAULT    = 0x4000,\r\n    GXV_FEAT_MASK_UNUSED             = 0x3F00,\r\n    GXV_FEAT_MASK_DEFAULT_SETTING    = 0x00FF\r\n\r\n  } GXV_FeatureFlagsMask;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_feat_registry_validate( FT_UShort      feature,\r\n                              FT_UShort      nSettings,\r\n                              FT_Bool        exclusive,\r\n                              GXV_Validator  valid )\r\n  {\r\n    GXV_NAME_ENTER( \"feature in registry\" );\r\n\r\n    GXV_TRACE(( \" (feature = %u)\\n\", feature ));\r\n\r\n    if ( feature >= gxv_feat_registry_length )\r\n    {\r\n      GXV_TRACE(( \"feature number %d is out of range %d\\n\",\r\n                  feature, gxv_feat_registry_length ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n      goto Exit;\r\n    }\r\n\r\n    if ( gxv_feat_registry[feature].existence == 0 )\r\n    {\r\n      GXV_TRACE(( \"feature number %d is in defined range but doesn't exist\\n\",\r\n                  feature ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n      goto Exit;\r\n    }\r\n\r\n    if ( gxv_feat_registry[feature].apple_reserved )\r\n    {\r\n      /* Don't use here. Apple is reserved. */\r\n      GXV_TRACE(( \"feature number %d is reserved by Apple\\n\", feature ));\r\n      if ( valid->root->level >= FT_VALIDATE_TIGHT )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    if ( nSettings != gxv_feat_registry[feature].nSettings )\r\n    {\r\n      GXV_TRACE(( \"feature %d: nSettings %d != defined nSettings %d\\n\",\r\n                  feature, nSettings,\r\n                  gxv_feat_registry[feature].nSettings ));\r\n      if ( valid->root->level >= FT_VALIDATE_TIGHT )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    if ( exclusive != gxv_feat_registry[feature].exclusive )\r\n    {\r\n      GXV_TRACE(( \"exclusive flag %d differs from predefined value\\n\",\r\n                  exclusive ));\r\n      if ( valid->root->level >= FT_VALIDATE_TIGHT )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n  Exit:\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_feat_name_index_validate( FT_Bytes       table,\r\n                                FT_Bytes       limit,\r\n                                GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    FT_Short  nameIndex;\r\n\r\n\r\n    GXV_NAME_ENTER( \"nameIndex\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    nameIndex = FT_NEXT_SHORT ( p );\r\n    GXV_TRACE(( \" (nameIndex = %d)\\n\", nameIndex ));\r\n\r\n    gxv_sfntName_validate( (FT_UShort)nameIndex,\r\n                           255,\r\n                           32768U,\r\n                           valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_feat_setting_validate( FT_Bytes       table,\r\n                             FT_Bytes       limit,\r\n                             FT_Bool        exclusive,\r\n                             GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  setting;\r\n\r\n\r\n    GXV_NAME_ENTER( \"setting\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n\r\n    setting = FT_NEXT_USHORT( p );\r\n\r\n    /* If we have exclusive setting, the setting should be odd. */\r\n    if ( exclusive && ( setting & 1 ) == 0 )\r\n      FT_INVALID_DATA;\r\n\r\n    gxv_feat_name_index_validate( p, limit, valid );\r\n\r\n    GXV_FEAT_DATA( setting ) = setting;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_feat_name_validate( FT_Bytes       table,\r\n                          FT_Bytes       limit,\r\n                          GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p             = table;\r\n    FT_UInt    reserved_size = GXV_FEAT_DATA( reserved_size );\r\n\r\n    FT_UShort  feature;\r\n    FT_UShort  nSettings;\r\n    FT_ULong   settingTable;\r\n    FT_UShort  featureFlags;\r\n\r\n    FT_Bool    exclusive;\r\n    FT_Int     last_setting;\r\n    FT_UInt    i;\r\n\r\n\r\n    GXV_NAME_ENTER( \"name\" );\r\n\r\n    /* feature + nSettings + settingTable + featureFlags */\r\n    GXV_LIMIT_CHECK( 2 + 2 + 4 + 2 );\r\n\r\n    feature = FT_NEXT_USHORT( p );\r\n    GXV_FEAT_DATA( feature ) = feature;\r\n\r\n    nSettings    = FT_NEXT_USHORT( p );\r\n    settingTable = FT_NEXT_ULONG ( p );\r\n    featureFlags = FT_NEXT_USHORT( p );\r\n\r\n    if ( settingTable < reserved_size )\r\n      FT_INVALID_OFFSET;\r\n\r\n    if ( ( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 )\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n\r\n    exclusive = FT_BOOL( featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS );\r\n    if ( exclusive )\r\n    {\r\n      FT_Byte  dynamic_default;\r\n\r\n\r\n      if ( featureFlags & GXV_FEAT_MASK_DYNAMIC_DEFAULT )\r\n        dynamic_default = (FT_Byte)( featureFlags &\r\n                                     GXV_FEAT_MASK_DEFAULT_SETTING );\r\n      else\r\n        dynamic_default = 0;\r\n\r\n      /* If exclusive, check whether default setting is in the range. */\r\n      if ( !( dynamic_default < nSettings ) )\r\n        FT_INVALID_FORMAT;\r\n    }\r\n\r\n    gxv_feat_registry_validate( feature, nSettings, exclusive, valid );\r\n\r\n    gxv_feat_name_index_validate( p, limit, valid );\r\n\r\n    p = valid->root->base + settingTable;\r\n    for ( last_setting = -1, i = 0; i < nSettings; i++ )\r\n    {\r\n      gxv_feat_setting_validate( p, limit, exclusive, valid );\r\n\r\n      if ( (FT_Int)GXV_FEAT_DATA( setting ) <= last_setting )\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT );\r\n\r\n      last_setting = (FT_Int)GXV_FEAT_DATA( setting );\r\n      /* setting + nameIndex */\r\n      p += ( 2 + 2 );\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         feat TABLE                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_feat_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n\r\n    GXV_feat_DataRec  featrec;\r\n    GXV_feat_Data     feat = &featrec;\r\n\r\n    FT_Bytes          p     = table;\r\n    FT_Bytes          limit = 0;\r\n\r\n    FT_UInt           featureNameCount;\r\n\r\n    FT_UInt           i;\r\n    FT_Int            last_feature;\r\n\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = feat;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `feat' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    feat->reserved_size = 0;\r\n\r\n    /* version + featureNameCount + none_0 + none_1  */\r\n    GXV_LIMIT_CHECK( 4 + 2 + 2 + 4 );\r\n    feat->reserved_size += 4 + 2 + 2 + 4;\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x00010000UL ) /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    featureNameCount = FT_NEXT_USHORT( p );\r\n    GXV_TRACE(( \" (featureNameCount = %d)\\n\", featureNameCount ));\r\n\r\n    if ( !( IS_PARANOID_VALIDATION ) )\r\n      p += 6; /* skip (none) and (none) */\r\n    else\r\n    {\r\n      if ( FT_NEXT_USHORT( p ) != 0 )\r\n        FT_INVALID_DATA;\r\n\r\n      if ( FT_NEXT_ULONG( p )  != 0 )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    feat->reserved_size += featureNameCount * ( 2 + 2 + 4 + 2 + 2 );\r\n\r\n    for ( last_feature = -1, i = 0; i < featureNameCount; i++ )\r\n    {\r\n      gxv_feat_name_validate( p, limit, valid );\r\n\r\n      if ( (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature )\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT );\r\n\r\n      last_feature = GXV_FEAT_DATA( feature );\r\n      p += 2 + 2 + 4 + 2 + 2;\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvfeat.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvfeat.h                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT feat table validation (specification).                */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __GXVFEAT_H__\r\n#define __GXVFEAT_H__\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                Registry predefined by Apple                   *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* TODO: More compact format */\r\n  typedef struct  GXV_Feature_RegistryRec_\r\n  {\r\n    FT_Bool  existence;\r\n    FT_Bool  apple_reserved;\r\n    FT_Bool  exclusive;\r\n    FT_Byte  nSettings;\r\n\r\n  } GX_Feature_RegistryRec;\r\n\r\n\r\n#define gxv_feat_registry_length                  \\\r\n          ( sizeof ( gxv_feat_registry ) /        \\\r\n              sizeof ( GX_Feature_RegistryRec ) )\r\n\r\n\r\n  static GX_Feature_RegistryRec  gxv_feat_registry[] =\r\n  {\r\n    /* Generated from gxvfgen.c */\r\n    {1, 0, 0,  1},   /* All Typographic Features */\r\n    {1, 0, 0,  8},   /* Ligatures */\r\n    {1, 0, 1,  3},   /* Cursive Connection */\r\n    {1, 0, 1,  6},   /* Letter Case */\r\n    {1, 0, 0,  1},   /* Vertical Substitution */\r\n    {1, 0, 0,  1},   /* Linguistic Rearrangement */\r\n    {1, 0, 1,  2},   /* Number Spacing */\r\n    {1, 1, 0,  0},   /* Apple Reserved 1 */\r\n    {1, 0, 0,  5},   /* Smart Swashes */\r\n    {1, 0, 1,  3},   /* Diacritics */\r\n    {1, 0, 1,  4},   /* Vertical Position */\r\n    {1, 0, 1,  3},   /* Fractions */\r\n    {1, 1, 0,  0},   /* Apple Reserved 2 */\r\n    {1, 0, 0,  1},   /* Overlapping Characters */\r\n    {1, 0, 0,  6},   /* Typographic Extras */\r\n    {1, 0, 0,  5},   /* Mathematical Extras */\r\n    {1, 0, 1,  7},   /* Ornament Sets */\r\n    {1, 0, 1,  1},   /* Character Alternatives */\r\n    {1, 0, 1,  5},   /* Design Complexity */\r\n    {1, 0, 1,  6},   /* Style Options */\r\n    {1, 0, 1, 11},   /* Character Shape */\r\n    {1, 0, 1,  2},   /* Number Case */\r\n    {1, 0, 1,  4},   /* Text Spacing */\r\n    {1, 0, 1, 10},   /* Transliteration */\r\n    {1, 0, 1,  9},   /* Annotation */\r\n    {1, 0, 1,  2},   /* Kana Spacing */\r\n    {1, 0, 1,  2},   /* Ideographic Spacing */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {0, 0, 0,  0},   /* __EMPTY__ */\r\n    {1, 0, 1,  4},   /* Text Spacing */\r\n    {1, 0, 1,  2},   /* Kana Spacing */\r\n    {1, 0, 1,  2},   /* Ideographic Spacing */\r\n    {1, 0, 1,  4},   /* CJK Roman Spacing */\r\n  };\r\n\r\n\r\n#endif /* __GXVFEAT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvfgen.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxfgen.c                                                               */\r\n/*                                                                         */\r\n/*    Generate feature registry data for gxv `feat' validator.             */\r\n/*    This program is derived from gxfeatreg.c in gxlayout.                */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006 by Masatake YAMATO and Redhat K.K.          */\r\n/*                                                                         */\r\n/*  This file may only be used,                                            */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxfeatreg.c                                                            */\r\n/*                                                                         */\r\n/*    Database of font features pre-defined by Apple Computer, Inc.        */\r\n/*    http://developer.apple.com/fonts/Registry/                           */\r\n/*    (body).                                                              */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  Masatake YAMATO and Redhat K.K.                                        */\r\n/*                                                                         */\r\n/*  This file may only be used,                                            */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* Development of gxfeatreg.c is supported by                              */\r\n/* Information-technology Promotion Agency, Japan.                         */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* This file is compiled as a stand-alone executable.                      */\r\n/* This file is never compiled into `libfreetype2'.                        */\r\n/* The output of this file is used in `gxvfeat.c'.                         */\r\n/* ----------------------------------------------------------------------- */\r\n/* Compile: gcc `pkg-config --cflags freetype2` gxvfgen.c -o gxvfgen       */\r\n/* Run: ./gxvfgen > tmp.c                                                  */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*******************************************************************/\r\n  /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */\r\n  /*******************************************************************/\r\n\r\n  /*\r\n   * If you add a new setting to a feature, check the number of settings\r\n   * in the feature.  If the number is greater than the value defined as\r\n   * FEATREG_MAX_SETTING, update the value.\r\n   */\r\n#define FEATREG_MAX_SETTING  12\r\n\r\n  /*******************************************************************/\r\n  /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */\r\n  /*******************************************************************/\r\n\r\n\r\n#include <stdio.h>\r\n#include <string.h>\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define APPLE_RESERVED         \"Apple Reserved\"\r\n#define APPLE_RESERVED_LENGTH  14\r\n\r\n  typedef struct  GX_Feature_RegistryRec_\r\n  {\r\n    const char*  feat_name;\r\n    char         exclusive;\r\n    char*        setting_name[FEATREG_MAX_SETTING];\r\n\r\n  } GX_Feature_RegistryRec;\r\n\r\n\r\n#define EMPTYFEAT {0, 0, {NULL}}\r\n\r\n\r\n  static GX_Feature_RegistryRec featreg_table[] = {\r\n    {                                       /* 0 */\r\n      \"All Typographic Features\",\r\n      0,\r\n      {\r\n        \"All Type Features\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 1 */\r\n      \"Ligatures\",\r\n      0,\r\n      {\r\n        \"Required Ligatures\",\r\n        \"Common Ligatures\",\r\n        \"Rare Ligatures\",\r\n        \"Logos\",\r\n        \"Rebus Pictures\",\r\n        \"Diphthong Ligatures\",\r\n        \"Squared Ligatures\",\r\n        \"Squared Ligatures, Abbreviated\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 2 */\r\n      \"Cursive Connection\",\r\n      1,\r\n      {\r\n        \"Unconnected\",\r\n        \"Partially Connected\",\r\n        \"Cursive\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 3 */\r\n      \"Letter Case\",\r\n      1,\r\n      {\r\n        \"Upper & Lower Case\",\r\n        \"All Caps\",\r\n        \"All Lower Case\",\r\n        \"Small Caps\",\r\n        \"Initial Caps\",\r\n        \"Initial Caps & Small Caps\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 4 */\r\n      \"Vertical Substitution\",\r\n      0,\r\n      {\r\n        /* \"Substitute Vertical Forms\", */\r\n        \"Turns on the feature\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 5 */\r\n      \"Linguistic Rearrangement\",\r\n      0,\r\n      {\r\n        /* \"Linguistic Rearrangement\", */\r\n        \"Turns on the feature\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 6 */\r\n      \"Number Spacing\",\r\n      1,\r\n      {\r\n        \"Monospaced Numbers\",\r\n        \"Proportional Numbers\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 7 */\r\n      APPLE_RESERVED \" 1\",\r\n      0,\r\n      {NULL}\r\n    }, {                                    /* 8 */\r\n      \"Smart Swashes\",\r\n      0,\r\n      {\r\n        \"Word Initial Swashes\",\r\n        \"Word Final Swashes\",\r\n        \"Line Initial Swashes\",\r\n        \"Line Final Swashes\",\r\n        \"Non-Final Swashes\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 9 */\r\n      \"Diacritics\",\r\n      1,\r\n      {\r\n        \"Show Diacritics\",\r\n        \"Hide Diacritics\",\r\n        \"Decompose Diacritics\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 10 */\r\n      \"Vertical Position\",\r\n      1,\r\n      {\r\n        /* \"Normal Position\", */\r\n        \"No Vertical Position\",\r\n        \"Superiors\",\r\n        \"Inferiors\",\r\n        \"Ordinals\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 11 */\r\n      \"Fractions\",\r\n      1,\r\n      {\r\n        \"No Fractions\",\r\n        \"Vertical Fractions\",\r\n        \"Diagonal Fractions\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 12 */\r\n      APPLE_RESERVED \" 2\",\r\n      0,\r\n      {NULL}\r\n    }, {                                    /* 13 */\r\n      \"Overlapping Characters\",\r\n      0,\r\n      {\r\n        /* \"Prevent Overlap\", */\r\n        \"Turns on the feature\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 14 */\r\n      \"Typographic Extras\",\r\n      0,\r\n      {\r\n        \"Hyphens to Em Dash\",\r\n        \"Hyphens to En Dash\",\r\n        \"Unslashed Zero\",\r\n        \"Form Interrobang\",\r\n        \"Smart Quotes\",\r\n        \"Periods to Ellipsis\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 15 */\r\n      \"Mathematical Extras\",\r\n      0,\r\n      {\r\n        \"Hyphens to Minus\",\r\n        \"Asterisk to Multiply\",\r\n        \"Slash to Divide\",\r\n        \"Inequality Ligatures\",\r\n        \"Exponents\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 16 */\r\n      \"Ornament Sets\",\r\n      1,\r\n      {\r\n        \"No Ornaments\",\r\n        \"Dingbats\",\r\n        \"Pi Characters\",\r\n        \"Fleurons\",\r\n        \"Decorative Borders\",\r\n        \"International Symbols\",\r\n        \"Math Symbols\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 17 */\r\n      \"Character Alternatives\",\r\n      1,\r\n      {\r\n        \"No Alternates\",\r\n        /* TODO */\r\n        NULL\r\n      }\r\n    }, {                                    /* 18 */\r\n      \"Design Complexity\",\r\n      1,\r\n      {\r\n        \"Design Level 1\",\r\n        \"Design Level 2\",\r\n        \"Design Level 3\",\r\n        \"Design Level 4\",\r\n        \"Design Level 5\",\r\n        /* TODO */\r\n        NULL\r\n      }\r\n    }, {                                    /* 19 */\r\n      \"Style Options\",\r\n      1,\r\n      {\r\n        \"No Style Options\",\r\n        \"Display Text\",\r\n        \"Engraved Text\",\r\n        \"Illuminated Caps\",\r\n        \"Tilling Caps\",\r\n        \"Tall Caps\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 20 */\r\n      \"Character Shape\",\r\n      1,\r\n      {\r\n        \"Traditional Characters\",\r\n        \"Simplified Characters\",\r\n        \"JIS 1978 Characters\",\r\n        \"JIS 1983 Characters\",\r\n        \"JIS 1990 Characters\",\r\n        \"Traditional Characters, Alternative Set 1\",\r\n        \"Traditional Characters, Alternative Set 2\",\r\n        \"Traditional Characters, Alternative Set 3\",\r\n        \"Traditional Characters, Alternative Set 4\",\r\n        \"Traditional Characters, Alternative Set 5\",\r\n        \"Expert Characters\",\r\n        NULL                           /* count => 12 */\r\n      }\r\n    }, {                                    /* 21 */\r\n      \"Number Case\",\r\n      1,\r\n      {\r\n        \"Lower Case Numbers\",\r\n        \"Upper Case Numbers\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 22 */\r\n      \"Text Spacing\",\r\n      1,\r\n      {\r\n        \"Proportional\",\r\n        \"Monospaced\",\r\n        \"Half-width\",\r\n        \"Normal\",\r\n        NULL\r\n      }\r\n    }, /* Here after Newer */  { /* 23 */\r\n      \"Transliteration\",\r\n      1,\r\n      {\r\n        \"No Transliteration\",\r\n        \"Hanja To Hangul\",\r\n        \"Hiragana to Katakana\",\r\n        \"Katakana to Hiragana\",\r\n        \"Kana to Romanization\",\r\n        \"Romanization to Hiragana\",\r\n        \"Romanization to Katakana\",\r\n        \"Hanja to Hangul, Alternative Set 1\",\r\n        \"Hanja to Hangul, Alternative Set 2\",\r\n        \"Hanja to Hangul, Alternative Set 3\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 24 */\r\n      \"Annotation\",\r\n      1,\r\n      {\r\n        \"No Annotation\",\r\n        \"Box Annotation\",\r\n        \"Rounded Box Annotation\",\r\n        \"Circle Annotation\",\r\n        \"Inverted Circle Annotation\",\r\n        \"Parenthesis Annotation\",\r\n        \"Period Annotation\",\r\n        \"Roman Numeral Annotation\",\r\n        \"Diamond Annotation\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 25 */\r\n      \"Kana Spacing\",\r\n      1,\r\n      {\r\n        \"Full Width\",\r\n        \"Proportional\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 26 */\r\n      \"Ideographic Spacing\",\r\n      1,\r\n      {\r\n        \"Full Width\",\r\n        \"Proportional\",\r\n        NULL\r\n      }\r\n    }, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT,         /* 27-30 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 31-35 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 36-40 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 40-45 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 46-50 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 51-55 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 56-60 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 61-65 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 66-70 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 71-75 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 76-80 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 81-85 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 86-90 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 91-95 */\r\n    EMPTYFEAT, EMPTYFEAT, EMPTYFEAT,                       /* 96-98 */\r\n    EMPTYFEAT, /* 99 */ {                   /* 100 => 22 */\r\n      \"Text Spacing\",\r\n      1,\r\n      {\r\n        \"Proportional\",\r\n        \"Monospaced\",\r\n        \"Half-width\",\r\n        \"Normal\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 101 => 25 */\r\n      \"Kana Spacing\",\r\n      1,\r\n      {\r\n        \"Full Width\",\r\n        \"Proportional\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 102 => 26 */\r\n      \"Ideographic Spacing\",\r\n      1,\r\n      {\r\n        \"Full Width\",\r\n        \"Proportional\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 103 */\r\n      \"CJK Roman Spacing\",\r\n      1,\r\n      {\r\n        \"Half-width\",\r\n        \"Proportional\",\r\n        \"Default Roman\",\r\n        \"Full-width Roman\",\r\n        NULL\r\n      }\r\n    }, {                                    /* 104 => 1 */\r\n      \"All Typographic Features\",\r\n      0,\r\n      {\r\n        \"All Type Features\",\r\n        NULL\r\n      }\r\n    }\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         Generator                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  int\r\n  main( void )\r\n  {\r\n    int  i;\r\n\r\n\r\n    printf( \"  {\\n\" );\r\n    printf( \"   /* Generated from %s */\\n\", __FILE__ );\r\n\r\n    for ( i = 0;\r\n          i < sizeof ( featreg_table ) / sizeof ( GX_Feature_RegistryRec );\r\n          i++ )\r\n    {\r\n      const char*  feat_name;\r\n      int          nSettings;\r\n\r\n\r\n      feat_name = featreg_table[i].feat_name;\r\n      for ( nSettings = 0;\r\n            featreg_table[i].setting_name[nSettings];\r\n            nSettings++)\r\n        ;                                   /* Do nothing */\r\n\r\n      printf( \"    {%1d, %1d, %1d, %2d},   /* %s */\\n\",\r\n              feat_name ? 1 : 0,\r\n              ( feat_name                                                  &&\r\n                ( ft_strncmp( feat_name,\r\n                              APPLE_RESERVED, APPLE_RESERVED_LENGTH ) == 0 )\r\n              ) ? 1 : 0,\r\n              featreg_table[i].exclusive ? 1 : 0,\r\n              nSettings,\r\n              feat_name ? feat_name : \"__EMPTY__\" );\r\n    }\r\n\r\n    printf( \"  };\\n\" );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvjust.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvjust.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT just table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n#include FT_SFNT_NAMES_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvjust\r\n\r\n  /*\r\n   * referred `just' table format specification:\r\n   * http://developer.apple.com/fonts/TTRefMan/RM06/Chap6just.html\r\n   * last updated 2000.\r\n   * ----------------------------------------------\r\n   * [JUST HEADER]: GXV_JUST_HEADER_SIZE\r\n   * version     (fixed:  32bit) = 0x00010000\r\n   * format      (uint16: 16bit) = 0 is only defined (2000)\r\n   * horizOffset (uint16: 16bit)\r\n   * vertOffset  (uint16: 16bit)\r\n   * ----------------------------------------------\r\n   */\r\n\r\n  typedef struct  GXV_just_DataRec_\r\n  {\r\n    FT_UShort  wdc_offset_max;\r\n    FT_UShort  wdc_offset_min;\r\n    FT_UShort  pc_offset_max;\r\n    FT_UShort  pc_offset_min;\r\n\r\n  } GXV_just_DataRec, *GXV_just_Data;\r\n\r\n\r\n#define  GXV_JUST_DATA( a )  GXV_TABLE_DATA( just, a )\r\n\r\n\r\n  /* GX just table does not define their subset of GID */\r\n  static void\r\n  gxv_just_check_max_gid( FT_UShort         gid,\r\n                          const FT_String*  msg_tag,\r\n                          GXV_Validator     valid )\r\n  {\r\n    if ( gid < valid->face->num_glyphs )\r\n      return;\r\n\r\n    GXV_TRACE(( \"just table includes too large %s\"\r\n                \" GID=%d > %d (in maxp)\\n\",\r\n                msg_tag, gid, valid->face->num_glyphs ));\r\n    GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_wdp_entry_validate( FT_Bytes       table,\r\n                               FT_Bytes       limit,\r\n                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_ULong   justClass;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_Fixed   beforeGrowLimit;\r\n    FT_Fixed   beforeShrinkGrowLimit;\r\n    FT_Fixed   afterGrowLimit;\r\n    FT_Fixed   afterShrinkGrowLimit;\r\n    FT_UShort  growFlags;\r\n    FT_UShort  shrinkFlags;\r\n#endif\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 + 4 + 2 + 2 );\r\n    justClass             = FT_NEXT_ULONG( p );\r\n#ifndef GXV_LOAD_UNUSED_VARS\r\n    p += 4 + 4 + 4 + 4 + 2 + 2;\r\n#else\r\n    beforeGrowLimit       = FT_NEXT_ULONG( p );\r\n    beforeShrinkGrowLimit = FT_NEXT_ULONG( p );\r\n    afterGrowLimit        = FT_NEXT_ULONG( p );\r\n    afterShrinkGrowLimit  = FT_NEXT_ULONG( p );\r\n    growFlags             = FT_NEXT_USHORT( p );\r\n    shrinkFlags           = FT_NEXT_USHORT( p );\r\n#endif\r\n\r\n    /* According to Apple spec, only 7bits in justClass is used */\r\n    if ( ( justClass & 0xFFFFFF80 ) != 0 )\r\n    {\r\n      GXV_TRACE(( \"just table includes non-zero value\"\r\n                  \" in unused justClass higher bits\"\r\n                  \" of WidthDeltaPair\" ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_wdc_entry_validate( FT_Bytes       table,\r\n                               FT_Bytes       limit,\r\n                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_ULong  count, i;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 );\r\n    count = FT_NEXT_ULONG( p );\r\n    for ( i = 0; i < count; i++ )\r\n    {\r\n      GXV_TRACE(( \"validating wdc pair %d/%d\\n\", i + 1, count ));\r\n      gxv_just_wdp_entry_validate( p, limit, valid );\r\n      p += valid->subtable_length;\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_widthDeltaClusters_validate( FT_Bytes       table,\r\n                                        FT_Bytes       limit,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p         = table ;\r\n    FT_Bytes  wdc_end   = table + GXV_JUST_DATA( wdc_offset_max );\r\n    FT_UInt   i;\r\n\r\n\r\n    GXV_NAME_ENTER( \"just justDeltaClusters\" );\r\n\r\n    if ( limit <= wdc_end )\r\n      FT_INVALID_OFFSET;\r\n\r\n    for ( i = 0; p <= wdc_end; i++ )\r\n    {\r\n      gxv_just_wdc_entry_validate( p, limit, valid );\r\n      p += valid->subtable_length;\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_actSubrecord_type0_validate( FT_Bytes       table,\r\n                                        FT_Bytes       limit,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n\r\n    FT_Fixed   lowerLimit;\r\n    FT_Fixed   upperLimit;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  order;\r\n#endif\r\n    FT_UShort  decomposedCount;\r\n\r\n    FT_UInt    i;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 );\r\n    lowerLimit      = FT_NEXT_ULONG( p );\r\n    upperLimit      = FT_NEXT_ULONG( p );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    order           = FT_NEXT_USHORT( p );\r\n#else\r\n    p += 2;\r\n#endif\r\n    decomposedCount = FT_NEXT_USHORT( p );\r\n\r\n    if ( lowerLimit >= upperLimit )\r\n    {\r\n      GXV_TRACE(( \"just table includes invalid range spec:\"\r\n                  \" lowerLimit(%d) > upperLimit(%d)\\n\"     ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n\r\n    for ( i = 0; i < decomposedCount; i++ )\r\n    {\r\n      FT_UShort glyphs;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 );\r\n      glyphs = FT_NEXT_USHORT( p );\r\n      gxv_just_check_max_gid( glyphs, \"type0:glyphs\", valid );\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_actSubrecord_type1_validate( FT_Bytes       table,\r\n                                        FT_Bytes       limit,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  addGlyph;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    addGlyph = FT_NEXT_USHORT( p );\r\n\r\n    gxv_just_check_max_gid( addGlyph, \"type1:addGlyph\", valid );\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_actSubrecord_type2_validate( FT_Bytes       table,\r\n                                        FT_Bytes       limit,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_Fixed   substThreshhold; /* Apple misspelled \"Threshhold\" */\r\n#endif\r\n    FT_UShort  addGlyph;\r\n    FT_UShort  substGlyph;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 + 2 );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    substThreshhold = FT_NEXT_ULONG( p );\r\n#else\r\n    p += 4;\r\n#endif\r\n    addGlyph        = FT_NEXT_USHORT( p );\r\n    substGlyph      = FT_NEXT_USHORT( p );\r\n\r\n    if ( addGlyph != 0xFFFF )\r\n      gxv_just_check_max_gid( addGlyph, \"type2:addGlyph\", valid );\r\n\r\n    gxv_just_check_max_gid( substGlyph, \"type2:substGlyph\", valid );\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_actSubrecord_type4_validate( FT_Bytes       table,\r\n                                        FT_Bytes       limit,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_ULong  variantsAxis;\r\n    FT_Fixed  minimumLimit;\r\n    FT_Fixed  noStretchValue;\r\n    FT_Fixed  maximumLimit;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 );\r\n    variantsAxis   = FT_NEXT_ULONG( p );\r\n    minimumLimit   = FT_NEXT_ULONG( p );\r\n    noStretchValue = FT_NEXT_ULONG( p );\r\n    maximumLimit   = FT_NEXT_ULONG( p );\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    if ( variantsAxis != 0x64756374 ) /* 'duct' */\r\n      GXV_TRACE(( \"variantsAxis 0x%08x is non default value\",\r\n                   variantsAxis ));\r\n\r\n    if ( minimumLimit > noStretchValue )\r\n      GXV_TRACE(( \"type4:minimumLimit 0x%08x > noStretchValue 0x%08x\\n\",\r\n                  minimumLimit, noStretchValue ));\r\n    else if ( noStretchValue > maximumLimit )\r\n      GXV_TRACE(( \"type4:noStretchValue 0x%08x > maximumLimit 0x%08x\\n\",\r\n                  noStretchValue, maximumLimit ));\r\n    else if ( !IS_PARANOID_VALIDATION )\r\n      return;\r\n\r\n    FT_INVALID_DATA;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_actSubrecord_type5_validate( FT_Bytes       table,\r\n                                        FT_Bytes       limit,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  flags;\r\n    FT_UShort  glyph;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 );\r\n    flags = FT_NEXT_USHORT( p );\r\n    glyph = FT_NEXT_USHORT( p );\r\n\r\n    if ( flags )\r\n      GXV_TRACE(( \"type5: nonzero value 0x%04x in unused flags\\n\",\r\n                   flags ));\r\n    gxv_just_check_max_gid( glyph, \"type5:glyph\", valid );\r\n\r\n    valid->subtable_length = p - table;\r\n  }\r\n\r\n\r\n  /* parse single actSubrecord */\r\n  static void\r\n  gxv_just_actSubrecord_validate( FT_Bytes       table,\r\n                                  FT_Bytes       limit,\r\n                                  GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  actionClass;\r\n    FT_UShort  actionType;\r\n    FT_ULong   actionLength;\r\n\r\n\r\n    GXV_NAME_ENTER( \"just actSubrecord\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 4 );\r\n    actionClass  = FT_NEXT_USHORT( p );\r\n    actionType   = FT_NEXT_USHORT( p );\r\n    actionLength = FT_NEXT_ULONG( p );\r\n\r\n    /* actionClass is related with justClass using 7bit only */\r\n    if ( ( actionClass & 0xFF80 ) != 0 )\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n\r\n    if ( actionType == 0 )\r\n      gxv_just_actSubrecord_type0_validate( p, limit, valid );\r\n    else if ( actionType == 1 )\r\n      gxv_just_actSubrecord_type1_validate( p, limit, valid );\r\n    else if ( actionType == 2 )\r\n      gxv_just_actSubrecord_type2_validate( p, limit, valid );\r\n    else if ( actionType == 3 )\r\n      ;                         /* Stretch glyph action: no actionData */\r\n    else if ( actionType == 4 )\r\n      gxv_just_actSubrecord_type4_validate( p, limit, valid );\r\n    else if ( actionType == 5 )\r\n      gxv_just_actSubrecord_type5_validate( p, limit, valid );\r\n    else\r\n      FT_INVALID_DATA;\r\n\r\n    valid->subtable_length = actionLength;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_pcActionRecord_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_ULong  actionCount;\r\n    FT_ULong  i;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 );\r\n    actionCount = FT_NEXT_ULONG( p );\r\n    GXV_TRACE(( \"actionCount = %d\\n\", actionCount ));\r\n\r\n    for ( i = 0; i < actionCount; i++ )\r\n    {\r\n      gxv_just_actSubrecord_validate( p, limit, valid );\r\n      p += valid->subtable_length;\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_pcTable_LookupValue_entry_validate( FT_UShort            glyph,\r\n                                               GXV_LookupValueCPtr  value_p,\r\n                                               GXV_Validator        valid )\r\n  {\r\n    FT_UNUSED( glyph );\r\n\r\n    if ( value_p->u > GXV_JUST_DATA( pc_offset_max ) )\r\n      GXV_JUST_DATA( pc_offset_max ) = value_p->u;\r\n    if ( value_p->u < GXV_JUST_DATA( pc_offset_max ) )\r\n      GXV_JUST_DATA( pc_offset_min ) = value_p->u;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_pcLookupTable_validate( FT_Bytes       table,\r\n                                   FT_Bytes       limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    FT_Bytes p = table;\r\n\r\n\r\n    GXV_NAME_ENTER( \"just pcLookupTable\" );\r\n    GXV_JUST_DATA( pc_offset_max ) = 0x0000;\r\n    GXV_JUST_DATA( pc_offset_min ) = 0xFFFFU;\r\n\r\n    valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func = gxv_just_pcTable_LookupValue_entry_validate;\r\n\r\n    gxv_LookupTable_validate( p, limit, valid );\r\n\r\n    /* subtable_length is set by gxv_LookupTable_validate() */\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_postcompTable_validate( FT_Bytes       table,\r\n                                   FT_Bytes       limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    GXV_NAME_ENTER( \"just postcompTable\" );\r\n\r\n    gxv_just_pcLookupTable_validate( p, limit, valid );\r\n    p += valid->subtable_length;\r\n\r\n    gxv_just_pcActionRecord_validate( p, limit, valid );\r\n    p += valid->subtable_length;\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_classTable_entry_validate(\r\n    FT_Byte                         state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    /* TODO: validate markClass & currentClass */\r\n    FT_UShort  setMark;\r\n    FT_UShort  dontAdvance;\r\n    FT_UShort  markClass;\r\n    FT_UShort  currentClass;\r\n#endif\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( glyphOffset_p );\r\n    FT_UNUSED( table );\r\n    FT_UNUSED( limit );\r\n    FT_UNUSED( valid );\r\n\r\n#ifndef GXV_LOAD_UNUSED_VARS\r\n    FT_UNUSED( flags );\r\n#else\r\n    setMark      = (FT_UShort)( ( flags >> 15 ) & 1    );\r\n    dontAdvance  = (FT_UShort)( ( flags >> 14 ) & 1    );\r\n    markClass    = (FT_UShort)( ( flags >> 7  ) & 0x7F );\r\n    currentClass = (FT_UShort)(   flags         & 0x7F );\r\n#endif\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_justClassTable_validate ( FT_Bytes       table,\r\n                                     FT_Bytes       limit,\r\n                                     GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  length;\r\n    FT_UShort  coverage;\r\n    FT_ULong   subFeatureFlags;\r\n\r\n\r\n    GXV_NAME_ENTER( \"just justClassTable\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 4 );\r\n    length          = FT_NEXT_USHORT( p );\r\n    coverage        = FT_NEXT_USHORT( p );\r\n    subFeatureFlags = FT_NEXT_ULONG( p );\r\n\r\n    GXV_TRACE(( \"  justClassTable: coverage = 0x%04x (%s) \", coverage ));\r\n    if ( ( coverage & 0x4000 ) == 0  )\r\n      GXV_TRACE(( \"ascending\\n\" ));\r\n    else\r\n      GXV_TRACE(( \"descending\\n\" ));\r\n\r\n    if ( subFeatureFlags )\r\n      GXV_TRACE(( \"  justClassTable: nonzero value (0x%08x)\"\r\n                  \" in unused subFeatureFlags\\n\", subFeatureFlags ));\r\n\r\n    valid->statetable.optdata               = NULL;\r\n    valid->statetable.optdata_load_func     = NULL;\r\n    valid->statetable.subtable_setup_func   = NULL;\r\n    valid->statetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;\r\n    valid->statetable.entry_validate_func   =\r\n      gxv_just_classTable_entry_validate;\r\n\r\n    gxv_StateTable_validate( p, table + length, valid );\r\n\r\n    /* subtable_length is set by gxv_LookupTable_validate() */\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_wdcTable_LookupValue_validate( FT_UShort            glyph,\r\n                                          GXV_LookupValueCPtr  value_p,\r\n                                          GXV_Validator        valid )\r\n  {\r\n    FT_UNUSED( glyph );\r\n\r\n    if ( value_p->u > GXV_JUST_DATA( wdc_offset_max ) )\r\n      GXV_JUST_DATA( wdc_offset_max ) = value_p->u;\r\n    if ( value_p->u < GXV_JUST_DATA( wdc_offset_min ) )\r\n      GXV_JUST_DATA( wdc_offset_min ) = value_p->u;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_just_justData_lookuptable_validate( FT_Bytes       table,\r\n                                          FT_Bytes       limit,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    GXV_JUST_DATA( wdc_offset_max ) = 0x0000;\r\n    GXV_JUST_DATA( wdc_offset_min ) = 0xFFFFU;\r\n\r\n    valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func = gxv_just_wdcTable_LookupValue_validate;\r\n\r\n    gxv_LookupTable_validate( p, limit, valid );\r\n\r\n    /* subtable_length is set by gxv_LookupTable_validate() */\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*\r\n   * gxv_just_justData_validate() parses and validates horizData, vertData.\r\n   */\r\n  static void\r\n  gxv_just_justData_validate( FT_Bytes       table,\r\n                              FT_Bytes       limit,\r\n                              GXV_Validator  valid )\r\n  {\r\n    /*\r\n     * following 3 offsets are measured from the start of `just'\r\n     * (which table points to), not justData\r\n     */\r\n    FT_UShort  justClassTableOffset;\r\n    FT_UShort  wdcTableOffset;\r\n    FT_UShort  pcTableOffset;\r\n    FT_Bytes   p = table;\r\n\r\n    GXV_ODTECT( 4, odtect );\r\n\r\n\r\n    GXV_NAME_ENTER( \"just justData\" );\r\n\r\n    GXV_ODTECT_INIT( odtect );\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 );\r\n    justClassTableOffset = FT_NEXT_USHORT( p );\r\n    wdcTableOffset       = FT_NEXT_USHORT( p );\r\n    pcTableOffset        = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \" (justClassTableOffset = 0x%04x)\\n\", justClassTableOffset ));\r\n    GXV_TRACE(( \" (wdcTableOffset = 0x%04x)\\n\", wdcTableOffset ));\r\n    GXV_TRACE(( \" (pcTableOffset = 0x%04x)\\n\", pcTableOffset ));\r\n\r\n    gxv_just_justData_lookuptable_validate( p, limit, valid );\r\n    gxv_odtect_add_range( p, valid->subtable_length,\r\n                          \"just_LookupTable\", odtect );\r\n\r\n    if ( wdcTableOffset )\r\n    {\r\n      gxv_just_widthDeltaClusters_validate(\r\n        valid->root->base + wdcTableOffset, limit, valid );\r\n      gxv_odtect_add_range( valid->root->base + wdcTableOffset,\r\n                            valid->subtable_length, \"just_wdcTable\", odtect );\r\n    }\r\n\r\n    if ( pcTableOffset )\r\n    {\r\n      gxv_just_postcompTable_validate( valid->root->base + pcTableOffset,\r\n                                       limit, valid );\r\n      gxv_odtect_add_range( valid->root->base + pcTableOffset,\r\n                            valid->subtable_length, \"just_pcTable\", odtect );\r\n    }\r\n\r\n    if ( justClassTableOffset )\r\n    {\r\n      gxv_just_justClassTable_validate(\r\n        valid->root->base + justClassTableOffset, limit, valid );\r\n      gxv_odtect_add_range( valid->root->base + justClassTableOffset,\r\n                            valid->subtable_length, \"just_justClassTable\",\r\n                            odtect );\r\n    }\r\n\r\n    gxv_odtect_validate( odtect, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_just_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    FT_Bytes           p     = table;\r\n    FT_Bytes           limit = 0;\r\n\r\n    GXV_ValidatorRec   validrec;\r\n    GXV_Validator      valid = &validrec;\r\n    GXV_just_DataRec   justrec;\r\n    GXV_just_Data      just = &justrec;\r\n\r\n    FT_ULong           version;\r\n    FT_UShort          format;\r\n    FT_UShort          horizOffset;\r\n    FT_UShort          vertOffset;\r\n\r\n    GXV_ODTECT( 3, odtect );\r\n\r\n\r\n    GXV_ODTECT_INIT( odtect );\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = just;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `just' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    limit      = valid->root->limit;\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 );\r\n    version     = FT_NEXT_ULONG( p );\r\n    format      = FT_NEXT_USHORT( p );\r\n    horizOffset = FT_NEXT_USHORT( p );\r\n    vertOffset  = FT_NEXT_USHORT( p );\r\n    gxv_odtect_add_range( table, p - table, \"just header\", odtect );\r\n\r\n\r\n    /* Version 1.0 (always:2000) */\r\n    GXV_TRACE(( \" (version = 0x%08x)\\n\", version ));\r\n    if ( version != 0x00010000UL )\r\n      FT_INVALID_FORMAT;\r\n\r\n    /* format 0 (always:2000) */\r\n    GXV_TRACE(( \" (format = 0x%04x)\\n\", format ));\r\n    if ( format != 0x0000 )\r\n        FT_INVALID_FORMAT;\r\n\r\n    GXV_TRACE(( \" (horizOffset = %d)\\n\", horizOffset  ));\r\n    GXV_TRACE(( \" (vertOffset = %d)\\n\", vertOffset  ));\r\n\r\n\r\n    /* validate justData */\r\n    if ( 0 < horizOffset )\r\n    {\r\n      gxv_just_justData_validate( table + horizOffset, limit, valid );\r\n      gxv_odtect_add_range( table + horizOffset, valid->subtable_length,\r\n                            \"horizJustData\", odtect );\r\n    }\r\n\r\n    if ( 0 < vertOffset )\r\n    {\r\n      gxv_just_justData_validate( table + vertOffset, limit, valid );\r\n      gxv_odtect_add_range( table + vertOffset, valid->subtable_length,\r\n                            \"vertJustData\", odtect );\r\n    }\r\n\r\n    gxv_odtect_validate( odtect, valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvkern.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvkern.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT kern table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2007                                       */\r\n/*  by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n#include FT_SFNT_NAMES_H\r\n#include FT_SERVICE_GX_VALIDATE_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvkern\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef enum  GXV_kern_Version_\r\n  {\r\n    KERN_VERSION_CLASSIC = 0x0000,\r\n    KERN_VERSION_NEW     = 0x0001\r\n\r\n  } GXV_kern_Version;\r\n\r\n\r\n  typedef enum GXV_kern_Dialect_\r\n  {\r\n    KERN_DIALECT_UNKNOWN = 0,\r\n    KERN_DIALECT_MS      = FT_VALIDATE_MS,\r\n    KERN_DIALECT_APPLE   = FT_VALIDATE_APPLE,\r\n    KERN_DIALECT_ANY     = FT_VALIDATE_CKERN\r\n\r\n  } GXV_kern_Dialect;\r\n\r\n\r\n  typedef struct  GXV_kern_DataRec_\r\n  {\r\n    GXV_kern_Version  version;\r\n    void             *subtable_data;\r\n    GXV_kern_Dialect  dialect_request;\r\n\r\n  } GXV_kern_DataRec, *GXV_kern_Data;\r\n\r\n\r\n#define GXV_KERN_DATA( field )  GXV_TABLE_DATA( kern, field )\r\n\r\n#define KERN_IS_CLASSIC( valid )                               \\\r\n          ( KERN_VERSION_CLASSIC == GXV_KERN_DATA( version ) )\r\n#define KERN_IS_NEW( valid )                                   \\\r\n          ( KERN_VERSION_NEW     == GXV_KERN_DATA( version ) )\r\n\r\n#define KERN_DIALECT( valid )              \\\r\n          GXV_KERN_DATA( dialect_request )\r\n#define KERN_ALLOWS_MS( valid )                       \\\r\n          ( KERN_DIALECT( valid ) & KERN_DIALECT_MS )\r\n#define KERN_ALLOWS_APPLE( valid )                       \\\r\n          ( KERN_DIALECT( valid ) & KERN_DIALECT_APPLE )\r\n\r\n#define GXV_KERN_HEADER_SIZE           ( KERN_IS_NEW( valid ) ? 8 : 4 )\r\n#define GXV_KERN_SUBTABLE_HEADER_SIZE  ( KERN_IS_NEW( valid ) ? 8 : 6 )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      SUBTABLE VALIDATORS                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* ============================= format 0 ============================== */\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt0_pairs_validate( FT_Bytes       table,\r\n                                         FT_Bytes       limit,\r\n                                         FT_UShort      nPairs,\r\n                                         GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  i;\r\n\r\n    FT_UShort  last_gid_left  = 0;\r\n    FT_UShort  last_gid_right = 0;\r\n\r\n    FT_UNUSED( limit );\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern format 0 pairs\" );\r\n\r\n    for ( i = 0; i < nPairs; i++ )\r\n    {\r\n      FT_UShort  gid_left;\r\n      FT_UShort  gid_right;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      FT_Short   kernValue;\r\n#endif\r\n\r\n\r\n      /* left */\r\n      gid_left  = FT_NEXT_USHORT( p );\r\n      gxv_glyphid_validate( gid_left, valid );\r\n\r\n      /* right */\r\n      gid_right = FT_NEXT_USHORT( p );\r\n      gxv_glyphid_validate( gid_right, valid );\r\n\r\n      /* Pairs of left and right GIDs must be unique and sorted. */\r\n      GXV_TRACE(( \"left gid = %u, right gid = %u\\n\", gid_left, gid_right ));\r\n      if ( gid_left == last_gid_left )\r\n      {\r\n        if ( last_gid_right < gid_right )\r\n          last_gid_right = gid_right;\r\n        else\r\n          FT_INVALID_DATA;\r\n      }\r\n      else if ( last_gid_left < gid_left )\r\n      {\r\n        last_gid_left  = gid_left;\r\n        last_gid_right = gid_right;\r\n      }\r\n      else\r\n        FT_INVALID_DATA;\r\n\r\n      /* skip the kern value */\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      kernValue = FT_NEXT_SHORT( p );\r\n#else\r\n      p += 2;\r\n#endif\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt0_validate( FT_Bytes       table,\r\n                                   FT_Bytes       limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table + GXV_KERN_SUBTABLE_HEADER_SIZE;\r\n\r\n    FT_UShort  nPairs;\r\n    FT_UShort  unitSize;\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern subtable format 0\" );\r\n\r\n    unitSize = 2 + 2 + 2;\r\n    nPairs   = 0;\r\n\r\n    /* nPairs, searchRange, entrySelector, rangeShift */\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 + 2 );\r\n    gxv_BinSrchHeader_validate( p, limit, &unitSize, &nPairs, valid );\r\n    p += 2 + 2 + 2 + 2;\r\n\r\n    gxv_kern_subtable_fmt0_pairs_validate( p, limit, nPairs, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ============================= format 1 ============================== */\r\n\r\n\r\n  typedef struct  GXV_kern_fmt1_StateOptRec_\r\n  {\r\n    FT_UShort  valueTable;\r\n    FT_UShort  valueTable_length;\r\n\r\n  } GXV_kern_fmt1_StateOptRec, *GXV_kern_fmt1_StateOptRecData;\r\n\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt1_valueTable_load( FT_Bytes       table,\r\n                                          FT_Bytes       limit,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_Bytes                       p = table;\r\n    GXV_kern_fmt1_StateOptRecData  optdata =\r\n      (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    optdata->valueTable = FT_NEXT_USHORT( p );\r\n  }\r\n\r\n\r\n  /*\r\n   * passed tables_size covers whole StateTable, including kern fmt1 header\r\n   */\r\n  static void\r\n  gxv_kern_subtable_fmt1_subtable_setup( FT_UShort      table_size,\r\n                                         FT_UShort      classTable,\r\n                                         FT_UShort      stateArray,\r\n                                         FT_UShort      entryTable,\r\n                                         FT_UShort*     classTable_length_p,\r\n                                         FT_UShort*     stateArray_length_p,\r\n                                         FT_UShort*     entryTable_length_p,\r\n                                         GXV_Validator  valid )\r\n  {\r\n    FT_UShort  o[4];\r\n    FT_UShort  *l[4];\r\n    FT_UShort  buff[5];\r\n\r\n    GXV_kern_fmt1_StateOptRecData  optdata =\r\n      (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    o[3] = optdata->valueTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n    l[3] = &(optdata->valueTable_length);\r\n\r\n    gxv_set_length_by_ushort_offset( o, l, buff, 4, table_size, valid );\r\n  }\r\n\r\n\r\n  /*\r\n   * passed table & limit are of whole StateTable, not including subtables\r\n   */\r\n  static void\r\n  gxv_kern_subtable_fmt1_entry_validate(\r\n    FT_Byte                         state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  push;\r\n    FT_UShort  dontAdvance;\r\n#endif\r\n    FT_UShort  valueOffset;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  kernAction;\r\n    FT_UShort  kernValue;\r\n#endif\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( glyphOffset_p );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    push        = (FT_UShort)( ( flags >> 15 ) & 1      );\r\n    dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1      );\r\n#endif\r\n    valueOffset = (FT_UShort)(   flags         & 0x3FFF );\r\n\r\n    {\r\n      GXV_kern_fmt1_StateOptRecData  vt_rec =\r\n        (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata;\r\n      FT_Bytes  p;\r\n\r\n\r\n      if ( valueOffset < vt_rec->valueTable )\r\n        FT_INVALID_OFFSET;\r\n\r\n      p     = table + valueOffset;\r\n      limit = table + vt_rec->valueTable + vt_rec->valueTable_length;\r\n\r\n      GXV_LIMIT_CHECK( 2 + 2 );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      kernAction = FT_NEXT_USHORT( p );\r\n      kernValue  = FT_NEXT_USHORT( p );\r\n#else\r\n      p += 4;\r\n#endif\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt1_validate( FT_Bytes       table,\r\n                                   FT_Bytes       limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    FT_Bytes                   p = table;\r\n    GXV_kern_fmt1_StateOptRec  vt_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern subtable format 1\" );\r\n\r\n    valid->statetable.optdata =\r\n      &vt_rec;\r\n    valid->statetable.optdata_load_func =\r\n      gxv_kern_subtable_fmt1_valueTable_load;\r\n    valid->statetable.subtable_setup_func =\r\n      gxv_kern_subtable_fmt1_subtable_setup;\r\n    valid->statetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_NONE;\r\n    valid->statetable.entry_validate_func =\r\n      gxv_kern_subtable_fmt1_entry_validate;\r\n\r\n    gxv_StateTable_validate( p, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ================ Data for Class-Based Subtables 2, 3 ================ */\r\n\r\n  typedef enum  GXV_kern_ClassSpec_\r\n  {\r\n    GXV_KERN_CLS_L = 0,\r\n    GXV_KERN_CLS_R\r\n\r\n  } GXV_kern_ClassSpec;\r\n\r\n\r\n  /* ============================= format 2 ============================== */\r\n\r\n  /* ---------------------- format 2 specific data ----------------------- */\r\n\r\n  typedef struct  GXV_kern_subtable_fmt2_DataRec_\r\n  {\r\n    FT_UShort         rowWidth;\r\n    FT_UShort         array;\r\n    FT_UShort         offset_min[2];\r\n    FT_UShort         offset_max[2];\r\n    const FT_String*  class_tag[2];\r\n    GXV_odtect_Range  odtect;\r\n\r\n  } GXV_kern_subtable_fmt2_DataRec, *GXV_kern_subtable_fmt2_Data;\r\n\r\n\r\n#define GXV_KERN_FMT2_DATA( field )                         \\\r\n        ( ( (GXV_kern_subtable_fmt2_DataRec *)              \\\r\n              ( GXV_KERN_DATA( subtable_data ) ) )->field )\r\n\r\n\r\n  /* -------------------------- utility functions ----------------------- */\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt2_clstbl_validate( FT_Bytes            table,\r\n                                          FT_Bytes            limit,\r\n                                          GXV_kern_ClassSpec  spec,\r\n                                          GXV_Validator       valid )\r\n  {\r\n    const FT_String*  tag    = GXV_KERN_FMT2_DATA( class_tag[spec] );\r\n    GXV_odtect_Range  odtect = GXV_KERN_FMT2_DATA( odtect );\r\n\r\n    FT_Bytes   p = table;\r\n    FT_UShort  firstGlyph;\r\n    FT_UShort  nGlyphs;\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern format 2 classTable\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 );\r\n    firstGlyph = FT_NEXT_USHORT( p );\r\n    nGlyphs    = FT_NEXT_USHORT( p );\r\n    GXV_TRACE(( \" %s firstGlyph=%d, nGlyphs=%d\\n\",\r\n                tag, firstGlyph, nGlyphs ));\r\n\r\n    gxv_glyphid_validate( firstGlyph, valid );\r\n    gxv_glyphid_validate( (FT_UShort)( firstGlyph + nGlyphs - 1 ), valid );\r\n\r\n    gxv_array_getlimits_ushort( p, p + ( 2 * nGlyphs ),\r\n                                &( GXV_KERN_FMT2_DATA( offset_min[spec] ) ),\r\n                                &( GXV_KERN_FMT2_DATA( offset_max[spec] ) ),\r\n                                valid );\r\n\r\n    gxv_odtect_add_range( table, 2 * nGlyphs, tag, odtect );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt2_validate( FT_Bytes       table,\r\n                                   FT_Bytes       limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    GXV_ODTECT( 3, odtect );\r\n    GXV_kern_subtable_fmt2_DataRec  fmt2_rec =\r\n      { 0, 0, { 0, 0 }, { 0, 0 }, { \"leftClass\", \"rightClass\" }, NULL };\r\n\r\n    FT_Bytes   p = table + GXV_KERN_SUBTABLE_HEADER_SIZE;\r\n    FT_UShort  leftOffsetTable;\r\n    FT_UShort  rightOffsetTable;\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern subtable format 2\" );\r\n\r\n    GXV_ODTECT_INIT( odtect );\r\n    fmt2_rec.odtect = odtect;\r\n    GXV_KERN_DATA( subtable_data ) = &fmt2_rec;\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 + 2 );\r\n    GXV_KERN_FMT2_DATA( rowWidth ) = FT_NEXT_USHORT( p );\r\n    leftOffsetTable                = FT_NEXT_USHORT( p );\r\n    rightOffsetTable               = FT_NEXT_USHORT( p );\r\n    GXV_KERN_FMT2_DATA( array )    = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \"rowWidth = %d\\n\", GXV_KERN_FMT2_DATA( rowWidth ) ));\r\n\r\n\r\n    GXV_LIMIT_CHECK( leftOffsetTable );\r\n    GXV_LIMIT_CHECK( rightOffsetTable );\r\n    GXV_LIMIT_CHECK( GXV_KERN_FMT2_DATA( array ) );\r\n\r\n    gxv_kern_subtable_fmt2_clstbl_validate( table + leftOffsetTable, limit,\r\n                                            GXV_KERN_CLS_L, valid );\r\n\r\n    gxv_kern_subtable_fmt2_clstbl_validate( table + rightOffsetTable, limit,\r\n                                            GXV_KERN_CLS_R, valid );\r\n\r\n    if ( GXV_KERN_FMT2_DATA( offset_min[GXV_KERN_CLS_L] ) +\r\n           GXV_KERN_FMT2_DATA( offset_min[GXV_KERN_CLS_R] )\r\n         < GXV_KERN_FMT2_DATA( array )                      )\r\n      FT_INVALID_OFFSET;\r\n\r\n    gxv_odtect_add_range( table + GXV_KERN_FMT2_DATA( array ),\r\n                          GXV_KERN_FMT2_DATA( offset_max[GXV_KERN_CLS_L] )\r\n                            + GXV_KERN_FMT2_DATA( offset_max[GXV_KERN_CLS_R] )\r\n                            - GXV_KERN_FMT2_DATA( array ),\r\n                          \"array\", odtect );\r\n\r\n    gxv_odtect_validate( odtect, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* ============================= format 3 ============================== */\r\n\r\n  static void\r\n  gxv_kern_subtable_fmt3_validate( FT_Bytes       table,\r\n                                   FT_Bytes       limit,\r\n                                   GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table + GXV_KERN_SUBTABLE_HEADER_SIZE;\r\n    FT_UShort  glyphCount;\r\n    FT_Byte    kernValueCount;\r\n    FT_Byte    leftClassCount;\r\n    FT_Byte    rightClassCount;\r\n    FT_Byte    flags;\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern subtable format 3\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 + 1 + 1 + 1 + 1 );\r\n    glyphCount      = FT_NEXT_USHORT( p );\r\n    kernValueCount  = FT_NEXT_BYTE( p );\r\n    leftClassCount  = FT_NEXT_BYTE( p );\r\n    rightClassCount = FT_NEXT_BYTE( p );\r\n    flags           = FT_NEXT_BYTE( p );\r\n\r\n    if ( valid->face->num_glyphs != glyphCount )\r\n    {\r\n      GXV_TRACE(( \"maxGID=%d, but glyphCount=%d\\n\",\r\n                  valid->face->num_glyphs, glyphCount ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n    }\r\n\r\n    if ( flags != 0 )\r\n      GXV_TRACE(( \"kern subtable fmt3 has nonzero value\"\r\n                  \" (%d) in unused flag\\n\", flags ));\r\n    /*\r\n     * just skip kernValue[kernValueCount]\r\n     */\r\n    GXV_LIMIT_CHECK( 2 * kernValueCount );\r\n    p += 2 * kernValueCount;\r\n\r\n    /*\r\n     * check leftClass[gid] < leftClassCount\r\n     */\r\n    {\r\n      FT_Byte  min, max;\r\n\r\n\r\n      GXV_LIMIT_CHECK( glyphCount );\r\n      gxv_array_getlimits_byte( p, p + glyphCount, &min, &max, valid );\r\n      p += valid->subtable_length;\r\n\r\n      if ( leftClassCount < max )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    /*\r\n     * check rightClass[gid] < rightClassCount\r\n     */\r\n    {\r\n      FT_Byte  min, max;\r\n\r\n\r\n      GXV_LIMIT_CHECK( glyphCount );\r\n      gxv_array_getlimits_byte( p, p + glyphCount, &min, &max, valid );\r\n      p += valid->subtable_length;\r\n\r\n      if ( rightClassCount < max )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    /*\r\n     * check kernIndex[i, j] < kernValueCount\r\n     */\r\n    {\r\n      FT_UShort  i, j;\r\n\r\n\r\n      for ( i = 0; i < leftClassCount; i++ )\r\n      {\r\n        for ( j = 0; j < rightClassCount; j++ )\r\n        {\r\n          GXV_LIMIT_CHECK( 1 );\r\n          if ( kernValueCount < FT_NEXT_BYTE( p ) )\r\n            FT_INVALID_OFFSET;\r\n        }\r\n      }\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  gxv_kern_coverage_new_apple_validate( FT_UShort      coverage,\r\n                                        FT_UShort*     format,\r\n                                        GXV_Validator  valid )\r\n  {\r\n    /* new Apple-dialect */\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    FT_Bool  kernVertical;\r\n    FT_Bool  kernCrossStream;\r\n    FT_Bool  kernVariation;\r\n#endif\r\n\r\n    FT_UNUSED( valid );\r\n\r\n\r\n    /* reserved bits = 0 */\r\n    if ( coverage & 0x1FFC )\r\n      return FALSE;\r\n\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    kernVertical    = FT_BOOL( ( coverage >> 15 ) & 1 );\r\n    kernCrossStream = FT_BOOL( ( coverage >> 14 ) & 1 );\r\n    kernVariation   = FT_BOOL( ( coverage >> 13 ) & 1 );\r\n#endif\r\n\r\n    *format = (FT_UShort)( coverage & 0x0003 );\r\n\r\n    GXV_TRACE(( \"new Apple-dialect: \"\r\n                \"horizontal=%d, cross-stream=%d, variation=%d, format=%d\\n\",\r\n                 !kernVertical, kernCrossStream, kernVariation, *format ));\r\n\r\n    GXV_TRACE(( \"kerning values in Apple format subtable are ignored\\n\" ));\r\n\r\n    return TRUE;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  gxv_kern_coverage_classic_apple_validate( FT_UShort      coverage,\r\n                                            FT_UShort*     format,\r\n                                            GXV_Validator  valid )\r\n  {\r\n    /* classic Apple-dialect */\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    FT_Bool  horizontal;\r\n    FT_Bool  cross_stream;\r\n#endif\r\n\r\n\r\n    /* check expected flags, but don't check if MS-dialect is impossible */\r\n    if ( !( coverage & 0xFD00 ) && KERN_ALLOWS_MS( valid ) )\r\n      return FALSE;\r\n\r\n    /* reserved bits = 0 */\r\n    if ( coverage & 0x02FC )\r\n      return FALSE;\r\n\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    horizontal   = FT_BOOL( ( coverage >> 15 ) & 1 );\r\n    cross_stream = FT_BOOL( ( coverage >> 13 ) & 1 );\r\n#endif\r\n\r\n    *format = (FT_UShort)( coverage & 0x0003 );\r\n\r\n    GXV_TRACE(( \"classic Apple-dialect: \"\r\n                \"horizontal=%d, cross-stream=%d, format=%d\\n\",\r\n                 horizontal, cross_stream, *format ));\r\n\r\n    /* format 1 requires GX State Machine, too new for classic */\r\n    if ( *format == 1 )\r\n      return FALSE;\r\n\r\n    GXV_TRACE(( \"kerning values in Apple format subtable are ignored\\n\" ));\r\n\r\n    return TRUE;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  gxv_kern_coverage_classic_microsoft_validate( FT_UShort      coverage,\r\n                                                FT_UShort*     format,\r\n                                                GXV_Validator  valid )\r\n  {\r\n    /* classic Microsoft-dialect */\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    FT_Bool  horizontal;\r\n    FT_Bool  minimum;\r\n    FT_Bool  cross_stream;\r\n    FT_Bool  override;\r\n#endif\r\n\r\n    FT_UNUSED( valid );\r\n\r\n\r\n    /* reserved bits = 0 */\r\n    if ( coverage & 0xFDF0 )\r\n      return FALSE;\r\n\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    horizontal   = FT_BOOL(   coverage        & 1 );\r\n    minimum      = FT_BOOL( ( coverage >> 1 ) & 1 );\r\n    cross_stream = FT_BOOL( ( coverage >> 2 ) & 1 );\r\n    override     = FT_BOOL( ( coverage >> 3 ) & 1 );\r\n#endif\r\n\r\n    *format = (FT_UShort)( ( coverage >> 8 ) & 0x0003 );\r\n\r\n    GXV_TRACE(( \"classic Microsoft-dialect: \"\r\n                \"horizontal=%d, minimum=%d, cross-stream=%d, \"\r\n                \"override=%d, format=%d\\n\",\r\n                horizontal, minimum, cross_stream, override, *format ));\r\n\r\n    if ( *format == 2 )\r\n      GXV_TRACE((\r\n        \"kerning values in Microsoft format 2 subtable are ignored\\n\" ));\r\n\r\n    return TRUE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            MAIN                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static GXV_kern_Dialect\r\n  gxv_kern_coverage_validate( FT_UShort      coverage,\r\n                              FT_UShort*     format,\r\n                              GXV_Validator  valid )\r\n  {\r\n    GXV_kern_Dialect  result = KERN_DIALECT_UNKNOWN;\r\n\r\n\r\n    GXV_NAME_ENTER( \"validating coverage\" );\r\n\r\n    GXV_TRACE(( \"interprete coverage 0x%04x by Apple style\\n\", coverage ));\r\n\r\n    if ( KERN_IS_NEW( valid ) )\r\n    {\r\n      if ( gxv_kern_coverage_new_apple_validate( coverage,\r\n                                                 format,\r\n                                                 valid ) )\r\n      {\r\n        result = KERN_DIALECT_APPLE;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    if ( KERN_IS_CLASSIC( valid ) && KERN_ALLOWS_APPLE( valid ) )\r\n    {\r\n      if ( gxv_kern_coverage_classic_apple_validate( coverage,\r\n                                                     format,\r\n                                                     valid ) )\r\n      {\r\n        result = KERN_DIALECT_APPLE;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    if ( KERN_IS_CLASSIC( valid ) && KERN_ALLOWS_MS( valid ) )\r\n    {\r\n      if ( gxv_kern_coverage_classic_microsoft_validate( coverage,\r\n                                                         format,\r\n                                                         valid ) )\r\n      {\r\n        result = KERN_DIALECT_MS;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    GXV_TRACE(( \"cannot interprete coverage, broken kern subtable\\n\" ));\r\n\r\n  Exit:\r\n    GXV_EXIT;\r\n    return result;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_kern_subtable_validate( FT_Bytes       table,\r\n                              FT_Bytes       limit,\r\n                              GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    FT_UShort  version = 0;    /* MS only: subtable version, unused */\r\n#endif\r\n    FT_ULong   length;         /* MS: 16bit, Apple: 32bit*/\r\n    FT_UShort  coverage;\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    FT_UShort  tupleIndex = 0; /* Apple only */\r\n#endif\r\n    FT_UShort  u16[2];\r\n    FT_UShort  format = 255;   /* subtable format */\r\n\r\n\r\n    GXV_NAME_ENTER( \"kern subtable\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 );\r\n    u16[0]   = FT_NEXT_USHORT( p ); /* Apple: length_hi MS: version */\r\n    u16[1]   = FT_NEXT_USHORT( p ); /* Apple: length_lo MS: length */\r\n    coverage = FT_NEXT_USHORT( p );\r\n\r\n    switch ( gxv_kern_coverage_validate( coverage, &format, valid ) )\r\n    {\r\n    case KERN_DIALECT_MS:\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n      version    = u16[0];\r\n#endif\r\n      length     = u16[1];\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n      tupleIndex = 0;\r\n#endif\r\n      GXV_TRACE(( \"Subtable version = %d\\n\", version ));\r\n      GXV_TRACE(( \"Subtable length = %d\\n\", length ));\r\n      break;\r\n\r\n    case KERN_DIALECT_APPLE:\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n      version    = 0;\r\n#endif\r\n      length     = ( u16[0] << 16 ) + u16[1];\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n      tupleIndex = 0;\r\n#endif\r\n      GXV_TRACE(( \"Subtable length = %d\\n\", length ));\r\n\r\n      if ( KERN_IS_NEW( valid ) )\r\n      {\r\n        GXV_LIMIT_CHECK( 2 );\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n        tupleIndex = FT_NEXT_USHORT( p );\r\n#else\r\n        p += 2;\r\n#endif\r\n        GXV_TRACE(( \"Subtable tupleIndex = %d\\n\", tupleIndex ));\r\n      }\r\n      break;\r\n\r\n    default:\r\n      length = u16[1];\r\n      GXV_TRACE(( \"cannot detect subtable dialect, \"\r\n                  \"just skip %d byte\\n\", length ));\r\n      goto Exit;\r\n    }\r\n\r\n    /* formats 1, 2, 3 require the position of the start of this subtable */\r\n    if ( format == 0 )\r\n      gxv_kern_subtable_fmt0_validate( table, table + length, valid );\r\n    else if ( format == 1 )\r\n      gxv_kern_subtable_fmt1_validate( table, table + length, valid );\r\n    else if ( format == 2 )\r\n      gxv_kern_subtable_fmt2_validate( table, table + length, valid );\r\n    else if ( format == 3 )\r\n      gxv_kern_subtable_fmt3_validate( table, table + length, valid );\r\n    else\r\n      FT_INVALID_DATA;\r\n\r\n  Exit:\r\n    valid->subtable_length = length;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         kern TABLE                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_kern_validate_generic( FT_Bytes          table,\r\n                             FT_Face           face,\r\n                             FT_Bool           classic_only,\r\n                             GXV_kern_Dialect  dialect_request,\r\n                             FT_Validator      ftvalid )\r\n  {\r\n    GXV_ValidatorRec   validrec;\r\n    GXV_Validator      valid = &validrec;\r\n\r\n    GXV_kern_DataRec   kernrec;\r\n    GXV_kern_Data      kern = &kernrec;\r\n\r\n    FT_Bytes           p     = table;\r\n    FT_Bytes           limit = 0;\r\n\r\n    FT_ULong           nTables = 0;\r\n    FT_UInt            i;\r\n\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = kern;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `kern' table\\n\" ));\r\n    GXV_INIT;\r\n    KERN_DIALECT( valid ) = dialect_request;\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    GXV_KERN_DATA( version ) = (GXV_kern_Version)FT_NEXT_USHORT( p );\r\n    GXV_TRACE(( \"version 0x%04x (higher 16bit)\\n\",\r\n                GXV_KERN_DATA( version ) ));\r\n\r\n    if ( 0x0001 < GXV_KERN_DATA( version ) )\r\n      FT_INVALID_FORMAT;\r\n    else if ( KERN_IS_CLASSIC( valid ) )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 );\r\n      nTables = FT_NEXT_USHORT( p );\r\n    }\r\n    else if ( KERN_IS_NEW( valid ) )\r\n    {\r\n      if ( classic_only )\r\n        FT_INVALID_FORMAT;\r\n\r\n      if ( 0x0000 != FT_NEXT_USHORT( p ) )\r\n        FT_INVALID_FORMAT;\r\n\r\n      GXV_LIMIT_CHECK( 4 );\r\n      nTables = FT_NEXT_ULONG( p );\r\n    }\r\n\r\n    for ( i = 0; i < nTables; i++ )\r\n    {\r\n      GXV_TRACE(( \"validating subtable %d/%d\\n\", i, nTables ));\r\n      /* p should be 32bit-aligned? */\r\n      gxv_kern_subtable_validate( p, 0, valid );\r\n      p += valid->subtable_length;\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_kern_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    gxv_kern_validate_generic( table, face, 0, KERN_DIALECT_ANY, ftvalid );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_kern_validate_classic( FT_Bytes      table,\r\n                             FT_Face       face,\r\n                             FT_Int        dialect_flags,\r\n                             FT_Validator  ftvalid )\r\n  {\r\n    GXV_kern_Dialect  dialect_request;\r\n\r\n\r\n    dialect_request = (GXV_kern_Dialect)dialect_flags;\r\n    gxv_kern_validate_generic( table, face, 1, dialect_request, ftvalid );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvlcar.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvlcar.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT lcar table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvlcar\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  GXV_lcar_DataRec_\r\n  {\r\n    FT_UShort  format;\r\n\r\n  } GXV_lcar_DataRec, *GXV_lcar_Data;\r\n\r\n\r\n#define GXV_LCAR_DATA( FIELD )  GXV_TABLE_DATA( lcar, FIELD )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_lcar_partial_validate( FT_UShort      partial,\r\n                             FT_UShort      glyph,\r\n                             GXV_Validator  valid )\r\n  {\r\n    GXV_NAME_ENTER( \"partial\" );\r\n\r\n    if ( GXV_LCAR_DATA( format ) != 1 )\r\n      goto Exit;\r\n\r\n    gxv_ctlPoint_validate( glyph, partial, valid );\r\n\r\n  Exit:\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_lcar_LookupValue_validate( FT_UShort            glyph,\r\n                                 GXV_LookupValueCPtr  value_p,\r\n                                 GXV_Validator        valid )\r\n  {\r\n    FT_Bytes   p     = valid->root->base + value_p->u;\r\n    FT_Bytes   limit = valid->root->limit;\r\n    FT_UShort  count;\r\n    FT_Short   partial;\r\n    FT_UShort  i;\r\n\r\n\r\n    GXV_NAME_ENTER( \"element in lookupTable\" );\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    count = FT_NEXT_USHORT( p );\r\n\r\n    GXV_LIMIT_CHECK( 2 * count );\r\n    for ( i = 0; i < count; i++ )\r\n    {\r\n      partial = FT_NEXT_SHORT( p );\r\n      gxv_lcar_partial_validate( partial, glyph, valid );\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*\r\n    +------ lcar --------------------+\r\n    |                                |\r\n    |      +===============+         |\r\n    |      | looup header  |         |\r\n    |      +===============+         |\r\n    |      | BinSrchHeader |         |\r\n    |      +===============+         |\r\n    |      | lastGlyph[0]  |         |\r\n    |      +---------------+         |\r\n    |      | firstGlyph[0] |         |  head of lcar sfnt table\r\n    |      +---------------+         |             +\r\n    |      | offset[0]     |    ->   |          offset            [byte]\r\n    |      +===============+         |             +\r\n    |      | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]\r\n    |      +---------------+         |\r\n    |      | firstGlyph[1] |         |\r\n    |      +---------------+         |\r\n    |      | offset[1]     |         |\r\n    |      +===============+         |\r\n    |                                |\r\n    |       ....                     |\r\n    |                                |\r\n    |      16bit value array         |\r\n    |      +===============+         |\r\n    +------|     value     | <-------+\r\n    |       ....\r\n    |\r\n    |\r\n    |\r\n    |\r\n    |\r\n    +---->  lcar values...handled by lcar callback function\r\n  */\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_lcar_LookupFmt4_transit( FT_UShort            relative_gindex,\r\n                               GXV_LookupValueCPtr  base_value_p,\r\n                               FT_Bytes             lookuptbl_limit,\r\n                               GXV_Validator        valid )\r\n  {\r\n    FT_Bytes             p;\r\n    FT_Bytes             limit;\r\n    FT_UShort            offset;\r\n    GXV_LookupValueDesc  value;\r\n\r\n    FT_UNUSED( lookuptbl_limit );\r\n\r\n    /* XXX: check range? */\r\n    offset = (FT_UShort)( base_value_p->u +\r\n                          relative_gindex * sizeof ( FT_UShort ) );\r\n    p      = valid->root->base + offset;\r\n    limit  = valid->root->limit;\r\n\r\n    GXV_LIMIT_CHECK ( 2 );\r\n    value.u = FT_NEXT_USHORT( p );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          lcar TABLE                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_lcar_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    FT_Bytes          p     = table;\r\n    FT_Bytes          limit = 0;\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n\r\n    GXV_lcar_DataRec  lcarrec;\r\n    GXV_lcar_Data     lcar = &lcarrec;\r\n\r\n    FT_Fixed          version;\r\n\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = lcar;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `lcar' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 );\r\n    version = FT_NEXT_ULONG( p );\r\n    GXV_LCAR_DATA( format ) = FT_NEXT_USHORT( p );\r\n\r\n    if ( version != 0x00010000UL)\r\n      FT_INVALID_FORMAT;\r\n\r\n    if ( GXV_LCAR_DATA( format ) > 1 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_lcar_LookupValue_validate;\r\n    valid->lookupfmt4_trans = gxv_lcar_LookupFmt4_transit;\r\n    gxv_LookupTable_validate( p, limit, valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmod.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmod.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType's TrueTypeGX/AAT validation module implementation (body).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006                                             */\r\n/*  by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_GX_VALIDATE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_GX_VALIDATE_H\r\n\r\n#include \"gxvmod.h\"\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmodule\r\n\r\n\r\n  static FT_Error\r\n  gxv_load_table( FT_Face             face,\r\n                  FT_Tag              tag,\r\n                  FT_Byte* volatile*  table,\r\n                  FT_ULong*           table_len )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n    error = FT_Load_Sfnt_Table( face, tag, 0, NULL, table_len );\r\n    if ( error == GXV_Err_Table_Missing )\r\n      return GXV_Err_Ok;\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_ALLOC( *table, *table_len ) )\r\n      goto Exit;\r\n\r\n    error = FT_Load_Sfnt_Table( face, tag, 0, *table, table_len );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n#define GXV_TABLE_DECL( _sfnt )                     \\\r\n          FT_Byte* volatile  _sfnt          = NULL; \\\r\n          FT_ULong            len_ ## _sfnt = 0\r\n\r\n#define GXV_TABLE_LOAD( _sfnt )                                     \\\r\n          if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \\\r\n               ( gx_flags & FT_VALIDATE_ ## _sfnt )            )    \\\r\n          {                                                         \\\r\n            error = gxv_load_table( face, TTAG_ ## _sfnt,           \\\r\n                                    &_sfnt, &len_ ## _sfnt );       \\\r\n            if ( error )                                            \\\r\n              goto Exit;                                            \\\r\n          }\r\n\r\n#define GXV_TABLE_VALIDATE( _sfnt )                                  \\\r\n          if ( _sfnt )                                               \\\r\n          {                                                          \\\r\n            ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \\\r\n                               FT_VALIDATE_DEFAULT );                \\\r\n            if ( ft_setjmp( valid.jump_buffer ) == 0 )               \\\r\n              gxv_ ## _sfnt ## _validate( _sfnt, face, &valid );     \\\r\n            error = valid.error;                                     \\\r\n            if ( error )                                             \\\r\n              goto Exit;                                             \\\r\n          }\r\n\r\n#define GXV_TABLE_SET( _sfnt )                                        \\\r\n          if ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count )        \\\r\n            tables[FT_VALIDATE_ ## _sfnt ## _INDEX] = (FT_Bytes)_sfnt\r\n\r\n\r\n  static FT_Error\r\n  gxv_validate( FT_Face   face,\r\n                FT_UInt   gx_flags,\r\n                FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],\r\n                FT_UInt   table_count )\r\n  {\r\n    FT_Memory volatile        memory = FT_FACE_MEMORY( face );\r\n\r\n    FT_Error                  error = GXV_Err_Ok;\r\n    FT_ValidatorRec volatile  valid;\r\n\r\n    FT_UInt  i;\r\n\r\n\r\n    GXV_TABLE_DECL( feat );\r\n    GXV_TABLE_DECL( bsln );\r\n    GXV_TABLE_DECL( trak );\r\n    GXV_TABLE_DECL( just );\r\n    GXV_TABLE_DECL( mort );\r\n    GXV_TABLE_DECL( morx );\r\n    GXV_TABLE_DECL( kern );\r\n    GXV_TABLE_DECL( opbd );\r\n    GXV_TABLE_DECL( prop );\r\n    GXV_TABLE_DECL( lcar );\r\n\r\n    for ( i = 0; i < table_count; i++ )\r\n      tables[i] = 0;\r\n\r\n    /* load tables */\r\n    GXV_TABLE_LOAD( feat );\r\n    GXV_TABLE_LOAD( bsln );\r\n    GXV_TABLE_LOAD( trak );\r\n    GXV_TABLE_LOAD( just );\r\n    GXV_TABLE_LOAD( mort );\r\n    GXV_TABLE_LOAD( morx );\r\n    GXV_TABLE_LOAD( kern );\r\n    GXV_TABLE_LOAD( opbd );\r\n    GXV_TABLE_LOAD( prop );\r\n    GXV_TABLE_LOAD( lcar );\r\n\r\n    /* validate tables */\r\n    GXV_TABLE_VALIDATE( feat );\r\n    GXV_TABLE_VALIDATE( bsln );\r\n    GXV_TABLE_VALIDATE( trak );\r\n    GXV_TABLE_VALIDATE( just );\r\n    GXV_TABLE_VALIDATE( mort );\r\n    GXV_TABLE_VALIDATE( morx );\r\n    GXV_TABLE_VALIDATE( kern );\r\n    GXV_TABLE_VALIDATE( opbd );\r\n    GXV_TABLE_VALIDATE( prop );\r\n    GXV_TABLE_VALIDATE( lcar );\r\n\r\n    /* Set results */\r\n    GXV_TABLE_SET( feat );\r\n    GXV_TABLE_SET( mort );\r\n    GXV_TABLE_SET( morx );\r\n    GXV_TABLE_SET( bsln );\r\n    GXV_TABLE_SET( just );\r\n    GXV_TABLE_SET( kern );\r\n    GXV_TABLE_SET( opbd );\r\n    GXV_TABLE_SET( trak );\r\n    GXV_TABLE_SET( prop );\r\n    GXV_TABLE_SET( lcar );\r\n\r\n  Exit:\r\n    if ( error )\r\n    {\r\n      FT_FREE( feat );\r\n      FT_FREE( bsln );\r\n      FT_FREE( trak );\r\n      FT_FREE( just );\r\n      FT_FREE( mort );\r\n      FT_FREE( morx );\r\n      FT_FREE( kern );\r\n      FT_FREE( opbd );\r\n      FT_FREE( prop );\r\n      FT_FREE( lcar );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  classic_kern_validate( FT_Face    face,\r\n                         FT_UInt    ckern_flags,\r\n                         FT_Bytes*  ckern_table )\r\n  {\r\n    FT_Memory volatile        memory = FT_FACE_MEMORY( face );\r\n\r\n    FT_Byte* volatile         ckern     = NULL;\r\n    FT_ULong                  len_ckern = 0;\r\n\r\n    /* without volatile on `error' GCC 4.1.1. emits:                         */\r\n    /*  warning: variable 'error' might be clobbered by 'longjmp' or 'vfork' */\r\n    /* this warning seems spurious but ---                                   */\r\n    FT_Error volatile         error = GXV_Err_Ok;\r\n    FT_ValidatorRec volatile  valid;\r\n\r\n\r\n    *ckern_table = NULL;\r\n\r\n    error = gxv_load_table( face, TTAG_kern, &ckern, &len_ckern );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( ckern )\r\n    {\r\n      ft_validator_init( &valid, ckern, ckern + len_ckern,\r\n                         FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        gxv_kern_validate_classic( ckern, face,\r\n                                   ckern_flags & FT_VALIDATE_CKERN, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    *ckern_table = ckern;\r\n\r\n  Exit:\r\n    if ( error )\r\n      FT_FREE( ckern );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static\r\n  const FT_Service_GXvalidateRec  gxvalid_interface =\r\n  {\r\n    gxv_validate\r\n  };\r\n\r\n\r\n  static\r\n  const FT_Service_CKERNvalidateRec  ckernvalid_interface =\r\n  {\r\n    classic_kern_validate\r\n  };\r\n\r\n\r\n  static\r\n  const FT_ServiceDescRec  gxvalid_services[] =\r\n  {\r\n    { FT_SERVICE_ID_GX_VALIDATE,          &gxvalid_interface },\r\n    { FT_SERVICE_ID_CLASSICKERN_VALIDATE, &ckernvalid_interface },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  static FT_Pointer\r\n  gxvalid_get_service( FT_Module    module,\r\n                       const char*  service_id )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( gxvalid_services, service_id );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Module_Class  gxv_module_class =\r\n  {\r\n    0,\r\n    sizeof ( FT_ModuleRec ),\r\n    \"gxvalid\",\r\n    0x10000L,\r\n    0x20000L,\r\n\r\n    0,              /* module-specific interface */\r\n\r\n    (FT_Module_Constructor)0,\r\n    (FT_Module_Destructor) 0,\r\n    (FT_Module_Requester)  gxvalid_get_service\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmod.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmod.h                                                               */\r\n/*                                                                         */\r\n/*    FreeType's TrueTypeGX/AAT validation module implementation           */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __GXVMOD_H__\r\n#define __GXVMOD_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Module_Class )  gxv_module_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __GXVMOD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT mort table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmort.h\"\r\n#include \"gxvfeat.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmort\r\n\r\n\r\n  static void\r\n  gxv_mort_feature_validate( GXV_mort_feature  f,\r\n                             GXV_Validator     valid )\r\n  {\r\n    if ( f->featureType >= gxv_feat_registry_length )\r\n    {\r\n      GXV_TRACE(( \"featureType %d is out of registered range, \"\r\n                  \"setting %d is unchecked\\n\",\r\n                  f->featureType, f->featureSetting ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n    else if ( !gxv_feat_registry[f->featureType].existence )\r\n    {\r\n      GXV_TRACE(( \"featureType %d is within registered area \"\r\n                  \"but undefined, setting %d is unchecked\\n\",\r\n                  f->featureType, f->featureSetting ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n    else\r\n    {\r\n      FT_Byte  nSettings_max;\r\n\r\n\r\n      /* nSettings in gxvfeat.c is halved for exclusive on/off settings */\r\n      nSettings_max = gxv_feat_registry[f->featureType].nSettings;\r\n      if ( gxv_feat_registry[f->featureType].exclusive )\r\n        nSettings_max = (FT_Byte)( 2 * nSettings_max );\r\n\r\n      GXV_TRACE(( \"featureType %d is registered\", f->featureType ));\r\n      GXV_TRACE(( \"setting %d\", f->featureSetting ));\r\n\r\n      if ( f->featureSetting > nSettings_max )\r\n      {\r\n        GXV_TRACE(( \"out of defined range %d\", nSettings_max ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n      }\r\n      GXV_TRACE(( \"\\n\" ));\r\n    }\r\n\r\n    /* TODO: enableFlags must be unique value in specified chain?  */\r\n  }\r\n\r\n\r\n  /*\r\n   * nFeatureFlags is typed to FT_ULong to accept that in\r\n   * mort (typed FT_UShort) and morx (typed FT_ULong).\r\n   */\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_featurearray_validate( FT_Bytes       table,\r\n                                  FT_Bytes       limit,\r\n                                  FT_ULong       nFeatureFlags,\r\n                                  GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_ULong  i;\r\n\r\n    GXV_mort_featureRec  f = GXV_MORT_FEATURE_OFF;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort feature list\" );\r\n    for ( i = 0; i < nFeatureFlags; i++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 + 2 + 4 + 4 );\r\n      f.featureType    = FT_NEXT_USHORT( p );\r\n      f.featureSetting = FT_NEXT_USHORT( p );\r\n      f.enableFlags    = FT_NEXT_ULONG( p );\r\n      f.disableFlags   = FT_NEXT_ULONG( p );\r\n\r\n      gxv_mort_feature_validate( &f, valid );\r\n    }\r\n\r\n    if ( !IS_GXV_MORT_FEATURE_OFF( f ) )\r\n      FT_INVALID_DATA;\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_coverage_validate( FT_UShort      coverage,\r\n                              GXV_Validator  valid )\r\n  {\r\n    FT_UNUSED( valid );\r\n\r\n    if ( coverage & 0x8000U )\r\n      GXV_TRACE(( \" this subtable is for vertical text only\\n\" ));\r\n    else\r\n      GXV_TRACE(( \" this subtable is for horizontal text only\\n\" ));\r\n\r\n    if ( coverage & 0x4000 )\r\n      GXV_TRACE(( \" this subtable is applied to glyph array \"\r\n                  \"in descending order\\n\" ));\r\n    else\r\n      GXV_TRACE(( \" this subtable is applied to glyph array \"\r\n                  \"in ascending order\\n\" ));\r\n\r\n    if ( coverage & 0x2000 )\r\n      GXV_TRACE(( \" this subtable is forcibly applied to \"\r\n                  \"vertical/horizontal text\\n\" ));\r\n\r\n    if ( coverage & 0x1FF8 )\r\n      GXV_TRACE(( \" coverage has non-zero bits in reserved area\\n\" ));\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtables_validate( FT_Bytes       table,\r\n                               FT_Bytes       limit,\r\n                               FT_UShort      nSubtables,\r\n                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_Validate_Func fmt_funcs_table[] =\r\n    {\r\n      gxv_mort_subtable_type0_validate, /* 0 */\r\n      gxv_mort_subtable_type1_validate, /* 1 */\r\n      gxv_mort_subtable_type2_validate, /* 2 */\r\n      NULL,                             /* 3 */\r\n      gxv_mort_subtable_type4_validate, /* 4 */\r\n      gxv_mort_subtable_type5_validate, /* 5 */\r\n\r\n    };\r\n\r\n    GXV_Validate_Func  func;\r\n    FT_UShort          i;\r\n\r\n\r\n    GXV_NAME_ENTER( \"subtables in a chain\" );\r\n\r\n    for ( i = 0; i < nSubtables; i++ )\r\n    {\r\n      FT_UShort  length;\r\n      FT_UShort  coverage;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      FT_ULong   subFeatureFlags;\r\n#endif\r\n      FT_UInt    type;\r\n      FT_UInt    rest;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 + 2 + 4 );\r\n      length          = FT_NEXT_USHORT( p );\r\n      coverage        = FT_NEXT_USHORT( p );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      subFeatureFlags = FT_NEXT_ULONG( p );\r\n#else\r\n      p += 4;\r\n#endif\r\n\r\n      GXV_TRACE(( \"validating chain subtable %d/%d (%d bytes)\\n\",\r\n                  i + 1, nSubtables, length ));\r\n      type = coverage & 0x0007;\r\n      rest = length - ( 2 + 2 + 4 );\r\n\r\n      GXV_LIMIT_CHECK( rest );\r\n      gxv_mort_coverage_validate( coverage, valid );\r\n\r\n      if ( type > 5 )\r\n        FT_INVALID_FORMAT;\r\n\r\n      func = fmt_funcs_table[type];\r\n      if ( func == NULL )\r\n        GXV_TRACE(( \"morx type %d is reserved\\n\", type ));\r\n\r\n      func( p, p + rest, valid );\r\n\r\n      p += rest;\r\n      /* TODO: validate subFeatureFlags */\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_chain_validate( FT_Bytes       table,\r\n                           FT_Bytes       limit,\r\n                           GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_ULong   defaultFlags;\r\n#endif\r\n    FT_ULong   chainLength;\r\n    FT_UShort  nFeatureFlags;\r\n    FT_UShort  nSubtables;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort chain header\" );\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    defaultFlags  = FT_NEXT_ULONG( p );\r\n#else\r\n    p += 4;\r\n#endif\r\n    chainLength   = FT_NEXT_ULONG( p );\r\n    nFeatureFlags = FT_NEXT_USHORT( p );\r\n    nSubtables    = FT_NEXT_USHORT( p );\r\n\r\n    gxv_mort_featurearray_validate( p, table + chainLength,\r\n                                    nFeatureFlags, valid );\r\n    p += valid->subtable_length;\r\n    gxv_mort_subtables_validate( p, table + chainLength, nSubtables, valid );\r\n    valid->subtable_length = chainLength;\r\n\r\n    /* TODO: validate defaultFlags */\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_Bytes          limit = 0;\r\n    FT_ULong          version;\r\n    FT_ULong          nChains;\r\n    FT_ULong          i;\r\n\r\n\r\n    valid->root = ftvalid;\r\n    valid->face = face;\r\n    limit       = valid->root->limit;\r\n\r\n    FT_TRACE3(( \"validating `mort' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 );\r\n    version = FT_NEXT_ULONG( p );\r\n    nChains = FT_NEXT_ULONG( p );\r\n\r\n    if (version != 0x00010000UL)\r\n      FT_INVALID_FORMAT;\r\n\r\n    for ( i = 0; i < nChains; i++ )\r\n    {\r\n      GXV_TRACE(( \"validating chain %d/%d\\n\", i + 1, nChains ));\r\n      GXV_32BIT_ALIGNMENT_VALIDATE( p - table );\r\n      gxv_mort_chain_validate( p, limit, valid );\r\n      p += valid->subtable_length;\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort.h                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT common definition for mort table (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __GXVMORT_H__\r\n#define __GXVMORT_H__\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n#include FT_SFNT_NAMES_H\r\n\r\n\r\n  typedef struct  GXV_mort_featureRec_\r\n  {\r\n    FT_UShort  featureType;\r\n    FT_UShort  featureSetting;\r\n    FT_ULong   enableFlags;\r\n    FT_ULong   disableFlags;\r\n\r\n  } GXV_mort_featureRec, *GXV_mort_feature;\r\n\r\n#define GXV_MORT_FEATURE_OFF  {0, 1, 0x00000000UL, 0x00000000UL}\r\n\r\n#define IS_GXV_MORT_FEATURE_OFF( f )              \\\r\n          ( (f).featureType    == 0            || \\\r\n            (f).featureSetting == 1            || \\\r\n            (f).enableFlags    == 0x00000000UL || \\\r\n            (f).disableFlags   == 0x00000000UL )\r\n\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_featurearray_validate( FT_Bytes       table,\r\n                                  FT_Bytes       limit,\r\n                                  FT_ULong       nFeatureFlags,\r\n                                  GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_coverage_validate( FT_UShort      coverage,\r\n                              GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_subtable_type0_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_subtable_type1_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_subtable_type2_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_subtable_type4_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_mort_subtable_type5_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n\r\n#endif /* __GXVMORT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort0.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort0.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT mort table validation                                 */\r\n/*    body for type0 (Indic Script Rearrangement) subtable.                */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmort.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmort\r\n\r\n\r\n  static const char* GXV_Mort_IndicScript_Msg[] =\r\n  {\r\n    \"no change\",\r\n    \"Ax => xA\",\r\n    \"xD => Dx\",\r\n    \"AxD => DxA\",\r\n    \"ABx => xAB\",\r\n    \"ABx => xBA\",\r\n    \"xCD => CDx\",\r\n    \"xCD => DCx\",\r\n    \"AxCD => CDxA\",\r\n    \"AxCD => DCxA\",\r\n    \"ABxD => DxAB\",\r\n    \"ABxD => DxBA\",\r\n    \"ABxCD => CDxAB\",\r\n    \"ABxCD => CDxBA\",\r\n    \"ABxCD => DCxAB\",\r\n    \"ABxCD => DCxBA\",\r\n\r\n  };\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type0_entry_validate(\r\n    FT_Byte                         state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n    FT_UShort  markFirst;\r\n    FT_UShort  dontAdvance;\r\n    FT_UShort  markLast;\r\n    FT_UShort  reserved;\r\n    FT_UShort  verb = 0;\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( table );\r\n    FT_UNUSED( limit );\r\n\r\n    FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */\r\n    FT_UNUSED( glyphOffset_p );                  /* case                  */\r\n\r\n\r\n    markFirst   = (FT_UShort)( ( flags >> 15 ) & 1 );\r\n    dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );\r\n    markLast    = (FT_UShort)( ( flags >> 13 ) & 1 );\r\n\r\n    reserved = (FT_UShort)( flags & 0x1FF0 );\r\n    verb     = (FT_UShort)( flags & 0x000F );\r\n\r\n    GXV_TRACE(( \"  IndicScript MorphRule for glyphOffset 0x%04x\",\r\n                glyphOffset_p->u ));\r\n    GXV_TRACE(( \" markFirst=%01d\", markFirst ));\r\n    GXV_TRACE(( \" dontAdvance=%01d\", dontAdvance ));\r\n    GXV_TRACE(( \" markLast=%01d\", markLast ));\r\n    GXV_TRACE(( \" %02d\", verb ));\r\n    GXV_TRACE(( \" %s\\n\", GXV_Mort_IndicScript_Msg[verb] ));\r\n\r\n    if ( markFirst > 0 && markLast > 0 )\r\n    {\r\n      GXV_TRACE(( \"  [odd] a glyph is marked as the first and last\"\r\n                  \"  in Indic rearrangement\\n\" ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n\r\n    if ( markFirst > 0 && dontAdvance > 0 )\r\n    {\r\n      GXV_TRACE(( \"  [odd] the first glyph is marked as dontAdvance\"\r\n                  \" in Indic rearrangement\\n\" ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n\r\n    if ( 0 < reserved )\r\n    {\r\n      GXV_TRACE(( \" non-zero bits found in reserved range\\n\" ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n    else\r\n      GXV_TRACE(( \"\\n\" ));\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_subtable_type0_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    GXV_NAME_ENTER(\r\n      \"mort chain subtable type0 (Indic-Script Rearrangement)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );\r\n\r\n    valid->statetable.optdata               = NULL;\r\n    valid->statetable.optdata_load_func     = NULL;\r\n    valid->statetable.subtable_setup_func   = NULL;\r\n    valid->statetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;\r\n    valid->statetable.entry_validate_func =\r\n      gxv_mort_subtable_type0_entry_validate;\r\n\r\n    gxv_StateTable_validate( p, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort1.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort1.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT mort table validation                                 */\r\n/*    body for type1 (Contextual Substitution) subtable.                   */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2007 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmort.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmort\r\n\r\n\r\n  typedef struct  GXV_mort_subtable_type1_StateOptRec_\r\n  {\r\n    FT_UShort  substitutionTable;\r\n    FT_UShort  substitutionTable_length;\r\n\r\n  }  GXV_mort_subtable_type1_StateOptRec,\r\n    *GXV_mort_subtable_type1_StateOptRecData;\r\n\r\n#define GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE \\\r\n          ( GXV_STATETABLE_HEADER_SIZE + 2 )\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type1_substitutionTable_load( FT_Bytes       table,\r\n                                                  FT_Bytes       limit,\r\n                                                  GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_mort_subtable_type1_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type1_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    optdata->substitutionTable = FT_NEXT_USHORT( p );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type1_subtable_setup( FT_UShort      table_size,\r\n                                          FT_UShort      classTable,\r\n                                          FT_UShort      stateArray,\r\n                                          FT_UShort      entryTable,\r\n                                          FT_UShort*     classTable_length_p,\r\n                                          FT_UShort*     stateArray_length_p,\r\n                                          FT_UShort*     entryTable_length_p,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_UShort  o[4];\r\n    FT_UShort  *l[4];\r\n    FT_UShort  buff[5];\r\n\r\n    GXV_mort_subtable_type1_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type1_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    o[3] = optdata->substitutionTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n    l[3] = &( optdata->substitutionTable_length );\r\n\r\n    gxv_set_length_by_ushort_offset( o, l, buff, 4, table_size, valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type1_offset_to_subst_validate(\r\n    FT_Short          wordOffset,\r\n    const FT_String*  tag,\r\n    FT_Byte           state,\r\n    GXV_Validator     valid )\r\n  {\r\n    FT_UShort  substTable;\r\n    FT_UShort  substTable_limit;\r\n\r\n    FT_UNUSED( tag );\r\n    FT_UNUSED( state );\r\n\r\n\r\n    substTable =\r\n      ((GXV_mort_subtable_type1_StateOptRec *)\r\n       (valid->statetable.optdata))->substitutionTable;\r\n    substTable_limit =\r\n      (FT_UShort)( substTable +\r\n                   ((GXV_mort_subtable_type1_StateOptRec *)\r\n                    (valid->statetable.optdata))->substitutionTable_length );\r\n\r\n    valid->min_gid = (FT_UShort)( ( substTable       - wordOffset * 2 ) / 2 );\r\n    valid->max_gid = (FT_UShort)( ( substTable_limit - wordOffset * 2 ) / 2 );\r\n    valid->max_gid = (FT_UShort)( FT_MAX( valid->max_gid,\r\n                                          valid->face->num_glyphs ) );\r\n\r\n    /* XXX: check range? */\r\n\r\n    /* TODO: min_gid & max_gid comparison with ClassTable contents */\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type1_entry_validate(\r\n    FT_Byte                         state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  setMark;\r\n    FT_UShort  dontAdvance;\r\n#endif\r\n    FT_UShort  reserved;\r\n    FT_Short   markOffset;\r\n    FT_Short   currentOffset;\r\n\r\n    FT_UNUSED( table );\r\n    FT_UNUSED( limit );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    setMark       = (FT_UShort)(   flags >> 15            );\r\n    dontAdvance   = (FT_UShort)( ( flags >> 14 ) & 1      );\r\n#endif\r\n    reserved      = (FT_Short)(    flags         & 0x3FFF );\r\n\r\n    markOffset    = (FT_Short)( glyphOffset_p->ul >> 16 );\r\n    currentOffset = (FT_Short)( glyphOffset_p->ul       );\r\n\r\n    if ( 0 < reserved )\r\n    {\r\n      GXV_TRACE(( \" non-zero bits found in reserved range\\n\" ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n\r\n    gxv_mort_subtable_type1_offset_to_subst_validate( markOffset,\r\n                                                      \"markOffset\",\r\n                                                      state,\r\n                                                      valid );\r\n\r\n    gxv_mort_subtable_type1_offset_to_subst_validate( currentOffset,\r\n                                                      \"currentOffset\",\r\n                                                      state,\r\n                                                      valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type1_substTable_validate( FT_Bytes       table,\r\n                                               FT_Bytes       limit,\r\n                                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  num_gids = (FT_UShort)(\r\n                 ((GXV_mort_subtable_type1_StateOptRec *)\r\n                  (valid->statetable.optdata))->substitutionTable_length / 2 );\r\n    FT_UShort  i;\r\n\r\n\r\n    GXV_NAME_ENTER( \"validating contents of substitutionTable\" );\r\n    for ( i = 0; i < num_gids ; i ++ )\r\n    {\r\n      FT_UShort  dst_gid;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 );\r\n      dst_gid = FT_NEXT_USHORT( p );\r\n\r\n      if ( dst_gid >= 0xFFFFU )\r\n        continue;\r\n\r\n      if ( dst_gid < valid->min_gid || valid->max_gid < dst_gid )\r\n      {\r\n        GXV_TRACE(( \"substTable include a strange gid[%d]=%d >\"\r\n                    \" out of define range (%d..%d)\\n\",\r\n                    i, dst_gid, valid->min_gid, valid->max_gid ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n      }\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*\r\n   * subtable for Contextual glyph substitution is a modified StateTable.\r\n   * In addition to classTable, stateArray, and entryTable, the field\r\n   * `substitutionTable' is added.\r\n   */\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_subtable_type1_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_mort_subtable_type1_StateOptRec  st_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort chain subtable type1 (Contextual Glyph Subst)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE );\r\n\r\n    valid->statetable.optdata =\r\n      &st_rec;\r\n    valid->statetable.optdata_load_func =\r\n      gxv_mort_subtable_type1_substitutionTable_load;\r\n    valid->statetable.subtable_setup_func =\r\n      gxv_mort_subtable_type1_subtable_setup;\r\n    valid->statetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_ULONG;\r\n    valid->statetable.entry_validate_func =\r\n\r\n      gxv_mort_subtable_type1_entry_validate;\r\n    gxv_StateTable_validate( p, limit, valid );\r\n\r\n    gxv_mort_subtable_type1_substTable_validate(\r\n      table + st_rec.substitutionTable,\r\n      table + st_rec.substitutionTable + st_rec.substitutionTable_length,\r\n      valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort2.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort2.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT mort table validation                                 */\r\n/*    body for type2 (Ligature Substitution) subtable.                     */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmort.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmort\r\n\r\n\r\n  typedef struct  GXV_mort_subtable_type2_StateOptRec_\r\n  {\r\n    FT_UShort  ligActionTable;\r\n    FT_UShort  componentTable;\r\n    FT_UShort  ligatureTable;\r\n    FT_UShort  ligActionTable_length;\r\n    FT_UShort  componentTable_length;\r\n    FT_UShort  ligatureTable_length;\r\n\r\n  }  GXV_mort_subtable_type2_StateOptRec,\r\n    *GXV_mort_subtable_type2_StateOptRecData;\r\n\r\n#define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE \\\r\n          ( GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2 )\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type2_opttable_load( FT_Bytes       table,\r\n                                         FT_Bytes       limit,\r\n                                         GXV_Validator  valid )\r\n  {\r\n    FT_Bytes p = table;\r\n    GXV_mort_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 2 + 2 + 2 );\r\n    optdata->ligActionTable = FT_NEXT_USHORT( p );\r\n    optdata->componentTable = FT_NEXT_USHORT( p );\r\n    optdata->ligatureTable  = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \"offset to ligActionTable=0x%04x\\n\",\r\n                optdata->ligActionTable ));\r\n    GXV_TRACE(( \"offset to componentTable=0x%04x\\n\",\r\n                optdata->componentTable ));\r\n    GXV_TRACE(( \"offset to ligatureTable=0x%04x\\n\",\r\n                optdata->ligatureTable ));\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type2_subtable_setup( FT_UShort      table_size,\r\n                                          FT_UShort      classTable,\r\n                                          FT_UShort      stateArray,\r\n                                          FT_UShort      entryTable,\r\n                                          FT_UShort      *classTable_length_p,\r\n                                          FT_UShort      *stateArray_length_p,\r\n                                          FT_UShort      *entryTable_length_p,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_UShort  o[6];\r\n    FT_UShort  *l[6];\r\n    FT_UShort  buff[7];\r\n\r\n    GXV_mort_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    GXV_NAME_ENTER( \"subtable boundaries setup\" );\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    o[3] = optdata->ligActionTable;\r\n    o[4] = optdata->componentTable;\r\n    o[5] = optdata->ligatureTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n    l[3] = &(optdata->ligActionTable_length);\r\n    l[4] = &(optdata->componentTable_length);\r\n    l[5] = &(optdata->ligatureTable_length);\r\n\r\n    gxv_set_length_by_ushort_offset( o, l, buff, 6, table_size, valid );\r\n\r\n    GXV_TRACE(( \"classTable: offset=0x%04x length=0x%04x\\n\",\r\n                classTable, *classTable_length_p ));\r\n    GXV_TRACE(( \"stateArray: offset=0x%04x length=0x%04x\\n\",\r\n                stateArray, *stateArray_length_p ));\r\n    GXV_TRACE(( \"entryTable: offset=0x%04x length=0x%04x\\n\",\r\n                entryTable, *entryTable_length_p ));\r\n    GXV_TRACE(( \"ligActionTable: offset=0x%04x length=0x%04x\\n\",\r\n                optdata->ligActionTable,\r\n                optdata->ligActionTable_length ));\r\n    GXV_TRACE(( \"componentTable: offset=0x%04x length=0x%04x\\n\",\r\n                optdata->componentTable,\r\n                optdata->componentTable_length ));\r\n    GXV_TRACE(( \"ligatureTable:  offset=0x%04x length=0x%04x\\n\",\r\n                optdata->ligatureTable,\r\n                optdata->ligatureTable_length ));\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type2_ligActionOffset_validate(\r\n    FT_Bytes       table,\r\n    FT_UShort      ligActionOffset,\r\n    GXV_Validator  valid )\r\n  {\r\n    /* access ligActionTable */\r\n    GXV_mort_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata;\r\n\r\n    FT_Bytes lat_base  = table + optdata->ligActionTable;\r\n    FT_Bytes p         = table + ligActionOffset;\r\n    FT_Bytes lat_limit = lat_base + optdata->ligActionTable;\r\n\r\n\r\n    GXV_32BIT_ALIGNMENT_VALIDATE( ligActionOffset );\r\n    if ( p < lat_base )\r\n    {\r\n      GXV_TRACE(( \"too short offset 0x%04x: p < lat_base (%d byte rewind)\\n\",\r\n                  ligActionOffset, lat_base - p ));\r\n\r\n      /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n    }\r\n    else if ( lat_limit < p )\r\n    {\r\n      GXV_TRACE(( \"too large offset 0x%04x: lat_limit < p (%d byte overrun)\\n\",\r\n                  ligActionOffset, p - lat_limit ));\r\n\r\n      /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n    }\r\n    else\r\n    {\r\n      /* validate entry in ligActionTable */\r\n      FT_ULong   lig_action;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      FT_UShort  last;\r\n      FT_UShort  store;\r\n#endif\r\n      FT_ULong   offset;\r\n\r\n\r\n      lig_action = FT_NEXT_ULONG( p );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      last   = (FT_UShort)( ( lig_action >> 31 ) & 1 );\r\n      store  = (FT_UShort)( ( lig_action >> 30 ) & 1 );\r\n#endif\r\n\r\n      /* Apple spec defines this offset as a word offset */\r\n      offset = lig_action & 0x3FFFFFFFUL;\r\n      if ( offset * 2 < optdata->ligatureTable )\r\n      {\r\n        GXV_TRACE(( \"too short offset 0x%08x:\"\r\n                    \" 2 x offset < ligatureTable (%d byte rewind)\\n\",\r\n                     offset, optdata->ligatureTable - offset * 2 ));\r\n\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n      } else if ( offset * 2 >\r\n                  optdata->ligatureTable + optdata->ligatureTable_length )\r\n      {\r\n        GXV_TRACE(( \"too long offset 0x%08x:\"\r\n                    \" 2 x offset > ligatureTable + ligatureTable_length\"\r\n                    \" (%d byte overrun)\\n\",\r\n                     offset,\r\n                     optdata->ligatureTable + optdata->ligatureTable_length\r\n                     - offset * 2 ));\r\n\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type2_entry_validate(\r\n    FT_Byte                         state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort setComponent;\r\n    FT_UShort dontAdvance;\r\n#endif\r\n    FT_UShort offset;\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( glyphOffset_p );\r\n    FT_UNUSED( limit );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    setComponent = (FT_UShort)( ( flags >> 15 ) & 1 );\r\n    dontAdvance  = (FT_UShort)( ( flags >> 14 ) & 1 );\r\n#endif\r\n\r\n    offset = (FT_UShort)( flags & 0x3FFFU );\r\n\r\n    if ( 0 < offset )\r\n      gxv_mort_subtable_type2_ligActionOffset_validate( table, offset,\r\n                                                        valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type2_ligatureTable_validate( FT_Bytes       table,\r\n                                                  GXV_Validator  valid )\r\n  {\r\n    GXV_mort_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata;\r\n\r\n    FT_Bytes p     = table + optdata->ligatureTable;\r\n    FT_Bytes limit = table + optdata->ligatureTable\r\n                           + optdata->ligatureTable_length;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort chain subtable type2 - substitutionTable\" );\r\n    if ( 0 != optdata->ligatureTable )\r\n    {\r\n      /* Apple does not give specification of ligatureTable format */\r\n      while ( p < limit )\r\n      {\r\n        FT_UShort  lig_gid;\r\n\r\n\r\n        GXV_LIMIT_CHECK( 2 );\r\n        lig_gid = FT_NEXT_USHORT( p );\r\n\r\n        if ( valid->face->num_glyphs < lig_gid )\r\n          GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n      }\r\n    }\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_subtable_type2_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_mort_subtable_type2_StateOptRec  lig_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort chain subtable type2 (Ligature Substitution)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE );\r\n\r\n    valid->statetable.optdata =\r\n      &lig_rec;\r\n    valid->statetable.optdata_load_func =\r\n      gxv_mort_subtable_type2_opttable_load;\r\n    valid->statetable.subtable_setup_func =\r\n      gxv_mort_subtable_type2_subtable_setup;\r\n    valid->statetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_NONE;\r\n    valid->statetable.entry_validate_func =\r\n      gxv_mort_subtable_type2_entry_validate;\r\n\r\n    gxv_StateTable_validate( p, limit, valid );\r\n\r\n    p += valid->subtable_length;\r\n    gxv_mort_subtable_type2_ligatureTable_validate( table, valid );\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort4.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort4.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT mort table validation                                 */\r\n/*    body for type4 (Non-Contextual Glyph Substitution) subtable.         */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmort.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmort\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type4_lookupval_validate( FT_UShort            glyph,\r\n                                              GXV_LookupValueCPtr  value_p,\r\n                                              GXV_Validator        valid )\r\n  {\r\n    FT_UNUSED( glyph );\r\n\r\n    gxv_glyphid_validate( value_p->u, valid );\r\n  }\r\n\r\n  /*\r\n    +===============+ --------+\r\n    | lookup header |         |\r\n    +===============+         |\r\n    | BinSrchHeader |         |\r\n    +===============+         |\r\n    | lastGlyph[0]  |         |\r\n    +---------------+         |\r\n    | firstGlyph[0] |         |    head of lookup table\r\n    +---------------+         |             +\r\n    | offset[0]     |    ->   |          offset            [byte]\r\n    +===============+         |             +\r\n    | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]\r\n    +---------------+         |\r\n    | firstGlyph[1] |         |\r\n    +---------------+         |\r\n    | offset[1]     |         |\r\n    +===============+         |\r\n                              |\r\n     ....                     |\r\n                              |\r\n    16bit value array         |\r\n    +===============+         |\r\n    |     value     | <-------+\r\n     ....\r\n  */\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_mort_subtable_type4_lookupfmt4_transit(\r\n    FT_UShort            relative_gindex,\r\n    GXV_LookupValueCPtr  base_value_p,\r\n    FT_Bytes             lookuptbl_limit,\r\n    GXV_Validator        valid )\r\n  {\r\n    FT_Bytes             p;\r\n    FT_Bytes             limit;\r\n    FT_UShort            offset;\r\n    GXV_LookupValueDesc  value;\r\n\r\n    /* XXX: check range? */\r\n    offset = (FT_UShort)( base_value_p->u +\r\n                          relative_gindex * sizeof ( FT_UShort ) );\r\n\r\n    p     = valid->lookuptbl_head + offset;\r\n    limit = lookuptbl_limit;\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    value.u = FT_NEXT_USHORT( p );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_subtable_type4_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort chain subtable type4 \"\r\n                    \"(Non-Contextual Glyph Substitution)\" );\r\n\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_mort_subtable_type4_lookupval_validate;\r\n    valid->lookupfmt4_trans = gxv_mort_subtable_type4_lookupfmt4_transit;\r\n\r\n    gxv_LookupTable_validate( p, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmort5.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmort5.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT mort table validation                                 */\r\n/*    body for type5 (Contextual Glyph Insertion) subtable.                */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmort.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmort\r\n\r\n\r\n  /*\r\n   * mort subtable type5 (Contextual Glyph Insertion)\r\n   * has the format of StateTable with insertion-glyph-list,\r\n   * but without name.  The offset is given by glyphOffset in\r\n   * entryTable.  There is no table location declaration\r\n   * like xxxTable.\r\n   */\r\n\r\n  typedef struct  GXV_mort_subtable_type5_StateOptRec_\r\n  {\r\n    FT_UShort   classTable;\r\n    FT_UShort   stateArray;\r\n    FT_UShort   entryTable;\r\n\r\n#define GXV_MORT_SUBTABLE_TYPE5_HEADER_SIZE  GXV_STATETABLE_HEADER_SIZE\r\n\r\n    FT_UShort*  classTable_length_p;\r\n    FT_UShort*  stateArray_length_p;\r\n    FT_UShort*  entryTable_length_p;\r\n\r\n  }  GXV_mort_subtable_type5_StateOptRec,\r\n    *GXV_mort_subtable_type5_StateOptRecData;\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_subtable_type5_subtable_setup( FT_UShort      table_size,\r\n                                          FT_UShort      classTable,\r\n                                          FT_UShort      stateArray,\r\n                                          FT_UShort      entryTable,\r\n                                          FT_UShort*     classTable_length_p,\r\n                                          FT_UShort*     stateArray_length_p,\r\n                                          FT_UShort*     entryTable_length_p,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    GXV_mort_subtable_type5_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type5_StateOptRecData)valid->statetable.optdata;\r\n\r\n\r\n    gxv_StateTable_subtable_setup( table_size,\r\n                                   classTable,\r\n                                   stateArray,\r\n                                   entryTable,\r\n                                   classTable_length_p,\r\n                                   stateArray_length_p,\r\n                                   entryTable_length_p,\r\n                                   valid );\r\n\r\n    optdata->classTable = classTable;\r\n    optdata->stateArray = stateArray;\r\n    optdata->entryTable = entryTable;\r\n\r\n    optdata->classTable_length_p = classTable_length_p;\r\n    optdata->stateArray_length_p = stateArray_length_p;\r\n    optdata->entryTable_length_p = entryTable_length_p;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type5_InsertList_validate( FT_UShort      offset,\r\n                                               FT_UShort      count,\r\n                                               FT_Bytes       table,\r\n                                               FT_Bytes       limit,\r\n                                               GXV_Validator  valid )\r\n  {\r\n    /*\r\n     * We don't know the range of insertion-glyph-list.\r\n     * Set range by whole of state table.\r\n     */\r\n    FT_Bytes  p = table + offset;\r\n\r\n    GXV_mort_subtable_type5_StateOptRecData  optdata =\r\n      (GXV_mort_subtable_type5_StateOptRecData)valid->statetable.optdata;\r\n\r\n    if ( optdata->classTable < offset                                   &&\r\n         offset < optdata->classTable + *(optdata->classTable_length_p) )\r\n      GXV_TRACE(( \" offset runs into ClassTable\" ));\r\n    if ( optdata->stateArray < offset                                   &&\r\n         offset < optdata->stateArray + *(optdata->stateArray_length_p) )\r\n      GXV_TRACE(( \" offset runs into StateArray\" ));\r\n    if ( optdata->entryTable < offset                                   &&\r\n         offset < optdata->entryTable + *(optdata->entryTable_length_p) )\r\n      GXV_TRACE(( \" offset runs into EntryTable\" ));\r\n\r\n#ifndef GXV_LOAD_TRACE_VARS\r\n    GXV_LIMIT_CHECK( count * 2 );\r\n#else\r\n    while ( p < table + offset + ( count * 2 ) )\r\n    {\r\n      FT_UShort insert_glyphID;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 );\r\n      insert_glyphID = FT_NEXT_USHORT( p );\r\n      GXV_TRACE(( \" 0x%04x\", insert_glyphID ));\r\n    }\r\n    GXV_TRACE(( \"\\n\" ));\r\n#endif\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_mort_subtable_type5_entry_validate(\r\n    FT_Byte                         state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_Bool    setMark;\r\n    FT_Bool    dontAdvance;\r\n    FT_Bool    currentIsKashidaLike;\r\n    FT_Bool    markedIsKashidaLike;\r\n    FT_Bool    currentInsertBefore;\r\n    FT_Bool    markedInsertBefore;\r\n#endif\r\n    FT_Byte    currentInsertCount;\r\n    FT_Byte    markedInsertCount;\r\n    FT_UShort  currentInsertList;\r\n    FT_UShort  markedInsertList;\r\n\r\n    FT_UNUSED( state );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    setMark              = FT_BOOL( ( flags >> 15 ) & 1 );\r\n    dontAdvance          = FT_BOOL( ( flags >> 14 ) & 1 );\r\n    currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 );\r\n    markedIsKashidaLike  = FT_BOOL( ( flags >> 12 ) & 1 );\r\n    currentInsertBefore  = FT_BOOL( ( flags >> 11 ) & 1 );\r\n    markedInsertBefore   = FT_BOOL( ( flags >> 10 ) & 1 );\r\n#endif\r\n\r\n    currentInsertCount   = (FT_Byte)( ( flags >> 5 ) & 0x1F   );\r\n    markedInsertCount    = (FT_Byte)(   flags        & 0x001F );\r\n\r\n    currentInsertList    = (FT_UShort)( glyphOffset->ul >> 16 );\r\n    markedInsertList     = (FT_UShort)( glyphOffset->ul       );\r\n\r\n    if ( 0 != currentInsertList && 0 != currentInsertCount )\r\n    {\r\n      gxv_mort_subtable_type5_InsertList_validate( currentInsertList,\r\n                                                   currentInsertCount,\r\n                                                   table,\r\n                                                   limit,\r\n                                                   valid );\r\n    }\r\n\r\n    if ( 0 != markedInsertList && 0 != markedInsertCount )\r\n    {\r\n      gxv_mort_subtable_type5_InsertList_validate( markedInsertList,\r\n                                                   markedInsertCount,\r\n                                                   table,\r\n                                                   limit,\r\n                                                   valid );\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_mort_subtable_type5_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_mort_subtable_type5_StateOptRec      et_rec;\r\n    GXV_mort_subtable_type5_StateOptRecData  et = &et_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"mort chain subtable type5 (Glyph Insertion)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE5_HEADER_SIZE );\r\n\r\n    valid->statetable.optdata =\r\n      et;\r\n    valid->statetable.optdata_load_func =\r\n      NULL;\r\n    valid->statetable.subtable_setup_func =\r\n      gxv_mort_subtable_type5_subtable_setup;\r\n    valid->statetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_ULONG;\r\n    valid->statetable.entry_validate_func =\r\n      gxv_mort_subtable_type5_entry_validate;\r\n\r\n    gxv_StateTable_validate( p, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT morx table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2008 by                                                */\r\n/*  suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmorx.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmorx\r\n\r\n\r\n  static void\r\n  gxv_morx_subtables_validate( FT_Bytes       table,\r\n                               FT_Bytes       limit,\r\n                               FT_UShort      nSubtables,\r\n                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_Validate_Func fmt_funcs_table[] =\r\n    {\r\n      gxv_morx_subtable_type0_validate, /* 0 */\r\n      gxv_morx_subtable_type1_validate, /* 1 */\r\n      gxv_morx_subtable_type2_validate, /* 2 */\r\n      NULL,                             /* 3 */\r\n      gxv_morx_subtable_type4_validate, /* 4 */\r\n      gxv_morx_subtable_type5_validate, /* 5 */\r\n\r\n    };\r\n\r\n    GXV_Validate_Func  func;\r\n\r\n    FT_UShort  i;\r\n\r\n\r\n    GXV_NAME_ENTER( \"subtables in a chain\" );\r\n\r\n    for ( i = 0; i < nSubtables; i++ )\r\n    {\r\n      FT_ULong  length;\r\n      FT_ULong  coverage;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      FT_ULong  subFeatureFlags;\r\n#endif\r\n      FT_ULong  type;\r\n      FT_ULong  rest;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 4 + 4 + 4 );\r\n      length          = FT_NEXT_ULONG( p );\r\n      coverage        = FT_NEXT_ULONG( p );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      subFeatureFlags = FT_NEXT_ULONG( p );\r\n#else\r\n      p += 4;\r\n#endif\r\n\r\n      GXV_TRACE(( \"validating chain subtable %d/%d (%d bytes)\\n\",\r\n                  i + 1, nSubtables, length ));\r\n\r\n      type = coverage & 0x0007;\r\n      rest = length - ( 4 + 4 + 4 );\r\n      GXV_LIMIT_CHECK( rest );\r\n\r\n      /* morx coverage consists of mort_coverage & 16bit padding */\r\n      gxv_mort_coverage_validate( (FT_UShort)( ( coverage >> 16 ) | coverage ),\r\n                                  valid );\r\n      if ( type > 5 )\r\n        FT_INVALID_FORMAT;\r\n\r\n      func = fmt_funcs_table[type];\r\n      if ( func == NULL )\r\n        GXV_TRACE(( \"morx type %d is reserved\\n\", type ));\r\n\r\n      func( p, p + rest, valid );\r\n\r\n      /* TODO: subFeatureFlags should be unique in a table? */\r\n      p += rest;\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_chain_validate( FT_Bytes       table,\r\n                           FT_Bytes       limit,\r\n                           GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_ULong  defaultFlags;\r\n#endif\r\n    FT_ULong  chainLength;\r\n    FT_ULong  nFeatureFlags;\r\n    FT_ULong  nSubtables;\r\n\r\n\r\n    GXV_NAME_ENTER( \"morx chain header\" );\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    defaultFlags  = FT_NEXT_ULONG( p );\r\n#else\r\n    p += 4;\r\n#endif\r\n    chainLength   = FT_NEXT_ULONG( p );\r\n    nFeatureFlags = FT_NEXT_ULONG( p );\r\n    nSubtables    = FT_NEXT_ULONG( p );\r\n\r\n    /* feature-array of morx is same with that of mort */\r\n    gxv_mort_featurearray_validate( p, limit, nFeatureFlags, valid );\r\n    p += valid->subtable_length;\r\n\r\n    if ( nSubtables >= 0x10000L )\r\n      FT_INVALID_DATA;\r\n\r\n    gxv_morx_subtables_validate( p, table + chainLength,\r\n                                 (FT_UShort)nSubtables, valid );\r\n\r\n    valid->subtable_length = chainLength;\r\n\r\n    /* TODO: defaultFlags should be compared with the flags in tables */\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_morx_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_Bytes          limit = 0;\r\n    FT_ULong          version;\r\n    FT_ULong          nChains;\r\n    FT_ULong          i;\r\n\r\n\r\n    valid->root = ftvalid;\r\n    valid->face = face;\r\n\r\n    FT_TRACE3(( \"validating `morx' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 );\r\n    version = FT_NEXT_ULONG( p );\r\n    nChains = FT_NEXT_ULONG( p );\r\n\r\n    if ( version != 0x00020000UL )\r\n      FT_INVALID_FORMAT;\r\n\r\n    for ( i = 0; i < nChains; i++ )\r\n    {\r\n      GXV_TRACE(( \"validating chain %d/%d\\n\", i + 1, nChains ));\r\n      GXV_32BIT_ALIGNMENT_VALIDATE( p - table );\r\n      gxv_morx_chain_validate( p, limit, valid );\r\n      p += valid->subtable_length;\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx.h                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT common definition for morx table (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __GXVMORX_H__\r\n#define __GXVMORX_H__\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n#include \"gxvmort.h\"\r\n\r\n#include FT_SFNT_NAMES_H\r\n\r\n\r\n  FT_LOCAL( void )\r\n  gxv_morx_subtable_type0_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_morx_subtable_type1_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_morx_subtable_type2_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_morx_subtable_type4_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  gxv_morx_subtable_type5_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid );\r\n\r\n\r\n#endif /* __GXVMORX_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx0.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx0.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT morx table validation                                 */\r\n/*    body for type0 (Indic Script Rearrangement) subtable.                */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmorx.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmorx\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type0_entry_validate(\r\n    FT_UShort                        state,\r\n    FT_UShort                        flags,\r\n    GXV_XStateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                         table,\r\n    FT_Bytes                         limit,\r\n    GXV_Validator                    valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  markFirst;\r\n    FT_UShort  dontAdvance;\r\n    FT_UShort  markLast;\r\n#endif\r\n    FT_UShort  reserved;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  verb;\r\n#endif\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( glyphOffset_p );\r\n    FT_UNUSED( table );\r\n    FT_UNUSED( limit );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    markFirst   = (FT_UShort)( ( flags >> 15 ) & 1 );\r\n    dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );\r\n    markLast    = (FT_UShort)( ( flags >> 13 ) & 1 );\r\n#endif\r\n\r\n    reserved = (FT_UShort)( flags & 0x1FF0 );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    verb     = (FT_UShort)( flags & 0x000F );\r\n#endif\r\n\r\n    if ( 0 < reserved )\r\n    {\r\n      GXV_TRACE(( \" non-zero bits found in reserved range\\n\" ));\r\n      FT_INVALID_DATA;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_morx_subtable_type0_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    GXV_NAME_ENTER(\r\n      \"morx chain subtable type0 (Indic-Script Rearrangement)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );\r\n\r\n    valid->xstatetable.optdata               = NULL;\r\n    valid->xstatetable.optdata_load_func     = NULL;\r\n    valid->xstatetable.subtable_setup_func   = NULL;\r\n    valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;\r\n    valid->xstatetable.entry_validate_func =\r\n      gxv_morx_subtable_type0_entry_validate;\r\n\r\n    gxv_XStateTable_validate( p, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx1.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx1.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT morx table validation                                 */\r\n/*    body for type1 (Contextual Substitution) subtable.                   */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2007 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmorx.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmorx\r\n\r\n\r\n  typedef struct  GXV_morx_subtable_type1_StateOptRec_\r\n  {\r\n    FT_ULong   substitutionTable;\r\n    FT_ULong   substitutionTable_length;\r\n    FT_UShort  substitutionTable_num_lookupTables;\r\n\r\n  }  GXV_morx_subtable_type1_StateOptRec,\r\n    *GXV_morx_subtable_type1_StateOptRecData;\r\n\r\n\r\n#define GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE \\\r\n          ( GXV_STATETABLE_HEADER_SIZE + 2 )\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type1_substitutionTable_load( FT_Bytes       table,\r\n                                                  FT_Bytes       limit,\r\n                                                  GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_morx_subtable_type1_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 2 );\r\n    optdata->substitutionTable = FT_NEXT_USHORT( p );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type1_subtable_setup( FT_ULong       table_size,\r\n                                          FT_ULong       classTable,\r\n                                          FT_ULong       stateArray,\r\n                                          FT_ULong       entryTable,\r\n                                          FT_ULong*      classTable_length_p,\r\n                                          FT_ULong*      stateArray_length_p,\r\n                                          FT_ULong*      entryTable_length_p,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_ULong  o[4];\r\n    FT_ULong  *l[4];\r\n    FT_ULong  buff[5];\r\n\r\n    GXV_morx_subtable_type1_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    o[3] = optdata->substitutionTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n    l[3] = &(optdata->substitutionTable_length);\r\n\r\n    gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type1_entry_validate(\r\n    FT_UShort                       state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    FT_UShort  setMark;\r\n    FT_UShort  dontAdvance;\r\n#endif\r\n    FT_UShort  reserved;\r\n    FT_Short   markIndex;\r\n    FT_Short   currentIndex;\r\n\r\n    GXV_morx_subtable_type1_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( table );\r\n    FT_UNUSED( limit );\r\n\r\n\r\n#ifdef GXV_LOAD_TRACE_VARS\r\n    setMark      = (FT_UShort)( ( flags >> 15 ) & 1 );\r\n    dontAdvance  = (FT_UShort)( ( flags >> 14 ) & 1 );\r\n#endif\r\n\r\n    reserved = (FT_UShort)( flags & 0x3FFF );\r\n\r\n    markIndex    = (FT_Short)( glyphOffset_p->ul >> 16 );\r\n    currentIndex = (FT_Short)( glyphOffset_p->ul       );\r\n\r\n    GXV_TRACE(( \" setMark=%01d dontAdvance=%01d\\n\",\r\n                setMark, dontAdvance ));\r\n\r\n    if ( 0 < reserved )\r\n    {\r\n      GXV_TRACE(( \" non-zero bits found in reserved range\\n\" ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );\r\n    }\r\n\r\n    GXV_TRACE(( \"markIndex = %d, currentIndex = %d\\n\",\r\n                markIndex, currentIndex ));\r\n\r\n    if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )\r\n      optdata->substitutionTable_num_lookupTables =\r\n        (FT_Short)( markIndex + 1 );\r\n\r\n    if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )\r\n      optdata->substitutionTable_num_lookupTables =\r\n        (FT_Short)( currentIndex + 1 );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type1_LookupValue_validate( FT_UShort            glyph,\r\n                                                GXV_LookupValueCPtr  value_p,\r\n                                                GXV_Validator        valid )\r\n  {\r\n    FT_UNUSED( glyph ); /* for the non-debugging case */\r\n\r\n    GXV_TRACE(( \"morx subtable type1 subst.: %d -> %d\\n\", glyph, value_p->u ));\r\n\r\n    if ( value_p->u > valid->face->num_glyphs )\r\n      FT_INVALID_GLYPH_ID;\r\n  }\r\n\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_morx_subtable_type1_LookupFmt4_transit(\r\n    FT_UShort            relative_gindex,\r\n    GXV_LookupValueCPtr  base_value_p,\r\n    FT_Bytes             lookuptbl_limit,\r\n    GXV_Validator        valid )\r\n  {\r\n    FT_Bytes             p;\r\n    FT_Bytes             limit;\r\n    FT_UShort            offset;\r\n    GXV_LookupValueDesc  value;\r\n\r\n    /* XXX: check range? */\r\n    offset = (FT_UShort)( base_value_p->u +\r\n                          relative_gindex * sizeof ( FT_UShort ) );\r\n\r\n    p     = valid->lookuptbl_head + offset;\r\n    limit = lookuptbl_limit;\r\n\r\n    GXV_LIMIT_CHECK ( 2 );\r\n    value.u = FT_NEXT_USHORT( p );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  /*\r\n   * TODO: length should be limit?\r\n   **/\r\n  static void\r\n  gxv_morx_subtable_type1_substitutionTable_validate( FT_Bytes       table,\r\n                                                      FT_Bytes       limit,\r\n                                                      GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  i;\r\n\r\n    GXV_morx_subtable_type1_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    /* TODO: calculate offset/length for each lookupTables */\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_morx_subtable_type1_LookupValue_validate;\r\n    valid->lookupfmt4_trans = gxv_morx_subtable_type1_LookupFmt4_transit;\r\n\r\n    for ( i = 0; i < optdata->substitutionTable_num_lookupTables; i++ )\r\n    {\r\n      FT_ULong  offset;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 4 );\r\n      offset = FT_NEXT_ULONG( p );\r\n\r\n      gxv_LookupTable_validate( table + offset, limit, valid );\r\n    }\r\n\r\n    /* TODO: overlapping of lookupTables in substitutionTable */\r\n  }\r\n\r\n\r\n  /*\r\n   * subtable for Contextual glyph substitution is a modified StateTable.\r\n   * In addition to classTable, stateArray, entryTable, the field\r\n   * `substitutionTable' is added.\r\n   */\r\n  FT_LOCAL_DEF( void )\r\n  gxv_morx_subtable_type1_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_morx_subtable_type1_StateOptRec  st_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"morx chain subtable type1 (Contextual Glyph Subst)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE );\r\n\r\n    st_rec.substitutionTable_num_lookupTables = 0;\r\n\r\n    valid->xstatetable.optdata =\r\n      &st_rec;\r\n    valid->xstatetable.optdata_load_func =\r\n      gxv_morx_subtable_type1_substitutionTable_load;\r\n    valid->xstatetable.subtable_setup_func =\r\n      gxv_morx_subtable_type1_subtable_setup;\r\n    valid->xstatetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_ULONG;\r\n    valid->xstatetable.entry_validate_func =\r\n      gxv_morx_subtable_type1_entry_validate;\r\n\r\n    gxv_XStateTable_validate( p, limit, valid );\r\n\r\n    gxv_morx_subtable_type1_substitutionTable_validate(\r\n      table + st_rec.substitutionTable,\r\n      table + st_rec.substitutionTable + st_rec.substitutionTable_length,\r\n      valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx2.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx2.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT morx table validation                                 */\r\n/*    body for type2 (Ligature Substitution) subtable.                     */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmorx.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmorx\r\n\r\n\r\n  typedef struct  GXV_morx_subtable_type2_StateOptRec_\r\n  {\r\n    FT_ULong  ligActionTable;\r\n    FT_ULong  componentTable;\r\n    FT_ULong  ligatureTable;\r\n    FT_ULong  ligActionTable_length;\r\n    FT_ULong  componentTable_length;\r\n    FT_ULong  ligatureTable_length;\r\n\r\n  }  GXV_morx_subtable_type2_StateOptRec,\r\n    *GXV_morx_subtable_type2_StateOptRecData;\r\n\r\n\r\n#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE \\\r\n          ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type2_opttable_load( FT_Bytes       table,\r\n                                         FT_Bytes       limit,\r\n                                         GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_morx_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 4 + 4 );\r\n    optdata->ligActionTable = FT_NEXT_ULONG( p );\r\n    optdata->componentTable = FT_NEXT_ULONG( p );\r\n    optdata->ligatureTable  = FT_NEXT_ULONG( p );\r\n\r\n    GXV_TRACE(( \"offset to ligActionTable=0x%08x\\n\",\r\n                optdata->ligActionTable ));\r\n    GXV_TRACE(( \"offset to componentTable=0x%08x\\n\",\r\n                optdata->componentTable ));\r\n    GXV_TRACE(( \"offset to ligatureTable=0x%08x\\n\",\r\n                optdata->ligatureTable ));\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type2_subtable_setup( FT_ULong       table_size,\r\n                                          FT_ULong       classTable,\r\n                                          FT_ULong       stateArray,\r\n                                          FT_ULong       entryTable,\r\n                                          FT_ULong*      classTable_length_p,\r\n                                          FT_ULong*      stateArray_length_p,\r\n                                          FT_ULong*      entryTable_length_p,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_ULong   o[6];\r\n    FT_ULong*  l[6];\r\n    FT_ULong   buff[7];\r\n\r\n    GXV_morx_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    GXV_NAME_ENTER( \"subtable boundaries setup\" );\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    o[3] = optdata->ligActionTable;\r\n    o[4] = optdata->componentTable;\r\n    o[5] = optdata->ligatureTable;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n    l[3] = &(optdata->ligActionTable_length);\r\n    l[4] = &(optdata->componentTable_length);\r\n    l[5] = &(optdata->ligatureTable_length);\r\n\r\n    gxv_set_length_by_ulong_offset( o, l, buff, 6, table_size, valid );\r\n\r\n    GXV_TRACE(( \"classTable: offset=0x%08x length=0x%08x\\n\",\r\n                classTable, *classTable_length_p ));\r\n    GXV_TRACE(( \"stateArray: offset=0x%08x length=0x%08x\\n\",\r\n                stateArray, *stateArray_length_p ));\r\n    GXV_TRACE(( \"entryTable: offset=0x%08x length=0x%08x\\n\",\r\n                entryTable, *entryTable_length_p ));\r\n    GXV_TRACE(( \"ligActionTable: offset=0x%08x length=0x%08x\\n\",\r\n                optdata->ligActionTable,\r\n                optdata->ligActionTable_length ));\r\n    GXV_TRACE(( \"componentTable: offset=0x%08x length=0x%08x\\n\",\r\n                optdata->componentTable,\r\n                optdata->componentTable_length ));\r\n    GXV_TRACE(( \"ligatureTable:  offset=0x%08x length=0x%08x\\n\",\r\n                optdata->ligatureTable,\r\n                optdata->ligatureTable_length ));\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n#define GXV_MORX_LIGACTION_ENTRY_SIZE  4\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type2_ligActionIndex_validate(\r\n    FT_Bytes       table,\r\n    FT_UShort      ligActionIndex,\r\n    GXV_Validator  valid )\r\n  {\r\n    /* access ligActionTable */\r\n    GXV_morx_subtable_type2_StateOptRecData optdata =\r\n      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n    FT_Bytes lat_base  = table + optdata->ligActionTable;\r\n    FT_Bytes p         = lat_base +\r\n                         ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE;\r\n    FT_Bytes lat_limit = lat_base + optdata->ligActionTable;\r\n\r\n\r\n    if ( p < lat_base )\r\n    {\r\n      GXV_TRACE(( \"p < lat_base (%d byte rewind)\\n\", lat_base - p ));\r\n      FT_INVALID_OFFSET;\r\n    }\r\n    else if ( lat_limit < p )\r\n    {\r\n      GXV_TRACE(( \"lat_limit < p (%d byte overrun)\\n\", p - lat_limit ));\r\n      FT_INVALID_OFFSET;\r\n    }\r\n\r\n    {\r\n      /* validate entry in ligActionTable */\r\n      FT_ULong   lig_action;\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      FT_UShort  last;\r\n      FT_UShort  store;\r\n#endif\r\n      FT_ULong   offset;\r\n      FT_Long    gid_limit;\r\n\r\n\r\n      lig_action = FT_NEXT_ULONG( p );\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n      last       = (FT_UShort)( ( lig_action >> 31 ) & 1 );\r\n      store      = (FT_UShort)( ( lig_action >> 30 ) & 1 );\r\n#endif\r\n\r\n      offset = lig_action & 0x3FFFFFFFUL;\r\n\r\n      /* this offset is 30-bit signed value to add to GID */\r\n      /* it is different from the location offset in mort */\r\n      if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL )\r\n      { /* negative offset */\r\n        gid_limit = valid->face->num_glyphs - ( offset & 0x0000FFFFUL );\r\n        if ( gid_limit > 0 )\r\n          return;\r\n\r\n        GXV_TRACE(( \"ligature action table includes\"\r\n                    \" too negative offset moving all GID\"\r\n                    \" below defined range: 0x%04x\\n\",\r\n                    offset & 0xFFFFU ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n      }\r\n      else if ( ( offset & 0x3FFF0000UL ) == 0x0000000UL )\r\n      { /* positive offset */\r\n        if ( (FT_Long)offset < valid->face->num_glyphs )\r\n          return;\r\n\r\n        GXV_TRACE(( \"ligature action table includes\"\r\n                    \" too large offset moving all GID\"\r\n                    \" over defined range: 0x%04x\\n\",\r\n                    offset & 0xFFFFU ));\r\n        GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n      }\r\n\r\n      GXV_TRACE(( \"ligature action table includes\"\r\n                  \" invalid offset to add to 16-bit GID:\"\r\n                  \" 0x%08x\\n\", offset ));\r\n      GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type2_entry_validate(\r\n    FT_UShort                       state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_UShort  setComponent;\r\n    FT_UShort  dontAdvance;\r\n    FT_UShort  performAction;\r\n#endif\r\n    FT_UShort  reserved;\r\n    FT_UShort  ligActionIndex;\r\n\r\n    FT_UNUSED( state );\r\n    FT_UNUSED( limit );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    setComponent   = (FT_UShort)( ( flags >> 15 ) & 1 );\r\n    dontAdvance    = (FT_UShort)( ( flags >> 14 ) & 1 );\r\n    performAction  = (FT_UShort)( ( flags >> 13 ) & 1 );\r\n#endif\r\n\r\n    reserved       = (FT_UShort)( flags & 0x1FFF );\r\n    ligActionIndex = glyphOffset_p->u;\r\n\r\n    if ( reserved > 0 )\r\n      GXV_TRACE(( \"  reserved 14bit is non-zero\\n\" ));\r\n\r\n    if ( 0 < ligActionIndex )\r\n      gxv_morx_subtable_type2_ligActionIndex_validate(\r\n        table, ligActionIndex, valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type2_ligatureTable_validate( FT_Bytes       table,\r\n                                                  GXV_Validator  valid )\r\n  {\r\n    GXV_morx_subtable_type2_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n    FT_Bytes p     = table + optdata->ligatureTable;\r\n    FT_Bytes limit = table + optdata->ligatureTable\r\n                           + optdata->ligatureTable_length;\r\n\r\n\r\n    GXV_NAME_ENTER( \"morx chain subtable type2 - substitutionTable\" );\r\n\r\n    if ( 0 != optdata->ligatureTable )\r\n    {\r\n      /* Apple does not give specification of ligatureTable format */\r\n      while ( p < limit )\r\n      {\r\n        FT_UShort  lig_gid;\r\n\r\n\r\n        GXV_LIMIT_CHECK( 2 );\r\n        lig_gid = FT_NEXT_USHORT( p );\r\n        if ( lig_gid < valid->face->num_glyphs )\r\n          GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );\r\n      }\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_morx_subtable_type2_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_morx_subtable_type2_StateOptRec  lig_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"morx chain subtable type2 (Ligature Substitution)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE );\r\n\r\n    valid->xstatetable.optdata =\r\n      &lig_rec;\r\n    valid->xstatetable.optdata_load_func =\r\n      gxv_morx_subtable_type2_opttable_load;\r\n    valid->xstatetable.subtable_setup_func =\r\n      gxv_morx_subtable_type2_subtable_setup;\r\n    valid->xstatetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_USHORT;\r\n    valid->xstatetable.entry_validate_func =\r\n      gxv_morx_subtable_type2_entry_validate;\r\n\r\n    gxv_XStateTable_validate( p, limit, valid );\r\n\r\n    p += valid->subtable_length;\r\n    gxv_morx_subtable_type2_ligatureTable_validate( table, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx4.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx4.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT morx table validation                                 */\r\n/*    body for \"morx\" type4 (Non-Contextual Glyph Substitution) subtable.  */\r\n/*                                                                         */\r\n/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmorx.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmorx\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_morx_subtable_type4_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    GXV_NAME_ENTER( \"morx chain subtable type4 \"\r\n                    \"(Non-Contextual Glyph Substitution)\" );\r\n\r\n    gxv_mort_subtable_type4_validate( table, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvmorx5.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvmorx5.c                                                             */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT morx table validation                                 */\r\n/*    body for type5 (Contextual Glyph Insertion) subtable.                */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2007 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvmorx.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvmorx\r\n\r\n\r\n  /*\r\n   * `morx' subtable type5 (Contextual Glyph Insertion)\r\n   * has format of a StateTable with insertion-glyph-list\r\n   * without name.  However, the 32bit offset from the head\r\n   * of subtable to the i-g-l is given after `entryTable',\r\n   * without variable name specification (the existence of\r\n   * this offset to the table is different from mort type5).\r\n   */\r\n\r\n\r\n  typedef struct  GXV_morx_subtable_type5_StateOptRec_\r\n  {\r\n    FT_ULong  insertionGlyphList;\r\n    FT_ULong  insertionGlyphList_length;\r\n\r\n  }  GXV_morx_subtable_type5_StateOptRec,\r\n    *GXV_morx_subtable_type5_StateOptRecData;\r\n\r\n\r\n#define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \\\r\n          ( GXV_STATETABLE_HEADER_SIZE + 4 )\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes       table,\r\n                                                   FT_Bytes       limit,\r\n                                                   GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_morx_subtable_type5_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 );\r\n    optdata->insertionGlyphList = FT_NEXT_ULONG( p );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type5_subtable_setup( FT_ULong       table_size,\r\n                                          FT_ULong       classTable,\r\n                                          FT_ULong       stateArray,\r\n                                          FT_ULong       entryTable,\r\n                                          FT_ULong*      classTable_length_p,\r\n                                          FT_ULong*      stateArray_length_p,\r\n                                          FT_ULong*      entryTable_length_p,\r\n                                          GXV_Validator  valid )\r\n  {\r\n    FT_ULong   o[4];\r\n    FT_ULong*  l[4];\r\n    FT_ULong   buff[5];\r\n\r\n    GXV_morx_subtable_type5_StateOptRecData  optdata =\r\n      (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;\r\n\r\n\r\n    o[0] = classTable;\r\n    o[1] = stateArray;\r\n    o[2] = entryTable;\r\n    o[3] = optdata->insertionGlyphList;\r\n    l[0] = classTable_length_p;\r\n    l[1] = stateArray_length_p;\r\n    l[2] = entryTable_length_p;\r\n    l[3] = &(optdata->insertionGlyphList_length);\r\n\r\n    gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid );\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type5_InsertList_validate( FT_UShort      table_index,\r\n                                               FT_UShort      count,\r\n                                               FT_Bytes       table,\r\n                                               FT_Bytes       limit,\r\n                                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes p = table + table_index * 2;\r\n\r\n\r\n#ifndef GXV_LOAD_TRACE_VARS\r\n    GXV_LIMIT_CHECK( count * 2 );\r\n#else\r\n    while ( p < table + count * 2 + table_index * 2 )\r\n    {\r\n      FT_UShort  insert_glyphID;\r\n\r\n\r\n      GXV_LIMIT_CHECK( 2 );\r\n      insert_glyphID = FT_NEXT_USHORT( p );\r\n      GXV_TRACE(( \" 0x%04x\", insert_glyphID ));\r\n    }\r\n\r\n    GXV_TRACE(( \"\\n\" ));\r\n#endif\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_morx_subtable_type5_entry_validate(\r\n    FT_UShort                       state,\r\n    FT_UShort                       flags,\r\n    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,\r\n    FT_Bytes                        table,\r\n    FT_Bytes                        limit,\r\n    GXV_Validator                   valid )\r\n  {\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    FT_Bool    setMark;\r\n    FT_Bool    dontAdvance;\r\n    FT_Bool    currentIsKashidaLike;\r\n    FT_Bool    markedIsKashidaLike;\r\n    FT_Bool    currentInsertBefore;\r\n    FT_Bool    markedInsertBefore;\r\n#endif\r\n    FT_Byte    currentInsertCount;\r\n    FT_Byte    markedInsertCount;\r\n    FT_Byte    currentInsertList;\r\n    FT_UShort  markedInsertList;\r\n\r\n    FT_UNUSED( state );\r\n\r\n\r\n#ifdef GXV_LOAD_UNUSED_VARS\r\n    setMark              = FT_BOOL( ( flags >> 15 ) & 1 );\r\n    dontAdvance          = FT_BOOL( ( flags >> 14 ) & 1 );\r\n    currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 );\r\n    markedIsKashidaLike  = FT_BOOL( ( flags >> 12 ) & 1 );\r\n    currentInsertBefore  = FT_BOOL( ( flags >> 11 ) & 1 );\r\n    markedInsertBefore   = FT_BOOL( ( flags >> 10 ) & 1 );\r\n#endif\r\n\r\n    currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F   );\r\n    markedInsertCount  = (FT_Byte)(   flags        & 0x001F );\r\n\r\n    currentInsertList = (FT_Byte)  ( glyphOffset_p->ul >> 16 );\r\n    markedInsertList  = (FT_UShort)( glyphOffset_p->ul       );\r\n\r\n    if ( currentInsertList && 0 != currentInsertCount )\r\n      gxv_morx_subtable_type5_InsertList_validate( currentInsertList,\r\n                                                   currentInsertCount,\r\n                                                   table, limit,\r\n                                                   valid );\r\n\r\n    if ( markedInsertList && 0 != markedInsertCount )\r\n      gxv_morx_subtable_type5_InsertList_validate( markedInsertList,\r\n                                                   markedInsertCount,\r\n                                                   table, limit,\r\n                                                   valid );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_morx_subtable_type5_validate( FT_Bytes       table,\r\n                                    FT_Bytes       limit,\r\n                                    GXV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n    GXV_morx_subtable_type5_StateOptRec      et_rec;\r\n    GXV_morx_subtable_type5_StateOptRecData  et = &et_rec;\r\n\r\n\r\n    GXV_NAME_ENTER( \"morx chain subtable type5 (Glyph Insertion)\" );\r\n\r\n    GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );\r\n\r\n    valid->xstatetable.optdata =\r\n      et;\r\n    valid->xstatetable.optdata_load_func =\r\n      gxv_morx_subtable_type5_insertionGlyphList_load;\r\n    valid->xstatetable.subtable_setup_func =\r\n      gxv_morx_subtable_type5_subtable_setup;\r\n    valid->xstatetable.entry_glyphoffset_fmt =\r\n      GXV_GLYPHOFFSET_ULONG;\r\n    valid->xstatetable.entry_validate_func =\r\n      gxv_morx_subtable_type5_entry_validate;\r\n\r\n    gxv_XStateTable_validate( p, limit, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvopbd.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvopbd.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT opbd table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvopbd\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  GXV_opbd_DataRec_\r\n  {\r\n    FT_UShort  format;\r\n    FT_UShort  valueOffset_min;\r\n\r\n  } GXV_opbd_DataRec, *GXV_opbd_Data;\r\n\r\n\r\n#define GXV_OPBD_DATA( FIELD )  GXV_TABLE_DATA( opbd, FIELD )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_opbd_LookupValue_validate( FT_UShort            glyph,\r\n                                 GXV_LookupValueCPtr  value_p,\r\n                                 GXV_Validator        valid )\r\n  {\r\n    /* offset in LookupTable is measured from the head of opbd table */\r\n    FT_Bytes   p     = valid->root->base + value_p->u;\r\n    FT_Bytes   limit = valid->root->limit;\r\n    FT_Short   delta_value;\r\n    int        i;\r\n\r\n\r\n    if ( value_p->u < GXV_OPBD_DATA( valueOffset_min ) )\r\n      GXV_OPBD_DATA( valueOffset_min ) = value_p->u;\r\n\r\n    for ( i = 0; i < 4; i++ )\r\n    {\r\n      GXV_LIMIT_CHECK( 2 );\r\n      delta_value = FT_NEXT_SHORT( p );\r\n\r\n      if ( GXV_OPBD_DATA( format ) )    /* format 1, value is ctrl pt. */\r\n      {\r\n        if ( delta_value == -1 )\r\n          continue;\r\n\r\n        gxv_ctlPoint_validate( glyph, delta_value, valid );\r\n      }\r\n      else                              /* format 0, value is distance */\r\n        continue;\r\n    }\r\n  }\r\n\r\n\r\n  /*\r\n    opbd ---------------------+\r\n                              |\r\n    +===============+         |\r\n    | lookup header |         |\r\n    +===============+         |\r\n    | BinSrchHeader |         |\r\n    +===============+         |\r\n    | lastGlyph[0]  |         |\r\n    +---------------+         |\r\n    | firstGlyph[0] |         |  head of opbd sfnt table\r\n    +---------------+         |             +\r\n    | offset[0]     |    ->   |          offset            [byte]\r\n    +===============+         |             +\r\n    | lastGlyph[1]  |         | (glyphID - firstGlyph) * 4 * sizeof(FT_Short) [byte]\r\n    +---------------+         |\r\n    | firstGlyph[1] |         |\r\n    +---------------+         |\r\n    | offset[1]     |         |\r\n    +===============+         |\r\n                              |\r\n     ....                     |\r\n                              |\r\n    48bit value array         |\r\n    +===============+         |\r\n    |     value     | <-------+\r\n    |               |\r\n    |               |\r\n    |               |\r\n    +---------------+\r\n    .... */\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_opbd_LookupFmt4_transit( FT_UShort            relative_gindex,\r\n                               GXV_LookupValueCPtr  base_value_p,\r\n                               FT_Bytes             lookuptbl_limit,\r\n                               GXV_Validator        valid )\r\n  {\r\n    GXV_LookupValueDesc  value;\r\n\r\n    FT_UNUSED( lookuptbl_limit );\r\n    FT_UNUSED( valid );\r\n\r\n    /* XXX: check range? */\r\n    value.u = (FT_UShort)( base_value_p->u +\r\n                           relative_gindex * 4 * sizeof ( FT_Short ) );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         opbd TABLE                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_opbd_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n    GXV_opbd_DataRec  opbdrec;\r\n    GXV_opbd_Data     opbd  = &opbdrec;\r\n    FT_Bytes          p     = table;\r\n    FT_Bytes          limit = 0;\r\n\r\n    FT_ULong  version;\r\n\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = opbd;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `opbd' table\\n\" ));\r\n    GXV_INIT;\r\n    GXV_OPBD_DATA( valueOffset_min ) = 0xFFFFU;\r\n\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 );\r\n    version                 = FT_NEXT_ULONG( p );\r\n    GXV_OPBD_DATA( format ) = FT_NEXT_USHORT( p );\r\n\r\n\r\n    /* only 0x00010000 is defined (1996) */\r\n    GXV_TRACE(( \"(version=0x%08x)\\n\", version ));\r\n    if ( 0x00010000UL != version )\r\n      FT_INVALID_FORMAT;\r\n\r\n    /* only values 0 and 1 are defined (1996) */\r\n    GXV_TRACE(( \"(format=0x%04x)\\n\", GXV_OPBD_DATA( format ) ));\r\n    if ( 0x0001 < GXV_OPBD_DATA( format ) )\r\n      FT_INVALID_FORMAT;\r\n\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_opbd_LookupValue_validate;\r\n    valid->lookupfmt4_trans = gxv_opbd_LookupFmt4_transit;\r\n\r\n    gxv_LookupTable_validate( p, limit, valid );\r\n    p += valid->subtable_length;\r\n\r\n    if ( p > table + GXV_OPBD_DATA( valueOffset_min ) )\r\n    {\r\n      GXV_TRACE((\r\n        \"found overlap between LookupTable and opbd_value array\\n\" ));\r\n      FT_INVALID_OFFSET;\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvprop.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvprop.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT prop table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvprop\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define GXV_PROP_HEADER_SIZE  ( 4 + 2 + 2 )\r\n#define GXV_PROP_SIZE_MIN     GXV_PROP_HEADER_SIZE\r\n\r\n  typedef struct  GXV_prop_DataRec_\r\n  {\r\n    FT_Fixed  version;\r\n\r\n  } GXV_prop_DataRec, *GXV_prop_Data;\r\n\r\n#define GXV_PROP_DATA( field )  GXV_TABLE_DATA( prop, field )\r\n\r\n#define GXV_PROP_FLOATER                      0x8000U\r\n#define GXV_PROP_USE_COMPLEMENTARY_BRACKET    0x1000U\r\n#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET 0x0F00U\r\n#define GXV_PROP_ATTACHING_TO_RIGHT           0x0080U\r\n#define GXV_PROP_RESERVED                     0x0060U\r\n#define GXV_PROP_DIRECTIONALITY_CLASS         0x001FU\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_prop_zero_advance_validate( FT_UShort      gid,\r\n                                  GXV_Validator  valid )\r\n  {\r\n    FT_Face       face;\r\n    FT_Error      error;\r\n    FT_GlyphSlot  glyph;\r\n\r\n\r\n    GXV_NAME_ENTER( \"zero advance\" );\r\n\r\n    face = valid->face;\r\n\r\n    error = FT_Load_Glyph( face,\r\n                           gid,\r\n                           FT_LOAD_IGNORE_TRANSFORM );\r\n    if ( error )\r\n      FT_INVALID_GLYPH_ID;\r\n\r\n    glyph = face->glyph;\r\n\r\n    if ( glyph->advance.x != (FT_Pos)0 ||\r\n         glyph->advance.y != (FT_Pos)0 )\r\n    {\r\n      GXV_TRACE(( \"  found non-zero advance in zero-advance glyph\\n\" ));\r\n      FT_INVALID_DATA;\r\n    }\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /* Pass 0 as GLYPH to check the default property */\r\n  static void\r\n  gxv_prop_property_validate( FT_UShort      property,\r\n                              FT_UShort      glyph,\r\n                              GXV_Validator  valid )\r\n  {\r\n    if ( glyph != 0 && ( property & GXV_PROP_FLOATER ) )\r\n      gxv_prop_zero_advance_validate( glyph, valid );\r\n\r\n    if ( property & GXV_PROP_USE_COMPLEMENTARY_BRACKET )\r\n    {\r\n      FT_UShort  offset;\r\n      char       complement;\r\n\r\n\r\n      offset = (FT_UShort)( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET );\r\n      if ( offset == 0 )\r\n      {\r\n        GXV_TRACE(( \"  found zero offset to property\\n\" ));\r\n        FT_INVALID_OFFSET;\r\n      }\r\n\r\n      complement = (char)( offset >> 8 );\r\n      if ( complement & 0x08 )\r\n      {\r\n        /* Top bit is set: negative */\r\n\r\n        /* Calculate the absolute offset */\r\n        complement = (char)( ( complement & 0x07 ) + 1 );\r\n\r\n        /* The gid for complement must be greater than 0 */\r\n        if ( glyph <= complement )\r\n        {\r\n          GXV_TRACE(( \"  found non-positive glyph complement\\n\" ));\r\n          FT_INVALID_DATA;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        /* The gid for complement must be the face. */\r\n        gxv_glyphid_validate( (FT_UShort)( glyph + complement ), valid );\r\n      }\r\n    }\r\n    else\r\n    {\r\n      if ( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET )\r\n        GXV_TRACE(( \"glyph %d cannot have complementary bracketing\\n\",\r\n                    glyph ));\r\n    }\r\n\r\n    /* this is introduced in version 2.0 */\r\n    if ( property & GXV_PROP_ATTACHING_TO_RIGHT )\r\n    {\r\n      if ( GXV_PROP_DATA( version ) == 0x00010000UL )\r\n      {\r\n        GXV_TRACE(( \"  found older version (1.0) in new version table\\n\" ));\r\n        FT_INVALID_DATA;\r\n      }\r\n    }\r\n\r\n    if ( property & GXV_PROP_RESERVED )\r\n    {\r\n      GXV_TRACE(( \"  found non-zero bits in reserved bits\\n\" ));\r\n      FT_INVALID_DATA;\r\n    }\r\n\r\n    if ( ( property & GXV_PROP_DIRECTIONALITY_CLASS ) > 11 )\r\n    {\r\n      /* TODO: Too restricted. Use the validation level. */\r\n      if ( GXV_PROP_DATA( version ) == 0x00010000UL ||\r\n           GXV_PROP_DATA( version ) == 0x00020000UL )\r\n      {\r\n        GXV_TRACE(( \"  found too old version in directionality class\\n\" ));\r\n        FT_INVALID_DATA;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_prop_LookupValue_validate( FT_UShort            glyph,\r\n                                 GXV_LookupValueCPtr  value_p,\r\n                                 GXV_Validator        valid )\r\n  {\r\n    gxv_prop_property_validate( value_p->u, glyph, valid );\r\n  }\r\n\r\n\r\n  /*\r\n    +===============+ --------+\r\n    | lookup header |         |\r\n    +===============+         |\r\n    | BinSrchHeader |         |\r\n    +===============+         |\r\n    | lastGlyph[0]  |         |\r\n    +---------------+         |\r\n    | firstGlyph[0] |         |    head of lookup table\r\n    +---------------+         |             +\r\n    | offset[0]     |    ->   |          offset            [byte]\r\n    +===============+         |             +\r\n    | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]\r\n    +---------------+         |\r\n    | firstGlyph[1] |         |\r\n    +---------------+         |\r\n    | offset[1]     |         |\r\n    +===============+         |\r\n                              |\r\n     ...                      |\r\n                              |\r\n    16bit value array         |\r\n    +===============+         |\r\n    |     value     | <-------+\r\n    ...\r\n  */\r\n\r\n  static GXV_LookupValueDesc\r\n  gxv_prop_LookupFmt4_transit( FT_UShort            relative_gindex,\r\n                               GXV_LookupValueCPtr  base_value_p,\r\n                               FT_Bytes             lookuptbl_limit,\r\n                               GXV_Validator        valid )\r\n  {\r\n    FT_Bytes             p;\r\n    FT_Bytes             limit;\r\n    FT_UShort            offset;\r\n    GXV_LookupValueDesc  value;\r\n\r\n    /* XXX: check range? */\r\n    offset = (FT_UShort)( base_value_p->u +\r\n                          relative_gindex * sizeof ( FT_UShort ) );\r\n    p      = valid->lookuptbl_head + offset;\r\n    limit  = lookuptbl_limit;\r\n\r\n    GXV_LIMIT_CHECK ( 2 );\r\n    value.u = FT_NEXT_USHORT( p );\r\n\r\n    return value;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         prop TABLE                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_prop_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    FT_Bytes          p     = table;\r\n    FT_Bytes          limit = 0;\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n\r\n    GXV_prop_DataRec  proprec;\r\n    GXV_prop_Data     prop = &proprec;\r\n\r\n    FT_Fixed          version;\r\n    FT_UShort         format;\r\n    FT_UShort         defaultProp;\r\n\r\n\r\n    valid->root       = ftvalid;\r\n    valid->table_data = prop;\r\n    valid->face       = face;\r\n\r\n    FT_TRACE3(( \"validating `prop' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 + 2 );\r\n    version     = FT_NEXT_ULONG( p );\r\n    format      = FT_NEXT_USHORT( p );\r\n    defaultProp = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \"  version 0x%08x\\n\", version ));\r\n    GXV_TRACE(( \"  format  0x%04x\\n\", format ));\r\n    GXV_TRACE(( \"  defaultProp  0x%04x\\n\", defaultProp ));\r\n\r\n    /* only versions 1.0, 2.0, 3.0 are defined (1996) */\r\n    if ( version != 0x00010000UL &&\r\n         version != 0x00020000UL &&\r\n         version != 0x00030000UL )\r\n    {\r\n      GXV_TRACE(( \"  found unknown version\\n\" ));\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n\r\n    /* only formats 0x0000, 0x0001 are defined (1996) */\r\n    if ( format > 1 )\r\n    {\r\n      GXV_TRACE(( \"  found unknown format\\n\" ));\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    gxv_prop_property_validate( defaultProp, 0, valid );\r\n\r\n    if ( format == 0 )\r\n    {\r\n      FT_TRACE3(( \"(format 0, no per-glyph properties, \"\r\n                  \"remaining %d bytes are skipped)\", limit - p ));\r\n      goto Exit;\r\n    }\r\n\r\n    /* format == 1 */\r\n    GXV_PROP_DATA( version ) = version;\r\n\r\n    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;\r\n    valid->lookupval_func   = gxv_prop_LookupValue_validate;\r\n    valid->lookupfmt4_trans = gxv_prop_LookupFmt4_transit;\r\n\r\n    gxv_LookupTable_validate( p, limit, valid );\r\n\r\n  Exit:\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/gxvtrak.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  gxvtrak.c                                                              */\r\n/*                                                                         */\r\n/*    TrueTypeGX/AAT trak table validation (body).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"gxvalid.h\"\r\n#include \"gxvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_gxvtrak\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      Data and Types                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n    /*\r\n     * referred track table format specification:\r\n     * http://developer.apple.com/fonts/TTRefMan/RM06/Chap6trak.html\r\n     * last update was 1996.\r\n     * ----------------------------------------------\r\n     * [MINIMUM HEADER]: GXV_TRAK_SIZE_MIN\r\n     * version          (fixed:  32bit) = 0x00010000\r\n     * format           (uint16: 16bit) = 0 is only defined (1996)\r\n     * horizOffset      (uint16: 16bit)\r\n     * vertOffset       (uint16: 16bit)\r\n     * reserved         (uint16: 16bit) = 0\r\n     * ----------------------------------------------\r\n     * [VARIABLE BODY]:\r\n     * horizData\r\n     *   header         ( 2 + 2 + 4\r\n     *   trackTable       + nTracks * ( 4 + 2 + 2 )\r\n     *   sizeTable        + nSizes * 4 )\r\n     * ----------------------------------------------\r\n     * vertData\r\n     *   header         ( 2 + 2 + 4\r\n     *   trackTable       + nTracks * ( 4 + 2 + 2 )\r\n     *   sizeTable        + nSizes * 4 )\r\n     * ----------------------------------------------\r\n     */\r\n  typedef struct  GXV_trak_DataRec_\r\n  {\r\n    FT_UShort  trackValueOffset_min;\r\n    FT_UShort  trackValueOffset_max;\r\n\r\n  } GXV_trak_DataRec, *GXV_trak_Data;\r\n\r\n\r\n#define GXV_TRAK_DATA( FIELD )  GXV_TABLE_DATA( trak, FIELD )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  gxv_trak_trackTable_validate( FT_Bytes       table,\r\n                                FT_Bytes       limit,\r\n                                FT_UShort      nTracks,\r\n                                GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n\r\n    FT_Fixed   track, t;\r\n    FT_UShort  nameIndex;\r\n    FT_UShort  offset;\r\n    FT_UShort  i, j;\r\n\r\n\r\n    GXV_NAME_ENTER( \"trackTable\" );\r\n\r\n    GXV_TRAK_DATA( trackValueOffset_min ) = 0xFFFFU;\r\n    GXV_TRAK_DATA( trackValueOffset_max ) = 0x0000;\r\n\r\n    GXV_LIMIT_CHECK( nTracks * ( 4 + 2 + 2 ) );\r\n\r\n    for ( i = 0; i < nTracks; i ++ )\r\n    {\r\n      p = table + i * ( 4 + 2 + 2 );\r\n      track     = FT_NEXT_LONG( p );\r\n      nameIndex = FT_NEXT_USHORT( p );\r\n      offset    = FT_NEXT_USHORT( p );\r\n\r\n      if ( offset < GXV_TRAK_DATA( trackValueOffset_min ) )\r\n        GXV_TRAK_DATA( trackValueOffset_min ) = offset;\r\n      if ( offset > GXV_TRAK_DATA( trackValueOffset_max ) )\r\n        GXV_TRAK_DATA( trackValueOffset_max ) = offset;\r\n\r\n      gxv_sfntName_validate( nameIndex, 256, 32767, valid );\r\n\r\n      for ( j = i; j < nTracks; j ++ )\r\n      {\r\n         p = table + j * ( 4 + 2 + 2 );\r\n         t = FT_NEXT_LONG( p );\r\n         if ( t == track )\r\n           GXV_TRACE(( \"duplicated entries found for track value 0x%x\\n\",\r\n                        track ));\r\n      }\r\n    }\r\n\r\n    valid->subtable_length = p - table;\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  gxv_trak_trackData_validate( FT_Bytes       table,\r\n                               FT_Bytes       limit,\r\n                               GXV_Validator  valid )\r\n  {\r\n    FT_Bytes   p = table;\r\n    FT_UShort  nTracks;\r\n    FT_UShort  nSizes;\r\n    FT_ULong   sizeTableOffset;\r\n\r\n    GXV_ODTECT( 4, odtect );\r\n\r\n\r\n    GXV_ODTECT_INIT( odtect );\r\n    GXV_NAME_ENTER( \"trackData\" );\r\n\r\n    /* read the header of trackData */\r\n    GXV_LIMIT_CHECK( 2 + 2 + 4 );\r\n    nTracks         = FT_NEXT_USHORT( p );\r\n    nSizes          = FT_NEXT_USHORT( p );\r\n    sizeTableOffset = FT_NEXT_ULONG( p );\r\n\r\n    gxv_odtect_add_range( table, p - table, \"trackData header\", odtect );\r\n\r\n    /* validate trackTable */\r\n    gxv_trak_trackTable_validate( p, limit, nTracks, valid );\r\n    gxv_odtect_add_range( p, valid->subtable_length,\r\n                          \"trackTable\", odtect );\r\n\r\n    /* sizeTable is array of FT_Fixed, don't check contents */\r\n    p = valid->root->base + sizeTableOffset;\r\n    GXV_LIMIT_CHECK( nSizes * 4 );\r\n    gxv_odtect_add_range( p, nSizes * 4, \"sizeTable\", odtect );\r\n\r\n    /* validate trackValueOffet */\r\n    p = valid->root->base + GXV_TRAK_DATA( trackValueOffset_min );\r\n    if ( limit - p < nTracks * nSizes * 2 )\r\n      GXV_TRACE(( \"too short trackValue array\\n\" ));\r\n\r\n    p = valid->root->base + GXV_TRAK_DATA( trackValueOffset_max );\r\n    GXV_LIMIT_CHECK( nSizes * 2 );\r\n\r\n    gxv_odtect_add_range( valid->root->base\r\n                            + GXV_TRAK_DATA( trackValueOffset_min ),\r\n                          GXV_TRAK_DATA( trackValueOffset_max )\r\n                            - GXV_TRAK_DATA( trackValueOffset_min )\r\n                            + nSizes * 2,\r\n                          \"trackValue array\", odtect );\r\n\r\n    gxv_odtect_validate( odtect, valid );\r\n\r\n    GXV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          trak TABLE                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  gxv_trak_validate( FT_Bytes      table,\r\n                     FT_Face       face,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    FT_Bytes          p = table;\r\n    FT_Bytes          limit = 0;\r\n\r\n    GXV_ValidatorRec  validrec;\r\n    GXV_Validator     valid = &validrec;\r\n    GXV_trak_DataRec  trakrec;\r\n    GXV_trak_Data     trak = &trakrec;\r\n\r\n    FT_ULong   version;\r\n    FT_UShort  format;\r\n    FT_UShort  horizOffset;\r\n    FT_UShort  vertOffset;\r\n    FT_UShort  reserved;\r\n\r\n\r\n    GXV_ODTECT( 3, odtect );\r\n\r\n    GXV_ODTECT_INIT( odtect );\r\n    valid->root       = ftvalid;\r\n    valid->table_data = trak;\r\n    valid->face       = face;\r\n\r\n    limit      = valid->root->limit;\r\n\r\n    FT_TRACE3(( \"validating `trak' table\\n\" ));\r\n    GXV_INIT;\r\n\r\n    GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 + 2 );\r\n    version     = FT_NEXT_ULONG( p );\r\n    format      = FT_NEXT_USHORT( p );\r\n    horizOffset = FT_NEXT_USHORT( p );\r\n    vertOffset  = FT_NEXT_USHORT( p );\r\n    reserved    = FT_NEXT_USHORT( p );\r\n\r\n    GXV_TRACE(( \" (version = 0x%08x)\\n\", version ));\r\n    GXV_TRACE(( \" (format = 0x%04x)\\n\", format ));\r\n    GXV_TRACE(( \" (horizOffset = 0x%04x)\\n\", horizOffset ));\r\n    GXV_TRACE(( \" (vertOffset = 0x%04x)\\n\", vertOffset ));\r\n    GXV_TRACE(( \" (reserved = 0x%04x)\\n\", reserved ));\r\n\r\n    /* Version 1.0 (always:1996) */\r\n    if ( version != 0x00010000UL )\r\n      FT_INVALID_FORMAT;\r\n\r\n    /* format 0 (always:1996) */\r\n    if ( format != 0x0000 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    GXV_32BIT_ALIGNMENT_VALIDATE( horizOffset );\r\n    GXV_32BIT_ALIGNMENT_VALIDATE( vertOffset );\r\n\r\n    /* Reserved Fixed Value (always) */\r\n    if ( reserved != 0x0000 )\r\n      FT_INVALID_DATA;\r\n\r\n    /* validate trackData */\r\n    if ( 0 < horizOffset )\r\n    {\r\n      gxv_trak_trackData_validate( table + horizOffset, limit, valid );\r\n      gxv_odtect_add_range( table + horizOffset, valid->subtable_length,\r\n                            \"horizJustData\", odtect );\r\n    }\r\n\r\n    if ( 0 < vertOffset )\r\n    {\r\n      gxv_trak_trackData_validate( table + vertOffset, limit, valid );\r\n      gxv_odtect_add_range( table + vertOffset, valid->subtable_length,\r\n                            \"vertJustData\", odtect );\r\n    }\r\n\r\n    gxv_odtect_validate( odtect, valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/module.mk",
    "content": "#\r\n# FreeType 2 gxvalid module definition\r\n#\r\n\r\n# Copyright 2004, 2005, 2006\r\n#   by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,\r\n#   David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += GXVALID_MODULE\r\n\r\ndefine GXVALID_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, gxv_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)gxvalid   $(ECHO_DRIVER_DESC)TrueTypeGX/AAT validation module$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gxvalid/rules.mk",
    "content": "#\r\n# FreeType 2 TrueTypeGX/AAT validation driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# GXV driver directory\r\n#\r\nGXV_DIR := $(SRC_DIR)/gxvalid\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nGXV_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(GXV_DIR))\r\n\r\n\r\n# GXV driver sources (i.e., C files)\r\n#\r\nGXV_DRV_SRC := $(GXV_DIR)/gxvcommn.c \\\r\n               $(GXV_DIR)/gxvfeat.c  \\\r\n               $(GXV_DIR)/gxvbsln.c  \\\r\n               $(GXV_DIR)/gxvtrak.c  \\\r\n               $(GXV_DIR)/gxvopbd.c  \\\r\n               $(GXV_DIR)/gxvprop.c  \\\r\n               $(GXV_DIR)/gxvjust.c  \\\r\n               $(GXV_DIR)/gxvmort.c  \\\r\n               $(GXV_DIR)/gxvmort0.c \\\r\n               $(GXV_DIR)/gxvmort1.c \\\r\n               $(GXV_DIR)/gxvmort2.c \\\r\n               $(GXV_DIR)/gxvmort4.c \\\r\n               $(GXV_DIR)/gxvmort5.c \\\r\n               $(GXV_DIR)/gxvmorx.c  \\\r\n               $(GXV_DIR)/gxvmorx0.c \\\r\n               $(GXV_DIR)/gxvmorx1.c \\\r\n               $(GXV_DIR)/gxvmorx2.c \\\r\n               $(GXV_DIR)/gxvmorx4.c \\\r\n               $(GXV_DIR)/gxvmorx5.c \\\r\n               $(GXV_DIR)/gxvlcar.c  \\\r\n               $(GXV_DIR)/gxvkern.c  \\\r\n               $(GXV_DIR)/gxvmod.c\r\n\r\n# GXV driver headers\r\n#\r\nGXV_DRV_H := $(GXV_DIR)/gxvalid.h  \\\r\n             $(GXV_DIR)/gxverror.h \\\r\n             $(GXV_DIR)/gxvcommn.h \\\r\n             $(GXV_DIR)/gxvfeat.h  \\\r\n             $(GXV_DIR)/gxvmod.h   \\\r\n             $(GXV_DIR)/gxvmort.h  \\\r\n             $(GXV_DIR)/gxvmorx.h\r\n\r\n\r\n# GXV driver object(s)\r\n#\r\n#   GXV_DRV_OBJ_M is used during `multi' builds.\r\n#   GXV_DRV_OBJ_S is used during `single' builds.\r\n#\r\nGXV_DRV_OBJ_M := $(GXV_DRV_SRC:$(GXV_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nGXV_DRV_OBJ_S := $(OBJ_DIR)/gxvalid.$O\r\n\r\n# GXV driver source file for single build\r\n#\r\nGXV_DRV_SRC_S := $(GXV_DIR)/gxvalid.c\r\n\r\n\r\n# GXV driver - single object\r\n#\r\n$(GXV_DRV_OBJ_S): $(GXV_DRV_SRC_S) $(GXV_DRV_SRC) \\\r\n                   $(FREETYPE_H) $(GXV_DRV_H)\r\n\t$(GXV_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(GXV_DRV_SRC_S))\r\n\r\n\r\n# GXV driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(GXV_DIR)/%.c $(FREETYPE_H) $(GXV_DRV_H)\r\n\t$(GXV_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(GXV_DRV_OBJ_S)\r\nDRV_OBJS_M += $(GXV_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/Jamfile",
    "content": "# FreeType 2 src/gzip Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) gzip ;\r\n\r\nLibrary  $(FT2_LIB) : ftgzip.c ;\r\n\r\n# end of src/pcf Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/adler32.c",
    "content": "/* adler32.c -- compute the Adler-32 checksum of a data stream\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* @(#) $Id$ */\r\n\r\n#include \"zlib.h\"\r\n\r\n#define BASE 65521L /* largest prime smaller than 65536 */\r\n#define NMAX 5552\r\n/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */\r\n\r\n#define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}\r\n#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);\r\n#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);\r\n#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);\r\n#define DO16(buf)   DO8(buf,0); DO8(buf,8);\r\n\r\n/* ========================================================================= */\r\nZEXPORT(uLong) adler32( /* adler, buf, len) */\r\n    uLong adler,\r\n    const Bytef *buf,\r\n    uInt len )\r\n{\r\n    unsigned long s1 = adler & 0xffff;\r\n    unsigned long s2 = (adler >> 16) & 0xffff;\r\n    int k;\r\n\r\n    if (buf == Z_NULL) return 1L;\r\n\r\n    while (len > 0) {\r\n        k = len < NMAX ? len : NMAX;\r\n        len -= k;\r\n        while (k >= 16) {\r\n            DO16(buf);\r\n            buf += 16;\r\n            k -= 16;\r\n        }\r\n        if (k != 0) do {\r\n            s1 += *buf++;\r\n            s2 += s1;\r\n        } while (--k);\r\n        s1 %= BASE;\r\n        s2 %= BASE;\r\n    }\r\n    return (s2 << 16) | s1;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/ftgzip.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgzip.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType support for .gz compressed files.                           */\r\n/*                                                                         */\r\n/*  This optional component relies on zlib.  It should mainly be used to   */\r\n/*  parse compressed PCF fonts, as found with many X11 server              */\r\n/*  distributions.                                                         */\r\n/*                                                                         */\r\n/*  Copyright 2002-2006, 2009-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_GZIP_H\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  Gzip_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Gzip\r\n\r\n#include FT_ERRORS_H\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_ZLIB\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"gzip code does not support PIC yet\"\r\n#endif\r\n\r\n#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB\r\n\r\n#include <zlib.h>\r\n\r\n#else /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */\r\n\r\n /* In this case, we include our own modified sources of the ZLib    */\r\n /* within the \"ftgzip\" component.  The modifications were necessary */\r\n /* to #include all files without conflicts, as well as preventing   */\r\n /* the definition of \"extern\" functions that may cause linking      */\r\n /* conflicts when a program is linked with both FreeType and the    */\r\n /* original ZLib.                                                   */\r\n\r\n#define NO_DUMMY_DECL\r\n#ifndef USE_ZLIB_ZCALLOC\r\n#define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutils.c */\r\n#endif\r\n\r\n#include \"zlib.h\"\r\n\r\n#undef  SLOW\r\n#define SLOW  1  /* we can't use asm-optimized sources here! */\r\n\r\n  /* Urgh.  `inflate_mask' must not be declared twice -- C++ doesn't like\r\n     this.  We temporarily disable it and load all necessary header files. */\r\n#define NO_INFLATE_MASK\r\n#include \"zutil.h\"\r\n#include \"inftrees.h\"\r\n#include \"infblock.h\"\r\n#include \"infcodes.h\"\r\n#include \"infutil.h\"\r\n#undef  NO_INFLATE_MASK\r\n\r\n  /* infutil.c must be included before infcodes.c */\r\n#include \"zutil.c\"\r\n#include \"inftrees.c\"\r\n#include \"infutil.c\"\r\n#include \"infcodes.c\"\r\n#include \"infblock.c\"\r\n#include \"inflate.c\"\r\n#include \"adler32.c\"\r\n\r\n#endif /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****            Z L I B   M E M O R Y   M A N A G E M E N T          *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n  /* it is better to use FreeType memory routines instead of raw\r\n     'malloc/free' */\r\n\r\n  static voidpf\r\n  ft_gzip_alloc( FT_Memory  memory,\r\n                 uInt       items,\r\n                 uInt       size )\r\n  {\r\n    FT_ULong    sz = (FT_ULong)size * items;\r\n    FT_Error    error;\r\n    FT_Pointer  p  = NULL;\r\n\r\n\r\n    (void)FT_ALLOC( p, sz );\r\n    return p;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_gzip_free( FT_Memory  memory,\r\n                voidpf     address )\r\n  {\r\n    FT_MEM_FREE( address );\r\n  }\r\n\r\n\r\n#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )\r\n\r\n  local voidpf\r\n  zcalloc ( voidpf    opaque,\r\n            unsigned  items,\r\n            unsigned  size )\r\n  {\r\n    return ft_gzip_alloc( (FT_Memory)opaque, items, size );\r\n  }\r\n\r\n  local void\r\n  zcfree( voidpf  opaque,\r\n          voidpf  ptr )\r\n  {\r\n    ft_gzip_free( (FT_Memory)opaque, ptr );\r\n  }\r\n\r\n#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****               Z L I B   F I L E   D E S C R I P T O R           *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n#define FT_GZIP_BUFFER_SIZE  4096\r\n\r\n  typedef struct  FT_GZipFileRec_\r\n  {\r\n    FT_Stream  source;         /* parent/source stream        */\r\n    FT_Stream  stream;         /* embedding stream            */\r\n    FT_Memory  memory;         /* memory allocator            */\r\n    z_stream   zstream;        /* zlib input stream           */\r\n\r\n    FT_ULong   start;          /* starting position, after .gz header */\r\n    FT_Byte    input[FT_GZIP_BUFFER_SIZE];   /* input read buffer  */\r\n\r\n    FT_Byte    buffer[FT_GZIP_BUFFER_SIZE];  /* output buffer      */\r\n    FT_ULong   pos;                          /* position in output */\r\n    FT_Byte*   cursor;\r\n    FT_Byte*   limit;\r\n\r\n  } FT_GZipFileRec, *FT_GZipFile;\r\n\r\n\r\n  /* gzip flag byte */\r\n#define FT_GZIP_ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */\r\n#define FT_GZIP_HEAD_CRC     0x02 /* bit 1 set: header CRC present */\r\n#define FT_GZIP_EXTRA_FIELD  0x04 /* bit 2 set: extra field present */\r\n#define FT_GZIP_ORIG_NAME    0x08 /* bit 3 set: original file name present */\r\n#define FT_GZIP_COMMENT      0x10 /* bit 4 set: file comment present */\r\n#define FT_GZIP_RESERVED     0xE0 /* bits 5..7: reserved */\r\n\r\n\r\n  /* check and skip .gz header - we don't support `transparent' compression */\r\n  static FT_Error\r\n  ft_gzip_check_header( FT_Stream  stream )\r\n  {\r\n    FT_Error  error;\r\n    FT_Byte   head[4];\r\n\r\n\r\n    if ( FT_STREAM_SEEK( 0 )       ||\r\n         FT_STREAM_READ( head, 4 ) )\r\n      goto Exit;\r\n\r\n    /* head[0] && head[1] are the magic numbers;    */\r\n    /* head[2] is the method, and head[3] the flags */\r\n    if ( head[0] != 0x1f              ||\r\n         head[1] != 0x8b              ||\r\n         head[2] != Z_DEFLATED        ||\r\n        (head[3] & FT_GZIP_RESERVED)  )\r\n    {\r\n      error = Gzip_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* skip time, xflags and os code */\r\n    (void)FT_STREAM_SKIP( 6 );\r\n\r\n    /* skip the extra field */\r\n    if ( head[3] & FT_GZIP_EXTRA_FIELD )\r\n    {\r\n      FT_UInt  len;\r\n\r\n\r\n      if ( FT_READ_USHORT_LE( len ) ||\r\n           FT_STREAM_SKIP( len )    )\r\n        goto Exit;\r\n    }\r\n\r\n    /* skip original file name */\r\n    if ( head[3] & FT_GZIP_ORIG_NAME )\r\n      for (;;)\r\n      {\r\n        FT_UInt  c;\r\n\r\n\r\n        if ( FT_READ_BYTE( c ) )\r\n          goto Exit;\r\n\r\n        if ( c == 0 )\r\n          break;\r\n      }\r\n\r\n    /* skip .gz comment */\r\n    if ( head[3] & FT_GZIP_COMMENT )\r\n      for (;;)\r\n      {\r\n        FT_UInt  c;\r\n\r\n\r\n        if ( FT_READ_BYTE( c ) )\r\n          goto Exit;\r\n\r\n        if ( c == 0 )\r\n          break;\r\n      }\r\n\r\n    /* skip CRC */\r\n    if ( head[3] & FT_GZIP_HEAD_CRC )\r\n      if ( FT_STREAM_SKIP( 2 ) )\r\n        goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_gzip_file_init( FT_GZipFile  zip,\r\n                     FT_Stream    stream,\r\n                     FT_Stream    source )\r\n  {\r\n    z_stream*  zstream = &zip->zstream;\r\n    FT_Error   error   = Gzip_Err_Ok;\r\n\r\n\r\n    zip->stream = stream;\r\n    zip->source = source;\r\n    zip->memory = stream->memory;\r\n\r\n    zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;\r\n    zip->cursor = zip->limit;\r\n    zip->pos    = 0;\r\n\r\n    /* check and skip .gz header */\r\n    {\r\n      stream = source;\r\n\r\n      error = ft_gzip_check_header( stream );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      zip->start = FT_STREAM_POS();\r\n    }\r\n\r\n    /* initialize zlib -- there is no zlib header in the compressed stream */\r\n    zstream->zalloc = (alloc_func)ft_gzip_alloc;\r\n    zstream->zfree  = (free_func) ft_gzip_free;\r\n    zstream->opaque = stream->memory;\r\n\r\n    zstream->avail_in = 0;\r\n    zstream->next_in  = zip->buffer;\r\n\r\n    if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||\r\n         zstream->next_in == NULL                     )\r\n      error = Gzip_Err_Invalid_File_Format;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_gzip_file_done( FT_GZipFile  zip )\r\n  {\r\n    z_stream*  zstream = &zip->zstream;\r\n\r\n\r\n    inflateEnd( zstream );\r\n\r\n    /* clear the rest */\r\n    zstream->zalloc    = NULL;\r\n    zstream->zfree     = NULL;\r\n    zstream->opaque    = NULL;\r\n    zstream->next_in   = NULL;\r\n    zstream->next_out  = NULL;\r\n    zstream->avail_in  = 0;\r\n    zstream->avail_out = 0;\r\n\r\n    zip->memory = NULL;\r\n    zip->source = NULL;\r\n    zip->stream = NULL;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_gzip_file_reset( FT_GZipFile  zip )\r\n  {\r\n    FT_Stream  stream = zip->source;\r\n    FT_Error   error;\r\n\r\n\r\n    if ( !FT_STREAM_SEEK( zip->start ) )\r\n    {\r\n      z_stream*  zstream = &zip->zstream;\r\n\r\n\r\n      inflateReset( zstream );\r\n\r\n      zstream->avail_in  = 0;\r\n      zstream->next_in   = zip->input;\r\n      zstream->avail_out = 0;\r\n      zstream->next_out  = zip->buffer;\r\n\r\n      zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;\r\n      zip->cursor = zip->limit;\r\n      zip->pos    = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_gzip_file_fill_input( FT_GZipFile  zip )\r\n  {\r\n    z_stream*  zstream = &zip->zstream;\r\n    FT_Stream  stream  = zip->source;\r\n    FT_ULong   size;\r\n\r\n\r\n    if ( stream->read )\r\n    {\r\n      size = stream->read( stream, stream->pos, zip->input,\r\n                           FT_GZIP_BUFFER_SIZE );\r\n      if ( size == 0 )\r\n        return Gzip_Err_Invalid_Stream_Operation;\r\n    }\r\n    else\r\n    {\r\n      size = stream->size - stream->pos;\r\n      if ( size > FT_GZIP_BUFFER_SIZE )\r\n        size = FT_GZIP_BUFFER_SIZE;\r\n\r\n      if ( size == 0 )\r\n        return Gzip_Err_Invalid_Stream_Operation;\r\n\r\n      FT_MEM_COPY( zip->input, stream->base + stream->pos, size );\r\n    }\r\n    stream->pos += size;\r\n\r\n    zstream->next_in  = zip->input;\r\n    zstream->avail_in = size;\r\n\r\n    return Gzip_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_gzip_file_fill_output( FT_GZipFile  zip )\r\n  {\r\n    z_stream*  zstream = &zip->zstream;\r\n    FT_Error   error   = Gzip_Err_Ok;\r\n\r\n\r\n    zip->cursor        = zip->buffer;\r\n    zstream->next_out  = zip->cursor;\r\n    zstream->avail_out = FT_GZIP_BUFFER_SIZE;\r\n\r\n    while ( zstream->avail_out > 0 )\r\n    {\r\n      int  err;\r\n\r\n\r\n      if ( zstream->avail_in == 0 )\r\n      {\r\n        error = ft_gzip_file_fill_input( zip );\r\n        if ( error )\r\n          break;\r\n      }\r\n\r\n      err = inflate( zstream, Z_NO_FLUSH );\r\n\r\n      if ( err == Z_STREAM_END )\r\n      {\r\n        zip->limit = zstream->next_out;\r\n        if ( zip->limit == zip->cursor )\r\n          error = Gzip_Err_Invalid_Stream_Operation;\r\n        break;\r\n      }\r\n      else if ( err != Z_OK )\r\n      {\r\n        error = Gzip_Err_Invalid_Stream_Operation;\r\n        break;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* fill output buffer; `count' must be <= FT_GZIP_BUFFER_SIZE */\r\n  static FT_Error\r\n  ft_gzip_file_skip_output( FT_GZipFile  zip,\r\n                            FT_ULong     count )\r\n  {\r\n    FT_Error  error = Gzip_Err_Ok;\r\n    FT_ULong  delta;\r\n\r\n\r\n    for (;;)\r\n    {\r\n      delta = (FT_ULong)( zip->limit - zip->cursor );\r\n      if ( delta >= count )\r\n        delta = count;\r\n\r\n      zip->cursor += delta;\r\n      zip->pos    += delta;\r\n\r\n      count -= delta;\r\n      if ( count == 0 )\r\n        break;\r\n\r\n      error = ft_gzip_file_fill_output( zip );\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_gzip_file_io( FT_GZipFile  zip,\r\n                   FT_ULong     pos,\r\n                   FT_Byte*     buffer,\r\n                   FT_ULong     count )\r\n  {\r\n    FT_ULong  result = 0;\r\n    FT_Error  error;\r\n\r\n\r\n    /* Reset inflate stream if we're seeking backwards.        */\r\n    /* Yes, that is not too efficient, but it saves memory :-) */\r\n    if ( pos < zip->pos )\r\n    {\r\n      error = ft_gzip_file_reset( zip );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* skip unwanted bytes */\r\n    if ( pos > zip->pos )\r\n    {\r\n      error = ft_gzip_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( count == 0 )\r\n      goto Exit;\r\n\r\n    /* now read the data */\r\n    for (;;)\r\n    {\r\n      FT_ULong  delta;\r\n\r\n\r\n      delta = (FT_ULong)( zip->limit - zip->cursor );\r\n      if ( delta >= count )\r\n        delta = count;\r\n\r\n      FT_MEM_COPY( buffer, zip->cursor, delta );\r\n      buffer      += delta;\r\n      result      += delta;\r\n      zip->cursor += delta;\r\n      zip->pos    += delta;\r\n\r\n      count -= delta;\r\n      if ( count == 0 )\r\n        break;\r\n\r\n      error = ft_gzip_file_fill_output( zip );\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****               G Z   E M B E D D I N G   S T R E A M             *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n  static void\r\n  ft_gzip_stream_close( FT_Stream  stream )\r\n  {\r\n    FT_GZipFile  zip    = (FT_GZipFile)stream->descriptor.pointer;\r\n    FT_Memory    memory = stream->memory;\r\n\r\n\r\n    if ( zip )\r\n    {\r\n      /* finalize gzip file descriptor */\r\n      ft_gzip_file_done( zip );\r\n\r\n      FT_FREE( zip );\r\n\r\n      stream->descriptor.pointer = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_gzip_stream_io( FT_Stream  stream,\r\n                     FT_ULong   pos,\r\n                     FT_Byte*   buffer,\r\n                     FT_ULong   count )\r\n  {\r\n    FT_GZipFile  zip = (FT_GZipFile)stream->descriptor.pointer;\r\n\r\n\r\n    return ft_gzip_file_io( zip, pos, buffer, count );\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_gzip_get_uncompressed_size( FT_Stream  stream )\r\n  {\r\n    FT_Error  error;\r\n    FT_ULong  old_pos;\r\n    FT_ULong  result = 0;\r\n\r\n\r\n    old_pos = stream->pos;\r\n    if ( !FT_Stream_Seek( stream, stream->size - 4 ) )\r\n    {\r\n      result = FT_Stream_ReadULong( stream, &error );\r\n      if ( error )\r\n        result = 0;\r\n\r\n      (void)FT_Stream_Seek( stream, old_pos );\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stream_OpenGzip( FT_Stream  stream,\r\n                      FT_Stream  source )\r\n  {\r\n    FT_Error     error;\r\n    FT_Memory    memory = source->memory;\r\n    FT_GZipFile  zip = NULL;\r\n\r\n\r\n    /*\r\n     *  check the header right now; this prevents allocating un-necessary\r\n     *  objects when we don't need them\r\n     */\r\n    error = ft_gzip_check_header( source );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_ZERO( stream );\r\n    stream->memory = memory;\r\n\r\n    if ( !FT_QNEW( zip ) )\r\n    {\r\n      error = ft_gzip_file_init( zip, stream, source );\r\n      if ( error )\r\n      {\r\n        FT_FREE( zip );\r\n        goto Exit;\r\n      }\r\n\r\n      stream->descriptor.pointer = zip;\r\n    }\r\n\r\n    /*\r\n     *  We use the following trick to try to dramatically improve the\r\n     *  performance while dealing with small files.  If the original stream\r\n     *  size is less than a certain threshold, we try to load the whole font\r\n     *  file into memory.  This saves us from using the 32KB buffer needed\r\n     *  to inflate the file, plus the two 4KB intermediate input/output\r\n     *  buffers used in the `FT_GZipFile' structure.\r\n     */\r\n    {\r\n      FT_ULong  zip_size = ft_gzip_get_uncompressed_size( source );\r\n\r\n\r\n      if ( zip_size != 0 && zip_size < 40 * 1024 )\r\n      {\r\n        FT_Byte*  zip_buff = NULL;\r\n\r\n\r\n        if ( !FT_ALLOC( zip_buff, zip_size ) )\r\n        {\r\n          FT_ULong  count;\r\n\r\n\r\n          count = ft_gzip_file_io( zip, 0, zip_buff, zip_size );\r\n          if ( count == zip_size )\r\n          {\r\n            ft_gzip_file_done( zip );\r\n            FT_FREE( zip );\r\n\r\n            stream->descriptor.pointer = NULL;\r\n\r\n            stream->size  = zip_size;\r\n            stream->pos   = 0;\r\n            stream->base  = zip_buff;\r\n            stream->read  = NULL;\r\n            stream->close = ft_gzip_stream_close;\r\n\r\n            goto Exit;\r\n          }\r\n\r\n          ft_gzip_file_io( zip, 0, NULL, 0 );\r\n          FT_FREE( zip_buff );\r\n        }\r\n        error = Gzip_Err_Ok;\r\n      }\r\n    }\r\n\r\n    stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */\r\n    stream->pos   = 0;\r\n    stream->base  = 0;\r\n    stream->read  = ft_gzip_stream_io;\r\n    stream->close = ft_gzip_stream_close;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n#else  /* !FT_CONFIG_OPTION_USE_ZLIB */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stream_OpenGzip( FT_Stream  stream,\r\n                      FT_Stream  source )\r\n  {\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( source );\r\n\r\n    return Gzip_Err_Unimplemented_Feature;\r\n  }\r\n\r\n#endif /* !FT_CONFIG_OPTION_USE_ZLIB */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/infblock.c",
    "content": "/* infblock.c -- interpret and process block types to last block\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n#include \"zutil.h\"\r\n#include \"infblock.h\"\r\n#include \"inftrees.h\"\r\n#include \"infcodes.h\"\r\n#include \"infutil.h\"\r\n\r\n\r\n/* simplify the use of the inflate_huft type with some defines */\r\n#define exop word.what.Exop\r\n#define bits word.what.Bits\r\n\r\n/* Table for deflate from PKZIP's appnote.txt. */\r\nlocal const uInt border[] = { /* Order of the bit length code lengths */\r\n        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};\r\n\r\n/*\r\n   Notes beyond the 1.93a appnote.txt:\r\n\r\n   1. Distance pointers never point before the beginning of the output\r\n      stream.\r\n   2. Distance pointers can point back across blocks, up to 32k away.\r\n   3. There is an implied maximum of 7 bits for the bit length table and\r\n      15 bits for the actual data.\r\n   4. If only one code exists, then it is encoded using one bit.  (Zero\r\n      would be more efficient, but perhaps a little confusing.)  If two\r\n      codes exist, they are coded using one bit each (0 and 1).\r\n   5. There is no way of sending zero distance codes--a dummy must be\r\n      sent if there are none.  (History: a pre 2.0 version of PKZIP would\r\n      store blocks with no distance codes, but this was discovered to be\r\n      too harsh a criterion.)  Valid only for 1.93a.  2.04c does allow\r\n      zero distance codes, which is sent as one code of zero bits in\r\n      length.\r\n   6. There are up to 286 literal/length codes.  Code 256 represents the\r\n      end-of-block.  Note however that the static length tree defines\r\n      288 codes just to fill out the Huffman codes.  Codes 286 and 287\r\n      cannot be used though, since there is no length base or extra bits\r\n      defined for them.  Similarily, there are up to 30 distance codes.\r\n      However, static trees define 32 codes (all 5 bits) to fill out the\r\n      Huffman codes, but the last two had better not show up in the data.\r\n   7. Unzip can check dynamic Huffman blocks for complete code sets.\r\n      The exception is that a single code would not be complete (see #4).\r\n   8. The five bits following the block type is really the number of\r\n      literal codes sent minus 257.\r\n   9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits\r\n      (1+6+6).  Therefore, to output three times the length, you output\r\n      three codes (1+1+1), whereas to output four times the same length,\r\n      you only need two codes (1+3).  Hmm.\r\n  10. In the tree reconstruction algorithm, Code = Code + Increment\r\n      only if BitLength(i) is not zero.  (Pretty obvious.)\r\n  11. Correction: 4 Bits: # of Bit Length codes - 4     (4 - 19)\r\n  12. Note: length code 284 can represent 227-258, but length code 285\r\n      really is 258.  The last length deserves its own, short code\r\n      since it gets used a lot in very redundant files.  The length\r\n      258 is special since 258 - 3 (the min match length) is 255.\r\n  13. The literal/length and distance code bit lengths are read as a\r\n      single stream of lengths.  It is possible (and advantageous) for\r\n      a repeat code (16, 17, or 18) to go across the boundary between\r\n      the two sets of lengths.\r\n */\r\n\r\n\r\nlocal void inflate_blocks_reset( /* s, z, c) */\r\ninflate_blocks_statef *s,\r\nz_streamp z,\r\nuLongf *c )\r\n{\r\n  if (c != Z_NULL)\r\n    *c = s->check;\r\n  if (s->mode == BTREE || s->mode == DTREE)\r\n    ZFREE(z, s->sub.trees.blens);\r\n  if (s->mode == CODES)\r\n    inflate_codes_free(s->sub.decode.codes, z);\r\n  s->mode = TYPE;\r\n  s->bitk = 0;\r\n  s->bitb = 0;\r\n  s->read = s->write = s->window;\r\n  if (s->checkfn != Z_NULL)\r\n    z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);\r\n  Tracev((stderr, \"inflate:   blocks reset\\n\"));\r\n}\r\n\r\n\r\nlocal inflate_blocks_statef *inflate_blocks_new( /* z, c, w) */\r\nz_streamp z,\r\ncheck_func c,\r\nuInt w )\r\n{\r\n  inflate_blocks_statef *s;\r\n\r\n  if ((s = (inflate_blocks_statef *)ZALLOC\r\n       (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)\r\n    return s;\r\n  if ((s->hufts =\r\n       (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)\r\n  {\r\n    ZFREE(z, s);\r\n    return Z_NULL;\r\n  }\r\n  if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)\r\n  {\r\n    ZFREE(z, s->hufts);\r\n    ZFREE(z, s);\r\n    return Z_NULL;\r\n  }\r\n  s->end = s->window + w;\r\n  s->checkfn = c;\r\n  s->mode = TYPE;\r\n  Tracev((stderr, \"inflate:   blocks allocated\\n\"));\r\n  inflate_blocks_reset(s, z, Z_NULL);\r\n  return s;\r\n}\r\n\r\n\r\nlocal int inflate_blocks( /* s, z, r) */\r\ninflate_blocks_statef *s,\r\nz_streamp z,\r\nint r )\r\n{\r\n  uInt t;               /* temporary storage */\r\n  uLong b;              /* bit buffer */\r\n  uInt k;               /* bits in bit buffer */\r\n  Bytef *p;             /* input data pointer */\r\n  uInt n;               /* bytes available there */\r\n  Bytef *q;             /* output window write pointer */\r\n  uInt m;               /* bytes to end of window or read pointer */\r\n\r\n  /* copy input/output information to locals (UPDATE macro restores) */\r\n  LOAD\r\n\r\n  /* process input based on current state */\r\n  while (1) switch (s->mode)\r\n  {\r\n    case TYPE:\r\n      NEEDBITS(3)\r\n      t = (uInt)b & 7;\r\n      s->last = t & 1;\r\n      switch (t >> 1)\r\n      {\r\n        case 0:                         /* stored */\r\n          Tracev((stderr, \"inflate:     stored block%s\\n\",\r\n                 s->last ? \" (last)\" : \"\"));\r\n          DUMPBITS(3)\r\n          t = k & 7;                    /* go to byte boundary */\r\n          DUMPBITS(t)\r\n          s->mode = LENS;               /* get length of stored block */\r\n          break;\r\n        case 1:                         /* fixed */\r\n          Tracev((stderr, \"inflate:     fixed codes block%s\\n\",\r\n                 s->last ? \" (last)\" : \"\"));\r\n          {\r\n            uInt bl, bd;\r\n            inflate_huft *tl, *td;\r\n\r\n            inflate_trees_fixed(&bl, &bd, (const inflate_huft**)&tl,\r\n                                          (const inflate_huft**)&td, z);\r\n            s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);\r\n            if (s->sub.decode.codes == Z_NULL)\r\n            {\r\n              r = Z_MEM_ERROR;\r\n              LEAVE\r\n            }\r\n          }\r\n          DUMPBITS(3)\r\n          s->mode = CODES;\r\n          break;\r\n        case 2:                         /* dynamic */\r\n          Tracev((stderr, \"inflate:     dynamic codes block%s\\n\",\r\n                 s->last ? \" (last)\" : \"\"));\r\n          DUMPBITS(3)\r\n          s->mode = TABLE;\r\n          break;\r\n        case 3:                         /* illegal */\r\n          DUMPBITS(3)\r\n          s->mode = BAD;\r\n          z->msg = (char*)\"invalid block type\";\r\n          r = Z_DATA_ERROR;\r\n          LEAVE\r\n      }\r\n      break;\r\n    case LENS:\r\n      NEEDBITS(32)\r\n      if ((((~b) >> 16) & 0xffff) != (b & 0xffff))\r\n      {\r\n        s->mode = BAD;\r\n        z->msg = (char*)\"invalid stored block lengths\";\r\n        r = Z_DATA_ERROR;\r\n        LEAVE\r\n      }\r\n      s->sub.left = (uInt)b & 0xffff;\r\n      b = k = 0;                      /* dump bits */\r\n      Tracev((stderr, \"inflate:       stored length %u\\n\", s->sub.left));\r\n      s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);\r\n      break;\r\n    case STORED:\r\n      if (n == 0)\r\n        LEAVE\r\n      NEEDOUT\r\n      t = s->sub.left;\r\n      if (t > n) t = n;\r\n      if (t > m) t = m;\r\n      zmemcpy(q, p, t);\r\n      p += t;  n -= t;\r\n      q += t;  m -= t;\r\n      if ((s->sub.left -= t) != 0)\r\n        break;\r\n      Tracev((stderr, \"inflate:       stored end, %lu total out\\n\",\r\n              z->total_out + (q >= s->read ? q - s->read :\r\n              (s->end - s->read) + (q - s->window))));\r\n      s->mode = s->last ? DRY : TYPE;\r\n      break;\r\n    case TABLE:\r\n      NEEDBITS(14)\r\n      s->sub.trees.table = t = (uInt)b & 0x3fff;\r\n#ifndef PKZIP_BUG_WORKAROUND\r\n      if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)\r\n      {\r\n        s->mode = BAD;\r\n        z->msg = (char*)\"too many length or distance symbols\";\r\n        r = Z_DATA_ERROR;\r\n        LEAVE\r\n      }\r\n#endif\r\n      t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);\r\n      if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)\r\n      {\r\n        r = Z_MEM_ERROR;\r\n        LEAVE\r\n      }\r\n      DUMPBITS(14)\r\n      s->sub.trees.index = 0;\r\n      Tracev((stderr, \"inflate:       table sizes ok\\n\"));\r\n      s->mode = BTREE;\r\n    case BTREE:\r\n      while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))\r\n      {\r\n        NEEDBITS(3)\r\n        s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;\r\n        DUMPBITS(3)\r\n      }\r\n      while (s->sub.trees.index < 19)\r\n        s->sub.trees.blens[border[s->sub.trees.index++]] = 0;\r\n      s->sub.trees.bb = 7;\r\n      t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,\r\n                             &s->sub.trees.tb, s->hufts, z);\r\n      if (t != Z_OK)\r\n      {\r\n        r = t;\r\n        if (r == Z_DATA_ERROR)\r\n        {\r\n          ZFREE(z, s->sub.trees.blens);\r\n          s->mode = BAD;\r\n        }\r\n        LEAVE\r\n      }\r\n      s->sub.trees.index = 0;\r\n      Tracev((stderr, \"inflate:       bits tree ok\\n\"));\r\n      s->mode = DTREE;\r\n    case DTREE:\r\n      while (t = s->sub.trees.table,\r\n             s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))\r\n      {\r\n        inflate_huft *h;\r\n        uInt i, j, c;\r\n\r\n        t = s->sub.trees.bb;\r\n        NEEDBITS(t)\r\n        h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);\r\n        t = h->bits;\r\n        c = h->base;\r\n        if (c < 16)\r\n        {\r\n          DUMPBITS(t)\r\n          s->sub.trees.blens[s->sub.trees.index++] = c;\r\n        }\r\n        else /* c == 16..18 */\r\n        {\r\n          i = c == 18 ? 7 : c - 14;\r\n          j = c == 18 ? 11 : 3;\r\n          NEEDBITS(t + i)\r\n          DUMPBITS(t)\r\n          j += (uInt)b & inflate_mask[i];\r\n          DUMPBITS(i)\r\n          i = s->sub.trees.index;\r\n          t = s->sub.trees.table;\r\n          if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||\r\n              (c == 16 && i < 1))\r\n          {\r\n            ZFREE(z, s->sub.trees.blens);\r\n            s->mode = BAD;\r\n            z->msg = (char*)\"invalid bit length repeat\";\r\n            r = Z_DATA_ERROR;\r\n            LEAVE\r\n          }\r\n          c = c == 16 ? s->sub.trees.blens[i - 1] : 0;\r\n          do {\r\n            s->sub.trees.blens[i++] = c;\r\n          } while (--j);\r\n          s->sub.trees.index = i;\r\n        }\r\n      }\r\n      s->sub.trees.tb = Z_NULL;\r\n      {\r\n        uInt bl, bd;\r\n        inflate_huft *tl, *td;\r\n        inflate_codes_statef *c;\r\n\r\n        bl = 9;         /* must be <= 9 for lookahead assumptions */\r\n        bd = 6;         /* must be <= 9 for lookahead assumptions */\r\n        t = s->sub.trees.table;\r\n        t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),\r\n                                  s->sub.trees.blens, &bl, &bd, &tl, &td,\r\n                                  s->hufts, z);\r\n        if (t != Z_OK)\r\n        {\r\n          if (t == (uInt)Z_DATA_ERROR)\r\n          {\r\n            ZFREE(z, s->sub.trees.blens);\r\n            s->mode = BAD;\r\n          }\r\n          r = t;\r\n          LEAVE\r\n        }\r\n        Tracev((stderr, \"inflate:       trees ok\\n\"));\r\n        if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)\r\n        {\r\n          r = Z_MEM_ERROR;\r\n          LEAVE\r\n        }\r\n        s->sub.decode.codes = c;\r\n      }\r\n      ZFREE(z, s->sub.trees.blens);\r\n      s->mode = CODES;\r\n    case CODES:\r\n      UPDATE\r\n      if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)\r\n        return inflate_flush(s, z, r);\r\n      r = Z_OK;\r\n      inflate_codes_free(s->sub.decode.codes, z);\r\n      LOAD\r\n      Tracev((stderr, \"inflate:       codes end, %lu total out\\n\",\r\n              z->total_out + (q >= s->read ? q - s->read :\r\n              (s->end - s->read) + (q - s->window))));\r\n      if (!s->last)\r\n      {\r\n        s->mode = TYPE;\r\n        break;\r\n      }\r\n      s->mode = DRY;\r\n    case DRY:\r\n      FLUSH\r\n      if (s->read != s->write)\r\n        LEAVE\r\n      s->mode = DONE;\r\n    case DONE:\r\n      r = Z_STREAM_END;\r\n      LEAVE\r\n    case BAD:\r\n      r = Z_DATA_ERROR;\r\n      LEAVE\r\n    default:\r\n      r = Z_STREAM_ERROR;\r\n      LEAVE\r\n  }\r\n#ifdef NEED_DUMMY_RETURN\r\n  return 0;\r\n#endif\r\n}\r\n\r\n\r\nlocal int inflate_blocks_free( /* s, z) */\r\ninflate_blocks_statef *s,\r\nz_streamp z )\r\n{\r\n  inflate_blocks_reset(s, z, Z_NULL);\r\n  ZFREE(z, s->window);\r\n  ZFREE(z, s->hufts);\r\n  ZFREE(z, s);\r\n  Tracev((stderr, \"inflate:   blocks freed\\n\"));\r\n  return Z_OK;\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/infblock.h",
    "content": "/* infblock.h -- header to use infblock.c\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* WARNING: this file should *not* be used by applications. It is\r\n   part of the implementation of the compression library and is\r\n   subject to change. Applications should only use zlib.h.\r\n */\r\n\r\n#ifndef _INFBLOCK_H\r\n#define _INFBLOCK_H\r\n\r\nstruct inflate_blocks_state;\r\ntypedef struct inflate_blocks_state FAR inflate_blocks_statef;\r\n\r\nlocal  inflate_blocks_statef * inflate_blocks_new OF((\r\n    z_streamp z,\r\n    check_func c,               /* check function */\r\n    uInt w));                   /* window size */\r\n\r\nlocal  int inflate_blocks OF((\r\n    inflate_blocks_statef *,\r\n    z_streamp ,\r\n    int));                      /* initial return code */\r\n\r\nlocal  void inflate_blocks_reset OF((\r\n    inflate_blocks_statef *,\r\n    z_streamp ,\r\n    uLongf *));                  /* check value on output */\r\n\r\nlocal  int inflate_blocks_free OF((\r\n    inflate_blocks_statef *,\r\n    z_streamp));\r\n\r\n#endif /* _INFBLOCK_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/infcodes.c",
    "content": "/* infcodes.c -- process literals and length/distance pairs\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n#include \"zutil.h\"\r\n#include \"inftrees.h\"\r\n#include \"infblock.h\"\r\n#include \"infcodes.h\"\r\n#include \"infutil.h\"\r\n\r\n/* simplify the use of the inflate_huft type with some defines */\r\n#define exop word.what.Exop\r\n#define bits word.what.Bits\r\n\r\ntypedef enum {        /* waiting for \"i:\"=input, \"o:\"=output, \"x:\"=nothing */\r\n      START,    /* x: set up for LEN */\r\n      LEN,      /* i: get length/literal/eob next */\r\n      LENEXT,   /* i: getting length extra (have base) */\r\n      DIST,     /* i: get distance next */\r\n      DISTEXT,  /* i: getting distance extra */\r\n      COPY,     /* o: copying bytes in window, waiting for space */\r\n      LIT,      /* o: got literal, waiting for output space */\r\n      WASH,     /* o: got eob, possibly still output waiting */\r\n      END,      /* x: got eob and all data flushed */\r\n      BADCODE}  /* x: got error */\r\ninflate_codes_mode;\r\n\r\n/* inflate codes private state */\r\nstruct inflate_codes_state {\r\n\r\n  /* mode */\r\n  inflate_codes_mode mode;      /* current inflate_codes mode */\r\n\r\n  /* mode dependent information */\r\n  uInt len;\r\n  union {\r\n    struct {\r\n      inflate_huft *tree;       /* pointer into tree */\r\n      uInt need;                /* bits needed */\r\n    } code;             /* if LEN or DIST, where in tree */\r\n    uInt lit;           /* if LIT, literal */\r\n    struct {\r\n      uInt get;                 /* bits to get for extra */\r\n      uInt dist;                /* distance back to copy from */\r\n    } copy;             /* if EXT or COPY, where and how much */\r\n  } sub;                /* submode */\r\n\r\n  /* mode independent information */\r\n  Byte lbits;           /* ltree bits decoded per branch */\r\n  Byte dbits;           /* dtree bits decoder per branch */\r\n  inflate_huft *ltree;          /* literal/length/eob tree */\r\n  inflate_huft *dtree;          /* distance tree */\r\n\r\n};\r\n\r\n\r\nlocal inflate_codes_statef *inflate_codes_new( /* bl, bd, tl, td, z) */\r\nuInt bl, uInt bd,\r\ninflate_huft *tl,\r\ninflate_huft *td, /* need separate declaration for Borland C++ */\r\nz_streamp z )\r\n{\r\n  inflate_codes_statef *c;\r\n\r\n  if ((c = (inflate_codes_statef *)\r\n       ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)\r\n  {\r\n    c->mode = START;\r\n    c->lbits = (Byte)bl;\r\n    c->dbits = (Byte)bd;\r\n    c->ltree = tl;\r\n    c->dtree = td;\r\n    Tracev((stderr, \"inflate:       codes new\\n\"));\r\n  }\r\n  return c;\r\n}\r\n\r\n\r\nlocal int inflate_codes( /* s, z, r) */\r\ninflate_blocks_statef *s,\r\nz_streamp z,\r\nint r )\r\n{\r\n  uInt j;               /* temporary storage */\r\n  inflate_huft *t;      /* temporary pointer */\r\n  uInt e;               /* extra bits or operation */\r\n  uLong b;              /* bit buffer */\r\n  uInt k;               /* bits in bit buffer */\r\n  Bytef *p;             /* input data pointer */\r\n  uInt n;               /* bytes available there */\r\n  Bytef *q;             /* output window write pointer */\r\n  uInt m;               /* bytes to end of window or read pointer */\r\n  Bytef *f;             /* pointer to copy strings from */\r\n  inflate_codes_statef *c = s->sub.decode.codes;  /* codes state */\r\n\r\n  /* copy input/output information to locals (UPDATE macro restores) */\r\n  LOAD\r\n\r\n  /* process input and output based on current state */\r\n  while (1) switch (c->mode)\r\n  {             /* waiting for \"i:\"=input, \"o:\"=output, \"x:\"=nothing */\r\n    case START:         /* x: set up for LEN */\r\n#ifndef SLOW\r\n      if (m >= 258 && n >= 10)\r\n      {\r\n        UPDATE\r\n        r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);\r\n        LOAD\r\n        if (r != Z_OK)\r\n        {\r\n          c->mode = r == Z_STREAM_END ? WASH : BADCODE;\r\n          break;\r\n        }\r\n      }\r\n#endif /* !SLOW */\r\n      c->sub.code.need = c->lbits;\r\n      c->sub.code.tree = c->ltree;\r\n      c->mode = LEN;\r\n    case LEN:           /* i: get length/literal/eob next */\r\n      j = c->sub.code.need;\r\n      NEEDBITS(j)\r\n      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);\r\n      DUMPBITS(t->bits)\r\n      e = (uInt)(t->exop);\r\n      if (e == 0)               /* literal */\r\n      {\r\n        c->sub.lit = t->base;\r\n        Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?\r\n                 \"inflate:         literal '%c'\\n\" :\r\n                 \"inflate:         literal 0x%02x\\n\", t->base));\r\n        c->mode = LIT;\r\n        break;\r\n      }\r\n      if (e & 16)               /* length */\r\n      {\r\n        c->sub.copy.get = e & 15;\r\n        c->len = t->base;\r\n        c->mode = LENEXT;\r\n        break;\r\n      }\r\n      if ((e & 64) == 0)        /* next table */\r\n      {\r\n        c->sub.code.need = e;\r\n        c->sub.code.tree = t + t->base;\r\n        break;\r\n      }\r\n      if (e & 32)               /* end of block */\r\n      {\r\n        Tracevv((stderr, \"inflate:         end of block\\n\"));\r\n        c->mode = WASH;\r\n        break;\r\n      }\r\n      c->mode = BADCODE;        /* invalid code */\r\n      z->msg = (char*)\"invalid literal/length code\";\r\n      r = Z_DATA_ERROR;\r\n      LEAVE\r\n    case LENEXT:        /* i: getting length extra (have base) */\r\n      j = c->sub.copy.get;\r\n      NEEDBITS(j)\r\n      c->len += (uInt)b & inflate_mask[j];\r\n      DUMPBITS(j)\r\n      c->sub.code.need = c->dbits;\r\n      c->sub.code.tree = c->dtree;\r\n      Tracevv((stderr, \"inflate:         length %u\\n\", c->len));\r\n      c->mode = DIST;\r\n    case DIST:          /* i: get distance next */\r\n      j = c->sub.code.need;\r\n      NEEDBITS(j)\r\n      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);\r\n      DUMPBITS(t->bits)\r\n      e = (uInt)(t->exop);\r\n      if (e & 16)               /* distance */\r\n      {\r\n        c->sub.copy.get = e & 15;\r\n        c->sub.copy.dist = t->base;\r\n        c->mode = DISTEXT;\r\n        break;\r\n      }\r\n      if ((e & 64) == 0)        /* next table */\r\n      {\r\n        c->sub.code.need = e;\r\n        c->sub.code.tree = t + t->base;\r\n        break;\r\n      }\r\n      c->mode = BADCODE;        /* invalid code */\r\n      z->msg = (char*)\"invalid distance code\";\r\n      r = Z_DATA_ERROR;\r\n      LEAVE\r\n    case DISTEXT:       /* i: getting distance extra */\r\n      j = c->sub.copy.get;\r\n      NEEDBITS(j)\r\n      c->sub.copy.dist += (uInt)b & inflate_mask[j];\r\n      DUMPBITS(j)\r\n      Tracevv((stderr, \"inflate:         distance %u\\n\", c->sub.copy.dist));\r\n      c->mode = COPY;\r\n    case COPY:          /* o: copying bytes in window, waiting for space */\r\n      f = q - c->sub.copy.dist;\r\n      while (f < s->window)             /* modulo window size-\"while\" instead */\r\n        f += s->end - s->window;        /* of \"if\" handles invalid distances */\r\n      while (c->len)\r\n      {\r\n        NEEDOUT\r\n        OUTBYTE(*f++)\r\n        if (f == s->end)\r\n          f = s->window;\r\n        c->len--;\r\n      }\r\n      c->mode = START;\r\n      break;\r\n    case LIT:           /* o: got literal, waiting for output space */\r\n      NEEDOUT\r\n      OUTBYTE(c->sub.lit)\r\n      c->mode = START;\r\n      break;\r\n    case WASH:          /* o: got eob, possibly more output */\r\n      if (k > 7)        /* return unused byte, if any */\r\n      {\r\n        Assert(k < 16, \"inflate_codes grabbed too many bytes\")\r\n        k -= 8;\r\n        n++;\r\n        p--;            /* can always return one */\r\n      }\r\n      FLUSH\r\n      if (s->read != s->write)\r\n        LEAVE\r\n      c->mode = END;\r\n    case END:\r\n      r = Z_STREAM_END;\r\n      LEAVE\r\n    case BADCODE:       /* x: got error */\r\n      r = Z_DATA_ERROR;\r\n      LEAVE\r\n    default:\r\n      r = Z_STREAM_ERROR;\r\n      LEAVE\r\n  }\r\n#ifdef NEED_DUMMY_RETURN\r\n  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */\r\n#endif\r\n}\r\n\r\n\r\nlocal void inflate_codes_free( /* c, z) */\r\ninflate_codes_statef *c,\r\nz_streamp z )\r\n{\r\n  ZFREE(z, c);\r\n  Tracev((stderr, \"inflate:       codes free\\n\"));\r\n}\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/infcodes.h",
    "content": "/* infcodes.h -- header to use infcodes.c\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* WARNING: this file should *not* be used by applications. It is\r\n   part of the implementation of the compression library and is\r\n   subject to change. Applications should only use zlib.h.\r\n */\r\n\r\n#ifndef _INFCODES_H\r\n#define _INFCODES_H\r\n\r\nstruct inflate_codes_state;\r\ntypedef struct inflate_codes_state FAR inflate_codes_statef;\r\n\r\nlocal inflate_codes_statef *inflate_codes_new OF((\r\n    uInt, uInt,\r\n    inflate_huft *, inflate_huft *,\r\n    z_streamp ));\r\n\r\nlocal int inflate_codes OF((\r\n    inflate_blocks_statef *,\r\n    z_streamp ,\r\n    int));\r\n\r\nlocal void inflate_codes_free OF((\r\n    inflate_codes_statef *,\r\n    z_streamp ));\r\n\r\n#endif /* _INFCODES_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/inffixed.h",
    "content": "/* inffixed.h -- table for decoding fixed codes\r\n * Generated automatically by the maketree.c program\r\n */\r\n\r\n/* WARNING: this file should *not* be used by applications. It is\r\n   part of the implementation of the compression library and is\r\n   subject to change. Applications should only use zlib.h.\r\n */\r\n\r\nlocal const uInt fixed_bl = 9;\r\nlocal const uInt fixed_bd = 5;\r\nlocal const inflate_huft fixed_tl[] = {\r\n    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},\r\n    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},\r\n    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},\r\n    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},\r\n    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},\r\n    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},\r\n    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},\r\n    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},\r\n    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},\r\n    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},\r\n    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},\r\n    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},\r\n    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},\r\n    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},\r\n    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},\r\n    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},\r\n    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},\r\n    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},\r\n    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},\r\n    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},\r\n    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},\r\n    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},\r\n    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},\r\n    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},\r\n    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},\r\n    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},\r\n    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},\r\n    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},\r\n    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},\r\n    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},\r\n    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},\r\n    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},\r\n    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},\r\n    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},\r\n    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},\r\n    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},\r\n    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},\r\n    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},\r\n    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},\r\n    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},\r\n    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},\r\n    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},\r\n    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},\r\n    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},\r\n    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},\r\n    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},\r\n    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},\r\n    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},\r\n    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},\r\n    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},\r\n    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},\r\n    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},\r\n    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},\r\n    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},\r\n    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},\r\n    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},\r\n    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},\r\n    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},\r\n    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},\r\n    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},\r\n    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},\r\n    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},\r\n    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},\r\n    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},\r\n    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},\r\n    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},\r\n    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},\r\n    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},\r\n    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},\r\n    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},\r\n    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},\r\n    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},\r\n    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},\r\n    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},\r\n    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},\r\n    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},\r\n    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},\r\n    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},\r\n    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},\r\n    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},\r\n    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},\r\n    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},\r\n    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},\r\n    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},\r\n    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},\r\n    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},\r\n    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},\r\n    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},\r\n    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},\r\n    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},\r\n    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},\r\n    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},\r\n    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},\r\n    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},\r\n    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},\r\n    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},\r\n    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},\r\n    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},\r\n    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},\r\n    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},\r\n    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},\r\n    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},\r\n    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},\r\n    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},\r\n    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},\r\n    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},\r\n    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},\r\n    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},\r\n    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},\r\n    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},\r\n    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},\r\n    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},\r\n    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},\r\n    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},\r\n    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},\r\n    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},\r\n    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},\r\n    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},\r\n    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},\r\n    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},\r\n    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},\r\n    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},\r\n    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},\r\n    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},\r\n    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},\r\n    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},\r\n    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},\r\n    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}\r\n  };\r\nlocal const inflate_huft fixed_td[] = {\r\n    {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},\r\n    {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},\r\n    {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},\r\n    {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},\r\n    {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},\r\n    {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},\r\n    {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},\r\n    {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}\r\n  };\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/inflate.c",
    "content": "/* inflate.c -- zlib interface to inflate modules\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n#include \"zutil.h\"\r\n#include \"infblock.h\"\r\n\r\n#define  DONE  INFLATE_DONE\r\n#define  BAD   INFLATE_BAD\r\n\r\ntypedef enum {\r\n      METHOD,   /* waiting for method byte */\r\n      FLAG,     /* waiting for flag byte */\r\n      DICT4,    /* four dictionary check bytes to go */\r\n      DICT3,    /* three dictionary check bytes to go */\r\n      DICT2,    /* two dictionary check bytes to go */\r\n      DICT1,    /* one dictionary check byte to go */\r\n      DICT0,    /* waiting for inflateSetDictionary */\r\n      BLOCKS,   /* decompressing blocks */\r\n      CHECK4,   /* four check bytes to go */\r\n      CHECK3,   /* three check bytes to go */\r\n      CHECK2,   /* two check bytes to go */\r\n      CHECK1,   /* one check byte to go */\r\n      DONE,     /* finished check, done */\r\n      BAD}      /* got an error--stay here */\r\ninflate_mode;\r\n\r\n/* inflate private state */\r\nstruct internal_state {\r\n\r\n  /* mode */\r\n  inflate_mode  mode;   /* current inflate mode */\r\n\r\n  /* mode dependent information */\r\n  union {\r\n    uInt method;        /* if FLAGS, method byte */\r\n    struct {\r\n      uLong was;                /* computed check value */\r\n      uLong need;               /* stream check value */\r\n    } check;            /* if CHECK, check values to compare */\r\n    uInt marker;        /* if BAD, inflateSync's marker bytes count */\r\n  } sub;        /* submode */\r\n\r\n  /* mode independent information */\r\n  int  nowrap;          /* flag for no wrapper */\r\n  uInt wbits;           /* log2(window size)  (8..15, defaults to 15) */\r\n  inflate_blocks_statef\r\n    *blocks;            /* current inflate_blocks state */\r\n\r\n};\r\n\r\n\r\nZEXPORT(int) inflateReset( /* z) */\r\nz_streamp z )\r\n{\r\n  if (z == Z_NULL || z->state == Z_NULL)\r\n    return Z_STREAM_ERROR;\r\n  z->total_in = z->total_out = 0;\r\n  z->msg = Z_NULL;\r\n  z->state->mode = z->state->nowrap ? BLOCKS : METHOD;\r\n  inflate_blocks_reset(z->state->blocks, z, Z_NULL);\r\n  Tracev((stderr, \"inflate: reset\\n\"));\r\n  return Z_OK;\r\n}\r\n\r\n\r\nZEXPORT(int) inflateEnd( /* z) */\r\nz_streamp z )\r\n{\r\n  if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)\r\n    return Z_STREAM_ERROR;\r\n  if (z->state->blocks != Z_NULL)\r\n    inflate_blocks_free(z->state->blocks, z);\r\n  ZFREE(z, z->state);\r\n  z->state = Z_NULL;\r\n  Tracev((stderr, \"inflate: end\\n\"));\r\n  return Z_OK;\r\n}\r\n\r\n\r\nZEXPORT(int) inflateInit2_( /* z, w, version, stream_size) */\r\nz_streamp z,\r\nint w,\r\nconst char *version,\r\nint stream_size )\r\n{\r\n  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||\r\n      stream_size != sizeof(z_stream))\r\n      return Z_VERSION_ERROR;\r\n\r\n  /* initialize state */\r\n  if (z == Z_NULL)\r\n    return Z_STREAM_ERROR;\r\n  z->msg = Z_NULL;\r\n  if (z->zalloc == Z_NULL)\r\n  {\r\n    z->zalloc = zcalloc;\r\n    z->opaque = (voidpf)0;\r\n  }\r\n  if (z->zfree == Z_NULL) z->zfree = zcfree;\r\n  if ((z->state = (struct internal_state FAR *)\r\n       ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)\r\n    return Z_MEM_ERROR;\r\n  z->state->blocks = Z_NULL;\r\n\r\n  /* handle undocumented nowrap option (no zlib header or check) */\r\n  z->state->nowrap = 0;\r\n  if (w < 0)\r\n  {\r\n    w = - w;\r\n    z->state->nowrap = 1;\r\n  }\r\n\r\n  /* set window size */\r\n  if (w < 8 || w > 15)\r\n  {\r\n    inflateEnd(z);\r\n    return Z_STREAM_ERROR;\r\n  }\r\n  z->state->wbits = (uInt)w;\r\n\r\n  /* create inflate_blocks state */\r\n  if ((z->state->blocks =\r\n      inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))\r\n      == Z_NULL)\r\n  {\r\n    inflateEnd(z);\r\n    return Z_MEM_ERROR;\r\n  }\r\n  Tracev((stderr, \"inflate: allocated\\n\"));\r\n\r\n  /* reset state */\r\n  inflateReset(z);\r\n  return Z_OK;\r\n}\r\n\r\n\r\n\r\n#undef  NEEDBYTE\r\n#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}\r\n\r\n#undef  NEXTBYTE\r\n#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)\r\n\r\n\r\nZEXPORT(int) inflate( /* z, f) */\r\nz_streamp z,\r\nint f )\r\n{\r\n  int r;\r\n  uInt b;\r\n\r\n  if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)\r\n    return Z_STREAM_ERROR;\r\n  f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;\r\n  r = Z_BUF_ERROR;\r\n  while (1) switch (z->state->mode)\r\n  {\r\n    case METHOD:\r\n      NEEDBYTE\r\n      if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)\r\n      {\r\n        z->state->mode = BAD;\r\n        z->msg = (char*)\"unknown compression method\";\r\n        z->state->sub.marker = 5;       /* can't try inflateSync */\r\n        break;\r\n      }\r\n      if ((z->state->sub.method >> 4) + 8 > z->state->wbits)\r\n      {\r\n        z->state->mode = BAD;\r\n        z->msg = (char*)\"invalid window size\";\r\n        z->state->sub.marker = 5;       /* can't try inflateSync */\r\n        break;\r\n      }\r\n      z->state->mode = FLAG;\r\n    case FLAG:\r\n      NEEDBYTE\r\n      b = NEXTBYTE;\r\n      if (((z->state->sub.method << 8) + b) % 31)\r\n      {\r\n        z->state->mode = BAD;\r\n        z->msg = (char*)\"incorrect header check\";\r\n        z->state->sub.marker = 5;       /* can't try inflateSync */\r\n        break;\r\n      }\r\n      Tracev((stderr, \"inflate: zlib header ok\\n\"));\r\n      if (!(b & PRESET_DICT))\r\n      {\r\n        z->state->mode = BLOCKS;\r\n        break;\r\n      }\r\n      z->state->mode = DICT4;\r\n    case DICT4:\r\n      NEEDBYTE\r\n      z->state->sub.check.need = (uLong)NEXTBYTE << 24;\r\n      z->state->mode = DICT3;\r\n    case DICT3:\r\n      NEEDBYTE\r\n      z->state->sub.check.need += (uLong)NEXTBYTE << 16;\r\n      z->state->mode = DICT2;\r\n    case DICT2:\r\n      NEEDBYTE\r\n      z->state->sub.check.need += (uLong)NEXTBYTE << 8;\r\n      z->state->mode = DICT1;\r\n    case DICT1:\r\n      NEEDBYTE\r\n      z->state->sub.check.need += (uLong)NEXTBYTE;\r\n      z->adler = z->state->sub.check.need;\r\n      z->state->mode = DICT0;\r\n      return Z_NEED_DICT;\r\n    case DICT0:\r\n      z->state->mode = BAD;\r\n      z->msg = (char*)\"need dictionary\";\r\n      z->state->sub.marker = 0;       /* can try inflateSync */\r\n      return Z_STREAM_ERROR;\r\n    case BLOCKS:\r\n      r = inflate_blocks(z->state->blocks, z, r);\r\n      if (r == Z_DATA_ERROR)\r\n      {\r\n        z->state->mode = BAD;\r\n        z->state->sub.marker = 0;       /* can try inflateSync */\r\n        break;\r\n      }\r\n      if (r == Z_OK)\r\n        r = f;\r\n      if (r != Z_STREAM_END)\r\n        return r;\r\n      r = f;\r\n      inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);\r\n      if (z->state->nowrap)\r\n      {\r\n        z->state->mode = DONE;\r\n        break;\r\n      }\r\n      z->state->mode = CHECK4;\r\n    case CHECK4:\r\n      NEEDBYTE\r\n      z->state->sub.check.need = (uLong)NEXTBYTE << 24;\r\n      z->state->mode = CHECK3;\r\n    case CHECK3:\r\n      NEEDBYTE\r\n      z->state->sub.check.need += (uLong)NEXTBYTE << 16;\r\n      z->state->mode = CHECK2;\r\n    case CHECK2:\r\n      NEEDBYTE\r\n      z->state->sub.check.need += (uLong)NEXTBYTE << 8;\r\n      z->state->mode = CHECK1;\r\n    case CHECK1:\r\n      NEEDBYTE\r\n      z->state->sub.check.need += (uLong)NEXTBYTE;\r\n\r\n      if (z->state->sub.check.was != z->state->sub.check.need)\r\n      {\r\n        z->state->mode = BAD;\r\n        z->msg = (char*)\"incorrect data check\";\r\n        z->state->sub.marker = 5;       /* can't try inflateSync */\r\n        break;\r\n      }\r\n      Tracev((stderr, \"inflate: zlib check ok\\n\"));\r\n      z->state->mode = DONE;\r\n    case DONE:\r\n      return Z_STREAM_END;\r\n    case BAD:\r\n      return Z_DATA_ERROR;\r\n    default:\r\n      return Z_STREAM_ERROR;\r\n  }\r\n#ifdef NEED_DUMMY_RETURN\r\n  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */\r\n#endif\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/inftrees.c",
    "content": "/* inftrees.c -- generate Huffman trees for efficient decoding\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n#include \"zutil.h\"\r\n#include \"inftrees.h\"\r\n\r\n#if !defined(BUILDFIXED) && !defined(STDC)\r\n#  define BUILDFIXED   /* non ANSI compilers may not accept inffixed.h */\r\n#endif\r\n\r\n\r\n#if 0\r\nlocal const char inflate_copyright[] =\r\n   \" inflate 1.1.4 Copyright 1995-2002 Mark Adler \";\r\n#endif\r\n/*\r\n  If you use the zlib library in a product, an acknowledgment is welcome\r\n  in the documentation of your product. If for some reason you cannot\r\n  include such an acknowledgment, I would appreciate that you keep this\r\n  copyright string in the executable of your product.\r\n */\r\n\r\n/* simplify the use of the inflate_huft type with some defines */\r\n#define exop word.what.Exop\r\n#define bits word.what.Bits\r\n\r\n\r\nlocal int huft_build OF((\r\n    uIntf *,            /* code lengths in bits */\r\n    uInt,               /* number of codes */\r\n    uInt,               /* number of \"simple\" codes */\r\n    const uIntf *,      /* list of base values for non-simple codes */\r\n    const uIntf *,      /* list of extra bits for non-simple codes */\r\n    inflate_huft * FAR*,/* result: starting table */\r\n    uIntf *,            /* maximum lookup bits (returns actual) */\r\n    inflate_huft *,     /* space for trees */\r\n    uInt *,             /* hufts used in space */\r\n    uIntf * ));         /* space for values */\r\n\r\n/* Tables for deflate from PKZIP's appnote.txt. */\r\nlocal const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */\r\n        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\r\n        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};\r\n        /* see note #13 above about 258 */\r\nlocal const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */\r\n        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,\r\n        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */\r\nlocal const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */\r\n        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\r\n        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\r\n        8193, 12289, 16385, 24577};\r\nlocal const uInt cpdext[30] = { /* Extra bits for distance codes */\r\n        0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,\r\n        7, 7, 8, 8, 9, 9, 10, 10, 11, 11,\r\n        12, 12, 13, 13};\r\n\r\n/*\r\n   Huffman code decoding is performed using a multi-level table lookup.\r\n   The fastest way to decode is to simply build a lookup table whose\r\n   size is determined by the longest code.  However, the time it takes\r\n   to build this table can also be a factor if the data being decoded\r\n   is not very long.  The most common codes are necessarily the\r\n   shortest codes, so those codes dominate the decoding time, and hence\r\n   the speed.  The idea is you can have a shorter table that decodes the\r\n   shorter, more probable codes, and then point to subsidiary tables for\r\n   the longer codes.  The time it costs to decode the longer codes is\r\n   then traded against the time it takes to make longer tables.\r\n\r\n   This results of this trade are in the variables lbits and dbits\r\n   below.  lbits is the number of bits the first level table for literal/\r\n   length codes can decode in one step, and dbits is the same thing for\r\n   the distance codes.  Subsequent tables are also less than or equal to\r\n   those sizes.  These values may be adjusted either when all of the\r\n   codes are shorter than that, in which case the longest code length in\r\n   bits is used, or when the shortest code is *longer* than the requested\r\n   table size, in which case the length of the shortest code in bits is\r\n   used.\r\n\r\n   There are two different values for the two tables, since they code a\r\n   different number of possibilities each.  The literal/length table\r\n   codes 286 possible values, or in a flat code, a little over eight\r\n   bits.  The distance table codes 30 possible values, or a little less\r\n   than five bits, flat.  The optimum values for speed end up being\r\n   about one bit more than those, so lbits is 8+1 and dbits is 5+1.\r\n   The optimum values may differ though from machine to machine, and\r\n   possibly even between compilers.  Your mileage may vary.\r\n */\r\n\r\n\r\n/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */\r\n#define BMAX 15         /* maximum bit length of any code */\r\n\r\nlocal int huft_build( /* b, n, s, d, e, t, m, hp, hn, v) */\r\nuIntf *b,               /* code lengths in bits (all assumed <= BMAX) */\r\nuInt n,                 /* number of codes (assumed <= 288) */\r\nuInt s,                 /* number of simple-valued codes (0..s-1) */\r\nconst uIntf *d,         /* list of base values for non-simple codes */\r\nconst uIntf *e,         /* list of extra bits for non-simple codes */\r\ninflate_huft * FAR *t,  /* result: starting table */\r\nuIntf *m,               /* maximum lookup bits, returns actual */\r\ninflate_huft *hp,       /* space for trees */\r\nuInt *hn,               /* hufts used in space */\r\nuIntf *v                /* working area: values in order of bit length */\r\n/* Given a list of code lengths and a maximum table size, make a set of\r\n   tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR\r\n   if the given code set is incomplete (the tables are still built in this\r\n   case), or Z_DATA_ERROR if the input is invalid. */\r\n)\r\n{\r\n\r\n  uInt a;                       /* counter for codes of length k */\r\n  uInt c[BMAX+1];               /* bit length count table */\r\n  uInt f;                       /* i repeats in table every f entries */\r\n  int g;                        /* maximum code length */\r\n  int h;                        /* table level */\r\n  register uInt i;              /* counter, current code */\r\n  register uInt j;              /* counter */\r\n  register int k;               /* number of bits in current code */\r\n  int l;                        /* bits per table (returned in m) */\r\n  uInt mask;                    /* (1 << w) - 1, to avoid cc -O bug on HP */\r\n  register uIntf *p;            /* pointer into c[], b[], or v[] */\r\n  inflate_huft *q;              /* points to current table */\r\n  struct inflate_huft_s r;      /* table entry for structure assignment */\r\n  inflate_huft *u[BMAX];        /* table stack */\r\n  register int w;               /* bits before this table == (l * h) */\r\n  uInt x[BMAX+1];               /* bit offsets, then code stack */\r\n  uIntf *xp;                    /* pointer into x */\r\n  int y;                        /* number of dummy codes added */\r\n  uInt z;                       /* number of entries in current table */\r\n\r\n\r\n  /* Make compiler happy */\r\n  r.base = 0;\r\n\r\n  /* Generate counts for each bit length */\r\n  p = c;\r\n#define C0 *p++ = 0;\r\n#define C2 C0 C0 C0 C0\r\n#define C4 C2 C2 C2 C2\r\n  C4                            /* clear c[]--assume BMAX+1 is 16 */\r\n  p = b;  i = n;\r\n  do {\r\n    c[*p++]++;                  /* assume all entries <= BMAX */\r\n  } while (--i);\r\n  if (c[0] == n)                /* null input--all zero length codes */\r\n  {\r\n    *t = (inflate_huft *)Z_NULL;\r\n    *m = 0;\r\n    return Z_OK;\r\n  }\r\n\r\n\r\n  /* Find minimum and maximum length, bound *m by those */\r\n  l = *m;\r\n  for (j = 1; j <= BMAX; j++)\r\n    if (c[j])\r\n      break;\r\n  k = j;                        /* minimum code length */\r\n  if ((uInt)l < j)\r\n    l = j;\r\n  for (i = BMAX; i; i--)\r\n    if (c[i])\r\n      break;\r\n  g = i;                        /* maximum code length */\r\n  if ((uInt)l > i)\r\n    l = i;\r\n  *m = l;\r\n\r\n\r\n  /* Adjust last length count to fill out codes, if needed */\r\n  for (y = 1 << j; j < i; j++, y <<= 1)\r\n    if ((y -= c[j]) < 0)\r\n      return Z_DATA_ERROR;\r\n  if ((y -= c[i]) < 0)\r\n    return Z_DATA_ERROR;\r\n  c[i] += y;\r\n\r\n\r\n  /* Generate starting offsets into the value table for each length */\r\n  x[1] = j = 0;\r\n  p = c + 1;  xp = x + 2;\r\n  while (--i) {                 /* note that i == g from above */\r\n    *xp++ = (j += *p++);\r\n  }\r\n\r\n\r\n  /* Make a table of values in order of bit lengths */\r\n  p = b;  i = 0;\r\n  do {\r\n    if ((j = *p++) != 0)\r\n      v[x[j]++] = i;\r\n  } while (++i < n);\r\n  n = x[g];                     /* set n to length of v */\r\n\r\n\r\n  /* Generate the Huffman codes and for each, make the table entries */\r\n  x[0] = i = 0;                 /* first Huffman code is zero */\r\n  p = v;                        /* grab values in bit order */\r\n  h = -1;                       /* no tables yet--level -1 */\r\n  w = -l;                       /* bits decoded == (l * h) */\r\n  u[0] = (inflate_huft *)Z_NULL;        /* just to keep compilers happy */\r\n  q = (inflate_huft *)Z_NULL;   /* ditto */\r\n  z = 0;                        /* ditto */\r\n\r\n  /* go through the bit lengths (k already is bits in shortest code) */\r\n  for (; k <= g; k++)\r\n  {\r\n    a = c[k];\r\n    while (a--)\r\n    {\r\n      /* here i is the Huffman code of length k bits for value *p */\r\n      /* make tables up to required level */\r\n      while (k > w + l)\r\n      {\r\n        h++;\r\n        w += l;                 /* previous table always l bits */\r\n\r\n        /* compute minimum size table less than or equal to l bits */\r\n        z = g - w;\r\n        z = z > (uInt)l ? (uInt)l : z;        /* table size upper limit */\r\n        if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */\r\n        {                       /* too few codes for k-w bit table */\r\n          f -= a + 1;           /* deduct codes from patterns left */\r\n          xp = c + k;\r\n          if (j < z)\r\n            while (++j < z)     /* try smaller tables up to z bits */\r\n            {\r\n              if ((f <<= 1) <= *++xp)\r\n                break;          /* enough codes to use up j bits */\r\n              f -= *xp;         /* else deduct codes from patterns */\r\n            }\r\n        }\r\n        z = 1 << j;             /* table entries for j-bit table */\r\n\r\n        /* allocate new table */\r\n        if (*hn + z > MANY)     /* (note: doesn't matter for fixed) */\r\n          return Z_DATA_ERROR;  /* overflow of MANY */\r\n        u[h] = q = hp + *hn;\r\n        *hn += z;\r\n\r\n        /* connect to last table, if there is one */\r\n        if (h)\r\n        {\r\n          x[h] = i;             /* save pattern for backing up */\r\n          r.bits = (Byte)l;     /* bits to dump before this table */\r\n          r.exop = (Byte)j;     /* bits in this table */\r\n          j = i >> (w - l);\r\n          r.base = (uInt)(q - u[h-1] - j);   /* offset to this table */\r\n          u[h-1][j] = r;        /* connect to last table */\r\n        }\r\n        else\r\n          *t = q;               /* first table is returned result */\r\n      }\r\n\r\n      /* set up table entry in r */\r\n      r.bits = (Byte)(k - w);\r\n      if (p >= v + n)\r\n        r.exop = 128 + 64;      /* out of values--invalid code */\r\n      else if (*p < s)\r\n      {\r\n        r.exop = (Byte)(*p < 256 ? 0 : 32 + 64);     /* 256 is end-of-block */\r\n        r.base = *p++;          /* simple code is just the value */\r\n      }\r\n      else\r\n      {\r\n        r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */\r\n        r.base = d[*p++ - s];\r\n      }\r\n\r\n      /* fill code-like entries with r */\r\n      f = 1 << (k - w);\r\n      for (j = i >> w; j < z; j += f)\r\n        q[j] = r;\r\n\r\n      /* backwards increment the k-bit code i */\r\n      for (j = 1 << (k - 1); i & j; j >>= 1)\r\n        i ^= j;\r\n      i ^= j;\r\n\r\n      /* backup over finished tables */\r\n      mask = (1 << w) - 1;      /* needed on HP, cc -O bug */\r\n      while ((i & mask) != x[h])\r\n      {\r\n        h--;                    /* don't need to update q */\r\n        w -= l;\r\n        mask = (1 << w) - 1;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* Return Z_BUF_ERROR if we were given an incomplete table */\r\n  return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;\r\n}\r\n\r\n\r\nlocal int inflate_trees_bits( /* c, bb, tb, hp, z) */\r\nuIntf *c,               /* 19 code lengths */\r\nuIntf *bb,              /* bits tree desired/actual depth */\r\ninflate_huft * FAR *tb, /* bits tree result */\r\ninflate_huft *hp,       /* space for trees */\r\nz_streamp z             /* for messages */\r\n)\r\n{\r\n  int r;\r\n  uInt hn = 0;          /* hufts used in space */\r\n  uIntf *v;             /* work area for huft_build */\r\n\r\n  if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)\r\n    return Z_MEM_ERROR;\r\n  r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,\r\n                 tb, bb, hp, &hn, v);\r\n  if (r == Z_DATA_ERROR)\r\n    z->msg = (char*)\"oversubscribed dynamic bit lengths tree\";\r\n  else if (r == Z_BUF_ERROR || *bb == 0)\r\n  {\r\n    z->msg = (char*)\"incomplete dynamic bit lengths tree\";\r\n    r = Z_DATA_ERROR;\r\n  }\r\n  ZFREE(z, v);\r\n  return r;\r\n}\r\n\r\n\r\nlocal int inflate_trees_dynamic( /* nl, nd, c, bl, bd, tl, td, hp, z) */\r\nuInt nl,                /* number of literal/length codes */\r\nuInt nd,                /* number of distance codes */\r\nuIntf *c,               /* that many (total) code lengths */\r\nuIntf *bl,              /* literal desired/actual bit depth */\r\nuIntf *bd,              /* distance desired/actual bit depth */\r\ninflate_huft * FAR *tl, /* literal/length tree result */\r\ninflate_huft * FAR *td, /* distance tree result */\r\ninflate_huft *hp,       /* space for trees */\r\nz_streamp z             /* for messages */\r\n)\r\n{\r\n  int r;\r\n  uInt hn = 0;          /* hufts used in space */\r\n  uIntf *v;             /* work area for huft_build */\r\n\r\n  /* allocate work area */\r\n  if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)\r\n    return Z_MEM_ERROR;\r\n\r\n  /* build literal/length tree */\r\n  r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);\r\n  if (r != Z_OK || *bl == 0)\r\n  {\r\n    if (r == Z_DATA_ERROR)\r\n      z->msg = (char*)\"oversubscribed literal/length tree\";\r\n    else if (r != Z_MEM_ERROR)\r\n    {\r\n      z->msg = (char*)\"incomplete literal/length tree\";\r\n      r = Z_DATA_ERROR;\r\n    }\r\n    ZFREE(z, v);\r\n    return r;\r\n  }\r\n\r\n  /* build distance tree */\r\n  r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);\r\n  if (r != Z_OK || (*bd == 0 && nl > 257))\r\n  {\r\n    if (r == Z_DATA_ERROR)\r\n      z->msg = (char*)\"oversubscribed distance tree\";\r\n    else if (r == Z_BUF_ERROR) {\r\n#if 0\r\n    {\r\n#endif\r\n#ifdef PKZIP_BUG_WORKAROUND\r\n      r = Z_OK;\r\n    }\r\n#else\r\n      z->msg = (char*)\"incomplete distance tree\";\r\n      r = Z_DATA_ERROR;\r\n    }\r\n    else if (r != Z_MEM_ERROR)\r\n    {\r\n      z->msg = (char*)\"empty distance tree with lengths\";\r\n      r = Z_DATA_ERROR;\r\n    }\r\n    ZFREE(z, v);\r\n    return r;\r\n#endif\r\n  }\r\n\r\n  /* done */\r\n  ZFREE(z, v);\r\n  return Z_OK;\r\n}\r\n\r\n\r\n/* build fixed tables only once--keep them here */\r\n#ifdef BUILDFIXED\r\nlocal int fixed_built = 0;\r\n#define FIXEDH 544      /* number of hufts used by fixed tables */\r\nlocal inflate_huft fixed_mem[FIXEDH];\r\nlocal uInt fixed_bl;\r\nlocal uInt fixed_bd;\r\nlocal inflate_huft *fixed_tl;\r\nlocal inflate_huft *fixed_td;\r\n#else\r\n#include \"inffixed.h\"\r\n#endif\r\n\r\n\r\nlocal int inflate_trees_fixed( /* bl, bd, tl, td, z) */\r\nuIntf *bl,                      /* literal desired/actual bit depth */\r\nuIntf *bd,                      /* distance desired/actual bit depth */\r\nconst inflate_huft * FAR *tl,   /* literal/length tree result */\r\nconst inflate_huft * FAR *td,   /* distance tree result */\r\nz_streamp z                     /* for memory allocation */\r\n)\r\n{\r\n#ifdef BUILDFIXED\r\n  /* build fixed tables if not already */\r\n  if (!fixed_built)\r\n  {\r\n    int k;              /* temporary variable */\r\n    uInt f = 0;         /* number of hufts used in fixed_mem */\r\n    uIntf *c;           /* length list for huft_build */\r\n    uIntf *v;           /* work area for huft_build */\r\n\r\n    /* allocate memory */\r\n    if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)\r\n      return Z_MEM_ERROR;\r\n    if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)\r\n    {\r\n      ZFREE(z, c);\r\n      return Z_MEM_ERROR;\r\n    }\r\n\r\n    /* literal table */\r\n    for (k = 0; k < 144; k++)\r\n      c[k] = 8;\r\n    for (; k < 256; k++)\r\n      c[k] = 9;\r\n    for (; k < 280; k++)\r\n      c[k] = 7;\r\n    for (; k < 288; k++)\r\n      c[k] = 8;\r\n    fixed_bl = 9;\r\n    huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,\r\n               fixed_mem, &f, v);\r\n\r\n    /* distance table */\r\n    for (k = 0; k < 30; k++)\r\n      c[k] = 5;\r\n    fixed_bd = 5;\r\n    huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,\r\n               fixed_mem, &f, v);\r\n\r\n    /* done */\r\n    ZFREE(z, v);\r\n    ZFREE(z, c);\r\n    fixed_built = 1;\r\n  }\r\n#else\r\n  FT_UNUSED(z);\r\n#endif\r\n  *bl = fixed_bl;\r\n  *bd = fixed_bd;\r\n  *tl = fixed_tl;\r\n  *td = fixed_td;\r\n  return Z_OK;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/inftrees.h",
    "content": "/* inftrees.h -- header to use inftrees.c\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* WARNING: this file should *not* be used by applications. It is\r\n   part of the implementation of the compression library and is\r\n   subject to change. Applications should only use zlib.h.\r\n */\r\n\r\n/* Huffman code lookup table entry--this entry is four bytes for machines\r\n   that have 16-bit pointers (e.g. PC's in the small or medium model). */\r\n\r\n#ifndef _INFTREES_H\r\n#define _INFTREES_H\r\n\r\ntypedef struct inflate_huft_s FAR inflate_huft;\r\n\r\nstruct inflate_huft_s {\r\n  union {\r\n    struct {\r\n      Byte Exop;        /* number of extra bits or operation */\r\n      Byte Bits;        /* number of bits in this code or subcode */\r\n    } what;\r\n    uInt pad;           /* pad structure to a power of 2 (4 bytes for */\r\n  } word;               /*  16-bit, 8 bytes for 32-bit int's) */\r\n  uInt base;            /* literal, length base, distance base,\r\n                           or table offset */\r\n};\r\n\r\n/* Maximum size of dynamic tree.  The maximum found in a long but non-\r\n   exhaustive search was 1004 huft structures (850 for length/literals\r\n   and 154 for distances, the latter actually the result of an\r\n   exhaustive search).  The actual maximum is not known, but the\r\n   value below is more than safe. */\r\n#define MANY 1440\r\n\r\nlocal  int inflate_trees_bits OF((\r\n    uIntf *,                    /* 19 code lengths */\r\n    uIntf *,                    /* bits tree desired/actual depth */\r\n    inflate_huft * FAR *,       /* bits tree result */\r\n    inflate_huft *,             /* space for trees */\r\n    z_streamp));                /* for messages */\r\n\r\nlocal  int inflate_trees_dynamic OF((\r\n    uInt,                       /* number of literal/length codes */\r\n    uInt,                       /* number of distance codes */\r\n    uIntf *,                    /* that many (total) code lengths */\r\n    uIntf *,                    /* literal desired/actual bit depth */\r\n    uIntf *,                    /* distance desired/actual bit depth */\r\n    inflate_huft * FAR *,       /* literal/length tree result */\r\n    inflate_huft * FAR *,       /* distance tree result */\r\n    inflate_huft *,             /* space for trees */\r\n    z_streamp));                /* for messages */\r\n\r\nlocal  int inflate_trees_fixed OF((\r\n    uIntf *,                    /* literal desired/actual bit depth */\r\n    uIntf *,                    /* distance desired/actual bit depth */\r\n    const inflate_huft * FAR *, /* literal/length tree result */\r\n    const inflate_huft * FAR *, /* distance tree result */\r\n    z_streamp));                /* for memory allocation */\r\n\r\n#endif /* _INFTREES_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/infutil.c",
    "content": "/* inflate_util.c -- data and routines common to blocks and codes\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n#include \"zutil.h\"\r\n#include \"infblock.h\"\r\n#include \"inftrees.h\"\r\n#include \"infcodes.h\"\r\n#include \"infutil.h\"\r\n\r\n\r\n/* And'ing with mask[n] masks the lower n bits */\r\nlocal const uInt inflate_mask[17] = {\r\n    0x0000,\r\n    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,\r\n    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff\r\n};\r\n\r\n\r\n/* copy as much as possible from the sliding window to the output area */\r\nlocal int inflate_flush( /* s, z, r) */\r\ninflate_blocks_statef *s,\r\nz_streamp z,\r\nint r )\r\n{\r\n  uInt n;\r\n  Bytef *p;\r\n  Bytef *q;\r\n\r\n  /* local copies of source and destination pointers */\r\n  p = z->next_out;\r\n  q = s->read;\r\n\r\n  /* compute number of bytes to copy as far as end of window */\r\n  n = (uInt)((q <= s->write ? s->write : s->end) - q);\r\n  if (n > z->avail_out) n = z->avail_out;\r\n  if (n && r == Z_BUF_ERROR) r = Z_OK;\r\n\r\n  /* update counters */\r\n  z->avail_out -= n;\r\n  z->total_out += n;\r\n\r\n  /* update check information */\r\n  if (s->checkfn != Z_NULL)\r\n    z->adler = s->check = (*s->checkfn)(s->check, q, n);\r\n\r\n  /* copy as far as end of window */\r\n  zmemcpy(p, q, n);\r\n  p += n;\r\n  q += n;\r\n\r\n  /* see if more to copy at beginning of window */\r\n  if (q == s->end)\r\n  {\r\n    /* wrap pointers */\r\n    q = s->window;\r\n    if (s->write == s->end)\r\n      s->write = s->window;\r\n\r\n    /* compute bytes to copy */\r\n    n = (uInt)(s->write - q);\r\n    if (n > z->avail_out) n = z->avail_out;\r\n    if (n && r == Z_BUF_ERROR) r = Z_OK;\r\n\r\n    /* update counters */\r\n    z->avail_out -= n;\r\n    z->total_out += n;\r\n\r\n    /* update check information */\r\n    if (s->checkfn != Z_NULL)\r\n      z->adler = s->check = (*s->checkfn)(s->check, q, n);\r\n\r\n    /* copy */\r\n    zmemcpy(p, q, n);\r\n    p += n;\r\n    q += n;\r\n  }\r\n\r\n  /* update pointers */\r\n  z->next_out = p;\r\n  s->read = q;\r\n\r\n  /* done */\r\n  return r;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/infutil.h",
    "content": "/* infutil.h -- types and macros common to blocks and codes\r\n * Copyright (C) 1995-2002 Mark Adler\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* WARNING: this file should *not* be used by applications. It is\r\n   part of the implementation of the compression library and is\r\n   subject to change. Applications should only use zlib.h.\r\n */\r\n\r\n#ifndef _INFUTIL_H\r\n#define _INFUTIL_H\r\n\r\ntypedef enum {\r\n      TYPE,     /* get type bits (3, including end bit) */\r\n      LENS,     /* get lengths for stored */\r\n      STORED,   /* processing stored block */\r\n      TABLE,    /* get table lengths */\r\n      BTREE,    /* get bit lengths tree for a dynamic block */\r\n      DTREE,    /* get length, distance trees for a dynamic block */\r\n      CODES,    /* processing fixed or dynamic block */\r\n      DRY,      /* output remaining window bytes */\r\n      DONE,     /* finished last block, done */\r\n      BAD}      /* got a data error--stuck here */\r\ninflate_block_mode;\r\n\r\n/* inflate blocks semi-private state */\r\nstruct inflate_blocks_state {\r\n\r\n  /* mode */\r\n  inflate_block_mode  mode;     /* current inflate_block mode */\r\n\r\n  /* mode dependent information */\r\n  union {\r\n    uInt left;          /* if STORED, bytes left to copy */\r\n    struct {\r\n      uInt table;               /* table lengths (14 bits) */\r\n      uInt index;               /* index into blens (or border) */\r\n      uIntf *blens;             /* bit lengths of codes */\r\n      uInt bb;                  /* bit length tree depth */\r\n      inflate_huft *tb;         /* bit length decoding tree */\r\n    } trees;            /* if DTREE, decoding info for trees */\r\n    struct {\r\n      inflate_codes_statef\r\n         *codes;\r\n    } decode;           /* if CODES, current state */\r\n  } sub;                /* submode */\r\n  uInt last;            /* true if this block is the last block */\r\n\r\n  /* mode independent information */\r\n  uInt bitk;            /* bits in bit buffer */\r\n  uLong bitb;           /* bit buffer */\r\n  inflate_huft *hufts;  /* single malloc for tree space */\r\n  Bytef *window;        /* sliding window */\r\n  Bytef *end;           /* one byte after sliding window */\r\n  Bytef *read;          /* window read pointer */\r\n  Bytef *write;         /* window write pointer */\r\n  check_func checkfn;   /* check function */\r\n  uLong check;          /* check on output */\r\n\r\n};\r\n\r\n\r\n/* defines for inflate input/output */\r\n/*   update pointers and return */\r\n#define UPDBITS {s->bitb=b;s->bitk=k;}\r\n#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}\r\n#define UPDOUT {s->write=q;}\r\n#define UPDATE {UPDBITS UPDIN UPDOUT}\r\n#define LEAVE {UPDATE return inflate_flush(s,z,r);}\r\n/*   get bytes and bits */\r\n#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}\r\n#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}\r\n#define NEXTBYTE (n--,*p++)\r\n#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}\r\n#define DUMPBITS(j) {b>>=(j);k-=(j);}\r\n/*   output bytes */\r\n#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)\r\n#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}\r\n#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}\r\n#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}\r\n#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}\r\n#define OUTBYTE(a) {*q++=(Byte)(a);m--;}\r\n/*   load local pointers */\r\n#define LOAD {LOADIN LOADOUT}\r\n\r\n/* masks for lower bits (size given to avoid silly warnings with Visual C++) */\r\n#ifndef NO_INFLATE_MASK\r\nlocal uInt inflate_mask[17];\r\n#endif\r\n\r\n/* copy as much as possible from the sliding window to the output area */\r\nlocal int inflate_flush OF((\r\n    inflate_blocks_statef *,\r\n    z_streamp ,\r\n    int));\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/rules.mk",
    "content": "#\r\n# FreeType 2 GZip support configuration rules\r\n#\r\n\r\n\r\n# Copyright 2002, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# gzip driver directory\r\n#\r\nGZIP_DIR := $(SRC_DIR)/gzip\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nifeq ($(SYSTEM_ZLIB),)\r\n  GZIP_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(GZIP_DIR))\r\nelse\r\n  GZIP_COMPILE := $(FT_COMPILE)\r\nendif\r\n\r\n\r\n# gzip support sources (i.e., C files)\r\n#\r\nGZIP_DRV_SRC := $(GZIP_DIR)/ftgzip.c\r\n\r\n# gzip support headers\r\n#\r\nGZIP_DRV_H :=\r\n\r\n\r\n# gzip driver object(s)\r\n#\r\n#   GZIP_DRV_OBJ_M is used during `multi' builds\r\n#   GZIP_DRV_OBJ_S is used during `single' builds\r\n#\r\nifeq ($(SYSTEM_ZLIB),)\r\n  GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nelse\r\n  GZIP_DRV_OBJ_M := $(OBJ_DIR)/ftgzip.$O\r\nendif\r\nGZIP_DRV_OBJ_S := $(OBJ_DIR)/ftgzip.$O\r\n\r\n# gzip support source file for single build\r\n#\r\nGZIP_DRV_SRC_S := $(GZIP_DIR)/ftgzip.c\r\n\r\n\r\n# gzip support - single object\r\n#\r\n$(GZIP_DRV_OBJ_S): $(GZIP_DRV_SRC_S) $(GZIP_DRV_SRC) $(FREETYPE_H) \\\r\n                   $(GZIP_DRV_H)\r\n\t$(GZIP_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(GZIP_DRV_SRC_S))\r\n\r\n\r\n# gzip support - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(GZIP_DIR)/%.c $(FREETYPE_H) $(GZIP_DRV_H)\r\n\t$(GZIP_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(GZIP_DRV_OBJ_S)\r\nDRV_OBJS_M += $(GZIP_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/zconf.h",
    "content": "/* zconf.h -- configuration of the zlib compression library\r\n * Copyright (C) 1995-2002 Jean-loup Gailly.\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* @(#) $Id$ */\r\n\r\n#ifndef _ZCONF_H\r\n#define _ZCONF_H\r\n\r\n/*\r\n * If you *really* need a unique prefix for all types and library functions,\r\n * compile with -DZ_PREFIX. The \"standard\" zlib should be compiled without it.\r\n */\r\n#ifdef Z_PREFIX\r\n#  define deflateInit_         z_deflateInit_\r\n#  define deflate              z_deflate\r\n#  define deflateEnd           z_deflateEnd\r\n#  define inflateInit_         z_inflateInit_\r\n#  define inflate              z_inflate\r\n#  define inflateEnd           z_inflateEnd\r\n#  define deflateInit2_        z_deflateInit2_\r\n#  define deflateSetDictionary z_deflateSetDictionary\r\n#  define deflateCopy          z_deflateCopy\r\n#  define deflateReset         z_deflateReset\r\n#  define deflateParams        z_deflateParams\r\n#  define inflateInit2_        z_inflateInit2_\r\n#  define inflateSetDictionary z_inflateSetDictionary\r\n#  define inflateSync          z_inflateSync\r\n#  define inflateSyncPoint     z_inflateSyncPoint\r\n#  define inflateReset         z_inflateReset\r\n#  define compress             z_compress\r\n#  define compress2            z_compress2\r\n#  define uncompress           z_uncompress\r\n#  define adler32              z_adler32\r\n#  define crc32                z_crc32\r\n#  define get_crc_table        z_get_crc_table\r\n\r\n#  define Byte   z_Byte\r\n#  define uInt   z_uInt\r\n#  define uLong  z_uLong\r\n#  define Bytef  z_Bytef\r\n#  define charf  z_charf\r\n#  define intf   z_intf\r\n#  define uIntf  z_uIntf\r\n#  define uLongf z_uLongf\r\n#  define voidpf z_voidpf\r\n#  define voidp  z_voidp\r\n#endif\r\n\r\n#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)\r\n#  define WIN32\r\n#endif\r\n#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)\r\n#  ifndef __32BIT__\r\n#    define __32BIT__\r\n#  endif\r\n#endif\r\n#if defined(__MSDOS__) && !defined(MSDOS)\r\n#  define MSDOS\r\n#endif\r\n\r\n/* WinCE doesn't have errno.h */\r\n#ifdef _WIN32_WCE\r\n#  define NO_ERRNO_H\r\n#endif\r\n\r\n\r\n/*\r\n * Compile with -DMAXSEG_64K if the alloc function cannot allocate more\r\n * than 64k bytes at a time (needed on systems with 16-bit int).\r\n */\r\n#if defined(MSDOS) && !defined(__32BIT__)\r\n#  define MAXSEG_64K\r\n#endif\r\n#ifdef MSDOS\r\n#  define UNALIGNED_OK\r\n#endif\r\n\r\n#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)\r\n#  define STDC\r\n#endif\r\n#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)\r\n#  ifndef STDC\r\n#    define STDC\r\n#  endif\r\n#endif\r\n\r\n#ifndef STDC\r\n#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */\r\n#    define const\r\n#  endif\r\n#endif\r\n\r\n/* Some Mac compilers merge all .h files incorrectly: */\r\n#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)\r\n#  define NO_DUMMY_DECL\r\n#endif\r\n\r\n/* Old Borland C and LCC incorrectly complains about missing returns: */\r\n#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)\r\n#  define NEED_DUMMY_RETURN\r\n#endif\r\n\r\n#if defined(__LCC__)\r\n#  define  NEED_DUMMY_RETURN\r\n#endif\r\n\r\n/* Maximum value for memLevel in deflateInit2 */\r\n#ifndef MAX_MEM_LEVEL\r\n#  ifdef MAXSEG_64K\r\n#    define MAX_MEM_LEVEL 8\r\n#  else\r\n#    define MAX_MEM_LEVEL 9\r\n#  endif\r\n#endif\r\n\r\n/* Maximum value for windowBits in deflateInit2 and inflateInit2.\r\n * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files\r\n * created by gzip. (Files created by minigzip can still be extracted by\r\n * gzip.)\r\n */\r\n#ifndef MAX_WBITS\r\n#  define MAX_WBITS   15 /* 32K LZ77 window */\r\n#endif\r\n\r\n/* The memory requirements for deflate are (in bytes):\r\n            (1 << (windowBits+2)) +  (1 << (memLevel+9))\r\n that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)\r\n plus a few kilobytes for small objects. For example, if you want to reduce\r\n the default memory requirements from 256K to 128K, compile with\r\n     make CFLAGS=\"-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7\"\r\n Of course this will generally degrade compression (there's no free lunch).\r\n\r\n   The memory requirements for inflate are (in bytes) 1 << windowBits\r\n that is, 32K for windowBits=15 (default value) plus a few kilobytes\r\n for small objects.\r\n*/\r\n\r\n                        /* Type declarations */\r\n\r\n#ifndef OF /* function prototypes */\r\n#  ifdef STDC\r\n#    define OF(args)  args\r\n#  else\r\n#    define OF(args)  ()\r\n#  endif\r\n#endif\r\n\r\n/* The following definitions for FAR are needed only for MSDOS mixed\r\n * model programming (small or medium model with some far allocations).\r\n * This was tested only with MSC; for other MSDOS compilers you may have\r\n * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,\r\n * just define FAR to be empty.\r\n */\r\n#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)\r\n   /* MSC small or medium model */\r\n#  define SMALL_MEDIUM\r\n#  ifdef _MSC_VER\r\n#    define FAR _far\r\n#  else\r\n#    define FAR far\r\n#  endif\r\n#endif\r\n#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))\r\n#  ifndef __32BIT__\r\n#    define SMALL_MEDIUM\r\n#    define FAR _far\r\n#  endif\r\n#endif\r\n\r\n/* Compile with -DZLIB_DLL for Windows DLL support */\r\n#if defined(ZLIB_DLL)\r\n#  if defined(_WINDOWS) || defined(WINDOWS)\r\n#    ifdef FAR\r\n#      undef FAR\r\n#    endif\r\n#    include <windows.h>\r\n#    define ZEXPORT(x)  x WINAPI\r\n#    ifdef WIN32\r\n#      define ZEXPORTVA(x)  x WINAPIV\r\n#    else\r\n#      define ZEXPORTVA(x)  x FAR _cdecl _export\r\n#    endif\r\n#  endif\r\n#  if defined (__BORLANDC__)\r\n#    if (__BORLANDC__ >= 0x0500) && defined (WIN32)\r\n#      include <windows.h>\r\n#      define ZEXPORT(x) x __declspec(dllexport) WINAPI\r\n#      define ZEXPORTRVA(x)  x __declspec(dllexport) WINAPIV\r\n#    else\r\n#      if defined (_Windows) && defined (__DLL__)\r\n#        define ZEXPORT(x) x _export\r\n#        define ZEXPORTVA(x) x _export\r\n#      endif\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n\r\n#ifndef ZEXPORT\r\n#  define ZEXPORT(x)   static x\r\n#endif\r\n#ifndef ZEXPORTVA\r\n#  define ZEXPORTVA(x)   static x\r\n#endif\r\n#ifndef ZEXTERN\r\n#  define ZEXTERN(x) static x\r\n#endif\r\n#ifndef ZEXTERNDEF\r\n#  define ZEXTERNDEF(x)  static x\r\n#endif\r\n\r\n#ifndef FAR\r\n#   define FAR\r\n#endif\r\n\r\n#if !defined(MACOS) && !defined(TARGET_OS_MAC)\r\ntypedef unsigned char  Byte;  /* 8 bits */\r\n#endif\r\ntypedef unsigned int   uInt;  /* 16 bits or more */\r\ntypedef unsigned long  uLong; /* 32 bits or more */\r\n\r\n#ifdef SMALL_MEDIUM\r\n   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */\r\n#  define Bytef Byte FAR\r\n#else\r\n   typedef Byte  FAR Bytef;\r\n#endif\r\ntypedef char  FAR charf;\r\ntypedef int   FAR intf;\r\ntypedef uInt  FAR uIntf;\r\ntypedef uLong FAR uLongf;\r\n\r\n#ifdef STDC\r\n   typedef void FAR *voidpf;\r\n   typedef void     *voidp;\r\n#else\r\n   typedef Byte FAR *voidpf;\r\n   typedef Byte     *voidp;\r\n#endif\r\n\r\n#ifdef HAVE_UNISTD_H\r\n#  include <sys/types.h> /* for off_t */\r\n#  include <unistd.h>    /* for SEEK_* and off_t */\r\n#  define z_off_t  off_t\r\n#endif\r\n#ifndef SEEK_SET\r\n#  define SEEK_SET        0       /* Seek from beginning of file.  */\r\n#  define SEEK_CUR        1       /* Seek from current position.  */\r\n#  define SEEK_END        2       /* Set file pointer to EOF plus \"offset\" */\r\n#endif\r\n#ifndef z_off_t\r\n#  define  z_off_t long\r\n#endif\r\n\r\n/* MVS linker does not support external names larger than 8 bytes */\r\n#if defined(__MVS__)\r\n#   pragma map(deflateInit_,\"DEIN\")\r\n#   pragma map(deflateInit2_,\"DEIN2\")\r\n#   pragma map(deflateEnd,\"DEEND\")\r\n#   pragma map(inflateInit_,\"ININ\")\r\n#   pragma map(inflateInit2_,\"ININ2\")\r\n#   pragma map(inflateEnd,\"INEND\")\r\n#   pragma map(inflateSync,\"INSY\")\r\n#   pragma map(inflateSetDictionary,\"INSEDI\")\r\n#   pragma map(inflate_blocks,\"INBL\")\r\n#   pragma map(inflate_blocks_new,\"INBLNE\")\r\n#   pragma map(inflate_blocks_free,\"INBLFR\")\r\n#   pragma map(inflate_blocks_reset,\"INBLRE\")\r\n#   pragma map(inflate_codes_free,\"INCOFR\")\r\n#   pragma map(inflate_codes,\"INCO\")\r\n#   pragma map(inflate_fast,\"INFA\")\r\n#   pragma map(inflate_flush,\"INFLU\")\r\n#   pragma map(inflate_mask,\"INMA\")\r\n#   pragma map(inflate_set_dictionary,\"INSEDI2\")\r\n#   pragma map(inflate_copyright,\"INCOPY\")\r\n#   pragma map(inflate_trees_bits,\"INTRBI\")\r\n#   pragma map(inflate_trees_dynamic,\"INTRDY\")\r\n#   pragma map(inflate_trees_fixed,\"INTRFI\")\r\n#   pragma map(inflate_trees_free,\"INTRFR\")\r\n#endif\r\n\r\n#endif /* _ZCONF_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/zlib.h",
    "content": "/* zlib.h -- interface of the 'zlib' general purpose compression library\r\n  version 1.1.4, March 11th, 2002\r\n\r\n  Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler\r\n\r\n  This software is provided 'as-is', without any express or implied\r\n  warranty.  In no event will the authors be held liable for any damages\r\n  arising from the use of this software.\r\n\r\n  Permission is granted to anyone to use this software for any purpose,\r\n  including commercial applications, and to alter it and redistribute it\r\n  freely, subject to the following restrictions:\r\n\r\n  1. The origin of this software must not be misrepresented; you must not\r\n     claim that you wrote the original software. If you use this software\r\n     in a product, an acknowledgment in the product documentation would be\r\n     appreciated but is not required.\r\n  2. Altered source versions must be plainly marked as such, and must not be\r\n     misrepresented as being the original software.\r\n  3. This notice may not be removed or altered from any source distribution.\r\n\r\n  Jean-loup Gailly        Mark Adler\r\n  jloup@gzip.org          madler@alumni.caltech.edu\r\n\r\n\r\n  The data format used by the zlib library is described by RFCs (Request for\r\n  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt\r\n  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).\r\n*/\r\n\r\n#ifndef _ZLIB_H\r\n#define _ZLIB_H\r\n\r\n#include \"zconf.h\"\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define ZLIB_VERSION \"1.1.4\"\r\n\r\n/*\r\n     The 'zlib' compression library provides in-memory compression and\r\n  decompression functions, including integrity checks of the uncompressed\r\n  data.  This version of the library supports only one compression method\r\n  (deflation) but other algorithms will be added later and will have the same\r\n  stream interface.\r\n\r\n     Compression can be done in a single step if the buffers are large\r\n  enough (for example if an input file is mmap'ed), or can be done by\r\n  repeated calls of the compression function.  In the latter case, the\r\n  application must provide more input and/or consume the output\r\n  (providing more output space) before each call.\r\n\r\n     The library also supports reading and writing files in gzip (.gz) format\r\n  with an interface similar to that of stdio.\r\n\r\n     The library does not install any signal handler. The decoder checks\r\n  the consistency of the compressed data, so the library should never\r\n  crash even in case of corrupted input.\r\n*/\r\n\r\ntypedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));\r\ntypedef void   (*free_func)  OF((voidpf opaque, voidpf address));\r\n\r\nstruct internal_state;\r\n\r\ntypedef struct z_stream_s {\r\n    Bytef    *next_in;  /* next input byte */\r\n    uInt     avail_in;  /* number of bytes available at next_in */\r\n    uLong    total_in;  /* total nb of input bytes read so far */\r\n\r\n    Bytef    *next_out; /* next output byte should be put there */\r\n    uInt     avail_out; /* remaining free space at next_out */\r\n    uLong    total_out; /* total nb of bytes output so far */\r\n\r\n    char     *msg;      /* last error message, NULL if no error */\r\n    struct internal_state FAR *state; /* not visible by applications */\r\n\r\n    alloc_func zalloc;  /* used to allocate the internal state */\r\n    free_func  zfree;   /* used to free the internal state */\r\n    voidpf     opaque;  /* private data object passed to zalloc and zfree */\r\n\r\n    int     data_type;  /* best guess about the data type: ascii or binary */\r\n    uLong   adler;      /* adler32 value of the uncompressed data */\r\n    uLong   reserved;   /* reserved for future use */\r\n} z_stream;\r\n\r\ntypedef z_stream FAR *z_streamp;\r\n\r\n/*\r\n   The application must update next_in and avail_in when avail_in has\r\n   dropped to zero. It must update next_out and avail_out when avail_out\r\n   has dropped to zero. The application must initialize zalloc, zfree and\r\n   opaque before calling the init function. All other fields are set by the\r\n   compression library and must not be updated by the application.\r\n\r\n   The opaque value provided by the application will be passed as the first\r\n   parameter for calls of zalloc and zfree. This can be useful for custom\r\n   memory management. The compression library attaches no meaning to the\r\n   opaque value.\r\n\r\n   zalloc must return Z_NULL if there is not enough memory for the object.\r\n   If zlib is used in a multi-threaded application, zalloc and zfree must be\r\n   thread safe.\r\n\r\n   On 16-bit systems, the functions zalloc and zfree must be able to allocate\r\n   exactly 65536 bytes, but will not be required to allocate more than this\r\n   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,\r\n   pointers returned by zalloc for objects of exactly 65536 bytes *must*\r\n   have their offset normalized to zero. The default allocation function\r\n   provided by this library ensures this (see zutil.c). To reduce memory\r\n   requirements and avoid any allocation of 64K objects, at the expense of\r\n   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).\r\n\r\n   The fields total_in and total_out can be used for statistics or\r\n   progress reports. After compression, total_in holds the total size of\r\n   the uncompressed data and may be saved for use in the decompressor\r\n   (particularly if the decompressor wants to decompress everything in\r\n   a single step).\r\n*/\r\n\r\n                        /* constants */\r\n\r\n#define Z_NO_FLUSH      0\r\n#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */\r\n#define Z_SYNC_FLUSH    2\r\n#define Z_FULL_FLUSH    3\r\n#define Z_FINISH        4\r\n/* Allowed flush values; see deflate() below for details */\r\n\r\n#define Z_OK            0\r\n#define Z_STREAM_END    1\r\n#define Z_NEED_DICT     2\r\n#define Z_ERRNO        (-1)\r\n#define Z_STREAM_ERROR (-2)\r\n#define Z_DATA_ERROR   (-3)\r\n#define Z_MEM_ERROR    (-4)\r\n#define Z_BUF_ERROR    (-5)\r\n#define Z_VERSION_ERROR (-6)\r\n/* Return codes for the compression/decompression functions. Negative\r\n * values are errors, positive values are used for special but normal events.\r\n */\r\n\r\n#define Z_NO_COMPRESSION         0\r\n#define Z_BEST_SPEED             1\r\n#define Z_BEST_COMPRESSION       9\r\n#define Z_DEFAULT_COMPRESSION  (-1)\r\n/* compression levels */\r\n\r\n#define Z_FILTERED            1\r\n#define Z_HUFFMAN_ONLY        2\r\n#define Z_DEFAULT_STRATEGY    0\r\n/* compression strategy; see deflateInit2() below for details */\r\n\r\n#define Z_BINARY   0\r\n#define Z_ASCII    1\r\n#define Z_UNKNOWN  2\r\n/* Possible values of the data_type field */\r\n\r\n#define Z_DEFLATED   8\r\n/* The deflate compression method (the only one supported in this version) */\r\n\r\n#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */\r\n\r\n\r\n                        /* basic functions */\r\n\r\n/* The application can compare zlibVersion and ZLIB_VERSION for consistency.\r\n   If the first character differs, the library code actually used is\r\n   not compatible with the zlib.h header file used by the application.\r\n   This check is automatically made by deflateInit and inflateInit.\r\n */\r\n\r\n/*\r\nZEXTERN(int)  deflateInit OF((z_streamp strm, int level));\r\n\r\n     Initializes the internal stream state for compression. The fields\r\n   zalloc, zfree and opaque must be initialized before by the caller.\r\n   If zalloc and zfree are set to Z_NULL, deflateInit updates them to\r\n   use default allocation functions.\r\n\r\n     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:\r\n   1 gives best speed, 9 gives best compression, 0 gives no compression at\r\n   all (the input data is simply copied a block at a time).\r\n   Z_DEFAULT_COMPRESSION requests a default compromise between speed and\r\n   compression (currently equivalent to level 6).\r\n\r\n     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_STREAM_ERROR if level is not a valid compression level,\r\n   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible\r\n   with the version assumed by the caller (ZLIB_VERSION).\r\n   msg is set to null if there is no error message.  deflateInit does not\r\n   perform any compression: this will be done by deflate().\r\n*/\r\n\r\n\r\n/*\r\n    deflate compresses as much data as possible, and stops when the input\r\n  buffer becomes empty or the output buffer becomes full. It may introduce some\r\n  output latency (reading input without producing any output) except when\r\n  forced to flush.\r\n\r\n    The detailed semantics are as follows. deflate performs one or both of the\r\n  following actions:\r\n\r\n  - Compress more input starting at next_in and update next_in and avail_in\r\n    accordingly. If not all input can be processed (because there is not\r\n    enough room in the output buffer), next_in and avail_in are updated and\r\n    processing will resume at this point for the next call of deflate().\r\n\r\n  - Provide more output starting at next_out and update next_out and avail_out\r\n    accordingly. This action is forced if the parameter flush is non zero.\r\n    Forcing flush frequently degrades the compression ratio, so this parameter\r\n    should be set only when necessary (in interactive applications).\r\n    Some output may be provided even if flush is not set.\r\n\r\n  Before the call of deflate(), the application should ensure that at least\r\n  one of the actions is possible, by providing more input and/or consuming\r\n  more output, and updating avail_in or avail_out accordingly; avail_out\r\n  should never be zero before the call. The application can consume the\r\n  compressed output when it wants, for example when the output buffer is full\r\n  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK\r\n  and with zero avail_out, it must be called again after making room in the\r\n  output buffer because there might be more output pending.\r\n\r\n    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is\r\n  flushed to the output buffer and the output is aligned on a byte boundary, so\r\n  that the decompressor can get all input data available so far. (In particular\r\n  avail_in is zero after the call if enough output space has been provided\r\n  before the call.)  Flushing may degrade compression for some compression\r\n  algorithms and so it should be used only when necessary.\r\n\r\n    If flush is set to Z_FULL_FLUSH, all output is flushed as with\r\n  Z_SYNC_FLUSH, and the compression state is reset so that decompression can\r\n  restart from this point if previous compressed data has been damaged or if\r\n  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade\r\n  the compression.\r\n\r\n    If deflate returns with avail_out == 0, this function must be called again\r\n  with the same value of the flush parameter and more output space (updated\r\n  avail_out), until the flush is complete (deflate returns with non-zero\r\n  avail_out).\r\n\r\n    If the parameter flush is set to Z_FINISH, pending input is processed,\r\n  pending output is flushed and deflate returns with Z_STREAM_END if there\r\n  was enough output space; if deflate returns with Z_OK, this function must be\r\n  called again with Z_FINISH and more output space (updated avail_out) but no\r\n  more input data, until it returns with Z_STREAM_END or an error. After\r\n  deflate has returned Z_STREAM_END, the only possible operations on the\r\n  stream are deflateReset or deflateEnd.\r\n\r\n    Z_FINISH can be used immediately after deflateInit if all the compression\r\n  is to be done in a single step. In this case, avail_out must be at least\r\n  0.1% larger than avail_in plus 12 bytes.  If deflate does not return\r\n  Z_STREAM_END, then it must be called again as described above.\r\n\r\n    deflate() sets strm->adler to the adler32 checksum of all input read\r\n  so far (that is, total_in bytes).\r\n\r\n    deflate() may update data_type if it can make a good guess about\r\n  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered\r\n  binary. This field is only for information purposes and does not affect\r\n  the compression algorithm in any manner.\r\n\r\n    deflate() returns Z_OK if some progress has been made (more input\r\n  processed or more output produced), Z_STREAM_END if all input has been\r\n  consumed and all output has been produced (only when flush is set to\r\n  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example\r\n  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible\r\n  (for example avail_in or avail_out was zero).\r\n*/\r\n\r\n\r\n/*\r\n     All dynamically allocated data structures for this stream are freed.\r\n   This function discards any unprocessed input and does not flush any\r\n   pending output.\r\n\r\n     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the\r\n   stream state was inconsistent, Z_DATA_ERROR if the stream was freed\r\n   prematurely (some input or output was discarded). In the error case,\r\n   msg may be set but then points to a static string (which must not be\r\n   deallocated).\r\n*/\r\n\r\n\r\n/*\r\nZEXTERN(int)  inflateInit OF((z_streamp strm));\r\n\r\n     Initializes the internal stream state for decompression. The fields\r\n   next_in, avail_in, zalloc, zfree and opaque must be initialized before by\r\n   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact\r\n   value depends on the compression method), inflateInit determines the\r\n   compression method from the zlib header and allocates all data structures\r\n   accordingly; otherwise the allocation will be deferred to the first call of\r\n   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to\r\n   use default allocation functions.\r\n\r\n     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\r\n   version assumed by the caller.  msg is set to null if there is no error\r\n   message. inflateInit does not perform any decompression apart from reading\r\n   the zlib header if present: this will be done by inflate().  (So next_in and\r\n   avail_in may be modified, but next_out and avail_out are unchanged.)\r\n*/\r\n\r\n\r\nZEXTERN(int) inflate OF((z_streamp strm, int flush));\r\n/*\r\n    inflate decompresses as much data as possible, and stops when the input\r\n  buffer becomes empty or the output buffer becomes full. It may some\r\n  introduce some output latency (reading input without producing any output)\r\n  except when forced to flush.\r\n\r\n  The detailed semantics are as follows. inflate performs one or both of the\r\n  following actions:\r\n\r\n  - Decompress more input starting at next_in and update next_in and avail_in\r\n    accordingly. If not all input can be processed (because there is not\r\n    enough room in the output buffer), next_in is updated and processing\r\n    will resume at this point for the next call of inflate().\r\n\r\n  - Provide more output starting at next_out and update next_out and avail_out\r\n    accordingly.  inflate() provides as much output as possible, until there\r\n    is no more input data or no more space in the output buffer (see below\r\n    about the flush parameter).\r\n\r\n  Before the call of inflate(), the application should ensure that at least\r\n  one of the actions is possible, by providing more input and/or consuming\r\n  more output, and updating the next_* and avail_* values accordingly.\r\n  The application can consume the uncompressed output when it wants, for\r\n  example when the output buffer is full (avail_out == 0), or after each\r\n  call of inflate(). If inflate returns Z_OK and with zero avail_out, it\r\n  must be called again after making room in the output buffer because there\r\n  might be more output pending.\r\n\r\n    If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much\r\n  output as possible to the output buffer. The flushing behavior of inflate is\r\n  not specified for values of the flush parameter other than Z_SYNC_FLUSH\r\n  and Z_FINISH, but the current implementation actually flushes as much output\r\n  as possible anyway.\r\n\r\n    inflate() should normally be called until it returns Z_STREAM_END or an\r\n  error. However if all decompression is to be performed in a single step\r\n  (a single call of inflate), the parameter flush should be set to\r\n  Z_FINISH. In this case all pending input is processed and all pending\r\n  output is flushed; avail_out must be large enough to hold all the\r\n  uncompressed data. (The size of the uncompressed data may have been saved\r\n  by the compressor for this purpose.) The next operation on this stream must\r\n  be inflateEnd to deallocate the decompression state. The use of Z_FINISH\r\n  is never required, but can be used to inform inflate that a faster routine\r\n  may be used for the single inflate() call.\r\n\r\n     If a preset dictionary is needed at this point (see inflateSetDictionary\r\n  below), inflate sets strm-adler to the adler32 checksum of the\r\n  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise\r\n  it sets strm->adler to the adler32 checksum of all output produced\r\n  so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or\r\n  an error code as described below. At the end of the stream, inflate()\r\n  checks that its computed adler32 checksum is equal to that saved by the\r\n  compressor and returns Z_STREAM_END only if the checksum is correct.\r\n\r\n    inflate() returns Z_OK if some progress has been made (more input processed\r\n  or more output produced), Z_STREAM_END if the end of the compressed data has\r\n  been reached and all uncompressed output has been produced, Z_NEED_DICT if a\r\n  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was\r\n  corrupted (input stream not conforming to the zlib format or incorrect\r\n  adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent\r\n  (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not\r\n  enough memory, Z_BUF_ERROR if no progress is possible or if there was not\r\n  enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR\r\n  case, the application may then call inflateSync to look for a good\r\n  compression block.\r\n*/\r\n\r\n\r\nZEXTERN(int)  inflateEnd OF((z_streamp strm));\r\n/*\r\n     All dynamically allocated data structures for this stream are freed.\r\n   This function discards any unprocessed input and does not flush any\r\n   pending output.\r\n\r\n     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state\r\n   was inconsistent. In the error case, msg may be set but then points to a\r\n   static string (which must not be deallocated).\r\n*/\r\n\r\n                        /* Advanced functions */\r\n\r\n/*\r\n    The following functions are needed only in some special applications.\r\n*/\r\n\r\n/*\r\nZEXTERN(int)  deflateInit2 OF((z_streamp strm,\r\n                                     int  level,\r\n                                     int  method,\r\n                                     int  windowBits,\r\n                                     int  memLevel,\r\n                                     int  strategy));\r\n\r\n     This is another version of deflateInit with more compression options. The\r\n   fields next_in, zalloc, zfree and opaque must be initialized before by\r\n   the caller.\r\n\r\n     The method parameter is the compression method. It must be Z_DEFLATED in\r\n   this version of the library.\r\n\r\n     The windowBits parameter is the base two logarithm of the window size\r\n   (the size of the history buffer).  It should be in the range 8..15 for this\r\n   version of the library. Larger values of this parameter result in better\r\n   compression at the expense of memory usage. The default value is 15 if\r\n   deflateInit is used instead.\r\n\r\n     The memLevel parameter specifies how much memory should be allocated\r\n   for the internal compression state. memLevel=1 uses minimum memory but\r\n   is slow and reduces compression ratio; memLevel=9 uses maximum memory\r\n   for optimal speed. The default value is 8. See zconf.h for total memory\r\n   usage as a function of windowBits and memLevel.\r\n\r\n     The strategy parameter is used to tune the compression algorithm. Use the\r\n   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a\r\n   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no\r\n   string match).  Filtered data consists mostly of small values with a\r\n   somewhat random distribution. In this case, the compression algorithm is\r\n   tuned to compress them better. The effect of Z_FILTERED is to force more\r\n   Huffman coding and less string matching; it is somewhat intermediate\r\n   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects\r\n   the compression ratio but not the correctness of the compressed output even\r\n   if it is not set appropriately.\r\n\r\n      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid\r\n   method). msg is set to null if there is no error message.  deflateInit2 does\r\n   not perform any compression: this will be done by deflate().\r\n*/\r\n\r\n/*\r\n     Initializes the compression dictionary from the given byte sequence\r\n   without producing any compressed output. This function must be called\r\n   immediately after deflateInit, deflateInit2 or deflateReset, before any\r\n   call of deflate. The compressor and decompressor must use exactly the same\r\n   dictionary (see inflateSetDictionary).\r\n\r\n     The dictionary should consist of strings (byte sequences) that are likely\r\n   to be encountered later in the data to be compressed, with the most commonly\r\n   used strings preferably put towards the end of the dictionary. Using a\r\n   dictionary is most useful when the data to be compressed is short and can be\r\n   predicted with good accuracy; the data can then be compressed better than\r\n   with the default empty dictionary.\r\n\r\n     Depending on the size of the compression data structures selected by\r\n   deflateInit or deflateInit2, a part of the dictionary may in effect be\r\n   discarded, for example if the dictionary is larger than the window size in\r\n   deflate or deflate2. Thus the strings most likely to be useful should be\r\n   put at the end of the dictionary, not at the front.\r\n\r\n     Upon return of this function, strm->adler is set to the Adler32 value\r\n   of the dictionary; the decompressor may later use this value to determine\r\n   which dictionary has been used by the compressor. (The Adler32 value\r\n   applies to the whole dictionary even if only a subset of the dictionary is\r\n   actually used by the compressor.)\r\n\r\n     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a\r\n   parameter is invalid (such as NULL dictionary) or the stream state is\r\n   inconsistent (for example if deflate has already been called for this stream\r\n   or if the compression method is bsort). deflateSetDictionary does not\r\n   perform any compression: this will be done by deflate().\r\n*/\r\n\r\n/*\r\n     Sets the destination stream as a complete copy of the source stream.\r\n\r\n     This function can be useful when several compression strategies will be\r\n   tried, for example when there are several ways of pre-processing the input\r\n   data with a filter. The streams that will be discarded should then be freed\r\n   by calling deflateEnd.  Note that deflateCopy duplicates the internal\r\n   compression state which can be quite large, so this strategy is slow and\r\n   can consume lots of memory.\r\n\r\n     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\r\n   (such as zalloc being NULL). msg is left unchanged in both source and\r\n   destination.\r\n*/\r\n\r\n/*\r\n     This function is equivalent to deflateEnd followed by deflateInit,\r\n   but does not free and reallocate all the internal compression state.\r\n   The stream will keep the same compression level and any other attributes\r\n   that may have been set by deflateInit2.\r\n\r\n      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent (such as zalloc or state being NULL).\r\n*/\r\n\r\n/*\r\n     Dynamically update the compression level and compression strategy.  The\r\n   interpretation of level and strategy is as in deflateInit2.  This can be\r\n   used to switch between compression and straight copy of the input data, or\r\n   to switch to a different kind of input data requiring a different\r\n   strategy. If the compression level is changed, the input available so far\r\n   is compressed with the old level (and may be flushed); the new level will\r\n   take effect only at the next call of deflate().\r\n\r\n     Before the call of deflateParams, the stream state must be set as for\r\n   a call of deflate(), since the currently available input may have to\r\n   be compressed and flushed. In particular, strm->avail_out must be non-zero.\r\n\r\n     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source\r\n   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR\r\n   if strm->avail_out was zero.\r\n*/\r\n\r\n/*\r\nZEXTERN(int)  inflateInit2 OF((z_streamp strm,\r\n                                     int  windowBits));\r\n\r\n     This is another version of inflateInit with an extra parameter. The\r\n   fields next_in, avail_in, zalloc, zfree and opaque must be initialized\r\n   before by the caller.\r\n\r\n     The windowBits parameter is the base two logarithm of the maximum window\r\n   size (the size of the history buffer).  It should be in the range 8..15 for\r\n   this version of the library. The default value is 15 if inflateInit is used\r\n   instead. If a compressed stream with a larger window size is given as\r\n   input, inflate() will return with the error code Z_DATA_ERROR instead of\r\n   trying to allocate a larger window.\r\n\r\n      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative\r\n   memLevel). msg is set to null if there is no error message.  inflateInit2\r\n   does not perform any decompression apart from reading the zlib header if\r\n   present: this will be done by inflate(). (So next_in and avail_in may be\r\n   modified, but next_out and avail_out are unchanged.)\r\n*/\r\n\r\n/*\r\n     Initializes the decompression dictionary from the given uncompressed byte\r\n   sequence. This function must be called immediately after a call of inflate\r\n   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor\r\n   can be determined from the Adler32 value returned by this call of\r\n   inflate. The compressor and decompressor must use exactly the same\r\n   dictionary (see deflateSetDictionary).\r\n\r\n     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a\r\n   parameter is invalid (such as NULL dictionary) or the stream state is\r\n   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the\r\n   expected one (incorrect Adler32 value). inflateSetDictionary does not\r\n   perform any decompression: this will be done by subsequent calls of\r\n   inflate().\r\n*/\r\n\r\n/*\r\n    Skips invalid compressed data until a full flush point (see above the\r\n  description of deflate with Z_FULL_FLUSH) can be found, or until all\r\n  available input is skipped. No output is provided.\r\n\r\n    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR\r\n  if no more input was provided, Z_DATA_ERROR if no flush point has been found,\r\n  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success\r\n  case, the application may save the current current value of total_in which\r\n  indicates where valid compressed data was found. In the error case, the\r\n  application may repeatedly call inflateSync, providing more input each time,\r\n  until success or end of the input data.\r\n*/\r\n\r\nZEXTERN(int)  inflateReset OF((z_streamp strm));\r\n/*\r\n     This function is equivalent to inflateEnd followed by inflateInit,\r\n   but does not free and reallocate all the internal decompression state.\r\n   The stream will keep attributes that may have been set by inflateInit2.\r\n\r\n      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent (such as zalloc or state being NULL).\r\n*/\r\n\r\n\r\n                        /* utility functions */\r\n\r\n/*\r\n     The following utility functions are implemented on top of the\r\n   basic stream-oriented functions. To simplify the interface, some\r\n   default options are assumed (compression level and memory usage,\r\n   standard memory allocation functions). The source code of these\r\n   utility functions can easily be modified if you need special options.\r\n*/\r\n\r\n/*\r\n     Compresses the source buffer into the destination buffer.  sourceLen is\r\n   the byte length of the source buffer. Upon entry, destLen is the total\r\n   size of the destination buffer, which must be at least 0.1% larger than\r\n   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the\r\n   compressed buffer.\r\n     This function can be used to compress a whole file at once if the\r\n   input file is mmap'ed.\r\n     compress returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\r\n   buffer.\r\n*/\r\n\r\n/*\r\n     Compresses the source buffer into the destination buffer. The level\r\n   parameter has the same meaning as in deflateInit.  sourceLen is the byte\r\n   length of the source buffer. Upon entry, destLen is the total size of the\r\n   destination buffer, which must be at least 0.1% larger than sourceLen plus\r\n   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.\r\n\r\n     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_BUF_ERROR if there was not enough room in the output buffer,\r\n   Z_STREAM_ERROR if the level parameter is invalid.\r\n*/\r\n\r\n/*\r\n     Decompresses the source buffer into the destination buffer.  sourceLen is\r\n   the byte length of the source buffer. Upon entry, destLen is the total\r\n   size of the destination buffer, which must be large enough to hold the\r\n   entire uncompressed data. (The size of the uncompressed data must have\r\n   been saved previously by the compressor and transmitted to the decompressor\r\n   by some mechanism outside the scope of this compression library.)\r\n   Upon exit, destLen is the actual size of the compressed buffer.\r\n     This function can be used to decompress a whole file at once if the\r\n   input file is mmap'ed.\r\n\r\n     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\r\n   buffer, or Z_DATA_ERROR if the input data was corrupted.\r\n*/\r\n\r\n\r\n/*\r\n     Opens a gzip (.gz) file for reading or writing. The mode parameter\r\n   is as in fopen (\"rb\" or \"wb\") but can also include a compression level\r\n   (\"wb9\") or a strategy: 'f' for filtered data as in \"wb6f\", 'h' for\r\n   Huffman only compression as in \"wb1h\". (See the description\r\n   of deflateInit2 for more information about the strategy parameter.)\r\n\r\n     gzopen can be used to read a file which is not in gzip format; in this\r\n   case gzread will directly read from the file without decompression.\r\n\r\n     gzopen returns NULL if the file could not be opened or if there was\r\n   insufficient memory to allocate the (de)compression state; errno\r\n   can be checked to distinguish the two cases (if errno is zero, the\r\n   zlib error is Z_MEM_ERROR).  */\r\n\r\n/*\r\n     gzdopen() associates a gzFile with the file descriptor fd.  File\r\n   descriptors are obtained from calls like open, dup, creat, pipe or\r\n   fileno (in the file has been previously opened with fopen).\r\n   The mode parameter is as in gzopen.\r\n     The next call of gzclose on the returned gzFile will also close the\r\n   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file\r\n   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).\r\n     gzdopen returns NULL if there was insufficient memory to allocate\r\n   the (de)compression state.\r\n*/\r\n\r\n/*\r\n     Dynamically update the compression level or strategy. See the description\r\n   of deflateInit2 for the meaning of these parameters.\r\n     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not\r\n   opened for writing.\r\n*/\r\n\r\n/*\r\n     Reads the given number of uncompressed bytes from the compressed file.\r\n   If the input file was not in gzip format, gzread copies the given number\r\n   of bytes into the buffer.\r\n     gzread returns the number of uncompressed bytes actually read (0 for\r\n   end of file, -1 for error). */\r\n\r\n/*\r\n     Writes the given number of uncompressed bytes into the compressed file.\r\n   gzwrite returns the number of uncompressed bytes actually written\r\n   (0 in case of error).\r\n*/\r\n\r\n/*\r\n     Converts, formats, and writes the args to the compressed file under\r\n   control of the format string, as in fprintf. gzprintf returns the number of\r\n   uncompressed bytes actually written (0 in case of error).\r\n*/\r\n\r\n/*\r\n      Writes the given null-terminated string to the compressed file, excluding\r\n   the terminating null character.\r\n      gzputs returns the number of characters written, or -1 in case of error.\r\n*/\r\n\r\n/*\r\n      Reads bytes from the compressed file until len-1 characters are read, or\r\n   a newline character is read and transferred to buf, or an end-of-file\r\n   condition is encountered.  The string is then terminated with a null\r\n   character.\r\n      gzgets returns buf, or Z_NULL in case of error.\r\n*/\r\n\r\n/*\r\n      Writes c, converted to an unsigned char, into the compressed file.\r\n   gzputc returns the value that was written, or -1 in case of error.\r\n*/\r\n\r\n/*\r\n      Reads one byte from the compressed file. gzgetc returns this byte\r\n   or -1 in case of end of file or error.\r\n*/\r\n\r\n/*\r\n     Flushes all pending output into the compressed file. The parameter\r\n   flush is as in the deflate() function. The return value is the zlib\r\n   error number (see function gzerror below). gzflush returns Z_OK if\r\n   the flush parameter is Z_FINISH and all output could be flushed.\r\n     gzflush should be called only when strictly necessary because it can\r\n   degrade compression.\r\n*/\r\n\r\n/*\r\n      Sets the starting position for the next gzread or gzwrite on the\r\n   given compressed file. The offset represents a number of bytes in the\r\n   uncompressed data stream. The whence parameter is defined as in lseek(2);\r\n   the value SEEK_END is not supported.\r\n     If the file is opened for reading, this function is emulated but can be\r\n   extremely slow. If the file is opened for writing, only forward seeks are\r\n   supported; gzseek then compresses a sequence of zeroes up to the new\r\n   starting position.\r\n\r\n      gzseek returns the resulting offset location as measured in bytes from\r\n   the beginning of the uncompressed stream, or -1 in case of error, in\r\n   particular if the file is opened for writing and the new starting position\r\n   would be before the current position.\r\n*/\r\n\r\n/*\r\n     Rewinds the given file. This function is supported only for reading.\r\n\r\n   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)\r\n*/\r\n\r\n/*\r\n     Returns the starting position for the next gzread or gzwrite on the\r\n   given compressed file. This position represents a number of bytes in the\r\n   uncompressed data stream.\r\n\r\n   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)\r\n*/\r\n\r\n/*\r\n     Returns 1 when EOF has previously been detected reading the given\r\n   input stream, otherwise zero.\r\n*/\r\n\r\n/*\r\n     Flushes all pending output if necessary, closes the compressed file\r\n   and deallocates all the (de)compression state. The return value is the zlib\r\n   error number (see function gzerror below).\r\n*/\r\n\r\n/*\r\n     Returns the error message for the last error which occurred on the\r\n   given compressed file. errnum is set to zlib error number. If an\r\n   error occurred in the file system and not in the compression library,\r\n   errnum is set to Z_ERRNO and the application may consult errno\r\n   to get the exact error code.\r\n*/\r\n\r\n                        /* checksum functions */\r\n\r\n/*\r\n     These functions are not related to compression but are exported\r\n   anyway because they might be useful in applications using the\r\n   compression library.\r\n*/\r\n\r\nZEXTERN(uLong)  adler32 OF((uLong adler, const Bytef *buf, uInt len));\r\n\r\n/*\r\n     Update a running Adler-32 checksum with the bytes buf[0..len-1] and\r\n   return the updated checksum. If buf is NULL, this function returns\r\n   the required initial value for the checksum.\r\n   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed\r\n   much faster. Usage example:\r\n\r\n     uLong adler = adler32(0L, Z_NULL, 0);\r\n\r\n     while (read_buffer(buffer, length) != EOF) {\r\n       adler = adler32(adler, buffer, length);\r\n     }\r\n     if (adler != original_adler) error();\r\n*/\r\n\r\n/*\r\n     Update a running crc with the bytes buf[0..len-1] and return the updated\r\n   crc. If buf is NULL, this function returns the required initial value\r\n   for the crc. Pre- and post-conditioning (one's complement) is performed\r\n   within this function so it shouldn't be done by the application.\r\n   Usage example:\r\n\r\n     uLong crc = crc32(0L, Z_NULL, 0);\r\n\r\n     while (read_buffer(buffer, length) != EOF) {\r\n       crc = crc32(crc, buffer, length);\r\n     }\r\n     if (crc != original_crc) error();\r\n*/\r\n\r\n\r\n                        /* various hacks, don't look :) */\r\n\r\n/* deflateInit and inflateInit are macros to allow checking the zlib version\r\n * and the compiler's view of z_stream:\r\n */\r\nZEXTERN(int)  inflateInit2_ OF((z_streamp strm, int  windowBits,\r\n                                      const char *version, int stream_size));\r\n#define deflateInit(strm, level) \\\r\n        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))\r\n#define inflateInit(strm) \\\r\n        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))\r\n#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \\\r\n        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\\\r\n                      (strategy),           ZLIB_VERSION, sizeof(z_stream))\r\n#define inflateInit2(strm, windowBits) \\\r\n        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))\r\n\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* _ZLIB_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/zutil.c",
    "content": "/* zutil.c -- target dependent utility functions for the compression library\r\n * Copyright (C) 1995-2002 Jean-loup Gailly.\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* @(#) $Id$ */\r\n\r\n#include \"zutil.h\"\r\n\r\n#ifndef STDC\r\nextern void exit OF((int));\r\n#endif\r\n\r\n\r\n#ifndef HAVE_MEMCPY\r\n\r\nvoid zmemcpy(dest, source, len)\r\n    Bytef* dest;\r\n    const Bytef* source;\r\n    uInt  len;\r\n{\r\n    if (len == 0) return;\r\n    do {\r\n        *dest++ = *source++; /* ??? to be unrolled */\r\n    } while (--len != 0);\r\n}\r\n\r\nint zmemcmp(s1, s2, len)\r\n    const Bytef* s1;\r\n    const Bytef* s2;\r\n    uInt  len;\r\n{\r\n    uInt j;\r\n\r\n    for (j = 0; j < len; j++) {\r\n        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;\r\n    }\r\n    return 0;\r\n}\r\n\r\nvoid zmemzero(dest, len)\r\n    Bytef* dest;\r\n    uInt  len;\r\n{\r\n    if (len == 0) return;\r\n    do {\r\n        *dest++ = 0;  /* ??? to be unrolled */\r\n    } while (--len != 0);\r\n}\r\n#endif\r\n\r\n#if defined( MSDOS ) && defined( __TURBOC__ ) && !defined( MY_ZCALLOC )\r\n#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)\r\n/* Small and medium model in Turbo C are for now limited to near allocation\r\n * with reduced MAX_WBITS and MAX_MEM_LEVEL\r\n */\r\n#  define MY_ZCALLOC\r\n\r\n/* Turbo C malloc() does not allow dynamic allocation of 64K bytes\r\n * and farmalloc(64K) returns a pointer with an offset of 8, so we\r\n * must fix the pointer. Warning: the pointer must be put back to its\r\n * original form in order to free it, use zcfree().\r\n */\r\n\r\n#define MAX_PTR 10\r\n/* 10*64K = 640K */\r\n\r\nlocal int next_ptr = 0;\r\n\r\ntypedef struct ptr_table_s {\r\n    voidpf org_ptr;\r\n    voidpf new_ptr;\r\n} ptr_table;\r\n\r\nlocal ptr_table table[MAX_PTR];\r\n/* This table is used to remember the original form of pointers\r\n * to large buffers (64K). Such pointers are normalized with a zero offset.\r\n * Since MSDOS is not a preemptive multitasking OS, this table is not\r\n * protected from concurrent access. This hack doesn't work anyway on\r\n * a protected system like OS/2. Use Microsoft C instead.\r\n */\r\n\r\nvoidpf zcalloc (voidpf opaque, unsigned items, unsigned size)\r\n{\r\n    voidpf buf = opaque; /* just to make some compilers happy */\r\n    ulg bsize = (ulg)items*size;\r\n\r\n    /* If we allocate less than 65520 bytes, we assume that farmalloc\r\n     * will return a usable pointer which doesn't have to be normalized.\r\n     */\r\n    if (bsize < 65520L) {\r\n        buf = farmalloc(bsize);\r\n        if (*(ush*)&buf != 0) return buf;\r\n    } else {\r\n        buf = farmalloc(bsize + 16L);\r\n    }\r\n    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;\r\n    table[next_ptr].org_ptr = buf;\r\n\r\n    /* Normalize the pointer to seg:0 */\r\n    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;\r\n    *(ush*)&buf = 0;\r\n    table[next_ptr++].new_ptr = buf;\r\n    return buf;\r\n}\r\n\r\nvoid  zcfree (voidpf opaque, voidpf ptr)\r\n{\r\n    int n;\r\n    if (*(ush*)&ptr != 0) { /* object < 64K */\r\n        farfree(ptr);\r\n        return;\r\n    }\r\n    /* Find the original pointer */\r\n    for (n = 0; n < next_ptr; n++) {\r\n        if (ptr != table[n].new_ptr) continue;\r\n\r\n        farfree(table[n].org_ptr);\r\n        while (++n < next_ptr) {\r\n            table[n-1] = table[n];\r\n        }\r\n        next_ptr--;\r\n        return;\r\n    }\r\n    ptr = opaque; /* just to make some compilers happy */\r\n    Assert(0, \"zcfree: ptr not found\");\r\n}\r\n#endif\r\n#endif /* MSDOS && __TURBOC__ */\r\n\r\n\r\n#if defined(M_I86) && !defined(__32BIT__) && !defined( MY_ZCALLOC )\r\n/* Microsoft C in 16-bit mode */\r\n\r\n#  define MY_ZCALLOC\r\n\r\n#if (!defined(_MSC_VER) || (_MSC_VER <= 600))\r\n#  define _halloc  halloc\r\n#  define _hfree   hfree\r\n#endif\r\n\r\nvoidpf zcalloc (voidpf opaque, unsigned items, unsigned size)\r\n{\r\n    if (opaque) opaque = 0; /* to make compiler happy */\r\n    return _halloc((long)items, size);\r\n}\r\n\r\nvoid  zcfree (voidpf opaque, voidpf ptr)\r\n{\r\n    if (opaque) opaque = 0; /* to make compiler happy */\r\n    _hfree(ptr);\r\n}\r\n\r\n#endif /* MSC */\r\n\r\n\r\n#ifndef MY_ZCALLOC /* Any system without a special alloc function */\r\n\r\n#ifndef STDC\r\nextern voidp  ft_scalloc OF((uInt items, uInt size));\r\nextern void   ft_sfree   OF((voidpf ptr));\r\n#endif\r\n\r\nvoidpf zcalloc (opaque, items, size)\r\n    voidpf opaque;\r\n    unsigned items;\r\n    unsigned size;\r\n{\r\n    if (opaque) items += size - size; /* make compiler happy */\r\n    return (voidpf)ft_scalloc(items, size);\r\n}\r\n\r\nvoid  zcfree (opaque, ptr)\r\n    voidpf opaque;\r\n    voidpf ptr;\r\n{\r\n    ft_sfree(ptr);\r\n    if (opaque) return; /* make compiler happy */\r\n}\r\n\r\n#endif /* MY_ZCALLOC */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/gzip/zutil.h",
    "content": "/* zutil.h -- internal interface and configuration of the compression library\r\n * Copyright (C) 1995-2002 Jean-loup Gailly.\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* WARNING: this file should *not* be used by applications. It is\r\n   part of the implementation of the compression library and is\r\n   subject to change. Applications should only use zlib.h.\r\n */\r\n\r\n/* @(#) $Id$ */\r\n\r\n#ifndef _Z_UTIL_H\r\n#define _Z_UTIL_H\r\n\r\n#include \"zlib.h\"\r\n\r\n#ifdef STDC\r\n#  include <stddef.h>\r\n#  include <string.h>\r\n#  include <stdlib.h>\r\n#endif\r\n#ifdef NO_ERRNO_H\r\n    extern int errno;\r\n#else\r\n#   include <errno.h>\r\n#endif\r\n\r\n#ifndef local\r\n#  define local static\r\n#endif\r\n/* compile with -Dlocal if your debugger can't find static symbols */\r\n\r\ntypedef unsigned char  uch;\r\ntypedef uch FAR uchf;\r\ntypedef unsigned short ush;\r\ntypedef ush FAR ushf;\r\ntypedef unsigned long  ulg;\r\n\r\n\r\n#define ERR_RETURN(strm,err) \\\r\n  return (strm->msg = (char*)ERR_MSG(err), (err))\r\n/* To be used only when the state is known to be valid */\r\n\r\n        /* common constants */\r\n\r\n#ifndef DEF_WBITS\r\n#  define DEF_WBITS MAX_WBITS\r\n#endif\r\n/* default windowBits for decompression. MAX_WBITS is for compression only */\r\n\r\n#if MAX_MEM_LEVEL >= 8\r\n#  define DEF_MEM_LEVEL 8\r\n#else\r\n#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL\r\n#endif\r\n/* default memLevel */\r\n\r\n#define STORED_BLOCK 0\r\n#define STATIC_TREES 1\r\n#define DYN_TREES    2\r\n/* The three kinds of block type */\r\n\r\n#define MIN_MATCH  3\r\n#define MAX_MATCH  258\r\n/* The minimum and maximum match lengths */\r\n\r\n#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */\r\n\r\n        /* target dependencies */\r\n\r\n#ifdef MSDOS\r\n#  define OS_CODE  0x00\r\n#  if defined(__TURBOC__) || defined(__BORLANDC__)\r\n#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))\r\n       /* Allow compilation with ANSI keywords only enabled */\r\n       void _Cdecl farfree( void *block );\r\n       void *_Cdecl farmalloc( unsigned long nbytes );\r\n#    else\r\n#     include <alloc.h>\r\n#    endif\r\n#  else /* MSC or DJGPP */\r\n#  endif\r\n#endif\r\n\r\n#ifdef OS2\r\n#  define OS_CODE  0x06\r\n#endif\r\n\r\n#ifdef WIN32 /* Window 95 & Windows NT */\r\n#  define OS_CODE  0x0b\r\n#endif\r\n\r\n#if defined(VAXC) || defined(VMS)\r\n#  define OS_CODE  0x02\r\n#  define F_OPEN(name, mode) \\\r\n     ft_fopen((name), (mode), \"mbc=60\", \"ctx=stm\", \"rfm=fix\", \"mrs=512\")\r\n#endif\r\n\r\n#ifdef AMIGA\r\n#  define OS_CODE  0x01\r\n#endif\r\n\r\n#if defined(ATARI) || defined(atarist)\r\n#  define OS_CODE  0x05\r\n#endif\r\n\r\n#if defined(MACOS) || defined(TARGET_OS_MAC)\r\n#  define OS_CODE  0x07\r\n#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os\r\n#    include <unix.h> /* for fdopen */\r\n#  else\r\n#    ifndef fdopen\r\n#      define fdopen(fd,mode) NULL /* No fdopen() */\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#ifdef __50SERIES /* Prime/PRIMOS */\r\n#  define OS_CODE  0x0F\r\n#endif\r\n\r\n#ifdef TOPS20\r\n#  define OS_CODE  0x0a\r\n#endif\r\n\r\n#if defined(_BEOS_) || defined(RISCOS)\r\n#  define fdopen(fd,mode) NULL /* No fdopen() */\r\n#endif\r\n\r\n#if (defined(_MSC_VER) && (_MSC_VER > 600))\r\n#  define fdopen(fd,type)  _fdopen(fd,type)\r\n#endif\r\n\r\n\r\n        /* Common defaults */\r\n\r\n#ifndef OS_CODE\r\n#  define OS_CODE  0x03  /* assume Unix */\r\n#endif\r\n\r\n#ifndef F_OPEN\r\n#  define F_OPEN(name, mode) ft_fopen((name), (mode))\r\n#endif\r\n\r\n         /* functions */\r\n\r\n#ifdef HAVE_STRERROR\r\n   extern char *strerror OF((int));\r\n#  define zstrerror(errnum) strerror(errnum)\r\n#else\r\n#  define zstrerror(errnum) \"\"\r\n#endif\r\n\r\n#if defined(pyr)\r\n#  define NO_MEMCPY\r\n#endif\r\n#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)\r\n /* Use our own functions for small and medium model with MSC <= 5.0.\r\n  * You may have to use the same strategy for Borland C (untested).\r\n  * The __SC__ check is for Symantec.\r\n  */\r\n#  define NO_MEMCPY\r\n#endif\r\n#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)\r\n#  define HAVE_MEMCPY\r\n#endif\r\n#ifdef HAVE_MEMCPY\r\n#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */\r\n#    define zmemcpy _fmemcpy\r\n#    define zmemcmp _fmemcmp\r\n#    define zmemzero(dest, len) _fmemset(dest, 0, len)\r\n#  else\r\n#    define zmemcpy ft_memcpy\r\n#    define zmemcmp ft_memcmp\r\n#    define zmemzero(dest, len) ft_memset(dest, 0, len)\r\n#  endif\r\n#else\r\n   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));\r\n   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));\r\n   extern void zmemzero OF((Bytef* dest, uInt len));\r\n#endif\r\n\r\n/* Diagnostic functions */\r\n#ifdef DEBUG\r\n#  include <stdio.h>\r\n   extern int z_verbose;\r\n   extern void z_error    OF((char *m));\r\n#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}\r\n#  define Trace(x) {if (z_verbose>=0) fprintf x ;}\r\n#  define Tracev(x) {if (z_verbose>0) fprintf x ;}\r\n#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}\r\n#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}\r\n#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}\r\n#else\r\n#  define Assert(cond,msg)\r\n#  define Trace(x)\r\n#  define Tracev(x)\r\n#  define Tracevv(x)\r\n#  define Tracec(c,x)\r\n#  define Tracecv(c,x)\r\n#endif\r\n\r\n\r\ntypedef uLong (*check_func) OF((uLong check, const Bytef *buf,\r\n                                uInt len));\r\nlocal voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));\r\nlocal void   zcfree  OF((voidpf opaque, voidpf ptr));\r\n\r\n#define ZALLOC(strm, items, size) \\\r\n           (*((strm)->zalloc))((strm)->opaque, (items), (size))\r\n#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))\r\n#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}\r\n\r\n#endif /* _Z_UTIL_H */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/lzw/Jamfile",
    "content": "# FreeType 2 src/lzw Jamfile\r\n#\r\n# Copyright 2004, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) lzw ;\r\n\r\nLibrary  $(FT2_LIB) : ftlzw.c ;\r\n\r\n# end of src/lzw Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/lzw/ftlzw.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlzw.c                                                                */\r\n/*                                                                         */\r\n/*    FreeType support for .Z compressed files.                            */\r\n/*                                                                         */\r\n/*  This optional component relies on NetBSD's zopen().  It should mainly  */\r\n/*  be used to parse compressed PCF fonts, as found with many X11 server   */\r\n/*  distributions.                                                         */\r\n/*                                                                         */\r\n/*  Copyright 2004-2006, 2009, 2010, 2012 by                               */\r\n/*  Albert Chin-A-Young.                                                   */\r\n/*                                                                         */\r\n/*  Based on code in src/gzip/ftgzip.c, Copyright 2004 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_LZW_H\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  LZW_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_LZW\r\n\r\n#include FT_ERRORS_H\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_LZW\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"lzw code does not support PIC yet\"\r\n#endif\r\n\r\n#include \"ftzopen.h\"\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****                  M E M O R Y   M A N A G E M E N T              *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****                   F I L E   D E S C R I P T O R                 *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n#define FT_LZW_BUFFER_SIZE  4096\r\n\r\n  typedef struct  FT_LZWFileRec_\r\n  {\r\n    FT_Stream       source;         /* parent/source stream        */\r\n    FT_Stream       stream;         /* embedding stream            */\r\n    FT_Memory       memory;         /* memory allocator            */\r\n    FT_LzwStateRec  lzw;            /* lzw decompressor state      */\r\n\r\n    FT_Byte         buffer[FT_LZW_BUFFER_SIZE]; /* output buffer      */\r\n    FT_ULong        pos;                        /* position in output */\r\n    FT_Byte*        cursor;\r\n    FT_Byte*        limit;\r\n\r\n  } FT_LZWFileRec, *FT_LZWFile;\r\n\r\n\r\n  /* check and skip .Z header */\r\n  static FT_Error\r\n  ft_lzw_check_header( FT_Stream  stream )\r\n  {\r\n    FT_Error  error;\r\n    FT_Byte   head[2];\r\n\r\n\r\n    if ( FT_STREAM_SEEK( 0 )       ||\r\n         FT_STREAM_READ( head, 2 ) )\r\n      goto Exit;\r\n\r\n    /* head[0] && head[1] are the magic numbers */\r\n    if ( head[0] != 0x1f ||\r\n         head[1] != 0x9d )\r\n      error = LZW_Err_Invalid_File_Format;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_lzw_file_init( FT_LZWFile  zip,\r\n                    FT_Stream   stream,\r\n                    FT_Stream   source )\r\n  {\r\n    FT_LzwState  lzw   = &zip->lzw;\r\n    FT_Error     error = LZW_Err_Ok;\r\n\r\n\r\n    zip->stream = stream;\r\n    zip->source = source;\r\n    zip->memory = stream->memory;\r\n\r\n    zip->limit  = zip->buffer + FT_LZW_BUFFER_SIZE;\r\n    zip->cursor = zip->limit;\r\n    zip->pos    = 0;\r\n\r\n    /* check and skip .Z header */\r\n    error = ft_lzw_check_header( source );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* initialize internal lzw variable */\r\n    ft_lzwstate_init( lzw, source );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_lzw_file_done( FT_LZWFile  zip )\r\n  {\r\n    /* clear the rest */\r\n    ft_lzwstate_done( &zip->lzw );\r\n\r\n    zip->memory = NULL;\r\n    zip->source = NULL;\r\n    zip->stream = NULL;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_lzw_file_reset( FT_LZWFile  zip )\r\n  {\r\n    FT_Stream  stream = zip->source;\r\n    FT_Error   error;\r\n\r\n\r\n    if ( !FT_STREAM_SEEK( 0 ) )\r\n    {\r\n      ft_lzwstate_reset( &zip->lzw );\r\n\r\n      zip->limit  = zip->buffer + FT_LZW_BUFFER_SIZE;\r\n      zip->cursor = zip->limit;\r\n      zip->pos    = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ft_lzw_file_fill_output( FT_LZWFile  zip )\r\n  {\r\n    FT_LzwState  lzw = &zip->lzw;\r\n    FT_ULong     count;\r\n    FT_Error     error = LZW_Err_Ok;\r\n\r\n\r\n    zip->cursor = zip->buffer;\r\n\r\n    count = ft_lzwstate_io( lzw, zip->buffer, FT_LZW_BUFFER_SIZE );\r\n\r\n    zip->limit = zip->cursor + count;\r\n\r\n    if ( count == 0 )\r\n      error = LZW_Err_Invalid_Stream_Operation;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* fill output buffer; `count' must be <= FT_LZW_BUFFER_SIZE */\r\n  static FT_Error\r\n  ft_lzw_file_skip_output( FT_LZWFile  zip,\r\n                           FT_ULong    count )\r\n  {\r\n    FT_Error  error = LZW_Err_Ok;\r\n\r\n\r\n    /* first, we skip what we can from the output buffer */\r\n    {\r\n      FT_ULong  delta = (FT_ULong)( zip->limit - zip->cursor );\r\n\r\n\r\n      if ( delta >= count )\r\n        delta = count;\r\n\r\n      zip->cursor += delta;\r\n      zip->pos    += delta;\r\n\r\n      count -= delta;\r\n    }\r\n\r\n    /* next, we skip as many bytes remaining as possible */\r\n    while ( count > 0 )\r\n    {\r\n      FT_ULong  delta = FT_LZW_BUFFER_SIZE;\r\n      FT_ULong  numread;\r\n\r\n\r\n      if ( delta > count )\r\n        delta = count;\r\n\r\n      numread = ft_lzwstate_io( &zip->lzw, NULL, delta );\r\n      if ( numread < delta )\r\n      {\r\n        /* not enough bytes */\r\n        error = LZW_Err_Invalid_Stream_Operation;\r\n        break;\r\n      }\r\n\r\n      zip->pos += delta;\r\n      count    -= delta;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_lzw_file_io( FT_LZWFile  zip,\r\n                  FT_ULong    pos,\r\n                  FT_Byte*    buffer,\r\n                  FT_ULong    count )\r\n  {\r\n    FT_ULong  result = 0;\r\n    FT_Error  error;\r\n\r\n\r\n    /* seeking backwards. */\r\n    if ( pos < zip->pos )\r\n    {\r\n      /* If the new position is within the output buffer, simply       */\r\n      /* decrement pointers, otherwise we reset the stream completely! */\r\n      if ( ( zip->pos - pos ) <= (FT_ULong)( zip->cursor - zip->buffer ) )\r\n      {\r\n        zip->cursor -= zip->pos - pos;\r\n        zip->pos     = pos;\r\n      }\r\n      else\r\n      {\r\n        error = ft_lzw_file_reset( zip );\r\n        if ( error )\r\n          goto Exit;\r\n      }\r\n    }\r\n\r\n    /* skip unwanted bytes */\r\n    if ( pos > zip->pos )\r\n    {\r\n      error = ft_lzw_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( count == 0 )\r\n      goto Exit;\r\n\r\n    /* now read the data */\r\n    for (;;)\r\n    {\r\n      FT_ULong  delta;\r\n\r\n\r\n      delta = (FT_ULong)( zip->limit - zip->cursor );\r\n      if ( delta >= count )\r\n        delta = count;\r\n\r\n      FT_MEM_COPY( buffer + result, zip->cursor, delta );\r\n      result      += delta;\r\n      zip->cursor += delta;\r\n      zip->pos    += delta;\r\n\r\n      count -= delta;\r\n      if ( count == 0 )\r\n        break;\r\n\r\n      error = ft_lzw_file_fill_output( zip );\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n/*****                                                                 *****/\r\n/*****            L Z W   E M B E D D I N G   S T R E A M              *****/\r\n/*****                                                                 *****/\r\n/***************************************************************************/\r\n/***************************************************************************/\r\n\r\n  static void\r\n  ft_lzw_stream_close( FT_Stream  stream )\r\n  {\r\n    FT_LZWFile  zip    = (FT_LZWFile)stream->descriptor.pointer;\r\n    FT_Memory   memory = stream->memory;\r\n\r\n\r\n    if ( zip )\r\n    {\r\n      /* finalize lzw file descriptor */\r\n      ft_lzw_file_done( zip );\r\n\r\n      FT_FREE( zip );\r\n\r\n      stream->descriptor.pointer = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_ULong\r\n  ft_lzw_stream_io( FT_Stream  stream,\r\n                    FT_ULong   pos,\r\n                    FT_Byte*   buffer,\r\n                    FT_ULong   count )\r\n  {\r\n    FT_LZWFile  zip = (FT_LZWFile)stream->descriptor.pointer;\r\n\r\n\r\n    return ft_lzw_file_io( zip, pos, buffer, count );\r\n  }\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stream_OpenLZW( FT_Stream  stream,\r\n                     FT_Stream  source )\r\n  {\r\n    FT_Error    error;\r\n    FT_Memory   memory = source->memory;\r\n    FT_LZWFile  zip = NULL;\r\n\r\n\r\n    /*\r\n     *  Check the header right now; this prevents allocation of a huge\r\n     *  LZWFile object (400 KByte of heap memory) if not necessary.\r\n     *\r\n     *  Did I mention that you should never use .Z compressed font\r\n     *  files?\r\n     */\r\n    error = ft_lzw_check_header( source );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_ZERO( stream );\r\n    stream->memory = memory;\r\n\r\n    if ( !FT_NEW( zip ) )\r\n    {\r\n      error = ft_lzw_file_init( zip, stream, source );\r\n      if ( error )\r\n      {\r\n        FT_FREE( zip );\r\n        goto Exit;\r\n      }\r\n\r\n      stream->descriptor.pointer = zip;\r\n    }\r\n\r\n    stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */\r\n    stream->pos   = 0;\r\n    stream->base  = 0;\r\n    stream->read  = ft_lzw_stream_io;\r\n    stream->close = ft_lzw_stream_close;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n#include \"ftzopen.c\"\r\n\r\n\r\n#else  /* !FT_CONFIG_OPTION_USE_LZW */\r\n\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  FT_Stream_OpenLZW( FT_Stream  stream,\r\n                     FT_Stream  source )\r\n  {\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( source );\r\n\r\n    return LZW_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n#endif /* !FT_CONFIG_OPTION_USE_LZW */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/lzw/ftzopen.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftzopen.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType support for .Z compressed files.                            */\r\n/*                                                                         */\r\n/*  This optional component relies on NetBSD's zopen().  It should mainly  */\r\n/*  be used to parse compressed PCF fonts, as found with many X11 server   */\r\n/*  distributions.                                                         */\r\n/*                                                                         */\r\n/*  Copyright 2005-2007, 2009, 2011 by David Turner.                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include \"ftzopen.h\"\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\n  static int\r\n  ft_lzwstate_refill( FT_LzwState  state )\r\n  {\r\n    FT_ULong  count;\r\n\r\n\r\n    if ( state->in_eof )\r\n      return -1;\r\n\r\n    count = FT_Stream_TryRead( state->source,\r\n                               state->buf_tab,\r\n                               state->num_bits );  /* WHY? */\r\n\r\n    state->buf_size   = (FT_UInt)count;\r\n    state->buf_total += count;\r\n    state->in_eof     = FT_BOOL( count < state->num_bits );\r\n    state->buf_offset = 0;\r\n    state->buf_size   = ( state->buf_size << 3 ) - ( state->num_bits - 1 );\r\n\r\n    if ( count == 0 )  /* end of file */\r\n      return -1;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static FT_Int32\r\n  ft_lzwstate_get_code( FT_LzwState  state )\r\n  {\r\n    FT_UInt   num_bits = state->num_bits;\r\n    FT_Int    offset   = state->buf_offset;\r\n    FT_Byte*  p;\r\n    FT_Int    result;\r\n\r\n\r\n    if ( state->buf_clear                    ||\r\n         offset >= state->buf_size           ||\r\n         state->free_ent >= state->free_bits )\r\n    {\r\n      if ( state->free_ent >= state->free_bits )\r\n      {\r\n        state->num_bits  = ++num_bits;\r\n        state->free_bits = state->num_bits < state->max_bits\r\n                           ? (FT_UInt)( ( 1UL << num_bits ) - 256 )\r\n                           : state->max_free + 1;\r\n      }\r\n\r\n      if ( state->buf_clear )\r\n      {\r\n        state->num_bits  = num_bits = LZW_INIT_BITS;\r\n        state->free_bits = (FT_UInt)( ( 1UL << num_bits ) - 256 );\r\n        state->buf_clear = 0;\r\n      }\r\n\r\n      if ( ft_lzwstate_refill( state ) < 0 )\r\n        return -1;\r\n\r\n      offset = 0;\r\n    }\r\n\r\n    state->buf_offset = offset + num_bits;\r\n\r\n    p         = &state->buf_tab[offset >> 3];\r\n    offset   &= 7;\r\n    result    = *p++ >> offset;\r\n    offset    = 8 - offset;\r\n    num_bits -= offset;\r\n\r\n    if ( num_bits >= 8 )\r\n    {\r\n      result   |= *p++ << offset;\r\n      offset   += 8;\r\n      num_bits -= 8;\r\n    }\r\n    if ( num_bits > 0 )\r\n      result |= ( *p & LZW_MASK( num_bits ) ) << offset;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* grow the character stack */\r\n  static int\r\n  ft_lzwstate_stack_grow( FT_LzwState  state )\r\n  {\r\n    if ( state->stack_top >= state->stack_size )\r\n    {\r\n      FT_Memory  memory = state->memory;\r\n      FT_Error   error;\r\n      FT_Offset  old_size = state->stack_size;\r\n      FT_Offset  new_size = old_size;\r\n\r\n      new_size = new_size + ( new_size >> 1 ) + 4;\r\n\r\n      if ( state->stack == state->stack_0 )\r\n      {\r\n        state->stack = NULL;\r\n        old_size     = 0;\r\n      }\r\n\r\n      /* requirement of the character stack larger than 1<<LZW_MAX_BITS */\r\n      /* implies bug in the decompression code                          */\r\n      if ( new_size > ( 1 << LZW_MAX_BITS ) )\r\n      {\r\n        new_size = 1 << LZW_MAX_BITS;\r\n        if ( new_size == old_size )\r\n          return -1;\r\n      }\r\n\r\n      if ( FT_RENEW_ARRAY( state->stack, old_size, new_size ) )\r\n        return -1;\r\n\r\n      state->stack_size = new_size;\r\n    }\r\n    return 0;\r\n  }\r\n\r\n\r\n  /* grow the prefix/suffix arrays */\r\n  static int\r\n  ft_lzwstate_prefix_grow( FT_LzwState  state )\r\n  {\r\n    FT_UInt    old_size = state->prefix_size;\r\n    FT_UInt    new_size = old_size;\r\n    FT_Memory  memory   = state->memory;\r\n    FT_Error   error;\r\n\r\n\r\n    if ( new_size == 0 )  /* first allocation -> 9 bits */\r\n      new_size = 512;\r\n    else\r\n      new_size += new_size >> 2;  /* don't grow too fast */\r\n\r\n    /*\r\n     *  Note that the `suffix' array is located in the same memory block\r\n     *  pointed to by `prefix'.\r\n     *\r\n     *  I know that sizeof(FT_Byte) == 1 by definition, but it is clearer\r\n     *  to write it literally.\r\n     *\r\n     */\r\n    if ( FT_REALLOC_MULT( state->prefix, old_size, new_size,\r\n                          sizeof ( FT_UShort ) + sizeof ( FT_Byte ) ) )\r\n      return -1;\r\n\r\n    /* now adjust `suffix' and move the data accordingly */\r\n    state->suffix = (FT_Byte*)( state->prefix + new_size );\r\n\r\n    FT_MEM_MOVE( state->suffix,\r\n                 state->prefix + old_size,\r\n                 old_size * sizeof ( FT_Byte ) );\r\n\r\n    state->prefix_size = new_size;\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ft_lzwstate_reset( FT_LzwState  state )\r\n  {\r\n    state->in_eof     = 0;\r\n    state->buf_offset = 0;\r\n    state->buf_size   = 0;\r\n    state->buf_clear  = 0;\r\n    state->buf_total  = 0;\r\n    state->stack_top  = 0;\r\n    state->num_bits   = LZW_INIT_BITS;\r\n    state->phase      = FT_LZW_PHASE_START;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ft_lzwstate_init( FT_LzwState  state,\r\n                    FT_Stream    source )\r\n  {\r\n    FT_ZERO( state );\r\n\r\n    state->source = source;\r\n    state->memory = source->memory;\r\n\r\n    state->prefix      = NULL;\r\n    state->suffix      = NULL;\r\n    state->prefix_size = 0;\r\n\r\n    state->stack      = state->stack_0;\r\n    state->stack_size = sizeof ( state->stack_0 );\r\n\r\n    ft_lzwstate_reset( state );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ft_lzwstate_done( FT_LzwState  state )\r\n  {\r\n    FT_Memory  memory = state->memory;\r\n\r\n\r\n    ft_lzwstate_reset( state );\r\n\r\n    if ( state->stack != state->stack_0 )\r\n      FT_FREE( state->stack );\r\n\r\n    FT_FREE( state->prefix );\r\n    state->suffix = NULL;\r\n\r\n    FT_ZERO( state );\r\n  }\r\n\r\n\r\n#define FTLZW_STACK_PUSH( c )                        \\\r\n  FT_BEGIN_STMNT                                     \\\r\n    if ( state->stack_top >= state->stack_size &&    \\\r\n         ft_lzwstate_stack_grow( state ) < 0   )     \\\r\n      goto Eof;                                      \\\r\n                                                     \\\r\n    state->stack[state->stack_top++] = (FT_Byte)(c); \\\r\n  FT_END_STMNT\r\n\r\n\r\n  FT_LOCAL_DEF( FT_ULong )\r\n  ft_lzwstate_io( FT_LzwState  state,\r\n                  FT_Byte*     buffer,\r\n                  FT_ULong     out_size )\r\n  {\r\n    FT_ULong  result = 0;\r\n\r\n    FT_UInt  old_char = state->old_char;\r\n    FT_UInt  old_code = state->old_code;\r\n    FT_UInt  in_code  = state->in_code;\r\n\r\n\r\n    if ( out_size == 0 )\r\n      goto Exit;\r\n\r\n    switch ( state->phase )\r\n    {\r\n    case FT_LZW_PHASE_START:\r\n      {\r\n        FT_Byte   max_bits;\r\n        FT_Int32  c;\r\n\r\n\r\n        /* skip magic bytes, and read max_bits + block_flag */\r\n        if ( FT_Stream_Seek( state->source, 2 ) != 0               ||\r\n             FT_Stream_TryRead( state->source, &max_bits, 1 ) != 1 )\r\n          goto Eof;\r\n\r\n        state->max_bits   = max_bits & LZW_BIT_MASK;\r\n        state->block_mode = max_bits & LZW_BLOCK_MASK;\r\n        state->max_free   = (FT_UInt)( ( 1UL << state->max_bits ) - 256 );\r\n\r\n        if ( state->max_bits > LZW_MAX_BITS )\r\n          goto Eof;\r\n\r\n        state->num_bits = LZW_INIT_BITS;\r\n        state->free_ent = ( state->block_mode ? LZW_FIRST\r\n                                              : LZW_CLEAR ) - 256;\r\n        in_code  = 0;\r\n\r\n        state->free_bits = state->num_bits < state->max_bits\r\n                           ? (FT_UInt)( ( 1UL << state->num_bits ) - 256 )\r\n                           : state->max_free + 1;\r\n\r\n        c = ft_lzwstate_get_code( state );\r\n        if ( c < 0 || c > 255 )\r\n          goto Eof;\r\n\r\n        old_code = old_char = (FT_UInt)c;\r\n\r\n        if ( buffer )\r\n          buffer[result] = (FT_Byte)old_char;\r\n\r\n        if ( ++result >= out_size )\r\n          goto Exit;\r\n\r\n        state->phase = FT_LZW_PHASE_CODE;\r\n      }\r\n      /* fall-through */\r\n\r\n    case FT_LZW_PHASE_CODE:\r\n      {\r\n        FT_Int32  c;\r\n        FT_UInt   code;\r\n\r\n\r\n      NextCode:\r\n        c = ft_lzwstate_get_code( state );\r\n        if ( c < 0 )\r\n          goto Eof;\r\n\r\n        code = (FT_UInt)c;\r\n\r\n        if ( code == LZW_CLEAR && state->block_mode )\r\n        {\r\n          /* why not LZW_FIRST-256 ? */\r\n          state->free_ent  = ( LZW_FIRST - 1 ) - 256;\r\n          state->buf_clear = 1;\r\n\r\n          /* not quite right, but at least more predictable */\r\n          old_code = 0;\r\n          old_char = 0;\r\n\r\n          goto NextCode;\r\n        }\r\n\r\n        in_code = code; /* save code for later */\r\n\r\n        if ( code >= 256U )\r\n        {\r\n          /* special case for KwKwKwK */\r\n          if ( code - 256U >= state->free_ent )\r\n          {\r\n            /* corrupted LZW stream */\r\n            if ( code - 256U > state->free_ent )\r\n              goto Eof;\r\n\r\n            FTLZW_STACK_PUSH( old_char );\r\n            code = old_code;\r\n          }\r\n\r\n          while ( code >= 256U )\r\n          {\r\n            if ( !state->prefix )\r\n              goto Eof;\r\n\r\n            FTLZW_STACK_PUSH( state->suffix[code - 256] );\r\n            code = state->prefix[code - 256];\r\n          }\r\n        }\r\n\r\n        old_char = code;\r\n        FTLZW_STACK_PUSH( old_char );\r\n\r\n        state->phase = FT_LZW_PHASE_STACK;\r\n      }\r\n      /* fall-through */\r\n\r\n    case FT_LZW_PHASE_STACK:\r\n      {\r\n        while ( state->stack_top > 0 )\r\n        {\r\n          --state->stack_top;\r\n\r\n          if ( buffer )\r\n            buffer[result] = state->stack[state->stack_top];\r\n\r\n          if ( ++result == out_size )\r\n            goto Exit;\r\n        }\r\n\r\n        /* now create new entry */\r\n        if ( state->free_ent < state->max_free )\r\n        {\r\n          if ( state->free_ent >= state->prefix_size &&\r\n               ft_lzwstate_prefix_grow( state ) < 0  )\r\n            goto Eof;\r\n\r\n          FT_ASSERT( state->free_ent < state->prefix_size );\r\n\r\n          state->prefix[state->free_ent] = (FT_UShort)old_code;\r\n          state->suffix[state->free_ent] = (FT_Byte)  old_char;\r\n\r\n          state->free_ent += 1;\r\n        }\r\n\r\n        old_code = in_code;\r\n\r\n        state->phase = FT_LZW_PHASE_CODE;\r\n        goto NextCode;\r\n      }\r\n\r\n    default:  /* state == EOF */\r\n      ;\r\n    }\r\n\r\n  Exit:\r\n    state->old_code = old_code;\r\n    state->old_char = old_char;\r\n    state->in_code  = in_code;\r\n\r\n    return result;\r\n\r\n  Eof:\r\n    state->phase = FT_LZW_PHASE_EOF;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/lzw/ftzopen.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftzopen.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType support for .Z compressed files.                            */\r\n/*                                                                         */\r\n/*  This optional component relies on NetBSD's zopen().  It should mainly  */\r\n/*  be used to parse compressed PCF fonts, as found with many X11 server   */\r\n/*  distributions.                                                         */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2006, 2007, 2008 by David Turner.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#ifndef __FT_ZOPEN_H__\r\n#define __FT_ZOPEN_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\n  /*\r\n   *  This is a complete re-implementation of the LZW file reader,\r\n   *  since the old one was incredibly badly written, using\r\n   *  400 KByte of heap memory before decompressing anything.\r\n   *\r\n   */\r\n\r\n#define FT_LZW_IN_BUFF_SIZE        64\r\n#define FT_LZW_DEFAULT_STACK_SIZE  64\r\n\r\n#define LZW_INIT_BITS     9\r\n#define LZW_MAX_BITS      16\r\n\r\n#define LZW_CLEAR         256\r\n#define LZW_FIRST         257\r\n\r\n#define LZW_BIT_MASK      0x1f\r\n#define LZW_BLOCK_MASK    0x80\r\n#define LZW_MASK( n )     ( ( 1U << (n) ) - 1U )\r\n\r\n\r\n  typedef enum  FT_LzwPhase_\r\n  {\r\n    FT_LZW_PHASE_START = 0,\r\n    FT_LZW_PHASE_CODE,\r\n    FT_LZW_PHASE_STACK,\r\n    FT_LZW_PHASE_EOF\r\n\r\n  } FT_LzwPhase;\r\n\r\n\r\n  /*\r\n   *  state of LZW decompressor\r\n   *\r\n   *  small technical note\r\n   *  --------------------\r\n   *\r\n   *  We use a few tricks in this implementation that are explained here to\r\n   *  ease debugging and maintenance.\r\n   *\r\n   *  - First of all, the `prefix' and `suffix' arrays contain the suffix\r\n   *    and prefix for codes over 256; this means that\r\n   *\r\n   *      prefix_of(code) == state->prefix[code-256]\r\n   *      suffix_of(code) == state->suffix[code-256]\r\n   *\r\n   *    Each prefix is a 16-bit code, and each suffix an 8-bit byte.\r\n   *\r\n   *    Both arrays are stored in a single memory block, pointed to by\r\n   *    `state->prefix'.  This means that the following equality is always\r\n   *    true:\r\n   *\r\n   *      state->suffix == (FT_Byte*)(state->prefix + state->prefix_size)\r\n   *\r\n   *    Of course, state->prefix_size is the number of prefix/suffix slots\r\n   *    in the arrays, corresponding to codes 256..255+prefix_size.\r\n   *\r\n   *  - `free_ent' is the index of the next free entry in the `prefix'\r\n   *    and `suffix' arrays.  This means that the corresponding `next free\r\n   *    code' is really `256+free_ent'.\r\n   *\r\n   *    Moreover, `max_free' is the maximum value that `free_ent' can reach.\r\n   *\r\n   *    `max_free' corresponds to `(1 << max_bits) - 256'.  Note that this\r\n   *    value is always <= 0xFF00, which means that both `free_ent' and\r\n   *    `max_free' can be stored in an FT_UInt variable, even on 16-bit\r\n   *    machines.\r\n   *\r\n   *    If `free_ent == max_free', you cannot add new codes to the\r\n   *    prefix/suffix table.\r\n   *\r\n   *  - `num_bits' is the current number of code bits, starting at 9 and\r\n   *    growing each time `free_ent' reaches the value of `free_bits'.  The\r\n   *    latter is computed as follows\r\n   *\r\n   *      if num_bits < max_bits:\r\n   *         free_bits = (1 << num_bits)-256\r\n   *      else:\r\n   *         free_bits = max_free + 1\r\n   *\r\n   *    Since the value of `max_free + 1' can never be reached by\r\n   *    `free_ent', `num_bits' cannot grow larger than `max_bits'.\r\n   */\r\n\r\n  typedef struct  FT_LzwStateRec_\r\n  {\r\n    FT_LzwPhase  phase;\r\n    FT_Int       in_eof;\r\n\r\n    FT_Byte      buf_tab[16];\r\n    FT_Int       buf_offset;\r\n    FT_Int       buf_size;\r\n    FT_Bool      buf_clear;\r\n    FT_Offset    buf_total;\r\n\r\n    FT_UInt      max_bits;    /* max code bits, from file header   */\r\n    FT_Int       block_mode;  /* block mode flag, from file header */\r\n    FT_UInt      max_free;    /* (1 << max_bits) - 256             */\r\n\r\n    FT_UInt      num_bits;    /* current code bit number */\r\n    FT_UInt      free_ent;    /* index of next free entry */\r\n    FT_UInt      free_bits;   /* if reached by free_ent, increment num_bits */\r\n    FT_UInt      old_code;\r\n    FT_UInt      old_char;\r\n    FT_UInt      in_code;\r\n\r\n    FT_UShort*   prefix;      /* always dynamically allocated / reallocated */\r\n    FT_Byte*     suffix;      /* suffix = (FT_Byte*)(prefix + prefix_size)  */\r\n    FT_UInt      prefix_size; /* number of slots in `prefix' or `suffix'    */\r\n\r\n    FT_Byte*     stack;       /* character stack */\r\n    FT_UInt      stack_top;\r\n    FT_Offset    stack_size;\r\n    FT_Byte      stack_0[FT_LZW_DEFAULT_STACK_SIZE]; /* minimize heap alloc */\r\n\r\n    FT_Stream    source;      /* source stream */\r\n    FT_Memory    memory;\r\n\r\n  } FT_LzwStateRec, *FT_LzwState;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ft_lzwstate_init( FT_LzwState  state,\r\n                    FT_Stream    source );\r\n\r\n  FT_LOCAL( void )\r\n  ft_lzwstate_done( FT_LzwState  state );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ft_lzwstate_reset( FT_LzwState  state );\r\n\r\n\r\n  FT_LOCAL( FT_ULong )\r\n  ft_lzwstate_io( FT_LzwState  state,\r\n                  FT_Byte*     buffer,\r\n                  FT_ULong     out_size );\r\n\r\n/* */\r\n\r\n#endif /* __FT_ZOPEN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/lzw/rules.mk",
    "content": "#\r\n# FreeType 2 LZW support configuration rules\r\n#\r\n\r\n\r\n# Copyright 2004, 2005, 2006 by\r\n# Albert Chin-A-Young.\r\n#\r\n# Based on src/lzw/rules.mk, Copyright 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# LZW driver directory\r\n#\r\nLZW_DIR := $(SRC_DIR)/lzw\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nLZW_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(LZW_DIR))\r\n\r\n\r\n# LZW support sources (i.e., C files)\r\n#\r\nLZW_DRV_SRC := $(LZW_DIR)/ftlzw.c\r\n\r\n# LZW support headers\r\n#\r\nLZW_DRV_H := $(LZW_DIR)/ftzopen.h \\\r\n             $(LZW_DIR)/ftzopen.c\r\n\r\n\r\n# LZW driver object(s)\r\n#\r\n#   LZW_DRV_OBJ_M is used during `multi' builds\r\n#   LZW_DRV_OBJ_S is used during `single' builds\r\n#\r\nLZW_DRV_OBJ_M := $(OBJ_DIR)/ftlzw.$O\r\nLZW_DRV_OBJ_S := $(OBJ_DIR)/ftlzw.$O\r\n\r\n# LZW support source file for single build\r\n#\r\nLZW_DRV_SRC_S := $(LZW_DIR)/ftlzw.c\r\n\r\n\r\n# LZW support - single object\r\n#\r\n$(LZW_DRV_OBJ_S): $(LZW_DRV_SRC_S) $(LZW_DRV_SRC) $(FREETYPE_H) $(LZW_DRV_H)\r\n\t$(LZW_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(LZW_DRV_SRC_S))\r\n\r\n\r\n# LZW support - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(LZW_DIR)/%.c $(FREETYPE_H) $(LZW_DRV_H)\r\n\t$(LZW_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(LZW_DRV_OBJ_S)\r\nDRV_OBJS_M += $(LZW_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/Jamfile",
    "content": "# FreeType 2 src/otvalid Jamfile\r\n#\r\n# Copyright 2004 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) otvalid ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod otvmath ;\r\n  }\r\n  else\r\n  {\r\n    _sources = otvalid ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/otvalid Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/module.mk",
    "content": "#\r\n# FreeType 2 otvalid module definition\r\n#\r\n\r\n\r\n# Copyright 2004, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += OTVALID_MODULE\r\n\r\ndefine OTVALID_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, otv_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)otvalid   $(ECHO_DRIVER_DESC)OpenType validation module$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvalid.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvalid.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType validator for OpenType tables (body only).                  */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2007 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n\r\n#include \"otvbase.c\"\r\n#include \"otvcommn.c\"\r\n#include \"otvgdef.c\"\r\n#include \"otvgpos.c\"\r\n#include \"otvgsub.c\"\r\n#include \"otvjstf.c\"\r\n#include \"otvmath.c\"\r\n#include \"otvmod.c\"\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvalid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvalid.h                                                              */\r\n/*                                                                         */\r\n/*    OpenType table validation (specification only).                      */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2008 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __OTVALID_H__\r\n#define __OTVALID_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#include \"otverror.h\"           /* must come before FT_INTERNAL_VALIDATE_H */\r\n\r\n#include FT_INTERNAL_VALIDATE_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( void )\r\n  otv_BASE_validate( FT_Bytes      table,\r\n                     FT_Validator  valid );\r\n\r\n  /* GSUB and GPOS tables should already be validated; */\r\n  /* if missing, set corresponding argument to 0       */\r\n  FT_LOCAL( void )\r\n  otv_GDEF_validate( FT_Bytes      table,\r\n                     FT_Bytes      gsub,\r\n                     FT_Bytes      gpos,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  otv_GPOS_validate( FT_Bytes      table,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  otv_GSUB_validate( FT_Bytes      table,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  valid );\r\n\r\n  /* GSUB and GPOS tables should already be validated; */\r\n  /* if missing, set corresponding argument to 0       */\r\n  FT_LOCAL( void )\r\n  otv_JSTF_validate( FT_Bytes      table,\r\n                     FT_Bytes      gsub,\r\n                     FT_Bytes      gpos,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  otv_MATH_validate( FT_Bytes      table,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  ftvalid );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __OTVALID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvbase.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvbase.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType BASE table validation (body).                               */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2007 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvbase\r\n\r\n\r\n  static void\r\n  otv_BaseCoord_validate( FT_Bytes       table,\r\n                          OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   BaseCoordFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"BaseCoord\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    BaseCoordFormat = FT_NEXT_USHORT( p );\r\n    p += 2;     /* skip Coordinate */\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", BaseCoordFormat ));\r\n\r\n    switch ( BaseCoordFormat )\r\n    {\r\n    case 1:     /* BaseCoordFormat1 */\r\n      break;\r\n\r\n    case 2:     /* BaseCoordFormat2 */\r\n      OTV_LIMIT_CHECK( 4 );   /* ReferenceGlyph, BaseCoordPoint */\r\n      break;\r\n\r\n    case 3:     /* BaseCoordFormat3 */\r\n      OTV_LIMIT_CHECK( 2 );\r\n      /* DeviceTable */\r\n      otv_Device_validate( table + FT_NEXT_USHORT( p ), valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_BaseTagList_validate( FT_Bytes       table,\r\n                            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   BaseTagCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"BaseTagList\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n\r\n    BaseTagCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (BaseTagCount = %d)\\n\", BaseTagCount ));\r\n\r\n    OTV_LIMIT_CHECK( BaseTagCount * 4 );          /* BaselineTag */\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_BaseValues_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   BaseCoordCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"BaseValues\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n\r\n    p             += 2;                     /* skip DefaultIndex */\r\n    BaseCoordCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (BaseCoordCount = %d)\\n\", BaseCoordCount ));\r\n\r\n    OTV_LIMIT_CHECK( BaseCoordCount * 2 );\r\n\r\n    /* BaseCoord */\r\n    for ( ; BaseCoordCount > 0; BaseCoordCount-- )\r\n      otv_BaseCoord_validate( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_MinMax_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   table_size;\r\n    FT_UInt   FeatMinMaxCount;\r\n\r\n    OTV_OPTIONAL_TABLE( MinCoord );\r\n    OTV_OPTIONAL_TABLE( MaxCoord );\r\n\r\n\r\n    OTV_NAME_ENTER( \"MinMax\" );\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n\r\n    OTV_OPTIONAL_OFFSET( MinCoord );\r\n    OTV_OPTIONAL_OFFSET( MaxCoord );\r\n    FeatMinMaxCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (FeatMinMaxCount = %d)\\n\", FeatMinMaxCount ));\r\n\r\n    table_size = FeatMinMaxCount * 8 + 6;\r\n\r\n    OTV_SIZE_CHECK( MinCoord );\r\n    if ( MinCoord )\r\n      otv_BaseCoord_validate( table + MinCoord, valid );\r\n\r\n    OTV_SIZE_CHECK( MaxCoord );\r\n    if ( MaxCoord )\r\n      otv_BaseCoord_validate( table + MaxCoord, valid );\r\n\r\n    OTV_LIMIT_CHECK( FeatMinMaxCount * 8 );\r\n\r\n    /* FeatMinMaxRecord */\r\n    for ( ; FeatMinMaxCount > 0; FeatMinMaxCount-- )\r\n    {\r\n      p += 4;                           /* skip FeatureTableTag */\r\n\r\n      OTV_OPTIONAL_OFFSET( MinCoord );\r\n      OTV_OPTIONAL_OFFSET( MaxCoord );\r\n\r\n      OTV_SIZE_CHECK( MinCoord );\r\n      if ( MinCoord )\r\n        otv_BaseCoord_validate( table + MinCoord, valid );\r\n\r\n      OTV_SIZE_CHECK( MaxCoord );\r\n      if ( MaxCoord )\r\n        otv_BaseCoord_validate( table + MaxCoord, valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_BaseScript_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   table_size;\r\n    FT_UInt   BaseLangSysCount;\r\n\r\n    OTV_OPTIONAL_TABLE( BaseValues    );\r\n    OTV_OPTIONAL_TABLE( DefaultMinMax );\r\n\r\n\r\n    OTV_NAME_ENTER( \"BaseScript\" );\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n    OTV_OPTIONAL_OFFSET( BaseValues    );\r\n    OTV_OPTIONAL_OFFSET( DefaultMinMax );\r\n    BaseLangSysCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (BaseLangSysCount = %d)\\n\", BaseLangSysCount ));\r\n\r\n    table_size = BaseLangSysCount * 6 + 6;\r\n\r\n    OTV_SIZE_CHECK( BaseValues );\r\n    if ( BaseValues )\r\n      otv_BaseValues_validate( table + BaseValues, valid );\r\n\r\n    OTV_SIZE_CHECK( DefaultMinMax );\r\n    if ( DefaultMinMax )\r\n      otv_MinMax_validate( table + DefaultMinMax, valid );\r\n\r\n    OTV_LIMIT_CHECK( BaseLangSysCount * 6 );\r\n\r\n    /* BaseLangSysRecord */\r\n    for ( ; BaseLangSysCount > 0; BaseLangSysCount-- )\r\n    {\r\n      p += 4;       /* skip BaseLangSysTag */\r\n\r\n      otv_MinMax_validate( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_BaseScriptList_validate( FT_Bytes       table,\r\n                               OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   BaseScriptCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"BaseScriptList\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    BaseScriptCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (BaseScriptCount = %d)\\n\", BaseScriptCount ));\r\n\r\n    OTV_LIMIT_CHECK( BaseScriptCount * 6 );\r\n\r\n    /* BaseScriptRecord */\r\n    for ( ; BaseScriptCount > 0; BaseScriptCount-- )\r\n    {\r\n      p += 4;       /* skip BaseScriptTag */\r\n\r\n      /* BaseScript */\r\n      otv_BaseScript_validate( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_Axis_validate( FT_Bytes       table,\r\n                     OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   table_size;\r\n\r\n    OTV_OPTIONAL_TABLE( BaseTagList );\r\n\r\n\r\n    OTV_NAME_ENTER( \"Axis\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    OTV_OPTIONAL_OFFSET( BaseTagList );\r\n\r\n    table_size = 4;\r\n\r\n    OTV_SIZE_CHECK( BaseTagList );\r\n    if ( BaseTagList )\r\n      otv_BaseTagList_validate( table + BaseTagList, valid );\r\n\r\n    /* BaseScriptList */\r\n    otv_BaseScriptList_validate( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_BASE_validate( FT_Bytes      table,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    OTV_ValidatorRec  validrec;\r\n    OTV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_UInt           table_size;\r\n\r\n    OTV_OPTIONAL_TABLE( HorizAxis );\r\n    OTV_OPTIONAL_TABLE( VertAxis  );\r\n\r\n\r\n    valid->root = ftvalid;\r\n\r\n    FT_TRACE3(( \"validating BASE table\\n\" ));\r\n    OTV_INIT;\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    table_size = 6;\r\n\r\n    OTV_OPTIONAL_OFFSET( HorizAxis );\r\n    OTV_SIZE_CHECK( HorizAxis );\r\n    if ( HorizAxis )\r\n      otv_Axis_validate( table + HorizAxis, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( VertAxis );\r\n    OTV_SIZE_CHECK( VertAxis );\r\n    if ( VertAxis )\r\n      otv_Axis_validate( table + VertAxis, valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvcommn.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvcommn.c                                                             */\r\n/*                                                                         */\r\n/*    OpenType common tables validation (body).                            */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2007 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvcommon\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       COVERAGE TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_Coverage_validate( FT_Bytes       table,\r\n                         OTV_Validator  valid,\r\n                         FT_Int         expected_count )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   CoverageFormat;\r\n    FT_UInt   total = 0;\r\n\r\n\r\n    OTV_NAME_ENTER( \"Coverage\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    CoverageFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", CoverageFormat ));\r\n\r\n    switch ( CoverageFormat )\r\n    {\r\n    case 1:     /* CoverageFormat1 */\r\n      {\r\n        FT_UInt  GlyphCount;\r\n        FT_UInt  i;\r\n\r\n\r\n        GlyphCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (GlyphCount = %d)\\n\", GlyphCount ));\r\n\r\n        OTV_LIMIT_CHECK( GlyphCount * 2 );        /* GlyphArray */\r\n\r\n        for ( i = 0; i < GlyphCount; ++i )\r\n        {\r\n          FT_UInt  gid;\r\n\r\n\r\n          gid = FT_NEXT_USHORT( p );\r\n          if ( gid >= valid->glyph_count )\r\n            FT_INVALID_GLYPH_ID;\r\n        }\r\n\r\n        total = GlyphCount;\r\n      }\r\n      break;\r\n\r\n    case 2:     /* CoverageFormat2 */\r\n      {\r\n        FT_UInt  n, RangeCount;\r\n        FT_UInt  Start, End, StartCoverageIndex, last = 0;\r\n\r\n\r\n        RangeCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (RangeCount = %d)\\n\", RangeCount ));\r\n\r\n        OTV_LIMIT_CHECK( RangeCount * 6 );\r\n\r\n        /* RangeRecord */\r\n        for ( n = 0; n < RangeCount; n++ )\r\n        {\r\n          Start              = FT_NEXT_USHORT( p );\r\n          End                = FT_NEXT_USHORT( p );\r\n          StartCoverageIndex = FT_NEXT_USHORT( p );\r\n\r\n          if ( Start > End || StartCoverageIndex != total )\r\n            FT_INVALID_DATA;\r\n\r\n          if ( End >= valid->glyph_count )\r\n            FT_INVALID_GLYPH_ID;\r\n\r\n          if ( n > 0 && Start <= last )\r\n            FT_INVALID_DATA;\r\n\r\n          total += End - Start + 1;\r\n          last   = End;\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    /* Generally, a coverage table offset has an associated count field.  */\r\n    /* The number of glyphs in the table should match this field.  If     */\r\n    /* there is no associated count, a value of -1 tells us not to check. */\r\n    if ( expected_count != -1 && (FT_UInt)expected_count != total )\r\n      FT_INVALID_DATA;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  otv_Coverage_get_first( FT_Bytes  table )\r\n  {\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    p += 4;     /* skip CoverageFormat and Glyph/RangeCount */\r\n\r\n    return FT_NEXT_USHORT( p );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  otv_Coverage_get_last( FT_Bytes  table )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   CoverageFormat = FT_NEXT_USHORT( p );\r\n    FT_UInt   count          = FT_NEXT_USHORT( p );     /* Glyph/RangeCount */\r\n    FT_UInt   result = 0;\r\n\r\n\r\n    switch ( CoverageFormat )\r\n    {\r\n    case 1:\r\n      p += ( count - 1 ) * 2;\r\n      result = FT_NEXT_USHORT( p );\r\n      break;\r\n\r\n    case 2:\r\n      p += ( count - 1 ) * 6 + 2;\r\n      result = FT_NEXT_USHORT( p );\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  otv_Coverage_get_count( FT_Bytes  table )\r\n  {\r\n    FT_Bytes  p              = table;\r\n    FT_UInt   CoverageFormat = FT_NEXT_USHORT( p );\r\n    FT_UInt   count          = FT_NEXT_USHORT( p );     /* Glyph/RangeCount */\r\n    FT_UInt   result         = 0;\r\n\r\n\r\n    switch ( CoverageFormat )\r\n    {\r\n    case 1:\r\n      return count;\r\n\r\n    case 2:\r\n      {\r\n        FT_UInt  Start, End;\r\n\r\n\r\n        for ( ; count > 0; count-- )\r\n        {\r\n          Start = FT_NEXT_USHORT( p );\r\n          End   = FT_NEXT_USHORT( p );\r\n          p    += 2;                    /* skip StartCoverageIndex */\r\n\r\n          result += End - Start + 1;\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                   CLASS DEFINITION TABLE                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_ClassDef_validate( FT_Bytes       table,\r\n                         OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   ClassFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ClassDef\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    ClassFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", ClassFormat ));\r\n\r\n    switch ( ClassFormat )\r\n    {\r\n    case 1:     /* ClassDefFormat1 */\r\n      {\r\n        FT_UInt  StartGlyph;\r\n        FT_UInt  GlyphCount;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 4 );\r\n\r\n        StartGlyph = FT_NEXT_USHORT( p );\r\n        GlyphCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (GlyphCount = %d)\\n\", GlyphCount ));\r\n\r\n        OTV_LIMIT_CHECK( GlyphCount * 2 );    /* ClassValueArray */\r\n\r\n        if ( StartGlyph + GlyphCount - 1 >= valid->glyph_count )\r\n          FT_INVALID_GLYPH_ID;\r\n      }\r\n      break;\r\n\r\n    case 2:     /* ClassDefFormat2 */\r\n      {\r\n        FT_UInt  n, ClassRangeCount;\r\n        FT_UInt  Start, End, last = 0;\r\n\r\n\r\n        ClassRangeCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (ClassRangeCount = %d)\\n\", ClassRangeCount ));\r\n\r\n        OTV_LIMIT_CHECK( ClassRangeCount * 6 );\r\n\r\n        /* ClassRangeRecord */\r\n        for ( n = 0; n < ClassRangeCount; n++ )\r\n        {\r\n          Start = FT_NEXT_USHORT( p );\r\n          End   = FT_NEXT_USHORT( p );\r\n          p    += 2;                        /* skip Class */\r\n\r\n          if ( Start > End || ( n > 0 && Start <= last ) )\r\n            FT_INVALID_DATA;\r\n\r\n          if ( End >= valid->glyph_count )\r\n            FT_INVALID_GLYPH_ID;\r\n\r\n          last = End;\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    /* no need to check glyph indices used as input to class definition   */\r\n    /* tables since even invalid glyph indices return a meaningful result */\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      DEVICE TABLE                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_Device_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   StartSize, EndSize, DeltaFormat, count;\r\n\r\n\r\n    OTV_NAME_ENTER( \"Device\" );\r\n\r\n    OTV_LIMIT_CHECK( 8 );\r\n    StartSize   = FT_NEXT_USHORT( p );\r\n    EndSize     = FT_NEXT_USHORT( p );\r\n    DeltaFormat = FT_NEXT_USHORT( p );\r\n\r\n    if ( DeltaFormat < 1 || DeltaFormat > 3 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    if ( EndSize < StartSize )\r\n      FT_INVALID_DATA;\r\n\r\n    count = EndSize - StartSize + 1;\r\n    OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 );  /* DeltaValue */\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         LOOKUPS                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* uses valid->type_count */\r\n  /* uses valid->type_funcs */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_Lookup_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_UInt            LookupType, SubTableCount;\r\n    OTV_Validate_Func  validate;\r\n\r\n\r\n    OTV_NAME_ENTER( \"Lookup\" );\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n    LookupType    = FT_NEXT_USHORT( p );\r\n    p            += 2;                      /* skip LookupFlag */\r\n    SubTableCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (type %d)\\n\", LookupType ));\r\n\r\n    if ( LookupType == 0 || LookupType > valid->type_count )\r\n      FT_INVALID_DATA;\r\n\r\n    validate = valid->type_funcs[LookupType - 1];\r\n\r\n    OTV_TRACE(( \" (SubTableCount = %d)\\n\", SubTableCount ));\r\n\r\n    OTV_LIMIT_CHECK( SubTableCount * 2 );\r\n\r\n    /* SubTable */\r\n    for ( ; SubTableCount > 0; SubTableCount-- )\r\n      validate( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* uses valid->lookup_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_LookupList_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   LookupCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"LookupList\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    LookupCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (LookupCount = %d)\\n\", LookupCount ));\r\n\r\n    OTV_LIMIT_CHECK( LookupCount * 2 );\r\n\r\n    valid->lookup_count = LookupCount;\r\n\r\n    /* Lookup */\r\n    for ( ; LookupCount > 0; LookupCount-- )\r\n      otv_Lookup_validate( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  otv_LookupList_get_count( FT_Bytes  table )\r\n  {\r\n    return FT_NEXT_USHORT( table );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        FEATURES                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* uses valid->lookup_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_Feature_validate( FT_Bytes       table,\r\n                        OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   LookupCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"Feature\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    p           += 2;                   /* skip FeatureParams (unused) */\r\n    LookupCount  = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (LookupCount = %d)\\n\", LookupCount ));\r\n\r\n    OTV_LIMIT_CHECK( LookupCount * 2 );\r\n\r\n    /* LookupListIndex */\r\n    for ( ; LookupCount > 0; LookupCount-- )\r\n      if ( FT_NEXT_USHORT( p ) >= valid->lookup_count )\r\n        FT_INVALID_DATA;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  otv_Feature_get_count( FT_Bytes  table )\r\n  {\r\n    return FT_NEXT_USHORT( table );\r\n  }\r\n\r\n\r\n  /* sets valid->lookup_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_FeatureList_validate( FT_Bytes       table,\r\n                            FT_Bytes       lookups,\r\n                            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   FeatureCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"FeatureList\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    FeatureCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (FeatureCount = %d)\\n\", FeatureCount ));\r\n\r\n    OTV_LIMIT_CHECK( FeatureCount * 2 );\r\n\r\n    valid->lookup_count = otv_LookupList_get_count( lookups );\r\n\r\n    /* FeatureRecord */\r\n    for ( ; FeatureCount > 0; FeatureCount-- )\r\n    {\r\n      p += 4;       /* skip FeatureTag */\r\n\r\n      /* Feature */\r\n      otv_Feature_validate( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       LANGUAGE SYSTEM                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* uses valid->extra1 (number of features) */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_LangSys_validate( FT_Bytes       table,\r\n                        OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   ReqFeatureIndex;\r\n    FT_UInt   FeatureCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"LangSys\" );\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n    p              += 2;                    /* skip LookupOrder (unused) */\r\n    ReqFeatureIndex = FT_NEXT_USHORT( p );\r\n    FeatureCount    = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (ReqFeatureIndex = %d)\\n\", ReqFeatureIndex ));\r\n    OTV_TRACE(( \" (FeatureCount = %d)\\n\",    FeatureCount    ));\r\n\r\n    if ( ReqFeatureIndex != 0xFFFFU && ReqFeatureIndex >= valid->extra1 )\r\n      FT_INVALID_DATA;\r\n\r\n    OTV_LIMIT_CHECK( FeatureCount * 2 );\r\n\r\n    /* FeatureIndex */\r\n    for ( ; FeatureCount > 0; FeatureCount-- )\r\n      if ( FT_NEXT_USHORT( p ) >= valid->extra1 )\r\n        FT_INVALID_DATA;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           SCRIPTS                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_Script_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid )\r\n  {\r\n    FT_UInt   DefaultLangSys, LangSysCount;\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    OTV_NAME_ENTER( \"Script\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    DefaultLangSys = FT_NEXT_USHORT( p );\r\n    LangSysCount   = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (LangSysCount = %d)\\n\", LangSysCount ));\r\n\r\n    if ( DefaultLangSys != 0 )\r\n      otv_LangSys_validate( table + DefaultLangSys, valid );\r\n\r\n    OTV_LIMIT_CHECK( LangSysCount * 6 );\r\n\r\n    /* LangSysRecord */\r\n    for ( ; LangSysCount > 0; LangSysCount-- )\r\n    {\r\n      p += 4;       /* skip LangSysTag */\r\n\r\n      /* LangSys */\r\n      otv_LangSys_validate( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* sets valid->extra1 (number of features) */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_ScriptList_validate( FT_Bytes       table,\r\n                           FT_Bytes       features,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_UInt   ScriptCount;\r\n    FT_Bytes  p = table;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ScriptList\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    ScriptCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (ScriptCount = %d)\\n\", ScriptCount ));\r\n\r\n    OTV_LIMIT_CHECK( ScriptCount * 6 );\r\n\r\n    valid->extra1 = otv_Feature_get_count( features );\r\n\r\n    /* ScriptRecord */\r\n    for ( ; ScriptCount > 0; ScriptCount-- )\r\n    {\r\n      p += 4;       /* skip ScriptTag */\r\n\r\n      otv_Script_validate( table + FT_NEXT_USHORT( p ), valid ); /* Script */\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n     u:   uint16\r\n     ux:  unit16 [x]\r\n\r\n     s:   struct\r\n     sx:  struct [x]\r\n     sxy: struct [x], using external y count\r\n\r\n     x:   uint16 x\r\n\r\n     C:   Coverage\r\n\r\n     O:   Offset\r\n     On:  Offset (NULL)\r\n     Ox:  Offset [x]\r\n     Onx: Offset (NULL) [x]\r\n  */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_x_Ox( FT_Bytes       table,\r\n            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_UInt            Count;\r\n    OTV_Validate_Func  func;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    Count = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count = %d)\\n\", Count ));\r\n\r\n    OTV_LIMIT_CHECK( Count * 2 );\r\n\r\n    valid->nesting_level++;\r\n    func = valid->func[valid->nesting_level];\r\n\r\n    for ( ; Count > 0; Count-- )\r\n      func( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    valid->nesting_level--;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_u_C_x_Ox( FT_Bytes       table,\r\n                OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_UInt            Count, Coverage;\r\n    OTV_Validate_Func  func;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    p += 2;     /* skip Format */\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    Coverage = FT_NEXT_USHORT( p );\r\n    Count    = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count = %d)\\n\", Count ));\r\n\r\n    otv_Coverage_validate( table + Coverage, valid, Count );\r\n\r\n    OTV_LIMIT_CHECK( Count * 2 );\r\n\r\n    valid->nesting_level++;\r\n    func = valid->func[valid->nesting_level];\r\n\r\n    for ( ; Count > 0; Count-- )\r\n      func( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    valid->nesting_level--;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* uses valid->extra1 (if > 0: array value limit) */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_x_ux( FT_Bytes       table,\r\n            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   Count;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    Count = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count = %d)\\n\", Count ));\r\n\r\n    OTV_LIMIT_CHECK( Count * 2 );\r\n\r\n    if ( valid->extra1 )\r\n    {\r\n      for ( ; Count > 0; Count-- )\r\n        if ( FT_NEXT_USHORT( p ) >= valid->extra1 )\r\n          FT_INVALID_DATA;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* `ux' in the function's name is not really correct since only x-1 */\r\n  /* elements are tested                                              */\r\n\r\n  /* uses valid->extra1 (array value limit) */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_x_y_ux_sy( FT_Bytes       table,\r\n                 OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   Count1, Count2;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    Count1 = FT_NEXT_USHORT( p );\r\n    Count2 = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count1 = %d)\\n\", Count1 ));\r\n    OTV_TRACE(( \" (Count2 = %d)\\n\", Count2 ));\r\n\r\n    if ( Count1 == 0 )\r\n      FT_INVALID_DATA;\r\n\r\n    OTV_LIMIT_CHECK( ( Count1 - 1 ) * 2 + Count2 * 4 );\r\n    p += ( Count1 - 1 ) * 2;\r\n\r\n    for ( ; Count2 > 0; Count2-- )\r\n    {\r\n      if ( FT_NEXT_USHORT( p ) >= Count1 )\r\n        FT_INVALID_DATA;\r\n\r\n      if ( FT_NEXT_USHORT( p ) >= valid->extra1 )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* `uy' in the function's name is not really correct since only y-1 */\r\n  /* elements are tested                                              */\r\n\r\n  /* uses valid->extra1 (array value limit) */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   BacktrackCount, InputCount, LookaheadCount;\r\n    FT_UInt   Count;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    BacktrackCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (BacktrackCount = %d)\\n\", BacktrackCount ));\r\n\r\n    OTV_LIMIT_CHECK( BacktrackCount * 2 + 2 );\r\n    p += BacktrackCount * 2;\r\n\r\n    InputCount = FT_NEXT_USHORT( p );\r\n    if ( InputCount == 0 )\r\n      FT_INVALID_DATA;\r\n\r\n    OTV_TRACE(( \" (InputCount = %d)\\n\", InputCount ));\r\n\r\n    OTV_LIMIT_CHECK( InputCount * 2 );\r\n    p += ( InputCount - 1 ) * 2;\r\n\r\n    LookaheadCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (LookaheadCount = %d)\\n\", LookaheadCount ));\r\n\r\n    OTV_LIMIT_CHECK( LookaheadCount * 2 + 2 );\r\n    p += LookaheadCount * 2;\r\n\r\n    Count = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count = %d)\\n\", Count ));\r\n\r\n    OTV_LIMIT_CHECK( Count * 4 );\r\n\r\n    for ( ; Count > 0; Count-- )\r\n    {\r\n      if ( FT_NEXT_USHORT( p ) >= InputCount )\r\n        FT_INVALID_DATA;\r\n\r\n      if ( FT_NEXT_USHORT( p ) >= valid->extra1 )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* sets valid->extra1 (valid->lookup_count) */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_u_O_O_x_Onx( FT_Bytes       table,\r\n                   OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_UInt            Coverage, ClassDef, ClassSetCount;\r\n    OTV_Validate_Func  func;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    p += 2;     /* skip Format */\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n    Coverage      = FT_NEXT_USHORT( p );\r\n    ClassDef      = FT_NEXT_USHORT( p );\r\n    ClassSetCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (ClassSetCount = %d)\\n\", ClassSetCount ));\r\n\r\n    otv_Coverage_validate( table + Coverage, valid, -1 );\r\n    otv_ClassDef_validate( table + ClassDef, valid );\r\n\r\n    OTV_LIMIT_CHECK( ClassSetCount * 2 );\r\n\r\n    valid->nesting_level++;\r\n    func          = valid->func[valid->nesting_level];\r\n    valid->extra1 = valid->lookup_count;\r\n\r\n    for ( ; ClassSetCount > 0; ClassSetCount-- )\r\n    {\r\n      FT_UInt  offset = FT_NEXT_USHORT( p );\r\n\r\n\r\n      if ( offset )\r\n        func( table + offset, valid );\r\n    }\r\n\r\n    valid->nesting_level--;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* uses valid->lookup_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_u_x_y_Ox_sy( FT_Bytes       table,\r\n                   OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   GlyphCount, Count, count1;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    p += 2;     /* skip Format */\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    GlyphCount = FT_NEXT_USHORT( p );\r\n    Count      = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (GlyphCount = %d)\\n\", GlyphCount ));\r\n    OTV_TRACE(( \" (Count = %d)\\n\",      Count      ));\r\n\r\n    OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 );\r\n\r\n    for ( count1 = GlyphCount; count1 > 0; count1-- )\r\n      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );\r\n\r\n    for ( ; Count > 0; Count-- )\r\n    {\r\n      if ( FT_NEXT_USHORT( p ) >= GlyphCount )\r\n        FT_INVALID_DATA;\r\n\r\n      if ( FT_NEXT_USHORT( p ) >= valid->lookup_count )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* sets valid->extra1 (valid->lookup_count)    */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_u_O_O_O_O_x_Onx( FT_Bytes       table,\r\n                       OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_UInt            Coverage;\r\n    FT_UInt            BacktrackClassDef, InputClassDef, LookaheadClassDef;\r\n    FT_UInt            ChainClassSetCount;\r\n    OTV_Validate_Func  func;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    p += 2;     /* skip Format */\r\n\r\n    OTV_LIMIT_CHECK( 10 );\r\n    Coverage           = FT_NEXT_USHORT( p );\r\n    BacktrackClassDef  = FT_NEXT_USHORT( p );\r\n    InputClassDef      = FT_NEXT_USHORT( p );\r\n    LookaheadClassDef  = FT_NEXT_USHORT( p );\r\n    ChainClassSetCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (ChainClassSetCount = %d)\\n\", ChainClassSetCount ));\r\n\r\n    otv_Coverage_validate( table + Coverage, valid, -1 );\r\n\r\n    otv_ClassDef_validate( table + BacktrackClassDef,  valid );\r\n    otv_ClassDef_validate( table + InputClassDef, valid );\r\n    otv_ClassDef_validate( table + LookaheadClassDef, valid );\r\n\r\n    OTV_LIMIT_CHECK( ChainClassSetCount * 2 );\r\n\r\n    valid->nesting_level++;\r\n    func          = valid->func[valid->nesting_level];\r\n    valid->extra1 = valid->lookup_count;\r\n\r\n    for ( ; ChainClassSetCount > 0; ChainClassSetCount-- )\r\n    {\r\n      FT_UInt  offset = FT_NEXT_USHORT( p );\r\n\r\n\r\n      if ( offset )\r\n        func( table + offset, valid );\r\n    }\r\n\r\n    valid->nesting_level--;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* uses valid->lookup_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes       table,\r\n                             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   BacktrackGlyphCount, InputGlyphCount, LookaheadGlyphCount;\r\n    FT_UInt   count1, count2;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    p += 2;     /* skip Format */\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    BacktrackGlyphCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (BacktrackGlyphCount = %d)\\n\", BacktrackGlyphCount ));\r\n\r\n    OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );\r\n\r\n    for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )\r\n      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );\r\n\r\n    InputGlyphCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (InputGlyphCount = %d)\\n\", InputGlyphCount ));\r\n\r\n    OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 );\r\n\r\n    for ( count1 = InputGlyphCount; count1 > 0; count1-- )\r\n      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );\r\n\r\n    LookaheadGlyphCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (LookaheadGlyphCount = %d)\\n\", LookaheadGlyphCount ));\r\n\r\n    OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );\r\n\r\n    for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )\r\n      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );\r\n\r\n    count2 = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count = %d)\\n\", count2 ));\r\n\r\n    OTV_LIMIT_CHECK( count2 * 4 );\r\n\r\n    for ( ; count2 > 0; count2-- )\r\n    {\r\n      if ( FT_NEXT_USHORT( p ) >= InputGlyphCount )\r\n        FT_INVALID_DATA;\r\n\r\n      if ( FT_NEXT_USHORT( p ) >= valid->lookup_count )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  otv_GSUBGPOS_get_Lookup_count( FT_Bytes  table )\r\n  {\r\n    FT_Bytes  p = table + 8;\r\n\r\n\r\n    return otv_LookupList_get_count( table + FT_NEXT_USHORT( p ) );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  otv_GSUBGPOS_have_MarkAttachmentType_flag( FT_Bytes  table )\r\n  {\r\n    FT_Bytes  p, lookup;\r\n    FT_UInt   count;\r\n\r\n\r\n    if ( !table )\r\n      return 0;\r\n\r\n    /* LookupList */\r\n    p      = table + 8;\r\n    table += FT_NEXT_USHORT( p );\r\n\r\n    /* LookupCount */\r\n    p     = table;\r\n    count = FT_NEXT_USHORT( p );\r\n\r\n    for ( ; count > 0; count-- )\r\n    {\r\n      FT_Bytes  oldp;\r\n\r\n\r\n      /* Lookup */\r\n      lookup = table + FT_NEXT_USHORT( p );\r\n\r\n      oldp = p;\r\n\r\n      /* LookupFlag */\r\n      p = lookup + 2;\r\n      if ( FT_NEXT_USHORT( p ) & 0xFF00U )\r\n        return 1;\r\n\r\n      p = oldp;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvcommn.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvcommn.h                                                             */\r\n/*                                                                         */\r\n/*    OpenType common tables validation (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2007, 2009 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __OTVCOMMN_H__\r\n#define __OTVCOMMN_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"otvalid.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         VALIDATION                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct OTV_ValidatorRec_*  OTV_Validator;\r\n\r\n  typedef void  (*OTV_Validate_Func)( FT_Bytes       table,\r\n                                      OTV_Validator  valid );\r\n\r\n  typedef struct  OTV_ValidatorRec_\r\n  {\r\n    FT_Validator        root;\r\n    FT_UInt             type_count;\r\n    OTV_Validate_Func*  type_funcs;\r\n\r\n    FT_UInt             lookup_count;\r\n    FT_UInt             glyph_count;\r\n\r\n    FT_UInt             nesting_level;\r\n\r\n    OTV_Validate_Func   func[3];\r\n\r\n    FT_UInt             extra1;     /* for passing parameters */\r\n    FT_UInt             extra2;\r\n    FT_Bytes            extra3;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_UInt             debug_indent;\r\n    const FT_String*    debug_function_name[3];\r\n#endif\r\n\r\n  } OTV_ValidatorRec;\r\n\r\n\r\n#undef  FT_INVALID_\r\n#define FT_INVALID_( _prefix, _error )                         \\\r\n          ft_validator_error( valid->root, _prefix ## _error )\r\n\r\n#define OTV_OPTIONAL_TABLE( _table )  FT_UShort  _table;      \\\r\n                                      FT_Bytes   _table ## _p\r\n\r\n#define OTV_OPTIONAL_OFFSET( _offset )           \\\r\n          FT_BEGIN_STMNT                         \\\r\n            _offset ## _p = p;                   \\\r\n            _offset       = FT_NEXT_USHORT( p ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_LIMIT_CHECK( _count )                    \\\r\n          FT_BEGIN_STMNT                             \\\r\n            if ( p + (_count) > valid->root->limit ) \\\r\n              FT_INVALID_TOO_SHORT;                  \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_SIZE_CHECK( _size )                                     \\\r\n          FT_BEGIN_STMNT                                            \\\r\n            if ( _size > 0 && _size < table_size )                  \\\r\n            {                                                       \\\r\n              if ( valid->root->level == FT_VALIDATE_PARANOID )     \\\r\n                FT_INVALID_OFFSET;                                  \\\r\n              else                                                  \\\r\n              {                                                     \\\r\n                /* strip off `const' */                             \\\r\n                FT_Byte*  pp = (FT_Byte*)_size ## _p;               \\\r\n                                                                    \\\r\n                                                                    \\\r\n                FT_TRACE3(( \"\\n\"                                    \\\r\n                            \"Invalid offset to optional table `%s'\" \\\r\n                            \" set to zero.\\n\"                       \\\r\n                            \"\\n\", #_size ));                        \\\r\n                                                                    \\\r\n                /* always assume 16bit entities */                  \\\r\n                _size = pp[0] = pp[1] = 0;                          \\\r\n              }                                                     \\\r\n            }                                                       \\\r\n          FT_END_STMNT\r\n\r\n\r\n#define  OTV_NAME_(x)  #x\r\n#define  OTV_NAME(x)   OTV_NAME_(x)\r\n\r\n#define  OTV_FUNC_(x)  x##Func\r\n#define  OTV_FUNC(x)   OTV_FUNC_(x)\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n#define OTV_NEST1( x )                                     \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            valid->nesting_level          = 0;             \\\r\n            valid->func[0]                = OTV_FUNC( x ); \\\r\n            valid->debug_function_name[0] = OTV_NAME( x ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_NEST2( x, y )                                  \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            valid->nesting_level          = 0;             \\\r\n            valid->func[0]                = OTV_FUNC( x ); \\\r\n            valid->func[1]                = OTV_FUNC( y ); \\\r\n            valid->debug_function_name[0] = OTV_NAME( x ); \\\r\n            valid->debug_function_name[1] = OTV_NAME( y ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_NEST3( x, y, z )                               \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            valid->nesting_level          = 0;             \\\r\n            valid->func[0]                = OTV_FUNC( x ); \\\r\n            valid->func[1]                = OTV_FUNC( y ); \\\r\n            valid->func[2]                = OTV_FUNC( z ); \\\r\n            valid->debug_function_name[0] = OTV_NAME( x ); \\\r\n            valid->debug_function_name[1] = OTV_NAME( y ); \\\r\n            valid->debug_function_name[2] = OTV_NAME( z ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_INIT  valid->debug_indent = 0\r\n\r\n#define OTV_ENTER                                                            \\\r\n          FT_BEGIN_STMNT                                                     \\\r\n            valid->debug_indent += 2;                                        \\\r\n            FT_TRACE4(( \"%*.s\", valid->debug_indent, 0 ));                   \\\r\n            FT_TRACE4(( \"%s table\\n\",                                        \\\r\n                        valid->debug_function_name[valid->nesting_level] )); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_NAME_ENTER( name )                             \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            valid->debug_indent += 2;                      \\\r\n            FT_TRACE4(( \"%*.s\", valid->debug_indent, 0 )); \\\r\n            FT_TRACE4(( \"%s table\\n\", name ));             \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_EXIT  valid->debug_indent -= 2\r\n\r\n#define OTV_TRACE( s )                                     \\\r\n          FT_BEGIN_STMNT                                   \\\r\n            FT_TRACE4(( \"%*.s\", valid->debug_indent, 0 )); \\\r\n            FT_TRACE4( s );                                \\\r\n          FT_END_STMNT\r\n\r\n#else   /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n#define OTV_NEST1( x )                            \\\r\n          FT_BEGIN_STMNT                          \\\r\n            valid->nesting_level = 0;             \\\r\n            valid->func[0]       = OTV_FUNC( x ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_NEST2( x, y )                         \\\r\n          FT_BEGIN_STMNT                          \\\r\n            valid->nesting_level = 0;             \\\r\n            valid->func[0]       = OTV_FUNC( x ); \\\r\n            valid->func[1]       = OTV_FUNC( y ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_NEST3( x, y, z )                      \\\r\n          FT_BEGIN_STMNT                          \\\r\n            valid->nesting_level = 0;             \\\r\n            valid->func[0]       = OTV_FUNC( x ); \\\r\n            valid->func[1]       = OTV_FUNC( y ); \\\r\n            valid->func[2]       = OTV_FUNC( z ); \\\r\n          FT_END_STMNT\r\n\r\n#define OTV_INIT                do { } while ( 0 )\r\n#define OTV_ENTER               do { } while ( 0 )\r\n#define OTV_NAME_ENTER( name )  do { } while ( 0 )\r\n#define OTV_EXIT                do { } while ( 0 )\r\n\r\n#define OTV_TRACE( s )          do { } while ( 0 )\r\n\r\n#endif  /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n#define OTV_RUN  valid->func[0]\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       COVERAGE TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_Coverage_validate( FT_Bytes       table,\r\n                         OTV_Validator  valid,\r\n                         FT_Int         expected_count );\r\n\r\n  /* return first covered glyph */\r\n  FT_LOCAL( FT_UInt )\r\n  otv_Coverage_get_first( FT_Bytes  table );\r\n\r\n  /* return last covered glyph */\r\n  FT_LOCAL( FT_UInt )\r\n  otv_Coverage_get_last( FT_Bytes  table );\r\n\r\n  /* return number of covered glyphs */\r\n  FT_LOCAL( FT_UInt )\r\n  otv_Coverage_get_count( FT_Bytes  table );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  CLASS DEFINITION TABLE                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_ClassDef_validate( FT_Bytes       table,\r\n                         OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      DEVICE TABLE                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_Device_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           LOOKUPS                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_Lookup_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid );\r\n\r\n  FT_LOCAL( void )\r\n  otv_LookupList_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        FEATURES                               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_Feature_validate( FT_Bytes       table,\r\n                        OTV_Validator  valid );\r\n\r\n  /* lookups must already be validated */\r\n  FT_LOCAL( void )\r\n  otv_FeatureList_validate( FT_Bytes       table,\r\n                            FT_Bytes       lookups,\r\n                            OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       LANGUAGE SYSTEM                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_LangSys_validate( FT_Bytes       table,\r\n                        OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           SCRIPTS                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  otv_Script_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid );\r\n\r\n  /* features must already be validated */\r\n  FT_LOCAL( void )\r\n  otv_ScriptList_validate( FT_Bytes       table,\r\n                           FT_Bytes       features,\r\n                           OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define ChainPosClassSetFunc  otv_x_Ox\r\n#define ChainPosRuleSetFunc   otv_x_Ox\r\n#define ChainSubClassSetFunc  otv_x_Ox\r\n#define ChainSubRuleSetFunc   otv_x_Ox\r\n#define JstfLangSysFunc       otv_x_Ox\r\n#define JstfMaxFunc           otv_x_Ox\r\n#define LigGlyphFunc          otv_x_Ox\r\n#define LigatureArrayFunc     otv_x_Ox\r\n#define LigatureSetFunc       otv_x_Ox\r\n#define PosClassSetFunc       otv_x_Ox\r\n#define PosRuleSetFunc        otv_x_Ox\r\n#define SubClassSetFunc       otv_x_Ox\r\n#define SubRuleSetFunc        otv_x_Ox\r\n\r\n  FT_LOCAL( void )\r\n  otv_x_Ox ( FT_Bytes       table,\r\n             OTV_Validator  valid );\r\n\r\n#define AlternateSubstFormat1Func     otv_u_C_x_Ox\r\n#define ChainContextPosFormat1Func    otv_u_C_x_Ox\r\n#define ChainContextSubstFormat1Func  otv_u_C_x_Ox\r\n#define ContextPosFormat1Func         otv_u_C_x_Ox\r\n#define ContextSubstFormat1Func       otv_u_C_x_Ox\r\n#define LigatureSubstFormat1Func      otv_u_C_x_Ox\r\n#define MultipleSubstFormat1Func      otv_u_C_x_Ox\r\n\r\n  FT_LOCAL( void )\r\n  otv_u_C_x_Ox( FT_Bytes       table,\r\n                OTV_Validator  valid );\r\n\r\n#define AlternateSetFunc     otv_x_ux\r\n#define AttachPointFunc      otv_x_ux\r\n#define ExtenderGlyphFunc    otv_x_ux\r\n#define JstfGPOSModListFunc  otv_x_ux\r\n#define JstfGSUBModListFunc  otv_x_ux\r\n#define SequenceFunc         otv_x_ux\r\n\r\n  FT_LOCAL( void )\r\n  otv_x_ux( FT_Bytes       table,\r\n            OTV_Validator  valid );\r\n\r\n#define PosClassRuleFunc  otv_x_y_ux_sy\r\n#define PosRuleFunc       otv_x_y_ux_sy\r\n#define SubClassRuleFunc  otv_x_y_ux_sy\r\n#define SubRuleFunc       otv_x_y_ux_sy\r\n\r\n  FT_LOCAL( void )\r\n  otv_x_y_ux_sy( FT_Bytes       table,\r\n                 OTV_Validator  valid );\r\n\r\n#define ChainPosClassRuleFunc  otv_x_ux_y_uy_z_uz_p_sp\r\n#define ChainPosRuleFunc       otv_x_ux_y_uy_z_uz_p_sp\r\n#define ChainSubClassRuleFunc  otv_x_ux_y_uy_z_uz_p_sp\r\n#define ChainSubRuleFunc       otv_x_ux_y_uy_z_uz_p_sp\r\n\r\n  FT_LOCAL( void )\r\n  otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes       table,\r\n                           OTV_Validator  valid );\r\n\r\n#define ContextPosFormat2Func    otv_u_O_O_x_Onx\r\n#define ContextSubstFormat2Func  otv_u_O_O_x_Onx\r\n\r\n  FT_LOCAL( void )\r\n  otv_u_O_O_x_Onx( FT_Bytes       table,\r\n                   OTV_Validator  valid );\r\n\r\n#define ContextPosFormat3Func    otv_u_x_y_Ox_sy\r\n#define ContextSubstFormat3Func  otv_u_x_y_Ox_sy\r\n\r\n  FT_LOCAL( void )\r\n  otv_u_x_y_Ox_sy( FT_Bytes       table,\r\n                   OTV_Validator  valid );\r\n\r\n#define ChainContextPosFormat2Func    otv_u_O_O_O_O_x_Onx\r\n#define ChainContextSubstFormat2Func  otv_u_O_O_O_O_x_Onx\r\n\r\n  FT_LOCAL( void )\r\n  otv_u_O_O_O_O_x_Onx( FT_Bytes       table,\r\n                       OTV_Validator  valid );\r\n\r\n#define ChainContextPosFormat3Func    otv_u_x_Ox_y_Oy_z_Oz_p_sp\r\n#define ChainContextSubstFormat3Func  otv_u_x_Ox_y_Oy_z_Oz_p_sp\r\n\r\n  FT_LOCAL( void )\r\n  otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes       table,\r\n                             OTV_Validator  valid );\r\n\r\n\r\n  FT_LOCAL( FT_UInt )\r\n  otv_GSUBGPOS_get_Lookup_count( FT_Bytes  table );\r\n\r\n  FT_LOCAL( FT_UInt )\r\n  otv_GSUBGPOS_have_MarkAttachmentType_flag( FT_Bytes  table );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __OTVCOMMN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otverror.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otverror.h                                                             */\r\n/*                                                                         */\r\n/*    OpenType validation module error codes (specification only).         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2012 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the OpenType validation module error      */\r\n  /* enumeration constants.                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __OTVERROR_H__\r\n#define __OTVERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  OTV_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_OTvalid\r\n\r\n#define FT_KEEP_ERR_PREFIX\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __OTVERROR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvgdef.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvgdef.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType GDEF table validation (body).                               */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2007 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvgdef\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define AttachListFunc    otv_O_x_Ox\r\n#define LigCaretListFunc  otv_O_x_Ox\r\n\r\n  /* sets valid->extra1 (0)           */\r\n\r\n  static void\r\n  otv_O_x_Ox( FT_Bytes       table,\r\n              OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_Bytes           Coverage;\r\n    FT_UInt            GlyphCount;\r\n    OTV_Validate_Func  func;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    Coverage   = table + FT_NEXT_USHORT( p );\r\n    GlyphCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (GlyphCount = %d)\\n\", GlyphCount ));\r\n\r\n    otv_Coverage_validate( Coverage, valid, GlyphCount );\r\n    if ( GlyphCount != otv_Coverage_get_count( Coverage ) )\r\n      FT_INVALID_DATA;\r\n\r\n    OTV_LIMIT_CHECK( GlyphCount * 2 );\r\n\r\n    valid->nesting_level++;\r\n    func          = valid->func[valid->nesting_level];\r\n    valid->extra1 = 0;\r\n\r\n    for ( ; GlyphCount > 0; GlyphCount-- )\r\n      func( table + FT_NEXT_USHORT( p ), valid );\r\n\r\n    valid->nesting_level--;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       LIGATURE CARETS                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define CaretValueFunc  otv_CaretValue_validate\r\n\r\n  static void\r\n  otv_CaretValue_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   CaretValueFormat;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n\r\n    CaretValueFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format = %d)\\n\", CaretValueFormat ));\r\n\r\n    switch ( CaretValueFormat )\r\n    {\r\n    case 1:     /* CaretValueFormat1 */\r\n      /* skip Coordinate, no test */\r\n      break;\r\n\r\n    case 2:     /* CaretValueFormat2 */\r\n      /* skip CaretValuePoint, no test */\r\n      break;\r\n\r\n    case 3:     /* CaretValueFormat3 */\r\n      p += 2;   /* skip Coordinate */\r\n\r\n      OTV_LIMIT_CHECK( 2 );\r\n\r\n      /* DeviceTable */\r\n      otv_Device_validate( table + FT_NEXT_USHORT( p ), valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         GDEF TABLE                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->glyph_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_GDEF_validate( FT_Bytes      table,\r\n                     FT_Bytes      gsub,\r\n                     FT_Bytes      gpos,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    OTV_ValidatorRec  validrec;\r\n    OTV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_UInt           table_size;\r\n    FT_Bool           need_MarkAttachClassDef;\r\n\r\n    OTV_OPTIONAL_TABLE( GlyphClassDef );\r\n    OTV_OPTIONAL_TABLE( AttachListOffset );\r\n    OTV_OPTIONAL_TABLE( LigCaretListOffset );\r\n    OTV_OPTIONAL_TABLE( MarkAttachClassDef );\r\n\r\n\r\n    valid->root = ftvalid;\r\n\r\n    FT_TRACE3(( \"validating GDEF table\\n\" ));\r\n    OTV_INIT;\r\n\r\n    OTV_LIMIT_CHECK( 12 );\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x10000UL )          /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    /* MarkAttachClassDef has been added to the OpenType */\r\n    /* specification without increasing GDEF's version,  */\r\n    /* so we use this ugly hack to find out whether the  */\r\n    /* table is needed actually.                         */\r\n\r\n    need_MarkAttachClassDef = FT_BOOL(\r\n      otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) ||\r\n      otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) );\r\n\r\n    if ( need_MarkAttachClassDef )\r\n      table_size = 12;              /* OpenType >= 1.2 */\r\n    else\r\n      table_size = 10;              /* OpenType < 1.2  */\r\n\r\n    valid->glyph_count = glyph_count;\r\n\r\n    OTV_OPTIONAL_OFFSET( GlyphClassDef );\r\n    OTV_SIZE_CHECK( GlyphClassDef );\r\n    if ( GlyphClassDef )\r\n      otv_ClassDef_validate( table + GlyphClassDef, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( AttachListOffset );\r\n    OTV_SIZE_CHECK( AttachListOffset );\r\n    if ( AttachListOffset )\r\n    {\r\n      OTV_NEST2( AttachList, AttachPoint );\r\n      OTV_RUN( table + AttachListOffset, valid );\r\n    }\r\n\r\n    OTV_OPTIONAL_OFFSET( LigCaretListOffset );\r\n    OTV_SIZE_CHECK( LigCaretListOffset );\r\n    if ( LigCaretListOffset )\r\n    {\r\n      OTV_NEST3( LigCaretList, LigGlyph, CaretValue );\r\n      OTV_RUN( table + LigCaretListOffset, valid );\r\n    }\r\n\r\n    if ( need_MarkAttachClassDef )\r\n    {\r\n      OTV_OPTIONAL_OFFSET( MarkAttachClassDef );\r\n      OTV_SIZE_CHECK( MarkAttachClassDef );\r\n      if ( MarkAttachClassDef )\r\n        otv_ClassDef_validate( table + MarkAttachClassDef, valid );\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvgpos.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvgpos.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType GPOS table validation (body).                               */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2004, 2005, 2006, 2007, 2008 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n#include \"otvgpos.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvgpos\r\n\r\n\r\n  static void\r\n  otv_Anchor_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid );\r\n\r\n  static void\r\n  otv_MarkArray_validate( FT_Bytes       table,\r\n                          OTV_Validator  valid );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      UTILITY FUNCTIONS                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define BaseArrayFunc       otv_x_sxy\r\n#define LigatureAttachFunc  otv_x_sxy\r\n#define Mark2ArrayFunc      otv_x_sxy\r\n\r\n  /* uses valid->extra1 (counter)                             */\r\n  /* uses valid->extra2 (boolean to handle NULL anchor field) */\r\n\r\n  static void\r\n  otv_x_sxy( FT_Bytes       table,\r\n             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   Count, count1, table_size;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n\r\n    Count = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (Count = %d)\\n\", Count ));\r\n\r\n    OTV_LIMIT_CHECK( Count * valid->extra1 * 2 );\r\n\r\n    table_size = Count * valid->extra1 * 2 + 2;\r\n\r\n    for ( ; Count > 0; Count-- )\r\n      for ( count1 = valid->extra1; count1 > 0; count1-- )\r\n      {\r\n        OTV_OPTIONAL_TABLE( anchor_offset );\r\n\r\n\r\n        OTV_OPTIONAL_OFFSET( anchor_offset );\r\n\r\n        if ( valid->extra2 )\r\n        {\r\n          OTV_SIZE_CHECK( anchor_offset );\r\n          if ( anchor_offset )\r\n            otv_Anchor_validate( table + anchor_offset, valid );\r\n        }\r\n        else\r\n          otv_Anchor_validate( table + anchor_offset, valid );\r\n      }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n#define MarkBasePosFormat1Func  otv_u_O_O_u_O_O\r\n#define MarkLigPosFormat1Func   otv_u_O_O_u_O_O\r\n#define MarkMarkPosFormat1Func  otv_u_O_O_u_O_O\r\n\r\n  /* sets valid->extra1 (class count) */\r\n\r\n  static void\r\n  otv_u_O_O_u_O_O( FT_Bytes       table,\r\n                   OTV_Validator  valid )\r\n  {\r\n    FT_Bytes           p = table;\r\n    FT_UInt            Coverage1, Coverage2, ClassCount;\r\n    FT_UInt            Array1, Array2;\r\n    OTV_Validate_Func  func;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    p += 2;     /* skip PosFormat */\r\n\r\n    OTV_LIMIT_CHECK( 10 );\r\n    Coverage1  = FT_NEXT_USHORT( p );\r\n    Coverage2  = FT_NEXT_USHORT( p );\r\n    ClassCount = FT_NEXT_USHORT( p );\r\n    Array1     = FT_NEXT_USHORT( p );\r\n    Array2     = FT_NEXT_USHORT( p );\r\n\r\n    otv_Coverage_validate( table + Coverage1, valid, -1 );\r\n    otv_Coverage_validate( table + Coverage2, valid, -1 );\r\n\r\n    otv_MarkArray_validate( table + Array1, valid );\r\n\r\n    valid->nesting_level++;\r\n    func          = valid->func[valid->nesting_level];\r\n    valid->extra1 = ClassCount;\r\n\r\n    func( table + Array2, valid );\r\n\r\n    valid->nesting_level--;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        VALUE RECORDS                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static FT_UInt\r\n  otv_value_length( FT_UInt  format )\r\n  {\r\n    FT_UInt  count;\r\n\r\n\r\n    count = ( ( format & 0xAA ) >> 1 ) + ( format & 0x55 );\r\n    count = ( ( count  & 0xCC ) >> 2 ) + ( count  & 0x33 );\r\n    count = ( ( count  & 0xF0 ) >> 4 ) + ( count  & 0x0F );\r\n\r\n    return count * 2;\r\n  }\r\n\r\n\r\n  /* uses valid->extra3 (pointer to base table) */\r\n\r\n  static void\r\n  otv_ValueRecord_validate( FT_Bytes       table,\r\n                            FT_UInt        format,\r\n                            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   count;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_Int    loop;\r\n    FT_ULong  res = 0;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ValueRecord\" );\r\n\r\n    /* display `format' in dual representation */\r\n    for ( loop = 7; loop >= 0; loop-- )\r\n    {\r\n      res <<= 4;\r\n      res  += ( format >> loop ) & 1;\r\n    }\r\n\r\n    OTV_TRACE(( \" (format 0b%08lx)\\n\", res ));\r\n#endif\r\n\r\n    if ( format >= 0x100 )\r\n      FT_INVALID_FORMAT;\r\n\r\n    for ( count = 4; count > 0; count-- )\r\n    {\r\n      if ( format & 1 )\r\n      {\r\n        /* XPlacement, YPlacement, XAdvance, YAdvance */\r\n        OTV_LIMIT_CHECK( 2 );\r\n        p += 2;\r\n      }\r\n\r\n      format >>= 1;\r\n    }\r\n\r\n    for ( count = 4; count > 0; count-- )\r\n    {\r\n      if ( format & 1 )\r\n      {\r\n        FT_PtrDist  table_size;\r\n\r\n        OTV_OPTIONAL_TABLE( device );\r\n\r\n\r\n        /* XPlaDevice, YPlaDevice, XAdvDevice, YAdvDevice */\r\n        OTV_LIMIT_CHECK( 2 );\r\n        OTV_OPTIONAL_OFFSET( device );\r\n\r\n        /* XXX: this value is usually too small, especially if the current */\r\n        /* ValueRecord is part of an array -- getting the correct table    */\r\n        /* size is probably not worth the trouble                          */\r\n\r\n        table_size = p - valid->extra3;\r\n\r\n        OTV_SIZE_CHECK( device );\r\n        if ( device )\r\n          otv_Device_validate( valid->extra3 + device, valid );\r\n      }\r\n      format >>= 1;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           ANCHORS                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_Anchor_validate( FT_Bytes       table,\r\n                       OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   AnchorFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"Anchor\");\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n    AnchorFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", AnchorFormat ));\r\n\r\n    p += 4;     /* skip XCoordinate and YCoordinate */\r\n\r\n    switch ( AnchorFormat )\r\n    {\r\n    case 1:\r\n      break;\r\n\r\n    case 2:\r\n      OTV_LIMIT_CHECK( 2 );  /* AnchorPoint */\r\n      break;\r\n\r\n    case 3:\r\n      {\r\n        FT_UInt   table_size;\r\n\r\n        OTV_OPTIONAL_TABLE( XDeviceTable );\r\n        OTV_OPTIONAL_TABLE( YDeviceTable );\r\n\r\n\r\n        OTV_LIMIT_CHECK( 4 );\r\n        OTV_OPTIONAL_OFFSET( XDeviceTable );\r\n        OTV_OPTIONAL_OFFSET( YDeviceTable );\r\n\r\n        table_size = 6 + 4;\r\n\r\n        OTV_SIZE_CHECK( XDeviceTable );\r\n        if ( XDeviceTable )\r\n          otv_Device_validate( table + XDeviceTable, valid );\r\n\r\n        OTV_SIZE_CHECK( YDeviceTable );\r\n        if ( YDeviceTable )\r\n          otv_Device_validate( table + YDeviceTable, valid );\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         MARK ARRAYS                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_MarkArray_validate( FT_Bytes       table,\r\n                          OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   MarkCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"MarkArray\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    MarkCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (MarkCount = %d)\\n\", MarkCount ));\r\n\r\n    OTV_LIMIT_CHECK( MarkCount * 4 );\r\n\r\n    /* MarkRecord */\r\n    for ( ; MarkCount > 0; MarkCount-- )\r\n    {\r\n      p += 2;   /* skip Class */\r\n      /* MarkAnchor */\r\n      otv_Anchor_validate( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 1                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra3 (pointer to base table) */\r\n\r\n  static void\r\n  otv_SinglePos_validate( FT_Bytes       table,\r\n                          OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"SinglePos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    valid->extra3 = table;\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:     /* SinglePosFormat1 */\r\n      {\r\n        FT_UInt  Coverage, ValueFormat;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 4 );\r\n        Coverage    = FT_NEXT_USHORT( p );\r\n        ValueFormat = FT_NEXT_USHORT( p );\r\n\r\n        otv_Coverage_validate( table + Coverage, valid, -1 );\r\n        otv_ValueRecord_validate( p, ValueFormat, valid ); /* Value */\r\n      }\r\n      break;\r\n\r\n    case 2:     /* SinglePosFormat2 */\r\n      {\r\n        FT_UInt  Coverage, ValueFormat, ValueCount, len_value;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 6 );\r\n        Coverage    = FT_NEXT_USHORT( p );\r\n        ValueFormat = FT_NEXT_USHORT( p );\r\n        ValueCount  = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (ValueCount = %d)\\n\", ValueCount ));\r\n\r\n        len_value = otv_value_length( ValueFormat );\r\n\r\n        otv_Coverage_validate( table + Coverage, valid, ValueCount );\r\n\r\n        OTV_LIMIT_CHECK( ValueCount * len_value );\r\n\r\n        /* Value */\r\n        for ( ; ValueCount > 0; ValueCount-- )\r\n        {\r\n          otv_ValueRecord_validate( p, ValueFormat, valid );\r\n          p += len_value;\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 2                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_PairSet_validate( FT_Bytes       table,\r\n                        FT_UInt        format1,\r\n                        FT_UInt        format2,\r\n                        OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   value_len1, value_len2, PairValueCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"PairSet\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PairValueCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (PairValueCount = %d)\\n\", PairValueCount ));\r\n\r\n    value_len1 = otv_value_length( format1 );\r\n    value_len2 = otv_value_length( format2 );\r\n\r\n    OTV_LIMIT_CHECK( PairValueCount * ( value_len1 + value_len2 + 2 ) );\r\n\r\n    /* PairValueRecord */\r\n    for ( ; PairValueCount > 0; PairValueCount-- )\r\n    {\r\n      p += 2;       /* skip SecondGlyph */\r\n\r\n      if ( format1 )\r\n        otv_ValueRecord_validate( p, format1, valid ); /* Value1 */\r\n      p += value_len1;\r\n\r\n      if ( format2 )\r\n        otv_ValueRecord_validate( p, format2, valid ); /* Value2 */\r\n      p += value_len2;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* sets valid->extra3 (pointer to base table) */\r\n\r\n  static void\r\n  otv_PairPos_validate( FT_Bytes       table,\r\n                        OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"PairPos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    valid->extra3 = table;\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:     /* PairPosFormat1 */\r\n      {\r\n        FT_UInt  Coverage, ValueFormat1, ValueFormat2, PairSetCount;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 8 );\r\n        Coverage     = FT_NEXT_USHORT( p );\r\n        ValueFormat1 = FT_NEXT_USHORT( p );\r\n        ValueFormat2 = FT_NEXT_USHORT( p );\r\n        PairSetCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (PairSetCount = %d)\\n\", PairSetCount ));\r\n\r\n        otv_Coverage_validate( table + Coverage, valid, -1 );\r\n\r\n        OTV_LIMIT_CHECK( PairSetCount * 2 );\r\n\r\n        /* PairSetOffset */\r\n        for ( ; PairSetCount > 0; PairSetCount-- )\r\n          otv_PairSet_validate( table + FT_NEXT_USHORT( p ),\r\n                                ValueFormat1, ValueFormat2, valid );\r\n      }\r\n      break;\r\n\r\n    case 2:     /* PairPosFormat2 */\r\n      {\r\n        FT_UInt  Coverage, ValueFormat1, ValueFormat2, ClassDef1, ClassDef2;\r\n        FT_UInt  ClassCount1, ClassCount2, len_value1, len_value2, count;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 14 );\r\n        Coverage     = FT_NEXT_USHORT( p );\r\n        ValueFormat1 = FT_NEXT_USHORT( p );\r\n        ValueFormat2 = FT_NEXT_USHORT( p );\r\n        ClassDef1    = FT_NEXT_USHORT( p );\r\n        ClassDef2    = FT_NEXT_USHORT( p );\r\n        ClassCount1  = FT_NEXT_USHORT( p );\r\n        ClassCount2  = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (ClassCount1 = %d)\\n\", ClassCount1 ));\r\n        OTV_TRACE(( \" (ClassCount2 = %d)\\n\", ClassCount2 ));\r\n\r\n        len_value1 = otv_value_length( ValueFormat1 );\r\n        len_value2 = otv_value_length( ValueFormat2 );\r\n\r\n        otv_Coverage_validate( table + Coverage, valid, -1 );\r\n        otv_ClassDef_validate( table + ClassDef1, valid );\r\n        otv_ClassDef_validate( table + ClassDef2, valid );\r\n\r\n        OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 *\r\n                     ( len_value1 + len_value2 ) );\r\n\r\n        /* Class1Record */\r\n        for ( ; ClassCount1 > 0; ClassCount1-- )\r\n        {\r\n          /* Class2Record */\r\n          for ( count = ClassCount2; count > 0; count-- )\r\n          {\r\n            if ( ValueFormat1 )\r\n              /* Value1 */\r\n              otv_ValueRecord_validate( p, ValueFormat1, valid );\r\n            p += len_value1;\r\n\r\n            if ( ValueFormat2 )\r\n              /* Value2 */\r\n              otv_ValueRecord_validate( p, ValueFormat2, valid );\r\n            p += len_value2;\r\n          }\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 3                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_CursivePos_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"CursivePos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:     /* CursivePosFormat1 */\r\n      {\r\n        FT_UInt   table_size;\r\n        FT_UInt   Coverage, EntryExitCount;\r\n\r\n        OTV_OPTIONAL_TABLE( EntryAnchor );\r\n        OTV_OPTIONAL_TABLE( ExitAnchor  );\r\n\r\n\r\n        OTV_LIMIT_CHECK( 4 );\r\n        Coverage       = FT_NEXT_USHORT( p );\r\n        EntryExitCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (EntryExitCount = %d)\\n\", EntryExitCount ));\r\n\r\n        otv_Coverage_validate( table + Coverage, valid, EntryExitCount );\r\n\r\n        OTV_LIMIT_CHECK( EntryExitCount * 4 );\r\n\r\n        table_size = EntryExitCount * 4 + 4;\r\n\r\n        /* EntryExitRecord */\r\n        for ( ; EntryExitCount > 0; EntryExitCount-- )\r\n        {\r\n          OTV_OPTIONAL_OFFSET( EntryAnchor );\r\n          OTV_OPTIONAL_OFFSET( ExitAnchor  );\r\n\r\n          OTV_SIZE_CHECK( EntryAnchor );\r\n          if ( EntryAnchor )\r\n            otv_Anchor_validate( table + EntryAnchor, valid );\r\n\r\n          OTV_SIZE_CHECK( ExitAnchor );\r\n          if ( ExitAnchor )\r\n            otv_Anchor_validate( table + ExitAnchor, valid );\r\n        }\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 4                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* UNDOCUMENTED (in OpenType 1.5):              */\r\n  /* BaseRecord tables can contain NULL pointers. */\r\n\r\n  /* sets valid->extra2 (1) */\r\n\r\n  static void\r\n  otv_MarkBasePos_validate( FT_Bytes       table,\r\n                            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"MarkBasePos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:\r\n      valid->extra2 = 1;\r\n      OTV_NEST2( MarkBasePosFormat1, BaseArray );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 5                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra2 (1) */\r\n\r\n  static void\r\n  otv_MarkLigPos_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"MarkLigPos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:\r\n      valid->extra2 = 1;\r\n      OTV_NEST3( MarkLigPosFormat1, LigatureArray, LigatureAttach );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 6                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra2 (0) */\r\n\r\n  static void\r\n  otv_MarkMarkPos_validate( FT_Bytes       table,\r\n                            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"MarkMarkPos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:\r\n      valid->extra2 = 0;\r\n      OTV_NEST2( MarkMarkPosFormat1, Mark2Array );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 7                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra1 (lookup count) */\r\n\r\n  static void\r\n  otv_ContextPos_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ContextPos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      valid->extra1 = valid->lookup_count;\r\n      OTV_NEST3( ContextPosFormat1, PosRuleSet, PosRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 2:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      OTV_NEST3( ContextPosFormat2, PosClassSet, PosClassRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 3:\r\n      OTV_NEST1( ContextPosFormat3 );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 8                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra1 (lookup count) */\r\n\r\n  static void\r\n  otv_ChainContextPos_validate( FT_Bytes       table,\r\n                                OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ChainContextPos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      valid->extra1 = valid->lookup_count;\r\n      OTV_NEST3( ChainContextPosFormat1,\r\n                 ChainPosRuleSet, ChainPosRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 2:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      OTV_NEST3( ChainContextPosFormat2,\r\n                 ChainPosClassSet, ChainPosClassRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 3:\r\n      OTV_NEST1( ChainContextPosFormat3 );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GPOS LOOKUP TYPE 9                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* uses valid->type_funcs */\r\n\r\n  static void\r\n  otv_ExtensionPos_validate( FT_Bytes       table,\r\n                             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   PosFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ExtensionPos\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    PosFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", PosFormat ));\r\n\r\n    switch ( PosFormat )\r\n    {\r\n    case 1:     /* ExtensionPosFormat1 */\r\n      {\r\n        FT_UInt            ExtensionLookupType;\r\n        FT_ULong           ExtensionOffset;\r\n        OTV_Validate_Func  validate;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 6 );\r\n        ExtensionLookupType = FT_NEXT_USHORT( p );\r\n        ExtensionOffset     = FT_NEXT_ULONG( p );\r\n\r\n        if ( ExtensionLookupType == 0 || ExtensionLookupType >= 9 )\r\n          FT_INVALID_DATA;\r\n\r\n        validate = valid->type_funcs[ExtensionLookupType - 1];\r\n        validate( table + ExtensionOffset, valid );\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static const OTV_Validate_Func  otv_gpos_validate_funcs[9] =\r\n  {\r\n    otv_SinglePos_validate,\r\n    otv_PairPos_validate,\r\n    otv_CursivePos_validate,\r\n    otv_MarkBasePos_validate,\r\n    otv_MarkLigPos_validate,\r\n    otv_MarkMarkPos_validate,\r\n    otv_ContextPos_validate,\r\n    otv_ChainContextPos_validate,\r\n    otv_ExtensionPos_validate\r\n  };\r\n\r\n\r\n  /* sets valid->type_count */\r\n  /* sets valid->type_funcs */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_GPOS_subtable_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid )\r\n  {\r\n    valid->type_count = 9;\r\n    valid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs;\r\n\r\n    otv_Lookup_validate( table, valid );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          GPOS TABLE                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->glyph_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_GPOS_validate( FT_Bytes      table,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    OTV_ValidatorRec  validrec;\r\n    OTV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_UInt           ScriptList, FeatureList, LookupList;\r\n\r\n\r\n    valid->root = ftvalid;\r\n\r\n    FT_TRACE3(( \"validating GPOS table\\n\" ));\r\n    OTV_INIT;\r\n\r\n    OTV_LIMIT_CHECK( 10 );\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    ScriptList  = FT_NEXT_USHORT( p );\r\n    FeatureList = FT_NEXT_USHORT( p );\r\n    LookupList  = FT_NEXT_USHORT( p );\r\n\r\n    valid->type_count  = 9;\r\n    valid->type_funcs  = (OTV_Validate_Func*)otv_gpos_validate_funcs;\r\n    valid->glyph_count = glyph_count;\r\n\r\n    otv_LookupList_validate( table + LookupList,\r\n                             valid );\r\n    otv_FeatureList_validate( table + FeatureList, table + LookupList,\r\n                              valid );\r\n    otv_ScriptList_validate( table + ScriptList, table + FeatureList,\r\n                             valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvgpos.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvgpos.h                                                              */\r\n/*                                                                         */\r\n/*    OpenType GPOS table validator (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 2004 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __OTVGPOS_H__\r\n#define __OTVGPOS_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( void )\r\n  otv_GPOS_subtable_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __OTVGPOS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvgsub.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvgsub.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType GSUB table validation (body).                               */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2007 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvgsub\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  GSUB LOOKUP TYPE 1                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* uses valid->glyph_count */\r\n\r\n  static void\r\n  otv_SingleSubst_validate( FT_Bytes       table,\r\n                            OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"SingleSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:     /* SingleSubstFormat1 */\r\n      {\r\n        FT_Bytes  Coverage;\r\n        FT_Int    DeltaGlyphID;\r\n        FT_Long   idx;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 4 );\r\n        Coverage     = table + FT_NEXT_USHORT( p );\r\n        DeltaGlyphID = FT_NEXT_SHORT( p );\r\n\r\n        otv_Coverage_validate( Coverage, valid, -1 );\r\n\r\n        idx = otv_Coverage_get_first( Coverage ) + DeltaGlyphID;\r\n        if ( idx < 0 )\r\n          FT_INVALID_DATA;\r\n\r\n        idx = otv_Coverage_get_last( Coverage ) + DeltaGlyphID;\r\n        if ( (FT_UInt)idx >= valid->glyph_count )\r\n          FT_INVALID_DATA;\r\n      }\r\n      break;\r\n\r\n    case 2:     /* SingleSubstFormat2 */\r\n      {\r\n        FT_UInt  Coverage, GlyphCount;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 4 );\r\n        Coverage   = FT_NEXT_USHORT( p );\r\n        GlyphCount = FT_NEXT_USHORT( p );\r\n\r\n        OTV_TRACE(( \" (GlyphCount = %d)\\n\", GlyphCount ));\r\n\r\n        otv_Coverage_validate( table + Coverage, valid, GlyphCount );\r\n\r\n        OTV_LIMIT_CHECK( GlyphCount * 2 );\r\n\r\n        /* Substitute */\r\n        for ( ; GlyphCount > 0; GlyphCount-- )\r\n          if ( FT_NEXT_USHORT( p ) >= valid->glyph_count )\r\n            FT_INVALID_GLYPH_ID;\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  GSUB LOOKUP TYPE 2                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra1 (glyph count) */\r\n\r\n  static void\r\n  otv_MultipleSubst_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"MultipleSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:\r\n      valid->extra1 = valid->glyph_count;\r\n      OTV_NEST2( MultipleSubstFormat1, Sequence );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GSUB LOOKUP TYPE 3                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra1 (glyph count) */\r\n\r\n  static void\r\n  otv_AlternateSubst_validate( FT_Bytes       table,\r\n                               OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"AlternateSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:\r\n      valid->extra1 = valid->glyph_count;\r\n      OTV_NEST2( AlternateSubstFormat1, AlternateSet );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GSUB LOOKUP TYPE 4                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define LigatureFunc  otv_Ligature_validate\r\n\r\n  /* uses valid->glyph_count */\r\n\r\n  static void\r\n  otv_Ligature_validate( FT_Bytes       table,\r\n                         OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   LigatureGlyph, CompCount;\r\n\r\n\r\n    OTV_ENTER;\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n    LigatureGlyph = FT_NEXT_USHORT( p );\r\n    if ( LigatureGlyph >= valid->glyph_count )\r\n      FT_INVALID_DATA;\r\n\r\n    CompCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (CompCount = %d)\\n\", CompCount ));\r\n\r\n    if ( CompCount == 0 )\r\n      FT_INVALID_DATA;\r\n\r\n    CompCount--;\r\n\r\n    OTV_LIMIT_CHECK( CompCount * 2 );     /* Component */\r\n\r\n    /* no need to check the Component glyph indices */\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_LigatureSubst_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"LigatureSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:\r\n      OTV_NEST3( LigatureSubstFormat1, LigatureSet, Ligature );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  GSUB LOOKUP TYPE 5                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra1 (lookup count) */\r\n\r\n  static void\r\n  otv_ContextSubst_validate( FT_Bytes       table,\r\n                             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ContextSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      valid->extra1 = valid->lookup_count;\r\n      OTV_NEST3( ContextSubstFormat1, SubRuleSet, SubRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 2:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      OTV_NEST3( ContextSubstFormat2, SubClassSet, SubClassRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 3:\r\n      OTV_NEST1( ContextSubstFormat3 );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GSUB LOOKUP TYPE 6                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->extra1 (lookup count)            */\r\n\r\n  static void\r\n  otv_ChainContextSubst_validate( FT_Bytes       table,\r\n                                  OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ChainContextSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      valid->extra1 = valid->lookup_count;\r\n      OTV_NEST3( ChainContextSubstFormat1,\r\n                 ChainSubRuleSet, ChainSubRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 2:\r\n      /* no need to check glyph indices/classes used as input for these */\r\n      /* context rules since even invalid glyph indices/classes return  */\r\n      /* meaningful results                                             */\r\n\r\n      OTV_NEST3( ChainContextSubstFormat2,\r\n                 ChainSubClassSet, ChainSubClassRule );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    case 3:\r\n      OTV_NEST1( ChainContextSubstFormat3 );\r\n      OTV_RUN( table, valid );\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GSUB LOOKUP TYPE 7                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* uses valid->type_funcs */\r\n\r\n  static void\r\n  otv_ExtensionSubst_validate( FT_Bytes       table,\r\n                               OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   SubstFormat;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ExtensionSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:     /* ExtensionSubstFormat1 */\r\n      {\r\n        FT_UInt            ExtensionLookupType;\r\n        FT_ULong           ExtensionOffset;\r\n        OTV_Validate_Func  validate;\r\n\r\n\r\n        OTV_LIMIT_CHECK( 6 );\r\n        ExtensionLookupType = FT_NEXT_USHORT( p );\r\n        ExtensionOffset     = FT_NEXT_ULONG( p );\r\n\r\n        if ( ExtensionLookupType == 0 ||\r\n             ExtensionLookupType == 7 ||\r\n             ExtensionLookupType > 8  )\r\n          FT_INVALID_DATA;\r\n\r\n        validate = valid->type_funcs[ExtensionLookupType - 1];\r\n        validate( table + ExtensionOffset, valid );\r\n      }\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GSUB LOOKUP TYPE 8                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* uses valid->glyph_count */\r\n\r\n  static void\r\n  otv_ReverseChainSingleSubst_validate( FT_Bytes       table,\r\n                                        OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table, Coverage;\r\n    FT_UInt   SubstFormat;\r\n    FT_UInt   BacktrackGlyphCount, LookaheadGlyphCount, GlyphCount;\r\n\r\n\r\n    OTV_NAME_ENTER( \"ReverseChainSingleSubst\" );\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n    SubstFormat = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (format %d)\\n\", SubstFormat ));\r\n\r\n    switch ( SubstFormat )\r\n    {\r\n    case 1:     /* ReverseChainSingleSubstFormat1 */\r\n      OTV_LIMIT_CHECK( 4 );\r\n      Coverage            = table + FT_NEXT_USHORT( p );\r\n      BacktrackGlyphCount = FT_NEXT_USHORT( p );\r\n\r\n      OTV_TRACE(( \" (BacktrackGlyphCount = %d)\\n\", BacktrackGlyphCount ));\r\n\r\n      otv_Coverage_validate( Coverage, valid, -1 );\r\n\r\n      OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );\r\n\r\n      for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )\r\n        otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );\r\n\r\n      LookaheadGlyphCount = FT_NEXT_USHORT( p );\r\n\r\n      OTV_TRACE(( \" (LookaheadGlyphCount = %d)\\n\", LookaheadGlyphCount ));\r\n\r\n      OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );\r\n\r\n      for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )\r\n        otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );\r\n\r\n      GlyphCount = FT_NEXT_USHORT( p );\r\n\r\n      OTV_TRACE(( \" (GlyphCount = %d)\\n\", GlyphCount ));\r\n\r\n      if ( GlyphCount != otv_Coverage_get_count( Coverage ) )\r\n        FT_INVALID_DATA;\r\n\r\n      OTV_LIMIT_CHECK( GlyphCount * 2 );\r\n\r\n      /* Substitute */\r\n      for ( ; GlyphCount > 0; GlyphCount-- )\r\n        if ( FT_NEXT_USHORT( p ) >= valid->glyph_count )\r\n          FT_INVALID_DATA;\r\n\r\n      break;\r\n\r\n    default:\r\n      FT_INVALID_FORMAT;\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static const OTV_Validate_Func  otv_gsub_validate_funcs[8] =\r\n  {\r\n    otv_SingleSubst_validate,\r\n    otv_MultipleSubst_validate,\r\n    otv_AlternateSubst_validate,\r\n    otv_LigatureSubst_validate,\r\n    otv_ContextSubst_validate,\r\n    otv_ChainContextSubst_validate,\r\n    otv_ExtensionSubst_validate,\r\n    otv_ReverseChainSingleSubst_validate\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          GSUB TABLE                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->type_count  */\r\n  /* sets valid->type_funcs  */\r\n  /* sets valid->glyph_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_GSUB_validate( FT_Bytes      table,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    OTV_ValidatorRec  validrec;\r\n    OTV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_UInt           ScriptList, FeatureList, LookupList;\r\n\r\n\r\n    valid->root = ftvalid;\r\n\r\n    FT_TRACE3(( \"validating GSUB table\\n\" ));\r\n    OTV_INIT;\r\n\r\n    OTV_LIMIT_CHECK( 10 );\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    ScriptList  = FT_NEXT_USHORT( p );\r\n    FeatureList = FT_NEXT_USHORT( p );\r\n    LookupList  = FT_NEXT_USHORT( p );\r\n\r\n    valid->type_count  = 8;\r\n    valid->type_funcs  = (OTV_Validate_Func*)otv_gsub_validate_funcs;\r\n    valid->glyph_count = glyph_count;\r\n\r\n    otv_LookupList_validate( table + LookupList,\r\n                             valid );\r\n    otv_FeatureList_validate( table + FeatureList, table + LookupList,\r\n                              valid );\r\n    otv_ScriptList_validate( table + ScriptList, table + FeatureList,\r\n                             valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvjstf.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvjstf.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType JSTF table validation (body).                               */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2007 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n#include \"otvgpos.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvjstf\r\n\r\n\r\n#define JstfPriorityFunc  otv_JstfPriority_validate\r\n#define JstfLookupFunc    otv_GPOS_subtable_validate\r\n\r\n  /* uses valid->extra1 (GSUB lookup count) */\r\n  /* uses valid->extra2 (GPOS lookup count) */\r\n  /* sets valid->extra1 (counter)           */\r\n\r\n  static void\r\n  otv_JstfPriority_validate( FT_Bytes       table,\r\n                             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   table_size;\r\n    FT_UInt   gsub_lookup_count, gpos_lookup_count;\r\n\r\n    OTV_OPTIONAL_TABLE( ShrinkageEnableGSUB  );\r\n    OTV_OPTIONAL_TABLE( ShrinkageDisableGSUB );\r\n    OTV_OPTIONAL_TABLE( ShrinkageEnableGPOS  );\r\n    OTV_OPTIONAL_TABLE( ShrinkageDisableGPOS );\r\n    OTV_OPTIONAL_TABLE( ExtensionEnableGSUB  );\r\n    OTV_OPTIONAL_TABLE( ExtensionDisableGSUB );\r\n    OTV_OPTIONAL_TABLE( ExtensionEnableGPOS  );\r\n    OTV_OPTIONAL_TABLE( ExtensionDisableGPOS );\r\n    OTV_OPTIONAL_TABLE( ShrinkageJstfMax );\r\n    OTV_OPTIONAL_TABLE( ExtensionJstfMax );\r\n\r\n\r\n    OTV_ENTER;\r\n    OTV_TRACE(( \"JstfPriority table\\n\" ));\r\n\r\n    OTV_LIMIT_CHECK( 20 );\r\n\r\n    gsub_lookup_count = valid->extra1;\r\n    gpos_lookup_count = valid->extra2;\r\n\r\n    table_size = 20;\r\n\r\n    valid->extra1 = gsub_lookup_count;\r\n\r\n    OTV_OPTIONAL_OFFSET( ShrinkageEnableGSUB );\r\n    OTV_SIZE_CHECK( ShrinkageEnableGSUB );\r\n    if ( ShrinkageEnableGSUB )\r\n      otv_x_ux( table + ShrinkageEnableGSUB, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( ShrinkageDisableGSUB );\r\n    OTV_SIZE_CHECK( ShrinkageDisableGSUB );\r\n    if ( ShrinkageDisableGSUB )\r\n      otv_x_ux( table + ShrinkageDisableGSUB, valid );\r\n\r\n    valid->extra1 = gpos_lookup_count;\r\n\r\n    OTV_OPTIONAL_OFFSET( ShrinkageEnableGPOS );\r\n    OTV_SIZE_CHECK( ShrinkageEnableGPOS );\r\n    if ( ShrinkageEnableGPOS )\r\n      otv_x_ux( table + ShrinkageEnableGPOS, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( ShrinkageDisableGPOS );\r\n    OTV_SIZE_CHECK( ShrinkageDisableGPOS );\r\n    if ( ShrinkageDisableGPOS )\r\n      otv_x_ux( table + ShrinkageDisableGPOS, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( ShrinkageJstfMax );\r\n    OTV_SIZE_CHECK( ShrinkageJstfMax );\r\n    if ( ShrinkageJstfMax )\r\n    {\r\n      /* XXX: check lookup types? */\r\n      OTV_NEST2( JstfMax, JstfLookup );\r\n      OTV_RUN( table + ShrinkageJstfMax, valid );\r\n    }\r\n\r\n    valid->extra1 = gsub_lookup_count;\r\n\r\n    OTV_OPTIONAL_OFFSET( ExtensionEnableGSUB );\r\n    OTV_SIZE_CHECK( ExtensionEnableGSUB );\r\n    if ( ExtensionEnableGSUB )\r\n      otv_x_ux( table + ExtensionEnableGSUB, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( ExtensionDisableGSUB );\r\n    OTV_SIZE_CHECK( ExtensionDisableGSUB );\r\n    if ( ExtensionDisableGSUB )\r\n      otv_x_ux( table + ExtensionDisableGSUB, valid );\r\n\r\n    valid->extra1 = gpos_lookup_count;\r\n\r\n    OTV_OPTIONAL_OFFSET( ExtensionEnableGPOS );\r\n    OTV_SIZE_CHECK( ExtensionEnableGPOS );\r\n    if ( ExtensionEnableGPOS )\r\n      otv_x_ux( table + ExtensionEnableGPOS, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( ExtensionDisableGPOS );\r\n    OTV_SIZE_CHECK( ExtensionDisableGPOS );\r\n    if ( ExtensionDisableGPOS )\r\n      otv_x_ux( table + ExtensionDisableGPOS, valid );\r\n\r\n    OTV_OPTIONAL_OFFSET( ExtensionJstfMax );\r\n    OTV_SIZE_CHECK( ExtensionJstfMax );\r\n    if ( ExtensionJstfMax )\r\n    {\r\n      /* XXX: check lookup types? */\r\n      OTV_NEST2( JstfMax, JstfLookup );\r\n      OTV_RUN( table + ExtensionJstfMax, valid );\r\n    }\r\n\r\n    valid->extra1 = gsub_lookup_count;\r\n    valid->extra2 = gpos_lookup_count;\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* sets valid->extra (glyph count)               */\r\n  /* sets valid->func1 (otv_JstfPriority_validate) */\r\n\r\n  static void\r\n  otv_JstfScript_validate( FT_Bytes       table,\r\n                           OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   table_size;\r\n    FT_UInt   JstfLangSysCount;\r\n\r\n    OTV_OPTIONAL_TABLE( ExtGlyph );\r\n    OTV_OPTIONAL_TABLE( DefJstfLangSys );\r\n\r\n\r\n    OTV_NAME_ENTER( \"JstfScript\" );\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n    OTV_OPTIONAL_OFFSET( ExtGlyph );\r\n    OTV_OPTIONAL_OFFSET( DefJstfLangSys );\r\n    JstfLangSysCount = FT_NEXT_USHORT( p );\r\n\r\n    OTV_TRACE(( \" (JstfLangSysCount = %d)\\n\", JstfLangSysCount ));\r\n\r\n    table_size = JstfLangSysCount * 6 + 6;\r\n\r\n    OTV_SIZE_CHECK( ExtGlyph );\r\n    if ( ExtGlyph )\r\n    {\r\n      valid->extra1 = valid->glyph_count;\r\n      OTV_NEST1( ExtenderGlyph );\r\n      OTV_RUN( table + ExtGlyph, valid );\r\n    }\r\n\r\n    OTV_SIZE_CHECK( DefJstfLangSys );\r\n    if ( DefJstfLangSys )\r\n    {\r\n      OTV_NEST2( JstfLangSys, JstfPriority );\r\n      OTV_RUN( table + DefJstfLangSys, valid );\r\n    }\r\n\r\n    OTV_LIMIT_CHECK( 6 * JstfLangSysCount );\r\n\r\n    /* JstfLangSysRecord */\r\n    OTV_NEST2( JstfLangSys, JstfPriority );\r\n    for ( ; JstfLangSysCount > 0; JstfLangSysCount-- )\r\n    {\r\n      p += 4;       /* skip JstfLangSysTag */\r\n\r\n      OTV_RUN( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /* sets valid->extra1 (GSUB lookup count) */\r\n  /* sets valid->extra2 (GPOS lookup count) */\r\n  /* sets valid->glyph_count                */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_JSTF_validate( FT_Bytes      table,\r\n                     FT_Bytes      gsub,\r\n                     FT_Bytes      gpos,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    OTV_ValidatorRec  validrec;\r\n    OTV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_UInt           JstfScriptCount;\r\n\r\n\r\n    valid->root = ftvalid;\r\n\r\n    FT_TRACE3(( \"validating JSTF table\\n\" ));\r\n    OTV_INIT;\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    JstfScriptCount = FT_NEXT_USHORT( p );\r\n\r\n    FT_TRACE3(( \" (JstfScriptCount = %d)\\n\", JstfScriptCount ));\r\n\r\n    OTV_LIMIT_CHECK( JstfScriptCount * 6 );\r\n\r\n    if ( gsub )\r\n      valid->extra1 = otv_GSUBGPOS_get_Lookup_count( gsub );\r\n    else\r\n      valid->extra1 = 0;\r\n\r\n    if ( gpos )\r\n      valid->extra2 = otv_GSUBGPOS_get_Lookup_count( gpos );\r\n    else\r\n      valid->extra2 = 0;\r\n\r\n    valid->glyph_count = glyph_count;\r\n\r\n    /* JstfScriptRecord */\r\n    for ( ; JstfScriptCount > 0; JstfScriptCount-- )\r\n    {\r\n      p += 4;       /* skip JstfScriptTag */\r\n\r\n      /* JstfScript */\r\n      otv_JstfScript_validate( table + FT_NEXT_USHORT( p ), valid );\r\n    }\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvmath.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvmath.c                                                              */\r\n/*                                                                         */\r\n/*    OpenType MATH table validation (body).                               */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2008 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  Written by George Williams.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n#include \"otvgpos.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvmath\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  MATH TYPOGRAPHIC CONSTANTS                   *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_MathConstants_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   i;\r\n    FT_UInt   table_size;\r\n\r\n    OTV_OPTIONAL_TABLE( DeviceTableOffset );\r\n\r\n\r\n    OTV_NAME_ENTER( \"MathConstants\" );\r\n\r\n    /* 56 constants, 51 have device tables */\r\n    OTV_LIMIT_CHECK( 2 * ( 56 + 51 ) );\r\n    table_size = 2 * ( 56 + 51 );\r\n\r\n    p += 4 * 2;                 /* First 4 constants have no device tables */\r\n    for ( i = 0; i < 51; ++i )\r\n    {\r\n      p += 2;                                            /* skip the value */\r\n      OTV_OPTIONAL_OFFSET( DeviceTableOffset );\r\n      OTV_SIZE_CHECK( DeviceTableOffset );\r\n      if ( DeviceTableOffset )\r\n        otv_Device_validate( table + DeviceTableOffset, valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                   MATH ITALICS CORRECTION                     *****/\r\n  /*****                 MATH TOP ACCENT ATTACHMENT                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_MathItalicsCorrectionInfo_validate( FT_Bytes       table,\r\n                                          OTV_Validator  valid,\r\n                                          FT_Int         isItalic )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   i, cnt, table_size ;\r\n\r\n    OTV_OPTIONAL_TABLE( Coverage );\r\n    OTV_OPTIONAL_TABLE( DeviceTableOffset );\r\n\r\n    FT_UNUSED( isItalic );  /* only used if tracing is active */\r\n\r\n\r\n    OTV_NAME_ENTER( isItalic ? \"MathItalicsCorrectionInfo\"\r\n                             : \"MathTopAccentAttachment\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n\r\n    OTV_OPTIONAL_OFFSET( Coverage );\r\n    cnt = FT_NEXT_USHORT( p );\r\n\r\n    OTV_LIMIT_CHECK( 4 * cnt );\r\n    table_size = 4 + 4 * cnt;\r\n\r\n    OTV_SIZE_CHECK( Coverage );\r\n    otv_Coverage_validate( table + Coverage, valid, cnt );\r\n\r\n    for ( i = 0; i < cnt; ++i )\r\n    {\r\n      p += 2;                                            /* Skip the value */\r\n      OTV_OPTIONAL_OFFSET( DeviceTableOffset );\r\n      OTV_SIZE_CHECK( DeviceTableOffset );\r\n      if ( DeviceTableOffset )\r\n        otv_Device_validate( table + DeviceTableOffset, valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           MATH KERNING                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_MathKern_validate( FT_Bytes       table,\r\n                         OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   i, cnt, table_size;\r\n\r\n    OTV_OPTIONAL_TABLE( DeviceTableOffset );\r\n\r\n\r\n    /* OTV_NAME_ENTER( \"MathKern\" );*/\r\n\r\n    OTV_LIMIT_CHECK( 2 );\r\n\r\n    cnt = FT_NEXT_USHORT( p );\r\n\r\n    OTV_LIMIT_CHECK( 4 * cnt + 2 );\r\n    table_size = 4 + 4 * cnt;\r\n\r\n    /* Heights */\r\n    for ( i = 0; i < cnt; ++i )\r\n    {\r\n      p += 2;                                            /* Skip the value */\r\n      OTV_OPTIONAL_OFFSET( DeviceTableOffset );\r\n      OTV_SIZE_CHECK( DeviceTableOffset );\r\n      if ( DeviceTableOffset )\r\n        otv_Device_validate( table + DeviceTableOffset, valid );\r\n    }\r\n\r\n    /* One more Kerning value */\r\n    for ( i = 0; i < cnt + 1; ++i )\r\n    {\r\n      p += 2;                                            /* Skip the value */\r\n      OTV_OPTIONAL_OFFSET( DeviceTableOffset );\r\n      OTV_SIZE_CHECK( DeviceTableOffset );\r\n      if ( DeviceTableOffset )\r\n        otv_Device_validate( table + DeviceTableOffset, valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  static void\r\n  otv_MathKernInfo_validate( FT_Bytes       table,\r\n                             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   i, j, cnt, table_size;\r\n\r\n    OTV_OPTIONAL_TABLE( Coverage );\r\n    OTV_OPTIONAL_TABLE( MKRecordOffset );\r\n\r\n\r\n    OTV_NAME_ENTER( \"MathKernInfo\" );\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n\r\n    OTV_OPTIONAL_OFFSET( Coverage );\r\n    cnt = FT_NEXT_USHORT( p );\r\n\r\n    OTV_LIMIT_CHECK( 8 * cnt );\r\n    table_size = 4 + 8 * cnt;\r\n\r\n    OTV_SIZE_CHECK( Coverage );\r\n    otv_Coverage_validate( table + Coverage, valid, cnt );\r\n\r\n    for ( i = 0; i < cnt; ++i )\r\n    {\r\n      for ( j = 0; j < 4; ++j )\r\n      {\r\n        OTV_OPTIONAL_OFFSET( MKRecordOffset );\r\n        OTV_SIZE_CHECK( MKRecordOffset );\r\n        if ( MKRecordOffset )\r\n          otv_MathKern_validate( table + MKRecordOffset, valid );\r\n      }\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         MATH GLYPH INFO                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_MathGlyphInfo_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   MathItalicsCorrectionInfo, MathTopAccentAttachment;\r\n    FT_UInt   ExtendedShapeCoverage, MathKernInfo;\r\n\r\n\r\n    OTV_NAME_ENTER( \"MathGlyphInfo\" );\r\n\r\n    OTV_LIMIT_CHECK( 8 );\r\n\r\n    MathItalicsCorrectionInfo = FT_NEXT_USHORT( p );\r\n    MathTopAccentAttachment   = FT_NEXT_USHORT( p );\r\n    ExtendedShapeCoverage     = FT_NEXT_USHORT( p );\r\n    MathKernInfo              = FT_NEXT_USHORT( p );\r\n\r\n    if ( MathItalicsCorrectionInfo )\r\n      otv_MathItalicsCorrectionInfo_validate(\r\n        table + MathItalicsCorrectionInfo, valid, TRUE );\r\n\r\n    /* Italic correction and Top Accent Attachment have the same format */\r\n    if ( MathTopAccentAttachment )\r\n      otv_MathItalicsCorrectionInfo_validate(\r\n        table + MathTopAccentAttachment, valid, FALSE );\r\n\r\n    if ( ExtendedShapeCoverage )\r\n    {\r\n      OTV_NAME_ENTER( \"ExtendedShapeCoverage\" );\r\n      otv_Coverage_validate( table + ExtendedShapeCoverage, valid, -1 );\r\n      OTV_EXIT;\r\n    }\r\n\r\n    if ( MathKernInfo )\r\n      otv_MathKernInfo_validate( table + MathKernInfo, valid );\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    MATH GLYPH CONSTRUCTION                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  otv_GlyphAssembly_validate( FT_Bytes       table,\r\n                              OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   pcnt, table_size;\r\n    FT_UInt   i;\r\n\r\n    OTV_OPTIONAL_TABLE( DeviceTableOffset );\r\n\r\n\r\n    /* OTV_NAME_ENTER( \"GlyphAssembly\" ); */\r\n\r\n    OTV_LIMIT_CHECK( 6 );\r\n\r\n    p += 2;                           /* Skip the Italics Correction value */\r\n    OTV_OPTIONAL_OFFSET( DeviceTableOffset );\r\n    pcnt = FT_NEXT_USHORT( p );\r\n\r\n    OTV_LIMIT_CHECK( 8 * pcnt );\r\n    table_size = 6 + 8 * pcnt;\r\n\r\n    OTV_SIZE_CHECK( DeviceTableOffset );\r\n    if ( DeviceTableOffset )\r\n      otv_Device_validate( table + DeviceTableOffset, valid );\r\n\r\n    for ( i = 0; i < pcnt; ++i )\r\n    {\r\n      FT_UInt  gid;\r\n\r\n\r\n      gid = FT_NEXT_USHORT( p );\r\n      if ( gid >= valid->glyph_count )\r\n        FT_INVALID_GLYPH_ID;\r\n      p += 2*4;             /* skip the Start, End, Full, and Flags fields */\r\n    }\r\n\r\n    /* OTV_EXIT; */\r\n  }\r\n\r\n\r\n  static void\r\n  otv_MathGlyphConstruction_validate( FT_Bytes       table,\r\n                                      OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   vcnt, table_size;\r\n    FT_UInt   i;\r\n\r\n    OTV_OPTIONAL_TABLE( GlyphAssembly );\r\n\r\n\r\n    /* OTV_NAME_ENTER( \"MathGlyphConstruction\" ); */\r\n\r\n    OTV_LIMIT_CHECK( 4 );\r\n\r\n    OTV_OPTIONAL_OFFSET( GlyphAssembly );\r\n    vcnt = FT_NEXT_USHORT( p );\r\n\r\n    OTV_LIMIT_CHECK( 4 * vcnt );\r\n    table_size = 4 + 4 * vcnt;\r\n\r\n    for ( i = 0; i < vcnt; ++i )\r\n    {\r\n      FT_UInt  gid;\r\n\r\n\r\n      gid = FT_NEXT_USHORT( p );\r\n      if ( gid >= valid->glyph_count )\r\n        FT_INVALID_GLYPH_ID;\r\n      p += 2;                          /* skip the size */\r\n    }\r\n\r\n    OTV_SIZE_CHECK( GlyphAssembly );\r\n    if ( GlyphAssembly )\r\n      otv_GlyphAssembly_validate( table+GlyphAssembly, valid );\r\n\r\n    /* OTV_EXIT; */\r\n  }\r\n\r\n\r\n  static void\r\n  otv_MathVariants_validate( FT_Bytes       table,\r\n                             OTV_Validator  valid )\r\n  {\r\n    FT_Bytes  p = table;\r\n    FT_UInt   vcnt, hcnt, i, table_size;\r\n\r\n    OTV_OPTIONAL_TABLE( VCoverage );\r\n    OTV_OPTIONAL_TABLE( HCoverage );\r\n    OTV_OPTIONAL_TABLE( Offset );\r\n\r\n\r\n    OTV_NAME_ENTER( \"MathVariants\" );\r\n\r\n    OTV_LIMIT_CHECK( 10 );\r\n\r\n    p += 2;                       /* Skip the MinConnectorOverlap constant */\r\n    OTV_OPTIONAL_OFFSET( VCoverage );\r\n    OTV_OPTIONAL_OFFSET( HCoverage );\r\n    vcnt = FT_NEXT_USHORT( p );\r\n    hcnt = FT_NEXT_USHORT( p );\r\n\r\n    OTV_LIMIT_CHECK( 2 * vcnt + 2 * hcnt );\r\n    table_size = 10 + 2 * vcnt + 2 * hcnt;\r\n\r\n    OTV_SIZE_CHECK( VCoverage );\r\n    if ( VCoverage )\r\n      otv_Coverage_validate( table + VCoverage, valid, vcnt );\r\n\r\n    OTV_SIZE_CHECK( HCoverage );\r\n    if ( HCoverage )\r\n      otv_Coverage_validate( table + HCoverage, valid, hcnt );\r\n\r\n    for ( i = 0; i < vcnt; ++i )\r\n    {\r\n      OTV_OPTIONAL_OFFSET( Offset );\r\n      OTV_SIZE_CHECK( Offset );\r\n      otv_MathGlyphConstruction_validate( table + Offset, valid );\r\n    }\r\n\r\n    for ( i = 0; i < hcnt; ++i )\r\n    {\r\n      OTV_OPTIONAL_OFFSET( Offset );\r\n      OTV_SIZE_CHECK( Offset );\r\n      otv_MathGlyphConstruction_validate( table + Offset, valid );\r\n    }\r\n\r\n    OTV_EXIT;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          MATH TABLE                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* sets valid->glyph_count */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  otv_MATH_validate( FT_Bytes      table,\r\n                     FT_UInt       glyph_count,\r\n                     FT_Validator  ftvalid )\r\n  {\r\n    OTV_ValidatorRec  validrec;\r\n    OTV_Validator     valid = &validrec;\r\n    FT_Bytes          p     = table;\r\n    FT_UInt           MathConstants, MathGlyphInfo, MathVariants;\r\n\r\n\r\n    valid->root = ftvalid;\r\n\r\n    FT_TRACE3(( \"validating MATH table\\n\" ));\r\n    OTV_INIT;\r\n\r\n    OTV_LIMIT_CHECK( 10 );\r\n\r\n    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */\r\n      FT_INVALID_FORMAT;\r\n\r\n    MathConstants = FT_NEXT_USHORT( p );\r\n    MathGlyphInfo = FT_NEXT_USHORT( p );\r\n    MathVariants  = FT_NEXT_USHORT( p );\r\n\r\n    valid->glyph_count = glyph_count;\r\n\r\n    otv_MathConstants_validate( table + MathConstants,\r\n                                valid );\r\n    otv_MathGlyphInfo_validate( table + MathGlyphInfo,\r\n                                valid );\r\n    otv_MathVariants_validate ( table + MathVariants,\r\n                                valid );\r\n\r\n    FT_TRACE4(( \"\\n\" ));\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvmod.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvmod.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType's OpenType validation module implementation (body).         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2007, 2008 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_OPENTYPE_VALIDATE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_OPENTYPE_VALIDATE_H\r\n\r\n#include \"otvmod.h\"\r\n#include \"otvalid.h\"\r\n#include \"otvcommn.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_otvmodule\r\n\r\n\r\n  static FT_Error\r\n  otv_load_table( FT_Face             face,\r\n                  FT_Tag              tag,\r\n                  FT_Byte* volatile*  table,\r\n                  FT_ULong*           table_len )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n    error = FT_Load_Sfnt_Table( face, tag, 0, NULL, table_len );\r\n    if ( error == OTV_Err_Table_Missing )\r\n      return OTV_Err_Ok;\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_ALLOC( *table, *table_len ) )\r\n      goto Exit;\r\n\r\n    error = FT_Load_Sfnt_Table( face, tag, 0, *table, table_len );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  otv_validate( FT_Face volatile   face,\r\n                FT_UInt            ot_flags,\r\n                FT_Bytes          *ot_base,\r\n                FT_Bytes          *ot_gdef,\r\n                FT_Bytes          *ot_gpos,\r\n                FT_Bytes          *ot_gsub,\r\n                FT_Bytes          *ot_jstf )\r\n  {\r\n    FT_Error                  error = OTV_Err_Ok;\r\n    FT_Byte* volatile         base;\r\n    FT_Byte* volatile         gdef;\r\n    FT_Byte* volatile         gpos;\r\n    FT_Byte* volatile         gsub;\r\n    FT_Byte* volatile         jstf;\r\n    FT_Byte* volatile         math;\r\n    FT_ULong                  len_base, len_gdef, len_gpos, len_gsub, len_jstf;\r\n    FT_ULong                  len_math;\r\n    FT_UInt                   num_glyphs = (FT_UInt)face->num_glyphs;\r\n    FT_ValidatorRec volatile  valid;\r\n\r\n\r\n    base     = gdef     = gpos     = gsub     = jstf     = math     = NULL;\r\n    len_base = len_gdef = len_gpos = len_gsub = len_jstf = len_math = 0;\r\n\r\n    /*\r\n     * XXX: OpenType tables cannot handle 32-bit glyph index,\r\n     *      although broken TrueType can have 32-bit glyph index.\r\n     */\r\n    if ( face->num_glyphs > 0xFFFFL )\r\n    {\r\n      FT_TRACE1(( \"otv_validate: Invalid glyphs index (0x0000FFFF - 0x%08x) \",\r\n                  face->num_glyphs ));\r\n      FT_TRACE1(( \"are not handled by OpenType tables\\n\" ));\r\n      num_glyphs = 0xFFFF;\r\n    }\r\n\r\n    /* load tables */\r\n\r\n    if ( ot_flags & FT_VALIDATE_BASE )\r\n    {\r\n      error = otv_load_table( face, TTAG_BASE, &base, &len_base );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( ot_flags & FT_VALIDATE_GDEF )\r\n    {\r\n      error = otv_load_table( face, TTAG_GDEF, &gdef, &len_gdef );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( ot_flags & FT_VALIDATE_GPOS )\r\n    {\r\n      error = otv_load_table( face, TTAG_GPOS, &gpos, &len_gpos );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( ot_flags & FT_VALIDATE_GSUB )\r\n    {\r\n      error = otv_load_table( face, TTAG_GSUB, &gsub, &len_gsub );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( ot_flags & FT_VALIDATE_JSTF )\r\n    {\r\n      error = otv_load_table( face, TTAG_JSTF, &jstf, &len_jstf );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( ot_flags & FT_VALIDATE_MATH )\r\n    {\r\n      error = otv_load_table( face, TTAG_MATH, &math, &len_math );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* validate tables */\r\n\r\n    if ( base )\r\n    {\r\n      ft_validator_init( &valid, base, base + len_base, FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        otv_BASE_validate( base, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( gpos )\r\n    {\r\n      ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        otv_GPOS_validate( gpos, num_glyphs, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( gsub )\r\n    {\r\n      ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        otv_GSUB_validate( gsub, num_glyphs, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( gdef )\r\n    {\r\n      ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        otv_GDEF_validate( gdef, gsub, gpos, num_glyphs, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( jstf )\r\n    {\r\n      ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        otv_JSTF_validate( jstf, gsub, gpos, num_glyphs, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( math )\r\n    {\r\n      ft_validator_init( &valid, math, math + len_math, FT_VALIDATE_DEFAULT );\r\n      if ( ft_setjmp( valid.jump_buffer ) == 0 )\r\n        otv_MATH_validate( math, num_glyphs, &valid );\r\n      error = valid.error;\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    *ot_base = (FT_Bytes)base;\r\n    *ot_gdef = (FT_Bytes)gdef;\r\n    *ot_gpos = (FT_Bytes)gpos;\r\n    *ot_gsub = (FT_Bytes)gsub;\r\n    *ot_jstf = (FT_Bytes)jstf;\r\n\r\n  Exit:\r\n    if ( error )\r\n    {\r\n      FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n      FT_FREE( base );\r\n      FT_FREE( gdef );\r\n      FT_FREE( gpos );\r\n      FT_FREE( gsub );\r\n      FT_FREE( jstf );\r\n    }\r\n\r\n    {\r\n      FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n      FT_FREE( math );                 /* Can't return this as API is frozen */\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static\r\n  const FT_Service_OTvalidateRec  otvalid_interface =\r\n  {\r\n    otv_validate\r\n  };\r\n\r\n\r\n  static\r\n  const FT_ServiceDescRec  otvalid_services[] =\r\n  {\r\n    { FT_SERVICE_ID_OPENTYPE_VALIDATE, &otvalid_interface },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  static FT_Pointer\r\n  otvalid_get_service( FT_Module    module,\r\n                       const char*  service_id )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( otvalid_services, service_id );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Module_Class  otv_module_class =\r\n  {\r\n    0,\r\n    sizeof ( FT_ModuleRec ),\r\n    \"otvalid\",\r\n    0x10000L,\r\n    0x20000L,\r\n\r\n    0,              /* module-specific interface */\r\n\r\n    (FT_Module_Constructor)0,\r\n    (FT_Module_Destructor) 0,\r\n    (FT_Module_Requester)  otvalid_get_service\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/otvmod.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  otvmod.h                                                               */\r\n/*                                                                         */\r\n/*    FreeType's OpenType validation module implementation                 */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2004 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __OTVMOD_H__\r\n#define __OTVMOD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Module_Class )  otv_module_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __OTVMOD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/otvalid/rules.mk",
    "content": "#\r\n# FreeType 2 OpenType validation driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 2004, 2007 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# OTV driver directory\r\n#\r\nOTV_DIR := $(SRC_DIR)/otvalid\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nOTV_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(OTV_DIR))\r\n\r\n\r\n# OTV driver sources (i.e., C files)\r\n#\r\nOTV_DRV_SRC := $(OTV_DIR)/otvbase.c  \\\r\n               $(OTV_DIR)/otvcommn.c \\\r\n               $(OTV_DIR)/otvgdef.c  \\\r\n               $(OTV_DIR)/otvgpos.c  \\\r\n               $(OTV_DIR)/otvgsub.c  \\\r\n               $(OTV_DIR)/otvjstf.c  \\\r\n               $(OTV_DIR)/otvmath.c  \\\r\n               $(OTV_DIR)/otvmod.c\r\n\r\n# OTV driver headers\r\n#\r\nOTV_DRV_H := $(OTV_DIR)/otvalid.h  \\\r\n             $(OTV_DIR)/otvcommn.h \\\r\n             $(OTV_DIR)/otverror.h \\\r\n             $(OTV_DIR)/otvgpos.h  \\\r\n             $(OTV_DIR)/otvmod.h\r\n\r\n\r\n# OTV driver object(s)\r\n#\r\n#   OTV_DRV_OBJ_M is used during `multi' builds.\r\n#   OTV_DRV_OBJ_S is used during `single' builds.\r\n#\r\nOTV_DRV_OBJ_M := $(OTV_DRV_SRC:$(OTV_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nOTV_DRV_OBJ_S := $(OBJ_DIR)/otvalid.$O\r\n\r\n# OTV driver source file for single build\r\n#\r\nOTV_DRV_SRC_S := $(OTV_DIR)/otvalid.c\r\n\r\n\r\n# OTV driver - single object\r\n#\r\n$(OTV_DRV_OBJ_S): $(OTV_DRV_SRC_S) $(OTV_DRV_SRC) \\\r\n                   $(FREETYPE_H) $(OTV_DRV_H)\r\n\t$(OTV_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(OTV_DRV_SRC_S))\r\n\r\n\r\n# OTV driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(OTV_DIR)/%.c $(FREETYPE_H) $(OTV_DRV_H)\r\n\t$(OTV_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(OTV_DRV_OBJ_S)\r\nDRV_OBJS_M += $(OTV_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/Jamfile",
    "content": "# FreeType 2 src/pcf Jamfile\r\n#\r\n# Copyright 2001, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) pcf ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = pcfdrivr pcfread pcfutil ;\r\n  }\r\n  else\r\n  {\r\n    _sources = pcf ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/pcf Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/README",
    "content": "                  FreeType font driver for PCF fonts\r\n\r\n                       Francesco Zappa Nardelli\r\n                  <francesco.zappa.nardelli@ens.fr>\r\n\r\n\r\nIntroduction\r\n************\r\n\r\nPCF (Portable Compiled Format) is a binary bitmap font format, largely used\r\nin X world. This code implements a PCF driver for the FreeType library.\r\nGlyph images are loaded into memory only on demand, thus leading to a small\r\nmemory footprint.\r\n\r\nInformation on the PCF font format can only be worked out from\r\n`pcfread.c', and `pcfwrite.c', to be found, for instance, in the XFree86\r\n(www.xfree86.org) source tree (xc/lib/font/bitmap/).\r\n\r\nMany good bitmap fonts in bdf format come with XFree86: they can be\r\ncompiled into the pcf format using the `bdftopcf' utility.\r\n\r\n\r\nSupported hardware\r\n******************\r\n\r\nThe driver has been tested on linux/x86 and sunos5.5/sparc.  In both\r\ncases the compiler was gcc.  When back in Paris, I will test it also\r\non linux/alpha.\r\n\r\n\r\nEncodings\r\n*********\r\n\r\nUse `FT_Get_BDF_Charset_ID' to access the encoding and registry.\r\n\r\nThe driver always exports `ft_encoding_none' as face->charmap.encoding. \r\nFT_Get_Char_Index() behavior is unmodified, that is, it converts the ULong\r\nvalue given as argument into the corresponding glyph number.\r\n\r\n\r\nKnown problems\r\n**************\r\n\r\n- dealing explicitly with encodings breaks the uniformity of freetype2\r\n  api.\r\n\r\n- except for encodings properties, client applications have no\r\n  visibility of the PCF_Face object.  This means that applications\r\n  cannot directly access font tables and are obliged to trust\r\n  FreeType.\r\n\r\n- currently, glyph names and ink_metrics are ignored.\r\n\r\nI plan to give full visibility of the PCF_Face object in the next\r\nrelease of the driver, thus implementing also glyph names and\r\nink_metrics.\r\n\r\n- height is defined as (ascent - descent).  Is this correct?\r\n\r\n- if unable to read size information from the font, PCF_Init_Face\r\n  sets available_size->width and available_size->height to 12.\r\n\r\n- too many english grammar errors in the readme file :-(\r\n\r\n\r\nLicense\r\n*******\r\n\r\nCopyright (C) 2000 by Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n\"Software\"), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n\r\nCredits\r\n*******\r\n\r\nKeith Packard wrote the pcf driver found in XFree86.  His work is at\r\nthe same time the specification and the sample implementation of the\r\nPCF format.  Undoubtedly, this driver is inspired from his work.\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/module.mk",
    "content": "#\r\n# FreeType 2 PCF module definition\r\n#\r\n\r\n# Copyright 2000, 2006 by\r\n# Francesco Zappa Nardelli\r\n#\r\n# Permission is hereby granted, free of charge, to any person obtaining a copy\r\n# of this software and associated documentation files (the \"Software\"), to deal\r\n# in the Software without restriction, including without limitation the rights\r\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n# copies of the Software, and to permit persons to whom the Software is\r\n# furnished to do so, subject to the following conditions:\r\n#\r\n# The above copyright notice and this permission notice shall be included in\r\n# all copies or substantial portions of the Software.\r\n#\r\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n# THE SOFTWARE.\r\n\r\n\r\nFTMODULE_H_COMMANDS += PCF_DRIVER\r\n\r\ndefine PCF_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, pcf_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)pcf       $(ECHO_DRIVER_DESC)pcf bitmap fonts$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcf.c",
    "content": "/*  pcf.c\r\n\r\n    FreeType font driver for pcf fonts\r\n\r\n  Copyright 2000-2001, 2003 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"pcfutil.c\"\r\n#include \"pcfread.c\"\r\n#include \"pcfdrivr.c\"\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcf.h",
    "content": "/*  pcf.h\r\n\r\n  FreeType font driver for pcf fonts\r\n\r\n  Copyright (C) 2000, 2001, 2002, 2003, 2006, 2010 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#ifndef __PCF_H__\r\n#define __PCF_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  typedef struct  PCF_TableRec_\r\n  {\r\n    FT_ULong  type;\r\n    FT_ULong  format;\r\n    FT_ULong  size;\r\n    FT_ULong  offset;\r\n\r\n  } PCF_TableRec, *PCF_Table;\r\n\r\n\r\n  typedef struct  PCF_TocRec_\r\n  {\r\n    FT_ULong   version;\r\n    FT_ULong   count;\r\n    PCF_Table  tables;\r\n\r\n  } PCF_TocRec, *PCF_Toc;\r\n\r\n\r\n  typedef struct  PCF_ParsePropertyRec_\r\n  {\r\n    FT_Long  name;\r\n    FT_Byte  isString;\r\n    FT_Long  value;\r\n\r\n  } PCF_ParsePropertyRec, *PCF_ParseProperty;\r\n\r\n\r\n  typedef struct  PCF_PropertyRec_\r\n  {\r\n    FT_String*  name;\r\n    FT_Byte     isString;\r\n\r\n    union\r\n    {\r\n      FT_String*  atom;\r\n      FT_Long     l;\r\n      FT_ULong    ul;\r\n\r\n    } value;\r\n\r\n  } PCF_PropertyRec, *PCF_Property;\r\n\r\n\r\n  typedef struct  PCF_Compressed_MetricRec_\r\n  {\r\n    FT_Byte  leftSideBearing;\r\n    FT_Byte  rightSideBearing;\r\n    FT_Byte  characterWidth;\r\n    FT_Byte  ascent;\r\n    FT_Byte  descent;\r\n\r\n  } PCF_Compressed_MetricRec, *PCF_Compressed_Metric;\r\n\r\n\r\n  typedef struct  PCF_MetricRec_\r\n  {\r\n    FT_Short  leftSideBearing;\r\n    FT_Short  rightSideBearing;\r\n    FT_Short  characterWidth;\r\n    FT_Short  ascent;\r\n    FT_Short  descent;\r\n    FT_Short  attributes;\r\n    FT_ULong  bits;\r\n\r\n  } PCF_MetricRec, *PCF_Metric;\r\n\r\n\r\n  typedef struct  PCF_AccelRec_\r\n  {\r\n    FT_Byte        noOverlap;\r\n    FT_Byte        constantMetrics;\r\n    FT_Byte        terminalFont;\r\n    FT_Byte        constantWidth;\r\n    FT_Byte        inkInside;\r\n    FT_Byte        inkMetrics;\r\n    FT_Byte        drawDirection;\r\n    FT_Long        fontAscent;\r\n    FT_Long        fontDescent;\r\n    FT_Long        maxOverlap;\r\n    PCF_MetricRec  minbounds;\r\n    PCF_MetricRec  maxbounds;\r\n    PCF_MetricRec  ink_minbounds;\r\n    PCF_MetricRec  ink_maxbounds;\r\n\r\n  } PCF_AccelRec, *PCF_Accel;\r\n\r\n\r\n  typedef struct  PCF_EncodingRec_\r\n  {\r\n    FT_Long    enc;\r\n    FT_UShort  glyph;\r\n\r\n  } PCF_EncodingRec, *PCF_Encoding;\r\n\r\n\r\n  typedef struct  PCF_FaceRec_\r\n  {\r\n    FT_FaceRec     root;\r\n\r\n    FT_StreamRec   comp_stream;\r\n    FT_Stream      comp_source;\r\n\r\n    char*          charset_encoding;\r\n    char*          charset_registry;\r\n\r\n    PCF_TocRec     toc;\r\n    PCF_AccelRec   accel;\r\n\r\n    int            nprops;\r\n    PCF_Property   properties;\r\n\r\n    FT_Long        nmetrics;\r\n    PCF_Metric     metrics;\r\n    FT_Long        nencodings;\r\n    PCF_Encoding   encodings;\r\n\r\n    FT_Short       defaultChar;\r\n\r\n    FT_ULong       bitmapsFormat;\r\n\r\n    FT_CharMap     charmap_handle;\r\n    FT_CharMapRec  charmap;  /* a single charmap per face */\r\n\r\n  } PCF_FaceRec, *PCF_Face;\r\n\r\n\r\n  /* macros for pcf font format */\r\n\r\n#define LSBFirst  0\r\n#define MSBFirst  1\r\n\r\n#define PCF_FILE_VERSION        ( ( 'p' << 24 ) | \\\r\n                                  ( 'c' << 16 ) | \\\r\n                                  ( 'f' <<  8 ) | 1 )\r\n#define PCF_FORMAT_MASK         0xFFFFFF00UL\r\n\r\n#define PCF_DEFAULT_FORMAT      0x00000000UL\r\n#define PCF_INKBOUNDS           0x00000200UL\r\n#define PCF_ACCEL_W_INKBOUNDS   0x00000100UL\r\n#define PCF_COMPRESSED_METRICS  0x00000100UL\r\n\r\n#define PCF_FORMAT_MATCH( a, b ) \\\r\n          ( ( (a) & PCF_FORMAT_MASK ) == ( (b) & PCF_FORMAT_MASK ) )\r\n\r\n#define PCF_GLYPH_PAD_MASK  ( 3 << 0 )\r\n#define PCF_BYTE_MASK       ( 1 << 2 )\r\n#define PCF_BIT_MASK        ( 1 << 3 )\r\n#define PCF_SCAN_UNIT_MASK  ( 3 << 4 )\r\n\r\n#define PCF_BYTE_ORDER( f ) \\\r\n          ( ( (f) & PCF_BYTE_MASK ) ? MSBFirst : LSBFirst )\r\n#define PCF_BIT_ORDER( f ) \\\r\n          ( ( (f) & PCF_BIT_MASK ) ? MSBFirst : LSBFirst )\r\n#define PCF_GLYPH_PAD_INDEX( f ) \\\r\n          ( (f) & PCF_GLYPH_PAD_MASK )\r\n#define PCF_GLYPH_PAD( f ) \\\r\n          ( 1 << PCF_GLYPH_PAD_INDEX( f ) )\r\n#define PCF_SCAN_UNIT_INDEX( f ) \\\r\n          ( ( (f) & PCF_SCAN_UNIT_MASK ) >> 4 )\r\n#define PCF_SCAN_UNIT( f ) \\\r\n          ( 1 << PCF_SCAN_UNIT_INDEX( f ) )\r\n#define PCF_FORMAT_BITS( f )             \\\r\n          ( (f) & ( PCF_GLYPH_PAD_MASK | \\\r\n                    PCF_BYTE_MASK      | \\\r\n                    PCF_BIT_MASK       | \\\r\n                    PCF_SCAN_UNIT_MASK ) )\r\n\r\n#define PCF_SIZE_TO_INDEX( s )  ( (s) == 4 ? 2 : (s) == 2 ? 1 : 0 )\r\n#define PCF_INDEX_TO_SIZE( b )  ( 1 << b )\r\n\r\n#define PCF_FORMAT( bit, byte, glyph, scan )          \\\r\n          ( ( PCF_SIZE_TO_INDEX( scan )      << 4 ) | \\\r\n            ( ( (bit)  == MSBFirst ? 1 : 0 ) << 3 ) | \\\r\n            ( ( (byte) == MSBFirst ? 1 : 0 ) << 2 ) | \\\r\n            ( PCF_SIZE_TO_INDEX( glyph )     << 0 ) )\r\n\r\n#define PCF_PROPERTIES        ( 1 << 0 )\r\n#define PCF_ACCELERATORS      ( 1 << 1 )\r\n#define PCF_METRICS           ( 1 << 2 )\r\n#define PCF_BITMAPS           ( 1 << 3 )\r\n#define PCF_INK_METRICS       ( 1 << 4 )\r\n#define PCF_BDF_ENCODINGS     ( 1 << 5 )\r\n#define PCF_SWIDTHS           ( 1 << 6 )\r\n#define PCF_GLYPH_NAMES       ( 1 << 7 )\r\n#define PCF_BDF_ACCELERATORS  ( 1 << 8 )\r\n\r\n#define GLYPHPADOPTIONS  4 /* I'm not sure about this */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pcf_load_font( FT_Stream,\r\n                 PCF_Face );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PCF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcfdrivr.c",
    "content": "/*  pcfdrivr.c\r\n\r\n    FreeType font driver for pcf files\r\n\r\n    Copyright (C) 2000-2004, 2006-2011 by\r\n    Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_GZIP_H\r\n#include FT_LZW_H\r\n#include FT_BZIP2_H\r\n#include FT_ERRORS_H\r\n#include FT_BDF_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n#include \"pcf.h\"\r\n#include \"pcfdrivr.h\"\r\n#include \"pcfread.h\"\r\n\r\n#include \"pcferror.h\"\r\n#include \"pcfutil.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pcfread\r\n\r\n#include FT_SERVICE_BDF_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pcfdriver\r\n\r\n\r\n  typedef struct  PCF_CMapRec_\r\n  {\r\n    FT_CMapRec    root;\r\n    FT_UInt       num_encodings;\r\n    PCF_Encoding  encodings;\r\n\r\n  } PCF_CMapRec, *PCF_CMap;\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pcf_cmap_init( FT_CMap     pcfcmap,   /* PCF_CMap */\r\n                 FT_Pointer  init_data )\r\n  {\r\n    PCF_CMap  cmap = (PCF_CMap)pcfcmap;\r\n    PCF_Face  face = (PCF_Face)FT_CMAP_FACE( pcfcmap );\r\n\r\n    FT_UNUSED( init_data );\r\n\r\n\r\n    cmap->num_encodings = (FT_UInt)face->nencodings;\r\n    cmap->encodings     = face->encodings;\r\n\r\n    return PCF_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  pcf_cmap_done( FT_CMap  pcfcmap )         /* PCF_CMap */\r\n  {\r\n    PCF_CMap  cmap = (PCF_CMap)pcfcmap;\r\n\r\n\r\n    cmap->encodings     = NULL;\r\n    cmap->num_encodings = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  pcf_cmap_char_index( FT_CMap    pcfcmap,  /* PCF_CMap */\r\n                       FT_UInt32  charcode )\r\n  {\r\n    PCF_CMap      cmap      = (PCF_CMap)pcfcmap;\r\n    PCF_Encoding  encodings = cmap->encodings;\r\n    FT_UInt       min, max, mid;\r\n    FT_UInt       result    = 0;\r\n\r\n\r\n    min = 0;\r\n    max = cmap->num_encodings;\r\n\r\n    while ( min < max )\r\n    {\r\n      FT_ULong  code;\r\n\r\n\r\n      mid  = ( min + max ) >> 1;\r\n      code = encodings[mid].enc;\r\n\r\n      if ( charcode == code )\r\n      {\r\n        result = encodings[mid].glyph + 1;\r\n        break;\r\n      }\r\n\r\n      if ( charcode < code )\r\n        max = mid;\r\n      else\r\n        min = mid + 1;\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  pcf_cmap_char_next( FT_CMap    pcfcmap,   /* PCF_CMap */\r\n                      FT_UInt32  *acharcode )\r\n  {\r\n    PCF_CMap      cmap      = (PCF_CMap)pcfcmap;\r\n    PCF_Encoding  encodings = cmap->encodings;\r\n    FT_UInt       min, max, mid;\r\n    FT_ULong      charcode  = *acharcode + 1;\r\n    FT_UInt       result    = 0;\r\n\r\n\r\n    min = 0;\r\n    max = cmap->num_encodings;\r\n\r\n    while ( min < max )\r\n    {\r\n      FT_ULong  code;\r\n\r\n\r\n      mid  = ( min + max ) >> 1;\r\n      code = encodings[mid].enc;\r\n\r\n      if ( charcode == code )\r\n      {\r\n        result = encodings[mid].glyph + 1;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( charcode < code )\r\n        max = mid;\r\n      else\r\n        min = mid + 1;\r\n    }\r\n\r\n    charcode = 0;\r\n    if ( min < cmap->num_encodings )\r\n    {\r\n      charcode = encodings[min].enc;\r\n      result   = encodings[min].glyph + 1;\r\n    }\r\n\r\n  Exit:\r\n    if ( charcode > 0xFFFFFFFFUL )\r\n    {\r\n      FT_TRACE1(( \"pcf_cmap_char_next: charcode 0x%x > 32bit API\" ));\r\n      *acharcode = 0;\r\n      /* XXX: result should be changed to indicate an overflow error */\r\n    }\r\n    else\r\n      *acharcode = (FT_UInt32)charcode;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_CMap_ClassRec  pcf_cmap_class =\r\n  {\r\n    sizeof ( PCF_CMapRec ),\r\n    pcf_cmap_init,\r\n    pcf_cmap_done,\r\n    pcf_cmap_char_index,\r\n    pcf_cmap_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  PCF_Face_Done( FT_Face  pcfface )         /* PCF_Face */\r\n  {\r\n    PCF_Face   face = (PCF_Face)pcfface;\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n    FT_FREE( face->encodings );\r\n    FT_FREE( face->metrics );\r\n\r\n    /* free properties */\r\n    {\r\n      PCF_Property  prop;\r\n      FT_Int        i;\r\n\r\n\r\n      if ( face->properties )\r\n      {\r\n        for ( i = 0; i < face->nprops; i++ )\r\n        {\r\n          prop = &face->properties[i];\r\n\r\n          if ( prop )\r\n          {\r\n            FT_FREE( prop->name );\r\n            if ( prop->isString )\r\n              FT_FREE( prop->value.atom );\r\n          }\r\n        }\r\n      }\r\n      FT_FREE( face->properties );\r\n    }\r\n\r\n    FT_FREE( face->toc.tables );\r\n    FT_FREE( pcfface->family_name );\r\n    FT_FREE( pcfface->style_name );\r\n    FT_FREE( pcfface->available_sizes );\r\n    FT_FREE( face->charset_encoding );\r\n    FT_FREE( face->charset_registry );\r\n\r\n    /* close compressed stream if any */\r\n    if ( pcfface->stream == &face->comp_stream )\r\n    {\r\n      FT_Stream_Close( &face->comp_stream );\r\n      pcfface->stream = face->comp_source;\r\n    }\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  PCF_Face_Init( FT_Stream      stream,\r\n                 FT_Face        pcfface,        /* PCF_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    PCF_Face  face  = (PCF_Face)pcfface;\r\n    FT_Error  error = PCF_Err_Ok;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n    FT_UNUSED( face_index );\r\n\r\n\r\n    FT_TRACE2(( \"PCF driver\\n\" ));\r\n\r\n    error = pcf_load_font( stream, face );\r\n    if ( error )\r\n    {\r\n      PCF_Face_Done( pcfface );\r\n\r\n#if defined( FT_CONFIG_OPTION_USE_ZLIB )  || \\\r\n    defined( FT_CONFIG_OPTION_USE_LZW )   || \\\r\n    defined( FT_CONFIG_OPTION_USE_BZIP2 )\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_ZLIB\r\n      {\r\n        FT_Error  error2;\r\n\r\n\r\n        /* this didn't work, try gzip support! */\r\n        error2 = FT_Stream_OpenGzip( &face->comp_stream, stream );\r\n        if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature )\r\n          goto Fail;\r\n\r\n        error = error2;\r\n      }\r\n#endif /* FT_CONFIG_OPTION_USE_ZLIB */\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_LZW\r\n      if ( error )\r\n      {\r\n        FT_Error  error3;\r\n\r\n\r\n        /* this didn't work, try LZW support! */\r\n        error3 = FT_Stream_OpenLZW( &face->comp_stream, stream );\r\n        if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature )\r\n          goto Fail;\r\n\r\n        error = error3;\r\n      }\r\n#endif /* FT_CONFIG_OPTION_USE_LZW */\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_BZIP2\r\n      if ( error )\r\n      {\r\n        FT_Error  error4;\r\n\r\n\r\n        /* this didn't work, try Bzip2 support! */\r\n        error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream );\r\n        if ( FT_ERROR_BASE( error4 ) == FT_Err_Unimplemented_Feature )\r\n          goto Fail;\r\n\r\n        error = error4;\r\n      }\r\n#endif /* FT_CONFIG_OPTION_USE_BZIP2 */\r\n\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      face->comp_source = stream;\r\n      pcfface->stream   = &face->comp_stream;\r\n\r\n      stream = pcfface->stream;\r\n\r\n      error = pcf_load_font( stream, face );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n#else /* !(FT_CONFIG_OPTION_USE_ZLIB ||\r\n           FT_CONFIG_OPTION_USE_LZW ||\r\n           FT_CONFIG_OPTION_USE_BZIP2) */\r\n\r\n      goto Fail;\r\n\r\n#endif\r\n    }\r\n\r\n    /* set up charmap */\r\n    {\r\n      FT_String  *charset_registry = face->charset_registry;\r\n      FT_String  *charset_encoding = face->charset_encoding;\r\n      FT_Bool     unicode_charmap  = 0;\r\n\r\n\r\n      if ( charset_registry && charset_encoding )\r\n      {\r\n        char*  s = charset_registry;\r\n\r\n\r\n        /* Uh, oh, compare first letters manually to avoid dependency\r\n           on locales. */\r\n        if ( ( s[0] == 'i' || s[0] == 'I' ) &&\r\n             ( s[1] == 's' || s[1] == 'S' ) &&\r\n             ( s[2] == 'o' || s[2] == 'O' ) )\r\n        {\r\n          s += 3;\r\n          if ( !ft_strcmp( s, \"10646\" )                      ||\r\n               ( !ft_strcmp( s, \"8859\" ) &&\r\n                 !ft_strcmp( face->charset_encoding, \"1\" ) ) )\r\n          unicode_charmap = 1;\r\n        }\r\n      }\r\n\r\n      {\r\n        FT_CharMapRec  charmap;\r\n\r\n\r\n        charmap.face        = FT_FACE( face );\r\n        charmap.encoding    = FT_ENCODING_NONE;\r\n        /* initial platform/encoding should indicate unset status? */\r\n        charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;\r\n        charmap.encoding_id = TT_APPLE_ID_DEFAULT;\r\n\r\n        if ( unicode_charmap )\r\n        {\r\n          charmap.encoding    = FT_ENCODING_UNICODE;\r\n          charmap.platform_id = TT_PLATFORM_MICROSOFT;\r\n          charmap.encoding_id = TT_MS_ID_UNICODE_CS;\r\n        }\r\n\r\n        error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );\r\n\r\n#if 0\r\n        /* Select default charmap */\r\n        if ( pcfface->num_charmaps )\r\n          pcfface->charmap = pcfface->charmaps[0];\r\n#endif\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    FT_TRACE2(( \"  not a PCF file\\n\" ));\r\n    PCF_Face_Done( pcfface );\r\n    error = PCF_Err_Unknown_File_Format;  /* error */\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  PCF_Size_Select( FT_Size   size,\r\n                   FT_ULong  strike_index )\r\n  {\r\n    PCF_Accel  accel = &( (PCF_Face)size->face )->accel;\r\n\r\n\r\n    FT_Select_Metrics( size->face, strike_index );\r\n\r\n    size->metrics.ascender    =  accel->fontAscent << 6;\r\n    size->metrics.descender   = -accel->fontDescent << 6;\r\n    size->metrics.max_advance =  accel->maxbounds.characterWidth << 6;\r\n\r\n    return PCF_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  PCF_Size_Request( FT_Size          size,\r\n                    FT_Size_Request  req )\r\n  {\r\n    PCF_Face         face  = (PCF_Face)size->face;\r\n    FT_Bitmap_Size*  bsize = size->face->available_sizes;\r\n    FT_Error         error = PCF_Err_Invalid_Pixel_Size;\r\n    FT_Long          height;\r\n\r\n\r\n    height = FT_REQUEST_HEIGHT( req );\r\n    height = ( height + 32 ) >> 6;\r\n\r\n    switch ( req->type )\r\n    {\r\n    case FT_SIZE_REQUEST_TYPE_NOMINAL:\r\n      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )\r\n        error = PCF_Err_Ok;\r\n      break;\r\n\r\n    case FT_SIZE_REQUEST_TYPE_REAL_DIM:\r\n      if ( height == ( face->accel.fontAscent +\r\n                       face->accel.fontDescent ) )\r\n        error = PCF_Err_Ok;\r\n      break;\r\n\r\n    default:\r\n      error = PCF_Err_Unimplemented_Feature;\r\n      break;\r\n    }\r\n\r\n    if ( error )\r\n      return error;\r\n    else\r\n      return PCF_Size_Select( size, 0 );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  PCF_Glyph_Load( FT_GlyphSlot  slot,\r\n                  FT_Size       size,\r\n                  FT_UInt       glyph_index,\r\n                  FT_Int32      load_flags )\r\n  {\r\n    PCF_Face    face   = (PCF_Face)FT_SIZE_FACE( size );\r\n    FT_Stream   stream;\r\n    FT_Error    error  = PCF_Err_Ok;\r\n    FT_Bitmap*  bitmap = &slot->bitmap;\r\n    PCF_Metric  metric;\r\n    FT_Offset   bytes;\r\n\r\n    FT_UNUSED( load_flags );\r\n\r\n\r\n    FT_TRACE4(( \"load_glyph %d ---\", glyph_index ));\r\n\r\n    if ( !face || glyph_index >= (FT_UInt)face->root.num_glyphs )\r\n    {\r\n      error = PCF_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    stream = face->root.stream;\r\n\r\n    if ( glyph_index > 0 )\r\n      glyph_index--;\r\n\r\n    metric = face->metrics + glyph_index;\r\n\r\n    bitmap->rows       = metric->ascent + metric->descent;\r\n    bitmap->width      = metric->rightSideBearing - metric->leftSideBearing;\r\n    bitmap->num_grays  = 1;\r\n    bitmap->pixel_mode = FT_PIXEL_MODE_MONO;\r\n\r\n    FT_TRACE6(( \"BIT_ORDER %d ; BYTE_ORDER %d ; GLYPH_PAD %d\\n\",\r\n                  PCF_BIT_ORDER( face->bitmapsFormat ),\r\n                  PCF_BYTE_ORDER( face->bitmapsFormat ),\r\n                  PCF_GLYPH_PAD( face->bitmapsFormat ) ));\r\n\r\n    switch ( PCF_GLYPH_PAD( face->bitmapsFormat ) )\r\n    {\r\n    case 1:\r\n      bitmap->pitch = ( bitmap->width + 7 ) >> 3;\r\n      break;\r\n\r\n    case 2:\r\n      bitmap->pitch = ( ( bitmap->width + 15 ) >> 4 ) << 1;\r\n      break;\r\n\r\n    case 4:\r\n      bitmap->pitch = ( ( bitmap->width + 31 ) >> 5 ) << 2;\r\n      break;\r\n\r\n    case 8:\r\n      bitmap->pitch = ( ( bitmap->width + 63 ) >> 6 ) << 3;\r\n      break;\r\n\r\n    default:\r\n      return PCF_Err_Invalid_File_Format;\r\n    }\r\n\r\n    /* XXX: to do: are there cases that need repadding the bitmap? */\r\n    bytes = bitmap->pitch * bitmap->rows;\r\n\r\n    error = ft_glyphslot_alloc_bitmap( slot, bytes );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_STREAM_SEEK( metric->bits )          ||\r\n         FT_STREAM_READ( bitmap->buffer, bytes ) )\r\n      goto Exit;\r\n\r\n    if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )\r\n      BitOrderInvert( bitmap->buffer, bytes );\r\n\r\n    if ( ( PCF_BYTE_ORDER( face->bitmapsFormat ) !=\r\n           PCF_BIT_ORDER( face->bitmapsFormat )  ) )\r\n    {\r\n      switch ( PCF_SCAN_UNIT( face->bitmapsFormat ) )\r\n      {\r\n      case 1:\r\n        break;\r\n\r\n      case 2:\r\n        TwoByteSwap( bitmap->buffer, bytes );\r\n        break;\r\n\r\n      case 4:\r\n        FourByteSwap( bitmap->buffer, bytes );\r\n        break;\r\n      }\r\n    }\r\n\r\n    slot->format      = FT_GLYPH_FORMAT_BITMAP;\r\n    slot->bitmap_left = metric->leftSideBearing;\r\n    slot->bitmap_top  = metric->ascent;\r\n\r\n    slot->metrics.horiAdvance  = metric->characterWidth << 6;\r\n    slot->metrics.horiBearingX = metric->leftSideBearing << 6;\r\n    slot->metrics.horiBearingY = metric->ascent << 6;\r\n    slot->metrics.width        = ( metric->rightSideBearing -\r\n                                   metric->leftSideBearing ) << 6;\r\n    slot->metrics.height       = bitmap->rows << 6;\r\n\r\n    ft_synthesize_vertical_metrics( &slot->metrics,\r\n                                    ( face->accel.fontAscent +\r\n                                      face->accel.fontDescent ) << 6 );\r\n\r\n    FT_TRACE4(( \" --- ok\\n\" ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n /*\r\n  *\r\n  *  BDF SERVICE\r\n  *\r\n  */\r\n\r\n  static FT_Error\r\n  pcf_get_bdf_property( PCF_Face          face,\r\n                        const char*       prop_name,\r\n                        BDF_PropertyRec  *aproperty )\r\n  {\r\n    PCF_Property  prop;\r\n\r\n\r\n    prop = pcf_find_property( face, prop_name );\r\n    if ( prop != NULL )\r\n    {\r\n      if ( prop->isString )\r\n      {\r\n        aproperty->type   = BDF_PROPERTY_TYPE_ATOM;\r\n        aproperty->u.atom = prop->value.atom;\r\n      }\r\n      else\r\n      {\r\n        if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )\r\n        {\r\n          FT_TRACE1(( \"pcf_get_bdf_property: \" ));\r\n          FT_TRACE1(( \"too large integer 0x%x is truncated\\n\" ));\r\n        }\r\n        /* Apparently, the PCF driver loads all properties as signed integers!\r\n         * This really doesn't seem to be a problem, because this is\r\n         * sufficient for any meaningful values.\r\n         */\r\n        aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;\r\n        aproperty->u.integer = (FT_Int32)prop->value.l;\r\n      }\r\n      return 0;\r\n    }\r\n\r\n    return PCF_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_charset_id( PCF_Face      face,\r\n                      const char*  *acharset_encoding,\r\n                      const char*  *acharset_registry )\r\n  {\r\n    *acharset_encoding = face->charset_encoding;\r\n    *acharset_registry = face->charset_registry;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static const FT_Service_BDFRec  pcf_service_bdf =\r\n  {\r\n    (FT_BDF_GetCharsetIdFunc)pcf_get_charset_id,\r\n    (FT_BDF_GetPropertyFunc) pcf_get_bdf_property\r\n  };\r\n\r\n\r\n /*\r\n  *\r\n  *  SERVICE LIST\r\n  *\r\n  */\r\n\r\n  static const FT_ServiceDescRec  pcf_services[] =\r\n  {\r\n    { FT_SERVICE_ID_BDF,       &pcf_service_bdf },\r\n    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PCF },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  pcf_driver_requester( FT_Module    module,\r\n                        const char*  name )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( pcf_services, name );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Driver_ClassRec  pcf_driver_class =\r\n  {\r\n    {\r\n      FT_MODULE_FONT_DRIVER        |\r\n      FT_MODULE_DRIVER_NO_OUTLINES,\r\n      sizeof ( FT_DriverRec ),\r\n\r\n      \"pcf\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,\r\n\r\n      0,                    /* FT_Module_Constructor */\r\n      0,                    /* FT_Module_Destructor  */\r\n      pcf_driver_requester\r\n    },\r\n\r\n    sizeof ( PCF_FaceRec ),\r\n    sizeof ( FT_SizeRec ),\r\n    sizeof ( FT_GlyphSlotRec ),\r\n\r\n    PCF_Face_Init,\r\n    PCF_Face_Done,\r\n    0,                      /* FT_Size_InitFunc */\r\n    0,                      /* FT_Size_DoneFunc */\r\n    0,                      /* FT_Slot_InitFunc */\r\n    0,                      /* FT_Slot_DoneFunc */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n    PCF_Glyph_Load,\r\n\r\n    0,                      /* FT_Face_GetKerningFunc  */\r\n    0,                      /* FT_Face_AttachFunc      */\r\n    0,                      /* FT_Face_GetAdvancesFunc */\r\n\r\n    PCF_Size_Request,\r\n    PCF_Size_Select\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcfdrivr.h",
    "content": "/*  pcfdrivr.h\r\n\r\n    FreeType font driver for pcf fonts\r\n\r\n  Copyright 2000-2001, 2002 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#ifndef __PCFDRIVR_H__\r\n#define __PCFDRIVR_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n  FT_EXPORT_VAR( const FT_Driver_ClassRec )  pcf_driver_class;\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PCFDRIVR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcferror.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pcferror.h                                                             */\r\n/*                                                                         */\r\n/*    PCF error codes (specification only).                                */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the PCF error enumeration constants.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __PCFERROR_H__\r\n#define __PCFERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  PCF_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_PCF\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __PCFERROR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcfread.c",
    "content": "/*  pcfread.c\r\n\r\n    FreeType font driver for pcf fonts\r\n\r\n  Copyright 2000-2010, 2012 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#include \"pcf.h\"\r\n#include \"pcfread.h\"\r\n\r\n#include \"pcferror.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pcfread\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n  static const char* const  tableNames[] =\r\n  {\r\n    \"prop\", \"accl\", \"mtrcs\", \"bmps\", \"imtrcs\",\r\n    \"enc\", \"swidth\", \"names\", \"accel\"\r\n  };\r\n#endif\r\n\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_toc_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_TocRec\r\n\r\n    FT_FRAME_START( 8 ),\r\n      FT_FRAME_ULONG_LE( version ),\r\n      FT_FRAME_ULONG_LE( count ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_table_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_TableRec\r\n\r\n    FT_FRAME_START( 16  ),\r\n      FT_FRAME_ULONG_LE( type ),\r\n      FT_FRAME_ULONG_LE( format ),\r\n      FT_FRAME_ULONG_LE( size ),\r\n      FT_FRAME_ULONG_LE( offset ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static FT_Error\r\n  pcf_read_TOC( FT_Stream  stream,\r\n                PCF_Face   face )\r\n  {\r\n    FT_Error   error;\r\n    PCF_Toc    toc = &face->toc;\r\n    PCF_Table  tables;\r\n\r\n    FT_Memory  memory = FT_FACE(face)->memory;\r\n    FT_UInt    n;\r\n\r\n\r\n    if ( FT_STREAM_SEEK ( 0 )                          ||\r\n         FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )\r\n      return PCF_Err_Cannot_Open_Resource;\r\n\r\n    if ( toc->version != PCF_FILE_VERSION                 ||\r\n         toc->count   >  FT_ARRAY_MAX( face->toc.tables ) ||\r\n         toc->count   == 0                                )\r\n      return PCF_Err_Invalid_File_Format;\r\n\r\n    if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )\r\n      return PCF_Err_Out_Of_Memory;\r\n\r\n    tables = face->toc.tables;\r\n    for ( n = 0; n < toc->count; n++ )\r\n    {\r\n      if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) )\r\n        goto Exit;\r\n      tables++;\r\n    }\r\n\r\n    /* Sort tables and check for overlaps.  Because they are almost      */\r\n    /* always ordered already, an in-place bubble sort with simultaneous */\r\n    /* boundary checking seems appropriate.                              */\r\n    tables = face->toc.tables;\r\n\r\n    for ( n = 0; n < toc->count - 1; n++ )\r\n    {\r\n      FT_UInt  i, have_change;\r\n\r\n\r\n      have_change = 0;\r\n\r\n      for ( i = 0; i < toc->count - 1 - n; i++ )\r\n      {\r\n        PCF_TableRec  tmp;\r\n\r\n\r\n        if ( tables[i].offset > tables[i + 1].offset )\r\n        {\r\n          tmp           = tables[i];\r\n          tables[i]     = tables[i + 1];\r\n          tables[i + 1] = tmp;\r\n\r\n          have_change = 1;\r\n        }\r\n\r\n        if ( ( tables[i].size   > tables[i + 1].offset )                  ||\r\n             ( tables[i].offset > tables[i + 1].offset - tables[i].size ) )\r\n          return PCF_Err_Invalid_Offset;\r\n      }\r\n\r\n      if ( !have_change )\r\n        break;\r\n    }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n    {\r\n      FT_UInt      i, j;\r\n      const char*  name = \"?\";\r\n\r\n\r\n      FT_TRACE4(( \"pcf_read_TOC:\\n\" ));\r\n\r\n      FT_TRACE4(( \"  number of tables: %ld\\n\", face->toc.count ));\r\n\r\n      tables = face->toc.tables;\r\n      for ( i = 0; i < toc->count; i++ )\r\n      {\r\n        for ( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] );\r\n              j++ )\r\n          if ( tables[i].type == (FT_UInt)( 1 << j ) )\r\n            name = tableNames[j];\r\n\r\n        FT_TRACE4(( \"  %d: type=%s, format=0x%X, \"\r\n                    \"size=%ld (0x%lX), offset=%ld (0x%lX)\\n\",\r\n                    i, name,\r\n                    tables[i].format,\r\n                    tables[i].size, tables[i].size,\r\n                    tables[i].offset, tables[i].offset ));\r\n      }\r\n    }\r\n\r\n#endif\r\n\r\n    return PCF_Err_Ok;\r\n\r\n  Exit:\r\n    FT_FREE( face->toc.tables );\r\n    return error;\r\n  }\r\n\r\n\r\n#define PCF_METRIC_SIZE  12\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_metric_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_MetricRec\r\n\r\n    FT_FRAME_START( PCF_METRIC_SIZE ),\r\n      FT_FRAME_SHORT_LE( leftSideBearing ),\r\n      FT_FRAME_SHORT_LE( rightSideBearing ),\r\n      FT_FRAME_SHORT_LE( characterWidth ),\r\n      FT_FRAME_SHORT_LE( ascent ),\r\n      FT_FRAME_SHORT_LE( descent ),\r\n      FT_FRAME_SHORT_LE( attributes ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_metric_msb_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_MetricRec\r\n\r\n    FT_FRAME_START( PCF_METRIC_SIZE ),\r\n      FT_FRAME_SHORT( leftSideBearing ),\r\n      FT_FRAME_SHORT( rightSideBearing ),\r\n      FT_FRAME_SHORT( characterWidth ),\r\n      FT_FRAME_SHORT( ascent ),\r\n      FT_FRAME_SHORT( descent ),\r\n      FT_FRAME_SHORT( attributes ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n#define PCF_COMPRESSED_METRIC_SIZE  5\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_compressed_metric_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_Compressed_MetricRec\r\n\r\n    FT_FRAME_START( PCF_COMPRESSED_METRIC_SIZE ),\r\n      FT_FRAME_BYTE( leftSideBearing ),\r\n      FT_FRAME_BYTE( rightSideBearing ),\r\n      FT_FRAME_BYTE( characterWidth ),\r\n      FT_FRAME_BYTE( ascent ),\r\n      FT_FRAME_BYTE( descent ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_metric( FT_Stream   stream,\r\n                  FT_ULong    format,\r\n                  PCF_Metric  metric )\r\n  {\r\n    FT_Error  error = PCF_Err_Ok;\r\n\r\n\r\n    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )\r\n    {\r\n      const FT_Frame_Field*  fields;\r\n\r\n\r\n      /* parsing normal metrics */\r\n      fields = PCF_BYTE_ORDER( format ) == MSBFirst\r\n               ? pcf_metric_msb_header\r\n               : pcf_metric_header;\r\n\r\n      /* the following sets `error' but doesn't return in case of failure */\r\n      (void)FT_STREAM_READ_FIELDS( fields, metric );\r\n    }\r\n    else\r\n    {\r\n      PCF_Compressed_MetricRec  compr;\r\n\r\n\r\n      /* parsing compressed metrics */\r\n      if ( FT_STREAM_READ_FIELDS( pcf_compressed_metric_header, &compr ) )\r\n        goto Exit;\r\n\r\n      metric->leftSideBearing  = (FT_Short)( compr.leftSideBearing  - 0x80 );\r\n      metric->rightSideBearing = (FT_Short)( compr.rightSideBearing - 0x80 );\r\n      metric->characterWidth   = (FT_Short)( compr.characterWidth   - 0x80 );\r\n      metric->ascent           = (FT_Short)( compr.ascent           - 0x80 );\r\n      metric->descent          = (FT_Short)( compr.descent          - 0x80 );\r\n      metric->attributes       = 0;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_seek_to_table_type( FT_Stream  stream,\r\n                          PCF_Table  tables,\r\n                          FT_ULong   ntables, /* same as PCF_Toc->count */\r\n                          FT_ULong   type,\r\n                          FT_ULong  *aformat,\r\n                          FT_ULong  *asize )\r\n  {\r\n    FT_Error  error = PCF_Err_Invalid_File_Format;\r\n    FT_ULong  i;\r\n\r\n\r\n    for ( i = 0; i < ntables; i++ )\r\n      if ( tables[i].type == type )\r\n      {\r\n        if ( stream->pos > tables[i].offset )\r\n        {\r\n          error = PCF_Err_Invalid_Stream_Skip;\r\n          goto Fail;\r\n        }\r\n\r\n        if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) )\r\n        {\r\n          error = PCF_Err_Invalid_Stream_Skip;\r\n          goto Fail;\r\n        }\r\n\r\n        *asize   = tables[i].size;\r\n        *aformat = tables[i].format;\r\n\r\n        return PCF_Err_Ok;\r\n      }\r\n\r\n  Fail:\r\n    *asize = 0;\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  pcf_has_table_type( PCF_Table  tables,\r\n                      FT_ULong   ntables, /* same as PCF_Toc->count */\r\n                      FT_ULong   type )\r\n  {\r\n    FT_ULong  i;\r\n\r\n\r\n    for ( i = 0; i < ntables; i++ )\r\n      if ( tables[i].type == type )\r\n        return TRUE;\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n#define PCF_PROPERTY_SIZE  9\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_property_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_ParsePropertyRec\r\n\r\n    FT_FRAME_START( PCF_PROPERTY_SIZE ),\r\n      FT_FRAME_LONG_LE( name ),\r\n      FT_FRAME_BYTE   ( isString ),\r\n      FT_FRAME_LONG_LE( value ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_property_msb_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_ParsePropertyRec\r\n\r\n    FT_FRAME_START( PCF_PROPERTY_SIZE ),\r\n      FT_FRAME_LONG( name ),\r\n      FT_FRAME_BYTE( isString ),\r\n      FT_FRAME_LONG( value ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  FT_LOCAL_DEF( PCF_Property )\r\n  pcf_find_property( PCF_Face          face,\r\n                     const FT_String*  prop )\r\n  {\r\n    PCF_Property  properties = face->properties;\r\n    FT_Bool       found      = 0;\r\n    int           i;\r\n\r\n\r\n    for ( i = 0 ; i < face->nprops && !found; i++ )\r\n    {\r\n      if ( !ft_strcmp( properties[i].name, prop ) )\r\n        found = 1;\r\n    }\r\n\r\n    if ( found )\r\n      return properties + i - 1;\r\n    else\r\n      return NULL;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_properties( FT_Stream  stream,\r\n                      PCF_Face   face )\r\n  {\r\n    PCF_ParseProperty  props      = 0;\r\n    PCF_Property       properties = NULL;\r\n    FT_ULong           nprops, i;\r\n    FT_ULong           format, size;\r\n    FT_Error           error;\r\n    FT_Memory          memory     = FT_FACE(face)->memory;\r\n    FT_ULong           string_size;\r\n    FT_String*         strings    = 0;\r\n\r\n\r\n    error = pcf_seek_to_table_type( stream,\r\n                                    face->toc.tables,\r\n                                    face->toc.count,\r\n                                    PCF_PROPERTIES,\r\n                                    &format,\r\n                                    &size );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    if ( FT_READ_ULONG_LE( format ) )\r\n      goto Bail;\r\n\r\n    FT_TRACE4(( \"pcf_get_properties:\\n\" ));\r\n\r\n    FT_TRACE4(( \"  format = %ld\\n\", format ));\r\n\r\n    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )\r\n      goto Bail;\r\n\r\n    if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n      (void)FT_READ_ULONG( nprops );\r\n    else\r\n      (void)FT_READ_ULONG_LE( nprops );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    FT_TRACE4(( \"  nprop = %d (truncate %d props)\\n\",\r\n                (int)nprops, nprops - (int)nprops ));\r\n\r\n    nprops = (int)nprops;\r\n\r\n    /* rough estimate */\r\n    if ( nprops > size / PCF_PROPERTY_SIZE )\r\n    {\r\n      error = PCF_Err_Invalid_Table;\r\n      goto Bail;\r\n    }\r\n\r\n    face->nprops = (int)nprops;\r\n\r\n    if ( FT_NEW_ARRAY( props, nprops ) )\r\n      goto Bail;\r\n\r\n    for ( i = 0; i < nprops; i++ )\r\n    {\r\n      if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n      {\r\n        if ( FT_STREAM_READ_FIELDS( pcf_property_msb_header, props + i ) )\r\n          goto Bail;\r\n      }\r\n      else\r\n      {\r\n        if ( FT_STREAM_READ_FIELDS( pcf_property_header, props + i ) )\r\n          goto Bail;\r\n      }\r\n    }\r\n\r\n    /* pad the property array                                            */\r\n    /*                                                                   */\r\n    /* clever here - nprops is the same as the number of odd-units read, */\r\n    /* as only isStringProp are odd length   (Keith Packard)             */\r\n    /*                                                                   */\r\n    if ( nprops & 3 )\r\n    {\r\n      i = 4 - ( nprops & 3 );\r\n      if ( FT_STREAM_SKIP( i ) )\r\n      {\r\n        error = PCF_Err_Invalid_Stream_Skip;\r\n        goto Bail;\r\n      }\r\n    }\r\n\r\n    if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n      (void)FT_READ_ULONG( string_size );\r\n    else\r\n      (void)FT_READ_ULONG_LE( string_size );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    FT_TRACE4(( \"  string_size = %ld\\n\", string_size ));\r\n\r\n    /* rough estimate */\r\n    if ( string_size > size - nprops * PCF_PROPERTY_SIZE )\r\n    {\r\n      error = PCF_Err_Invalid_Table;\r\n      goto Bail;\r\n    }\r\n\r\n    /* allocate one more byte so that we have a final null byte */\r\n    if ( FT_NEW_ARRAY( strings, string_size + 1 ) )\r\n      goto Bail;\r\n\r\n    error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    if ( FT_NEW_ARRAY( properties, nprops ) )\r\n      goto Bail;\r\n\r\n    face->properties = properties;\r\n\r\n    for ( i = 0; i < nprops; i++ )\r\n    {\r\n      FT_Long  name_offset = props[i].name;\r\n\r\n\r\n      if ( ( name_offset < 0 )                     ||\r\n           ( (FT_ULong)name_offset > string_size ) )\r\n      {\r\n        error = PCF_Err_Invalid_Offset;\r\n        goto Bail;\r\n      }\r\n\r\n      if ( FT_STRDUP( properties[i].name, strings + name_offset ) )\r\n        goto Bail;\r\n\r\n      FT_TRACE4(( \"  %s:\", properties[i].name ));\r\n\r\n      properties[i].isString = props[i].isString;\r\n\r\n      if ( props[i].isString )\r\n      {\r\n        FT_Long  value_offset = props[i].value;\r\n\r\n\r\n        if ( ( value_offset < 0 )                     ||\r\n             ( (FT_ULong)value_offset > string_size ) )\r\n        {\r\n          error = PCF_Err_Invalid_Offset;\r\n          goto Bail;\r\n        }\r\n\r\n        if ( FT_STRDUP( properties[i].value.atom, strings + value_offset ) )\r\n          goto Bail;\r\n\r\n        FT_TRACE4(( \" `%s'\\n\", properties[i].value.atom ));\r\n      }\r\n      else\r\n      {\r\n        properties[i].value.l = props[i].value;\r\n\r\n        FT_TRACE4(( \" %d\\n\", properties[i].value.l ));\r\n      }\r\n    }\r\n\r\n    error = PCF_Err_Ok;\r\n\r\n  Bail:\r\n    FT_FREE( props );\r\n    FT_FREE( strings );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_metrics( FT_Stream  stream,\r\n                   PCF_Face   face )\r\n  {\r\n    FT_Error    error    = PCF_Err_Ok;\r\n    FT_Memory   memory   = FT_FACE(face)->memory;\r\n    FT_ULong    format, size;\r\n    PCF_Metric  metrics  = 0;\r\n    FT_ULong    nmetrics, i;\r\n\r\n\r\n    error = pcf_seek_to_table_type( stream,\r\n                                    face->toc.tables,\r\n                                    face->toc.count,\r\n                                    PCF_METRICS,\r\n                                    &format,\r\n                                    &size );\r\n    if ( error )\r\n      return error;\r\n\r\n    if ( FT_READ_ULONG_LE( format ) )\r\n      goto Bail;\r\n\r\n    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT )     &&\r\n         !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )\r\n      return PCF_Err_Invalid_File_Format;\r\n\r\n    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )\r\n    {\r\n      if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n        (void)FT_READ_ULONG( nmetrics );\r\n      else\r\n        (void)FT_READ_ULONG_LE( nmetrics );\r\n    }\r\n    else\r\n    {\r\n      if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n        (void)FT_READ_USHORT( nmetrics );\r\n      else\r\n        (void)FT_READ_USHORT_LE( nmetrics );\r\n    }\r\n    if ( error )\r\n      return PCF_Err_Invalid_File_Format;\r\n\r\n    face->nmetrics = nmetrics;\r\n\r\n    if ( !nmetrics )\r\n      return PCF_Err_Invalid_Table;\r\n\r\n    FT_TRACE4(( \"pcf_get_metrics:\\n\" ));\r\n\r\n    FT_TRACE4(( \"  number of metrics: %d\\n\", nmetrics ));\r\n\r\n    /* rough estimate */\r\n    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )\r\n    {\r\n      if ( nmetrics > size / PCF_METRIC_SIZE )\r\n        return PCF_Err_Invalid_Table;\r\n    }\r\n    else\r\n    {\r\n      if ( nmetrics > size / PCF_COMPRESSED_METRIC_SIZE )\r\n        return PCF_Err_Invalid_Table;\r\n    }\r\n\r\n    if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )\r\n      return PCF_Err_Out_Of_Memory;\r\n\r\n    metrics = face->metrics;\r\n    for ( i = 0; i < nmetrics; i++ )\r\n    {\r\n      error = pcf_get_metric( stream, format, metrics + i );\r\n\r\n      metrics[i].bits = 0;\r\n\r\n      FT_TRACE5(( \"  idx %d: width=%d, \"\r\n                  \"lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d\\n\",\r\n                  i,\r\n                  ( metrics + i )->characterWidth,\r\n                  ( metrics + i )->leftSideBearing,\r\n                  ( metrics + i )->rightSideBearing,\r\n                  ( metrics + i )->ascent,\r\n                  ( metrics + i )->descent,\r\n                  ( metrics + i )->attributes ));\r\n\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n    if ( error )\r\n      FT_FREE( face->metrics );\r\n\r\n  Bail:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_bitmaps( FT_Stream  stream,\r\n                   PCF_Face   face )\r\n  {\r\n    FT_Error   error   = PCF_Err_Ok;\r\n    FT_Memory  memory  = FT_FACE(face)->memory;\r\n    FT_Long*   offsets = NULL;\r\n    FT_Long    bitmapSizes[GLYPHPADOPTIONS];\r\n    FT_ULong   format, size;\r\n    FT_ULong   nbitmaps, i, sizebitmaps = 0;\r\n\r\n\r\n    error = pcf_seek_to_table_type( stream,\r\n                                    face->toc.tables,\r\n                                    face->toc.count,\r\n                                    PCF_BITMAPS,\r\n                                    &format,\r\n                                    &size );\r\n    if ( error )\r\n      return error;\r\n\r\n    error = FT_Stream_EnterFrame( stream, 8 );\r\n    if ( error )\r\n      return error;\r\n\r\n    format = FT_GET_ULONG_LE();\r\n    if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n      nbitmaps  = FT_GET_ULONG();\r\n    else\r\n      nbitmaps  = FT_GET_ULONG_LE();\r\n\r\n    FT_Stream_ExitFrame( stream );\r\n\r\n    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )\r\n      return PCF_Err_Invalid_File_Format;\r\n\r\n    FT_TRACE4(( \"pcf_get_bitmaps:\\n\" ));\r\n\r\n    FT_TRACE4(( \"  number of bitmaps: %d\\n\", nbitmaps ));\r\n\r\n    /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */\r\n    if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics )\r\n      return PCF_Err_Invalid_File_Format;\r\n\r\n    if ( FT_NEW_ARRAY( offsets, nbitmaps ) )\r\n      return error;\r\n\r\n    for ( i = 0; i < nbitmaps; i++ )\r\n    {\r\n      if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n        (void)FT_READ_LONG( offsets[i] );\r\n      else\r\n        (void)FT_READ_LONG_LE( offsets[i] );\r\n\r\n      FT_TRACE5(( \"  bitmap %d: offset %ld (0x%lX)\\n\",\r\n                  i, offsets[i], offsets[i] ));\r\n    }\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    for ( i = 0; i < GLYPHPADOPTIONS; i++ )\r\n    {\r\n      if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n        (void)FT_READ_LONG( bitmapSizes[i] );\r\n      else\r\n        (void)FT_READ_LONG_LE( bitmapSizes[i] );\r\n      if ( error )\r\n        goto Bail;\r\n\r\n      sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];\r\n\r\n      FT_TRACE4(( \"  padding %d implies a size of %ld\\n\", i, bitmapSizes[i] ));\r\n    }\r\n\r\n    FT_TRACE4(( \"  %d bitmaps, padding index %ld\\n\",\r\n                nbitmaps,\r\n                PCF_GLYPH_PAD_INDEX( format ) ));\r\n    FT_TRACE4(( \"  bitmap size = %d\\n\", sizebitmaps ));\r\n\r\n    FT_UNUSED( sizebitmaps );       /* only used for debugging */\r\n\r\n    for ( i = 0; i < nbitmaps; i++ )\r\n    {\r\n      /* rough estimate */\r\n      if ( ( offsets[i] < 0 )              ||\r\n           ( (FT_ULong)offsets[i] > size ) )\r\n      {\r\n        FT_TRACE0(( \"pcf_get_bitmaps:\"\r\n                    \" invalid offset to bitmap data of glyph %d\\n\", i ));\r\n      }\r\n      else\r\n        face->metrics[i].bits = stream->pos + offsets[i];\r\n    }\r\n\r\n    face->bitmapsFormat = format;\r\n\r\n  Bail:\r\n    FT_FREE( offsets );\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_encodings( FT_Stream  stream,\r\n                     PCF_Face   face )\r\n  {\r\n    FT_Error      error  = PCF_Err_Ok;\r\n    FT_Memory     memory = FT_FACE(face)->memory;\r\n    FT_ULong      format, size;\r\n    int           firstCol, lastCol;\r\n    int           firstRow, lastRow;\r\n    int           nencoding, encodingOffset;\r\n    int           i, j;\r\n    PCF_Encoding  tmpEncoding = NULL, encoding = 0;\r\n\r\n\r\n    error = pcf_seek_to_table_type( stream,\r\n                                    face->toc.tables,\r\n                                    face->toc.count,\r\n                                    PCF_BDF_ENCODINGS,\r\n                                    &format,\r\n                                    &size );\r\n    if ( error )\r\n      return error;\r\n\r\n    error = FT_Stream_EnterFrame( stream, 14 );\r\n    if ( error )\r\n      return error;\r\n\r\n    format = FT_GET_ULONG_LE();\r\n\r\n    if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n    {\r\n      firstCol          = FT_GET_SHORT();\r\n      lastCol           = FT_GET_SHORT();\r\n      firstRow          = FT_GET_SHORT();\r\n      lastRow           = FT_GET_SHORT();\r\n      face->defaultChar = FT_GET_SHORT();\r\n    }\r\n    else\r\n    {\r\n      firstCol          = FT_GET_SHORT_LE();\r\n      lastCol           = FT_GET_SHORT_LE();\r\n      firstRow          = FT_GET_SHORT_LE();\r\n      lastRow           = FT_GET_SHORT_LE();\r\n      face->defaultChar = FT_GET_SHORT_LE();\r\n    }\r\n\r\n    FT_Stream_ExitFrame( stream );\r\n\r\n    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )\r\n      return PCF_Err_Invalid_File_Format;\r\n\r\n    FT_TRACE4(( \"pdf_get_encodings:\\n\" ));\r\n\r\n    FT_TRACE4(( \"  firstCol %d, lastCol %d, firstRow %d, lastRow %d\\n\",\r\n                firstCol, lastCol, firstRow, lastRow ));\r\n\r\n    nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );\r\n\r\n    if ( FT_NEW_ARRAY( tmpEncoding, nencoding ) )\r\n      return PCF_Err_Out_Of_Memory;\r\n\r\n    error = FT_Stream_EnterFrame( stream, 2 * nencoding );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    for ( i = 0, j = 0 ; i < nencoding; i++ )\r\n    {\r\n      if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n        encodingOffset = FT_GET_SHORT();\r\n      else\r\n        encodingOffset = FT_GET_SHORT_LE();\r\n\r\n      if ( encodingOffset != -1 )\r\n      {\r\n        tmpEncoding[j].enc = ( ( ( i / ( lastCol - firstCol + 1 ) ) +\r\n                                 firstRow ) * 256 ) +\r\n                               ( ( i % ( lastCol - firstCol + 1 ) ) +\r\n                                 firstCol );\r\n\r\n        tmpEncoding[j].glyph = (FT_Short)encodingOffset;\r\n\r\n        FT_TRACE5(( \"  code %d (0x%04X): idx %d\\n\",\r\n                    tmpEncoding[j].enc, tmpEncoding[j].enc,\r\n                    tmpEncoding[j].glyph ));\r\n\r\n        j++;\r\n      }\r\n    }\r\n    FT_Stream_ExitFrame( stream );\r\n\r\n    if ( FT_NEW_ARRAY( encoding, j ) )\r\n      goto Bail;\r\n\r\n    for ( i = 0; i < j; i++ )\r\n    {\r\n      encoding[i].enc   = tmpEncoding[i].enc;\r\n      encoding[i].glyph = tmpEncoding[i].glyph;\r\n    }\r\n\r\n    face->nencodings = j;\r\n    face->encodings  = encoding;\r\n    FT_FREE( tmpEncoding );\r\n\r\n    return error;\r\n\r\n  Bail:\r\n    FT_FREE( encoding );\r\n    FT_FREE( tmpEncoding );\r\n    return error;\r\n  }\r\n\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_accel_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_AccelRec\r\n\r\n    FT_FRAME_START( 20 ),\r\n      FT_FRAME_BYTE      ( noOverlap ),\r\n      FT_FRAME_BYTE      ( constantMetrics ),\r\n      FT_FRAME_BYTE      ( terminalFont ),\r\n      FT_FRAME_BYTE      ( constantWidth ),\r\n      FT_FRAME_BYTE      ( inkInside ),\r\n      FT_FRAME_BYTE      ( inkMetrics ),\r\n      FT_FRAME_BYTE      ( drawDirection ),\r\n      FT_FRAME_SKIP_BYTES( 1 ),\r\n      FT_FRAME_LONG_LE   ( fontAscent ),\r\n      FT_FRAME_LONG_LE   ( fontDescent ),\r\n      FT_FRAME_LONG_LE   ( maxOverlap ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static\r\n  const FT_Frame_Field  pcf_accel_msb_header[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PCF_AccelRec\r\n\r\n    FT_FRAME_START( 20 ),\r\n      FT_FRAME_BYTE      ( noOverlap ),\r\n      FT_FRAME_BYTE      ( constantMetrics ),\r\n      FT_FRAME_BYTE      ( terminalFont ),\r\n      FT_FRAME_BYTE      ( constantWidth ),\r\n      FT_FRAME_BYTE      ( inkInside ),\r\n      FT_FRAME_BYTE      ( inkMetrics ),\r\n      FT_FRAME_BYTE      ( drawDirection ),\r\n      FT_FRAME_SKIP_BYTES( 1 ),\r\n      FT_FRAME_LONG      ( fontAscent ),\r\n      FT_FRAME_LONG      ( fontDescent ),\r\n      FT_FRAME_LONG      ( maxOverlap ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static FT_Error\r\n  pcf_get_accel( FT_Stream  stream,\r\n                 PCF_Face   face,\r\n                 FT_ULong   type )\r\n  {\r\n    FT_ULong   format, size;\r\n    FT_Error   error = PCF_Err_Ok;\r\n    PCF_Accel  accel = &face->accel;\r\n\r\n\r\n    error = pcf_seek_to_table_type( stream,\r\n                                    face->toc.tables,\r\n                                    face->toc.count,\r\n                                    type,\r\n                                    &format,\r\n                                    &size );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    if ( FT_READ_ULONG_LE( format ) )\r\n      goto Bail;\r\n\r\n    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT )    &&\r\n         !PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )\r\n      goto Bail;\r\n\r\n    if ( PCF_BYTE_ORDER( format ) == MSBFirst )\r\n    {\r\n      if ( FT_STREAM_READ_FIELDS( pcf_accel_msb_header, accel ) )\r\n        goto Bail;\r\n    }\r\n    else\r\n    {\r\n      if ( FT_STREAM_READ_FIELDS( pcf_accel_header, accel ) )\r\n        goto Bail;\r\n    }\r\n\r\n    error = pcf_get_metric( stream,\r\n                            format & ( ~PCF_FORMAT_MASK ),\r\n                            &(accel->minbounds) );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    error = pcf_get_metric( stream,\r\n                            format & ( ~PCF_FORMAT_MASK ),\r\n                            &(accel->maxbounds) );\r\n    if ( error )\r\n      goto Bail;\r\n\r\n    if ( PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )\r\n    {\r\n      error = pcf_get_metric( stream,\r\n                              format & ( ~PCF_FORMAT_MASK ),\r\n                              &(accel->ink_minbounds) );\r\n      if ( error )\r\n        goto Bail;\r\n\r\n      error = pcf_get_metric( stream,\r\n                              format & ( ~PCF_FORMAT_MASK ),\r\n                              &(accel->ink_maxbounds) );\r\n      if ( error )\r\n        goto Bail;\r\n    }\r\n    else\r\n    {\r\n      accel->ink_minbounds = accel->minbounds; /* I'm not sure about this */\r\n      accel->ink_maxbounds = accel->maxbounds;\r\n    }\r\n\r\n  Bail:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pcf_interpret_style( PCF_Face  pcf )\r\n  {\r\n    FT_Error   error  = PCF_Err_Ok;\r\n    FT_Face    face   = FT_FACE( pcf );\r\n    FT_Memory  memory = face->memory;\r\n\r\n    PCF_Property  prop;\r\n\r\n    size_t  nn, len;\r\n    char*   strings[4] = { NULL, NULL, NULL, NULL };\r\n    size_t  lengths[4];\r\n\r\n\r\n    face->style_flags = 0;\r\n\r\n    prop = pcf_find_property( pcf, \"SLANT\" );\r\n    if ( prop && prop->isString                                       &&\r\n         ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ||\r\n           *(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) )\r\n    {\r\n      face->style_flags |= FT_STYLE_FLAG_ITALIC;\r\n      strings[2] = ( *(prop->value.atom) == 'O' ||\r\n                     *(prop->value.atom) == 'o' ) ? (char *)\"Oblique\"\r\n                                                  : (char *)\"Italic\";\r\n    }\r\n\r\n    prop = pcf_find_property( pcf, \"WEIGHT_NAME\" );\r\n    if ( prop && prop->isString                                       &&\r\n         ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) )\r\n    {\r\n      face->style_flags |= FT_STYLE_FLAG_BOLD;\r\n      strings[1] = (char *)\"Bold\";\r\n    }\r\n\r\n    prop = pcf_find_property( pcf, \"SETWIDTH_NAME\" );\r\n    if ( prop && prop->isString                                        &&\r\n         *(prop->value.atom)                                           &&\r\n         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )\r\n      strings[3] = (char *)(prop->value.atom);\r\n\r\n    prop = pcf_find_property( pcf, \"ADD_STYLE_NAME\" );\r\n    if ( prop && prop->isString                                        &&\r\n         *(prop->value.atom)                                           &&\r\n         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )\r\n      strings[0] = (char *)(prop->value.atom);\r\n\r\n    for ( len = 0, nn = 0; nn < 4; nn++ )\r\n    {\r\n      lengths[nn] = 0;\r\n      if ( strings[nn] )\r\n      {\r\n        lengths[nn] = ft_strlen( strings[nn] );\r\n        len        += lengths[nn] + 1;\r\n      }\r\n    }\r\n\r\n    if ( len == 0 )\r\n    {\r\n      strings[0] = (char *)\"Regular\";\r\n      lengths[0] = ft_strlen( strings[0] );\r\n      len        = lengths[0] + 1;\r\n    }\r\n\r\n    {\r\n      char*  s;\r\n\r\n\r\n      if ( FT_ALLOC( face->style_name, len ) )\r\n        return error;\r\n\r\n      s = face->style_name;\r\n\r\n      for ( nn = 0; nn < 4; nn++ )\r\n      {\r\n        char*  src = strings[nn];\r\n\r\n\r\n        len = lengths[nn];\r\n\r\n        if ( src == NULL )\r\n          continue;\r\n\r\n        /* separate elements with a space */\r\n        if ( s != face->style_name )\r\n          *s++ = ' ';\r\n\r\n        ft_memcpy( s, src, len );\r\n\r\n        /* need to convert spaces to dashes for */\r\n        /* add_style_name and setwidth_name     */\r\n        if ( nn == 0 || nn == 3 )\r\n        {\r\n          size_t  mm;\r\n\r\n\r\n          for ( mm = 0; mm < len; mm++ )\r\n            if (s[mm] == ' ')\r\n              s[mm] = '-';\r\n        }\r\n\r\n        s += len;\r\n      }\r\n      *s = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pcf_load_font( FT_Stream  stream,\r\n                 PCF_Face   face )\r\n  {\r\n    FT_Error   error  = PCF_Err_Ok;\r\n    FT_Memory  memory = FT_FACE(face)->memory;\r\n    FT_Bool    hasBDFAccelerators;\r\n\r\n\r\n    error = pcf_read_TOC( stream, face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = pcf_get_properties( stream, face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* Use the old accelerators if no BDF accelerators are in the file. */\r\n    hasBDFAccelerators = pcf_has_table_type( face->toc.tables,\r\n                                             face->toc.count,\r\n                                             PCF_BDF_ACCELERATORS );\r\n    if ( !hasBDFAccelerators )\r\n    {\r\n      error = pcf_get_accel( stream, face, PCF_ACCELERATORS );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* metrics */\r\n    error = pcf_get_metrics( stream, face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* bitmaps */\r\n    error = pcf_get_bitmaps( stream, face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* encodings */\r\n    error = pcf_get_encodings( stream, face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* BDF style accelerators (i.e. bounds based on encoded glyphs) */\r\n    if ( hasBDFAccelerators )\r\n    {\r\n      error = pcf_get_accel( stream, face, PCF_BDF_ACCELERATORS );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* XXX: TO DO: inkmetrics and glyph_names are missing */\r\n\r\n    /* now construct the face object */\r\n    {\r\n      FT_Face       root = FT_FACE( face );\r\n      PCF_Property  prop;\r\n\r\n\r\n      root->num_faces  = 1;\r\n      root->face_index = 0;\r\n      root->face_flags = FT_FACE_FLAG_FIXED_SIZES |\r\n                         FT_FACE_FLAG_HORIZONTAL  |\r\n                         FT_FACE_FLAG_FAST_GLYPHS;\r\n\r\n      if ( face->accel.constantWidth )\r\n        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      if ( ( error = pcf_interpret_style( face ) ) != 0 )\r\n         goto Exit;\r\n\r\n      prop = pcf_find_property( face, \"FAMILY_NAME\" );\r\n      if ( prop && prop->isString )\r\n      {\r\n        if ( FT_STRDUP( root->family_name, prop->value.atom ) )\r\n          goto Exit;\r\n      }\r\n      else\r\n        root->family_name = NULL;\r\n\r\n      /*\r\n       * Note: We shift all glyph indices by +1 since we must\r\n       * respect the convention that glyph 0 always corresponds\r\n       * to the `missing glyph'.\r\n       *\r\n       * This implies bumping the number of `available' glyphs by 1.\r\n       */\r\n      root->num_glyphs = face->nmetrics + 1;\r\n\r\n      root->num_fixed_sizes = 1;\r\n      if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )\r\n        goto Exit;\r\n\r\n      {\r\n        FT_Bitmap_Size*  bsize = root->available_sizes;\r\n        FT_Short         resolution_x = 0, resolution_y = 0;\r\n\r\n\r\n        FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );\r\n\r\n#if 0\r\n        bsize->height = face->accel.maxbounds.ascent << 6;\r\n#endif\r\n        bsize->height = (FT_Short)( face->accel.fontAscent +\r\n                                    face->accel.fontDescent );\r\n\r\n        prop = pcf_find_property( face, \"AVERAGE_WIDTH\" );\r\n        if ( prop )\r\n          bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );\r\n        else\r\n          bsize->width = (FT_Short)( bsize->height * 2/3 );\r\n\r\n        prop = pcf_find_property( face, \"POINT_SIZE\" );\r\n        if ( prop )\r\n          /* convert from 722.7 decipoints to 72 points per inch */\r\n          bsize->size =\r\n            (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );\r\n\r\n        prop = pcf_find_property( face, \"PIXEL_SIZE\" );\r\n        if ( prop )\r\n          bsize->y_ppem = (FT_Short)prop->value.l << 6;\r\n\r\n        prop = pcf_find_property( face, \"RESOLUTION_X\" );\r\n        if ( prop )\r\n          resolution_x = (FT_Short)prop->value.l;\r\n\r\n        prop = pcf_find_property( face, \"RESOLUTION_Y\" );\r\n        if ( prop )\r\n          resolution_y = (FT_Short)prop->value.l;\r\n\r\n        if ( bsize->y_ppem == 0 )\r\n        {\r\n          bsize->y_ppem = bsize->size;\r\n          if ( resolution_y )\r\n            bsize->y_ppem = bsize->y_ppem * resolution_y / 72;\r\n        }\r\n        if ( resolution_x && resolution_y )\r\n          bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;\r\n        else\r\n          bsize->x_ppem = bsize->y_ppem;\r\n      }\r\n\r\n      /* set up charset */\r\n      {\r\n        PCF_Property  charset_registry = 0, charset_encoding = 0;\r\n\r\n\r\n        charset_registry = pcf_find_property( face, \"CHARSET_REGISTRY\" );\r\n        charset_encoding = pcf_find_property( face, \"CHARSET_ENCODING\" );\r\n\r\n        if ( charset_registry && charset_registry->isString &&\r\n             charset_encoding && charset_encoding->isString )\r\n        {\r\n          if ( FT_STRDUP( face->charset_encoding,\r\n                          charset_encoding->value.atom ) ||\r\n               FT_STRDUP( face->charset_registry,\r\n                          charset_registry->value.atom ) )\r\n            goto Exit;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    if ( error )\r\n    {\r\n      /* This is done to respect the behaviour of the original */\r\n      /* PCF font driver.                                      */\r\n      error = PCF_Err_Invalid_File_Format;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcfread.h",
    "content": "/*  pcfread.h\r\n\r\n    FreeType font driver for pcf fonts\r\n\r\n  Copyright 2003 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#ifndef __PCFREAD_H__\r\n#define __PCFREAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  FT_LOCAL( PCF_Property )\r\n  pcf_find_property( PCF_Face          face,\r\n                     const FT_String*  prop );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PCFREAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcfutil.c",
    "content": "/*\r\n\r\nCopyright 1990, 1994, 1998  The Open Group\r\n\r\nPermission to use, copy, modify, distribute, and sell this software and its\r\ndocumentation for any purpose is hereby granted without fee, provided that\r\nthe above copyright notice appear in all copies and that both that\r\ncopyright notice and this permission notice appear in supporting\r\ndocumentation.\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r\nAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\nExcept as contained in this notice, the name of The Open Group shall not be\r\nused in advertising or otherwise to promote the sale, use or other dealings\r\nin this Software without prior written authorization from The Open Group.\r\n\r\n*/\r\n/* $XFree86: xc/lib/font/util/utilbitmap.c,v 1.3 1999/08/22 08:58:58 dawes Exp $ */\r\n\r\n/*\r\n * Author:  Keith Packard, MIT X Consortium\r\n */\r\n\r\n/* Modified for use with FreeType */\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"pcfutil.h\"\r\n\r\n\r\n  /*\r\n   *  Invert bit order within each BYTE of an array.\r\n   */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  BitOrderInvert( unsigned char*  buf,\r\n                  size_t          nbytes )\r\n  {\r\n    for ( ; nbytes > 0; nbytes--, buf++ )\r\n    {\r\n      unsigned int  val = *buf;\r\n\r\n\r\n      val = ( ( val >> 1 ) & 0x55 ) | ( ( val << 1 ) & 0xAA );\r\n      val = ( ( val >> 2 ) & 0x33 ) | ( ( val << 2 ) & 0xCC );\r\n      val = ( ( val >> 4 ) & 0x0F ) | ( ( val << 4 ) & 0xF0 );\r\n\r\n      *buf = (unsigned char)val;\r\n    }\r\n  }\r\n\r\n\r\n  /*\r\n   *  Invert byte order within each 16-bits of an array.\r\n   */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  TwoByteSwap( unsigned char*  buf,\r\n               size_t          nbytes )\r\n  {\r\n    unsigned char  c;\r\n\r\n\r\n    for ( ; nbytes >= 2; nbytes -= 2, buf += 2 )\r\n    {\r\n      c      = buf[0];\r\n      buf[0] = buf[1];\r\n      buf[1] = c;\r\n    }\r\n  }\r\n\r\n  /*\r\n   *  Invert byte order within each 32-bits of an array.\r\n   */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  FourByteSwap( unsigned char*  buf,\r\n                size_t          nbytes )\r\n  {\r\n    unsigned char  c;\r\n\r\n\r\n    for ( ; nbytes >= 4; nbytes -= 4, buf += 4 )\r\n    {\r\n      c      = buf[0];\r\n      buf[0] = buf[3];\r\n      buf[3] = c;\r\n\r\n      c      = buf[1];\r\n      buf[1] = buf[2];\r\n      buf[2] = c;\r\n    }\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/pcfutil.h",
    "content": "/*  pcfutil.h\r\n\r\n    FreeType font driver for pcf fonts\r\n\r\n  Copyright 2000, 2001, 2004 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#ifndef __PCFUTIL_H__\r\n#define __PCFUTIL_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  FT_LOCAL( void )\r\n  BitOrderInvert( unsigned char*  buf,\r\n                  size_t          nbytes );\r\n\r\n  FT_LOCAL( void )\r\n  TwoByteSwap( unsigned char*  buf,\r\n               size_t          nbytes );\r\n\r\n  FT_LOCAL( void )\r\n  FourByteSwap( unsigned char*  buf,\r\n                size_t          nbytes );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PCFUTIL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pcf/rules.mk",
    "content": "#\r\n# FreeType 2 pcf driver configuration rules\r\n#\r\n\r\n\r\n# Copyright (C) 2000, 2001, 2003, 2008 by\r\n# Francesco Zappa Nardelli\r\n#\r\n# Permission is hereby granted, free of charge, to any person obtaining a copy\r\n# of this software and associated documentation files (the \"Software\"), to deal\r\n# in the Software without restriction, including without limitation the rights\r\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n# copies of the Software, and to permit persons to whom the Software is\r\n# furnished to do so, subject to the following conditions:\r\n#\r\n# The above copyright notice and this permission notice shall be included in\r\n# all copies or substantial portions of the Software.\r\n#\r\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n# THE SOFTWARE.\r\n\r\n\r\n# pcf driver directory\r\n#\r\nPCF_DIR := $(SRC_DIR)/pcf\r\n\r\n\r\nPCF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PCF_DIR))\r\n\r\n\r\n# pcf driver sources (i.e., C files)\r\n#\r\nPCF_DRV_SRC := $(PCF_DIR)/pcfdrivr.c \\\r\n               $(PCF_DIR)/pcfread.c  \\\r\n               $(PCF_DIR)/pcfutil.c\r\n\r\n# pcf driver headers\r\n#\r\nPCF_DRV_H := $(PCF_DRV_SRC:%.c=%.h) \\\r\n             $(PCF_DIR)/pcf.h       \\\r\n             $(PCF_DIR)/pcferror.h\r\n\r\n# pcf driver object(s)\r\n#\r\n#   PCF_DRV_OBJ_M is used during `multi' builds\r\n#   PCF_DRV_OBJ_S is used during `single' builds\r\n#\r\nPCF_DRV_OBJ_M := $(PCF_DRV_SRC:$(PCF_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nPCF_DRV_OBJ_S := $(OBJ_DIR)/pcf.$O\r\n\r\n# pcf driver source file for single build\r\n#\r\nPCF_DRV_SRC_S := $(PCF_DIR)/pcf.c\r\n\r\n\r\n# pcf driver - single object\r\n#\r\n$(PCF_DRV_OBJ_S): $(PCF_DRV_SRC_S) $(PCF_DRV_SRC) $(FREETYPE_H) $(PCF_DRV_H)\r\n\t$(PCF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PCF_DRV_SRC_S))\r\n\r\n\r\n# pcf driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(PCF_DIR)/%.c $(FREETYPE_H) $(PCF_DRV_H)\r\n\t$(PCF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(PCF_DRV_OBJ_S)\r\nDRV_OBJS_M += $(PCF_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/Jamfile",
    "content": "# FreeType 2 src/pfr Jamfile\r\n#\r\n# Copyright 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) pfr ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = pfrdrivr pfrgload pfrload pfrobjs pfrcmap pfrsbit ;\r\n  }\r\n  else\r\n  {\r\n    _sources = pfr ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/pfr Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/module.mk",
    "content": "#\r\n# FreeType 2 PFR module definition\r\n#\r\n\r\n\r\n# Copyright 2002, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += PFR_DRIVER\r\n\r\ndefine PFR_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, pfr_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)pfr       $(ECHO_DRIVER_DESC)PFR/TrueDoc font files with extension *.pfr$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfr.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfr.c                                                                  */\r\n/*                                                                         */\r\n/*    FreeType PFR driver component.                                       */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n\r\n#include \"pfrload.c\"\r\n#include \"pfrgload.c\"\r\n#include \"pfrcmap.c\"\r\n#include \"pfrobjs.c\"\r\n#include \"pfrdrivr.c\"\r\n#include \"pfrsbit.c\"\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrcmap.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrcmap.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR cmap handling (body).                                   */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2007, 2009 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"pfrcmap.h\"\r\n#include \"pfrobjs.h\"\r\n\r\n#include \"pfrerror.h\"\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_cmap_init( PFR_CMap  cmap )\r\n  {\r\n    FT_Error  error = PFR_Err_Ok;\r\n    PFR_Face  face  = (PFR_Face)FT_CMAP_FACE( cmap );\r\n\r\n\r\n    cmap->num_chars = face->phy_font.num_chars;\r\n    cmap->chars     = face->phy_font.chars;\r\n\r\n    /* just for safety, check that the character entries are correctly */\r\n    /* sorted in increasing character code order                       */\r\n    {\r\n      FT_UInt  n;\r\n\r\n\r\n      for ( n = 1; n < cmap->num_chars; n++ )\r\n      {\r\n        if ( cmap->chars[n - 1].char_code >= cmap->chars[n].char_code )\r\n        {\r\n          error = PFR_Err_Invalid_Table;\r\n          goto Exit;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  pfr_cmap_done( PFR_CMap  cmap )\r\n  {\r\n    cmap->chars     = NULL;\r\n    cmap->num_chars = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  pfr_cmap_char_index( PFR_CMap   cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    FT_UInt   min = 0;\r\n    FT_UInt   max = cmap->num_chars;\r\n    FT_UInt   mid;\r\n    PFR_Char  gchar;\r\n\r\n\r\n    while ( min < max )\r\n    {\r\n      mid   = min + ( max - min ) / 2;\r\n      gchar = cmap->chars + mid;\r\n\r\n      if ( gchar->char_code == char_code )\r\n        return mid + 1;\r\n\r\n      if ( gchar->char_code < char_code )\r\n        min = mid + 1;\r\n      else\r\n        max = mid;\r\n    }\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  pfr_cmap_char_next( PFR_CMap    cmap,\r\n                      FT_UInt32  *pchar_code )\r\n  {\r\n    FT_UInt    result    = 0;\r\n    FT_UInt32  char_code = *pchar_code + 1;\r\n\r\n\r\n  Restart:\r\n    {\r\n      FT_UInt   min = 0;\r\n      FT_UInt   max = cmap->num_chars;\r\n      FT_UInt   mid;\r\n      PFR_Char  gchar;\r\n\r\n\r\n      while ( min < max )\r\n      {\r\n        mid   = min + ( ( max - min ) >> 1 );\r\n        gchar = cmap->chars + mid;\r\n\r\n        if ( gchar->char_code == char_code )\r\n        {\r\n          result = mid;\r\n          if ( result != 0 )\r\n          {\r\n            result++;\r\n            goto Exit;\r\n          }\r\n\r\n          char_code++;\r\n          goto Restart;\r\n        }\r\n\r\n        if ( gchar->char_code < char_code )\r\n          min = mid+1;\r\n        else\r\n          max = mid;\r\n      }\r\n\r\n      /* we didn't find it, but we have a pair just above it */\r\n      char_code = 0;\r\n\r\n      if ( min < cmap->num_chars )\r\n      {\r\n        gchar  = cmap->chars + min;\r\n        result = min;\r\n        if ( result != 0 )\r\n        {\r\n          result++;\r\n          char_code = gchar->char_code;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    *pchar_code = char_code;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec\r\n  pfr_cmap_class_rec =\r\n  {\r\n    sizeof ( PFR_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     pfr_cmap_init,\r\n    (FT_CMap_DoneFunc)     pfr_cmap_done,\r\n    (FT_CMap_CharIndexFunc)pfr_cmap_char_index,\r\n    (FT_CMap_CharNextFunc) pfr_cmap_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrcmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrcmap.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR cmap handling (specification).                          */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFRCMAP_H__\r\n#define __PFRCMAP_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"pfrtypes.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  typedef struct  PFR_CMapRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_UInt     num_chars;\r\n    PFR_Char    chars;\r\n\r\n  } PFR_CMapRec, *PFR_CMap;\r\n\r\n\r\n  FT_CALLBACK_TABLE const FT_CMap_ClassRec  pfr_cmap_class_rec;\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PFRCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrdrivr.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrdrivr.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType PFR driver interface (body).                                */\r\n/*                                                                         */\r\n/*  Copyright 2002-2004, 2006, 2008, 2010, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_SERVICE_PFR_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n#include \"pfrdrivr.h\"\r\n#include \"pfrobjs.h\"\r\n\r\n#include \"pfrerror.h\"\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_get_kerning( FT_Face     pfrface,     /* PFR_Face */\r\n                   FT_UInt     left,\r\n                   FT_UInt     right,\r\n                   FT_Vector  *avector )\r\n  {\r\n    PFR_Face     face = (PFR_Face)pfrface;\r\n    PFR_PhyFont  phys = &face->phy_font;\r\n\r\n\r\n    pfr_face_get_kerning( pfrface, left, right, avector );\r\n\r\n    /* convert from metrics to outline units when necessary */\r\n    if ( phys->outline_resolution != phys->metrics_resolution )\r\n    {\r\n      if ( avector->x != 0 )\r\n        avector->x = FT_MulDiv( avector->x, phys->outline_resolution,\r\n                                            phys->metrics_resolution );\r\n\r\n      if ( avector->y != 0 )\r\n        avector->y = FT_MulDiv( avector->x, phys->outline_resolution,\r\n                                            phys->metrics_resolution );\r\n    }\r\n\r\n    return PFR_Err_Ok;\r\n  }\r\n\r\n\r\n /*\r\n  *  PFR METRICS SERVICE\r\n  *\r\n  */\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_get_advance( FT_Face   pfrface,       /* PFR_Face */\r\n                   FT_UInt   gindex,\r\n                   FT_Pos   *anadvance )\r\n  {\r\n    PFR_Face  face  = (PFR_Face)pfrface;\r\n    FT_Error  error = PFR_Err_Invalid_Argument;\r\n\r\n\r\n    *anadvance = 0;\r\n\r\n    if ( !gindex )\r\n      goto Exit;\r\n\r\n    gindex--;\r\n\r\n    if ( face )\r\n    {\r\n      PFR_PhyFont  phys = &face->phy_font;\r\n\r\n\r\n      if ( gindex < phys->num_chars )\r\n      {\r\n        *anadvance = phys->chars[gindex].advance;\r\n        error = PFR_Err_Ok;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_get_metrics( FT_Face    pfrface,      /* PFR_Face */\r\n                   FT_UInt   *anoutline_resolution,\r\n                   FT_UInt   *ametrics_resolution,\r\n                   FT_Fixed  *ametrics_x_scale,\r\n                   FT_Fixed  *ametrics_y_scale )\r\n  {\r\n    PFR_Face     face = (PFR_Face)pfrface;\r\n    PFR_PhyFont  phys = &face->phy_font;\r\n    FT_Fixed     x_scale, y_scale;\r\n    FT_Size      size = face->root.size;\r\n\r\n\r\n    if ( anoutline_resolution )\r\n      *anoutline_resolution = phys->outline_resolution;\r\n\r\n    if ( ametrics_resolution )\r\n      *ametrics_resolution = phys->metrics_resolution;\r\n\r\n    x_scale = 0x10000L;\r\n    y_scale = 0x10000L;\r\n\r\n    if ( size )\r\n    {\r\n      x_scale = FT_DivFix( size->metrics.x_ppem << 6,\r\n                           phys->metrics_resolution );\r\n\r\n      y_scale = FT_DivFix( size->metrics.y_ppem << 6,\r\n                           phys->metrics_resolution );\r\n    }\r\n\r\n    if ( ametrics_x_scale )\r\n      *ametrics_x_scale = x_scale;\r\n\r\n    if ( ametrics_y_scale )\r\n      *ametrics_y_scale = y_scale;\r\n\r\n    return PFR_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Service_PfrMetricsRec  pfr_metrics_service_rec =\r\n  {\r\n    pfr_get_metrics,\r\n    pfr_face_get_kerning,\r\n    pfr_get_advance\r\n  };\r\n\r\n\r\n /*\r\n  *  SERVICE LIST\r\n  *\r\n  */\r\n\r\n  static const FT_ServiceDescRec  pfr_services[] =\r\n  {\r\n    { FT_SERVICE_ID_PFR_METRICS, &pfr_metrics_service_rec },\r\n    { FT_SERVICE_ID_XF86_NAME,   FT_XF86_FORMAT_PFR },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  pfr_get_service( FT_Module         module,\r\n                   const FT_String*  service_id )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( pfr_services, service_id );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Driver_ClassRec  pfr_driver_class =\r\n  {\r\n    {\r\n      FT_MODULE_FONT_DRIVER     |\r\n      FT_MODULE_DRIVER_SCALABLE,\r\n\r\n      sizeof ( FT_DriverRec ),\r\n\r\n      \"pfr\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      NULL,\r\n\r\n      0,                /* FT_Module_Constructor */\r\n      0,                /* FT_Module_Destructor  */\r\n      pfr_get_service\r\n    },\r\n\r\n    sizeof ( PFR_FaceRec ),\r\n    sizeof ( PFR_SizeRec ),\r\n    sizeof ( PFR_SlotRec ),\r\n\r\n    pfr_face_init,\r\n    pfr_face_done,\r\n    0,                  /* FT_Size_InitFunc */\r\n    0,                  /* FT_Size_DoneFunc */\r\n    pfr_slot_init,\r\n    pfr_slot_done,\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n    pfr_slot_load,\r\n\r\n    pfr_get_kerning,\r\n    0,                  /* FT_Face_AttachFunc      */\r\n    0,                  /* FT_Face_GetAdvancesFunc */\r\n    0,                  /* FT_Size_RequestFunc     */\r\n    0,                  /* FT_Size_SelectFunc      */\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrdrivr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrdrivr.h                                                             */\r\n/*                                                                         */\r\n/*    High-level Type PFR driver interface (specification).                */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFRDRIVR_H__\r\n#define __PFRDRIVR_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Driver_ClassRec )  pfr_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PFRDRIVR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrerror.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrerror.h                                                             */\r\n/*                                                                         */\r\n/*    PFR error codes (specification only).                                */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the PFR error enumeration constants.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __PFRERROR_H__\r\n#define __PFRERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  PFR_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_PFR\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __PFRERROR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrgload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrgload.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType PFR glyph loader (body).                                    */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2005, 2007, 2010 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"pfrgload.h\"\r\n#include \"pfrsbit.h\"\r\n#include \"pfrload.h\"            /* for macro definitions */\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"pfrerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pfr\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      PFR GLYPH BUILDER                        *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  pfr_glyph_init( PFR_Glyph       glyph,\r\n                  FT_GlyphLoader  loader )\r\n  {\r\n    FT_ZERO( glyph );\r\n\r\n    glyph->loader     = loader;\r\n    glyph->path_begun = 0;\r\n\r\n    FT_GlyphLoader_Rewind( loader );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  pfr_glyph_done( PFR_Glyph  glyph )\r\n  {\r\n    FT_Memory  memory = glyph->loader->memory;\r\n\r\n\r\n    FT_FREE( glyph->x_control );\r\n    glyph->y_control = NULL;\r\n\r\n    glyph->max_xy_control = 0;\r\n#if 0\r\n    glyph->num_x_control  = 0;\r\n    glyph->num_y_control  = 0;\r\n#endif\r\n\r\n    FT_FREE( glyph->subs );\r\n\r\n    glyph->max_subs = 0;\r\n    glyph->num_subs = 0;\r\n\r\n    glyph->loader     = NULL;\r\n    glyph->path_begun = 0;\r\n  }\r\n\r\n\r\n  /* close current contour, if any */\r\n  static void\r\n  pfr_glyph_close_contour( PFR_Glyph  glyph )\r\n  {\r\n    FT_GlyphLoader  loader  = glyph->loader;\r\n    FT_Outline*     outline = &loader->current.outline;\r\n    FT_Int          last, first;\r\n\r\n\r\n    if ( !glyph->path_begun )\r\n      return;\r\n\r\n    /* compute first and last point indices in current glyph outline */\r\n    last  = outline->n_points - 1;\r\n    first = 0;\r\n    if ( outline->n_contours > 0 )\r\n      first = outline->contours[outline->n_contours - 1];\r\n\r\n    /* if the last point falls on the same location than the first one */\r\n    /* we need to delete it                                            */\r\n    if ( last > first )\r\n    {\r\n      FT_Vector*  p1 = outline->points + first;\r\n      FT_Vector*  p2 = outline->points + last;\r\n\r\n\r\n      if ( p1->x == p2->x && p1->y == p2->y )\r\n      {\r\n        outline->n_points--;\r\n        last--;\r\n      }\r\n    }\r\n\r\n    /* don't add empty contours */\r\n    if ( last >= first )\r\n      outline->contours[outline->n_contours++] = (short)last;\r\n\r\n    glyph->path_begun = 0;\r\n  }\r\n\r\n\r\n  /* reset glyph to start the loading of a new glyph */\r\n  static void\r\n  pfr_glyph_start( PFR_Glyph  glyph )\r\n  {\r\n    glyph->path_begun = 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pfr_glyph_line_to( PFR_Glyph   glyph,\r\n                     FT_Vector*  to )\r\n  {\r\n    FT_GlyphLoader  loader  = glyph->loader;\r\n    FT_Outline*     outline = &loader->current.outline;\r\n    FT_Error        error;\r\n\r\n\r\n    /* check that we have begun a new path */\r\n    if ( !glyph->path_begun )\r\n    {\r\n      error = PFR_Err_Invalid_Table;\r\n      FT_ERROR(( \"pfr_glyph_line_to: invalid glyph data\\n\" ));\r\n      goto Exit;\r\n    }\r\n\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( loader, 1, 0 );\r\n    if ( !error )\r\n    {\r\n      FT_UInt  n = outline->n_points;\r\n\r\n\r\n      outline->points[n] = *to;\r\n      outline->tags  [n] = FT_CURVE_TAG_ON;\r\n\r\n      outline->n_points++;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pfr_glyph_curve_to( PFR_Glyph   glyph,\r\n                      FT_Vector*  control1,\r\n                      FT_Vector*  control2,\r\n                      FT_Vector*  to )\r\n  {\r\n    FT_GlyphLoader  loader  = glyph->loader;\r\n    FT_Outline*     outline = &loader->current.outline;\r\n    FT_Error        error;\r\n\r\n\r\n    /* check that we have begun a new path */\r\n    if ( !glyph->path_begun )\r\n    {\r\n      error = PFR_Err_Invalid_Table;\r\n      FT_ERROR(( \"pfr_glyph_line_to: invalid glyph data\\n\" ));\r\n      goto Exit;\r\n    }\r\n\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( loader, 3, 0 );\r\n    if ( !error )\r\n    {\r\n      FT_Vector*  vec = outline->points         + outline->n_points;\r\n      FT_Byte*    tag = (FT_Byte*)outline->tags + outline->n_points;\r\n\r\n\r\n      vec[0] = *control1;\r\n      vec[1] = *control2;\r\n      vec[2] = *to;\r\n      tag[0] = FT_CURVE_TAG_CUBIC;\r\n      tag[1] = FT_CURVE_TAG_CUBIC;\r\n      tag[2] = FT_CURVE_TAG_ON;\r\n\r\n      outline->n_points = (FT_Short)( outline->n_points + 3 );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pfr_glyph_move_to( PFR_Glyph   glyph,\r\n                     FT_Vector*  to )\r\n  {\r\n    FT_GlyphLoader  loader  = glyph->loader;\r\n    FT_Error        error;\r\n\r\n\r\n    /* close current contour if any */\r\n    pfr_glyph_close_contour( glyph );\r\n\r\n    /* indicate that a new contour has started */\r\n    glyph->path_begun = 1;\r\n\r\n    /* check that there is space for a new contour and a new point */\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( loader, 1, 1 );\r\n    if ( !error )\r\n      /* add new start point */\r\n      error = pfr_glyph_line_to( glyph, to );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  pfr_glyph_end( PFR_Glyph  glyph )\r\n  {\r\n    /* close current contour if any */\r\n    pfr_glyph_close_contour( glyph );\r\n\r\n    /* merge the current glyph into the stack */\r\n    FT_GlyphLoader_Add( glyph->loader );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      PFR GLYPH LOADER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* load a simple glyph */\r\n  static FT_Error\r\n  pfr_glyph_load_simple( PFR_Glyph  glyph,\r\n                         FT_Byte*   p,\r\n                         FT_Byte*   limit )\r\n  {\r\n    FT_Error   error  = PFR_Err_Ok;\r\n    FT_Memory  memory = glyph->loader->memory;\r\n    FT_UInt    flags, x_count, y_count, i, count, mask;\r\n    FT_Int     x;\r\n\r\n\r\n    PFR_CHECK( 1 );\r\n    flags = PFR_NEXT_BYTE( p );\r\n\r\n    /* test for composite glyphs */\r\n    if ( flags & PFR_GLYPH_IS_COMPOUND )\r\n      goto Failure;\r\n\r\n    x_count = 0;\r\n    y_count = 0;\r\n\r\n    if ( flags & PFR_GLYPH_1BYTE_XYCOUNT )\r\n    {\r\n      PFR_CHECK( 1 );\r\n      count   = PFR_NEXT_BYTE( p );\r\n      x_count = count & 15;\r\n      y_count = count >> 4;\r\n    }\r\n    else\r\n    {\r\n      if ( flags & PFR_GLYPH_XCOUNT )\r\n      {\r\n        PFR_CHECK( 1 );\r\n        x_count = PFR_NEXT_BYTE( p );\r\n      }\r\n\r\n      if ( flags & PFR_GLYPH_YCOUNT )\r\n      {\r\n        PFR_CHECK( 1 );\r\n        y_count = PFR_NEXT_BYTE( p );\r\n      }\r\n    }\r\n\r\n    count = x_count + y_count;\r\n\r\n    /* re-allocate array when necessary */\r\n    if ( count > glyph->max_xy_control )\r\n    {\r\n      FT_UInt  new_max = FT_PAD_CEIL( count, 8 );\r\n\r\n\r\n      if ( FT_RENEW_ARRAY( glyph->x_control,\r\n                           glyph->max_xy_control,\r\n                           new_max ) )\r\n        goto Exit;\r\n\r\n      glyph->max_xy_control = new_max;\r\n    }\r\n\r\n    glyph->y_control = glyph->x_control + x_count;\r\n\r\n    mask  = 0;\r\n    x     = 0;\r\n\r\n    for ( i = 0; i < count; i++ )\r\n    {\r\n      if ( ( i & 7 ) == 0 )\r\n      {\r\n        PFR_CHECK( 1 );\r\n        mask = PFR_NEXT_BYTE( p );\r\n      }\r\n\r\n      if ( mask & 1 )\r\n      {\r\n        PFR_CHECK( 2 );\r\n        x = PFR_NEXT_SHORT( p );\r\n      }\r\n      else\r\n      {\r\n        PFR_CHECK( 1 );\r\n        x += PFR_NEXT_BYTE( p );\r\n      }\r\n\r\n      glyph->x_control[i] = x;\r\n\r\n      mask >>= 1;\r\n    }\r\n\r\n    /* XXX: for now we ignore the secondary stroke and edge definitions */\r\n    /*      since we don't want to support native PFR hinting           */\r\n    /*                                                                  */\r\n    if ( flags & PFR_GLYPH_EXTRA_ITEMS )\r\n    {\r\n      error = pfr_extra_items_skip( &p, limit );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    pfr_glyph_start( glyph );\r\n\r\n    /* now load a simple glyph */\r\n    {\r\n      FT_Vector   pos[4];\r\n      FT_Vector*  cur;\r\n\r\n\r\n      pos[0].x = pos[0].y = 0;\r\n      pos[3]   = pos[0];\r\n\r\n      for (;;)\r\n      {\r\n        FT_UInt  format, format_low, args_format = 0, args_count, n;\r\n\r\n\r\n        /***************************************************************/\r\n        /*  read instruction                                           */\r\n        /*                                                             */\r\n        PFR_CHECK( 1 );\r\n        format     = PFR_NEXT_BYTE( p );\r\n        format_low = format & 15;\r\n\r\n        switch ( format >> 4 )\r\n        {\r\n        case 0:                             /* end glyph */\r\n          FT_TRACE6(( \"- end glyph\" ));\r\n          args_count = 0;\r\n          break;\r\n\r\n        case 1:                             /* general line operation */\r\n          FT_TRACE6(( \"- general line\" ));\r\n          goto Line1;\r\n\r\n        case 4:                             /* move to inside contour  */\r\n          FT_TRACE6(( \"- move to inside\" ));\r\n          goto Line1;\r\n\r\n        case 5:                             /* move to outside contour */\r\n          FT_TRACE6(( \"- move to outside\" ));\r\n        Line1:\r\n          args_format = format_low;\r\n          args_count  = 1;\r\n          break;\r\n\r\n        case 2:                             /* horizontal line to */\r\n          FT_TRACE6(( \"- horizontal line to cx.%d\", format_low ));\r\n          if ( format_low >= x_count )\r\n            goto Failure;\r\n          pos[0].x   = glyph->x_control[format_low];\r\n          pos[0].y   = pos[3].y;\r\n          pos[3]     = pos[0];\r\n          args_count = 0;\r\n          break;\r\n\r\n        case 3:                             /* vertical line to */\r\n          FT_TRACE6(( \"- vertical line to cy.%d\", format_low ));\r\n          if ( format_low >= y_count )\r\n            goto Failure;\r\n          pos[0].x   = pos[3].x;\r\n          pos[0].y   = glyph->y_control[format_low];\r\n          pos[3]     = pos[0];\r\n          args_count = 0;\r\n          break;\r\n\r\n        case 6:                             /* horizontal to vertical curve */\r\n          FT_TRACE6(( \"- hv curve \" ));\r\n          args_format = 0xB8E;\r\n          args_count  = 3;\r\n          break;\r\n\r\n        case 7:                             /* vertical to horizontal curve */\r\n          FT_TRACE6(( \"- vh curve\" ));\r\n          args_format = 0xE2B;\r\n          args_count  = 3;\r\n          break;\r\n\r\n        default:                            /* general curve to */\r\n          FT_TRACE6(( \"- general curve\" ));\r\n          args_count  = 4;\r\n          args_format = format_low;\r\n        }\r\n\r\n        /***********************************************************/\r\n        /*  now read arguments                                     */\r\n        /*                                                         */\r\n        cur = pos;\r\n        for ( n = 0; n < args_count; n++ )\r\n        {\r\n          FT_UInt  idx;\r\n          FT_Int   delta;\r\n\r\n\r\n          /* read the X argument */\r\n          switch ( args_format & 3 )\r\n          {\r\n          case 0:                           /* 8-bit index */\r\n            PFR_CHECK( 1 );\r\n            idx  = PFR_NEXT_BYTE( p );\r\n            if ( idx >= x_count )\r\n              goto Failure;\r\n            cur->x = glyph->x_control[idx];\r\n            FT_TRACE7(( \" cx#%d\", idx ));\r\n            break;\r\n\r\n          case 1:                           /* 16-bit value */\r\n            PFR_CHECK( 2 );\r\n            cur->x = PFR_NEXT_SHORT( p );\r\n            FT_TRACE7(( \" x.%d\", cur->x ));\r\n            break;\r\n\r\n          case 2:                           /* 8-bit delta */\r\n            PFR_CHECK( 1 );\r\n            delta  = PFR_NEXT_INT8( p );\r\n            cur->x = pos[3].x + delta;\r\n            FT_TRACE7(( \" dx.%d\", delta ));\r\n            break;\r\n\r\n          default:\r\n            FT_TRACE7(( \" |\" ));\r\n            cur->x = pos[3].x;\r\n          }\r\n\r\n          /* read the Y argument */\r\n          switch ( ( args_format >> 2 ) & 3 )\r\n          {\r\n          case 0:                           /* 8-bit index */\r\n            PFR_CHECK( 1 );\r\n            idx  = PFR_NEXT_BYTE( p );\r\n            if ( idx >= y_count )\r\n              goto Failure;\r\n            cur->y = glyph->y_control[idx];\r\n            FT_TRACE7(( \" cy#%d\", idx ));\r\n            break;\r\n\r\n          case 1:                           /* 16-bit absolute value */\r\n            PFR_CHECK( 2 );\r\n            cur->y = PFR_NEXT_SHORT( p );\r\n            FT_TRACE7(( \" y.%d\", cur->y ));\r\n            break;\r\n\r\n          case 2:                           /* 8-bit delta */\r\n            PFR_CHECK( 1 );\r\n            delta  = PFR_NEXT_INT8( p );\r\n            cur->y = pos[3].y + delta;\r\n            FT_TRACE7(( \" dy.%d\", delta ));\r\n            break;\r\n\r\n          default:\r\n            FT_TRACE7(( \" -\" ));\r\n            cur->y = pos[3].y;\r\n          }\r\n\r\n          /* read the additional format flag for the general curve */\r\n          if ( n == 0 && args_count == 4 )\r\n          {\r\n            PFR_CHECK( 1 );\r\n            args_format = PFR_NEXT_BYTE( p );\r\n            args_count--;\r\n          }\r\n          else\r\n            args_format >>= 4;\r\n\r\n          /* save the previous point */\r\n          pos[3] = cur[0];\r\n          cur++;\r\n        }\r\n\r\n        FT_TRACE7(( \"\\n\" ));\r\n\r\n        /***********************************************************/\r\n        /*  finally, execute instruction                           */\r\n        /*                                                         */\r\n        switch ( format >> 4 )\r\n        {\r\n        case 0:                             /* end glyph => EXIT */\r\n          pfr_glyph_end( glyph );\r\n          goto Exit;\r\n\r\n        case 1:                             /* line operations */\r\n        case 2:\r\n        case 3:\r\n          error = pfr_glyph_line_to( glyph, pos );\r\n          goto Test_Error;\r\n\r\n        case 4:                             /* move to inside contour  */\r\n        case 5:                             /* move to outside contour */\r\n          error = pfr_glyph_move_to( glyph, pos );\r\n          goto Test_Error;\r\n\r\n        default:                            /* curve operations */\r\n          error = pfr_glyph_curve_to( glyph, pos, pos + 1, pos + 2 );\r\n\r\n        Test_Error:  /* test error condition */\r\n          if ( error )\r\n            goto Exit;\r\n        }\r\n      } /* for (;;) */\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Failure:\r\n  Too_Short:\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_glyph_load_simple: invalid glyph data\\n\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /* load a composite/compound glyph */\r\n  static FT_Error\r\n  pfr_glyph_load_compound( PFR_Glyph  glyph,\r\n                           FT_Byte*   p,\r\n                           FT_Byte*   limit )\r\n  {\r\n    FT_Error        error  = PFR_Err_Ok;\r\n    FT_GlyphLoader  loader = glyph->loader;\r\n    FT_Memory       memory = loader->memory;\r\n    PFR_SubGlyph    subglyph;\r\n    FT_UInt         flags, i, count, org_count;\r\n    FT_Int          x_pos, y_pos;\r\n\r\n\r\n    PFR_CHECK( 1 );\r\n    flags = PFR_NEXT_BYTE( p );\r\n\r\n    /* test for composite glyphs */\r\n    if ( !( flags & PFR_GLYPH_IS_COMPOUND ) )\r\n      goto Failure;\r\n\r\n    count = flags & 0x3F;\r\n\r\n    /* ignore extra items when present */\r\n    /*                                 */\r\n    if ( flags & PFR_GLYPH_EXTRA_ITEMS )\r\n    {\r\n      error = pfr_extra_items_skip( &p, limit );\r\n      if (error) goto Exit;\r\n    }\r\n\r\n    /* we can't rely on the FT_GlyphLoader to load sub-glyphs, because   */\r\n    /* the PFR format is dumb, using direct file offsets to point to the */\r\n    /* sub-glyphs (instead of glyph indices).  Sigh.                     */\r\n    /*                                                                   */\r\n    /* For now, we load the list of sub-glyphs into a different array    */\r\n    /* but this will prevent us from using the auto-hinter at its best   */\r\n    /* quality.                                                          */\r\n    /*                                                                   */\r\n    org_count = glyph->num_subs;\r\n\r\n    if ( org_count + count > glyph->max_subs )\r\n    {\r\n      FT_UInt  new_max = ( org_count + count + 3 ) & (FT_UInt)-4;\r\n\r\n\r\n      /* we arbitrarily limit the number of subglyphs */\r\n      /* to avoid endless recursion                   */\r\n      if ( new_max > 64 )\r\n      {\r\n        error = PFR_Err_Invalid_Table;\r\n        FT_ERROR(( \"pfr_glyph_load_compound:\"\r\n                   \" too many compound glyphs components\\n\" ));\r\n        goto Exit;\r\n      }\r\n\r\n      if ( FT_RENEW_ARRAY( glyph->subs, glyph->max_subs, new_max ) )\r\n        goto Exit;\r\n\r\n      glyph->max_subs = new_max;\r\n    }\r\n\r\n    subglyph = glyph->subs + org_count;\r\n\r\n    for ( i = 0; i < count; i++, subglyph++ )\r\n    {\r\n      FT_UInt  format;\r\n\r\n\r\n      x_pos = 0;\r\n      y_pos = 0;\r\n\r\n      PFR_CHECK( 1 );\r\n      format = PFR_NEXT_BYTE( p );\r\n\r\n      /* read scale when available */\r\n      subglyph->x_scale = 0x10000L;\r\n      if ( format & PFR_SUBGLYPH_XSCALE )\r\n      {\r\n        PFR_CHECK( 2 );\r\n        subglyph->x_scale = PFR_NEXT_SHORT( p ) << 4;\r\n      }\r\n\r\n      subglyph->y_scale = 0x10000L;\r\n      if ( format & PFR_SUBGLYPH_YSCALE )\r\n      {\r\n        PFR_CHECK( 2 );\r\n        subglyph->y_scale = PFR_NEXT_SHORT( p ) << 4;\r\n      }\r\n\r\n      /* read offset */\r\n      switch ( format & 3 )\r\n      {\r\n      case 1:\r\n        PFR_CHECK( 2 );\r\n        x_pos = PFR_NEXT_SHORT( p );\r\n        break;\r\n\r\n      case 2:\r\n        PFR_CHECK( 1 );\r\n        x_pos += PFR_NEXT_INT8( p );\r\n        break;\r\n\r\n      default:\r\n        ;\r\n      }\r\n\r\n      switch ( ( format >> 2 ) & 3 )\r\n      {\r\n      case 1:\r\n        PFR_CHECK( 2 );\r\n        y_pos = PFR_NEXT_SHORT( p );\r\n        break;\r\n\r\n      case 2:\r\n        PFR_CHECK( 1 );\r\n        y_pos += PFR_NEXT_INT8( p );\r\n        break;\r\n\r\n      default:\r\n        ;\r\n      }\r\n\r\n      subglyph->x_delta = x_pos;\r\n      subglyph->y_delta = y_pos;\r\n\r\n      /* read glyph position and size now */\r\n      if ( format & PFR_SUBGLYPH_2BYTE_SIZE )\r\n      {\r\n        PFR_CHECK( 2 );\r\n        subglyph->gps_size = PFR_NEXT_USHORT( p );\r\n      }\r\n      else\r\n      {\r\n        PFR_CHECK( 1 );\r\n        subglyph->gps_size = PFR_NEXT_BYTE( p );\r\n      }\r\n\r\n      if ( format & PFR_SUBGLYPH_3BYTE_OFFSET )\r\n      {\r\n        PFR_CHECK( 3 );\r\n        subglyph->gps_offset = PFR_NEXT_LONG( p );\r\n      }\r\n      else\r\n      {\r\n        PFR_CHECK( 2 );\r\n        subglyph->gps_offset = PFR_NEXT_USHORT( p );\r\n      }\r\n\r\n      glyph->num_subs++;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Failure:\r\n  Too_Short:\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_glyph_load_compound: invalid glyph data\\n\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pfr_glyph_load_rec( PFR_Glyph  glyph,\r\n                      FT_Stream  stream,\r\n                      FT_ULong   gps_offset,\r\n                      FT_ULong   offset,\r\n                      FT_ULong   size )\r\n  {\r\n    FT_Error  error;\r\n    FT_Byte*  p;\r\n    FT_Byte*  limit;\r\n\r\n\r\n    if ( FT_STREAM_SEEK( gps_offset + offset ) ||\r\n         FT_FRAME_ENTER( size )                )\r\n      goto Exit;\r\n\r\n    p     = (FT_Byte*)stream->cursor;\r\n    limit = p + size;\r\n\r\n    if ( size > 0 && *p & PFR_GLYPH_IS_COMPOUND )\r\n    {\r\n      FT_Int          n, old_count, count;\r\n      FT_GlyphLoader  loader = glyph->loader;\r\n      FT_Outline*     base   = &loader->base.outline;\r\n\r\n\r\n      old_count = glyph->num_subs;\r\n\r\n      /* this is a compound glyph - load it */\r\n      error = pfr_glyph_load_compound( glyph, p, limit );\r\n\r\n      FT_FRAME_EXIT();\r\n\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      count = glyph->num_subs - old_count;\r\n\r\n      FT_TRACE4(( \"compound glyph with %d elements (offset %lu):\\n\",\r\n                  count, offset ));\r\n\r\n      /* now, load each individual glyph */\r\n      for ( n = 0; n < count; n++ )\r\n      {\r\n        FT_Int        i, old_points, num_points;\r\n        PFR_SubGlyph  subglyph;\r\n\r\n\r\n        FT_TRACE4(( \"subglyph %d:\\n\", n ));\r\n\r\n        subglyph   = glyph->subs + old_count + n;\r\n        old_points = base->n_points;\r\n\r\n        error = pfr_glyph_load_rec( glyph, stream, gps_offset,\r\n                                    subglyph->gps_offset,\r\n                                    subglyph->gps_size );\r\n        if ( error )\r\n          break;\r\n\r\n        /* note that `glyph->subs' might have been re-allocated */\r\n        subglyph   = glyph->subs + old_count + n;\r\n        num_points = base->n_points - old_points;\r\n\r\n        /* translate and eventually scale the new glyph points */\r\n        if ( subglyph->x_scale != 0x10000L || subglyph->y_scale != 0x10000L )\r\n        {\r\n          FT_Vector*  vec = base->points + old_points;\r\n\r\n\r\n          for ( i = 0; i < num_points; i++, vec++ )\r\n          {\r\n            vec->x = FT_MulFix( vec->x, subglyph->x_scale ) +\r\n                       subglyph->x_delta;\r\n            vec->y = FT_MulFix( vec->y, subglyph->y_scale ) +\r\n                       subglyph->y_delta;\r\n          }\r\n        }\r\n        else\r\n        {\r\n          FT_Vector*  vec = loader->base.outline.points + old_points;\r\n\r\n\r\n          for ( i = 0; i < num_points; i++, vec++ )\r\n          {\r\n            vec->x += subglyph->x_delta;\r\n            vec->y += subglyph->y_delta;\r\n          }\r\n        }\r\n\r\n        /* proceed to next sub-glyph */\r\n      }\r\n\r\n      FT_TRACE4(( \"end compound glyph with %d elements\\n\", count ));\r\n    }\r\n    else\r\n    {\r\n      FT_TRACE4(( \"simple glyph (offset %lu)\\n\", offset ));\r\n\r\n      /* load a simple glyph */\r\n      error = pfr_glyph_load_simple( glyph, p, limit );\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_glyph_load( PFR_Glyph  glyph,\r\n                  FT_Stream  stream,\r\n                  FT_ULong   gps_offset,\r\n                  FT_ULong   offset,\r\n                  FT_ULong   size )\r\n  {\r\n    /* initialize glyph loader */\r\n    FT_GlyphLoader_Rewind( glyph->loader );\r\n\r\n    glyph->num_subs = 0;\r\n\r\n    /* load the glyph, recursively when needed */\r\n    return pfr_glyph_load_rec( glyph, stream, gps_offset, offset, size );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrgload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrgload.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType PFR glyph loader (specification).                           */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFRGLOAD_H__\r\n#define __PFRGLOAD_H__\r\n\r\n#include \"pfrtypes.h\"\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( void )\r\n  pfr_glyph_init( PFR_Glyph       glyph,\r\n                  FT_GlyphLoader  loader );\r\n\r\n  FT_LOCAL( void )\r\n  pfr_glyph_done( PFR_Glyph  glyph );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_glyph_load( PFR_Glyph  glyph,\r\n                  FT_Stream  stream,\r\n                  FT_ULong   gps_offset,\r\n                  FT_ULong   offset,\r\n                  FT_ULong   size );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PFRGLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrload.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR loader (body).                                          */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2005, 2007, 2009, 2010 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"pfrload.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n#include \"pfrerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pfr\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          EXTRA ITEMS                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_extra_items_skip( FT_Byte*  *pp,\r\n                        FT_Byte*   limit )\r\n  {\r\n    return pfr_extra_items_parse( pp, limit, NULL, NULL );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_extra_items_parse( FT_Byte*       *pp,\r\n                         FT_Byte*        limit,\r\n                         PFR_ExtraItem   item_list,\r\n                         FT_Pointer      item_data )\r\n  {\r\n    FT_Error  error = PFR_Err_Ok;\r\n    FT_Byte*  p     = *pp;\r\n    FT_UInt   num_items, item_type, item_size;\r\n\r\n\r\n    PFR_CHECK( 1 );\r\n    num_items = PFR_NEXT_BYTE( p );\r\n\r\n    for ( ; num_items > 0; num_items-- )\r\n    {\r\n      PFR_CHECK( 2 );\r\n      item_size = PFR_NEXT_BYTE( p );\r\n      item_type = PFR_NEXT_BYTE( p );\r\n\r\n      PFR_CHECK( item_size );\r\n\r\n      if ( item_list )\r\n      {\r\n        PFR_ExtraItem  extra = item_list;\r\n\r\n\r\n        for ( extra = item_list; extra->parser != NULL; extra++ )\r\n        {\r\n          if ( extra->type == item_type )\r\n          {\r\n            error = extra->parser( p, p + item_size, item_data );\r\n            if ( error ) goto Exit;\r\n\r\n            break;\r\n          }\r\n        }\r\n      }\r\n\r\n      p += item_size;\r\n    }\r\n\r\n  Exit:\r\n    *pp = p;\r\n    return error;\r\n\r\n  Too_Short:\r\n    FT_ERROR(( \"pfr_extra_items_parse: invalid extra items table\\n\" ));\r\n    error = PFR_Err_Invalid_Table;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          PFR HEADER                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n   static const FT_Frame_Field  pfr_header_fields[] =\r\n   {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PFR_HeaderRec\r\n\r\n     FT_FRAME_START( 58 ),\r\n       FT_FRAME_ULONG ( signature ),\r\n       FT_FRAME_USHORT( version ),\r\n       FT_FRAME_USHORT( signature2 ),\r\n       FT_FRAME_USHORT( header_size ),\r\n\r\n       FT_FRAME_USHORT( log_dir_size ),\r\n       FT_FRAME_USHORT( log_dir_offset ),\r\n\r\n       FT_FRAME_USHORT( log_font_max_size ),\r\n       FT_FRAME_UOFF3 ( log_font_section_size ),\r\n       FT_FRAME_UOFF3 ( log_font_section_offset ),\r\n\r\n       FT_FRAME_USHORT( phy_font_max_size ),\r\n       FT_FRAME_UOFF3 ( phy_font_section_size ),\r\n       FT_FRAME_UOFF3 ( phy_font_section_offset ),\r\n\r\n       FT_FRAME_USHORT( gps_max_size ),\r\n       FT_FRAME_UOFF3 ( gps_section_size ),\r\n       FT_FRAME_UOFF3 ( gps_section_offset ),\r\n\r\n       FT_FRAME_BYTE  ( max_blue_values ),\r\n       FT_FRAME_BYTE  ( max_x_orus ),\r\n       FT_FRAME_BYTE  ( max_y_orus ),\r\n\r\n       FT_FRAME_BYTE  ( phy_font_max_size_high ),\r\n       FT_FRAME_BYTE  ( color_flags ),\r\n\r\n       FT_FRAME_UOFF3 ( bct_max_size ),\r\n       FT_FRAME_UOFF3 ( bct_set_max_size ),\r\n       FT_FRAME_UOFF3 ( phy_bct_set_max_size ),\r\n\r\n       FT_FRAME_USHORT( num_phy_fonts ),\r\n       FT_FRAME_BYTE  ( max_vert_stem_snap ),\r\n       FT_FRAME_BYTE  ( max_horz_stem_snap ),\r\n       FT_FRAME_USHORT( max_chars ),\r\n     FT_FRAME_END\r\n   };\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_header_load( PFR_Header  header,\r\n                   FT_Stream   stream )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    /* read header directly */\r\n    if ( !FT_STREAM_SEEK( 0 )                                &&\r\n         !FT_STREAM_READ_FIELDS( pfr_header_fields, header ) )\r\n    {\r\n      /* make a few adjustments to the header */\r\n      header->phy_font_max_size +=\r\n        (FT_UInt32)header->phy_font_max_size_high << 16;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  pfr_header_check( PFR_Header  header )\r\n  {\r\n    FT_Bool  result = 1;\r\n\r\n\r\n    /* check signature and header size */\r\n    if ( header->signature  != 0x50465230L ||   /* \"PFR0\" */\r\n         header->version     > 4           ||\r\n         header->header_size < 58          ||\r\n         header->signature2 != 0x0d0a      )    /* CR/LF  */\r\n    {\r\n      result = 0;\r\n    }\r\n    return  result;\r\n  }\r\n\r\n\r\n  /***********************************************************************/\r\n  /***********************************************************************/\r\n  /*****                                                             *****/\r\n  /*****                    PFR LOGICAL FONTS                        *****/\r\n  /*****                                                             *****/\r\n  /***********************************************************************/\r\n  /***********************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_log_font_count( FT_Stream  stream,\r\n                      FT_UInt32  section_offset,\r\n                      FT_UInt   *acount )\r\n  {\r\n    FT_Error  error;\r\n    FT_UInt   count;\r\n    FT_UInt   result = 0;\r\n\r\n\r\n    if ( FT_STREAM_SEEK( section_offset ) || FT_READ_USHORT( count ) )\r\n      goto Exit;\r\n\r\n    result = count;\r\n\r\n  Exit:\r\n    *acount = result;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_log_font_load( PFR_LogFont  log_font,\r\n                     FT_Stream    stream,\r\n                     FT_UInt      idx,\r\n                     FT_UInt32    section_offset,\r\n                     FT_Bool      size_increment )\r\n  {\r\n    FT_UInt    num_log_fonts;\r\n    FT_UInt    flags;\r\n    FT_UInt32  offset;\r\n    FT_UInt32  size;\r\n    FT_Error   error;\r\n\r\n\r\n    if ( FT_STREAM_SEEK( section_offset ) ||\r\n         FT_READ_USHORT( num_log_fonts )  )\r\n      goto Exit;\r\n\r\n    if ( idx >= num_log_fonts )\r\n      return PFR_Err_Invalid_Argument;\r\n\r\n    if ( FT_STREAM_SKIP( idx * 5 ) ||\r\n         FT_READ_USHORT( size )    ||\r\n         FT_READ_UOFF3 ( offset )  )\r\n      goto Exit;\r\n\r\n    /* save logical font size and offset */\r\n    log_font->size   = size;\r\n    log_font->offset = offset;\r\n\r\n    /* now, check the rest of the table before loading it */\r\n    {\r\n      FT_Byte*  p;\r\n      FT_Byte*  limit;\r\n      FT_UInt   local;\r\n\r\n\r\n      if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) )\r\n        goto Exit;\r\n\r\n      p     = stream->cursor;\r\n      limit = p + size;\r\n\r\n      PFR_CHECK(13);\r\n\r\n      log_font->matrix[0] = PFR_NEXT_LONG( p );\r\n      log_font->matrix[1] = PFR_NEXT_LONG( p );\r\n      log_font->matrix[2] = PFR_NEXT_LONG( p );\r\n      log_font->matrix[3] = PFR_NEXT_LONG( p );\r\n\r\n      flags = PFR_NEXT_BYTE( p );\r\n\r\n      local = 0;\r\n      if ( flags & PFR_LOG_STROKE )\r\n      {\r\n        local++;\r\n        if ( flags & PFR_LOG_2BYTE_STROKE )\r\n          local++;\r\n\r\n        if ( (flags & PFR_LINE_JOIN_MASK) == PFR_LINE_JOIN_MITER )\r\n          local += 3;\r\n      }\r\n      if ( flags & PFR_LOG_BOLD )\r\n      {\r\n        local++;\r\n        if ( flags & PFR_LOG_2BYTE_BOLD )\r\n          local++;\r\n      }\r\n\r\n      PFR_CHECK( local );\r\n\r\n      if ( flags & PFR_LOG_STROKE )\r\n      {\r\n        log_font->stroke_thickness = ( flags & PFR_LOG_2BYTE_STROKE )\r\n                                     ? PFR_NEXT_SHORT( p )\r\n                                     : PFR_NEXT_BYTE( p );\r\n\r\n        if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER )\r\n          log_font->miter_limit = PFR_NEXT_LONG( p );\r\n      }\r\n\r\n      if ( flags & PFR_LOG_BOLD )\r\n      {\r\n        log_font->bold_thickness = ( flags & PFR_LOG_2BYTE_BOLD )\r\n                                   ? PFR_NEXT_SHORT( p )\r\n                                   : PFR_NEXT_BYTE( p );\r\n      }\r\n\r\n      if ( flags & PFR_LOG_EXTRA_ITEMS )\r\n      {\r\n        error = pfr_extra_items_skip( &p, limit );\r\n        if (error) goto Fail;\r\n      }\r\n\r\n      PFR_CHECK(5);\r\n      log_font->phys_size   = PFR_NEXT_USHORT( p );\r\n      log_font->phys_offset = PFR_NEXT_ULONG( p );\r\n      if ( size_increment )\r\n      {\r\n        PFR_CHECK( 1 );\r\n        log_font->phys_size += (FT_UInt32)PFR_NEXT_BYTE( p ) << 16;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    FT_FRAME_EXIT();\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Too_Short:\r\n    FT_ERROR(( \"pfr_log_font_load: invalid logical font table\\n\" ));\r\n    error = PFR_Err_Invalid_Table;\r\n    goto Fail;\r\n  }\r\n\r\n\r\n  /***********************************************************************/\r\n  /***********************************************************************/\r\n  /*****                                                             *****/\r\n  /*****                    PFR PHYSICAL FONTS                       *****/\r\n  /*****                                                             *****/\r\n  /***********************************************************************/\r\n  /***********************************************************************/\r\n\r\n\r\n  /* load bitmap strikes lists */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_extra_item_load_bitmap_info( FT_Byte*     p,\r\n                                   FT_Byte*     limit,\r\n                                   PFR_PhyFont  phy_font )\r\n  {\r\n    FT_Memory   memory = phy_font->memory;\r\n    PFR_Strike  strike;\r\n    FT_UInt     flags0;\r\n    FT_UInt     n, count, size1;\r\n    FT_Error    error = PFR_Err_Ok;\r\n\r\n\r\n    PFR_CHECK( 5 );\r\n\r\n    p += 3;  /* skip bctSize */\r\n    flags0 = PFR_NEXT_BYTE( p );\r\n    count  = PFR_NEXT_BYTE( p );\r\n\r\n    /* re-allocate when needed */\r\n    if ( phy_font->num_strikes + count > phy_font->max_strikes )\r\n    {\r\n      FT_UInt  new_max = FT_PAD_CEIL( phy_font->num_strikes + count, 4 );\r\n\r\n\r\n      if ( FT_RENEW_ARRAY( phy_font->strikes,\r\n                           phy_font->num_strikes,\r\n                           new_max ) )\r\n        goto Exit;\r\n\r\n      phy_font->max_strikes = new_max;\r\n    }\r\n\r\n    size1 = 1 + 1 + 1 + 2 + 2 + 1;\r\n    if ( flags0 & PFR_STRIKE_2BYTE_XPPM )\r\n      size1++;\r\n\r\n    if ( flags0 & PFR_STRIKE_2BYTE_YPPM )\r\n      size1++;\r\n\r\n    if ( flags0 & PFR_STRIKE_3BYTE_SIZE )\r\n      size1++;\r\n\r\n    if ( flags0 & PFR_STRIKE_3BYTE_OFFSET )\r\n      size1++;\r\n\r\n    if ( flags0 & PFR_STRIKE_2BYTE_COUNT )\r\n      size1++;\r\n\r\n    strike = phy_font->strikes + phy_font->num_strikes;\r\n\r\n    PFR_CHECK( count * size1 );\r\n\r\n    for ( n = 0; n < count; n++, strike++ )\r\n    {\r\n      strike->x_ppm       = ( flags0 & PFR_STRIKE_2BYTE_XPPM )\r\n                            ? PFR_NEXT_USHORT( p )\r\n                            : PFR_NEXT_BYTE( p );\r\n\r\n      strike->y_ppm       = ( flags0 & PFR_STRIKE_2BYTE_YPPM )\r\n                            ? PFR_NEXT_USHORT( p )\r\n                            : PFR_NEXT_BYTE( p );\r\n\r\n      strike->flags       = PFR_NEXT_BYTE( p );\r\n\r\n      strike->bct_size    = ( flags0 & PFR_STRIKE_3BYTE_SIZE )\r\n                            ? PFR_NEXT_ULONG( p )\r\n                            : PFR_NEXT_USHORT( p );\r\n\r\n      strike->bct_offset  = ( flags0 & PFR_STRIKE_3BYTE_OFFSET )\r\n                            ? PFR_NEXT_ULONG( p )\r\n                            : PFR_NEXT_USHORT( p );\r\n\r\n      strike->num_bitmaps = ( flags0 & PFR_STRIKE_2BYTE_COUNT )\r\n                            ? PFR_NEXT_USHORT( p )\r\n                            : PFR_NEXT_BYTE( p );\r\n    }\r\n\r\n    phy_font->num_strikes += count;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Too_Short:\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_extra_item_load_bitmap_info:\"\r\n               \" invalid bitmap info table\\n\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /* Load font ID.  This is a so-called \"unique\" name that is rather\r\n   * long and descriptive (like \"Tiresias ScreenFont v7.51\").\r\n   *\r\n   * Note that a PFR font's family name is contained in an *undocumented*\r\n   * string of the \"auxiliary data\" portion of a physical font record.  This\r\n   * may also contain the \"real\" style name!\r\n   *\r\n   * If no family name is present, the font ID is used instead for the\r\n   * family.\r\n   */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_extra_item_load_font_id( FT_Byte*     p,\r\n                               FT_Byte*     limit,\r\n                               PFR_PhyFont  phy_font )\r\n  {\r\n    FT_Error    error  = PFR_Err_Ok;\r\n    FT_Memory   memory = phy_font->memory;\r\n    FT_PtrDist  len    = limit - p;\r\n\r\n\r\n    if ( phy_font->font_id != NULL )\r\n      goto Exit;\r\n\r\n    if ( FT_ALLOC( phy_font->font_id, len + 1 ) )\r\n      goto Exit;\r\n\r\n    /* copy font ID name, and terminate it for safety */\r\n    FT_MEM_COPY( phy_font->font_id, p, len );\r\n    phy_font->font_id[len] = 0;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* load stem snap tables */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_extra_item_load_stem_snaps( FT_Byte*     p,\r\n                                  FT_Byte*     limit,\r\n                                  PFR_PhyFont  phy_font )\r\n  {\r\n    FT_UInt    count, num_vert, num_horz;\r\n    FT_Int*    snaps  = NULL;\r\n    FT_Error   error  = PFR_Err_Ok;\r\n    FT_Memory  memory = phy_font->memory;\r\n\r\n\r\n    if ( phy_font->vertical.stem_snaps != NULL )\r\n      goto Exit;\r\n\r\n    PFR_CHECK( 1 );\r\n    count = PFR_NEXT_BYTE( p );\r\n\r\n    num_vert = count & 15;\r\n    num_horz = count >> 4;\r\n    count    = num_vert + num_horz;\r\n\r\n    PFR_CHECK( count * 2 );\r\n\r\n    if ( FT_NEW_ARRAY( snaps, count ) )\r\n      goto Exit;\r\n\r\n    phy_font->vertical.stem_snaps = snaps;\r\n    phy_font->horizontal.stem_snaps = snaps + num_vert;\r\n\r\n    for ( ; count > 0; count--, snaps++ )\r\n      *snaps = FT_NEXT_SHORT( p );\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Too_Short:\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_exta_item_load_stem_snaps:\"\r\n               \" invalid stem snaps table\\n\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n\r\n  /* load kerning pair data */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  pfr_extra_item_load_kerning_pairs( FT_Byte*     p,\r\n                                     FT_Byte*     limit,\r\n                                     PFR_PhyFont  phy_font )\r\n  {\r\n    PFR_KernItem  item   = NULL;\r\n    FT_Error      error  = PFR_Err_Ok;\r\n    FT_Memory     memory = phy_font->memory;\r\n\r\n\r\n    FT_TRACE2(( \"pfr_extra_item_load_kerning_pairs()\\n\" ));\r\n\r\n    if ( FT_NEW( item ) )\r\n      goto Exit;\r\n\r\n    PFR_CHECK( 4 );\r\n\r\n    item->pair_count = PFR_NEXT_BYTE( p );\r\n    item->base_adj   = PFR_NEXT_SHORT( p );\r\n    item->flags      = PFR_NEXT_BYTE( p );\r\n    item->offset     = phy_font->offset + ( p - phy_font->cursor );\r\n\r\n#ifndef PFR_CONFIG_NO_CHECKS\r\n    item->pair_size = 3;\r\n\r\n    if ( item->flags & PFR_KERN_2BYTE_CHAR )\r\n      item->pair_size += 2;\r\n\r\n    if ( item->flags & PFR_KERN_2BYTE_ADJ )\r\n      item->pair_size += 1;\r\n\r\n    PFR_CHECK( item->pair_count * item->pair_size );\r\n#endif\r\n\r\n    /* load first and last pairs into the item to speed up */\r\n    /* lookup later...                                     */\r\n    if ( item->pair_count > 0 )\r\n    {\r\n      FT_UInt   char1, char2;\r\n      FT_Byte*  q;\r\n\r\n\r\n      if ( item->flags & PFR_KERN_2BYTE_CHAR )\r\n      {\r\n        q     = p;\r\n        char1 = PFR_NEXT_USHORT( q );\r\n        char2 = PFR_NEXT_USHORT( q );\r\n\r\n        item->pair1 = PFR_KERN_INDEX( char1, char2 );\r\n\r\n        q = p + item->pair_size * ( item->pair_count - 1 );\r\n        char1 = PFR_NEXT_USHORT( q );\r\n        char2 = PFR_NEXT_USHORT( q );\r\n\r\n        item->pair2 = PFR_KERN_INDEX( char1, char2 );\r\n      }\r\n      else\r\n      {\r\n        q     = p;\r\n        char1 = PFR_NEXT_BYTE( q );\r\n        char2 = PFR_NEXT_BYTE( q );\r\n\r\n        item->pair1 = PFR_KERN_INDEX( char1, char2 );\r\n\r\n        q = p + item->pair_size * ( item->pair_count - 1 );\r\n        char1 = PFR_NEXT_BYTE( q );\r\n        char2 = PFR_NEXT_BYTE( q );\r\n\r\n        item->pair2 = PFR_KERN_INDEX( char1, char2 );\r\n      }\r\n\r\n      /* add new item to the current list */\r\n      item->next                 = NULL;\r\n      *phy_font->kern_items_tail = item;\r\n      phy_font->kern_items_tail  = &item->next;\r\n      phy_font->num_kern_pairs  += item->pair_count;\r\n    }\r\n    else\r\n    {\r\n      /* empty item! */\r\n      FT_FREE( item );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Too_Short:\r\n    FT_FREE( item );\r\n\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_extra_item_load_kerning_pairs:\"\r\n               \" invalid kerning pairs table\\n\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n\r\n  static const PFR_ExtraItemRec  pfr_phy_font_extra_items[] =\r\n  {\r\n    { 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },\r\n    { 2, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_font_id },\r\n    { 3, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_stem_snaps },\r\n    { 4, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_kerning_pairs },\r\n    { 0, NULL }\r\n  };\r\n\r\n\r\n  /* Loads a name from the auxiliary data.  Since this extracts undocumented\r\n   * strings from the font file, we need to be careful here.\r\n   */\r\n  static FT_Error\r\n  pfr_aux_name_load( FT_Byte*     p,\r\n                     FT_UInt      len,\r\n                     FT_Memory    memory,\r\n                     FT_String*  *astring )\r\n  {\r\n    FT_Error    error = PFR_Err_Ok;\r\n    FT_String*  result = NULL;\r\n    FT_UInt     n, ok;\r\n\r\n\r\n    if ( len > 0 && p[len - 1] == 0 )\r\n      len--;\r\n\r\n    /* check that each character is ASCII for making sure not to\r\n       load garbage\r\n     */\r\n    ok = ( len > 0 );\r\n    for ( n = 0; n < len; n++ )\r\n      if ( p[n] < 32 || p[n] > 127 )\r\n      {\r\n        ok = 0;\r\n        break;\r\n      }\r\n\r\n    if ( ok )\r\n    {\r\n      if ( FT_ALLOC( result, len + 1 ) )\r\n        goto Exit;\r\n\r\n      FT_MEM_COPY( result, p, len );\r\n      result[len] = 0;\r\n    }\r\n  Exit:\r\n    *astring = result;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  pfr_phy_font_done( PFR_PhyFont  phy_font,\r\n                     FT_Memory    memory )\r\n  {\r\n    FT_FREE( phy_font->font_id );\r\n    FT_FREE( phy_font->family_name );\r\n    FT_FREE( phy_font->style_name );\r\n\r\n    FT_FREE( phy_font->vertical.stem_snaps );\r\n    phy_font->vertical.num_stem_snaps = 0;\r\n\r\n    phy_font->horizontal.stem_snaps     = NULL;\r\n    phy_font->horizontal.num_stem_snaps = 0;\r\n\r\n    FT_FREE( phy_font->strikes );\r\n    phy_font->num_strikes = 0;\r\n    phy_font->max_strikes = 0;\r\n\r\n    FT_FREE( phy_font->chars );\r\n    phy_font->num_chars    = 0;\r\n    phy_font->chars_offset = 0;\r\n\r\n    FT_FREE( phy_font->blue_values );\r\n    phy_font->num_blue_values = 0;\r\n\r\n    {\r\n      PFR_KernItem  item, next;\r\n\r\n\r\n      item = phy_font->kern_items;\r\n      while ( item )\r\n      {\r\n        next = item->next;\r\n        FT_FREE( item );\r\n        item = next;\r\n      }\r\n      phy_font->kern_items      = NULL;\r\n      phy_font->kern_items_tail = NULL;\r\n    }\r\n\r\n    phy_font->num_kern_pairs = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_phy_font_load( PFR_PhyFont  phy_font,\r\n                     FT_Stream    stream,\r\n                     FT_UInt32    offset,\r\n                     FT_UInt32    size )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_UInt    flags;\r\n    FT_ULong   num_aux;\r\n    FT_Byte*   p;\r\n    FT_Byte*   limit;\r\n\r\n\r\n    phy_font->memory = memory;\r\n    phy_font->offset = offset;\r\n\r\n    phy_font->kern_items      = NULL;\r\n    phy_font->kern_items_tail = &phy_font->kern_items;\r\n\r\n    if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) )\r\n      goto Exit;\r\n\r\n    phy_font->cursor = stream->cursor;\r\n\r\n    p     = stream->cursor;\r\n    limit = p + size;\r\n\r\n    PFR_CHECK( 15 );\r\n    phy_font->font_ref_number    = PFR_NEXT_USHORT( p );\r\n    phy_font->outline_resolution = PFR_NEXT_USHORT( p );\r\n    phy_font->metrics_resolution = PFR_NEXT_USHORT( p );\r\n    phy_font->bbox.xMin          = PFR_NEXT_SHORT( p );\r\n    phy_font->bbox.yMin          = PFR_NEXT_SHORT( p );\r\n    phy_font->bbox.xMax          = PFR_NEXT_SHORT( p );\r\n    phy_font->bbox.yMax          = PFR_NEXT_SHORT( p );\r\n    phy_font->flags      = flags = PFR_NEXT_BYTE( p );\r\n\r\n    /* get the standard advance for non-proportional fonts */\r\n    if ( !(flags & PFR_PHY_PROPORTIONAL) )\r\n    {\r\n      PFR_CHECK( 2 );\r\n      phy_font->standard_advance = PFR_NEXT_SHORT( p );\r\n    }\r\n\r\n    /* load the extra items when present */\r\n    if ( flags & PFR_PHY_EXTRA_ITEMS )\r\n    {\r\n      error =  pfr_extra_items_parse( &p, limit,\r\n                                      pfr_phy_font_extra_items, phy_font );\r\n\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n\r\n    /* In certain fonts, the auxiliary bytes contain interesting  */\r\n    /* information. These are not in the specification but can be */\r\n    /* guessed by looking at the content of a few PFR0 fonts.     */\r\n    PFR_CHECK( 3 );\r\n    num_aux = PFR_NEXT_ULONG( p );\r\n\r\n    if ( num_aux > 0 )\r\n    {\r\n      FT_Byte*  q = p;\r\n      FT_Byte*  q2;\r\n\r\n\r\n      PFR_CHECK( num_aux );\r\n      p += num_aux;\r\n\r\n      while ( num_aux > 0 )\r\n      {\r\n        FT_UInt  length, type;\r\n\r\n\r\n        if ( q + 4 > p )\r\n          break;\r\n\r\n        length = PFR_NEXT_USHORT( q );\r\n        if ( length < 4 || length > num_aux )\r\n          break;\r\n\r\n        q2   = q + length - 2;\r\n        type = PFR_NEXT_USHORT( q );\r\n\r\n        switch ( type )\r\n        {\r\n        case 1:\r\n          /* this seems to correspond to the font's family name,\r\n           * padded to 16-bits with one zero when necessary\r\n           */\r\n          error = pfr_aux_name_load( q, length - 4U, memory,\r\n                                     &phy_font->family_name );\r\n          if ( error )\r\n            goto Exit;\r\n          break;\r\n\r\n        case 2:\r\n          if ( q + 32 > q2 )\r\n            break;\r\n\r\n          q += 10;\r\n          phy_font->ascent  = PFR_NEXT_SHORT( q );\r\n          phy_font->descent = PFR_NEXT_SHORT( q );\r\n          phy_font->leading = PFR_NEXT_SHORT( q );\r\n          q += 16;\r\n          break;\r\n\r\n        case 3:\r\n          /* this seems to correspond to the font's style name,\r\n           * padded to 16-bits with one zero when necessary\r\n           */\r\n          error = pfr_aux_name_load( q, length - 4U, memory,\r\n                                     &phy_font->style_name );\r\n          if ( error )\r\n            goto Exit;\r\n          break;\r\n\r\n        default:\r\n          ;\r\n        }\r\n\r\n        q        = q2;\r\n        num_aux -= length;\r\n      }\r\n    }\r\n\r\n    /* read the blue values */\r\n    {\r\n      FT_UInt  n, count;\r\n\r\n\r\n      PFR_CHECK( 1 );\r\n      phy_font->num_blue_values = count = PFR_NEXT_BYTE( p );\r\n\r\n      PFR_CHECK( count * 2 );\r\n\r\n      if ( FT_NEW_ARRAY( phy_font->blue_values, count ) )\r\n        goto Fail;\r\n\r\n      for ( n = 0; n < count; n++ )\r\n        phy_font->blue_values[n] = PFR_NEXT_SHORT( p );\r\n    }\r\n\r\n    PFR_CHECK( 8 );\r\n    phy_font->blue_fuzz  = PFR_NEXT_BYTE( p );\r\n    phy_font->blue_scale = PFR_NEXT_BYTE( p );\r\n\r\n    phy_font->vertical.standard   = PFR_NEXT_USHORT( p );\r\n    phy_font->horizontal.standard = PFR_NEXT_USHORT( p );\r\n\r\n    /* read the character descriptors */\r\n    {\r\n      FT_UInt  n, count, Size;\r\n\r\n\r\n      phy_font->num_chars    = count = PFR_NEXT_USHORT( p );\r\n      phy_font->chars_offset = offset + ( p - stream->cursor );\r\n\r\n      if ( FT_NEW_ARRAY( phy_font->chars, count ) )\r\n        goto Fail;\r\n\r\n      Size = 1 + 1 + 2;\r\n      if ( flags & PFR_PHY_2BYTE_CHARCODE )\r\n        Size += 1;\r\n\r\n      if ( flags & PFR_PHY_PROPORTIONAL )\r\n        Size += 2;\r\n\r\n      if ( flags & PFR_PHY_ASCII_CODE )\r\n        Size += 1;\r\n\r\n      if ( flags & PFR_PHY_2BYTE_GPS_SIZE )\r\n        Size += 1;\r\n\r\n      if ( flags & PFR_PHY_3BYTE_GPS_OFFSET )\r\n        Size += 1;\r\n\r\n      PFR_CHECK( count * Size );\r\n\r\n      for ( n = 0; n < count; n++ )\r\n      {\r\n        PFR_Char  cur = &phy_font->chars[n];\r\n\r\n\r\n        cur->char_code = ( flags & PFR_PHY_2BYTE_CHARCODE )\r\n                         ? PFR_NEXT_USHORT( p )\r\n                         : PFR_NEXT_BYTE( p );\r\n\r\n        cur->advance   = ( flags & PFR_PHY_PROPORTIONAL )\r\n                         ? PFR_NEXT_SHORT( p )\r\n                         : (FT_Int) phy_font->standard_advance;\r\n\r\n#if 0\r\n        cur->ascii     = ( flags & PFR_PHY_ASCII_CODE )\r\n                         ? PFR_NEXT_BYTE( p )\r\n                         : 0;\r\n#else\r\n        if ( flags & PFR_PHY_ASCII_CODE )\r\n          p += 1;\r\n#endif\r\n        cur->gps_size  = ( flags & PFR_PHY_2BYTE_GPS_SIZE )\r\n                         ? PFR_NEXT_USHORT( p )\r\n                         : PFR_NEXT_BYTE( p );\r\n\r\n        cur->gps_offset = ( flags & PFR_PHY_3BYTE_GPS_OFFSET )\r\n                          ? PFR_NEXT_ULONG( p )\r\n                          : PFR_NEXT_USHORT( p );\r\n      }\r\n    }\r\n\r\n    /* that's it! */\r\n\r\n  Fail:\r\n    FT_FRAME_EXIT();\r\n\r\n    /* save position of bitmap info */\r\n    phy_font->bct_offset = FT_STREAM_POS();\r\n    phy_font->cursor     = NULL;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Too_Short:\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_phy_font_load: invalid physical font table\\n\" ));\r\n    goto Fail;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrload.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR loader (specification).                                 */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFRLOAD_H__\r\n#define __PFRLOAD_H__\r\n\r\n#include \"pfrobjs.h\"\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef PFR_CONFIG_NO_CHECKS\r\n#define PFR_CHECK( x )  do { } while ( 0 )\r\n#else\r\n#define PFR_CHECK( x )  do                       \\\r\n                        {                        \\\r\n                          if ( p + (x) > limit ) \\\r\n                            goto Too_Short;      \\\r\n                        } while ( 0 )\r\n#endif\r\n\r\n#define PFR_NEXT_BYTE( p )    FT_NEXT_BYTE( p )\r\n#define PFR_NEXT_INT8( p )    FT_NEXT_CHAR( p )\r\n#define PFR_NEXT_SHORT( p )   FT_NEXT_SHORT( p )\r\n#define PFR_NEXT_USHORT( p )  FT_NEXT_USHORT( p )\r\n#define PFR_NEXT_LONG( p )    FT_NEXT_OFF3( p )\r\n#define PFR_NEXT_ULONG( p )   FT_NEXT_UOFF3( p )\r\n\r\n\r\n /* handling extra items */\r\n\r\n  typedef FT_Error\r\n  (*PFR_ExtraItem_ParseFunc)( FT_Byte*    p,\r\n                              FT_Byte*    limit,\r\n                              FT_Pointer  data );\r\n\r\n  typedef struct  PFR_ExtraItemRec_\r\n  {\r\n    FT_UInt                  type;\r\n    PFR_ExtraItem_ParseFunc  parser;\r\n\r\n  } PFR_ExtraItemRec;\r\n\r\n  typedef const struct PFR_ExtraItemRec_*  PFR_ExtraItem;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_extra_items_skip( FT_Byte*  *pp,\r\n                        FT_Byte*  limit );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_extra_items_parse( FT_Byte*      *pp,\r\n                         FT_Byte*       limit,\r\n                         PFR_ExtraItem  item_list,\r\n                         FT_Pointer     item_data );\r\n\r\n\r\n  /* load a PFR header */\r\n  FT_LOCAL( FT_Error )\r\n  pfr_header_load( PFR_Header  header,\r\n                   FT_Stream   stream );\r\n\r\n  /* check a PFR header */\r\n  FT_LOCAL( FT_Bool )\r\n  pfr_header_check( PFR_Header  header );\r\n\r\n\r\n  /* return number of logical fonts in this file */\r\n  FT_LOCAL( FT_Error )\r\n  pfr_log_font_count( FT_Stream   stream,\r\n                      FT_UInt32   log_section_offset,\r\n                      FT_UInt    *acount );\r\n\r\n  /* load a pfr logical font entry */\r\n  FT_LOCAL( FT_Error )\r\n  pfr_log_font_load( PFR_LogFont  log_font,\r\n                     FT_Stream    stream,\r\n                     FT_UInt      face_index,\r\n                     FT_UInt32    section_offset,\r\n                     FT_Bool      size_increment );\r\n\r\n\r\n  /* load a physical font entry */\r\n  FT_LOCAL( FT_Error )\r\n  pfr_phy_font_load( PFR_PhyFont  phy_font,\r\n                     FT_Stream    stream,\r\n                     FT_UInt32    offset,\r\n                     FT_UInt32    size );\r\n\r\n  /* finalize a physical font */\r\n  FT_LOCAL( void )\r\n  pfr_phy_font_done( PFR_PhyFont  phy_font,\r\n                     FT_Memory    memory );\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PFRLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrobjs.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR object methods (body).                                  */\r\n/*                                                                         */\r\n/*  Copyright 2002-2008, 2010-2011 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"pfrobjs.h\"\r\n#include \"pfrload.h\"\r\n#include \"pfrgload.h\"\r\n#include \"pfrcmap.h\"\r\n#include \"pfrsbit.h\"\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n#include \"pfrerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pfr\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     FACE OBJECT METHODS                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  pfr_face_done( FT_Face  pfrface )     /* PFR_Face */\r\n  {\r\n    PFR_Face   face = (PFR_Face)pfrface;\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = pfrface->driver->root.memory;\r\n\r\n    /* we don't want dangling pointers */\r\n    pfrface->family_name = NULL;\r\n    pfrface->style_name  = NULL;\r\n\r\n    /* finalize the physical font record */\r\n    pfr_phy_font_done( &face->phy_font, FT_FACE_MEMORY( face ) );\r\n\r\n    /* no need to finalize the logical font or the header */\r\n    FT_FREE( pfrface->available_sizes );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_face_init( FT_Stream      stream,\r\n                 FT_Face        pfrface,\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    PFR_Face  face = (PFR_Face)pfrface;\r\n    FT_Error  error;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n\r\n\r\n    FT_TRACE2(( \"PFR driver\\n\" ));\r\n\r\n    /* load the header and check it */\r\n    error = pfr_header_load( &face->header, stream );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( !pfr_header_check( &face->header ) )\r\n    {\r\n      FT_TRACE2(( \"  not a PFR font\\n\" ));\r\n      error = PFR_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* check face index */\r\n    {\r\n      FT_UInt  num_faces;\r\n\r\n\r\n      error = pfr_log_font_count( stream,\r\n                                  face->header.log_dir_offset,\r\n                                  &num_faces );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      pfrface->num_faces = num_faces;\r\n    }\r\n\r\n    if ( face_index < 0 )\r\n      goto Exit;\r\n\r\n    if ( face_index >= pfrface->num_faces )\r\n    {\r\n      FT_ERROR(( \"pfr_face_init: invalid face index\\n\" ));\r\n      error = PFR_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* load the face */\r\n    error = pfr_log_font_load(\r\n               &face->log_font, stream, face_index,\r\n               face->header.log_dir_offset,\r\n               FT_BOOL( face->header.phy_font_max_size_high != 0 ) );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* now load the physical font descriptor */\r\n    error = pfr_phy_font_load( &face->phy_font, stream,\r\n                               face->log_font.phys_offset,\r\n                               face->log_font.phys_size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* now set up all root face fields */\r\n    {\r\n      PFR_PhyFont  phy_font = &face->phy_font;\r\n\r\n\r\n      pfrface->face_index = face_index;\r\n      pfrface->num_glyphs = phy_font->num_chars + 1;\r\n      pfrface->face_flags = FT_FACE_FLAG_SCALABLE;\r\n\r\n      /* if all characters point to the same gps_offset 0, we */\r\n      /* assume that the font only contains bitmaps           */\r\n      {\r\n        FT_UInt  nn;\r\n\r\n\r\n        for ( nn = 0; nn < phy_font->num_chars; nn++ )\r\n          if ( phy_font->chars[nn].gps_offset != 0 )\r\n            break;\r\n\r\n        if ( nn == phy_font->num_chars )\r\n        {\r\n          if ( phy_font->num_strikes > 0 )\r\n            pfrface->face_flags = 0;        /* not scalable */\r\n          else\r\n          {\r\n            FT_ERROR(( \"pfr_face_init: font doesn't contain glyphs\\n\" ));\r\n            error = PFR_Err_Invalid_File_Format;\r\n            goto Exit;\r\n          }\r\n        }\r\n      }\r\n\r\n      if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )\r\n        pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      if ( phy_font->flags & PFR_PHY_VERTICAL )\r\n        pfrface->face_flags |= FT_FACE_FLAG_VERTICAL;\r\n      else\r\n        pfrface->face_flags |= FT_FACE_FLAG_HORIZONTAL;\r\n\r\n      if ( phy_font->num_strikes > 0 )\r\n        pfrface->face_flags |= FT_FACE_FLAG_FIXED_SIZES;\r\n\r\n      if ( phy_font->num_kern_pairs > 0 )\r\n        pfrface->face_flags |= FT_FACE_FLAG_KERNING;\r\n\r\n      /* If no family name was found in the \"undocumented\" auxiliary\r\n       * data, use the font ID instead.  This sucks but is better than\r\n       * nothing.\r\n       */\r\n      pfrface->family_name = phy_font->family_name;\r\n      if ( pfrface->family_name == NULL )\r\n        pfrface->family_name = phy_font->font_id;\r\n\r\n      /* note that the style name can be NULL in certain PFR fonts,\r\n       * probably meaning \"Regular\"\r\n       */\r\n      pfrface->style_name = phy_font->style_name;\r\n\r\n      pfrface->num_fixed_sizes = 0;\r\n      pfrface->available_sizes = 0;\r\n\r\n      pfrface->bbox         = phy_font->bbox;\r\n      pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution;\r\n      pfrface->ascender     = (FT_Short) phy_font->bbox.yMax;\r\n      pfrface->descender    = (FT_Short) phy_font->bbox.yMin;\r\n\r\n      pfrface->height = (FT_Short)( ( pfrface->units_per_EM * 12 ) / 10 );\r\n      if ( pfrface->height < pfrface->ascender - pfrface->descender )\r\n        pfrface->height = (FT_Short)(pfrface->ascender - pfrface->descender);\r\n\r\n      if ( phy_font->num_strikes > 0 )\r\n      {\r\n        FT_UInt          n, count = phy_font->num_strikes;\r\n        FT_Bitmap_Size*  size;\r\n        PFR_Strike       strike;\r\n        FT_Memory        memory = pfrface->stream->memory;\r\n\r\n\r\n        if ( FT_NEW_ARRAY( pfrface->available_sizes, count ) )\r\n          goto Exit;\r\n\r\n        size   = pfrface->available_sizes;\r\n        strike = phy_font->strikes;\r\n        for ( n = 0; n < count; n++, size++, strike++ )\r\n        {\r\n          size->height = (FT_UShort)strike->y_ppm;\r\n          size->width  = (FT_UShort)strike->x_ppm;\r\n          size->size   = strike->y_ppm << 6;\r\n          size->x_ppem = strike->x_ppm << 6;\r\n          size->y_ppem = strike->y_ppm << 6;\r\n        }\r\n        pfrface->num_fixed_sizes = count;\r\n      }\r\n\r\n      /* now compute maximum advance width */\r\n      if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )\r\n        pfrface->max_advance_width = (FT_Short)phy_font->standard_advance;\r\n      else\r\n      {\r\n        FT_Int    max = 0;\r\n        FT_UInt   count = phy_font->num_chars;\r\n        PFR_Char  gchar = phy_font->chars;\r\n\r\n\r\n        for ( ; count > 0; count--, gchar++ )\r\n        {\r\n          if ( max < gchar->advance )\r\n            max = gchar->advance;\r\n        }\r\n\r\n        pfrface->max_advance_width = (FT_Short)max;\r\n      }\r\n\r\n      pfrface->max_advance_height = pfrface->height;\r\n\r\n      pfrface->underline_position  = (FT_Short)( -pfrface->units_per_EM / 10 );\r\n      pfrface->underline_thickness = (FT_Short)(  pfrface->units_per_EM / 30 );\r\n\r\n      /* create charmap */\r\n      {\r\n        FT_CharMapRec  charmap;\r\n\r\n\r\n        charmap.face        = pfrface;\r\n        charmap.platform_id = TT_PLATFORM_MICROSOFT;\r\n        charmap.encoding_id = TT_MS_ID_UNICODE_CS;\r\n        charmap.encoding    = FT_ENCODING_UNICODE;\r\n\r\n        error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );\r\n\r\n#if 0\r\n        /* Select default charmap */\r\n        if ( pfrface->num_charmaps )\r\n          pfrface->charmap = pfrface->charmaps[0];\r\n#endif\r\n      }\r\n\r\n      /* check whether we've loaded any kerning pairs */\r\n      if ( phy_font->num_kern_pairs )\r\n        pfrface->face_flags |= FT_FACE_FLAG_KERNING;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    SLOT OBJECT METHOD                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_slot_init( FT_GlyphSlot  pfrslot )        /* PFR_Slot */\r\n  {\r\n    PFR_Slot        slot   = (PFR_Slot)pfrslot;\r\n    FT_GlyphLoader  loader = pfrslot->internal->loader;\r\n\r\n\r\n    pfr_glyph_init( &slot->glyph, loader );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  pfr_slot_done( FT_GlyphSlot  pfrslot )        /* PFR_Slot */\r\n  {\r\n    PFR_Slot  slot = (PFR_Slot)pfrslot;\r\n\r\n\r\n    pfr_glyph_done( &slot->glyph );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_slot_load( FT_GlyphSlot  pfrslot,         /* PFR_Slot */\r\n                 FT_Size       pfrsize,         /* PFR_Size */\r\n                 FT_UInt       gindex,\r\n                 FT_Int32      load_flags )\r\n  {\r\n    PFR_Slot     slot    = (PFR_Slot)pfrslot;\r\n    PFR_Size     size    = (PFR_Size)pfrsize;\r\n    FT_Error     error;\r\n    PFR_Face     face    = (PFR_Face)pfrslot->face;\r\n    PFR_Char     gchar;\r\n    FT_Outline*  outline = &pfrslot->outline;\r\n    FT_ULong     gps_offset;\r\n\r\n\r\n    if ( gindex > 0 )\r\n      gindex--;\r\n\r\n    if ( !face || gindex >= face->phy_font.num_chars )\r\n    {\r\n      error = PFR_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* try to load an embedded bitmap */\r\n    if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 )\r\n    {\r\n      error = pfr_slot_load_bitmap( slot, size, gindex );\r\n      if ( error == 0 )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( load_flags & FT_LOAD_SBITS_ONLY )\r\n    {\r\n      error = PFR_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    gchar               = face->phy_font.chars + gindex;\r\n    pfrslot->format     = FT_GLYPH_FORMAT_OUTLINE;\r\n    outline->n_points   = 0;\r\n    outline->n_contours = 0;\r\n    gps_offset          = face->header.gps_section_offset;\r\n\r\n    /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */\r\n    error = pfr_glyph_load( &slot->glyph, face->root.stream,\r\n                            gps_offset, gchar->gps_offset, gchar->gps_size );\r\n\r\n    if ( !error )\r\n    {\r\n      FT_BBox            cbox;\r\n      FT_Glyph_Metrics*  metrics = &pfrslot->metrics;\r\n      FT_Pos             advance;\r\n      FT_Int             em_metrics, em_outline;\r\n      FT_Bool            scaling;\r\n\r\n\r\n      scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );\r\n\r\n      /* copy outline data */\r\n      *outline = slot->glyph.loader->base.outline;\r\n\r\n      outline->flags &= ~FT_OUTLINE_OWNER;\r\n      outline->flags |= FT_OUTLINE_REVERSE_FILL;\r\n\r\n      if ( size && pfrsize->metrics.y_ppem < 24 )\r\n        outline->flags |= FT_OUTLINE_HIGH_PRECISION;\r\n\r\n      /* compute the advance vector */\r\n      metrics->horiAdvance = 0;\r\n      metrics->vertAdvance = 0;\r\n\r\n      advance    = gchar->advance;\r\n      em_metrics = face->phy_font.metrics_resolution;\r\n      em_outline = face->phy_font.outline_resolution;\r\n\r\n      if ( em_metrics != em_outline )\r\n        advance = FT_MulDiv( advance, em_outline, em_metrics );\r\n\r\n      if ( face->phy_font.flags & PFR_PHY_VERTICAL )\r\n        metrics->vertAdvance = advance;\r\n      else\r\n        metrics->horiAdvance = advance;\r\n\r\n      pfrslot->linearHoriAdvance = metrics->horiAdvance;\r\n      pfrslot->linearVertAdvance = metrics->vertAdvance;\r\n\r\n      /* make-up vertical metrics(?) */\r\n      metrics->vertBearingX = 0;\r\n      metrics->vertBearingY = 0;\r\n\r\n#if 0 /* some fonts seem to be broken here! */\r\n\r\n      /* Apply the font matrix, if any.                 */\r\n      /* TODO: Test existing fonts with unusual matrix  */\r\n      /* whether we have to adjust Units per EM.        */\r\n      {\r\n        FT_Matrix font_matrix;\r\n\r\n\r\n        font_matrix.xx = face->log_font.matrix[0] << 8;\r\n        font_matrix.yx = face->log_font.matrix[1] << 8;\r\n        font_matrix.xy = face->log_font.matrix[2] << 8;\r\n        font_matrix.yy = face->log_font.matrix[3] << 8;\r\n\r\n        FT_Outline_Transform( outline, &font_matrix );\r\n      }\r\n#endif\r\n\r\n      /* scale when needed */\r\n      if ( scaling )\r\n      {\r\n        FT_Int      n;\r\n        FT_Fixed    x_scale = pfrsize->metrics.x_scale;\r\n        FT_Fixed    y_scale = pfrsize->metrics.y_scale;\r\n        FT_Vector*  vec     = outline->points;\r\n\r\n\r\n        /* scale outline points */\r\n        for ( n = 0; n < outline->n_points; n++, vec++ )\r\n        {\r\n          vec->x = FT_MulFix( vec->x, x_scale );\r\n          vec->y = FT_MulFix( vec->y, y_scale );\r\n        }\r\n\r\n        /* scale the advance */\r\n        metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );\r\n        metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );\r\n      }\r\n\r\n      /* compute the rest of the metrics */\r\n      FT_Outline_Get_CBox( outline, &cbox );\r\n\r\n      metrics->width        = cbox.xMax - cbox.xMin;\r\n      metrics->height       = cbox.yMax - cbox.yMin;\r\n      metrics->horiBearingX = cbox.xMin;\r\n      metrics->horiBearingY = cbox.yMax - metrics->height;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      KERNING METHOD                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  pfr_face_get_kerning( FT_Face     pfrface,        /* PFR_Face */\r\n                        FT_UInt     glyph1,\r\n                        FT_UInt     glyph2,\r\n                        FT_Vector*  kerning )\r\n  {\r\n    PFR_Face     face     = (PFR_Face)pfrface;\r\n    FT_Error     error    = PFR_Err_Ok;\r\n    PFR_PhyFont  phy_font = &face->phy_font;\r\n    FT_UInt32    code1, code2, pair;\r\n\r\n\r\n    kerning->x = 0;\r\n    kerning->y = 0;\r\n\r\n    if ( glyph1 > 0 )\r\n      glyph1--;\r\n\r\n    if ( glyph2 > 0 )\r\n      glyph2--;\r\n\r\n    /* convert glyph indices to character codes */\r\n    if ( glyph1 > phy_font->num_chars ||\r\n         glyph2 > phy_font->num_chars )\r\n      goto Exit;\r\n\r\n    code1 = phy_font->chars[glyph1].char_code;\r\n    code2 = phy_font->chars[glyph2].char_code;\r\n    pair  = PFR_KERN_INDEX( code1, code2 );\r\n\r\n    /* now search the list of kerning items */\r\n    {\r\n      PFR_KernItem  item   = phy_font->kern_items;\r\n      FT_Stream     stream = pfrface->stream;\r\n\r\n\r\n      for ( ; item; item = item->next )\r\n      {\r\n        if ( pair >= item->pair1 && pair <= item->pair2 )\r\n          goto FoundPair;\r\n      }\r\n      goto Exit;\r\n\r\n    FoundPair: /* we found an item, now parse it and find the value if any */\r\n      if ( FT_STREAM_SEEK( item->offset )                       ||\r\n           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )\r\n        goto Exit;\r\n\r\n      {\r\n        FT_UInt    count       = item->pair_count;\r\n        FT_UInt    size        = item->pair_size;\r\n        FT_UInt    power       = (FT_UInt)ft_highpow2( (FT_UInt32)count );\r\n        FT_UInt    probe       = power * size;\r\n        FT_UInt    extra       = count - power;\r\n        FT_Byte*   base        = stream->cursor;\r\n        FT_Bool    twobytes    = FT_BOOL( item->flags & 1 );\r\n        FT_Bool    twobyte_adj = FT_BOOL( item->flags & 2 );\r\n        FT_Byte*   p;\r\n        FT_UInt32  cpair;\r\n\r\n\r\n        if ( extra > 0 )\r\n        {\r\n          p = base + extra * size;\r\n\r\n          if ( twobytes )\r\n            cpair = FT_NEXT_ULONG( p );\r\n          else\r\n            cpair = PFR_NEXT_KPAIR( p );\r\n\r\n          if ( cpair == pair )\r\n            goto Found;\r\n\r\n          if ( cpair < pair )\r\n          {\r\n            if ( twobyte_adj )\r\n              p += 2;\r\n            else\r\n              p++;\r\n            base = p;\r\n          }\r\n        }\r\n\r\n        while ( probe > size )\r\n        {\r\n          probe >>= 1;\r\n          p       = base + probe;\r\n\r\n          if ( twobytes )\r\n            cpair = FT_NEXT_ULONG( p );\r\n          else\r\n            cpair = PFR_NEXT_KPAIR( p );\r\n\r\n          if ( cpair == pair )\r\n            goto Found;\r\n\r\n          if ( cpair < pair )\r\n            base += probe;\r\n        }\r\n\r\n        p = base;\r\n\r\n        if ( twobytes )\r\n          cpair = FT_NEXT_ULONG( p );\r\n        else\r\n          cpair = PFR_NEXT_KPAIR( p );\r\n\r\n        if ( cpair == pair )\r\n        {\r\n          FT_Int  value;\r\n\r\n\r\n        Found:\r\n          if ( twobyte_adj )\r\n            value = FT_PEEK_SHORT( p );\r\n          else\r\n            value = p[0];\r\n\r\n          kerning->x = item->base_adj + value;\r\n        }\r\n      }\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrobjs.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR object methods (specification).                         */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFROBJS_H__\r\n#define __PFROBJS_H__\r\n\r\n#include \"pfrtypes.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  typedef struct PFR_FaceRec_*  PFR_Face;\r\n\r\n  typedef struct PFR_SizeRec_*  PFR_Size;\r\n\r\n  typedef struct PFR_SlotRec_*  PFR_Slot;\r\n\r\n\r\n  typedef struct  PFR_FaceRec_\r\n  {\r\n    FT_FaceRec      root;\r\n    PFR_HeaderRec   header;\r\n    PFR_LogFontRec  log_font;\r\n    PFR_PhyFontRec  phy_font;\r\n\r\n  } PFR_FaceRec;\r\n\r\n\r\n  typedef struct  PFR_SizeRec_\r\n  {\r\n    FT_SizeRec  root;\r\n\r\n  } PFR_SizeRec;\r\n\r\n\r\n  typedef struct  PFR_SlotRec_\r\n  {\r\n    FT_GlyphSlotRec  root;\r\n    PFR_GlyphRec     glyph;\r\n\r\n  } PFR_SlotRec;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_face_init( FT_Stream      stream,\r\n                 FT_Face        face,           /* PFR_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params );\r\n\r\n  FT_LOCAL( void )\r\n  pfr_face_done( FT_Face  face );               /* PFR_Face */\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_face_get_kerning( FT_Face     face,       /* PFR_Face */\r\n                        FT_UInt     glyph1,\r\n                        FT_UInt     glyph2,\r\n                        FT_Vector*  kerning );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_slot_init( FT_GlyphSlot  slot );          /* PFR_Slot */\r\n\r\n  FT_LOCAL( void )\r\n  pfr_slot_done( FT_GlyphSlot  slot );          /* PFR_Slot */\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_slot_load( FT_GlyphSlot  slot,            /* PFR_Slot */\r\n                 FT_Size       size,            /* PFR_Size */\r\n                 FT_UInt       gindex,\r\n                 FT_Int32      load_flags );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PFROBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrsbit.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrsbit.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR bitmap loader (body).                                   */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006, 2009, 2010 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"pfrsbit.h\"\r\n#include \"pfrload.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n#include \"pfrerror.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pfr\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      PFR BIT WRITER                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  PFR_BitWriter_\r\n  {\r\n    FT_Byte*  line;      /* current line start                    */\r\n    FT_Int    pitch;     /* line size in bytes                    */\r\n    FT_Int    width;     /* width in pixels/bits                  */\r\n    FT_Int    rows;      /* number of remaining rows to scan      */\r\n    FT_Int    total;     /* total number of bits to draw          */\r\n\r\n  } PFR_BitWriterRec, *PFR_BitWriter;\r\n\r\n\r\n  static void\r\n  pfr_bitwriter_init( PFR_BitWriter  writer,\r\n                      FT_Bitmap*     target,\r\n                      FT_Bool        decreasing )\r\n  {\r\n    writer->line   = target->buffer;\r\n    writer->pitch  = target->pitch;\r\n    writer->width  = target->width;\r\n    writer->rows   = target->rows;\r\n    writer->total  = writer->width * writer->rows;\r\n\r\n    if ( !decreasing )\r\n    {\r\n      writer->line += writer->pitch * ( target->rows-1 );\r\n      writer->pitch = -writer->pitch;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  pfr_bitwriter_decode_bytes( PFR_BitWriter  writer,\r\n                              FT_Byte*       p,\r\n                              FT_Byte*       limit )\r\n  {\r\n    FT_Int    n, reload;\r\n    FT_Int    left = writer->width;\r\n    FT_Byte*  cur  = writer->line;\r\n    FT_UInt   mask = 0x80;\r\n    FT_UInt   val  = 0;\r\n    FT_UInt   c    = 0;\r\n\r\n\r\n    n = (FT_Int)( limit - p ) * 8;\r\n    if ( n > writer->total )\r\n      n = writer->total;\r\n\r\n    reload = n & 7;\r\n\r\n    for ( ; n > 0; n-- )\r\n    {\r\n      if ( ( n & 7 ) == reload )\r\n        val = *p++;\r\n\r\n      if ( val & 0x80 )\r\n        c |= mask;\r\n\r\n      val  <<= 1;\r\n      mask >>= 1;\r\n\r\n      if ( --left <= 0 )\r\n      {\r\n        cur[0] = (FT_Byte)c;\r\n        left   = writer->width;\r\n        mask   = 0x80;\r\n\r\n        writer->line += writer->pitch;\r\n        cur           = writer->line;\r\n        c             = 0;\r\n      }\r\n      else if ( mask == 0 )\r\n      {\r\n        cur[0] = (FT_Byte)c;\r\n        mask   = 0x80;\r\n        c      = 0;\r\n        cur ++;\r\n      }\r\n    }\r\n\r\n    if ( mask != 0x80 )\r\n      cur[0] = (FT_Byte)c;\r\n  }\r\n\r\n\r\n  static void\r\n  pfr_bitwriter_decode_rle1( PFR_BitWriter  writer,\r\n                             FT_Byte*       p,\r\n                             FT_Byte*       limit )\r\n  {\r\n    FT_Int    n, phase, count, counts[2], reload;\r\n    FT_Int    left = writer->width;\r\n    FT_Byte*  cur  = writer->line;\r\n    FT_UInt   mask = 0x80;\r\n    FT_UInt   c    = 0;\r\n\r\n\r\n    n = writer->total;\r\n\r\n    phase     = 1;\r\n    counts[0] = 0;\r\n    counts[1] = 0;\r\n    count     = 0;\r\n    reload    = 1;\r\n\r\n    for ( ; n > 0; n-- )\r\n    {\r\n      if ( reload )\r\n      {\r\n        do\r\n        {\r\n          if ( phase )\r\n          {\r\n            FT_Int  v;\r\n\r\n\r\n            if ( p >= limit )\r\n              break;\r\n\r\n            v         = *p++;\r\n            counts[0] = v >> 4;\r\n            counts[1] = v & 15;\r\n            phase     = 0;\r\n            count     = counts[0];\r\n          }\r\n          else\r\n          {\r\n            phase = 1;\r\n            count = counts[1];\r\n          }\r\n\r\n        } while ( count == 0 );\r\n      }\r\n\r\n      if ( phase )\r\n        c |= mask;\r\n\r\n      mask >>= 1;\r\n\r\n      if ( --left <= 0 )\r\n      {\r\n        cur[0] = (FT_Byte) c;\r\n        left   = writer->width;\r\n        mask   = 0x80;\r\n\r\n        writer->line += writer->pitch;\r\n        cur           = writer->line;\r\n        c             = 0;\r\n      }\r\n      else if ( mask == 0 )\r\n      {\r\n        cur[0] = (FT_Byte)c;\r\n        mask   = 0x80;\r\n        c      = 0;\r\n        cur ++;\r\n      }\r\n\r\n      reload = ( --count <= 0 );\r\n    }\r\n\r\n    if ( mask != 0x80 )\r\n      cur[0] = (FT_Byte) c;\r\n  }\r\n\r\n\r\n  static void\r\n  pfr_bitwriter_decode_rle2( PFR_BitWriter  writer,\r\n                             FT_Byte*       p,\r\n                             FT_Byte*       limit )\r\n  {\r\n    FT_Int    n, phase, count, reload;\r\n    FT_Int    left = writer->width;\r\n    FT_Byte*  cur  = writer->line;\r\n    FT_UInt   mask = 0x80;\r\n    FT_UInt   c    = 0;\r\n\r\n\r\n    n = writer->total;\r\n\r\n    phase  = 1;\r\n    count  = 0;\r\n    reload = 1;\r\n\r\n    for ( ; n > 0; n-- )\r\n    {\r\n      if ( reload )\r\n      {\r\n        do\r\n        {\r\n          if ( p >= limit )\r\n            break;\r\n\r\n          count = *p++;\r\n          phase = phase ^ 1;\r\n\r\n        } while ( count == 0 );\r\n      }\r\n\r\n      if ( phase )\r\n        c |= mask;\r\n\r\n      mask >>= 1;\r\n\r\n      if ( --left <= 0 )\r\n      {\r\n        cur[0] = (FT_Byte) c;\r\n        c      = 0;\r\n        mask   = 0x80;\r\n        left   = writer->width;\r\n\r\n        writer->line += writer->pitch;\r\n        cur           = writer->line;\r\n      }\r\n      else if ( mask == 0 )\r\n      {\r\n        cur[0] = (FT_Byte)c;\r\n        c      = 0;\r\n        mask   = 0x80;\r\n        cur ++;\r\n      }\r\n\r\n      reload = ( --count <= 0 );\r\n    }\r\n\r\n    if ( mask != 0x80 )\r\n      cur[0] = (FT_Byte) c;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  BITMAP DATA DECODING                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  pfr_lookup_bitmap_data( FT_Byte*   base,\r\n                          FT_Byte*   limit,\r\n                          FT_UInt    count,\r\n                          FT_UInt    flags,\r\n                          FT_UInt    char_code,\r\n                          FT_ULong*  found_offset,\r\n                          FT_ULong*  found_size )\r\n  {\r\n    FT_UInt   left, right, char_len;\r\n    FT_Bool   two = FT_BOOL( flags & 1 );\r\n    FT_Byte*  buff;\r\n\r\n\r\n    char_len = 4;\r\n    if ( two )       char_len += 1;\r\n    if ( flags & 2 ) char_len += 1;\r\n    if ( flags & 4 ) char_len += 1;\r\n\r\n    left  = 0;\r\n    right = count;\r\n\r\n    while ( left < right )\r\n    {\r\n      FT_UInt  middle, code;\r\n\r\n\r\n      middle = ( left + right ) >> 1;\r\n      buff   = base + middle * char_len;\r\n\r\n      /* check that we are not outside of the table -- */\r\n      /* this is possible with broken fonts...         */\r\n      if ( buff + char_len > limit )\r\n        goto Fail;\r\n\r\n      if ( two )\r\n        code = PFR_NEXT_USHORT( buff );\r\n      else\r\n        code = PFR_NEXT_BYTE( buff );\r\n\r\n      if ( code == char_code )\r\n        goto Found_It;\r\n\r\n      if ( code < char_code )\r\n        left = middle;\r\n      else\r\n        right = middle;\r\n    }\r\n\r\n  Fail:\r\n    /* Not found */\r\n    *found_size   = 0;\r\n    *found_offset = 0;\r\n    return;\r\n\r\n  Found_It:\r\n    if ( flags & 2 )\r\n      *found_size = PFR_NEXT_USHORT( buff );\r\n    else\r\n      *found_size = PFR_NEXT_BYTE( buff );\r\n\r\n    if ( flags & 4 )\r\n      *found_offset = PFR_NEXT_ULONG( buff );\r\n    else\r\n      *found_offset = PFR_NEXT_USHORT( buff );\r\n  }\r\n\r\n\r\n  /* load bitmap metrics.  \"*padvance\" must be set to the default value */\r\n  /* before calling this function...                                    */\r\n  /*                                                                    */\r\n  static FT_Error\r\n  pfr_load_bitmap_metrics( FT_Byte**  pdata,\r\n                           FT_Byte*   limit,\r\n                           FT_Long    scaled_advance,\r\n                           FT_Long   *axpos,\r\n                           FT_Long   *aypos,\r\n                           FT_UInt   *axsize,\r\n                           FT_UInt   *aysize,\r\n                           FT_Long   *aadvance,\r\n                           FT_UInt   *aformat )\r\n  {\r\n    FT_Error  error = PFR_Err_Ok;\r\n    FT_Byte   flags;\r\n    FT_Char   b;\r\n    FT_Byte*  p = *pdata;\r\n    FT_Long   xpos, ypos, advance;\r\n    FT_UInt   xsize, ysize;\r\n\r\n\r\n    PFR_CHECK( 1 );\r\n    flags = PFR_NEXT_BYTE( p );\r\n\r\n    xpos    = 0;\r\n    ypos    = 0;\r\n    xsize   = 0;\r\n    ysize   = 0;\r\n    advance = 0;\r\n\r\n    switch ( flags & 3 )\r\n    {\r\n    case 0:\r\n      PFR_CHECK( 1 );\r\n      b    = PFR_NEXT_INT8( p );\r\n      xpos = b >> 4;\r\n      ypos = ( (FT_Char)( b << 4 ) ) >> 4;\r\n      break;\r\n\r\n    case 1:\r\n      PFR_CHECK( 2 );\r\n      xpos = PFR_NEXT_INT8( p );\r\n      ypos = PFR_NEXT_INT8( p );\r\n      break;\r\n\r\n    case 2:\r\n      PFR_CHECK( 4 );\r\n      xpos = PFR_NEXT_SHORT( p );\r\n      ypos = PFR_NEXT_SHORT( p );\r\n      break;\r\n\r\n    case 3:\r\n      PFR_CHECK( 6 );\r\n      xpos = PFR_NEXT_LONG( p );\r\n      ypos = PFR_NEXT_LONG( p );\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    flags >>= 2;\r\n    switch ( flags & 3 )\r\n    {\r\n    case 0:\r\n      /* blank image */\r\n      xsize = 0;\r\n      ysize = 0;\r\n      break;\r\n\r\n    case 1:\r\n      PFR_CHECK( 1 );\r\n      b     = PFR_NEXT_BYTE( p );\r\n      xsize = ( b >> 4 ) & 0xF;\r\n      ysize = b & 0xF;\r\n      break;\r\n\r\n    case 2:\r\n      PFR_CHECK( 2 );\r\n      xsize = PFR_NEXT_BYTE( p );\r\n      ysize = PFR_NEXT_BYTE( p );\r\n      break;\r\n\r\n    case 3:\r\n      PFR_CHECK( 4 );\r\n      xsize = PFR_NEXT_USHORT( p );\r\n      ysize = PFR_NEXT_USHORT( p );\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    flags >>= 2;\r\n    switch ( flags & 3 )\r\n    {\r\n    case 0:\r\n      advance = scaled_advance;\r\n      break;\r\n\r\n    case 1:\r\n      PFR_CHECK( 1 );\r\n      advance = PFR_NEXT_INT8( p ) << 8;\r\n      break;\r\n\r\n    case 2:\r\n      PFR_CHECK( 2 );\r\n      advance = PFR_NEXT_SHORT( p );\r\n      break;\r\n\r\n    case 3:\r\n      PFR_CHECK( 3 );\r\n      advance = PFR_NEXT_LONG( p );\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    *axpos    = xpos;\r\n    *aypos    = ypos;\r\n    *axsize   = xsize;\r\n    *aysize   = ysize;\r\n    *aadvance = advance;\r\n    *aformat  = flags >> 2;\r\n    *pdata    = p;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Too_Short:\r\n    error = PFR_Err_Invalid_Table;\r\n    FT_ERROR(( \"pfr_load_bitmap_metrics: invalid glyph data\\n\" ));\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  pfr_load_bitmap_bits( FT_Byte*    p,\r\n                        FT_Byte*    limit,\r\n                        FT_UInt     format,\r\n                        FT_Bool     decreasing,\r\n                        FT_Bitmap*  target )\r\n  {\r\n    FT_Error          error = PFR_Err_Ok;\r\n    PFR_BitWriterRec  writer;\r\n\r\n\r\n    if ( target->rows > 0 && target->width > 0 )\r\n    {\r\n      pfr_bitwriter_init( &writer, target, decreasing );\r\n\r\n      switch ( format )\r\n      {\r\n      case 0: /* packed bits */\r\n        pfr_bitwriter_decode_bytes( &writer, p, limit );\r\n        break;\r\n\r\n      case 1: /* RLE1 */\r\n        pfr_bitwriter_decode_rle1( &writer, p, limit );\r\n        break;\r\n\r\n      case 2: /* RLE2 */\r\n        pfr_bitwriter_decode_rle2( &writer, p, limit );\r\n        break;\r\n\r\n      default:\r\n        FT_ERROR(( \"pfr_read_bitmap_data: invalid image type\\n\" ));\r\n        error = PFR_Err_Invalid_File_Format;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     BITMAP LOADING                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_slot_load_bitmap( PFR_Slot  glyph,\r\n                        PFR_Size  size,\r\n                        FT_UInt   glyph_index )\r\n  {\r\n    FT_Error     error;\r\n    PFR_Face     face   = (PFR_Face) glyph->root.face;\r\n    FT_Stream    stream = face->root.stream;\r\n    PFR_PhyFont  phys   = &face->phy_font;\r\n    FT_ULong     gps_offset;\r\n    FT_ULong     gps_size;\r\n    PFR_Char     character;\r\n    PFR_Strike   strike;\r\n\r\n\r\n    character = &phys->chars[glyph_index];\r\n\r\n    /* Look-up a bitmap strike corresponding to the current */\r\n    /* character dimensions                                 */\r\n    {\r\n      FT_UInt  n;\r\n\r\n\r\n      strike = phys->strikes;\r\n      for ( n = 0; n < phys->num_strikes; n++ )\r\n      {\r\n        if ( strike->x_ppm == (FT_UInt)size->root.metrics.x_ppem &&\r\n             strike->y_ppm == (FT_UInt)size->root.metrics.y_ppem )\r\n        {\r\n          goto Found_Strike;\r\n        }\r\n\r\n        strike++;\r\n      }\r\n\r\n      /* couldn't find it */\r\n      return PFR_Err_Invalid_Argument;\r\n    }\r\n\r\n  Found_Strike:\r\n\r\n    /* Now lookup the glyph's position within the file */\r\n    {\r\n      FT_UInt  char_len;\r\n\r\n\r\n      char_len = 4;\r\n      if ( strike->flags & 1 ) char_len += 1;\r\n      if ( strike->flags & 2 ) char_len += 1;\r\n      if ( strike->flags & 4 ) char_len += 1;\r\n\r\n      /* Access data directly in the frame to speed lookups */\r\n      if ( FT_STREAM_SEEK( phys->bct_offset + strike->bct_offset ) ||\r\n           FT_FRAME_ENTER( char_len * strike->num_bitmaps )        )\r\n        goto Exit;\r\n\r\n      pfr_lookup_bitmap_data( stream->cursor,\r\n                              stream->limit,\r\n                              strike->num_bitmaps,\r\n                              strike->flags,\r\n                              character->char_code,\r\n                              &gps_offset,\r\n                              &gps_size );\r\n\r\n      FT_FRAME_EXIT();\r\n\r\n      if ( gps_size == 0 )\r\n      {\r\n        /* Could not find a bitmap program string for this glyph */\r\n        error = PFR_Err_Invalid_Argument;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    /* get the bitmap metrics */\r\n    {\r\n      FT_Long   xpos = 0, ypos = 0, advance = 0;\r\n      FT_UInt   xsize = 0, ysize = 0, format = 0;\r\n      FT_Byte*  p;\r\n\r\n\r\n      /* compute linear advance */\r\n      advance = character->advance;\r\n      if ( phys->metrics_resolution != phys->outline_resolution )\r\n        advance = FT_MulDiv( advance,\r\n                             phys->outline_resolution,\r\n                             phys->metrics_resolution );\r\n\r\n      glyph->root.linearHoriAdvance = advance;\r\n\r\n      /* compute default advance, i.e., scaled advance.  This can be */\r\n      /* overridden in the bitmap header of certain glyphs.          */\r\n      advance = FT_MulDiv( (FT_Fixed)size->root.metrics.x_ppem << 8,\r\n                           character->advance,\r\n                           phys->metrics_resolution );\r\n\r\n      if ( FT_STREAM_SEEK( face->header.gps_section_offset + gps_offset ) ||\r\n           FT_FRAME_ENTER( gps_size )                                     )\r\n        goto Exit;\r\n\r\n      p     = stream->cursor;\r\n      error = pfr_load_bitmap_metrics( &p, stream->limit,\r\n                                       advance,\r\n                                       &xpos, &ypos,\r\n                                       &xsize, &ysize,\r\n                                       &advance, &format );\r\n\r\n      /*\r\n       * XXX: on 16bit system, we return an error for huge bitmap\r\n       *      which causes a size truncation, because truncated\r\n       *      size properties makes bitmap glyph broken.\r\n       */\r\n      if ( xpos > FT_INT_MAX || ( ypos + ysize ) > FT_INT_MAX )\r\n      {\r\n        FT_TRACE1(( \"pfr_slot_load_bitmap:\" ));\r\n        FT_TRACE1(( \"huge bitmap glyph %dx%d over FT_GlyphSlot\\n\",\r\n                     xpos, ypos ));\r\n        error = PFR_Err_Invalid_Pixel_Size;\r\n      }\r\n\r\n      if ( !error )\r\n      {\r\n        glyph->root.format = FT_GLYPH_FORMAT_BITMAP;\r\n\r\n        /* Set up glyph bitmap and metrics */\r\n\r\n        /* XXX: needs casts to fit FT_Bitmap.{width|rows|pitch} */\r\n        glyph->root.bitmap.width      = (FT_Int)xsize;\r\n        glyph->root.bitmap.rows       = (FT_Int)ysize;\r\n        glyph->root.bitmap.pitch      = (FT_Int)( xsize + 7 ) >> 3;\r\n        glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO;\r\n\r\n        /* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */\r\n        glyph->root.metrics.width        = (FT_Pos)xsize << 6;\r\n        glyph->root.metrics.height       = (FT_Pos)ysize << 6;\r\n        glyph->root.metrics.horiBearingX = xpos << 6;\r\n        glyph->root.metrics.horiBearingY = ypos << 6;\r\n        glyph->root.metrics.horiAdvance  = FT_PIX_ROUND( ( advance >> 2 ) );\r\n        glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;\r\n        glyph->root.metrics.vertBearingY = 0;\r\n        glyph->root.metrics.vertAdvance  = size->root.metrics.height;\r\n\r\n        /* XXX: needs casts fit FT_GlyphSlotRec.bitmap_{left|top} */\r\n        glyph->root.bitmap_left = (FT_Int)xpos;\r\n        glyph->root.bitmap_top  = (FT_Int)(ypos + ysize);\r\n\r\n        /* Allocate and read bitmap data */\r\n        {\r\n          FT_ULong  len = glyph->root.bitmap.pitch * ysize;\r\n\r\n\r\n          error = ft_glyphslot_alloc_bitmap( &glyph->root, len );\r\n          if ( !error )\r\n          {\r\n            error = pfr_load_bitmap_bits(\r\n                      p,\r\n                      stream->limit,\r\n                      format,\r\n                      FT_BOOL(face->header.color_flags & 2),\r\n                      &glyph->root.bitmap );\r\n          }\r\n        }\r\n      }\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrsbit.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrsbit.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType PFR bitmap loader (specification).                          */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFRSBIT_H__\r\n#define __PFRSBIT_H__\r\n\r\n#include \"pfrobjs.h\"\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  FT_LOCAL( FT_Error )\r\n  pfr_slot_load_bitmap( PFR_Slot  glyph,\r\n                        PFR_Size  size,\r\n                        FT_UInt   glyph_index );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PFR_SBIT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/pfrtypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pfrtypes.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType PFR data structures (specification only).                   */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2005, 2007 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PFRTYPES_H__\r\n#define __PFRTYPES_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /************************************************************************/\r\n\r\n  /* the PFR Header structure */\r\n  typedef struct  PFR_HeaderRec_\r\n  {\r\n    FT_UInt32  signature;\r\n    FT_UInt    version;\r\n    FT_UInt    signature2;\r\n    FT_UInt    header_size;\r\n\r\n    FT_UInt    log_dir_size;\r\n    FT_UInt    log_dir_offset;\r\n\r\n    FT_UInt    log_font_max_size;\r\n    FT_UInt32  log_font_section_size;\r\n    FT_UInt32  log_font_section_offset;\r\n\r\n    FT_UInt32  phy_font_max_size;\r\n    FT_UInt32  phy_font_section_size;\r\n    FT_UInt32  phy_font_section_offset;\r\n\r\n    FT_UInt    gps_max_size;\r\n    FT_UInt32  gps_section_size;\r\n    FT_UInt32  gps_section_offset;\r\n\r\n    FT_UInt    max_blue_values;\r\n    FT_UInt    max_x_orus;\r\n    FT_UInt    max_y_orus;\r\n\r\n    FT_UInt    phy_font_max_size_high;\r\n    FT_UInt    color_flags;\r\n\r\n    FT_UInt32  bct_max_size;\r\n    FT_UInt32  bct_set_max_size;\r\n    FT_UInt32  phy_bct_set_max_size;\r\n\r\n    FT_UInt    num_phy_fonts;\r\n    FT_UInt    max_vert_stem_snap;\r\n    FT_UInt    max_horz_stem_snap;\r\n    FT_UInt    max_chars;\r\n\r\n  } PFR_HeaderRec, *PFR_Header;\r\n\r\n\r\n  /* used in `color_flags' field of the PFR_Header */\r\n  typedef enum  PFR_HeaderFlags_\r\n  {\r\n    PFR_FLAG_BLACK_PIXEL   = 1,\r\n    PFR_FLAG_INVERT_BITMAP = 2\r\n\r\n  } PFR_HeaderFlags;\r\n\r\n\r\n  /************************************************************************/\r\n\r\n  typedef struct  PFR_LogFontRec_\r\n  {\r\n    FT_UInt32  size;\r\n    FT_UInt32  offset;\r\n\r\n    FT_Int32   matrix[4];\r\n    FT_UInt    stroke_flags;\r\n    FT_Int     stroke_thickness;\r\n    FT_Int     bold_thickness;\r\n    FT_Int32   miter_limit;\r\n\r\n    FT_UInt32  phys_size;\r\n    FT_UInt32  phys_offset;\r\n\r\n  } PFR_LogFontRec, *PFR_LogFont;\r\n\r\n\r\n  typedef enum  PFR_LogFlags_\r\n  {\r\n    PFR_LOG_EXTRA_ITEMS  = 0x40,\r\n    PFR_LOG_2BYTE_BOLD   = 0x20,\r\n    PFR_LOG_BOLD         = 0x10,\r\n    PFR_LOG_2BYTE_STROKE = 8,\r\n    PFR_LOG_STROKE       = 4,\r\n    PFR_LINE_JOIN_MASK   = 3\r\n\r\n  } PFR_LogFlags;\r\n\r\n\r\n  typedef enum  PFR_LineJoinFlags_\r\n  {\r\n    PFR_LINE_JOIN_MITER = 0,\r\n    PFR_LINE_JOIN_ROUND = 1,\r\n    PFR_LINE_JOIN_BEVEL = 2\r\n\r\n  } PFR_LineJoinFlags;\r\n\r\n\r\n  /************************************************************************/\r\n\r\n  typedef enum  PFR_BitmapFlags_\r\n  {\r\n    PFR_BITMAP_3BYTE_OFFSET   = 4,\r\n    PFR_BITMAP_2BYTE_SIZE     = 2,\r\n    PFR_BITMAP_2BYTE_CHARCODE = 1\r\n\r\n  } PFR_BitmapFlags;\r\n\r\n\r\n  typedef struct  PFR_BitmapCharRec_\r\n  {\r\n    FT_UInt    char_code;\r\n    FT_UInt    gps_size;\r\n    FT_UInt32  gps_offset;\r\n\r\n  } PFR_BitmapCharRec, *PFR_BitmapChar;\r\n\r\n\r\n  typedef enum  PFR_StrikeFlags_\r\n  {\r\n    PFR_STRIKE_2BYTE_COUNT  = 0x10,\r\n    PFR_STRIKE_3BYTE_OFFSET = 0x08,\r\n    PFR_STRIKE_3BYTE_SIZE   = 0x04,\r\n    PFR_STRIKE_2BYTE_YPPM   = 0x02,\r\n    PFR_STRIKE_2BYTE_XPPM   = 0x01\r\n\r\n  } PFR_StrikeFlags;\r\n\r\n\r\n  typedef struct  PFR_StrikeRec_\r\n  {\r\n    FT_UInt         x_ppm;\r\n    FT_UInt         y_ppm;\r\n    FT_UInt         flags;\r\n\r\n    FT_UInt32       gps_size;\r\n    FT_UInt32       gps_offset;\r\n\r\n    FT_UInt32       bct_size;\r\n    FT_UInt32       bct_offset;\r\n\r\n    /* optional */\r\n    FT_UInt         num_bitmaps;\r\n    PFR_BitmapChar  bitmaps;\r\n\r\n  } PFR_StrikeRec, *PFR_Strike;\r\n\r\n\r\n  /************************************************************************/\r\n\r\n  typedef struct  PFR_CharRec_\r\n  {\r\n    FT_UInt    char_code;\r\n    FT_Int     advance;\r\n    FT_UInt    gps_size;\r\n    FT_UInt32  gps_offset;\r\n\r\n  } PFR_CharRec, *PFR_Char;\r\n\r\n\r\n  /************************************************************************/\r\n\r\n  typedef struct  PFR_DimensionRec_\r\n  {\r\n    FT_UInt  standard;\r\n    FT_UInt  num_stem_snaps;\r\n    FT_Int*  stem_snaps;\r\n\r\n  } PFR_DimensionRec, *PFR_Dimension;\r\n\r\n  /************************************************************************/\r\n\r\n  typedef struct PFR_KernItemRec_*  PFR_KernItem;\r\n\r\n  typedef struct  PFR_KernItemRec_\r\n  {\r\n    PFR_KernItem  next;\r\n    FT_Byte       pair_count;\r\n    FT_Byte       flags;\r\n    FT_Short      base_adj;\r\n    FT_UInt       pair_size;\r\n    FT_Offset     offset;\r\n    FT_UInt32     pair1;\r\n    FT_UInt32     pair2;\r\n\r\n  } PFR_KernItemRec;\r\n\r\n\r\n#define PFR_KERN_INDEX( g1, g2 )                          \\\r\n          ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )\r\n\r\n#define PFR_KERN_PAIR_INDEX( pair )                        \\\r\n          PFR_KERN_INDEX( (pair)->glyph1, (pair)->glyph2 )\r\n\r\n#define PFR_NEXT_KPAIR( p )  ( p += 2,                              \\\r\n                               ( (FT_UInt32)p[-2] << 16 ) | p[-1] )\r\n\r\n\r\n  /************************************************************************/\r\n\r\n  typedef struct  PFR_PhyFontRec_\r\n  {\r\n    FT_Memory          memory;\r\n    FT_UInt32          offset;\r\n\r\n    FT_UInt            font_ref_number;\r\n    FT_UInt            outline_resolution;\r\n    FT_UInt            metrics_resolution;\r\n    FT_BBox            bbox;\r\n    FT_UInt            flags;\r\n    FT_UInt            standard_advance;\r\n\r\n    FT_Int             ascent;   /* optional, bbox.yMax if not present */\r\n    FT_Int             descent;  /* optional, bbox.yMin if not present */\r\n    FT_Int             leading;  /* optional, 0 if not present         */\r\n\r\n    PFR_DimensionRec   horizontal;\r\n    PFR_DimensionRec   vertical;\r\n\r\n    FT_String*         font_id;\r\n    FT_String*         family_name;\r\n    FT_String*         style_name;\r\n\r\n    FT_UInt            num_strikes;\r\n    FT_UInt            max_strikes;\r\n    PFR_StrikeRec*     strikes;\r\n\r\n    FT_UInt            num_blue_values;\r\n    FT_Int            *blue_values;\r\n    FT_UInt            blue_fuzz;\r\n    FT_UInt            blue_scale;\r\n\r\n    FT_UInt            num_chars;\r\n    FT_Offset          chars_offset;\r\n    PFR_Char           chars;\r\n\r\n    FT_UInt            num_kern_pairs;\r\n    PFR_KernItem       kern_items;\r\n    PFR_KernItem*      kern_items_tail;\r\n\r\n    /* not part of the spec, but used during load */\r\n    FT_Long            bct_offset;\r\n    FT_Byte*           cursor;\r\n\r\n  } PFR_PhyFontRec, *PFR_PhyFont;\r\n\r\n\r\n  typedef enum  PFR_PhyFlags_\r\n  {\r\n    PFR_PHY_EXTRA_ITEMS      = 0x80,\r\n    PFR_PHY_3BYTE_GPS_OFFSET = 0x20,\r\n    PFR_PHY_2BYTE_GPS_SIZE   = 0x10,\r\n    PFR_PHY_ASCII_CODE       = 0x08,\r\n    PFR_PHY_PROPORTIONAL     = 0x04,\r\n    PFR_PHY_2BYTE_CHARCODE   = 0x02,\r\n    PFR_PHY_VERTICAL         = 0x01\r\n\r\n  } PFR_PhyFlags;\r\n\r\n\r\n  typedef enum PFR_KernFlags_\r\n  {\r\n    PFR_KERN_2BYTE_CHAR  = 0x01,\r\n    PFR_KERN_2BYTE_ADJ   = 0x02\r\n\r\n  } PFR_KernFlags;\r\n\r\n\r\n  /************************************************************************/\r\n\r\n  typedef enum  PFR_GlyphFlags_\r\n  {\r\n    PFR_GLYPH_IS_COMPOUND   = 0x80,\r\n    PFR_GLYPH_EXTRA_ITEMS   = 0x08,\r\n    PFR_GLYPH_1BYTE_XYCOUNT = 0x04,\r\n    PFR_GLYPH_XCOUNT        = 0x02,\r\n    PFR_GLYPH_YCOUNT        = 0x01\r\n\r\n  } PFR_GlyphFlags;\r\n\r\n\r\n  /* controlled coordinate */\r\n  typedef struct  PFR_CoordRec_\r\n  {\r\n    FT_UInt  org;\r\n    FT_UInt  cur;\r\n\r\n  } PFR_CoordRec, *PFR_Coord;\r\n\r\n\r\n  typedef struct  PFR_SubGlyphRec_\r\n  {\r\n    FT_Fixed   x_scale;\r\n    FT_Fixed   y_scale;\r\n    FT_Int     x_delta;\r\n    FT_Int     y_delta;\r\n    FT_UInt32  gps_offset;\r\n    FT_UInt    gps_size;\r\n\r\n  } PFR_SubGlyphRec, *PFR_SubGlyph;\r\n\r\n\r\n  typedef enum  PFR_SubgGlyphFlags_\r\n  {\r\n    PFR_SUBGLYPH_3BYTE_OFFSET = 0x80,\r\n    PFR_SUBGLYPH_2BYTE_SIZE   = 0x40,\r\n    PFR_SUBGLYPH_YSCALE       = 0x20,\r\n    PFR_SUBGLYPH_XSCALE       = 0x10\r\n\r\n  } PFR_SubGlyphFlags;\r\n\r\n\r\n  typedef struct  PFR_GlyphRec_\r\n  {\r\n    FT_Byte           format;\r\n\r\n#if 0\r\n    FT_UInt           num_x_control;\r\n    FT_UInt           num_y_control;\r\n#endif\r\n    FT_UInt           max_xy_control;\r\n    FT_Pos*           x_control;\r\n    FT_Pos*           y_control;\r\n\r\n\r\n    FT_UInt           num_subs;\r\n    FT_UInt           max_subs;\r\n    PFR_SubGlyphRec*  subs;\r\n\r\n    FT_GlyphLoader    loader;\r\n    FT_Bool           path_begun;\r\n\r\n  } PFR_GlyphRec, *PFR_Glyph;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PFRTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pfr/rules.mk",
    "content": "#\r\n# FreeType 2 PFR driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 2002, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# pfr driver directory\r\n#\r\nPFR_DIR := $(SRC_DIR)/pfr\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nPFR_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PFR_DIR))\r\n\r\n\r\n# pfr driver sources (i.e., C files)\r\n#\r\nPFR_DRV_SRC := $(PFR_DIR)/pfrload.c  \\\r\n               $(PFR_DIR)/pfrgload.c \\\r\n               $(PFR_DIR)/pfrcmap.c  \\\r\n               $(PFR_DIR)/pfrdrivr.c \\\r\n               $(PFR_DIR)/pfrsbit.c  \\\r\n               $(PFR_DIR)/pfrobjs.c\r\n\r\n# pfr driver headers\r\n#\r\nPFR_DRV_H := $(PFR_DRV_SRC:%.c=%.h) \\\r\n             $(PFR_DIR)/pfrerror.h  \\\r\n             $(PFR_DIR)/pfrtypes.h\r\n\r\n\r\n# Pfr driver object(s)\r\n#\r\n#   PFR_DRV_OBJ_M is used during `multi' builds\r\n#   PFR_DRV_OBJ_S is used during `single' builds\r\n#\r\nPFR_DRV_OBJ_M := $(PFR_DRV_SRC:$(PFR_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nPFR_DRV_OBJ_S := $(OBJ_DIR)/pfr.$O\r\n\r\n# pfr driver source file for single build\r\n#\r\nPFR_DRV_SRC_S := $(PFR_DIR)/pfr.c\r\n\r\n\r\n# pfr driver - single object\r\n#\r\n$(PFR_DRV_OBJ_S): $(PFR_DRV_SRC_S) $(PFR_DRV_SRC) $(FREETYPE_H) $(PFR_DRV_H)\r\n\t$(PFR_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PFR_DRV_SRC_S))\r\n\r\n\r\n# pfr driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(PFR_DIR)/%.c $(FREETYPE_H) $(PFR_DRV_H)\r\n\t$(PFR_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(PFR_DRV_OBJ_S)\r\nDRV_OBJS_M += $(PFR_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/Jamfile",
    "content": "# FreeType 2 src/psaux Jamfile\r\n#\r\n# Copyright 2001, 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) psaux ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = psauxmod psobjs   t1decode t1cmap\r\n               psconv   afmparse\r\n               ;\r\n  }\r\n  else\r\n  {\r\n    _sources = psaux ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/psaux Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/afmparse.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afmparse.c                                                             */\r\n/*                                                                         */\r\n/*    AFM parser (body).                                                   */\r\n/*                                                                         */\r\n/*  Copyright 2006-2010, 2012 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n#include \"afmparse.h\"\r\n#include \"psconv.h\"\r\n\r\n#include \"psauxerr.h\"\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/*    AFM_Stream                                                           */\r\n/*                                                                         */\r\n/* The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib.  */\r\n/*                                                                         */\r\n/*                                                                         */\r\n\r\n  enum\r\n  {\r\n    AFM_STREAM_STATUS_NORMAL,\r\n    AFM_STREAM_STATUS_EOC,\r\n    AFM_STREAM_STATUS_EOL,\r\n    AFM_STREAM_STATUS_EOF\r\n  };\r\n\r\n\r\n  typedef struct  AFM_StreamRec_\r\n  {\r\n    FT_Byte*  cursor;\r\n    FT_Byte*  base;\r\n    FT_Byte*  limit;\r\n\r\n    FT_Int    status;\r\n\r\n  } AFM_StreamRec;\r\n\r\n\r\n#ifndef EOF\r\n#define EOF -1\r\n#endif\r\n\r\n\r\n  /* this works because empty lines are ignored */\r\n#define AFM_IS_NEWLINE( ch )  ( (ch) == '\\r' || (ch) == '\\n' )\r\n\r\n#define AFM_IS_EOF( ch )      ( (ch) == EOF  || (ch) == '\\x1a' )\r\n#define AFM_IS_SPACE( ch )    ( (ch) == ' '  || (ch) == '\\t' )\r\n\r\n  /* column separator; there is no `column' in the spec actually */\r\n#define AFM_IS_SEP( ch )      ( (ch) == ';' )\r\n\r\n#define AFM_GETC()                                                       \\\r\n          ( ( (stream)->cursor < (stream)->limit ) ? *(stream)->cursor++ \\\r\n                                                   : EOF )\r\n\r\n#define AFM_STREAM_KEY_BEGIN( stream )    \\\r\n          (char*)( (stream)->cursor - 1 )\r\n\r\n#define AFM_STREAM_KEY_LEN( stream, key )       \\\r\n          ( (char*)(stream)->cursor - key - 1 )\r\n\r\n#define AFM_STATUS_EOC( stream ) \\\r\n          ( (stream)->status >= AFM_STREAM_STATUS_EOC )\r\n\r\n#define AFM_STATUS_EOL( stream ) \\\r\n          ( (stream)->status >= AFM_STREAM_STATUS_EOL )\r\n\r\n#define AFM_STATUS_EOF( stream ) \\\r\n          ( (stream)->status >= AFM_STREAM_STATUS_EOF )\r\n\r\n\r\n  static int\r\n  afm_stream_skip_spaces( AFM_Stream  stream )\r\n  {\r\n    int  ch = 0;  /* make stupid compiler happy */\r\n\r\n\r\n    if ( AFM_STATUS_EOC( stream ) )\r\n      return ';';\r\n\r\n    while ( 1 )\r\n    {\r\n      ch = AFM_GETC();\r\n      if ( !AFM_IS_SPACE( ch ) )\r\n        break;\r\n    }\r\n\r\n    if ( AFM_IS_NEWLINE( ch ) )\r\n      stream->status = AFM_STREAM_STATUS_EOL;\r\n    else if ( AFM_IS_SEP( ch ) )\r\n      stream->status = AFM_STREAM_STATUS_EOC;\r\n    else if ( AFM_IS_EOF( ch ) )\r\n      stream->status = AFM_STREAM_STATUS_EOF;\r\n\r\n    return ch;\r\n  }\r\n\r\n\r\n  /* read a key or value in current column */\r\n  static char*\r\n  afm_stream_read_one( AFM_Stream  stream )\r\n  {\r\n    char*  str;\r\n    int    ch;\r\n\r\n\r\n    afm_stream_skip_spaces( stream );\r\n    if ( AFM_STATUS_EOC( stream ) )\r\n      return NULL;\r\n\r\n    str = AFM_STREAM_KEY_BEGIN( stream );\r\n\r\n    while ( 1 )\r\n    {\r\n      ch = AFM_GETC();\r\n      if ( AFM_IS_SPACE( ch ) )\r\n        break;\r\n      else if ( AFM_IS_NEWLINE( ch ) )\r\n      {\r\n        stream->status = AFM_STREAM_STATUS_EOL;\r\n        break;\r\n      }\r\n      else if ( AFM_IS_SEP( ch ) )\r\n      {\r\n        stream->status = AFM_STREAM_STATUS_EOC;\r\n        break;\r\n      }\r\n      else if ( AFM_IS_EOF( ch ) )\r\n      {\r\n        stream->status = AFM_STREAM_STATUS_EOF;\r\n        break;\r\n      }\r\n    }\r\n\r\n    return str;\r\n  }\r\n\r\n\r\n  /* read a string (i.e., read to EOL) */\r\n  static char*\r\n  afm_stream_read_string( AFM_Stream  stream )\r\n  {\r\n    char*  str;\r\n    int    ch;\r\n\r\n\r\n    afm_stream_skip_spaces( stream );\r\n    if ( AFM_STATUS_EOL( stream ) )\r\n      return NULL;\r\n\r\n    str = AFM_STREAM_KEY_BEGIN( stream );\r\n\r\n    /* scan to eol */\r\n    while ( 1 )\r\n    {\r\n      ch = AFM_GETC();\r\n      if ( AFM_IS_NEWLINE( ch ) )\r\n      {\r\n        stream->status = AFM_STREAM_STATUS_EOL;\r\n        break;\r\n      }\r\n      else if ( AFM_IS_EOF( ch ) )\r\n      {\r\n        stream->status = AFM_STREAM_STATUS_EOF;\r\n        break;\r\n      }\r\n    }\r\n\r\n    return str;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*    AFM_Parser                                                         */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n\r\n  /* all keys defined in Ch. 7-10 of 5004.AFM_Spec.pdf */\r\n  typedef enum  AFM_Token_\r\n  {\r\n    AFM_TOKEN_ASCENDER,\r\n    AFM_TOKEN_AXISLABEL,\r\n    AFM_TOKEN_AXISTYPE,\r\n    AFM_TOKEN_B,\r\n    AFM_TOKEN_BLENDAXISTYPES,\r\n    AFM_TOKEN_BLENDDESIGNMAP,\r\n    AFM_TOKEN_BLENDDESIGNPOSITIONS,\r\n    AFM_TOKEN_C,\r\n    AFM_TOKEN_CC,\r\n    AFM_TOKEN_CH,\r\n    AFM_TOKEN_CAPHEIGHT,\r\n    AFM_TOKEN_CHARWIDTH,\r\n    AFM_TOKEN_CHARACTERSET,\r\n    AFM_TOKEN_CHARACTERS,\r\n    AFM_TOKEN_DESCENDER,\r\n    AFM_TOKEN_ENCODINGSCHEME,\r\n    AFM_TOKEN_ENDAXIS,\r\n    AFM_TOKEN_ENDCHARMETRICS,\r\n    AFM_TOKEN_ENDCOMPOSITES,\r\n    AFM_TOKEN_ENDDIRECTION,\r\n    AFM_TOKEN_ENDFONTMETRICS,\r\n    AFM_TOKEN_ENDKERNDATA,\r\n    AFM_TOKEN_ENDKERNPAIRS,\r\n    AFM_TOKEN_ENDTRACKKERN,\r\n    AFM_TOKEN_ESCCHAR,\r\n    AFM_TOKEN_FAMILYNAME,\r\n    AFM_TOKEN_FONTBBOX,\r\n    AFM_TOKEN_FONTNAME,\r\n    AFM_TOKEN_FULLNAME,\r\n    AFM_TOKEN_ISBASEFONT,\r\n    AFM_TOKEN_ISCIDFONT,\r\n    AFM_TOKEN_ISFIXEDPITCH,\r\n    AFM_TOKEN_ISFIXEDV,\r\n    AFM_TOKEN_ITALICANGLE,\r\n    AFM_TOKEN_KP,\r\n    AFM_TOKEN_KPH,\r\n    AFM_TOKEN_KPX,\r\n    AFM_TOKEN_KPY,\r\n    AFM_TOKEN_L,\r\n    AFM_TOKEN_MAPPINGSCHEME,\r\n    AFM_TOKEN_METRICSSETS,\r\n    AFM_TOKEN_N,\r\n    AFM_TOKEN_NOTICE,\r\n    AFM_TOKEN_PCC,\r\n    AFM_TOKEN_STARTAXIS,\r\n    AFM_TOKEN_STARTCHARMETRICS,\r\n    AFM_TOKEN_STARTCOMPOSITES,\r\n    AFM_TOKEN_STARTDIRECTION,\r\n    AFM_TOKEN_STARTFONTMETRICS,\r\n    AFM_TOKEN_STARTKERNDATA,\r\n    AFM_TOKEN_STARTKERNPAIRS,\r\n    AFM_TOKEN_STARTKERNPAIRS0,\r\n    AFM_TOKEN_STARTKERNPAIRS1,\r\n    AFM_TOKEN_STARTTRACKKERN,\r\n    AFM_TOKEN_STDHW,\r\n    AFM_TOKEN_STDVW,\r\n    AFM_TOKEN_TRACKKERN,\r\n    AFM_TOKEN_UNDERLINEPOSITION,\r\n    AFM_TOKEN_UNDERLINETHICKNESS,\r\n    AFM_TOKEN_VV,\r\n    AFM_TOKEN_VVECTOR,\r\n    AFM_TOKEN_VERSION,\r\n    AFM_TOKEN_W,\r\n    AFM_TOKEN_W0,\r\n    AFM_TOKEN_W0X,\r\n    AFM_TOKEN_W0Y,\r\n    AFM_TOKEN_W1,\r\n    AFM_TOKEN_W1X,\r\n    AFM_TOKEN_W1Y,\r\n    AFM_TOKEN_WX,\r\n    AFM_TOKEN_WY,\r\n    AFM_TOKEN_WEIGHT,\r\n    AFM_TOKEN_WEIGHTVECTOR,\r\n    AFM_TOKEN_XHEIGHT,\r\n    N_AFM_TOKENS,\r\n    AFM_TOKEN_UNKNOWN\r\n\r\n  } AFM_Token;\r\n\r\n\r\n  static const char*  const afm_key_table[N_AFM_TOKENS] =\r\n  {\r\n    \"Ascender\",\r\n    \"AxisLabel\",\r\n    \"AxisType\",\r\n    \"B\",\r\n    \"BlendAxisTypes\",\r\n    \"BlendDesignMap\",\r\n    \"BlendDesignPositions\",\r\n    \"C\",\r\n    \"CC\",\r\n    \"CH\",\r\n    \"CapHeight\",\r\n    \"CharWidth\",\r\n    \"CharacterSet\",\r\n    \"Characters\",\r\n    \"Descender\",\r\n    \"EncodingScheme\",\r\n    \"EndAxis\",\r\n    \"EndCharMetrics\",\r\n    \"EndComposites\",\r\n    \"EndDirection\",\r\n    \"EndFontMetrics\",\r\n    \"EndKernData\",\r\n    \"EndKernPairs\",\r\n    \"EndTrackKern\",\r\n    \"EscChar\",\r\n    \"FamilyName\",\r\n    \"FontBBox\",\r\n    \"FontName\",\r\n    \"FullName\",\r\n    \"IsBaseFont\",\r\n    \"IsCIDFont\",\r\n    \"IsFixedPitch\",\r\n    \"IsFixedV\",\r\n    \"ItalicAngle\",\r\n    \"KP\",\r\n    \"KPH\",\r\n    \"KPX\",\r\n    \"KPY\",\r\n    \"L\",\r\n    \"MappingScheme\",\r\n    \"MetricsSets\",\r\n    \"N\",\r\n    \"Notice\",\r\n    \"PCC\",\r\n    \"StartAxis\",\r\n    \"StartCharMetrics\",\r\n    \"StartComposites\",\r\n    \"StartDirection\",\r\n    \"StartFontMetrics\",\r\n    \"StartKernData\",\r\n    \"StartKernPairs\",\r\n    \"StartKernPairs0\",\r\n    \"StartKernPairs1\",\r\n    \"StartTrackKern\",\r\n    \"StdHW\",\r\n    \"StdVW\",\r\n    \"TrackKern\",\r\n    \"UnderlinePosition\",\r\n    \"UnderlineThickness\",\r\n    \"VV\",\r\n    \"VVector\",\r\n    \"Version\",\r\n    \"W\",\r\n    \"W0\",\r\n    \"W0X\",\r\n    \"W0Y\",\r\n    \"W1\",\r\n    \"W1X\",\r\n    \"W1Y\",\r\n    \"WX\",\r\n    \"WY\",\r\n    \"Weight\",\r\n    \"WeightVector\",\r\n    \"XHeight\"\r\n  };\r\n\r\n\r\n  /*\r\n   * `afm_parser_read_vals' and `afm_parser_next_key' provide\r\n   * high-level operations to an AFM_Stream.  The rest of the\r\n   * parser functions should use them without accessing the\r\n   * AFM_Stream directly.\r\n   */\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  afm_parser_read_vals( AFM_Parser  parser,\r\n                        AFM_Value   vals,\r\n                        FT_UInt     n )\r\n  {\r\n    AFM_Stream  stream = parser->stream;\r\n    char*       str;\r\n    FT_UInt     i;\r\n\r\n\r\n    if ( n > AFM_MAX_ARGUMENTS )\r\n      return 0;\r\n\r\n    for ( i = 0; i < n; i++ )\r\n    {\r\n      FT_Offset  len;\r\n      AFM_Value  val = vals + i;\r\n\r\n\r\n      if ( val->type == AFM_VALUE_TYPE_STRING )\r\n        str = afm_stream_read_string( stream );\r\n      else\r\n        str = afm_stream_read_one( stream );\r\n\r\n      if ( !str )\r\n        break;\r\n\r\n      len = AFM_STREAM_KEY_LEN( stream, str );\r\n\r\n      switch ( val->type )\r\n      {\r\n      case AFM_VALUE_TYPE_STRING:\r\n      case AFM_VALUE_TYPE_NAME:\r\n        {\r\n          FT_Memory  memory = parser->memory;\r\n          FT_Error   error;\r\n\r\n\r\n          if ( !FT_QALLOC( val->u.s, len + 1 ) )\r\n          {\r\n            ft_memcpy( val->u.s, str, len );\r\n            val->u.s[len] = '\\0';\r\n          }\r\n        }\r\n        break;\r\n\r\n      case AFM_VALUE_TYPE_FIXED:\r\n        val->u.f = PS_Conv_ToFixed( (FT_Byte**)(void*)&str,\r\n                                    (FT_Byte*)str + len, 0 );\r\n        break;\r\n\r\n      case AFM_VALUE_TYPE_INTEGER:\r\n        val->u.i = PS_Conv_ToInt( (FT_Byte**)(void*)&str,\r\n                                  (FT_Byte*)str + len );\r\n        break;\r\n\r\n      case AFM_VALUE_TYPE_BOOL:\r\n        val->u.b = FT_BOOL( len == 4                      &&\r\n                            !ft_strncmp( str, \"true\", 4 ) );\r\n        break;\r\n\r\n      case AFM_VALUE_TYPE_INDEX:\r\n        if ( parser->get_index )\r\n          val->u.i = parser->get_index( str, len, parser->user_data );\r\n        else\r\n          val->u.i = 0;\r\n        break;\r\n      }\r\n    }\r\n\r\n    return i;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( char* )\r\n  afm_parser_next_key( AFM_Parser  parser,\r\n                       FT_Bool     line,\r\n                       FT_Offset*  len )\r\n  {\r\n    AFM_Stream  stream = parser->stream;\r\n    char*       key    = 0;  /* make stupid compiler happy */\r\n\r\n\r\n    if ( line )\r\n    {\r\n      while ( 1 )\r\n      {\r\n        /* skip current line */\r\n        if ( !AFM_STATUS_EOL( stream ) )\r\n          afm_stream_read_string( stream );\r\n\r\n        stream->status = AFM_STREAM_STATUS_NORMAL;\r\n        key = afm_stream_read_one( stream );\r\n\r\n        /* skip empty line */\r\n        if ( !key                      &&\r\n             !AFM_STATUS_EOF( stream ) &&\r\n             AFM_STATUS_EOL( stream )  )\r\n          continue;\r\n\r\n        break;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      while ( 1 )\r\n      {\r\n        /* skip current column */\r\n        while ( !AFM_STATUS_EOC( stream ) )\r\n          afm_stream_read_one( stream );\r\n\r\n        stream->status = AFM_STREAM_STATUS_NORMAL;\r\n        key = afm_stream_read_one( stream );\r\n\r\n        /* skip empty column */\r\n        if ( !key                      &&\r\n             !AFM_STATUS_EOF( stream ) &&\r\n             AFM_STATUS_EOC( stream )  )\r\n          continue;\r\n\r\n        break;\r\n      }\r\n    }\r\n\r\n    if ( len )\r\n      *len = ( key ) ? (FT_Offset)AFM_STREAM_KEY_LEN( stream, key )\r\n                     : 0;\r\n\r\n    return key;\r\n  }\r\n\r\n\r\n  static AFM_Token\r\n  afm_tokenize( const char*  key,\r\n                FT_Offset    len )\r\n  {\r\n    int  n;\r\n\r\n\r\n    for ( n = 0; n < N_AFM_TOKENS; n++ )\r\n    {\r\n      if ( *( afm_key_table[n] ) == *key )\r\n      {\r\n        for ( ; n < N_AFM_TOKENS; n++ )\r\n        {\r\n          if ( *( afm_key_table[n] ) != *key )\r\n            return AFM_TOKEN_UNKNOWN;\r\n\r\n          if ( ft_strncmp( afm_key_table[n], key, len ) == 0 )\r\n            return (AFM_Token) n;\r\n        }\r\n      }\r\n    }\r\n\r\n    return AFM_TOKEN_UNKNOWN;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  afm_parser_init( AFM_Parser  parser,\r\n                   FT_Memory   memory,\r\n                   FT_Byte*    base,\r\n                   FT_Byte*    limit )\r\n  {\r\n    AFM_Stream  stream = NULL;\r\n    FT_Error    error;\r\n\r\n\r\n    if ( FT_NEW( stream ) )\r\n      return error;\r\n\r\n    stream->cursor = stream->base = base;\r\n    stream->limit  = limit;\r\n\r\n    /* don't skip the first line during the first call */\r\n    stream->status = AFM_STREAM_STATUS_EOL;\r\n\r\n    parser->memory    = memory;\r\n    parser->stream    = stream;\r\n    parser->FontInfo  = NULL;\r\n    parser->get_index = NULL;\r\n\r\n    return PSaux_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_LOCAL( void )\r\n  afm_parser_done( AFM_Parser  parser )\r\n  {\r\n    FT_Memory  memory = parser->memory;\r\n\r\n\r\n    FT_FREE( parser->stream );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  afm_parser_read_int( AFM_Parser  parser,\r\n                       FT_Int*     aint )\r\n  {\r\n    AFM_ValueRec  val;\r\n\r\n\r\n    val.type = AFM_VALUE_TYPE_INTEGER;\r\n\r\n    if ( afm_parser_read_vals( parser, &val, 1 ) == 1 )\r\n    {\r\n      *aint = val.u.i;\r\n\r\n      return PSaux_Err_Ok;\r\n    }\r\n    else\r\n      return PSaux_Err_Syntax_Error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  afm_parse_track_kern( AFM_Parser  parser )\r\n  {\r\n    AFM_FontInfo   fi = parser->FontInfo;\r\n    AFM_TrackKern  tk;\r\n    char*          key;\r\n    FT_Offset      len;\r\n    int            n = -1;\r\n\r\n\r\n    if ( afm_parser_read_int( parser, &fi->NumTrackKern ) )\r\n        goto Fail;\r\n\r\n    if ( fi->NumTrackKern )\r\n    {\r\n      FT_Memory  memory = parser->memory;\r\n      FT_Error   error;\r\n\r\n\r\n      if ( FT_QNEW_ARRAY( fi->TrackKerns, fi->NumTrackKern ) )\r\n        return error;\r\n    }\r\n\r\n    while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )\r\n    {\r\n      AFM_ValueRec  shared_vals[5];\r\n\r\n\r\n      switch ( afm_tokenize( key, len ) )\r\n      {\r\n      case AFM_TOKEN_TRACKKERN:\r\n        n++;\r\n\r\n        if ( n >= fi->NumTrackKern )\r\n          goto Fail;\r\n\r\n        tk = fi->TrackKerns + n;\r\n\r\n        shared_vals[0].type = AFM_VALUE_TYPE_INTEGER;\r\n        shared_vals[1].type = AFM_VALUE_TYPE_FIXED;\r\n        shared_vals[2].type = AFM_VALUE_TYPE_FIXED;\r\n        shared_vals[3].type = AFM_VALUE_TYPE_FIXED;\r\n        shared_vals[4].type = AFM_VALUE_TYPE_FIXED;\r\n        if ( afm_parser_read_vals( parser, shared_vals, 5 ) != 5 )\r\n          goto Fail;\r\n\r\n        tk->degree     = shared_vals[0].u.i;\r\n        tk->min_ptsize = shared_vals[1].u.f;\r\n        tk->min_kern   = shared_vals[2].u.f;\r\n        tk->max_ptsize = shared_vals[3].u.f;\r\n        tk->max_kern   = shared_vals[4].u.f;\r\n\r\n        break;\r\n\r\n      case AFM_TOKEN_ENDTRACKKERN:\r\n      case AFM_TOKEN_ENDKERNDATA:\r\n      case AFM_TOKEN_ENDFONTMETRICS:\r\n        fi->NumTrackKern = n + 1;\r\n        return PSaux_Err_Ok;\r\n\r\n      case AFM_TOKEN_UNKNOWN:\r\n        break;\r\n\r\n      default:\r\n        goto Fail;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    return PSaux_Err_Syntax_Error;\r\n  }\r\n\r\n\r\n#undef  KERN_INDEX\r\n#define KERN_INDEX( g1, g2 )  ( ( (FT_ULong)g1 << 16 ) | g2 )\r\n\r\n\r\n  /* compare two kerning pairs */\r\n  FT_CALLBACK_DEF( int )\r\n  afm_compare_kern_pairs( const void*  a,\r\n                          const void*  b )\r\n  {\r\n    AFM_KernPair  kp1 = (AFM_KernPair)a;\r\n    AFM_KernPair  kp2 = (AFM_KernPair)b;\r\n\r\n    FT_ULong  index1 = KERN_INDEX( kp1->index1, kp1->index2 );\r\n    FT_ULong  index2 = KERN_INDEX( kp2->index1, kp2->index2 );\r\n\r\n\r\n    if ( index1 > index2 )\r\n      return 1;\r\n    else if ( index1 < index2 )\r\n      return -1;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  afm_parse_kern_pairs( AFM_Parser  parser )\r\n  {\r\n    AFM_FontInfo  fi = parser->FontInfo;\r\n    AFM_KernPair  kp;\r\n    char*         key;\r\n    FT_Offset     len;\r\n    int           n = -1;\r\n\r\n\r\n    if ( afm_parser_read_int( parser, &fi->NumKernPair ) )\r\n      goto Fail;\r\n\r\n    if ( fi->NumKernPair )\r\n    {\r\n      FT_Memory  memory = parser->memory;\r\n      FT_Error   error;\r\n\r\n\r\n      if ( FT_QNEW_ARRAY( fi->KernPairs, fi->NumKernPair ) )\r\n        return error;\r\n    }\r\n\r\n    while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )\r\n    {\r\n      AFM_Token  token = afm_tokenize( key, len );\r\n\r\n\r\n      switch ( token )\r\n      {\r\n      case AFM_TOKEN_KP:\r\n      case AFM_TOKEN_KPX:\r\n      case AFM_TOKEN_KPY:\r\n        {\r\n          FT_Int        r;\r\n          AFM_ValueRec  shared_vals[4];\r\n\r\n\r\n          n++;\r\n\r\n          if ( n >= fi->NumKernPair )\r\n            goto Fail;\r\n\r\n          kp = fi->KernPairs + n;\r\n\r\n          shared_vals[0].type = AFM_VALUE_TYPE_INDEX;\r\n          shared_vals[1].type = AFM_VALUE_TYPE_INDEX;\r\n          shared_vals[2].type = AFM_VALUE_TYPE_INTEGER;\r\n          shared_vals[3].type = AFM_VALUE_TYPE_INTEGER;\r\n          r = afm_parser_read_vals( parser, shared_vals, 4 );\r\n          if ( r < 3 )\r\n            goto Fail;\r\n\r\n          kp->index1 = shared_vals[0].u.i;\r\n          kp->index2 = shared_vals[1].u.i;\r\n          if ( token == AFM_TOKEN_KPY )\r\n          {\r\n            kp->x = 0;\r\n            kp->y = shared_vals[2].u.i;\r\n          }\r\n          else\r\n          {\r\n            kp->x = shared_vals[2].u.i;\r\n            kp->y = ( token == AFM_TOKEN_KP && r == 4 )\r\n                      ? shared_vals[3].u.i : 0;\r\n          }\r\n        }\r\n        break;\r\n\r\n      case AFM_TOKEN_ENDKERNPAIRS:\r\n      case AFM_TOKEN_ENDKERNDATA:\r\n      case AFM_TOKEN_ENDFONTMETRICS:\r\n        fi->NumKernPair = n + 1;\r\n        ft_qsort( fi->KernPairs, fi->NumKernPair,\r\n                  sizeof ( AFM_KernPairRec ),\r\n                  afm_compare_kern_pairs );\r\n        return PSaux_Err_Ok;\r\n\r\n      case AFM_TOKEN_UNKNOWN:\r\n        break;\r\n\r\n      default:\r\n        goto Fail;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    return PSaux_Err_Syntax_Error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  afm_parse_kern_data( AFM_Parser  parser )\r\n  {\r\n    FT_Error   error;\r\n    char*      key;\r\n    FT_Offset  len;\r\n\r\n\r\n    while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )\r\n    {\r\n      switch ( afm_tokenize( key, len ) )\r\n      {\r\n      case AFM_TOKEN_STARTTRACKKERN:\r\n        error = afm_parse_track_kern( parser );\r\n        if ( error )\r\n          return error;\r\n        break;\r\n\r\n      case AFM_TOKEN_STARTKERNPAIRS:\r\n      case AFM_TOKEN_STARTKERNPAIRS0:\r\n        error = afm_parse_kern_pairs( parser );\r\n        if ( error )\r\n          return error;\r\n        break;\r\n\r\n      case AFM_TOKEN_ENDKERNDATA:\r\n      case AFM_TOKEN_ENDFONTMETRICS:\r\n        return PSaux_Err_Ok;\r\n\r\n      case AFM_TOKEN_UNKNOWN:\r\n        break;\r\n\r\n      default:\r\n        goto Fail;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    return PSaux_Err_Syntax_Error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  afm_parser_skip_section( AFM_Parser  parser,\r\n                           FT_UInt     n,\r\n                           AFM_Token   end_section )\r\n  {\r\n    char*      key;\r\n    FT_Offset  len;\r\n\r\n\r\n    while ( n-- > 0 )\r\n    {\r\n      key = afm_parser_next_key( parser, 1, NULL );\r\n      if ( !key )\r\n        goto Fail;\r\n    }\r\n\r\n    while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )\r\n    {\r\n      AFM_Token  token = afm_tokenize( key, len );\r\n\r\n\r\n      if ( token == end_section || token == AFM_TOKEN_ENDFONTMETRICS )\r\n        return PSaux_Err_Ok;\r\n    }\r\n\r\n  Fail:\r\n    return PSaux_Err_Syntax_Error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  afm_parser_parse( AFM_Parser  parser )\r\n  {\r\n    FT_Memory     memory = parser->memory;\r\n    AFM_FontInfo  fi     = parser->FontInfo;\r\n    FT_Error      error  = PSaux_Err_Syntax_Error;\r\n    char*         key;\r\n    FT_Offset     len;\r\n    FT_Int        metrics_sets = 0;\r\n\r\n\r\n    if ( !fi )\r\n      return PSaux_Err_Invalid_Argument;\r\n\r\n    key = afm_parser_next_key( parser, 1, &len );\r\n    if ( !key || len != 16                              ||\r\n         ft_strncmp( key, \"StartFontMetrics\", 16 ) != 0 )\r\n      return PSaux_Err_Unknown_File_Format;\r\n\r\n    while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )\r\n    {\r\n      AFM_ValueRec  shared_vals[4];\r\n\r\n\r\n      switch ( afm_tokenize( key, len ) )\r\n      {\r\n      case AFM_TOKEN_METRICSSETS:\r\n        if ( afm_parser_read_int( parser, &metrics_sets ) )\r\n          goto Fail;\r\n\r\n        if ( metrics_sets != 0 && metrics_sets != 2 )\r\n        {\r\n          error = PSaux_Err_Unimplemented_Feature;\r\n\r\n          goto Fail;\r\n        }\r\n        break;\r\n\r\n      case AFM_TOKEN_ISCIDFONT:\r\n        shared_vals[0].type = AFM_VALUE_TYPE_BOOL;\r\n        if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )\r\n          goto Fail;\r\n\r\n        fi->IsCIDFont = shared_vals[0].u.b;\r\n        break;\r\n\r\n      case AFM_TOKEN_FONTBBOX:\r\n        shared_vals[0].type = AFM_VALUE_TYPE_FIXED;\r\n        shared_vals[1].type = AFM_VALUE_TYPE_FIXED;\r\n        shared_vals[2].type = AFM_VALUE_TYPE_FIXED;\r\n        shared_vals[3].type = AFM_VALUE_TYPE_FIXED;\r\n        if ( afm_parser_read_vals( parser, shared_vals, 4 ) != 4 )\r\n          goto Fail;\r\n\r\n        fi->FontBBox.xMin = shared_vals[0].u.f;\r\n        fi->FontBBox.yMin = shared_vals[1].u.f;\r\n        fi->FontBBox.xMax = shared_vals[2].u.f;\r\n        fi->FontBBox.yMax = shared_vals[3].u.f;\r\n        break;\r\n\r\n      case AFM_TOKEN_ASCENDER:\r\n        shared_vals[0].type = AFM_VALUE_TYPE_FIXED;\r\n        if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )\r\n          goto Fail;\r\n\r\n        fi->Ascender = shared_vals[0].u.f;\r\n        break;\r\n\r\n      case AFM_TOKEN_DESCENDER:\r\n        shared_vals[0].type = AFM_VALUE_TYPE_FIXED;\r\n        if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )\r\n          goto Fail;\r\n\r\n        fi->Descender = shared_vals[0].u.f;\r\n        break;\r\n\r\n      case AFM_TOKEN_STARTCHARMETRICS:\r\n        {\r\n          FT_Int  n = 0;\r\n\r\n\r\n          if ( afm_parser_read_int( parser, &n ) )\r\n            goto Fail;\r\n\r\n          error = afm_parser_skip_section( parser, n,\r\n                                           AFM_TOKEN_ENDCHARMETRICS );\r\n          if ( error )\r\n            return error;\r\n        }\r\n        break;\r\n\r\n      case AFM_TOKEN_STARTKERNDATA:\r\n        error = afm_parse_kern_data( parser );\r\n        if ( error )\r\n          goto Fail;\r\n        /* fall through since we only support kern data */\r\n\r\n      case AFM_TOKEN_ENDFONTMETRICS:\r\n        return PSaux_Err_Ok;\r\n\r\n      default:\r\n        break;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    FT_FREE( fi->TrackKerns );\r\n    fi->NumTrackKern = 0;\r\n\r\n    FT_FREE( fi->KernPairs );\r\n    fi->NumKernPair = 0;\r\n\r\n    fi->IsCIDFont = 0;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/afmparse.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  afmparse.h                                                             */\r\n/*                                                                         */\r\n/*    AFM parser (specification).                                          */\r\n/*                                                                         */\r\n/*  Copyright 2006 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __AFMPARSE_H__\r\n#define __AFMPARSE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  afm_parser_init( AFM_Parser  parser,\r\n                   FT_Memory   memory,\r\n                   FT_Byte*    base,\r\n                   FT_Byte*    limit );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  afm_parser_done( AFM_Parser  parser );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  afm_parser_parse( AFM_Parser  parser );\r\n\r\n\r\n  enum  AFM_ValueType_\r\n  {\r\n    AFM_VALUE_TYPE_STRING,\r\n    AFM_VALUE_TYPE_NAME,\r\n    AFM_VALUE_TYPE_FIXED,   /* real number */\r\n    AFM_VALUE_TYPE_INTEGER,\r\n    AFM_VALUE_TYPE_BOOL,\r\n    AFM_VALUE_TYPE_INDEX    /* glyph index */\r\n  };\r\n\r\n\r\n  typedef struct  AFM_ValueRec_\r\n  {\r\n    enum AFM_ValueType_  type;\r\n    union\r\n    {\r\n      char*     s;\r\n      FT_Fixed  f;\r\n      FT_Int    i;\r\n      FT_Bool   b;\r\n\r\n    } u;\r\n\r\n  } AFM_ValueRec, *AFM_Value;\r\n\r\n#define  AFM_MAX_ARGUMENTS  5\r\n\r\n  FT_LOCAL( FT_Int )\r\n  afm_parser_read_vals( AFM_Parser  parser,\r\n                        AFM_Value   vals,\r\n                        FT_UInt     n );\r\n\r\n  /* read the next key from the next line or column */\r\n  FT_LOCAL( char* )\r\n  afm_parser_next_key( AFM_Parser  parser,\r\n                       FT_Bool     line,\r\n                       FT_Offset*  len );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AFMPARSE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/module.mk",
    "content": "#\r\n# FreeType 2 PSaux module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += PSAUX_MODULE\r\n\r\ndefine PSAUX_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, psaux_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)psaux     $(ECHO_DRIVER_DESC)Postscript Type 1 & Type 2 helper module$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psaux.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psaux.c                                                                */\r\n/*                                                                         */\r\n/*    FreeType auxiliary PostScript driver component (body only).          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2006 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"psobjs.c\"\r\n#include \"psauxmod.c\"\r\n#include \"t1decode.c\"\r\n#include \"t1cmap.c\"\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n#include \"afmparse.c\"\r\n#endif\r\n\r\n#include \"psconv.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psauxerr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psauxerr.h                                                             */\r\n/*                                                                         */\r\n/*    PS auxiliary module error codes (specification only).                */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the PS auxiliary module error enumeration */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __PSAUXERR_H__\r\n#define __PSAUXERR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  PSaux_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_PSaux\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __PSAUXERR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psauxmod.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psauxmod.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType auxiliary PostScript module implementation (body).          */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003, 2006 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"psauxmod.h\"\r\n#include \"psobjs.h\"\r\n#include \"t1decode.h\"\r\n#include \"t1cmap.h\"\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n#include \"afmparse.h\"\r\n#endif\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const PS_Table_FuncsRec  ps_table_funcs =\r\n  {\r\n    ps_table_new,\r\n    ps_table_done,\r\n    ps_table_add,\r\n    ps_table_release\r\n  };\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const PS_Parser_FuncsRec  ps_parser_funcs =\r\n  {\r\n    ps_parser_init,\r\n    ps_parser_done,\r\n    ps_parser_skip_spaces,\r\n    ps_parser_skip_PS_token,\r\n    ps_parser_to_int,\r\n    ps_parser_to_fixed,\r\n    ps_parser_to_bytes,\r\n    ps_parser_to_coord_array,\r\n    ps_parser_to_fixed_array,\r\n    ps_parser_to_token,\r\n    ps_parser_to_token_array,\r\n    ps_parser_load_field,\r\n    ps_parser_load_field_table\r\n  };\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const T1_Builder_FuncsRec  t1_builder_funcs =\r\n  {\r\n    t1_builder_init,\r\n    t1_builder_done,\r\n    t1_builder_check_points,\r\n    t1_builder_add_point,\r\n    t1_builder_add_point1,\r\n    t1_builder_add_contour,\r\n    t1_builder_start_point,\r\n    t1_builder_close_contour\r\n  };\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const T1_Decoder_FuncsRec  t1_decoder_funcs =\r\n  {\r\n    t1_decoder_init,\r\n    t1_decoder_done,\r\n    t1_decoder_parse_charstrings\r\n  };\r\n\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n  FT_CALLBACK_TABLE_DEF\r\n  const AFM_Parser_FuncsRec  afm_parser_funcs =\r\n  {\r\n    afm_parser_init,\r\n    afm_parser_done,\r\n    afm_parser_parse\r\n  };\r\n#endif\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const T1_CMap_ClassesRec  t1_cmap_classes =\r\n  {\r\n    &t1_cmap_standard_class_rec,\r\n    &t1_cmap_expert_class_rec,\r\n    &t1_cmap_custom_class_rec,\r\n    &t1_cmap_unicode_class_rec\r\n  };\r\n\r\n\r\n  static\r\n  const PSAux_Interface  psaux_interface =\r\n  {\r\n    &ps_table_funcs,\r\n    &ps_parser_funcs,\r\n    &t1_builder_funcs,\r\n    &t1_decoder_funcs,\r\n    t1_decrypt,\r\n\r\n    (const T1_CMap_ClassesRec*) &t1_cmap_classes,\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n    &afm_parser_funcs,\r\n#else\r\n    0,\r\n#endif\r\n  };\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Module_Class  psaux_module_class =\r\n  {\r\n    0,\r\n    sizeof ( FT_ModuleRec ),\r\n    \"psaux\",\r\n    0x20000L,\r\n    0x20000L,\r\n\r\n    &psaux_interface,  /* module-specific interface */\r\n\r\n    (FT_Module_Constructor)0,\r\n    (FT_Module_Destructor) 0,\r\n    (FT_Module_Requester)  0\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psauxmod.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psauxmod.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType auxiliary PostScript module implementation (specification). */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSAUXMOD_H__\r\n#define __PSAUXMOD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Module_Class )  psaux_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSAUXMOD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psconv.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psconv.c                                                               */\r\n/*                                                                         */\r\n/*    Some convenience conversions (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2008, 2009, 2012 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"psconv.h\"\r\n#include \"psauxerr.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_psconv\r\n\r\n\r\n  /* The following array is used by various functions to quickly convert */\r\n  /* digits (both decimal and non-decimal) into numbers.                 */\r\n\r\n#if 'A' == 65\r\n  /* ASCII */\r\n\r\n  static const FT_Char  ft_char_table[128] =\r\n  {\r\n    /* 0x00 */\r\n    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,\r\n    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\r\n    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,\r\n    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\r\n    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,\r\n  };\r\n\r\n  /* no character >= 0x80 can represent a valid number */\r\n#define OP  >=\r\n\r\n#endif /* 'A' == 65 */\r\n\r\n#if 'A' == 193\r\n  /* EBCDIC */\r\n\r\n  static const FT_Char  ft_char_table[128] =\r\n  {\r\n    /* 0x80 */\r\n    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,\r\n    -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,\r\n    -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,\r\n    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,\r\n    -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,\r\n    -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,\r\n     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,\r\n  };\r\n\r\n  /* no character < 0x80 can represent a valid number */\r\n#define OP  <\r\n\r\n#endif /* 'A' == 193 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Long )\r\n  PS_Conv_Strtol( FT_Byte**  cursor,\r\n                  FT_Byte*   limit,\r\n                  FT_Long    base )\r\n  {\r\n    FT_Byte*  p = *cursor;\r\n\r\n    FT_Long   num           = 0;\r\n    FT_Bool   sign          = 0;\r\n    FT_Bool   have_overflow = 0;\r\n\r\n    FT_Long   num_limit;\r\n    FT_Char   c_limit;\r\n\r\n\r\n    if ( p >= limit )\r\n      goto Bad;\r\n\r\n    if ( base < 2 || base > 36 )\r\n    {\r\n      FT_TRACE4(( \"!!!INVALID BASE:!!!\" ));\r\n      return 0;\r\n    }\r\n\r\n    if ( *p == '-' || *p == '+' )\r\n    {\r\n      sign = FT_BOOL( *p == '-' );\r\n\r\n      p++;\r\n      if ( p == limit )\r\n        goto Bad;\r\n    }\r\n\r\n    num_limit = 0x7FFFFFFFL / base;\r\n    c_limit   = (FT_Char)( 0x7FFFFFFFL % base );\r\n\r\n    for ( ; p < limit; p++ )\r\n    {\r\n      FT_Char  c;\r\n\r\n\r\n      if ( IS_PS_SPACE( *p ) || *p OP 0x80 )\r\n        break;\r\n\r\n      c = ft_char_table[*p & 0x7f];\r\n\r\n      if ( c < 0 || c >= base )\r\n        break;\r\n\r\n      if ( num > num_limit || ( num == num_limit && c > c_limit ) )\r\n        have_overflow = 1;\r\n      else\r\n        num = num * base + c;\r\n    }\r\n\r\n    *cursor = p;\r\n\r\n    if ( have_overflow )\r\n    {\r\n      num = 0x7FFFFFFFL;\r\n      FT_TRACE4(( \"!!!OVERFLOW:!!!\" ));\r\n    }\r\n\r\n    if ( sign )\r\n      num = -num;\r\n\r\n    return num;\r\n\r\n  Bad:\r\n    FT_TRACE4(( \"!!!END OF DATA:!!!\" ));\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Long )\r\n  PS_Conv_ToInt( FT_Byte**  cursor,\r\n                 FT_Byte*   limit )\r\n\r\n  {\r\n    FT_Byte*  p = *cursor;\r\n    FT_Byte*  curp;\r\n\r\n    FT_Long   num;\r\n\r\n\r\n    curp = p;\r\n    num  = PS_Conv_Strtol( &p, limit, 10 );\r\n\r\n    if ( p == curp )\r\n      return 0;\r\n\r\n    if ( p < limit && *p == '#' )\r\n    {\r\n      p++;\r\n\r\n      curp = p;\r\n      num  = PS_Conv_Strtol( &p, limit, num );\r\n\r\n      if ( p == curp )\r\n        return 0;\r\n    }\r\n\r\n    *cursor = p;\r\n\r\n    return num;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Fixed )\r\n  PS_Conv_ToFixed( FT_Byte**  cursor,\r\n                   FT_Byte*   limit,\r\n                   FT_Long    power_ten )\r\n  {\r\n    FT_Byte*  p = *cursor;\r\n    FT_Byte*  curp;\r\n\r\n    FT_Fixed  integral = 0;\r\n    FT_Long   decimal  = 0;\r\n    FT_Long   divider  = 1;\r\n\r\n    FT_Bool   sign           = 0;\r\n    FT_Bool   have_overflow  = 0;\r\n    FT_Bool   have_underflow = 0;\r\n\r\n\r\n    if ( p >= limit )\r\n      goto Bad;\r\n\r\n    if ( *p == '-' || *p == '+' )\r\n    {\r\n      sign = FT_BOOL( *p == '-' );\r\n\r\n      p++;\r\n      if ( p == limit )\r\n        goto Bad;\r\n    }\r\n\r\n    /* read the integer part */\r\n    if ( *p != '.' )\r\n    {\r\n      curp     = p;\r\n      integral = PS_Conv_ToInt( &p, limit );\r\n\r\n      if ( p == curp )\r\n        return 0;\r\n\r\n      if ( integral > 0x7FFF )\r\n        have_overflow = 1;\r\n      else\r\n        integral <<= 16;\r\n    }\r\n\r\n    /* read the decimal part */\r\n    if ( p < limit && *p == '.' )\r\n    {\r\n      p++;\r\n\r\n      for ( ; p < limit; p++ )\r\n      {\r\n        FT_Char  c;\r\n\r\n\r\n        if ( IS_PS_SPACE( *p ) || *p OP 0x80 )\r\n          break;\r\n\r\n        c = ft_char_table[*p & 0x7f];\r\n\r\n        if ( c < 0 || c >= 10 )\r\n          break;\r\n\r\n        if ( decimal < 0xCCCCCCCL )\r\n        {\r\n          decimal = decimal * 10 + c;\r\n\r\n          if ( !integral && power_ten > 0 )\r\n            power_ten--;\r\n          else\r\n            divider *= 10;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* read exponent, if any */\r\n    if ( p + 1 < limit && ( *p == 'e' || *p == 'E' ) )\r\n    {\r\n      FT_Long  exponent;\r\n\r\n\r\n      p++;\r\n\r\n      curp     = p;\r\n      exponent = PS_Conv_ToInt( &p, limit );\r\n\r\n      if ( curp == p )\r\n        return 0;\r\n\r\n      /* arbitrarily limit exponent */\r\n      if ( exponent > 1000 )\r\n        have_overflow = 1;\r\n      else if ( exponent < -1000 )\r\n        have_underflow = 1;\r\n      else\r\n        power_ten += exponent;\r\n    }\r\n\r\n    *cursor = p;\r\n\r\n    if ( !integral && !decimal )\r\n      return 0;\r\n\r\n    if ( have_overflow )\r\n      goto Overflow;\r\n    if ( have_underflow )\r\n      goto Underflow;\r\n\r\n    while ( power_ten > 0 )\r\n    {\r\n      if ( integral >= 0xCCCCCCCL )\r\n        goto Overflow;\r\n      integral *= 10;\r\n\r\n      if ( decimal >= 0xCCCCCCCL )\r\n      {\r\n        if ( divider == 1 )\r\n          goto Overflow;\r\n        divider /= 10;\r\n      }\r\n      else\r\n        decimal *= 10;\r\n\r\n      power_ten--;\r\n    }\r\n\r\n    while ( power_ten < 0 )\r\n    {\r\n      integral /= 10;\r\n      if ( divider < 0xCCCCCCCL )\r\n        divider *= 10;\r\n      else\r\n        decimal /= 10;\r\n\r\n      if ( !integral && !decimal )\r\n        goto Underflow;\r\n\r\n      power_ten++;\r\n    }\r\n\r\n    if ( decimal )\r\n    {\r\n      decimal = FT_DivFix( decimal, divider );\r\n      /* it's not necessary to check this addition for overflow */\r\n      /* due to the structure of the real number representation */\r\n      integral += decimal;\r\n    }\r\n\r\n  Exit:\r\n    if ( sign )\r\n      integral = -integral;\r\n\r\n    return integral;\r\n\r\n  Bad:\r\n    FT_TRACE4(( \"!!!END OF DATA:!!!\" ));\r\n    return 0;\r\n\r\n  Overflow:\r\n    integral = 0x7FFFFFFFL;\r\n    FT_TRACE4(( \"!!!OVERFLOW:!!!\" ));\r\n    goto Exit;\r\n\r\n  Underflow:\r\n    FT_TRACE4(( \"!!!UNDERFLOW:!!!\" ));\r\n    return 0;\r\n  }\r\n\r\n\r\n#if 0\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  PS_Conv_StringDecode( FT_Byte**  cursor,\r\n                        FT_Byte*   limit,\r\n                        FT_Byte*   buffer,\r\n                        FT_Offset  n )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_UInt   r = 0;\r\n\r\n\r\n    for ( p = *cursor; r < n && p < limit; p++ )\r\n    {\r\n      FT_Byte  b;\r\n\r\n\r\n      if ( *p != '\\\\' )\r\n      {\r\n        buffer[r++] = *p;\r\n\r\n        continue;\r\n      }\r\n\r\n      p++;\r\n\r\n      switch ( *p )\r\n      {\r\n      case 'n':\r\n        b = '\\n';\r\n        break;\r\n      case 'r':\r\n        b = '\\r';\r\n        break;\r\n      case 't':\r\n        b = '\\t';\r\n        break;\r\n      case 'b':\r\n        b = '\\b';\r\n        break;\r\n      case 'f':\r\n        b = '\\f';\r\n        break;\r\n      case '\\r':\r\n        p++;\r\n        if ( *p != '\\n' )\r\n        {\r\n          b = *p;\r\n\r\n          break;\r\n        }\r\n        /* no break */\r\n      case '\\n':\r\n        continue;\r\n        break;\r\n      default:\r\n        if ( IS_PS_DIGIT( *p ) )\r\n        {\r\n          b = *p - '0';\r\n\r\n          p++;\r\n\r\n          if ( IS_PS_DIGIT( *p ) )\r\n          {\r\n            b = b * 8 + *p - '0';\r\n\r\n            p++;\r\n\r\n            if ( IS_PS_DIGIT( *p ) )\r\n              b = b * 8 + *p - '0';\r\n            else\r\n            {\r\n              buffer[r++] = b;\r\n              b = *p;\r\n            }\r\n          }\r\n          else\r\n          {\r\n            buffer[r++] = b;\r\n            b = *p;\r\n          }\r\n        }\r\n        else\r\n          b = *p;\r\n        break;\r\n      }\r\n\r\n      buffer[r++] = b;\r\n    }\r\n\r\n    *cursor = p;\r\n\r\n    return r;\r\n  }\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  PS_Conv_ASCIIHexDecode( FT_Byte**  cursor,\r\n                          FT_Byte*   limit,\r\n                          FT_Byte*   buffer,\r\n                          FT_Offset  n )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_UInt   r   = 0;\r\n    FT_UInt   w   = 0;\r\n    FT_UInt   pad = 0x01;\r\n\r\n\r\n    n *= 2;\r\n\r\n#if 1\r\n\r\n    p = *cursor;\r\n\r\n    if ( p >= limit )\r\n      return 0;\r\n\r\n    if ( n > (FT_UInt)( limit - p ) )\r\n      n = (FT_UInt)( limit - p );\r\n\r\n    /* we try to process two nibbles at a time to be as fast as possible */\r\n    for ( ; r < n; r++ )\r\n    {\r\n      FT_UInt  c = p[r];\r\n\r\n\r\n      if ( IS_PS_SPACE( c ) )\r\n        continue;\r\n\r\n      if ( c OP 0x80 )\r\n        break;\r\n\r\n      c = ft_char_table[c & 0x7F];\r\n      if ( (unsigned)c >= 16 )\r\n        break;\r\n\r\n      pad = ( pad << 4 ) | c;\r\n      if ( pad & 0x100 )\r\n      {\r\n        buffer[w++] = (FT_Byte)pad;\r\n        pad         = 0x01;\r\n      }\r\n    }\r\n\r\n    if ( pad != 0x01 )\r\n      buffer[w++] = (FT_Byte)( pad << 4 );\r\n\r\n    *cursor = p + r;\r\n\r\n    return w;\r\n\r\n#else /* 0 */\r\n\r\n    for ( r = 0; r < n; r++ )\r\n    {\r\n      FT_Char  c;\r\n\r\n\r\n      if ( IS_PS_SPACE( *p ) )\r\n        continue;\r\n\r\n      if ( *p OP 0x80 )\r\n        break;\r\n\r\n      c = ft_char_table[*p & 0x7f];\r\n\r\n      if ( (unsigned)c >= 16 )\r\n        break;\r\n\r\n      if ( r & 1 )\r\n      {\r\n        *buffer = (FT_Byte)(*buffer + c);\r\n        buffer++;\r\n      }\r\n      else\r\n        *buffer = (FT_Byte)(c << 4);\r\n\r\n      r++;\r\n    }\r\n\r\n    *cursor = p;\r\n\r\n    return ( r + 1 ) / 2;\r\n\r\n#endif /* 0 */\r\n\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  PS_Conv_EexecDecode( FT_Byte**   cursor,\r\n                       FT_Byte*    limit,\r\n                       FT_Byte*    buffer,\r\n                       FT_Offset   n,\r\n                       FT_UShort*  seed )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_UInt   r;\r\n    FT_UInt   s = *seed;\r\n\r\n\r\n#if 1\r\n\r\n    p = *cursor;\r\n\r\n    if ( p >= limit )\r\n      return 0;\r\n\r\n    if ( n > (FT_UInt)(limit - p) )\r\n      n = (FT_UInt)(limit - p);\r\n\r\n    for ( r = 0; r < n; r++ )\r\n    {\r\n      FT_UInt  val = p[r];\r\n      FT_UInt  b   = ( val ^ ( s >> 8 ) );\r\n\r\n\r\n      s         = ( (val + s)*52845U + 22719 ) & 0xFFFFU;\r\n      buffer[r] = (FT_Byte) b;\r\n    }\r\n\r\n    *cursor = p + n;\r\n    *seed   = (FT_UShort)s;\r\n\r\n#else /* 0 */\r\n\r\n    for ( r = 0, p = *cursor; r < n && p < limit; r++, p++ )\r\n    {\r\n      FT_Byte  b = (FT_Byte)( *p ^ ( s >> 8 ) );\r\n\r\n\r\n      s = (FT_UShort)( ( *p + s ) * 52845U + 22719 );\r\n      *buffer++ = b;\r\n    }\r\n    *cursor = p;\r\n    *seed   = s;\r\n\r\n#endif /* 0 */\r\n\r\n    return r;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psconv.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psconv.h                                                               */\r\n/*                                                                         */\r\n/*    Some convenience conversions (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSCONV_H__\r\n#define __PSCONV_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Long )\r\n  PS_Conv_Strtol( FT_Byte**  cursor,\r\n                  FT_Byte*   limit,\r\n                  FT_Long    base );\r\n\r\n\r\n  FT_LOCAL( FT_Long )\r\n  PS_Conv_ToInt( FT_Byte**  cursor,\r\n                 FT_Byte*   limit );\r\n\r\n  FT_LOCAL( FT_Fixed )\r\n  PS_Conv_ToFixed( FT_Byte**  cursor,\r\n                   FT_Byte*   limit,\r\n                   FT_Long    power_ten );\r\n\r\n#if 0\r\n  FT_LOCAL( FT_UInt )\r\n  PS_Conv_StringDecode( FT_Byte**  cursor,\r\n                        FT_Byte*   limit,\r\n                        FT_Byte*   buffer,\r\n                        FT_Offset  n );\r\n#endif\r\n\r\n  FT_LOCAL( FT_UInt )\r\n  PS_Conv_ASCIIHexDecode( FT_Byte**  cursor,\r\n                          FT_Byte*   limit,\r\n                          FT_Byte*   buffer,\r\n                          FT_Offset  n );\r\n\r\n  FT_LOCAL( FT_UInt )\r\n  PS_Conv_EexecDecode( FT_Byte**   cursor,\r\n                       FT_Byte*    limit,\r\n                       FT_Byte*    buffer,\r\n                       FT_Offset   n,\r\n                       FT_UShort*  seed );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSCONV_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psobjs.c                                                               */\r\n/*                                                                         */\r\n/*    Auxiliary functions for PostScript fonts (body).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n\r\n#include \"psobjs.h\"\r\n#include \"psconv.h\"\r\n\r\n#include \"psauxerr.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_psobjs\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                             PS_TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ps_table_new                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a PS_Table.                                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    table  :: The address of the target table.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    count  :: The table size = the maximum number of elements.         */\r\n  /*                                                                       */\r\n  /*    memory :: The memory object to use for all subsequent              */\r\n  /*              reallocations.                                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ps_table_new( PS_Table   table,\r\n                FT_Int     count,\r\n                FT_Memory  memory )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    table->memory = memory;\r\n    if ( FT_NEW_ARRAY( table->elements, count ) ||\r\n         FT_NEW_ARRAY( table->lengths,  count ) )\r\n      goto Exit;\r\n\r\n    table->max_elems = count;\r\n    table->init      = 0xDEADBEEFUL;\r\n    table->num_elems = 0;\r\n    table->block     = 0;\r\n    table->capacity  = 0;\r\n    table->cursor    = 0;\r\n\r\n    *(PS_Table_FuncsRec*)&table->funcs = ps_table_funcs;\r\n\r\n  Exit:\r\n    if ( error )\r\n      FT_FREE( table->elements );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  shift_elements( PS_Table  table,\r\n                  FT_Byte*  old_base )\r\n  {\r\n    FT_PtrDist  delta  = table->block - old_base;\r\n    FT_Byte**   offset = table->elements;\r\n    FT_Byte**   limit  = offset + table->max_elems;\r\n\r\n\r\n    for ( ; offset < limit; offset++ )\r\n    {\r\n      if ( offset[0] )\r\n        offset[0] += delta;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  reallocate_t1_table( PS_Table  table,\r\n                       FT_Long   new_size )\r\n  {\r\n    FT_Memory  memory   = table->memory;\r\n    FT_Byte*   old_base = table->block;\r\n    FT_Error   error;\r\n\r\n\r\n    /* allocate new base block */\r\n    if ( FT_ALLOC( table->block, new_size ) )\r\n    {\r\n      table->block = old_base;\r\n      return error;\r\n    }\r\n\r\n    /* copy elements and shift offsets */\r\n    if ( old_base )\r\n    {\r\n      FT_MEM_COPY( table->block, old_base, table->capacity );\r\n      shift_elements( table, old_base );\r\n      FT_FREE( old_base );\r\n    }\r\n\r\n    table->capacity = new_size;\r\n\r\n    return PSaux_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ps_table_add                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Adds an object to a PS_Table, possibly growing its memory block.   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    table  :: The target table.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    idx    :: The index of the object in the table.                    */\r\n  /*                                                                       */\r\n  /*    object :: The address of the object to copy in memory.             */\r\n  /*                                                                       */\r\n  /*    length :: The length in bytes of the source object.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  An error is returned if a  */\r\n  /*    reallocation fails.                                                */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ps_table_add( PS_Table    table,\r\n                FT_Int      idx,\r\n                void*       object,\r\n                FT_PtrDist  length )\r\n  {\r\n    if ( idx < 0 || idx >= table->max_elems )\r\n    {\r\n      FT_ERROR(( \"ps_table_add: invalid index\\n\" ));\r\n      return PSaux_Err_Invalid_Argument;\r\n    }\r\n\r\n    if ( length < 0 )\r\n    {\r\n      FT_ERROR(( \"ps_table_add: invalid length\\n\" ));\r\n      return PSaux_Err_Invalid_Argument;\r\n    }\r\n\r\n    /* grow the base block if needed */\r\n    if ( table->cursor + length > table->capacity )\r\n    {\r\n      FT_Error    error;\r\n      FT_Offset   new_size = table->capacity;\r\n      FT_PtrDist  in_offset;\r\n\r\n\r\n      in_offset = (FT_Byte*)object - table->block;\r\n      if ( in_offset < 0 || (FT_Offset)in_offset >= table->capacity )\r\n        in_offset = -1;\r\n\r\n      while ( new_size < table->cursor + length )\r\n      {\r\n        /* increase size by 25% and round up to the nearest multiple\r\n           of 1024 */\r\n        new_size += ( new_size >> 2 ) + 1;\r\n        new_size  = FT_PAD_CEIL( new_size, 1024 );\r\n      }\r\n\r\n      error = reallocate_t1_table( table, new_size );\r\n      if ( error )\r\n        return error;\r\n\r\n      if ( in_offset >= 0 )\r\n        object = table->block + in_offset;\r\n    }\r\n\r\n    /* add the object to the base block and adjust offset */\r\n    table->elements[idx] = table->block + table->cursor;\r\n    table->lengths [idx] = length;\r\n    FT_MEM_COPY( table->block + table->cursor, object, length );\r\n\r\n    table->cursor += length;\r\n    return PSaux_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ps_table_done                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalizes a PS_TableRec (i.e., reallocate it to its current        */\r\n  /*    cursor).                                                           */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    table :: The target table.                                         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does NOT release the heap's memory block.  It is up  */\r\n  /*    to the caller to clean it, or reference it in its own structures.  */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  ps_table_done( PS_Table  table )\r\n  {\r\n    FT_Memory  memory = table->memory;\r\n    FT_Error   error;\r\n    FT_Byte*   old_base = table->block;\r\n\r\n\r\n    /* should never fail, because rec.cursor <= rec.size */\r\n    if ( !old_base )\r\n      return;\r\n\r\n    if ( FT_ALLOC( table->block, table->cursor ) )\r\n      return;\r\n    FT_MEM_COPY( table->block, old_base, table->cursor );\r\n    shift_elements( table, old_base );\r\n\r\n    table->capacity = table->cursor;\r\n    FT_FREE( old_base );\r\n\r\n    FT_UNUSED( error );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_table_release( PS_Table  table )\r\n  {\r\n    FT_Memory  memory = table->memory;\r\n\r\n\r\n    if ( (FT_ULong)table->init == 0xDEADBEEFUL )\r\n    {\r\n      FT_FREE( table->block );\r\n      FT_FREE( table->elements );\r\n      FT_FREE( table->lengths );\r\n      table->init = 0;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            T1 PARSER                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* first character must be already part of the comment */\r\n\r\n  static void\r\n  skip_comment( FT_Byte*  *acur,\r\n                FT_Byte*   limit )\r\n  {\r\n    FT_Byte*  cur = *acur;\r\n\r\n\r\n    while ( cur < limit )\r\n    {\r\n      if ( IS_PS_NEWLINE( *cur ) )\r\n        break;\r\n      cur++;\r\n    }\r\n\r\n    *acur = cur;\r\n  }\r\n\r\n\r\n  static void\r\n  skip_spaces( FT_Byte*  *acur,\r\n               FT_Byte*   limit )\r\n  {\r\n    FT_Byte*  cur = *acur;\r\n\r\n\r\n    while ( cur < limit )\r\n    {\r\n      if ( !IS_PS_SPACE( *cur ) )\r\n      {\r\n        if ( *cur == '%' )\r\n          /* According to the PLRM, a comment is equal to a space. */\r\n          skip_comment( &cur, limit );\r\n        else\r\n          break;\r\n      }\r\n      cur++;\r\n    }\r\n\r\n    *acur = cur;\r\n  }\r\n\r\n\r\n#define IS_OCTAL_DIGIT( c ) ( '0' <= (c) && (c) <= '7' )\r\n\r\n\r\n  /* first character must be `(';                               */\r\n  /* *acur is positioned at the character after the closing `)' */\r\n\r\n  static FT_Error\r\n  skip_literal_string( FT_Byte*  *acur,\r\n                       FT_Byte*   limit )\r\n  {\r\n    FT_Byte*      cur   = *acur;\r\n    FT_Int        embed = 0;\r\n    FT_Error      error = PSaux_Err_Invalid_File_Format;\r\n    unsigned int  i;\r\n\r\n\r\n    while ( cur < limit )\r\n    {\r\n      FT_Byte  c = *cur;\r\n\r\n\r\n      ++cur;\r\n\r\n      if ( c == '\\\\' )\r\n      {\r\n        /* Red Book 3rd ed., section `Literal Text Strings', p. 29:     */\r\n        /* A backslash can introduce three different types              */\r\n        /* of escape sequences:                                         */\r\n        /*   - a special escaped char like \\r, \\n, etc.                 */\r\n        /*   - a one-, two-, or three-digit octal number                */\r\n        /*   - none of the above in which case the backslash is ignored */\r\n\r\n        if ( cur == limit )\r\n          /* error (or to be ignored?) */\r\n          break;\r\n\r\n        switch ( *cur )\r\n        {\r\n          /* skip `special' escape */\r\n        case 'n':\r\n        case 'r':\r\n        case 't':\r\n        case 'b':\r\n        case 'f':\r\n        case '\\\\':\r\n        case '(':\r\n        case ')':\r\n          ++cur;\r\n          break;\r\n\r\n        default:\r\n          /* skip octal escape or ignore backslash */\r\n          for ( i = 0; i < 3 && cur < limit; ++i )\r\n          {\r\n            if ( !IS_OCTAL_DIGIT( *cur ) )\r\n              break;\r\n\r\n            ++cur;\r\n          }\r\n        }\r\n      }\r\n      else if ( c == '(' )\r\n        embed++;\r\n      else if ( c == ')' )\r\n      {\r\n        embed--;\r\n        if ( embed == 0 )\r\n        {\r\n          error = PSaux_Err_Ok;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n    *acur = cur;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* first character must be `<' */\r\n\r\n  static FT_Error\r\n  skip_string( FT_Byte*  *acur,\r\n               FT_Byte*   limit )\r\n  {\r\n    FT_Byte*  cur = *acur;\r\n    FT_Error  err =  PSaux_Err_Ok;\r\n\r\n\r\n    while ( ++cur < limit )\r\n    {\r\n      /* All whitespace characters are ignored. */\r\n      skip_spaces( &cur, limit );\r\n      if ( cur >= limit )\r\n        break;\r\n\r\n      if ( !IS_PS_XDIGIT( *cur ) )\r\n        break;\r\n    }\r\n\r\n    if ( cur < limit && *cur != '>' )\r\n    {\r\n      FT_ERROR(( \"skip_string: missing closing delimiter `>'\\n\" ));\r\n      err = PSaux_Err_Invalid_File_Format;\r\n    }\r\n    else\r\n      cur++;\r\n\r\n    *acur = cur;\r\n    return err;\r\n  }\r\n\r\n\r\n  /* first character must be the opening brace that */\r\n  /* starts the procedure                           */\r\n\r\n  /* NB: [ and ] need not match:                    */\r\n  /* `/foo {[} def' is a valid PostScript fragment, */\r\n  /* even within a Type1 font                       */\r\n\r\n  static FT_Error\r\n  skip_procedure( FT_Byte*  *acur,\r\n                  FT_Byte*   limit )\r\n  {\r\n    FT_Byte*  cur;\r\n    FT_Int    embed = 0;\r\n    FT_Error  error = PSaux_Err_Ok;\r\n\r\n\r\n    FT_ASSERT( **acur == '{' );\r\n\r\n    for ( cur = *acur; cur < limit && error == PSaux_Err_Ok; ++cur )\r\n    {\r\n      switch ( *cur )\r\n      {\r\n      case '{':\r\n        ++embed;\r\n        break;\r\n\r\n      case '}':\r\n        --embed;\r\n        if ( embed == 0 )\r\n        {\r\n          ++cur;\r\n          goto end;\r\n        }\r\n        break;\r\n\r\n      case '(':\r\n        error = skip_literal_string( &cur, limit );\r\n        break;\r\n\r\n      case '<':\r\n        error = skip_string( &cur, limit );\r\n        break;\r\n\r\n      case '%':\r\n        skip_comment( &cur, limit );\r\n        break;\r\n      }\r\n    }\r\n\r\n  end:\r\n    if ( embed != 0 )\r\n      error = PSaux_Err_Invalid_File_Format;\r\n\r\n    *acur = cur;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /***********************************************************************/\r\n  /*                                                                     */\r\n  /* All exported parsing routines handle leading whitespace and stop at */\r\n  /* the first character which isn't part of the just handled token.     */\r\n  /*                                                                     */\r\n  /***********************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_parser_skip_PS_token( PS_Parser  parser )\r\n  {\r\n    /* Note: PostScript allows any non-delimiting, non-whitespace        */\r\n    /*       character in a name (PS Ref Manual, 3rd ed, p31).           */\r\n    /*       PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */\r\n\r\n    FT_Byte*  cur   = parser->cursor;\r\n    FT_Byte*  limit = parser->limit;\r\n    FT_Error  error = PSaux_Err_Ok;\r\n\r\n\r\n    skip_spaces( &cur, limit );             /* this also skips comments */\r\n    if ( cur >= limit )\r\n      goto Exit;\r\n\r\n    /* self-delimiting, single-character tokens */\r\n    if ( *cur == '[' || *cur == ']' )\r\n    {\r\n      cur++;\r\n      goto Exit;\r\n    }\r\n\r\n    /* skip balanced expressions (procedures and strings) */\r\n\r\n    if ( *cur == '{' )                              /* {...} */\r\n    {\r\n      error = skip_procedure( &cur, limit );\r\n      goto Exit;\r\n    }\r\n\r\n    if ( *cur == '(' )                              /* (...) */\r\n    {\r\n      error = skip_literal_string( &cur, limit );\r\n      goto Exit;\r\n    }\r\n\r\n    if ( *cur == '<' )                              /* <...> */\r\n    {\r\n      if ( cur + 1 < limit && *(cur + 1) == '<' )   /* << */\r\n      {\r\n        cur++;\r\n        cur++;\r\n      }\r\n      else\r\n        error = skip_string( &cur, limit );\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    if ( *cur == '>' )\r\n    {\r\n      cur++;\r\n      if ( cur >= limit || *cur != '>' )             /* >> */\r\n      {\r\n        FT_ERROR(( \"ps_parser_skip_PS_token:\"\r\n                   \" unexpected closing delimiter `>'\\n\" ));\r\n        error = PSaux_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n      cur++;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( *cur == '/' )\r\n      cur++;\r\n\r\n    /* anything else */\r\n    while ( cur < limit )\r\n    {\r\n      /* *cur might be invalid (e.g., ')' or '}'), but this   */\r\n      /* is handled by the test `cur == parser->cursor' below */\r\n      if ( IS_PS_DELIM( *cur ) )\r\n        break;\r\n\r\n      cur++;\r\n    }\r\n\r\n  Exit:\r\n    if ( cur < limit && cur == parser->cursor )\r\n    {\r\n      FT_ERROR(( \"ps_parser_skip_PS_token:\"\r\n                 \" current token is `%c' which is self-delimiting\\n\"\r\n                 \"                        \"\r\n                 \" but invalid at this point\\n\",\r\n                 *cur ));\r\n\r\n      error = PSaux_Err_Invalid_File_Format;\r\n    }\r\n\r\n    parser->error  = error;\r\n    parser->cursor = cur;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_parser_skip_spaces( PS_Parser  parser )\r\n  {\r\n    skip_spaces( &parser->cursor, parser->limit );\r\n  }\r\n\r\n\r\n  /* `token' here means either something between balanced delimiters */\r\n  /* or the next token; the delimiters are not removed.              */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_parser_to_token( PS_Parser  parser,\r\n                      T1_Token   token )\r\n  {\r\n    FT_Byte*  cur;\r\n    FT_Byte*  limit;\r\n    FT_Int    embed;\r\n\r\n\r\n    token->type  = T1_TOKEN_TYPE_NONE;\r\n    token->start = 0;\r\n    token->limit = 0;\r\n\r\n    /* first of all, skip leading whitespace */\r\n    ps_parser_skip_spaces( parser );\r\n\r\n    cur   = parser->cursor;\r\n    limit = parser->limit;\r\n\r\n    if ( cur >= limit )\r\n      return;\r\n\r\n    switch ( *cur )\r\n    {\r\n      /************* check for literal string *****************/\r\n    case '(':\r\n      token->type  = T1_TOKEN_TYPE_STRING;\r\n      token->start = cur;\r\n\r\n      if ( skip_literal_string( &cur, limit ) == PSaux_Err_Ok )\r\n        token->limit = cur;\r\n      break;\r\n\r\n      /************* check for programs/array *****************/\r\n    case '{':\r\n      token->type  = T1_TOKEN_TYPE_ARRAY;\r\n      token->start = cur;\r\n\r\n      if ( skip_procedure( &cur, limit ) == PSaux_Err_Ok )\r\n        token->limit = cur;\r\n      break;\r\n\r\n      /************* check for table/array ********************/\r\n      /* XXX: in theory we should also look for \"<<\"          */\r\n      /*      since this is semantically equivalent to \"[\";   */\r\n      /*      in practice it doesn't matter (?)               */\r\n    case '[':\r\n      token->type  = T1_TOKEN_TYPE_ARRAY;\r\n      embed        = 1;\r\n      token->start = cur++;\r\n\r\n      /* we need this to catch `[ ]' */\r\n      parser->cursor = cur;\r\n      ps_parser_skip_spaces( parser );\r\n      cur = parser->cursor;\r\n\r\n      while ( cur < limit && !parser->error )\r\n      {\r\n        /* XXX: this is wrong because it does not      */\r\n        /*      skip comments, procedures, and strings */\r\n        if ( *cur == '[' )\r\n          embed++;\r\n        else if ( *cur == ']' )\r\n        {\r\n          embed--;\r\n          if ( embed <= 0 )\r\n          {\r\n            token->limit = ++cur;\r\n            break;\r\n          }\r\n        }\r\n\r\n        parser->cursor = cur;\r\n        ps_parser_skip_PS_token( parser );\r\n        /* we need this to catch `[XXX ]' */\r\n        ps_parser_skip_spaces  ( parser );\r\n        cur = parser->cursor;\r\n      }\r\n      break;\r\n\r\n      /* ************ otherwise, it is any token **************/\r\n    default:\r\n      token->start = cur;\r\n      token->type  = ( *cur == '/' ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY );\r\n      ps_parser_skip_PS_token( parser );\r\n      cur = parser->cursor;\r\n      if ( !parser->error )\r\n        token->limit = cur;\r\n    }\r\n\r\n    if ( !token->limit )\r\n    {\r\n      token->start = 0;\r\n      token->type  = T1_TOKEN_TYPE_NONE;\r\n    }\r\n\r\n    parser->cursor = cur;\r\n  }\r\n\r\n\r\n  /* NB: `tokens' can be NULL if we only want to count */\r\n  /* the number of array elements                      */\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_parser_to_token_array( PS_Parser  parser,\r\n                            T1_Token   tokens,\r\n                            FT_UInt    max_tokens,\r\n                            FT_Int*    pnum_tokens )\r\n  {\r\n    T1_TokenRec  master;\r\n\r\n\r\n    *pnum_tokens = -1;\r\n\r\n    /* this also handles leading whitespace */\r\n    ps_parser_to_token( parser, &master );\r\n\r\n    if ( master.type == T1_TOKEN_TYPE_ARRAY )\r\n    {\r\n      FT_Byte*  old_cursor = parser->cursor;\r\n      FT_Byte*  old_limit  = parser->limit;\r\n      T1_Token  cur        = tokens;\r\n      T1_Token  limit      = cur + max_tokens;\r\n\r\n\r\n      /* don't include outermost delimiters */\r\n      parser->cursor = master.start + 1;\r\n      parser->limit  = master.limit - 1;\r\n\r\n      while ( parser->cursor < parser->limit )\r\n      {\r\n        T1_TokenRec  token;\r\n\r\n\r\n        ps_parser_to_token( parser, &token );\r\n        if ( !token.type )\r\n          break;\r\n\r\n        if ( tokens != NULL && cur < limit )\r\n          *cur = token;\r\n\r\n        cur++;\r\n      }\r\n\r\n      *pnum_tokens = (FT_Int)( cur - tokens );\r\n\r\n      parser->cursor = old_cursor;\r\n      parser->limit  = old_limit;\r\n    }\r\n  }\r\n\r\n\r\n  /* first character must be a delimiter or a part of a number */\r\n  /* NB: `coords' can be NULL if we just want to skip the      */\r\n  /*     array; in this case we ignore `max_coords'            */\r\n\r\n  static FT_Int\r\n  ps_tocoordarray( FT_Byte*  *acur,\r\n                   FT_Byte*   limit,\r\n                   FT_Int     max_coords,\r\n                   FT_Short*  coords )\r\n  {\r\n    FT_Byte*  cur   = *acur;\r\n    FT_Int    count = 0;\r\n    FT_Byte   c, ender;\r\n\r\n\r\n    if ( cur >= limit )\r\n      goto Exit;\r\n\r\n    /* check for the beginning of an array; otherwise, only one number */\r\n    /* will be read                                                    */\r\n    c     = *cur;\r\n    ender = 0;\r\n\r\n    if ( c == '[' )\r\n      ender = ']';\r\n    else if ( c == '{' )\r\n      ender = '}';\r\n\r\n    if ( ender )\r\n      cur++;\r\n\r\n    /* now, read the coordinates */\r\n    while ( cur < limit )\r\n    {\r\n      FT_Short  dummy;\r\n      FT_Byte*  old_cur;\r\n\r\n\r\n      /* skip whitespace in front of data */\r\n      skip_spaces( &cur, limit );\r\n      if ( cur >= limit )\r\n        goto Exit;\r\n\r\n      if ( *cur == ender )\r\n      {\r\n        cur++;\r\n        break;\r\n      }\r\n\r\n      old_cur = cur;\r\n\r\n      if ( coords != NULL && count >= max_coords )\r\n        break;\r\n\r\n      /* call PS_Conv_ToFixed() even if coords == NULL */\r\n      /* to properly parse number at `cur'             */\r\n      *( coords != NULL ? &coords[count] : &dummy ) =\r\n        (FT_Short)( PS_Conv_ToFixed( &cur, limit, 0 ) >> 16 );\r\n\r\n      if ( old_cur == cur )\r\n      {\r\n        count = -1;\r\n        goto Exit;\r\n      }\r\n      else\r\n        count++;\r\n\r\n      if ( !ender )\r\n        break;\r\n    }\r\n\r\n  Exit:\r\n    *acur = cur;\r\n    return count;\r\n  }\r\n\r\n\r\n  /* first character must be a delimiter or a part of a number */\r\n  /* NB: `values' can be NULL if we just want to skip the      */\r\n  /*     array; in this case we ignore `max_values'            */\r\n\r\n  static FT_Int\r\n  ps_tofixedarray( FT_Byte*  *acur,\r\n                   FT_Byte*   limit,\r\n                   FT_Int     max_values,\r\n                   FT_Fixed*  values,\r\n                   FT_Int     power_ten )\r\n  {\r\n    FT_Byte*  cur   = *acur;\r\n    FT_Int    count = 0;\r\n    FT_Byte   c, ender;\r\n\r\n\r\n    if ( cur >= limit )\r\n      goto Exit;\r\n\r\n    /* Check for the beginning of an array.  Otherwise, only one number */\r\n    /* will be read.                                                    */\r\n    c     = *cur;\r\n    ender = 0;\r\n\r\n    if ( c == '[' )\r\n      ender = ']';\r\n    else if ( c == '{' )\r\n      ender = '}';\r\n\r\n    if ( ender )\r\n      cur++;\r\n\r\n    /* now, read the values */\r\n    while ( cur < limit )\r\n    {\r\n      FT_Fixed  dummy;\r\n      FT_Byte*  old_cur;\r\n\r\n\r\n      /* skip whitespace in front of data */\r\n      skip_spaces( &cur, limit );\r\n      if ( cur >= limit )\r\n        goto Exit;\r\n\r\n      if ( *cur == ender )\r\n      {\r\n        cur++;\r\n        break;\r\n      }\r\n\r\n      old_cur = cur;\r\n\r\n      if ( values != NULL && count >= max_values )\r\n        break;\r\n\r\n      /* call PS_Conv_ToFixed() even if coords == NULL */\r\n      /* to properly parse number at `cur'             */\r\n      *( values != NULL ? &values[count] : &dummy ) =\r\n        PS_Conv_ToFixed( &cur, limit, power_ten );\r\n\r\n      if ( old_cur == cur )\r\n      {\r\n        count = -1;\r\n        goto Exit;\r\n      }\r\n      else\r\n        count++;\r\n\r\n      if ( !ender )\r\n        break;\r\n    }\r\n\r\n  Exit:\r\n    *acur = cur;\r\n    return count;\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  static FT_String*\r\n  ps_tostring( FT_Byte**  cursor,\r\n               FT_Byte*   limit,\r\n               FT_Memory  memory )\r\n  {\r\n    FT_Byte*    cur = *cursor;\r\n    FT_PtrDist  len = 0;\r\n    FT_Int      count;\r\n    FT_String*  result;\r\n    FT_Error    error;\r\n\r\n\r\n    /* XXX: some stupid fonts have a `Notice' or `Copyright' string     */\r\n    /*      that simply doesn't begin with an opening parenthesis, even */\r\n    /*      though they have a closing one!  E.g. \"amuncial.pfb\"        */\r\n    /*                                                                  */\r\n    /*      We must deal with these ill-fated cases there.  Note that   */\r\n    /*      these fonts didn't work with the old Type 1 driver as the   */\r\n    /*      notice/copyright was not recognized as a valid string token */\r\n    /*      and made the old token parser commit errors.                */\r\n\r\n    while ( cur < limit && ( *cur == ' ' || *cur == '\\t' ) )\r\n      cur++;\r\n    if ( cur + 1 >= limit )\r\n      return 0;\r\n\r\n    if ( *cur == '(' )\r\n      cur++;  /* skip the opening parenthesis, if there is one */\r\n\r\n    *cursor = cur;\r\n    count   = 0;\r\n\r\n    /* then, count its length */\r\n    for ( ; cur < limit; cur++ )\r\n    {\r\n      if ( *cur == '(' )\r\n        count++;\r\n\r\n      else if ( *cur == ')' )\r\n      {\r\n        count--;\r\n        if ( count < 0 )\r\n          break;\r\n      }\r\n    }\r\n\r\n    len = cur - *cursor;\r\n    if ( cur >= limit || FT_ALLOC( result, len + 1 ) )\r\n      return 0;\r\n\r\n    /* now copy the string */\r\n    FT_MEM_COPY( result, *cursor, len );\r\n    result[len] = '\\0';\r\n    *cursor = cur;\r\n    return result;\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  static int\r\n  ps_tobool( FT_Byte*  *acur,\r\n             FT_Byte*   limit )\r\n  {\r\n    FT_Byte*  cur    = *acur;\r\n    FT_Bool   result = 0;\r\n\r\n\r\n    /* return 1 if we find `true', 0 otherwise */\r\n    if ( cur + 3 < limit &&\r\n         cur[0] == 't'   &&\r\n         cur[1] == 'r'   &&\r\n         cur[2] == 'u'   &&\r\n         cur[3] == 'e'   )\r\n    {\r\n      result = 1;\r\n      cur   += 5;\r\n    }\r\n    else if ( cur + 4 < limit &&\r\n              cur[0] == 'f'   &&\r\n              cur[1] == 'a'   &&\r\n              cur[2] == 'l'   &&\r\n              cur[3] == 's'   &&\r\n              cur[4] == 'e'   )\r\n    {\r\n      result = 0;\r\n      cur   += 6;\r\n    }\r\n\r\n    *acur = cur;\r\n    return result;\r\n  }\r\n\r\n\r\n  /* load a simple field (i.e. non-table) into the current list of objects */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ps_parser_load_field( PS_Parser       parser,\r\n                        const T1_Field  field,\r\n                        void**          objects,\r\n                        FT_UInt         max_objects,\r\n                        FT_ULong*       pflags )\r\n  {\r\n    T1_TokenRec  token;\r\n    FT_Byte*     cur;\r\n    FT_Byte*     limit;\r\n    FT_UInt      count;\r\n    FT_UInt      idx;\r\n    FT_Error     error;\r\n\r\n\r\n    /* this also skips leading whitespace */\r\n    ps_parser_to_token( parser, &token );\r\n    if ( !token.type )\r\n      goto Fail;\r\n\r\n    count = 1;\r\n    idx   = 0;\r\n    cur   = token.start;\r\n    limit = token.limit;\r\n\r\n    /* we must detect arrays in /FontBBox */\r\n    if ( field->type == T1_FIELD_TYPE_BBOX )\r\n    {\r\n      T1_TokenRec  token2;\r\n      FT_Byte*     old_cur   = parser->cursor;\r\n      FT_Byte*     old_limit = parser->limit;\r\n\r\n\r\n      /* don't include delimiters */\r\n      parser->cursor = token.start + 1;\r\n      parser->limit  = token.limit - 1;\r\n\r\n      ps_parser_to_token( parser, &token2 );\r\n      parser->cursor = old_cur;\r\n      parser->limit  = old_limit;\r\n\r\n      if ( token2.type == T1_TOKEN_TYPE_ARRAY )\r\n        goto FieldArray;\r\n    }\r\n    else if ( token.type == T1_TOKEN_TYPE_ARRAY )\r\n    {\r\n    FieldArray:\r\n      /* if this is an array and we have no blend, an error occurs */\r\n      if ( max_objects == 0 )\r\n        goto Fail;\r\n\r\n      count = max_objects;\r\n      idx   = 1;\r\n\r\n      /* don't include delimiters */\r\n      cur++;\r\n      limit--;\r\n    }\r\n\r\n    for ( ; count > 0; count--, idx++ )\r\n    {\r\n      FT_Byte*    q = (FT_Byte*)objects[idx] + field->offset;\r\n      FT_Long     val;\r\n      FT_String*  string;\r\n\r\n\r\n      skip_spaces( &cur, limit );\r\n\r\n      switch ( field->type )\r\n      {\r\n      case T1_FIELD_TYPE_BOOL:\r\n        val = ps_tobool( &cur, limit );\r\n        goto Store_Integer;\r\n\r\n      case T1_FIELD_TYPE_FIXED:\r\n        val = PS_Conv_ToFixed( &cur, limit, 0 );\r\n        goto Store_Integer;\r\n\r\n      case T1_FIELD_TYPE_FIXED_1000:\r\n        val = PS_Conv_ToFixed( &cur, limit, 3 );\r\n        goto Store_Integer;\r\n\r\n      case T1_FIELD_TYPE_INTEGER:\r\n        val = PS_Conv_ToInt( &cur, limit );\r\n        /* fall through */\r\n\r\n      Store_Integer:\r\n        switch ( field->size )\r\n        {\r\n        case (8 / FT_CHAR_BIT):\r\n          *(FT_Byte*)q = (FT_Byte)val;\r\n          break;\r\n\r\n        case (16 / FT_CHAR_BIT):\r\n          *(FT_UShort*)q = (FT_UShort)val;\r\n          break;\r\n\r\n        case (32 / FT_CHAR_BIT):\r\n          *(FT_UInt32*)q = (FT_UInt32)val;\r\n          break;\r\n\r\n        default:                /* for 64-bit systems */\r\n          *(FT_Long*)q = val;\r\n        }\r\n        break;\r\n\r\n      case T1_FIELD_TYPE_STRING:\r\n      case T1_FIELD_TYPE_KEY:\r\n        {\r\n          FT_Memory  memory = parser->memory;\r\n          FT_UInt    len    = (FT_UInt)( limit - cur );\r\n\r\n\r\n          if ( cur >= limit )\r\n            break;\r\n\r\n          /* we allow both a string or a name   */\r\n          /* for cases like /FontName (foo) def */\r\n          if ( token.type == T1_TOKEN_TYPE_KEY )\r\n          {\r\n            /* don't include leading `/' */\r\n            len--;\r\n            cur++;\r\n          }\r\n          else if ( token.type == T1_TOKEN_TYPE_STRING )\r\n          {\r\n            /* don't include delimiting parentheses    */\r\n            /* XXX we don't handle <<...>> here        */\r\n            /* XXX should we convert octal escapes?    */\r\n            /*     if so, what encoding should we use? */\r\n            cur++;\r\n            len -= 2;\r\n          }\r\n          else\r\n          {\r\n            FT_ERROR(( \"ps_parser_load_field:\"\r\n                       \" expected a name or string\\n\"\r\n                       \"                     \"\r\n                       \" but found token of type %d instead\\n\",\r\n                       token.type ));\r\n            error = PSaux_Err_Invalid_File_Format;\r\n            goto Exit;\r\n          }\r\n\r\n          /* for this to work (FT_String**)q must have been */\r\n          /* initialized to NULL                            */\r\n          if ( *(FT_String**)q != NULL )\r\n          {\r\n            FT_TRACE0(( \"ps_parser_load_field: overwriting field %s\\n\",\r\n                        field->ident ));\r\n            FT_FREE( *(FT_String**)q );\r\n            *(FT_String**)q = NULL;\r\n          }\r\n\r\n          if ( FT_ALLOC( string, len + 1 ) )\r\n            goto Exit;\r\n\r\n          FT_MEM_COPY( string, cur, len );\r\n          string[len] = 0;\r\n\r\n          *(FT_String**)q = string;\r\n        }\r\n        break;\r\n\r\n      case T1_FIELD_TYPE_BBOX:\r\n        {\r\n          FT_Fixed  temp[4];\r\n          FT_BBox*  bbox = (FT_BBox*)q;\r\n          FT_Int    result;\r\n\r\n\r\n          result = ps_tofixedarray( &cur, limit, 4, temp, 0 );\r\n\r\n          if ( result < 0 )\r\n          {\r\n            FT_ERROR(( \"ps_parser_load_field:\"\r\n                       \" expected four integers in bounding box\\n\" ));\r\n            error = PSaux_Err_Invalid_File_Format;\r\n            goto Exit;\r\n          }\r\n\r\n          bbox->xMin = FT_RoundFix( temp[0] );\r\n          bbox->yMin = FT_RoundFix( temp[1] );\r\n          bbox->xMax = FT_RoundFix( temp[2] );\r\n          bbox->yMax = FT_RoundFix( temp[3] );\r\n        }\r\n        break;\r\n\r\n      default:\r\n        /* an error occurred */\r\n        goto Fail;\r\n      }\r\n    }\r\n\r\n#if 0  /* obsolete -- keep for reference */\r\n    if ( pflags )\r\n      *pflags |= 1L << field->flag_bit;\r\n#else\r\n    FT_UNUSED( pflags );\r\n#endif\r\n\r\n    error = PSaux_Err_Ok;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    error = PSaux_Err_Invalid_File_Format;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n#define T1_MAX_TABLE_ELEMENTS  32\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ps_parser_load_field_table( PS_Parser       parser,\r\n                              const T1_Field  field,\r\n                              void**          objects,\r\n                              FT_UInt         max_objects,\r\n                              FT_ULong*       pflags )\r\n  {\r\n    T1_TokenRec  elements[T1_MAX_TABLE_ELEMENTS];\r\n    T1_Token     token;\r\n    FT_Int       num_elements;\r\n    FT_Error     error = PSaux_Err_Ok;\r\n    FT_Byte*     old_cursor;\r\n    FT_Byte*     old_limit;\r\n    T1_FieldRec  fieldrec = *(T1_Field)field;\r\n\r\n\r\n    fieldrec.type = T1_FIELD_TYPE_INTEGER;\r\n    if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY ||\r\n         field->type == T1_FIELD_TYPE_BBOX        )\r\n      fieldrec.type = T1_FIELD_TYPE_FIXED;\r\n\r\n    ps_parser_to_token_array( parser, elements,\r\n                              T1_MAX_TABLE_ELEMENTS, &num_elements );\r\n    if ( num_elements < 0 )\r\n    {\r\n      error = PSaux_Err_Ignore;\r\n      goto Exit;\r\n    }\r\n    if ( (FT_UInt)num_elements > field->array_max )\r\n      num_elements = field->array_max;\r\n\r\n    old_cursor = parser->cursor;\r\n    old_limit  = parser->limit;\r\n\r\n    /* we store the elements count if necessary;           */\r\n    /* we further assume that `count_offset' can't be zero */\r\n    if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )\r\n      *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =\r\n        (FT_Byte)num_elements;\r\n\r\n    /* we now load each element, adjusting the field.offset on each one */\r\n    token = elements;\r\n    for ( ; num_elements > 0; num_elements--, token++ )\r\n    {\r\n      parser->cursor = token->start;\r\n      parser->limit  = token->limit;\r\n      ps_parser_load_field( parser, &fieldrec, objects, max_objects, 0 );\r\n      fieldrec.offset += fieldrec.size;\r\n    }\r\n\r\n#if 0  /* obsolete -- keep for reference */\r\n    if ( pflags )\r\n      *pflags |= 1L << field->flag_bit;\r\n#else\r\n    FT_UNUSED( pflags );\r\n#endif\r\n\r\n    parser->cursor = old_cursor;\r\n    parser->limit  = old_limit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Long )\r\n  ps_parser_to_int( PS_Parser  parser )\r\n  {\r\n    ps_parser_skip_spaces( parser );\r\n    return PS_Conv_ToInt( &parser->cursor, parser->limit );\r\n  }\r\n\r\n\r\n  /* first character must be `<' if `delimiters' is non-zero */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  ps_parser_to_bytes( PS_Parser  parser,\r\n                      FT_Byte*   bytes,\r\n                      FT_Offset  max_bytes,\r\n                      FT_Long*   pnum_bytes,\r\n                      FT_Bool    delimiters )\r\n  {\r\n    FT_Error  error = PSaux_Err_Ok;\r\n    FT_Byte*  cur;\r\n\r\n\r\n    ps_parser_skip_spaces( parser );\r\n    cur = parser->cursor;\r\n\r\n    if ( cur >= parser->limit )\r\n      goto Exit;\r\n\r\n    if ( delimiters )\r\n    {\r\n      if ( *cur != '<' )\r\n      {\r\n        FT_ERROR(( \"ps_parser_to_bytes: Missing starting delimiter `<'\\n\" ));\r\n        error = PSaux_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      cur++;\r\n    }\r\n\r\n    *pnum_bytes = PS_Conv_ASCIIHexDecode( &cur,\r\n                                          parser->limit,\r\n                                          bytes,\r\n                                          max_bytes );\r\n\r\n    if ( delimiters )\r\n    {\r\n      if ( cur < parser->limit && *cur != '>' )\r\n      {\r\n        FT_ERROR(( \"ps_parser_to_bytes: Missing closing delimiter `>'\\n\" ));\r\n        error = PSaux_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      cur++;\r\n    }\r\n\r\n    parser->cursor = cur;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Fixed )\r\n  ps_parser_to_fixed( PS_Parser  parser,\r\n                      FT_Int     power_ten )\r\n  {\r\n    ps_parser_skip_spaces( parser );\r\n    return PS_Conv_ToFixed( &parser->cursor, parser->limit, power_ten );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  ps_parser_to_coord_array( PS_Parser  parser,\r\n                            FT_Int     max_coords,\r\n                            FT_Short*  coords )\r\n  {\r\n    ps_parser_skip_spaces( parser );\r\n    return ps_tocoordarray( &parser->cursor, parser->limit,\r\n                            max_coords, coords );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  ps_parser_to_fixed_array( PS_Parser  parser,\r\n                            FT_Int     max_values,\r\n                            FT_Fixed*  values,\r\n                            FT_Int     power_ten )\r\n  {\r\n    ps_parser_skip_spaces( parser );\r\n    return ps_tofixedarray( &parser->cursor, parser->limit,\r\n                            max_values, values, power_ten );\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  FT_LOCAL_DEF( FT_String* )\r\n  T1_ToString( PS_Parser  parser )\r\n  {\r\n    return ps_tostring( &parser->cursor, parser->limit, parser->memory );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  T1_ToBool( PS_Parser  parser )\r\n  {\r\n    return ps_tobool( &parser->cursor, parser->limit );\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_parser_init( PS_Parser  parser,\r\n                  FT_Byte*   base,\r\n                  FT_Byte*   limit,\r\n                  FT_Memory  memory )\r\n  {\r\n    parser->error  = PSaux_Err_Ok;\r\n    parser->base   = base;\r\n    parser->limit  = limit;\r\n    parser->cursor = base;\r\n    parser->memory = memory;\r\n    parser->funcs  = ps_parser_funcs;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  ps_parser_done( PS_Parser  parser )\r\n  {\r\n    FT_UNUSED( parser );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            T1 BUILDER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    t1_builder_init                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given glyph builder.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    builder :: A pointer to the glyph builder to initialize.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: The current face object.                                */\r\n  /*                                                                       */\r\n  /*    size    :: The current size object.                                */\r\n  /*                                                                       */\r\n  /*    glyph   :: The current glyph object.                               */\r\n  /*                                                                       */\r\n  /*    hinting :: Whether hinting should be applied.                      */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  t1_builder_init( T1_Builder    builder,\r\n                   FT_Face       face,\r\n                   FT_Size       size,\r\n                   FT_GlyphSlot  glyph,\r\n                   FT_Bool       hinting )\r\n  {\r\n    builder->parse_state = T1_Parse_Start;\r\n    builder->load_points = 1;\r\n\r\n    builder->face   = face;\r\n    builder->glyph  = glyph;\r\n    builder->memory = face->memory;\r\n\r\n    if ( glyph )\r\n    {\r\n      FT_GlyphLoader  loader = glyph->internal->loader;\r\n\r\n\r\n      builder->loader  = loader;\r\n      builder->base    = &loader->base.outline;\r\n      builder->current = &loader->current.outline;\r\n      FT_GlyphLoader_Rewind( loader );\r\n\r\n      builder->hints_globals = size->internal;\r\n      builder->hints_funcs   = 0;\r\n\r\n      if ( hinting )\r\n        builder->hints_funcs = glyph->internal->glyph_hints;\r\n    }\r\n\r\n    builder->pos_x = 0;\r\n    builder->pos_y = 0;\r\n\r\n    builder->left_bearing.x = 0;\r\n    builder->left_bearing.y = 0;\r\n    builder->advance.x      = 0;\r\n    builder->advance.y      = 0;\r\n\r\n    builder->funcs = t1_builder_funcs;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    t1_builder_done                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalizes a given glyph builder.  Its contents can still be used   */\r\n  /*    after the call, but the function saves important information       */\r\n  /*    within the corresponding glyph slot.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    builder :: A pointer to the glyph builder to finalize.             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  t1_builder_done( T1_Builder  builder )\r\n  {\r\n    FT_GlyphSlot  glyph = builder->glyph;\r\n\r\n\r\n    if ( glyph )\r\n      glyph->outline = *builder->base;\r\n  }\r\n\r\n\r\n  /* check that there is enough space for `count' more points */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_builder_check_points( T1_Builder  builder,\r\n                           FT_Int      count )\r\n  {\r\n    return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );\r\n  }\r\n\r\n\r\n  /* add a new point, do not check space */\r\n  FT_LOCAL_DEF( void )\r\n  t1_builder_add_point( T1_Builder  builder,\r\n                        FT_Pos      x,\r\n                        FT_Pos      y,\r\n                        FT_Byte     flag )\r\n  {\r\n    FT_Outline*  outline = builder->current;\r\n\r\n\r\n    if ( builder->load_points )\r\n    {\r\n      FT_Vector*  point   = outline->points + outline->n_points;\r\n      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;\r\n\r\n\r\n      point->x = FIXED_TO_INT( x );\r\n      point->y = FIXED_TO_INT( y );\r\n      *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );\r\n    }\r\n    outline->n_points++;\r\n  }\r\n\r\n\r\n  /* check space for a new on-curve point, then add it */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_builder_add_point1( T1_Builder  builder,\r\n                         FT_Pos      x,\r\n                         FT_Pos      y )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = t1_builder_check_points( builder, 1 );\r\n    if ( !error )\r\n      t1_builder_add_point( builder, x, y, 1 );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* check space for a new contour, then add it */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_builder_add_contour( T1_Builder  builder )\r\n  {\r\n    FT_Outline*  outline = builder->current;\r\n    FT_Error     error;\r\n\r\n\r\n    /* this might happen in invalid fonts */\r\n    if ( !outline )\r\n    {\r\n      FT_ERROR(( \"t1_builder_add_contour: no outline to add points to\\n\" ));\r\n      return PSaux_Err_Invalid_File_Format;\r\n    }\r\n\r\n    if ( !builder->load_points )\r\n    {\r\n      outline->n_contours++;\r\n      return PSaux_Err_Ok;\r\n    }\r\n\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );\r\n    if ( !error )\r\n    {\r\n      if ( outline->n_contours > 0 )\r\n        outline->contours[outline->n_contours - 1] =\r\n          (short)( outline->n_points - 1 );\r\n\r\n      outline->n_contours++;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* if a path was begun, add its first on-curve point */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_builder_start_point( T1_Builder  builder,\r\n                          FT_Pos      x,\r\n                          FT_Pos      y )\r\n  {\r\n    FT_Error  error = PSaux_Err_Invalid_File_Format;\r\n\r\n\r\n    /* test whether we are building a new contour */\r\n\r\n    if ( builder->parse_state == T1_Parse_Have_Path )\r\n      error = PSaux_Err_Ok;\r\n    else\r\n    {\r\n      builder->parse_state = T1_Parse_Have_Path;\r\n      error = t1_builder_add_contour( builder );\r\n      if ( !error )\r\n        error = t1_builder_add_point1( builder, x, y );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* close the current contour */\r\n  FT_LOCAL_DEF( void )\r\n  t1_builder_close_contour( T1_Builder  builder )\r\n  {\r\n    FT_Outline*  outline = builder->current;\r\n    FT_Int       first;\r\n\r\n\r\n    if ( !outline )\r\n      return;\r\n\r\n    first = outline->n_contours <= 1\r\n            ? 0 : outline->contours[outline->n_contours - 2] + 1;\r\n\r\n    /* We must not include the last point in the path if it */\r\n    /* is located on the first point.                       */\r\n    if ( outline->n_points > 1 )\r\n    {\r\n      FT_Vector*  p1      = outline->points + first;\r\n      FT_Vector*  p2      = outline->points + outline->n_points - 1;\r\n      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;\r\n\r\n\r\n      /* `delete' last point only if it coincides with the first */\r\n      /* point and it is not a control point (which can happen). */\r\n      if ( p1->x == p2->x && p1->y == p2->y )\r\n        if ( *control == FT_CURVE_TAG_ON )\r\n          outline->n_points--;\r\n    }\r\n\r\n    if ( outline->n_contours > 0 )\r\n    {\r\n      /* Don't add contours only consisting of one point, i.e.,  */\r\n      /* check whether the first and the last point is the same. */\r\n      if ( first == outline->n_points - 1 )\r\n      {\r\n        outline->n_contours--;\r\n        outline->n_points--;\r\n      }\r\n      else\r\n        outline->contours[outline->n_contours - 1] =\r\n          (short)( outline->n_points - 1 );\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            OTHER                              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  t1_decrypt( FT_Byte*   buffer,\r\n              FT_Offset  length,\r\n              FT_UShort  seed )\r\n  {\r\n    PS_Conv_EexecDecode( &buffer,\r\n                         buffer + length,\r\n                         buffer,\r\n                         length,\r\n                         &seed );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/psobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psobjs.h                                                               */\r\n/*                                                                         */\r\n/*    Auxiliary functions for PostScript fonts (specification).            */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSOBJS_H__\r\n#define __PSOBJS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                             T1_TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_CALLBACK_TABLE\r\n  const PS_Table_FuncsRec    ps_table_funcs;\r\n\r\n  FT_CALLBACK_TABLE\r\n  const PS_Parser_FuncsRec   ps_parser_funcs;\r\n\r\n  FT_CALLBACK_TABLE\r\n  const T1_Builder_FuncsRec  t1_builder_funcs;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ps_table_new( PS_Table   table,\r\n                FT_Int     count,\r\n                FT_Memory  memory );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ps_table_add( PS_Table    table,\r\n                FT_Int      idx,\r\n                void*       object,\r\n                FT_PtrDist  length );\r\n\r\n  FT_LOCAL( void )\r\n  ps_table_done( PS_Table  table );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ps_table_release( PS_Table  table );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            T1 PARSER                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ps_parser_skip_spaces( PS_Parser  parser );\r\n\r\n  FT_LOCAL( void )\r\n  ps_parser_skip_PS_token( PS_Parser  parser );\r\n\r\n  FT_LOCAL( void )\r\n  ps_parser_to_token( PS_Parser  parser,\r\n                      T1_Token   token );\r\n\r\n  FT_LOCAL( void )\r\n  ps_parser_to_token_array( PS_Parser  parser,\r\n                            T1_Token   tokens,\r\n                            FT_UInt    max_tokens,\r\n                            FT_Int*    pnum_tokens );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ps_parser_load_field( PS_Parser       parser,\r\n                        const T1_Field  field,\r\n                        void**          objects,\r\n                        FT_UInt         max_objects,\r\n                        FT_ULong*       pflags );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ps_parser_load_field_table( PS_Parser       parser,\r\n                              const T1_Field  field,\r\n                              void**          objects,\r\n                              FT_UInt         max_objects,\r\n                              FT_ULong*       pflags );\r\n\r\n  FT_LOCAL( FT_Long )\r\n  ps_parser_to_int( PS_Parser  parser );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ps_parser_to_bytes( PS_Parser  parser,\r\n                      FT_Byte*   bytes,\r\n                      FT_Offset  max_bytes,\r\n                      FT_Long*   pnum_bytes,\r\n                      FT_Bool    delimiters );\r\n\r\n\r\n  FT_LOCAL( FT_Fixed )\r\n  ps_parser_to_fixed( PS_Parser  parser,\r\n                      FT_Int     power_ten );\r\n\r\n\r\n  FT_LOCAL( FT_Int )\r\n  ps_parser_to_coord_array( PS_Parser  parser,\r\n                            FT_Int     max_coords,\r\n                            FT_Short*  coords );\r\n\r\n  FT_LOCAL( FT_Int )\r\n  ps_parser_to_fixed_array( PS_Parser  parser,\r\n                            FT_Int     max_values,\r\n                            FT_Fixed*  values,\r\n                            FT_Int     power_ten );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  ps_parser_init( PS_Parser  parser,\r\n                  FT_Byte*   base,\r\n                  FT_Byte*   limit,\r\n                  FT_Memory  memory );\r\n\r\n  FT_LOCAL( void )\r\n  ps_parser_done( PS_Parser  parser );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            T1 BUILDER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  t1_builder_init( T1_Builder    builder,\r\n                   FT_Face       face,\r\n                   FT_Size       size,\r\n                   FT_GlyphSlot  glyph,\r\n                   FT_Bool       hinting );\r\n\r\n  FT_LOCAL( void )\r\n  t1_builder_done( T1_Builder  builder );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_builder_check_points( T1_Builder  builder,\r\n                           FT_Int      count );\r\n\r\n  FT_LOCAL( void )\r\n  t1_builder_add_point( T1_Builder  builder,\r\n                        FT_Pos      x,\r\n                        FT_Pos      y,\r\n                        FT_Byte     flag );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_builder_add_point1( T1_Builder  builder,\r\n                         FT_Pos      x,\r\n                         FT_Pos      y );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_builder_add_contour( T1_Builder  builder );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_builder_start_point( T1_Builder  builder,\r\n                          FT_Pos      x,\r\n                          FT_Pos      y );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  t1_builder_close_contour( T1_Builder  builder );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            OTHER                              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL( void )\r\n  t1_decrypt( FT_Byte*   buffer,\r\n              FT_Offset  length,\r\n              FT_UShort  seed );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSOBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/rules.mk",
    "content": "#\r\n# FreeType 2 PSaux driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2002, 2003, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# PSAUX driver directory\r\n#\r\nPSAUX_DIR := $(SRC_DIR)/psaux\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nPSAUX_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSAUX_DIR))\r\n\r\n\r\n# PSAUX driver sources (i.e., C files)\r\n#\r\nPSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c   \\\r\n                 $(PSAUX_DIR)/t1decode.c \\\r\n                 $(PSAUX_DIR)/t1cmap.c   \\\r\n                 $(PSAUX_DIR)/afmparse.c \\\r\n                 $(PSAUX_DIR)/psconv.c   \\\r\n                 $(PSAUX_DIR)/psauxmod.c\r\n\r\n# PSAUX driver headers\r\n#\r\nPSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h)  \\\r\n               $(PSAUX_DIR)/psauxerr.h\r\n\r\n\r\n# PSAUX driver object(s)\r\n#\r\n#   PSAUX_DRV_OBJ_M is used during `multi' builds.\r\n#   PSAUX_DRV_OBJ_S is used during `single' builds.\r\n#\r\nPSAUX_DRV_OBJ_M := $(PSAUX_DRV_SRC:$(PSAUX_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nPSAUX_DRV_OBJ_S := $(OBJ_DIR)/psaux.$O\r\n\r\n# PSAUX driver source file for single build\r\n#\r\nPSAUX_DRV_SRC_S := $(PSAUX_DIR)/psaux.c\r\n\r\n\r\n# PSAUX driver - single object\r\n#\r\n$(PSAUX_DRV_OBJ_S): $(PSAUX_DRV_SRC_S) $(PSAUX_DRV_SRC) \\\r\n                   $(FREETYPE_H) $(PSAUX_DRV_H)\r\n\t$(PSAUX_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PSAUX_DRV_SRC_S))\r\n\r\n\r\n# PSAUX driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(PSAUX_DIR)/%.c $(FREETYPE_H) $(PSAUX_DRV_H)\r\n\t$(PSAUX_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(PSAUX_DRV_OBJ_S)\r\nDRV_OBJS_M += $(PSAUX_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/t1cmap.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1cmap.c                                                               */\r\n/*                                                                         */\r\n/*    Type 1 character map support (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006, 2007, 2012 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"t1cmap.h\"\r\n\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"psauxerr.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****          TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  t1_cmap_std_init( T1_CMapStd  cmap,\r\n                    FT_Int      is_expert )\r\n  {\r\n    T1_Face             face    = (T1_Face)FT_CMAP_FACE( cmap );\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;\r\n\r\n\r\n    cmap->num_glyphs    = face->type1.num_glyphs;\r\n    cmap->glyph_names   = (const char* const*)face->type1.glyph_names;\r\n    cmap->sid_to_string = psnames->adobe_std_strings;\r\n    cmap->code_to_sid   = is_expert ? psnames->adobe_expert_encoding\r\n                                    : psnames->adobe_std_encoding;\r\n\r\n    FT_ASSERT( cmap->code_to_sid != NULL );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  t1_cmap_std_done( T1_CMapStd  cmap )\r\n  {\r\n    cmap->num_glyphs    = 0;\r\n    cmap->glyph_names   = NULL;\r\n    cmap->sid_to_string = NULL;\r\n    cmap->code_to_sid   = NULL;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  t1_cmap_std_char_index( T1_CMapStd  cmap,\r\n                          FT_UInt32   char_code )\r\n  {\r\n    FT_UInt  result = 0;\r\n\r\n\r\n    if ( char_code < 256 )\r\n    {\r\n      FT_UInt      code, n;\r\n      const char*  glyph_name;\r\n\r\n\r\n      /* convert character code to Adobe SID string */\r\n      code       = cmap->code_to_sid[char_code];\r\n      glyph_name = cmap->sid_to_string( code );\r\n\r\n      /* look for the corresponding glyph name */\r\n      for ( n = 0; n < cmap->num_glyphs; n++ )\r\n      {\r\n        const char* gname = cmap->glyph_names[n];\r\n\r\n\r\n        if ( gname && gname[0] == glyph_name[0]  &&\r\n             ft_strcmp( gname, glyph_name ) == 0 )\r\n        {\r\n          result = n;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  t1_cmap_std_char_next( T1_CMapStd   cmap,\r\n                         FT_UInt32   *pchar_code )\r\n  {\r\n    FT_UInt    result    = 0;\r\n    FT_UInt32  char_code = *pchar_code + 1;\r\n\r\n\r\n    while ( char_code < 256 )\r\n    {\r\n      result = t1_cmap_std_char_index( cmap, char_code );\r\n      if ( result != 0 )\r\n        goto Exit;\r\n\r\n      char_code++;\r\n    }\r\n    char_code = 0;\r\n\r\n  Exit:\r\n    *pchar_code = char_code;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  t1_cmap_standard_init( T1_CMapStd  cmap )\r\n  {\r\n    t1_cmap_std_init( cmap, 0 );\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec\r\n  t1_cmap_standard_class_rec =\r\n  {\r\n    sizeof ( T1_CMapStdRec ),\r\n\r\n    (FT_CMap_InitFunc)     t1_cmap_standard_init,\r\n    (FT_CMap_DoneFunc)     t1_cmap_std_done,\r\n    (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,\r\n    (FT_CMap_CharNextFunc) t1_cmap_std_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  t1_cmap_expert_init( T1_CMapStd  cmap )\r\n  {\r\n    t1_cmap_std_init( cmap, 1 );\r\n    return 0;\r\n  }\r\n\r\n  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec\r\n  t1_cmap_expert_class_rec =\r\n  {\r\n    sizeof ( T1_CMapStdRec ),\r\n\r\n    (FT_CMap_InitFunc)     t1_cmap_expert_init,\r\n    (FT_CMap_DoneFunc)     t1_cmap_std_done,\r\n    (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,\r\n    (FT_CMap_CharNextFunc) t1_cmap_std_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    TYPE1 CUSTOM ENCODING CMAP                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  t1_cmap_custom_init( T1_CMapCustom  cmap )\r\n  {\r\n    T1_Face      face     = (T1_Face)FT_CMAP_FACE( cmap );\r\n    T1_Encoding  encoding = &face->type1.encoding;\r\n\r\n\r\n    cmap->first   = encoding->code_first;\r\n    cmap->count   = (FT_UInt)( encoding->code_last - cmap->first );\r\n    cmap->indices = encoding->char_index;\r\n\r\n    FT_ASSERT( cmap->indices != NULL );\r\n    FT_ASSERT( encoding->code_first <= encoding->code_last );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  t1_cmap_custom_done( T1_CMapCustom  cmap )\r\n  {\r\n    cmap->indices = NULL;\r\n    cmap->first   = 0;\r\n    cmap->count   = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  t1_cmap_custom_char_index( T1_CMapCustom  cmap,\r\n                             FT_UInt32      char_code )\r\n  {\r\n    FT_UInt    result = 0;\r\n\r\n\r\n    if ( ( char_code >= cmap->first )                  &&\r\n         ( char_code < ( cmap->first + cmap->count ) ) )\r\n      result = cmap->indices[char_code];\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  t1_cmap_custom_char_next( T1_CMapCustom  cmap,\r\n                            FT_UInt32     *pchar_code )\r\n  {\r\n    FT_UInt    result = 0;\r\n    FT_UInt32  char_code = *pchar_code;\r\n\r\n\r\n    ++char_code;\r\n\r\n    if ( char_code < cmap->first )\r\n      char_code = cmap->first;\r\n\r\n    for ( ; char_code < ( cmap->first + cmap->count ); char_code++ )\r\n    {\r\n      result = cmap->indices[char_code];\r\n      if ( result != 0 )\r\n        goto Exit;\r\n    }\r\n\r\n    char_code = 0;\r\n\r\n  Exit:\r\n    *pchar_code = char_code;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec\r\n  t1_cmap_custom_class_rec =\r\n  {\r\n    sizeof ( T1_CMapCustomRec ),\r\n\r\n    (FT_CMap_InitFunc)     t1_cmap_custom_init,\r\n    (FT_CMap_DoneFunc)     t1_cmap_custom_done,\r\n    (FT_CMap_CharIndexFunc)t1_cmap_custom_char_index,\r\n    (FT_CMap_CharNextFunc) t1_cmap_custom_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****            TYPE1 SYNTHETIC UNICODE ENCODING CMAP              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_CALLBACK_DEF( const char * )\r\n  psaux_get_glyph_name( T1_Face  face,\r\n                        FT_UInt  idx )\r\n  {\r\n    return face->type1.glyph_names[idx];\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  t1_cmap_unicode_init( PS_Unicodes  unicodes )\r\n  {\r\n    T1_Face             face    = (T1_Face)FT_CMAP_FACE( unicodes );\r\n    FT_Memory           memory  = FT_FACE_MEMORY( face );\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;\r\n\r\n\r\n    return psnames->unicodes_init( memory,\r\n                                   unicodes,\r\n                                   face->type1.num_glyphs,\r\n                                   (PS_GetGlyphNameFunc)&psaux_get_glyph_name,\r\n                                   (PS_FreeGlyphNameFunc)NULL,\r\n                                   (FT_Pointer)face );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  t1_cmap_unicode_done( PS_Unicodes  unicodes )\r\n  {\r\n    FT_Face    face   = FT_CMAP_FACE( unicodes );\r\n    FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n\r\n    FT_FREE( unicodes->maps );\r\n    unicodes->num_maps = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  t1_cmap_unicode_char_index( PS_Unicodes  unicodes,\r\n                              FT_UInt32    char_code )\r\n  {\r\n    T1_Face             face    = (T1_Face)FT_CMAP_FACE( unicodes );\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;\r\n\r\n\r\n    return psnames->unicodes_char_index( unicodes, char_code );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  t1_cmap_unicode_char_next( PS_Unicodes  unicodes,\r\n                             FT_UInt32   *pchar_code )\r\n  {\r\n    T1_Face             face    = (T1_Face)FT_CMAP_FACE( unicodes );\r\n    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;\r\n\r\n\r\n    return psnames->unicodes_char_next( unicodes, pchar_code );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec\r\n  t1_cmap_unicode_class_rec =\r\n  {\r\n    sizeof ( PS_UnicodesRec ),\r\n\r\n    (FT_CMap_InitFunc)     t1_cmap_unicode_init,\r\n    (FT_CMap_DoneFunc)     t1_cmap_unicode_done,\r\n    (FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index,\r\n    (FT_CMap_CharNextFunc) t1_cmap_unicode_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/t1cmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1cmap.h                                                               */\r\n/*                                                                         */\r\n/*    Type 1 character map support (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1CMAP_H__\r\n#define __T1CMAP_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****          TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* standard (and expert) encoding cmaps */\r\n  typedef struct T1_CMapStdRec_*  T1_CMapStd;\r\n\r\n  typedef struct  T1_CMapStdRec_\r\n  {\r\n    FT_CMapRec                cmap;\r\n\r\n    const FT_UShort*          code_to_sid;\r\n    PS_Adobe_Std_StringsFunc  sid_to_string;\r\n\r\n    FT_UInt                   num_glyphs;\r\n    const char* const*        glyph_names;\r\n\r\n  } T1_CMapStdRec;\r\n\r\n\r\n  FT_CALLBACK_TABLE const FT_CMap_ClassRec\r\n  t1_cmap_standard_class_rec;\r\n\r\n  FT_CALLBACK_TABLE const FT_CMap_ClassRec\r\n  t1_cmap_expert_class_rec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  TYPE1 CUSTOM ENCODING CMAP                   *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct T1_CMapCustomRec_*  T1_CMapCustom;\r\n\r\n  typedef struct  T1_CMapCustomRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_UInt     first;\r\n    FT_UInt     count;\r\n    FT_UShort*  indices;\r\n\r\n  } T1_CMapCustomRec;\r\n\r\n\r\n  FT_CALLBACK_TABLE const FT_CMap_ClassRec\r\n  t1_cmap_custom_class_rec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****             TYPE1 SYNTHETIC UNICODE ENCODING CMAP             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* unicode (synthetic) cmaps */\r\n\r\n  FT_CALLBACK_TABLE const FT_CMap_ClassRec\r\n  t1_cmap_unicode_class_rec;\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1CMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/t1decode.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1decode.c                                                             */\r\n/*                                                                         */\r\n/*    PostScript Type 1 decoding routines (body).                          */\r\n/*                                                                         */\r\n/*  Copyright 2000-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n#include FT_OUTLINE_H\r\n\r\n#include \"t1decode.h\"\r\n#include \"psobjs.h\"\r\n\r\n#include \"psauxerr.h\"\r\n\r\n/* ensure proper sign extension */\r\n#define Fix2Int( f )  ( (FT_Int)(FT_Short)( (f) >> 16 ) )\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1decode\r\n\r\n\r\n  typedef enum  T1_Operator_\r\n  {\r\n    op_none = 0,\r\n    op_endchar,\r\n    op_hsbw,\r\n    op_seac,\r\n    op_sbw,\r\n    op_closepath,\r\n    op_hlineto,\r\n    op_hmoveto,\r\n    op_hvcurveto,\r\n    op_rlineto,\r\n    op_rmoveto,\r\n    op_rrcurveto,\r\n    op_vhcurveto,\r\n    op_vlineto,\r\n    op_vmoveto,\r\n    op_dotsection,\r\n    op_hstem,\r\n    op_hstem3,\r\n    op_vstem,\r\n    op_vstem3,\r\n    op_div,\r\n    op_callothersubr,\r\n    op_callsubr,\r\n    op_pop,\r\n    op_return,\r\n    op_setcurrentpoint,\r\n    op_unknown15,\r\n\r\n    op_max    /* never remove this one */\r\n\r\n  } T1_Operator;\r\n\r\n\r\n  static\r\n  const FT_Int  t1_args_count[op_max] =\r\n  {\r\n    0, /* none */\r\n    0, /* endchar */\r\n    2, /* hsbw */\r\n    5, /* seac */\r\n    4, /* sbw */\r\n    0, /* closepath */\r\n    1, /* hlineto */\r\n    1, /* hmoveto */\r\n    4, /* hvcurveto */\r\n    2, /* rlineto */\r\n    2, /* rmoveto */\r\n    6, /* rrcurveto */\r\n    4, /* vhcurveto */\r\n    1, /* vlineto */\r\n    1, /* vmoveto */\r\n    0, /* dotsection */\r\n    2, /* hstem */\r\n    6, /* hstem3 */\r\n    2, /* vstem */\r\n    6, /* vstem3 */\r\n    2, /* div */\r\n   -1, /* callothersubr */\r\n    1, /* callsubr */\r\n    0, /* pop */\r\n    0, /* return */\r\n    2, /* setcurrentpoint */\r\n    2  /* opcode 15 (undocumented and obsolete) */\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    t1_lookup_glyph_by_stdcharcode                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Looks up a given glyph by its StandardEncoding charcode.  Used to  */\r\n  /*    implement the SEAC Type 1 operator.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: The current face object.                               */\r\n  /*                                                                       */\r\n  /*    charcode :: The character code to look for.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A glyph index in the font face.  Returns -1 if the corresponding   */\r\n  /*    glyph wasn't found.                                                */\r\n  /*                                                                       */\r\n  static FT_Int\r\n  t1_lookup_glyph_by_stdcharcode( T1_Decoder  decoder,\r\n                                  FT_Int      charcode )\r\n  {\r\n    FT_UInt             n;\r\n    const FT_String*    glyph_name;\r\n    FT_Service_PsCMaps  psnames = decoder->psnames;\r\n\r\n\r\n    /* check range of standard char code */\r\n    if ( charcode < 0 || charcode > 255 )\r\n      return -1;\r\n\r\n    glyph_name = psnames->adobe_std_strings(\r\n                   psnames->adobe_std_encoding[charcode]);\r\n\r\n    for ( n = 0; n < decoder->num_glyphs; n++ )\r\n    {\r\n      FT_String*  name = (FT_String*)decoder->glyph_names[n];\r\n\r\n\r\n      if ( name                               &&\r\n           name[0] == glyph_name[0]           &&\r\n           ft_strcmp( name, glyph_name ) == 0 )\r\n        return n;\r\n    }\r\n\r\n    return -1;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    t1operator_seac                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Implements the `seac' Type 1 operator for a Type 1 decoder.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    decoder :: The current CID decoder.                                */\r\n  /*                                                                       */\r\n  /*    asb     :: The accent's side bearing.                              */\r\n  /*                                                                       */\r\n  /*    adx     :: The horizontal offset of the accent.                    */\r\n  /*                                                                       */\r\n  /*    ady     :: The vertical offset of the accent.                      */\r\n  /*                                                                       */\r\n  /*    bchar   :: The base character's StandardEncoding charcode.         */\r\n  /*                                                                       */\r\n  /*    achar   :: The accent character's StandardEncoding charcode.       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  t1operator_seac( T1_Decoder  decoder,\r\n                   FT_Pos      asb,\r\n                   FT_Pos      adx,\r\n                   FT_Pos      ady,\r\n                   FT_Int      bchar,\r\n                   FT_Int      achar )\r\n  {\r\n    FT_Error     error;\r\n    FT_Int       bchar_index, achar_index;\r\n#if 0\r\n    FT_Int       n_base_points;\r\n    FT_Outline*  base = decoder->builder.base;\r\n#endif\r\n    FT_Vector    left_bearing, advance;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    T1_Face      face  = (T1_Face)decoder->builder.face;\r\n#endif\r\n\r\n\r\n    if ( decoder->seac )\r\n    {\r\n      FT_ERROR(( \"t1operator_seac: invalid nested seac\\n\" ));\r\n      return PSaux_Err_Syntax_Error;\r\n    }\r\n\r\n    if ( decoder->builder.metrics_only )\r\n    {\r\n      FT_ERROR(( \"t1operator_seac: unexpected seac\\n\" ));\r\n      return PSaux_Err_Syntax_Error;\r\n    }\r\n\r\n    /* seac weirdness */\r\n    adx += decoder->builder.left_bearing.x;\r\n\r\n    /* `glyph_names' is set to 0 for CID fonts which do not */\r\n    /* include an encoding.  How can we deal with these?    */\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    if ( decoder->glyph_names == 0                   &&\r\n         !face->root.internal->incremental_interface )\r\n#else\r\n    if ( decoder->glyph_names == 0 )\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n    {\r\n      FT_ERROR(( \"t1operator_seac:\"\r\n                 \" glyph names table not available in this font\\n\" ));\r\n      return PSaux_Err_Syntax_Error;\r\n    }\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    if ( face->root.internal->incremental_interface )\r\n    {\r\n      /* the caller must handle the font encoding also */\r\n      bchar_index = bchar;\r\n      achar_index = achar;\r\n    }\r\n    else\r\n#endif\r\n    {\r\n      bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );\r\n      achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );\r\n    }\r\n\r\n    if ( bchar_index < 0 || achar_index < 0 )\r\n    {\r\n      FT_ERROR(( \"t1operator_seac:\"\r\n                 \" invalid seac character code arguments\\n\" ));\r\n      return PSaux_Err_Syntax_Error;\r\n    }\r\n\r\n    /* if we are trying to load a composite glyph, do not load the */\r\n    /* accent character and return the array of subglyphs.         */\r\n    if ( decoder->builder.no_recurse )\r\n    {\r\n      FT_GlyphSlot    glyph  = (FT_GlyphSlot)decoder->builder.glyph;\r\n      FT_GlyphLoader  loader = glyph->internal->loader;\r\n      FT_SubGlyph     subg;\r\n\r\n\r\n      /* reallocate subglyph array if necessary */\r\n      error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      subg = loader->current.subglyphs;\r\n\r\n      /* subglyph 0 = base character */\r\n      subg->index = bchar_index;\r\n      subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |\r\n                    FT_SUBGLYPH_FLAG_USE_MY_METRICS;\r\n      subg->arg1  = 0;\r\n      subg->arg2  = 0;\r\n      subg++;\r\n\r\n      /* subglyph 1 = accent character */\r\n      subg->index = achar_index;\r\n      subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;\r\n      subg->arg1  = (FT_Int)FIXED_TO_INT( adx - asb );\r\n      subg->arg2  = (FT_Int)FIXED_TO_INT( ady );\r\n\r\n      /* set up remaining glyph fields */\r\n      glyph->num_subglyphs = 2;\r\n      glyph->subglyphs     = loader->base.subglyphs;\r\n      glyph->format        = FT_GLYPH_FORMAT_COMPOSITE;\r\n\r\n      loader->current.num_subglyphs = 2;\r\n      goto Exit;\r\n    }\r\n\r\n    /* First load `bchar' in builder */\r\n    /* now load the unscaled outline */\r\n\r\n    FT_GlyphLoader_Prepare( decoder->builder.loader );  /* prepare loader */\r\n\r\n    /* the seac operator must not be nested */\r\n    decoder->seac = TRUE;\r\n    error = t1_decoder_parse_glyph( decoder, bchar_index );\r\n    decoder->seac = FALSE;\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* save the left bearing and width of the base character */\r\n    /* as they will be erased by the next load.              */\r\n\r\n    left_bearing = decoder->builder.left_bearing;\r\n    advance      = decoder->builder.advance;\r\n\r\n    decoder->builder.left_bearing.x = 0;\r\n    decoder->builder.left_bearing.y = 0;\r\n\r\n    decoder->builder.pos_x = adx - asb;\r\n    decoder->builder.pos_y = ady;\r\n\r\n    /* Now load `achar' on top of */\r\n    /* the base outline           */\r\n\r\n    /* the seac operator must not be nested */\r\n    decoder->seac = TRUE;\r\n    error = t1_decoder_parse_glyph( decoder, achar_index );\r\n    decoder->seac = FALSE;\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* restore the left side bearing and   */\r\n    /* advance width of the base character */\r\n\r\n    decoder->builder.left_bearing = left_bearing;\r\n    decoder->builder.advance      = advance;\r\n\r\n    decoder->builder.pos_x = 0;\r\n    decoder->builder.pos_y = 0;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    t1_decoder_parse_charstrings                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parses a given Type 1 charstrings program.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    decoder         :: The current Type 1 decoder.                     */\r\n  /*                                                                       */\r\n  /*    charstring_base :: The base address of the charstring stream.      */\r\n  /*                                                                       */\r\n  /*    charstring_len  :: The length in bytes of the charstring stream.   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_decoder_parse_charstrings( T1_Decoder  decoder,\r\n                                FT_Byte*    charstring_base,\r\n                                FT_UInt     charstring_len )\r\n  {\r\n    FT_Error         error;\r\n    T1_Decoder_Zone  zone;\r\n    FT_Byte*         ip;\r\n    FT_Byte*         limit;\r\n    T1_Builder       builder = &decoder->builder;\r\n    FT_Pos           x, y, orig_x, orig_y;\r\n    FT_Int           known_othersubr_result_cnt   = 0;\r\n    FT_Int           unknown_othersubr_result_cnt = 0;\r\n    FT_Bool          large_int;\r\n    FT_Fixed         seed;\r\n\r\n    T1_Hints_Funcs   hinter;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_Bool          bol = TRUE;\r\n#endif\r\n\r\n\r\n    /* compute random seed from stack address of parameter */\r\n    seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed              ^\r\n                         (FT_PtrDist)(char*)&decoder           ^\r\n                         (FT_PtrDist)(char*)&charstring_base ) &\r\n                         FT_ULONG_MAX ) ;\r\n    seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;\r\n    if ( seed == 0 )\r\n      seed = 0x7384;\r\n\r\n    /* First of all, initialize the decoder */\r\n    decoder->top  = decoder->stack;\r\n    decoder->zone = decoder->zones;\r\n    zone          = decoder->zones;\r\n\r\n    builder->parse_state = T1_Parse_Start;\r\n\r\n    hinter = (T1_Hints_Funcs)builder->hints_funcs;\r\n\r\n    /* a font that reads BuildCharArray without setting */\r\n    /* its values first is buggy, but ...               */\r\n    FT_ASSERT( ( decoder->len_buildchar == 0 ) ==\r\n               ( decoder->buildchar == NULL )  );\r\n\r\n    if ( decoder->buildchar && decoder->len_buildchar > 0 )\r\n      ft_memset( &decoder->buildchar[0],\r\n                 0,\r\n                 sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar );\r\n\r\n    FT_TRACE4(( \"\\n\"\r\n                \"Start charstring\\n\" ));\r\n\r\n    zone->base           = charstring_base;\r\n    limit = zone->limit  = charstring_base + charstring_len;\r\n    ip    = zone->cursor = zone->base;\r\n\r\n    error = PSaux_Err_Ok;\r\n\r\n    x = orig_x = builder->pos_x;\r\n    y = orig_y = builder->pos_y;\r\n\r\n    /* begin hints recording session, if any */\r\n    if ( hinter )\r\n      hinter->open( hinter->hints );\r\n\r\n    large_int = FALSE;\r\n\r\n    /* now, execute loop */\r\n    while ( ip < limit )\r\n    {\r\n      FT_Long*     top   = decoder->top;\r\n      T1_Operator  op    = op_none;\r\n      FT_Int32     value = 0;\r\n\r\n\r\n      FT_ASSERT( known_othersubr_result_cnt == 0   ||\r\n                 unknown_othersubr_result_cnt == 0 );\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n      if ( bol )\r\n      {\r\n        FT_TRACE5(( \" (%d)\", decoder->top - decoder->stack ));\r\n        bol = FALSE;\r\n      }\r\n#endif\r\n\r\n      /*********************************************************************/\r\n      /*                                                                   */\r\n      /* Decode operator or operand                                        */\r\n      /*                                                                   */\r\n      /*                                                                   */\r\n\r\n      /* first of all, decompress operator or value */\r\n      switch ( *ip++ )\r\n      {\r\n      case 1:\r\n        op = op_hstem;\r\n        break;\r\n\r\n      case 3:\r\n        op = op_vstem;\r\n        break;\r\n      case 4:\r\n        op = op_vmoveto;\r\n        break;\r\n      case 5:\r\n        op = op_rlineto;\r\n        break;\r\n      case 6:\r\n        op = op_hlineto;\r\n        break;\r\n      case 7:\r\n        op = op_vlineto;\r\n        break;\r\n      case 8:\r\n        op = op_rrcurveto;\r\n        break;\r\n      case 9:\r\n        op = op_closepath;\r\n        break;\r\n      case 10:\r\n        op = op_callsubr;\r\n        break;\r\n      case 11:\r\n        op = op_return;\r\n        break;\r\n\r\n      case 13:\r\n        op = op_hsbw;\r\n        break;\r\n      case 14:\r\n        op = op_endchar;\r\n        break;\r\n\r\n      case 15:          /* undocumented, obsolete operator */\r\n        op = op_unknown15;\r\n        break;\r\n\r\n      case 21:\r\n        op = op_rmoveto;\r\n        break;\r\n      case 22:\r\n        op = op_hmoveto;\r\n        break;\r\n\r\n      case 30:\r\n        op = op_vhcurveto;\r\n        break;\r\n      case 31:\r\n        op = op_hvcurveto;\r\n        break;\r\n\r\n      case 12:\r\n        if ( ip > limit )\r\n        {\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                     \" invalid escape (12+EOF)\\n\" ));\r\n          goto Syntax_Error;\r\n        }\r\n\r\n        switch ( *ip++ )\r\n        {\r\n        case 0:\r\n          op = op_dotsection;\r\n          break;\r\n        case 1:\r\n          op = op_vstem3;\r\n          break;\r\n        case 2:\r\n          op = op_hstem3;\r\n          break;\r\n        case 6:\r\n          op = op_seac;\r\n          break;\r\n        case 7:\r\n          op = op_sbw;\r\n          break;\r\n        case 12:\r\n          op = op_div;\r\n          break;\r\n        case 16:\r\n          op = op_callothersubr;\r\n          break;\r\n        case 17:\r\n          op = op_pop;\r\n          break;\r\n        case 33:\r\n          op = op_setcurrentpoint;\r\n          break;\r\n\r\n        default:\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                     \" invalid escape (12+%d)\\n\",\r\n                     ip[-1] ));\r\n          goto Syntax_Error;\r\n        }\r\n        break;\r\n\r\n      case 255:    /* four bytes integer */\r\n        if ( ip + 4 > limit )\r\n        {\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                     \" unexpected EOF in integer\\n\" ));\r\n          goto Syntax_Error;\r\n        }\r\n\r\n        value = (FT_Int32)( ( (FT_Long)ip[0] << 24 ) |\r\n                            ( (FT_Long)ip[1] << 16 ) |\r\n                            ( (FT_Long)ip[2] << 8  ) |\r\n                                       ip[3]         );\r\n        ip += 4;\r\n\r\n        /* According to the specification, values > 32000 or < -32000 must */\r\n        /* be followed by a `div' operator to make the result be in the    */\r\n        /* range [-32000;32000].  We expect that the second argument of    */\r\n        /* `div' is not a large number.  Additionally, we don't handle     */\r\n        /* stuff like `<large1> <large2> <num> div <num> div' or           */\r\n        /* <large1> <large2> <num> div div'.  This is probably not allowed */\r\n        /* anyway.                                                         */\r\n        if ( value > 32000 || value < -32000 )\r\n        {\r\n          if ( large_int )\r\n          {\r\n            FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                       \" no `div' after large integer\\n\" ));\r\n          }\r\n          else\r\n            large_int = TRUE;\r\n        }\r\n        else\r\n        {\r\n          if ( !large_int )\r\n            value <<= 16;\r\n        }\r\n\r\n        break;\r\n\r\n      default:\r\n        if ( ip[-1] >= 32 )\r\n        {\r\n          if ( ip[-1] < 247 )\r\n            value = (FT_Int32)ip[-1] - 139;\r\n          else\r\n          {\r\n            if ( ++ip > limit )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" unexpected EOF in integer\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            if ( ip[-2] < 251 )\r\n              value =  ( ( (FT_Int32)ip[-2] - 247 ) << 8 ) + ip[-1] + 108;\r\n            else\r\n              value = -( ( ( (FT_Int32)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 );\r\n          }\r\n\r\n          if ( !large_int )\r\n            value <<= 16;\r\n        }\r\n        else\r\n        {\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                     \" invalid byte (%d)\\n\", ip[-1] ));\r\n          goto Syntax_Error;\r\n        }\r\n      }\r\n\r\n      if ( unknown_othersubr_result_cnt > 0 )\r\n      {\r\n        switch ( op )\r\n        {\r\n        case op_callsubr:\r\n        case op_return:\r\n        case op_none:\r\n        case op_pop:\r\n          break;\r\n\r\n        default:\r\n          /* all operands have been transferred by previous pops */\r\n          unknown_othersubr_result_cnt = 0;\r\n          break;\r\n        }\r\n      }\r\n\r\n      if ( large_int && !( op == op_none || op == op_div ) )\r\n      {\r\n        FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                   \" no `div' after large integer\\n\" ));\r\n\r\n        large_int = FALSE;\r\n      }\r\n\r\n      /*********************************************************************/\r\n      /*                                                                   */\r\n      /*  Push value on stack, or process operator                         */\r\n      /*                                                                   */\r\n      /*                                                                   */\r\n      if ( op == op_none )\r\n      {\r\n        if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )\r\n        {\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings: stack overflow\\n\" ));\r\n          goto Syntax_Error;\r\n        }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        if ( large_int )\r\n          FT_TRACE4(( \" %ld\", value ));\r\n        else\r\n          FT_TRACE4(( \" %ld\", Fix2Int( value ) ));\r\n#endif\r\n\r\n        *top++       = value;\r\n        decoder->top = top;\r\n      }\r\n      else if ( op == op_callothersubr )  /* callothersubr */\r\n      {\r\n        FT_Int  subr_no;\r\n        FT_Int  arg_cnt;\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        FT_TRACE4(( \" callothersubr\\n\" ));\r\n        bol = TRUE;\r\n#endif\r\n\r\n        if ( top - decoder->stack < 2 )\r\n          goto Stack_Underflow;\r\n\r\n        top -= 2;\r\n\r\n        subr_no = Fix2Int( top[1] );\r\n        arg_cnt = Fix2Int( top[0] );\r\n\r\n        /***********************************************************/\r\n        /*                                                         */\r\n        /* remove all operands to callothersubr from the stack     */\r\n        /*                                                         */\r\n        /* for handled othersubrs, where we know the number of     */\r\n        /* arguments, we increase the stack by the value of        */\r\n        /* known_othersubr_result_cnt                              */\r\n        /*                                                         */\r\n        /* for unhandled othersubrs the following pops adjust the  */\r\n        /* stack pointer as necessary                              */\r\n\r\n        if ( arg_cnt > top - decoder->stack )\r\n          goto Stack_Underflow;\r\n\r\n        top -= arg_cnt;\r\n\r\n        known_othersubr_result_cnt   = 0;\r\n        unknown_othersubr_result_cnt = 0;\r\n\r\n        /* XXX TODO: The checks to `arg_count == <whatever>'       */\r\n        /* might not be correct; an othersubr expects a certain    */\r\n        /* number of operands on the PostScript stack (as opposed  */\r\n        /* to the T1 stack) but it doesn't have to put them there  */\r\n        /* by itself; previous othersubrs might have left the      */\r\n        /* operands there if they were not followed by an          */\r\n        /* appropriate number of pops                              */\r\n        /*                                                         */\r\n        /* On the other hand, Adobe Reader 7.0.8 for Linux doesn't */\r\n        /* accept a font that contains charstrings like            */\r\n        /*                                                         */\r\n        /*     100 200 2 20 callothersubr                          */\r\n        /*     300 1 20 callothersubr pop                          */\r\n        /*                                                         */\r\n        /* Perhaps this is the reason why BuildCharArray exists.   */\r\n\r\n        switch ( subr_no )\r\n        {\r\n        case 0:                     /* end flex feature */\r\n          if ( arg_cnt != 3 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          if ( decoder->flex_state       == 0 ||\r\n               decoder->num_flex_vectors != 7 )\r\n          {\r\n            FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                       \" unexpected flex end\\n\" ));\r\n            goto Syntax_Error;\r\n          }\r\n\r\n          /* the two `results' are popped by the following setcurrentpoint */\r\n          top[0] = x;\r\n          top[1] = y;\r\n          known_othersubr_result_cnt = 2;\r\n          break;\r\n\r\n        case 1:                     /* start flex feature */\r\n          if ( arg_cnt != 0 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          decoder->flex_state        = 1;\r\n          decoder->num_flex_vectors  = 0;\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok                                   ||\r\n               ( error = t1_builder_check_points( builder, 6 ) )\r\n                 != PSaux_Err_Ok                                   )\r\n            goto Fail;\r\n          break;\r\n\r\n        case 2:                     /* add flex vectors */\r\n          {\r\n            FT_Int  idx;\r\n\r\n\r\n            if ( arg_cnt != 0 )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            if ( decoder->flex_state == 0 )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" missing flex start\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            /* note that we should not add a point for index 0; */\r\n            /* this will move our current position to the flex  */\r\n            /* point without adding any point to the outline    */\r\n            idx = decoder->num_flex_vectors++;\r\n            if ( idx > 0 && idx < 7 )\r\n              t1_builder_add_point( builder,\r\n                                    x,\r\n                                    y,\r\n                                    (FT_Byte)( idx == 3 || idx == 6 ) );\r\n          }\r\n          break;\r\n\r\n        case 3:                     /* change hints */\r\n          if ( arg_cnt != 1 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          known_othersubr_result_cnt = 1;\r\n\r\n          if ( hinter )\r\n            hinter->reset( hinter->hints, builder->current->n_points );\r\n          break;\r\n\r\n        case 12:\r\n        case 13:\r\n          /* counter control hints, clear stack */\r\n          top = decoder->stack;\r\n          break;\r\n\r\n        case 14:\r\n        case 15:\r\n        case 16:\r\n        case 17:\r\n        case 18:                    /* multiple masters */\r\n          {\r\n            PS_Blend  blend = decoder->blend;\r\n            FT_UInt   num_points, nn, mm;\r\n            FT_Long*  delta;\r\n            FT_Long*  values;\r\n\r\n\r\n            if ( !blend )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" unexpected multiple masters operator\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 );\r\n            if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" incorrect number of multiple masters arguments\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            /* We want to compute                                    */\r\n            /*                                                       */\r\n            /*   a0*w0 + a1*w1 + ... + ak*wk                         */\r\n            /*                                                       */\r\n            /* but we only have a0, a1-a0, a2-a0, ..., ak-a0.        */\r\n            /*                                                       */\r\n            /* However, given that w0 + w1 + ... + wk == 1, we can   */\r\n            /* rewrite it easily as                                  */\r\n            /*                                                       */\r\n            /*   a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk     */\r\n            /*                                                       */\r\n            /* where k == num_designs-1.                             */\r\n            /*                                                       */\r\n            /* I guess that's why it's written in this `compact'     */\r\n            /* form.                                                 */\r\n            /*                                                       */\r\n            delta  = top + num_points;\r\n            values = top;\r\n            for ( nn = 0; nn < num_points; nn++ )\r\n            {\r\n              FT_Long  tmp = values[0];\r\n\r\n\r\n              for ( mm = 1; mm < blend->num_designs; mm++ )\r\n                tmp += FT_MulFix( *delta++, blend->weight_vector[mm] );\r\n\r\n              *values++ = tmp;\r\n            }\r\n\r\n            known_othersubr_result_cnt = num_points;\r\n            break;\r\n          }\r\n\r\n        case 19:\r\n          /* <idx> 1 19 callothersubr                             */\r\n          /* => replace elements starting from index cvi( <idx> ) */\r\n          /*    of BuildCharArray with WeightVector               */\r\n          {\r\n            FT_Int    idx;\r\n            PS_Blend  blend = decoder->blend;\r\n\r\n\r\n            if ( arg_cnt != 1 || blend == NULL )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            idx = Fix2Int( top[0] );\r\n\r\n            if ( idx < 0                                           ||\r\n                 idx + blend->num_designs > decoder->len_buildchar )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            ft_memcpy( &decoder->buildchar[idx],\r\n                       blend->weight_vector,\r\n                       blend->num_designs *\r\n                         sizeof ( blend->weight_vector[0] ) );\r\n          }\r\n          break;\r\n\r\n        case 20:\r\n          /* <arg1> <arg2> 2 20 callothersubr pop   */\r\n          /* ==> push <arg1> + <arg2> onto T1 stack */\r\n          if ( arg_cnt != 2 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          top[0] += top[1]; /* XXX (over|under)flow */\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n        case 21:\r\n          /* <arg1> <arg2> 2 21 callothersubr pop   */\r\n          /* ==> push <arg1> - <arg2> onto T1 stack */\r\n          if ( arg_cnt != 2 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          top[0] -= top[1]; /* XXX (over|under)flow */\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n        case 22:\r\n          /* <arg1> <arg2> 2 22 callothersubr pop   */\r\n          /* ==> push <arg1> * <arg2> onto T1 stack */\r\n          if ( arg_cnt != 2 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          top[0] = FT_MulFix( top[0], top[1] );\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n        case 23:\r\n          /* <arg1> <arg2> 2 23 callothersubr pop   */\r\n          /* ==> push <arg1> / <arg2> onto T1 stack */\r\n          if ( arg_cnt != 2 || top[1] == 0 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          top[0] = FT_DivFix( top[0], top[1] );\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n        case 24:\r\n          /* <val> <idx> 2 24 callothersubr               */\r\n          /* ==> set BuildCharArray[cvi( <idx> )] = <val> */\r\n          {\r\n            FT_Int    idx;\r\n            PS_Blend  blend = decoder->blend;\r\n\r\n\r\n            if ( arg_cnt != 2 || blend == NULL )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            idx = Fix2Int( top[1] );\r\n\r\n            if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            decoder->buildchar[idx] = top[0];\r\n          }\r\n          break;\r\n\r\n        case 25:\r\n          /* <idx> 1 25 callothersubr pop        */\r\n          /* ==> push BuildCharArray[cvi( idx )] */\r\n          /*     onto T1 stack                   */\r\n          {\r\n            FT_Int    idx;\r\n            PS_Blend  blend = decoder->blend;\r\n\r\n\r\n            if ( arg_cnt != 1 || blend == NULL )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            idx = Fix2Int( top[0] );\r\n\r\n            if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )\r\n              goto Unexpected_OtherSubr;\r\n\r\n            top[0] = decoder->buildchar[idx];\r\n          }\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n#if 0\r\n        case 26:\r\n          /* <val> mark <idx> ==> set BuildCharArray[cvi( <idx> )] = <val>, */\r\n          /*                      leave mark on T1 stack                    */\r\n          /* <val> <idx>      ==> set BuildCharArray[cvi( <idx> )] = <val>  */\r\n          XXX which routine has left its mark on the (PostScript) stack?;\r\n          break;\r\n#endif\r\n\r\n        case 27:\r\n          /* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */\r\n          /* ==> push <res1> onto T1 stack if <val1> <= <val2>, */\r\n          /*     otherwise push <res2>                          */\r\n          if ( arg_cnt != 4 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          if ( top[2] > top[3] )\r\n            top[0] = top[1];\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n        case 28:\r\n          /* 0 28 callothersubr pop                               */\r\n          /* => push random value from interval [0, 1) onto stack */\r\n          if ( arg_cnt != 0 )\r\n            goto Unexpected_OtherSubr;\r\n\r\n          {\r\n            FT_Fixed  Rand;\r\n\r\n\r\n            Rand = seed;\r\n            if ( Rand >= 0x8000L )\r\n              Rand++;\r\n\r\n            top[0] = Rand;\r\n\r\n            seed = FT_MulFix( seed, 0x10000L - seed );\r\n            if ( seed == 0 )\r\n              seed += 0x2873;\r\n          }\r\n\r\n          known_othersubr_result_cnt = 1;\r\n          break;\r\n\r\n        default:\r\n          if ( arg_cnt >= 0 && subr_no >= 0 )\r\n          {\r\n            FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                       \" unknown othersubr [%d %d], wish me luck\\n\",\r\n                       arg_cnt, subr_no ));\r\n            unknown_othersubr_result_cnt = arg_cnt;\r\n            break;\r\n          }\r\n          /* fall through */\r\n\r\n        Unexpected_OtherSubr:\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                     \" invalid othersubr [%d %d]\\n\", arg_cnt, subr_no ));\r\n          goto Syntax_Error;\r\n        }\r\n\r\n        top += known_othersubr_result_cnt;\r\n\r\n        decoder->top = top;\r\n      }\r\n      else  /* general operator */\r\n      {\r\n        FT_Int  num_args = t1_args_count[op];\r\n\r\n\r\n        FT_ASSERT( num_args >= 0 );\r\n\r\n        if ( top - decoder->stack < num_args )\r\n          goto Stack_Underflow;\r\n\r\n        /* XXX Operators usually take their operands from the        */\r\n        /*     bottom of the stack, i.e., the operands are           */\r\n        /*     decoder->stack[0], ..., decoder->stack[num_args - 1]; */\r\n        /*     only div, callsubr, and callothersubr are different.  */\r\n        /*     In practice it doesn't matter (?).                    */\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n        switch ( op )\r\n        {\r\n        case op_callsubr:\r\n        case op_div:\r\n        case op_callothersubr:\r\n        case op_pop:\r\n        case op_return:\r\n          break;\r\n\r\n        default:\r\n          if ( top - decoder->stack != num_args )\r\n            FT_TRACE0(( \"t1_decoder_parse_charstrings:\"\r\n                        \" too much operands on the stack\"\r\n                        \" (seen %d, expected %d)\\n\",\r\n                        top - decoder->stack, num_args ));\r\n            break;\r\n        }\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n        top -= num_args;\r\n\r\n        switch ( op )\r\n        {\r\n        case op_endchar:\r\n          FT_TRACE4(( \" endchar\\n\" ));\r\n\r\n          t1_builder_close_contour( builder );\r\n\r\n          /* close hints recording session */\r\n          if ( hinter )\r\n          {\r\n            if ( hinter->close( hinter->hints, builder->current->n_points ) )\r\n              goto Syntax_Error;\r\n\r\n            /* apply hints to the loaded glyph outline now */\r\n            hinter->apply( hinter->hints,\r\n                           builder->current,\r\n                           (PSH_Globals)builder->hints_globals,\r\n                           decoder->hint_mode );\r\n          }\r\n\r\n          /* add current outline to the glyph slot */\r\n          FT_GlyphLoader_Add( builder->loader );\r\n\r\n          /* the compiler should optimize away this empty loop but ... */\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n          if ( decoder->len_buildchar > 0 )\r\n          {\r\n            FT_UInt  i;\r\n\r\n\r\n            FT_TRACE4(( \"BuildCharArray = [ \" ));\r\n\r\n            for ( i = 0; i < decoder->len_buildchar; ++i )\r\n              FT_TRACE4(( \"%d \", decoder->buildchar[i] ));\r\n\r\n            FT_TRACE4(( \"]\\n\" ));\r\n          }\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n          FT_TRACE4(( \"\\n\" ));\r\n\r\n          /* return now! */\r\n          return PSaux_Err_Ok;\r\n\r\n        case op_hsbw:\r\n          FT_TRACE4(( \" hsbw\" ));\r\n\r\n          builder->parse_state = T1_Parse_Have_Width;\r\n\r\n          builder->left_bearing.x += top[0];\r\n          builder->advance.x       = top[1];\r\n          builder->advance.y       = 0;\r\n\r\n          orig_x = x = builder->pos_x + top[0];\r\n          orig_y = y = builder->pos_y;\r\n\r\n          FT_UNUSED( orig_y );\r\n\r\n          /* the `metrics_only' indicates that we only want to compute */\r\n          /* the glyph's metrics (lsb + advance width), not load the   */\r\n          /* rest of it; so exit immediately                           */\r\n          if ( builder->metrics_only )\r\n            return PSaux_Err_Ok;\r\n\r\n          break;\r\n\r\n        case op_seac:\r\n          return t1operator_seac( decoder,\r\n                                  top[0],\r\n                                  top[1],\r\n                                  top[2],\r\n                                  Fix2Int( top[3] ),\r\n                                  Fix2Int( top[4] ) );\r\n\r\n        case op_sbw:\r\n          FT_TRACE4(( \" sbw\" ));\r\n\r\n          builder->parse_state = T1_Parse_Have_Width;\r\n\r\n          builder->left_bearing.x += top[0];\r\n          builder->left_bearing.y += top[1];\r\n          builder->advance.x       = top[2];\r\n          builder->advance.y       = top[3];\r\n\r\n          x = builder->pos_x + top[0];\r\n          y = builder->pos_y + top[1];\r\n\r\n          /* the `metrics_only' indicates that we only want to compute */\r\n          /* the glyph's metrics (lsb + advance width), not load the   */\r\n          /* rest of it; so exit immediately                           */\r\n          if ( builder->metrics_only )\r\n            return PSaux_Err_Ok;\r\n\r\n          break;\r\n\r\n        case op_closepath:\r\n          FT_TRACE4(( \" closepath\" ));\r\n\r\n          /* if there is no path, `closepath' is a no-op */\r\n          if ( builder->parse_state == T1_Parse_Have_Path   ||\r\n               builder->parse_state == T1_Parse_Have_Moveto )\r\n            t1_builder_close_contour( builder );\r\n\r\n          builder->parse_state = T1_Parse_Have_Width;\r\n          break;\r\n\r\n        case op_hlineto:\r\n          FT_TRACE4(( \" hlineto\" ));\r\n\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok )\r\n            goto Fail;\r\n\r\n          x += top[0];\r\n          goto Add_Line;\r\n\r\n        case op_hmoveto:\r\n          FT_TRACE4(( \" hmoveto\" ));\r\n\r\n          x += top[0];\r\n          if ( !decoder->flex_state )\r\n          {\r\n            if ( builder->parse_state == T1_Parse_Start )\r\n              goto Syntax_Error;\r\n            builder->parse_state = T1_Parse_Have_Moveto;\r\n          }\r\n          break;\r\n\r\n        case op_hvcurveto:\r\n          FT_TRACE4(( \" hvcurveto\" ));\r\n\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok                                   ||\r\n               ( error = t1_builder_check_points( builder, 3 ) )\r\n                 != PSaux_Err_Ok                                   )\r\n            goto Fail;\r\n\r\n          x += top[0];\r\n          t1_builder_add_point( builder, x, y, 0 );\r\n          x += top[1];\r\n          y += top[2];\r\n          t1_builder_add_point( builder, x, y, 0 );\r\n          y += top[3];\r\n          t1_builder_add_point( builder, x, y, 1 );\r\n          break;\r\n\r\n        case op_rlineto:\r\n          FT_TRACE4(( \" rlineto\" ));\r\n\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok )\r\n            goto Fail;\r\n\r\n          x += top[0];\r\n          y += top[1];\r\n\r\n        Add_Line:\r\n          if ( ( error = t1_builder_add_point1( builder, x, y ) )\r\n                 != PSaux_Err_Ok )\r\n            goto Fail;\r\n          break;\r\n\r\n        case op_rmoveto:\r\n          FT_TRACE4(( \" rmoveto\" ));\r\n\r\n          x += top[0];\r\n          y += top[1];\r\n          if ( !decoder->flex_state )\r\n          {\r\n            if ( builder->parse_state == T1_Parse_Start )\r\n              goto Syntax_Error;\r\n            builder->parse_state = T1_Parse_Have_Moveto;\r\n          }\r\n          break;\r\n\r\n        case op_rrcurveto:\r\n          FT_TRACE4(( \" rrcurveto\" ));\r\n\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok                                   ||\r\n               ( error = t1_builder_check_points( builder, 3 ) )\r\n                 != PSaux_Err_Ok                                   )\r\n            goto Fail;\r\n\r\n          x += top[0];\r\n          y += top[1];\r\n          t1_builder_add_point( builder, x, y, 0 );\r\n\r\n          x += top[2];\r\n          y += top[3];\r\n          t1_builder_add_point( builder, x, y, 0 );\r\n\r\n          x += top[4];\r\n          y += top[5];\r\n          t1_builder_add_point( builder, x, y, 1 );\r\n          break;\r\n\r\n        case op_vhcurveto:\r\n          FT_TRACE4(( \" vhcurveto\" ));\r\n\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok                                   ||\r\n               ( error = t1_builder_check_points( builder, 3 ) )\r\n                 != PSaux_Err_Ok                                   )\r\n            goto Fail;\r\n\r\n          y += top[0];\r\n          t1_builder_add_point( builder, x, y, 0 );\r\n          x += top[1];\r\n          y += top[2];\r\n          t1_builder_add_point( builder, x, y, 0 );\r\n          x += top[3];\r\n          t1_builder_add_point( builder, x, y, 1 );\r\n          break;\r\n\r\n        case op_vlineto:\r\n          FT_TRACE4(( \" vlineto\" ));\r\n\r\n          if ( ( error = t1_builder_start_point( builder, x, y ) )\r\n                 != PSaux_Err_Ok )\r\n            goto Fail;\r\n\r\n          y += top[0];\r\n          goto Add_Line;\r\n\r\n        case op_vmoveto:\r\n          FT_TRACE4(( \" vmoveto\" ));\r\n\r\n          y += top[0];\r\n          if ( !decoder->flex_state )\r\n          {\r\n            if ( builder->parse_state == T1_Parse_Start )\r\n              goto Syntax_Error;\r\n            builder->parse_state = T1_Parse_Have_Moveto;\r\n          }\r\n          break;\r\n\r\n        case op_div:\r\n          FT_TRACE4(( \" div\" ));\r\n\r\n          /* if `large_int' is set, we divide unscaled numbers; */\r\n          /* otherwise, we divide numbers in 16.16 format --    */\r\n          /* in both cases, it is the same operation            */\r\n          *top = FT_DivFix( top[0], top[1] );\r\n          ++top;\r\n\r\n          large_int = FALSE;\r\n          break;\r\n\r\n        case op_callsubr:\r\n          {\r\n            FT_Int  idx;\r\n\r\n\r\n            FT_TRACE4(( \" callsubr\" ));\r\n\r\n            idx = Fix2Int( top[0] );\r\n            if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" invalid subrs index\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" too many nested subrs\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            zone->cursor = ip;  /* save current instruction pointer */\r\n\r\n            zone++;\r\n\r\n            /* The Type 1 driver stores subroutines without the seed bytes. */\r\n            /* The CID driver stores subroutines with seed bytes.  This     */\r\n            /* case is taken care of when decoder->subrs_len == 0.          */\r\n            zone->base = decoder->subrs[idx];\r\n\r\n            if ( decoder->subrs_len )\r\n              zone->limit = zone->base + decoder->subrs_len[idx];\r\n            else\r\n            {\r\n              /* We are using subroutines from a CID font.  We must adjust */\r\n              /* for the seed bytes.                                       */\r\n              zone->base  += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );\r\n              zone->limit  = decoder->subrs[idx + 1];\r\n            }\r\n\r\n            zone->cursor = zone->base;\r\n\r\n            if ( !zone->base )\r\n            {\r\n              FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                         \" invoking empty subrs\\n\" ));\r\n              goto Syntax_Error;\r\n            }\r\n\r\n            decoder->zone = zone;\r\n            ip            = zone->base;\r\n            limit         = zone->limit;\r\n            break;\r\n          }\r\n\r\n        case op_pop:\r\n          FT_TRACE4(( \" pop\" ));\r\n\r\n          if ( known_othersubr_result_cnt > 0 )\r\n          {\r\n            known_othersubr_result_cnt--;\r\n            /* ignore, we pushed the operands ourselves */\r\n            break;\r\n          }\r\n\r\n          if ( unknown_othersubr_result_cnt == 0 )\r\n          {\r\n            FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                       \" no more operands for othersubr\\n\" ));\r\n            goto Syntax_Error;\r\n          }\r\n\r\n          unknown_othersubr_result_cnt--;\r\n          top++;   /* `push' the operand to callothersubr onto the stack */\r\n          break;\r\n\r\n        case op_return:\r\n          FT_TRACE4(( \" return\" ));\r\n\r\n          if ( zone <= decoder->zones )\r\n          {\r\n            FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                       \" unexpected return\\n\" ));\r\n            goto Syntax_Error;\r\n          }\r\n\r\n          zone--;\r\n          ip            = zone->cursor;\r\n          limit         = zone->limit;\r\n          decoder->zone = zone;\r\n          break;\r\n\r\n        case op_dotsection:\r\n          FT_TRACE4(( \" dotsection\" ));\r\n\r\n          break;\r\n\r\n        case op_hstem:\r\n          FT_TRACE4(( \" hstem\" ));\r\n\r\n          /* record horizontal hint */\r\n          if ( hinter )\r\n          {\r\n            /* top[0] += builder->left_bearing.y; */\r\n            hinter->stem( hinter->hints, 1, top );\r\n          }\r\n          break;\r\n\r\n        case op_hstem3:\r\n          FT_TRACE4(( \" hstem3\" ));\r\n\r\n          /* record horizontal counter-controlled hints */\r\n          if ( hinter )\r\n            hinter->stem3( hinter->hints, 1, top );\r\n          break;\r\n\r\n        case op_vstem:\r\n          FT_TRACE4(( \" vstem\" ));\r\n\r\n          /* record vertical hint */\r\n          if ( hinter )\r\n          {\r\n            top[0] += orig_x;\r\n            hinter->stem( hinter->hints, 0, top );\r\n          }\r\n          break;\r\n\r\n        case op_vstem3:\r\n          FT_TRACE4(( \" vstem3\" ));\r\n\r\n          /* record vertical counter-controlled hints */\r\n          if ( hinter )\r\n          {\r\n            FT_Pos  dx = orig_x;\r\n\r\n\r\n            top[0] += dx;\r\n            top[2] += dx;\r\n            top[4] += dx;\r\n            hinter->stem3( hinter->hints, 0, top );\r\n          }\r\n          break;\r\n\r\n        case op_setcurrentpoint:\r\n          FT_TRACE4(( \" setcurrentpoint\" ));\r\n\r\n          /* From the T1 specification, section 6.4:                */\r\n          /*                                                        */\r\n          /*   The setcurrentpoint command is used only in          */\r\n          /*   conjunction with results from OtherSubrs procedures. */\r\n\r\n          /* known_othersubr_result_cnt != 0 is already handled     */\r\n          /* above.                                                 */\r\n\r\n          /* Note, however, that both Ghostscript and Adobe         */\r\n          /* Distiller handle this situation by silently ignoring   */\r\n          /* the inappropriate `setcurrentpoint' instruction.  So   */\r\n          /* we do the same.                                        */\r\n#if 0\r\n\r\n          if ( decoder->flex_state != 1 )\r\n          {\r\n            FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                       \" unexpected `setcurrentpoint'\\n\" ));\r\n            goto Syntax_Error;\r\n          }\r\n          else\r\n            ...\r\n#endif\r\n\r\n          x = top[0];\r\n          y = top[1];\r\n          decoder->flex_state = 0;\r\n          break;\r\n\r\n        case op_unknown15:\r\n          FT_TRACE4(( \" opcode_15\" ));\r\n          /* nothing to do except to pop the two arguments */\r\n          break;\r\n\r\n        default:\r\n          FT_ERROR(( \"t1_decoder_parse_charstrings:\"\r\n                     \" unhandled opcode %d\\n\", op ));\r\n          goto Syntax_Error;\r\n        }\r\n\r\n        /* XXX Operators usually clear the operand stack;  */\r\n        /*     only div, callsubr, callothersubr, pop, and */\r\n        /*     return are different.                       */\r\n        /*     In practice it doesn't matter (?).          */\r\n\r\n        decoder->top = top;\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        FT_TRACE4(( \"\\n\" ));\r\n        bol = TRUE;\r\n#endif\r\n\r\n      } /* general operator processing */\r\n\r\n    } /* while ip < limit */\r\n\r\n    FT_TRACE4(( \"..end..\\n\\n\" ));\r\n\r\n  Fail:\r\n    return error;\r\n\r\n  Syntax_Error:\r\n    return PSaux_Err_Syntax_Error;\r\n\r\n  Stack_Underflow:\r\n    return PSaux_Err_Stack_Underflow;\r\n  }\r\n\r\n\r\n  /* parse a single Type 1 glyph */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_decoder_parse_glyph( T1_Decoder  decoder,\r\n                          FT_UInt     glyph )\r\n  {\r\n    return decoder->parse_callback( decoder, glyph );\r\n  }\r\n\r\n\r\n  /* initialize T1 decoder */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t1_decoder_init( T1_Decoder           decoder,\r\n                   FT_Face              face,\r\n                   FT_Size              size,\r\n                   FT_GlyphSlot         slot,\r\n                   FT_Byte**            glyph_names,\r\n                   PS_Blend             blend,\r\n                   FT_Bool              hinting,\r\n                   FT_Render_Mode       hint_mode,\r\n                   T1_Decoder_Callback  parse_callback )\r\n  {\r\n    FT_MEM_ZERO( decoder, sizeof ( *decoder ) );\r\n\r\n    /* retrieve PSNames interface from list of current modules */\r\n    {\r\n      FT_Service_PsCMaps  psnames = 0;\r\n\r\n\r\n      FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );\r\n      if ( !psnames )\r\n      {\r\n        FT_ERROR(( \"t1_decoder_init:\"\r\n                   \" the `psnames' module is not available\\n\" ));\r\n        return PSaux_Err_Unimplemented_Feature;\r\n      }\r\n\r\n      decoder->psnames = psnames;\r\n    }\r\n\r\n    t1_builder_init( &decoder->builder, face, size, slot, hinting );\r\n\r\n    /* decoder->buildchar and decoder->len_buildchar have to be  */\r\n    /* initialized by the caller since we cannot know the length */\r\n    /* of the BuildCharArray                                     */\r\n\r\n    decoder->num_glyphs     = (FT_UInt)face->num_glyphs;\r\n    decoder->glyph_names    = glyph_names;\r\n    decoder->hint_mode      = hint_mode;\r\n    decoder->blend          = blend;\r\n    decoder->parse_callback = parse_callback;\r\n\r\n    decoder->funcs          = t1_decoder_funcs;\r\n\r\n    return PSaux_Err_Ok;\r\n  }\r\n\r\n\r\n  /* finalize T1 decoder */\r\n  FT_LOCAL_DEF( void )\r\n  t1_decoder_done( T1_Decoder  decoder )\r\n  {\r\n    t1_builder_done( &decoder->builder );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psaux/t1decode.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1decode.h                                                             */\r\n/*                                                                         */\r\n/*    PostScript Type 1 decoding routines (specification).                 */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2002, 2003 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1DECODE_H__\r\n#define __T1DECODE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_CALLBACK_TABLE\r\n  const T1_Decoder_FuncsRec  t1_decoder_funcs;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_decoder_parse_glyph( T1_Decoder  decoder,\r\n                          FT_UInt     glyph_index );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_decoder_parse_charstrings( T1_Decoder  decoder,\r\n                                FT_Byte*    base,\r\n                                FT_UInt     len );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t1_decoder_init( T1_Decoder           decoder,\r\n                   FT_Face              face,\r\n                   FT_Size              size,\r\n                   FT_GlyphSlot         slot,\r\n                   FT_Byte**            glyph_names,\r\n                   PS_Blend             blend,\r\n                   FT_Bool              hinting,\r\n                   FT_Render_Mode       hint_mode,\r\n                   T1_Decoder_Callback  parse_glyph );\r\n\r\n  FT_LOCAL( void )\r\n  t1_decoder_done( T1_Decoder  decoder );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1DECODE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/Jamfile",
    "content": "# FreeType 2 src/pshinter Jamfile\r\n#\r\n# Copyright 2001, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) pshinter ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = pshrec pshglob pshalgo pshmod pshpic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = pshinter ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/pshinter Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/module.mk",
    "content": "#\r\n# FreeType 2 PSHinter module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2001, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += PSHINTER_MODULE\r\n\r\ndefine PSHINTER_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, pshinter_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)pshinter  $(ECHO_DRIVER_DESC)Postscript hinter module$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshalgo.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshalgo.c                                                              */\r\n/*                                                                         */\r\n/*    PostScript hinting algorithm (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 2001-2010, 2012 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used        */\r\n/*  modified and distributed under the terms of the FreeType project       */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n#include \"pshalgo.h\"\r\n\r\n#include \"pshnterr.h\"\r\n\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pshalgo2\r\n\r\n\r\n#ifdef DEBUG_HINTER\r\n  PSH_Hint_Table  ps_debug_hint_table = 0;\r\n  PSH_HintFunc    ps_debug_hint_func  = 0;\r\n  PSH_Glyph       ps_debug_glyph      = 0;\r\n#endif\r\n\r\n\r\n#define  COMPUTE_INFLEXS  /* compute inflection points to optimize `S' */\r\n                          /* and similar glyphs                        */\r\n#define  STRONGER         /* slightly increase the contrast of smooth  */\r\n                          /* hinting                                   */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  BASIC HINTS RECORDINGS                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* return true if two stem hints overlap */\r\n  static FT_Int\r\n  psh_hint_overlap( PSH_Hint  hint1,\r\n                    PSH_Hint  hint2 )\r\n  {\r\n    return hint1->org_pos + hint1->org_len >= hint2->org_pos &&\r\n           hint2->org_pos + hint2->org_len >= hint1->org_pos;\r\n  }\r\n\r\n\r\n  /* destroy hints table */\r\n  static void\r\n  psh_hint_table_done( PSH_Hint_Table  table,\r\n                       FT_Memory       memory )\r\n  {\r\n    FT_FREE( table->zones );\r\n    table->num_zones = 0;\r\n    table->zone      = 0;\r\n\r\n    FT_FREE( table->sort );\r\n    FT_FREE( table->hints );\r\n    table->num_hints   = 0;\r\n    table->max_hints   = 0;\r\n    table->sort_global = 0;\r\n  }\r\n\r\n\r\n  /* deactivate all hints in a table */\r\n  static void\r\n  psh_hint_table_deactivate( PSH_Hint_Table  table )\r\n  {\r\n    FT_UInt   count = table->max_hints;\r\n    PSH_Hint  hint  = table->hints;\r\n\r\n\r\n    for ( ; count > 0; count--, hint++ )\r\n    {\r\n      psh_hint_deactivate( hint );\r\n      hint->order = -1;\r\n    }\r\n  }\r\n\r\n\r\n  /* internal function to record a new hint */\r\n  static void\r\n  psh_hint_table_record( PSH_Hint_Table  table,\r\n                         FT_UInt         idx )\r\n  {\r\n    PSH_Hint  hint = table->hints + idx;\r\n\r\n\r\n    if ( idx >= table->max_hints )\r\n    {\r\n      FT_TRACE0(( \"psh_hint_table_record: invalid hint index %d\\n\", idx ));\r\n      return;\r\n    }\r\n\r\n    /* ignore active hints */\r\n    if ( psh_hint_is_active( hint ) )\r\n      return;\r\n\r\n    psh_hint_activate( hint );\r\n\r\n    /* now scan the current active hint set to check */\r\n    /* whether `hint' overlaps with another hint     */\r\n    {\r\n      PSH_Hint*  sorted = table->sort_global;\r\n      FT_UInt    count  = table->num_hints;\r\n      PSH_Hint   hint2;\r\n\r\n\r\n      hint->parent = 0;\r\n      for ( ; count > 0; count--, sorted++ )\r\n      {\r\n        hint2 = sorted[0];\r\n\r\n        if ( psh_hint_overlap( hint, hint2 ) )\r\n        {\r\n          hint->parent = hint2;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n    if ( table->num_hints < table->max_hints )\r\n      table->sort_global[table->num_hints++] = hint;\r\n    else\r\n      FT_TRACE0(( \"psh_hint_table_record: too many sorted hints!  BUG!\\n\" ));\r\n  }\r\n\r\n\r\n  static void\r\n  psh_hint_table_record_mask( PSH_Hint_Table  table,\r\n                              PS_Mask         hint_mask )\r\n  {\r\n    FT_Int    mask = 0, val = 0;\r\n    FT_Byte*  cursor = hint_mask->bytes;\r\n    FT_UInt   idx, limit;\r\n\r\n\r\n    limit = hint_mask->num_bits;\r\n\r\n    for ( idx = 0; idx < limit; idx++ )\r\n    {\r\n      if ( mask == 0 )\r\n      {\r\n        val  = *cursor++;\r\n        mask = 0x80;\r\n      }\r\n\r\n      if ( val & mask )\r\n        psh_hint_table_record( table, idx );\r\n\r\n      mask >>= 1;\r\n    }\r\n  }\r\n\r\n\r\n  /* create hints table */\r\n  static FT_Error\r\n  psh_hint_table_init( PSH_Hint_Table  table,\r\n                       PS_Hint_Table   hints,\r\n                       PS_Mask_Table   hint_masks,\r\n                       PS_Mask_Table   counter_masks,\r\n                       FT_Memory       memory )\r\n  {\r\n    FT_UInt   count;\r\n    FT_Error  error;\r\n\r\n    FT_UNUSED( counter_masks );\r\n\r\n\r\n    count = hints->num_hints;\r\n\r\n    /* allocate our tables */\r\n    if ( FT_NEW_ARRAY( table->sort,  2 * count     ) ||\r\n         FT_NEW_ARRAY( table->hints,     count     ) ||\r\n         FT_NEW_ARRAY( table->zones, 2 * count + 1 ) )\r\n      goto Exit;\r\n\r\n    table->max_hints   = count;\r\n    table->sort_global = table->sort + count;\r\n    table->num_hints   = 0;\r\n    table->num_zones   = 0;\r\n    table->zone        = 0;\r\n\r\n    /* initialize the `table->hints' array */\r\n    {\r\n      PSH_Hint  write = table->hints;\r\n      PS_Hint   read  = hints->hints;\r\n\r\n\r\n      for ( ; count > 0; count--, write++, read++ )\r\n      {\r\n        write->org_pos = read->pos;\r\n        write->org_len = read->len;\r\n        write->flags   = read->flags;\r\n      }\r\n    }\r\n\r\n    /* we now need to determine the initial `parent' stems; first  */\r\n    /* activate the hints that are given by the initial hint masks */\r\n    if ( hint_masks )\r\n    {\r\n      PS_Mask  mask = hint_masks->masks;\r\n\r\n\r\n      count             = hint_masks->num_masks;\r\n      table->hint_masks = hint_masks;\r\n\r\n      for ( ; count > 0; count--, mask++ )\r\n        psh_hint_table_record_mask( table, mask );\r\n    }\r\n\r\n    /* finally, do a linear parse in case some hints were left alone */\r\n    if ( table->num_hints != table->max_hints )\r\n    {\r\n      FT_UInt  idx;\r\n\r\n\r\n      FT_TRACE0(( \"psh_hint_table_init: missing/incorrect hint masks\\n\" ));\r\n\r\n      count = table->max_hints;\r\n      for ( idx = 0; idx < count; idx++ )\r\n        psh_hint_table_record( table, idx );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  psh_hint_table_activate_mask( PSH_Hint_Table  table,\r\n                                PS_Mask         hint_mask )\r\n  {\r\n    FT_Int    mask = 0, val = 0;\r\n    FT_Byte*  cursor = hint_mask->bytes;\r\n    FT_UInt   idx, limit, count;\r\n\r\n\r\n    limit = hint_mask->num_bits;\r\n    count = 0;\r\n\r\n    psh_hint_table_deactivate( table );\r\n\r\n    for ( idx = 0; idx < limit; idx++ )\r\n    {\r\n      if ( mask == 0 )\r\n      {\r\n        val  = *cursor++;\r\n        mask = 0x80;\r\n      }\r\n\r\n      if ( val & mask )\r\n      {\r\n        PSH_Hint  hint = &table->hints[idx];\r\n\r\n\r\n        if ( !psh_hint_is_active( hint ) )\r\n        {\r\n          FT_UInt     count2;\r\n\r\n#if 0\r\n          PSH_Hint*  sort = table->sort;\r\n          PSH_Hint   hint2;\r\n\r\n\r\n          for ( count2 = count; count2 > 0; count2--, sort++ )\r\n          {\r\n            hint2 = sort[0];\r\n            if ( psh_hint_overlap( hint, hint2 ) )\r\n              FT_TRACE0(( \"psh_hint_table_activate_mask:\"\r\n                          \" found overlapping hints\\n\" ))\r\n          }\r\n#else\r\n          count2 = 0;\r\n#endif\r\n\r\n          if ( count2 == 0 )\r\n          {\r\n            psh_hint_activate( hint );\r\n            if ( count < table->max_hints )\r\n              table->sort[count++] = hint;\r\n            else\r\n              FT_TRACE0(( \"psh_hint_tableactivate_mask:\"\r\n                          \" too many active hints\\n\" ));\r\n          }\r\n        }\r\n      }\r\n\r\n      mask >>= 1;\r\n    }\r\n    table->num_hints = count;\r\n\r\n    /* now, sort the hints; they are guaranteed to not overlap */\r\n    /* so we can compare their \"org_pos\" field directly        */\r\n    {\r\n      FT_Int     i1, i2;\r\n      PSH_Hint   hint1, hint2;\r\n      PSH_Hint*  sort = table->sort;\r\n\r\n\r\n      /* a simple bubble sort will do, since in 99% of cases, the hints */\r\n      /* will be already sorted -- and the sort will be linear          */\r\n      for ( i1 = 1; i1 < (FT_Int)count; i1++ )\r\n      {\r\n        hint1 = sort[i1];\r\n        for ( i2 = i1 - 1; i2 >= 0; i2-- )\r\n        {\r\n          hint2 = sort[i2];\r\n\r\n          if ( hint2->org_pos < hint1->org_pos )\r\n            break;\r\n\r\n          sort[i2 + 1] = hint2;\r\n          sort[i2]     = hint1;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****               HINTS GRID-FITTING AND OPTIMIZATION             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#if 1\r\n  static FT_Pos\r\n  psh_dimension_quantize_len( PSH_Dimension  dim,\r\n                              FT_Pos         len,\r\n                              FT_Bool        do_snapping )\r\n  {\r\n    if ( len <= 64 )\r\n      len = 64;\r\n    else\r\n    {\r\n      FT_Pos  delta = len - dim->stdw.widths[0].cur;\r\n\r\n\r\n      if ( delta < 0 )\r\n        delta = -delta;\r\n\r\n      if ( delta < 40 )\r\n      {\r\n        len = dim->stdw.widths[0].cur;\r\n        if ( len < 48 )\r\n          len = 48;\r\n      }\r\n\r\n      if ( len < 3 * 64 )\r\n      {\r\n        delta = ( len & 63 );\r\n        len  &= -64;\r\n\r\n        if ( delta < 10 )\r\n          len += delta;\r\n\r\n        else if ( delta < 32 )\r\n          len += 10;\r\n\r\n        else if ( delta < 54 )\r\n          len += 54;\r\n\r\n        else\r\n          len += delta;\r\n      }\r\n      else\r\n        len = FT_PIX_ROUND( len );\r\n    }\r\n\r\n    if ( do_snapping )\r\n      len = FT_PIX_ROUND( len );\r\n\r\n    return  len;\r\n  }\r\n#endif /* 0 */\r\n\r\n\r\n#ifdef DEBUG_HINTER\r\n\r\n  static void\r\n  ps_simple_scale( PSH_Hint_Table  table,\r\n                   FT_Fixed        scale,\r\n                   FT_Fixed        delta,\r\n                   FT_Int          dimension )\r\n  {\r\n    PSH_Hint  hint;\r\n    FT_UInt   count;\r\n\r\n\r\n    for ( count = 0; count < table->max_hints; count++ )\r\n    {\r\n      hint = table->hints + count;\r\n\r\n      hint->cur_pos = FT_MulFix( hint->org_pos, scale ) + delta;\r\n      hint->cur_len = FT_MulFix( hint->org_len, scale );\r\n\r\n      if ( ps_debug_hint_func )\r\n        ps_debug_hint_func( hint, dimension );\r\n    }\r\n  }\r\n\r\n#endif /* DEBUG_HINTER */\r\n\r\n\r\n  static FT_Fixed\r\n  psh_hint_snap_stem_side_delta( FT_Fixed  pos,\r\n                                 FT_Fixed  len )\r\n  {\r\n    FT_Fixed  delta1 = FT_PIX_ROUND( pos ) - pos;\r\n    FT_Fixed  delta2 = FT_PIX_ROUND( pos + len ) - pos - len;\r\n\r\n\r\n    if ( FT_ABS( delta1 ) <= FT_ABS( delta2 ) )\r\n      return delta1;\r\n    else\r\n      return delta2;\r\n  }\r\n\r\n\r\n  static void\r\n  psh_hint_align( PSH_Hint     hint,\r\n                  PSH_Globals  globals,\r\n                  FT_Int       dimension,\r\n                  PSH_Glyph    glyph )\r\n  {\r\n    PSH_Dimension  dim   = &globals->dimension[dimension];\r\n    FT_Fixed       scale = dim->scale_mult;\r\n    FT_Fixed       delta = dim->scale_delta;\r\n\r\n\r\n    if ( !psh_hint_is_fitted( hint ) )\r\n    {\r\n      FT_Pos  pos = FT_MulFix( hint->org_pos, scale ) + delta;\r\n      FT_Pos  len = FT_MulFix( hint->org_len, scale );\r\n\r\n      FT_Int            do_snapping;\r\n      FT_Pos            fit_len;\r\n      PSH_AlignmentRec  align;\r\n\r\n\r\n      /* ignore stem alignments when requested through the hint flags */\r\n      if ( ( dimension == 0 && !glyph->do_horz_hints ) ||\r\n           ( dimension == 1 && !glyph->do_vert_hints ) )\r\n      {\r\n        hint->cur_pos = pos;\r\n        hint->cur_len = len;\r\n\r\n        psh_hint_set_fitted( hint );\r\n        return;\r\n      }\r\n\r\n      /* perform stem snapping when requested - this is necessary\r\n       * for monochrome and LCD hinting modes only\r\n       */\r\n      do_snapping = ( dimension == 0 && glyph->do_horz_snapping ) ||\r\n                    ( dimension == 1 && glyph->do_vert_snapping );\r\n\r\n      hint->cur_len = fit_len = len;\r\n\r\n      /* check blue zones for horizontal stems */\r\n      align.align     = PSH_BLUE_ALIGN_NONE;\r\n      align.align_bot = align.align_top = 0;\r\n\r\n      if ( dimension == 1 )\r\n        psh_blues_snap_stem( &globals->blues,\r\n                             hint->org_pos + hint->org_len,\r\n                             hint->org_pos,\r\n                             &align );\r\n\r\n      switch ( align.align )\r\n      {\r\n      case PSH_BLUE_ALIGN_TOP:\r\n        /* the top of the stem is aligned against a blue zone */\r\n        hint->cur_pos = align.align_top - fit_len;\r\n        break;\r\n\r\n      case PSH_BLUE_ALIGN_BOT:\r\n        /* the bottom of the stem is aligned against a blue zone */\r\n        hint->cur_pos = align.align_bot;\r\n        break;\r\n\r\n      case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT:\r\n        /* both edges of the stem are aligned against blue zones */\r\n        hint->cur_pos = align.align_bot;\r\n        hint->cur_len = align.align_top - align.align_bot;\r\n        break;\r\n\r\n      default:\r\n        {\r\n          PSH_Hint  parent = hint->parent;\r\n\r\n\r\n          if ( parent )\r\n          {\r\n            FT_Pos  par_org_center, par_cur_center;\r\n            FT_Pos  cur_org_center, cur_delta;\r\n\r\n\r\n            /* ensure that parent is already fitted */\r\n            if ( !psh_hint_is_fitted( parent ) )\r\n              psh_hint_align( parent, globals, dimension, glyph );\r\n\r\n            /* keep original relation between hints, this is, use the */\r\n            /* scaled distance between the centers of the hints to    */\r\n            /* compute the new position                               */\r\n            par_org_center = parent->org_pos + ( parent->org_len >> 1 );\r\n            par_cur_center = parent->cur_pos + ( parent->cur_len >> 1 );\r\n            cur_org_center = hint->org_pos   + ( hint->org_len   >> 1 );\r\n\r\n            cur_delta = FT_MulFix( cur_org_center - par_org_center, scale );\r\n            pos       = par_cur_center + cur_delta - ( len >> 1 );\r\n          }\r\n\r\n          hint->cur_pos = pos;\r\n          hint->cur_len = fit_len;\r\n\r\n          /* Stem adjustment tries to snap stem widths to standard\r\n           * ones.  This is important to prevent unpleasant rounding\r\n           * artefacts.\r\n           */\r\n          if ( glyph->do_stem_adjust )\r\n          {\r\n            if ( len <= 64 )\r\n            {\r\n              /* the stem is less than one pixel; we will center it\r\n               * around the nearest pixel center\r\n               */\r\n              if ( len >= 32 )\r\n              {\r\n                /* This is a special case where we also widen the stem\r\n                 * and align it to the pixel grid.\r\n                 *\r\n                 *   stem_center          = pos + (len/2)\r\n                 *   nearest_pixel_center = FT_ROUND(stem_center-32)+32\r\n                 *   new_pos              = nearest_pixel_center-32\r\n                 *                        = FT_ROUND(stem_center-32)\r\n                 *                        = FT_FLOOR(stem_center-32+32)\r\n                 *                        = FT_FLOOR(stem_center)\r\n                 *   new_len              = 64\r\n                 */\r\n                pos = FT_PIX_FLOOR( pos + ( len >> 1 ) );\r\n                len = 64;\r\n              }\r\n              else if ( len > 0 )\r\n              {\r\n                /* This is a very small stem; we simply align it to the\r\n                 * pixel grid, trying to find the minimum displacement.\r\n                 *\r\n                 * left               = pos\r\n                 * right              = pos + len\r\n                 * left_nearest_edge  = ROUND(pos)\r\n                 * right_nearest_edge = ROUND(right)\r\n                 *\r\n                 * if ( ABS(left_nearest_edge - left) <=\r\n                 *      ABS(right_nearest_edge - right) )\r\n                 *    new_pos = left\r\n                 * else\r\n                 *    new_pos = right\r\n                 */\r\n                FT_Pos  left_nearest  = FT_PIX_ROUND( pos );\r\n                FT_Pos  right_nearest = FT_PIX_ROUND( pos + len );\r\n                FT_Pos  left_disp     = left_nearest - pos;\r\n                FT_Pos  right_disp    = right_nearest - ( pos + len );\r\n\r\n\r\n                if ( left_disp < 0 )\r\n                  left_disp = -left_disp;\r\n                if ( right_disp < 0 )\r\n                  right_disp = -right_disp;\r\n                if ( left_disp <= right_disp )\r\n                  pos = left_nearest;\r\n                else\r\n                  pos = right_nearest;\r\n              }\r\n              else\r\n              {\r\n                /* this is a ghost stem; we simply round it */\r\n                pos = FT_PIX_ROUND( pos );\r\n              }\r\n            }\r\n            else\r\n            {\r\n              len = psh_dimension_quantize_len( dim, len, 0 );\r\n            }\r\n          }\r\n\r\n          /* now that we have a good hinted stem width, try to position */\r\n          /* the stem along a pixel grid integer coordinate             */\r\n          hint->cur_pos = pos + psh_hint_snap_stem_side_delta( pos, len );\r\n          hint->cur_len = len;\r\n        }\r\n      }\r\n\r\n      if ( do_snapping )\r\n      {\r\n        pos = hint->cur_pos;\r\n        len = hint->cur_len;\r\n\r\n        if ( len < 64 )\r\n          len = 64;\r\n        else\r\n          len = FT_PIX_ROUND( len );\r\n\r\n        switch ( align.align )\r\n        {\r\n          case PSH_BLUE_ALIGN_TOP:\r\n            hint->cur_pos = align.align_top - len;\r\n            hint->cur_len = len;\r\n            break;\r\n\r\n          case PSH_BLUE_ALIGN_BOT:\r\n            hint->cur_len = len;\r\n            break;\r\n\r\n          case PSH_BLUE_ALIGN_BOT | PSH_BLUE_ALIGN_TOP:\r\n            /* don't touch */\r\n            break;\r\n\r\n\r\n          default:\r\n            hint->cur_len = len;\r\n            if ( len & 64 )\r\n              pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ) + 32;\r\n            else\r\n              pos = FT_PIX_ROUND( pos + ( len >> 1 ) );\r\n\r\n            hint->cur_pos = pos - ( len >> 1 );\r\n            hint->cur_len = len;\r\n        }\r\n      }\r\n\r\n      psh_hint_set_fitted( hint );\r\n\r\n#ifdef DEBUG_HINTER\r\n      if ( ps_debug_hint_func )\r\n        ps_debug_hint_func( hint, dimension );\r\n#endif\r\n    }\r\n  }\r\n\r\n\r\n#if 0  /* not used for now, experimental */\r\n\r\n /*\r\n  *  A variant to perform \"light\" hinting (i.e. FT_RENDER_MODE_LIGHT)\r\n  *  of stems\r\n  */\r\n  static void\r\n  psh_hint_align_light( PSH_Hint     hint,\r\n                        PSH_Globals  globals,\r\n                        FT_Int       dimension,\r\n                        PSH_Glyph    glyph )\r\n  {\r\n    PSH_Dimension  dim   = &globals->dimension[dimension];\r\n    FT_Fixed       scale = dim->scale_mult;\r\n    FT_Fixed       delta = dim->scale_delta;\r\n\r\n\r\n    if ( !psh_hint_is_fitted( hint ) )\r\n    {\r\n      FT_Pos  pos = FT_MulFix( hint->org_pos, scale ) + delta;\r\n      FT_Pos  len = FT_MulFix( hint->org_len, scale );\r\n\r\n      FT_Pos  fit_len;\r\n\r\n      PSH_AlignmentRec  align;\r\n\r\n\r\n      /* ignore stem alignments when requested through the hint flags */\r\n      if ( ( dimension == 0 && !glyph->do_horz_hints ) ||\r\n           ( dimension == 1 && !glyph->do_vert_hints ) )\r\n      {\r\n        hint->cur_pos = pos;\r\n        hint->cur_len = len;\r\n\r\n        psh_hint_set_fitted( hint );\r\n        return;\r\n      }\r\n\r\n      fit_len = len;\r\n\r\n      hint->cur_len = fit_len;\r\n\r\n      /* check blue zones for horizontal stems */\r\n      align.align = PSH_BLUE_ALIGN_NONE;\r\n      align.align_bot = align.align_top = 0;\r\n\r\n      if ( dimension == 1 )\r\n        psh_blues_snap_stem( &globals->blues,\r\n                             hint->org_pos + hint->org_len,\r\n                             hint->org_pos,\r\n                             &align );\r\n\r\n      switch ( align.align )\r\n      {\r\n      case PSH_BLUE_ALIGN_TOP:\r\n        /* the top of the stem is aligned against a blue zone */\r\n        hint->cur_pos = align.align_top - fit_len;\r\n        break;\r\n\r\n      case PSH_BLUE_ALIGN_BOT:\r\n        /* the bottom of the stem is aligned against a blue zone */\r\n        hint->cur_pos = align.align_bot;\r\n        break;\r\n\r\n      case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT:\r\n        /* both edges of the stem are aligned against blue zones */\r\n        hint->cur_pos = align.align_bot;\r\n        hint->cur_len = align.align_top - align.align_bot;\r\n        break;\r\n\r\n      default:\r\n        {\r\n          PSH_Hint  parent = hint->parent;\r\n\r\n\r\n          if ( parent )\r\n          {\r\n            FT_Pos  par_org_center, par_cur_center;\r\n            FT_Pos  cur_org_center, cur_delta;\r\n\r\n\r\n            /* ensure that parent is already fitted */\r\n            if ( !psh_hint_is_fitted( parent ) )\r\n              psh_hint_align_light( parent, globals, dimension, glyph );\r\n\r\n            par_org_center = parent->org_pos + ( parent->org_len / 2 );\r\n            par_cur_center = parent->cur_pos + ( parent->cur_len / 2 );\r\n            cur_org_center = hint->org_pos   + ( hint->org_len   / 2 );\r\n\r\n            cur_delta = FT_MulFix( cur_org_center - par_org_center, scale );\r\n            pos       = par_cur_center + cur_delta - ( len >> 1 );\r\n          }\r\n\r\n          /* Stems less than one pixel wide are easy -- we want to\r\n           * make them as dark as possible, so they must fall within\r\n           * one pixel.  If the stem is split between two pixels\r\n           * then snap the edge that is nearer to the pixel boundary\r\n           * to the pixel boundary.\r\n           */\r\n          if ( len <= 64 )\r\n          {\r\n            if ( ( pos + len + 63 ) / 64  != pos / 64 + 1 )\r\n              pos += psh_hint_snap_stem_side_delta ( pos, len );\r\n          }\r\n\r\n          /* Position stems other to minimize the amount of mid-grays.\r\n           * There are, in general, two positions that do this,\r\n           * illustrated as A) and B) below.\r\n           *\r\n           *   +                   +                   +                   +\r\n           *\r\n           * A)             |--------------------------------|\r\n           * B)   |--------------------------------|\r\n           * C)       |--------------------------------|\r\n           *\r\n           * Position A) (split the excess stem equally) should be better\r\n           * for stems of width N + f where f < 0.5.\r\n           *\r\n           * Position B) (split the deficiency equally) should be better\r\n           * for stems of width N + f where f > 0.5.\r\n           *\r\n           * It turns out though that minimizing the total number of lit\r\n           * pixels is also important, so position C), with one edge\r\n           * aligned with a pixel boundary is actually preferable\r\n           * to A).  There are also more possibile positions for C) than\r\n           * for A) or B), so it involves less distortion of the overall\r\n           * character shape.\r\n           */\r\n          else /* len > 64 */\r\n          {\r\n            FT_Fixed  frac_len = len & 63;\r\n            FT_Fixed  center = pos + ( len >> 1 );\r\n            FT_Fixed  delta_a, delta_b;\r\n\r\n\r\n            if ( ( len / 64 ) & 1 )\r\n            {\r\n              delta_a = FT_PIX_FLOOR( center ) + 32 - center;\r\n              delta_b = FT_PIX_ROUND( center ) - center;\r\n            }\r\n            else\r\n            {\r\n              delta_a = FT_PIX_ROUND( center ) - center;\r\n              delta_b = FT_PIX_FLOOR( center ) + 32 - center;\r\n            }\r\n\r\n            /* We choose between B) and C) above based on the amount\r\n             * of fractinal stem width; for small amounts, choose\r\n             * C) always, for large amounts, B) always, and inbetween,\r\n             * pick whichever one involves less stem movement.\r\n             */\r\n            if ( frac_len < 32 )\r\n            {\r\n              pos += psh_hint_snap_stem_side_delta ( pos, len );\r\n            }\r\n            else if ( frac_len < 48 )\r\n            {\r\n              FT_Fixed  side_delta = psh_hint_snap_stem_side_delta ( pos,\r\n                                                                     len );\r\n\r\n              if ( FT_ABS( side_delta ) < FT_ABS( delta_b ) )\r\n                pos += side_delta;\r\n              else\r\n                pos += delta_b;\r\n            }\r\n            else\r\n            {\r\n              pos += delta_b;\r\n            }\r\n          }\r\n\r\n          hint->cur_pos = pos;\r\n        }\r\n      }  /* switch */\r\n\r\n      psh_hint_set_fitted( hint );\r\n\r\n#ifdef DEBUG_HINTER\r\n      if ( ps_debug_hint_func )\r\n        ps_debug_hint_func( hint, dimension );\r\n#endif\r\n    }\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  static void\r\n  psh_hint_table_align_hints( PSH_Hint_Table  table,\r\n                              PSH_Globals     globals,\r\n                              FT_Int          dimension,\r\n                              PSH_Glyph       glyph )\r\n  {\r\n    PSH_Hint       hint;\r\n    FT_UInt        count;\r\n\r\n#ifdef DEBUG_HINTER\r\n\r\n    PSH_Dimension  dim   = &globals->dimension[dimension];\r\n    FT_Fixed       scale = dim->scale_mult;\r\n    FT_Fixed       delta = dim->scale_delta;\r\n\r\n\r\n    if ( ps_debug_no_vert_hints && dimension == 0 )\r\n    {\r\n      ps_simple_scale( table, scale, delta, dimension );\r\n      return;\r\n    }\r\n\r\n    if ( ps_debug_no_horz_hints && dimension == 1 )\r\n    {\r\n      ps_simple_scale( table, scale, delta, dimension );\r\n      return;\r\n    }\r\n\r\n#endif /* DEBUG_HINTER*/\r\n\r\n    hint  = table->hints;\r\n    count = table->max_hints;\r\n\r\n    for ( ; count > 0; count--, hint++ )\r\n      psh_hint_align( hint, globals, dimension, glyph );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                POINTS INTERPOLATION ROUTINES                  *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define PSH_ZONE_MIN  -3200000L\r\n#define PSH_ZONE_MAX  +3200000L\r\n\r\n#define xxDEBUG_ZONES\r\n\r\n\r\n#ifdef DEBUG_ZONES\r\n\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n  static void\r\n  psh_print_zone( PSH_Zone  zone )\r\n  {\r\n    printf( \"zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\\n\",\r\n             zone->scale / 65536.0,\r\n             zone->delta / 64.0,\r\n             zone->min,\r\n             zone->max );\r\n  }\r\n\r\n#else\r\n\r\n#define psh_print_zone( x )  do { } while ( 0 )\r\n\r\n#endif /* DEBUG_ZONES */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    HINTER GLYPH MANAGEMENT                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#if 1\r\n\r\n#define  psh_corner_is_flat      ft_corner_is_flat\r\n#define  psh_corner_orientation  ft_corner_orientation\r\n\r\n#else\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  psh_corner_is_flat( FT_Pos  x_in,\r\n                      FT_Pos  y_in,\r\n                      FT_Pos  x_out,\r\n                      FT_Pos  y_out )\r\n  {\r\n    FT_Pos  ax = x_in;\r\n    FT_Pos  ay = y_in;\r\n\r\n    FT_Pos  d_in, d_out, d_corner;\r\n\r\n\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_in = ax + ay;\r\n\r\n    ax = x_out;\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    ay = y_out;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_out = ax + ay;\r\n\r\n    ax = x_out + x_in;\r\n    if ( ax < 0 )\r\n      ax = -ax;\r\n    ay = y_out + y_in;\r\n    if ( ay < 0 )\r\n      ay = -ay;\r\n    d_corner = ax + ay;\r\n\r\n    return ( d_in + d_out - d_corner ) < ( d_corner >> 4 );\r\n  }\r\n\r\n  static FT_Int\r\n  psh_corner_orientation( FT_Pos  in_x,\r\n                          FT_Pos  in_y,\r\n                          FT_Pos  out_x,\r\n                          FT_Pos  out_y )\r\n  {\r\n    FT_Int  result;\r\n\r\n\r\n    /* deal with the trivial cases quickly */\r\n    if ( in_y == 0 )\r\n    {\r\n      if ( in_x >= 0 )\r\n        result = out_y;\r\n      else\r\n        result = -out_y;\r\n    }\r\n    else if ( in_x == 0 )\r\n    {\r\n      if ( in_y >= 0 )\r\n        result = -out_x;\r\n      else\r\n        result = out_x;\r\n    }\r\n    else if ( out_y == 0 )\r\n    {\r\n      if ( out_x >= 0 )\r\n        result = in_y;\r\n      else\r\n        result = -in_y;\r\n    }\r\n    else if ( out_x == 0 )\r\n    {\r\n      if ( out_y >= 0 )\r\n        result = -in_x;\r\n      else\r\n        result =  in_x;\r\n    }\r\n    else /* general case */\r\n    {\r\n      long long  delta = (long long)in_x * out_y - (long long)in_y * out_x;\r\n\r\n      if ( delta == 0 )\r\n        result = 0;\r\n      else\r\n        result = 1 - 2 * ( delta < 0 );\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n#endif /* !1 */\r\n\r\n\r\n#ifdef COMPUTE_INFLEXS\r\n\r\n  /* compute all inflex points in a given glyph */\r\n  static void\r\n  psh_glyph_compute_inflections( PSH_Glyph  glyph )\r\n  {\r\n    FT_UInt  n;\r\n\r\n\r\n    for ( n = 0; n < glyph->num_contours; n++ )\r\n    {\r\n      PSH_Point  first, start, end, before, after;\r\n      FT_Pos     in_x, in_y, out_x, out_y;\r\n      FT_Int     orient_prev, orient_cur;\r\n      FT_Int     finished = 0;\r\n\r\n\r\n      /* we need at least 4 points to create an inflection point */\r\n      if ( glyph->contours[n].count < 4 )\r\n        continue;\r\n\r\n      /* compute first segment in contour */\r\n      first = glyph->contours[n].start;\r\n\r\n      start = end = first;\r\n      do\r\n      {\r\n        end = end->next;\r\n        if ( end == first )\r\n          goto Skip;\r\n\r\n        in_x = end->org_u - start->org_u;\r\n        in_y = end->org_v - start->org_v;\r\n\r\n      } while ( in_x == 0 && in_y == 0 );\r\n\r\n      /* extend the segment start whenever possible */\r\n      before = start;\r\n      do\r\n      {\r\n        do\r\n        {\r\n          start  = before;\r\n          before = before->prev;\r\n          if ( before == first )\r\n            goto Skip;\r\n\r\n          out_x = start->org_u - before->org_u;\r\n          out_y = start->org_v - before->org_v;\r\n\r\n        } while ( out_x == 0 && out_y == 0 );\r\n\r\n        orient_prev = psh_corner_orientation( in_x, in_y, out_x, out_y );\r\n\r\n      } while ( orient_prev == 0 );\r\n\r\n      first = start;\r\n      in_x  = out_x;\r\n      in_y  = out_y;\r\n\r\n      /* now, process all segments in the contour */\r\n      do\r\n      {\r\n        /* first, extend current segment's end whenever possible */\r\n        after = end;\r\n        do\r\n        {\r\n          do\r\n          {\r\n            end   = after;\r\n            after = after->next;\r\n            if ( after == first )\r\n              finished = 1;\r\n\r\n            out_x = after->org_u - end->org_u;\r\n            out_y = after->org_v - end->org_v;\r\n\r\n          } while ( out_x == 0 && out_y == 0 );\r\n\r\n          orient_cur = psh_corner_orientation( in_x, in_y, out_x, out_y );\r\n\r\n        } while ( orient_cur == 0 );\r\n\r\n        if ( ( orient_cur ^ orient_prev ) < 0 )\r\n        {\r\n          do\r\n          {\r\n            psh_point_set_inflex( start );\r\n            start = start->next;\r\n          }\r\n          while ( start != end );\r\n\r\n          psh_point_set_inflex( start );\r\n        }\r\n\r\n        start       = end;\r\n        end         = after;\r\n        orient_prev = orient_cur;\r\n        in_x        = out_x;\r\n        in_y        = out_y;\r\n\r\n      } while ( !finished );\r\n\r\n    Skip:\r\n      ;\r\n    }\r\n  }\r\n\r\n#endif /* COMPUTE_INFLEXS */\r\n\r\n\r\n  static void\r\n  psh_glyph_done( PSH_Glyph  glyph )\r\n  {\r\n    FT_Memory  memory = glyph->memory;\r\n\r\n\r\n    psh_hint_table_done( &glyph->hint_tables[1], memory );\r\n    psh_hint_table_done( &glyph->hint_tables[0], memory );\r\n\r\n    FT_FREE( glyph->points );\r\n    FT_FREE( glyph->contours );\r\n\r\n    glyph->num_points   = 0;\r\n    glyph->num_contours = 0;\r\n\r\n    glyph->memory = 0;\r\n  }\r\n\r\n\r\n  static int\r\n  psh_compute_dir( FT_Pos  dx,\r\n                   FT_Pos  dy )\r\n  {\r\n    FT_Pos  ax, ay;\r\n    int     result = PSH_DIR_NONE;\r\n\r\n\r\n    ax = ( dx >= 0 ) ? dx : -dx;\r\n    ay = ( dy >= 0 ) ? dy : -dy;\r\n\r\n    if ( ay * 12 < ax )\r\n    {\r\n      /* |dy| <<< |dx|  means a near-horizontal segment */\r\n      result = ( dx >= 0 ) ? PSH_DIR_RIGHT : PSH_DIR_LEFT;\r\n    }\r\n    else if ( ax * 12 < ay )\r\n    {\r\n      /* |dx| <<< |dy|  means a near-vertical segment */\r\n      result = ( dy >= 0 ) ? PSH_DIR_UP : PSH_DIR_DOWN;\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* load outline point coordinates into hinter glyph */\r\n  static void\r\n  psh_glyph_load_points( PSH_Glyph  glyph,\r\n                         FT_Int     dimension )\r\n  {\r\n    FT_Vector*  vec   = glyph->outline->points;\r\n    PSH_Point   point = glyph->points;\r\n    FT_UInt     count = glyph->num_points;\r\n\r\n\r\n    for ( ; count > 0; count--, point++, vec++ )\r\n    {\r\n      point->flags2 = 0;\r\n      point->hint   = NULL;\r\n      if ( dimension == 0 )\r\n      {\r\n        point->org_u = vec->x;\r\n        point->org_v = vec->y;\r\n      }\r\n      else\r\n      {\r\n        point->org_u = vec->y;\r\n        point->org_v = vec->x;\r\n      }\r\n\r\n#ifdef DEBUG_HINTER\r\n      point->org_x = vec->x;\r\n      point->org_y = vec->y;\r\n#endif\r\n\r\n    }\r\n  }\r\n\r\n\r\n  /* save hinted point coordinates back to outline */\r\n  static void\r\n  psh_glyph_save_points( PSH_Glyph  glyph,\r\n                         FT_Int     dimension )\r\n  {\r\n    FT_UInt     n;\r\n    PSH_Point   point = glyph->points;\r\n    FT_Vector*  vec   = glyph->outline->points;\r\n    char*       tags  = glyph->outline->tags;\r\n\r\n\r\n    for ( n = 0; n < glyph->num_points; n++ )\r\n    {\r\n      if ( dimension == 0 )\r\n        vec[n].x = point->cur_u;\r\n      else\r\n        vec[n].y = point->cur_u;\r\n\r\n      if ( psh_point_is_strong( point ) )\r\n        tags[n] |= (char)( ( dimension == 0 ) ? 32 : 64 );\r\n\r\n#ifdef DEBUG_HINTER\r\n\r\n      if ( dimension == 0 )\r\n      {\r\n        point->cur_x   = point->cur_u;\r\n        point->flags_x = point->flags2 | point->flags;\r\n      }\r\n      else\r\n      {\r\n        point->cur_y   = point->cur_u;\r\n        point->flags_y = point->flags2 | point->flags;\r\n      }\r\n\r\n#endif\r\n\r\n      point++;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  psh_glyph_init( PSH_Glyph    glyph,\r\n                  FT_Outline*  outline,\r\n                  PS_Hints     ps_hints,\r\n                  PSH_Globals  globals )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n\r\n    /* clear all fields */\r\n    FT_MEM_ZERO( glyph, sizeof ( *glyph ) );\r\n\r\n    memory = glyph->memory = globals->memory;\r\n\r\n    /* allocate and setup points + contours arrays */\r\n    if ( FT_NEW_ARRAY( glyph->points,   outline->n_points   ) ||\r\n         FT_NEW_ARRAY( glyph->contours, outline->n_contours ) )\r\n      goto Exit;\r\n\r\n    glyph->num_points   = outline->n_points;\r\n    glyph->num_contours = outline->n_contours;\r\n\r\n    {\r\n      FT_UInt      first = 0, next, n;\r\n      PSH_Point    points  = glyph->points;\r\n      PSH_Contour  contour = glyph->contours;\r\n\r\n\r\n      for ( n = 0; n < glyph->num_contours; n++ )\r\n      {\r\n        FT_Int     count;\r\n        PSH_Point  point;\r\n\r\n\r\n        next  = outline->contours[n] + 1;\r\n        count = next - first;\r\n\r\n        contour->start = points + first;\r\n        contour->count = (FT_UInt)count;\r\n\r\n        if ( count > 0 )\r\n        {\r\n          point = points + first;\r\n\r\n          point->prev    = points + next - 1;\r\n          point->contour = contour;\r\n\r\n          for ( ; count > 1; count-- )\r\n          {\r\n            point[0].next = point + 1;\r\n            point[1].prev = point;\r\n            point++;\r\n            point->contour = contour;\r\n          }\r\n          point->next = points + first;\r\n        }\r\n\r\n        contour++;\r\n        first = next;\r\n      }\r\n    }\r\n\r\n    {\r\n      PSH_Point   points = glyph->points;\r\n      PSH_Point   point  = points;\r\n      FT_Vector*  vec    = outline->points;\r\n      FT_UInt     n;\r\n\r\n\r\n      for ( n = 0; n < glyph->num_points; n++, point++ )\r\n      {\r\n        FT_Int  n_prev = (FT_Int)( point->prev - points );\r\n        FT_Int  n_next = (FT_Int)( point->next - points );\r\n        FT_Pos  dxi, dyi, dxo, dyo;\r\n\r\n\r\n        if ( !( outline->tags[n] & FT_CURVE_TAG_ON ) )\r\n          point->flags = PSH_POINT_OFF;\r\n\r\n        dxi = vec[n].x - vec[n_prev].x;\r\n        dyi = vec[n].y - vec[n_prev].y;\r\n\r\n        point->dir_in = (FT_Char)psh_compute_dir( dxi, dyi );\r\n\r\n        dxo = vec[n_next].x - vec[n].x;\r\n        dyo = vec[n_next].y - vec[n].y;\r\n\r\n        point->dir_out = (FT_Char)psh_compute_dir( dxo, dyo );\r\n\r\n        /* detect smooth points */\r\n        if ( point->flags & PSH_POINT_OFF )\r\n          point->flags |= PSH_POINT_SMOOTH;\r\n\r\n        else if ( point->dir_in == point->dir_out )\r\n        {\r\n          if ( point->dir_out != PSH_DIR_NONE           ||\r\n               psh_corner_is_flat( dxi, dyi, dxo, dyo ) )\r\n            point->flags |= PSH_POINT_SMOOTH;\r\n        }\r\n      }\r\n    }\r\n\r\n    glyph->outline = outline;\r\n    glyph->globals = globals;\r\n\r\n#ifdef COMPUTE_INFLEXS\r\n    psh_glyph_load_points( glyph, 0 );\r\n    psh_glyph_compute_inflections( glyph );\r\n#endif /* COMPUTE_INFLEXS */\r\n\r\n    /* now deal with hints tables */\r\n    error = psh_hint_table_init( &glyph->hint_tables [0],\r\n                                 &ps_hints->dimension[0].hints,\r\n                                 &ps_hints->dimension[0].masks,\r\n                                 &ps_hints->dimension[0].counters,\r\n                                 memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = psh_hint_table_init( &glyph->hint_tables [1],\r\n                                 &ps_hints->dimension[1].hints,\r\n                                 &ps_hints->dimension[1].masks,\r\n                                 &ps_hints->dimension[1].counters,\r\n                                 memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* compute all extrema in a glyph for a given dimension */\r\n  static void\r\n  psh_glyph_compute_extrema( PSH_Glyph  glyph )\r\n  {\r\n    FT_UInt  n;\r\n\r\n\r\n    /* first of all, compute all local extrema */\r\n    for ( n = 0; n < glyph->num_contours; n++ )\r\n    {\r\n      PSH_Point  first = glyph->contours[n].start;\r\n      PSH_Point  point, before, after;\r\n\r\n\r\n      if ( glyph->contours[n].count == 0 )\r\n        continue;\r\n\r\n      point  = first;\r\n      before = point;\r\n      after  = point;\r\n\r\n      do\r\n      {\r\n        before = before->prev;\r\n        if ( before == first )\r\n          goto Skip;\r\n\r\n      } while ( before->org_u == point->org_u );\r\n\r\n      first = point = before->next;\r\n\r\n      for (;;)\r\n      {\r\n        after = point;\r\n        do\r\n        {\r\n          after = after->next;\r\n          if ( after == first )\r\n            goto Next;\r\n\r\n        } while ( after->org_u == point->org_u );\r\n\r\n        if ( before->org_u < point->org_u )\r\n        {\r\n          if ( after->org_u < point->org_u )\r\n          {\r\n            /* local maximum */\r\n            goto Extremum;\r\n          }\r\n        }\r\n        else /* before->org_u > point->org_u */\r\n        {\r\n          if ( after->org_u > point->org_u )\r\n          {\r\n            /* local minimum */\r\n          Extremum:\r\n            do\r\n            {\r\n              psh_point_set_extremum( point );\r\n              point = point->next;\r\n\r\n            } while ( point != after );\r\n          }\r\n        }\r\n\r\n        before = after->prev;\r\n        point  = after;\r\n\r\n      } /* for  */\r\n\r\n    Next:\r\n      ;\r\n    }\r\n\r\n    /* for each extremum, determine its direction along the */\r\n    /* orthogonal axis                                      */\r\n    for ( n = 0; n < glyph->num_points; n++ )\r\n    {\r\n      PSH_Point  point, before, after;\r\n\r\n\r\n      point  = &glyph->points[n];\r\n      before = point;\r\n      after  = point;\r\n\r\n      if ( psh_point_is_extremum( point ) )\r\n      {\r\n        do\r\n        {\r\n          before = before->prev;\r\n          if ( before == point )\r\n            goto Skip;\r\n\r\n        } while ( before->org_v == point->org_v );\r\n\r\n        do\r\n        {\r\n          after = after->next;\r\n          if ( after == point )\r\n            goto Skip;\r\n\r\n        } while ( after->org_v == point->org_v );\r\n      }\r\n\r\n      if ( before->org_v < point->org_v &&\r\n           after->org_v  > point->org_v )\r\n      {\r\n        psh_point_set_positive( point );\r\n      }\r\n      else if ( before->org_v > point->org_v &&\r\n                after->org_v  < point->org_v )\r\n      {\r\n        psh_point_set_negative( point );\r\n      }\r\n\r\n    Skip:\r\n      ;\r\n    }\r\n  }\r\n\r\n\r\n  /* major_dir is the direction for points on the bottom/left of the stem; */\r\n  /* Points on the top/right of the stem will have a direction of          */\r\n  /* -major_dir.                                                           */\r\n\r\n  static void\r\n  psh_hint_table_find_strong_points( PSH_Hint_Table  table,\r\n                                     PSH_Point       point,\r\n                                     FT_UInt         count,\r\n                                     FT_Int          threshold,\r\n                                     FT_Int          major_dir )\r\n  {\r\n    PSH_Hint*  sort      = table->sort;\r\n    FT_UInt    num_hints = table->num_hints;\r\n\r\n\r\n    for ( ; count > 0; count--, point++ )\r\n    {\r\n      FT_Int  point_dir = 0;\r\n      FT_Pos  org_u     = point->org_u;\r\n\r\n\r\n      if ( psh_point_is_strong( point ) )\r\n        continue;\r\n\r\n      if ( PSH_DIR_COMPARE( point->dir_in, major_dir ) )\r\n        point_dir = point->dir_in;\r\n\r\n      else if ( PSH_DIR_COMPARE( point->dir_out, major_dir ) )\r\n        point_dir = point->dir_out;\r\n\r\n      if ( point_dir )\r\n      {\r\n        if ( point_dir == major_dir )\r\n        {\r\n          FT_UInt  nn;\r\n\r\n\r\n          for ( nn = 0; nn < num_hints; nn++ )\r\n          {\r\n            PSH_Hint  hint = sort[nn];\r\n            FT_Pos    d    = org_u - hint->org_pos;\r\n\r\n\r\n            if ( d < threshold && -d < threshold )\r\n            {\r\n              psh_point_set_strong( point );\r\n              point->flags2 |= PSH_POINT_EDGE_MIN;\r\n              point->hint    = hint;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n        else if ( point_dir == -major_dir )\r\n        {\r\n          FT_UInt  nn;\r\n\r\n\r\n          for ( nn = 0; nn < num_hints; nn++ )\r\n          {\r\n            PSH_Hint  hint = sort[nn];\r\n            FT_Pos    d    = org_u - hint->org_pos - hint->org_len;\r\n\r\n\r\n            if ( d < threshold && -d < threshold )\r\n            {\r\n              psh_point_set_strong( point );\r\n              point->flags2 |= PSH_POINT_EDGE_MAX;\r\n              point->hint    = hint;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n#if 1\r\n      else if ( psh_point_is_extremum( point ) )\r\n      {\r\n        /* treat extrema as special cases for stem edge alignment */\r\n        FT_UInt  nn, min_flag, max_flag;\r\n\r\n\r\n        if ( major_dir == PSH_DIR_HORIZONTAL )\r\n        {\r\n          min_flag = PSH_POINT_POSITIVE;\r\n          max_flag = PSH_POINT_NEGATIVE;\r\n        }\r\n        else\r\n        {\r\n          min_flag = PSH_POINT_NEGATIVE;\r\n          max_flag = PSH_POINT_POSITIVE;\r\n        }\r\n\r\n        if ( point->flags2 & min_flag )\r\n        {\r\n          for ( nn = 0; nn < num_hints; nn++ )\r\n          {\r\n            PSH_Hint  hint = sort[nn];\r\n            FT_Pos    d    = org_u - hint->org_pos;\r\n\r\n\r\n            if ( d < threshold && -d < threshold )\r\n            {\r\n              point->flags2 |= PSH_POINT_EDGE_MIN;\r\n              point->hint    = hint;\r\n              psh_point_set_strong( point );\r\n              break;\r\n            }\r\n          }\r\n        }\r\n        else if ( point->flags2 & max_flag )\r\n        {\r\n          for ( nn = 0; nn < num_hints; nn++ )\r\n          {\r\n            PSH_Hint  hint = sort[nn];\r\n            FT_Pos    d    = org_u - hint->org_pos - hint->org_len;\r\n\r\n\r\n            if ( d < threshold && -d < threshold )\r\n            {\r\n              point->flags2 |= PSH_POINT_EDGE_MAX;\r\n              point->hint    = hint;\r\n              psh_point_set_strong( point );\r\n              break;\r\n            }\r\n          }\r\n        }\r\n\r\n        if ( point->hint == NULL )\r\n        {\r\n          for ( nn = 0; nn < num_hints; nn++ )\r\n          {\r\n            PSH_Hint  hint = sort[nn];\r\n\r\n\r\n            if ( org_u >= hint->org_pos                 &&\r\n                org_u <= hint->org_pos + hint->org_len )\r\n            {\r\n              point->hint = hint;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n#endif /* 1 */\r\n    }\r\n  }\r\n\r\n\r\n  /* the accepted shift for strong points in fractional pixels */\r\n#define PSH_STRONG_THRESHOLD  32\r\n\r\n  /* the maximum shift value in font units */\r\n#define PSH_STRONG_THRESHOLD_MAXIMUM  30\r\n\r\n\r\n  /* find strong points in a glyph */\r\n  static void\r\n  psh_glyph_find_strong_points( PSH_Glyph  glyph,\r\n                                FT_Int     dimension )\r\n  {\r\n    /* a point is `strong' if it is located on a stem edge and       */\r\n    /* has an `in' or `out' tangent parallel to the hint's direction */\r\n\r\n    PSH_Hint_Table  table     = &glyph->hint_tables[dimension];\r\n    PS_Mask         mask      = table->hint_masks->masks;\r\n    FT_UInt         num_masks = table->hint_masks->num_masks;\r\n    FT_UInt         first     = 0;\r\n    FT_Int          major_dir = dimension == 0 ? PSH_DIR_VERTICAL\r\n                                               : PSH_DIR_HORIZONTAL;\r\n    PSH_Dimension   dim       = &glyph->globals->dimension[dimension];\r\n    FT_Fixed        scale     = dim->scale_mult;\r\n    FT_Int          threshold;\r\n\r\n\r\n    threshold = (FT_Int)FT_DivFix( PSH_STRONG_THRESHOLD, scale );\r\n    if ( threshold > PSH_STRONG_THRESHOLD_MAXIMUM )\r\n      threshold = PSH_STRONG_THRESHOLD_MAXIMUM;\r\n\r\n    /* process secondary hints to `selected' points */\r\n    if ( num_masks > 1 && glyph->num_points > 0 )\r\n    {\r\n      /* the `endchar' op can reduce the number of points */\r\n      first = mask->end_point > glyph->num_points\r\n                ? glyph->num_points\r\n                : mask->end_point;\r\n      mask++;\r\n      for ( ; num_masks > 1; num_masks--, mask++ )\r\n      {\r\n        FT_UInt  next;\r\n        FT_Int   count;\r\n\r\n\r\n        next  = mask->end_point > glyph->num_points\r\n                  ? glyph->num_points\r\n                  : mask->end_point;\r\n        count = next - first;\r\n        if ( count > 0 )\r\n        {\r\n          PSH_Point  point = glyph->points + first;\r\n\r\n\r\n          psh_hint_table_activate_mask( table, mask );\r\n\r\n          psh_hint_table_find_strong_points( table, point, count,\r\n                                             threshold, major_dir );\r\n        }\r\n        first = next;\r\n      }\r\n    }\r\n\r\n    /* process primary hints for all points */\r\n    if ( num_masks == 1 )\r\n    {\r\n      FT_UInt    count = glyph->num_points;\r\n      PSH_Point  point = glyph->points;\r\n\r\n\r\n      psh_hint_table_activate_mask( table, table->hint_masks->masks );\r\n\r\n      psh_hint_table_find_strong_points( table, point, count,\r\n                                         threshold, major_dir );\r\n    }\r\n\r\n    /* now, certain points may have been attached to a hint and */\r\n    /* not marked as strong; update their flags then            */\r\n    {\r\n      FT_UInt    count = glyph->num_points;\r\n      PSH_Point  point = glyph->points;\r\n\r\n\r\n      for ( ; count > 0; count--, point++ )\r\n        if ( point->hint && !psh_point_is_strong( point ) )\r\n          psh_point_set_strong( point );\r\n    }\r\n  }\r\n\r\n\r\n  /* find points in a glyph which are in a blue zone and have `in' or */\r\n  /* `out' tangents parallel to the horizontal axis                   */\r\n  static void\r\n  psh_glyph_find_blue_points( PSH_Blues  blues,\r\n                              PSH_Glyph  glyph )\r\n  {\r\n    PSH_Blue_Table  table;\r\n    PSH_Blue_Zone   zone;\r\n    FT_UInt         glyph_count = glyph->num_points;\r\n    FT_UInt         blue_count;\r\n    PSH_Point       point = glyph->points;\r\n\r\n\r\n    for ( ; glyph_count > 0; glyph_count--, point++ )\r\n    {\r\n      FT_Pos  y;\r\n\r\n\r\n      /* check tangents */\r\n      if ( !PSH_DIR_COMPARE( point->dir_in,  PSH_DIR_HORIZONTAL ) &&\r\n           !PSH_DIR_COMPARE( point->dir_out, PSH_DIR_HORIZONTAL ) )\r\n        continue;\r\n\r\n      /* skip strong points */\r\n      if ( psh_point_is_strong( point ) )\r\n        continue;\r\n\r\n      y = point->org_u;\r\n\r\n      /* look up top zones */\r\n      table      = &blues->normal_top;\r\n      blue_count = table->count;\r\n      zone       = table->zones;\r\n\r\n      for ( ; blue_count > 0; blue_count--, zone++ )\r\n      {\r\n        FT_Pos  delta = y - zone->org_bottom;\r\n\r\n\r\n        if ( delta < -blues->blue_fuzz )\r\n          break;\r\n\r\n        if ( y <= zone->org_top + blues->blue_fuzz )\r\n          if ( blues->no_overshoots || delta <= blues->blue_threshold )\r\n          {\r\n            point->cur_u = zone->cur_bottom;\r\n            psh_point_set_strong( point );\r\n            psh_point_set_fitted( point );\r\n          }\r\n      }\r\n\r\n      /* look up bottom zones */\r\n      table      = &blues->normal_bottom;\r\n      blue_count = table->count;\r\n      zone       = table->zones + blue_count - 1;\r\n\r\n      for ( ; blue_count > 0; blue_count--, zone-- )\r\n      {\r\n        FT_Pos  delta = zone->org_top - y;\r\n\r\n\r\n        if ( delta < -blues->blue_fuzz )\r\n          break;\r\n\r\n        if ( y >= zone->org_bottom - blues->blue_fuzz )\r\n          if ( blues->no_overshoots || delta < blues->blue_threshold )\r\n          {\r\n            point->cur_u = zone->cur_top;\r\n            psh_point_set_strong( point );\r\n            psh_point_set_fitted( point );\r\n          }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* interpolate strong points with the help of hinted coordinates */\r\n  static void\r\n  psh_glyph_interpolate_strong_points( PSH_Glyph  glyph,\r\n                                       FT_Int     dimension )\r\n  {\r\n    PSH_Dimension  dim   = &glyph->globals->dimension[dimension];\r\n    FT_Fixed       scale = dim->scale_mult;\r\n\r\n    FT_UInt        count = glyph->num_points;\r\n    PSH_Point      point = glyph->points;\r\n\r\n\r\n    for ( ; count > 0; count--, point++ )\r\n    {\r\n      PSH_Hint  hint = point->hint;\r\n\r\n\r\n      if ( hint )\r\n      {\r\n        FT_Pos  delta;\r\n\r\n\r\n        if ( psh_point_is_edge_min( point ) )\r\n          point->cur_u = hint->cur_pos;\r\n\r\n        else if ( psh_point_is_edge_max( point ) )\r\n          point->cur_u = hint->cur_pos + hint->cur_len;\r\n\r\n        else\r\n        {\r\n          delta = point->org_u - hint->org_pos;\r\n\r\n          if ( delta <= 0 )\r\n            point->cur_u = hint->cur_pos + FT_MulFix( delta, scale );\r\n\r\n          else if ( delta >= hint->org_len )\r\n            point->cur_u = hint->cur_pos + hint->cur_len +\r\n                             FT_MulFix( delta - hint->org_len, scale );\r\n\r\n          else /* hint->org_len > 0 */\r\n            point->cur_u = hint->cur_pos +\r\n                             FT_MulDiv( delta, hint->cur_len,\r\n                                        hint->org_len );\r\n        }\r\n        psh_point_set_fitted( point );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n#define  PSH_MAX_STRONG_INTERNAL  16\r\n\r\n  static void\r\n  psh_glyph_interpolate_normal_points( PSH_Glyph  glyph,\r\n                                       FT_Int     dimension )\r\n  {\r\n\r\n#if 1\r\n    /* first technique: a point is strong if it is a local extremum */\r\n\r\n    PSH_Dimension  dim    = &glyph->globals->dimension[dimension];\r\n    FT_Fixed       scale  = dim->scale_mult;\r\n    FT_Memory      memory = glyph->memory;\r\n\r\n    PSH_Point*     strongs     = NULL;\r\n    PSH_Point      strongs_0[PSH_MAX_STRONG_INTERNAL];\r\n    FT_UInt        num_strongs = 0;\r\n\r\n    PSH_Point      points = glyph->points;\r\n    PSH_Point      points_end = points + glyph->num_points;\r\n    PSH_Point      point;\r\n\r\n\r\n    /* first count the number of strong points */\r\n    for ( point = points; point < points_end; point++ )\r\n    {\r\n      if ( psh_point_is_strong( point ) )\r\n        num_strongs++;\r\n    }\r\n\r\n    if ( num_strongs == 0 )  /* nothing to do here */\r\n      return;\r\n\r\n    /* allocate an array to store a list of points, */\r\n    /* stored in increasing org_u order             */\r\n    if ( num_strongs <= PSH_MAX_STRONG_INTERNAL )\r\n      strongs = strongs_0;\r\n    else\r\n    {\r\n      FT_Error  error;\r\n\r\n\r\n      if ( FT_NEW_ARRAY( strongs, num_strongs ) )\r\n        return;\r\n    }\r\n\r\n    num_strongs = 0;\r\n    for ( point = points; point < points_end; point++ )\r\n    {\r\n      PSH_Point*  insert;\r\n\r\n\r\n      if ( !psh_point_is_strong( point ) )\r\n        continue;\r\n\r\n      for ( insert = strongs + num_strongs; insert > strongs; insert-- )\r\n      {\r\n        if ( insert[-1]->org_u <= point->org_u )\r\n          break;\r\n\r\n        insert[0] = insert[-1];\r\n      }\r\n      insert[0] = point;\r\n      num_strongs++;\r\n    }\r\n\r\n    /* now try to interpolate all normal points */\r\n    for ( point = points; point < points_end; point++ )\r\n    {\r\n      if ( psh_point_is_strong( point ) )\r\n        continue;\r\n\r\n      /* sometimes, some local extrema are smooth points */\r\n      if ( psh_point_is_smooth( point ) )\r\n      {\r\n        if ( point->dir_in == PSH_DIR_NONE   ||\r\n             point->dir_in != point->dir_out )\r\n          continue;\r\n\r\n        if ( !psh_point_is_extremum( point ) &&\r\n             !psh_point_is_inflex( point )   )\r\n          continue;\r\n\r\n        point->flags &= ~PSH_POINT_SMOOTH;\r\n      }\r\n\r\n      /* find best enclosing point coordinates then interpolate */\r\n      {\r\n        PSH_Point   before, after;\r\n        FT_UInt     nn;\r\n\r\n\r\n        for ( nn = 0; nn < num_strongs; nn++ )\r\n          if ( strongs[nn]->org_u > point->org_u )\r\n            break;\r\n\r\n        if ( nn == 0 )  /* point before the first strong point */\r\n        {\r\n          after = strongs[0];\r\n\r\n          point->cur_u = after->cur_u +\r\n                           FT_MulFix( point->org_u - after->org_u,\r\n                                      scale );\r\n        }\r\n        else\r\n        {\r\n          before = strongs[nn - 1];\r\n\r\n          for ( nn = num_strongs; nn > 0; nn-- )\r\n            if ( strongs[nn - 1]->org_u < point->org_u )\r\n              break;\r\n\r\n          if ( nn == num_strongs )  /* point is after last strong point */\r\n          {\r\n            before = strongs[nn - 1];\r\n\r\n            point->cur_u = before->cur_u +\r\n                             FT_MulFix( point->org_u - before->org_u,\r\n                                        scale );\r\n          }\r\n          else\r\n          {\r\n            FT_Pos  u;\r\n\r\n\r\n            after = strongs[nn];\r\n\r\n            /* now interpolate point between before and after */\r\n            u = point->org_u;\r\n\r\n            if ( u == before->org_u )\r\n              point->cur_u = before->cur_u;\r\n\r\n            else if ( u == after->org_u )\r\n              point->cur_u = after->cur_u;\r\n\r\n            else\r\n              point->cur_u = before->cur_u +\r\n                               FT_MulDiv( u - before->org_u,\r\n                                          after->cur_u - before->cur_u,\r\n                                          after->org_u - before->org_u );\r\n          }\r\n        }\r\n        psh_point_set_fitted( point );\r\n      }\r\n    }\r\n\r\n    if ( strongs != strongs_0 )\r\n      FT_FREE( strongs );\r\n\r\n#endif /* 1 */\r\n\r\n  }\r\n\r\n\r\n  /* interpolate other points */\r\n  static void\r\n  psh_glyph_interpolate_other_points( PSH_Glyph  glyph,\r\n                                      FT_Int     dimension )\r\n  {\r\n    PSH_Dimension  dim          = &glyph->globals->dimension[dimension];\r\n    FT_Fixed       scale        = dim->scale_mult;\r\n    FT_Fixed       delta        = dim->scale_delta;\r\n    PSH_Contour    contour      = glyph->contours;\r\n    FT_UInt        num_contours = glyph->num_contours;\r\n\r\n\r\n    for ( ; num_contours > 0; num_contours--, contour++ )\r\n    {\r\n      PSH_Point  start = contour->start;\r\n      PSH_Point  first, next, point;\r\n      FT_UInt    fit_count;\r\n\r\n\r\n      /* count the number of strong points in this contour */\r\n      next      = start + contour->count;\r\n      fit_count = 0;\r\n      first     = 0;\r\n\r\n      for ( point = start; point < next; point++ )\r\n        if ( psh_point_is_fitted( point ) )\r\n        {\r\n          if ( !first )\r\n            first = point;\r\n\r\n          fit_count++;\r\n        }\r\n\r\n      /* if there are less than 2 fitted points in the contour, we */\r\n      /* simply scale and eventually translate the contour points  */\r\n      if ( fit_count < 2 )\r\n      {\r\n        if ( fit_count == 1 )\r\n          delta = first->cur_u - FT_MulFix( first->org_u, scale );\r\n\r\n        for ( point = start; point < next; point++ )\r\n          if ( point != first )\r\n            point->cur_u = FT_MulFix( point->org_u, scale ) + delta;\r\n\r\n        goto Next_Contour;\r\n      }\r\n\r\n      /* there are more than 2 strong points in this contour; we */\r\n      /* need to interpolate weak points between them            */\r\n      start = first;\r\n      do\r\n      {\r\n        point = first;\r\n\r\n        /* skip consecutive fitted points */\r\n        for (;;)\r\n        {\r\n          next = first->next;\r\n          if ( next == start )\r\n            goto Next_Contour;\r\n\r\n          if ( !psh_point_is_fitted( next ) )\r\n            break;\r\n\r\n          first = next;\r\n        }\r\n\r\n        /* find next fitted point after unfitted one */\r\n        for (;;)\r\n        {\r\n          next = next->next;\r\n          if ( psh_point_is_fitted( next ) )\r\n            break;\r\n        }\r\n\r\n        /* now interpolate between them */\r\n        {\r\n          FT_Pos    org_a, org_ab, cur_a, cur_ab;\r\n          FT_Pos    org_c, org_ac, cur_c;\r\n          FT_Fixed  scale_ab;\r\n\r\n\r\n          if ( first->org_u <= next->org_u )\r\n          {\r\n            org_a  = first->org_u;\r\n            cur_a  = first->cur_u;\r\n            org_ab = next->org_u - org_a;\r\n            cur_ab = next->cur_u - cur_a;\r\n          }\r\n          else\r\n          {\r\n            org_a  = next->org_u;\r\n            cur_a  = next->cur_u;\r\n            org_ab = first->org_u - org_a;\r\n            cur_ab = first->cur_u - cur_a;\r\n          }\r\n\r\n          scale_ab = 0x10000L;\r\n          if ( org_ab > 0 )\r\n            scale_ab = FT_DivFix( cur_ab, org_ab );\r\n\r\n          point = first->next;\r\n          do\r\n          {\r\n            org_c  = point->org_u;\r\n            org_ac = org_c - org_a;\r\n\r\n            if ( org_ac <= 0 )\r\n            {\r\n              /* on the left of the interpolation zone */\r\n              cur_c = cur_a + FT_MulFix( org_ac, scale );\r\n            }\r\n            else if ( org_ac >= org_ab )\r\n            {\r\n              /* on the right on the interpolation zone */\r\n              cur_c = cur_a + cur_ab + FT_MulFix( org_ac - org_ab, scale );\r\n            }\r\n            else\r\n            {\r\n              /* within the interpolation zone */\r\n              cur_c = cur_a + FT_MulFix( org_ac, scale_ab );\r\n            }\r\n\r\n            point->cur_u = cur_c;\r\n\r\n            point = point->next;\r\n\r\n          } while ( point != next );\r\n        }\r\n\r\n        /* keep going until all points in the contours have been processed */\r\n        first = next;\r\n\r\n      } while ( first != start );\r\n\r\n    Next_Contour:\r\n      ;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     HIGH-LEVEL INTERFACE                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  FT_Error\r\n  ps_hints_apply( PS_Hints        ps_hints,\r\n                  FT_Outline*     outline,\r\n                  PSH_Globals     globals,\r\n                  FT_Render_Mode  hint_mode )\r\n  {\r\n    PSH_GlyphRec  glyphrec;\r\n    PSH_Glyph     glyph = &glyphrec;\r\n    FT_Error      error;\r\n#ifdef DEBUG_HINTER\r\n    FT_Memory     memory;\r\n#endif\r\n    FT_Int        dimension;\r\n\r\n\r\n    /* something to do? */\r\n    if ( outline->n_points == 0 || outline->n_contours == 0 )\r\n      return PSH_Err_Ok;\r\n\r\n#ifdef DEBUG_HINTER\r\n\r\n    memory = globals->memory;\r\n\r\n    if ( ps_debug_glyph )\r\n    {\r\n      psh_glyph_done( ps_debug_glyph );\r\n      FT_FREE( ps_debug_glyph );\r\n    }\r\n\r\n    if ( FT_NEW( glyph ) )\r\n      return error;\r\n\r\n    ps_debug_glyph = glyph;\r\n\r\n#endif /* DEBUG_HINTER */\r\n\r\n    error = psh_glyph_init( glyph, outline, ps_hints, globals );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* try to optimize the y_scale so that the top of non-capital letters\r\n     * is aligned on a pixel boundary whenever possible\r\n     */\r\n    {\r\n      PSH_Dimension  dim_x = &glyph->globals->dimension[0];\r\n      PSH_Dimension  dim_y = &glyph->globals->dimension[1];\r\n\r\n      FT_Fixed  x_scale = dim_x->scale_mult;\r\n      FT_Fixed  y_scale = dim_y->scale_mult;\r\n\r\n      FT_Fixed  old_x_scale = x_scale;\r\n      FT_Fixed  old_y_scale = y_scale;\r\n\r\n      FT_Fixed  scaled;\r\n      FT_Fixed  fitted;\r\n\r\n      FT_Bool  rescale = FALSE;\r\n\r\n\r\n      scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );\r\n      fitted = FT_PIX_ROUND( scaled );\r\n\r\n      if ( fitted != 0 && scaled != fitted )\r\n      {\r\n        rescale = TRUE;\r\n\r\n        y_scale = FT_MulDiv( y_scale, fitted, scaled );\r\n\r\n        if ( fitted < scaled )\r\n          x_scale -= x_scale / 50;\r\n\r\n        psh_globals_set_scale( glyph->globals, x_scale, y_scale, 0, 0 );\r\n      }\r\n\r\n      glyph->do_horz_hints = 1;\r\n      glyph->do_vert_hints = 1;\r\n\r\n      glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||\r\n                                         hint_mode == FT_RENDER_MODE_LCD  );\r\n\r\n      glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO  ||\r\n                                         hint_mode == FT_RENDER_MODE_LCD_V );\r\n\r\n      glyph->do_stem_adjust   = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );\r\n\r\n      for ( dimension = 0; dimension < 2; dimension++ )\r\n      {\r\n        /* load outline coordinates into glyph */\r\n        psh_glyph_load_points( glyph, dimension );\r\n\r\n        /* compute local extrema */\r\n        psh_glyph_compute_extrema( glyph );\r\n\r\n        /* compute aligned stem/hints positions */\r\n        psh_hint_table_align_hints( &glyph->hint_tables[dimension],\r\n                                    glyph->globals,\r\n                                    dimension,\r\n                                    glyph );\r\n\r\n        /* find strong points, align them, then interpolate others */\r\n        psh_glyph_find_strong_points( glyph, dimension );\r\n        if ( dimension == 1 )\r\n          psh_glyph_find_blue_points( &globals->blues, glyph );\r\n        psh_glyph_interpolate_strong_points( glyph, dimension );\r\n        psh_glyph_interpolate_normal_points( glyph, dimension );\r\n        psh_glyph_interpolate_other_points( glyph, dimension );\r\n\r\n        /* save hinted coordinates back to outline */\r\n        psh_glyph_save_points( glyph, dimension );\r\n\r\n        if ( rescale )\r\n          psh_globals_set_scale( glyph->globals,\r\n                                 old_x_scale, old_y_scale, 0, 0 );\r\n      }\r\n    }\r\n\r\n  Exit:\r\n\r\n#ifndef DEBUG_HINTER\r\n    psh_glyph_done( glyph );\r\n#endif\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshalgo.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshalgo.h                                                              */\r\n/*                                                                         */\r\n/*    PostScript hinting algorithm (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2008 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSHALGO_H__\r\n#define __PSHALGO_H__\r\n\r\n\r\n#include \"pshrec.h\"\r\n#include \"pshglob.h\"\r\n#include FT_TRIGONOMETRY_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* handle to Hint structure */\r\n  typedef struct PSH_HintRec_*  PSH_Hint;\r\n\r\n  /* hint bit-flags */\r\n  typedef enum  PSH_Hint_Flags_\r\n  {\r\n    PSH_HINT_GHOST  = PS_HINT_FLAG_GHOST,\r\n    PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,\r\n    PSH_HINT_ACTIVE = 4,\r\n    PSH_HINT_FITTED = 8\r\n\r\n  } PSH_Hint_Flags;\r\n\r\n\r\n#define psh_hint_is_active( x )  ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 )\r\n#define psh_hint_is_ghost( x )   ( ( (x)->flags & PSH_HINT_GHOST  ) != 0 )\r\n#define psh_hint_is_fitted( x )  ( ( (x)->flags & PSH_HINT_FITTED ) != 0 )\r\n\r\n#define psh_hint_activate( x )    (x)->flags |=  PSH_HINT_ACTIVE\r\n#define psh_hint_deactivate( x )  (x)->flags &= ~PSH_HINT_ACTIVE\r\n#define psh_hint_set_fitted( x )  (x)->flags |=  PSH_HINT_FITTED\r\n\r\n  /* hint structure */\r\n  typedef struct  PSH_HintRec_\r\n  {\r\n    FT_Int    org_pos;\r\n    FT_Int    org_len;\r\n    FT_Pos    cur_pos;\r\n    FT_Pos    cur_len;\r\n    FT_UInt   flags;\r\n    PSH_Hint  parent;\r\n    FT_Int    order;\r\n\r\n  } PSH_HintRec;\r\n\r\n\r\n  /* this is an interpolation zone used for strong points;  */\r\n  /* weak points are interpolated according to their strong */\r\n  /* neighbours                                             */\r\n  typedef struct  PSH_ZoneRec_\r\n  {\r\n    FT_Fixed  scale;\r\n    FT_Fixed  delta;\r\n    FT_Pos    min;\r\n    FT_Pos    max;\r\n\r\n  } PSH_ZoneRec, *PSH_Zone;\r\n\r\n\r\n  typedef struct  PSH_Hint_TableRec_\r\n  {\r\n    FT_UInt        max_hints;\r\n    FT_UInt        num_hints;\r\n    PSH_Hint       hints;\r\n    PSH_Hint*      sort;\r\n    PSH_Hint*      sort_global;\r\n    FT_UInt        num_zones;\r\n    PSH_ZoneRec*   zones;\r\n    PSH_Zone       zone;\r\n    PS_Mask_Table  hint_masks;\r\n    PS_Mask_Table  counter_masks;\r\n\r\n  } PSH_Hint_TableRec, *PSH_Hint_Table;\r\n\r\n\r\n  typedef struct PSH_PointRec_*    PSH_Point;\r\n  typedef struct PSH_ContourRec_*  PSH_Contour;\r\n\r\n  enum\r\n  {\r\n    PSH_DIR_NONE  =  4,\r\n    PSH_DIR_UP    = -1,\r\n    PSH_DIR_DOWN  =  1,\r\n    PSH_DIR_LEFT  = -2,\r\n    PSH_DIR_RIGHT =  2\r\n  };\r\n\r\n#define PSH_DIR_HORIZONTAL  2\r\n#define PSH_DIR_VERTICAL    1\r\n\r\n#define PSH_DIR_COMPARE( d1, d2 )   ( (d1) == (d2) || (d1) == -(d2) )\r\n#define PSH_DIR_IS_HORIZONTAL( d )  PSH_DIR_COMPARE( d, PSH_DIR_HORIZONTAL )\r\n#define PSH_DIR_IS_VERTICAL( d )    PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )\r\n\r\n\r\n /* the following bit-flags are computed once by the glyph */\r\n /* analyzer, for both dimensions                          */\r\n  enum\r\n  {\r\n    PSH_POINT_OFF    = 1,   /* point is off the curve */\r\n    PSH_POINT_SMOOTH = 2,   /* point is smooth        */\r\n    PSH_POINT_INFLEX = 4    /* point is inflection    */\r\n  };\r\n\r\n#define psh_point_is_smooth( p )  ( (p)->flags & PSH_POINT_SMOOTH )\r\n#define psh_point_is_off( p )     ( (p)->flags & PSH_POINT_OFF    )\r\n#define psh_point_is_inflex( p )  ( (p)->flags & PSH_POINT_INFLEX )\r\n\r\n#define psh_point_set_smooth( p )  (p)->flags |= PSH_POINT_SMOOTH\r\n#define psh_point_set_off( p )     (p)->flags |= PSH_POINT_OFF\r\n#define psh_point_set_inflex( p )  (p)->flags |= PSH_POINT_INFLEX\r\n\r\n  /* the following bit-flags are re-computed for each dimension */\r\n  enum\r\n  {\r\n    PSH_POINT_STRONG   = 16,   /* point is strong                           */\r\n    PSH_POINT_FITTED   = 32,   /* point is already fitted                   */\r\n    PSH_POINT_EXTREMUM = 64,   /* point is local extremum                   */\r\n    PSH_POINT_POSITIVE = 128,  /* extremum has positive contour flow        */\r\n    PSH_POINT_NEGATIVE = 256,  /* extremum has negative contour flow        */\r\n    PSH_POINT_EDGE_MIN = 512,  /* point is aligned to left/bottom stem edge */\r\n    PSH_POINT_EDGE_MAX = 1024  /* point is aligned to top/right stem edge   */\r\n  };\r\n\r\n#define psh_point_is_strong( p )    ( (p)->flags2 & PSH_POINT_STRONG )\r\n#define psh_point_is_fitted( p )    ( (p)->flags2 & PSH_POINT_FITTED )\r\n#define psh_point_is_extremum( p )  ( (p)->flags2 & PSH_POINT_EXTREMUM )\r\n#define psh_point_is_positive( p )  ( (p)->flags2 & PSH_POINT_POSITIVE )\r\n#define psh_point_is_negative( p )  ( (p)->flags2 & PSH_POINT_NEGATIVE )\r\n#define psh_point_is_edge_min( p )  ( (p)->flags2 & PSH_POINT_EDGE_MIN )\r\n#define psh_point_is_edge_max( p )  ( (p)->flags2 & PSH_POINT_EDGE_MAX )\r\n\r\n#define psh_point_set_strong( p )    (p)->flags2 |= PSH_POINT_STRONG\r\n#define psh_point_set_fitted( p )    (p)->flags2 |= PSH_POINT_FITTED\r\n#define psh_point_set_extremum( p )  (p)->flags2 |= PSH_POINT_EXTREMUM\r\n#define psh_point_set_positive( p )  (p)->flags2 |= PSH_POINT_POSITIVE\r\n#define psh_point_set_negative( p )  (p)->flags2 |= PSH_POINT_NEGATIVE\r\n#define psh_point_set_edge_min( p )  (p)->flags2 |= PSH_POINT_EDGE_MIN\r\n#define psh_point_set_edge_max( p )  (p)->flags2 |= PSH_POINT_EDGE_MAX\r\n\r\n\r\n  typedef struct  PSH_PointRec_\r\n  {\r\n    PSH_Point    prev;\r\n    PSH_Point    next;\r\n    PSH_Contour  contour;\r\n    FT_UInt      flags;\r\n    FT_UInt      flags2;\r\n    FT_Char      dir_in;\r\n    FT_Char      dir_out;\r\n    FT_Angle     angle_in;\r\n    FT_Angle     angle_out;\r\n    PSH_Hint     hint;\r\n    FT_Pos       org_u;\r\n    FT_Pos       org_v;\r\n    FT_Pos       cur_u;\r\n#ifdef DEBUG_HINTER\r\n    FT_Pos       org_x;\r\n    FT_Pos       cur_x;\r\n    FT_Pos       org_y;\r\n    FT_Pos       cur_y;\r\n    FT_UInt      flags_x;\r\n    FT_UInt      flags_y;\r\n#endif\r\n\r\n  } PSH_PointRec;\r\n\r\n\r\n#define PSH_POINT_EQUAL_ORG( a, b )  ( (a)->org_u == (b)->org_u && \\\r\n                                       (a)->org_v == (b)->org_v )\r\n\r\n#define PSH_POINT_ANGLE( a, b )  FT_Atan2( (b)->org_u - (a)->org_u,  \\\r\n                                           (b)->org_v - (a)->org_v )\r\n\r\n  typedef struct  PSH_ContourRec_\r\n  {\r\n    PSH_Point  start;\r\n    FT_UInt    count;\r\n\r\n  } PSH_ContourRec;\r\n\r\n\r\n  typedef struct  PSH_GlyphRec_\r\n  {\r\n    FT_UInt            num_points;\r\n    FT_UInt            num_contours;\r\n\r\n    PSH_Point          points;\r\n    PSH_Contour        contours;\r\n\r\n    FT_Memory          memory;\r\n    FT_Outline*        outline;\r\n    PSH_Globals        globals;\r\n    PSH_Hint_TableRec  hint_tables[2];\r\n\r\n    FT_Bool            vertical;\r\n    FT_Int             major_dir;\r\n    FT_Int             minor_dir;\r\n\r\n    FT_Bool            do_horz_hints;\r\n    FT_Bool            do_vert_hints;\r\n    FT_Bool            do_horz_snapping;\r\n    FT_Bool            do_vert_snapping;\r\n    FT_Bool            do_stem_adjust;\r\n\r\n  } PSH_GlyphRec, *PSH_Glyph;\r\n\r\n\r\n#ifdef DEBUG_HINTER\r\n  extern PSH_Hint_Table  ps_debug_hint_table;\r\n\r\n  typedef void\r\n  (*PSH_HintFunc)( PSH_Hint  hint,\r\n                   FT_Bool   vertical );\r\n\r\n  extern PSH_HintFunc    ps_debug_hint_func;\r\n\r\n  extern PSH_Glyph       ps_debug_glyph;\r\n#endif\r\n\r\n\r\n  extern FT_Error\r\n  ps_hints_apply( PS_Hints        ps_hints,\r\n                  FT_Outline*     outline,\r\n                  PSH_Globals     globals,\r\n                  FT_Render_Mode  hint_mode );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PSHALGO_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshglob.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshglob.c                                                              */\r\n/*                                                                         */\r\n/*    PostScript hinter global hinting management (body).                  */\r\n/*    Inspired by the new auto-hinter module.                              */\r\n/*                                                                         */\r\n/*  Copyright 2001-2004, 2006, 2010, 2012 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used        */\r\n/*  modified and distributed under the terms of the FreeType project       */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"pshglob.h\"\r\n\r\n#ifdef DEBUG_HINTER\r\n  PSH_Globals  ps_debug_globals = 0;\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       STANDARD WIDTHS                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* scale the widths/heights table */\r\n  static void\r\n  psh_globals_scale_widths( PSH_Globals  globals,\r\n                            FT_UInt      direction )\r\n  {\r\n    PSH_Dimension  dim   = &globals->dimension[direction];\r\n    PSH_Widths     stdw  = &dim->stdw;\r\n    FT_UInt        count = stdw->count;\r\n    PSH_Width      width = stdw->widths;\r\n    PSH_Width      stand = width;               /* standard width/height */\r\n    FT_Fixed       scale = dim->scale_mult;\r\n\r\n\r\n    if ( count > 0 )\r\n    {\r\n      width->cur = FT_MulFix( width->org, scale );\r\n      width->fit = FT_PIX_ROUND( width->cur );\r\n\r\n      width++;\r\n      count--;\r\n\r\n      for ( ; count > 0; count--, width++ )\r\n      {\r\n        FT_Pos  w, dist;\r\n\r\n\r\n        w    = FT_MulFix( width->org, scale );\r\n        dist = w - stand->cur;\r\n\r\n        if ( dist < 0 )\r\n          dist = -dist;\r\n\r\n        if ( dist < 128 )\r\n          w = stand->cur;\r\n\r\n        width->cur = w;\r\n        width->fit = FT_PIX_ROUND( w );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  /* org_width is is font units, result in device pixels, 26.6 format */\r\n  FT_LOCAL_DEF( FT_Pos )\r\n  psh_dimension_snap_width( PSH_Dimension  dimension,\r\n                            FT_Int         org_width )\r\n  {\r\n    FT_UInt  n;\r\n    FT_Pos   width     = FT_MulFix( org_width, dimension->scale_mult );\r\n    FT_Pos   best      = 64 + 32 + 2;\r\n    FT_Pos   reference = width;\r\n\r\n\r\n    for ( n = 0; n < dimension->stdw.count; n++ )\r\n    {\r\n      FT_Pos  w;\r\n      FT_Pos  dist;\r\n\r\n\r\n      w = dimension->stdw.widths[n].cur;\r\n      dist = width - w;\r\n      if ( dist < 0 )\r\n        dist = -dist;\r\n      if ( dist < best )\r\n      {\r\n        best      = dist;\r\n        reference = w;\r\n      }\r\n    }\r\n\r\n    if ( width >= reference )\r\n    {\r\n      width -= 0x21;\r\n      if ( width < reference )\r\n        width = reference;\r\n    }\r\n    else\r\n    {\r\n      width += 0x21;\r\n      if ( width > reference )\r\n        width = reference;\r\n    }\r\n\r\n    return width;\r\n  }\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       BLUE ZONES                              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  psh_blues_set_zones_0( PSH_Blues       target,\r\n                         FT_Bool         is_others,\r\n                         FT_UInt         read_count,\r\n                         FT_Short*       read,\r\n                         PSH_Blue_Table  top_table,\r\n                         PSH_Blue_Table  bot_table )\r\n  {\r\n    FT_UInt  count_top = top_table->count;\r\n    FT_UInt  count_bot = bot_table->count;\r\n    FT_Bool  first     = 1;\r\n\r\n    FT_UNUSED( target );\r\n\r\n\r\n    for ( ; read_count > 1; read_count -= 2 )\r\n    {\r\n      FT_Int         reference, delta;\r\n      FT_UInt        count;\r\n      PSH_Blue_Zone  zones, zone;\r\n      FT_Bool        top;\r\n\r\n\r\n      /* read blue zone entry, and select target top/bottom zone */\r\n      top = 0;\r\n      if ( first || is_others )\r\n      {\r\n        reference = read[1];\r\n        delta     = read[0] - reference;\r\n\r\n        zones = bot_table->zones;\r\n        count = count_bot;\r\n        first = 0;\r\n      }\r\n      else\r\n      {\r\n        reference = read[0];\r\n        delta     = read[1] - reference;\r\n\r\n        zones = top_table->zones;\r\n        count = count_top;\r\n        top   = 1;\r\n      }\r\n\r\n      /* insert into sorted table */\r\n      zone = zones;\r\n      for ( ; count > 0; count--, zone++ )\r\n      {\r\n        if ( reference < zone->org_ref )\r\n          break;\r\n\r\n        if ( reference == zone->org_ref )\r\n        {\r\n          FT_Int  delta0 = zone->org_delta;\r\n\r\n\r\n          /* we have two zones on the same reference position -- */\r\n          /* only keep the largest one                           */\r\n          if ( delta < 0 )\r\n          {\r\n            if ( delta < delta0 )\r\n              zone->org_delta = delta;\r\n          }\r\n          else\r\n          {\r\n            if ( delta > delta0 )\r\n              zone->org_delta = delta;\r\n          }\r\n          goto Skip;\r\n        }\r\n      }\r\n\r\n      for ( ; count > 0; count-- )\r\n        zone[count] = zone[count-1];\r\n\r\n      zone->org_ref   = reference;\r\n      zone->org_delta = delta;\r\n\r\n      if ( top )\r\n        count_top++;\r\n      else\r\n        count_bot++;\r\n\r\n    Skip:\r\n      read += 2;\r\n    }\r\n\r\n    top_table->count = count_top;\r\n    bot_table->count = count_bot;\r\n  }\r\n\r\n\r\n  /* Re-read blue zones from the original fonts and store them into out */\r\n  /* private structure.  This function re-orders, sanitizes and         */\r\n  /* fuzz-expands the zones as well.                                    */\r\n  static void\r\n  psh_blues_set_zones( PSH_Blues  target,\r\n                       FT_UInt    count,\r\n                       FT_Short*  blues,\r\n                       FT_UInt    count_others,\r\n                       FT_Short*  other_blues,\r\n                       FT_Int     fuzz,\r\n                       FT_Int     family )\r\n  {\r\n    PSH_Blue_Table  top_table, bot_table;\r\n    FT_Int          count_top, count_bot;\r\n\r\n\r\n    if ( family )\r\n    {\r\n      top_table = &target->family_top;\r\n      bot_table = &target->family_bottom;\r\n    }\r\n    else\r\n    {\r\n      top_table = &target->normal_top;\r\n      bot_table = &target->normal_bottom;\r\n    }\r\n\r\n    /* read the input blue zones, and build two sorted tables  */\r\n    /* (one for the top zones, the other for the bottom zones) */\r\n    top_table->count = 0;\r\n    bot_table->count = 0;\r\n\r\n    /* first, the blues */\r\n    psh_blues_set_zones_0( target, 0,\r\n                           count, blues, top_table, bot_table );\r\n    psh_blues_set_zones_0( target, 1,\r\n                           count_others, other_blues, top_table, bot_table );\r\n\r\n    count_top = top_table->count;\r\n    count_bot = bot_table->count;\r\n\r\n    /* sanitize top table */\r\n    if ( count_top > 0 )\r\n    {\r\n      PSH_Blue_Zone  zone = top_table->zones;\r\n\r\n\r\n      for ( count = count_top; count > 0; count--, zone++ )\r\n      {\r\n        FT_Int  delta;\r\n\r\n\r\n        if ( count > 1 )\r\n        {\r\n          delta = zone[1].org_ref - zone[0].org_ref;\r\n          if ( zone->org_delta > delta )\r\n            zone->org_delta = delta;\r\n        }\r\n\r\n        zone->org_bottom = zone->org_ref;\r\n        zone->org_top    = zone->org_delta + zone->org_ref;\r\n      }\r\n    }\r\n\r\n    /* sanitize bottom table */\r\n    if ( count_bot > 0 )\r\n    {\r\n      PSH_Blue_Zone  zone = bot_table->zones;\r\n\r\n\r\n      for ( count = count_bot; count > 0; count--, zone++ )\r\n      {\r\n        FT_Int  delta;\r\n\r\n\r\n        if ( count > 1 )\r\n        {\r\n          delta = zone[0].org_ref - zone[1].org_ref;\r\n          if ( zone->org_delta < delta )\r\n            zone->org_delta = delta;\r\n        }\r\n\r\n        zone->org_top    = zone->org_ref;\r\n        zone->org_bottom = zone->org_delta + zone->org_ref;\r\n      }\r\n    }\r\n\r\n    /* expand top and bottom tables with blue fuzz */\r\n    {\r\n      FT_Int         dim, top, bot, delta;\r\n      PSH_Blue_Zone  zone;\r\n\r\n\r\n      zone  = top_table->zones;\r\n      count = count_top;\r\n\r\n      for ( dim = 1; dim >= 0; dim-- )\r\n      {\r\n        if ( count > 0 )\r\n        {\r\n          /* expand the bottom of the lowest zone normally */\r\n          zone->org_bottom -= fuzz;\r\n\r\n          /* expand the top and bottom of intermediate zones;    */\r\n          /* checking that the interval is smaller than the fuzz */\r\n          top = zone->org_top;\r\n\r\n          for ( count--; count > 0; count-- )\r\n          {\r\n            bot   = zone[1].org_bottom;\r\n            delta = bot - top;\r\n\r\n            if ( delta < 2 * fuzz )\r\n              zone[0].org_top = zone[1].org_bottom = top + delta / 2;\r\n            else\r\n            {\r\n              zone[0].org_top    = top + fuzz;\r\n              zone[1].org_bottom = bot - fuzz;\r\n            }\r\n\r\n            zone++;\r\n            top = zone->org_top;\r\n          }\r\n\r\n          /* expand the top of the highest zone normally */\r\n          zone->org_top = top + fuzz;\r\n        }\r\n        zone  = bot_table->zones;\r\n        count = count_bot;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* reset the blues table when the device transform changes */\r\n  static void\r\n  psh_blues_scale_zones( PSH_Blues  blues,\r\n                         FT_Fixed   scale,\r\n                         FT_Pos     delta )\r\n  {\r\n    FT_UInt         count;\r\n    FT_UInt         num;\r\n    PSH_Blue_Table  table = 0;\r\n\r\n    /*                                                        */\r\n    /* Determine whether we need to suppress overshoots or    */\r\n    /* not.  We simply need to compare the vertical scale     */\r\n    /* parameter to the raw bluescale value.  Here is why:    */\r\n    /*                                                        */\r\n    /*   We need to suppress overshoots for all pointsizes.   */\r\n    /*   At 300dpi that satisfies:                            */\r\n    /*                                                        */\r\n    /*      pointsize < 240*bluescale + 0.49                  */\r\n    /*                                                        */\r\n    /*   This corresponds to:                                 */\r\n    /*                                                        */\r\n    /*      pixelsize < 1000*bluescale + 49/24                */\r\n    /*                                                        */\r\n    /*      scale*EM_Size < 1000*bluescale + 49/24            */\r\n    /*                                                        */\r\n    /*   However, for normal Type 1 fonts, EM_Size is 1000!   */\r\n    /*   We thus only check:                                  */\r\n    /*                                                        */\r\n    /*      scale < bluescale + 49/24000                      */\r\n    /*                                                        */\r\n    /*   which we shorten to                                  */\r\n    /*                                                        */\r\n    /*      \"scale < bluescale\"                               */\r\n    /*                                                        */\r\n    /* Note that `blue_scale' is stored 1000 times its real   */\r\n    /* value, and that `scale' converts from font units to    */\r\n    /* fractional pixels.                                     */\r\n    /*                                                        */\r\n\r\n    /* 1000 / 64 = 125 / 8 */\r\n    if ( scale >= 0x20C49BAL )\r\n      blues->no_overshoots = FT_BOOL( scale < blues->blue_scale * 8 / 125 );\r\n    else\r\n      blues->no_overshoots = FT_BOOL( scale * 125 < blues->blue_scale * 8 );\r\n\r\n    /*                                                        */\r\n    /*  The blue threshold is the font units distance under   */\r\n    /*  which overshoots are suppressed due to the BlueShift  */\r\n    /*  even if the scale is greater than BlueScale.          */\r\n    /*                                                        */\r\n    /*  It is the smallest distance such that                 */\r\n    /*                                                        */\r\n    /*    dist <= BlueShift && dist*scale <= 0.5 pixels       */\r\n    /*                                                        */\r\n    {\r\n      FT_Int  threshold = blues->blue_shift;\r\n\r\n\r\n      while ( threshold > 0 && FT_MulFix( threshold, scale ) > 32 )\r\n        threshold--;\r\n\r\n      blues->blue_threshold = threshold;\r\n    }\r\n\r\n    for ( num = 0; num < 4; num++ )\r\n    {\r\n      PSH_Blue_Zone  zone;\r\n\r\n\r\n      switch ( num )\r\n      {\r\n      case 0:\r\n        table = &blues->normal_top;\r\n        break;\r\n      case 1:\r\n        table = &blues->normal_bottom;\r\n        break;\r\n      case 2:\r\n        table = &blues->family_top;\r\n        break;\r\n      default:\r\n        table = &blues->family_bottom;\r\n        break;\r\n      }\r\n\r\n      zone  = table->zones;\r\n      count = table->count;\r\n      for ( ; count > 0; count--, zone++ )\r\n      {\r\n        zone->cur_top    = FT_MulFix( zone->org_top,    scale ) + delta;\r\n        zone->cur_bottom = FT_MulFix( zone->org_bottom, scale ) + delta;\r\n        zone->cur_ref    = FT_MulFix( zone->org_ref,    scale ) + delta;\r\n        zone->cur_delta  = FT_MulFix( zone->org_delta,  scale );\r\n\r\n        /* round scaled reference position */\r\n        zone->cur_ref = FT_PIX_ROUND( zone->cur_ref );\r\n\r\n#if 0\r\n        if ( zone->cur_ref > zone->cur_top )\r\n          zone->cur_ref -= 64;\r\n        else if ( zone->cur_ref < zone->cur_bottom )\r\n          zone->cur_ref += 64;\r\n#endif\r\n      }\r\n    }\r\n\r\n    /* process the families now */\r\n\r\n    for ( num = 0; num < 2; num++ )\r\n    {\r\n      PSH_Blue_Zone   zone1, zone2;\r\n      FT_UInt         count1, count2;\r\n      PSH_Blue_Table  normal, family;\r\n\r\n\r\n      switch ( num )\r\n      {\r\n      case 0:\r\n        normal = &blues->normal_top;\r\n        family = &blues->family_top;\r\n        break;\r\n\r\n      default:\r\n        normal = &blues->normal_bottom;\r\n        family = &blues->family_bottom;\r\n      }\r\n\r\n      zone1  = normal->zones;\r\n      count1 = normal->count;\r\n\r\n      for ( ; count1 > 0; count1--, zone1++ )\r\n      {\r\n        /* try to find a family zone whose reference position is less */\r\n        /* than 1 pixel far from the current zone                     */\r\n        zone2  = family->zones;\r\n        count2 = family->count;\r\n\r\n        for ( ; count2 > 0; count2--, zone2++ )\r\n        {\r\n          FT_Pos  Delta;\r\n\r\n\r\n          Delta = zone1->org_ref - zone2->org_ref;\r\n          if ( Delta < 0 )\r\n            Delta = -Delta;\r\n\r\n          if ( FT_MulFix( Delta, scale ) < 64 )\r\n          {\r\n            zone1->cur_top    = zone2->cur_top;\r\n            zone1->cur_bottom = zone2->cur_bottom;\r\n            zone1->cur_ref    = zone2->cur_ref;\r\n            zone1->cur_delta  = zone2->cur_delta;\r\n            break;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* calculate the maximum height of given blue zones */\r\n  static FT_Short\r\n  psh_calc_max_height( FT_UInt          num,\r\n                       const FT_Short*  values,\r\n                       FT_Short         cur_max )\r\n  {\r\n    FT_UInt  count;\r\n\r\n\r\n    for ( count = 0; count < num; count += 2 )\r\n    {\r\n      FT_Short  cur_height = values[count + 1] - values[count];\r\n\r\n\r\n      if ( cur_height > cur_max )\r\n        cur_max = cur_height;\r\n    }\r\n\r\n    return cur_max;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  psh_blues_snap_stem( PSH_Blues      blues,\r\n                       FT_Int         stem_top,\r\n                       FT_Int         stem_bot,\r\n                       PSH_Alignment  alignment )\r\n  {\r\n    PSH_Blue_Table  table;\r\n    FT_UInt         count;\r\n    FT_Pos          delta;\r\n    PSH_Blue_Zone   zone;\r\n    FT_Int          no_shoots;\r\n\r\n\r\n    alignment->align = PSH_BLUE_ALIGN_NONE;\r\n\r\n    no_shoots = blues->no_overshoots;\r\n\r\n    /* look up stem top in top zones table */\r\n    table = &blues->normal_top;\r\n    count = table->count;\r\n    zone  = table->zones;\r\n\r\n    for ( ; count > 0; count--, zone++ )\r\n    {\r\n      delta = stem_top - zone->org_bottom;\r\n      if ( delta < -blues->blue_fuzz )\r\n        break;\r\n\r\n      if ( stem_top <= zone->org_top + blues->blue_fuzz )\r\n      {\r\n        if ( no_shoots || delta <= blues->blue_threshold )\r\n        {\r\n          alignment->align    |= PSH_BLUE_ALIGN_TOP;\r\n          alignment->align_top = zone->cur_ref;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* look up stem bottom in bottom zones table */\r\n    table = &blues->normal_bottom;\r\n    count = table->count;\r\n    zone  = table->zones + count-1;\r\n\r\n    for ( ; count > 0; count--, zone-- )\r\n    {\r\n      delta = zone->org_top - stem_bot;\r\n      if ( delta < -blues->blue_fuzz )\r\n        break;\r\n\r\n      if ( stem_bot >= zone->org_bottom - blues->blue_fuzz )\r\n      {\r\n        if ( no_shoots || delta < blues->blue_threshold )\r\n        {\r\n          alignment->align    |= PSH_BLUE_ALIGN_BOT;\r\n          alignment->align_bot = zone->cur_ref;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        GLOBAL HINTS                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  psh_globals_destroy( PSH_Globals  globals )\r\n  {\r\n    if ( globals )\r\n    {\r\n      FT_Memory  memory;\r\n\r\n\r\n      memory = globals->memory;\r\n      globals->dimension[0].stdw.count = 0;\r\n      globals->dimension[1].stdw.count = 0;\r\n\r\n      globals->blues.normal_top.count    = 0;\r\n      globals->blues.normal_bottom.count = 0;\r\n      globals->blues.family_top.count    = 0;\r\n      globals->blues.family_bottom.count = 0;\r\n\r\n      FT_FREE( globals );\r\n\r\n#ifdef DEBUG_HINTER\r\n      ps_debug_globals = 0;\r\n#endif\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  psh_globals_new( FT_Memory     memory,\r\n                   T1_Private*   priv,\r\n                   PSH_Globals  *aglobals )\r\n  {\r\n    PSH_Globals  globals = NULL;\r\n    FT_Error     error;\r\n\r\n\r\n    if ( !FT_NEW( globals ) )\r\n    {\r\n      FT_UInt    count;\r\n      FT_Short*  read;\r\n\r\n\r\n      globals->memory = memory;\r\n\r\n      /* copy standard widths */\r\n      {\r\n        PSH_Dimension  dim   = &globals->dimension[1];\r\n        PSH_Width      write = dim->stdw.widths;\r\n\r\n\r\n        write->org = priv->standard_width[0];\r\n        write++;\r\n\r\n        read = priv->snap_widths;\r\n        for ( count = priv->num_snap_widths; count > 0; count-- )\r\n        {\r\n          write->org = *read;\r\n          write++;\r\n          read++;\r\n        }\r\n\r\n        dim->stdw.count = priv->num_snap_widths + 1;\r\n      }\r\n\r\n      /* copy standard heights */\r\n      {\r\n        PSH_Dimension  dim = &globals->dimension[0];\r\n        PSH_Width      write = dim->stdw.widths;\r\n\r\n\r\n        write->org = priv->standard_height[0];\r\n        write++;\r\n        read = priv->snap_heights;\r\n        for ( count = priv->num_snap_heights; count > 0; count-- )\r\n        {\r\n          write->org = *read;\r\n          write++;\r\n          read++;\r\n        }\r\n\r\n        dim->stdw.count = priv->num_snap_heights + 1;\r\n      }\r\n\r\n      /* copy blue zones */\r\n      psh_blues_set_zones( &globals->blues, priv->num_blue_values,\r\n                           priv->blue_values, priv->num_other_blues,\r\n                           priv->other_blues, priv->blue_fuzz, 0 );\r\n\r\n      psh_blues_set_zones( &globals->blues, priv->num_family_blues,\r\n                           priv->family_blues, priv->num_family_other_blues,\r\n                           priv->family_other_blues, priv->blue_fuzz, 1 );\r\n\r\n      /* limit the BlueScale value to `1 / max_of_blue_zone_heights' */\r\n      {\r\n        FT_Fixed  max_scale;\r\n        FT_Short  max_height = 1;\r\n\r\n\r\n        max_height = psh_calc_max_height( priv->num_blue_values,\r\n                                          priv->blue_values,\r\n                                          max_height );\r\n        max_height = psh_calc_max_height( priv->num_other_blues,\r\n                                          priv->other_blues,\r\n                                          max_height );\r\n        max_height = psh_calc_max_height( priv->num_family_blues,\r\n                                          priv->family_blues,\r\n                                          max_height );\r\n        max_height = psh_calc_max_height( priv->num_family_other_blues,\r\n                                          priv->family_other_blues,\r\n                                          max_height );\r\n\r\n        /* BlueScale is scaled 1000 times */\r\n        max_scale = FT_DivFix( 1000, max_height );\r\n        globals->blues.blue_scale = priv->blue_scale < max_scale\r\n                                      ? priv->blue_scale\r\n                                      : max_scale;\r\n      }\r\n\r\n      globals->blues.blue_shift = priv->blue_shift;\r\n      globals->blues.blue_fuzz  = priv->blue_fuzz;\r\n\r\n      globals->dimension[0].scale_mult  = 0;\r\n      globals->dimension[0].scale_delta = 0;\r\n      globals->dimension[1].scale_mult  = 0;\r\n      globals->dimension[1].scale_delta = 0;\r\n\r\n#ifdef DEBUG_HINTER\r\n      ps_debug_globals = globals;\r\n#endif\r\n    }\r\n\r\n    *aglobals = globals;\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  psh_globals_set_scale( PSH_Globals  globals,\r\n                         FT_Fixed     x_scale,\r\n                         FT_Fixed     y_scale,\r\n                         FT_Fixed     x_delta,\r\n                         FT_Fixed     y_delta )\r\n  {\r\n    PSH_Dimension  dim = &globals->dimension[0];\r\n\r\n\r\n    dim = &globals->dimension[0];\r\n    if ( x_scale != dim->scale_mult  ||\r\n         x_delta != dim->scale_delta )\r\n    {\r\n      dim->scale_mult  = x_scale;\r\n      dim->scale_delta = x_delta;\r\n\r\n      psh_globals_scale_widths( globals, 0 );\r\n    }\r\n\r\n    dim = &globals->dimension[1];\r\n    if ( y_scale != dim->scale_mult  ||\r\n         y_delta != dim->scale_delta )\r\n    {\r\n      dim->scale_mult  = y_scale;\r\n      dim->scale_delta = y_delta;\r\n\r\n      psh_globals_scale_widths( globals, 1 );\r\n      psh_blues_scale_zones( &globals->blues, y_scale, y_delta );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  psh_globals_funcs_init( PSH_Globals_FuncsRec*  funcs )\r\n  {\r\n    funcs->create    = psh_globals_new;\r\n    funcs->set_scale = psh_globals_set_scale;\r\n    funcs->destroy   = psh_globals_destroy;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshglob.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshglob.h                                                              */\r\n/*                                                                         */\r\n/*    PostScript hinter global hinting management.                         */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSHGLOB_H__\r\n#define __PSHGLOB_H__\r\n\r\n\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    GLOBAL HINTS INTERNALS                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* @constant:                                                            */\r\n  /*    PS_GLOBALS_MAX_BLUE_ZONES                                          */\r\n  /*                                                                       */\r\n  /* @description:                                                         */\r\n  /*    The maximum number of blue zones in a font global hints structure. */\r\n  /*    See @PS_Globals_BluesRec.                                          */\r\n  /*                                                                       */\r\n#define PS_GLOBALS_MAX_BLUE_ZONES  16\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* @constant:                                                            */\r\n  /*    PS_GLOBALS_MAX_STD_WIDTHS                                          */\r\n  /*                                                                       */\r\n  /* @description:                                                         */\r\n  /*    The maximum number of standard and snap widths in either the       */\r\n  /*    horizontal or vertical direction.  See @PS_Globals_WidthsRec.      */\r\n  /*                                                                       */\r\n#define PS_GLOBALS_MAX_STD_WIDTHS  16\r\n\r\n\r\n  /* standard and snap width */\r\n  typedef struct  PSH_WidthRec_\r\n  {\r\n    FT_Int  org;\r\n    FT_Pos  cur;\r\n    FT_Pos  fit;\r\n\r\n  } PSH_WidthRec, *PSH_Width;\r\n\r\n\r\n  /* standard and snap widths table */\r\n  typedef struct  PSH_WidthsRec_\r\n  {\r\n    FT_UInt       count;\r\n    PSH_WidthRec  widths[PS_GLOBALS_MAX_STD_WIDTHS];\r\n\r\n  } PSH_WidthsRec, *PSH_Widths;\r\n\r\n\r\n  typedef struct  PSH_DimensionRec_\r\n  {\r\n    PSH_WidthsRec  stdw;\r\n    FT_Fixed       scale_mult;\r\n    FT_Fixed       scale_delta;\r\n\r\n  } PSH_DimensionRec, *PSH_Dimension;\r\n\r\n\r\n  /* blue zone descriptor */\r\n  typedef struct  PSH_Blue_ZoneRec_\r\n  {\r\n    FT_Int  org_ref;\r\n    FT_Int  org_delta;\r\n    FT_Int  org_top;\r\n    FT_Int  org_bottom;\r\n\r\n    FT_Pos  cur_ref;\r\n    FT_Pos  cur_delta;\r\n    FT_Pos  cur_bottom;\r\n    FT_Pos  cur_top;\r\n\r\n  } PSH_Blue_ZoneRec, *PSH_Blue_Zone;\r\n\r\n\r\n  typedef struct  PSH_Blue_TableRec_\r\n  {\r\n    FT_UInt           count;\r\n    PSH_Blue_ZoneRec  zones[PS_GLOBALS_MAX_BLUE_ZONES];\r\n\r\n  } PSH_Blue_TableRec, *PSH_Blue_Table;\r\n\r\n\r\n  /* blue zones table */\r\n  typedef struct  PSH_BluesRec_\r\n  {\r\n    PSH_Blue_TableRec  normal_top;\r\n    PSH_Blue_TableRec  normal_bottom;\r\n    PSH_Blue_TableRec  family_top;\r\n    PSH_Blue_TableRec  family_bottom;\r\n\r\n    FT_Fixed           blue_scale;\r\n    FT_Int             blue_shift;\r\n    FT_Int             blue_threshold;\r\n    FT_Int             blue_fuzz;\r\n    FT_Bool            no_overshoots;\r\n\r\n  } PSH_BluesRec, *PSH_Blues;\r\n\r\n\r\n  /* font globals.                                         */\r\n  /* dimension 0 => X coordinates + vertical hints/stems   */\r\n  /* dimension 1 => Y coordinates + horizontal hints/stems */\r\n  typedef struct  PSH_GlobalsRec_\r\n  {\r\n    FT_Memory         memory;\r\n    PSH_DimensionRec  dimension[2];\r\n    PSH_BluesRec      blues;\r\n\r\n  } PSH_GlobalsRec;\r\n\r\n\r\n#define PSH_BLUE_ALIGN_NONE  0\r\n#define PSH_BLUE_ALIGN_TOP   1\r\n#define PSH_BLUE_ALIGN_BOT   2\r\n\r\n\r\n  typedef struct  PSH_AlignmentRec_\r\n  {\r\n    int     align;\r\n    FT_Pos  align_top;\r\n    FT_Pos  align_bot;\r\n\r\n  } PSH_AlignmentRec, *PSH_Alignment;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  psh_globals_funcs_init( PSH_Globals_FuncsRec*  funcs );\r\n\r\n\r\n#if 0\r\n  /* snap a stem width to fitter coordinates.  `org_width' is in font */\r\n  /* units.  The result is in device pixels (26.6 format).            */\r\n  FT_LOCAL( FT_Pos )\r\n  psh_dimension_snap_width( PSH_Dimension  dimension,\r\n                            FT_Int         org_width );\r\n#endif\r\n\r\n  FT_LOCAL( FT_Error )\r\n  psh_globals_set_scale( PSH_Globals  globals,\r\n                         FT_Fixed     x_scale,\r\n                         FT_Fixed     y_scale,\r\n                         FT_Fixed     x_delta,\r\n                         FT_Fixed     y_delta );\r\n\r\n  /* snap a stem to one or two blue zones */\r\n  FT_LOCAL( void )\r\n  psh_blues_snap_stem( PSH_Blues      blues,\r\n                       FT_Int         stem_top,\r\n                       FT_Int         stem_bot,\r\n                       PSH_Alignment  alignment );\r\n  /* */\r\n\r\n#ifdef DEBUG_HINTER\r\n  extern PSH_Globals  ps_debug_globals;\r\n#endif\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PSHGLOB_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshinter.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshinter.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType PostScript Hinting module                                   */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2003 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"pshpic.c\"\r\n#include \"pshrec.c\"\r\n#include \"pshglob.c\"\r\n#include \"pshalgo.c\"\r\n#include \"pshmod.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshmod.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshmod.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType PostScript hinter module implementation (body).             */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2007, 2009, 2012 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"pshrec.h\"\r\n#include \"pshalgo.h\"\r\n#include \"pshpic.h\"\r\n\r\n\r\n  /* the Postscript Hinter module structure */\r\n  typedef struct  PS_Hinter_Module_Rec_\r\n  {\r\n    FT_ModuleRec          root;\r\n    PS_HintsRec           ps_hints;\r\n\r\n    PSH_Globals_FuncsRec  globals_funcs;\r\n    T1_Hints_FuncsRec     t1_funcs;\r\n    T2_Hints_FuncsRec     t2_funcs;\r\n\r\n  } PS_Hinter_ModuleRec, *PS_Hinter_Module;\r\n\r\n\r\n  /* finalize module */\r\n  FT_CALLBACK_DEF( void )\r\n  ps_hinter_done( PS_Hinter_Module  module )\r\n  {\r\n    module->t1_funcs.hints = NULL;\r\n    module->t2_funcs.hints = NULL;\r\n\r\n    ps_hints_done( &module->ps_hints );\r\n  }\r\n\r\n\r\n  /* initialize module, create hints recorder and the interface */\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  ps_hinter_init( PS_Hinter_Module  module )\r\n  {\r\n    FT_Memory  memory = module->root.memory;\r\n    void*      ph     = &module->ps_hints;\r\n\r\n\r\n    ps_hints_init( &module->ps_hints, memory );\r\n\r\n    psh_globals_funcs_init( &module->globals_funcs );\r\n\r\n    t1_hints_funcs_init( &module->t1_funcs );\r\n    module->t1_funcs.hints = (T1_Hints)ph;\r\n\r\n    t2_hints_funcs_init( &module->t2_funcs );\r\n    module->t2_funcs.hints = (T2_Hints)ph;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /* returns global hints interface */\r\n  FT_CALLBACK_DEF( PSH_Globals_Funcs )\r\n  pshinter_get_globals_funcs( FT_Module  module )\r\n  {\r\n    return &((PS_Hinter_Module)module)->globals_funcs;\r\n  }\r\n\r\n\r\n  /* return Type 1 hints interface */\r\n  FT_CALLBACK_DEF( T1_Hints_Funcs )\r\n  pshinter_get_t1_funcs( FT_Module  module )\r\n  {\r\n    return &((PS_Hinter_Module)module)->t1_funcs;\r\n  }\r\n\r\n\r\n  /* return Type 2 hints interface */\r\n  FT_CALLBACK_DEF( T2_Hints_Funcs )\r\n  pshinter_get_t2_funcs( FT_Module  module )\r\n  {\r\n    return &((PS_Hinter_Module)module)->t2_funcs;\r\n  }\r\n\r\n\r\n  FT_DEFINE_PSHINTER_INTERFACE(\r\n    pshinter_interface,\r\n    pshinter_get_globals_funcs,\r\n    pshinter_get_t1_funcs,\r\n    pshinter_get_t2_funcs )\r\n\r\n\r\n  FT_DEFINE_MODULE(\r\n    pshinter_module_class,\r\n\r\n    0,\r\n    sizeof ( PS_Hinter_ModuleRec ),\r\n    \"pshinter\",\r\n    0x10000L,\r\n    0x20000L,\r\n\r\n    &PSHINTER_INTERFACE_GET,              /* module-specific interface */\r\n\r\n    (FT_Module_Constructor)ps_hinter_init,\r\n    (FT_Module_Destructor) ps_hinter_done,\r\n    (FT_Module_Requester)  NULL )   /* no additional interface for now */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshmod.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshmod.h                                                               */\r\n/*                                                                         */\r\n/*    PostScript hinter module interface (specification).                  */\r\n/*                                                                         */\r\n/*  Copyright 2001 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSHMOD_H__\r\n#define __PSHMOD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_DECLARE_MODULE( pshinter_module_class )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PSHMOD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshnterr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshnterr.h                                                             */\r\n/*                                                                         */\r\n/*    PS Hinter error codes (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the PSHinter error enumeration constants. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __PSHNTERR_H__\r\n#define __PSHNTERR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  PSH_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_PShinter\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __PSHNTERR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshpic.c                                                               */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for pshinter module. */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"pshpic.h\"\r\n#include \"pshnterr.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from pshmod.c */\r\n  void\r\n  FT_Init_Class_pshinter_interface( FT_Library           library,\r\n                                    PSHinter_Interface*  clazz );\r\n\r\n  void\r\n  pshinter_module_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    if ( pic_container->pshinter )\r\n    {\r\n      FT_FREE( pic_container->pshinter );\r\n      pic_container->pshinter = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  pshinter_module_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = PSH_Err_Ok;\r\n    PSHinterPIC*       container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->pshinter = container;\r\n\r\n    /* add call to initialization function when you add new scripts */\r\n    FT_Init_Class_pshinter_interface(\r\n      library, &container->pshinter_interface );\r\n\r\n    if( error )\r\n      pshinter_module_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshpic.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for pshinter module. */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSHPIC_H__\r\n#define __PSHPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define PSHINTER_INTERFACE_GET  pshinter_interface\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n  typedef struct  PSHinterPIC_\r\n  {\r\n    PSHinter_Interface  pshinter_interface;\r\n\r\n  } PSHinterPIC;\r\n\r\n\r\n#define GET_PIC( lib )  ( (PSHinterPIC*)((lib)->pic_container.autofit) )\r\n\r\n#define PSHINTER_INTERFACE_GET  ( GET_PIC( library )->pshinter_interface )\r\n\r\n  /* see pshpic.c for the implementation */\r\n  void\r\n  pshinter_module_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  pshinter_module_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSHPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshrec.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshrec.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType PostScript hints recorder (body).                           */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2004, 2007, 2009 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n\r\n#include \"pshrec.h\"\r\n#include \"pshalgo.h\"\r\n\r\n#include \"pshnterr.h\"\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_pshrec\r\n\r\n#ifdef DEBUG_HINTER\r\n  PS_Hints  ps_debug_hints         = 0;\r\n  int       ps_debug_no_horz_hints = 0;\r\n  int       ps_debug_no_vert_hints = 0;\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      PS_HINT MANAGEMENT                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* destroy hints table */\r\n  static void\r\n  ps_hint_table_done( PS_Hint_Table  table,\r\n                      FT_Memory      memory )\r\n  {\r\n    FT_FREE( table->hints );\r\n    table->num_hints = 0;\r\n    table->max_hints = 0;\r\n  }\r\n\r\n\r\n  /* ensure that a table can contain \"count\" elements */\r\n  static FT_Error\r\n  ps_hint_table_ensure( PS_Hint_Table  table,\r\n                        FT_UInt        count,\r\n                        FT_Memory      memory )\r\n  {\r\n    FT_UInt   old_max = table->max_hints;\r\n    FT_UInt   new_max = count;\r\n    FT_Error  error   = PSH_Err_Ok;\r\n\r\n\r\n    if ( new_max > old_max )\r\n    {\r\n      /* try to grow the table */\r\n      new_max = FT_PAD_CEIL( new_max, 8 );\r\n      if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )\r\n        table->max_hints = new_max;\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  ps_hint_table_alloc( PS_Hint_Table  table,\r\n                       FT_Memory      memory,\r\n                       PS_Hint       *ahint )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n    FT_UInt   count;\r\n    PS_Hint   hint = 0;\r\n\r\n\r\n    count = table->num_hints;\r\n    count++;\r\n\r\n    if ( count >= table->max_hints )\r\n    {\r\n      error = ps_hint_table_ensure( table, count, memory );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    hint        = table->hints + count - 1;\r\n    hint->pos   = 0;\r\n    hint->len   = 0;\r\n    hint->flags = 0;\r\n\r\n    table->num_hints = count;\r\n\r\n  Exit:\r\n    *ahint = hint;\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      PS_MASK MANAGEMENT                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* destroy mask */\r\n  static void\r\n  ps_mask_done( PS_Mask    mask,\r\n                FT_Memory  memory )\r\n  {\r\n    FT_FREE( mask->bytes );\r\n    mask->num_bits  = 0;\r\n    mask->max_bits  = 0;\r\n    mask->end_point = 0;\r\n  }\r\n\r\n\r\n  /* ensure that a mask can contain \"count\" bits */\r\n  static FT_Error\r\n  ps_mask_ensure( PS_Mask    mask,\r\n                  FT_UInt    count,\r\n                  FT_Memory  memory )\r\n  {\r\n    FT_UInt   old_max = ( mask->max_bits + 7 ) >> 3;\r\n    FT_UInt   new_max = ( count          + 7 ) >> 3;\r\n    FT_Error  error   = PSH_Err_Ok;\r\n\r\n\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = FT_PAD_CEIL( new_max, 8 );\r\n      if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )\r\n        mask->max_bits = new_max * 8;\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  /* test a bit value in a given mask */\r\n  static FT_Int\r\n  ps_mask_test_bit( PS_Mask  mask,\r\n                    FT_Int   idx )\r\n  {\r\n    if ( (FT_UInt)idx >= mask->num_bits )\r\n      return 0;\r\n\r\n    return mask->bytes[idx >> 3] & ( 0x80 >> ( idx & 7 ) );\r\n  }\r\n\r\n\r\n  /* clear a given bit */\r\n  static void\r\n  ps_mask_clear_bit( PS_Mask  mask,\r\n                     FT_Int   idx )\r\n  {\r\n    FT_Byte*  p;\r\n\r\n\r\n    if ( (FT_UInt)idx >= mask->num_bits )\r\n      return;\r\n\r\n    p    = mask->bytes + ( idx >> 3 );\r\n    p[0] = (FT_Byte)( p[0] & ~( 0x80 >> ( idx & 7 ) ) );\r\n  }\r\n\r\n\r\n  /* set a given bit, possibly grow the mask */\r\n  static FT_Error\r\n  ps_mask_set_bit( PS_Mask    mask,\r\n                   FT_Int     idx,\r\n                   FT_Memory  memory )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n    FT_Byte*  p;\r\n\r\n\r\n    if ( idx < 0 )\r\n      goto Exit;\r\n\r\n    if ( (FT_UInt)idx >= mask->num_bits )\r\n    {\r\n      error = ps_mask_ensure( mask, idx + 1, memory );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      mask->num_bits = idx + 1;\r\n    }\r\n\r\n    p    = mask->bytes + ( idx >> 3 );\r\n    p[0] = (FT_Byte)( p[0] | ( 0x80 >> ( idx & 7 ) ) );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* destroy mask table */\r\n  static void\r\n  ps_mask_table_done( PS_Mask_Table  table,\r\n                      FT_Memory      memory )\r\n  {\r\n    FT_UInt  count = table->max_masks;\r\n    PS_Mask  mask  = table->masks;\r\n\r\n\r\n    for ( ; count > 0; count--, mask++ )\r\n      ps_mask_done( mask, memory );\r\n\r\n    FT_FREE( table->masks );\r\n    table->num_masks = 0;\r\n    table->max_masks = 0;\r\n  }\r\n\r\n\r\n  /* ensure that a mask table can contain \"count\" masks */\r\n  static FT_Error\r\n  ps_mask_table_ensure( PS_Mask_Table  table,\r\n                        FT_UInt        count,\r\n                        FT_Memory      memory )\r\n  {\r\n    FT_UInt   old_max = table->max_masks;\r\n    FT_UInt   new_max = count;\r\n    FT_Error  error   = PSH_Err_Ok;\r\n\r\n\r\n    if ( new_max > old_max )\r\n    {\r\n      new_max = FT_PAD_CEIL( new_max, 8 );\r\n      if ( !FT_RENEW_ARRAY( table->masks, old_max, new_max ) )\r\n        table->max_masks = new_max;\r\n    }\r\n    return error;\r\n  }\r\n\r\n\r\n  /* allocate a new mask in a table */\r\n  static FT_Error\r\n  ps_mask_table_alloc( PS_Mask_Table  table,\r\n                       FT_Memory      memory,\r\n                       PS_Mask       *amask )\r\n  {\r\n    FT_UInt   count;\r\n    FT_Error  error = PSH_Err_Ok;\r\n    PS_Mask   mask  = 0;\r\n\r\n\r\n    count = table->num_masks;\r\n    count++;\r\n\r\n    if ( count > table->max_masks )\r\n    {\r\n      error = ps_mask_table_ensure( table, count, memory );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    mask             = table->masks + count - 1;\r\n    mask->num_bits   = 0;\r\n    mask->end_point  = 0;\r\n    table->num_masks = count;\r\n\r\n  Exit:\r\n    *amask = mask;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* return last hint mask in a table, create one if the table is empty */\r\n  static FT_Error\r\n  ps_mask_table_last( PS_Mask_Table  table,\r\n                      FT_Memory      memory,\r\n                      PS_Mask       *amask )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n    FT_UInt   count;\r\n    PS_Mask   mask;\r\n\r\n\r\n    count = table->num_masks;\r\n    if ( count == 0 )\r\n    {\r\n      error = ps_mask_table_alloc( table, memory, &mask );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n    else\r\n      mask = table->masks + count - 1;\r\n\r\n  Exit:\r\n    *amask = mask;\r\n    return error;\r\n  }\r\n\r\n\r\n  /* set a new mask to a given bit range */\r\n  static FT_Error\r\n  ps_mask_table_set_bits( PS_Mask_Table   table,\r\n                          const FT_Byte*  source,\r\n                          FT_UInt         bit_pos,\r\n                          FT_UInt         bit_count,\r\n                          FT_Memory       memory )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n    PS_Mask   mask;\r\n\r\n\r\n    error = ps_mask_table_last( table, memory, &mask );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = ps_mask_ensure( mask, bit_count, memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    mask->num_bits = bit_count;\r\n\r\n    /* now, copy bits */\r\n    {\r\n      FT_Byte*  read  = (FT_Byte*)source + ( bit_pos >> 3 );\r\n      FT_Int    rmask = 0x80 >> ( bit_pos & 7 );\r\n      FT_Byte*  write = mask->bytes;\r\n      FT_Int    wmask = 0x80;\r\n      FT_Int    val;\r\n\r\n\r\n      for ( ; bit_count > 0; bit_count-- )\r\n      {\r\n        val = write[0] & ~wmask;\r\n\r\n        if ( read[0] & rmask )\r\n          val |= wmask;\r\n\r\n        write[0] = (FT_Byte)val;\r\n\r\n        rmask >>= 1;\r\n        if ( rmask == 0 )\r\n        {\r\n          read++;\r\n          rmask = 0x80;\r\n        }\r\n\r\n        wmask >>= 1;\r\n        if ( wmask == 0 )\r\n        {\r\n          write++;\r\n          wmask = 0x80;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* test whether two masks in a table intersect */\r\n  static FT_Int\r\n  ps_mask_table_test_intersect( PS_Mask_Table  table,\r\n                                FT_Int         index1,\r\n                                FT_Int         index2 )\r\n  {\r\n    PS_Mask   mask1  = table->masks + index1;\r\n    PS_Mask   mask2  = table->masks + index2;\r\n    FT_Byte*  p1     = mask1->bytes;\r\n    FT_Byte*  p2     = mask2->bytes;\r\n    FT_UInt   count1 = mask1->num_bits;\r\n    FT_UInt   count2 = mask2->num_bits;\r\n    FT_UInt   count;\r\n\r\n\r\n    count = ( count1 <= count2 ) ? count1 : count2;\r\n    for ( ; count >= 8; count -= 8 )\r\n    {\r\n      if ( p1[0] & p2[0] )\r\n        return 1;\r\n\r\n      p1++;\r\n      p2++;\r\n    }\r\n\r\n    if ( count == 0 )\r\n      return 0;\r\n\r\n    return ( p1[0] & p2[0] ) & ~( 0xFF >> count );\r\n  }\r\n\r\n\r\n  /* merge two masks, used by ps_mask_table_merge_all */\r\n  static FT_Error\r\n  ps_mask_table_merge( PS_Mask_Table  table,\r\n                       FT_Int         index1,\r\n                       FT_Int         index2,\r\n                       FT_Memory      memory )\r\n  {\r\n    FT_UInt   temp;\r\n    FT_Error  error = PSH_Err_Ok;\r\n\r\n\r\n    /* swap index1 and index2 so that index1 < index2 */\r\n    if ( index1 > index2 )\r\n    {\r\n      temp   = index1;\r\n      index1 = index2;\r\n      index2 = temp;\r\n    }\r\n\r\n    if ( index1 < index2 && index1 >= 0 && index2 < (FT_Int)table->num_masks )\r\n    {\r\n      /* we need to merge the bitsets of index1 and index2 with a */\r\n      /* simple union                                             */\r\n      PS_Mask  mask1  = table->masks + index1;\r\n      PS_Mask  mask2  = table->masks + index2;\r\n      FT_UInt  count1 = mask1->num_bits;\r\n      FT_UInt  count2 = mask2->num_bits;\r\n      FT_Int   delta;\r\n\r\n\r\n      if ( count2 > 0 )\r\n      {\r\n        FT_UInt   pos;\r\n        FT_Byte*  read;\r\n        FT_Byte*  write;\r\n\r\n\r\n        /* if \"count2\" is greater than \"count1\", we need to grow the */\r\n        /* first bitset, and clear the highest bits                  */\r\n        if ( count2 > count1 )\r\n        {\r\n          error = ps_mask_ensure( mask1, count2, memory );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          for ( pos = count1; pos < count2; pos++ )\r\n            ps_mask_clear_bit( mask1, pos );\r\n        }\r\n\r\n        /* merge (unite) the bitsets */\r\n        read  = mask2->bytes;\r\n        write = mask1->bytes;\r\n        pos   = (FT_UInt)( ( count2 + 7 ) >> 3 );\r\n\r\n        for ( ; pos > 0; pos-- )\r\n        {\r\n          write[0] = (FT_Byte)( write[0] | read[0] );\r\n          write++;\r\n          read++;\r\n        }\r\n      }\r\n\r\n      /* Now, remove \"mask2\" from the list.  We need to keep the masks */\r\n      /* sorted in order of importance, so move table elements.        */\r\n      mask2->num_bits  = 0;\r\n      mask2->end_point = 0;\r\n\r\n      delta = table->num_masks - 1 - index2; /* number of masks to move */\r\n      if ( delta > 0 )\r\n      {\r\n        /* move to end of table for reuse */\r\n        PS_MaskRec  dummy = *mask2;\r\n\r\n\r\n        ft_memmove( mask2, mask2 + 1, delta * sizeof ( PS_MaskRec ) );\r\n\r\n        mask2[delta] = dummy;\r\n      }\r\n\r\n      table->num_masks--;\r\n    }\r\n    else\r\n      FT_TRACE0(( \"ps_mask_table_merge: ignoring invalid indices (%d,%d)\\n\",\r\n                  index1, index2 ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Try to merge all masks in a given table.  This is used to merge */\r\n  /* all counter masks into independent counter \"paths\".             */\r\n  /*                                                                 */\r\n  static FT_Error\r\n  ps_mask_table_merge_all( PS_Mask_Table  table,\r\n                           FT_Memory      memory )\r\n  {\r\n    FT_Int    index1, index2;\r\n    FT_Error  error = PSH_Err_Ok;\r\n\r\n\r\n    for ( index1 = table->num_masks - 1; index1 > 0; index1-- )\r\n    {\r\n      for ( index2 = index1 - 1; index2 >= 0; index2-- )\r\n      {\r\n        if ( ps_mask_table_test_intersect( table, index1, index2 ) )\r\n        {\r\n          error = ps_mask_table_merge( table, index2, index1, memory );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          break;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    PS_DIMENSION MANAGEMENT                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* finalize a given dimension */\r\n  static void\r\n  ps_dimension_done( PS_Dimension  dimension,\r\n                     FT_Memory     memory )\r\n  {\r\n    ps_mask_table_done( &dimension->counters, memory );\r\n    ps_mask_table_done( &dimension->masks,    memory );\r\n    ps_hint_table_done( &dimension->hints,    memory );\r\n  }\r\n\r\n\r\n  /* initialize a given dimension */\r\n  static void\r\n  ps_dimension_init( PS_Dimension  dimension )\r\n  {\r\n    dimension->hints.num_hints    = 0;\r\n    dimension->masks.num_masks    = 0;\r\n    dimension->counters.num_masks = 0;\r\n  }\r\n\r\n\r\n#if 0\r\n\r\n  /* set a bit at a given index in the current hint mask */\r\n  static FT_Error\r\n  ps_dimension_set_mask_bit( PS_Dimension  dim,\r\n                             FT_UInt       idx,\r\n                             FT_Memory     memory )\r\n  {\r\n    PS_Mask   mask;\r\n    FT_Error  error = PSH_Err_Ok;\r\n\r\n\r\n    /* get last hint mask */\r\n    error = ps_mask_table_last( &dim->masks, memory, &mask );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = ps_mask_set_bit( mask, idx, memory );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n#endif\r\n\r\n  /* set the end point in a mask, called from \"End\" & \"Reset\" methods */\r\n  static void\r\n  ps_dimension_end_mask( PS_Dimension  dim,\r\n                         FT_UInt       end_point )\r\n  {\r\n    FT_UInt  count = dim->masks.num_masks;\r\n    PS_Mask  mask;\r\n\r\n\r\n    if ( count > 0 )\r\n    {\r\n      mask            = dim->masks.masks + count - 1;\r\n      mask->end_point = end_point;\r\n    }\r\n  }\r\n\r\n\r\n  /* set the end point in the current mask, then create a new empty one */\r\n  /* (called by \"Reset\" method)                                         */\r\n  static FT_Error\r\n  ps_dimension_reset_mask( PS_Dimension  dim,\r\n                           FT_UInt       end_point,\r\n                           FT_Memory     memory )\r\n  {\r\n    PS_Mask  mask;\r\n\r\n\r\n    /* end current mask */\r\n    ps_dimension_end_mask( dim, end_point );\r\n\r\n    /* allocate new one */\r\n    return ps_mask_table_alloc( &dim->masks, memory, &mask );\r\n  }\r\n\r\n\r\n  /* set a new mask, called from the \"T2Stem\" method */\r\n  static FT_Error\r\n  ps_dimension_set_mask_bits( PS_Dimension    dim,\r\n                              const FT_Byte*  source,\r\n                              FT_UInt         source_pos,\r\n                              FT_UInt         source_bits,\r\n                              FT_UInt         end_point,\r\n                              FT_Memory       memory )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n\r\n\r\n    /* reset current mask, if any */\r\n    error = ps_dimension_reset_mask( dim, end_point, memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* set bits in new mask */\r\n    error = ps_mask_table_set_bits( &dim->masks, source,\r\n                                    source_pos, source_bits, memory );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* add a new single stem (called from \"T1Stem\" method) */\r\n  static FT_Error\r\n  ps_dimension_add_t1stem( PS_Dimension  dim,\r\n                           FT_Int        pos,\r\n                           FT_Int        len,\r\n                           FT_Memory     memory,\r\n                           FT_Int       *aindex )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n    FT_UInt   flags = 0;\r\n\r\n\r\n    /* detect ghost stem */\r\n    if ( len < 0 )\r\n    {\r\n      flags |= PS_HINT_FLAG_GHOST;\r\n      if ( len == -21 )\r\n      {\r\n        flags |= PS_HINT_FLAG_BOTTOM;\r\n        pos   += len;\r\n      }\r\n      len = 0;\r\n    }\r\n\r\n    if ( aindex )\r\n      *aindex = -1;\r\n\r\n    /* now, lookup stem in the current hints table */\r\n    {\r\n      PS_Mask  mask;\r\n      FT_UInt  idx;\r\n      FT_UInt  max   = dim->hints.num_hints;\r\n      PS_Hint  hint  = dim->hints.hints;\r\n\r\n\r\n      for ( idx = 0; idx < max; idx++, hint++ )\r\n      {\r\n        if ( hint->pos == pos && hint->len == len )\r\n          break;\r\n      }\r\n\r\n      /* we need to create a new hint in the table */\r\n      if ( idx >= max )\r\n      {\r\n        error = ps_hint_table_alloc( &dim->hints, memory, &hint );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        hint->pos   = pos;\r\n        hint->len   = len;\r\n        hint->flags = flags;\r\n      }\r\n\r\n      /* now, store the hint in the current mask */\r\n      error = ps_mask_table_last( &dim->masks, memory, &mask );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      error = ps_mask_set_bit( mask, idx, memory );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      if ( aindex )\r\n        *aindex = (FT_Int)idx;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* add a \"hstem3/vstem3\" counter to our dimension table */\r\n  static FT_Error\r\n  ps_dimension_add_counter( PS_Dimension  dim,\r\n                            FT_Int        hint1,\r\n                            FT_Int        hint2,\r\n                            FT_Int        hint3,\r\n                            FT_Memory     memory )\r\n  {\r\n    FT_Error  error   = PSH_Err_Ok;\r\n    FT_UInt   count   = dim->counters.num_masks;\r\n    PS_Mask   counter = dim->counters.masks;\r\n\r\n\r\n    /* try to find an existing counter mask that already uses */\r\n    /* one of these stems here                                */\r\n    for ( ; count > 0; count--, counter++ )\r\n    {\r\n      if ( ps_mask_test_bit( counter, hint1 ) ||\r\n           ps_mask_test_bit( counter, hint2 ) ||\r\n           ps_mask_test_bit( counter, hint3 ) )\r\n        break;\r\n    }\r\n\r\n    /* create a new counter when needed */\r\n    if ( count == 0 )\r\n    {\r\n      error = ps_mask_table_alloc( &dim->counters, memory, &counter );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* now, set the bits for our hints in the counter mask */\r\n    error = ps_mask_set_bit( counter, hint1, memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = ps_mask_set_bit( counter, hint2, memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = ps_mask_set_bit( counter, hint3, memory );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* end of recording session for a given dimension */\r\n  static FT_Error\r\n  ps_dimension_end( PS_Dimension  dim,\r\n                    FT_UInt       end_point,\r\n                    FT_Memory     memory )\r\n  {\r\n    /* end hint mask table */\r\n    ps_dimension_end_mask( dim, end_point );\r\n\r\n    /* merge all counter masks into independent \"paths\" */\r\n    return ps_mask_table_merge_all( &dim->counters, memory );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    PS_RECORDER MANAGEMENT                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* destroy hints */\r\n  FT_LOCAL( void )\r\n  ps_hints_done( PS_Hints  hints )\r\n  {\r\n    FT_Memory  memory = hints->memory;\r\n\r\n\r\n    ps_dimension_done( &hints->dimension[0], memory );\r\n    ps_dimension_done( &hints->dimension[1], memory );\r\n\r\n    hints->error  = PSH_Err_Ok;\r\n    hints->memory = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  ps_hints_init( PS_Hints   hints,\r\n                 FT_Memory  memory )\r\n  {\r\n    FT_MEM_ZERO( hints, sizeof ( *hints ) );\r\n    hints->memory = memory;\r\n    return PSH_Err_Ok;\r\n  }\r\n\r\n\r\n  /* initialize a hints for a new session */\r\n  static void\r\n  ps_hints_open( PS_Hints      hints,\r\n                 PS_Hint_Type  hint_type )\r\n  {\r\n    switch ( hint_type )\r\n    {\r\n    case PS_HINT_TYPE_1:\r\n    case PS_HINT_TYPE_2:\r\n      hints->error     = PSH_Err_Ok;\r\n      hints->hint_type = hint_type;\r\n\r\n      ps_dimension_init( &hints->dimension[0] );\r\n      ps_dimension_init( &hints->dimension[1] );\r\n      break;\r\n\r\n    default:\r\n      hints->error     = PSH_Err_Invalid_Argument;\r\n      hints->hint_type = hint_type;\r\n\r\n      FT_TRACE0(( \"ps_hints_open: invalid charstring type\\n\" ));\r\n      break;\r\n    }\r\n  }\r\n\r\n\r\n  /* add one or more stems to the current hints table */\r\n  static void\r\n  ps_hints_stem( PS_Hints  hints,\r\n                 FT_Int    dimension,\r\n                 FT_UInt   count,\r\n                 FT_Long*  stems )\r\n  {\r\n    if ( !hints->error )\r\n    {\r\n      /* limit \"dimension\" to 0..1 */\r\n      if ( dimension < 0 || dimension > 1 )\r\n      {\r\n        FT_TRACE0(( \"ps_hints_stem: invalid dimension (%d) used\\n\",\r\n                    dimension ));\r\n        dimension = ( dimension != 0 );\r\n      }\r\n\r\n      /* record the stems in the current hints/masks table */\r\n      switch ( hints->hint_type )\r\n      {\r\n      case PS_HINT_TYPE_1:  /* Type 1 \"hstem\" or \"vstem\" operator */\r\n      case PS_HINT_TYPE_2:  /* Type 2 \"hstem\" or \"vstem\" operator */\r\n        {\r\n          PS_Dimension  dim = &hints->dimension[dimension];\r\n\r\n\r\n          for ( ; count > 0; count--, stems += 2 )\r\n          {\r\n            FT_Error   error;\r\n            FT_Memory  memory = hints->memory;\r\n\r\n\r\n            error = ps_dimension_add_t1stem(\r\n                      dim, (FT_Int)stems[0], (FT_Int)stems[1],\r\n                      memory, NULL );\r\n            if ( error )\r\n            {\r\n              FT_ERROR(( \"ps_hints_stem: could not add stem\"\r\n                         \" (%d,%d) to hints table\\n\", stems[0], stems[1] ));\r\n\r\n              hints->error = error;\r\n              return;\r\n            }\r\n          }\r\n          break;\r\n        }\r\n\r\n      default:\r\n        FT_TRACE0(( \"ps_hints_stem: called with invalid hint type (%d)\\n\",\r\n                    hints->hint_type ));\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* add one Type1 counter stem to the current hints table */\r\n  static void\r\n  ps_hints_t1stem3( PS_Hints   hints,\r\n                    FT_Int     dimension,\r\n                    FT_Fixed*  stems )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n\r\n\r\n    if ( !hints->error )\r\n    {\r\n      PS_Dimension  dim;\r\n      FT_Memory     memory = hints->memory;\r\n      FT_Int        count;\r\n      FT_Int        idx[3];\r\n\r\n\r\n      /* limit \"dimension\" to 0..1 */\r\n      if ( dimension < 0 || dimension > 1 )\r\n      {\r\n        FT_TRACE0(( \"ps_hints_t1stem3: invalid dimension (%d) used\\n\",\r\n                    dimension ));\r\n        dimension = ( dimension != 0 );\r\n      }\r\n\r\n      dim = &hints->dimension[dimension];\r\n\r\n      /* there must be 6 elements in the 'stem' array */\r\n      if ( hints->hint_type == PS_HINT_TYPE_1 )\r\n      {\r\n        /* add the three stems to our hints/masks table */\r\n        for ( count = 0; count < 3; count++, stems += 2 )\r\n        {\r\n          error = ps_dimension_add_t1stem( dim,\r\n                                           (FT_Int)FIXED_TO_INT( stems[0] ),\r\n                                           (FT_Int)FIXED_TO_INT( stems[1] ),\r\n                                           memory, &idx[count] );\r\n          if ( error )\r\n            goto Fail;\r\n        }\r\n\r\n        /* now, add the hints to the counters table */\r\n        error = ps_dimension_add_counter( dim, idx[0], idx[1], idx[2],\r\n                                          memory );\r\n        if ( error )\r\n          goto Fail;\r\n      }\r\n      else\r\n      {\r\n        FT_ERROR(( \"ps_hints_t1stem3: called with invalid hint type\\n\" ));\r\n        error = PSH_Err_Invalid_Argument;\r\n        goto Fail;\r\n      }\r\n    }\r\n\r\n    return;\r\n\r\n  Fail:\r\n    FT_ERROR(( \"ps_hints_t1stem3: could not add counter stems to table\\n\" ));\r\n    hints->error = error;\r\n  }\r\n\r\n\r\n  /* reset hints (only with Type 1 hints) */\r\n  static void\r\n  ps_hints_t1reset( PS_Hints  hints,\r\n                    FT_UInt   end_point )\r\n  {\r\n    FT_Error  error = PSH_Err_Ok;\r\n\r\n\r\n    if ( !hints->error )\r\n    {\r\n      FT_Memory  memory = hints->memory;\r\n\r\n\r\n      if ( hints->hint_type == PS_HINT_TYPE_1 )\r\n      {\r\n        error = ps_dimension_reset_mask( &hints->dimension[0],\r\n                                         end_point, memory );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        error = ps_dimension_reset_mask( &hints->dimension[1],\r\n                                         end_point, memory );\r\n        if ( error )\r\n          goto Fail;\r\n      }\r\n      else\r\n      {\r\n        /* invalid hint type */\r\n        error = PSH_Err_Invalid_Argument;\r\n        goto Fail;\r\n      }\r\n    }\r\n    return;\r\n\r\n  Fail:\r\n    hints->error = error;\r\n  }\r\n\r\n\r\n  /* Type2 \"hintmask\" operator, add a new hintmask to each direction */\r\n  static void\r\n  ps_hints_t2mask( PS_Hints        hints,\r\n                   FT_UInt         end_point,\r\n                   FT_UInt         bit_count,\r\n                   const FT_Byte*  bytes )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    if ( !hints->error )\r\n    {\r\n      PS_Dimension  dim    = hints->dimension;\r\n      FT_Memory     memory = hints->memory;\r\n      FT_UInt       count1 = dim[0].hints.num_hints;\r\n      FT_UInt       count2 = dim[1].hints.num_hints;\r\n\r\n\r\n      /* check bit count; must be equal to current total hint count */\r\n      if ( bit_count !=  count1 + count2 )\r\n      {\r\n        FT_TRACE0(( \"ps_hints_t2mask:\"\r\n                    \" called with invalid bitcount %d (instead of %d)\\n\",\r\n                   bit_count, count1 + count2 ));\r\n\r\n        /* simply ignore the operator */\r\n        return;\r\n      }\r\n\r\n      /* set-up new horizontal and vertical hint mask now */\r\n      error = ps_dimension_set_mask_bits( &dim[0], bytes, count2, count1,\r\n                                          end_point, memory );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = ps_dimension_set_mask_bits( &dim[1], bytes, 0, count2,\r\n                                          end_point, memory );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n    return;\r\n\r\n  Fail:\r\n    hints->error = error;\r\n  }\r\n\r\n\r\n  static void\r\n  ps_hints_t2counter( PS_Hints        hints,\r\n                      FT_UInt         bit_count,\r\n                      const FT_Byte*  bytes )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    if ( !hints->error )\r\n    {\r\n      PS_Dimension  dim    = hints->dimension;\r\n      FT_Memory     memory = hints->memory;\r\n      FT_UInt       count1 = dim[0].hints.num_hints;\r\n      FT_UInt       count2 = dim[1].hints.num_hints;\r\n\r\n\r\n      /* check bit count, must be equal to current total hint count */\r\n      if ( bit_count !=  count1 + count2 )\r\n      {\r\n        FT_TRACE0(( \"ps_hints_t2counter:\"\r\n                    \" called with invalid bitcount %d (instead of %d)\\n\",\r\n                   bit_count, count1 + count2 ));\r\n\r\n        /* simply ignore the operator */\r\n        return;\r\n      }\r\n\r\n      /* set-up new horizontal and vertical hint mask now */\r\n      error = ps_dimension_set_mask_bits( &dim[0], bytes, 0, count1,\r\n                                          0, memory );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = ps_dimension_set_mask_bits( &dim[1], bytes, count1, count2,\r\n                                          0, memory );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n    return;\r\n\r\n  Fail:\r\n    hints->error = error;\r\n  }\r\n\r\n\r\n  /* end recording session */\r\n  static FT_Error\r\n  ps_hints_close( PS_Hints  hints,\r\n                  FT_UInt   end_point )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = hints->error;\r\n    if ( !error )\r\n    {\r\n      FT_Memory     memory = hints->memory;\r\n      PS_Dimension  dim    = hints->dimension;\r\n\r\n\r\n      error = ps_dimension_end( &dim[0], end_point, memory );\r\n      if ( !error )\r\n      {\r\n        error = ps_dimension_end( &dim[1], end_point, memory );\r\n      }\r\n    }\r\n\r\n#ifdef DEBUG_HINTER\r\n    if ( !error )\r\n      ps_debug_hints = hints;\r\n#endif\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                TYPE 1 HINTS RECORDING INTERFACE               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  t1_hints_open( T1_Hints  hints )\r\n  {\r\n    ps_hints_open( (PS_Hints)hints, PS_HINT_TYPE_1 );\r\n  }\r\n\r\n  static void\r\n  t1_hints_stem( T1_Hints   hints,\r\n                 FT_Int     dimension,\r\n                 FT_Fixed*  coords )\r\n  {\r\n    FT_Pos  stems[2];\r\n\r\n\r\n    stems[0] = FIXED_TO_INT( coords[0] );\r\n    stems[1] = FIXED_TO_INT( coords[1] );\r\n\r\n    ps_hints_stem( (PS_Hints)hints, dimension, 1, stems );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  t1_hints_funcs_init( T1_Hints_FuncsRec*  funcs )\r\n  {\r\n    FT_MEM_ZERO( (char*)funcs, sizeof ( *funcs ) );\r\n\r\n    funcs->open  = (T1_Hints_OpenFunc)    t1_hints_open;\r\n    funcs->close = (T1_Hints_CloseFunc)   ps_hints_close;\r\n    funcs->stem  = (T1_Hints_SetStemFunc) t1_hints_stem;\r\n    funcs->stem3 = (T1_Hints_SetStem3Func)ps_hints_t1stem3;\r\n    funcs->reset = (T1_Hints_ResetFunc)   ps_hints_t1reset;\r\n    funcs->apply = (T1_Hints_ApplyFunc)   ps_hints_apply;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                TYPE 2 HINTS RECORDING INTERFACE               *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  t2_hints_open( T2_Hints  hints )\r\n  {\r\n    ps_hints_open( (PS_Hints)hints, PS_HINT_TYPE_2 );\r\n  }\r\n\r\n\r\n  static void\r\n  t2_hints_stems( T2_Hints   hints,\r\n                  FT_Int     dimension,\r\n                  FT_Int     count,\r\n                  FT_Fixed*  coords )\r\n  {\r\n    FT_Pos  stems[32], y, n;\r\n    FT_Int  total = count;\r\n\r\n\r\n    y = 0;\r\n    while ( total > 0 )\r\n    {\r\n      /* determine number of stems to write */\r\n      count = total;\r\n      if ( count > 16 )\r\n        count = 16;\r\n\r\n      /* compute integer stem positions in font units */\r\n      for ( n = 0; n < count * 2; n++ )\r\n      {\r\n        y       += coords[n];\r\n        stems[n] = FIXED_TO_INT( y );\r\n      }\r\n\r\n      /* compute lengths */\r\n      for ( n = 0; n < count * 2; n += 2 )\r\n        stems[n + 1] = stems[n + 1] - stems[n];\r\n\r\n      /* add them to the current dimension */\r\n      ps_hints_stem( (PS_Hints)hints, dimension, count, stems );\r\n\r\n      total -= count;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  t2_hints_funcs_init( T2_Hints_FuncsRec*  funcs )\r\n  {\r\n    FT_MEM_ZERO( funcs, sizeof ( *funcs ) );\r\n\r\n    funcs->open    = (T2_Hints_OpenFunc)   t2_hints_open;\r\n    funcs->close   = (T2_Hints_CloseFunc)  ps_hints_close;\r\n    funcs->stems   = (T2_Hints_StemsFunc)  t2_hints_stems;\r\n    funcs->hintmask= (T2_Hints_MaskFunc)   ps_hints_t2mask;\r\n    funcs->counter = (T2_Hints_CounterFunc)ps_hints_t2counter;\r\n    funcs->apply   = (T2_Hints_ApplyFunc)  ps_hints_apply;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/pshrec.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshrec.h                                                               */\r\n/*                                                                         */\r\n/*    Postscript (Type1/Type2) hints recorder (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2006, 2008 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /**************************************************************************/\r\n  /*                                                                        */\r\n  /*  The functions defined here are called from the Type 1, CID and CFF    */\r\n  /*  font drivers to record the hints of a given character/glyph.          */\r\n  /*                                                                        */\r\n  /*  The hints are recorded in a unified format, and are later processed   */\r\n  /*  by the `optimizer' and `fitter' to adjust the outlines to the pixel   */\r\n  /*  grid.                                                                 */\r\n  /*                                                                        */\r\n  /**************************************************************************/\r\n\r\n\r\n#ifndef __PSHREC_H__\r\n#define __PSHREC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n#include \"pshglob.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                 GLYPH HINTS RECORDER INTERNALS                *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* handle to hint record */\r\n  typedef struct PS_HintRec_*  PS_Hint;\r\n\r\n  /* hint types */\r\n  typedef enum  PS_Hint_Type_\r\n  {\r\n    PS_HINT_TYPE_1 = 1,\r\n    PS_HINT_TYPE_2 = 2\r\n\r\n  } PS_Hint_Type;\r\n\r\n\r\n  /* hint flags */\r\n  typedef enum  PS_Hint_Flags_\r\n  {\r\n    PS_HINT_FLAG_GHOST  = 1,\r\n    PS_HINT_FLAG_BOTTOM = 2\r\n\r\n  } PS_Hint_Flags;\r\n\r\n\r\n  /* hint descriptor */\r\n  typedef struct  PS_HintRec_\r\n  {\r\n    FT_Int   pos;\r\n    FT_Int   len;\r\n    FT_UInt  flags;\r\n\r\n  } PS_HintRec;\r\n\r\n\r\n#define ps_hint_is_active( x )  ( (x)->flags & PS_HINT_FLAG_ACTIVE )\r\n#define ps_hint_is_ghost( x )   ( (x)->flags & PS_HINT_FLAG_GHOST  )\r\n#define ps_hint_is_bottom( x )  ( (x)->flags & PS_HINT_FLAG_BOTTOM )\r\n\r\n\r\n  /* hints table descriptor */\r\n  typedef struct  PS_Hint_TableRec_\r\n  {\r\n    FT_UInt  num_hints;\r\n    FT_UInt  max_hints;\r\n    PS_Hint  hints;\r\n\r\n  } PS_Hint_TableRec, *PS_Hint_Table;\r\n\r\n\r\n  /* hint and counter mask descriptor */\r\n  typedef struct  PS_MaskRec_\r\n  {\r\n    FT_UInt   num_bits;\r\n    FT_UInt   max_bits;\r\n    FT_Byte*  bytes;\r\n    FT_UInt   end_point;\r\n\r\n  } PS_MaskRec, *PS_Mask;\r\n\r\n\r\n  /* masks and counters table descriptor */\r\n  typedef struct  PS_Mask_TableRec_\r\n  {\r\n    FT_UInt  num_masks;\r\n    FT_UInt  max_masks;\r\n    PS_Mask  masks;\r\n\r\n  } PS_Mask_TableRec, *PS_Mask_Table;\r\n\r\n\r\n /* dimension-specific hints descriptor */\r\n  typedef struct  PS_DimensionRec_\r\n  {\r\n    PS_Hint_TableRec  hints;\r\n    PS_Mask_TableRec  masks;\r\n    PS_Mask_TableRec  counters;\r\n\r\n  } PS_DimensionRec, *PS_Dimension;\r\n\r\n\r\n  /* glyph hints descriptor                                */\r\n  /* dimension 0 => X coordinates + vertical hints/stems   */\r\n  /* dimension 1 => Y coordinates + horizontal hints/stems */\r\n  typedef struct  PS_HintsRec_\r\n  {\r\n    FT_Memory        memory;\r\n    FT_Error         error;\r\n    FT_UInt32        magic;\r\n    PS_Hint_Type     hint_type;\r\n    PS_DimensionRec  dimension[2];\r\n\r\n  } PS_HintsRec, *PS_Hints;\r\n\r\n  /* */\r\n\r\n  /* initialize hints recorder */\r\n  FT_LOCAL( FT_Error )\r\n  ps_hints_init( PS_Hints   hints,\r\n                 FT_Memory  memory );\r\n\r\n  /* finalize hints recorder */\r\n  FT_LOCAL( void )\r\n  ps_hints_done( PS_Hints  hints );\r\n\r\n  /* initialize Type1 hints recorder interface */\r\n  FT_LOCAL( void )\r\n  t1_hints_funcs_init( T1_Hints_FuncsRec*  funcs );\r\n\r\n  /* initialize Type2 hints recorder interface */\r\n  FT_LOCAL( void )\r\n  t2_hints_funcs_init( T2_Hints_FuncsRec*  funcs );\r\n\r\n\r\n#ifdef DEBUG_HINTER\r\n  extern PS_Hints  ps_debug_hints;\r\n  extern  int      ps_debug_no_horz_hints;\r\n  extern  int      ps_debug_no_vert_hints;\r\n#endif\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __PS_HINTER_RECORD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/pshinter/rules.mk",
    "content": "#\r\n# FreeType 2 PSHinter driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 2001, 2003, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# PSHINTER driver directory\r\n#\r\nPSHINTER_DIR := $(SRC_DIR)/pshinter\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nPSHINTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSHINTER_DIR))\r\n\r\n\r\n# PSHINTER driver sources (i.e., C files)\r\n#\r\nPSHINTER_DRV_SRC := $(PSHINTER_DIR)/pshalgo.c \\\r\n                    $(PSHINTER_DIR)/pshglob.c \\\r\n                    $(PSHINTER_DIR)/pshmod.c  \\\r\n                    $(PSHINTER_DIR)/pshpic.c  \\\r\n                    $(PSHINTER_DIR)/pshrec.c\r\n\r\n\r\n# PSHINTER driver headers\r\n#\r\nPSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h) \\\r\n                  $(PSHINTER_DIR)/pshnterr.h\r\n\r\n\r\n# PSHINTER driver object(s)\r\n#\r\n#   PSHINTER_DRV_OBJ_M is used during `multi' builds.\r\n#   PSHINTER_DRV_OBJ_S is used during `single' builds.\r\n#\r\nPSHINTER_DRV_OBJ_M := $(PSHINTER_DRV_SRC:$(PSHINTER_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nPSHINTER_DRV_OBJ_S := $(OBJ_DIR)/pshinter.$O\r\n\r\n# PSHINTER driver source file for single build\r\n#\r\nPSHINTER_DRV_SRC_S := $(PSHINTER_DIR)/pshinter.c\r\n\r\n\r\n# PSHINTER driver - single object\r\n#\r\n$(PSHINTER_DRV_OBJ_S): $(PSHINTER_DRV_SRC_S) $(PSHINTER_DRV_SRC) \\\r\n                       $(FREETYPE_H) $(PSHINTER_DRV_H)\r\n\t$(PSHINTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PSHINTER_DRV_SRC_S))\r\n\r\n\r\n# PSHINTER driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(PSHINTER_DIR)/%.c $(FREETYPE_H) $(PSHINTER_DRV_H)\r\n\t$(PSHINTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(PSHINTER_DRV_OBJ_S)\r\nDRV_OBJS_M += $(PSHINTER_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/Jamfile",
    "content": "# FreeType 2 src/psnames Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) psnames ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = psmodule pspic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = psnames ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/psnames Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/module.mk",
    "content": "#\r\n# FreeType 2 PSnames module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += PSNAMES_MODULE\r\n\r\ndefine PSNAMES_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, psnames_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)psnames   $(ECHO_DRIVER_DESC)Postscript & Unicode Glyph name handling$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/psmodule.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psmodule.c                                                             */\r\n/*                                                                         */\r\n/*    PSNames module implementation (body).                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2005-2008, 2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n#include \"psmodule.h\"\r\n#include \"pstables.h\"\r\n\r\n#include \"psnamerr.h\"\r\n#include \"pspic.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\r\n\r\n\r\n#define VARIANT_BIT         0x80000000UL\r\n#define BASE_GLYPH( code )  ( (FT_UInt32)( (code) & ~VARIANT_BIT ) )\r\n\r\n\r\n  /* Return the Unicode value corresponding to a given glyph.  Note that */\r\n  /* we do deal with glyph variants by detecting a non-initial dot in    */\r\n  /* the name, as in `A.swash' or `e.final'; in this case, the           */\r\n  /* VARIANT_BIT is set in the return value.                             */\r\n  /*                                                                     */\r\n  static FT_UInt32\r\n  ps_unicode_value( const char*  glyph_name )\r\n  {\r\n    /* If the name begins with `uni', then the glyph name may be a */\r\n    /* hard-coded unicode character code.                          */\r\n    if ( glyph_name[0] == 'u' &&\r\n         glyph_name[1] == 'n' &&\r\n         glyph_name[2] == 'i' )\r\n    {\r\n      /* determine whether the next four characters following are */\r\n      /* hexadecimal.                                             */\r\n\r\n      /* XXX: Add code to deal with ligatures, i.e. glyph names like */\r\n      /*      `uniXXXXYYYYZZZZ'...                                   */\r\n\r\n      FT_Int       count;\r\n      FT_UInt32    value = 0;\r\n      const char*  p     = glyph_name + 3;\r\n\r\n\r\n      for ( count = 4; count > 0; count--, p++ )\r\n      {\r\n        char          c = *p;\r\n        unsigned int  d;\r\n\r\n\r\n        d = (unsigned char)c - '0';\r\n        if ( d >= 10 )\r\n        {\r\n          d = (unsigned char)c - 'A';\r\n          if ( d >= 6 )\r\n            d = 16;\r\n          else\r\n            d += 10;\r\n        }\r\n\r\n        /* Exit if a non-uppercase hexadecimal character was found   */\r\n        /* -- this also catches character codes below `0' since such */\r\n        /* negative numbers cast to `unsigned int' are far too big.  */\r\n        if ( d >= 16 )\r\n          break;\r\n\r\n        value = ( value << 4 ) + d;\r\n      }\r\n\r\n      /* there must be exactly four hex digits */\r\n      if ( count == 0 )\r\n      {\r\n        if ( *p == '\\0' )\r\n          return value;\r\n        if ( *p == '.' )\r\n          return (FT_UInt32)( value | VARIANT_BIT );\r\n      }\r\n    }\r\n\r\n    /* If the name begins with `u', followed by four to six uppercase */\r\n    /* hexadecimal digits, it is a hard-coded unicode character code. */\r\n    if ( glyph_name[0] == 'u' )\r\n    {\r\n      FT_Int       count;\r\n      FT_UInt32    value = 0;\r\n      const char*  p     = glyph_name + 1;\r\n\r\n\r\n      for ( count = 6; count > 0; count--, p++ )\r\n      {\r\n        char          c = *p;\r\n        unsigned int  d;\r\n\r\n\r\n        d = (unsigned char)c - '0';\r\n        if ( d >= 10 )\r\n        {\r\n          d = (unsigned char)c - 'A';\r\n          if ( d >= 6 )\r\n            d = 16;\r\n          else\r\n            d += 10;\r\n        }\r\n\r\n        if ( d >= 16 )\r\n          break;\r\n\r\n        value = ( value << 4 ) + d;\r\n      }\r\n\r\n      if ( count <= 2 )\r\n      {\r\n        if ( *p == '\\0' )\r\n          return value;\r\n        if ( *p == '.' )\r\n          return (FT_UInt32)( value | VARIANT_BIT );\r\n      }\r\n    }\r\n\r\n    /* Look for a non-initial dot in the glyph name in order to */\r\n    /* find variants like `A.swash', `e.final', etc.            */\r\n    {\r\n      const char*  p   = glyph_name;\r\n      const char*  dot = NULL;\r\n\r\n\r\n      for ( ; *p; p++ )\r\n      {\r\n        if ( *p == '.' && p > glyph_name )\r\n        {\r\n          dot = p;\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* now look up the glyph in the Adobe Glyph List */\r\n      if ( !dot )\r\n        return (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );\r\n      else\r\n        return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) |\r\n                            VARIANT_BIT );\r\n    }\r\n  }\r\n\r\n\r\n  /* ft_qsort callback to sort the unicode map */\r\n  FT_CALLBACK_DEF( int )\r\n  compare_uni_maps( const void*  a,\r\n                    const void*  b )\r\n  {\r\n    PS_UniMap*  map1 = (PS_UniMap*)a;\r\n    PS_UniMap*  map2 = (PS_UniMap*)b;\r\n    FT_UInt32   unicode1 = BASE_GLYPH( map1->unicode );\r\n    FT_UInt32   unicode2 = BASE_GLYPH( map2->unicode );\r\n\r\n\r\n    /* sort base glyphs before glyph variants */\r\n    if ( unicode1 == unicode2 )\r\n    {\r\n      if ( map1->unicode > map2->unicode )\r\n        return 1;\r\n      else if ( map1->unicode < map2->unicode )\r\n        return -1;\r\n      else\r\n        return 0;\r\n    }\r\n    else\r\n    {\r\n      if ( unicode1 > unicode2 )\r\n        return 1;\r\n      else if ( unicode1 < unicode2 )\r\n        return -1;\r\n      else\r\n        return 0;\r\n    }\r\n  }\r\n\r\n\r\n  /* support for extra glyphs not handled (well) in AGL; */\r\n  /* we add extra mappings for them if necessary         */\r\n\r\n#define EXTRA_GLYPH_LIST_SIZE  10\r\n\r\n  static const FT_UInt32  ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =\r\n  {\r\n    /* WGL 4 */\r\n    0x0394,\r\n    0x03A9,\r\n    0x2215,\r\n    0x00AD,\r\n    0x02C9,\r\n    0x03BC,\r\n    0x2219,\r\n    0x00A0,\r\n    /* Romanian */\r\n    0x021A,\r\n    0x021B\r\n  };\r\n\r\n  static const char  ft_extra_glyph_names[] =\r\n  {\r\n    'D','e','l','t','a',0,\r\n    'O','m','e','g','a',0,\r\n    'f','r','a','c','t','i','o','n',0,\r\n    'h','y','p','h','e','n',0,\r\n    'm','a','c','r','o','n',0,\r\n    'm','u',0,\r\n    'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,\r\n    's','p','a','c','e',0,\r\n    'T','c','o','m','m','a','a','c','c','e','n','t',0,\r\n    't','c','o','m','m','a','a','c','c','e','n','t',0\r\n  };\r\n\r\n  static const FT_Int\r\n  ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =\r\n  {\r\n     0,\r\n     6,\r\n    12,\r\n    21,\r\n    28,\r\n    35,\r\n    38,\r\n    53,\r\n    59,\r\n    72\r\n  };\r\n\r\n\r\n  static void\r\n  ps_check_extra_glyph_name( const char*  gname,\r\n                             FT_UInt      glyph,\r\n                             FT_UInt*     extra_glyphs,\r\n                             FT_UInt     *states )\r\n  {\r\n    FT_UInt  n;\r\n\r\n\r\n    for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )\r\n    {\r\n      if ( ft_strcmp( ft_extra_glyph_names +\r\n                        ft_extra_glyph_name_offsets[n], gname ) == 0 )\r\n      {\r\n        if ( states[n] == 0 )\r\n        {\r\n          /* mark this extra glyph as a candidate for the cmap */\r\n          states[n]     = 1;\r\n          extra_glyphs[n] = glyph;\r\n        }\r\n\r\n        return;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  ps_check_extra_glyph_unicode( FT_UInt32  uni_char,\r\n                                FT_UInt   *states )\r\n  {\r\n    FT_UInt  n;\r\n\r\n\r\n    for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )\r\n    {\r\n      if ( uni_char == ft_extra_glyph_unicodes[n] )\r\n      {\r\n        /* disable this extra glyph from being added to the cmap */\r\n        states[n] = 2;\r\n\r\n        return;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /* Build a table that maps Unicode values to glyph indices. */\r\n  static FT_Error\r\n  ps_unicodes_init( FT_Memory             memory,\r\n                    PS_Unicodes           table,\r\n                    FT_UInt               num_glyphs,\r\n                    PS_GetGlyphNameFunc   get_glyph_name,\r\n                    PS_FreeGlyphNameFunc  free_glyph_name,\r\n                    FT_Pointer            glyph_data )\r\n  {\r\n    FT_Error  error;\r\n\r\n    FT_UInt  extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\r\n    FT_UInt  extra_glyphs[EXTRA_GLYPH_LIST_SIZE];\r\n\r\n\r\n    /* we first allocate the table */\r\n    table->num_maps = 0;\r\n    table->maps     = 0;\r\n\r\n    if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )\r\n    {\r\n      FT_UInt     n;\r\n      FT_UInt     count;\r\n      PS_UniMap*  map;\r\n      FT_UInt32   uni_char;\r\n\r\n\r\n      map = table->maps;\r\n\r\n      for ( n = 0; n < num_glyphs; n++ )\r\n      {\r\n        const char*  gname = get_glyph_name( glyph_data, n );\r\n\r\n\r\n        if ( gname )\r\n        {\r\n          ps_check_extra_glyph_name( gname, n,\r\n                                     extra_glyphs, extra_glyph_list_states );\r\n          uni_char = ps_unicode_value( gname );\r\n\r\n          if ( BASE_GLYPH( uni_char ) != 0 )\r\n          {\r\n            ps_check_extra_glyph_unicode( uni_char,\r\n                                          extra_glyph_list_states );\r\n            map->unicode     = uni_char;\r\n            map->glyph_index = n;\r\n            map++;\r\n          }\r\n\r\n          if ( free_glyph_name )\r\n            free_glyph_name( glyph_data, gname );\r\n        }\r\n      }\r\n\r\n      for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )\r\n      {\r\n        if ( extra_glyph_list_states[n] == 1 )\r\n        {\r\n          /* This glyph name has an additional representation. */\r\n          /* Add it to the cmap.                               */\r\n\r\n          map->unicode     = ft_extra_glyph_unicodes[n];\r\n          map->glyph_index = extra_glyphs[n];\r\n          map++;\r\n        }\r\n      }\r\n\r\n      /* now compress the table a bit */\r\n      count = (FT_UInt)( map - table->maps );\r\n\r\n      if ( count == 0 )\r\n      {\r\n        /* No unicode chars here! */\r\n        FT_FREE( table->maps );\r\n        if ( !error )\r\n          error = PSnames_Err_No_Unicode_Glyph_Name;\r\n      }\r\n      else\r\n      {\r\n        /* Reallocate if the number of used entries is much smaller. */\r\n        if ( count < num_glyphs / 2 )\r\n        {\r\n          (void)FT_RENEW_ARRAY( table->maps, num_glyphs, count );\r\n          error = PSnames_Err_Ok;\r\n        }\r\n\r\n        /* Sort the table in increasing order of unicode values, */\r\n        /* taking care of glyph variants.                        */\r\n        ft_qsort( table->maps, count, sizeof ( PS_UniMap ),\r\n                  compare_uni_maps );\r\n      }\r\n\r\n      table->num_maps = count;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  ps_unicodes_char_index( PS_Unicodes  table,\r\n                          FT_UInt32    unicode )\r\n  {\r\n    PS_UniMap  *min, *max, *mid, *result = NULL;\r\n\r\n\r\n    /* Perform a binary search on the table. */\r\n\r\n    min = table->maps;\r\n    max = min + table->num_maps - 1;\r\n\r\n    while ( min <= max )\r\n    {\r\n      FT_UInt32  base_glyph;\r\n\r\n\r\n      mid = min + ( ( max - min ) >> 1 );\r\n\r\n      if ( mid->unicode == unicode )\r\n      {\r\n        result = mid;\r\n        break;\r\n      }\r\n\r\n      base_glyph = BASE_GLYPH( mid->unicode );\r\n\r\n      if ( base_glyph == unicode )\r\n        result = mid; /* remember match but continue search for base glyph */\r\n\r\n      if ( min == max )\r\n        break;\r\n\r\n      if ( base_glyph < unicode )\r\n        min = mid + 1;\r\n      else\r\n        max = mid - 1;\r\n    }\r\n\r\n    if ( result )\r\n      return result->glyph_index;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  static FT_UInt32\r\n  ps_unicodes_char_next( PS_Unicodes  table,\r\n                         FT_UInt32   *unicode )\r\n  {\r\n    FT_UInt    result    = 0;\r\n    FT_UInt32  char_code = *unicode + 1;\r\n\r\n\r\n    {\r\n      FT_UInt     min = 0;\r\n      FT_UInt     max = table->num_maps;\r\n      FT_UInt     mid;\r\n      PS_UniMap*  map;\r\n      FT_UInt32   base_glyph;\r\n\r\n\r\n      while ( min < max )\r\n      {\r\n        mid = min + ( ( max - min ) >> 1 );\r\n        map = table->maps + mid;\r\n\r\n        if ( map->unicode == char_code )\r\n        {\r\n          result = map->glyph_index;\r\n          goto Exit;\r\n        }\r\n\r\n        base_glyph = BASE_GLYPH( map->unicode );\r\n\r\n        if ( base_glyph == char_code )\r\n          result = map->glyph_index;\r\n\r\n        if ( base_glyph < char_code )\r\n          min = mid + 1;\r\n        else\r\n          max = mid;\r\n      }\r\n\r\n      if ( result )\r\n        goto Exit;               /* we have a variant glyph */\r\n\r\n      /* we didn't find it; check whether we have a map just above it */\r\n      char_code = 0;\r\n\r\n      if ( min < table->num_maps )\r\n      {\r\n        map       = table->maps + min;\r\n        result    = map->glyph_index;\r\n        char_code = BASE_GLYPH( map->unicode );\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    *unicode = char_code;\r\n    return result;\r\n  }\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\r\n\r\n\r\n  static const char*\r\n  ps_get_macintosh_name( FT_UInt  name_index )\r\n  {\r\n    if ( name_index >= FT_NUM_MAC_NAMES )\r\n      name_index = 0;\r\n\r\n    return ft_standard_glyph_names + ft_mac_names[name_index];\r\n  }\r\n\r\n\r\n  static const char*\r\n  ps_get_standard_strings( FT_UInt  sid )\r\n  {\r\n    if ( sid >= FT_NUM_SID_NAMES )\r\n      return 0;\r\n\r\n    return ft_standard_glyph_names + ft_sid_names[sid];\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\r\n\r\n  FT_DEFINE_SERVICE_PSCMAPSREC(\r\n    pscmaps_interface,\r\n    (PS_Unicode_ValueFunc)     ps_unicode_value,\r\n    (PS_Unicodes_InitFunc)     ps_unicodes_init,\r\n    (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index,\r\n    (PS_Unicodes_CharNextFunc) ps_unicodes_char_next,\r\n\r\n    (PS_Macintosh_NameFunc)    ps_get_macintosh_name,\r\n    (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,\r\n\r\n    t1_standard_encoding,\r\n    t1_expert_encoding )\r\n\r\n#else\r\n\r\n  FT_DEFINE_SERVICE_PSCMAPSREC(\r\n    pscmaps_interface,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    (PS_Macintosh_NameFunc)    ps_get_macintosh_name,\r\n    (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,\r\n\r\n    t1_standard_encoding,\r\n    t1_expert_encoding )\r\n\r\n#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\r\n\r\n\r\n  FT_DEFINE_SERVICEDESCREC1(\r\n    pscmaps_services,\r\n    FT_SERVICE_ID_POSTSCRIPT_CMAPS, &PSCMAPS_INTERFACE_GET )\r\n\r\n\r\n  static FT_Pointer\r\n  psnames_get_service( FT_Module    module,\r\n                       const char*  service_id )\r\n  {\r\n    /* PSCMAPS_SERVICES_GET derefers `library' in PIC mode */\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    FT_Library  library;\r\n\r\n\r\n    if ( !module )\r\n      return NULL;\r\n    library = module->library;\r\n    if ( !library )\r\n      return NULL;\r\n#else\r\n    FT_UNUSED( module );\r\n#endif\r\n\r\n    return ft_service_list_lookup( PSCMAPS_SERVICES_GET, service_id );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n#define PUT_PS_NAMES_SERVICE( a )  NULL\r\n#else\r\n#define PUT_PS_NAMES_SERVICE( a )  a\r\n#endif\r\n\r\n  FT_DEFINE_MODULE(\r\n    psnames_module_class,\r\n\r\n    0,  /* this is not a font driver, nor a renderer */\r\n    sizeof ( FT_ModuleRec ),\r\n\r\n    \"psnames\",  /* driver name                         */\r\n    0x10000L,   /* driver version                      */\r\n    0x20000L,   /* driver requires FreeType 2 or above */\r\n\r\n    PUT_PS_NAMES_SERVICE(\r\n      (void*)&PSCMAPS_INTERFACE_GET ),   /* module specific interface */\r\n    (FT_Module_Constructor)NULL,\r\n    (FT_Module_Destructor) NULL,\r\n    (FT_Module_Requester)  PUT_PS_NAMES_SERVICE( psnames_get_service ) )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/psmodule.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psmodule.h                                                             */\r\n/*                                                                         */\r\n/*    High-level PSNames module interface (specification).                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSMODULE_H__\r\n#define __PSMODULE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_DECLARE_MODULE( psnames_module_class )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSMODULE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/psnamerr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psnamerr.h                                                             */\r\n/*                                                                         */\r\n/*    PS names module error codes (specification only).                    */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the PS names module error enumeration     */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __PSNAMERR_H__\r\n#define __PSNAMERR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  PSnames_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_PSnames\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __PSNAMERR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/psnames.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psnames.c                                                              */\r\n/*                                                                         */\r\n/*    FreeType PSNames module component (body only).                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"pspic.c\"\r\n#include \"psmodule.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/pspic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pspic.c                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for psnames module.  */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"pspic.h\"\r\n#include \"psnamerr.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from psmodule.c */\r\n  FT_Error\r\n  FT_Create_Class_pscmaps_services( FT_Library           library,\r\n                                    FT_ServiceDescRec**  output_class );\r\n  void\r\n  FT_Destroy_Class_pscmaps_services( FT_Library          library,\r\n                                     FT_ServiceDescRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_pscmaps_interface( FT_Library              library,\r\n                                   FT_Service_PsCMapsRec*  clazz );\r\n\r\n\r\n  void\r\n  psnames_module_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    if ( pic_container->psnames )\r\n    {\r\n      PSModulePIC*  container = (PSModulePIC*)pic_container->psnames;\r\n\r\n\r\n      if ( container->pscmaps_services )\r\n        FT_Destroy_Class_pscmaps_services( library,\r\n                                           container->pscmaps_services );\r\n      container->pscmaps_services = NULL;\r\n      FT_FREE( container );\r\n      pic_container->psnames = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  psnames_module_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = PSnames_Err_Ok;\r\n    PSModulePIC*       container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->psnames = container;\r\n\r\n    /* initialize pointer table -                       */\r\n    /* this is how the module usually expects this data */\r\n    error = FT_Create_Class_pscmaps_services(\r\n              library, &container->pscmaps_services );\r\n    if ( error )\r\n      goto Exit;\r\n    FT_Init_Class_pscmaps_interface( library,\r\n                                     &container->pscmaps_interface );\r\n\r\n  Exit:\r\n    if ( error )\r\n      psnames_module_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/pspic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pspic.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for psnames module.  */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSPIC_H__\r\n#define __PSPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define PSCMAPS_SERVICES_GET   pscmaps_services\r\n#define PSCMAPS_INTERFACE_GET  pscmaps_interface\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n  typedef struct  PSModulePIC_\r\n  {\r\n    FT_ServiceDescRec*     pscmaps_services;\r\n    FT_Service_PsCMapsRec  pscmaps_interface;\r\n\r\n  } PSModulePIC;\r\n\r\n\r\n#define GET_PIC( lib )                                     \\\r\n          ( (PSModulePIC*)((lib)->pic_container.psnames) )\r\n#define PSCMAPS_SERVICES_GET   ( GET_PIC( library )->pscmaps_services )\r\n#define PSCMAPS_INTERFACE_GET  ( GET_PIC( library )->pscmaps_interface )\r\n\r\n\r\n  /* see pspic.c for the implementation */\r\n  void\r\n  psnames_module_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  psnames_module_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/pstables.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pstables.h                                                             */\r\n/*                                                                         */\r\n/*    PostScript glyph names.                                              */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2008, 2011 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /* This file has been generated automatically -- do not edit! */\r\n\r\n\r\n  static const char  ft_standard_glyph_names[3696] =\r\n  {\r\n    '.','n','u','l','l', 0,\r\n    'n','o','n','m','a','r','k','i','n','g','r','e','t','u','r','n', 0,\r\n    'n','o','t','e','q','u','a','l', 0,\r\n    'i','n','f','i','n','i','t','y', 0,\r\n    'l','e','s','s','e','q','u','a','l', 0,\r\n    'g','r','e','a','t','e','r','e','q','u','a','l', 0,\r\n    'p','a','r','t','i','a','l','d','i','f','f', 0,\r\n    's','u','m','m','a','t','i','o','n', 0,\r\n    'p','r','o','d','u','c','t', 0,\r\n    'p','i', 0,\r\n    'i','n','t','e','g','r','a','l', 0,\r\n    'O','m','e','g','a', 0,\r\n    'r','a','d','i','c','a','l', 0,\r\n    'a','p','p','r','o','x','e','q','u','a','l', 0,\r\n    'D','e','l','t','a', 0,\r\n    'n','o','n','b','r','e','a','k','i','n','g','s','p','a','c','e', 0,\r\n    'l','o','z','e','n','g','e', 0,\r\n    'a','p','p','l','e', 0,\r\n    'f','r','a','n','c', 0,\r\n    'G','b','r','e','v','e', 0,\r\n    'g','b','r','e','v','e', 0,\r\n    'I','d','o','t','a','c','c','e','n','t', 0,\r\n    'S','c','e','d','i','l','l','a', 0,\r\n    's','c','e','d','i','l','l','a', 0,\r\n    'C','a','c','u','t','e', 0,\r\n    'c','a','c','u','t','e', 0,\r\n    'C','c','a','r','o','n', 0,\r\n    'c','c','a','r','o','n', 0,\r\n    'd','c','r','o','a','t', 0,\r\n    '.','n','o','t','d','e','f', 0,\r\n    's','p','a','c','e', 0,\r\n    'e','x','c','l','a','m', 0,\r\n    'q','u','o','t','e','d','b','l', 0,\r\n    'n','u','m','b','e','r','s','i','g','n', 0,\r\n    'd','o','l','l','a','r', 0,\r\n    'p','e','r','c','e','n','t', 0,\r\n    'a','m','p','e','r','s','a','n','d', 0,\r\n    'q','u','o','t','e','r','i','g','h','t', 0,\r\n    'p','a','r','e','n','l','e','f','t', 0,\r\n    'p','a','r','e','n','r','i','g','h','t', 0,\r\n    'a','s','t','e','r','i','s','k', 0,\r\n    'p','l','u','s', 0,\r\n    'c','o','m','m','a', 0,\r\n    'h','y','p','h','e','n', 0,\r\n    'p','e','r','i','o','d', 0,\r\n    's','l','a','s','h', 0,\r\n    'z','e','r','o', 0,\r\n    'o','n','e', 0,\r\n    't','w','o', 0,\r\n    't','h','r','e','e', 0,\r\n    'f','o','u','r', 0,\r\n    'f','i','v','e', 0,\r\n    's','i','x', 0,\r\n    's','e','v','e','n', 0,\r\n    'e','i','g','h','t', 0,\r\n    'n','i','n','e', 0,\r\n    'c','o','l','o','n', 0,\r\n    's','e','m','i','c','o','l','o','n', 0,\r\n    'l','e','s','s', 0,\r\n    'e','q','u','a','l', 0,\r\n    'g','r','e','a','t','e','r', 0,\r\n    'q','u','e','s','t','i','o','n', 0,\r\n    'a','t', 0,\r\n    'A', 0,\r\n    'B', 0,\r\n    'C', 0,\r\n    'D', 0,\r\n    'E', 0,\r\n    'F', 0,\r\n    'G', 0,\r\n    'H', 0,\r\n    'I', 0,\r\n    'J', 0,\r\n    'K', 0,\r\n    'L', 0,\r\n    'M', 0,\r\n    'N', 0,\r\n    'O', 0,\r\n    'P', 0,\r\n    'Q', 0,\r\n    'R', 0,\r\n    'S', 0,\r\n    'T', 0,\r\n    'U', 0,\r\n    'V', 0,\r\n    'W', 0,\r\n    'X', 0,\r\n    'Y', 0,\r\n    'Z', 0,\r\n    'b','r','a','c','k','e','t','l','e','f','t', 0,\r\n    'b','a','c','k','s','l','a','s','h', 0,\r\n    'b','r','a','c','k','e','t','r','i','g','h','t', 0,\r\n    'a','s','c','i','i','c','i','r','c','u','m', 0,\r\n    'u','n','d','e','r','s','c','o','r','e', 0,\r\n    'q','u','o','t','e','l','e','f','t', 0,\r\n    'a', 0,\r\n    'b', 0,\r\n    'c', 0,\r\n    'd', 0,\r\n    'e', 0,\r\n    'f', 0,\r\n    'g', 0,\r\n    'h', 0,\r\n    'i', 0,\r\n    'j', 0,\r\n    'k', 0,\r\n    'l', 0,\r\n    'm', 0,\r\n    'n', 0,\r\n    'o', 0,\r\n    'p', 0,\r\n    'q', 0,\r\n    'r', 0,\r\n    's', 0,\r\n    't', 0,\r\n    'u', 0,\r\n    'v', 0,\r\n    'w', 0,\r\n    'x', 0,\r\n    'y', 0,\r\n    'z', 0,\r\n    'b','r','a','c','e','l','e','f','t', 0,\r\n    'b','a','r', 0,\r\n    'b','r','a','c','e','r','i','g','h','t', 0,\r\n    'a','s','c','i','i','t','i','l','d','e', 0,\r\n    'e','x','c','l','a','m','d','o','w','n', 0,\r\n    'c','e','n','t', 0,\r\n    's','t','e','r','l','i','n','g', 0,\r\n    'f','r','a','c','t','i','o','n', 0,\r\n    'y','e','n', 0,\r\n    'f','l','o','r','i','n', 0,\r\n    's','e','c','t','i','o','n', 0,\r\n    'c','u','r','r','e','n','c','y', 0,\r\n    'q','u','o','t','e','s','i','n','g','l','e', 0,\r\n    'q','u','o','t','e','d','b','l','l','e','f','t', 0,\r\n    'g','u','i','l','l','e','m','o','t','l','e','f','t', 0,\r\n    'g','u','i','l','s','i','n','g','l','l','e','f','t', 0,\r\n    'g','u','i','l','s','i','n','g','l','r','i','g','h','t', 0,\r\n    'f','i', 0,\r\n    'f','l', 0,\r\n    'e','n','d','a','s','h', 0,\r\n    'd','a','g','g','e','r', 0,\r\n    'd','a','g','g','e','r','d','b','l', 0,\r\n    'p','e','r','i','o','d','c','e','n','t','e','r','e','d', 0,\r\n    'p','a','r','a','g','r','a','p','h', 0,\r\n    'b','u','l','l','e','t', 0,\r\n    'q','u','o','t','e','s','i','n','g','l','b','a','s','e', 0,\r\n    'q','u','o','t','e','d','b','l','b','a','s','e', 0,\r\n    'q','u','o','t','e','d','b','l','r','i','g','h','t', 0,\r\n    'g','u','i','l','l','e','m','o','t','r','i','g','h','t', 0,\r\n    'e','l','l','i','p','s','i','s', 0,\r\n    'p','e','r','t','h','o','u','s','a','n','d', 0,\r\n    'q','u','e','s','t','i','o','n','d','o','w','n', 0,\r\n    'g','r','a','v','e', 0,\r\n    'a','c','u','t','e', 0,\r\n    'c','i','r','c','u','m','f','l','e','x', 0,\r\n    't','i','l','d','e', 0,\r\n    'm','a','c','r','o','n', 0,\r\n    'b','r','e','v','e', 0,\r\n    'd','o','t','a','c','c','e','n','t', 0,\r\n    'd','i','e','r','e','s','i','s', 0,\r\n    'r','i','n','g', 0,\r\n    'c','e','d','i','l','l','a', 0,\r\n    'h','u','n','g','a','r','u','m','l','a','u','t', 0,\r\n    'o','g','o','n','e','k', 0,\r\n    'c','a','r','o','n', 0,\r\n    'e','m','d','a','s','h', 0,\r\n    'A','E', 0,\r\n    'o','r','d','f','e','m','i','n','i','n','e', 0,\r\n    'L','s','l','a','s','h', 0,\r\n    'O','s','l','a','s','h', 0,\r\n    'O','E', 0,\r\n    'o','r','d','m','a','s','c','u','l','i','n','e', 0,\r\n    'a','e', 0,\r\n    'd','o','t','l','e','s','s','i', 0,\r\n    'l','s','l','a','s','h', 0,\r\n    'o','s','l','a','s','h', 0,\r\n    'o','e', 0,\r\n    'g','e','r','m','a','n','d','b','l','s', 0,\r\n    'o','n','e','s','u','p','e','r','i','o','r', 0,\r\n    'l','o','g','i','c','a','l','n','o','t', 0,\r\n    'm','u', 0,\r\n    't','r','a','d','e','m','a','r','k', 0,\r\n    'E','t','h', 0,\r\n    'o','n','e','h','a','l','f', 0,\r\n    'p','l','u','s','m','i','n','u','s', 0,\r\n    'T','h','o','r','n', 0,\r\n    'o','n','e','q','u','a','r','t','e','r', 0,\r\n    'd','i','v','i','d','e', 0,\r\n    'b','r','o','k','e','n','b','a','r', 0,\r\n    'd','e','g','r','e','e', 0,\r\n    't','h','o','r','n', 0,\r\n    't','h','r','e','e','q','u','a','r','t','e','r','s', 0,\r\n    't','w','o','s','u','p','e','r','i','o','r', 0,\r\n    'r','e','g','i','s','t','e','r','e','d', 0,\r\n    'm','i','n','u','s', 0,\r\n    'e','t','h', 0,\r\n    'm','u','l','t','i','p','l','y', 0,\r\n    't','h','r','e','e','s','u','p','e','r','i','o','r', 0,\r\n    'c','o','p','y','r','i','g','h','t', 0,\r\n    'A','a','c','u','t','e', 0,\r\n    'A','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'A','d','i','e','r','e','s','i','s', 0,\r\n    'A','g','r','a','v','e', 0,\r\n    'A','r','i','n','g', 0,\r\n    'A','t','i','l','d','e', 0,\r\n    'C','c','e','d','i','l','l','a', 0,\r\n    'E','a','c','u','t','e', 0,\r\n    'E','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'E','d','i','e','r','e','s','i','s', 0,\r\n    'E','g','r','a','v','e', 0,\r\n    'I','a','c','u','t','e', 0,\r\n    'I','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'I','d','i','e','r','e','s','i','s', 0,\r\n    'I','g','r','a','v','e', 0,\r\n    'N','t','i','l','d','e', 0,\r\n    'O','a','c','u','t','e', 0,\r\n    'O','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'O','d','i','e','r','e','s','i','s', 0,\r\n    'O','g','r','a','v','e', 0,\r\n    'O','t','i','l','d','e', 0,\r\n    'S','c','a','r','o','n', 0,\r\n    'U','a','c','u','t','e', 0,\r\n    'U','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'U','d','i','e','r','e','s','i','s', 0,\r\n    'U','g','r','a','v','e', 0,\r\n    'Y','a','c','u','t','e', 0,\r\n    'Y','d','i','e','r','e','s','i','s', 0,\r\n    'Z','c','a','r','o','n', 0,\r\n    'a','a','c','u','t','e', 0,\r\n    'a','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'a','d','i','e','r','e','s','i','s', 0,\r\n    'a','g','r','a','v','e', 0,\r\n    'a','r','i','n','g', 0,\r\n    'a','t','i','l','d','e', 0,\r\n    'c','c','e','d','i','l','l','a', 0,\r\n    'e','a','c','u','t','e', 0,\r\n    'e','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'e','d','i','e','r','e','s','i','s', 0,\r\n    'e','g','r','a','v','e', 0,\r\n    'i','a','c','u','t','e', 0,\r\n    'i','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'i','d','i','e','r','e','s','i','s', 0,\r\n    'i','g','r','a','v','e', 0,\r\n    'n','t','i','l','d','e', 0,\r\n    'o','a','c','u','t','e', 0,\r\n    'o','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'o','d','i','e','r','e','s','i','s', 0,\r\n    'o','g','r','a','v','e', 0,\r\n    'o','t','i','l','d','e', 0,\r\n    's','c','a','r','o','n', 0,\r\n    'u','a','c','u','t','e', 0,\r\n    'u','c','i','r','c','u','m','f','l','e','x', 0,\r\n    'u','d','i','e','r','e','s','i','s', 0,\r\n    'u','g','r','a','v','e', 0,\r\n    'y','a','c','u','t','e', 0,\r\n    'y','d','i','e','r','e','s','i','s', 0,\r\n    'z','c','a','r','o','n', 0,\r\n    'e','x','c','l','a','m','s','m','a','l','l', 0,\r\n    'H','u','n','g','a','r','u','m','l','a','u','t','s','m','a','l','l', 0,\r\n    'd','o','l','l','a','r','o','l','d','s','t','y','l','e', 0,\r\n    'd','o','l','l','a','r','s','u','p','e','r','i','o','r', 0,\r\n    'a','m','p','e','r','s','a','n','d','s','m','a','l','l', 0,\r\n    'A','c','u','t','e','s','m','a','l','l', 0,\r\n    'p','a','r','e','n','l','e','f','t','s','u','p','e','r','i','o','r', 0,\r\n    'p','a','r','e','n','r','i','g','h','t','s','u','p','e','r','i','o','r', 0,\r\n    't','w','o','d','o','t','e','n','l','e','a','d','e','r', 0,\r\n    'o','n','e','d','o','t','e','n','l','e','a','d','e','r', 0,\r\n    'z','e','r','o','o','l','d','s','t','y','l','e', 0,\r\n    'o','n','e','o','l','d','s','t','y','l','e', 0,\r\n    't','w','o','o','l','d','s','t','y','l','e', 0,\r\n    't','h','r','e','e','o','l','d','s','t','y','l','e', 0,\r\n    'f','o','u','r','o','l','d','s','t','y','l','e', 0,\r\n    'f','i','v','e','o','l','d','s','t','y','l','e', 0,\r\n    's','i','x','o','l','d','s','t','y','l','e', 0,\r\n    's','e','v','e','n','o','l','d','s','t','y','l','e', 0,\r\n    'e','i','g','h','t','o','l','d','s','t','y','l','e', 0,\r\n    'n','i','n','e','o','l','d','s','t','y','l','e', 0,\r\n    'c','o','m','m','a','s','u','p','e','r','i','o','r', 0,\r\n    't','h','r','e','e','q','u','a','r','t','e','r','s','e','m','d','a','s','h', 0,\r\n    'p','e','r','i','o','d','s','u','p','e','r','i','o','r', 0,\r\n    'q','u','e','s','t','i','o','n','s','m','a','l','l', 0,\r\n    'a','s','u','p','e','r','i','o','r', 0,\r\n    'b','s','u','p','e','r','i','o','r', 0,\r\n    'c','e','n','t','s','u','p','e','r','i','o','r', 0,\r\n    'd','s','u','p','e','r','i','o','r', 0,\r\n    'e','s','u','p','e','r','i','o','r', 0,\r\n    'i','s','u','p','e','r','i','o','r', 0,\r\n    'l','s','u','p','e','r','i','o','r', 0,\r\n    'm','s','u','p','e','r','i','o','r', 0,\r\n    'n','s','u','p','e','r','i','o','r', 0,\r\n    'o','s','u','p','e','r','i','o','r', 0,\r\n    'r','s','u','p','e','r','i','o','r', 0,\r\n    's','s','u','p','e','r','i','o','r', 0,\r\n    't','s','u','p','e','r','i','o','r', 0,\r\n    'f','f', 0,\r\n    'f','f','i', 0,\r\n    'f','f','l', 0,\r\n    'p','a','r','e','n','l','e','f','t','i','n','f','e','r','i','o','r', 0,\r\n    'p','a','r','e','n','r','i','g','h','t','i','n','f','e','r','i','o','r', 0,\r\n    'C','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,\r\n    'h','y','p','h','e','n','s','u','p','e','r','i','o','r', 0,\r\n    'G','r','a','v','e','s','m','a','l','l', 0,\r\n    'A','s','m','a','l','l', 0,\r\n    'B','s','m','a','l','l', 0,\r\n    'C','s','m','a','l','l', 0,\r\n    'D','s','m','a','l','l', 0,\r\n    'E','s','m','a','l','l', 0,\r\n    'F','s','m','a','l','l', 0,\r\n    'G','s','m','a','l','l', 0,\r\n    'H','s','m','a','l','l', 0,\r\n    'I','s','m','a','l','l', 0,\r\n    'J','s','m','a','l','l', 0,\r\n    'K','s','m','a','l','l', 0,\r\n    'L','s','m','a','l','l', 0,\r\n    'M','s','m','a','l','l', 0,\r\n    'N','s','m','a','l','l', 0,\r\n    'O','s','m','a','l','l', 0,\r\n    'P','s','m','a','l','l', 0,\r\n    'Q','s','m','a','l','l', 0,\r\n    'R','s','m','a','l','l', 0,\r\n    'S','s','m','a','l','l', 0,\r\n    'T','s','m','a','l','l', 0,\r\n    'U','s','m','a','l','l', 0,\r\n    'V','s','m','a','l','l', 0,\r\n    'W','s','m','a','l','l', 0,\r\n    'X','s','m','a','l','l', 0,\r\n    'Y','s','m','a','l','l', 0,\r\n    'Z','s','m','a','l','l', 0,\r\n    'c','o','l','o','n','m','o','n','e','t','a','r','y', 0,\r\n    'o','n','e','f','i','t','t','e','d', 0,\r\n    'r','u','p','i','a','h', 0,\r\n    'T','i','l','d','e','s','m','a','l','l', 0,\r\n    'e','x','c','l','a','m','d','o','w','n','s','m','a','l','l', 0,\r\n    'c','e','n','t','o','l','d','s','t','y','l','e', 0,\r\n    'L','s','l','a','s','h','s','m','a','l','l', 0,\r\n    'S','c','a','r','o','n','s','m','a','l','l', 0,\r\n    'Z','c','a','r','o','n','s','m','a','l','l', 0,\r\n    'D','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    'B','r','e','v','e','s','m','a','l','l', 0,\r\n    'C','a','r','o','n','s','m','a','l','l', 0,\r\n    'D','o','t','a','c','c','e','n','t','s','m','a','l','l', 0,\r\n    'M','a','c','r','o','n','s','m','a','l','l', 0,\r\n    'f','i','g','u','r','e','d','a','s','h', 0,\r\n    'h','y','p','h','e','n','i','n','f','e','r','i','o','r', 0,\r\n    'O','g','o','n','e','k','s','m','a','l','l', 0,\r\n    'R','i','n','g','s','m','a','l','l', 0,\r\n    'C','e','d','i','l','l','a','s','m','a','l','l', 0,\r\n    'q','u','e','s','t','i','o','n','d','o','w','n','s','m','a','l','l', 0,\r\n    'o','n','e','e','i','g','h','t','h', 0,\r\n    't','h','r','e','e','e','i','g','h','t','h','s', 0,\r\n    'f','i','v','e','e','i','g','h','t','h','s', 0,\r\n    's','e','v','e','n','e','i','g','h','t','h','s', 0,\r\n    'o','n','e','t','h','i','r','d', 0,\r\n    't','w','o','t','h','i','r','d','s', 0,\r\n    'z','e','r','o','s','u','p','e','r','i','o','r', 0,\r\n    'f','o','u','r','s','u','p','e','r','i','o','r', 0,\r\n    'f','i','v','e','s','u','p','e','r','i','o','r', 0,\r\n    's','i','x','s','u','p','e','r','i','o','r', 0,\r\n    's','e','v','e','n','s','u','p','e','r','i','o','r', 0,\r\n    'e','i','g','h','t','s','u','p','e','r','i','o','r', 0,\r\n    'n','i','n','e','s','u','p','e','r','i','o','r', 0,\r\n    'z','e','r','o','i','n','f','e','r','i','o','r', 0,\r\n    'o','n','e','i','n','f','e','r','i','o','r', 0,\r\n    't','w','o','i','n','f','e','r','i','o','r', 0,\r\n    't','h','r','e','e','i','n','f','e','r','i','o','r', 0,\r\n    'f','o','u','r','i','n','f','e','r','i','o','r', 0,\r\n    'f','i','v','e','i','n','f','e','r','i','o','r', 0,\r\n    's','i','x','i','n','f','e','r','i','o','r', 0,\r\n    's','e','v','e','n','i','n','f','e','r','i','o','r', 0,\r\n    'e','i','g','h','t','i','n','f','e','r','i','o','r', 0,\r\n    'n','i','n','e','i','n','f','e','r','i','o','r', 0,\r\n    'c','e','n','t','i','n','f','e','r','i','o','r', 0,\r\n    'd','o','l','l','a','r','i','n','f','e','r','i','o','r', 0,\r\n    'p','e','r','i','o','d','i','n','f','e','r','i','o','r', 0,\r\n    'c','o','m','m','a','i','n','f','e','r','i','o','r', 0,\r\n    'A','g','r','a','v','e','s','m','a','l','l', 0,\r\n    'A','a','c','u','t','e','s','m','a','l','l', 0,\r\n    'A','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,\r\n    'A','t','i','l','d','e','s','m','a','l','l', 0,\r\n    'A','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    'A','r','i','n','g','s','m','a','l','l', 0,\r\n    'A','E','s','m','a','l','l', 0,\r\n    'C','c','e','d','i','l','l','a','s','m','a','l','l', 0,\r\n    'E','g','r','a','v','e','s','m','a','l','l', 0,\r\n    'E','a','c','u','t','e','s','m','a','l','l', 0,\r\n    'E','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,\r\n    'E','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    'I','g','r','a','v','e','s','m','a','l','l', 0,\r\n    'I','a','c','u','t','e','s','m','a','l','l', 0,\r\n    'I','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,\r\n    'I','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    'E','t','h','s','m','a','l','l', 0,\r\n    'N','t','i','l','d','e','s','m','a','l','l', 0,\r\n    'O','g','r','a','v','e','s','m','a','l','l', 0,\r\n    'O','a','c','u','t','e','s','m','a','l','l', 0,\r\n    'O','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,\r\n    'O','t','i','l','d','e','s','m','a','l','l', 0,\r\n    'O','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    'O','E','s','m','a','l','l', 0,\r\n    'O','s','l','a','s','h','s','m','a','l','l', 0,\r\n    'U','g','r','a','v','e','s','m','a','l','l', 0,\r\n    'U','a','c','u','t','e','s','m','a','l','l', 0,\r\n    'U','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,\r\n    'U','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    'Y','a','c','u','t','e','s','m','a','l','l', 0,\r\n    'T','h','o','r','n','s','m','a','l','l', 0,\r\n    'Y','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,\r\n    '0','0','1','.','0','0','0', 0,\r\n    '0','0','1','.','0','0','1', 0,\r\n    '0','0','1','.','0','0','2', 0,\r\n    '0','0','1','.','0','0','3', 0,\r\n    'B','l','a','c','k', 0,\r\n    'B','o','l','d', 0,\r\n    'B','o','o','k', 0,\r\n    'L','i','g','h','t', 0,\r\n    'M','e','d','i','u','m', 0,\r\n    'R','e','g','u','l','a','r', 0,\r\n    'R','o','m','a','n', 0,\r\n    'S','e','m','i','b','o','l','d', 0,\r\n  };\r\n\r\n\r\n#define FT_NUM_MAC_NAMES  258\r\n\r\n  /* Values are offsets into the `ft_standard_glyph_names' table */\r\n\r\n  static const short  ft_mac_names[FT_NUM_MAC_NAMES] =\r\n  {\r\n     253,   0,   6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351,\r\n     360, 365, 371, 378, 385, 391, 396, 400, 404, 410, 415, 420, 424, 430,\r\n     436, 441, 447, 457, 462, 468, 476, 485, 488, 490, 492, 494, 496, 498,\r\n     500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526,\r\n     528, 530, 532, 534, 536, 538, 540, 552, 562, 575, 587, 979, 608, 610,\r\n     612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638,\r\n     640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 670, 674, 685,\r\n    1375,1392,1405,1414,1486,1512,1562,1603,1632,1610,1622,1645,1639,1652,\r\n    1661,1690,1668,1680,1697,1726,1704,1716,1733,1740,1769,1747,1759,1776,\r\n    1790,1819,1797,1809, 839,1263, 707, 712, 741, 881, 871,1160,1302,1346,\r\n    1197, 985,1031,  23,1086,1108,  32,1219,  41,  51, 730,1194,  64,  76,\r\n      86,  94,  97,1089,1118, 106,1131,1150, 966, 696,1183, 112, 734, 120,\r\n     132, 783, 930, 945, 138,1385,1398,1529,1115,1157, 832,1079, 770, 916,\r\n     598, 319,1246, 155,1833,1586, 721, 749, 797, 811, 826, 829, 846, 856,\r\n     888, 903, 954,1363,1421,1356,1433,1443,1450,1457,1469,1479,1493,1500,\r\n     163,1522,1543,1550,1572,1134, 991,1002,1008,1015,1021,1040,1045,1053,\r\n    1066,1073,1101,1143,1536,1783,1596,1843,1253,1207,1319,1579,1826,1229,\r\n    1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200,\r\n     209, 218, 225, 232, 239, 246\r\n  };\r\n\r\n\r\n#define FT_NUM_SID_NAMES  391\r\n\r\n  /* Values are offsets into the `ft_standard_glyph_names' table */\r\n\r\n  static const short  ft_sid_names[FT_NUM_SID_NAMES] =\r\n  {\r\n     253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365,\r\n     371, 378, 385, 391, 396, 400, 404, 410, 415, 420, 424, 430, 436, 441,\r\n     447, 457, 462, 468, 476, 485, 488, 490, 492, 494, 496, 498, 500, 502,\r\n     504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530,\r\n     532, 534, 536, 538, 540, 552, 562, 575, 587, 598, 608, 610, 612, 614,\r\n     616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642,\r\n     644, 646, 648, 650, 652, 654, 656, 658, 660, 670, 674, 685, 696, 707,\r\n     712, 721, 730, 734, 741, 749, 758, 770, 783, 797, 811, 826, 829, 832,\r\n     839, 846, 856, 871, 881, 888, 903, 916, 930, 945, 954, 966, 979, 985,\r\n     991,1002,1008,1015,1021,1031,1040,1045,1053,1066,1073,1079,1086,1089,\r\n    1101,1108,1115,1118,1131,1134,1143,1150,1157,1160,1171,1183,1194,1197,\r\n    1207,1211,1219,1229,1235,1246,1253,1263,1270,1276,1290,1302,1313,1319,\r\n    1323,1332,1346,1356,1363,1375,1385,1392,1398,1405,1414,1421,1433,1443,\r\n    1450,1457,1469,1479,1486,1493,1500,1512,1522,1529,1536,1543,1550,1562,\r\n    1572,1579,1586,1596,1603,1610,1622,1632,1639,1645,1652,1661,1668,1680,\r\n    1690,1697,1704,1716,1726,1733,1740,1747,1759,1769,1776,1783,1790,1797,\r\n    1809,1819,1826,1833,1843,1850,1862,1880,1895,1910,1925,1936,1954,1973,\r\n    1988,2003,2016,2028,2040,2054,2067,2080,2092,2106,2120,2133,2147,2167,\r\n    2182,2196,2206,2216,2229,2239,2249,2259,2269,2279,2289,2299,2309,2319,\r\n    2329,2332,2336,2340,2358,2377,2393,2408,2419,2426,2433,2440,2447,2454,\r\n    2461,2468,2475,2482,2489,2496,2503,2510,2517,2524,2531,2538,2545,2552,\r\n    2559,2566,2573,2580,2587,2594,2601,2615,2625,2632,2643,2659,2672,2684,\r\n    2696,2708,2722,2733,2744,2759,2771,2782,2797,2809,2819,2832,2850,2860,\r\n    2873,2885,2898,2907,2917,2930,2943,2956,2968,2982,2996,3009,3022,3034,\r\n    3046,3060,3073,3086,3098,3112,3126,3139,3152,3167,3182,3196,3208,3220,\r\n    3237,3249,3264,3275,3283,3297,3309,3321,3338,3353,3365,3377,3394,3409,\r\n    3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586,\r\n    3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687\r\n  };\r\n\r\n\r\n  /* the following are indices into the SID name table */\r\n  static const unsigned short  t1_standard_encoding[256] =\r\n  {\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,\r\n     17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,\r\n     33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,\r\n     49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,\r\n     65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,\r\n     81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,  0,\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,\r\n      0,111,112,113,114,  0,115,116,117,118,119,120,121,122,  0,123,\r\n      0,124,125,126,127,128,129,130,131,  0,132,133,  0,134,135,136,\r\n    137,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0,138,  0,139,  0,  0,  0,  0,140,141,142,143,  0,  0,  0,  0,\r\n      0,144,  0,  0,  0,145,  0,  0,146,147,148,149,  0,  0,  0,  0\r\n  };\r\n\r\n\r\n  /* the following are indices into the SID name table */\r\n  static const unsigned short  t1_expert_encoding[256] =\r\n  {\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      1,229,230,  0,231,232,233,234,235,236,237,238, 13, 14, 15, 99,\r\n    239,240,241,242,243,244,245,246,247,248, 27, 28,249,250,251,252,\r\n      0,253,254,255,256,257,  0,  0,  0,258,  0,  0,259,260,261,262,\r\n      0,  0,263,264,265,  0,266,109,110,267,268,269,  0,270,271,272,\r\n    273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,\r\n    289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,  0,\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,\r\n      0,304,305,306,  0,  0,307,308,309,310,311,  0,312,  0,  0,313,\r\n      0,  0,314,315,  0,  0,316,317,318,  0,  0,  0,158,155,163,319,\r\n    320,321,322,323,324,325,  0,  0,326,150,164,169,327,328,329,330,\r\n    331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,\r\n    347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,\r\n    363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378\r\n  };\r\n\r\n\r\n  /*\r\n   *  This table is a compressed version of the Adobe Glyph List (AGL),\r\n   *  optimized for efficient searching.  It has been generated by the\r\n   *  `glnames.py' python script located in the `src/tools' directory.\r\n   *\r\n   *  The lookup function to get the Unicode value for a given string\r\n   *  is defined below the table.\r\n   */\r\n\r\n#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\r\n\r\n  static const unsigned char  ft_adobe_glyph_list[55997L] =\r\n  {\r\n      0, 52,  0,106,  2,167,  3, 63,  4,220,  6,125,  9,143, 10, 23,\r\n     11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88,\r\n     22,110, 23, 32, 23, 71, 24, 77, 27,156, 29, 73, 31,247, 32,107,\r\n     32,222, 33, 55, 34,154, 35,218, 58, 10, 64,122, 72,188, 80,109,\r\n     88,104, 93, 61, 98,168,106, 91,114,111,115,237,122,180,127,255,\r\n    135,164,143,132,149,213,158,108,161,115,168,175,183,147,197,199,\r\n    202, 25,204,166,208,209,209, 81,215, 26, 65,143,  0, 65,  0,140,\r\n      0,175,  0,193,  1, 15,  1,147,  1,233,  1,251,  2,  7,  2, 40,\r\n      2, 57,  2, 82,  2, 91,  2,128,  2,136,  2,154, 69,131,  0,198,\r\n      0,150,  0,158,  0,167,225,227,245,244,101,128,  1,252,237,225,\r\n    227,242,239,110,128,  1,226,243,237,225,236,108,128,247,230,225,\r\n    227,245,244,101,129,  0,193,  0,185,243,237,225,236,108,128,247,\r\n    225,226,242,229,246,101,134,  1,  2,  0,213,  0,221,  0,232,  0,\r\n    243,  0,251,  1,  7,225,227,245,244,101,128, 30,174,227,249,242,\r\n    233,236,236,233, 99,128,  4,208,228,239,244,226,229,236,239,119,\r\n    128, 30,182,231,242,225,246,101,128, 30,176,232,239,239,235,225,\r\n    226,239,246,101,128, 30,178,244,233,236,228,101,128, 30,180, 99,\r\n      4,  1, 25,  1, 32,  1,121,  1,137,225,242,239,110,128,  1,205,\r\n    233,242, 99,  2,  1, 40,  1, 45,236,101,128, 36,182,245,237,230,\r\n    236,229,120,134,  0,194,  1, 66,  1, 74,  1, 85,  1, 93,  1,105,\r\n      1,113,225,227,245,244,101,128, 30,164,228,239,244,226,229,236,\r\n    239,119,128, 30,172,231,242,225,246,101,128, 30,166,232,239,239,\r\n    235,225,226,239,246,101,128, 30,168,243,237,225,236,108,128,247,\r\n    226,244,233,236,228,101,128, 30,170,245,244,101,129,246,201,  1,\r\n    129,243,237,225,236,108,128,247,180,249,242,233,236,236,233, 99,\r\n    128,  4, 16,100,  3,  1,155,  1,165,  1,209,226,236,231,242,225,\r\n    246,101,128,  2,  0,233,229,242,229,243,233,115,131,  0,196,  1,\r\n    181,  1,192,  1,201,227,249,242,233,236,236,233, 99,128,  4,210,\r\n    237,225,227,242,239,110,128,  1,222,243,237,225,236,108,128,247,\r\n    228,239,116,  2,  1,216,  1,224,226,229,236,239,119,128, 30,160,\r\n    237,225,227,242,239,110,128,  1,224,231,242,225,246,101,129,  0,\r\n    192,  1,243,243,237,225,236,108,128,247,224,232,239,239,235,225,\r\n    226,239,246,101,128, 30,162,105,  2,  2, 13,  2, 25,229,227,249,\r\n    242,233,236,236,233, 99,128,  4,212,238,246,229,242,244,229,228,\r\n    226,242,229,246,101,128,  2,  2,236,240,232, 97,129,  3,145,  2,\r\n     49,244,239,238,239,115,128,  3,134,109,  2,  2, 63,  2, 71,225,\r\n    227,242,239,110,128,  1,  0,239,238,239,243,240,225,227,101,128,\r\n    255, 33,239,231,239,238,229,107,128,  1,  4,242,233,238,103,131,\r\n      0,197,  2,104,  2,112,  2,120,225,227,245,244,101,128,  1,250,\r\n    226,229,236,239,119,128, 30,  0,243,237,225,236,108,128,247,229,\r\n    243,237,225,236,108,128,247, 97,244,233,236,228,101,129,  0,195,\r\n      2,146,243,237,225,236,108,128,247,227,249,226,225,242,237,229,\r\n    238,233,225,110,128,  5, 49, 66,137,  0, 66,  2,189,  2,198,  2,\r\n    223,  3,  3,  3, 10,  3, 22,  3, 34,  3, 46,  3, 54,227,233,242,\r\n    227,236,101,128, 36,183,228,239,116,  2,  2,206,  2,215,225,227,\r\n    227,229,238,116,128, 30,  2,226,229,236,239,119,128, 30,  4,101,\r\n      3,  2,231,  2,242,  2,254,227,249,242,233,236,236,233, 99,128,\r\n      4, 17,238,225,242,237,229,238,233,225,110,128,  5, 50,244, 97,\r\n    128,  3,146,232,239,239,107,128,  1,129,236,233,238,229,226,229,\r\n    236,239,119,128, 30,  6,237,239,238,239,243,240,225,227,101,128,\r\n    255, 34,242,229,246,229,243,237,225,236,108,128,246,244,243,237,\r\n    225,236,108,128,247, 98,244,239,240,226,225,114,128,  1,130, 67,\r\n    137,  0, 67,  3, 85,  3,127,  3,193,  3,210,  3,224,  4,171,  4,\r\n    188,  4,200,  4,212, 97,  3,  3, 93,  3,104,  3,111,225,242,237,\r\n    229,238,233,225,110,128,  5, 62,227,245,244,101,128,  1,  6,242,\r\n    239,110,129,246,202,  3,119,243,237,225,236,108,128,246,245, 99,\r\n      3,  3,135,  3,142,  3,171,225,242,239,110,128,  1, 12,229,228,\r\n    233,236,236, 97,130,  0,199,  3,155,  3,163,225,227,245,244,101,\r\n    128, 30,  8,243,237,225,236,108,128,247,231,233,242, 99,  2,  3,\r\n    179,  3,184,236,101,128, 36,184,245,237,230,236,229,120,128,  1,\r\n      8,228,239,116,129,  1, 10,  3,201,225,227,227,229,238,116,128,\r\n      1, 10,229,228,233,236,236,225,243,237,225,236,108,128,247,184,\r\n    104,  4,  3,234,  3,246,  4,161,  4,165,225,225,242,237,229,238,\r\n    233,225,110,128,  5, 73,101,  6,  4,  4,  4, 24,  4, 35,  4,103,\r\n      4,115,  4,136,225,226,235,232,225,243,233,225,238,227,249,242,\r\n    233,236,236,233, 99,128,  4,188,227,249,242,233,236,236,233, 99,\r\n    128,  4, 39,100,  2,  4, 41,  4, 85,229,243,227,229,238,228,229,\r\n    114,  2,  4, 54,  4, 74,225,226,235,232,225,243,233,225,238,227,\r\n    249,242,233,236,236,233, 99,128,  4,190,227,249,242,233,236,236,\r\n    233, 99,128,  4,182,233,229,242,229,243,233,243,227,249,242,233,\r\n    236,236,233, 99,128,  4,244,232,225,242,237,229,238,233,225,110,\r\n    128,  5, 67,235,232,225,235,225,243,243,233,225,238,227,249,242,\r\n    233,236,236,233, 99,128,  4,203,246,229,242,244,233,227,225,236,\r\n    243,244,242,239,235,229,227,249,242,233,236,236,233, 99,128,  4,\r\n    184,105,128,  3,167,239,239,107,128,  1,135,233,242,227,245,237,\r\n    230,236,229,248,243,237,225,236,108,128,246,246,237,239,238,239,\r\n    243,240,225,227,101,128,255, 35,239,225,242,237,229,238,233,225,\r\n    110,128,  5, 81,243,237,225,236,108,128,247, 99, 68,142,  0, 68,\r\n      4,252,  5, 10,  5, 36,  5, 96,  5,121,  5,166,  5,173,  5,231,\r\n      5,244,  6,  0,  6, 12,  6, 28,  6, 48,  6, 57, 90,129,  1,241,\r\n      5,  2,227,225,242,239,110,128,  1,196, 97,  2,  5, 16,  5, 27,\r\n    225,242,237,229,238,233,225,110,128,  5, 52,230,242,233,227,225,\r\n    110,128,  1,137, 99,  4,  5, 46,  5, 53,  5, 62,  5, 89,225,242,\r\n    239,110,128,  1, 14,229,228,233,236,236, 97,128, 30, 16,233,242,\r\n     99,  2,  5, 70,  5, 75,236,101,128, 36,185,245,237,230,236,229,\r\n    248,226,229,236,239,119,128, 30, 18,242,239,225,116,128,  1, 16,\r\n    228,239,116,  2,  5,104,  5,113,225,227,227,229,238,116,128, 30,\r\n     10,226,229,236,239,119,128, 30, 12,101,  3,  5,129,  5,140,  5,\r\n    150,227,249,242,233,236,236,233, 99,128,  4, 20,233,227,239,240,\r\n    244,233, 99,128,  3,238,236,244, 97,129, 34,  6,  5,158,231,242,\r\n    229,229,107,128,  3,148,232,239,239,107,128,  1,138,105,  2,  5,\r\n    179,  5,218,229,242,229,243,233,115,131,246,203,  5,194,  5,202,\r\n      5,210,193,227,245,244,101,128,246,204,199,242,225,246,101,128,\r\n    246,205,243,237,225,236,108,128,247,168,231,225,237,237,225,231,\r\n    242,229,229,107,128,  3,220,234,229,227,249,242,233,236,236,233,\r\n     99,128,  4,  2,236,233,238,229,226,229,236,239,119,128, 30, 14,\r\n    237,239,238,239,243,240,225,227,101,128,255, 36,239,244,225,227,\r\n    227,229,238,244,243,237,225,236,108,128,246,247,115,  2,  6, 34,\r\n      6, 41,236,225,243,104,128,  1, 16,237,225,236,108,128,247,100,\r\n    244,239,240,226,225,114,128,  1,139,122,131,  1,242,  6, 67,  6,\r\n     75,  6,112,227,225,242,239,110,128,  1,197,101,  2,  6, 81,  6,\r\n    101,225,226,235,232,225,243,233,225,238,227,249,242,233,236,236,\r\n    233, 99,128,  4,224,227,249,242,233,236,236,233, 99,128,  4,  5,\r\n    232,229,227,249,242,233,236,236,233, 99,128,  4, 15, 69,146,  0,\r\n     69,  6,165,  6,183,  6,191,  7, 89,  7,153,  7,165,  7,183,  7,\r\n    211,  8,  7,  8, 36,  8, 94,  8,169,  8,189,  8,208,  8,248,  9,\r\n     44,  9,109,  9,115,225,227,245,244,101,129,  0,201,  6,175,243,\r\n    237,225,236,108,128,247,233,226,242,229,246,101,128,  1, 20, 99,\r\n      5,  6,203,  6,210,  6,224,  6,236,  7, 79,225,242,239,110,128,\r\n      1, 26,229,228,233,236,236,225,226,242,229,246,101,128, 30, 28,\r\n    232,225,242,237,229,238,233,225,110,128,  5, 53,233,242, 99,  2,\r\n      6,244,  6,249,236,101,128, 36,186,245,237,230,236,229,120,135,\r\n      0,202,  7, 16,  7, 24,  7, 32,  7, 43,  7, 51,  7, 63,  7, 71,\r\n    225,227,245,244,101,128, 30,190,226,229,236,239,119,128, 30, 24,\r\n    228,239,244,226,229,236,239,119,128, 30,198,231,242,225,246,101,\r\n    128, 30,192,232,239,239,235,225,226,239,246,101,128, 30,194,243,\r\n    237,225,236,108,128,247,234,244,233,236,228,101,128, 30,196,249,\r\n    242,233,236,236,233, 99,128,  4,  4,100,  3,  7, 97,  7,107,  7,\r\n    127,226,236,231,242,225,246,101,128,  2,  4,233,229,242,229,243,\r\n    233,115,129,  0,203,  7,119,243,237,225,236,108,128,247,235,239,\r\n    116,130,  1, 22,  7,136,  7,145,225,227,227,229,238,116,128,  1,\r\n     22,226,229,236,239,119,128, 30,184,230,227,249,242,233,236,236,\r\n    233, 99,128,  4, 36,231,242,225,246,101,129,  0,200,  7,175,243,\r\n    237,225,236,108,128,247,232,104,  2,  7,189,  7,200,225,242,237,\r\n    229,238,233,225,110,128,  5, 55,239,239,235,225,226,239,246,101,\r\n    128, 30,186,105,  3,  7,219,  7,230,  7,245,231,232,244,242,239,\r\n    237,225,110,128, 33,103,238,246,229,242,244,229,228,226,242,229,\r\n    246,101,128,  2,  6,239,244,233,230,233,229,228,227,249,242,233,\r\n    236,236,233, 99,128,  4,100,108,  2,  8, 13,  8, 24,227,249,242,\r\n    233,236,236,233, 99,128,  4, 27,229,246,229,238,242,239,237,225,\r\n    110,128, 33,106,109,  3,  8, 44,  8, 72,  8, 83,225,227,242,239,\r\n    110,130,  1, 18,  8, 56,  8, 64,225,227,245,244,101,128, 30, 22,\r\n    231,242,225,246,101,128, 30, 20,227,249,242,233,236,236,233, 99,\r\n    128,  4, 28,239,238,239,243,240,225,227,101,128,255, 37,110,  4,\r\n      8,104,  8,115,  8,135,  8,154,227,249,242,233,236,236,233, 99,\r\n    128,  4, 29,228,229,243,227,229,238,228,229,242,227,249,242,233,\r\n    236,236,233, 99,128,  4,162,103,129,  1, 74,  8,141,232,229,227,\r\n    249,242,233,236,236,233, 99,128,  4,164,232,239,239,235,227,249,\r\n    242,233,236,236,233, 99,128,  4,199,111,  2,  8,175,  8,183,231,\r\n    239,238,229,107,128,  1, 24,240,229,110,128,  1,144,240,243,233,\r\n    236,239,110,129,  3,149,  8,200,244,239,238,239,115,128,  3,136,\r\n    114,  2,  8,214,  8,225,227,249,242,233,236,236,233, 99,128,  4,\r\n     32,229,246,229,242,243,229,100,129,  1,142,  8,237,227,249,242,\r\n    233,236,236,233, 99,128,  4, 45,115,  4,  9,  2,  9, 13,  9, 33,\r\n      9, 37,227,249,242,233,236,236,233, 99,128,  4, 33,228,229,243,\r\n    227,229,238,228,229,242,227,249,242,233,236,236,233, 99,128,  4,\r\n    170,104,128,  1,169,237,225,236,108,128,247,101,116,  3,  9, 52,\r\n      9, 78,  9, 92, 97,130,  3,151,  9, 60,  9, 70,242,237,229,238,\r\n    233,225,110,128,  5, 56,244,239,238,239,115,128,  3,137,104,129,\r\n      0,208,  9, 84,243,237,225,236,108,128,247,240,233,236,228,101,\r\n    129, 30,188,  9,101,226,229,236,239,119,128, 30, 26,245,242,111,\r\n    128, 32,172,250,104,130,  1,183,  9,124,  9,132,227,225,242,239,\r\n    110,128,  1,238,242,229,246,229,242,243,229,100,128,  1,184, 70,\r\n    136,  0, 70,  9,163,  9,172,  9,184,  9,212,  9,219,  9,248, 10,\r\n      4, 10, 15,227,233,242,227,236,101,128, 36,187,228,239,244,225,\r\n    227,227,229,238,116,128, 30, 30,101,  2,  9,190,  9,202,232,225,\r\n    242,237,229,238,233,225,110,128,  5, 86,233,227,239,240,244,233,\r\n     99,128,  3,228,232,239,239,107,128,  1,145,105,  2,  9,225,  9,\r\n    238,244,225,227,249,242,233,236,236,233, 99,128,  4,114,246,229,\r\n    242,239,237,225,110,128, 33,100,237,239,238,239,243,240,225,227,\r\n    101,128,255, 38,239,245,242,242,239,237,225,110,128, 33, 99,243,\r\n    237,225,236,108,128,247,102, 71,140,  0, 71, 10, 51, 10, 61, 10,\r\n    107, 10,115, 10,176, 10,193, 10,205, 11, 39, 11, 52, 11, 65, 11,\r\n     90, 11,107,194,243,241,245,225,242,101,128, 51,135, 97,  3, 10,\r\n     69, 10, 76, 10, 94,227,245,244,101,128,  1,244,237,237, 97,129,\r\n      3,147, 10, 84,225,230,242,233,227,225,110,128,  1,148,238,231,\r\n    233,225,227,239,240,244,233, 99,128,  3,234,226,242,229,246,101,\r\n    128,  1, 30, 99,  4, 10,125, 10,132, 10,141, 10,163,225,242,239,\r\n    110,128,  1,230,229,228,233,236,236, 97,128,  1, 34,233,242, 99,\r\n      2, 10,149, 10,154,236,101,128, 36,188,245,237,230,236,229,120,\r\n    128,  1, 28,239,237,237,225,225,227,227,229,238,116,128,  1, 34,\r\n    228,239,116,129,  1, 32, 10,184,225,227,227,229,238,116,128,  1,\r\n     32,229,227,249,242,233,236,236,233, 99,128,  4, 19,104,  3, 10,\r\n    213, 10,226, 11, 33,225,228,225,242,237,229,238,233,225,110,128,\r\n      5, 66,101,  3, 10,234, 10,255, 11, 16,237,233,228,228,236,229,\r\n    232,239,239,235,227,249,242,233,236,236,233, 99,128,  4,148,243,\r\n    244,242,239,235,229,227,249,242,233,236,236,233, 99,128,  4,146,\r\n    245,240,244,245,242,238,227,249,242,233,236,236,233, 99,128,  4,\r\n    144,239,239,107,128,  1,147,233,237,225,242,237,229,238,233,225,\r\n    110,128,  5, 51,234,229,227,249,242,233,236,236,233, 99,128,  4,\r\n      3,109,  2, 11, 71, 11, 79,225,227,242,239,110,128, 30, 32,239,\r\n    238,239,243,240,225,227,101,128,255, 39,242,225,246,101,129,246,\r\n    206, 11, 99,243,237,225,236,108,128,247, 96,115,  2, 11,113, 11,\r\n    129,237,225,236,108,129,247,103, 11,122,232,239,239,107,128,  2,\r\n    155,244,242,239,235,101,128,  1,228, 72,140,  0, 72, 11,165, 11,\r\n    190, 11,198, 11,208, 12, 17, 12, 40, 12, 77, 12,117, 12,129, 12,\r\n    157, 12,165, 12,189,177,184, 53,  3, 11,175, 11,180, 11,185,179,\r\n     51,128, 37,207,180, 51,128, 37,170,181, 49,128, 37,171,178,178,\r\n    176,183, 51,128, 37,161,208,243,241,245,225,242,101,128, 51,203,\r\n     97,  3, 11,216, 11,236, 12,  0,225,226,235,232,225,243,233,225,\r\n    238,227,249,242,233,236,236,233, 99,128,  4,168,228,229,243,227,\r\n    229,238,228,229,242,227,249,242,233,236,236,233, 99,128,  4,178,\r\n    242,228,243,233,231,238,227,249,242,233,236,236,233, 99,128,  4,\r\n     42, 98,  2, 12, 23, 12, 28,225,114,128,  1, 38,242,229,246,229,\r\n    226,229,236,239,119,128, 30, 42, 99,  2, 12, 46, 12, 55,229,228,\r\n    233,236,236, 97,128, 30, 40,233,242, 99,  2, 12, 63, 12, 68,236,\r\n    101,128, 36,189,245,237,230,236,229,120,128,  1, 36,100,  2, 12,\r\n     83, 12, 93,233,229,242,229,243,233,115,128, 30, 38,239,116,  2,\r\n     12,100, 12,109,225,227,227,229,238,116,128, 30, 34,226,229,236,\r\n    239,119,128, 30, 36,237,239,238,239,243,240,225,227,101,128,255,\r\n     40,111,  2, 12,135, 12,146,225,242,237,229,238,233,225,110,128,\r\n      5, 64,242,233,227,239,240,244,233, 99,128,  3,232,243,237,225,\r\n    236,108,128,247,104,245,238,231,225,242,245,237,236,225,245,116,\r\n    129,246,207, 12,181,243,237,225,236,108,128,246,248,250,243,241,\r\n    245,225,242,101,128, 51,144, 73,146,  0, 73, 12,239, 12,251, 12,\r\n    255, 13, 11, 13, 29, 13, 37, 13, 94, 13,181, 13,214, 13,224, 13,\r\n    242, 13,254, 14, 48, 14, 86, 14, 99, 14,166, 14,187, 14,205,193,\r\n    227,249,242,233,236,236,233, 99,128,  4, 47, 74,128,  1, 50,213,\r\n    227,249,242,233,236,236,233, 99,128,  4, 46,225,227,245,244,101,\r\n    129,  0,205, 13, 21,243,237,225,236,108,128,247,237,226,242,229,\r\n    246,101,128,  1, 44, 99,  3, 13, 45, 13, 52, 13, 84,225,242,239,\r\n    110,128,  1,207,233,242, 99,  2, 13, 60, 13, 65,236,101,128, 36,\r\n    190,245,237,230,236,229,120,129,  0,206, 13, 76,243,237,225,236,\r\n    108,128,247,238,249,242,233,236,236,233, 99,128,  4,  6,100,  3,\r\n     13,102, 13,112, 13,155,226,236,231,242,225,246,101,128,  2,  8,\r\n    233,229,242,229,243,233,115,131,  0,207, 13,128, 13,136, 13,147,\r\n    225,227,245,244,101,128, 30, 46,227,249,242,233,236,236,233, 99,\r\n    128,  4,228,243,237,225,236,108,128,247,239,239,116,130,  1, 48,\r\n     13,164, 13,173,225,227,227,229,238,116,128,  1, 48,226,229,236,\r\n    239,119,128, 30,202,101,  2, 13,187, 13,203,226,242,229,246,229,\r\n    227,249,242,233,236,236,233, 99,128,  4,214,227,249,242,233,236,\r\n    236,233, 99,128,  4, 21,230,242,225,235,244,245,114,128, 33, 17,\r\n    231,242,225,246,101,129,  0,204, 13,234,243,237,225,236,108,128,\r\n    247,236,232,239,239,235,225,226,239,246,101,128, 30,200,105,  3,\r\n     14,  6, 14, 17, 14, 32,227,249,242,233,236,236,233, 99,128,  4,\r\n     24,238,246,229,242,244,229,228,226,242,229,246,101,128,  2, 10,\r\n    243,232,239,242,244,227,249,242,233,236,236,233, 99,128,  4, 25,\r\n    109,  2, 14, 54, 14, 75,225,227,242,239,110,129,  1, 42, 14, 64,\r\n    227,249,242,233,236,236,233, 99,128,  4,226,239,238,239,243,240,\r\n    225,227,101,128,255, 41,238,233,225,242,237,229,238,233,225,110,\r\n    128,  5, 59,111,  3, 14,107, 14,118, 14,126,227,249,242,233,236,\r\n    236,233, 99,128,  4,  1,231,239,238,229,107,128,  1, 46,244, 97,\r\n    131,  3,153, 14,137, 14,147, 14,158,225,230,242,233,227,225,110,\r\n    128,  1,150,228,233,229,242,229,243,233,115,128,  3,170,244,239,\r\n    238,239,115,128,  3,138,115,  2, 14,172, 14,179,237,225,236,108,\r\n    128,247,105,244,242,239,235,101,128,  1,151,244,233,236,228,101,\r\n    129,  1, 40, 14,197,226,229,236,239,119,128, 30, 44,250,232,233,\r\n    244,243, 97,  2, 14,216, 14,227,227,249,242,233,236,236,233, 99,\r\n    128,  4,116,228,226,236,231,242,225,246,229,227,249,242,233,236,\r\n    236,233, 99,128,  4,118, 74,134,  0, 74, 15,  6, 15, 18, 15, 41,\r\n     15, 53, 15, 67, 15, 79,225,225,242,237,229,238,233,225,110,128,\r\n      5, 65,227,233,242, 99,  2, 15, 27, 15, 32,236,101,128, 36,191,\r\n    245,237,230,236,229,120,128,  1, 52,229,227,249,242,233,236,236,\r\n    233, 99,128,  4,  8,232,229,232,225,242,237,229,238,233,225,110,\r\n    128,  5, 75,237,239,238,239,243,240,225,227,101,128,255, 42,243,\r\n    237,225,236,108,128,247,106, 75,140,  0, 75, 15,115, 15,125, 15,\r\n    135, 16, 18, 16, 65, 16, 76, 16,106, 16,143, 16,156, 16,168, 16,\r\n    180, 16,208,194,243,241,245,225,242,101,128, 51,133,203,243,241,\r\n    245,225,242,101,128, 51,205, 97,  7, 15,151, 15,169, 15,191, 15,\r\n    211, 15,226, 15,232, 15,249,226,225,243,232,235,233,242,227,249,\r\n    242,233,236,236,233, 99,128,  4,160, 99,  2, 15,175, 15,181,245,\r\n    244,101,128, 30, 48,249,242,233,236,236,233, 99,128,  4, 26,228,\r\n    229,243,227,229,238,228,229,242,227,249,242,233,236,236,233, 99,\r\n    128,  4,154,232,239,239,235,227,249,242,233,236,236,233, 99,128,\r\n      4,195,240,240, 97,128,  3,154,243,244,242,239,235,229,227,249,\r\n    242,233,236,236,233, 99,128,  4,158,246,229,242,244,233,227,225,\r\n    236,243,244,242,239,235,229,227,249,242,233,236,236,233, 99,128,\r\n      4,156, 99,  4, 16, 28, 16, 35, 16, 44, 16, 52,225,242,239,110,\r\n    128,  1,232,229,228,233,236,236, 97,128,  1, 54,233,242,227,236,\r\n    101,128, 36,192,239,237,237,225,225,227,227,229,238,116,128,  1,\r\n     54,228,239,244,226,229,236,239,119,128, 30, 50,101,  2, 16, 82,\r\n     16, 94,232,225,242,237,229,238,233,225,110,128,  5, 84,238,225,\r\n    242,237,229,238,233,225,110,128,  5, 63,104,  3, 16,114, 16,126,\r\n     16,137,225,227,249,242,233,236,236,233, 99,128,  4, 37,229,233,\r\n    227,239,240,244,233, 99,128,  3,230,239,239,107,128,  1,152,234,\r\n    229,227,249,242,233,236,236,233, 99,128,  4, 12,236,233,238,229,\r\n    226,229,236,239,119,128, 30, 52,237,239,238,239,243,240,225,227,\r\n    101,128,255, 43,239,240,240, 97,  2, 16,189, 16,200,227,249,242,\r\n    233,236,236,233, 99,128,  4,128,231,242,229,229,107,128,  3,222,\r\n    115,  2, 16,214, 16,226,233,227,249,242,233,236,236,233, 99,128,\r\n      4,110,237,225,236,108,128,247,107, 76,138,  0, 76, 17,  1, 17,\r\n      5, 17,  9, 17, 29, 17, 95, 17,133, 17,147, 17,165, 17,177, 17,\r\n    189, 74,128,  1,199, 76,128,246,191, 97,  2, 17, 15, 17, 22,227,\r\n    245,244,101,128,  1, 57,237,226,228, 97,128,  3,155, 99,  4, 17,\r\n     39, 17, 46, 17, 55, 17, 82,225,242,239,110,128,  1, 61,229,228,\r\n    233,236,236, 97,128,  1, 59,233,242, 99,  2, 17, 63, 17, 68,236,\r\n    101,128, 36,193,245,237,230,236,229,248,226,229,236,239,119,128,\r\n     30, 60,239,237,237,225,225,227,227,229,238,116,128,  1, 59,228,\r\n    239,116,130,  1, 63, 17,105, 17,114,225,227,227,229,238,116,128,\r\n      1, 63,226,229,236,239,119,129, 30, 54, 17,124,237,225,227,242,\r\n    239,110,128, 30, 56,233,247,238,225,242,237,229,238,233,225,110,\r\n    128,  5, 60,106,129,  1,200, 17,153,229,227,249,242,233,236,236,\r\n    233, 99,128,  4,  9,236,233,238,229,226,229,236,239,119,128, 30,\r\n     58,237,239,238,239,243,240,225,227,101,128,255, 44,115,  2, 17,\r\n    195, 17,212,236,225,243,104,129,  1, 65, 17,204,243,237,225,236,\r\n    108,128,246,249,237,225,236,108,128,247,108, 77,137,  0, 77, 17,\r\n    241, 17,251, 18, 24, 18, 33, 18, 58, 18, 71, 18, 83, 18, 91, 18,\r\n    100,194,243,241,245,225,242,101,128, 51,134,225, 99,  2, 18,  2,\r\n     18, 18,242,239,110,129,246,208, 18, 10,243,237,225,236,108,128,\r\n    247,175,245,244,101,128, 30, 62,227,233,242,227,236,101,128, 36,\r\n    194,228,239,116,  2, 18, 41, 18, 50,225,227,227,229,238,116,128,\r\n     30, 64,226,229,236,239,119,128, 30, 66,229,238,225,242,237,229,\r\n    238,233,225,110,128,  5, 68,237,239,238,239,243,240,225,227,101,\r\n    128,255, 45,243,237,225,236,108,128,247,109,244,245,242,238,229,\r\n    100,128,  1,156,117,128,  3,156, 78,141,  0, 78, 18,134, 18,138,\r\n     18,146, 18,212, 18,237, 18,248, 19,  3, 19, 21, 19, 33, 19, 45,\r\n     19, 58, 19, 66, 19, 84, 74,128,  1,202,225,227,245,244,101,128,\r\n      1, 67, 99,  4, 18,156, 18,163, 18,172, 18,199,225,242,239,110,\r\n    128,  1, 71,229,228,233,236,236, 97,128,  1, 69,233,242, 99,  2,\r\n     18,180, 18,185,236,101,128, 36,195,245,237,230,236,229,248,226,\r\n    229,236,239,119,128, 30, 74,239,237,237,225,225,227,227,229,238,\r\n    116,128,  1, 69,228,239,116,  2, 18,220, 18,229,225,227,227,229,\r\n    238,116,128, 30, 68,226,229,236,239,119,128, 30, 70,232,239,239,\r\n    235,236,229,230,116,128,  1,157,233,238,229,242,239,237,225,110,\r\n    128, 33,104,106,129,  1,203, 19,  9,229,227,249,242,233,236,236,\r\n    233, 99,128,  4, 10,236,233,238,229,226,229,236,239,119,128, 30,\r\n     72,237,239,238,239,243,240,225,227,101,128,255, 46,239,247,225,\r\n    242,237,229,238,233,225,110,128,  5, 70,243,237,225,236,108,128,\r\n    247,110,244,233,236,228,101,129,  0,209, 19, 76,243,237,225,236,\r\n    108,128,247,241,117,128,  3,157, 79,141,  0, 79, 19,118, 19,132,\r\n     19,150, 19,203, 20, 78, 20,152, 20,187, 21, 48, 21, 69, 21,213,\r\n     21,223, 21,254, 22, 53, 69,129,  1, 82, 19,124,243,237,225,236,\r\n    108,128,246,250,225,227,245,244,101,129,  0,211, 19,142,243,237,\r\n    225,236,108,128,247,243, 98,  2, 19,156, 19,196,225,242,242,229,\r\n    100,  2, 19,166, 19,177,227,249,242,233,236,236,233, 99,128,  4,\r\n    232,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233,\r\n     99,128,  4,234,242,229,246,101,128,  1, 78, 99,  4, 19,213, 19,\r\n    220, 19,235, 20, 68,225,242,239,110,128,  1,209,229,238,244,229,\r\n    242,229,228,244,233,236,228,101,128,  1,159,233,242, 99,  2, 19,\r\n    243, 19,248,236,101,128, 36,196,245,237,230,236,229,120,134,  0,\r\n    212, 20, 13, 20, 21, 20, 32, 20, 40, 20, 52, 20, 60,225,227,245,\r\n    244,101,128, 30,208,228,239,244,226,229,236,239,119,128, 30,216,\r\n    231,242,225,246,101,128, 30,210,232,239,239,235,225,226,239,246,\r\n    101,128, 30,212,243,237,225,236,108,128,247,244,244,233,236,228,\r\n    101,128, 30,214,249,242,233,236,236,233, 99,128,  4, 30,100,  3,\r\n     20, 86, 20,109, 20,142,226,108,  2, 20, 93, 20,101,225,227,245,\r\n    244,101,128,  1, 80,231,242,225,246,101,128,  2, 12,233,229,242,\r\n    229,243,233,115,130,  0,214, 20,123, 20,134,227,249,242,233,236,\r\n    236,233, 99,128,  4,230,243,237,225,236,108,128,247,246,239,244,\r\n    226,229,236,239,119,128, 30,204,103,  2, 20,158, 20,170,239,238,\r\n    229,235,243,237,225,236,108,128,246,251,242,225,246,101,129,  0,\r\n    210, 20,179,243,237,225,236,108,128,247,242,104,  4, 20,197, 20,\r\n    208, 20,212, 21, 34,225,242,237,229,238,233,225,110,128,  5, 85,\r\n    109,128, 33, 38,111,  2, 20,218, 20,228,239,235,225,226,239,246,\r\n    101,128, 30,206,242,110,133,  1,160, 20,243, 20,251, 21,  6, 21,\r\n     14, 21, 26,225,227,245,244,101,128, 30,218,228,239,244,226,229,\r\n    236,239,119,128, 30,226,231,242,225,246,101,128, 30,220,232,239,\r\n    239,235,225,226,239,246,101,128, 30,222,244,233,236,228,101,128,\r\n     30,224,245,238,231,225,242,245,237,236,225,245,116,128,  1, 80,\r\n    105,129,  1,162, 21, 54,238,246,229,242,244,229,228,226,242,229,\r\n    246,101,128,  2, 14,109,  4, 21, 79, 21,107, 21,184, 21,202,225,\r\n    227,242,239,110,130,  1, 76, 21, 91, 21, 99,225,227,245,244,101,\r\n    128, 30, 82,231,242,225,246,101,128, 30, 80,229,231, 97,132, 33,\r\n     38, 21,121, 21,132, 21,140, 21,156,227,249,242,233,236,236,233,\r\n     99,128,  4, 96,231,242,229,229,107,128,  3,169,242,239,245,238,\r\n    228,227,249,242,233,236,236,233, 99,128,  4,122,116,  2, 21,162,\r\n     21,177,233,244,236,239,227,249,242,233,236,236,233, 99,128,  4,\r\n    124,239,238,239,115,128,  3,143,233,227,242,239,110,129,  3,159,\r\n     21,194,244,239,238,239,115,128,  3,140,239,238,239,243,240,225,\r\n    227,101,128,255, 47,238,229,242,239,237,225,110,128, 33, 96,111,\r\n      2, 21,229, 21,248,231,239,238,229,107,129,  1,234, 21,239,237,\r\n    225,227,242,239,110,128,  1,236,240,229,110,128,  1,134,115,  3,\r\n     22,  6, 22, 33, 22, 40,236,225,243,104,130,  0,216, 22, 17, 22,\r\n     25,225,227,245,244,101,128,  1,254,243,237,225,236,108,128,247,\r\n    248,237,225,236,108,128,247,111,244,242,239,235,229,225,227,245,\r\n    244,101,128,  1,254,116,  2, 22, 59, 22, 70,227,249,242,233,236,\r\n    236,233, 99,128,  4,126,233,236,228,101,131,  0,213, 22, 83, 22,\r\n     91, 22,102,225,227,245,244,101,128, 30, 76,228,233,229,242,229,\r\n    243,233,115,128, 30, 78,243,237,225,236,108,128,247,245, 80,136,\r\n      0, 80, 22,130, 22,138, 22,147, 22,159, 22,211, 22,227, 22,246,\r\n     23,  2,225,227,245,244,101,128, 30, 84,227,233,242,227,236,101,\r\n    128, 36,197,228,239,244,225,227,227,229,238,116,128, 30, 86,101,\r\n      3, 22,167, 22,178, 22,190,227,249,242,233,236,236,233, 99,128,\r\n      4, 31,232,225,242,237,229,238,233,225,110,128,  5, 74,237,233,\r\n    228,228,236,229,232,239,239,235,227,249,242,233,236,236,233, 99,\r\n    128,  4,166,104,  2, 22,217, 22,221,105,128,  3,166,239,239,107,\r\n    128,  1,164,105,129,  3,160, 22,233,247,242,225,242,237,229,238,\r\n    233,225,110,128,  5, 83,237,239,238,239,243,240,225,227,101,128,\r\n    255, 48,115,  2, 23,  8, 23, 25,105,129,  3,168, 23, 14,227,249,\r\n    242,233,236,236,233, 99,128,  4,112,237,225,236,108,128,247,112,\r\n     81,131,  0, 81, 23, 42, 23, 51, 23, 63,227,233,242,227,236,101,\r\n    128, 36,198,237,239,238,239,243,240,225,227,101,128,255, 49,243,\r\n    237,225,236,108,128,247,113, 82,138,  0, 82, 23, 95, 23,119, 23,\r\n    166, 23,217, 23,230, 23,240, 23,245, 24, 19, 24, 31, 24, 43, 97,\r\n      2, 23,101, 23,112,225,242,237,229,238,233,225,110,128,  5, 76,\r\n    227,245,244,101,128,  1, 84, 99,  4, 23,129, 23,136, 23,145, 23,\r\n    153,225,242,239,110,128,  1, 88,229,228,233,236,236, 97,128,  1,\r\n     86,233,242,227,236,101,128, 36,199,239,237,237,225,225,227,227,\r\n    229,238,116,128,  1, 86,100,  2, 23,172, 23,182,226,236,231,242,\r\n    225,246,101,128,  2, 16,239,116,  2, 23,189, 23,198,225,227,227,\r\n    229,238,116,128, 30, 88,226,229,236,239,119,129, 30, 90, 23,208,\r\n    237,225,227,242,239,110,128, 30, 92,229,232,225,242,237,229,238,\r\n    233,225,110,128,  5, 80,230,242,225,235,244,245,114,128, 33, 28,\r\n    232,111,128,  3,161,233,110,  2, 23,252, 24,  5,231,243,237,225,\r\n    236,108,128,246,252,246,229,242,244,229,228,226,242,229,246,101,\r\n    128,  2, 18,236,233,238,229,226,229,236,239,119,128, 30, 94,237,\r\n    239,238,239,243,240,225,227,101,128,255, 50,243,237,225,236,108,\r\n    129,247,114, 24, 53,233,238,246,229,242,244,229,100,129,  2,129,\r\n     24, 66,243,245,240,229,242,233,239,114,128,  2,182, 83,139,  0,\r\n     83, 24,103, 26, 17, 26, 55, 26,182, 26,221, 26,250, 27, 84, 27,\r\n    105, 27,117, 27,135, 27,143, 70,  6, 24,117, 24,209, 24,241, 25,\r\n     77, 25,119, 25,221, 48,  9, 24,137, 24,145, 24,153, 24,161, 24,\r\n    169, 24,177, 24,185, 24,193, 24,201,177,176,176,176, 48,128, 37,\r\n     12,178,176,176,176, 48,128, 37, 20,179,176,176,176, 48,128, 37,\r\n     16,180,176,176,176, 48,128, 37, 24,181,176,176,176, 48,128, 37,\r\n     60,182,176,176,176, 48,128, 37, 44,183,176,176,176, 48,128, 37,\r\n     52,184,176,176,176, 48,128, 37, 28,185,176,176,176, 48,128, 37,\r\n     36, 49,  3, 24,217, 24,225, 24,233,176,176,176,176, 48,128, 37,\r\n      0,177,176,176,176, 48,128, 37,  2,185,176,176,176, 48,128, 37,\r\n     97, 50,  9, 25,  5, 25, 13, 25, 21, 25, 29, 25, 37, 25, 45, 25,\r\n     53, 25, 61, 25, 69,176,176,176,176, 48,128, 37, 98,177,176,176,\r\n    176, 48,128, 37, 86,178,176,176,176, 48,128, 37, 85,179,176,176,\r\n    176, 48,128, 37, 99,180,176,176,176, 48,128, 37, 81,181,176,176,\r\n    176, 48,128, 37, 87,182,176,176,176, 48,128, 37, 93,183,176,176,\r\n    176, 48,128, 37, 92,184,176,176,176, 48,128, 37, 91, 51,  4, 25,\r\n     87, 25, 95, 25,103, 25,111,182,176,176,176, 48,128, 37, 94,183,\r\n    176,176,176, 48,128, 37, 95,184,176,176,176, 48,128, 37, 90,185,\r\n    176,176,176, 48,128, 37, 84, 52, 10, 25,141, 25,149, 25,157, 25,\r\n    165, 25,173, 25,181, 25,189, 25,197, 25,205, 25,213,176,176,176,\r\n    176, 48,128, 37,105,177,176,176,176, 48,128, 37,102,178,176,176,\r\n    176, 48,128, 37, 96,179,176,176,176, 48,128, 37, 80,180,176,176,\r\n    176, 48,128, 37,108,181,176,176,176, 48,128, 37,103,182,176,176,\r\n    176, 48,128, 37,104,183,176,176,176, 48,128, 37,100,184,176,176,\r\n    176, 48,128, 37,101,185,176,176,176, 48,128, 37, 89, 53,  5, 25,\r\n    233, 25,241, 25,249, 26,  1, 26,  9,176,176,176,176, 48,128, 37,\r\n     88,177,176,176,176, 48,128, 37, 82,178,176,176,176, 48,128, 37,\r\n     83,179,176,176,176, 48,128, 37,107,180,176,176,176, 48,128, 37,\r\n    106, 97,  2, 26, 23, 26, 44,227,245,244,101,129,  1, 90, 26, 32,\r\n    228,239,244,225,227,227,229,238,116,128, 30,100,237,240,233,231,\r\n    242,229,229,107,128,  3,224, 99,  5, 26, 67, 26, 98, 26,107, 26,\r\n    147, 26,169,225,242,239,110,130,  1, 96, 26, 78, 26, 90,228,239,\r\n    244,225,227,227,229,238,116,128, 30,102,243,237,225,236,108,128,\r\n    246,253,229,228,233,236,236, 97,128,  1, 94,232,247, 97,130,  1,\r\n    143, 26,117, 26,128,227,249,242,233,236,236,233, 99,128,  4,216,\r\n    228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,\r\n    128,  4,218,233,242, 99,  2, 26,155, 26,160,236,101,128, 36,200,\r\n    245,237,230,236,229,120,128,  1, 92,239,237,237,225,225,227,227,\r\n    229,238,116,128,  2, 24,228,239,116,  2, 26,190, 26,199,225,227,\r\n    227,229,238,116,128, 30, 96,226,229,236,239,119,129, 30, 98, 26,\r\n    209,228,239,244,225,227,227,229,238,116,128, 30,104,101,  2, 26,\r\n    227, 26,239,232,225,242,237,229,238,233,225,110,128,  5, 77,246,\r\n    229,238,242,239,237,225,110,128, 33,102,104,  5, 27,  6, 27, 34,\r\n     27, 48, 27, 59, 27, 72, 97,  2, 27, 12, 27, 23,225,242,237,229,\r\n    238,233,225,110,128,  5, 71,227,249,242,233,236,236,233, 99,128,\r\n      4, 40,227,232,225,227,249,242,233,236,236,233, 99,128,  4, 41,\r\n    229,233,227,239,240,244,233, 99,128,  3,226,232,225,227,249,242,\r\n    233,236,236,233, 99,128,  4,186,233,237,225,227,239,240,244,233,\r\n     99,128,  3,236,105,  2, 27, 90, 27, 96,231,237, 97,128,  3,163,\r\n    248,242,239,237,225,110,128, 33,101,237,239,238,239,243,240,225,\r\n    227,101,128,255, 51,239,230,244,243,233,231,238,227,249,242,233,\r\n    236,236,233, 99,128,  4, 44,243,237,225,236,108,128,247,115,244,\r\n    233,231,237,225,231,242,229,229,107,128,  3,218, 84,141,  0, 84,\r\n     27,186, 27,191, 27,197, 28,  7, 28, 32, 28, 96, 28,147, 28,177,\r\n     28,189, 28,201, 28,246, 29,  6, 29, 46,225,117,128,  3,164,226,\r\n    225,114,128,  1,102, 99,  4, 27,207, 27,214, 27,223, 27,250,225,\r\n    242,239,110,128,  1,100,229,228,233,236,236, 97,128,  1, 98,233,\r\n    242, 99,  2, 27,231, 27,236,236,101,128, 36,201,245,237,230,236,\r\n    229,248,226,229,236,239,119,128, 30,112,239,237,237,225,225,227,\r\n    227,229,238,116,128,  1, 98,228,239,116,  2, 28, 15, 28, 24,225,\r\n    227,227,229,238,116,128, 30,106,226,229,236,239,119,128, 30,108,\r\n    101,  4, 28, 42, 28, 53, 28, 73, 28, 82,227,249,242,233,236,236,\r\n    233, 99,128,  4, 34,228,229,243,227,229,238,228,229,242,227,249,\r\n    242,233,236,236,233, 99,128,  4,172,238,242,239,237,225,110,128,\r\n     33,105,244,243,229,227,249,242,233,236,236,233, 99,128,  4,180,\r\n    104,  3, 28,104, 28,110, 28,136,229,244, 97,128,  3,152,111,  2,\r\n     28,116, 28,121,239,107,128,  1,172,242,110,129,  0,222, 28,128,\r\n    243,237,225,236,108,128,247,254,242,229,229,242,239,237,225,110,\r\n    128, 33, 98,105,  2, 28,153, 28,164,236,228,229,243,237,225,236,\r\n    108,128,246,254,247,238,225,242,237,229,238,233,225,110,128,  5,\r\n     79,236,233,238,229,226,229,236,239,119,128, 30,110,237,239,238,\r\n    239,243,240,225,227,101,128,255, 52,111,  2, 28,207, 28,218,225,\r\n    242,237,229,238,233,225,110,128,  5, 57,238,101,  3, 28,227, 28,\r\n    234, 28,240,230,233,246,101,128,  1,188,243,233,120,128,  1,132,\r\n    244,247,111,128,  1,167,242,229,244,242,239,230,236,229,248,232,\r\n    239,239,107,128,  1,174,115,  3, 29, 14, 29, 26, 29, 39,229,227,\r\n    249,242,233,236,236,233, 99,128,  4, 38,232,229,227,249,242,233,\r\n    236,236,233, 99,128,  4, 11,237,225,236,108,128,247,116,119,  2,\r\n     29, 52, 29, 64,229,236,246,229,242,239,237,225,110,128, 33,107,\r\n    239,242,239,237,225,110,128, 33, 97, 85,142,  0, 85, 29,105, 29,\r\n    123, 29,131, 29,198, 30, 69, 30, 87, 30,198, 30,214, 30,226, 31,\r\n     21, 31, 30, 31,142, 31,149, 31,219,225,227,245,244,101,129,  0,\r\n    218, 29,115,243,237,225,236,108,128,247,250,226,242,229,246,101,\r\n    128,  1,108, 99,  3, 29,139, 29,146, 29,188,225,242,239,110,128,\r\n      1,211,233,242, 99,  2, 29,154, 29,159,236,101,128, 36,202,245,\r\n    237,230,236,229,120,130,  0,219, 29,172, 29,180,226,229,236,239,\r\n    119,128, 30,118,243,237,225,236,108,128,247,251,249,242,233,236,\r\n    236,233, 99,128,  4, 35,100,  3, 29,206, 29,229, 30, 59,226,108,\r\n      2, 29,213, 29,221,225,227,245,244,101,128,  1,112,231,242,225,\r\n    246,101,128,  2, 20,233,229,242,229,243,233,115,134,  0,220, 29,\r\n    251, 30,  3, 30, 11, 30, 34, 30, 42, 30, 51,225,227,245,244,101,\r\n    128,  1,215,226,229,236,239,119,128, 30,114, 99,  2, 30, 17, 30,\r\n     24,225,242,239,110,128,  1,217,249,242,233,236,236,233, 99,128,\r\n      4,240,231,242,225,246,101,128,  1,219,237,225,227,242,239,110,\r\n    128,  1,213,243,237,225,236,108,128,247,252,239,244,226,229,236,\r\n    239,119,128, 30,228,231,242,225,246,101,129,  0,217, 30, 79,243,\r\n    237,225,236,108,128,247,249,104,  2, 30, 93, 30,171,111,  2, 30,\r\n     99, 30,109,239,235,225,226,239,246,101,128, 30,230,242,110,133,\r\n      1,175, 30,124, 30,132, 30,143, 30,151, 30,163,225,227,245,244,\r\n    101,128, 30,232,228,239,244,226,229,236,239,119,128, 30,240,231,\r\n    242,225,246,101,128, 30,234,232,239,239,235,225,226,239,246,101,\r\n    128, 30,236,244,233,236,228,101,128, 30,238,245,238,231,225,242,\r\n    245,237,236,225,245,116,129,  1,112, 30,187,227,249,242,233,236,\r\n    236,233, 99,128,  4,242,233,238,246,229,242,244,229,228,226,242,\r\n    229,246,101,128,  2, 22,235,227,249,242,233,236,236,233, 99,128,\r\n      4,120,109,  2, 30,232, 31, 10,225,227,242,239,110,130,  1,106,\r\n     30,244, 30,255,227,249,242,233,236,236,233, 99,128,  4,238,228,\r\n    233,229,242,229,243,233,115,128, 30,122,239,238,239,243,240,225,\r\n    227,101,128,255, 53,239,231,239,238,229,107,128,  1,114,240,243,\r\n    233,236,239,110,133,  3,165, 31, 49, 31, 53, 31, 90, 31,121, 31,\r\n    134, 49,128,  3,210, 97,  2, 31, 59, 31, 81,227,245,244,229,232,\r\n    239,239,235,243,249,237,226,239,236,231,242,229,229,107,128,  3,\r\n    211,230,242,233,227,225,110,128,  1,177,228,233,229,242,229,243,\r\n    233,115,129,  3,171, 31,103,232,239,239,235,243,249,237,226,239,\r\n    236,231,242,229,229,107,128,  3,212,232,239,239,235,243,249,237,\r\n    226,239,108,128,  3,210,244,239,238,239,115,128,  3,142,242,233,\r\n    238,103,128,  1,110,115,  3, 31,157, 31,172, 31,179,232,239,242,\r\n    244,227,249,242,233,236,236,233, 99,128,  4, 14,237,225,236,108,\r\n    128,247,117,244,242,225,233,231,232,116,  2, 31,191, 31,202,227,\r\n    249,242,233,236,236,233, 99,128,  4,174,243,244,242,239,235,229,\r\n    227,249,242,233,236,236,233, 99,128,  4,176,244,233,236,228,101,\r\n    130,  1,104, 31,231, 31,239,225,227,245,244,101,128, 30,120,226,\r\n    229,236,239,119,128, 30,116, 86,136,  0, 86, 32, 11, 32, 20, 32,\r\n     31, 32, 60, 32, 67, 32, 79, 32, 91, 32, 99,227,233,242,227,236,\r\n    101,128, 36,203,228,239,244,226,229,236,239,119,128, 30,126,101,\r\n      2, 32, 37, 32, 48,227,249,242,233,236,236,233, 99,128,  4, 18,\r\n    247,225,242,237,229,238,233,225,110,128,  5, 78,232,239,239,107,\r\n    128,  1,178,237,239,238,239,243,240,225,227,101,128,255, 54,239,\r\n    225,242,237,229,238,233,225,110,128,  5, 72,243,237,225,236,108,\r\n    128,247,118,244,233,236,228,101,128, 30,124, 87,134,  0, 87, 32,\r\n    123, 32,131, 32,154, 32,194, 32,202, 32,214,225,227,245,244,101,\r\n    128, 30,130,227,233,242, 99,  2, 32,140, 32,145,236,101,128, 36,\r\n    204,245,237,230,236,229,120,128,  1,116,100,  2, 32,160, 32,170,\r\n    233,229,242,229,243,233,115,128, 30,132,239,116,  2, 32,177, 32,\r\n    186,225,227,227,229,238,116,128, 30,134,226,229,236,239,119,128,\r\n     30,136,231,242,225,246,101,128, 30,128,237,239,238,239,243,240,\r\n    225,227,101,128,255, 55,243,237,225,236,108,128,247,119, 88,134,\r\n      0, 88, 32,238, 32,247, 33, 18, 33, 31, 33, 35, 33, 47,227,233,\r\n    242,227,236,101,128, 36,205,100,  2, 32,253, 33,  7,233,229,242,\r\n    229,243,233,115,128, 30,140,239,244,225,227,227,229,238,116,128,\r\n     30,138,229,232,225,242,237,229,238,233,225,110,128,  5, 61,105,\r\n    128,  3,158,237,239,238,239,243,240,225,227,101,128,255, 56,243,\r\n    237,225,236,108,128,247,120, 89,139,  0, 89, 33, 81, 33,116, 33,\r\n    139, 33,189, 33,228, 33,236, 33,253, 34, 40, 34, 52, 34, 60, 34,\r\n     68, 97,  2, 33, 87, 33,104,227,245,244,101,129,  0,221, 33, 96,\r\n    243,237,225,236,108,128,247,253,244,227,249,242,233,236,236,233,\r\n     99,128,  4, 98,227,233,242, 99,  2, 33,125, 33,130,236,101,128,\r\n     36,206,245,237,230,236,229,120,128,  1,118,100,  2, 33,145, 33,\r\n    165,233,229,242,229,243,233,115,129,  1,120, 33,157,243,237,225,\r\n    236,108,128,247,255,239,116,  2, 33,172, 33,181,225,227,227,229,\r\n    238,116,128, 30,142,226,229,236,239,119,128, 30,244,229,114,  2,\r\n     33,196, 33,208,233,227,249,242,233,236,236,233, 99,128,  4, 43,\r\n    245,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233,\r\n     99,128,  4,248,231,242,225,246,101,128, 30,242,232,239,239,107,\r\n    129,  1,179, 33,245,225,226,239,246,101,128, 30,246,105,  3, 34,\r\n      5, 34, 16, 34, 27,225,242,237,229,238,233,225,110,128,  5, 69,\r\n    227,249,242,233,236,236,233, 99,128,  4,  7,247,238,225,242,237,\r\n    229,238,233,225,110,128,  5, 82,237,239,238,239,243,240,225,227,\r\n    101,128,255, 57,243,237,225,236,108,128,247,121,244,233,236,228,\r\n    101,128, 30,248,245,115,  2, 34, 75, 34,113,226,233,103,  2, 34,\r\n     83, 34, 94,227,249,242,233,236,236,233, 99,128,  4,106,233,239,\r\n    244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128,  4,\r\n    108,236,233,244,244,236,101,  2, 34,124, 34,135,227,249,242,233,\r\n    236,236,233, 99,128,  4,102,233,239,244,233,230,233,229,228,227,\r\n    249,242,233,236,236,233, 99,128,  4,104, 90,136,  0, 90, 34,174,\r\n     34,198, 34,243, 35, 14, 35, 81, 35,173, 35,185, 35,197, 97,  2,\r\n     34,180, 34,191,225,242,237,229,238,233,225,110,128,  5, 54,227,\r\n    245,244,101,128,  1,121, 99,  2, 34,204, 34,221,225,242,239,110,\r\n    129,  1,125, 34,213,243,237,225,236,108,128,246,255,233,242, 99,\r\n      2, 34,229, 34,234,236,101,128, 36,207,245,237,230,236,229,120,\r\n    128, 30,144,228,239,116,130,  1,123, 34,253, 35,  6,225,227,227,\r\n    229,238,116,128,  1,123,226,229,236,239,119,128, 30,146,101,  3,\r\n     35, 22, 35, 33, 35, 76,227,249,242,233,236,236,233, 99,128,  4,\r\n     23,100,  2, 35, 39, 35, 58,229,243,227,229,238,228,229,242,227,\r\n    249,242,233,236,236,233, 99,128,  4,152,233,229,242,229,243,233,\r\n    243,227,249,242,233,236,236,233, 99,128,  4,222,244, 97,128,  3,\r\n    150,232,101,  4, 35, 92, 35,103, 35,119, 35,130,225,242,237,229,\r\n    238,233,225,110,128,  5, 58,226,242,229,246,229,227,249,242,233,\r\n    236,236,233, 99,128,  4,193,227,249,242,233,236,236,233, 99,128,\r\n      4, 22,100,  2, 35,136, 35,155,229,243,227,229,238,228,229,242,\r\n    227,249,242,233,236,236,233, 99,128,  4,150,233,229,242,229,243,\r\n    233,243,227,249,242,233,236,236,233, 99,128,  4,220,236,233,238,\r\n    229,226,229,236,239,119,128, 30,148,237,239,238,239,243,240,225,\r\n    227,101,128,255, 58,115,  2, 35,203, 35,210,237,225,236,108,128,\r\n    247,122,244,242,239,235,101,128,  1,181, 97,158,  0, 97, 36, 26,\r\n     38,154, 39,  4, 39, 68, 39,132, 39,196, 40,  4, 40, 68, 40,126,\r\n     40,190, 41, 70, 41,217, 42,137, 42,237, 43, 17, 49,192, 49,229,\r\n     50,  0, 50,225, 51,  7, 52, 96, 52,168, 53,123, 53,132, 54,  5,\r\n     56, 13, 57,  3, 57, 50, 57,201, 57,215, 49,138, 39,  1, 36, 50,\r\n     36,114, 36,154, 36,218, 37, 26, 37, 90, 37,154, 37,218, 38, 26,\r\n     38, 90, 48,138, 39, 33, 36, 74, 36, 78, 36, 82, 36, 86, 36, 90,\r\n     36, 94, 36, 98, 36,102, 36,106, 36,110, 48,128, 39, 94, 49,128,\r\n     39, 97, 50,128, 39, 98, 51,128, 39, 99, 52,128, 39,100, 53,128,\r\n     39, 16, 54,128, 39,101, 55,128, 39,102, 56,128, 39,103, 57,128,\r\n     38, 96, 49,134, 38, 27, 36,130, 36,134, 36,138, 36,142, 36,146,\r\n     36,150, 48,128, 38,101, 49,128, 38,102, 50,128, 38, 99, 55,128,\r\n     39,  9, 56,128, 39,  8, 57,128, 39,  7, 50,138, 38, 30, 36,178,\r\n     36,182, 36,186, 36,190, 36,194, 36,198, 36,202, 36,206, 36,210,\r\n     36,214, 48,128, 36, 96, 49,128, 36, 97, 50,128, 36, 98, 51,128,\r\n     36, 99, 52,128, 36,100, 53,128, 36,101, 54,128, 36,102, 55,128,\r\n     36,103, 56,128, 36,104, 57,128, 36,105, 51,138, 39, 12, 36,242,\r\n     36,246, 36,250, 36,254, 37,  2, 37,  6, 37, 10, 37, 14, 37, 18,\r\n     37, 22, 48,128, 39,118, 49,128, 39,119, 50,128, 39,120, 51,128,\r\n     39,121, 52,128, 39,122, 53,128, 39,123, 54,128, 39,124, 55,128,\r\n     39,125, 56,128, 39,126, 57,128, 39,127, 52,138, 39, 13, 37, 50,\r\n     37, 54, 37, 58, 37, 62, 37, 66, 37, 70, 37, 74, 37, 78, 37, 82,\r\n     37, 86, 48,128, 39,128, 49,128, 39,129, 50,128, 39,130, 51,128,\r\n     39,131, 52,128, 39,132, 53,128, 39,133, 54,128, 39,134, 55,128,\r\n     39,135, 56,128, 39,136, 57,128, 39,137, 53,138, 39, 14, 37,114,\r\n     37,118, 37,122, 37,126, 37,130, 37,134, 37,138, 37,142, 37,146,\r\n     37,150, 48,128, 39,138, 49,128, 39,139, 50,128, 39,140, 51,128,\r\n     39,141, 52,128, 39,142, 53,128, 39,143, 54,128, 39,144, 55,128,\r\n     39,145, 56,128, 39,146, 57,128, 39,147, 54,138, 39, 15, 37,178,\r\n     37,182, 37,186, 37,190, 37,194, 37,198, 37,202, 37,206, 37,210,\r\n     37,214, 48,128, 39,148, 49,128, 33,146, 50,128, 39,163, 51,128,\r\n     33,148, 52,128, 33,149, 53,128, 39,153, 54,128, 39,155, 55,128,\r\n     39,156, 56,128, 39,157, 57,128, 39,158, 55,138, 39, 17, 37,242,\r\n     37,246, 37,250, 37,254, 38,  2, 38,  6, 38, 10, 38, 14, 38, 18,\r\n     38, 22, 48,128, 39,159, 49,128, 39,160, 50,128, 39,161, 51,128,\r\n     39,162, 52,128, 39,164, 53,128, 39,165, 54,128, 39,166, 55,128,\r\n     39,167, 56,128, 39,168, 57,128, 39,169, 56,138, 39, 18, 38, 50,\r\n     38, 54, 38, 58, 38, 62, 38, 66, 38, 70, 38, 74, 38, 78, 38, 82,\r\n     38, 86, 48,128, 39,171, 49,128, 39,173, 50,128, 39,175, 51,128,\r\n     39,178, 52,128, 39,179, 53,128, 39,181, 54,128, 39,184, 55,128,\r\n     39,186, 56,128, 39,187, 57,128, 39,188, 57,138, 39, 19, 38,114,\r\n     38,118, 38,122, 38,126, 38,130, 38,134, 38,138, 38,142, 38,146,\r\n     38,150, 48,128, 39,189, 49,128, 39,190, 50,128, 39,154, 51,128,\r\n     39,170, 52,128, 39,182, 53,128, 39,185, 54,128, 39,152, 55,128,\r\n     39,180, 56,128, 39,183, 57,128, 39,172, 50,138, 39,  2, 38,178,\r\n     38,224, 38,228, 38,232, 38,236, 38,240, 38,244, 38,248, 38,252,\r\n     39,  0, 48,135, 39, 20, 38,196, 38,200, 38,204, 38,208, 38,212,\r\n     38,216, 38,220, 48,128, 39,174, 49,128, 39,177, 50,128, 39,  3,\r\n     51,128, 39, 80, 52,128, 39, 82, 53,128, 39,110, 54,128, 39,112,\r\n     49,128, 39, 21, 50,128, 39, 22, 51,128, 39, 23, 52,128, 39, 24,\r\n     53,128, 39, 25, 54,128, 39, 26, 55,128, 39, 27, 56,128, 39, 28,\r\n     57,128, 39, 34, 51,138, 39,  4, 39, 28, 39, 32, 39, 36, 39, 40,\r\n     39, 44, 39, 48, 39, 52, 39, 56, 39, 60, 39, 64, 48,128, 39, 35,\r\n     49,128, 39, 36, 50,128, 39, 37, 51,128, 39, 38, 52,128, 39, 39,\r\n     53,128, 38,  5, 54,128, 39, 41, 55,128, 39, 42, 56,128, 39, 43,\r\n     57,128, 39, 44, 52,138, 38, 14, 39, 92, 39, 96, 39,100, 39,104,\r\n     39,108, 39,112, 39,116, 39,120, 39,124, 39,128, 48,128, 39, 45,\r\n     49,128, 39, 46, 50,128, 39, 47, 51,128, 39, 48, 52,128, 39, 49,\r\n     53,128, 39, 50, 54,128, 39, 51, 55,128, 39, 52, 56,128, 39, 53,\r\n     57,128, 39, 54, 53,138, 39,  6, 39,156, 39,160, 39,164, 39,168,\r\n     39,172, 39,176, 39,180, 39,184, 39,188, 39,192, 48,128, 39, 55,\r\n     49,128, 39, 56, 50,128, 39, 57, 51,128, 39, 58, 52,128, 39, 59,\r\n     53,128, 39, 60, 54,128, 39, 61, 55,128, 39, 62, 56,128, 39, 63,\r\n     57,128, 39, 64, 54,138, 39, 29, 39,220, 39,224, 39,228, 39,232,\r\n     39,236, 39,240, 39,244, 39,248, 39,252, 40,  0, 48,128, 39, 65,\r\n     49,128, 39, 66, 50,128, 39, 67, 51,128, 39, 68, 52,128, 39, 69,\r\n     53,128, 39, 70, 54,128, 39, 71, 55,128, 39, 72, 56,128, 39, 73,\r\n     57,128, 39, 74, 55,138, 39, 30, 40, 28, 40, 32, 40, 36, 40, 40,\r\n     40, 44, 40, 48, 40, 52, 40, 56, 40, 60, 40, 64, 48,128, 39, 75,\r\n     49,128, 37,207, 50,128, 39, 77, 51,128, 37,160, 52,128, 39, 79,\r\n     53,128, 39, 81, 54,128, 37,178, 55,128, 37,188, 56,128, 37,198,\r\n     57,128, 39, 86, 56,137, 39, 31, 40, 90, 40, 94, 40, 98, 40,102,\r\n     40,106, 40,110, 40,114, 40,118, 40,122, 49,128, 37,215, 50,128,\r\n     39, 88, 51,128, 39, 89, 52,128, 39, 90, 53,128, 39,111, 54,128,\r\n     39,113, 55,128, 39,114, 56,128, 39,115, 57,128, 39,104, 57,138,\r\n     39, 32, 40,150, 40,154, 40,158, 40,162, 40,166, 40,170, 40,174,\r\n     40,178, 40,182, 40,186, 48,128, 39,105, 49,128, 39,108, 50,128,\r\n     39,109, 51,128, 39,106, 52,128, 39,107, 53,128, 39,116, 54,128,\r\n     39,117, 55,128, 39, 91, 56,128, 39, 92, 57,128, 39, 93, 97,  7,\r\n     40,206, 40,216, 40,223, 40,230, 40,255, 41, 15, 41, 26,226,229,\r\n    238,231,225,236,105,128,  9,134,227,245,244,101,128,  0,225,228,\r\n    229,246, 97,128,  9,  6,231,117,  2, 40,237, 40,246,234,225,242,\r\n    225,244,105,128, 10,134,242,237,245,235,232,105,128, 10,  6,237,\r\n    225,244,242,225,231,245,242,237,245,235,232,105,128, 10, 62,242,\r\n    245,243,241,245,225,242,101,128, 51,  3,246,239,247,229,236,243,\r\n    233,231,110,  3, 41, 42, 41, 52, 41, 59,226,229,238,231,225,236,\r\n    105,128,  9,190,228,229,246, 97,128,  9, 62,231,245,234,225,242,\r\n    225,244,105,128, 10,190, 98,  4, 41, 80, 41,121, 41,130, 41,140,\r\n    226,242,229,246,233,225,244,233,239,110,  2, 41, 95, 41,110,237,\r\n    225,242,235,225,242,237,229,238,233,225,110,128,  5, 95,243,233,\r\n    231,238,228,229,246, 97,128,  9,112,229,238,231,225,236,105,128,\r\n      9,133,239,240,239,237,239,230,111,128, 49, 26,242,229,246,101,\r\n    134,  1,  3, 41,159, 41,167, 41,178, 41,189, 41,197, 41,209,225,\r\n    227,245,244,101,128, 30,175,227,249,242,233,236,236,233, 99,128,\r\n      4,209,228,239,244,226,229,236,239,119,128, 30,183,231,242,225,\r\n    246,101,128, 30,177,232,239,239,235,225,226,239,246,101,128, 30,\r\n    179,244,233,236,228,101,128, 30,181, 99,  4, 41,227, 41,234, 42,\r\n     57, 42,127,225,242,239,110,128,  1,206,233,242, 99,  2, 41,242,\r\n     41,247,236,101,128, 36,208,245,237,230,236,229,120,133,  0,226,\r\n     42, 10, 42, 18, 42, 29, 42, 37, 42, 49,225,227,245,244,101,128,\r\n     30,165,228,239,244,226,229,236,239,119,128, 30,173,231,242,225,\r\n    246,101,128, 30,167,232,239,239,235,225,226,239,246,101,128, 30,\r\n    169,244,233,236,228,101,128, 30,171,245,244,101,133,  0,180, 42,\r\n     73, 42, 84, 42,101, 42,108, 42,117,226,229,236,239,247,227,237,\r\n     98,128,  3, 23, 99,  2, 42, 90, 42, 95,237, 98,128,  3,  1,239,\r\n    237, 98,128,  3,  1,228,229,246, 97,128,  9, 84,236,239,247,237,\r\n    239,100,128,  2,207,244,239,238,229,227,237, 98,128,  3, 65,249,\r\n    242,233,236,236,233, 99,128,  4, 48,100,  5, 42,149, 42,159, 42,\r\n    173, 42,179, 42,213,226,236,231,242,225,246,101,128,  2,  1,228,\r\n    225,235,231,245,242,237,245,235,232,105,128, 10,113,229,246, 97,\r\n    128,  9,  5,233,229,242,229,243,233,115,130,  0,228, 42,193, 42,\r\n    204,227,249,242,233,236,236,233, 99,128,  4,211,237,225,227,242,\r\n    239,110,128,  1,223,239,116,  2, 42,220, 42,228,226,229,236,239,\r\n    119,128, 30,161,237,225,227,242,239,110,128,  1,225,101,131,  0,\r\n    230, 42,247, 42,255, 43,  8,225,227,245,244,101,128,  1,253,235,\r\n    239,242,229,225,110,128, 49, 80,237,225,227,242,239,110,128,  1,\r\n    227,230,233,105,  6, 43, 33, 43, 53, 45,246, 45,252, 46, 11, 49,\r\n    111, 48,  2, 43, 39, 43, 46,176,178,176, 56,128, 32, 21,184,185,\r\n    180, 49,128, 32,164,177, 48,  3, 43, 62, 45, 86, 45,221, 48,  9,\r\n     43, 82, 43,102, 43,164, 43,226, 44, 32, 44, 94, 44,156, 44,218,\r\n     45, 24, 49,  3, 43, 90, 43, 94, 43, 98, 55,128,  4, 16, 56,128,\r\n      4, 17, 57,128,  4, 18, 50, 10, 43,124, 43,128, 43,132, 43,136,\r\n     43,140, 43,144, 43,148, 43,152, 43,156, 43,160, 48,128,  4, 19,\r\n     49,128,  4, 20, 50,128,  4, 21, 51,128,  4,  1, 52,128,  4, 22,\r\n     53,128,  4, 23, 54,128,  4, 24, 55,128,  4, 25, 56,128,  4, 26,\r\n     57,128,  4, 27, 51, 10, 43,186, 43,190, 43,194, 43,198, 43,202,\r\n     43,206, 43,210, 43,214, 43,218, 43,222, 48,128,  4, 28, 49,128,\r\n      4, 29, 50,128,  4, 30, 51,128,  4, 31, 52,128,  4, 32, 53,128,\r\n      4, 33, 54,128,  4, 34, 55,128,  4, 35, 56,128,  4, 36, 57,128,\r\n      4, 37, 52, 10, 43,248, 43,252, 44,  0, 44,  4, 44,  8, 44, 12,\r\n     44, 16, 44, 20, 44, 24, 44, 28, 48,128,  4, 38, 49,128,  4, 39,\r\n     50,128,  4, 40, 51,128,  4, 41, 52,128,  4, 42, 53,128,  4, 43,\r\n     54,128,  4, 44, 55,128,  4, 45, 56,128,  4, 46, 57,128,  4, 47,\r\n     53, 10, 44, 54, 44, 58, 44, 62, 44, 66, 44, 70, 44, 74, 44, 78,\r\n     44, 82, 44, 86, 44, 90, 48,128,  4,144, 49,128,  4,  2, 50,128,\r\n      4,  3, 51,128,  4,  4, 52,128,  4,  5, 53,128,  4,  6, 54,128,\r\n      4,  7, 55,128,  4,  8, 56,128,  4,  9, 57,128,  4, 10, 54, 10,\r\n     44,116, 44,120, 44,124, 44,128, 44,132, 44,136, 44,140, 44,144,\r\n     44,148, 44,152, 48,128,  4, 11, 49,128,  4, 12, 50,128,  4, 14,\r\n     51,128,246,196, 52,128,246,197, 53,128,  4, 48, 54,128,  4, 49,\r\n     55,128,  4, 50, 56,128,  4, 51, 57,128,  4, 52, 55, 10, 44,178,\r\n     44,182, 44,186, 44,190, 44,194, 44,198, 44,202, 44,206, 44,210,\r\n     44,214, 48,128,  4, 53, 49,128,  4, 81, 50,128,  4, 54, 51,128,\r\n      4, 55, 52,128,  4, 56, 53,128,  4, 57, 54,128,  4, 58, 55,128,\r\n      4, 59, 56,128,  4, 60, 57,128,  4, 61, 56, 10, 44,240, 44,244,\r\n     44,248, 44,252, 45,  0, 45,  4, 45,  8, 45, 12, 45, 16, 45, 20,\r\n     48,128,  4, 62, 49,128,  4, 63, 50,128,  4, 64, 51,128,  4, 65,\r\n     52,128,  4, 66, 53,128,  4, 67, 54,128,  4, 68, 55,128,  4, 69,\r\n     56,128,  4, 70, 57,128,  4, 71, 57, 10, 45, 46, 45, 50, 45, 54,\r\n     45, 58, 45, 62, 45, 66, 45, 70, 45, 74, 45, 78, 45, 82, 48,128,\r\n      4, 72, 49,128,  4, 73, 50,128,  4, 74, 51,128,  4, 75, 52,128,\r\n      4, 76, 53,128,  4, 77, 54,128,  4, 78, 55,128,  4, 79, 56,128,\r\n      4,145, 57,128,  4, 82, 49,  4, 45, 96, 45,158, 45,163, 45,189,\r\n     48, 10, 45,118, 45,122, 45,126, 45,130, 45,134, 45,138, 45,142,\r\n     45,146, 45,150, 45,154, 48,128,  4, 83, 49,128,  4, 84, 50,128,\r\n      4, 85, 51,128,  4, 86, 52,128,  4, 87, 53,128,  4, 88, 54,128,\r\n      4, 89, 55,128,  4, 90, 56,128,  4, 91, 57,128,  4, 92,177, 48,\r\n    128,  4, 94, 52,  4, 45,173, 45,177, 45,181, 45,185, 53,128,  4,\r\n     15, 54,128,  4, 98, 55,128,  4,114, 56,128,  4,116, 57,  5, 45,\r\n    201, 45,205, 45,209, 45,213, 45,217, 50,128,246,198, 51,128,  4,\r\n     95, 52,128,  4, 99, 53,128,  4,115, 54,128,  4,117, 56,  2, 45,\r\n    227, 45,241, 51,  2, 45,233, 45,237, 49,128,246,199, 50,128,246,\r\n    200,180, 54,128,  4,217,178,185, 57,128, 32, 14,179, 48,  2, 46,\r\n      3, 46,  7, 48,128, 32, 15, 49,128, 32, 13,181, 55,  7, 46, 28,\r\n     46, 98, 47,163, 47,240, 48,197, 49, 34, 49,105, 51,  2, 46, 34,\r\n     46, 48, 56,  2, 46, 40, 46, 44, 49,128,  6,106, 56,128,  6, 12,\r\n     57,  8, 46, 66, 46, 70, 46, 74, 46, 78, 46, 82, 46, 86, 46, 90,\r\n     46, 94, 50,128,  6, 96, 51,128,  6, 97, 52,128,  6, 98, 53,128,\r\n      6, 99, 54,128,  6,100, 55,128,  6,101, 56,128,  6,102, 57,128,\r\n      6,103, 52,  7, 46,114, 46,146, 46,208, 47, 14, 47, 46, 47,102,\r\n     47,158, 48,  5, 46,126, 46,130, 46,134, 46,138, 46,142, 48,128,\r\n      6,104, 49,128,  6,105, 51,128,  6, 27, 55,128,  6, 31, 57,128,\r\n      6, 33, 49, 10, 46,168, 46,172, 46,176, 46,180, 46,184, 46,188,\r\n     46,192, 46,196, 46,200, 46,204, 48,128,  6, 34, 49,128,  6, 35,\r\n     50,128,  6, 36, 51,128,  6, 37, 52,128,  6, 38, 53,128,  6, 39,\r\n     54,128,  6, 40, 55,128,  6, 41, 56,128,  6, 42, 57,128,  6, 43,\r\n     50, 10, 46,230, 46,234, 46,238, 46,242, 46,246, 46,250, 46,254,\r\n     47,  2, 47,  6, 47, 10, 48,128,  6, 44, 49,128,  6, 45, 50,128,\r\n      6, 46, 51,128,  6, 47, 52,128,  6, 48, 53,128,  6, 49, 54,128,\r\n      6, 50, 55,128,  6, 51, 56,128,  6, 52, 57,128,  6, 53, 51,  5,\r\n     47, 26, 47, 30, 47, 34, 47, 38, 47, 42, 48,128,  6, 54, 49,128,\r\n      6, 55, 50,128,  6, 56, 51,128,  6, 57, 52,128,  6, 58, 52,  9,\r\n     47, 66, 47, 70, 47, 74, 47, 78, 47, 82, 47, 86, 47, 90, 47, 94,\r\n     47, 98, 48,128,  6, 64, 49,128,  6, 65, 50,128,  6, 66, 51,128,\r\n      6, 67, 52,128,  6, 68, 53,128,  6, 69, 54,128,  6, 70, 56,128,\r\n      6, 72, 57,128,  6, 73, 53,  9, 47,122, 47,126, 47,130, 47,134,\r\n     47,138, 47,142, 47,146, 47,150, 47,154, 48,128,  6, 74, 49,128,\r\n      6, 75, 50,128,  6, 76, 51,128,  6, 77, 52,128,  6, 78, 53,128,\r\n      6, 79, 54,128,  6, 80, 55,128,  6, 81, 56,128,  6, 82,183, 48,\r\n    128,  6, 71, 53,  3, 47,171, 47,203, 47,235, 48,  5, 47,183, 47,\r\n    187, 47,191, 47,195, 47,199, 53,128,  6,164, 54,128,  6,126, 55,\r\n    128,  6,134, 56,128,  6,152, 57,128,  6,175, 49,  5, 47,215, 47,\r\n    219, 47,223, 47,227, 47,231, 49,128,  6,121, 50,128,  6,136, 51,\r\n    128,  6,145, 52,128,  6,186, 57,128,  6,210,179, 52,128,  6,213,\r\n     54,  7, 48,  0, 48,  5, 48, 10, 48, 15, 48, 53, 48,115, 48,177,\r\n    179, 54,128, 32,170,180, 53,128,  5,190,181, 56,128,  5,195, 54,\r\n      6, 48, 29, 48, 33, 48, 37, 48, 41, 48, 45, 48, 49, 52,128,  5,\r\n    208, 53,128,  5,209, 54,128,  5,210, 55,128,  5,211, 56,128,  5,\r\n    212, 57,128,  5,213, 55, 10, 48, 75, 48, 79, 48, 83, 48, 87, 48,\r\n     91, 48, 95, 48, 99, 48,103, 48,107, 48,111, 48,128,  5,214, 49,\r\n    128,  5,215, 50,128,  5,216, 51,128,  5,217, 52,128,  5,218, 53,\r\n    128,  5,219, 54,128,  5,220, 55,128,  5,221, 56,128,  5,222, 57,\r\n    128,  5,223, 56, 10, 48,137, 48,141, 48,145, 48,149, 48,153, 48,\r\n    157, 48,161, 48,165, 48,169, 48,173, 48,128,  5,224, 49,128,  5,\r\n    225, 50,128,  5,226, 51,128,  5,227, 52,128,  5,228, 53,128,  5,\r\n    229, 54,128,  5,230, 55,128,  5,231, 56,128,  5,232, 57,128,  5,\r\n    233, 57,  3, 48,185, 48,189, 48,193, 48,128,  5,234, 52,128,251,\r\n     42, 53,128,251, 43, 55,  4, 48,207, 48,221, 48,241, 48,246, 48,\r\n      2, 48,213, 48,217, 48,128,251, 75, 53,128,251, 31, 49,  3, 48,\r\n    229, 48,233, 48,237, 54,128,  5,240, 55,128,  5,241, 56,128,  5,\r\n    242,178, 51,128,251, 53, 57,  7, 49,  6, 49, 10, 49, 14, 49, 18,\r\n     49, 22, 49, 26, 49, 30, 51,128,  5,180, 52,128,  5,181, 53,128,\r\n      5,182, 54,128,  5,187, 55,128,  5,184, 56,128,  5,183, 57,128,\r\n      5,176, 56,  3, 49, 42, 49, 86, 49, 91, 48,  7, 49, 58, 49, 62,\r\n     49, 66, 49, 70, 49, 74, 49, 78, 49, 82, 48,128,  5,178, 49,128,\r\n      5,177, 50,128,  5,179, 51,128,  5,194, 52,128,  5,193, 54,128,\r\n      5,185, 55,128,  5,188,179, 57,128,  5,189, 52,  2, 49, 97, 49,\r\n    101, 49,128,  5,191, 50,128,  5,192,185,178, 57,128,  2,188, 54,\r\n      3, 49,119, 49,178, 49,185, 49,  4, 49,129, 49,145, 49,151, 49,\r\n    172, 50,  2, 49,135, 49,140,180, 56,128, 33,  5,184, 57,128, 33,\r\n     19,179,181, 50,128, 33, 22,181, 55,  3, 49,160, 49,164, 49,168,\r\n     51,128, 32, 44, 52,128, 32, 45, 53,128, 32, 46,182,182, 52,128,\r\n     32, 12,179,177,182, 55,128,  6,109,180,185,179, 55,128,  2,189,\r\n    103,  2, 49,198, 49,205,242,225,246,101,128,  0,224,117,  2, 49,\r\n    211, 49,220,234,225,242,225,244,105,128, 10,133,242,237,245,235,\r\n    232,105,128, 10,  5,104,  2, 49,235, 49,245,233,242,225,231,225,\r\n    238, 97,128, 48, 66,239,239,235,225,226,239,246,101,128, 30,163,\r\n    105,  7, 50, 16, 50, 41, 50, 48, 50, 60, 50, 85, 50,101, 50,181,\r\n     98,  2, 50, 22, 50, 31,229,238,231,225,236,105,128,  9,144,239,\r\n    240,239,237,239,230,111,128, 49, 30,228,229,246, 97,128,  9, 16,\r\n    229,227,249,242,233,236,236,233, 99,128,  4,213,231,117,  2, 50,\r\n     67, 50, 76,234,225,242,225,244,105,128, 10,144,242,237,245,235,\r\n    232,105,128, 10, 16,237,225,244,242,225,231,245,242,237,245,235,\r\n    232,105,128, 10, 72,110,  5, 50,113, 50,122, 50,136, 50,152, 50,\r\n    167,225,242,225,226,233, 99,128,  6, 57,230,233,238,225,236,225,\r\n    242,225,226,233, 99,128,254,202,233,238,233,244,233,225,236,225,\r\n    242,225,226,233, 99,128,254,203,237,229,228,233,225,236,225,242,\r\n    225,226,233, 99,128,254,204,246,229,242,244,229,228,226,242,229,\r\n    246,101,128,  2,  3,246,239,247,229,236,243,233,231,110,  3, 50,\r\n    197, 50,207, 50,214,226,229,238,231,225,236,105,128,  9,200,228,\r\n    229,246, 97,128,  9, 72,231,245,234,225,242,225,244,105,128, 10,\r\n    200,107,  2, 50,231, 50,255,225,244,225,235,225,238, 97,129, 48,\r\n    162, 50,243,232,225,236,230,247,233,228,244,104,128,255,113,239,\r\n    242,229,225,110,128, 49, 79,108,  3, 51, 15, 52, 71, 52, 80,101,\r\n      2, 51, 21, 52, 66,102,136,  5,208, 51, 41, 51, 50, 51, 65, 51,\r\n     79, 51,168, 51,182, 52, 37, 52, 51,225,242,225,226,233, 99,128,\r\n      6, 39,228,225,231,229,243,232,232,229,226,242,229,119,128,251,\r\n     48,230,233,238,225,236,225,242,225,226,233, 99,128,254,142,104,\r\n      2, 51, 85, 51,160,225,237,250, 97,  2, 51, 94, 51,127,225,226,\r\n    239,246,101,  2, 51,104, 51,113,225,242,225,226,233, 99,128,  6,\r\n     35,230,233,238,225,236,225,242,225,226,233, 99,128,254,132,226,\r\n    229,236,239,119,  2, 51,137, 51,146,225,242,225,226,233, 99,128,\r\n      6, 37,230,233,238,225,236,225,242,225,226,233, 99,128,254,136,\r\n    229,226,242,229,119,128,  5,208,236,225,237,229,228,232,229,226,\r\n    242,229,119,128,251, 79,237, 97,  2, 51,189, 51,225,228,228,225,\r\n    225,226,239,246,101,  2, 51,202, 51,211,225,242,225,226,233, 99,\r\n    128,  6, 34,230,233,238,225,236,225,242,225,226,233, 99,128,254,\r\n    130,235,243,245,242, 97,  4, 51,239, 51,248, 52,  6, 52, 22,225,\r\n    242,225,226,233, 99,128,  6, 73,230,233,238,225,236,225,242,225,\r\n    226,233, 99,128,254,240,233,238,233,244,233,225,236,225,242,225,\r\n    226,233, 99,128,254,243,237,229,228,233,225,236,225,242,225,226,\r\n    233, 99,128,254,244,240,225,244,225,232,232,229,226,242,229,119,\r\n    128,251, 46,241,225,237,225,244,243,232,229,226,242,229,119,128,\r\n    251, 47,240,104,128, 33, 53,236,229,241,245,225,108,128, 34, 76,\r\n    240,232, 97,129,  3,177, 52, 88,244,239,238,239,115,128,  3,172,\r\n    109,  4, 52,106, 52,114, 52,125, 52,159,225,227,242,239,110,128,\r\n      1,  1,239,238,239,243,240,225,227,101,128,255, 65,240,229,242,\r\n    243,225,238,100,130,  0, 38, 52,139, 52,151,237,239,238,239,243,\r\n    240,225,227,101,128,255,  6,243,237,225,236,108,128,247, 38,243,\r\n    241,245,225,242,101,128, 51,194,110,  4, 52,178, 52,189, 53, 55,\r\n     53, 65,226,239,240,239,237,239,230,111,128, 49, 34,103,  4, 52,\r\n    199, 52,210, 52,224, 53, 47,226,239,240,239,237,239,230,111,128,\r\n     49, 36,235,232,225,238,235,232,245,244,232,225,105,128, 14, 90,\r\n    236,101,131, 34, 32, 52,235, 53, 32, 53, 39,226,242,225,227,235,\r\n    229,116,  2, 52,247, 53, 11,236,229,230,116,129, 48,  8, 53,  0,\r\n    246,229,242,244,233,227,225,108,128,254, 63,242,233,231,232,116,\r\n    129, 48,  9, 53, 21,246,229,242,244,233,227,225,108,128,254, 64,\r\n    236,229,230,116,128, 35, 41,242,233,231,232,116,128, 35, 42,243,\r\n    244,242,239,109,128, 33, 43,239,244,229,236,229,233, 97,128,  3,\r\n    135,117,  2, 53, 71, 53, 83,228,225,244,244,225,228,229,246, 97,\r\n    128,  9, 82,243,246,225,242, 97,  3, 53, 95, 53,105, 53,112,226,\r\n    229,238,231,225,236,105,128,  9,130,228,229,246, 97,128,  9,  2,\r\n    231,245,234,225,242,225,244,105,128, 10,130,239,231,239,238,229,\r\n    107,128,  1,  5,112,  3, 53,140, 53,164, 53,194, 97,  2, 53,146,\r\n     53,158,225,244,239,243,241,245,225,242,101,128, 51,  0,242,229,\r\n    110,128, 36,156,239,243,244,242,239,240,232,101,  2, 53,177, 53,\r\n    188,225,242,237,229,238,233,225,110,128,  5, 90,237,239,100,128,\r\n      2,188,112,  2, 53,200, 53,205,236,101,128,248,255,242,111,  2,\r\n     53,212, 53,220,225,227,232,229,115,128, 34, 80,120,  2, 53,226,\r\n     53,246,229,241,245,225,108,129, 34, 72, 53,236,239,242,233,237,\r\n    225,231,101,128, 34, 82,233,237,225,244,229,236,249,229,241,245,\r\n    225,108,128, 34, 69,114,  4, 54, 15, 54, 42, 54, 46, 54, 91,225,\r\n    229, 97,  2, 54, 23, 54, 33,229,235,239,242,229,225,110,128, 49,\r\n    142,235,239,242,229,225,110,128, 49,141, 99,128, 35, 18,105,  2,\r\n     54, 52, 54, 66,231,232,244,232,225,236,230,242,233,238,103,128,\r\n     30,154,238,103,130,  0,229, 54, 75, 54, 83,225,227,245,244,101,\r\n    128,  1,251,226,229,236,239,119,128, 30,  1,242,239,119,  8, 54,\r\n    111, 54,118, 54,247, 55, 57, 55,107, 55,162, 55,185, 56,  4,226,\r\n    239,244,104,128, 33,148,100,  3, 54,126, 54,165, 54,212,225,243,\r\n    104,  4, 54,138, 54,145, 54,152, 54,160,228,239,247,110,128, 33,\r\n    227,236,229,230,116,128, 33,224,242,233,231,232,116,128, 33,226,\r\n    245,112,128, 33,225,226,108,  5, 54,178, 54,185, 54,192, 54,199,\r\n     54,207,226,239,244,104,128, 33,212,228,239,247,110,128, 33,211,\r\n    236,229,230,116,128, 33,208,242,233,231,232,116,128, 33,210,245,\r\n    112,128, 33,209,239,247,110,131, 33,147, 54,224, 54,231, 54,239,\r\n    236,229,230,116,128, 33,153,242,233,231,232,116,128, 33,152,247,\r\n    232,233,244,101,128, 33,233,104,  2, 54,253, 55, 48,229,225,100,\r\n      4, 55,  9, 55, 19, 55, 29, 55, 40,228,239,247,238,237,239,100,\r\n    128,  2,197,236,229,230,244,237,239,100,128,  2,194,242,233,231,\r\n    232,244,237,239,100,128,  2,195,245,240,237,239,100,128,  2,196,\r\n    239,242,233,250,229,120,128,248,231,236,229,230,116,131, 33,144,\r\n     55, 70, 55, 87, 55, 99,228,226,108,129, 33,208, 55, 78,243,244,\r\n    242,239,235,101,128, 33,205,239,246,229,242,242,233,231,232,116,\r\n    128, 33,198,247,232,233,244,101,128, 33,230,242,233,231,232,116,\r\n    132, 33,146, 55,123, 55,135, 55,143, 55,154,228,226,236,243,244,\r\n    242,239,235,101,128, 33,207,232,229,225,246,121,128, 39,158,239,\r\n    246,229,242,236,229,230,116,128, 33,196,247,232,233,244,101,128,\r\n     33,232,244,225, 98,  2, 55,170, 55,177,236,229,230,116,128, 33,\r\n    228,242,233,231,232,116,128, 33,229,245,112,132, 33,145, 55,198,\r\n     55,226, 55,244, 55,252,100,  2, 55,204, 55,216,110,129, 33,149,\r\n     55,210,226,243,101,128, 33,168,239,247,238,226,225,243,101,128,\r\n     33,168,236,229,230,116,129, 33,150, 55,235,239,230,228,239,247,\r\n    110,128, 33,197,242,233,231,232,116,128, 33,151,247,232,233,244,\r\n    101,128, 33,231,246,229,242,244,229,120,128,248,230,115,  5, 56,\r\n     25, 56,101, 56,146, 56,229, 56,239, 99,  2, 56, 31, 56, 83,233,\r\n    105,  2, 56, 38, 56, 61,227,233,242,227,245,109,129,  0, 94, 56,\r\n     49,237,239,238,239,243,240,225,227,101,128,255, 62,244,233,236,\r\n    228,101,129,  0,126, 56, 71,237,239,238,239,243,240,225,227,101,\r\n    128,255, 94,242,233,240,116,129,  2, 81, 56, 92,244,245,242,238,\r\n    229,100,128,  2, 82,237,225,236,108,  2, 56,110, 56,121,232,233,\r\n    242,225,231,225,238, 97,128, 48, 65,235,225,244,225,235,225,238,\r\n     97,129, 48,161, 56,134,232,225,236,230,247,233,228,244,104,128,\r\n    255,103,244,229,242,233,115,  2, 56,156, 56,225,107,131,  0, 42,\r\n     56,166, 56,194, 56,217, 97,  2, 56,172, 56,186,236,244,239,238,\r\n    229,225,242,225,226,233, 99,128,  6,109,242,225,226,233, 99,128,\r\n      6,109,109,  2, 56,200, 56,206,225,244,104,128, 34, 23,239,238,\r\n    239,243,240,225,227,101,128,255, 10,243,237,225,236,108,128,254,\r\n     97,109,128, 32, 66,245,240,229,242,233,239,114,128,246,233,249,\r\n    237,240,244,239,244,233,227,225,236,236,249,229,241,245,225,108,\r\n    128, 34, 67,116,132,  0, 64, 57, 15, 57, 22, 57, 34, 57, 42,233,\r\n    236,228,101,128,  0,227,237,239,238,239,243,240,225,227,101,128,\r\n    255, 32,243,237,225,236,108,128,254,107,245,242,238,229,100,128,\r\n      2, 80,117,  6, 57, 64, 57, 89, 57, 96, 57,121, 57,141, 57,157,\r\n     98,  2, 57, 70, 57, 79,229,238,231,225,236,105,128,  9,148,239,\r\n    240,239,237,239,230,111,128, 49, 32,228,229,246, 97,128,  9, 20,\r\n    231,117,  2, 57,103, 57,112,234,225,242,225,244,105,128, 10,148,\r\n    242,237,245,235,232,105,128, 10, 20,236,229,238,231,244,232,237,\r\n    225,242,235,226,229,238,231,225,236,105,128,  9,215,237,225,244,\r\n    242,225,231,245,242,237,245,235,232,105,128, 10, 76,246,239,247,\r\n    229,236,243,233,231,110,  3, 57,173, 57,183, 57,190,226,229,238,\r\n    231,225,236,105,128,  9,204,228,229,246, 97,128,  9, 76,231,245,\r\n    234,225,242,225,244,105,128, 10,204,246,225,231,242,225,232,225,\r\n    228,229,246, 97,128,  9, 61,121,  2, 57,221, 57,233,226,225,242,\r\n    237,229,238,233,225,110,128,  5, 97,233,110,130,  5,226, 57,242,\r\n     58,  1,225,236,244,239,238,229,232,229,226,242,229,119,128,251,\r\n     32,232,229,226,242,229,119,128,  5,226, 98,144,  0, 98, 58, 46,\r\n     58,181, 58,192, 58,201, 58,226, 60, 11, 60, 73, 60,146, 62, 72,\r\n     62, 84, 62,127, 62,135, 62,145, 64, 15, 64, 39, 64, 48, 97,  7,\r\n     58, 62, 58, 72, 58, 96, 58,103, 58,128, 58,152, 58,163,226,229,\r\n    238,231,225,236,105,128,  9,172,227,235,243,236,225,243,104,129,\r\n      0, 92, 58, 84,237,239,238,239,243,240,225,227,101,128,255, 60,\r\n    228,229,246, 97,128,  9, 44,231,117,  2, 58,110, 58,119,234,225,\r\n    242,225,244,105,128, 10,172,242,237,245,235,232,105,128, 10, 44,\r\n    104,  2, 58,134, 58,144,233,242,225,231,225,238, 97,128, 48,112,\r\n    244,244,232,225,105,128, 14, 63,235,225,244,225,235,225,238, 97,\r\n    128, 48,208,114,129,  0,124, 58,169,237,239,238,239,243,240,225,\r\n    227,101,128,255, 92,226,239,240,239,237,239,230,111,128, 49,  5,\r\n    227,233,242,227,236,101,128, 36,209,228,239,116,  2, 58,209, 58,\r\n    218,225,227,227,229,238,116,128, 30,  3,226,229,236,239,119,128,\r\n     30,  5,101,  6, 58,240, 59,  5, 59, 28, 59,170, 59,181, 59,193,\r\n    225,237,229,228,243,233,248,244,229,229,238,244,232,238,239,244,\r\n    229,115,128, 38,108, 99,  2, 59, 11, 59, 18,225,245,243,101,128,\r\n     34, 53,249,242,233,236,236,233, 99,128,  4, 49,104,  5, 59, 40,\r\n     59, 49, 59, 63, 59, 93, 59,152,225,242,225,226,233, 99,128,  6,\r\n     40,230,233,238,225,236,225,242,225,226,233, 99,128,254,144,105,\r\n      2, 59, 69, 59, 84,238,233,244,233,225,236,225,242,225,226,233,\r\n     99,128,254,145,242,225,231,225,238, 97,128, 48,121,237,101,  2,\r\n     59,100, 59,113,228,233,225,236,225,242,225,226,233, 99,128,254,\r\n    146,229,237,105,  2, 59,121, 59,136,238,233,244,233,225,236,225,\r\n    242,225,226,233, 99,128,252,159,243,239,236,225,244,229,228,225,\r\n    242,225,226,233, 99,128,252,  8,238,239,239,238,230,233,238,225,\r\n    236,225,242,225,226,233, 99,128,252,109,235,225,244,225,235,225,\r\n    238, 97,128, 48,217,238,225,242,237,229,238,233,225,110,128,  5,\r\n     98,116,132,  5,209, 59,205, 59,225, 59,245, 59,254, 97,129,  3,\r\n    178, 59,211,243,249,237,226,239,236,231,242,229,229,107,128,  3,\r\n    208,228,225,231,229,243,104,129,251, 49, 59,236,232,229,226,242,\r\n    229,119,128,251, 49,232,229,226,242,229,119,128,  5,209,242,225,\r\n    230,229,232,229,226,242,229,119,128,251, 76,104,  2, 60, 17, 60,\r\n     67, 97,  3, 60, 25, 60, 35, 60, 42,226,229,238,231,225,236,105,\r\n    128,  9,173,228,229,246, 97,128,  9, 45,231,117,  2, 60, 49, 60,\r\n     58,234,225,242,225,244,105,128, 10,173,242,237,245,235,232,105,\r\n    128, 10, 45,239,239,107,128,  2, 83,105,  5, 60, 85, 60, 96, 60,\r\n    107, 60,121, 60,135,232,233,242,225,231,225,238, 97,128, 48,115,\r\n    235,225,244,225,235,225,238, 97,128, 48,211,236,225,226,233,225,\r\n    236,227,236,233,227,107,128,  2,152,238,228,233,231,245,242,237,\r\n    245,235,232,105,128, 10,  2,242,245,243,241,245,225,242,101,128,\r\n     51, 49,108,  3, 60,154, 62, 55, 62, 66, 97,  2, 60,160, 62, 50,\r\n    227,107,  6, 60,175, 60,184, 60,221, 61,114, 61,169, 61,221,227,\r\n    233,242,227,236,101,128, 37,207,100,  2, 60,190, 60,199,233,225,\r\n    237,239,238,100,128, 37,198,239,247,238,240,239,233,238,244,233,\r\n    238,231,244,242,233,225,238,231,236,101,128, 37,188,108,  2, 60,\r\n    227, 61, 74,101,  2, 60,233, 61, 13,230,244,240,239,233,238,244,\r\n    233,238,103,  2, 60,248, 61,  2,240,239,233,238,244,229,114,128,\r\n     37,196,244,242,233,225,238,231,236,101,128, 37,192,238,244,233,\r\n    227,245,236,225,242,226,242,225,227,235,229,116,  2, 61, 33, 61,\r\n     53,236,229,230,116,129, 48, 16, 61, 42,246,229,242,244,233,227,\r\n    225,108,128,254, 59,242,233,231,232,116,129, 48, 17, 61, 63,246,\r\n    229,242,244,233,227,225,108,128,254, 60,239,247,229,114,  2, 61,\r\n     83, 61, 98,236,229,230,244,244,242,233,225,238,231,236,101,128,\r\n     37,227,242,233,231,232,244,244,242,233,225,238,231,236,101,128,\r\n     37,226,114,  2, 61,120, 61,131,229,227,244,225,238,231,236,101,\r\n    128, 37,172,233,231,232,244,240,239,233,238,244,233,238,103,  2,\r\n     61,148, 61,158,240,239,233,238,244,229,114,128, 37,186,244,242,\r\n    233,225,238,231,236,101,128, 37,182,115,  3, 61,177, 61,207, 61,\r\n    215,109,  2, 61,183, 61,195,225,236,236,243,241,245,225,242,101,\r\n    128, 37,170,233,236,233,238,231,230,225,227,101,128, 38, 59,241,\r\n    245,225,242,101,128, 37,160,244,225,114,128, 38,  5,245,240,112,\r\n      2, 61,229, 62, 11,229,114,  2, 61,236, 61,251,236,229,230,244,\r\n    244,242,233,225,238,231,236,101,128, 37,228,242,233,231,232,244,\r\n    244,242,233,225,238,231,236,101,128, 37,229,239,233,238,244,233,\r\n    238,103,  2, 62, 23, 62, 39,243,237,225,236,236,244,242,233,225,\r\n    238,231,236,101,128, 37,180,244,242,233,225,238,231,236,101,128,\r\n     37,178,238,107,128, 36, 35,233,238,229,226,229,236,239,119,128,\r\n     30,  7,239,227,107,128, 37,136,237,239,238,239,243,240,225,227,\r\n    101,128,255, 66,111,  3, 62, 92, 62,105, 62,116,226,225,233,237,\r\n    225,233,244,232,225,105,128, 14, 26,232,233,242,225,231,225,238,\r\n     97,128, 48,124,235,225,244,225,235,225,238, 97,128, 48,220,240,\r\n    225,242,229,110,128, 36,157,241,243,241,245,225,242,101,128, 51,\r\n    195,114,  4, 62,155, 63,149, 63,222, 64,  5,225, 99,  2, 62,162,\r\n     63, 56,101,  3, 62,170, 62,175, 62,243,229,120,128,248,244,236,\r\n    229,230,116,133,  0,123, 62,192, 62,197, 62,219, 62,227, 62,232,\r\n    226,116,128,248,243,109,  2, 62,203, 62,208,233,100,128,248,242,\r\n    239,238,239,243,240,225,227,101,128,255, 91,243,237,225,236,108,\r\n    128,254, 91,244,112,128,248,241,246,229,242,244,233,227,225,108,\r\n    128,254, 55,242,233,231,232,116,133,  0,125, 63,  5, 63, 10, 63,\r\n     32, 63, 40, 63, 45,226,116,128,248,254,109,  2, 63, 16, 63, 21,\r\n    233,100,128,248,253,239,238,239,243,240,225,227,101,128,255, 93,\r\n    243,237,225,236,108,128,254, 92,244,112,128,248,252,246,229,242,\r\n    244,233,227,225,108,128,254, 56,235,229,116,  2, 63, 64, 63,106,\r\n    236,229,230,116,132,  0, 91, 63, 79, 63, 84, 63, 89, 63,101,226,\r\n    116,128,248,240,229,120,128,248,239,237,239,238,239,243,240,225,\r\n    227,101,128,255, 59,244,112,128,248,238,242,233,231,232,116,132,\r\n      0, 93, 63,122, 63,127, 63,132, 63,144,226,116,128,248,251,229,\r\n    120,128,248,250,237,239,238,239,243,240,225,227,101,128,255, 61,\r\n    244,112,128,248,249,229,246,101,131,  2,216, 63,161, 63,172, 63,\r\n    178,226,229,236,239,247,227,237, 98,128,  3, 46,227,237, 98,128,\r\n      3,  6,233,238,246,229,242,244,229,100,  3, 63,193, 63,204, 63,\r\n    210,226,229,236,239,247,227,237, 98,128,  3, 47,227,237, 98,128,\r\n      3, 17,228,239,245,226,236,229,227,237, 98,128,  3, 97,233,228,\r\n    231,101,  2, 63,231, 63,242,226,229,236,239,247,227,237, 98,128,\r\n      3, 42,233,238,246,229,242,244,229,228,226,229,236,239,247,227,\r\n    237, 98,128,  3, 58,239,235,229,238,226,225,114,128,  0,166,115,\r\n      2, 64, 21, 64, 29,244,242,239,235,101,128,  1,128,245,240,229,\r\n    242,233,239,114,128,246,234,244,239,240,226,225,114,128,  1,131,\r\n    117,  3, 64, 56, 64, 67, 64, 78,232,233,242,225,231,225,238, 97,\r\n    128, 48,118,235,225,244,225,235,225,238, 97,128, 48,214,236,108,\r\n      2, 64, 85, 64,115,229,116,130, 32, 34, 64, 94, 64,104,233,238,\r\n    246,229,242,243,101,128, 37,216,239,240,229,242,225,244,239,114,\r\n    128, 34, 25,243,229,249,101,128, 37,206, 99,143,  0, 99, 64,156,\r\n     65,105, 65,116, 65,180, 65,211, 66, 48, 67,215, 68,199, 69, 43,\r\n     69, 92, 72, 84, 72, 92, 72,102, 72,114, 72,147, 97,  9, 64,176,\r\n     64,187, 64,197, 64,204, 64,211, 64,236, 64,246, 65, 42, 65, 51,\r\n    225,242,237,229,238,233,225,110,128,  5,110,226,229,238,231,225,\r\n    236,105,128,  9,154,227,245,244,101,128,  1,  7,228,229,246, 97,\r\n    128,  9, 26,231,117,  2, 64,218, 64,227,234,225,242,225,244,105,\r\n    128, 10,154,242,237,245,235,232,105,128, 10, 26,236,243,241,245,\r\n    225,242,101,128, 51,136,238,228,242,225,226,233,238,228,117,  4,\r\n     65,  8, 65, 18, 65, 24, 65, 31,226,229,238,231,225,236,105,128,\r\n      9,129,227,237, 98,128,  3, 16,228,229,246, 97,128,  9,  1,231,\r\n    245,234,225,242,225,244,105,128, 10,129,240,243,236,239,227,107,\r\n    128, 33,234,114,  3, 65, 59, 65, 65, 65, 91,229,239,102,128, 33,\r\n      5,239,110,130,  2,199, 65, 74, 65, 85,226,229,236,239,247,227,\r\n    237, 98,128,  3, 44,227,237, 98,128,  3, 12,242,233,225,231,229,\r\n    242,229,244,245,242,110,128, 33,181,226,239,240,239,237,239,230,\r\n    111,128, 49, 24, 99,  4, 65,126, 65,133, 65,152, 65,174,225,242,\r\n    239,110,128,  1, 13,229,228,233,236,236, 97,129,  0,231, 65,144,\r\n    225,227,245,244,101,128, 30,  9,233,242, 99,  2, 65,160, 65,165,\r\n    236,101,128, 36,210,245,237,230,236,229,120,128,  1,  9,245,242,\r\n    108,128,  2, 85,100,  2, 65,186, 65,202,239,116,129,  1, 11, 65,\r\n    193,225,227,227,229,238,116,128,  1, 11,243,241,245,225,242,101,\r\n    128, 51,197,101,  2, 65,217, 65,233,228,233,236,236, 97,129,  0,\r\n    184, 65,227,227,237, 98,128,  3, 39,238,116,132,  0,162, 65,246,\r\n     66, 14, 66, 26, 66, 37,105,  2, 65,252, 66,  4,231,242,225,228,\r\n    101,128, 33,  3,238,230,229,242,233,239,114,128,246,223,237,239,\r\n    238,239,243,240,225,227,101,128,255,224,239,236,228,243,244,249,\r\n    236,101,128,247,162,243,245,240,229,242,233,239,114,128,246,224,\r\n    104,  5, 66, 60, 66,123, 66,134, 67, 62, 67,154, 97,  4, 66, 70,\r\n     66, 81, 66, 91, 66, 98,225,242,237,229,238,233,225,110,128,  5,\r\n    121,226,229,238,231,225,236,105,128,  9,155,228,229,246, 97,128,\r\n      9, 27,231,117,  2, 66,105, 66,114,234,225,242,225,244,105,128,\r\n     10,155,242,237,245,235,232,105,128, 10, 27,226,239,240,239,237,\r\n    239,230,111,128, 49, 20,101,  6, 66,148, 66,168, 66,192, 67,  4,\r\n     67, 16, 67, 37,225,226,235,232,225,243,233,225,238,227,249,242,\r\n    233,236,236,233, 99,128,  4,189, 99,  2, 66,174, 66,182,235,237,\r\n    225,242,107,128, 39, 19,249,242,233,236,236,233, 99,128,  4, 71,\r\n    100,  2, 66,198, 66,242,229,243,227,229,238,228,229,114,  2, 66,\r\n    211, 66,231,225,226,235,232,225,243,233,225,238,227,249,242,233,\r\n    236,236,233, 99,128,  4,191,227,249,242,233,236,236,233, 99,128,\r\n      4,183,233,229,242,229,243,233,243,227,249,242,233,236,236,233,\r\n     99,128,  4,245,232,225,242,237,229,238,233,225,110,128,  5,115,\r\n    235,232,225,235,225,243,243,233,225,238,227,249,242,233,236,236,\r\n    233, 99,128,  4,204,246,229,242,244,233,227,225,236,243,244,242,\r\n    239,235,229,227,249,242,233,236,236,233, 99,128,  4,185,105,129,\r\n      3,199, 67, 68,229,245,227,104,  4, 67, 81, 67,116, 67,131, 67,\r\n    140, 97,  2, 67, 87, 67,102,227,233,242,227,236,229,235,239,242,\r\n    229,225,110,128, 50,119,240,225,242,229,238,235,239,242,229,225,\r\n    110,128, 50, 23,227,233,242,227,236,229,235,239,242,229,225,110,\r\n    128, 50,105,235,239,242,229,225,110,128, 49, 74,240,225,242,229,\r\n    238,235,239,242,229,225,110,128, 50,  9,111,  2, 67,160, 67,210,\r\n    227,104,  3, 67,169, 67,191, 67,201,225,110,  2, 67,176, 67,184,\r\n    231,244,232,225,105,128, 14, 10,244,232,225,105,128, 14,  8,233,\r\n    238,231,244,232,225,105,128, 14,  9,239,229,244,232,225,105,128,\r\n     14, 12,239,107,128,  1,136,105,  2, 67,221, 68, 67,229,245, 99,\r\n      5, 67,235, 68, 14, 68, 29, 68, 38, 68, 52, 97,  2, 67,241, 68,\r\n      0,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,118,\r\n    240,225,242,229,238,235,239,242,229,225,110,128, 50, 22,227,233,\r\n    242,227,236,229,235,239,242,229,225,110,128, 50,104,235,239,242,\r\n    229,225,110,128, 49, 72,240,225,242,229,238,235,239,242,229,225,\r\n    110,128, 50,  8,245,240,225,242,229,238,235,239,242,229,225,110,\r\n    128, 50, 28,242, 99,  2, 68, 74, 68,169,236,101,132, 37,203, 68,\r\n     87, 68, 98, 68,103, 68,127,237,245,236,244,233,240,236,121,128,\r\n     34,151,239,116,128, 34,153,112,  2, 68,109, 68,115,236,245,115,\r\n    128, 34,149,239,243,244,225,236,237,225,242,107,128, 48, 54,247,\r\n    233,244,104,  2, 68,136, 68,152,236,229,230,244,232,225,236,230,\r\n    226,236,225,227,107,128, 37,208,242,233,231,232,244,232,225,236,\r\n    230,226,236,225,227,107,128, 37,209,245,237,230,236,229,120,130,\r\n      2,198, 68,182, 68,193,226,229,236,239,247,227,237, 98,128,  3,\r\n     45,227,237, 98,128,  3,  2,108,  3, 68,207, 68,213, 69, 11,229,\r\n    225,114,128, 35, 39,233,227,107,  4, 68,225, 68,236, 68,245, 68,\r\n    255,225,236,246,229,239,236,225,114,128,  1,194,228,229,238,244,\r\n    225,108,128,  1,192,236,225,244,229,242,225,108,128,  1,193,242,\r\n    229,244,242,239,230,236,229,120,128,  1,195,245, 98,129, 38, 99,\r\n     69, 18,243,245,233,116,  2, 69, 27, 69, 35,226,236,225,227,107,\r\n    128, 38, 99,247,232,233,244,101,128, 38,103,109,  3, 69, 51, 69,\r\n     65, 69, 76,227,245,226,229,228,243,241,245,225,242,101,128, 51,\r\n    164,239,238,239,243,240,225,227,101,128,255, 67,243,241,245,225,\r\n    242,229,228,243,241,245,225,242,101,128, 51,160,111,  8, 69,110,\r\n     69,121, 69,208, 70,150, 71,179, 71,210, 72, 61, 72, 70,225,242,\r\n    237,229,238,233,225,110,128,  5,129,236,239,110,131,  0, 58, 69,\r\n    133, 69,158, 69,177,237,239,110,  2, 69,141, 69,149,229,244,225,\r\n    242,121,128, 32,161,239,243,240,225,227,101,128,255, 26,115,  2,\r\n     69,164, 69,170,233,231,110,128, 32,161,237,225,236,108,128,254,\r\n     85,244,242,233,225,238,231,245,236,225,114,  2, 69,192, 69,202,\r\n    232,225,236,230,237,239,100,128,  2,209,237,239,100,128,  2,208,\r\n    109,  2, 69,214, 70,143,237, 97,134,  0, 44, 69,231, 70, 39, 70,\r\n     50, 70, 62, 70, 92, 70,115, 97,  3, 69,239, 70,  9, 70, 17,226,\r\n    239,246,101,  2, 69,248, 69,254,227,237, 98,128,  3, 19,242,233,\r\n    231,232,244,227,237, 98,128,  3, 21,227,227,229,238,116,128,246,\r\n    195,114,  2, 70, 23, 70, 30,225,226,233, 99,128,  6, 12,237,229,\r\n    238,233,225,110,128,  5, 93,233,238,230,229,242,233,239,114,128,\r\n    246,225,237,239,238,239,243,240,225,227,101,128,255, 12,242,229,\r\n    246,229,242,243,229,100,  2, 70, 75, 70, 86,225,226,239,246,229,\r\n    227,237, 98,128,  3, 20,237,239,100,128,  2,189,115,  2, 70, 98,\r\n     70,105,237,225,236,108,128,254, 80,245,240,229,242,233,239,114,\r\n    128,246,226,244,245,242,238,229,100,  2, 70,126, 70,137,225,226,\r\n    239,246,229,227,237, 98,128,  3, 18,237,239,100,128,  2,187,240,\r\n    225,243,115,128, 38, 60,110,  2, 70,156, 70,165,231,242,245,229,\r\n    238,116,128, 34, 69,116,  2, 70,171, 70,185,239,245,242,233,238,\r\n    244,229,231,242,225,108,128, 34, 46,242,239,108,142, 35,  3, 70,\r\n    219, 70,225, 70,240, 70,255, 71, 43, 71, 88, 71,102, 71,107, 71,\r\n    112, 71,117, 71,123, 71,128, 71,169, 71,174,193,195, 75,128,  0,\r\n      6, 66,  2, 70,231, 70,236,197, 76,128,  0,  7, 83,128,  0,  8,\r\n     67,  2, 70,246, 70,251,193, 78,128,  0, 24, 82,128,  0, 13, 68,\r\n      3, 71,  7, 71, 33, 71, 38, 67,  4, 71, 17, 71, 21, 71, 25, 71,\r\n     29, 49,128,  0, 17, 50,128,  0, 18, 51,128,  0, 19, 52,128,  0,\r\n     20,197, 76,128,  0,127,204, 69,128,  0, 16, 69,  5, 71, 55, 71,\r\n     59, 71, 64, 71, 69, 71, 74, 77,128,  0, 25,206, 81,128,  0,  5,\r\n    207, 84,128,  0,  4,211, 67,128,  0, 27, 84,  2, 71, 80, 71, 84,\r\n     66,128,  0, 23, 88,128,  0,  3, 70,  2, 71, 94, 71, 98, 70,128,\r\n      0, 12, 83,128,  0, 28,199, 83,128,  0, 29,200, 84,128,  0,  9,\r\n    204, 70,128,  0, 10,206,193, 75,128,  0, 21,210, 83,128,  0, 30,\r\n     83,  5, 71,140, 71,144, 71,154, 71,159, 71,164, 73,128,  0, 15,\r\n     79,129,  0, 14, 71,150, 84,128,  0,  2,212, 88,128,  0,  1,213,\r\n     66,128,  0, 26,217, 78,128,  0, 22,213, 83,128,  0, 31,214, 84,\r\n    128,  0, 11,240,249,242,233,231,232,116,129,  0,169, 71,191,115,\r\n      2, 71,197, 71,203,225,238,115,128,248,233,229,242,233,102,128,\r\n    246,217,114,  2, 71,216, 72, 44,238,229,242,226,242,225,227,235,\r\n    229,116,  2, 71,231, 72,  9,236,229,230,116,130, 48, 12, 71,242,\r\n     71,254,232,225,236,230,247,233,228,244,104,128,255, 98,246,229,\r\n    242,244,233,227,225,108,128,254, 65,242,233,231,232,116,130, 48,\r\n     13, 72, 21, 72, 33,232,225,236,230,247,233,228,244,104,128,255,\r\n     99,246,229,242,244,233,227,225,108,128,254, 66,240,239,242,225,\r\n    244,233,239,238,243,241,245,225,242,101,128, 51,127,243,241,245,\r\n    225,242,101,128, 51,199,246,229,242,235,231,243,241,245,225,242,\r\n    101,128, 51,198,240,225,242,229,110,128, 36,158,242,245,250,229,\r\n    233,242,111,128, 32,162,243,244,242,229,244,227,232,229,100,128,\r\n      2,151,245,114,  2, 72,121, 72,139,236,121,  2, 72,128, 72,134,\r\n    225,238,100,128, 34,207,239,114,128, 34,206,242,229,238,227,121,\r\n    128,  0,164,249,114,  4, 72,158, 72,166, 72,173, 72,181,194,242,\r\n    229,246,101,128,246,209,198,236,229,120,128,246,210,226,242,229,\r\n    246,101,128,246,212,230,236,229,120,128,246,213,100,146,  0,100,\r\n     72,228, 74,110, 75,134, 75,194, 76,114, 77, 68, 77,130, 78, 59,\r\n     78, 72, 78, 81, 78,107, 78,132, 78,141, 79,208, 79,216, 79,227,\r\n     79,247, 80, 19, 97, 11, 72,252, 73,  7, 73, 17, 73, 89, 73,152,\r\n     73,163, 73,174, 73,243, 74, 49, 74, 55, 74, 85,225,242,237,229,\r\n    238,233,225,110,128,  5,100,226,229,238,231,225,236,105,128,  9,\r\n    166,100,  5, 73, 29, 73, 38, 73, 44, 73, 58, 73, 74,225,242,225,\r\n    226,233, 99,128,  6, 54,229,246, 97,128,  9, 38,230,233,238,225,\r\n    236,225,242,225,226,233, 99,128,254,190,233,238,233,244,233,225,\r\n    236,225,242,225,226,233, 99,128,254,191,237,229,228,233,225,236,\r\n    225,242,225,226,233, 99,128,254,192,103,  3, 73, 97, 73,114, 73,\r\n    128,229,243,104,129,  5,188, 73,105,232,229,226,242,229,119,128,\r\n      5,188,231,229,114,129, 32, 32, 73,122,228,226,108,128, 32, 33,\r\n    117,  2, 73,134, 73,143,234,225,242,225,244,105,128, 10,166,242,\r\n    237,245,235,232,105,128, 10, 38,232,233,242,225,231,225,238, 97,\r\n    128, 48, 96,235,225,244,225,235,225,238, 97,128, 48,192,108,  3,\r\n     73,182, 73,191, 73,229,225,242,225,226,233, 99,128,  6, 47,229,\r\n    116,130,  5,211, 73,200, 73,220,228,225,231,229,243,104,129,251,\r\n     51, 73,211,232,229,226,242,229,119,128,251, 51,232,229,226,242,\r\n    229,119,128,  5,211,230,233,238,225,236,225,242,225,226,233, 99,\r\n    128,254,170,237,237, 97,  3, 73,253, 74,  6, 74, 18,225,242,225,\r\n    226,233, 99,128,  6, 79,236,239,247,225,242,225,226,233, 99,128,\r\n      6, 79,244,225,238, 97,  2, 74, 27, 74, 41,236,244,239,238,229,\r\n    225,242,225,226,233, 99,128,  6, 76,242,225,226,233, 99,128,  6,\r\n     76,238,228, 97,128,  9,100,242,231, 97,  2, 74, 63, 74, 72,232,\r\n    229,226,242,229,119,128,  5,167,236,229,230,244,232,229,226,242,\r\n    229,119,128,  5,167,243,233,225,240,238,229,245,237,225,244,225,\r\n    227,249,242,233,236,236,233,227,227,237, 98,128,  4,133, 98,  3,\r\n     74,118, 75,115, 75,125,108,  9, 74,138, 74,146, 75,  3, 75, 11,\r\n     75, 27, 75, 38, 75, 56, 75, 70, 75, 81,199,242,225,246,101,128,\r\n    246,211, 97,  2, 74,152, 74,209,238,231,236,229,226,242,225,227,\r\n    235,229,116,  2, 74,168, 74,188,236,229,230,116,129, 48, 10, 74,\r\n    177,246,229,242,244,233,227,225,108,128,254, 61,242,233,231,232,\r\n    116,129, 48, 11, 74,198,246,229,242,244,233,227,225,108,128,254,\r\n     62,114,  2, 74,215, 74,236,227,232,233,238,246,229,242,244,229,\r\n    228,226,229,236,239,247,227,237, 98,128,  3, 43,242,239,119,  2,\r\n     74,244, 74,251,236,229,230,116,128, 33,212,242,233,231,232,116,\r\n    128, 33,210,228,225,238,228, 97,128,  9,101,231,242,225,246,101,\r\n    129,246,214, 75, 21,227,237, 98,128,  3, 15,233,238,244,229,231,\r\n    242,225,108,128, 34, 44,236,239,247,236,233,238,101,129, 32, 23,\r\n     75, 50,227,237, 98,128,  3, 51,239,246,229,242,236,233,238,229,\r\n    227,237, 98,128,  3, 63,240,242,233,237,229,237,239,100,128,  2,\r\n    186,246,229,242,244,233,227,225,108,  2, 75, 94, 75,100,226,225,\r\n    114,128, 32, 22,236,233,238,229,225,226,239,246,229,227,237, 98,\r\n    128,  3, 14,239,240,239,237,239,230,111,128, 49,  9,243,241,245,\r\n    225,242,101,128, 51,200, 99,  4, 75,144, 75,151, 75,160, 75,187,\r\n    225,242,239,110,128,  1, 15,229,228,233,236,236, 97,128, 30, 17,\r\n    233,242, 99,  2, 75,168, 75,173,236,101,128, 36,211,245,237,230,\r\n    236,229,248,226,229,236,239,119,128, 30, 19,242,239,225,116,128,\r\n      1, 17,100,  4, 75,204, 76, 29, 76, 39, 76, 90, 97,  4, 75,214,\r\n     75,224, 75,231, 76,  0,226,229,238,231,225,236,105,128,  9,161,\r\n    228,229,246, 97,128,  9, 33,231,117,  2, 75,238, 75,247,234,225,\r\n    242,225,244,105,128, 10,161,242,237,245,235,232,105,128, 10, 33,\r\n    108,  2, 76,  6, 76, 15,225,242,225,226,233, 99,128,  6,136,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,251,137,228,232,225,\r\n    228,229,246, 97,128,  9, 92,232, 97,  3, 76, 48, 76, 58, 76, 65,\r\n    226,229,238,231,225,236,105,128,  9,162,228,229,246, 97,128,  9,\r\n     34,231,117,  2, 76, 72, 76, 81,234,225,242,225,244,105,128, 10,\r\n    162,242,237,245,235,232,105,128, 10, 34,239,116,  2, 76, 97, 76,\r\n    106,225,227,227,229,238,116,128, 30, 11,226,229,236,239,119,128,\r\n     30, 13,101,  8, 76,132, 76,185, 76,192, 76,217, 76,227, 76,238,\r\n     77, 27, 77, 63, 99,  2, 76,138, 76,175,233,237,225,236,243,229,\r\n    240,225,242,225,244,239,114,  2, 76,156, 76,165,225,242,225,226,\r\n    233, 99,128,  6,107,240,229,242,243,233,225,110,128,  6,107,249,\r\n    242,233,236,236,233, 99,128,  4, 52,231,242,229,101,128,  0,176,\r\n    232,105,  2, 76,199, 76,208,232,229,226,242,229,119,128,  5,173,\r\n    242,225,231,225,238, 97,128, 48,103,233,227,239,240,244,233, 99,\r\n    128,  3,239,235,225,244,225,235,225,238, 97,128, 48,199,108,  2,\r\n     76,244, 77, 11,229,244,101,  2, 76,252, 77,  3,236,229,230,116,\r\n    128, 35, 43,242,233,231,232,116,128, 35, 38,244, 97,129,  3,180,\r\n     77, 18,244,245,242,238,229,100,128,  1,141,238,239,237,233,238,\r\n    225,244,239,242,237,233,238,245,243,239,238,229,238,245,237,229,\r\n    242,225,244,239,242,226,229,238,231,225,236,105,128,  9,248,250,\r\n    104,128,  2,164,104,  2, 77, 74, 77,124, 97,  3, 77, 82, 77, 92,\r\n     77, 99,226,229,238,231,225,236,105,128,  9,167,228,229,246, 97,\r\n    128,  9, 39,231,117,  2, 77,106, 77,115,234,225,242,225,244,105,\r\n    128, 10,167,242,237,245,235,232,105,128, 10, 39,239,239,107,128,\r\n      2, 87,105,  6, 77,144, 77,193, 77,253, 78,  8, 78, 19, 78, 29,\r\n     97,  2, 77,150, 77,172,236,249,244,233,235,225,244,239,238,239,\r\n    115,129,  3,133, 77,166,227,237, 98,128,  3, 68,237,239,238,100,\r\n    129, 38,102, 77,181,243,245,233,244,247,232,233,244,101,128, 38,\r\n     98,229,242,229,243,233,115,133,  0,168, 77,212, 77,220, 77,231,\r\n     77,237, 77,245,225,227,245,244,101,128,246,215,226,229,236,239,\r\n    247,227,237, 98,128,  3, 36,227,237, 98,128,  3,  8,231,242,225,\r\n    246,101,128,246,216,244,239,238,239,115,128,  3,133,232,233,242,\r\n    225,231,225,238, 97,128, 48, 98,235,225,244,225,235,225,238, 97,\r\n    128, 48,194,244,244,239,237,225,242,107,128, 48,  3,246,105,  2,\r\n     78, 36, 78, 47,228,101,129,  0,247, 78, 43,115,128, 34, 35,243,\r\n    233,239,238,243,236,225,243,104,128, 34, 21,234,229,227,249,242,\r\n    233,236,236,233, 99,128,  4, 82,235,243,232,225,228,101,128, 37,\r\n    147,108,  2, 78, 87, 78, 98,233,238,229,226,229,236,239,119,128,\r\n     30, 15,243,241,245,225,242,101,128, 51,151,109,  2, 78,113, 78,\r\n    121,225,227,242,239,110,128,  1, 17,239,238,239,243,240,225,227,\r\n    101,128,255, 68,238,226,236,239,227,107,128, 37,132,111, 10, 78,\r\n    163, 78,175, 78,185, 78,196, 78,207, 79, 23, 79, 28, 79, 39, 79,\r\n    154, 79,180,227,232,225,228,225,244,232,225,105,128, 14, 14,228,\r\n    229,235,244,232,225,105,128, 14, 20,232,233,242,225,231,225,238,\r\n     97,128, 48,105,235,225,244,225,235,225,238, 97,128, 48,201,236,\r\n    236,225,114,132,  0, 36, 78,222, 78,233, 78,245, 79,  0,233,238,\r\n    230,229,242,233,239,114,128,246,227,237,239,238,239,243,240,225,\r\n    227,101,128,255,  4,239,236,228,243,244,249,236,101,128,247, 36,\r\n    115,  2, 79,  6, 79, 13,237,225,236,108,128,254,105,245,240,229,\r\n    242,233,239,114,128,246,228,238,103,128, 32,171,242,245,243,241,\r\n    245,225,242,101,128, 51, 38,116,  6, 79, 53, 79, 70, 79, 92, 79,\r\n    103, 79,135, 79,142,225,227,227,229,238,116,129,  2,217, 79, 64,\r\n    227,237, 98,128,  3,  7,226,229,236,239,247, 99,  2, 79, 81, 79,\r\n     86,237, 98,128,  3, 35,239,237, 98,128,  3, 35,235,225,244,225,\r\n    235,225,238, 97,128, 48,251,236,229,243,115,  2, 79,112, 79,116,\r\n    105,128,  1, 49,106,129,246,190, 79,122,243,244,242,239,235,229,\r\n    232,239,239,107,128,  2,132,237,225,244,104,128, 34,197,244,229,\r\n    228,227,233,242,227,236,101,128, 37,204,245,226,236,229,249,239,\r\n    228,240,225,244,225,104,129,251, 31, 79,171,232,229,226,242,229,\r\n    119,128,251, 31,247,238,244,225,227,107,  2, 79,191, 79,202,226,\r\n    229,236,239,247,227,237, 98,128,  3, 30,237,239,100,128,  2,213,\r\n    240,225,242,229,110,128, 36,159,243,245,240,229,242,233,239,114,\r\n    128,246,235,116,  2, 79,233, 79,239,225,233,108,128,  2, 86,239,\r\n    240,226,225,114,128,  1,140,117,  2, 79,253, 80,  8,232,233,242,\r\n    225,231,225,238, 97,128, 48,101,235,225,244,225,235,225,238, 97,\r\n    128, 48,197,122,132,  1,243, 80, 31, 80, 40, 80, 59, 80, 96,225,\r\n    236,244,239,238,101,128,  2,163, 99,  2, 80, 46, 80, 53,225,242,\r\n    239,110,128,  1,198,245,242,108,128,  2,165,101,  2, 80, 65, 80,\r\n     85,225,226,235,232,225,243,233,225,238,227,249,242,233,236,236,\r\n    233, 99,128,  4,225,227,249,242,233,236,236,233, 99,128,  4, 85,\r\n    232,229,227,249,242,233,236,236,233, 99,128,  4, 95,101,151,  0,\r\n    101, 80,159, 80,178, 80,212, 81,186, 81,248, 82, 25, 82, 37, 82,\r\n     60, 82,113, 83,225, 84, 27, 84,129, 84,245, 85,124, 85,199, 85,\r\n    230, 86, 36, 86, 89, 87, 24, 87,157, 87,177, 87,221, 88, 56, 97,\r\n      2, 80,165, 80,172,227,245,244,101,128,  0,233,242,244,104,128,\r\n     38, 65, 98,  3, 80,186, 80,195, 80,205,229,238,231,225,236,105,\r\n    128,  9,143,239,240,239,237,239,230,111,128, 49, 28,242,229,246,\r\n    101,128,  1, 21, 99,  5, 80,224, 81, 41, 81, 55, 81, 87, 81,176,\r\n     97,  2, 80,230, 81, 35,238,228,242, 97,  3, 80,241, 80,248, 81,\r\n      3,228,229,246, 97,128,  9, 13,231,245,234,225,242,225,244,105,\r\n    128, 10,141,246,239,247,229,236,243,233,231,110,  2, 81, 17, 81,\r\n     24,228,229,246, 97,128,  9, 69,231,245,234,225,242,225,244,105,\r\n    128, 10,197,242,239,110,128,  1, 27,229,228,233,236,236,225,226,\r\n    242,229,246,101,128, 30, 29,104,  2, 81, 61, 81, 72,225,242,237,\r\n    229,238,233,225,110,128,  5,101,249,233,247,238,225,242,237,229,\r\n    238,233,225,110,128,  5,135,233,242, 99,  2, 81, 95, 81,100,236,\r\n    101,128, 36,212,245,237,230,236,229,120,134,  0,234, 81,121, 81,\r\n    129, 81,137, 81,148, 81,156, 81,168,225,227,245,244,101,128, 30,\r\n    191,226,229,236,239,119,128, 30, 25,228,239,244,226,229,236,239,\r\n    119,128, 30,199,231,242,225,246,101,128, 30,193,232,239,239,235,\r\n    225,226,239,246,101,128, 30,195,244,233,236,228,101,128, 30,197,\r\n    249,242,233,236,236,233, 99,128,  4, 84,100,  4, 81,196, 81,206,\r\n     81,212, 81,222,226,236,231,242,225,246,101,128,  2,  5,229,246,\r\n     97,128,  9, 15,233,229,242,229,243,233,115,128,  0,235,239,116,\r\n    130,  1, 23, 81,231, 81,240,225,227,227,229,238,116,128,  1, 23,\r\n    226,229,236,239,119,128, 30,185,101,  2, 81,254, 82,  9,231,245,\r\n    242,237,245,235,232,105,128, 10, 15,237,225,244,242,225,231,245,\r\n    242,237,245,235,232,105,128, 10, 71,230,227,249,242,233,236,236,\r\n    233, 99,128,  4, 68,103,  2, 82, 43, 82, 50,242,225,246,101,128,\r\n      0,232,245,234,225,242,225,244,105,128, 10,143,104,  4, 82, 70,\r\n     82, 81, 82, 92, 82,102,225,242,237,229,238,233,225,110,128,  5,\r\n    103,226,239,240,239,237,239,230,111,128, 49, 29,233,242,225,231,\r\n    225,238, 97,128, 48, 72,239,239,235,225,226,239,246,101,128, 30,\r\n    187,105,  4, 82,123, 82,134, 83,192, 83,207,226,239,240,239,237,\r\n    239,230,111,128, 49, 31,231,232,116,142,  0, 56, 82,168, 82,177,\r\n     82,187, 82,217, 82,224, 83,  6, 83, 31, 83, 76, 83,110, 83,122,\r\n     83,133, 83,166, 83,174, 83,185,225,242,225,226,233, 99,128,  6,\r\n    104,226,229,238,231,225,236,105,128,  9,238,227,233,242,227,236,\r\n    101,129, 36,103, 82,198,233,238,246,229,242,243,229,243,225,238,\r\n    243,243,229,242,233,102,128, 39,145,228,229,246, 97,128,  9,110,\r\n    229,229,110,  2, 82,232, 82,241,227,233,242,227,236,101,128, 36,\r\n    113,112,  2, 82,247, 82,254,225,242,229,110,128, 36,133,229,242,\r\n    233,239,100,128, 36,153,231,117,  2, 83, 13, 83, 22,234,225,242,\r\n    225,244,105,128, 10,238,242,237,245,235,232,105,128, 10,110,104,\r\n      2, 83, 37, 83, 63, 97,  2, 83, 43, 83, 54,227,235,225,242,225,\r\n    226,233, 99,128,  6,104,238,231,250,232,239,117,128, 48, 40,238,\r\n    239,244,229,226,229,225,237,229,100,128, 38,107,105,  2, 83, 82,\r\n     83,100,228,229,239,231,242,225,240,232,233,227,240,225,242,229,\r\n    110,128, 50, 39,238,230,229,242,233,239,114,128, 32,136,237,239,\r\n    238,239,243,240,225,227,101,128,255, 24,239,236,228,243,244,249,\r\n    236,101,128,247, 56,112,  2, 83,139, 83,146,225,242,229,110,128,\r\n     36,123,229,114,  2, 83,153, 83,159,233,239,100,128, 36,143,243,\r\n    233,225,110,128,  6,248,242,239,237,225,110,128, 33,119,243,245,\r\n    240,229,242,233,239,114,128, 32,120,244,232,225,105,128, 14, 88,\r\n    238,246,229,242,244,229,228,226,242,229,246,101,128,  2,  7,239,\r\n    244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128,  4,\r\n    101,107,  2, 83,231, 83,255,225,244,225,235,225,238, 97,129, 48,\r\n    168, 83,243,232,225,236,230,247,233,228,244,104,128,255,116,111,\r\n      2, 84,  5, 84, 20,238,235,225,242,231,245,242,237,245,235,232,\r\n    105,128, 10,116,242,229,225,110,128, 49, 84,108,  3, 84, 35, 84,\r\n     46, 84,107,227,249,242,233,236,236,233, 99,128,  4, 59,101,  2,\r\n     84, 52, 84, 59,237,229,238,116,128, 34,  8,246,229,110,  3, 84,\r\n     69, 84, 78, 84, 99,227,233,242,227,236,101,128, 36,106,112,  2,\r\n     84, 84, 84, 91,225,242,229,110,128, 36,126,229,242,233,239,100,\r\n    128, 36,146,242,239,237,225,110,128, 33,122,236,233,240,243,233,\r\n    115,129, 32, 38, 84,118,246,229,242,244,233,227,225,108,128, 34,\r\n    238,109,  5, 84,141, 84,169, 84,180, 84,200, 84,211,225,227,242,\r\n    239,110,130,  1, 19, 84,153, 84,161,225,227,245,244,101,128, 30,\r\n     23,231,242,225,246,101,128, 30, 21,227,249,242,233,236,236,233,\r\n     99,128,  4, 60,228,225,243,104,129, 32, 20, 84,189,246,229,242,\r\n    244,233,227,225,108,128,254, 49,239,238,239,243,240,225,227,101,\r\n    128,255, 69,112,  2, 84,217, 84,237,232,225,243,233,243,237,225,\r\n    242,235,225,242,237,229,238,233,225,110,128,  5, 91,244,249,243,\r\n    229,116,128, 34,  5,110,  6, 85,  3, 85, 14, 85, 25, 85, 69, 85,\r\n    101, 85,116,226,239,240,239,237,239,230,111,128, 49, 35,227,249,\r\n    242,233,236,236,233, 99,128,  4, 61,100,  2, 85, 31, 85, 50,225,\r\n    243,104,129, 32, 19, 85, 39,246,229,242,244,233,227,225,108,128,\r\n    254, 50,229,243,227,229,238,228,229,242,227,249,242,233,236,236,\r\n    233, 99,128,  4,163,103,130,  1, 75, 85, 77, 85, 88,226,239,240,\r\n    239,237,239,230,111,128, 49, 37,232,229,227,249,242,233,236,236,\r\n    233, 99,128,  4,165,232,239,239,235,227,249,242,233,236,236,233,\r\n     99,128,  4,200,243,240,225,227,101,128, 32,  2,111,  3, 85,132,\r\n     85,140, 85,149,231,239,238,229,107,128,  1, 25,235,239,242,229,\r\n    225,110,128, 49, 83,240,229,110,130,  2, 91, 85,159, 85,168,227,\r\n    236,239,243,229,100,128,  2,154,242,229,246,229,242,243,229,100,\r\n    130,  2, 92, 85,183, 85,192,227,236,239,243,229,100,128,  2, 94,\r\n    232,239,239,107,128,  2, 93,112,  2, 85,205, 85,212,225,242,229,\r\n    110,128, 36,160,243,233,236,239,110,129,  3,181, 85,222,244,239,\r\n    238,239,115,128,  3,173,241,117,  2, 85,237, 86, 25,225,108,130,\r\n      0, 61, 85,246, 86,  2,237,239,238,239,243,240,225,227,101,128,\r\n    255, 29,115,  2, 86,  8, 86, 15,237,225,236,108,128,254,102,245,\r\n    240,229,242,233,239,114,128, 32,124,233,246,225,236,229,238,227,\r\n    101,128, 34, 97,114,  3, 86, 44, 86, 55, 86, 66,226,239,240,239,\r\n    237,239,230,111,128, 49, 38,227,249,242,233,236,236,233, 99,128,\r\n      4, 64,229,246,229,242,243,229,100,129,  2, 88, 86, 78,227,249,\r\n    242,233,236,236,233, 99,128,  4, 77,115,  6, 86,103, 86,114, 86,\r\n    134, 86,215, 87,  4, 87, 14,227,249,242,233,236,236,233, 99,128,\r\n      4, 65,228,229,243,227,229,238,228,229,242,227,249,242,233,236,\r\n    236,233, 99,128,  4,171,104,132,  2,131, 86,146, 86,153, 86,184,\r\n     86,199,227,245,242,108,128,  2,134,239,242,116,  2, 86,161, 86,\r\n    168,228,229,246, 97,128,  9, 14,246,239,247,229,236,243,233,231,\r\n    238,228,229,246, 97,128,  9, 70,242,229,246,229,242,243,229,228,\r\n    236,239,239,112,128,  1,170,243,241,245,225,244,242,229,246,229,\r\n    242,243,229,100,128,  2,133,237,225,236,108,  2, 86,224, 86,235,\r\n    232,233,242,225,231,225,238, 97,128, 48, 71,235,225,244,225,235,\r\n    225,238, 97,129, 48,167, 86,248,232,225,236,230,247,233,228,244,\r\n    104,128,255,106,244,233,237,225,244,229,100,128, 33, 46,245,240,\r\n    229,242,233,239,114,128,246,236,116,  5, 87, 36, 87, 62, 87, 66,\r\n     87, 83, 87,149, 97,130,  3,183, 87, 44, 87, 54,242,237,229,238,\r\n    233,225,110,128,  5,104,244,239,238,239,115,128,  3,174,104,128,\r\n      0,240,233,236,228,101,129, 30,189, 87, 75,226,229,236,239,119,\r\n    128, 30, 27,238,225,232,244, 97,  3, 87, 95, 87,127, 87,136,230,\r\n    239,245,235,104,  2, 87,105, 87,114,232,229,226,242,229,119,128,\r\n      5,145,236,229,230,244,232,229,226,242,229,119,128,  5,145,232,\r\n    229,226,242,229,119,128,  5,145,236,229,230,244,232,229,226,242,\r\n    229,119,128,  5,145,245,242,238,229,100,128,  1,221,117,  2, 87,\r\n    163, 87,172,235,239,242,229,225,110,128, 49, 97,242,111,128, 32,\r\n    172,246,239,247,229,236,243,233,231,110,  3, 87,193, 87,203, 87,\r\n    210,226,229,238,231,225,236,105,128,  9,199,228,229,246, 97,128,\r\n      9, 71,231,245,234,225,242,225,244,105,128, 10,199,120,  2, 87,\r\n    227, 88, 44,227,236,225,109,132,  0, 33, 87,242, 87,253, 88, 24,\r\n     88, 36,225,242,237,229,238,233,225,110,128,  5, 92,100,  2, 88,\r\n      3, 88,  8,226,108,128, 32, 60,239,247,110,129,  0,161, 88, 16,\r\n    243,237,225,236,108,128,247,161,237,239,238,239,243,240,225,227,\r\n    101,128,255,  1,243,237,225,236,108,128,247, 33,233,243,244,229,\r\n    238,244,233,225,108,128, 34,  3,250,104,131,  2,146, 88, 67, 88,\r\n     86, 88, 97, 99,  2, 88, 73, 88, 80,225,242,239,110,128,  1,239,\r\n    245,242,108,128,  2,147,242,229,246,229,242,243,229,100,128,  1,\r\n    185,244,225,233,108,128,  1,186,102,140,  0,102, 88,132, 88,214,\r\n     88,225, 88,234, 88,246, 89, 93, 89,109, 91,117, 91,130, 91,156,\r\n     93, 33, 93, 41, 97,  4, 88,142, 88,149, 88,160, 88,171,228,229,\r\n    246, 97,128,  9, 94,231,245,242,237,245,235,232,105,128, 10, 94,\r\n    232,242,229,238,232,229,233,116,128, 33,  9,244,232, 97,  3, 88,\r\n    181, 88,190, 88,202,225,242,225,226,233, 99,128,  6, 78,236,239,\r\n    247,225,242,225,226,233, 99,128,  6, 78,244,225,238,225,242,225,\r\n    226,233, 99,128,  6, 75,226,239,240,239,237,239,230,111,128, 49,\r\n      8,227,233,242,227,236,101,128, 36,213,228,239,244,225,227,227,\r\n    229,238,116,128, 30, 31,101,  3, 88,254, 89, 76, 89, 86,104,  4,\r\n     89,  8, 89, 31, 89, 45, 89, 61,225,114,  2, 89, 15, 89, 22,225,\r\n    226,233, 99,128,  6, 65,237,229,238,233,225,110,128,  5,134,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,254,210,233,238,233,\r\n    244,233,225,236,225,242,225,226,233, 99,128,254,211,237,229,228,\r\n    233,225,236,225,242,225,226,233, 99,128,254,212,233,227,239,240,\r\n    244,233, 99,128,  3,229,237,225,236,101,128, 38, 64,102,130,251,\r\n      0, 89,101, 89,105,105,128,251,  3,108,128,251,  4,105,136,251,\r\n      1, 89,129, 89,169, 89,180, 89,202, 90, 68, 90, 85, 90, 93, 90,\r\n    106,230,244,229,229,110,  2, 89,139, 89,148,227,233,242,227,236,\r\n    101,128, 36,110,112,  2, 89,154, 89,161,225,242,229,110,128, 36,\r\n    130,229,242,233,239,100,128, 36,150,231,245,242,229,228,225,243,\r\n    104,128, 32, 18,236,236,229,100,  2, 89,189, 89,195,226,239,120,\r\n    128, 37,160,242,229,227,116,128, 37,172,238,225,108,  5, 89,216,\r\n     89,255, 90, 16, 90, 33, 90, 49,235,225,102,130,  5,218, 89,226,\r\n     89,246,228,225,231,229,243,104,129,251, 58, 89,237,232,229,226,\r\n    242,229,119,128,251, 58,232,229,226,242,229,119,128,  5,218,237,\r\n    229,109,129,  5,221, 90,  7,232,229,226,242,229,119,128,  5,221,\r\n    238,245,110,129,  5,223, 90, 24,232,229,226,242,229,119,128,  5,\r\n    223,240,101,129,  5,227, 90, 40,232,229,226,242,229,119,128,  5,\r\n    227,244,243,225,228,105,129,  5,229, 90, 59,232,229,226,242,229,\r\n    119,128,  5,229,242,243,244,244,239,238,229,227,232,233,238,229,\r\n    243,101,128,  2,201,243,232,229,249,101,128, 37,201,244,225,227,\r\n    249,242,233,236,236,233, 99,128,  4,115,246,101,142,  0, 53, 90,\r\n    139, 90,148, 90,158, 90,188, 90,195, 90,205, 90,230, 91,  1, 91,\r\n     35, 91, 47, 91, 58, 91, 91, 91, 99, 91,110,225,242,225,226,233,\r\n     99,128,  6,101,226,229,238,231,225,236,105,128,  9,235,227,233,\r\n    242,227,236,101,129, 36,100, 90,169,233,238,246,229,242,243,229,\r\n    243,225,238,243,243,229,242,233,102,128, 39,142,228,229,246, 97,\r\n    128,  9,107,229,233,231,232,244,232,115,128, 33, 93,231,117,  2,\r\n     90,212, 90,221,234,225,242,225,244,105,128, 10,235,242,237,245,\r\n    235,232,105,128, 10,107,232, 97,  2, 90,237, 90,248,227,235,225,\r\n    242,225,226,233, 99,128,  6,101,238,231,250,232,239,117,128, 48,\r\n     37,105,  2, 91,  7, 91, 25,228,229,239,231,242,225,240,232,233,\r\n    227,240,225,242,229,110,128, 50, 36,238,230,229,242,233,239,114,\r\n    128, 32,133,237,239,238,239,243,240,225,227,101,128,255, 21,239,\r\n    236,228,243,244,249,236,101,128,247, 53,112,  2, 91, 64, 91, 71,\r\n    225,242,229,110,128, 36,120,229,114,  2, 91, 78, 91, 84,233,239,\r\n    100,128, 36,140,243,233,225,110,128,  6,245,242,239,237,225,110,\r\n    128, 33,116,243,245,240,229,242,233,239,114,128, 32,117,244,232,\r\n    225,105,128, 14, 85,108,129,251,  2, 91,123,239,242,233,110,128,\r\n      1,146,109,  2, 91,136, 91,147,239,238,239,243,240,225,227,101,\r\n    128,255, 70,243,241,245,225,242,101,128, 51,153,111,  4, 91,166,\r\n     91,188, 91,200, 91,207,230, 97,  2, 91,173, 91,181,238,244,232,\r\n    225,105,128, 14, 31,244,232,225,105,128, 14, 29,238,231,237,225,\r\n    238,244,232,225,105,128, 14, 79,242,225,236,108,128, 34,  0,245,\r\n    114,142,  0, 52, 91,240, 91,249, 92,  3, 92, 33, 92, 40, 92, 65,\r\n     92, 92, 92,126, 92,138, 92,157, 92,168, 92,201, 92,209, 92,220,\r\n    225,242,225,226,233, 99,128,  6,100,226,229,238,231,225,236,105,\r\n    128,  9,234,227,233,242,227,236,101,129, 36, 99, 92, 14,233,238,\r\n    246,229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39,\r\n    141,228,229,246, 97,128,  9,106,231,117,  2, 92, 47, 92, 56,234,\r\n    225,242,225,244,105,128, 10,234,242,237,245,235,232,105,128, 10,\r\n    106,232, 97,  2, 92, 72, 92, 83,227,235,225,242,225,226,233, 99,\r\n    128,  6,100,238,231,250,232,239,117,128, 48, 36,105,  2, 92, 98,\r\n     92,116,228,229,239,231,242,225,240,232,233,227,240,225,242,229,\r\n    110,128, 50, 35,238,230,229,242,233,239,114,128, 32,132,237,239,\r\n    238,239,243,240,225,227,101,128,255, 20,238,245,237,229,242,225,\r\n    244,239,242,226,229,238,231,225,236,105,128,  9,247,239,236,228,\r\n    243,244,249,236,101,128,247, 52,112,  2, 92,174, 92,181,225,242,\r\n    229,110,128, 36,119,229,114,  2, 92,188, 92,194,233,239,100,128,\r\n     36,139,243,233,225,110,128,  6,244,242,239,237,225,110,128, 33,\r\n    115,243,245,240,229,242,233,239,114,128, 32,116,116,  2, 92,226,\r\n     93,  8,229,229,110,  2, 92,234, 92,243,227,233,242,227,236,101,\r\n    128, 36,109,112,  2, 92,249, 93,  0,225,242,229,110,128, 36,129,\r\n    229,242,233,239,100,128, 36,149,104,  2, 93, 14, 93, 19,225,105,\r\n    128, 14, 84,244,239,238,229,227,232,233,238,229,243,101,128,  2,\r\n    203,240,225,242,229,110,128, 36,161,242, 97,  2, 93, 48, 93, 56,\r\n    227,244,233,239,110,128, 32, 68,238, 99,128, 32,163,103,144,  0,\r\n    103, 93, 97, 94, 43, 94, 66, 94,127, 94,144, 95, 65, 96, 58, 96,\r\n    143, 96,156, 97, 14, 97, 39, 97, 67, 97, 89, 98, 34, 98, 56, 98,\r\n    158, 97,  9, 93,117, 93,127, 93,134, 93,141, 93,205, 93,230, 93,\r\n    241, 93,252, 94, 30,226,229,238,231,225,236,105,128,  9,151,227,\r\n    245,244,101,128,  1,245,228,229,246, 97,128,  9, 23,102,  4, 93,\r\n    151, 93,160, 93,174, 93,190,225,242,225,226,233, 99,128,  6,175,\r\n    230,233,238,225,236,225,242,225,226,233, 99,128,251,147,233,238,\r\n    233,244,233,225,236,225,242,225,226,233, 99,128,251,148,237,229,\r\n    228,233,225,236,225,242,225,226,233, 99,128,251,149,231,117,  2,\r\n     93,212, 93,221,234,225,242,225,244,105,128, 10,151,242,237,245,\r\n    235,232,105,128, 10, 23,232,233,242,225,231,225,238, 97,128, 48,\r\n     76,235,225,244,225,235,225,238, 97,128, 48,172,237,237, 97,130,\r\n      3,179, 94,  6, 94, 19,236,225,244,233,238,243,237,225,236,108,\r\n    128,  2, 99,243,245,240,229,242,233,239,114,128,  2,224,238,231,\r\n    233,225,227,239,240,244,233, 99,128,  3,235, 98,  2, 94, 49, 94,\r\n     59,239,240,239,237,239,230,111,128, 49, 13,242,229,246,101,128,\r\n      1, 31, 99,  4, 94, 76, 94, 83, 94, 92, 94,114,225,242,239,110,\r\n    128,  1,231,229,228,233,236,236, 97,128,  1, 35,233,242, 99,  2,\r\n     94,100, 94,105,236,101,128, 36,214,245,237,230,236,229,120,128,\r\n      1, 29,239,237,237,225,225,227,227,229,238,116,128,  1, 35,228,\r\n    239,116,129,  1, 33, 94,135,225,227,227,229,238,116,128,  1, 33,\r\n    101,  6, 94,158, 94,169, 94,180, 94,191, 94,210, 95, 56,227,249,\r\n    242,233,236,236,233, 99,128,  4, 51,232,233,242,225,231,225,238,\r\n     97,128, 48, 82,235,225,244,225,235,225,238, 97,128, 48,178,239,\r\n    237,229,244,242,233,227,225,236,236,249,229,241,245,225,108,128,\r\n     34, 81,114,  3, 94,218, 95, 11, 95, 21,229,243,104,  3, 94,228,\r\n     94,243, 94,252,225,227,227,229,238,244,232,229,226,242,229,119,\r\n    128,  5,156,232,229,226,242,229,119,128,  5,243,237,245,241,228,\r\n    225,237,232,229,226,242,229,119,128,  5,157,237,225,238,228,226,\r\n    236,115,128,  0,223,243,232,225,249,233,109,  2, 95, 32, 95, 47,\r\n    225,227,227,229,238,244,232,229,226,242,229,119,128,  5,158,232,\r\n    229,226,242,229,119,128,  5,244,244,225,237,225,242,107,128, 48,\r\n     19,104,  5, 95, 77, 95,210, 96, 17, 96, 42, 96, 48, 97,  4, 95,\r\n     87, 95, 97, 95,120, 95,145,226,229,238,231,225,236,105,128,  9,\r\n    152,100,  2, 95,103, 95,114,225,242,237,229,238,233,225,110,128,\r\n      5,114,229,246, 97,128,  9, 24,231,117,  2, 95,127, 95,136,234,\r\n    225,242,225,244,105,128, 10,152,242,237,245,235,232,105,128, 10,\r\n     24,233,110,  4, 95,156, 95,165, 95,179, 95,195,225,242,225,226,\r\n    233, 99,128,  6, 58,230,233,238,225,236,225,242,225,226,233, 99,\r\n    128,254,206,233,238,233,244,233,225,236,225,242,225,226,233, 99,\r\n    128,254,207,237,229,228,233,225,236,225,242,225,226,233, 99,128,\r\n    254,208,101,  3, 95,218, 95,239, 96,  0,237,233,228,228,236,229,\r\n    232,239,239,235,227,249,242,233,236,236,233, 99,128,  4,149,243,\r\n    244,242,239,235,229,227,249,242,233,236,236,233, 99,128,  4,147,\r\n    245,240,244,245,242,238,227,249,242,233,236,236,233, 99,128,  4,\r\n    145,232, 97,  2, 96, 24, 96, 31,228,229,246, 97,128,  9, 90,231,\r\n    245,242,237,245,235,232,105,128, 10, 90,239,239,107,128,  2, 96,\r\n    250,243,241,245,225,242,101,128, 51,147,105,  3, 96, 66, 96, 77,\r\n     96, 88,232,233,242,225,231,225,238, 97,128, 48, 78,235,225,244,\r\n    225,235,225,238, 97,128, 48,174,109,  2, 96, 94, 96,105,225,242,\r\n    237,229,238,233,225,110,128,  5, 99,229,108,130,  5,210, 96,114,\r\n     96,134,228,225,231,229,243,104,129,251, 50, 96,125,232,229,226,\r\n    242,229,119,128,251, 50,232,229,226,242,229,119,128,  5,210,234,\r\n    229,227,249,242,233,236,236,233, 99,128,  4, 83,236,239,244,244,\r\n    225,108,  2, 96,167, 96,184,233,238,246,229,242,244,229,228,243,\r\n    244,242,239,235,101,128,  1,190,243,244,239,112,132,  2,148, 96,\r\n    199, 96,210, 96,216, 96,248,233,238,246,229,242,244,229,100,128,\r\n      2,150,237,239,100,128,  2,192,242,229,246,229,242,243,229,100,\r\n    130,  2,149, 96,231, 96,237,237,239,100,128,  2,193,243,245,240,\r\n    229,242,233,239,114,128,  2,228,243,244,242,239,235,101,129,  2,\r\n    161, 97,  3,242,229,246,229,242,243,229,100,128,  2,162,109,  2,\r\n     97, 20, 97, 28,225,227,242,239,110,128, 30, 33,239,238,239,243,\r\n    240,225,227,101,128,255, 71,111,  2, 97, 45, 97, 56,232,233,242,\r\n    225,231,225,238, 97,128, 48, 84,235,225,244,225,235,225,238, 97,\r\n    128, 48,180,240, 97,  2, 97, 74, 97, 80,242,229,110,128, 36,162,\r\n    243,241,245,225,242,101,128, 51,172,114,  2, 97, 95, 97,192, 97,\r\n      2, 97,101, 97,109,228,233,229,238,116,128, 34,  7,246,101,134,\r\n      0, 96, 97,126, 97,137, 97,154, 97,161, 97,170, 97,182,226,229,\r\n    236,239,247,227,237, 98,128,  3, 22, 99,  2, 97,143, 97,148,237,\r\n     98,128,  3,  0,239,237, 98,128,  3,  0,228,229,246, 97,128,  9,\r\n     83,236,239,247,237,239,100,128,  2,206,237,239,238,239,243,240,\r\n    225,227,101,128,255, 64,244,239,238,229,227,237, 98,128,  3, 64,\r\n    229,225,244,229,114,132,  0, 62, 97,208, 97,227, 97,239, 98, 26,\r\n    229,241,245,225,108,129, 34,101, 97,218,239,242,236,229,243,115,\r\n    128, 34,219,237,239,238,239,243,240,225,227,101,128,255, 30,111,\r\n      2, 97,245, 98, 15,114,  2, 97,251, 98,  8,229,241,245,233,246,\r\n    225,236,229,238,116,128, 34,115,236,229,243,115,128, 34,119,246,\r\n    229,242,229,241,245,225,108,128, 34,103,243,237,225,236,108,128,\r\n    254,101,115,  2, 98, 40, 98, 48,227,242,233,240,116,128,  2, 97,\r\n    244,242,239,235,101,128,  1,229,117,  4, 98, 66, 98, 77, 98,134,\r\n     98,145,232,233,242,225,231,225,238, 97,128, 48, 80,233,108,  2,\r\n     98, 84, 98,109,236,229,237,239,116,  2, 98, 94, 98,101,236,229,\r\n    230,116,128,  0,171,242,233,231,232,116,128,  0,187,243,233,238,\r\n    231,108,  2, 98,119, 98,126,236,229,230,116,128, 32, 57,242,233,\r\n    231,232,116,128, 32, 58,235,225,244,225,235,225,238, 97,128, 48,\r\n    176,242,225,237,245,243,241,245,225,242,101,128, 51, 24,249,243,\r\n    241,245,225,242,101,128, 51,201,104,144,  0,104, 98,204,101, 90,\r\n    101,125,101,162,101,202,103, 90,103,110,104, 75,104, 87,104, 99,\r\n    105,167,105,175,105,186,105,195,106, 19,106, 23, 97, 13, 98,232,\r\n     99, 15, 99, 25, 99, 55, 99, 80, 99,158, 99,170, 99,195, 99,210,\r\n     99,239, 99,252,100, 54,100, 63, 97,  2, 98,238, 99,  1,226,235,\r\n    232,225,243,233,225,238,227,249,242,233,236,236,233, 99,128,  4,\r\n    169,236,244,239,238,229,225,242,225,226,233, 99,128,  6,193,226,\r\n    229,238,231,225,236,105,128,  9,185,228,101,  2, 99, 32, 99, 50,\r\n    243,227,229,238,228,229,242,227,249,242,233,236,236,233, 99,128,\r\n      4,179,246, 97,128,  9, 57,231,117,  2, 99, 62, 99, 71,234,225,\r\n    242,225,244,105,128, 10,185,242,237,245,235,232,105,128, 10, 57,\r\n    104,  4, 99, 90, 99, 99, 99,113, 99,143,225,242,225,226,233, 99,\r\n    128,  6, 45,230,233,238,225,236,225,242,225,226,233, 99,128,254,\r\n    162,105,  2, 99,119, 99,134,238,233,244,233,225,236,225,242,225,\r\n    226,233, 99,128,254,163,242,225,231,225,238, 97,128, 48,111,237,\r\n    229,228,233,225,236,225,242,225,226,233, 99,128,254,164,233,244,\r\n    245,243,241,245,225,242,101,128, 51, 42,235,225,244,225,235,225,\r\n    238, 97,129, 48,207, 99,183,232,225,236,230,247,233,228,244,104,\r\n    128,255,138,236,225,238,244,231,245,242,237,245,235,232,105,128,\r\n     10, 77,237,250, 97,  2, 99,218, 99,227,225,242,225,226,233, 99,\r\n    128,  6, 33,236,239,247,225,242,225,226,233, 99,128,  6, 33,238,\r\n    231,245,236,230,233,236,236,229,114,128, 49,100,114,  2,100,  2,\r\n    100, 18,228,243,233,231,238,227,249,242,233,236,236,233, 99,128,\r\n      4, 74,240,239,239,110,  2,100, 27,100, 40,236,229,230,244,226,\r\n    225,242,226,245,112,128, 33,188,242,233,231,232,244,226,225,242,\r\n    226,245,112,128, 33,192,243,241,245,225,242,101,128, 51,202,244,\r\n    225,102,  3,100, 73,100,165,101,  0,240,225,244,225,104,134,  5,\r\n    178,100, 93,100, 98,100,112,100,121,100,136,100,152,177, 54,128,\r\n      5,178, 50,  2,100,104,100,108, 51,128,  5,178,102,128,  5,178,\r\n    232,229,226,242,229,119,128,  5,178,238,225,242,242,239,247,232,\r\n    229,226,242,229,119,128,  5,178,241,245,225,242,244,229,242,232,\r\n    229,226,242,229,119,128,  5,178,247,233,228,229,232,229,226,242,\r\n    229,119,128,  5,178,241,225,237,225,244,115,135,  5,179,100,188,\r\n    100,193,100,198,100,203,100,212,100,227,100,243,177, 98,128,  5,\r\n    179,178, 56,128,  5,179,179, 52,128,  5,179,232,229,226,242,229,\r\n    119,128,  5,179,238,225,242,242,239,247,232,229,226,242,229,119,\r\n    128,  5,179,241,245,225,242,244,229,242,232,229,226,242,229,119,\r\n    128,  5,179,247,233,228,229,232,229,226,242,229,119,128,  5,179,\r\n    243,229,231,239,108,135,  5,177,101, 22,101, 27,101, 32,101, 37,\r\n    101, 46,101, 61,101, 77,177, 55,128,  5,177,178, 52,128,  5,177,\r\n    179, 48,128,  5,177,232,229,226,242,229,119,128,  5,177,238,225,\r\n    242,242,239,247,232,229,226,242,229,119,128,  5,177,241,245,225,\r\n    242,244,229,242,232,229,226,242,229,119,128,  5,177,247,233,228,\r\n    229,232,229,226,242,229,119,128,  5,177, 98,  3,101, 98,101,103,\r\n    101,113,225,114,128,  1, 39,239,240,239,237,239,230,111,128, 49,\r\n     15,242,229,246,229,226,229,236,239,119,128, 30, 43, 99,  2,101,\r\n    131,101,140,229,228,233,236,236, 97,128, 30, 41,233,242, 99,  2,\r\n    101,148,101,153,236,101,128, 36,215,245,237,230,236,229,120,128,\r\n      1, 37,100,  2,101,168,101,178,233,229,242,229,243,233,115,128,\r\n     30, 39,239,116,  2,101,185,101,194,225,227,227,229,238,116,128,\r\n     30, 35,226,229,236,239,119,128, 30, 37,101,136,  5,212,101,222,\r\n    101,255,102, 19,102,248,103,  8,103, 53,103, 62,103, 75,225,242,\r\n    116,129, 38,101,101,230,243,245,233,116,  2,101,239,101,247,226,\r\n    236,225,227,107,128, 38,101,247,232,233,244,101,128, 38, 97,228,\r\n    225,231,229,243,104,129,251, 52,102, 10,232,229,226,242,229,119,\r\n    128,251, 52,104,  6,102, 33,102, 61,102, 69,102,119,102,165,102,\r\n    214, 97,  2,102, 39,102, 53,236,244,239,238,229,225,242,225,226,\r\n    233, 99,128,  6,193,242,225,226,233, 99,128,  6, 71,229,226,242,\r\n    229,119,128,  5,212,230,233,238,225,236, 97,  2,102, 80,102,111,\r\n    236,116,  2,102, 87,102, 99,239,238,229,225,242,225,226,233, 99,\r\n    128,251,167,244,247,239,225,242,225,226,233, 99,128,254,234,242,\r\n    225,226,233, 99,128,254,234,232,225,237,250,225,225,226,239,246,\r\n    101,  2,102,134,102,148,230,233,238,225,236,225,242,225,226,233,\r\n     99,128,251,165,233,243,239,236,225,244,229,228,225,242,225,226,\r\n    233, 99,128,251,164,105,  2,102,171,102,205,238,233,244,233,225,\r\n    236, 97,  2,102,183,102,197,236,244,239,238,229,225,242,225,226,\r\n    233, 99,128,251,168,242,225,226,233, 99,128,254,235,242,225,231,\r\n    225,238, 97,128, 48,120,237,229,228,233,225,236, 97,  2,102,226,\r\n    102,240,236,244,239,238,229,225,242,225,226,233, 99,128,251,169,\r\n    242,225,226,233, 99,128,254,236,233,243,229,233,229,242,225,243,\r\n    241,245,225,242,101,128, 51,123,107,  2,103, 14,103, 38,225,244,\r\n    225,235,225,238, 97,129, 48,216,103, 26,232,225,236,230,247,233,\r\n    228,244,104,128,255,141,245,244,225,225,242,245,243,241,245,225,\r\n    242,101,128, 51, 54,238,231,232,239,239,107,128,  2,103,242,245,\r\n    244,245,243,241,245,225,242,101,128, 51, 57,116,129,  5,215,103,\r\n     81,232,229,226,242,229,119,128,  5,215,232,239,239,107,129,  2,\r\n    102,103, 99,243,245,240,229,242,233,239,114,128,  2,177,105,  4,\r\n    103,120,103,205,103,216,103,241,229,245,104,  4,103,132,103,167,\r\n    103,182,103,191, 97,  2,103,138,103,153,227,233,242,227,236,229,\r\n    235,239,242,229,225,110,128, 50,123,240,225,242,229,238,235,239,\r\n    242,229,225,110,128, 50, 27,227,233,242,227,236,229,235,239,242,\r\n    229,225,110,128, 50,109,235,239,242,229,225,110,128, 49, 78,240,\r\n    225,242,229,238,235,239,242,229,225,110,128, 50, 13,232,233,242,\r\n    225,231,225,238, 97,128, 48,114,235,225,244,225,235,225,238, 97,\r\n    129, 48,210,103,229,232,225,236,230,247,233,228,244,104,128,255,\r\n    139,242,233,113,134,  5,180,104,  3,104,  8,104, 22,104, 31,104,\r\n     46,104, 62,177, 52,128,  5,180, 50,  2,104, 14,104, 18, 49,128,\r\n      5,180,100,128,  5,180,232,229,226,242,229,119,128,  5,180,238,\r\n    225,242,242,239,247,232,229,226,242,229,119,128,  5,180,241,245,\r\n    225,242,244,229,242,232,229,226,242,229,119,128,  5,180,247,233,\r\n    228,229,232,229,226,242,229,119,128,  5,180,236,233,238,229,226,\r\n    229,236,239,119,128, 30,150,237,239,238,239,243,240,225,227,101,\r\n    128,255, 72,111,  9,104,119,104,130,104,154,104,179,105, 11,105,\r\n     24,105,110,105,150,105,161,225,242,237,229,238,233,225,110,128,\r\n      5,112,232,105,  2,104,137,104,145,240,244,232,225,105,128, 14,\r\n     43,242,225,231,225,238, 97,128, 48,123,235,225,244,225,235,225,\r\n    238, 97,129, 48,219,104,167,232,225,236,230,247,233,228,244,104,\r\n    128,255,142,236,225,109,135,  5,185,104,199,104,204,104,209,104,\r\n    214,104,223,104,238,104,254,177, 57,128,  5,185,178, 54,128,  5,\r\n    185,179, 50,128,  5,185,232,229,226,242,229,119,128,  5,185,238,\r\n    225,242,242,239,247,232,229,226,242,229,119,128,  5,185,241,245,\r\n    225,242,244,229,242,232,229,226,242,229,119,128,  5,185,247,233,\r\n    228,229,232,229,226,242,229,119,128,  5,185,238,239,235,232,245,\r\n    235,244,232,225,105,128, 14, 46,111,  2,105, 30,105,100,107,  4,\r\n    105, 40,105, 52,105, 58,105, 80,225,226,239,246,229,227,239,237,\r\n     98,128,  3,  9,227,237, 98,128,  3,  9,240,225,236,225,244,225,\r\n    236,233,250,229,228,226,229,236,239,247,227,237, 98,128,  3, 33,\r\n    242,229,244,242,239,230,236,229,248,226,229,236,239,247,227,237,\r\n     98,128,  3, 34,238,243,241,245,225,242,101,128, 51, 66,114,  2,\r\n    105,116,105,143,105,  2,105,122,105,131,227,239,240,244,233, 99,\r\n    128,  3,233,250,239,238,244,225,236,226,225,114,128, 32, 21,238,\r\n    227,237, 98,128,  3, 27,244,243,240,242,233,238,231,115,128, 38,\r\n    104,245,243,101,128, 35,  2,240,225,242,229,110,128, 36,163,243,\r\n    245,240,229,242,233,239,114,128,  2,176,244,245,242,238,229,100,\r\n    128,  2,101,117,  4,105,205,105,216,105,229,105,254,232,233,242,\r\n    225,231,225,238, 97,128, 48,117,233,233,244,239,243,241,245,225,\r\n    242,101,128, 51, 51,235,225,244,225,235,225,238, 97,129, 48,213,\r\n    105,242,232,225,236,230,247,233,228,244,104,128,255,140,238,231,\r\n    225,242,245,237,236,225,245,116,129,  2,221,106, 13,227,237, 98,\r\n    128,  3, 11,118,128,  1,149,249,240,232,229,110,132,  0, 45,106,\r\n     39,106, 50,106, 62,106, 85,233,238,230,229,242,233,239,114,128,\r\n    246,229,237,239,238,239,243,240,225,227,101,128,255, 13,115,  2,\r\n    106, 68,106, 75,237,225,236,108,128,254, 99,245,240,229,242,233,\r\n    239,114,128,246,230,244,247,111,128, 32, 16,105,149,  0,105,106,\r\n    137,106,160,106,194,106,241,110,123,110,243,111, 24,111, 51,111,\r\n    213,111,217,111,255,112, 21,112,105,113, 14,113, 89,113, 97,113,\r\n    110,113,197,113,254,114, 26,114, 70,225, 99,  2,106,144,106,150,\r\n    245,244,101,128,  0,237,249,242,233,236,236,233, 99,128,  4, 79,\r\n     98,  3,106,168,106,177,106,187,229,238,231,225,236,105,128,  9,\r\n    135,239,240,239,237,239,230,111,128, 49, 39,242,229,246,101,128,\r\n      1, 45, 99,  3,106,202,106,209,106,231,225,242,239,110,128,  1,\r\n    208,233,242, 99,  2,106,217,106,222,236,101,128, 36,216,245,237,\r\n    230,236,229,120,128,  0,238,249,242,233,236,236,233, 99,128,  4,\r\n     86,100,  4,106,251,107,  5,110, 80,110,113,226,236,231,242,225,\r\n    246,101,128,  2,  9,101,  2,107, 11,110, 75,239,231,242,225,240,\r\n    104,  7,107, 32,107, 46,107, 59,109,244,110, 19,110, 32,110, 44,\r\n    229,225,242,244,232,227,233,242,227,236,101,128, 50,143,230,233,\r\n    242,229,227,233,242,227,236,101,128, 50,139,233, 99, 14,107, 90,\r\n    107,106,107,205,108,  3,108, 69,108, 98,108,114,108,171,108,220,\r\n    108,232,109,  3,109, 70,109,208,109,237,225,236,236,233,225,238,\r\n    227,229,240,225,242,229,110,128, 50, 63, 99,  4,107,116,107,127,\r\n    107,141,107,148,225,236,236,240,225,242,229,110,128, 50, 58,229,\r\n    238,244,242,229,227,233,242,227,236,101,128, 50,165,236,239,243,\r\n    101,128, 48,  6,111,  3,107,156,107,171,107,191,237,237, 97,129,\r\n     48,  1,107,164,236,229,230,116,128,255,100,238,231,242,225,244,\r\n    245,236,225,244,233,239,238,240,225,242,229,110,128, 50, 55,242,\r\n    242,229,227,244,227,233,242,227,236,101,128, 50,163,101,  3,107,\r\n    213,107,225,107,242,225,242,244,232,240,225,242,229,110,128, 50,\r\n     47,238,244,229,242,240,242,233,243,229,240,225,242,229,110,128,\r\n     50, 61,248,227,229,236,236,229,238,244,227,233,242,227,236,101,\r\n    128, 50,157,102,  2,108,  9,108, 24,229,243,244,233,246,225,236,\r\n    240,225,242,229,110,128, 50, 64,105,  2,108, 30,108, 59,238,225,\r\n    238,227,233,225,108,  2,108, 42,108, 51,227,233,242,227,236,101,\r\n    128, 50,150,240,225,242,229,110,128, 50, 54,242,229,240,225,242,\r\n    229,110,128, 50, 43,104,  2,108, 75,108, 86,225,246,229,240,225,\r\n    242,229,110,128, 50, 50,233,231,232,227,233,242,227,236,101,128,\r\n     50,164,233,244,229,242,225,244,233,239,238,237,225,242,107,128,\r\n     48,  5,108,  3,108,122,108,148,108,160,225,226,239,114,  2,108,\r\n    131,108,140,227,233,242,227,236,101,128, 50,152,240,225,242,229,\r\n    110,128, 50, 56,229,230,244,227,233,242,227,236,101,128, 50,167,\r\n    239,247,227,233,242,227,236,101,128, 50,166,109,  2,108,177,108,\r\n    209,101,  2,108,183,108,198,228,233,227,233,238,229,227,233,242,\r\n    227,236,101,128, 50,169,244,225,236,240,225,242,229,110,128, 50,\r\n     46,239,239,238,240,225,242,229,110,128, 50, 42,238,225,237,229,\r\n    240,225,242,229,110,128, 50, 52,112,  2,108,238,108,246,229,242,\r\n    233,239,100,128, 48,  2,242,233,238,244,227,233,242,227,236,101,\r\n    128, 50,158,114,  2,109,  9,109, 57,101,  3,109, 17,109, 28,109,\r\n     43,225,227,232,240,225,242,229,110,128, 50, 67,240,242,229,243,\r\n    229,238,244,240,225,242,229,110,128, 50, 57,243,239,245,242,227,\r\n    229,240,225,242,229,110,128, 50, 62,233,231,232,244,227,233,242,\r\n    227,236,101,128, 50,168,115,  5,109, 82,109,111,109,125,109,150,\r\n    109,178,101,  2,109, 88,109,101,227,242,229,244,227,233,242,227,\r\n    236,101,128, 50,153,236,230,240,225,242,229,110,128, 50, 66,239,\r\n    227,233,229,244,249,240,225,242,229,110,128, 50, 51,112,  2,109,\r\n    131,109,137,225,227,101,128, 48,  0,229,227,233,225,236,240,225,\r\n    242,229,110,128, 50, 53,116,  2,109,156,109,167,239,227,235,240,\r\n    225,242,229,110,128, 50, 49,245,228,249,240,225,242,229,110,128,\r\n     50, 59,117,  2,109,184,109,193,238,240,225,242,229,110,128, 50,\r\n     48,240,229,242,246,233,243,229,240,225,242,229,110,128, 50, 60,\r\n    119,  2,109,214,109,226,225,244,229,242,240,225,242,229,110,128,\r\n     50, 44,239,239,228,240,225,242,229,110,128, 50, 45,250,229,242,\r\n    111,128, 48,  7,109,  2,109,250,110,  7,229,244,225,236,227,233,\r\n    242,227,236,101,128, 50,142,239,239,238,227,233,242,227,236,101,\r\n    128, 50,138,238,225,237,229,227,233,242,227,236,101,128, 50,148,\r\n    243,245,238,227,233,242,227,236,101,128, 50,144,119,  2,110, 50,\r\n    110, 63,225,244,229,242,227,233,242,227,236,101,128, 50,140,239,\r\n    239,228,227,233,242,227,236,101,128, 50,141,246, 97,128,  9,  7,\r\n    233,229,242,229,243,233,115,130,  0,239,110, 94,110,102,225,227,\r\n    245,244,101,128, 30, 47,227,249,242,233,236,236,233, 99,128,  4,\r\n    229,239,244,226,229,236,239,119,128, 30,203,101,  3,110,131,110,\r\n    147,110,158,226,242,229,246,229,227,249,242,233,236,236,233, 99,\r\n    128,  4,215,227,249,242,233,236,236,233, 99,128,  4, 53,245,238,\r\n    103,  4,110,170,110,205,110,220,110,229, 97,  2,110,176,110,191,\r\n    227,233,242,227,236,229,235,239,242,229,225,110,128, 50,117,240,\r\n    225,242,229,238,235,239,242,229,225,110,128, 50, 21,227,233,242,\r\n    227,236,229,235,239,242,229,225,110,128, 50,103,235,239,242,229,\r\n    225,110,128, 49, 71,240,225,242,229,238,235,239,242,229,225,110,\r\n    128, 50,  7,103,  2,110,249,111,  0,242,225,246,101,128,  0,236,\r\n    117,  2,111,  6,111, 15,234,225,242,225,244,105,128, 10,135,242,\r\n    237,245,235,232,105,128, 10,  7,104,  2,111, 30,111, 40,233,242,\r\n    225,231,225,238, 97,128, 48, 68,239,239,235,225,226,239,246,101,\r\n    128, 30,201,105,  8,111, 69,111, 79,111, 90,111, 97,111,122,111,\r\n    138,111,153,111,169,226,229,238,231,225,236,105,128,  9,136,227,\r\n    249,242,233,236,236,233, 99,128,  4, 56,228,229,246, 97,128,  9,\r\n      8,231,117,  2,111,104,111,113,234,225,242,225,244,105,128, 10,\r\n    136,242,237,245,235,232,105,128, 10,  8,237,225,244,242,225,231,\r\n    245,242,237,245,235,232,105,128, 10, 64,238,246,229,242,244,229,\r\n    228,226,242,229,246,101,128,  2, 11,243,232,239,242,244,227,249,\r\n    242,233,236,236,233, 99,128,  4, 57,246,239,247,229,236,243,233,\r\n    231,110,  3,111,185,111,195,111,202,226,229,238,231,225,236,105,\r\n    128,  9,192,228,229,246, 97,128,  9, 64,231,245,234,225,242,225,\r\n    244,105,128, 10,192,106,128,  1, 51,107,  2,111,223,111,247,225,\r\n    244,225,235,225,238, 97,129, 48,164,111,235,232,225,236,230,247,\r\n    233,228,244,104,128,255,114,239,242,229,225,110,128, 49, 99,108,\r\n      2,112,  5,112, 10,228,101,128,  2,220,245,249,232,229,226,242,\r\n    229,119,128,  5,172,109,  2,112, 27,112, 94, 97,  3,112, 35,112,\r\n     55,112, 80,227,242,239,110,129,  1, 43,112, 44,227,249,242,233,\r\n    236,236,233, 99,128,  4,227,231,229,239,242,225,240,240,242,239,\r\n    248,233,237,225,244,229,236,249,229,241,245,225,108,128, 34, 83,\r\n    244,242,225,231,245,242,237,245,235,232,105,128, 10, 63,239,238,\r\n    239,243,240,225,227,101,128,255, 73,110,  5,112,117,112,127,112,\r\n    136,112,148,112,232,227,242,229,237,229,238,116,128, 34,  6,230,\r\n    233,238,233,244,121,128, 34, 30,233,225,242,237,229,238,233,225,\r\n    110,128,  5,107,116,  2,112,154,112,222,101,  2,112,160,112,211,\r\n    231,242,225,108,131, 34, 43,112,173,112,191,112,196, 98,  2,112,\r\n    179,112,187,239,244,244,239,109,128, 35, 33,116,128, 35, 33,229,\r\n    120,128,248,245,116,  2,112,202,112,207,239,112,128, 35, 32,112,\r\n    128, 35, 32,242,243,229,227,244,233,239,110,128, 34, 41,233,243,\r\n    241,245,225,242,101,128, 51,  5,118,  3,112,240,112,249,113,  2,\r\n    226,245,236,236,229,116,128, 37,216,227,233,242,227,236,101,128,\r\n     37,217,243,237,233,236,229,230,225,227,101,128, 38, 59,111,  3,\r\n    113, 22,113, 33,113, 41,227,249,242,233,236,236,233, 99,128,  4,\r\n     81,231,239,238,229,107,128,  1, 47,244, 97,131,  3,185,113, 52,\r\n    113, 73,113, 81,228,233,229,242,229,243,233,115,129,  3,202,113,\r\n     65,244,239,238,239,115,128,  3,144,236,225,244,233,110,128,  2,\r\n    105,244,239,238,239,115,128,  3,175,240,225,242,229,110,128, 36,\r\n    164,242,233,231,245,242,237,245,235,232,105,128, 10,114,115,  4,\r\n    113,120,113,165,113,179,113,187,237,225,236,108,  2,113,129,113,\r\n    140,232,233,242,225,231,225,238, 97,128, 48, 67,235,225,244,225,\r\n    235,225,238, 97,129, 48,163,113,153,232,225,236,230,247,233,228,\r\n    244,104,128,255,104,243,232,225,242,226,229,238,231,225,236,105,\r\n    128,  9,250,244,242,239,235,101,128,  2,104,245,240,229,242,233,\r\n    239,114,128,246,237,116,  2,113,203,113,237,229,242,225,244,233,\r\n    239,110,  2,113,215,113,226,232,233,242,225,231,225,238, 97,128,\r\n     48,157,235,225,244,225,235,225,238, 97,128, 48,253,233,236,228,\r\n    101,129,  1, 41,113,246,226,229,236,239,119,128, 30, 45,117,  2,\r\n    114,  4,114, 15,226,239,240,239,237,239,230,111,128, 49, 41,227,\r\n    249,242,233,236,236,233, 99,128,  4, 78,246,239,247,229,236,243,\r\n    233,231,110,  3,114, 42,114, 52,114, 59,226,229,238,231,225,236,\r\n    105,128,  9,191,228,229,246, 97,128,  9, 63,231,245,234,225,242,\r\n    225,244,105,128, 10,191,250,232,233,244,243, 97,  2,114, 81,114,\r\n     92,227,249,242,233,236,236,233, 99,128,  4,117,228,226,236,231,\r\n    242,225,246,229,227,249,242,233,236,236,233, 99,128,  4,119,106,\r\n    138,  0,106,114,135,114,198,114,209,115,  3,115, 19,115,132,115,\r\n    201,115,206,115,218,115,226, 97,  4,114,145,114,156,114,166,114,\r\n    173,225,242,237,229,238,233,225,110,128,  5,113,226,229,238,231,\r\n    225,236,105,128,  9,156,228,229,246, 97,128,  9, 28,231,117,  2,\r\n    114,180,114,189,234,225,242,225,244,105,128, 10,156,242,237,245,\r\n    235,232,105,128, 10, 28,226,239,240,239,237,239,230,111,128, 49,\r\n     16, 99,  3,114,217,114,224,114,246,225,242,239,110,128,  1,240,\r\n    233,242, 99,  2,114,232,114,237,236,101,128, 36,217,245,237,230,\r\n    236,229,120,128,  1, 53,242,239,243,243,229,228,244,225,233,108,\r\n    128,  2,157,228,239,244,236,229,243,243,243,244,242,239,235,101,\r\n    128,  2, 95,101,  3,115, 27,115, 38,115,103,227,249,242,233,236,\r\n    236,233, 99,128,  4, 88,229,109,  4,115, 49,115, 58,115, 72,115,\r\n     88,225,242,225,226,233, 99,128,  6, 44,230,233,238,225,236,225,\r\n    242,225,226,233, 99,128,254,158,233,238,233,244,233,225,236,225,\r\n    242,225,226,233, 99,128,254,159,237,229,228,233,225,236,225,242,\r\n    225,226,233, 99,128,254,160,104,  2,115,109,115,118,225,242,225,\r\n    226,233, 99,128,  6,152,230,233,238,225,236,225,242,225,226,233,\r\n     99,128,251,139,104,  2,115,138,115,188, 97,  3,115,146,115,156,\r\n    115,163,226,229,238,231,225,236,105,128,  9,157,228,229,246, 97,\r\n    128,  9, 29,231,117,  2,115,170,115,179,234,225,242,225,244,105,\r\n    128, 10,157,242,237,245,235,232,105,128, 10, 29,229,232,225,242,\r\n    237,229,238,233,225,110,128,  5,123,233,115,128, 48,  4,237,239,\r\n    238,239,243,240,225,227,101,128,255, 74,240,225,242,229,110,128,\r\n     36,165,243,245,240,229,242,233,239,114,128,  2,178,107,146,  0,\r\n    107,116, 21,118,110,118,121,118,183,118,194,119, 28,119, 42,120,\r\n    150,121, 90,121,103,121,129,121,178,122, 60,122, 82,122, 95,122,\r\n    118,122,160,122,170, 97, 12,116, 47,116, 79,116,101,116,131,116,\r\n    245,117, 14,117, 44,117, 69,117,175,117,189,118, 56,118, 85, 98,\r\n      2,116, 53,116, 70,225,243,232,235,233,242,227,249,242,233,236,\r\n    236,233, 99,128,  4,161,229,238,231,225,236,105,128,  9,149, 99,\r\n      2,116, 85,116, 91,245,244,101,128, 30, 49,249,242,233,236,236,\r\n    233, 99,128,  4, 58,228,101,  2,116,108,116,126,243,227,229,238,\r\n    228,229,242,227,249,242,233,236,236,233, 99,128,  4,155,246, 97,\r\n    128,  9, 21,102,135,  5,219,116,149,116,158,116,178,116,192,116,\r\n    201,116,217,116,232,225,242,225,226,233, 99,128,  6, 67,228,225,\r\n    231,229,243,104,129,251, 59,116,169,232,229,226,242,229,119,128,\r\n    251, 59,230,233,238,225,236,225,242,225,226,233, 99,128,254,218,\r\n    232,229,226,242,229,119,128,  5,219,233,238,233,244,233,225,236,\r\n    225,242,225,226,233, 99,128,254,219,237,229,228,233,225,236,225,\r\n    242,225,226,233, 99,128,254,220,242,225,230,229,232,229,226,242,\r\n    229,119,128,251, 77,231,117,  2,116,252,117,  5,234,225,242,225,\r\n    244,105,128, 10,149,242,237,245,235,232,105,128, 10, 21,104,  2,\r\n    117, 20,117, 30,233,242,225,231,225,238, 97,128, 48, 75,239,239,\r\n    235,227,249,242,233,236,236,233, 99,128,  4,196,235,225,244,225,\r\n    235,225,238, 97,129, 48,171,117, 57,232,225,236,230,247,233,228,\r\n    244,104,128,255,118,112,  2,117, 75,117, 96,240, 97,129,  3,186,\r\n    117, 82,243,249,237,226,239,236,231,242,229,229,107,128,  3,240,\r\n    249,229,239,245,110,  3,117,108,117,122,117,156,237,233,229,245,\r\n    237,235,239,242,229,225,110,128, 49,113,112,  2,117,128,117,143,\r\n    232,233,229,245,240,232,235,239,242,229,225,110,128, 49,132,233,\r\n    229,245,240,235,239,242,229,225,110,128, 49,120,243,243,225,238,\r\n    231,240,233,229,245,240,235,239,242,229,225,110,128, 49,121,242,\r\n    239,242,233,233,243,241,245,225,242,101,128, 51, 13,115,  5,117,\r\n    201,117,245,118,  4,118, 12,118, 40,232,233,228,225,225,245,244,\r\n    111,  2,117,214,117,223,225,242,225,226,233, 99,128,  6, 64,238,\r\n    239,243,233,228,229,226,229,225,242,233,238,231,225,242,225,226,\r\n    233, 99,128,  6, 64,237,225,236,236,235,225,244,225,235,225,238,\r\n     97,128, 48,245,241,245,225,242,101,128, 51,132,242, 97,  2,118,\r\n     19,118, 28,225,242,225,226,233, 99,128,  6, 80,244,225,238,225,\r\n    242,225,226,233, 99,128,  6, 77,244,242,239,235,229,227,249,242,\r\n    233,236,236,233, 99,128,  4,159,244,225,232,233,242,225,240,242,\r\n    239,236,239,238,231,237,225,242,235,232,225,236,230,247,233,228,\r\n    244,104,128,255,112,246,229,242,244,233,227,225,236,243,244,242,\r\n    239,235,229,227,249,242,233,236,236,233, 99,128,  4,157,226,239,\r\n    240,239,237,239,230,111,128, 49, 14, 99,  4,118,131,118,153,118,\r\n    162,118,170, 97,  2,118,137,118,147,236,243,241,245,225,242,101,\r\n    128, 51,137,242,239,110,128,  1,233,229,228,233,236,236, 97,128,\r\n      1, 55,233,242,227,236,101,128, 36,218,239,237,237,225,225,227,\r\n    227,229,238,116,128,  1, 55,228,239,244,226,229,236,239,119,128,\r\n     30, 51,101,  4,118,204,118,231,119,  0,119, 12,104,  2,118,210,\r\n    118,221,225,242,237,229,238,233,225,110,128,  5,132,233,242,225,\r\n    231,225,238, 97,128, 48, 81,235,225,244,225,235,225,238, 97,129,\r\n     48,177,118,244,232,225,236,230,247,233,228,244,104,128,255,121,\r\n    238,225,242,237,229,238,233,225,110,128,  5,111,243,237,225,236,\r\n    236,235,225,244,225,235,225,238, 97,128, 48,246,231,242,229,229,\r\n    238,236,225,238,228,233, 99,128,  1, 56,104,  6,119, 56,119,185,\r\n    119,196,119,221,120, 52,120,140, 97,  5,119, 68,119, 78,119, 89,\r\n    119, 96,119,121,226,229,238,231,225,236,105,128,  9,150,227,249,\r\n    242,233,236,236,233, 99,128,  4, 69,228,229,246, 97,128,  9, 22,\r\n    231,117,  2,119,103,119,112,234,225,242,225,244,105,128, 10,150,\r\n    242,237,245,235,232,105,128, 10, 22,104,  4,119,131,119,140,119,\r\n    154,119,170,225,242,225,226,233, 99,128,  6, 46,230,233,238,225,\r\n    236,225,242,225,226,233, 99,128,254,166,233,238,233,244,233,225,\r\n    236,225,242,225,226,233, 99,128,254,167,237,229,228,233,225,236,\r\n    225,242,225,226,233, 99,128,254,168,229,233,227,239,240,244,233,\r\n     99,128,  3,231,232, 97,  2,119,203,119,210,228,229,246, 97,128,\r\n      9, 89,231,245,242,237,245,235,232,105,128, 10, 89,233,229,245,\r\n    235,104,  4,119,235,120, 14,120, 29,120, 38, 97,  2,119,241,120,\r\n      0,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,120,\r\n    240,225,242,229,238,235,239,242,229,225,110,128, 50, 24,227,233,\r\n    242,227,236,229,235,239,242,229,225,110,128, 50,106,235,239,242,\r\n    229,225,110,128, 49, 75,240,225,242,229,238,235,239,242,229,225,\r\n    110,128, 50, 10,111,  4,120, 62,120,111,120,121,120,126,235,104,\r\n      4,120, 73,120, 82,120, 91,120,101,225,233,244,232,225,105,128,\r\n     14,  2,239,238,244,232,225,105,128, 14,  5,245,225,244,244,232,\r\n    225,105,128, 14,  3,247,225,233,244,232,225,105,128, 14,  4,237,\r\n    245,244,244,232,225,105,128, 14, 91,239,107,128,  1,153,242,225,\r\n    235,232,225,238,231,244,232,225,105,128, 14,  6,250,243,241,245,\r\n    225,242,101,128, 51,145,105,  4,120,160,120,171,120,196,120,245,\r\n    232,233,242,225,231,225,238, 97,128, 48, 77,235,225,244,225,235,\r\n    225,238, 97,129, 48,173,120,184,232,225,236,230,247,233,228,244,\r\n    104,128,255,119,242,111,  3,120,205,120,220,120,236,231,245,242,\r\n    225,237,245,243,241,245,225,242,101,128, 51, 21,237,229,229,244,\r\n    239,242,245,243,241,245,225,242,101,128, 51, 22,243,241,245,225,\r\n    242,101,128, 51, 20,249,229,239,107,  5,121,  4,121, 39,121, 54,\r\n    121, 63,121, 77, 97,  2,121, 10,121, 25,227,233,242,227,236,229,\r\n    235,239,242,229,225,110,128, 50,110,240,225,242,229,238,235,239,\r\n    242,229,225,110,128, 50, 14,227,233,242,227,236,229,235,239,242,\r\n    229,225,110,128, 50, 96,235,239,242,229,225,110,128, 49, 49,240,\r\n    225,242,229,238,235,239,242,229,225,110,128, 50,  0,243,233,239,\r\n    243,235,239,242,229,225,110,128, 49, 51,234,229,227,249,242,233,\r\n    236,236,233, 99,128,  4, 92,108,  2,121,109,121,120,233,238,229,\r\n    226,229,236,239,119,128, 30, 53,243,241,245,225,242,101,128, 51,\r\n    152,109,  3,121,137,121,151,121,162,227,245,226,229,228,243,241,\r\n    245,225,242,101,128, 51,166,239,238,239,243,240,225,227,101,128,\r\n    255, 75,243,241,245,225,242,229,228,243,241,245,225,242,101,128,\r\n     51,162,111,  5,121,190,121,216,121,254,122, 10,122, 24,104,  2,\r\n    121,196,121,206,233,242,225,231,225,238, 97,128, 48, 83,237,243,\r\n    241,245,225,242,101,128, 51,192,235, 97,  2,121,223,121,231,233,\r\n    244,232,225,105,128, 14,  1,244,225,235,225,238, 97,129, 48,179,\r\n    121,242,232,225,236,230,247,233,228,244,104,128,255,122,239,240,\r\n    239,243,241,245,225,242,101,128, 51, 30,240,240,225,227,249,242,\r\n    233,236,236,233, 99,128,  4,129,114,  2,122, 30,122, 50,229,225,\r\n    238,243,244,225,238,228,225,242,228,243,249,237,226,239,108,128,\r\n     50,127,239,238,233,243,227,237, 98,128,  3, 67,240, 97,  2,122,\r\n     67,122, 73,242,229,110,128, 36,166,243,241,245,225,242,101,128,\r\n     51,170,243,233,227,249,242,233,236,236,233, 99,128,  4,111,116,\r\n      2,122,101,122,110,243,241,245,225,242,101,128, 51,207,245,242,\r\n    238,229,100,128,  2,158,117,  2,122,124,122,135,232,233,242,225,\r\n    231,225,238, 97,128, 48, 79,235,225,244,225,235,225,238, 97,129,\r\n     48,175,122,148,232,225,236,230,247,233,228,244,104,128,255,120,\r\n    246,243,241,245,225,242,101,128, 51,184,247,243,241,245,225,242,\r\n    101,128, 51,190,108,146,  0,108,122,220,124,247,125, 20,125, 86,\r\n    125,124,126, 20,126, 29,126, 45,126, 69,126, 87,126,205,126,246,\r\n    127,125,127,133,127,166,127,175,127,183,127,245, 97,  7,122,236,\r\n    122,246,122,253,123,  4,123, 29,123, 45,124,235,226,229,238,231,\r\n    225,236,105,128,  9,178,227,245,244,101,128,  1, 58,228,229,246,\r\n     97,128,  9, 50,231,117,  2,123, 11,123, 20,234,225,242,225,244,\r\n    105,128, 10,178,242,237,245,235,232,105,128, 10, 50,235,235,232,\r\n    225,238,231,249,225,239,244,232,225,105,128, 14, 69,109, 10,123,\r\n     67,124,  6,124, 23,124, 61,124, 75,124, 94,124,110,124,130,124,\r\n    150,124,173, 97,  2,123, 73,123,254,236,229,102,  4,123, 85,123,\r\n     99,123,191,123,208,230,233,238,225,236,225,242,225,226,233, 99,\r\n    128,254,252,232,225,237,250, 97,  2,123,109,123,150,225,226,239,\r\n    246,101,  2,123,119,123,133,230,233,238,225,236,225,242,225,226,\r\n    233, 99,128,254,248,233,243,239,236,225,244,229,228,225,242,225,\r\n    226,233, 99,128,254,247,226,229,236,239,119,  2,123,160,123,174,\r\n    230,233,238,225,236,225,242,225,226,233, 99,128,254,250,233,243,\r\n    239,236,225,244,229,228,225,242,225,226,233, 99,128,254,249,233,\r\n    243,239,236,225,244,229,228,225,242,225,226,233, 99,128,254,251,\r\n    237,225,228,228,225,225,226,239,246,101,  2,123,223,123,237,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,254,246,233,243,239,\r\n    236,225,244,229,228,225,242,225,226,233, 99,128,254,245,242,225,\r\n    226,233, 99,128,  6, 68,226,228, 97,129,  3,187,124, 14,243,244,\r\n    242,239,235,101,128,  1,155,229,100,130,  5,220,124, 32,124, 52,\r\n    228,225,231,229,243,104,129,251, 60,124, 43,232,229,226,242,229,\r\n    119,128,251, 60,232,229,226,242,229,119,128,  5,220,230,233,238,\r\n    225,236,225,242,225,226,233, 99,128,254,222,232,225,232,233,238,\r\n    233,244,233,225,236,225,242,225,226,233, 99,128,252,202,233,238,\r\n    233,244,233,225,236,225,242,225,226,233, 99,128,254,223,234,229,\r\n    229,237,233,238,233,244,233,225,236,225,242,225,226,233, 99,128,\r\n    252,201,235,232,225,232,233,238,233,244,233,225,236,225,242,225,\r\n    226,233, 99,128,252,203,236,225,237,232,229,232,233,243,239,236,\r\n    225,244,229,228,225,242,225,226,233, 99,128,253,242,237,101,  2,\r\n    124,180,124,193,228,233,225,236,225,242,225,226,233, 99,128,254,\r\n    224,229,109,  2,124,200,124,219,232,225,232,233,238,233,244,233,\r\n    225,236,225,242,225,226,233, 99,128,253,136,233,238,233,244,233,\r\n    225,236,225,242,225,226,233, 99,128,252,204,242,231,229,227,233,\r\n    242,227,236,101,128, 37,239, 98,  3,124,255,125,  4,125, 10,225,\r\n    114,128,  1,154,229,236,116,128,  2,108,239,240,239,237,239,230,\r\n    111,128, 49, 12, 99,  4,125, 30,125, 37,125, 46,125, 73,225,242,\r\n    239,110,128,  1, 62,229,228,233,236,236, 97,128,  1, 60,233,242,\r\n     99,  2,125, 54,125, 59,236,101,128, 36,219,245,237,230,236,229,\r\n    248,226,229,236,239,119,128, 30, 61,239,237,237,225,225,227,227,\r\n    229,238,116,128,  1, 60,228,239,116,130,  1, 64,125, 96,125,105,\r\n    225,227,227,229,238,116,128,  1, 64,226,229,236,239,119,129, 30,\r\n     55,125,115,237,225,227,242,239,110,128, 30, 57,101,  3,125,132,\r\n    125,170,126, 15,230,116,  2,125,139,125,155,225,238,231,236,229,\r\n    225,226,239,246,229,227,237, 98,128,  3, 26,244,225,227,235,226,\r\n    229,236,239,247,227,237, 98,128,  3, 24,243,115,132,  0, 60,125,\r\n    183,125,205,125,217,126,  7,229,241,245,225,108,129, 34,100,125,\r\n    193,239,242,231,242,229,225,244,229,114,128, 34,218,237,239,238,\r\n    239,243,240,225,227,101,128,255, 28,111,  2,125,223,125,252,114,\r\n      2,125,229,125,242,229,241,245,233,246,225,236,229,238,116,128,\r\n     34,114,231,242,229,225,244,229,114,128, 34,118,246,229,242,229,\r\n    241,245,225,108,128, 34,102,243,237,225,236,108,128,254,100,250,\r\n    104,128,  2,110,230,226,236,239,227,107,128, 37,140,232,239,239,\r\n    235,242,229,244,242,239,230,236,229,120,128,  2,109,105,  2,126,\r\n     51,126, 56,242, 97,128, 32,164,247,238,225,242,237,229,238,233,\r\n    225,110,128,  5,108,106,129,  1,201,126, 75,229,227,249,242,233,\r\n    236,236,233, 99,128,  4, 89,108,132,246,192,126, 99,126,123,126,\r\n    134,126,143, 97,  2,126,105,126,112,228,229,246, 97,128,  9, 51,\r\n    231,245,234,225,242,225,244,105,128, 10,179,233,238,229,226,229,\r\n    236,239,119,128, 30, 59,236,225,228,229,246, 97,128,  9, 52,246,\r\n    239,227,225,236,233, 99,  3,126,157,126,167,126,174,226,229,238,\r\n    231,225,236,105,128,  9,225,228,229,246, 97,128,  9, 97,246,239,\r\n    247,229,236,243,233,231,110,  2,126,188,126,198,226,229,238,231,\r\n    225,236,105,128,  9,227,228,229,246, 97,128,  9, 99,109,  3,126,\r\n    213,126,226,126,237,233,228,228,236,229,244,233,236,228,101,128,\r\n      2,107,239,238,239,243,240,225,227,101,128,255, 76,243,241,245,\r\n    225,242,101,128, 51,208,111,  6,127,  4,127, 16,127, 58,127, 69,\r\n    127, 75,127,117,227,232,245,236,225,244,232,225,105,128, 14, 44,\r\n    231,233,227,225,108,  3,127, 28,127, 34,127, 53,225,238,100,128,\r\n     34, 39,238,239,116,129,  0,172,127, 42,242,229,246,229,242,243,\r\n    229,100,128, 35, 16,239,114,128, 34, 40,236,233,238,231,244,232,\r\n    225,105,128, 14, 37,238,231,115,128,  1,127,247,236,233,238,101,\r\n      2,127, 85,127,108, 99,  2,127, 91,127,103,229,238,244,229,242,\r\n    236,233,238,101,128,254, 78,237, 98,128,  3, 50,228,225,243,232,\r\n    229,100,128,254, 77,250,229,238,231,101,128, 37,202,240,225,242,\r\n    229,110,128, 36,167,115,  3,127,141,127,148,127,156,236,225,243,\r\n    104,128,  1, 66,241,245,225,242,101,128, 33, 19,245,240,229,242,\r\n    233,239,114,128,246,238,244,243,232,225,228,101,128, 37,145,245,\r\n    244,232,225,105,128, 14, 38,246,239,227,225,236,233, 99,  3,127,\r\n    197,127,207,127,214,226,229,238,231,225,236,105,128,  9,140,228,\r\n    229,246, 97,128,  9, 12,246,239,247,229,236,243,233,231,110,  2,\r\n    127,228,127,238,226,229,238,231,225,236,105,128,  9,226,228,229,\r\n    246, 97,128,  9, 98,248,243,241,245,225,242,101,128, 51,211,109,\r\n    144,  0,109,128, 35,130,144,130,169,130,196,130,221,132, 18,132,\r\n     40,133, 95,133,125,133,174,134, 25,134, 47,134, 72,134, 81,135,\r\n    108,135,136, 97, 12,128, 61,128, 71,128,135,128,142,128,167,128,\r\n    215,130, 51,130, 76,130, 81,130, 95,130,107,130,112,226,229,238,\r\n    231,225,236,105,128,  9,174, 99,  2,128, 77,128,129,242,239,110,\r\n    132,  0,175,128, 91,128,102,128,108,128,117,226,229,236,239,247,\r\n    227,237, 98,128,  3, 49,227,237, 98,128,  3,  4,236,239,247,237,\r\n    239,100,128,  2,205,237,239,238,239,243,240,225,227,101,128,255,\r\n    227,245,244,101,128, 30, 63,228,229,246, 97,128,  9, 46,231,117,\r\n      2,128,149,128,158,234,225,242,225,244,105,128, 10,174,242,237,\r\n    245,235,232,105,128, 10, 46,104,  2,128,173,128,205,225,240,225,\r\n    235,104,  2,128,183,128,192,232,229,226,242,229,119,128,  5,164,\r\n    236,229,230,244,232,229,226,242,229,119,128,  5,164,233,242,225,\r\n    231,225,238, 97,128, 48,126,105,  5,128,227,129, 40,129,103,129,\r\n    133,130, 39,227,232,225,244,244,225,247, 97,  3,128,242,129, 17,\r\n    129, 24,236,239,119,  2,128,250,129,  5,236,229,230,244,244,232,\r\n    225,105,128,248,149,242,233,231,232,244,244,232,225,105,128,248,\r\n    148,244,232,225,105,128, 14, 75,245,240,240,229,242,236,229,230,\r\n    244,244,232,225,105,128,248,147,229,107,  3,129, 49,129, 80,129,\r\n     87,236,239,119,  2,129, 57,129, 68,236,229,230,244,244,232,225,\r\n    105,128,248,140,242,233,231,232,244,244,232,225,105,128,248,139,\r\n    244,232,225,105,128, 14, 72,245,240,240,229,242,236,229,230,244,\r\n    244,232,225,105,128,248,138,232,225,238,225,235,225,116,  2,129,\r\n    115,129,126,236,229,230,244,244,232,225,105,128,248,132,244,232,\r\n    225,105,128, 14, 49,116,  3,129,141,129,169,129,232,225,233,235,\r\n    232,117,  2,129,151,129,162,236,229,230,244,244,232,225,105,128,\r\n    248,137,244,232,225,105,128, 14, 71,232,111,  3,129,178,129,209,\r\n    129,216,236,239,119,  2,129,186,129,197,236,229,230,244,244,232,\r\n    225,105,128,248,143,242,233,231,232,244,244,232,225,105,128,248,\r\n    142,244,232,225,105,128, 14, 73,245,240,240,229,242,236,229,230,\r\n    244,244,232,225,105,128,248,141,242,105,  3,129,241,130, 16,130,\r\n     23,236,239,119,  2,129,249,130,  4,236,229,230,244,244,232,225,\r\n    105,128,248,146,242,233,231,232,244,244,232,225,105,128,248,145,\r\n    244,232,225,105,128, 14, 74,245,240,240,229,242,236,229,230,244,\r\n    244,232,225,105,128,248,144,249,225,237,239,235,244,232,225,105,\r\n    128, 14, 70,235,225,244,225,235,225,238, 97,129, 48,222,130, 64,\r\n    232,225,236,230,247,233,228,244,104,128,255,143,236,101,128, 38,\r\n     66,238,243,249,239,238,243,241,245,225,242,101,128, 51, 71,241,\r\n    225,230,232,229,226,242,229,119,128,  5,190,242,115,128, 38, 66,\r\n    115,  2,130,118,130,136,239,242,225,227,233,242,227,236,229,232,\r\n    229,226,242,229,119,128,  5,175,241,245,225,242,101,128, 51,131,\r\n     98,  2,130,150,130,160,239,240,239,237,239,230,111,128, 49,  7,\r\n    243,241,245,225,242,101,128, 51,212, 99,  2,130,175,130,183,233,\r\n    242,227,236,101,128, 36,220,245,226,229,228,243,241,245,225,242,\r\n    101,128, 51,165,228,239,116,  2,130,204,130,213,225,227,227,229,\r\n    238,116,128, 30, 65,226,229,236,239,119,128, 30, 67,101,  7,130,\r\n    237,131,108,131,119,131,134,131,159,131,196,131,208,101,  2,130,\r\n    243,131, 95,109,  4,130,253,131,  6,131, 20,131, 36,225,242,225,\r\n    226,233, 99,128,  6, 69,230,233,238,225,236,225,242,225,226,233,\r\n     99,128,254,226,233,238,233,244,233,225,236,225,242,225,226,233,\r\n     99,128,254,227,237,101,  2,131, 43,131, 56,228,233,225,236,225,\r\n    242,225,226,233, 99,128,254,228,229,237,105,  2,131, 64,131, 79,\r\n    238,233,244,233,225,236,225,242,225,226,233, 99,128,252,209,243,\r\n    239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 72,244,\r\n    239,242,245,243,241,245,225,242,101,128, 51, 77,232,233,242,225,\r\n    231,225,238, 97,128, 48,129,233,250,233,229,242,225,243,241,245,\r\n    225,242,101,128, 51,126,235,225,244,225,235,225,238, 97,129, 48,\r\n    225,131,147,232,225,236,230,247,233,228,244,104,128,255,146,109,\r\n    130,  5,222,131,167,131,187,228,225,231,229,243,104,129,251, 62,\r\n    131,178,232,229,226,242,229,119,128,251, 62,232,229,226,242,229,\r\n    119,128,  5,222,238,225,242,237,229,238,233,225,110,128,  5,116,\r\n    242,235,232, 97,  3,131,219,131,228,132,  5,232,229,226,242,229,\r\n    119,128,  5,165,235,229,230,245,236, 97,  2,131,239,131,248,232,\r\n    229,226,242,229,119,128,  5,166,236,229,230,244,232,229,226,242,\r\n    229,119,128,  5,166,236,229,230,244,232,229,226,242,229,119,128,\r\n      5,165,104,  2,132, 24,132, 30,239,239,107,128,  2,113,250,243,\r\n    241,245,225,242,101,128, 51,146,105,  6,132, 54,132, 91,132,228,\r\n    132,239,133,  8,133, 65,228,100,  2,132, 61,132, 86,236,229,228,\r\n    239,244,235,225,244,225,235,225,238,225,232,225,236,230,247,233,\r\n    228,244,104,128,255,101,239,116,128,  0,183,229,245,109,  5,132,\r\n    105,132,140,132,155,132,164,132,215, 97,  2,132,111,132,126,227,\r\n    233,242,227,236,229,235,239,242,229,225,110,128, 50,114,240,225,\r\n    242,229,238,235,239,242,229,225,110,128, 50, 18,227,233,242,227,\r\n    236,229,235,239,242,229,225,110,128, 50,100,235,239,242,229,225,\r\n    110,128, 49, 65,112,  2,132,170,132,202, 97,  2,132,176,132,190,\r\n    238,243,233,239,243,235,239,242,229,225,110,128, 49,112,242,229,\r\n    238,235,239,242,229,225,110,128, 50,  4,233,229,245,240,235,239,\r\n    242,229,225,110,128, 49,110,243,233,239,243,235,239,242,229,225,\r\n    110,128, 49,111,232,233,242,225,231,225,238, 97,128, 48,127,235,\r\n    225,244,225,235,225,238, 97,129, 48,223,132,252,232,225,236,230,\r\n    247,233,228,244,104,128,255,144,238,117,  2,133, 15,133, 60,115,\r\n    132, 34, 18,133, 27,133, 38,133, 47,133, 53,226,229,236,239,247,\r\n    227,237, 98,128,  3, 32,227,233,242,227,236,101,128, 34,150,237,\r\n    239,100,128,  2,215,240,236,245,115,128, 34, 19,244,101,128, 32,\r\n     50,242,105,  2,133, 72,133, 86,226,225,225,242,245,243,241,245,\r\n    225,242,101,128, 51, 74,243,241,245,225,242,101,128, 51, 73,108,\r\n      2,133,101,133,116,239,238,231,236,229,231,244,245,242,238,229,\r\n    100,128,  2,112,243,241,245,225,242,101,128, 51,150,109,  3,133,\r\n    133,133,147,133,158,227,245,226,229,228,243,241,245,225,242,101,\r\n    128, 51,163,239,238,239,243,240,225,227,101,128,255, 77,243,241,\r\n    245,225,242,229,228,243,241,245,225,242,101,128, 51,159,111,  5,\r\n    133,186,133,212,133,237,133,247,134,  0,104,  2,133,192,133,202,\r\n    233,242,225,231,225,238, 97,128, 48,130,237,243,241,245,225,242,\r\n    101,128, 51,193,235,225,244,225,235,225,238, 97,129, 48,226,133,\r\n    225,232,225,236,230,247,233,228,244,104,128,255,147,236,243,241,\r\n    245,225,242,101,128, 51,214,237,225,244,232,225,105,128, 14, 33,\r\n    246,229,242,243,243,241,245,225,242,101,129, 51,167,134, 15,228,\r\n    243,241,245,225,242,101,128, 51,168,240, 97,  2,134, 32,134, 38,\r\n    242,229,110,128, 36,168,243,241,245,225,242,101,128, 51,171,115,\r\n      2,134, 53,134, 62,243,241,245,225,242,101,128, 51,179,245,240,\r\n    229,242,233,239,114,128,246,239,244,245,242,238,229,100,128,  2,\r\n    111,117,141,  0,181,134,111,134,115,134,125,134,149,134,159,134,\r\n    181,134,192,134,217,134,240,134,250,135, 24,135, 88,135, 98, 49,\r\n    128,  0,181,225,243,241,245,225,242,101,128, 51,130,227,104,  2,\r\n    134,132,134,142,231,242,229,225,244,229,114,128, 34,107,236,229,\r\n    243,115,128, 34,106,230,243,241,245,225,242,101,128, 51,140,103,\r\n      2,134,165,134,172,242,229,229,107,128,  3,188,243,241,245,225,\r\n    242,101,128, 51,141,232,233,242,225,231,225,238, 97,128, 48,128,\r\n    235,225,244,225,235,225,238, 97,129, 48,224,134,205,232,225,236,\r\n    230,247,233,228,244,104,128,255,145,108,  2,134,223,134,232,243,\r\n    241,245,225,242,101,128, 51,149,244,233,240,236,121,128,  0,215,\r\n    237,243,241,245,225,242,101,128, 51,155,238,225,104,  2,135,  2,\r\n    135, 11,232,229,226,242,229,119,128,  5,163,236,229,230,244,232,\r\n    229,226,242,229,119,128,  5,163,115,  2,135, 30,135, 79,233, 99,\r\n      3,135, 39,135, 56,135, 67,225,236,238,239,244,101,129, 38,106,\r\n    135, 50,228,226,108,128, 38,107,230,236,225,244,243,233,231,110,\r\n    128, 38,109,243,232,225,242,240,243,233,231,110,128, 38,111,243,\r\n    241,245,225,242,101,128, 51,178,246,243,241,245,225,242,101,128,\r\n     51,182,247,243,241,245,225,242,101,128, 51,188,118,  2,135,114,\r\n    135,127,237,229,231,225,243,241,245,225,242,101,128, 51,185,243,\r\n    241,245,225,242,101,128, 51,183,119,  2,135,142,135,155,237,229,\r\n    231,225,243,241,245,225,242,101,128, 51,191,243,241,245,225,242,\r\n    101,128, 51,189,110,150,  0,110,135,212,136, 90,136,114,136,180,\r\n    136,205,137,  7,137, 17,137, 84,137,127,139,161,139,179,139,204,\r\n    139,235,140,  5,140, 70,142, 52,142, 60,142, 85,142, 93,143, 61,\r\n    143, 71,143, 81, 97,  8,135,230,135,250,136,  1,136,  8,136, 33,\r\n    136, 44,136, 69,136, 81, 98,  2,135,236,135,245,229,238,231,225,\r\n    236,105,128,  9,168,236, 97,128, 34,  7,227,245,244,101,128,  1,\r\n     68,228,229,246, 97,128,  9, 40,231,117,  2,136, 15,136, 24,234,\r\n    225,242,225,244,105,128, 10,168,242,237,245,235,232,105,128, 10,\r\n     40,232,233,242,225,231,225,238, 97,128, 48,106,235,225,244,225,\r\n    235,225,238, 97,129, 48,202,136, 57,232,225,236,230,247,233,228,\r\n    244,104,128,255,133,240,239,243,244,242,239,240,232,101,128,  1,\r\n     73,243,241,245,225,242,101,128, 51,129, 98,  2,136, 96,136,106,\r\n    239,240,239,237,239,230,111,128, 49, 11,243,240,225,227,101,128,\r\n      0,160, 99,  4,136,124,136,131,136,140,136,167,225,242,239,110,\r\n    128,  1, 72,229,228,233,236,236, 97,128,  1, 70,233,242, 99,  2,\r\n    136,148,136,153,236,101,128, 36,221,245,237,230,236,229,248,226,\r\n    229,236,239,119,128, 30, 75,239,237,237,225,225,227,227,229,238,\r\n    116,128,  1, 70,228,239,116,  2,136,188,136,197,225,227,227,229,\r\n    238,116,128, 30, 69,226,229,236,239,119,128, 30, 71,101,  3,136,\r\n    213,136,224,136,249,232,233,242,225,231,225,238, 97,128, 48,109,\r\n    235,225,244,225,235,225,238, 97,129, 48,205,136,237,232,225,236,\r\n    230,247,233,228,244,104,128,255,136,247,243,232,229,241,229,236,\r\n    243,233,231,110,128, 32,170,230,243,241,245,225,242,101,128, 51,\r\n    139,103,  2,137, 23,137, 73, 97,  3,137, 31,137, 41,137, 48,226,\r\n    229,238,231,225,236,105,128,  9,153,228,229,246, 97,128,  9, 25,\r\n    231,117,  2,137, 55,137, 64,234,225,242,225,244,105,128, 10,153,\r\n    242,237,245,235,232,105,128, 10, 25,239,238,231,245,244,232,225,\r\n    105,128, 14,  7,104,  2,137, 90,137,100,233,242,225,231,225,238,\r\n     97,128, 48,147,239,239,107,  2,137,108,137,115,236,229,230,116,\r\n    128,  2,114,242,229,244,242,239,230,236,229,120,128,  2,115,105,\r\n      4,137,137,138, 50,138, 61,138,119,229,245,110,  7,137,155,137,\r\n    190,137,222,137,236,137,245,138, 22,138, 35, 97,  2,137,161,137,\r\n    176,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,111,\r\n    240,225,242,229,238,235,239,242,229,225,110,128, 50, 15,227,105,\r\n      2,137,197,137,209,229,245,227,235,239,242,229,225,110,128, 49,\r\n     53,242,227,236,229,235,239,242,229,225,110,128, 50, 97,232,233,\r\n    229,245,232,235,239,242,229,225,110,128, 49, 54,235,239,242,229,\r\n    225,110,128, 49, 52,240, 97,  2,137,252,138, 10,238,243,233,239,\r\n    243,235,239,242,229,225,110,128, 49,104,242,229,238,235,239,242,\r\n    229,225,110,128, 50,  1,243,233,239,243,235,239,242,229,225,110,\r\n    128, 49,103,244,233,235,229,245,244,235,239,242,229,225,110,128,\r\n     49,102,232,233,242,225,231,225,238, 97,128, 48,107,107,  2,138,\r\n     67,138, 91,225,244,225,235,225,238, 97,129, 48,203,138, 79,232,\r\n    225,236,230,247,233,228,244,104,128,255,134,232,225,232,233,116,\r\n      2,138,101,138,112,236,229,230,244,244,232,225,105,128,248,153,\r\n    244,232,225,105,128, 14, 77,238,101,141,  0, 57,138,150,138,159,\r\n    138,169,138,199,138,206,138,231,139,  2,139, 36,139, 48,139, 59,\r\n    139, 92,139,100,139,111,225,242,225,226,233, 99,128,  6,105,226,\r\n    229,238,231,225,236,105,128,  9,239,227,233,242,227,236,101,129,\r\n     36,104,138,180,233,238,246,229,242,243,229,243,225,238,243,243,\r\n    229,242,233,102,128, 39,146,228,229,246, 97,128,  9,111,231,117,\r\n      2,138,213,138,222,234,225,242,225,244,105,128, 10,239,242,237,\r\n    245,235,232,105,128, 10,111,232, 97,  2,138,238,138,249,227,235,\r\n    225,242,225,226,233, 99,128,  6,105,238,231,250,232,239,117,128,\r\n     48, 41,105,  2,139,  8,139, 26,228,229,239,231,242,225,240,232,\r\n    233,227,240,225,242,229,110,128, 50, 40,238,230,229,242,233,239,\r\n    114,128, 32,137,237,239,238,239,243,240,225,227,101,128,255, 25,\r\n    239,236,228,243,244,249,236,101,128,247, 57,112,  2,139, 65,139,\r\n     72,225,242,229,110,128, 36,124,229,114,  2,139, 79,139, 85,233,\r\n    239,100,128, 36,144,243,233,225,110,128,  6,249,242,239,237,225,\r\n    110,128, 33,120,243,245,240,229,242,233,239,114,128, 32,121,116,\r\n      2,139,117,139,155,229,229,110,  2,139,125,139,134,227,233,242,\r\n    227,236,101,128, 36,114,112,  2,139,140,139,147,225,242,229,110,\r\n    128, 36,134,229,242,233,239,100,128, 36,154,232,225,105,128, 14,\r\n     89,106,129,  1,204,139,167,229,227,249,242,233,236,236,233, 99,\r\n    128,  4, 90,235,225,244,225,235,225,238, 97,129, 48,243,139,192,\r\n    232,225,236,230,247,233,228,244,104,128,255,157,108,  2,139,210,\r\n    139,224,229,231,242,233,231,232,244,236,239,238,103,128,  1,158,\r\n    233,238,229,226,229,236,239,119,128, 30, 73,109,  2,139,241,139,\r\n    252,239,238,239,243,240,225,227,101,128,255, 78,243,241,245,225,\r\n    242,101,128, 51,154,110,  2,140, 11,140, 61, 97,  3,140, 19,140,\r\n     29,140, 36,226,229,238,231,225,236,105,128,  9,163,228,229,246,\r\n     97,128,  9, 35,231,117,  2,140, 43,140, 52,234,225,242,225,244,\r\n    105,128, 10,163,242,237,245,235,232,105,128, 10, 35,238,225,228,\r\n    229,246, 97,128,  9, 41,111,  6,140, 84,140, 95,140,120,140,161,\r\n    141,113,142, 40,232,233,242,225,231,225,238, 97,128, 48,110,235,\r\n    225,244,225,235,225,238, 97,129, 48,206,140,108,232,225,236,230,\r\n    247,233,228,244,104,128,255,137,110,  3,140,128,140,144,140,153,\r\n    226,242,229,225,235,233,238,231,243,240,225,227,101,128,  0,160,\r\n    229,238,244,232,225,105,128, 14, 19,245,244,232,225,105,128, 14,\r\n     25,239,110,  7,140,178,140,187,140,201,140,235,140,251,141, 36,\r\n    141, 95,225,242,225,226,233, 99,128,  6, 70,230,233,238,225,236,\r\n    225,242,225,226,233, 99,128,254,230,231,232,245,238,238, 97,  2,\r\n    140,212,140,221,225,242,225,226,233, 99,128,  6,186,230,233,238,\r\n    225,236,225,242,225,226,233, 99,128,251,159,233,238,233,244,233,\r\n    225,236,225,242,225,226,233, 99,128,254,231,234,229,229,237,105,\r\n      2,141,  5,141, 20,238,233,244,233,225,236,225,242,225,226,233,\r\n     99,128,252,210,243,239,236,225,244,229,228,225,242,225,226,233,\r\n     99,128,252, 75,237,101,  2,141, 43,141, 56,228,233,225,236,225,\r\n    242,225,226,233, 99,128,254,232,229,237,105,  2,141, 64,141, 79,\r\n    238,233,244,233,225,236,225,242,225,226,233, 99,128,252,213,243,\r\n    239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 78,238,\r\n    239,239,238,230,233,238,225,236,225,242,225,226,233, 99,128,252,\r\n    141,116,  7,141,129,141,140,141,169,141,204,141,216,141,236,142,\r\n      6,227,239,238,244,225,233,238,115,128, 34, 12,101,  2,141,146,\r\n    141,162,236,229,237,229,238,116,129, 34,  9,141,157,239,102,128,\r\n     34,  9,241,245,225,108,128, 34, 96,231,242,229,225,244,229,114,\r\n    129, 34,111,141,181,238,239,114,  2,141,189,141,197,229,241,245,\r\n    225,108,128, 34,113,236,229,243,115,128, 34,121,233,228,229,238,\r\n    244,233,227,225,108,128, 34, 98,236,229,243,115,129, 34,110,141,\r\n    225,238,239,242,229,241,245,225,108,128, 34,112,112,  2,141,242,\r\n    141,252,225,242,225,236,236,229,108,128, 34, 38,242,229,227,229,\r\n    228,229,115,128, 34,128,243,117,  3,142, 15,142, 22,142, 31,226,\r\n    243,229,116,128, 34,132,227,227,229,229,228,115,128, 34,129,240,\r\n    229,242,243,229,116,128, 34,133,247,225,242,237,229,238,233,225,\r\n    110,128,  5,118,240,225,242,229,110,128, 36,169,115,  2,142, 66,\r\n    142, 75,243,241,245,225,242,101,128, 51,177,245,240,229,242,233,\r\n    239,114,128, 32,127,244,233,236,228,101,128,  0,241,117,132,  3,\r\n    189,142,105,142,116,142,197,143, 24,232,233,242,225,231,225,238,\r\n     97,128, 48,108,107,  2,142,122,142,146,225,244,225,235,225,238,\r\n     97,129, 48,204,142,134,232,225,236,230,247,233,228,244,104,128,\r\n    255,135,244, 97,  3,142,155,142,165,142,172,226,229,238,231,225,\r\n    236,105,128,  9,188,228,229,246, 97,128,  9, 60,231,117,  2,142,\r\n    179,142,188,234,225,242,225,244,105,128, 10,188,242,237,245,235,\r\n    232,105,128, 10, 60,109,  2,142,203,142,237,226,229,242,243,233,\r\n    231,110,130,  0, 35,142,217,142,229,237,239,238,239,243,240,225,\r\n    227,101,128,255,  3,243,237,225,236,108,128,254, 95,229,114,  2,\r\n    142,244,143, 20,225,236,243,233,231,110,  2,142,255,143,  7,231,\r\n    242,229,229,107,128,  3,116,236,239,247,229,242,231,242,229,229,\r\n    107,128,  3,117,111,128, 33, 22,110,130,  5,224,143, 32,143, 52,\r\n    228,225,231,229,243,104,129,251, 64,143, 43,232,229,226,242,229,\r\n    119,128,251, 64,232,229,226,242,229,119,128,  5,224,246,243,241,\r\n    245,225,242,101,128, 51,181,247,243,241,245,225,242,101,128, 51,\r\n    187,249, 97,  3,143, 90,143,100,143,107,226,229,238,231,225,236,\r\n    105,128,  9,158,228,229,246, 97,128,  9, 30,231,117,  2,143,114,\r\n    143,123,234,225,242,225,244,105,128, 10,158,242,237,245,235,232,\r\n    105,128, 10, 30,111,147,  0,111,143,174,143,196,144, 18,144,188,\r\n    145,  4,145, 19,145, 59,145,182,145,203,145,241,145,252,146,174,\r\n    148,  8,148, 72,148,105,148,151,149, 24,149, 71,149, 83, 97,  2,\r\n    143,180,143,187,227,245,244,101,128,  0,243,238,231,244,232,225,\r\n    105,128, 14, 45, 98,  4,143,206,143,248,144,  1,144, 11,225,242,\r\n    242,229,100,130,  2,117,143,218,143,229,227,249,242,233,236,236,\r\n    233, 99,128,  4,233,228,233,229,242,229,243,233,243,227,249,242,\r\n    233,236,236,233, 99,128,  4,235,229,238,231,225,236,105,128,  9,\r\n    147,239,240,239,237,239,230,111,128, 49, 27,242,229,246,101,128,\r\n      1, 79, 99,  3,144, 26,144, 99,144,178, 97,  2,144, 32,144, 93,\r\n    238,228,242, 97,  3,144, 43,144, 50,144, 61,228,229,246, 97,128,\r\n      9, 17,231,245,234,225,242,225,244,105,128, 10,145,246,239,247,\r\n    229,236,243,233,231,110,  2,144, 75,144, 82,228,229,246, 97,128,\r\n      9, 73,231,245,234,225,242,225,244,105,128, 10,201,242,239,110,\r\n    128,  1,210,233,242, 99,  2,144,107,144,112,236,101,128, 36,222,\r\n    245,237,230,236,229,120,133,  0,244,144,131,144,139,144,150,144,\r\n    158,144,170,225,227,245,244,101,128, 30,209,228,239,244,226,229,\r\n    236,239,119,128, 30,217,231,242,225,246,101,128, 30,211,232,239,\r\n    239,235,225,226,239,246,101,128, 30,213,244,233,236,228,101,128,\r\n     30,215,249,242,233,236,236,233, 99,128,  4, 62,100,  4,144,198,\r\n    144,221,144,227,144,250,226,108,  2,144,205,144,213,225,227,245,\r\n    244,101,128,  1, 81,231,242,225,246,101,128,  2, 13,229,246, 97,\r\n    128,  9, 19,233,229,242,229,243,233,115,129,  0,246,144,239,227,\r\n    249,242,233,236,236,233, 99,128,  4,231,239,244,226,229,236,239,\r\n    119,128, 30,205,101,129,  1, 83,145, 10,235,239,242,229,225,110,\r\n    128, 49, 90,103,  3,145, 27,145, 42,145, 49,239,238,229,107,129,\r\n      2,219,145, 36,227,237, 98,128,  3, 40,242,225,246,101,128,  0,\r\n    242,245,234,225,242,225,244,105,128, 10,147,104,  4,145, 69,145,\r\n     80,145, 90,145,168,225,242,237,229,238,233,225,110,128,  5,133,\r\n    233,242,225,231,225,238, 97,128, 48, 74,111,  2,145, 96,145,106,\r\n    239,235,225,226,239,246,101,128, 30,207,242,110,133,  1,161,145,\r\n    121,145,129,145,140,145,148,145,160,225,227,245,244,101,128, 30,\r\n    219,228,239,244,226,229,236,239,119,128, 30,227,231,242,225,246,\r\n    101,128, 30,221,232,239,239,235,225,226,239,246,101,128, 30,223,\r\n    244,233,236,228,101,128, 30,225,245,238,231,225,242,245,237,236,\r\n    225,245,116,128,  1, 81,105,129,  1,163,145,188,238,246,229,242,\r\n    244,229,228,226,242,229,246,101,128,  2, 15,107,  2,145,209,145,\r\n    233,225,244,225,235,225,238, 97,129, 48,170,145,221,232,225,236,\r\n    230,247,233,228,244,104,128,255,117,239,242,229,225,110,128, 49,\r\n     87,236,229,232,229,226,242,229,119,128,  5,171,109,  6,146, 10,\r\n    146, 38,146, 45,146,134,146,145,146,163,225,227,242,239,110,130,\r\n      1, 77,146, 22,146, 30,225,227,245,244,101,128, 30, 83,231,242,\r\n    225,246,101,128, 30, 81,228,229,246, 97,128,  9, 80,229,231, 97,\r\n    133,  3,201,146, 61,146, 65,146, 76,146, 90,146,106, 49,128,  3,\r\n    214,227,249,242,233,236,236,233, 99,128,  4, 97,236,225,244,233,\r\n    238,227,236,239,243,229,100,128,  2,119,242,239,245,238,228,227,\r\n    249,242,233,236,236,233, 99,128,  4,123,116,  2,146,112,146,127,\r\n    233,244,236,239,227,249,242,233,236,236,233, 99,128,  4,125,239,\r\n    238,239,115,128,  3,206,231,245,234,225,242,225,244,105,128, 10,\r\n    208,233,227,242,239,110,129,  3,191,146,155,244,239,238,239,115,\r\n    128,  3,204,239,238,239,243,240,225,227,101,128,255, 79,238,101,\r\n    145,  0, 49,146,213,146,222,146,232,147,  6,147, 31,147, 40,147,\r\n     49,147, 74,147,108,147,142,147,154,147,173,147,184,147,217,147,\r\n    227,147,235,147,246,225,242,225,226,233, 99,128,  6, 97,226,229,\r\n    238,231,225,236,105,128,  9,231,227,233,242,227,236,101,129, 36,\r\n     96,146,243,233,238,246,229,242,243,229,243,225,238,243,243,229,\r\n    242,233,102,128, 39,138,100,  2,147, 12,147, 18,229,246, 97,128,\r\n      9,103,239,244,229,238,236,229,225,228,229,114,128, 32, 36,229,\r\n    233,231,232,244,104,128, 33, 91,230,233,244,244,229,100,128,246,\r\n    220,231,117,  2,147, 56,147, 65,234,225,242,225,244,105,128, 10,\r\n    231,242,237,245,235,232,105,128, 10,103,232, 97,  3,147, 83,147,\r\n     94,147, 99,227,235,225,242,225,226,233, 99,128,  6, 97,236,102,\r\n    128,  0,189,238,231,250,232,239,117,128, 48, 33,105,  2,147,114,\r\n    147,132,228,229,239,231,242,225,240,232,233,227,240,225,242,229,\r\n    110,128, 50, 32,238,230,229,242,233,239,114,128, 32,129,237,239,\r\n    238,239,243,240,225,227,101,128,255, 17,238,245,237,229,242,225,\r\n    244,239,242,226,229,238,231,225,236,105,128,  9,244,239,236,228,\r\n    243,244,249,236,101,128,247, 49,112,  2,147,190,147,197,225,242,\r\n    229,110,128, 36,116,229,114,  2,147,204,147,210,233,239,100,128,\r\n     36,136,243,233,225,110,128,  6,241,241,245,225,242,244,229,114,\r\n    128,  0,188,242,239,237,225,110,128, 33,112,243,245,240,229,242,\r\n    233,239,114,128,  0,185,244,104,  2,147,253,148,  2,225,105,128,\r\n     14, 81,233,242,100,128, 33, 83,111,  3,148, 16,148, 50,148, 66,\r\n    103,  2,148, 22,148, 40,239,238,229,107,129,  1,235,148, 31,237,\r\n    225,227,242,239,110,128,  1,237,245,242,237,245,235,232,105,128,\r\n     10, 19,237,225,244,242,225,231,245,242,237,245,235,232,105,128,\r\n     10, 75,240,229,110,128,  2, 84,112,  3,148, 80,148, 87,148, 98,\r\n    225,242,229,110,128, 36,170,229,238,226,245,236,236,229,116,128,\r\n     37,230,244,233,239,110,128, 35, 37,114,  2,148,111,148,140,100,\r\n      2,148,117,148,128,230,229,237,233,238,233,238,101,128,  0,170,\r\n    237,225,243,227,245,236,233,238,101,128,  0,186,244,232,239,231,\r\n    239,238,225,108,128, 34, 31,115,  5,148,163,148,195,148,212,149,\r\n      1,149, 14,232,239,242,116,  2,148,172,148,179,228,229,246, 97,\r\n    128,  9, 18,246,239,247,229,236,243,233,231,238,228,229,246, 97,\r\n    128,  9, 74,236,225,243,104,129,  0,248,148,204,225,227,245,244,\r\n    101,128,  1,255,237,225,236,108,  2,148,221,148,232,232,233,242,\r\n    225,231,225,238, 97,128, 48, 73,235,225,244,225,235,225,238, 97,\r\n    129, 48,169,148,245,232,225,236,230,247,233,228,244,104,128,255,\r\n    107,244,242,239,235,229,225,227,245,244,101,128,  1,255,245,240,\r\n    229,242,233,239,114,128,246,240,116,  2,149, 30,149, 41,227,249,\r\n    242,233,236,236,233, 99,128,  4,127,233,236,228,101,130,  0,245,\r\n    149, 52,149, 60,225,227,245,244,101,128, 30, 77,228,233,229,242,\r\n    229,243,233,115,128, 30, 79,245,226,239,240,239,237,239,230,111,\r\n    128, 49, 33,118,  2,149, 89,149,170,229,114,  2,149, 96,149,162,\r\n    236,233,238,101,131, 32, 62,149,109,149,132,149,155, 99,  2,149,\r\n    115,149,127,229,238,244,229,242,236,233,238,101,128,254, 74,237,\r\n     98,128,  3,  5,100,  2,149,138,149,146,225,243,232,229,100,128,\r\n    254, 73,226,236,247,225,246,121,128,254, 76,247,225,246,121,128,\r\n    254, 75,243,227,239,242,101,128,  0,175,239,247,229,236,243,233,\r\n    231,110,  3,149,185,149,195,149,202,226,229,238,231,225,236,105,\r\n    128,  9,203,228,229,246, 97,128,  9, 75,231,245,234,225,242,225,\r\n    244,105,128, 10,203,112,145,  0,112,149,251,152,123,152,134,152,\r\n    143,152,155,154, 80,154, 90,155, 82,156,101,156,191,156,217,157,\r\n     92,157,100,158,  2,158, 60,158, 88,158, 98, 97, 14,150, 25,150,\r\n     57,150, 67,150, 74,150, 81,150,129,150,140,150,154,150,165,150,\r\n    212,150,226,151,238,152, 21,152,111, 97,  2,150, 31,150, 43,237,\r\n    240,243,243,241,245,225,242,101,128, 51,128,243,229,238,244,239,\r\n    243,241,245,225,242,101,128, 51, 43,226,229,238,231,225,236,105,\r\n    128,  9,170,227,245,244,101,128, 30, 85,228,229,246, 97,128,  9,\r\n     42,103,  2,150, 87,150,105,101,  2,150, 93,150,100,228,239,247,\r\n    110,128, 33,223,245,112,128, 33,222,117,  2,150,111,150,120,234,\r\n    225,242,225,244,105,128, 10,170,242,237,245,235,232,105,128, 10,\r\n     42,232,233,242,225,231,225,238, 97,128, 48,113,233,249,225,238,\r\n    238,239,233,244,232,225,105,128, 14, 47,235,225,244,225,235,225,\r\n    238, 97,128, 48,209,108,  2,150,171,150,196,225,244,225,236,233,\r\n    250,225,244,233,239,238,227,249,242,233,236,236,233,227,227,237,\r\n     98,128,  4,132,239,227,232,235,225,227,249,242,233,236,236,233,\r\n     99,128,  4,192,238,243,233,239,243,235,239,242,229,225,110,128,\r\n     49,127,114,  3,150,234,150,255,151,227, 97,  2,150,240,150,248,\r\n    231,242,225,240,104,128,  0,182,236,236,229,108,128, 34, 37,229,\r\n    110,  2,151,  6,151,116,236,229,230,116,136,  0, 40,151, 29,151,\r\n     44,151, 49,151, 54,151, 65,151, 77,151,100,151,105,225,236,244,\r\n    239,238,229,225,242,225,226,233, 99,128,253, 62,226,116,128,248,\r\n    237,229,120,128,248,236,233,238,230,229,242,233,239,114,128, 32,\r\n    141,237,239,238,239,243,240,225,227,101,128,255,  8,115,  2,151,\r\n     83,151, 90,237,225,236,108,128,254, 89,245,240,229,242,233,239,\r\n    114,128, 32,125,244,112,128,248,235,246,229,242,244,233,227,225,\r\n    108,128,254, 53,242,233,231,232,116,136,  0, 41,151,140,151,155,\r\n    151,160,151,165,151,176,151,188,151,211,151,216,225,236,244,239,\r\n    238,229,225,242,225,226,233, 99,128,253, 63,226,116,128,248,248,\r\n    229,120,128,248,247,233,238,230,229,242,233,239,114,128, 32,142,\r\n    237,239,238,239,243,240,225,227,101,128,255,  9,115,  2,151,194,\r\n    151,201,237,225,236,108,128,254, 90,245,240,229,242,233,239,114,\r\n    128, 32,126,244,112,128,248,246,246,229,242,244,233,227,225,108,\r\n    128,254, 54,244,233,225,236,228,233,230,102,128, 34,  2,115,  3,\r\n    151,246,152,  1,152, 13,229,241,232,229,226,242,229,119,128,  5,\r\n    192,232,244,225,232,229,226,242,229,119,128,  5,153,241,245,225,\r\n    242,101,128, 51,169,244,225,104,134,  5,183,152, 39,152, 53,152,\r\n     58,152, 67,152, 82,152, 98, 49,  2,152, 45,152, 49, 49,128,  5,\r\n    183,100,128,  5,183,178, 97,128,  5,183,232,229,226,242,229,119,\r\n    128,  5,183,238,225,242,242,239,247,232,229,226,242,229,119,128,\r\n      5,183,241,245,225,242,244,229,242,232,229,226,242,229,119,128,\r\n      5,183,247,233,228,229,232,229,226,242,229,119,128,  5,183,250,\r\n    229,242,232,229,226,242,229,119,128,  5,161,226,239,240,239,237,\r\n    239,230,111,128, 49,  6,227,233,242,227,236,101,128, 36,223,228,\r\n    239,244,225,227,227,229,238,116,128, 30, 87,101,137,  5,228,152,\r\n    177,152,188,152,208,152,220,152,240,153, 86,153, 97,153,118,154,\r\n     73,227,249,242,233,236,236,233, 99,128,  4, 63,228,225,231,229,\r\n    243,104,129,251, 68,152,199,232,229,226,242,229,119,128,251, 68,\r\n    229,250,233,243,241,245,225,242,101,128, 51, 59,230,233,238,225,\r\n    236,228,225,231,229,243,232,232,229,226,242,229,119,128,251, 67,\r\n    104,  5,152,252,153, 19,153, 27,153, 41,153, 71,225,114,  2,153,\r\n      3,153, 10,225,226,233, 99,128,  6,126,237,229,238,233,225,110,\r\n    128,  5,122,229,226,242,229,119,128,  5,228,230,233,238,225,236,\r\n    225,242,225,226,233, 99,128,251, 87,105,  2,153, 47,153, 62,238,\r\n    233,244,233,225,236,225,242,225,226,233, 99,128,251, 88,242,225,\r\n    231,225,238, 97,128, 48,122,237,229,228,233,225,236,225,242,225,\r\n    226,233, 99,128,251, 89,235,225,244,225,235,225,238, 97,128, 48,\r\n    218,237,233,228,228,236,229,232,239,239,235,227,249,242,233,236,\r\n    236,233, 99,128,  4,167,114,  5,153,130,153,142,153,184,154, 49,\r\n    154, 62,225,230,229,232,229,226,242,229,119,128,251, 78,227,229,\r\n    238,116,131,  0, 37,153,155,153,164,153,176,225,242,225,226,233,\r\n     99,128,  6,106,237,239,238,239,243,240,225,227,101,128,255,  5,\r\n    243,237,225,236,108,128,254,106,105,  2,153,190,154, 31,239,100,\r\n    134,  0, 46,153,207,153,218,153,229,153,241,153,252,154,  8,225,\r\n    242,237,229,238,233,225,110,128,  5,137,227,229,238,244,229,242,\r\n    229,100,128,  0,183,232,225,236,230,247,233,228,244,104,128,255,\r\n     97,233,238,230,229,242,233,239,114,128,246,231,237,239,238,239,\r\n    243,240,225,227,101,128,255, 14,115,  2,154, 14,154, 21,237,225,\r\n    236,108,128,254, 82,245,240,229,242,233,239,114,128,246,232,243,\r\n    240,239,237,229,238,233,231,242,229,229,235,227,237, 98,128,  3,\r\n     66,240,229,238,228,233,227,245,236,225,114,128, 34,165,244,232,\r\n    239,245,243,225,238,100,128, 32, 48,243,229,244, 97,128, 32,167,\r\n    230,243,241,245,225,242,101,128, 51,138,104,  3,154, 98,154,148,\r\n    155, 29, 97,  3,154,106,154,116,154,123,226,229,238,231,225,236,\r\n    105,128,  9,171,228,229,246, 97,128,  9, 43,231,117,  2,154,130,\r\n    154,139,234,225,242,225,244,105,128, 10,171,242,237,245,235,232,\r\n    105,128, 10, 43,105,133,  3,198,154,162,154,166,154,252,155,  4,\r\n    155, 15, 49,128,  3,213,229,245,240,104,  4,154,179,154,214,154,\r\n    229,154,238, 97,  2,154,185,154,200,227,233,242,227,236,229,235,\r\n    239,242,229,225,110,128, 50,122,240,225,242,229,238,235,239,242,\r\n    229,225,110,128, 50, 26,227,233,242,227,236,229,235,239,242,229,\r\n    225,110,128, 50,108,235,239,242,229,225,110,128, 49, 77,240,225,\r\n    242,229,238,235,239,242,229,225,110,128, 50, 12,236,225,244,233,\r\n    110,128,  2,120,238,244,232,245,244,232,225,105,128, 14, 58,243,\r\n    249,237,226,239,236,231,242,229,229,107,128,  3,213,111,  3,155,\r\n     37,155, 42,155, 68,239,107,128,  1,165,240,104,  2,155, 49,155,\r\n     58,225,238,244,232,225,105,128, 14, 30,245,238,231,244,232,225,\r\n    105,128, 14, 28,243,225,237,240,232,225,239,244,232,225,105,128,\r\n     14, 32,105,133,  3,192,155, 96,156, 52,156, 63,156, 74,156, 88,\r\n    229,245,112,  6,155,112,155,147,155,179,155,207,155,221,156, 17,\r\n     97,  2,155,118,155,133,227,233,242,227,236,229,235,239,242,229,\r\n    225,110,128, 50,115,240,225,242,229,238,235,239,242,229,225,110,\r\n    128, 50, 19,227,105,  2,155,154,155,166,229,245,227,235,239,242,\r\n    229,225,110,128, 49,118,242,227,236,229,235,239,242,229,225,110,\r\n    128, 50,101,107,  2,155,185,155,199,233,249,229,239,235,235,239,\r\n    242,229,225,110,128, 49,114,239,242,229,225,110,128, 49, 66,240,\r\n    225,242,229,238,235,239,242,229,225,110,128, 50,  5,243,233,239,\r\n    115,  2,155,230,156,  2,107,  2,155,236,155,250,233,249,229,239,\r\n    235,235,239,242,229,225,110,128, 49,116,239,242,229,225,110,128,\r\n     49, 68,244,233,235,229,245,244,235,239,242,229,225,110,128, 49,\r\n    117,116,  2,156, 23,156, 38,232,233,229,245,244,232,235,239,242,\r\n    229,225,110,128, 49,119,233,235,229,245,244,235,239,242,229,225,\r\n    110,128, 49,115,232,233,242,225,231,225,238, 97,128, 48,116,235,\r\n    225,244,225,235,225,238, 97,128, 48,212,243,249,237,226,239,236,\r\n    231,242,229,229,107,128,  3,214,247,242,225,242,237,229,238,233,\r\n    225,110,128,  5,131,236,245,115,132,  0, 43,156,115,156,126,156,\r\n    135,156,168,226,229,236,239,247,227,237, 98,128,  3, 31,227,233,\r\n    242,227,236,101,128, 34,149,109,  2,156,141,156,148,233,238,245,\r\n    115,128,  0,177,111,  2,156,154,156,158,100,128,  2,214,238,239,\r\n    243,240,225,227,101,128,255, 11,115,  2,156,174,156,181,237,225,\r\n    236,108,128,254, 98,245,240,229,242,233,239,114,128, 32,122,109,\r\n      2,156,197,156,208,239,238,239,243,240,225,227,101,128,255, 80,\r\n    243,241,245,225,242,101,128, 51,216,111,  5,156,229,156,240,157,\r\n     51,157, 62,157, 72,232,233,242,225,231,225,238, 97,128, 48,125,\r\n    233,238,244,233,238,231,233,238,228,229,120,  4,157,  4,157, 16,\r\n    157, 28,157, 41,228,239,247,238,247,232,233,244,101,128, 38, 31,\r\n    236,229,230,244,247,232,233,244,101,128, 38, 28,242,233,231,232,\r\n    244,247,232,233,244,101,128, 38, 30,245,240,247,232,233,244,101,\r\n    128, 38, 29,235,225,244,225,235,225,238, 97,128, 48,221,240,236,\r\n    225,244,232,225,105,128, 14, 27,243,244,225,236,237,225,242,107,\r\n    129, 48, 18,157, 85,230,225,227,101,128, 48, 32,240,225,242,229,\r\n    110,128, 36,171,114,  3,157,108,157,134,157,159,101,  2,157,114,\r\n    157,122,227,229,228,229,115,128, 34,122,243,227,242,233,240,244,\r\n    233,239,110,128, 33, 30,233,237,101,  2,157,142,157,148,237,239,\r\n    100,128,  2,185,242,229,246,229,242,243,229,100,128, 32, 53,111,\r\n      4,157,169,157,176,157,186,157,199,228,245,227,116,128, 34, 15,\r\n    234,229,227,244,233,246,101,128, 35,  5,236,239,238,231,229,228,\r\n    235,225,238, 97,128, 48,252,112,  2,157,205,157,242,101,  2,157,\r\n    211,157,218,236,236,239,114,128, 35, 24,242,243,117,  2,157,226,\r\n    157,233,226,243,229,116,128, 34,130,240,229,242,243,229,116,128,\r\n     34,131,239,242,244,233,239,110,129, 34, 55,157,253,225,108,128,\r\n     34, 29,115,  2,158,  8,158, 51,105,130,  3,200,158, 16,158, 27,\r\n    227,249,242,233,236,236,233, 99,128,  4,113,236,233,240,238,229,\r\n    245,237,225,244,225,227,249,242,233,236,236,233,227,227,237, 98,\r\n    128,  4,134,243,241,245,225,242,101,128, 51,176,117,  2,158, 66,\r\n    158, 77,232,233,242,225,231,225,238, 97,128, 48,119,235,225,244,\r\n    225,235,225,238, 97,128, 48,215,246,243,241,245,225,242,101,128,\r\n     51,180,247,243,241,245,225,242,101,128, 51,186,113,136,  0,113,\r\n    158,128,159,177,159,188,159,197,159,204,159,216,159,254,160,  6,\r\n     97,  4,158,138,158,161,158,225,159,160,100,  2,158,144,158,150,\r\n    229,246, 97,128,  9, 88,237,225,232,229,226,242,229,119,128,  5,\r\n    168,102,  4,158,171,158,180,158,194,158,210,225,242,225,226,233,\r\n     99,128,  6, 66,230,233,238,225,236,225,242,225,226,233, 99,128,\r\n    254,214,233,238,233,244,233,225,236,225,242,225,226,233, 99,128,\r\n    254,215,237,229,228,233,225,236,225,242,225,226,233, 99,128,254,\r\n    216,237,225,244,115,136,  5,184,158,248,159, 12,159, 26,159, 31,\r\n    159, 36,159, 45,159, 60,159,147, 49,  3,159,  0,159,  4,159,  8,\r\n     48,128,  5,184, 97,128,  5,184, 99,128,  5,184, 50,  2,159, 18,\r\n    159, 22, 55,128,  5,184, 57,128,  5,184,179, 51,128,  5,184,228,\r\n    101,128,  5,184,232,229,226,242,229,119,128,  5,184,238,225,242,\r\n    242,239,247,232,229,226,242,229,119,128,  5,184,113,  2,159, 66,\r\n    159,132,225,244,225,110,  4,159, 79,159, 88,159,103,159,119,232,\r\n    229,226,242,229,119,128,  5,184,238,225,242,242,239,247,232,229,\r\n    226,242,229,119,128,  5,184,241,245,225,242,244,229,242,232,229,\r\n    226,242,229,119,128,  5,184,247,233,228,229,232,229,226,242,229,\r\n    119,128,  5,184,245,225,242,244,229,242,232,229,226,242,229,119,\r\n    128,  5,184,247,233,228,229,232,229,226,242,229,119,128,  5,184,\r\n    242,238,229,249,240,225,242,225,232,229,226,242,229,119,128,  5,\r\n    159,226,239,240,239,237,239,230,111,128, 49, 17,227,233,242,227,\r\n    236,101,128, 36,224,232,239,239,107,128,  2,160,237,239,238,239,\r\n    243,240,225,227,101,128,255, 81,239,102,130,  5,231,159,225,159,\r\n    245,228,225,231,229,243,104,129,251, 71,159,236,232,229,226,242,\r\n    229,119,128,251, 71,232,229,226,242,229,119,128,  5,231,240,225,\r\n    242,229,110,128, 36,172,117,  4,160, 16,160, 28,160,117,160,204,\r\n    225,242,244,229,242,238,239,244,101,128, 38,105,226,245,244,115,\r\n    135,  5,187,160, 49,160, 54,160, 59,160, 64,160, 73,160, 88,160,\r\n    104,177, 56,128,  5,187,178, 53,128,  5,187,179, 49,128,  5,187,\r\n    232,229,226,242,229,119,128,  5,187,238,225,242,242,239,247,232,\r\n    229,226,242,229,119,128,  5,187,241,245,225,242,244,229,242,232,\r\n    229,226,242,229,119,128,  5,187,247,233,228,229,232,229,226,242,\r\n    229,119,128,  5,187,229,243,244,233,239,110,133,  0, 63,160,136,\r\n    160,159,160,176,160,184,160,196,225,114,  2,160,143,160,150,225,\r\n    226,233, 99,128,  6, 31,237,229,238,233,225,110,128,  5, 94,228,\r\n    239,247,110,129,  0,191,160,168,243,237,225,236,108,128,247,191,\r\n    231,242,229,229,107,128,  3,126,237,239,238,239,243,240,225,227,\r\n    101,128,255, 31,243,237,225,236,108,128,247, 63,239,244,101,  4,\r\n    160,216,161, 31,161, 51,161, 80,228,226,108,133,  0, 34,160,232,\r\n    160,239,160,246,161,  2,161, 23,226,225,243,101,128, 32, 30,236,\r\n    229,230,116,128, 32, 28,237,239,238,239,243,240,225,227,101,128,\r\n    255,  2,240,242,233,237,101,129, 48, 30,161, 12,242,229,246,229,\r\n    242,243,229,100,128, 48, 29,242,233,231,232,116,128, 32, 29,236,\r\n    229,230,116,129, 32, 24,161, 40,242,229,246,229,242,243,229,100,\r\n    128, 32, 27,114,  2,161, 57,161, 67,229,246,229,242,243,229,100,\r\n    128, 32, 27,233,231,232,116,129, 32, 25,161, 76,110,128,  1, 73,\r\n    243,233,238,231,108,  2,161, 90,161, 97,226,225,243,101,128, 32,\r\n     26,101,129,  0, 39,161,103,237,239,238,239,243,240,225,227,101,\r\n    128,255,  7,114,145,  0,114,161,153,162,157,162,168,162,215,163,\r\n     10,164, 27,164, 51,164,146,166,180,166,217,166,229,167, 27,167,\r\n     35,167,197,167,208,167,243,168, 87, 97, 11,161,177,161,188,161,\r\n    198,161,205,162, 14,162, 30,162, 55,162, 66,162, 91,162,114,162,\r\n    151,225,242,237,229,238,233,225,110,128,  5,124,226,229,238,231,\r\n    225,236,105,128,  9,176,227,245,244,101,128,  1, 85,100,  4,161,\r\n    215,161,221,161,235,162,  5,229,246, 97,128,  9, 48,233,227,225,\r\n    108,129, 34, 26,161,230,229,120,128,248,229,239,246,229,242,243,\r\n    243,241,245,225,242,101,129, 51,174,161,251,228,243,241,245,225,\r\n    242,101,128, 51,175,243,241,245,225,242,101,128, 51,173,230,101,\r\n    129,  5,191,162, 21,232,229,226,242,229,119,128,  5,191,231,117,\r\n      2,162, 37,162, 46,234,225,242,225,244,105,128, 10,176,242,237,\r\n    245,235,232,105,128, 10, 48,232,233,242,225,231,225,238, 97,128,\r\n     48,137,235,225,244,225,235,225,238, 97,129, 48,233,162, 79,232,\r\n    225,236,230,247,233,228,244,104,128,255,151,236,239,247,229,242,\r\n    228,233,225,231,239,238,225,236,226,229,238,231,225,236,105,128,\r\n      9,241,109,  2,162,120,162,143,233,228,228,236,229,228,233,225,\r\n    231,239,238,225,236,226,229,238,231,225,236,105,128,  9,240,243,\r\n    232,239,242,110,128,  2,100,244,233,111,128, 34, 54,226,239,240,\r\n    239,237,239,230,111,128, 49, 22, 99,  4,162,178,162,185,162,194,\r\n    162,202,225,242,239,110,128,  1, 89,229,228,233,236,236, 97,128,\r\n      1, 87,233,242,227,236,101,128, 36,225,239,237,237,225,225,227,\r\n    227,229,238,116,128,  1, 87,100,  2,162,221,162,231,226,236,231,\r\n    242,225,246,101,128,  2, 17,239,116,  2,162,238,162,247,225,227,\r\n    227,229,238,116,128, 30, 89,226,229,236,239,119,129, 30, 91,163,\r\n      1,237,225,227,242,239,110,128, 30, 93,101,  6,163, 24,163, 69,\r\n    163,104,163,159,163,184,163,217,102,  2,163, 30,163, 43,229,242,\r\n    229,238,227,229,237,225,242,107,128, 32, 59,236,229,248,243,117,\r\n      2,163, 53,163, 60,226,243,229,116,128, 34,134,240,229,242,243,\r\n    229,116,128, 34,135,231,233,243,244,229,114,  2,163, 80,163, 85,\r\n    229,100,128,  0,174,115,  2,163, 91,163, 97,225,238,115,128,248,\r\n    232,229,242,233,102,128,246,218,104,  3,163,112,163,135,163,149,\r\n    225,114,  2,163,119,163,126,225,226,233, 99,128,  6, 49,237,229,\r\n    238,233,225,110,128,  5,128,230,233,238,225,236,225,242,225,226,\r\n    233, 99,128,254,174,233,242,225,231,225,238, 97,128, 48,140,235,\r\n    225,244,225,235,225,238, 97,129, 48,236,163,172,232,225,236,230,\r\n    247,233,228,244,104,128,255,154,243,104,130,  5,232,163,193,163,\r\n    208,228,225,231,229,243,232,232,229,226,242,229,119,128,251, 72,\r\n    232,229,226,242,229,119,128,  5,232,118,  3,163,225,163,238,164,\r\n     14,229,242,243,229,228,244,233,236,228,101,128, 34, 61,233, 97,\r\n      2,163,245,163,254,232,229,226,242,229,119,128,  5,151,237,245,\r\n    231,242,225,243,232,232,229,226,242,229,119,128,  5,151,236,239,\r\n    231,233,227,225,236,238,239,116,128, 35, 16,230,233,243,232,232,\r\n    239,239,107,129,  2,126,164, 40,242,229,246,229,242,243,229,100,\r\n    128,  2,127,104,  2,164, 57,164, 80, 97,  2,164, 63,164, 73,226,\r\n    229,238,231,225,236,105,128,  9,221,228,229,246, 97,128,  9, 93,\r\n    111,131,  3,193,164, 90,164,119,164,133,239,107,129,  2,125,164,\r\n     97,244,245,242,238,229,100,129,  2,123,164,108,243,245,240,229,\r\n    242,233,239,114,128,  2,181,243,249,237,226,239,236,231,242,229,\r\n    229,107,128,  3,241,244,233,227,232,239,239,235,237,239,100,128,\r\n      2,222,105,  6,164,160,165,204,165,250,166,  5,166, 30,166,166,\r\n    229,245,108,  9,164,182,164,217,164,232,164,246,165, 36,165, 50,\r\n    165,136,165,149,165,184, 97,  2,164,188,164,203,227,233,242,227,\r\n    236,229,235,239,242,229,225,110,128, 50,113,240,225,242,229,238,\r\n    235,239,242,229,225,110,128, 50, 17,227,233,242,227,236,229,235,\r\n    239,242,229,225,110,128, 50, 99,232,233,229,245,232,235,239,242,\r\n    229,225,110,128, 49, 64,107,  2,164,252,165, 28,233,249,229,239,\r\n    107,  2,165,  6,165, 15,235,239,242,229,225,110,128, 49, 58,243,\r\n    233,239,243,235,239,242,229,225,110,128, 49,105,239,242,229,225,\r\n    110,128, 49, 57,237,233,229,245,237,235,239,242,229,225,110,128,\r\n     49, 59,112,  3,165, 58,165, 90,165,105, 97,  2,165, 64,165, 78,\r\n    238,243,233,239,243,235,239,242,229,225,110,128, 49,108,242,229,\r\n    238,235,239,242,229,225,110,128, 50,  3,232,233,229,245,240,232,\r\n    235,239,242,229,225,110,128, 49, 63,233,229,245,112,  2,165,114,\r\n    165,123,235,239,242,229,225,110,128, 49, 60,243,233,239,243,235,\r\n    239,242,229,225,110,128, 49,107,243,233,239,243,235,239,242,229,\r\n    225,110,128, 49, 61,116,  2,165,155,165,170,232,233,229,245,244,\r\n    232,235,239,242,229,225,110,128, 49, 62,233,235,229,245,244,235,\r\n    239,242,229,225,110,128, 49,106,249,229,239,242,233,238,232,233,\r\n    229,245,232,235,239,242,229,225,110,128, 49,109,231,232,116,  2,\r\n    165,212,165,220,225,238,231,236,101,128, 34, 31,116,  2,165,226,\r\n    165,240,225,227,235,226,229,236,239,247,227,237, 98,128,  3, 25,\r\n    242,233,225,238,231,236,101,128, 34,191,232,233,242,225,231,225,\r\n    238, 97,128, 48,138,235,225,244,225,235,225,238, 97,129, 48,234,\r\n    166, 18,232,225,236,230,247,233,228,244,104,128,255,152,110,  2,\r\n    166, 36,166,152,103,131,  2,218,166, 46,166, 57,166, 63,226,229,\r\n    236,239,247,227,237, 98,128,  3, 37,227,237, 98,128,  3, 10,232,\r\n    225,236,102,  2,166, 72,166,118,236,229,230,116,131,  2,191,166,\r\n     85,166, 96,166,107,225,242,237,229,238,233,225,110,128,  5, 89,\r\n    226,229,236,239,247,227,237, 98,128,  3, 28,227,229,238,244,229,\r\n    242,229,100,128,  2,211,242,233,231,232,116,130,  2,190,166,130,\r\n    166,141,226,229,236,239,247,227,237, 98,128,  3, 57,227,229,238,\r\n    244,229,242,229,100,128,  2,210,246,229,242,244,229,228,226,242,\r\n    229,246,101,128,  2, 19,244,244,239,242,245,243,241,245,225,242,\r\n    101,128, 51, 81,108,  2,166,186,166,197,233,238,229,226,229,236,\r\n    239,119,128, 30, 95,239,238,231,236,229,103,129,  2,124,166,208,\r\n    244,245,242,238,229,100,128,  2,122,237,239,238,239,243,240,225,\r\n    227,101,128,255, 82,111,  3,166,237,166,248,167, 17,232,233,242,\r\n    225,231,225,238, 97,128, 48,141,235,225,244,225,235,225,238, 97,\r\n    129, 48,237,167,  5,232,225,236,230,247,233,228,244,104,128,255,\r\n    155,242,245,225,244,232,225,105,128, 14, 35,240,225,242,229,110,\r\n    128, 36,173,114,  3,167, 43,167, 79,167,109, 97,  3,167, 51,167,\r\n     61,167, 68,226,229,238,231,225,236,105,128,  9,220,228,229,246,\r\n     97,128,  9, 49,231,245,242,237,245,235,232,105,128, 10, 92,229,\r\n    104,  2,167, 86,167, 95,225,242,225,226,233, 99,128,  6,145,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,251,141,246,239,227,\r\n    225,236,233, 99,  4,167,125,167,135,167,142,167,153,226,229,238,\r\n    231,225,236,105,128,  9,224,228,229,246, 97,128,  9, 96,231,245,\r\n    234,225,242,225,244,105,128, 10,224,246,239,247,229,236,243,233,\r\n    231,110,  3,167,169,167,179,167,186,226,229,238,231,225,236,105,\r\n    128,  9,196,228,229,246, 97,128,  9, 68,231,245,234,225,242,225,\r\n    244,105,128, 10,196,243,245,240,229,242,233,239,114,128,246,241,\r\n    116,  2,167,214,167,222,226,236,239,227,107,128, 37,144,245,242,\r\n    238,229,100,129,  2,121,167,232,243,245,240,229,242,233,239,114,\r\n    128,  2,180,117,  4,167,253,168,  8,168, 33,168, 80,232,233,242,\r\n    225,231,225,238, 97,128, 48,139,235,225,244,225,235,225,238, 97,\r\n    129, 48,235,168, 21,232,225,236,230,247,233,228,244,104,128,255,\r\n    153,112,  2,168, 39,168, 74,229,101,  2,168, 46,168, 60,237,225,\r\n    242,235,226,229,238,231,225,236,105,128,  9,242,243,233,231,238,\r\n    226,229,238,231,225,236,105,128,  9,243,233,225,104,128,246,221,\r\n    244,232,225,105,128, 14, 36,246,239,227,225,236,233, 99,  4,168,\r\n    103,168,113,168,120,168,131,226,229,238,231,225,236,105,128,  9,\r\n    139,228,229,246, 97,128,  9, 11,231,245,234,225,242,225,244,105,\r\n    128, 10,139,246,239,247,229,236,243,233,231,110,  3,168,147,168,\r\n    157,168,164,226,229,238,231,225,236,105,128,  9,195,228,229,246,\r\n     97,128,  9, 67,231,245,234,225,242,225,244,105,128, 10,195,115,\r\n    147,  0,115,168,217,170,187,170,198,171, 68,171,107,174, 49,174,\r\n     60,176,203,179, 85,179,131,179,158,180, 93,180,160,181,193,181,\r\n    203,182,133,182,206,183,120,183,130, 97,  9,168,237,168,247,169,\r\n     12,169, 84,169,109,169,120,169,145,169,177,169,217,226,229,238,\r\n    231,225,236,105,128,  9,184,227,245,244,101,129,  1, 91,169,  0,\r\n    228,239,244,225,227,227,229,238,116,128, 30,101,100,  5,169, 24,\r\n    169, 33,169, 39,169, 53,169, 69,225,242,225,226,233, 99,128,  6,\r\n     53,229,246, 97,128,  9, 56,230,233,238,225,236,225,242,225,226,\r\n    233, 99,128,254,186,233,238,233,244,233,225,236,225,242,225,226,\r\n    233, 99,128,254,187,237,229,228,233,225,236,225,242,225,226,233,\r\n     99,128,254,188,231,117,  2,169, 91,169,100,234,225,242,225,244,\r\n    105,128, 10,184,242,237,245,235,232,105,128, 10, 56,232,233,242,\r\n    225,231,225,238, 97,128, 48, 85,235,225,244,225,235,225,238, 97,\r\n    129, 48,181,169,133,232,225,236,230,247,233,228,244,104,128,255,\r\n    123,236,236,225,236,236,225,232,239,245,225,236,225,249,232,229,\r\n    247,225,243,225,236,236,225,237,225,242,225,226,233, 99,128,253,\r\n    250,237,229,235,104,130,  5,225,169,188,169,208,228,225,231,229,\r\n    243,104,129,251, 65,169,199,232,229,226,242,229,119,128,251, 65,\r\n    232,229,226,242,229,119,128,  5,225,242, 97,  5,169,230,170, 48,\r\n    170, 56,170,106,170,114, 97,  5,169,242,169,250,170,  2,170, 33,\r\n    170, 41,225,244,232,225,105,128, 14, 50,229,244,232,225,105,128,\r\n     14, 65,233,237,225,233,109,  2,170, 12,170, 23,225,236,225,233,\r\n    244,232,225,105,128, 14, 68,245,225,238,244,232,225,105,128, 14,\r\n     67,237,244,232,225,105,128, 14, 51,244,232,225,105,128, 14, 48,\r\n    229,244,232,225,105,128, 14, 64,105,  3,170, 64,170, 88,170, 99,\r\n    105,  2,170, 70,170, 81,236,229,230,244,244,232,225,105,128,248,\r\n    134,244,232,225,105,128, 14, 53,236,229,230,244,244,232,225,105,\r\n    128,248,133,244,232,225,105,128, 14, 52,239,244,232,225,105,128,\r\n     14, 66,117,  3,170,122,170,172,170,179,101,  3,170,130,170,154,\r\n    170,165,101,  2,170,136,170,147,236,229,230,244,244,232,225,105,\r\n    128,248,136,244,232,225,105,128, 14, 55,236,229,230,244,244,232,\r\n    225,105,128,248,135,244,232,225,105,128, 14, 54,244,232,225,105,\r\n    128, 14, 56,245,244,232,225,105,128, 14, 57,226,239,240,239,237,\r\n    239,230,111,128, 49, 25, 99,  5,170,210,170,231,170,240,171, 33,\r\n    171, 55,225,242,239,110,129,  1, 97,170,219,228,239,244,225,227,\r\n    227,229,238,116,128, 30,103,229,228,233,236,236, 97,128,  1, 95,\r\n    232,247, 97,131,  2, 89,170,252,171,  7,171, 26,227,249,242,233,\r\n    236,236,233, 99,128,  4,217,228,233,229,242,229,243,233,243,227,\r\n    249,242,233,236,236,233, 99,128,  4,219,232,239,239,107,128,  2,\r\n     90,233,242, 99,  2,171, 41,171, 46,236,101,128, 36,226,245,237,\r\n    230,236,229,120,128,  1, 93,239,237,237,225,225,227,227,229,238,\r\n    116,128,  2, 25,228,239,116,  2,171, 76,171, 85,225,227,227,229,\r\n    238,116,128, 30, 97,226,229,236,239,119,129, 30, 99,171, 95,228,\r\n    239,244,225,227,227,229,238,116,128, 30,105,101,  9,171,127,171,\r\n    143,171,178,171,243,172, 90,172,117,172,142,172,223,172,250,225,\r\n    231,245,236,236,226,229,236,239,247,227,237, 98,128,  3, 60, 99,\r\n      2,171,149,171,171,239,238,100,129, 32, 51,171,157,244,239,238,\r\n    229,227,232,233,238,229,243,101,128,  2,202,244,233,239,110,128,\r\n      0,167,229,110,  4,171,189,171,198,171,212,171,228,225,242,225,\r\n    226,233, 99,128,  6, 51,230,233,238,225,236,225,242,225,226,233,\r\n     99,128,254,178,233,238,233,244,233,225,236,225,242,225,226,233,\r\n     99,128,254,179,237,229,228,233,225,236,225,242,225,226,233, 99,\r\n    128,254,180,231,239,108,135,  5,182,172,  7,172, 21,172, 26,172,\r\n     35,172, 50,172, 66,172, 77, 49,  2,172, 13,172, 17, 51,128,  5,\r\n    182,102,128,  5,182,178, 99,128,  5,182,232,229,226,242,229,119,\r\n    128,  5,182,238,225,242,242,239,247,232,229,226,242,229,119,128,\r\n      5,182,241,245,225,242,244,229,242,232,229,226,242,229,119,128,\r\n      5,182,244,225,232,229,226,242,229,119,128,  5,146,247,233,228,\r\n    229,232,229,226,242,229,119,128,  5,182,104,  2,172, 96,172,107,\r\n    225,242,237,229,238,233,225,110,128,  5,125,233,242,225,231,225,\r\n    238, 97,128, 48, 91,235,225,244,225,235,225,238, 97,129, 48,187,\r\n    172,130,232,225,236,230,247,233,228,244,104,128,255,126,237,105,\r\n      2,172,149,172,192,227,239,236,239,110,131,  0, 59,172,163,172,\r\n    172,172,184,225,242,225,226,233, 99,128,  6, 27,237,239,238,239,\r\n    243,240,225,227,101,128,255, 27,243,237,225,236,108,128,254, 84,\r\n    246,239,233,227,229,228,237,225,242,235,235,225,238, 97,129, 48,\r\n    156,172,211,232,225,236,230,247,233,228,244,104,128,255,159,238,\r\n    116,  2,172,230,172,240,233,243,241,245,225,242,101,128, 51, 34,\r\n    239,243,241,245,225,242,101,128, 51, 35,246,229,110,142,  0, 55,\r\n    173, 28,173, 37,173, 47,173, 77,173, 84,173, 94,173,119,173,146,\r\n    173,180,173,192,173,203,173,236,173,244,173,255,225,242,225,226,\r\n    233, 99,128,  6,103,226,229,238,231,225,236,105,128,  9,237,227,\r\n    233,242,227,236,101,129, 36,102,173, 58,233,238,246,229,242,243,\r\n    229,243,225,238,243,243,229,242,233,102,128, 39,144,228,229,246,\r\n     97,128,  9,109,229,233,231,232,244,232,115,128, 33, 94,231,117,\r\n      2,173,101,173,110,234,225,242,225,244,105,128, 10,237,242,237,\r\n    245,235,232,105,128, 10,109,232, 97,  2,173,126,173,137,227,235,\r\n    225,242,225,226,233, 99,128,  6,103,238,231,250,232,239,117,128,\r\n     48, 39,105,  2,173,152,173,170,228,229,239,231,242,225,240,232,\r\n    233,227,240,225,242,229,110,128, 50, 38,238,230,229,242,233,239,\r\n    114,128, 32,135,237,239,238,239,243,240,225,227,101,128,255, 23,\r\n    239,236,228,243,244,249,236,101,128,247, 55,112,  2,173,209,173,\r\n    216,225,242,229,110,128, 36,122,229,114,  2,173,223,173,229,233,\r\n    239,100,128, 36,142,243,233,225,110,128,  6,247,242,239,237,225,\r\n    110,128, 33,118,243,245,240,229,242,233,239,114,128, 32,119,116,\r\n      2,174,  5,174, 43,229,229,110,  2,174, 13,174, 22,227,233,242,\r\n    227,236,101,128, 36,112,112,  2,174, 28,174, 35,225,242,229,110,\r\n    128, 36,132,229,242,233,239,100,128, 36,152,232,225,105,128, 14,\r\n     87,230,244,232,249,240,232,229,110,128,  0,173,104,  7,174, 76,\r\n    175, 50,175, 61,175, 75,176, 20,176, 33,176,197, 97,  6,174, 90,\r\n    174,101,174,111,174,122,175,  9,175, 34,225,242,237,229,238,233,\r\n    225,110,128,  5,119,226,229,238,231,225,236,105,128,  9,182,227,\r\n    249,242,233,236,236,233, 99,128,  4, 72,100,  2,174,128,174,224,\r\n    228, 97,  4,174,139,174,148,174,179,174,193,225,242,225,226,233,\r\n     99,128,  6, 81,228,225,237,237, 97,  2,174,158,174,167,225,242,\r\n    225,226,233, 99,128,252, 97,244,225,238,225,242,225,226,233, 99,\r\n    128,252, 94,230,225,244,232,225,225,242,225,226,233, 99,128,252,\r\n     96,235,225,243,242, 97,  2,174,203,174,212,225,242,225,226,233,\r\n     99,128,252, 98,244,225,238,225,242,225,226,233, 99,128,252, 95,\r\n    101,132, 37,146,174,236,174,243,174,251,175,  4,228,225,242,107,\r\n    128, 37,147,236,233,231,232,116,128, 37,145,237,229,228,233,245,\r\n    109,128, 37,146,246, 97,128,  9, 54,231,117,  2,175, 16,175, 25,\r\n    234,225,242,225,244,105,128, 10,182,242,237,245,235,232,105,128,\r\n     10, 54,236,243,232,229,236,229,244,232,229,226,242,229,119,128,\r\n      5,147,226,239,240,239,237,239,230,111,128, 49, 21,227,232,225,\r\n    227,249,242,233,236,236,233, 99,128,  4, 73,101,  4,175, 85,175,\r\n    150,175,160,175,177,229,110,  4,175, 96,175,105,175,119,175,135,\r\n    225,242,225,226,233, 99,128,  6, 52,230,233,238,225,236,225,242,\r\n    225,226,233, 99,128,254,182,233,238,233,244,233,225,236,225,242,\r\n    225,226,233, 99,128,254,183,237,229,228,233,225,236,225,242,225,\r\n    226,233, 99,128,254,184,233,227,239,240,244,233, 99,128,  3,227,\r\n    241,229,108,129, 32,170,175,168,232,229,226,242,229,119,128, 32,\r\n    170,246, 97,134,  5,176,175,194,175,209,175,223,175,232,175,247,\r\n    176,  7, 49,  2,175,200,175,205,177, 53,128,  5,176, 53,128,  5,\r\n    176, 50,  2,175,215,175,219, 50,128,  5,176,101,128,  5,176,232,\r\n    229,226,242,229,119,128,  5,176,238,225,242,242,239,247,232,229,\r\n    226,242,229,119,128,  5,176,241,245,225,242,244,229,242,232,229,\r\n    226,242,229,119,128,  5,176,247,233,228,229,232,229,226,242,229,\r\n    119,128,  5,176,232,225,227,249,242,233,236,236,233, 99,128,  4,\r\n    187,105,  2,176, 39,176, 50,237,225,227,239,240,244,233, 99,128,\r\n      3,237,110,131,  5,233,176, 60,176,143,176,152,100,  2,176, 66,\r\n    176,132,225,231,229,243,104,130,251, 73,176, 78,176, 87,232,229,\r\n    226,242,229,119,128,251, 73,115,  2,176, 93,176,113,232,233,238,\r\n    228,239,116,129,251, 44,176,104,232,229,226,242,229,119,128,251,\r\n     44,233,238,228,239,116,129,251, 45,176,123,232,229,226,242,229,\r\n    119,128,251, 45,239,244,232,229,226,242,229,119,128,  5,193,232,\r\n    229,226,242,229,119,128,  5,233,115,  2,176,158,176,178,232,233,\r\n    238,228,239,116,129,251, 42,176,169,232,229,226,242,229,119,128,\r\n    251, 42,233,238,228,239,116,129,251, 43,176,188,232,229,226,242,\r\n    229,119,128,251, 43,239,239,107,128,  2,130,105,  8,176,221,177,\r\n      9,177, 20,177, 45,177, 75,177, 83,177, 96,178, 11,231,237, 97,\r\n    131,  3,195,176,233,176,237,176,245, 49,128,  3,194,230,233,238,\r\n    225,108,128,  3,194,236,245,238,225,244,229,243,249,237,226,239,\r\n    236,231,242,229,229,107,128,  3,242,232,233,242,225,231,225,238,\r\n     97,128, 48, 87,235,225,244,225,235,225,238, 97,129, 48,183,177,\r\n     33,232,225,236,230,247,233,228,244,104,128,255,124,236,245,113,\r\n      2,177, 53,177, 62,232,229,226,242,229,119,128,  5,189,236,229,\r\n    230,244,232,229,226,242,229,119,128,  5,189,237,233,236,225,114,\r\n    128, 34, 60,238,228,239,244,232,229,226,242,229,119,128,  5,194,\r\n    239,115,  6,177,111,177,146,177,178,177,206,177,220,177,252, 97,\r\n      2,177,117,177,132,227,233,242,227,236,229,235,239,242,229,225,\r\n    110,128, 50,116,240,225,242,229,238,235,239,242,229,225,110,128,\r\n     50, 20,227,105,  2,177,153,177,165,229,245,227,235,239,242,229,\r\n    225,110,128, 49,126,242,227,236,229,235,239,242,229,225,110,128,\r\n     50,102,107,  2,177,184,177,198,233,249,229,239,235,235,239,242,\r\n    229,225,110,128, 49,122,239,242,229,225,110,128, 49, 69,238,233,\r\n    229,245,238,235,239,242,229,225,110,128, 49,123,112,  2,177,226,\r\n    177,239,225,242,229,238,235,239,242,229,225,110,128, 50,  6,233,\r\n    229,245,240,235,239,242,229,225,110,128, 49,125,244,233,235,229,\r\n    245,244,235,239,242,229,225,110,128, 49,124,120,141,  0, 54,178,\r\n     41,178, 50,178, 60,178, 90,178, 97,178,122,178,149,178,183,178,\r\n    195,178,206,178,239,178,247,179,  2,225,242,225,226,233, 99,128,\r\n      6,102,226,229,238,231,225,236,105,128,  9,236,227,233,242,227,\r\n    236,101,129, 36,101,178, 71,233,238,246,229,242,243,229,243,225,\r\n    238,243,243,229,242,233,102,128, 39,143,228,229,246, 97,128,  9,\r\n    108,231,117,  2,178,104,178,113,234,225,242,225,244,105,128, 10,\r\n    236,242,237,245,235,232,105,128, 10,108,232, 97,  2,178,129,178,\r\n    140,227,235,225,242,225,226,233, 99,128,  6,102,238,231,250,232,\r\n    239,117,128, 48, 38,105,  2,178,155,178,173,228,229,239,231,242,\r\n    225,240,232,233,227,240,225,242,229,110,128, 50, 37,238,230,229,\r\n    242,233,239,114,128, 32,134,237,239,238,239,243,240,225,227,101,\r\n    128,255, 22,239,236,228,243,244,249,236,101,128,247, 54,112,  2,\r\n    178,212,178,219,225,242,229,110,128, 36,121,229,114,  2,178,226,\r\n    178,232,233,239,100,128, 36,141,243,233,225,110,128,  6,246,242,\r\n    239,237,225,110,128, 33,117,243,245,240,229,242,233,239,114,128,\r\n     32,118,116,  2,179,  8,179, 79,229,229,110,  2,179, 16,179, 58,\r\n     99,  2,179, 22,179, 30,233,242,227,236,101,128, 36,111,245,242,\r\n    242,229,238,227,249,228,229,238,239,237,233,238,225,244,239,242,\r\n    226,229,238,231,225,236,105,128,  9,249,112,  2,179, 64,179, 71,\r\n    225,242,229,110,128, 36,131,229,242,233,239,100,128, 36,151,232,\r\n    225,105,128, 14, 86,108,  2,179, 91,179,111,225,243,104,129,  0,\r\n     47,179, 99,237,239,238,239,243,240,225,227,101,128,255, 15,239,\r\n    238,103,129,  1,127,179,119,228,239,244,225,227,227,229,238,116,\r\n    128, 30,155,109,  2,179,137,179,147,233,236,229,230,225,227,101,\r\n    128, 38, 58,239,238,239,243,240,225,227,101,128,255, 83,111,  6,\r\n    179,172,179,222,179,233,180,  2,180, 47,180, 58,102,  2,179,178,\r\n    179,192,240,225,243,245,241,232,229,226,242,229,119,128,  5,195,\r\n    116,  2,179,198,179,207,232,249,240,232,229,110,128,  0,173,243,\r\n    233,231,238,227,249,242,233,236,236,233, 99,128,  4, 76,232,233,\r\n    242,225,231,225,238, 97,128, 48, 93,235,225,244,225,235,225,238,\r\n     97,129, 48,189,179,246,232,225,236,230,247,233,228,244,104,128,\r\n    255,127,236,233,228,245,115,  2,180, 12,180, 29,236,239,238,231,\r\n    239,246,229,242,236,225,249,227,237, 98,128,  3, 56,243,232,239,\r\n    242,244,239,246,229,242,236,225,249,227,237, 98,128,  3, 55,242,\r\n    245,243,233,244,232,225,105,128, 14, 41,115,  3,180, 66,180, 76,\r\n    180, 84,225,236,225,244,232,225,105,128, 14, 40,239,244,232,225,\r\n    105,128, 14, 11,245,225,244,232,225,105,128, 14, 42,240, 97,  3,\r\n    180,102,180,122,180,154,227,101,129,  0, 32,180,109,232,225,227,\r\n    235,225,242,225,226,233, 99,128,  0, 32,228,101,129, 38, 96,180,\r\n    129,243,245,233,116,  2,180,138,180,146,226,236,225,227,107,128,\r\n     38, 96,247,232,233,244,101,128, 38,100,242,229,110,128, 36,174,\r\n    241,245,225,242,101, 11,180,188,180,199,180,213,180,238,180,255,\r\n    181, 25,181, 40,181, 73,181,100,181,156,181,171,226,229,236,239,\r\n    247,227,237, 98,128,  3, 59, 99,  2,180,205,180,209, 99,128, 51,\r\n    196,109,128, 51,157,228,233,225,231,239,238,225,236,227,242,239,\r\n    243,243,232,225,244,227,232,230,233,236,108,128, 37,169,232,239,\r\n    242,233,250,239,238,244,225,236,230,233,236,108,128, 37,164,107,\r\n      2,181,  5,181,  9,103,128, 51,143,109,129, 51,158,181, 15,227,\r\n    225,240,233,244,225,108,128, 51,206,108,  2,181, 31,181, 35,110,\r\n    128, 51,209,239,103,128, 51,210,109,  4,181, 50,181, 54,181, 59,\r\n    181, 63,103,128, 51,142,233,108,128, 51,213,109,128, 51,156,243,\r\n    241,245,225,242,229,100,128, 51,161,239,242,244,232,239,231,239,\r\n    238,225,236,227,242,239,243,243,232,225,244,227,232,230,233,236,\r\n    108,128, 37,166,245,240,240,229,114,  2,181,110,181,133,236,229,\r\n    230,244,244,239,236,239,247,229,242,242,233,231,232,244,230,233,\r\n    236,108,128, 37,167,242,233,231,232,244,244,239,236,239,247,229,\r\n    242,236,229,230,244,230,233,236,108,128, 37,168,246,229,242,244,\r\n    233,227,225,236,230,233,236,108,128, 37,165,247,232,233,244,229,\r\n    247,233,244,232,243,237,225,236,236,226,236,225,227,107,128, 37,\r\n    163,242,243,241,245,225,242,101,128, 51,219,115,  2,181,209,182,\r\n    123, 97,  4,181,219,181,229,181,236,181,247,226,229,238,231,225,\r\n    236,105,128,  9,183,228,229,246, 97,128,  9, 55,231,245,234,225,\r\n    242,225,244,105,128, 10,183,238,103,  8,182, 10,182, 24,182, 38,\r\n    182, 52,182, 67,182, 81,182, 95,182,108,227,233,229,245,227,235,\r\n    239,242,229,225,110,128, 49, 73,232,233,229,245,232,235,239,242,\r\n    229,225,110,128, 49,133,233,229,245,238,231,235,239,242,229,225,\r\n    110,128, 49,128,235,233,249,229,239,235,235,239,242,229,225,110,\r\n    128, 49, 50,238,233,229,245,238,235,239,242,229,225,110,128, 49,\r\n    101,240,233,229,245,240,235,239,242,229,225,110,128, 49, 67,243,\r\n    233,239,243,235,239,242,229,225,110,128, 49, 70,244,233,235,229,\r\n    245,244,235,239,242,229,225,110,128, 49, 56,245,240,229,242,233,\r\n    239,114,128,246,242,116,  2,182,139,182,162,229,242,236,233,238,\r\n    103,129,  0,163,182,150,237,239,238,239,243,240,225,227,101,128,\r\n    255,225,242,239,235,101,  2,182,171,182,188,236,239,238,231,239,\r\n    246,229,242,236,225,249,227,237, 98,128,  3, 54,243,232,239,242,\r\n    244,239,246,229,242,236,225,249,227,237, 98,128,  3, 53,117,  7,\r\n    182,222,182,254,183, 20,183, 31,183, 72,183, 82,183, 86,226,243,\r\n    229,116,130, 34,130,182,233,182,244,238,239,244,229,241,245,225,\r\n    108,128, 34,138,239,242,229,241,245,225,108,128, 34,134, 99,  2,\r\n    183,  4,183, 12,227,229,229,228,115,128, 34,123,232,244,232,225,\r\n    116,128, 34, 11,232,233,242,225,231,225,238, 97,128, 48, 89,107,\r\n      2,183, 37,183, 61,225,244,225,235,225,238, 97,129, 48,185,183,\r\n     49,232,225,236,230,247,233,228,244,104,128,255,125,245,238,225,\r\n    242,225,226,233, 99,128,  6, 82,237,237,225,244,233,239,110,128,\r\n     34, 17,110,128, 38, 60,240,229,242,243,229,116,130, 34,131,183,\r\n     99,183,110,238,239,244,229,241,245,225,108,128, 34,139,239,242,\r\n    229,241,245,225,108,128, 34,135,246,243,241,245,225,242,101,128,\r\n     51,220,249,239,245,247,225,229,242,225,243,241,245,225,242,101,\r\n    128, 51,124,116,144,  0,116,183,183,184,192,184,213,185,100,185,\r\n    140,187,188,191, 70,192,145,192,157,192,169,193,202,193,227,194,\r\n     57,194,237,195,165,195,255, 97, 10,183,205,183,215,183,236,183,\r\n    243,184, 12,184, 90,184,107,184,132,184,146,184,150,226,229,238,\r\n    231,225,236,105,128,  9,164,227,107,  2,183,222,183,229,228,239,\r\n    247,110,128, 34,164,236,229,230,116,128, 34,163,228,229,246, 97,\r\n    128,  9, 36,231,117,  2,183,250,184,  3,234,225,242,225,244,105,\r\n    128, 10,164,242,237,245,235,232,105,128, 10, 36,104,  4,184, 22,\r\n    184, 31,184, 45,184, 75,225,242,225,226,233, 99,128,  6, 55,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,254,194,105,  2,184,\r\n     51,184, 66,238,233,244,233,225,236,225,242,225,226,233, 99,128,\r\n    254,195,242,225,231,225,238, 97,128, 48, 95,237,229,228,233,225,\r\n    236,225,242,225,226,233, 99,128,254,196,233,243,249,239,245,229,\r\n    242,225,243,241,245,225,242,101,128, 51,125,235,225,244,225,235,\r\n    225,238, 97,129, 48,191,184,120,232,225,236,230,247,233,228,244,\r\n    104,128,255,128,244,247,229,229,236,225,242,225,226,233, 99,128,\r\n      6, 64,117,128,  3,196,118,130,  5,234,184,158,184,183,228,225,\r\n    231,229,115,129,251, 74,184,168,104,129,251, 74,184,174,232,229,\r\n    226,242,229,119,128,251, 74,232,229,226,242,229,119,128,  5,234,\r\n     98,  2,184,198,184,203,225,114,128,  1,103,239,240,239,237,239,\r\n    230,111,128, 49, 10, 99,  6,184,227,184,234,184,241,184,250,185,\r\n     60,185, 87,225,242,239,110,128,  1,101,227,245,242,108,128,  2,\r\n    168,229,228,233,236,236, 97,128,  1, 99,232,229,104,  4,185,  6,\r\n    185, 15,185, 29,185, 45,225,242,225,226,233, 99,128,  6,134,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,251,123,233,238,233,\r\n    244,233,225,236,225,242,225,226,233, 99,128,251,124,237,229,228,\r\n    233,225,236,225,242,225,226,233, 99,128,251,125,233,242, 99,  2,\r\n    185, 68,185, 73,236,101,128, 36,227,245,237,230,236,229,248,226,\r\n    229,236,239,119,128, 30,113,239,237,237,225,225,227,227,229,238,\r\n    116,128,  1, 99,100,  2,185,106,185,116,233,229,242,229,243,233,\r\n    115,128, 30,151,239,116,  2,185,123,185,132,225,227,227,229,238,\r\n    116,128, 30,107,226,229,236,239,119,128, 30,109,101,  9,185,160,\r\n    185,171,185,191,186,201,186,226,187, 34,187,101,187,106,187,158,\r\n    227,249,242,233,236,236,233, 99,128,  4, 66,228,229,243,227,229,\r\n    238,228,229,242,227,249,242,233,236,236,233, 99,128,  4,173,104,\r\n      7,185,207,185,216,185,230,186, 14,186, 44,186, 85,186,183,225,\r\n    242,225,226,233, 99,128,  6, 42,230,233,238,225,236,225,242,225,\r\n    226,233, 99,128,254,150,232,225,232,105,  2,185,239,185,254,238,\r\n    233,244,233,225,236,225,242,225,226,233, 99,128,252,162,243,239,\r\n    236,225,244,229,228,225,242,225,226,233, 99,128,252, 12,105,  2,\r\n    186, 20,186, 35,238,233,244,233,225,236,225,242,225,226,233, 99,\r\n    128,254,151,242,225,231,225,238, 97,128, 48,102,234,229,229,237,\r\n    105,  2,186, 54,186, 69,238,233,244,233,225,236,225,242,225,226,\r\n    233, 99,128,252,161,243,239,236,225,244,229,228,225,242,225,226,\r\n    233, 99,128,252, 11,109,  2,186, 91,186,125,225,242,226,245,244,\r\n     97,  2,186,102,186,111,225,242,225,226,233, 99,128,  6, 41,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,254,148,101,  2,186,\r\n    131,186,144,228,233,225,236,225,242,225,226,233, 99,128,254,152,\r\n    229,237,105,  2,186,152,186,167,238,233,244,233,225,236,225,242,\r\n    225,226,233, 99,128,252,164,243,239,236,225,244,229,228,225,242,\r\n    225,226,233, 99,128,252, 14,238,239,239,238,230,233,238,225,236,\r\n    225,242,225,226,233, 99,128,252,115,235,225,244,225,235,225,238,\r\n     97,129, 48,198,186,214,232,225,236,230,247,233,228,244,104,128,\r\n    255,131,108,  2,186,232,186,251,229,240,232,239,238,101,129, 33,\r\n     33,186,243,226,236,225,227,107,128, 38, 14,233,243,232, 97,  2,\r\n    187,  4,187, 19,231,229,228,239,236,225,232,229,226,242,229,119,\r\n    128,  5,160,241,229,244,225,238,225,232,229,226,242,229,119,128,\r\n      5,169,110,  4,187, 44,187, 53,187, 72,187, 93,227,233,242,227,\r\n    236,101,128, 36,105,233,228,229,239,231,242,225,240,232,233,227,\r\n    240,225,242,229,110,128, 50, 41,112,  2,187, 78,187, 85,225,242,\r\n    229,110,128, 36,125,229,242,233,239,100,128, 36,145,242,239,237,\r\n    225,110,128, 33,121,243,104,128,  2,167,116,131,  5,216,187,116,\r\n    187,136,187,145,228,225,231,229,243,104,129,251, 56,187,127,232,\r\n    229,226,242,229,119,128,251, 56,232,229,226,242,229,119,128,  5,\r\n    216,243,229,227,249,242,233,236,236,233, 99,128,  4,181,246,233,\r\n    114,  2,187,166,187,175,232,229,226,242,229,119,128,  5,155,236,\r\n    229,230,244,232,229,226,242,229,119,128,  5,155,104,  6,187,202,\r\n    188, 98,188,220,189, 96,190,  3,191, 60, 97,  5,187,214,187,224,\r\n    187,231,188,  0,188, 29,226,229,238,231,225,236,105,128,  9,165,\r\n    228,229,246, 97,128,  9, 37,231,117,  2,187,238,187,247,234,225,\r\n    242,225,244,105,128, 10,165,242,237,245,235,232,105,128, 10, 37,\r\n    108,  2,188,  6,188, 15,225,242,225,226,233, 99,128,  6, 48,230,\r\n    233,238,225,236,225,242,225,226,233, 99,128,254,172,238,244,232,\r\n    225,235,232,225,116,  3,188, 44,188, 75,188, 82,236,239,119,  2,\r\n    188, 52,188, 63,236,229,230,244,244,232,225,105,128,248,152,242,\r\n    233,231,232,244,244,232,225,105,128,248,151,244,232,225,105,128,\r\n     14, 76,245,240,240,229,242,236,229,230,244,244,232,225,105,128,\r\n    248,150,101,  3,188,106,188,170,188,193,104,  4,188,116,188,125,\r\n    188,139,188,155,225,242,225,226,233, 99,128,  6, 43,230,233,238,\r\n    225,236,225,242,225,226,233, 99,128,254,154,233,238,233,244,233,\r\n    225,236,225,242,225,226,233, 99,128,254,155,237,229,228,233,225,\r\n    236,225,242,225,226,233, 99,128,254,156,242,101,  2,188,177,188,\r\n    186,229,248,233,243,244,115,128, 34,  3,230,239,242,101,128, 34,\r\n     52,244, 97,130,  3,184,188,202,188,206, 49,128,  3,209,243,249,\r\n    237,226,239,236,231,242,229,229,107,128,  3,209,105,  2,188,226,\r\n    189, 56,229,245,244,104,  4,188,239,189, 18,189, 33,189, 42, 97,\r\n      2,188,245,189,  4,227,233,242,227,236,229,235,239,242,229,225,\r\n    110,128, 50,121,240,225,242,229,238,235,239,242,229,225,110,128,\r\n     50, 25,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,\r\n    107,235,239,242,229,225,110,128, 49, 76,240,225,242,229,238,235,\r\n    239,242,229,225,110,128, 50, 11,242,244,229,229,110,  2,189, 66,\r\n    189, 75,227,233,242,227,236,101,128, 36,108,112,  2,189, 81,189,\r\n     88,225,242,229,110,128, 36,128,229,242,233,239,100,128, 36,148,\r\n    111,  6,189,110,189,127,189,132,189,146,189,151,189,204,238,225,\r\n    238,231,237,239,238,244,232,239,244,232,225,105,128, 14, 17,239,\r\n    107,128,  1,173,240,232,245,244,232,225,239,244,232,225,105,128,\r\n     14, 18,242,110,128,  0,254,244,104,  3,189,160,189,184,189,194,\r\n     97,  2,189,166,189,176,232,225,238,244,232,225,105,128, 14, 23,\r\n    238,244,232,225,105,128, 14, 16,239,238,231,244,232,225,105,128,\r\n     14, 24,245,238,231,244,232,225,105,128, 14, 22,245,243,225,238,\r\n    100,  2,189,214,189,225,227,249,242,233,236,236,233, 99,128,  4,\r\n    130,243,243,229,240,225,242,225,244,239,114,  2,189,240,189,249,\r\n    225,242,225,226,233, 99,128,  6,108,240,229,242,243,233,225,110,\r\n    128,  6,108,242,229,101,144,  0, 51,190, 41,190, 50,190, 60,190,\r\n     90,190, 97,190,107,190,132,190,159,190,193,190,205,190,224,190,\r\n    235,191, 12,191, 34,191, 42,191, 53,225,242,225,226,233, 99,128,\r\n      6, 99,226,229,238,231,225,236,105,128,  9,233,227,233,242,227,\r\n    236,101,129, 36, 98,190, 71,233,238,246,229,242,243,229,243,225,\r\n    238,243,243,229,242,233,102,128, 39,140,228,229,246, 97,128,  9,\r\n    105,229,233,231,232,244,232,115,128, 33, 92,231,117,  2,190,114,\r\n    190,123,234,225,242,225,244,105,128, 10,233,242,237,245,235,232,\r\n    105,128, 10,105,232, 97,  2,190,139,190,150,227,235,225,242,225,\r\n    226,233, 99,128,  6, 99,238,231,250,232,239,117,128, 48, 35,105,\r\n      2,190,165,190,183,228,229,239,231,242,225,240,232,233,227,240,\r\n    225,242,229,110,128, 50, 34,238,230,229,242,233,239,114,128, 32,\r\n    131,237,239,238,239,243,240,225,227,101,128,255, 19,238,245,237,\r\n    229,242,225,244,239,242,226,229,238,231,225,236,105,128,  9,246,\r\n    239,236,228,243,244,249,236,101,128,247, 51,112,  2,190,241,190,\r\n    248,225,242,229,110,128, 36,118,229,114,  2,190,255,191,  5,233,\r\n    239,100,128, 36,138,243,233,225,110,128,  6,243,241,245,225,242,\r\n    244,229,242,115,129,  0,190,191, 25,229,237,228,225,243,104,128,\r\n    246,222,242,239,237,225,110,128, 33,114,243,245,240,229,242,233,\r\n    239,114,128,  0,179,244,232,225,105,128, 14, 83,250,243,241,245,\r\n    225,242,101,128, 51,148,105,  7,191, 86,191, 97,191,212,192, 54,\r\n    192, 66,192,115,192,132,232,233,242,225,231,225,238, 97,128, 48,\r\n     97,107,  2,191,103,191,127,225,244,225,235,225,238, 97,129, 48,\r\n    193,191,115,232,225,236,230,247,233,228,244,104,128,255,129,229,\r\n    245,116,  4,191,139,191,174,191,189,191,198, 97,  2,191,145,191,\r\n    160,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,112,\r\n    240,225,242,229,238,235,239,242,229,225,110,128, 50, 16,227,233,\r\n    242,227,236,229,235,239,242,229,225,110,128, 50, 98,235,239,242,\r\n    229,225,110,128, 49, 55,240,225,242,229,238,235,239,242,229,225,\r\n    110,128, 50,  2,236,228,101,133,  2,220,191,228,191,239,192,  0,\r\n    192, 12,192, 40,226,229,236,239,247,227,237, 98,128,  3, 48, 99,\r\n      2,191,245,191,250,237, 98,128,  3,  3,239,237, 98,128,  3,  3,\r\n    228,239,245,226,236,229,227,237, 98,128,  3, 96,111,  2,192, 18,\r\n    192, 28,240,229,242,225,244,239,114,128, 34, 60,246,229,242,236,\r\n    225,249,227,237, 98,128,  3, 52,246,229,242,244,233,227,225,236,\r\n    227,237, 98,128,  3, 62,237,229,243,227,233,242,227,236,101,128,\r\n     34,151,112,  2,192, 72,192,102,229,232, 97,  2,192, 80,192, 89,\r\n    232,229,226,242,229,119,128,  5,150,236,229,230,244,232,229,226,\r\n    242,229,119,128,  5,150,240,233,231,245,242,237,245,235,232,105,\r\n    128, 10,112,244,236,239,227,249,242,233,236,236,233,227,227,237,\r\n     98,128,  4,131,247,238,225,242,237,229,238,233,225,110,128,  5,\r\n    127,236,233,238,229,226,229,236,239,119,128, 30,111,237,239,238,\r\n    239,243,240,225,227,101,128,255, 84,111,  7,192,185,192,196,192,\r\n    207,192,232,193, 96,193,108,193,192,225,242,237,229,238,233,225,\r\n    110,128,  5,105,232,233,242,225,231,225,238, 97,128, 48,104,235,\r\n    225,244,225,235,225,238, 97,129, 48,200,192,220,232,225,236,230,\r\n    247,233,228,244,104,128,255,132,110,  3,192,240,193, 82,193, 87,\r\n    101,  4,192,250,193, 63,193, 70,193, 76,226,225,114,  4,193,  6,\r\n    193, 35,193, 45,193, 54,229,248,244,242, 97,  2,193, 16,193, 26,\r\n    232,233,231,232,237,239,100,128,  2,229,236,239,247,237,239,100,\r\n    128,  2,233,232,233,231,232,237,239,100,128,  2,230,236,239,247,\r\n    237,239,100,128,  2,232,237,233,228,237,239,100,128,  2,231,230,\r\n    233,246,101,128,  1,189,243,233,120,128,  1,133,244,247,111,128,\r\n      1,168,239,115,128,  3,132,243,241,245,225,242,101,128, 51, 39,\r\n    240,225,244,225,235,244,232,225,105,128, 14, 15,242,244,239,233,\r\n    243,229,243,232,229,236,236,226,242,225,227,235,229,116,  2,193,\r\n    131,193,161,236,229,230,116,130, 48, 20,193,142,193,150,243,237,\r\n    225,236,108,128,254, 93,246,229,242,244,233,227,225,108,128,254,\r\n     57,242,233,231,232,116,130, 48, 21,193,173,193,181,243,237,225,\r\n    236,108,128,254, 94,246,229,242,244,233,227,225,108,128,254, 58,\r\n    244,225,239,244,232,225,105,128, 14, 21,240, 97,  2,193,209,193,\r\n    221,236,225,244,225,236,232,239,239,107,128,  1,171,242,229,110,\r\n    128, 36,175,114,  3,193,235,194, 10,194, 25,225,228,229,237,225,\r\n    242,107,129, 33, 34,193,247,115,  2,193,253,194,  3,225,238,115,\r\n    128,248,234,229,242,233,102,128,246,219,229,244,242,239,230,236,\r\n    229,248,232,239,239,107,128,  2,136,233,225,103,  4,194, 37,194,\r\n     42,194, 47,194, 52,228,110,128, 37,188,236,102,128, 37,196,242,\r\n    116,128, 37,186,245,112,128, 37,178,115,132,  2,166,194, 69,194,\r\n    108,194,214,194,227,225,228,105,130,  5,230,194, 79,194, 99,228,\r\n    225,231,229,243,104,129,251, 70,194, 90,232,229,226,242,229,119,\r\n    128,251, 70,232,229,226,242,229,119,128,  5,230,101,  2,194,114,\r\n    194,125,227,249,242,233,236,236,233, 99,128,  4, 70,242,101,134,\r\n      5,181,194,142,194,156,194,161,194,170,194,185,194,201, 49,  2,\r\n    194,148,194,152, 50,128,  5,181,101,128,  5,181,178, 98,128,  5,\r\n    181,232,229,226,242,229,119,128,  5,181,238,225,242,242,239,247,\r\n    232,229,226,242,229,119,128,  5,181,241,245,225,242,244,229,242,\r\n    232,229,226,242,229,119,128,  5,181,247,233,228,229,232,229,226,\r\n    242,229,119,128,  5,181,232,229,227,249,242,233,236,236,233, 99,\r\n    128,  4, 91,245,240,229,242,233,239,114,128,246,243,116,  4,194,\r\n    247,195, 41,195,106,195,157, 97,  3,194,255,195,  9,195, 16,226,\r\n    229,238,231,225,236,105,128,  9,159,228,229,246, 97,128,  9, 31,\r\n    231,117,  2,195, 23,195, 32,234,225,242,225,244,105,128, 10,159,\r\n    242,237,245,235,232,105,128, 10, 31,229,104,  4,195, 52,195, 61,\r\n    195, 75,195, 91,225,242,225,226,233, 99,128,  6,121,230,233,238,\r\n    225,236,225,242,225,226,233, 99,128,251,103,233,238,233,244,233,\r\n    225,236,225,242,225,226,233, 99,128,251,104,237,229,228,233,225,\r\n    236,225,242,225,226,233, 99,128,251,105,232, 97,  3,195,115,195,\r\n    125,195,132,226,229,238,231,225,236,105,128,  9,160,228,229,246,\r\n     97,128,  9, 32,231,117,  2,195,139,195,148,234,225,242,225,244,\r\n    105,128, 10,160,242,237,245,235,232,105,128, 10, 32,245,242,238,\r\n    229,100,128,  2,135,117,  3,195,173,195,184,195,209,232,233,242,\r\n    225,231,225,238, 97,128, 48,100,235,225,244,225,235,225,238, 97,\r\n    129, 48,196,195,197,232,225,236,230,247,233,228,244,104,128,255,\r\n    130,243,237,225,236,108,  2,195,219,195,230,232,233,242,225,231,\r\n    225,238, 97,128, 48, 99,235,225,244,225,235,225,238, 97,129, 48,\r\n    195,195,243,232,225,236,230,247,233,228,244,104,128,255,111,119,\r\n      2,196,  5,196,110,101,  2,196, 11,196, 59,236,246,101,  3,196,\r\n     21,196, 30,196, 51,227,233,242,227,236,101,128, 36,107,112,  2,\r\n    196, 36,196, 43,225,242,229,110,128, 36,127,229,242,233,239,100,\r\n    128, 36,147,242,239,237,225,110,128, 33,123,238,244,121,  3,196,\r\n     69,196, 78,196, 89,227,233,242,227,236,101,128, 36,115,232,225,\r\n    238,231,250,232,239,117,128, 83, 68,112,  2,196, 95,196,102,225,\r\n    242,229,110,128, 36,135,229,242,233,239,100,128, 36,155,111,142,\r\n      0, 50,196,142,196,151,196,161,196,191,196,243,197, 12,197, 39,\r\n    197, 73,197, 85,197,104,197,115,197,148,197,156,197,180,225,242,\r\n    225,226,233, 99,128,  6, 98,226,229,238,231,225,236,105,128,  9,\r\n    232,227,233,242,227,236,101,129, 36, 97,196,172,233,238,246,229,\r\n    242,243,229,243,225,238,243,243,229,242,233,102,128, 39,139,100,\r\n      2,196,197,196,203,229,246, 97,128,  9,104,239,116,  2,196,210,\r\n    196,221,229,238,236,229,225,228,229,114,128, 32, 37,236,229,225,\r\n    228,229,114,129, 32, 37,196,232,246,229,242,244,233,227,225,108,\r\n    128,254, 48,231,117,  2,196,250,197,  3,234,225,242,225,244,105,\r\n    128, 10,232,242,237,245,235,232,105,128, 10,104,232, 97,  2,197,\r\n     19,197, 30,227,235,225,242,225,226,233, 99,128,  6, 98,238,231,\r\n    250,232,239,117,128, 48, 34,105,  2,197, 45,197, 63,228,229,239,\r\n    231,242,225,240,232,233,227,240,225,242,229,110,128, 50, 33,238,\r\n    230,229,242,233,239,114,128, 32,130,237,239,238,239,243,240,225,\r\n    227,101,128,255, 18,238,245,237,229,242,225,244,239,242,226,229,\r\n    238,231,225,236,105,128,  9,245,239,236,228,243,244,249,236,101,\r\n    128,247, 50,112,  2,197,121,197,128,225,242,229,110,128, 36,117,\r\n    229,114,  2,197,135,197,141,233,239,100,128, 36,137,243,233,225,\r\n    110,128,  6,242,242,239,237,225,110,128, 33,113,115,  2,197,162,\r\n    197,170,244,242,239,235,101,128,  1,187,245,240,229,242,233,239,\r\n    114,128,  0,178,244,104,  2,197,187,197,192,225,105,128, 14, 82,\r\n    233,242,228,115,128, 33, 84,117,145,  0,117,197,237,197,245,198,\r\n     30,198, 87,198,225,199,  6,199,129,199,145,199,196,200, 10,200,\r\n     91,200,100,200,219,200,243,201, 95,201,123,201,237,225,227,245,\r\n    244,101,128,  0,250, 98,  4,197,255,198,  4,198, 13,198, 23,225,\r\n    114,128,  2,137,229,238,231,225,236,105,128,  9,137,239,240,239,\r\n    237,239,230,111,128, 49, 40,242,229,246,101,128,  1,109, 99,  3,\r\n    198, 38,198, 45,198, 77,225,242,239,110,128,  1,212,233,242, 99,\r\n      2,198, 53,198, 58,236,101,128, 36,228,245,237,230,236,229,120,\r\n    129,  0,251,198, 69,226,229,236,239,119,128, 30,119,249,242,233,\r\n    236,236,233, 99,128,  4, 67,100,  5,198, 99,198,110,198,133,198,\r\n    139,198,215,225,244,244,225,228,229,246, 97,128,  9, 81,226,108,\r\n      2,198,117,198,125,225,227,245,244,101,128,  1,113,231,242,225,\r\n    246,101,128,  2, 21,229,246, 97,128,  9,  9,233,229,242,229,243,\r\n    233,115,133,  0,252,198,159,198,167,198,175,198,198,198,206,225,\r\n    227,245,244,101,128,  1,216,226,229,236,239,119,128, 30,115, 99,\r\n      2,198,181,198,188,225,242,239,110,128,  1,218,249,242,233,236,\r\n    236,233, 99,128,  4,241,231,242,225,246,101,128,  1,220,237,225,\r\n    227,242,239,110,128,  1,214,239,244,226,229,236,239,119,128, 30,\r\n    229,103,  2,198,231,198,238,242,225,246,101,128,  0,249,117,  2,\r\n    198,244,198,253,234,225,242,225,244,105,128, 10,137,242,237,245,\r\n    235,232,105,128, 10,  9,104,  3,199, 14,199, 24,199,102,233,242,\r\n    225,231,225,238, 97,128, 48, 70,111,  2,199, 30,199, 40,239,235,\r\n    225,226,239,246,101,128, 30,231,242,110,133,  1,176,199, 55,199,\r\n     63,199, 74,199, 82,199, 94,225,227,245,244,101,128, 30,233,228,\r\n    239,244,226,229,236,239,119,128, 30,241,231,242,225,246,101,128,\r\n     30,235,232,239,239,235,225,226,239,246,101,128, 30,237,244,233,\r\n    236,228,101,128, 30,239,245,238,231,225,242,245,237,236,225,245,\r\n    116,129,  1,113,199,118,227,249,242,233,236,236,233, 99,128,  4,\r\n    243,233,238,246,229,242,244,229,228,226,242,229,246,101,128,  2,\r\n     23,107,  3,199,153,199,177,199,188,225,244,225,235,225,238, 97,\r\n    129, 48,166,199,165,232,225,236,230,247,233,228,244,104,128,255,\r\n    115,227,249,242,233,236,236,233, 99,128,  4,121,239,242,229,225,\r\n    110,128, 49, 92,109,  2,199,202,199,255, 97,  2,199,208,199,241,\r\n    227,242,239,110,130,  1,107,199,219,199,230,227,249,242,233,236,\r\n    236,233, 99,128,  4,239,228,233,229,242,229,243,233,115,128, 30,\r\n    123,244,242,225,231,245,242,237,245,235,232,105,128, 10, 65,239,\r\n    238,239,243,240,225,227,101,128,255, 85,110,  2,200, 16,200, 71,\r\n    228,229,242,243,227,239,242,101,132,  0, 95,200, 35,200, 41,200,\r\n     53,200, 64,228,226,108,128, 32, 23,237,239,238,239,243,240,225,\r\n    227,101,128,255, 63,246,229,242,244,233,227,225,108,128,254, 51,\r\n    247,225,246,121,128,254, 79,105,  2,200, 77,200, 82,239,110,128,\r\n     34, 42,246,229,242,243,225,108,128, 34,  0,239,231,239,238,229,\r\n    107,128,  1,115,112,  5,200,112,200,119,200,127,200,142,200,193,\r\n    225,242,229,110,128, 36,176,226,236,239,227,107,128, 37,128,240,\r\n    229,242,228,239,244,232,229,226,242,229,119,128,  5,196,243,233,\r\n    236,239,110,131,  3,197,200,156,200,177,200,185,228,233,229,242,\r\n    229,243,233,115,129,  3,203,200,169,244,239,238,239,115,128,  3,\r\n    176,236,225,244,233,110,128,  2,138,244,239,238,239,115,128,  3,\r\n    205,244,225,227,107,  2,200,202,200,213,226,229,236,239,247,227,\r\n    237, 98,128,  3, 29,237,239,100,128,  2,212,114,  2,200,225,200,\r\n    237,225,231,245,242,237,245,235,232,105,128, 10,115,233,238,103,\r\n    128,  1,111,115,  3,200,251,201, 10,201, 55,232,239,242,244,227,\r\n    249,242,233,236,236,233, 99,128,  4, 94,237,225,236,108,  2,201,\r\n     19,201, 30,232,233,242,225,231,225,238, 97,128, 48, 69,235,225,\r\n    244,225,235,225,238, 97,129, 48,165,201, 43,232,225,236,230,247,\r\n    233,228,244,104,128,255,105,244,242,225,233,231,232,116,  2,201,\r\n     67,201, 78,227,249,242,233,236,236,233, 99,128,  4,175,243,244,\r\n    242,239,235,229,227,249,242,233,236,236,233, 99,128,  4,177,244,\r\n    233,236,228,101,130,  1,105,201,107,201,115,225,227,245,244,101,\r\n    128, 30,121,226,229,236,239,119,128, 30,117,117,  5,201,135,201,\r\n    145,201,152,201,177,201,193,226,229,238,231,225,236,105,128,  9,\r\n    138,228,229,246, 97,128,  9, 10,231,117,  2,201,159,201,168,234,\r\n    225,242,225,244,105,128, 10,138,242,237,245,235,232,105,128, 10,\r\n     10,237,225,244,242,225,231,245,242,237,245,235,232,105,128, 10,\r\n     66,246,239,247,229,236,243,233,231,110,  3,201,209,201,219,201,\r\n    226,226,229,238,231,225,236,105,128,  9,194,228,229,246, 97,128,\r\n      9, 66,231,245,234,225,242,225,244,105,128, 10,194,246,239,247,\r\n    229,236,243,233,231,110,  3,201,253,202,  7,202, 14,226,229,238,\r\n    231,225,236,105,128,  9,193,228,229,246, 97,128,  9, 65,231,245,\r\n    234,225,242,225,244,105,128, 10,193,118,139,  0,118,202, 51,202,\r\n    199,202,208,202,219,203,148,203,155,203,253,204,  9,204,109,204,\r\n    117,204,138, 97,  4,202, 61,202, 68,202, 93,202,104,228,229,246,\r\n     97,128,  9, 53,231,117,  2,202, 75,202, 84,234,225,242,225,244,\r\n    105,128, 10,181,242,237,245,235,232,105,128, 10, 53,235,225,244,\r\n    225,235,225,238, 97,128, 48,247,118,132,  5,213,202,116,202,143,\r\n    202,175,202,187,228,225,231,229,243,104,130,251, 53,202,129,202,\r\n    134,182, 53,128,251, 53,232,229,226,242,229,119,128,251, 53,104,\r\n      2,202,149,202,157,229,226,242,229,119,128,  5,213,239,236,225,\r\n    109,129,251, 75,202,166,232,229,226,242,229,119,128,251, 75,246,\r\n    225,246,232,229,226,242,229,119,128,  5,240,249,239,228,232,229,\r\n    226,242,229,119,128,  5,241,227,233,242,227,236,101,128, 36,229,\r\n    228,239,244,226,229,236,239,119,128, 30,127,101,  6,202,233,202,\r\n    244,203, 52,203, 63,203, 69,203,136,227,249,242,233,236,236,233,\r\n     99,128,  4, 50,104,  4,202,254,203,  7,203, 21,203, 37,225,242,\r\n    225,226,233, 99,128,  6,164,230,233,238,225,236,225,242,225,226,\r\n    233, 99,128,251,107,233,238,233,244,233,225,236,225,242,225,226,\r\n    233, 99,128,251,108,237,229,228,233,225,236,225,242,225,226,233,\r\n     99,128,251,109,235,225,244,225,235,225,238, 97,128, 48,249,238,\r\n    245,115,128, 38, 64,242,244,233,227,225,108,  2,203, 80,203, 86,\r\n    226,225,114,128,  0,124,236,233,238,101,  4,203, 99,203,110,203,\r\n    121,203,130,225,226,239,246,229,227,237, 98,128,  3, 13,226,229,\r\n    236,239,247,227,237, 98,128,  3, 41,236,239,247,237,239,100,128,\r\n      2,204,237,239,100,128,  2,200,247,225,242,237,229,238,233,225,\r\n    110,128,  5,126,232,239,239,107,128,  2,139,105,  3,203,163,203,\r\n    174,203,213,235,225,244,225,235,225,238, 97,128, 48,248,242,225,\r\n    237, 97,  3,203,185,203,195,203,202,226,229,238,231,225,236,105,\r\n    128,  9,205,228,229,246, 97,128,  9, 77,231,245,234,225,242,225,\r\n    244,105,128, 10,205,243,225,242,231, 97,  3,203,225,203,235,203,\r\n    242,226,229,238,231,225,236,105,128,  9,131,228,229,246, 97,128,\r\n      9,  3,231,245,234,225,242,225,244,105,128, 10,131,237,239,238,\r\n    239,243,240,225,227,101,128,255, 86,111,  3,204, 17,204, 28,204,\r\n     98,225,242,237,229,238,233,225,110,128,  5,120,233,227,229,100,\r\n      2,204, 37,204, 73,233,244,229,242,225,244,233,239,110,  2,204,\r\n     51,204, 62,232,233,242,225,231,225,238, 97,128, 48,158,235,225,\r\n    244,225,235,225,238, 97,128, 48,254,237,225,242,235,235,225,238,\r\n     97,129, 48,155,204, 86,232,225,236,230,247,233,228,244,104,128,\r\n    255,158,235,225,244,225,235,225,238, 97,128, 48,250,240,225,242,\r\n    229,110,128, 36,177,116,  2,204,123,204,130,233,236,228,101,128,\r\n     30,125,245,242,238,229,100,128,  2,140,117,  2,204,144,204,155,\r\n    232,233,242,225,231,225,238, 97,128, 48,148,235,225,244,225,235,\r\n    225,238, 97,128, 48,244,119,143,  0,119,204,200,205,177,205,187,\r\n    205,210,205,250,206, 61,206, 69,208, 40,208, 81,208, 93,208,168,\r\n    208,176,208,183,208,194,208,203, 97,  8,204,218,204,225,204,235,\r\n    204,246,205, 28,205, 60,205, 72,205,108,227,245,244,101,128, 30,\r\n    131,229,235,239,242,229,225,110,128, 49, 89,232,233,242,225,231,\r\n    225,238, 97,128, 48,143,107,  2,204,252,205, 20,225,244,225,235,\r\n    225,238, 97,129, 48,239,205,  8,232,225,236,230,247,233,228,244,\r\n    104,128,255,156,239,242,229,225,110,128, 49, 88,243,237,225,236,\r\n    108,  2,205, 38,205, 49,232,233,242,225,231,225,238, 97,128, 48,\r\n    142,235,225,244,225,235,225,238, 97,128, 48,238,244,244,239,243,\r\n    241,245,225,242,101,128, 51, 87,118,  2,205, 78,205, 86,229,228,\r\n    225,243,104,128, 48, 28,249,245,238,228,229,242,243,227,239,242,\r\n    229,246,229,242,244,233,227,225,108,128,254, 52,119,  3,205,116,\r\n    205,125,205,139,225,242,225,226,233, 99,128,  6, 72,230,233,238,\r\n    225,236,225,242,225,226,233, 99,128,254,238,232,225,237,250,225,\r\n    225,226,239,246,101,  2,205,154,205,163,225,242,225,226,233, 99,\r\n    128,  6, 36,230,233,238,225,236,225,242,225,226,233, 99,128,254,\r\n    134,226,243,241,245,225,242,101,128, 51,221,227,233,242, 99,  2,\r\n    205,196,205,201,236,101,128, 36,230,245,237,230,236,229,120,128,\r\n      1,117,100,  2,205,216,205,226,233,229,242,229,243,233,115,128,\r\n     30,133,239,116,  2,205,233,205,242,225,227,227,229,238,116,128,\r\n     30,135,226,229,236,239,119,128, 30,137,101,  4,206,  4,206, 15,\r\n    206, 27,206, 51,232,233,242,225,231,225,238, 97,128, 48,145,233,\r\n    229,242,243,244,242,225,243,115,128, 33, 24,107,  2,206, 33,206,\r\n     43,225,244,225,235,225,238, 97,128, 48,241,239,242,229,225,110,\r\n    128, 49, 94,239,235,239,242,229,225,110,128, 49, 93,231,242,225,\r\n    246,101,128, 30,129,232,233,244,101,  8,206, 90,206, 99,206,183,\r\n    207, 17,207,101,207,146,207,198,207,254,226,245,236,236,229,116,\r\n    128, 37,230, 99,  2,206,105,206,125,233,242,227,236,101,129, 37,\r\n    203,206,115,233,238,246,229,242,243,101,128, 37,217,239,242,238,\r\n    229,242,226,242,225,227,235,229,116,  2,206,142,206,162,236,229,\r\n    230,116,129, 48, 14,206,151,246,229,242,244,233,227,225,108,128,\r\n    254, 67,242,233,231,232,116,129, 48, 15,206,172,246,229,242,244,\r\n    233,227,225,108,128,254, 68,100,  2,206,189,206,230,233,225,237,\r\n    239,238,100,129, 37,199,206,200,227,239,238,244,225,233,238,233,\r\n    238,231,226,236,225,227,235,243,237,225,236,236,228,233,225,237,\r\n    239,238,100,128, 37,200,239,247,238,240,239,233,238,244,233,238,\r\n    103,  2,206,246,207,  6,243,237,225,236,236,244,242,233,225,238,\r\n    231,236,101,128, 37,191,244,242,233,225,238,231,236,101,128, 37,\r\n    189,236,101,  2,207, 24,207, 66,230,244,240,239,233,238,244,233,\r\n    238,103,  2,207, 39,207, 55,243,237,225,236,236,244,242,233,225,\r\n    238,231,236,101,128, 37,195,244,242,233,225,238,231,236,101,128,\r\n     37,193,238,244,233,227,245,236,225,242,226,242,225,227,235,229,\r\n    116,  2,207, 86,207, 93,236,229,230,116,128, 48, 22,242,233,231,\r\n    232,116,128, 48, 23,242,233,231,232,244,240,239,233,238,244,233,\r\n    238,103,  2,207,119,207,135,243,237,225,236,236,244,242,233,225,\r\n    238,231,236,101,128, 37,185,244,242,233,225,238,231,236,101,128,\r\n     37,183,115,  3,207,154,207,184,207,192,109,  2,207,160,207,172,\r\n    225,236,236,243,241,245,225,242,101,128, 37,171,233,236,233,238,\r\n    231,230,225,227,101,128, 38, 58,241,245,225,242,101,128, 37,161,\r\n    244,225,114,128, 38,  6,116,  2,207,204,207,215,229,236,229,240,\r\n    232,239,238,101,128, 38, 15,239,242,244,239,233,243,229,243,232,\r\n    229,236,236,226,242,225,227,235,229,116,  2,207,239,207,246,236,\r\n    229,230,116,128, 48, 24,242,233,231,232,116,128, 48, 25,245,240,\r\n    240,239,233,238,244,233,238,103,  2,208, 13,208, 29,243,237,225,\r\n    236,236,244,242,233,225,238,231,236,101,128, 37,181,244,242,233,\r\n    225,238,231,236,101,128, 37,179,105,  2,208, 46,208, 57,232,233,\r\n    242,225,231,225,238, 97,128, 48,144,107,  2,208, 63,208, 73,225,\r\n    244,225,235,225,238, 97,128, 48,240,239,242,229,225,110,128, 49,\r\n     95,237,239,238,239,243,240,225,227,101,128,255, 87,111,  4,208,\r\n    103,208,114,208,139,208,157,232,233,242,225,231,225,238, 97,128,\r\n     48,146,235,225,244,225,235,225,238, 97,129, 48,242,208,127,232,\r\n    225,236,230,247,233,228,244,104,128,255,102,110,129, 32,169,208,\r\n    145,237,239,238,239,243,240,225,227,101,128,255,230,247,225,229,\r\n    238,244,232,225,105,128, 14, 39,240,225,242,229,110,128, 36,178,\r\n    242,233,238,103,128, 30,152,243,245,240,229,242,233,239,114,128,\r\n      2,183,244,245,242,238,229,100,128,  2,141,249,238,110,128,  1,\r\n    191,120,137,  0,120,208,231,208,242,208,253,209,  6,209, 33,209,\r\n     46,209, 50,209, 62,209, 70,225,226,239,246,229,227,237, 98,128,\r\n      3, 61,226,239,240,239,237,239,230,111,128, 49, 18,227,233,242,\r\n    227,236,101,128, 36,231,100,  2,209, 12,209, 22,233,229,242,229,\r\n    243,233,115,128, 30,141,239,244,225,227,227,229,238,116,128, 30,\r\n    139,229,232,225,242,237,229,238,233,225,110,128,  5,109,105,128,\r\n      3,190,237,239,238,239,243,240,225,227,101,128,255, 88,240,225,\r\n    242,229,110,128, 36,179,243,245,240,229,242,233,239,114,128,  2,\r\n    227,121,143,  0,121,209,115,210, 74,210, 97,210,137,212,103,212,\r\n    111,212,128,212,192,212,204,213,201,213,241,213,253,214,  8,214,\r\n     29,215,  2, 97, 11,209,139,209,151,209,161,209,168,209,175,209,\r\n    185,209,210,209,221,210,  3,210, 16,210, 62,225,228,239,243,241,\r\n    245,225,242,101,128, 51, 78,226,229,238,231,225,236,105,128,  9,\r\n    175,227,245,244,101,128,  0,253,228,229,246, 97,128,  9, 47,229,\r\n    235,239,242,229,225,110,128, 49, 82,231,117,  2,209,192,209,201,\r\n    234,225,242,225,244,105,128, 10,175,242,237,245,235,232,105,128,\r\n     10, 47,232,233,242,225,231,225,238, 97,128, 48,132,107,  2,209,\r\n    227,209,251,225,244,225,235,225,238, 97,129, 48,228,209,239,232,\r\n    225,236,230,247,233,228,244,104,128,255,148,239,242,229,225,110,\r\n    128, 49, 81,237,225,235,235,225,238,244,232,225,105,128, 14, 78,\r\n    243,237,225,236,108,  2,210, 26,210, 37,232,233,242,225,231,225,\r\n    238, 97,128, 48,131,235,225,244,225,235,225,238, 97,129, 48,227,\r\n    210, 50,232,225,236,230,247,233,228,244,104,128,255,108,244,227,\r\n    249,242,233,236,236,233, 99,128,  4, 99,227,233,242, 99,  2,210,\r\n     83,210, 88,236,101,128, 36,232,245,237,230,236,229,120,128,  1,\r\n    119,100,  2,210,103,210,113,233,229,242,229,243,233,115,128,  0,\r\n    255,239,116,  2,210,120,210,129,225,227,227,229,238,116,128, 30,\r\n    143,226,229,236,239,119,128, 30,245,101,  7,210,153,211,161,211,\r\n    170,211,188,211,220,212, 40,212, 91,104,  8,210,171,210,180,210,\r\n    214,210,228,211, 45,211, 61,211,120,211,138,225,242,225,226,233,\r\n     99,128,  6, 74,226,225,242,242,229,101,  2,210,191,210,200,225,\r\n    242,225,226,233, 99,128,  6,210,230,233,238,225,236,225,242,225,\r\n    226,233, 99,128,251,175,230,233,238,225,236,225,242,225,226,233,\r\n     99,128,254,242,232,225,237,250,225,225,226,239,246,101,  4,210,\r\n    247,211,  0,211, 14,211, 30,225,242,225,226,233, 99,128,  6, 38,\r\n    230,233,238,225,236,225,242,225,226,233, 99,128,254,138,233,238,\r\n    233,244,233,225,236,225,242,225,226,233, 99,128,254,139,237,229,\r\n    228,233,225,236,225,242,225,226,233, 99,128,254,140,233,238,233,\r\n    244,233,225,236,225,242,225,226,233, 99,128,254,243,237,101,  2,\r\n    211, 68,211, 81,228,233,225,236,225,242,225,226,233, 99,128,254,\r\n    244,229,237,105,  2,211, 89,211,104,238,233,244,233,225,236,225,\r\n    242,225,226,233, 99,128,252,221,243,239,236,225,244,229,228,225,\r\n    242,225,226,233, 99,128,252, 88,238,239,239,238,230,233,238,225,\r\n    236,225,242,225,226,233, 99,128,252,148,244,232,242,229,229,228,\r\n    239,244,243,226,229,236,239,247,225,242,225,226,233, 99,128,  6,\r\n    209,235,239,242,229,225,110,128, 49, 86,110,129,  0,165,211,176,\r\n    237,239,238,239,243,240,225,227,101,128,255,229,111,  2,211,194,\r\n    211,203,235,239,242,229,225,110,128, 49, 85,242,233,238,232,233,\r\n    229,245,232,235,239,242,229,225,110,128, 49,134,114,  3,211,228,\r\n    212,  8,212, 20,225,232,226,229,238,249,239,237,111,  2,211,242,\r\n    211,251,232,229,226,242,229,119,128,  5,170,236,229,230,244,232,\r\n    229,226,242,229,119,128,  5,170,233,227,249,242,233,236,236,233,\r\n     99,128,  4, 75,245,228,233,229,242,229,243,233,243,227,249,242,\r\n    233,236,236,233, 99,128,  4,249,243,233,229,245,238,103,  3,212,\r\n     53,212, 62,212, 78,235,239,242,229,225,110,128, 49,129,240,225,\r\n    238,243,233,239,243,235,239,242,229,225,110,128, 49,131,243,233,\r\n    239,243,235,239,242,229,225,110,128, 49,130,244,233,246,232,229,\r\n    226,242,229,119,128,  5,154,231,242,225,246,101,128, 30,243,232,\r\n    239,239,107,129,  1,180,212,120,225,226,239,246,101,128, 30,247,\r\n    105,  5,212,140,212,151,212,162,212,171,212,179,225,242,237,229,\r\n    238,233,225,110,128,  5,117,227,249,242,233,236,236,233, 99,128,\r\n      4, 87,235,239,242,229,225,110,128, 49, 98,238,249,225,238,103,\r\n    128, 38, 47,247,238,225,242,237,229,238,233,225,110,128,  5,130,\r\n    237,239,238,239,243,240,225,227,101,128,255, 89,111,  7,212,220,\r\n    213, 34,213, 45,213, 55,213, 93,213,139,213,148,100,131,  5,217,\r\n    212,230,212,250,213,  3,228,225,231,229,243,104,129,251, 57,212,\r\n    241,232,229,226,242,229,119,128,251, 57,232,229,226,242,229,119,\r\n    128,  5,217,249,239,100,  2,213, 11,213, 20,232,229,226,242,229,\r\n    119,128,  5,242,240,225,244,225,232,232,229,226,242,229,119,128,\r\n    251, 31,232,233,242,225,231,225,238, 97,128, 48,136,233,235,239,\r\n    242,229,225,110,128, 49,137,107,  2,213, 61,213, 85,225,244,225,\r\n    235,225,238, 97,129, 48,232,213, 73,232,225,236,230,247,233,228,\r\n    244,104,128,255,150,239,242,229,225,110,128, 49, 91,243,237,225,\r\n    236,108,  2,213,103,213,114,232,233,242,225,231,225,238, 97,128,\r\n     48,135,235,225,244,225,235,225,238, 97,129, 48,231,213,127,232,\r\n    225,236,230,247,233,228,244,104,128,255,110,244,231,242,229,229,\r\n    107,128,  3,243,121,  2,213,154,213,191, 97,  2,213,160,213,170,\r\n    229,235,239,242,229,225,110,128, 49,136,107,  2,213,176,213,184,\r\n    239,242,229,225,110,128, 49,135,244,232,225,105,128, 14, 34,233,\r\n    238,231,244,232,225,105,128, 14, 13,112,  2,213,207,213,214,225,\r\n    242,229,110,128, 36,180,239,231,229,231,242,225,237,237,229,238,\r\n    105,129,  3,122,213,230,231,242,229,229,235,227,237, 98,128,  3,\r\n     69,114,129,  1,166,213,247,233,238,103,128, 30,153,243,245,240,\r\n    229,242,233,239,114,128,  2,184,116,  2,214, 14,214, 21,233,236,\r\n    228,101,128, 30,249,245,242,238,229,100,128,  2,142,117,  5,214,\r\n     41,214, 52,214, 62,214,100,214,232,232,233,242,225,231,225,238,\r\n     97,128, 48,134,233,235,239,242,229,225,110,128, 49,140,107,  2,\r\n    214, 68,214, 92,225,244,225,235,225,238, 97,129, 48,230,214, 80,\r\n    232,225,236,230,247,233,228,244,104,128,255,149,239,242,229,225,\r\n    110,128, 49, 96,115,  3,214,108,214,146,214,187,226,233,103,  2,\r\n    214,116,214,127,227,249,242,233,236,236,233, 99,128,  4,107,233,\r\n    239,244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128,\r\n      4,109,236,233,244,244,236,101,  2,214,157,214,168,227,249,242,\r\n    233,236,236,233, 99,128,  4,103,233,239,244,233,230,233,229,228,\r\n    227,249,242,233,236,236,233, 99,128,  4,105,237,225,236,108,  2,\r\n    214,196,214,207,232,233,242,225,231,225,238, 97,128, 48,133,235,\r\n    225,244,225,235,225,238, 97,129, 48,229,214,220,232,225,236,230,\r\n    247,233,228,244,104,128,255,109,249,101,  2,214,239,214,248,235,\r\n    239,242,229,225,110,128, 49,139,239,235,239,242,229,225,110,128,\r\n     49,138,249, 97,  2,215,  9,215, 19,226,229,238,231,225,236,105,\r\n    128,  9,223,228,229,246, 97,128,  9, 95,122,142,  0,122,215, 58,\r\n    216, 66,216, 77,216,120,216,147,217,182,218, 34,218, 76,218, 88,\r\n    218,100,218,128,218,136,218,152,218,161, 97, 10,215, 80,215, 91,\r\n    215, 98,215,105,215,116,215,194,215,224,215,235,216, 15,216, 27,\r\n    225,242,237,229,238,233,225,110,128,  5,102,227,245,244,101,128,\r\n      1,122,228,229,246, 97,128,  9, 91,231,245,242,237,245,235,232,\r\n    105,128, 10, 91,104,  4,215,126,215,135,215,149,215,179,225,242,\r\n    225,226,233, 99,128,  6, 56,230,233,238,225,236,225,242,225,226,\r\n    233, 99,128,254,198,105,  2,215,155,215,170,238,233,244,233,225,\r\n    236,225,242,225,226,233, 99,128,254,199,242,225,231,225,238, 97,\r\n    128, 48, 86,237,229,228,233,225,236,225,242,225,226,233, 99,128,\r\n    254,200,233,110,  2,215,201,215,210,225,242,225,226,233, 99,128,\r\n      6, 50,230,233,238,225,236,225,242,225,226,233, 99,128,254,176,\r\n    235,225,244,225,235,225,238, 97,128, 48,182,241,229,102,  2,215,\r\n    243,216,  1,231,225,228,239,236,232,229,226,242,229,119,128,  5,\r\n    149,241,225,244,225,238,232,229,226,242,229,119,128,  5,148,242,\r\n    241,225,232,229,226,242,229,119,128,  5,152,249,233,110,130,  5,\r\n    214,216, 37,216, 57,228,225,231,229,243,104,129,251, 54,216, 48,\r\n    232,229,226,242,229,119,128,251, 54,232,229,226,242,229,119,128,\r\n      5,214,226,239,240,239,237,239,230,111,128, 49, 23, 99,  3,216,\r\n     85,216, 92,216,114,225,242,239,110,128,  1,126,233,242, 99,  2,\r\n    216,100,216,105,236,101,128, 36,233,245,237,230,236,229,120,128,\r\n     30,145,245,242,108,128,  2,145,228,239,116,130,  1,124,216,130,\r\n    216,139,225,227,227,229,238,116,128,  1,124,226,229,236,239,119,\r\n    128, 30,147,101,  6,216,161,216,172,216,215,216,226,216,237,217,\r\n    177,227,249,242,233,236,236,233, 99,128,  4, 55,100,  2,216,178,\r\n    216,197,229,243,227,229,238,228,229,242,227,249,242,233,236,236,\r\n    233, 99,128,  4,153,233,229,242,229,243,233,243,227,249,242,233,\r\n    236,236,233, 99,128,  4,223,232,233,242,225,231,225,238, 97,128,\r\n     48, 92,235,225,244,225,235,225,238, 97,128, 48,188,242,111,140,\r\n      0, 48,217, 10,217, 19,217, 29,217, 36,217, 61,217, 74,217, 85,\r\n    217, 97,217,108,217,118,217,129,217,136,225,242,225,226,233, 99,\r\n    128,  6, 96,226,229,238,231,225,236,105,128,  9,230,228,229,246,\r\n     97,128,  9,102,231,117,  2,217, 43,217, 52,234,225,242,225,244,\r\n    105,128, 10,230,242,237,245,235,232,105,128, 10,102,232,225,227,\r\n    235,225,242,225,226,233, 99,128,  6, 96,233,238,230,229,242,233,\r\n    239,114,128, 32,128,237,239,238,239,243,240,225,227,101,128,255,\r\n     16,239,236,228,243,244,249,236,101,128,247, 48,240,229,242,243,\r\n    233,225,110,128,  6,240,243,245,240,229,242,233,239,114,128, 32,\r\n    112,244,232,225,105,128, 14, 80,247,233,228,244,104,  3,217,148,\r\n    217,157,217,169,234,239,233,238,229,114,128,254,255,238,239,238,\r\n    234,239,233,238,229,114,128, 32, 12,243,240,225,227,101,128, 32,\r\n     11,244, 97,128,  3,182,104,  2,217,188,217,199,226,239,240,239,\r\n    237,239,230,111,128, 49, 19,101,  4,217,209,217,220,217,236,217,\r\n    247,225,242,237,229,238,233,225,110,128,  5,106,226,242,229,246,\r\n    229,227,249,242,233,236,236,233, 99,128,  4,194,227,249,242,233,\r\n    236,236,233, 99,128,  4, 54,100,  2,217,253,218, 16,229,243,227,\r\n    229,238,228,229,242,227,249,242,233,236,236,233, 99,128,  4,151,\r\n    233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128,\r\n      4,221,105,  3,218, 42,218, 53,218, 64,232,233,242,225,231,225,\r\n    238, 97,128, 48, 88,235,225,244,225,235,225,238, 97,128, 48,184,\r\n    238,239,242,232,229,226,242,229,119,128,  5,174,236,233,238,229,\r\n    226,229,236,239,119,128, 30,149,237,239,238,239,243,240,225,227,\r\n    101,128,255, 90,111,  2,218,106,218,117,232,233,242,225,231,225,\r\n    238, 97,128, 48, 94,235,225,244,225,235,225,238, 97,128, 48,190,\r\n    240,225,242,229,110,128, 36,181,242,229,244,242,239,230,236,229,\r\n    248,232,239,239,107,128,  2,144,243,244,242,239,235,101,128,  1,\r\n    182,117,  2,218,167,218,178,232,233,242,225,231,225,238, 97,128,\r\n     48, 90,235,225,244,225,235,225,238, 97,128, 48,186\r\n  };\r\n\r\n\r\n  /*\r\n   *  This function searches the compressed table efficiently.\r\n   */\r\n  static unsigned long\r\n  ft_get_adobe_glyph_index( const char*  name,\r\n                            const char*  limit )\r\n  {\r\n    int                   c = 0;\r\n    int                   count, min, max;\r\n    const unsigned char*  p = ft_adobe_glyph_list;\r\n\r\n\r\n    if ( name == 0 || name >= limit )\r\n      goto NotFound;\r\n\r\n    c     = *name++;\r\n    count = p[1];\r\n    p    += 2;\r\n\r\n    min = 0;\r\n    max = count;\r\n\r\n    while ( min < max )\r\n    {\r\n      int                   mid = ( min + max ) >> 1;\r\n      const unsigned char*  q   = p + mid * 2;\r\n      int                   c2;\r\n\r\n\r\n      q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] );\r\n\r\n      c2 = q[0] & 127;\r\n      if ( c2 == c )\r\n      {\r\n        p = q;\r\n        goto Found;\r\n      }\r\n      if ( c2 < c )\r\n        min = mid + 1;\r\n      else\r\n        max = mid;\r\n    }\r\n    goto NotFound;\r\n\r\n  Found:\r\n    for (;;)\r\n    {\r\n      /* assert (*p & 127) == c */\r\n\r\n      if ( name >= limit )\r\n      {\r\n        if ( (p[0] & 128) == 0 &&\r\n             (p[1] & 128) != 0 )\r\n          return (unsigned long)( ( (int)p[2] << 8 ) | p[3] );\r\n\r\n        goto NotFound;\r\n      }\r\n      c = *name++;\r\n      if ( p[0] & 128 )\r\n      {\r\n        p++;\r\n        if ( c != (p[0] & 127) )\r\n          goto NotFound;\r\n\r\n        continue;\r\n      }\r\n\r\n      p++;\r\n      count = p[0] & 127;\r\n      if ( p[0] & 128 )\r\n        p += 2;\r\n\r\n      p++;\r\n\r\n      for ( ; count > 0; count--, p += 2 )\r\n      {\r\n        int                   offset = ( (int)p[0] << 8 ) | p[1];\r\n        const unsigned char*  q      = ft_adobe_glyph_list + offset;\r\n\r\n        if ( c == ( q[0] & 127 ) )\r\n        {\r\n          p = q;\r\n          goto NextIter;\r\n        }\r\n      }\r\n      goto NotFound;\r\n\r\n    NextIter:\r\n      ;\r\n    }\r\n\r\n  NotFound:\r\n    return 0;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/psnames/rules.mk",
    "content": "#\r\n# FreeType 2 PSNames driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# PSNames driver directory\r\n#\r\nPSNAMES_DIR := $(SRC_DIR)/psnames\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nPSNAMES_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSNAMES_DIR))\r\n\r\n\r\n# PSNames driver sources (i.e., C files)\r\n#\r\nPSNAMES_DRV_SRC := $(PSNAMES_DIR)/psmodule.c \\\r\n                   $(PSNAMES_DIR)/pspic.c\r\n\r\n\r\n# PSNames driver headers\r\n#\r\nPSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \\\r\n                 $(PSNAMES_DIR)/psnamerr.h  \\\r\n                 $(PSNAMES_DIR)/pstables.h\r\n\r\n\r\n# PSNames driver object(s)\r\n#\r\n#   PSNAMES_DRV_OBJ_M is used during `multi' builds\r\n#   PSNAMES_DRV_OBJ_S is used during `single' builds\r\n#\r\nPSNAMES_DRV_OBJ_M := $(PSNAMES_DRV_SRC:$(PSNAMES_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nPSNAMES_DRV_OBJ_S := $(OBJ_DIR)/psnames.$O\r\n\r\n# PSNames driver source file for single build\r\n#\r\nPSNAMES_DRV_SRC_S := $(PSNAMES_DIR)/psmodule.c\r\n\r\n\r\n# PSNames driver - single object\r\n#\r\n$(PSNAMES_DRV_OBJ_S): $(PSNAMES_DRV_SRC_S) $(PSNAMES_DRV_SRC) \\\r\n                      $(FREETYPE_H) $(PSNAMES_DRV_H)\r\n\t$(PSNAMES_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PSNAMES_DRV_SRC_S))\r\n\r\n\r\n# PSNames driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(PSNAMES_DIR)/%.c $(FREETYPE_H) $(PSNAMES_DRV_H)\r\n\t$(PSNAMES_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(PSNAMES_DRV_OBJ_S)\r\nDRV_OBJS_M += $(PSNAMES_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/Jamfile",
    "content": "# FreeType 2 src/raster Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) raster ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = ftraster ftrend1 rastpic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = raster ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/raster Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/ftmisc.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmisc.h                                                               */\r\n/*                                                                         */\r\n/*    Miscellaneous macros for stand-alone rasterizer (specification       */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2009, 2010 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used        */\r\n/*  modified and distributed under the terms of the FreeType project       */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /***************************************************/\r\n  /*                                                 */\r\n  /* This file is *not* portable!  You have to adapt */\r\n  /* its definitions to your platform.               */\r\n  /*                                                 */\r\n  /***************************************************/\r\n\r\n#ifndef __FTMISC_H__\r\n#define __FTMISC_H__\r\n\r\n\r\n  /* memset */\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n#define FT_BEGIN_HEADER\r\n#define FT_END_HEADER\r\n\r\n#define FT_LOCAL_DEF( x )   static x\r\n\r\n\r\n  /* from include/freetype2/fttypes.h */\r\n\r\n  typedef unsigned char  FT_Byte;\r\n  typedef signed int     FT_Int;\r\n  typedef unsigned int   FT_UInt;\r\n  typedef signed long    FT_Long;\r\n  typedef unsigned long  FT_ULong;\r\n  typedef signed long    FT_F26Dot6;\r\n  typedef int            FT_Error;\r\n\r\n#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \\\r\n          ( ( (FT_ULong)_x1 << 24 ) |     \\\r\n            ( (FT_ULong)_x2 << 16 ) |     \\\r\n            ( (FT_ULong)_x3 <<  8 ) |     \\\r\n              (FT_ULong)_x4         )\r\n\r\n\r\n  /* from include/freetype2/ftsystem.h */\r\n\r\n  typedef struct FT_MemoryRec_*  FT_Memory;\r\n\r\n  typedef void* (*FT_Alloc_Func)( FT_Memory  memory,\r\n                                  long       size );\r\n\r\n  typedef void (*FT_Free_Func)( FT_Memory  memory,\r\n                                void*      block );\r\n\r\n  typedef void* (*FT_Realloc_Func)( FT_Memory  memory,\r\n                                    long       cur_size,\r\n                                    long       new_size,\r\n                                    void*      block );\r\n\r\n  typedef struct FT_MemoryRec_\r\n  {\r\n    void*            user;\r\n\r\n    FT_Alloc_Func    alloc;\r\n    FT_Free_Func     free;\r\n    FT_Realloc_Func  realloc;\r\n\r\n  } FT_MemoryRec;\r\n\r\n\r\n  /* from src/ftcalc.c */\r\n\r\n#if ( defined _WIN32 || defined _WIN64 )\r\n\r\n  typedef __int64  FT_Int64;\r\n\r\n#else\r\n\r\n#include \"inttypes.h\"\r\n\r\n  typedef int64_t  FT_Int64;\r\n\r\n#endif\r\n\r\n\r\n  static FT_Long\r\n  FT_MulDiv( FT_Long  a,\r\n             FT_Long  b,\r\n             FT_Long  c )\r\n  {\r\n    FT_Int   s;\r\n    FT_Long  d;\r\n\r\n\r\n    s = 1;\r\n    if ( a < 0 ) { a = -a; s = -1; }\r\n    if ( b < 0 ) { b = -b; s = -s; }\r\n    if ( c < 0 ) { c = -c; s = -s; }\r\n\r\n    d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c\r\n                         : 0x7FFFFFFFL );\r\n\r\n    return ( s > 0 ) ? d : -d;\r\n  }\r\n\r\n\r\n  static FT_Long\r\n  FT_MulDiv_No_Round( FT_Long  a,\r\n                      FT_Long  b,\r\n                      FT_Long  c )\r\n  {\r\n    FT_Int   s;\r\n    FT_Long  d;\r\n\r\n\r\n    s = 1;\r\n    if ( a < 0 ) { a = -a; s = -1; }\r\n    if ( b < 0 ) { b = -b; s = -s; }\r\n    if ( c < 0 ) { c = -c; s = -s; }\r\n\r\n    d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c\r\n                         : 0x7FFFFFFFL );\r\n\r\n    return ( s > 0 ) ? d : -d;\r\n  }\r\n\r\n#endif /* __FTMISC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/ftraster.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftraster.c                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph rasterizer (body).                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2005, 2007-2012 by                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file can be compiled without the rest of the FreeType engine, by */\r\n  /* defining the _STANDALONE_ macro when compiling it.  You also need to  */\r\n  /* put the files `ftimage.h' and `ftmisc.h' into the $(incdir)           */\r\n  /* directory.  Typically, you should do something like                   */\r\n  /*                                                                       */\r\n  /* - copy `src/raster/ftraster.c' (this file) to your current directory  */\r\n  /*                                                                       */\r\n  /* - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h'         */\r\n  /*   to your current directory                                           */\r\n  /*                                                                       */\r\n  /* - compile `ftraster' with the _STANDALONE_ macro defined, as in       */\r\n  /*                                                                       */\r\n  /*     cc -c -D_STANDALONE_ ftraster.c                                   */\r\n  /*                                                                       */\r\n  /* The renderer can be initialized with a call to                        */\r\n  /* `ft_standard_raster.raster_new'; a bitmap can be generated            */\r\n  /* with a call to `ft_standard_raster.raster_render'.                    */\r\n  /*                                                                       */\r\n  /* See the comments and documentation in the file `ftimage.h' for more   */\r\n  /* details on how the raster works.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This is a rewrite of the FreeType 1.x scan-line converter             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef _STANDALONE_\r\n\r\n#define FT_CONFIG_STANDARD_LIBRARY_H  <stdlib.h>\r\n\r\n#include <string.h>           /* for memset */\r\n\r\n#include \"ftmisc.h\"\r\n#include \"ftimage.h\"\r\n\r\n#else /* !_STANDALONE_ */\r\n\r\n#include <ft2build.h>\r\n#include \"ftraster.h\"\r\n#include FT_INTERNAL_CALC_H   /* for FT_MulDiv and FT_MulDiv_No_Round */\r\n\r\n#include \"rastpic.h\"\r\n\r\n#endif /* !_STANDALONE_ */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A simple technical note on how the raster works                       */\r\n  /* -----------------------------------------------                       */\r\n  /*                                                                       */\r\n  /*   Converting an outline into a bitmap is achieved in several steps:   */\r\n  /*                                                                       */\r\n  /*   1 - Decomposing the outline into successive `profiles'.  Each       */\r\n  /*       profile is simply an array of scanline intersections on a given */\r\n  /*       dimension.  A profile's main attributes are                     */\r\n  /*                                                                       */\r\n  /*       o its scanline position boundaries, i.e. `Ymin' and `Ymax'      */\r\n  /*                                                                       */\r\n  /*       o an array of intersection coordinates for each scanline        */\r\n  /*         between `Ymin' and `Ymax'                                     */\r\n  /*                                                                       */\r\n  /*       o a direction, indicating whether it was built going `up' or    */\r\n  /*         `down', as this is very important for filling rules           */\r\n  /*                                                                       */\r\n  /*       o its drop-out mode                                             */\r\n  /*                                                                       */\r\n  /*   2 - Sweeping the target map's scanlines in order to compute segment */\r\n  /*       `spans' which are then filled.  Additionally, this pass         */\r\n  /*       performs drop-out control.                                      */\r\n  /*                                                                       */\r\n  /*   The outline data is parsed during step 1 only.  The profiles are    */\r\n  /*   built from the bottom of the render pool, used as a stack.  The     */\r\n  /*   following graphics shows the profile list under construction:       */\r\n  /*                                                                       */\r\n  /*     __________________________________________________________ _ _    */\r\n  /*    |         |                 |         |                 |          */\r\n  /*    | profile | coordinates for | profile | coordinates for |-->       */\r\n  /*    |    1    |  profile 1      |    2    |  profile 2      |-->       */\r\n  /*    |_________|_________________|_________|_________________|__ _ _    */\r\n  /*                                                                       */\r\n  /*    ^                                                       ^          */\r\n  /*    |                                                       |          */\r\n  /* start of render pool                                      top         */\r\n  /*                                                                       */\r\n  /*   The top of the profile stack is kept in the `top' variable.         */\r\n  /*                                                                       */\r\n  /*   As you can see, a profile record is pushed on top of the render     */\r\n  /*   pool, which is then followed by its coordinates/intersections.  If  */\r\n  /*   a change of direction is detected in the outline, a new profile is  */\r\n  /*   generated until the end of the outline.                             */\r\n  /*                                                                       */\r\n  /*   Note that when all profiles have been generated, the function       */\r\n  /*   Finalize_Profile_Table() is used to record, for each profile, its   */\r\n  /*   bottom-most scanline as well as the scanline above its upmost       */\r\n  /*   boundary.  These positions are called `y-turns' because they (sort  */\r\n  /*   of) correspond to local extrema.  They are stored in a sorted list  */\r\n  /*   built from the top of the render pool as a downwards stack:         */\r\n  /*                                                                       */\r\n  /*      _ _ _______________________________________                      */\r\n  /*                            |                    |                     */\r\n  /*                         <--| sorted list of     |                     */\r\n  /*                         <--|  extrema scanlines |                     */\r\n  /*      _ _ __________________|____________________|                     */\r\n  /*                                                                       */\r\n  /*                            ^                    ^                     */\r\n  /*                            |                    |                     */\r\n  /*                         maxBuff           sizeBuff = end of pool      */\r\n  /*                                                                       */\r\n  /*   This list is later used during the sweep phase in order to          */\r\n  /*   optimize performance (see technical note on the sweep below).       */\r\n  /*                                                                       */\r\n  /*   Of course, the raster detects whether the two stacks collide and    */\r\n  /*   handles the situation properly.                                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**                                                                     **/\r\n  /**  CONFIGURATION MACROS                                               **/\r\n  /**                                                                     **/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* define DEBUG_RASTER if you want to compile a debugging version */\r\n/* #define DEBUG_RASTER */\r\n\r\n  /* define FT_RASTER_OPTION_ANTI_ALIASING if you want to support */\r\n  /* 5-levels anti-aliasing                                       */\r\n/* #define FT_RASTER_OPTION_ANTI_ALIASING */\r\n\r\n  /* The size of the two-lines intermediate bitmap used */\r\n  /* for anti-aliasing, in bytes.                       */\r\n#define RASTER_GRAY_LINES  2048\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**                                                                     **/\r\n  /**  OTHER MACROS (do not change)                                       **/\r\n  /**                                                                     **/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_raster\r\n\r\n\r\n#ifdef _STANDALONE_\r\n\r\n\r\n  /* This macro is used to indicate that a function parameter is unused. */\r\n  /* Its purpose is simply to reduce compiler warnings.  Note also that  */\r\n  /* simply defining it as `(void)x' doesn't avoid warnings with certain */\r\n  /* ANSI compilers (e.g. LCC).                                          */\r\n#define FT_UNUSED( x )  (x) = (x)\r\n\r\n  /* Disable the tracing mechanism for simplicity -- developers can      */\r\n  /* activate it easily by redefining these two macros.                  */\r\n#ifndef FT_ERROR\r\n#define FT_ERROR( x )  do { } while ( 0 )     /* nothing */\r\n#endif\r\n\r\n#ifndef FT_TRACE\r\n#define FT_TRACE( x )   do { } while ( 0 )    /* nothing */\r\n#define FT_TRACE1( x )  do { } while ( 0 )    /* nothing */\r\n#define FT_TRACE6( x )  do { } while ( 0 )    /* nothing */\r\n#endif\r\n\r\n#define Raster_Err_None          0\r\n#define Raster_Err_Not_Ini      -1\r\n#define Raster_Err_Overflow     -2\r\n#define Raster_Err_Neg_Height   -3\r\n#define Raster_Err_Invalid      -4\r\n#define Raster_Err_Unsupported  -5\r\n\r\n#define ft_memset  memset\r\n\r\n#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, \\\r\n                                raster_reset_, raster_set_mode_,    \\\r\n                                raster_render_, raster_done_ )      \\\r\n          const FT_Raster_Funcs class_ =                            \\\r\n          {                                                         \\\r\n            glyph_format_,                                          \\\r\n            raster_new_,                                            \\\r\n            raster_reset_,                                          \\\r\n            raster_set_mode_,                                       \\\r\n            raster_render_,                                         \\\r\n            raster_done_                                            \\\r\n         };\r\n\r\n#else /* !_STANDALONE_ */\r\n\r\n\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H        /* for FT_TRACE() and FT_ERROR() */\r\n\r\n#include \"rasterrs.h\"\r\n\r\n#define Raster_Err_None         Raster_Err_Ok\r\n#define Raster_Err_Not_Ini      Raster_Err_Raster_Uninitialized\r\n#define Raster_Err_Overflow     Raster_Err_Raster_Overflow\r\n#define Raster_Err_Neg_Height   Raster_Err_Raster_Negative_Height\r\n#define Raster_Err_Invalid      Raster_Err_Invalid_Outline\r\n#define Raster_Err_Unsupported  Raster_Err_Cannot_Render_Glyph\r\n\r\n\r\n#endif /* !_STANDALONE_ */\r\n\r\n\r\n#ifndef FT_MEM_SET\r\n#define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )\r\n#endif\r\n\r\n#ifndef FT_MEM_ZERO\r\n#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )\r\n#endif\r\n\r\n  /* FMulDiv means `Fast MulDiv'; it is used in case where `b' is       */\r\n  /* typically a small value and the result of a*b is known to fit into */\r\n  /* 32 bits.                                                           */\r\n#define FMulDiv( a, b, c )  ( (a) * (b) / (c) )\r\n\r\n  /* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */\r\n  /* for clipping computations.  It simply uses the FT_MulDiv() function   */\r\n  /* defined in `ftcalc.h'.                                                */\r\n#define SMulDiv           FT_MulDiv\r\n#define SMulDiv_No_Round  FT_MulDiv_No_Round\r\n\r\n  /* The rasterizer is a very general purpose component; please leave */\r\n  /* the following redefinitions there (you never know your target    */\r\n  /* environment).                                                    */\r\n\r\n#ifndef TRUE\r\n#define TRUE   1\r\n#endif\r\n\r\n#ifndef FALSE\r\n#define FALSE  0\r\n#endif\r\n\r\n#ifndef NULL\r\n#define NULL  (void*)0\r\n#endif\r\n\r\n#ifndef SUCCESS\r\n#define SUCCESS  0\r\n#endif\r\n\r\n#ifndef FAILURE\r\n#define FAILURE  1\r\n#endif\r\n\r\n\r\n#define MaxBezier  32   /* The maximum number of stacked Bezier curves. */\r\n                        /* Setting this constant to more than 32 is a   */\r\n                        /* pure waste of space.                         */\r\n\r\n#define Pixel_Bits  6   /* fractional bits of *input* coordinates */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**                                                                     **/\r\n  /**  SIMPLE TYPE DECLARATIONS                                           **/\r\n  /**                                                                     **/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef int             Int;\r\n  typedef unsigned int    UInt;\r\n  typedef short           Short;\r\n  typedef unsigned short  UShort, *PUShort;\r\n  typedef long            Long, *PLong;\r\n\r\n  typedef unsigned char   Byte, *PByte;\r\n  typedef char            Bool;\r\n\r\n\r\n  typedef union  Alignment_\r\n  {\r\n    long    l;\r\n    void*   p;\r\n    void  (*f)(void);\r\n\r\n  } Alignment, *PAlignment;\r\n\r\n\r\n  typedef struct  TPoint_\r\n  {\r\n    Long  x;\r\n    Long  y;\r\n\r\n  } TPoint;\r\n\r\n\r\n  /* values for the `flags' bit field */\r\n#define Flow_Up           0x8\r\n#define Overshoot_Top     0x10\r\n#define Overshoot_Bottom  0x20\r\n\r\n\r\n  /* States of each line, arc, and profile */\r\n  typedef enum  TStates_\r\n  {\r\n    Unknown_State,\r\n    Ascending_State,\r\n    Descending_State,\r\n    Flat_State\r\n\r\n  } TStates;\r\n\r\n\r\n  typedef struct TProfile_  TProfile;\r\n  typedef TProfile*         PProfile;\r\n\r\n  struct  TProfile_\r\n  {\r\n    FT_F26Dot6  X;           /* current coordinate during sweep          */\r\n    PProfile    link;        /* link to next profile (various purposes)  */\r\n    PLong       offset;      /* start of profile's data in render pool   */\r\n    unsigned    flags;       /* Bit 0-2: drop-out mode                   */\r\n                             /* Bit 3: profile orientation (up/down)     */\r\n                             /* Bit 4: is top profile?                   */\r\n                             /* Bit 5: is bottom profile?                */\r\n    long        height;      /* profile's height in scanlines            */\r\n    long        start;       /* profile's starting scanline              */\r\n\r\n    unsigned    countL;      /* number of lines to step before this      */\r\n                             /* profile becomes drawable                 */\r\n\r\n    PProfile    next;        /* next profile in same contour, used       */\r\n                             /* during drop-out control                  */\r\n  };\r\n\r\n  typedef PProfile   TProfileList;\r\n  typedef PProfile*  PProfileList;\r\n\r\n\r\n  /* Simple record used to implement a stack of bands, required */\r\n  /* by the sub-banding mechanism                               */\r\n  typedef struct  black_TBand_\r\n  {\r\n    Short  y_min;   /* band's minimum */\r\n    Short  y_max;   /* band's maximum */\r\n\r\n  } black_TBand;\r\n\r\n\r\n#define AlignProfileSize \\\r\n  ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) )\r\n\r\n\r\n#undef RAS_ARG\r\n#undef RAS_ARGS\r\n#undef RAS_VAR\r\n#undef RAS_VARS\r\n\r\n#ifdef FT_STATIC_RASTER\r\n\r\n\r\n#define RAS_ARGS       /* void */\r\n#define RAS_ARG        /* void */\r\n\r\n#define RAS_VARS       /* void */\r\n#define RAS_VAR        /* void */\r\n\r\n#define FT_UNUSED_RASTER  do { } while ( 0 )\r\n\r\n\r\n#else /* !FT_STATIC_RASTER */\r\n\r\n\r\n#define RAS_ARGS       black_PWorker  worker,\r\n#define RAS_ARG        black_PWorker  worker\r\n\r\n#define RAS_VARS       worker,\r\n#define RAS_VAR        worker\r\n\r\n#define FT_UNUSED_RASTER  FT_UNUSED( worker )\r\n\r\n\r\n#endif /* !FT_STATIC_RASTER */\r\n\r\n\r\n  typedef struct black_TWorker_  black_TWorker, *black_PWorker;\r\n\r\n\r\n  /* prototypes used for sweep function dispatch */\r\n  typedef void\r\n  Function_Sweep_Init( RAS_ARGS Short*  min,\r\n                                Short*  max );\r\n\r\n  typedef void\r\n  Function_Sweep_Span( RAS_ARGS Short       y,\r\n                                FT_F26Dot6  x1,\r\n                                FT_F26Dot6  x2,\r\n                                PProfile    left,\r\n                                PProfile    right );\r\n\r\n  typedef void\r\n  Function_Sweep_Step( RAS_ARG );\r\n\r\n\r\n  /* NOTE: These operations are only valid on 2's complement processors */\r\n#undef FLOOR\r\n#undef CEILING\r\n#undef TRUNC\r\n#undef SCALED\r\n\r\n#define FLOOR( x )    ( (x) & -ras.precision )\r\n#define CEILING( x )  ( ( (x) + ras.precision - 1 ) & -ras.precision )\r\n#define TRUNC( x )    ( (signed long)(x) >> ras.precision_bits )\r\n#define FRAC( x )     ( (x) & ( ras.precision - 1 ) )\r\n#define SCALED( x )   ( ( (x) << ras.scale_shift ) - ras.precision_half )\r\n\r\n#define IS_BOTTOM_OVERSHOOT( x )  ( CEILING( x ) - x >= ras.precision_half )\r\n#define IS_TOP_OVERSHOOT( x )     ( x - FLOOR( x ) >= ras.precision_half )\r\n\r\n  /* The most used variables are positioned at the top of the structure. */\r\n  /* Thus, their offset can be coded with less opcodes, resulting in a   */\r\n  /* smaller executable.                                                 */\r\n\r\n  struct  black_TWorker_\r\n  {\r\n    Int         precision_bits;     /* precision related variables         */\r\n    Int         precision;\r\n    Int         precision_half;\r\n    Int         precision_shift;\r\n    Int         precision_step;\r\n    Int         precision_jitter;\r\n\r\n    Int         scale_shift;        /* == precision_shift   for bitmaps    */\r\n                                    /* == precision_shift+1 for pixmaps    */\r\n\r\n    PLong       buff;               /* The profiles buffer                 */\r\n    PLong       sizeBuff;           /* Render pool size                    */\r\n    PLong       maxBuff;            /* Profiles buffer size                */\r\n    PLong       top;                /* Current cursor in buffer            */\r\n\r\n    FT_Error    error;\r\n\r\n    Int         numTurns;           /* number of Y-turns in outline        */\r\n\r\n    TPoint*     arc;                /* current Bezier arc pointer          */\r\n\r\n    UShort      bWidth;             /* target bitmap width                 */\r\n    PByte       bTarget;            /* target bitmap buffer                */\r\n    PByte       gTarget;            /* target pixmap buffer                */\r\n\r\n    Long        lastX, lastY;\r\n    Long        minY, maxY;\r\n\r\n    UShort      num_Profs;          /* current number of profiles          */\r\n\r\n    Bool        fresh;              /* signals a fresh new profile which   */\r\n                                    /* `start' field must be completed     */\r\n    Bool        joint;              /* signals that the last arc ended     */\r\n                                    /* exactly on a scanline.  Allows      */\r\n                                    /* removal of doublets                 */\r\n    PProfile    cProfile;           /* current profile                     */\r\n    PProfile    fProfile;           /* head of linked list of profiles     */\r\n    PProfile    gProfile;           /* contour's first profile in case     */\r\n                                    /* of impact                           */\r\n\r\n    TStates     state;              /* rendering state                     */\r\n\r\n    FT_Bitmap   target;             /* description of target bit/pixmap    */\r\n    FT_Outline  outline;\r\n\r\n    Long        traceOfs;           /* current offset in target bitmap     */\r\n    Long        traceG;             /* current offset in target pixmap     */\r\n\r\n    Short       traceIncr;          /* sweep's increment in target bitmap  */\r\n\r\n    Short       gray_min_x;         /* current min x during gray rendering */\r\n    Short       gray_max_x;         /* current max x during gray rendering */\r\n\r\n    /* dispatch variables */\r\n\r\n    Function_Sweep_Init*  Proc_Sweep_Init;\r\n    Function_Sweep_Span*  Proc_Sweep_Span;\r\n    Function_Sweep_Span*  Proc_Sweep_Drop;\r\n    Function_Sweep_Step*  Proc_Sweep_Step;\r\n\r\n    Byte        dropOutControl;     /* current drop_out control method     */\r\n\r\n    Bool        second_pass;        /* indicates whether a horizontal pass */\r\n                                    /* should be performed to control      */\r\n                                    /* drop-out accurately when calling    */\r\n                                    /* Render_Glyph.  Note that there is   */\r\n                                    /* no horizontal pass during gray      */\r\n                                    /* rendering.                          */\r\n\r\n    TPoint      arcs[3 * MaxBezier + 1]; /* The Bezier stack               */\r\n\r\n    black_TBand  band_stack[16];    /* band stack used for sub-banding     */\r\n    Int          band_top;          /* band stack top                      */\r\n\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n\r\n    Byte*       grays;\r\n\r\n    Byte        gray_lines[RASTER_GRAY_LINES];\r\n                                /* Intermediate table used to render the   */\r\n                                /* graylevels pixmaps.                     */\r\n                                /* gray_lines is a buffer holding two      */\r\n                                /* monochrome scanlines                    */\r\n\r\n    Short       gray_width;     /* width in bytes of one monochrome        */\r\n                                /* intermediate scanline of gray_lines.    */\r\n                                /* Each gray pixel takes 2 bits long there */\r\n\r\n                       /* The gray_lines must hold 2 lines, thus with size */\r\n                       /* in bytes of at least `gray_width*2'.             */\r\n\r\n#endif /* FT_RASTER_ANTI_ALIASING */\r\n\r\n  };\r\n\r\n\r\n  typedef struct  black_TRaster_\r\n  {\r\n    char*          buffer;\r\n    long           buffer_size;\r\n    void*          memory;\r\n    black_PWorker  worker;\r\n    Byte           grays[5];\r\n    Short          gray_width;\r\n\r\n  } black_TRaster, *black_PRaster;\r\n\r\n#ifdef FT_STATIC_RASTER\r\n\r\n  static black_TWorker  cur_ras;\r\n#define ras  cur_ras\r\n\r\n#else /* !FT_STATIC_RASTER */\r\n\r\n#define ras  (*worker)\r\n\r\n#endif /* !FT_STATIC_RASTER */\r\n\r\n\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n\r\n  /* A lookup table used to quickly count set bits in four gray 2x2 */\r\n  /* cells.  The values of the table have been produced with the    */\r\n  /* following code:                                                */\r\n  /*                                                                */\r\n  /*   for ( i = 0; i < 256; i++ )                                  */\r\n  /*   {                                                            */\r\n  /*     l = 0;                                                     */\r\n  /*     j = i;                                                     */\r\n  /*                                                                */\r\n  /*     for ( c = 0; c < 4; c++ )                                  */\r\n  /*     {                                                          */\r\n  /*       l <<= 4;                                                 */\r\n  /*                                                                */\r\n  /*       if ( j & 0x80 ) l++;                                     */\r\n  /*       if ( j & 0x40 ) l++;                                     */\r\n  /*                                                                */\r\n  /*       j = ( j << 2 ) & 0xFF;                                   */\r\n  /*     }                                                          */\r\n  /*     printf( \"0x%04X\", l );                                     */\r\n  /*   }                                                            */\r\n  /*                                                                */\r\n\r\n  static const short  count_table[256] =\r\n  {\r\n    0x0000, 0x0001, 0x0001, 0x0002, 0x0010, 0x0011, 0x0011, 0x0012,\r\n    0x0010, 0x0011, 0x0011, 0x0012, 0x0020, 0x0021, 0x0021, 0x0022,\r\n    0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,\r\n    0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,\r\n    0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,\r\n    0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,\r\n    0x0200, 0x0201, 0x0201, 0x0202, 0x0210, 0x0211, 0x0211, 0x0212,\r\n    0x0210, 0x0211, 0x0211, 0x0212, 0x0220, 0x0221, 0x0221, 0x0222,\r\n    0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,\r\n    0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,\r\n    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,\r\n    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,\r\n    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,\r\n    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,\r\n    0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,\r\n    0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,\r\n    0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,\r\n    0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,\r\n    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,\r\n    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,\r\n    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,\r\n    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,\r\n    0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,\r\n    0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,\r\n    0x2000, 0x2001, 0x2001, 0x2002, 0x2010, 0x2011, 0x2011, 0x2012,\r\n    0x2010, 0x2011, 0x2011, 0x2012, 0x2020, 0x2021, 0x2021, 0x2022,\r\n    0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,\r\n    0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,\r\n    0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,\r\n    0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,\r\n    0x2200, 0x2201, 0x2201, 0x2202, 0x2210, 0x2211, 0x2211, 0x2212,\r\n    0x2210, 0x2211, 0x2211, 0x2212, 0x2220, 0x2221, 0x2221, 0x2222\r\n  };\r\n\r\n#endif /* FT_RASTER_OPTION_ANTI_ALIASING */\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**                                                                     **/\r\n  /**  PROFILES COMPUTATION                                               **/\r\n  /**                                                                     **/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Set_High_Precision                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set precision variables according to param flag.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    High :: Set to True for high precision (typically for ppem < 18),  */\r\n  /*            false otherwise.                                           */\r\n  /*                                                                       */\r\n  static void\r\n  Set_High_Precision( RAS_ARGS Int  High )\r\n  {\r\n    /*\r\n     * `precision_step' is used in `Bezier_Up' to decide when to split a\r\n     * given y-monotonous Bezier arc that crosses a scanline before\r\n     * approximating it as a straight segment.  The default value of 32 (for\r\n     * low accuracy) corresponds to\r\n     *\r\n     *   32 / 64 == 0.5 pixels ,\r\n     *\r\n     * while for the high accuracy case we have\r\n     *\r\n     *   256/ (1 << 12) = 0.0625 pixels .\r\n     *\r\n     * `precision_jitter' is an epsilon threshold used in\r\n     * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier\r\n     * decomposition (after all, we are working with approximations only);\r\n     * it avoids switching on additional pixels which would cause artifacts\r\n     * otherwise.\r\n     *\r\n     * The value of `precision_jitter' has been determined heuristically.\r\n     *\r\n     */\r\n\r\n    if ( High )\r\n    {\r\n      ras.precision_bits   = 12;\r\n      ras.precision_step   = 256;\r\n      ras.precision_jitter = 30;\r\n    }\r\n    else\r\n    {\r\n      ras.precision_bits   = 6;\r\n      ras.precision_step   = 32;\r\n      ras.precision_jitter = 2;\r\n    }\r\n\r\n    FT_TRACE6(( \"Set_High_Precision(%s)\\n\", High ? \"true\" : \"false\" ));\r\n\r\n    ras.precision       = 1 << ras.precision_bits;\r\n    ras.precision_half  = ras.precision / 2;\r\n    ras.precision_shift = ras.precision_bits - Pixel_Bits;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    New_Profile                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new profile in the render pool.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    aState    :: The state/orientation of the new profile.             */\r\n  /*                                                                       */\r\n  /*    overshoot :: Whether the profile's unrounded start position        */\r\n  /*                 differs by at least a half pixel.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   SUCCESS on success.  FAILURE in case of overflow or of incoherent   */\r\n  /*   profile.                                                            */\r\n  /*                                                                       */\r\n  static Bool\r\n  New_Profile( RAS_ARGS TStates  aState,\r\n                        Bool     overshoot )\r\n  {\r\n    if ( !ras.fProfile )\r\n    {\r\n      ras.cProfile  = (PProfile)ras.top;\r\n      ras.fProfile  = ras.cProfile;\r\n      ras.top      += AlignProfileSize;\r\n    }\r\n\r\n    if ( ras.top >= ras.maxBuff )\r\n    {\r\n      ras.error = Raster_Err_Overflow;\r\n      return FAILURE;\r\n    }\r\n\r\n    ras.cProfile->flags  = 0;\r\n    ras.cProfile->start  = 0;\r\n    ras.cProfile->height = 0;\r\n    ras.cProfile->offset = ras.top;\r\n    ras.cProfile->link   = (PProfile)0;\r\n    ras.cProfile->next   = (PProfile)0;\r\n    ras.cProfile->flags  = ras.dropOutControl;\r\n\r\n    switch ( aState )\r\n    {\r\n    case Ascending_State:\r\n      ras.cProfile->flags |= Flow_Up;\r\n      if ( overshoot )\r\n        ras.cProfile->flags |= Overshoot_Bottom;\r\n\r\n      FT_TRACE6(( \"New ascending profile = %p\\n\", ras.cProfile ));\r\n      break;\r\n\r\n    case Descending_State:\r\n      if ( overshoot )\r\n        ras.cProfile->flags |= Overshoot_Top;\r\n      FT_TRACE6(( \"New descending profile = %p\\n\", ras.cProfile ));\r\n      break;\r\n\r\n    default:\r\n      FT_ERROR(( \"New_Profile: invalid profile direction\\n\" ));\r\n      ras.error = Raster_Err_Invalid;\r\n      return FAILURE;\r\n    }\r\n\r\n    if ( !ras.gProfile )\r\n      ras.gProfile = ras.cProfile;\r\n\r\n    ras.state = aState;\r\n    ras.fresh = TRUE;\r\n    ras.joint = FALSE;\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    End_Profile                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalize the current profile.                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    overshoot :: Whether the profile's unrounded end position differs  */\r\n  /*                 by at least a half pixel.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success.  FAILURE in case of overflow or incoherency.   */\r\n  /*                                                                       */\r\n  static Bool\r\n  End_Profile( RAS_ARGS Bool  overshoot )\r\n  {\r\n    Long      h;\r\n    PProfile  oldProfile;\r\n\r\n\r\n    h = (Long)( ras.top - ras.cProfile->offset );\r\n\r\n    if ( h < 0 )\r\n    {\r\n      FT_ERROR(( \"End_Profile: negative height encountered\\n\" ));\r\n      ras.error = Raster_Err_Neg_Height;\r\n      return FAILURE;\r\n    }\r\n\r\n    if ( h > 0 )\r\n    {\r\n      FT_TRACE6(( \"Ending profile %p, start = %ld, height = %ld\\n\",\r\n                  ras.cProfile, ras.cProfile->start, h ));\r\n\r\n      ras.cProfile->height = h;\r\n      if ( overshoot )\r\n      {\r\n        if ( ras.cProfile->flags & Flow_Up )\r\n          ras.cProfile->flags |= Overshoot_Top;\r\n        else\r\n          ras.cProfile->flags |= Overshoot_Bottom;\r\n      }\r\n\r\n      oldProfile   = ras.cProfile;\r\n      ras.cProfile = (PProfile)ras.top;\r\n\r\n      ras.top += AlignProfileSize;\r\n\r\n      ras.cProfile->height = 0;\r\n      ras.cProfile->offset = ras.top;\r\n\r\n      oldProfile->next = ras.cProfile;\r\n      ras.num_Profs++;\r\n    }\r\n\r\n    if ( ras.top >= ras.maxBuff )\r\n    {\r\n      FT_TRACE1(( \"overflow in End_Profile\\n\" ));\r\n      ras.error = Raster_Err_Overflow;\r\n      return FAILURE;\r\n    }\r\n\r\n    ras.joint = FALSE;\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Insert_Y_Turn                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Insert a salient into the sorted list placed on top of the render  */\r\n  /*    pool.                                                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    New y scanline position.                                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success.  FAILURE in case of overflow.                  */\r\n  /*                                                                       */\r\n  static Bool\r\n  Insert_Y_Turn( RAS_ARGS Int  y )\r\n  {\r\n    PLong  y_turns;\r\n    Int    y2, n;\r\n\r\n\r\n    n       = ras.numTurns - 1;\r\n    y_turns = ras.sizeBuff - ras.numTurns;\r\n\r\n    /* look for first y value that is <= */\r\n    while ( n >= 0 && y < y_turns[n] )\r\n      n--;\r\n\r\n    /* if it is <, simply insert it, ignore if == */\r\n    if ( n >= 0 && y > y_turns[n] )\r\n      while ( n >= 0 )\r\n      {\r\n        y2 = (Int)y_turns[n];\r\n        y_turns[n] = y;\r\n        y = y2;\r\n        n--;\r\n      }\r\n\r\n    if ( n < 0 )\r\n    {\r\n      ras.maxBuff--;\r\n      if ( ras.maxBuff <= ras.top )\r\n      {\r\n        ras.error = Raster_Err_Overflow;\r\n        return FAILURE;\r\n      }\r\n      ras.numTurns++;\r\n      ras.sizeBuff[-ras.numTurns] = y;\r\n    }\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Finalize_Profile_Table                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Adjust all links in the profiles list.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success.  FAILURE in case of overflow.                  */\r\n  /*                                                                       */\r\n  static Bool\r\n  Finalize_Profile_Table( RAS_ARG )\r\n  {\r\n    Int       bottom, top;\r\n    UShort    n;\r\n    PProfile  p;\r\n\r\n\r\n    n = ras.num_Profs;\r\n    p = ras.fProfile;\r\n\r\n    if ( n > 1 && p )\r\n    {\r\n      while ( n > 0 )\r\n      {\r\n        if ( n > 1 )\r\n          p->link = (PProfile)( p->offset + p->height );\r\n        else\r\n          p->link = NULL;\r\n\r\n        if ( p->flags & Flow_Up )\r\n        {\r\n          bottom = (Int)p->start;\r\n          top    = (Int)( p->start + p->height - 1 );\r\n        }\r\n        else\r\n        {\r\n          bottom     = (Int)( p->start - p->height + 1 );\r\n          top        = (Int)p->start;\r\n          p->start   = bottom;\r\n          p->offset += p->height - 1;\r\n        }\r\n\r\n        if ( Insert_Y_Turn( RAS_VARS bottom )  ||\r\n             Insert_Y_Turn( RAS_VARS top + 1 ) )\r\n          return FAILURE;\r\n\r\n        p = p->link;\r\n        n--;\r\n      }\r\n    }\r\n    else\r\n      ras.fProfile = NULL;\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Split_Conic                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Subdivide one conic Bezier into two joint sub-arcs in the Bezier   */\r\n  /*    stack.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    None (subdivided Bezier is taken from the top of the stack).       */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This routine is the `beef' of this component.  It is  _the_ inner  */\r\n  /*    loop that should be optimized to hell to get the best performance. */\r\n  /*                                                                       */\r\n  static void\r\n  Split_Conic( TPoint*  base )\r\n  {\r\n    Long  a, b;\r\n\r\n\r\n    base[4].x = base[2].x;\r\n    b = base[1].x;\r\n    a = base[3].x = ( base[2].x + b ) / 2;\r\n    b = base[1].x = ( base[0].x + b ) / 2;\r\n    base[2].x = ( a + b ) / 2;\r\n\r\n    base[4].y = base[2].y;\r\n    b = base[1].y;\r\n    a = base[3].y = ( base[2].y + b ) / 2;\r\n    b = base[1].y = ( base[0].y + b ) / 2;\r\n    base[2].y = ( a + b ) / 2;\r\n\r\n    /* hand optimized.  gcc doesn't seem to be too good at common      */\r\n    /* expression substitution and instruction scheduling ;-)          */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Split_Cubic                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Subdivide a third-order Bezier arc into two joint sub-arcs in the  */\r\n  /*    Bezier stack.                                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This routine is the `beef' of the component.  It is one of _the_   */\r\n  /*    inner loops that should be optimized like hell to get the best     */\r\n  /*    performance.                                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Split_Cubic( TPoint*  base )\r\n  {\r\n    Long  a, b, c, d;\r\n\r\n\r\n    base[6].x = base[3].x;\r\n    c = base[1].x;\r\n    d = base[2].x;\r\n    base[1].x = a = ( base[0].x + c + 1 ) >> 1;\r\n    base[5].x = b = ( base[3].x + d + 1 ) >> 1;\r\n    c = ( c + d + 1 ) >> 1;\r\n    base[2].x = a = ( a + c + 1 ) >> 1;\r\n    base[4].x = b = ( b + c + 1 ) >> 1;\r\n    base[3].x = ( a + b + 1 ) >> 1;\r\n\r\n    base[6].y = base[3].y;\r\n    c = base[1].y;\r\n    d = base[2].y;\r\n    base[1].y = a = ( base[0].y + c + 1 ) >> 1;\r\n    base[5].y = b = ( base[3].y + d + 1 ) >> 1;\r\n    c = ( c + d + 1 ) >> 1;\r\n    base[2].y = a = ( a + c + 1 ) >> 1;\r\n    base[4].y = b = ( b + c + 1 ) >> 1;\r\n    base[3].y = ( a + b + 1 ) >> 1;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Line_Up                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Compute the x-coordinates of an ascending line segment and store   */\r\n  /*    them in the render pool.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    x1   :: The x-coordinate of the segment's start point.             */\r\n  /*                                                                       */\r\n  /*    y1   :: The y-coordinate of the segment's start point.             */\r\n  /*                                                                       */\r\n  /*    x2   :: The x-coordinate of the segment's end point.               */\r\n  /*                                                                       */\r\n  /*    y2   :: The y-coordinate of the segment's end point.               */\r\n  /*                                                                       */\r\n  /*    miny :: A lower vertical clipping bound value.                     */\r\n  /*                                                                       */\r\n  /*    maxy :: An upper vertical clipping bound value.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success, FAILURE on render pool overflow.               */\r\n  /*                                                                       */\r\n  static Bool\r\n  Line_Up( RAS_ARGS Long  x1,\r\n                    Long  y1,\r\n                    Long  x2,\r\n                    Long  y2,\r\n                    Long  miny,\r\n                    Long  maxy )\r\n  {\r\n    Long   Dx, Dy;\r\n    Int    e1, e2, f1, f2, size;     /* XXX: is `Short' sufficient? */\r\n    Long   Ix, Rx, Ax;\r\n\r\n    PLong  top;\r\n\r\n\r\n    Dx = x2 - x1;\r\n    Dy = y2 - y1;\r\n\r\n    if ( Dy <= 0 || y2 < miny || y1 > maxy )\r\n      return SUCCESS;\r\n\r\n    if ( y1 < miny )\r\n    {\r\n      /* Take care: miny-y1 can be a very large value; we use     */\r\n      /*            a slow MulDiv function to avoid clipping bugs */\r\n      x1 += SMulDiv( Dx, miny - y1, Dy );\r\n      e1  = (Int)TRUNC( miny );\r\n      f1  = 0;\r\n    }\r\n    else\r\n    {\r\n      e1 = (Int)TRUNC( y1 );\r\n      f1 = (Int)FRAC( y1 );\r\n    }\r\n\r\n    if ( y2 > maxy )\r\n    {\r\n      /* x2 += FMulDiv( Dx, maxy - y2, Dy );  UNNECESSARY */\r\n      e2  = (Int)TRUNC( maxy );\r\n      f2  = 0;\r\n    }\r\n    else\r\n    {\r\n      e2 = (Int)TRUNC( y2 );\r\n      f2 = (Int)FRAC( y2 );\r\n    }\r\n\r\n    if ( f1 > 0 )\r\n    {\r\n      if ( e1 == e2 )\r\n        return SUCCESS;\r\n      else\r\n      {\r\n        x1 += SMulDiv( Dx, ras.precision - f1, Dy );\r\n        e1 += 1;\r\n      }\r\n    }\r\n    else\r\n      if ( ras.joint )\r\n      {\r\n        ras.top--;\r\n        ras.joint = FALSE;\r\n      }\r\n\r\n    ras.joint = (char)( f2 == 0 );\r\n\r\n    if ( ras.fresh )\r\n    {\r\n      ras.cProfile->start = e1;\r\n      ras.fresh           = FALSE;\r\n    }\r\n\r\n    size = e2 - e1 + 1;\r\n    if ( ras.top + size >= ras.maxBuff )\r\n    {\r\n      ras.error = Raster_Err_Overflow;\r\n      return FAILURE;\r\n    }\r\n\r\n    if ( Dx > 0 )\r\n    {\r\n      Ix = SMulDiv_No_Round( ras.precision, Dx, Dy );\r\n      Rx = ( ras.precision * Dx ) % Dy;\r\n      Dx = 1;\r\n    }\r\n    else\r\n    {\r\n      Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy );\r\n      Rx = ( ras.precision * -Dx ) % Dy;\r\n      Dx = -1;\r\n    }\r\n\r\n    Ax  = -Dy;\r\n    top = ras.top;\r\n\r\n    while ( size > 0 )\r\n    {\r\n      *top++ = x1;\r\n\r\n      x1 += Ix;\r\n      Ax += Rx;\r\n      if ( Ax >= 0 )\r\n      {\r\n        Ax -= Dy;\r\n        x1 += Dx;\r\n      }\r\n      size--;\r\n    }\r\n\r\n    ras.top = top;\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Line_Down                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Compute the x-coordinates of an descending line segment and store  */\r\n  /*    them in the render pool.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    x1   :: The x-coordinate of the segment's start point.             */\r\n  /*                                                                       */\r\n  /*    y1   :: The y-coordinate of the segment's start point.             */\r\n  /*                                                                       */\r\n  /*    x2   :: The x-coordinate of the segment's end point.               */\r\n  /*                                                                       */\r\n  /*    y2   :: The y-coordinate of the segment's end point.               */\r\n  /*                                                                       */\r\n  /*    miny :: A lower vertical clipping bound value.                     */\r\n  /*                                                                       */\r\n  /*    maxy :: An upper vertical clipping bound value.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success, FAILURE on render pool overflow.               */\r\n  /*                                                                       */\r\n  static Bool\r\n  Line_Down( RAS_ARGS Long  x1,\r\n                      Long  y1,\r\n                      Long  x2,\r\n                      Long  y2,\r\n                      Long  miny,\r\n                      Long  maxy )\r\n  {\r\n    Bool  result, fresh;\r\n\r\n\r\n    fresh  = ras.fresh;\r\n\r\n    result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );\r\n\r\n    if ( fresh && !ras.fresh )\r\n      ras.cProfile->start = -ras.cProfile->start;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /* A function type describing the functions used to split Bezier arcs */\r\n  typedef void  (*TSplitter)( TPoint*  base );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Bezier_Up                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Compute the x-coordinates of an ascending Bezier arc and store     */\r\n  /*    them in the render pool.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    degree   :: The degree of the Bezier arc (either 2 or 3).          */\r\n  /*                                                                       */\r\n  /*    splitter :: The function to split Bezier arcs.                     */\r\n  /*                                                                       */\r\n  /*    miny     :: A lower vertical clipping bound value.                 */\r\n  /*                                                                       */\r\n  /*    maxy     :: An upper vertical clipping bound value.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success, FAILURE on render pool overflow.               */\r\n  /*                                                                       */\r\n  static Bool\r\n  Bezier_Up( RAS_ARGS Int        degree,\r\n                      TSplitter  splitter,\r\n                      Long       miny,\r\n                      Long       maxy )\r\n  {\r\n    Long   y1, y2, e, e2, e0;\r\n    Short  f1;\r\n\r\n    TPoint*  arc;\r\n    TPoint*  start_arc;\r\n\r\n    PLong top;\r\n\r\n\r\n    arc = ras.arc;\r\n    y1  = arc[degree].y;\r\n    y2  = arc[0].y;\r\n    top = ras.top;\r\n\r\n    if ( y2 < miny || y1 > maxy )\r\n      goto Fin;\r\n\r\n    e2 = FLOOR( y2 );\r\n\r\n    if ( e2 > maxy )\r\n      e2 = maxy;\r\n\r\n    e0 = miny;\r\n\r\n    if ( y1 < miny )\r\n      e = miny;\r\n    else\r\n    {\r\n      e  = CEILING( y1 );\r\n      f1 = (Short)( FRAC( y1 ) );\r\n      e0 = e;\r\n\r\n      if ( f1 == 0 )\r\n      {\r\n        if ( ras.joint )\r\n        {\r\n          top--;\r\n          ras.joint = FALSE;\r\n        }\r\n\r\n        *top++ = arc[degree].x;\r\n\r\n        e += ras.precision;\r\n      }\r\n    }\r\n\r\n    if ( ras.fresh )\r\n    {\r\n      ras.cProfile->start = TRUNC( e0 );\r\n      ras.fresh = FALSE;\r\n    }\r\n\r\n    if ( e2 < e )\r\n      goto Fin;\r\n\r\n    if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )\r\n    {\r\n      ras.top   = top;\r\n      ras.error = Raster_Err_Overflow;\r\n      return FAILURE;\r\n    }\r\n\r\n    start_arc = arc;\r\n\r\n    while ( arc >= start_arc && e <= e2 )\r\n    {\r\n      ras.joint = FALSE;\r\n\r\n      y2 = arc[0].y;\r\n\r\n      if ( y2 > e )\r\n      {\r\n        y1 = arc[degree].y;\r\n        if ( y2 - y1 >= ras.precision_step )\r\n        {\r\n          splitter( arc );\r\n          arc += degree;\r\n        }\r\n        else\r\n        {\r\n          *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,\r\n                                            e - y1, y2 - y1 );\r\n          arc -= degree;\r\n          e   += ras.precision;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        if ( y2 == e )\r\n        {\r\n          ras.joint  = TRUE;\r\n          *top++     = arc[0].x;\r\n\r\n          e += ras.precision;\r\n        }\r\n        arc -= degree;\r\n      }\r\n    }\r\n\r\n  Fin:\r\n    ras.top  = top;\r\n    ras.arc -= degree;\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Bezier_Down                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Compute the x-coordinates of an descending Bezier arc and store    */\r\n  /*    them in the render pool.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    degree   :: The degree of the Bezier arc (either 2 or 3).          */\r\n  /*                                                                       */\r\n  /*    splitter :: The function to split Bezier arcs.                     */\r\n  /*                                                                       */\r\n  /*    miny     :: A lower vertical clipping bound value.                 */\r\n  /*                                                                       */\r\n  /*    maxy     :: An upper vertical clipping bound value.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success, FAILURE on render pool overflow.               */\r\n  /*                                                                       */\r\n  static Bool\r\n  Bezier_Down( RAS_ARGS Int        degree,\r\n                        TSplitter  splitter,\r\n                        Long       miny,\r\n                        Long       maxy )\r\n  {\r\n    TPoint*  arc = ras.arc;\r\n    Bool     result, fresh;\r\n\r\n\r\n    arc[0].y = -arc[0].y;\r\n    arc[1].y = -arc[1].y;\r\n    arc[2].y = -arc[2].y;\r\n    if ( degree > 2 )\r\n      arc[3].y = -arc[3].y;\r\n\r\n    fresh = ras.fresh;\r\n\r\n    result = Bezier_Up( RAS_VARS degree, splitter, -maxy, -miny );\r\n\r\n    if ( fresh && !ras.fresh )\r\n      ras.cProfile->start = -ras.cProfile->start;\r\n\r\n    arc[0].y = -arc[0].y;\r\n    return result;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Line_To                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Inject a new line segment and adjust the Profiles list.            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*   x :: The x-coordinate of the segment's end point (its start point   */\r\n  /*        is stored in `lastX').                                         */\r\n  /*                                                                       */\r\n  /*   y :: The y-coordinate of the segment's end point (its start point   */\r\n  /*        is stored in `lastY').                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   SUCCESS on success, FAILURE on render pool overflow or incorrect    */\r\n  /*   profile.                                                            */\r\n  /*                                                                       */\r\n  static Bool\r\n  Line_To( RAS_ARGS Long  x,\r\n                    Long  y )\r\n  {\r\n    /* First, detect a change of direction */\r\n\r\n    switch ( ras.state )\r\n    {\r\n    case Unknown_State:\r\n      if ( y > ras.lastY )\r\n      {\r\n        if ( New_Profile( RAS_VARS Ascending_State,\r\n                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )\r\n          return FAILURE;\r\n      }\r\n      else\r\n      {\r\n        if ( y < ras.lastY )\r\n          if ( New_Profile( RAS_VARS Descending_State,\r\n                                     IS_TOP_OVERSHOOT( ras.lastY ) ) )\r\n            return FAILURE;\r\n      }\r\n      break;\r\n\r\n    case Ascending_State:\r\n      if ( y < ras.lastY )\r\n      {\r\n        if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) ||\r\n             New_Profile( RAS_VARS Descending_State,\r\n                                   IS_TOP_OVERSHOOT( ras.lastY ) ) )\r\n          return FAILURE;\r\n      }\r\n      break;\r\n\r\n    case Descending_State:\r\n      if ( y > ras.lastY )\r\n      {\r\n        if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ||\r\n             New_Profile( RAS_VARS Ascending_State,\r\n                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )\r\n          return FAILURE;\r\n      }\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    /* Then compute the lines */\r\n\r\n    switch ( ras.state )\r\n    {\r\n    case Ascending_State:\r\n      if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,\r\n                             x, y, ras.minY, ras.maxY ) )\r\n        return FAILURE;\r\n      break;\r\n\r\n    case Descending_State:\r\n      if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,\r\n                               x, y, ras.minY, ras.maxY ) )\r\n        return FAILURE;\r\n      break;\r\n\r\n    default:\r\n      ;\r\n    }\r\n\r\n    ras.lastX = x;\r\n    ras.lastY = y;\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Conic_To                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Inject a new conic arc and adjust the profile list.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*   cx :: The x-coordinate of the arc's new control point.              */\r\n  /*                                                                       */\r\n  /*   cy :: The y-coordinate of the arc's new control point.              */\r\n  /*                                                                       */\r\n  /*   x  :: The x-coordinate of the arc's end point (its start point is   */\r\n  /*         stored in `lastX').                                           */\r\n  /*                                                                       */\r\n  /*   y  :: The y-coordinate of the arc's end point (its start point is   */\r\n  /*         stored in `lastY').                                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   SUCCESS on success, FAILURE on render pool overflow or incorrect    */\r\n  /*   profile.                                                            */\r\n  /*                                                                       */\r\n  static Bool\r\n  Conic_To( RAS_ARGS Long  cx,\r\n                     Long  cy,\r\n                     Long  x,\r\n                     Long  y )\r\n  {\r\n    Long     y1, y2, y3, x3, ymin, ymax;\r\n    TStates  state_bez;\r\n\r\n\r\n    ras.arc      = ras.arcs;\r\n    ras.arc[2].x = ras.lastX;\r\n    ras.arc[2].y = ras.lastY;\r\n    ras.arc[1].x = cx;\r\n    ras.arc[1].y = cy;\r\n    ras.arc[0].x = x;\r\n    ras.arc[0].y = y;\r\n\r\n    do\r\n    {\r\n      y1 = ras.arc[2].y;\r\n      y2 = ras.arc[1].y;\r\n      y3 = ras.arc[0].y;\r\n      x3 = ras.arc[0].x;\r\n\r\n      /* first, categorize the Bezier arc */\r\n\r\n      if ( y1 <= y3 )\r\n      {\r\n        ymin = y1;\r\n        ymax = y3;\r\n      }\r\n      else\r\n      {\r\n        ymin = y3;\r\n        ymax = y1;\r\n      }\r\n\r\n      if ( y2 < ymin || y2 > ymax )\r\n      {\r\n        /* this arc has no given direction, split it! */\r\n        Split_Conic( ras.arc );\r\n        ras.arc += 2;\r\n      }\r\n      else if ( y1 == y3 )\r\n      {\r\n        /* this arc is flat, ignore it and pop it from the Bezier stack */\r\n        ras.arc -= 2;\r\n      }\r\n      else\r\n      {\r\n        /* the arc is y-monotonous, either ascending or descending */\r\n        /* detect a change of direction                            */\r\n        state_bez = y1 < y3 ? Ascending_State : Descending_State;\r\n        if ( ras.state != state_bez )\r\n        {\r\n          Bool  o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 )\r\n                                                 : IS_TOP_OVERSHOOT( y1 );\r\n\r\n\r\n          /* finalize current profile if any */\r\n          if ( ras.state != Unknown_State &&\r\n               End_Profile( RAS_VARS o )  )\r\n            goto Fail;\r\n\r\n          /* create a new profile */\r\n          if ( New_Profile( RAS_VARS state_bez, o ) )\r\n            goto Fail;\r\n        }\r\n\r\n        /* now call the appropriate routine */\r\n        if ( state_bez == Ascending_State )\r\n        {\r\n          if ( Bezier_Up( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )\r\n            goto Fail;\r\n        }\r\n        else\r\n          if ( Bezier_Down( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )\r\n            goto Fail;\r\n      }\r\n\r\n    } while ( ras.arc >= ras.arcs );\r\n\r\n    ras.lastX = x3;\r\n    ras.lastY = y3;\r\n\r\n    return SUCCESS;\r\n\r\n  Fail:\r\n    return FAILURE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Cubic_To                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Inject a new cubic arc and adjust the profile list.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*   cx1 :: The x-coordinate of the arc's first new control point.       */\r\n  /*                                                                       */\r\n  /*   cy1 :: The y-coordinate of the arc's first new control point.       */\r\n  /*                                                                       */\r\n  /*   cx2 :: The x-coordinate of the arc's second new control point.      */\r\n  /*                                                                       */\r\n  /*   cy2 :: The y-coordinate of the arc's second new control point.      */\r\n  /*                                                                       */\r\n  /*   x   :: The x-coordinate of the arc's end point (its start point is  */\r\n  /*          stored in `lastX').                                          */\r\n  /*                                                                       */\r\n  /*   y   :: The y-coordinate of the arc's end point (its start point is  */\r\n  /*          stored in `lastY').                                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   SUCCESS on success, FAILURE on render pool overflow or incorrect    */\r\n  /*   profile.                                                            */\r\n  /*                                                                       */\r\n  static Bool\r\n  Cubic_To( RAS_ARGS Long  cx1,\r\n                     Long  cy1,\r\n                     Long  cx2,\r\n                     Long  cy2,\r\n                     Long  x,\r\n                     Long  y )\r\n  {\r\n    Long     y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;\r\n    TStates  state_bez;\r\n\r\n\r\n    ras.arc      = ras.arcs;\r\n    ras.arc[3].x = ras.lastX;\r\n    ras.arc[3].y = ras.lastY;\r\n    ras.arc[2].x = cx1;\r\n    ras.arc[2].y = cy1;\r\n    ras.arc[1].x = cx2;\r\n    ras.arc[1].y = cy2;\r\n    ras.arc[0].x = x;\r\n    ras.arc[0].y = y;\r\n\r\n    do\r\n    {\r\n      y1 = ras.arc[3].y;\r\n      y2 = ras.arc[2].y;\r\n      y3 = ras.arc[1].y;\r\n      y4 = ras.arc[0].y;\r\n      x4 = ras.arc[0].x;\r\n\r\n      /* first, categorize the Bezier arc */\r\n\r\n      if ( y1 <= y4 )\r\n      {\r\n        ymin1 = y1;\r\n        ymax1 = y4;\r\n      }\r\n      else\r\n      {\r\n        ymin1 = y4;\r\n        ymax1 = y1;\r\n      }\r\n\r\n      if ( y2 <= y3 )\r\n      {\r\n        ymin2 = y2;\r\n        ymax2 = y3;\r\n      }\r\n      else\r\n      {\r\n        ymin2 = y3;\r\n        ymax2 = y2;\r\n      }\r\n\r\n      if ( ymin2 < ymin1 || ymax2 > ymax1 )\r\n      {\r\n        /* this arc has no given direction, split it! */\r\n        Split_Cubic( ras.arc );\r\n        ras.arc += 3;\r\n      }\r\n      else if ( y1 == y4 )\r\n      {\r\n        /* this arc is flat, ignore it and pop it from the Bezier stack */\r\n        ras.arc -= 3;\r\n      }\r\n      else\r\n      {\r\n        state_bez = ( y1 <= y4 ) ? Ascending_State : Descending_State;\r\n\r\n        /* detect a change of direction */\r\n        if ( ras.state != state_bez )\r\n        {\r\n          Bool  o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 )\r\n                                                 : IS_TOP_OVERSHOOT( y1 );\r\n\r\n\r\n          /* finalize current profile if any */\r\n          if ( ras.state != Unknown_State &&\r\n               End_Profile( RAS_VARS o )  )\r\n            goto Fail;\r\n\r\n          if ( New_Profile( RAS_VARS state_bez, o ) )\r\n            goto Fail;\r\n        }\r\n\r\n        /* compute intersections */\r\n        if ( state_bez == Ascending_State )\r\n        {\r\n          if ( Bezier_Up( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )\r\n            goto Fail;\r\n        }\r\n        else\r\n          if ( Bezier_Down( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )\r\n            goto Fail;\r\n      }\r\n\r\n    } while ( ras.arc >= ras.arcs );\r\n\r\n    ras.lastX = x4;\r\n    ras.lastY = y4;\r\n\r\n    return SUCCESS;\r\n\r\n  Fail:\r\n    return FAILURE;\r\n  }\r\n\r\n\r\n#undef  SWAP_\r\n#define SWAP_( x, y )  do                \\\r\n                       {                 \\\r\n                         Long  swap = x; \\\r\n                                         \\\r\n                                         \\\r\n                         x = y;          \\\r\n                         y = swap;       \\\r\n                       } while ( 0 )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Decompose_Curve                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Scan the outline arrays in order to emit individual segments and   */\r\n  /*    Beziers by calling Line_To() and Bezier_To().  It handles all      */\r\n  /*    weird cases, like when the first point is off the curve, or when   */\r\n  /*    there are simply no `on' points in the contour!                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    first   :: The index of the first point in the contour.            */\r\n  /*                                                                       */\r\n  /*    last    :: The index of the last point in the contour.             */\r\n  /*                                                                       */\r\n  /*    flipped :: If set, flip the direction of the curve.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success, FAILURE on error.                              */\r\n  /*                                                                       */\r\n  static Bool\r\n  Decompose_Curve( RAS_ARGS UShort  first,\r\n                            UShort  last,\r\n                            int     flipped )\r\n  {\r\n    FT_Vector   v_last;\r\n    FT_Vector   v_control;\r\n    FT_Vector   v_start;\r\n\r\n    FT_Vector*  points;\r\n    FT_Vector*  point;\r\n    FT_Vector*  limit;\r\n    char*       tags;\r\n\r\n    unsigned    tag;       /* current point's state           */\r\n\r\n\r\n    points = ras.outline.points;\r\n    limit  = points + last;\r\n\r\n    v_start.x = SCALED( points[first].x );\r\n    v_start.y = SCALED( points[first].y );\r\n    v_last.x  = SCALED( points[last].x );\r\n    v_last.y  = SCALED( points[last].y );\r\n\r\n    if ( flipped )\r\n    {\r\n      SWAP_( v_start.x, v_start.y );\r\n      SWAP_( v_last.x, v_last.y );\r\n    }\r\n\r\n    v_control = v_start;\r\n\r\n    point = points + first;\r\n    tags  = ras.outline.tags + first;\r\n\r\n    /* set scan mode if necessary */\r\n    if ( tags[0] & FT_CURVE_TAG_HAS_SCANMODE )\r\n      ras.dropOutControl = (Byte)tags[0] >> 5;\r\n\r\n    tag = FT_CURVE_TAG( tags[0] );\r\n\r\n    /* A contour cannot start with a cubic control point! */\r\n    if ( tag == FT_CURVE_TAG_CUBIC )\r\n      goto Invalid_Outline;\r\n\r\n    /* check first point to determine origin */\r\n    if ( tag == FT_CURVE_TAG_CONIC )\r\n    {\r\n      /* first point is conic control.  Yes, this happens. */\r\n      if ( FT_CURVE_TAG( ras.outline.tags[last] ) == FT_CURVE_TAG_ON )\r\n      {\r\n        /* start at last point if it is on the curve */\r\n        v_start = v_last;\r\n        limit--;\r\n      }\r\n      else\r\n      {\r\n        /* if both first and last points are conic,         */\r\n        /* start at their middle and record its position    */\r\n        /* for closure                                      */\r\n        v_start.x = ( v_start.x + v_last.x ) / 2;\r\n        v_start.y = ( v_start.y + v_last.y ) / 2;\r\n\r\n        v_last = v_start;\r\n      }\r\n      point--;\r\n      tags--;\r\n    }\r\n\r\n    ras.lastX = v_start.x;\r\n    ras.lastY = v_start.y;\r\n\r\n    while ( point < limit )\r\n    {\r\n      point++;\r\n      tags++;\r\n\r\n      tag = FT_CURVE_TAG( tags[0] );\r\n\r\n      switch ( tag )\r\n      {\r\n      case FT_CURVE_TAG_ON:  /* emit a single line_to */\r\n        {\r\n          Long  x, y;\r\n\r\n\r\n          x = SCALED( point->x );\r\n          y = SCALED( point->y );\r\n          if ( flipped )\r\n            SWAP_( x, y );\r\n\r\n          if ( Line_To( RAS_VARS x, y ) )\r\n            goto Fail;\r\n          continue;\r\n        }\r\n\r\n      case FT_CURVE_TAG_CONIC:  /* consume conic arcs */\r\n        v_control.x = SCALED( point[0].x );\r\n        v_control.y = SCALED( point[0].y );\r\n\r\n        if ( flipped )\r\n          SWAP_( v_control.x, v_control.y );\r\n\r\n      Do_Conic:\r\n        if ( point < limit )\r\n        {\r\n          FT_Vector  v_middle;\r\n          Long       x, y;\r\n\r\n\r\n          point++;\r\n          tags++;\r\n          tag = FT_CURVE_TAG( tags[0] );\r\n\r\n          x = SCALED( point[0].x );\r\n          y = SCALED( point[0].y );\r\n\r\n          if ( flipped )\r\n            SWAP_( x, y );\r\n\r\n          if ( tag == FT_CURVE_TAG_ON )\r\n          {\r\n            if ( Conic_To( RAS_VARS v_control.x, v_control.y, x, y ) )\r\n              goto Fail;\r\n            continue;\r\n          }\r\n\r\n          if ( tag != FT_CURVE_TAG_CONIC )\r\n            goto Invalid_Outline;\r\n\r\n          v_middle.x = ( v_control.x + x ) / 2;\r\n          v_middle.y = ( v_control.y + y ) / 2;\r\n\r\n          if ( Conic_To( RAS_VARS v_control.x, v_control.y,\r\n                                  v_middle.x,  v_middle.y ) )\r\n            goto Fail;\r\n\r\n          v_control.x = x;\r\n          v_control.y = y;\r\n\r\n          goto Do_Conic;\r\n        }\r\n\r\n        if ( Conic_To( RAS_VARS v_control.x, v_control.y,\r\n                                v_start.x,   v_start.y ) )\r\n          goto Fail;\r\n\r\n        goto Close;\r\n\r\n      default:  /* FT_CURVE_TAG_CUBIC */\r\n        {\r\n          Long  x1, y1, x2, y2, x3, y3;\r\n\r\n\r\n          if ( point + 1 > limit                             ||\r\n               FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )\r\n            goto Invalid_Outline;\r\n\r\n          point += 2;\r\n          tags  += 2;\r\n\r\n          x1 = SCALED( point[-2].x );\r\n          y1 = SCALED( point[-2].y );\r\n          x2 = SCALED( point[-1].x );\r\n          y2 = SCALED( point[-1].y );\r\n\r\n          if ( flipped )\r\n          {\r\n            SWAP_( x1, y1 );\r\n            SWAP_( x2, y2 );\r\n          }\r\n\r\n          if ( point <= limit )\r\n          {\r\n            x3 = SCALED( point[0].x );\r\n            y3 = SCALED( point[0].y );\r\n\r\n            if ( flipped )\r\n              SWAP_( x3, y3 );\r\n\r\n            if ( Cubic_To( RAS_VARS x1, y1, x2, y2, x3, y3 ) )\r\n              goto Fail;\r\n            continue;\r\n          }\r\n\r\n          if ( Cubic_To( RAS_VARS x1, y1, x2, y2, v_start.x, v_start.y ) )\r\n            goto Fail;\r\n          goto Close;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* close the contour with a line segment */\r\n    if ( Line_To( RAS_VARS v_start.x, v_start.y ) )\r\n      goto Fail;\r\n\r\n  Close:\r\n    return SUCCESS;\r\n\r\n  Invalid_Outline:\r\n    ras.error = Raster_Err_Invalid;\r\n\r\n  Fail:\r\n    return FAILURE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Convert_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a glyph into a series of segments and arcs and make a      */\r\n  /*    profiles list with them.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    flipped :: If set, flip the direction of curve.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS on success, FAILURE if any error was encountered during    */\r\n  /*    rendering.                                                         */\r\n  /*                                                                       */\r\n  static Bool\r\n  Convert_Glyph( RAS_ARGS int  flipped )\r\n  {\r\n    int       i;\r\n    unsigned  start;\r\n\r\n    PProfile  lastProfile;\r\n\r\n\r\n    ras.fProfile = NULL;\r\n    ras.joint    = FALSE;\r\n    ras.fresh    = FALSE;\r\n\r\n    ras.maxBuff  = ras.sizeBuff - AlignProfileSize;\r\n\r\n    ras.numTurns = 0;\r\n\r\n    ras.cProfile         = (PProfile)ras.top;\r\n    ras.cProfile->offset = ras.top;\r\n    ras.num_Profs        = 0;\r\n\r\n    start = 0;\r\n\r\n    for ( i = 0; i < ras.outline.n_contours; i++ )\r\n    {\r\n      Bool  o;\r\n\r\n\r\n      ras.state    = Unknown_State;\r\n      ras.gProfile = NULL;\r\n\r\n      if ( Decompose_Curve( RAS_VARS (unsigned short)start,\r\n                                     ras.outline.contours[i],\r\n                                     flipped ) )\r\n        return FAILURE;\r\n\r\n      start = ras.outline.contours[i] + 1;\r\n\r\n      /* we must now check whether the extreme arcs join or not */\r\n      if ( FRAC( ras.lastY ) == 0 &&\r\n           ras.lastY >= ras.minY  &&\r\n           ras.lastY <= ras.maxY  )\r\n        if ( ras.gProfile                        &&\r\n             ( ras.gProfile->flags & Flow_Up ) ==\r\n               ( ras.cProfile->flags & Flow_Up ) )\r\n          ras.top--;\r\n        /* Note that ras.gProfile can be nil if the contour was too small */\r\n        /* to be drawn.                                                   */\r\n\r\n      lastProfile = ras.cProfile;\r\n      if ( ras.cProfile->flags & Flow_Up )\r\n        o = IS_TOP_OVERSHOOT( ras.lastY );\r\n      else\r\n        o = IS_BOTTOM_OVERSHOOT( ras.lastY );\r\n      if ( End_Profile( RAS_VARS o ) )\r\n        return FAILURE;\r\n\r\n      /* close the `next profile in contour' linked list */\r\n      if ( ras.gProfile )\r\n        lastProfile->next = ras.gProfile;\r\n    }\r\n\r\n    if ( Finalize_Profile_Table( RAS_VAR ) )\r\n      return FAILURE;\r\n\r\n    return (Bool)( ras.top < ras.maxBuff ? SUCCESS : FAILURE );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**                                                                     **/\r\n  /**  SCAN-LINE SWEEPS AND DRAWING                                       **/\r\n  /**                                                                     **/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Init_Linked                                                          */\r\n  /*                                                                       */\r\n  /*    Initializes an empty linked list.                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Init_Linked( TProfileList*  l )\r\n  {\r\n    *l = NULL;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  InsNew                                                               */\r\n  /*                                                                       */\r\n  /*    Inserts a new profile in a linked list.                            */\r\n  /*                                                                       */\r\n  static void\r\n  InsNew( PProfileList  list,\r\n          PProfile      profile )\r\n  {\r\n    PProfile  *old, current;\r\n    Long       x;\r\n\r\n\r\n    old     = list;\r\n    current = *old;\r\n    x       = profile->X;\r\n\r\n    while ( current )\r\n    {\r\n      if ( x < current->X )\r\n        break;\r\n      old     = &current->link;\r\n      current = *old;\r\n    }\r\n\r\n    profile->link = current;\r\n    *old          = profile;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  DelOld                                                               */\r\n  /*                                                                       */\r\n  /*    Removes an old profile from a linked list.                         */\r\n  /*                                                                       */\r\n  static void\r\n  DelOld( PProfileList  list,\r\n          PProfile      profile )\r\n  {\r\n    PProfile  *old, current;\r\n\r\n\r\n    old     = list;\r\n    current = *old;\r\n\r\n    while ( current )\r\n    {\r\n      if ( current == profile )\r\n      {\r\n        *old = current->link;\r\n        return;\r\n      }\r\n\r\n      old     = &current->link;\r\n      current = *old;\r\n    }\r\n\r\n    /* we should never get there, unless the profile was not part of */\r\n    /* the list.                                                     */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Sort                                                                 */\r\n  /*                                                                       */\r\n  /*    Sorts a trace list.  In 95%, the list is already sorted.  We need  */\r\n  /*    an algorithm which is fast in this case.  Bubble sort is enough    */\r\n  /*    and simple.                                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Sort( PProfileList  list )\r\n  {\r\n    PProfile  *old, current, next;\r\n\r\n\r\n    /* First, set the new X coordinate of each profile */\r\n    current = *list;\r\n    while ( current )\r\n    {\r\n      current->X       = *current->offset;\r\n      current->offset += current->flags & Flow_Up ? 1 : -1;\r\n      current->height--;\r\n      current = current->link;\r\n    }\r\n\r\n    /* Then sort them */\r\n    old     = list;\r\n    current = *old;\r\n\r\n    if ( !current )\r\n      return;\r\n\r\n    next = current->link;\r\n\r\n    while ( next )\r\n    {\r\n      if ( current->X <= next->X )\r\n      {\r\n        old     = &current->link;\r\n        current = *old;\r\n\r\n        if ( !current )\r\n          return;\r\n      }\r\n      else\r\n      {\r\n        *old          = next;\r\n        current->link = next->link;\r\n        next->link    = current;\r\n\r\n        old     = list;\r\n        current = *old;\r\n      }\r\n\r\n      next = current->link;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Vertical Sweep Procedure Set                                         */\r\n  /*                                                                       */\r\n  /*  These four routines are used during the vertical black/white sweep   */\r\n  /*  phase by the generic Draw_Sweep() function.                          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  Vertical_Sweep_Init( RAS_ARGS Short*  min,\r\n                                Short*  max )\r\n  {\r\n    Long  pitch = ras.target.pitch;\r\n\r\n    FT_UNUSED( max );\r\n\r\n\r\n    ras.traceIncr = (Short)-pitch;\r\n    ras.traceOfs  = -*min * pitch;\r\n    if ( pitch > 0 )\r\n      ras.traceOfs += ( ras.target.rows - 1 ) * pitch;\r\n\r\n    ras.gray_min_x = 0;\r\n    ras.gray_max_x = 0;\r\n  }\r\n\r\n\r\n  static void\r\n  Vertical_Sweep_Span( RAS_ARGS Short       y,\r\n                                FT_F26Dot6  x1,\r\n                                FT_F26Dot6  x2,\r\n                                PProfile    left,\r\n                                PProfile    right )\r\n  {\r\n    Long   e1, e2;\r\n    int    c1, c2;\r\n    Byte   f1, f2;\r\n    Byte*  target;\r\n\r\n    FT_UNUSED( y );\r\n    FT_UNUSED( left );\r\n    FT_UNUSED( right );\r\n\r\n\r\n    /* Drop-out control */\r\n\r\n    e1 = TRUNC( CEILING( x1 ) );\r\n\r\n    if ( x2 - x1 - ras.precision <= ras.precision_jitter )\r\n      e2 = e1;\r\n    else\r\n      e2 = TRUNC( FLOOR( x2 ) );\r\n\r\n    if ( e2 >= 0 && e1 < ras.bWidth )\r\n    {\r\n      if ( e1 < 0 )\r\n        e1 = 0;\r\n      if ( e2 >= ras.bWidth )\r\n        e2 = ras.bWidth - 1;\r\n\r\n      c1 = (Short)( e1 >> 3 );\r\n      c2 = (Short)( e2 >> 3 );\r\n\r\n      f1 = (Byte)  ( 0xFF >> ( e1 & 7 ) );\r\n      f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );\r\n\r\n      if ( ras.gray_min_x > c1 )\r\n        ras.gray_min_x = (short)c1;\r\n      if ( ras.gray_max_x < c2 )\r\n        ras.gray_max_x = (short)c2;\r\n\r\n      target = ras.bTarget + ras.traceOfs + c1;\r\n      c2 -= c1;\r\n\r\n      if ( c2 > 0 )\r\n      {\r\n        target[0] |= f1;\r\n\r\n        /* memset() is slower than the following code on many platforms. */\r\n        /* This is due to the fact that, in the vast majority of cases,  */\r\n        /* the span length in bytes is relatively small.                 */\r\n        c2--;\r\n        while ( c2 > 0 )\r\n        {\r\n          *(++target) = 0xFF;\r\n          c2--;\r\n        }\r\n        target[1] |= f2;\r\n      }\r\n      else\r\n        *target |= ( f1 & f2 );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  Vertical_Sweep_Drop( RAS_ARGS Short       y,\r\n                                FT_F26Dot6  x1,\r\n                                FT_F26Dot6  x2,\r\n                                PProfile    left,\r\n                                PProfile    right )\r\n  {\r\n    Long   e1, e2, pxl;\r\n    Short  c1, f1;\r\n\r\n\r\n    /* Drop-out control */\r\n\r\n    /*   e2            x2                    x1           e1   */\r\n    /*                                                         */\r\n    /*                 ^                     |                 */\r\n    /*                 |                     |                 */\r\n    /*   +-------------+---------------------+------------+    */\r\n    /*                 |                     |                 */\r\n    /*                 |                     v                 */\r\n    /*                                                         */\r\n    /* pixel         contour              contour       pixel  */\r\n    /* center                                           center */\r\n\r\n    /* drop-out mode    scan conversion rules (as defined in OpenType) */\r\n    /* --------------------------------------------------------------- */\r\n    /*  0                1, 2, 3                                       */\r\n    /*  1                1, 2, 4                                       */\r\n    /*  2                1, 2                                          */\r\n    /*  3                same as mode 2                                */\r\n    /*  4                1, 2, 5                                       */\r\n    /*  5                1, 2, 6                                       */\r\n    /*  6, 7             same as mode 2                                */\r\n\r\n    e1  = CEILING( x1 );\r\n    e2  = FLOOR  ( x2 );\r\n    pxl = e1;\r\n\r\n    if ( e1 > e2 )\r\n    {\r\n      Int  dropOutControl = left->flags & 7;\r\n\r\n\r\n      if ( e1 == e2 + ras.precision )\r\n      {\r\n        switch ( dropOutControl )\r\n        {\r\n        case 0: /* simple drop-outs including stubs */\r\n          pxl = e2;\r\n          break;\r\n\r\n        case 4: /* smart drop-outs including stubs */\r\n          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\r\n          break;\r\n\r\n        case 1: /* simple drop-outs excluding stubs */\r\n        case 5: /* smart drop-outs excluding stubs  */\r\n\r\n          /* Drop-out Control Rules #4 and #6 */\r\n\r\n          /* The specification neither provides an exact definition */\r\n          /* of a `stub' nor gives exact rules to exclude them.     */\r\n          /*                                                        */\r\n          /* Here the constraints we use to recognize a stub.       */\r\n          /*                                                        */\r\n          /*  upper stub:                                           */\r\n          /*                                                        */\r\n          /*   - P_Left and P_Right are in the same contour         */\r\n          /*   - P_Right is the successor of P_Left in that contour */\r\n          /*   - y is the top of P_Left and P_Right                 */\r\n          /*                                                        */\r\n          /*  lower stub:                                           */\r\n          /*                                                        */\r\n          /*   - P_Left and P_Right are in the same contour         */\r\n          /*   - P_Left is the successor of P_Right in that contour */\r\n          /*   - y is the bottom of P_Left                          */\r\n          /*                                                        */\r\n          /* We draw a stub if the following constraints are met.   */\r\n          /*                                                        */\r\n          /*   - for an upper or lower stub, there is top or bottom */\r\n          /*     overshoot, respectively                            */\r\n          /*   - the covered interval is greater or equal to a half */\r\n          /*     pixel                                              */\r\n\r\n          /* upper stub test */\r\n          if ( left->next == right                &&\r\n               left->height <= 0                  &&\r\n               !( left->flags & Overshoot_Top   &&\r\n                  x2 - x1 >= ras.precision_half ) )\r\n            return;\r\n\r\n          /* lower stub test */\r\n          if ( right->next == left                 &&\r\n               left->start == y                    &&\r\n               !( left->flags & Overshoot_Bottom &&\r\n                  x2 - x1 >= ras.precision_half  ) )\r\n            return;\r\n\r\n          if ( dropOutControl == 1 )\r\n            pxl = e2;\r\n          else\r\n            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\r\n          break;\r\n\r\n        default: /* modes 2, 3, 6, 7 */\r\n          return;  /* no drop-out control */\r\n        }\r\n\r\n        /* undocumented but confirmed: If the drop-out would result in a  */\r\n        /* pixel outside of the bounding box, use the pixel inside of the */\r\n        /* bounding box instead                                           */\r\n        if ( pxl < 0 )\r\n          pxl = e1;\r\n        else if ( TRUNC( pxl ) >= ras.bWidth )\r\n          pxl = e2;\r\n\r\n        /* check that the other pixel isn't set */\r\n        e1 = pxl == e1 ? e2 : e1;\r\n\r\n        e1 = TRUNC( e1 );\r\n\r\n        c1 = (Short)( e1 >> 3 );\r\n        f1 = (Short)( e1 &  7 );\r\n\r\n        if ( e1 >= 0 && e1 < ras.bWidth                      &&\r\n             ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )\r\n          return;\r\n      }\r\n      else\r\n        return;\r\n    }\r\n\r\n    e1 = TRUNC( pxl );\r\n\r\n    if ( e1 >= 0 && e1 < ras.bWidth )\r\n    {\r\n      c1 = (Short)( e1 >> 3 );\r\n      f1 = (Short)( e1 & 7 );\r\n\r\n      if ( ras.gray_min_x > c1 )\r\n        ras.gray_min_x = c1;\r\n      if ( ras.gray_max_x < c1 )\r\n        ras.gray_max_x = c1;\r\n\r\n      ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  Vertical_Sweep_Step( RAS_ARG )\r\n  {\r\n    ras.traceOfs += ras.traceIncr;\r\n  }\r\n\r\n\r\n  /***********************************************************************/\r\n  /*                                                                     */\r\n  /*  Horizontal Sweep Procedure Set                                     */\r\n  /*                                                                     */\r\n  /*  These four routines are used during the horizontal black/white     */\r\n  /*  sweep phase by the generic Draw_Sweep() function.                  */\r\n  /*                                                                     */\r\n  /***********************************************************************/\r\n\r\n  static void\r\n  Horizontal_Sweep_Init( RAS_ARGS Short*  min,\r\n                                  Short*  max )\r\n  {\r\n    /* nothing, really */\r\n    FT_UNUSED_RASTER;\r\n    FT_UNUSED( min );\r\n    FT_UNUSED( max );\r\n  }\r\n\r\n\r\n  static void\r\n  Horizontal_Sweep_Span( RAS_ARGS Short       y,\r\n                                  FT_F26Dot6  x1,\r\n                                  FT_F26Dot6  x2,\r\n                                  PProfile    left,\r\n                                  PProfile    right )\r\n  {\r\n    Long   e1, e2;\r\n    PByte  bits;\r\n    Byte   f1;\r\n\r\n    FT_UNUSED( left );\r\n    FT_UNUSED( right );\r\n\r\n\r\n    if ( x2 - x1 < ras.precision )\r\n    {\r\n      e1 = CEILING( x1 );\r\n      e2 = FLOOR  ( x2 );\r\n\r\n      if ( e1 == e2 )\r\n      {\r\n        bits = ras.bTarget + ( y >> 3 );\r\n        f1   = (Byte)( 0x80 >> ( y & 7 ) );\r\n\r\n        e1 = TRUNC( e1 );\r\n\r\n        if ( e1 >= 0 && e1 < ras.target.rows )\r\n        {\r\n          PByte  p;\r\n\r\n\r\n          p = bits - e1 * ras.target.pitch;\r\n          if ( ras.target.pitch > 0 )\r\n            p += ( ras.target.rows - 1 ) * ras.target.pitch;\r\n\r\n          p[0] |= f1;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  Horizontal_Sweep_Drop( RAS_ARGS Short       y,\r\n                                  FT_F26Dot6  x1,\r\n                                  FT_F26Dot6  x2,\r\n                                  PProfile    left,\r\n                                  PProfile    right )\r\n  {\r\n    Long   e1, e2, pxl;\r\n    PByte  bits;\r\n    Byte   f1;\r\n\r\n\r\n    /* During the horizontal sweep, we only take care of drop-outs */\r\n\r\n    /* e1     +       <-- pixel center */\r\n    /*        |                        */\r\n    /* x1  ---+-->    <-- contour      */\r\n    /*        |                        */\r\n    /*        |                        */\r\n    /* x2  <--+---    <-- contour      */\r\n    /*        |                        */\r\n    /*        |                        */\r\n    /* e2     +       <-- pixel center */\r\n\r\n    e1  = CEILING( x1 );\r\n    e2  = FLOOR  ( x2 );\r\n    pxl = e1;\r\n\r\n    if ( e1 > e2 )\r\n    {\r\n      Int  dropOutControl = left->flags & 7;\r\n\r\n\r\n      if ( e1 == e2 + ras.precision )\r\n      {\r\n        switch ( dropOutControl )\r\n        {\r\n        case 0: /* simple drop-outs including stubs */\r\n          pxl = e2;\r\n          break;\r\n\r\n        case 4: /* smart drop-outs including stubs */\r\n          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\r\n          break;\r\n\r\n        case 1: /* simple drop-outs excluding stubs */\r\n        case 5: /* smart drop-outs excluding stubs  */\r\n          /* see Vertical_Sweep_Drop for details */\r\n\r\n          /* rightmost stub test */\r\n          if ( left->next == right                &&\r\n               left->height <= 0                  &&\r\n               !( left->flags & Overshoot_Top   &&\r\n                  x2 - x1 >= ras.precision_half ) )\r\n            return;\r\n\r\n          /* leftmost stub test */\r\n          if ( right->next == left                 &&\r\n               left->start == y                    &&\r\n               !( left->flags & Overshoot_Bottom &&\r\n                  x2 - x1 >= ras.precision_half  ) )\r\n            return;\r\n\r\n          if ( dropOutControl == 1 )\r\n            pxl = e2;\r\n          else\r\n            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\r\n          break;\r\n\r\n        default: /* modes 2, 3, 6, 7 */\r\n          return;  /* no drop-out control */\r\n        }\r\n\r\n        /* undocumented but confirmed: If the drop-out would result in a  */\r\n        /* pixel outside of the bounding box, use the pixel inside of the */\r\n        /* bounding box instead                                           */\r\n        if ( pxl < 0 )\r\n          pxl = e1;\r\n        else if ( TRUNC( pxl ) >= ras.target.rows )\r\n          pxl = e2;\r\n\r\n        /* check that the other pixel isn't set */\r\n        e1 = pxl == e1 ? e2 : e1;\r\n\r\n        e1 = TRUNC( e1 );\r\n\r\n        bits = ras.bTarget + ( y >> 3 );\r\n        f1   = (Byte)( 0x80 >> ( y & 7 ) );\r\n\r\n        bits -= e1 * ras.target.pitch;\r\n        if ( ras.target.pitch > 0 )\r\n          bits += ( ras.target.rows - 1 ) * ras.target.pitch;\r\n\r\n        if ( e1 >= 0              &&\r\n             e1 < ras.target.rows &&\r\n             *bits & f1           )\r\n          return;\r\n      }\r\n      else\r\n        return;\r\n    }\r\n\r\n    bits = ras.bTarget + ( y >> 3 );\r\n    f1   = (Byte)( 0x80 >> ( y & 7 ) );\r\n\r\n    e1 = TRUNC( pxl );\r\n\r\n    if ( e1 >= 0 && e1 < ras.target.rows )\r\n    {\r\n      bits -= e1 * ras.target.pitch;\r\n      if ( ras.target.pitch > 0 )\r\n        bits += ( ras.target.rows - 1 ) * ras.target.pitch;\r\n\r\n      bits[0] |= f1;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  Horizontal_Sweep_Step( RAS_ARG )\r\n  {\r\n    /* Nothing, really */\r\n    FT_UNUSED_RASTER;\r\n  }\r\n\r\n\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Vertical Gray Sweep Procedure Set                                    */\r\n  /*                                                                       */\r\n  /*  These two routines are used during the vertical gray-levels sweep    */\r\n  /*  phase by the generic Draw_Sweep() function.                          */\r\n  /*                                                                       */\r\n  /*  NOTES                                                                */\r\n  /*                                                                       */\r\n  /*  - The target pixmap's width *must* be a multiple of 4.               */\r\n  /*                                                                       */\r\n  /*  - You have to use the function Vertical_Sweep_Span() for the gray    */\r\n  /*    span call.                                                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  static void\r\n  Vertical_Gray_Sweep_Init( RAS_ARGS Short*  min,\r\n                                     Short*  max )\r\n  {\r\n    Long  pitch, byte_len;\r\n\r\n\r\n    *min = *min & -2;\r\n    *max = ( *max + 3 ) & -2;\r\n\r\n    ras.traceOfs  = 0;\r\n    pitch         = ras.target.pitch;\r\n    byte_len      = -pitch;\r\n    ras.traceIncr = (Short)byte_len;\r\n    ras.traceG    = ( *min / 2 ) * byte_len;\r\n\r\n    if ( pitch > 0 )\r\n    {\r\n      ras.traceG += ( ras.target.rows - 1 ) * pitch;\r\n      byte_len    = -byte_len;\r\n    }\r\n\r\n    ras.gray_min_x =  (Short)byte_len;\r\n    ras.gray_max_x = -(Short)byte_len;\r\n  }\r\n\r\n\r\n  static void\r\n  Vertical_Gray_Sweep_Step( RAS_ARG )\r\n  {\r\n    Int     c1, c2;\r\n    PByte   pix, bit, bit2;\r\n    short*  count = (short*)count_table;\r\n    Byte*   grays;\r\n\r\n\r\n    ras.traceOfs += ras.gray_width;\r\n\r\n    if ( ras.traceOfs > ras.gray_width )\r\n    {\r\n      pix   = ras.gTarget + ras.traceG + ras.gray_min_x * 4;\r\n      grays = ras.grays;\r\n\r\n      if ( ras.gray_max_x >= 0 )\r\n      {\r\n        Long  last_pixel = ras.target.width - 1;\r\n        Int   last_cell  = last_pixel >> 2;\r\n        Int   last_bit   = last_pixel & 3;\r\n        Bool  over       = 0;\r\n\r\n\r\n        if ( ras.gray_max_x >= last_cell && last_bit != 3 )\r\n        {\r\n          ras.gray_max_x = last_cell - 1;\r\n          over = 1;\r\n        }\r\n\r\n        if ( ras.gray_min_x < 0 )\r\n          ras.gray_min_x = 0;\r\n\r\n        bit  = ras.bTarget + ras.gray_min_x;\r\n        bit2 = bit + ras.gray_width;\r\n\r\n        c1 = ras.gray_max_x - ras.gray_min_x;\r\n\r\n        while ( c1 >= 0 )\r\n        {\r\n          c2 = count[*bit] + count[*bit2];\r\n\r\n          if ( c2 )\r\n          {\r\n            pix[0] = grays[(c2 >> 12) & 0x000F];\r\n            pix[1] = grays[(c2 >> 8 ) & 0x000F];\r\n            pix[2] = grays[(c2 >> 4 ) & 0x000F];\r\n            pix[3] = grays[ c2        & 0x000F];\r\n\r\n            *bit  = 0;\r\n            *bit2 = 0;\r\n          }\r\n\r\n          bit++;\r\n          bit2++;\r\n          pix += 4;\r\n          c1--;\r\n        }\r\n\r\n        if ( over )\r\n        {\r\n          c2 = count[*bit] + count[*bit2];\r\n          if ( c2 )\r\n          {\r\n            switch ( last_bit )\r\n            {\r\n            case 2:\r\n              pix[2] = grays[(c2 >> 4 ) & 0x000F];\r\n            case 1:\r\n              pix[1] = grays[(c2 >> 8 ) & 0x000F];\r\n            default:\r\n              pix[0] = grays[(c2 >> 12) & 0x000F];\r\n            }\r\n\r\n            *bit  = 0;\r\n            *bit2 = 0;\r\n          }\r\n        }\r\n      }\r\n\r\n      ras.traceOfs = 0;\r\n      ras.traceG  += ras.traceIncr;\r\n\r\n      ras.gray_min_x =  32000;\r\n      ras.gray_max_x = -32000;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  Horizontal_Gray_Sweep_Span( RAS_ARGS Short       y,\r\n                                       FT_F26Dot6  x1,\r\n                                       FT_F26Dot6  x2,\r\n                                       PProfile    left,\r\n                                       PProfile    right )\r\n  {\r\n    /* nothing, really */\r\n    FT_UNUSED_RASTER;\r\n    FT_UNUSED( y );\r\n    FT_UNUSED( x1 );\r\n    FT_UNUSED( x2 );\r\n    FT_UNUSED( left );\r\n    FT_UNUSED( right );\r\n  }\r\n\r\n\r\n  static void\r\n  Horizontal_Gray_Sweep_Drop( RAS_ARGS Short       y,\r\n                                       FT_F26Dot6  x1,\r\n                                       FT_F26Dot6  x2,\r\n                                       PProfile    left,\r\n                                       PProfile    right )\r\n  {\r\n    Long   e1, e2;\r\n    PByte  pixel;\r\n    Byte   color;\r\n\r\n\r\n    /* During the horizontal sweep, we only take care of drop-outs */\r\n\r\n    e1 = CEILING( x1 );\r\n    e2 = FLOOR  ( x2 );\r\n\r\n    if ( e1 > e2 )\r\n    {\r\n      Int  dropOutControl = left->flags & 7;\r\n\r\n\r\n      if ( e1 == e2 + ras.precision )\r\n      {\r\n        switch ( dropOutControl )\r\n        {\r\n        case 0: /* simple drop-outs including stubs */\r\n          e1 = e2;\r\n          break;\r\n\r\n        case 4: /* smart drop-outs including stubs */\r\n          e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\r\n          break;\r\n\r\n        case 1: /* simple drop-outs excluding stubs */\r\n        case 5: /* smart drop-outs excluding stubs  */\r\n          /* see Vertical_Sweep_Drop for details */\r\n\r\n          /* rightmost stub test */\r\n          if ( left->next == right && left->height <= 0 )\r\n            return;\r\n\r\n          /* leftmost stub test */\r\n          if ( right->next == left && left->start == y )\r\n            return;\r\n\r\n          if ( dropOutControl == 1 )\r\n            e1 = e2;\r\n          else\r\n            e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\r\n\r\n          break;\r\n\r\n        default: /* modes 2, 3, 6, 7 */\r\n          return;  /* no drop-out control */\r\n        }\r\n      }\r\n      else\r\n        return;\r\n    }\r\n\r\n    if ( e1 >= 0 )\r\n    {\r\n      if ( x2 - x1 >= ras.precision_half )\r\n        color = ras.grays[2];\r\n      else\r\n        color = ras.grays[1];\r\n\r\n      e1 = TRUNC( e1 ) / 2;\r\n      if ( e1 < ras.target.rows )\r\n      {\r\n        pixel = ras.gTarget - e1 * ras.target.pitch + y / 2;\r\n        if ( ras.target.pitch > 0 )\r\n          pixel += ( ras.target.rows - 1 ) * ras.target.pitch;\r\n\r\n        if ( pixel[0] == ras.grays[0] )\r\n          pixel[0] = color;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n#endif /* FT_RASTER_OPTION_ANTI_ALIASING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Generic Sweep Drawing routine                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  static Bool\r\n  Draw_Sweep( RAS_ARG )\r\n  {\r\n    Short         y, y_change, y_height;\r\n\r\n    PProfile      P, Q, P_Left, P_Right;\r\n\r\n    Short         min_Y, max_Y, top, bottom, dropouts;\r\n\r\n    Long          x1, x2, xs, e1, e2;\r\n\r\n    TProfileList  waiting;\r\n    TProfileList  draw_left, draw_right;\r\n\r\n\r\n    /* initialize empty linked lists */\r\n\r\n    Init_Linked( &waiting );\r\n\r\n    Init_Linked( &draw_left  );\r\n    Init_Linked( &draw_right );\r\n\r\n    /* first, compute min and max Y */\r\n\r\n    P     = ras.fProfile;\r\n    max_Y = (Short)TRUNC( ras.minY );\r\n    min_Y = (Short)TRUNC( ras.maxY );\r\n\r\n    while ( P )\r\n    {\r\n      Q = P->link;\r\n\r\n      bottom = (Short)P->start;\r\n      top    = (Short)( P->start + P->height - 1 );\r\n\r\n      if ( min_Y > bottom )\r\n        min_Y = bottom;\r\n      if ( max_Y < top )\r\n        max_Y = top;\r\n\r\n      P->X = 0;\r\n      InsNew( &waiting, P );\r\n\r\n      P = Q;\r\n    }\r\n\r\n    /* check the Y-turns */\r\n    if ( ras.numTurns == 0 )\r\n    {\r\n      ras.error = Raster_Err_Invalid;\r\n      return FAILURE;\r\n    }\r\n\r\n    /* now initialize the sweep */\r\n\r\n    ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );\r\n\r\n    /* then compute the distance of each profile from min_Y */\r\n\r\n    P = waiting;\r\n\r\n    while ( P )\r\n    {\r\n      P->countL = (UShort)( P->start - min_Y );\r\n      P = P->link;\r\n    }\r\n\r\n    /* let's go */\r\n\r\n    y        = min_Y;\r\n    y_height = 0;\r\n\r\n    if ( ras.numTurns > 0                     &&\r\n         ras.sizeBuff[-ras.numTurns] == min_Y )\r\n      ras.numTurns--;\r\n\r\n    while ( ras.numTurns > 0 )\r\n    {\r\n      /* check waiting list for new activations */\r\n\r\n      P = waiting;\r\n\r\n      while ( P )\r\n      {\r\n        Q = P->link;\r\n        P->countL -= y_height;\r\n        if ( P->countL == 0 )\r\n        {\r\n          DelOld( &waiting, P );\r\n\r\n          if ( P->flags & Flow_Up )\r\n            InsNew( &draw_left,  P );\r\n          else\r\n            InsNew( &draw_right, P );\r\n        }\r\n\r\n        P = Q;\r\n      }\r\n\r\n      /* sort the drawing lists */\r\n\r\n      Sort( &draw_left );\r\n      Sort( &draw_right );\r\n\r\n      y_change = (Short)ras.sizeBuff[-ras.numTurns--];\r\n      y_height = (Short)( y_change - y );\r\n\r\n      while ( y < y_change )\r\n      {\r\n        /* let's trace */\r\n\r\n        dropouts = 0;\r\n\r\n        P_Left  = draw_left;\r\n        P_Right = draw_right;\r\n\r\n        while ( P_Left )\r\n        {\r\n          x1 = P_Left ->X;\r\n          x2 = P_Right->X;\r\n\r\n          if ( x1 > x2 )\r\n          {\r\n            xs = x1;\r\n            x1 = x2;\r\n            x2 = xs;\r\n          }\r\n\r\n          e1 = FLOOR( x1 );\r\n          e2 = CEILING( x2 );\r\n\r\n          if ( x2 - x1 <= ras.precision &&\r\n               e1 != x1 && e2 != x2     )\r\n          {\r\n            if ( e1 > e2 || e2 == e1 + ras.precision )\r\n            {\r\n              Int  dropOutControl = P_Left->flags & 7;\r\n\r\n\r\n              if ( dropOutControl != 2 )\r\n              {\r\n                /* a drop-out was detected */\r\n\r\n                P_Left ->X = x1;\r\n                P_Right->X = x2;\r\n\r\n                /* mark profile for drop-out processing */\r\n                P_Left->countL = 1;\r\n                dropouts++;\r\n              }\r\n\r\n              goto Skip_To_Next;\r\n            }\r\n          }\r\n\r\n          ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );\r\n\r\n        Skip_To_Next:\r\n\r\n          P_Left  = P_Left->link;\r\n          P_Right = P_Right->link;\r\n        }\r\n\r\n        /* handle drop-outs _after_ the span drawing --       */\r\n        /* drop-out processing has been moved out of the loop */\r\n        /* for performance tuning                             */\r\n        if ( dropouts > 0 )\r\n          goto Scan_DropOuts;\r\n\r\n      Next_Line:\r\n\r\n        ras.Proc_Sweep_Step( RAS_VAR );\r\n\r\n        y++;\r\n\r\n        if ( y < y_change )\r\n        {\r\n          Sort( &draw_left  );\r\n          Sort( &draw_right );\r\n        }\r\n      }\r\n\r\n      /* now finalize the profiles that need it */\r\n\r\n      P = draw_left;\r\n      while ( P )\r\n      {\r\n        Q = P->link;\r\n        if ( P->height == 0 )\r\n          DelOld( &draw_left, P );\r\n        P = Q;\r\n      }\r\n\r\n      P = draw_right;\r\n      while ( P )\r\n      {\r\n        Q = P->link;\r\n        if ( P->height == 0 )\r\n          DelOld( &draw_right, P );\r\n        P = Q;\r\n      }\r\n    }\r\n\r\n    /* for gray-scaling, flush the bitmap scanline cache */\r\n    while ( y <= max_Y )\r\n    {\r\n      ras.Proc_Sweep_Step( RAS_VAR );\r\n      y++;\r\n    }\r\n\r\n    return SUCCESS;\r\n\r\n  Scan_DropOuts:\r\n\r\n    P_Left  = draw_left;\r\n    P_Right = draw_right;\r\n\r\n    while ( P_Left )\r\n    {\r\n      if ( P_Left->countL )\r\n      {\r\n        P_Left->countL = 0;\r\n#if 0\r\n        dropouts--;  /* -- this is useful when debugging only */\r\n#endif\r\n        ras.Proc_Sweep_Drop( RAS_VARS y,\r\n                                      P_Left->X,\r\n                                      P_Right->X,\r\n                                      P_Left,\r\n                                      P_Right );\r\n      }\r\n\r\n      P_Left  = P_Left->link;\r\n      P_Right = P_Right->link;\r\n    }\r\n\r\n    goto Next_Line;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Render_Single_Pass                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Perform one sweep with sub-banding.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    flipped :: If set, flip the direction of the outline.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Renderer error code.                                               */\r\n  /*                                                                       */\r\n  static int\r\n  Render_Single_Pass( RAS_ARGS Bool  flipped )\r\n  {\r\n    Short  i, j, k;\r\n\r\n\r\n    while ( ras.band_top >= 0 )\r\n    {\r\n      ras.maxY = (Long)ras.band_stack[ras.band_top].y_max * ras.precision;\r\n      ras.minY = (Long)ras.band_stack[ras.band_top].y_min * ras.precision;\r\n\r\n      ras.top = ras.buff;\r\n\r\n      ras.error = Raster_Err_None;\r\n\r\n      if ( Convert_Glyph( RAS_VARS flipped ) )\r\n      {\r\n        if ( ras.error != Raster_Err_Overflow )\r\n          return FAILURE;\r\n\r\n        ras.error = Raster_Err_None;\r\n\r\n        /* sub-banding */\r\n\r\n#ifdef DEBUG_RASTER\r\n        ClearBand( RAS_VARS TRUNC( ras.minY ), TRUNC( ras.maxY ) );\r\n#endif\r\n\r\n        i = ras.band_stack[ras.band_top].y_min;\r\n        j = ras.band_stack[ras.band_top].y_max;\r\n\r\n        k = (Short)( ( i + j ) / 2 );\r\n\r\n        if ( ras.band_top >= 7 || k < i )\r\n        {\r\n          ras.band_top = 0;\r\n          ras.error    = Raster_Err_Invalid;\r\n\r\n          return ras.error;\r\n        }\r\n\r\n        ras.band_stack[ras.band_top + 1].y_min = k;\r\n        ras.band_stack[ras.band_top + 1].y_max = j;\r\n\r\n        ras.band_stack[ras.band_top].y_max = (Short)( k - 1 );\r\n\r\n        ras.band_top++;\r\n      }\r\n      else\r\n      {\r\n        if ( ras.fProfile )\r\n          if ( Draw_Sweep( RAS_VAR ) )\r\n             return ras.error;\r\n        ras.band_top--;\r\n      }\r\n    }\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Render_Glyph                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Render a glyph in a bitmap.  Sub-banding if needed.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  Render_Glyph( RAS_ARG )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    Set_High_Precision( RAS_VARS ras.outline.flags &\r\n                                 FT_OUTLINE_HIGH_PRECISION );\r\n    ras.scale_shift = ras.precision_shift;\r\n\r\n    if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )\r\n      ras.dropOutControl = 2;\r\n    else\r\n    {\r\n      if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )\r\n        ras.dropOutControl = 4;\r\n      else\r\n        ras.dropOutControl = 0;\r\n\r\n      if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )\r\n        ras.dropOutControl += 1;\r\n    }\r\n\r\n    ras.second_pass = (FT_Byte)( !( ras.outline.flags &\r\n                                    FT_OUTLINE_SINGLE_PASS ) );\r\n\r\n    /* Vertical Sweep */\r\n    ras.Proc_Sweep_Init = Vertical_Sweep_Init;\r\n    ras.Proc_Sweep_Span = Vertical_Sweep_Span;\r\n    ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;\r\n    ras.Proc_Sweep_Step = Vertical_Sweep_Step;\r\n\r\n    ras.band_top            = 0;\r\n    ras.band_stack[0].y_min = 0;\r\n    ras.band_stack[0].y_max = (short)( ras.target.rows - 1 );\r\n\r\n    ras.bWidth  = (unsigned short)ras.target.width;\r\n    ras.bTarget = (Byte*)ras.target.buffer;\r\n\r\n    if ( ( error = Render_Single_Pass( RAS_VARS 0 ) ) != 0 )\r\n      return error;\r\n\r\n    /* Horizontal Sweep */\r\n    if ( ras.second_pass && ras.dropOutControl != 2 )\r\n    {\r\n      ras.Proc_Sweep_Init = Horizontal_Sweep_Init;\r\n      ras.Proc_Sweep_Span = Horizontal_Sweep_Span;\r\n      ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;\r\n      ras.Proc_Sweep_Step = Horizontal_Sweep_Step;\r\n\r\n      ras.band_top            = 0;\r\n      ras.band_stack[0].y_min = 0;\r\n      ras.band_stack[0].y_max = (short)( ras.target.width - 1 );\r\n\r\n      if ( ( error = Render_Single_Pass( RAS_VARS 1 ) ) != 0 )\r\n        return error;\r\n    }\r\n\r\n    return Raster_Err_None;\r\n  }\r\n\r\n\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Render_Gray_Glyph                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Render a glyph with grayscaling.  Sub-banding if needed.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  Render_Gray_Glyph( RAS_ARG )\r\n  {\r\n    Long      pixel_width;\r\n    FT_Error  error;\r\n\r\n\r\n    Set_High_Precision( RAS_VARS ras.outline.flags &\r\n                                 FT_OUTLINE_HIGH_PRECISION );\r\n    ras.scale_shift = ras.precision_shift + 1;\r\n\r\n    if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )\r\n      ras.dropOutControl = 2;\r\n    else\r\n    {\r\n      if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )\r\n        ras.dropOutControl = 4;\r\n      else\r\n        ras.dropOutControl = 0;\r\n\r\n      if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )\r\n        ras.dropOutControl += 1;\r\n    }\r\n\r\n    ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );\r\n\r\n    /* Vertical Sweep */\r\n\r\n    ras.band_top            = 0;\r\n    ras.band_stack[0].y_min = 0;\r\n    ras.band_stack[0].y_max = 2 * ras.target.rows - 1;\r\n\r\n    ras.bWidth  = ras.gray_width;\r\n    pixel_width = 2 * ( ( ras.target.width + 3 ) >> 2 );\r\n\r\n    if ( ras.bWidth > pixel_width )\r\n      ras.bWidth = pixel_width;\r\n\r\n    ras.bWidth  = ras.bWidth * 8;\r\n    ras.bTarget = (Byte*)ras.gray_lines;\r\n    ras.gTarget = (Byte*)ras.target.buffer;\r\n\r\n    ras.Proc_Sweep_Init = Vertical_Gray_Sweep_Init;\r\n    ras.Proc_Sweep_Span = Vertical_Sweep_Span;\r\n    ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;\r\n    ras.Proc_Sweep_Step = Vertical_Gray_Sweep_Step;\r\n\r\n    error = Render_Single_Pass( RAS_VARS 0 );\r\n    if ( error )\r\n      return error;\r\n\r\n    /* Horizontal Sweep */\r\n    if ( ras.second_pass && ras.dropOutControl != 2 )\r\n    {\r\n      ras.Proc_Sweep_Init = Horizontal_Sweep_Init;\r\n      ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;\r\n      ras.Proc_Sweep_Drop = Horizontal_Gray_Sweep_Drop;\r\n      ras.Proc_Sweep_Step = Horizontal_Sweep_Step;\r\n\r\n      ras.band_top            = 0;\r\n      ras.band_stack[0].y_min = 0;\r\n      ras.band_stack[0].y_max = ras.target.width * 2 - 1;\r\n\r\n      error = Render_Single_Pass( RAS_VARS 1 );\r\n      if ( error )\r\n        return error;\r\n    }\r\n\r\n    return Raster_Err_None;\r\n  }\r\n\r\n#else /* !FT_RASTER_OPTION_ANTI_ALIASING */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  Render_Gray_Glyph( RAS_ARG )\r\n  {\r\n    FT_UNUSED_RASTER;\r\n\r\n    return Raster_Err_Unsupported;\r\n  }\r\n\r\n#endif /* !FT_RASTER_OPTION_ANTI_ALIASING */\r\n\r\n\r\n  static void\r\n  ft_black_init( black_PRaster  raster )\r\n  {\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n    FT_UInt  n;\r\n\r\n\r\n    /* set default 5-levels gray palette */\r\n    for ( n = 0; n < 5; n++ )\r\n      raster->grays[n] = n * 255 / 4;\r\n\r\n    raster->gray_width = RASTER_GRAY_LINES / 2;\r\n#else\r\n    FT_UNUSED( raster );\r\n#endif\r\n  }\r\n\r\n\r\n  /**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/\r\n  /****                         a static object.                  *****/\r\n\r\n\r\n#ifdef _STANDALONE_\r\n\r\n\r\n  static int\r\n  ft_black_new( void*       memory,\r\n                FT_Raster  *araster )\r\n  {\r\n     static black_TRaster  the_raster;\r\n     FT_UNUSED( memory );\r\n\r\n\r\n     *araster = (FT_Raster)&the_raster;\r\n     FT_MEM_ZERO( &the_raster, sizeof ( the_raster ) );\r\n     ft_black_init( &the_raster );\r\n\r\n     return 0;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_black_done( FT_Raster  raster )\r\n  {\r\n    /* nothing */\r\n    FT_UNUSED( raster );\r\n  }\r\n\r\n\r\n#else /* !_STANDALONE_ */\r\n\r\n\r\n  static int\r\n  ft_black_new( FT_Memory       memory,\r\n                black_PRaster  *araster )\r\n  {\r\n    FT_Error       error;\r\n    black_PRaster  raster = NULL;\r\n\r\n\r\n    *araster = 0;\r\n    if ( !FT_NEW( raster ) )\r\n    {\r\n      raster->memory = memory;\r\n      ft_black_init( raster );\r\n\r\n      *araster = raster;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  ft_black_done( black_PRaster  raster )\r\n  {\r\n    FT_Memory  memory = (FT_Memory)raster->memory;\r\n\r\n\r\n    FT_FREE( raster );\r\n  }\r\n\r\n\r\n#endif /* !_STANDALONE_ */\r\n\r\n\r\n  static void\r\n  ft_black_reset( black_PRaster  raster,\r\n                  char*          pool_base,\r\n                  long           pool_size )\r\n  {\r\n    if ( raster )\r\n    {\r\n      if ( pool_base && pool_size >= (long)sizeof ( black_TWorker ) + 2048 )\r\n      {\r\n        black_PWorker  worker = (black_PWorker)pool_base;\r\n\r\n\r\n        raster->buffer      = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 );\r\n        raster->buffer_size = pool_base + pool_size - (char*)raster->buffer;\r\n        raster->worker      = worker;\r\n      }\r\n      else\r\n      {\r\n        raster->buffer      = NULL;\r\n        raster->buffer_size = 0;\r\n        raster->worker      = NULL;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  ft_black_set_mode( black_PRaster  raster,\r\n                     unsigned long  mode,\r\n                     const char*    palette )\r\n  {\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n\r\n    if ( mode == FT_MAKE_TAG( 'p', 'a', 'l', '5' ) )\r\n    {\r\n      /* set 5-levels gray palette */\r\n      raster->grays[0] = palette[0];\r\n      raster->grays[1] = palette[1];\r\n      raster->grays[2] = palette[2];\r\n      raster->grays[3] = palette[3];\r\n      raster->grays[4] = palette[4];\r\n    }\r\n\r\n#else\r\n\r\n    FT_UNUSED( raster );\r\n    FT_UNUSED( mode );\r\n    FT_UNUSED( palette );\r\n\r\n#endif\r\n  }\r\n\r\n\r\n  static int\r\n  ft_black_render( black_PRaster            raster,\r\n                   const FT_Raster_Params*  params )\r\n  {\r\n    const FT_Outline*  outline    = (const FT_Outline*)params->source;\r\n    const FT_Bitmap*   target_map = params->target;\r\n    black_PWorker      worker;\r\n\r\n\r\n    if ( !raster || !raster->buffer || !raster->buffer_size )\r\n      return Raster_Err_Not_Ini;\r\n\r\n    if ( !outline )\r\n      return Raster_Err_Invalid;\r\n\r\n    /* return immediately if the outline is empty */\r\n    if ( outline->n_points == 0 || outline->n_contours <= 0 )\r\n      return Raster_Err_None;\r\n\r\n    if ( !outline->contours || !outline->points )\r\n      return Raster_Err_Invalid;\r\n\r\n    if ( outline->n_points !=\r\n           outline->contours[outline->n_contours - 1] + 1 )\r\n      return Raster_Err_Invalid;\r\n\r\n    worker = raster->worker;\r\n\r\n    /* this version of the raster does not support direct rendering, sorry */\r\n    if ( params->flags & FT_RASTER_FLAG_DIRECT )\r\n      return Raster_Err_Unsupported;\r\n\r\n    if ( !target_map )\r\n      return Raster_Err_Invalid;\r\n\r\n    /* nothing to do */\r\n    if ( !target_map->width || !target_map->rows )\r\n      return Raster_Err_None;\r\n\r\n    if ( !target_map->buffer )\r\n      return Raster_Err_Invalid;\r\n\r\n    ras.outline = *outline;\r\n    ras.target  = *target_map;\r\n\r\n    worker->buff       = (PLong) raster->buffer;\r\n    worker->sizeBuff   = worker->buff +\r\n                           raster->buffer_size / sizeof ( Long );\r\n#ifdef FT_RASTER_OPTION_ANTI_ALIASING\r\n    worker->grays      = raster->grays;\r\n    worker->gray_width = raster->gray_width;\r\n\r\n    FT_MEM_ZERO( worker->gray_lines, worker->gray_width * 2 );\r\n#endif\r\n\r\n    return ( params->flags & FT_RASTER_FLAG_AA )\r\n           ? Render_Gray_Glyph( RAS_VAR )\r\n           : Render_Glyph( RAS_VAR );\r\n  }\r\n\r\n\r\n  FT_DEFINE_RASTER_FUNCS( ft_standard_raster,\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n    (FT_Raster_New_Func)     ft_black_new,\r\n    (FT_Raster_Reset_Func)   ft_black_reset,\r\n    (FT_Raster_Set_Mode_Func)ft_black_set_mode,\r\n    (FT_Raster_Render_Func)  ft_black_render,\r\n    (FT_Raster_Done_Func)    ft_black_done\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/ftraster.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftraster.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph rasterizer (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used        */\r\n/*  modified and distributed under the terms of the FreeType project       */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTRASTER_H__\r\n#define __FTRASTER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_IMAGE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Uncomment the following line if you are using ftraster.c as a         */\r\n  /* standalone module, fully independent of FreeType.                     */\r\n  /*                                                                       */\r\n/* #define _STANDALONE_ */\r\n\r\n  FT_EXPORT_VAR( const FT_Raster_Funcs )  ft_standard_raster;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTRASTER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/ftrend1.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrend1.c                                                              */\r\n/*                                                                         */\r\n/*    The FreeType glyph rasterizer interface (body).                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2003, 2005, 2006, 2011 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_OUTLINE_H\r\n#include \"ftrend1.h\"\r\n#include \"ftraster.h\"\r\n#include \"rastpic.h\"\r\n\r\n#include \"rasterrs.h\"\r\n\r\n\r\n  /* initialize renderer -- init its raster */\r\n  static FT_Error\r\n  ft_raster1_init( FT_Renderer  render )\r\n  {\r\n    FT_Library  library = FT_MODULE_LIBRARY( render );\r\n\r\n\r\n    render->clazz->raster_class->raster_reset( render->raster,\r\n                                               library->raster_pool,\r\n                                               library->raster_pool_size );\r\n\r\n    return Raster_Err_Ok;\r\n  }\r\n\r\n\r\n  /* set render-specific mode */\r\n  static FT_Error\r\n  ft_raster1_set_mode( FT_Renderer  render,\r\n                       FT_ULong     mode_tag,\r\n                       FT_Pointer   data )\r\n  {\r\n    /* we simply pass it to the raster */\r\n    return render->clazz->raster_class->raster_set_mode( render->raster,\r\n                                                         mode_tag,\r\n                                                         data );\r\n  }\r\n\r\n\r\n  /* transform a given glyph image */\r\n  static FT_Error\r\n  ft_raster1_transform( FT_Renderer       render,\r\n                        FT_GlyphSlot      slot,\r\n                        const FT_Matrix*  matrix,\r\n                        const FT_Vector*  delta )\r\n  {\r\n    FT_Error error = Raster_Err_Ok;\r\n\r\n\r\n    if ( slot->format != render->glyph_format )\r\n    {\r\n      error = Raster_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( matrix )\r\n      FT_Outline_Transform( &slot->outline, matrix );\r\n\r\n    if ( delta )\r\n      FT_Outline_Translate( &slot->outline, delta->x, delta->y );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* return the glyph's control box */\r\n  static void\r\n  ft_raster1_get_cbox( FT_Renderer   render,\r\n                       FT_GlyphSlot  slot,\r\n                       FT_BBox*      cbox )\r\n  {\r\n    FT_MEM_ZERO( cbox, sizeof ( *cbox ) );\r\n\r\n    if ( slot->format == render->glyph_format )\r\n      FT_Outline_Get_CBox( &slot->outline, cbox );\r\n  }\r\n\r\n\r\n  /* convert a slot's glyph image into a bitmap */\r\n  static FT_Error\r\n  ft_raster1_render( FT_Renderer       render,\r\n                     FT_GlyphSlot      slot,\r\n                     FT_Render_Mode    mode,\r\n                     const FT_Vector*  origin )\r\n  {\r\n    FT_Error     error;\r\n    FT_Outline*  outline;\r\n    FT_BBox      cbox;\r\n    FT_UInt      width, height, pitch;\r\n    FT_Bitmap*   bitmap;\r\n    FT_Memory    memory;\r\n\r\n    FT_Raster_Params  params;\r\n\r\n\r\n    /* check glyph image format */\r\n    if ( slot->format != render->glyph_format )\r\n    {\r\n      error = Raster_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* check rendering mode */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n    if ( mode != FT_RENDER_MODE_MONO )\r\n    {\r\n      /* raster1 is only capable of producing monochrome bitmaps */\r\n      if ( render->clazz == &ft_raster1_renderer_class )\r\n        return Raster_Err_Cannot_Render_Glyph;\r\n    }\r\n    else\r\n    {\r\n      /* raster5 is only capable of producing 5-gray-levels bitmaps */\r\n      if ( render->clazz == &ft_raster5_renderer_class )\r\n        return Raster_Err_Cannot_Render_Glyph;\r\n    }\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n    /* When PIC is enabled, we cannot get to the class object      */\r\n    /* so instead we check the final character in the class name   */\r\n    /* (\"raster5\" or \"raster1\"). Yes this is a hack.               */\r\n    /* The \"correct\" thing to do is have different render function */\r\n    /* for each of the classes.                                    */\r\n    if ( mode != FT_RENDER_MODE_MONO )\r\n    {\r\n      /* raster1 is only capable of producing monochrome bitmaps */\r\n      if ( render->clazz->root.module_name[6] == '1' )\r\n        return Raster_Err_Cannot_Render_Glyph;\r\n    }\r\n    else\r\n    {\r\n      /* raster5 is only capable of producing 5-gray-levels bitmaps */\r\n      if ( render->clazz->root.module_name[6] == '5' )\r\n        return Raster_Err_Cannot_Render_Glyph;\r\n    }\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n    outline = &slot->outline;\r\n\r\n    /* translate the outline to the new origin if needed */\r\n    if ( origin )\r\n      FT_Outline_Translate( outline, origin->x, origin->y );\r\n\r\n    /* compute the control box, and grid fit it */\r\n    FT_Outline_Get_CBox( outline, &cbox );\r\n\r\n    /* undocumented but confirmed: bbox values get rounded */\r\n#if 1\r\n    cbox.xMin = FT_PIX_ROUND( cbox.xMin );\r\n    cbox.yMin = FT_PIX_ROUND( cbox.yMin );\r\n    cbox.xMax = FT_PIX_ROUND( cbox.xMax );\r\n    cbox.yMax = FT_PIX_ROUND( cbox.yMax );\r\n#else\r\n    cbox.xMin = FT_PIX_FLOOR( cbox.xMin );\r\n    cbox.yMin = FT_PIX_FLOOR( cbox.yMin );\r\n    cbox.xMax = FT_PIX_CEIL( cbox.xMax );\r\n    cbox.yMax = FT_PIX_CEIL( cbox.yMax );\r\n#endif\r\n\r\n    width  = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );\r\n    height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );\r\n\r\n    if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX )\r\n    {\r\n      error = Raster_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    bitmap = &slot->bitmap;\r\n    memory = render->root.memory;\r\n\r\n    /* release old bitmap buffer */\r\n    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )\r\n    {\r\n      FT_FREE( bitmap->buffer );\r\n      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;\r\n    }\r\n\r\n    /* allocate new one, depends on pixel format */\r\n    if ( !( mode & FT_RENDER_MODE_MONO ) )\r\n    {\r\n      /* we pad to 32 bits, only for backwards compatibility with FT 1.x */\r\n      pitch              = FT_PAD_CEIL( width, 4 );\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;\r\n      bitmap->num_grays  = 256;\r\n    }\r\n    else\r\n    {\r\n      pitch              = ( ( width + 15 ) >> 4 ) << 1;\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_MONO;\r\n    }\r\n\r\n    bitmap->width = width;\r\n    bitmap->rows  = height;\r\n    bitmap->pitch = pitch;\r\n\r\n    if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) )\r\n      goto Exit;\r\n\r\n    slot->internal->flags |= FT_GLYPH_OWN_BITMAP;\r\n\r\n    /* translate outline to render it into the bitmap */\r\n    FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );\r\n\r\n    /* set up parameters */\r\n    params.target = bitmap;\r\n    params.source = outline;\r\n    params.flags  = 0;\r\n\r\n    if ( bitmap->pixel_mode == FT_PIXEL_MODE_GRAY )\r\n      params.flags |= FT_RASTER_FLAG_AA;\r\n\r\n    /* render outline into the bitmap */\r\n    error = render->raster_render( render->raster, &params );\r\n\r\n    FT_Outline_Translate( outline, cbox.xMin, cbox.yMin );\r\n\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    slot->format      = FT_GLYPH_FORMAT_BITMAP;\r\n    slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 );\r\n    slot->bitmap_top  = (FT_Int)( cbox.yMax >> 6 );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_DEFINE_RENDERER( ft_raster1_renderer_class,\r\n\r\n      FT_MODULE_RENDERER,\r\n      sizeof ( FT_RendererRec ),\r\n\r\n      \"raster1\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,    /* module specific interface */\r\n\r\n      (FT_Module_Constructor)ft_raster1_init,\r\n      (FT_Module_Destructor) 0,\r\n      (FT_Module_Requester)  0\r\n    ,\r\n\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    (FT_Renderer_RenderFunc)   ft_raster1_render,\r\n    (FT_Renderer_TransformFunc)ft_raster1_transform,\r\n    (FT_Renderer_GetCBoxFunc)  ft_raster1_get_cbox,\r\n    (FT_Renderer_SetModeFunc)  ft_raster1_set_mode,\r\n\r\n    (FT_Raster_Funcs*)    &FT_STANDARD_RASTER_GET\r\n  )\r\n\r\n\r\n  /* This renderer is _NOT_ part of the default modules; you will need */\r\n  /* to register it by hand in your application.  It should only be    */\r\n  /* used for backwards-compatibility with FT 1.x anyway.              */\r\n  /*                                                                   */\r\n  FT_DEFINE_RENDERER( ft_raster5_renderer_class,\r\n\r\n      FT_MODULE_RENDERER,\r\n      sizeof ( FT_RendererRec ),\r\n\r\n      \"raster5\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,    /* module specific interface */\r\n\r\n      (FT_Module_Constructor)ft_raster1_init,\r\n      (FT_Module_Destructor) 0,\r\n      (FT_Module_Requester)  0\r\n    ,\r\n\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    (FT_Renderer_RenderFunc)   ft_raster1_render,\r\n    (FT_Renderer_TransformFunc)ft_raster1_transform,\r\n    (FT_Renderer_GetCBoxFunc)  ft_raster1_get_cbox,\r\n    (FT_Renderer_SetModeFunc)  ft_raster1_set_mode,\r\n\r\n    (FT_Raster_Funcs*)    &FT_STANDARD_RASTER_GET\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/ftrend1.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrend1.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType glyph rasterizer interface (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTREND1_H__\r\n#define __FTREND1_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_RENDER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_DECLARE_RENDERER( ft_raster1_renderer_class )\r\n\r\n  /* this renderer is _NOT_ part of the default modules, you'll need */\r\n  /* to register it by hand in your application.  It should only be  */\r\n  /* used for backwards-compatibility with FT 1.x anyway.            */\r\n  /*                                                                 */\r\n  FT_DECLARE_RENDERER( ft_raster5_renderer_class )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTREND1_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/module.mk",
    "content": "#\r\n# FreeType 2 renderer module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += RASTER_MODULE\r\n\r\ndefine RASTER_MODULE\r\n$(OPEN_DRIVER) FT_Renderer_Class, ft_raster1_renderer_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)raster    $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/raster.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  raster.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType monochrome rasterer module component (body only).           */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"rastpic.c\"\r\n#include \"ftraster.c\"\r\n#include \"ftrend1.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/rasterrs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  rasterrs.h                                                             */\r\n/*                                                                         */\r\n/*    monochrome renderer error codes (specification only).                */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the monochrome renderer error enumeration */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __RASTERRS_H__\r\n#define __RASTERRS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  Raster_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Raster\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __RASTERRS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/rastpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  rastpic.c                                                              */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for raster module.   */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"rastpic.h\"\r\n#include \"rasterrs.h\"\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from ftraster.c */\r\n  void\r\n  FT_Init_Class_ft_standard_raster( FT_Raster_Funcs*  funcs );\r\n\r\n  void\r\n  ft_raster1_renderer_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory  memory = library->memory;\r\n\r\n\r\n    if ( pic_container->raster )\r\n    {\r\n      RasterPIC* container = (RasterPIC*)pic_container->raster;\r\n      if ( --container->ref_count )\r\n        return;\r\n      FT_FREE( container );\r\n      pic_container->raster = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  ft_raster1_renderer_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container* pic_container = &library->pic_container;\r\n    FT_Error          error         = Raster_Err_Ok;\r\n    RasterPIC*        container     = NULL;\r\n    FT_Memory         memory        = library->memory;\r\n\r\n\r\n    /* since this function also serve raster5 renderer,\r\n       it implements reference counting */\r\n    if ( pic_container->raster )\r\n    {\r\n      ((RasterPIC*)pic_container->raster)->ref_count++;\r\n      return error;\r\n    }\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->raster = container;\r\n    container->ref_count = 1;\r\n\r\n    /* initialize pointer table - this is how the module usually expects this data */\r\n    FT_Init_Class_ft_standard_raster( &container->ft_standard_raster );\r\n/*Exit:*/\r\n    if( error )\r\n      ft_raster1_renderer_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n  /* re-route these init and free functions to the above functions */\r\n  FT_Error\r\n  ft_raster5_renderer_class_pic_init( FT_Library  library )\r\n  {\r\n    return ft_raster1_renderer_class_pic_init( library );\r\n  }\r\n\r\n  void\r\n  ft_raster5_renderer_class_pic_free( FT_Library  library )\r\n  {\r\n    ft_raster1_renderer_class_pic_free( library );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/rastpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  rastpic.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for raster module.   */\r\n/*                                                                         */\r\n/*  Copyright 2009 by                                                      */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __RASTPIC_H__\r\n#define __RASTPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n#define FT_STANDARD_RASTER_GET     ft_standard_raster\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n  typedef struct RasterPIC_\r\n  {\r\n    int ref_count;\r\n    FT_Raster_Funcs ft_standard_raster;\r\n  } RasterPIC;\r\n\r\n#define GET_PIC(lib)               ((RasterPIC*)((lib)->pic_container.raster))\r\n#define FT_STANDARD_RASTER_GET     (GET_PIC(library)->ft_standard_raster)\r\n\r\n  /* see rastpic.c for the implementation */\r\n  void\r\n  ft_raster1_renderer_class_pic_free( FT_Library  library );\r\n\r\n  void\r\n  ft_raster5_renderer_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  ft_raster1_renderer_class_pic_init( FT_Library  library );\r\n\r\n  FT_Error\r\n  ft_raster5_renderer_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __RASTPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/raster/rules.mk",
    "content": "#\r\n# FreeType 2 renderer module build rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003, 2008, 2009, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# raster driver directory\r\n#\r\nRASTER_DIR := $(SRC_DIR)/raster\r\n\r\n# compilation flags for the driver\r\n#\r\nRASTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(RASTER_DIR))\r\n\r\n\r\n# raster driver sources (i.e., C files)\r\n#\r\nRASTER_DRV_SRC := $(RASTER_DIR)/ftraster.c \\\r\n                  $(RASTER_DIR)/ftrend1.c  \\\r\n                  $(RASTER_DIR)/rastpic.c\r\n\r\n\r\n# raster driver headers\r\n#\r\nRASTER_DRV_H := $(RASTER_DRV_SRC:%.c=%.h) \\\r\n                $(RASTER_DIR)/rasterrs.h\r\n\r\n\r\n# raster driver object(s)\r\n#\r\n#   RASTER_DRV_OBJ_M is used during `multi' builds.\r\n#   RASTER_DRV_OBJ_S is used during `single' builds.\r\n#\r\nRASTER_DRV_OBJ_M := $(RASTER_DRV_SRC:$(RASTER_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nRASTER_DRV_OBJ_S := $(OBJ_DIR)/raster.$O\r\n\r\n# raster driver source file for single build\r\n#\r\nRASTER_DRV_SRC_S := $(RASTER_DIR)/raster.c\r\n\r\n\r\n# raster driver - single object\r\n#\r\n$(RASTER_DRV_OBJ_S): $(RASTER_DRV_SRC_S) $(RASTER_DRV_SRC) \\\r\n                     $(FREETYPE_H) $(RASTER_DRV_H)\r\n\t$(RASTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(RASTER_DRV_SRC_S))\r\n\r\n\r\n# raster driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(RASTER_DIR)/%.c $(FREETYPE_H) $(RASTER_DRV_H)\r\n\t$(RASTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(RASTER_DRV_OBJ_S)\r\nDRV_OBJS_M += $(RASTER_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/Jamfile",
    "content": "# FreeType 2 src/sfnt Jamfile\r\n#\r\n# Copyright 2001, 2002, 2004, 2005 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) sfnt ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf sfntpic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = sfnt ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/sfnt Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/module.mk",
    "content": "#\r\n# FreeType 2 SFNT module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += SFNT_MODULE\r\n\r\ndefine SFNT_MODULE\r\n$(OPEN_DRIVER) FT_Module_Class, sfnt_module_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)sfnt      $(ECHO_DRIVER_DESC)helper module for TrueType & OpenType formats$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/rules.mk",
    "content": "#\r\n# FreeType 2 SFNT driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# SFNT driver directory\r\n#\r\nSFNT_DIR := $(SRC_DIR)/sfnt\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nSFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR))\r\n\r\n\r\n# SFNT driver sources (i.e., C files)\r\n#\r\nSFNT_DRV_SRC := $(SFNT_DIR)/ttload.c   \\\r\n                $(SFNT_DIR)/ttmtx.c    \\\r\n                $(SFNT_DIR)/ttcmap.c   \\\r\n                $(SFNT_DIR)/ttsbit.c   \\\r\n                $(SFNT_DIR)/ttpost.c   \\\r\n                $(SFNT_DIR)/ttkern.c   \\\r\n                $(SFNT_DIR)/ttbdf.c    \\\r\n                $(SFNT_DIR)/sfobjs.c   \\\r\n                $(SFNT_DIR)/sfdriver.c \\\r\n                $(SFNT_DIR)/sfntpic.c\r\n\r\n# SFNT driver headers\r\n#\r\n# Note that ttsbit0.c gets #included by ttsbit.c.\r\n#\r\nSFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h)  \\\r\n              $(SFNT_DIR)/sferrors.h \\\r\n              $(SFNT_DIR)/ttsbit0.c\r\n\r\n\r\n# SFNT driver object(s)\r\n#\r\n#   SFNT_DRV_OBJ_M is used during `multi' builds.\r\n#   SFNT_DRV_OBJ_S is used during `single' builds.\r\n#\r\nSFNT_DRV_OBJ_M := $(SFNT_DRV_SRC:$(SFNT_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nSFNT_DRV_OBJ_S := $(OBJ_DIR)/sfnt.$O\r\n\r\n# SFNT driver source file for single build\r\n#\r\nSFNT_DRV_SRC_S := $(SFNT_DIR)/sfnt.c\r\n\r\n\r\n# SFNT driver - single object\r\n#\r\n$(SFNT_DRV_OBJ_S): $(SFNT_DRV_SRC_S) $(SFNT_DRV_SRC) \\\r\n                   $(FREETYPE_H) $(SFNT_DRV_H)\r\n\t$(SFNT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SFNT_DRV_SRC_S))\r\n\r\n\r\n# SFNT driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(SFNT_DIR)/%.c $(FREETYPE_H) $(SFNT_DRV_H)\r\n\t$(SFNT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(SFNT_DRV_OBJ_S)\r\nDRV_OBJS_M += $(SFNT_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfdriver.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfdriver.c                                                             */\r\n/*                                                                         */\r\n/*    High-level SFNT driver interface (body).                             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2007, 2009-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#include \"sfdriver.h\"\r\n#include \"ttload.h\"\r\n#include \"sfobjs.h\"\r\n#include \"sfntpic.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n#include \"ttsbit.h\"\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n#include \"ttpost.h\"\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n#include \"ttbdf.h\"\r\n#include FT_SERVICE_BDF_H\r\n#endif\r\n\r\n#include \"ttcmap.h\"\r\n#include \"ttkern.h\"\r\n#include \"ttmtx.h\"\r\n\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_SFNT_H\r\n#include FT_SERVICE_TT_CMAP_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_sfdriver\r\n\r\n\r\n  /*\r\n   *  SFNT TABLE SERVICE\r\n   *\r\n   */\r\n\r\n  static void*\r\n  get_sfnt_table( TT_Face      face,\r\n                  FT_Sfnt_Tag  tag )\r\n  {\r\n    void*  table;\r\n\r\n\r\n    switch ( tag )\r\n    {\r\n    case ft_sfnt_head:\r\n      table = &face->header;\r\n      break;\r\n\r\n    case ft_sfnt_hhea:\r\n      table = &face->horizontal;\r\n      break;\r\n\r\n    case ft_sfnt_vhea:\r\n      table = face->vertical_info ? &face->vertical : 0;\r\n      break;\r\n\r\n    case ft_sfnt_os2:\r\n      table = face->os2.version == 0xFFFFU ? 0 : &face->os2;\r\n      break;\r\n\r\n    case ft_sfnt_post:\r\n      table = &face->postscript;\r\n      break;\r\n\r\n    case ft_sfnt_maxp:\r\n      table = &face->max_profile;\r\n      break;\r\n\r\n    case ft_sfnt_pclt:\r\n      table = face->pclt.Version ? &face->pclt : 0;\r\n      break;\r\n\r\n    default:\r\n      table = 0;\r\n    }\r\n\r\n    return table;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  sfnt_table_info( TT_Face    face,\r\n                   FT_UInt    idx,\r\n                   FT_ULong  *tag,\r\n                   FT_ULong  *offset,\r\n                   FT_ULong  *length )\r\n  {\r\n    if ( !offset || !length )\r\n      return SFNT_Err_Invalid_Argument;\r\n\r\n    if ( !tag )\r\n      *length = face->num_tables;\r\n    else\r\n    {\r\n      if ( idx >= face->num_tables )\r\n        return SFNT_Err_Table_Missing;\r\n\r\n      *tag    = face->dir_tables[idx].Tag;\r\n      *offset = face->dir_tables[idx].Offset;\r\n      *length = face->dir_tables[idx].Length;\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_SFNT_TABLEREC(\r\n    sfnt_service_sfnt_table,\r\n    (FT_SFNT_TableLoadFunc)tt_face_load_any,\r\n    (FT_SFNT_TableGetFunc) get_sfnt_table,\r\n    (FT_SFNT_TableInfoFunc)sfnt_table_info )\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n  /*\r\n   *  GLYPH DICT SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  sfnt_get_glyph_name( TT_Face     face,\r\n                       FT_UInt     glyph_index,\r\n                       FT_Pointer  buffer,\r\n                       FT_UInt     buffer_max )\r\n  {\r\n    FT_String*  gname;\r\n    FT_Error    error;\r\n\r\n\r\n    error = tt_face_get_ps_name( face, glyph_index, &gname );\r\n    if ( !error )\r\n      FT_STRCPYN( buffer, gname, buffer_max );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  sfnt_get_name_index( TT_Face     face,\r\n                       FT_String*  glyph_name )\r\n  {\r\n    FT_Face  root = &face->root;\r\n\r\n    FT_UInt  i, max_gid = FT_UINT_MAX;\r\n\r\n\r\n    if ( root->num_glyphs < 0 )\r\n      return 0;\r\n    else if ( (FT_ULong)root->num_glyphs < FT_UINT_MAX )\r\n      max_gid = (FT_UInt)root->num_glyphs;\r\n    else\r\n      FT_TRACE0(( \"Ignore glyph names for invalid GID 0x%08x - 0x%08x\\n\",\r\n                  FT_UINT_MAX, root->num_glyphs ));\r\n\r\n    for ( i = 0; i < max_gid; i++ )\r\n    {\r\n      FT_String*  gname;\r\n      FT_Error    error = tt_face_get_ps_name( face, i, &gname );\r\n\r\n\r\n      if ( error )\r\n        continue;\r\n\r\n      if ( !ft_strcmp( glyph_name, gname ) )\r\n        return i;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_GLYPHDICTREC(\r\n    sfnt_service_glyph_dict,\r\n    (FT_GlyphDict_GetNameFunc)  sfnt_get_glyph_name,\r\n    (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index )\r\n\r\n\r\n#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT NAME SERVICE\r\n   *\r\n   */\r\n\r\n  static const char*\r\n  sfnt_get_ps_name( TT_Face  face )\r\n  {\r\n    FT_Int       n, found_win, found_apple;\r\n    const char*  result = NULL;\r\n\r\n\r\n    /* shouldn't happen, but just in case to avoid memory leaks */\r\n    if ( face->postscript_name )\r\n      return face->postscript_name;\r\n\r\n    /* scan the name table to see whether we have a Postscript name here, */\r\n    /* either in Macintosh or Windows platform encodings                  */\r\n    found_win   = -1;\r\n    found_apple = -1;\r\n\r\n    for ( n = 0; n < face->num_names; n++ )\r\n    {\r\n      TT_NameEntryRec*  name = face->name_table.names + n;\r\n\r\n\r\n      if ( name->nameID == 6 && name->stringLength > 0 )\r\n      {\r\n        if ( name->platformID == 3     &&\r\n             name->encodingID == 1     &&\r\n             name->languageID == 0x409 )\r\n          found_win = n;\r\n\r\n        if ( name->platformID == 1 &&\r\n             name->encodingID == 0 &&\r\n             name->languageID == 0 )\r\n          found_apple = n;\r\n      }\r\n    }\r\n\r\n    if ( found_win != -1 )\r\n    {\r\n      FT_Memory         memory = face->root.memory;\r\n      TT_NameEntryRec*  name   = face->name_table.names + found_win;\r\n      FT_UInt           len    = name->stringLength / 2;\r\n      FT_Error          error  = SFNT_Err_Ok;\r\n\r\n      FT_UNUSED( error );\r\n\r\n\r\n      if ( !FT_ALLOC( result, name->stringLength + 1 ) )\r\n      {\r\n        FT_Stream   stream = face->name_table.stream;\r\n        FT_String*  r      = (FT_String*)result;\r\n        FT_Byte*    p      = (FT_Byte*)name->string;\r\n\r\n\r\n        if ( FT_STREAM_SEEK( name->stringOffset ) ||\r\n             FT_FRAME_ENTER( name->stringLength ) )\r\n        {\r\n          FT_FREE( result );\r\n          name->stringLength = 0;\r\n          name->stringOffset = 0;\r\n          FT_FREE( name->string );\r\n\r\n          goto Exit;\r\n        }\r\n\r\n        p = (FT_Byte*)stream->cursor;\r\n\r\n        for ( ; len > 0; len--, p += 2 )\r\n        {\r\n          if ( p[0] == 0 && p[1] >= 32 && p[1] < 128 )\r\n            *r++ = p[1];\r\n        }\r\n        *r = '\\0';\r\n\r\n        FT_FRAME_EXIT();\r\n      }\r\n      goto Exit;\r\n    }\r\n\r\n    if ( found_apple != -1 )\r\n    {\r\n      FT_Memory         memory = face->root.memory;\r\n      TT_NameEntryRec*  name   = face->name_table.names + found_apple;\r\n      FT_UInt           len    = name->stringLength;\r\n      FT_Error          error  = SFNT_Err_Ok;\r\n\r\n      FT_UNUSED( error );\r\n\r\n\r\n      if ( !FT_ALLOC( result, len + 1 ) )\r\n      {\r\n        FT_Stream  stream = face->name_table.stream;\r\n\r\n\r\n        if ( FT_STREAM_SEEK( name->stringOffset ) ||\r\n             FT_STREAM_READ( result, len )        )\r\n        {\r\n          name->stringOffset = 0;\r\n          name->stringLength = 0;\r\n          FT_FREE( name->string );\r\n          FT_FREE( result );\r\n          goto Exit;\r\n        }\r\n        ((char*)result)[len] = '\\0';\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    face->postscript_name = result;\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_PSFONTNAMEREC(\r\n    sfnt_service_ps_name,\r\n    (FT_PsName_GetFunc)sfnt_get_ps_name )\r\n\r\n\r\n  /*\r\n   *  TT CMAP INFO\r\n   */\r\n  FT_DEFINE_SERVICE_TTCMAPSREC(\r\n    tt_service_get_cmap_info,\r\n    (TT_CMap_Info_GetFunc)tt_get_cmap_info )\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n\r\n  static FT_Error\r\n  sfnt_get_charset_id( TT_Face       face,\r\n                       const char*  *acharset_encoding,\r\n                       const char*  *acharset_registry )\r\n  {\r\n    BDF_PropertyRec  encoding, registry;\r\n    FT_Error         error;\r\n\r\n\r\n    /* XXX: I don't know whether this is correct, since\r\n     *      tt_face_find_bdf_prop only returns something correct if we have\r\n     *      previously selected a size that is listed in the BDF table.\r\n     *      Should we change the BDF table format to include single offsets\r\n     *      for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?\r\n     */\r\n    error = tt_face_find_bdf_prop( face, \"CHARSET_REGISTRY\", &registry );\r\n    if ( !error )\r\n    {\r\n      error = tt_face_find_bdf_prop( face, \"CHARSET_ENCODING\", &encoding );\r\n      if ( !error )\r\n      {\r\n        if ( registry.type == BDF_PROPERTY_TYPE_ATOM &&\r\n             encoding.type == BDF_PROPERTY_TYPE_ATOM )\r\n        {\r\n          *acharset_encoding = encoding.u.atom;\r\n          *acharset_registry = registry.u.atom;\r\n        }\r\n        else\r\n          error = SFNT_Err_Invalid_Argument;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_DEFINE_SERVICE_BDFRec(\r\n    sfnt_service_bdf,\r\n    (FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id,\r\n    (FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop )\r\n\r\n\r\n#endif /* TT_CONFIG_OPTION_BDF */\r\n\r\n\r\n  /*\r\n   *  SERVICE LIST\r\n   */\r\n\r\n#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF\r\n  FT_DEFINE_SERVICEDESCREC5(\r\n    sfnt_services,\r\n    FT_SERVICE_ID_SFNT_TABLE,           &SFNT_SERVICE_SFNT_TABLE_GET,\r\n    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,\r\n    FT_SERVICE_ID_GLYPH_DICT,           &SFNT_SERVICE_GLYPH_DICT_GET,\r\n    FT_SERVICE_ID_BDF,                  &SFNT_SERVICE_BDF_GET,\r\n    FT_SERVICE_ID_TT_CMAP,              &TT_SERVICE_CMAP_INFO_GET )\r\n#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n  FT_DEFINE_SERVICEDESCREC4(\r\n    sfnt_services,\r\n    FT_SERVICE_ID_SFNT_TABLE,           &SFNT_SERVICE_SFNT_TABLE_GET,\r\n    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,\r\n    FT_SERVICE_ID_GLYPH_DICT,           &SFNT_SERVICE_GLYPH_DICT_GET,\r\n    FT_SERVICE_ID_TT_CMAP,              &TT_SERVICE_CMAP_INFO_GET )\r\n#elif defined TT_CONFIG_OPTION_BDF\r\n  FT_DEFINE_SERVICEDESCREC4(\r\n    sfnt_services,\r\n    FT_SERVICE_ID_SFNT_TABLE,           &SFNT_SERVICE_SFNT_TABLE_GET,\r\n    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,\r\n    FT_SERVICE_ID_BDF,                  &SFNT_SERVICE_BDF_GET,\r\n    FT_SERVICE_ID_TT_CMAP,              &TT_SERVICE_CMAP_INFO_GET )\r\n#else\r\n  FT_DEFINE_SERVICEDESCREC3(\r\n    sfnt_services,\r\n    FT_SERVICE_ID_SFNT_TABLE,           &SFNT_SERVICE_SFNT_TABLE_GET,\r\n    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,\r\n    FT_SERVICE_ID_TT_CMAP,              &TT_SERVICE_CMAP_INFO_GET )\r\n#endif\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  sfnt_get_interface( FT_Module    module,\r\n                      const char*  module_interface )\r\n  {\r\n    /* SFNT_SERVICES_GET derefers `library' in PIC mode */\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    FT_Library  library;\r\n\r\n\r\n    if ( !module )\r\n      return NULL;\r\n    library = module->library;\r\n    if ( !library )\r\n      return NULL;\r\n#else\r\n    FT_UNUSED( module );\r\n#endif\r\n\r\n    return ft_service_list_lookup( SFNT_SERVICES_GET, module_interface );\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_load_sfnt_header_stub( TT_Face      face,\r\n                                 FT_Stream    stream,\r\n                                 FT_Long      face_index,\r\n                                 SFNT_Header  header )\r\n  {\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( face_index );\r\n    FT_UNUSED( header );\r\n\r\n    return SFNT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_load_directory_stub( TT_Face      face,\r\n                               FT_Stream    stream,\r\n                               SFNT_Header  header )\r\n  {\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( header );\r\n\r\n    return SFNT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_load_hdmx_stub( TT_Face    face,\r\n                          FT_Stream  stream )\r\n  {\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( stream );\r\n\r\n    return SFNT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  tt_face_free_hdmx_stub( TT_Face  face )\r\n  {\r\n    FT_UNUSED( face );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_set_sbit_strike_stub( TT_Face    face,\r\n                                FT_UInt    x_ppem,\r\n                                FT_UInt    y_ppem,\r\n                                FT_ULong*  astrike_index )\r\n  {\r\n    /*\r\n     * We simply forge a FT_Size_Request and call the real function\r\n     * that does all the work.\r\n     *\r\n     * This stub might be called by libXfont in the X.Org Xserver,\r\n     * compiled against version 2.1.8 or newer.\r\n     */\r\n\r\n    FT_Size_RequestRec  req;\r\n\r\n\r\n    req.type           = FT_SIZE_REQUEST_TYPE_NOMINAL;\r\n    req.width          = (FT_F26Dot6)x_ppem;\r\n    req.height         = (FT_F26Dot6)y_ppem;\r\n    req.horiResolution = 0;\r\n    req.vertResolution = 0;\r\n\r\n    *astrike_index = 0x7FFFFFFFUL;\r\n\r\n    return tt_face_set_sbit_strike( face, &req, astrike_index );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_load_sbit_stub( TT_Face    face,\r\n                          FT_Stream  stream )\r\n  {\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( stream );\r\n\r\n    /*\r\n     *  This function was originally implemented to load the sbit table.\r\n     *  However, it has been replaced by `tt_face_load_eblc', and this stub\r\n     *  is only there for some rogue clients which would want to call it\r\n     *  directly (which doesn't make much sense).\r\n     */\r\n    return SFNT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  tt_face_free_sbit_stub( TT_Face  face )\r\n  {\r\n    /* nothing to do in this stub */\r\n    FT_UNUSED( face );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_load_charmap_stub( TT_Face    face,\r\n                             void*      cmap,\r\n                             FT_Stream  input )\r\n  {\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( cmap );\r\n    FT_UNUSED( input );\r\n\r\n    return SFNT_Err_Unimplemented_Feature;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_face_free_charmap_stub( TT_Face  face,\r\n                             void*    cmap )\r\n  {\r\n    FT_UNUSED( face );\r\n    FT_UNUSED( cmap );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n#define PUT_EMBEDDED_BITMAPS( a )  a\r\n#else\r\n#define PUT_EMBEDDED_BITMAPS( a )  NULL\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n#define PUT_PS_NAMES( a )  a\r\n#else\r\n#define PUT_PS_NAMES( a )  NULL\r\n#endif\r\n\r\n  FT_DEFINE_SFNT_INTERFACE(\r\n    sfnt_interface,\r\n    tt_face_goto_table,\r\n\r\n    sfnt_init_face,\r\n    sfnt_load_face,\r\n    sfnt_done_face,\r\n    sfnt_get_interface,\r\n\r\n    tt_face_load_any,\r\n\r\n    tt_face_load_sfnt_header_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    tt_face_load_directory_stub,   /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    tt_face_load_head,\r\n    tt_face_load_hhea,\r\n    tt_face_load_cmap,\r\n    tt_face_load_maxp,\r\n    tt_face_load_os2,\r\n    tt_face_load_post,\r\n\r\n    tt_face_load_name,\r\n    tt_face_free_name,\r\n\r\n    tt_face_load_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    tt_face_free_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    tt_face_load_kern,\r\n    tt_face_load_gasp,\r\n    tt_face_load_pclt,\r\n\r\n    /* see `ttload.h' */\r\n    PUT_EMBEDDED_BITMAPS( tt_face_load_bhed ),\r\n\r\n    tt_face_set_sbit_strike_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    tt_face_load_sbit_stub,       /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    tt_find_sbit_image,   /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    tt_load_sbit_metrics, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    PUT_EMBEDDED_BITMAPS( tt_face_load_sbit_image ),\r\n\r\n    tt_face_free_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    /* see `ttpost.h' */\r\n    PUT_PS_NAMES( tt_face_get_ps_name   ),\r\n    PUT_PS_NAMES( tt_face_free_ps_names ),\r\n\r\n    tt_face_load_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    tt_face_free_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    /* since version 2.1.8 */\r\n\r\n    tt_face_get_kerning,\r\n\r\n    /* since version 2.2 */\r\n\r\n    tt_face_load_font_dir,\r\n    tt_face_load_hmtx,\r\n\r\n    /* see `ttsbit.h' and `sfnt.h' */\r\n    PUT_EMBEDDED_BITMAPS( tt_face_load_eblc ),\r\n    PUT_EMBEDDED_BITMAPS( tt_face_free_eblc ),\r\n\r\n    PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike     ),\r\n    PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ),\r\n\r\n    tt_face_get_metrics\r\n  )\r\n\r\n\r\n  FT_DEFINE_MODULE(\r\n    sfnt_module_class,\r\n\r\n    0,  /* not a font driver or renderer */\r\n    sizeof ( FT_ModuleRec ),\r\n\r\n    \"sfnt\",     /* driver name                            */\r\n    0x10000L,   /* driver version 1.0                     */\r\n    0x20000L,   /* driver requires FreeType 2.0 or higher */\r\n\r\n    (const void*)&SFNT_INTERFACE_GET,  /* module specific interface */\r\n\r\n    (FT_Module_Constructor)0,\r\n    (FT_Module_Destructor) 0,\r\n    (FT_Module_Requester)  sfnt_get_interface )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfdriver.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfdriver.h                                                             */\r\n/*                                                                         */\r\n/*    High-level SFNT driver interface (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SFDRIVER_H__\r\n#define __SFDRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_DECLARE_MODULE( sfnt_module_class )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SFDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sferrors.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sferrors.h                                                             */\r\n/*                                                                         */\r\n/*    SFNT error codes (specification only).                               */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2004, 2012 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the SFNT error enumeration constants.     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __SFERRORS_H__\r\n#define __SFERRORS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  SFNT_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_SFNT\r\n\r\n#define FT_KEEP_ERR_PREFIX\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __SFERRORS_H__ */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfnt.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfnt.c                                                                 */\r\n/*                                                                         */\r\n/*    Single object library component.                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"sfntpic.c\"\r\n#include \"ttload.c\"\r\n#include \"ttmtx.c\"\r\n#include \"ttcmap.c\"\r\n#include \"ttkern.c\"\r\n#include \"sfobjs.c\"\r\n#include \"sfdriver.c\"\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n#include \"ttsbit.c\"\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n#include \"ttpost.c\"\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n#include \"ttbdf.c\"\r\n#endif\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfntpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfntpic.c                                                              */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for sfnt module.     */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"sfntpic.h\"\r\n#include \"sferrors.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from sfdriver.c */\r\n  FT_Error\r\n  FT_Create_Class_sfnt_services( FT_Library           library,\r\n                                 FT_ServiceDescRec**  output_class );\r\n\r\n  void\r\n  FT_Destroy_Class_sfnt_services( FT_Library          library,\r\n                                  FT_ServiceDescRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_sfnt_interface( FT_Library       library,\r\n                                SFNT_Interface*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_sfnt_service_glyph_dict(\r\n    FT_Library                library,\r\n    FT_Service_GlyphDictRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_sfnt_service_ps_name(\r\n    FT_Library                 library,\r\n    FT_Service_PsFontNameRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_tt_service_get_cmap_info(\r\n    FT_Library              library,\r\n    FT_Service_TTCMapsRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_sfnt_service_sfnt_table(\r\n    FT_Service_SFNT_TableRec*  clazz );\r\n\r\n  /* forward declaration of PIC init functions from ttcmap.c */\r\n  FT_Error\r\n  FT_Create_Class_tt_cmap_classes( FT_Library       library,\r\n                                   TT_CMap_Class**  output_class );\r\n\r\n  void\r\n  FT_Destroy_Class_tt_cmap_classes( FT_Library      library,\r\n                                    TT_CMap_Class*  clazz );\r\n\r\n\r\n  void\r\n  sfnt_module_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    if ( pic_container->sfnt )\r\n    {\r\n      sfntModulePIC*  container = (sfntModulePIC*)pic_container->sfnt;\r\n\r\n\r\n      if ( container->sfnt_services )\r\n        FT_Destroy_Class_sfnt_services( library,\r\n                                        container->sfnt_services );\r\n      container->sfnt_services = NULL;\r\n\r\n      if ( container->tt_cmap_classes )\r\n        FT_Destroy_Class_tt_cmap_classes( library,\r\n                                          container->tt_cmap_classes );\r\n      container->tt_cmap_classes = NULL;\r\n\r\n      FT_FREE( container );\r\n      pic_container->sfnt = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  sfnt_module_class_pic_init( FT_Library library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = SFNT_Err_Ok;\r\n    sfntModulePIC*     container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->sfnt = container;\r\n\r\n    /* initialize pointer table -                       */\r\n    /* this is how the module usually expects this data */\r\n    error = FT_Create_Class_sfnt_services( library,\r\n                                           &container->sfnt_services );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = FT_Create_Class_tt_cmap_classes( library,\r\n                                             &container->tt_cmap_classes );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_Init_Class_sfnt_service_glyph_dict(\r\n      library, &container->sfnt_service_glyph_dict );\r\n    FT_Init_Class_sfnt_service_ps_name(\r\n      library, &container->sfnt_service_ps_name );\r\n    FT_Init_Class_tt_service_get_cmap_info(\r\n      library, &container->tt_service_get_cmap_info );\r\n    FT_Init_Class_sfnt_service_sfnt_table(\r\n      &container->sfnt_service_sfnt_table );\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n    FT_Init_Class_sfnt_service_bdf( &container->sfnt_service_bdf );\r\n#endif\r\n    FT_Init_Class_sfnt_interface( library, &container->sfnt_interface );\r\n\r\n  Exit:\r\n    if ( error )\r\n      sfnt_module_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfntpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfntpic.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for sfnt module.     */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SFNTPIC_H__\r\n#define __SFNTPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define SFNT_SERVICES_GET            sfnt_services\r\n#define SFNT_SERVICE_GLYPH_DICT_GET  sfnt_service_glyph_dict\r\n#define SFNT_SERVICE_PS_NAME_GET     sfnt_service_ps_name\r\n#define TT_SERVICE_CMAP_INFO_GET     tt_service_get_cmap_info\r\n#define SFNT_SERVICES_GET            sfnt_services\r\n#define TT_CMAP_CLASSES_GET          tt_cmap_classes\r\n#define SFNT_SERVICE_SFNT_TABLE_GET  sfnt_service_sfnt_table\r\n#define SFNT_SERVICE_BDF_GET         sfnt_service_bdf\r\n#define SFNT_INTERFACE_GET           sfnt_interface\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* some include files required for members of sfntModulePIC */\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_SFNT_H\r\n#include FT_SERVICE_TT_CMAP_H\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n#include \"ttbdf.h\"\r\n#include FT_SERVICE_BDF_H\r\n#endif\r\n\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include \"ttcmap.h\"\r\n\r\n\r\n  typedef struct  sfntModulePIC_\r\n  {\r\n    FT_ServiceDescRec*        sfnt_services;\r\n    FT_Service_GlyphDictRec   sfnt_service_glyph_dict;\r\n    FT_Service_PsFontNameRec  sfnt_service_ps_name;\r\n    FT_Service_TTCMapsRec     tt_service_get_cmap_info;\r\n    TT_CMap_Class*            tt_cmap_classes;\r\n    FT_Service_SFNT_TableRec  sfnt_service_sfnt_table;\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n    FT_Service_BDFRec         sfnt_service_bdf;\r\n#endif\r\n    SFNT_Interface            sfnt_interface;\r\n\r\n  } sfntModulePIC;\r\n\r\n\r\n#define GET_PIC( lib )  \\\r\n          ( (sfntModulePIC*)((lib)->pic_container.sfnt) )\r\n\r\n#define SFNT_SERVICES_GET  \\\r\n          ( GET_PIC( library )->sfnt_services )\r\n#define SFNT_SERVICE_GLYPH_DICT_GET  \\\r\n          ( GET_PIC( library )->sfnt_service_glyph_dict )\r\n#define SFNT_SERVICE_PS_NAME_GET  \\\r\n          ( GET_PIC( library )->sfnt_service_ps_name )\r\n#define TT_SERVICE_CMAP_INFO_GET  \\\r\n          ( GET_PIC( library )->tt_service_get_cmap_info )\r\n#define SFNT_SERVICES_GET  \\\r\n          ( GET_PIC( library )->sfnt_services )\r\n#define TT_CMAP_CLASSES_GET  \\\r\n          ( GET_PIC( library )->tt_cmap_classes )\r\n#define SFNT_SERVICE_SFNT_TABLE_GET  \\\r\n          ( GET_PIC( library )->sfnt_service_sfnt_table )\r\n#define SFNT_SERVICE_BDF_GET  \\\r\n          ( GET_PIC( library )->sfnt_service_bdf )\r\n#define SFNT_INTERFACE_GET  \\\r\n          ( GET_PIC( library )->sfnt_interface )\r\n\r\n\r\n  /* see sfntpic.c for the implementation */\r\n  void\r\n  sfnt_module_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  sfnt_module_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SFNTPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfobjs.c                                                               */\r\n/*                                                                         */\r\n/*    SFNT object management (base).                                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2008, 2010-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"sfobjs.h\"\r\n#include \"ttload.h\"\r\n#include \"ttcmap.h\"\r\n#include \"ttkern.h\"\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_TRUETYPE_IDS_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_SFNT_NAMES_H\r\n#include \"sferrors.h\"\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n#include \"ttbdf.h\"\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_sfobjs\r\n\r\n\r\n\r\n  /* convert a UTF-16 name entry to ASCII */\r\n  static FT_String*\r\n  tt_name_entry_ascii_from_utf16( TT_NameEntry  entry,\r\n                                  FT_Memory     memory )\r\n  {\r\n    FT_String*  string = NULL;\r\n    FT_UInt     len, code, n;\r\n    FT_Byte*    read   = (FT_Byte*)entry->string;\r\n    FT_Error    error;\r\n\r\n\r\n    len = (FT_UInt)entry->stringLength / 2;\r\n\r\n    if ( FT_NEW_ARRAY( string, len + 1 ) )\r\n      return NULL;\r\n\r\n    for ( n = 0; n < len; n++ )\r\n    {\r\n      code = FT_NEXT_USHORT( read );\r\n\r\n      if ( code == 0 )\r\n        break;\r\n\r\n      if ( code < 32 || code > 127 )\r\n        code = '?';\r\n\r\n      string[n] = (char)code;\r\n    }\r\n\r\n    string[n] = 0;\r\n\r\n    return string;\r\n  }\r\n\r\n\r\n  /* convert an Apple Roman or symbol name entry to ASCII */\r\n  static FT_String*\r\n  tt_name_entry_ascii_from_other( TT_NameEntry  entry,\r\n                                  FT_Memory     memory )\r\n  {\r\n    FT_String*  string = NULL;\r\n    FT_UInt     len, code, n;\r\n    FT_Byte*    read   = (FT_Byte*)entry->string;\r\n    FT_Error    error;\r\n\r\n\r\n    len = (FT_UInt)entry->stringLength;\r\n\r\n    if ( FT_NEW_ARRAY( string, len + 1 ) )\r\n      return NULL;\r\n\r\n    for ( n = 0; n < len; n++ )\r\n    {\r\n      code = *read++;\r\n\r\n      if ( code == 0 )\r\n        break;\r\n\r\n      if ( code < 32 || code > 127 )\r\n        code = '?';\r\n\r\n      string[n] = (char)code;\r\n    }\r\n\r\n    string[n] = 0;\r\n\r\n    return string;\r\n  }\r\n\r\n\r\n  typedef FT_String*  (*TT_NameEntry_ConvertFunc)( TT_NameEntry  entry,\r\n                                                   FT_Memory     memory );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_get_name                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Returns a given ENGLISH name record in ASCII.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the source face object.                      */\r\n  /*                                                                       */\r\n  /*    nameid :: The name id of the name record to return.                */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    name   :: The address of a string pointer.  NULL if no name is     */\r\n  /*              present.                                                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  tt_face_get_name( TT_Face      face,\r\n                    FT_UShort    nameid,\r\n                    FT_String**  name )\r\n  {\r\n    FT_Memory         memory = face->root.memory;\r\n    FT_Error          error  = SFNT_Err_Ok;\r\n    FT_String*        result = NULL;\r\n    FT_UShort         n;\r\n    TT_NameEntryRec*  rec;\r\n    FT_Int            found_apple         = -1;\r\n    FT_Int            found_apple_roman   = -1;\r\n    FT_Int            found_apple_english = -1;\r\n    FT_Int            found_win           = -1;\r\n    FT_Int            found_unicode       = -1;\r\n\r\n    FT_Bool           is_english = 0;\r\n\r\n    TT_NameEntry_ConvertFunc  convert;\r\n\r\n\r\n    FT_ASSERT( name );\r\n\r\n    rec = face->name_table.names;\r\n    for ( n = 0; n < face->num_names; n++, rec++ )\r\n    {\r\n      /* According to the OpenType 1.3 specification, only Microsoft or  */\r\n      /* Apple platform IDs might be used in the `name' table.  The      */\r\n      /* `Unicode' platform is reserved for the `cmap' table, and the    */\r\n      /* `ISO' one is deprecated.                                        */\r\n      /*                                                                 */\r\n      /* However, the Apple TrueType specification doesn't say the same  */\r\n      /* thing and goes to suggest that all Unicode `name' table entries */\r\n      /* should be coded in UTF-16 (in big-endian format I suppose).     */\r\n      /*                                                                 */\r\n      if ( rec->nameID == nameid && rec->stringLength > 0 )\r\n      {\r\n        switch ( rec->platformID )\r\n        {\r\n        case TT_PLATFORM_APPLE_UNICODE:\r\n        case TT_PLATFORM_ISO:\r\n          /* there is `languageID' to check there.  We should use this */\r\n          /* field only as a last solution when nothing else is        */\r\n          /* available.                                                */\r\n          /*                                                           */\r\n          found_unicode = n;\r\n          break;\r\n\r\n        case TT_PLATFORM_MACINTOSH:\r\n          /* This is a bit special because some fonts will use either    */\r\n          /* an English language id, or a Roman encoding id, to indicate */\r\n          /* the English version of its font name.                       */\r\n          /*                                                             */\r\n          if ( rec->languageID == TT_MAC_LANGID_ENGLISH )\r\n            found_apple_english = n;\r\n          else if ( rec->encodingID == TT_MAC_ID_ROMAN )\r\n            found_apple_roman = n;\r\n          break;\r\n\r\n        case TT_PLATFORM_MICROSOFT:\r\n          /* we only take a non-English name when there is nothing */\r\n          /* else available in the font                            */\r\n          /*                                                       */\r\n          if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 )\r\n          {\r\n            switch ( rec->encodingID )\r\n            {\r\n            case TT_MS_ID_SYMBOL_CS:\r\n            case TT_MS_ID_UNICODE_CS:\r\n            case TT_MS_ID_UCS_4:\r\n              is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 );\r\n              found_win  = n;\r\n              break;\r\n\r\n            default:\r\n              ;\r\n            }\r\n          }\r\n          break;\r\n\r\n        default:\r\n          ;\r\n        }\r\n      }\r\n    }\r\n\r\n    found_apple = found_apple_roman;\r\n    if ( found_apple_english >= 0 )\r\n      found_apple = found_apple_english;\r\n\r\n    /* some fonts contain invalid Unicode or Macintosh formatted entries; */\r\n    /* we will thus favor names encoded in Windows formats if available   */\r\n    /* (provided it is an English name)                                   */\r\n    /*                                                                    */\r\n    convert = NULL;\r\n    if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) )\r\n    {\r\n      rec = face->name_table.names + found_win;\r\n      switch ( rec->encodingID )\r\n      {\r\n        /* all Unicode strings are encoded using UTF-16BE */\r\n      case TT_MS_ID_UNICODE_CS:\r\n      case TT_MS_ID_SYMBOL_CS:\r\n        convert = tt_name_entry_ascii_from_utf16;\r\n        break;\r\n\r\n      case TT_MS_ID_UCS_4:\r\n        /* Apparently, if this value is found in a name table entry, it is */\r\n        /* documented as `full Unicode repertoire'.  Experience with the   */\r\n        /* MsGothic font shipped with Windows Vista shows that this really */\r\n        /* means UTF-16 encoded names (UCS-4 values are only used within   */\r\n        /* charmaps).                                                      */\r\n        convert = tt_name_entry_ascii_from_utf16;\r\n        break;\r\n\r\n      default:\r\n        ;\r\n      }\r\n    }\r\n    else if ( found_apple >= 0 )\r\n    {\r\n      rec     = face->name_table.names + found_apple;\r\n      convert = tt_name_entry_ascii_from_other;\r\n    }\r\n    else if ( found_unicode >= 0 )\r\n    {\r\n      rec     = face->name_table.names + found_unicode;\r\n      convert = tt_name_entry_ascii_from_utf16;\r\n    }\r\n\r\n    if ( rec && convert )\r\n    {\r\n      if ( rec->string == NULL )\r\n      {\r\n        FT_Stream  stream = face->name_table.stream;\r\n\r\n\r\n        if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||\r\n             FT_STREAM_SEEK( rec->stringOffset )              ||\r\n             FT_STREAM_READ( rec->string, rec->stringLength ) )\r\n        {\r\n          FT_FREE( rec->string );\r\n          rec->stringLength = 0;\r\n          result            = NULL;\r\n          goto Exit;\r\n        }\r\n      }\r\n\r\n      result = convert( rec, memory );\r\n    }\r\n\r\n  Exit:\r\n    *name = result;\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Encoding\r\n  sfnt_find_encoding( int  platform_id,\r\n                      int  encoding_id )\r\n  {\r\n    typedef struct  TEncoding_\r\n    {\r\n      int          platform_id;\r\n      int          encoding_id;\r\n      FT_Encoding  encoding;\r\n\r\n    } TEncoding;\r\n\r\n    static\r\n    const TEncoding  tt_encodings[] =\r\n    {\r\n      { TT_PLATFORM_ISO,           -1,                  FT_ENCODING_UNICODE },\r\n\r\n      { TT_PLATFORM_APPLE_UNICODE, -1,                  FT_ENCODING_UNICODE },\r\n\r\n      { TT_PLATFORM_MACINTOSH,     TT_MAC_ID_ROMAN,     FT_ENCODING_APPLE_ROMAN },\r\n\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_SYMBOL_CS,  FT_ENCODING_MS_SYMBOL },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_UCS_4,      FT_ENCODING_UNICODE },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_UNICODE_CS, FT_ENCODING_UNICODE },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_SJIS,       FT_ENCODING_SJIS },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_GB2312,     FT_ENCODING_GB2312 },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_BIG_5,      FT_ENCODING_BIG5 },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_WANSUNG,    FT_ENCODING_WANSUNG },\r\n      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_JOHAB,      FT_ENCODING_JOHAB }\r\n    };\r\n\r\n    const TEncoding  *cur, *limit;\r\n\r\n\r\n    cur   = tt_encodings;\r\n    limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] );\r\n\r\n    for ( ; cur < limit; cur++ )\r\n    {\r\n      if ( cur->platform_id == platform_id )\r\n      {\r\n        if ( cur->encoding_id == encoding_id ||\r\n             cur->encoding_id == -1          )\r\n          return cur->encoding;\r\n      }\r\n    }\r\n\r\n    return FT_ENCODING_NONE;\r\n  }\r\n\r\n\r\n  /* Fill in face->ttc_header.  If the font is not a TTC, it is */\r\n  /* synthesized into a TTC with one offset table.              */\r\n  static FT_Error\r\n  sfnt_open_font( FT_Stream  stream,\r\n                  TT_Face    face )\r\n  {\r\n    FT_Memory  memory = stream->memory;\r\n    FT_Error   error;\r\n    FT_ULong   tag, offset;\r\n\r\n    static const FT_Frame_Field  ttc_header_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TTC_HeaderRec\r\n\r\n      FT_FRAME_START( 8 ),\r\n        FT_FRAME_LONG( version ),\r\n        FT_FRAME_LONG( count   ),  /* this is ULong in the specs */\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    face->ttc_header.tag     = 0;\r\n    face->ttc_header.version = 0;\r\n    face->ttc_header.count   = 0;\r\n\r\n    offset = FT_STREAM_POS();\r\n\r\n    if ( FT_READ_ULONG( tag ) )\r\n      return error;\r\n\r\n    if ( tag != 0x00010000UL &&\r\n         tag != TTAG_ttcf    &&\r\n         tag != TTAG_OTTO    &&\r\n         tag != TTAG_true    &&\r\n         tag != TTAG_typ1    &&\r\n         tag != 0x00020000UL )\r\n    {\r\n      FT_TRACE2(( \"  not a font using the SFNT container format\\n\" ));\r\n      return SFNT_Err_Unknown_File_Format;\r\n    }\r\n\r\n    face->ttc_header.tag = TTAG_ttcf;\r\n\r\n    if ( tag == TTAG_ttcf )\r\n    {\r\n      FT_Int  n;\r\n\r\n\r\n      FT_TRACE3(( \"sfnt_open_font: file is a collection\\n\" ));\r\n\r\n      if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )\r\n        return error;\r\n\r\n      if ( face->ttc_header.count == 0 )\r\n        return SFNT_Err_Invalid_Table;\r\n\r\n      /* a rough size estimate: let's conservatively assume that there   */\r\n      /* is just a single table info in each subfont header (12 + 16*1 = */\r\n      /* 28 bytes), thus we have (at least) `12 + 4*count' bytes for the */\r\n      /* size of the TTC header plus `28*count' bytes for all subfont    */\r\n      /* headers                                                         */\r\n      if ( (FT_ULong)face->ttc_header.count > stream->size / ( 28 + 4 ) )\r\n        return SFNT_Err_Array_Too_Large;\r\n\r\n      /* now read the offsets of each font in the file */\r\n      if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )\r\n        return error;\r\n\r\n      if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )\r\n        return error;\r\n\r\n      for ( n = 0; n < face->ttc_header.count; n++ )\r\n        face->ttc_header.offsets[n] = FT_GET_ULONG();\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n    else\r\n    {\r\n      FT_TRACE3(( \"sfnt_open_font: synthesize TTC\\n\" ));\r\n\r\n      face->ttc_header.version = 1 << 16;\r\n      face->ttc_header.count   = 1;\r\n\r\n      if ( FT_NEW( face->ttc_header.offsets ) )\r\n        return error;\r\n\r\n      face->ttc_header.offsets[0] = offset;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  sfnt_init_face( FT_Stream      stream,\r\n                  TT_Face        face,\r\n                  FT_Int         face_index,\r\n                  FT_Int         num_params,\r\n                  FT_Parameter*  params )\r\n  {\r\n    FT_Error        error;\r\n    FT_Library      library = face->root.driver->root.library;\r\n    SFNT_Service    sfnt;\r\n\r\n\r\n    /* for now, parameters are unused */\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n\r\n\r\n    sfnt = (SFNT_Service)face->sfnt;\r\n    if ( !sfnt )\r\n    {\r\n      sfnt = (SFNT_Service)FT_Get_Module_Interface( library, \"sfnt\" );\r\n      if ( !sfnt )\r\n      {\r\n        FT_ERROR(( \"sfnt_init_face: cannot access `sfnt' module\\n\" ));\r\n        return SFNT_Err_Missing_Module;\r\n      }\r\n\r\n      face->sfnt       = sfnt;\r\n      face->goto_table = sfnt->goto_table;\r\n    }\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );\r\n\r\n    FT_TRACE2(( \"SFNT driver\\n\" ));\r\n\r\n    error = sfnt_open_font( stream, face );\r\n    if ( error )\r\n      return error;\r\n\r\n    FT_TRACE2(( \"sfnt_init_face: %08p, %ld\\n\", face, face_index ));\r\n\r\n    if ( face_index < 0 )\r\n      face_index = 0;\r\n\r\n    if ( face_index >= face->ttc_header.count )\r\n      return SFNT_Err_Invalid_Argument;\r\n\r\n    if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )\r\n      return error;\r\n\r\n    /* check that we have a valid TrueType file */\r\n    error = sfnt->load_font_dir( face, stream );\r\n    if ( error )\r\n      return error;\r\n\r\n    face->root.num_faces  = face->ttc_header.count;\r\n    face->root.face_index = face_index;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#define LOAD_( x )                                            \\\r\n  do {                                                        \\\r\n    FT_TRACE2(( \"`\" #x \"' \" ));                               \\\r\n    FT_TRACE3(( \"-->\\n\" ));                                   \\\r\n                                                              \\\r\n    error = sfnt->load_ ## x( face, stream );                 \\\r\n                                                              \\\r\n    FT_TRACE2(( \"%s\\n\", ( !error )                            \\\r\n                        ? \"loaded\"                            \\\r\n                        : ( error == SFNT_Err_Table_Missing ) \\\r\n                          ? \"missing\"                         \\\r\n                          : \"failed to load\" ));              \\\r\n    FT_TRACE3(( \"\\n\" ));                                      \\\r\n  } while ( 0 )\r\n\r\n#define LOADM_( x, vertical )                                 \\\r\n  do {                                                        \\\r\n    FT_TRACE2(( \"`%s\" #x \"' \",                                \\\r\n                vertical ? \"vertical \" : \"\" ));               \\\r\n    FT_TRACE3(( \"-->\\n\" ));                                   \\\r\n                                                              \\\r\n    error = sfnt->load_ ## x( face, stream, vertical );       \\\r\n                                                              \\\r\n    FT_TRACE2(( \"%s\\n\", ( !error )                            \\\r\n                        ? \"loaded\"                            \\\r\n                        : ( error == SFNT_Err_Table_Missing ) \\\r\n                          ? \"missing\"                         \\\r\n                          : \"failed to load\" ));              \\\r\n    FT_TRACE3(( \"\\n\" ));                                      \\\r\n  } while ( 0 )\r\n\r\n#define GET_NAME( id, field )                                   \\\r\n  do {                                                          \\\r\n    error = tt_face_get_name( face, TT_NAME_ID_ ## id, field ); \\\r\n    if ( error )                                                \\\r\n      goto Exit;                                                \\\r\n  } while ( 0 )\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  sfnt_load_face( FT_Stream      stream,\r\n                  TT_Face        face,\r\n                  FT_Int         face_index,\r\n                  FT_Int         num_params,\r\n                  FT_Parameter*  params )\r\n  {\r\n    FT_Error      error;\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n    FT_Error      psnames_error;\r\n#endif\r\n    FT_Bool       has_outline;\r\n    FT_Bool       is_apple_sbit;\r\n    FT_Bool       ignore_preferred_family    = FALSE;\r\n    FT_Bool       ignore_preferred_subfamily = FALSE;\r\n\r\n    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;\r\n\r\n    FT_UNUSED( face_index );\r\n\r\n\r\n    /* Check parameters */\r\n\r\n    {\r\n      FT_Int  i;\r\n\r\n\r\n      for ( i = 0; i < num_params; i++ )\r\n      {\r\n        if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY )\r\n          ignore_preferred_family = TRUE;\r\n        else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY )\r\n          ignore_preferred_subfamily = TRUE;\r\n      }\r\n    }\r\n\r\n    /* Load tables */\r\n\r\n    /* We now support two SFNT-based bitmapped font formats.  They */\r\n    /* are recognized easily as they do not include a `glyf'       */\r\n    /* table.                                                      */\r\n    /*                                                             */\r\n    /* The first format comes from Apple, and uses a table named   */\r\n    /* `bhed' instead of `head' to store the font header (using    */\r\n    /* the same format).  It also doesn't include horizontal and   */\r\n    /* vertical metrics tables (i.e. `hhea' and `vhea' tables are  */\r\n    /* missing).                                                   */\r\n    /*                                                             */\r\n    /* The other format comes from Microsoft, and is used with     */\r\n    /* WinCE/PocketPC.  It looks like a standard TTF, except that  */\r\n    /* it doesn't contain outlines.                                */\r\n    /*                                                             */\r\n\r\n    FT_TRACE2(( \"sfnt_load_face: %08p\\n\\n\", face ));\r\n\r\n    /* do we have outlines in there? */\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||\r\n                           tt_face_lookup_table( face, TTAG_glyf )    != 0 ||\r\n                           tt_face_lookup_table( face, TTAG_CFF )     != 0 );\r\n#else\r\n    has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||\r\n                           tt_face_lookup_table( face, TTAG_CFF )  != 0 );\r\n#endif\r\n\r\n    is_apple_sbit = 0;\r\n\r\n    /* if this font doesn't contain outlines, we try to load */\r\n    /* a `bhed' table                                        */\r\n    if ( !has_outline && sfnt->load_bhed )\r\n    {\r\n      LOAD_( bhed );\r\n      is_apple_sbit = FT_BOOL( !error );\r\n    }\r\n\r\n    /* load the font header (`head' table) if this isn't an Apple */\r\n    /* sbit font file                                             */\r\n    if ( !is_apple_sbit )\r\n    {\r\n      LOAD_( head );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( face->header.Units_Per_EM == 0 )\r\n    {\r\n      error = SFNT_Err_Invalid_Table;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* the following tables are often not present in embedded TrueType */\r\n    /* fonts within PDF documents, so don't check for them.            */\r\n    LOAD_( maxp );\r\n    LOAD_( cmap );\r\n\r\n    /* the following tables are optional in PCL fonts -- */\r\n    /* don't check for errors                            */\r\n    LOAD_( name );\r\n    LOAD_( post );\r\n\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n    psnames_error = error;\r\n#endif\r\n\r\n    /* do not load the metrics headers and tables if this is an Apple */\r\n    /* sbit font file                                                 */\r\n    if ( !is_apple_sbit )\r\n    {\r\n      /* load the `hhea' and `hmtx' tables */\r\n      LOADM_( hhea, 0 );\r\n      if ( !error )\r\n      {\r\n        LOADM_( hmtx, 0 );\r\n        if ( error == SFNT_Err_Table_Missing )\r\n        {\r\n          error = SFNT_Err_Hmtx_Table_Missing;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n          /* If this is an incrementally loaded font and there are */\r\n          /* overriding metrics, tolerate a missing `hmtx' table.  */\r\n          if ( face->root.internal->incremental_interface          &&\r\n               face->root.internal->incremental_interface->funcs->\r\n                 get_glyph_metrics                                 )\r\n          {\r\n            face->horizontal.number_Of_HMetrics = 0;\r\n            error                               = SFNT_Err_Ok;\r\n          }\r\n#endif\r\n        }\r\n      }\r\n      else if ( error == SFNT_Err_Table_Missing )\r\n      {\r\n        /* No `hhea' table necessary for SFNT Mac fonts. */\r\n        if ( face->format_tag == TTAG_true )\r\n        {\r\n          FT_TRACE2(( \"This is an SFNT Mac font.\\n\" ));\r\n\r\n          has_outline = 0;\r\n          error       = SFNT_Err_Ok;\r\n        }\r\n        else\r\n        {\r\n          error = SFNT_Err_Horiz_Header_Missing;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n          /* If this is an incrementally loaded font and there are */\r\n          /* overriding metrics, tolerate a missing `hhea' table.  */\r\n          if ( face->root.internal->incremental_interface          &&\r\n               face->root.internal->incremental_interface->funcs->\r\n                 get_glyph_metrics                                 )\r\n          {\r\n            face->horizontal.number_Of_HMetrics = 0;\r\n            error                               = SFNT_Err_Ok;\r\n          }\r\n#endif\r\n\r\n        }\r\n      }\r\n\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* try to load the `vhea' and `vmtx' tables */\r\n      LOADM_( hhea, 1 );\r\n      if ( !error )\r\n      {\r\n        LOADM_( hmtx, 1 );\r\n        if ( !error )\r\n          face->vertical_info = 1;\r\n      }\r\n\r\n      if ( error && error != SFNT_Err_Table_Missing )\r\n        goto Exit;\r\n\r\n      LOAD_( os2 );\r\n      if ( error )\r\n      {\r\n        /* we treat the table as missing if there are any errors */\r\n        face->os2.version = 0xFFFFU;\r\n      }\r\n    }\r\n\r\n    /* the optional tables */\r\n\r\n    /* embedded bitmap support */\r\n    if ( sfnt->load_eblc )\r\n    {\r\n      LOAD_( eblc );\r\n      if ( error )\r\n      {\r\n        /* a font which contains neither bitmaps nor outlines is */\r\n        /* still valid (although rather useless in most cases);  */\r\n        /* however, you can find such stripped fonts in PDFs     */\r\n        if ( error == SFNT_Err_Table_Missing )\r\n          error = SFNT_Err_Ok;\r\n        else\r\n          goto Exit;\r\n      }\r\n    }\r\n\r\n    LOAD_( pclt );\r\n    if ( error )\r\n    {\r\n      if ( error != SFNT_Err_Table_Missing )\r\n        goto Exit;\r\n\r\n      face->pclt.Version = 0;\r\n    }\r\n\r\n    /* consider the kerning and gasp tables as optional */\r\n    LOAD_( gasp );\r\n    LOAD_( kern );\r\n\r\n    face->root.num_glyphs = face->max_profile.numGlyphs;\r\n\r\n    /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes  */\r\n    /* a WWS-only font face.  `WWS' stands for `weight', width', and */\r\n    /* `slope', a term used by Microsoft's Windows Presentation      */\r\n    /* Foundation (WPF).  This flag has been introduced in version   */\r\n    /* 1.5 of the OpenType specification (May 2008).                 */\r\n\r\n    face->root.family_name = NULL;\r\n    face->root.style_name  = NULL;\r\n    if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )\r\n    {\r\n      if ( !ignore_preferred_family )\r\n        GET_NAME( PREFERRED_FAMILY, &face->root.family_name );\r\n      if ( !face->root.family_name )\r\n        GET_NAME( FONT_FAMILY, &face->root.family_name );\r\n\r\n      if ( !ignore_preferred_subfamily )\r\n        GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );\r\n      if ( !face->root.style_name )\r\n        GET_NAME( FONT_SUBFAMILY, &face->root.style_name );\r\n    }\r\n    else\r\n    {\r\n      GET_NAME( WWS_FAMILY, &face->root.family_name );\r\n      if ( !face->root.family_name && !ignore_preferred_family )\r\n        GET_NAME( PREFERRED_FAMILY, &face->root.family_name );\r\n      if ( !face->root.family_name )\r\n        GET_NAME( FONT_FAMILY, &face->root.family_name );\r\n\r\n      GET_NAME( WWS_SUBFAMILY, &face->root.style_name );\r\n      if ( !face->root.style_name && !ignore_preferred_subfamily )\r\n        GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );\r\n      if ( !face->root.style_name )\r\n        GET_NAME( FONT_SUBFAMILY, &face->root.style_name );\r\n    }\r\n\r\n    /* now set up root fields */\r\n    {\r\n      FT_Face  root  = &face->root;\r\n      FT_Long  flags = root->face_flags;\r\n\r\n\r\n      /*********************************************************************/\r\n      /*                                                                   */\r\n      /* Compute face flags.                                               */\r\n      /*                                                                   */\r\n      if ( has_outline == TRUE )\r\n        flags |= FT_FACE_FLAG_SCALABLE;   /* scalable outlines */\r\n\r\n      /* The sfnt driver only supports bitmap fonts natively, thus we */\r\n      /* don't set FT_FACE_FLAG_HINTER.                               */\r\n      flags |= FT_FACE_FLAG_SFNT       |  /* SFNT file format  */\r\n               FT_FACE_FLAG_HORIZONTAL;   /* horizontal data   */\r\n\r\n#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n      if ( psnames_error == SFNT_Err_Ok               &&\r\n           face->postscript.FormatType != 0x00030000L )\r\n        flags |= FT_FACE_FLAG_GLYPH_NAMES;\r\n#endif\r\n\r\n      /* fixed width font? */\r\n      if ( face->postscript.isFixedPitch )\r\n        flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      /* vertical information? */\r\n      if ( face->vertical_info )\r\n        flags |= FT_FACE_FLAG_VERTICAL;\r\n\r\n      /* kerning available ? */\r\n      if ( TT_FACE_HAS_KERNING( face ) )\r\n        flags |= FT_FACE_FLAG_KERNING;\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n      /* Don't bother to load the tables unless somebody asks for them. */\r\n      /* No need to do work which will (probably) not be used.          */\r\n      if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&\r\n           tt_face_lookup_table( face, TTAG_fvar ) != 0 &&\r\n           tt_face_lookup_table( face, TTAG_gvar ) != 0 )\r\n        flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;\r\n#endif\r\n\r\n      root->face_flags = flags;\r\n\r\n      /*********************************************************************/\r\n      /*                                                                   */\r\n      /* Compute style flags.                                              */\r\n      /*                                                                   */\r\n\r\n      flags = 0;\r\n      if ( has_outline == TRUE && face->os2.version != 0xFFFFU )\r\n      {\r\n        /* We have an OS/2 table; use the `fsSelection' field.  Bit 9 */\r\n        /* indicates an oblique font face.  This flag has been        */\r\n        /* introduced in version 1.5 of the OpenType specification.   */\r\n\r\n        if ( face->os2.fsSelection & 512 )       /* bit 9 */\r\n          flags |= FT_STYLE_FLAG_ITALIC;\r\n        else if ( face->os2.fsSelection & 1 )    /* bit 0 */\r\n          flags |= FT_STYLE_FLAG_ITALIC;\r\n\r\n        if ( face->os2.fsSelection & 32 )        /* bit 5 */\r\n          flags |= FT_STYLE_FLAG_BOLD;\r\n      }\r\n      else\r\n      {\r\n        /* this is an old Mac font, use the header field */\r\n\r\n        if ( face->header.Mac_Style & 1 )\r\n          flags |= FT_STYLE_FLAG_BOLD;\r\n\r\n        if ( face->header.Mac_Style & 2 )\r\n          flags |= FT_STYLE_FLAG_ITALIC;\r\n      }\r\n\r\n      root->style_flags = flags;\r\n\r\n      /*********************************************************************/\r\n      /*                                                                   */\r\n      /* Polish the charmaps.                                              */\r\n      /*                                                                   */\r\n      /*   Try to set the charmap encoding according to the platform &     */\r\n      /*   encoding ID of each charmap.                                    */\r\n      /*                                                                   */\r\n\r\n      tt_face_build_cmaps( face );  /* ignore errors */\r\n\r\n\r\n      /* set the encoding fields */\r\n      {\r\n        FT_Int  m;\r\n\r\n\r\n        for ( m = 0; m < root->num_charmaps; m++ )\r\n        {\r\n          FT_CharMap  charmap = root->charmaps[m];\r\n\r\n\r\n          charmap->encoding = sfnt_find_encoding( charmap->platform_id,\r\n                                                  charmap->encoding_id );\r\n\r\n#if 0\r\n          if ( root->charmap     == NULL &&\r\n               charmap->encoding == FT_ENCODING_UNICODE )\r\n          {\r\n            /* set 'root->charmap' to the first Unicode encoding we find */\r\n            root->charmap = charmap;\r\n          }\r\n#endif\r\n        }\r\n      }\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n      /*\r\n       *  Now allocate the root array of FT_Bitmap_Size records and\r\n       *  populate them.  Unfortunately, it isn't possible to indicate bit\r\n       *  depths in the FT_Bitmap_Size record.  This is a design error.\r\n       */\r\n      {\r\n        FT_UInt  i, count;\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_OLD_INTERNALS\r\n        count = face->sbit_num_strikes;\r\n#else\r\n        count = (FT_UInt)face->num_sbit_strikes;\r\n#endif\r\n\r\n        if ( count > 0 )\r\n        {\r\n          FT_Memory        memory   = face->root.stream->memory;\r\n          FT_UShort        em_size  = face->header.Units_Per_EM;\r\n          FT_Short         avgwidth = face->os2.xAvgCharWidth;\r\n          FT_Size_Metrics  metrics;\r\n\r\n\r\n          if ( em_size == 0 || face->os2.version == 0xFFFFU )\r\n          {\r\n            avgwidth = 0;\r\n            em_size = 1;\r\n          }\r\n\r\n          if ( FT_NEW_ARRAY( root->available_sizes, count ) )\r\n            goto Exit;\r\n\r\n          for ( i = 0; i < count; i++ )\r\n          {\r\n            FT_Bitmap_Size*  bsize = root->available_sizes + i;\r\n\r\n\r\n            error = sfnt->load_strike_metrics( face, i, &metrics );\r\n            if ( error )\r\n              goto Exit;\r\n\r\n            bsize->height = (FT_Short)( metrics.height >> 6 );\r\n            bsize->width = (FT_Short)(\r\n                ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );\r\n\r\n            bsize->x_ppem = metrics.x_ppem << 6;\r\n            bsize->y_ppem = metrics.y_ppem << 6;\r\n\r\n            /* assume 72dpi */\r\n            bsize->size   = metrics.y_ppem << 6;\r\n          }\r\n\r\n          root->face_flags     |= FT_FACE_FLAG_FIXED_SIZES;\r\n          root->num_fixed_sizes = (FT_Int)count;\r\n        }\r\n      }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n      /* a font with no bitmaps and no outlines is scalable; */\r\n      /* it has only empty glyphs then                       */\r\n      if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )\r\n        root->face_flags |= FT_FACE_FLAG_SCALABLE;\r\n\r\n\r\n      /*********************************************************************/\r\n      /*                                                                   */\r\n      /*  Set up metrics.                                                  */\r\n      /*                                                                   */\r\n      if ( FT_IS_SCALABLE( root ) )\r\n      {\r\n        /* XXX What about if outline header is missing */\r\n        /*     (e.g. sfnt wrapped bitmap)?             */\r\n        root->bbox.xMin    = face->header.xMin;\r\n        root->bbox.yMin    = face->header.yMin;\r\n        root->bbox.xMax    = face->header.xMax;\r\n        root->bbox.yMax    = face->header.yMax;\r\n        root->units_per_EM = face->header.Units_Per_EM;\r\n\r\n\r\n        /* XXX: Computing the ascender/descender/height is very different */\r\n        /*      from what the specification tells you.  Apparently, we    */\r\n        /*      must be careful because                                   */\r\n        /*                                                                */\r\n        /*      - not all fonts have an OS/2 table; in this case, we take */\r\n        /*        the values in the horizontal header.  However, these    */\r\n        /*        values very often are not reliable.                     */\r\n        /*                                                                */\r\n        /*      - otherwise, the correct typographic values are in the    */\r\n        /*        sTypoAscender, sTypoDescender & sTypoLineGap fields.    */\r\n        /*                                                                */\r\n        /*        However, certain fonts have these fields set to 0.      */\r\n        /*        Rather, they have usWinAscent & usWinDescent correctly  */\r\n        /*        set (but with different values).                        */\r\n        /*                                                                */\r\n        /*      As an example, Arial Narrow is implemented through four   */\r\n        /*      files ARIALN.TTF, ARIALNI.TTF, ARIALNB.TTF & ARIALNBI.TTF */\r\n        /*                                                                */\r\n        /*      Strangely, all fonts have the same values in their        */\r\n        /*      sTypoXXX fields, except ARIALNB which sets them to 0.     */\r\n        /*                                                                */\r\n        /*      On the other hand, they all have different                */\r\n        /*      usWinAscent/Descent values -- as a conclusion, the OS/2   */\r\n        /*      table cannot be used to compute the text height reliably! */\r\n        /*                                                                */\r\n\r\n        /* The ascender and descender are taken from the `hhea' table. */\r\n        /* If zero, they are taken from the `OS/2' table.              */\r\n\r\n        root->ascender  = face->horizontal.Ascender;\r\n        root->descender = face->horizontal.Descender;\r\n\r\n        root->height = (FT_Short)( root->ascender - root->descender +\r\n                                   face->horizontal.Line_Gap );\r\n\r\n        if ( !( root->ascender || root->descender ) )\r\n        {\r\n          if ( face->os2.version != 0xFFFFU )\r\n          {\r\n            if ( face->os2.sTypoAscender || face->os2.sTypoDescender )\r\n            {\r\n              root->ascender  = face->os2.sTypoAscender;\r\n              root->descender = face->os2.sTypoDescender;\r\n\r\n              root->height = (FT_Short)( root->ascender - root->descender +\r\n                                         face->os2.sTypoLineGap );\r\n            }\r\n            else\r\n            {\r\n              root->ascender  =  (FT_Short)face->os2.usWinAscent;\r\n              root->descender = -(FT_Short)face->os2.usWinDescent;\r\n\r\n              root->height = (FT_UShort)( root->ascender - root->descender );\r\n            }\r\n          }\r\n        }\r\n\r\n        root->max_advance_width  = face->horizontal.advance_Width_Max;\r\n        root->max_advance_height = (FT_Short)( face->vertical_info\r\n                                     ? face->vertical.advance_Height_Max\r\n                                     : root->height );\r\n\r\n        /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */\r\n        /* Adjust underline position from top edge to centre of     */\r\n        /* stroke to convert TrueType meaning to FreeType meaning.  */\r\n        root->underline_position  = face->postscript.underlinePosition -\r\n                                    face->postscript.underlineThickness / 2;\r\n        root->underline_thickness = face->postscript.underlineThickness;\r\n      }\r\n\r\n    }\r\n\r\n  Exit:\r\n    FT_TRACE2(( \"sfnt_load_face: done\\n\" ));\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n#undef LOAD_\r\n#undef LOADM_\r\n#undef GET_NAME\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  sfnt_done_face( TT_Face  face )\r\n  {\r\n    FT_Memory     memory;\r\n    SFNT_Service  sfnt;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = face->root.memory;\r\n    sfnt   = (SFNT_Service)face->sfnt;\r\n\r\n    if ( sfnt )\r\n    {\r\n      /* destroy the postscript names table if it is loaded */\r\n      if ( sfnt->free_psnames )\r\n        sfnt->free_psnames( face );\r\n\r\n      /* destroy the embedded bitmaps table if it is loaded */\r\n      if ( sfnt->free_eblc )\r\n        sfnt->free_eblc( face );\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n    /* freeing the embedded BDF properties */\r\n    tt_face_free_bdf_props( face );\r\n#endif\r\n\r\n    /* freeing the kerning table */\r\n    tt_face_done_kern( face );\r\n\r\n    /* freeing the collection table */\r\n    FT_FREE( face->ttc_header.offsets );\r\n    face->ttc_header.count = 0;\r\n\r\n    /* freeing table directory */\r\n    FT_FREE( face->dir_tables );\r\n    face->num_tables = 0;\r\n\r\n    {\r\n      FT_Stream  stream = FT_FACE_STREAM( face );\r\n\r\n\r\n      /* simply release the 'cmap' table frame */\r\n      FT_FRAME_RELEASE( face->cmap_table );\r\n      face->cmap_size = 0;\r\n    }\r\n\r\n    /* freeing the horizontal metrics */\r\n#ifndef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    {\r\n      FT_Stream  stream = FT_FACE_STREAM( face );\r\n\r\n\r\n      FT_FRAME_RELEASE( face->horz_metrics );\r\n      FT_FRAME_RELEASE( face->vert_metrics );\r\n      face->horz_metrics_size = 0;\r\n      face->vert_metrics_size = 0;\r\n    }\r\n#else\r\n    FT_FREE( face->horizontal.long_metrics );\r\n    FT_FREE( face->horizontal.short_metrics );\r\n#endif\r\n\r\n    /* freeing the vertical ones, if any */\r\n    if ( face->vertical_info )\r\n    {\r\n      FT_FREE( face->vertical.long_metrics  );\r\n      FT_FREE( face->vertical.short_metrics );\r\n      face->vertical_info = 0;\r\n    }\r\n\r\n    /* freeing the gasp table */\r\n    FT_FREE( face->gasp.gaspRanges );\r\n    face->gasp.numRanges = 0;\r\n\r\n    /* freeing the name table */\r\n    if ( sfnt )\r\n      sfnt->free_name( face );\r\n\r\n    /* freeing family and style name */\r\n    FT_FREE( face->root.family_name );\r\n    FT_FREE( face->root.style_name );\r\n\r\n    /* freeing sbit size table */\r\n    FT_FREE( face->root.available_sizes );\r\n    face->root.num_fixed_sizes = 0;\r\n\r\n    FT_FREE( face->postscript_name );\r\n\r\n    face->sfnt = 0;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/sfobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfobjs.h                                                               */\r\n/*                                                                         */\r\n/*    SFNT object management (specification).                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SFOBJS_H__\r\n#define __SFOBJS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  sfnt_init_face( FT_Stream      stream,\r\n                  TT_Face        face,\r\n                  FT_Int         face_index,\r\n                  FT_Int         num_params,\r\n                  FT_Parameter*  params );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  sfnt_load_face( FT_Stream      stream,\r\n                  TT_Face        face,\r\n                  FT_Int         face_index,\r\n                  FT_Int         num_params,\r\n                  FT_Parameter*  params );\r\n\r\n  FT_LOCAL( void )\r\n  sfnt_done_face( TT_Face  face );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SFDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttbdf.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttbdf.c                                                                */\r\n/*                                                                         */\r\n/*    TrueType and OpenType embedded BDF properties (body).                */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2006, 2010 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttbdf.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttbdf\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_free_bdf_props( TT_Face  face )\r\n  {\r\n    TT_BDF  bdf = &face->bdf;\r\n\r\n\r\n    if ( bdf->loaded )\r\n    {\r\n      FT_Stream  stream = FT_FACE(face)->stream;\r\n\r\n\r\n      if ( bdf->table != NULL )\r\n        FT_FRAME_RELEASE( bdf->table );\r\n\r\n      bdf->table_end    = NULL;\r\n      bdf->strings      = NULL;\r\n      bdf->strings_size = 0;\r\n    }\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_face_load_bdf_props( TT_Face    face,\r\n                          FT_Stream  stream )\r\n  {\r\n    TT_BDF    bdf = &face->bdf;\r\n    FT_ULong  length;\r\n    FT_Error  error;\r\n\r\n\r\n    FT_ZERO( bdf );\r\n\r\n    error = tt_face_goto_table( face, TTAG_BDF, stream, &length );\r\n    if ( error                                  ||\r\n         length < 8                             ||\r\n         FT_FRAME_EXTRACT( length, bdf->table ) )\r\n    {\r\n      error = SFNT_Err_Invalid_Table;\r\n      goto Exit;\r\n    }\r\n\r\n    bdf->table_end = bdf->table + length;\r\n\r\n    {\r\n      FT_Byte*   p           = bdf->table;\r\n      FT_UInt    version     = FT_NEXT_USHORT( p );\r\n      FT_UInt    num_strikes = FT_NEXT_USHORT( p );\r\n      FT_ULong   strings     = FT_NEXT_ULONG ( p );\r\n      FT_UInt    count;\r\n      FT_Byte*   strike;\r\n\r\n\r\n      if ( version != 0x0001                 ||\r\n           strings < 8                       ||\r\n           ( strings - 8 ) / 4 < num_strikes ||\r\n           strings + 1 > length              )\r\n      {\r\n        goto BadTable;\r\n      }\r\n\r\n      bdf->num_strikes  = num_strikes;\r\n      bdf->strings      = bdf->table + strings;\r\n      bdf->strings_size = length - strings;\r\n\r\n      count  = bdf->num_strikes;\r\n      p      = bdf->table + 8;\r\n      strike = p + count * 4;\r\n\r\n\r\n      for ( ; count > 0; count-- )\r\n      {\r\n        FT_UInt  num_items = FT_PEEK_USHORT( p + 2 );\r\n\r\n        /*\r\n         *  We don't need to check the value sets themselves, since this\r\n         *  is done later.\r\n         */\r\n        strike += 10 * num_items;\r\n\r\n        p += 4;\r\n      }\r\n\r\n      if ( strike > bdf->strings )\r\n        goto BadTable;\r\n    }\r\n\r\n    bdf->loaded = 1;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  BadTable:\r\n    FT_FRAME_RELEASE( bdf->table );\r\n    FT_ZERO( bdf );\r\n    error = SFNT_Err_Invalid_Table;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_find_bdf_prop( TT_Face           face,\r\n                         const char*       property_name,\r\n                         BDF_PropertyRec  *aprop )\r\n  {\r\n    TT_BDF     bdf   = &face->bdf;\r\n    FT_Size    size  = FT_FACE(face)->size;\r\n    FT_Error   error = SFNT_Err_Ok;\r\n    FT_Byte*   p;\r\n    FT_UInt    count;\r\n    FT_Byte*   strike;\r\n    FT_Offset  property_len;\r\n\r\n\r\n    aprop->type = BDF_PROPERTY_TYPE_NONE;\r\n\r\n    if ( bdf->loaded == 0 )\r\n    {\r\n      error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    count  = bdf->num_strikes;\r\n    p      = bdf->table + 8;\r\n    strike = p + 4 * count;\r\n\r\n    error = SFNT_Err_Invalid_Argument;\r\n\r\n    if ( size == NULL || property_name == NULL )\r\n      goto Exit;\r\n\r\n    property_len = ft_strlen( property_name );\r\n    if ( property_len == 0 )\r\n      goto Exit;\r\n\r\n    for ( ; count > 0; count-- )\r\n    {\r\n      FT_UInt  _ppem  = FT_NEXT_USHORT( p );\r\n      FT_UInt  _count = FT_NEXT_USHORT( p );\r\n\r\n      if ( _ppem == size->metrics.y_ppem )\r\n      {\r\n        count = _count;\r\n        goto FoundStrike;\r\n      }\r\n\r\n      strike += 10 * _count;\r\n    }\r\n    goto Exit;\r\n\r\n  FoundStrike:\r\n    p = strike;\r\n    for ( ; count > 0; count-- )\r\n    {\r\n      FT_UInt  type = FT_PEEK_USHORT( p + 4 );\r\n\r\n      if ( ( type & 0x10 ) != 0 )\r\n      {\r\n        FT_UInt32  name_offset = FT_PEEK_ULONG( p     );\r\n        FT_UInt32  value       = FT_PEEK_ULONG( p + 6 );\r\n\r\n        /* be a bit paranoid for invalid entries here */\r\n        if ( name_offset < bdf->strings_size                    &&\r\n             property_len < bdf->strings_size - name_offset     &&\r\n             ft_strncmp( property_name,\r\n                         (const char*)bdf->strings + name_offset,\r\n                         bdf->strings_size - name_offset ) == 0 )\r\n        {\r\n          switch ( type & 0x0F )\r\n          {\r\n          case 0x00:  /* string */\r\n          case 0x01:  /* atoms */\r\n            /* check that the content is really 0-terminated */\r\n            if ( value < bdf->strings_size &&\r\n                 ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )\r\n            {\r\n              aprop->type   = BDF_PROPERTY_TYPE_ATOM;\r\n              aprop->u.atom = (const char*)bdf->strings + value;\r\n              error         = SFNT_Err_Ok;\r\n              goto Exit;\r\n            }\r\n            break;\r\n\r\n          case 0x02:\r\n            aprop->type      = BDF_PROPERTY_TYPE_INTEGER;\r\n            aprop->u.integer = (FT_Int32)value;\r\n            error            = SFNT_Err_Ok;\r\n            goto Exit;\r\n\r\n          case 0x03:\r\n            aprop->type       = BDF_PROPERTY_TYPE_CARDINAL;\r\n            aprop->u.cardinal = value;\r\n            error             = SFNT_Err_Ok;\r\n            goto Exit;\r\n\r\n          default:\r\n            ;\r\n          }\r\n        }\r\n      }\r\n      p += 10;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_BDF */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttbdf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttbdf.h                                                                */\r\n/*                                                                         */\r\n/*    TrueType and OpenType embedded BDF properties (specification).       */\r\n/*                                                                         */\r\n/*  Copyright 2005 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTBDF_H__\r\n#define __TTBDF_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ttload.h\"\r\n#include FT_BDF_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_free_bdf_props( TT_Face  face );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_find_bdf_prop( TT_Face           face,\r\n                         const char*       property_name,\r\n                         BDF_PropertyRec  *aprop );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTBDF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttcmap.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttcmap.c                                                               */\r\n/*                                                                         */\r\n/*    TrueType character mapping table (cmap) support (body).              */\r\n/*                                                                         */\r\n/*  Copyright 2002-2010, 2012 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include \"sferrors.h\"           /* must come before FT_INTERNAL_VALIDATE_H */\r\n\r\n#include FT_INTERNAL_VALIDATE_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include \"ttload.h\"\r\n#include \"ttcmap.h\"\r\n#include \"sfntpic.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttcmap\r\n\r\n\r\n#define TT_PEEK_SHORT   FT_PEEK_SHORT\r\n#define TT_PEEK_USHORT  FT_PEEK_USHORT\r\n#define TT_PEEK_UINT24  FT_PEEK_UOFF3\r\n#define TT_PEEK_LONG    FT_PEEK_LONG\r\n#define TT_PEEK_ULONG   FT_PEEK_ULONG\r\n\r\n#define TT_NEXT_SHORT   FT_NEXT_SHORT\r\n#define TT_NEXT_USHORT  FT_NEXT_USHORT\r\n#define TT_NEXT_UINT24  FT_NEXT_UOFF3\r\n#define TT_NEXT_LONG    FT_NEXT_LONG\r\n#define TT_NEXT_ULONG   FT_NEXT_ULONG\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap_init( TT_CMap   cmap,\r\n                FT_Byte*  table )\r\n  {\r\n    cmap->data = table;\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           FORMAT 0                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET         TYPE          DESCRIPTION                */\r\n  /*                                                                       */\r\n  /*   format      0              USHORT        must be 0                  */\r\n  /*   length      2              USHORT        table length in bytes      */\r\n  /*   language    4              USHORT        Mac language code          */\r\n  /*   glyph_ids   6              BYTE[256]     array of glyph indices     */\r\n  /*               262                                                     */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_0\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap0_validate( FT_Byte*      table,\r\n                     FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p      = table + 2;\r\n    FT_UInt   length = TT_NEXT_USHORT( p );\r\n\r\n\r\n    if ( table + length > valid->limit || length < 262 )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check glyph indices whenever necessary */\r\n    if ( valid->level >= FT_VALIDATE_TIGHT )\r\n    {\r\n      FT_UInt  n, idx;\r\n\r\n\r\n      p = table + 6;\r\n      for ( n = 0; n < 256; n++ )\r\n      {\r\n        idx = *p++;\r\n        if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )\r\n          FT_INVALID_GLYPH_ID;\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap0_char_index( TT_CMap    cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    FT_Byte*  table = cmap->data;\r\n\r\n\r\n    return char_code < 256 ? table[6 + char_code] : 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap0_char_next( TT_CMap     cmap,\r\n                      FT_UInt32  *pchar_code )\r\n  {\r\n    FT_Byte*   table    = cmap->data;\r\n    FT_UInt32  charcode = *pchar_code;\r\n    FT_UInt32  result   = 0;\r\n    FT_UInt    gindex   = 0;\r\n\r\n\r\n    table += 6;  /* go to glyph IDs */\r\n    while ( ++charcode < 256 )\r\n    {\r\n      gindex = table[charcode];\r\n      if ( gindex != 0 )\r\n      {\r\n        result = charcode;\r\n        break;\r\n      }\r\n    }\r\n\r\n    *pchar_code = result;\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap0_get_info( TT_CMap       cmap,\r\n                     TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 4;\r\n\r\n\r\n    cmap_info->format   = 0;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap0_class_rec,\r\n    sizeof ( TT_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap0_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap0_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    0,\r\n    (TT_CMap_ValidateFunc)tt_cmap0_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap0_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_0 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          FORMAT 2                             *****/\r\n  /*****                                                               *****/\r\n  /***** This is used for certain CJK encodings that encode text in a  *****/\r\n  /***** mixed 8/16 bits encoding along the following lines:           *****/\r\n  /*****                                                               *****/\r\n  /***** * Certain byte values correspond to an 8-bit character code   *****/\r\n  /*****   (typically in the range 0..127 for ASCII compatibility).    *****/\r\n  /*****                                                               *****/\r\n  /***** * Certain byte values signal the first byte of a 2-byte       *****/\r\n  /*****   character code (but these values are also valid as the      *****/\r\n  /*****   second byte of a 2-byte character).                         *****/\r\n  /*****                                                               *****/\r\n  /***** The following charmap lookup and iteration functions all      *****/\r\n  /***** assume that the value \"charcode\" correspond to following:     *****/\r\n  /*****                                                               *****/\r\n  /*****   - For one byte characters, \"charcode\" is simply the         *****/\r\n  /*****     character code.                                           *****/\r\n  /*****                                                               *****/\r\n  /*****   - For two byte characters, \"charcode\" is the 2-byte         *****/\r\n  /*****     character code in big endian format.  More exactly:       *****/\r\n  /*****                                                               *****/\r\n  /*****       (charcode >> 8)    is the first byte value              *****/\r\n  /*****       (charcode & 0xFF)  is the second byte value             *****/\r\n  /*****                                                               *****/\r\n  /***** Note that not all values of \"charcode\" are valid according    *****/\r\n  /***** to these rules, and the function moderately check the         *****/\r\n  /***** arguments.                                                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET         TYPE            DESCRIPTION              */\r\n  /*                                                                       */\r\n  /*   format      0              USHORT          must be 2                */\r\n  /*   length      2              USHORT          table length in bytes    */\r\n  /*   language    4              USHORT          Mac language code        */\r\n  /*   keys        6              USHORT[256]     sub-header keys          */\r\n  /*   subs        518            SUBHEAD[NSUBS]  sub-headers array        */\r\n  /*   glyph_ids   518+NSUB*8     USHORT[]        glyph ID array           */\r\n  /*                                                                       */\r\n  /* The `keys' table is used to map charcode high-bytes to sub-headers.   */\r\n  /* The value of `NSUBS' is the number of sub-headers defined in the      */\r\n  /* table and is computed by finding the maximum of the `keys' table.     */\r\n  /*                                                                       */\r\n  /* Note that for any n, `keys[n]' is a byte offset within the `subs'     */\r\n  /* table, i.e., it is the corresponding sub-header index multiplied      */\r\n  /* by 8.                                                                 */\r\n  /*                                                                       */\r\n  /* Each sub-header has the following format:                             */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET      TYPE            DESCRIPTION                 */\r\n  /*                                                                       */\r\n  /*   first       0           USHORT          first valid low-byte        */\r\n  /*   count       2           USHORT          number of valid low-bytes   */\r\n  /*   delta       4           SHORT           see below                   */\r\n  /*   offset      6           USHORT          see below                   */\r\n  /*                                                                       */\r\n  /* A sub-header defines, for each high-byte, the range of valid          */\r\n  /* low-bytes within the charmap.  Note that the range defined by `first' */\r\n  /* and `count' must be completely included in the interval [0..255]      */\r\n  /* according to the specification.                                       */\r\n  /*                                                                       */\r\n  /* If a character code is contained within a given sub-header, then      */\r\n  /* mapping it to a glyph index is done as follows:                       */\r\n  /*                                                                       */\r\n  /* * The value of `offset' is read.  This is a _byte_ distance from the  */\r\n  /*   location of the `offset' field itself into a slice of the           */\r\n  /*   `glyph_ids' table.  Let's call it `slice' (it is a USHORT[] too).   */\r\n  /*                                                                       */\r\n  /* * The value `slice[char.lo - first]' is read.  If it is 0, there is   */\r\n  /*   no glyph for the charcode.  Otherwise, the value of `delta' is      */\r\n  /*   added to it (modulo 65536) to form a new glyph index.               */\r\n  /*                                                                       */\r\n  /* It is up to the validation routine to check that all offsets fall     */\r\n  /* within the glyph IDs table (and not within the `subs' table itself or */\r\n  /* outside of the CMap).                                                 */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_2\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap2_validate( FT_Byte*      table,\r\n                     FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p      = table + 2;           /* skip format */\r\n    FT_UInt   length = TT_PEEK_USHORT( p );\r\n    FT_UInt   n, max_subs;\r\n    FT_Byte*  keys;                         /* keys table */\r\n    FT_Byte*  subs;                         /* sub-headers */\r\n    FT_Byte*  glyph_ids;                    /* glyph ID array */\r\n\r\n\r\n    if ( table + length > valid->limit || length < 6 + 512 )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    keys = table + 6;\r\n\r\n    /* parse keys to compute sub-headers count */\r\n    p        = keys;\r\n    max_subs = 0;\r\n    for ( n = 0; n < 256; n++ )\r\n    {\r\n      FT_UInt  idx = TT_NEXT_USHORT( p );\r\n\r\n\r\n      /* value must be multiple of 8 */\r\n      if ( valid->level >= FT_VALIDATE_PARANOID && ( idx & 7 ) != 0 )\r\n        FT_INVALID_DATA;\r\n\r\n      idx >>= 3;\r\n\r\n      if ( idx > max_subs )\r\n        max_subs = idx;\r\n    }\r\n\r\n    FT_ASSERT( p == table + 518 );\r\n\r\n    subs      = p;\r\n    glyph_ids = subs + (max_subs + 1) * 8;\r\n    if ( glyph_ids > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* parse sub-headers */\r\n    for ( n = 0; n <= max_subs; n++ )\r\n    {\r\n      FT_UInt   first_code, code_count, offset;\r\n      FT_Int    delta;\r\n      FT_Byte*  ids;\r\n\r\n\r\n      first_code = TT_NEXT_USHORT( p );\r\n      code_count = TT_NEXT_USHORT( p );\r\n      delta      = TT_NEXT_SHORT( p );\r\n      offset     = TT_NEXT_USHORT( p );\r\n\r\n      /* many Dynalab fonts have empty sub-headers */\r\n      if ( code_count == 0 )\r\n        continue;\r\n\r\n      /* check range within 0..255 */\r\n      if ( valid->level >= FT_VALIDATE_PARANOID )\r\n      {\r\n        if ( first_code >= 256 || first_code + code_count > 256 )\r\n          FT_INVALID_DATA;\r\n      }\r\n\r\n      /* check offset */\r\n      if ( offset != 0 )\r\n      {\r\n        ids = p - 2 + offset;\r\n        if ( ids < glyph_ids || ids + code_count*2 > table + length )\r\n          FT_INVALID_OFFSET;\r\n\r\n        /* check glyph IDs */\r\n        if ( valid->level >= FT_VALIDATE_TIGHT )\r\n        {\r\n          FT_Byte*  limit = p + code_count * 2;\r\n          FT_UInt   idx;\r\n\r\n\r\n          for ( ; p < limit; )\r\n          {\r\n            idx = TT_NEXT_USHORT( p );\r\n            if ( idx != 0 )\r\n            {\r\n              idx = ( idx + delta ) & 0xFFFFU;\r\n              if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )\r\n                FT_INVALID_GLYPH_ID;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* return sub header corresponding to a given character code */\r\n  /* NULL on invalid charcode                                  */\r\n  static FT_Byte*\r\n  tt_cmap2_get_subheader( FT_Byte*   table,\r\n                          FT_UInt32  char_code )\r\n  {\r\n    FT_Byte*  result = NULL;\r\n\r\n\r\n    if ( char_code < 0x10000UL )\r\n    {\r\n      FT_UInt   char_lo = (FT_UInt)( char_code & 0xFF );\r\n      FT_UInt   char_hi = (FT_UInt)( char_code >> 8 );\r\n      FT_Byte*  p       = table + 6;    /* keys table */\r\n      FT_Byte*  subs    = table + 518;  /* subheaders table */\r\n      FT_Byte*  sub;\r\n\r\n\r\n      if ( char_hi == 0 )\r\n      {\r\n        /* an 8-bit character code -- we use subHeader 0 in this case */\r\n        /* to test whether the character code is in the charmap       */\r\n        /*                                                            */\r\n        sub = subs;  /* jump to first sub-header */\r\n\r\n        /* check that the sub-header for this byte is 0, which */\r\n        /* indicates that it is really a valid one-byte value  */\r\n        /* Otherwise, return 0                                 */\r\n        /*                                                     */\r\n        p += char_lo * 2;\r\n        if ( TT_PEEK_USHORT( p ) != 0 )\r\n          goto Exit;\r\n      }\r\n      else\r\n      {\r\n        /* a 16-bit character code */\r\n\r\n        /* jump to key entry  */\r\n        p  += char_hi * 2;\r\n        /* jump to sub-header */\r\n        sub = subs + ( FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 8 ) );\r\n\r\n        /* check that the high byte isn't a valid one-byte value */\r\n        if ( sub == subs )\r\n          goto Exit;\r\n      }\r\n      result = sub;\r\n    }\r\n  Exit:\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap2_char_index( TT_CMap    cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    FT_Byte*  table   = cmap->data;\r\n    FT_UInt   result  = 0;\r\n    FT_Byte*  subheader;\r\n\r\n\r\n    subheader = tt_cmap2_get_subheader( table, char_code );\r\n    if ( subheader )\r\n    {\r\n      FT_Byte*  p   = subheader;\r\n      FT_UInt   idx = (FT_UInt)(char_code & 0xFF);\r\n      FT_UInt   start, count;\r\n      FT_Int    delta;\r\n      FT_UInt   offset;\r\n\r\n\r\n      start  = TT_NEXT_USHORT( p );\r\n      count  = TT_NEXT_USHORT( p );\r\n      delta  = TT_NEXT_SHORT ( p );\r\n      offset = TT_PEEK_USHORT( p );\r\n\r\n      idx -= start;\r\n      if ( idx < count && offset != 0 )\r\n      {\r\n        p  += offset + 2 * idx;\r\n        idx = TT_PEEK_USHORT( p );\r\n\r\n        if ( idx != 0 )\r\n          result = (FT_UInt)( idx + delta ) & 0xFFFFU;\r\n      }\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap2_char_next( TT_CMap     cmap,\r\n                      FT_UInt32  *pcharcode )\r\n  {\r\n    FT_Byte*   table    = cmap->data;\r\n    FT_UInt    gindex   = 0;\r\n    FT_UInt32  result   = 0;\r\n    FT_UInt32  charcode = *pcharcode + 1;\r\n    FT_Byte*   subheader;\r\n\r\n\r\n    while ( charcode < 0x10000UL )\r\n    {\r\n      subheader = tt_cmap2_get_subheader( table, charcode );\r\n      if ( subheader )\r\n      {\r\n        FT_Byte*  p       = subheader;\r\n        FT_UInt   start   = TT_NEXT_USHORT( p );\r\n        FT_UInt   count   = TT_NEXT_USHORT( p );\r\n        FT_Int    delta   = TT_NEXT_SHORT ( p );\r\n        FT_UInt   offset  = TT_PEEK_USHORT( p );\r\n        FT_UInt   char_lo = (FT_UInt)( charcode & 0xFF );\r\n        FT_UInt   pos, idx;\r\n\r\n\r\n        if ( offset == 0 )\r\n          goto Next_SubHeader;\r\n\r\n        if ( char_lo < start )\r\n        {\r\n          char_lo = start;\r\n          pos     = 0;\r\n        }\r\n        else\r\n          pos = (FT_UInt)( char_lo - start );\r\n\r\n        p       += offset + pos * 2;\r\n        charcode = FT_PAD_FLOOR( charcode, 256 ) + char_lo;\r\n\r\n        for ( ; pos < count; pos++, charcode++ )\r\n        {\r\n          idx = TT_NEXT_USHORT( p );\r\n\r\n          if ( idx != 0 )\r\n          {\r\n            gindex = ( idx + delta ) & 0xFFFFU;\r\n            if ( gindex != 0 )\r\n            {\r\n              result = charcode;\r\n              goto Exit;\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      /* jump to next sub-header, i.e. higher byte value */\r\n    Next_SubHeader:\r\n      charcode = FT_PAD_FLOOR( charcode, 256 ) + 256;\r\n    }\r\n\r\n  Exit:\r\n    *pcharcode = result;\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap2_get_info( TT_CMap       cmap,\r\n                     TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 4;\r\n\r\n\r\n    cmap_info->format   = 2;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap2_class_rec,\r\n    sizeof ( TT_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap2_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap2_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    2,\r\n    (TT_CMap_ValidateFunc)tt_cmap2_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap2_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_2 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           FORMAT 4                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME          OFFSET         TYPE              DESCRIPTION          */\r\n  /*                                                                       */\r\n  /*   format        0              USHORT            must be 4            */\r\n  /*   length        2              USHORT            table length         */\r\n  /*                                                  in bytes             */\r\n  /*   language      4              USHORT            Mac language code    */\r\n  /*                                                                       */\r\n  /*   segCountX2    6              USHORT            2*NUM_SEGS           */\r\n  /*   searchRange   8              USHORT            2*(1 << LOG_SEGS)    */\r\n  /*   entrySelector 10             USHORT            LOG_SEGS             */\r\n  /*   rangeShift    12             USHORT            segCountX2 -         */\r\n  /*                                                    searchRange        */\r\n  /*                                                                       */\r\n  /*   endCount      14             USHORT[NUM_SEGS]  end charcode for     */\r\n  /*                                                  each segment; last   */\r\n  /*                                                  is 0xFFFF            */\r\n  /*                                                                       */\r\n  /*   pad           14+NUM_SEGS*2  USHORT            padding              */\r\n  /*                                                                       */\r\n  /*   startCount    16+NUM_SEGS*2  USHORT[NUM_SEGS]  first charcode for   */\r\n  /*                                                  each segment         */\r\n  /*                                                                       */\r\n  /*   idDelta       16+NUM_SEGS*4  SHORT[NUM_SEGS]   delta for each       */\r\n  /*                                                  segment              */\r\n  /*   idOffset      16+NUM_SEGS*6  SHORT[NUM_SEGS]   range offset for     */\r\n  /*                                                  each segment; can be */\r\n  /*                                                  zero                 */\r\n  /*                                                                       */\r\n  /*   glyphIds      16+NUM_SEGS*8  USHORT[]          array of glyph ID    */\r\n  /*                                                  ranges               */\r\n  /*                                                                       */\r\n  /* Character codes are modelled by a series of ordered (increasing)      */\r\n  /* intervals called segments.  Each segment has start and end codes,     */\r\n  /* provided by the `startCount' and `endCount' arrays.  Segments must    */\r\n  /* not overlap, and the last segment should always contain the value     */\r\n  /* 0xFFFF for `endCount'.                                                */\r\n  /*                                                                       */\r\n  /* The fields `searchRange', `entrySelector' and `rangeShift' are better */\r\n  /* ignored (they are traces of over-engineering in the TrueType          */\r\n  /* specification).                                                       */\r\n  /*                                                                       */\r\n  /* Each segment also has a signed `delta', as well as an optional offset */\r\n  /* within the `glyphIds' table.                                          */\r\n  /*                                                                       */\r\n  /* If a segment's idOffset is 0, the glyph index corresponding to any    */\r\n  /* charcode within the segment is obtained by adding the value of        */\r\n  /* `idDelta' directly to the charcode, modulo 65536.                     */\r\n  /*                                                                       */\r\n  /* Otherwise, a glyph index is taken from the glyph IDs sub-array for    */\r\n  /* the segment, and the value of `idDelta' is added to it.               */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* Finally, note that a lot of fonts contain an invalid last segment,    */\r\n  /* where `start' and `end' are correctly set to 0xFFFF but both `delta'  */\r\n  /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with     */\r\n  /* OpenOffice.org).  We need special code to deal with them correctly.   */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_4\r\n\r\n  typedef struct  TT_CMap4Rec_\r\n  {\r\n    TT_CMapRec  cmap;\r\n    FT_UInt32   cur_charcode;   /* current charcode */\r\n    FT_UInt     cur_gindex;     /* current glyph index */\r\n\r\n    FT_UInt     num_ranges;\r\n    FT_UInt     cur_range;\r\n    FT_UInt     cur_start;\r\n    FT_UInt     cur_end;\r\n    FT_Int      cur_delta;\r\n    FT_Byte*    cur_values;\r\n\r\n  } TT_CMap4Rec, *TT_CMap4;\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap4_init( TT_CMap4  cmap,\r\n                 FT_Byte*  table )\r\n  {\r\n    FT_Byte*  p;\r\n\r\n\r\n    cmap->cmap.data    = table;\r\n\r\n    p                  = table + 6;\r\n    cmap->num_ranges   = FT_PEEK_USHORT( p ) >> 1;\r\n    cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;\r\n    cmap->cur_gindex   = 0;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Int\r\n  tt_cmap4_set_range( TT_CMap4  cmap,\r\n                      FT_UInt   range_index )\r\n  {\r\n    FT_Byte*  table = cmap->cmap.data;\r\n    FT_Byte*  p;\r\n    FT_UInt   num_ranges = cmap->num_ranges;\r\n\r\n\r\n    while ( range_index < num_ranges )\r\n    {\r\n      FT_UInt  offset;\r\n\r\n\r\n      p             = table + 14 + range_index * 2;\r\n      cmap->cur_end = FT_PEEK_USHORT( p );\r\n\r\n      p              += 2 + num_ranges * 2;\r\n      cmap->cur_start = FT_PEEK_USHORT( p );\r\n\r\n      p              += num_ranges * 2;\r\n      cmap->cur_delta = FT_PEEK_SHORT( p );\r\n\r\n      p     += num_ranges * 2;\r\n      offset = FT_PEEK_USHORT( p );\r\n\r\n      /* some fonts have an incorrect last segment; */\r\n      /* we have to catch it                        */\r\n      if ( range_index     >= num_ranges - 1 &&\r\n           cmap->cur_start == 0xFFFFU        &&\r\n           cmap->cur_end   == 0xFFFFU        )\r\n      {\r\n        TT_Face   face  = (TT_Face)cmap->cmap.cmap.charmap.face;\r\n        FT_Byte*  limit = face->cmap_table + face->cmap_size;\r\n\r\n\r\n        if ( offset && p + offset + 2 > limit )\r\n        {\r\n          cmap->cur_delta = 1;\r\n          offset          = 0;\r\n        }\r\n      }\r\n\r\n      if ( offset != 0xFFFFU )\r\n      {\r\n        cmap->cur_values = offset ? p + offset : NULL;\r\n        cmap->cur_range  = range_index;\r\n        return 0;\r\n      }\r\n\r\n      /* we skip empty segments */\r\n      range_index++;\r\n    }\r\n\r\n    return -1;\r\n  }\r\n\r\n\r\n  /* search the index of the charcode next to cmap->cur_charcode; */\r\n  /* caller should call tt_cmap4_set_range with proper range      */\r\n  /* before calling this function                                 */\r\n  /*                                                              */\r\n  static void\r\n  tt_cmap4_next( TT_CMap4  cmap )\r\n  {\r\n    FT_UInt  charcode;\r\n\r\n\r\n    if ( cmap->cur_charcode >= 0xFFFFUL )\r\n      goto Fail;\r\n\r\n    charcode = (FT_UInt)cmap->cur_charcode + 1;\r\n\r\n    if ( charcode < cmap->cur_start )\r\n      charcode = cmap->cur_start;\r\n\r\n    for ( ;; )\r\n    {\r\n      FT_Byte*  values = cmap->cur_values;\r\n      FT_UInt   end    = cmap->cur_end;\r\n      FT_Int    delta  = cmap->cur_delta;\r\n\r\n\r\n      if ( charcode <= end )\r\n      {\r\n        if ( values )\r\n        {\r\n          FT_Byte*  p = values + 2 * ( charcode - cmap->cur_start );\r\n\r\n\r\n          do\r\n          {\r\n            FT_UInt  gindex = FT_NEXT_USHORT( p );\r\n\r\n\r\n            if ( gindex != 0 )\r\n            {\r\n              gindex = (FT_UInt)( ( gindex + delta ) & 0xFFFFU );\r\n              if ( gindex != 0 )\r\n              {\r\n                cmap->cur_charcode = charcode;\r\n                cmap->cur_gindex   = gindex;\r\n                return;\r\n              }\r\n            }\r\n          } while ( ++charcode <= end );\r\n        }\r\n        else\r\n        {\r\n          do\r\n          {\r\n            FT_UInt  gindex = (FT_UInt)( ( charcode + delta ) & 0xFFFFU );\r\n\r\n\r\n            if ( gindex != 0 )\r\n            {\r\n              cmap->cur_charcode = charcode;\r\n              cmap->cur_gindex   = gindex;\r\n              return;\r\n            }\r\n          } while ( ++charcode <= end );\r\n        }\r\n      }\r\n\r\n      /* we need to find another range */\r\n      if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 )\r\n        break;\r\n\r\n      if ( charcode < cmap->cur_start )\r\n        charcode = cmap->cur_start;\r\n    }\r\n\r\n  Fail:\r\n    cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;\r\n    cmap->cur_gindex   = 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap4_validate( FT_Byte*      table,\r\n                     FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p      = table + 2;               /* skip format */\r\n    FT_UInt   length = TT_NEXT_USHORT( p );\r\n    FT_Byte   *ends, *starts, *offsets, *deltas, *glyph_ids;\r\n    FT_UInt   num_segs;\r\n    FT_Error  error = SFNT_Err_Ok;\r\n\r\n\r\n    if ( length < 16 )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* in certain fonts, the `length' field is invalid and goes */\r\n    /* out of bound.  We try to correct this here...            */\r\n    if ( table + length > valid->limit )\r\n    {\r\n      if ( valid->level >= FT_VALIDATE_TIGHT )\r\n        FT_INVALID_TOO_SHORT;\r\n\r\n      length = (FT_UInt)( valid->limit - table );\r\n    }\r\n\r\n    p        = table + 6;\r\n    num_segs = TT_NEXT_USHORT( p );   /* read segCountX2 */\r\n\r\n    if ( valid->level >= FT_VALIDATE_PARANOID )\r\n    {\r\n      /* check that we have an even value here */\r\n      if ( num_segs & 1 )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    num_segs /= 2;\r\n\r\n    if ( length < 16 + num_segs * 2 * 4 )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check the search parameters - even though we never use them */\r\n    /*                                                             */\r\n    if ( valid->level >= FT_VALIDATE_PARANOID )\r\n    {\r\n      /* check the values of `searchRange', `entrySelector', `rangeShift' */\r\n      FT_UInt  search_range   = TT_NEXT_USHORT( p );\r\n      FT_UInt  entry_selector = TT_NEXT_USHORT( p );\r\n      FT_UInt  range_shift    = TT_NEXT_USHORT( p );\r\n\r\n\r\n      if ( ( search_range | range_shift ) & 1 )  /* must be even values */\r\n        FT_INVALID_DATA;\r\n\r\n      search_range /= 2;\r\n      range_shift  /= 2;\r\n\r\n      /* `search range' is the greatest power of 2 that is <= num_segs */\r\n\r\n      if ( search_range                > num_segs                 ||\r\n           search_range * 2            < num_segs                 ||\r\n           search_range + range_shift != num_segs                 ||\r\n           search_range               != ( 1U << entry_selector ) )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    ends      = table   + 14;\r\n    starts    = table   + 16 + num_segs * 2;\r\n    deltas    = starts  + num_segs * 2;\r\n    offsets   = deltas  + num_segs * 2;\r\n    glyph_ids = offsets + num_segs * 2;\r\n\r\n    /* check last segment; its end count value must be 0xFFFF */\r\n    if ( valid->level >= FT_VALIDATE_PARANOID )\r\n    {\r\n      p = ends + ( num_segs - 1 ) * 2;\r\n      if ( TT_PEEK_USHORT( p ) != 0xFFFFU )\r\n        FT_INVALID_DATA;\r\n    }\r\n\r\n    {\r\n      FT_UInt   start, end, offset, n;\r\n      FT_UInt   last_start = 0, last_end = 0;\r\n      FT_Int    delta;\r\n      FT_Byte*  p_start   = starts;\r\n      FT_Byte*  p_end     = ends;\r\n      FT_Byte*  p_delta   = deltas;\r\n      FT_Byte*  p_offset  = offsets;\r\n\r\n\r\n      for ( n = 0; n < num_segs; n++ )\r\n      {\r\n        p      = p_offset;\r\n        start  = TT_NEXT_USHORT( p_start );\r\n        end    = TT_NEXT_USHORT( p_end );\r\n        delta  = TT_NEXT_SHORT( p_delta );\r\n        offset = TT_NEXT_USHORT( p_offset );\r\n\r\n        if ( start > end )\r\n          FT_INVALID_DATA;\r\n\r\n        /* this test should be performed at default validation level; */\r\n        /* unfortunately, some popular Asian fonts have overlapping   */\r\n        /* ranges in their charmaps                                   */\r\n        /*                                                            */\r\n        if ( start <= last_end && n > 0 )\r\n        {\r\n          if ( valid->level >= FT_VALIDATE_TIGHT )\r\n            FT_INVALID_DATA;\r\n          else\r\n          {\r\n            /* allow overlapping segments, provided their start points */\r\n            /* and end points, respectively, are in ascending order    */\r\n            /*                                                         */\r\n            if ( last_start > start || last_end > end )\r\n              error |= TT_CMAP_FLAG_UNSORTED;\r\n            else\r\n              error |= TT_CMAP_FLAG_OVERLAPPING;\r\n          }\r\n        }\r\n\r\n        if ( offset && offset != 0xFFFFU )\r\n        {\r\n          p += offset;  /* start of glyph ID array */\r\n\r\n          /* check that we point within the glyph IDs table only */\r\n          if ( valid->level >= FT_VALIDATE_TIGHT )\r\n          {\r\n            if ( p < glyph_ids                                ||\r\n                 p + ( end - start + 1 ) * 2 > table + length )\r\n              FT_INVALID_DATA;\r\n          }\r\n          /* Some fonts handle the last segment incorrectly.  In */\r\n          /* theory, 0xFFFF might point to an ordinary glyph --  */\r\n          /* a cmap 4 is versatile and could be used for any     */\r\n          /* encoding, not only Unicode.  However, reality shows */\r\n          /* that far too many fonts are sloppy and incorrectly  */\r\n          /* set all fields but `start' and `end' for the last   */\r\n          /* segment if it contains only a single character.     */\r\n          /*                                                     */\r\n          /* We thus omit the test here, delaying it to the      */\r\n          /* routines which actually access the cmap.            */\r\n          else if ( n != num_segs - 1                       ||\r\n                    !( start == 0xFFFFU && end == 0xFFFFU ) )\r\n          {\r\n            if ( p < glyph_ids                              ||\r\n                 p + ( end - start + 1 ) * 2 > valid->limit )\r\n              FT_INVALID_DATA;\r\n          }\r\n\r\n          /* check glyph indices within the segment range */\r\n          if ( valid->level >= FT_VALIDATE_TIGHT )\r\n          {\r\n            FT_UInt  i, idx;\r\n\r\n\r\n            for ( i = start; i < end; i++ )\r\n            {\r\n              idx = FT_NEXT_USHORT( p );\r\n              if ( idx != 0 )\r\n              {\r\n                idx = (FT_UInt)( idx + delta ) & 0xFFFFU;\r\n\r\n                if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )\r\n                  FT_INVALID_GLYPH_ID;\r\n              }\r\n            }\r\n          }\r\n        }\r\n        else if ( offset == 0xFFFFU )\r\n        {\r\n          /* some fonts (erroneously?) use a range offset of 0xFFFF */\r\n          /* to mean missing glyph in cmap table                    */\r\n          /*                                                        */\r\n          if ( valid->level >= FT_VALIDATE_PARANOID    ||\r\n               n != num_segs - 1                       ||\r\n               !( start == 0xFFFFU && end == 0xFFFFU ) )\r\n            FT_INVALID_DATA;\r\n        }\r\n\r\n        last_start = start;\r\n        last_end   = end;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap4_char_map_linear( TT_CMap     cmap,\r\n                            FT_UInt32*  pcharcode,\r\n                            FT_Bool     next )\r\n  {\r\n    FT_UInt    num_segs2, start, end, offset;\r\n    FT_Int     delta;\r\n    FT_UInt    i, num_segs;\r\n    FT_UInt32  charcode = *pcharcode;\r\n    FT_UInt    gindex   = 0;\r\n    FT_Byte*   p;\r\n\r\n\r\n    p = cmap->data + 6;\r\n    num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );\r\n\r\n    num_segs = num_segs2 >> 1;\r\n\r\n    if ( !num_segs )\r\n      return 0;\r\n\r\n    if ( next )\r\n      charcode++;\r\n\r\n    /* linear search */\r\n    for ( ; charcode <= 0xFFFFU; charcode++ )\r\n    {\r\n      FT_Byte*  q;\r\n\r\n\r\n      p = cmap->data + 14;               /* ends table   */\r\n      q = cmap->data + 16 + num_segs2;   /* starts table */\r\n\r\n      for ( i = 0; i < num_segs; i++ )\r\n      {\r\n        end   = TT_NEXT_USHORT( p );\r\n        start = TT_NEXT_USHORT( q );\r\n\r\n        if ( charcode >= start && charcode <= end )\r\n        {\r\n          p       = q - 2 + num_segs2;\r\n          delta   = TT_PEEK_SHORT( p );\r\n          p      += num_segs2;\r\n          offset  = TT_PEEK_USHORT( p );\r\n\r\n          /* some fonts have an incorrect last segment; */\r\n          /* we have to catch it                        */\r\n          if ( i >= num_segs - 1                  &&\r\n               start == 0xFFFFU && end == 0xFFFFU )\r\n          {\r\n            TT_Face   face  = (TT_Face)cmap->cmap.charmap.face;\r\n            FT_Byte*  limit = face->cmap_table + face->cmap_size;\r\n\r\n\r\n            if ( offset && p + offset + 2 > limit )\r\n            {\r\n              delta  = 1;\r\n              offset = 0;\r\n            }\r\n          }\r\n\r\n          if ( offset == 0xFFFFU )\r\n            continue;\r\n\r\n          if ( offset )\r\n          {\r\n            p += offset + ( charcode - start ) * 2;\r\n            gindex = TT_PEEK_USHORT( p );\r\n            if ( gindex != 0 )\r\n              gindex = (FT_UInt)( gindex + delta ) & 0xFFFFU;\r\n          }\r\n          else\r\n            gindex = (FT_UInt)( charcode + delta ) & 0xFFFFU;\r\n\r\n          break;\r\n        }\r\n      }\r\n\r\n      if ( !next || gindex )\r\n        break;\r\n    }\r\n\r\n    if ( next && gindex )\r\n      *pcharcode = charcode;\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap4_char_map_binary( TT_CMap     cmap,\r\n                            FT_UInt32*  pcharcode,\r\n                            FT_Bool     next )\r\n  {\r\n    FT_UInt   num_segs2, start, end, offset;\r\n    FT_Int    delta;\r\n    FT_UInt   max, min, mid, num_segs;\r\n    FT_UInt   charcode = (FT_UInt)*pcharcode;\r\n    FT_UInt   gindex   = 0;\r\n    FT_Byte*  p;\r\n\r\n\r\n    p = cmap->data + 6;\r\n    num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );\r\n\r\n    if ( !num_segs2 )\r\n      return 0;\r\n\r\n    num_segs = num_segs2 >> 1;\r\n\r\n    /* make compiler happy */\r\n    mid = num_segs;\r\n    end = 0xFFFFU;\r\n\r\n    if ( next )\r\n      charcode++;\r\n\r\n    min = 0;\r\n    max = num_segs;\r\n\r\n    /* binary search */\r\n    while ( min < max )\r\n    {\r\n      mid    = ( min + max ) >> 1;\r\n      p      = cmap->data + 14 + mid * 2;\r\n      end    = TT_PEEK_USHORT( p );\r\n      p     += 2 + num_segs2;\r\n      start  = TT_PEEK_USHORT( p );\r\n\r\n      if ( charcode < start )\r\n        max = mid;\r\n      else if ( charcode > end )\r\n        min = mid + 1;\r\n      else\r\n      {\r\n        p     += num_segs2;\r\n        delta  = TT_PEEK_SHORT( p );\r\n        p     += num_segs2;\r\n        offset = TT_PEEK_USHORT( p );\r\n\r\n        /* some fonts have an incorrect last segment; */\r\n        /* we have to catch it                        */\r\n        if ( mid >= num_segs - 1                &&\r\n             start == 0xFFFFU && end == 0xFFFFU )\r\n        {\r\n          TT_Face   face  = (TT_Face)cmap->cmap.charmap.face;\r\n          FT_Byte*  limit = face->cmap_table + face->cmap_size;\r\n\r\n\r\n          if ( offset && p + offset + 2 > limit )\r\n          {\r\n            delta  = 1;\r\n            offset = 0;\r\n          }\r\n        }\r\n\r\n        /* search the first segment containing `charcode' */\r\n        if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )\r\n        {\r\n          FT_UInt  i;\r\n\r\n\r\n          /* call the current segment `max' */\r\n          max = mid;\r\n\r\n          if ( offset == 0xFFFFU )\r\n            mid = max + 1;\r\n\r\n          /* search in segments before the current segment */\r\n          for ( i = max ; i > 0; i-- )\r\n          {\r\n            FT_UInt   prev_end;\r\n            FT_Byte*  old_p;\r\n\r\n\r\n            old_p    = p;\r\n            p        = cmap->data + 14 + ( i - 1 ) * 2;\r\n            prev_end = TT_PEEK_USHORT( p );\r\n\r\n            if ( charcode > prev_end )\r\n            {\r\n              p = old_p;\r\n              break;\r\n            }\r\n\r\n            end    = prev_end;\r\n            p     += 2 + num_segs2;\r\n            start  = TT_PEEK_USHORT( p );\r\n            p     += num_segs2;\r\n            delta  = TT_PEEK_SHORT( p );\r\n            p     += num_segs2;\r\n            offset = TT_PEEK_USHORT( p );\r\n\r\n            if ( offset != 0xFFFFU )\r\n              mid = i - 1;\r\n          }\r\n\r\n          /* no luck */\r\n          if ( mid == max + 1 )\r\n          {\r\n            if ( i != max )\r\n            {\r\n              p      = cmap->data + 14 + max * 2;\r\n              end    = TT_PEEK_USHORT( p );\r\n              p     += 2 + num_segs2;\r\n              start  = TT_PEEK_USHORT( p );\r\n              p     += num_segs2;\r\n              delta  = TT_PEEK_SHORT( p );\r\n              p     += num_segs2;\r\n              offset = TT_PEEK_USHORT( p );\r\n            }\r\n\r\n            mid = max;\r\n\r\n            /* search in segments after the current segment */\r\n            for ( i = max + 1; i < num_segs; i++ )\r\n            {\r\n              FT_UInt  next_end, next_start;\r\n\r\n\r\n              p          = cmap->data + 14 + i * 2;\r\n              next_end   = TT_PEEK_USHORT( p );\r\n              p         += 2 + num_segs2;\r\n              next_start = TT_PEEK_USHORT( p );\r\n\r\n              if ( charcode < next_start )\r\n                break;\r\n\r\n              end    = next_end;\r\n              start  = next_start;\r\n              p     += num_segs2;\r\n              delta  = TT_PEEK_SHORT( p );\r\n              p     += num_segs2;\r\n              offset = TT_PEEK_USHORT( p );\r\n\r\n              if ( offset != 0xFFFFU )\r\n                mid = i;\r\n            }\r\n            i--;\r\n\r\n            /* still no luck */\r\n            if ( mid == max )\r\n            {\r\n              mid = i;\r\n\r\n              break;\r\n            }\r\n          }\r\n\r\n          /* end, start, delta, and offset are for the i'th segment */\r\n          if ( mid != i )\r\n          {\r\n            p      = cmap->data + 14 + mid * 2;\r\n            end    = TT_PEEK_USHORT( p );\r\n            p     += 2 + num_segs2;\r\n            start  = TT_PEEK_USHORT( p );\r\n            p     += num_segs2;\r\n            delta  = TT_PEEK_SHORT( p );\r\n            p     += num_segs2;\r\n            offset = TT_PEEK_USHORT( p );\r\n          }\r\n        }\r\n        else\r\n        {\r\n          if ( offset == 0xFFFFU )\r\n            break;\r\n        }\r\n\r\n        if ( offset )\r\n        {\r\n          p += offset + ( charcode - start ) * 2;\r\n          gindex = TT_PEEK_USHORT( p );\r\n          if ( gindex != 0 )\r\n            gindex = (FT_UInt)( gindex + delta ) & 0xFFFFU;\r\n        }\r\n        else\r\n          gindex = (FT_UInt)( charcode + delta ) & 0xFFFFU;\r\n\r\n        break;\r\n      }\r\n    }\r\n\r\n    if ( next )\r\n    {\r\n      TT_CMap4  cmap4 = (TT_CMap4)cmap;\r\n\r\n\r\n      /* if `charcode' is not in any segment, then `mid' is */\r\n      /* the segment nearest to `charcode'                  */\r\n      /*                                                    */\r\n\r\n      if ( charcode > end )\r\n      {\r\n        mid++;\r\n        if ( mid == num_segs )\r\n          return 0;\r\n      }\r\n\r\n      if ( tt_cmap4_set_range( cmap4, mid ) )\r\n      {\r\n        if ( gindex )\r\n          *pcharcode = charcode;\r\n      }\r\n      else\r\n      {\r\n        cmap4->cur_charcode = charcode;\r\n\r\n        if ( gindex )\r\n          cmap4->cur_gindex = gindex;\r\n        else\r\n        {\r\n          cmap4->cur_charcode = charcode;\r\n          tt_cmap4_next( cmap4 );\r\n          gindex = cmap4->cur_gindex;\r\n        }\r\n\r\n        if ( gindex )\r\n          *pcharcode = cmap4->cur_charcode;\r\n      }\r\n    }\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap4_char_index( TT_CMap    cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    if ( char_code >= 0x10000UL )\r\n      return 0;\r\n\r\n    if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )\r\n      return tt_cmap4_char_map_linear( cmap, &char_code, 0 );\r\n    else\r\n      return tt_cmap4_char_map_binary( cmap, &char_code, 0 );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap4_char_next( TT_CMap     cmap,\r\n                      FT_UInt32  *pchar_code )\r\n  {\r\n    FT_UInt  gindex;\r\n\r\n\r\n    if ( *pchar_code >= 0xFFFFU )\r\n      return 0;\r\n\r\n    if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )\r\n      gindex = tt_cmap4_char_map_linear( cmap, pchar_code, 1 );\r\n    else\r\n    {\r\n      TT_CMap4  cmap4 = (TT_CMap4)cmap;\r\n\r\n\r\n      /* no need to search */\r\n      if ( *pchar_code == cmap4->cur_charcode )\r\n      {\r\n        tt_cmap4_next( cmap4 );\r\n        gindex = cmap4->cur_gindex;\r\n        if ( gindex )\r\n          *pchar_code = cmap4->cur_charcode;\r\n      }\r\n      else\r\n        gindex = tt_cmap4_char_map_binary( cmap, pchar_code, 1 );\r\n    }\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap4_get_info( TT_CMap       cmap,\r\n                     TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 4;\r\n\r\n\r\n    cmap_info->format   = 4;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap4_class_rec,\r\n    sizeof ( TT_CMap4Rec ),\r\n    (FT_CMap_InitFunc)     tt_cmap4_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap4_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap4_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    4,\r\n    (TT_CMap_ValidateFunc)tt_cmap4_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap4_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_4 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          FORMAT 6                             *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET          TYPE             DESCRIPTION            */\r\n  /*                                                                       */\r\n  /*   format       0              USHORT           must be 4              */\r\n  /*   length       2              USHORT           table length in bytes  */\r\n  /*   language     4              USHORT           Mac language code      */\r\n  /*                                                                       */\r\n  /*   first        6              USHORT           first segment code     */\r\n  /*   count        8              USHORT           segment size in chars  */\r\n  /*   glyphIds     10             USHORT[count]    glyph IDs              */\r\n  /*                                                                       */\r\n  /* A very simplified segment mapping.                                    */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_6\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap6_validate( FT_Byte*      table,\r\n                     FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_UInt   length, count;\r\n\r\n\r\n    if ( table + 10 > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    p      = table + 2;\r\n    length = TT_NEXT_USHORT( p );\r\n\r\n    p      = table + 8;             /* skip language and start index */\r\n    count  = TT_NEXT_USHORT( p );\r\n\r\n    if ( table + length > valid->limit || length < 10 + count * 2 )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check glyph indices */\r\n    if ( valid->level >= FT_VALIDATE_TIGHT )\r\n    {\r\n      FT_UInt  gindex;\r\n\r\n\r\n      for ( ; count > 0; count-- )\r\n      {\r\n        gindex = TT_NEXT_USHORT( p );\r\n        if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )\r\n          FT_INVALID_GLYPH_ID;\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap6_char_index( TT_CMap    cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    FT_Byte*  table  = cmap->data;\r\n    FT_UInt   result = 0;\r\n    FT_Byte*  p      = table + 6;\r\n    FT_UInt   start  = TT_NEXT_USHORT( p );\r\n    FT_UInt   count  = TT_NEXT_USHORT( p );\r\n    FT_UInt   idx    = (FT_UInt)( char_code - start );\r\n\r\n\r\n    if ( idx < count )\r\n    {\r\n      p += 2 * idx;\r\n      result = TT_PEEK_USHORT( p );\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap6_char_next( TT_CMap     cmap,\r\n                      FT_UInt32  *pchar_code )\r\n  {\r\n    FT_Byte*   table     = cmap->data;\r\n    FT_UInt32  result    = 0;\r\n    FT_UInt32  char_code = *pchar_code + 1;\r\n    FT_UInt    gindex    = 0;\r\n\r\n    FT_Byte*   p         = table + 6;\r\n    FT_UInt    start     = TT_NEXT_USHORT( p );\r\n    FT_UInt    count     = TT_NEXT_USHORT( p );\r\n    FT_UInt    idx;\r\n\r\n\r\n    if ( char_code >= 0x10000UL )\r\n      goto Exit;\r\n\r\n    if ( char_code < start )\r\n      char_code = start;\r\n\r\n    idx = (FT_UInt)( char_code - start );\r\n    p  += 2 * idx;\r\n\r\n    for ( ; idx < count; idx++ )\r\n    {\r\n      gindex = TT_NEXT_USHORT( p );\r\n      if ( gindex != 0 )\r\n      {\r\n        result = char_code;\r\n        break;\r\n      }\r\n      char_code++;\r\n    }\r\n\r\n  Exit:\r\n    *pchar_code = result;\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap6_get_info( TT_CMap       cmap,\r\n                     TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 4;\r\n\r\n\r\n    cmap_info->format   = 6;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap6_class_rec,\r\n    sizeof ( TT_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap6_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap6_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    6,\r\n    (TT_CMap_ValidateFunc)tt_cmap6_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap6_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_6 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          FORMAT 8                             *****/\r\n  /*****                                                               *****/\r\n  /***** It is hard to completely understand what the OpenType spec    *****/\r\n  /***** says about this format, but here is my conclusion.            *****/\r\n  /*****                                                               *****/\r\n  /***** The purpose of this format is to easily map UTF-16 text to    *****/\r\n  /***** glyph indices.  Basically, the `char_code' must be in one of  *****/\r\n  /***** the following formats:                                        *****/\r\n  /*****                                                               *****/\r\n  /*****   - A 16-bit value that isn't part of the Unicode Surrogates  *****/\r\n  /*****     Area (i.e. U+D800-U+DFFF).                                *****/\r\n  /*****                                                               *****/\r\n  /*****   - A 32-bit value, made of two surrogate values, i.e.. if    *****/\r\n  /*****     `char_code = (char_hi << 16) | char_lo', then both        *****/\r\n  /*****     `char_hi' and `char_lo' must be in the Surrogates Area.   *****/\r\n  /*****      Area.                                                    *****/\r\n  /*****                                                               *****/\r\n  /***** The `is32' table embedded in the charmap indicates whether a  *****/\r\n  /***** given 16-bit value is in the surrogates area or not.          *****/\r\n  /*****                                                               *****/\r\n  /***** So, for any given `char_code', we can assert the following:   *****/\r\n  /*****                                                               *****/\r\n  /*****   If `char_hi == 0' then we must have `is32[char_lo] == 0'.   *****/\r\n  /*****                                                               *****/\r\n  /*****   If `char_hi != 0' then we must have both                    *****/\r\n  /*****   `is32[char_hi] != 0' and `is32[char_lo] != 0'.              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET         TYPE        DESCRIPTION                  */\r\n  /*                                                                       */\r\n  /*   format      0              USHORT      must be 8                    */\r\n  /*   reserved    2              USHORT      reserved                     */\r\n  /*   length      4              ULONG       length in bytes              */\r\n  /*   language    8              ULONG       Mac language code            */\r\n  /*   is32        12             BYTE[8192]  32-bitness bitmap            */\r\n  /*   count       8204           ULONG       number of groups             */\r\n  /*                                                                       */\r\n  /* This header is followed by `count' groups of the following format:    */\r\n  /*                                                                       */\r\n  /*   start       0              ULONG       first charcode               */\r\n  /*   end         4              ULONG       last charcode                */\r\n  /*   startId     8              ULONG       start glyph ID for the group */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_8\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap8_validate( FT_Byte*      table,\r\n                     FT_Validator  valid )\r\n  {\r\n    FT_Byte*   p = table + 4;\r\n    FT_Byte*   is32;\r\n    FT_UInt32  length;\r\n    FT_UInt32  num_groups;\r\n\r\n\r\n    if ( table + 16 + 8192 > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    length = TT_NEXT_ULONG( p );\r\n    if ( length > (FT_UInt32)( valid->limit - table ) || length < 8192 + 16 )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    is32       = table + 12;\r\n    p          = is32  + 8192;          /* skip `is32' array */\r\n    num_groups = TT_NEXT_ULONG( p );\r\n\r\n    if ( p + num_groups * 12 > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check groups, they must be in increasing order */\r\n    {\r\n      FT_UInt32  n, start, end, start_id, count, last = 0;\r\n\r\n\r\n      for ( n = 0; n < num_groups; n++ )\r\n      {\r\n        FT_UInt   hi, lo;\r\n\r\n\r\n        start    = TT_NEXT_ULONG( p );\r\n        end      = TT_NEXT_ULONG( p );\r\n        start_id = TT_NEXT_ULONG( p );\r\n\r\n        if ( start > end )\r\n          FT_INVALID_DATA;\r\n\r\n        if ( n > 0 && start <= last )\r\n          FT_INVALID_DATA;\r\n\r\n        if ( valid->level >= FT_VALIDATE_TIGHT )\r\n        {\r\n          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )\r\n            FT_INVALID_GLYPH_ID;\r\n\r\n          count = (FT_UInt32)( end - start + 1 );\r\n\r\n          if ( start & ~0xFFFFU )\r\n          {\r\n            /* start_hi != 0; check that is32[i] is 1 for each i in */\r\n            /* the `hi' and `lo' of the range [start..end]          */\r\n            for ( ; count > 0; count--, start++ )\r\n            {\r\n              hi = (FT_UInt)( start >> 16 );\r\n              lo = (FT_UInt)( start & 0xFFFFU );\r\n\r\n              if ( (is32[hi >> 3] & ( 0x80 >> ( hi & 7 ) ) ) == 0 )\r\n                FT_INVALID_DATA;\r\n\r\n              if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) == 0 )\r\n                FT_INVALID_DATA;\r\n            }\r\n          }\r\n          else\r\n          {\r\n            /* start_hi == 0; check that is32[i] is 0 for each i in */\r\n            /* the range [start..end]                               */\r\n\r\n            /* end_hi cannot be != 0! */\r\n            if ( end & ~0xFFFFU )\r\n              FT_INVALID_DATA;\r\n\r\n            for ( ; count > 0; count--, start++ )\r\n            {\r\n              lo = (FT_UInt)( start & 0xFFFFU );\r\n\r\n              if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) != 0 )\r\n                FT_INVALID_DATA;\r\n            }\r\n          }\r\n        }\r\n\r\n        last = end;\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap8_char_index( TT_CMap    cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    FT_Byte*   table      = cmap->data;\r\n    FT_UInt    result     = 0;\r\n    FT_Byte*   p          = table + 8204;\r\n    FT_UInt32  num_groups = TT_NEXT_ULONG( p );\r\n    FT_UInt32  start, end, start_id;\r\n\r\n\r\n    for ( ; num_groups > 0; num_groups-- )\r\n    {\r\n      start    = TT_NEXT_ULONG( p );\r\n      end      = TT_NEXT_ULONG( p );\r\n      start_id = TT_NEXT_ULONG( p );\r\n\r\n      if ( char_code < start )\r\n        break;\r\n\r\n      if ( char_code <= end )\r\n      {\r\n        result = (FT_UInt)( start_id + char_code - start );\r\n        break;\r\n      }\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap8_char_next( TT_CMap     cmap,\r\n                      FT_UInt32  *pchar_code )\r\n  {\r\n    FT_UInt32  result     = 0;\r\n    FT_UInt32  char_code  = *pchar_code + 1;\r\n    FT_UInt    gindex     = 0;\r\n    FT_Byte*   table      = cmap->data;\r\n    FT_Byte*   p          = table + 8204;\r\n    FT_UInt32  num_groups = TT_NEXT_ULONG( p );\r\n    FT_UInt32  start, end, start_id;\r\n\r\n\r\n    p = table + 8208;\r\n\r\n    for ( ; num_groups > 0; num_groups-- )\r\n    {\r\n      start    = TT_NEXT_ULONG( p );\r\n      end      = TT_NEXT_ULONG( p );\r\n      start_id = TT_NEXT_ULONG( p );\r\n\r\n      if ( char_code < start )\r\n        char_code = start;\r\n\r\n      if ( char_code <= end )\r\n      {\r\n        gindex = (FT_UInt)( char_code - start + start_id );\r\n        if ( gindex != 0 )\r\n        {\r\n          result = char_code;\r\n          goto Exit;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    *pchar_code = result;\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap8_get_info( TT_CMap       cmap,\r\n                     TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 8;\r\n\r\n\r\n    cmap_info->format   = 8;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap8_class_rec,\r\n    sizeof ( TT_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap8_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap8_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    8,\r\n    (TT_CMap_ValidateFunc)tt_cmap8_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap8_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_8 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          FORMAT 10                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME      OFFSET  TYPE               DESCRIPTION                    */\r\n  /*                                                                       */\r\n  /*   format     0      USHORT             must be 10                     */\r\n  /*   reserved   2      USHORT             reserved                       */\r\n  /*   length     4      ULONG              length in bytes                */\r\n  /*   language   8      ULONG              Mac language code              */\r\n  /*                                                                       */\r\n  /*   start     12      ULONG              first char in range            */\r\n  /*   count     16      ULONG              number of chars in range       */\r\n  /*   glyphIds  20      USHORT[count]      glyph indices covered          */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_10\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap10_validate( FT_Byte*      table,\r\n                      FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p = table + 4;\r\n    FT_ULong  length, count;\r\n\r\n\r\n    if ( table + 20 > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    length = TT_NEXT_ULONG( p );\r\n    p      = table + 16;\r\n    count  = TT_NEXT_ULONG( p );\r\n\r\n    if ( length > (FT_ULong)( valid->limit - table ) ||\r\n         length < 20 + count * 2                     )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check glyph indices */\r\n    if ( valid->level >= FT_VALIDATE_TIGHT )\r\n    {\r\n      FT_UInt  gindex;\r\n\r\n\r\n      for ( ; count > 0; count-- )\r\n      {\r\n        gindex = TT_NEXT_USHORT( p );\r\n        if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )\r\n          FT_INVALID_GLYPH_ID;\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap10_char_index( TT_CMap    cmap,\r\n                        FT_UInt32  char_code )\r\n  {\r\n    FT_Byte*   table  = cmap->data;\r\n    FT_UInt    result = 0;\r\n    FT_Byte*   p      = table + 12;\r\n    FT_UInt32  start  = TT_NEXT_ULONG( p );\r\n    FT_UInt32  count  = TT_NEXT_ULONG( p );\r\n    FT_UInt32  idx    = (FT_ULong)( char_code - start );\r\n\r\n\r\n    if ( idx < count )\r\n    {\r\n      p     += 2 * idx;\r\n      result = TT_PEEK_USHORT( p );\r\n    }\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap10_char_next( TT_CMap     cmap,\r\n                       FT_UInt32  *pchar_code )\r\n  {\r\n    FT_Byte*   table     = cmap->data;\r\n    FT_UInt32  char_code = *pchar_code + 1;\r\n    FT_UInt    gindex    = 0;\r\n    FT_Byte*   p         = table + 12;\r\n    FT_UInt32  start     = TT_NEXT_ULONG( p );\r\n    FT_UInt32  count     = TT_NEXT_ULONG( p );\r\n    FT_UInt32  idx;\r\n\r\n\r\n    if ( char_code < start )\r\n      char_code = start;\r\n\r\n    idx = (FT_UInt32)( char_code - start );\r\n    p  += 2 * idx;\r\n\r\n    for ( ; idx < count; idx++ )\r\n    {\r\n      gindex = TT_NEXT_USHORT( p );\r\n      if ( gindex != 0 )\r\n        break;\r\n      char_code++;\r\n    }\r\n\r\n    *pchar_code = char_code;\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap10_get_info( TT_CMap       cmap,\r\n                      TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 8;\r\n\r\n\r\n    cmap_info->format   = 10;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap10_class_rec,\r\n    sizeof ( TT_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap10_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap10_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    10,\r\n    (TT_CMap_ValidateFunc)tt_cmap10_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap10_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_10 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          FORMAT 12                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET     TYPE       DESCRIPTION                       */\r\n  /*                                                                       */\r\n  /*   format      0          USHORT     must be 12                        */\r\n  /*   reserved    2          USHORT     reserved                          */\r\n  /*   length      4          ULONG      length in bytes                   */\r\n  /*   language    8          ULONG      Mac language code                 */\r\n  /*   count       12         ULONG      number of groups                  */\r\n  /*               16                                                      */\r\n  /*                                                                       */\r\n  /* This header is followed by `count' groups of the following format:    */\r\n  /*                                                                       */\r\n  /*   start       0          ULONG      first charcode                    */\r\n  /*   end         4          ULONG      last charcode                     */\r\n  /*   startId     8          ULONG      start glyph ID for the group      */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_12\r\n\r\n  typedef struct  TT_CMap12Rec_\r\n  {\r\n    TT_CMapRec  cmap;\r\n    FT_Bool     valid;\r\n    FT_ULong    cur_charcode;\r\n    FT_UInt     cur_gindex;\r\n    FT_ULong    cur_group;\r\n    FT_ULong    num_groups;\r\n\r\n  } TT_CMap12Rec, *TT_CMap12;\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap12_init( TT_CMap12  cmap,\r\n                  FT_Byte*   table )\r\n  {\r\n    cmap->cmap.data  = table;\r\n\r\n    table           += 12;\r\n    cmap->num_groups = FT_PEEK_ULONG( table );\r\n\r\n    cmap->valid      = 0;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap12_validate( FT_Byte*      table,\r\n                      FT_Validator  valid )\r\n  {\r\n    FT_Byte*   p;\r\n    FT_ULong   length;\r\n    FT_ULong   num_groups;\r\n\r\n\r\n    if ( table + 16 > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    p      = table + 4;\r\n    length = TT_NEXT_ULONG( p );\r\n\r\n    p          = table + 12;\r\n    num_groups = TT_NEXT_ULONG( p );\r\n\r\n    if ( length > (FT_ULong)( valid->limit - table ) ||\r\n         length < 16 + 12 * num_groups               )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check groups, they must be in increasing order */\r\n    {\r\n      FT_ULong  n, start, end, start_id, last = 0;\r\n\r\n\r\n      for ( n = 0; n < num_groups; n++ )\r\n      {\r\n        start    = TT_NEXT_ULONG( p );\r\n        end      = TT_NEXT_ULONG( p );\r\n        start_id = TT_NEXT_ULONG( p );\r\n\r\n        if ( start > end )\r\n          FT_INVALID_DATA;\r\n\r\n        if ( n > 0 && start <= last )\r\n          FT_INVALID_DATA;\r\n\r\n        if ( valid->level >= FT_VALIDATE_TIGHT )\r\n        {\r\n          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )\r\n            FT_INVALID_GLYPH_ID;\r\n        }\r\n\r\n        last = end;\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* search the index of the charcode next to cmap->cur_charcode */\r\n  /* cmap->cur_group should be set up properly by caller         */\r\n  /*                                                             */\r\n  static void\r\n  tt_cmap12_next( TT_CMap12  cmap )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_ULong  start, end, start_id, char_code;\r\n    FT_ULong  n;\r\n    FT_UInt   gindex;\r\n\r\n\r\n    if ( cmap->cur_charcode >= 0xFFFFFFFFUL )\r\n      goto Fail;\r\n\r\n    char_code = cmap->cur_charcode + 1;\r\n\r\n    n = cmap->cur_group;\r\n\r\n    for ( n = cmap->cur_group; n < cmap->num_groups; n++ )\r\n    {\r\n      p        = cmap->cmap.data + 16 + 12 * n;\r\n      start    = TT_NEXT_ULONG( p );\r\n      end      = TT_NEXT_ULONG( p );\r\n      start_id = TT_PEEK_ULONG( p );\r\n\r\n      if ( char_code < start )\r\n        char_code = start;\r\n\r\n      for ( ; char_code <= end; char_code++ )\r\n      {\r\n        gindex = (FT_UInt)( start_id + char_code - start );\r\n\r\n        if ( gindex )\r\n        {\r\n          cmap->cur_charcode = char_code;;\r\n          cmap->cur_gindex   = gindex;\r\n          cmap->cur_group    = n;\r\n\r\n          return;\r\n        }\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    cmap->valid = 0;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap12_char_map_binary( TT_CMap     cmap,\r\n                             FT_UInt32*  pchar_code,\r\n                             FT_Bool     next )\r\n  {\r\n    FT_UInt    gindex     = 0;\r\n    FT_Byte*   p          = cmap->data + 12;\r\n    FT_UInt32  num_groups = TT_PEEK_ULONG( p );\r\n    FT_UInt32  char_code  = *pchar_code;\r\n    FT_UInt32  start, end, start_id;\r\n    FT_UInt32  max, min, mid;\r\n\r\n\r\n    if ( !num_groups )\r\n      return 0;\r\n\r\n    /* make compiler happy */\r\n    mid = num_groups;\r\n    end = 0xFFFFFFFFUL;\r\n\r\n    if ( next )\r\n      char_code++;\r\n\r\n    min = 0;\r\n    max = num_groups;\r\n\r\n    /* binary search */\r\n    while ( min < max )\r\n    {\r\n      mid = ( min + max ) >> 1;\r\n      p   = cmap->data + 16 + 12 * mid;\r\n\r\n      start = TT_NEXT_ULONG( p );\r\n      end   = TT_NEXT_ULONG( p );\r\n\r\n      if ( char_code < start )\r\n        max = mid;\r\n      else if ( char_code > end )\r\n        min = mid + 1;\r\n      else\r\n      {\r\n        start_id = TT_PEEK_ULONG( p );\r\n        gindex = (FT_UInt)( start_id + char_code - start );\r\n\r\n        break;\r\n      }\r\n    }\r\n\r\n    if ( next )\r\n    {\r\n      TT_CMap12  cmap12 = (TT_CMap12)cmap;\r\n\r\n\r\n      /* if `char_code' is not in any group, then `mid' is */\r\n      /* the group nearest to `char_code'                  */\r\n      /*                                                   */\r\n\r\n      if ( char_code > end )\r\n      {\r\n        mid++;\r\n        if ( mid == num_groups )\r\n          return 0;\r\n      }\r\n\r\n      cmap12->valid        = 1;\r\n      cmap12->cur_charcode = char_code;\r\n      cmap12->cur_group    = mid;\r\n\r\n      if ( !gindex )\r\n      {\r\n        tt_cmap12_next( cmap12 );\r\n\r\n        if ( cmap12->valid )\r\n          gindex = cmap12->cur_gindex;\r\n      }\r\n      else\r\n        cmap12->cur_gindex = gindex;\r\n\r\n      if ( gindex )\r\n        *pchar_code = cmap12->cur_charcode;\r\n    }\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap12_char_index( TT_CMap    cmap,\r\n                        FT_UInt32  char_code )\r\n  {\r\n    return tt_cmap12_char_map_binary( cmap, &char_code, 0 );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap12_char_next( TT_CMap     cmap,\r\n                       FT_UInt32  *pchar_code )\r\n  {\r\n    TT_CMap12  cmap12 = (TT_CMap12)cmap;\r\n    FT_ULong   gindex;\r\n\r\n\r\n    if ( cmap12->cur_charcode >= 0xFFFFFFFFUL )\r\n      return 0;\r\n\r\n    /* no need to search */\r\n    if ( cmap12->valid && cmap12->cur_charcode == *pchar_code )\r\n    {\r\n      tt_cmap12_next( cmap12 );\r\n      if ( cmap12->valid )\r\n      {\r\n        gindex = cmap12->cur_gindex;\r\n\r\n        /* XXX: check cur_charcode overflow is expected */\r\n        if ( gindex )\r\n          *pchar_code = (FT_UInt32)cmap12->cur_charcode;\r\n      }\r\n      else\r\n        gindex = 0;\r\n    }\r\n    else\r\n      gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 );\r\n\r\n    /* XXX: check gindex overflow is expected */\r\n    return (FT_UInt32)gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap12_get_info( TT_CMap       cmap,\r\n                      TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 8;\r\n\r\n\r\n    cmap_info->format   = 12;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap12_class_rec,\r\n    sizeof ( TT_CMap12Rec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap12_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap12_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap12_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    12,\r\n    (TT_CMap_ValidateFunc)tt_cmap12_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap12_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_12 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                          FORMAT 13                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME        OFFSET     TYPE       DESCRIPTION                       */\r\n  /*                                                                       */\r\n  /*   format      0          USHORT     must be 13                        */\r\n  /*   reserved    2          USHORT     reserved                          */\r\n  /*   length      4          ULONG      length in bytes                   */\r\n  /*   language    8          ULONG      Mac language code                 */\r\n  /*   count       12         ULONG      number of groups                  */\r\n  /*               16                                                      */\r\n  /*                                                                       */\r\n  /* This header is followed by `count' groups of the following format:    */\r\n  /*                                                                       */\r\n  /*   start       0          ULONG      first charcode                    */\r\n  /*   end         4          ULONG      last charcode                     */\r\n  /*   glyphId     8          ULONG      glyph ID for the whole group      */\r\n  /*                                                                       */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_13\r\n\r\n  typedef struct  TT_CMap13Rec_\r\n  {\r\n    TT_CMapRec  cmap;\r\n    FT_Bool     valid;\r\n    FT_ULong    cur_charcode;\r\n    FT_UInt     cur_gindex;\r\n    FT_ULong    cur_group;\r\n    FT_ULong    num_groups;\r\n\r\n  } TT_CMap13Rec, *TT_CMap13;\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap13_init( TT_CMap13  cmap,\r\n                  FT_Byte*   table )\r\n  {\r\n    cmap->cmap.data  = table;\r\n\r\n    table           += 12;\r\n    cmap->num_groups = FT_PEEK_ULONG( table );\r\n\r\n    cmap->valid      = 0;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap13_validate( FT_Byte*      table,\r\n                      FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_ULong  length;\r\n    FT_ULong  num_groups;\r\n\r\n\r\n    if ( table + 16 > valid->limit )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    p      = table + 4;\r\n    length = TT_NEXT_ULONG( p );\r\n\r\n    p          = table + 12;\r\n    num_groups = TT_NEXT_ULONG( p );\r\n\r\n    if ( length > (FT_ULong)( valid->limit - table ) ||\r\n         length < 16 + 12 * num_groups               )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check groups, they must be in increasing order */\r\n    {\r\n      FT_ULong  n, start, end, glyph_id, last = 0;\r\n\r\n\r\n      for ( n = 0; n < num_groups; n++ )\r\n      {\r\n        start    = TT_NEXT_ULONG( p );\r\n        end      = TT_NEXT_ULONG( p );\r\n        glyph_id = TT_NEXT_ULONG( p );\r\n\r\n        if ( start > end )\r\n          FT_INVALID_DATA;\r\n\r\n        if ( n > 0 && start <= last )\r\n          FT_INVALID_DATA;\r\n\r\n        if ( valid->level >= FT_VALIDATE_TIGHT )\r\n        {\r\n          if ( glyph_id >= TT_VALID_GLYPH_COUNT( valid ) )\r\n            FT_INVALID_GLYPH_ID;\r\n        }\r\n\r\n        last = end;\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  /* search the index of the charcode next to cmap->cur_charcode */\r\n  /* cmap->cur_group should be set up properly by caller         */\r\n  /*                                                             */\r\n  static void\r\n  tt_cmap13_next( TT_CMap13  cmap )\r\n  {\r\n    FT_Byte*  p;\r\n    FT_ULong  start, end, glyph_id, char_code;\r\n    FT_ULong  n;\r\n    FT_UInt   gindex;\r\n\r\n\r\n    if ( cmap->cur_charcode >= 0xFFFFFFFFUL )\r\n      goto Fail;\r\n\r\n    char_code = cmap->cur_charcode + 1;\r\n\r\n    n = cmap->cur_group;\r\n\r\n    for ( n = cmap->cur_group; n < cmap->num_groups; n++ )\r\n    {\r\n      p        = cmap->cmap.data + 16 + 12 * n;\r\n      start    = TT_NEXT_ULONG( p );\r\n      end      = TT_NEXT_ULONG( p );\r\n      glyph_id = TT_PEEK_ULONG( p );\r\n\r\n      if ( char_code < start )\r\n        char_code = start;\r\n\r\n      if ( char_code <= end )\r\n      {\r\n        gindex = (FT_UInt)glyph_id;\r\n\r\n        if ( gindex )\r\n        {\r\n          cmap->cur_charcode = char_code;;\r\n          cmap->cur_gindex   = gindex;\r\n          cmap->cur_group    = n;\r\n\r\n          return;\r\n        }\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    cmap->valid = 0;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap13_char_map_binary( TT_CMap     cmap,\r\n                             FT_UInt32*  pchar_code,\r\n                             FT_Bool     next )\r\n  {\r\n    FT_UInt    gindex     = 0;\r\n    FT_Byte*   p          = cmap->data + 12;\r\n    FT_UInt32  num_groups = TT_PEEK_ULONG( p );\r\n    FT_UInt32  char_code  = *pchar_code;\r\n    FT_UInt32  start, end;\r\n    FT_UInt32  max, min, mid;\r\n\r\n\r\n    if ( !num_groups )\r\n      return 0;\r\n\r\n    /* make compiler happy */\r\n    mid = num_groups;\r\n    end = 0xFFFFFFFFUL;\r\n\r\n    if ( next )\r\n      char_code++;\r\n\r\n    min = 0;\r\n    max = num_groups;\r\n\r\n    /* binary search */\r\n    while ( min < max )\r\n    {\r\n      mid = ( min + max ) >> 1;\r\n      p   = cmap->data + 16 + 12 * mid;\r\n\r\n      start = TT_NEXT_ULONG( p );\r\n      end   = TT_NEXT_ULONG( p );\r\n\r\n      if ( char_code < start )\r\n        max = mid;\r\n      else if ( char_code > end )\r\n        min = mid + 1;\r\n      else\r\n      {\r\n        gindex = (FT_UInt)TT_PEEK_ULONG( p );\r\n\r\n        break;\r\n      }\r\n    }\r\n\r\n    if ( next )\r\n    {\r\n      TT_CMap13  cmap13 = (TT_CMap13)cmap;\r\n\r\n\r\n      /* if `char_code' is not in any group, then `mid' is */\r\n      /* the group nearest to `char_code'                  */\r\n\r\n      if ( char_code > end )\r\n      {\r\n        mid++;\r\n        if ( mid == num_groups )\r\n          return 0;\r\n      }\r\n\r\n      cmap13->valid        = 1;\r\n      cmap13->cur_charcode = char_code;\r\n      cmap13->cur_group    = mid;\r\n\r\n      if ( !gindex )\r\n      {\r\n        tt_cmap13_next( cmap13 );\r\n\r\n        if ( cmap13->valid )\r\n          gindex = cmap13->cur_gindex;\r\n      }\r\n      else\r\n        cmap13->cur_gindex = gindex;\r\n\r\n      if ( gindex )\r\n        *pchar_code = cmap13->cur_charcode;\r\n    }\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap13_char_index( TT_CMap    cmap,\r\n                        FT_UInt32  char_code )\r\n  {\r\n    return tt_cmap13_char_map_binary( cmap, &char_code, 0 );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap13_char_next( TT_CMap     cmap,\r\n                       FT_UInt32  *pchar_code )\r\n  {\r\n    TT_CMap13  cmap13 = (TT_CMap13)cmap;\r\n    FT_UInt    gindex;\r\n\r\n\r\n    if ( cmap13->cur_charcode >= 0xFFFFFFFFUL )\r\n      return 0;\r\n\r\n    /* no need to search */\r\n    if ( cmap13->valid && cmap13->cur_charcode == *pchar_code )\r\n    {\r\n      tt_cmap13_next( cmap13 );\r\n      if ( cmap13->valid )\r\n      {\r\n        gindex = cmap13->cur_gindex;\r\n        if ( gindex )\r\n          *pchar_code = cmap13->cur_charcode;\r\n      }\r\n      else\r\n        gindex = 0;\r\n    }\r\n    else\r\n      gindex = tt_cmap13_char_map_binary( cmap, pchar_code, 1 );\r\n\r\n    return gindex;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap13_get_info( TT_CMap       cmap,\r\n                      TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_Byte*  p = cmap->data + 8;\r\n\r\n\r\n    cmap_info->format   = 13;\r\n    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap13_class_rec,\r\n    sizeof ( TT_CMap13Rec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap13_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)tt_cmap13_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap13_char_next,\r\n\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n    NULL,\r\n\r\n    13,\r\n    (TT_CMap_ValidateFunc)tt_cmap13_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap13_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_13 */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                           FORMAT 14                           *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TABLE OVERVIEW                                                        */\r\n  /* --------------                                                        */\r\n  /*                                                                       */\r\n  /*   NAME         OFFSET  TYPE    DESCRIPTION                            */\r\n  /*                                                                       */\r\n  /*   format         0     USHORT  must be 14                             */\r\n  /*   length         2     ULONG   table length in bytes                  */\r\n  /*   numSelector    6     ULONG   number of variation sel. records       */\r\n  /*                                                                       */\r\n  /* Followed by numSelector records, each of which looks like             */\r\n  /*                                                                       */\r\n  /*   varSelector    0     UINT24  Unicode codepoint of sel.              */\r\n  /*   defaultOff     3     ULONG   offset to a default UVS table          */\r\n  /*                                describing any variants to be found in */\r\n  /*                                the normal Unicode subtable.           */\r\n  /*   nonDefOff      7     ULONG   offset to a non-default UVS table      */\r\n  /*                                describing any variants not in the     */\r\n  /*                                standard cmap, with GIDs here          */\r\n  /* (either offset may be 0 NULL)                                         */\r\n  /*                                                                       */\r\n  /* Selectors are sorted by code point.                                   */\r\n  /*                                                                       */\r\n  /* A default Unicode Variation Selector (UVS) subtable is just a list of */\r\n  /* ranges of code points which are to be found in the standard cmap.  No */\r\n  /* glyph IDs (GIDs) here.                                                */\r\n  /*                                                                       */\r\n  /*   numRanges      0     ULONG   number of ranges following             */\r\n  /*                                                                       */\r\n  /* A range looks like                                                    */\r\n  /*                                                                       */\r\n  /*   uniStart       0     UINT24  code point of the first character in   */\r\n  /*                                this range                             */\r\n  /*   additionalCnt  3     UBYTE   count of additional characters in this */\r\n  /*                                range (zero means a range of a single  */\r\n  /*                                character)                             */\r\n  /*                                                                       */\r\n  /* Ranges are sorted by `uniStart'.                                      */\r\n  /*                                                                       */\r\n  /* A non-default Unicode Variation Selector (UVS) subtable is a list of  */\r\n  /* mappings from codepoint to GID.                                       */\r\n  /*                                                                       */\r\n  /*   numMappings    0     ULONG   number of mappings                     */\r\n  /*                                                                       */\r\n  /* A range looks like                                                    */\r\n  /*                                                                       */\r\n  /*   uniStart       0     UINT24  code point of the first character in   */\r\n  /*                                this range                             */\r\n  /*   GID            3     USHORT  and its GID                            */\r\n  /*                                                                       */\r\n  /* Ranges are sorted by `uniStart'.                                      */\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_14\r\n\r\n  typedef struct  TT_CMap14Rec_\r\n  {\r\n    TT_CMapRec  cmap;\r\n    FT_ULong    num_selectors;\r\n\r\n    /* This array is used to store the results of various\r\n     * cmap 14 query functions.  The data is overwritten\r\n     * on each call to these functions.\r\n     */\r\n    FT_UInt32   max_results;\r\n    FT_UInt32*  results;\r\n    FT_Memory   memory;\r\n\r\n  } TT_CMap14Rec, *TT_CMap14;\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  tt_cmap14_done( TT_CMap14  cmap )\r\n  {\r\n    FT_Memory  memory = cmap->memory;\r\n\r\n\r\n    cmap->max_results = 0;\r\n    if ( memory != NULL && cmap->results != NULL )\r\n      FT_FREE( cmap->results );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_cmap14_ensure( TT_CMap14  cmap,\r\n                    FT_UInt32  num_results,\r\n                    FT_Memory  memory )\r\n  {\r\n    FT_UInt32  old_max = cmap->max_results;\r\n    FT_Error   error   = SFNT_Err_Ok;\r\n\r\n\r\n    if ( num_results > cmap->max_results )\r\n    {\r\n       cmap->memory = memory;\r\n\r\n       if ( FT_QRENEW_ARRAY( cmap->results, old_max, num_results ) )\r\n         return error;\r\n\r\n       cmap->max_results = num_results;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap14_init( TT_CMap14  cmap,\r\n                  FT_Byte*   table )\r\n  {\r\n    cmap->cmap.data = table;\r\n\r\n    table               += 6;\r\n    cmap->num_selectors  = FT_PEEK_ULONG( table );\r\n    cmap->max_results    = 0;\r\n    cmap->results        = NULL;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap14_validate( FT_Byte*      table,\r\n                      FT_Validator  valid )\r\n  {\r\n    FT_Byte*  p             = table + 2;\r\n    FT_ULong  length        = TT_NEXT_ULONG( p );\r\n    FT_ULong  num_selectors = TT_NEXT_ULONG( p );\r\n\r\n\r\n    if ( length > (FT_ULong)( valid->limit - table ) ||\r\n         length < 10 + 11 * num_selectors            )\r\n      FT_INVALID_TOO_SHORT;\r\n\r\n    /* check selectors, they must be in increasing order */\r\n    {\r\n      /* we start lastVarSel at 1 because a variant selector value of 0\r\n       * isn't valid.\r\n       */\r\n      FT_ULong  n, lastVarSel = 1;\r\n\r\n\r\n      for ( n = 0; n < num_selectors; n++ )\r\n      {\r\n        FT_ULong  varSel    = TT_NEXT_UINT24( p );\r\n        FT_ULong  defOff    = TT_NEXT_ULONG( p );\r\n        FT_ULong  nondefOff = TT_NEXT_ULONG( p );\r\n\r\n\r\n        if ( defOff >= length || nondefOff >= length )\r\n          FT_INVALID_TOO_SHORT;\r\n\r\n        if ( varSel < lastVarSel )\r\n          FT_INVALID_DATA;\r\n\r\n        lastVarSel = varSel + 1;\r\n\r\n        /* check the default table (these glyphs should be reached     */\r\n        /* through the normal Unicode cmap, no GIDs, just check order) */\r\n        if ( defOff != 0 )\r\n        {\r\n          FT_Byte*  defp      = table + defOff;\r\n          FT_ULong  numRanges = TT_NEXT_ULONG( defp );\r\n          FT_ULong  i;\r\n          FT_ULong  lastBase  = 0;\r\n\r\n\r\n          if ( defp + numRanges * 4 > valid->limit )\r\n            FT_INVALID_TOO_SHORT;\r\n\r\n          for ( i = 0; i < numRanges; ++i )\r\n          {\r\n            FT_ULong  base = TT_NEXT_UINT24( defp );\r\n            FT_ULong  cnt  = FT_NEXT_BYTE( defp );\r\n\r\n\r\n            if ( base + cnt >= 0x110000UL )              /* end of Unicode */\r\n              FT_INVALID_DATA;\r\n\r\n            if ( base < lastBase )\r\n              FT_INVALID_DATA;\r\n\r\n            lastBase = base + cnt + 1U;\r\n          }\r\n        }\r\n\r\n        /* and the non-default table (these glyphs are specified here) */\r\n        if ( nondefOff != 0 )\r\n        {\r\n          FT_Byte*  ndp         = table + nondefOff;\r\n          FT_ULong  numMappings = TT_NEXT_ULONG( ndp );\r\n          FT_ULong  i, lastUni  = 0;\r\n\r\n\r\n          if ( numMappings * 4 > (FT_ULong)( valid->limit - ndp ) )\r\n            FT_INVALID_TOO_SHORT;\r\n\r\n          for ( i = 0; i < numMappings; ++i )\r\n          {\r\n            FT_ULong  uni = TT_NEXT_UINT24( ndp );\r\n            FT_ULong  gid = TT_NEXT_USHORT( ndp );\r\n\r\n\r\n            if ( uni >= 0x110000UL )                     /* end of Unicode */\r\n              FT_INVALID_DATA;\r\n\r\n            if ( uni < lastUni )\r\n              FT_INVALID_DATA;\r\n\r\n            lastUni = uni + 1U;\r\n\r\n            if ( valid->level >= FT_VALIDATE_TIGHT    &&\r\n                 gid >= TT_VALID_GLYPH_COUNT( valid ) )\r\n              FT_INVALID_GLYPH_ID;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap14_char_index( TT_CMap    cmap,\r\n                        FT_UInt32  char_code )\r\n  {\r\n    FT_UNUSED( cmap );\r\n    FT_UNUSED( char_code );\r\n\r\n    /* This can't happen */\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 )\r\n  tt_cmap14_char_next( TT_CMap     cmap,\r\n                       FT_UInt32  *pchar_code )\r\n  {\r\n    FT_UNUSED( cmap );\r\n\r\n    /* This can't happen */\r\n    *pchar_code = 0;\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  tt_cmap14_get_info( TT_CMap       cmap,\r\n                      TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_UNUSED( cmap );\r\n\r\n    cmap_info->format   = 14;\r\n    /* subtable 14 does not define a language field */\r\n    cmap_info->language = 0xFFFFFFFFUL;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap14_char_map_def_binary( FT_Byte    *base,\r\n                                 FT_UInt32   char_code )\r\n  {\r\n    FT_UInt32  numRanges = TT_PEEK_ULONG( base );\r\n    FT_UInt32  max, min;\r\n\r\n\r\n    min = 0;\r\n    max = numRanges;\r\n\r\n    base += 4;\r\n\r\n    /* binary search */\r\n    while ( min < max )\r\n    {\r\n      FT_UInt32  mid   = ( min + max ) >> 1;\r\n      FT_Byte*   p     = base + 4 * mid;\r\n      FT_ULong   start = TT_NEXT_UINT24( p );\r\n      FT_UInt    cnt   = FT_NEXT_BYTE( p );\r\n\r\n\r\n      if ( char_code < start )\r\n        max = mid;\r\n      else if ( char_code > start+cnt )\r\n        min = mid + 1;\r\n      else\r\n        return TRUE;\r\n    }\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap14_char_map_nondef_binary( FT_Byte    *base,\r\n                                    FT_UInt32   char_code )\r\n  {\r\n    FT_UInt32  numMappings = TT_PEEK_ULONG( base );\r\n    FT_UInt32  max, min;\r\n\r\n\r\n    min = 0;\r\n    max = numMappings;\r\n\r\n    base += 4;\r\n\r\n    /* binary search */\r\n    while ( min < max )\r\n    {\r\n      FT_UInt32  mid = ( min + max ) >> 1;\r\n      FT_Byte*   p   = base + 5 * mid;\r\n      FT_UInt32  uni = (FT_UInt32)TT_NEXT_UINT24( p );\r\n\r\n\r\n      if ( char_code < uni )\r\n        max = mid;\r\n      else if ( char_code > uni )\r\n        min = mid + 1;\r\n      else\r\n        return TT_PEEK_USHORT( p );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static FT_Byte*\r\n  tt_cmap14_find_variant( FT_Byte    *base,\r\n                          FT_UInt32   variantCode )\r\n  {\r\n    FT_UInt32  numVar = TT_PEEK_ULONG( base );\r\n    FT_UInt32  max, min;\r\n\r\n\r\n    min = 0;\r\n    max = numVar;\r\n\r\n    base += 4;\r\n\r\n    /* binary search */\r\n    while ( min < max )\r\n    {\r\n      FT_UInt32  mid    = ( min + max ) >> 1;\r\n      FT_Byte*   p      = base + 11 * mid;\r\n      FT_ULong   varSel = TT_NEXT_UINT24( p );\r\n\r\n\r\n      if ( variantCode < varSel )\r\n        max = mid;\r\n      else if ( variantCode > varSel )\r\n        min = mid + 1;\r\n      else\r\n        return p;\r\n    }\r\n\r\n    return NULL;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt )\r\n  tt_cmap14_char_var_index( TT_CMap    cmap,\r\n                            TT_CMap    ucmap,\r\n                            FT_UInt32  charcode,\r\n                            FT_UInt32  variantSelector )\r\n  {\r\n    FT_Byte*  p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );\r\n    FT_ULong  defOff;\r\n    FT_ULong  nondefOff;\r\n\r\n\r\n    if ( !p )\r\n      return 0;\r\n\r\n    defOff    = TT_NEXT_ULONG( p );\r\n    nondefOff = TT_PEEK_ULONG( p );\r\n\r\n    if ( defOff != 0                                                    &&\r\n         tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )\r\n    {\r\n      /* This is the default variant of this charcode.  GID not stored */\r\n      /* here; stored in the normal Unicode charmap instead.           */\r\n      return ucmap->cmap.clazz->char_index( &ucmap->cmap, charcode );\r\n    }\r\n\r\n    if ( nondefOff != 0 )\r\n      return tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,\r\n                                               charcode );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Int )\r\n  tt_cmap14_char_var_isdefault( TT_CMap    cmap,\r\n                                FT_UInt32  charcode,\r\n                                FT_UInt32  variantSelector )\r\n  {\r\n    FT_Byte*  p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );\r\n    FT_ULong  defOff;\r\n    FT_ULong  nondefOff;\r\n\r\n\r\n    if ( !p )\r\n      return -1;\r\n\r\n    defOff    = TT_NEXT_ULONG( p );\r\n    nondefOff = TT_NEXT_ULONG( p );\r\n\r\n    if ( defOff != 0                                                    &&\r\n         tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )\r\n      return 1;\r\n\r\n    if ( nondefOff != 0                                            &&\r\n         tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,\r\n                                           charcode ) != 0         )\r\n      return 0;\r\n\r\n    return -1;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32* )\r\n  tt_cmap14_variants( TT_CMap    cmap,\r\n                      FT_Memory  memory )\r\n  {\r\n    TT_CMap14   cmap14 = (TT_CMap14)cmap;\r\n    FT_UInt32   count  = cmap14->num_selectors;\r\n    FT_Byte*    p      = cmap->data + 10;\r\n    FT_UInt32*  result;\r\n    FT_UInt32   i;\r\n\r\n\r\n    if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )\r\n      return NULL;\r\n\r\n    result = cmap14->results;\r\n    for ( i = 0; i < count; ++i )\r\n    {\r\n      result[i] = (FT_UInt32)TT_NEXT_UINT24( p );\r\n      p        += 8;\r\n    }\r\n    result[i] = 0;\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 * )\r\n  tt_cmap14_char_variants( TT_CMap    cmap,\r\n                           FT_Memory  memory,\r\n                           FT_UInt32  charCode )\r\n  {\r\n    TT_CMap14   cmap14 = (TT_CMap14)  cmap;\r\n    FT_UInt32   count  = cmap14->num_selectors;\r\n    FT_Byte*    p      = cmap->data + 10;\r\n    FT_UInt32*  q;\r\n\r\n\r\n    if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )\r\n      return NULL;\r\n\r\n    for ( q = cmap14->results; count > 0; --count )\r\n    {\r\n      FT_UInt32  varSel    = TT_NEXT_UINT24( p );\r\n      FT_ULong   defOff    = TT_NEXT_ULONG( p );\r\n      FT_ULong   nondefOff = TT_NEXT_ULONG( p );\r\n\r\n\r\n      if ( ( defOff != 0                                               &&\r\n             tt_cmap14_char_map_def_binary( cmap->data + defOff,\r\n                                            charCode )                 ) ||\r\n           ( nondefOff != 0                                            &&\r\n             tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,\r\n                                               charCode ) != 0         ) )\r\n      {\r\n        q[0] = varSel;\r\n        q++;\r\n      }\r\n    }\r\n    q[0] = 0;\r\n\r\n    return cmap14->results;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  tt_cmap14_def_char_count( FT_Byte  *p )\r\n  {\r\n    FT_UInt32  numRanges = (FT_UInt32)TT_NEXT_ULONG( p );\r\n    FT_UInt    tot       = 0;\r\n\r\n\r\n    p += 3;  /* point to the first `cnt' field */\r\n    for ( ; numRanges > 0; numRanges-- )\r\n    {\r\n      tot += 1 + p[0];\r\n      p   += 4;\r\n    }\r\n\r\n    return tot;\r\n  }\r\n\r\n\r\n  static FT_UInt32*\r\n  tt_cmap14_get_def_chars( TT_CMap    cmap,\r\n                           FT_Byte*   p,\r\n                           FT_Memory  memory )\r\n  {\r\n    TT_CMap14   cmap14 = (TT_CMap14) cmap;\r\n    FT_UInt32   numRanges;\r\n    FT_UInt     cnt;\r\n    FT_UInt32*  q;\r\n\r\n\r\n    cnt       = tt_cmap14_def_char_count( p );\r\n    numRanges = (FT_UInt32)TT_NEXT_ULONG( p );\r\n\r\n    if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) )\r\n      return NULL;\r\n\r\n    for ( q = cmap14->results; numRanges > 0; --numRanges )\r\n    {\r\n      FT_UInt32  uni = (FT_UInt32)TT_NEXT_UINT24( p );\r\n\r\n\r\n      cnt = FT_NEXT_BYTE( p ) + 1;\r\n      do\r\n      {\r\n        q[0]  = uni;\r\n        uni  += 1;\r\n        q    += 1;\r\n\r\n      } while ( --cnt != 0 );\r\n    }\r\n    q[0] = 0;\r\n\r\n    return cmap14->results;\r\n  }\r\n\r\n\r\n  static FT_UInt32*\r\n  tt_cmap14_get_nondef_chars( TT_CMap     cmap,\r\n                              FT_Byte    *p,\r\n                              FT_Memory   memory )\r\n  {\r\n    TT_CMap14   cmap14 = (TT_CMap14) cmap;\r\n    FT_UInt32   numMappings;\r\n    FT_UInt     i;\r\n    FT_UInt32  *ret;\r\n\r\n\r\n    numMappings = (FT_UInt32)TT_NEXT_ULONG( p );\r\n\r\n    if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) )\r\n      return NULL;\r\n\r\n    ret = cmap14->results;\r\n    for ( i = 0; i < numMappings; ++i )\r\n    {\r\n      ret[i] = (FT_UInt32)TT_NEXT_UINT24( p );\r\n      p += 2;\r\n    }\r\n    ret[i] = 0;\r\n\r\n    return ret;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_UInt32 * )\r\n  tt_cmap14_variant_chars( TT_CMap    cmap,\r\n                           FT_Memory  memory,\r\n                           FT_UInt32  variantSelector )\r\n  {\r\n    FT_Byte    *p  = tt_cmap14_find_variant( cmap->data + 6,\r\n                                             variantSelector );\r\n    FT_UInt32  *ret;\r\n    FT_Int      i;\r\n    FT_ULong    defOff;\r\n    FT_ULong    nondefOff;\r\n\r\n\r\n    if ( !p )\r\n      return NULL;\r\n\r\n    defOff    = TT_NEXT_ULONG( p );\r\n    nondefOff = TT_NEXT_ULONG( p );\r\n\r\n    if ( defOff == 0 && nondefOff == 0 )\r\n      return NULL;\r\n\r\n    if ( defOff == 0 )\r\n      return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,\r\n                                         memory );\r\n    else if ( nondefOff == 0 )\r\n      return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,\r\n                                      memory );\r\n    else\r\n    {\r\n      /* Both a default and a non-default glyph set?  That's probably not */\r\n      /* good font design, but the spec allows for it...                  */\r\n      TT_CMap14  cmap14 = (TT_CMap14) cmap;\r\n      FT_UInt32  numRanges;\r\n      FT_UInt32  numMappings;\r\n      FT_UInt32  duni;\r\n      FT_UInt32  dcnt;\r\n      FT_UInt32  nuni;\r\n      FT_Byte*   dp;\r\n      FT_UInt    di, ni, k;\r\n\r\n\r\n      p  = cmap->data + nondefOff;\r\n      dp = cmap->data + defOff;\r\n\r\n      numMappings = (FT_UInt32)TT_NEXT_ULONG( p );\r\n      dcnt        = tt_cmap14_def_char_count( dp );\r\n      numRanges   = (FT_UInt32)TT_NEXT_ULONG( dp );\r\n\r\n      if ( numMappings == 0 )\r\n        return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,\r\n                                        memory );\r\n      if ( dcnt == 0 )\r\n        return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,\r\n                                           memory );\r\n\r\n      if ( tt_cmap14_ensure( cmap14, ( dcnt + numMappings + 1 ), memory ) )\r\n        return NULL;\r\n\r\n      ret  = cmap14->results;\r\n      duni = (FT_UInt32)TT_NEXT_UINT24( dp );\r\n      dcnt = FT_NEXT_BYTE( dp );\r\n      di   = 1;\r\n      nuni = (FT_UInt32)TT_NEXT_UINT24( p );\r\n      p   += 2;\r\n      ni   = 1;\r\n      i    = 0;\r\n\r\n      for ( ;; )\r\n      {\r\n        if ( nuni > duni + dcnt )\r\n        {\r\n          for ( k = 0; k <= dcnt; ++k )\r\n            ret[i++] = duni + k;\r\n\r\n          ++di;\r\n\r\n          if ( di > numRanges )\r\n            break;\r\n\r\n          duni = (FT_UInt32)TT_NEXT_UINT24( dp );\r\n          dcnt = FT_NEXT_BYTE( dp );\r\n        }\r\n        else\r\n        {\r\n          if ( nuni < duni )\r\n            ret[i++] = nuni;\r\n          /* If it is within the default range then ignore it -- */\r\n          /* that should not have happened                       */\r\n          ++ni;\r\n          if ( ni > numMappings )\r\n            break;\r\n\r\n          nuni = (FT_UInt32)TT_NEXT_UINT24( p );\r\n          p += 2;\r\n        }\r\n      }\r\n\r\n      if ( ni <= numMappings )\r\n      {\r\n        /* If we get here then we have run out of all default ranges.   */\r\n        /* We have read one non-default mapping which we haven't stored */\r\n        /* and there may be others that need to be read.                */\r\n        ret[i++] = nuni;\r\n        while ( ni < numMappings )\r\n        {\r\n          ret[i++] = (FT_UInt32)TT_NEXT_UINT24( p );\r\n          p += 2;\r\n          ++ni;\r\n        }\r\n      }\r\n      else if ( di <= numRanges )\r\n      {\r\n        /* If we get here then we have run out of all non-default     */\r\n        /* mappings.  We have read one default range which we haven't */\r\n        /* stored and there may be others that need to be read.       */\r\n        for ( k = 0; k <= dcnt; ++k )\r\n          ret[i++] = duni + k;\r\n\r\n        while ( di < numRanges )\r\n        {\r\n          duni = (FT_UInt32)TT_NEXT_UINT24( dp );\r\n          dcnt = FT_NEXT_BYTE( dp );\r\n\r\n          for ( k = 0; k <= dcnt; ++k )\r\n            ret[i++] = duni + k;\r\n          ++di;\r\n        }\r\n      }\r\n\r\n      ret[i] = 0;\r\n\r\n      return ret;\r\n    }\r\n  }\r\n\r\n\r\n  FT_DEFINE_TT_CMAP(\r\n    tt_cmap14_class_rec,\r\n    sizeof ( TT_CMap14Rec ),\r\n\r\n    (FT_CMap_InitFunc)     tt_cmap14_init,\r\n    (FT_CMap_DoneFunc)     tt_cmap14_done,\r\n    (FT_CMap_CharIndexFunc)tt_cmap14_char_index,\r\n    (FT_CMap_CharNextFunc) tt_cmap14_char_next,\r\n\r\n    /* Format 14 extension functions */\r\n    (FT_CMap_CharVarIndexFunc)    tt_cmap14_char_var_index,\r\n    (FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault,\r\n    (FT_CMap_VariantListFunc)     tt_cmap14_variants,\r\n    (FT_CMap_CharVariantListFunc) tt_cmap14_char_variants,\r\n    (FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars,\r\n\r\n    14,\r\n    (TT_CMap_ValidateFunc)tt_cmap14_validate,\r\n    (TT_CMap_Info_GetFunc)tt_cmap14_get_info )\r\n\r\n#endif /* TT_CONFIG_CMAP_FORMAT_14 */\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n  static const TT_CMap_Class  tt_cmap_classes[] =\r\n  {\r\n#define TTCMAPCITEM( a )  &a,\r\n#include \"ttcmapc.h\"\r\n    NULL,\r\n  };\r\n\r\n#else /*FT_CONFIG_OPTION_PIC*/\r\n\r\n  void\r\n  FT_Destroy_Class_tt_cmap_classes( FT_Library      library,\r\n                                    TT_CMap_Class*  clazz )\r\n  {\r\n    FT_Memory  memory = library->memory;\r\n\r\n\r\n    if ( clazz )\r\n      FT_FREE( clazz );\r\n  }\r\n\r\n\r\n  FT_Error\r\n  FT_Create_Class_tt_cmap_classes( FT_Library       library,\r\n                                   TT_CMap_Class**  output_class )\r\n  {\r\n    TT_CMap_Class*     clazz  = NULL;\r\n    TT_CMap_ClassRec*  recs;\r\n    FT_Error           error;\r\n    FT_Memory          memory = library->memory;\r\n\r\n    int  i = 0;\r\n\r\n\r\n#define TTCMAPCITEM( a ) i++;\r\n#include \"ttcmapc.h\"\r\n\r\n    /* allocate enough space for both the pointers */\r\n    /* plus terminator and the class instances     */\r\n    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * ( i + 1 ) +\r\n                          sizeof ( TT_CMap_ClassRec ) * i ) )\r\n      return error;\r\n\r\n    /* the location of the class instances follows the array of pointers */\r\n    recs = (TT_CMap_ClassRec*)( (char*)clazz +\r\n                                sizeof ( *clazz ) * ( i + 1 ) );\r\n    i    = 0;\r\n\r\n#undef TTCMAPCITEM\r\n#define  TTCMAPCITEM( a )             \\\r\n    FT_Init_Class_ ## a( &recs[i] );  \\\r\n    clazz[i] = &recs[i];              \\\r\n    i++;\r\n#include \"ttcmapc.h\"\r\n\r\n    clazz[i] = NULL;\r\n\r\n    *output_class = clazz;\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n#endif /*FT_CONFIG_OPTION_PIC*/\r\n\r\n\r\n  /* parse the `cmap' table and build the corresponding TT_CMap objects */\r\n  /* in the current face                                                */\r\n  /*                                                                    */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_build_cmaps( TT_Face  face )\r\n  {\r\n    FT_Byte*           table = face->cmap_table;\r\n    FT_Byte*           limit = table + face->cmap_size;\r\n    FT_UInt volatile   num_cmaps;\r\n    FT_Byte* volatile  p     = table;\r\n    FT_Library         library = FT_FACE_LIBRARY( face );\r\n\r\n    FT_UNUSED( library );\r\n\r\n\r\n    if ( !p || p + 4 > limit )\r\n      return SFNT_Err_Invalid_Table;\r\n\r\n    /* only recognize format 0 */\r\n    if ( TT_NEXT_USHORT( p ) != 0 )\r\n    {\r\n      p -= 2;\r\n      FT_ERROR(( \"tt_face_build_cmaps:\"\r\n                 \" unsupported `cmap' table format = %d\\n\",\r\n                 TT_PEEK_USHORT( p ) ));\r\n      return SFNT_Err_Invalid_Table;\r\n    }\r\n\r\n    num_cmaps = TT_NEXT_USHORT( p );\r\n\r\n#ifdef FT_MAX_CHARMAP_CACHEABLE\r\n    if ( num_cmaps > FT_MAX_CHARMAP_CACHEABLE )\r\n      FT_ERROR(( \"tt_face_build_cmaps: too many cmap subtables (%d)\\n\"\r\n                 \"                     subtable #%d and higher are loaded\"\r\n                 \"                     but cannot be searched\\n\",\r\n                 num_cmaps, FT_MAX_CHARMAP_CACHEABLE + 1 ));\r\n#endif\r\n\r\n    for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )\r\n    {\r\n      FT_CharMapRec  charmap;\r\n      FT_UInt32      offset;\r\n\r\n\r\n      charmap.platform_id = TT_NEXT_USHORT( p );\r\n      charmap.encoding_id = TT_NEXT_USHORT( p );\r\n      charmap.face        = FT_FACE( face );\r\n      charmap.encoding    = FT_ENCODING_NONE;  /* will be filled later */\r\n      offset              = TT_NEXT_ULONG( p );\r\n\r\n      if ( offset && offset <= face->cmap_size - 2 )\r\n      {\r\n        FT_Byte* volatile              cmap   = table + offset;\r\n        volatile FT_UInt               format = TT_PEEK_USHORT( cmap );\r\n        const TT_CMap_Class* volatile  pclazz = TT_CMAP_CLASSES_GET;\r\n        TT_CMap_Class volatile         clazz;\r\n\r\n\r\n        for ( ; *pclazz; pclazz++ )\r\n        {\r\n          clazz = *pclazz;\r\n          if ( clazz->format == format )\r\n          {\r\n            volatile TT_ValidatorRec  valid;\r\n            volatile FT_Error         error = SFNT_Err_Ok;\r\n\r\n\r\n            ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,\r\n                               FT_VALIDATE_DEFAULT );\r\n\r\n            valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;\r\n\r\n            if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer) == 0 )\r\n            {\r\n              /* validate this cmap sub-table */\r\n              error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );\r\n            }\r\n\r\n            if ( valid.validator.error == 0 )\r\n            {\r\n              FT_CMap  ttcmap;\r\n\r\n\r\n              /* It might make sense to store the single variation         */\r\n              /* selector cmap somewhere special.  But it would have to be */\r\n              /* in the public FT_FaceRec, and we can't change that.       */\r\n\r\n              if ( !FT_CMap_New( (FT_CMap_Class)clazz,\r\n                                 cmap, &charmap, &ttcmap ) )\r\n              {\r\n                /* it is simpler to directly set `flags' than adding */\r\n                /* a parameter to FT_CMap_New                        */\r\n                ((TT_CMap)ttcmap)->flags = (FT_Int)error;\r\n              }\r\n            }\r\n            else\r\n            {\r\n              FT_TRACE0(( \"tt_face_build_cmaps:\"\r\n                          \" broken cmap sub-table ignored\\n\" ));\r\n            }\r\n            break;\r\n          }\r\n        }\r\n\r\n        if ( *pclazz == NULL )\r\n        {\r\n          FT_TRACE0(( \"tt_face_build_cmaps:\"\r\n                      \" unsupported cmap sub-table ignored\\n\" ));\r\n        }\r\n      }\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_get_cmap_info( FT_CharMap    charmap,\r\n                    TT_CMapInfo  *cmap_info )\r\n  {\r\n    FT_CMap        cmap  = (FT_CMap)charmap;\r\n    TT_CMap_Class  clazz = (TT_CMap_Class)cmap->clazz;\r\n\r\n\r\n    return clazz->get_cmap_info( charmap, cmap_info );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttcmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttcmap.h                                                               */\r\n/*                                                                         */\r\n/*    TrueType character mapping table (cmap) support (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2002-2005, 2009, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTCMAP_H__\r\n#define __TTCMAP_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n#include FT_INTERNAL_VALIDATE_H\r\n#include FT_SERVICE_TT_CMAP_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define TT_CMAP_FLAG_UNSORTED     1\r\n#define TT_CMAP_FLAG_OVERLAPPING  2\r\n\r\n  typedef struct  TT_CMapRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_Byte*    data;           /* pointer to in-memory cmap table */\r\n    FT_Int      flags;          /* for format 4 only               */\r\n\r\n  } TT_CMapRec, *TT_CMap;\r\n\r\n  typedef const struct TT_CMap_ClassRec_*  TT_CMap_Class;\r\n\r\n\r\n  typedef FT_Error\r\n  (*TT_CMap_ValidateFunc)( FT_Byte*      data,\r\n                           FT_Validator  valid );\r\n\r\n  typedef struct  TT_CMap_ClassRec_\r\n  {\r\n    FT_CMap_ClassRec      clazz;\r\n    FT_UInt               format;\r\n    TT_CMap_ValidateFunc  validate;\r\n    TT_CMap_Info_GetFunc  get_cmap_info;\r\n\r\n  } TT_CMap_ClassRec;\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_TT_CMAP( class_,             \\\r\n                           size_,              \\\r\n                           init_,              \\\r\n                           done_,              \\\r\n                           char_index_,        \\\r\n                           char_next_,         \\\r\n                           char_var_index_,    \\\r\n                           char_var_default_,  \\\r\n                           variant_list_,      \\\r\n                           charvariant_list_,  \\\r\n                           variantchar_list_,  \\\r\n                           format_,            \\\r\n                           validate_,          \\\r\n                           get_cmap_info_ )    \\\r\n  FT_CALLBACK_TABLE_DEF                        \\\r\n  const TT_CMap_ClassRec  class_ =             \\\r\n  {                                            \\\r\n    { size_,                                   \\\r\n      init_,                                   \\\r\n      done_,                                   \\\r\n      char_index_,                             \\\r\n      char_next_,                              \\\r\n      char_var_index_,                         \\\r\n      char_var_default_,                       \\\r\n      variant_list_,                           \\\r\n      charvariant_list_,                       \\\r\n      variantchar_list_                        \\\r\n    },                                         \\\r\n                                               \\\r\n    format_,                                   \\\r\n    validate_,                                 \\\r\n    get_cmap_info_                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DEFINE_TT_CMAP( class_,                      \\\r\n                           size_,                       \\\r\n                           init_,                       \\\r\n                           done_,                       \\\r\n                           char_index_,                 \\\r\n                           char_next_,                  \\\r\n                           char_var_index_,             \\\r\n                           char_var_default_,           \\\r\n                           variant_list_,               \\\r\n                           charvariant_list_,           \\\r\n                           variantchar_list_,           \\\r\n                           format_,                     \\\r\n                           validate_,                   \\\r\n                           get_cmap_info_ )             \\\r\n  void                                                  \\\r\n  FT_Init_Class_ ## class_( TT_CMap_ClassRec*  clazz )  \\\r\n  {                                                     \\\r\n    clazz->clazz.size             = size_;              \\\r\n    clazz->clazz.init             = init_;              \\\r\n    clazz->clazz.done             = done_;              \\\r\n    clazz->clazz.char_index       = char_index_;        \\\r\n    clazz->clazz.char_next        = char_next_;         \\\r\n    clazz->clazz.char_var_index   = char_var_index_;    \\\r\n    clazz->clazz.char_var_default = char_var_default_;  \\\r\n    clazz->clazz.variant_list     = variant_list_;      \\\r\n    clazz->clazz.charvariant_list = charvariant_list_;  \\\r\n    clazz->clazz.variantchar_list = variantchar_list_;  \\\r\n    clazz->format                 = format_;            \\\r\n    clazz->validate               = validate_;          \\\r\n    clazz->get_cmap_info          = get_cmap_info_;     \\\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  typedef struct  TT_ValidatorRec_\r\n  {\r\n    FT_ValidatorRec  validator;\r\n    FT_UInt          num_glyphs;\r\n\r\n  } TT_ValidatorRec, *TT_Validator;\r\n\r\n\r\n#define TT_VALIDATOR( x )          ( (TT_Validator)( x ) )\r\n#define TT_VALID_GLYPH_COUNT( x )  TT_VALIDATOR( x )->num_glyphs\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_build_cmaps( TT_Face  face );\r\n\r\n  /* used in tt-cmaps service */\r\n  FT_LOCAL( FT_Error )\r\n  tt_get_cmap_info( FT_CharMap    charmap,\r\n                    TT_CMapInfo  *cmap_info );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttcmapc.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttcmapc.h                                                              */\r\n/*                                                                         */\r\n/*    TT CMAP classes definitions (specification only).                    */\r\n/*                                                                         */\r\n/*  Copyright 2009 by                                                      */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_0\r\n  TTCMAPCITEM( tt_cmap0_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_2\r\n  TTCMAPCITEM( tt_cmap2_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_4\r\n  TTCMAPCITEM( tt_cmap4_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_6\r\n  TTCMAPCITEM( tt_cmap6_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_8\r\n  TTCMAPCITEM( tt_cmap8_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_10\r\n  TTCMAPCITEM( tt_cmap10_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_12\r\n  TTCMAPCITEM( tt_cmap12_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_13\r\n  TTCMAPCITEM( tt_cmap13_class_rec )\r\n#endif\r\n\r\n#ifdef TT_CONFIG_CMAP_FORMAT_14\r\n  TTCMAPCITEM( tt_cmap14_class_rec )\r\n#endif\r\n\r\n\r\n  /* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttkern.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttkern.c                                                               */\r\n/*                                                                         */\r\n/*    Load the basic TrueType kerning table.  This doesn't handle          */\r\n/*    kerning data within the GPOS table at the moment.                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttkern.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttkern\r\n\r\n\r\n#undef  TT_KERN_INDEX\r\n#define TT_KERN_INDEX( g1, g2 )  ( ( (FT_ULong)(g1) << 16 ) | (g2) )\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_kern( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error   error;\r\n    FT_ULong   table_size;\r\n    FT_Byte*   p;\r\n    FT_Byte*   p_limit;\r\n    FT_UInt    nn, num_tables;\r\n    FT_UInt32  avail = 0, ordered = 0;\r\n\r\n\r\n    /* the kern table is optional; exit silently if it is missing */\r\n    error = face->goto_table( face, TTAG_kern, stream, &table_size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( table_size < 4 )  /* the case of a malformed table */\r\n    {\r\n      FT_ERROR(( \"tt_face_load_kern:\"\r\n                 \" kerning table is too small - ignored\\n\" ));\r\n      error = SFNT_Err_Table_Missing;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( FT_FRAME_EXTRACT( table_size, face->kern_table ) )\r\n    {\r\n      FT_ERROR(( \"tt_face_load_kern:\"\r\n                 \" could not extract kerning table\\n\" ));\r\n      goto Exit;\r\n    }\r\n\r\n    face->kern_table_size = table_size;\r\n\r\n    p       = face->kern_table;\r\n    p_limit = p + table_size;\r\n\r\n    p         += 2; /* skip version */\r\n    num_tables = FT_NEXT_USHORT( p );\r\n\r\n    if ( num_tables > 32 ) /* we only support up to 32 sub-tables */\r\n      num_tables = 32;\r\n\r\n    for ( nn = 0; nn < num_tables; nn++ )\r\n    {\r\n      FT_UInt    num_pairs, length, coverage;\r\n      FT_Byte*   p_next;\r\n      FT_UInt32  mask = (FT_UInt32)1UL << nn;\r\n\r\n\r\n      if ( p + 6 > p_limit )\r\n        break;\r\n\r\n      p_next = p;\r\n\r\n      p += 2; /* skip version */\r\n      length   = FT_NEXT_USHORT( p );\r\n      coverage = FT_NEXT_USHORT( p );\r\n\r\n      if ( length <= 6 )\r\n        break;\r\n\r\n      p_next += length;\r\n\r\n      if ( p_next > p_limit )  /* handle broken table */\r\n        p_next = p_limit;\r\n\r\n      /* only use horizontal kerning tables */\r\n      if ( ( coverage & ~8 ) != 0x0001 ||\r\n           p + 8 > p_limit             )\r\n        goto NextTable;\r\n\r\n      num_pairs = FT_NEXT_USHORT( p );\r\n      p        += 6;\r\n\r\n      if ( ( p_next - p ) < 6 * (int)num_pairs ) /* handle broken count */\r\n        num_pairs = (FT_UInt)( ( p_next - p ) / 6 );\r\n\r\n      avail |= mask;\r\n\r\n      /*\r\n       *  Now check whether the pairs in this table are ordered.\r\n       *  We then can use binary search.\r\n       */\r\n      if ( num_pairs > 0 )\r\n      {\r\n        FT_ULong  count;\r\n        FT_ULong  old_pair;\r\n\r\n\r\n        old_pair = FT_NEXT_ULONG( p );\r\n        p       += 2;\r\n\r\n        for ( count = num_pairs - 1; count > 0; count-- )\r\n        {\r\n          FT_UInt32  cur_pair;\r\n\r\n\r\n          cur_pair = FT_NEXT_ULONG( p );\r\n          if ( cur_pair <= old_pair )\r\n            break;\r\n\r\n          p += 2;\r\n          old_pair = cur_pair;\r\n        }\r\n\r\n        if ( count == 0 )\r\n          ordered |= mask;\r\n      }\r\n\r\n    NextTable:\r\n      p = p_next;\r\n    }\r\n\r\n    face->num_kern_tables = nn;\r\n    face->kern_avail_bits = avail;\r\n    face->kern_order_bits = ordered;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_done_kern( TT_Face  face )\r\n  {\r\n    FT_Stream  stream = face->root.stream;\r\n\r\n\r\n    FT_FRAME_RELEASE( face->kern_table );\r\n    face->kern_table_size = 0;\r\n    face->num_kern_tables = 0;\r\n    face->kern_avail_bits = 0;\r\n    face->kern_order_bits = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Int )\r\n  tt_face_get_kerning( TT_Face  face,\r\n                       FT_UInt  left_glyph,\r\n                       FT_UInt  right_glyph )\r\n  {\r\n    FT_Int    result = 0;\r\n    FT_UInt   count, mask = 1;\r\n    FT_Byte*  p       = face->kern_table;\r\n    FT_Byte*  p_limit = p + face->kern_table_size;\r\n\r\n\r\n    p   += 4;\r\n    mask = 0x0001;\r\n\r\n    for ( count = face->num_kern_tables;\r\n          count > 0 && p + 6 <= p_limit;\r\n          count--, mask <<= 1 )\r\n    {\r\n      FT_Byte* base     = p;\r\n      FT_Byte* next     = base;\r\n      FT_UInt  version  = FT_NEXT_USHORT( p );\r\n      FT_UInt  length   = FT_NEXT_USHORT( p );\r\n      FT_UInt  coverage = FT_NEXT_USHORT( p );\r\n      FT_UInt  num_pairs;\r\n      FT_Int   value    = 0;\r\n\r\n      FT_UNUSED( version );\r\n\r\n\r\n      next = base + length;\r\n\r\n      if ( next > p_limit )  /* handle broken table */\r\n        next = p_limit;\r\n\r\n      if ( ( face->kern_avail_bits & mask ) == 0 )\r\n        goto NextTable;\r\n\r\n      if ( p + 8 > next )\r\n        goto NextTable;\r\n\r\n      num_pairs = FT_NEXT_USHORT( p );\r\n      p        += 6;\r\n\r\n      if ( ( next - p ) < 6 * (int)num_pairs )  /* handle broken count  */\r\n        num_pairs = (FT_UInt)( ( next - p ) / 6 );\r\n\r\n      switch ( coverage >> 8 )\r\n      {\r\n      case 0:\r\n        {\r\n          FT_ULong  key0 = TT_KERN_INDEX( left_glyph, right_glyph );\r\n\r\n\r\n          if ( face->kern_order_bits & mask )   /* binary search */\r\n          {\r\n            FT_UInt   min = 0;\r\n            FT_UInt   max = num_pairs;\r\n\r\n\r\n            while ( min < max )\r\n            {\r\n              FT_UInt   mid = ( min + max ) >> 1;\r\n              FT_Byte*  q   = p + 6 * mid;\r\n              FT_ULong  key;\r\n\r\n\r\n              key = FT_NEXT_ULONG( q );\r\n\r\n              if ( key == key0 )\r\n              {\r\n                value = FT_PEEK_SHORT( q );\r\n                goto Found;\r\n              }\r\n              if ( key < key0 )\r\n                min = mid + 1;\r\n              else\r\n                max = mid;\r\n            }\r\n          }\r\n          else /* linear search */\r\n          {\r\n            FT_UInt  count2;\r\n\r\n\r\n            for ( count2 = num_pairs; count2 > 0; count2-- )\r\n            {\r\n              FT_ULong  key = FT_NEXT_ULONG( p );\r\n\r\n\r\n              if ( key == key0 )\r\n              {\r\n                value = FT_PEEK_SHORT( p );\r\n                goto Found;\r\n              }\r\n              p += 2;\r\n            }\r\n          }\r\n        }\r\n        break;\r\n\r\n       /*\r\n        *  We don't support format 2 because we haven't seen a single font\r\n        *  using it in real life...\r\n        */\r\n\r\n      default:\r\n        ;\r\n      }\r\n\r\n      goto NextTable;\r\n\r\n    Found:\r\n      if ( coverage & 8 ) /* override or add */\r\n        result = value;\r\n      else\r\n        result += value;\r\n\r\n    NextTable:\r\n      p = next;\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n#undef TT_KERN_INDEX\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttkern.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttkern.h                                                               */\r\n/*                                                                         */\r\n/*    Load the basic TrueType kerning table.  This doesn't handle          */\r\n/*    kerning data within the GPOS table at the moment.                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2005, 2007 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTKERN_H__\r\n#define __TTKERN_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error  )\r\n  tt_face_load_kern( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_done_kern( TT_Face  face );\r\n\r\n  FT_LOCAL( FT_Int )\r\n  tt_face_get_kerning( TT_Face     face,\r\n                       FT_UInt     left_glyph,\r\n                       FT_UInt     right_glyph );\r\n\r\n#define TT_FACE_HAS_KERNING( face )  ( (face)->kern_avail_bits != 0 )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTKERN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttload.c                                                               */\r\n/*                                                                         */\r\n/*    Load the basic TrueType tables, i.e., tables that can be either in   */\r\n/*    TTF or OTF fonts (body).                                             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2010, 2012 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttload.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttload\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_lookup_table                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Looks for a TrueType table by name.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A face object handle.                                      */\r\n  /*                                                                       */\r\n  /*    tag  :: The searched tag.                                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to the table directory entry.  0 if not found.           */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( TT_Table  )\r\n  tt_face_lookup_table( TT_Face   face,\r\n                        FT_ULong  tag  )\r\n  {\r\n    TT_Table  entry;\r\n    TT_Table  limit;\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    FT_Bool   zero_length = FALSE;\r\n#endif\r\n\r\n\r\n    FT_TRACE4(( \"tt_face_lookup_table: %08p, `%c%c%c%c' -- \",\r\n                face,\r\n                (FT_Char)( tag >> 24 ),\r\n                (FT_Char)( tag >> 16 ),\r\n                (FT_Char)( tag >> 8  ),\r\n                (FT_Char)( tag       ) ));\r\n\r\n    entry = face->dir_tables;\r\n    limit = entry + face->num_tables;\r\n\r\n    for ( ; entry < limit; entry++ )\r\n    {\r\n      /* For compatibility with Windows, we consider    */\r\n      /* zero-length tables the same as missing tables. */\r\n      if ( entry->Tag == tag )\r\n      {\r\n        if ( entry->Length != 0 )\r\n        {\r\n          FT_TRACE4(( \"found table.\\n\" ));\r\n          return entry;\r\n        }\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n        zero_length = TRUE;\r\n#endif\r\n      }\r\n    }\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n    if ( zero_length )\r\n      FT_TRACE4(( \"ignoring empty table\\n\" ));\r\n    else\r\n      FT_TRACE4(( \"could not find table\\n\" ));\r\n#endif\r\n\r\n    return NULL;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_goto_table                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Looks for a TrueType table by name, then seek a stream to it.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A face object handle.                                    */\r\n  /*                                                                       */\r\n  /*    tag    :: The searched tag.                                        */\r\n  /*                                                                       */\r\n  /*    stream :: The stream to seek when the table is found.              */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    length :: The length of the table if found, undefined otherwise.   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_goto_table( TT_Face    face,\r\n                      FT_ULong   tag,\r\n                      FT_Stream  stream,\r\n                      FT_ULong*  length )\r\n  {\r\n    TT_Table  table;\r\n    FT_Error  error;\r\n\r\n\r\n    table = tt_face_lookup_table( face, tag );\r\n    if ( table )\r\n    {\r\n      if ( length )\r\n        *length = table->Length;\r\n\r\n      if ( FT_STREAM_SEEK( table->Offset ) )\r\n        goto Exit;\r\n    }\r\n    else\r\n      error = SFNT_Err_Table_Missing;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* Here, we                                                         */\r\n  /*                                                                  */\r\n  /* - check that `num_tables' is valid (and adjust it if necessary)  */\r\n  /*                                                                  */\r\n  /* - look for a `head' table, check its size, and parse it to check */\r\n  /*   whether its `magic' field is correctly set                     */\r\n  /*                                                                  */\r\n  /* - errors (except errors returned by stream handling)             */\r\n  /*                                                                  */\r\n  /*     SFNT_Err_Unknown_File_Format:                                */\r\n  /*       no table is defined in directory, it is not sfnt-wrapped   */\r\n  /*       data                                                       */\r\n  /*     SFNT_Err_Table_Missing:                                      */\r\n  /*       table directory is valid, but essential tables             */\r\n  /*       (head/bhed/SING) are missing                               */\r\n  /*                                                                  */\r\n  static FT_Error\r\n  check_table_dir( SFNT_Header  sfnt,\r\n                   FT_Stream    stream )\r\n  {\r\n    FT_Error   error;\r\n    FT_UShort  nn, valid_entries = 0;\r\n    FT_UInt    has_head = 0, has_sing = 0, has_meta = 0;\r\n    FT_ULong   offset = sfnt->offset + 12;\r\n\r\n    static const FT_Frame_Field  table_dir_entry_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_TableRec\r\n\r\n      FT_FRAME_START( 16 ),\r\n        FT_FRAME_ULONG( Tag ),\r\n        FT_FRAME_ULONG( CheckSum ),\r\n        FT_FRAME_ULONG( Offset ),\r\n        FT_FRAME_ULONG( Length ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    if ( FT_STREAM_SEEK( offset ) )\r\n      goto Exit;\r\n\r\n    for ( nn = 0; nn < sfnt->num_tables; nn++ )\r\n    {\r\n      TT_TableRec  table;\r\n\r\n\r\n      if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )\r\n      {\r\n        nn--;\r\n        FT_TRACE2(( \"check_table_dir:\"\r\n                    \" can read only %d table%s in font (instead of %d)\\n\",\r\n                    nn, nn == 1 ? \"\" : \"s\", sfnt->num_tables ));\r\n        sfnt->num_tables = nn;\r\n        break;\r\n      }\r\n\r\n      /* we ignore invalid tables */\r\n      if ( table.Offset + table.Length > stream->size )\r\n      {\r\n        FT_TRACE2(( \"check_table_dir: table entry %d invalid\\n\", nn ));\r\n        continue;\r\n      }\r\n      else\r\n        valid_entries++;\r\n\r\n      if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )\r\n      {\r\n        FT_UInt32  magic;\r\n\r\n\r\n#ifndef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n        if ( table.Tag == TTAG_head )\r\n#endif\r\n          has_head = 1;\r\n\r\n        /*\r\n         * The table length should be 0x36, but certain font tools make it\r\n         * 0x38, so we will just check that it is greater.\r\n         *\r\n         * Note that according to the specification, the table must be\r\n         * padded to 32-bit lengths, but this doesn't apply to the value of\r\n         * its `Length' field!\r\n         *\r\n         */\r\n        if ( table.Length < 0x36 )\r\n        {\r\n          FT_TRACE2(( \"check_table_dir: `head' table too small\\n\" ));\r\n          error = SFNT_Err_Table_Missing;\r\n          goto Exit;\r\n        }\r\n\r\n        if ( FT_STREAM_SEEK( table.Offset + 12 ) ||\r\n             FT_READ_ULONG( magic )              )\r\n          goto Exit;\r\n\r\n        if ( magic != 0x5F0F3CF5UL )\r\n        {\r\n          FT_TRACE2(( \"check_table_dir:\"\r\n                      \" no magic number found in `head' table\\n\"));\r\n          error = SFNT_Err_Table_Missing;\r\n          goto Exit;\r\n        }\r\n\r\n        if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )\r\n          goto Exit;\r\n      }\r\n      else if ( table.Tag == TTAG_SING )\r\n        has_sing = 1;\r\n      else if ( table.Tag == TTAG_META )\r\n        has_meta = 1;\r\n    }\r\n\r\n    sfnt->num_tables = valid_entries;\r\n\r\n    if ( sfnt->num_tables == 0 )\r\n    {\r\n      FT_TRACE2(( \"check_table_dir: no tables found\\n\" ));\r\n      error = SFNT_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* if `sing' and `meta' tables are present, there is no `head' table */\r\n    if ( has_head || ( has_sing && has_meta ) )\r\n    {\r\n      error = SFNT_Err_Ok;\r\n      goto Exit;\r\n    }\r\n    else\r\n    {\r\n      FT_TRACE2(( \"check_table_dir:\" ));\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n      FT_TRACE2(( \" neither `head', `bhed', nor `sing' table found\\n\" ));\r\n#else\r\n      FT_TRACE2(( \" neither `head' nor `sing' table found\\n\" ));\r\n#endif\r\n      error = SFNT_Err_Table_Missing;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_font_dir                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the header of a SFNT font file.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sfnt       :: The SFNT header.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the beginning of the font directory.  */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_font_dir( TT_Face    face,\r\n                         FT_Stream  stream )\r\n  {\r\n    SFNT_HeaderRec  sfnt;\r\n    FT_Error        error;\r\n    FT_Memory       memory = stream->memory;\r\n    TT_TableRec*    entry;\r\n    FT_Int          nn;\r\n\r\n    static const FT_Frame_Field  offset_table_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  SFNT_HeaderRec\r\n\r\n      FT_FRAME_START( 8 ),\r\n        FT_FRAME_USHORT( num_tables ),\r\n        FT_FRAME_USHORT( search_range ),\r\n        FT_FRAME_USHORT( entry_selector ),\r\n        FT_FRAME_USHORT( range_shift ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    FT_TRACE2(( \"tt_face_load_font_dir: %08p\\n\", face ));\r\n\r\n    /* read the offset table */\r\n\r\n    sfnt.offset = FT_STREAM_POS();\r\n\r\n    if ( FT_READ_ULONG( sfnt.format_tag )                    ||\r\n         FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )\r\n      goto Exit;\r\n\r\n    /* many fonts don't have these fields set correctly */\r\n#if 0\r\n    if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 )        ||\r\n         sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 )\r\n      return SFNT_Err_Unknown_File_Format;\r\n#endif\r\n\r\n    /* load the table directory */\r\n\r\n    FT_TRACE2(( \"-- Number of tables: %10u\\n\",    sfnt.num_tables ));\r\n    FT_TRACE2(( \"-- Format version:   0x%08lx\\n\", sfnt.format_tag ));\r\n\r\n    if ( sfnt.format_tag != TTAG_OTTO )\r\n    {\r\n      /* check first */\r\n      error = check_table_dir( &sfnt, stream );\r\n      if ( error )\r\n      {\r\n        FT_TRACE2(( \"tt_face_load_font_dir:\"\r\n                    \" invalid table directory for TrueType\\n\" ));\r\n\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    face->num_tables = sfnt.num_tables;\r\n    face->format_tag = sfnt.format_tag;\r\n\r\n    if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )\r\n      goto Exit;\r\n\r\n    if ( FT_STREAM_SEEK( sfnt.offset + 12 )       ||\r\n         FT_FRAME_ENTER( face->num_tables * 16L ) )\r\n      goto Exit;\r\n\r\n    entry = face->dir_tables;\r\n\r\n    FT_TRACE2(( \"\\n\"\r\n                \"  tag    offset    length   checksum\\n\"\r\n                \"  ----------------------------------\\n\" ));\r\n\r\n    for ( nn = 0; nn < sfnt.num_tables; nn++ )\r\n    {\r\n      entry->Tag      = FT_GET_TAG4();\r\n      entry->CheckSum = FT_GET_ULONG();\r\n      entry->Offset   = FT_GET_LONG();\r\n      entry->Length   = FT_GET_LONG();\r\n\r\n      /* ignore invalid tables */\r\n      if ( entry->Offset + entry->Length > stream->size )\r\n        continue;\r\n      else\r\n      {\r\n        FT_TRACE2(( \"  %c%c%c%c  %08lx  %08lx  %08lx\\n\",\r\n                    (FT_Char)( entry->Tag >> 24 ),\r\n                    (FT_Char)( entry->Tag >> 16 ),\r\n                    (FT_Char)( entry->Tag >> 8  ),\r\n                    (FT_Char)( entry->Tag       ),\r\n                    entry->Offset,\r\n                    entry->Length,\r\n                    entry->CheckSum ));\r\n        entry++;\r\n      }\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    FT_TRACE2(( \"table directory loaded\\n\\n\" ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_any                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads any font table into client memory.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: The face object to look for.                             */\r\n  /*                                                                       */\r\n  /*    tag    :: The tag of table to load.  Use the value 0 if you want   */\r\n  /*              to access the whole font file, else set this parameter   */\r\n  /*              to a valid TrueType table tag that you can forge with    */\r\n  /*              the MAKE_TT_TAG macro.                                   */\r\n  /*                                                                       */\r\n  /*    offset :: The starting offset in the table (or the file if         */\r\n  /*              tag == 0).                                               */\r\n  /*                                                                       */\r\n  /*    length :: The address of the decision variable:                    */\r\n  /*                                                                       */\r\n  /*                If length == NULL:                                     */\r\n  /*                  Loads the whole table.  Returns an error if          */\r\n  /*                  `offset' == 0!                                       */\r\n  /*                                                                       */\r\n  /*                If *length == 0:                                       */\r\n  /*                  Exits immediately; returning the length of the given */\r\n  /*                  table or of the font file, depending on the value of */\r\n  /*                  `tag'.                                               */\r\n  /*                                                                       */\r\n  /*                If *length != 0:                                       */\r\n  /*                  Loads the next `length' bytes of table or font,      */\r\n  /*                  starting at offset `offset' (in table or font too).  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    buffer :: The address of target buffer.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_any( TT_Face    face,\r\n                    FT_ULong   tag,\r\n                    FT_Long    offset,\r\n                    FT_Byte*   buffer,\r\n                    FT_ULong*  length )\r\n  {\r\n    FT_Error   error;\r\n    FT_Stream  stream;\r\n    TT_Table   table;\r\n    FT_ULong   size;\r\n\r\n\r\n    if ( tag != 0 )\r\n    {\r\n      /* look for tag in font directory */\r\n      table = tt_face_lookup_table( face, tag );\r\n      if ( !table )\r\n      {\r\n        error = SFNT_Err_Table_Missing;\r\n        goto Exit;\r\n      }\r\n\r\n      offset += table->Offset;\r\n      size    = table->Length;\r\n    }\r\n    else\r\n      /* tag == 0 -- the user wants to access the font file directly */\r\n      size = face->root.stream->size;\r\n\r\n    if ( length && *length == 0 )\r\n    {\r\n      *length = size;\r\n\r\n      return SFNT_Err_Ok;\r\n    }\r\n\r\n    if ( length )\r\n      size = *length;\r\n\r\n    stream = face->root.stream;\r\n    /* the `if' is syntactic sugar for picky compilers */\r\n    if ( FT_STREAM_READ_AT( offset, buffer, size ) )\r\n      goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_generic_header                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the TrueType table `head' or `bhed'.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  tt_face_load_generic_header( TT_Face    face,\r\n                               FT_Stream  stream,\r\n                               FT_ULong   tag )\r\n  {\r\n    FT_Error    error;\r\n    TT_Header*  header;\r\n\r\n    static const FT_Frame_Field  header_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_Header\r\n\r\n      FT_FRAME_START( 54 ),\r\n        FT_FRAME_ULONG ( Table_Version ),\r\n        FT_FRAME_ULONG ( Font_Revision ),\r\n        FT_FRAME_LONG  ( CheckSum_Adjust ),\r\n        FT_FRAME_LONG  ( Magic_Number ),\r\n        FT_FRAME_USHORT( Flags ),\r\n        FT_FRAME_USHORT( Units_Per_EM ),\r\n        FT_FRAME_LONG  ( Created[0] ),\r\n        FT_FRAME_LONG  ( Created[1] ),\r\n        FT_FRAME_LONG  ( Modified[0] ),\r\n        FT_FRAME_LONG  ( Modified[1] ),\r\n        FT_FRAME_SHORT ( xMin ),\r\n        FT_FRAME_SHORT ( yMin ),\r\n        FT_FRAME_SHORT ( xMax ),\r\n        FT_FRAME_SHORT ( yMax ),\r\n        FT_FRAME_USHORT( Mac_Style ),\r\n        FT_FRAME_USHORT( Lowest_Rec_PPEM ),\r\n        FT_FRAME_SHORT ( Font_Direction ),\r\n        FT_FRAME_SHORT ( Index_To_Loc_Format ),\r\n        FT_FRAME_SHORT ( Glyph_Data_Format ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    error = face->goto_table( face, tag, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    header = &face->header;\r\n\r\n    if ( FT_STREAM_READ_FIELDS( header_fields, header ) )\r\n      goto Exit;\r\n\r\n    FT_TRACE3(( \"Units per EM: %4u\\n\", header->Units_Per_EM ));\r\n    FT_TRACE3(( \"IndexToLoc:   %4d\\n\", header->Index_To_Loc_Format ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_head( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    return tt_face_load_generic_header( face, stream, TTAG_head );\r\n  }\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_bhed( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    return tt_face_load_generic_header( face, stream, TTAG_bhed );\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_max_profile                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the maximum profile into a face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_maxp( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error        error;\r\n    TT_MaxProfile*  maxProfile = &face->max_profile;\r\n\r\n    static const FT_Frame_Field  maxp_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_MaxProfile\r\n\r\n      FT_FRAME_START( 6 ),\r\n        FT_FRAME_LONG  ( version ),\r\n        FT_FRAME_USHORT( numGlyphs ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  maxp_fields_extra[] =\r\n    {\r\n      FT_FRAME_START( 26 ),\r\n        FT_FRAME_USHORT( maxPoints ),\r\n        FT_FRAME_USHORT( maxContours ),\r\n        FT_FRAME_USHORT( maxCompositePoints ),\r\n        FT_FRAME_USHORT( maxCompositeContours ),\r\n        FT_FRAME_USHORT( maxZones ),\r\n        FT_FRAME_USHORT( maxTwilightPoints ),\r\n        FT_FRAME_USHORT( maxStorage ),\r\n        FT_FRAME_USHORT( maxFunctionDefs ),\r\n        FT_FRAME_USHORT( maxInstructionDefs ),\r\n        FT_FRAME_USHORT( maxStackElements ),\r\n        FT_FRAME_USHORT( maxSizeOfInstructions ),\r\n        FT_FRAME_USHORT( maxComponentElements ),\r\n        FT_FRAME_USHORT( maxComponentDepth ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    error = face->goto_table( face, TTAG_maxp, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_STREAM_READ_FIELDS( maxp_fields, maxProfile ) )\r\n      goto Exit;\r\n\r\n    maxProfile->maxPoints             = 0;\r\n    maxProfile->maxContours           = 0;\r\n    maxProfile->maxCompositePoints    = 0;\r\n    maxProfile->maxCompositeContours  = 0;\r\n    maxProfile->maxZones              = 0;\r\n    maxProfile->maxTwilightPoints     = 0;\r\n    maxProfile->maxStorage            = 0;\r\n    maxProfile->maxFunctionDefs       = 0;\r\n    maxProfile->maxInstructionDefs    = 0;\r\n    maxProfile->maxStackElements      = 0;\r\n    maxProfile->maxSizeOfInstructions = 0;\r\n    maxProfile->maxComponentElements  = 0;\r\n    maxProfile->maxComponentDepth     = 0;\r\n\r\n    if ( maxProfile->version >= 0x10000L )\r\n    {\r\n      if ( FT_STREAM_READ_FIELDS( maxp_fields_extra, maxProfile ) )\r\n        goto Exit;\r\n\r\n      /* XXX: an adjustment that is necessary to load certain */\r\n      /*      broken fonts like `Keystrokes MT' :-(           */\r\n      /*                                                      */\r\n      /*   We allocate 64 function entries by default when    */\r\n      /*   the maxFunctionDefs value is smaller.              */\r\n\r\n      if ( maxProfile->maxFunctionDefs < 64 )\r\n        maxProfile->maxFunctionDefs = 64;\r\n\r\n      /* we add 4 phantom points later */\r\n      if ( maxProfile->maxTwilightPoints > ( 0xFFFFU - 4 ) )\r\n      {\r\n        FT_TRACE0(( \"tt_face_load_maxp:\"\r\n                    \" too much twilight points in `maxp' table;\\n\"\r\n                    \"                  \"\r\n                    \" some glyphs might be rendered incorrectly\\n\" ));\r\n\r\n        maxProfile->maxTwilightPoints = 0xFFFFU - 4;\r\n      }\r\n\r\n      /* we arbitrarily limit recursion to avoid stack exhaustion */\r\n      if ( maxProfile->maxComponentDepth > 100 )\r\n      {\r\n        FT_TRACE0(( \"tt_face_load_maxp:\"\r\n                    \" abnormally large component depth (%d) set to 100\\n\",\r\n                    maxProfile->maxComponentDepth ));\r\n        maxProfile->maxComponentDepth = 100;\r\n      }\r\n    }\r\n\r\n    FT_TRACE3(( \"numGlyphs: %u\\n\", maxProfile->numGlyphs ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_name                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the name records.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_name( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error      error;\r\n    FT_Memory     memory = stream->memory;\r\n    FT_ULong      table_pos, table_len;\r\n    FT_ULong      storage_start, storage_limit;\r\n    FT_UInt       count;\r\n    TT_NameTable  table;\r\n\r\n    static const FT_Frame_Field  name_table_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_NameTableRec\r\n\r\n      FT_FRAME_START( 6 ),\r\n        FT_FRAME_USHORT( format ),\r\n        FT_FRAME_USHORT( numNameRecords ),\r\n        FT_FRAME_USHORT( storageOffset ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  name_record_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_NameEntryRec\r\n\r\n      /* no FT_FRAME_START */\r\n        FT_FRAME_USHORT( platformID ),\r\n        FT_FRAME_USHORT( encodingID ),\r\n        FT_FRAME_USHORT( languageID ),\r\n        FT_FRAME_USHORT( nameID ),\r\n        FT_FRAME_USHORT( stringLength ),\r\n        FT_FRAME_USHORT( stringOffset ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    table         = &face->name_table;\r\n    table->stream = stream;\r\n\r\n    error = face->goto_table( face, TTAG_name, stream, &table_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    table_pos = FT_STREAM_POS();\r\n\r\n\r\n    if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) )\r\n      goto Exit;\r\n\r\n    /* Some popular Asian fonts have an invalid `storageOffset' value   */\r\n    /* (it should be at least \"6 + 12*num_names\").  However, the string */\r\n    /* offsets, computed as \"storageOffset + entry->stringOffset\", are  */\r\n    /* valid pointers within the name table...                          */\r\n    /*                                                                  */\r\n    /* We thus can't check `storageOffset' right now.                   */\r\n    /*                                                                  */\r\n    storage_start = table_pos + 6 + 12*table->numNameRecords;\r\n    storage_limit = table_pos + table_len;\r\n\r\n    if ( storage_start > storage_limit )\r\n    {\r\n      FT_ERROR(( \"tt_face_load_name: invalid `name' table\\n\" ));\r\n      error = SFNT_Err_Name_Table_Missing;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Allocate the array of name records. */\r\n    count                 = table->numNameRecords;\r\n    table->numNameRecords = 0;\r\n\r\n    if ( FT_NEW_ARRAY( table->names, count ) ||\r\n         FT_FRAME_ENTER( count * 12 )        )\r\n      goto Exit;\r\n\r\n    /* Load the name records and determine how much storage is needed */\r\n    /* to hold the strings themselves.                                */\r\n    {\r\n      TT_NameEntryRec*  entry = table->names;\r\n\r\n\r\n      for ( ; count > 0; count-- )\r\n      {\r\n        if ( FT_STREAM_READ_FIELDS( name_record_fields, entry ) )\r\n          continue;\r\n\r\n        /* check that the name is not empty */\r\n        if ( entry->stringLength == 0 )\r\n          continue;\r\n\r\n        /* check that the name string is within the table */\r\n        entry->stringOffset += table_pos + table->storageOffset;\r\n        if ( entry->stringOffset                       < storage_start ||\r\n             entry->stringOffset + entry->stringLength > storage_limit )\r\n        {\r\n          /* invalid entry - ignore it */\r\n          entry->stringOffset = 0;\r\n          entry->stringLength = 0;\r\n          continue;\r\n        }\r\n\r\n        entry++;\r\n      }\r\n\r\n      table->numNameRecords = (FT_UInt)( entry - table->names );\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    /* everything went well, update face->num_names */\r\n    face->num_names = (FT_UShort) table->numNameRecords;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_free_names                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Frees the name records.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the target face object.                        */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_free_name( TT_Face  face )\r\n  {\r\n    FT_Memory     memory = face->root.driver->root.memory;\r\n    TT_NameTable  table  = &face->name_table;\r\n    TT_NameEntry  entry  = table->names;\r\n    FT_UInt       count  = table->numNameRecords;\r\n\r\n\r\n    if ( table->names )\r\n    {\r\n      for ( ; count > 0; count--, entry++ )\r\n      {\r\n        FT_FREE( entry->string );\r\n        entry->stringLength = 0;\r\n      }\r\n\r\n      /* free strings table */\r\n      FT_FREE( table->names );\r\n    }\r\n\r\n    table->numNameRecords = 0;\r\n    table->format         = 0;\r\n    table->storageOffset  = 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_cmap                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the cmap directory in a face object.  The cmaps themselves   */\r\n  /*    are loaded on demand in the `ttcmap.c' module.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_cmap( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )\r\n      face->cmap_size = 0;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_os2                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the OS2 table.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_os2( TT_Face    face,\r\n                    FT_Stream  stream )\r\n  {\r\n    FT_Error  error;\r\n    TT_OS2*   os2;\r\n\r\n    static const FT_Frame_Field  os2_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_OS2\r\n\r\n      FT_FRAME_START( 78 ),\r\n        FT_FRAME_USHORT( version ),\r\n        FT_FRAME_SHORT ( xAvgCharWidth ),\r\n        FT_FRAME_USHORT( usWeightClass ),\r\n        FT_FRAME_USHORT( usWidthClass ),\r\n        FT_FRAME_SHORT ( fsType ),\r\n        FT_FRAME_SHORT ( ySubscriptXSize ),\r\n        FT_FRAME_SHORT ( ySubscriptYSize ),\r\n        FT_FRAME_SHORT ( ySubscriptXOffset ),\r\n        FT_FRAME_SHORT ( ySubscriptYOffset ),\r\n        FT_FRAME_SHORT ( ySuperscriptXSize ),\r\n        FT_FRAME_SHORT ( ySuperscriptYSize ),\r\n        FT_FRAME_SHORT ( ySuperscriptXOffset ),\r\n        FT_FRAME_SHORT ( ySuperscriptYOffset ),\r\n        FT_FRAME_SHORT ( yStrikeoutSize ),\r\n        FT_FRAME_SHORT ( yStrikeoutPosition ),\r\n        FT_FRAME_SHORT ( sFamilyClass ),\r\n        FT_FRAME_BYTE  ( panose[0] ),\r\n        FT_FRAME_BYTE  ( panose[1] ),\r\n        FT_FRAME_BYTE  ( panose[2] ),\r\n        FT_FRAME_BYTE  ( panose[3] ),\r\n        FT_FRAME_BYTE  ( panose[4] ),\r\n        FT_FRAME_BYTE  ( panose[5] ),\r\n        FT_FRAME_BYTE  ( panose[6] ),\r\n        FT_FRAME_BYTE  ( panose[7] ),\r\n        FT_FRAME_BYTE  ( panose[8] ),\r\n        FT_FRAME_BYTE  ( panose[9] ),\r\n        FT_FRAME_ULONG ( ulUnicodeRange1 ),\r\n        FT_FRAME_ULONG ( ulUnicodeRange2 ),\r\n        FT_FRAME_ULONG ( ulUnicodeRange3 ),\r\n        FT_FRAME_ULONG ( ulUnicodeRange4 ),\r\n        FT_FRAME_BYTE  ( achVendID[0] ),\r\n        FT_FRAME_BYTE  ( achVendID[1] ),\r\n        FT_FRAME_BYTE  ( achVendID[2] ),\r\n        FT_FRAME_BYTE  ( achVendID[3] ),\r\n\r\n        FT_FRAME_USHORT( fsSelection ),\r\n        FT_FRAME_USHORT( usFirstCharIndex ),\r\n        FT_FRAME_USHORT( usLastCharIndex ),\r\n        FT_FRAME_SHORT ( sTypoAscender ),\r\n        FT_FRAME_SHORT ( sTypoDescender ),\r\n        FT_FRAME_SHORT ( sTypoLineGap ),\r\n        FT_FRAME_USHORT( usWinAscent ),\r\n        FT_FRAME_USHORT( usWinDescent ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  os2_fields_extra[] =\r\n    {\r\n      FT_FRAME_START( 8 ),\r\n        FT_FRAME_ULONG( ulCodePageRange1 ),\r\n        FT_FRAME_ULONG( ulCodePageRange2 ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  os2_fields_extra2[] =\r\n    {\r\n      FT_FRAME_START( 10 ),\r\n        FT_FRAME_SHORT ( sxHeight ),\r\n        FT_FRAME_SHORT ( sCapHeight ),\r\n        FT_FRAME_USHORT( usDefaultChar ),\r\n        FT_FRAME_USHORT( usBreakChar ),\r\n        FT_FRAME_USHORT( usMaxContext ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    /* We now support old Mac fonts where the OS/2 table doesn't  */\r\n    /* exist.  Simply put, we set the `version' field to 0xFFFF   */\r\n    /* and test this value each time we need to access the table. */\r\n    error = face->goto_table( face, TTAG_OS2, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    os2 = &face->os2;\r\n\r\n    if ( FT_STREAM_READ_FIELDS( os2_fields, os2 ) )\r\n      goto Exit;\r\n\r\n    os2->ulCodePageRange1 = 0;\r\n    os2->ulCodePageRange2 = 0;\r\n    os2->sxHeight         = 0;\r\n    os2->sCapHeight       = 0;\r\n    os2->usDefaultChar    = 0;\r\n    os2->usBreakChar      = 0;\r\n    os2->usMaxContext     = 0;\r\n\r\n    if ( os2->version >= 0x0001 )\r\n    {\r\n      /* only version 1 tables */\r\n      if ( FT_STREAM_READ_FIELDS( os2_fields_extra, os2 ) )\r\n        goto Exit;\r\n\r\n      if ( os2->version >= 0x0002 )\r\n      {\r\n        /* only version 2 tables */\r\n        if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )\r\n          goto Exit;\r\n      }\r\n    }\r\n\r\n    FT_TRACE3(( \"sTypoAscender:  %4d\\n\",   os2->sTypoAscender ));\r\n    FT_TRACE3(( \"sTypoDescender: %4d\\n\",   os2->sTypoDescender ));\r\n    FT_TRACE3(( \"usWinAscent:    %4u\\n\",   os2->usWinAscent ));\r\n    FT_TRACE3(( \"usWinDescent:   %4u\\n\",   os2->usWinDescent ));\r\n    FT_TRACE3(( \"fsSelection:    0x%2x\\n\", os2->fsSelection ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_postscript                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the Postscript table.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_post( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error        error;\r\n    TT_Postscript*  post = &face->postscript;\r\n\r\n    static const FT_Frame_Field  post_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_Postscript\r\n\r\n      FT_FRAME_START( 32 ),\r\n        FT_FRAME_ULONG( FormatType ),\r\n        FT_FRAME_ULONG( italicAngle ),\r\n        FT_FRAME_SHORT( underlinePosition ),\r\n        FT_FRAME_SHORT( underlineThickness ),\r\n        FT_FRAME_ULONG( isFixedPitch ),\r\n        FT_FRAME_ULONG( minMemType42 ),\r\n        FT_FRAME_ULONG( maxMemType42 ),\r\n        FT_FRAME_ULONG( minMemType1 ),\r\n        FT_FRAME_ULONG( maxMemType1 ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    error = face->goto_table( face, TTAG_post, stream, 0 );\r\n    if ( error )\r\n      return error;\r\n\r\n    if ( FT_STREAM_READ_FIELDS( post_fields, post ) )\r\n      return error;\r\n\r\n    /* we don't load the glyph names, we do that in another */\r\n    /* module (ttpost).                                     */\r\n\r\n    FT_TRACE3(( \"FormatType:   0x%x\\n\", post->FormatType ));\r\n    FT_TRACE3(( \"isFixedPitch:   %s\\n\", post->isFixedPitch\r\n                                        ? \"  yes\" : \"   no\" ));\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_pclt                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the PCL 5 Table.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_pclt( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    static const FT_Frame_Field  pclt_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_PCLT\r\n\r\n      FT_FRAME_START( 54 ),\r\n        FT_FRAME_ULONG ( Version ),\r\n        FT_FRAME_ULONG ( FontNumber ),\r\n        FT_FRAME_USHORT( Pitch ),\r\n        FT_FRAME_USHORT( xHeight ),\r\n        FT_FRAME_USHORT( Style ),\r\n        FT_FRAME_USHORT( TypeFamily ),\r\n        FT_FRAME_USHORT( CapHeight ),\r\n        FT_FRAME_BYTES ( TypeFace, 16 ),\r\n        FT_FRAME_BYTES ( CharacterComplement, 8 ),\r\n        FT_FRAME_BYTES ( FileName, 6 ),\r\n        FT_FRAME_CHAR  ( StrokeWeight ),\r\n        FT_FRAME_CHAR  ( WidthType ),\r\n        FT_FRAME_BYTE  ( SerifStyle ),\r\n        FT_FRAME_BYTE  ( Reserved ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    FT_Error  error;\r\n    TT_PCLT*  pclt = &face->pclt;\r\n\r\n\r\n    /* optional table */\r\n    error = face->goto_table( face, TTAG_PCLT, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_STREAM_READ_FIELDS( pclt_fields, pclt ) )\r\n      goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_gasp                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the `gasp' table into a face object.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_gasp( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n\r\n    FT_UInt        j,num_ranges;\r\n    TT_GaspRange   gaspranges = NULL;\r\n\r\n\r\n    /* the gasp table is optional */\r\n    error = face->goto_table( face, TTAG_gasp, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_FRAME_ENTER( 4L ) )\r\n      goto Exit;\r\n\r\n    face->gasp.version   = FT_GET_USHORT();\r\n    face->gasp.numRanges = FT_GET_USHORT();\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    /* only support versions 0 and 1 of the table */\r\n    if ( face->gasp.version >= 2 )\r\n    {\r\n      face->gasp.numRanges = 0;\r\n      error = SFNT_Err_Invalid_Table;\r\n      goto Exit;\r\n    }\r\n\r\n    num_ranges = face->gasp.numRanges;\r\n    FT_TRACE3(( \"numRanges: %u\\n\", num_ranges ));\r\n\r\n    if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) ||\r\n         FT_FRAME_ENTER( num_ranges * 4L )                  )\r\n      goto Exit;\r\n\r\n    gaspranges = face->gasp.gaspRanges;\r\n\r\n    for ( j = 0; j < num_ranges; j++ )\r\n    {\r\n      gaspranges[j].maxPPEM  = FT_GET_USHORT();\r\n      gaspranges[j].gaspFlag = FT_GET_USHORT();\r\n\r\n      FT_TRACE3(( \"gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\\n\",\r\n                  j,\r\n                  gaspranges[j].maxPPEM,\r\n                  gaspranges[j].gaspFlag ));\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttload.h                                                               */\r\n/*                                                                         */\r\n/*    Load the basic TrueType tables, i.e., tables that can be either in   */\r\n/*    TTF or OTF fonts (specification).                                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2005, 2006 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTLOAD_H__\r\n#define __TTLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( TT_Table  )\r\n  tt_face_lookup_table( TT_Face   face,\r\n                        FT_ULong  tag );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_goto_table( TT_Face    face,\r\n                      FT_ULong   tag,\r\n                      FT_Stream  stream,\r\n                      FT_ULong*  length );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_font_dir( TT_Face    face,\r\n                         FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_any( TT_Face    face,\r\n                    FT_ULong   tag,\r\n                    FT_Long    offset,\r\n                    FT_Byte*   buffer,\r\n                    FT_ULong*  length );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_head( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_cmap( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_maxp( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_name( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_os2( TT_Face    face,\r\n                    FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_post( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_pclt( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_free_name( TT_Face  face );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_gasp( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_bhed( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttmtx.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttmtx.c                                                                */\r\n/*                                                                         */\r\n/*    Load the metrics tables common to TTF and OTF fonts (body).          */\r\n/*                                                                         */\r\n/*  Copyright 2006-2009, 2011-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttmtx.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttmtx\r\n\r\n\r\n  /*\r\n   *  Unfortunately, we can't enable our memory optimizations if\r\n   *  FT_CONFIG_OPTION_OLD_INTERNALS is defined.  This is because at least\r\n   *  one rogue client (libXfont in the X.Org XServer) is directly accessing\r\n   *  the metrics.\r\n   */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_hmtx                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the `hmtx' or `vmtx' table into a face object.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the target face object.                    */\r\n  /*                                                                       */\r\n  /*    stream   :: The input stream.                                      */\r\n  /*                                                                       */\r\n  /*    vertical :: A boolean flag.  If set, load `vmtx'.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_hmtx( TT_Face    face,\r\n                     FT_Stream  stream,\r\n                     FT_Bool    vertical )\r\n  {\r\n    FT_Error   error;\r\n    FT_ULong   tag, table_size;\r\n    FT_ULong*  ptable_offset;\r\n    FT_ULong*  ptable_size;\r\n\r\n\r\n    if ( vertical )\r\n    {\r\n      tag           = TTAG_vmtx;\r\n      ptable_offset = &face->vert_metrics_offset;\r\n      ptable_size   = &face->vert_metrics_size;\r\n    }\r\n    else\r\n    {\r\n      tag           = TTAG_hmtx;\r\n      ptable_offset = &face->horz_metrics_offset;\r\n      ptable_size   = &face->horz_metrics_size;\r\n    }\r\n\r\n    error = face->goto_table( face, tag, stream, &table_size );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    *ptable_size   = table_size;\r\n    *ptable_offset = FT_STREAM_POS();\r\n\r\n  Fail:\r\n    return error;\r\n  }\r\n\r\n#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_hmtx( TT_Face    face,\r\n                     FT_Stream  stream,\r\n                     FT_Bool    vertical )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n\r\n    FT_ULong   table_len;\r\n    FT_Long    num_shorts, num_longs, num_shorts_checked;\r\n\r\n    TT_LongMetrics*    longs;\r\n    TT_ShortMetrics**  shorts;\r\n    FT_Byte*           p;\r\n\r\n\r\n    if ( vertical )\r\n    {\r\n      void*   lm = &face->vertical.long_metrics;\r\n      void**  sm = &face->vertical.short_metrics;\r\n\r\n\r\n      error = face->goto_table( face, TTAG_vmtx, stream, &table_len );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      num_longs = face->vertical.number_Of_VMetrics;\r\n      if ( (FT_ULong)num_longs > table_len / 4 )\r\n        num_longs = (FT_Long)( table_len / 4 );\r\n\r\n      face->vertical.number_Of_VMetrics = 0;\r\n\r\n      longs  = (TT_LongMetrics*)lm;\r\n      shorts = (TT_ShortMetrics**)sm;\r\n    }\r\n    else\r\n    {\r\n      void*   lm = &face->horizontal.long_metrics;\r\n      void**  sm = &face->horizontal.short_metrics;\r\n\r\n\r\n      error = face->goto_table( face, TTAG_hmtx, stream, &table_len );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      num_longs = face->horizontal.number_Of_HMetrics;\r\n      if ( (FT_ULong)num_longs > table_len / 4 )\r\n        num_longs = (FT_Long)( table_len / 4 );\r\n\r\n      face->horizontal.number_Of_HMetrics = 0;\r\n\r\n      longs  = (TT_LongMetrics*)lm;\r\n      shorts = (TT_ShortMetrics**)sm;\r\n    }\r\n\r\n    /* never trust derived values */\r\n\r\n    num_shorts         = face->max_profile.numGlyphs - num_longs;\r\n    num_shorts_checked = ( table_len - num_longs * 4L ) / 2;\r\n\r\n    if ( num_shorts < 0 )\r\n    {\r\n      FT_TRACE0(( \"tt_face_load_hmtx:\"\r\n                  \" %cmtx has more metrics than glyphs.\\n\",\r\n                  vertical ? 'v' : 'h' ));\r\n\r\n      /* Adobe simply ignores this problem.  So we shall do the same. */\r\n#if 0\r\n      error = vertical ? SFNT_Err_Invalid_Vert_Metrics\r\n                       : SFNT_Err_Invalid_Horiz_Metrics;\r\n      goto Exit;\r\n#else\r\n      num_shorts = 0;\r\n#endif\r\n    }\r\n\r\n    if ( FT_QNEW_ARRAY( *longs,  num_longs  ) ||\r\n         FT_QNEW_ARRAY( *shorts, num_shorts ) )\r\n      goto Fail;\r\n\r\n    if ( FT_FRAME_ENTER( table_len ) )\r\n      goto Fail;\r\n\r\n    p = stream->cursor;\r\n\r\n    {\r\n      TT_LongMetrics  cur   = *longs;\r\n      TT_LongMetrics  limit = cur + num_longs;\r\n\r\n\r\n      for ( ; cur < limit; cur++ )\r\n      {\r\n        cur->advance = FT_NEXT_USHORT( p );\r\n        cur->bearing = FT_NEXT_SHORT( p );\r\n      }\r\n    }\r\n\r\n    /* do we have an inconsistent number of metric values? */\r\n    {\r\n      TT_ShortMetrics*  cur   = *shorts;\r\n      TT_ShortMetrics*  limit = cur +\r\n                                FT_MIN( num_shorts, num_shorts_checked );\r\n\r\n\r\n      for ( ; cur < limit; cur++ )\r\n        *cur = FT_NEXT_SHORT( p );\r\n\r\n      /* We fill up the missing left side bearings with the     */\r\n      /* last valid value.  Since this will occur for buggy CJK */\r\n      /* fonts usually only, nothing serious will happen.       */\r\n      if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )\r\n      {\r\n        FT_Short  val = (*shorts)[num_shorts_checked - 1];\r\n\r\n\r\n        limit = *shorts + num_shorts;\r\n        for ( ; cur < limit; cur++ )\r\n          *cur = val;\r\n      }\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    if ( vertical )\r\n      face->vertical.number_Of_VMetrics = (FT_UShort)num_longs;\r\n    else\r\n      face->horizontal.number_Of_HMetrics = (FT_UShort)num_longs;\r\n\r\n  Fail:\r\n    return error;\r\n  }\r\n\r\n#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_hhea                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the `hhea' or 'vhea' table into a face object.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the target face object.                    */\r\n  /*                                                                       */\r\n  /*    stream   :: The input stream.                                      */\r\n  /*                                                                       */\r\n  /*    vertical :: A boolean flag.  If set, load `vhea'.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_hhea( TT_Face    face,\r\n                     FT_Stream  stream,\r\n                     FT_Bool    vertical )\r\n  {\r\n    FT_Error        error;\r\n    TT_HoriHeader*  header;\r\n\r\n    static const FT_Frame_Field  metrics_header_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_HoriHeader\r\n\r\n      FT_FRAME_START( 36 ),\r\n        FT_FRAME_ULONG ( Version ),\r\n        FT_FRAME_SHORT ( Ascender ),\r\n        FT_FRAME_SHORT ( Descender ),\r\n        FT_FRAME_SHORT ( Line_Gap ),\r\n        FT_FRAME_USHORT( advance_Width_Max ),\r\n        FT_FRAME_SHORT ( min_Left_Side_Bearing ),\r\n        FT_FRAME_SHORT ( min_Right_Side_Bearing ),\r\n        FT_FRAME_SHORT ( xMax_Extent ),\r\n        FT_FRAME_SHORT ( caret_Slope_Rise ),\r\n        FT_FRAME_SHORT ( caret_Slope_Run ),\r\n        FT_FRAME_SHORT ( caret_Offset ),\r\n        FT_FRAME_SHORT ( Reserved[0] ),\r\n        FT_FRAME_SHORT ( Reserved[1] ),\r\n        FT_FRAME_SHORT ( Reserved[2] ),\r\n        FT_FRAME_SHORT ( Reserved[3] ),\r\n        FT_FRAME_SHORT ( metric_Data_Format ),\r\n        FT_FRAME_USHORT( number_Of_HMetrics ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    if ( vertical )\r\n    {\r\n      void  *v = &face->vertical;\r\n\r\n\r\n      error = face->goto_table( face, TTAG_vhea, stream, 0 );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      header = (TT_HoriHeader*)v;\r\n    }\r\n    else\r\n    {\r\n      error = face->goto_table( face, TTAG_hhea, stream, 0 );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      header = &face->horizontal;\r\n    }\r\n\r\n    if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )\r\n      goto Fail;\r\n\r\n    FT_TRACE3(( \"Ascender:          %5d\\n\", header->Ascender ));\r\n    FT_TRACE3(( \"Descender:         %5d\\n\", header->Descender ));\r\n    FT_TRACE3(( \"number_Of_Metrics: %5u\\n\", header->number_Of_HMetrics ));\r\n\r\n    header->long_metrics  = NULL;\r\n    header->short_metrics = NULL;\r\n\r\n  Fail:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_get_metrics                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Returns the horizontal or vertical metrics in font units for a     */\r\n  /*    given glyph.  The metrics are the left side bearing (resp. top     */\r\n  /*    side bearing) and advance width (resp. advance height).            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    header  :: A pointer to either the horizontal or vertical metrics  */\r\n  /*               structure.                                              */\r\n  /*                                                                       */\r\n  /*    idx     :: The glyph index.                                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    bearing :: The bearing, either left side or top side.              */\r\n  /*                                                                       */\r\n  /*    advance :: The advance width resp. advance height.                 */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_get_metrics( TT_Face     face,\r\n                       FT_Bool     vertical,\r\n                       FT_UInt     gindex,\r\n                       FT_Short   *abearing,\r\n                       FT_UShort  *aadvance )\r\n  {\r\n    FT_Error        error;\r\n    FT_Stream       stream = face->root.stream;\r\n    TT_HoriHeader*  header;\r\n    FT_ULong        table_pos, table_size, table_end;\r\n    FT_UShort       k;\r\n\r\n\r\n    if ( vertical )\r\n    {\r\n      void*  v = &face->vertical;\r\n\r\n\r\n      header     = (TT_HoriHeader*)v;\r\n      table_pos  = face->vert_metrics_offset;\r\n      table_size = face->vert_metrics_size;\r\n    }\r\n    else\r\n    {\r\n      header     = &face->horizontal;\r\n      table_pos  = face->horz_metrics_offset;\r\n      table_size = face->horz_metrics_size;\r\n    }\r\n\r\n    table_end = table_pos + table_size;\r\n\r\n    k = header->number_Of_HMetrics;\r\n\r\n    if ( k > 0 )\r\n    {\r\n      if ( gindex < (FT_UInt)k )\r\n      {\r\n        table_pos += 4 * gindex;\r\n        if ( table_pos + 4 > table_end )\r\n          goto NoData;\r\n\r\n        if ( FT_STREAM_SEEK( table_pos ) ||\r\n             FT_READ_USHORT( *aadvance ) ||\r\n             FT_READ_SHORT( *abearing )  )\r\n          goto NoData;\r\n      }\r\n      else\r\n      {\r\n        table_pos += 4 * ( k - 1 );\r\n        if ( table_pos + 4 > table_end )\r\n          goto NoData;\r\n\r\n        if ( FT_STREAM_SEEK( table_pos ) ||\r\n             FT_READ_USHORT( *aadvance ) )\r\n          goto NoData;\r\n\r\n        table_pos += 4 + 2 * ( gindex - k );\r\n        if ( table_pos + 2 > table_end )\r\n          *abearing = 0;\r\n        else\r\n        {\r\n          if ( !FT_STREAM_SEEK( table_pos ) )\r\n            (void)FT_READ_SHORT( *abearing );\r\n        }\r\n      }\r\n    }\r\n    else\r\n    {\r\n    NoData:\r\n      *abearing = 0;\r\n      *aadvance = 0;\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_get_metrics( TT_Face     face,\r\n                       FT_Bool     vertical,\r\n                       FT_UInt     gindex,\r\n                       FT_Short*   abearing,\r\n                       FT_UShort*  aadvance )\r\n  {\r\n    void*           v = &face->vertical;\r\n    void*           h = &face->horizontal;\r\n    TT_HoriHeader*  header = vertical ? (TT_HoriHeader*)v\r\n                                      : (TT_HoriHeader*)h;\r\n    TT_LongMetrics  longs_m;\r\n    FT_UShort       k = header->number_Of_HMetrics;\r\n\r\n\r\n    if ( k == 0                                         ||\r\n         !header->long_metrics                          ||\r\n         gindex >= (FT_UInt)face->max_profile.numGlyphs )\r\n    {\r\n      *abearing = *aadvance = 0;\r\n      return SFNT_Err_Ok;\r\n    }\r\n\r\n    if ( gindex < (FT_UInt)k )\r\n    {\r\n      longs_m   = (TT_LongMetrics)header->long_metrics + gindex;\r\n      *abearing = longs_m->bearing;\r\n      *aadvance = longs_m->advance;\r\n    }\r\n    else\r\n    {\r\n      *abearing = ((TT_ShortMetrics*)header->short_metrics)[gindex - k];\r\n      *aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance;\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttmtx.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttmtx.h                                                                */\r\n/*                                                                         */\r\n/*    Load the metrics tables common to TTF and OTF fonts (specification). */\r\n/*                                                                         */\r\n/*  Copyright 2006 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTMTX_H__\r\n#define __TTMTX_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_hhea( TT_Face    face,\r\n                     FT_Stream  stream,\r\n                     FT_Bool    vertical );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_hmtx( TT_Face    face,\r\n                     FT_Stream  stream,\r\n                     FT_Bool    vertical );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_get_metrics( TT_Face     face,\r\n                       FT_Bool     vertical,\r\n                       FT_UInt     gindex,\r\n                       FT_Short*   abearing,\r\n                       FT_UShort*  aadvance );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTMTX_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttpost.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttpost.c                                                               */\r\n/*                                                                         */\r\n/*    Postcript name table processing for TrueType and OpenType fonts      */\r\n/*    (body).                                                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The post table is not completely loaded by the core engine.  This     */\r\n  /* file loads the missing PS glyph names and implements an API to access */\r\n  /* them.                                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttpost.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttpost\r\n\r\n\r\n  /* If this configuration macro is defined, we rely on the `PSNames' */\r\n  /* module to grab the glyph names.                                  */\r\n\r\n#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n#define MAC_NAME( x )  ( (FT_String*)psnames->macintosh_name( x ) )\r\n\r\n\r\n#else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */\r\n\r\n\r\n   /* Otherwise, we ignore the `PSNames' module, and provide our own  */\r\n   /* table of Mac names.  Thus, it is possible to build a version of */\r\n   /* FreeType without the Type 1 driver & PSNames module.            */\r\n\r\n#define MAC_NAME( x )  ( (FT_String*)tt_post_default_names[x] )\r\n\r\n  /* the 258 default Mac PS glyph names */\r\n\r\n  static const FT_String* const  tt_post_default_names[258] =\r\n  {\r\n    /*   0 */\r\n    \".notdef\", \".null\", \"CR\", \"space\", \"exclam\",\r\n    \"quotedbl\", \"numbersign\", \"dollar\", \"percent\", \"ampersand\",\r\n    /*  10 */\r\n    \"quotesingle\", \"parenleft\", \"parenright\", \"asterisk\", \"plus\",\r\n    \"comma\", \"hyphen\", \"period\", \"slash\", \"zero\",\r\n    /*  20 */\r\n    \"one\", \"two\", \"three\", \"four\", \"five\",\r\n    \"six\", \"seven\", \"eight\", \"nine\", \"colon\",\r\n    /*  30 */\r\n    \"semicolon\", \"less\", \"equal\", \"greater\", \"question\",\r\n    \"at\", \"A\", \"B\", \"C\", \"D\",\r\n    /*  40 */\r\n    \"E\", \"F\", \"G\", \"H\", \"I\",\r\n    \"J\", \"K\", \"L\", \"M\", \"N\",\r\n    /*  50 */\r\n    \"O\", \"P\", \"Q\", \"R\", \"S\",\r\n    \"T\", \"U\", \"V\", \"W\", \"X\",\r\n    /*  60 */\r\n    \"Y\", \"Z\", \"bracketleft\", \"backslash\", \"bracketright\",\r\n    \"asciicircum\", \"underscore\", \"grave\", \"a\", \"b\",\r\n    /*  70 */\r\n    \"c\", \"d\", \"e\", \"f\", \"g\",\r\n    \"h\", \"i\", \"j\", \"k\", \"l\",\r\n    /*  80 */\r\n    \"m\", \"n\", \"o\", \"p\", \"q\",\r\n    \"r\", \"s\", \"t\", \"u\", \"v\",\r\n    /*  90 */\r\n    \"w\", \"x\", \"y\", \"z\", \"braceleft\",\r\n    \"bar\", \"braceright\", \"asciitilde\", \"Adieresis\", \"Aring\",\r\n    /* 100 */\r\n    \"Ccedilla\", \"Eacute\", \"Ntilde\", \"Odieresis\", \"Udieresis\",\r\n    \"aacute\", \"agrave\", \"acircumflex\", \"adieresis\", \"atilde\",\r\n    /* 110 */\r\n    \"aring\", \"ccedilla\", \"eacute\", \"egrave\", \"ecircumflex\",\r\n    \"edieresis\", \"iacute\", \"igrave\", \"icircumflex\", \"idieresis\",\r\n    /* 120 */\r\n    \"ntilde\", \"oacute\", \"ograve\", \"ocircumflex\", \"odieresis\",\r\n    \"otilde\", \"uacute\", \"ugrave\", \"ucircumflex\", \"udieresis\",\r\n    /* 130 */\r\n    \"dagger\", \"degree\", \"cent\", \"sterling\", \"section\",\r\n    \"bullet\", \"paragraph\", \"germandbls\", \"registered\", \"copyright\",\r\n    /* 140 */\r\n    \"trademark\", \"acute\", \"dieresis\", \"notequal\", \"AE\",\r\n    \"Oslash\", \"infinity\", \"plusminus\", \"lessequal\", \"greaterequal\",\r\n    /* 150 */\r\n    \"yen\", \"mu\", \"partialdiff\", \"summation\", \"product\",\r\n    \"pi\", \"integral\", \"ordfeminine\", \"ordmasculine\", \"Omega\",\r\n    /* 160 */\r\n    \"ae\", \"oslash\", \"questiondown\", \"exclamdown\", \"logicalnot\",\r\n    \"radical\", \"florin\", \"approxequal\", \"Delta\", \"guillemotleft\",\r\n    /* 170 */\r\n    \"guillemotright\", \"ellipsis\", \"nbspace\", \"Agrave\", \"Atilde\",\r\n    \"Otilde\", \"OE\", \"oe\", \"endash\", \"emdash\",\r\n    /* 180 */\r\n    \"quotedblleft\", \"quotedblright\", \"quoteleft\", \"quoteright\", \"divide\",\r\n    \"lozenge\", \"ydieresis\", \"Ydieresis\", \"fraction\", \"currency\",\r\n    /* 190 */\r\n    \"guilsinglleft\", \"guilsinglright\", \"fi\", \"fl\", \"daggerdbl\",\r\n    \"periodcentered\", \"quotesinglbase\", \"quotedblbase\", \"perthousand\", \"Acircumflex\",\r\n    /* 200 */\r\n    \"Ecircumflex\", \"Aacute\", \"Edieresis\", \"Egrave\", \"Iacute\",\r\n    \"Icircumflex\", \"Idieresis\", \"Igrave\", \"Oacute\", \"Ocircumflex\",\r\n    /* 210 */\r\n    \"apple\", \"Ograve\", \"Uacute\", \"Ucircumflex\", \"Ugrave\",\r\n    \"dotlessi\", \"circumflex\", \"tilde\", \"macron\", \"breve\",\r\n    /* 220 */\r\n    \"dotaccent\", \"ring\", \"cedilla\", \"hungarumlaut\", \"ogonek\",\r\n    \"caron\", \"Lslash\", \"lslash\", \"Scaron\", \"scaron\",\r\n    /* 230 */\r\n    \"Zcaron\", \"zcaron\", \"brokenbar\", \"Eth\", \"eth\",\r\n    \"Yacute\", \"yacute\", \"Thorn\", \"thorn\", \"minus\",\r\n    /* 240 */\r\n    \"multiply\", \"onesuperior\", \"twosuperior\", \"threesuperior\", \"onehalf\",\r\n    \"onequarter\", \"threequarters\", \"franc\", \"Gbreve\", \"gbreve\",\r\n    /* 250 */\r\n    \"Idot\", \"Scedilla\", \"scedilla\", \"Cacute\", \"cacute\",\r\n    \"Ccaron\", \"ccaron\", \"dmacron\",\r\n  };\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */\r\n\r\n\r\n  static FT_Error\r\n  load_format_20( TT_Face    face,\r\n                  FT_Stream  stream,\r\n                  FT_Long    post_limit )\r\n  {\r\n    FT_Memory   memory = stream->memory;\r\n    FT_Error    error;\r\n\r\n    FT_Int      num_glyphs;\r\n    FT_UShort   num_names;\r\n\r\n    FT_UShort*  glyph_indices = 0;\r\n    FT_Char**   name_strings  = 0;\r\n\r\n\r\n    if ( FT_READ_USHORT( num_glyphs ) )\r\n      goto Exit;\r\n\r\n    /* UNDOCUMENTED!  The number of glyphs in this table can be smaller */\r\n    /* than the value in the maxp table (cf. cyberbit.ttf).             */\r\n\r\n    /* There already exist fonts which have more than 32768 glyph names */\r\n    /* in this table, so the test for this threshold has been dropped.  */\r\n\r\n    if ( num_glyphs > face->max_profile.numGlyphs )\r\n    {\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* load the indices */\r\n    {\r\n      FT_Int  n;\r\n\r\n\r\n      if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) ||\r\n           FT_FRAME_ENTER( num_glyphs * 2L )          )\r\n        goto Fail;\r\n\r\n      for ( n = 0; n < num_glyphs; n++ )\r\n        glyph_indices[n] = FT_GET_USHORT();\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n    /* compute number of names stored in table */\r\n    {\r\n      FT_Int  n;\r\n\r\n\r\n      num_names = 0;\r\n\r\n      for ( n = 0; n < num_glyphs; n++ )\r\n      {\r\n        FT_Int  idx;\r\n\r\n\r\n        idx = glyph_indices[n];\r\n        if ( idx >= 258 )\r\n        {\r\n          idx -= 257;\r\n          if ( idx > num_names )\r\n            num_names = (FT_UShort)idx;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* now load the name strings */\r\n    {\r\n      FT_UShort  n;\r\n\r\n\r\n      if ( FT_NEW_ARRAY( name_strings, num_names ) )\r\n        goto Fail;\r\n\r\n      for ( n = 0; n < num_names; n++ )\r\n      {\r\n        FT_UInt  len;\r\n\r\n\r\n        if ( FT_STREAM_POS() >= post_limit )\r\n          break;\r\n        else\r\n        {\r\n          FT_TRACE6(( \"load_format_20: %d byte left in post table\\n\",\r\n                      post_limit - FT_STREAM_POS() ));\r\n\r\n          if ( FT_READ_BYTE( len ) )\r\n            goto Fail1;\r\n        }\r\n\r\n        if ( (FT_Int)len > post_limit                   ||\r\n             FT_STREAM_POS() > post_limit - (FT_Int)len )\r\n        {\r\n          FT_ERROR(( \"load_format_20:\"\r\n                     \" exceeding string length (%d),\"\r\n                     \" truncating at end of post table (%d byte left)\\n\",\r\n                     len, post_limit - FT_STREAM_POS() ));\r\n          len = FT_MAX( 0, post_limit - FT_STREAM_POS() );\r\n        }\r\n\r\n        if ( FT_NEW_ARRAY( name_strings[n], len + 1 ) ||\r\n             FT_STREAM_READ( name_strings[n], len   ) )\r\n          goto Fail1;\r\n\r\n        name_strings[n][len] = '\\0';\r\n      }\r\n\r\n      if ( n < num_names )\r\n      {\r\n        FT_ERROR(( \"load_format_20:\"\r\n                   \" all entries in post table are already parsed,\"\r\n                   \" using NULL names for gid %d - %d\\n\",\r\n                    n, num_names - 1 ));\r\n        for ( ; n < num_names; n++ )\r\n          if ( FT_NEW_ARRAY( name_strings[n], 1 ) )\r\n            goto Fail1;\r\n          else\r\n            name_strings[n][0] = '\\0';\r\n      }\r\n    }\r\n\r\n    /* all right, set table fields and exit successfully */\r\n    {\r\n      TT_Post_20  table = &face->postscript_names.names.format_20;\r\n\r\n\r\n      table->num_glyphs    = (FT_UShort)num_glyphs;\r\n      table->num_names     = (FT_UShort)num_names;\r\n      table->glyph_indices = glyph_indices;\r\n      table->glyph_names   = name_strings;\r\n    }\r\n    return SFNT_Err_Ok;\r\n\r\n  Fail1:\r\n    {\r\n      FT_UShort  n;\r\n\r\n\r\n      for ( n = 0; n < num_names; n++ )\r\n        FT_FREE( name_strings[n] );\r\n    }\r\n\r\n  Fail:\r\n    FT_FREE( name_strings );\r\n    FT_FREE( glyph_indices );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  load_format_25( TT_Face    face,\r\n                  FT_Stream  stream,\r\n                  FT_Long    post_limit )\r\n  {\r\n    FT_Memory  memory = stream->memory;\r\n    FT_Error   error;\r\n\r\n    FT_Int     num_glyphs;\r\n    FT_Char*   offset_table = 0;\r\n\r\n    FT_UNUSED( post_limit );\r\n\r\n\r\n    /* UNDOCUMENTED!  This value appears only in the Apple TT specs. */\r\n    if ( FT_READ_USHORT( num_glyphs ) )\r\n      goto Exit;\r\n\r\n    /* check the number of glyphs */\r\n    if ( num_glyphs > face->max_profile.numGlyphs || num_glyphs > 258 )\r\n    {\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( FT_NEW_ARRAY( offset_table, num_glyphs )   ||\r\n         FT_STREAM_READ( offset_table, num_glyphs ) )\r\n      goto Fail;\r\n\r\n    /* now check the offset table */\r\n    {\r\n      FT_Int  n;\r\n\r\n\r\n      for ( n = 0; n < num_glyphs; n++ )\r\n      {\r\n        FT_Long  idx = (FT_Long)n + offset_table[n];\r\n\r\n\r\n        if ( idx < 0 || idx > num_glyphs )\r\n        {\r\n          error = SFNT_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* OK, set table fields and exit successfully */\r\n    {\r\n      TT_Post_25  table = &face->postscript_names.names.format_25;\r\n\r\n\r\n      table->num_glyphs = (FT_UShort)num_glyphs;\r\n      table->offsets    = offset_table;\r\n    }\r\n\r\n    return SFNT_Err_Ok;\r\n\r\n  Fail:\r\n    FT_FREE( offset_table );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  load_post_names( TT_Face  face )\r\n  {\r\n    FT_Stream  stream;\r\n    FT_Error   error;\r\n    FT_Fixed   format;\r\n    FT_ULong   post_len;\r\n    FT_Long    post_limit;\r\n\r\n\r\n    /* get a stream for the face's resource */\r\n    stream = face->root.stream;\r\n\r\n    /* seek to the beginning of the PS names table */\r\n    error = face->goto_table( face, TTAG_post, stream, &post_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    post_limit = FT_STREAM_POS() + post_len;\r\n\r\n    format = face->postscript.FormatType;\r\n\r\n    /* go to beginning of subtable */\r\n    if ( FT_STREAM_SKIP( 32 ) )\r\n      goto Exit;\r\n\r\n    /* now read postscript table */\r\n    if ( format == 0x00020000L )\r\n      error = load_format_20( face, stream, post_limit );\r\n    else if ( format == 0x00028000L )\r\n      error = load_format_25( face, stream, post_limit );\r\n    else\r\n      error = SFNT_Err_Invalid_File_Format;\r\n\r\n    face->postscript_names.loaded = 1;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_free_ps_names( TT_Face  face )\r\n  {\r\n    FT_Memory      memory = face->root.memory;\r\n    TT_Post_Names  names  = &face->postscript_names;\r\n    FT_Fixed       format;\r\n\r\n\r\n    if ( names->loaded )\r\n    {\r\n      format = face->postscript.FormatType;\r\n\r\n      if ( format == 0x00020000L )\r\n      {\r\n        TT_Post_20  table = &names->names.format_20;\r\n        FT_UShort   n;\r\n\r\n\r\n        FT_FREE( table->glyph_indices );\r\n        table->num_glyphs = 0;\r\n\r\n        for ( n = 0; n < table->num_names; n++ )\r\n          FT_FREE( table->glyph_names[n] );\r\n\r\n        FT_FREE( table->glyph_names );\r\n        table->num_names = 0;\r\n      }\r\n      else if ( format == 0x00028000L )\r\n      {\r\n        TT_Post_25  table = &names->names.format_25;\r\n\r\n\r\n        FT_FREE( table->offsets );\r\n        table->num_glyphs = 0;\r\n      }\r\n    }\r\n    names->loaded = 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_get_ps_name                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the PostScript glyph name of a glyph.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the parent face.                             */\r\n  /*                                                                       */\r\n  /*    idx    :: The glyph index.                                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    PSname :: The address of a string pointer.  Will be NULL in case   */\r\n  /*              of error, otherwise it is a pointer to the glyph name.   */\r\n  /*                                                                       */\r\n  /*              You must not modify the returned string!                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_get_ps_name( TT_Face      face,\r\n                       FT_UInt      idx,\r\n                       FT_String**  PSname )\r\n  {\r\n    FT_Error       error;\r\n    TT_Post_Names  names;\r\n    FT_Fixed       format;\r\n\r\n#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n    FT_Service_PsCMaps  psnames;\r\n#endif\r\n\r\n\r\n    if ( !face )\r\n      return SFNT_Err_Invalid_Face_Handle;\r\n\r\n    if ( idx >= (FT_UInt)face->max_profile.numGlyphs )\r\n      return SFNT_Err_Invalid_Glyph_Index;\r\n\r\n#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n    psnames = (FT_Service_PsCMaps)face->psnames;\r\n    if ( !psnames )\r\n      return SFNT_Err_Unimplemented_Feature;\r\n#endif\r\n\r\n    names = &face->postscript_names;\r\n\r\n    /* `.notdef' by default */\r\n    *PSname = MAC_NAME( 0 );\r\n\r\n    format = face->postscript.FormatType;\r\n\r\n    if ( format == 0x00010000L )\r\n    {\r\n      if ( idx < 258 )                    /* paranoid checking */\r\n        *PSname = MAC_NAME( idx );\r\n    }\r\n    else if ( format == 0x00020000L )\r\n    {\r\n      TT_Post_20  table = &names->names.format_20;\r\n\r\n\r\n      if ( !names->loaded )\r\n      {\r\n        error = load_post_names( face );\r\n        if ( error )\r\n          goto End;\r\n      }\r\n\r\n      if ( idx < (FT_UInt)table->num_glyphs )\r\n      {\r\n        FT_UShort  name_index = table->glyph_indices[idx];\r\n\r\n\r\n        if ( name_index < 258 )\r\n          *PSname = MAC_NAME( name_index );\r\n        else\r\n          *PSname = (FT_String*)table->glyph_names[name_index - 258];\r\n      }\r\n    }\r\n    else if ( format == 0x00028000L )\r\n    {\r\n      TT_Post_25  table = &names->names.format_25;\r\n\r\n\r\n      if ( !names->loaded )\r\n      {\r\n        error = load_post_names( face );\r\n        if ( error )\r\n          goto End;\r\n      }\r\n\r\n      if ( idx < (FT_UInt)table->num_glyphs )    /* paranoid checking */\r\n      {\r\n        idx    += table->offsets[idx];\r\n        *PSname = MAC_NAME( idx );\r\n      }\r\n    }\r\n\r\n    /* nothing to do for format == 0x00030000L */\r\n\r\n  End:\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttpost.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttpost.h                                                               */\r\n/*                                                                         */\r\n/*    Postcript name table processing for TrueType and OpenType fonts      */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTPOST_H__\r\n#define __TTPOST_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_get_ps_name( TT_Face      face,\r\n                       FT_UInt      idx,\r\n                       FT_String**  PSname );\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_free_ps_names( TT_Face  face );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTPOST_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttsbit.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttsbit.c                                                               */\r\n/*                                                                         */\r\n/*    TrueType and OpenType embedded bitmap support (body).                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */\r\n/*            2010 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n\r\n  /*\r\n   *  Alas, the memory-optimized sbit loader can't be used when implementing\r\n   *  the `old internals' hack\r\n   */\r\n#ifndef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n#include \"ttsbit0.c\"\r\n\r\n#else /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttsbit.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttsbit\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    blit_sbit                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Blits a bitmap from an input stream into a given target.  Supports */\r\n  /*    x and y offsets as well as byte padded lines.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    target      :: The target bitmap/pixmap.                           */\r\n  /*                                                                       */\r\n  /*    source      :: The input packed bitmap data.                       */\r\n  /*                                                                       */\r\n  /*    line_bits   :: The number of bits per line.                        */\r\n  /*                                                                       */\r\n  /*    byte_padded :: A flag which is true if lines are byte-padded.      */\r\n  /*                                                                       */\r\n  /*    x_offset    :: The horizontal offset.                              */\r\n  /*                                                                       */\r\n  /*    y_offset    :: The vertical offset.                                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    IMPORTANT: The x and y offsets are relative to the top corner of   */\r\n  /*               the target bitmap (unlike the normal TrueType           */\r\n  /*               convention).  A positive y offset indicates a downwards */\r\n  /*               direction!                                              */\r\n  /*                                                                       */\r\n  static void\r\n  blit_sbit( FT_Bitmap*  target,\r\n             FT_Byte*    source,\r\n             FT_Int      line_bits,\r\n             FT_Bool     byte_padded,\r\n             FT_Int      x_offset,\r\n             FT_Int      y_offset,\r\n             FT_Int      source_height )\r\n  {\r\n    FT_Byte*   line_buff;\r\n    FT_Int     line_incr;\r\n    FT_Int     height;\r\n\r\n    FT_UShort  acc;\r\n    FT_UInt    loaded;\r\n\r\n\r\n    /* first of all, compute starting write position */\r\n    line_incr = target->pitch;\r\n    line_buff = target->buffer;\r\n\r\n    if ( line_incr < 0 )\r\n      line_buff -= line_incr * ( target->rows - 1 );\r\n\r\n    line_buff += ( x_offset >> 3 ) + y_offset * line_incr;\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* We use the extra-classic `accumulator' trick to extract the bits    */\r\n    /* from the source byte stream.                                        */\r\n    /*                                                                     */\r\n    /* Namely, the variable `acc' is a 16-bit accumulator containing the   */\r\n    /* last `loaded' bits from the input stream.  The bits are shifted to  */\r\n    /* the upmost position in `acc'.                                       */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    acc    = 0;  /* clear accumulator   */\r\n    loaded = 0;  /* no bits were loaded */\r\n\r\n    for ( height = source_height; height > 0; height-- )\r\n    {\r\n      FT_Byte*  cur   = line_buff;        /* current write cursor          */\r\n      FT_Int    count = line_bits;        /* # of bits to extract per line */\r\n      FT_Byte   shift = (FT_Byte)( x_offset & 7 ); /* current write shift  */\r\n      FT_Byte   space = (FT_Byte)( 8 - shift );\r\n\r\n\r\n      /* first of all, read individual source bytes */\r\n      if ( count >= 8 )\r\n      {\r\n        count -= 8;\r\n        {\r\n          do\r\n          {\r\n            FT_Byte  val;\r\n\r\n\r\n            /* ensure that there are at least 8 bits in the accumulator */\r\n            if ( loaded < 8 )\r\n            {\r\n              acc    |= (FT_UShort)((FT_UShort)*source++ << ( 8 - loaded ));\r\n              loaded += 8;\r\n            }\r\n\r\n            /* now write one byte */\r\n            val = (FT_Byte)( acc >> 8 );\r\n            if ( shift )\r\n            {\r\n              cur[0] |= (FT_Byte)( val >> shift );\r\n              cur[1] |= (FT_Byte)( val << space );\r\n            }\r\n            else\r\n              cur[0] |= val;\r\n\r\n            cur++;\r\n            acc   <<= 8;  /* remove bits from accumulator */\r\n            loaded -= 8;\r\n            count  -= 8;\r\n\r\n          } while ( count >= 0 );\r\n        }\r\n\r\n        /* restore `count' to correct value */\r\n        count += 8;\r\n      }\r\n\r\n      /* now write remaining bits (count < 8) */\r\n      if ( count > 0 )\r\n      {\r\n        FT_Byte  val;\r\n\r\n\r\n        /* ensure that there are at least `count' bits in the accumulator */\r\n        if ( (FT_Int)loaded < count )\r\n        {\r\n          acc    |= (FT_UShort)((FT_UShort)*source++ << ( 8 - loaded ));\r\n          loaded += 8;\r\n        }\r\n\r\n        /* now write remaining bits */\r\n        val     = (FT_Byte)( ( (FT_Byte)( acc >> 8 ) ) & ~( 0xFF >> count ) );\r\n        cur[0] |= (FT_Byte)( val >> shift );\r\n\r\n        if ( count > space )\r\n          cur[1] |= (FT_Byte)( val << space );\r\n\r\n        acc   <<= count;\r\n        loaded -= count;\r\n      }\r\n\r\n      /* now, skip to next line */\r\n      if ( byte_padded )\r\n      {\r\n        acc    = 0;\r\n        loaded = 0;   /* clear accumulator on byte-padded lines */\r\n      }\r\n\r\n      line_buff += line_incr;\r\n    }\r\n  }\r\n\r\n\r\n  static const FT_Frame_Field  sbit_metrics_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_SBit_MetricsRec\r\n\r\n    FT_FRAME_START( 8 ),\r\n      FT_FRAME_BYTE( height ),\r\n      FT_FRAME_BYTE( width ),\r\n\r\n      FT_FRAME_CHAR( horiBearingX ),\r\n      FT_FRAME_CHAR( horiBearingY ),\r\n      FT_FRAME_BYTE( horiAdvance ),\r\n\r\n      FT_FRAME_CHAR( vertBearingX ),\r\n      FT_FRAME_CHAR( vertBearingY ),\r\n      FT_FRAME_BYTE( vertAdvance ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Load_SBit_Const_Metrics                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the metrics for `EBLC' index tables format 2 and 5.          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    range  :: The target range.                                        */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  Load_SBit_Const_Metrics( TT_SBit_Range  range,\r\n                           FT_Stream      stream )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    if ( FT_READ_ULONG( range->image_size ) )\r\n      return error;\r\n\r\n    return FT_STREAM_READ_FIELDS( sbit_metrics_fields, &range->metrics );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Load_SBit_Range_Codes                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the range codes for `EBLC' index tables format 4 and 5.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    range        :: The target range.                                  */\r\n  /*                                                                       */\r\n  /*    stream       :: The input stream.                                  */\r\n  /*                                                                       */\r\n  /*    load_offsets :: A flag whether to load the glyph offset table.     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  Load_SBit_Range_Codes( TT_SBit_Range  range,\r\n                         FT_Stream      stream,\r\n                         FT_Bool        load_offsets )\r\n  {\r\n    FT_Error   error;\r\n    FT_ULong   count, n, size;\r\n    FT_Memory  memory = stream->memory;\r\n\r\n\r\n    if ( FT_READ_ULONG( count ) )\r\n      goto Exit;\r\n\r\n    range->num_glyphs = count;\r\n\r\n    /* Allocate glyph offsets table if needed */\r\n    if ( load_offsets )\r\n    {\r\n      if ( FT_NEW_ARRAY( range->glyph_offsets, count ) )\r\n        goto Exit;\r\n\r\n      size = count * 4L;\r\n    }\r\n    else\r\n      size = count * 2L;\r\n\r\n    /* Allocate glyph codes table and access frame */\r\n    if ( FT_NEW_ARRAY ( range->glyph_codes, count ) ||\r\n         FT_FRAME_ENTER( size )                     )\r\n      goto Exit;\r\n\r\n    for ( n = 0; n < count; n++ )\r\n    {\r\n      range->glyph_codes[n] = FT_GET_USHORT();\r\n\r\n      if ( load_offsets )\r\n        range->glyph_offsets[n] = (FT_ULong)range->image_offset +\r\n                                  FT_GET_USHORT();\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Load_SBit_Range                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads a given `EBLC' index/range table.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    range  :: The target range.                                        */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  Load_SBit_Range( TT_SBit_Range  range,\r\n                   FT_Stream      stream )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n\r\n\r\n    switch( range->index_format )\r\n    {\r\n    case 1:   /* variable metrics with 4-byte offsets */\r\n    case 3:   /* variable metrics with 2-byte offsets */\r\n      {\r\n        FT_ULong  num_glyphs, n;\r\n        FT_Int    size_elem;\r\n        FT_Bool   large = FT_BOOL( range->index_format == 1 );\r\n\r\n\r\n\r\n        if ( range->last_glyph < range->first_glyph )\r\n        {\r\n          error = SFNT_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        num_glyphs        = range->last_glyph - range->first_glyph + 1L;\r\n        range->num_glyphs = num_glyphs;\r\n        num_glyphs++;                       /* XXX: BEWARE - see spec */\r\n\r\n        size_elem = large ? 4 : 2;\r\n\r\n        if ( FT_NEW_ARRAY( range->glyph_offsets, num_glyphs ) ||\r\n             FT_FRAME_ENTER( num_glyphs * size_elem )         )\r\n          goto Exit;\r\n\r\n        for ( n = 0; n < num_glyphs; n++ )\r\n          range->glyph_offsets[n] = (FT_ULong)( range->image_offset +\r\n                                                ( large ? FT_GET_ULONG()\r\n                                                        : FT_GET_USHORT() ) );\r\n        FT_FRAME_EXIT();\r\n      }\r\n      break;\r\n\r\n    case 2:   /* all glyphs have identical metrics */\r\n      error = Load_SBit_Const_Metrics( range, stream );\r\n      break;\r\n\r\n    case 4:\r\n      error = Load_SBit_Range_Codes( range, stream, 1 );\r\n      break;\r\n\r\n    case 5:\r\n      error = Load_SBit_Const_Metrics( range, stream );\r\n      if ( !error )\r\n        error = Load_SBit_Range_Codes( range, stream, 0 );\r\n      break;\r\n\r\n    default:\r\n      error = SFNT_Err_Invalid_File_Format;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_eblc                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the table of embedded bitmap sizes for this face.            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: The target face object.                                  */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_eblc( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error   error  = SFNT_Err_Ok;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_Fixed   version;\r\n    FT_ULong   num_strikes;\r\n    FT_ULong   table_base;\r\n\r\n    static const FT_Frame_Field  sbit_line_metrics_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_SBit_LineMetricsRec\r\n\r\n      /* no FT_FRAME_START */\r\n        FT_FRAME_CHAR( ascender ),\r\n        FT_FRAME_CHAR( descender ),\r\n        FT_FRAME_BYTE( max_width ),\r\n\r\n        FT_FRAME_CHAR( caret_slope_numerator ),\r\n        FT_FRAME_CHAR( caret_slope_denominator ),\r\n        FT_FRAME_CHAR( caret_offset ),\r\n\r\n        FT_FRAME_CHAR( min_origin_SB ),\r\n        FT_FRAME_CHAR( min_advance_SB ),\r\n        FT_FRAME_CHAR( max_before_BL ),\r\n        FT_FRAME_CHAR( min_after_BL ),\r\n        FT_FRAME_CHAR( pads[0] ),\r\n        FT_FRAME_CHAR( pads[1] ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  strike_start_fields[] =\r\n    {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_SBit_StrikeRec\r\n\r\n      /* no FT_FRAME_START */\r\n        FT_FRAME_ULONG( ranges_offset ),\r\n        FT_FRAME_SKIP_LONG,\r\n        FT_FRAME_ULONG( num_ranges ),\r\n        FT_FRAME_ULONG( color_ref ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  strike_end_fields[] =\r\n    {\r\n      /* no FT_FRAME_START */\r\n        FT_FRAME_USHORT( start_glyph ),\r\n        FT_FRAME_USHORT( end_glyph ),\r\n        FT_FRAME_BYTE  ( x_ppem ),\r\n        FT_FRAME_BYTE  ( y_ppem ),\r\n        FT_FRAME_BYTE  ( bit_depth ),\r\n        FT_FRAME_CHAR  ( flags ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    face->num_sbit_strikes = 0;\r\n\r\n    /* this table is optional */\r\n    error = face->goto_table( face, TTAG_EBLC, stream, 0 );\r\n    if ( error )\r\n      error = face->goto_table( face, TTAG_bloc, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    table_base = FT_STREAM_POS();\r\n    if ( FT_FRAME_ENTER( 8L ) )\r\n      goto Exit;\r\n\r\n    version     = FT_GET_LONG();\r\n    num_strikes = FT_GET_ULONG();\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    /* check version number and strike count */\r\n    if ( version     != 0x00020000L ||\r\n         num_strikes >= 0x10000L    )\r\n    {\r\n      FT_ERROR(( \"tt_face_load_sbit_strikes: invalid table version\\n\" ));\r\n      error = SFNT_Err_Invalid_File_Format;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    /* allocate the strikes table */\r\n    if ( FT_NEW_ARRAY( face->sbit_strikes, num_strikes ) )\r\n      goto Exit;\r\n\r\n    face->num_sbit_strikes = num_strikes;\r\n\r\n    /* now read each strike table separately */\r\n    {\r\n      TT_SBit_Strike  strike = face->sbit_strikes;\r\n      FT_ULong        count  = num_strikes;\r\n\r\n\r\n      if ( FT_FRAME_ENTER( 48L * num_strikes ) )\r\n        goto Exit;\r\n\r\n      while ( count > 0 )\r\n      {\r\n        if ( FT_STREAM_READ_FIELDS( strike_start_fields, strike )             ||\r\n             FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->hori ) ||\r\n             FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->vert ) ||\r\n             FT_STREAM_READ_FIELDS( strike_end_fields, strike )               )\r\n          break;\r\n\r\n        count--;\r\n        strike++;\r\n      }\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n    /* allocate the index ranges for each strike table */\r\n    {\r\n      TT_SBit_Strike  strike = face->sbit_strikes;\r\n      FT_ULong        count  = num_strikes;\r\n\r\n\r\n      while ( count > 0 )\r\n      {\r\n        TT_SBit_Range  range;\r\n        FT_ULong       count2 = strike->num_ranges;\r\n\r\n\r\n        /* read each range */\r\n        if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) ||\r\n             FT_FRAME_ENTER( strike->num_ranges * 8L )            )\r\n          goto Exit;\r\n\r\n        if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) )\r\n          goto Exit;\r\n\r\n        range = strike->sbit_ranges;\r\n        while ( count2 > 0 )\r\n        {\r\n          range->first_glyph  = FT_GET_USHORT();\r\n          range->last_glyph   = FT_GET_USHORT();\r\n          range->table_offset = table_base + strike->ranges_offset +\r\n                                  FT_GET_ULONG();\r\n          count2--;\r\n          range++;\r\n        }\r\n\r\n        FT_FRAME_EXIT();\r\n\r\n        /* Now, read each index table */\r\n        count2 = strike->num_ranges;\r\n        range  = strike->sbit_ranges;\r\n        while ( count2 > 0 )\r\n        {\r\n          /* Read the header */\r\n          if ( FT_STREAM_SEEK( range->table_offset ) ||\r\n               FT_FRAME_ENTER( 8L )                  )\r\n            goto Exit;\r\n\r\n          range->index_format = FT_GET_USHORT();\r\n          range->image_format = FT_GET_USHORT();\r\n          range->image_offset = FT_GET_ULONG();\r\n\r\n          FT_FRAME_EXIT();\r\n\r\n          error = Load_SBit_Range( range, stream );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          count2--;\r\n          range++;\r\n        }\r\n\r\n        count--;\r\n        strike++;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_free_eblc                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Releases the embedded bitmap tables.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: The target face object.                                    */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_free_eblc( TT_Face  face )\r\n  {\r\n    FT_Memory       memory       = face->root.memory;\r\n    TT_SBit_Strike  strike       = face->sbit_strikes;\r\n    TT_SBit_Strike  strike_limit = strike + face->num_sbit_strikes;\r\n\r\n\r\n    if ( strike )\r\n    {\r\n      for ( ; strike < strike_limit; strike++ )\r\n      {\r\n        TT_SBit_Range  range       = strike->sbit_ranges;\r\n        TT_SBit_Range  range_limit = range + strike->num_ranges;\r\n\r\n\r\n        if ( range )\r\n        {\r\n          for ( ; range < range_limit; range++ )\r\n          {\r\n            /* release the glyph offsets and codes tables */\r\n            /* where appropriate                          */\r\n            FT_FREE( range->glyph_offsets );\r\n            FT_FREE( range->glyph_codes );\r\n          }\r\n        }\r\n        FT_FREE( strike->sbit_ranges );\r\n        strike->num_ranges = 0;\r\n      }\r\n      FT_FREE( face->sbit_strikes );\r\n    }\r\n    face->num_sbit_strikes = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_set_sbit_strike( TT_Face          face,\r\n                           FT_Size_Request  req,\r\n                           FT_ULong*        astrike_index )\r\n  {\r\n    return FT_Match_Size( (FT_Face)face, req, 0, astrike_index );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_strike_metrics( TT_Face           face,\r\n                               FT_ULong          strike_index,\r\n                               FT_Size_Metrics*  metrics )\r\n  {\r\n    TT_SBit_Strike  strike;\r\n\r\n\r\n    if ( strike_index >= face->num_sbit_strikes )\r\n      return SFNT_Err_Invalid_Argument;\r\n\r\n    strike = face->sbit_strikes + strike_index;\r\n\r\n    metrics->x_ppem = strike->x_ppem;\r\n    metrics->y_ppem = strike->y_ppem;\r\n\r\n    metrics->ascender  = strike->hori.ascender << 6;\r\n    metrics->descender = strike->hori.descender << 6;\r\n\r\n    /* XXX: Is this correct? */\r\n    metrics->max_advance = ( strike->hori.min_origin_SB  +\r\n                             strike->hori.max_width      +\r\n                             strike->hori.min_advance_SB ) << 6;\r\n\r\n    metrics->height = metrics->ascender - metrics->descender;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    find_sbit_range                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Scans a given strike's ranges and return, for a given glyph        */\r\n  /*    index, the corresponding sbit range, and `EBDT' offset.            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph_index   :: The glyph index.                                  */\r\n  /*                                                                       */\r\n  /*    strike        :: The source/current sbit strike.                   */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    arange        :: The sbit range containing the glyph index.        */\r\n  /*                                                                       */\r\n  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means the glyph index was found.           */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  find_sbit_range( FT_UInt          glyph_index,\r\n                   TT_SBit_Strike   strike,\r\n                   TT_SBit_Range   *arange,\r\n                   FT_ULong        *aglyph_offset )\r\n  {\r\n    TT_SBit_RangeRec  *range, *range_limit;\r\n\r\n\r\n    /* check whether the glyph index is within this strike's */\r\n    /* glyph range                                           */\r\n    if ( glyph_index < (FT_UInt)strike->start_glyph ||\r\n         glyph_index > (FT_UInt)strike->end_glyph   )\r\n      goto Fail;\r\n\r\n    /* scan all ranges in strike */\r\n    range       = strike->sbit_ranges;\r\n    range_limit = range + strike->num_ranges;\r\n    if ( !range )\r\n      goto Fail;\r\n\r\n    for ( ; range < range_limit; range++ )\r\n    {\r\n      if ( glyph_index >= (FT_UInt)range->first_glyph &&\r\n           glyph_index <= (FT_UInt)range->last_glyph  )\r\n      {\r\n        FT_UShort  delta = (FT_UShort)( glyph_index - range->first_glyph );\r\n\r\n\r\n        switch ( range->index_format )\r\n        {\r\n        case 1:\r\n        case 3:\r\n          *aglyph_offset = range->glyph_offsets[delta];\r\n          break;\r\n\r\n        case 2:\r\n          *aglyph_offset = range->image_offset +\r\n                           range->image_size * delta;\r\n          break;\r\n\r\n        case 4:\r\n        case 5:\r\n          {\r\n            FT_ULong  n;\r\n\r\n\r\n            for ( n = 0; n < range->num_glyphs; n++ )\r\n            {\r\n              if ( (FT_UInt)range->glyph_codes[n] == glyph_index )\r\n              {\r\n                if ( range->index_format == 4 )\r\n                  *aglyph_offset = range->glyph_offsets[n];\r\n                else\r\n                  *aglyph_offset = range->image_offset +\r\n                                   n * range->image_size;\r\n                goto Found;\r\n              }\r\n            }\r\n          }\r\n\r\n        /* fall-through */\r\n        default:\r\n          goto Fail;\r\n        }\r\n\r\n      Found:\r\n        /* return successfully! */\r\n        *arange  = range;\r\n        return SFNT_Err_Ok;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    *arange        = 0;\r\n    *aglyph_offset = 0;\r\n\r\n    return SFNT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_find_sbit_image                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Checks whether an embedded bitmap (an `sbit') exists for a given   */\r\n  /*    glyph, at a given strike.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    glyph_index   :: The glyph index.                                  */\r\n  /*                                                                       */\r\n  /*    strike_index  :: The current strike index.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    arange        :: The SBit range containing the glyph index.        */\r\n  /*                                                                       */\r\n  /*    astrike       :: The SBit strike containing the glyph index.       */\r\n  /*                                                                       */\r\n  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns                    */\r\n  /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */\r\n  /*    glyph.                                                             */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  tt_find_sbit_image( TT_Face          face,\r\n                      FT_UInt          glyph_index,\r\n                      FT_ULong         strike_index,\r\n                      TT_SBit_Range   *arange,\r\n                      TT_SBit_Strike  *astrike,\r\n                      FT_ULong        *aglyph_offset )\r\n  {\r\n    FT_Error        error;\r\n    TT_SBit_Strike  strike;\r\n\r\n\r\n    if ( !face->sbit_strikes                        ||\r\n         ( face->num_sbit_strikes <= strike_index ) )\r\n      goto Fail;\r\n\r\n    strike = &face->sbit_strikes[strike_index];\r\n\r\n    error = find_sbit_range( glyph_index, strike,\r\n                             arange, aglyph_offset );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    *astrike = strike;\r\n\r\n    return SFNT_Err_Ok;\r\n\r\n  Fail:\r\n    /* no embedded bitmap for this glyph in face */\r\n    *arange        = 0;\r\n    *astrike       = 0;\r\n    *aglyph_offset = 0;\r\n\r\n    return SFNT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_load_sbit_metrics                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Gets the big metrics for a given SBit.                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream      :: The input stream.                                   */\r\n  /*                                                                       */\r\n  /*    range       :: The SBit range containing the glyph.                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    big_metrics :: A big SBit metrics structure for the glyph.         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be positioned at the glyph's offset within  */\r\n  /*    the `EBDT' table before the call.                                  */\r\n  /*                                                                       */\r\n  /*    If the image format uses variable metrics, the stream cursor is    */\r\n  /*    positioned just after the metrics header in the `EBDT' table on    */\r\n  /*    function exit.                                                     */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  tt_load_sbit_metrics( FT_Stream        stream,\r\n                        TT_SBit_Range    range,\r\n                        TT_SBit_Metrics  metrics )\r\n  {\r\n    FT_Error  error = SFNT_Err_Ok;\r\n\r\n\r\n    switch ( range->image_format )\r\n    {\r\n    case 1:\r\n    case 2:\r\n    case 8:\r\n      /* variable small metrics */\r\n      {\r\n        TT_SBit_SmallMetricsRec  smetrics;\r\n\r\n        static const FT_Frame_Field  sbit_small_metrics_fields[] =\r\n        {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  TT_SBit_SmallMetricsRec\r\n\r\n          FT_FRAME_START( 5 ),\r\n            FT_FRAME_BYTE( height ),\r\n            FT_FRAME_BYTE( width ),\r\n            FT_FRAME_CHAR( bearingX ),\r\n            FT_FRAME_CHAR( bearingY ),\r\n            FT_FRAME_BYTE( advance ),\r\n          FT_FRAME_END\r\n        };\r\n\r\n\r\n        /* read small metrics */\r\n        if ( FT_STREAM_READ_FIELDS( sbit_small_metrics_fields, &smetrics ) )\r\n          goto Exit;\r\n\r\n        /* convert it to a big metrics */\r\n        metrics->height       = smetrics.height;\r\n        metrics->width        = smetrics.width;\r\n        metrics->horiBearingX = smetrics.bearingX;\r\n        metrics->horiBearingY = smetrics.bearingY;\r\n        metrics->horiAdvance  = smetrics.advance;\r\n\r\n        /* these metrics are made up at a higher level when */\r\n        /* needed.                                          */\r\n        metrics->vertBearingX = 0;\r\n        metrics->vertBearingY = 0;\r\n        metrics->vertAdvance  = 0;\r\n      }\r\n      break;\r\n\r\n    case 6:\r\n    case 7:\r\n    case 9:\r\n      /* variable big metrics */\r\n      if ( FT_STREAM_READ_FIELDS( sbit_metrics_fields, metrics ) )\r\n        goto Exit;\r\n      break;\r\n\r\n    case 5:\r\n    default:  /* constant metrics */\r\n      if ( range->index_format == 2 || range->index_format == 5 )\r\n        *metrics = range->metrics;\r\n      else\r\n        return SFNT_Err_Invalid_File_Format;\r\n   }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    crop_bitmap                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Crops a bitmap to its tightest bounding box, and adjusts its       */\r\n  /*    metrics.                                                           */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    map     :: The bitmap.                                             */\r\n  /*                                                                       */\r\n  /*    metrics :: The corresponding metrics structure.                    */\r\n  /*                                                                       */\r\n  static void\r\n  crop_bitmap( FT_Bitmap*       map,\r\n               TT_SBit_Metrics  metrics )\r\n  {\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* In this situation, some bounding boxes of embedded bitmaps are too  */\r\n    /* large.  We need to crop it to a reasonable size.                    */\r\n    /*                                                                     */\r\n    /*      ---------                                                      */\r\n    /*      |       |                -----                                 */\r\n    /*      |  ***  |                |***|                                 */\r\n    /*      |   *   |                | * |                                 */\r\n    /*      |   *   |    ------>     | * |                                 */\r\n    /*      |   *   |                | * |                                 */\r\n    /*      |   *   |                | * |                                 */\r\n    /*      |  ***  |                |***|                                 */\r\n    /*      ---------                -----                                 */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    FT_Int    rows, count;\r\n    FT_Long   line_len;\r\n    FT_Byte*  line;\r\n\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* first of all, check the top-most lines of the bitmap, and remove    */\r\n    /* them if they're empty.                                              */\r\n    /*                                                                     */\r\n    {\r\n      line     = (FT_Byte*)map->buffer;\r\n      rows     = map->rows;\r\n      line_len = map->pitch;\r\n\r\n\r\n      for ( count = 0; count < rows; count++ )\r\n      {\r\n        FT_Byte*  cur   = line;\r\n        FT_Byte*  limit = line + line_len;\r\n\r\n\r\n        for ( ; cur < limit; cur++ )\r\n          if ( cur[0] )\r\n            goto Found_Top;\r\n\r\n        /* the current line was empty - skip to next one */\r\n        line  = limit;\r\n      }\r\n\r\n    Found_Top:\r\n      /* check that we have at least one filled line */\r\n      if ( count >= rows )\r\n        goto Empty_Bitmap;\r\n\r\n      /* now, crop the empty upper lines */\r\n      if ( count > 0 )\r\n      {\r\n        line = (FT_Byte*)map->buffer;\r\n\r\n        FT_MEM_MOVE( line, line + count * line_len,\r\n                     ( rows - count ) * line_len );\r\n\r\n        metrics->height       = (FT_Byte)( metrics->height - count );\r\n        metrics->horiBearingY = (FT_Char)( metrics->horiBearingY - count );\r\n        metrics->vertBearingY = (FT_Char)( metrics->vertBearingY - count );\r\n\r\n        map->rows -= count;\r\n        rows      -= count;\r\n      }\r\n    }\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* second, crop the lower lines                                        */\r\n    /*                                                                     */\r\n    {\r\n      line = (FT_Byte*)map->buffer + ( rows - 1 ) * line_len;\r\n\r\n      for ( count = 0; count < rows; count++ )\r\n      {\r\n        FT_Byte*  cur   = line;\r\n        FT_Byte*  limit = line + line_len;\r\n\r\n\r\n        for ( ; cur < limit; cur++ )\r\n          if ( cur[0] )\r\n            goto Found_Bottom;\r\n\r\n        /* the current line was empty - skip to previous one */\r\n        line -= line_len;\r\n      }\r\n\r\n    Found_Bottom:\r\n      if ( count > 0 )\r\n      {\r\n        metrics->height  = (FT_Byte)( metrics->height - count );\r\n        rows            -= count;\r\n        map->rows       -= count;\r\n      }\r\n    }\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* third, get rid of the space on the left side of the glyph           */\r\n    /*                                                                     */\r\n    do\r\n    {\r\n      FT_Byte*  limit;\r\n\r\n\r\n      line  = (FT_Byte*)map->buffer;\r\n      limit = line + rows * line_len;\r\n\r\n      for ( ; line < limit; line += line_len )\r\n        if ( line[0] & 0x80 )\r\n          goto Found_Left;\r\n\r\n      /* shift the whole glyph one pixel to the left */\r\n      line  = (FT_Byte*)map->buffer;\r\n      limit = line + rows * line_len;\r\n\r\n      for ( ; line < limit; line += line_len )\r\n      {\r\n        FT_Int    n, width = map->width;\r\n        FT_Byte   old;\r\n        FT_Byte*  cur = line;\r\n\r\n\r\n        old = (FT_Byte)(cur[0] << 1);\r\n        for ( n = 8; n < width; n += 8 )\r\n        {\r\n          FT_Byte  val;\r\n\r\n\r\n          val    = cur[1];\r\n          cur[0] = (FT_Byte)( old | ( val >> 7 ) );\r\n          old    = (FT_Byte)( val << 1 );\r\n          cur++;\r\n        }\r\n        cur[0] = old;\r\n      }\r\n\r\n      map->width--;\r\n      metrics->horiBearingX++;\r\n      metrics->vertBearingX++;\r\n      metrics->width--;\r\n\r\n    } while ( map->width > 0 );\r\n\r\n  Found_Left:\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* finally, crop the bitmap width to get rid of the space on the right */\r\n    /* side of the glyph.                                                  */\r\n    /*                                                                     */\r\n    do\r\n    {\r\n      FT_Int    right = map->width - 1;\r\n      FT_Byte*  limit;\r\n      FT_Byte   mask;\r\n\r\n\r\n      line  = (FT_Byte*)map->buffer + ( right >> 3 );\r\n      limit = line + rows * line_len;\r\n      mask  = (FT_Byte)( 0x80 >> ( right & 7 ) );\r\n\r\n      for ( ; line < limit; line += line_len )\r\n        if ( line[0] & mask )\r\n          goto Found_Right;\r\n\r\n      /* crop the whole glyph to the right */\r\n      map->width--;\r\n      metrics->width--;\r\n\r\n    } while ( map->width > 0 );\r\n\r\n  Found_Right:\r\n    /* all right, the bitmap was cropped */\r\n    return;\r\n\r\n  Empty_Bitmap:\r\n    map->width      = 0;\r\n    map->rows       = 0;\r\n    map->pitch      = 0;\r\n    map->pixel_mode = FT_PIXEL_MODE_MONO;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  Load_SBit_Single( FT_Bitmap*       map,\r\n                    FT_Int           x_offset,\r\n                    FT_Int           y_offset,\r\n                    FT_Int           pix_bits,\r\n                    FT_UShort        image_format,\r\n                    TT_SBit_Metrics  metrics,\r\n                    FT_Stream        stream )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    /* check that the source bitmap fits into the target pixmap */\r\n    if ( x_offset < 0 || x_offset + metrics->width  > map->width ||\r\n         y_offset < 0 || y_offset + metrics->height > map->rows  )\r\n    {\r\n      error = SFNT_Err_Invalid_Argument;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    {\r\n      FT_Int   glyph_width  = metrics->width;\r\n      FT_Int   glyph_height = metrics->height;\r\n      FT_Int   glyph_size;\r\n      FT_Int   line_bits    = pix_bits * glyph_width;\r\n      FT_Bool  pad_bytes    = 0;\r\n\r\n\r\n      /* compute size of glyph image */\r\n      switch ( image_format )\r\n      {\r\n      case 1:  /* byte-padded formats */\r\n      case 6:\r\n        {\r\n          FT_Int  line_length;\r\n\r\n\r\n          switch ( pix_bits )\r\n          {\r\n          case 1:\r\n            line_length = ( glyph_width + 7 ) >> 3;\r\n            break;\r\n          case 2:\r\n            line_length = ( glyph_width + 3 ) >> 2;\r\n            break;\r\n          case 4:\r\n            line_length = ( glyph_width + 1 ) >> 1;\r\n            break;\r\n          default:\r\n            line_length =   glyph_width;\r\n          }\r\n\r\n          glyph_size = glyph_height * line_length;\r\n          pad_bytes  = 1;\r\n        }\r\n        break;\r\n\r\n      case 2:\r\n      case 5:\r\n      case 7:\r\n        line_bits  =   glyph_width  * pix_bits;\r\n        glyph_size = ( glyph_height * line_bits + 7 ) >> 3;\r\n        break;\r\n\r\n      default:  /* invalid format */\r\n        return SFNT_Err_Invalid_File_Format;\r\n      }\r\n\r\n      /* Now read data and draw glyph into target pixmap       */\r\n      if ( FT_FRAME_ENTER( glyph_size ) )\r\n        goto Exit;\r\n\r\n      /* don't forget to multiply `x_offset' by `map->pix_bits' as */\r\n      /* the sbit blitter doesn't make a difference between pixmap */\r\n      /* depths.                                                   */\r\n      blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,\r\n                 x_offset * pix_bits, y_offset, metrics->height );\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  Load_SBit_Image( TT_SBit_Strike   strike,\r\n                   TT_SBit_Range    range,\r\n                   FT_ULong         ebdt_pos,\r\n                   FT_ULong         glyph_offset,\r\n                   FT_GlyphSlot     slot,\r\n                   FT_Int           x_offset,\r\n                   FT_Int           y_offset,\r\n                   FT_Stream        stream,\r\n                   TT_SBit_Metrics  metrics,\r\n                   FT_Int           depth )\r\n  {\r\n    FT_Memory   memory = stream->memory;\r\n    FT_Bitmap*  map    = &slot->bitmap;\r\n    FT_Error    error;\r\n\r\n\r\n    /* place stream at beginning of glyph data and read metrics */\r\n    if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) )\r\n      goto Exit;\r\n\r\n    error = tt_load_sbit_metrics( stream, range, metrics );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* This function is recursive.  At the top-level call, we  */\r\n    /* compute the dimensions of the higher-level glyph to     */\r\n    /* allocate the final pixmap buffer.                       */\r\n    if ( depth == 0 )\r\n    {\r\n      FT_Long  size;\r\n\r\n\r\n      map->width = metrics->width;\r\n      map->rows  = metrics->height;\r\n\r\n      switch ( strike->bit_depth )\r\n      {\r\n      case 1:\r\n        map->pixel_mode = FT_PIXEL_MODE_MONO;\r\n        map->pitch      = ( map->width + 7 ) >> 3;\r\n        break;\r\n\r\n      case 2:\r\n        map->pixel_mode = FT_PIXEL_MODE_GRAY2;\r\n        map->pitch      = ( map->width + 3 ) >> 2;\r\n        break;\r\n\r\n      case 4:\r\n        map->pixel_mode = FT_PIXEL_MODE_GRAY4;\r\n        map->pitch      = ( map->width + 1 ) >> 1;\r\n        break;\r\n\r\n      case 8:\r\n        map->pixel_mode = FT_PIXEL_MODE_GRAY;\r\n        map->pitch      = map->width;\r\n        break;\r\n\r\n      default:\r\n        return SFNT_Err_Invalid_File_Format;\r\n      }\r\n\r\n      size = map->rows * map->pitch;\r\n\r\n      /* check that there is no empty image */\r\n      if ( size == 0 )\r\n        goto Exit;     /* exit successfully! */\r\n\r\n      error = ft_glyphslot_alloc_bitmap( slot, size );\r\n      if (error)\r\n        goto Exit;\r\n    }\r\n\r\n    switch ( range->image_format )\r\n    {\r\n    case 1:  /* single sbit image - load it */\r\n    case 2:\r\n    case 5:\r\n    case 6:\r\n    case 7:\r\n      return Load_SBit_Single( map, x_offset, y_offset, strike->bit_depth,\r\n                               range->image_format, metrics, stream );\r\n\r\n    case 8:  /* compound format */\r\n      if ( FT_STREAM_SKIP( 1L ) )\r\n      {\r\n        error = SFNT_Err_Invalid_Stream_Skip;\r\n        goto Exit;\r\n      }\r\n      /* fallthrough */\r\n\r\n    case 9:\r\n      break;\r\n\r\n    default: /* invalid image format */\r\n      return SFNT_Err_Invalid_File_Format;\r\n    }\r\n\r\n    /* All right, we have a compound format.  First of all, read */\r\n    /* the array of elements.                                    */\r\n    {\r\n      TT_SBit_Component  components = NULL;\r\n      TT_SBit_Component  comp;\r\n      FT_UShort          num_components, count;\r\n\r\n\r\n      if ( FT_READ_USHORT( num_components )           ||\r\n           FT_NEW_ARRAY( components, num_components ) )\r\n        goto Exit;\r\n\r\n      count = num_components;\r\n\r\n      if ( FT_FRAME_ENTER( 4L * num_components ) )\r\n        goto Fail_Memory;\r\n\r\n      for ( comp = components; count > 0; count--, comp++ )\r\n      {\r\n        comp->glyph_code = FT_GET_USHORT();\r\n        comp->x_offset   = FT_GET_CHAR();\r\n        comp->y_offset   = FT_GET_CHAR();\r\n      }\r\n\r\n      FT_FRAME_EXIT();\r\n\r\n      /* Now recursively load each element glyph */\r\n      count = num_components;\r\n      comp  = components;\r\n      for ( ; count > 0; count--, comp++ )\r\n      {\r\n        TT_SBit_Range       elem_range;\r\n        TT_SBit_MetricsRec  elem_metrics;\r\n        FT_ULong            elem_offset;\r\n\r\n\r\n        /* find the range for this element */\r\n        error = find_sbit_range( comp->glyph_code,\r\n                                 strike,\r\n                                 &elem_range,\r\n                                 &elem_offset );\r\n        if ( error )\r\n          goto Fail_Memory;\r\n\r\n        /* now load the element, recursively */\r\n        error = Load_SBit_Image( strike,\r\n                                 elem_range,\r\n                                 ebdt_pos,\r\n                                 elem_offset,\r\n                                 slot,\r\n                                 x_offset + comp->x_offset,\r\n                                 y_offset + comp->y_offset,\r\n                                 stream,\r\n                                 &elem_metrics,\r\n                                 depth + 1 );\r\n        if ( error )\r\n          goto Fail_Memory;\r\n      }\r\n\r\n    Fail_Memory:\r\n      FT_FREE( components );\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_sbit_image                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads a given glyph sbit image from the font resource.  This also  */\r\n  /*    returns its metrics.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face         :: The target face object.                            */\r\n  /*                                                                       */\r\n  /*    strike_index :: The current strike index.                          */\r\n  /*                                                                       */\r\n  /*    glyph_index  :: The current glyph index.                           */\r\n  /*                                                                       */\r\n  /*    load_flags   :: The glyph load flags (the code checks for the flag */\r\n  /*                    FT_LOAD_CROP_BITMAP).                              */\r\n  /*                                                                       */\r\n  /*    stream       :: The input stream.                                  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    map          :: The target pixmap.                                 */\r\n  /*                                                                       */\r\n  /*    metrics      :: A big sbit metrics structure for the glyph image.  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    glyph sbit exists for the index.                                   */\r\n  /*                                                                       */\r\n  /*  <Note>                                                               */\r\n  /*    The `map.buffer' field is always freed before the glyph is loaded. */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_sbit_image( TT_Face              face,\r\n                           FT_ULong             strike_index,\r\n                           FT_UInt              glyph_index,\r\n                           FT_UInt              load_flags,\r\n                           FT_Stream            stream,\r\n                           FT_Bitmap           *map,\r\n                           TT_SBit_MetricsRec  *metrics )\r\n  {\r\n    FT_Error        error;\r\n    FT_ULong        ebdt_pos, glyph_offset;\r\n\r\n    TT_SBit_Strike  strike;\r\n    TT_SBit_Range   range;\r\n\r\n\r\n    /* Check whether there is a glyph sbit for the current index */\r\n    error = tt_find_sbit_image( face, glyph_index, strike_index,\r\n                                &range, &strike, &glyph_offset );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* now, find the location of the `EBDT' table in */\r\n    /* the font file                                 */\r\n    error = face->goto_table( face, TTAG_EBDT, stream, 0 );\r\n    if ( error )\r\n      error = face->goto_table( face, TTAG_bdat, stream, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    ebdt_pos = FT_STREAM_POS();\r\n\r\n    error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,\r\n                             face->root.glyph, 0, 0, stream, metrics, 0 );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* setup vertical metrics if needed */\r\n    if ( strike->flags & 1 )\r\n    {\r\n      /* in case of a horizontal strike only */\r\n      FT_Int  advance;\r\n\r\n\r\n      advance = strike->hori.ascender - strike->hori.descender;\r\n\r\n      /* some heuristic values */\r\n\r\n      metrics->vertBearingX = (FT_Char)(-metrics->width / 2 );\r\n      metrics->vertBearingY = (FT_Char)( ( advance - metrics->height ) / 2 );\r\n      metrics->vertAdvance  = (FT_Char)( advance * 12 / 10 );\r\n    }\r\n\r\n    /* Crop the bitmap now, unless specified otherwise */\r\n    if ( load_flags & FT_LOAD_CROP_BITMAP )\r\n      crop_bitmap( map, metrics );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttsbit.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttsbit.h                                                               */\r\n/*                                                                         */\r\n/*    TrueType and OpenType embedded bitmap support (specification).       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTSBIT_H__\r\n#define __TTSBIT_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ttload.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_eblc( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_free_eblc( TT_Face  face );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_set_sbit_strike( TT_Face          face,\r\n                           FT_Size_Request  req,\r\n                           FT_ULong*        astrike_index );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_strike_metrics( TT_Face           face,\r\n                               FT_ULong          strike_index,\r\n                               FT_Size_Metrics*  metrics );\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n  FT_LOCAL( FT_Error )\r\n  tt_find_sbit_image( TT_Face          face,\r\n                      FT_UInt          glyph_index,\r\n                      FT_ULong         strike_index,\r\n                      TT_SBit_Range   *arange,\r\n                      TT_SBit_Strike  *astrike,\r\n                      FT_ULong        *aglyph_offset );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_load_sbit_metrics( FT_Stream        stream,\r\n                        TT_SBit_Range    range,\r\n                        TT_SBit_Metrics  metrics );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_sbit_image( TT_Face              face,\r\n                           FT_ULong             strike_index,\r\n                           FT_UInt              glyph_index,\r\n                           FT_UInt              load_flags,\r\n                           FT_Stream            stream,\r\n                           FT_Bitmap           *map,\r\n                           TT_SBit_MetricsRec  *metrics );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTSBIT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/sfnt/ttsbit0.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttsbit0.c                                                              */\r\n/*                                                                         */\r\n/*    TrueType and OpenType embedded bitmap support (body).                */\r\n/*    This is a heap-optimized version.                                    */\r\n/*                                                                         */\r\n/*  Copyright 2005, 2006, 2007, 2008, 2009 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/* This file is included by ttsbit.c */\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include \"ttsbit.h\"\r\n\r\n#include \"sferrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttsbit\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_eblc( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error  error = SFNT_Err_Ok;\r\n    FT_Fixed  version;\r\n    FT_ULong  num_strikes, table_size;\r\n    FT_Byte*  p;\r\n    FT_Byte*  p_limit;\r\n    FT_UInt   count;\r\n\r\n\r\n    face->sbit_num_strikes = 0;\r\n\r\n    /* this table is optional */\r\n    error = face->goto_table( face, TTAG_EBLC, stream, &table_size );\r\n    if ( error )\r\n      error = face->goto_table( face, TTAG_bloc, stream, &table_size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( table_size < 8 )\r\n    {\r\n      FT_ERROR(( \"tt_face_load_sbit_strikes: table too short\\n\" ));\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) )\r\n      goto Exit;\r\n\r\n    face->sbit_table_size = table_size;\r\n\r\n    p       = face->sbit_table;\r\n    p_limit = p + table_size;\r\n\r\n    version     = FT_NEXT_ULONG( p );\r\n    num_strikes = FT_NEXT_ULONG( p );\r\n\r\n    if ( version != 0x00020000UL || num_strikes >= 0x10000UL )\r\n    {\r\n      FT_ERROR(( \"tt_face_load_sbit_strikes: invalid table version\\n\" ));\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    /*\r\n     *  Count the number of strikes available in the table.  We are a bit\r\n     *  paranoid there and don't trust the data.\r\n     */\r\n    count = (FT_UInt)num_strikes;\r\n    if ( 8 + 48UL * count > table_size )\r\n      count = (FT_UInt)( ( p_limit - p ) / 48 );\r\n\r\n    face->sbit_num_strikes = count;\r\n\r\n    FT_TRACE3(( \"sbit_num_strikes: %u\\n\", count ));\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    FT_FRAME_RELEASE( face->sbit_table );\r\n    face->sbit_table_size = 0;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_free_eblc( TT_Face  face )\r\n  {\r\n    FT_Stream  stream = face->root.stream;\r\n\r\n\r\n    FT_FRAME_RELEASE( face->sbit_table );\r\n    face->sbit_table_size  = 0;\r\n    face->sbit_num_strikes = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_set_sbit_strike( TT_Face          face,\r\n                           FT_Size_Request  req,\r\n                           FT_ULong*        astrike_index )\r\n  {\r\n    return FT_Match_Size( (FT_Face)face, req, 0, astrike_index );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_strike_metrics( TT_Face           face,\r\n                               FT_ULong          strike_index,\r\n                               FT_Size_Metrics*  metrics )\r\n  {\r\n    FT_Byte*  strike;\r\n\r\n\r\n    if ( strike_index >= (FT_ULong)face->sbit_num_strikes )\r\n      return SFNT_Err_Invalid_Argument;\r\n\r\n    strike = face->sbit_table + 8 + strike_index * 48;\r\n\r\n    metrics->x_ppem = (FT_UShort)strike[44];\r\n    metrics->y_ppem = (FT_UShort)strike[45];\r\n\r\n    metrics->ascender  = (FT_Char)strike[16] << 6;  /* hori.ascender  */\r\n    metrics->descender = (FT_Char)strike[17] << 6;  /* hori.descender */\r\n    metrics->height    = metrics->ascender - metrics->descender;\r\n\r\n    /* XXX: Is this correct? */\r\n    metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB  */\r\n                                      strike[18] + /* max_width      */\r\n                             (FT_Char)strike[23]   /* min_advance_SB */\r\n                                                 ) << 6;\r\n\r\n    return SFNT_Err_Ok;\r\n  }\r\n\r\n\r\n  typedef struct  TT_SBitDecoderRec_\r\n  {\r\n    TT_Face          face;\r\n    FT_Stream        stream;\r\n    FT_Bitmap*       bitmap;\r\n    TT_SBit_Metrics  metrics;\r\n    FT_Bool          metrics_loaded;\r\n    FT_Bool          bitmap_allocated;\r\n    FT_Byte          bit_depth;\r\n\r\n    FT_ULong         ebdt_start;\r\n    FT_ULong         ebdt_size;\r\n\r\n    FT_ULong         strike_index_array;\r\n    FT_ULong         strike_index_count;\r\n    FT_Byte*         eblc_base;\r\n    FT_Byte*         eblc_limit;\r\n\r\n  } TT_SBitDecoderRec, *TT_SBitDecoder;\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_init( TT_SBitDecoder       decoder,\r\n                        TT_Face              face,\r\n                        FT_ULong             strike_index,\r\n                        TT_SBit_MetricsRec*  metrics )\r\n  {\r\n    FT_Error   error;\r\n    FT_Stream  stream = face->root.stream;\r\n    FT_ULong   ebdt_size;\r\n\r\n\r\n    error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );\r\n    if ( error )\r\n      error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    decoder->face    = face;\r\n    decoder->stream  = stream;\r\n    decoder->bitmap  = &face->root.glyph->bitmap;\r\n    decoder->metrics = metrics;\r\n\r\n    decoder->metrics_loaded   = 0;\r\n    decoder->bitmap_allocated = 0;\r\n\r\n    decoder->ebdt_start = FT_STREAM_POS();\r\n    decoder->ebdt_size  = ebdt_size;\r\n\r\n    decoder->eblc_base  = face->sbit_table;\r\n    decoder->eblc_limit = face->sbit_table + face->sbit_table_size;\r\n\r\n    /* now find the strike corresponding to the index */\r\n    {\r\n      FT_Byte*  p;\r\n\r\n\r\n      if ( 8 + 48 * strike_index + 3 * 4 + 34 + 1 > face->sbit_table_size )\r\n      {\r\n        error = SFNT_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      p = decoder->eblc_base + 8 + 48 * strike_index;\r\n\r\n      decoder->strike_index_array = FT_NEXT_ULONG( p );\r\n      p                          += 4;\r\n      decoder->strike_index_count = FT_NEXT_ULONG( p );\r\n      p                          += 34;\r\n      decoder->bit_depth          = *p;\r\n\r\n      if ( decoder->strike_index_array > face->sbit_table_size             ||\r\n           decoder->strike_index_array + 8 * decoder->strike_index_count >\r\n             face->sbit_table_size                                         )\r\n        error = SFNT_Err_Invalid_File_Format;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  tt_sbit_decoder_done( TT_SBitDecoder  decoder )\r\n  {\r\n    FT_UNUSED( decoder );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder  decoder )\r\n  {\r\n    FT_Error    error = SFNT_Err_Ok;\r\n    FT_UInt     width, height;\r\n    FT_Bitmap*  map = decoder->bitmap;\r\n    FT_Long     size;\r\n\r\n\r\n    if ( !decoder->metrics_loaded )\r\n    {\r\n      error = SFNT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    width  = decoder->metrics->width;\r\n    height = decoder->metrics->height;\r\n\r\n    map->width = (int)width;\r\n    map->rows  = (int)height;\r\n\r\n    switch ( decoder->bit_depth )\r\n    {\r\n    case 1:\r\n      map->pixel_mode = FT_PIXEL_MODE_MONO;\r\n      map->pitch      = ( map->width + 7 ) >> 3;\r\n      break;\r\n\r\n    case 2:\r\n      map->pixel_mode = FT_PIXEL_MODE_GRAY2;\r\n      map->pitch      = ( map->width + 3 ) >> 2;\r\n      break;\r\n\r\n    case 4:\r\n      map->pixel_mode = FT_PIXEL_MODE_GRAY4;\r\n      map->pitch      = ( map->width + 1 ) >> 1;\r\n      break;\r\n\r\n    case 8:\r\n      map->pixel_mode = FT_PIXEL_MODE_GRAY;\r\n      map->pitch      = map->width;\r\n      break;\r\n\r\n    default:\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    size = map->rows * map->pitch;\r\n\r\n    /* check that there is no empty image */\r\n    if ( size == 0 )\r\n      goto Exit;     /* exit successfully! */\r\n\r\n    error = ft_glyphslot_alloc_bitmap( decoder->face->root.glyph, size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    decoder->bitmap_allocated = 1;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_load_metrics( TT_SBitDecoder  decoder,\r\n                                FT_Byte*       *pp,\r\n                                FT_Byte*        limit,\r\n                                FT_Bool         big )\r\n  {\r\n    FT_Byte*         p       = *pp;\r\n    TT_SBit_Metrics  metrics = decoder->metrics;\r\n\r\n\r\n    if ( p + 5 > limit )\r\n      goto Fail;\r\n\r\n    metrics->height       = p[0];\r\n    metrics->width        = p[1];\r\n    metrics->horiBearingX = (FT_Char)p[2];\r\n    metrics->horiBearingY = (FT_Char)p[3];\r\n    metrics->horiAdvance  = p[4];\r\n\r\n    p += 5;\r\n    if ( big )\r\n    {\r\n      if ( p + 3 > limit )\r\n        goto Fail;\r\n\r\n      metrics->vertBearingX = (FT_Char)p[0];\r\n      metrics->vertBearingY = (FT_Char)p[1];\r\n      metrics->vertAdvance  = p[2];\r\n\r\n      p += 3;\r\n    }\r\n\r\n    decoder->metrics_loaded = 1;\r\n    *pp = p;\r\n    return SFNT_Err_Ok;\r\n\r\n  Fail:\r\n    return SFNT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  /* forward declaration */\r\n  static FT_Error\r\n  tt_sbit_decoder_load_image( TT_SBitDecoder  decoder,\r\n                              FT_UInt         glyph_index,\r\n                              FT_Int          x_pos,\r\n                              FT_Int          y_pos );\r\n\r\n  typedef FT_Error  (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder  decoder,\r\n                                                FT_Byte*        p,\r\n                                                FT_Byte*        plimit,\r\n                                                FT_Int          x_pos,\r\n                                                FT_Int          y_pos );\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder  decoder,\r\n                                     FT_Byte*        p,\r\n                                     FT_Byte*        limit,\r\n                                     FT_Int          x_pos,\r\n                                     FT_Int          y_pos )\r\n  {\r\n    FT_Error    error = SFNT_Err_Ok;\r\n    FT_Byte*    line;\r\n    FT_Int      bit_height, bit_width, pitch, width, height, h;\r\n    FT_Bitmap*  bitmap;\r\n\r\n\r\n    if ( !decoder->bitmap_allocated )\r\n    {\r\n      error = tt_sbit_decoder_alloc_bitmap( decoder );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* check that we can write the glyph into the bitmap */\r\n    bitmap     = decoder->bitmap;\r\n    bit_width  = bitmap->width;\r\n    bit_height = bitmap->rows;\r\n    pitch      = bitmap->pitch;\r\n    line       = bitmap->buffer;\r\n\r\n    width  = decoder->metrics->width;\r\n    height = decoder->metrics->height;\r\n\r\n    if ( x_pos < 0 || x_pos + width > bit_width   ||\r\n         y_pos < 0 || y_pos + height > bit_height )\r\n    {\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( p + ( ( width + 7 ) >> 3 ) * height > limit )\r\n    {\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now do the blit */\r\n    line  += y_pos * pitch + ( x_pos >> 3 );\r\n    x_pos &= 7;\r\n\r\n    if ( x_pos == 0 )  /* the easy one */\r\n    {\r\n      for ( h = height; h > 0; h--, line += pitch )\r\n      {\r\n        FT_Byte*  write = line;\r\n        FT_Int    w;\r\n\r\n\r\n        for ( w = width; w >= 8; w -= 8 )\r\n        {\r\n          write[0] = (FT_Byte)( write[0] | *p++ );\r\n          write   += 1;\r\n        }\r\n\r\n        if ( w > 0 )\r\n          write[0] = (FT_Byte)( write[0] | ( *p++ & ( 0xFF00U >> w ) ) );\r\n      }\r\n    }\r\n    else  /* x_pos > 0 */\r\n    {\r\n      for ( h = height; h > 0; h--, line += pitch )\r\n      {\r\n        FT_Byte*  write = line;\r\n        FT_Int    w;\r\n        FT_UInt   wval = 0;\r\n\r\n\r\n        for ( w = width; w >= 8; w -= 8 )\r\n        {\r\n          wval      = (FT_UInt)( wval | *p++ );\r\n          write[0]  = (FT_Byte)( write[0] | ( wval >> x_pos ) );\r\n          write    += 1;\r\n          wval    <<= 8;\r\n        }\r\n\r\n        if ( w > 0 )\r\n          wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );\r\n\r\n        /* all bits read and there are `x_pos + w' bits to be written */\r\n\r\n        write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );\r\n\r\n        if ( x_pos + w > 8 )\r\n        {\r\n          write++;\r\n          wval   <<= 8;\r\n          write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*\r\n   * Load a bit-aligned bitmap (with pointer `p') into a line-aligned bitmap\r\n   * (with pointer `write').  In the example below, the width is 3 pixel,\r\n   * and `x_pos' is 1 pixel.\r\n   *\r\n   *       p                               p+1\r\n   *     |                               |                               |\r\n   *     | 7   6   5   4   3   2   1   0 | 7   6   5   4   3   2   1   0 |...\r\n   *     |                               |                               |\r\n   *       +-------+   +-------+   +-------+ ...\r\n   *           .           .           .\r\n   *           .           .           .\r\n   *           v           .           .\r\n   *       +-------+       .           .\r\n   * |                               | .\r\n   * | 7   6   5   4   3   2   1   0 | .\r\n   * |                               | .\r\n   *   write               .           .\r\n   *                       .           .\r\n   *                       v           .\r\n   *                   +-------+       .\r\n   *             |                               |\r\n   *             | 7   6   5   4   3   2   1   0 |\r\n   *             |                               |\r\n   *               write+1             .\r\n   *                                   .\r\n   *                                   v\r\n   *                               +-------+\r\n   *                         |                               |\r\n   *                         | 7   6   5   4   3   2   1   0 |\r\n   *                         |                               |\r\n   *                           write+2\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder  decoder,\r\n                                    FT_Byte*        p,\r\n                                    FT_Byte*        limit,\r\n                                    FT_Int          x_pos,\r\n                                    FT_Int          y_pos )\r\n  {\r\n    FT_Error    error = SFNT_Err_Ok;\r\n    FT_Byte*    line;\r\n    FT_Int      bit_height, bit_width, pitch, width, height, h, nbits;\r\n    FT_Bitmap*  bitmap;\r\n    FT_UShort   rval;\r\n\r\n\r\n    if ( !decoder->bitmap_allocated )\r\n    {\r\n      error = tt_sbit_decoder_alloc_bitmap( decoder );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* check that we can write the glyph into the bitmap */\r\n    bitmap     = decoder->bitmap;\r\n    bit_width  = bitmap->width;\r\n    bit_height = bitmap->rows;\r\n    pitch      = bitmap->pitch;\r\n    line       = bitmap->buffer;\r\n\r\n    width  = decoder->metrics->width;\r\n    height = decoder->metrics->height;\r\n\r\n    if ( x_pos < 0 || x_pos + width  > bit_width  ||\r\n         y_pos < 0 || y_pos + height > bit_height )\r\n    {\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( p + ( ( width * height + 7 ) >> 3 ) > limit )\r\n    {\r\n      error = SFNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now do the blit */\r\n\r\n    /* adjust `line' to point to the first byte of the bitmap */\r\n    line  += y_pos * pitch + ( x_pos >> 3 );\r\n    x_pos &= 7;\r\n\r\n    /* the higher byte of `rval' is used as a buffer */\r\n    rval  = 0;\r\n    nbits = 0;\r\n\r\n    for ( h = height; h > 0; h--, line += pitch )\r\n    {\r\n      FT_Byte*  write = line;\r\n      FT_Int    w     = width;\r\n\r\n\r\n      /* handle initial byte (in target bitmap) specially if necessary */\r\n      if ( x_pos )\r\n      {\r\n        w = ( width < 8 - x_pos ) ? width : 8 - x_pos;\r\n\r\n        if ( h == height )\r\n        {\r\n          rval  = *p++;\r\n          nbits = x_pos;\r\n        }\r\n        else if ( nbits < w )\r\n        {\r\n          if ( p < limit )\r\n            rval |= *p++;\r\n          nbits += 8 - w;\r\n        }\r\n        else\r\n        {\r\n          rval  >>= 8;\r\n          nbits  -= w;\r\n        }\r\n\r\n        *write++ |= ( ( rval >> nbits ) & 0xFF ) &\r\n                    ( ~( 0xFF << w ) << ( 8 - w - x_pos ) );\r\n        rval    <<= 8;\r\n\r\n        w = width - w;\r\n      }\r\n\r\n      /* handle medial bytes */\r\n      for ( ; w >= 8; w -= 8 )\r\n      {\r\n        rval     |= *p++;\r\n        *write++ |= ( rval >> nbits ) & 0xFF;\r\n\r\n        rval <<= 8;\r\n      }\r\n\r\n      /* handle final byte if necessary */\r\n      if ( w > 0 )\r\n      {\r\n        if ( nbits < w )\r\n        {\r\n          if ( p < limit )\r\n            rval |= *p++;\r\n          *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );\r\n          nbits  += 8 - w;\r\n\r\n          rval <<= 8;\r\n        }\r\n        else\r\n        {\r\n          *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );\r\n          nbits  -= w;\r\n        }\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_load_compound( TT_SBitDecoder  decoder,\r\n                                 FT_Byte*        p,\r\n                                 FT_Byte*        limit,\r\n                                 FT_Int          x_pos,\r\n                                 FT_Int          y_pos )\r\n  {\r\n    FT_Error  error = SFNT_Err_Ok;\r\n    FT_UInt   num_components, nn;\r\n\r\n    FT_Char  horiBearingX = decoder->metrics->horiBearingX;\r\n    FT_Char  horiBearingY = decoder->metrics->horiBearingY;\r\n    FT_Byte  horiAdvance  = decoder->metrics->horiAdvance;\r\n    FT_Char  vertBearingX = decoder->metrics->vertBearingX;\r\n    FT_Char  vertBearingY = decoder->metrics->vertBearingY;\r\n    FT_Byte  vertAdvance  = decoder->metrics->vertAdvance;\r\n\r\n\r\n    if ( p + 2 > limit )\r\n      goto Fail;\r\n\r\n    num_components = FT_NEXT_USHORT( p );\r\n    if ( p + 4 * num_components > limit )\r\n      goto Fail;\r\n\r\n    if ( !decoder->bitmap_allocated )\r\n    {\r\n      error = tt_sbit_decoder_alloc_bitmap( decoder );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    for ( nn = 0; nn < num_components; nn++ )\r\n    {\r\n      FT_UInt  gindex = FT_NEXT_USHORT( p );\r\n      FT_Byte  dx     = FT_NEXT_BYTE( p );\r\n      FT_Byte  dy     = FT_NEXT_BYTE( p );\r\n\r\n\r\n      /* NB: a recursive call */\r\n      error = tt_sbit_decoder_load_image( decoder, gindex,\r\n                                          x_pos + dx, y_pos + dy );\r\n      if ( error )\r\n        break;\r\n    }\r\n\r\n    decoder->metrics->horiBearingX = horiBearingX;\r\n    decoder->metrics->horiBearingY = horiBearingY;\r\n    decoder->metrics->horiAdvance  = horiAdvance;\r\n    decoder->metrics->vertBearingX = vertBearingX;\r\n    decoder->metrics->vertBearingY = vertBearingY;\r\n    decoder->metrics->vertAdvance  = vertAdvance;\r\n    decoder->metrics->width        = (FT_UInt)decoder->bitmap->width;\r\n    decoder->metrics->height       = (FT_UInt)decoder->bitmap->rows;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    error = SFNT_Err_Invalid_File_Format;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_load_bitmap( TT_SBitDecoder  decoder,\r\n                               FT_UInt         glyph_format,\r\n                               FT_ULong        glyph_start,\r\n                               FT_ULong        glyph_size,\r\n                               FT_Int          x_pos,\r\n                               FT_Int          y_pos )\r\n  {\r\n    FT_Error   error;\r\n    FT_Stream  stream = decoder->stream;\r\n    FT_Byte*   p;\r\n    FT_Byte*   p_limit;\r\n    FT_Byte*   data;\r\n\r\n\r\n    /* seek into the EBDT table now */\r\n    if ( glyph_start + glyph_size > decoder->ebdt_size )\r\n    {\r\n      error = SFNT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( FT_STREAM_SEEK( decoder->ebdt_start + glyph_start ) ||\r\n         FT_FRAME_EXTRACT( glyph_size, data )                )\r\n      goto Exit;\r\n\r\n    p       = data;\r\n    p_limit = p + glyph_size;\r\n\r\n    /* read the data, depending on the glyph format */\r\n    switch ( glyph_format )\r\n    {\r\n    case 1:\r\n    case 2:\r\n    case 8:\r\n      error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 );\r\n      break;\r\n\r\n    case 6:\r\n    case 7:\r\n    case 9:\r\n      error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 );\r\n      break;\r\n\r\n    default:\r\n      error = SFNT_Err_Ok;\r\n    }\r\n\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    {\r\n      TT_SBitDecoder_LoadFunc  loader;\r\n\r\n\r\n      switch ( glyph_format )\r\n      {\r\n      case 1:\r\n      case 6:\r\n        loader = tt_sbit_decoder_load_byte_aligned;\r\n        break;\r\n\r\n      case 2:\r\n      case 5:\r\n      case 7:\r\n        loader = tt_sbit_decoder_load_bit_aligned;\r\n        break;\r\n\r\n      case 8:\r\n        if ( p + 1 > p_limit )\r\n          goto Fail;\r\n\r\n        p += 1;  /* skip padding */\r\n        /* fall-through */\r\n\r\n      case 9:\r\n        loader = tt_sbit_decoder_load_compound;\r\n        break;\r\n\r\n      default:\r\n        goto Fail;\r\n      }\r\n\r\n      error = loader( decoder, p, p_limit, x_pos, y_pos );\r\n    }\r\n\r\n  Fail:\r\n    FT_FRAME_RELEASE( data );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  tt_sbit_decoder_load_image( TT_SBitDecoder  decoder,\r\n                              FT_UInt         glyph_index,\r\n                              FT_Int          x_pos,\r\n                              FT_Int          y_pos )\r\n  {\r\n    /*\r\n     *  First, we find the correct strike range that applies to this\r\n     *  glyph index.\r\n     */\r\n\r\n    FT_Byte*  p          = decoder->eblc_base + decoder->strike_index_array;\r\n    FT_Byte*  p_limit    = decoder->eblc_limit;\r\n    FT_ULong  num_ranges = decoder->strike_index_count;\r\n    FT_UInt   start, end, index_format, image_format;\r\n    FT_ULong  image_start = 0, image_end = 0, image_offset;\r\n\r\n\r\n    for ( ; num_ranges > 0; num_ranges-- )\r\n    {\r\n      start = FT_NEXT_USHORT( p );\r\n      end   = FT_NEXT_USHORT( p );\r\n\r\n      if ( glyph_index >= start && glyph_index <= end )\r\n        goto FoundRange;\r\n\r\n      p += 4;  /* ignore index offset */\r\n    }\r\n    goto NoBitmap;\r\n\r\n  FoundRange:\r\n    image_offset = FT_NEXT_ULONG( p );\r\n\r\n    /* overflow check */\r\n    if ( decoder->eblc_base + decoder->strike_index_array + image_offset <\r\n           decoder->eblc_base )\r\n      goto Failure;\r\n\r\n    p = decoder->eblc_base + decoder->strike_index_array + image_offset;\r\n    if ( p + 8 > p_limit )\r\n      goto NoBitmap;\r\n\r\n    /* now find the glyph's location and extend within the ebdt table */\r\n    index_format = FT_NEXT_USHORT( p );\r\n    image_format = FT_NEXT_USHORT( p );\r\n    image_offset = FT_NEXT_ULONG ( p );\r\n\r\n    switch ( index_format )\r\n    {\r\n    case 1: /* 4-byte offsets relative to `image_offset' */\r\n      {\r\n        p += 4 * ( glyph_index - start );\r\n        if ( p + 8 > p_limit )\r\n          goto NoBitmap;\r\n\r\n        image_start = FT_NEXT_ULONG( p );\r\n        image_end   = FT_NEXT_ULONG( p );\r\n\r\n        if ( image_start == image_end )  /* missing glyph */\r\n          goto NoBitmap;\r\n      }\r\n      break;\r\n\r\n    case 2: /* big metrics, constant image size */\r\n      {\r\n        FT_ULong  image_size;\r\n\r\n\r\n        if ( p + 12 > p_limit )\r\n          goto NoBitmap;\r\n\r\n        image_size = FT_NEXT_ULONG( p );\r\n\r\n        if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )\r\n          goto NoBitmap;\r\n\r\n        image_start = image_size * ( glyph_index - start );\r\n        image_end   = image_start + image_size;\r\n      }\r\n      break;\r\n\r\n    case 3: /* 2-byte offsets relative to 'image_offset' */\r\n      {\r\n        p += 2 * ( glyph_index - start );\r\n        if ( p + 4 > p_limit )\r\n          goto NoBitmap;\r\n\r\n        image_start = FT_NEXT_USHORT( p );\r\n        image_end   = FT_NEXT_USHORT( p );\r\n\r\n        if ( image_start == image_end )  /* missing glyph */\r\n          goto NoBitmap;\r\n      }\r\n      break;\r\n\r\n    case 4: /* sparse glyph array with (glyph,offset) pairs */\r\n      {\r\n        FT_ULong  mm, num_glyphs;\r\n\r\n\r\n        if ( p + 4 > p_limit )\r\n          goto NoBitmap;\r\n\r\n        num_glyphs = FT_NEXT_ULONG( p );\r\n\r\n        /* overflow check */\r\n        if ( p + ( num_glyphs + 1 ) * 4 < p )\r\n          goto Failure;\r\n\r\n        if ( p + ( num_glyphs + 1 ) * 4 > p_limit )\r\n          goto NoBitmap;\r\n\r\n        for ( mm = 0; mm < num_glyphs; mm++ )\r\n        {\r\n          FT_UInt  gindex = FT_NEXT_USHORT( p );\r\n\r\n\r\n          if ( gindex == glyph_index )\r\n          {\r\n            image_start = FT_NEXT_USHORT( p );\r\n            p          += 2;\r\n            image_end   = FT_PEEK_USHORT( p );\r\n            break;\r\n          }\r\n          p += 2;\r\n        }\r\n\r\n        if ( mm >= num_glyphs )\r\n          goto NoBitmap;\r\n      }\r\n      break;\r\n\r\n    case 5: /* constant metrics with sparse glyph codes */\r\n      {\r\n        FT_ULong  image_size, mm, num_glyphs;\r\n\r\n\r\n        if ( p + 16 > p_limit )\r\n          goto NoBitmap;\r\n\r\n        image_size = FT_NEXT_ULONG( p );\r\n\r\n        if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )\r\n          goto NoBitmap;\r\n\r\n        num_glyphs = FT_NEXT_ULONG( p );\r\n\r\n        /* overflow check */\r\n        if ( p + 2 * num_glyphs < p )\r\n          goto Failure;\r\n\r\n        if ( p + 2 * num_glyphs > p_limit )\r\n          goto NoBitmap;\r\n\r\n        for ( mm = 0; mm < num_glyphs; mm++ )\r\n        {\r\n          FT_UInt  gindex = FT_NEXT_USHORT( p );\r\n\r\n\r\n          if ( gindex == glyph_index )\r\n            break;\r\n        }\r\n\r\n        if ( mm >= num_glyphs )\r\n          goto NoBitmap;\r\n\r\n        image_start = image_size * mm;\r\n        image_end   = image_start + image_size;\r\n      }\r\n      break;\r\n\r\n    default:\r\n      goto NoBitmap;\r\n    }\r\n\r\n    if ( image_start > image_end )\r\n      goto NoBitmap;\r\n\r\n    image_end  -= image_start;\r\n    image_start = image_offset + image_start;\r\n\r\n    return tt_sbit_decoder_load_bitmap( decoder,\r\n                                        image_format,\r\n                                        image_start,\r\n                                        image_end,\r\n                                        x_pos,\r\n                                        y_pos );\r\n\r\n  Failure:\r\n    return SFNT_Err_Invalid_Table;\r\n\r\n  NoBitmap:\r\n    return SFNT_Err_Invalid_Argument;\r\n  }\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_sbit_image( TT_Face              face,\r\n                           FT_ULong             strike_index,\r\n                           FT_UInt              glyph_index,\r\n                           FT_UInt              load_flags,\r\n                           FT_Stream            stream,\r\n                           FT_Bitmap           *map,\r\n                           TT_SBit_MetricsRec  *metrics )\r\n  {\r\n    TT_SBitDecoderRec  decoder[1];\r\n    FT_Error           error;\r\n\r\n    FT_UNUSED( load_flags );\r\n    FT_UNUSED( stream );\r\n    FT_UNUSED( map );\r\n\r\n\r\n    error = tt_sbit_decoder_init( decoder, face, strike_index, metrics );\r\n    if ( !error )\r\n    {\r\n      error = tt_sbit_decoder_load_image( decoder, glyph_index, 0, 0 );\r\n      tt_sbit_decoder_done( decoder );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n/* EOF */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/Jamfile",
    "content": "# FreeType 2 src/smooth Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) smooth ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = ftgrays ftsmooth ftspic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = smooth ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/smooth Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftgrays.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgrays.c                                                              */\r\n/*                                                                         */\r\n/*    A new `perfect' anti-aliasing renderer (body).                       */\r\n/*                                                                         */\r\n/*  Copyright 2000-2003, 2005-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file can be compiled without the rest of the FreeType engine, by */\r\n  /* defining the _STANDALONE_ macro when compiling it.  You also need to  */\r\n  /* put the files `ftgrays.h' and `ftimage.h' into the current            */\r\n  /* compilation directory.  Typically, you could do something like        */\r\n  /*                                                                       */\r\n  /* - copy `src/smooth/ftgrays.c' (this file) to your current directory   */\r\n  /*                                                                       */\r\n  /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */\r\n  /*   same directory                                                      */\r\n  /*                                                                       */\r\n  /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in        */\r\n  /*                                                                       */\r\n  /*     cc -c -D_STANDALONE_ ftgrays.c                                    */\r\n  /*                                                                       */\r\n  /* The renderer can be initialized with a call to                        */\r\n  /* `ft_gray_raster.raster_new'; an anti-aliased bitmap can be generated  */\r\n  /* with a call to `ft_gray_raster.raster_render'.                        */\r\n  /*                                                                       */\r\n  /* See the comments and documentation in the file `ftimage.h' for more   */\r\n  /* details on how the raster works.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This is a new anti-aliasing scan-converter for FreeType 2.  The       */\r\n  /* algorithm used here is _very_ different from the one in the standard  */\r\n  /* `ftraster' module.  Actually, `ftgrays' computes the _exact_          */\r\n  /* coverage of the outline on each pixel cell.                           */\r\n  /*                                                                       */\r\n  /* It is based on ideas that I initially found in Raph Levien's          */\r\n  /* excellent LibArt graphics library (see http://www.levien.com/libart   */\r\n  /* for more information, though the web pages do not tell anything       */\r\n  /* about the renderer; you'll have to dive into the source code to       */\r\n  /* understand how it works).                                             */\r\n  /*                                                                       */\r\n  /* Note, however, that this is a _very_ different implementation         */\r\n  /* compared to Raph's.  Coverage information is stored in a very         */\r\n  /* different way, and I don't use sorted vector paths.  Also, it doesn't */\r\n  /* use floating point values.                                            */\r\n  /*                                                                       */\r\n  /* This renderer has the following advantages:                           */\r\n  /*                                                                       */\r\n  /* - It doesn't need an intermediate bitmap.  Instead, one can supply a  */\r\n  /*   callback function that will be called by the renderer to draw gray  */\r\n  /*   spans on any target surface.  You can thus do direct composition on */\r\n  /*   any kind of bitmap, provided that you give the renderer the right   */\r\n  /*   callback.                                                           */\r\n  /*                                                                       */\r\n  /* - A perfect anti-aliaser, i.e., it computes the _exact_ coverage on   */\r\n  /*   each pixel cell.                                                    */\r\n  /*                                                                       */\r\n  /* - It performs a single pass on the outline (the `standard' FT2        */\r\n  /*   renderer makes two passes).                                         */\r\n  /*                                                                       */\r\n  /* - It can easily be modified to render to _any_ number of gray levels  */\r\n  /*   cheaply.                                                            */\r\n  /*                                                                       */\r\n  /* - For small (< 20) pixel sizes, it is faster than the standard        */\r\n  /*   renderer.                                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_smooth\r\n\r\n\r\n#ifdef _STANDALONE_\r\n\r\n\r\n  /* define this to dump debugging information */\r\n/* #define FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n#include <stdio.h>\r\n#include <stdarg.h>\r\n#endif\r\n\r\n#include <stddef.h>\r\n#include <string.h>\r\n#include <setjmp.h>\r\n#include <limits.h>\r\n#define FT_UINT_MAX  UINT_MAX\r\n#define FT_INT_MAX   INT_MAX\r\n\r\n#define ft_memset   memset\r\n\r\n#define ft_setjmp   setjmp\r\n#define ft_longjmp  longjmp\r\n#define ft_jmp_buf  jmp_buf\r\n\r\ntypedef ptrdiff_t  FT_PtrDist;\r\n\r\n\r\n#define ErrRaster_Invalid_Mode      -2\r\n#define ErrRaster_Invalid_Outline   -1\r\n#define ErrRaster_Invalid_Argument  -3\r\n#define ErrRaster_Memory_Overflow   -4\r\n\r\n#define FT_BEGIN_HEADER\r\n#define FT_END_HEADER\r\n\r\n#include \"ftimage.h\"\r\n#include \"ftgrays.h\"\r\n\r\n\r\n  /* This macro is used to indicate that a function parameter is unused. */\r\n  /* Its purpose is simply to reduce compiler warnings.  Note also that  */\r\n  /* simply defining it as `(void)x' doesn't avoid warnings with certain */\r\n  /* ANSI compilers (e.g. LCC).                                          */\r\n#define FT_UNUSED( x )  (x) = (x)\r\n\r\n\r\n  /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n  void\r\n  FT_Message( const char*  fmt,\r\n              ... )\r\n  {\r\n    va_list  ap;\r\n\r\n\r\n    va_start( ap, fmt );\r\n    vfprintf( stderr, fmt, ap );\r\n    va_end( ap );\r\n  }\r\n\r\n  /* we don't handle tracing levels in stand-alone mode; */\r\n#ifndef FT_TRACE5\r\n#define FT_TRACE5( varformat )  FT_Message varformat\r\n#endif\r\n#ifndef FT_TRACE7\r\n#define FT_TRACE7( varformat )  FT_Message varformat\r\n#endif\r\n#ifndef FT_ERROR\r\n#define FT_ERROR( varformat )   FT_Message varformat\r\n#endif\r\n\r\n#else /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n#define FT_TRACE5( x )  do { } while ( 0 )     /* nothing */\r\n#define FT_TRACE7( x )  do { } while ( 0 )     /* nothing */\r\n#define FT_ERROR( x )   do { } while ( 0 )     /* nothing */\r\n\r\n#endif /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n#define FT_DEFINE_OUTLINE_FUNCS( class_,               \\\r\n                                 move_to_, line_to_,   \\\r\n                                 conic_to_, cubic_to_, \\\r\n                                 shift_, delta_ )      \\\r\n          static const FT_Outline_Funcs class_ =       \\\r\n          {                                            \\\r\n            move_to_,                                  \\\r\n            line_to_,                                  \\\r\n            conic_to_,                                 \\\r\n            cubic_to_,                                 \\\r\n            shift_,                                    \\\r\n            delta_                                     \\\r\n         };\r\n\r\n#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_,            \\\r\n                                raster_new_, raster_reset_,       \\\r\n                                raster_set_mode_, raster_render_, \\\r\n                                raster_done_ )                    \\\r\n          const FT_Raster_Funcs class_ =                          \\\r\n          {                                                       \\\r\n            glyph_format_,                                        \\\r\n            raster_new_,                                          \\\r\n            raster_reset_,                                        \\\r\n            raster_set_mode_,                                     \\\r\n            raster_render_,                                       \\\r\n            raster_done_                                          \\\r\n         };\r\n\r\n#else /* !_STANDALONE_ */\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ftgrays.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_OUTLINE_H\r\n\r\n#include \"ftsmerrs.h\"\r\n\r\n#include \"ftspic.h\"\r\n\r\n#define ErrRaster_Invalid_Mode      Smooth_Err_Cannot_Render_Glyph\r\n#define ErrRaster_Invalid_Outline   Smooth_Err_Invalid_Outline\r\n#define ErrRaster_Memory_Overflow   Smooth_Err_Out_Of_Memory\r\n#define ErrRaster_Invalid_Argument  Smooth_Err_Invalid_Argument\r\n\r\n#endif /* !_STANDALONE_ */\r\n\r\n#ifndef FT_MEM_SET\r\n#define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )\r\n#endif\r\n\r\n#ifndef FT_MEM_ZERO\r\n#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )\r\n#endif\r\n\r\n  /* as usual, for the speed hungry :-) */\r\n\r\n#undef RAS_ARG\r\n#undef RAS_ARG_\r\n#undef RAS_VAR\r\n#undef RAS_VAR_\r\n\r\n#ifndef FT_STATIC_RASTER\r\n\r\n#define RAS_ARG   gray_PWorker  worker\r\n#define RAS_ARG_  gray_PWorker  worker,\r\n\r\n#define RAS_VAR   worker\r\n#define RAS_VAR_  worker,\r\n\r\n#else /* FT_STATIC_RASTER */\r\n\r\n#define RAS_ARG   /* empty */\r\n#define RAS_ARG_  /* empty */\r\n#define RAS_VAR   /* empty */\r\n#define RAS_VAR_  /* empty */\r\n\r\n#endif /* FT_STATIC_RASTER */\r\n\r\n\r\n  /* must be at least 6 bits! */\r\n#define PIXEL_BITS  8\r\n\r\n#undef FLOOR\r\n#undef CEILING\r\n#undef TRUNC\r\n#undef SCALED\r\n\r\n#define ONE_PIXEL       ( 1L << PIXEL_BITS )\r\n#define PIXEL_MASK      ( -1L << PIXEL_BITS )\r\n#define TRUNC( x )      ( (TCoord)( (x) >> PIXEL_BITS ) )\r\n#define SUBPIXELS( x )  ( (TPos)(x) << PIXEL_BITS )\r\n#define FLOOR( x )      ( (x) & -ONE_PIXEL )\r\n#define CEILING( x )    ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )\r\n#define ROUND( x )      ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )\r\n\r\n#if PIXEL_BITS >= 6\r\n#define UPSCALE( x )    ( (x) << ( PIXEL_BITS - 6 ) )\r\n#define DOWNSCALE( x )  ( (x) >> ( PIXEL_BITS - 6 ) )\r\n#else\r\n#define UPSCALE( x )    ( (x) >> ( 6 - PIXEL_BITS ) )\r\n#define DOWNSCALE( x )  ( (x) << ( 6 - PIXEL_BITS ) )\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*   TYPE DEFINITIONS                                                    */\r\n  /*                                                                       */\r\n\r\n  /* don't change the following types to FT_Int or FT_Pos, since we might */\r\n  /* need to define them to \"float\" or \"double\" when experimenting with   */\r\n  /* new algorithms                                                       */\r\n\r\n  typedef long  TCoord;   /* integer scanline/pixel coordinate */\r\n  typedef long  TPos;     /* sub-pixel coordinate              */\r\n\r\n  /* determine the type used to store cell areas.  This normally takes at */\r\n  /* least PIXEL_BITS*2 + 1 bits.  On 16-bit systems, we need to use      */\r\n  /* `long' instead of `int', otherwise bad things happen                 */\r\n\r\n#if PIXEL_BITS <= 7\r\n\r\n  typedef int  TArea;\r\n\r\n#else /* PIXEL_BITS >= 8 */\r\n\r\n  /* approximately determine the size of integers using an ANSI-C header */\r\n#if FT_UINT_MAX == 0xFFFFU\r\n  typedef long  TArea;\r\n#else\r\n  typedef int   TArea;\r\n#endif\r\n\r\n#endif /* PIXEL_BITS >= 8 */\r\n\r\n\r\n  /* maximum number of gray spans in a call to the span callback */\r\n#define FT_MAX_GRAY_SPANS  32\r\n\r\n\r\n  typedef struct TCell_*  PCell;\r\n\r\n  typedef struct  TCell_\r\n  {\r\n    TPos    x;     /* same with gray_TWorker.ex    */\r\n    TCoord  cover; /* same with gray_TWorker.cover */\r\n    TArea   area;\r\n    PCell   next;\r\n\r\n  } TCell;\r\n\r\n\r\n  typedef struct  gray_TWorker_\r\n  {\r\n    TCoord  ex, ey;\r\n    TPos    min_ex, max_ex;\r\n    TPos    min_ey, max_ey;\r\n    TPos    count_ex, count_ey;\r\n\r\n    TArea   area;\r\n    TCoord  cover;\r\n    int     invalid;\r\n\r\n    PCell       cells;\r\n    FT_PtrDist  max_cells;\r\n    FT_PtrDist  num_cells;\r\n\r\n    TCoord  cx, cy;\r\n    TPos    x,  y;\r\n\r\n    TPos    last_ey;\r\n\r\n    FT_Vector   bez_stack[32 * 3 + 1];\r\n    int         lev_stack[32];\r\n\r\n    FT_Outline  outline;\r\n    FT_Bitmap   target;\r\n    FT_BBox     clip_box;\r\n\r\n    FT_Span     gray_spans[FT_MAX_GRAY_SPANS];\r\n    int         num_gray_spans;\r\n\r\n    FT_Raster_Span_Func  render_span;\r\n    void*                render_span_data;\r\n    int                  span_y;\r\n\r\n    int  band_size;\r\n    int  band_shoot;\r\n\r\n    ft_jmp_buf  jump_buffer;\r\n\r\n    void*       buffer;\r\n    long        buffer_size;\r\n\r\n    PCell*     ycells;\r\n    TPos       ycount;\r\n\r\n  } gray_TWorker, *gray_PWorker;\r\n\r\n\r\n#ifndef FT_STATIC_RASTER\r\n#define ras  (*worker)\r\n#else\r\n  static gray_TWorker  ras;\r\n#endif\r\n\r\n\r\n  typedef struct gray_TRaster_\r\n  {\r\n    void*         buffer;\r\n    long          buffer_size;\r\n    int           band_size;\r\n    void*         memory;\r\n    gray_PWorker  worker;\r\n\r\n  } gray_TRaster, *gray_PRaster;\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Initialize the cells table.                                           */\r\n  /*                                                                       */\r\n  static void\r\n  gray_init_cells( RAS_ARG_ void*  buffer,\r\n                   long            byte_size )\r\n  {\r\n    ras.buffer      = buffer;\r\n    ras.buffer_size = byte_size;\r\n\r\n    ras.ycells      = (PCell*) buffer;\r\n    ras.cells       = NULL;\r\n    ras.max_cells   = 0;\r\n    ras.num_cells   = 0;\r\n    ras.area        = 0;\r\n    ras.cover       = 0;\r\n    ras.invalid     = 1;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Compute the outline bounding box.                                     */\r\n  /*                                                                       */\r\n  static void\r\n  gray_compute_cbox( RAS_ARG )\r\n  {\r\n    FT_Outline*  outline = &ras.outline;\r\n    FT_Vector*   vec     = outline->points;\r\n    FT_Vector*   limit   = vec + outline->n_points;\r\n\r\n\r\n    if ( outline->n_points <= 0 )\r\n    {\r\n      ras.min_ex = ras.max_ex = 0;\r\n      ras.min_ey = ras.max_ey = 0;\r\n      return;\r\n    }\r\n\r\n    ras.min_ex = ras.max_ex = vec->x;\r\n    ras.min_ey = ras.max_ey = vec->y;\r\n\r\n    vec++;\r\n\r\n    for ( ; vec < limit; vec++ )\r\n    {\r\n      TPos  x = vec->x;\r\n      TPos  y = vec->y;\r\n\r\n\r\n      if ( x < ras.min_ex ) ras.min_ex = x;\r\n      if ( x > ras.max_ex ) ras.max_ex = x;\r\n      if ( y < ras.min_ey ) ras.min_ey = y;\r\n      if ( y > ras.max_ey ) ras.max_ey = y;\r\n    }\r\n\r\n    /* truncate the bounding box to integer pixels */\r\n    ras.min_ex = ras.min_ex >> 6;\r\n    ras.min_ey = ras.min_ey >> 6;\r\n    ras.max_ex = ( ras.max_ex + 63 ) >> 6;\r\n    ras.max_ey = ( ras.max_ey + 63 ) >> 6;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Record the current cell in the table.                                 */\r\n  /*                                                                       */\r\n  static PCell\r\n  gray_find_cell( RAS_ARG )\r\n  {\r\n    PCell  *pcell, cell;\r\n    TPos    x = ras.ex;\r\n\r\n\r\n    if ( x > ras.count_ex )\r\n      x = ras.count_ex;\r\n\r\n    pcell = &ras.ycells[ras.ey];\r\n    for (;;)\r\n    {\r\n      cell = *pcell;\r\n      if ( cell == NULL || cell->x > x )\r\n        break;\r\n\r\n      if ( cell->x == x )\r\n        goto Exit;\r\n\r\n      pcell = &cell->next;\r\n    }\r\n\r\n    if ( ras.num_cells >= ras.max_cells )\r\n      ft_longjmp( ras.jump_buffer, 1 );\r\n\r\n    cell        = ras.cells + ras.num_cells++;\r\n    cell->x     = x;\r\n    cell->area  = 0;\r\n    cell->cover = 0;\r\n\r\n    cell->next  = *pcell;\r\n    *pcell      = cell;\r\n\r\n  Exit:\r\n    return cell;\r\n  }\r\n\r\n\r\n  static void\r\n  gray_record_cell( RAS_ARG )\r\n  {\r\n    if ( !ras.invalid && ( ras.area | ras.cover ) )\r\n    {\r\n      PCell  cell = gray_find_cell( RAS_VAR );\r\n\r\n\r\n      cell->area  += ras.area;\r\n      cell->cover += ras.cover;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Set the current cell to a new position.                               */\r\n  /*                                                                       */\r\n  static void\r\n  gray_set_cell( RAS_ARG_ TCoord  ex,\r\n                          TCoord  ey )\r\n  {\r\n    /* Move the cell pointer to a new position.  We set the `invalid'      */\r\n    /* flag to indicate that the cell isn't part of those we're interested */\r\n    /* in during the render phase.  This means that:                       */\r\n    /*                                                                     */\r\n    /* . the new vertical position must be within min_ey..max_ey-1.        */\r\n    /* . the new horizontal position must be strictly less than max_ex     */\r\n    /*                                                                     */\r\n    /* Note that if a cell is to the left of the clipping region, it is    */\r\n    /* actually set to the (min_ex-1) horizontal position.                 */\r\n\r\n    /* All cells that are on the left of the clipping region go to the */\r\n    /* min_ex - 1 horizontal position.                                 */\r\n    ey -= ras.min_ey;\r\n\r\n    if ( ex > ras.max_ex )\r\n      ex = ras.max_ex;\r\n\r\n    ex -= ras.min_ex;\r\n    if ( ex < 0 )\r\n      ex = -1;\r\n\r\n    /* are we moving to a different cell ? */\r\n    if ( ex != ras.ex || ey != ras.ey )\r\n    {\r\n      /* record the current one if it is valid */\r\n      if ( !ras.invalid )\r\n        gray_record_cell( RAS_VAR );\r\n\r\n      ras.area  = 0;\r\n      ras.cover = 0;\r\n    }\r\n\r\n    ras.ex      = ex;\r\n    ras.ey      = ey;\r\n    ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey ||\r\n                              ex >= ras.count_ex           );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Start a new contour at a given cell.                                  */\r\n  /*                                                                       */\r\n  static void\r\n  gray_start_cell( RAS_ARG_ TCoord  ex,\r\n                            TCoord  ey )\r\n  {\r\n    if ( ex > ras.max_ex )\r\n      ex = (TCoord)( ras.max_ex );\r\n\r\n    if ( ex < ras.min_ex )\r\n      ex = (TCoord)( ras.min_ex - 1 );\r\n\r\n    ras.area    = 0;\r\n    ras.cover   = 0;\r\n    ras.ex      = ex - ras.min_ex;\r\n    ras.ey      = ey - ras.min_ey;\r\n    ras.last_ey = SUBPIXELS( ey );\r\n    ras.invalid = 0;\r\n\r\n    gray_set_cell( RAS_VAR_ ex, ey );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Render a scanline as one or more cells.                               */\r\n  /*                                                                       */\r\n  static void\r\n  gray_render_scanline( RAS_ARG_ TCoord  ey,\r\n                                 TPos    x1,\r\n                                 TCoord  y1,\r\n                                 TPos    x2,\r\n                                 TCoord  y2 )\r\n  {\r\n    TCoord  ex1, ex2, fx1, fx2, delta, mod, lift, rem;\r\n    long    p, first, dx;\r\n    int     incr;\r\n\r\n\r\n    dx = x2 - x1;\r\n\r\n    ex1 = TRUNC( x1 );\r\n    ex2 = TRUNC( x2 );\r\n    fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) );\r\n    fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) );\r\n\r\n    /* trivial case.  Happens often */\r\n    if ( y1 == y2 )\r\n    {\r\n      gray_set_cell( RAS_VAR_ ex2, ey );\r\n      return;\r\n    }\r\n\r\n    /* everything is located in a single cell.  That is easy! */\r\n    /*                                                        */\r\n    if ( ex1 == ex2 )\r\n    {\r\n      delta      = y2 - y1;\r\n      ras.area  += (TArea)(( fx1 + fx2 ) * delta);\r\n      ras.cover += delta;\r\n      return;\r\n    }\r\n\r\n    /* ok, we'll have to render a run of adjacent cells on the same */\r\n    /* scanline...                                                  */\r\n    /*                                                              */\r\n    p     = ( ONE_PIXEL - fx1 ) * ( y2 - y1 );\r\n    first = ONE_PIXEL;\r\n    incr  = 1;\r\n\r\n    if ( dx < 0 )\r\n    {\r\n      p     = fx1 * ( y2 - y1 );\r\n      first = 0;\r\n      incr  = -1;\r\n      dx    = -dx;\r\n    }\r\n\r\n    delta = (TCoord)( p / dx );\r\n    mod   = (TCoord)( p % dx );\r\n    if ( mod < 0 )\r\n    {\r\n      delta--;\r\n      mod += (TCoord)dx;\r\n    }\r\n\r\n    ras.area  += (TArea)(( fx1 + first ) * delta);\r\n    ras.cover += delta;\r\n\r\n    ex1 += incr;\r\n    gray_set_cell( RAS_VAR_ ex1, ey );\r\n    y1  += delta;\r\n\r\n    if ( ex1 != ex2 )\r\n    {\r\n      p    = ONE_PIXEL * ( y2 - y1 + delta );\r\n      lift = (TCoord)( p / dx );\r\n      rem  = (TCoord)( p % dx );\r\n      if ( rem < 0 )\r\n      {\r\n        lift--;\r\n        rem += (TCoord)dx;\r\n      }\r\n\r\n      mod -= (int)dx;\r\n\r\n      while ( ex1 != ex2 )\r\n      {\r\n        delta = lift;\r\n        mod  += rem;\r\n        if ( mod >= 0 )\r\n        {\r\n          mod -= (TCoord)dx;\r\n          delta++;\r\n        }\r\n\r\n        ras.area  += (TArea)(ONE_PIXEL * delta);\r\n        ras.cover += delta;\r\n        y1        += delta;\r\n        ex1       += incr;\r\n        gray_set_cell( RAS_VAR_ ex1, ey );\r\n      }\r\n    }\r\n\r\n    delta      = y2 - y1;\r\n    ras.area  += (TArea)(( fx2 + ONE_PIXEL - first ) * delta);\r\n    ras.cover += delta;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Render a given line as a series of scanlines.                         */\r\n  /*                                                                       */\r\n  static void\r\n  gray_render_line( RAS_ARG_ TPos  to_x,\r\n                             TPos  to_y )\r\n  {\r\n    TCoord  ey1, ey2, fy1, fy2, mod;\r\n    TPos    dx, dy, x, x2;\r\n    long    p, first;\r\n    int     delta, rem, lift, incr;\r\n\r\n\r\n    ey1 = TRUNC( ras.last_ey );\r\n    ey2 = TRUNC( to_y );     /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */\r\n    fy1 = (TCoord)( ras.y - ras.last_ey );\r\n    fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) );\r\n\r\n    dx = to_x - ras.x;\r\n    dy = to_y - ras.y;\r\n\r\n    /* XXX: we should do something about the trivial case where dx == 0, */\r\n    /*      as it happens very often!                                    */\r\n\r\n    /* perform vertical clipping */\r\n    {\r\n      TCoord  min, max;\r\n\r\n\r\n      min = ey1;\r\n      max = ey2;\r\n      if ( ey1 > ey2 )\r\n      {\r\n        min = ey2;\r\n        max = ey1;\r\n      }\r\n      if ( min >= ras.max_ey || max < ras.min_ey )\r\n        goto End;\r\n    }\r\n\r\n    /* everything is on a single scanline */\r\n    if ( ey1 == ey2 )\r\n    {\r\n      gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, to_x, fy2 );\r\n      goto End;\r\n    }\r\n\r\n    /* vertical line - avoid calling gray_render_scanline */\r\n    incr = 1;\r\n\r\n    if ( dx == 0 )\r\n    {\r\n      TCoord  ex     = TRUNC( ras.x );\r\n      TCoord  two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );\r\n      TArea   area;\r\n\r\n\r\n      first = ONE_PIXEL;\r\n      if ( dy < 0 )\r\n      {\r\n        first = 0;\r\n        incr  = -1;\r\n      }\r\n\r\n      delta      = (int)( first - fy1 );\r\n      ras.area  += (TArea)two_fx * delta;\r\n      ras.cover += delta;\r\n      ey1       += incr;\r\n\r\n      gray_set_cell( RAS_VAR_ ex, ey1 );\r\n\r\n      delta = (int)( first + first - ONE_PIXEL );\r\n      area  = (TArea)two_fx * delta;\r\n      while ( ey1 != ey2 )\r\n      {\r\n        ras.area  += area;\r\n        ras.cover += delta;\r\n        ey1       += incr;\r\n\r\n        gray_set_cell( RAS_VAR_ ex, ey1 );\r\n      }\r\n\r\n      delta      = (int)( fy2 - ONE_PIXEL + first );\r\n      ras.area  += (TArea)two_fx * delta;\r\n      ras.cover += delta;\r\n\r\n      goto End;\r\n    }\r\n\r\n    /* ok, we have to render several scanlines */\r\n    p     = ( ONE_PIXEL - fy1 ) * dx;\r\n    first = ONE_PIXEL;\r\n    incr  = 1;\r\n\r\n    if ( dy < 0 )\r\n    {\r\n      p     = fy1 * dx;\r\n      first = 0;\r\n      incr  = -1;\r\n      dy    = -dy;\r\n    }\r\n\r\n    delta = (int)( p / dy );\r\n    mod   = (int)( p % dy );\r\n    if ( mod < 0 )\r\n    {\r\n      delta--;\r\n      mod += (TCoord)dy;\r\n    }\r\n\r\n    x = ras.x + delta;\r\n    gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, (TCoord)first );\r\n\r\n    ey1 += incr;\r\n    gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );\r\n\r\n    if ( ey1 != ey2 )\r\n    {\r\n      p     = ONE_PIXEL * dx;\r\n      lift  = (int)( p / dy );\r\n      rem   = (int)( p % dy );\r\n      if ( rem < 0 )\r\n      {\r\n        lift--;\r\n        rem += (int)dy;\r\n      }\r\n      mod -= (int)dy;\r\n\r\n      while ( ey1 != ey2 )\r\n      {\r\n        delta = lift;\r\n        mod  += rem;\r\n        if ( mod >= 0 )\r\n        {\r\n          mod -= (int)dy;\r\n          delta++;\r\n        }\r\n\r\n        x2 = x + delta;\r\n        gray_render_scanline( RAS_VAR_ ey1, x,\r\n                                       (TCoord)( ONE_PIXEL - first ), x2,\r\n                                       (TCoord)first );\r\n        x = x2;\r\n\r\n        ey1 += incr;\r\n        gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );\r\n      }\r\n    }\r\n\r\n    gray_render_scanline( RAS_VAR_ ey1, x,\r\n                                   (TCoord)( ONE_PIXEL - first ), to_x,\r\n                                   fy2 );\r\n\r\n  End:\r\n    ras.x       = to_x;\r\n    ras.y       = to_y;\r\n    ras.last_ey = SUBPIXELS( ey2 );\r\n  }\r\n\r\n\r\n  static void\r\n  gray_split_conic( FT_Vector*  base )\r\n  {\r\n    TPos  a, b;\r\n\r\n\r\n    base[4].x = base[2].x;\r\n    b = base[1].x;\r\n    a = base[3].x = ( base[2].x + b ) / 2;\r\n    b = base[1].x = ( base[0].x + b ) / 2;\r\n    base[2].x = ( a + b ) / 2;\r\n\r\n    base[4].y = base[2].y;\r\n    b = base[1].y;\r\n    a = base[3].y = ( base[2].y + b ) / 2;\r\n    b = base[1].y = ( base[0].y + b ) / 2;\r\n    base[2].y = ( a + b ) / 2;\r\n  }\r\n\r\n\r\n  static void\r\n  gray_render_conic( RAS_ARG_ const FT_Vector*  control,\r\n                              const FT_Vector*  to )\r\n  {\r\n    TPos        dx, dy;\r\n    TPos        min, max, y;\r\n    int         top, level;\r\n    int*        levels;\r\n    FT_Vector*  arc;\r\n\r\n\r\n    levels = ras.lev_stack;\r\n\r\n    arc      = ras.bez_stack;\r\n    arc[0].x = UPSCALE( to->x );\r\n    arc[0].y = UPSCALE( to->y );\r\n    arc[1].x = UPSCALE( control->x );\r\n    arc[1].y = UPSCALE( control->y );\r\n    arc[2].x = ras.x;\r\n    arc[2].y = ras.y;\r\n    top      = 0;\r\n\r\n    dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x );\r\n    dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y );\r\n    if ( dx < dy )\r\n      dx = dy;\r\n\r\n    if ( dx < ONE_PIXEL / 4 )\r\n      goto Draw;\r\n\r\n    /* short-cut the arc that crosses the current band */\r\n    min = max = arc[0].y;\r\n\r\n    y = arc[1].y;\r\n    if ( y < min ) min = y;\r\n    if ( y > max ) max = y;\r\n\r\n    y = arc[2].y;\r\n    if ( y < min ) min = y;\r\n    if ( y > max ) max = y;\r\n\r\n    if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )\r\n      goto Draw;\r\n\r\n    level = 0;\r\n    do\r\n    {\r\n      dx >>= 2;\r\n      level++;\r\n    } while ( dx > ONE_PIXEL / 4 );\r\n\r\n    levels[0] = level;\r\n\r\n    do\r\n    {\r\n      level = levels[top];\r\n      if ( level > 0 )\r\n      {\r\n        gray_split_conic( arc );\r\n        arc += 2;\r\n        top++;\r\n        levels[top] = levels[top - 1] = level - 1;\r\n        continue;\r\n      }\r\n\r\n    Draw:\r\n      gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );\r\n      top--;\r\n      arc -= 2;\r\n\r\n    } while ( top >= 0 );\r\n  }\r\n\r\n\r\n  static void\r\n  gray_split_cubic( FT_Vector*  base )\r\n  {\r\n    TPos  a, b, c, d;\r\n\r\n\r\n    base[6].x = base[3].x;\r\n    c = base[1].x;\r\n    d = base[2].x;\r\n    base[1].x = a = ( base[0].x + c ) / 2;\r\n    base[5].x = b = ( base[3].x + d ) / 2;\r\n    c = ( c + d ) / 2;\r\n    base[2].x = a = ( a + c ) / 2;\r\n    base[4].x = b = ( b + c ) / 2;\r\n    base[3].x = ( a + b ) / 2;\r\n\r\n    base[6].y = base[3].y;\r\n    c = base[1].y;\r\n    d = base[2].y;\r\n    base[1].y = a = ( base[0].y + c ) / 2;\r\n    base[5].y = b = ( base[3].y + d ) / 2;\r\n    c = ( c + d ) / 2;\r\n    base[2].y = a = ( a + c ) / 2;\r\n    base[4].y = b = ( b + c ) / 2;\r\n    base[3].y = ( a + b ) / 2;\r\n  }\r\n\r\n\r\n  static void\r\n  gray_render_cubic( RAS_ARG_ const FT_Vector*  control1,\r\n                              const FT_Vector*  control2,\r\n                              const FT_Vector*  to )\r\n  {\r\n    FT_Vector*  arc;\r\n    TPos        min, max, y;\r\n\r\n\r\n    arc      = ras.bez_stack;\r\n    arc[0].x = UPSCALE( to->x );\r\n    arc[0].y = UPSCALE( to->y );\r\n    arc[1].x = UPSCALE( control2->x );\r\n    arc[1].y = UPSCALE( control2->y );\r\n    arc[2].x = UPSCALE( control1->x );\r\n    arc[2].y = UPSCALE( control1->y );\r\n    arc[3].x = ras.x;\r\n    arc[3].y = ras.y;\r\n\r\n    /* Short-cut the arc that crosses the current band. */\r\n    min = max = arc[0].y;\r\n\r\n    y = arc[1].y;\r\n    if ( y < min )\r\n      min = y;\r\n    if ( y > max )\r\n      max = y;\r\n\r\n    y = arc[2].y;\r\n    if ( y < min )\r\n      min = y;\r\n    if ( y > max )\r\n      max = y;\r\n\r\n    y = arc[3].y;\r\n    if ( y < min )\r\n      min = y;\r\n    if ( y > max )\r\n      max = y;\r\n\r\n    if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )\r\n      goto Draw;\r\n\r\n    for (;;)\r\n    {\r\n      /* Decide whether to split or draw. See `Rapid Termination          */\r\n      /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */\r\n      /* F. Hain, at                                                      */\r\n      /* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pdf */\r\n\r\n      {\r\n        TPos  dx, dy, dx_, dy_;\r\n        TPos  dx1, dy1, dx2, dy2;\r\n        TPos  L, s, s_limit;\r\n\r\n\r\n        /* dx and dy are x and y components of the P0-P3 chord vector. */\r\n        dx = arc[3].x - arc[0].x;\r\n        dy = arc[3].y - arc[0].y;\r\n\r\n        /* L is an (under)estimate of the Euclidean distance P0-P3.       */\r\n        /*                                                                */\r\n        /* If dx >= dy, then r = sqrt(dx^2 + dy^2) can be overestimated   */\r\n        /* with least maximum error by                                    */\r\n        /*                                                                */\r\n        /*   r_upperbound = dx + (sqrt(2) - 1) * dy  ,                    */\r\n        /*                                                                */\r\n        /* where sqrt(2) - 1 can be (over)estimated by 107/256, giving an */\r\n        /* error of no more than 8.4%.                                    */\r\n        /*                                                                */\r\n        /* Similarly, some elementary calculus shows that r can be        */\r\n        /* underestimated with least maximum error by                     */\r\n        /*                                                                */\r\n        /*   r_lowerbound = sqrt(2 + sqrt(2)) / 2 * dx                    */\r\n        /*                  + sqrt(2 - sqrt(2)) / 2 * dy  .               */\r\n        /*                                                                */\r\n        /* 236/256 and 97/256 are (under)estimates of the two algebraic   */\r\n        /* numbers, giving an error of no more than 8.1%.                 */\r\n\r\n        dx_ = FT_ABS( dx );\r\n        dy_ = FT_ABS( dy );\r\n\r\n        /* This is the same as                     */\r\n        /*                                         */\r\n        /*   L = ( 236 * FT_MAX( dx_, dy_ )        */\r\n        /*       + 97 * FT_MIN( dx_, dy_ ) ) >> 8; */\r\n        L = ( dx_ > dy_ ? 236 * dx_ +  97 * dy_\r\n                        :  97 * dx_ + 236 * dy_ ) >> 8;\r\n\r\n        /* Avoid possible arithmetic overflow below by splitting. */\r\n        if ( L > 32767 )\r\n          goto Split;\r\n\r\n        /* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */\r\n        s_limit = L * (TPos)( ONE_PIXEL / 6 );\r\n\r\n        /* s is L * the perpendicular distance from P1 to the line P0-P3. */\r\n        dx1 = arc[1].x - arc[0].x;\r\n        dy1 = arc[1].y - arc[0].y;\r\n        s = FT_ABS( dy * dx1 - dx * dy1 );\r\n\r\n        if ( s > s_limit )\r\n          goto Split;\r\n\r\n        /* s is L * the perpendicular distance from P2 to the line P0-P3. */\r\n        dx2 = arc[2].x - arc[0].x;\r\n        dy2 = arc[2].y - arc[0].y;\r\n        s = FT_ABS( dy * dx2 - dx * dy2 );\r\n\r\n        if ( s > s_limit )\r\n          goto Split;\r\n\r\n        /* Split super curvy segments where the off points are so far\r\n           from the chord that the angles P0-P1-P3 or P0-P2-P3 become \r\n           acute as detected by appropriate dot products. */\r\n        if ( dx1 * ( dx1 - dx ) + dy1 * ( dy1 - dy ) > 0 ||\r\n             dx2 * ( dx2 - dx ) + dy2 * ( dy2 - dy ) > 0 )\r\n          goto Split;\r\n\r\n        /* No reason to split. */\r\n        goto Draw;\r\n      }\r\n\r\n    Split:\r\n      gray_split_cubic( arc );\r\n      arc += 3;\r\n      continue;\r\n\r\n    Draw:\r\n      gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );\r\n\r\n      if ( arc == ras.bez_stack )\r\n        return;\r\n\r\n      arc -= 3;\r\n    }\r\n  }\r\n\r\n\r\n  static int\r\n  gray_move_to( const FT_Vector*  to,\r\n                gray_PWorker      worker )\r\n  {\r\n    TPos  x, y;\r\n\r\n\r\n    /* record current cell, if any */\r\n    gray_record_cell( RAS_VAR );\r\n\r\n    /* start to a new position */\r\n    x = UPSCALE( to->x );\r\n    y = UPSCALE( to->y );\r\n\r\n    gray_start_cell( RAS_VAR_ TRUNC( x ), TRUNC( y ) );\r\n\r\n    worker->x = x;\r\n    worker->y = y;\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  gray_line_to( const FT_Vector*  to,\r\n                gray_PWorker      worker )\r\n  {\r\n    gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) );\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  gray_conic_to( const FT_Vector*  control,\r\n                 const FT_Vector*  to,\r\n                 gray_PWorker      worker )\r\n  {\r\n    gray_render_conic( RAS_VAR_ control, to );\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  gray_cubic_to( const FT_Vector*  control1,\r\n                 const FT_Vector*  control2,\r\n                 const FT_Vector*  to,\r\n                 gray_PWorker      worker )\r\n  {\r\n    gray_render_cubic( RAS_VAR_ control1, control2, to );\r\n    return 0;\r\n  }\r\n\r\n\r\n  static void\r\n  gray_render_span( int             y,\r\n                    int             count,\r\n                    const FT_Span*  spans,\r\n                    gray_PWorker    worker )\r\n  {\r\n    unsigned char*  p;\r\n    FT_Bitmap*      map = &worker->target;\r\n\r\n\r\n    /* first of all, compute the scanline offset */\r\n    p = (unsigned char*)map->buffer - y * map->pitch;\r\n    if ( map->pitch >= 0 )\r\n      p += (unsigned)( ( map->rows - 1 ) * map->pitch );\r\n\r\n    for ( ; count > 0; count--, spans++ )\r\n    {\r\n      unsigned char  coverage = spans->coverage;\r\n\r\n\r\n      if ( coverage )\r\n      {\r\n        /* For small-spans it is faster to do it by ourselves than\r\n         * calling `memset'.  This is mainly due to the cost of the\r\n         * function call.\r\n         */\r\n        if ( spans->len >= 8 )\r\n          FT_MEM_SET( p + spans->x, (unsigned char)coverage, spans->len );\r\n        else\r\n        {\r\n          unsigned char*  q = p + spans->x;\r\n\r\n\r\n          switch ( spans->len )\r\n          {\r\n          case 7: *q++ = (unsigned char)coverage;\r\n          case 6: *q++ = (unsigned char)coverage;\r\n          case 5: *q++ = (unsigned char)coverage;\r\n          case 4: *q++ = (unsigned char)coverage;\r\n          case 3: *q++ = (unsigned char)coverage;\r\n          case 2: *q++ = (unsigned char)coverage;\r\n          case 1: *q   = (unsigned char)coverage;\r\n          default:\r\n            ;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  gray_hline( RAS_ARG_ TCoord  x,\r\n                       TCoord  y,\r\n                       TPos    area,\r\n                       TCoord  acount )\r\n  {\r\n    FT_Span*  span;\r\n    int       count;\r\n    int       coverage;\r\n\r\n\r\n    /* compute the coverage line's coverage, depending on the    */\r\n    /* outline fill rule                                         */\r\n    /*                                                           */\r\n    /* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */\r\n    /*                                                           */\r\n    coverage = (int)( area >> ( PIXEL_BITS * 2 + 1 - 8 ) );\r\n                                                    /* use range 0..256 */\r\n    if ( coverage < 0 )\r\n      coverage = -coverage;\r\n\r\n    if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL )\r\n    {\r\n      coverage &= 511;\r\n\r\n      if ( coverage > 256 )\r\n        coverage = 512 - coverage;\r\n      else if ( coverage == 256 )\r\n        coverage = 255;\r\n    }\r\n    else\r\n    {\r\n      /* normal non-zero winding rule */\r\n      if ( coverage >= 256 )\r\n        coverage = 255;\r\n    }\r\n\r\n    y += (TCoord)ras.min_ey;\r\n    x += (TCoord)ras.min_ex;\r\n\r\n    /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */\r\n    if ( x >= 32767 )\r\n      x = 32767;\r\n\r\n    /* FT_Span.y is an integer, so limit our coordinates appropriately */\r\n    if ( y >= FT_INT_MAX )\r\n      y = FT_INT_MAX;\r\n\r\n    if ( coverage )\r\n    {\r\n      /* see whether we can add this span to the current list */\r\n      count = ras.num_gray_spans;\r\n      span  = ras.gray_spans + count - 1;\r\n      if ( count > 0                          &&\r\n           ras.span_y == y                    &&\r\n           (int)span->x + span->len == (int)x &&\r\n           span->coverage == coverage         )\r\n      {\r\n        span->len = (unsigned short)( span->len + acount );\r\n        return;\r\n      }\r\n\r\n      if ( ras.span_y != y || count >= FT_MAX_GRAY_SPANS )\r\n      {\r\n        if ( ras.render_span && count > 0 )\r\n          ras.render_span( ras.span_y, count, ras.gray_spans,\r\n                           ras.render_span_data );\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n        if ( count > 0 )\r\n        {\r\n          int  n;\r\n\r\n\r\n          FT_TRACE7(( \"y = %3d \", ras.span_y ));\r\n          span = ras.gray_spans;\r\n          for ( n = 0; n < count; n++, span++ )\r\n            FT_TRACE7(( \"[%d..%d]:%02x \",\r\n                        span->x, span->x + span->len - 1, span->coverage ));\r\n          FT_TRACE7(( \"\\n\" ));\r\n        }\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n        ras.num_gray_spans = 0;\r\n        ras.span_y         = (int)y;\r\n\r\n        count = 0;\r\n        span  = ras.gray_spans;\r\n      }\r\n      else\r\n        span++;\r\n\r\n      /* add a gray span to the current list */\r\n      span->x        = (short)x;\r\n      span->len      = (unsigned short)acount;\r\n      span->coverage = (unsigned char)coverage;\r\n\r\n      ras.num_gray_spans++;\r\n    }\r\n  }\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n  /* to be called while in the debugger --                                */\r\n  /* this function causes a compiler warning since it is unused otherwise */\r\n  static void\r\n  gray_dump_cells( RAS_ARG )\r\n  {\r\n    int  yindex;\r\n\r\n\r\n    for ( yindex = 0; yindex < ras.ycount; yindex++ )\r\n    {\r\n      PCell  cell;\r\n\r\n\r\n      printf( \"%3d:\", yindex );\r\n\r\n      for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )\r\n        printf( \" (%3ld, c:%4ld, a:%6d)\", cell->x, cell->cover, cell->area );\r\n      printf( \"\\n\" );\r\n    }\r\n  }\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  static void\r\n  gray_sweep( RAS_ARG_ const FT_Bitmap*  target )\r\n  {\r\n    int  yindex;\r\n\r\n    FT_UNUSED( target );\r\n\r\n\r\n    if ( ras.num_cells == 0 )\r\n      return;\r\n\r\n    ras.num_gray_spans = 0;\r\n\r\n    FT_TRACE7(( \"gray_sweep: start\\n\" ));\r\n\r\n    for ( yindex = 0; yindex < ras.ycount; yindex++ )\r\n    {\r\n      PCell   cell  = ras.ycells[yindex];\r\n      TCoord  cover = 0;\r\n      TCoord  x     = 0;\r\n\r\n\r\n      for ( ; cell != NULL; cell = cell->next )\r\n      {\r\n        TPos  area;\r\n\r\n\r\n        if ( cell->x > x && cover != 0 )\r\n          gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),\r\n                      cell->x - x );\r\n\r\n        cover += cell->cover;\r\n        area   = cover * ( ONE_PIXEL * 2 ) - cell->area;\r\n\r\n        if ( area != 0 && cell->x >= 0 )\r\n          gray_hline( RAS_VAR_ cell->x, yindex, area, 1 );\r\n\r\n        x = cell->x + 1;\r\n      }\r\n\r\n      if ( cover != 0 )\r\n        gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),\r\n                    ras.count_ex - x );\r\n    }\r\n\r\n    if ( ras.render_span && ras.num_gray_spans > 0 )\r\n      ras.render_span( ras.span_y, ras.num_gray_spans,\r\n                       ras.gray_spans, ras.render_span_data );\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n    if ( ras.num_gray_spans > 0 )\r\n    {\r\n      FT_Span*  span;\r\n      int       n;\r\n\r\n\r\n      FT_TRACE7(( \"y = %3d \", ras.span_y ));\r\n      span = ras.gray_spans;\r\n      for ( n = 0; n < ras.num_gray_spans; n++, span++ )\r\n        FT_TRACE7(( \"[%d..%d]:%02x \",\r\n                    span->x, span->x + span->len - 1, span->coverage ));\r\n      FT_TRACE7(( \"\\n\" ));\r\n    }\r\n\r\n    FT_TRACE7(( \"gray_sweep: end\\n\" ));\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n  }\r\n\r\n\r\n#ifdef _STANDALONE_\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  The following function should only compile in stand-alone mode,      */\r\n  /*  i.e., when building this component without the rest of FreeType.     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Decompose                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Walk over an outline's structure to decompose it into individual   */\r\n  /*    segments and Bézier arcs.  This function is also able to emit      */\r\n  /*    `move to' and `close to' operations to indicate the start and end  */\r\n  /*    of new contours in the outline.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline        :: A pointer to the source target.                  */\r\n  /*                                                                       */\r\n  /*    func_interface :: A table of `emitters', i.e., function pointers   */\r\n  /*                      called during decomposition to indicate path     */\r\n  /*                      operations.                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    user           :: A typeless pointer which is passed to each       */\r\n  /*                      emitter during the decomposition.  It can be     */\r\n  /*                      used to store the state during the               */\r\n  /*                      decomposition.                                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0 means success.                                      */\r\n  /*                                                                       */\r\n  static int\r\n  FT_Outline_Decompose( const FT_Outline*        outline,\r\n                        const FT_Outline_Funcs*  func_interface,\r\n                        void*                    user )\r\n  {\r\n#undef SCALED\r\n#define SCALED( x )  ( ( (x) << shift ) - delta )\r\n\r\n    FT_Vector   v_last;\r\n    FT_Vector   v_control;\r\n    FT_Vector   v_start;\r\n\r\n    FT_Vector*  point;\r\n    FT_Vector*  limit;\r\n    char*       tags;\r\n\r\n    int         error;\r\n\r\n    int   n;         /* index of contour in outline     */\r\n    int   first;     /* index of first point in contour */\r\n    char  tag;       /* current point's state           */\r\n\r\n    int   shift;\r\n    TPos  delta;\r\n\r\n\r\n    if ( !outline || !func_interface )\r\n      return ErrRaster_Invalid_Argument;\r\n\r\n    shift = func_interface->shift;\r\n    delta = func_interface->delta;\r\n    first = 0;\r\n\r\n    for ( n = 0; n < outline->n_contours; n++ )\r\n    {\r\n      int  last;  /* index of last point in contour */\r\n\r\n\r\n      FT_TRACE5(( \"FT_Outline_Decompose: Outline %d\\n\", n ));\r\n\r\n      last  = outline->contours[n];\r\n      if ( last < 0 )\r\n        goto Invalid_Outline;\r\n      limit = outline->points + last;\r\n\r\n      v_start   = outline->points[first];\r\n      v_start.x = SCALED( v_start.x );\r\n      v_start.y = SCALED( v_start.y );\r\n\r\n      v_last   = outline->points[last];\r\n      v_last.x = SCALED( v_last.x );\r\n      v_last.y = SCALED( v_last.y );\r\n\r\n      v_control = v_start;\r\n\r\n      point = outline->points + first;\r\n      tags  = outline->tags   + first;\r\n      tag   = FT_CURVE_TAG( tags[0] );\r\n\r\n      /* A contour cannot start with a cubic control point! */\r\n      if ( tag == FT_CURVE_TAG_CUBIC )\r\n        goto Invalid_Outline;\r\n\r\n      /* check first point to determine origin */\r\n      if ( tag == FT_CURVE_TAG_CONIC )\r\n      {\r\n        /* first point is conic control.  Yes, this happens. */\r\n        if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )\r\n        {\r\n          /* start at last point if it is on the curve */\r\n          v_start = v_last;\r\n          limit--;\r\n        }\r\n        else\r\n        {\r\n          /* if both first and last points are conic,         */\r\n          /* start at their middle and record its position    */\r\n          /* for closure                                      */\r\n          v_start.x = ( v_start.x + v_last.x ) / 2;\r\n          v_start.y = ( v_start.y + v_last.y ) / 2;\r\n\r\n          v_last = v_start;\r\n        }\r\n        point--;\r\n        tags--;\r\n      }\r\n\r\n      FT_TRACE5(( \"  move to (%.2f, %.2f)\\n\",\r\n                  v_start.x / 64.0, v_start.y / 64.0 ));\r\n      error = func_interface->move_to( &v_start, user );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      while ( point < limit )\r\n      {\r\n        point++;\r\n        tags++;\r\n\r\n        tag = FT_CURVE_TAG( tags[0] );\r\n        switch ( tag )\r\n        {\r\n        case FT_CURVE_TAG_ON:  /* emit a single line_to */\r\n          {\r\n            FT_Vector  vec;\r\n\r\n\r\n            vec.x = SCALED( point->x );\r\n            vec.y = SCALED( point->y );\r\n\r\n            FT_TRACE5(( \"  line to (%.2f, %.2f)\\n\",\r\n                        vec.x / 64.0, vec.y / 64.0 ));\r\n            error = func_interface->line_to( &vec, user );\r\n            if ( error )\r\n              goto Exit;\r\n            continue;\r\n          }\r\n\r\n        case FT_CURVE_TAG_CONIC:  /* consume conic arcs */\r\n          v_control.x = SCALED( point->x );\r\n          v_control.y = SCALED( point->y );\r\n\r\n        Do_Conic:\r\n          if ( point < limit )\r\n          {\r\n            FT_Vector  vec;\r\n            FT_Vector  v_middle;\r\n\r\n\r\n            point++;\r\n            tags++;\r\n            tag = FT_CURVE_TAG( tags[0] );\r\n\r\n            vec.x = SCALED( point->x );\r\n            vec.y = SCALED( point->y );\r\n\r\n            if ( tag == FT_CURVE_TAG_ON )\r\n            {\r\n              FT_TRACE5(( \"  conic to (%.2f, %.2f)\"\r\n                          \" with control (%.2f, %.2f)\\n\",\r\n                          vec.x / 64.0, vec.y / 64.0,\r\n                          v_control.x / 64.0, v_control.y / 64.0 ));\r\n              error = func_interface->conic_to( &v_control, &vec, user );\r\n              if ( error )\r\n                goto Exit;\r\n              continue;\r\n            }\r\n\r\n            if ( tag != FT_CURVE_TAG_CONIC )\r\n              goto Invalid_Outline;\r\n\r\n            v_middle.x = ( v_control.x + vec.x ) / 2;\r\n            v_middle.y = ( v_control.y + vec.y ) / 2;\r\n\r\n            FT_TRACE5(( \"  conic to (%.2f, %.2f)\"\r\n                        \" with control (%.2f, %.2f)\\n\",\r\n                        v_middle.x / 64.0, v_middle.y / 64.0,\r\n                        v_control.x / 64.0, v_control.y / 64.0 ));\r\n            error = func_interface->conic_to( &v_control, &v_middle, user );\r\n            if ( error )\r\n              goto Exit;\r\n\r\n            v_control = vec;\r\n            goto Do_Conic;\r\n          }\r\n\r\n          FT_TRACE5(( \"  conic to (%.2f, %.2f)\"\r\n                      \" with control (%.2f, %.2f)\\n\",\r\n                      v_start.x / 64.0, v_start.y / 64.0,\r\n                      v_control.x / 64.0, v_control.y / 64.0 ));\r\n          error = func_interface->conic_to( &v_control, &v_start, user );\r\n          goto Close;\r\n\r\n        default:  /* FT_CURVE_TAG_CUBIC */\r\n          {\r\n            FT_Vector  vec1, vec2;\r\n\r\n\r\n            if ( point + 1 > limit                             ||\r\n                 FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )\r\n              goto Invalid_Outline;\r\n\r\n            point += 2;\r\n            tags  += 2;\r\n\r\n            vec1.x = SCALED( point[-2].x );\r\n            vec1.y = SCALED( point[-2].y );\r\n\r\n            vec2.x = SCALED( point[-1].x );\r\n            vec2.y = SCALED( point[-1].y );\r\n\r\n            if ( point <= limit )\r\n            {\r\n              FT_Vector  vec;\r\n\r\n\r\n              vec.x = SCALED( point->x );\r\n              vec.y = SCALED( point->y );\r\n\r\n              FT_TRACE5(( \"  cubic to (%.2f, %.2f)\"\r\n                          \" with controls (%.2f, %.2f) and (%.2f, %.2f)\\n\",\r\n                          vec.x / 64.0, vec.y / 64.0,\r\n                          vec1.x / 64.0, vec1.y / 64.0,\r\n                          vec2.x / 64.0, vec2.y / 64.0 ));\r\n              error = func_interface->cubic_to( &vec1, &vec2, &vec, user );\r\n              if ( error )\r\n                goto Exit;\r\n              continue;\r\n            }\r\n\r\n            FT_TRACE5(( \"  cubic to (%.2f, %.2f)\"\r\n                        \" with controls (%.2f, %.2f) and (%.2f, %.2f)\\n\",\r\n                        v_start.x / 64.0, v_start.y / 64.0,\r\n                        vec1.x / 64.0, vec1.y / 64.0,\r\n                        vec2.x / 64.0, vec2.y / 64.0 ));\r\n            error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );\r\n            goto Close;\r\n          }\r\n        }\r\n      }\r\n\r\n      /* close the contour with a line segment */\r\n      FT_TRACE5(( \"  line to (%.2f, %.2f)\\n\",\r\n                  v_start.x / 64.0, v_start.y / 64.0 ));\r\n      error = func_interface->line_to( &v_start, user );\r\n\r\n   Close:\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      first = last + 1;\r\n    }\r\n\r\n    FT_TRACE5(( \"FT_Outline_Decompose: Done\\n\", n ));\r\n    return 0;\r\n\r\n  Exit:\r\n    FT_TRACE5(( \"FT_Outline_Decompose: Error %d\\n\", error ));\r\n    return error;\r\n\r\n  Invalid_Outline:\r\n    return ErrRaster_Invalid_Outline;\r\n  }\r\n\r\n#endif /* _STANDALONE_ */\r\n\r\n\r\n  typedef struct  gray_TBand_\r\n  {\r\n    TPos  min, max;\r\n\r\n  } gray_TBand;\r\n\r\n    FT_DEFINE_OUTLINE_FUNCS(func_interface,\r\n      (FT_Outline_MoveTo_Func) gray_move_to,\r\n      (FT_Outline_LineTo_Func) gray_line_to,\r\n      (FT_Outline_ConicTo_Func)gray_conic_to,\r\n      (FT_Outline_CubicTo_Func)gray_cubic_to,\r\n      0,\r\n      0\r\n    )\r\n\r\n  static int\r\n  gray_convert_glyph_inner( RAS_ARG )\r\n  {\r\n\r\n    volatile int  error = 0;\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n      FT_Outline_Funcs func_interface;\r\n      Init_Class_func_interface(&func_interface);\r\n#endif\r\n\r\n    if ( ft_setjmp( ras.jump_buffer ) == 0 )\r\n    {\r\n      error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );\r\n      gray_record_cell( RAS_VAR );\r\n    }\r\n    else\r\n      error = ErrRaster_Memory_Overflow;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static int\r\n  gray_convert_glyph( RAS_ARG )\r\n  {\r\n    gray_TBand            bands[40];\r\n    gray_TBand* volatile  band;\r\n    int volatile          n, num_bands;\r\n    TPos volatile         min, max, max_y;\r\n    FT_BBox*              clip;\r\n\r\n\r\n    /* Set up state in the raster object */\r\n    gray_compute_cbox( RAS_VAR );\r\n\r\n    /* clip to target bitmap, exit if nothing to do */\r\n    clip = &ras.clip_box;\r\n\r\n    if ( ras.max_ex <= clip->xMin || ras.min_ex >= clip->xMax ||\r\n         ras.max_ey <= clip->yMin || ras.min_ey >= clip->yMax )\r\n      return 0;\r\n\r\n    if ( ras.min_ex < clip->xMin ) ras.min_ex = clip->xMin;\r\n    if ( ras.min_ey < clip->yMin ) ras.min_ey = clip->yMin;\r\n\r\n    if ( ras.max_ex > clip->xMax ) ras.max_ex = clip->xMax;\r\n    if ( ras.max_ey > clip->yMax ) ras.max_ey = clip->yMax;\r\n\r\n    ras.count_ex = ras.max_ex - ras.min_ex;\r\n    ras.count_ey = ras.max_ey - ras.min_ey;\r\n\r\n    /* set up vertical bands */\r\n    num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );\r\n    if ( num_bands == 0 )\r\n      num_bands = 1;\r\n    if ( num_bands >= 39 )\r\n      num_bands = 39;\r\n\r\n    ras.band_shoot = 0;\r\n\r\n    min   = ras.min_ey;\r\n    max_y = ras.max_ey;\r\n\r\n    for ( n = 0; n < num_bands; n++, min = max )\r\n    {\r\n      max = min + ras.band_size;\r\n      if ( n == num_bands - 1 || max > max_y )\r\n        max = max_y;\r\n\r\n      bands[0].min = min;\r\n      bands[0].max = max;\r\n      band         = bands;\r\n\r\n      while ( band >= bands )\r\n      {\r\n        TPos  bottom, top, middle;\r\n        int   error;\r\n\r\n        {\r\n          PCell  cells_max;\r\n          int    yindex;\r\n          long   cell_start, cell_end, cell_mod;\r\n\r\n\r\n          ras.ycells = (PCell*)ras.buffer;\r\n          ras.ycount = band->max - band->min;\r\n\r\n          cell_start = sizeof ( PCell ) * ras.ycount;\r\n          cell_mod   = cell_start % sizeof ( TCell );\r\n          if ( cell_mod > 0 )\r\n            cell_start += sizeof ( TCell ) - cell_mod;\r\n\r\n          cell_end  = ras.buffer_size;\r\n          cell_end -= cell_end % sizeof ( TCell );\r\n\r\n          cells_max = (PCell)( (char*)ras.buffer + cell_end );\r\n          ras.cells = (PCell)( (char*)ras.buffer + cell_start );\r\n          if ( ras.cells >= cells_max )\r\n            goto ReduceBands;\r\n\r\n          ras.max_cells = cells_max - ras.cells;\r\n          if ( ras.max_cells < 2 )\r\n            goto ReduceBands;\r\n\r\n          for ( yindex = 0; yindex < ras.ycount; yindex++ )\r\n            ras.ycells[yindex] = NULL;\r\n        }\r\n\r\n        ras.num_cells = 0;\r\n        ras.invalid   = 1;\r\n        ras.min_ey    = band->min;\r\n        ras.max_ey    = band->max;\r\n        ras.count_ey  = band->max - band->min;\r\n\r\n        error = gray_convert_glyph_inner( RAS_VAR );\r\n\r\n        if ( !error )\r\n        {\r\n          gray_sweep( RAS_VAR_ &ras.target );\r\n          band--;\r\n          continue;\r\n        }\r\n        else if ( error != ErrRaster_Memory_Overflow )\r\n          return 1;\r\n\r\n      ReduceBands:\r\n        /* render pool overflow; we will reduce the render band by half */\r\n        bottom = band->min;\r\n        top    = band->max;\r\n        middle = bottom + ( ( top - bottom ) >> 1 );\r\n\r\n        /* This is too complex for a single scanline; there must */\r\n        /* be some problems.                                     */\r\n        if ( middle == bottom )\r\n        {\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n          FT_TRACE7(( \"gray_convert_glyph: rotten glyph\\n\" ));\r\n#endif\r\n          return 1;\r\n        }\r\n\r\n        if ( bottom-top >= ras.band_size )\r\n          ras.band_shoot++;\r\n\r\n        band[1].min = bottom;\r\n        band[1].max = middle;\r\n        band[0].min = middle;\r\n        band[0].max = top;\r\n        band++;\r\n      }\r\n    }\r\n\r\n    if ( ras.band_shoot > 8 && ras.band_size > 16 )\r\n      ras.band_size = ras.band_size / 2;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  gray_raster_render( gray_PRaster             raster,\r\n                      const FT_Raster_Params*  params )\r\n  {\r\n    const FT_Outline*  outline    = (const FT_Outline*)params->source;\r\n    const FT_Bitmap*   target_map = params->target;\r\n    gray_PWorker       worker;\r\n\r\n\r\n    if ( !raster || !raster->buffer || !raster->buffer_size )\r\n      return ErrRaster_Invalid_Argument;\r\n\r\n    if ( !outline )\r\n      return ErrRaster_Invalid_Outline;\r\n\r\n    /* return immediately if the outline is empty */\r\n    if ( outline->n_points == 0 || outline->n_contours <= 0 )\r\n      return 0;\r\n\r\n    if ( !outline->contours || !outline->points )\r\n      return ErrRaster_Invalid_Outline;\r\n\r\n    if ( outline->n_points !=\r\n           outline->contours[outline->n_contours - 1] + 1 )\r\n      return ErrRaster_Invalid_Outline;\r\n\r\n    worker = raster->worker;\r\n\r\n    /* if direct mode is not set, we must have a target bitmap */\r\n    if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )\r\n    {\r\n      if ( !target_map )\r\n        return ErrRaster_Invalid_Argument;\r\n\r\n      /* nothing to do */\r\n      if ( !target_map->width || !target_map->rows )\r\n        return 0;\r\n\r\n      if ( !target_map->buffer )\r\n        return ErrRaster_Invalid_Argument;\r\n    }\r\n\r\n    /* this version does not support monochrome rendering */\r\n    if ( !( params->flags & FT_RASTER_FLAG_AA ) )\r\n      return ErrRaster_Invalid_Mode;\r\n\r\n    /* compute clipping box */\r\n    if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )\r\n    {\r\n      /* compute clip box from target pixmap */\r\n      ras.clip_box.xMin = 0;\r\n      ras.clip_box.yMin = 0;\r\n      ras.clip_box.xMax = target_map->width;\r\n      ras.clip_box.yMax = target_map->rows;\r\n    }\r\n    else if ( params->flags & FT_RASTER_FLAG_CLIP )\r\n      ras.clip_box = params->clip_box;\r\n    else\r\n    {\r\n      ras.clip_box.xMin = -32768L;\r\n      ras.clip_box.yMin = -32768L;\r\n      ras.clip_box.xMax =  32767L;\r\n      ras.clip_box.yMax =  32767L;\r\n    }\r\n\r\n    gray_init_cells( RAS_VAR_ raster->buffer, raster->buffer_size );\r\n\r\n    ras.outline        = *outline;\r\n    ras.num_cells      = 0;\r\n    ras.invalid        = 1;\r\n    ras.band_size      = raster->band_size;\r\n    ras.num_gray_spans = 0;\r\n\r\n    if ( params->flags & FT_RASTER_FLAG_DIRECT )\r\n    {\r\n      ras.render_span      = (FT_Raster_Span_Func)params->gray_spans;\r\n      ras.render_span_data = params->user;\r\n    }\r\n    else\r\n    {\r\n      ras.target           = *target_map;\r\n      ras.render_span      = (FT_Raster_Span_Func)gray_render_span;\r\n      ras.render_span_data = &ras;\r\n    }\r\n\r\n    return gray_convert_glyph( RAS_VAR );\r\n  }\r\n\r\n\r\n  /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/\r\n  /****                         a static object.                   *****/\r\n\r\n#ifdef _STANDALONE_\r\n\r\n  static int\r\n  gray_raster_new( void*       memory,\r\n                   FT_Raster*  araster )\r\n  {\r\n    static gray_TRaster  the_raster;\r\n\r\n    FT_UNUSED( memory );\r\n\r\n\r\n    *araster = (FT_Raster)&the_raster;\r\n    FT_MEM_ZERO( &the_raster, sizeof ( the_raster ) );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static void\r\n  gray_raster_done( FT_Raster  raster )\r\n  {\r\n    /* nothing */\r\n    FT_UNUSED( raster );\r\n  }\r\n\r\n#else /* !_STANDALONE_ */\r\n\r\n  static int\r\n  gray_raster_new( FT_Memory   memory,\r\n                   FT_Raster*  araster )\r\n  {\r\n    FT_Error      error;\r\n    gray_PRaster  raster = NULL;\r\n\r\n\r\n    *araster = 0;\r\n    if ( !FT_ALLOC( raster, sizeof ( gray_TRaster ) ) )\r\n    {\r\n      raster->memory = memory;\r\n      *araster       = (FT_Raster)raster;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  gray_raster_done( FT_Raster  raster )\r\n  {\r\n    FT_Memory  memory = (FT_Memory)((gray_PRaster)raster)->memory;\r\n\r\n\r\n    FT_FREE( raster );\r\n  }\r\n\r\n#endif /* !_STANDALONE_ */\r\n\r\n\r\n  static void\r\n  gray_raster_reset( FT_Raster  raster,\r\n                     char*      pool_base,\r\n                     long       pool_size )\r\n  {\r\n    gray_PRaster  rast = (gray_PRaster)raster;\r\n\r\n\r\n    if ( raster )\r\n    {\r\n      if ( pool_base && pool_size >= (long)sizeof ( gray_TWorker ) + 2048 )\r\n      {\r\n        gray_PWorker  worker = (gray_PWorker)pool_base;\r\n\r\n\r\n        rast->worker      = worker;\r\n        rast->buffer      = pool_base +\r\n                              ( ( sizeof ( gray_TWorker ) +\r\n                                  sizeof ( TCell ) - 1 )  &\r\n                                ~( sizeof ( TCell ) - 1 ) );\r\n        rast->buffer_size = (long)( ( pool_base + pool_size ) -\r\n                                    (char*)rast->buffer ) &\r\n                                      ~( sizeof ( TCell ) - 1 );\r\n        rast->band_size   = (int)( rast->buffer_size /\r\n                                     ( sizeof ( TCell ) * 8 ) );\r\n      }\r\n      else\r\n      {\r\n        rast->buffer      = NULL;\r\n        rast->buffer_size = 0;\r\n        rast->worker      = NULL;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  FT_DEFINE_RASTER_FUNCS(ft_grays_raster,\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    (FT_Raster_New_Func)     gray_raster_new,\r\n    (FT_Raster_Reset_Func)   gray_raster_reset,\r\n    (FT_Raster_Set_Mode_Func)0,\r\n    (FT_Raster_Render_Func)  gray_raster_render,\r\n    (FT_Raster_Done_Func)    gray_raster_done\r\n  )\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftgrays.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgrays.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType smooth renderer declaration                                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGRAYS_H__\r\n#define __FTGRAYS_H__\r\n\r\n#ifdef __cplusplus\r\n  extern \"C\" {\r\n#endif\r\n\r\n\r\n#ifdef _STANDALONE_\r\n#include \"ftimage.h\"\r\n#else\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H /* for FT_CONFIG_OPTION_PIC */\r\n#include FT_IMAGE_H\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* To make ftgrays.h independent from configuration files we check       */\r\n  /* whether FT_EXPORT_VAR has been defined already.                       */\r\n  /*                                                                       */\r\n  /* On some systems and compilers (Win32 mostly), an extra keyword is     */\r\n  /* necessary to compile the library as a DLL.                            */\r\n  /*                                                                       */\r\n#ifndef FT_EXPORT_VAR\r\n#define FT_EXPORT_VAR( x )  extern  x\r\n#endif\r\n\r\n  FT_EXPORT_VAR( const FT_Raster_Funcs )  ft_grays_raster;\r\n\r\n\r\n#ifdef __cplusplus\r\n  }\r\n#endif\r\n\r\n#endif /* __FTGRAYS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftsmerrs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsmerrs.h                                                             */\r\n/*                                                                         */\r\n/*    smooth renderer error codes (specification only).                    */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the smooth renderer error enumeration     */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __FTSMERRS_H__\r\n#define __FTSMERRS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  Smooth_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Smooth\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __FTSMERRS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftsmooth.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsmooth.c                                                             */\r\n/*                                                                         */\r\n/*    Anti-aliasing renderer interface (body).                             */\r\n/*                                                                         */\r\n/*  Copyright 2000-2006, 2009-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4701 : Potentially uninitialized local variable 'name' used\r\n#pragma warning( disable : 4701 )\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_OUTLINE_H\r\n#include \"ftsmooth.h\"\r\n#include \"ftgrays.h\"\r\n#include \"ftspic.h\"\r\n\r\n#include \"ftsmerrs.h\"\r\n\r\n\r\n  /* initialize renderer -- init its raster */\r\n  static FT_Error\r\n  ft_smooth_init( FT_Renderer  render )\r\n  {\r\n    FT_Library  library = FT_MODULE_LIBRARY( render );\r\n\r\n\r\n    render->clazz->raster_class->raster_reset( render->raster,\r\n                                               library->raster_pool,\r\n                                               library->raster_pool_size );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /* sets render-specific mode */\r\n  static FT_Error\r\n  ft_smooth_set_mode( FT_Renderer  render,\r\n                      FT_ULong     mode_tag,\r\n                      FT_Pointer   data )\r\n  {\r\n    /* we simply pass it to the raster */\r\n    return render->clazz->raster_class->raster_set_mode( render->raster,\r\n                                                         mode_tag,\r\n                                                         data );\r\n  }\r\n\r\n  /* transform a given glyph image */\r\n  static FT_Error\r\n  ft_smooth_transform( FT_Renderer       render,\r\n                       FT_GlyphSlot      slot,\r\n                       const FT_Matrix*  matrix,\r\n                       const FT_Vector*  delta )\r\n  {\r\n    FT_Error  error = Smooth_Err_Ok;\r\n\r\n\r\n    if ( slot->format != render->glyph_format )\r\n    {\r\n      error = Smooth_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( matrix )\r\n      FT_Outline_Transform( &slot->outline, matrix );\r\n\r\n    if ( delta )\r\n      FT_Outline_Translate( &slot->outline, delta->x, delta->y );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /* return the glyph's control box */\r\n  static void\r\n  ft_smooth_get_cbox( FT_Renderer   render,\r\n                      FT_GlyphSlot  slot,\r\n                      FT_BBox*      cbox )\r\n  {\r\n    FT_MEM_ZERO( cbox, sizeof ( *cbox ) );\r\n\r\n    if ( slot->format == render->glyph_format )\r\n      FT_Outline_Get_CBox( &slot->outline, cbox );\r\n  }\r\n\r\n\r\n  /* convert a slot's glyph image into a bitmap */\r\n  static FT_Error\r\n  ft_smooth_render_generic( FT_Renderer       render,\r\n                            FT_GlyphSlot      slot,\r\n                            FT_Render_Mode    mode,\r\n                            const FT_Vector*  origin,\r\n                            FT_Render_Mode    required_mode )\r\n  {\r\n    FT_Error     error;\r\n    FT_Outline*  outline = NULL;\r\n    FT_BBox      cbox;\r\n    FT_Pos       width, height, pitch;\r\n#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n    FT_Pos       height_org, width_org;\r\n#endif\r\n    FT_Bitmap*   bitmap;\r\n    FT_Memory    memory;\r\n    FT_Int       hmul = mode == FT_RENDER_MODE_LCD;\r\n    FT_Int       vmul = mode == FT_RENDER_MODE_LCD_V;\r\n    FT_Pos       x_shift, y_shift, x_left, y_top;\r\n\r\n    FT_Raster_Params  params;\r\n\r\n    FT_Bool  have_translated_origin = FALSE;\r\n    FT_Bool  have_outline_shifted   = FALSE;\r\n    FT_Bool  have_buffer            = FALSE;\r\n\r\n\r\n    /* check glyph image format */\r\n    if ( slot->format != render->glyph_format )\r\n    {\r\n      error = Smooth_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* check mode */\r\n    if ( mode != required_mode )\r\n    {\r\n      error = Smooth_Err_Cannot_Render_Glyph;\r\n      goto Exit;\r\n    }\r\n\r\n    outline = &slot->outline;\r\n\r\n    /* translate the outline to the new origin if needed */\r\n    if ( origin )\r\n    {\r\n      FT_Outline_Translate( outline, origin->x, origin->y );\r\n      have_translated_origin = TRUE;\r\n    }\r\n\r\n    /* compute the control box, and grid fit it */\r\n    FT_Outline_Get_CBox( outline, &cbox );\r\n\r\n    cbox.xMin = FT_PIX_FLOOR( cbox.xMin );\r\n    cbox.yMin = FT_PIX_FLOOR( cbox.yMin );\r\n    cbox.xMax = FT_PIX_CEIL( cbox.xMax );\r\n    cbox.yMax = FT_PIX_CEIL( cbox.yMax );\r\n\r\n    if ( cbox.xMin < 0 && cbox.xMax > FT_INT_MAX + cbox.xMin )\r\n    {\r\n      FT_ERROR(( \"ft_smooth_render_generic: glyph too large:\"\r\n                 \" xMin = %d, xMax = %d\\n\",\r\n                 cbox.xMin >> 6, cbox.xMax >> 6 ));\r\n      error = Smooth_Err_Raster_Overflow;\r\n      goto Exit;\r\n    }\r\n    else\r\n      width = ( cbox.xMax - cbox.xMin ) >> 6;\r\n\r\n    if ( cbox.yMin < 0 && cbox.yMax > FT_INT_MAX + cbox.yMin )\r\n    {\r\n      FT_ERROR(( \"ft_smooth_render_generic: glyph too large:\"\r\n                 \" yMin = %d, yMax = %d\\n\",\r\n                 cbox.yMin >> 6, cbox.yMax >> 6 ));\r\n      error = Smooth_Err_Raster_Overflow;\r\n      goto Exit;\r\n    }\r\n    else\r\n      height = ( cbox.yMax - cbox.yMin ) >> 6;\r\n\r\n    bitmap = &slot->bitmap;\r\n    memory = render->root.memory;\r\n\r\n#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n    width_org  = width;\r\n    height_org = height;\r\n#endif\r\n\r\n    /* release old bitmap buffer */\r\n    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )\r\n    {\r\n      FT_FREE( bitmap->buffer );\r\n      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;\r\n    }\r\n\r\n    /* allocate new one */\r\n    pitch = width;\r\n    if ( hmul )\r\n    {\r\n      width = width * 3;\r\n      pitch = FT_PAD_CEIL( width, 4 );\r\n    }\r\n\r\n    if ( vmul )\r\n      height *= 3;\r\n\r\n    x_shift = (FT_Int) cbox.xMin;\r\n    y_shift = (FT_Int) cbox.yMin;\r\n    x_left  = (FT_Int)( cbox.xMin >> 6 );\r\n    y_top   = (FT_Int)( cbox.yMax >> 6 );\r\n\r\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n\r\n    if ( slot->library->lcd_filter_func )\r\n    {\r\n      FT_Int  extra = slot->library->lcd_extra;\r\n\r\n\r\n      if ( hmul )\r\n      {\r\n        x_shift -= 64 * ( extra >> 1 );\r\n        width   += 3 * extra;\r\n        pitch    = FT_PAD_CEIL( width, 4 );\r\n        x_left  -= extra >> 1;\r\n      }\r\n\r\n      if ( vmul )\r\n      {\r\n        y_shift -= 64 * ( extra >> 1 );\r\n        height  += 3 * extra;\r\n        y_top   += extra >> 1;\r\n      }\r\n    }\r\n\r\n#endif\r\n\r\n#if FT_UINT_MAX > 0xFFFFU\r\n\r\n    /* Required check is (pitch * height < FT_ULONG_MAX),        */\r\n    /* but we care realistic cases only.  Always pitch <= width. */\r\n    if ( width > 0x7FFF || height > 0x7FFF )\r\n    {\r\n      FT_ERROR(( \"ft_smooth_render_generic: glyph too large: %u x %u\\n\",\r\n                 width, height ));\r\n      error = Smooth_Err_Raster_Overflow;\r\n      goto Exit;\r\n    }\r\n\r\n#endif\r\n\r\n    bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;\r\n    bitmap->num_grays  = 256;\r\n    bitmap->width      = width;\r\n    bitmap->rows       = height;\r\n    bitmap->pitch      = pitch;\r\n\r\n    /* translate outline to render it into the bitmap */\r\n    FT_Outline_Translate( outline, -x_shift, -y_shift );\r\n    have_outline_shifted = TRUE;\r\n\r\n    if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )\r\n      goto Exit;\r\n    else\r\n      have_buffer = TRUE;\r\n\r\n    slot->internal->flags |= FT_GLYPH_OWN_BITMAP;\r\n\r\n    /* set up parameters */\r\n    params.target = bitmap;\r\n    params.source = outline;\r\n    params.flags  = FT_RASTER_FLAG_AA;\r\n\r\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n\r\n    /* implode outline if needed */\r\n    {\r\n      FT_Vector*  points     = outline->points;\r\n      FT_Vector*  points_end = points + outline->n_points;\r\n      FT_Vector*  vec;\r\n\r\n\r\n      if ( hmul )\r\n        for ( vec = points; vec < points_end; vec++ )\r\n          vec->x *= 3;\r\n\r\n      if ( vmul )\r\n        for ( vec = points; vec < points_end; vec++ )\r\n          vec->y *= 3;\r\n    }\r\n\r\n    /* render outline into the bitmap */\r\n    error = render->raster_render( render->raster, &params );\r\n\r\n    /* deflate outline if needed */\r\n    {\r\n      FT_Vector*  points     = outline->points;\r\n      FT_Vector*  points_end = points + outline->n_points;\r\n      FT_Vector*  vec;\r\n\r\n\r\n      if ( hmul )\r\n        for ( vec = points; vec < points_end; vec++ )\r\n          vec->x /= 3;\r\n\r\n      if ( vmul )\r\n        for ( vec = points; vec < points_end; vec++ )\r\n          vec->y /= 3;\r\n    }\r\n\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( slot->library->lcd_filter_func )\r\n      slot->library->lcd_filter_func( bitmap, mode, slot->library );\r\n\r\n#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\r\n\r\n    /* render outline into bitmap */\r\n    error = render->raster_render( render->raster, &params );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* expand it horizontally */\r\n    if ( hmul )\r\n    {\r\n      FT_Byte*  line = bitmap->buffer;\r\n      FT_UInt   hh;\r\n\r\n\r\n      for ( hh = height_org; hh > 0; hh--, line += pitch )\r\n      {\r\n        FT_UInt   xx;\r\n        FT_Byte*  end = line + width;\r\n\r\n\r\n        for ( xx = width_org; xx > 0; xx-- )\r\n        {\r\n          FT_UInt  pixel = line[xx-1];\r\n\r\n\r\n          end[-3] = (FT_Byte)pixel;\r\n          end[-2] = (FT_Byte)pixel;\r\n          end[-1] = (FT_Byte)pixel;\r\n          end    -= 3;\r\n        }\r\n      }\r\n    }\r\n\r\n    /* expand it vertically */\r\n    if ( vmul )\r\n    {\r\n      FT_Byte*  read  = bitmap->buffer + ( height - height_org ) * pitch;\r\n      FT_Byte*  write = bitmap->buffer;\r\n      FT_UInt   hh;\r\n\r\n\r\n      for ( hh = height_org; hh > 0; hh-- )\r\n      {\r\n        ft_memcpy( write, read, pitch );\r\n        write += pitch;\r\n\r\n        ft_memcpy( write, read, pitch );\r\n        write += pitch;\r\n\r\n        ft_memcpy( write, read, pitch );\r\n        write += pitch;\r\n        read  += pitch;\r\n      }\r\n    }\r\n\r\n#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\r\n\r\n    /*\r\n     * XXX: on 16bit system, we return an error for huge bitmap\r\n     * to prevent an overflow.\r\n     */\r\n    if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX )\r\n    {\r\n      error = Smooth_Err_Invalid_Pixel_Size;\r\n      goto Exit;\r\n    }\r\n\r\n    slot->format      = FT_GLYPH_FORMAT_BITMAP;\r\n    slot->bitmap_left = (FT_Int)x_left;\r\n    slot->bitmap_top  = (FT_Int)y_top;\r\n\r\n    /* everything is fine; don't deallocate buffer */\r\n    have_buffer = FALSE;\r\n\r\n    error = Smooth_Err_Ok;\r\n\r\n  Exit:\r\n    if ( have_outline_shifted )\r\n      FT_Outline_Translate( outline, x_shift, y_shift );\r\n    if ( have_translated_origin )\r\n      FT_Outline_Translate( outline, -origin->x, -origin->y );\r\n    if ( have_buffer )\r\n    {\r\n      FT_FREE( bitmap->buffer );\r\n      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* convert a slot's glyph image into a bitmap */\r\n  static FT_Error\r\n  ft_smooth_render( FT_Renderer       render,\r\n                    FT_GlyphSlot      slot,\r\n                    FT_Render_Mode    mode,\r\n                    const FT_Vector*  origin )\r\n  {\r\n    if ( mode == FT_RENDER_MODE_LIGHT )\r\n      mode = FT_RENDER_MODE_NORMAL;\r\n\r\n    return ft_smooth_render_generic( render, slot, mode, origin,\r\n                                     FT_RENDER_MODE_NORMAL );\r\n  }\r\n\r\n\r\n  /* convert a slot's glyph image into a horizontal LCD bitmap */\r\n  static FT_Error\r\n  ft_smooth_render_lcd( FT_Renderer       render,\r\n                        FT_GlyphSlot      slot,\r\n                        FT_Render_Mode    mode,\r\n                        const FT_Vector*  origin )\r\n  {\r\n    FT_Error  error;\r\n\r\n    error = ft_smooth_render_generic( render, slot, mode, origin,\r\n                                      FT_RENDER_MODE_LCD );\r\n    if ( !error )\r\n      slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* convert a slot's glyph image into a vertical LCD bitmap */\r\n  static FT_Error\r\n  ft_smooth_render_lcd_v( FT_Renderer       render,\r\n                          FT_GlyphSlot      slot,\r\n                          FT_Render_Mode    mode,\r\n                          const FT_Vector*  origin )\r\n  {\r\n    FT_Error  error;\r\n\r\n    error = ft_smooth_render_generic( render, slot, mode, origin,\r\n                                      FT_RENDER_MODE_LCD_V );\r\n    if ( !error )\r\n      slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_DEFINE_RENDERER( ft_smooth_renderer_class,\r\n\r\n      FT_MODULE_RENDERER,\r\n      sizeof ( FT_RendererRec ),\r\n\r\n      \"smooth\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,    /* module specific interface */\r\n\r\n      (FT_Module_Constructor)ft_smooth_init,\r\n      (FT_Module_Destructor) 0,\r\n      (FT_Module_Requester)  0\r\n    ,\r\n\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    (FT_Renderer_RenderFunc)   ft_smooth_render,\r\n    (FT_Renderer_TransformFunc)ft_smooth_transform,\r\n    (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,\r\n    (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,\r\n\r\n    (FT_Raster_Funcs*)    &FT_GRAYS_RASTER_GET\r\n  )\r\n\r\n\r\n  FT_DEFINE_RENDERER( ft_smooth_lcd_renderer_class,\r\n\r\n      FT_MODULE_RENDERER,\r\n      sizeof ( FT_RendererRec ),\r\n\r\n      \"smooth-lcd\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,    /* module specific interface */\r\n\r\n      (FT_Module_Constructor)ft_smooth_init,\r\n      (FT_Module_Destructor) 0,\r\n      (FT_Module_Requester)  0\r\n    ,\r\n\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    (FT_Renderer_RenderFunc)   ft_smooth_render_lcd,\r\n    (FT_Renderer_TransformFunc)ft_smooth_transform,\r\n    (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,\r\n    (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,\r\n\r\n    (FT_Raster_Funcs*)    &FT_GRAYS_RASTER_GET\r\n  )\r\n\r\n  FT_DEFINE_RENDERER( ft_smooth_lcdv_renderer_class,\r\n\r\n      FT_MODULE_RENDERER,\r\n      sizeof ( FT_RendererRec ),\r\n\r\n      \"smooth-lcdv\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,    /* module specific interface */\r\n\r\n      (FT_Module_Constructor)ft_smooth_init,\r\n      (FT_Module_Destructor) 0,\r\n      (FT_Module_Requester)  0\r\n    ,\r\n\r\n    FT_GLYPH_FORMAT_OUTLINE,\r\n\r\n    (FT_Renderer_RenderFunc)   ft_smooth_render_lcd_v,\r\n    (FT_Renderer_TransformFunc)ft_smooth_transform,\r\n    (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,\r\n    (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,\r\n\r\n    (FT_Raster_Funcs*)    &FT_GRAYS_RASTER_GET\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftsmooth.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsmooth.h                                                             */\r\n/*                                                                         */\r\n/*    Anti-aliasing renderer interface (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTSMOOTH_H__\r\n#define __FTSMOOTH_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_RENDER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_STD_RASTER\r\n  FT_DECLARE_RENDERER( ft_std_renderer_class )\r\n#endif\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER\r\n  FT_DECLARE_RENDERER( ft_smooth_renderer_class )\r\n\r\n  FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )\r\n\r\n  FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class )\r\n#endif\r\n\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSMOOTH_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftspic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftspic.c                                                               */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for smooth module.   */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"ftspic.h\"\r\n#include \"ftsmerrs.h\"\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from ftgrays.c */\r\n  void\r\n  FT_Init_Class_ft_grays_raster( FT_Raster_Funcs*  funcs );\r\n\r\n  void\r\n  ft_smooth_renderer_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory  memory = library->memory;\r\n\r\n\r\n    if ( pic_container->smooth )\r\n    {\r\n      SmoothPIC*  container = (SmoothPIC*)pic_container->smooth;\r\n\r\n\r\n      if ( --container->ref_count )\r\n        return;\r\n      FT_FREE( container );\r\n      pic_container->smooth = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  ft_smooth_renderer_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = Smooth_Err_Ok;\r\n    SmoothPIC*         container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* since this function also serve smooth_lcd and smooth_lcdv renderers,\r\n       it implements reference counting */\r\n    if ( pic_container->smooth )\r\n    {\r\n      ((SmoothPIC*)pic_container->smooth)->ref_count++;\r\n      return error;\r\n    }\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->smooth = container;\r\n    container->ref_count = 1;\r\n\r\n    /* initialize pointer table - this is how the module usually expects this data */\r\n    FT_Init_Class_ft_grays_raster( &container->ft_grays_raster );\r\n/*Exit:*/\r\n    if ( error )\r\n      ft_smooth_renderer_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n  /* re-route these init and free functions to the above functions */\r\n  FT_Error ft_smooth_lcd_renderer_class_pic_init( FT_Library  library )\r\n  {\r\n    return ft_smooth_renderer_class_pic_init( library );\r\n  }\r\n\r\n  void ft_smooth_lcd_renderer_class_pic_free( FT_Library  library )\r\n  {\r\n    ft_smooth_renderer_class_pic_free( library );\r\n  }\r\n\r\n  FT_Error ft_smooth_lcdv_renderer_class_pic_init( FT_Library  library )\r\n  {\r\n    return ft_smooth_renderer_class_pic_init( library );\r\n  }\r\n\r\n  void ft_smooth_lcdv_renderer_class_pic_free( FT_Library  library )\r\n  {\r\n    ft_smooth_renderer_class_pic_free( library );\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/ftspic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftspic.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for smooth module.   */\r\n/*                                                                         */\r\n/*  Copyright 2009 by                                                      */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTSPIC_H__\r\n#define __FTSPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#include FT_INTERNAL_PIC_H\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n#define FT_GRAYS_RASTER_GET        ft_grays_raster\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n  typedef struct SmoothPIC_\r\n  {\r\n    int ref_count;\r\n    FT_Raster_Funcs ft_grays_raster;\r\n  } SmoothPIC;\r\n\r\n#define GET_PIC(lib)               ((SmoothPIC*)((lib)->pic_container.smooth))\r\n#define FT_GRAYS_RASTER_GET        (GET_PIC(library)->ft_grays_raster)\r\n\r\n  /* see ftspic.c for the implementation */\r\n  void\r\n  ft_smooth_renderer_class_pic_free( FT_Library  library );\r\n\r\n  void\r\n  ft_smooth_lcd_renderer_class_pic_free( FT_Library  library );\r\n\r\n  void\r\n  ft_smooth_lcdv_renderer_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  ft_smooth_renderer_class_pic_init( FT_Library  library );\r\n\r\n  FT_Error\r\n  ft_smooth_lcd_renderer_class_pic_init( FT_Library  library );\r\n\r\n  FT_Error\r\n  ft_smooth_lcdv_renderer_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/module.mk",
    "content": "#\r\n# FreeType 2 smooth renderer module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += SMOOTH_RENDERER\r\n\r\ndefine SMOOTH_RENDERER\r\n$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)\r\n$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)\r\n$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/rules.mk",
    "content": "#\r\n# FreeType 2 smooth renderer module build rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# smooth driver directory\r\n#\r\nSMOOTH_DIR := $(SRC_DIR)/smooth\r\n\r\n# compilation flags for the driver\r\n#\r\nSMOOTH_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR))\r\n\r\n\r\n# smooth driver sources (i.e., C files)\r\n#\r\nSMOOTH_DRV_SRC := $(SMOOTH_DIR)/ftgrays.c  \\\r\n                  $(SMOOTH_DIR)/ftsmooth.c \\\r\n                  $(SMOOTH_DIR)/ftspic.c\r\n\r\n\r\n# smooth driver headers\r\n#\r\nSMOOTH_DRV_H := $(SMOOTH_DRV_SRC:%c=%h)  \\\r\n                $(SMOOTH_DIR)/ftsmerrs.h\r\n\r\n\r\n# smooth driver object(s)\r\n#\r\n#   SMOOTH_DRV_OBJ_M is used during `multi' builds.\r\n#   SMOOTH_DRV_OBJ_S is used during `single' builds.\r\n#\r\nSMOOTH_DRV_OBJ_M := $(SMOOTH_DRV_SRC:$(SMOOTH_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nSMOOTH_DRV_OBJ_S := $(OBJ_DIR)/smooth.$O\r\n\r\n# smooth driver source file for single build\r\n#\r\nSMOOTH_DRV_SRC_S := $(SMOOTH_DIR)/smooth.c\r\n\r\n\r\n# smooth driver - single object\r\n#\r\n$(SMOOTH_DRV_OBJ_S): $(SMOOTH_DRV_SRC_S) $(SMOOTH_DRV_SRC) \\\r\n                     $(FREETYPE_H) $(SMOOTH_DRV_H)\r\n\t$(SMOOTH_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SMOOTH_DRV_SRC_S))\r\n\r\n\r\n# smooth driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(SMOOTH_DIR)/%.c $(FREETYPE_H) $(SMOOTH_DRV_H)\r\n\t$(SMOOTH_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(SMOOTH_DRV_OBJ_S)\r\nDRV_OBJS_M += $(SMOOTH_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/smooth/smooth.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  smooth.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType anti-aliasing rasterer module component (body only).        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"ftspic.c\"\r\n#include \"ftgrays.c\"\r\n#include \"ftsmooth.c\"\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/Jamfile",
    "content": "# Jamfile for src/tools\r\n#\r\nSubDir FT2_TOP src tools ;\r\n\r\nMain  apinames : apinames.c ;\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/apinames.c",
    "content": "/*\r\n * This little program is used to parse the FreeType headers and\r\n * find the declaration of all public APIs.  This is easy, because\r\n * they all look like the following:\r\n *\r\n *   FT_EXPORT( return_type )\r\n *   function_name( function arguments );\r\n *\r\n * You must pass the list of header files as arguments.  Wildcards are\r\n * accepted if you are using GCC for compilation (and probably by\r\n * other compilers too).\r\n *\r\n * Author: David Turner, 2005, 2006, 2008-2012\r\n *\r\n * This code is explicitly placed into the public domain.\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <ctype.h>\r\n\r\n#define  PROGRAM_NAME     \"apinames\"\r\n#define  PROGRAM_VERSION  \"0.1\"\r\n\r\n#define  LINEBUFF_SIZE  1024\r\n\r\ntypedef enum  OutputFormat_\r\n{\r\n  OUTPUT_LIST = 0,      /* output the list of names, one per line             */\r\n  OUTPUT_WINDOWS_DEF,   /* output a Windows .DEF file for Visual C++ or Mingw */\r\n  OUTPUT_BORLAND_DEF,   /* output a Windows .DEF file for Borland C++         */\r\n  OUTPUT_WATCOM_LBC     /* output a Watcom Linker Command File                */\r\n\r\n} OutputFormat;\r\n\r\n\r\nstatic void\r\npanic( const char*  message )\r\n{\r\n  fprintf( stderr, \"PANIC: %s\\n\", message );\r\n  exit(2);\r\n}\r\n\r\n\r\ntypedef struct  NameRec_\r\n{\r\n  char*         name;\r\n  unsigned int  hash;\r\n\r\n} NameRec, *Name;\r\n\r\nstatic Name  the_names;\r\nstatic int   num_names;\r\nstatic int   max_names;\r\n\r\nstatic void\r\nnames_add( const char*  name,\r\n           const char*  end )\r\n{\r\n  unsigned int  h;\r\n  int           nn, len;\r\n  Name          nm;\r\n\r\n  if ( end <= name )\r\n    return;\r\n\r\n  /* compute hash value */\r\n  len = (int)(end - name);\r\n  h   = 0;\r\n  for ( nn = 0; nn < len; nn++ )\r\n    h = h*33 + name[nn];\r\n\r\n  /* check for an pre-existing name */\r\n  for ( nn = 0; nn < num_names; nn++ )\r\n  {\r\n    nm = the_names + nn;\r\n\r\n    if ( (int)nm->hash                 == h &&\r\n         memcmp( name, nm->name, len ) == 0 &&\r\n         nm->name[len]                 == 0 )\r\n      return;\r\n  }\r\n\r\n  /* add new name */\r\n  if ( num_names >= max_names )\r\n  {\r\n    max_names += (max_names >> 1) + 4;\r\n    the_names  = (NameRec*)realloc( the_names,\r\n                                    sizeof ( the_names[0] ) * max_names );\r\n    if ( the_names == NULL )\r\n      panic( \"not enough memory\" );\r\n  }\r\n  nm = &the_names[num_names++];\r\n\r\n  nm->hash = h;\r\n  nm->name = (char*)malloc( len+1 );\r\n  if ( nm->name == NULL )\r\n    panic( \"not enough memory\" );\r\n\r\n  memcpy( nm->name, name, len );\r\n  nm->name[len] = 0;\r\n}\r\n\r\n\r\nstatic int\r\nname_compare( const void*  name1,\r\n              const void*  name2 )\r\n{\r\n  Name  n1 = (Name)name1;\r\n  Name  n2 = (Name)name2;\r\n\r\n  return strcmp( n1->name, n2->name );\r\n}\r\n\r\nstatic void\r\nnames_sort( void )\r\n{\r\n  qsort( the_names, (size_t)num_names,\r\n         sizeof ( the_names[0] ), name_compare );\r\n}\r\n\r\n\r\nstatic void\r\nnames_dump( FILE*         out,\r\n            OutputFormat  format,\r\n            const char*   dll_name )\r\n{\r\n  int  nn;\r\n\r\n\r\n  switch ( format )\r\n  {\r\n    case OUTPUT_WINDOWS_DEF:\r\n      if ( dll_name )\r\n        fprintf( out, \"LIBRARY %s\\n\", dll_name );\r\n\r\n      fprintf( out, \"DESCRIPTION  FreeType 2 DLL\\n\" );\r\n      fprintf( out, \"EXPORTS\\n\" );\r\n      for ( nn = 0; nn < num_names; nn++ )\r\n        fprintf( out, \"  %s\\n\", the_names[nn].name );\r\n      break;\r\n\r\n    case OUTPUT_BORLAND_DEF:\r\n      if ( dll_name )\r\n        fprintf( out, \"LIBRARY %s\\n\", dll_name );\r\n\r\n      fprintf( out, \"DESCRIPTION  FreeType 2 DLL\\n\" );\r\n      fprintf( out, \"EXPORTS\\n\" );\r\n      for ( nn = 0; nn < num_names; nn++ )\r\n        fprintf( out, \"  _%s\\n\", the_names[nn].name );\r\n      break;\r\n\r\n    case OUTPUT_WATCOM_LBC:\r\n      {\r\n        /* we must omit the .dll suffix from the library name */\r\n        char         temp[512];\r\n        const char*  dot;\r\n\r\n\r\n        if ( dll_name == NULL )\r\n        {\r\n          fprintf( stderr,\r\n                   \"you must provide a DLL name with the -d option!\\n\" );\r\n          exit( 4 );\r\n        }\r\n\r\n        dot = strchr( dll_name, '.' );\r\n        if ( dot != NULL )\r\n        {\r\n          int  len = dot - dll_name;\r\n\r\n\r\n          if ( len > (int)( sizeof ( temp ) - 1 ) )\r\n            len = sizeof ( temp ) - 1;\r\n\r\n          memcpy( temp, dll_name, len );\r\n          temp[len] = 0;\r\n\r\n          dll_name = (const char*)temp;\r\n        }\r\n\r\n        for ( nn = 0; nn < num_names; nn++ )\r\n          fprintf( out, \"++_%s.%s.%s\\n\", the_names[nn].name, dll_name,\r\n                        the_names[nn].name );\r\n      }\r\n      break;\r\n\r\n    default:  /* LIST */\r\n      for ( nn = 0; nn < num_names; nn++ )\r\n        fprintf( out, \"%s\\n\", the_names[nn].name );\r\n  }\r\n}\r\n\r\n\r\n\r\n\r\n/* states of the line parser */\r\n\r\ntypedef enum  State_\r\n{\r\n  STATE_START = 0,  /* waiting for FT_EXPORT keyword and return type */\r\n  STATE_TYPE        /* type was read, waiting for function name      */\r\n\r\n} State;\r\n\r\nstatic int\r\nread_header_file( FILE*  file, int  verbose )\r\n{\r\n  static char  buff[LINEBUFF_SIZE + 1];\r\n  State        state = STATE_START;\r\n\r\n  while ( !feof( file ) )\r\n  {\r\n    char*  p;\r\n\r\n    if ( !fgets( buff, LINEBUFF_SIZE, file ) )\r\n      break;\r\n\r\n    p = buff;\r\n\r\n    while ( *p && (*p == ' ' || *p == '\\\\') )  /* skip leading whitespace */\r\n      p++;\r\n\r\n    if ( *p == '\\n' || *p == '\\r' )  /* skip empty lines */\r\n      continue;\r\n\r\n    switch ( state )\r\n    {\r\n      case STATE_START:\r\n        {\r\n          if ( memcmp( p, \"FT_EXPORT(\", 10 ) != 0 )\r\n            break;\r\n\r\n          p += 10;\r\n          for (;;)\r\n          {\r\n            if ( *p == 0 || *p == '\\n' || *p == '\\r' )\r\n              goto NextLine;\r\n\r\n            if ( *p == ')' )\r\n            {\r\n              p++;\r\n              break;\r\n            }\r\n\r\n            p++;\r\n          }\r\n\r\n          state = STATE_TYPE;\r\n\r\n         /* sometimes, the name is just after the FT_EXPORT(...), so\r\n          * skip whitespace, and fall-through if we find an alphanumeric\r\n          * character\r\n          */\r\n          while ( *p == ' ' || *p == '\\t' )\r\n            p++;\r\n\r\n          if ( !isalpha(*p) )\r\n            break;\r\n        }\r\n        /* fall-through */\r\n\r\n      case STATE_TYPE:\r\n        {\r\n          char*   name = p;\r\n\r\n          while ( isalnum(*p) || *p == '_' )\r\n            p++;\r\n\r\n          if ( p > name )\r\n          {\r\n            if ( verbose )\r\n              fprintf( stderr, \">>> %.*s\\n\", (int)(p - name), name );\r\n\r\n            names_add( name, p );\r\n          }\r\n\r\n          state = STATE_START;\r\n        }\r\n        break;\r\n\r\n      default:\r\n        ;\r\n    }\r\n\r\n  NextLine:\r\n    ;\r\n  }\r\n\r\n  return 0;\r\n}\r\n\r\n\r\nstatic void\r\nusage( void )\r\n{\r\n  static const char* const  format =\r\n   \"%s %s: extract FreeType API names from header files\\n\\n\"\r\n   \"this program is used to extract the list of public FreeType API\\n\"\r\n   \"functions. It receives the list of header files as argument and\\n\"\r\n   \"generates a sorted list of unique identifiers\\n\\n\"\r\n\r\n   \"usage: %s header1 [options] [header2 ...]\\n\\n\"\r\n\r\n   \"options:   -      : parse the content of stdin, ignore arguments\\n\"\r\n   \"           -v     : verbose mode, output sent to standard error\\n\"\r\n   \"           -oFILE : write output to FILE instead of standard output\\n\"\r\n   \"           -dNAME : indicate DLL file name, 'freetype.dll' by default\\n\"\r\n   \"           -w     : output .DEF file for Visual C++ and Mingw\\n\"\r\n   \"           -wB    : output .DEF file for Borland C++\\n\"\r\n   \"           -wW    : output Watcom Linker Response File\\n\"\r\n   \"\\n\";\r\n\r\n  fprintf( stderr,\r\n           format,\r\n           PROGRAM_NAME,\r\n           PROGRAM_VERSION,\r\n           PROGRAM_NAME\r\n           );\r\n  exit(1);\r\n}\r\n\r\n\r\nint  main( int argc, const char* const*  argv )\r\n{\r\n  int           from_stdin = 0;\r\n  int           verbose = 0;\r\n  OutputFormat  format = OUTPUT_LIST;  /* the default */\r\n  FILE*         out    = stdout;\r\n  const char*   library_name = NULL;\r\n\r\n  if ( argc < 2 )\r\n    usage();\r\n\r\n  /* '-' used as a single argument means read source file from stdin */\r\n  while ( argc > 1 && argv[1][0] == '-' )\r\n  {\r\n    const char*  arg = argv[1];\r\n\r\n    switch ( arg[1] )\r\n    {\r\n      case 'v':\r\n        verbose = 1;\r\n        break;\r\n\r\n      case 'o':\r\n        if ( arg[2] == 0 )\r\n        {\r\n          if ( argc < 2 )\r\n            usage();\r\n\r\n          arg = argv[2];\r\n          argv++;\r\n          argc--;\r\n        }\r\n        else\r\n          arg += 2;\r\n\r\n        out = fopen( arg, \"wt\" );\r\n        if ( out == NULL )\r\n        {\r\n          fprintf( stderr, \"could not open '%s' for writing\\n\", argv[2] );\r\n          exit(3);\r\n        }\r\n        break;\r\n\r\n      case 'd':\r\n        if ( arg[2] == 0 )\r\n        {\r\n          if ( argc < 2 )\r\n            usage();\r\n\r\n          arg = argv[2];\r\n          argv++;\r\n          argc--;\r\n        }\r\n        else\r\n          arg += 2;\r\n\r\n        library_name = arg;\r\n        break;\r\n\r\n      case 'w':\r\n        format = OUTPUT_WINDOWS_DEF;\r\n        switch ( arg[2] )\r\n        {\r\n          case 'B':\r\n            format = OUTPUT_BORLAND_DEF;\r\n            break;\r\n\r\n          case 'W':\r\n            format = OUTPUT_WATCOM_LBC;\r\n            break;\r\n\r\n          case 0:\r\n            break;\r\n\r\n          default:\r\n            usage();\r\n        }\r\n        break;\r\n\r\n      case 0:\r\n        from_stdin = 1;\r\n        break;\r\n\r\n      default:\r\n        usage();\r\n    }\r\n\r\n    argc--;\r\n    argv++;\r\n  }\r\n\r\n  if ( from_stdin )\r\n  {\r\n    read_header_file( stdin, verbose );\r\n  }\r\n  else\r\n  {\r\n    for ( --argc, argv++; argc > 0; argc--, argv++ )\r\n    {\r\n      FILE*  file = fopen( argv[0], \"rb\" );\r\n\r\n      if ( file == NULL )\r\n        fprintf( stderr, \"unable to open '%s'\\n\", argv[0] );\r\n      else\r\n      {\r\n        if ( verbose )\r\n          fprintf( stderr, \"opening '%s'\\n\", argv[0] );\r\n\r\n        read_header_file( file, verbose );\r\n        fclose( file );\r\n      }\r\n    }\r\n  }\r\n\r\n  if ( num_names == 0 )\r\n    panic( \"could not find exported functions !!\\n\" );\r\n\r\n  names_sort();\r\n  names_dump( out, format, library_name );\r\n\r\n  if ( out != stdout )\r\n    fclose( out );\r\n\r\n  return 0;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/chktrcmp.py",
    "content": "#!/usr/bin/env python\r\n#\r\n# Check trace components in FreeType 2 source.\r\n# Author: suzuki toshiya, 2009\r\n#\r\n# This code is explicitly into the public domain.\r\n\r\n\r\nimport sys\r\nimport os\r\nimport re\r\n\r\nSRC_FILE_LIST   = []\r\nUSED_COMPONENT  = {}\r\nKNOWN_COMPONENT = {}\r\n\r\nSRC_FILE_DIRS   = [ \"src\" ]\r\nTRACE_DEF_FILES = [ \"include/freetype/internal/fttrace.h\" ]\r\n\r\n\r\n# --------------------------------------------------------------\r\n# Parse command line options\r\n#\r\n\r\nfor i in range( 1, len( sys.argv ) ):\r\n  if sys.argv[i].startswith( \"--help\" ):\r\n    print \"Usage: %s [option]\" % sys.argv[0]\r\n    print \"Search used-but-defined and defined-but-not-used trace_XXX macros\"\r\n    print \"\"\r\n    print \"  --help:\"\r\n    print \"        Show this help\"\r\n    print \"\"\r\n    print \"  --src-dirs=dir1:dir2:...\"\r\n    print \"        Specify the directories of C source files to be checked\"\r\n    print \"        Default is %s\" % \":\".join( SRC_FILE_DIRS )\r\n    print \"\"\r\n    print \"  --def-files=file1:file2:...\"\r\n    print \"        Specify the header files including FT_TRACE_DEF()\"\r\n    print \"        Default is %s\" % \":\".join( TRACE_DEF_FILES )\r\n    print \"\"\r\n    exit(0)\r\n  if sys.argv[i].startswith( \"--src-dirs=\" ):\r\n    SRC_FILE_DIRS = sys.argv[i].replace( \"--src-dirs=\", \"\", 1 ).split( \":\" )\r\n  elif sys.argv[i].startswith( \"--def-files=\" ):\r\n    TRACE_DEF_FILES = sys.argv[i].replace( \"--def-files=\", \"\", 1 ).split( \":\" )\r\n\r\n\r\n# --------------------------------------------------------------\r\n# Scan C source and header files using trace macros.\r\n#\r\n\r\nc_pathname_pat = re.compile( '^.*\\.[ch]$', re.IGNORECASE )\r\ntrace_use_pat  = re.compile( '^[ \\t]*#define[ \\t]+FT_COMPONENT[ \\t]+trace_' )\r\n\r\nfor d in SRC_FILE_DIRS:\r\n  for ( p, dlst, flst ) in os.walk( d ):\r\n    for f in flst:\r\n      if c_pathname_pat.match( f ) != None:\r\n        src_pathname = os.path.join( p, f )\r\n\r\n        line_num = 0\r\n        for src_line in open( src_pathname, 'r' ):\r\n          line_num = line_num + 1\r\n          src_line = src_line.strip()\r\n          if trace_use_pat.match( src_line ) != None:\r\n            component_name = trace_use_pat.sub( '', src_line )\r\n            if component_name in USED_COMPONENT:\r\n              USED_COMPONENT[component_name].append( \"%s:%d\" % ( src_pathname, line_num ) )\r\n            else:\r\n              USED_COMPONENT[component_name] = [ \"%s:%d\" % ( src_pathname, line_num ) ]\r\n\r\n\r\n# --------------------------------------------------------------\r\n# Scan header file(s) defining trace macros.\r\n#\r\n\r\ntrace_def_pat_opn = re.compile( '^.*FT_TRACE_DEF[ \\t]*\\([ \\t]*' )\r\ntrace_def_pat_cls = re.compile( '[ \\t\\)].*$' )\r\n\r\nfor f in TRACE_DEF_FILES:\r\n  line_num = 0\r\n  for hdr_line in open( f, 'r' ):\r\n    line_num = line_num + 1\r\n    hdr_line = hdr_line.strip()\r\n    if trace_def_pat_opn.match( hdr_line ) != None:\r\n      component_name = trace_def_pat_opn.sub( '', hdr_line )\r\n      component_name = trace_def_pat_cls.sub( '', component_name )\r\n      if component_name in KNOWN_COMPONENT:\r\n        print \"trace component %s is defined twice, see %s and fttrace.h:%d\" % \\\r\n          ( component_name, KNOWN_COMPONENT[component_name], line_num )\r\n      else:\r\n        KNOWN_COMPONENT[component_name] = \"%s:%d\" % \\\r\n          ( os.path.basename( f ), line_num )\r\n\r\n\r\n# --------------------------------------------------------------\r\n# Compare the used and defined trace macros.\r\n#\r\n\r\nprint \"# Trace component used in the implementations but not defined in fttrace.h.\"\r\ncmpnt = USED_COMPONENT.keys()\r\ncmpnt.sort()\r\nfor c in cmpnt:\r\n  if c not in KNOWN_COMPONENT:\r\n    print \"Trace component %s (used in %s) is not defined.\" % ( c, \", \".join( USED_COMPONENT[c] ) )\r\n\r\nprint \"# Trace component is defined but not used in the implementations.\"\r\ncmpnt = KNOWN_COMPONENT.keys()\r\ncmpnt.sort()\r\nfor c in cmpnt:\r\n  if c not in USED_COMPONENT:\r\n    if c != \"any\":\r\n      print \"Trace component %s (defined in %s) is not used.\" % ( c, KNOWN_COMPONENT[c] )\r\n\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/cordic.py",
    "content": "# compute arctangent table for CORDIC computations in fttrigon.c\r\nimport sys, math\r\n\r\n#units  = 64*65536.0   # don't change !!\r\nunits  = 256\r\nscale  = units/math.pi\r\nshrink = 1.0\r\ncomma  = \"\"\r\n\r\ndef calc_val( x ):\r\n    global units, shrink\r\n    angle  = math.atan(x)\r\n    shrink = shrink * math.cos(angle)\r\n    return angle/math.pi * units\r\n\r\ndef  print_val( n, x ):\r\n    global comma\r\n\r\n    lo  = int(x)\r\n    hi  = lo + 1\r\n    alo = math.atan(lo)\r\n    ahi = math.atan(hi)\r\n    ax  = math.atan(2.0**n)\r\n\r\n    errlo = abs( alo - ax )\r\n    errhi = abs( ahi - ax )\r\n\r\n    if ( errlo < errhi ):\r\n      hi = lo\r\n\r\n    sys.stdout.write( comma + repr( int(hi) ) )\r\n    comma = \", \"\r\n\r\n\r\nprint \"\"\r\nprint \"table of arctan( 1/2^n ) for PI = \" + repr(units/65536.0) + \" units\"\r\n\r\n# compute range of \"i\"\r\nr = [-1]\r\nr = r + range(32)\r\n\r\nfor n in r:\r\n\r\n    if n >= 0:\r\n        x = 1.0/(2.0**n)    # tangent value\r\n    else:\r\n        x = 2.0**(-n)\r\n\r\n    angle  = math.atan(x)    # arctangent\r\n    angle2 = angle*scale     # arctangent in FT_Angle units\r\n\r\n    # determine which integer value for angle gives the best tangent\r\n    lo  = int(angle2)\r\n    hi  = lo + 1\r\n    tlo = math.tan(lo/scale)\r\n    thi = math.tan(hi/scale)\r\n\r\n    errlo = abs( tlo - x )\r\n    errhi = abs( thi - x )\r\n\r\n    angle2 = hi\r\n    if errlo < errhi:\r\n        angle2 = lo\r\n\r\n    if angle2 <= 0:\r\n        break\r\n\r\n    sys.stdout.write( comma + repr( int(angle2) ) )\r\n    comma = \", \"\r\n\r\n    shrink = shrink * math.cos( angle2/scale)\r\n\r\n\r\nprint\r\nprint \"shrink factor    = \" + repr( shrink )\r\nprint \"shrink factor 2  = \" + repr( shrink * (2.0**32) )\r\nprint \"expansion factor = \" + repr(1/shrink)\r\nprint \"\"\r\n\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/content.py",
    "content": "#  Content (c) 2002, 2004, 2006-2009, 2012\r\n#    David Turner <david@freetype.org>\r\n#\r\n#  This file contains routines used to parse the content of documentation\r\n#  comment blocks and build more structured objects out of them.\r\n#\r\n\r\nfrom sources import *\r\nfrom utils import *\r\nimport string, re\r\n\r\n\r\n# this regular expression is used to detect code sequences. these\r\n# are simply code fragments embedded in '{' and '}' like in:\r\n#\r\n#  {\r\n#    x = y + z;\r\n#    if ( zookoo == 2 )\r\n#    {\r\n#      foobar();\r\n#    }\r\n#  }\r\n#\r\n# note that indentation of the starting and ending accolades must be\r\n# exactly the same. the code sequence can contain accolades at greater\r\n# indentation\r\n#\r\nre_code_start = re.compile( r\"(\\s*){\\s*$\" )\r\nre_code_end   = re.compile( r\"(\\s*)}\\s*$\" )\r\n\r\n\r\n# this regular expression is used to isolate identifiers from\r\n# other text\r\n#\r\nre_identifier = re.compile( r'((?:\\w|-)*)' )\r\n\r\n\r\n# we collect macros ending in `_H'; while outputting the object data, we use\r\n# this info together with the object's file location to emit the appropriate\r\n# header file macro and name before the object itself\r\n#\r\nre_header_macro = re.compile( r'^#define\\s{1,}(\\w{1,}_H)\\s{1,}<(.*)>' )\r\n\r\n\r\n#############################################################################\r\n#\r\n# The DocCode class is used to store source code lines.\r\n#\r\n#   'self.lines' contains a set of source code lines that will be dumped as\r\n#   HTML in a <PRE> tag.\r\n#\r\n#   The object is filled line by line by the parser; it strips the leading\r\n#   \"margin\" space from each input line before storing it in 'self.lines'.\r\n#\r\nclass  DocCode:\r\n\r\n    def  __init__( self, margin, lines ):\r\n        self.lines = []\r\n        self.words = None\r\n\r\n        # remove margin spaces\r\n        for l in lines:\r\n            if string.strip( l[:margin] ) == \"\":\r\n                l = l[margin:]\r\n            self.lines.append( l )\r\n\r\n    def  dump( self, prefix = \"\", width = 60 ):\r\n        lines = self.dump_lines( 0, width )\r\n        for l in lines:\r\n            print prefix + l\r\n\r\n    def  dump_lines( self, margin = 0, width = 60 ):\r\n        result = []\r\n        for l in self.lines:\r\n            result.append( \" \" * margin + l )\r\n        return result\r\n\r\n\r\n\r\n#############################################################################\r\n#\r\n# The DocPara class is used to store \"normal\" text paragraph.\r\n#\r\n#   'self.words' contains the list of words that make up the paragraph\r\n#\r\nclass  DocPara:\r\n\r\n    def  __init__( self, lines ):\r\n        self.lines = None\r\n        self.words = []\r\n        for l in lines:\r\n            l = string.strip( l )\r\n            self.words.extend( string.split( l ) )\r\n\r\n    def  dump( self, prefix = \"\", width = 60 ):\r\n        lines = self.dump_lines( 0, width )\r\n        for l in lines:\r\n            print prefix + l\r\n\r\n    def  dump_lines( self, margin = 0, width = 60 ):\r\n        cur    = \"\"  # current line\r\n        col    = 0   # current width\r\n        result = []\r\n\r\n        for word in self.words:\r\n            ln = len( word )\r\n            if col > 0:\r\n                ln = ln + 1\r\n\r\n            if col + ln > width:\r\n                result.append( \" \" * margin + cur )\r\n                cur = word\r\n                col = len( word )\r\n            else:\r\n                if col > 0:\r\n                    cur = cur + \" \"\r\n                cur = cur + word\r\n                col = col + ln\r\n\r\n        if col > 0:\r\n            result.append( \" \" * margin + cur )\r\n\r\n        return result\r\n\r\n\r\n\r\n#############################################################################\r\n#\r\n#  The DocField class is used to store a list containing either DocPara or\r\n#  DocCode objects. Each DocField also has an optional \"name\" which is used\r\n#  when the object corresponds to a field or value definition\r\n#\r\nclass  DocField:\r\n\r\n    def  __init__( self, name, lines ):\r\n        self.name  = name  # can be None for normal paragraphs/sources\r\n        self.items = []    # list of items\r\n\r\n        mode_none  = 0     # start parsing mode\r\n        mode_code  = 1     # parsing code sequences\r\n        mode_para  = 3     # parsing normal paragraph\r\n\r\n        margin     = -1    # current code sequence indentation\r\n        cur_lines  = []\r\n\r\n        # now analyze the markup lines to see if they contain paragraphs,\r\n        # code sequences or fields definitions\r\n        #\r\n        start = 0\r\n        mode  = mode_none\r\n\r\n        for l in lines:\r\n            # are we parsing a code sequence ?\r\n            if mode == mode_code:\r\n                m = re_code_end.match( l )\r\n                if m and len( m.group( 1 ) ) <= margin:\r\n                    # that's it, we finished the code sequence\r\n                    code = DocCode( 0, cur_lines )\r\n                    self.items.append( code )\r\n                    margin    = -1\r\n                    cur_lines = []\r\n                    mode      = mode_none\r\n                else:\r\n                    # nope, continue the code sequence\r\n                    cur_lines.append( l[margin:] )\r\n            else:\r\n                # start of code sequence ?\r\n                m = re_code_start.match( l )\r\n                if m:\r\n                    # save current lines\r\n                    if cur_lines:\r\n                        para = DocPara( cur_lines )\r\n                        self.items.append( para )\r\n                        cur_lines = []\r\n\r\n                    # switch to code extraction mode\r\n                    margin = len( m.group( 1 ) )\r\n                    mode   = mode_code\r\n                else:\r\n                    if not string.split( l ) and cur_lines:\r\n                        # if the line is empty, we end the current paragraph,\r\n                        # if any\r\n                        para = DocPara( cur_lines )\r\n                        self.items.append( para )\r\n                        cur_lines = []\r\n                    else:\r\n                        # otherwise, simply add the line to the current\r\n                        # paragraph\r\n                        cur_lines.append( l )\r\n\r\n        if mode == mode_code:\r\n            # unexpected end of code sequence\r\n            code = DocCode( margin, cur_lines )\r\n            self.items.append( code )\r\n        elif cur_lines:\r\n            para = DocPara( cur_lines )\r\n            self.items.append( para )\r\n\r\n    def  dump( self, prefix = \"\" ):\r\n        if self.field:\r\n            print prefix + self.field + \" ::\"\r\n            prefix = prefix + \"----\"\r\n\r\n        first = 1\r\n        for p in self.items:\r\n            if not first:\r\n                print \"\"\r\n            p.dump( prefix )\r\n            first = 0\r\n\r\n    def  dump_lines( self, margin = 0, width = 60 ):\r\n        result = []\r\n        nl     = None\r\n\r\n        for p in self.items:\r\n            if nl:\r\n                result.append( \"\" )\r\n\r\n            result.extend( p.dump_lines( margin, width ) )\r\n            nl = 1\r\n\r\n        return result\r\n\r\n\r\n\r\n# this regular expression is used to detect field definitions\r\n#\r\nre_field = re.compile( r\"\\s*(\\w*|\\w(\\w|\\.)*\\w)\\s*::\" )\r\n\r\n\r\n\r\nclass  DocMarkup:\r\n\r\n    def  __init__( self, tag, lines ):\r\n        self.tag    = string.lower( tag )\r\n        self.fields = []\r\n\r\n        cur_lines = []\r\n        field     = None\r\n        mode      = 0\r\n\r\n        for l in lines:\r\n            m = re_field.match( l )\r\n            if m:\r\n                # we detected the start of a new field definition\r\n\r\n                # first, save the current one\r\n                if cur_lines:\r\n                    f = DocField( field, cur_lines )\r\n                    self.fields.append( f )\r\n                    cur_lines = []\r\n                    field     = None\r\n\r\n                field     = m.group( 1 )   # record field name\r\n                ln        = len( m.group( 0 ) )\r\n                l         = \" \" * ln + l[ln:]\r\n                cur_lines = [l]\r\n            else:\r\n                cur_lines.append( l )\r\n\r\n        if field or cur_lines:\r\n            f = DocField( field, cur_lines )\r\n            self.fields.append( f )\r\n\r\n    def  get_name( self ):\r\n        try:\r\n            return self.fields[0].items[0].words[0]\r\n        except:\r\n            return None\r\n\r\n    def  get_start( self ):\r\n        try:\r\n            result = \"\"\r\n            for word in self.fields[0].items[0].words:\r\n                result = result + \" \" + word\r\n            return result[1:]\r\n        except:\r\n            return \"ERROR\"\r\n\r\n    def  dump( self, margin ):\r\n        print \" \" * margin + \"<\" + self.tag + \">\"\r\n        for f in self.fields:\r\n            f.dump( \"  \" )\r\n        print \" \" * margin + \"</\" + self.tag + \">\"\r\n\r\n\r\n\r\nclass  DocChapter:\r\n\r\n    def  __init__( self, block ):\r\n        self.block    = block\r\n        self.sections = []\r\n        if block:\r\n            self.name  = block.name\r\n            self.title = block.get_markup_words( \"title\" )\r\n            self.order = block.get_markup_words( \"sections\" )\r\n        else:\r\n            self.name  = \"Other\"\r\n            self.title = string.split( \"Miscellaneous\" )\r\n            self.order = []\r\n\r\n\r\n\r\nclass  DocSection:\r\n\r\n    def  __init__( self, name = \"Other\" ):\r\n        self.name        = name\r\n        self.blocks      = {}\r\n        self.block_names = []  # ordered block names in section\r\n        self.defs        = []\r\n        self.abstract    = \"\"\r\n        self.description = \"\"\r\n        self.order       = []\r\n        self.title       = \"ERROR\"\r\n        self.chapter     = None\r\n\r\n    def  add_def( self, block ):\r\n        self.defs.append( block )\r\n\r\n    def  add_block( self, block ):\r\n        self.block_names.append( block.name )\r\n        self.blocks[block.name] = block\r\n\r\n    def  process( self ):\r\n        # look up one block that contains a valid section description\r\n        for block in self.defs:\r\n            title = block.get_markup_text( \"title\" )\r\n            if title:\r\n                self.title       = title\r\n                self.abstract    = block.get_markup_words( \"abstract\" )\r\n                self.description = block.get_markup_items( \"description\" )\r\n                self.order       = block.get_markup_words( \"order\" )\r\n                return\r\n\r\n    def  reorder( self ):\r\n        self.block_names = sort_order_list( self.block_names, self.order )\r\n\r\n\r\n\r\nclass  ContentProcessor:\r\n\r\n    def  __init__( self ):\r\n        \"\"\"initialize a block content processor\"\"\"\r\n        self.reset()\r\n\r\n        self.sections = {}    # dictionary of documentation sections\r\n        self.section  = None  # current documentation section\r\n\r\n        self.chapters = []    # list of chapters\r\n\r\n        self.headers  = {}    # dictionary of header macros\r\n\r\n    def  set_section( self, section_name ):\r\n        \"\"\"set current section during parsing\"\"\"\r\n        if not self.sections.has_key( section_name ):\r\n            section = DocSection( section_name )\r\n            self.sections[section_name] = section\r\n            self.section                = section\r\n        else:\r\n            self.section = self.sections[section_name]\r\n\r\n    def  add_chapter( self, block ):\r\n        chapter = DocChapter( block )\r\n        self.chapters.append( chapter )\r\n\r\n\r\n    def  reset( self ):\r\n        \"\"\"reset the content processor for a new block\"\"\"\r\n        self.markups      = []\r\n        self.markup       = None\r\n        self.markup_lines = []\r\n\r\n    def  add_markup( self ):\r\n        \"\"\"add a new markup section\"\"\"\r\n        if self.markup and self.markup_lines:\r\n\r\n            # get rid of last line of markup if it's empty\r\n            marks = self.markup_lines\r\n            if len( marks ) > 0 and not string.strip( marks[-1] ):\r\n                self.markup_lines = marks[:-1]\r\n\r\n            m = DocMarkup( self.markup, self.markup_lines )\r\n\r\n            self.markups.append( m )\r\n\r\n            self.markup       = None\r\n            self.markup_lines = []\r\n\r\n    def  process_content( self, content ):\r\n        \"\"\"process a block content and return a list of DocMarkup objects\r\n           corresponding to it\"\"\"\r\n        markup       = None\r\n        markup_lines = []\r\n        first        = 1\r\n\r\n        for line in content:\r\n            found = None\r\n            for t in re_markup_tags:\r\n                m = t.match( line )\r\n                if m:\r\n                    found  = string.lower( m.group( 1 ) )\r\n                    prefix = len( m.group( 0 ) )\r\n                    line   = \" \" * prefix + line[prefix:]   # remove markup from line\r\n                    break\r\n\r\n            # is it the start of a new markup section ?\r\n            if found:\r\n                first = 0\r\n                self.add_markup()  # add current markup content\r\n                self.markup = found\r\n                if len( string.strip( line ) ) > 0:\r\n                    self.markup_lines.append( line )\r\n            elif first == 0:\r\n                self.markup_lines.append( line )\r\n\r\n        self.add_markup()\r\n\r\n        return self.markups\r\n\r\n    def  parse_sources( self, source_processor ):\r\n        blocks = source_processor.blocks\r\n        count  = len( blocks )\r\n\r\n        for n in range( count ):\r\n            source = blocks[n]\r\n            if source.content:\r\n                # this is a documentation comment, we need to catch\r\n                # all following normal blocks in the \"follow\" list\r\n                #\r\n                follow = []\r\n                m = n + 1\r\n                while m < count and not blocks[m].content:\r\n                    follow.append( blocks[m] )\r\n                    m = m + 1\r\n\r\n                doc_block = DocBlock( source, follow, self )\r\n\r\n    def  finish( self ):\r\n        # process all sections to extract their abstract, description\r\n        # and ordered list of items\r\n        #\r\n        for sec in self.sections.values():\r\n            sec.process()\r\n\r\n        # process chapters to check that all sections are correctly\r\n        # listed there\r\n        for chap in self.chapters:\r\n            for sec in chap.order:\r\n                if self.sections.has_key( sec ):\r\n                    section = self.sections[sec]\r\n                    section.chapter = chap\r\n                    section.reorder()\r\n                    chap.sections.append( section )\r\n                else:\r\n                    sys.stderr.write( \"WARNING: chapter '\" +          \\\r\n                        chap.name + \"' in \" + chap.block.location() + \\\r\n                        \" lists unknown section '\" + sec + \"'\\n\" )\r\n\r\n        # check that all sections are in a chapter\r\n        #\r\n        others = []\r\n        for sec in self.sections.values():\r\n            if not sec.chapter:\r\n                others.append( sec )\r\n\r\n        # create a new special chapter for all remaining sections\r\n        # when necessary\r\n        #\r\n        if others:\r\n            chap = DocChapter( None )\r\n            chap.sections = others\r\n            self.chapters.append( chap )\r\n\r\n\r\n\r\nclass  DocBlock:\r\n\r\n    def  __init__( self, source, follow, processor ):\r\n        processor.reset()\r\n\r\n        self.source  = source\r\n        self.code    = []\r\n        self.type    = \"ERRTYPE\"\r\n        self.name    = \"ERRNAME\"\r\n        self.section = processor.section\r\n        self.markups = processor.process_content( source.content )\r\n\r\n        # compute block type from first markup tag\r\n        try:\r\n            self.type = self.markups[0].tag\r\n        except:\r\n            pass\r\n\r\n        # compute block name from first markup paragraph\r\n        try:\r\n            markup = self.markups[0]\r\n            para   = markup.fields[0].items[0]\r\n            name   = para.words[0]\r\n            m = re_identifier.match( name )\r\n            if m:\r\n                name = m.group( 1 )\r\n            self.name = name\r\n        except:\r\n            pass\r\n\r\n        if self.type == \"section\":\r\n            # detect new section starts\r\n            processor.set_section( self.name )\r\n            processor.section.add_def( self )\r\n        elif self.type == \"chapter\":\r\n            # detect new chapter\r\n            processor.add_chapter( self )\r\n        else:\r\n            processor.section.add_block( self )\r\n\r\n        # now, compute the source lines relevant to this documentation\r\n        # block. We keep normal comments in for obvious reasons (??)\r\n        source = []\r\n        for b in follow:\r\n            if b.format:\r\n                break\r\n            for l in b.lines:\r\n                # collect header macro definitions\r\n                m = re_header_macro.match( l )\r\n                if m:\r\n                    processor.headers[m.group( 2 )] = m.group( 1 );\r\n\r\n                # we use \"/* */\" as a separator\r\n                if re_source_sep.match( l ):\r\n                    break\r\n                source.append( l )\r\n\r\n        # now strip the leading and trailing empty lines from the sources\r\n        start = 0\r\n        end   = len( source ) - 1\r\n\r\n        while start < end and not string.strip( source[start] ):\r\n            start = start + 1\r\n\r\n        while start < end and not string.strip( source[end] ):\r\n            end = end - 1\r\n\r\n        if start == end and not string.strip( source[start] ):\r\n            self.code = []\r\n        else:\r\n            self.code = source[start:end + 1]\r\n\r\n    def  location( self ):\r\n        return self.source.location()\r\n\r\n    def  get_markup( self, tag_name ):\r\n        \"\"\"return the DocMarkup corresponding to a given tag in a block\"\"\"\r\n        for m in self.markups:\r\n            if m.tag == string.lower( tag_name ):\r\n                return m\r\n        return None\r\n\r\n    def  get_markup_name( self, tag_name ):\r\n        \"\"\"return the name of a given primary markup in a block\"\"\"\r\n        try:\r\n            m = self.get_markup( tag_name )\r\n            return m.get_name()\r\n        except:\r\n            return None\r\n\r\n    def  get_markup_words( self, tag_name ):\r\n        try:\r\n            m = self.get_markup( tag_name )\r\n            return m.fields[0].items[0].words\r\n        except:\r\n            return []\r\n\r\n    def  get_markup_text( self, tag_name ):\r\n        result = self.get_markup_words( tag_name )\r\n        return string.join( result )\r\n\r\n    def  get_markup_items( self, tag_name ):\r\n        try:\r\n            m = self.get_markup( tag_name )\r\n            return m.fields[0].items\r\n        except:\r\n            return None\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/docbeauty.py",
    "content": "#!/usr/bin/env python\r\n#\r\n#  DocBeauty (c) 2003, 2004, 2008 David Turner <david@freetype.org>\r\n#\r\n# This program is used to beautify the documentation comments used\r\n# in the FreeType 2 public headers.\r\n#\r\n\r\nfrom sources import *\r\nfrom content import *\r\nfrom utils   import *\r\n\r\nimport utils\r\n\r\nimport sys, os, time, string, getopt\r\n\r\n\r\ncontent_processor = ContentProcessor()\r\n\r\n\r\ndef  beautify_block( block ):\r\n    if block.content:\r\n        content_processor.reset()\r\n\r\n        markups = content_processor.process_content( block.content )\r\n        text    = []\r\n        first   = 1\r\n\r\n        for markup in markups:\r\n            text.extend( markup.beautify( first ) )\r\n            first = 0\r\n\r\n        # now beautify the documentation \"borders\" themselves\r\n        lines = [\" /*************************************************************************\"]\r\n        for l in text:\r\n            lines.append( \"  *\" + l )\r\n        lines.append( \"  */\" )\r\n\r\n        block.lines = lines\r\n\r\n\r\ndef  usage():\r\n    print \"\\nDocBeauty 0.1 Usage information\\n\"\r\n    print \"  docbeauty [options] file1 [file2 ...]\\n\"\r\n    print \"using the following options:\\n\"\r\n    print \"  -h : print this page\"\r\n    print \"  -b : backup original files with the 'orig' extension\"\r\n    print \"\"\r\n    print \"  --backup : same as -b\"\r\n\r\n\r\ndef  main( argv ):\r\n    \"\"\"main program loop\"\"\"\r\n\r\n    global output_dir\r\n\r\n    try:\r\n        opts, args = getopt.getopt( sys.argv[1:], \\\r\n                                    \"hb\",         \\\r\n                                    [\"help\", \"backup\"] )\r\n    except getopt.GetoptError:\r\n        usage()\r\n        sys.exit( 2 )\r\n\r\n    if args == []:\r\n        usage()\r\n        sys.exit( 1 )\r\n\r\n    # process options\r\n    #\r\n    output_dir = None\r\n    do_backup  = None\r\n\r\n    for opt in opts:\r\n        if opt[0] in ( \"-h\", \"--help\" ):\r\n            usage()\r\n            sys.exit( 0 )\r\n\r\n        if opt[0] in ( \"-b\", \"--backup\" ):\r\n            do_backup = 1\r\n\r\n    # create context and processor\r\n    source_processor = SourceProcessor()\r\n\r\n    # retrieve the list of files to process\r\n    file_list = make_file_list( args )\r\n    for filename in file_list:\r\n        source_processor.parse_file( filename )\r\n\r\n        for block in source_processor.blocks:\r\n            beautify_block( block )\r\n\r\n        new_name = filename + \".new\"\r\n        ok       = None\r\n\r\n        try:\r\n            file = open( new_name, \"wt\" )\r\n            for block in source_processor.blocks:\r\n                for line in block.lines:\r\n                    file.write( line )\r\n                    file.write( \"\\n\" )\r\n            file.close()\r\n        except:\r\n            ok = 0\r\n\r\n\r\n# if called from the command line\r\n#\r\nif __name__ == '__main__':\r\n    main( sys.argv )\r\n\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/docmaker.py",
    "content": "#!/usr/bin/env python\r\n#\r\n#  DocMaker (c) 2002, 2004, 2008 David Turner <david@freetype.org>\r\n#\r\n# This program is a re-write of the original DocMaker took used\r\n# to generate the API Reference of the FreeType font engine\r\n# by converting in-source comments into structured HTML.\r\n#\r\n# This new version is capable of outputting XML data, as well\r\n# as accepts more liberal formatting options.\r\n#\r\n# It also uses regular expression matching and substitution\r\n# to speed things significantly.\r\n#\r\n\r\nfrom sources   import *\r\nfrom content   import *\r\nfrom utils     import *\r\nfrom formatter import *\r\nfrom tohtml    import *\r\n\r\nimport utils\r\n\r\nimport sys, os, time, string, glob, getopt\r\n\r\n\r\ndef  usage():\r\n    print \"\\nDocMaker Usage information\\n\"\r\n    print \"  docmaker [options] file1 [file2 ...]\\n\"\r\n    print \"using the following options:\\n\"\r\n    print \"  -h : print this page\"\r\n    print \"  -t : set project title, as in '-t \\\"My Project\\\"'\"\r\n    print \"  -o : set output directory, as in '-o mydir'\"\r\n    print \"  -p : set documentation prefix, as in '-p ft2'\"\r\n    print \"\"\r\n    print \"  --title  : same as -t, as in '--title=\\\"My Project\\\"'\"\r\n    print \"  --output : same as -o, as in '--output=mydir'\"\r\n    print \"  --prefix : same as -p, as in '--prefix=ft2'\"\r\n\r\n\r\ndef  main( argv ):\r\n    \"\"\"main program loop\"\"\"\r\n\r\n    global output_dir\r\n\r\n    try:\r\n        opts, args = getopt.getopt( sys.argv[1:], \\\r\n                                    \"ht:o:p:\",    \\\r\n                                    [\"help\", \"title=\", \"output=\", \"prefix=\"] )\r\n    except getopt.GetoptError:\r\n        usage()\r\n        sys.exit( 2 )\r\n\r\n    if args == []:\r\n        usage()\r\n        sys.exit( 1 )\r\n\r\n    # process options\r\n    #\r\n    project_title  = \"Project\"\r\n    project_prefix = None\r\n    output_dir     = None\r\n\r\n    for opt in opts:\r\n        if opt[0] in ( \"-h\", \"--help\" ):\r\n            usage()\r\n            sys.exit( 0 )\r\n\r\n        if opt[0] in ( \"-t\", \"--title\" ):\r\n            project_title = opt[1]\r\n\r\n        if opt[0] in ( \"-o\", \"--output\" ):\r\n            utils.output_dir = opt[1]\r\n\r\n        if opt[0] in ( \"-p\", \"--prefix\" ):\r\n            project_prefix = opt[1]\r\n\r\n    check_output()\r\n\r\n    # create context and processor\r\n    source_processor  = SourceProcessor()\r\n    content_processor = ContentProcessor()\r\n\r\n    # retrieve the list of files to process\r\n    file_list = make_file_list( args )\r\n    for filename in file_list:\r\n        source_processor.parse_file( filename )\r\n        content_processor.parse_sources( source_processor )\r\n\r\n    # process sections\r\n    content_processor.finish()\r\n\r\n    formatter = HtmlFormatter( content_processor, project_title, project_prefix )\r\n\r\n    formatter.toc_dump()\r\n    formatter.index_dump()\r\n    formatter.section_dump_all()\r\n\r\n\r\n# if called from the command line\r\n#\r\nif __name__ == '__main__':\r\n    main( sys.argv )\r\n\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/formatter.py",
    "content": "#  Formatter (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org>\r\n#\r\n\r\nfrom sources import *\r\nfrom content import *\r\nfrom utils   import *\r\n\r\n# This is the base Formatter class.  Its purpose is to convert\r\n# a content processor's data into specific documents (i.e., table of\r\n# contents, global index, and individual API reference indices).\r\n#\r\n# You need to sub-class it to output anything sensible.  For example,\r\n# the file tohtml.py contains the definition of the HtmlFormatter sub-class\r\n# used to output -- you guessed it -- HTML.\r\n#\r\n\r\nclass  Formatter:\r\n\r\n    def  __init__( self, processor ):\r\n        self.processor   = processor\r\n        self.identifiers = {}\r\n        self.chapters    = processor.chapters\r\n        self.sections    = processor.sections.values()\r\n        self.block_index = []\r\n\r\n        # store all blocks in a dictionary\r\n        self.blocks = []\r\n        for section in self.sections:\r\n            for block in section.blocks.values():\r\n                self.add_identifier( block.name, block )\r\n\r\n                # add enumeration values to the index, since this is useful\r\n                for markup in block.markups:\r\n                    if markup.tag == 'values':\r\n                        for field in markup.fields:\r\n                            self.add_identifier( field.name, block )\r\n\r\n        self.block_index = self.identifiers.keys()\r\n        self.block_index.sort( index_sort )\r\n\r\n    def  add_identifier( self, name, block ):\r\n        if self.identifiers.has_key( name ):\r\n            # duplicate name!\r\n            sys.stderr.write(                                           \\\r\n               \"WARNING: duplicate definition for '\" + name + \"' in \" + \\\r\n               block.location() + \", previous definition in \" +         \\\r\n               self.identifiers[name].location() + \"\\n\" )\r\n        else:\r\n            self.identifiers[name] = block\r\n\r\n    #\r\n    #  Formatting the table of contents\r\n    #\r\n    def  toc_enter( self ):\r\n        pass\r\n\r\n    def  toc_chapter_enter( self, chapter ):\r\n        pass\r\n\r\n    def  toc_section_enter( self, section ):\r\n        pass\r\n\r\n    def  toc_section_exit( self, section ):\r\n        pass\r\n\r\n    def  toc_chapter_exit( self, chapter ):\r\n        pass\r\n\r\n    def  toc_index( self, index_filename ):\r\n        pass\r\n\r\n    def  toc_exit( self ):\r\n        pass\r\n\r\n    def  toc_dump( self, toc_filename = None, index_filename = None ):\r\n        output = None\r\n        if toc_filename:\r\n            output = open_output( toc_filename )\r\n\r\n        self.toc_enter()\r\n\r\n        for chap in self.processor.chapters:\r\n\r\n            self.toc_chapter_enter( chap )\r\n\r\n            for section in chap.sections:\r\n                self.toc_section_enter( section )\r\n                self.toc_section_exit( section )\r\n\r\n            self.toc_chapter_exit( chap )\r\n\r\n        self.toc_index( index_filename )\r\n\r\n        self.toc_exit()\r\n\r\n        if output:\r\n            close_output( output )\r\n\r\n    #\r\n    #  Formatting the index\r\n    #\r\n    def  index_enter( self ):\r\n        pass\r\n\r\n    def  index_name_enter( self, name ):\r\n        pass\r\n\r\n    def  index_name_exit( self, name ):\r\n        pass\r\n\r\n    def  index_exit( self ):\r\n        pass\r\n\r\n    def  index_dump( self, index_filename = None ):\r\n        output = None\r\n        if index_filename:\r\n            output = open_output( index_filename )\r\n\r\n        self.index_enter()\r\n\r\n        for name in self.block_index:\r\n            self.index_name_enter( name )\r\n            self.index_name_exit( name )\r\n\r\n        self.index_exit()\r\n\r\n        if output:\r\n            close_output( output )\r\n\r\n    #\r\n    #  Formatting a section\r\n    #\r\n    def  section_enter( self, section ):\r\n        pass\r\n\r\n    def  block_enter( self, block ):\r\n        pass\r\n\r\n    def  markup_enter( self, markup, block = None ):\r\n        pass\r\n\r\n    def  field_enter( self, field, markup = None, block = None ):\r\n        pass\r\n\r\n    def  field_exit( self, field, markup = None, block = None ):\r\n        pass\r\n\r\n    def  markup_exit( self, markup, block = None ):\r\n        pass\r\n\r\n    def  block_exit( self, block ):\r\n        pass\r\n\r\n    def  section_exit( self, section ):\r\n        pass\r\n\r\n    def  section_dump( self, section, section_filename = None ):\r\n        output = None\r\n        if section_filename:\r\n            output = open_output( section_filename )\r\n\r\n        self.section_enter( section )\r\n\r\n        for name in section.block_names:\r\n            block = self.identifiers[name]\r\n            self.block_enter( block )\r\n\r\n            for markup in block.markups[1:]:   # always ignore first markup!\r\n                self.markup_enter( markup, block )\r\n\r\n                for field in markup.fields:\r\n                    self.field_enter( field, markup, block )\r\n                    self.field_exit( field, markup, block )\r\n\r\n                self.markup_exit( markup, block )\r\n\r\n            self.block_exit( block )\r\n\r\n        self.section_exit( section )\r\n\r\n        if output:\r\n            close_output( output )\r\n\r\n    def  section_dump_all( self ):\r\n        for section in self.sections:\r\n            self.section_dump( section )\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/sources.py",
    "content": "#  Sources (c) 2002-2004, 2006-2009, 2012\r\n#    David Turner <david@freetype.org>\r\n#\r\n#\r\n# this file contains definitions of classes needed to decompose\r\n# C sources files into a series of multi-line \"blocks\". There are\r\n# two kinds of blocks:\r\n#\r\n#   - normal blocks, which contain source code or ordinary comments\r\n#\r\n#   - documentation blocks, which have restricted formatting, and\r\n#     whose text always start with a documentation markup tag like\r\n#     \"<Function>\", \"<Type>\", etc..\r\n#\r\n# the routines used to process the content of documentation blocks\r\n# are not contained here, but in \"content.py\"\r\n#\r\n# the classes and methods found here only deal with text parsing\r\n# and basic documentation block extraction\r\n#\r\n\r\nimport fileinput, re, sys, os, string\r\n\r\n\r\n\r\n################################################################\r\n##\r\n##  BLOCK FORMAT PATTERN\r\n##\r\n##   A simple class containing compiled regular expressions used\r\n##   to detect potential documentation format block comments within\r\n##   C source code\r\n##\r\n##   note that the 'column' pattern must contain a group that will\r\n##   be used to \"unbox\" the content of documentation comment blocks\r\n##\r\nclass  SourceBlockFormat:\r\n\r\n    def  __init__( self, id, start, column, end ):\r\n        \"\"\"create a block pattern, used to recognize special documentation blocks\"\"\"\r\n        self.id     = id\r\n        self.start  = re.compile( start, re.VERBOSE )\r\n        self.column = re.compile( column, re.VERBOSE )\r\n        self.end    = re.compile( end, re.VERBOSE )\r\n\r\n\r\n\r\n#\r\n# format 1 documentation comment blocks look like the following:\r\n#\r\n#    /************************************/\r\n#    /*                                  */\r\n#    /*                                  */\r\n#    /*                                  */\r\n#    /************************************/\r\n#\r\n# we define a few regular expressions here to detect them\r\n#\r\n\r\nstart = r'''\r\n  \\s*      # any number of whitespace\r\n  /\\*{2,}/ # followed by '/' and at least two asterisks then '/'\r\n  \\s*$     # probably followed by whitespace\r\n'''\r\n\r\ncolumn = r'''\r\n  \\s*      # any number of whitespace\r\n  /\\*{1}   # followed by '/' and precisely one asterisk\r\n  ([^*].*) # followed by anything (group 1)\r\n  \\*{1}/   # followed by one asterisk and a '/'\r\n  \\s*$     # probably followed by whitespace\r\n'''\r\n\r\nre_source_block_format1 = SourceBlockFormat( 1, start, column, start )\r\n\r\n\r\n#\r\n# format 2 documentation comment blocks look like the following:\r\n#\r\n#    /************************************ (at least 2 asterisks)\r\n#     *\r\n#     *\r\n#     *\r\n#     *\r\n#     **/       (1 or more asterisks at the end)\r\n#\r\n# we define a few regular expressions here to detect them\r\n#\r\nstart = r'''\r\n  \\s*     # any number of whitespace\r\n  /\\*{2,} # followed by '/' and at least two asterisks\r\n  \\s*$    # probably followed by whitespace\r\n'''\r\n\r\ncolumn = r'''\r\n  \\s*        # any number of whitespace\r\n  \\*{1}(?!/) # followed by precisely one asterisk not followed by `/'\r\n  (.*)       # then anything (group1)\r\n'''\r\n\r\nend = r'''\r\n  \\s*  # any number of whitespace\r\n  \\*+/ # followed by at least one asterisk, then '/'\r\n'''\r\n\r\nre_source_block_format2 = SourceBlockFormat( 2, start, column, end )\r\n\r\n\r\n#\r\n# the list of supported documentation block formats, we could add new ones\r\n# relatively easily\r\n#\r\nre_source_block_formats = [re_source_block_format1, re_source_block_format2]\r\n\r\n\r\n#\r\n# the following regular expressions corresponds to markup tags\r\n# within the documentation comment blocks. they're equivalent\r\n# despite their different syntax\r\n#\r\n# notice how each markup tag _must_ begin a new line\r\n#\r\nre_markup_tag1 = re.compile( r'''\\s*<((?:\\w|-)*)>''' )  # <xxxx> format\r\nre_markup_tag2 = re.compile( r'''\\s*@((?:\\w|-)*):''' )  # @xxxx: format\r\n\r\n#\r\n# the list of supported markup tags, we could add new ones relatively\r\n# easily\r\n#\r\nre_markup_tags = [re_markup_tag1, re_markup_tag2]\r\n\r\n#\r\n# used to detect a cross-reference, after markup tags have been stripped\r\n#\r\nre_crossref = re.compile( r'@((?:\\w|-)*)(.*)' )\r\n\r\n#\r\n# used to detect italic and bold styles in paragraph text\r\n#\r\nre_italic = re.compile( r\"_(\\w(\\w|')*)_(.*)\" )     #  _italic_\r\nre_bold   = re.compile( r\"\\*(\\w(\\w|')*)\\*(.*)\" )   #  *bold*\r\n\r\n#\r\n# used to detect the end of commented source lines\r\n#\r\nre_source_sep = re.compile( r'\\s*/\\*\\s*\\*/' )\r\n\r\n#\r\n# used to perform cross-reference within source output\r\n#\r\nre_source_crossref = re.compile( r'(\\W*)(\\w*)' )\r\n\r\n#\r\n# a list of reserved source keywords\r\n#\r\nre_source_keywords = re.compile( '''\\\\b ( typedef   |\r\n                                          struct    |\r\n                                          enum      |\r\n                                          union     |\r\n                                          const     |\r\n                                          char      |\r\n                                          int       |\r\n                                          short     |\r\n                                          long      |\r\n                                          void      |\r\n                                          signed    |\r\n                                          unsigned  |\r\n                                          \\#include |\r\n                                          \\#define  |\r\n                                          \\#undef   |\r\n                                          \\#if      |\r\n                                          \\#ifdef   |\r\n                                          \\#ifndef  |\r\n                                          \\#else    |\r\n                                          \\#endif   ) \\\\b''', re.VERBOSE )\r\n\r\n\r\n################################################################\r\n##\r\n##  SOURCE BLOCK CLASS\r\n##\r\n##   A SourceProcessor is in charge of reading a C source file\r\n##   and decomposing it into a series of different \"SourceBlocks\".\r\n##   each one of these blocks can be made of the following data:\r\n##\r\n##   - A documentation comment block that starts with \"/**\" and\r\n##     whose exact format will be discussed later\r\n##\r\n##   - normal sources lines, including comments\r\n##\r\n##   the important fields in a text block are the following ones:\r\n##\r\n##     self.lines   : a list of text lines for the corresponding block\r\n##\r\n##     self.content : for documentation comment blocks only, this is the\r\n##                    block content that has been \"unboxed\" from its\r\n##                    decoration. This is None for all other blocks\r\n##                    (i.e. sources or ordinary comments with no starting\r\n##                     markup tag)\r\n##\r\nclass  SourceBlock:\r\n\r\n    def  __init__( self, processor, filename, lineno, lines ):\r\n        self.processor = processor\r\n        self.filename  = filename\r\n        self.lineno    = lineno\r\n        self.lines     = lines[:]\r\n        self.format    = processor.format\r\n        self.content   = []\r\n\r\n        if self.format == None:\r\n            return\r\n\r\n        words = []\r\n\r\n        # extract comment lines\r\n        lines = []\r\n\r\n        for line0 in self.lines:\r\n            m = self.format.column.match( line0 )\r\n            if m:\r\n                lines.append( m.group( 1 ) )\r\n\r\n        # now, look for a markup tag\r\n        for l in lines:\r\n            l = string.strip( l )\r\n            if len( l ) > 0:\r\n                for tag in re_markup_tags:\r\n                    if tag.match( l ):\r\n                        self.content = lines\r\n                        return\r\n\r\n    def  location( self ):\r\n        return \"(\" + self.filename + \":\" + repr( self.lineno ) + \")\"\r\n\r\n    # debugging only - not used in normal operations\r\n    def  dump( self ):\r\n        if self.content:\r\n            print \"{{{content start---\"\r\n            for l in self.content:\r\n                print l\r\n            print \"---content end}}}\"\r\n            return\r\n\r\n        fmt = \"\"\r\n        if self.format:\r\n            fmt = repr( self.format.id ) + \" \"\r\n\r\n        for line in self.lines:\r\n            print line\r\n\r\n\r\n\r\n################################################################\r\n##\r\n##  SOURCE PROCESSOR CLASS\r\n##\r\n##   The SourceProcessor is in charge of reading a C source file\r\n##   and decomposing it into a series of different \"SourceBlock\"\r\n##   objects.\r\n##\r\n##   each one of these blocks can be made of the following data:\r\n##\r\n##   - A documentation comment block that starts with \"/**\" and\r\n##     whose exact format will be discussed later\r\n##\r\n##   - normal sources lines, include comments\r\n##\r\n##\r\nclass  SourceProcessor:\r\n\r\n    def  __init__( self ):\r\n        \"\"\"initialize a source processor\"\"\"\r\n        self.blocks   = []\r\n        self.filename = None\r\n        self.format   = None\r\n        self.lines    = []\r\n\r\n    def  reset( self ):\r\n        \"\"\"reset a block processor, clean all its blocks\"\"\"\r\n        self.blocks = []\r\n        self.format = None\r\n\r\n    def  parse_file( self, filename ):\r\n        \"\"\"parse a C source file, and add its blocks to the processor's list\"\"\"\r\n        self.reset()\r\n\r\n        self.filename = filename\r\n\r\n        fileinput.close()\r\n        self.format = None\r\n        self.lineno = 0\r\n        self.lines  = []\r\n\r\n        for line in fileinput.input( filename ):\r\n            # strip trailing newlines, important on Windows machines!\r\n            if line[-1] == '\\012':\r\n                line = line[0:-1]\r\n\r\n            if self.format == None:\r\n                self.process_normal_line( line )\r\n            else:\r\n                if self.format.end.match( line ):\r\n                    # that's a normal block end, add it to 'lines' and\r\n                    # create a new block\r\n                    self.lines.append( line )\r\n                    self.add_block_lines()\r\n                elif self.format.column.match( line ):\r\n                    # that's a normal column line, add it to 'lines'\r\n                    self.lines.append( line )\r\n                else:\r\n                    # humm.. this is an unexpected block end,\r\n                    # create a new block, but don't process the line\r\n                    self.add_block_lines()\r\n\r\n                    # we need to process the line again\r\n                    self.process_normal_line( line )\r\n\r\n        # record the last lines\r\n        self.add_block_lines()\r\n\r\n    def  process_normal_line( self, line ):\r\n        \"\"\"process a normal line and check whether it is the start of a new block\"\"\"\r\n        for f in re_source_block_formats:\r\n            if f.start.match( line ):\r\n                self.add_block_lines()\r\n                self.format = f\r\n                self.lineno = fileinput.filelineno()\r\n\r\n        self.lines.append( line )\r\n\r\n    def  add_block_lines( self ):\r\n        \"\"\"add the current accumulated lines and create a new block\"\"\"\r\n        if self.lines != []:\r\n            block = SourceBlock( self, self.filename, self.lineno, self.lines )\r\n\r\n            self.blocks.append( block )\r\n            self.format = None\r\n            self.lines  = []\r\n\r\n    # debugging only, not used in normal operations\r\n    def  dump( self ):\r\n        \"\"\"print all blocks in a processor\"\"\"\r\n        for b in self.blocks:\r\n            b.dump()\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/tohtml.py",
    "content": "#  ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008\r\n#    David Turner <david@freetype.org>\r\n\r\nfrom sources import *\r\nfrom content import *\r\nfrom formatter import *\r\n\r\nimport time\r\n\r\n\r\n# The following defines the HTML header used by all generated pages.\r\nhtml_header_1 = \"\"\"\\\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n\"http://www.w3.org/TR/html4/loose.dtd\">\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<title>\\\r\n\"\"\"\r\n\r\nhtml_header_2 = \"\"\"\\\r\n API Reference</title>\r\n<style type=\"text/css\">\r\n  body { font-family: Verdana, Geneva, Arial, Helvetica, serif;\r\n         color: #000000;\r\n         background: #FFFFFF; }\r\n\r\n  p { text-align: justify; }\r\n  h1 { text-align: center; }\r\n  li { text-align: justify; }\r\n  td { padding: 0 0.5em 0 0.5em; }\r\n  td.left { padding: 0 0.5em 0 0.5em;\r\n            text-align: left; }\r\n\r\n  a:link { color: #0000EF; }\r\n  a:visited { color: #51188E; }\r\n  a:hover { color: #FF0000; }\r\n\r\n  span.keyword { font-family: monospace;\r\n                 text-align: left;\r\n                 white-space: pre;\r\n                 color: darkblue; }\r\n\r\n  pre.colored { color: blue; }\r\n\r\n  ul.empty { list-style-type: none; }\r\n</style>\r\n</head>\r\n<body>\r\n\"\"\"\r\n\r\nhtml_header_3 = \"\"\"\r\n<table align=center><tr><td><font size=-1>[<a href=\"\\\r\n\"\"\"\r\n\r\nhtml_header_3i = \"\"\"\r\n<table align=center><tr><td width=\"100%\"></td>\r\n<td><font size=-1>[<a href=\"\\\r\n\"\"\"\r\n\r\nhtml_header_4 = \"\"\"\\\r\n\">Index</a>]</font></td>\r\n<td width=\"100%\"></td>\r\n<td><font size=-1>[<a href=\"\\\r\n\"\"\"\r\n\r\nhtml_header_5 = \"\"\"\\\r\n\">TOC</a>]</font></td></tr></table>\r\n<center><h1>\\\r\n\"\"\"\r\n\r\nhtml_header_5t = \"\"\"\\\r\n\">Index</a>]</font></td>\r\n<td width=\"100%\"></td></tr></table>\r\n<center><h1>\\\r\n\"\"\"\r\n\r\nhtml_header_6 = \"\"\"\\\r\n API Reference</h1></center>\r\n\"\"\"\r\n\r\n\r\n# The HTML footer used by all generated pages.\r\nhtml_footer = \"\"\"\\\r\n</body>\r\n</html>\\\r\n\"\"\"\r\n\r\n# The header and footer used for each section.\r\nsection_title_header = \"<center><h1>\"\r\nsection_title_footer = \"</h1></center>\"\r\n\r\n# The header and footer used for code segments.\r\ncode_header = '<pre class=\"colored\">'\r\ncode_footer = '</pre>'\r\n\r\n# Paragraph header and footer.\r\npara_header = \"<p>\"\r\npara_footer = \"</p>\"\r\n\r\n# Block header and footer.\r\nblock_header        = '<table align=center width=\"75%\"><tr><td>'\r\nblock_footer_start  = \"\"\"\\\r\n</td></tr></table>\r\n<hr width=\"75%\">\r\n<table align=center width=\"75%\"><tr><td><font size=-2>[<a href=\"\\\r\n\"\"\"\r\nblock_footer_middle = \"\"\"\\\r\n\">Index</a>]</font></td>\r\n<td width=\"100%\"></td>\r\n<td><font size=-2>[<a href=\"\\\r\n\"\"\"\r\nblock_footer_end    = \"\"\"\\\r\n\">TOC</a>]</font></td></tr></table>\r\n\"\"\"\r\n\r\n# Description header/footer.\r\ndescription_header = '<table align=center width=\"87%\"><tr><td>'\r\ndescription_footer = \"</td></tr></table><br>\"\r\n\r\n# Marker header/inter/footer combination.\r\nmarker_header = '<table align=center width=\"87%\" cellpadding=5><tr bgcolor=\"#EEEEFF\"><td><em><b>'\r\nmarker_inter  = \"</b></em></td></tr><tr><td>\"\r\nmarker_footer = \"</td></tr></table>\"\r\n\r\n# Header location header/footer.\r\nheader_location_header = '<table align=center width=\"87%\"><tr><td>'\r\nheader_location_footer = \"</td></tr></table><br>\"\r\n\r\n# Source code extracts header/footer.\r\nsource_header = '<table align=center width=\"87%\"><tr bgcolor=\"#D6E8FF\"><td><pre>\\n'\r\nsource_footer = \"\\n</pre></table><br>\"\r\n\r\n# Chapter header/inter/footer.\r\nchapter_header = '<br><table align=center width=\"75%\"><tr><td><h2>'\r\nchapter_inter  = '</h2><ul class=\"empty\"><li>'\r\nchapter_footer = '</li></ul></td></tr></table>'\r\n\r\n# Index footer.\r\nindex_footer_start = \"\"\"\\\r\n<hr>\r\n<table><tr><td width=\"100%\"></td>\r\n<td><font size=-2>[<a href=\"\\\r\n\"\"\"\r\nindex_footer_end = \"\"\"\\\r\n\">TOC</a>]</font></td></tr></table>\r\n\"\"\"\r\n\r\n# TOC footer.\r\ntoc_footer_start = \"\"\"\\\r\n<hr>\r\n<table><tr><td><font size=-2>[<a href=\"\\\r\n\"\"\"\r\ntoc_footer_end = \"\"\"\\\r\n\">Index</a>]</font></td>\r\n<td width=\"100%\"></td>\r\n</tr></table>\r\n\"\"\"\r\n\r\n\r\n# source language keyword coloration/styling\r\nkeyword_prefix = '<span class=\"keyword\">'\r\nkeyword_suffix = '</span>'\r\n\r\nsection_synopsis_header = '<h2>Synopsis</h2>'\r\nsection_synopsis_footer = ''\r\n\r\n\r\n# Translate a single line of source to HTML.  This will convert\r\n# a \"<\" into \"&lt.\", \">\" into \"&gt.\", etc.\r\ndef  html_quote( line ):\r\n    result = string.replace( line, \"&\", \"&amp;\" )\r\n    result = string.replace( result, \"<\", \"&lt;\" )\r\n    result = string.replace( result, \">\", \"&gt;\" )\r\n    return result\r\n\r\n\r\n# same as 'html_quote', but ignores left and right brackets\r\ndef  html_quote0( line ):\r\n    return string.replace( line, \"&\", \"&amp;\" )\r\n\r\n\r\ndef  dump_html_code( lines, prefix = \"\" ):\r\n    # clean the last empty lines\r\n    l = len( self.lines )\r\n    while l > 0 and string.strip( self.lines[l - 1] ) == \"\":\r\n        l = l - 1\r\n\r\n    # The code footer should be directly appended to the last code\r\n    # line to avoid an additional blank line.\r\n    print prefix + code_header,\r\n    for line in self.lines[0 : l + 1]:\r\n        print '\\n' + prefix + html_quote( line ),\r\n    print prefix + code_footer,\r\n\r\n\r\n\r\nclass  HtmlFormatter( Formatter ):\r\n\r\n    def  __init__( self, processor, project_title, file_prefix ):\r\n        Formatter.__init__( self, processor )\r\n\r\n        global html_header_1, html_header_2, html_header_3\r\n        global html_header_4, html_header_5, html_footer\r\n\r\n        if file_prefix:\r\n            file_prefix = file_prefix + \"-\"\r\n        else:\r\n            file_prefix = \"\"\r\n\r\n        self.headers           = processor.headers\r\n        self.project_title     = project_title\r\n        self.file_prefix       = file_prefix\r\n        self.html_header       = html_header_1 + project_title +              \\\r\n                                 html_header_2 +                              \\\r\n                                 html_header_3 + file_prefix + \"index.html\" + \\\r\n                                 html_header_4 + file_prefix + \"toc.html\" +   \\\r\n                                 html_header_5 + project_title +              \\\r\n                                 html_header_6\r\n\r\n        self.html_index_header = html_header_1 + project_title +             \\\r\n                                 html_header_2 +                             \\\r\n                                 html_header_3i + file_prefix + \"toc.html\" + \\\r\n                                 html_header_5 + project_title +             \\\r\n                                 html_header_6\r\n\r\n        self.html_toc_header   = html_header_1 + project_title +              \\\r\n                                 html_header_2 +                              \\\r\n                                 html_header_3 + file_prefix + \"index.html\" + \\\r\n                                 html_header_5t + project_title +             \\\r\n                                 html_header_6\r\n\r\n        self.html_footer       = \"<center><font size=\"\"-2\"\">generated on \" +     \\\r\n                                 time.asctime( time.localtime( time.time() ) ) + \\\r\n                                 \"</font></center>\" + html_footer\r\n\r\n        self.columns = 3\r\n\r\n    def  make_section_url( self, section ):\r\n        return self.file_prefix + section.name + \".html\"\r\n\r\n    def  make_block_url( self, block ):\r\n        return self.make_section_url( block.section ) + \"#\" + block.name\r\n\r\n    def  make_html_words( self, words ):\r\n        \"\"\" convert a series of simple words into some HTML text \"\"\"\r\n        line = \"\"\r\n        if words:\r\n            line = html_quote( words[0] )\r\n            for w in words[1:]:\r\n                line = line + \" \" + html_quote( w )\r\n\r\n        return line\r\n\r\n    def  make_html_word( self, word ):\r\n        \"\"\"analyze a simple word to detect cross-references and styling\"\"\"\r\n        # look for cross-references\r\n        m = re_crossref.match( word )\r\n        if m:\r\n            try:\r\n                name = m.group( 1 )\r\n                rest = m.group( 2 )\r\n                block = self.identifiers[name]\r\n                url   = self.make_block_url( block )\r\n                return '<a href=\"' + url + '\">' + name + '</a>' + rest\r\n            except:\r\n                # we detected a cross-reference to an unknown item\r\n                sys.stderr.write( \\\r\n                   \"WARNING: undefined cross reference '\" + name + \"'.\\n\" )\r\n                return '?' + name + '?' + rest\r\n\r\n        # look for italics and bolds\r\n        m = re_italic.match( word )\r\n        if m:\r\n            name = m.group( 1 )\r\n            rest = m.group( 3 )\r\n            return '<i>' + name + '</i>' + rest\r\n\r\n        m = re_bold.match( word )\r\n        if m:\r\n            name = m.group( 1 )\r\n            rest = m.group( 3 )\r\n            return '<b>' + name + '</b>' + rest\r\n\r\n        return html_quote( word )\r\n\r\n    def  make_html_para( self, words ):\r\n        \"\"\" convert words of a paragraph into tagged HTML text, handle xrefs \"\"\"\r\n        line = \"\"\r\n        if words:\r\n            line = self.make_html_word( words[0] )\r\n            for word in words[1:]:\r\n                line = line + \" \" + self.make_html_word( word )\r\n            # convert `...' quotations into real left and right single quotes\r\n            line = re.sub( r\"(^|\\W)`(.*?)'(\\W|$)\",  \\\r\n                           r'\\1&lsquo;\\2&rsquo;\\3', \\\r\n                           line )\r\n            # convert tilde into non-breakable space\r\n            line = string.replace( line, \"~\", \"&nbsp;\" )\r\n\r\n        return para_header + line + para_footer\r\n\r\n    def  make_html_code( self, lines ):\r\n        \"\"\" convert a code sequence to HTML \"\"\"\r\n        line = code_header + '\\n'\r\n        for l in lines:\r\n            line = line + html_quote( l ) + '\\n'\r\n\r\n        return line + code_footer\r\n\r\n    def  make_html_items( self, items ):\r\n        \"\"\" convert a field's content into some valid HTML \"\"\"\r\n        lines = []\r\n        for item in items:\r\n            if item.lines:\r\n                lines.append( self.make_html_code( item.lines ) )\r\n            else:\r\n                lines.append( self.make_html_para( item.words ) )\r\n\r\n        return string.join( lines, '\\n' )\r\n\r\n    def  print_html_items( self, items ):\r\n        print self.make_html_items( items )\r\n\r\n    def  print_html_field( self, field ):\r\n        if field.name:\r\n            print \"<table><tr valign=top><td><b>\" + field.name + \"</b></td><td>\"\r\n\r\n        print self.make_html_items( field.items )\r\n\r\n        if field.name:\r\n            print \"</td></tr></table>\"\r\n\r\n    def  html_source_quote( self, line, block_name = None ):\r\n        result = \"\"\r\n        while line:\r\n            m = re_source_crossref.match( line )\r\n            if m:\r\n                name   = m.group( 2 )\r\n                prefix = html_quote( m.group( 1 ) )\r\n                length = len( m.group( 0 ) )\r\n\r\n                if name == block_name:\r\n                    # this is the current block name, if any\r\n                    result = result + prefix + '<b>' + name + '</b>'\r\n                elif re_source_keywords.match( name ):\r\n                    # this is a C keyword\r\n                    result = result + prefix + keyword_prefix + name + keyword_suffix\r\n                elif self.identifiers.has_key( name ):\r\n                    # this is a known identifier\r\n                    block = self.identifiers[name]\r\n                    result = result + prefix + '<a href=\"' + \\\r\n                             self.make_block_url( block ) + '\">' + name + '</a>'\r\n                else:\r\n                    result = result + html_quote( line[:length] )\r\n\r\n                line = line[length:]\r\n            else:\r\n                result = result + html_quote( line )\r\n                line   = []\r\n\r\n        return result\r\n\r\n    def  print_html_field_list( self, fields ):\r\n        print \"<p></p>\"\r\n        print \"<table cellpadding=3 border=0>\"\r\n        for field in fields:\r\n            if len( field.name ) > 22:\r\n              print \"<tr valign=top><td colspan=0><b>\" + field.name + \"</b></td></tr>\"\r\n              print \"<tr valign=top><td></td><td>\"\r\n            else:\r\n              print \"<tr valign=top><td><b>\" + field.name + \"</b></td><td>\"\r\n\r\n            self.print_html_items( field.items )\r\n            print \"</td></tr>\"\r\n        print \"</table>\"\r\n\r\n    def  print_html_markup( self, markup ):\r\n        table_fields = []\r\n        for field in markup.fields:\r\n            if field.name:\r\n                # we begin a new series of field or value definitions, we\r\n                # will record them in the 'table_fields' list before outputting\r\n                # all of them as a single table\r\n                #\r\n                table_fields.append( field )\r\n            else:\r\n                if table_fields:\r\n                    self.print_html_field_list( table_fields )\r\n                    table_fields = []\r\n\r\n                self.print_html_items( field.items )\r\n\r\n        if table_fields:\r\n            self.print_html_field_list( table_fields )\r\n\r\n    #\r\n    #  Formatting the index\r\n    #\r\n    def  index_enter( self ):\r\n        print self.html_index_header\r\n        self.index_items = {}\r\n\r\n    def  index_name_enter( self, name ):\r\n        block = self.identifiers[name]\r\n        url   = self.make_block_url( block )\r\n        self.index_items[name] = url\r\n\r\n    def  index_exit( self ):\r\n        # block_index already contains the sorted list of index names\r\n        count = len( self.block_index )\r\n        rows  = ( count + self.columns - 1 ) / self.columns\r\n\r\n        print \"<table align=center border=0 cellpadding=0 cellspacing=0>\"\r\n        for r in range( rows ):\r\n            line = \"<tr>\"\r\n            for c in range( self.columns ):\r\n                i = r + c * rows\r\n                if i < count:\r\n                    bname = self.block_index[r + c * rows]\r\n                    url   = self.index_items[bname]\r\n                    line = line + '<td><a href=\"' + url + '\">' + bname + '</a></td>'\r\n                else:\r\n                    line = line + '<td></td>'\r\n            line = line + \"</tr>\"\r\n            print line\r\n\r\n        print \"</table>\"\r\n\r\n        print index_footer_start +            \\\r\n              self.file_prefix + \"toc.html\" + \\\r\n              index_footer_end\r\n\r\n        print self.html_footer\r\n\r\n        self.index_items = {}\r\n\r\n    def  index_dump( self, index_filename = None ):\r\n        if index_filename == None:\r\n            index_filename = self.file_prefix + \"index.html\"\r\n\r\n        Formatter.index_dump( self, index_filename )\r\n\r\n    #\r\n    #  Formatting the table of content\r\n    #\r\n    def  toc_enter( self ):\r\n        print self.html_toc_header\r\n        print \"<center><h1>Table of Contents</h1></center>\"\r\n\r\n    def  toc_chapter_enter( self, chapter ):\r\n        print  chapter_header + string.join( chapter.title ) + chapter_inter\r\n        print \"<table cellpadding=5>\"\r\n\r\n    def  toc_section_enter( self, section ):\r\n        print '<tr valign=top><td class=\"left\">'\r\n        print '<a href=\"' + self.make_section_url( section ) + '\">' + \\\r\n               section.title + '</a></td><td>'\r\n\r\n        print self.make_html_para( section.abstract )\r\n\r\n    def  toc_section_exit( self, section ):\r\n        print \"</td></tr>\"\r\n\r\n    def  toc_chapter_exit( self, chapter ):\r\n        print \"</table>\"\r\n        print chapter_footer\r\n\r\n    def  toc_index( self, index_filename ):\r\n        print chapter_header +                                      \\\r\n              '<a href=\"' + index_filename + '\">Global Index</a>' + \\\r\n              chapter_inter + chapter_footer\r\n\r\n    def  toc_exit( self ):\r\n        print toc_footer_start +                \\\r\n              self.file_prefix + \"index.html\" + \\\r\n              toc_footer_end\r\n\r\n        print self.html_footer\r\n\r\n    def  toc_dump( self, toc_filename = None, index_filename = None ):\r\n        if toc_filename == None:\r\n            toc_filename = self.file_prefix + \"toc.html\"\r\n\r\n        if index_filename == None:\r\n            index_filename = self.file_prefix + \"index.html\"\r\n\r\n        Formatter.toc_dump( self, toc_filename, index_filename )\r\n\r\n    #\r\n    #  Formatting sections\r\n    #\r\n    def  section_enter( self, section ):\r\n        print self.html_header\r\n\r\n        print section_title_header\r\n        print section.title\r\n        print section_title_footer\r\n\r\n        maxwidth = 0\r\n        for b in section.blocks.values():\r\n            if len( b.name ) > maxwidth:\r\n                maxwidth = len( b.name )\r\n\r\n        width = 70  # XXX magic number\r\n        if maxwidth <> 0:\r\n            # print section synopsis\r\n            print section_synopsis_header\r\n            print \"<table align=center cellspacing=5 cellpadding=0 border=0>\"\r\n\r\n            columns = width / maxwidth\r\n            if columns < 1:\r\n                columns = 1\r\n\r\n            count = len( section.block_names )\r\n            rows  = ( count + columns - 1 ) / columns\r\n\r\n            for r in range( rows ):\r\n                line = \"<tr>\"\r\n                for c in range( columns ):\r\n                    i = r + c * rows\r\n                    line = line + '<td></td><td>'\r\n                    if i < count:\r\n                        name = section.block_names[i]\r\n                        line = line + '<a href=\"#' + name + '\">' + name + '</a>'\r\n\r\n                    line = line + '</td>'\r\n                line = line + \"</tr>\"\r\n                print line\r\n\r\n            print \"</table><br><br>\"\r\n            print section_synopsis_footer\r\n\r\n        print description_header\r\n        print self.make_html_items( section.description )\r\n        print description_footer\r\n\r\n    def  block_enter( self, block ):\r\n        print block_header\r\n\r\n        # place html anchor if needed\r\n        if block.name:\r\n            print '<h4><a name=\"' + block.name + '\">' + block.name + '</a></h4>'\r\n\r\n        # dump the block C source lines now\r\n        if block.code:\r\n            header = ''\r\n            for f in self.headers.keys():\r\n                if block.source.filename.find( f ) >= 0:\r\n                    header = self.headers[f] + ' (' + f + ')'\r\n                    break;\r\n                \r\n#           if not header:\r\n#               sys.stderr.write( \\\r\n#                 'WARNING: No header macro for ' + block.source.filename + '.\\n' )\r\n\r\n            if header:\r\n                print header_location_header\r\n                print 'Defined in ' + header + '.'\r\n                print header_location_footer\r\n\r\n            print source_header\r\n            for l in block.code:\r\n                print self.html_source_quote( l, block.name )\r\n            print source_footer\r\n\r\n    def  markup_enter( self, markup, block ):\r\n        if markup.tag == \"description\":\r\n            print description_header\r\n        else:\r\n            print marker_header + markup.tag + marker_inter\r\n\r\n        self.print_html_markup( markup )\r\n\r\n    def  markup_exit( self, markup, block ):\r\n        if markup.tag == \"description\":\r\n            print description_footer\r\n        else:\r\n            print marker_footer\r\n\r\n    def  block_exit( self, block ):\r\n        print block_footer_start + self.file_prefix + \"index.html\" + \\\r\n              block_footer_middle + self.file_prefix + \"toc.html\" +  \\\r\n              block_footer_end\r\n\r\n    def  section_exit( self, section ):\r\n        print html_footer\r\n\r\n    def  section_dump_all( self ):\r\n        for section in self.sections:\r\n            self.section_dump( section, self.file_prefix + section.name + '.html' )\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/docmaker/utils.py",
    "content": "#  Utils (c) 2002, 2004, 2007, 2008  David Turner <david@freetype.org>\r\n#\r\n\r\nimport string, sys, os, glob\r\n\r\n# current output directory\r\n#\r\noutput_dir = None\r\n\r\n\r\n# This function is used to sort the index.  It is a simple lexicographical\r\n# sort, except that it places capital letters before lowercase ones.\r\n#\r\ndef  index_sort( s1, s2 ):\r\n    if not s1:\r\n        return -1\r\n\r\n    if not s2:\r\n        return 1\r\n\r\n    l1 = len( s1 )\r\n    l2 = len( s2 )\r\n    m1 = string.lower( s1 )\r\n    m2 = string.lower( s2 )\r\n\r\n    for i in range( l1 ):\r\n        if i >= l2 or m1[i] > m2[i]:\r\n            return 1\r\n\r\n        if m1[i] < m2[i]:\r\n            return -1\r\n\r\n        if s1[i] < s2[i]:\r\n            return -1\r\n\r\n        if s1[i] > s2[i]:\r\n            return 1\r\n\r\n    if l2 > l1:\r\n        return -1\r\n\r\n    return 0\r\n\r\n\r\n# Sort input_list, placing the elements of order_list in front.\r\n#\r\ndef  sort_order_list( input_list, order_list ):\r\n    new_list = order_list[:]\r\n    for id in input_list:\r\n        if not id in order_list:\r\n            new_list.append( id )\r\n    return new_list\r\n\r\n\r\n# Open the standard output to a given project documentation file.  Use\r\n# \"output_dir\" to determine the filename location if necessary and save the\r\n# old stdout in a tuple that is returned by this function.\r\n#\r\ndef  open_output( filename ):\r\n    global output_dir\r\n\r\n    if output_dir and output_dir != \"\":\r\n        filename = output_dir + os.sep + filename\r\n\r\n    old_stdout = sys.stdout\r\n    new_file   = open( filename, \"w\" )\r\n    sys.stdout = new_file\r\n\r\n    return ( new_file, old_stdout )\r\n\r\n\r\n# Close the output that was returned by \"close_output\".\r\n#\r\ndef  close_output( output ):\r\n    output[0].close()\r\n    sys.stdout = output[1]\r\n\r\n\r\n# Check output directory.\r\n#\r\ndef  check_output():\r\n    global output_dir\r\n    if output_dir:\r\n        if output_dir != \"\":\r\n            if not os.path.isdir( output_dir ):\r\n                sys.stderr.write( \"argument\" + \" '\" + output_dir + \"' \" + \\\r\n                                  \"is not a valid directory\" )\r\n                sys.exit( 2 )\r\n        else:\r\n            output_dir = None\r\n\r\n\r\ndef  file_exists( pathname ):\r\n    \"\"\"checks that a given file exists\"\"\"\r\n    result = 1\r\n    try:\r\n        file = open( pathname, \"r\" )\r\n        file.close()\r\n    except:\r\n        result = None\r\n        sys.stderr.write( pathname + \" couldn't be accessed\\n\" )\r\n\r\n    return result\r\n\r\n\r\ndef  make_file_list( args = None ):\r\n    \"\"\"builds a list of input files from command-line arguments\"\"\"\r\n    file_list = []\r\n    # sys.stderr.write( repr( sys.argv[1 :] ) + '\\n' )\r\n\r\n    if not args:\r\n        args = sys.argv[1 :]\r\n\r\n    for pathname in args:\r\n        if string.find( pathname, '*' ) >= 0:\r\n            newpath = glob.glob( pathname )\r\n            newpath.sort()  # sort files -- this is important because\r\n                            # of the order of files\r\n        else:\r\n            newpath = [pathname]\r\n\r\n        file_list.extend( newpath )\r\n\r\n    if len( file_list ) == 0:\r\n        file_list = None\r\n    else:\r\n        # now filter the file list to remove non-existing ones\r\n        file_list = filter( file_exists, file_list )\r\n\r\n    return file_list\r\n\r\n# eof\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/ftrandom/Makefile",
    "content": "# TOP_DIR and OBJ_DIR should be set by the user to the right directories,\r\n# if necessary.\r\n\r\nTOP_DIR ?= ../../..\r\nOBJ_DIR ?= $(TOP_DIR)/objs\r\n\r\n\r\n# The setup below is for gcc on a Unix-like platform.\r\n\r\nSRC_DIR = $(TOP_DIR)/src/tools/ftrandom\r\n\r\nCC = gcc\r\nWFLAGS = -Wmissing-prototypes \\\r\n         -Wunused \\\r\n         -Wimplicit \\\r\n         -Wreturn-type \\\r\n         -Wparentheses \\\r\n         -pedantic \\\r\n         -Wformat \\\r\n         -Wchar-subscripts \\\r\n         -Wsequence-point\r\nCFLAGS = $(WFLAGS) \\\r\n         -g \\\r\n         -I $(TOP_DIR)/include\r\nLIBS = -lm \\\r\n       -L $(OBJ_DIR) \\\r\n       -lfreetype \\\r\n       -lz\r\n\r\nall: $(OBJ_DIR)/ftrandom\r\n\r\n$(OBJ_DIR)/ftrandom: $(SRC_DIR)/ftrandom.c $(OBJ_DIR)/libfreetype.a\r\n\t$(CC) -o $(OBJ_DIR)/ftrandom $(CFLAGS) $(SRC_DIR)/ftrandom.c $(LIBS)\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/ftrandom/README",
    "content": "ftrandom\r\n--------\r\n\r\nThis program expects a set of directories containing good fonts, and a set\r\nof extensions of fonts to be tested.  It will randomly pick a font, copy it,\r\nintroduce and error and then test it.\r\n\r\nThe FreeType tests are quite basic:\r\n\r\n  For each erroneous font it\r\n    forks off a new tester;\r\n    initializes the library;\r\n    opens each font in the file;\r\n    loads each glyph;\r\n      (optionally reviewing the contours of the glyph)\r\n      (optionally rasterizing)\r\n    closes the face.\r\n\r\nIf the tester exits with a signal, or takes longer than 20 seconds then\r\nftrandom saves the erroneous font and continues.  If the tester exits\r\nnormally or with an error, then the superstructure removes the test font and\r\ncontinues.\r\n\r\nArguments are:\r\n\r\n  --all                    Test every font in the directory(ies) no matter\r\n                           what its extension (some CID-keyed fonts have no\r\n                           extension).\r\n  --check-outlines         Call FT_Outline_Decompose on each glyph.\r\n  --dir <dir>              Append <dir> to the list of directories to search\r\n                           for good fonts.\r\n  --error-count <cnt>      Introduce <cnt> single-byte errors into the\r\n                           erroneous fonts.\r\n  --error-fraction <frac>  Multiply the file size of the font by <frac> and\r\n                           introduce that many errors into the erroneous\r\n                           font file.\r\n  --ext <ext>              Add <ext> to the set of font types tested.  Known\r\n                           extensions are `ttf', `otf', `ttc', `cid', `pfb',\r\n                           `pfa', `bdf', `pcf', `pfr', `fon', `otb', and\r\n                           `cff'.\r\n  --help                   Print out this list of options.\r\n  --nohints                Specify FT_LOAD_NO_HINTING when loading glyphs.\r\n  --rasterize              Call FT_Render_Glyph as well as loading it.\r\n  --result <dir>           This is the directory in which test files are\r\n                           placed.\r\n  --test <file>            Run a single test on a pre-generated testcase. \r\n                           Done in the current process so it can be debugged\r\n                           more easily.\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/ftrandom/ftrandom.c",
    "content": "/* Copyright (C) 2005, 2007, 2008 by George Williams */\r\n/*\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n\r\n * Redistributions of source code must retain the above copyright notice, this\r\n * list of conditions and the following disclaimer.\r\n\r\n * Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n\r\n * The name of the author may not be used to endorse or promote products\r\n * derived from this software without specific prior written permission.\r\n\r\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED\r\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\r\n * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\n/* modified by Werner Lemberg <wl@gnu.org>       */\r\n/* This file is now part of the FreeType library */\r\n\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <strings.h>\r\n#include <sys/types.h>\r\n#include <sys/stat.h>\r\n#include <sys/wait.h>\r\n#include <unistd.h>\r\n#include <dirent.h>\r\n#include <math.h>\r\n#include <signal.h>\r\n#include <time.h>\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_OUTLINE_H\r\n\r\n#define true     1\r\n#define false    0\r\n#define forever  for (;;)\r\n\r\n\r\n  static int    check_outlines = false;\r\n  static int    nohints        = false;\r\n  static int    rasterize      = false;\r\n  static char*  results_dir    = \"results\";\r\n\r\n#define GOOD_FONTS_DIR  \"/home/wl/freetype-testfonts\"\r\n\r\n  static char*  default_dir_list[] =\r\n  {\r\n    GOOD_FONTS_DIR,\r\n    NULL\r\n  };\r\n\r\n  static char*  default_ext_list[] =\r\n  {\r\n    \"ttf\",\r\n    \"otf\",\r\n    \"ttc\",\r\n    \"cid\",\r\n    \"pfb\",\r\n    \"pfa\",\r\n    \"bdf\",\r\n    \"pcf\",\r\n    \"pfr\",\r\n    \"fon\",\r\n    \"otb\",\r\n    \"cff\",\r\n    NULL\r\n  };\r\n\r\n  static int  error_count    = 1;\r\n  static int  error_fraction = 0;\r\n\r\n  static FT_F26Dot6  font_size = 12 * 64;\r\n\r\n  static struct fontlist\r\n  {\r\n    char*         name;\r\n    int           len;\r\n    unsigned int  isbinary: 1;\r\n    unsigned int  isascii: 1;\r\n    unsigned int  ishex: 1;\r\n\r\n  } *fontlist;\r\n\r\n  static int  fcnt;\r\n\r\n\r\n  static int\r\n  FT_MoveTo( const FT_Vector  *to,\r\n             void             *user )\r\n  {\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  FT_LineTo( const FT_Vector  *to,\r\n             void             *user )\r\n  {\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  FT_ConicTo( const FT_Vector  *_cp,\r\n              const FT_Vector  *to,\r\n              void             *user )\r\n  {\r\n    return 0;\r\n  }\r\n\r\n\r\n  static int\r\n  FT_CubicTo( const FT_Vector  *cp1,\r\n              const FT_Vector  *cp2,\r\n              const FT_Vector  *to,\r\n              void             *user )\r\n  {\r\n    return 0;\r\n  }\r\n\r\n\r\n  static FT_Outline_Funcs outlinefuncs =\r\n  {\r\n    FT_MoveTo,\r\n    FT_LineTo,\r\n    FT_ConicTo,\r\n    FT_CubicTo,\r\n    0, 0          /* No shift, no delta */\r\n  };\r\n\r\n\r\n  static void\r\n  TestFace( FT_Face  face )\r\n  {\r\n    int  gid;\r\n    int  load_flags = FT_LOAD_DEFAULT;\r\n\r\n\r\n    if ( check_outlines         &&\r\n         FT_IS_SCALABLE( face ) )\r\n      load_flags = FT_LOAD_NO_BITMAP;\r\n\r\n    if ( nohints )\r\n      load_flags |= FT_LOAD_NO_HINTING;\r\n\r\n    FT_Set_Char_Size( face, 0, font_size, 72, 72 );\r\n\r\n    for ( gid = 0; gid < face->num_glyphs; ++gid )\r\n    {\r\n      if ( check_outlines         &&\r\n           FT_IS_SCALABLE( face ) )\r\n      {\r\n        if ( !FT_Load_Glyph( face, gid, load_flags ) )\r\n          FT_Outline_Decompose( &face->glyph->outline, &outlinefuncs, NULL );\r\n      }\r\n      else\r\n        FT_Load_Glyph( face, gid, load_flags );\r\n\r\n      if ( rasterize )\r\n        FT_Render_Glyph( face->glyph, ft_render_mode_normal );\r\n    }\r\n\r\n    FT_Done_Face( face );\r\n  }\r\n\r\n\r\n  static void\r\n  ExecuteTest( char*  testfont )\r\n  {\r\n    FT_Library  context;\r\n    FT_Face     face;\r\n    int         i, num;\r\n\r\n\r\n    if ( FT_Init_FreeType( &context ) )\r\n    {\r\n      fprintf( stderr, \"Can't initialize FreeType.\\n\" );\r\n      exit( 1 );\r\n    }\r\n\r\n    if ( FT_New_Face( context, testfont, 0, &face ) )\r\n    {\r\n      /* The font is erroneous, so if this fails that's ok. */\r\n      exit( 0 );\r\n    }\r\n\r\n    if ( face->num_faces == 1 )\r\n      TestFace( face );\r\n    else\r\n    {\r\n      num = face->num_faces;\r\n      FT_Done_Face( face );\r\n\r\n      for ( i = 0; i < num; ++i )\r\n      {\r\n        if ( !FT_New_Face( context, testfont, i, &face ) )\r\n          TestFace( face );\r\n      }\r\n    }\r\n\r\n    exit( 0 );\r\n  }\r\n\r\n\r\n  static int\r\n  extmatch( char*   filename,\r\n            char**  extensions )\r\n  {\r\n    int    i;\r\n    char*  pt;\r\n\r\n\r\n    if ( extensions == NULL )\r\n      return true;\r\n\r\n    pt = strrchr( filename, '.' );\r\n    if ( pt == NULL )\r\n      return false;\r\n    if ( pt < strrchr( filename, '/' ) )\r\n      return false;\r\n\r\n    for ( i = 0; extensions[i] != NULL; ++i )\r\n      if ( strcasecmp( pt + 1, extensions[i] ) == 0 ||\r\n           strcasecmp( pt,     extensions[i] ) == 0 )\r\n        return true;\r\n\r\n    return false;\r\n  }\r\n\r\n\r\n  static void\r\n  figurefiletype( struct fontlist*  item )\r\n  {\r\n    FILE*  foo;\r\n\r\n\r\n    item->isbinary = item->isascii = item->ishex = false;\r\n\r\n    foo = fopen( item->name, \"rb\" );\r\n    if ( foo != NULL )\r\n    {\r\n      /* Try to guess the file type from the first few characters... */\r\n      int  ch1 = getc( foo );\r\n      int  ch2 = getc( foo );\r\n      int  ch3 = getc( foo );\r\n      int  ch4 = getc( foo );\r\n\r\n\r\n      fclose( foo );\r\n\r\n      if ( ( ch1 == 0   && ch2 == 1   && ch3 == 0   && ch4 == 0   ) ||\r\n           ( ch1 == 'O' && ch2 == 'T' && ch3 == 'T' && ch4 == 'O' ) ||\r\n           ( ch1 == 't' && ch2 == 'r' && ch3 == 'u' && ch4 == 'e' ) ||\r\n           ( ch1 == 't' && ch2 == 't' && ch3 == 'c' && ch4 == 'f' ) )\r\n      {\r\n        /* ttf, otf, ttc files */\r\n        item->isbinary = true;\r\n      }\r\n      else if ( ch1 == 0x80 && ch2 == '\\01' )\r\n      {\r\n        /* PFB header */\r\n        item->isbinary = true;\r\n      }\r\n      else if ( ch1 == '%' && ch2 == '!' )\r\n      {\r\n        /* Random PostScript */\r\n        if ( strstr( item->name, \".pfa\" ) != NULL ||\r\n             strstr( item->name, \".PFA\" ) != NULL )\r\n          item->ishex = true;\r\n        else\r\n          item->isascii = true;\r\n      }\r\n      else if ( ch1 == 1 && ch2 == 0 && ch3 == 4 )\r\n      {\r\n        /* Bare CFF */\r\n        item->isbinary = true;\r\n      }\r\n      else if ( ch1 == 'S' && ch2 == 'T' && ch3 == 'A' && ch4 == 'R' )\r\n      {\r\n        /* BDF */\r\n        item->ishex = true;\r\n      }\r\n      else if ( ch1 == 'P' && ch2 == 'F' && ch3 == 'R' && ch4 == '0' )\r\n      {\r\n        /* PFR */\r\n        item->isbinary = true;\r\n      }\r\n      else if ( ( ch1 == '\\1' && ch2 == 'f' && ch3 == 'c' && ch4 == 'p' ) ||\r\n                ( ch1 == 'M'  && ch2 == 'Z' )                             )\r\n      {\r\n        /* Windows FON */\r\n        item->isbinary = true;\r\n      }\r\n      else\r\n      {\r\n        fprintf( stderr,\r\n                 \"Can't recognize file type of `%s', assuming binary\\n\",\r\n                 item->name );\r\n        item->isbinary = true;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      fprintf( stderr, \"Can't open `%s' for typing the file.\\n\",\r\n               item->name );\r\n      item->isbinary = true;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  FindFonts( char**  fontdirs,\r\n             char**  extensions )\r\n  {\r\n    DIR*            examples;\r\n    struct dirent*  ent;\r\n\r\n    int             i, max;\r\n    char            buffer[1025];\r\n    struct stat     statb;\r\n\r\n\r\n    max  = 0;\r\n    fcnt = 0;\r\n\r\n    for ( i = 0; fontdirs[i] != NULL; ++i )\r\n    {\r\n      examples = opendir( fontdirs[i] );\r\n      if ( examples == NULL )\r\n      {\r\n        fprintf( stderr,\r\n                 \"Can't open example font directory `%s'\\n\",\r\n                 fontdirs[i] );\r\n        exit( 1 );\r\n      }\r\n\r\n      while ( ( ent = readdir( examples ) ) != NULL )\r\n      {\r\n        snprintf( buffer, sizeof ( buffer ),\r\n                  \"%s/%s\", fontdirs[i], ent->d_name );\r\n        if ( stat( buffer, &statb ) == -1 || S_ISDIR( statb.st_mode ) )\r\n          continue;\r\n        if ( extensions == NULL || extmatch( buffer, extensions ) )\r\n        {\r\n          if ( fcnt >= max )\r\n          {\r\n            max += 100;\r\n            fontlist = realloc( fontlist, max * sizeof ( struct fontlist ) );\r\n            if ( fontlist == NULL )\r\n            {\r\n              fprintf( stderr, \"Can't allocate memory\\n\" );\r\n              exit( 1 );\r\n            }\r\n          }\r\n\r\n          fontlist[fcnt].name = strdup( buffer );\r\n          fontlist[fcnt].len  = statb.st_size;\r\n\r\n          figurefiletype( &fontlist[fcnt] );\r\n          ++fcnt;\r\n        }\r\n      }\r\n\r\n      closedir( examples );\r\n    }\r\n\r\n    if ( fcnt == 0 )\r\n    {\r\n      fprintf( stderr, \"Can't find matching font files.\\n\" );\r\n      exit( 1 );\r\n    }\r\n\r\n    fontlist[fcnt].name = NULL;\r\n  }\r\n\r\n\r\n  static int\r\n  getErrorCnt( struct fontlist*  item )\r\n  {\r\n    if ( error_count == 0 && error_fraction == 0 )\r\n      return 0;\r\n\r\n    return error_count + ceil( error_fraction * item->len );\r\n  }\r\n\r\n\r\n  static int\r\n  getRandom( int  low,\r\n             int  high )\r\n  {\r\n    if ( low - high < 0x10000L )\r\n      return low + ( ( random() >> 8 ) % ( high + 1 - low ) );\r\n\r\n    return low + ( random() % ( high + 1 - low ) );\r\n  }\r\n\r\n\r\n  static int\r\n  copyfont( struct fontlist*  item,\r\n            char*             newfont )\r\n  {\r\n    static char  buffer[8096];\r\n    FILE         *good, *new;\r\n    int          len;\r\n    int          i, err_cnt;\r\n\r\n\r\n    good = fopen( item->name, \"r\" );\r\n    if ( good == NULL )\r\n    {\r\n      fprintf( stderr, \"Can't open `%s'\\n\", item->name );\r\n      return false;\r\n    }\r\n\r\n    new = fopen( newfont, \"w+\" );\r\n    if ( new == NULL )\r\n    {\r\n      fprintf( stderr, \"Can't create temporary output file `%s'\\n\",\r\n               newfont );\r\n      exit( 1 );\r\n    }\r\n\r\n    while ( ( len = fread( buffer, 1, sizeof ( buffer ), good ) ) > 0 )\r\n      fwrite( buffer, 1, len, new );\r\n\r\n    fclose( good );\r\n\r\n    err_cnt = getErrorCnt( item );\r\n    for ( i = 0; i < err_cnt; ++i )\r\n    {\r\n      fseek( new, getRandom( 0, item->len - 1 ), SEEK_SET );\r\n\r\n      if ( item->isbinary )\r\n        putc( getRandom( 0, 0xff ), new );\r\n      else if ( item->isascii )\r\n        putc( getRandom( 0x20, 0x7e ), new );\r\n      else\r\n      {\r\n        int  hex = getRandom( 0, 15 );\r\n\r\n\r\n        if ( hex < 10 )\r\n          hex += '0';\r\n        else\r\n          hex += 'A' - 10;\r\n\r\n        putc( hex, new );\r\n      }\r\n    }\r\n\r\n    if ( ferror( new ) )\r\n    {\r\n      fclose( new );\r\n      unlink( newfont );\r\n      return false;\r\n    }\r\n\r\n    fclose( new );\r\n\r\n    return true;\r\n  }\r\n\r\n\r\n  static int  child_pid;\r\n\r\n  static void\r\n  abort_test( int  sig )\r\n  {\r\n    /* If a time-out happens, then kill the child */\r\n    kill( child_pid, SIGFPE );\r\n    write( 2, \"Timeout... \", 11 );\r\n  }\r\n\r\n\r\n  static void\r\n  do_test( void )\r\n  {\r\n    int         i        = getRandom( 0, fcnt - 1 );\r\n    static int  test_num = 0;\r\n    char        buffer[1024];\r\n\r\n\r\n    sprintf( buffer, \"%s/test%d\", results_dir, test_num++ );\r\n\r\n    if ( copyfont ( &fontlist[i], buffer ) )\r\n    {\r\n      signal( SIGALRM, abort_test );\r\n      /* Anything that takes more than 20 seconds */\r\n      /* to parse and/or rasterize is an error.   */\r\n      alarm( 20 );\r\n      if ( ( child_pid = fork() ) == 0 )\r\n        ExecuteTest( buffer );\r\n      else if ( child_pid != -1 )\r\n      {\r\n        int  status;\r\n\r\n\r\n        waitpid( child_pid, &status, 0 );\r\n        alarm( 0 );\r\n        if ( WIFSIGNALED ( status ) )\r\n          printf( \"Error found in file `%s'\\n\", buffer );\r\n        else\r\n          unlink( buffer );\r\n      }\r\n      else\r\n      {\r\n        fprintf( stderr, \"Can't fork test case.\\n\" );\r\n        exit( 1 );\r\n      }\r\n      alarm( 0 );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  usage( FILE*  out,\r\n         char*  name )\r\n  {\r\n    fprintf( out, \"%s [options] -- Generate random erroneous fonts\\n\"\r\n                  \"  and attempt to parse them with FreeType.\\n\\n\", name );\r\n\r\n    fprintf( out, \"  --all                    All non-directory files are assumed to be fonts.\\n\" );\r\n    fprintf( out, \"  --check-outlines         Make sure we can parse the outlines of each glyph.\\n\" );\r\n    fprintf( out, \"  --dir <path>             Append <path> to list of font search directories.\\n\" );\r\n    fprintf( out, \"  --error-count <cnt>      Introduce <cnt> single byte errors into each font.\\n\" );\r\n    fprintf( out, \"  --error-fraction <frac>  Introduce <frac>*filesize single byte errors\\n\"\r\n                  \"                           into each font.\\n\" );\r\n    fprintf( out, \"  --ext <ext>              Add <ext> to list of extensions indicating fonts.\\n\" );\r\n    fprintf( out, \"  --help                   Print this.\\n\" );\r\n    fprintf( out, \"  --nohints                Turn off hinting.\\n\" );\r\n    fprintf( out, \"  --rasterize              Attempt to rasterize each glyph.\\n\" );\r\n    fprintf( out, \"  --results <dir>          Directory in which to place the test fonts.\\n\" );\r\n    fprintf( out, \"  --size <float>           Use the given font size for the tests.\\n\" );\r\n    fprintf( out, \"  --test <file>            Run a single test on an already existing file.\\n\" );\r\n  }\r\n\r\n\r\n  int\r\n  main( int     argc,\r\n        char**  argv )\r\n  {\r\n    char    **dirs, **exts;\r\n    char    *pt, *end;\r\n    int     dcnt = 0, ecnt = 0, rset = false, allexts = false;\r\n    int     i;\r\n    time_t  now;\r\n    char*   testfile = NULL;\r\n\r\n\r\n    dirs = calloc( argc + 1, sizeof ( char ** ) );\r\n    exts = calloc( argc + 1, sizeof ( char ** ) );\r\n\r\n    for ( i = 1; i < argc; ++i )\r\n    {\r\n      pt = argv[i];\r\n      if ( pt[0] == '-' && pt[1] == '-' )\r\n        ++pt;\r\n\r\n      if ( strcmp( pt, \"-all\" ) == 0 )\r\n        allexts = true;\r\n      else if ( strcmp( pt, \"-check-outlines\" ) == 0 )\r\n        check_outlines = true;\r\n      else if ( strcmp( pt, \"-dir\" ) == 0 )\r\n        dirs[dcnt++] = argv[++i];\r\n      else if ( strcmp( pt, \"-error-count\" ) == 0 )\r\n      {\r\n        if ( !rset )\r\n          error_fraction = 0;\r\n        rset = true;\r\n        error_count = strtol( argv[++i], &end, 10 );\r\n        if ( *end != '\\0' )\r\n        {\r\n          fprintf( stderr, \"Bad value for error-count: %s\\n\", argv[i] );\r\n          exit( 1 );\r\n        }\r\n      }\r\n      else if ( strcmp( pt, \"-error-fraction\" ) == 0 )\r\n      {\r\n        if ( !rset )\r\n          error_count = 0;\r\n        rset = true;\r\n        error_fraction = strtod( argv[++i], &end );\r\n        if ( *end != '\\0' )\r\n        {\r\n          fprintf( stderr, \"Bad value for error-fraction: %s\\n\", argv[i] );\r\n          exit( 1 );\r\n        }\r\n      }\r\n      else if ( strcmp( pt, \"-ext\" ) == 0 )\r\n        exts[ecnt++] = argv[++i];\r\n      else if ( strcmp( pt, \"-help\" ) == 0 )\r\n      {\r\n        usage( stdout, argv[0] );\r\n        exit( 0 );\r\n      }\r\n      else if ( strcmp( pt, \"-nohints\" ) == 0 )\r\n        nohints = true;\r\n      else if ( strcmp( pt, \"-rasterize\" ) == 0 )\r\n        rasterize = true;\r\n      else if ( strcmp( pt, \"-results\" ) == 0 )\r\n        results_dir = argv[++i];\r\n      else if ( strcmp( pt, \"-size\" ) == 0 )\r\n      {\r\n        font_size = (FT_F26Dot6)( strtod( argv[++i], &end ) * 64 );\r\n        if ( *end != '\\0' || font_size < 64 )\r\n        {\r\n          fprintf( stderr, \"Bad value for size: %s\\n\", argv[i] );\r\n          exit( 1 );\r\n        }\r\n      }\r\n      else if ( strcmp( pt, \"-test\" ) == 0 )\r\n        testfile = argv[++i];\r\n      else\r\n      {\r\n        usage( stderr, argv[0] );\r\n        exit( 1 );\r\n      }\r\n    }\r\n\r\n    if ( allexts )\r\n      exts = NULL;\r\n    else if ( ecnt == 0 )\r\n      exts = default_ext_list;\r\n\r\n    if ( dcnt == 0 )\r\n      dirs = default_dir_list;\r\n\r\n    if ( testfile != NULL )\r\n      ExecuteTest( testfile );         /* This should never return */\r\n\r\n    time( &now );\r\n    srandom( now );\r\n\r\n    FindFonts( dirs, exts );\r\n    mkdir( results_dir, 0755 );\r\n\r\n    forever\r\n      do_test();\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n/* EOF */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/glnames.py",
    "content": "#!/usr/bin/env python\r\n#\r\n\r\n#\r\n# FreeType 2 glyph name builder\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2003, 2005, 2007, 2008, 2011 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n\"\"\"\\\r\n\r\nusage: %s <output-file>\r\n\r\n  This python script generates the glyph names tables defined in the\r\n  `psnames' module.\r\n\r\n  Its single argument is the name of the header file to be created.\r\n\"\"\"\r\n\r\n\r\nimport sys, string, struct, re, os.path\r\n\r\n\r\n# This table lists the glyphs according to the Macintosh specification.\r\n# It is used by the TrueType Postscript names table.\r\n#\r\n# See\r\n#\r\n#   http://fonts.apple.com/TTRefMan/RM06/Chap6post.html\r\n#\r\n# for the official list.\r\n#\r\nmac_standard_names = \\\r\n[\r\n  # 0\r\n  \".notdef\", \".null\", \"nonmarkingreturn\", \"space\", \"exclam\",\r\n  \"quotedbl\", \"numbersign\", \"dollar\", \"percent\", \"ampersand\",\r\n\r\n  # 10\r\n  \"quotesingle\", \"parenleft\", \"parenright\", \"asterisk\", \"plus\",\r\n  \"comma\", \"hyphen\", \"period\", \"slash\", \"zero\",\r\n\r\n  # 20\r\n  \"one\", \"two\", \"three\", \"four\", \"five\",\r\n  \"six\", \"seven\", \"eight\", \"nine\", \"colon\",\r\n\r\n  # 30\r\n  \"semicolon\", \"less\", \"equal\", \"greater\", \"question\",\r\n  \"at\", \"A\", \"B\", \"C\", \"D\",\r\n\r\n  # 40\r\n  \"E\", \"F\", \"G\", \"H\", \"I\",\r\n  \"J\", \"K\", \"L\", \"M\", \"N\",\r\n\r\n  # 50\r\n  \"O\", \"P\", \"Q\", \"R\", \"S\",\r\n  \"T\", \"U\", \"V\", \"W\", \"X\",\r\n\r\n  # 60\r\n  \"Y\", \"Z\", \"bracketleft\", \"backslash\", \"bracketright\",\r\n  \"asciicircum\", \"underscore\", \"grave\", \"a\", \"b\",\r\n\r\n  # 70\r\n  \"c\", \"d\", \"e\", \"f\", \"g\",\r\n  \"h\", \"i\", \"j\", \"k\", \"l\",\r\n\r\n  # 80\r\n  \"m\", \"n\", \"o\", \"p\", \"q\",\r\n  \"r\", \"s\", \"t\", \"u\", \"v\",\r\n\r\n  # 90\r\n  \"w\", \"x\", \"y\", \"z\", \"braceleft\",\r\n  \"bar\", \"braceright\", \"asciitilde\", \"Adieresis\", \"Aring\",\r\n\r\n  # 100\r\n  \"Ccedilla\", \"Eacute\", \"Ntilde\", \"Odieresis\", \"Udieresis\",\r\n  \"aacute\", \"agrave\", \"acircumflex\", \"adieresis\", \"atilde\",\r\n\r\n  # 110\r\n  \"aring\", \"ccedilla\", \"eacute\", \"egrave\", \"ecircumflex\",\r\n  \"edieresis\", \"iacute\", \"igrave\", \"icircumflex\", \"idieresis\",\r\n\r\n  # 120\r\n  \"ntilde\", \"oacute\", \"ograve\", \"ocircumflex\", \"odieresis\",\r\n  \"otilde\", \"uacute\", \"ugrave\", \"ucircumflex\", \"udieresis\",\r\n\r\n  # 130\r\n  \"dagger\", \"degree\", \"cent\", \"sterling\", \"section\",\r\n  \"bullet\", \"paragraph\", \"germandbls\", \"registered\", \"copyright\",\r\n\r\n  # 140\r\n  \"trademark\", \"acute\", \"dieresis\", \"notequal\", \"AE\",\r\n  \"Oslash\", \"infinity\", \"plusminus\", \"lessequal\", \"greaterequal\",\r\n\r\n  # 150\r\n  \"yen\", \"mu\", \"partialdiff\", \"summation\", \"product\",\r\n  \"pi\", \"integral\", \"ordfeminine\", \"ordmasculine\", \"Omega\",\r\n\r\n  # 160\r\n  \"ae\", \"oslash\", \"questiondown\", \"exclamdown\", \"logicalnot\",\r\n  \"radical\", \"florin\", \"approxequal\", \"Delta\", \"guillemotleft\",\r\n\r\n  # 170\r\n  \"guillemotright\", \"ellipsis\", \"nonbreakingspace\", \"Agrave\", \"Atilde\",\r\n  \"Otilde\", \"OE\", \"oe\", \"endash\", \"emdash\",\r\n\r\n  # 180\r\n  \"quotedblleft\", \"quotedblright\", \"quoteleft\", \"quoteright\", \"divide\",\r\n  \"lozenge\", \"ydieresis\", \"Ydieresis\", \"fraction\", \"currency\",\r\n\r\n  # 190\r\n  \"guilsinglleft\", \"guilsinglright\", \"fi\", \"fl\", \"daggerdbl\",\r\n  \"periodcentered\", \"quotesinglbase\", \"quotedblbase\", \"perthousand\",\r\n    \"Acircumflex\",\r\n\r\n  # 200\r\n  \"Ecircumflex\", \"Aacute\", \"Edieresis\", \"Egrave\", \"Iacute\",\r\n  \"Icircumflex\", \"Idieresis\", \"Igrave\", \"Oacute\", \"Ocircumflex\",\r\n\r\n  # 210\r\n  \"apple\", \"Ograve\", \"Uacute\", \"Ucircumflex\", \"Ugrave\",\r\n  \"dotlessi\", \"circumflex\", \"tilde\", \"macron\", \"breve\",\r\n\r\n  # 220\r\n  \"dotaccent\", \"ring\", \"cedilla\", \"hungarumlaut\", \"ogonek\",\r\n  \"caron\", \"Lslash\", \"lslash\", \"Scaron\", \"scaron\",\r\n\r\n  # 230\r\n  \"Zcaron\", \"zcaron\", \"brokenbar\", \"Eth\", \"eth\",\r\n  \"Yacute\", \"yacute\", \"Thorn\", \"thorn\", \"minus\",\r\n\r\n  # 240\r\n  \"multiply\", \"onesuperior\", \"twosuperior\", \"threesuperior\", \"onehalf\",\r\n  \"onequarter\", \"threequarters\", \"franc\", \"Gbreve\", \"gbreve\",\r\n\r\n  # 250\r\n  \"Idotaccent\", \"Scedilla\", \"scedilla\", \"Cacute\", \"cacute\",\r\n  \"Ccaron\", \"ccaron\", \"dcroat\"\r\n]\r\n\r\n\r\n# The list of standard `SID' glyph names.  For the official list,\r\n# see Annex A of document at\r\n#\r\n#   http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf  .\r\n#\r\nsid_standard_names = \\\r\n[\r\n  # 0\r\n  \".notdef\", \"space\", \"exclam\", \"quotedbl\", \"numbersign\",\r\n  \"dollar\", \"percent\", \"ampersand\", \"quoteright\", \"parenleft\",\r\n\r\n  # 10\r\n  \"parenright\", \"asterisk\", \"plus\", \"comma\", \"hyphen\",\r\n  \"period\", \"slash\", \"zero\", \"one\", \"two\",\r\n\r\n  # 20\r\n  \"three\", \"four\", \"five\", \"six\", \"seven\",\r\n  \"eight\", \"nine\", \"colon\", \"semicolon\", \"less\",\r\n\r\n  # 30\r\n  \"equal\", \"greater\", \"question\", \"at\", \"A\",\r\n  \"B\", \"C\", \"D\", \"E\", \"F\",\r\n\r\n  # 40\r\n  \"G\", \"H\", \"I\", \"J\", \"K\",\r\n  \"L\", \"M\", \"N\", \"O\", \"P\",\r\n\r\n  # 50\r\n  \"Q\", \"R\", \"S\", \"T\", \"U\",\r\n  \"V\", \"W\", \"X\", \"Y\", \"Z\",\r\n\r\n  # 60\r\n  \"bracketleft\", \"backslash\", \"bracketright\", \"asciicircum\", \"underscore\",\r\n  \"quoteleft\", \"a\", \"b\", \"c\", \"d\",\r\n\r\n  # 70\r\n  \"e\", \"f\", \"g\", \"h\", \"i\",\r\n  \"j\", \"k\", \"l\", \"m\", \"n\",\r\n\r\n  # 80\r\n  \"o\", \"p\", \"q\", \"r\", \"s\",\r\n  \"t\", \"u\", \"v\", \"w\", \"x\",\r\n\r\n  # 90\r\n  \"y\", \"z\", \"braceleft\", \"bar\", \"braceright\",\r\n  \"asciitilde\", \"exclamdown\", \"cent\", \"sterling\", \"fraction\",\r\n\r\n  # 100\r\n  \"yen\", \"florin\", \"section\", \"currency\", \"quotesingle\",\r\n  \"quotedblleft\", \"guillemotleft\", \"guilsinglleft\", \"guilsinglright\", \"fi\",\r\n\r\n  # 110\r\n  \"fl\", \"endash\", \"dagger\", \"daggerdbl\", \"periodcentered\",\r\n  \"paragraph\", \"bullet\", \"quotesinglbase\", \"quotedblbase\", \"quotedblright\",\r\n\r\n  # 120\r\n  \"guillemotright\", \"ellipsis\", \"perthousand\", \"questiondown\", \"grave\",\r\n  \"acute\", \"circumflex\", \"tilde\", \"macron\", \"breve\",\r\n\r\n  # 130\r\n  \"dotaccent\", \"dieresis\", \"ring\", \"cedilla\", \"hungarumlaut\",\r\n  \"ogonek\", \"caron\", \"emdash\", \"AE\", \"ordfeminine\",\r\n\r\n  # 140\r\n  \"Lslash\", \"Oslash\", \"OE\", \"ordmasculine\", \"ae\",\r\n  \"dotlessi\", \"lslash\", \"oslash\", \"oe\", \"germandbls\",\r\n\r\n  # 150\r\n  \"onesuperior\", \"logicalnot\", \"mu\", \"trademark\", \"Eth\",\r\n  \"onehalf\", \"plusminus\", \"Thorn\", \"onequarter\", \"divide\",\r\n\r\n  # 160\r\n  \"brokenbar\", \"degree\", \"thorn\", \"threequarters\", \"twosuperior\",\r\n  \"registered\", \"minus\", \"eth\", \"multiply\", \"threesuperior\",\r\n\r\n  # 170\r\n  \"copyright\", \"Aacute\", \"Acircumflex\", \"Adieresis\", \"Agrave\",\r\n  \"Aring\", \"Atilde\", \"Ccedilla\", \"Eacute\", \"Ecircumflex\",\r\n\r\n  # 180\r\n  \"Edieresis\", \"Egrave\", \"Iacute\", \"Icircumflex\", \"Idieresis\",\r\n  \"Igrave\", \"Ntilde\", \"Oacute\", \"Ocircumflex\", \"Odieresis\",\r\n\r\n  # 190\r\n  \"Ograve\", \"Otilde\", \"Scaron\", \"Uacute\", \"Ucircumflex\",\r\n  \"Udieresis\", \"Ugrave\", \"Yacute\", \"Ydieresis\", \"Zcaron\",\r\n\r\n  # 200\r\n  \"aacute\", \"acircumflex\", \"adieresis\", \"agrave\", \"aring\",\r\n  \"atilde\", \"ccedilla\", \"eacute\", \"ecircumflex\", \"edieresis\",\r\n\r\n  # 210\r\n  \"egrave\", \"iacute\", \"icircumflex\", \"idieresis\", \"igrave\",\r\n  \"ntilde\", \"oacute\", \"ocircumflex\", \"odieresis\", \"ograve\",\r\n\r\n  # 220\r\n  \"otilde\", \"scaron\", \"uacute\", \"ucircumflex\", \"udieresis\",\r\n  \"ugrave\", \"yacute\", \"ydieresis\", \"zcaron\", \"exclamsmall\",\r\n\r\n  # 230\r\n  \"Hungarumlautsmall\", \"dollaroldstyle\", \"dollarsuperior\", \"ampersandsmall\",\r\n    \"Acutesmall\",\r\n  \"parenleftsuperior\", \"parenrightsuperior\", \"twodotenleader\",\r\n    \"onedotenleader\", \"zerooldstyle\",\r\n\r\n  # 240\r\n  \"oneoldstyle\", \"twooldstyle\", \"threeoldstyle\", \"fouroldstyle\",\r\n    \"fiveoldstyle\",\r\n  \"sixoldstyle\", \"sevenoldstyle\", \"eightoldstyle\", \"nineoldstyle\",\r\n    \"commasuperior\",\r\n\r\n  # 250\r\n  \"threequartersemdash\", \"periodsuperior\", \"questionsmall\", \"asuperior\",\r\n    \"bsuperior\",\r\n  \"centsuperior\", \"dsuperior\", \"esuperior\", \"isuperior\", \"lsuperior\",\r\n\r\n  # 260\r\n  \"msuperior\", \"nsuperior\", \"osuperior\", \"rsuperior\", \"ssuperior\",\r\n  \"tsuperior\", \"ff\", \"ffi\", \"ffl\", \"parenleftinferior\",\r\n\r\n  # 270\r\n  \"parenrightinferior\", \"Circumflexsmall\", \"hyphensuperior\", \"Gravesmall\",\r\n    \"Asmall\",\r\n  \"Bsmall\", \"Csmall\", \"Dsmall\", \"Esmall\", \"Fsmall\",\r\n\r\n  # 280\r\n  \"Gsmall\", \"Hsmall\", \"Ismall\", \"Jsmall\", \"Ksmall\",\r\n  \"Lsmall\", \"Msmall\", \"Nsmall\", \"Osmall\", \"Psmall\",\r\n\r\n  # 290\r\n  \"Qsmall\", \"Rsmall\", \"Ssmall\", \"Tsmall\", \"Usmall\",\r\n  \"Vsmall\", \"Wsmall\", \"Xsmall\", \"Ysmall\", \"Zsmall\",\r\n\r\n  # 300\r\n  \"colonmonetary\", \"onefitted\", \"rupiah\", \"Tildesmall\", \"exclamdownsmall\",\r\n  \"centoldstyle\", \"Lslashsmall\", \"Scaronsmall\", \"Zcaronsmall\",\r\n    \"Dieresissmall\",\r\n\r\n  # 310\r\n  \"Brevesmall\", \"Caronsmall\", \"Dotaccentsmall\", \"Macronsmall\", \"figuredash\",\r\n  \"hypheninferior\", \"Ogoneksmall\", \"Ringsmall\", \"Cedillasmall\",\r\n    \"questiondownsmall\",\r\n\r\n  # 320\r\n  \"oneeighth\", \"threeeighths\", \"fiveeighths\", \"seveneighths\", \"onethird\",\r\n  \"twothirds\", \"zerosuperior\", \"foursuperior\", \"fivesuperior\",\r\n    \"sixsuperior\",\r\n\r\n  # 330\r\n  \"sevensuperior\", \"eightsuperior\", \"ninesuperior\", \"zeroinferior\",\r\n    \"oneinferior\",\r\n  \"twoinferior\", \"threeinferior\", \"fourinferior\", \"fiveinferior\",\r\n    \"sixinferior\",\r\n\r\n  # 340\r\n  \"seveninferior\", \"eightinferior\", \"nineinferior\", \"centinferior\",\r\n    \"dollarinferior\",\r\n  \"periodinferior\", \"commainferior\", \"Agravesmall\", \"Aacutesmall\",\r\n    \"Acircumflexsmall\",\r\n\r\n  # 350\r\n  \"Atildesmall\", \"Adieresissmall\", \"Aringsmall\", \"AEsmall\", \"Ccedillasmall\",\r\n  \"Egravesmall\", \"Eacutesmall\", \"Ecircumflexsmall\", \"Edieresissmall\",\r\n    \"Igravesmall\",\r\n\r\n  # 360\r\n  \"Iacutesmall\", \"Icircumflexsmall\", \"Idieresissmall\", \"Ethsmall\",\r\n    \"Ntildesmall\",\r\n  \"Ogravesmall\", \"Oacutesmall\", \"Ocircumflexsmall\", \"Otildesmall\",\r\n    \"Odieresissmall\",\r\n\r\n  # 370\r\n  \"OEsmall\", \"Oslashsmall\", \"Ugravesmall\", \"Uacutesmall\",\r\n    \"Ucircumflexsmall\",\r\n  \"Udieresissmall\", \"Yacutesmall\", \"Thornsmall\", \"Ydieresissmall\",\r\n    \"001.000\",\r\n\r\n  # 380\r\n  \"001.001\", \"001.002\", \"001.003\", \"Black\", \"Bold\",\r\n  \"Book\", \"Light\", \"Medium\", \"Regular\", \"Roman\",\r\n\r\n  # 390\r\n  \"Semibold\"\r\n]\r\n\r\n\r\n# This table maps character codes of the Adobe Standard Type 1\r\n# encoding to glyph indices in the sid_standard_names table.\r\n#\r\nt1_standard_encoding = \\\r\n[\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   1,   2,   3,   4,   5,   6,   7,   8,\r\n    9,  10,  11,  12,  13,  14,  15,  16,  17,  18,\r\n\r\n   19,  20,  21,  22,  23,  24,  25,  26,  27,  28,\r\n   29,  30,  31,  32,  33,  34,  35,  36,  37,  38,\r\n   39,  40,  41,  42,  43,  44,  45,  46,  47,  48,\r\n   49,  50,  51,  52,  53,  54,  55,  56,  57,  58,\r\n   59,  60,  61,  62,  63,  64,  65,  66,  67,  68,\r\n\r\n   69,  70,  71,  72,  73,  74,  75,  76,  77,  78,\r\n   79,  80,  81,  82,  83,  84,  85,  86,  87,  88,\r\n   89,  90,  91,  92,  93,  94,  95,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,  96,  97,  98,  99, 100, 101, 102, 103, 104,\r\n  105, 106, 107, 108, 109, 110,   0, 111, 112, 113,\r\n  114,   0, 115, 116, 117, 118, 119, 120, 121, 122,\r\n    0, 123,   0, 124, 125, 126, 127, 128, 129, 130,\r\n\r\n  131,   0, 132, 133,   0, 134, 135, 136, 137,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0, 138,   0, 139,   0,   0,\r\n    0,   0, 140, 141, 142, 143,   0,   0,   0,   0,\r\n    0, 144,   0,   0,   0, 145,   0,   0, 146, 147,\r\n\r\n  148, 149,   0,   0,   0,   0\r\n]\r\n\r\n\r\n# This table maps character codes of the Adobe Expert Type 1\r\n# encoding to glyph indices in the sid_standard_names table.\r\n#\r\nt1_expert_encoding = \\\r\n[\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   1, 229, 230,   0, 231, 232, 233, 234,\r\n  235, 236, 237, 238,  13,  14,  15,  99, 239, 240,\r\n\r\n  241, 242, 243, 244, 245, 246, 247, 248,  27,  28,\r\n  249, 250, 251, 252,   0, 253, 254, 255, 256, 257,\r\n    0,   0,   0, 258,   0,   0, 259, 260, 261, 262,\r\n    0,   0, 263, 264, 265,   0, 266, 109, 110, 267,\r\n  268, 269,   0, 270, 271, 272, 273, 274, 275, 276,\r\n\r\n  277, 278, 279, 280, 281, 282, 283, 284, 285, 286,\r\n  287, 288, 289, 290, 291, 292, 293, 294, 295, 296,\r\n  297, 298, 299, 300, 301, 302, 303,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n\r\n    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\r\n    0, 304, 305, 306,   0,   0, 307, 308, 309, 310,\r\n  311,   0, 312,   0,   0, 313,   0,   0, 314, 315,\r\n    0,   0, 316, 317, 318,   0,   0,   0, 158, 155,\r\n  163, 319, 320, 321, 322, 323, 324, 325,   0,   0,\r\n\r\n  326, 150, 164, 169, 327, 328, 329, 330, 331, 332,\r\n  333, 334, 335, 336, 337, 338, 339, 340, 341, 342,\r\n  343, 344, 345, 346, 347, 348, 349, 350, 351, 352,\r\n  353, 354, 355, 356, 357, 358, 359, 360, 361, 362,\r\n  363, 364, 365, 366, 367, 368, 369, 370, 371, 372,\r\n\r\n  373, 374, 375, 376, 377, 378\r\n]\r\n\r\n\r\n# This data has been taken literally from the files `glyphlist.txt'\r\n# and `zapfdingbats.txt' version 2.0, Sept 2002.  It is available from\r\n#\r\n#   http://sourceforge.net/adobe/aglfn/\r\n#\r\nadobe_glyph_list = \"\"\"\\\r\nA;0041\r\nAE;00C6\r\nAEacute;01FC\r\nAEmacron;01E2\r\nAEsmall;F7E6\r\nAacute;00C1\r\nAacutesmall;F7E1\r\nAbreve;0102\r\nAbreveacute;1EAE\r\nAbrevecyrillic;04D0\r\nAbrevedotbelow;1EB6\r\nAbrevegrave;1EB0\r\nAbrevehookabove;1EB2\r\nAbrevetilde;1EB4\r\nAcaron;01CD\r\nAcircle;24B6\r\nAcircumflex;00C2\r\nAcircumflexacute;1EA4\r\nAcircumflexdotbelow;1EAC\r\nAcircumflexgrave;1EA6\r\nAcircumflexhookabove;1EA8\r\nAcircumflexsmall;F7E2\r\nAcircumflextilde;1EAA\r\nAcute;F6C9\r\nAcutesmall;F7B4\r\nAcyrillic;0410\r\nAdblgrave;0200\r\nAdieresis;00C4\r\nAdieresiscyrillic;04D2\r\nAdieresismacron;01DE\r\nAdieresissmall;F7E4\r\nAdotbelow;1EA0\r\nAdotmacron;01E0\r\nAgrave;00C0\r\nAgravesmall;F7E0\r\nAhookabove;1EA2\r\nAiecyrillic;04D4\r\nAinvertedbreve;0202\r\nAlpha;0391\r\nAlphatonos;0386\r\nAmacron;0100\r\nAmonospace;FF21\r\nAogonek;0104\r\nAring;00C5\r\nAringacute;01FA\r\nAringbelow;1E00\r\nAringsmall;F7E5\r\nAsmall;F761\r\nAtilde;00C3\r\nAtildesmall;F7E3\r\nAybarmenian;0531\r\nB;0042\r\nBcircle;24B7\r\nBdotaccent;1E02\r\nBdotbelow;1E04\r\nBecyrillic;0411\r\nBenarmenian;0532\r\nBeta;0392\r\nBhook;0181\r\nBlinebelow;1E06\r\nBmonospace;FF22\r\nBrevesmall;F6F4\r\nBsmall;F762\r\nBtopbar;0182\r\nC;0043\r\nCaarmenian;053E\r\nCacute;0106\r\nCaron;F6CA\r\nCaronsmall;F6F5\r\nCcaron;010C\r\nCcedilla;00C7\r\nCcedillaacute;1E08\r\nCcedillasmall;F7E7\r\nCcircle;24B8\r\nCcircumflex;0108\r\nCdot;010A\r\nCdotaccent;010A\r\nCedillasmall;F7B8\r\nChaarmenian;0549\r\nCheabkhasiancyrillic;04BC\r\nChecyrillic;0427\r\nChedescenderabkhasiancyrillic;04BE\r\nChedescendercyrillic;04B6\r\nChedieresiscyrillic;04F4\r\nCheharmenian;0543\r\nChekhakassiancyrillic;04CB\r\nCheverticalstrokecyrillic;04B8\r\nChi;03A7\r\nChook;0187\r\nCircumflexsmall;F6F6\r\nCmonospace;FF23\r\nCoarmenian;0551\r\nCsmall;F763\r\nD;0044\r\nDZ;01F1\r\nDZcaron;01C4\r\nDaarmenian;0534\r\nDafrican;0189\r\nDcaron;010E\r\nDcedilla;1E10\r\nDcircle;24B9\r\nDcircumflexbelow;1E12\r\nDcroat;0110\r\nDdotaccent;1E0A\r\nDdotbelow;1E0C\r\nDecyrillic;0414\r\nDeicoptic;03EE\r\nDelta;2206\r\nDeltagreek;0394\r\nDhook;018A\r\nDieresis;F6CB\r\nDieresisAcute;F6CC\r\nDieresisGrave;F6CD\r\nDieresissmall;F7A8\r\nDigammagreek;03DC\r\nDjecyrillic;0402\r\nDlinebelow;1E0E\r\nDmonospace;FF24\r\nDotaccentsmall;F6F7\r\nDslash;0110\r\nDsmall;F764\r\nDtopbar;018B\r\nDz;01F2\r\nDzcaron;01C5\r\nDzeabkhasiancyrillic;04E0\r\nDzecyrillic;0405\r\nDzhecyrillic;040F\r\nE;0045\r\nEacute;00C9\r\nEacutesmall;F7E9\r\nEbreve;0114\r\nEcaron;011A\r\nEcedillabreve;1E1C\r\nEcharmenian;0535\r\nEcircle;24BA\r\nEcircumflex;00CA\r\nEcircumflexacute;1EBE\r\nEcircumflexbelow;1E18\r\nEcircumflexdotbelow;1EC6\r\nEcircumflexgrave;1EC0\r\nEcircumflexhookabove;1EC2\r\nEcircumflexsmall;F7EA\r\nEcircumflextilde;1EC4\r\nEcyrillic;0404\r\nEdblgrave;0204\r\nEdieresis;00CB\r\nEdieresissmall;F7EB\r\nEdot;0116\r\nEdotaccent;0116\r\nEdotbelow;1EB8\r\nEfcyrillic;0424\r\nEgrave;00C8\r\nEgravesmall;F7E8\r\nEharmenian;0537\r\nEhookabove;1EBA\r\nEightroman;2167\r\nEinvertedbreve;0206\r\nEiotifiedcyrillic;0464\r\nElcyrillic;041B\r\nElevenroman;216A\r\nEmacron;0112\r\nEmacronacute;1E16\r\nEmacrongrave;1E14\r\nEmcyrillic;041C\r\nEmonospace;FF25\r\nEncyrillic;041D\r\nEndescendercyrillic;04A2\r\nEng;014A\r\nEnghecyrillic;04A4\r\nEnhookcyrillic;04C7\r\nEogonek;0118\r\nEopen;0190\r\nEpsilon;0395\r\nEpsilontonos;0388\r\nErcyrillic;0420\r\nEreversed;018E\r\nEreversedcyrillic;042D\r\nEscyrillic;0421\r\nEsdescendercyrillic;04AA\r\nEsh;01A9\r\nEsmall;F765\r\nEta;0397\r\nEtarmenian;0538\r\nEtatonos;0389\r\nEth;00D0\r\nEthsmall;F7F0\r\nEtilde;1EBC\r\nEtildebelow;1E1A\r\nEuro;20AC\r\nEzh;01B7\r\nEzhcaron;01EE\r\nEzhreversed;01B8\r\nF;0046\r\nFcircle;24BB\r\nFdotaccent;1E1E\r\nFeharmenian;0556\r\nFeicoptic;03E4\r\nFhook;0191\r\nFitacyrillic;0472\r\nFiveroman;2164\r\nFmonospace;FF26\r\nFourroman;2163\r\nFsmall;F766\r\nG;0047\r\nGBsquare;3387\r\nGacute;01F4\r\nGamma;0393\r\nGammaafrican;0194\r\nGangiacoptic;03EA\r\nGbreve;011E\r\nGcaron;01E6\r\nGcedilla;0122\r\nGcircle;24BC\r\nGcircumflex;011C\r\nGcommaaccent;0122\r\nGdot;0120\r\nGdotaccent;0120\r\nGecyrillic;0413\r\nGhadarmenian;0542\r\nGhemiddlehookcyrillic;0494\r\nGhestrokecyrillic;0492\r\nGheupturncyrillic;0490\r\nGhook;0193\r\nGimarmenian;0533\r\nGjecyrillic;0403\r\nGmacron;1E20\r\nGmonospace;FF27\r\nGrave;F6CE\r\nGravesmall;F760\r\nGsmall;F767\r\nGsmallhook;029B\r\nGstroke;01E4\r\nH;0048\r\nH18533;25CF\r\nH18543;25AA\r\nH18551;25AB\r\nH22073;25A1\r\nHPsquare;33CB\r\nHaabkhasiancyrillic;04A8\r\nHadescendercyrillic;04B2\r\nHardsigncyrillic;042A\r\nHbar;0126\r\nHbrevebelow;1E2A\r\nHcedilla;1E28\r\nHcircle;24BD\r\nHcircumflex;0124\r\nHdieresis;1E26\r\nHdotaccent;1E22\r\nHdotbelow;1E24\r\nHmonospace;FF28\r\nHoarmenian;0540\r\nHoricoptic;03E8\r\nHsmall;F768\r\nHungarumlaut;F6CF\r\nHungarumlautsmall;F6F8\r\nHzsquare;3390\r\nI;0049\r\nIAcyrillic;042F\r\nIJ;0132\r\nIUcyrillic;042E\r\nIacute;00CD\r\nIacutesmall;F7ED\r\nIbreve;012C\r\nIcaron;01CF\r\nIcircle;24BE\r\nIcircumflex;00CE\r\nIcircumflexsmall;F7EE\r\nIcyrillic;0406\r\nIdblgrave;0208\r\nIdieresis;00CF\r\nIdieresisacute;1E2E\r\nIdieresiscyrillic;04E4\r\nIdieresissmall;F7EF\r\nIdot;0130\r\nIdotaccent;0130\r\nIdotbelow;1ECA\r\nIebrevecyrillic;04D6\r\nIecyrillic;0415\r\nIfraktur;2111\r\nIgrave;00CC\r\nIgravesmall;F7EC\r\nIhookabove;1EC8\r\nIicyrillic;0418\r\nIinvertedbreve;020A\r\nIishortcyrillic;0419\r\nImacron;012A\r\nImacroncyrillic;04E2\r\nImonospace;FF29\r\nIniarmenian;053B\r\nIocyrillic;0401\r\nIogonek;012E\r\nIota;0399\r\nIotaafrican;0196\r\nIotadieresis;03AA\r\nIotatonos;038A\r\nIsmall;F769\r\nIstroke;0197\r\nItilde;0128\r\nItildebelow;1E2C\r\nIzhitsacyrillic;0474\r\nIzhitsadblgravecyrillic;0476\r\nJ;004A\r\nJaarmenian;0541\r\nJcircle;24BF\r\nJcircumflex;0134\r\nJecyrillic;0408\r\nJheharmenian;054B\r\nJmonospace;FF2A\r\nJsmall;F76A\r\nK;004B\r\nKBsquare;3385\r\nKKsquare;33CD\r\nKabashkircyrillic;04A0\r\nKacute;1E30\r\nKacyrillic;041A\r\nKadescendercyrillic;049A\r\nKahookcyrillic;04C3\r\nKappa;039A\r\nKastrokecyrillic;049E\r\nKaverticalstrokecyrillic;049C\r\nKcaron;01E8\r\nKcedilla;0136\r\nKcircle;24C0\r\nKcommaaccent;0136\r\nKdotbelow;1E32\r\nKeharmenian;0554\r\nKenarmenian;053F\r\nKhacyrillic;0425\r\nKheicoptic;03E6\r\nKhook;0198\r\nKjecyrillic;040C\r\nKlinebelow;1E34\r\nKmonospace;FF2B\r\nKoppacyrillic;0480\r\nKoppagreek;03DE\r\nKsicyrillic;046E\r\nKsmall;F76B\r\nL;004C\r\nLJ;01C7\r\nLL;F6BF\r\nLacute;0139\r\nLambda;039B\r\nLcaron;013D\r\nLcedilla;013B\r\nLcircle;24C1\r\nLcircumflexbelow;1E3C\r\nLcommaaccent;013B\r\nLdot;013F\r\nLdotaccent;013F\r\nLdotbelow;1E36\r\nLdotbelowmacron;1E38\r\nLiwnarmenian;053C\r\nLj;01C8\r\nLjecyrillic;0409\r\nLlinebelow;1E3A\r\nLmonospace;FF2C\r\nLslash;0141\r\nLslashsmall;F6F9\r\nLsmall;F76C\r\nM;004D\r\nMBsquare;3386\r\nMacron;F6D0\r\nMacronsmall;F7AF\r\nMacute;1E3E\r\nMcircle;24C2\r\nMdotaccent;1E40\r\nMdotbelow;1E42\r\nMenarmenian;0544\r\nMmonospace;FF2D\r\nMsmall;F76D\r\nMturned;019C\r\nMu;039C\r\nN;004E\r\nNJ;01CA\r\nNacute;0143\r\nNcaron;0147\r\nNcedilla;0145\r\nNcircle;24C3\r\nNcircumflexbelow;1E4A\r\nNcommaaccent;0145\r\nNdotaccent;1E44\r\nNdotbelow;1E46\r\nNhookleft;019D\r\nNineroman;2168\r\nNj;01CB\r\nNjecyrillic;040A\r\nNlinebelow;1E48\r\nNmonospace;FF2E\r\nNowarmenian;0546\r\nNsmall;F76E\r\nNtilde;00D1\r\nNtildesmall;F7F1\r\nNu;039D\r\nO;004F\r\nOE;0152\r\nOEsmall;F6FA\r\nOacute;00D3\r\nOacutesmall;F7F3\r\nObarredcyrillic;04E8\r\nObarreddieresiscyrillic;04EA\r\nObreve;014E\r\nOcaron;01D1\r\nOcenteredtilde;019F\r\nOcircle;24C4\r\nOcircumflex;00D4\r\nOcircumflexacute;1ED0\r\nOcircumflexdotbelow;1ED8\r\nOcircumflexgrave;1ED2\r\nOcircumflexhookabove;1ED4\r\nOcircumflexsmall;F7F4\r\nOcircumflextilde;1ED6\r\nOcyrillic;041E\r\nOdblacute;0150\r\nOdblgrave;020C\r\nOdieresis;00D6\r\nOdieresiscyrillic;04E6\r\nOdieresissmall;F7F6\r\nOdotbelow;1ECC\r\nOgoneksmall;F6FB\r\nOgrave;00D2\r\nOgravesmall;F7F2\r\nOharmenian;0555\r\nOhm;2126\r\nOhookabove;1ECE\r\nOhorn;01A0\r\nOhornacute;1EDA\r\nOhorndotbelow;1EE2\r\nOhorngrave;1EDC\r\nOhornhookabove;1EDE\r\nOhorntilde;1EE0\r\nOhungarumlaut;0150\r\nOi;01A2\r\nOinvertedbreve;020E\r\nOmacron;014C\r\nOmacronacute;1E52\r\nOmacrongrave;1E50\r\nOmega;2126\r\nOmegacyrillic;0460\r\nOmegagreek;03A9\r\nOmegaroundcyrillic;047A\r\nOmegatitlocyrillic;047C\r\nOmegatonos;038F\r\nOmicron;039F\r\nOmicrontonos;038C\r\nOmonospace;FF2F\r\nOneroman;2160\r\nOogonek;01EA\r\nOogonekmacron;01EC\r\nOopen;0186\r\nOslash;00D8\r\nOslashacute;01FE\r\nOslashsmall;F7F8\r\nOsmall;F76F\r\nOstrokeacute;01FE\r\nOtcyrillic;047E\r\nOtilde;00D5\r\nOtildeacute;1E4C\r\nOtildedieresis;1E4E\r\nOtildesmall;F7F5\r\nP;0050\r\nPacute;1E54\r\nPcircle;24C5\r\nPdotaccent;1E56\r\nPecyrillic;041F\r\nPeharmenian;054A\r\nPemiddlehookcyrillic;04A6\r\nPhi;03A6\r\nPhook;01A4\r\nPi;03A0\r\nPiwrarmenian;0553\r\nPmonospace;FF30\r\nPsi;03A8\r\nPsicyrillic;0470\r\nPsmall;F770\r\nQ;0051\r\nQcircle;24C6\r\nQmonospace;FF31\r\nQsmall;F771\r\nR;0052\r\nRaarmenian;054C\r\nRacute;0154\r\nRcaron;0158\r\nRcedilla;0156\r\nRcircle;24C7\r\nRcommaaccent;0156\r\nRdblgrave;0210\r\nRdotaccent;1E58\r\nRdotbelow;1E5A\r\nRdotbelowmacron;1E5C\r\nReharmenian;0550\r\nRfraktur;211C\r\nRho;03A1\r\nRingsmall;F6FC\r\nRinvertedbreve;0212\r\nRlinebelow;1E5E\r\nRmonospace;FF32\r\nRsmall;F772\r\nRsmallinverted;0281\r\nRsmallinvertedsuperior;02B6\r\nS;0053\r\nSF010000;250C\r\nSF020000;2514\r\nSF030000;2510\r\nSF040000;2518\r\nSF050000;253C\r\nSF060000;252C\r\nSF070000;2534\r\nSF080000;251C\r\nSF090000;2524\r\nSF100000;2500\r\nSF110000;2502\r\nSF190000;2561\r\nSF200000;2562\r\nSF210000;2556\r\nSF220000;2555\r\nSF230000;2563\r\nSF240000;2551\r\nSF250000;2557\r\nSF260000;255D\r\nSF270000;255C\r\nSF280000;255B\r\nSF360000;255E\r\nSF370000;255F\r\nSF380000;255A\r\nSF390000;2554\r\nSF400000;2569\r\nSF410000;2566\r\nSF420000;2560\r\nSF430000;2550\r\nSF440000;256C\r\nSF450000;2567\r\nSF460000;2568\r\nSF470000;2564\r\nSF480000;2565\r\nSF490000;2559\r\nSF500000;2558\r\nSF510000;2552\r\nSF520000;2553\r\nSF530000;256B\r\nSF540000;256A\r\nSacute;015A\r\nSacutedotaccent;1E64\r\nSampigreek;03E0\r\nScaron;0160\r\nScarondotaccent;1E66\r\nScaronsmall;F6FD\r\nScedilla;015E\r\nSchwa;018F\r\nSchwacyrillic;04D8\r\nSchwadieresiscyrillic;04DA\r\nScircle;24C8\r\nScircumflex;015C\r\nScommaaccent;0218\r\nSdotaccent;1E60\r\nSdotbelow;1E62\r\nSdotbelowdotaccent;1E68\r\nSeharmenian;054D\r\nSevenroman;2166\r\nShaarmenian;0547\r\nShacyrillic;0428\r\nShchacyrillic;0429\r\nSheicoptic;03E2\r\nShhacyrillic;04BA\r\nShimacoptic;03EC\r\nSigma;03A3\r\nSixroman;2165\r\nSmonospace;FF33\r\nSoftsigncyrillic;042C\r\nSsmall;F773\r\nStigmagreek;03DA\r\nT;0054\r\nTau;03A4\r\nTbar;0166\r\nTcaron;0164\r\nTcedilla;0162\r\nTcircle;24C9\r\nTcircumflexbelow;1E70\r\nTcommaaccent;0162\r\nTdotaccent;1E6A\r\nTdotbelow;1E6C\r\nTecyrillic;0422\r\nTedescendercyrillic;04AC\r\nTenroman;2169\r\nTetsecyrillic;04B4\r\nTheta;0398\r\nThook;01AC\r\nThorn;00DE\r\nThornsmall;F7FE\r\nThreeroman;2162\r\nTildesmall;F6FE\r\nTiwnarmenian;054F\r\nTlinebelow;1E6E\r\nTmonospace;FF34\r\nToarmenian;0539\r\nTonefive;01BC\r\nTonesix;0184\r\nTonetwo;01A7\r\nTretroflexhook;01AE\r\nTsecyrillic;0426\r\nTshecyrillic;040B\r\nTsmall;F774\r\nTwelveroman;216B\r\nTworoman;2161\r\nU;0055\r\nUacute;00DA\r\nUacutesmall;F7FA\r\nUbreve;016C\r\nUcaron;01D3\r\nUcircle;24CA\r\nUcircumflex;00DB\r\nUcircumflexbelow;1E76\r\nUcircumflexsmall;F7FB\r\nUcyrillic;0423\r\nUdblacute;0170\r\nUdblgrave;0214\r\nUdieresis;00DC\r\nUdieresisacute;01D7\r\nUdieresisbelow;1E72\r\nUdieresiscaron;01D9\r\nUdieresiscyrillic;04F0\r\nUdieresisgrave;01DB\r\nUdieresismacron;01D5\r\nUdieresissmall;F7FC\r\nUdotbelow;1EE4\r\nUgrave;00D9\r\nUgravesmall;F7F9\r\nUhookabove;1EE6\r\nUhorn;01AF\r\nUhornacute;1EE8\r\nUhorndotbelow;1EF0\r\nUhorngrave;1EEA\r\nUhornhookabove;1EEC\r\nUhorntilde;1EEE\r\nUhungarumlaut;0170\r\nUhungarumlautcyrillic;04F2\r\nUinvertedbreve;0216\r\nUkcyrillic;0478\r\nUmacron;016A\r\nUmacroncyrillic;04EE\r\nUmacrondieresis;1E7A\r\nUmonospace;FF35\r\nUogonek;0172\r\nUpsilon;03A5\r\nUpsilon1;03D2\r\nUpsilonacutehooksymbolgreek;03D3\r\nUpsilonafrican;01B1\r\nUpsilondieresis;03AB\r\nUpsilondieresishooksymbolgreek;03D4\r\nUpsilonhooksymbol;03D2\r\nUpsilontonos;038E\r\nUring;016E\r\nUshortcyrillic;040E\r\nUsmall;F775\r\nUstraightcyrillic;04AE\r\nUstraightstrokecyrillic;04B0\r\nUtilde;0168\r\nUtildeacute;1E78\r\nUtildebelow;1E74\r\nV;0056\r\nVcircle;24CB\r\nVdotbelow;1E7E\r\nVecyrillic;0412\r\nVewarmenian;054E\r\nVhook;01B2\r\nVmonospace;FF36\r\nVoarmenian;0548\r\nVsmall;F776\r\nVtilde;1E7C\r\nW;0057\r\nWacute;1E82\r\nWcircle;24CC\r\nWcircumflex;0174\r\nWdieresis;1E84\r\nWdotaccent;1E86\r\nWdotbelow;1E88\r\nWgrave;1E80\r\nWmonospace;FF37\r\nWsmall;F777\r\nX;0058\r\nXcircle;24CD\r\nXdieresis;1E8C\r\nXdotaccent;1E8A\r\nXeharmenian;053D\r\nXi;039E\r\nXmonospace;FF38\r\nXsmall;F778\r\nY;0059\r\nYacute;00DD\r\nYacutesmall;F7FD\r\nYatcyrillic;0462\r\nYcircle;24CE\r\nYcircumflex;0176\r\nYdieresis;0178\r\nYdieresissmall;F7FF\r\nYdotaccent;1E8E\r\nYdotbelow;1EF4\r\nYericyrillic;042B\r\nYerudieresiscyrillic;04F8\r\nYgrave;1EF2\r\nYhook;01B3\r\nYhookabove;1EF6\r\nYiarmenian;0545\r\nYicyrillic;0407\r\nYiwnarmenian;0552\r\nYmonospace;FF39\r\nYsmall;F779\r\nYtilde;1EF8\r\nYusbigcyrillic;046A\r\nYusbigiotifiedcyrillic;046C\r\nYuslittlecyrillic;0466\r\nYuslittleiotifiedcyrillic;0468\r\nZ;005A\r\nZaarmenian;0536\r\nZacute;0179\r\nZcaron;017D\r\nZcaronsmall;F6FF\r\nZcircle;24CF\r\nZcircumflex;1E90\r\nZdot;017B\r\nZdotaccent;017B\r\nZdotbelow;1E92\r\nZecyrillic;0417\r\nZedescendercyrillic;0498\r\nZedieresiscyrillic;04DE\r\nZeta;0396\r\nZhearmenian;053A\r\nZhebrevecyrillic;04C1\r\nZhecyrillic;0416\r\nZhedescendercyrillic;0496\r\nZhedieresiscyrillic;04DC\r\nZlinebelow;1E94\r\nZmonospace;FF3A\r\nZsmall;F77A\r\nZstroke;01B5\r\na;0061\r\naabengali;0986\r\naacute;00E1\r\naadeva;0906\r\naagujarati;0A86\r\naagurmukhi;0A06\r\naamatragurmukhi;0A3E\r\naarusquare;3303\r\naavowelsignbengali;09BE\r\naavowelsigndeva;093E\r\naavowelsigngujarati;0ABE\r\nabbreviationmarkarmenian;055F\r\nabbreviationsigndeva;0970\r\nabengali;0985\r\nabopomofo;311A\r\nabreve;0103\r\nabreveacute;1EAF\r\nabrevecyrillic;04D1\r\nabrevedotbelow;1EB7\r\nabrevegrave;1EB1\r\nabrevehookabove;1EB3\r\nabrevetilde;1EB5\r\nacaron;01CE\r\nacircle;24D0\r\nacircumflex;00E2\r\nacircumflexacute;1EA5\r\nacircumflexdotbelow;1EAD\r\nacircumflexgrave;1EA7\r\nacircumflexhookabove;1EA9\r\nacircumflextilde;1EAB\r\nacute;00B4\r\nacutebelowcmb;0317\r\nacutecmb;0301\r\nacutecomb;0301\r\nacutedeva;0954\r\nacutelowmod;02CF\r\nacutetonecmb;0341\r\nacyrillic;0430\r\nadblgrave;0201\r\naddakgurmukhi;0A71\r\nadeva;0905\r\nadieresis;00E4\r\nadieresiscyrillic;04D3\r\nadieresismacron;01DF\r\nadotbelow;1EA1\r\nadotmacron;01E1\r\nae;00E6\r\naeacute;01FD\r\naekorean;3150\r\naemacron;01E3\r\nafii00208;2015\r\nafii08941;20A4\r\nafii10017;0410\r\nafii10018;0411\r\nafii10019;0412\r\nafii10020;0413\r\nafii10021;0414\r\nafii10022;0415\r\nafii10023;0401\r\nafii10024;0416\r\nafii10025;0417\r\nafii10026;0418\r\nafii10027;0419\r\nafii10028;041A\r\nafii10029;041B\r\nafii10030;041C\r\nafii10031;041D\r\nafii10032;041E\r\nafii10033;041F\r\nafii10034;0420\r\nafii10035;0421\r\nafii10036;0422\r\nafii10037;0423\r\nafii10038;0424\r\nafii10039;0425\r\nafii10040;0426\r\nafii10041;0427\r\nafii10042;0428\r\nafii10043;0429\r\nafii10044;042A\r\nafii10045;042B\r\nafii10046;042C\r\nafii10047;042D\r\nafii10048;042E\r\nafii10049;042F\r\nafii10050;0490\r\nafii10051;0402\r\nafii10052;0403\r\nafii10053;0404\r\nafii10054;0405\r\nafii10055;0406\r\nafii10056;0407\r\nafii10057;0408\r\nafii10058;0409\r\nafii10059;040A\r\nafii10060;040B\r\nafii10061;040C\r\nafii10062;040E\r\nafii10063;F6C4\r\nafii10064;F6C5\r\nafii10065;0430\r\nafii10066;0431\r\nafii10067;0432\r\nafii10068;0433\r\nafii10069;0434\r\nafii10070;0435\r\nafii10071;0451\r\nafii10072;0436\r\nafii10073;0437\r\nafii10074;0438\r\nafii10075;0439\r\nafii10076;043A\r\nafii10077;043B\r\nafii10078;043C\r\nafii10079;043D\r\nafii10080;043E\r\nafii10081;043F\r\nafii10082;0440\r\nafii10083;0441\r\nafii10084;0442\r\nafii10085;0443\r\nafii10086;0444\r\nafii10087;0445\r\nafii10088;0446\r\nafii10089;0447\r\nafii10090;0448\r\nafii10091;0449\r\nafii10092;044A\r\nafii10093;044B\r\nafii10094;044C\r\nafii10095;044D\r\nafii10096;044E\r\nafii10097;044F\r\nafii10098;0491\r\nafii10099;0452\r\nafii10100;0453\r\nafii10101;0454\r\nafii10102;0455\r\nafii10103;0456\r\nafii10104;0457\r\nafii10105;0458\r\nafii10106;0459\r\nafii10107;045A\r\nafii10108;045B\r\nafii10109;045C\r\nafii10110;045E\r\nafii10145;040F\r\nafii10146;0462\r\nafii10147;0472\r\nafii10148;0474\r\nafii10192;F6C6\r\nafii10193;045F\r\nafii10194;0463\r\nafii10195;0473\r\nafii10196;0475\r\nafii10831;F6C7\r\nafii10832;F6C8\r\nafii10846;04D9\r\nafii299;200E\r\nafii300;200F\r\nafii301;200D\r\nafii57381;066A\r\nafii57388;060C\r\nafii57392;0660\r\nafii57393;0661\r\nafii57394;0662\r\nafii57395;0663\r\nafii57396;0664\r\nafii57397;0665\r\nafii57398;0666\r\nafii57399;0667\r\nafii57400;0668\r\nafii57401;0669\r\nafii57403;061B\r\nafii57407;061F\r\nafii57409;0621\r\nafii57410;0622\r\nafii57411;0623\r\nafii57412;0624\r\nafii57413;0625\r\nafii57414;0626\r\nafii57415;0627\r\nafii57416;0628\r\nafii57417;0629\r\nafii57418;062A\r\nafii57419;062B\r\nafii57420;062C\r\nafii57421;062D\r\nafii57422;062E\r\nafii57423;062F\r\nafii57424;0630\r\nafii57425;0631\r\nafii57426;0632\r\nafii57427;0633\r\nafii57428;0634\r\nafii57429;0635\r\nafii57430;0636\r\nafii57431;0637\r\nafii57432;0638\r\nafii57433;0639\r\nafii57434;063A\r\nafii57440;0640\r\nafii57441;0641\r\nafii57442;0642\r\nafii57443;0643\r\nafii57444;0644\r\nafii57445;0645\r\nafii57446;0646\r\nafii57448;0648\r\nafii57449;0649\r\nafii57450;064A\r\nafii57451;064B\r\nafii57452;064C\r\nafii57453;064D\r\nafii57454;064E\r\nafii57455;064F\r\nafii57456;0650\r\nafii57457;0651\r\nafii57458;0652\r\nafii57470;0647\r\nafii57505;06A4\r\nafii57506;067E\r\nafii57507;0686\r\nafii57508;0698\r\nafii57509;06AF\r\nafii57511;0679\r\nafii57512;0688\r\nafii57513;0691\r\nafii57514;06BA\r\nafii57519;06D2\r\nafii57534;06D5\r\nafii57636;20AA\r\nafii57645;05BE\r\nafii57658;05C3\r\nafii57664;05D0\r\nafii57665;05D1\r\nafii57666;05D2\r\nafii57667;05D3\r\nafii57668;05D4\r\nafii57669;05D5\r\nafii57670;05D6\r\nafii57671;05D7\r\nafii57672;05D8\r\nafii57673;05D9\r\nafii57674;05DA\r\nafii57675;05DB\r\nafii57676;05DC\r\nafii57677;05DD\r\nafii57678;05DE\r\nafii57679;05DF\r\nafii57680;05E0\r\nafii57681;05E1\r\nafii57682;05E2\r\nafii57683;05E3\r\nafii57684;05E4\r\nafii57685;05E5\r\nafii57686;05E6\r\nafii57687;05E7\r\nafii57688;05E8\r\nafii57689;05E9\r\nafii57690;05EA\r\nafii57694;FB2A\r\nafii57695;FB2B\r\nafii57700;FB4B\r\nafii57705;FB1F\r\nafii57716;05F0\r\nafii57717;05F1\r\nafii57718;05F2\r\nafii57723;FB35\r\nafii57793;05B4\r\nafii57794;05B5\r\nafii57795;05B6\r\nafii57796;05BB\r\nafii57797;05B8\r\nafii57798;05B7\r\nafii57799;05B0\r\nafii57800;05B2\r\nafii57801;05B1\r\nafii57802;05B3\r\nafii57803;05C2\r\nafii57804;05C1\r\nafii57806;05B9\r\nafii57807;05BC\r\nafii57839;05BD\r\nafii57841;05BF\r\nafii57842;05C0\r\nafii57929;02BC\r\nafii61248;2105\r\nafii61289;2113\r\nafii61352;2116\r\nafii61573;202C\r\nafii61574;202D\r\nafii61575;202E\r\nafii61664;200C\r\nafii63167;066D\r\nafii64937;02BD\r\nagrave;00E0\r\nagujarati;0A85\r\nagurmukhi;0A05\r\nahiragana;3042\r\nahookabove;1EA3\r\naibengali;0990\r\naibopomofo;311E\r\naideva;0910\r\naiecyrillic;04D5\r\naigujarati;0A90\r\naigurmukhi;0A10\r\naimatragurmukhi;0A48\r\nainarabic;0639\r\nainfinalarabic;FECA\r\naininitialarabic;FECB\r\nainmedialarabic;FECC\r\nainvertedbreve;0203\r\naivowelsignbengali;09C8\r\naivowelsigndeva;0948\r\naivowelsigngujarati;0AC8\r\nakatakana;30A2\r\nakatakanahalfwidth;FF71\r\nakorean;314F\r\nalef;05D0\r\nalefarabic;0627\r\nalefdageshhebrew;FB30\r\naleffinalarabic;FE8E\r\nalefhamzaabovearabic;0623\r\nalefhamzaabovefinalarabic;FE84\r\nalefhamzabelowarabic;0625\r\nalefhamzabelowfinalarabic;FE88\r\nalefhebrew;05D0\r\naleflamedhebrew;FB4F\r\nalefmaddaabovearabic;0622\r\nalefmaddaabovefinalarabic;FE82\r\nalefmaksuraarabic;0649\r\nalefmaksurafinalarabic;FEF0\r\nalefmaksurainitialarabic;FEF3\r\nalefmaksuramedialarabic;FEF4\r\nalefpatahhebrew;FB2E\r\nalefqamatshebrew;FB2F\r\naleph;2135\r\nallequal;224C\r\nalpha;03B1\r\nalphatonos;03AC\r\namacron;0101\r\namonospace;FF41\r\nampersand;0026\r\nampersandmonospace;FF06\r\nampersandsmall;F726\r\namsquare;33C2\r\nanbopomofo;3122\r\nangbopomofo;3124\r\nangkhankhuthai;0E5A\r\nangle;2220\r\nanglebracketleft;3008\r\nanglebracketleftvertical;FE3F\r\nanglebracketright;3009\r\nanglebracketrightvertical;FE40\r\nangleleft;2329\r\nangleright;232A\r\nangstrom;212B\r\nanoteleia;0387\r\nanudattadeva;0952\r\nanusvarabengali;0982\r\nanusvaradeva;0902\r\nanusvaragujarati;0A82\r\naogonek;0105\r\napaatosquare;3300\r\naparen;249C\r\napostrophearmenian;055A\r\napostrophemod;02BC\r\napple;F8FF\r\napproaches;2250\r\napproxequal;2248\r\napproxequalorimage;2252\r\napproximatelyequal;2245\r\naraeaekorean;318E\r\naraeakorean;318D\r\narc;2312\r\narighthalfring;1E9A\r\naring;00E5\r\naringacute;01FB\r\naringbelow;1E01\r\narrowboth;2194\r\narrowdashdown;21E3\r\narrowdashleft;21E0\r\narrowdashright;21E2\r\narrowdashup;21E1\r\narrowdblboth;21D4\r\narrowdbldown;21D3\r\narrowdblleft;21D0\r\narrowdblright;21D2\r\narrowdblup;21D1\r\narrowdown;2193\r\narrowdownleft;2199\r\narrowdownright;2198\r\narrowdownwhite;21E9\r\narrowheaddownmod;02C5\r\narrowheadleftmod;02C2\r\narrowheadrightmod;02C3\r\narrowheadupmod;02C4\r\narrowhorizex;F8E7\r\narrowleft;2190\r\narrowleftdbl;21D0\r\narrowleftdblstroke;21CD\r\narrowleftoverright;21C6\r\narrowleftwhite;21E6\r\narrowright;2192\r\narrowrightdblstroke;21CF\r\narrowrightheavy;279E\r\narrowrightoverleft;21C4\r\narrowrightwhite;21E8\r\narrowtableft;21E4\r\narrowtabright;21E5\r\narrowup;2191\r\narrowupdn;2195\r\narrowupdnbse;21A8\r\narrowupdownbase;21A8\r\narrowupleft;2196\r\narrowupleftofdown;21C5\r\narrowupright;2197\r\narrowupwhite;21E7\r\narrowvertex;F8E6\r\nasciicircum;005E\r\nasciicircummonospace;FF3E\r\nasciitilde;007E\r\nasciitildemonospace;FF5E\r\nascript;0251\r\nascriptturned;0252\r\nasmallhiragana;3041\r\nasmallkatakana;30A1\r\nasmallkatakanahalfwidth;FF67\r\nasterisk;002A\r\nasteriskaltonearabic;066D\r\nasteriskarabic;066D\r\nasteriskmath;2217\r\nasteriskmonospace;FF0A\r\nasterisksmall;FE61\r\nasterism;2042\r\nasuperior;F6E9\r\nasymptoticallyequal;2243\r\nat;0040\r\natilde;00E3\r\natmonospace;FF20\r\natsmall;FE6B\r\naturned;0250\r\naubengali;0994\r\naubopomofo;3120\r\naudeva;0914\r\naugujarati;0A94\r\naugurmukhi;0A14\r\naulengthmarkbengali;09D7\r\naumatragurmukhi;0A4C\r\nauvowelsignbengali;09CC\r\nauvowelsigndeva;094C\r\nauvowelsigngujarati;0ACC\r\navagrahadeva;093D\r\naybarmenian;0561\r\nayin;05E2\r\nayinaltonehebrew;FB20\r\nayinhebrew;05E2\r\nb;0062\r\nbabengali;09AC\r\nbackslash;005C\r\nbackslashmonospace;FF3C\r\nbadeva;092C\r\nbagujarati;0AAC\r\nbagurmukhi;0A2C\r\nbahiragana;3070\r\nbahtthai;0E3F\r\nbakatakana;30D0\r\nbar;007C\r\nbarmonospace;FF5C\r\nbbopomofo;3105\r\nbcircle;24D1\r\nbdotaccent;1E03\r\nbdotbelow;1E05\r\nbeamedsixteenthnotes;266C\r\nbecause;2235\r\nbecyrillic;0431\r\nbeharabic;0628\r\nbehfinalarabic;FE90\r\nbehinitialarabic;FE91\r\nbehiragana;3079\r\nbehmedialarabic;FE92\r\nbehmeeminitialarabic;FC9F\r\nbehmeemisolatedarabic;FC08\r\nbehnoonfinalarabic;FC6D\r\nbekatakana;30D9\r\nbenarmenian;0562\r\nbet;05D1\r\nbeta;03B2\r\nbetasymbolgreek;03D0\r\nbetdagesh;FB31\r\nbetdageshhebrew;FB31\r\nbethebrew;05D1\r\nbetrafehebrew;FB4C\r\nbhabengali;09AD\r\nbhadeva;092D\r\nbhagujarati;0AAD\r\nbhagurmukhi;0A2D\r\nbhook;0253\r\nbihiragana;3073\r\nbikatakana;30D3\r\nbilabialclick;0298\r\nbindigurmukhi;0A02\r\nbirusquare;3331\r\nblackcircle;25CF\r\nblackdiamond;25C6\r\nblackdownpointingtriangle;25BC\r\nblackleftpointingpointer;25C4\r\nblackleftpointingtriangle;25C0\r\nblacklenticularbracketleft;3010\r\nblacklenticularbracketleftvertical;FE3B\r\nblacklenticularbracketright;3011\r\nblacklenticularbracketrightvertical;FE3C\r\nblacklowerlefttriangle;25E3\r\nblacklowerrighttriangle;25E2\r\nblackrectangle;25AC\r\nblackrightpointingpointer;25BA\r\nblackrightpointingtriangle;25B6\r\nblacksmallsquare;25AA\r\nblacksmilingface;263B\r\nblacksquare;25A0\r\nblackstar;2605\r\nblackupperlefttriangle;25E4\r\nblackupperrighttriangle;25E5\r\nblackuppointingsmalltriangle;25B4\r\nblackuppointingtriangle;25B2\r\nblank;2423\r\nblinebelow;1E07\r\nblock;2588\r\nbmonospace;FF42\r\nbobaimaithai;0E1A\r\nbohiragana;307C\r\nbokatakana;30DC\r\nbparen;249D\r\nbqsquare;33C3\r\nbraceex;F8F4\r\nbraceleft;007B\r\nbraceleftbt;F8F3\r\nbraceleftmid;F8F2\r\nbraceleftmonospace;FF5B\r\nbraceleftsmall;FE5B\r\nbracelefttp;F8F1\r\nbraceleftvertical;FE37\r\nbraceright;007D\r\nbracerightbt;F8FE\r\nbracerightmid;F8FD\r\nbracerightmonospace;FF5D\r\nbracerightsmall;FE5C\r\nbracerighttp;F8FC\r\nbracerightvertical;FE38\r\nbracketleft;005B\r\nbracketleftbt;F8F0\r\nbracketleftex;F8EF\r\nbracketleftmonospace;FF3B\r\nbracketlefttp;F8EE\r\nbracketright;005D\r\nbracketrightbt;F8FB\r\nbracketrightex;F8FA\r\nbracketrightmonospace;FF3D\r\nbracketrighttp;F8F9\r\nbreve;02D8\r\nbrevebelowcmb;032E\r\nbrevecmb;0306\r\nbreveinvertedbelowcmb;032F\r\nbreveinvertedcmb;0311\r\nbreveinverteddoublecmb;0361\r\nbridgebelowcmb;032A\r\nbridgeinvertedbelowcmb;033A\r\nbrokenbar;00A6\r\nbstroke;0180\r\nbsuperior;F6EA\r\nbtopbar;0183\r\nbuhiragana;3076\r\nbukatakana;30D6\r\nbullet;2022\r\nbulletinverse;25D8\r\nbulletoperator;2219\r\nbullseye;25CE\r\nc;0063\r\ncaarmenian;056E\r\ncabengali;099A\r\ncacute;0107\r\ncadeva;091A\r\ncagujarati;0A9A\r\ncagurmukhi;0A1A\r\ncalsquare;3388\r\ncandrabindubengali;0981\r\ncandrabinducmb;0310\r\ncandrabindudeva;0901\r\ncandrabindugujarati;0A81\r\ncapslock;21EA\r\ncareof;2105\r\ncaron;02C7\r\ncaronbelowcmb;032C\r\ncaroncmb;030C\r\ncarriagereturn;21B5\r\ncbopomofo;3118\r\nccaron;010D\r\nccedilla;00E7\r\nccedillaacute;1E09\r\nccircle;24D2\r\nccircumflex;0109\r\nccurl;0255\r\ncdot;010B\r\ncdotaccent;010B\r\ncdsquare;33C5\r\ncedilla;00B8\r\ncedillacmb;0327\r\ncent;00A2\r\ncentigrade;2103\r\ncentinferior;F6DF\r\ncentmonospace;FFE0\r\ncentoldstyle;F7A2\r\ncentsuperior;F6E0\r\nchaarmenian;0579\r\nchabengali;099B\r\nchadeva;091B\r\nchagujarati;0A9B\r\nchagurmukhi;0A1B\r\nchbopomofo;3114\r\ncheabkhasiancyrillic;04BD\r\ncheckmark;2713\r\nchecyrillic;0447\r\nchedescenderabkhasiancyrillic;04BF\r\nchedescendercyrillic;04B7\r\nchedieresiscyrillic;04F5\r\ncheharmenian;0573\r\nchekhakassiancyrillic;04CC\r\ncheverticalstrokecyrillic;04B9\r\nchi;03C7\r\nchieuchacirclekorean;3277\r\nchieuchaparenkorean;3217\r\nchieuchcirclekorean;3269\r\nchieuchkorean;314A\r\nchieuchparenkorean;3209\r\nchochangthai;0E0A\r\nchochanthai;0E08\r\nchochingthai;0E09\r\nchochoethai;0E0C\r\nchook;0188\r\ncieucacirclekorean;3276\r\ncieucaparenkorean;3216\r\ncieuccirclekorean;3268\r\ncieuckorean;3148\r\ncieucparenkorean;3208\r\ncieucuparenkorean;321C\r\ncircle;25CB\r\ncirclemultiply;2297\r\ncircleot;2299\r\ncircleplus;2295\r\ncirclepostalmark;3036\r\ncirclewithlefthalfblack;25D0\r\ncirclewithrighthalfblack;25D1\r\ncircumflex;02C6\r\ncircumflexbelowcmb;032D\r\ncircumflexcmb;0302\r\nclear;2327\r\nclickalveolar;01C2\r\nclickdental;01C0\r\nclicklateral;01C1\r\nclickretroflex;01C3\r\nclub;2663\r\nclubsuitblack;2663\r\nclubsuitwhite;2667\r\ncmcubedsquare;33A4\r\ncmonospace;FF43\r\ncmsquaredsquare;33A0\r\ncoarmenian;0581\r\ncolon;003A\r\ncolonmonetary;20A1\r\ncolonmonospace;FF1A\r\ncolonsign;20A1\r\ncolonsmall;FE55\r\ncolontriangularhalfmod;02D1\r\ncolontriangularmod;02D0\r\ncomma;002C\r\ncommaabovecmb;0313\r\ncommaaboverightcmb;0315\r\ncommaaccent;F6C3\r\ncommaarabic;060C\r\ncommaarmenian;055D\r\ncommainferior;F6E1\r\ncommamonospace;FF0C\r\ncommareversedabovecmb;0314\r\ncommareversedmod;02BD\r\ncommasmall;FE50\r\ncommasuperior;F6E2\r\ncommaturnedabovecmb;0312\r\ncommaturnedmod;02BB\r\ncompass;263C\r\ncongruent;2245\r\ncontourintegral;222E\r\ncontrol;2303\r\ncontrolACK;0006\r\ncontrolBEL;0007\r\ncontrolBS;0008\r\ncontrolCAN;0018\r\ncontrolCR;000D\r\ncontrolDC1;0011\r\ncontrolDC2;0012\r\ncontrolDC3;0013\r\ncontrolDC4;0014\r\ncontrolDEL;007F\r\ncontrolDLE;0010\r\ncontrolEM;0019\r\ncontrolENQ;0005\r\ncontrolEOT;0004\r\ncontrolESC;001B\r\ncontrolETB;0017\r\ncontrolETX;0003\r\ncontrolFF;000C\r\ncontrolFS;001C\r\ncontrolGS;001D\r\ncontrolHT;0009\r\ncontrolLF;000A\r\ncontrolNAK;0015\r\ncontrolRS;001E\r\ncontrolSI;000F\r\ncontrolSO;000E\r\ncontrolSOT;0002\r\ncontrolSTX;0001\r\ncontrolSUB;001A\r\ncontrolSYN;0016\r\ncontrolUS;001F\r\ncontrolVT;000B\r\ncopyright;00A9\r\ncopyrightsans;F8E9\r\ncopyrightserif;F6D9\r\ncornerbracketleft;300C\r\ncornerbracketlefthalfwidth;FF62\r\ncornerbracketleftvertical;FE41\r\ncornerbracketright;300D\r\ncornerbracketrighthalfwidth;FF63\r\ncornerbracketrightvertical;FE42\r\ncorporationsquare;337F\r\ncosquare;33C7\r\ncoverkgsquare;33C6\r\ncparen;249E\r\ncruzeiro;20A2\r\ncstretched;0297\r\ncurlyand;22CF\r\ncurlyor;22CE\r\ncurrency;00A4\r\ncyrBreve;F6D1\r\ncyrFlex;F6D2\r\ncyrbreve;F6D4\r\ncyrflex;F6D5\r\nd;0064\r\ndaarmenian;0564\r\ndabengali;09A6\r\ndadarabic;0636\r\ndadeva;0926\r\ndadfinalarabic;FEBE\r\ndadinitialarabic;FEBF\r\ndadmedialarabic;FEC0\r\ndagesh;05BC\r\ndageshhebrew;05BC\r\ndagger;2020\r\ndaggerdbl;2021\r\ndagujarati;0AA6\r\ndagurmukhi;0A26\r\ndahiragana;3060\r\ndakatakana;30C0\r\ndalarabic;062F\r\ndalet;05D3\r\ndaletdagesh;FB33\r\ndaletdageshhebrew;FB33\r\ndalethatafpatah;05D3 05B2\r\ndalethatafpatahhebrew;05D3 05B2\r\ndalethatafsegol;05D3 05B1\r\ndalethatafsegolhebrew;05D3 05B1\r\ndalethebrew;05D3\r\ndalethiriq;05D3 05B4\r\ndalethiriqhebrew;05D3 05B4\r\ndaletholam;05D3 05B9\r\ndaletholamhebrew;05D3 05B9\r\ndaletpatah;05D3 05B7\r\ndaletpatahhebrew;05D3 05B7\r\ndaletqamats;05D3 05B8\r\ndaletqamatshebrew;05D3 05B8\r\ndaletqubuts;05D3 05BB\r\ndaletqubutshebrew;05D3 05BB\r\ndaletsegol;05D3 05B6\r\ndaletsegolhebrew;05D3 05B6\r\ndaletsheva;05D3 05B0\r\ndaletshevahebrew;05D3 05B0\r\ndalettsere;05D3 05B5\r\ndalettserehebrew;05D3 05B5\r\ndalfinalarabic;FEAA\r\ndammaarabic;064F\r\ndammalowarabic;064F\r\ndammatanaltonearabic;064C\r\ndammatanarabic;064C\r\ndanda;0964\r\ndargahebrew;05A7\r\ndargalefthebrew;05A7\r\ndasiapneumatacyrilliccmb;0485\r\ndblGrave;F6D3\r\ndblanglebracketleft;300A\r\ndblanglebracketleftvertical;FE3D\r\ndblanglebracketright;300B\r\ndblanglebracketrightvertical;FE3E\r\ndblarchinvertedbelowcmb;032B\r\ndblarrowleft;21D4\r\ndblarrowright;21D2\r\ndbldanda;0965\r\ndblgrave;F6D6\r\ndblgravecmb;030F\r\ndblintegral;222C\r\ndbllowline;2017\r\ndbllowlinecmb;0333\r\ndbloverlinecmb;033F\r\ndblprimemod;02BA\r\ndblverticalbar;2016\r\ndblverticallineabovecmb;030E\r\ndbopomofo;3109\r\ndbsquare;33C8\r\ndcaron;010F\r\ndcedilla;1E11\r\ndcircle;24D3\r\ndcircumflexbelow;1E13\r\ndcroat;0111\r\nddabengali;09A1\r\nddadeva;0921\r\nddagujarati;0AA1\r\nddagurmukhi;0A21\r\nddalarabic;0688\r\nddalfinalarabic;FB89\r\ndddhadeva;095C\r\nddhabengali;09A2\r\nddhadeva;0922\r\nddhagujarati;0AA2\r\nddhagurmukhi;0A22\r\nddotaccent;1E0B\r\nddotbelow;1E0D\r\ndecimalseparatorarabic;066B\r\ndecimalseparatorpersian;066B\r\ndecyrillic;0434\r\ndegree;00B0\r\ndehihebrew;05AD\r\ndehiragana;3067\r\ndeicoptic;03EF\r\ndekatakana;30C7\r\ndeleteleft;232B\r\ndeleteright;2326\r\ndelta;03B4\r\ndeltaturned;018D\r\ndenominatorminusonenumeratorbengali;09F8\r\ndezh;02A4\r\ndhabengali;09A7\r\ndhadeva;0927\r\ndhagujarati;0AA7\r\ndhagurmukhi;0A27\r\ndhook;0257\r\ndialytikatonos;0385\r\ndialytikatonoscmb;0344\r\ndiamond;2666\r\ndiamondsuitwhite;2662\r\ndieresis;00A8\r\ndieresisacute;F6D7\r\ndieresisbelowcmb;0324\r\ndieresiscmb;0308\r\ndieresisgrave;F6D8\r\ndieresistonos;0385\r\ndihiragana;3062\r\ndikatakana;30C2\r\ndittomark;3003\r\ndivide;00F7\r\ndivides;2223\r\ndivisionslash;2215\r\ndjecyrillic;0452\r\ndkshade;2593\r\ndlinebelow;1E0F\r\ndlsquare;3397\r\ndmacron;0111\r\ndmonospace;FF44\r\ndnblock;2584\r\ndochadathai;0E0E\r\ndodekthai;0E14\r\ndohiragana;3069\r\ndokatakana;30C9\r\ndollar;0024\r\ndollarinferior;F6E3\r\ndollarmonospace;FF04\r\ndollaroldstyle;F724\r\ndollarsmall;FE69\r\ndollarsuperior;F6E4\r\ndong;20AB\r\ndorusquare;3326\r\ndotaccent;02D9\r\ndotaccentcmb;0307\r\ndotbelowcmb;0323\r\ndotbelowcomb;0323\r\ndotkatakana;30FB\r\ndotlessi;0131\r\ndotlessj;F6BE\r\ndotlessjstrokehook;0284\r\ndotmath;22C5\r\ndottedcircle;25CC\r\ndoubleyodpatah;FB1F\r\ndoubleyodpatahhebrew;FB1F\r\ndowntackbelowcmb;031E\r\ndowntackmod;02D5\r\ndparen;249F\r\ndsuperior;F6EB\r\ndtail;0256\r\ndtopbar;018C\r\nduhiragana;3065\r\ndukatakana;30C5\r\ndz;01F3\r\ndzaltone;02A3\r\ndzcaron;01C6\r\ndzcurl;02A5\r\ndzeabkhasiancyrillic;04E1\r\ndzecyrillic;0455\r\ndzhecyrillic;045F\r\ne;0065\r\neacute;00E9\r\nearth;2641\r\nebengali;098F\r\nebopomofo;311C\r\nebreve;0115\r\necandradeva;090D\r\necandragujarati;0A8D\r\necandravowelsigndeva;0945\r\necandravowelsigngujarati;0AC5\r\necaron;011B\r\necedillabreve;1E1D\r\necharmenian;0565\r\nechyiwnarmenian;0587\r\necircle;24D4\r\necircumflex;00EA\r\necircumflexacute;1EBF\r\necircumflexbelow;1E19\r\necircumflexdotbelow;1EC7\r\necircumflexgrave;1EC1\r\necircumflexhookabove;1EC3\r\necircumflextilde;1EC5\r\necyrillic;0454\r\nedblgrave;0205\r\nedeva;090F\r\nedieresis;00EB\r\nedot;0117\r\nedotaccent;0117\r\nedotbelow;1EB9\r\neegurmukhi;0A0F\r\neematragurmukhi;0A47\r\nefcyrillic;0444\r\negrave;00E8\r\negujarati;0A8F\r\neharmenian;0567\r\nehbopomofo;311D\r\nehiragana;3048\r\nehookabove;1EBB\r\neibopomofo;311F\r\neight;0038\r\neightarabic;0668\r\neightbengali;09EE\r\neightcircle;2467\r\neightcircleinversesansserif;2791\r\neightdeva;096E\r\neighteencircle;2471\r\neighteenparen;2485\r\neighteenperiod;2499\r\neightgujarati;0AEE\r\neightgurmukhi;0A6E\r\neighthackarabic;0668\r\neighthangzhou;3028\r\neighthnotebeamed;266B\r\neightideographicparen;3227\r\neightinferior;2088\r\neightmonospace;FF18\r\neightoldstyle;F738\r\neightparen;247B\r\neightperiod;248F\r\neightpersian;06F8\r\neightroman;2177\r\neightsuperior;2078\r\neightthai;0E58\r\neinvertedbreve;0207\r\neiotifiedcyrillic;0465\r\nekatakana;30A8\r\nekatakanahalfwidth;FF74\r\nekonkargurmukhi;0A74\r\nekorean;3154\r\nelcyrillic;043B\r\nelement;2208\r\nelevencircle;246A\r\nelevenparen;247E\r\nelevenperiod;2492\r\nelevenroman;217A\r\nellipsis;2026\r\nellipsisvertical;22EE\r\nemacron;0113\r\nemacronacute;1E17\r\nemacrongrave;1E15\r\nemcyrillic;043C\r\nemdash;2014\r\nemdashvertical;FE31\r\nemonospace;FF45\r\nemphasismarkarmenian;055B\r\nemptyset;2205\r\nenbopomofo;3123\r\nencyrillic;043D\r\nendash;2013\r\nendashvertical;FE32\r\nendescendercyrillic;04A3\r\neng;014B\r\nengbopomofo;3125\r\nenghecyrillic;04A5\r\nenhookcyrillic;04C8\r\nenspace;2002\r\neogonek;0119\r\neokorean;3153\r\neopen;025B\r\neopenclosed;029A\r\neopenreversed;025C\r\neopenreversedclosed;025E\r\neopenreversedhook;025D\r\neparen;24A0\r\nepsilon;03B5\r\nepsilontonos;03AD\r\nequal;003D\r\nequalmonospace;FF1D\r\nequalsmall;FE66\r\nequalsuperior;207C\r\nequivalence;2261\r\nerbopomofo;3126\r\nercyrillic;0440\r\nereversed;0258\r\nereversedcyrillic;044D\r\nescyrillic;0441\r\nesdescendercyrillic;04AB\r\nesh;0283\r\neshcurl;0286\r\neshortdeva;090E\r\neshortvowelsigndeva;0946\r\neshreversedloop;01AA\r\neshsquatreversed;0285\r\nesmallhiragana;3047\r\nesmallkatakana;30A7\r\nesmallkatakanahalfwidth;FF6A\r\nestimated;212E\r\nesuperior;F6EC\r\neta;03B7\r\netarmenian;0568\r\netatonos;03AE\r\neth;00F0\r\netilde;1EBD\r\netildebelow;1E1B\r\netnahtafoukhhebrew;0591\r\netnahtafoukhlefthebrew;0591\r\netnahtahebrew;0591\r\netnahtalefthebrew;0591\r\neturned;01DD\r\neukorean;3161\r\neuro;20AC\r\nevowelsignbengali;09C7\r\nevowelsigndeva;0947\r\nevowelsigngujarati;0AC7\r\nexclam;0021\r\nexclamarmenian;055C\r\nexclamdbl;203C\r\nexclamdown;00A1\r\nexclamdownsmall;F7A1\r\nexclammonospace;FF01\r\nexclamsmall;F721\r\nexistential;2203\r\nezh;0292\r\nezhcaron;01EF\r\nezhcurl;0293\r\nezhreversed;01B9\r\nezhtail;01BA\r\nf;0066\r\nfadeva;095E\r\nfagurmukhi;0A5E\r\nfahrenheit;2109\r\nfathaarabic;064E\r\nfathalowarabic;064E\r\nfathatanarabic;064B\r\nfbopomofo;3108\r\nfcircle;24D5\r\nfdotaccent;1E1F\r\nfeharabic;0641\r\nfeharmenian;0586\r\nfehfinalarabic;FED2\r\nfehinitialarabic;FED3\r\nfehmedialarabic;FED4\r\nfeicoptic;03E5\r\nfemale;2640\r\nff;FB00\r\nffi;FB03\r\nffl;FB04\r\nfi;FB01\r\nfifteencircle;246E\r\nfifteenparen;2482\r\nfifteenperiod;2496\r\nfiguredash;2012\r\nfilledbox;25A0\r\nfilledrect;25AC\r\nfinalkaf;05DA\r\nfinalkafdagesh;FB3A\r\nfinalkafdageshhebrew;FB3A\r\nfinalkafhebrew;05DA\r\nfinalkafqamats;05DA 05B8\r\nfinalkafqamatshebrew;05DA 05B8\r\nfinalkafsheva;05DA 05B0\r\nfinalkafshevahebrew;05DA 05B0\r\nfinalmem;05DD\r\nfinalmemhebrew;05DD\r\nfinalnun;05DF\r\nfinalnunhebrew;05DF\r\nfinalpe;05E3\r\nfinalpehebrew;05E3\r\nfinaltsadi;05E5\r\nfinaltsadihebrew;05E5\r\nfirsttonechinese;02C9\r\nfisheye;25C9\r\nfitacyrillic;0473\r\nfive;0035\r\nfivearabic;0665\r\nfivebengali;09EB\r\nfivecircle;2464\r\nfivecircleinversesansserif;278E\r\nfivedeva;096B\r\nfiveeighths;215D\r\nfivegujarati;0AEB\r\nfivegurmukhi;0A6B\r\nfivehackarabic;0665\r\nfivehangzhou;3025\r\nfiveideographicparen;3224\r\nfiveinferior;2085\r\nfivemonospace;FF15\r\nfiveoldstyle;F735\r\nfiveparen;2478\r\nfiveperiod;248C\r\nfivepersian;06F5\r\nfiveroman;2174\r\nfivesuperior;2075\r\nfivethai;0E55\r\nfl;FB02\r\nflorin;0192\r\nfmonospace;FF46\r\nfmsquare;3399\r\nfofanthai;0E1F\r\nfofathai;0E1D\r\nfongmanthai;0E4F\r\nforall;2200\r\nfour;0034\r\nfourarabic;0664\r\nfourbengali;09EA\r\nfourcircle;2463\r\nfourcircleinversesansserif;278D\r\nfourdeva;096A\r\nfourgujarati;0AEA\r\nfourgurmukhi;0A6A\r\nfourhackarabic;0664\r\nfourhangzhou;3024\r\nfourideographicparen;3223\r\nfourinferior;2084\r\nfourmonospace;FF14\r\nfournumeratorbengali;09F7\r\nfouroldstyle;F734\r\nfourparen;2477\r\nfourperiod;248B\r\nfourpersian;06F4\r\nfourroman;2173\r\nfoursuperior;2074\r\nfourteencircle;246D\r\nfourteenparen;2481\r\nfourteenperiod;2495\r\nfourthai;0E54\r\nfourthtonechinese;02CB\r\nfparen;24A1\r\nfraction;2044\r\nfranc;20A3\r\ng;0067\r\ngabengali;0997\r\ngacute;01F5\r\ngadeva;0917\r\ngafarabic;06AF\r\ngaffinalarabic;FB93\r\ngafinitialarabic;FB94\r\ngafmedialarabic;FB95\r\ngagujarati;0A97\r\ngagurmukhi;0A17\r\ngahiragana;304C\r\ngakatakana;30AC\r\ngamma;03B3\r\ngammalatinsmall;0263\r\ngammasuperior;02E0\r\ngangiacoptic;03EB\r\ngbopomofo;310D\r\ngbreve;011F\r\ngcaron;01E7\r\ngcedilla;0123\r\ngcircle;24D6\r\ngcircumflex;011D\r\ngcommaaccent;0123\r\ngdot;0121\r\ngdotaccent;0121\r\ngecyrillic;0433\r\ngehiragana;3052\r\ngekatakana;30B2\r\ngeometricallyequal;2251\r\ngereshaccenthebrew;059C\r\ngereshhebrew;05F3\r\ngereshmuqdamhebrew;059D\r\ngermandbls;00DF\r\ngershayimaccenthebrew;059E\r\ngershayimhebrew;05F4\r\ngetamark;3013\r\nghabengali;0998\r\nghadarmenian;0572\r\nghadeva;0918\r\nghagujarati;0A98\r\nghagurmukhi;0A18\r\nghainarabic;063A\r\nghainfinalarabic;FECE\r\nghaininitialarabic;FECF\r\nghainmedialarabic;FED0\r\nghemiddlehookcyrillic;0495\r\nghestrokecyrillic;0493\r\ngheupturncyrillic;0491\r\nghhadeva;095A\r\nghhagurmukhi;0A5A\r\nghook;0260\r\nghzsquare;3393\r\ngihiragana;304E\r\ngikatakana;30AE\r\ngimarmenian;0563\r\ngimel;05D2\r\ngimeldagesh;FB32\r\ngimeldageshhebrew;FB32\r\ngimelhebrew;05D2\r\ngjecyrillic;0453\r\nglottalinvertedstroke;01BE\r\nglottalstop;0294\r\nglottalstopinverted;0296\r\nglottalstopmod;02C0\r\nglottalstopreversed;0295\r\nglottalstopreversedmod;02C1\r\nglottalstopreversedsuperior;02E4\r\nglottalstopstroke;02A1\r\nglottalstopstrokereversed;02A2\r\ngmacron;1E21\r\ngmonospace;FF47\r\ngohiragana;3054\r\ngokatakana;30B4\r\ngparen;24A2\r\ngpasquare;33AC\r\ngradient;2207\r\ngrave;0060\r\ngravebelowcmb;0316\r\ngravecmb;0300\r\ngravecomb;0300\r\ngravedeva;0953\r\ngravelowmod;02CE\r\ngravemonospace;FF40\r\ngravetonecmb;0340\r\ngreater;003E\r\ngreaterequal;2265\r\ngreaterequalorless;22DB\r\ngreatermonospace;FF1E\r\ngreaterorequivalent;2273\r\ngreaterorless;2277\r\ngreateroverequal;2267\r\ngreatersmall;FE65\r\ngscript;0261\r\ngstroke;01E5\r\nguhiragana;3050\r\nguillemotleft;00AB\r\nguillemotright;00BB\r\nguilsinglleft;2039\r\nguilsinglright;203A\r\ngukatakana;30B0\r\nguramusquare;3318\r\ngysquare;33C9\r\nh;0068\r\nhaabkhasiancyrillic;04A9\r\nhaaltonearabic;06C1\r\nhabengali;09B9\r\nhadescendercyrillic;04B3\r\nhadeva;0939\r\nhagujarati;0AB9\r\nhagurmukhi;0A39\r\nhaharabic;062D\r\nhahfinalarabic;FEA2\r\nhahinitialarabic;FEA3\r\nhahiragana;306F\r\nhahmedialarabic;FEA4\r\nhaitusquare;332A\r\nhakatakana;30CF\r\nhakatakanahalfwidth;FF8A\r\nhalantgurmukhi;0A4D\r\nhamzaarabic;0621\r\nhamzadammaarabic;0621 064F\r\nhamzadammatanarabic;0621 064C\r\nhamzafathaarabic;0621 064E\r\nhamzafathatanarabic;0621 064B\r\nhamzalowarabic;0621\r\nhamzalowkasraarabic;0621 0650\r\nhamzalowkasratanarabic;0621 064D\r\nhamzasukunarabic;0621 0652\r\nhangulfiller;3164\r\nhardsigncyrillic;044A\r\nharpoonleftbarbup;21BC\r\nharpoonrightbarbup;21C0\r\nhasquare;33CA\r\nhatafpatah;05B2\r\nhatafpatah16;05B2\r\nhatafpatah23;05B2\r\nhatafpatah2f;05B2\r\nhatafpatahhebrew;05B2\r\nhatafpatahnarrowhebrew;05B2\r\nhatafpatahquarterhebrew;05B2\r\nhatafpatahwidehebrew;05B2\r\nhatafqamats;05B3\r\nhatafqamats1b;05B3\r\nhatafqamats28;05B3\r\nhatafqamats34;05B3\r\nhatafqamatshebrew;05B3\r\nhatafqamatsnarrowhebrew;05B3\r\nhatafqamatsquarterhebrew;05B3\r\nhatafqamatswidehebrew;05B3\r\nhatafsegol;05B1\r\nhatafsegol17;05B1\r\nhatafsegol24;05B1\r\nhatafsegol30;05B1\r\nhatafsegolhebrew;05B1\r\nhatafsegolnarrowhebrew;05B1\r\nhatafsegolquarterhebrew;05B1\r\nhatafsegolwidehebrew;05B1\r\nhbar;0127\r\nhbopomofo;310F\r\nhbrevebelow;1E2B\r\nhcedilla;1E29\r\nhcircle;24D7\r\nhcircumflex;0125\r\nhdieresis;1E27\r\nhdotaccent;1E23\r\nhdotbelow;1E25\r\nhe;05D4\r\nheart;2665\r\nheartsuitblack;2665\r\nheartsuitwhite;2661\r\nhedagesh;FB34\r\nhedageshhebrew;FB34\r\nhehaltonearabic;06C1\r\nheharabic;0647\r\nhehebrew;05D4\r\nhehfinalaltonearabic;FBA7\r\nhehfinalalttwoarabic;FEEA\r\nhehfinalarabic;FEEA\r\nhehhamzaabovefinalarabic;FBA5\r\nhehhamzaaboveisolatedarabic;FBA4\r\nhehinitialaltonearabic;FBA8\r\nhehinitialarabic;FEEB\r\nhehiragana;3078\r\nhehmedialaltonearabic;FBA9\r\nhehmedialarabic;FEEC\r\nheiseierasquare;337B\r\nhekatakana;30D8\r\nhekatakanahalfwidth;FF8D\r\nhekutaarusquare;3336\r\nhenghook;0267\r\nherutusquare;3339\r\nhet;05D7\r\nhethebrew;05D7\r\nhhook;0266\r\nhhooksuperior;02B1\r\nhieuhacirclekorean;327B\r\nhieuhaparenkorean;321B\r\nhieuhcirclekorean;326D\r\nhieuhkorean;314E\r\nhieuhparenkorean;320D\r\nhihiragana;3072\r\nhikatakana;30D2\r\nhikatakanahalfwidth;FF8B\r\nhiriq;05B4\r\nhiriq14;05B4\r\nhiriq21;05B4\r\nhiriq2d;05B4\r\nhiriqhebrew;05B4\r\nhiriqnarrowhebrew;05B4\r\nhiriqquarterhebrew;05B4\r\nhiriqwidehebrew;05B4\r\nhlinebelow;1E96\r\nhmonospace;FF48\r\nhoarmenian;0570\r\nhohipthai;0E2B\r\nhohiragana;307B\r\nhokatakana;30DB\r\nhokatakanahalfwidth;FF8E\r\nholam;05B9\r\nholam19;05B9\r\nholam26;05B9\r\nholam32;05B9\r\nholamhebrew;05B9\r\nholamnarrowhebrew;05B9\r\nholamquarterhebrew;05B9\r\nholamwidehebrew;05B9\r\nhonokhukthai;0E2E\r\nhookabovecomb;0309\r\nhookcmb;0309\r\nhookpalatalizedbelowcmb;0321\r\nhookretroflexbelowcmb;0322\r\nhoonsquare;3342\r\nhoricoptic;03E9\r\nhorizontalbar;2015\r\nhorncmb;031B\r\nhotsprings;2668\r\nhouse;2302\r\nhparen;24A3\r\nhsuperior;02B0\r\nhturned;0265\r\nhuhiragana;3075\r\nhuiitosquare;3333\r\nhukatakana;30D5\r\nhukatakanahalfwidth;FF8C\r\nhungarumlaut;02DD\r\nhungarumlautcmb;030B\r\nhv;0195\r\nhyphen;002D\r\nhypheninferior;F6E5\r\nhyphenmonospace;FF0D\r\nhyphensmall;FE63\r\nhyphensuperior;F6E6\r\nhyphentwo;2010\r\ni;0069\r\niacute;00ED\r\niacyrillic;044F\r\nibengali;0987\r\nibopomofo;3127\r\nibreve;012D\r\nicaron;01D0\r\nicircle;24D8\r\nicircumflex;00EE\r\nicyrillic;0456\r\nidblgrave;0209\r\nideographearthcircle;328F\r\nideographfirecircle;328B\r\nideographicallianceparen;323F\r\nideographiccallparen;323A\r\nideographiccentrecircle;32A5\r\nideographicclose;3006\r\nideographiccomma;3001\r\nideographiccommaleft;FF64\r\nideographiccongratulationparen;3237\r\nideographiccorrectcircle;32A3\r\nideographicearthparen;322F\r\nideographicenterpriseparen;323D\r\nideographicexcellentcircle;329D\r\nideographicfestivalparen;3240\r\nideographicfinancialcircle;3296\r\nideographicfinancialparen;3236\r\nideographicfireparen;322B\r\nideographichaveparen;3232\r\nideographichighcircle;32A4\r\nideographiciterationmark;3005\r\nideographiclaborcircle;3298\r\nideographiclaborparen;3238\r\nideographicleftcircle;32A7\r\nideographiclowcircle;32A6\r\nideographicmedicinecircle;32A9\r\nideographicmetalparen;322E\r\nideographicmoonparen;322A\r\nideographicnameparen;3234\r\nideographicperiod;3002\r\nideographicprintcircle;329E\r\nideographicreachparen;3243\r\nideographicrepresentparen;3239\r\nideographicresourceparen;323E\r\nideographicrightcircle;32A8\r\nideographicsecretcircle;3299\r\nideographicselfparen;3242\r\nideographicsocietyparen;3233\r\nideographicspace;3000\r\nideographicspecialparen;3235\r\nideographicstockparen;3231\r\nideographicstudyparen;323B\r\nideographicsunparen;3230\r\nideographicsuperviseparen;323C\r\nideographicwaterparen;322C\r\nideographicwoodparen;322D\r\nideographiczero;3007\r\nideographmetalcircle;328E\r\nideographmooncircle;328A\r\nideographnamecircle;3294\r\nideographsuncircle;3290\r\nideographwatercircle;328C\r\nideographwoodcircle;328D\r\nideva;0907\r\nidieresis;00EF\r\nidieresisacute;1E2F\r\nidieresiscyrillic;04E5\r\nidotbelow;1ECB\r\niebrevecyrillic;04D7\r\niecyrillic;0435\r\nieungacirclekorean;3275\r\nieungaparenkorean;3215\r\nieungcirclekorean;3267\r\nieungkorean;3147\r\nieungparenkorean;3207\r\nigrave;00EC\r\nigujarati;0A87\r\nigurmukhi;0A07\r\nihiragana;3044\r\nihookabove;1EC9\r\niibengali;0988\r\niicyrillic;0438\r\niideva;0908\r\niigujarati;0A88\r\niigurmukhi;0A08\r\niimatragurmukhi;0A40\r\niinvertedbreve;020B\r\niishortcyrillic;0439\r\niivowelsignbengali;09C0\r\niivowelsigndeva;0940\r\niivowelsigngujarati;0AC0\r\nij;0133\r\nikatakana;30A4\r\nikatakanahalfwidth;FF72\r\nikorean;3163\r\nilde;02DC\r\niluyhebrew;05AC\r\nimacron;012B\r\nimacroncyrillic;04E3\r\nimageorapproximatelyequal;2253\r\nimatragurmukhi;0A3F\r\nimonospace;FF49\r\nincrement;2206\r\ninfinity;221E\r\niniarmenian;056B\r\nintegral;222B\r\nintegralbottom;2321\r\nintegralbt;2321\r\nintegralex;F8F5\r\nintegraltop;2320\r\nintegraltp;2320\r\nintersection;2229\r\nintisquare;3305\r\ninvbullet;25D8\r\ninvcircle;25D9\r\ninvsmileface;263B\r\niocyrillic;0451\r\niogonek;012F\r\niota;03B9\r\niotadieresis;03CA\r\niotadieresistonos;0390\r\niotalatin;0269\r\niotatonos;03AF\r\niparen;24A4\r\nirigurmukhi;0A72\r\nismallhiragana;3043\r\nismallkatakana;30A3\r\nismallkatakanahalfwidth;FF68\r\nissharbengali;09FA\r\nistroke;0268\r\nisuperior;F6ED\r\niterationhiragana;309D\r\niterationkatakana;30FD\r\nitilde;0129\r\nitildebelow;1E2D\r\niubopomofo;3129\r\niucyrillic;044E\r\nivowelsignbengali;09BF\r\nivowelsigndeva;093F\r\nivowelsigngujarati;0ABF\r\nizhitsacyrillic;0475\r\nizhitsadblgravecyrillic;0477\r\nj;006A\r\njaarmenian;0571\r\njabengali;099C\r\njadeva;091C\r\njagujarati;0A9C\r\njagurmukhi;0A1C\r\njbopomofo;3110\r\njcaron;01F0\r\njcircle;24D9\r\njcircumflex;0135\r\njcrossedtail;029D\r\njdotlessstroke;025F\r\njecyrillic;0458\r\njeemarabic;062C\r\njeemfinalarabic;FE9E\r\njeeminitialarabic;FE9F\r\njeemmedialarabic;FEA0\r\njeharabic;0698\r\njehfinalarabic;FB8B\r\njhabengali;099D\r\njhadeva;091D\r\njhagujarati;0A9D\r\njhagurmukhi;0A1D\r\njheharmenian;057B\r\njis;3004\r\njmonospace;FF4A\r\njparen;24A5\r\njsuperior;02B2\r\nk;006B\r\nkabashkircyrillic;04A1\r\nkabengali;0995\r\nkacute;1E31\r\nkacyrillic;043A\r\nkadescendercyrillic;049B\r\nkadeva;0915\r\nkaf;05DB\r\nkafarabic;0643\r\nkafdagesh;FB3B\r\nkafdageshhebrew;FB3B\r\nkaffinalarabic;FEDA\r\nkafhebrew;05DB\r\nkafinitialarabic;FEDB\r\nkafmedialarabic;FEDC\r\nkafrafehebrew;FB4D\r\nkagujarati;0A95\r\nkagurmukhi;0A15\r\nkahiragana;304B\r\nkahookcyrillic;04C4\r\nkakatakana;30AB\r\nkakatakanahalfwidth;FF76\r\nkappa;03BA\r\nkappasymbolgreek;03F0\r\nkapyeounmieumkorean;3171\r\nkapyeounphieuphkorean;3184\r\nkapyeounpieupkorean;3178\r\nkapyeounssangpieupkorean;3179\r\nkaroriisquare;330D\r\nkashidaautoarabic;0640\r\nkashidaautonosidebearingarabic;0640\r\nkasmallkatakana;30F5\r\nkasquare;3384\r\nkasraarabic;0650\r\nkasratanarabic;064D\r\nkastrokecyrillic;049F\r\nkatahiraprolongmarkhalfwidth;FF70\r\nkaverticalstrokecyrillic;049D\r\nkbopomofo;310E\r\nkcalsquare;3389\r\nkcaron;01E9\r\nkcedilla;0137\r\nkcircle;24DA\r\nkcommaaccent;0137\r\nkdotbelow;1E33\r\nkeharmenian;0584\r\nkehiragana;3051\r\nkekatakana;30B1\r\nkekatakanahalfwidth;FF79\r\nkenarmenian;056F\r\nkesmallkatakana;30F6\r\nkgreenlandic;0138\r\nkhabengali;0996\r\nkhacyrillic;0445\r\nkhadeva;0916\r\nkhagujarati;0A96\r\nkhagurmukhi;0A16\r\nkhaharabic;062E\r\nkhahfinalarabic;FEA6\r\nkhahinitialarabic;FEA7\r\nkhahmedialarabic;FEA8\r\nkheicoptic;03E7\r\nkhhadeva;0959\r\nkhhagurmukhi;0A59\r\nkhieukhacirclekorean;3278\r\nkhieukhaparenkorean;3218\r\nkhieukhcirclekorean;326A\r\nkhieukhkorean;314B\r\nkhieukhparenkorean;320A\r\nkhokhaithai;0E02\r\nkhokhonthai;0E05\r\nkhokhuatthai;0E03\r\nkhokhwaithai;0E04\r\nkhomutthai;0E5B\r\nkhook;0199\r\nkhorakhangthai;0E06\r\nkhzsquare;3391\r\nkihiragana;304D\r\nkikatakana;30AD\r\nkikatakanahalfwidth;FF77\r\nkiroguramusquare;3315\r\nkiromeetorusquare;3316\r\nkirosquare;3314\r\nkiyeokacirclekorean;326E\r\nkiyeokaparenkorean;320E\r\nkiyeokcirclekorean;3260\r\nkiyeokkorean;3131\r\nkiyeokparenkorean;3200\r\nkiyeoksioskorean;3133\r\nkjecyrillic;045C\r\nklinebelow;1E35\r\nklsquare;3398\r\nkmcubedsquare;33A6\r\nkmonospace;FF4B\r\nkmsquaredsquare;33A2\r\nkohiragana;3053\r\nkohmsquare;33C0\r\nkokaithai;0E01\r\nkokatakana;30B3\r\nkokatakanahalfwidth;FF7A\r\nkooposquare;331E\r\nkoppacyrillic;0481\r\nkoreanstandardsymbol;327F\r\nkoroniscmb;0343\r\nkparen;24A6\r\nkpasquare;33AA\r\nksicyrillic;046F\r\nktsquare;33CF\r\nkturned;029E\r\nkuhiragana;304F\r\nkukatakana;30AF\r\nkukatakanahalfwidth;FF78\r\nkvsquare;33B8\r\nkwsquare;33BE\r\nl;006C\r\nlabengali;09B2\r\nlacute;013A\r\nladeva;0932\r\nlagujarati;0AB2\r\nlagurmukhi;0A32\r\nlakkhangyaothai;0E45\r\nlamaleffinalarabic;FEFC\r\nlamalefhamzaabovefinalarabic;FEF8\r\nlamalefhamzaaboveisolatedarabic;FEF7\r\nlamalefhamzabelowfinalarabic;FEFA\r\nlamalefhamzabelowisolatedarabic;FEF9\r\nlamalefisolatedarabic;FEFB\r\nlamalefmaddaabovefinalarabic;FEF6\r\nlamalefmaddaaboveisolatedarabic;FEF5\r\nlamarabic;0644\r\nlambda;03BB\r\nlambdastroke;019B\r\nlamed;05DC\r\nlameddagesh;FB3C\r\nlameddageshhebrew;FB3C\r\nlamedhebrew;05DC\r\nlamedholam;05DC 05B9\r\nlamedholamdagesh;05DC 05B9 05BC\r\nlamedholamdageshhebrew;05DC 05B9 05BC\r\nlamedholamhebrew;05DC 05B9\r\nlamfinalarabic;FEDE\r\nlamhahinitialarabic;FCCA\r\nlaminitialarabic;FEDF\r\nlamjeeminitialarabic;FCC9\r\nlamkhahinitialarabic;FCCB\r\nlamlamhehisolatedarabic;FDF2\r\nlammedialarabic;FEE0\r\nlammeemhahinitialarabic;FD88\r\nlammeeminitialarabic;FCCC\r\nlammeemjeeminitialarabic;FEDF FEE4 FEA0\r\nlammeemkhahinitialarabic;FEDF FEE4 FEA8\r\nlargecircle;25EF\r\nlbar;019A\r\nlbelt;026C\r\nlbopomofo;310C\r\nlcaron;013E\r\nlcedilla;013C\r\nlcircle;24DB\r\nlcircumflexbelow;1E3D\r\nlcommaaccent;013C\r\nldot;0140\r\nldotaccent;0140\r\nldotbelow;1E37\r\nldotbelowmacron;1E39\r\nleftangleabovecmb;031A\r\nlefttackbelowcmb;0318\r\nless;003C\r\nlessequal;2264\r\nlessequalorgreater;22DA\r\nlessmonospace;FF1C\r\nlessorequivalent;2272\r\nlessorgreater;2276\r\nlessoverequal;2266\r\nlesssmall;FE64\r\nlezh;026E\r\nlfblock;258C\r\nlhookretroflex;026D\r\nlira;20A4\r\nliwnarmenian;056C\r\nlj;01C9\r\nljecyrillic;0459\r\nll;F6C0\r\nlladeva;0933\r\nllagujarati;0AB3\r\nllinebelow;1E3B\r\nllladeva;0934\r\nllvocalicbengali;09E1\r\nllvocalicdeva;0961\r\nllvocalicvowelsignbengali;09E3\r\nllvocalicvowelsigndeva;0963\r\nlmiddletilde;026B\r\nlmonospace;FF4C\r\nlmsquare;33D0\r\nlochulathai;0E2C\r\nlogicaland;2227\r\nlogicalnot;00AC\r\nlogicalnotreversed;2310\r\nlogicalor;2228\r\nlolingthai;0E25\r\nlongs;017F\r\nlowlinecenterline;FE4E\r\nlowlinecmb;0332\r\nlowlinedashed;FE4D\r\nlozenge;25CA\r\nlparen;24A7\r\nlslash;0142\r\nlsquare;2113\r\nlsuperior;F6EE\r\nltshade;2591\r\nluthai;0E26\r\nlvocalicbengali;098C\r\nlvocalicdeva;090C\r\nlvocalicvowelsignbengali;09E2\r\nlvocalicvowelsigndeva;0962\r\nlxsquare;33D3\r\nm;006D\r\nmabengali;09AE\r\nmacron;00AF\r\nmacronbelowcmb;0331\r\nmacroncmb;0304\r\nmacronlowmod;02CD\r\nmacronmonospace;FFE3\r\nmacute;1E3F\r\nmadeva;092E\r\nmagujarati;0AAE\r\nmagurmukhi;0A2E\r\nmahapakhhebrew;05A4\r\nmahapakhlefthebrew;05A4\r\nmahiragana;307E\r\nmaichattawalowleftthai;F895\r\nmaichattawalowrightthai;F894\r\nmaichattawathai;0E4B\r\nmaichattawaupperleftthai;F893\r\nmaieklowleftthai;F88C\r\nmaieklowrightthai;F88B\r\nmaiekthai;0E48\r\nmaiekupperleftthai;F88A\r\nmaihanakatleftthai;F884\r\nmaihanakatthai;0E31\r\nmaitaikhuleftthai;F889\r\nmaitaikhuthai;0E47\r\nmaitholowleftthai;F88F\r\nmaitholowrightthai;F88E\r\nmaithothai;0E49\r\nmaithoupperleftthai;F88D\r\nmaitrilowleftthai;F892\r\nmaitrilowrightthai;F891\r\nmaitrithai;0E4A\r\nmaitriupperleftthai;F890\r\nmaiyamokthai;0E46\r\nmakatakana;30DE\r\nmakatakanahalfwidth;FF8F\r\nmale;2642\r\nmansyonsquare;3347\r\nmaqafhebrew;05BE\r\nmars;2642\r\nmasoracirclehebrew;05AF\r\nmasquare;3383\r\nmbopomofo;3107\r\nmbsquare;33D4\r\nmcircle;24DC\r\nmcubedsquare;33A5\r\nmdotaccent;1E41\r\nmdotbelow;1E43\r\nmeemarabic;0645\r\nmeemfinalarabic;FEE2\r\nmeeminitialarabic;FEE3\r\nmeemmedialarabic;FEE4\r\nmeemmeeminitialarabic;FCD1\r\nmeemmeemisolatedarabic;FC48\r\nmeetorusquare;334D\r\nmehiragana;3081\r\nmeizierasquare;337E\r\nmekatakana;30E1\r\nmekatakanahalfwidth;FF92\r\nmem;05DE\r\nmemdagesh;FB3E\r\nmemdageshhebrew;FB3E\r\nmemhebrew;05DE\r\nmenarmenian;0574\r\nmerkhahebrew;05A5\r\nmerkhakefulahebrew;05A6\r\nmerkhakefulalefthebrew;05A6\r\nmerkhalefthebrew;05A5\r\nmhook;0271\r\nmhzsquare;3392\r\nmiddledotkatakanahalfwidth;FF65\r\nmiddot;00B7\r\nmieumacirclekorean;3272\r\nmieumaparenkorean;3212\r\nmieumcirclekorean;3264\r\nmieumkorean;3141\r\nmieumpansioskorean;3170\r\nmieumparenkorean;3204\r\nmieumpieupkorean;316E\r\nmieumsioskorean;316F\r\nmihiragana;307F\r\nmikatakana;30DF\r\nmikatakanahalfwidth;FF90\r\nminus;2212\r\nminusbelowcmb;0320\r\nminuscircle;2296\r\nminusmod;02D7\r\nminusplus;2213\r\nminute;2032\r\nmiribaarusquare;334A\r\nmirisquare;3349\r\nmlonglegturned;0270\r\nmlsquare;3396\r\nmmcubedsquare;33A3\r\nmmonospace;FF4D\r\nmmsquaredsquare;339F\r\nmohiragana;3082\r\nmohmsquare;33C1\r\nmokatakana;30E2\r\nmokatakanahalfwidth;FF93\r\nmolsquare;33D6\r\nmomathai;0E21\r\nmoverssquare;33A7\r\nmoverssquaredsquare;33A8\r\nmparen;24A8\r\nmpasquare;33AB\r\nmssquare;33B3\r\nmsuperior;F6EF\r\nmturned;026F\r\nmu;00B5\r\nmu1;00B5\r\nmuasquare;3382\r\nmuchgreater;226B\r\nmuchless;226A\r\nmufsquare;338C\r\nmugreek;03BC\r\nmugsquare;338D\r\nmuhiragana;3080\r\nmukatakana;30E0\r\nmukatakanahalfwidth;FF91\r\nmulsquare;3395\r\nmultiply;00D7\r\nmumsquare;339B\r\nmunahhebrew;05A3\r\nmunahlefthebrew;05A3\r\nmusicalnote;266A\r\nmusicalnotedbl;266B\r\nmusicflatsign;266D\r\nmusicsharpsign;266F\r\nmussquare;33B2\r\nmuvsquare;33B6\r\nmuwsquare;33BC\r\nmvmegasquare;33B9\r\nmvsquare;33B7\r\nmwmegasquare;33BF\r\nmwsquare;33BD\r\nn;006E\r\nnabengali;09A8\r\nnabla;2207\r\nnacute;0144\r\nnadeva;0928\r\nnagujarati;0AA8\r\nnagurmukhi;0A28\r\nnahiragana;306A\r\nnakatakana;30CA\r\nnakatakanahalfwidth;FF85\r\nnapostrophe;0149\r\nnasquare;3381\r\nnbopomofo;310B\r\nnbspace;00A0\r\nncaron;0148\r\nncedilla;0146\r\nncircle;24DD\r\nncircumflexbelow;1E4B\r\nncommaaccent;0146\r\nndotaccent;1E45\r\nndotbelow;1E47\r\nnehiragana;306D\r\nnekatakana;30CD\r\nnekatakanahalfwidth;FF88\r\nnewsheqelsign;20AA\r\nnfsquare;338B\r\nngabengali;0999\r\nngadeva;0919\r\nngagujarati;0A99\r\nngagurmukhi;0A19\r\nngonguthai;0E07\r\nnhiragana;3093\r\nnhookleft;0272\r\nnhookretroflex;0273\r\nnieunacirclekorean;326F\r\nnieunaparenkorean;320F\r\nnieuncieuckorean;3135\r\nnieuncirclekorean;3261\r\nnieunhieuhkorean;3136\r\nnieunkorean;3134\r\nnieunpansioskorean;3168\r\nnieunparenkorean;3201\r\nnieunsioskorean;3167\r\nnieuntikeutkorean;3166\r\nnihiragana;306B\r\nnikatakana;30CB\r\nnikatakanahalfwidth;FF86\r\nnikhahitleftthai;F899\r\nnikhahitthai;0E4D\r\nnine;0039\r\nninearabic;0669\r\nninebengali;09EF\r\nninecircle;2468\r\nninecircleinversesansserif;2792\r\nninedeva;096F\r\nninegujarati;0AEF\r\nninegurmukhi;0A6F\r\nninehackarabic;0669\r\nninehangzhou;3029\r\nnineideographicparen;3228\r\nnineinferior;2089\r\nninemonospace;FF19\r\nnineoldstyle;F739\r\nnineparen;247C\r\nnineperiod;2490\r\nninepersian;06F9\r\nnineroman;2178\r\nninesuperior;2079\r\nnineteencircle;2472\r\nnineteenparen;2486\r\nnineteenperiod;249A\r\nninethai;0E59\r\nnj;01CC\r\nnjecyrillic;045A\r\nnkatakana;30F3\r\nnkatakanahalfwidth;FF9D\r\nnlegrightlong;019E\r\nnlinebelow;1E49\r\nnmonospace;FF4E\r\nnmsquare;339A\r\nnnabengali;09A3\r\nnnadeva;0923\r\nnnagujarati;0AA3\r\nnnagurmukhi;0A23\r\nnnnadeva;0929\r\nnohiragana;306E\r\nnokatakana;30CE\r\nnokatakanahalfwidth;FF89\r\nnonbreakingspace;00A0\r\nnonenthai;0E13\r\nnonuthai;0E19\r\nnoonarabic;0646\r\nnoonfinalarabic;FEE6\r\nnoonghunnaarabic;06BA\r\nnoonghunnafinalarabic;FB9F\r\nnoonhehinitialarabic;FEE7 FEEC\r\nnooninitialarabic;FEE7\r\nnoonjeeminitialarabic;FCD2\r\nnoonjeemisolatedarabic;FC4B\r\nnoonmedialarabic;FEE8\r\nnoonmeeminitialarabic;FCD5\r\nnoonmeemisolatedarabic;FC4E\r\nnoonnoonfinalarabic;FC8D\r\nnotcontains;220C\r\nnotelement;2209\r\nnotelementof;2209\r\nnotequal;2260\r\nnotgreater;226F\r\nnotgreaternorequal;2271\r\nnotgreaternorless;2279\r\nnotidentical;2262\r\nnotless;226E\r\nnotlessnorequal;2270\r\nnotparallel;2226\r\nnotprecedes;2280\r\nnotsubset;2284\r\nnotsucceeds;2281\r\nnotsuperset;2285\r\nnowarmenian;0576\r\nnparen;24A9\r\nnssquare;33B1\r\nnsuperior;207F\r\nntilde;00F1\r\nnu;03BD\r\nnuhiragana;306C\r\nnukatakana;30CC\r\nnukatakanahalfwidth;FF87\r\nnuktabengali;09BC\r\nnuktadeva;093C\r\nnuktagujarati;0ABC\r\nnuktagurmukhi;0A3C\r\nnumbersign;0023\r\nnumbersignmonospace;FF03\r\nnumbersignsmall;FE5F\r\nnumeralsigngreek;0374\r\nnumeralsignlowergreek;0375\r\nnumero;2116\r\nnun;05E0\r\nnundagesh;FB40\r\nnundageshhebrew;FB40\r\nnunhebrew;05E0\r\nnvsquare;33B5\r\nnwsquare;33BB\r\nnyabengali;099E\r\nnyadeva;091E\r\nnyagujarati;0A9E\r\nnyagurmukhi;0A1E\r\no;006F\r\noacute;00F3\r\noangthai;0E2D\r\nobarred;0275\r\nobarredcyrillic;04E9\r\nobarreddieresiscyrillic;04EB\r\nobengali;0993\r\nobopomofo;311B\r\nobreve;014F\r\nocandradeva;0911\r\nocandragujarati;0A91\r\nocandravowelsigndeva;0949\r\nocandravowelsigngujarati;0AC9\r\nocaron;01D2\r\nocircle;24DE\r\nocircumflex;00F4\r\nocircumflexacute;1ED1\r\nocircumflexdotbelow;1ED9\r\nocircumflexgrave;1ED3\r\nocircumflexhookabove;1ED5\r\nocircumflextilde;1ED7\r\nocyrillic;043E\r\nodblacute;0151\r\nodblgrave;020D\r\nodeva;0913\r\nodieresis;00F6\r\nodieresiscyrillic;04E7\r\nodotbelow;1ECD\r\noe;0153\r\noekorean;315A\r\nogonek;02DB\r\nogonekcmb;0328\r\nograve;00F2\r\nogujarati;0A93\r\noharmenian;0585\r\nohiragana;304A\r\nohookabove;1ECF\r\nohorn;01A1\r\nohornacute;1EDB\r\nohorndotbelow;1EE3\r\nohorngrave;1EDD\r\nohornhookabove;1EDF\r\nohorntilde;1EE1\r\nohungarumlaut;0151\r\noi;01A3\r\noinvertedbreve;020F\r\nokatakana;30AA\r\nokatakanahalfwidth;FF75\r\nokorean;3157\r\nolehebrew;05AB\r\nomacron;014D\r\nomacronacute;1E53\r\nomacrongrave;1E51\r\nomdeva;0950\r\nomega;03C9\r\nomega1;03D6\r\nomegacyrillic;0461\r\nomegalatinclosed;0277\r\nomegaroundcyrillic;047B\r\nomegatitlocyrillic;047D\r\nomegatonos;03CE\r\nomgujarati;0AD0\r\nomicron;03BF\r\nomicrontonos;03CC\r\nomonospace;FF4F\r\none;0031\r\nonearabic;0661\r\nonebengali;09E7\r\nonecircle;2460\r\nonecircleinversesansserif;278A\r\nonedeva;0967\r\nonedotenleader;2024\r\noneeighth;215B\r\nonefitted;F6DC\r\nonegujarati;0AE7\r\nonegurmukhi;0A67\r\nonehackarabic;0661\r\nonehalf;00BD\r\nonehangzhou;3021\r\noneideographicparen;3220\r\noneinferior;2081\r\nonemonospace;FF11\r\nonenumeratorbengali;09F4\r\noneoldstyle;F731\r\noneparen;2474\r\noneperiod;2488\r\nonepersian;06F1\r\nonequarter;00BC\r\noneroman;2170\r\nonesuperior;00B9\r\nonethai;0E51\r\nonethird;2153\r\noogonek;01EB\r\noogonekmacron;01ED\r\noogurmukhi;0A13\r\noomatragurmukhi;0A4B\r\noopen;0254\r\noparen;24AA\r\nopenbullet;25E6\r\noption;2325\r\nordfeminine;00AA\r\nordmasculine;00BA\r\northogonal;221F\r\noshortdeva;0912\r\noshortvowelsigndeva;094A\r\noslash;00F8\r\noslashacute;01FF\r\nosmallhiragana;3049\r\nosmallkatakana;30A9\r\nosmallkatakanahalfwidth;FF6B\r\nostrokeacute;01FF\r\nosuperior;F6F0\r\notcyrillic;047F\r\notilde;00F5\r\notildeacute;1E4D\r\notildedieresis;1E4F\r\noubopomofo;3121\r\noverline;203E\r\noverlinecenterline;FE4A\r\noverlinecmb;0305\r\noverlinedashed;FE49\r\noverlinedblwavy;FE4C\r\noverlinewavy;FE4B\r\noverscore;00AF\r\novowelsignbengali;09CB\r\novowelsigndeva;094B\r\novowelsigngujarati;0ACB\r\np;0070\r\npaampssquare;3380\r\npaasentosquare;332B\r\npabengali;09AA\r\npacute;1E55\r\npadeva;092A\r\npagedown;21DF\r\npageup;21DE\r\npagujarati;0AAA\r\npagurmukhi;0A2A\r\npahiragana;3071\r\npaiyannoithai;0E2F\r\npakatakana;30D1\r\npalatalizationcyrilliccmb;0484\r\npalochkacyrillic;04C0\r\npansioskorean;317F\r\nparagraph;00B6\r\nparallel;2225\r\nparenleft;0028\r\nparenleftaltonearabic;FD3E\r\nparenleftbt;F8ED\r\nparenleftex;F8EC\r\nparenleftinferior;208D\r\nparenleftmonospace;FF08\r\nparenleftsmall;FE59\r\nparenleftsuperior;207D\r\nparenlefttp;F8EB\r\nparenleftvertical;FE35\r\nparenright;0029\r\nparenrightaltonearabic;FD3F\r\nparenrightbt;F8F8\r\nparenrightex;F8F7\r\nparenrightinferior;208E\r\nparenrightmonospace;FF09\r\nparenrightsmall;FE5A\r\nparenrightsuperior;207E\r\nparenrighttp;F8F6\r\nparenrightvertical;FE36\r\npartialdiff;2202\r\npaseqhebrew;05C0\r\npashtahebrew;0599\r\npasquare;33A9\r\npatah;05B7\r\npatah11;05B7\r\npatah1d;05B7\r\npatah2a;05B7\r\npatahhebrew;05B7\r\npatahnarrowhebrew;05B7\r\npatahquarterhebrew;05B7\r\npatahwidehebrew;05B7\r\npazerhebrew;05A1\r\npbopomofo;3106\r\npcircle;24DF\r\npdotaccent;1E57\r\npe;05E4\r\npecyrillic;043F\r\npedagesh;FB44\r\npedageshhebrew;FB44\r\npeezisquare;333B\r\npefinaldageshhebrew;FB43\r\npeharabic;067E\r\npeharmenian;057A\r\npehebrew;05E4\r\npehfinalarabic;FB57\r\npehinitialarabic;FB58\r\npehiragana;307A\r\npehmedialarabic;FB59\r\npekatakana;30DA\r\npemiddlehookcyrillic;04A7\r\nperafehebrew;FB4E\r\npercent;0025\r\npercentarabic;066A\r\npercentmonospace;FF05\r\npercentsmall;FE6A\r\nperiod;002E\r\nperiodarmenian;0589\r\nperiodcentered;00B7\r\nperiodhalfwidth;FF61\r\nperiodinferior;F6E7\r\nperiodmonospace;FF0E\r\nperiodsmall;FE52\r\nperiodsuperior;F6E8\r\nperispomenigreekcmb;0342\r\nperpendicular;22A5\r\nperthousand;2030\r\npeseta;20A7\r\npfsquare;338A\r\nphabengali;09AB\r\nphadeva;092B\r\nphagujarati;0AAB\r\nphagurmukhi;0A2B\r\nphi;03C6\r\nphi1;03D5\r\nphieuphacirclekorean;327A\r\nphieuphaparenkorean;321A\r\nphieuphcirclekorean;326C\r\nphieuphkorean;314D\r\nphieuphparenkorean;320C\r\nphilatin;0278\r\nphinthuthai;0E3A\r\nphisymbolgreek;03D5\r\nphook;01A5\r\nphophanthai;0E1E\r\nphophungthai;0E1C\r\nphosamphaothai;0E20\r\npi;03C0\r\npieupacirclekorean;3273\r\npieupaparenkorean;3213\r\npieupcieuckorean;3176\r\npieupcirclekorean;3265\r\npieupkiyeokkorean;3172\r\npieupkorean;3142\r\npieupparenkorean;3205\r\npieupsioskiyeokkorean;3174\r\npieupsioskorean;3144\r\npieupsiostikeutkorean;3175\r\npieupthieuthkorean;3177\r\npieuptikeutkorean;3173\r\npihiragana;3074\r\npikatakana;30D4\r\npisymbolgreek;03D6\r\npiwrarmenian;0583\r\nplus;002B\r\nplusbelowcmb;031F\r\npluscircle;2295\r\nplusminus;00B1\r\nplusmod;02D6\r\nplusmonospace;FF0B\r\nplussmall;FE62\r\nplussuperior;207A\r\npmonospace;FF50\r\npmsquare;33D8\r\npohiragana;307D\r\npointingindexdownwhite;261F\r\npointingindexleftwhite;261C\r\npointingindexrightwhite;261E\r\npointingindexupwhite;261D\r\npokatakana;30DD\r\npoplathai;0E1B\r\npostalmark;3012\r\npostalmarkface;3020\r\npparen;24AB\r\nprecedes;227A\r\nprescription;211E\r\nprimemod;02B9\r\nprimereversed;2035\r\nproduct;220F\r\nprojective;2305\r\nprolongedkana;30FC\r\npropellor;2318\r\npropersubset;2282\r\npropersuperset;2283\r\nproportion;2237\r\nproportional;221D\r\npsi;03C8\r\npsicyrillic;0471\r\npsilipneumatacyrilliccmb;0486\r\npssquare;33B0\r\npuhiragana;3077\r\npukatakana;30D7\r\npvsquare;33B4\r\npwsquare;33BA\r\nq;0071\r\nqadeva;0958\r\nqadmahebrew;05A8\r\nqafarabic;0642\r\nqaffinalarabic;FED6\r\nqafinitialarabic;FED7\r\nqafmedialarabic;FED8\r\nqamats;05B8\r\nqamats10;05B8\r\nqamats1a;05B8\r\nqamats1c;05B8\r\nqamats27;05B8\r\nqamats29;05B8\r\nqamats33;05B8\r\nqamatsde;05B8\r\nqamatshebrew;05B8\r\nqamatsnarrowhebrew;05B8\r\nqamatsqatanhebrew;05B8\r\nqamatsqatannarrowhebrew;05B8\r\nqamatsqatanquarterhebrew;05B8\r\nqamatsqatanwidehebrew;05B8\r\nqamatsquarterhebrew;05B8\r\nqamatswidehebrew;05B8\r\nqarneyparahebrew;059F\r\nqbopomofo;3111\r\nqcircle;24E0\r\nqhook;02A0\r\nqmonospace;FF51\r\nqof;05E7\r\nqofdagesh;FB47\r\nqofdageshhebrew;FB47\r\nqofhatafpatah;05E7 05B2\r\nqofhatafpatahhebrew;05E7 05B2\r\nqofhatafsegol;05E7 05B1\r\nqofhatafsegolhebrew;05E7 05B1\r\nqofhebrew;05E7\r\nqofhiriq;05E7 05B4\r\nqofhiriqhebrew;05E7 05B4\r\nqofholam;05E7 05B9\r\nqofholamhebrew;05E7 05B9\r\nqofpatah;05E7 05B7\r\nqofpatahhebrew;05E7 05B7\r\nqofqamats;05E7 05B8\r\nqofqamatshebrew;05E7 05B8\r\nqofqubuts;05E7 05BB\r\nqofqubutshebrew;05E7 05BB\r\nqofsegol;05E7 05B6\r\nqofsegolhebrew;05E7 05B6\r\nqofsheva;05E7 05B0\r\nqofshevahebrew;05E7 05B0\r\nqoftsere;05E7 05B5\r\nqoftserehebrew;05E7 05B5\r\nqparen;24AC\r\nquarternote;2669\r\nqubuts;05BB\r\nqubuts18;05BB\r\nqubuts25;05BB\r\nqubuts31;05BB\r\nqubutshebrew;05BB\r\nqubutsnarrowhebrew;05BB\r\nqubutsquarterhebrew;05BB\r\nqubutswidehebrew;05BB\r\nquestion;003F\r\nquestionarabic;061F\r\nquestionarmenian;055E\r\nquestiondown;00BF\r\nquestiondownsmall;F7BF\r\nquestiongreek;037E\r\nquestionmonospace;FF1F\r\nquestionsmall;F73F\r\nquotedbl;0022\r\nquotedblbase;201E\r\nquotedblleft;201C\r\nquotedblmonospace;FF02\r\nquotedblprime;301E\r\nquotedblprimereversed;301D\r\nquotedblright;201D\r\nquoteleft;2018\r\nquoteleftreversed;201B\r\nquotereversed;201B\r\nquoteright;2019\r\nquoterightn;0149\r\nquotesinglbase;201A\r\nquotesingle;0027\r\nquotesinglemonospace;FF07\r\nr;0072\r\nraarmenian;057C\r\nrabengali;09B0\r\nracute;0155\r\nradeva;0930\r\nradical;221A\r\nradicalex;F8E5\r\nradoverssquare;33AE\r\nradoverssquaredsquare;33AF\r\nradsquare;33AD\r\nrafe;05BF\r\nrafehebrew;05BF\r\nragujarati;0AB0\r\nragurmukhi;0A30\r\nrahiragana;3089\r\nrakatakana;30E9\r\nrakatakanahalfwidth;FF97\r\nralowerdiagonalbengali;09F1\r\nramiddlediagonalbengali;09F0\r\nramshorn;0264\r\nratio;2236\r\nrbopomofo;3116\r\nrcaron;0159\r\nrcedilla;0157\r\nrcircle;24E1\r\nrcommaaccent;0157\r\nrdblgrave;0211\r\nrdotaccent;1E59\r\nrdotbelow;1E5B\r\nrdotbelowmacron;1E5D\r\nreferencemark;203B\r\nreflexsubset;2286\r\nreflexsuperset;2287\r\nregistered;00AE\r\nregistersans;F8E8\r\nregisterserif;F6DA\r\nreharabic;0631\r\nreharmenian;0580\r\nrehfinalarabic;FEAE\r\nrehiragana;308C\r\nrehyehaleflamarabic;0631 FEF3 FE8E 0644\r\nrekatakana;30EC\r\nrekatakanahalfwidth;FF9A\r\nresh;05E8\r\nreshdageshhebrew;FB48\r\nreshhatafpatah;05E8 05B2\r\nreshhatafpatahhebrew;05E8 05B2\r\nreshhatafsegol;05E8 05B1\r\nreshhatafsegolhebrew;05E8 05B1\r\nreshhebrew;05E8\r\nreshhiriq;05E8 05B4\r\nreshhiriqhebrew;05E8 05B4\r\nreshholam;05E8 05B9\r\nreshholamhebrew;05E8 05B9\r\nreshpatah;05E8 05B7\r\nreshpatahhebrew;05E8 05B7\r\nreshqamats;05E8 05B8\r\nreshqamatshebrew;05E8 05B8\r\nreshqubuts;05E8 05BB\r\nreshqubutshebrew;05E8 05BB\r\nreshsegol;05E8 05B6\r\nreshsegolhebrew;05E8 05B6\r\nreshsheva;05E8 05B0\r\nreshshevahebrew;05E8 05B0\r\nreshtsere;05E8 05B5\r\nreshtserehebrew;05E8 05B5\r\nreversedtilde;223D\r\nreviahebrew;0597\r\nreviamugrashhebrew;0597\r\nrevlogicalnot;2310\r\nrfishhook;027E\r\nrfishhookreversed;027F\r\nrhabengali;09DD\r\nrhadeva;095D\r\nrho;03C1\r\nrhook;027D\r\nrhookturned;027B\r\nrhookturnedsuperior;02B5\r\nrhosymbolgreek;03F1\r\nrhotichookmod;02DE\r\nrieulacirclekorean;3271\r\nrieulaparenkorean;3211\r\nrieulcirclekorean;3263\r\nrieulhieuhkorean;3140\r\nrieulkiyeokkorean;313A\r\nrieulkiyeoksioskorean;3169\r\nrieulkorean;3139\r\nrieulmieumkorean;313B\r\nrieulpansioskorean;316C\r\nrieulparenkorean;3203\r\nrieulphieuphkorean;313F\r\nrieulpieupkorean;313C\r\nrieulpieupsioskorean;316B\r\nrieulsioskorean;313D\r\nrieulthieuthkorean;313E\r\nrieultikeutkorean;316A\r\nrieulyeorinhieuhkorean;316D\r\nrightangle;221F\r\nrighttackbelowcmb;0319\r\nrighttriangle;22BF\r\nrihiragana;308A\r\nrikatakana;30EA\r\nrikatakanahalfwidth;FF98\r\nring;02DA\r\nringbelowcmb;0325\r\nringcmb;030A\r\nringhalfleft;02BF\r\nringhalfleftarmenian;0559\r\nringhalfleftbelowcmb;031C\r\nringhalfleftcentered;02D3\r\nringhalfright;02BE\r\nringhalfrightbelowcmb;0339\r\nringhalfrightcentered;02D2\r\nrinvertedbreve;0213\r\nrittorusquare;3351\r\nrlinebelow;1E5F\r\nrlongleg;027C\r\nrlonglegturned;027A\r\nrmonospace;FF52\r\nrohiragana;308D\r\nrokatakana;30ED\r\nrokatakanahalfwidth;FF9B\r\nroruathai;0E23\r\nrparen;24AD\r\nrrabengali;09DC\r\nrradeva;0931\r\nrragurmukhi;0A5C\r\nrreharabic;0691\r\nrrehfinalarabic;FB8D\r\nrrvocalicbengali;09E0\r\nrrvocalicdeva;0960\r\nrrvocalicgujarati;0AE0\r\nrrvocalicvowelsignbengali;09C4\r\nrrvocalicvowelsigndeva;0944\r\nrrvocalicvowelsigngujarati;0AC4\r\nrsuperior;F6F1\r\nrtblock;2590\r\nrturned;0279\r\nrturnedsuperior;02B4\r\nruhiragana;308B\r\nrukatakana;30EB\r\nrukatakanahalfwidth;FF99\r\nrupeemarkbengali;09F2\r\nrupeesignbengali;09F3\r\nrupiah;F6DD\r\nruthai;0E24\r\nrvocalicbengali;098B\r\nrvocalicdeva;090B\r\nrvocalicgujarati;0A8B\r\nrvocalicvowelsignbengali;09C3\r\nrvocalicvowelsigndeva;0943\r\nrvocalicvowelsigngujarati;0AC3\r\ns;0073\r\nsabengali;09B8\r\nsacute;015B\r\nsacutedotaccent;1E65\r\nsadarabic;0635\r\nsadeva;0938\r\nsadfinalarabic;FEBA\r\nsadinitialarabic;FEBB\r\nsadmedialarabic;FEBC\r\nsagujarati;0AB8\r\nsagurmukhi;0A38\r\nsahiragana;3055\r\nsakatakana;30B5\r\nsakatakanahalfwidth;FF7B\r\nsallallahoualayhewasallamarabic;FDFA\r\nsamekh;05E1\r\nsamekhdagesh;FB41\r\nsamekhdageshhebrew;FB41\r\nsamekhhebrew;05E1\r\nsaraaathai;0E32\r\nsaraaethai;0E41\r\nsaraaimaimalaithai;0E44\r\nsaraaimaimuanthai;0E43\r\nsaraamthai;0E33\r\nsaraathai;0E30\r\nsaraethai;0E40\r\nsaraiileftthai;F886\r\nsaraiithai;0E35\r\nsaraileftthai;F885\r\nsaraithai;0E34\r\nsaraothai;0E42\r\nsaraueeleftthai;F888\r\nsaraueethai;0E37\r\nsaraueleftthai;F887\r\nsarauethai;0E36\r\nsarauthai;0E38\r\nsarauuthai;0E39\r\nsbopomofo;3119\r\nscaron;0161\r\nscarondotaccent;1E67\r\nscedilla;015F\r\nschwa;0259\r\nschwacyrillic;04D9\r\nschwadieresiscyrillic;04DB\r\nschwahook;025A\r\nscircle;24E2\r\nscircumflex;015D\r\nscommaaccent;0219\r\nsdotaccent;1E61\r\nsdotbelow;1E63\r\nsdotbelowdotaccent;1E69\r\nseagullbelowcmb;033C\r\nsecond;2033\r\nsecondtonechinese;02CA\r\nsection;00A7\r\nseenarabic;0633\r\nseenfinalarabic;FEB2\r\nseeninitialarabic;FEB3\r\nseenmedialarabic;FEB4\r\nsegol;05B6\r\nsegol13;05B6\r\nsegol1f;05B6\r\nsegol2c;05B6\r\nsegolhebrew;05B6\r\nsegolnarrowhebrew;05B6\r\nsegolquarterhebrew;05B6\r\nsegoltahebrew;0592\r\nsegolwidehebrew;05B6\r\nseharmenian;057D\r\nsehiragana;305B\r\nsekatakana;30BB\r\nsekatakanahalfwidth;FF7E\r\nsemicolon;003B\r\nsemicolonarabic;061B\r\nsemicolonmonospace;FF1B\r\nsemicolonsmall;FE54\r\nsemivoicedmarkkana;309C\r\nsemivoicedmarkkanahalfwidth;FF9F\r\nsentisquare;3322\r\nsentosquare;3323\r\nseven;0037\r\nsevenarabic;0667\r\nsevenbengali;09ED\r\nsevencircle;2466\r\nsevencircleinversesansserif;2790\r\nsevendeva;096D\r\nseveneighths;215E\r\nsevengujarati;0AED\r\nsevengurmukhi;0A6D\r\nsevenhackarabic;0667\r\nsevenhangzhou;3027\r\nsevenideographicparen;3226\r\nseveninferior;2087\r\nsevenmonospace;FF17\r\nsevenoldstyle;F737\r\nsevenparen;247A\r\nsevenperiod;248E\r\nsevenpersian;06F7\r\nsevenroman;2176\r\nsevensuperior;2077\r\nseventeencircle;2470\r\nseventeenparen;2484\r\nseventeenperiod;2498\r\nseventhai;0E57\r\nsfthyphen;00AD\r\nshaarmenian;0577\r\nshabengali;09B6\r\nshacyrillic;0448\r\nshaddaarabic;0651\r\nshaddadammaarabic;FC61\r\nshaddadammatanarabic;FC5E\r\nshaddafathaarabic;FC60\r\nshaddafathatanarabic;0651 064B\r\nshaddakasraarabic;FC62\r\nshaddakasratanarabic;FC5F\r\nshade;2592\r\nshadedark;2593\r\nshadelight;2591\r\nshademedium;2592\r\nshadeva;0936\r\nshagujarati;0AB6\r\nshagurmukhi;0A36\r\nshalshelethebrew;0593\r\nshbopomofo;3115\r\nshchacyrillic;0449\r\nsheenarabic;0634\r\nsheenfinalarabic;FEB6\r\nsheeninitialarabic;FEB7\r\nsheenmedialarabic;FEB8\r\nsheicoptic;03E3\r\nsheqel;20AA\r\nsheqelhebrew;20AA\r\nsheva;05B0\r\nsheva115;05B0\r\nsheva15;05B0\r\nsheva22;05B0\r\nsheva2e;05B0\r\nshevahebrew;05B0\r\nshevanarrowhebrew;05B0\r\nshevaquarterhebrew;05B0\r\nshevawidehebrew;05B0\r\nshhacyrillic;04BB\r\nshimacoptic;03ED\r\nshin;05E9\r\nshindagesh;FB49\r\nshindageshhebrew;FB49\r\nshindageshshindot;FB2C\r\nshindageshshindothebrew;FB2C\r\nshindageshsindot;FB2D\r\nshindageshsindothebrew;FB2D\r\nshindothebrew;05C1\r\nshinhebrew;05E9\r\nshinshindot;FB2A\r\nshinshindothebrew;FB2A\r\nshinsindot;FB2B\r\nshinsindothebrew;FB2B\r\nshook;0282\r\nsigma;03C3\r\nsigma1;03C2\r\nsigmafinal;03C2\r\nsigmalunatesymbolgreek;03F2\r\nsihiragana;3057\r\nsikatakana;30B7\r\nsikatakanahalfwidth;FF7C\r\nsiluqhebrew;05BD\r\nsiluqlefthebrew;05BD\r\nsimilar;223C\r\nsindothebrew;05C2\r\nsiosacirclekorean;3274\r\nsiosaparenkorean;3214\r\nsioscieuckorean;317E\r\nsioscirclekorean;3266\r\nsioskiyeokkorean;317A\r\nsioskorean;3145\r\nsiosnieunkorean;317B\r\nsiosparenkorean;3206\r\nsiospieupkorean;317D\r\nsiostikeutkorean;317C\r\nsix;0036\r\nsixarabic;0666\r\nsixbengali;09EC\r\nsixcircle;2465\r\nsixcircleinversesansserif;278F\r\nsixdeva;096C\r\nsixgujarati;0AEC\r\nsixgurmukhi;0A6C\r\nsixhackarabic;0666\r\nsixhangzhou;3026\r\nsixideographicparen;3225\r\nsixinferior;2086\r\nsixmonospace;FF16\r\nsixoldstyle;F736\r\nsixparen;2479\r\nsixperiod;248D\r\nsixpersian;06F6\r\nsixroman;2175\r\nsixsuperior;2076\r\nsixteencircle;246F\r\nsixteencurrencydenominatorbengali;09F9\r\nsixteenparen;2483\r\nsixteenperiod;2497\r\nsixthai;0E56\r\nslash;002F\r\nslashmonospace;FF0F\r\nslong;017F\r\nslongdotaccent;1E9B\r\nsmileface;263A\r\nsmonospace;FF53\r\nsofpasuqhebrew;05C3\r\nsofthyphen;00AD\r\nsoftsigncyrillic;044C\r\nsohiragana;305D\r\nsokatakana;30BD\r\nsokatakanahalfwidth;FF7F\r\nsoliduslongoverlaycmb;0338\r\nsolidusshortoverlaycmb;0337\r\nsorusithai;0E29\r\nsosalathai;0E28\r\nsosothai;0E0B\r\nsosuathai;0E2A\r\nspace;0020\r\nspacehackarabic;0020\r\nspade;2660\r\nspadesuitblack;2660\r\nspadesuitwhite;2664\r\nsparen;24AE\r\nsquarebelowcmb;033B\r\nsquarecc;33C4\r\nsquarecm;339D\r\nsquarediagonalcrosshatchfill;25A9\r\nsquarehorizontalfill;25A4\r\nsquarekg;338F\r\nsquarekm;339E\r\nsquarekmcapital;33CE\r\nsquareln;33D1\r\nsquarelog;33D2\r\nsquaremg;338E\r\nsquaremil;33D5\r\nsquaremm;339C\r\nsquaremsquared;33A1\r\nsquareorthogonalcrosshatchfill;25A6\r\nsquareupperlefttolowerrightfill;25A7\r\nsquareupperrighttolowerleftfill;25A8\r\nsquareverticalfill;25A5\r\nsquarewhitewithsmallblack;25A3\r\nsrsquare;33DB\r\nssabengali;09B7\r\nssadeva;0937\r\nssagujarati;0AB7\r\nssangcieuckorean;3149\r\nssanghieuhkorean;3185\r\nssangieungkorean;3180\r\nssangkiyeokkorean;3132\r\nssangnieunkorean;3165\r\nssangpieupkorean;3143\r\nssangsioskorean;3146\r\nssangtikeutkorean;3138\r\nssuperior;F6F2\r\nsterling;00A3\r\nsterlingmonospace;FFE1\r\nstrokelongoverlaycmb;0336\r\nstrokeshortoverlaycmb;0335\r\nsubset;2282\r\nsubsetnotequal;228A\r\nsubsetorequal;2286\r\nsucceeds;227B\r\nsuchthat;220B\r\nsuhiragana;3059\r\nsukatakana;30B9\r\nsukatakanahalfwidth;FF7D\r\nsukunarabic;0652\r\nsummation;2211\r\nsun;263C\r\nsuperset;2283\r\nsupersetnotequal;228B\r\nsupersetorequal;2287\r\nsvsquare;33DC\r\nsyouwaerasquare;337C\r\nt;0074\r\ntabengali;09A4\r\ntackdown;22A4\r\ntackleft;22A3\r\ntadeva;0924\r\ntagujarati;0AA4\r\ntagurmukhi;0A24\r\ntaharabic;0637\r\ntahfinalarabic;FEC2\r\ntahinitialarabic;FEC3\r\ntahiragana;305F\r\ntahmedialarabic;FEC4\r\ntaisyouerasquare;337D\r\ntakatakana;30BF\r\ntakatakanahalfwidth;FF80\r\ntatweelarabic;0640\r\ntau;03C4\r\ntav;05EA\r\ntavdages;FB4A\r\ntavdagesh;FB4A\r\ntavdageshhebrew;FB4A\r\ntavhebrew;05EA\r\ntbar;0167\r\ntbopomofo;310A\r\ntcaron;0165\r\ntccurl;02A8\r\ntcedilla;0163\r\ntcheharabic;0686\r\ntchehfinalarabic;FB7B\r\ntchehinitialarabic;FB7C\r\ntchehmedialarabic;FB7D\r\ntchehmeeminitialarabic;FB7C FEE4\r\ntcircle;24E3\r\ntcircumflexbelow;1E71\r\ntcommaaccent;0163\r\ntdieresis;1E97\r\ntdotaccent;1E6B\r\ntdotbelow;1E6D\r\ntecyrillic;0442\r\ntedescendercyrillic;04AD\r\nteharabic;062A\r\ntehfinalarabic;FE96\r\ntehhahinitialarabic;FCA2\r\ntehhahisolatedarabic;FC0C\r\ntehinitialarabic;FE97\r\ntehiragana;3066\r\ntehjeeminitialarabic;FCA1\r\ntehjeemisolatedarabic;FC0B\r\ntehmarbutaarabic;0629\r\ntehmarbutafinalarabic;FE94\r\ntehmedialarabic;FE98\r\ntehmeeminitialarabic;FCA4\r\ntehmeemisolatedarabic;FC0E\r\ntehnoonfinalarabic;FC73\r\ntekatakana;30C6\r\ntekatakanahalfwidth;FF83\r\ntelephone;2121\r\ntelephoneblack;260E\r\ntelishagedolahebrew;05A0\r\ntelishaqetanahebrew;05A9\r\ntencircle;2469\r\ntenideographicparen;3229\r\ntenparen;247D\r\ntenperiod;2491\r\ntenroman;2179\r\ntesh;02A7\r\ntet;05D8\r\ntetdagesh;FB38\r\ntetdageshhebrew;FB38\r\ntethebrew;05D8\r\ntetsecyrillic;04B5\r\ntevirhebrew;059B\r\ntevirlefthebrew;059B\r\nthabengali;09A5\r\nthadeva;0925\r\nthagujarati;0AA5\r\nthagurmukhi;0A25\r\nthalarabic;0630\r\nthalfinalarabic;FEAC\r\nthanthakhatlowleftthai;F898\r\nthanthakhatlowrightthai;F897\r\nthanthakhatthai;0E4C\r\nthanthakhatupperleftthai;F896\r\ntheharabic;062B\r\nthehfinalarabic;FE9A\r\nthehinitialarabic;FE9B\r\nthehmedialarabic;FE9C\r\nthereexists;2203\r\ntherefore;2234\r\ntheta;03B8\r\ntheta1;03D1\r\nthetasymbolgreek;03D1\r\nthieuthacirclekorean;3279\r\nthieuthaparenkorean;3219\r\nthieuthcirclekorean;326B\r\nthieuthkorean;314C\r\nthieuthparenkorean;320B\r\nthirteencircle;246C\r\nthirteenparen;2480\r\nthirteenperiod;2494\r\nthonangmonthothai;0E11\r\nthook;01AD\r\nthophuthaothai;0E12\r\nthorn;00FE\r\nthothahanthai;0E17\r\nthothanthai;0E10\r\nthothongthai;0E18\r\nthothungthai;0E16\r\nthousandcyrillic;0482\r\nthousandsseparatorarabic;066C\r\nthousandsseparatorpersian;066C\r\nthree;0033\r\nthreearabic;0663\r\nthreebengali;09E9\r\nthreecircle;2462\r\nthreecircleinversesansserif;278C\r\nthreedeva;0969\r\nthreeeighths;215C\r\nthreegujarati;0AE9\r\nthreegurmukhi;0A69\r\nthreehackarabic;0663\r\nthreehangzhou;3023\r\nthreeideographicparen;3222\r\nthreeinferior;2083\r\nthreemonospace;FF13\r\nthreenumeratorbengali;09F6\r\nthreeoldstyle;F733\r\nthreeparen;2476\r\nthreeperiod;248A\r\nthreepersian;06F3\r\nthreequarters;00BE\r\nthreequartersemdash;F6DE\r\nthreeroman;2172\r\nthreesuperior;00B3\r\nthreethai;0E53\r\nthzsquare;3394\r\ntihiragana;3061\r\ntikatakana;30C1\r\ntikatakanahalfwidth;FF81\r\ntikeutacirclekorean;3270\r\ntikeutaparenkorean;3210\r\ntikeutcirclekorean;3262\r\ntikeutkorean;3137\r\ntikeutparenkorean;3202\r\ntilde;02DC\r\ntildebelowcmb;0330\r\ntildecmb;0303\r\ntildecomb;0303\r\ntildedoublecmb;0360\r\ntildeoperator;223C\r\ntildeoverlaycmb;0334\r\ntildeverticalcmb;033E\r\ntimescircle;2297\r\ntipehahebrew;0596\r\ntipehalefthebrew;0596\r\ntippigurmukhi;0A70\r\ntitlocyrilliccmb;0483\r\ntiwnarmenian;057F\r\ntlinebelow;1E6F\r\ntmonospace;FF54\r\ntoarmenian;0569\r\ntohiragana;3068\r\ntokatakana;30C8\r\ntokatakanahalfwidth;FF84\r\ntonebarextrahighmod;02E5\r\ntonebarextralowmod;02E9\r\ntonebarhighmod;02E6\r\ntonebarlowmod;02E8\r\ntonebarmidmod;02E7\r\ntonefive;01BD\r\ntonesix;0185\r\ntonetwo;01A8\r\ntonos;0384\r\ntonsquare;3327\r\ntopatakthai;0E0F\r\ntortoiseshellbracketleft;3014\r\ntortoiseshellbracketleftsmall;FE5D\r\ntortoiseshellbracketleftvertical;FE39\r\ntortoiseshellbracketright;3015\r\ntortoiseshellbracketrightsmall;FE5E\r\ntortoiseshellbracketrightvertical;FE3A\r\ntotaothai;0E15\r\ntpalatalhook;01AB\r\ntparen;24AF\r\ntrademark;2122\r\ntrademarksans;F8EA\r\ntrademarkserif;F6DB\r\ntretroflexhook;0288\r\ntriagdn;25BC\r\ntriaglf;25C4\r\ntriagrt;25BA\r\ntriagup;25B2\r\nts;02A6\r\ntsadi;05E6\r\ntsadidagesh;FB46\r\ntsadidageshhebrew;FB46\r\ntsadihebrew;05E6\r\ntsecyrillic;0446\r\ntsere;05B5\r\ntsere12;05B5\r\ntsere1e;05B5\r\ntsere2b;05B5\r\ntserehebrew;05B5\r\ntserenarrowhebrew;05B5\r\ntserequarterhebrew;05B5\r\ntserewidehebrew;05B5\r\ntshecyrillic;045B\r\ntsuperior;F6F3\r\nttabengali;099F\r\nttadeva;091F\r\nttagujarati;0A9F\r\nttagurmukhi;0A1F\r\ntteharabic;0679\r\nttehfinalarabic;FB67\r\nttehinitialarabic;FB68\r\nttehmedialarabic;FB69\r\ntthabengali;09A0\r\ntthadeva;0920\r\ntthagujarati;0AA0\r\ntthagurmukhi;0A20\r\ntturned;0287\r\ntuhiragana;3064\r\ntukatakana;30C4\r\ntukatakanahalfwidth;FF82\r\ntusmallhiragana;3063\r\ntusmallkatakana;30C3\r\ntusmallkatakanahalfwidth;FF6F\r\ntwelvecircle;246B\r\ntwelveparen;247F\r\ntwelveperiod;2493\r\ntwelveroman;217B\r\ntwentycircle;2473\r\ntwentyhangzhou;5344\r\ntwentyparen;2487\r\ntwentyperiod;249B\r\ntwo;0032\r\ntwoarabic;0662\r\ntwobengali;09E8\r\ntwocircle;2461\r\ntwocircleinversesansserif;278B\r\ntwodeva;0968\r\ntwodotenleader;2025\r\ntwodotleader;2025\r\ntwodotleadervertical;FE30\r\ntwogujarati;0AE8\r\ntwogurmukhi;0A68\r\ntwohackarabic;0662\r\ntwohangzhou;3022\r\ntwoideographicparen;3221\r\ntwoinferior;2082\r\ntwomonospace;FF12\r\ntwonumeratorbengali;09F5\r\ntwooldstyle;F732\r\ntwoparen;2475\r\ntwoperiod;2489\r\ntwopersian;06F2\r\ntworoman;2171\r\ntwostroke;01BB\r\ntwosuperior;00B2\r\ntwothai;0E52\r\ntwothirds;2154\r\nu;0075\r\nuacute;00FA\r\nubar;0289\r\nubengali;0989\r\nubopomofo;3128\r\nubreve;016D\r\nucaron;01D4\r\nucircle;24E4\r\nucircumflex;00FB\r\nucircumflexbelow;1E77\r\nucyrillic;0443\r\nudattadeva;0951\r\nudblacute;0171\r\nudblgrave;0215\r\nudeva;0909\r\nudieresis;00FC\r\nudieresisacute;01D8\r\nudieresisbelow;1E73\r\nudieresiscaron;01DA\r\nudieresiscyrillic;04F1\r\nudieresisgrave;01DC\r\nudieresismacron;01D6\r\nudotbelow;1EE5\r\nugrave;00F9\r\nugujarati;0A89\r\nugurmukhi;0A09\r\nuhiragana;3046\r\nuhookabove;1EE7\r\nuhorn;01B0\r\nuhornacute;1EE9\r\nuhorndotbelow;1EF1\r\nuhorngrave;1EEB\r\nuhornhookabove;1EED\r\nuhorntilde;1EEF\r\nuhungarumlaut;0171\r\nuhungarumlautcyrillic;04F3\r\nuinvertedbreve;0217\r\nukatakana;30A6\r\nukatakanahalfwidth;FF73\r\nukcyrillic;0479\r\nukorean;315C\r\numacron;016B\r\numacroncyrillic;04EF\r\numacrondieresis;1E7B\r\numatragurmukhi;0A41\r\numonospace;FF55\r\nunderscore;005F\r\nunderscoredbl;2017\r\nunderscoremonospace;FF3F\r\nunderscorevertical;FE33\r\nunderscorewavy;FE4F\r\nunion;222A\r\nuniversal;2200\r\nuogonek;0173\r\nuparen;24B0\r\nupblock;2580\r\nupperdothebrew;05C4\r\nupsilon;03C5\r\nupsilondieresis;03CB\r\nupsilondieresistonos;03B0\r\nupsilonlatin;028A\r\nupsilontonos;03CD\r\nuptackbelowcmb;031D\r\nuptackmod;02D4\r\nuragurmukhi;0A73\r\nuring;016F\r\nushortcyrillic;045E\r\nusmallhiragana;3045\r\nusmallkatakana;30A5\r\nusmallkatakanahalfwidth;FF69\r\nustraightcyrillic;04AF\r\nustraightstrokecyrillic;04B1\r\nutilde;0169\r\nutildeacute;1E79\r\nutildebelow;1E75\r\nuubengali;098A\r\nuudeva;090A\r\nuugujarati;0A8A\r\nuugurmukhi;0A0A\r\nuumatragurmukhi;0A42\r\nuuvowelsignbengali;09C2\r\nuuvowelsigndeva;0942\r\nuuvowelsigngujarati;0AC2\r\nuvowelsignbengali;09C1\r\nuvowelsigndeva;0941\r\nuvowelsigngujarati;0AC1\r\nv;0076\r\nvadeva;0935\r\nvagujarati;0AB5\r\nvagurmukhi;0A35\r\nvakatakana;30F7\r\nvav;05D5\r\nvavdagesh;FB35\r\nvavdagesh65;FB35\r\nvavdageshhebrew;FB35\r\nvavhebrew;05D5\r\nvavholam;FB4B\r\nvavholamhebrew;FB4B\r\nvavvavhebrew;05F0\r\nvavyodhebrew;05F1\r\nvcircle;24E5\r\nvdotbelow;1E7F\r\nvecyrillic;0432\r\nveharabic;06A4\r\nvehfinalarabic;FB6B\r\nvehinitialarabic;FB6C\r\nvehmedialarabic;FB6D\r\nvekatakana;30F9\r\nvenus;2640\r\nverticalbar;007C\r\nverticallineabovecmb;030D\r\nverticallinebelowcmb;0329\r\nverticallinelowmod;02CC\r\nverticallinemod;02C8\r\nvewarmenian;057E\r\nvhook;028B\r\nvikatakana;30F8\r\nviramabengali;09CD\r\nviramadeva;094D\r\nviramagujarati;0ACD\r\nvisargabengali;0983\r\nvisargadeva;0903\r\nvisargagujarati;0A83\r\nvmonospace;FF56\r\nvoarmenian;0578\r\nvoicediterationhiragana;309E\r\nvoicediterationkatakana;30FE\r\nvoicedmarkkana;309B\r\nvoicedmarkkanahalfwidth;FF9E\r\nvokatakana;30FA\r\nvparen;24B1\r\nvtilde;1E7D\r\nvturned;028C\r\nvuhiragana;3094\r\nvukatakana;30F4\r\nw;0077\r\nwacute;1E83\r\nwaekorean;3159\r\nwahiragana;308F\r\nwakatakana;30EF\r\nwakatakanahalfwidth;FF9C\r\nwakorean;3158\r\nwasmallhiragana;308E\r\nwasmallkatakana;30EE\r\nwattosquare;3357\r\nwavedash;301C\r\nwavyunderscorevertical;FE34\r\nwawarabic;0648\r\nwawfinalarabic;FEEE\r\nwawhamzaabovearabic;0624\r\nwawhamzaabovefinalarabic;FE86\r\nwbsquare;33DD\r\nwcircle;24E6\r\nwcircumflex;0175\r\nwdieresis;1E85\r\nwdotaccent;1E87\r\nwdotbelow;1E89\r\nwehiragana;3091\r\nweierstrass;2118\r\nwekatakana;30F1\r\nwekorean;315E\r\nweokorean;315D\r\nwgrave;1E81\r\nwhitebullet;25E6\r\nwhitecircle;25CB\r\nwhitecircleinverse;25D9\r\nwhitecornerbracketleft;300E\r\nwhitecornerbracketleftvertical;FE43\r\nwhitecornerbracketright;300F\r\nwhitecornerbracketrightvertical;FE44\r\nwhitediamond;25C7\r\nwhitediamondcontainingblacksmalldiamond;25C8\r\nwhitedownpointingsmalltriangle;25BF\r\nwhitedownpointingtriangle;25BD\r\nwhiteleftpointingsmalltriangle;25C3\r\nwhiteleftpointingtriangle;25C1\r\nwhitelenticularbracketleft;3016\r\nwhitelenticularbracketright;3017\r\nwhiterightpointingsmalltriangle;25B9\r\nwhiterightpointingtriangle;25B7\r\nwhitesmallsquare;25AB\r\nwhitesmilingface;263A\r\nwhitesquare;25A1\r\nwhitestar;2606\r\nwhitetelephone;260F\r\nwhitetortoiseshellbracketleft;3018\r\nwhitetortoiseshellbracketright;3019\r\nwhiteuppointingsmalltriangle;25B5\r\nwhiteuppointingtriangle;25B3\r\nwihiragana;3090\r\nwikatakana;30F0\r\nwikorean;315F\r\nwmonospace;FF57\r\nwohiragana;3092\r\nwokatakana;30F2\r\nwokatakanahalfwidth;FF66\r\nwon;20A9\r\nwonmonospace;FFE6\r\nwowaenthai;0E27\r\nwparen;24B2\r\nwring;1E98\r\nwsuperior;02B7\r\nwturned;028D\r\nwynn;01BF\r\nx;0078\r\nxabovecmb;033D\r\nxbopomofo;3112\r\nxcircle;24E7\r\nxdieresis;1E8D\r\nxdotaccent;1E8B\r\nxeharmenian;056D\r\nxi;03BE\r\nxmonospace;FF58\r\nxparen;24B3\r\nxsuperior;02E3\r\ny;0079\r\nyaadosquare;334E\r\nyabengali;09AF\r\nyacute;00FD\r\nyadeva;092F\r\nyaekorean;3152\r\nyagujarati;0AAF\r\nyagurmukhi;0A2F\r\nyahiragana;3084\r\nyakatakana;30E4\r\nyakatakanahalfwidth;FF94\r\nyakorean;3151\r\nyamakkanthai;0E4E\r\nyasmallhiragana;3083\r\nyasmallkatakana;30E3\r\nyasmallkatakanahalfwidth;FF6C\r\nyatcyrillic;0463\r\nycircle;24E8\r\nycircumflex;0177\r\nydieresis;00FF\r\nydotaccent;1E8F\r\nydotbelow;1EF5\r\nyeharabic;064A\r\nyehbarreearabic;06D2\r\nyehbarreefinalarabic;FBAF\r\nyehfinalarabic;FEF2\r\nyehhamzaabovearabic;0626\r\nyehhamzaabovefinalarabic;FE8A\r\nyehhamzaaboveinitialarabic;FE8B\r\nyehhamzaabovemedialarabic;FE8C\r\nyehinitialarabic;FEF3\r\nyehmedialarabic;FEF4\r\nyehmeeminitialarabic;FCDD\r\nyehmeemisolatedarabic;FC58\r\nyehnoonfinalarabic;FC94\r\nyehthreedotsbelowarabic;06D1\r\nyekorean;3156\r\nyen;00A5\r\nyenmonospace;FFE5\r\nyeokorean;3155\r\nyeorinhieuhkorean;3186\r\nyerahbenyomohebrew;05AA\r\nyerahbenyomolefthebrew;05AA\r\nyericyrillic;044B\r\nyerudieresiscyrillic;04F9\r\nyesieungkorean;3181\r\nyesieungpansioskorean;3183\r\nyesieungsioskorean;3182\r\nyetivhebrew;059A\r\nygrave;1EF3\r\nyhook;01B4\r\nyhookabove;1EF7\r\nyiarmenian;0575\r\nyicyrillic;0457\r\nyikorean;3162\r\nyinyang;262F\r\nyiwnarmenian;0582\r\nymonospace;FF59\r\nyod;05D9\r\nyoddagesh;FB39\r\nyoddageshhebrew;FB39\r\nyodhebrew;05D9\r\nyodyodhebrew;05F2\r\nyodyodpatahhebrew;FB1F\r\nyohiragana;3088\r\nyoikorean;3189\r\nyokatakana;30E8\r\nyokatakanahalfwidth;FF96\r\nyokorean;315B\r\nyosmallhiragana;3087\r\nyosmallkatakana;30E7\r\nyosmallkatakanahalfwidth;FF6E\r\nyotgreek;03F3\r\nyoyaekorean;3188\r\nyoyakorean;3187\r\nyoyakthai;0E22\r\nyoyingthai;0E0D\r\nyparen;24B4\r\nypogegrammeni;037A\r\nypogegrammenigreekcmb;0345\r\nyr;01A6\r\nyring;1E99\r\nysuperior;02B8\r\nytilde;1EF9\r\nyturned;028E\r\nyuhiragana;3086\r\nyuikorean;318C\r\nyukatakana;30E6\r\nyukatakanahalfwidth;FF95\r\nyukorean;3160\r\nyusbigcyrillic;046B\r\nyusbigiotifiedcyrillic;046D\r\nyuslittlecyrillic;0467\r\nyuslittleiotifiedcyrillic;0469\r\nyusmallhiragana;3085\r\nyusmallkatakana;30E5\r\nyusmallkatakanahalfwidth;FF6D\r\nyuyekorean;318B\r\nyuyeokorean;318A\r\nyyabengali;09DF\r\nyyadeva;095F\r\nz;007A\r\nzaarmenian;0566\r\nzacute;017A\r\nzadeva;095B\r\nzagurmukhi;0A5B\r\nzaharabic;0638\r\nzahfinalarabic;FEC6\r\nzahinitialarabic;FEC7\r\nzahiragana;3056\r\nzahmedialarabic;FEC8\r\nzainarabic;0632\r\nzainfinalarabic;FEB0\r\nzakatakana;30B6\r\nzaqefgadolhebrew;0595\r\nzaqefqatanhebrew;0594\r\nzarqahebrew;0598\r\nzayin;05D6\r\nzayindagesh;FB36\r\nzayindageshhebrew;FB36\r\nzayinhebrew;05D6\r\nzbopomofo;3117\r\nzcaron;017E\r\nzcircle;24E9\r\nzcircumflex;1E91\r\nzcurl;0291\r\nzdot;017C\r\nzdotaccent;017C\r\nzdotbelow;1E93\r\nzecyrillic;0437\r\nzedescendercyrillic;0499\r\nzedieresiscyrillic;04DF\r\nzehiragana;305C\r\nzekatakana;30BC\r\nzero;0030\r\nzeroarabic;0660\r\nzerobengali;09E6\r\nzerodeva;0966\r\nzerogujarati;0AE6\r\nzerogurmukhi;0A66\r\nzerohackarabic;0660\r\nzeroinferior;2080\r\nzeromonospace;FF10\r\nzerooldstyle;F730\r\nzeropersian;06F0\r\nzerosuperior;2070\r\nzerothai;0E50\r\nzerowidthjoiner;FEFF\r\nzerowidthnonjoiner;200C\r\nzerowidthspace;200B\r\nzeta;03B6\r\nzhbopomofo;3113\r\nzhearmenian;056A\r\nzhebrevecyrillic;04C2\r\nzhecyrillic;0436\r\nzhedescendercyrillic;0497\r\nzhedieresiscyrillic;04DD\r\nzihiragana;3058\r\nzikatakana;30B8\r\nzinorhebrew;05AE\r\nzlinebelow;1E95\r\nzmonospace;FF5A\r\nzohiragana;305E\r\nzokatakana;30BE\r\nzparen;24B5\r\nzretroflexhook;0290\r\nzstroke;01B6\r\nzuhiragana;305A\r\nzukatakana;30BA\r\na100;275E\r\na101;2761\r\na102;2762\r\na103;2763\r\na104;2764\r\na105;2710\r\na106;2765\r\na107;2766\r\na108;2767\r\na109;2660\r\na10;2721\r\na110;2665\r\na111;2666\r\na112;2663\r\na117;2709\r\na118;2708\r\na119;2707\r\na11;261B\r\na120;2460\r\na121;2461\r\na122;2462\r\na123;2463\r\na124;2464\r\na125;2465\r\na126;2466\r\na127;2467\r\na128;2468\r\na129;2469\r\na12;261E\r\na130;2776\r\na131;2777\r\na132;2778\r\na133;2779\r\na134;277A\r\na135;277B\r\na136;277C\r\na137;277D\r\na138;277E\r\na139;277F\r\na13;270C\r\na140;2780\r\na141;2781\r\na142;2782\r\na143;2783\r\na144;2784\r\na145;2785\r\na146;2786\r\na147;2787\r\na148;2788\r\na149;2789\r\na14;270D\r\na150;278A\r\na151;278B\r\na152;278C\r\na153;278D\r\na154;278E\r\na155;278F\r\na156;2790\r\na157;2791\r\na158;2792\r\na159;2793\r\na15;270E\r\na160;2794\r\na161;2192\r\na162;27A3\r\na163;2194\r\na164;2195\r\na165;2799\r\na166;279B\r\na167;279C\r\na168;279D\r\na169;279E\r\na16;270F\r\na170;279F\r\na171;27A0\r\na172;27A1\r\na173;27A2\r\na174;27A4\r\na175;27A5\r\na176;27A6\r\na177;27A7\r\na178;27A8\r\na179;27A9\r\na17;2711\r\na180;27AB\r\na181;27AD\r\na182;27AF\r\na183;27B2\r\na184;27B3\r\na185;27B5\r\na186;27B8\r\na187;27BA\r\na188;27BB\r\na189;27BC\r\na18;2712\r\na190;27BD\r\na191;27BE\r\na192;279A\r\na193;27AA\r\na194;27B6\r\na195;27B9\r\na196;2798\r\na197;27B4\r\na198;27B7\r\na199;27AC\r\na19;2713\r\na1;2701\r\na200;27AE\r\na201;27B1\r\na202;2703\r\na203;2750\r\na204;2752\r\na205;276E\r\na206;2770\r\na20;2714\r\na21;2715\r\na22;2716\r\na23;2717\r\na24;2718\r\na25;2719\r\na26;271A\r\na27;271B\r\na28;271C\r\na29;2722\r\na2;2702\r\na30;2723\r\na31;2724\r\na32;2725\r\na33;2726\r\na34;2727\r\na35;2605\r\na36;2729\r\na37;272A\r\na38;272B\r\na39;272C\r\na3;2704\r\na40;272D\r\na41;272E\r\na42;272F\r\na43;2730\r\na44;2731\r\na45;2732\r\na46;2733\r\na47;2734\r\na48;2735\r\na49;2736\r\na4;260E\r\na50;2737\r\na51;2738\r\na52;2739\r\na53;273A\r\na54;273B\r\na55;273C\r\na56;273D\r\na57;273E\r\na58;273F\r\na59;2740\r\na5;2706\r\na60;2741\r\na61;2742\r\na62;2743\r\na63;2744\r\na64;2745\r\na65;2746\r\na66;2747\r\na67;2748\r\na68;2749\r\na69;274A\r\na6;271D\r\na70;274B\r\na71;25CF\r\na72;274D\r\na73;25A0\r\na74;274F\r\na75;2751\r\na76;25B2\r\na77;25BC\r\na78;25C6\r\na79;2756\r\na7;271E\r\na81;25D7\r\na82;2758\r\na83;2759\r\na84;275A\r\na85;276F\r\na86;2771\r\na87;2772\r\na88;2773\r\na89;2768\r\na8;271F\r\na90;2769\r\na91;276C\r\na92;276D\r\na93;276A\r\na94;276B\r\na95;2774\r\na96;2775\r\na97;275B\r\na98;275C\r\na99;275D\r\na9;2720\r\n\"\"\"\r\n\r\n\r\n# string table management\r\n#\r\nclass StringTable:\r\n  def __init__( self, name_list, master_table_name ):\r\n    self.names        = name_list\r\n    self.master_table = master_table_name\r\n    self.indices      = {}\r\n    index             = 0\r\n\r\n    for name in name_list:\r\n      self.indices[name] = index\r\n      index += len( name ) + 1\r\n\r\n    self.total = index\r\n\r\n  def dump( self, file ):\r\n    write = file.write\r\n    write( \"  static const char  \" + self.master_table +\r\n           \"[\" + repr( self.total ) + \"] =\\n\" )\r\n    write( \"  {\\n\" )\r\n\r\n    line = \"\"\r\n    for name in self.names:\r\n      line += \"    '\"\r\n      line += string.join( ( re.findall( \".\", name ) ), \"','\" )\r\n      line += \"', 0,\\n\"\r\n\r\n    write( line + \"  };\\n\\n\\n\" )\r\n\r\n  def dump_sublist( self, file, table_name, macro_name, sublist ):\r\n    write = file.write\r\n    write( \"#define \" + macro_name + \"  \" + repr( len( sublist ) ) + \"\\n\\n\" )\r\n\r\n    write( \"  /* Values are offsets into the `\" +\r\n           self.master_table + \"' table */\\n\\n\" )\r\n    write( \"  static const short  \" + table_name +\r\n           \"[\" + macro_name + \"] =\\n\" )\r\n    write( \"  {\\n\" )\r\n\r\n    line  = \"    \"\r\n    comma = \"\"\r\n    col   = 0\r\n\r\n    for name in sublist:\r\n      line += comma\r\n      line += \"%4d\" % self.indices[name]\r\n      col  += 1\r\n      comma = \",\"\r\n      if col == 14:\r\n        col   = 0\r\n        comma = \",\\n    \"\r\n\r\n    write( line + \"\\n  };\\n\\n\\n\" )\r\n\r\n\r\n# We now store the Adobe Glyph List in compressed form.  The list is put\r\n# into a data structure called `trie' (because it has a tree-like\r\n# appearance).  Consider, for example, that you want to store the\r\n# following name mapping:\r\n#\r\n#   A        => 1\r\n#   Aacute   => 6\r\n#   Abalon   => 2\r\n#   Abstract => 4\r\n#\r\n# It is possible to store the entries as follows.\r\n#\r\n#   A => 1\r\n#   |\r\n#   +-acute => 6\r\n#   |\r\n#   +-b\r\n#     |\r\n#     +-alon => 2\r\n#     |\r\n#     +-stract => 4\r\n#\r\n# We see that each node in the trie has:\r\n#\r\n# - one or more `letters'\r\n# - an optional value\r\n# - zero or more child nodes\r\n#\r\n# The first step is to call\r\n#\r\n#   root = StringNode( \"\", 0 )\r\n#   for word in map.values():\r\n#     root.add( word, map[word] )\r\n#\r\n# which creates a large trie where each node has only one children.\r\n#\r\n# Executing\r\n#\r\n#   root = root.optimize()\r\n#\r\n# optimizes the trie by merging the letters of successive nodes whenever\r\n# possible.\r\n#\r\n# Each node of the trie is stored as follows.\r\n#\r\n# - First the node's letter, according to the following scheme.  We\r\n#   use the fact that in the AGL no name contains character codes > 127.\r\n#\r\n#     name         bitsize     description\r\n#     ----------------------------------------------------------------\r\n#     notlast            1     Set to 1 if this is not the last letter\r\n#                              in the word.\r\n#     ascii              7     The letter's ASCII value.\r\n#\r\n# - The letter is followed by a children count and the value of the\r\n#   current key (if any).  Again we can do some optimization because all\r\n#   AGL entries are from the BMP; this means that 16 bits are sufficient\r\n#   to store its Unicode values.  Additionally, no node has more than\r\n#   127 children.\r\n#\r\n#     name         bitsize     description\r\n#     -----------------------------------------\r\n#     hasvalue           1     Set to 1 if a 16-bit Unicode value follows.\r\n#     num_children       7     Number of children.  Can be 0 only if\r\n#                              `hasvalue' is set to 1.\r\n#     value             16     Optional Unicode value.\r\n#\r\n# - A node is finished by a list of 16bit absolute offsets to the\r\n#   children, which must be sorted in increasing order of their first\r\n#   letter.\r\n#\r\n# For simplicity, all 16bit quantities are stored in big-endian order.\r\n#\r\n# The root node has first letter = 0, and no value.\r\n#\r\nclass StringNode:\r\n  def __init__( self, letter, value ):\r\n    self.letter   = letter\r\n    self.value    = value\r\n    self.children = {}\r\n\r\n  def __cmp__( self, other ):\r\n    return ord( self.letter[0] ) - ord( other.letter[0] )\r\n\r\n  def add( self, word, value ):\r\n    if len( word ) == 0:\r\n      self.value = value\r\n      return\r\n\r\n    letter = word[0]\r\n    word   = word[1:]\r\n\r\n    if self.children.has_key( letter ):\r\n      child = self.children[letter]\r\n    else:\r\n      child = StringNode( letter, 0 )\r\n      self.children[letter] = child\r\n\r\n    child.add( word, value )\r\n\r\n  def optimize( self ):\r\n    # optimize all children first\r\n    children      = self.children.values()\r\n    self.children = {}\r\n\r\n    for child in children:\r\n      self.children[child.letter[0]] = child.optimize()\r\n\r\n    # don't optimize if there's a value,\r\n    # if we don't have any child or if we\r\n    # have more than one child\r\n    if ( self.value != 0 ) or ( not children ) or len( children ) > 1:\r\n      return self\r\n\r\n    child = children[0]\r\n\r\n    self.letter  += child.letter\r\n    self.value    = child.value\r\n    self.children = child.children\r\n\r\n    return self\r\n\r\n  def dump_debug( self, write, margin ):\r\n    # this is used during debugging\r\n    line = margin + \"+-\"\r\n    if len( self.letter ) == 0:\r\n      line += \"<NOLETTER>\"\r\n    else:\r\n      line += self.letter\r\n\r\n    if self.value:\r\n      line += \" => \" + repr( self.value )\r\n\r\n    write( line + \"\\n\" )\r\n\r\n    if self.children:\r\n      margin += \"| \"\r\n      for child in self.children.values():\r\n        child.dump_debug( write, margin )\r\n\r\n  def locate( self, index ):\r\n    self.index = index\r\n    if len( self.letter ) > 0:\r\n      index += len( self.letter ) + 1\r\n    else:\r\n      index += 2\r\n\r\n    if self.value != 0:\r\n      index += 2\r\n\r\n    children = self.children.values()\r\n    children.sort()\r\n\r\n    index += 2 * len( children )\r\n    for child in children:\r\n      index = child.locate( index )\r\n\r\n    return index\r\n\r\n  def store( self, storage ):\r\n    # write the letters\r\n    l = len( self.letter )\r\n    if l == 0:\r\n      storage += struct.pack( \"B\", 0 )\r\n    else:\r\n      for n in range( l ):\r\n        val = ord( self.letter[n] )\r\n        if n < l - 1:\r\n          val += 128\r\n        storage += struct.pack( \"B\", val )\r\n\r\n    # write the count\r\n    children = self.children.values()\r\n    children.sort()\r\n\r\n    count = len( children )\r\n\r\n    if self.value != 0:\r\n      storage += struct.pack( \"!BH\", count + 128, self.value )\r\n    else:\r\n      storage += struct.pack( \"B\", count )\r\n\r\n    for child in children:\r\n      storage += struct.pack( \"!H\", child.index )\r\n\r\n    for child in children:\r\n      storage = child.store( storage )\r\n\r\n    return storage\r\n\r\n\r\ndef adobe_glyph_values():\r\n  \"\"\"return the list of glyph names and their unicode values\"\"\"\r\n\r\n  lines  = string.split( adobe_glyph_list, '\\n' )\r\n  glyphs = []\r\n  values = []\r\n\r\n  for line in lines:\r\n    if line:\r\n      fields = string.split( line, ';' )\r\n#     print fields[1] + ' - ' + fields[0]\r\n      subfields = string.split( fields[1], ' ' )\r\n      if len( subfields ) == 1:\r\n        glyphs.append( fields[0] )\r\n        values.append( fields[1] )\r\n\r\n  return glyphs, values\r\n\r\n\r\ndef filter_glyph_names( alist, filter ):\r\n  \"\"\"filter `alist' by taking _out_ all glyph names that are in `filter'\"\"\"\r\n\r\n  count  = 0\r\n  extras = []\r\n\r\n  for name in alist:\r\n    try:\r\n      filtered_index = filter.index( name )\r\n    except:\r\n      extras.append( name )\r\n\r\n  return extras\r\n\r\n\r\ndef dump_encoding( file, encoding_name, encoding_list ):\r\n  \"\"\"dump a given encoding\"\"\"\r\n\r\n  write = file.write\r\n  write( \"  /* the following are indices into the SID name table */\\n\" )\r\n  write( \"  static const unsigned short  \" + encoding_name +\r\n         \"[\" + repr( len( encoding_list ) ) + \"] =\\n\" )\r\n  write( \"  {\\n\" )\r\n\r\n  line  = \"    \"\r\n  comma = \"\"\r\n  col   = 0\r\n  for value in encoding_list:\r\n    line += comma\r\n    line += \"%3d\" % value\r\n    comma = \",\"\r\n    col  += 1\r\n    if col == 16:\r\n      col = 0\r\n      comma = \",\\n    \"\r\n\r\n  write( line + \"\\n  };\\n\\n\\n\" )\r\n\r\n\r\ndef dump_array( the_array, write, array_name ):\r\n  \"\"\"dumps a given encoding\"\"\"\r\n\r\n  write( \"  static const unsigned char  \" + array_name +\r\n         \"[\" + repr( len( the_array ) ) + \"L] =\\n\" )\r\n  write( \"  {\\n\" )\r\n\r\n  line  = \"\"\r\n  comma = \"    \"\r\n  col   = 0\r\n\r\n  for value in the_array:\r\n    line += comma\r\n    line += \"%3d\" % ord( value )\r\n    comma = \",\"\r\n    col  += 1\r\n\r\n    if col == 16:\r\n      col   = 0\r\n      comma = \",\\n    \"\r\n\r\n    if len( line ) > 1024:\r\n      write( line )\r\n      line = \"\"\r\n\r\n  write( line + \"\\n  };\\n\\n\\n\" )\r\n\r\n\r\ndef main():\r\n  \"\"\"main program body\"\"\"\r\n\r\n  if len( sys.argv ) != 2:\r\n    print __doc__ % sys.argv[0]\r\n    sys.exit( 1 )\r\n\r\n  file  = open( sys.argv[1], \"w\\n\" )\r\n  write = file.write\r\n\r\n  count_sid = len( sid_standard_names )\r\n\r\n  # `mac_extras' contains the list of glyph names in the Macintosh standard\r\n  # encoding which are not in the SID Standard Names.\r\n  #\r\n  mac_extras = filter_glyph_names( mac_standard_names, sid_standard_names )\r\n\r\n  # `base_list' contains the names of our final glyph names table.\r\n  # It consists of the `mac_extras' glyph names, followed by the SID\r\n  # standard names.\r\n  #\r\n  mac_extras_count = len( mac_extras )\r\n  base_list        = mac_extras + sid_standard_names\r\n\r\n  write( \"/***************************************************************************/\\n\" )\r\n  write( \"/*                                                                         */\\n\" )\r\n\r\n  write( \"/*  %-71s*/\\n\" % os.path.basename( sys.argv[1] ) )\r\n\r\n  write( \"/*                                                                         */\\n\" )\r\n  write( \"/*    PostScript glyph names.                                              */\\n\" )\r\n  write( \"/*                                                                         */\\n\" )\r\n  write( \"/*  Copyright 2005, 2008, 2011 by                                          */\\n\" )\r\n  write( \"/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\\n\" )\r\n  write( \"/*                                                                         */\\n\" )\r\n  write( \"/*  This file is part of the FreeType project, and may only be used,       */\\n\" )\r\n  write( \"/*  modified, and distributed under the terms of the FreeType project      */\\n\" )\r\n  write( \"/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\\n\" )\r\n  write( \"/*  this file you indicate that you have read the license and              */\\n\" )\r\n  write( \"/*  understand and accept it fully.                                        */\\n\" )\r\n  write( \"/*                                                                         */\\n\" )\r\n  write( \"/***************************************************************************/\\n\" )\r\n  write( \"\\n\" )\r\n  write( \"\\n\" )\r\n  write( \"  /* This file has been generated automatically -- do not edit! */\\n\" )\r\n  write( \"\\n\" )\r\n  write( \"\\n\" )\r\n\r\n  # dump final glyph list (mac extras + sid standard names)\r\n  #\r\n  st = StringTable( base_list, \"ft_standard_glyph_names\" )\r\n\r\n  st.dump( file )\r\n  st.dump_sublist( file, \"ft_mac_names\",\r\n                   \"FT_NUM_MAC_NAMES\", mac_standard_names )\r\n  st.dump_sublist( file, \"ft_sid_names\",\r\n                   \"FT_NUM_SID_NAMES\", sid_standard_names )\r\n\r\n  dump_encoding( file, \"t1_standard_encoding\", t1_standard_encoding )\r\n  dump_encoding( file, \"t1_expert_encoding\", t1_expert_encoding )\r\n\r\n  # dump the AGL in its compressed form\r\n  #\r\n  agl_glyphs, agl_values = adobe_glyph_values()\r\n  dict = StringNode( \"\", 0 )\r\n\r\n  for g in range( len( agl_glyphs ) ):\r\n    dict.add( agl_glyphs[g], eval( \"0x\" + agl_values[g] ) )\r\n\r\n  dict       = dict.optimize()\r\n  dict_len   = dict.locate( 0 )\r\n  dict_array = dict.store( \"\" )\r\n\r\n  write( \"\"\"\\\r\n  /*\r\n   *  This table is a compressed version of the Adobe Glyph List (AGL),\r\n   *  optimized for efficient searching.  It has been generated by the\r\n   *  `glnames.py' python script located in the `src/tools' directory.\r\n   *\r\n   *  The lookup function to get the Unicode value for a given string\r\n   *  is defined below the table.\r\n   */\r\n\r\n#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\r\n\r\n\"\"\" )\r\n\r\n  dump_array( dict_array, write, \"ft_adobe_glyph_list\" )\r\n\r\n  # write the lookup routine now\r\n  #\r\n  write( \"\"\"\\\r\n  /*\r\n   *  This function searches the compressed table efficiently.\r\n   */\r\n  static unsigned long\r\n  ft_get_adobe_glyph_index( const char*  name,\r\n                            const char*  limit )\r\n  {\r\n    int                   c = 0;\r\n    int                   count, min, max;\r\n    const unsigned char*  p = ft_adobe_glyph_list;\r\n\r\n\r\n    if ( name == 0 || name >= limit )\r\n      goto NotFound;\r\n\r\n    c     = *name++;\r\n    count = p[1];\r\n    p    += 2;\r\n\r\n    min = 0;\r\n    max = count;\r\n\r\n    while ( min < max )\r\n    {\r\n      int                   mid = ( min + max ) >> 1;\r\n      const unsigned char*  q   = p + mid * 2;\r\n      int                   c2;\r\n\r\n\r\n      q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] );\r\n\r\n      c2 = q[0] & 127;\r\n      if ( c2 == c )\r\n      {\r\n        p = q;\r\n        goto Found;\r\n      }\r\n      if ( c2 < c )\r\n        min = mid + 1;\r\n      else\r\n        max = mid;\r\n    }\r\n    goto NotFound;\r\n\r\n  Found:\r\n    for (;;)\r\n    {\r\n      /* assert (*p & 127) == c */\r\n\r\n      if ( name >= limit )\r\n      {\r\n        if ( (p[0] & 128) == 0 &&\r\n             (p[1] & 128) != 0 )\r\n          return (unsigned long)( ( (int)p[2] << 8 ) | p[3] );\r\n\r\n        goto NotFound;\r\n      }\r\n      c = *name++;\r\n      if ( p[0] & 128 )\r\n      {\r\n        p++;\r\n        if ( c != (p[0] & 127) )\r\n          goto NotFound;\r\n\r\n        continue;\r\n      }\r\n\r\n      p++;\r\n      count = p[0] & 127;\r\n      if ( p[0] & 128 )\r\n        p += 2;\r\n\r\n      p++;\r\n\r\n      for ( ; count > 0; count--, p += 2 )\r\n      {\r\n        int                   offset = ( (int)p[0] << 8 ) | p[1];\r\n        const unsigned char*  q      = ft_adobe_glyph_list + offset;\r\n\r\n        if ( c == ( q[0] & 127 ) )\r\n        {\r\n          p = q;\r\n          goto NextIter;\r\n        }\r\n      }\r\n      goto NotFound;\r\n\r\n    NextIter:\r\n      ;\r\n    }\r\n\r\n  NotFound:\r\n    return 0;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\r\n\r\n\"\"\" )\r\n\r\n  if 0:  # generate unit test, or don't\r\n    #\r\n    # now write the unit test to check that everything works OK\r\n    #\r\n    write( \"#ifdef TEST\\n\\n\" )\r\n\r\n    write( \"static const char* const  the_names[] = {\\n\" )\r\n    for name in agl_glyphs:\r\n      write( '  \"' + name + '\",\\n' )\r\n    write( \"  0\\n};\\n\" )\r\n\r\n    write( \"static const unsigned long  the_values[] = {\\n\" )\r\n    for val in agl_values:\r\n      write( '  0x' + val + ',\\n' )\r\n    write( \"  0\\n};\\n\" )\r\n\r\n    write( \"\"\"\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n\r\n  int\r\n  main( void )\r\n  {\r\n    int                   result = 0;\r\n    const char* const*    names  = the_names;\r\n    const unsigned long*  values = the_values;\r\n\r\n\r\n    for ( ; *names; names++, values++ )\r\n    {\r\n      const char*    name      = *names;\r\n      unsigned long  reference = *values;\r\n      unsigned long  value;\r\n\r\n\r\n      value = ft_get_adobe_glyph_index( name, name + strlen( name ) );\r\n      if ( value != reference )\r\n      {\r\n        result = 1;\r\n        fprintf( stderr, \"name '%s' => %04x instead of %04x\\\\n\",\r\n                         name, value, reference );\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\"\"\" )\r\n\r\n    write( \"#endif /* TEST */\\n\" )\r\n\r\n  write(\"\\n/* END */\\n\")\r\n\r\n\r\n# Now run the main routine\r\n#\r\nmain()\r\n\r\n\r\n# END\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/test_afm.c",
    "content": "/*\r\n * gcc -DFT2_BUILD_LIBRARY -I../../include -o test_afm test_afm.c \\\r\n *     -L../../objs/.libs -lfreetype -lz -static\r\n */\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n  void dump_fontinfo( AFM_FontInfo  fi )\r\n  {\r\n    FT_Int  i;\r\n\r\n\r\n    printf( \"This AFM is for %sCID font.\\n\\n\",\r\n            ( fi->IsCIDFont ) ? \"\" : \"non-\" );\r\n\r\n    printf( \"FontBBox: %.2f %.2f %.2f %.2f\\n\", fi->FontBBox.xMin / 65536.,\r\n                                               fi->FontBBox.yMin / 65536.,\r\n                                               fi->FontBBox.xMax / 65536.,\r\n                                               fi->FontBBox.yMax / 65536. );\r\n    printf( \"Ascender: %.2f\\n\", fi->Ascender / 65536. );\r\n    printf( \"Descender: %.2f\\n\\n\", fi->Descender / 65536. );\r\n\r\n    if ( fi->NumTrackKern )\r\n      printf( \"There are %d sets of track kernings:\\n\",\r\n              fi->NumTrackKern );\r\n    else\r\n      printf( \"There is no track kerning.\\n\" );\r\n\r\n    for ( i = 0; i < fi->NumTrackKern; i++ )\r\n    {\r\n      AFM_TrackKern  tk = fi->TrackKerns + i;\r\n\r\n\r\n      printf( \"\\t%2d: %5.2f %5.2f %5.2f %5.2f\\n\", tk->degree,\r\n                                                  tk->min_ptsize / 65536.,\r\n                                                  tk->min_kern / 65536.,\r\n                                                  tk->max_ptsize / 65536.,\r\n                                                  tk->max_kern / 65536. );\r\n    }\r\n\r\n    printf( \"\\n\" );\r\n\r\n    if ( fi->NumKernPair )\r\n      printf( \"There are %d kerning pairs:\\n\",\r\n              fi->NumKernPair );\r\n    else\r\n      printf( \"There is no kerning pair.\\n\" );\r\n\r\n    for ( i = 0; i < fi->NumKernPair; i++ )\r\n    {\r\n      AFM_KernPair  kp = fi->KernPairs + i;\r\n\r\n\r\n      printf( \"\\t%3d + %3d => (%4d, %4d)\\n\", kp->index1,\r\n                                             kp->index2,\r\n                                             kp->x,\r\n                                             kp->y );\r\n    }\r\n\r\n  }\r\n\r\n  int\r\n  dummy_get_index( const char*  name,\r\n                   FT_Offset    len,\r\n                   void*        user_data )\r\n  {\r\n    if ( len )\r\n      return name[0];\r\n    else\r\n      return 0;\r\n  }\r\n\r\n  FT_Error\r\n  parse_afm( FT_Library    library,\r\n             FT_Stream     stream,\r\n             AFM_FontInfo  fi )\r\n  {\r\n    PSAux_Service  psaux;\r\n    AFM_ParserRec  parser;\r\n    FT_Error       error = FT_Err_Ok;\r\n\r\n\r\n    psaux = (PSAux_Service)FT_Get_Module_Interface( library, \"psaux\" );\r\n    if ( !psaux || !psaux->afm_parser_funcs )\r\n      return -1;\r\n\r\n    error = FT_Stream_EnterFrame( stream, stream->size );\r\n    if ( error )\r\n      return error;\r\n\r\n    error = psaux->afm_parser_funcs->init( &parser,\r\n                                           library->memory,\r\n                                           stream->cursor,\r\n                                           stream->limit );\r\n    if ( error )\r\n      return error;\r\n\r\n    parser.FontInfo = fi;\r\n    parser.get_index = dummy_get_index;\r\n\r\n    error = psaux->afm_parser_funcs->parse( &parser );\r\n\r\n    psaux->afm_parser_funcs->done( &parser );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  int main( int    argc,\r\n            char** argv )\r\n  {\r\n    FT_Library       library;\r\n    FT_StreamRec     stream;\r\n    FT_Error         error = FT_Err_Ok;\r\n    AFM_FontInfoRec  fi;\r\n\r\n\r\n    if ( argc < 2 )\r\n      return FT_Err_Invalid_Argument;\r\n\r\n    error = FT_Init_FreeType( &library );\r\n    if ( error )\r\n      return error;\r\n\r\n    FT_ZERO( &stream );\r\n    error = FT_Stream_Open( &stream, argv[1] );\r\n    if ( error )\r\n      goto Exit;\r\n    stream.memory = library->memory;\r\n\r\n    FT_ZERO( &fi );\r\n    error = parse_afm( library, &stream, &fi );\r\n\r\n    if ( !error )\r\n    {\r\n      FT_Memory  memory = library->memory;\r\n\r\n\r\n      dump_fontinfo( &fi );\r\n\r\n      if ( fi.KernPairs )\r\n        FT_FREE( fi.KernPairs );\r\n      if ( fi.TrackKerns )\r\n        FT_FREE( fi.TrackKerns );\r\n    }\r\n    else\r\n      printf( \"parse error\\n\" );\r\n\r\n    FT_Stream_Close( &stream );\r\n\r\n  Exit:\r\n    FT_Done_FreeType( library );\r\n\r\n    return error;\r\n  }\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/test_bbox.c",
    "content": "#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_BBOX_H\r\n\r\n\r\n#include <time.h>    /* for clock() */\r\n\r\n/* SunOS 4.1.* does not define CLOCKS_PER_SEC, so include <sys/param.h> */\r\n/* to get the HZ macro which is the equivalent.                         */\r\n#if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)\r\n#include <sys/param.h>\r\n#define CLOCKS_PER_SEC HZ\r\n#endif\r\n\r\n  static long\r\n  get_time( void )\r\n  {\r\n    return clock() * 10000L / CLOCKS_PER_SEC;\r\n  }\r\n\r\n\r\n\r\n\r\n  /* test bbox computations */\r\n\r\n#define  XSCALE    65536\r\n#define  XX(x)     ((FT_Pos)(x*XSCALE))\r\n#define  XVEC(x,y)  { XX(x), XX(y) }\r\n#define  XVAL(x)   ((x)/(1.0*XSCALE))\r\n\r\n  /* dummy outline #1 */\r\n  static FT_Vector  dummy_vec_1[4] =\r\n  {\r\n#if 1\r\n    XVEC( 408.9111, 535.3164 ),\r\n    XVEC( 455.8887, 634.396  ),\r\n    XVEC( -37.8765, 786.2207 ),\r\n    XVEC( 164.6074, 535.3164 )\r\n#else\r\n    { (FT_Int32)0x0198E93DL , (FT_Int32)0x021750FFL },  /* 408.9111, 535.3164 */\r\n    { (FT_Int32)0x01C7E312L , (FT_Int32)0x027A6560L },  /* 455.8887, 634.3960 */\r\n    { (FT_Int32)0xFFDA1F9EL , (FT_Int32)0x0312387FL },  /* -37.8765, 786.2207 */\r\n    { (FT_Int32)0x00A49B7EL , (FT_Int32)0x021750FFL }   /* 164.6074, 535.3164 */\r\n#endif\r\n   };\r\n\r\n  static char  dummy_tag_1[4] =\r\n  {\r\n    FT_CURVE_TAG_ON,\r\n    FT_CURVE_TAG_CUBIC,\r\n    FT_CURVE_TAG_CUBIC,\r\n    FT_CURVE_TAG_ON\r\n  };\r\n\r\n  static short  dummy_contour_1[1] =\r\n  {\r\n    3\r\n  };\r\n\r\n  static FT_Outline  dummy_outline_1 =\r\n  {\r\n    1,\r\n    4,\r\n    dummy_vec_1,\r\n    dummy_tag_1,\r\n    dummy_contour_1,\r\n    0\r\n  };\r\n\r\n\r\n  /* dummy outline #2 */\r\n  static FT_Vector  dummy_vec_2[4] =\r\n  {\r\n    XVEC( 100.0, 100.0 ),\r\n    XVEC( 100.0, 200.0 ),\r\n    XVEC( 200.0, 200.0 ),\r\n    XVEC( 200.0, 133.0 )\r\n  };\r\n\r\n  static FT_Outline  dummy_outline_2 =\r\n  {\r\n    1,\r\n    4,\r\n    dummy_vec_2,\r\n    dummy_tag_1,\r\n    dummy_contour_1,\r\n    0\r\n  };\r\n\r\n\r\n  static void\r\n  dump_outline( FT_Outline*  outline )\r\n  {\r\n    FT_BBox  bbox;\r\n\r\n    /* compute and display cbox */\r\n    FT_Outline_Get_CBox( outline, &bbox );\r\n    printf( \"cbox = [%.2f %.2f %.2f %.2f]\\n\",\r\n             XVAL( bbox.xMin ),\r\n             XVAL( bbox.yMin ),\r\n             XVAL( bbox.xMax ),\r\n             XVAL( bbox.yMax ) );\r\n\r\n    /* compute and display bbox */\r\n    FT_Outline_Get_BBox( outline, &bbox );\r\n    printf( \"bbox = [%.2f %.2f %.2f %.2f]\\n\",\r\n             XVAL( bbox.xMin ),\r\n             XVAL( bbox.yMin ),\r\n             XVAL( bbox.xMax ),\r\n             XVAL( bbox.yMax ) );\r\n  }\r\n\r\n\r\n\r\n  static void\r\n  profile_outline( FT_Outline*   outline,\r\n                   long          repeat )\r\n  {\r\n    FT_BBox  bbox;\r\n    long     count;\r\n    long     time0;\r\n\r\n    time0 = get_time();\r\n    for ( count = repeat; count > 0; count-- )\r\n      FT_Outline_Get_CBox( outline, &bbox );\r\n\r\n    time0 = get_time() - time0;\r\n    printf( \"time = %5.2f cbox = [%.2f %.2f %.2f %.2f]\\n\",\r\n             ((double)time0/10000.0),\r\n             XVAL( bbox.xMin ),\r\n             XVAL( bbox.yMin ),\r\n             XVAL( bbox.xMax ),\r\n             XVAL( bbox.yMax ) );\r\n\r\n\r\n    time0 = get_time();\r\n    for ( count = repeat; count > 0; count-- )\r\n      FT_Outline_Get_BBox( outline, &bbox );\r\n\r\n    time0 = get_time() - time0;\r\n    printf( \"time = %5.2f bbox = [%.2f %.2f %.2f %.2f]\\n\",\r\n             ((double)time0/10000.0),\r\n             XVAL( bbox.xMin ),\r\n             XVAL( bbox.yMin ),\r\n             XVAL( bbox.xMax ),\r\n             XVAL( bbox.yMax ) );\r\n  }\r\n\r\n#define REPEAT  100000L\r\n\r\n  int  main( int  argc, char**  argv )\r\n  {\r\n    printf( \"outline #1\\n\" );\r\n    profile_outline( &dummy_outline_1, REPEAT );\r\n\r\n    printf( \"outline #2\\n\" );\r\n    profile_outline( &dummy_outline_2, REPEAT );\r\n    return 0;\r\n  }\r\n\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/tools/test_trig.c",
    "content": "#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TRIGONOMETRY_H\r\n\r\n#include <math.h>\r\n#include <stdio.h>\r\n\r\n#define  PI   3.14159265358979323846\r\n#define  SPI  (PI/FT_ANGLE_PI)\r\n\r\n/* the precision in 16.16 fixed float points of the checks. Expect */\r\n/* between 2 and 5 noise LSB bits during operations, due to        */\r\n/* rounding errors..                                               */\r\n#define  THRESHOLD  64\r\n\r\n  static  error = 0;\r\n\r\n  static void\r\n  test_cos( void )\r\n  {\r\n    FT_Fixed  f1, f2;\r\n    double    d1, d2;\r\n    int       i;\r\n\r\n    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )\r\n    {\r\n      f1 = FT_Cos(i);\r\n      d1 = f1/65536.0;\r\n      d2 = cos( i*SPI );\r\n      f2 = (FT_Fixed)(d2*65536.0);\r\n\r\n      if ( abs( f2-f1 ) > THRESHOLD )\r\n      {\r\n        error = 1;\r\n        printf( \"FT_Cos[%3d] = %.7f  cos[%3d] = %.7f\\n\",\r\n                (i >> 16), f1/65536.0, (i >> 16), d2 );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n\r\n  static void\r\n  test_sin( void )\r\n  {\r\n    FT_Fixed  f1, f2;\r\n    double    d1, d2;\r\n    int       i;\r\n\r\n    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )\r\n    {\r\n      f1 = FT_Sin(i);\r\n      d1 = f1/65536.0;\r\n      d2 = sin( i*SPI );\r\n      f2 = (FT_Fixed)(d2*65536.0);\r\n\r\n      if ( abs( f2-f1 ) > THRESHOLD )\r\n      {\r\n        error = 1;\r\n        printf( \"FT_Sin[%3d] = %.7f  sin[%3d] = %.7f\\n\",\r\n                (i >> 16), f1/65536.0, (i >> 16), d2 );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  test_tan( void )\r\n  {\r\n    FT_Fixed  f1, f2;\r\n    double    d1, d2;\r\n    int       i;\r\n\r\n    for ( i = 0; i < FT_ANGLE_PI2-0x2000000; i += 0x10000 )\r\n    {\r\n      f1 = FT_Tan(i);\r\n      d1 = f1/65536.0;\r\n      d2 = tan( i*SPI );\r\n      f2 = (FT_Fixed)(d2*65536.0);\r\n\r\n      if ( abs( f2-f1 ) > THRESHOLD )\r\n      {\r\n        error = 1;\r\n        printf( \"FT_Tan[%3d] = %.7f  tan[%3d] = %.7f\\n\",\r\n                (i >> 16), f1/65536.0, (i >> 16), d2 );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  test_atan2( void )\r\n  {\r\n    FT_Fixed  c2, s2;\r\n    double    l, a, c1, s1;\r\n    int       i, j;\r\n\r\n    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )\r\n    {\r\n      l  = 5.0;\r\n      a  = i*SPI;\r\n\r\n      c1 = l * cos(a);\r\n      s1 = l * sin(a);\r\n\r\n      c2 = (FT_Fixed)(c1*65536.0);\r\n      s2 = (FT_Fixed)(s1*65536.0);\r\n\r\n      j  = FT_Atan2( c2, s2 );\r\n      if ( j < 0 )\r\n        j += FT_ANGLE_2PI;\r\n\r\n      if ( abs( i - j ) > 1 )\r\n      {\r\n        printf( \"FT_Atan2( %.7f, %.7f ) = %.5f, atan = %.5f\\n\",\r\n                c2/65536.0, s2/65536.0, j/65536.0, i/65536.0 );\r\n      }\r\n    }\r\n  }\r\n\r\n  static void\r\n  test_unit( void )\r\n  {\r\n    FT_Vector  v;\r\n    double     a, c1, s1;\r\n    FT_Fixed   c2, s2;\r\n    int        i;\r\n\r\n    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )\r\n    {\r\n      FT_Vector_Unit( &v, i );\r\n      a  = ( i*SPI );\r\n      c1 = cos(a);\r\n      s1 = sin(a);\r\n      c2 = (FT_Fixed)(c1*65536.0);\r\n      s2 = (FT_Fixed)(s1*65536.0);\r\n\r\n      if ( abs( v.x-c2 ) > THRESHOLD ||\r\n           abs( v.y-s2 ) > THRESHOLD )\r\n      {\r\n        error = 1;\r\n        printf( \"FT_Vector_Unit[%3d] = ( %.7f, %.7f )  vec = ( %.7f, %.7f )\\n\",\r\n                (i >> 16),\r\n                v.x/65536.0, v.y/65536.0,\r\n                c1, s1 );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  test_length( void )\r\n  {\r\n    FT_Vector  v;\r\n    FT_Fixed   l, l2;\r\n    int        i;\r\n\r\n    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )\r\n    {\r\n      l   = (FT_Fixed)(500.0*65536.0);\r\n      v.x = (FT_Fixed)( l * cos( i*SPI ) );\r\n      v.y = (FT_Fixed)( l * sin( i*SPI ) );\r\n      l2  = FT_Vector_Length( &v );\r\n\r\n      if ( abs( l2-l ) > THRESHOLD )\r\n      {\r\n        error = 1;\r\n        printf( \"FT_Length( %.7f, %.7f ) = %.5f, length = %.5f\\n\",\r\n                v.x/65536.0, v.y/65536.0, l2/65536.0, l/65536.0 );\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  test_rotate( void )\r\n  {\r\n    FT_Fixed  c2, s2, c4, s4;\r\n    FT_Vector v;\r\n    double    l, ra, a, c1, s1, cra, sra, c3, s3;\r\n    int       i, j, rotate;\r\n\r\n    for ( rotate = 0; rotate < FT_ANGLE_2PI; rotate += 0x10000 )\r\n    {\r\n      ra  = rotate*SPI;\r\n      cra = cos( ra );\r\n      sra = sin( ra );\r\n\r\n      for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )\r\n      {\r\n        l  = 500.0;\r\n        a  = i*SPI;\r\n\r\n        c1 = l * cos(a);\r\n        s1 = l * sin(a);\r\n\r\n        v.x = c2 = (FT_Fixed)(c1*65536.0);\r\n        v.y = s2 = (FT_Fixed)(s1*65536.0);\r\n\r\n        FT_Vector_Rotate( &v, rotate );\r\n\r\n        c3 = c1 * cra - s1 * sra;\r\n        s3 = c1 * sra + s1 * cra;\r\n\r\n        c4 = (FT_Fixed)(c3*65536.0);\r\n        s4 = (FT_Fixed)(s3*65536.0);\r\n\r\n        if ( abs( c4 - v.x ) > THRESHOLD ||\r\n             abs( s4 - v.y ) > THRESHOLD )\r\n        {\r\n          error = 1;\r\n          printf( \"FT_Rotate( (%.7f,%.7f), %.5f ) = ( %.7f, %.7f ), rot = ( %.7f, %.7f )\\n\",\r\n                  c1, s1, ra,\r\n                  c2/65536.0, s2/65536.0,\r\n                  c4/65536.0, s4/65536.0 );\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  int main( void )\r\n  {\r\n    test_cos();\r\n    test_sin();\r\n    test_tan();\r\n    test_atan2();\r\n    test_unit();\r\n    test_length();\r\n    test_rotate();\r\n\r\n    if (!error)\r\n      printf( \"trigonometry test ok !\\n\" );\r\n\r\n    return !error;\r\n  }\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/Jamfile",
    "content": "# FreeType 2 src/truetype Jamfile\r\n#\r\n# Copyright 2001, 2004 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) truetype ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ttpic ;\r\n  }\r\n  else\r\n  {\r\n    _sources = truetype ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/truetype Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/module.mk",
    "content": "#\r\n# FreeType 2 TrueType module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += TRUETYPE_DRIVER\r\n\r\ndefine TRUETYPE_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, tt_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)truetype  $(ECHO_DRIVER_DESC)Windows/Mac font files with extension *.ttf or *.ttc$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/rules.mk",
    "content": "#\r\n# FreeType 2 TrueType driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2001, 2003-2004, 2011-2012 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# TrueType driver directory\r\n#\r\nTT_DIR := $(SRC_DIR)/truetype\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nTT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(TT_DIR))\r\n\r\n\r\n# TrueType driver sources (i.e., C files)\r\n#\r\nTT_DRV_SRC := $(TT_DIR)/ttdriver.c \\\r\n              $(TT_DIR)/ttgload.c  \\\r\n              $(TT_DIR)/ttgxvar.c  \\\r\n              $(TT_DIR)/ttinterp.c \\\r\n              $(TT_DIR)/ttobjs.c   \\\r\n              $(TT_DIR)/ttpic.c    \\\r\n              $(TT_DIR)/ttpload.c  \\\r\n              $(TT_DIR)/ttsubpix.c\r\n\r\n# TrueType driver headers\r\n#\r\nTT_DRV_H := $(TT_DRV_SRC:%.c=%.h) \\\r\n            $(TT_DIR)/tterrors.h\r\n\r\n\r\n# TrueType driver object(s)\r\n#\r\n#   TT_DRV_OBJ_M is used during `multi' builds\r\n#   TT_DRV_OBJ_S is used during `single' builds\r\n#\r\nTT_DRV_OBJ_M := $(TT_DRV_SRC:$(TT_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nTT_DRV_OBJ_S := $(OBJ_DIR)/truetype.$O\r\n\r\n# TrueType driver source file for single build\r\n#\r\nTT_DRV_SRC_S := $(TT_DIR)/truetype.c\r\n\r\n\r\n# TrueType driver - single object\r\n#\r\n$(TT_DRV_OBJ_S): $(TT_DRV_SRC_S) $(TT_DRV_SRC) $(FREETYPE_H) $(TT_DRV_H)\r\n\t$(TT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(TT_DRV_SRC_S))\r\n\r\n\r\n# driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(TT_DIR)/%.c $(FREETYPE_H) $(TT_DRV_H)\r\n\t$(TT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(TT_DRV_OBJ_S)\r\nDRV_OBJS_M += $(TT_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/truetype.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  truetype.c                                                             */\r\n/*                                                                         */\r\n/*    FreeType TrueType driver component (body only).                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2004, 2006, 2012 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"ttpic.c\"\r\n#include \"ttdriver.c\"   /* driver interface    */\r\n#include \"ttpload.c\"    /* tables loader       */\r\n#include \"ttgload.c\"    /* glyph loader        */\r\n#include \"ttobjs.c\"     /* object manager      */\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n#include \"ttinterp.c\"\r\n#include \"ttsubpix.c\"\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include \"ttgxvar.c\"    /* gx distortable font */\r\n#endif\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttdriver.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttdriver.c                                                             */\r\n/*                                                                         */\r\n/*    TrueType font driver implementation (body).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include FT_MULTIPLE_MASTERS_H\r\n#include FT_SERVICE_MULTIPLE_MASTERS_H\r\n#endif\r\n\r\n#include FT_SERVICE_TRUETYPE_ENGINE_H\r\n#include FT_SERVICE_TRUETYPE_GLYF_H\r\n\r\n#include \"ttdriver.h\"\r\n#include \"ttgload.h\"\r\n#include \"ttpload.h\"\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include \"ttgxvar.h\"\r\n#endif\r\n\r\n#include \"tterrors.h\"\r\n\r\n#include \"ttpic.h\"\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttdriver\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                          F A C E S                              ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#undef  PAIR_TAG\r\n#define PAIR_TAG( left, right )  ( ( (FT_ULong)left << 16 ) | \\\r\n                                     (FT_ULong)right        )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_get_kerning                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A driver method used to return the kerning vector between two      */\r\n  /*    glyphs of the same face.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to the source face object.                 */\r\n  /*                                                                       */\r\n  /*    left_glyph  :: The index of the left glyph in the kern pair.       */\r\n  /*                                                                       */\r\n  /*    right_glyph :: The index of the right glyph in the kern pair.      */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    kerning     :: The kerning vector.  This is in font units for      */\r\n  /*                   scalable formats, and in pixels for fixed-sizes     */\r\n  /*                   formats.                                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only horizontal layouts (left-to-right & right-to-left) are        */\r\n  /*    supported by this function.  Other layouts, or more sophisticated  */\r\n  /*    kernings, are out of scope of this method (the basic driver        */\r\n  /*    interface is meant to be simple).                                  */\r\n  /*                                                                       */\r\n  /*    They can be implemented by format-specific interfaces.             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  tt_get_kerning( FT_Face     ttface,          /* TT_Face */\r\n                  FT_UInt     left_glyph,\r\n                  FT_UInt     right_glyph,\r\n                  FT_Vector*  kerning )\r\n  {\r\n    TT_Face       face = (TT_Face)ttface;\r\n    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;\r\n\r\n\r\n    kerning->x = 0;\r\n    kerning->y = 0;\r\n\r\n    if ( sfnt )\r\n      kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n#undef PAIR_TAG\r\n\r\n\r\n  static FT_Error\r\n  tt_get_advances( FT_Face    ttface,\r\n                   FT_UInt    start,\r\n                   FT_UInt    count,\r\n                   FT_Int32   flags,\r\n                   FT_Fixed  *advances )\r\n  {\r\n    FT_UInt  nn;\r\n    TT_Face  face  = (TT_Face) ttface;\r\n\r\n\r\n    /* XXX: TODO: check for sbits */\r\n\r\n    if ( flags & FT_LOAD_VERTICAL_LAYOUT )\r\n    {\r\n      for ( nn = 0; nn < count; nn++ )\r\n      {\r\n        FT_Short   tsb;\r\n        FT_UShort  ah;\r\n\r\n\r\n        TT_Get_VMetrics( face, start + nn, &tsb, &ah );\r\n        advances[nn] = ah;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      for ( nn = 0; nn < count; nn++ )\r\n      {\r\n        FT_Short   lsb;\r\n        FT_UShort  aw;\r\n\r\n\r\n        TT_Get_HMetrics( face, start + nn, &lsb, &aw );\r\n        advances[nn] = aw;\r\n      }\r\n    }\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                           S I Z E S                             ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n  static FT_Error\r\n  tt_size_select( FT_Size   size,\r\n                  FT_ULong  strike_index )\r\n  {\r\n    TT_Face   ttface = (TT_Face)size->face;\r\n    TT_Size   ttsize = (TT_Size)size;\r\n    FT_Error  error  = TT_Err_Ok;\r\n\r\n\r\n    ttsize->strike_index = strike_index;\r\n\r\n    if ( FT_IS_SCALABLE( size->face ) )\r\n    {\r\n      /* use the scaled metrics, even when tt_size_reset fails */\r\n      FT_Select_Metrics( size->face, strike_index );\r\n\r\n      tt_size_reset( ttsize );\r\n    }\r\n    else\r\n    {\r\n      SFNT_Service      sfnt    = (SFNT_Service) ttface->sfnt;\r\n      FT_Size_Metrics*  metrics = &size->metrics;\r\n\r\n\r\n      error = sfnt->load_strike_metrics( ttface, strike_index, metrics );\r\n      if ( error )\r\n        ttsize->strike_index = 0xFFFFFFFFUL;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n\r\n  static FT_Error\r\n  tt_size_request( FT_Size          size,\r\n                   FT_Size_Request  req )\r\n  {\r\n    TT_Size   ttsize = (TT_Size)size;\r\n    FT_Error  error  = TT_Err_Ok;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n    if ( FT_HAS_FIXED_SIZES( size->face ) )\r\n    {\r\n      TT_Face       ttface = (TT_Face)size->face;\r\n      SFNT_Service  sfnt   = (SFNT_Service) ttface->sfnt;\r\n      FT_ULong      strike_index;\r\n\r\n\r\n      error = sfnt->set_sbit_strike( ttface, req, &strike_index );\r\n\r\n      if ( error )\r\n        ttsize->strike_index = 0xFFFFFFFFUL;\r\n      else\r\n        return tt_size_select( size, strike_index );\r\n    }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n    FT_Request_Metrics( size->face, req );\r\n\r\n    if ( FT_IS_SCALABLE( size->face ) )\r\n    {\r\n      error = tt_size_reset( ttsize );\r\n      ttsize->root.metrics = ttsize->metrics;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_glyph_load                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A driver method used to load a glyph within a given glyph slot.    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot        :: A handle to the target slot object where the glyph  */\r\n  /*                   will be loaded.                                     */\r\n  /*                                                                       */\r\n  /*    size        :: A handle to the source face size at which the glyph */\r\n  /*                   must be scaled, loaded, etc.                        */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The index of the glyph in the font file.            */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   FT_LOAD_XXX constants can be used to control the    */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  tt_glyph_load( FT_GlyphSlot  ttslot,      /* TT_GlyphSlot */\r\n                 FT_Size       ttsize,      /* TT_Size      */\r\n                 FT_UInt       glyph_index,\r\n                 FT_Int32      load_flags )\r\n  {\r\n    TT_GlyphSlot  slot = (TT_GlyphSlot)ttslot;\r\n    TT_Size       size = (TT_Size)ttsize;\r\n    FT_Face       face = ttslot->face;\r\n    FT_Error      error;\r\n\r\n\r\n    if ( !slot )\r\n      return TT_Err_Invalid_Slot_Handle;\r\n\r\n    if ( !size )\r\n      return TT_Err_Invalid_Size_Handle;\r\n\r\n    if ( !face )\r\n      return TT_Err_Invalid_Argument;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    if ( glyph_index >= (FT_UInt)face->num_glyphs &&\r\n         !face->internal->incremental_interface   )\r\n#else\r\n    if ( glyph_index >= (FT_UInt)face->num_glyphs )\r\n#endif\r\n      return TT_Err_Invalid_Argument;\r\n\r\n    if ( load_flags & FT_LOAD_NO_HINTING )\r\n    {\r\n      /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT   */\r\n      /* are necessary to disable hinting for tricky fonts */\r\n\r\n      if ( FT_IS_TRICKY( face ) )\r\n        load_flags &= ~FT_LOAD_NO_HINTING;\r\n\r\n      if ( load_flags & FT_LOAD_NO_AUTOHINT )\r\n        load_flags |= FT_LOAD_NO_HINTING;\r\n    }\r\n\r\n    if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )\r\n    {\r\n      load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;\r\n\r\n      if ( !FT_IS_TRICKY( face ) )\r\n        load_flags |= FT_LOAD_NO_HINTING;\r\n    }\r\n\r\n    /* now load the glyph outline if necessary */\r\n    error = TT_Load_Glyph( size, slot, glyph_index, load_flags );\r\n\r\n    /* force drop-out mode to 2 - irrelevant now */\r\n    /* slot->outline.dropout_mode = 2; */\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                D R I V E R  I N T E R F A C E                   ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n  FT_DEFINE_SERVICE_MULTIMASTERSREC(\r\n    tt_service_gx_multi_masters,\r\n    (FT_Get_MM_Func)        NULL,\r\n    (FT_Set_MM_Design_Func) NULL,\r\n    (FT_Set_MM_Blend_Func)  TT_Set_MM_Blend,\r\n    (FT_Get_MM_Var_Func)    TT_Get_MM_Var,\r\n    (FT_Set_Var_Design_Func)TT_Set_Var_Design )\r\n#endif\r\n\r\n  static const FT_Service_TrueTypeEngineRec  tt_service_truetype_engine =\r\n  {\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    FT_TRUETYPE_ENGINE_TYPE_UNPATENTED\r\n#else\r\n    FT_TRUETYPE_ENGINE_TYPE_PATENTED\r\n#endif\r\n\r\n#else /* !TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    FT_TRUETYPE_ENGINE_TYPE_NONE\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n  };\r\n\r\n  FT_DEFINE_SERVICE_TTGLYFREC(\r\n    tt_service_truetype_glyf,\r\n    (TT_Glyf_GetLocationFunc)tt_face_get_location )\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n  FT_DEFINE_SERVICEDESCREC4(\r\n    tt_services,\r\n    FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE,\r\n    FT_SERVICE_ID_MULTI_MASTERS,   &TT_SERVICE_GX_MULTI_MASTERS_GET,\r\n    FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,\r\n    FT_SERVICE_ID_TT_GLYF,         &TT_SERVICE_TRUETYPE_GLYF_GET )\r\n#else\r\n  FT_DEFINE_SERVICEDESCREC3(\r\n    tt_services,\r\n    FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE,\r\n    FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,\r\n    FT_SERVICE_ID_TT_GLYF,         &TT_SERVICE_TRUETYPE_GLYF_GET )\r\n#endif\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  tt_get_interface( FT_Module    driver,    /* TT_Driver */\r\n                    const char*  tt_interface )\r\n  {\r\n    FT_Library           library;\r\n    FT_Module_Interface  result;\r\n    FT_Module            sfntd;\r\n    SFNT_Service         sfnt;\r\n\r\n\r\n    /* TT_SERVICES_GET derefers `library' in PIC mode */\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    if ( !driver )\r\n      return NULL;\r\n    library = driver->library;\r\n    if ( !library )\r\n      return NULL;\r\n#endif\r\n\r\n    result = ft_service_list_lookup( TT_SERVICES_GET, tt_interface );\r\n    if ( result != NULL )\r\n      return result;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n    if ( !driver )\r\n      return NULL;\r\n    library = driver->library;\r\n    if ( !library )\r\n      return NULL;\r\n#endif\r\n\r\n    /* only return the default interface from the SFNT module */\r\n    sfntd = FT_Get_Module( library, \"sfnt\" );\r\n    if ( sfntd )\r\n    {\r\n      sfnt = (SFNT_Service)( sfntd->clazz->module_interface );\r\n      if ( sfnt )\r\n        return sfnt->get_interface( driver, tt_interface );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /* The FT_DriverInterface structure is defined in ftdriver.h. */\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n#define TT_HINTER_FLAG  FT_MODULE_DRIVER_HAS_HINTER\r\n#else\r\n#define TT_HINTER_FLAG  0\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n#define TT_SIZE_SELECT  tt_size_select\r\n#else\r\n#define TT_SIZE_SELECT  0\r\n#endif\r\n\r\n  FT_DEFINE_DRIVER( tt_driver_class,\r\n\r\n      FT_MODULE_FONT_DRIVER     |\r\n      FT_MODULE_DRIVER_SCALABLE |\r\n      TT_HINTER_FLAG,\r\n\r\n      sizeof ( TT_DriverRec ),\r\n\r\n      \"truetype\",      /* driver name                           */\r\n      0x10000L,        /* driver version == 1.0                 */\r\n      0x20000L,        /* driver requires FreeType 2.0 or above */\r\n\r\n      (void*)0,        /* driver specific interface */\r\n\r\n      tt_driver_init,\r\n      tt_driver_done,\r\n      tt_get_interface,\r\n\r\n    sizeof ( TT_FaceRec ),\r\n    sizeof ( TT_SizeRec ),\r\n    sizeof ( FT_GlyphSlotRec ),\r\n\r\n    tt_face_init,\r\n    tt_face_done,\r\n    tt_size_init,\r\n    tt_size_done,\r\n    tt_slot_init,\r\n    0,                       /* FT_Slot_DoneFunc */\r\n\r\n    ft_stub_set_char_sizes,  /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    tt_glyph_load,\r\n\r\n    tt_get_kerning,\r\n    0,                       /* FT_Face_AttachFunc */\r\n    tt_get_advances,\r\n\r\n    tt_size_request,\r\n    TT_SIZE_SELECT\r\n  )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttdriver.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttdriver.h                                                             */\r\n/*                                                                         */\r\n/*    High-level TrueType driver interface (specification).                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTDRIVER_H__\r\n#define __TTDRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_DECLARE_DRIVER( tt_driver_class )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/tterrors.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tterrors.h                                                             */\r\n/*                                                                         */\r\n/*    TrueType error codes (specification only).                           */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the TrueType error enumeration            */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __TTERRORS_H__\r\n#define __TTERRORS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  TT_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_TrueType\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __TTERRORS_H__ */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttgload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttgload.c                                                              */\r\n/*                                                                         */\r\n/*    TrueType Glyph Loader (body).                                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012                                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_OUTLINE_H\r\n\r\n#include \"ttgload.h\"\r\n#include \"ttpload.h\"\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include \"ttgxvar.h\"\r\n#endif\r\n\r\n#include \"tterrors.h\"\r\n#include \"ttsubpix.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttgload\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Composite glyph flags.                                                */\r\n  /*                                                                       */\r\n#define ARGS_ARE_WORDS             0x0001\r\n#define ARGS_ARE_XY_VALUES         0x0002\r\n#define ROUND_XY_TO_GRID           0x0004\r\n#define WE_HAVE_A_SCALE            0x0008\r\n/* reserved                        0x0010 */\r\n#define MORE_COMPONENTS            0x0020\r\n#define WE_HAVE_AN_XY_SCALE        0x0040\r\n#define WE_HAVE_A_2X2              0x0080\r\n#define WE_HAVE_INSTR              0x0100\r\n#define USE_MY_METRICS             0x0200\r\n#define OVERLAP_COMPOUND           0x0400\r\n#define SCALED_COMPONENT_OFFSET    0x0800\r\n#define UNSCALED_COMPONENT_OFFSET  0x1000\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Return the horizontal metrics in font units for a given glyph.        */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  TT_Get_HMetrics( TT_Face     face,\r\n                   FT_UInt     idx,\r\n                   FT_Short*   lsb,\r\n                   FT_UShort*  aw )\r\n  {\r\n    ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw );\r\n\r\n    FT_TRACE5(( \"  advance width (font units): %d\\n\", *aw ));\r\n    FT_TRACE5(( \"  left side bearing (font units): %d\\n\", *lsb ));\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Return the vertical metrics in font units for a given glyph.          */\r\n  /* Greg Hitchcock from Microsoft told us that if there were no `vmtx'    */\r\n  /* table, typoAscender/Descender from the `OS/2' table would be used     */\r\n  /* instead, and if there were no `OS/2' table, use ascender/descender    */\r\n  /* from the `hhea' table.  But that is not what Microsoft's rasterizer   */\r\n  /* apparently does: It uses the ppem value as the advance height, and    */\r\n  /* sets the top side bearing to be zero.                                 */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  TT_Get_VMetrics( TT_Face     face,\r\n                   FT_UInt     idx,\r\n                   FT_Short*   tsb,\r\n                   FT_UShort*  ah )\r\n  {\r\n    if ( face->vertical_info )\r\n      ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, idx, tsb, ah );\r\n\r\n#if 1             /* Empirically determined, at variance with what MS said */\r\n\r\n    else\r\n    {\r\n      *tsb = 0;\r\n      *ah  = face->root.units_per_EM;\r\n    }\r\n\r\n#else      /* This is what MS said to do.  It isn't what they do, however. */\r\n\r\n    else if ( face->os2.version != 0xFFFFU )\r\n    {\r\n      *tsb = face->os2.sTypoAscender;\r\n      *ah  = face->os2.sTypoAscender - face->os2.sTypoDescender;\r\n    }\r\n    else\r\n    {\r\n      *tsb = face->horizontal.Ascender;\r\n      *ah  = face->horizontal.Ascender - face->horizontal.Descender;\r\n    }\r\n\r\n#endif\r\n\r\n    FT_TRACE5(( \"  advance height (font units): %d\\n\", *ah ));\r\n    FT_TRACE5(( \"  top side bearing (font units): %d\\n\", *tsb ));\r\n  }\r\n\r\n\r\n  static void\r\n  tt_get_metrics( TT_Loader  loader,\r\n                  FT_UInt    glyph_index )\r\n  {\r\n    TT_Face  face = (TT_Face)loader->face;\r\n\r\n    FT_Short   left_bearing = 0, top_bearing = 0;\r\n    FT_UShort  advance_width = 0, advance_height = 0;\r\n\r\n\r\n    TT_Get_HMetrics( face, glyph_index,\r\n                     &left_bearing,\r\n                     &advance_width );\r\n    TT_Get_VMetrics( face, glyph_index,\r\n                     &top_bearing,\r\n                     &advance_height );\r\n\r\n    loader->left_bearing = left_bearing;\r\n    loader->advance      = advance_width;\r\n    loader->top_bearing  = top_bearing;\r\n    loader->vadvance     = advance_height;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( loader->exec )\r\n      loader->exec->sph_tweak_flags = 0;\r\n\r\n    /* this may not be the right place for this, but it works */\r\n    if ( loader->exec && loader->exec->ignore_x_mode )\r\n      sph_set_tweaks( loader, glyph_index );\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    if ( !loader->linear_def )\r\n    {\r\n      loader->linear_def = 1;\r\n      loader->linear     = advance_width;\r\n    }\r\n  }\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n  static void\r\n  tt_get_metrics_incr_overrides( TT_Loader  loader,\r\n                                 FT_UInt    glyph_index )\r\n  {\r\n    TT_Face  face = (TT_Face)loader->face;\r\n\r\n    FT_Short   left_bearing = 0, top_bearing = 0;\r\n    FT_UShort  advance_width = 0, advance_height = 0;\r\n\r\n\r\n    /* If this is an incrementally loaded font check whether there are */\r\n    /* overriding metrics for this glyph.                              */\r\n    if ( face->root.internal->incremental_interface                           &&\r\n         face->root.internal->incremental_interface->funcs->get_glyph_metrics )\r\n    {\r\n      FT_Incremental_MetricsRec  metrics;\r\n      FT_Error                   error;\r\n\r\n\r\n      metrics.bearing_x = loader->left_bearing;\r\n      metrics.bearing_y = 0;\r\n      metrics.advance   = loader->advance;\r\n      metrics.advance_v = 0;\r\n\r\n      error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(\r\n                face->root.internal->incremental_interface->object,\r\n                glyph_index, FALSE, &metrics );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      left_bearing  = (FT_Short)metrics.bearing_x;\r\n      advance_width = (FT_UShort)metrics.advance;\r\n\r\n#if 0\r\n\r\n      /* GWW: Do I do the same for vertical metrics? */\r\n      metrics.bearing_x = 0;\r\n      metrics.bearing_y = loader->top_bearing;\r\n      metrics.advance   = loader->vadvance;\r\n\r\n      error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(\r\n                face->root.internal->incremental_interface->object,\r\n                glyph_index, TRUE, &metrics );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      top_bearing    = (FT_Short)metrics.bearing_y;\r\n      advance_height = (FT_UShort)metrics.advance;\r\n\r\n#endif /* 0 */\r\n\r\n      loader->left_bearing = left_bearing;\r\n      loader->advance      = advance_width;\r\n      loader->top_bearing  = top_bearing;\r\n      loader->vadvance     = advance_height;\r\n\r\n      if ( !loader->linear_def )\r\n      {\r\n        loader->linear_def = 1;\r\n        loader->linear     = advance_width;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Translates an array of coordinates.                                   */\r\n  /*                                                                       */\r\n  static void\r\n  translate_array( FT_UInt     n,\r\n                   FT_Vector*  coords,\r\n                   FT_Pos      delta_x,\r\n                   FT_Pos      delta_y )\r\n  {\r\n    FT_UInt  k;\r\n\r\n\r\n    if ( delta_x )\r\n      for ( k = 0; k < n; k++ )\r\n        coords[k].x += delta_x;\r\n\r\n    if ( delta_y )\r\n      for ( k = 0; k < n; k++ )\r\n        coords[k].y += delta_y;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The following functions are used by default with TrueType fonts.      */\r\n  /* However, they can be replaced by alternatives if we need to support   */\r\n  /* TrueType-compressed formats (like MicroType) in the future.           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  TT_Access_Glyph_Frame( TT_Loader  loader,\r\n                         FT_UInt    glyph_index,\r\n                         FT_ULong   offset,\r\n                         FT_UInt    byte_count )\r\n  {\r\n    FT_Error   error;\r\n    FT_Stream  stream = loader->stream;\r\n\r\n    /* for non-debug mode */\r\n    FT_UNUSED( glyph_index );\r\n\r\n\r\n    FT_TRACE4(( \"Glyph %ld\\n\", glyph_index ));\r\n\r\n    /* the following line sets the `error' variable through macros! */\r\n    if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) )\r\n      return error;\r\n\r\n    loader->cursor = stream->cursor;\r\n    loader->limit  = stream->limit;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  TT_Forget_Glyph_Frame( TT_Loader  loader )\r\n  {\r\n    FT_Stream  stream = loader->stream;\r\n\r\n\r\n    FT_FRAME_EXIT();\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  TT_Load_Glyph_Header( TT_Loader  loader )\r\n  {\r\n    FT_Byte*  p     = loader->cursor;\r\n    FT_Byte*  limit = loader->limit;\r\n\r\n\r\n    if ( p + 10 > limit )\r\n      return TT_Err_Invalid_Outline;\r\n\r\n    loader->n_contours = FT_NEXT_SHORT( p );\r\n\r\n    loader->bbox.xMin = FT_NEXT_SHORT( p );\r\n    loader->bbox.yMin = FT_NEXT_SHORT( p );\r\n    loader->bbox.xMax = FT_NEXT_SHORT( p );\r\n    loader->bbox.yMax = FT_NEXT_SHORT( p );\r\n\r\n    FT_TRACE5(( \"  # of contours: %d\\n\", loader->n_contours ));\r\n    FT_TRACE5(( \"  xMin: %4d  xMax: %4d\\n\", loader->bbox.xMin,\r\n                                            loader->bbox.xMax ));\r\n    FT_TRACE5(( \"  yMin: %4d  yMax: %4d\\n\", loader->bbox.yMin,\r\n                                            loader->bbox.yMax ));\r\n    loader->cursor = p;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  TT_Load_Simple_Glyph( TT_Loader  load )\r\n  {\r\n    FT_Error        error;\r\n    FT_Byte*        p          = load->cursor;\r\n    FT_Byte*        limit      = load->limit;\r\n    FT_GlyphLoader  gloader    = load->gloader;\r\n    FT_Int          n_contours = load->n_contours;\r\n    FT_Outline*     outline;\r\n    TT_Face         face       = (TT_Face)load->face;\r\n    FT_UShort       n_ins;\r\n    FT_Int          n_points;\r\n\r\n    FT_Byte         *flag, *flag_limit;\r\n    FT_Byte         c, count;\r\n    FT_Vector       *vec, *vec_limit;\r\n    FT_Pos          x;\r\n    FT_Short        *cont, *cont_limit, prev_cont;\r\n    FT_Int          xy_size = 0;\r\n\r\n\r\n    /* check that we can add the contours to the glyph */\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( gloader, 0, n_contours );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    /* reading the contours' endpoints & number of points */\r\n    cont       = gloader->current.outline.contours;\r\n    cont_limit = cont + n_contours;\r\n\r\n    /* check space for contours array + instructions count */\r\n    if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )\r\n      goto Invalid_Outline;\r\n\r\n    prev_cont = FT_NEXT_SHORT( p );\r\n\r\n    if ( n_contours > 0 )\r\n      cont[0] = prev_cont;\r\n\r\n    if ( prev_cont < 0 )\r\n      goto Invalid_Outline;\r\n\r\n    for ( cont++; cont < cont_limit; cont++ )\r\n    {\r\n      cont[0] = FT_NEXT_SHORT( p );\r\n      if ( cont[0] <= prev_cont )\r\n      {\r\n        /* unordered contours: this is invalid */\r\n        goto Invalid_Outline;\r\n      }\r\n      prev_cont = cont[0];\r\n    }\r\n\r\n    n_points = 0;\r\n    if ( n_contours > 0 )\r\n    {\r\n      n_points = cont[-1] + 1;\r\n      if ( n_points < 0 )\r\n        goto Invalid_Outline;\r\n    }\r\n\r\n    /* note that we will add four phantom points later */\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( gloader, n_points + 4, 0 );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    /* reading the bytecode instructions */\r\n    load->glyph->control_len  = 0;\r\n    load->glyph->control_data = 0;\r\n\r\n    if ( p + 2 > limit )\r\n      goto Invalid_Outline;\r\n\r\n    n_ins = FT_NEXT_USHORT( p );\r\n\r\n    FT_TRACE5(( \"  Instructions size: %u\\n\", n_ins ));\r\n\r\n    if ( n_ins > face->max_profile.maxSizeOfInstructions )\r\n    {\r\n      FT_TRACE0(( \"TT_Load_Simple_Glyph: too many instructions (%d)\\n\",\r\n                  n_ins ));\r\n      error = TT_Err_Too_Many_Hints;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( ( limit - p ) < n_ins )\r\n    {\r\n      FT_TRACE0(( \"TT_Load_Simple_Glyph: instruction count mismatch\\n\" ));\r\n      error = TT_Err_Too_Many_Hints;\r\n      goto Fail;\r\n    }\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    if ( IS_HINTED( load->load_flags ) )\r\n    {\r\n      load->glyph->control_len  = n_ins;\r\n      load->glyph->control_data = load->exec->glyphIns;\r\n\r\n      FT_MEM_COPY( load->exec->glyphIns, p, (FT_Long)n_ins );\r\n    }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    p += n_ins;\r\n\r\n    outline = &gloader->current.outline;\r\n\r\n    /* reading the point tags */\r\n    flag       = (FT_Byte*)outline->tags;\r\n    flag_limit = flag + n_points;\r\n\r\n    FT_ASSERT( flag != NULL );\r\n\r\n    while ( flag < flag_limit )\r\n    {\r\n      if ( p + 1 > limit )\r\n        goto Invalid_Outline;\r\n\r\n      *flag++ = c = FT_NEXT_BYTE( p );\r\n      if ( c & 8 )\r\n      {\r\n        if ( p + 1 > limit )\r\n          goto Invalid_Outline;\r\n\r\n        count = FT_NEXT_BYTE( p );\r\n        if ( flag + (FT_Int)count > flag_limit )\r\n          goto Invalid_Outline;\r\n\r\n        for ( ; count > 0; count-- )\r\n          *flag++ = c;\r\n      }\r\n    }\r\n\r\n    /* reading the X coordinates */\r\n\r\n    vec       = outline->points;\r\n    vec_limit = vec + n_points;\r\n    flag      = (FT_Byte*)outline->tags;\r\n    x         = 0;\r\n\r\n    if ( p + xy_size > limit )\r\n      goto Invalid_Outline;\r\n\r\n    for ( ; vec < vec_limit; vec++, flag++ )\r\n    {\r\n      FT_Pos   y = 0;\r\n      FT_Byte  f = *flag;\r\n\r\n\r\n      if ( f & 2 )\r\n      {\r\n        if ( p + 1 > limit )\r\n          goto Invalid_Outline;\r\n\r\n        y = (FT_Pos)FT_NEXT_BYTE( p );\r\n        if ( ( f & 16 ) == 0 )\r\n          y = -y;\r\n      }\r\n      else if ( ( f & 16 ) == 0 )\r\n      {\r\n        if ( p + 2 > limit )\r\n          goto Invalid_Outline;\r\n\r\n        y = (FT_Pos)FT_NEXT_SHORT( p );\r\n      }\r\n\r\n      x     += y;\r\n      vec->x = x;\r\n      /* the cast is for stupid compilers */\r\n      *flag  = (FT_Byte)( f & ~( 2 | 16 ) );\r\n    }\r\n\r\n    /* reading the Y coordinates */\r\n\r\n    vec       = gloader->current.outline.points;\r\n    vec_limit = vec + n_points;\r\n    flag      = (FT_Byte*)outline->tags;\r\n    x         = 0;\r\n\r\n    for ( ; vec < vec_limit; vec++, flag++ )\r\n    {\r\n      FT_Pos   y = 0;\r\n      FT_Byte  f = *flag;\r\n\r\n\r\n      if ( f & 4 )\r\n      {\r\n        if ( p + 1 > limit )\r\n          goto Invalid_Outline;\r\n\r\n        y = (FT_Pos)FT_NEXT_BYTE( p );\r\n        if ( ( f & 32 ) == 0 )\r\n          y = -y;\r\n      }\r\n      else if ( ( f & 32 ) == 0 )\r\n      {\r\n        if ( p + 2 > limit )\r\n          goto Invalid_Outline;\r\n\r\n        y = (FT_Pos)FT_NEXT_SHORT( p );\r\n      }\r\n\r\n      x     += y;\r\n      vec->y = x;\r\n      /* the cast is for stupid compilers */\r\n      *flag  = (FT_Byte)( f & FT_CURVE_TAG_ON );\r\n    }\r\n\r\n    outline->n_points   = (FT_UShort)n_points;\r\n    outline->n_contours = (FT_Short) n_contours;\r\n\r\n    load->cursor = p;\r\n\r\n  Fail:\r\n    return error;\r\n\r\n  Invalid_Outline:\r\n    error = TT_Err_Invalid_Outline;\r\n    goto Fail;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  TT_Load_Composite_Glyph( TT_Loader  loader )\r\n  {\r\n    FT_Error        error;\r\n    FT_Byte*        p       = loader->cursor;\r\n    FT_Byte*        limit   = loader->limit;\r\n    FT_GlyphLoader  gloader = loader->gloader;\r\n    FT_SubGlyph     subglyph;\r\n    FT_UInt         num_subglyphs;\r\n\r\n\r\n    num_subglyphs = 0;\r\n\r\n    do\r\n    {\r\n      FT_Fixed  xx, xy, yy, yx;\r\n      FT_UInt   count;\r\n\r\n\r\n      /* check that we can load a new subglyph */\r\n      error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs + 1 );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* check space */\r\n      if ( p + 4 > limit )\r\n        goto Invalid_Composite;\r\n\r\n      subglyph = gloader->current.subglyphs + num_subglyphs;\r\n\r\n      subglyph->arg1 = subglyph->arg2 = 0;\r\n\r\n      subglyph->flags = FT_NEXT_USHORT( p );\r\n      subglyph->index = FT_NEXT_USHORT( p );\r\n\r\n      /* check space */\r\n      count = 2;\r\n      if ( subglyph->flags & ARGS_ARE_WORDS )\r\n        count += 2;\r\n      if ( subglyph->flags & WE_HAVE_A_SCALE )\r\n        count += 2;\r\n      else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )\r\n        count += 4;\r\n      else if ( subglyph->flags & WE_HAVE_A_2X2 )\r\n        count += 8;\r\n\r\n      if ( p + count > limit )\r\n        goto Invalid_Composite;\r\n\r\n      /* read arguments */\r\n      if ( subglyph->flags & ARGS_ARE_WORDS )\r\n      {\r\n        subglyph->arg1 = FT_NEXT_SHORT( p );\r\n        subglyph->arg2 = FT_NEXT_SHORT( p );\r\n      }\r\n      else\r\n      {\r\n        subglyph->arg1 = FT_NEXT_CHAR( p );\r\n        subglyph->arg2 = FT_NEXT_CHAR( p );\r\n      }\r\n\r\n      /* read transform */\r\n      xx = yy = 0x10000L;\r\n      xy = yx = 0;\r\n\r\n      if ( subglyph->flags & WE_HAVE_A_SCALE )\r\n      {\r\n        xx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n        yy = xx;\r\n      }\r\n      else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )\r\n      {\r\n        xx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n        yy = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n      }\r\n      else if ( subglyph->flags & WE_HAVE_A_2X2 )\r\n      {\r\n        xx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n        yx = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n        xy = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n        yy = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;\r\n      }\r\n\r\n      subglyph->transform.xx = xx;\r\n      subglyph->transform.xy = xy;\r\n      subglyph->transform.yx = yx;\r\n      subglyph->transform.yy = yy;\r\n\r\n      num_subglyphs++;\r\n\r\n    } while ( subglyph->flags & MORE_COMPONENTS );\r\n\r\n    gloader->current.num_subglyphs = num_subglyphs;\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    {\r\n      FT_Stream  stream = loader->stream;\r\n\r\n\r\n      /* we must undo the FT_FRAME_ENTER in order to point */\r\n      /* to the composite instructions, if we find some.   */\r\n      /* We will process them later.                       */\r\n      /*                                                   */\r\n      loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +\r\n                                    p - limit );\r\n    }\r\n\r\n#endif\r\n\r\n    loader->cursor = p;\r\n\r\n  Fail:\r\n    return error;\r\n\r\n  Invalid_Composite:\r\n    error = TT_Err_Invalid_Composite;\r\n    goto Fail;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  TT_Init_Glyph_Loading( TT_Face  face )\r\n  {\r\n    face->access_glyph_frame   = TT_Access_Glyph_Frame;\r\n    face->read_glyph_header    = TT_Load_Glyph_Header;\r\n    face->read_simple_glyph    = TT_Load_Simple_Glyph;\r\n    face->read_composite_glyph = TT_Load_Composite_Glyph;\r\n    face->forget_glyph_frame   = TT_Forget_Glyph_Frame;\r\n  }\r\n\r\n\r\n  static void\r\n  tt_prepare_zone( TT_GlyphZone  zone,\r\n                   FT_GlyphLoad  load,\r\n                   FT_UInt       start_point,\r\n                   FT_UInt       start_contour )\r\n  {\r\n    zone->n_points    = (FT_UShort)( load->outline.n_points - start_point );\r\n    zone->n_contours  = (FT_Short) ( load->outline.n_contours -\r\n                                       start_contour );\r\n    zone->org         = load->extra_points + start_point;\r\n    zone->cur         = load->outline.points + start_point;\r\n    zone->orus        = load->extra_points2 + start_point;\r\n    zone->tags        = (FT_Byte*)load->outline.tags + start_point;\r\n    zone->contours    = (FT_UShort*)load->outline.contours + start_contour;\r\n    zone->first_point = (FT_UShort)start_point;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Hint_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Hint the glyph using the zone prepared by the caller.  Note that   */\r\n  /*    the zone is supposed to include four phantom points.               */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  TT_Hint_Glyph( TT_Loader  loader,\r\n                 FT_Bool    is_composite )\r\n  {\r\n    TT_GlyphZone  zone = &loader->zone;\r\n    FT_Pos        origin;\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    FT_UInt       n_ins;\r\n#else\r\n    FT_UNUSED( is_composite );\r\n#endif\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    if ( loader->glyph->control_len > 0xFFFFL )\r\n    {\r\n      FT_TRACE1(( \"TT_Hint_Glyph: too long instructions \" ));\r\n      FT_TRACE1(( \"(0x%lx byte) is truncated\\n\",\r\n                 loader->glyph->control_len ));\r\n    }\r\n    n_ins = (FT_UInt)( loader->glyph->control_len );\r\n#endif\r\n\r\n    origin = zone->cur[zone->n_points - 4].x;\r\n    origin = FT_PIX_ROUND( origin ) - origin;\r\n    if ( origin )\r\n      translate_array( zone->n_points, zone->cur, origin, 0 );\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    /* save original point position in org */\r\n    if ( n_ins > 0 )\r\n      FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );\r\n\r\n    /* Reset graphics state. */\r\n    loader->exec->GS = ((TT_Size)loader->size)->GS;\r\n\r\n    /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */\r\n    /*      completely refer to the (already) hinted subglyphs.     */\r\n    if ( is_composite )\r\n    {\r\n      loader->exec->metrics.x_scale = 1 << 16;\r\n      loader->exec->metrics.y_scale = 1 << 16;\r\n\r\n      FT_ARRAY_COPY( zone->orus, zone->cur, zone->n_points );\r\n    }\r\n    else\r\n    {\r\n      loader->exec->metrics.x_scale =\r\n        ((TT_Size)loader->size)->metrics.x_scale;\r\n      loader->exec->metrics.y_scale =\r\n        ((TT_Size)loader->size)->metrics.y_scale;\r\n    }\r\n#endif\r\n\r\n    /* round pp2 and pp4 */\r\n    zone->cur[zone->n_points - 3].x =\r\n      FT_PIX_ROUND( zone->cur[zone->n_points - 3].x );\r\n    zone->cur[zone->n_points - 1].y =\r\n      FT_PIX_ROUND( zone->cur[zone->n_points - 1].y );\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    if ( n_ins > 0 )\r\n    {\r\n      FT_Bool   debug;\r\n      FT_Error  error;\r\n\r\n      FT_GlyphLoader  gloader         = loader->gloader;\r\n      FT_Outline      current_outline = gloader->current.outline;\r\n\r\n\r\n      error = TT_Set_CodeRange( loader->exec, tt_coderange_glyph,\r\n                                loader->exec->glyphIns, n_ins );\r\n      if ( error )\r\n        return error;\r\n\r\n      loader->exec->is_composite = is_composite;\r\n      loader->exec->pts          = *zone;\r\n\r\n      debug = FT_BOOL( !( loader->load_flags & FT_LOAD_NO_SCALE ) &&\r\n                       ((TT_Size)loader->size)->debug             );\r\n\r\n      error = TT_Run_Context( loader->exec, debug );\r\n      if ( error && loader->exec->pedantic_hinting )\r\n        return error;\r\n\r\n      /* store drop-out mode in bits 5-7; set bit 2 also as a marker */\r\n      current_outline.tags[0] |=\r\n        ( loader->exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE;\r\n    }\r\n\r\n#endif\r\n\r\n    /* save glyph phantom points */\r\n    if ( !loader->preserve_pps )\r\n    {\r\n      loader->pp1 = zone->cur[zone->n_points - 4];\r\n      loader->pp2 = zone->cur[zone->n_points - 3];\r\n      loader->pp3 = zone->cur[zone->n_points - 2];\r\n      loader->pp4 = zone->cur[zone->n_points - 1];\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( loader->exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )\r\n      FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );\r\n\r\n    else if ( loader->exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )\r\n      FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );\r\n#endif\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Process_Simple_Glyph                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Once a simple glyph has been loaded, it needs to be processed.     */\r\n  /*    Usually, this means scaling and hinting through bytecode           */\r\n  /*    interpretation.                                                    */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  TT_Process_Simple_Glyph( TT_Loader  loader )\r\n  {\r\n    FT_GlyphLoader  gloader = loader->gloader;\r\n    FT_Error        error   = TT_Err_Ok;\r\n    FT_Outline*     outline;\r\n    FT_Int          n_points;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    TT_Face     face           = (TT_Face)loader->face;\r\n    FT_String*  family         = face->root.family_name;\r\n    FT_Int      ppem           = loader->size->metrics.x_ppem;\r\n    FT_String*  style          = face->root.style_name;\r\n    FT_Int      x_scale_factor = 1000;\r\n#endif\r\n\r\n\r\n    outline  = &gloader->current.outline;\r\n    n_points = outline->n_points;\r\n\r\n    /* set phantom points */\r\n\r\n    outline->points[n_points    ] = loader->pp1;\r\n    outline->points[n_points + 1] = loader->pp2;\r\n    outline->points[n_points + 2] = loader->pp3;\r\n    outline->points[n_points + 3] = loader->pp4;\r\n\r\n    outline->tags[n_points    ] = 0;\r\n    outline->tags[n_points + 1] = 0;\r\n    outline->tags[n_points + 2] = 0;\r\n    outline->tags[n_points + 3] = 0;\r\n\r\n    n_points += 4;\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n\r\n    if ( ((TT_Face)loader->face)->doblend )\r\n    {\r\n      /* Deltas apply to the unscaled data. */\r\n      FT_Vector*  deltas;\r\n      FT_Memory   memory = loader->face->memory;\r\n      FT_Int      i;\r\n\r\n\r\n      error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face),\r\n                                        loader->glyph_index,\r\n                                        &deltas,\r\n                                        n_points );\r\n      if ( error )\r\n        return error;\r\n\r\n      for ( i = 0; i < n_points; ++i )\r\n      {\r\n        outline->points[i].x += deltas[i].x;\r\n        outline->points[i].y += deltas[i].y;\r\n      }\r\n\r\n      FT_FREE( deltas );\r\n    }\r\n\r\n#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */\r\n\r\n    if ( IS_HINTED( loader->load_flags ) )\r\n    {\r\n      tt_prepare_zone( &loader->zone, &gloader->current, 0, 0 );\r\n\r\n      FT_ARRAY_COPY( loader->zone.orus, loader->zone.cur,\r\n                     loader->zone.n_points + 4 );\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    /* scale, but only if enabled and only if TT hinting is being used */\r\n    if ( IS_HINTED( loader->load_flags ) )\r\n      x_scale_factor = scale_test_tweak( face, family, ppem, style,\r\n                                         loader->glyph_index, X_SCALING_Rules,\r\n                                         X_SCALING_RULES_SIZE );\r\n    /* scale the glyph */\r\n    if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||\r\n         x_scale_factor != 1000                         )\r\n    {\r\n      FT_Vector*  vec     = outline->points;\r\n      FT_Vector*  limit   = outline->points + n_points;\r\n      FT_Fixed    x_scale = FT_MulDiv(\r\n                              ((TT_Size)loader->size)->metrics.x_scale,\r\n                              x_scale_factor, 1000 );\r\n      FT_Fixed    y_scale = ((TT_Size)loader->size)->metrics.y_scale;\r\n\r\n\r\n      /* compensate for any scaling by de/emboldening; */\r\n      /* the amount was determined via experimentation */\r\n      if ( x_scale_factor != 1000 && ppem > 11 )\r\n         FT_Outline_EmboldenXY( outline,\r\n                                FT_MulFix( 1280 * ppem,\r\n                                           1000 - x_scale_factor ),\r\n                                0 );\r\n#else\r\n    /* scale the glyph */\r\n    if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n    {\r\n      FT_Vector*  vec     = outline->points;\r\n      FT_Vector*  limit   = outline->points + n_points;\r\n      FT_Fixed    x_scale = ((TT_Size)loader->size)->metrics.x_scale;\r\n      FT_Fixed    y_scale = ((TT_Size)loader->size)->metrics.y_scale;\r\n#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n      for ( ; vec < limit; vec++ )\r\n      {\r\n        vec->x = FT_MulFix( vec->x, x_scale );\r\n        vec->y = FT_MulFix( vec->y, y_scale );\r\n      }\r\n\r\n      loader->pp1 = outline->points[n_points - 4];\r\n      loader->pp2 = outline->points[n_points - 3];\r\n      loader->pp3 = outline->points[n_points - 2];\r\n      loader->pp4 = outline->points[n_points - 1];\r\n    }\r\n\r\n    if ( IS_HINTED( loader->load_flags ) )\r\n    {\r\n      loader->zone.n_points += 4;\r\n\r\n      error = TT_Hint_Glyph( loader, 0 );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Process_Composite_Component                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Once a composite component has been loaded, it needs to be         */\r\n  /*    processed.  Usually, this means transforming and translating.      */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  TT_Process_Composite_Component( TT_Loader    loader,\r\n                                  FT_SubGlyph  subglyph,\r\n                                  FT_UInt      start_point,\r\n                                  FT_UInt      num_base_points )\r\n  {\r\n    FT_GlyphLoader  gloader    = loader->gloader;\r\n    FT_Vector*      base_vec   = gloader->base.outline.points;\r\n    FT_UInt         num_points = gloader->base.outline.n_points;\r\n    FT_Bool         have_scale;\r\n    FT_Pos          x, y;\r\n\r\n\r\n    have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE     |\r\n                                              WE_HAVE_AN_XY_SCALE |\r\n                                              WE_HAVE_A_2X2       ) );\r\n\r\n    /* perform the transform required for this subglyph */\r\n    if ( have_scale )\r\n    {\r\n      FT_UInt  i;\r\n\r\n\r\n      for ( i = num_base_points; i < num_points; i++ )\r\n        FT_Vector_Transform( base_vec + i, &subglyph->transform );\r\n    }\r\n\r\n    /* get offset */\r\n    if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )\r\n    {\r\n      FT_UInt     k = subglyph->arg1;\r\n      FT_UInt     l = subglyph->arg2;\r\n      FT_Vector*  p1;\r\n      FT_Vector*  p2;\r\n\r\n\r\n      /* match l-th point of the newly loaded component to the k-th point */\r\n      /* of the previously loaded components.                             */\r\n\r\n      /* change to the point numbers used by our outline */\r\n      k += start_point;\r\n      l += num_base_points;\r\n      if ( k >= num_base_points ||\r\n           l >= num_points      )\r\n        return TT_Err_Invalid_Composite;\r\n\r\n      p1 = gloader->base.outline.points + k;\r\n      p2 = gloader->base.outline.points + l;\r\n\r\n      x = p1->x - p2->x;\r\n      y = p1->y - p2->y;\r\n    }\r\n    else\r\n    {\r\n      x = subglyph->arg1;\r\n      y = subglyph->arg2;\r\n\r\n      if ( !x && !y )\r\n        return TT_Err_Ok;\r\n\r\n  /* Use a default value dependent on                                     */\r\n  /* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED.  This is useful for old TT */\r\n  /* fonts which don't set the xxx_COMPONENT_OFFSET bit.                  */\r\n\r\n      if ( have_scale &&\r\n#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED\r\n           !( subglyph->flags & UNSCALED_COMPONENT_OFFSET ) )\r\n#else\r\n            ( subglyph->flags & SCALED_COMPONENT_OFFSET ) )\r\n#endif\r\n      {\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This algorithm is what Apple documents.  But it doesn't work.         */\r\n  /*                                                                       */\r\n        int  a = subglyph->transform.xx > 0 ?  subglyph->transform.xx\r\n                                            : -subglyph->transform.xx;\r\n        int  b = subglyph->transform.yx > 0 ?  subglyph->transform.yx\r\n                                            : -subglyph->transform.yx;\r\n        int  c = subglyph->transform.xy > 0 ?  subglyph->transform.xy\r\n                                            : -subglyph->transform.xy;\r\n        int  d = subglyph->transform.yy > 0 ? subglyph->transform.yy\r\n                                            : -subglyph->transform.yy;\r\n        int  m = a > b ? a : b;\r\n        int  n = c > d ? c : d;\r\n\r\n\r\n        if ( a - b <= 33 && a - b >= -33 )\r\n          m *= 2;\r\n        if ( c - d <= 33 && c - d >= -33 )\r\n          n *= 2;\r\n        x = FT_MulFix( x, m );\r\n        y = FT_MulFix( y, n );\r\n\r\n#else /* 0 */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This algorithm is a guess and works much better than the above.       */\r\n  /*                                                                       */\r\n        FT_Fixed  mac_xscale = FT_SqrtFixed(\r\n                                 (FT_Int32)FT_MulFix( subglyph->transform.xx,\r\n                                                      subglyph->transform.xx ) +\r\n                                 (FT_Int32)FT_MulFix( subglyph->transform.xy,\r\n                                                      subglyph->transform.xy ) );\r\n        FT_Fixed  mac_yscale = FT_SqrtFixed(\r\n                                 (FT_Int32)FT_MulFix( subglyph->transform.yy,\r\n                                                      subglyph->transform.yy ) +\r\n                                 (FT_Int32)FT_MulFix( subglyph->transform.yx,\r\n                                                      subglyph->transform.yx ) );\r\n\r\n\r\n        x = FT_MulFix( x, mac_xscale );\r\n        y = FT_MulFix( y, mac_yscale );\r\n\r\n#endif /* 0 */\r\n\r\n      }\r\n\r\n      if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )\r\n      {\r\n        FT_Fixed  x_scale = ((TT_Size)loader->size)->metrics.x_scale;\r\n        FT_Fixed  y_scale = ((TT_Size)loader->size)->metrics.y_scale;\r\n\r\n\r\n        x = FT_MulFix( x, x_scale );\r\n        y = FT_MulFix( y, y_scale );\r\n\r\n        if ( subglyph->flags & ROUND_XY_TO_GRID )\r\n        {\r\n          x = FT_PIX_ROUND( x );\r\n          y = FT_PIX_ROUND( y );\r\n        }\r\n      }\r\n    }\r\n\r\n    if ( x || y )\r\n      translate_array( num_points - num_base_points,\r\n                       base_vec + num_base_points,\r\n                       x, y );\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Process_Composite_Glyph                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is slightly different from TT_Process_Simple_Glyph, in that   */\r\n  /*    its sole purpose is to hint the glyph.  Thus this function is      */\r\n  /*    only available when bytecode interpreter is enabled.               */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  TT_Process_Composite_Glyph( TT_Loader  loader,\r\n                              FT_UInt    start_point,\r\n                              FT_UInt    start_contour )\r\n  {\r\n    FT_Error     error;\r\n    FT_Outline*  outline;\r\n    FT_UInt      i;\r\n\r\n\r\n    outline = &loader->gloader->base.outline;\r\n\r\n    /* make room for phantom points */\r\n    error = FT_GLYPHLOADER_CHECK_POINTS( loader->gloader,\r\n                                         outline->n_points + 4,\r\n                                         0 );\r\n    if ( error )\r\n      return error;\r\n\r\n    outline->points[outline->n_points    ] = loader->pp1;\r\n    outline->points[outline->n_points + 1] = loader->pp2;\r\n    outline->points[outline->n_points + 2] = loader->pp3;\r\n    outline->points[outline->n_points + 3] = loader->pp4;\r\n\r\n    outline->tags[outline->n_points    ] = 0;\r\n    outline->tags[outline->n_points + 1] = 0;\r\n    outline->tags[outline->n_points + 2] = 0;\r\n    outline->tags[outline->n_points + 3] = 0;\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    {\r\n      FT_Stream  stream = loader->stream;\r\n      FT_UShort  n_ins, max_ins;\r\n      FT_ULong   tmp;\r\n\r\n\r\n      /* TT_Load_Composite_Glyph only gives us the offset of instructions */\r\n      /* so we read them here                                             */\r\n      if ( FT_STREAM_SEEK( loader->ins_pos ) ||\r\n           FT_READ_USHORT( n_ins )           )\r\n        return error;\r\n\r\n      FT_TRACE5(( \"  Instructions size = %d\\n\", n_ins ));\r\n\r\n      /* check it */\r\n      max_ins = ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions;\r\n      if ( n_ins > max_ins )\r\n      {\r\n        /* acroread ignores this field, so we only do a rough safety check */\r\n        if ( (FT_Int)n_ins > loader->byte_len )\r\n        {\r\n          FT_TRACE1(( \"TT_Process_Composite_Glyph: \"\r\n                      \"too many instructions (%d) for glyph with length %d\\n\",\r\n                      n_ins, loader->byte_len ));\r\n          return TT_Err_Too_Many_Hints;\r\n        }\r\n\r\n        tmp = loader->exec->glyphSize;\r\n        error = Update_Max( loader->exec->memory,\r\n                            &tmp,\r\n                            sizeof ( FT_Byte ),\r\n                            (void*)&loader->exec->glyphIns,\r\n                            n_ins );\r\n        loader->exec->glyphSize = (FT_UShort)tmp;\r\n        if ( error )\r\n          return error;\r\n      }\r\n      else if ( n_ins == 0 )\r\n        return TT_Err_Ok;\r\n\r\n      if ( FT_STREAM_READ( loader->exec->glyphIns, n_ins ) )\r\n        return error;\r\n\r\n      loader->glyph->control_data = loader->exec->glyphIns;\r\n      loader->glyph->control_len  = n_ins;\r\n    }\r\n\r\n#endif\r\n\r\n    tt_prepare_zone( &loader->zone, &loader->gloader->base,\r\n                     start_point, start_contour );\r\n\r\n    /* Some points are likely touched during execution of  */\r\n    /* instructions on components.  So let's untouch them. */\r\n    for ( i = start_point; i < loader->zone.n_points; i++ )\r\n      loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH;\r\n\r\n    loader->zone.n_points += 4;\r\n\r\n    return TT_Hint_Glyph( loader, 1 );\r\n  }\r\n\r\n\r\n  /* Calculate the four phantom points.                     */\r\n  /* The first two stand for horizontal origin and advance. */\r\n  /* The last two stand for vertical origin and advance.    */\r\n#define TT_LOADER_SET_PP( loader )                                          \\\r\n          do {                                                              \\\r\n            (loader)->pp1.x = (loader)->bbox.xMin - (loader)->left_bearing; \\\r\n            (loader)->pp1.y = 0;                                            \\\r\n            (loader)->pp2.x = (loader)->pp1.x + (loader)->advance;          \\\r\n            (loader)->pp2.y = 0;                                            \\\r\n            (loader)->pp3.x = 0;                                            \\\r\n            (loader)->pp3.y = (loader)->top_bearing + (loader)->bbox.yMax;  \\\r\n            (loader)->pp4.x = 0;                                            \\\r\n            (loader)->pp4.y = (loader)->pp3.y - (loader)->vadvance;         \\\r\n          } while ( 0 )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    load_truetype_glyph                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads a given truetype glyph.  Handles composites and uses a       */\r\n  /*    TT_Loader object.                                                  */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  load_truetype_glyph( TT_Loader  loader,\r\n                       FT_UInt    glyph_index,\r\n                       FT_UInt    recurse_count,\r\n                       FT_Bool    header_only )\r\n  {\r\n    FT_Error        error        = TT_Err_Ok;\r\n    FT_Fixed        x_scale, y_scale;\r\n    FT_ULong        offset;\r\n    TT_Face         face         = (TT_Face)loader->face;\r\n    FT_GlyphLoader  gloader      = loader->gloader;\r\n    FT_Bool         opened_frame = 0;\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    FT_Vector*      deltas       = NULL;\r\n#endif\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_StreamRec    inc_stream;\r\n    FT_Data         glyph_data;\r\n    FT_Bool         glyph_data_loaded = 0;\r\n#endif\r\n\r\n\r\n    /* some fonts have an incorrect value of `maxComponentDepth', */\r\n    /* thus we allow depth 1 to catch the majority of them        */\r\n    if ( recurse_count > 1                                   &&\r\n         recurse_count > face->max_profile.maxComponentDepth )\r\n    {\r\n      error = TT_Err_Invalid_Composite;\r\n      goto Exit;\r\n    }\r\n\r\n    /* check glyph index */\r\n    if ( glyph_index >= (FT_UInt)face->root.num_glyphs )\r\n    {\r\n      error = TT_Err_Invalid_Glyph_Index;\r\n      goto Exit;\r\n    }\r\n\r\n    loader->glyph_index = glyph_index;\r\n\r\n    if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n    {\r\n      x_scale = ((TT_Size)loader->size)->metrics.x_scale;\r\n      y_scale = ((TT_Size)loader->size)->metrics.y_scale;\r\n    }\r\n    else\r\n    {\r\n      x_scale = 0x10000L;\r\n      y_scale = 0x10000L;\r\n    }\r\n\r\n    tt_get_metrics( loader, glyph_index );\r\n\r\n    /* Set `offset' to the start of the glyph relative to the start of */\r\n    /* the `glyf' table, and `byte_len' to the length of the glyph in  */\r\n    /* bytes.                                                          */\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    /* If we are loading glyph data via the incremental interface, set */\r\n    /* the loader stream to a memory stream reading the data returned  */\r\n    /* by the interface.                                               */\r\n    if ( face->root.internal->incremental_interface )\r\n    {\r\n      error = face->root.internal->incremental_interface->funcs->get_glyph_data(\r\n                face->root.internal->incremental_interface->object,\r\n                glyph_index, &glyph_data );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      glyph_data_loaded = 1;\r\n      offset            = 0;\r\n      loader->byte_len  = glyph_data.length;\r\n\r\n      FT_MEM_ZERO( &inc_stream, sizeof ( inc_stream ) );\r\n      FT_Stream_OpenMemory( &inc_stream,\r\n                            glyph_data.pointer, glyph_data.length );\r\n\r\n      loader->stream = &inc_stream;\r\n    }\r\n    else\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n      offset = tt_face_get_location( face, glyph_index,\r\n                                     (FT_UInt*)&loader->byte_len );\r\n\r\n    if ( loader->byte_len > 0 )\r\n    {\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n      /* for the incremental interface, `glyf_offset' is always zero */\r\n      if ( !loader->glyf_offset                        &&\r\n           !face->root.internal->incremental_interface )\r\n#else\r\n      if ( !loader->glyf_offset )\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n      {\r\n        FT_TRACE2(( \"no `glyf' table but non-zero `loca' entry\\n\" ));\r\n        error = TT_Err_Invalid_Table;\r\n        goto Exit;\r\n      }\r\n\r\n      error = face->access_glyph_frame( loader, glyph_index,\r\n                                        loader->glyf_offset + offset,\r\n                                        loader->byte_len );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      opened_frame = 1;\r\n\r\n      /* read glyph header first */\r\n      error = face->read_glyph_header( loader );\r\n      if ( error || header_only )\r\n        goto Exit;\r\n    }\r\n\r\n    if ( loader->byte_len == 0 || loader->n_contours == 0 )\r\n    {\r\n      loader->bbox.xMin = 0;\r\n      loader->bbox.xMax = 0;\r\n      loader->bbox.yMin = 0;\r\n      loader->bbox.yMax = 0;\r\n\r\n      if ( header_only )\r\n        goto Exit;\r\n\r\n      /* must initialize points before (possibly) overriding */\r\n      /* glyph metrics from the incremental interface        */\r\n      TT_LOADER_SET_PP( loader );\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n      tt_get_metrics_incr_overrides( loader, glyph_index );\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n\r\n      if ( ((TT_Face)(loader->face))->doblend )\r\n      {\r\n        /* this must be done before scaling */\r\n        FT_Memory  memory = loader->face->memory;\r\n\r\n\r\n        error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face),\r\n                                          glyph_index, &deltas, 4 );\r\n        if ( error )\r\n          goto Exit;\r\n\r\n        loader->pp1.x += deltas[0].x; loader->pp1.y += deltas[0].y;\r\n        loader->pp2.x += deltas[1].x; loader->pp2.y += deltas[1].y;\r\n        loader->pp3.x += deltas[2].x; loader->pp3.y += deltas[2].y;\r\n        loader->pp4.x += deltas[3].x; loader->pp4.y += deltas[3].y;\r\n\r\n        FT_FREE( deltas );\r\n      }\r\n\r\n#endif\r\n\r\n      if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n      {\r\n        loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );\r\n        loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );\r\n        loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );\r\n        loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );\r\n      }\r\n\r\n      error = TT_Err_Ok;\r\n      goto Exit;\r\n    }\r\n\r\n    /* must initialize points before (possibly) overriding */\r\n    /* glyph metrics from the incremental interface        */\r\n    TT_LOADER_SET_PP( loader );\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    tt_get_metrics_incr_overrides( loader, glyph_index );\r\n#endif\r\n\r\n    /***********************************************************************/\r\n    /***********************************************************************/\r\n    /***********************************************************************/\r\n\r\n    /* if it is a simple glyph, load it */\r\n\r\n    if ( loader->n_contours > 0 )\r\n    {\r\n      error = face->read_simple_glyph( loader );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* all data have been read */\r\n      face->forget_glyph_frame( loader );\r\n      opened_frame = 0;\r\n\r\n      error = TT_Process_Simple_Glyph( loader );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      FT_GlyphLoader_Add( gloader );\r\n    }\r\n\r\n    /***********************************************************************/\r\n    /***********************************************************************/\r\n    /***********************************************************************/\r\n\r\n    /* otherwise, load a composite! */\r\n    else if ( loader->n_contours == -1 )\r\n    {\r\n      FT_UInt   start_point;\r\n      FT_UInt   start_contour;\r\n      FT_ULong  ins_pos;  /* position of composite instructions, if any */\r\n\r\n\r\n      start_point   = gloader->base.outline.n_points;\r\n      start_contour = gloader->base.outline.n_contours;\r\n\r\n      /* for each subglyph, read composite header */\r\n      error = face->read_composite_glyph( loader );\r\n      if ( error )\r\n        goto Exit;\r\n\r\n      /* store the offset of instructions */\r\n      ins_pos = loader->ins_pos;\r\n\r\n      /* all data we need are read */\r\n      face->forget_glyph_frame( loader );\r\n      opened_frame = 0;\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n\r\n      if ( face->doblend )\r\n      {\r\n        FT_Int       i, limit;\r\n        FT_SubGlyph  subglyph;\r\n        FT_Memory    memory = face->root.memory;\r\n\r\n\r\n        /* this provides additional offsets */\r\n        /* for each component's translation */\r\n\r\n        if ( ( error = TT_Vary_Get_Glyph_Deltas(\r\n                         face,\r\n                         glyph_index,\r\n                         &deltas,\r\n                         gloader->current.num_subglyphs + 4 )) != 0 )\r\n          goto Exit;\r\n\r\n        subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs;\r\n        limit    = gloader->current.num_subglyphs;\r\n\r\n        for ( i = 0; i < limit; ++i, ++subglyph )\r\n        {\r\n          if ( subglyph->flags & ARGS_ARE_XY_VALUES )\r\n          {\r\n            /* XXX: overflow check for subglyph->{arg1,arg2}.   */\r\n            /* deltas[i].{x,y} must be within signed 16-bit,    */\r\n            /* but the restriction of summed delta is not clear */\r\n            subglyph->arg1 += (FT_Int16)deltas[i].x;\r\n            subglyph->arg2 += (FT_Int16)deltas[i].y;\r\n          }\r\n        }\r\n\r\n        loader->pp1.x += deltas[i + 0].x; loader->pp1.y += deltas[i + 0].y;\r\n        loader->pp2.x += deltas[i + 1].x; loader->pp2.y += deltas[i + 1].y;\r\n        loader->pp3.x += deltas[i + 2].x; loader->pp3.y += deltas[i + 2].y;\r\n        loader->pp4.x += deltas[i + 3].x; loader->pp4.y += deltas[i + 3].y;\r\n\r\n        FT_FREE( deltas );\r\n      }\r\n\r\n#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */\r\n\r\n      if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n      {\r\n        loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );\r\n        loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );\r\n        loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );\r\n        loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );\r\n      }\r\n\r\n      /* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */\r\n      /* `as is' in the glyph slot (the client application will be     */\r\n      /* responsible for interpreting these data)...                   */\r\n      if ( loader->load_flags & FT_LOAD_NO_RECURSE )\r\n      {\r\n        FT_GlyphLoader_Add( gloader );\r\n        loader->glyph->format = FT_GLYPH_FORMAT_COMPOSITE;\r\n\r\n        goto Exit;\r\n      }\r\n\r\n      /*********************************************************************/\r\n      /*********************************************************************/\r\n      /*********************************************************************/\r\n\r\n      {\r\n        FT_UInt      n, num_base_points;\r\n        FT_SubGlyph  subglyph       = 0;\r\n\r\n        FT_UInt      num_points     = start_point;\r\n        FT_UInt      num_subglyphs  = gloader->current.num_subglyphs;\r\n        FT_UInt      num_base_subgs = gloader->base.num_subglyphs;\r\n\r\n        FT_Stream    old_stream     = loader->stream;\r\n        FT_Int       old_byte_len   = loader->byte_len;\r\n\r\n\r\n        FT_GlyphLoader_Add( gloader );\r\n\r\n        /* read each subglyph independently */\r\n        for ( n = 0; n < num_subglyphs; n++ )\r\n        {\r\n          FT_Vector  pp[4];\r\n\r\n\r\n          /* Each time we call load_truetype_glyph in this loop, the   */\r\n          /* value of `gloader.base.subglyphs' can change due to table */\r\n          /* reallocations.  We thus need to recompute the subglyph    */\r\n          /* pointer on each iteration.                                */\r\n          subglyph = gloader->base.subglyphs + num_base_subgs + n;\r\n\r\n          pp[0] = loader->pp1;\r\n          pp[1] = loader->pp2;\r\n          pp[2] = loader->pp3;\r\n          pp[3] = loader->pp4;\r\n\r\n          num_base_points = gloader->base.outline.n_points;\r\n\r\n          error = load_truetype_glyph( loader, subglyph->index,\r\n                                       recurse_count + 1, FALSE );\r\n          if ( error )\r\n            goto Exit;\r\n\r\n          /* restore subglyph pointer */\r\n          subglyph = gloader->base.subglyphs + num_base_subgs + n;\r\n\r\n          if ( !( subglyph->flags & USE_MY_METRICS ) )\r\n          {\r\n            loader->pp1 = pp[0];\r\n            loader->pp2 = pp[1];\r\n            loader->pp3 = pp[2];\r\n            loader->pp4 = pp[3];\r\n          }\r\n\r\n          num_points = gloader->base.outline.n_points;\r\n\r\n          if ( num_points == num_base_points )\r\n            continue;\r\n\r\n          /* gloader->base.outline consists of three parts:               */\r\n          /* 0 -(1)-> start_point -(2)-> num_base_points -(3)-> n_points. */\r\n          /*                                                              */\r\n          /* (1): exists from the beginning                               */\r\n          /* (2): components that have been loaded so far                 */\r\n          /* (3): the newly loaded component                              */\r\n          TT_Process_Composite_Component( loader, subglyph, start_point,\r\n                                          num_base_points );\r\n        }\r\n\r\n        loader->stream   = old_stream;\r\n        loader->byte_len = old_byte_len;\r\n\r\n        /* process the glyph */\r\n        loader->ins_pos = ins_pos;\r\n        if ( IS_HINTED( loader->load_flags ) &&\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n             subglyph->flags & WE_HAVE_INSTR &&\r\n\r\n#endif\r\n\r\n             num_points > start_point )\r\n          TT_Process_Composite_Glyph( loader, start_point, start_contour );\r\n\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* invalid composite count (negative but not -1) */\r\n      error = TT_Err_Invalid_Outline;\r\n      goto Exit;\r\n    }\r\n\r\n    /***********************************************************************/\r\n    /***********************************************************************/\r\n    /***********************************************************************/\r\n\r\n  Exit:\r\n\r\n    if ( opened_frame )\r\n      face->forget_glyph_frame( loader );\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    if ( glyph_data_loaded )\r\n      face->root.internal->incremental_interface->funcs->free_glyph_data(\r\n        face->root.internal->incremental_interface->object,\r\n        &glyph_data );\r\n\r\n#endif\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  compute_glyph_metrics( TT_Loader  loader,\r\n                         FT_UInt    glyph_index )\r\n  {\r\n    FT_BBox       bbox;\r\n    TT_Face       face = (TT_Face)loader->face;\r\n    FT_Fixed      y_scale;\r\n    TT_GlyphSlot  glyph = loader->glyph;\r\n    TT_Size       size = (TT_Size)loader->size;\r\n\r\n\r\n    y_scale = 0x10000L;\r\n    if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n      y_scale = size->root.metrics.y_scale;\r\n\r\n    if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE )\r\n      FT_Outline_Get_CBox( &glyph->outline, &bbox );\r\n    else\r\n      bbox = loader->bbox;\r\n\r\n    /* get the device-independent horizontal advance; it is scaled later */\r\n    /* by the base layer.                                                */\r\n    glyph->linearHoriAdvance = loader->linear;\r\n\r\n    glyph->metrics.horiBearingX = bbox.xMin;\r\n    glyph->metrics.horiBearingY = bbox.yMax;\r\n    glyph->metrics.horiAdvance  = loader->pp2.x - loader->pp1.x;\r\n\r\n    /* adjust advance width to the value contained in the hdmx table */\r\n    if ( !face->postscript.isFixedPitch  &&\r\n         IS_HINTED( loader->load_flags ) )\r\n    {\r\n      FT_Byte*  widthp;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      FT_Bool  ignore_x_mode;\r\n\r\n\r\n      ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) !=\r\n                               FT_RENDER_MODE_MONO );\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      widthp = tt_face_get_device_metrics( face,\r\n                                           size->root.metrics.x_ppem,\r\n                                           glyph_index );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( widthp                                                   &&\r\n           ( ( ignore_x_mode && loader->exec->compatible_widths ) ||\r\n              !ignore_x_mode                                      ||\r\n              SPH_OPTION_BITMAP_WIDTHS                            ) )\r\n#else\r\n      if ( widthp )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n        glyph->metrics.horiAdvance = *widthp << 6;\r\n    }\r\n\r\n    /* set glyph dimensions */\r\n    glyph->metrics.width  = bbox.xMax - bbox.xMin;\r\n    glyph->metrics.height = bbox.yMax - bbox.yMin;\r\n\r\n    /* Now take care of vertical metrics.  In the case where there is */\r\n    /* no vertical information within the font (relatively common),   */\r\n    /* create some metrics manually                                   */\r\n    {\r\n      FT_Pos  top;      /* scaled vertical top side bearing  */\r\n      FT_Pos  advance;  /* scaled vertical advance height    */\r\n\r\n\r\n      /* Get the unscaled top bearing and advance height. */\r\n      if ( face->vertical_info                   &&\r\n           face->vertical.number_Of_VMetrics > 0 )\r\n      {\r\n        top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,\r\n                                   y_scale );\r\n\r\n        if ( loader->pp3.y <= loader->pp4.y )\r\n          advance = 0;\r\n        else\r\n          advance = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y,\r\n                                          y_scale );\r\n      }\r\n      else\r\n      {\r\n        FT_Pos  height;\r\n\r\n\r\n        /* XXX Compute top side bearing and advance height in  */\r\n        /*     Get_VMetrics instead of here.                   */\r\n\r\n        /* NOTE: The OS/2 values are the only `portable' ones, */\r\n        /*       which is why we use them, if there is an OS/2 */\r\n        /*       table in the font.  Otherwise, we use the     */\r\n        /*       values defined in the horizontal header.      */\r\n\r\n        height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin,\r\n                                      y_scale );\r\n        if ( face->os2.version != 0xFFFFU )\r\n          advance = (FT_Pos)( face->os2.sTypoAscender -\r\n                              face->os2.sTypoDescender );\r\n        else\r\n          advance = (FT_Pos)( face->horizontal.Ascender -\r\n                              face->horizontal.Descender );\r\n\r\n        top = ( advance - height ) / 2;\r\n      }\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n      {\r\n        FT_Incremental_InterfaceRec*  incr;\r\n        FT_Incremental_MetricsRec     metrics;\r\n        FT_Error                      error;\r\n\r\n\r\n        incr = face->root.internal->incremental_interface;\r\n\r\n        /* If this is an incrementally loaded font see if there are */\r\n        /* overriding metrics for this glyph.                       */\r\n        if ( incr && incr->funcs->get_glyph_metrics )\r\n        {\r\n          metrics.bearing_x = 0;\r\n          metrics.bearing_y = top;\r\n          metrics.advance   = advance;\r\n\r\n          error = incr->funcs->get_glyph_metrics( incr->object,\r\n                                                  glyph_index,\r\n                                                  TRUE,\r\n                                                  &metrics );\r\n          if ( error )\r\n            return error;\r\n\r\n          top     = metrics.bearing_y;\r\n          advance = metrics.advance;\r\n        }\r\n      }\r\n\r\n      /* GWW: Do vertical metrics get loaded incrementally too? */\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n      glyph->linearVertAdvance = advance;\r\n\r\n      /* scale the metrics */\r\n      if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )\r\n      {\r\n        top     = FT_MulFix( top,     y_scale );\r\n        advance = FT_MulFix( advance, y_scale );\r\n      }\r\n\r\n      /* XXX: for now, we have no better algorithm for the lsb, but it */\r\n      /*      should work fine.                                        */\r\n      /*                                                               */\r\n      glyph->metrics.vertBearingX = glyph->metrics.horiBearingX -\r\n                                      glyph->metrics.horiAdvance / 2;\r\n      glyph->metrics.vertBearingY = top;\r\n      glyph->metrics.vertAdvance  = advance;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n  static FT_Error\r\n  load_sbit_image( TT_Size       size,\r\n                   TT_GlyphSlot  glyph,\r\n                   FT_UInt       glyph_index,\r\n                   FT_Int32      load_flags )\r\n  {\r\n    TT_Face             face;\r\n    SFNT_Service        sfnt;\r\n    FT_Stream           stream;\r\n    FT_Error            error;\r\n    TT_SBit_MetricsRec  metrics;\r\n\r\n\r\n    face   = (TT_Face)glyph->face;\r\n    sfnt   = (SFNT_Service)face->sfnt;\r\n    stream = face->root.stream;\r\n\r\n    error = sfnt->load_sbit_image( face,\r\n                                   size->strike_index,\r\n                                   glyph_index,\r\n                                   (FT_Int)load_flags,\r\n                                   stream,\r\n                                   &glyph->bitmap,\r\n                                   &metrics );\r\n    if ( !error )\r\n    {\r\n      glyph->outline.n_points   = 0;\r\n      glyph->outline.n_contours = 0;\r\n\r\n      glyph->metrics.width  = (FT_Pos)metrics.width  << 6;\r\n      glyph->metrics.height = (FT_Pos)metrics.height << 6;\r\n\r\n      glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;\r\n      glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;\r\n      glyph->metrics.horiAdvance  = (FT_Pos)metrics.horiAdvance  << 6;\r\n\r\n      glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;\r\n      glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;\r\n      glyph->metrics.vertAdvance  = (FT_Pos)metrics.vertAdvance  << 6;\r\n\r\n      glyph->format = FT_GLYPH_FORMAT_BITMAP;\r\n\r\n      if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n      {\r\n        glyph->bitmap_left = metrics.vertBearingX;\r\n        glyph->bitmap_top  = metrics.vertBearingY;\r\n      }\r\n      else\r\n      {\r\n        glyph->bitmap_left = metrics.horiBearingX;\r\n        glyph->bitmap_top  = metrics.horiBearingY;\r\n      }\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n\r\n  static FT_Error\r\n  tt_loader_init( TT_Loader     loader,\r\n                  TT_Size       size,\r\n                  TT_GlyphSlot  glyph,\r\n                  FT_Int32      load_flags,\r\n                  FT_Bool       glyf_table_only )\r\n  {\r\n    TT_Face    face;\r\n    FT_Stream  stream;\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    FT_Bool    pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );\r\n#endif\r\n\r\n\r\n    face   = (TT_Face)glyph->face;\r\n    stream = face->root.stream;\r\n\r\n    FT_MEM_ZERO( loader, sizeof ( TT_LoaderRec ) );\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    /* load execution context */\r\n    if ( IS_HINTED( load_flags ) && !glyf_table_only )\r\n    {\r\n      TT_ExecContext  exec;\r\n      FT_Bool         grayscale;\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      FT_Bool         subpixel_hinting;\r\n      FT_Bool         grayscale_hinting;\r\n#if 0\r\n      FT_Bool         compatible_widths;\r\n      FT_Bool         symmetrical_smoothing;\r\n      FT_Bool         bgr;\r\n      FT_Bool         subpixel_positioned;\r\n#endif\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n      if ( !size->cvt_ready )\r\n      {\r\n        FT_Error  error = tt_size_ready_bytecode( size, pedantic );\r\n\r\n\r\n        if ( error )\r\n          return error;\r\n      }\r\n\r\n      /* query new execution context */\r\n      exec = size->debug ? size->context\r\n                         : ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;\r\n      if ( !exec )\r\n        return TT_Err_Could_Not_Find_Context;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n      subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags )\r\n                                    != FT_RENDER_MODE_MONO )          &&\r\n                                  SPH_OPTION_SET_SUBPIXEL             );\r\n\r\n      if ( subpixel_hinting )\r\n        grayscale = grayscale_hinting = FALSE;\r\n\r\n      else if ( SPH_OPTION_SET_GRAYSCALE )\r\n      {\r\n        grayscale = grayscale_hinting = TRUE;\r\n        subpixel_hinting = FALSE;\r\n      }\r\n\r\n      if ( FT_IS_TRICKY( glyph->face ) )\r\n        subpixel_hinting = grayscale_hinting = FALSE;\r\n\r\n      exec->ignore_x_mode      = subpixel_hinting || grayscale_hinting;\r\n      exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;\r\n      if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )\r\n        exec->rasterizer_version = 35;\r\n\r\n#if 1\r\n      exec->compatible_widths     = SPH_OPTION_SET_COMPATIBLE_WIDTHS;\r\n      exec->symmetrical_smoothing = FALSE;\r\n      exec->bgr                   = FALSE;\r\n      exec->subpixel_positioned   = TRUE;\r\n#else /* 0 */\r\n      exec->compatible_widths =\r\n        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=\r\n                 TT_LOAD_COMPATIBLE_WIDTHS );\r\n      exec->symmetrical_smoothing =\r\n        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=\r\n                 TT_LOAD_SYMMETRICAL_SMOOTHING );\r\n      exec->bgr =\r\n        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=\r\n                 TT_LOAD_BGR );\r\n      exec->subpixel_positioned =\r\n        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=\r\n                 TT_LOAD_SUBPIXEL_POSITIONED );\r\n#endif /* 0 */\r\n\r\n#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      grayscale =\r\n        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_RENDER_MODE_MONO );\r\n\r\n#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      TT_Load_Context( exec, face, size );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n      /* a change from mono to subpixel rendering (and vice versa) */\r\n      /* requires a re-execution of the CVT program                */\r\n      if ( subpixel_hinting != exec->subpixel_hinting )\r\n      {\r\n        FT_UInt  i;\r\n\r\n\r\n        exec->subpixel_hinting = subpixel_hinting;\r\n\r\n        for ( i = 0; i < size->cvt_size; i++ )\r\n          size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );\r\n        tt_size_run_prep( size, pedantic );\r\n      }\r\n\r\n      /* a change from mono to grayscale rendering (and vice versa) */\r\n      /* requires a re-execution of the CVT program                 */\r\n      if ( grayscale != exec->grayscale_hinting )\r\n      {\r\n        FT_UInt  i;\r\n\r\n\r\n        exec->grayscale_hinting = grayscale_hinting;\r\n\r\n        for ( i = 0; i < size->cvt_size; i++ )\r\n          size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );\r\n        tt_size_run_prep( size, pedantic );\r\n      }\r\n\r\n#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      /* a change from mono to grayscale rendering (and vice versa) */\r\n      /* requires a re-execution of the CVT program                 */\r\n      if ( grayscale != exec->grayscale )\r\n      {\r\n        FT_UInt  i;\r\n\r\n\r\n        FT_TRACE4(( \"tt_loader_init: grayscale change,\"\r\n                    \" re-executing `prep' table\\n\" ));\r\n\r\n        exec->grayscale = grayscale;\r\n\r\n        for ( i = 0; i < size->cvt_size; i++ )\r\n          size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );\r\n        tt_size_run_prep( size, pedantic );\r\n      }\r\n\r\n#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      /* see whether the cvt program has disabled hinting */\r\n      if ( exec->GS.instruct_control & 1 )\r\n        load_flags |= FT_LOAD_NO_HINTING;\r\n\r\n      /* load default graphics state -- if needed */\r\n      if ( exec->GS.instruct_control & 2 )\r\n        exec->GS = tt_default_graphics_state;\r\n\r\n      exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );\r\n      loader->exec = exec;\r\n      loader->instructions = exec->glyphIns;\r\n    }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    /* seek to the beginning of the glyph table -- for Type 42 fonts     */\r\n    /* the table might be accessed from a Postscript stream or something */\r\n    /* else...                                                           */\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    if ( face->root.internal->incremental_interface )\r\n      loader->glyf_offset = 0;\r\n    else\r\n\r\n#endif\r\n\r\n    {\r\n      FT_Error  error = face->goto_table( face, TTAG_glyf, stream, 0 );\r\n\r\n\r\n      if ( error == TT_Err_Table_Missing )\r\n        loader->glyf_offset = 0;\r\n      else if ( error )\r\n      {\r\n        FT_ERROR(( \"tt_loader_init: could not access glyph table\\n\" ));\r\n        return error;\r\n      }\r\n      else\r\n        loader->glyf_offset = FT_STREAM_POS();\r\n    }\r\n\r\n    /* get face's glyph loader */\r\n    if ( !glyf_table_only )\r\n    {\r\n      FT_GlyphLoader  gloader = glyph->internal->loader;\r\n\r\n\r\n      FT_GlyphLoader_Rewind( gloader );\r\n      loader->gloader = gloader;\r\n    }\r\n\r\n    loader->load_flags = load_flags;\r\n\r\n    loader->face   = (FT_Face)face;\r\n    loader->size   = (FT_Size)size;\r\n    loader->glyph  = (FT_GlyphSlot)glyph;\r\n    loader->stream = stream;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Load_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to load a single glyph within a given glyph slot,  */\r\n  /*    for a given size.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph       :: A handle to a target slot object where the glyph    */\r\n  /*                   will be loaded.                                     */\r\n  /*                                                                       */\r\n  /*    size        :: A handle to the source face size at which the glyph */\r\n  /*                   must be scaled/loaded.                              */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The index of the glyph in the font file.            */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   FT_LOAD_XXX constants can be used to control the    */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Load_Glyph( TT_Size       size,\r\n                 TT_GlyphSlot  glyph,\r\n                 FT_UInt       glyph_index,\r\n                 FT_Int32      load_flags )\r\n  {\r\n    FT_Error      error;\r\n    TT_LoaderRec  loader;\r\n\r\n\r\n    error = TT_Err_Ok;\r\n\r\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n    /* try to load embedded bitmap if any              */\r\n    /*                                                 */\r\n    /* XXX: The convention should be emphasized in     */\r\n    /*      the documents because it can be confusing. */\r\n    if ( size->strike_index != 0xFFFFFFFFUL      &&\r\n         ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )\r\n    {\r\n      error = load_sbit_image( size, glyph, glyph_index, load_flags );\r\n      if ( !error )\r\n      {\r\n        if ( FT_IS_SCALABLE( glyph->face ) )\r\n        {\r\n          /* for the bbox we need the header only */\r\n          (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );\r\n          (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );\r\n          glyph->linearHoriAdvance = loader.linear;\r\n          glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax -\r\n                                       loader.vadvance;\r\n        }\r\n\r\n        return TT_Err_Ok;\r\n      }\r\n    }\r\n\r\n#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */\r\n\r\n    /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */\r\n    if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid )\r\n      return TT_Err_Invalid_Size_Handle;\r\n\r\n    if ( load_flags & FT_LOAD_SBITS_ONLY )\r\n      return TT_Err_Invalid_Argument;\r\n\r\n    error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );\r\n    if ( error )\r\n      return error;\r\n\r\n    glyph->format        = FT_GLYPH_FORMAT_OUTLINE;\r\n    glyph->num_subglyphs = 0;\r\n    glyph->outline.flags = 0;\r\n\r\n    /* main loading loop */\r\n    error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );\r\n    if ( !error )\r\n    {\r\n      if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE )\r\n      {\r\n        glyph->num_subglyphs = loader.gloader->base.num_subglyphs;\r\n        glyph->subglyphs     = loader.gloader->base.subglyphs;\r\n      }\r\n      else\r\n      {\r\n        glyph->outline        = loader.gloader->base.outline;\r\n        glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;\r\n\r\n        /* Translate array so that (0,0) is the glyph's origin.  Note  */\r\n        /* that this behaviour is independent on the value of bit 1 of */\r\n        /* the `flags' field in the `head' table -- at least major     */\r\n        /* applications like Acroread indicate that.                   */\r\n        if ( loader.pp1.x )\r\n          FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );\r\n      }\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n      if ( IS_HINTED( load_flags ) )\r\n      {\r\n        if ( loader.exec->GS.scan_control )\r\n        {\r\n          /* convert scan conversion mode to FT_OUTLINE_XXX flags */\r\n          switch ( loader.exec->GS.scan_type )\r\n          {\r\n          case 0: /* simple drop-outs including stubs */\r\n            glyph->outline.flags |= FT_OUTLINE_INCLUDE_STUBS;\r\n            break;\r\n          case 1: /* simple drop-outs excluding stubs */\r\n            /* nothing; it's the default rendering mode */\r\n            break;\r\n          case 4: /* smart drop-outs including stubs */\r\n            glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS |\r\n                                    FT_OUTLINE_INCLUDE_STUBS;\r\n            break;\r\n          case 5: /* smart drop-outs excluding stubs  */\r\n            glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS;\r\n            break;\r\n\r\n          default: /* no drop-out control */\r\n            glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;\r\n            break;\r\n          }\r\n        }\r\n        else\r\n          glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;\r\n      }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n      compute_glyph_metrics( &loader, glyph_index );\r\n    }\r\n\r\n    /* Set the `high precision' bit flag.                           */\r\n    /* This is _critical_ to get correct output for monochrome      */\r\n    /* TrueType glyphs at all sizes using the bytecode interpreter. */\r\n    /*                                                              */\r\n    if ( !( load_flags & FT_LOAD_NO_SCALE ) &&\r\n         size->root.metrics.y_ppem < 24     )\r\n      glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttgload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttgload.h                                                              */\r\n/*                                                                         */\r\n/*    TrueType Glyph Loader (specification).                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2006, 2008, 2011 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTGLOAD_H__\r\n#define __TTGLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ttobjs.h\"\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n#include \"ttinterp.h\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( void )\r\n  TT_Init_Glyph_Loading( TT_Face  face );\r\n\r\n  FT_LOCAL( void )\r\n  TT_Get_HMetrics( TT_Face     face,\r\n                   FT_UInt     idx,\r\n                   FT_Short*   lsb,\r\n                   FT_UShort*  aw );\r\n\r\n  FT_LOCAL( void )\r\n  TT_Get_VMetrics( TT_Face     face,\r\n                   FT_UInt     idx,\r\n                   FT_Short*   tsb,\r\n                   FT_UShort*  ah );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Load_Glyph( TT_Size       size,\r\n                 TT_GlyphSlot  glyph,\r\n                 FT_UInt       glyph_index,\r\n                 FT_Int32      load_flags );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTGLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttgxvar.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttgxvar.c                                                              */\r\n/*                                                                         */\r\n/*    TrueType GX Font Variation loader                                    */\r\n/*                                                                         */\r\n/*  Copyright 2004-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.     */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at      */\r\n  /*                                                                       */\r\n  /*   http://developer.apple.com/fonts/TTRefMan/RM06/Chap6[fgca]var.html  */\r\n  /*                                                                       */\r\n  /* The documentation for `fvar' is inconsistent.  At one point it says   */\r\n  /* that `countSizePairs' should be 3, at another point 2.  It should     */\r\n  /* be 2.                                                                 */\r\n  /*                                                                       */\r\n  /* The documentation for `gvar' is not intelligible; `cvar' refers you   */\r\n  /* to `gvar' and is thus also incomprehensible.                          */\r\n  /*                                                                       */\r\n  /* The documentation for `avar' appears correct, but Apple has no fonts  */\r\n  /* with an `avar' table, so it is hard to test.                          */\r\n  /*                                                                       */\r\n  /* Many thanks to John Jenkins (at Apple) in figuring this out.          */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* Apple's `kern' table has some references to tuple indices, but as     */\r\n  /* there is no indication where these indices are defined, nor how to    */\r\n  /* interpolate the kerning values (different tuples have different       */\r\n  /* classes) this issue is ignored.                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4245 : 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch\r\n#pragma warning( disable : 4245 )\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_MULTIPLE_MASTERS_H\r\n\r\n#include \"ttpload.h\"\r\n#include \"ttgxvar.h\"\r\n\r\n#include \"tterrors.h\"\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n\r\n\r\n#define FT_Stream_FTell( stream )  \\\r\n          ( (stream)->cursor - (stream)->base )\r\n#define FT_Stream_SeekSet( stream, off ) \\\r\n              ( (stream)->cursor = (stream)->base+(off) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttgxvar\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       Internal Routines                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro ALL_POINTS is used in `ft_var_readpackedpoints'.  It        */\r\n  /* indicates that there is a delta for every point without needing to    */\r\n  /* enumerate all of them.                                                */\r\n  /*                                                                       */\r\n#define ALL_POINTS  (FT_UShort*)( ~0 )\r\n\r\n\r\n#define GX_PT_POINTS_ARE_WORDS      0x80\r\n#define GX_PT_POINT_RUN_COUNT_MASK  0x7F\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_var_readpackedpoints                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Read a set of points to which the following deltas will apply.     */\r\n  /*    Points are packed with a run length encoding.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream    :: The data stream.                                      */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    point_cnt :: The number of points read.  A zero value means that   */\r\n  /*                 all points in the glyph will be affected, without     */\r\n  /*                 enumerating them individually.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    An array of FT_UShort containing the affected points or the        */\r\n  /*    special value ALL_POINTS.                                          */\r\n  /*                                                                       */\r\n  static FT_UShort*\r\n  ft_var_readpackedpoints( FT_Stream  stream,\r\n                           FT_UInt   *point_cnt )\r\n  {\r\n    FT_UShort *points = NULL;\r\n    FT_Int     n;\r\n    FT_Int     runcnt;\r\n    FT_Int     i;\r\n    FT_Int     j;\r\n    FT_Int     first;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_Error   error  = TT_Err_Ok;\r\n\r\n    FT_UNUSED( error );\r\n\r\n\r\n    *point_cnt = n = FT_GET_BYTE();\r\n    if ( n == 0 )\r\n      return ALL_POINTS;\r\n\r\n    if ( n & GX_PT_POINTS_ARE_WORDS )\r\n      n = FT_GET_BYTE() | ( ( n & GX_PT_POINT_RUN_COUNT_MASK ) << 8 );\r\n\r\n    if ( FT_NEW_ARRAY( points, n ) )\r\n      return NULL;\r\n\r\n    i = 0;\r\n    while ( i < n )\r\n    {\r\n      runcnt = FT_GET_BYTE();\r\n      if ( runcnt & GX_PT_POINTS_ARE_WORDS )\r\n      {\r\n        runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK;\r\n        first  = points[i++] = FT_GET_USHORT();\r\n\r\n        if ( runcnt < 1 || i + runcnt >= n )\r\n          goto Exit;\r\n\r\n        /* first point not included in runcount */\r\n        for ( j = 0; j < runcnt; ++j )\r\n          points[i++] = (FT_UShort)( first += FT_GET_USHORT() );\r\n      }\r\n      else\r\n      {\r\n        first = points[i++] = FT_GET_BYTE();\r\n\r\n        if ( runcnt < 1 || i + runcnt >= n )\r\n          goto Exit;\r\n\r\n        for ( j = 0; j < runcnt; ++j )\r\n          points[i++] = (FT_UShort)( first += FT_GET_BYTE() );\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return points;\r\n  }\r\n\r\n\r\n  enum\r\n  {\r\n    GX_DT_DELTAS_ARE_ZERO      = 0x80,\r\n    GX_DT_DELTAS_ARE_WORDS     = 0x40,\r\n    GX_DT_DELTA_RUN_COUNT_MASK = 0x3F\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_var_readpackeddeltas                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Read a set of deltas.  These are packed slightly differently than  */\r\n  /*    points.  In particular there is no overall count.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream    :: The data stream.                                      */\r\n  /*                                                                       */\r\n  /*    delta_cnt :: The number of to be read.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    An array of FT_Short containing the deltas for the affected        */\r\n  /*    points.  (This only gets the deltas for one dimension.  It will    */\r\n  /*    generally be called twice, once for x, once for y.  When used in   */\r\n  /*    cvt table, it will only be called once.)                           */\r\n  /*                                                                       */\r\n  static FT_Short*\r\n  ft_var_readpackeddeltas( FT_Stream  stream,\r\n                           FT_Offset  delta_cnt )\r\n  {\r\n    FT_Short  *deltas = NULL;\r\n    FT_UInt    runcnt;\r\n    FT_Offset  i;\r\n    FT_UInt    j;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_Error   error  = TT_Err_Ok;\r\n\r\n    FT_UNUSED( error );\r\n\r\n\r\n    if ( FT_NEW_ARRAY( deltas, delta_cnt ) )\r\n      return NULL;\r\n\r\n    i = 0;\r\n    while ( i < delta_cnt )\r\n    {\r\n      runcnt = FT_GET_BYTE();\r\n      if ( runcnt & GX_DT_DELTAS_ARE_ZERO )\r\n      {\r\n        /* runcnt zeroes get added */\r\n        for ( j = 0;\r\n              j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) && i < delta_cnt;\r\n              ++j )\r\n          deltas[i++] = 0;\r\n      }\r\n      else if ( runcnt & GX_DT_DELTAS_ARE_WORDS )\r\n      {\r\n        /* runcnt shorts from the stack */\r\n        for ( j = 0;\r\n              j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) && i < delta_cnt;\r\n              ++j )\r\n          deltas[i++] = FT_GET_SHORT();\r\n      }\r\n      else\r\n      {\r\n        /* runcnt signed bytes from the stack */\r\n        for ( j = 0;\r\n              j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) && i < delta_cnt;\r\n              ++j )\r\n          deltas[i++] = FT_GET_CHAR();\r\n      }\r\n\r\n      if ( j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) )\r\n      {\r\n        /* Bad format */\r\n        FT_FREE( deltas );\r\n        return NULL;\r\n      }\r\n    }\r\n\r\n    return deltas;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_var_load_avar                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parse the `avar' table if present.  It need not be, so we return   */\r\n  /*    nothing.                                                           */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face :: The font face.                                             */\r\n  /*                                                                       */\r\n  static void\r\n  ft_var_load_avar( TT_Face  face )\r\n  {\r\n    FT_Stream       stream = FT_FACE_STREAM(face);\r\n    FT_Memory       memory = stream->memory;\r\n    GX_Blend        blend  = face->blend;\r\n    GX_AVarSegment  segment;\r\n    FT_Error        error = TT_Err_Ok;\r\n    FT_ULong        version;\r\n    FT_Long         axisCount;\r\n    FT_Int          i, j;\r\n    FT_ULong        table_len;\r\n\r\n    FT_UNUSED( error );\r\n\r\n\r\n    blend->avar_checked = TRUE;\r\n    if ( (error = face->goto_table( face, TTAG_avar, stream, &table_len )) != 0 )\r\n      return;\r\n\r\n    if ( FT_FRAME_ENTER( table_len ) )\r\n      return;\r\n\r\n    version   = FT_GET_LONG();\r\n    axisCount = FT_GET_LONG();\r\n\r\n    if ( version != 0x00010000L                       ||\r\n         axisCount != (FT_Long)blend->mmvar->num_axis )\r\n      goto Exit;\r\n\r\n    if ( FT_NEW_ARRAY( blend->avar_segment, axisCount ) )\r\n      goto Exit;\r\n\r\n    segment = &blend->avar_segment[0];\r\n    for ( i = 0; i < axisCount; ++i, ++segment )\r\n    {\r\n      segment->pairCount = FT_GET_USHORT();\r\n      if ( FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )\r\n      {\r\n        /* Failure.  Free everything we have done so far.  We must do */\r\n        /* it right now since loading the `avar' table is optional.   */\r\n\r\n        for ( j = i - 1; j >= 0; --j )\r\n          FT_FREE( blend->avar_segment[j].correspondence );\r\n\r\n        FT_FREE( blend->avar_segment );\r\n        blend->avar_segment = NULL;\r\n        goto Exit;\r\n      }\r\n\r\n      for ( j = 0; j < segment->pairCount; ++j )\r\n      {\r\n        segment->correspondence[j].fromCoord =\r\n          FT_GET_SHORT() << 2;    /* convert to Fixed */\r\n        segment->correspondence[j].toCoord =\r\n          FT_GET_SHORT()<<2;    /* convert to Fixed */\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    FT_FRAME_EXIT();\r\n  }\r\n\r\n\r\n  typedef struct  GX_GVar_Head_\r\n  {\r\n    FT_Long    version;\r\n    FT_UShort  axisCount;\r\n    FT_UShort  globalCoordCount;\r\n    FT_ULong   offsetToCoord;\r\n    FT_UShort  glyphCount;\r\n    FT_UShort  flags;\r\n    FT_ULong   offsetToData;\r\n\r\n  } GX_GVar_Head;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_var_load_gvar                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parses the `gvar' table if present.  If `fvar' is there, `gvar'    */\r\n  /*    had better be there too.                                           */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face :: The font face.                                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  ft_var_load_gvar( TT_Face  face )\r\n  {\r\n    FT_Stream     stream = FT_FACE_STREAM(face);\r\n    FT_Memory     memory = stream->memory;\r\n    GX_Blend      blend  = face->blend;\r\n    FT_Error      error;\r\n    FT_UInt       i, j;\r\n    FT_ULong      table_len;\r\n    FT_ULong      gvar_start;\r\n    FT_ULong      offsetToData;\r\n    GX_GVar_Head  gvar_head;\r\n\r\n    static const FT_Frame_Field  gvar_fields[] =\r\n    {\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  GX_GVar_Head\r\n\r\n      FT_FRAME_START( 20 ),\r\n        FT_FRAME_LONG  ( version ),\r\n        FT_FRAME_USHORT( axisCount ),\r\n        FT_FRAME_USHORT( globalCoordCount ),\r\n        FT_FRAME_ULONG ( offsetToCoord ),\r\n        FT_FRAME_USHORT( glyphCount ),\r\n        FT_FRAME_USHORT( flags ),\r\n        FT_FRAME_ULONG ( offsetToData ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    if ( (error = face->goto_table( face, TTAG_gvar, stream, &table_len )) != 0 )\r\n      goto Exit;\r\n\r\n    gvar_start = FT_STREAM_POS( );\r\n    if ( FT_STREAM_READ_FIELDS( gvar_fields, &gvar_head ) )\r\n      goto Exit;\r\n\r\n    blend->tuplecount  = gvar_head.globalCoordCount;\r\n    blend->gv_glyphcnt = gvar_head.glyphCount;\r\n    offsetToData       = gvar_start + gvar_head.offsetToData;\r\n\r\n    if ( gvar_head.version   != (FT_Long)0x00010000L              ||\r\n         gvar_head.axisCount != (FT_UShort)blend->mmvar->num_axis )\r\n    {\r\n      error = TT_Err_Invalid_Table;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) )\r\n      goto Exit;\r\n\r\n    if ( gvar_head.flags & 1 )\r\n    {\r\n      /* long offsets (one more offset than glyphs, to mark size of last) */\r\n      if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) )\r\n        goto Exit;\r\n\r\n      for ( i = 0; i <= blend->gv_glyphcnt; ++i )\r\n        blend->glyphoffsets[i] = offsetToData + FT_GET_LONG();\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n    else\r\n    {\r\n      /* short offsets (one more offset than glyphs, to mark size of last) */\r\n      if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) )\r\n        goto Exit;\r\n\r\n      for ( i = 0; i <= blend->gv_glyphcnt; ++i )\r\n        blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2;\r\n                                              /* XXX: Undocumented: `*2'! */\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n    if ( blend->tuplecount != 0 )\r\n    {\r\n      if ( FT_NEW_ARRAY( blend->tuplecoords,\r\n                         gvar_head.axisCount * blend->tuplecount ) )\r\n        goto Exit;\r\n\r\n      if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord )       ||\r\n           FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L )                   )\r\n        goto Exit;\r\n\r\n      for ( i = 0; i < blend->tuplecount; ++i )\r\n        for ( j = 0 ; j < (FT_UInt)gvar_head.axisCount; ++j )\r\n          blend->tuplecoords[i * gvar_head.axisCount + j] =\r\n            FT_GET_SHORT() << 2;                /* convert to FT_Fixed */\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    ft_var_apply_tuple                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Figure out whether a given tuple (design) applies to the current   */\r\n  /*    blend, and if so, what is the scaling factor.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    blend           :: The current blend of the font.                  */\r\n  /*                                                                       */\r\n  /*    tupleIndex      :: A flag saying whether this is an intermediate   */\r\n  /*                       tuple or not.                                   */\r\n  /*                                                                       */\r\n  /*    tuple_coords    :: The coordinates of the tuple in normalized axis */\r\n  /*                       units.                                          */\r\n  /*                                                                       */\r\n  /*    im_start_coords :: The initial coordinates where this tuple starts */\r\n  /*                       to apply (for intermediate coordinates).        */\r\n  /*                                                                       */\r\n  /*    im_end_coords   :: The final coordinates after which this tuple no */\r\n  /*                       longer applies (for intermediate coordinates).  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    An FT_Fixed value containing the scaling factor.                   */\r\n  /*                                                                       */\r\n  static FT_Fixed\r\n  ft_var_apply_tuple( GX_Blend   blend,\r\n                      FT_UShort  tupleIndex,\r\n                      FT_Fixed*  tuple_coords,\r\n                      FT_Fixed*  im_start_coords,\r\n                      FT_Fixed*  im_end_coords )\r\n  {\r\n    FT_UInt   i;\r\n    FT_Fixed  apply = 0x10000L;\r\n\r\n\r\n    for ( i = 0; i < blend->num_axis; ++i )\r\n    {\r\n      if ( tuple_coords[i] == 0 )\r\n        /* It's not clear why (for intermediate tuples) we don't need     */\r\n        /* to check against start/end -- the documentation says we don't. */\r\n        /* Similarly, it's unclear why we don't need to scale along the   */\r\n        /* axis.                                                          */\r\n        continue;\r\n\r\n      else if ( blend->normalizedcoords[i] == 0                           ||\r\n                ( blend->normalizedcoords[i] < 0 && tuple_coords[i] > 0 ) ||\r\n                ( blend->normalizedcoords[i] > 0 && tuple_coords[i] < 0 ) )\r\n      {\r\n        apply = 0;\r\n        break;\r\n      }\r\n\r\n      else if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) )\r\n        /* not an intermediate tuple */\r\n        apply = FT_MulFix( apply,\r\n                           blend->normalizedcoords[i] > 0\r\n                             ? blend->normalizedcoords[i]\r\n                             : -blend->normalizedcoords[i] );\r\n\r\n      else if ( blend->normalizedcoords[i] <= im_start_coords[i] ||\r\n                blend->normalizedcoords[i] >= im_end_coords[i]   )\r\n      {\r\n        apply = 0;\r\n        break;\r\n      }\r\n\r\n      else if ( blend->normalizedcoords[i] < tuple_coords[i] )\r\n        apply = FT_MulDiv( apply,\r\n                           blend->normalizedcoords[i] - im_start_coords[i],\r\n                           tuple_coords[i] - im_start_coords[i] );\r\n\r\n      else\r\n        apply = FT_MulDiv( apply,\r\n                           im_end_coords[i] - blend->normalizedcoords[i],\r\n                           im_end_coords[i] - tuple_coords[i] );\r\n    }\r\n\r\n    return apply;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****               MULTIPLE MASTERS SERVICE FUNCTIONS              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct  GX_FVar_Head_\r\n  {\r\n    FT_Long    version;\r\n    FT_UShort  offsetToData;\r\n    FT_UShort  countSizePairs;\r\n    FT_UShort  axisCount;\r\n    FT_UShort  axisSize;\r\n    FT_UShort  instanceCount;\r\n    FT_UShort  instanceSize;\r\n\r\n  } GX_FVar_Head;\r\n\r\n\r\n  typedef struct  fvar_axis_\r\n  {\r\n    FT_ULong   axisTag;\r\n    FT_ULong   minValue;\r\n    FT_ULong   defaultValue;\r\n    FT_ULong   maxValue;\r\n    FT_UShort  flags;\r\n    FT_UShort  nameID;\r\n\r\n  } GX_FVar_Axis;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Get_MM_Var                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check that the font's `fvar' table is valid, parse it, and return  */\r\n  /*    those data.                                                        */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: The font face.                                           */\r\n  /*              TT_Get_MM_Var initializes the blend structure.           */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    master :: The `fvar' data (must be freed by caller).               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Get_MM_Var( TT_Face      face,\r\n                 FT_MM_Var*  *master )\r\n  {\r\n    FT_Stream            stream = face->root.stream;\r\n    FT_Memory            memory = face->root.memory;\r\n    FT_ULong             table_len;\r\n    FT_Error             error  = TT_Err_Ok;\r\n    FT_ULong             fvar_start;\r\n    FT_Int               i, j;\r\n    FT_MM_Var*           mmvar = NULL;\r\n    FT_Fixed*            next_coords;\r\n    FT_String*           next_name;\r\n    FT_Var_Axis*         a;\r\n    FT_Var_Named_Style*  ns;\r\n    GX_FVar_Head         fvar_head;\r\n\r\n    static const FT_Frame_Field  fvar_fields[] =\r\n    {\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  GX_FVar_Head\r\n\r\n      FT_FRAME_START( 16 ),\r\n        FT_FRAME_LONG  ( version ),\r\n        FT_FRAME_USHORT( offsetToData ),\r\n        FT_FRAME_USHORT( countSizePairs ),\r\n        FT_FRAME_USHORT( axisCount ),\r\n        FT_FRAME_USHORT( axisSize ),\r\n        FT_FRAME_USHORT( instanceCount ),\r\n        FT_FRAME_USHORT( instanceSize ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n    static const FT_Frame_Field  fvaraxis_fields[] =\r\n    {\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  GX_FVar_Axis\r\n\r\n      FT_FRAME_START( 20 ),\r\n        FT_FRAME_ULONG ( axisTag ),\r\n        FT_FRAME_ULONG ( minValue ),\r\n        FT_FRAME_ULONG ( defaultValue ),\r\n        FT_FRAME_ULONG ( maxValue ),\r\n        FT_FRAME_USHORT( flags ),\r\n        FT_FRAME_USHORT( nameID ),\r\n      FT_FRAME_END\r\n    };\r\n\r\n\r\n    if ( face->blend == NULL )\r\n    {\r\n      /* both `fvar' and `gvar' must be present */\r\n      if ( (error = face->goto_table( face, TTAG_gvar,\r\n                                      stream, &table_len )) != 0 )\r\n        goto Exit;\r\n\r\n      if ( (error = face->goto_table( face, TTAG_fvar,\r\n                                      stream, &table_len )) != 0 )\r\n        goto Exit;\r\n\r\n      fvar_start = FT_STREAM_POS( );\r\n\r\n      if ( FT_STREAM_READ_FIELDS( fvar_fields, &fvar_head ) )\r\n        goto Exit;\r\n\r\n      if ( fvar_head.version != (FT_Long)0x00010000L                      ||\r\n           fvar_head.countSizePairs != 2                                  ||\r\n           fvar_head.axisSize != 20                                       ||\r\n           /* axisCount limit implied by 16-bit instanceSize */\r\n           fvar_head.axisCount > 0x3FFE                                   ||\r\n           fvar_head.instanceSize != 4 + 4 * fvar_head.axisCount          ||\r\n           /* instanceCount limit implied by limited range of name IDs */\r\n           fvar_head.instanceCount > 0x7EFF                               ||\r\n           fvar_head.offsetToData + fvar_head.axisCount * 20U +\r\n             fvar_head.instanceCount * fvar_head.instanceSize > table_len )\r\n      {\r\n        error = TT_Err_Invalid_Table;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( FT_NEW( face->blend ) )\r\n        goto Exit;\r\n\r\n      /* cannot overflow 32-bit arithmetic because of limits above */\r\n      face->blend->mmvar_len =\r\n        sizeof ( FT_MM_Var ) +\r\n        fvar_head.axisCount * sizeof ( FT_Var_Axis ) +\r\n        fvar_head.instanceCount * sizeof ( FT_Var_Named_Style ) +\r\n        fvar_head.instanceCount * fvar_head.axisCount * sizeof ( FT_Fixed ) +\r\n        5 * fvar_head.axisCount;\r\n\r\n      if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )\r\n        goto Exit;\r\n      face->blend->mmvar = mmvar;\r\n\r\n      mmvar->num_axis =\r\n        fvar_head.axisCount;\r\n      mmvar->num_designs =\r\n        ~0;                    /* meaningless in this context; each glyph */\r\n                               /* may have a different number of designs  */\r\n                               /* (or tuples, as called by Apple)         */\r\n      mmvar->num_namedstyles =\r\n        fvar_head.instanceCount;\r\n      mmvar->axis =\r\n        (FT_Var_Axis*)&(mmvar[1]);\r\n      mmvar->namedstyle =\r\n        (FT_Var_Named_Style*)&(mmvar->axis[fvar_head.axisCount]);\r\n\r\n      next_coords =\r\n        (FT_Fixed*)&(mmvar->namedstyle[fvar_head.instanceCount]);\r\n      for ( i = 0; i < fvar_head.instanceCount; ++i )\r\n      {\r\n        mmvar->namedstyle[i].coords  = next_coords;\r\n        next_coords                 += fvar_head.axisCount;\r\n      }\r\n\r\n      next_name = (FT_String*)next_coords;\r\n      for ( i = 0; i < fvar_head.axisCount; ++i )\r\n      {\r\n        mmvar->axis[i].name  = next_name;\r\n        next_name           += 5;\r\n      }\r\n\r\n      if ( FT_STREAM_SEEK( fvar_start + fvar_head.offsetToData ) )\r\n        goto Exit;\r\n\r\n      a = mmvar->axis;\r\n      for ( i = 0; i < fvar_head.axisCount; ++i )\r\n      {\r\n        GX_FVar_Axis  axis_rec;\r\n\r\n\r\n        if ( FT_STREAM_READ_FIELDS( fvaraxis_fields, &axis_rec ) )\r\n          goto Exit;\r\n        a->tag     = axis_rec.axisTag;\r\n        a->minimum = axis_rec.minValue;     /* A Fixed */\r\n        a->def     = axis_rec.defaultValue; /* A Fixed */\r\n        a->maximum = axis_rec.maxValue;     /* A Fixed */\r\n        a->strid   = axis_rec.nameID;\r\n\r\n        a->name[0] = (FT_String)(   a->tag >> 24 );\r\n        a->name[1] = (FT_String)( ( a->tag >> 16 ) & 0xFF );\r\n        a->name[2] = (FT_String)( ( a->tag >>  8 ) & 0xFF );\r\n        a->name[3] = (FT_String)( ( a->tag       ) & 0xFF );\r\n        a->name[4] = 0;\r\n\r\n        ++a;\r\n      }\r\n\r\n      ns = mmvar->namedstyle;\r\n      for ( i = 0; i < fvar_head.instanceCount; ++i, ++ns )\r\n      {\r\n        if ( FT_FRAME_ENTER( 4L + 4L * fvar_head.axisCount ) )\r\n          goto Exit;\r\n\r\n        ns->strid       =    FT_GET_USHORT();\r\n        (void) /* flags = */ FT_GET_USHORT();\r\n\r\n        for ( j = 0; j < fvar_head.axisCount; ++j )\r\n          ns->coords[j] = FT_GET_ULONG();     /* A Fixed */\r\n\r\n        FT_FRAME_EXIT();\r\n      }\r\n    }\r\n\r\n    if ( master != NULL )\r\n    {\r\n      FT_UInt  n;\r\n\r\n\r\n      if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )\r\n        goto Exit;\r\n      FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len );\r\n\r\n      mmvar->axis =\r\n        (FT_Var_Axis*)&(mmvar[1]);\r\n      mmvar->namedstyle =\r\n        (FT_Var_Named_Style*)&(mmvar->axis[mmvar->num_axis]);\r\n      next_coords =\r\n        (FT_Fixed*)&(mmvar->namedstyle[mmvar->num_namedstyles]);\r\n\r\n      for ( n = 0; n < mmvar->num_namedstyles; ++n )\r\n      {\r\n        mmvar->namedstyle[n].coords  = next_coords;\r\n        next_coords                 += mmvar->num_axis;\r\n      }\r\n\r\n      a = mmvar->axis;\r\n      next_name = (FT_String*)next_coords;\r\n      for ( n = 0; n < mmvar->num_axis; ++n )\r\n      {\r\n        a->name = next_name;\r\n\r\n        /* standard PostScript names for some standard apple tags */\r\n        if ( a->tag == TTAG_wght )\r\n          a->name = (char *)\"Weight\";\r\n        else if ( a->tag == TTAG_wdth )\r\n          a->name = (char *)\"Width\";\r\n        else if ( a->tag == TTAG_opsz )\r\n          a->name = (char *)\"OpticalSize\";\r\n        else if ( a->tag == TTAG_slnt )\r\n          a->name = (char *)\"Slant\";\r\n\r\n        next_name += 5;\r\n        ++a;\r\n      }\r\n\r\n      *master = mmvar;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Set_MM_Blend                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set the blend (normalized) coordinates for this instance of the    */\r\n  /*    font.  Check that the `gvar' table is reasonable and does some     */\r\n  /*    initial preparation.                                               */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The font.                                            */\r\n  /*                  Initialize the blend structure with `gvar' data.     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: Must be the axis count of the font.                  */\r\n  /*                                                                       */\r\n  /*    coords     :: An array of num_coords, each between [-1,1].         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Set_MM_Blend( TT_Face    face,\r\n                   FT_UInt    num_coords,\r\n                   FT_Fixed*  coords )\r\n  {\r\n    FT_Error    error = TT_Err_Ok;\r\n    GX_Blend    blend;\r\n    FT_MM_Var*  mmvar;\r\n    FT_UInt     i;\r\n    FT_Memory   memory = face->root.memory;\r\n\r\n    enum\r\n    {\r\n      mcvt_retain,\r\n      mcvt_modify,\r\n      mcvt_load\r\n\r\n    } manageCvt;\r\n\r\n\r\n    face->doblend = FALSE;\r\n\r\n    if ( face->blend == NULL )\r\n    {\r\n      if ( (error = TT_Get_MM_Var( face, NULL)) != 0 )\r\n        goto Exit;\r\n    }\r\n\r\n    blend = face->blend;\r\n    mmvar = blend->mmvar;\r\n\r\n    if ( num_coords != mmvar->num_axis )\r\n    {\r\n      error = TT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    for ( i = 0; i < num_coords; ++i )\r\n      if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L )\r\n      {\r\n        error = TT_Err_Invalid_Argument;\r\n        goto Exit;\r\n      }\r\n\r\n    if ( blend->glyphoffsets == NULL )\r\n      if ( (error = ft_var_load_gvar( face )) != 0 )\r\n        goto Exit;\r\n\r\n    if ( blend->normalizedcoords == NULL )\r\n    {\r\n      if ( FT_NEW_ARRAY( blend->normalizedcoords, num_coords ) )\r\n        goto Exit;\r\n\r\n      manageCvt = mcvt_modify;\r\n\r\n      /* If we have not set the blend coordinates before this, then the  */\r\n      /* cvt table will still be what we read from the `cvt ' table and  */\r\n      /* we don't need to reload it.  We may need to change it though... */\r\n    }\r\n    else\r\n    {\r\n      manageCvt = mcvt_retain;\r\n      for ( i = 0; i < num_coords; ++i )\r\n      {\r\n        if ( blend->normalizedcoords[i] != coords[i] )\r\n        {\r\n          manageCvt = mcvt_load;\r\n          break;\r\n        }\r\n      }\r\n\r\n      /* If we don't change the blend coords then we don't need to do  */\r\n      /* anything to the cvt table.  It will be correct.  Otherwise we */\r\n      /* no longer have the original cvt (it was modified when we set  */\r\n      /* the blend last time), so we must reload and then modify it.   */\r\n    }\r\n\r\n    blend->num_axis = num_coords;\r\n    FT_MEM_COPY( blend->normalizedcoords,\r\n                 coords,\r\n                 num_coords * sizeof ( FT_Fixed ) );\r\n\r\n    face->doblend = TRUE;\r\n\r\n    if ( face->cvt != NULL )\r\n    {\r\n      switch ( manageCvt )\r\n      {\r\n      case mcvt_load:\r\n        /* The cvt table has been loaded already; every time we change the */\r\n        /* blend we may need to reload and remodify the cvt table.         */\r\n        FT_FREE( face->cvt );\r\n        face->cvt = NULL;\r\n\r\n        tt_face_load_cvt( face, face->root.stream );\r\n        break;\r\n\r\n      case mcvt_modify:\r\n        /* The original cvt table is in memory.  All we need to do is */\r\n        /* apply the `cvar' table (if any).                           */\r\n        tt_face_vary_cvt( face, face->root.stream );\r\n        break;\r\n\r\n      case mcvt_retain:\r\n        /* The cvt table is correct for this set of coordinates. */\r\n        break;\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Set_Var_Design                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set the coordinates for the instance, measured in the user         */\r\n  /*    coordinate system.  Parse the `avar' table (if present) to convert */\r\n  /*    from user to normalized coordinates.                               */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The font face.                                       */\r\n  /*                  Initialize the blend struct with `gvar' data.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: This must be the axis count of the font.             */\r\n  /*                                                                       */\r\n  /*    coords     :: A coordinate array with `num_coords' elements.       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Set_Var_Design( TT_Face    face,\r\n                     FT_UInt    num_coords,\r\n                     FT_Fixed*  coords )\r\n  {\r\n    FT_Error        error      = TT_Err_Ok;\r\n    FT_Fixed*       normalized = NULL;\r\n    GX_Blend        blend;\r\n    FT_MM_Var*      mmvar;\r\n    FT_UInt         i, j;\r\n    FT_Var_Axis*    a;\r\n    GX_AVarSegment  av;\r\n    FT_Memory       memory = face->root.memory;\r\n\r\n\r\n    if ( face->blend == NULL )\r\n    {\r\n      if ( (error = TT_Get_MM_Var( face, NULL )) != 0 )\r\n        goto Exit;\r\n    }\r\n\r\n    blend = face->blend;\r\n    mmvar = blend->mmvar;\r\n\r\n    if ( num_coords != mmvar->num_axis )\r\n    {\r\n      error = TT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Axis normalization is a two stage process.  First we normalize */\r\n    /* based on the [min,def,max] values for the axis to be [-1,0,1]. */\r\n    /* Then, if there's an `avar' table, we renormalize this range.   */\r\n\r\n    if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) )\r\n      goto Exit;\r\n\r\n    a = mmvar->axis;\r\n    for ( i = 0; i < mmvar->num_axis; ++i, ++a )\r\n    {\r\n      if ( coords[i] > a->maximum || coords[i] < a->minimum )\r\n      {\r\n        error = TT_Err_Invalid_Argument;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( coords[i] < a->def )\r\n        normalized[i] = -FT_DivFix( coords[i] - a->def, a->minimum - a->def );\r\n      else if ( a->maximum == a->def )\r\n        normalized[i] = 0;\r\n      else\r\n        normalized[i] = FT_DivFix( coords[i] - a->def, a->maximum - a->def );\r\n    }\r\n\r\n    if ( !blend->avar_checked )\r\n      ft_var_load_avar( face );\r\n\r\n    if ( blend->avar_segment != NULL )\r\n    {\r\n      av = blend->avar_segment;\r\n      for ( i = 0; i < mmvar->num_axis; ++i, ++av )\r\n      {\r\n        for ( j = 1; j < (FT_UInt)av->pairCount; ++j )\r\n          if ( normalized[i] < av->correspondence[j].fromCoord )\r\n          {\r\n            normalized[i] =\r\n              FT_MulDiv( normalized[i] - av->correspondence[j - 1].fromCoord,\r\n                         av->correspondence[j].toCoord -\r\n                           av->correspondence[j - 1].toCoord,\r\n                         av->correspondence[j].fromCoord -\r\n                           av->correspondence[j - 1].fromCoord ) +\r\n              av->correspondence[j - 1].toCoord;\r\n            break;\r\n          }\r\n      }\r\n    }\r\n\r\n    error = TT_Set_MM_Blend( face, num_coords, normalized );\r\n\r\n  Exit:\r\n    FT_FREE( normalized );\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     GX VAR PARSING ROUTINES                   *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_vary_cvt                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Modify the loaded cvt table according to the `cvar' table and the  */\r\n  /*    font's blend.                                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /*    Most errors are ignored.  It is perfectly valid not to have a      */\r\n  /*    `cvar' table even if there is a `gvar' and `fvar' table.           */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_vary_cvt( TT_Face    face,\r\n                    FT_Stream  stream )\r\n  {\r\n    FT_Error    error;\r\n    FT_Memory   memory = stream->memory;\r\n    FT_ULong    table_start;\r\n    FT_ULong    table_len;\r\n    FT_UInt     tupleCount;\r\n    FT_ULong    offsetToData;\r\n    FT_ULong    here;\r\n    FT_UInt     i, j;\r\n    FT_Fixed*   tuple_coords    = NULL;\r\n    FT_Fixed*   im_start_coords = NULL;\r\n    FT_Fixed*   im_end_coords   = NULL;\r\n    GX_Blend    blend           = face->blend;\r\n    FT_UInt     point_count;\r\n    FT_UShort*  localpoints;\r\n    FT_Short*   deltas;\r\n\r\n\r\n    FT_TRACE2(( \"CVAR \" ));\r\n\r\n    if ( blend == NULL )\r\n    {\r\n      FT_TRACE2(( \"tt_face_vary_cvt: no blend specified\\n\" ));\r\n\r\n      error = TT_Err_Ok;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( face->cvt == NULL )\r\n    {\r\n      FT_TRACE2(( \"tt_face_vary_cvt: no `cvt ' table\\n\" ));\r\n\r\n      error = TT_Err_Ok;\r\n      goto Exit;\r\n    }\r\n\r\n    error = face->goto_table( face, TTAG_cvar, stream, &table_len );\r\n    if ( error )\r\n    {\r\n      FT_TRACE2(( \"is missing\\n\" ));\r\n\r\n      error = TT_Err_Ok;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( FT_FRAME_ENTER( table_len ) )\r\n    {\r\n      error = TT_Err_Ok;\r\n      goto Exit;\r\n    }\r\n\r\n    table_start = FT_Stream_FTell( stream );\r\n    if ( FT_GET_LONG() != 0x00010000L )\r\n    {\r\n      FT_TRACE2(( \"bad table version\\n\" ));\r\n\r\n      error = TT_Err_Ok;\r\n      goto FExit;\r\n    }\r\n\r\n    if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis )    ||\r\n         FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||\r\n         FT_NEW_ARRAY( im_end_coords, blend->num_axis )   )\r\n      goto FExit;\r\n\r\n    tupleCount   = FT_GET_USHORT();\r\n    offsetToData = table_start + FT_GET_USHORT();\r\n\r\n    /* The documentation implies there are flags packed into the        */\r\n    /* tuplecount, but John Jenkins says that shared points don't apply */\r\n    /* to `cvar', and no other flags are defined.                       */\r\n\r\n    for ( i = 0; i < ( tupleCount & 0xFFF ); ++i )\r\n    {\r\n      FT_UInt   tupleDataSize;\r\n      FT_UInt   tupleIndex;\r\n      FT_Fixed  apply;\r\n\r\n\r\n      tupleDataSize = FT_GET_USHORT();\r\n      tupleIndex    = FT_GET_USHORT();\r\n\r\n      /* There is no provision here for a global tuple coordinate section, */\r\n      /* so John says.  There are no tuple indices, just embedded tuples.  */\r\n\r\n      if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )\r\n      {\r\n        for ( j = 0; j < blend->num_axis; ++j )\r\n          tuple_coords[j] = FT_GET_SHORT() << 2; /* convert from        */\r\n                                                 /* short frac to fixed */\r\n      }\r\n      else\r\n      {\r\n        /* skip this tuple; it makes no sense */\r\n\r\n        if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )\r\n          for ( j = 0; j < 2 * blend->num_axis; ++j )\r\n            (void)FT_GET_SHORT();\r\n\r\n        offsetToData += tupleDataSize;\r\n        continue;\r\n      }\r\n\r\n      if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )\r\n      {\r\n        for ( j = 0; j < blend->num_axis; ++j )\r\n          im_start_coords[j] = FT_GET_SHORT() << 2;\r\n        for ( j = 0; j < blend->num_axis; ++j )\r\n          im_end_coords[j] = FT_GET_SHORT() << 2;\r\n      }\r\n\r\n      apply = ft_var_apply_tuple( blend,\r\n                                  (FT_UShort)tupleIndex,\r\n                                  tuple_coords,\r\n                                  im_start_coords,\r\n                                  im_end_coords );\r\n      if ( /* tuple isn't active for our blend */\r\n           apply == 0                                    ||\r\n           /* global points not allowed,           */\r\n           /* if they aren't local, makes no sense */\r\n           !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) )\r\n      {\r\n        offsetToData += tupleDataSize;\r\n        continue;\r\n      }\r\n\r\n      here = FT_Stream_FTell( stream );\r\n\r\n      FT_Stream_SeekSet( stream, offsetToData );\r\n\r\n      localpoints = ft_var_readpackedpoints( stream, &point_count );\r\n      deltas      = ft_var_readpackeddeltas( stream,\r\n                                             point_count == 0 ? face->cvt_size\r\n                                                              : point_count );\r\n      if ( localpoints == NULL || deltas == NULL )\r\n        /* failure, ignore it */;\r\n\r\n      else if ( localpoints == ALL_POINTS )\r\n      {\r\n        /* this means that there are deltas for every entry in cvt */\r\n        for ( j = 0; j < face->cvt_size; ++j )\r\n          face->cvt[j] = (FT_Short)( face->cvt[j] +\r\n                                     FT_MulFix( deltas[j], apply ) );\r\n      }\r\n\r\n      else\r\n      {\r\n        for ( j = 0; j < point_count; ++j )\r\n        {\r\n          int  pindex = localpoints[j];\r\n\r\n          face->cvt[pindex] = (FT_Short)( face->cvt[pindex] +\r\n                                          FT_MulFix( deltas[j], apply ) );\r\n        }\r\n      }\r\n\r\n      if ( localpoints != ALL_POINTS )\r\n        FT_FREE( localpoints );\r\n      FT_FREE( deltas );\r\n\r\n      offsetToData += tupleDataSize;\r\n\r\n      FT_Stream_SeekSet( stream, here );\r\n    }\r\n\r\n  FExit:\r\n    FT_FRAME_EXIT();\r\n\r\n  Exit:\r\n    FT_FREE( tuple_coords );\r\n    FT_FREE( im_start_coords );\r\n    FT_FREE( im_end_coords );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Vary_Get_Glyph_Deltas                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the appropriate deltas for the current glyph.                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to the target face object.                 */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The index of the glyph being modified.              */\r\n  /*                                                                       */\r\n  /*    n_points    :: The number of the points in the glyph, including    */\r\n  /*                   phantom points.                                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    deltas      :: The array of points to change.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Vary_Get_Glyph_Deltas( TT_Face      face,\r\n                            FT_UInt      glyph_index,\r\n                            FT_Vector*  *deltas,\r\n                            FT_UInt      n_points )\r\n  {\r\n    FT_Stream   stream = face->root.stream;\r\n    FT_Memory   memory = stream->memory;\r\n    GX_Blend    blend  = face->blend;\r\n    FT_Vector*  delta_xy = NULL;\r\n\r\n    FT_Error    error;\r\n    FT_ULong    glyph_start;\r\n    FT_UInt     tupleCount;\r\n    FT_ULong    offsetToData;\r\n    FT_ULong    here;\r\n    FT_UInt     i, j;\r\n    FT_Fixed*   tuple_coords    = NULL;\r\n    FT_Fixed*   im_start_coords = NULL;\r\n    FT_Fixed*   im_end_coords   = NULL;\r\n    FT_UInt     point_count, spoint_count = 0;\r\n    FT_UShort*  sharedpoints = NULL;\r\n    FT_UShort*  localpoints  = NULL;\r\n    FT_UShort*  points;\r\n    FT_Short    *deltas_x, *deltas_y;\r\n\r\n\r\n    if ( !face->doblend || blend == NULL )\r\n      return TT_Err_Invalid_Argument;\r\n\r\n    /* to be freed by the caller */\r\n    if ( FT_NEW_ARRAY( delta_xy, n_points ) )\r\n      goto Exit;\r\n    *deltas = delta_xy;\r\n\r\n    if ( glyph_index >= blend->gv_glyphcnt      ||\r\n         blend->glyphoffsets[glyph_index] ==\r\n           blend->glyphoffsets[glyph_index + 1] )\r\n      return TT_Err_Ok;               /* no variation data for this glyph */\r\n\r\n    if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] )   ||\r\n         FT_FRAME_ENTER( blend->glyphoffsets[glyph_index + 1] -\r\n                           blend->glyphoffsets[glyph_index] ) )\r\n      goto Fail1;\r\n\r\n    glyph_start = FT_Stream_FTell( stream );\r\n\r\n    /* each set of glyph variation data is formatted similarly to `cvar' */\r\n    /* (except we get shared points and global tuples)                   */\r\n\r\n    if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis )    ||\r\n         FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||\r\n         FT_NEW_ARRAY( im_end_coords, blend->num_axis )   )\r\n      goto Fail2;\r\n\r\n    tupleCount   = FT_GET_USHORT();\r\n    offsetToData = glyph_start + FT_GET_USHORT();\r\n\r\n    if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS )\r\n    {\r\n      here = FT_Stream_FTell( stream );\r\n\r\n      FT_Stream_SeekSet( stream, offsetToData );\r\n\r\n      sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );\r\n      offsetToData = FT_Stream_FTell( stream );\r\n\r\n      FT_Stream_SeekSet( stream, here );\r\n    }\r\n\r\n    for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); ++i )\r\n    {\r\n      FT_UInt   tupleDataSize;\r\n      FT_UInt   tupleIndex;\r\n      FT_Fixed  apply;\r\n\r\n\r\n      tupleDataSize = FT_GET_USHORT();\r\n      tupleIndex    = FT_GET_USHORT();\r\n\r\n      if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )\r\n      {\r\n        for ( j = 0; j < blend->num_axis; ++j )\r\n          tuple_coords[j] = FT_GET_SHORT() << 2;  /* convert from        */\r\n                                                  /* short frac to fixed */\r\n      }\r\n      else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )\r\n      {\r\n        error = TT_Err_Invalid_Table;\r\n        goto Fail3;\r\n      }\r\n      else\r\n      {\r\n        FT_MEM_COPY(\r\n          tuple_coords,\r\n          &blend->tuplecoords[(tupleIndex & 0xFFF) * blend->num_axis],\r\n          blend->num_axis * sizeof ( FT_Fixed ) );\r\n      }\r\n\r\n      if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )\r\n      {\r\n        for ( j = 0; j < blend->num_axis; ++j )\r\n          im_start_coords[j] = FT_GET_SHORT() << 2;\r\n        for ( j = 0; j < blend->num_axis; ++j )\r\n          im_end_coords[j] = FT_GET_SHORT() << 2;\r\n      }\r\n\r\n      apply = ft_var_apply_tuple( blend,\r\n                                  (FT_UShort)tupleIndex,\r\n                                  tuple_coords,\r\n                                  im_start_coords,\r\n                                  im_end_coords );\r\n\r\n      if ( apply == 0 )              /* tuple isn't active for our blend */\r\n      {\r\n        offsetToData += tupleDataSize;\r\n        continue;\r\n      }\r\n\r\n      here = FT_Stream_FTell( stream );\r\n\r\n      if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )\r\n      {\r\n        FT_Stream_SeekSet( stream, offsetToData );\r\n\r\n        localpoints = ft_var_readpackedpoints( stream, &point_count );\r\n        points      = localpoints;\r\n      }\r\n      else\r\n      {\r\n        points      = sharedpoints;\r\n        point_count = spoint_count;\r\n      }\r\n\r\n      deltas_x = ft_var_readpackeddeltas( stream,\r\n                                          point_count == 0 ? n_points\r\n                                                           : point_count );\r\n      deltas_y = ft_var_readpackeddeltas( stream,\r\n                                          point_count == 0 ? n_points\r\n                                                           : point_count );\r\n\r\n      if ( points == NULL || deltas_y == NULL || deltas_x == NULL )\r\n        ; /* failure, ignore it */\r\n\r\n      else if ( points == ALL_POINTS )\r\n      {\r\n        /* this means that there are deltas for every point in the glyph */\r\n        for ( j = 0; j < n_points; ++j )\r\n        {\r\n          delta_xy[j].x += FT_MulFix( deltas_x[j], apply );\r\n          delta_xy[j].y += FT_MulFix( deltas_y[j], apply );\r\n        }\r\n      }\r\n\r\n      else\r\n      {\r\n        for ( j = 0; j < point_count; ++j )\r\n        {\r\n          if ( localpoints[j] >= n_points )\r\n            continue;\r\n\r\n          delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply );\r\n          delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply );\r\n        }\r\n      }\r\n\r\n      if ( localpoints != ALL_POINTS )\r\n        FT_FREE( localpoints );\r\n      FT_FREE( deltas_x );\r\n      FT_FREE( deltas_y );\r\n\r\n      offsetToData += tupleDataSize;\r\n\r\n      FT_Stream_SeekSet( stream, here );\r\n    }\r\n\r\n  Fail3:\r\n    FT_FREE( tuple_coords );\r\n    FT_FREE( im_start_coords );\r\n    FT_FREE( im_end_coords );\r\n\r\n  Fail2:\r\n    FT_FRAME_EXIT();\r\n\r\n  Fail1:\r\n    if ( error )\r\n    {\r\n      FT_FREE( delta_xy );\r\n      *deltas = NULL;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_done_blend                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Frees the blend internal data structure.                           */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_done_blend( FT_Memory  memory,\r\n                 GX_Blend   blend )\r\n  {\r\n    if ( blend != NULL )\r\n    {\r\n      FT_UInt  i;\r\n\r\n\r\n      FT_FREE( blend->normalizedcoords );\r\n      FT_FREE( blend->mmvar );\r\n\r\n      if ( blend->avar_segment != NULL )\r\n      {\r\n        for ( i = 0; i < blend->num_axis; ++i )\r\n          FT_FREE( blend->avar_segment[i].correspondence );\r\n        FT_FREE( blend->avar_segment );\r\n      }\r\n\r\n      FT_FREE( blend->tuplecoords );\r\n      FT_FREE( blend->glyphoffsets );\r\n      FT_FREE( blend );\r\n    }\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttgxvar.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttgxvar.h                                                              */\r\n/*                                                                         */\r\n/*    TrueType GX Font Variation loader (specification)                    */\r\n/*                                                                         */\r\n/*  Copyright 2004 by                                                      */\r\n/*  David Turner, Robert Wilhelm, Werner Lemberg and George Williams.      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTGXVAR_H__\r\n#define __TTGXVAR_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"ttobjs.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    GX_AVarCorrespondenceRec                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A data structure representing `shortFracCorrespondence' in `avar'  */\r\n  /*    table according to the specifications from Apple.                  */\r\n  /*                                                                       */\r\n  typedef struct  GX_AVarCorrespondenceRec_\r\n  {\r\n    FT_Fixed  fromCoord;\r\n    FT_Fixed  toCoord;\r\n\r\n  } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    GX_AVarRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Data from the segment field of `avar' table.                       */\r\n  /*    There is one of these for each axis.                               */\r\n  /*                                                                       */\r\n  typedef struct  GX_AVarSegmentRec_\r\n  {\r\n    FT_UShort              pairCount;\r\n    GX_AVarCorrespondence  correspondence; /* array with pairCount entries */\r\n\r\n  } GX_AVarSegmentRec, *GX_AVarSegment;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    GX_BlendRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Data for interpolating a font from a distortable font specified    */\r\n  /*    by the GX *var tables ([fgca]var).                                 */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_axis         :: The number of axes along which interpolation   */\r\n  /*                         may happen                                    */\r\n  /*                                                                       */\r\n  /*    normalizedcoords :: A normalized value (between [-1,1]) indicating */\r\n  /*                        the contribution along each axis to the final  */\r\n  /*                        interpolated font.                             */\r\n  /*                                                                       */\r\n  typedef struct  GX_BlendRec_\r\n  {\r\n    FT_UInt         num_axis;\r\n    FT_Fixed*       normalizedcoords;\r\n\r\n    FT_MM_Var*      mmvar;\r\n    FT_Offset       mmvar_len;\r\n\r\n    FT_Bool         avar_checked;\r\n    GX_AVarSegment  avar_segment;\r\n\r\n    FT_UInt         tuplecount;      /* shared tuples in `gvar'           */\r\n    FT_Fixed*       tuplecoords;     /* tuplecoords[tuplecount][num_axis] */\r\n\r\n    FT_UInt         gv_glyphcnt;\r\n    FT_ULong*       glyphoffsets;\r\n\r\n  } GX_BlendRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <enum>                                                                */\r\n  /*    GX_TupleCountFlags                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Flags used within the `TupleCount' field of the `gvar' table.      */\r\n  /*                                                                       */\r\n  typedef enum  GX_TupleCountFlags_\r\n  {\r\n    GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000,\r\n    GX_TC_RESERVED_TUPLE_FLAGS       = 0x7000,\r\n    GX_TC_TUPLE_COUNT_MASK           = 0x0FFF\r\n\r\n  } GX_TupleCountFlags;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <enum>                                                                */\r\n  /*    GX_TupleIndexFlags                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Flags used within the `TupleIndex' field of the `gvar' and `cvar'  */\r\n  /*    tables.                                                            */\r\n  /*                                                                       */\r\n  typedef enum  GX_TupleIndexFlags_\r\n  {\r\n    GX_TI_EMBEDDED_TUPLE_COORD  = 0x8000,\r\n    GX_TI_INTERMEDIATE_TUPLE    = 0x4000,\r\n    GX_TI_PRIVATE_POINT_NUMBERS = 0x2000,\r\n    GX_TI_RESERVED_TUPLE_FLAG   = 0x1000,\r\n    GX_TI_TUPLE_INDEX_MASK      = 0x0FFF\r\n\r\n  } GX_TupleIndexFlags;\r\n\r\n\r\n#define TTAG_wght  FT_MAKE_TAG( 'w', 'g', 'h', 't' )\r\n#define TTAG_wdth  FT_MAKE_TAG( 'w', 'd', 't', 'h' )\r\n#define TTAG_opsz  FT_MAKE_TAG( 'o', 'p', 's', 'z' )\r\n#define TTAG_slnt  FT_MAKE_TAG( 's', 'l', 'n', 't' )\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Set_MM_Blend( TT_Face    face,\r\n                   FT_UInt    num_coords,\r\n                   FT_Fixed*  coords );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Set_Var_Design( TT_Face    face,\r\n                     FT_UInt    num_coords,\r\n                     FT_Fixed*  coords );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Get_MM_Var( TT_Face      face,\r\n                 FT_MM_Var*  *master );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_vary_cvt( TT_Face    face,\r\n                    FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Vary_Get_Glyph_Deltas( TT_Face      face,\r\n                            FT_UInt      glyph_index,\r\n                            FT_Vector*  *deltas,\r\n                            FT_UInt      n_points );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  tt_done_blend( FT_Memory  memory,\r\n                 GX_Blend   blend );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __TTGXVAR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttinterp.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttinterp.c                                                             */\r\n/*                                                                         */\r\n/*    TrueType bytecode interpreter (body).                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012                                                    */\r\n/*  by David Turner, Robert Wilhelm, and Werner Lemberg.                   */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/* Greg Hitchcock from Microsoft has helped a lot in resolving unclear */\r\n/* issues; many thanks!                                                */\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_TRIGONOMETRY_H\r\n#include FT_SYSTEM_H\r\n\r\n#include \"ttinterp.h\"\r\n#include \"tterrors.h\"\r\n#include \"ttsubpix.h\"\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n\r\n#define xxxSPH_DEBUG\r\n#define xxxSPH_DEBUG_MORE_VERBOSE\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttinterp\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* In order to detect infinite loops in the code, we set up a counter    */\r\n  /* within the run loop.  A single stroke of interpretation is now        */\r\n  /* limited to a maximum number of opcodes defined below.                 */\r\n  /*                                                                       */\r\n#define MAX_RUNNABLE_OPCODES  1000000L\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* There are two kinds of implementations:                               */\r\n  /*                                                                       */\r\n  /* a. static implementation                                              */\r\n  /*                                                                       */\r\n  /*    The current execution context is a static variable, which fields   */\r\n  /*    are accessed directly by the interpreter during execution.  The    */\r\n  /*    context is named `cur'.                                            */\r\n  /*                                                                       */\r\n  /*    This version is non-reentrant, of course.                          */\r\n  /*                                                                       */\r\n  /* b. indirect implementation                                            */\r\n  /*                                                                       */\r\n  /*    The current execution context is passed to _each_ function as its  */\r\n  /*    first argument, and each field is thus accessed indirectly.        */\r\n  /*                                                                       */\r\n  /*    This version is fully re-entrant.                                  */\r\n  /*                                                                       */\r\n  /* The idea is that an indirect implementation may be slower to execute  */\r\n  /* on low-end processors that are used in some systems (like 386s or     */\r\n  /* even 486s).                                                           */\r\n  /*                                                                       */\r\n  /* As a consequence, the indirect implementation is now the default, as  */\r\n  /* its performance costs can be considered negligible in our context.    */\r\n  /* Note, however, that we kept the same source with macros because:      */\r\n  /*                                                                       */\r\n  /* - The code is kept very close in design to the Pascal code used for   */\r\n  /*   development.                                                        */\r\n  /*                                                                       */\r\n  /* - It's much more readable that way!                                   */\r\n  /*                                                                       */\r\n  /* - It's still open to experimentation and tuning.                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER     /* indirect implementation */\r\n\r\n#define CUR  (*exc)                             /* see ttobjs.h */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This macro is used whenever `exec' is unused in a function, to avoid  */\r\n  /* stupid warnings from pedantic compilers.                              */\r\n  /*                                                                       */\r\n#define FT_UNUSED_EXEC  FT_UNUSED( exc )\r\n\r\n#else                                           /* static implementation */\r\n\r\n#define CUR  cur\r\n\r\n#define FT_UNUSED_EXEC  int  __dummy = __dummy\r\n\r\n  static\r\n  TT_ExecContextRec  cur;   /* static exec. context variable */\r\n\r\n  /* apparently, we have a _lot_ of direct indexing when accessing  */\r\n  /* the static `cur', which makes the code bigger (due to all the  */\r\n  /* four bytes addresses).                                         */\r\n\r\n#endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The instruction argument stack.                                       */\r\n  /*                                                                       */\r\n#define INS_ARG  EXEC_OP_ FT_Long*  args    /* see ttobjs.h for EXEC_OP_ */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This macro is used whenever `args' is unused in a function, to avoid  */\r\n  /* stupid warnings from pedantic compilers.                              */\r\n  /*                                                                       */\r\n#define FT_UNUSED_ARG  FT_UNUSED_EXEC; FT_UNUSED( args )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The following macros hide the use of EXEC_ARG and EXEC_ARG_ to        */\r\n  /* increase readability of the code.                                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define SKIP_Code() \\\r\n          SkipCode( EXEC_ARG )\r\n\r\n#define GET_ShortIns() \\\r\n          GetShortIns( EXEC_ARG )\r\n\r\n#define NORMalize( x, y, v ) \\\r\n          Normalize( EXEC_ARG_ x, y, v )\r\n\r\n#define SET_SuperRound( scale, flags ) \\\r\n          SetSuperRound( EXEC_ARG_ scale, flags )\r\n\r\n#define ROUND_None( d, c ) \\\r\n          Round_None( EXEC_ARG_ d, c )\r\n\r\n#define INS_Goto_CodeRange( range, ip ) \\\r\n          Ins_Goto_CodeRange( EXEC_ARG_ range, ip )\r\n\r\n#define CUR_Func_move( z, p, d ) \\\r\n          CUR.func_move( EXEC_ARG_ z, p, d )\r\n\r\n#define CUR_Func_move_orig( z, p, d ) \\\r\n          CUR.func_move_orig( EXEC_ARG_ z, p, d )\r\n\r\n#define CUR_Func_round( d, c ) \\\r\n          CUR.func_round( EXEC_ARG_ d, c )\r\n\r\n#define CUR_Func_read_cvt( index ) \\\r\n          CUR.func_read_cvt( EXEC_ARG_ index )\r\n\r\n#define CUR_Func_write_cvt( index, val ) \\\r\n          CUR.func_write_cvt( EXEC_ARG_ index, val )\r\n\r\n#define CUR_Func_move_cvt( index, val ) \\\r\n          CUR.func_move_cvt( EXEC_ARG_ index, val )\r\n\r\n#define CURRENT_Ratio() \\\r\n          Current_Ratio( EXEC_ARG )\r\n\r\n#define CURRENT_Ppem() \\\r\n          Current_Ppem( EXEC_ARG )\r\n\r\n#define CUR_Ppem() \\\r\n          Cur_PPEM( EXEC_ARG )\r\n\r\n#define INS_SxVTL( a, b, c, d ) \\\r\n          Ins_SxVTL( EXEC_ARG_ a, b, c, d )\r\n\r\n#define COMPUTE_Funcs() \\\r\n          Compute_Funcs( EXEC_ARG )\r\n\r\n#define COMPUTE_Round( a ) \\\r\n          Compute_Round( EXEC_ARG_ a )\r\n\r\n#define COMPUTE_Point_Displacement( a, b, c, d ) \\\r\n          Compute_Point_Displacement( EXEC_ARG_ a, b, c, d )\r\n\r\n#define MOVE_Zp2_Point( a, b, c, t ) \\\r\n          Move_Zp2_Point( EXEC_ARG_ a, b, c, t )\r\n\r\n\r\n#define CUR_Func_project( v1, v2 )  \\\r\n          CUR.func_project( EXEC_ARG_ (v1)->x - (v2)->x, (v1)->y - (v2)->y )\r\n\r\n#define CUR_Func_dualproj( v1, v2 )  \\\r\n          CUR.func_dualproj( EXEC_ARG_ (v1)->x - (v2)->x, (v1)->y - (v2)->y )\r\n\r\n#define CUR_fast_project( v ) \\\r\n          CUR.func_project( EXEC_ARG_ (v)->x, (v)->y )\r\n\r\n#define CUR_fast_dualproj( v ) \\\r\n          CUR.func_dualproj( EXEC_ARG_ (v)->x, (v)->y )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Instruction dispatch function, as used by the interpreter.            */\r\n  /*                                                                       */\r\n  typedef void  (*TInstruction_Function)( INS_ARG );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Two simple bounds-checking macros.                                    */\r\n  /*                                                                       */\r\n#define BOUNDS( x, n )   ( (FT_UInt)(x)  >= (FT_UInt)(n)  )\r\n#define BOUNDSL( x, n )  ( (FT_ULong)(x) >= (FT_ULong)(n) )\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This macro computes (a*2^14)/b and complements TT_MulFix14.           */\r\n  /*                                                                       */\r\n#define TT_DivFix14( a, b ) \\\r\n          FT_DivFix( a, (b) << 2 )\r\n\r\n\r\n#undef  SUCCESS\r\n#define SUCCESS  0\r\n\r\n#undef  FAILURE\r\n#define FAILURE  1\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#define GUESS_VECTOR( V )                                         \\\r\n  if ( CUR.face->unpatented_hinting )                             \\\r\n  {                                                               \\\r\n    CUR.GS.V.x = (FT_F2Dot14)( CUR.GS.both_x_axis ? 0x4000 : 0 ); \\\r\n    CUR.GS.V.y = (FT_F2Dot14)( CUR.GS.both_x_axis ? 0 : 0x4000 ); \\\r\n  }\r\n#else\r\n#define GUESS_VECTOR( V )\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                        CODERANGE FUNCTIONS                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Goto_CodeRange                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Switches to a new code range (updates the code related elements in */\r\n  /*    `exec', and `IP').                                                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    range :: The new execution code range.                             */\r\n  /*                                                                       */\r\n  /*    IP    :: The new IP in the new code range.                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    exec  :: The target execution context.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Goto_CodeRange( TT_ExecContext  exec,\r\n                     FT_Int          range,\r\n                     FT_Long         IP )\r\n  {\r\n    TT_CodeRange*  coderange;\r\n\r\n\r\n    FT_ASSERT( range >= 1 && range <= 3 );\r\n\r\n    coderange = &exec->codeRangeTable[range - 1];\r\n\r\n    FT_ASSERT( coderange->base != NULL );\r\n\r\n    /* NOTE: Because the last instruction of a program may be a CALL */\r\n    /*       which will return to the first byte *after* the code    */\r\n    /*       range, we test for IP <= Size instead of IP < Size.     */\r\n    /*                                                               */\r\n    FT_ASSERT( (FT_ULong)IP <= coderange->size );\r\n\r\n    exec->code     = coderange->base;\r\n    exec->codeSize = coderange->size;\r\n    exec->IP       = IP;\r\n    exec->curRange = range;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Set_CodeRange                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Sets a code range.                                                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    range  :: The code range index.                                    */\r\n  /*                                                                       */\r\n  /*    base   :: The new code base.                                       */\r\n  /*                                                                       */\r\n  /*    length :: The range size in bytes.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    exec   :: The target execution context.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Set_CodeRange( TT_ExecContext  exec,\r\n                    FT_Int          range,\r\n                    void*           base,\r\n                    FT_Long         length )\r\n  {\r\n    FT_ASSERT( range >= 1 && range <= 3 );\r\n\r\n    exec->codeRangeTable[range - 1].base = (FT_Byte*)base;\r\n    exec->codeRangeTable[range - 1].size = length;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Clear_CodeRange                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Clears a code range.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    range :: The code range index.                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    exec  :: The target execution context.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Does not set the Error variable.                                   */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Clear_CodeRange( TT_ExecContext  exec,\r\n                      FT_Int          range )\r\n  {\r\n    FT_ASSERT( range >= 1 && range <= 3 );\r\n\r\n    exec->codeRangeTable[range - 1].base = NULL;\r\n    exec->codeRangeTable[range - 1].size = 0;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                   EXECUTION CONTEXT ROUTINES                          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Done_Context                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroys a given context.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    exec   :: A handle to the target execution context.                */\r\n  /*                                                                       */\r\n  /*    memory :: A handle to the parent memory object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only the glyph loader and debugger should call this function.      */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Done_Context( TT_ExecContext  exec )\r\n  {\r\n    FT_Memory  memory = exec->memory;\r\n\r\n\r\n    /* points zone */\r\n    exec->maxPoints   = 0;\r\n    exec->maxContours = 0;\r\n\r\n    /* free stack */\r\n    FT_FREE( exec->stack );\r\n    exec->stackSize = 0;\r\n\r\n    /* free call stack */\r\n    FT_FREE( exec->callStack );\r\n    exec->callSize = 0;\r\n    exec->callTop  = 0;\r\n\r\n    /* free glyph code range */\r\n    FT_FREE( exec->glyphIns );\r\n    exec->glyphSize = 0;\r\n\r\n    exec->size = NULL;\r\n    exec->face = NULL;\r\n\r\n    FT_FREE( exec );\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Init_Context                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a context object.                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the parent memory object.                    */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    exec   :: A handle to the target execution context.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  Init_Context( TT_ExecContext  exec,\r\n                FT_Memory       memory )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    FT_TRACE1(( \"Init_Context: new object at 0x%08p\\n\", exec ));\r\n\r\n    exec->memory   = memory;\r\n    exec->callSize = 32;\r\n\r\n    if ( FT_NEW_ARRAY( exec->callStack, exec->callSize ) )\r\n      goto Fail_Memory;\r\n\r\n    /* all values in the context are set to 0 already, but this is */\r\n    /* here as a remainder                                         */\r\n    exec->maxPoints   = 0;\r\n    exec->maxContours = 0;\r\n\r\n    exec->stackSize = 0;\r\n    exec->glyphSize = 0;\r\n\r\n    exec->stack     = NULL;\r\n    exec->glyphIns  = NULL;\r\n\r\n    exec->face = NULL;\r\n    exec->size = NULL;\r\n\r\n    return TT_Err_Ok;\r\n\r\n  Fail_Memory:\r\n    FT_ERROR(( \"Init_Context: not enough memory for %p\\n\", exec ));\r\n    TT_Done_Context( exec );\r\n\r\n    return error;\r\n }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Update_Max                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Checks the size of a buffer and reallocates it if necessary.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory     :: A handle to the parent memory object.                */\r\n  /*                                                                       */\r\n  /*    multiplier :: The size in bytes of each element in the buffer.     */\r\n  /*                                                                       */\r\n  /*    new_max    :: The new capacity (size) of the buffer.               */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    size       :: The address of the buffer's current size expressed   */\r\n  /*                  in elements.                                         */\r\n  /*                                                                       */\r\n  /*    buff       :: The address of the buffer base pointer.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  Update_Max( FT_Memory  memory,\r\n              FT_ULong*  size,\r\n              FT_Long    multiplier,\r\n              void*      _pbuff,\r\n              FT_ULong   new_max )\r\n  {\r\n    FT_Error  error;\r\n    void**    pbuff = (void**)_pbuff;\r\n\r\n\r\n    if ( *size < new_max )\r\n    {\r\n      if ( FT_REALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )\r\n        return error;\r\n      *size = new_max;\r\n    }\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Load_Context                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Prepare an execution context for glyph hinting.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face object.                        */\r\n  /*                                                                       */\r\n  /*    size :: A handle to the source size object.                        */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    exec :: A handle to the target execution context.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only the glyph loader and debugger should call this function.      */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Load_Context( TT_ExecContext  exec,\r\n                   TT_Face         face,\r\n                   TT_Size         size )\r\n  {\r\n    FT_Int          i;\r\n    FT_ULong        tmp;\r\n    TT_MaxProfile*  maxp;\r\n    FT_Error        error;\r\n\r\n\r\n    exec->face = face;\r\n    maxp       = &face->max_profile;\r\n    exec->size = size;\r\n\r\n    if ( size )\r\n    {\r\n      exec->numFDefs   = size->num_function_defs;\r\n      exec->maxFDefs   = size->max_function_defs;\r\n      exec->numIDefs   = size->num_instruction_defs;\r\n      exec->maxIDefs   = size->max_instruction_defs;\r\n      exec->FDefs      = size->function_defs;\r\n      exec->IDefs      = size->instruction_defs;\r\n      exec->tt_metrics = size->ttmetrics;\r\n      exec->metrics    = size->metrics;\r\n\r\n      exec->maxFunc    = size->max_func;\r\n      exec->maxIns     = size->max_ins;\r\n\r\n      for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )\r\n        exec->codeRangeTable[i] = size->codeRangeTable[i];\r\n\r\n      /* set graphics state */\r\n      exec->GS = size->GS;\r\n\r\n      exec->cvtSize = size->cvt_size;\r\n      exec->cvt     = size->cvt;\r\n\r\n      exec->storeSize = size->storage_size;\r\n      exec->storage   = size->storage;\r\n\r\n      exec->twilight  = size->twilight;\r\n\r\n      /* In case of multi-threading it can happen that the old size object */\r\n      /* no longer exists, thus we must clear all glyph zone references.   */\r\n      ft_memset( &exec->zp0, 0, sizeof ( exec->zp0 ) );\r\n      exec->zp1 = exec->zp0;\r\n      exec->zp2 = exec->zp0;\r\n    }\r\n\r\n    /* XXX: We reserve a little more elements on the stack to deal safely */\r\n    /*      with broken fonts like arialbs, courbs, timesbs, etc.         */\r\n    tmp = exec->stackSize;\r\n    error = Update_Max( exec->memory,\r\n                        &tmp,\r\n                        sizeof ( FT_F26Dot6 ),\r\n                        (void*)&exec->stack,\r\n                        maxp->maxStackElements + 32 );\r\n    exec->stackSize = (FT_UInt)tmp;\r\n    if ( error )\r\n      return error;\r\n\r\n    tmp = exec->glyphSize;\r\n    error = Update_Max( exec->memory,\r\n                        &tmp,\r\n                        sizeof ( FT_Byte ),\r\n                        (void*)&exec->glyphIns,\r\n                        maxp->maxSizeOfInstructions );\r\n    exec->glyphSize = (FT_UShort)tmp;\r\n    if ( error )\r\n      return error;\r\n\r\n    exec->pts.n_points   = 0;\r\n    exec->pts.n_contours = 0;\r\n\r\n    exec->zp1 = exec->pts;\r\n    exec->zp2 = exec->pts;\r\n    exec->zp0 = exec->pts;\r\n\r\n    exec->instruction_trap = FALSE;\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Save_Context                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Saves the code ranges in a `size' object.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    exec :: A handle to the source execution context.                  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    size :: A handle to the target size object.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only the glyph loader and debugger should call this function.      */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Save_Context( TT_ExecContext  exec,\r\n                   TT_Size         size )\r\n  {\r\n    FT_Int  i;\r\n\r\n\r\n    /* XXX: Will probably disappear soon with all the code range */\r\n    /*      management, which is now rather obsolete.            */\r\n    /*                                                           */\r\n    size->num_function_defs    = exec->numFDefs;\r\n    size->num_instruction_defs = exec->numIDefs;\r\n\r\n    size->max_func = exec->maxFunc;\r\n    size->max_ins  = exec->maxIns;\r\n\r\n    for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )\r\n      size->codeRangeTable[i] = exec->codeRangeTable[i];\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_Run_Context                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Executes one or more instructions in the execution context.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    debug :: A Boolean flag.  If set, the function sets some internal  */\r\n  /*             variables and returns immediately, otherwise TT_RunIns()  */\r\n  /*             is called.                                                */\r\n  /*                                                                       */\r\n  /*             This is commented out currently.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    exec  :: A handle to the target execution context.                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    TrueType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only the glyph loader and debugger should call this function.      */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  TT_Run_Context( TT_ExecContext  exec,\r\n                  FT_Bool         debug )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    if ( ( error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ) )\r\n           != TT_Err_Ok )\r\n      return error;\r\n\r\n    exec->zp0 = exec->pts;\r\n    exec->zp1 = exec->pts;\r\n    exec->zp2 = exec->pts;\r\n\r\n    exec->GS.gep0 = 1;\r\n    exec->GS.gep1 = 1;\r\n    exec->GS.gep2 = 1;\r\n\r\n    exec->GS.projVector.x = 0x4000;\r\n    exec->GS.projVector.y = 0x0000;\r\n\r\n    exec->GS.freeVector = exec->GS.projVector;\r\n    exec->GS.dualVector = exec->GS.projVector;\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    exec->GS.both_x_axis = TRUE;\r\n#endif\r\n\r\n    exec->GS.round_state = 1;\r\n    exec->GS.loop        = 1;\r\n\r\n    /* some glyphs leave something on the stack. so we clean it */\r\n    /* before a new execution.                                  */\r\n    exec->top     = 0;\r\n    exec->callTop = 0;\r\n\r\n#if 1\r\n    FT_UNUSED( debug );\r\n\r\n    return exec->face->interpreter( exec );\r\n#else\r\n    if ( !debug )\r\n      return TT_RunIns( exec );\r\n    else\r\n      return TT_Err_Ok;\r\n#endif\r\n  }\r\n\r\n\r\n  /* The default value for `scan_control' is documented as FALSE in the */\r\n  /* TrueType specification.  This is confusing since it implies a      */\r\n  /* Boolean value.  However, this is not the case, thus both the       */\r\n  /* default values of our `scan_type' and `scan_control' fields (which */\r\n  /* the documentation's `scan_control' variable is split into) are     */\r\n  /* zero.                                                              */\r\n\r\n  const TT_GraphicsState  tt_default_graphics_state =\r\n  {\r\n    0, 0, 0,\r\n    { 0x4000, 0 },\r\n    { 0x4000, 0 },\r\n    { 0x4000, 0 },\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    TRUE,\r\n#endif\r\n\r\n    1, 64, 1,\r\n    TRUE, 68, 0, 0, 9, 3,\r\n    0, FALSE, 0, 1, 1, 1\r\n  };\r\n\r\n\r\n  /* documentation is in ttinterp.h */\r\n\r\n  FT_EXPORT_DEF( TT_ExecContext )\r\n  TT_New_Context( TT_Driver  driver )\r\n  {\r\n    TT_ExecContext  exec;\r\n    FT_Memory       memory;\r\n\r\n\r\n    memory = driver->root.root.memory;\r\n    exec   = driver->context;\r\n\r\n    if ( !driver->context )\r\n    {\r\n      FT_Error  error;\r\n\r\n\r\n      /* allocate object */\r\n      if ( FT_NEW( exec ) )\r\n        goto Fail;\r\n\r\n      /* initialize it; in case of error this deallocates `exec' too */\r\n      error = Init_Context( exec, memory );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* store it into the driver */\r\n      driver->context = exec;\r\n    }\r\n\r\n    return driver->context;\r\n\r\n  Fail:\r\n    return NULL;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Before an opcode is executed, the interpreter verifies that there are */\r\n  /* enough arguments on the stack, with the help of the `Pop_Push_Count'  */\r\n  /* table.                                                                */\r\n  /*                                                                       */\r\n  /* For each opcode, the first column gives the number of arguments that  */\r\n  /* are popped from the stack; the second one gives the number of those   */\r\n  /* that are pushed in result.                                            */\r\n  /*                                                                       */\r\n  /* Opcodes which have a varying number of parameters in the data stream  */\r\n  /* (NPUSHB, NPUSHW) are handled specially; they have a negative value in */\r\n  /* the `opcode_length' table, and the value in `Pop_Push_Count' is set   */\r\n  /* to zero.                                                              */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#undef  PACK\r\n#define PACK( x, y )  ( ( x << 4 ) | y )\r\n\r\n\r\n  static\r\n  const FT_Byte  Pop_Push_Count[256] =\r\n  {\r\n    /* opcodes are gathered in groups of 16 */\r\n    /* please keep the spaces as they are   */\r\n\r\n    /*  SVTCA  y  */  PACK( 0, 0 ),\r\n    /*  SVTCA  x  */  PACK( 0, 0 ),\r\n    /*  SPvTCA y  */  PACK( 0, 0 ),\r\n    /*  SPvTCA x  */  PACK( 0, 0 ),\r\n    /*  SFvTCA y  */  PACK( 0, 0 ),\r\n    /*  SFvTCA x  */  PACK( 0, 0 ),\r\n    /*  SPvTL //  */  PACK( 2, 0 ),\r\n    /*  SPvTL +   */  PACK( 2, 0 ),\r\n    /*  SFvTL //  */  PACK( 2, 0 ),\r\n    /*  SFvTL +   */  PACK( 2, 0 ),\r\n    /*  SPvFS     */  PACK( 2, 0 ),\r\n    /*  SFvFS     */  PACK( 2, 0 ),\r\n    /*  GPV       */  PACK( 0, 2 ),\r\n    /*  GFV       */  PACK( 0, 2 ),\r\n    /*  SFvTPv    */  PACK( 0, 0 ),\r\n    /*  ISECT     */  PACK( 5, 0 ),\r\n\r\n    /*  SRP0      */  PACK( 1, 0 ),\r\n    /*  SRP1      */  PACK( 1, 0 ),\r\n    /*  SRP2      */  PACK( 1, 0 ),\r\n    /*  SZP0      */  PACK( 1, 0 ),\r\n    /*  SZP1      */  PACK( 1, 0 ),\r\n    /*  SZP2      */  PACK( 1, 0 ),\r\n    /*  SZPS      */  PACK( 1, 0 ),\r\n    /*  SLOOP     */  PACK( 1, 0 ),\r\n    /*  RTG       */  PACK( 0, 0 ),\r\n    /*  RTHG      */  PACK( 0, 0 ),\r\n    /*  SMD       */  PACK( 1, 0 ),\r\n    /*  ELSE      */  PACK( 0, 0 ),\r\n    /*  JMPR      */  PACK( 1, 0 ),\r\n    /*  SCvTCi    */  PACK( 1, 0 ),\r\n    /*  SSwCi     */  PACK( 1, 0 ),\r\n    /*  SSW       */  PACK( 1, 0 ),\r\n\r\n    /*  DUP       */  PACK( 1, 2 ),\r\n    /*  POP       */  PACK( 1, 0 ),\r\n    /*  CLEAR     */  PACK( 0, 0 ),\r\n    /*  SWAP      */  PACK( 2, 2 ),\r\n    /*  DEPTH     */  PACK( 0, 1 ),\r\n    /*  CINDEX    */  PACK( 1, 1 ),\r\n    /*  MINDEX    */  PACK( 1, 0 ),\r\n    /*  AlignPTS  */  PACK( 2, 0 ),\r\n    /*  INS_$28   */  PACK( 0, 0 ),\r\n    /*  UTP       */  PACK( 1, 0 ),\r\n    /*  LOOPCALL  */  PACK( 2, 0 ),\r\n    /*  CALL      */  PACK( 1, 0 ),\r\n    /*  FDEF      */  PACK( 1, 0 ),\r\n    /*  ENDF      */  PACK( 0, 0 ),\r\n    /*  MDAP[0]   */  PACK( 1, 0 ),\r\n    /*  MDAP[1]   */  PACK( 1, 0 ),\r\n\r\n    /*  IUP[0]    */  PACK( 0, 0 ),\r\n    /*  IUP[1]    */  PACK( 0, 0 ),\r\n    /*  SHP[0]    */  PACK( 0, 0 ),\r\n    /*  SHP[1]    */  PACK( 0, 0 ),\r\n    /*  SHC[0]    */  PACK( 1, 0 ),\r\n    /*  SHC[1]    */  PACK( 1, 0 ),\r\n    /*  SHZ[0]    */  PACK( 1, 0 ),\r\n    /*  SHZ[1]    */  PACK( 1, 0 ),\r\n    /*  SHPIX     */  PACK( 1, 0 ),\r\n    /*  IP        */  PACK( 0, 0 ),\r\n    /*  MSIRP[0]  */  PACK( 2, 0 ),\r\n    /*  MSIRP[1]  */  PACK( 2, 0 ),\r\n    /*  AlignRP   */  PACK( 0, 0 ),\r\n    /*  RTDG      */  PACK( 0, 0 ),\r\n    /*  MIAP[0]   */  PACK( 2, 0 ),\r\n    /*  MIAP[1]   */  PACK( 2, 0 ),\r\n\r\n    /*  NPushB    */  PACK( 0, 0 ),\r\n    /*  NPushW    */  PACK( 0, 0 ),\r\n    /*  WS        */  PACK( 2, 0 ),\r\n    /*  RS        */  PACK( 1, 1 ),\r\n    /*  WCvtP     */  PACK( 2, 0 ),\r\n    /*  RCvt      */  PACK( 1, 1 ),\r\n    /*  GC[0]     */  PACK( 1, 1 ),\r\n    /*  GC[1]     */  PACK( 1, 1 ),\r\n    /*  SCFS      */  PACK( 2, 0 ),\r\n    /*  MD[0]     */  PACK( 2, 1 ),\r\n    /*  MD[1]     */  PACK( 2, 1 ),\r\n    /*  MPPEM     */  PACK( 0, 1 ),\r\n    /*  MPS       */  PACK( 0, 1 ),\r\n    /*  FlipON    */  PACK( 0, 0 ),\r\n    /*  FlipOFF   */  PACK( 0, 0 ),\r\n    /*  DEBUG     */  PACK( 1, 0 ),\r\n\r\n    /*  LT        */  PACK( 2, 1 ),\r\n    /*  LTEQ      */  PACK( 2, 1 ),\r\n    /*  GT        */  PACK( 2, 1 ),\r\n    /*  GTEQ      */  PACK( 2, 1 ),\r\n    /*  EQ        */  PACK( 2, 1 ),\r\n    /*  NEQ       */  PACK( 2, 1 ),\r\n    /*  ODD       */  PACK( 1, 1 ),\r\n    /*  EVEN      */  PACK( 1, 1 ),\r\n    /*  IF        */  PACK( 1, 0 ),\r\n    /*  EIF       */  PACK( 0, 0 ),\r\n    /*  AND       */  PACK( 2, 1 ),\r\n    /*  OR        */  PACK( 2, 1 ),\r\n    /*  NOT       */  PACK( 1, 1 ),\r\n    /*  DeltaP1   */  PACK( 1, 0 ),\r\n    /*  SDB       */  PACK( 1, 0 ),\r\n    /*  SDS       */  PACK( 1, 0 ),\r\n\r\n    /*  ADD       */  PACK( 2, 1 ),\r\n    /*  SUB       */  PACK( 2, 1 ),\r\n    /*  DIV       */  PACK( 2, 1 ),\r\n    /*  MUL       */  PACK( 2, 1 ),\r\n    /*  ABS       */  PACK( 1, 1 ),\r\n    /*  NEG       */  PACK( 1, 1 ),\r\n    /*  FLOOR     */  PACK( 1, 1 ),\r\n    /*  CEILING   */  PACK( 1, 1 ),\r\n    /*  ROUND[0]  */  PACK( 1, 1 ),\r\n    /*  ROUND[1]  */  PACK( 1, 1 ),\r\n    /*  ROUND[2]  */  PACK( 1, 1 ),\r\n    /*  ROUND[3]  */  PACK( 1, 1 ),\r\n    /*  NROUND[0] */  PACK( 1, 1 ),\r\n    /*  NROUND[1] */  PACK( 1, 1 ),\r\n    /*  NROUND[2] */  PACK( 1, 1 ),\r\n    /*  NROUND[3] */  PACK( 1, 1 ),\r\n\r\n    /*  WCvtF     */  PACK( 2, 0 ),\r\n    /*  DeltaP2   */  PACK( 1, 0 ),\r\n    /*  DeltaP3   */  PACK( 1, 0 ),\r\n    /*  DeltaCn[0] */ PACK( 1, 0 ),\r\n    /*  DeltaCn[1] */ PACK( 1, 0 ),\r\n    /*  DeltaCn[2] */ PACK( 1, 0 ),\r\n    /*  SROUND    */  PACK( 1, 0 ),\r\n    /*  S45Round  */  PACK( 1, 0 ),\r\n    /*  JROT      */  PACK( 2, 0 ),\r\n    /*  JROF      */  PACK( 2, 0 ),\r\n    /*  ROFF      */  PACK( 0, 0 ),\r\n    /*  INS_$7B   */  PACK( 0, 0 ),\r\n    /*  RUTG      */  PACK( 0, 0 ),\r\n    /*  RDTG      */  PACK( 0, 0 ),\r\n    /*  SANGW     */  PACK( 1, 0 ),\r\n    /*  AA        */  PACK( 1, 0 ),\r\n\r\n    /*  FlipPT    */  PACK( 0, 0 ),\r\n    /*  FlipRgON  */  PACK( 2, 0 ),\r\n    /*  FlipRgOFF */  PACK( 2, 0 ),\r\n    /*  INS_$83   */  PACK( 0, 0 ),\r\n    /*  INS_$84   */  PACK( 0, 0 ),\r\n    /*  ScanCTRL  */  PACK( 1, 0 ),\r\n    /*  SDPVTL[0] */  PACK( 2, 0 ),\r\n    /*  SDPVTL[1] */  PACK( 2, 0 ),\r\n    /*  GetINFO   */  PACK( 1, 1 ),\r\n    /*  IDEF      */  PACK( 1, 0 ),\r\n    /*  ROLL      */  PACK( 3, 3 ),\r\n    /*  MAX       */  PACK( 2, 1 ),\r\n    /*  MIN       */  PACK( 2, 1 ),\r\n    /*  ScanTYPE  */  PACK( 1, 0 ),\r\n    /*  InstCTRL  */  PACK( 2, 0 ),\r\n    /*  INS_$8F   */  PACK( 0, 0 ),\r\n\r\n    /*  INS_$90  */   PACK( 0, 0 ),\r\n    /*  INS_$91  */   PACK( 0, 0 ),\r\n    /*  INS_$92  */   PACK( 0, 0 ),\r\n    /*  INS_$93  */   PACK( 0, 0 ),\r\n    /*  INS_$94  */   PACK( 0, 0 ),\r\n    /*  INS_$95  */   PACK( 0, 0 ),\r\n    /*  INS_$96  */   PACK( 0, 0 ),\r\n    /*  INS_$97  */   PACK( 0, 0 ),\r\n    /*  INS_$98  */   PACK( 0, 0 ),\r\n    /*  INS_$99  */   PACK( 0, 0 ),\r\n    /*  INS_$9A  */   PACK( 0, 0 ),\r\n    /*  INS_$9B  */   PACK( 0, 0 ),\r\n    /*  INS_$9C  */   PACK( 0, 0 ),\r\n    /*  INS_$9D  */   PACK( 0, 0 ),\r\n    /*  INS_$9E  */   PACK( 0, 0 ),\r\n    /*  INS_$9F  */   PACK( 0, 0 ),\r\n\r\n    /*  INS_$A0  */   PACK( 0, 0 ),\r\n    /*  INS_$A1  */   PACK( 0, 0 ),\r\n    /*  INS_$A2  */   PACK( 0, 0 ),\r\n    /*  INS_$A3  */   PACK( 0, 0 ),\r\n    /*  INS_$A4  */   PACK( 0, 0 ),\r\n    /*  INS_$A5  */   PACK( 0, 0 ),\r\n    /*  INS_$A6  */   PACK( 0, 0 ),\r\n    /*  INS_$A7  */   PACK( 0, 0 ),\r\n    /*  INS_$A8  */   PACK( 0, 0 ),\r\n    /*  INS_$A9  */   PACK( 0, 0 ),\r\n    /*  INS_$AA  */   PACK( 0, 0 ),\r\n    /*  INS_$AB  */   PACK( 0, 0 ),\r\n    /*  INS_$AC  */   PACK( 0, 0 ),\r\n    /*  INS_$AD  */   PACK( 0, 0 ),\r\n    /*  INS_$AE  */   PACK( 0, 0 ),\r\n    /*  INS_$AF  */   PACK( 0, 0 ),\r\n\r\n    /*  PushB[0]  */  PACK( 0, 1 ),\r\n    /*  PushB[1]  */  PACK( 0, 2 ),\r\n    /*  PushB[2]  */  PACK( 0, 3 ),\r\n    /*  PushB[3]  */  PACK( 0, 4 ),\r\n    /*  PushB[4]  */  PACK( 0, 5 ),\r\n    /*  PushB[5]  */  PACK( 0, 6 ),\r\n    /*  PushB[6]  */  PACK( 0, 7 ),\r\n    /*  PushB[7]  */  PACK( 0, 8 ),\r\n    /*  PushW[0]  */  PACK( 0, 1 ),\r\n    /*  PushW[1]  */  PACK( 0, 2 ),\r\n    /*  PushW[2]  */  PACK( 0, 3 ),\r\n    /*  PushW[3]  */  PACK( 0, 4 ),\r\n    /*  PushW[4]  */  PACK( 0, 5 ),\r\n    /*  PushW[5]  */  PACK( 0, 6 ),\r\n    /*  PushW[6]  */  PACK( 0, 7 ),\r\n    /*  PushW[7]  */  PACK( 0, 8 ),\r\n\r\n    /*  MDRP[00]  */  PACK( 1, 0 ),\r\n    /*  MDRP[01]  */  PACK( 1, 0 ),\r\n    /*  MDRP[02]  */  PACK( 1, 0 ),\r\n    /*  MDRP[03]  */  PACK( 1, 0 ),\r\n    /*  MDRP[04]  */  PACK( 1, 0 ),\r\n    /*  MDRP[05]  */  PACK( 1, 0 ),\r\n    /*  MDRP[06]  */  PACK( 1, 0 ),\r\n    /*  MDRP[07]  */  PACK( 1, 0 ),\r\n    /*  MDRP[08]  */  PACK( 1, 0 ),\r\n    /*  MDRP[09]  */  PACK( 1, 0 ),\r\n    /*  MDRP[10]  */  PACK( 1, 0 ),\r\n    /*  MDRP[11]  */  PACK( 1, 0 ),\r\n    /*  MDRP[12]  */  PACK( 1, 0 ),\r\n    /*  MDRP[13]  */  PACK( 1, 0 ),\r\n    /*  MDRP[14]  */  PACK( 1, 0 ),\r\n    /*  MDRP[15]  */  PACK( 1, 0 ),\r\n\r\n    /*  MDRP[16]  */  PACK( 1, 0 ),\r\n    /*  MDRP[17]  */  PACK( 1, 0 ),\r\n    /*  MDRP[18]  */  PACK( 1, 0 ),\r\n    /*  MDRP[19]  */  PACK( 1, 0 ),\r\n    /*  MDRP[20]  */  PACK( 1, 0 ),\r\n    /*  MDRP[21]  */  PACK( 1, 0 ),\r\n    /*  MDRP[22]  */  PACK( 1, 0 ),\r\n    /*  MDRP[23]  */  PACK( 1, 0 ),\r\n    /*  MDRP[24]  */  PACK( 1, 0 ),\r\n    /*  MDRP[25]  */  PACK( 1, 0 ),\r\n    /*  MDRP[26]  */  PACK( 1, 0 ),\r\n    /*  MDRP[27]  */  PACK( 1, 0 ),\r\n    /*  MDRP[28]  */  PACK( 1, 0 ),\r\n    /*  MDRP[29]  */  PACK( 1, 0 ),\r\n    /*  MDRP[30]  */  PACK( 1, 0 ),\r\n    /*  MDRP[31]  */  PACK( 1, 0 ),\r\n\r\n    /*  MIRP[00]  */  PACK( 2, 0 ),\r\n    /*  MIRP[01]  */  PACK( 2, 0 ),\r\n    /*  MIRP[02]  */  PACK( 2, 0 ),\r\n    /*  MIRP[03]  */  PACK( 2, 0 ),\r\n    /*  MIRP[04]  */  PACK( 2, 0 ),\r\n    /*  MIRP[05]  */  PACK( 2, 0 ),\r\n    /*  MIRP[06]  */  PACK( 2, 0 ),\r\n    /*  MIRP[07]  */  PACK( 2, 0 ),\r\n    /*  MIRP[08]  */  PACK( 2, 0 ),\r\n    /*  MIRP[09]  */  PACK( 2, 0 ),\r\n    /*  MIRP[10]  */  PACK( 2, 0 ),\r\n    /*  MIRP[11]  */  PACK( 2, 0 ),\r\n    /*  MIRP[12]  */  PACK( 2, 0 ),\r\n    /*  MIRP[13]  */  PACK( 2, 0 ),\r\n    /*  MIRP[14]  */  PACK( 2, 0 ),\r\n    /*  MIRP[15]  */  PACK( 2, 0 ),\r\n\r\n    /*  MIRP[16]  */  PACK( 2, 0 ),\r\n    /*  MIRP[17]  */  PACK( 2, 0 ),\r\n    /*  MIRP[18]  */  PACK( 2, 0 ),\r\n    /*  MIRP[19]  */  PACK( 2, 0 ),\r\n    /*  MIRP[20]  */  PACK( 2, 0 ),\r\n    /*  MIRP[21]  */  PACK( 2, 0 ),\r\n    /*  MIRP[22]  */  PACK( 2, 0 ),\r\n    /*  MIRP[23]  */  PACK( 2, 0 ),\r\n    /*  MIRP[24]  */  PACK( 2, 0 ),\r\n    /*  MIRP[25]  */  PACK( 2, 0 ),\r\n    /*  MIRP[26]  */  PACK( 2, 0 ),\r\n    /*  MIRP[27]  */  PACK( 2, 0 ),\r\n    /*  MIRP[28]  */  PACK( 2, 0 ),\r\n    /*  MIRP[29]  */  PACK( 2, 0 ),\r\n    /*  MIRP[30]  */  PACK( 2, 0 ),\r\n    /*  MIRP[31]  */  PACK( 2, 0 )\r\n  };\r\n\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n  static\r\n  const char*  const opcode_name[256] =\r\n  {\r\n    \"SVTCA y\",\r\n    \"SVTCA x\",\r\n    \"SPvTCA y\",\r\n    \"SPvTCA x\",\r\n    \"SFvTCA y\",\r\n    \"SFvTCA x\",\r\n    \"SPvTL ||\",\r\n    \"SPvTL +\",\r\n    \"SFvTL ||\",\r\n    \"SFvTL +\",\r\n    \"SPvFS\",\r\n    \"SFvFS\",\r\n    \"GPV\",\r\n    \"GFV\",\r\n    \"SFvTPv\",\r\n    \"ISECT\",\r\n\r\n    \"SRP0\",\r\n    \"SRP1\",\r\n    \"SRP2\",\r\n    \"SZP0\",\r\n    \"SZP1\",\r\n    \"SZP2\",\r\n    \"SZPS\",\r\n    \"SLOOP\",\r\n    \"RTG\",\r\n    \"RTHG\",\r\n    \"SMD\",\r\n    \"ELSE\",\r\n    \"JMPR\",\r\n    \"SCvTCi\",\r\n    \"SSwCi\",\r\n    \"SSW\",\r\n\r\n    \"DUP\",\r\n    \"POP\",\r\n    \"CLEAR\",\r\n    \"SWAP\",\r\n    \"DEPTH\",\r\n    \"CINDEX\",\r\n    \"MINDEX\",\r\n    \"AlignPTS\",\r\n    \"INS_$28\",\r\n    \"UTP\",\r\n    \"LOOPCALL\",\r\n    \"CALL\",\r\n    \"FDEF\",\r\n    \"ENDF\",\r\n    \"MDAP[0]\",\r\n    \"MDAP[1]\",\r\n\r\n    \"IUP[0]\",\r\n    \"IUP[1]\",\r\n    \"SHP[0]\",\r\n    \"SHP[1]\",\r\n    \"SHC[0]\",\r\n    \"SHC[1]\",\r\n    \"SHZ[0]\",\r\n    \"SHZ[1]\",\r\n    \"SHPIX\",\r\n    \"IP\",\r\n    \"MSIRP[0]\",\r\n    \"MSIRP[1]\",\r\n    \"AlignRP\",\r\n    \"RTDG\",\r\n    \"MIAP[0]\",\r\n    \"MIAP[1]\",\r\n\r\n    \"NPushB\",\r\n    \"NPushW\",\r\n    \"WS\",\r\n    \"RS\",\r\n    \"WCvtP\",\r\n    \"RCvt\",\r\n    \"GC[0]\",\r\n    \"GC[1]\",\r\n    \"SCFS\",\r\n    \"MD[0]\",\r\n    \"MD[1]\",\r\n    \"MPPEM\",\r\n    \"MPS\",\r\n    \"FlipON\",\r\n    \"FlipOFF\",\r\n    \"DEBUG\",\r\n\r\n    \"LT\",\r\n    \"LTEQ\",\r\n    \"GT\",\r\n    \"GTEQ\",\r\n    \"EQ\",\r\n    \"NEQ\",\r\n    \"ODD\",\r\n    \"EVEN\",\r\n    \"IF\",\r\n    \"EIF\",\r\n    \"AND\",\r\n    \"OR\",\r\n    \"NOT\",\r\n    \"DeltaP1\",\r\n    \"SDB\",\r\n    \"SDS\",\r\n\r\n    \"ADD\",\r\n    \"SUB\",\r\n    \"DIV\",\r\n    \"MUL\",\r\n    \"ABS\",\r\n    \"NEG\",\r\n    \"FLOOR\",\r\n    \"CEILING\",\r\n    \"ROUND[0]\",\r\n    \"ROUND[1]\",\r\n    \"ROUND[2]\",\r\n    \"ROUND[3]\",\r\n    \"NROUND[0]\",\r\n    \"NROUND[1]\",\r\n    \"NROUND[2]\",\r\n    \"NROUND[3]\",\r\n\r\n    \"WCvtF\",\r\n    \"DeltaP2\",\r\n    \"DeltaP3\",\r\n    \"DeltaCn[0]\",\r\n    \"DeltaCn[1]\",\r\n    \"DeltaCn[2]\",\r\n    \"SROUND\",\r\n    \"S45Round\",\r\n    \"JROT\",\r\n    \"JROF\",\r\n    \"ROFF\",\r\n    \"INS_$7B\",\r\n    \"RUTG\",\r\n    \"RDTG\",\r\n    \"SANGW\",\r\n    \"AA\",\r\n\r\n    \"FlipPT\",\r\n    \"FlipRgON\",\r\n    \"FlipRgOFF\",\r\n    \"INS_$83\",\r\n    \"INS_$84\",\r\n    \"ScanCTRL\",\r\n    \"SDVPTL[0]\",\r\n    \"SDVPTL[1]\",\r\n    \"GetINFO\",\r\n    \"IDEF\",\r\n    \"ROLL\",\r\n    \"MAX\",\r\n    \"MIN\",\r\n    \"ScanTYPE\",\r\n    \"InstCTRL\",\r\n    \"INS_$8F\",\r\n\r\n    \"INS_$90\",\r\n    \"INS_$91\",\r\n    \"INS_$92\",\r\n    \"INS_$93\",\r\n    \"INS_$94\",\r\n    \"INS_$95\",\r\n    \"INS_$96\",\r\n    \"INS_$97\",\r\n    \"INS_$98\",\r\n    \"INS_$99\",\r\n    \"INS_$9A\",\r\n    \"INS_$9B\",\r\n    \"INS_$9C\",\r\n    \"INS_$9D\",\r\n    \"INS_$9E\",\r\n    \"INS_$9F\",\r\n\r\n    \"INS_$A0\",\r\n    \"INS_$A1\",\r\n    \"INS_$A2\",\r\n    \"INS_$A3\",\r\n    \"INS_$A4\",\r\n    \"INS_$A5\",\r\n    \"INS_$A6\",\r\n    \"INS_$A7\",\r\n    \"INS_$A8\",\r\n    \"INS_$A9\",\r\n    \"INS_$AA\",\r\n    \"INS_$AB\",\r\n    \"INS_$AC\",\r\n    \"INS_$AD\",\r\n    \"INS_$AE\",\r\n    \"INS_$AF\",\r\n\r\n    \"PushB[0]\",\r\n    \"PushB[1]\",\r\n    \"PushB[2]\",\r\n    \"PushB[3]\",\r\n    \"PushB[4]\",\r\n    \"PushB[5]\",\r\n    \"PushB[6]\",\r\n    \"PushB[7]\",\r\n    \"PushW[0]\",\r\n    \"PushW[1]\",\r\n    \"PushW[2]\",\r\n    \"PushW[3]\",\r\n    \"PushW[4]\",\r\n    \"PushW[5]\",\r\n    \"PushW[6]\",\r\n    \"PushW[7]\",\r\n\r\n    \"MDRP[00]\",\r\n    \"MDRP[01]\",\r\n    \"MDRP[02]\",\r\n    \"MDRP[03]\",\r\n    \"MDRP[04]\",\r\n    \"MDRP[05]\",\r\n    \"MDRP[06]\",\r\n    \"MDRP[07]\",\r\n    \"MDRP[08]\",\r\n    \"MDRP[09]\",\r\n    \"MDRP[10]\",\r\n    \"MDRP[11]\",\r\n    \"MDRP[12]\",\r\n    \"MDRP[13]\",\r\n    \"MDRP[14]\",\r\n    \"MDRP[15]\",\r\n\r\n    \"MDRP[16]\",\r\n    \"MDRP[17]\",\r\n    \"MDRP[18]\",\r\n    \"MDRP[19]\",\r\n    \"MDRP[20]\",\r\n    \"MDRP[21]\",\r\n    \"MDRP[22]\",\r\n    \"MDRP[23]\",\r\n    \"MDRP[24]\",\r\n    \"MDRP[25]\",\r\n    \"MDRP[26]\",\r\n    \"MDRP[27]\",\r\n    \"MDRP[28]\",\r\n    \"MDRP[29]\",\r\n    \"MDRP[30]\",\r\n    \"MDRP[31]\",\r\n\r\n    \"MIRP[00]\",\r\n    \"MIRP[01]\",\r\n    \"MIRP[02]\",\r\n    \"MIRP[03]\",\r\n    \"MIRP[04]\",\r\n    \"MIRP[05]\",\r\n    \"MIRP[06]\",\r\n    \"MIRP[07]\",\r\n    \"MIRP[08]\",\r\n    \"MIRP[09]\",\r\n    \"MIRP[10]\",\r\n    \"MIRP[11]\",\r\n    \"MIRP[12]\",\r\n    \"MIRP[13]\",\r\n    \"MIRP[14]\",\r\n    \"MIRP[15]\",\r\n\r\n    \"MIRP[16]\",\r\n    \"MIRP[17]\",\r\n    \"MIRP[18]\",\r\n    \"MIRP[19]\",\r\n    \"MIRP[20]\",\r\n    \"MIRP[21]\",\r\n    \"MIRP[22]\",\r\n    \"MIRP[23]\",\r\n    \"MIRP[24]\",\r\n    \"MIRP[25]\",\r\n    \"MIRP[26]\",\r\n    \"MIRP[27]\",\r\n    \"MIRP[28]\",\r\n    \"MIRP[29]\",\r\n    \"MIRP[30]\",\r\n    \"MIRP[31]\"\r\n  };\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  static\r\n  const FT_Char  opcode_length[256] =\r\n  {\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n\r\n   -1,-2, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    2, 3, 4, 5,  6, 7, 8, 9,  3, 5, 7, 9, 11,13,15,17,\r\n\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,\r\n    1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1\r\n  };\r\n\r\n#undef PACK\r\n\r\n#if 1\r\n\r\n  static FT_Int32\r\n  TT_MulFix14( FT_Int32  a,\r\n               FT_Int    b )\r\n  {\r\n    FT_Int32   sign;\r\n    FT_UInt32  ah, al, mid, lo, hi;\r\n\r\n\r\n    sign = a ^ b;\r\n\r\n    if ( a < 0 )\r\n      a = -a;\r\n    if ( b < 0 )\r\n      b = -b;\r\n\r\n    ah = (FT_UInt32)( ( a >> 16 ) & 0xFFFFU );\r\n    al = (FT_UInt32)( a & 0xFFFFU );\r\n\r\n    lo    = al * b;\r\n    mid   = ah * b;\r\n    hi    = mid >> 16;\r\n    mid   = ( mid << 16 ) + ( 1 << 13 ); /* rounding */\r\n    lo   += mid;\r\n    if ( lo < mid )\r\n      hi += 1;\r\n\r\n    mid = ( lo >> 14 ) | ( hi << 18 );\r\n\r\n    return sign >= 0 ? (FT_Int32)mid : -(FT_Int32)mid;\r\n  }\r\n\r\n#else\r\n\r\n  /* compute (a*b)/2^14 with maximum accuracy and rounding */\r\n  static FT_Int32\r\n  TT_MulFix14( FT_Int32  a,\r\n               FT_Int    b )\r\n  {\r\n    FT_Int32   m, s, hi;\r\n    FT_UInt32  l, lo;\r\n\r\n\r\n    /* compute ax*bx as 64-bit value */\r\n    l  = (FT_UInt32)( ( a & 0xFFFFU ) * b );\r\n    m  = ( a >> 16 ) * b;\r\n\r\n    lo = l + (FT_UInt32)( m << 16 );\r\n    hi = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo < l );\r\n\r\n    /* divide the result by 2^14 with rounding */\r\n    s   = hi >> 31;\r\n    l   = lo + (FT_UInt32)s;\r\n    hi += s + ( l < lo );\r\n    lo  = l;\r\n\r\n    l   = lo + 0x2000U;\r\n    hi += l < lo;\r\n\r\n    return ( hi << 18 ) | ( l >> 14 );\r\n  }\r\n#endif\r\n\r\n\r\n  /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */\r\n  static FT_Int32\r\n  TT_DotFix14( FT_Int32  ax,\r\n               FT_Int32  ay,\r\n               FT_Int    bx,\r\n               FT_Int    by )\r\n  {\r\n    FT_Int32   m, s, hi1, hi2, hi;\r\n    FT_UInt32  l, lo1, lo2, lo;\r\n\r\n\r\n    /* compute ax*bx as 64-bit value */\r\n    l = (FT_UInt32)( ( ax & 0xFFFFU ) * bx );\r\n    m = ( ax >> 16 ) * bx;\r\n\r\n    lo1 = l + (FT_UInt32)( m << 16 );\r\n    hi1 = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo1 < l );\r\n\r\n    /* compute ay*by as 64-bit value */\r\n    l = (FT_UInt32)( ( ay & 0xFFFFU ) * by );\r\n    m = ( ay >> 16 ) * by;\r\n\r\n    lo2 = l + (FT_UInt32)( m << 16 );\r\n    hi2 = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo2 < l );\r\n\r\n    /* add them */\r\n    lo = lo1 + lo2;\r\n    hi = hi1 + hi2 + ( lo < lo1 );\r\n\r\n    /* divide the result by 2^14 with rounding */\r\n    s   = hi >> 31;\r\n    l   = lo + (FT_UInt32)s;\r\n    hi += s + ( l < lo );\r\n    lo  = l;\r\n\r\n    l   = lo + 0x2000U;\r\n    hi += ( l < lo );\r\n\r\n    return ( hi << 18 ) | ( l >> 14 );\r\n  }\r\n\r\n\r\n  /* return length of given vector */\r\n\r\n#if 0\r\n\r\n  static FT_Int32\r\n  TT_VecLen( FT_Int32  x,\r\n             FT_Int32  y )\r\n  {\r\n    FT_Int32   m, hi1, hi2, hi;\r\n    FT_UInt32  l, lo1, lo2, lo;\r\n\r\n\r\n    /* compute x*x as 64-bit value */\r\n    lo = (FT_UInt32)( x & 0xFFFFU );\r\n    hi = x >> 16;\r\n\r\n    l  = lo * lo;\r\n    m  = hi * lo;\r\n    hi = hi * hi;\r\n\r\n    lo1 = l + (FT_UInt32)( m << 17 );\r\n    hi1 = hi + ( m >> 15 ) + ( lo1 < l );\r\n\r\n    /* compute y*y as 64-bit value */\r\n    lo = (FT_UInt32)( y & 0xFFFFU );\r\n    hi = y >> 16;\r\n\r\n    l  = lo * lo;\r\n    m  = hi * lo;\r\n    hi = hi * hi;\r\n\r\n    lo2 = l + (FT_UInt32)( m << 17 );\r\n    hi2 = hi + ( m >> 15 ) + ( lo2 < l );\r\n\r\n    /* add them to get 'x*x+y*y' as 64-bit value */\r\n    lo = lo1 + lo2;\r\n    hi = hi1 + hi2 + ( lo < lo1 );\r\n\r\n    /* compute the square root of this value */\r\n    {\r\n      FT_UInt32  root, rem, test_div;\r\n      FT_Int     count;\r\n\r\n\r\n      root = 0;\r\n\r\n      {\r\n        rem   = 0;\r\n        count = 32;\r\n        do\r\n        {\r\n          rem      = ( rem << 2 ) | ( (FT_UInt32)hi >> 30 );\r\n          hi       = (  hi << 2 ) | (            lo >> 30 );\r\n          lo     <<= 2;\r\n          root   <<= 1;\r\n          test_div = ( root << 1 ) + 1;\r\n\r\n          if ( rem >= test_div )\r\n          {\r\n            rem  -= test_div;\r\n            root += 1;\r\n          }\r\n        } while ( --count );\r\n      }\r\n\r\n      return (FT_Int32)root;\r\n    }\r\n  }\r\n\r\n#else\r\n\r\n  /* this version uses FT_Vector_Length which computes the same value */\r\n  /* much, much faster..                                              */\r\n  /*                                                                  */\r\n  static FT_F26Dot6\r\n  TT_VecLen( FT_F26Dot6  X,\r\n             FT_F26Dot6  Y )\r\n  {\r\n    FT_Vector  v;\r\n\r\n\r\n    v.x = X;\r\n    v.y = Y;\r\n\r\n    return FT_Vector_Length( &v );\r\n  }\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Current_Ratio                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Returns the current aspect ratio scaling factor depending on the   */\r\n  /*    projection vector's state and device resolutions.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The aspect ratio in 16.16 format, always <= 1.0 .                  */\r\n  /*                                                                       */\r\n  static FT_Long\r\n  Current_Ratio( EXEC_OP )\r\n  {\r\n    if ( !CUR.tt_metrics.ratio )\r\n    {\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n      if ( CUR.face->unpatented_hinting )\r\n      {\r\n        if ( CUR.GS.both_x_axis )\r\n          CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;\r\n        else\r\n          CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;\r\n      }\r\n      else\r\n#endif\r\n      {\r\n        if ( CUR.GS.projVector.y == 0 )\r\n          CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;\r\n\r\n        else if ( CUR.GS.projVector.x == 0 )\r\n          CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;\r\n\r\n        else\r\n        {\r\n          FT_F26Dot6  x, y;\r\n\r\n\r\n          x = TT_MulFix14( CUR.tt_metrics.x_ratio,\r\n                           CUR.GS.projVector.x );\r\n          y = TT_MulFix14( CUR.tt_metrics.y_ratio,\r\n                           CUR.GS.projVector.y );\r\n          CUR.tt_metrics.ratio = TT_VecLen( x, y );\r\n        }\r\n      }\r\n    }\r\n    return CUR.tt_metrics.ratio;\r\n  }\r\n\r\n\r\n  static FT_Long\r\n  Current_Ppem( EXEC_OP )\r\n  {\r\n    return FT_MulFix( CUR.tt_metrics.ppem, CURRENT_Ratio() );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Functions related to the control value table (CVT).                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_F26Dot6 )\r\n  Read_CVT( EXEC_OP_ FT_ULong  idx )\r\n  {\r\n    return CUR.cvt[idx];\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_F26Dot6 )\r\n  Read_CVT_Stretched( EXEC_OP_ FT_ULong  idx )\r\n  {\r\n    return FT_MulFix( CUR.cvt[idx], CURRENT_Ratio() );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  Write_CVT( EXEC_OP_ FT_ULong    idx,\r\n                      FT_F26Dot6  value )\r\n  {\r\n    CUR.cvt[idx] = value;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  Write_CVT_Stretched( EXEC_OP_ FT_ULong    idx,\r\n                                FT_F26Dot6  value )\r\n  {\r\n    CUR.cvt[idx] = FT_DivFix( value, CURRENT_Ratio() );\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  Move_CVT( EXEC_OP_ FT_ULong    idx,\r\n                     FT_F26Dot6  value )\r\n  {\r\n    CUR.cvt[idx] += value;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( void )\r\n  Move_CVT_Stretched( EXEC_OP_ FT_ULong    idx,\r\n                               FT_F26Dot6  value )\r\n  {\r\n    CUR.cvt[idx] += FT_DivFix( value, CURRENT_Ratio() );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    GetShortIns                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Returns a short integer taken from the instruction stream at       */\r\n  /*    address IP.                                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Short read at code[IP].                                            */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This one could become a macro.                                     */\r\n  /*                                                                       */\r\n  static FT_Short\r\n  GetShortIns( EXEC_OP )\r\n  {\r\n    /* Reading a byte stream so there is no endianess (DaveP) */\r\n    CUR.IP += 2;\r\n    return (FT_Short)( ( CUR.code[CUR.IP - 2] << 8 ) +\r\n                         CUR.code[CUR.IP - 1]      );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Ins_Goto_CodeRange                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Goes to a certain code range in the instruction stream.            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    aRange :: The index of the code range.                             */\r\n  /*                                                                       */\r\n  /*    aIP    :: The new IP address in the code range.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    SUCCESS or FAILURE.                                                */\r\n  /*                                                                       */\r\n  static FT_Bool\r\n  Ins_Goto_CodeRange( EXEC_OP_ FT_Int    aRange,\r\n                               FT_ULong  aIP )\r\n  {\r\n    TT_CodeRange*  range;\r\n\r\n\r\n    if ( aRange < 1 || aRange > 3 )\r\n    {\r\n      CUR.error = TT_Err_Bad_Argument;\r\n      return FAILURE;\r\n    }\r\n\r\n    range = &CUR.codeRangeTable[aRange - 1];\r\n\r\n    if ( range->base == NULL )     /* invalid coderange */\r\n    {\r\n      CUR.error = TT_Err_Invalid_CodeRange;\r\n      return FAILURE;\r\n    }\r\n\r\n    /* NOTE: Because the last instruction of a program may be a CALL */\r\n    /*       which will return to the first byte *after* the code    */\r\n    /*       range, we test for aIP <= Size, instead of aIP < Size.  */\r\n\r\n    if ( aIP > range->size )\r\n    {\r\n      CUR.error = TT_Err_Code_Overflow;\r\n      return FAILURE;\r\n    }\r\n\r\n    CUR.code     = range->base;\r\n    CUR.codeSize = range->size;\r\n    CUR.IP       = aIP;\r\n    CUR.curRange = aRange;\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Direct_Move                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Moves a point by a given distance along the freedom vector.  The   */\r\n  /*    point will be `touched'.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    point    :: The index of the point to move.                        */\r\n  /*                                                                       */\r\n  /*    distance :: The distance to apply.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    zone     :: The affected glyph zone.                               */\r\n  /*                                                                       */\r\n  static void\r\n  Direct_Move( EXEC_OP_ TT_GlyphZone  zone,\r\n                        FT_UShort     point,\r\n                        FT_F26Dot6    distance )\r\n  {\r\n    FT_F26Dot6  v;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    FT_ASSERT( !CUR.face->unpatented_hinting );\r\n#endif\r\n\r\n    v = CUR.GS.freeVector.x;\r\n\r\n    if ( v != 0 )\r\n    {\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( !CUR.ignore_x_mode                                ||\r\n           ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n      zone->cur[point].x += FT_MulDiv( distance, v, CUR.F_dot_P );\r\n\r\n      zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;\r\n    }\r\n\r\n    v = CUR.GS.freeVector.y;\r\n\r\n    if ( v != 0 )\r\n    {\r\n      zone->cur[point].y += FT_MulDiv( distance, v, CUR.F_dot_P );\r\n\r\n      zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Direct_Move_Orig                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Moves the *original* position of a point by a given distance along */\r\n  /*    the freedom vector.  Obviously, the point will not be `touched'.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    point    :: The index of the point to move.                        */\r\n  /*                                                                       */\r\n  /*    distance :: The distance to apply.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    zone     :: The affected glyph zone.                               */\r\n  /*                                                                       */\r\n  static void\r\n  Direct_Move_Orig( EXEC_OP_ TT_GlyphZone  zone,\r\n                             FT_UShort     point,\r\n                             FT_F26Dot6    distance )\r\n  {\r\n    FT_F26Dot6  v;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    FT_ASSERT( !CUR.face->unpatented_hinting );\r\n#endif\r\n\r\n    v = CUR.GS.freeVector.x;\r\n\r\n    if ( v != 0 )\r\n      zone->org[point].x += FT_MulDiv( distance, v, CUR.F_dot_P );\r\n\r\n    v = CUR.GS.freeVector.y;\r\n\r\n    if ( v != 0 )\r\n      zone->org[point].y += FT_MulDiv( distance, v, CUR.F_dot_P );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Special versions of Direct_Move()                                     */\r\n  /*                                                                       */\r\n  /*   The following versions are used whenever both vectors are both      */\r\n  /*   along one of the coordinate unit vectors, i.e. in 90% of the cases. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static void\r\n  Direct_Move_X( EXEC_OP_ TT_GlyphZone  zone,\r\n                          FT_UShort     point,\r\n                          FT_F26Dot6    distance )\r\n  {\r\n    FT_UNUSED_EXEC;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( !CUR.ignore_x_mode                                 ||\r\n         ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVEX ) )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n    zone->cur[point].x += distance;\r\n    zone->tags[point]  |= FT_CURVE_TAG_TOUCH_X;\r\n  }\r\n\r\n\r\n  static void\r\n  Direct_Move_Y( EXEC_OP_ TT_GlyphZone  zone,\r\n                          FT_UShort     point,\r\n                          FT_F26Dot6    distance )\r\n  {\r\n    FT_UNUSED_EXEC;\r\n\r\n    zone->cur[point].y += distance;\r\n    zone->tags[point]  |= FT_CURVE_TAG_TOUCH_Y;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Special versions of Direct_Move_Orig()                                */\r\n  /*                                                                       */\r\n  /*   The following versions are used whenever both vectors are both      */\r\n  /*   along one of the coordinate unit vectors, i.e. in 90% of the cases. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static void\r\n  Direct_Move_Orig_X( EXEC_OP_ TT_GlyphZone  zone,\r\n                               FT_UShort     point,\r\n                               FT_F26Dot6    distance )\r\n  {\r\n    FT_UNUSED_EXEC;\r\n\r\n    zone->org[point].x += distance;\r\n  }\r\n\r\n\r\n  static void\r\n  Direct_Move_Orig_Y( EXEC_OP_ TT_GlyphZone  zone,\r\n                               FT_UShort     point,\r\n                               FT_F26Dot6    distance )\r\n  {\r\n    FT_UNUSED_EXEC;\r\n\r\n    zone->org[point].y += distance;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_None                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Does not round, but adds engine compensation.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance (not) to round.                       */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The compensated distance.                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The TrueType specification says very few about the relationship    */\r\n  /*    between rounding and engine compensation.  However, it seems from  */\r\n  /*    the description of super round that we should add the compensation */\r\n  /*    before rounding.                                                   */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_None( EXEC_OP_ FT_F26Dot6  distance,\r\n                       FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = distance + compensation;\r\n      if ( distance && val < 0 )\r\n        val = 0;\r\n    }\r\n    else\r\n    {\r\n      val = distance - compensation;\r\n      if ( val > 0 )\r\n        val = 0;\r\n    }\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_To_Grid                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Rounds value to grid after adding engine compensation.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_To_Grid( EXEC_OP_ FT_F26Dot6  distance,\r\n                          FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = distance + compensation + 32;\r\n      if ( distance && val > 0 )\r\n        val &= ~63;\r\n      else\r\n        val = 0;\r\n    }\r\n    else\r\n    {\r\n      val = -FT_PIX_ROUND( compensation - distance );\r\n      if ( val > 0 )\r\n        val = 0;\r\n    }\r\n\r\n    return  val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_To_Half_Grid                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Rounds value to half grid after adding engine compensation.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_To_Half_Grid( EXEC_OP_ FT_F26Dot6  distance,\r\n                               FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = FT_PIX_FLOOR( distance + compensation ) + 32;\r\n      if ( distance && val < 0 )\r\n        val = 0;\r\n    }\r\n    else\r\n    {\r\n      val = -( FT_PIX_FLOOR( compensation - distance ) + 32 );\r\n      if ( val > 0 )\r\n        val = 0;\r\n    }\r\n\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_Down_To_Grid                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Rounds value down to grid after adding engine compensation.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_Down_To_Grid( EXEC_OP_ FT_F26Dot6  distance,\r\n                               FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = distance + compensation;\r\n      if ( distance && val > 0 )\r\n        val &= ~63;\r\n      else\r\n        val = 0;\r\n    }\r\n    else\r\n    {\r\n      val = -( ( compensation - distance ) & -64 );\r\n      if ( val > 0 )\r\n        val = 0;\r\n    }\r\n\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_Up_To_Grid                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Rounds value up to grid after adding engine compensation.          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_Up_To_Grid( EXEC_OP_ FT_F26Dot6  distance,\r\n                             FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = distance + compensation + 63;\r\n      if ( distance && val > 0 )\r\n        val &= ~63;\r\n      else\r\n        val = 0;\r\n    }\r\n    else\r\n    {\r\n      val = -FT_PIX_CEIL( compensation - distance );\r\n      if ( val > 0 )\r\n        val = 0;\r\n    }\r\n\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_To_Double_Grid                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Rounds value to double grid after adding engine compensation.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_To_Double_Grid( EXEC_OP_ FT_F26Dot6  distance,\r\n                                 FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6 val;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = distance + compensation + 16;\r\n      if ( distance && val > 0 )\r\n        val &= ~31;\r\n      else\r\n        val = 0;\r\n    }\r\n    else\r\n    {\r\n      val = -FT_PAD_ROUND( compensation - distance, 32 );\r\n      if ( val > 0 )\r\n        val = 0;\r\n    }\r\n\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_Super                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Super-rounds value to grid after adding engine compensation.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The TrueType specification says very few about the relationship    */\r\n  /*    between rounding and engine compensation.  However, it seems from  */\r\n  /*    the description of super round that we should add the compensation */\r\n  /*    before rounding.                                                   */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_Super( EXEC_OP_ FT_F26Dot6  distance,\r\n                        FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = ( distance - CUR.phase + CUR.threshold + compensation ) &\r\n              -CUR.period;\r\n      if ( distance && val < 0 )\r\n        val = 0;\r\n      val += CUR.phase;\r\n    }\r\n    else\r\n    {\r\n      val = -( ( CUR.threshold - CUR.phase - distance + compensation ) &\r\n               -CUR.period );\r\n      if ( val > 0 )\r\n        val = 0;\r\n      val -= CUR.phase;\r\n    }\r\n\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Round_Super_45                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Super-rounds value to grid after adding engine compensation.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    distance     :: The distance to round.                             */\r\n  /*                                                                       */\r\n  /*    compensation :: The engine compensation.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Rounded distance.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    There is a separate function for Round_Super_45() as we may need   */\r\n  /*    greater precision.                                                 */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Round_Super_45( EXEC_OP_ FT_F26Dot6  distance,\r\n                           FT_F26Dot6  compensation )\r\n  {\r\n    FT_F26Dot6  val;\r\n\r\n\r\n    if ( distance >= 0 )\r\n    {\r\n      val = ( ( distance - CUR.phase + CUR.threshold + compensation ) /\r\n                CUR.period ) * CUR.period;\r\n      if ( distance && val < 0 )\r\n        val = 0;\r\n      val += CUR.phase;\r\n    }\r\n    else\r\n    {\r\n      val = -( ( ( CUR.threshold - CUR.phase - distance + compensation ) /\r\n                   CUR.period ) * CUR.period );\r\n      if ( val > 0 )\r\n        val = 0;\r\n      val -= CUR.phase;\r\n    }\r\n\r\n    return val;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Compute_Round                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Sets the rounding mode.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    round_mode :: The rounding mode to be used.                        */\r\n  /*                                                                       */\r\n  static void\r\n  Compute_Round( EXEC_OP_ FT_Byte  round_mode )\r\n  {\r\n    switch ( round_mode )\r\n    {\r\n    case TT_Round_Off:\r\n      CUR.func_round = (TT_Round_Func)Round_None;\r\n      break;\r\n\r\n    case TT_Round_To_Grid:\r\n      CUR.func_round = (TT_Round_Func)Round_To_Grid;\r\n      break;\r\n\r\n    case TT_Round_Up_To_Grid:\r\n      CUR.func_round = (TT_Round_Func)Round_Up_To_Grid;\r\n      break;\r\n\r\n    case TT_Round_Down_To_Grid:\r\n      CUR.func_round = (TT_Round_Func)Round_Down_To_Grid;\r\n      break;\r\n\r\n    case TT_Round_To_Half_Grid:\r\n      CUR.func_round = (TT_Round_Func)Round_To_Half_Grid;\r\n      break;\r\n\r\n    case TT_Round_To_Double_Grid:\r\n      CUR.func_round = (TT_Round_Func)Round_To_Double_Grid;\r\n      break;\r\n\r\n    case TT_Round_Super:\r\n      CUR.func_round = (TT_Round_Func)Round_Super;\r\n      break;\r\n\r\n    case TT_Round_Super_45:\r\n      CUR.func_round = (TT_Round_Func)Round_Super_45;\r\n      break;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    SetSuperRound                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Sets Super Round parameters.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    GridPeriod :: The grid period.                                     */\r\n  /*                                                                       */\r\n  /*    selector   :: The SROUND opcode.                                   */\r\n  /*                                                                       */\r\n  static void\r\n  SetSuperRound( EXEC_OP_ FT_F26Dot6  GridPeriod,\r\n                          FT_Long     selector )\r\n  {\r\n    switch ( (FT_Int)( selector & 0xC0 ) )\r\n    {\r\n      case 0:\r\n        CUR.period = GridPeriod / 2;\r\n        break;\r\n\r\n      case 0x40:\r\n        CUR.period = GridPeriod;\r\n        break;\r\n\r\n      case 0x80:\r\n        CUR.period = GridPeriod * 2;\r\n        break;\r\n\r\n      /* This opcode is reserved, but... */\r\n\r\n      case 0xC0:\r\n        CUR.period = GridPeriod;\r\n        break;\r\n    }\r\n\r\n    switch ( (FT_Int)( selector & 0x30 ) )\r\n    {\r\n    case 0:\r\n      CUR.phase = 0;\r\n      break;\r\n\r\n    case 0x10:\r\n      CUR.phase = CUR.period / 4;\r\n      break;\r\n\r\n    case 0x20:\r\n      CUR.phase = CUR.period / 2;\r\n      break;\r\n\r\n    case 0x30:\r\n      CUR.phase = CUR.period * 3 / 4;\r\n      break;\r\n    }\r\n\r\n    if ( ( selector & 0x0F ) == 0 )\r\n      CUR.threshold = CUR.period - 1;\r\n    else\r\n      CUR.threshold = ( (FT_Int)( selector & 0x0F ) - 4 ) * CUR.period / 8;\r\n\r\n    CUR.period    /= 256;\r\n    CUR.phase     /= 256;\r\n    CUR.threshold /= 256;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Project                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the projection of vector given by (v2-v1) along the       */\r\n  /*    current projection vector.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    v1 :: First input vector.                                          */\r\n  /*    v2 :: Second input vector.                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The distance in F26dot6 format.                                    */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Project( EXEC_OP_ FT_Pos  dx,\r\n                    FT_Pos  dy )\r\n  {\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    FT_ASSERT( !CUR.face->unpatented_hinting );\r\n#endif\r\n\r\n    return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,\r\n                        CUR.GS.projVector.x,\r\n                        CUR.GS.projVector.y );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Dual_Project                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the projection of the vector given by (v2-v1) along the   */\r\n  /*    current dual vector.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    v1 :: First input vector.                                          */\r\n  /*    v2 :: Second input vector.                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The distance in F26dot6 format.                                    */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Dual_Project( EXEC_OP_ FT_Pos  dx,\r\n                         FT_Pos  dy )\r\n  {\r\n    return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,\r\n                        CUR.GS.dualVector.x,\r\n                        CUR.GS.dualVector.y );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Project_x                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the projection of the vector given by (v2-v1) along the   */\r\n  /*    horizontal axis.                                                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    v1 :: First input vector.                                          */\r\n  /*    v2 :: Second input vector.                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The distance in F26dot6 format.                                    */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Project_x( EXEC_OP_ FT_Pos  dx,\r\n                      FT_Pos  dy )\r\n  {\r\n    FT_UNUSED_EXEC;\r\n    FT_UNUSED( dy );\r\n\r\n    return dx;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Project_y                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the projection of the vector given by (v2-v1) along the   */\r\n  /*    vertical axis.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    v1 :: First input vector.                                          */\r\n  /*    v2 :: Second input vector.                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The distance in F26dot6 format.                                    */\r\n  /*                                                                       */\r\n  static FT_F26Dot6\r\n  Project_y( EXEC_OP_ FT_Pos  dx,\r\n                      FT_Pos  dy )\r\n  {\r\n    FT_UNUSED_EXEC;\r\n    FT_UNUSED( dx );\r\n\r\n    return dy;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Compute_Funcs                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the projection and movement function pointers according   */\r\n  /*    to the current graphics state.                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Compute_Funcs( EXEC_OP )\r\n  {\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    if ( CUR.face->unpatented_hinting )\r\n    {\r\n      /* If both vectors point rightwards along the x axis, set             */\r\n      /* `both-x-axis' true, otherwise set it false.  The x values only     */\r\n      /* need be tested because the vector has been normalised to a unit    */\r\n      /* vector of length 0x4000 = unity.                                   */\r\n      CUR.GS.both_x_axis = (FT_Bool)( CUR.GS.projVector.x == 0x4000 &&\r\n                                      CUR.GS.freeVector.x == 0x4000 );\r\n\r\n      /* Throw away projection and freedom vector information */\r\n      /* because the patents don't allow them to be stored.   */\r\n      /* The relevant US Patents are 5155805 and 5325479.     */\r\n      CUR.GS.projVector.x = 0;\r\n      CUR.GS.projVector.y = 0;\r\n      CUR.GS.freeVector.x = 0;\r\n      CUR.GS.freeVector.y = 0;\r\n\r\n      if ( CUR.GS.both_x_axis )\r\n      {\r\n        CUR.func_project   = Project_x;\r\n        CUR.func_move      = Direct_Move_X;\r\n        CUR.func_move_orig = Direct_Move_Orig_X;\r\n      }\r\n      else\r\n      {\r\n        CUR.func_project   = Project_y;\r\n        CUR.func_move      = Direct_Move_Y;\r\n        CUR.func_move_orig = Direct_Move_Orig_Y;\r\n      }\r\n\r\n      if ( CUR.GS.dualVector.x == 0x4000 )\r\n        CUR.func_dualproj = Project_x;\r\n      else if ( CUR.GS.dualVector.y == 0x4000 )\r\n        CUR.func_dualproj = Project_y;\r\n      else\r\n        CUR.func_dualproj = Dual_Project;\r\n\r\n      /* Force recalculation of cached aspect ratio */\r\n      CUR.tt_metrics.ratio = 0;\r\n\r\n      return;\r\n    }\r\n#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */\r\n\r\n    if ( CUR.GS.freeVector.x == 0x4000 )\r\n      CUR.F_dot_P = CUR.GS.projVector.x;\r\n    else if ( CUR.GS.freeVector.y == 0x4000 )\r\n      CUR.F_dot_P = CUR.GS.projVector.y;\r\n    else\r\n      CUR.F_dot_P = ( (FT_Long)CUR.GS.projVector.x * CUR.GS.freeVector.x +\r\n                      (FT_Long)CUR.GS.projVector.y * CUR.GS.freeVector.y ) >>\r\n                    14;\r\n\r\n    if ( CUR.GS.projVector.x == 0x4000 )\r\n      CUR.func_project = (TT_Project_Func)Project_x;\r\n    else if ( CUR.GS.projVector.y == 0x4000 )\r\n      CUR.func_project = (TT_Project_Func)Project_y;\r\n    else\r\n      CUR.func_project = (TT_Project_Func)Project;\r\n\r\n    if ( CUR.GS.dualVector.x == 0x4000 )\r\n      CUR.func_dualproj = (TT_Project_Func)Project_x;\r\n    else if ( CUR.GS.dualVector.y == 0x4000 )\r\n      CUR.func_dualproj = (TT_Project_Func)Project_y;\r\n    else\r\n      CUR.func_dualproj = (TT_Project_Func)Dual_Project;\r\n\r\n    CUR.func_move      = (TT_Move_Func)Direct_Move;\r\n    CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig;\r\n\r\n    if ( CUR.F_dot_P == 0x4000L )\r\n    {\r\n      if ( CUR.GS.freeVector.x == 0x4000 )\r\n      {\r\n        CUR.func_move      = (TT_Move_Func)Direct_Move_X;\r\n        CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_X;\r\n      }\r\n      else if ( CUR.GS.freeVector.y == 0x4000 )\r\n      {\r\n        CUR.func_move      = (TT_Move_Func)Direct_Move_Y;\r\n        CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y;\r\n      }\r\n    }\r\n\r\n    /* at small sizes, F_dot_P can become too small, resulting   */\r\n    /* in overflows and `spikes' in a number of glyphs like `w'. */\r\n\r\n    if ( FT_ABS( CUR.F_dot_P ) < 0x400L )\r\n      CUR.F_dot_P = 0x4000L;\r\n\r\n    /* Disable cached aspect ratio */\r\n    CUR.tt_metrics.ratio = 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Normalize                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Norms a vector.                                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    Vx :: The horizontal input vector coordinate.                      */\r\n  /*    Vy :: The vertical input vector coordinate.                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    R  :: The normed unit vector.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Returns FAILURE if a vector parameter is zero.                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In case Vx and Vy are both zero, Normalize() returns SUCCESS, and  */\r\n  /*    R is undefined.                                                    */\r\n  /*                                                                       */\r\n\r\n\r\n  static FT_Bool\r\n  Normalize( EXEC_OP_ FT_F26Dot6      Vx,\r\n                      FT_F26Dot6      Vy,\r\n                      FT_UnitVector*  R )\r\n  {\r\n    FT_F26Dot6  W;\r\n    FT_Bool     S1, S2;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    if ( FT_ABS( Vx ) < 0x10000L && FT_ABS( Vy ) < 0x10000L )\r\n    {\r\n      Vx *= 0x100;\r\n      Vy *= 0x100;\r\n\r\n      W = TT_VecLen( Vx, Vy );\r\n\r\n      if ( W == 0 )\r\n      {\r\n        /* XXX: UNDOCUMENTED! It seems that it is possible to try   */\r\n        /*      to normalize the vector (0,0).  Return immediately. */\r\n        return SUCCESS;\r\n      }\r\n\r\n      R->x = (FT_F2Dot14)TT_DivFix14( Vx, W );\r\n      R->y = (FT_F2Dot14)TT_DivFix14( Vy, W );\r\n\r\n      return SUCCESS;\r\n    }\r\n\r\n    W = TT_VecLen( Vx, Vy );\r\n\r\n    Vx = TT_DivFix14( Vx, W );\r\n    Vy = TT_DivFix14( Vy, W );\r\n\r\n    W = Vx * Vx + Vy * Vy;\r\n\r\n    /* Now, we want that Sqrt( W ) = 0x4000 */\r\n    /* Or 0x10000000 <= W < 0x10004000      */\r\n\r\n    if ( Vx < 0 )\r\n    {\r\n      Vx = -Vx;\r\n      S1 = TRUE;\r\n    }\r\n    else\r\n      S1 = FALSE;\r\n\r\n    if ( Vy < 0 )\r\n    {\r\n      Vy = -Vy;\r\n      S2 = TRUE;\r\n    }\r\n    else\r\n      S2 = FALSE;\r\n\r\n    while ( W < 0x10000000L )\r\n    {\r\n      /* We need to increase W by a minimal amount */\r\n      if ( Vx < Vy )\r\n        Vx++;\r\n      else\r\n        Vy++;\r\n\r\n      W = Vx * Vx + Vy * Vy;\r\n    }\r\n\r\n    while ( W >= 0x10004000L )\r\n    {\r\n      /* We need to decrease W by a minimal amount */\r\n      if ( Vx < Vy )\r\n        Vx--;\r\n      else\r\n        Vy--;\r\n\r\n      W = Vx * Vx + Vy * Vy;\r\n    }\r\n\r\n    /* Note that in various cases, we can only  */\r\n    /* compute a Sqrt(W) of 0x3FFF, eg. Vx = Vy */\r\n\r\n    if ( S1 )\r\n      Vx = -Vx;\r\n\r\n    if ( S2 )\r\n      Vy = -Vy;\r\n\r\n    R->x = (FT_F2Dot14)Vx;   /* Type conversion */\r\n    R->y = (FT_F2Dot14)Vy;   /* Type conversion */\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Here we start with the implementation of the various opcodes.         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static FT_Bool\r\n  Ins_SxVTL( EXEC_OP_ FT_UShort       aIdx1,\r\n                      FT_UShort       aIdx2,\r\n                      FT_Int          aOpc,\r\n                      FT_UnitVector*  Vec )\r\n  {\r\n    FT_Long     A, B, C;\r\n    FT_Vector*  p1;\r\n    FT_Vector*  p2;\r\n\r\n\r\n    if ( BOUNDS( aIdx1, CUR.zp2.n_points ) ||\r\n         BOUNDS( aIdx2, CUR.zp1.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return FAILURE;\r\n    }\r\n\r\n    p1 = CUR.zp1.cur + aIdx2;\r\n    p2 = CUR.zp2.cur + aIdx1;\r\n\r\n    A = p1->x - p2->x;\r\n    B = p1->y - p2->y;\r\n\r\n    /* If p1 == p2, SPVTL and SFVTL behave the same as */\r\n    /* SPVTCA[X] and SFVTCA[X], respectively.          */\r\n    /*                                                 */\r\n    /* Confirmed by Greg Hitchcock.                    */\r\n\r\n    if ( A == 0 && B == 0 )\r\n    {\r\n      A    = 0x4000;\r\n      aOpc = 0;\r\n    }\r\n\r\n    if ( ( aOpc & 1 ) != 0 )\r\n    {\r\n      C =  B;   /* counter clockwise rotation */\r\n      B =  A;\r\n      A = -C;\r\n    }\r\n\r\n    NORMalize( A, B, Vec );\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  /* When not using the big switch statements, the interpreter uses a */\r\n  /* call table defined later below in this source.  Each opcode must */\r\n  /* thus have a corresponding function, even trivial ones.           */\r\n  /*                                                                  */\r\n  /* They are all defined there.                                      */\r\n\r\n#define DO_SVTCA                            \\\r\n  {                                         \\\r\n    FT_Short  A, B;                         \\\r\n                                            \\\r\n                                            \\\r\n    A = (FT_Short)( CUR.opcode & 1 ) << 14; \\\r\n    B = A ^ (FT_Short)0x4000;               \\\r\n                                            \\\r\n    CUR.GS.freeVector.x = A;                \\\r\n    CUR.GS.projVector.x = A;                \\\r\n    CUR.GS.dualVector.x = A;                \\\r\n                                            \\\r\n    CUR.GS.freeVector.y = B;                \\\r\n    CUR.GS.projVector.y = B;                \\\r\n    CUR.GS.dualVector.y = B;                \\\r\n                                            \\\r\n    COMPUTE_Funcs();                        \\\r\n  }\r\n\r\n\r\n#define DO_SPVTCA                           \\\r\n  {                                         \\\r\n    FT_Short  A, B;                         \\\r\n                                            \\\r\n                                            \\\r\n    A = (FT_Short)( CUR.opcode & 1 ) << 14; \\\r\n    B = A ^ (FT_Short)0x4000;               \\\r\n                                            \\\r\n    CUR.GS.projVector.x = A;                \\\r\n    CUR.GS.dualVector.x = A;                \\\r\n                                            \\\r\n    CUR.GS.projVector.y = B;                \\\r\n    CUR.GS.dualVector.y = B;                \\\r\n                                            \\\r\n    GUESS_VECTOR( freeVector );             \\\r\n                                            \\\r\n    COMPUTE_Funcs();                        \\\r\n  }\r\n\r\n\r\n#define DO_SFVTCA                           \\\r\n  {                                         \\\r\n    FT_Short  A, B;                         \\\r\n                                            \\\r\n                                            \\\r\n    A = (FT_Short)( CUR.opcode & 1 ) << 14; \\\r\n    B = A ^ (FT_Short)0x4000;               \\\r\n                                            \\\r\n    CUR.GS.freeVector.x = A;                \\\r\n    CUR.GS.freeVector.y = B;                \\\r\n                                            \\\r\n    GUESS_VECTOR( projVector );             \\\r\n                                            \\\r\n    COMPUTE_Funcs();                        \\\r\n  }\r\n\r\n\r\n#define DO_SPVTL                                      \\\r\n    if ( INS_SxVTL( (FT_UShort)args[1],               \\\r\n                    (FT_UShort)args[0],               \\\r\n                    CUR.opcode,                       \\\r\n                    &CUR.GS.projVector ) == SUCCESS ) \\\r\n    {                                                 \\\r\n      CUR.GS.dualVector = CUR.GS.projVector;          \\\r\n      GUESS_VECTOR( freeVector );                     \\\r\n      COMPUTE_Funcs();                                \\\r\n    }\r\n\r\n\r\n#define DO_SFVTL                                      \\\r\n    if ( INS_SxVTL( (FT_UShort)args[1],               \\\r\n                    (FT_UShort)args[0],               \\\r\n                    CUR.opcode,                       \\\r\n                    &CUR.GS.freeVector ) == SUCCESS ) \\\r\n    {                                                 \\\r\n      GUESS_VECTOR( projVector );                     \\\r\n      COMPUTE_Funcs();                                \\\r\n    }\r\n\r\n\r\n#define DO_SFVTPV                          \\\r\n    GUESS_VECTOR( projVector );            \\\r\n    CUR.GS.freeVector = CUR.GS.projVector; \\\r\n    COMPUTE_Funcs();\r\n\r\n\r\n#define DO_SPVFS                                \\\r\n  {                                             \\\r\n    FT_Short  S;                                \\\r\n    FT_Long   X, Y;                             \\\r\n                                                \\\r\n                                                \\\r\n    /* Only use low 16bits, then sign extend */ \\\r\n    S = (FT_Short)args[1];                      \\\r\n    Y = (FT_Long)S;                             \\\r\n    S = (FT_Short)args[0];                      \\\r\n    X = (FT_Long)S;                             \\\r\n                                                \\\r\n    NORMalize( X, Y, &CUR.GS.projVector );      \\\r\n                                                \\\r\n    CUR.GS.dualVector = CUR.GS.projVector;      \\\r\n    GUESS_VECTOR( freeVector );                 \\\r\n    COMPUTE_Funcs();                            \\\r\n  }\r\n\r\n\r\n#define DO_SFVFS                                \\\r\n  {                                             \\\r\n    FT_Short  S;                                \\\r\n    FT_Long   X, Y;                             \\\r\n                                                \\\r\n                                                \\\r\n    /* Only use low 16bits, then sign extend */ \\\r\n    S = (FT_Short)args[1];                      \\\r\n    Y = (FT_Long)S;                             \\\r\n    S = (FT_Short)args[0];                      \\\r\n    X = S;                                      \\\r\n                                                \\\r\n    NORMalize( X, Y, &CUR.GS.freeVector );      \\\r\n    GUESS_VECTOR( projVector );                 \\\r\n    COMPUTE_Funcs();                            \\\r\n  }\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#define DO_GPV                                   \\\r\n    if ( CUR.face->unpatented_hinting )          \\\r\n    {                                            \\\r\n      args[0] = CUR.GS.both_x_axis ? 0x4000 : 0; \\\r\n      args[1] = CUR.GS.both_x_axis ? 0 : 0x4000; \\\r\n    }                                            \\\r\n    else                                         \\\r\n    {                                            \\\r\n      args[0] = CUR.GS.projVector.x;             \\\r\n      args[1] = CUR.GS.projVector.y;             \\\r\n    }\r\n#else\r\n#define DO_GPV                                   \\\r\n    args[0] = CUR.GS.projVector.x;               \\\r\n    args[1] = CUR.GS.projVector.y;\r\n#endif\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#define DO_GFV                                   \\\r\n    if ( CUR.face->unpatented_hinting )          \\\r\n    {                                            \\\r\n      args[0] = CUR.GS.both_x_axis ? 0x4000 : 0; \\\r\n      args[1] = CUR.GS.both_x_axis ? 0 : 0x4000; \\\r\n    }                                            \\\r\n    else                                         \\\r\n    {                                            \\\r\n      args[0] = CUR.GS.freeVector.x;             \\\r\n      args[1] = CUR.GS.freeVector.y;             \\\r\n    }\r\n#else\r\n#define DO_GFV                                   \\\r\n    args[0] = CUR.GS.freeVector.x;               \\\r\n    args[1] = CUR.GS.freeVector.y;\r\n#endif\r\n\r\n\r\n#define DO_SRP0                      \\\r\n    CUR.GS.rp0 = (FT_UShort)args[0];\r\n\r\n\r\n#define DO_SRP1                      \\\r\n    CUR.GS.rp1 = (FT_UShort)args[0];\r\n\r\n\r\n#define DO_SRP2                      \\\r\n    CUR.GS.rp2 = (FT_UShort)args[0];\r\n\r\n\r\n#define DO_RTHG                                         \\\r\n    CUR.GS.round_state = TT_Round_To_Half_Grid;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_To_Half_Grid;\r\n\r\n\r\n#define DO_RTG                                     \\\r\n    CUR.GS.round_state = TT_Round_To_Grid;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_To_Grid;\r\n\r\n\r\n#define DO_RTDG                                           \\\r\n    CUR.GS.round_state = TT_Round_To_Double_Grid;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_To_Double_Grid;\r\n\r\n\r\n#define DO_RUTG                                       \\\r\n    CUR.GS.round_state = TT_Round_Up_To_Grid;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_Up_To_Grid;\r\n\r\n\r\n#define DO_RDTG                                         \\\r\n    CUR.GS.round_state = TT_Round_Down_To_Grid;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_Down_To_Grid;\r\n\r\n\r\n#define DO_ROFF                                 \\\r\n    CUR.GS.round_state = TT_Round_Off;          \\\r\n    CUR.func_round = (TT_Round_Func)Round_None;\r\n\r\n\r\n#define DO_SROUND                                \\\r\n    SET_SuperRound( 0x4000, args[0] );           \\\r\n    CUR.GS.round_state = TT_Round_Super;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_Super;\r\n\r\n\r\n#define DO_S45ROUND                                 \\\r\n    SET_SuperRound( 0x2D41, args[0] );              \\\r\n    CUR.GS.round_state = TT_Round_Super_45;         \\\r\n    CUR.func_round = (TT_Round_Func)Round_Super_45;\r\n\r\n\r\n#define DO_SLOOP                       \\\r\n    if ( args[0] < 0 )                 \\\r\n      CUR.error = TT_Err_Bad_Argument; \\\r\n    else                               \\\r\n      CUR.GS.loop = args[0];\r\n\r\n\r\n#define DO_SMD                         \\\r\n    CUR.GS.minimum_distance = args[0];\r\n\r\n\r\n#define DO_SCVTCI                                     \\\r\n    CUR.GS.control_value_cutin = (FT_F26Dot6)args[0];\r\n\r\n\r\n#define DO_SSWCI                                     \\\r\n    CUR.GS.single_width_cutin = (FT_F26Dot6)args[0];\r\n\r\n\r\n#define DO_SSW                                                     \\\r\n    CUR.GS.single_width_value = FT_MulFix( args[0],                \\\r\n                                           CUR.tt_metrics.scale );\r\n\r\n\r\n#define DO_FLIPON            \\\r\n    CUR.GS.auto_flip = TRUE;\r\n\r\n\r\n#define DO_FLIPOFF            \\\r\n    CUR.GS.auto_flip = FALSE;\r\n\r\n\r\n#define DO_SDB                             \\\r\n    CUR.GS.delta_base = (FT_Short)args[0];\r\n\r\n\r\n#define DO_SDS                              \\\r\n    CUR.GS.delta_shift = (FT_Short)args[0];\r\n\r\n\r\n#define DO_MD  /* nothing */\r\n\r\n\r\n#define DO_MPPEM              \\\r\n    args[0] = CURRENT_Ppem();\r\n\r\n\r\n  /* Note: The pointSize should be irrelevant in a given font program; */\r\n  /*       we thus decide to return only the ppem.                     */\r\n#if 0\r\n\r\n#define DO_MPS                       \\\r\n    args[0] = CUR.metrics.pointSize;\r\n\r\n#else\r\n\r\n#define DO_MPS                \\\r\n    args[0] = CURRENT_Ppem();\r\n\r\n#endif /* 0 */\r\n\r\n\r\n#define DO_DUP         \\\r\n    args[1] = args[0];\r\n\r\n\r\n#define DO_CLEAR     \\\r\n    CUR.new_top = 0;\r\n\r\n\r\n#define DO_SWAP        \\\r\n  {                    \\\r\n    FT_Long  L;        \\\r\n                       \\\r\n                       \\\r\n    L       = args[0]; \\\r\n    args[0] = args[1]; \\\r\n    args[1] = L;       \\\r\n  }\r\n\r\n\r\n#define DO_DEPTH       \\\r\n    args[0] = CUR.top;\r\n\r\n\r\n#define DO_CINDEX                             \\\r\n  {                                           \\\r\n    FT_Long  L;                               \\\r\n                                              \\\r\n                                              \\\r\n    L = args[0];                              \\\r\n                                              \\\r\n    if ( L <= 0 || L > CUR.args )             \\\r\n    {                                         \\\r\n      if ( CUR.pedantic_hinting )             \\\r\n        CUR.error = TT_Err_Invalid_Reference; \\\r\n      args[0] = 0;                            \\\r\n    }                                         \\\r\n    else                                      \\\r\n      args[0] = CUR.stack[CUR.args - L];      \\\r\n  }\r\n\r\n\r\n#define DO_JROT                                                   \\\r\n    if ( args[1] != 0 )                                           \\\r\n    {                                                             \\\r\n      if ( args[0] == 0 && CUR.args == 0 )                        \\\r\n        CUR.error = TT_Err_Bad_Argument;                          \\\r\n      CUR.IP += args[0];                                          \\\r\n      if ( CUR.IP < 0                                          || \\\r\n           ( CUR.callTop > 0                                 &&   \\\r\n             CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) )  \\\r\n        CUR.error = TT_Err_Bad_Argument;                          \\\r\n      CUR.step_ins = FALSE;                                       \\\r\n    }\r\n\r\n\r\n#define DO_JMPR                                                 \\\r\n    if ( args[0] == 0 && CUR.args == 0 )                        \\\r\n      CUR.error = TT_Err_Bad_Argument;                          \\\r\n    CUR.IP += args[0];                                          \\\r\n    if ( CUR.IP < 0                                          || \\\r\n         ( CUR.callTop > 0                                 &&   \\\r\n           CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) )  \\\r\n      CUR.error = TT_Err_Bad_Argument;                          \\\r\n    CUR.step_ins = FALSE;\r\n\r\n\r\n#define DO_JROF                                                   \\\r\n    if ( args[1] == 0 )                                           \\\r\n    {                                                             \\\r\n      if ( args[0] == 0 && CUR.args == 0 )                        \\\r\n        CUR.error = TT_Err_Bad_Argument;                          \\\r\n      CUR.IP += args[0];                                          \\\r\n      if ( CUR.IP < 0                                          || \\\r\n           ( CUR.callTop > 0                                 &&   \\\r\n             CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) )  \\\r\n        CUR.error = TT_Err_Bad_Argument;                          \\\r\n      CUR.step_ins = FALSE;                                       \\\r\n    }\r\n\r\n\r\n#define DO_LT                        \\\r\n    args[0] = ( args[0] < args[1] );\r\n\r\n\r\n#define DO_LTEQ                       \\\r\n    args[0] = ( args[0] <= args[1] );\r\n\r\n\r\n#define DO_GT                        \\\r\n    args[0] = ( args[0] > args[1] );\r\n\r\n\r\n#define DO_GTEQ                       \\\r\n    args[0] = ( args[0] >= args[1] );\r\n\r\n\r\n#define DO_EQ                         \\\r\n    args[0] = ( args[0] == args[1] );\r\n\r\n\r\n#define DO_NEQ                        \\\r\n    args[0] = ( args[0] != args[1] );\r\n\r\n\r\n#define DO_ODD                                                  \\\r\n    args[0] = ( ( CUR_Func_round( args[0], 0 ) & 127 ) == 64 );\r\n\r\n\r\n#define DO_EVEN                                                \\\r\n    args[0] = ( ( CUR_Func_round( args[0], 0 ) & 127 ) == 0 );\r\n\r\n\r\n#define DO_AND                        \\\r\n    args[0] = ( args[0] && args[1] );\r\n\r\n\r\n#define DO_OR                         \\\r\n    args[0] = ( args[0] || args[1] );\r\n\r\n\r\n#define DO_NOT          \\\r\n    args[0] = !args[0];\r\n\r\n\r\n#define DO_ADD          \\\r\n    args[0] += args[1];\r\n\r\n\r\n#define DO_SUB          \\\r\n    args[0] -= args[1];\r\n\r\n\r\n#define DO_DIV                                               \\\r\n    if ( args[1] == 0 )                                      \\\r\n      CUR.error = TT_Err_Divide_By_Zero;                     \\\r\n    else                                                     \\\r\n      args[0] = FT_MulDiv_No_Round( args[0], 64L, args[1] );\r\n\r\n\r\n#define DO_MUL                                    \\\r\n    args[0] = FT_MulDiv( args[0], args[1], 64L );\r\n\r\n\r\n#define DO_ABS                   \\\r\n    args[0] = FT_ABS( args[0] );\r\n\r\n\r\n#define DO_NEG          \\\r\n    args[0] = -args[0];\r\n\r\n\r\n#define DO_FLOOR    \\\r\n    args[0] = FT_PIX_FLOOR( args[0] );\r\n\r\n\r\n#define DO_CEILING                    \\\r\n    args[0] = FT_PIX_CEIL( args[0] );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n#define DO_RS                                             \\\r\n   {                                                      \\\r\n     FT_ULong  I = (FT_ULong)args[0];                     \\\r\n                                                          \\\r\n                                                          \\\r\n     if ( BOUNDSL( I, CUR.storeSize ) )                   \\\r\n     {                                                    \\\r\n       if ( CUR.pedantic_hinting )                        \\\r\n         ARRAY_BOUND_ERROR;                               \\\r\n       else                                               \\\r\n         args[0] = 0;                                     \\\r\n     }                                                    \\\r\n     else                                                 \\\r\n     {                                                    \\\r\n       /* subpixel hinting - avoid Typeman Dstroke and */ \\\r\n       /* IStroke and Vacuform rounds                  */ \\\r\n                                                          \\\r\n       if ( CUR.compatibility_mode           &&           \\\r\n            ( I == 24 || I == 22 || I == 8 ) )            \\\r\n         args[0] = 0;                                     \\\r\n       else                                               \\\r\n         args[0] = CUR.storage[I];                        \\\r\n     }                                                    \\\r\n   }\r\n\r\n#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n#define DO_RS                           \\\r\n   {                                    \\\r\n     FT_ULong  I = (FT_ULong)args[0];   \\\r\n                                        \\\r\n                                        \\\r\n     if ( BOUNDSL( I, CUR.storeSize ) ) \\\r\n     {                                  \\\r\n       if ( CUR.pedantic_hinting )      \\\r\n       {                                \\\r\n         ARRAY_BOUND_ERROR;             \\\r\n       }                                \\\r\n       else                             \\\r\n         args[0] = 0;                   \\\r\n     }                                  \\\r\n     else                               \\\r\n       args[0] = CUR.storage[I];        \\\r\n   }\r\n\r\n#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n#define DO_WS                           \\\r\n   {                                    \\\r\n     FT_ULong  I = (FT_ULong)args[0];   \\\r\n                                        \\\r\n                                        \\\r\n     if ( BOUNDSL( I, CUR.storeSize ) ) \\\r\n     {                                  \\\r\n       if ( CUR.pedantic_hinting )      \\\r\n       {                                \\\r\n         ARRAY_BOUND_ERROR;             \\\r\n       }                                \\\r\n     }                                  \\\r\n     else                               \\\r\n       CUR.storage[I] = args[1];        \\\r\n   }\r\n\r\n\r\n#define DO_RCVT                          \\\r\n   {                                     \\\r\n     FT_ULong  I = (FT_ULong)args[0];    \\\r\n                                         \\\r\n                                         \\\r\n     if ( BOUNDSL( I, CUR.cvtSize ) )    \\\r\n     {                                   \\\r\n       if ( CUR.pedantic_hinting )       \\\r\n       {                                 \\\r\n         ARRAY_BOUND_ERROR;              \\\r\n       }                                 \\\r\n       else                              \\\r\n         args[0] = 0;                    \\\r\n     }                                   \\\r\n     else                                \\\r\n       args[0] = CUR_Func_read_cvt( I ); \\\r\n   }\r\n\r\n\r\n#define DO_WCVTP                         \\\r\n   {                                     \\\r\n     FT_ULong  I = (FT_ULong)args[0];    \\\r\n                                         \\\r\n                                         \\\r\n     if ( BOUNDSL( I, CUR.cvtSize ) )    \\\r\n     {                                   \\\r\n       if ( CUR.pedantic_hinting )       \\\r\n       {                                 \\\r\n         ARRAY_BOUND_ERROR;              \\\r\n       }                                 \\\r\n     }                                   \\\r\n     else                                \\\r\n       CUR_Func_write_cvt( I, args[1] ); \\\r\n   }\r\n\r\n\r\n#define DO_WCVTF                                                \\\r\n   {                                                            \\\r\n     FT_ULong  I = (FT_ULong)args[0];                           \\\r\n                                                                \\\r\n                                                                \\\r\n     if ( BOUNDSL( I, CUR.cvtSize ) )                           \\\r\n     {                                                          \\\r\n       if ( CUR.pedantic_hinting )                              \\\r\n       {                                                        \\\r\n         ARRAY_BOUND_ERROR;                                     \\\r\n       }                                                        \\\r\n     }                                                          \\\r\n     else                                                       \\\r\n       CUR.cvt[I] = FT_MulFix( args[1], CUR.tt_metrics.scale ); \\\r\n   }\r\n\r\n\r\n#define DO_DEBUG                     \\\r\n    CUR.error = TT_Err_Debug_OpCode;\r\n\r\n\r\n#define DO_ROUND                                                   \\\r\n    args[0] = CUR_Func_round(                                      \\\r\n                args[0],                                           \\\r\n                CUR.tt_metrics.compensations[CUR.opcode - 0x68] );\r\n\r\n\r\n#define DO_NROUND                                                            \\\r\n    args[0] = ROUND_None( args[0],                                           \\\r\n                          CUR.tt_metrics.compensations[CUR.opcode - 0x6C] );\r\n\r\n\r\n#define DO_MAX               \\\r\n    if ( args[1] > args[0] ) \\\r\n      args[0] = args[1];\r\n\r\n\r\n#define DO_MIN               \\\r\n    if ( args[1] < args[0] ) \\\r\n      args[0] = args[1];\r\n\r\n\r\n#ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH\r\n\r\n\r\n#undef  ARRAY_BOUND_ERROR\r\n#define ARRAY_BOUND_ERROR                   \\\r\n    {                                       \\\r\n      CUR.error = TT_Err_Invalid_Reference; \\\r\n      return;                               \\\r\n    }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SVTCA[a]:     Set (F and P) Vectors to Coordinate Axis                */\r\n  /* Opcode range: 0x00-0x01                                               */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SVTCA( INS_ARG )\r\n  {\r\n    DO_SVTCA\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SPVTCA[a]:    Set PVector to Coordinate Axis                          */\r\n  /* Opcode range: 0x02-0x03                                               */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SPVTCA( INS_ARG )\r\n  {\r\n    DO_SPVTCA\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SFVTCA[a]:    Set FVector to Coordinate Axis                          */\r\n  /* Opcode range: 0x04-0x05                                               */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SFVTCA( INS_ARG )\r\n  {\r\n    DO_SFVTCA\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SPVTL[a]:     Set PVector To Line                                     */\r\n  /* Opcode range: 0x06-0x07                                               */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SPVTL( INS_ARG )\r\n  {\r\n    DO_SPVTL\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SFVTL[a]:     Set FVector To Line                                     */\r\n  /* Opcode range: 0x08-0x09                                               */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SFVTL( INS_ARG )\r\n  {\r\n    DO_SFVTL\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SFVTPV[]:     Set FVector To PVector                                  */\r\n  /* Opcode range: 0x0E                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SFVTPV( INS_ARG )\r\n  {\r\n    DO_SFVTPV\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SPVFS[]:      Set PVector From Stack                                  */\r\n  /* Opcode range: 0x0A                                                    */\r\n  /* Stack:        f2.14 f2.14 -->                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SPVFS( INS_ARG )\r\n  {\r\n    DO_SPVFS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SFVFS[]:      Set FVector From Stack                                  */\r\n  /* Opcode range: 0x0B                                                    */\r\n  /* Stack:        f2.14 f2.14 -->                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SFVFS( INS_ARG )\r\n  {\r\n    DO_SFVFS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* GPV[]:        Get Projection Vector                                   */\r\n  /* Opcode range: 0x0C                                                    */\r\n  /* Stack:        ef2.14 --> ef2.14                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_GPV( INS_ARG )\r\n  {\r\n    DO_GPV\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /* GFV[]:        Get Freedom Vector                                      */\r\n  /* Opcode range: 0x0D                                                    */\r\n  /* Stack:        ef2.14 --> ef2.14                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_GFV( INS_ARG )\r\n  {\r\n    DO_GFV\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SRP0[]:       Set Reference Point 0                                   */\r\n  /* Opcode range: 0x10                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SRP0( INS_ARG )\r\n  {\r\n    DO_SRP0\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SRP1[]:       Set Reference Point 1                                   */\r\n  /* Opcode range: 0x11                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SRP1( INS_ARG )\r\n  {\r\n    DO_SRP1\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SRP2[]:       Set Reference Point 2                                   */\r\n  /* Opcode range: 0x12                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SRP2( INS_ARG )\r\n  {\r\n    DO_SRP2\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* RTHG[]:       Round To Half Grid                                      */\r\n  /* Opcode range: 0x19                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RTHG( INS_ARG )\r\n  {\r\n    DO_RTHG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* RTG[]:        Round To Grid                                           */\r\n  /* Opcode range: 0x18                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RTG( INS_ARG )\r\n  {\r\n    DO_RTG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /* RTDG[]:       Round To Double Grid                                    */\r\n  /* Opcode range: 0x3D                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RTDG( INS_ARG )\r\n  {\r\n    DO_RTDG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /* RUTG[]:       Round Up To Grid                                        */\r\n  /* Opcode range: 0x7C                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RUTG( INS_ARG )\r\n  {\r\n    DO_RUTG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* RDTG[]:       Round Down To Grid                                      */\r\n  /* Opcode range: 0x7D                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RDTG( INS_ARG )\r\n  {\r\n    DO_RDTG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ROFF[]:       Round OFF                                               */\r\n  /* Opcode range: 0x7A                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ROFF( INS_ARG )\r\n  {\r\n    DO_ROFF\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SROUND[]:     Super ROUND                                             */\r\n  /* Opcode range: 0x76                                                    */\r\n  /* Stack:        Eint8 -->                                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SROUND( INS_ARG )\r\n  {\r\n    DO_SROUND\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* S45ROUND[]:   Super ROUND 45 degrees                                  */\r\n  /* Opcode range: 0x77                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_S45ROUND( INS_ARG )\r\n  {\r\n    DO_S45ROUND\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SLOOP[]:      Set LOOP variable                                       */\r\n  /* Opcode range: 0x17                                                    */\r\n  /* Stack:        int32? -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SLOOP( INS_ARG )\r\n  {\r\n    DO_SLOOP\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SMD[]:        Set Minimum Distance                                    */\r\n  /* Opcode range: 0x1A                                                    */\r\n  /* Stack:        f26.6 -->                                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SMD( INS_ARG )\r\n  {\r\n    DO_SMD\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SCVTCI[]:     Set Control Value Table Cut In                          */\r\n  /* Opcode range: 0x1D                                                    */\r\n  /* Stack:        f26.6 -->                                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SCVTCI( INS_ARG )\r\n  {\r\n    DO_SCVTCI\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SSWCI[]:      Set Single Width Cut In                                 */\r\n  /* Opcode range: 0x1E                                                    */\r\n  /* Stack:        f26.6 -->                                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SSWCI( INS_ARG )\r\n  {\r\n    DO_SSWCI\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SSW[]:        Set Single Width                                        */\r\n  /* Opcode range: 0x1F                                                    */\r\n  /* Stack:        int32? -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SSW( INS_ARG )\r\n  {\r\n    DO_SSW\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FLIPON[]:     Set auto-FLIP to ON                                     */\r\n  /* Opcode range: 0x4D                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FLIPON( INS_ARG )\r\n  {\r\n    DO_FLIPON\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FLIPOFF[]:    Set auto-FLIP to OFF                                    */\r\n  /* Opcode range: 0x4E                                                    */\r\n  /* Stack: -->                                                            */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FLIPOFF( INS_ARG )\r\n  {\r\n    DO_FLIPOFF\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SANGW[]:      Set ANGle Weight                                        */\r\n  /* Opcode range: 0x7E                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SANGW( INS_ARG )\r\n  {\r\n    /* instruction not supported anymore */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SDB[]:        Set Delta Base                                          */\r\n  /* Opcode range: 0x5E                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SDB( INS_ARG )\r\n  {\r\n    DO_SDB\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SDS[]:        Set Delta Shift                                         */\r\n  /* Opcode range: 0x5F                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SDS( INS_ARG )\r\n  {\r\n    DO_SDS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MPPEM[]:      Measure Pixel Per EM                                    */\r\n  /* Opcode range: 0x4B                                                    */\r\n  /* Stack:        --> Euint16                                             */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MPPEM( INS_ARG )\r\n  {\r\n    DO_MPPEM\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MPS[]:        Measure Point Size                                      */\r\n  /* Opcode range: 0x4C                                                    */\r\n  /* Stack:        --> Euint16                                             */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MPS( INS_ARG )\r\n  {\r\n    DO_MPS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DUP[]:        DUPlicate the top stack's element                       */\r\n  /* Opcode range: 0x20                                                    */\r\n  /* Stack:        StkElt --> StkElt StkElt                                */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_DUP( INS_ARG )\r\n  {\r\n    DO_DUP\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* POP[]:        POP the stack's top element                             */\r\n  /* Opcode range: 0x21                                                    */\r\n  /* Stack:        StkElt -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_POP( INS_ARG )\r\n  {\r\n    /* nothing to do */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* CLEAR[]:      CLEAR the entire stack                                  */\r\n  /* Opcode range: 0x22                                                    */\r\n  /* Stack:        StkElt... -->                                           */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_CLEAR( INS_ARG )\r\n  {\r\n    DO_CLEAR\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SWAP[]:       SWAP the stack's top two elements                       */\r\n  /* Opcode range: 0x23                                                    */\r\n  /* Stack:        2 * StkElt --> 2 * StkElt                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SWAP( INS_ARG )\r\n  {\r\n    DO_SWAP\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DEPTH[]:      return the stack DEPTH                                  */\r\n  /* Opcode range: 0x24                                                    */\r\n  /* Stack:        --> uint32                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_DEPTH( INS_ARG )\r\n  {\r\n    DO_DEPTH\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* CINDEX[]:     Copy INDEXed element                                    */\r\n  /* Opcode range: 0x25                                                    */\r\n  /* Stack:        int32 --> StkElt                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_CINDEX( INS_ARG )\r\n  {\r\n    DO_CINDEX\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* EIF[]:        End IF                                                  */\r\n  /* Opcode range: 0x59                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_EIF( INS_ARG )\r\n  {\r\n    /* nothing to do */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* JROT[]:       Jump Relative On True                                   */\r\n  /* Opcode range: 0x78                                                    */\r\n  /* Stack:        StkElt int32 -->                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_JROT( INS_ARG )\r\n  {\r\n    DO_JROT\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* JMPR[]:       JuMP Relative                                           */\r\n  /* Opcode range: 0x1C                                                    */\r\n  /* Stack:        int32 -->                                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_JMPR( INS_ARG )\r\n  {\r\n    DO_JMPR\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* JROF[]:       Jump Relative On False                                  */\r\n  /* Opcode range: 0x79                                                    */\r\n  /* Stack:        StkElt int32 -->                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_JROF( INS_ARG )\r\n  {\r\n    DO_JROF\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* LT[]:         Less Than                                               */\r\n  /* Opcode range: 0x50                                                    */\r\n  /* Stack:        int32? int32? --> bool                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_LT( INS_ARG )\r\n  {\r\n    DO_LT\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* LTEQ[]:       Less Than or EQual                                      */\r\n  /* Opcode range: 0x51                                                    */\r\n  /* Stack:        int32? int32? --> bool                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_LTEQ( INS_ARG )\r\n  {\r\n    DO_LTEQ\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* GT[]:         Greater Than                                            */\r\n  /* Opcode range: 0x52                                                    */\r\n  /* Stack:        int32? int32? --> bool                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_GT( INS_ARG )\r\n  {\r\n    DO_GT\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* GTEQ[]:       Greater Than or EQual                                   */\r\n  /* Opcode range: 0x53                                                    */\r\n  /* Stack:        int32? int32? --> bool                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_GTEQ( INS_ARG )\r\n  {\r\n    DO_GTEQ\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* EQ[]:         EQual                                                   */\r\n  /* Opcode range: 0x54                                                    */\r\n  /* Stack:        StkElt StkElt --> bool                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_EQ( INS_ARG )\r\n  {\r\n    DO_EQ\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* NEQ[]:        Not EQual                                               */\r\n  /* Opcode range: 0x55                                                    */\r\n  /* Stack:        StkElt StkElt --> bool                                  */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_NEQ( INS_ARG )\r\n  {\r\n    DO_NEQ\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ODD[]:        Is ODD                                                  */\r\n  /* Opcode range: 0x56                                                    */\r\n  /* Stack:        f26.6 --> bool                                          */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ODD( INS_ARG )\r\n  {\r\n    DO_ODD\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* EVEN[]:       Is EVEN                                                 */\r\n  /* Opcode range: 0x57                                                    */\r\n  /* Stack:        f26.6 --> bool                                          */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_EVEN( INS_ARG )\r\n  {\r\n    DO_EVEN\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* AND[]:        logical AND                                             */\r\n  /* Opcode range: 0x5A                                                    */\r\n  /* Stack:        uint32 uint32 --> uint32                                */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_AND( INS_ARG )\r\n  {\r\n    DO_AND\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* OR[]:         logical OR                                              */\r\n  /* Opcode range: 0x5B                                                    */\r\n  /* Stack:        uint32 uint32 --> uint32                                */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_OR( INS_ARG )\r\n  {\r\n    DO_OR\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* NOT[]:        logical NOT                                             */\r\n  /* Opcode range: 0x5C                                                    */\r\n  /* Stack:        StkElt --> uint32                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_NOT( INS_ARG )\r\n  {\r\n    DO_NOT\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ADD[]:        ADD                                                     */\r\n  /* Opcode range: 0x60                                                    */\r\n  /* Stack:        f26.6 f26.6 --> f26.6                                   */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ADD( INS_ARG )\r\n  {\r\n    DO_ADD\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SUB[]:        SUBtract                                                */\r\n  /* Opcode range: 0x61                                                    */\r\n  /* Stack:        f26.6 f26.6 --> f26.6                                   */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SUB( INS_ARG )\r\n  {\r\n    DO_SUB\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DIV[]:        DIVide                                                  */\r\n  /* Opcode range: 0x62                                                    */\r\n  /* Stack:        f26.6 f26.6 --> f26.6                                   */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_DIV( INS_ARG )\r\n  {\r\n    DO_DIV\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MUL[]:        MULtiply                                                */\r\n  /* Opcode range: 0x63                                                    */\r\n  /* Stack:        f26.6 f26.6 --> f26.6                                   */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MUL( INS_ARG )\r\n  {\r\n    DO_MUL\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ABS[]:        ABSolute value                                          */\r\n  /* Opcode range: 0x64                                                    */\r\n  /* Stack:        f26.6 --> f26.6                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ABS( INS_ARG )\r\n  {\r\n    DO_ABS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* NEG[]:        NEGate                                                  */\r\n  /* Opcode range: 0x65                                                    */\r\n  /* Stack: f26.6 --> f26.6                                                */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_NEG( INS_ARG )\r\n  {\r\n    DO_NEG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FLOOR[]:      FLOOR                                                   */\r\n  /* Opcode range: 0x66                                                    */\r\n  /* Stack:        f26.6 --> f26.6                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FLOOR( INS_ARG )\r\n  {\r\n    DO_FLOOR\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* CEILING[]:    CEILING                                                 */\r\n  /* Opcode range: 0x67                                                    */\r\n  /* Stack:        f26.6 --> f26.6                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_CEILING( INS_ARG )\r\n  {\r\n    DO_CEILING\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* RS[]:         Read Store                                              */\r\n  /* Opcode range: 0x43                                                    */\r\n  /* Stack:        uint32 --> uint32                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RS( INS_ARG )\r\n  {\r\n    DO_RS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* WS[]:         Write Store                                             */\r\n  /* Opcode range: 0x42                                                    */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_WS( INS_ARG )\r\n  {\r\n    DO_WS\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* WCVTP[]:      Write CVT in Pixel units                                */\r\n  /* Opcode range: 0x44                                                    */\r\n  /* Stack:        f26.6 uint32 -->                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_WCVTP( INS_ARG )\r\n  {\r\n    DO_WCVTP\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* WCVTF[]:      Write CVT in Funits                                     */\r\n  /* Opcode range: 0x70                                                    */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_WCVTF( INS_ARG )\r\n  {\r\n    DO_WCVTF\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* RCVT[]:       Read CVT                                                */\r\n  /* Opcode range: 0x45                                                    */\r\n  /* Stack:        uint32 --> f26.6                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_RCVT( INS_ARG )\r\n  {\r\n    DO_RCVT\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* AA[]:         Adjust Angle                                            */\r\n  /* Opcode range: 0x7F                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_AA( INS_ARG )\r\n  {\r\n    /* intentionally no longer supported */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DEBUG[]:      DEBUG.  Unsupported.                                    */\r\n  /* Opcode range: 0x4F                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  /* Note: The original instruction pops a value from the stack.           */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_DEBUG( INS_ARG )\r\n  {\r\n    DO_DEBUG\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ROUND[ab]:    ROUND value                                             */\r\n  /* Opcode range: 0x68-0x6B                                               */\r\n  /* Stack:        f26.6 --> f26.6                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ROUND( INS_ARG )\r\n  {\r\n    DO_ROUND\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* NROUND[ab]:   No ROUNDing of value                                    */\r\n  /* Opcode range: 0x6C-0x6F                                               */\r\n  /* Stack:        f26.6 --> f26.6                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_NROUND( INS_ARG )\r\n  {\r\n    DO_NROUND\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MAX[]:        MAXimum                                                 */\r\n  /* Opcode range: 0x68                                                    */\r\n  /* Stack:        int32? int32? --> int32                                 */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MAX( INS_ARG )\r\n  {\r\n    DO_MAX\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MIN[]:        MINimum                                                 */\r\n  /* Opcode range: 0x69                                                    */\r\n  /* Stack:        int32? int32? --> int32                                 */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MIN( INS_ARG )\r\n  {\r\n    DO_MIN\r\n  }\r\n\r\n\r\n#endif  /* !TT_CONFIG_OPTION_INTERPRETER_SWITCH */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The following functions are called as is within the switch statement. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MINDEX[]:     Move INDEXed element                                    */\r\n  /* Opcode range: 0x26                                                    */\r\n  /* Stack:        int32? --> StkElt                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MINDEX( INS_ARG )\r\n  {\r\n    FT_Long  L, K;\r\n\r\n\r\n    L = args[0];\r\n\r\n    if ( L <= 0 || L > CUR.args )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n    }\r\n    else\r\n    {\r\n      K = CUR.stack[CUR.args - L];\r\n\r\n      FT_ARRAY_MOVE( &CUR.stack[CUR.args - L    ],\r\n                     &CUR.stack[CUR.args - L + 1],\r\n                     ( L - 1 ) );\r\n\r\n      CUR.stack[CUR.args - 1] = K;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ROLL[]:       ROLL top three elements                                 */\r\n  /* Opcode range: 0x8A                                                    */\r\n  /* Stack:        3 * StkElt --> 3 * StkElt                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ROLL( INS_ARG )\r\n  {\r\n    FT_Long  A, B, C;\r\n\r\n    FT_UNUSED_EXEC;\r\n\r\n\r\n    A = args[2];\r\n    B = args[1];\r\n    C = args[0];\r\n\r\n    args[2] = C;\r\n    args[1] = A;\r\n    args[0] = B;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MANAGING THE FLOW OF CONTROL                                          */\r\n  /*                                                                       */\r\n  /*   Instructions appear in the specification's order.                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static FT_Bool\r\n  SkipCode( EXEC_OP )\r\n  {\r\n    CUR.IP += CUR.length;\r\n\r\n    if ( CUR.IP < CUR.codeSize )\r\n    {\r\n      CUR.opcode = CUR.code[CUR.IP];\r\n\r\n      CUR.length = opcode_length[CUR.opcode];\r\n      if ( CUR.length < 0 )\r\n      {\r\n        if ( CUR.IP + 1 >= CUR.codeSize )\r\n          goto Fail_Overflow;\r\n        CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1];\r\n      }\r\n\r\n      if ( CUR.IP + CUR.length <= CUR.codeSize )\r\n        return SUCCESS;\r\n    }\r\n\r\n  Fail_Overflow:\r\n    CUR.error = TT_Err_Code_Overflow;\r\n    return FAILURE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* IF[]:         IF test                                                 */\r\n  /* Opcode range: 0x58                                                    */\r\n  /* Stack:        StkElt -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_IF( INS_ARG )\r\n  {\r\n    FT_Int   nIfs;\r\n    FT_Bool  Out;\r\n\r\n\r\n    if ( args[0] != 0 )\r\n      return;\r\n\r\n    nIfs = 1;\r\n    Out = 0;\r\n\r\n    do\r\n    {\r\n      if ( SKIP_Code() == FAILURE )\r\n        return;\r\n\r\n      switch ( CUR.opcode )\r\n      {\r\n      case 0x58:      /* IF */\r\n        nIfs++;\r\n        break;\r\n\r\n      case 0x1B:      /* ELSE */\r\n        Out = FT_BOOL( nIfs == 1 );\r\n        break;\r\n\r\n      case 0x59:      /* EIF */\r\n        nIfs--;\r\n        Out = FT_BOOL( nIfs == 0 );\r\n        break;\r\n      }\r\n    } while ( Out == 0 );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ELSE[]:       ELSE                                                    */\r\n  /* Opcode range: 0x1B                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ELSE( INS_ARG )\r\n  {\r\n    FT_Int  nIfs;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    nIfs = 1;\r\n\r\n    do\r\n    {\r\n      if ( SKIP_Code() == FAILURE )\r\n        return;\r\n\r\n      switch ( CUR.opcode )\r\n      {\r\n      case 0x58:    /* IF */\r\n        nIfs++;\r\n        break;\r\n\r\n      case 0x59:    /* EIF */\r\n        nIfs--;\r\n        break;\r\n      }\r\n    } while ( nIfs != 0 );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS                         */\r\n  /*                                                                       */\r\n  /*   Instructions appear in the specification's order.                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FDEF[]:       Function DEFinition                                     */\r\n  /* Opcode range: 0x2C                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FDEF( INS_ARG )\r\n  {\r\n    FT_ULong       n;\r\n    TT_DefRecord*  rec;\r\n    TT_DefRecord*  limit;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    /* arguments to opcodes are skipped by `SKIP_Code' */\r\n    FT_Byte    opcode_pattern[1][12] = {\r\n                 /* #0 TTFautohint bytecode (old) */\r\n                 {\r\n                   0x20, /* DUP     */\r\n                   0x64, /* ABS     */\r\n                   0xB0, /* PUSHB_1 */\r\n                         /*   32    */\r\n                   0x60, /* ADD     */\r\n                   0x66, /* FLOOR   */\r\n                   0x23, /* SWAP    */\r\n                   0xB0  /* PUSHB_1 */\r\n                 },\r\n               };\r\n    FT_UShort  opcode_patterns   = 1;\r\n    FT_UShort  opcode_pointer[1] = { 0, };\r\n    FT_UShort  opcode_size[1]    = { 7, };\r\n    FT_UShort  i;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n    /* some font programs are broken enough to redefine functions! */\r\n    /* We will then parse the current table.                       */\r\n\r\n    rec   = CUR.FDefs;\r\n    limit = rec + CUR.numFDefs;\r\n    n     = args[0];\r\n\r\n    for ( ; rec < limit; rec++ )\r\n    {\r\n      if ( rec->opc == n )\r\n        break;\r\n    }\r\n\r\n    if ( rec == limit )\r\n    {\r\n      /* check that there is enough room for new functions */\r\n      if ( CUR.numFDefs >= CUR.maxFDefs )\r\n      {\r\n        CUR.error = TT_Err_Too_Many_Function_Defs;\r\n        return;\r\n      }\r\n      CUR.numFDefs++;\r\n    }\r\n\r\n    /* Although FDEF takes unsigned 32-bit integer,  */\r\n    /* func # must be within unsigned 16-bit integer */\r\n    if ( n > 0xFFFFU )\r\n    {\r\n      CUR.error = TT_Err_Too_Many_Function_Defs;\r\n      return;\r\n    }\r\n\r\n    rec->range        = CUR.curRange;\r\n    rec->opc          = (FT_UInt16)n;\r\n    rec->start        = CUR.IP + 1;\r\n    rec->active       = TRUE;\r\n    rec->inline_delta = FALSE;\r\n\r\n    if ( n > CUR.maxFunc )\r\n      CUR.maxFunc = (FT_UInt16)n;\r\n\r\n    /* Now skip the whole function definition. */\r\n    /* We don't allow nested IDEFS & FDEFs.    */\r\n\r\n    while ( SKIP_Code() == SUCCESS )\r\n    {\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n#ifdef SPH_DEBUG_MORE_VERBOSE\r\n      printf ( \"Opcode: %d \", CUR.opcode );\r\n#endif\r\n\r\n      for ( i = 0; i < opcode_patterns; i++ )\r\n      {\r\n        if ( opcode_pointer[i] < opcode_size[i]                 &&\r\n             CUR.opcode == opcode_pattern[i][opcode_pointer[i]] )\r\n        {\r\n#ifdef SPH_DEBUG_MORE_VERBOSE\r\n          printf( \"function %d, opcode ptrn: %d\"\r\n                  \"  op# %d: %d FOUND \\n\",\r\n                  n, i, opcode_pointer[i], CUR.opcode );\r\n#endif\r\n          opcode_pointer[i] += 1;\r\n\r\n          if ( opcode_pointer[i] == opcode_size[i] )\r\n          {\r\n#ifdef SPH_DEBUG\r\n            printf( \"Function signature %d detected in FDEF %d\\n\", i, n);\r\n#endif\r\n\r\n            switch ( i )\r\n            {\r\n            case 0:\r\n              CUR.size->ttfautohinted = TRUE;\r\n              break;\r\n            }\r\n            opcode_pointer[i] = 0;\r\n          }\r\n        }\r\n\r\n        else\r\n          opcode_pointer[i] = 0;\r\n      }\r\n\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      switch ( CUR.opcode )\r\n      {\r\n      case 0x89:    /* IDEF */\r\n      case 0x2C:    /* FDEF */\r\n        CUR.error = TT_Err_Nested_DEFS;\r\n        return;\r\n\r\n      case 0x2D:   /* ENDF */\r\n        rec->end = CUR.IP;\r\n        return;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ENDF[]:       END Function definition                                 */\r\n  /* Opcode range: 0x2D                                                    */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ENDF( INS_ARG )\r\n  {\r\n    TT_CallRec*  pRec;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    if ( CUR.callTop <= 0 )     /* We encountered an ENDF without a call */\r\n    {\r\n      CUR.error = TT_Err_ENDF_In_Exec_Stream;\r\n      return;\r\n    }\r\n\r\n    CUR.callTop--;\r\n\r\n    pRec = &CUR.callStack[CUR.callTop];\r\n\r\n    pRec->Cur_Count--;\r\n\r\n    CUR.step_ins = FALSE;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    /*\r\n     *  CUR.ignore_x_mode may be turned off prior to function calls.  This\r\n     *  ensures it is turned back on.\r\n     */\r\n    CUR.ignore_x_mode =  ( CUR.subpixel_hinting || CUR.grayscale_hinting ) &&\r\n                        !( CUR.sph_tweak_flags & SPH_TWEAK_PIXEL_HINTING );\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    if ( pRec->Cur_Count > 0 )\r\n    {\r\n      CUR.callTop++;\r\n      CUR.IP = pRec->Cur_Restart;\r\n    }\r\n    else\r\n      /* Loop through the current function */\r\n      INS_Goto_CodeRange( pRec->Caller_Range,\r\n                          pRec->Caller_IP );\r\n\r\n    /* Exit the current call frame.                      */\r\n\r\n    /* NOTE: If the last instruction of a program is a   */\r\n    /*       CALL or LOOPCALL, the return address is     */\r\n    /*       always out of the code range.  This is a    */\r\n    /*       valid address, and it is why we do not test */\r\n    /*       the result of Ins_Goto_CodeRange() here!    */\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* CALL[]:       CALL function                                           */\r\n  /* Opcode range: 0x2B                                                    */\r\n  /* Stack:        uint32? -->                                             */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_CALL( INS_ARG )\r\n  {\r\n    FT_ULong       F;\r\n    TT_CallRec*    pCrec;\r\n    TT_DefRecord*  def;\r\n\r\n\r\n    /* first of all, check the index */\r\n\r\n    F = args[0];\r\n    if ( BOUNDSL( F, CUR.maxFunc + 1 ) )\r\n      goto Fail;\r\n\r\n    /* Except for some old Apple fonts, all functions in a TrueType */\r\n    /* font are defined in increasing order, starting from 0.  This */\r\n    /* means that we normally have                                  */\r\n    /*                                                              */\r\n    /*    CUR.maxFunc+1 == CUR.numFDefs                             */\r\n    /*    CUR.FDefs[n].opc == n for n in 0..CUR.maxFunc             */\r\n    /*                                                              */\r\n    /* If this isn't true, we need to look up the function table.   */\r\n\r\n    def = CUR.FDefs + F;\r\n    if ( CUR.maxFunc + 1 != CUR.numFDefs || def->opc != F )\r\n    {\r\n      /* look up the FDefs table */\r\n      TT_DefRecord*  limit;\r\n\r\n\r\n      def   = CUR.FDefs;\r\n      limit = def + CUR.numFDefs;\r\n\r\n      while ( def < limit && def->opc != F )\r\n        def++;\r\n\r\n      if ( def == limit )\r\n        goto Fail;\r\n    }\r\n\r\n    /* check that the function is active */\r\n    if ( !def->active )\r\n      goto Fail;\r\n\r\n\r\n    /* check the call stack */\r\n    if ( CUR.callTop >= CUR.callSize )\r\n    {\r\n      CUR.error = TT_Err_Stack_Overflow;\r\n      return;\r\n    }\r\n\r\n    pCrec = CUR.callStack + CUR.callTop;\r\n\r\n    pCrec->Caller_Range = CUR.curRange;\r\n    pCrec->Caller_IP    = CUR.IP + 1;\r\n    pCrec->Cur_Count    = 1;\r\n    pCrec->Cur_Restart  = def->start;\r\n    pCrec->Cur_End      = def->end;\r\n\r\n    CUR.callTop++;\r\n\r\n    INS_Goto_CodeRange( def->range,\r\n                        def->start );\r\n\r\n    CUR.step_ins = FALSE;\r\n    return;\r\n\r\n  Fail:\r\n    CUR.error = TT_Err_Invalid_Reference;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* LOOPCALL[]:   LOOP and CALL function                                  */\r\n  /* Opcode range: 0x2A                                                    */\r\n  /* Stack:        uint32? Eint16? -->                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_LOOPCALL( INS_ARG )\r\n  {\r\n    FT_ULong       F;\r\n    TT_CallRec*    pCrec;\r\n    TT_DefRecord*  def;\r\n\r\n\r\n    /* first of all, check the index */\r\n    F = args[1];\r\n    if ( BOUNDSL( F, CUR.maxFunc + 1 ) )\r\n      goto Fail;\r\n\r\n    /* Except for some old Apple fonts, all functions in a TrueType */\r\n    /* font are defined in increasing order, starting from 0.  This */\r\n    /* means that we normally have                                  */\r\n    /*                                                              */\r\n    /*    CUR.maxFunc+1 == CUR.numFDefs                             */\r\n    /*    CUR.FDefs[n].opc == n for n in 0..CUR.maxFunc             */\r\n    /*                                                              */\r\n    /* If this isn't true, we need to look up the function table.   */\r\n\r\n    def = CUR.FDefs + F;\r\n    if ( CUR.maxFunc + 1 != CUR.numFDefs || def->opc != F )\r\n    {\r\n      /* look up the FDefs table */\r\n      TT_DefRecord*  limit;\r\n\r\n\r\n      def   = CUR.FDefs;\r\n      limit = def + CUR.numFDefs;\r\n\r\n      while ( def < limit && def->opc != F )\r\n        def++;\r\n\r\n      if ( def == limit )\r\n        goto Fail;\r\n    }\r\n\r\n    /* check that the function is active */\r\n    if ( !def->active )\r\n      goto Fail;\r\n\r\n    /* check stack */\r\n    if ( CUR.callTop >= CUR.callSize )\r\n    {\r\n      CUR.error = TT_Err_Stack_Overflow;\r\n      return;\r\n    }\r\n\r\n    if ( args[0] > 0 )\r\n    {\r\n      pCrec = CUR.callStack + CUR.callTop;\r\n\r\n      pCrec->Caller_Range = CUR.curRange;\r\n      pCrec->Caller_IP    = CUR.IP + 1;\r\n      pCrec->Cur_Count    = (FT_Int)args[0];\r\n      pCrec->Cur_Restart  = def->start;\r\n      pCrec->Cur_End      = def->end;\r\n\r\n      CUR.callTop++;\r\n\r\n      INS_Goto_CodeRange( def->range, def->start );\r\n\r\n      CUR.step_ins = FALSE;\r\n    }\r\n\r\n    return;\r\n\r\n  Fail:\r\n    CUR.error = TT_Err_Invalid_Reference;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* IDEF[]:       Instruction DEFinition                                  */\r\n  /* Opcode range: 0x89                                                    */\r\n  /* Stack:        Eint8 -->                                               */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_IDEF( INS_ARG )\r\n  {\r\n    TT_DefRecord*  def;\r\n    TT_DefRecord*  limit;\r\n\r\n\r\n    /*  First of all, look for the same function in our table */\r\n\r\n    def   = CUR.IDefs;\r\n    limit = def + CUR.numIDefs;\r\n\r\n    for ( ; def < limit; def++ )\r\n      if ( def->opc == (FT_ULong)args[0] )\r\n        break;\r\n\r\n    if ( def == limit )\r\n    {\r\n      /* check that there is enough room for a new instruction */\r\n      if ( CUR.numIDefs >= CUR.maxIDefs )\r\n      {\r\n        CUR.error = TT_Err_Too_Many_Instruction_Defs;\r\n        return;\r\n      }\r\n      CUR.numIDefs++;\r\n    }\r\n\r\n    /* opcode must be unsigned 8-bit integer */\r\n    if ( 0 > args[0] || args[0] > 0x00FF )\r\n    {\r\n      CUR.error = TT_Err_Too_Many_Instruction_Defs;\r\n      return;\r\n    }\r\n\r\n    def->opc    = (FT_Byte)args[0];\r\n    def->start  = CUR.IP + 1;\r\n    def->range  = CUR.curRange;\r\n    def->active = TRUE;\r\n\r\n    if ( (FT_ULong)args[0] > CUR.maxIns )\r\n      CUR.maxIns = (FT_Byte)args[0];\r\n\r\n    /* Now skip the whole function definition. */\r\n    /* We don't allow nested IDEFs & FDEFs.    */\r\n\r\n    while ( SKIP_Code() == SUCCESS )\r\n    {\r\n      switch ( CUR.opcode )\r\n      {\r\n      case 0x89:   /* IDEF */\r\n      case 0x2C:   /* FDEF */\r\n        CUR.error = TT_Err_Nested_DEFS;\r\n        return;\r\n      case 0x2D:   /* ENDF */\r\n        return;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* PUSHING DATA ONTO THE INTERPRETER STACK                               */\r\n  /*                                                                       */\r\n  /*   Instructions appear in the specification's order.                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* NPUSHB[]:     PUSH N Bytes                                            */\r\n  /* Opcode range: 0x40                                                    */\r\n  /* Stack:        --> uint32...                                           */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_NPUSHB( INS_ARG )\r\n  {\r\n    FT_UShort  L, K;\r\n\r\n\r\n    L = (FT_UShort)CUR.code[CUR.IP + 1];\r\n\r\n    if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )\r\n    {\r\n      CUR.error = TT_Err_Stack_Overflow;\r\n      return;\r\n    }\r\n\r\n    for ( K = 1; K <= L; K++ )\r\n      args[K - 1] = CUR.code[CUR.IP + K + 1];\r\n\r\n    CUR.new_top += L;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* NPUSHW[]:     PUSH N Words                                            */\r\n  /* Opcode range: 0x41                                                    */\r\n  /* Stack:        --> int32...                                            */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_NPUSHW( INS_ARG )\r\n  {\r\n    FT_UShort  L, K;\r\n\r\n\r\n    L = (FT_UShort)CUR.code[CUR.IP + 1];\r\n\r\n    if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )\r\n    {\r\n      CUR.error = TT_Err_Stack_Overflow;\r\n      return;\r\n    }\r\n\r\n    CUR.IP += 2;\r\n\r\n    for ( K = 0; K < L; K++ )\r\n      args[K] = GET_ShortIns();\r\n\r\n    CUR.step_ins = FALSE;\r\n    CUR.new_top += L;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* PUSHB[abc]:   PUSH Bytes                                              */\r\n  /* Opcode range: 0xB0-0xB7                                               */\r\n  /* Stack:        --> uint32...                                           */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_PUSHB( INS_ARG )\r\n  {\r\n    FT_UShort  L, K;\r\n\r\n\r\n    L = (FT_UShort)( CUR.opcode - 0xB0 + 1 );\r\n\r\n    if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )\r\n    {\r\n      CUR.error = TT_Err_Stack_Overflow;\r\n      return;\r\n    }\r\n\r\n    for ( K = 1; K <= L; K++ )\r\n      args[K - 1] = CUR.code[CUR.IP + K];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* PUSHW[abc]:   PUSH Words                                              */\r\n  /* Opcode range: 0xB8-0xBF                                               */\r\n  /* Stack:        --> int32...                                            */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_PUSHW( INS_ARG )\r\n  {\r\n    FT_UShort  L, K;\r\n\r\n\r\n    L = (FT_UShort)( CUR.opcode - 0xB8 + 1 );\r\n\r\n    if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )\r\n    {\r\n      CUR.error = TT_Err_Stack_Overflow;\r\n      return;\r\n    }\r\n\r\n    CUR.IP++;\r\n\r\n    for ( K = 0; K < L; K++ )\r\n      args[K] = GET_ShortIns();\r\n\r\n    CUR.step_ins = FALSE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MANAGING THE GRAPHICS STATE                                           */\r\n  /*                                                                       */\r\n  /*  Instructions appear in the specs' order.                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* GC[a]:        Get Coordinate projected onto                           */\r\n  /* Opcode range: 0x46-0x47                                               */\r\n  /* Stack:        uint32 --> f26.6                                        */\r\n  /*                                                                       */\r\n  /* XXX: UNDOCUMENTED: Measures from the original glyph must be taken     */\r\n  /*      along the dual projection vector!                                */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_GC( INS_ARG )\r\n  {\r\n    FT_ULong    L;\r\n    FT_F26Dot6  R;\r\n\r\n\r\n    L = (FT_ULong)args[0];\r\n\r\n    if ( BOUNDSL( L, CUR.zp2.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      R = 0;\r\n    }\r\n    else\r\n    {\r\n      if ( CUR.opcode & 1 )\r\n        R = CUR_fast_dualproj( &CUR.zp2.org[L] );\r\n      else\r\n        R = CUR_fast_project( &CUR.zp2.cur[L] );\r\n    }\r\n\r\n    args[0] = R;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SCFS[]:       Set Coordinate From Stack                               */\r\n  /* Opcode range: 0x48                                                    */\r\n  /* Stack:        f26.6 uint32 -->                                        */\r\n  /*                                                                       */\r\n  /* Formula:                                                              */\r\n  /*                                                                       */\r\n  /*   OA := OA + ( value - OA.p )/( f.p ) * f                             */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SCFS( INS_ARG )\r\n  {\r\n    FT_Long    K;\r\n    FT_UShort  L;\r\n\r\n\r\n    L = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( L, CUR.zp2.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    K = CUR_fast_project( &CUR.zp2.cur[L] );\r\n\r\n    CUR_Func_move( &CUR.zp2, L, args[1] - K );\r\n\r\n    /* UNDOCUMENTED!  The MS rasterizer does that with */\r\n    /* twilight points (confirmed by Greg Hitchcock)   */\r\n    if ( CUR.GS.gep2 == 0 )\r\n      CUR.zp2.org[L] = CUR.zp2.cur[L];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MD[a]:        Measure Distance                                        */\r\n  /* Opcode range: 0x49-0x4A                                               */\r\n  /* Stack:        uint32 uint32 --> f26.6                                 */\r\n  /*                                                                       */\r\n  /* XXX: UNDOCUMENTED: Measure taken in the original glyph must be along  */\r\n  /*                    the dual projection vector.                        */\r\n  /*                                                                       */\r\n  /* XXX: UNDOCUMENTED: Flag attributes are inverted!                      */\r\n  /*                      0 => measure distance in original outline        */\r\n  /*                      1 => measure distance in grid-fitted outline     */\r\n  /*                                                                       */\r\n  /* XXX: UNDOCUMENTED: `zp0 - zp1', and not `zp2 - zp1!                   */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MD( INS_ARG )\r\n  {\r\n    FT_UShort   K, L;\r\n    FT_F26Dot6  D;\r\n\r\n\r\n    K = (FT_UShort)args[1];\r\n    L = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( L, CUR.zp0.n_points ) ||\r\n         BOUNDS( K, CUR.zp1.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      D = 0;\r\n    }\r\n    else\r\n    {\r\n      if ( CUR.opcode & 1 )\r\n        D = CUR_Func_project( CUR.zp0.cur + L, CUR.zp1.cur + K );\r\n      else\r\n      {\r\n        /* XXX: UNDOCUMENTED: twilight zone special case */\r\n\r\n        if ( CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 )\r\n        {\r\n          FT_Vector*  vec1 = CUR.zp0.org + L;\r\n          FT_Vector*  vec2 = CUR.zp1.org + K;\r\n\r\n\r\n          D = CUR_Func_dualproj( vec1, vec2 );\r\n        }\r\n        else\r\n        {\r\n          FT_Vector*  vec1 = CUR.zp0.orus + L;\r\n          FT_Vector*  vec2 = CUR.zp1.orus + K;\r\n\r\n\r\n          if ( CUR.metrics.x_scale == CUR.metrics.y_scale )\r\n          {\r\n            /* this should be faster */\r\n            D = CUR_Func_dualproj( vec1, vec2 );\r\n            D = FT_MulFix( D, CUR.metrics.x_scale );\r\n          }\r\n          else\r\n          {\r\n            FT_Vector  vec;\r\n\r\n\r\n            vec.x = FT_MulFix( vec1->x - vec2->x, CUR.metrics.x_scale );\r\n            vec.y = FT_MulFix( vec1->y - vec2->y, CUR.metrics.y_scale );\r\n\r\n            D = CUR_fast_dualproj( &vec );\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    /* Disable Type 2 Vacuform Rounds - e.g. Arial Narrow */\r\n    if ( CUR.ignore_x_mode && FT_ABS( D ) == 64 )\r\n      D += 1;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    args[0] = D;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SDPVTL[a]:    Set Dual PVector to Line                                */\r\n  /* Opcode range: 0x86-0x87                                               */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SDPVTL( INS_ARG )\r\n  {\r\n    FT_Long    A, B, C;\r\n    FT_UShort  p1, p2;            /* was FT_Int in pas type ERROR */\r\n    FT_Int     aOpc = CUR.opcode;\r\n\r\n\r\n    p1 = (FT_UShort)args[1];\r\n    p2 = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( p2, CUR.zp1.n_points ) ||\r\n         BOUNDS( p1, CUR.zp2.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    {\r\n      FT_Vector* v1 = CUR.zp1.org + p2;\r\n      FT_Vector* v2 = CUR.zp2.org + p1;\r\n\r\n\r\n      A = v1->x - v2->x;\r\n      B = v1->y - v2->y;\r\n\r\n      /* If v1 == v2, SDPVTL behaves the same as */\r\n      /* SVTCA[X], respectively.                 */\r\n      /*                                         */\r\n      /* Confirmed by Greg Hitchcock.            */\r\n\r\n      if ( A == 0 && B == 0 )\r\n      {\r\n        A    = 0x4000;\r\n        aOpc = 0;\r\n      }\r\n    }\r\n\r\n    if ( ( aOpc & 1 ) != 0 )\r\n    {\r\n      C =  B;   /* counter clockwise rotation */\r\n      B =  A;\r\n      A = -C;\r\n    }\r\n\r\n    NORMalize( A, B, &CUR.GS.dualVector );\r\n\r\n    {\r\n      FT_Vector*  v1 = CUR.zp1.cur + p2;\r\n      FT_Vector*  v2 = CUR.zp2.cur + p1;\r\n\r\n\r\n      A = v1->x - v2->x;\r\n      B = v1->y - v2->y;\r\n    }\r\n\r\n    if ( ( aOpc & 1 ) != 0 )\r\n    {\r\n      C =  B;   /* counter clockwise rotation */\r\n      B =  A;\r\n      A = -C;\r\n    }\r\n\r\n    NORMalize( A, B, &CUR.GS.projVector );\r\n\r\n    GUESS_VECTOR( freeVector );\r\n\r\n    COMPUTE_Funcs();\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SZP0[]:       Set Zone Pointer 0                                      */\r\n  /* Opcode range: 0x13                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SZP0( INS_ARG )\r\n  {\r\n    switch ( (FT_Int)args[0] )\r\n    {\r\n    case 0:\r\n      CUR.zp0 = CUR.twilight;\r\n      break;\r\n\r\n    case 1:\r\n      CUR.zp0 = CUR.pts;\r\n      break;\r\n\r\n    default:\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    CUR.GS.gep0 = (FT_UShort)args[0];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SZP1[]:       Set Zone Pointer 1                                      */\r\n  /* Opcode range: 0x14                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SZP1( INS_ARG )\r\n  {\r\n    switch ( (FT_Int)args[0] )\r\n    {\r\n    case 0:\r\n      CUR.zp1 = CUR.twilight;\r\n      break;\r\n\r\n    case 1:\r\n      CUR.zp1 = CUR.pts;\r\n      break;\r\n\r\n    default:\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    CUR.GS.gep1 = (FT_UShort)args[0];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SZP2[]:       Set Zone Pointer 2                                      */\r\n  /* Opcode range: 0x15                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SZP2( INS_ARG )\r\n  {\r\n    switch ( (FT_Int)args[0] )\r\n    {\r\n    case 0:\r\n      CUR.zp2 = CUR.twilight;\r\n      break;\r\n\r\n    case 1:\r\n      CUR.zp2 = CUR.pts;\r\n      break;\r\n\r\n    default:\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    CUR.GS.gep2 = (FT_UShort)args[0];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SZPS[]:       Set Zone PointerS                                       */\r\n  /* Opcode range: 0x16                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SZPS( INS_ARG )\r\n  {\r\n    switch ( (FT_Int)args[0] )\r\n    {\r\n    case 0:\r\n      CUR.zp0 = CUR.twilight;\r\n      break;\r\n\r\n    case 1:\r\n      CUR.zp0 = CUR.pts;\r\n      break;\r\n\r\n    default:\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    CUR.zp1 = CUR.zp0;\r\n    CUR.zp2 = CUR.zp0;\r\n\r\n    CUR.GS.gep0 = (FT_UShort)args[0];\r\n    CUR.GS.gep1 = (FT_UShort)args[0];\r\n    CUR.GS.gep2 = (FT_UShort)args[0];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* INSTCTRL[]:   INSTruction ConTRoL                                     */\r\n  /* Opcode range: 0x8e                                                    */\r\n  /* Stack:        int32 int32 -->                                         */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_INSTCTRL( INS_ARG )\r\n  {\r\n    FT_Long  K, L;\r\n\r\n\r\n    K = args[1];\r\n    L = args[0];\r\n\r\n    if ( K < 1 || K > 2 )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    if ( L != 0 )\r\n        L = K;\r\n\r\n    CUR.GS.instruct_control = FT_BOOL(\r\n      ( (FT_Byte)CUR.GS.instruct_control & ~(FT_Byte)K ) | (FT_Byte)L );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SCANCTRL[]:   SCAN ConTRoL                                            */\r\n  /* Opcode range: 0x85                                                    */\r\n  /* Stack:        uint32? -->                                             */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SCANCTRL( INS_ARG )\r\n  {\r\n    FT_Int  A;\r\n\r\n\r\n    /* Get Threshold */\r\n    A = (FT_Int)( args[0] & 0xFF );\r\n\r\n    if ( A == 0xFF )\r\n    {\r\n      CUR.GS.scan_control = TRUE;\r\n      return;\r\n    }\r\n    else if ( A == 0 )\r\n    {\r\n      CUR.GS.scan_control = FALSE;\r\n      return;\r\n    }\r\n\r\n    if ( ( args[0] & 0x100 ) != 0 && CUR.tt_metrics.ppem <= A )\r\n      CUR.GS.scan_control = TRUE;\r\n\r\n    if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated )\r\n      CUR.GS.scan_control = TRUE;\r\n\r\n    if ( ( args[0] & 0x400 ) != 0 && CUR.tt_metrics.stretched )\r\n      CUR.GS.scan_control = TRUE;\r\n\r\n    if ( ( args[0] & 0x800 ) != 0 && CUR.tt_metrics.ppem > A )\r\n      CUR.GS.scan_control = FALSE;\r\n\r\n    if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated )\r\n      CUR.GS.scan_control = FALSE;\r\n\r\n    if ( ( args[0] & 0x2000 ) != 0 && CUR.tt_metrics.stretched )\r\n      CUR.GS.scan_control = FALSE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SCANTYPE[]:   SCAN TYPE                                               */\r\n  /* Opcode range: 0x8D                                                    */\r\n  /* Stack:        uint32? -->                                             */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SCANTYPE( INS_ARG )\r\n  {\r\n    if ( args[0] >= 0 )\r\n      CUR.GS.scan_type = (FT_Int)args[0];\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MANAGING OUTLINES                                                     */\r\n  /*                                                                       */\r\n  /*   Instructions appear in the specification's order.                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FLIPPT[]:     FLIP PoinT                                              */\r\n  /* Opcode range: 0x80                                                    */\r\n  /* Stack:        uint32... -->                                           */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FLIPPT( INS_ARG )\r\n  {\r\n    FT_UShort  point;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    if ( CUR.top < CUR.GS.loop )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Too_Few_Arguments;\r\n      goto Fail;\r\n    }\r\n\r\n    while ( CUR.GS.loop > 0 )\r\n    {\r\n      CUR.args--;\r\n\r\n      point = (FT_UShort)CUR.stack[CUR.args];\r\n\r\n      if ( BOUNDS( point, CUR.pts.n_points ) )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n          return;\r\n        }\r\n      }\r\n      else\r\n        CUR.pts.tags[point] ^= FT_CURVE_TAG_ON;\r\n\r\n      CUR.GS.loop--;\r\n    }\r\n\r\n  Fail:\r\n    CUR.GS.loop = 1;\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FLIPRGON[]:   FLIP RanGe ON                                           */\r\n  /* Opcode range: 0x81                                                    */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FLIPRGON( INS_ARG )\r\n  {\r\n    FT_UShort  I, K, L;\r\n\r\n\r\n    K = (FT_UShort)args[1];\r\n    L = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( K, CUR.pts.n_points ) ||\r\n         BOUNDS( L, CUR.pts.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    for ( I = L; I <= K; I++ )\r\n      CUR.pts.tags[I] |= FT_CURVE_TAG_ON;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FLIPRGOFF:    FLIP RanGe OFF                                          */\r\n  /* Opcode range: 0x82                                                    */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_FLIPRGOFF( INS_ARG )\r\n  {\r\n    FT_UShort  I, K, L;\r\n\r\n\r\n    K = (FT_UShort)args[1];\r\n    L = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( K, CUR.pts.n_points ) ||\r\n         BOUNDS( L, CUR.pts.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    for ( I = L; I <= K; I++ )\r\n      CUR.pts.tags[I] &= ~FT_CURVE_TAG_ON;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  Compute_Point_Displacement( EXEC_OP_ FT_F26Dot6*   x,\r\n                                       FT_F26Dot6*   y,\r\n                                       TT_GlyphZone  zone,\r\n                                       FT_UShort*    refp )\r\n  {\r\n    TT_GlyphZoneRec  zp;\r\n    FT_UShort        p;\r\n    FT_F26Dot6       d;\r\n\r\n\r\n    if ( CUR.opcode & 1 )\r\n    {\r\n      zp = CUR.zp0;\r\n      p  = CUR.GS.rp1;\r\n    }\r\n    else\r\n    {\r\n      zp = CUR.zp1;\r\n      p  = CUR.GS.rp2;\r\n    }\r\n\r\n    if ( BOUNDS( p, zp.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      *refp = 0;\r\n      return FAILURE;\r\n    }\r\n\r\n    *zone = zp;\r\n    *refp = p;\r\n\r\n    d = CUR_Func_project( zp.cur + p, zp.org + p );\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    if ( CUR.face->unpatented_hinting )\r\n    {\r\n      if ( CUR.GS.both_x_axis )\r\n      {\r\n        *x = d;\r\n        *y = 0;\r\n      }\r\n      else\r\n      {\r\n        *x = 0;\r\n        *y = d;\r\n      }\r\n    }\r\n    else\r\n#endif\r\n    {\r\n      *x = FT_MulDiv( d, (FT_Long)CUR.GS.freeVector.x, CUR.F_dot_P );\r\n      *y = FT_MulDiv( d, (FT_Long)CUR.GS.freeVector.y, CUR.F_dot_P );\r\n    }\r\n\r\n    return SUCCESS;\r\n  }\r\n\r\n\r\n  static void\r\n  Move_Zp2_Point( EXEC_OP_ FT_UShort   point,\r\n                           FT_F26Dot6  dx,\r\n                           FT_F26Dot6  dy,\r\n                           FT_Bool     touch )\r\n  {\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    if ( CUR.face->unpatented_hinting )\r\n    {\r\n      if ( CUR.GS.both_x_axis )\r\n      {\r\n        CUR.zp2.cur[point].x += dx;\r\n        if ( touch )\r\n          CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;\r\n      }\r\n      else\r\n      {\r\n        CUR.zp2.cur[point].y += dy;\r\n        if ( touch )\r\n          CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;\r\n      }\r\n      return;\r\n    }\r\n#endif\r\n\r\n    if ( CUR.GS.freeVector.x != 0 )\r\n    {\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( !CUR.ignore_x_mode                                      ||\r\n          ( CUR.ignore_x_mode                                    &&\r\n            ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_MOVE_ZP2 ) ) )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n        CUR.zp2.cur[point].x += dx;\r\n      if ( touch )\r\n        CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;\r\n    }\r\n\r\n    if ( CUR.GS.freeVector.y != 0 )\r\n    {\r\n      CUR.zp2.cur[point].y += dy;\r\n      if ( touch )\r\n        CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SHP[a]:       SHift Point by the last point                           */\r\n  /* Opcode range: 0x32-0x33                                               */\r\n  /* Stack:        uint32... -->                                           */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SHP( INS_ARG )\r\n  {\r\n    TT_GlyphZoneRec  zp;\r\n    FT_UShort        refp;\r\n\r\n    FT_F26Dot6       dx,\r\n                     dy;\r\n    FT_UShort        point;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    if ( CUR.top < CUR.GS.loop )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )\r\n      return;\r\n\r\n    while ( CUR.GS.loop > 0 )\r\n    {\r\n      CUR.args--;\r\n      point = (FT_UShort)CUR.stack[CUR.args];\r\n\r\n      if ( BOUNDS( point, CUR.zp2.n_points ) )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n          return;\r\n        }\r\n      }\r\n      else\r\n        MOVE_Zp2_Point( point, dx, dy, TRUE );\r\n\r\n      CUR.GS.loop--;\r\n    }\r\n\r\n  Fail:\r\n    CUR.GS.loop = 1;\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SHC[a]:       SHift Contour                                           */\r\n  /* Opcode range: 0x34-35                                                 */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  /* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual)     */\r\n  /*               contour in the twilight zone, namely contour number     */\r\n  /*               zero which includes all points of it.                   */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SHC( INS_ARG )\r\n  {\r\n    TT_GlyphZoneRec  zp;\r\n    FT_UShort        refp;\r\n    FT_F26Dot6       dx, dy;\r\n\r\n    FT_Short         contour, bounds;\r\n    FT_UShort        start, limit, i;\r\n\r\n\r\n    contour = (FT_UShort)args[0];\r\n    bounds  = ( CUR.GS.gep2 == 0 ) ? 1 : CUR.zp2.n_contours;\r\n\r\n    if ( BOUNDS( contour, bounds ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )\r\n      return;\r\n\r\n    if ( contour == 0 )\r\n      start = 0;\r\n    else\r\n      start = (FT_UShort)( CUR.zp2.contours[contour - 1] + 1 -\r\n                           CUR.zp2.first_point );\r\n\r\n    /* we use the number of points if in the twilight zone */\r\n    if ( CUR.GS.gep2 == 0 )\r\n      limit = CUR.zp2.n_points;\r\n    else\r\n      limit = (FT_UShort)( CUR.zp2.contours[contour] -\r\n                           CUR.zp2.first_point + 1 );\r\n\r\n    for ( i = start; i < limit; i++ )\r\n    {\r\n      if ( zp.cur != CUR.zp2.cur || refp != i )\r\n        MOVE_Zp2_Point( i, dx, dy, TRUE );\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SHZ[a]:       SHift Zone                                              */\r\n  /* Opcode range: 0x36-37                                                 */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SHZ( INS_ARG )\r\n  {\r\n    TT_GlyphZoneRec  zp;\r\n    FT_UShort        refp;\r\n    FT_F26Dot6       dx,\r\n                     dy;\r\n\r\n    FT_UShort        limit, i;\r\n\r\n\r\n    if ( BOUNDS( args[0], 2 ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )\r\n      return;\r\n\r\n    /* XXX: UNDOCUMENTED! SHZ doesn't move the phantom points.     */\r\n    /*      Twilight zone has no real contours, so use `n_points'. */\r\n    /*      Normal zone's `n_points' includes phantoms, so must    */\r\n    /*      use end of last contour.                               */\r\n    if ( CUR.GS.gep2 == 0 )\r\n      limit = (FT_UShort)CUR.zp2.n_points;\r\n    else if ( CUR.GS.gep2 == 1 && CUR.zp2.n_contours > 0 )\r\n      limit = (FT_UShort)( CUR.zp2.contours[CUR.zp2.n_contours - 1] + 1 );\r\n    else\r\n      limit = 0;\r\n\r\n    /* XXX: UNDOCUMENTED! SHZ doesn't touch the points */\r\n    for ( i = 0; i < limit; i++ )\r\n    {\r\n      if ( zp.cur != CUR.zp2.cur || refp != i )\r\n        MOVE_Zp2_Point( i, dx, dy, FALSE );\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* SHPIX[]:      SHift points by a PIXel amount                          */\r\n  /* Opcode range: 0x38                                                    */\r\n  /* Stack:        f26.6 uint32... -->                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_SHPIX( INS_ARG )\r\n  {\r\n    FT_F26Dot6  dx, dy;\r\n    FT_UShort   point;\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    FT_Int      B1, B2;\r\n#endif\r\n\r\n\r\n    if ( CUR.top < CUR.GS.loop + 1 )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    if ( CUR.face->unpatented_hinting )\r\n    {\r\n      if ( CUR.GS.both_x_axis )\r\n      {\r\n        dx = (FT_UInt32)args[0];\r\n        dy = 0;\r\n      }\r\n      else\r\n      {\r\n        dx = 0;\r\n        dy = (FT_UInt32)args[0];\r\n      }\r\n    }\r\n    else\r\n#endif\r\n    {\r\n      dx = TT_MulFix14( (FT_UInt32)args[0], CUR.GS.freeVector.x );\r\n      dy = TT_MulFix14( (FT_UInt32)args[0], CUR.GS.freeVector.y );\r\n    }\r\n\r\n    while ( CUR.GS.loop > 0 )\r\n    {\r\n      CUR.args--;\r\n\r\n      point = (FT_UShort)CUR.stack[CUR.args];\r\n\r\n      if ( BOUNDS( point, CUR.zp2.n_points ) )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n          return;\r\n        }\r\n      }\r\n      else\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      {\r\n        /*  If not using ignore_x_mode rendering, allow ZP2 move.          */\r\n        /*  If inline deltas aren't allowed, skip ZP2 move.                */\r\n        /*  If using ignore_x_mode rendering, allow ZP2 point move if:     */\r\n        /*   - freedom vector is y and compatibility_mode is off           */\r\n        /*   - the glyph is composite and the move is in the Y direction   */\r\n        /*   - the glyph is specifically set to allow SHPIX moves          */\r\n        /*   - the move is on a previously Y-touched point                 */\r\n\r\n        if ( CUR.ignore_x_mode )\r\n        {\r\n          /* save point for later comparison */\r\n          if ( CUR.GS.freeVector.y != 0 )\r\n            B1 = CUR.zp2.cur[point].y;\r\n          else\r\n            B1 = CUR.zp2.cur[point].x;\r\n\r\n          if ( CUR.GS.freeVector.y != 0                               &&\r\n               ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_INLINE_DELTAS ) )\r\n            goto Skip;\r\n\r\n          if ( CUR.ignore_x_mode                                   &&\r\n               !CUR.compatibility_mode && CUR.GS.freeVector.y != 0 )\r\n            MOVE_Zp2_Point( point, dx, dy, TRUE );\r\n\r\n          else if ( CUR.ignore_x_mode && CUR.compatibility_mode )\r\n          {\r\n            if ( CUR.ignore_x_mode                                         &&\r\n                ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )\r\n            {\r\n              dx = FT_PIX_ROUND( B1 + dx ) - B1;\r\n              dy = FT_PIX_ROUND( B1 + dy ) - B1;\r\n            }\r\n\r\n            if ( !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&\r\n                  ( ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) ||\r\n                    ( CUR.zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y )   ||\r\n                    ( CUR.sph_tweak_flags & SPH_TWEAK_DO_SHPIX )     )   )\r\n              MOVE_Zp2_Point( point, dx, dy, TRUE );\r\n          }\r\n\r\n          /* save new point */\r\n          if ( CUR.GS.freeVector.y != 0 )\r\n            B2 = CUR.zp2.cur[point].y;\r\n          else\r\n            B2 = CUR.zp2.cur[point].x;\r\n\r\n          /* reverse any disallowed moves */\r\n          if ( ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&\r\n                 CUR.GS.freeVector.y != 0                                  &&\r\n                 B1 % 64 != 0                                              &&\r\n                 B2 % 64 != 0                                              &&\r\n                 B1 != B2                                                  ) ||\r\n               ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES ) &&\r\n                 CUR.GS.freeVector.y != 0                                  &&\r\n                 B1 % 64 == 0                                              &&\r\n                 B2 % 64 != 0                                              &&\r\n                 B1 != B2                                                  &&\r\n                 !CUR.size->ttfautohinted                                  ) )\r\n          {\r\n#ifdef SPH_DEBUG\r\n            printf( \"Reversing ZP2 move\\n\" );\r\n#endif\r\n            MOVE_Zp2_Point( point, -dx, -dy, TRUE );\r\n          }\r\n      }\r\n        else\r\n          MOVE_Zp2_Point( point, dx, dy, TRUE );\r\n      }\r\n  Skip:\r\n#else\r\n        MOVE_Zp2_Point( point, dx, dy, TRUE );\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n      CUR.GS.loop--;\r\n    }\r\n\r\n  Fail:\r\n    CUR.GS.loop = 1;\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MSIRP[a]:     Move Stack Indirect Relative Position                   */\r\n  /* Opcode range: 0x3A-0x3B                                               */\r\n  /* Stack:        f26.6 uint32 -->                                        */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MSIRP( INS_ARG )\r\n  {\r\n    FT_UShort   point;\r\n    FT_F26Dot6  distance;\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    FT_F26Dot6  control_value_cutin;\r\n\r\n\r\n    control_value_cutin = CUR.GS.control_value_cutin;\r\n\r\n    if ( CUR.ignore_x_mode                                 &&\r\n         CUR.GS.freeVector.x != 0                          &&\r\n         !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )\r\n      control_value_cutin = 0;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    point = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( point,      CUR.zp1.n_points ) ||\r\n         BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    /* UNDOCUMENTED!  The MS rasterizer does that with */\r\n    /* twilight points (confirmed by Greg Hitchcock)   */\r\n    if ( CUR.GS.gep1 == 0 )\r\n    {\r\n      CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0];\r\n      CUR_Func_move_orig( &CUR.zp1, point, args[1] );\r\n      CUR.zp1.cur[point] = CUR.zp1.org[point];\r\n    }\r\n\r\n    distance = CUR_Func_project( CUR.zp1.cur + point,\r\n                                 CUR.zp0.cur + CUR.GS.rp0 );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    /* subpixel hinting - make MSIRP respect CVT cut-in; */\r\n    if ( CUR.ignore_x_mode                                   &&\r\n         CUR.GS.freeVector.x != 0                            &&\r\n         FT_ABS( distance - args[1] ) >= control_value_cutin )\r\n      distance = args[1];\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    CUR_Func_move( &CUR.zp1, point, args[1] - distance );\r\n\r\n    CUR.GS.rp1 = CUR.GS.rp0;\r\n    CUR.GS.rp2 = point;\r\n\r\n    if ( ( CUR.opcode & 1 ) != 0 )\r\n      CUR.GS.rp0 = point;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MDAP[a]:      Move Direct Absolute Point                              */\r\n  /* Opcode range: 0x2E-0x2F                                               */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MDAP( INS_ARG )\r\n  {\r\n    FT_UShort   point;\r\n    FT_F26Dot6  cur_dist;\r\n    FT_F26Dot6  distance;\r\n\r\n\r\n    point = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( point, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    if ( ( CUR.opcode & 1 ) != 0 )\r\n    {\r\n      cur_dist = CUR_fast_project( &CUR.zp0.cur[point] );\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( CUR.ignore_x_mode        &&\r\n           CUR.GS.freeVector.x != 0 )\r\n        distance = ROUND_None(\r\n                     cur_dist,\r\n                     CUR.tt_metrics.compensations[0] ) - cur_dist;\r\n      else\r\n#endif\r\n        distance = CUR_Func_round(\r\n                     cur_dist,\r\n                     CUR.tt_metrics.compensations[0] ) - cur_dist;\r\n    }\r\n    else\r\n      distance = 0;\r\n\r\n    CUR_Func_move( &CUR.zp0, point, distance );\r\n\r\n    CUR.GS.rp0 = point;\r\n    CUR.GS.rp1 = point;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MIAP[a]:      Move Indirect Absolute Point                            */\r\n  /* Opcode range: 0x3E-0x3F                                               */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MIAP( INS_ARG )\r\n  {\r\n    FT_ULong    cvtEntry;\r\n    FT_UShort   point;\r\n    FT_F26Dot6  distance;\r\n    FT_F26Dot6  org_dist;\r\n    FT_F26Dot6  control_value_cutin;\r\n\r\n\r\n    control_value_cutin = CUR.GS.control_value_cutin;\r\n    cvtEntry            = (FT_ULong)args[1];\r\n    point               = (FT_UShort)args[0];\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode                                 &&\r\n         CUR.GS.freeVector.x != 0                          &&\r\n         !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )\r\n      control_value_cutin = 0;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    if ( BOUNDS( point,     CUR.zp0.n_points ) ||\r\n         BOUNDSL( cvtEntry, CUR.cvtSize )      )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    /* UNDOCUMENTED!                                                      */\r\n    /*                                                                    */\r\n    /* The behaviour of an MIAP instruction is quite different when used  */\r\n    /* in the twilight zone.                                              */\r\n    /*                                                                    */\r\n    /* First, no control value cut-in test is performed as it would fail  */\r\n    /* anyway.  Second, the original point, i.e. (org_x,org_y) of         */\r\n    /* zp0.point, is set to the absolute, unrounded distance found in the */\r\n    /* CVT.                                                               */\r\n    /*                                                                    */\r\n    /* This is used in the CVT programs of the Microsoft fonts Arial,     */\r\n    /* Times, etc., in order to re-adjust some key font heights.  It      */\r\n    /* allows the use of the IP instruction in the twilight zone, which   */\r\n    /* otherwise would be invalid according to the specification.         */\r\n    /*                                                                    */\r\n    /* We implement it with a special sequence for the twilight zone.     */\r\n    /* This is a bad hack, but it seems to work.                          */\r\n    /*                                                                    */\r\n    /* Confirmed by Greg Hitchcock.                                       */\r\n\r\n    distance = CUR_Func_read_cvt( cvtEntry );\r\n\r\n    if ( CUR.GS.gep0 == 0 )   /* If in twilight zone */\r\n    {\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      /* only adjust legacy fonts x otherwise breaks Calibri italic */\r\n      if ( CUR.compatibility_mode )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n        CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance,\r\n                                            CUR.GS.freeVector.x );\r\n      CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance,\r\n                                          CUR.GS.freeVector.y ),\r\n      CUR.zp0.cur[point]   = CUR.zp0.org[point];\r\n    }\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( ( CUR.sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) &&\r\n         distance > 0                                  &&\r\n         CUR.GS.freeVector.y != 0                      )\r\n      distance = 0;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    org_dist = CUR_fast_project( &CUR.zp0.cur[point] );\r\n\r\n    if ( ( CUR.opcode & 1 ) != 0 )   /* rounding and control cut-in flag */\r\n    {\r\n      if ( FT_ABS( distance - org_dist ) > control_value_cutin )\r\n        distance = org_dist;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( CUR.ignore_x_mode        &&\r\n           CUR.GS.freeVector.x != 0 )\r\n        distance = ROUND_None( distance,\r\n                               CUR.tt_metrics.compensations[0] );\r\n      else\r\n#endif\r\n        distance = CUR_Func_round( distance,\r\n                                   CUR.tt_metrics.compensations[0] );\r\n    }\r\n\r\n    CUR_Func_move( &CUR.zp0, point, distance - org_dist );\r\n\r\n  Fail:\r\n    CUR.GS.rp0 = point;\r\n    CUR.GS.rp1 = point;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MDRP[abcde]:  Move Direct Relative Point                              */\r\n  /* Opcode range: 0xC0-0xDF                                               */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MDRP( INS_ARG )\r\n  {\r\n    FT_UShort   point;\r\n    FT_F26Dot6  org_dist, distance, minimum_distance;\r\n\r\n\r\n    minimum_distance = CUR.GS.minimum_distance;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode                                 &&\r\n         CUR.GS.freeVector.x != 0                          &&\r\n         !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )\r\n      minimum_distance = 0;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n    point = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( point,      CUR.zp1.n_points ) ||\r\n         BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    /* XXX: Is there some undocumented feature while in the */\r\n    /*      twilight zone?                                  */\r\n\r\n    /* XXX: UNDOCUMENTED: twilight zone special case */\r\n\r\n    if ( CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 )\r\n    {\r\n      FT_Vector*  vec1 = &CUR.zp1.org[point];\r\n      FT_Vector*  vec2 = &CUR.zp0.org[CUR.GS.rp0];\r\n\r\n\r\n      org_dist = CUR_Func_dualproj( vec1, vec2 );\r\n    }\r\n    else\r\n    {\r\n      FT_Vector*  vec1 = &CUR.zp1.orus[point];\r\n      FT_Vector*  vec2 = &CUR.zp0.orus[CUR.GS.rp0];\r\n\r\n\r\n      if ( CUR.metrics.x_scale == CUR.metrics.y_scale )\r\n      {\r\n        /* this should be faster */\r\n        org_dist = CUR_Func_dualproj( vec1, vec2 );\r\n        org_dist = FT_MulFix( org_dist, CUR.metrics.x_scale );\r\n      }\r\n      else\r\n      {\r\n        FT_Vector  vec;\r\n\r\n\r\n        vec.x = FT_MulFix( vec1->x - vec2->x, CUR.metrics.x_scale );\r\n        vec.y = FT_MulFix( vec1->y - vec2->y, CUR.metrics.y_scale );\r\n\r\n        org_dist = CUR_fast_dualproj( &vec );\r\n      }\r\n    }\r\n\r\n    /* single width cut-in test */\r\n\r\n    if ( FT_ABS( org_dist - CUR.GS.single_width_value ) <\r\n         CUR.GS.single_width_cutin )\r\n    {\r\n      if ( org_dist >= 0 )\r\n        org_dist = CUR.GS.single_width_value;\r\n      else\r\n        org_dist = -CUR.GS.single_width_value;\r\n    }\r\n\r\n    /* round flag */\r\n\r\n    if ( ( CUR.opcode & 4 ) != 0 )\r\n    {\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 )\r\n        distance = ROUND_None(\r\n                     org_dist,\r\n                     CUR.tt_metrics.compensations[CUR.opcode & 3] );\r\n      else\r\n#endif\r\n      distance = CUR_Func_round(\r\n                   org_dist,\r\n                   CUR.tt_metrics.compensations[CUR.opcode & 3] );\r\n    }\r\n    else\r\n      distance = ROUND_None(\r\n                   org_dist,\r\n                   CUR.tt_metrics.compensations[CUR.opcode & 3] );\r\n\r\n    /* minimum distance flag */\r\n\r\n    if ( ( CUR.opcode & 8 ) != 0 )\r\n    {\r\n      if ( org_dist >= 0 )\r\n      {\r\n        if ( distance < minimum_distance )\r\n          distance = minimum_distance;\r\n      }\r\n      else\r\n      {\r\n        if ( distance > -minimum_distance )\r\n          distance = -minimum_distance;\r\n      }\r\n    }\r\n\r\n    /* now move the point */\r\n\r\n    org_dist = CUR_Func_project( CUR.zp1.cur + point,\r\n                                 CUR.zp0.cur + CUR.GS.rp0 );\r\n\r\n    CUR_Func_move( &CUR.zp1, point, distance - org_dist );\r\n\r\n  Fail:\r\n    CUR.GS.rp1 = CUR.GS.rp0;\r\n    CUR.GS.rp2 = point;\r\n\r\n    if ( ( CUR.opcode & 16 ) != 0 )\r\n      CUR.GS.rp0 = point;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MIRP[abcde]:  Move Indirect Relative Point                            */\r\n  /* Opcode range: 0xE0-0xFF                                               */\r\n  /* Stack:        int32? uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_MIRP( INS_ARG )\r\n  {\r\n    FT_UShort   point;\r\n    FT_ULong    cvtEntry;\r\n\r\n    FT_F26Dot6  cvt_dist,\r\n                distance,\r\n                cur_dist,\r\n                org_dist,\r\n                control_value_cutin,\r\n                minimum_distance;\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    FT_Int      B1;\r\n    FT_Int      B2;\r\n    FT_Bool     reverse_move = FALSE;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n    minimum_distance    = CUR.GS.minimum_distance;\r\n    control_value_cutin = CUR.GS.control_value_cutin;\r\n    point               = (FT_UShort)args[0];\r\n    cvtEntry            = (FT_ULong)( args[1] + 1 );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode                                 &&\r\n         CUR.GS.freeVector.x != 0                          &&\r\n         !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )\r\n      control_value_cutin = minimum_distance = 0;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */\r\n\r\n    if ( BOUNDS( point,      CUR.zp1.n_points ) ||\r\n         BOUNDSL( cvtEntry,  CUR.cvtSize + 1 )  ||\r\n         BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( !cvtEntry )\r\n      cvt_dist = 0;\r\n    else\r\n      cvt_dist = CUR_Func_read_cvt( cvtEntry - 1 );\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n      if ( CUR.sph_tweak_flags & SPH_TWEAK_MIRP_CVT_ZERO )\r\n        cvt_dist = 0;\r\n#endif\r\n\r\n    /* single width test */\r\n\r\n    if ( FT_ABS( cvt_dist - CUR.GS.single_width_value ) <\r\n         CUR.GS.single_width_cutin )\r\n    {\r\n      if ( cvt_dist >= 0 )\r\n        cvt_dist =  CUR.GS.single_width_value;\r\n      else\r\n        cvt_dist = -CUR.GS.single_width_value;\r\n    }\r\n\r\n    /* UNDOCUMENTED!  The MS rasterizer does that with */\r\n    /* twilight points (confirmed by Greg Hitchcock)   */\r\n    if ( CUR.GS.gep1 == 0 )\r\n    {\r\n      CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +\r\n                             TT_MulFix14( (FT_UInt32)cvt_dist,\r\n                                          CUR.GS.freeVector.x );\r\n      CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +\r\n                             TT_MulFix14( (FT_UInt32)cvt_dist,\r\n                                          CUR.GS.freeVector.y );\r\n      CUR.zp1.cur[point]   = CUR.zp1.org[point];\r\n    }\r\n\r\n    org_dist = CUR_Func_dualproj( &CUR.zp1.org[point],\r\n                                  &CUR.zp0.org[CUR.GS.rp0] );\r\n    cur_dist = CUR_Func_project ( &CUR.zp1.cur[point],\r\n                                  &CUR.zp0.cur[CUR.GS.rp0] );\r\n\r\n    /* auto-flip test */\r\n\r\n    if ( CUR.GS.auto_flip )\r\n    {\r\n      if ( ( org_dist ^ cvt_dist ) < 0 )\r\n        cvt_dist = -cvt_dist;\r\n    }\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.GS.freeVector.y != 0                                 &&\r\n         ( CUR.sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )\r\n    {\r\n      if ( cur_dist < -64 )\r\n        cvt_dist -= 16;\r\n      else if ( cur_dist > 64 && cur_dist < 84 )\r\n        cvt_dist += 32;\r\n    }\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n    /* control value cut-in and round */\r\n\r\n    if ( ( CUR.opcode & 4 ) != 0 )\r\n    {\r\n      /* XXX: UNDOCUMENTED!  Only perform cut-in test when both points */\r\n      /*      refer to the same zone.                                  */\r\n\r\n      if ( CUR.GS.gep0 == CUR.GS.gep1 )\r\n      {\r\n        /* XXX: According to Greg Hitchcock, the following wording is */\r\n        /*      the right one:                                        */\r\n        /*                                                            */\r\n        /*        When the absolute difference between the value in   */\r\n        /*        the table [CVT] and the measurement directly from   */\r\n        /*        the outline is _greater_ than the cut_in value, the */\r\n        /*        outline measurement is used.                        */\r\n        /*                                                            */\r\n        /*      This is from `instgly.doc'.  The description in       */\r\n        /*      `ttinst2.doc', version 1.66, is thus incorrect since  */\r\n        /*      it implies `>=' instead of `>'.                       */\r\n\r\n        if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin )\r\n          cvt_dist = org_dist;\r\n      }\r\n\r\n      distance = CUR_Func_round(\r\n                   cvt_dist,\r\n                   CUR.tt_metrics.compensations[CUR.opcode & 3] );\r\n    }\r\n    else\r\n      distance = ROUND_None(\r\n                   cvt_dist,\r\n                   CUR.tt_metrics.compensations[CUR.opcode & 3] );\r\n\r\n    /* minimum distance test */\r\n\r\n    if ( ( CUR.opcode & 8 ) != 0 )\r\n    {\r\n      if ( org_dist >= 0 )\r\n      {\r\n        if ( distance < minimum_distance )\r\n          distance = minimum_distance;\r\n      }\r\n      else\r\n      {\r\n        if ( distance > -minimum_distance )\r\n          distance = -minimum_distance;\r\n      }\r\n    }\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    B1 = CUR.zp1.cur[point].y;\r\n\r\n    /* Round moves if necessary */\r\n    if ( CUR.ignore_x_mode                                          &&\r\n         CUR.GS.freeVector.y != 0                                   &&\r\n         ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )\r\n      distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist;\r\n\r\n    if ( CUR.GS.freeVector.y != 0                               &&\r\n         ( CUR.opcode & 16 ) == 0                               &&\r\n         ( CUR.opcode & 8 ) == 0                                &&\r\n         ( CUR.sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) )\r\n      distance += 64;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    CUR_Func_move( &CUR.zp1, point, distance - cur_dist );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    B2 = CUR.zp1.cur[point].y;\r\n\r\n    /* Reverse move if necessary */\r\n    if ( CUR.ignore_x_mode )\r\n    {\r\n      if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES ) &&\r\n           CUR.GS.freeVector.y != 0                                  &&\r\n           B1 % 64 == 0                                              &&\r\n           B2 % 64 != 0                                              &&\r\n           !CUR.size->ttfautohinted                                  )\r\n        reverse_move = TRUE;\r\n\r\n      if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&\r\n           CUR.GS.freeVector.y != 0                                  &&\r\n           B2 % 64 != 0                                              &&\r\n           B1 % 64 != 0                                              )\r\n        reverse_move = TRUE;\r\n\r\n      if ( ( CUR.sph_tweak_flags &\r\n             SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES ) &&\r\n           !reverse_move                                &&\r\n           FT_ABS( B1 - B2 ) >= 64                      )\r\n        reverse_move = TRUE;\r\n    }\r\n\r\n    if ( reverse_move )\r\n      CUR_Func_move( &CUR.zp1, point, -( distance - cur_dist ) );\r\n\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n  Fail:\r\n    CUR.GS.rp1 = CUR.GS.rp0;\r\n\r\n    if ( ( CUR.opcode & 16 ) != 0 )\r\n      CUR.GS.rp0 = point;\r\n\r\n    CUR.GS.rp2 = point;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ALIGNRP[]:    ALIGN Relative Point                                    */\r\n  /* Opcode range: 0x3C                                                    */\r\n  /* Stack:        uint32 uint32... -->                                    */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ALIGNRP( INS_ARG )\r\n  {\r\n    FT_UShort   point;\r\n    FT_F26Dot6  distance;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode                                        &&\r\n         CUR.iup_called                                           &&\r\n         ( CUR.sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) )\r\n    {\r\n      CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    if ( CUR.top < CUR.GS.loop ||\r\n         BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    while ( CUR.GS.loop > 0 )\r\n    {\r\n      CUR.args--;\r\n\r\n      point = (FT_UShort)CUR.stack[CUR.args];\r\n\r\n      if ( BOUNDS( point, CUR.zp1.n_points ) )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n          return;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        distance = CUR_Func_project( CUR.zp1.cur + point,\r\n                                     CUR.zp0.cur + CUR.GS.rp0 );\r\n\r\n        CUR_Func_move( &CUR.zp1, point, -distance );\r\n      }\r\n\r\n      CUR.GS.loop--;\r\n    }\r\n\r\n  Fail:\r\n    CUR.GS.loop = 1;\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ISECT[]:      moves point to InterSECTion                             */\r\n  /* Opcode range: 0x0F                                                    */\r\n  /* Stack:        5 * uint32 -->                                          */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ISECT( INS_ARG )\r\n  {\r\n    FT_UShort   point,\r\n                a0, a1,\r\n                b0, b1;\r\n\r\n    FT_F26Dot6  discriminant, dotproduct;\r\n\r\n    FT_F26Dot6  dx,  dy,\r\n                dax, day,\r\n                dbx, dby;\r\n\r\n    FT_F26Dot6  val;\r\n\r\n    FT_Vector   R;\r\n\r\n\r\n    point = (FT_UShort)args[0];\r\n\r\n    a0 = (FT_UShort)args[1];\r\n    a1 = (FT_UShort)args[2];\r\n    b0 = (FT_UShort)args[3];\r\n    b1 = (FT_UShort)args[4];\r\n\r\n    if ( BOUNDS( b0, CUR.zp0.n_points )  ||\r\n         BOUNDS( b1, CUR.zp0.n_points )  ||\r\n         BOUNDS( a0, CUR.zp1.n_points )  ||\r\n         BOUNDS( a1, CUR.zp1.n_points )  ||\r\n         BOUNDS( point, CUR.zp2.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    /* Cramer's rule */\r\n\r\n    dbx = CUR.zp0.cur[b1].x - CUR.zp0.cur[b0].x;\r\n    dby = CUR.zp0.cur[b1].y - CUR.zp0.cur[b0].y;\r\n\r\n    dax = CUR.zp1.cur[a1].x - CUR.zp1.cur[a0].x;\r\n    day = CUR.zp1.cur[a1].y - CUR.zp1.cur[a0].y;\r\n\r\n    dx = CUR.zp0.cur[b0].x - CUR.zp1.cur[a0].x;\r\n    dy = CUR.zp0.cur[b0].y - CUR.zp1.cur[a0].y;\r\n\r\n    CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH;\r\n\r\n    discriminant = FT_MulDiv( dax, -dby, 0x40 ) +\r\n                   FT_MulDiv( day, dbx, 0x40 );\r\n    dotproduct   = FT_MulDiv( dax, dbx, 0x40 ) +\r\n                   FT_MulDiv( day, dby, 0x40 );\r\n\r\n    /* The discriminant above is actually a cross product of vectors     */\r\n    /* da and db. Together with the dot product, they can be used as     */\r\n    /* surrogates for sine and cosine of the angle between the vectors.  */\r\n    /* Indeed,                                                           */\r\n    /*       dotproduct   = |da||db|cos(angle)                           */\r\n    /*       discriminant = |da||db|sin(angle)     .                     */\r\n    /* We use these equations to reject grazing intersections by         */\r\n    /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */\r\n    if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) )\r\n    {\r\n      val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 );\r\n\r\n      R.x = FT_MulDiv( val, dax, discriminant );\r\n      R.y = FT_MulDiv( val, day, discriminant );\r\n\r\n      CUR.zp2.cur[point].x = CUR.zp1.cur[a0].x + R.x;\r\n      CUR.zp2.cur[point].y = CUR.zp1.cur[a0].y + R.y;\r\n    }\r\n    else\r\n    {\r\n      /* else, take the middle of the middles of A and B */\r\n\r\n      CUR.zp2.cur[point].x = ( CUR.zp1.cur[a0].x +\r\n                               CUR.zp1.cur[a1].x +\r\n                               CUR.zp0.cur[b0].x +\r\n                               CUR.zp0.cur[b1].x ) / 4;\r\n      CUR.zp2.cur[point].y = ( CUR.zp1.cur[a0].y +\r\n                               CUR.zp1.cur[a1].y +\r\n                               CUR.zp0.cur[b0].y +\r\n                               CUR.zp0.cur[b1].y ) / 4;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ALIGNPTS[]:   ALIGN PoinTS                                            */\r\n  /* Opcode range: 0x27                                                    */\r\n  /* Stack:        uint32 uint32 -->                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_ALIGNPTS( INS_ARG )\r\n  {\r\n    FT_UShort   p1, p2;\r\n    FT_F26Dot6  distance;\r\n\r\n\r\n    p1 = (FT_UShort)args[0];\r\n    p2 = (FT_UShort)args[1];\r\n\r\n    if ( BOUNDS( p1, CUR.zp1.n_points ) ||\r\n         BOUNDS( p2, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    distance = CUR_Func_project( CUR.zp0.cur + p2,\r\n                                 CUR.zp1.cur + p1 ) / 2;\r\n\r\n    CUR_Func_move( &CUR.zp1, p1, distance );\r\n    CUR_Func_move( &CUR.zp0, p2, -distance );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* IP[]:         Interpolate Point                                       */\r\n  /* Opcode range: 0x39                                                    */\r\n  /* Stack:        uint32... -->                                           */\r\n  /*                                                                       */\r\n\r\n  /* SOMETIMES, DUMBER CODE IS BETTER CODE */\r\n\r\n  static void\r\n  Ins_IP( INS_ARG )\r\n  {\r\n    FT_F26Dot6  old_range, cur_range;\r\n    FT_Vector*  orus_base;\r\n    FT_Vector*  cur_base;\r\n    FT_Int      twilight;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    if ( CUR.top < CUR.GS.loop )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    /*\r\n     * We need to deal in a special way with the twilight zone.\r\n     * Otherwise, by definition, the value of CUR.twilight.orus[n] is (0,0),\r\n     * for every n.\r\n     */\r\n    twilight = CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 || CUR.GS.gep2 == 0;\r\n\r\n    if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( twilight )\r\n      orus_base = &CUR.zp0.org[CUR.GS.rp1];\r\n    else\r\n      orus_base = &CUR.zp0.orus[CUR.GS.rp1];\r\n\r\n    cur_base = &CUR.zp0.cur[CUR.GS.rp1];\r\n\r\n    /* XXX: There are some glyphs in some braindead but popular */\r\n    /*      fonts out there (e.g. [aeu]grave in monotype.ttf)   */\r\n    /*      calling IP[] with bad values of rp[12].             */\r\n    /*      Do something sane when this odd thing happens.      */\r\n    if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) ||\r\n         BOUNDS( CUR.GS.rp2, CUR.zp1.n_points ) )\r\n    {\r\n      old_range = 0;\r\n      cur_range = 0;\r\n    }\r\n    else\r\n    {\r\n      if ( twilight )\r\n        old_range = CUR_Func_dualproj( &CUR.zp1.org[CUR.GS.rp2],\r\n                                       orus_base );\r\n      else if ( CUR.metrics.x_scale == CUR.metrics.y_scale )\r\n        old_range = CUR_Func_dualproj( &CUR.zp1.orus[CUR.GS.rp2],\r\n                                       orus_base );\r\n      else\r\n      {\r\n        FT_Vector  vec;\r\n\r\n\r\n        vec.x = FT_MulFix( CUR.zp1.orus[CUR.GS.rp2].x - orus_base->x,\r\n                           CUR.metrics.x_scale );\r\n        vec.y = FT_MulFix( CUR.zp1.orus[CUR.GS.rp2].y - orus_base->y,\r\n                           CUR.metrics.y_scale );\r\n\r\n        old_range = CUR_fast_dualproj( &vec );\r\n      }\r\n\r\n      cur_range = CUR_Func_project ( &CUR.zp1.cur[CUR.GS.rp2], cur_base );\r\n    }\r\n\r\n    for ( ; CUR.GS.loop > 0; --CUR.GS.loop )\r\n    {\r\n      FT_UInt     point = (FT_UInt)CUR.stack[--CUR.args];\r\n      FT_F26Dot6  org_dist, cur_dist, new_dist;\r\n\r\n\r\n      /* check point bounds */\r\n      if ( BOUNDS( point, CUR.zp2.n_points ) )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n          return;\r\n        }\r\n        continue;\r\n      }\r\n\r\n      if ( twilight )\r\n        org_dist = CUR_Func_dualproj( &CUR.zp2.org[point], orus_base );\r\n      else if ( CUR.metrics.x_scale == CUR.metrics.y_scale )\r\n        org_dist = CUR_Func_dualproj( &CUR.zp2.orus[point], orus_base );\r\n      else\r\n      {\r\n        FT_Vector  vec;\r\n\r\n\r\n        vec.x = FT_MulFix( CUR.zp2.orus[point].x - orus_base->x,\r\n                           CUR.metrics.x_scale );\r\n        vec.y = FT_MulFix( CUR.zp2.orus[point].y - orus_base->y,\r\n                           CUR.metrics.y_scale );\r\n\r\n        org_dist = CUR_fast_dualproj( &vec );\r\n      }\r\n\r\n      cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );\r\n\r\n      if ( org_dist )\r\n        new_dist = ( old_range != 0 )\r\n                     ? FT_MulDiv( org_dist, cur_range, old_range )\r\n                     : cur_dist;\r\n      else\r\n        new_dist = 0;\r\n\r\n      CUR_Func_move( &CUR.zp2, (FT_UShort)point, new_dist - cur_dist );\r\n    }\r\n\r\n  Fail:\r\n    CUR.GS.loop = 1;\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* UTP[a]:       UnTouch Point                                           */\r\n  /* Opcode range: 0x29                                                    */\r\n  /* Stack:        uint32 -->                                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_UTP( INS_ARG )\r\n  {\r\n    FT_UShort  point;\r\n    FT_Byte    mask;\r\n\r\n\r\n    point = (FT_UShort)args[0];\r\n\r\n    if ( BOUNDS( point, CUR.zp0.n_points ) )\r\n    {\r\n      if ( CUR.pedantic_hinting )\r\n        CUR.error = TT_Err_Invalid_Reference;\r\n      return;\r\n    }\r\n\r\n    mask = 0xFF;\r\n\r\n    if ( CUR.GS.freeVector.x != 0 )\r\n      mask &= ~FT_CURVE_TAG_TOUCH_X;\r\n\r\n    if ( CUR.GS.freeVector.y != 0 )\r\n      mask &= ~FT_CURVE_TAG_TOUCH_Y;\r\n\r\n    CUR.zp0.tags[point] &= mask;\r\n  }\r\n\r\n\r\n  /* Local variables for Ins_IUP: */\r\n  typedef struct  IUP_WorkerRec_\r\n  {\r\n    FT_Vector*  orgs;   /* original and current coordinate */\r\n    FT_Vector*  curs;   /* arrays                          */\r\n    FT_Vector*  orus;\r\n    FT_UInt     max_points;\r\n\r\n  } IUP_WorkerRec, *IUP_Worker;\r\n\r\n\r\n  static void\r\n  _iup_worker_shift( IUP_Worker  worker,\r\n                     FT_UInt     p1,\r\n                     FT_UInt     p2,\r\n                     FT_UInt     p )\r\n  {\r\n    FT_UInt     i;\r\n    FT_F26Dot6  dx;\r\n\r\n\r\n    dx = worker->curs[p].x - worker->orgs[p].x;\r\n    if ( dx != 0 )\r\n    {\r\n      for ( i = p1; i < p; i++ )\r\n        worker->curs[i].x += dx;\r\n\r\n      for ( i = p + 1; i <= p2; i++ )\r\n        worker->curs[i].x += dx;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  _iup_worker_interpolate( IUP_Worker  worker,\r\n                           FT_UInt     p1,\r\n                           FT_UInt     p2,\r\n                           FT_UInt     ref1,\r\n                           FT_UInt     ref2 )\r\n  {\r\n    FT_UInt     i;\r\n    FT_F26Dot6  orus1, orus2, org1, org2, delta1, delta2;\r\n\r\n\r\n    if ( p1 > p2 )\r\n      return;\r\n\r\n    if ( BOUNDS( ref1, worker->max_points ) ||\r\n         BOUNDS( ref2, worker->max_points ) )\r\n      return;\r\n\r\n    orus1 = worker->orus[ref1].x;\r\n    orus2 = worker->orus[ref2].x;\r\n\r\n    if ( orus1 > orus2 )\r\n    {\r\n      FT_F26Dot6  tmp_o;\r\n      FT_UInt     tmp_r;\r\n\r\n\r\n      tmp_o = orus1;\r\n      orus1 = orus2;\r\n      orus2 = tmp_o;\r\n\r\n      tmp_r = ref1;\r\n      ref1  = ref2;\r\n      ref2  = tmp_r;\r\n    }\r\n\r\n    org1   = worker->orgs[ref1].x;\r\n    org2   = worker->orgs[ref2].x;\r\n    delta1 = worker->curs[ref1].x - org1;\r\n    delta2 = worker->curs[ref2].x - org2;\r\n\r\n    if ( orus1 == orus2 )\r\n    {\r\n      /* simple shift of untouched points */\r\n      for ( i = p1; i <= p2; i++ )\r\n      {\r\n        FT_F26Dot6  x = worker->orgs[i].x;\r\n\r\n\r\n        if ( x <= org1 )\r\n          x += delta1;\r\n        else\r\n          x += delta2;\r\n\r\n        worker->curs[i].x = x;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      FT_Fixed  scale       = 0;\r\n      FT_Bool   scale_valid = 0;\r\n\r\n\r\n      /* interpolation */\r\n      for ( i = p1; i <= p2; i++ )\r\n      {\r\n        FT_F26Dot6  x = worker->orgs[i].x;\r\n\r\n\r\n        if ( x <= org1 )\r\n          x += delta1;\r\n\r\n        else if ( x >= org2 )\r\n          x += delta2;\r\n\r\n        else\r\n        {\r\n          if ( !scale_valid )\r\n          {\r\n            scale_valid = 1;\r\n            scale       = FT_DivFix( org2 + delta2 - ( org1 + delta1 ),\r\n                                     orus2 - orus1 );\r\n          }\r\n\r\n          x = ( org1 + delta1 ) +\r\n              FT_MulFix( worker->orus[i].x - orus1, scale );\r\n        }\r\n        worker->curs[i].x = x;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* IUP[a]:       Interpolate Untouched Points                            */\r\n  /* Opcode range: 0x30-0x31                                               */\r\n  /* Stack:        -->                                                     */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_IUP( INS_ARG )\r\n  {\r\n    IUP_WorkerRec  V;\r\n    FT_Byte        mask;\r\n\r\n    FT_UInt   first_point;   /* first point of contour        */\r\n    FT_UInt   end_point;     /* end point (last+1) of contour */\r\n\r\n    FT_UInt   first_touched; /* first touched point in contour   */\r\n    FT_UInt   cur_touched;   /* current touched point in contour */\r\n\r\n    FT_UInt   point;         /* current point   */\r\n    FT_Short  contour;       /* current contour */\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    /* ignore empty outlines */\r\n    if ( CUR.pts.n_contours == 0 )\r\n      return;\r\n\r\n    if ( CUR.opcode & 1 )\r\n    {\r\n      mask   = FT_CURVE_TAG_TOUCH_X;\r\n      V.orgs = CUR.pts.org;\r\n      V.curs = CUR.pts.cur;\r\n      V.orus = CUR.pts.orus;\r\n    }\r\n    else\r\n    {\r\n      mask   = FT_CURVE_TAG_TOUCH_Y;\r\n      V.orgs = (FT_Vector*)( (FT_Pos*)CUR.pts.org + 1 );\r\n      V.curs = (FT_Vector*)( (FT_Pos*)CUR.pts.cur + 1 );\r\n      V.orus = (FT_Vector*)( (FT_Pos*)CUR.pts.orus + 1 );\r\n    }\r\n    V.max_points = CUR.pts.n_points;\r\n\r\n    contour = 0;\r\n    point   = 0;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode )\r\n    {\r\n      CUR.iup_called = 1;\r\n      if ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_IUP )\r\n        return;\r\n    }\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    do\r\n    {\r\n      end_point   = CUR.pts.contours[contour] - CUR.pts.first_point;\r\n      first_point = point;\r\n\r\n      if ( BOUNDS ( end_point, CUR.pts.n_points ) )\r\n        end_point = CUR.pts.n_points - 1;\r\n\r\n      while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 )\r\n        point++;\r\n\r\n      if ( point <= end_point )\r\n      {\r\n        first_touched = point;\r\n        cur_touched   = point;\r\n\r\n        point++;\r\n\r\n        while ( point <= end_point )\r\n        {\r\n          if ( ( CUR.pts.tags[point] & mask ) != 0 )\r\n          {\r\n            _iup_worker_interpolate( &V,\r\n                                     cur_touched + 1,\r\n                                     point - 1,\r\n                                     cur_touched,\r\n                                     point );\r\n            cur_touched = point;\r\n          }\r\n\r\n          point++;\r\n        }\r\n\r\n        if ( cur_touched == first_touched )\r\n          _iup_worker_shift( &V, first_point, end_point, cur_touched );\r\n        else\r\n        {\r\n          _iup_worker_interpolate( &V,\r\n                                   (FT_UShort)( cur_touched + 1 ),\r\n                                   end_point,\r\n                                   cur_touched,\r\n                                   first_touched );\r\n\r\n          if ( first_touched > 0 )\r\n            _iup_worker_interpolate( &V,\r\n                                     first_point,\r\n                                     first_touched - 1,\r\n                                     cur_touched,\r\n                                     first_touched );\r\n        }\r\n      }\r\n      contour++;\r\n    } while ( contour < CUR.pts.n_contours );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DELTAPn[]:    DELTA exceptions P1, P2, P3                             */\r\n  /* Opcode range: 0x5D,0x71,0x72                                          */\r\n  /* Stack:        uint32 (2 * uint32)... -->                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_DELTAP( INS_ARG )\r\n  {\r\n    FT_ULong   k, nump;\r\n    FT_UShort  A;\r\n    FT_ULong   C;\r\n    FT_Long    B;\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    FT_UShort  B1, B2;\r\n#endif\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    /* Delta hinting is covered by US Patent 5159668. */\r\n    if ( CUR.face->unpatented_hinting )\r\n    {\r\n      FT_Long  n = args[0] * 2;\r\n\r\n\r\n      if ( CUR.args < n )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n          CUR.error = TT_Err_Too_Few_Arguments;\r\n        n = CUR.args;\r\n      }\r\n\r\n      CUR.args -= n;\r\n      CUR.new_top = CUR.args;\r\n      return;\r\n    }\r\n#endif\r\n\r\n    nump = (FT_ULong)args[0];   /* some points theoretically may occur more\r\n                                   than once, thus UShort isn't enough */\r\n\r\n    for ( k = 1; k <= nump; k++ )\r\n    {\r\n      if ( CUR.args < 2 )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n          CUR.error = TT_Err_Too_Few_Arguments;\r\n        CUR.args = 0;\r\n        goto Fail;\r\n      }\r\n\r\n      CUR.args -= 2;\r\n\r\n      A = (FT_UShort)CUR.stack[CUR.args + 1];\r\n      B = CUR.stack[CUR.args];\r\n\r\n      /* XXX: Because some popular fonts contain some invalid DeltaP */\r\n      /*      instructions, we simply ignore them when the stacked   */\r\n      /*      point reference is off limit, rather than returning an */\r\n      /*      error.  As a delta instruction doesn't change a glyph  */\r\n      /*      in great ways, this shouldn't be a problem.            */\r\n\r\n      if ( !BOUNDS( A, CUR.zp0.n_points ) )\r\n      {\r\n        C = ( (FT_ULong)B & 0xF0 ) >> 4;\r\n\r\n        switch ( CUR.opcode )\r\n        {\r\n        case 0x5D:\r\n          break;\r\n\r\n        case 0x71:\r\n          C += 16;\r\n          break;\r\n\r\n        case 0x72:\r\n          C += 32;\r\n          break;\r\n        }\r\n\r\n        C += CUR.GS.delta_base;\r\n\r\n        if ( CURRENT_Ppem() == (FT_Long)C )\r\n        {\r\n          B = ( (FT_ULong)B & 0xF ) - 8;\r\n          if ( B >= 0 )\r\n            B++;\r\n          B = B * 64 / ( 1L << CUR.GS.delta_shift );\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n          /*\r\n           *  Allow delta move if\r\n           *\r\n           *  - not using ignore_x_mode rendering\r\n           *  - glyph is specifically set to allow it\r\n           *  - glyph is composite and freedom vector is not subpixel vector\r\n           */\r\n          if ( !CUR.ignore_x_mode                                   ||\r\n               ( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) ||\r\n               ( CUR.is_composite && CUR.GS.freeVector.y != 0 )     )\r\n            CUR_Func_move( &CUR.zp0, A, B );\r\n\r\n          /* Otherwise apply subpixel hinting and compatibility mode rules */\r\n          else if ( CUR.ignore_x_mode )\r\n          {\r\n            if ( CUR.GS.freeVector.y != 0 )\r\n              B1 = CUR.zp0.cur[A].y;\r\n            else\r\n              B1 = CUR.zp0.cur[A].x;\r\n\r\n            /* Standard Subpixel Hinting:  Allow y move */\r\n            if ( !CUR.compatibility_mode && CUR.GS.freeVector.y != 0 )\r\n              CUR_Func_move( &CUR.zp0, A, B );\r\n\r\n            /* Compatibility Mode: Allow x or y move if point touched in\r\n                Y direction */\r\n            else if ( CUR.compatibility_mode                                  &&\r\n                      !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) )\r\n            {\r\n              /* save the y value of the point now; compare after move */\r\n              B1 = CUR.zp0.cur[A].y;\r\n\r\n              if ( ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )\r\n                B = FT_PIX_ROUND( B1 + B ) - B1;\r\n\r\n              /*\r\n              *  Allow delta move if using compatibility_mode, IUP has not\r\n              *  been called, and point is touched on Y.\r\n              */\r\n              if ( !CUR.iup_called                            &&\r\n                   ( CUR.zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) )\r\n                CUR_Func_move( &CUR.zp0, A, B );\r\n            }\r\n\r\n            B2 = CUR.zp0.cur[A].y;\r\n\r\n            /* Reverse this move if it results in a disallowed move */\r\n            if ( CUR.GS.freeVector.y != 0                     &&\r\n                 ( ( ( CUR.sph_tweak_flags &\r\n                        SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES ) &&\r\n                        B1 % 64 == 0                      &&\r\n                        B2 % 64 != 0                      &&\r\n                        !CUR.size->ttfautohinted          ) ||\r\n                   ( ( CUR.sph_tweak_flags &\r\n                        SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&\r\n                        B1 % 64 != 0                      &&\r\n                        B2 % 64 != 0                      ) ) )\r\n              CUR_Func_move( &CUR.zp0, A, -B );\r\n          }\r\n#else\r\n          CUR_Func_move( &CUR.zp0, A, B );\r\n#endif /* *TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n        }\r\n      }\r\n      else\r\n        if ( CUR.pedantic_hinting )\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n    }\r\n\r\n  Fail:\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DELTACn[]:    DELTA exceptions C1, C2, C3                             */\r\n  /* Opcode range: 0x73,0x74,0x75                                          */\r\n  /* Stack:        uint32 (2 * uint32)... -->                              */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_DELTAC( INS_ARG )\r\n  {\r\n    FT_ULong  nump, k;\r\n    FT_ULong  A, C;\r\n    FT_Long   B;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    /* Delta hinting is covered by US Patent 5159668. */\r\n    if ( CUR.face->unpatented_hinting )\r\n    {\r\n      FT_Long  n = args[0] * 2;\r\n\r\n\r\n      if ( CUR.args < n )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n          CUR.error = TT_Err_Too_Few_Arguments;\r\n        n = CUR.args;\r\n      }\r\n\r\n      CUR.args -= n;\r\n      CUR.new_top = CUR.args;\r\n      return;\r\n    }\r\n#endif\r\n\r\n    nump = (FT_ULong)args[0];\r\n\r\n    for ( k = 1; k <= nump; k++ )\r\n    {\r\n      if ( CUR.args < 2 )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n          CUR.error = TT_Err_Too_Few_Arguments;\r\n        CUR.args = 0;\r\n        goto Fail;\r\n      }\r\n\r\n      CUR.args -= 2;\r\n\r\n      A = (FT_ULong)CUR.stack[CUR.args + 1];\r\n      B = CUR.stack[CUR.args];\r\n\r\n      if ( BOUNDSL( A, CUR.cvtSize ) )\r\n      {\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Invalid_Reference;\r\n          return;\r\n        }\r\n      }\r\n      else\r\n      {\r\n        C = ( (FT_ULong)B & 0xF0 ) >> 4;\r\n\r\n        switch ( CUR.opcode )\r\n        {\r\n        case 0x73:\r\n          break;\r\n\r\n        case 0x74:\r\n          C += 16;\r\n          break;\r\n\r\n        case 0x75:\r\n          C += 32;\r\n          break;\r\n        }\r\n\r\n        C += CUR.GS.delta_base;\r\n\r\n        if ( CURRENT_Ppem() == (FT_Long)C )\r\n        {\r\n          B = ( (FT_ULong)B & 0xF ) - 8;\r\n          if ( B >= 0 )\r\n            B++;\r\n          B = B * 64 / ( 1L << CUR.GS.delta_shift );\r\n\r\n          CUR_Func_move_cvt( A, B );\r\n        }\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    CUR.new_top = CUR.args;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* MISC. INSTRUCTIONS                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* GETINFO[]:    GET INFOrmation                                         */\r\n  /* Opcode range: 0x88                                                    */\r\n  /* Stack:        uint32 --> uint32                                       */\r\n  /*                                                                       */\r\n  static void\r\n  Ins_GETINFO( INS_ARG )\r\n  {\r\n    FT_Long  K;\r\n\r\n\r\n    K = 0;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    /********************************/\r\n    /* RASTERIZER VERSION           */\r\n    /* Selector Bit:  0             */\r\n    /* Return Bit(s): 0-7           */\r\n    /*                              */\r\n    if ( ( args[0] & 1 ) != 0 && CUR.ignore_x_mode )\r\n    {\r\n      K = CUR.rasterizer_version;\r\n#ifdef SPH_DEBUG_MORE_VERBOSE\r\n      printf(\" SETTING AS %d\\n\", CUR.rasterizer_version );\r\n#endif\r\n    }\r\n    else\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n      if ( ( args[0] & 1 ) != 0 )\r\n        K = 35;\r\n\r\n    /********************************/\r\n    /* GLYPH ROTATED                */\r\n    /* Selector Bit:  1             */\r\n    /* Return Bit(s): 8             */\r\n    /*                              */\r\n    if ( ( args[0] & 2 ) != 0 && CUR.tt_metrics.rotated )\r\n      K |= 0x80;\r\n\r\n    /********************************/\r\n    /* GLYPH STRETCHED              */\r\n    /* Selector Bit:  2             */\r\n    /* Return Bit(s): 9             */\r\n    /*                              */\r\n    if ( ( args[0] & 4 ) != 0 && CUR.tt_metrics.stretched )\r\n      K |= 1 << 8;\r\n\r\n    /********************************/\r\n    /* HINTING FOR GRAYSCALE        */\r\n    /* Selector Bit:  5             */\r\n    /* Return Bit(s): 12            */\r\n    /*                              */\r\n    if ( ( args[0] & 32 ) != 0 && CUR.grayscale )\r\n      K |= 1 << 12;\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode && CUR.rasterizer_version >= 35 )\r\n    {\r\n      /********************************/\r\n      /* HINTING FOR GRAYSCALE        */\r\n      /* Selector Bit:  5             */\r\n      /* Return Bit(s): 12            */\r\n      /*                              */\r\n      if ( ( args[0] & 32 ) != 0 && CUR.grayscale_hinting )\r\n        K |= 1 << 12;\r\n\r\n      /********************************/\r\n      /* HINTING FOR SUBPIXEL         */\r\n      /* Selector Bit:  6             */\r\n      /* Return Bit(s): 13            */\r\n      /*                              */\r\n      if ( ( args[0] & 64 ) != 0        &&\r\n           CUR.subpixel_hinting         &&\r\n           CUR.rasterizer_version >= 37 )\r\n      {\r\n        K |= 1 << 13;\r\n\r\n        /* the stuff below is irrelevant if subpixel_hinting is not set */\r\n\r\n        /********************************/\r\n        /* COMPATIBLE WIDTHS ENABLED    */\r\n        /* Selector Bit:  7             */\r\n        /* Return Bit(s): 14            */\r\n        /*                              */\r\n        /* Functionality still needs to be added */\r\n        if ( ( args[0] & 128 ) != 0 && CUR.compatible_widths )\r\n          K |= 1 << 14;\r\n\r\n        /********************************/\r\n        /* SYMMETRICAL SMOOTHING        */\r\n        /* Selector Bit:  8             */\r\n        /* Return Bit(s): 15            */\r\n        /*                              */\r\n        /* Functionality still needs to be added */\r\n        if ( ( args[0] & 256 ) != 0 && CUR.symmetrical_smoothing )\r\n          K |= 1 << 15;\r\n\r\n        /********************************/\r\n        /* HINTING FOR BGR?             */\r\n        /* Selector Bit:  9             */\r\n        /* Return Bit(s): 16            */\r\n        /*                              */\r\n        /* Functionality still needs to be added */\r\n        if ( ( args[0] & 512 ) != 0 && CUR.bgr )\r\n          K |= 1 << 16;\r\n\r\n        if ( CUR.rasterizer_version >= 38 )\r\n        {\r\n          /********************************/\r\n          /* SUBPIXEL POSITIONED?         */\r\n          /* Selector Bit:  10            */\r\n          /* Return Bit(s): 17            */\r\n          /*                              */\r\n          /* Functionality still needs to be added */\r\n          if ( ( args[0] & 1024 ) != 0 && CUR.subpixel_positioned )\r\n            K |= 1 << 17;\r\n        }\r\n      }\r\n    }\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n    args[0] = K;\r\n  }\r\n\r\n\r\n  static void\r\n  Ins_UNKNOWN( INS_ARG )\r\n  {\r\n    TT_DefRecord*  def   = CUR.IDefs;\r\n    TT_DefRecord*  limit = def + CUR.numIDefs;\r\n\r\n    FT_UNUSED_ARG;\r\n\r\n\r\n    for ( ; def < limit; def++ )\r\n    {\r\n      if ( (FT_Byte)def->opc == CUR.opcode && def->active )\r\n      {\r\n        TT_CallRec*  call;\r\n\r\n\r\n        if ( CUR.callTop >= CUR.callSize )\r\n        {\r\n          CUR.error = TT_Err_Stack_Overflow;\r\n          return;\r\n        }\r\n\r\n        call = CUR.callStack + CUR.callTop++;\r\n\r\n        call->Caller_Range = CUR.curRange;\r\n        call->Caller_IP    = CUR.IP + 1;\r\n        call->Cur_Count    = 1;\r\n        call->Cur_Restart  = def->start;\r\n        call->Cur_End      = def->end;\r\n\r\n        INS_Goto_CodeRange( def->range, def->start );\r\n\r\n        CUR.step_ins = FALSE;\r\n        return;\r\n      }\r\n    }\r\n\r\n    CUR.error = TT_Err_Invalid_Opcode;\r\n  }\r\n\r\n\r\n#ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH\r\n\r\n\r\n  static\r\n  TInstruction_Function  Instruct_Dispatch[256] =\r\n  {\r\n    /* Opcodes are gathered in groups of 16. */\r\n    /* Please keep the spaces as they are.   */\r\n\r\n    /*  SVTCA  y  */  Ins_SVTCA,\r\n    /*  SVTCA  x  */  Ins_SVTCA,\r\n    /*  SPvTCA y  */  Ins_SPVTCA,\r\n    /*  SPvTCA x  */  Ins_SPVTCA,\r\n    /*  SFvTCA y  */  Ins_SFVTCA,\r\n    /*  SFvTCA x  */  Ins_SFVTCA,\r\n    /*  SPvTL //  */  Ins_SPVTL,\r\n    /*  SPvTL +   */  Ins_SPVTL,\r\n    /*  SFvTL //  */  Ins_SFVTL,\r\n    /*  SFvTL +   */  Ins_SFVTL,\r\n    /*  SPvFS     */  Ins_SPVFS,\r\n    /*  SFvFS     */  Ins_SFVFS,\r\n    /*  GPV       */  Ins_GPV,\r\n    /*  GFV       */  Ins_GFV,\r\n    /*  SFvTPv    */  Ins_SFVTPV,\r\n    /*  ISECT     */  Ins_ISECT,\r\n\r\n    /*  SRP0      */  Ins_SRP0,\r\n    /*  SRP1      */  Ins_SRP1,\r\n    /*  SRP2      */  Ins_SRP2,\r\n    /*  SZP0      */  Ins_SZP0,\r\n    /*  SZP1      */  Ins_SZP1,\r\n    /*  SZP2      */  Ins_SZP2,\r\n    /*  SZPS      */  Ins_SZPS,\r\n    /*  SLOOP     */  Ins_SLOOP,\r\n    /*  RTG       */  Ins_RTG,\r\n    /*  RTHG      */  Ins_RTHG,\r\n    /*  SMD       */  Ins_SMD,\r\n    /*  ELSE      */  Ins_ELSE,\r\n    /*  JMPR      */  Ins_JMPR,\r\n    /*  SCvTCi    */  Ins_SCVTCI,\r\n    /*  SSwCi     */  Ins_SSWCI,\r\n    /*  SSW       */  Ins_SSW,\r\n\r\n    /*  DUP       */  Ins_DUP,\r\n    /*  POP       */  Ins_POP,\r\n    /*  CLEAR     */  Ins_CLEAR,\r\n    /*  SWAP      */  Ins_SWAP,\r\n    /*  DEPTH     */  Ins_DEPTH,\r\n    /*  CINDEX    */  Ins_CINDEX,\r\n    /*  MINDEX    */  Ins_MINDEX,\r\n    /*  AlignPTS  */  Ins_ALIGNPTS,\r\n    /*  INS_0x28  */  Ins_UNKNOWN,\r\n    /*  UTP       */  Ins_UTP,\r\n    /*  LOOPCALL  */  Ins_LOOPCALL,\r\n    /*  CALL      */  Ins_CALL,\r\n    /*  FDEF      */  Ins_FDEF,\r\n    /*  ENDF      */  Ins_ENDF,\r\n    /*  MDAP[0]   */  Ins_MDAP,\r\n    /*  MDAP[1]   */  Ins_MDAP,\r\n\r\n    /*  IUP[0]    */  Ins_IUP,\r\n    /*  IUP[1]    */  Ins_IUP,\r\n    /*  SHP[0]    */  Ins_SHP,\r\n    /*  SHP[1]    */  Ins_SHP,\r\n    /*  SHC[0]    */  Ins_SHC,\r\n    /*  SHC[1]    */  Ins_SHC,\r\n    /*  SHZ[0]    */  Ins_SHZ,\r\n    /*  SHZ[1]    */  Ins_SHZ,\r\n    /*  SHPIX     */  Ins_SHPIX,\r\n    /*  IP        */  Ins_IP,\r\n    /*  MSIRP[0]  */  Ins_MSIRP,\r\n    /*  MSIRP[1]  */  Ins_MSIRP,\r\n    /*  AlignRP   */  Ins_ALIGNRP,\r\n    /*  RTDG      */  Ins_RTDG,\r\n    /*  MIAP[0]   */  Ins_MIAP,\r\n    /*  MIAP[1]   */  Ins_MIAP,\r\n\r\n    /*  NPushB    */  Ins_NPUSHB,\r\n    /*  NPushW    */  Ins_NPUSHW,\r\n    /*  WS        */  Ins_WS,\r\n    /*  RS        */  Ins_RS,\r\n    /*  WCvtP     */  Ins_WCVTP,\r\n    /*  RCvt      */  Ins_RCVT,\r\n    /*  GC[0]     */  Ins_GC,\r\n    /*  GC[1]     */  Ins_GC,\r\n    /*  SCFS      */  Ins_SCFS,\r\n    /*  MD[0]     */  Ins_MD,\r\n    /*  MD[1]     */  Ins_MD,\r\n    /*  MPPEM     */  Ins_MPPEM,\r\n    /*  MPS       */  Ins_MPS,\r\n    /*  FlipON    */  Ins_FLIPON,\r\n    /*  FlipOFF   */  Ins_FLIPOFF,\r\n    /*  DEBUG     */  Ins_DEBUG,\r\n\r\n    /*  LT        */  Ins_LT,\r\n    /*  LTEQ      */  Ins_LTEQ,\r\n    /*  GT        */  Ins_GT,\r\n    /*  GTEQ      */  Ins_GTEQ,\r\n    /*  EQ        */  Ins_EQ,\r\n    /*  NEQ       */  Ins_NEQ,\r\n    /*  ODD       */  Ins_ODD,\r\n    /*  EVEN      */  Ins_EVEN,\r\n    /*  IF        */  Ins_IF,\r\n    /*  EIF       */  Ins_EIF,\r\n    /*  AND       */  Ins_AND,\r\n    /*  OR        */  Ins_OR,\r\n    /*  NOT       */  Ins_NOT,\r\n    /*  DeltaP1   */  Ins_DELTAP,\r\n    /*  SDB       */  Ins_SDB,\r\n    /*  SDS       */  Ins_SDS,\r\n\r\n    /*  ADD       */  Ins_ADD,\r\n    /*  SUB       */  Ins_SUB,\r\n    /*  DIV       */  Ins_DIV,\r\n    /*  MUL       */  Ins_MUL,\r\n    /*  ABS       */  Ins_ABS,\r\n    /*  NEG       */  Ins_NEG,\r\n    /*  FLOOR     */  Ins_FLOOR,\r\n    /*  CEILING   */  Ins_CEILING,\r\n    /*  ROUND[0]  */  Ins_ROUND,\r\n    /*  ROUND[1]  */  Ins_ROUND,\r\n    /*  ROUND[2]  */  Ins_ROUND,\r\n    /*  ROUND[3]  */  Ins_ROUND,\r\n    /*  NROUND[0] */  Ins_NROUND,\r\n    /*  NROUND[1] */  Ins_NROUND,\r\n    /*  NROUND[2] */  Ins_NROUND,\r\n    /*  NROUND[3] */  Ins_NROUND,\r\n\r\n    /*  WCvtF     */  Ins_WCVTF,\r\n    /*  DeltaP2   */  Ins_DELTAP,\r\n    /*  DeltaP3   */  Ins_DELTAP,\r\n    /*  DeltaCn[0] */ Ins_DELTAC,\r\n    /*  DeltaCn[1] */ Ins_DELTAC,\r\n    /*  DeltaCn[2] */ Ins_DELTAC,\r\n    /*  SROUND    */  Ins_SROUND,\r\n    /*  S45Round  */  Ins_S45ROUND,\r\n    /*  JROT      */  Ins_JROT,\r\n    /*  JROF      */  Ins_JROF,\r\n    /*  ROFF      */  Ins_ROFF,\r\n    /*  INS_0x7B  */  Ins_UNKNOWN,\r\n    /*  RUTG      */  Ins_RUTG,\r\n    /*  RDTG      */  Ins_RDTG,\r\n    /*  SANGW     */  Ins_SANGW,\r\n    /*  AA        */  Ins_AA,\r\n\r\n    /*  FlipPT    */  Ins_FLIPPT,\r\n    /*  FlipRgON  */  Ins_FLIPRGON,\r\n    /*  FlipRgOFF */  Ins_FLIPRGOFF,\r\n    /*  INS_0x83  */  Ins_UNKNOWN,\r\n    /*  INS_0x84  */  Ins_UNKNOWN,\r\n    /*  ScanCTRL  */  Ins_SCANCTRL,\r\n    /*  SDPVTL[0] */  Ins_SDPVTL,\r\n    /*  SDPVTL[1] */  Ins_SDPVTL,\r\n    /*  GetINFO   */  Ins_GETINFO,\r\n    /*  IDEF      */  Ins_IDEF,\r\n    /*  ROLL      */  Ins_ROLL,\r\n    /*  MAX       */  Ins_MAX,\r\n    /*  MIN       */  Ins_MIN,\r\n    /*  ScanTYPE  */  Ins_SCANTYPE,\r\n    /*  InstCTRL  */  Ins_INSTCTRL,\r\n    /*  INS_0x8F  */  Ins_UNKNOWN,\r\n\r\n    /*  INS_0x90  */   Ins_UNKNOWN,\r\n    /*  INS_0x91  */   Ins_UNKNOWN,\r\n    /*  INS_0x92  */   Ins_UNKNOWN,\r\n    /*  INS_0x93  */   Ins_UNKNOWN,\r\n    /*  INS_0x94  */   Ins_UNKNOWN,\r\n    /*  INS_0x95  */   Ins_UNKNOWN,\r\n    /*  INS_0x96  */   Ins_UNKNOWN,\r\n    /*  INS_0x97  */   Ins_UNKNOWN,\r\n    /*  INS_0x98  */   Ins_UNKNOWN,\r\n    /*  INS_0x99  */   Ins_UNKNOWN,\r\n    /*  INS_0x9A  */   Ins_UNKNOWN,\r\n    /*  INS_0x9B  */   Ins_UNKNOWN,\r\n    /*  INS_0x9C  */   Ins_UNKNOWN,\r\n    /*  INS_0x9D  */   Ins_UNKNOWN,\r\n    /*  INS_0x9E  */   Ins_UNKNOWN,\r\n    /*  INS_0x9F  */   Ins_UNKNOWN,\r\n\r\n    /*  INS_0xA0  */   Ins_UNKNOWN,\r\n    /*  INS_0xA1  */   Ins_UNKNOWN,\r\n    /*  INS_0xA2  */   Ins_UNKNOWN,\r\n    /*  INS_0xA3  */   Ins_UNKNOWN,\r\n    /*  INS_0xA4  */   Ins_UNKNOWN,\r\n    /*  INS_0xA5  */   Ins_UNKNOWN,\r\n    /*  INS_0xA6  */   Ins_UNKNOWN,\r\n    /*  INS_0xA7  */   Ins_UNKNOWN,\r\n    /*  INS_0xA8  */   Ins_UNKNOWN,\r\n    /*  INS_0xA9  */   Ins_UNKNOWN,\r\n    /*  INS_0xAA  */   Ins_UNKNOWN,\r\n    /*  INS_0xAB  */   Ins_UNKNOWN,\r\n    /*  INS_0xAC  */   Ins_UNKNOWN,\r\n    /*  INS_0xAD  */   Ins_UNKNOWN,\r\n    /*  INS_0xAE  */   Ins_UNKNOWN,\r\n    /*  INS_0xAF  */   Ins_UNKNOWN,\r\n\r\n    /*  PushB[0]  */  Ins_PUSHB,\r\n    /*  PushB[1]  */  Ins_PUSHB,\r\n    /*  PushB[2]  */  Ins_PUSHB,\r\n    /*  PushB[3]  */  Ins_PUSHB,\r\n    /*  PushB[4]  */  Ins_PUSHB,\r\n    /*  PushB[5]  */  Ins_PUSHB,\r\n    /*  PushB[6]  */  Ins_PUSHB,\r\n    /*  PushB[7]  */  Ins_PUSHB,\r\n    /*  PushW[0]  */  Ins_PUSHW,\r\n    /*  PushW[1]  */  Ins_PUSHW,\r\n    /*  PushW[2]  */  Ins_PUSHW,\r\n    /*  PushW[3]  */  Ins_PUSHW,\r\n    /*  PushW[4]  */  Ins_PUSHW,\r\n    /*  PushW[5]  */  Ins_PUSHW,\r\n    /*  PushW[6]  */  Ins_PUSHW,\r\n    /*  PushW[7]  */  Ins_PUSHW,\r\n\r\n    /*  MDRP[00]  */  Ins_MDRP,\r\n    /*  MDRP[01]  */  Ins_MDRP,\r\n    /*  MDRP[02]  */  Ins_MDRP,\r\n    /*  MDRP[03]  */  Ins_MDRP,\r\n    /*  MDRP[04]  */  Ins_MDRP,\r\n    /*  MDRP[05]  */  Ins_MDRP,\r\n    /*  MDRP[06]  */  Ins_MDRP,\r\n    /*  MDRP[07]  */  Ins_MDRP,\r\n    /*  MDRP[08]  */  Ins_MDRP,\r\n    /*  MDRP[09]  */  Ins_MDRP,\r\n    /*  MDRP[10]  */  Ins_MDRP,\r\n    /*  MDRP[11]  */  Ins_MDRP,\r\n    /*  MDRP[12]  */  Ins_MDRP,\r\n    /*  MDRP[13]  */  Ins_MDRP,\r\n    /*  MDRP[14]  */  Ins_MDRP,\r\n    /*  MDRP[15]  */  Ins_MDRP,\r\n\r\n    /*  MDRP[16]  */  Ins_MDRP,\r\n    /*  MDRP[17]  */  Ins_MDRP,\r\n    /*  MDRP[18]  */  Ins_MDRP,\r\n    /*  MDRP[19]  */  Ins_MDRP,\r\n    /*  MDRP[20]  */  Ins_MDRP,\r\n    /*  MDRP[21]  */  Ins_MDRP,\r\n    /*  MDRP[22]  */  Ins_MDRP,\r\n    /*  MDRP[23]  */  Ins_MDRP,\r\n    /*  MDRP[24]  */  Ins_MDRP,\r\n    /*  MDRP[25]  */  Ins_MDRP,\r\n    /*  MDRP[26]  */  Ins_MDRP,\r\n    /*  MDRP[27]  */  Ins_MDRP,\r\n    /*  MDRP[28]  */  Ins_MDRP,\r\n    /*  MDRP[29]  */  Ins_MDRP,\r\n    /*  MDRP[30]  */  Ins_MDRP,\r\n    /*  MDRP[31]  */  Ins_MDRP,\r\n\r\n    /*  MIRP[00]  */  Ins_MIRP,\r\n    /*  MIRP[01]  */  Ins_MIRP,\r\n    /*  MIRP[02]  */  Ins_MIRP,\r\n    /*  MIRP[03]  */  Ins_MIRP,\r\n    /*  MIRP[04]  */  Ins_MIRP,\r\n    /*  MIRP[05]  */  Ins_MIRP,\r\n    /*  MIRP[06]  */  Ins_MIRP,\r\n    /*  MIRP[07]  */  Ins_MIRP,\r\n    /*  MIRP[08]  */  Ins_MIRP,\r\n    /*  MIRP[09]  */  Ins_MIRP,\r\n    /*  MIRP[10]  */  Ins_MIRP,\r\n    /*  MIRP[11]  */  Ins_MIRP,\r\n    /*  MIRP[12]  */  Ins_MIRP,\r\n    /*  MIRP[13]  */  Ins_MIRP,\r\n    /*  MIRP[14]  */  Ins_MIRP,\r\n    /*  MIRP[15]  */  Ins_MIRP,\r\n\r\n    /*  MIRP[16]  */  Ins_MIRP,\r\n    /*  MIRP[17]  */  Ins_MIRP,\r\n    /*  MIRP[18]  */  Ins_MIRP,\r\n    /*  MIRP[19]  */  Ins_MIRP,\r\n    /*  MIRP[20]  */  Ins_MIRP,\r\n    /*  MIRP[21]  */  Ins_MIRP,\r\n    /*  MIRP[22]  */  Ins_MIRP,\r\n    /*  MIRP[23]  */  Ins_MIRP,\r\n    /*  MIRP[24]  */  Ins_MIRP,\r\n    /*  MIRP[25]  */  Ins_MIRP,\r\n    /*  MIRP[26]  */  Ins_MIRP,\r\n    /*  MIRP[27]  */  Ins_MIRP,\r\n    /*  MIRP[28]  */  Ins_MIRP,\r\n    /*  MIRP[29]  */  Ins_MIRP,\r\n    /*  MIRP[30]  */  Ins_MIRP,\r\n    /*  MIRP[31]  */  Ins_MIRP\r\n  };\r\n\r\n\r\n#endif /* !TT_CONFIG_OPTION_INTERPRETER_SWITCH */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* RUN                                                                   */\r\n  /*                                                                       */\r\n  /*  This function executes a run of opcodes.  It will exit in the        */\r\n  /*  following cases:                                                     */\r\n  /*                                                                       */\r\n  /*  - Errors (in which case it returns FALSE).                           */\r\n  /*                                                                       */\r\n  /*  - Reaching the end of the main code range (returns TRUE).            */\r\n  /*    Reaching the end of a code range within a function call is an      */\r\n  /*    error.                                                             */\r\n  /*                                                                       */\r\n  /*  - After executing one single opcode, if the flag `Instruction_Trap'  */\r\n  /*    is set to TRUE (returns TRUE).                                     */\r\n  /*                                                                       */\r\n  /*  On exit with TRUE, test IP < CodeSize to know whether it comes from  */\r\n  /*  an instruction trap or a normal termination.                         */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*  Note: The documented DEBUG opcode pops a value from the stack.  This */\r\n  /*        behaviour is unsupported; here a DEBUG opcode is always an     */\r\n  /*        error.                                                         */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* THIS IS THE INTERPRETER'S MAIN LOOP.                                  */\r\n  /*                                                                       */\r\n  /*  Instructions appear in the specification's order.                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* documentation is in ttinterp.h */\r\n\r\n  FT_EXPORT_DEF( FT_Error )\r\n  TT_RunIns( TT_ExecContext  exc )\r\n  {\r\n    FT_Long  ins_counter = 0;  /* executed instructions counter */\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_STATIC_RASTER\r\n    cur = *exc;\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    if ( CUR.ignore_x_mode )\r\n      CUR.iup_called        = FALSE;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n    /* set CVT functions */\r\n    CUR.tt_metrics.ratio = 0;\r\n    if ( CUR.metrics.x_ppem != CUR.metrics.y_ppem )\r\n    {\r\n      /* non-square pixels, use the stretched routines */\r\n      CUR.func_read_cvt  = Read_CVT_Stretched;\r\n      CUR.func_write_cvt = Write_CVT_Stretched;\r\n      CUR.func_move_cvt  = Move_CVT_Stretched;\r\n    }\r\n    else\r\n    {\r\n      /* square pixels, use normal routines */\r\n      CUR.func_read_cvt  = Read_CVT;\r\n      CUR.func_write_cvt = Write_CVT;\r\n      CUR.func_move_cvt  = Move_CVT;\r\n    }\r\n\r\n    COMPUTE_Funcs();\r\n    COMPUTE_Round( (FT_Byte)exc->GS.round_state );\r\n\r\n    do\r\n    {\r\n      CUR.opcode = CUR.code[CUR.IP];\r\n\r\n      FT_TRACE7(( \"  \" ));\r\n      FT_TRACE7(( opcode_name[CUR.opcode] ));\r\n      FT_TRACE7(( \"\\n\" ));\r\n\r\n      if ( ( CUR.length = opcode_length[CUR.opcode] ) < 0 )\r\n      {\r\n        if ( CUR.IP + 1 >= CUR.codeSize )\r\n          goto LErrorCodeOverflow_;\r\n\r\n        CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1];\r\n      }\r\n\r\n      if ( CUR.IP + CUR.length > CUR.codeSize )\r\n        goto LErrorCodeOverflow_;\r\n\r\n      /* First, let's check for empty stack and overflow */\r\n      CUR.args = CUR.top - ( Pop_Push_Count[CUR.opcode] >> 4 );\r\n\r\n      /* `args' is the top of the stack once arguments have been popped. */\r\n      /* One can also interpret it as the index of the last argument.    */\r\n      if ( CUR.args < 0 )\r\n      {\r\n        FT_UShort  i;\r\n\r\n\r\n        if ( CUR.pedantic_hinting )\r\n        {\r\n          CUR.error = TT_Err_Too_Few_Arguments;\r\n          goto LErrorLabel_;\r\n        }\r\n\r\n        /* push zeroes onto the stack */\r\n        for ( i = 0; i < Pop_Push_Count[CUR.opcode] >> 4; i++ )\r\n          CUR.stack[i] = 0;\r\n        CUR.args = 0;\r\n      }\r\n\r\n      CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 );\r\n\r\n      /* `new_top' is the new top of the stack, after the instruction's */\r\n      /* execution.  `top' will be set to `new_top' after the `switch'  */\r\n      /* statement.                                                     */\r\n      if ( CUR.new_top > CUR.stackSize )\r\n      {\r\n        CUR.error = TT_Err_Stack_Overflow;\r\n        goto LErrorLabel_;\r\n      }\r\n\r\n      CUR.step_ins = TRUE;\r\n      CUR.error    = TT_Err_Ok;\r\n\r\n#ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH\r\n\r\n      {\r\n        FT_Long*  args   = CUR.stack + CUR.args;\r\n        FT_Byte   opcode = CUR.opcode;\r\n\r\n\r\n#undef  ARRAY_BOUND_ERROR\r\n#define ARRAY_BOUND_ERROR  goto Set_Invalid_Ref\r\n\r\n\r\n        switch ( opcode )\r\n        {\r\n        case 0x00:  /* SVTCA y  */\r\n        case 0x01:  /* SVTCA x  */\r\n        case 0x02:  /* SPvTCA y */\r\n        case 0x03:  /* SPvTCA x */\r\n        case 0x04:  /* SFvTCA y */\r\n        case 0x05:  /* SFvTCA x */\r\n          {\r\n            FT_Short  AA, BB;\r\n\r\n\r\n            AA = (FT_Short)( ( opcode & 1 ) << 14 );\r\n            BB = (FT_Short)( AA ^ 0x4000 );\r\n\r\n            if ( opcode < 4 )\r\n            {\r\n              CUR.GS.projVector.x = AA;\r\n              CUR.GS.projVector.y = BB;\r\n\r\n              CUR.GS.dualVector.x = AA;\r\n              CUR.GS.dualVector.y = BB;\r\n            }\r\n            else\r\n            {\r\n              GUESS_VECTOR( projVector );\r\n            }\r\n\r\n            if ( ( opcode & 2 ) == 0 )\r\n            {\r\n              CUR.GS.freeVector.x = AA;\r\n              CUR.GS.freeVector.y = BB;\r\n            }\r\n            else\r\n            {\r\n              GUESS_VECTOR( freeVector );\r\n            }\r\n\r\n            COMPUTE_Funcs();\r\n          }\r\n          break;\r\n\r\n        case 0x06:  /* SPvTL // */\r\n        case 0x07:  /* SPvTL +  */\r\n          DO_SPVTL\r\n          break;\r\n\r\n        case 0x08:  /* SFvTL // */\r\n        case 0x09:  /* SFvTL +  */\r\n          DO_SFVTL\r\n          break;\r\n\r\n        case 0x0A:  /* SPvFS */\r\n          DO_SPVFS\r\n          break;\r\n\r\n        case 0x0B:  /* SFvFS */\r\n          DO_SFVFS\r\n          break;\r\n\r\n        case 0x0C:  /* GPV */\r\n          DO_GPV\r\n          break;\r\n\r\n        case 0x0D:  /* GFV */\r\n          DO_GFV\r\n          break;\r\n\r\n        case 0x0E:  /* SFvTPv */\r\n          DO_SFVTPV\r\n          break;\r\n\r\n        case 0x0F:  /* ISECT  */\r\n          Ins_ISECT( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x10:  /* SRP0 */\r\n          DO_SRP0\r\n          break;\r\n\r\n        case 0x11:  /* SRP1 */\r\n          DO_SRP1\r\n          break;\r\n\r\n        case 0x12:  /* SRP2 */\r\n          DO_SRP2\r\n          break;\r\n\r\n        case 0x13:  /* SZP0 */\r\n          Ins_SZP0( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x14:  /* SZP1 */\r\n          Ins_SZP1( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x15:  /* SZP2 */\r\n          Ins_SZP2( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x16:  /* SZPS */\r\n          Ins_SZPS( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x17:  /* SLOOP */\r\n          DO_SLOOP\r\n          break;\r\n\r\n        case 0x18:  /* RTG */\r\n          DO_RTG\r\n          break;\r\n\r\n        case 0x19:  /* RTHG */\r\n          DO_RTHG\r\n          break;\r\n\r\n        case 0x1A:  /* SMD */\r\n          DO_SMD\r\n          break;\r\n\r\n        case 0x1B:  /* ELSE */\r\n          Ins_ELSE( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x1C:  /* JMPR */\r\n          DO_JMPR\r\n          break;\r\n\r\n        case 0x1D:  /* SCVTCI */\r\n          DO_SCVTCI\r\n          break;\r\n\r\n        case 0x1E:  /* SSWCI */\r\n          DO_SSWCI\r\n          break;\r\n\r\n        case 0x1F:  /* SSW */\r\n          DO_SSW\r\n          break;\r\n\r\n        case 0x20:  /* DUP */\r\n          DO_DUP\r\n          break;\r\n\r\n        case 0x21:  /* POP */\r\n          /* nothing :-) */\r\n          break;\r\n\r\n        case 0x22:  /* CLEAR */\r\n          DO_CLEAR\r\n          break;\r\n\r\n        case 0x23:  /* SWAP */\r\n          DO_SWAP\r\n          break;\r\n\r\n        case 0x24:  /* DEPTH */\r\n          DO_DEPTH\r\n          break;\r\n\r\n        case 0x25:  /* CINDEX */\r\n          DO_CINDEX\r\n          break;\r\n\r\n        case 0x26:  /* MINDEX */\r\n          Ins_MINDEX( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x27:  /* ALIGNPTS */\r\n          Ins_ALIGNPTS( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x28:  /* ???? */\r\n          Ins_UNKNOWN( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x29:  /* UTP */\r\n          Ins_UTP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x2A:  /* LOOPCALL */\r\n          Ins_LOOPCALL( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x2B:  /* CALL */\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n          if ( !CUR.ignore_x_mode                                         ||\r\n               !CUR.iup_called                                            ||\r\n               ( CUR.iup_called                                         &&\r\n                 !( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n            Ins_CALL( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x2C:  /* FDEF */\r\n          Ins_FDEF( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x2D:  /* ENDF */\r\n          Ins_ENDF( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x2E:  /* MDAP */\r\n        case 0x2F:  /* MDAP */\r\n          Ins_MDAP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x30:  /* IUP */\r\n        case 0x31:  /* IUP */\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n          if ( CUR.ignore_x_mode )\r\n            CUR.iup_called = TRUE;\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n            Ins_IUP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x32:  /* SHP */\r\n        case 0x33:  /* SHP */\r\n          Ins_SHP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x34:  /* SHC */\r\n        case 0x35:  /* SHC */\r\n          Ins_SHC( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x36:  /* SHZ */\r\n        case 0x37:  /* SHZ */\r\n          Ins_SHZ( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x38:  /* SHPIX */\r\n          Ins_SHPIX( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x39:  /* IP    */\r\n          Ins_IP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x3A:  /* MSIRP */\r\n        case 0x3B:  /* MSIRP */\r\n          Ins_MSIRP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x3C:  /* AlignRP */\r\n          Ins_ALIGNRP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x3D:  /* RTDG */\r\n          DO_RTDG\r\n          break;\r\n\r\n        case 0x3E:  /* MIAP */\r\n        case 0x3F:  /* MIAP */\r\n          Ins_MIAP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x40:  /* NPUSHB */\r\n          Ins_NPUSHB( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x41:  /* NPUSHW */\r\n          Ins_NPUSHW( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x42:  /* WS */\r\n          DO_WS\r\n          break;\r\n\r\n      Set_Invalid_Ref:\r\n            CUR.error = TT_Err_Invalid_Reference;\r\n          break;\r\n\r\n        case 0x43:  /* RS */\r\n          DO_RS\r\n          break;\r\n\r\n        case 0x44:  /* WCVTP */\r\n          DO_WCVTP\r\n          break;\r\n\r\n        case 0x45:  /* RCVT */\r\n          DO_RCVT\r\n          break;\r\n\r\n        case 0x46:  /* GC */\r\n        case 0x47:  /* GC */\r\n          Ins_GC( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x48:  /* SCFS */\r\n          Ins_SCFS( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x49:  /* MD */\r\n        case 0x4A:  /* MD */\r\n          Ins_MD( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x4B:  /* MPPEM */\r\n          DO_MPPEM\r\n          break;\r\n\r\n        case 0x4C:  /* MPS */\r\n          DO_MPS\r\n          break;\r\n\r\n        case 0x4D:  /* FLIPON */\r\n          DO_FLIPON\r\n          break;\r\n\r\n        case 0x4E:  /* FLIPOFF */\r\n          DO_FLIPOFF\r\n          break;\r\n\r\n        case 0x4F:  /* DEBUG */\r\n          DO_DEBUG\r\n          break;\r\n\r\n        case 0x50:  /* LT */\r\n          DO_LT\r\n          break;\r\n\r\n        case 0x51:  /* LTEQ */\r\n          DO_LTEQ\r\n          break;\r\n\r\n        case 0x52:  /* GT */\r\n          DO_GT\r\n          break;\r\n\r\n        case 0x53:  /* GTEQ */\r\n          DO_GTEQ\r\n          break;\r\n\r\n        case 0x54:  /* EQ */\r\n          DO_EQ\r\n          break;\r\n\r\n        case 0x55:  /* NEQ */\r\n          DO_NEQ\r\n          break;\r\n\r\n        case 0x56:  /* ODD */\r\n          DO_ODD\r\n          break;\r\n\r\n        case 0x57:  /* EVEN */\r\n          DO_EVEN\r\n          break;\r\n\r\n        case 0x58:  /* IF */\r\n          Ins_IF( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x59:  /* EIF */\r\n          /* do nothing */\r\n          break;\r\n\r\n        case 0x5A:  /* AND */\r\n          DO_AND\r\n          break;\r\n\r\n        case 0x5B:  /* OR */\r\n          DO_OR\r\n          break;\r\n\r\n        case 0x5C:  /* NOT */\r\n          DO_NOT\r\n          break;\r\n\r\n        case 0x5D:  /* DELTAP1 */\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n          if ( !CUR.ignore_x_mode                                           ||\r\n               !CUR.iup_called                                              ||\r\n               ( CUR.iup_called                                           &&\r\n                 !( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) )\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n            Ins_DELTAP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x5E:  /* SDB */\r\n          DO_SDB\r\n          break;\r\n\r\n        case 0x5F:  /* SDS */\r\n          DO_SDS\r\n          break;\r\n\r\n        case 0x60:  /* ADD */\r\n          DO_ADD\r\n          break;\r\n\r\n        case 0x61:  /* SUB */\r\n          DO_SUB\r\n          break;\r\n\r\n        case 0x62:  /* DIV */\r\n          DO_DIV\r\n          break;\r\n\r\n        case 0x63:  /* MUL */\r\n          DO_MUL\r\n          break;\r\n\r\n        case 0x64:  /* ABS */\r\n          DO_ABS\r\n          break;\r\n\r\n        case 0x65:  /* NEG */\r\n          DO_NEG\r\n          break;\r\n\r\n        case 0x66:  /* FLOOR */\r\n          DO_FLOOR\r\n          break;\r\n\r\n        case 0x67:  /* CEILING */\r\n          DO_CEILING\r\n          break;\r\n\r\n        case 0x68:  /* ROUND */\r\n        case 0x69:  /* ROUND */\r\n        case 0x6A:  /* ROUND */\r\n        case 0x6B:  /* ROUND */\r\n          DO_ROUND\r\n          break;\r\n\r\n        case 0x6C:  /* NROUND */\r\n        case 0x6D:  /* NROUND */\r\n        case 0x6E:  /* NRRUND */\r\n        case 0x6F:  /* NROUND */\r\n          DO_NROUND\r\n          break;\r\n\r\n        case 0x70:  /* WCVTF */\r\n          DO_WCVTF\r\n          break;\r\n\r\n        case 0x71:  /* DELTAP2 */\r\n        case 0x72:  /* DELTAP3 */\r\n          Ins_DELTAP( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x73:  /* DELTAC0 */\r\n        case 0x74:  /* DELTAC1 */\r\n        case 0x75:  /* DELTAC2 */\r\n          Ins_DELTAC( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x76:  /* SROUND */\r\n          DO_SROUND\r\n          break;\r\n\r\n        case 0x77:  /* S45Round */\r\n          DO_S45ROUND\r\n          break;\r\n\r\n        case 0x78:  /* JROT */\r\n          DO_JROT\r\n          break;\r\n\r\n        case 0x79:  /* JROF */\r\n          DO_JROF\r\n          break;\r\n\r\n        case 0x7A:  /* ROFF */\r\n          DO_ROFF\r\n          break;\r\n\r\n        case 0x7B:  /* ???? */\r\n          Ins_UNKNOWN( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x7C:  /* RUTG */\r\n          DO_RUTG\r\n          break;\r\n\r\n        case 0x7D:  /* RDTG */\r\n          DO_RDTG\r\n          break;\r\n\r\n        case 0x7E:  /* SANGW */\r\n        case 0x7F:  /* AA    */\r\n          /* nothing - obsolete */\r\n          break;\r\n\r\n        case 0x80:  /* FLIPPT */\r\n          Ins_FLIPPT( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x81:  /* FLIPRGON */\r\n          Ins_FLIPRGON( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x82:  /* FLIPRGOFF */\r\n          Ins_FLIPRGOFF( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x83:  /* UNKNOWN */\r\n        case 0x84:  /* UNKNOWN */\r\n          Ins_UNKNOWN( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x85:  /* SCANCTRL */\r\n          Ins_SCANCTRL( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x86:  /* SDPVTL */\r\n        case 0x87:  /* SDPVTL */\r\n          Ins_SDPVTL( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x88:  /* GETINFO */\r\n          Ins_GETINFO( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x89:  /* IDEF */\r\n          Ins_IDEF( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x8A:  /* ROLL */\r\n          Ins_ROLL( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x8B:  /* MAX */\r\n          DO_MAX\r\n          break;\r\n\r\n        case 0x8C:  /* MIN */\r\n          DO_MIN\r\n          break;\r\n\r\n        case 0x8D:  /* SCANTYPE */\r\n          Ins_SCANTYPE( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x8E:  /* INSTCTRL */\r\n          Ins_INSTCTRL( EXEC_ARG_ args );\r\n          break;\r\n\r\n        case 0x8F:\r\n          Ins_UNKNOWN( EXEC_ARG_ args );\r\n          break;\r\n\r\n        default:\r\n          if ( opcode >= 0xE0 )\r\n            Ins_MIRP( EXEC_ARG_ args );\r\n          else if ( opcode >= 0xC0 )\r\n            Ins_MDRP( EXEC_ARG_ args );\r\n          else if ( opcode >= 0xB8 )\r\n            Ins_PUSHW( EXEC_ARG_ args );\r\n          else if ( opcode >= 0xB0 )\r\n            Ins_PUSHB( EXEC_ARG_ args );\r\n          else\r\n            Ins_UNKNOWN( EXEC_ARG_ args );\r\n        }\r\n\r\n      }\r\n\r\n#else\r\n\r\n      Instruct_Dispatch[CUR.opcode]( EXEC_ARG_ &CUR.stack[CUR.args] );\r\n\r\n#endif /* TT_CONFIG_OPTION_INTERPRETER_SWITCH */\r\n\r\n      if ( CUR.error != TT_Err_Ok )\r\n      {\r\n        switch ( CUR.error )\r\n        {\r\n        case TT_Err_Invalid_Opcode: /* looking for redefined instructions */\r\n          {\r\n            TT_DefRecord*  def   = CUR.IDefs;\r\n            TT_DefRecord*  limit = def + CUR.numIDefs;\r\n\r\n\r\n            for ( ; def < limit; def++ )\r\n            {\r\n              if ( def->active && CUR.opcode == (FT_Byte)def->opc )\r\n              {\r\n                TT_CallRec*  callrec;\r\n\r\n\r\n                if ( CUR.callTop >= CUR.callSize )\r\n                {\r\n                  CUR.error = TT_Err_Invalid_Reference;\r\n                  goto LErrorLabel_;\r\n                }\r\n\r\n                callrec = &CUR.callStack[CUR.callTop];\r\n\r\n                callrec->Caller_Range = CUR.curRange;\r\n                callrec->Caller_IP    = CUR.IP + 1;\r\n                callrec->Cur_Count    = 1;\r\n                callrec->Cur_Restart  = def->start;\r\n                callrec->Cur_End      = def->end;\r\n\r\n                if ( INS_Goto_CodeRange( def->range, def->start ) == FAILURE )\r\n                  goto LErrorLabel_;\r\n\r\n                goto LSuiteLabel_;\r\n              }\r\n            }\r\n          }\r\n\r\n          CUR.error = TT_Err_Invalid_Opcode;\r\n          goto LErrorLabel_;\r\n\r\n#if 0\r\n          break;   /* Unreachable code warning suppression.             */\r\n                   /* Leave to remind in case a later change the editor */\r\n                   /* to consider break;                                */\r\n#endif\r\n\r\n        default:\r\n          goto LErrorLabel_;\r\n\r\n#if 0\r\n        break;\r\n#endif\r\n        }\r\n      }\r\n\r\n      CUR.top = CUR.new_top;\r\n\r\n      if ( CUR.step_ins )\r\n        CUR.IP += CUR.length;\r\n\r\n      /* increment instruction counter and check if we didn't */\r\n      /* run this program for too long (e.g. infinite loops). */\r\n      if ( ++ins_counter > MAX_RUNNABLE_OPCODES )\r\n        return TT_Err_Execution_Too_Long;\r\n\r\n    LSuiteLabel_:\r\n      if ( CUR.IP >= CUR.codeSize )\r\n      {\r\n        if ( CUR.callTop > 0 )\r\n        {\r\n          CUR.error = TT_Err_Code_Overflow;\r\n          goto LErrorLabel_;\r\n        }\r\n        else\r\n          goto LNo_Error_;\r\n      }\r\n    } while ( !CUR.instruction_trap );\r\n\r\n  LNo_Error_:\r\n\r\n#ifdef TT_CONFIG_OPTION_STATIC_RASTER\r\n    *exc = cur;\r\n#endif\r\n\r\n    return TT_Err_Ok;\r\n\r\n  LErrorCodeOverflow_:\r\n    CUR.error = TT_Err_Code_Overflow;\r\n\r\n  LErrorLabel_:\r\n\r\n#ifdef TT_CONFIG_OPTION_STATIC_RASTER\r\n    *exc = cur;\r\n#endif\r\n\r\n    /* If any errors have occurred, function tables may be broken. */\r\n    /* Force a re-execution of `prep' and `fpgm' tables if no      */\r\n    /* bytecode debugger is run.                                   */\r\n    if ( CUR.error && !CUR.instruction_trap )\r\n    {\r\n      FT_TRACE1(( \"  The interpreter returned error 0x%x\\n\", CUR.error ));\r\n      exc->size->cvt_ready      = FALSE;\r\n    }\r\n\r\n    return CUR.error;\r\n  }\r\n\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttinterp.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttinterp.h                                                             */\r\n/*                                                                         */\r\n/*    TrueType bytecode interpreter (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2007, 2010, 2012 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTINTERP_H__\r\n#define __TTINTERP_H__\r\n\r\n#include <ft2build.h>\r\n#include \"ttobjs.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */\r\n\r\n#define EXEC_OP_   TT_ExecContext  exc,\r\n#define EXEC_OP    TT_ExecContext  exc\r\n#define EXEC_ARG_  exc,\r\n#define EXEC_ARG   exc\r\n\r\n#else                                       /* static implementation */\r\n\r\n#define EXEC_OP_   /* void */\r\n#define EXEC_OP    /* void */\r\n#define EXEC_ARG_  /* void */\r\n#define EXEC_ARG   /* void */\r\n\r\n#endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Rounding mode constants.                                              */\r\n  /*                                                                       */\r\n#define TT_Round_Off             5\r\n#define TT_Round_To_Half_Grid    0\r\n#define TT_Round_To_Grid         1\r\n#define TT_Round_To_Double_Grid  2\r\n#define TT_Round_Up_To_Grid      4\r\n#define TT_Round_Down_To_Grid    3\r\n#define TT_Round_Super           6\r\n#define TT_Round_Super_45        7\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Function types used by the interpreter, depending on various modes    */\r\n  /* (e.g. the rounding mode, whether to render a vertical or horizontal   */\r\n  /* line etc).                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /* Rounding function */\r\n  typedef FT_F26Dot6\r\n  (*TT_Round_Func)( EXEC_OP_ FT_F26Dot6  distance,\r\n                             FT_F26Dot6  compensation );\r\n\r\n  /* Point displacement along the freedom vector routine */\r\n  typedef void\r\n  (*TT_Move_Func)( EXEC_OP_ TT_GlyphZone  zone,\r\n                            FT_UShort     point,\r\n                            FT_F26Dot6    distance );\r\n\r\n  /* Distance projection along one of the projection vectors */\r\n  typedef FT_F26Dot6\r\n  (*TT_Project_Func)( EXEC_OP_ FT_Pos   dx,\r\n                               FT_Pos   dy );\r\n\r\n  /* reading a cvt value.  Take care of non-square pixels if necessary */\r\n  typedef FT_F26Dot6\r\n  (*TT_Get_CVT_Func)( EXEC_OP_ FT_ULong  idx );\r\n\r\n  /* setting or moving a cvt value.  Take care of non-square pixels  */\r\n  /* if necessary                                                    */\r\n  typedef void\r\n  (*TT_Set_CVT_Func)( EXEC_OP_ FT_ULong    idx,\r\n                               FT_F26Dot6  value );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This structure defines a call record, used to manage function calls.  */\r\n  /*                                                                       */\r\n  typedef struct  TT_CallRec_\r\n  {\r\n    FT_Int   Caller_Range;\r\n    FT_Long  Caller_IP;\r\n    FT_Long  Cur_Count;\r\n    FT_Long  Cur_Restart;\r\n    FT_Long  Cur_End;\r\n\r\n  } TT_CallRec, *TT_CallStack;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* These structures define rules used to tweak subpixel hinting for      */\r\n  /* various fonts.  \"\", 0, \"\", NULL value indicates to match any value.   */\r\n  /*                                                                       */\r\n\r\n#define MAX_NAME_SIZE      32\r\n#define MAX_CLASS_MEMBERS  100\r\n\r\n  typedef struct  SPH_TweakRule_\r\n  {\r\n    const char      family[MAX_NAME_SIZE];\r\n    const FT_UInt   ppem;\r\n    const char      style[MAX_NAME_SIZE];\r\n    const FT_ULong  glyph;\r\n\r\n  } SPH_TweakRule;\r\n\r\n\r\n  typedef struct  SPH_ScaleRule_\r\n  {\r\n    const char      family[MAX_NAME_SIZE];\r\n    const FT_UInt   ppem;\r\n    const char      style[MAX_NAME_SIZE];\r\n    const FT_ULong  glyph;\r\n    const FT_ULong  scale;\r\n\r\n  } SPH_ScaleRule;\r\n\r\n\r\n  typedef struct  Font_Class_\r\n  {\r\n    const char  name[MAX_NAME_SIZE];\r\n    const char  member[MAX_CLASS_MEMBERS][MAX_NAME_SIZE];\r\n\r\n  } Font_Class;\r\n\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The main structure for the interpreter which collects all necessary   */\r\n  /* variables and states.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_ExecContextRec_\r\n  {\r\n    TT_Face            face;\r\n    TT_Size            size;\r\n    FT_Memory          memory;\r\n\r\n    /* instructions state */\r\n\r\n    FT_Error           error;      /* last execution error */\r\n\r\n    FT_Long            top;        /* top of exec. stack   */\r\n\r\n    FT_UInt            stackSize;  /* size of exec. stack  */\r\n    FT_Long*           stack;      /* current exec. stack  */\r\n\r\n    FT_Long            args;\r\n    FT_UInt            new_top;    /* new top after exec.  */\r\n\r\n    TT_GlyphZoneRec    zp0,        /* zone records */\r\n                       zp1,\r\n                       zp2,\r\n                       pts,\r\n                       twilight;\r\n\r\n    FT_Size_Metrics    metrics;\r\n    TT_Size_Metrics    tt_metrics; /* size metrics */\r\n\r\n    TT_GraphicsState   GS;         /* current graphics state */\r\n\r\n    FT_Int             curRange;  /* current code range number   */\r\n    FT_Byte*           code;      /* current code range          */\r\n    FT_Long            IP;        /* current instruction pointer */\r\n    FT_Long            codeSize;  /* size of current range       */\r\n\r\n    FT_Byte            opcode;    /* current opcode              */\r\n    FT_Int             length;    /* length of current opcode    */\r\n\r\n    FT_Bool            step_ins;  /* true if the interpreter must */\r\n                                  /* increment IP after ins. exec */\r\n    FT_ULong           cvtSize;\r\n    FT_Long*           cvt;\r\n\r\n    FT_UInt            glyphSize; /* glyph instructions buffer size */\r\n    FT_Byte*           glyphIns;  /* glyph instructions buffer */\r\n\r\n    FT_UInt            numFDefs;  /* number of function defs         */\r\n    FT_UInt            maxFDefs;  /* maximum number of function defs */\r\n    TT_DefArray        FDefs;     /* table of FDefs entries          */\r\n\r\n    FT_UInt            numIDefs;  /* number of instruction defs */\r\n    FT_UInt            maxIDefs;  /* maximum number of ins defs */\r\n    TT_DefArray        IDefs;     /* table of IDefs entries     */\r\n\r\n    FT_UInt            maxFunc;   /* maximum function index     */\r\n    FT_UInt            maxIns;    /* maximum instruction index  */\r\n\r\n    FT_Int             callTop,    /* top of call stack during execution */\r\n                       callSize;   /* size of call stack */\r\n    TT_CallStack       callStack;  /* call stack */\r\n\r\n    FT_UShort          maxPoints;    /* capacity of this context's `pts' */\r\n    FT_Short           maxContours;  /* record, expressed in points and  */\r\n                                     /* contours.                        */\r\n\r\n    TT_CodeRangeTable  codeRangeTable;  /* table of valid code ranges */\r\n                                        /* useful for the debugger   */\r\n\r\n    FT_UShort          storeSize;  /* size of current storage */\r\n    FT_Long*           storage;    /* storage area            */\r\n\r\n    FT_F26Dot6         period;     /* values used for the */\r\n    FT_F26Dot6         phase;      /* `SuperRounding'     */\r\n    FT_F26Dot6         threshold;\r\n\r\n#if 0\r\n    /* this seems to be unused */\r\n    FT_Int             cur_ppem;   /* ppem along the current proj vector */\r\n#endif\r\n\r\n    FT_Bool            instruction_trap; /* If `True', the interpreter will */\r\n                                         /* exit after each instruction     */\r\n\r\n    TT_GraphicsState   default_GS;       /* graphics state resulting from   */\r\n                                         /* the prep program                */\r\n    FT_Bool            is_composite;     /* true if the glyph is composite  */\r\n    FT_Bool            pedantic_hinting; /* true if pedantic interpretation */\r\n\r\n    /* latest interpreter additions */\r\n\r\n    FT_Long            F_dot_P;    /* dot product of freedom and projection */\r\n                                   /* vectors                               */\r\n    TT_Round_Func      func_round; /* current rounding function             */\r\n\r\n    TT_Project_Func    func_project,   /* current projection function */\r\n                       func_dualproj,  /* current dual proj. function */\r\n                       func_freeProj;  /* current freedom proj. func  */\r\n\r\n    TT_Move_Func       func_move;      /* current point move function */\r\n    TT_Move_Func       func_move_orig; /* move original position function */\r\n\r\n    TT_Get_CVT_Func    func_read_cvt;  /* read a cvt entry              */\r\n    TT_Set_CVT_Func    func_write_cvt; /* write a cvt entry (in pixels) */\r\n    TT_Set_CVT_Func    func_move_cvt;  /* incr a cvt entry (in pixels)  */\r\n\r\n    FT_Bool            grayscale;      /* are we hinting for grayscale? */\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n    TT_Round_Func      func_round_sphn;   /* subpixel rounding function */\r\n\r\n    FT_Bool            grayscale_hinting; /* Using grayscale hinting?      */\r\n    FT_Bool            subpixel_hinting;  /* Using subpixel hinting?       */\r\n    FT_Bool            native_hinting;    /* Using native hinting?         */\r\n    FT_Bool            ignore_x_mode;     /* Standard rendering mode for   */\r\n                                          /* subpixel hinting.  On if gray */\r\n                                          /* or subpixel hinting is on )   */\r\n    FT_Bool            compatibility_mode;/* Additional exceptions to      */\r\n                                          /* native TT rules for legacy    */\r\n                                          /* fonts.  Implies               */\r\n                                          /* ignore_x_mode.                */\r\n\r\n    /* The following 4 aren't fully implemented but here for MS rasterizer */\r\n    /* compatibility.                                                      */\r\n    FT_Bool            compatible_widths;     /* compatible widths?        */\r\n    FT_Bool            symmetrical_smoothing; /* symmetrical_smoothing?    */\r\n    FT_Bool            bgr;                   /* bgr instead of rgb?       */\r\n    FT_Bool            subpixel_positioned;   /* subpixel positioned       */\r\n                                              /* (DirectWrite ClearType)?  */\r\n\r\n    FT_Int             rasterizer_version;    /* MS rasterizer version */\r\n\r\n    FT_Bool            iup_called;            /* IUP called for glyph?  */\r\n\r\n    FT_ULong           sph_tweak_flags;       /* flags to control */\r\n                                              /* hint tweaks      */\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n  } TT_ExecContextRec;\r\n\r\n\r\n  extern const TT_GraphicsState  tt_default_graphics_state;\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n  FT_LOCAL( FT_Error )\r\n  TT_Goto_CodeRange( TT_ExecContext  exec,\r\n                     FT_Int          range,\r\n                     FT_Long         IP );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Set_CodeRange( TT_ExecContext  exec,\r\n                    FT_Int          range,\r\n                    void*           base,\r\n                    FT_Long         length );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Clear_CodeRange( TT_ExecContext  exec,\r\n                      FT_Int          range );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  Update_Max( FT_Memory  memory,\r\n              FT_ULong*  size,\r\n              FT_Long    multiplier,\r\n              void*      _pbuff,\r\n              FT_ULong   new_max );\r\n#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_New_Context                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Queries the face context for a given font.  Note that there is     */\r\n  /*    now a _single_ execution context in the TrueType driver which is   */\r\n  /*    shared among faces.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face object.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A handle to the execution context.  Initialized for `face'.        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only the glyph loader and debugger should call this function.      */\r\n  /*                                                                       */\r\n  FT_EXPORT( TT_ExecContext )\r\n  TT_New_Context( TT_Driver  driver );\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n  FT_LOCAL( FT_Error )\r\n  TT_Done_Context( TT_ExecContext  exec );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Load_Context( TT_ExecContext  exec,\r\n                   TT_Face         face,\r\n                   TT_Size         size );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Save_Context( TT_ExecContext  exec,\r\n                   TT_Size         ins );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  TT_Run_Context( TT_ExecContext  exec,\r\n                  FT_Bool         debug );\r\n#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    TT_RunIns                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Executes one or more instruction in the execution context.  This   */\r\n  /*    is the main function of the TrueType opcode interpreter.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    exec :: A handle to the target execution context.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only the object manager and debugger should call this function.    */\r\n  /*                                                                       */\r\n  /*    This function is publicly exported because it is directly          */\r\n  /*    invoked by the TrueType debugger.                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  TT_RunIns( TT_ExecContext  exec );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTINTERP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttobjs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttobjs.c                                                               */\r\n/*                                                                         */\r\n/*    Objects manager (body).                                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012                                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_INTERNAL_SFNT_H\r\n\r\n#include \"ttgload.h\"\r\n#include \"ttpload.h\"\r\n\r\n#include \"tterrors.h\"\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n#include \"ttinterp.h\"\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#include FT_TRUETYPE_UNPATENTED_H\r\n#endif\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include \"ttgxvar.h\"\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttobjs\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                       GLYPH ZONE FUNCTIONS                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_glyphzone_done                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Deallocate a glyph zone.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    zone :: A pointer to the target glyph zone.                        */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_glyphzone_done( TT_GlyphZone  zone )\r\n  {\r\n    FT_Memory  memory = zone->memory;\r\n\r\n\r\n    if ( memory )\r\n    {\r\n      FT_FREE( zone->contours );\r\n      FT_FREE( zone->tags );\r\n      FT_FREE( zone->cur );\r\n      FT_FREE( zone->org );\r\n      FT_FREE( zone->orus );\r\n\r\n      zone->max_points   = zone->n_points   = 0;\r\n      zone->max_contours = zone->n_contours = 0;\r\n      zone->memory       = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_glyphzone_new                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Allocate a new glyph zone.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory      :: A handle to the current memory object.              */\r\n  /*                                                                       */\r\n  /*    maxPoints   :: The capacity of glyph zone in points.               */\r\n  /*                                                                       */\r\n  /*    maxContours :: The capacity of glyph zone in contours.             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    zone        :: A pointer to the target glyph zone record.          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_glyphzone_new( FT_Memory     memory,\r\n                    FT_UShort     maxPoints,\r\n                    FT_Short      maxContours,\r\n                    TT_GlyphZone  zone )\r\n  {\r\n    FT_Error  error;\r\n\r\n\r\n    FT_MEM_ZERO( zone, sizeof ( *zone ) );\r\n    zone->memory = memory;\r\n\r\n    if ( FT_NEW_ARRAY( zone->org,      maxPoints   ) ||\r\n         FT_NEW_ARRAY( zone->cur,      maxPoints   ) ||\r\n         FT_NEW_ARRAY( zone->orus,     maxPoints   ) ||\r\n         FT_NEW_ARRAY( zone->tags,     maxPoints   ) ||\r\n         FT_NEW_ARRAY( zone->contours, maxContours ) )\r\n    {\r\n      tt_glyphzone_done( zone );\r\n    }\r\n    else\r\n    {\r\n      zone->max_points   = maxPoints;\r\n      zone->max_contours = maxContours;\r\n    }\r\n\r\n    return error;\r\n  }\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /* Compare the face with a list of well-known `tricky' fonts. */\r\n  /* This list shall be expanded as we find more of them.       */\r\n\r\n  static FT_Bool\r\n  tt_check_trickyness_family( FT_String*  name )\r\n  {\r\n\r\n#define TRICK_NAMES_MAX_CHARACTERS  16\r\n#define TRICK_NAMES_COUNT            8\r\n\r\n    static const char trick_names[TRICK_NAMES_COUNT]\r\n                                 [TRICK_NAMES_MAX_CHARACTERS + 1] =\r\n    {\r\n      \"DFKaiSho-SB\",     /* dfkaisb.ttf */\r\n      \"DFKaiShu\",\r\n      \"DFKai-SB\",        /* kaiu.ttf */\r\n      \"HuaTianKaiTi?\",   /* htkt2.ttf */\r\n      \"HuaTianSongTi?\",  /* htst3.ttf */\r\n      \"MingLiU\",         /* mingliu.ttf & mingliu.ttc */\r\n      \"PMingLiU\",        /* mingliu.ttc */\r\n      \"MingLi43\",        /* mingli.ttf */\r\n    };\r\n\r\n    int  nn;\r\n\r\n\r\n    for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )\r\n      if ( ft_strstr( name, trick_names[nn] ) )\r\n        return TRUE;\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  /* XXX: This function should be in the `sfnt' module. */\r\n\r\n  /* Some PDF generators clear the checksums in the TrueType header table. */\r\n  /* For example, Quartz ContextPDF clears all entries, or Bullzip PDF     */\r\n  /* Printer clears the entries for subsetted subtables.  We thus have to  */\r\n  /* recalculate the checksums  where necessary.                           */\r\n\r\n  static FT_UInt32\r\n  tt_synth_sfnt_checksum( FT_Stream  stream,\r\n                          FT_ULong   length )\r\n  {\r\n    FT_Error   error;\r\n    FT_UInt32  checksum = 0;\r\n    int        i;\r\n\r\n\r\n    if ( FT_FRAME_ENTER( length ) )\r\n      return 0;\r\n\r\n    for ( ; length > 3; length -= 4 )\r\n      checksum += (FT_UInt32)FT_GET_ULONG();\r\n\r\n    for ( i = 3; length > 0; length --, i-- )\r\n      checksum += (FT_UInt32)( FT_GET_BYTE() << ( i * 8 ) );\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    return checksum;\r\n  }\r\n\r\n\r\n  /* XXX: This function should be in the `sfnt' module. */\r\n\r\n  static FT_ULong\r\n  tt_get_sfnt_checksum( TT_Face    face,\r\n                        FT_UShort  i )\r\n  {\r\n#if 0 /* if we believe the written value, use following part. */\r\n    if ( face->dir_tables[i].CheckSum )\r\n      return face->dir_tables[i].CheckSum;\r\n#endif\r\n\r\n    if ( !face->goto_table )\r\n      return 0;\r\n\r\n    if ( face->goto_table( face,\r\n                           face->dir_tables[i].Tag,\r\n                           face->root.stream,\r\n                           NULL ) )\r\n      return 0;\r\n\r\n    return (FT_ULong)tt_synth_sfnt_checksum( face->root.stream,\r\n                                             face->dir_tables[i].Length );\r\n  }\r\n\r\n\r\n  typedef struct tt_sfnt_id_rec_\r\n  {\r\n    FT_ULong  CheckSum;\r\n    FT_ULong  Length;\r\n\r\n  } tt_sfnt_id_rec;\r\n\r\n\r\n  static FT_Bool\r\n  tt_check_trickyness_sfnt_ids( TT_Face  face )\r\n  {\r\n#define TRICK_SFNT_IDS_PER_FACE   3\r\n#define TRICK_SFNT_IDS_NUM_FACES  17\r\n\r\n    static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]\r\n                                       [TRICK_SFNT_IDS_PER_FACE] = {\r\n\r\n#define TRICK_SFNT_ID_cvt   0\r\n#define TRICK_SFNT_ID_fpgm  1\r\n#define TRICK_SFNT_ID_prep  2\r\n\r\n      { /* MingLiU 1995 */\r\n        { 0x05bcf058, 0x000002e4 }, /* cvt  */\r\n        { 0x28233bf1, 0x000087c4 }, /* fpgm */\r\n        { 0xa344a1ea, 0x000001e1 }  /* prep */\r\n      },\r\n      { /* MingLiU 1996- */\r\n        { 0x05bcf058, 0x000002e4 }, /* cvt  */\r\n        { 0x28233bf1, 0x000087c4 }, /* fpgm */\r\n        { 0xa344a1eb, 0x000001e1 }  /* prep */\r\n      },\r\n      { /* DFKaiShu */\r\n        { 0x11e5ead4, 0x00000350 }, /* cvt  */\r\n        { 0x5a30ca3b, 0x00009063 }, /* fpgm */\r\n        { 0x13a42602, 0x0000007e }  /* prep */\r\n      },\r\n      { /* HuaTianKaiTi */\r\n        { 0xfffbfffc, 0x00000008 }, /* cvt  */\r\n        { 0x9c9e48b8, 0x0000bea2 }, /* fpgm */\r\n        { 0x70020112, 0x00000008 }  /* prep */\r\n      },\r\n      { /* HuaTianSongTi */\r\n        { 0xfffbfffc, 0x00000008 }, /* cvt  */\r\n        { 0x0a5a0483, 0x00017c39 }, /* fpgm */\r\n        { 0x70020112, 0x00000008 }  /* prep */\r\n      },\r\n      { /* NEC fadpop7.ttf */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x40c92555, 0x000000e5 }, /* fpgm */\r\n        { 0xa39b58e3, 0x0000117c }  /* prep */\r\n      },\r\n      { /* NEC fadrei5.ttf */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x33c41652, 0x000000e5 }, /* fpgm */\r\n        { 0x26d6c52a, 0x00000f6a }  /* prep */\r\n      },\r\n      { /* NEC fangot7.ttf */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x6db1651d, 0x0000019d }, /* fpgm */\r\n        { 0x6c6e4b03, 0x00002492 }  /* prep */\r\n      },\r\n      { /* NEC fangyo5.ttf */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x40c92555, 0x000000e5 }, /* fpgm */\r\n        { 0xde51fad0, 0x0000117c }  /* prep */\r\n      },\r\n      { /* NEC fankyo5.ttf */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x85e47664, 0x000000e5 }, /* fpgm */\r\n        { 0xa6c62831, 0x00001caa }  /* prep */\r\n      },\r\n      { /* NEC fanrgo5.ttf */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x2d891cfd, 0x0000019d }, /* fpgm */\r\n        { 0xa0604633, 0x00001de8 }  /* prep */\r\n      },\r\n      { /* NEC fangot5.ttc */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x40aa774c, 0x000001cb }, /* fpgm */\r\n        { 0x9b5caa96, 0x00001f9a }  /* prep */\r\n      },\r\n      { /* NEC fanmin3.ttc */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x0d3de9cb, 0x00000141 }, /* fpgm */\r\n        { 0xd4127766, 0x00002280 }  /* prep */\r\n      },\r\n      { /* NEC FA-Gothic, 1996 */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x4a692698, 0x000001f0 }, /* fpgm */\r\n        { 0x340d4346, 0x00001fca }  /* prep */\r\n      },\r\n      { /* NEC FA-Minchou, 1996 */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0xcd34c604, 0x00000166 }, /* fpgm */\r\n        { 0x6cf31046, 0x000022b0 }  /* prep */\r\n      },\r\n      { /* NEC FA-RoundGothicB, 1996 */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0x5da75315, 0x0000019d }, /* fpgm */\r\n        { 0x40745a5f, 0x000022e0 }  /* prep */\r\n      },\r\n      { /* NEC FA-RoundGothicM, 1996 */\r\n        { 0x00000000, 0x00000000 }, /* cvt  */\r\n        { 0xf055fc48, 0x000001c2 }, /* fpgm */\r\n        { 0x3900ded3, 0x00001e18 }  /* prep */\r\n      }\r\n    };\r\n\r\n    FT_ULong   checksum;\r\n    int        num_matched_ids[TRICK_SFNT_IDS_NUM_FACES];\r\n    FT_Bool    has_cvt, has_fpgm, has_prep;\r\n    FT_UShort  i;\r\n    int        j, k;\r\n\r\n\r\n    FT_MEM_SET( num_matched_ids, 0,\r\n                sizeof ( int ) * TRICK_SFNT_IDS_NUM_FACES );\r\n    has_cvt  = FALSE;\r\n    has_fpgm = FALSE;\r\n    has_prep = FALSE;\r\n\r\n    for ( i = 0; i < face->num_tables; i++ )\r\n    {\r\n      checksum = 0;\r\n\r\n      switch( face->dir_tables[i].Tag )\r\n      {\r\n      case TTAG_cvt:\r\n        k = TRICK_SFNT_ID_cvt;\r\n        has_cvt  = TRUE;\r\n        break;\r\n\r\n      case TTAG_fpgm:\r\n        k = TRICK_SFNT_ID_fpgm;\r\n        has_fpgm = TRUE;\r\n        break;\r\n\r\n      case TTAG_prep:\r\n        k = TRICK_SFNT_ID_prep;\r\n        has_prep = TRUE;\r\n        break;\r\n\r\n      default:\r\n        continue;\r\n      }\r\n\r\n      for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )\r\n        if ( face->dir_tables[i].Length == sfnt_id[j][k].Length )\r\n        {\r\n          if ( !checksum )\r\n            checksum = tt_get_sfnt_checksum( face, i );\r\n\r\n          if ( sfnt_id[j][k].CheckSum == checksum )\r\n            num_matched_ids[j]++;\r\n\r\n          if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )\r\n            return TRUE;\r\n        }\r\n    }\r\n\r\n    for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )\r\n    {\r\n      if ( !has_cvt  && !sfnt_id[j][TRICK_SFNT_ID_cvt].Length )\r\n        num_matched_ids[j] ++;\r\n      if ( !has_fpgm && !sfnt_id[j][TRICK_SFNT_ID_fpgm].Length )\r\n        num_matched_ids[j] ++;\r\n      if ( !has_prep && !sfnt_id[j][TRICK_SFNT_ID_prep].Length )\r\n        num_matched_ids[j] ++;\r\n      if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )\r\n        return TRUE;\r\n    }\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  static FT_Bool\r\n  tt_check_trickyness( FT_Face  face )\r\n  {\r\n    if ( !face )\r\n      return FALSE;\r\n\r\n    /* For first, check the face name for quick check. */\r\n    if ( face->family_name                               &&\r\n         tt_check_trickyness_family( face->family_name ) )\r\n      return TRUE;\r\n\r\n    /* Type42 fonts may lack `name' tables, we thus try to identify */\r\n    /* tricky fonts by checking the checksums of Type42-persistent  */\r\n    /* sfnt tables (`cvt', `fpgm', and `prep').                     */\r\n    if ( tt_check_trickyness_sfnt_ids( (TT_Face)face ) )\r\n      return TRUE;\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  /* Check whether `.notdef' is the only glyph in the `loca' table. */\r\n  static FT_Bool\r\n  tt_check_single_notdef( FT_Face  ttface )\r\n  {\r\n    FT_Bool   result = FALSE;\r\n\r\n    TT_Face   face = (TT_Face)ttface;\r\n    FT_UInt   asize;\r\n    FT_ULong  i;\r\n    FT_ULong  glyph_index = 0;\r\n    FT_UInt   count       = 0;\r\n\r\n\r\n    for( i = 0; i < face->num_locations; i++ )\r\n    {\r\n      tt_face_get_location( face, i, &asize );\r\n      if ( asize > 0 )\r\n      {\r\n        count += 1;\r\n        if ( count > 1 )\r\n          break;\r\n        glyph_index = i;\r\n      }\r\n    }\r\n\r\n    /* Only have a single outline. */\r\n    if ( count == 1 )\r\n    {\r\n      if ( glyph_index == 0 )\r\n        result = TRUE;\r\n      else\r\n      {\r\n        /* FIXME: Need to test glyphname == .notdef ? */\r\n        FT_Error error;\r\n        char buf[8];\r\n\r\n\r\n        error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 );\r\n        if ( !error                                            &&\r\n             buf[0] == '.' && !ft_strncmp( buf, \".notdef\", 8 ) )\r\n          result = TRUE;\r\n      }\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_init                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a given TrueType face object.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     :: The source font stream.                              */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the font face in the resource.          */\r\n  /*                                                                       */\r\n  /*    num_params :: Number of additional generic parameters.  Ignored.   */\r\n  /*                                                                       */\r\n  /*    params     :: Additional generic parameters.  Ignored.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The newly built face object.                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_init( FT_Stream      stream,\r\n                FT_Face        ttface,      /* TT_Face */\r\n                FT_Int         face_index,\r\n                FT_Int         num_params,\r\n                FT_Parameter*  params )\r\n  {\r\n    FT_Error      error;\r\n    FT_Library    library;\r\n    SFNT_Service  sfnt;\r\n    TT_Face       face = (TT_Face)ttface;\r\n\r\n\r\n    FT_TRACE2(( \"TTF driver\\n\" ));\r\n\r\n    library = ttface->driver->root.library;\r\n\r\n    sfnt = (SFNT_Service)FT_Get_Module_Interface( library, \"sfnt\" );\r\n    if ( !sfnt )\r\n    {\r\n      FT_ERROR(( \"tt_face_init: cannot access `sfnt' module\\n\" ));\r\n      error = TT_Err_Missing_Module;\r\n      goto Exit;\r\n    }\r\n\r\n    /* create input stream from resource */\r\n    if ( FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    /* check that we have a valid TrueType file */\r\n    error = sfnt->init_face( stream, face, face_index, num_params, params );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* We must also be able to accept Mac/GX fonts, as well as OT ones. */\r\n    /* The 0x00020000 tag is completely undocumented; some fonts from   */\r\n    /* Arphic made for Chinese Windows 3.1 have this.                   */\r\n    if ( face->format_tag != 0x00010000L &&    /* MS fonts  */\r\n         face->format_tag != 0x00020000L &&    /* CJK fonts for Win 3.1 */\r\n         face->format_tag != TTAG_true   )     /* Mac fonts */\r\n    {\r\n      FT_TRACE2(( \"  not a TTF font\\n\" ));\r\n      goto Bad_Format;\r\n    }\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    ttface->face_flags |= FT_FACE_FLAG_HINTER;\r\n#endif\r\n\r\n    /* If we are performing a simple font format check, exit immediately. */\r\n    if ( face_index < 0 )\r\n      return TT_Err_Ok;\r\n\r\n    /* Load font directory */\r\n    error = sfnt->load_face( stream, face, face_index, num_params, params );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( tt_check_trickyness( ttface ) )\r\n      ttface->face_flags |= FT_FACE_FLAG_TRICKY;\r\n\r\n    error = tt_face_load_hdmx( face, stream );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( FT_IS_SCALABLE( ttface ) )\r\n    {\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n      if ( !ttface->internal->incremental_interface )\r\n        error = tt_face_load_loca( face, stream );\r\n      if ( !error )\r\n        error = tt_face_load_cvt( face, stream );\r\n      if ( !error )\r\n        error = tt_face_load_fpgm( face, stream );\r\n      if ( !error )\r\n        error = tt_face_load_prep( face, stream );\r\n\r\n      /* Check the scalable flag based on `loca'. */\r\n      if ( !ttface->internal->incremental_interface &&\r\n           ttface->num_fixed_sizes                  &&\r\n           face->glyph_locations                    &&\r\n           tt_check_single_notdef( ttface )         )\r\n      {\r\n        FT_TRACE5(( \"tt_face_init:\"\r\n                    \" Only the `.notdef' glyph has an outline.\\n\"\r\n                    \"             \"\r\n                    \" Resetting scalable flag to FALSE.\\n\" ));\r\n\r\n        ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;\r\n      }\r\n\r\n#else\r\n\r\n      if ( !error )\r\n        error = tt_face_load_loca( face, stream );\r\n      if ( !error )\r\n        error = tt_face_load_cvt( face, stream );\r\n      if ( !error )\r\n        error = tt_face_load_fpgm( face, stream );\r\n      if ( !error )\r\n        error = tt_face_load_prep( face, stream );\r\n\r\n      /* Check the scalable flag based on `loca'. */\r\n      if ( ttface->num_fixed_sizes          &&\r\n           face->glyph_locations            &&\r\n           tt_check_single_notdef( ttface ) )\r\n      {\r\n        FT_TRACE5(( \"tt_face_init:\"\r\n                    \" Only the `.notdef' glyph has an outline.\\n\"\r\n                    \"             \"\r\n                    \" Resetting scalable flag to FALSE.\\n\" ));\r\n\r\n        ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;\r\n      }\r\n\r\n#endif\r\n\r\n    }\r\n\r\n#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING    ) && \\\r\n    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )\r\n\r\n    {\r\n      FT_Bool  unpatented_hinting;\r\n      int      i;\r\n\r\n\r\n      /* Determine whether unpatented hinting is to be used for this face. */\r\n      unpatented_hinting = FT_BOOL\r\n        ( library->debug_hooks[FT_DEBUG_HOOK_UNPATENTED_HINTING] != NULL );\r\n\r\n      for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )\r\n        if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )\r\n          unpatented_hinting = TRUE;\r\n\r\n      if ( !unpatented_hinting )\r\n        ttface->internal->ignore_unpatented_hinter = TRUE;\r\n    }\r\n\r\n#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&\r\n          !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */\r\n\r\n    /* initialize standard glyph loading routines */\r\n    TT_Init_Glyph_Loading( face );\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Bad_Format:\r\n    error = TT_Err_Unknown_File_Format;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_done                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalize a given face object.                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A pointer to the face object to destroy.                   */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_done( FT_Face  ttface )           /* TT_Face */\r\n  {\r\n    TT_Face       face = (TT_Face)ttface;\r\n    FT_Memory     memory;\r\n    FT_Stream     stream;\r\n    SFNT_Service  sfnt;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = ttface->memory;\r\n    stream = ttface->stream;\r\n    sfnt   = (SFNT_Service)face->sfnt;\r\n\r\n    /* for `extended TrueType formats' (i.e. compressed versions) */\r\n    if ( face->extra.finalizer )\r\n      face->extra.finalizer( face->extra.data );\r\n\r\n    if ( sfnt )\r\n      sfnt->done_face( face );\r\n\r\n    /* freeing the locations table */\r\n    tt_face_done_loca( face );\r\n\r\n    tt_face_free_hdmx( face );\r\n\r\n    /* freeing the CVT */\r\n    FT_FREE( face->cvt );\r\n    face->cvt_size = 0;\r\n\r\n    /* freeing the programs */\r\n    FT_FRAME_RELEASE( face->font_program );\r\n    FT_FRAME_RELEASE( face->cvt_program );\r\n    face->font_program_size = 0;\r\n    face->cvt_program_size  = 0;\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    tt_done_blend( memory, face->blend );\r\n    face->blend = NULL;\r\n#endif\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                           SIZE  FUNCTIONS                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_size_run_fpgm                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Run the font program.                                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size     :: A handle to the size object.                           */\r\n  /*                                                                       */\r\n  /*    pedantic :: Set if bytecode execution should be pedantic.          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_size_run_fpgm( TT_Size  size,\r\n                    FT_Bool  pedantic )\r\n  {\r\n    TT_Face         face = (TT_Face)size->root.face;\r\n    TT_ExecContext  exec;\r\n    FT_Error        error;\r\n\r\n\r\n    /* debugging instances have their own context */\r\n    if ( size->debug )\r\n      exec = size->context;\r\n    else\r\n      exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;\r\n\r\n    if ( !exec )\r\n      return TT_Err_Could_Not_Find_Context;\r\n\r\n    TT_Load_Context( exec, face, size );\r\n\r\n    exec->callTop = 0;\r\n    exec->top     = 0;\r\n\r\n    exec->period    = 64;\r\n    exec->phase     = 0;\r\n    exec->threshold = 0;\r\n\r\n    exec->instruction_trap = FALSE;\r\n    exec->F_dot_P          = 0x4000L;\r\n\r\n    exec->pedantic_hinting = pedantic;\r\n\r\n    {\r\n      FT_Size_Metrics*  metrics    = &exec->metrics;\r\n      TT_Size_Metrics*  tt_metrics = &exec->tt_metrics;\r\n\r\n\r\n      metrics->x_ppem   = 0;\r\n      metrics->y_ppem   = 0;\r\n      metrics->x_scale  = 0;\r\n      metrics->y_scale  = 0;\r\n\r\n      tt_metrics->ppem  = 0;\r\n      tt_metrics->scale = 0;\r\n      tt_metrics->ratio = 0x10000L;\r\n    }\r\n\r\n    /* allow font program execution */\r\n    TT_Set_CodeRange( exec,\r\n                      tt_coderange_font,\r\n                      face->font_program,\r\n                      face->font_program_size );\r\n\r\n    /* disable CVT and glyph programs coderange */\r\n    TT_Clear_CodeRange( exec, tt_coderange_cvt );\r\n    TT_Clear_CodeRange( exec, tt_coderange_glyph );\r\n\r\n    if ( face->font_program_size > 0 )\r\n    {\r\n      error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 );\r\n\r\n      if ( !error )\r\n      {\r\n        FT_TRACE4(( \"Executing `fpgm' table.\\n\" ));\r\n\r\n        error = face->interpreter( exec );\r\n      }\r\n    }\r\n    else\r\n      error = TT_Err_Ok;\r\n\r\n    if ( !error )\r\n      TT_Save_Context( exec, size );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_size_run_prep                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Run the control value program.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size     :: A handle to the size object.                           */\r\n  /*                                                                       */\r\n  /*    pedantic :: Set if bytecode execution should be pedantic.          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_size_run_prep( TT_Size  size,\r\n                    FT_Bool  pedantic )\r\n  {\r\n    TT_Face         face = (TT_Face)size->root.face;\r\n    TT_ExecContext  exec;\r\n    FT_Error        error;\r\n\r\n\r\n    /* debugging instances have their own context */\r\n    if ( size->debug )\r\n      exec = size->context;\r\n    else\r\n      exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;\r\n\r\n    if ( !exec )\r\n      return TT_Err_Could_Not_Find_Context;\r\n\r\n    TT_Load_Context( exec, face, size );\r\n\r\n    exec->callTop = 0;\r\n    exec->top     = 0;\r\n\r\n    exec->instruction_trap = FALSE;\r\n\r\n    exec->pedantic_hinting = pedantic;\r\n\r\n    TT_Set_CodeRange( exec,\r\n                      tt_coderange_cvt,\r\n                      face->cvt_program,\r\n                      face->cvt_program_size );\r\n\r\n    TT_Clear_CodeRange( exec, tt_coderange_glyph );\r\n\r\n    if ( face->cvt_program_size > 0 )\r\n    {\r\n      error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );\r\n\r\n      if ( !error && !size->debug )\r\n      {\r\n        FT_TRACE4(( \"Executing `prep' table.\\n\" ));\r\n\r\n        error = face->interpreter( exec );\r\n      }\r\n    }\r\n    else\r\n      error = TT_Err_Ok;\r\n\r\n    /* save as default graphics state */\r\n    size->GS = exec->GS;\r\n\r\n    TT_Save_Context( exec, size );\r\n\r\n    return error;\r\n  }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  static void\r\n  tt_size_done_bytecode( FT_Size  ftsize )\r\n  {\r\n    TT_Size    size   = (TT_Size)ftsize;\r\n    TT_Face    face   = (TT_Face)ftsize->face;\r\n    FT_Memory  memory = face->root.memory;\r\n\r\n\r\n    if ( size->debug )\r\n    {\r\n      /* the debug context must be deleted by the debugger itself */\r\n      size->context = NULL;\r\n      size->debug   = FALSE;\r\n    }\r\n\r\n    FT_FREE( size->cvt );\r\n    size->cvt_size = 0;\r\n\r\n    /* free storage area */\r\n    FT_FREE( size->storage );\r\n    size->storage_size = 0;\r\n\r\n    /* twilight zone */\r\n    tt_glyphzone_done( &size->twilight );\r\n\r\n    FT_FREE( size->function_defs );\r\n    FT_FREE( size->instruction_defs );\r\n\r\n    size->num_function_defs    = 0;\r\n    size->max_function_defs    = 0;\r\n    size->num_instruction_defs = 0;\r\n    size->max_instruction_defs = 0;\r\n\r\n    size->max_func = 0;\r\n    size->max_ins  = 0;\r\n\r\n    size->bytecode_ready = 0;\r\n    size->cvt_ready      = 0;\r\n  }\r\n\r\n\r\n  /* Initialize bytecode-related fields in the size object.       */\r\n  /* We do this only if bytecode interpretation is really needed. */\r\n  static FT_Error\r\n  tt_size_init_bytecode( FT_Size  ftsize,\r\n                         FT_Bool  pedantic )\r\n  {\r\n    FT_Error   error;\r\n    TT_Size    size = (TT_Size)ftsize;\r\n    TT_Face    face = (TT_Face)ftsize->face;\r\n    FT_Memory  memory = face->root.memory;\r\n    FT_Int     i;\r\n\r\n    FT_UShort       n_twilight;\r\n    TT_MaxProfile*  maxp = &face->max_profile;\r\n\r\n\r\n    size->bytecode_ready = 1;\r\n    size->cvt_ready      = 0;\r\n\r\n    size->max_function_defs    = maxp->maxFunctionDefs;\r\n    size->max_instruction_defs = maxp->maxInstructionDefs;\r\n\r\n    size->num_function_defs    = 0;\r\n    size->num_instruction_defs = 0;\r\n\r\n    size->max_func = 0;\r\n    size->max_ins  = 0;\r\n\r\n    size->cvt_size     = face->cvt_size;\r\n    size->storage_size = maxp->maxStorage;\r\n\r\n    /* Set default metrics */\r\n    {\r\n      TT_Size_Metrics*  metrics = &size->ttmetrics;\r\n\r\n\r\n      metrics->rotated   = FALSE;\r\n      metrics->stretched = FALSE;\r\n\r\n      /* set default compensation (all 0) */\r\n      for ( i = 0; i < 4; i++ )\r\n        metrics->compensations[i] = 0;\r\n    }\r\n\r\n    /* allocate function defs, instruction defs, cvt, and storage area */\r\n    if ( FT_NEW_ARRAY( size->function_defs,    size->max_function_defs    ) ||\r\n         FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||\r\n         FT_NEW_ARRAY( size->cvt,              size->cvt_size             ) ||\r\n         FT_NEW_ARRAY( size->storage,          size->storage_size         ) )\r\n      goto Exit;\r\n\r\n    /* reserve twilight zone */\r\n    n_twilight = maxp->maxTwilightPoints;\r\n\r\n    /* there are 4 phantom points (do we need this?) */\r\n    n_twilight += 4;\r\n\r\n    error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    size->twilight.n_points = n_twilight;\r\n\r\n    size->GS = tt_default_graphics_state;\r\n\r\n    /* set `face->interpreter' according to the debug hook present */\r\n    {\r\n      FT_Library  library = face->root.driver->root.library;\r\n\r\n\r\n      face->interpreter = (TT_Interpreter)\r\n                            library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];\r\n      if ( !face->interpreter )\r\n        face->interpreter = (TT_Interpreter)TT_RunIns;\r\n    }\r\n\r\n    /* Fine, now run the font program! */\r\n    error = tt_size_run_fpgm( size, pedantic );\r\n\r\n  Exit:\r\n    if ( error )\r\n      tt_size_done_bytecode( ftsize );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_size_ready_bytecode( TT_Size  size,\r\n                          FT_Bool  pedantic )\r\n  {\r\n    FT_Error  error = TT_Err_Ok;\r\n\r\n\r\n    if ( !size->bytecode_ready )\r\n    {\r\n      error = tt_size_init_bytecode( (FT_Size)size, pedantic );\r\n      if ( error )\r\n        goto Exit;\r\n    }\r\n\r\n    /* rescale CVT when needed */\r\n    if ( !size->cvt_ready )\r\n    {\r\n      FT_UInt  i;\r\n      TT_Face  face = (TT_Face)size->root.face;\r\n\r\n\r\n      /* Scale the cvt values to the new ppem.          */\r\n      /* We use by default the y ppem to scale the CVT. */\r\n      for ( i = 0; i < size->cvt_size; i++ )\r\n        size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );\r\n\r\n      /* all twilight points are originally zero */\r\n      for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )\r\n      {\r\n        size->twilight.org[i].x = 0;\r\n        size->twilight.org[i].y = 0;\r\n        size->twilight.cur[i].x = 0;\r\n        size->twilight.cur[i].y = 0;\r\n      }\r\n\r\n      /* clear storage area */\r\n      for ( i = 0; i < (FT_UInt)size->storage_size; i++ )\r\n        size->storage[i] = 0;\r\n\r\n      size->GS = tt_default_graphics_state;\r\n\r\n      error = tt_size_run_prep( size, pedantic );\r\n      if ( !error )\r\n        size->cvt_ready = 1;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_size_init                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a new TrueType size object.                             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    size :: A handle to the size object.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_size_init( FT_Size  ttsize )           /* TT_Size */\r\n  {\r\n    TT_Size   size  = (TT_Size)ttsize;\r\n    FT_Error  error = TT_Err_Ok;\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    size->bytecode_ready = 0;\r\n    size->cvt_ready      = 0;\r\n#endif\r\n\r\n    size->ttmetrics.valid = FALSE;\r\n    size->strike_index    = 0xFFFFFFFFUL;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_size_done                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The TrueType size object finalizer.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size :: A handle to the target size object.                        */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_size_done( FT_Size  ttsize )           /* TT_Size */\r\n  {\r\n    TT_Size  size = (TT_Size)ttsize;\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    if ( size->bytecode_ready )\r\n      tt_size_done_bytecode( ttsize );\r\n#endif\r\n\r\n    size->ttmetrics.valid = FALSE;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_size_reset                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Reset a TrueType size when resolutions and character dimensions    */\r\n  /*    have been changed.                                                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size :: A handle to the target size object.                        */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_size_reset( TT_Size  size )\r\n  {\r\n    TT_Face           face;\r\n    FT_Error          error = TT_Err_Ok;\r\n    FT_Size_Metrics*  metrics;\r\n\r\n\r\n    size->ttmetrics.valid = FALSE;\r\n\r\n    face = (TT_Face)size->root.face;\r\n\r\n    metrics = &size->metrics;\r\n\r\n    /* copy the result from base layer */\r\n    *metrics = size->root.metrics;\r\n\r\n    if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )\r\n      return TT_Err_Invalid_PPem;\r\n\r\n    /* This bit flag, if set, indicates that the ppems must be       */\r\n    /* rounded to integers.  Nearly all TrueType fonts have this bit */\r\n    /* set, as hinting won't work really well otherwise.             */\r\n    /*                                                               */\r\n    if ( face->header.Flags & 8 )\r\n    {\r\n      metrics->x_scale = FT_DivFix( metrics->x_ppem << 6,\r\n                                    face->root.units_per_EM );\r\n      metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,\r\n                                    face->root.units_per_EM );\r\n\r\n      metrics->ascender =\r\n        FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );\r\n      metrics->descender =\r\n        FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );\r\n      metrics->height =\r\n        FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );\r\n      metrics->max_advance =\r\n        FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,\r\n                                 metrics->x_scale ) );\r\n    }\r\n\r\n    /* compute new transformation */\r\n    if ( metrics->x_ppem >= metrics->y_ppem )\r\n    {\r\n      size->ttmetrics.scale   = metrics->x_scale;\r\n      size->ttmetrics.ppem    = metrics->x_ppem;\r\n      size->ttmetrics.x_ratio = 0x10000L;\r\n      size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem,\r\n                                           metrics->x_ppem );\r\n    }\r\n    else\r\n    {\r\n      size->ttmetrics.scale   = metrics->y_scale;\r\n      size->ttmetrics.ppem    = metrics->y_ppem;\r\n      size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem,\r\n                                           metrics->y_ppem );\r\n      size->ttmetrics.y_ratio = 0x10000L;\r\n    }\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    size->cvt_ready = 0;\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    if ( !error )\r\n      size->ttmetrics.valid = TRUE;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_driver_init                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a given TrueType driver object.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target driver object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_driver_init( FT_Module  ttdriver )     /* TT_Driver */\r\n  {\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    TT_Driver  driver = (TT_Driver)ttdriver;\r\n\r\n\r\n    if ( !TT_New_Context( driver ) )\r\n      return TT_Err_Could_Not_Find_Context;\r\n\r\n#else\r\n\r\n    FT_UNUSED( ttdriver );\r\n\r\n#endif\r\n\r\n    return TT_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_driver_done                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalize a given TrueType driver.                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target TrueType driver.                  */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  tt_driver_done( FT_Module  ttdriver )     /* TT_Driver */\r\n  {\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n    TT_Driver  driver = (TT_Driver)ttdriver;\r\n\r\n\r\n    /* destroy the execution context */\r\n    if ( driver->context )\r\n    {\r\n      TT_Done_Context( driver->context );\r\n      driver->context = NULL;\r\n    }\r\n#else\r\n    FT_UNUSED( ttdriver );\r\n#endif\r\n\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_slot_init                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a new slot object.                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    slot :: A handle to the slot object.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_slot_init( FT_GlyphSlot  slot )\r\n  {\r\n    return FT_GlyphLoader_CreateExtra( slot->internal->loader );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttobjs.h                                                               */\r\n/*                                                                         */\r\n/*    Objects manager (specification).                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2009, 2011-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTOBJS_H__\r\n#define __TTOBJS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_Driver                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a TrueType driver object.                              */\r\n  /*                                                                       */\r\n  typedef struct TT_DriverRec_*  TT_Driver;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_Instance                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a TrueType size object.                                */\r\n  /*                                                                       */\r\n  typedef struct TT_SizeRec_*  TT_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_GlyphSlot                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a TrueType glyph slot object.                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This is a direct typedef of FT_GlyphSlot, as there is nothing      */\r\n  /*    specific about the TrueType glyph slot.                            */\r\n  /*                                                                       */\r\n  typedef FT_GlyphSlot  TT_GlyphSlot;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_GraphicsState                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The TrueType graphics state used during bytecode interpretation.   */\r\n  /*                                                                       */\r\n  typedef struct  TT_GraphicsState_\r\n  {\r\n    FT_UShort      rp0;\r\n    FT_UShort      rp1;\r\n    FT_UShort      rp2;\r\n\r\n    FT_UnitVector  dualVector;\r\n    FT_UnitVector  projVector;\r\n    FT_UnitVector  freeVector;\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    FT_Bool        both_x_axis;\r\n#endif\r\n\r\n    FT_Long        loop;\r\n    FT_F26Dot6     minimum_distance;\r\n    FT_Int         round_state;\r\n\r\n    FT_Bool        auto_flip;\r\n    FT_F26Dot6     control_value_cutin;\r\n    FT_F26Dot6     single_width_cutin;\r\n    FT_F26Dot6     single_width_value;\r\n    FT_Short       delta_base;\r\n    FT_Short       delta_shift;\r\n\r\n    FT_Byte        instruct_control;\r\n    /* According to Greg Hitchcock from Microsoft, the `scan_control'     */\r\n    /* variable as documented in the TrueType specification is a 32-bit   */\r\n    /* integer; the high-word part holds the SCANTYPE value, the low-word */\r\n    /* part the SCANCTRL value.  We separate it into two fields.          */\r\n    FT_Bool        scan_control;\r\n    FT_Int         scan_type;\r\n\r\n    FT_UShort      gep0;\r\n    FT_UShort      gep1;\r\n    FT_UShort      gep2;\r\n\r\n  } TT_GraphicsState;\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  FT_LOCAL( void )\r\n  tt_glyphzone_done( TT_GlyphZone  zone );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_glyphzone_new( FT_Memory     memory,\r\n                    FT_UShort     maxPoints,\r\n                    FT_Short      maxContours,\r\n                    TT_GlyphZone  zone );\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  EXECUTION SUBTABLES                                                  */\r\n  /*                                                                       */\r\n  /*  These sub-tables relate to instruction execution.                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define TT_MAX_CODE_RANGES  3\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* There can only be 3 active code ranges at once:                       */\r\n  /*   - the Font Program                                                  */\r\n  /*   - the CVT Program                                                   */\r\n  /*   - a glyph's instructions set                                        */\r\n  /*                                                                       */\r\n  typedef enum  TT_CodeRange_Tag_\r\n  {\r\n    tt_coderange_none = 0,\r\n    tt_coderange_font,\r\n    tt_coderange_cvt,\r\n    tt_coderange_glyph\r\n\r\n  } TT_CodeRange_Tag;\r\n\r\n\r\n  typedef struct  TT_CodeRange_\r\n  {\r\n    FT_Byte*  base;\r\n    FT_ULong  size;\r\n\r\n  } TT_CodeRange;\r\n\r\n  typedef TT_CodeRange  TT_CodeRangeTable[TT_MAX_CODE_RANGES];\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Defines a function/instruction definition record.                     */\r\n  /*                                                                       */\r\n  typedef struct  TT_DefRecord_\r\n  {\r\n    FT_Int   range;        /* in which code range is it located?     */\r\n    FT_Long  start;        /* where does it start?                   */\r\n    FT_Long  end;          /* where does it end?                     */\r\n    FT_UInt  opc;          /* function #, or instruction code        */\r\n    FT_Bool  active;       /* is it active?                          */\r\n    FT_Bool  inline_delta; /* is function that defines inline delta? */\r\n\r\n  } TT_DefRecord, *TT_DefArray;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Subglyph transformation record.                                       */\r\n  /*                                                                       */\r\n  typedef struct  TT_Transform_\r\n  {\r\n    FT_Fixed    xx, xy;     /* transformation matrix coefficients */\r\n    FT_Fixed    yx, yy;\r\n    FT_F26Dot6  ox, oy;     /* offsets                            */\r\n\r\n  } TT_Transform;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A note regarding non-squared pixels:                                  */\r\n  /*                                                                       */\r\n  /* (This text will probably go into some docs at some time; for now, it  */\r\n  /* is kept here to explain some definitions in the TT_Size_Metrics       */\r\n  /* record).                                                              */\r\n  /*                                                                       */\r\n  /* The CVT is a one-dimensional array containing values that control     */\r\n  /* certain important characteristics in a font, like the height of all   */\r\n  /* capitals, all lowercase letter, default spacing or stem width/height. */\r\n  /*                                                                       */\r\n  /* These values are found in FUnits in the font file, and must be scaled */\r\n  /* to pixel coordinates before being used by the CVT and glyph programs. */\r\n  /* Unfortunately, when using distinct x and y resolutions (or distinct x */\r\n  /* and y pointsizes), there are two possible scalings.                   */\r\n  /*                                                                       */\r\n  /* A first try was to implement a `lazy' scheme where all values were    */\r\n  /* scaled when first used.  However, while some values are always used   */\r\n  /* in the same direction, some others are used under many different      */\r\n  /* circumstances and orientations.                                       */\r\n  /*                                                                       */\r\n  /* I have found a simpler way to do the same, and it even seems to work  */\r\n  /* in most of the cases:                                                 */\r\n  /*                                                                       */\r\n  /* - All CVT values are scaled to the maximum ppem size.                 */\r\n  /*                                                                       */\r\n  /* - When performing a read or write in the CVT, a ratio factor is used  */\r\n  /*   to perform adequate scaling.  Example:                              */\r\n  /*                                                                       */\r\n  /*     x_ppem = 14                                                       */\r\n  /*     y_ppem = 10                                                       */\r\n  /*                                                                       */\r\n  /*   We choose ppem = x_ppem = 14 as the CVT scaling size.  All cvt      */\r\n  /*   entries are scaled to it.                                           */\r\n  /*                                                                       */\r\n  /*     x_ratio = 1.0                                                     */\r\n  /*     y_ratio = y_ppem/ppem (< 1.0)                                     */\r\n  /*                                                                       */\r\n  /*   We compute the current ratio like:                                  */\r\n  /*                                                                       */\r\n  /*   - If projVector is horizontal,                                      */\r\n  /*       ratio = x_ratio = 1.0                                           */\r\n  /*                                                                       */\r\n  /*   - if projVector is vertical,                                        */\r\n  /*       ratio = y_ratio                                                 */\r\n  /*                                                                       */\r\n  /*   - else,                                                             */\r\n  /*       ratio = sqrt( (proj.x * x_ratio) ^ 2 + (proj.y * y_ratio) ^ 2 ) */\r\n  /*                                                                       */\r\n  /*   Reading a cvt value returns                                         */\r\n  /*     ratio * cvt[index]                                                */\r\n  /*                                                                       */\r\n  /*   Writing a cvt value in pixels:                                      */\r\n  /*     cvt[index] / ratio                                                */\r\n  /*                                                                       */\r\n  /*   The current ppem is simply                                          */\r\n  /*     ratio * ppem                                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Metrics used by the TrueType size and context objects.                */\r\n  /*                                                                       */\r\n  typedef struct  TT_Size_Metrics_\r\n  {\r\n    /* for non-square pixels */\r\n    FT_Long     x_ratio;\r\n    FT_Long     y_ratio;\r\n\r\n    FT_UShort   ppem;               /* maximum ppem size              */\r\n    FT_Long     ratio;              /* current ratio                  */\r\n    FT_Fixed    scale;\r\n\r\n    FT_F26Dot6  compensations[4];   /* device-specific compensations  */\r\n\r\n    FT_Bool     valid;\r\n\r\n    FT_Bool     rotated;            /* `is the glyph rotated?'-flag   */\r\n    FT_Bool     stretched;          /* `is the glyph stretched?'-flag */\r\n\r\n  } TT_Size_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TrueType size class.                                                  */\r\n  /*                                                                       */\r\n  typedef struct  TT_SizeRec_\r\n  {\r\n    FT_SizeRec         root;\r\n\r\n    /* we have our own copy of metrics so that we can modify */\r\n    /* it without affecting auto-hinting (when used)         */\r\n    FT_Size_Metrics    metrics;\r\n\r\n    TT_Size_Metrics    ttmetrics;\r\n\r\n    FT_ULong           strike_index;      /* 0xFFFFFFFF to indicate invalid */\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    FT_UInt            num_function_defs; /* number of function definitions */\r\n    FT_UInt            max_function_defs;\r\n    TT_DefArray        function_defs;     /* table of function definitions  */\r\n\r\n    FT_UInt            num_instruction_defs;  /* number of ins. definitions */\r\n    FT_UInt            max_instruction_defs;\r\n    TT_DefArray        instruction_defs;      /* table of ins. definitions  */\r\n\r\n    FT_UInt            max_func;\r\n    FT_UInt            max_ins;\r\n\r\n    TT_CodeRangeTable  codeRangeTable;\r\n\r\n    TT_GraphicsState   GS;\r\n\r\n    FT_ULong           cvt_size;      /* the scaled control value table */\r\n    FT_Long*           cvt;\r\n\r\n    FT_UShort          storage_size; /* The storage area is now part of */\r\n    FT_Long*           storage;      /* the instance                    */\r\n\r\n    TT_GlyphZoneRec    twilight;     /* The instance's twilight zone    */\r\n\r\n    /* debugging variables */\r\n\r\n    /* When using the debugger, we must keep the */\r\n    /* execution context tied to the instance    */\r\n    /* object rather than asking it on demand.   */\r\n\r\n    FT_Bool            debug;\r\n    TT_ExecContext     context;\r\n\r\n    FT_Bool            bytecode_ready;\r\n    FT_Bool            cvt_ready;\r\n    FT_Bool            ttfautohinted;\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n  } TT_SizeRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TrueType driver class.                                                */\r\n  /*                                                                       */\r\n  typedef struct  TT_DriverRec_\r\n  {\r\n    FT_DriverRec     root;\r\n    TT_ExecContext   context;  /* execution context        */\r\n    TT_GlyphZoneRec  zone;     /* glyph loader points zone */\r\n\r\n    void*            extension_component;\r\n\r\n  } TT_DriverRec;\r\n\r\n\r\n  /* Note: All of the functions below (except tt_size_reset()) are used    */\r\n  /* as function pointers in a FT_Driver_ClassRec.  Therefore their        */\r\n  /* parameters are of types FT_Face, FT_Size, etc., rather than TT_Face,  */\r\n  /* TT_Size, etc., so that the compiler can confirm that the types and    */\r\n  /* number of parameters are correct.  In all cases the FT_xxx types are  */\r\n  /* cast to their TT_xxx counterparts inside the functions since FreeType */\r\n  /* will always use the TT driver to create them.                         */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Face functions                                                        */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_init( FT_Stream      stream,\r\n                FT_Face        ttface,      /* TT_Face */\r\n                FT_Int         face_index,\r\n                FT_Int         num_params,\r\n                FT_Parameter*  params );\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_done( FT_Face  ttface );          /* TT_Face */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Size functions                                                        */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  tt_size_init( FT_Size  ttsize );          /* TT_Size */\r\n\r\n  FT_LOCAL( void )\r\n  tt_size_done( FT_Size  ttsize );          /* TT_Size */\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_size_run_fpgm( TT_Size  size,\r\n                    FT_Bool  pedantic );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_size_run_prep( TT_Size  size,\r\n                    FT_Bool  pedantic );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_size_ready_bytecode( TT_Size  size,\r\n                          FT_Bool  pedantic );\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_size_reset( TT_Size  size );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Driver functions                                                      */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  tt_driver_init( FT_Module  ttdriver );    /* TT_Driver */\r\n\r\n  FT_LOCAL( void )\r\n  tt_driver_done( FT_Module  ttdriver );    /* TT_Driver */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Slot functions                                                        */\r\n  /*                                                                       */\r\n  FT_LOCAL( FT_Error )\r\n  tt_slot_init( FT_GlyphSlot  slot );\r\n\r\n\r\n  /* auxiliary */\r\n#define IS_HINTED( flags )  ( ( flags & FT_LOAD_NO_HINTING ) == 0 )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTOBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttpic.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttpic.c                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for truetype module. */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2010, 2012 by                                          */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include \"ttpic.h\"\r\n#include \"tterrors.h\"\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /* forward declaration of PIC init functions from ttdriver.c */\r\n  FT_Error\r\n  FT_Create_Class_tt_services( FT_Library           library,\r\n                               FT_ServiceDescRec**  output_class );\r\n\r\n  void\r\n  FT_Destroy_Class_tt_services( FT_Library          library,\r\n                                FT_ServiceDescRec*  clazz );\r\n\r\n  void\r\n  FT_Init_Class_tt_service_gx_multi_masters(\r\n    FT_Service_MultiMastersRec*  sv_mm );\r\n\r\n  void\r\n  FT_Init_Class_tt_service_truetype_glyf(\r\n    FT_Service_TTGlyfRec*  sv_ttglyf );\r\n\r\n\r\n  void\r\n  tt_driver_class_pic_free( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    if ( pic_container->truetype )\r\n    {\r\n      TTModulePIC*  container = (TTModulePIC*)pic_container->truetype;\r\n\r\n\r\n      if ( container->tt_services )\r\n        FT_Destroy_Class_tt_services( library, container->tt_services );\r\n      container->tt_services = NULL;\r\n      FT_FREE( container );\r\n      pic_container->truetype = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_Error\r\n  tt_driver_class_pic_init( FT_Library  library )\r\n  {\r\n    FT_PIC_Container*  pic_container = &library->pic_container;\r\n    FT_Error           error         = TT_Err_Ok;\r\n    TTModulePIC*       container     = NULL;\r\n    FT_Memory          memory        = library->memory;\r\n\r\n\r\n    /* allocate pointer, clear and set global container pointer */\r\n    if ( FT_ALLOC ( container, sizeof ( *container ) ) )\r\n      return error;\r\n    FT_MEM_SET( container, 0, sizeof ( *container ) );\r\n    pic_container->truetype = container;\r\n\r\n    /* initialize pointer table - this is how the module usually */\r\n    /* expects this data                                         */\r\n    error = FT_Create_Class_tt_services( library,\r\n                                         &container->tt_services );\r\n    if ( error )\r\n      goto Exit;\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    FT_Init_Class_tt_service_gx_multi_masters(\r\n      &container->tt_service_gx_multi_masters );\r\n#endif\r\n    FT_Init_Class_tt_service_truetype_glyf(\r\n      &container->tt_service_truetype_glyf );\r\n\r\nExit:\r\n    if ( error )\r\n      tt_driver_class_pic_free( library );\r\n    return error;\r\n  }\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttpic.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services for truetype module. */\r\n/*                                                                         */\r\n/*  Copyright 2009, 2012 by                                                */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTPIC_H__\r\n#define __TTPIC_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define TT_SERVICES_GET                  tt_services\r\n#define TT_SERVICE_GX_MULTI_MASTERS_GET  tt_service_gx_multi_masters\r\n#define TT_SERVICE_TRUETYPE_GLYF_GET     tt_service_truetype_glyf\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#include FT_MULTIPLE_MASTERS_H\r\n#include FT_SERVICE_MULTIPLE_MASTERS_H\r\n#include FT_SERVICE_TRUETYPE_GLYF_H\r\n\r\n\r\n  typedef struct  TTModulePIC_\r\n  {\r\n    FT_ServiceDescRec*         tt_services;\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    FT_Service_MultiMastersRec tt_service_gx_multi_masters;\r\n#endif\r\n    FT_Service_TTGlyfRec       tt_service_truetype_glyf;\r\n\r\n  } TTModulePIC;\r\n\r\n\r\n#define GET_PIC( lib )                                      \\\r\n          ( (TTModulePIC*)((lib)->pic_container.truetype) )\r\n#define TT_SERVICES_GET                       \\\r\n          ( GET_PIC( library )->tt_services )\r\n#define TT_SERVICE_GX_MULTI_MASTERS_GET                       \\\r\n          ( GET_PIC( library )->tt_service_gx_multi_masters )\r\n#define TT_SERVICE_TRUETYPE_GLYF_GET                       \\\r\n          ( GET_PIC( library )->tt_service_truetype_glyf )\r\n\r\n\r\n  /* see ttpic.c for the implementation */\r\n  void\r\n  tt_driver_class_pic_free( FT_Library  library );\r\n\r\n  FT_Error\r\n  tt_driver_class_pic_init( FT_Library  library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttpload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttpload.c                                                              */\r\n/*                                                                         */\r\n/*    TrueType-specific tables loader (body).                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2004-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_TAGS_H\r\n\r\n#include \"ttpload.h\"\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include \"ttgxvar.h\"\r\n#endif\r\n\r\n#include \"tterrors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_ttpload\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_loca                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the locations table.                                          */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_loca( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error  error;\r\n    FT_ULong  table_len;\r\n    FT_Int    shift;\r\n\r\n\r\n    /* we need the size of the `glyf' table for malformed `loca' tables */\r\n    error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );\r\n\r\n    /* it is possible that a font doesn't have a glyf table at all */\r\n    /* or its size is zero                                         */\r\n    if ( error == TT_Err_Table_Missing )\r\n      face->glyf_len = 0;\r\n    else if ( error )\r\n      goto Exit;\r\n\r\n    FT_TRACE2(( \"Locations \" ));\r\n    error = face->goto_table( face, TTAG_loca, stream, &table_len );\r\n    if ( error )\r\n    {\r\n      error = TT_Err_Locations_Missing;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( face->header.Index_To_Loc_Format != 0 )\r\n    {\r\n      shift = 2;\r\n\r\n      if ( table_len >= 0x40000L )\r\n      {\r\n        FT_TRACE2(( \"table too large\\n\" ));\r\n        error = TT_Err_Invalid_Table;\r\n        goto Exit;\r\n      }\r\n      face->num_locations = table_len >> shift;\r\n    }\r\n    else\r\n    {\r\n      shift = 1;\r\n\r\n      if ( table_len >= 0x20000L )\r\n      {\r\n        FT_TRACE2(( \"table too large\\n\" ));\r\n        error = TT_Err_Invalid_Table;\r\n        goto Exit;\r\n      }\r\n      face->num_locations = table_len >> shift;\r\n    }\r\n\r\n    if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 )\r\n    {\r\n      FT_TRACE2(( \"glyph count mismatch!  loca: %d, maxp: %d\\n\",\r\n                  face->num_locations - 1, face->root.num_glyphs ));\r\n\r\n      /* we only handle the case where `maxp' gives a larger value */\r\n      if ( face->num_locations <= (FT_ULong)face->root.num_glyphs )\r\n      {\r\n        FT_Long   new_loca_len =\r\n                    ( (FT_Long)( face->root.num_glyphs ) + 1 ) << shift;\r\n\r\n        TT_Table  entry = face->dir_tables;\r\n        TT_Table  limit = entry + face->num_tables;\r\n\r\n        FT_Long   pos  = FT_Stream_Pos( stream );\r\n        FT_Long   dist = 0x7FFFFFFFL;\r\n\r\n\r\n        /* compute the distance to next table in font file */\r\n        for ( ; entry < limit; entry++ )\r\n        {\r\n          FT_Long  diff = entry->Offset - pos;\r\n\r\n\r\n          if ( diff > 0 && diff < dist )\r\n            dist = diff;\r\n        }\r\n\r\n        if ( entry == limit )\r\n        {\r\n          /* `loca' is the last table */\r\n          dist = stream->size - pos;\r\n        }\r\n\r\n        if ( new_loca_len <= dist )\r\n        {\r\n          face->num_locations = face->root.num_glyphs + 1;\r\n          table_len           = new_loca_len;\r\n\r\n          FT_TRACE2(( \"adjusting num_locations to %d\\n\",\r\n                      face->num_locations ));\r\n        }\r\n      }\r\n    }\r\n\r\n    /*\r\n     * Extract the frame.  We don't need to decompress it since\r\n     * we are able to parse it directly.\r\n     */\r\n    if ( FT_FRAME_EXTRACT( table_len, face->glyph_locations ) )\r\n      goto Exit;\r\n\r\n    FT_TRACE2(( \"loaded\\n\" ));\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_ULong )\r\n  tt_face_get_location( TT_Face   face,\r\n                        FT_UInt   gindex,\r\n                        FT_UInt  *asize )\r\n  {\r\n    FT_ULong  pos1, pos2;\r\n    FT_Byte*  p;\r\n    FT_Byte*  p_limit;\r\n\r\n\r\n    pos1 = pos2 = 0;\r\n\r\n    if ( gindex < face->num_locations )\r\n    {\r\n      if ( face->header.Index_To_Loc_Format != 0 )\r\n      {\r\n        p       = face->glyph_locations + gindex * 4;\r\n        p_limit = face->glyph_locations + face->num_locations * 4;\r\n\r\n        pos1 = FT_NEXT_ULONG( p );\r\n        pos2 = pos1;\r\n\r\n        if ( p + 4 <= p_limit )\r\n          pos2 = FT_NEXT_ULONG( p );\r\n      }\r\n      else\r\n      {\r\n        p       = face->glyph_locations + gindex * 2;\r\n        p_limit = face->glyph_locations + face->num_locations * 2;\r\n\r\n        pos1 = FT_NEXT_USHORT( p );\r\n        pos2 = pos1;\r\n\r\n        if ( p + 2 <= p_limit )\r\n          pos2 = FT_NEXT_USHORT( p );\r\n\r\n        pos1 <<= 1;\r\n        pos2 <<= 1;\r\n      }\r\n    }\r\n\r\n    /* Check broken location data */\r\n    if ( pos1 > face->glyf_len )\r\n    {\r\n      FT_TRACE1(( \"tt_face_get_location:\"\r\n                  \" too large offset=0x%08lx found for gid=0x%04lx,\"\r\n                  \" exceeding the end of glyf table (0x%08lx)\\n\",\r\n                  pos1, gindex, face->glyf_len ));\r\n      *asize = 0;\r\n      return 0;\r\n    }\r\n\r\n    if ( pos2 > face->glyf_len )\r\n    {\r\n      FT_TRACE1(( \"tt_face_get_location:\"\r\n                  \" too large offset=0x%08lx found for gid=0x%04lx,\"\r\n                  \" truncate at the end of glyf table (0x%08lx)\\n\",\r\n                  pos2, gindex + 1, face->glyf_len ));\r\n      pos2 = face->glyf_len;\r\n    }\r\n\r\n    /* The `loca' table must be ordered; it refers to the length of */\r\n    /* an entry as the difference between the current and the next  */\r\n    /* position.  However, there do exist (malformed) fonts which   */\r\n    /* don't obey this rule, so we are only able to provide an      */\r\n    /* upper bound for the size.                                    */\r\n    /*                                                              */\r\n    /* We get (intentionally) a wrong, non-zero result in case the  */\r\n    /* `glyf' table is missing.                                     */\r\n    if ( pos2 >= pos1 )\r\n      *asize = (FT_UInt)( pos2 - pos1 );\r\n    else\r\n      *asize = (FT_UInt)( face->glyf_len - pos1 );\r\n\r\n    return pos1;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_done_loca( TT_Face  face )\r\n  {\r\n    FT_Stream  stream = face->root.stream;\r\n\r\n\r\n    FT_FRAME_RELEASE( face->glyph_locations );\r\n    face->num_locations = 0;\r\n  }\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_cvt                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the control value table into a face object.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_cvt( TT_Face    face,\r\n                    FT_Stream  stream )\r\n  {\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_ULong   table_len;\r\n\r\n\r\n    FT_TRACE2(( \"CVT \" ));\r\n\r\n    error = face->goto_table( face, TTAG_cvt, stream, &table_len );\r\n    if ( error )\r\n    {\r\n      FT_TRACE2(( \"is missing\\n\" ));\r\n\r\n      face->cvt_size = 0;\r\n      face->cvt      = NULL;\r\n      error          = TT_Err_Ok;\r\n\r\n      goto Exit;\r\n    }\r\n\r\n    face->cvt_size = table_len / 2;\r\n\r\n    if ( FT_NEW_ARRAY( face->cvt, face->cvt_size ) )\r\n      goto Exit;\r\n\r\n    if ( FT_FRAME_ENTER( face->cvt_size * 2L ) )\r\n      goto Exit;\r\n\r\n    {\r\n      FT_Short*  cur   = face->cvt;\r\n      FT_Short*  limit = cur + face->cvt_size;\r\n\r\n\r\n      for ( ; cur < limit; cur++ )\r\n        *cur = FT_GET_SHORT();\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n    FT_TRACE2(( \"loaded\\n\" ));\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    if ( face->doblend )\r\n      error = tt_face_vary_cvt( face, stream );\r\n#endif\r\n\r\n  Exit:\r\n    return error;\r\n\r\n#else /* !TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    FT_UNUSED( face   );\r\n    FT_UNUSED( stream );\r\n\r\n    return TT_Err_Ok;\r\n\r\n#endif\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_fpgm                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the font program.                                             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_fpgm( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    FT_Error  error;\r\n    FT_ULong  table_len;\r\n\r\n\r\n    FT_TRACE2(( \"Font program \" ));\r\n\r\n    /* The font program is optional */\r\n    error = face->goto_table( face, TTAG_fpgm, stream, &table_len );\r\n    if ( error )\r\n    {\r\n      face->font_program      = NULL;\r\n      face->font_program_size = 0;\r\n      error                   = TT_Err_Ok;\r\n\r\n      FT_TRACE2(( \"is missing\\n\" ));\r\n    }\r\n    else\r\n    {\r\n      face->font_program_size = table_len;\r\n      if ( FT_FRAME_EXTRACT( table_len, face->font_program ) )\r\n        goto Exit;\r\n\r\n      FT_TRACE2(( \"loaded, %12d bytes\\n\", face->font_program_size ));\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n#else /* !TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    FT_UNUSED( face   );\r\n    FT_UNUSED( stream );\r\n\r\n    return TT_Err_Ok;\r\n\r\n#endif\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_prep                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the cvt program.                                              */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_prep( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n    FT_Error  error;\r\n    FT_ULong  table_len;\r\n\r\n\r\n    FT_TRACE2(( \"Prep program \" ));\r\n\r\n    error = face->goto_table( face, TTAG_prep, stream, &table_len );\r\n    if ( error )\r\n    {\r\n      face->cvt_program      = NULL;\r\n      face->cvt_program_size = 0;\r\n      error                  = TT_Err_Ok;\r\n\r\n      FT_TRACE2(( \"is missing\\n\" ));\r\n    }\r\n    else\r\n    {\r\n      face->cvt_program_size = table_len;\r\n      if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) )\r\n        goto Exit;\r\n\r\n      FT_TRACE2(( \"loaded, %12d bytes\\n\", face->cvt_program_size ));\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n#else /* !TT_USE_BYTECODE_INTERPRETER */\r\n\r\n    FT_UNUSED( face   );\r\n    FT_UNUSED( stream );\r\n\r\n    return TT_Err_Ok;\r\n\r\n#endif\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    tt_face_load_hdmx                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the `hdmx' table into the face object.                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the input stream.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  tt_face_load_hdmx( TT_Face    face,\r\n                     FT_Stream  stream )\r\n  {\r\n    FT_Error   error;\r\n    FT_Memory  memory = stream->memory;\r\n    FT_UInt    version, nn, num_records;\r\n    FT_ULong   table_size, record_size;\r\n    FT_Byte*   p;\r\n    FT_Byte*   limit;\r\n\r\n\r\n    /* this table is optional */\r\n    error = face->goto_table( face, TTAG_hdmx, stream, &table_size );\r\n    if ( error || table_size < 8 )\r\n      return TT_Err_Ok;\r\n\r\n    if ( FT_FRAME_EXTRACT( table_size, face->hdmx_table ) )\r\n      goto Exit;\r\n\r\n    p     = face->hdmx_table;\r\n    limit = p + table_size;\r\n\r\n    version     = FT_NEXT_USHORT( p );\r\n    num_records = FT_NEXT_USHORT( p );\r\n    record_size = FT_NEXT_ULONG( p );\r\n\r\n    /* The maximum number of bytes in an hdmx device record is the */\r\n    /* maximum number of glyphs + 2; this is 0xFFFF + 2; this is   */\r\n    /* the reason why `record_size' is a long (which we read as    */\r\n    /* unsigned long for convenience).  In practice, two bytes     */\r\n    /* sufficient to hold the size value.                          */\r\n    /*                                                             */\r\n    /* There are at least two fonts, HANNOM-A and HANNOM-B version */\r\n    /* 2.0 (2005), which get this wrong: The upper two bytes of    */\r\n    /* the size value are set to 0xFF instead of 0x00.  We catch   */\r\n    /* and fix this.                                               */\r\n\r\n    if ( record_size >= 0xFFFF0000UL )\r\n      record_size &= 0xFFFFU;\r\n\r\n    /* The limit for `num_records' is a heuristic value. */\r\n\r\n    if ( version != 0 || num_records > 255 || record_size > 0x10001L )\r\n    {\r\n      error = TT_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( FT_NEW_ARRAY( face->hdmx_record_sizes, num_records ) )\r\n      goto Fail;\r\n\r\n    for ( nn = 0; nn < num_records; nn++ )\r\n    {\r\n      if ( p + record_size > limit )\r\n        break;\r\n\r\n      face->hdmx_record_sizes[nn] = p[0];\r\n      p                          += record_size;\r\n    }\r\n\r\n    face->hdmx_record_count = nn;\r\n    face->hdmx_table_size   = table_size;\r\n    face->hdmx_record_size  = record_size;\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    FT_FRAME_RELEASE( face->hdmx_table );\r\n    face->hdmx_table_size = 0;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  tt_face_free_hdmx( TT_Face  face )\r\n  {\r\n    FT_Stream  stream = face->root.stream;\r\n    FT_Memory  memory = stream->memory;\r\n\r\n\r\n    FT_FREE( face->hdmx_record_sizes );\r\n    FT_FRAME_RELEASE( face->hdmx_table );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Return the advance width table for a given pixel size if it is found  */\r\n  /* in the font's `hdmx' table (if any).                                  */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Byte* )\r\n  tt_face_get_device_metrics( TT_Face  face,\r\n                              FT_UInt  ppem,\r\n                              FT_UInt  gindex )\r\n  {\r\n    FT_UInt   nn;\r\n    FT_Byte*  result      = NULL;\r\n    FT_ULong  record_size = face->hdmx_record_size;\r\n    FT_Byte*  record      = face->hdmx_table + 8;\r\n\r\n\r\n    for ( nn = 0; nn < face->hdmx_record_count; nn++ )\r\n      if ( face->hdmx_record_sizes[nn] == ppem )\r\n      {\r\n        gindex += 2;\r\n        if ( gindex < record_size )\r\n          result = record + nn * record_size + gindex;\r\n        break;\r\n      }\r\n\r\n    return result;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttpload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttpload.h                                                              */\r\n/*                                                                         */\r\n/*    TrueType-specific tables loader (specification).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2005, 2006 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTPLOAD_H__\r\n#define __TTPLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_loca( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n  FT_LOCAL( FT_ULong )\r\n  tt_face_get_location( TT_Face   face,\r\n                        FT_UInt   gindex,\r\n                        FT_UInt  *asize );\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_done_loca( TT_Face  face );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_cvt( TT_Face    face,\r\n                    FT_Stream  stream );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_fpgm( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_prep( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  tt_face_load_hdmx( TT_Face    face,\r\n                     FT_Stream  stream );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  tt_face_free_hdmx( TT_Face  face );\r\n\r\n\r\n  FT_LOCAL( FT_Byte* )\r\n  tt_face_get_device_metrics( TT_Face    face,\r\n                              FT_UInt    ppem,\r\n                              FT_UInt    gindex );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTPLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttsubpix.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttsubpix.c                                                             */\r\n/*                                                                         */\r\n/*    TrueType Subpixel Hinting.                                           */\r\n/*                                                                         */\r\n/*  Copyright 2010-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_SFNT_H\r\n#include FT_TRUETYPE_TAGS_H\r\n#include FT_OUTLINE_H\r\n\r\n#include \"ttsubpix.h\"\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  is_member_of_family_class( const FT_String*  detected_font_name,\r\n                             const FT_String*  rule_font_name )\r\n  {\r\n    FT_UInt  i, j;\r\n\r\n\r\n    /* Does font name match rule family? */\r\n    if ( strcmp( detected_font_name, rule_font_name ) == 0 )\r\n      return TRUE;\r\n\r\n    /* Is font name a wildcard \"\"? */\r\n    if ( strcmp( rule_font_name, \"\" ) == 0 )\r\n      return TRUE;\r\n\r\n    /* Is font name contained in a class list? */\r\n    for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ )\r\n    {\r\n      if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 )\r\n      {\r\n        for ( j = 0; j < MAX_CLASS_MEMBERS; j++ )\r\n        {\r\n          if ( strcmp( FAMILY_CLASS_Rules[i].member[j], \"\" ) == 0 )\r\n            continue;\r\n          if ( strcmp( FAMILY_CLASS_Rules[i].member[j],\r\n                       detected_font_name ) == 0 )\r\n            return TRUE;\r\n        }\r\n      }\r\n    }\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  is_member_of_style_class( const FT_String*  detected_font_style,\r\n                            const FT_String*  rule_font_style )\r\n  {\r\n    FT_UInt  i, j;\r\n\r\n\r\n    /* Does font style match rule style? */\r\n    if ( strcmp( detected_font_style, rule_font_style ) == 0 )\r\n      return TRUE;\r\n\r\n    /* Is font style a wildcard \"\"? */\r\n    if ( strcmp( rule_font_style, \"\" ) == 0 )\r\n      return TRUE;\r\n\r\n    /* Is font style contained in a class list? */\r\n    for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ )\r\n    {\r\n      if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 )\r\n      {\r\n        for ( j = 0; j < MAX_CLASS_MEMBERS; j++ )\r\n        {\r\n          if ( strcmp( STYLE_CLASS_Rules[i].member[j], \"\" ) == 0 )\r\n            continue;\r\n          if ( strcmp( STYLE_CLASS_Rules[i].member[j],\r\n                       detected_font_style ) == 0 )\r\n            return TRUE;\r\n        }\r\n      }\r\n    }\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Bool )\r\n  sph_test_tweak( TT_Face         face,\r\n                  FT_String*      family,\r\n                  FT_UInt         ppem,\r\n                  FT_String*      style,\r\n                  FT_UInt         glyph_index,\r\n                  SPH_TweakRule*  rule,\r\n                  FT_UInt         num_rules )\r\n  {\r\n    FT_UInt  i;\r\n\r\n\r\n    /* rule checks may be able to be optimized further */\r\n    for ( i = 0; i < num_rules; i++ )\r\n    {\r\n      if ( family                                                   &&\r\n           ( is_member_of_family_class ( family, rule[i].family ) ) )\r\n        if ( rule[i].ppem == 0    ||\r\n             rule[i].ppem == ppem )\r\n          if ( style                                             &&\r\n               is_member_of_style_class ( style, rule[i].style ) )\r\n            if ( rule[i].glyph == 0                                ||\r\n                 FT_Get_Char_Index( (FT_Face)face,\r\n                                    rule[i].glyph ) == glyph_index )\r\n        return TRUE;\r\n    }\r\n\r\n    return FALSE;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  scale_test_tweak( TT_Face         face,\r\n                    FT_String*      family,\r\n                    FT_UInt         ppem,\r\n                    FT_String*      style,\r\n                    FT_UInt         glyph_index,\r\n                    SPH_ScaleRule*  rule,\r\n                    FT_UInt         num_rules )\r\n  {\r\n    FT_UInt  i;\r\n\r\n\r\n    /* rule checks may be able to be optimized further */\r\n    for ( i = 0; i < num_rules; i++ )\r\n    {\r\n      if ( family                                                   &&\r\n           ( is_member_of_family_class ( family, rule[i].family ) ) )\r\n        if ( rule[i].ppem == 0    ||\r\n             rule[i].ppem == ppem )\r\n          if ( style                                            &&\r\n               is_member_of_style_class( style, rule[i].style ) )\r\n            if ( rule[i].glyph == 0                                ||\r\n                 FT_Get_Char_Index( (FT_Face)face,\r\n                                    rule[i].glyph ) == glyph_index )\r\n        return rule[i].scale;\r\n    }\r\n\r\n    return 1000;\r\n  }\r\n\r\n\r\n#define TWEAK_RULES( x )                                       \\\r\n  if ( sph_test_tweak( face, family, ppem, style, glyph_index, \\\r\n                       x##_Rules, x##_RULES_SIZE ) )           \\\r\n    loader->exec->sph_tweak_flags |= SPH_TWEAK_##x;\r\n\r\n#define TWEAK_RULES_EXCEPTIONS( x )                                        \\\r\n  if ( sph_test_tweak( face, family, ppem, style, glyph_index,             \\\r\n                       x##_Rules_Exceptions, x##_RULES_EXCEPTIONS_SIZE ) ) \\\r\n    loader->exec->sph_tweak_flags &= ~SPH_TWEAK_##x;\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  sph_set_tweaks( TT_Loader  loader,\r\n                  FT_UInt    glyph_index )\r\n  {\r\n    TT_Face     face   = (TT_Face)loader->face;\r\n    FT_String*  family = face->root.family_name;\r\n    int         ppem   = loader->size->metrics.x_ppem;\r\n    FT_String*  style  = face->root.style_name;\r\n\r\n\r\n    /* don't apply rules if style isn't set */\r\n    if ( !face->root.style_name )\r\n      return;\r\n\r\n#ifdef SPH_DEBUG_MORE_VERBOSE\r\n    printf( \"%s,%d,%s,%c=%d \",\r\n            family, ppem, style, glyph_index, glyph_index );\r\n#endif\r\n\r\n    TWEAK_RULES( PIXEL_HINTING );\r\n\r\n    if ( loader->exec->sph_tweak_flags & SPH_TWEAK_PIXEL_HINTING )\r\n    {\r\n      loader->exec->ignore_x_mode = FALSE;\r\n      return;\r\n    }\r\n\r\n    TWEAK_RULES( ALLOW_X_DMOVE );\r\n    TWEAK_RULES( ALLOW_X_DMOVEX );\r\n    TWEAK_RULES( ALLOW_X_MOVE_ZP2 );\r\n    TWEAK_RULES( ALWAYS_DO_DELTAP );\r\n    TWEAK_RULES( ALWAYS_SKIP_DELTAP );\r\n    TWEAK_RULES( DEEMBOLDEN );\r\n    TWEAK_RULES( DELTAP_SKIP_EXAGGERATED_VALUES );\r\n    TWEAK_RULES( DO_SHPIX );\r\n    TWEAK_RULES( EMBOLDEN );\r\n    TWEAK_RULES( MIAP_HACK );\r\n    TWEAK_RULES( NORMAL_ROUND );\r\n    TWEAK_RULES( NO_ALIGNRP_AFTER_IUP );\r\n    TWEAK_RULES( NO_CALL_AFTER_IUP );\r\n    TWEAK_RULES( NO_DELTAP_AFTER_IUP );\r\n    TWEAK_RULES( RASTERIZER_35 );\r\n    TWEAK_RULES( SKIP_INLINE_DELTAS );\r\n    TWEAK_RULES( SKIP_IUP );\r\n    TWEAK_RULES( MIRP_CVT_ZERO );\r\n\r\n    TWEAK_RULES( SKIP_OFFPIXEL_Y_MOVES );\r\n    TWEAK_RULES_EXCEPTIONS( SKIP_OFFPIXEL_Y_MOVES );\r\n\r\n    TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES );\r\n    TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES );\r\n\r\n    TWEAK_RULES( ROUND_NONPIXEL_Y_MOVES );\r\n    TWEAK_RULES_EXCEPTIONS( ROUND_NONPIXEL_Y_MOVES );\r\n\r\n    if ( loader->exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )\r\n      loader->exec->rasterizer_version = 35;\r\n    else\r\n      loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;\r\n\r\n    /* re-execute fpgm always to avoid problems */\r\n    loader->exec->size->cvt_ready = FALSE;\r\n    tt_size_ready_bytecode( loader->exec->size,\r\n                            FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) );\r\n\r\n    if ( IS_HINTED( loader->load_flags ) )\r\n    {\r\n      TWEAK_RULES( TIMES_NEW_ROMAN_HACK );\r\n      TWEAK_RULES( COURIER_NEW_2_HACK );\r\n    }\r\n\r\n    if ( sph_test_tweak( face, family, ppem, style, glyph_index,\r\n           COMPATIBILITY_MODE_Rules, COMPATIBILITY_MODE_RULES_SIZE ) )\r\n    {\r\n      loader->exec->compatibility_mode |= TRUE;\r\n      loader->exec->ignore_x_mode      |= TRUE;\r\n    }\r\n    else\r\n      loader->exec->compatibility_mode &= FALSE;\r\n\r\n    if ( IS_HINTED( loader->load_flags ) )\r\n    {\r\n      if ( sph_test_tweak( face, family, ppem, style, glyph_index,\r\n             COMPATIBLE_WIDTHS_Rules, COMPATIBLE_WIDTHS_RULES_SIZE ) )\r\n        loader->exec->compatible_widths |= TRUE;\r\n    }\r\n  }\r\n\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/truetype/ttsubpix.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttsubpix.h                                                             */\r\n/*                                                                         */\r\n/*    TrueType Subpixel Hinting.                                           */\r\n/*                                                                         */\r\n/*  Copyright 2010-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTSUBPIX_H__\r\n#define __TTSUBPIX_H__\r\n\r\n#include <ft2build.h>\r\n#include \"ttobjs.h\"\r\n#include \"ttinterp.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Tweak flags that are set for each glyph by the below rules.           */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n#define SPH_TWEAK_ALLOW_X_DMOVE                   0x0000001\r\n#define SPH_TWEAK_ALLOW_X_DMOVEX                  0x0000002\r\n#define SPH_TWEAK_ALLOW_X_MOVE_ZP2                0x0000004\r\n#define SPH_TWEAK_ALWAYS_DO_DELTAP                0x0000008\r\n#define SPH_TWEAK_ALWAYS_SKIP_DELTAP              0x0000010\r\n#define SPH_TWEAK_COURIER_NEW_2_HACK              0x0000020\r\n#define SPH_TWEAK_DEEMBOLDEN                      0x0000040\r\n#define SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES  0x0000080\r\n#define SPH_TWEAK_DO_SHPIX                        0x0000100\r\n#define SPH_TWEAK_EMBOLDEN                        0x0000200\r\n#define SPH_TWEAK_MIAP_HACK                       0x0000400\r\n#define SPH_TWEAK_NORMAL_ROUND                    0x0000800\r\n#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP            0x0001000\r\n#define SPH_TWEAK_NO_CALL_AFTER_IUP               0x0002000\r\n#define SPH_TWEAK_NO_DELTAP_AFTER_IUP             0x0004000\r\n#define SPH_TWEAK_PIXEL_HINTING                   0x0008000\r\n#define SPH_TWEAK_RASTERIZER_35                   0x0010000\r\n#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES          0x0020000\r\n#define SPH_TWEAK_SKIP_INLINE_DELTAS              0x0040000\r\n#define SPH_TWEAK_SKIP_IUP                        0x0080000\r\n#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES           0x0100000\r\n#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES           0x0200000\r\n#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK            0x0400000\r\n#define SPH_TWEAK_MIRP_CVT_ZERO                   0x0800000\r\n\r\n\r\n  FT_LOCAL( FT_Bool )\r\n  sph_test_tweak( TT_Face         face,\r\n                  FT_String*      family,\r\n                  FT_UInt         ppem,\r\n                  FT_String*      style,\r\n                  FT_UInt         glyph_index,\r\n                  SPH_TweakRule*  rule,\r\n                  FT_UInt         num_rules );\r\n\r\n  FT_LOCAL_DEF( FT_UInt )\r\n  scale_test_tweak( TT_Face         face,\r\n                    FT_String*      family,\r\n                    FT_UInt         ppem,\r\n                    FT_String*      style,\r\n                    FT_UInt         glyph_index,\r\n                    SPH_ScaleRule*  rule,\r\n                    FT_UInt         num_rules );\r\n\r\n  FT_LOCAL( void )\r\n  sph_set_tweaks( TT_Loader  loader,\r\n                  FT_UInt    glyph_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* These rules affect how the TT Interpreter does hinting, with the      */\r\n  /* goal of doing subpixel hinting by (in general) ignoring x moves.      */\r\n  /* Some of these rules are fixes that go above and beyond the            */\r\n  /* stated techniques in the MS whitepaper on Cleartype, due to           */\r\n  /* artifacts in many glyphs.  So, these rules make some glyphs render    */\r\n  /* better than they do in the MS rasterizer.                             */\r\n  /*                                                                       */\r\n  /* \"\" string or 0 int/char indicates to apply to all glyphs.             */\r\n  /* \"-\" used as dummy placeholders, but any non-matching string works.    */\r\n  /*                                                                       */\r\n  /* Some of this could arguably be implemented in fontconfig, however:    */\r\n  /*                                                                       */\r\n  /*  - Fontconfig can't set things on a glyph-by-glyph basis.             */\r\n  /*  - The tweaks that happen here are very low-level, from an average    */\r\n  /*    user's point of view and are best implemented in the hinter.       */\r\n  /*                                                                       */\r\n  /* The goal is to make the subpixel hinting techniques as generalized    */\r\n  /* as possible across all fonts to prevent the need for extra rules such */\r\n  /* as these.                                                             */\r\n  /*                                                                       */\r\n  /* The rule structure is designed so that entirely new rules can easily  */\r\n  /* be added when a new compatibility feature is discovered.              */\r\n  /*                                                                       */\r\n  /* The rule structures could also use some enhancement to handle ranges. */\r\n  /*                                                                       */\r\n  /*     ****************** WORK IN PROGRESS *******************           */\r\n  /*                                                                       */\r\n\r\n  /* These macros are defined absent a method for setting them */\r\n#define SPH_OPTION_BITMAP_WIDTHS           FALSE\r\n#define SPH_OPTION_SET_SUBPIXEL            TRUE\r\n#define SPH_OPTION_SET_GRAYSCALE           FALSE\r\n#define SPH_OPTION_SET_COMPATIBLE_WIDTHS   FALSE\r\n#define SPH_OPTION_SET_RASTERIZER_VERSION  38\r\n\r\n\r\n  /* Define this to force natural (i.e. not bitmap-compatible) widths.     */\r\n  /* The default leans strongly towards natural widths except for a few    */\r\n  /* legacy fonts where a selective combination produces nicer results.    */\r\n/* #define FORCE_NATURAL_WIDTHS   */\r\n\r\n\r\n  /* These are `classes' of fonts that can be grouped together and used in */\r\n  /* rules below.  A blank entry \"\" is required at the end of these!       */\r\n#define FAMILY_CLASS_RULES_SIZE  7\r\n\r\n  Font_Class FAMILY_CLASS_Rules\r\n               [FAMILY_CLASS_RULES_SIZE] =\r\n  {\r\n    { \"MS Legacy Fonts\",\r\n      { \"Aharoni\",\r\n        \"Andale Mono\",\r\n        \"Andalus\",\r\n        \"Angsana New\",\r\n        \"AngsanaUPC\",\r\n        \"Arabic Transparent\",\r\n        \"Arial Black\",\r\n        \"Arial Narrow\",\r\n        \"Arial Unicode MS\",\r\n        \"Arial\",\r\n        \"Batang\",\r\n        \"Browallia New\",\r\n        \"BrowalliaUPC\",\r\n        \"Comic Sans MS\",\r\n        \"Cordia New\",\r\n        \"CordiaUPC\",\r\n        \"Courier New\",\r\n        \"DFKai-SB\",\r\n        \"David Transparent\",\r\n        \"David\",\r\n        \"DilleniaUPC\",\r\n        \"Estrangelo Edessa\",\r\n        \"EucrosiaUPC\",\r\n        \"FangSong_GB2312\",\r\n        \"Fixed Miriam Transparent\",\r\n        \"FrankRuehl\",\r\n        \"Franklin Gothic Medium\",\r\n        \"FreesiaUPC\",\r\n        \"Garamond\",\r\n        \"Gautami\",\r\n        \"Georgia\",\r\n        \"Gulim\",\r\n        \"Impact\",\r\n        \"IrisUPC\",\r\n        \"JasmineUPC\",\r\n        \"KaiTi_GB2312\",\r\n        \"KodchiangUPC\",\r\n        \"Latha\",\r\n        \"Levenim MT\",\r\n        \"LilyUPC\",\r\n        \"Lucida Console\",\r\n        \"Lucida Sans Unicode\",\r\n        \"MS Gothic\",\r\n        \"MS Mincho\",\r\n        \"MV Boli\",\r\n        \"Mangal\",\r\n        \"Marlett\",\r\n        \"Microsoft Sans Serif\",\r\n        \"Mingliu\",\r\n        \"Miriam Fixed\",\r\n        \"Miriam Transparent\",\r\n        \"Miriam\",\r\n        \"Narkisim\",\r\n        \"Palatino Linotype\",\r\n        \"Raavi\",\r\n        \"Rod Transparent\",\r\n        \"Rod\",\r\n        \"Shruti\",\r\n        \"SimHei\",\r\n        \"Simplified Arabic Fixed\",\r\n        \"Simplified Arabic\",\r\n        \"Simsun\",\r\n        \"Sylfaen\",\r\n        \"Symbol\",\r\n        \"Tahoma\",\r\n        \"Times New Roman\",\r\n        \"Traditional Arabic\",\r\n        \"Trebuchet MS\",\r\n        \"Tunga\",\r\n        \"Verdana\",\r\n        \"Webdings\",\r\n        \"Wingdings\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Core MS Legacy Fonts\",\r\n      { \"Arial Black\",\r\n        \"Arial Narrow\",\r\n        \"Arial Unicode MS\",\r\n        \"Arial\",\r\n        \"Comic Sans MS\",\r\n        \"Courier New\",\r\n        \"Garamond\",\r\n        \"Georgia\",\r\n        \"Impact\",\r\n        \"Lucida Console\",\r\n        \"Lucida Sans Unicode\",\r\n        \"Microsoft Sans Serif\",\r\n        \"Palatino Linotype\",\r\n        \"Tahoma\",\r\n        \"Times New Roman\",\r\n        \"Trebuchet MS\",\r\n        \"Verdana\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Apple Legacy Fonts\",\r\n      { \"Geneva\",\r\n        \"Times\",\r\n        \"Monaco\",\r\n        \"Century\",\r\n        \"Chalkboard\",\r\n        \"Lobster\",\r\n        \"Century Gothic\",\r\n        \"Optima\",\r\n        \"Lucida Grande\",\r\n        \"Gill Sans\",\r\n        \"Baskerville\",\r\n        \"Helvetica\",\r\n        \"Helvetica Neue\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Legacy Sans Fonts\",\r\n      { \"Andale Mono\",\r\n        \"Arial Unicode MS\",\r\n        \"Arial\",\r\n        \"Century Gothic\",\r\n        \"Comic Sans MS\",\r\n        \"Franklin Gothic Medium\",\r\n        \"Geneva\",\r\n        \"Lucida Console\",\r\n        \"Lucida Grande\",\r\n        \"Lucida Sans Unicode\",\r\n        \"Lucida Sans Typewriter\",\r\n        \"Microsoft Sans Serif\",\r\n        \"Monaco\",\r\n        \"Tahoma\",\r\n        \"Trebuchet MS\",\r\n        \"Verdana\",\r\n        \"\",\r\n      },\r\n    },\r\n\r\n    { \"Misc Legacy Fonts\",\r\n      { \"Dark Courier\", \"\", }, },\r\n    { \"Verdana Clones\",\r\n      { \"DejaVu Sans\",\r\n        \"Bitstream Vera Sans\", \"\", }, },\r\n    { \"Verdana and Clones\",\r\n      { \"DejaVu Sans\",\r\n        \"Bitstream Vera Sans\",\r\n        \"Verdana\", \"\", }, },\r\n  };\r\n\r\n\r\n  /* Define `classes' of styles that can be grouped together and used in   */\r\n  /* rules below.  A blank entry \"\" is required at the end of these!       */\r\n#define STYLE_CLASS_RULES_SIZE  5\r\n\r\n  Font_Class STYLE_CLASS_Rules\r\n               [STYLE_CLASS_RULES_SIZE] =\r\n  {\r\n    { \"Regular Class\",\r\n      { \"Regular\",\r\n        \"Book\",\r\n        \"Medium\",\r\n        \"Roman\",\r\n        \"Normal\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Regular/Italic Class\",\r\n      { \"Regular\",\r\n        \"Book\",\r\n        \"Medium\",\r\n        \"Italic\",\r\n        \"Oblique\",\r\n        \"Roman\",\r\n        \"Normal\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Bold/BoldItalic Class\",\r\n      { \"Bold\",\r\n        \"Bold Italic\",\r\n        \"Black\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Bold/Italic/BoldItalic Class\",\r\n      { \"Bold\",\r\n        \"Bold Italic\",\r\n        \"Black\",\r\n        \"Italic\",\r\n        \"Oblique\",\r\n        \"\",\r\n      },\r\n    },\r\n    { \"Regular/Bold Class\",\r\n      { \"Regular\",\r\n        \"Book\",\r\n        \"Medium\",\r\n        \"Normal\",\r\n        \"Roman\",\r\n        \"Bold\",\r\n        \"Black\",\r\n        \"\",\r\n      },\r\n    },\r\n  };\r\n\r\n\r\n  /* Special fixes for known legacy fonts;                                 */\r\n  /* this is the primary workhorse rule for legacy fonts                   */\r\n#define COMPATIBILITY_MODE_RULES_SIZE  4\r\n\r\n  SPH_TweakRule  COMPATIBILITY_MODE_Rules\r\n                   [COMPATIBILITY_MODE_RULES_SIZE] =\r\n  {\r\n    { \"MS Legacy Fonts\", 0, \"\", 0 },\r\n    { \"Apple Legacy Fonts\", 0, \"\", 0 },\r\n    { \"Misc Legacy Fonts\", 0, \"\", 0 },\r\n    { \"Verdana Clones\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting.         */\r\n#define PIXEL_HINTING_RULES_SIZE  4\r\n\r\n  SPH_TweakRule  PIXEL_HINTING_Rules\r\n                   [PIXEL_HINTING_RULES_SIZE] =\r\n  {\r\n    /* these characters are almost always safe */\r\n    { \"\", 0, \"\", '<' },\r\n    { \"\", 0, \"\", '>' },\r\n    /* fixes the vanishing stem */\r\n    { \"Times New Roman\", 0, \"Bold\", 'A' },\r\n    { \"Times New Roman\", 0, \"Bold\", 'V' },\r\n  };\r\n\r\n\r\n  /* According to Greg Hitchcock and the MS whitepaper, this should work   */\r\n  /* on all legacy MS fonts, but creates artifacts with some.  Only using  */\r\n  /* where absolutely necessary.                                           */\r\n#define SKIP_INLINE_DELTAS_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  SKIP_INLINE_DELTAS_Rules\r\n                   [SKIP_INLINE_DELTAS_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Subpixel hinting ignores SHPIX rules on X.  Force SHPIX for these.    */\r\n#define DO_SHPIX_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  DO_SHPIX_Rules\r\n                   [DO_SHPIX_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Skip Y moves that start with a point that is not on a Y pixel         */\r\n  /* boundary and don't move that point to a Y pixel boundary.             */\r\n#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE  10\r\n\r\n  SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_Rules\r\n                   [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] =\r\n  {\r\n    /* fix vwxyz thinness*/\r\n    { \"Consolas\", 0, \"Regular\", 0 },\r\n    /* fix tiny gap at top of m */\r\n    { \"Arial\", 0, \"Regular\", 'm' },\r\n    /* Fix thin middle stems */\r\n    { \"Core MS Legacy Fonts\", 0, \"Regular/Bold Class\", 'N' },\r\n    { \"Lucida Grande\", 0, \"\", 'N' },\r\n    { \"Lucida Grande\", 0, \"Bold\", 'y' },\r\n    /* Cyrillic small letter I */\r\n    { \"Legacy Sans Fonts\", 0, \"\", 0x438 },\r\n    { \"Verdana Clones\", 0, \"\",'N' },\r\n    { \"Ubuntu\", 0, \"Regular Class\", 'N' },\r\n    /* Fix misshapen x */\r\n    { \"Verdana\", 0, \"Bold\", 'x' },\r\n    /* Fix misshapen s */\r\n    { \"Tahoma\", 0, \"\", 's' },\r\n  };\r\n\r\n\r\n#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  6\r\n\r\n  SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions\r\n                   [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =\r\n  {\r\n    { \"Tahoma\", 0, \"\", 'N' },\r\n    { \"Comic Sans MS\", 0, \"\", 'N' },\r\n    { \"Verdana\", 0, \"Regular/Bold Class\", 'N' },\r\n    { \"Verdana\", 11, \"Bold\", 'x' },\r\n    /* Cyrillic small letter I */\r\n    { \"Arial\", 0, \"\", 0x438 },\r\n    { \"Trebuchet MS\", 0, \"Bold\", 0 },\r\n  };\r\n\r\n\r\n  /* Skip Y moves that move a point off a Y pixel boundary.                */\r\n  /* This fixes Tahoma, Trebuchet oddities and some issues with `$'.       */\r\n#define SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE  5\r\n\r\n  SPH_TweakRule  SKIP_OFFPIXEL_Y_MOVES_Rules\r\n                   [SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE] =\r\n  {\r\n    { \"MS Legacy Fonts\", 0, \"\", 0 },\r\n    { \"Apple Legacy Fonts\", 0, \"\", 0 },\r\n    { \"Misc Legacy Fonts\", 0, \"\", 0 },\r\n    { \"Ubuntu\", 0, \"Regular Class\", 0 },\r\n    { \"Verdana Clones\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n#define SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  1\r\n\r\n  SPH_TweakRule  SKIP_OFFPIXEL_Y_MOVES_Rules_Exceptions\r\n                   [SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Round moves that don't move a point to a Y pixel boundary.            */\r\n#define ROUND_NONPIXEL_Y_MOVES_RULES_SIZE  3\r\n\r\n  SPH_TweakRule  ROUND_NONPIXEL_Y_MOVES_Rules\r\n                   [ROUND_NONPIXEL_Y_MOVES_RULES_SIZE] =\r\n  {\r\n    /* Droid font instructions don't snap Y to pixels */\r\n    { \"Droid Sans\", 0, \"Regular/Italic Class\", 0 },\r\n    { \"Droid Sans Mono\", 0, \"\", 0 },\r\n    { \"Ubuntu\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n#define ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  3\r\n\r\n  SPH_TweakRule  ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions\r\n                   [ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =\r\n  {\r\n    { \"Droid Sans\", 12, \"Bold\", 0 },\r\n    { \"Droid Sans\", 13, \"Bold\", 0 },\r\n    { \"Droid Sans\", 16, \"Bold\", 0 },\r\n  };\r\n\r\n\r\n  /* Allow a Direct_Move_X along X freedom vector if matched.              */\r\n#define ALLOW_X_DMOVEX_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  ALLOW_X_DMOVEX_Rules\r\n                   [ALLOW_X_DMOVEX_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"Regular\", 0 },\r\n  };\r\n\r\n\r\n  /* Allow a Direct_Move along X freedom vector if matched.                */\r\n#define ALLOW_X_DMOVE_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  ALLOW_X_DMOVE_Rules\r\n                   [ALLOW_X_DMOVE_RULES_SIZE] =\r\n  {\r\n    /* Fixes vanishing diagonal in 4 */\r\n    { \"Verdana\", 0, \"Regular\", '4' },\r\n  };\r\n\r\n\r\n  /* Allow a ZP2 move along freedom vector if matched;                     */\r\n  /* This is called from SHP, SHPIX, SHC, SHZ.                             */\r\n#define ALLOW_X_MOVE_ZP2_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  ALLOW_X_MOVE_ZP2_Rules\r\n                   [ALLOW_X_MOVE_ZP2_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Return MS rasterizer version 35 if matched.                           */\r\n#define RASTERIZER_35_RULES_SIZE  8\r\n\r\n  SPH_TweakRule  RASTERIZER_35_Rules\r\n                   [RASTERIZER_35_RULES_SIZE] =\r\n  {\r\n    /* This seems to be the only way to make these look good */\r\n    { \"Times New Roman\", 0, \"Regular\", 'i' },\r\n    { \"Times New Roman\", 0, \"Regular\", 'j' },\r\n    { \"Times New Roman\", 0, \"Regular\", 'm' },\r\n    { \"Times New Roman\", 0, \"Regular\", 'r' },\r\n    { \"Times New Roman\", 0, \"Regular\", 'a' },\r\n    { \"Times New Roman\", 0, \"Regular\", 'n' },\r\n    { \"Times New Roman\", 0, \"Regular\", 'p' },\r\n    { \"Times\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Don't round to the subpixel grid.  Round to pixel grid.               */\r\n#define NORMAL_ROUND_RULES_SIZE  2\r\n\r\n  SPH_TweakRule  NORMAL_ROUND_Rules\r\n                   [NORMAL_ROUND_RULES_SIZE] =\r\n  {\r\n    /* Fix point \"explosions\" */\r\n    { \"Courier New\", 0, \"\", 0 },\r\n    { \"Verdana\", 10, \"Regular\", '4' },\r\n  };\r\n\r\n\r\n  /* Skip IUP instructions if matched.                                     */\r\n#define SKIP_IUP_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  SKIP_IUP_Rules\r\n                   [SKIP_IUP_RULES_SIZE] =\r\n  {\r\n    { \"Arial\", 13, \"Regular\", 'a' },\r\n  };\r\n\r\n\r\n  /* Skip MIAP Twilight hack if matched.                                   */\r\n#define MIAP_HACK_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  MIAP_HACK_Rules\r\n                   [MIAP_HACK_RULES_SIZE] =\r\n  {\r\n    { \"Geneva\", 12, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Skip DELTAP instructions if matched.                                  */\r\n#define ALWAYS_SKIP_DELTAP_RULES_SIZE  16\r\n\r\n  SPH_TweakRule  ALWAYS_SKIP_DELTAP_Rules\r\n                   [ALWAYS_SKIP_DELTAP_RULES_SIZE] =\r\n  {\r\n    { \"Georgia\", 0, \"Regular\", 'k' },\r\n    /* fixes problems with W M w */\r\n    { \"Trebuchet MS\", 0, \"Italic\", 0 },\r\n    /* fix various problems with e in different versions */\r\n    { \"Trebuchet MS\", 14, \"Regular\", 'e' },\r\n    { \"Trebuchet MS\", 13, \"Regular\", 'e' },\r\n    { \"Trebuchet MS\", 15, \"Regular\", 'e' },\r\n    { \"Arial\", 11, \"Regular\", 's' },\r\n    { \"Verdana\", 10, \"Regular\", 0 },\r\n    { \"Verdana\", 9, \"Regular\", 0 },\r\n    /* Cyrillic small letter short I */\r\n    { \"Legacy Sans Fonts\", 0, \"\", 0x438 },\r\n    { \"Legacy Sans Fonts\", 0, \"\", 0x439 },\r\n    { \"Arial\", 10, \"Regular\", '6' },\r\n    { \"Arial\", 0, \"Bold/BoldItalic Class\", 'a' },\r\n    /* Make horizontal stems consistent with the rest */\r\n    { \"Arial\", 24, \"Bold\", 's' },\r\n    { \"Arial\", 25, \"Bold\", 's' },\r\n    { \"Arial\", 24, \"Bold\", 'a' },\r\n    { \"Arial\", 25, \"Bold\", 'a' },\r\n  };\r\n\r\n\r\n  /* Always do DELTAP instructions if matched.                             */\r\n#define ALWAYS_DO_DELTAP_RULES_SIZE  2\r\n\r\n  SPH_TweakRule  ALWAYS_DO_DELTAP_Rules\r\n                   [ALWAYS_DO_DELTAP_RULES_SIZE] =\r\n  {\r\n    { \"Verdana Clones\", 17, \"Regular Class\", 'K' },\r\n    { \"Verdana Clones\", 17, \"Regular Class\", 'k' },\r\n  };\r\n\r\n\r\n  /* Do an extra RTG instruction in DELTAP if matched.                     */\r\n#define DELTAP_RTG_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  DELTAP_RTG_Rules\r\n                   [DELTAP_RTG_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Force CVT distance to zero in MIRP.                                   */\r\n#define MIRP_CVT_ZERO_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  MIRP_CVT_ZERO_Rules\r\n                   [MIRP_CVT_ZERO_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* Skip moves that meet or exceed 1 pixel.                               */\r\n#define DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  DELTAP_SKIP_EXAGGERATED_VALUES_Rules\r\n                   [DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE] =\r\n  {\r\n    /* Fix vanishing stems */\r\n    { \"Ubuntu\", 0, \"Regular\", 'M' },\r\n  };\r\n\r\n\r\n  /* Don't allow ALIGNRP after IUP.                                        */\r\n#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE  4\r\n\r\n  SPH_TweakRule  NO_ALIGNRP_AFTER_IUP_Rules\r\n                   [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] =\r\n  {\r\n    /* Prevent creation of dents in outline */\r\n    { \"Courier New\", 0, \"Bold\", 'C' },\r\n    { \"Courier New\", 0, \"Bold\", 'D' },\r\n    { \"Courier New\", 0, \"Bold\", 'Q' },\r\n    { \"Courier New\", 0, \"Bold\", '0' },\r\n  };\r\n\r\n\r\n  /* Don't allow DELTAP after IUP.                                         */\r\n#define NO_DELTAP_AFTER_IUP_RULES_SIZE  2\r\n\r\n  SPH_TweakRule  NO_DELTAP_AFTER_IUP_Rules\r\n                   [NO_DELTAP_AFTER_IUP_RULES_SIZE] =\r\n  {\r\n    { \"Arial\", 0, \"Bold\", 'N' },\r\n    { \"Verdana\", 0, \"Regular\", '4' },\r\n  };\r\n\r\n\r\n  /* Don't allow CALL after IUP.                                           */\r\n#define NO_CALL_AFTER_IUP_RULES_SIZE  4\r\n\r\n  SPH_TweakRule  NO_CALL_AFTER_IUP_Rules\r\n                   [NO_CALL_AFTER_IUP_RULES_SIZE] =\r\n  {\r\n    /* Prevent creation of dents in outline */\r\n    { \"Courier New\", 0, \"Bold\", 'O' },\r\n    { \"Courier New\", 0, \"Bold\", 'Q' },\r\n    { \"Courier New\", 0, \"Bold\", 'k' },\r\n    { \"Courier New\", 0, \"Bold Italic\", 'M' },\r\n  };\r\n\r\n\r\n  /* De-embolden these glyphs slightly.                                    */\r\n#define DEEMBOLDEN_RULES_SIZE  9\r\n\r\n  SPH_TweakRule  DEEMBOLDEN_Rules\r\n                   [DEEMBOLDEN_RULES_SIZE] =\r\n  {\r\n    { \"Courier New\", 0, \"Bold\", 'A' },\r\n    { \"Courier New\", 0, \"Bold\", 'W' },\r\n    { \"Courier New\", 0, \"Bold\", 'w' },\r\n    { \"Courier New\", 0, \"Bold\", 'M' },\r\n    { \"Courier New\", 0, \"Bold\", 'X' },\r\n    { \"Courier New\", 0, \"Bold\", 'K' },\r\n    { \"Courier New\", 0, \"Bold\", 'x' },\r\n    { \"Courier New\", 0, \"Bold\", 'z' },\r\n    { \"Courier New\", 0, \"Bold\", 'v' },\r\n  };\r\n\r\n\r\n  /* Embolden these glyphs slightly.                                       */\r\n#define EMBOLDEN_RULES_SIZE  5\r\n\r\n  SPH_TweakRule  EMBOLDEN_Rules\r\n                   [EMBOLDEN_RULES_SIZE] =\r\n  {\r\n    { \"Courier New\", 12, \"Italic\", 'z' },\r\n    { \"Courier New\", 11, \"Italic\", 'z' },\r\n    { \"Courier New\", 10, \"Italic\", 'z' },\r\n    { \"Courier New\", 0, \"Regular\", 0 },\r\n    { \"Courier New\", 0, \"Italic\", 0 },\r\n  };\r\n\r\n\r\n  /* Do an extra RDTG instruction in DELTAP if matched.                    */\r\n#define DELTAP_RDTG_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  DELTAP_RDTG_Rules\r\n                   [DELTAP_RDTG_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n  /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7       */\r\n  /* similar to Windows XP.                                                */\r\n#define TIMES_NEW_ROMAN_HACK_RULES_SIZE  12\r\n\r\n  SPH_TweakRule  TIMES_NEW_ROMAN_HACK_Rules\r\n                   [TIMES_NEW_ROMAN_HACK_RULES_SIZE] =\r\n  {\r\n    { \"Times New Roman\", 16, \"Italic\", '2' },\r\n    { \"Times New Roman\", 16, \"Italic\", '5' },\r\n    { \"Times New Roman\", 16, \"Italic\", '7' },\r\n    { \"Times New Roman\", 16, \"Regular\", '2' },\r\n    { \"Times New Roman\", 16, \"Regular\", '5' },\r\n    { \"Times New Roman\", 16, \"Regular\", '7' },\r\n    { \"Times New Roman\", 17, \"Italic\", '2' },\r\n    { \"Times New Roman\", 17, \"Italic\", '5' },\r\n    { \"Times New Roman\", 17, \"Italic\", '7' },\r\n    { \"Times New Roman\", 17, \"Regular\", '2' },\r\n    { \"Times New Roman\", 17, \"Regular\", '5' },\r\n    { \"Times New Roman\", 17, \"Regular\", '7' },\r\n  };\r\n\r\n\r\n  /* This fudges distance on 2 to get rid of the vanishing stem issue.     */\r\n  /* A real solution to this is certainly welcome.                         */\r\n#define COURIER_NEW_2_HACK_RULES_SIZE  15\r\n\r\n  SPH_TweakRule  COURIER_NEW_2_HACK_Rules\r\n                   [COURIER_NEW_2_HACK_RULES_SIZE] =\r\n  {\r\n    { \"Courier New\", 10, \"Regular\", '2' },\r\n    { \"Courier New\", 11, \"Regular\", '2' },\r\n    { \"Courier New\", 12, \"Regular\", '2' },\r\n    { \"Courier New\", 13, \"Regular\", '2' },\r\n    { \"Courier New\", 14, \"Regular\", '2' },\r\n    { \"Courier New\", 15, \"Regular\", '2' },\r\n    { \"Courier New\", 16, \"Regular\", '2' },\r\n    { \"Courier New\", 17, \"Regular\", '2' },\r\n    { \"Courier New\", 18, \"Regular\", '2' },\r\n    { \"Courier New\", 19, \"Regular\", '2' },\r\n    { \"Courier New\", 20, \"Regular\", '2' },\r\n    { \"Courier New\", 21, \"Regular\", '2' },\r\n    { \"Courier New\", 22, \"Regular\", '2' },\r\n    { \"Courier New\", 23, \"Regular\", '2' },\r\n    { \"Courier New\", 24, \"Regular\", '2' },\r\n  };\r\n\r\n\r\n#ifndef FORCE_NATURAL_WIDTHS\r\n\r\n  /* Use compatible widths with these glyphs.  Compatible widths is always */\r\n  /* on when doing B/W TrueType instructing, but is used selectively here, */\r\n  /* typically on glyphs with 3 or more vertical stems.                    */\r\n#define COMPATIBLE_WIDTHS_RULES_SIZE  38\r\n\r\n  SPH_TweakRule  COMPATIBLE_WIDTHS_Rules\r\n                   [COMPATIBLE_WIDTHS_RULES_SIZE] =\r\n  {\r\n    { \"Arial Unicode MS\", 12, \"Regular Class\", 'm' },\r\n    { \"Arial Unicode MS\", 14, \"Regular Class\", 'm' },\r\n    /* Cyrillic small letter sha */\r\n    { \"Arial\", 10, \"Regular Class\", 0x448 },\r\n    { \"Arial\", 11, \"Regular Class\", 'm' },\r\n    { \"Arial\", 12, \"Regular Class\", 'm' },\r\n    /* Cyrillic small letter sha */\r\n    { \"Arial\", 12, \"Regular Class\", 0x448 },\r\n    { \"Arial\", 13, \"Regular Class\", 0x448 },\r\n    { \"Arial\", 14, \"Regular Class\", 'm' },\r\n    /* Cyrillic small letter sha */\r\n    { \"Arial\", 14, \"Regular Class\", 0x448 },\r\n    { \"Arial\", 15, \"Regular Class\", 0x448 },\r\n    { \"Arial\", 17, \"Regular Class\", 'm' },\r\n    { \"DejaVu Sans\", 15, \"Regular Class\", 0 },\r\n    { \"Microsoft Sans Serif\", 11, \"Regular Class\", 0 },\r\n    { \"Microsoft Sans Serif\", 12, \"Regular Class\", 0 },\r\n    { \"Segoe UI\", 11, \"Regular Class\", 0 },\r\n    { \"Monaco\", 0, \"Regular Class\", 0 },\r\n    { \"Segoe UI\", 12, \"Regular Class\", 'm' },\r\n    { \"Segoe UI\", 14, \"Regular Class\", 'm' },\r\n    { \"Tahoma\", 11, \"Regular Class\", 0 },\r\n    { \"Times New Roman\", 16, \"Regular Class\", 'c' },\r\n    { \"Times New Roman\", 16, \"Regular Class\", 'm' },\r\n    { \"Times New Roman\", 16, \"Regular Class\", 'o' },\r\n    { \"Times New Roman\", 16, \"Regular Class\", 'w' },\r\n    { \"Trebuchet MS\", 11, \"Regular Class\", 0 },\r\n    { \"Trebuchet MS\", 12, \"Regular Class\", 0 },\r\n    { \"Trebuchet MS\", 14, \"Regular Class\", 0 },\r\n    { \"Trebuchet MS\", 15, \"Regular Class\", 0 },\r\n    { \"Ubuntu\", 12, \"Regular Class\", 'm' },\r\n    /* Cyrillic small letter sha */\r\n    { \"Verdana\", 10, \"Regular Class\", 0x448 },\r\n    { \"Verdana\", 11, \"Regular Class\", 0x448 },\r\n    { \"Verdana and Clones\", 12, \"Regular Class\", 'i' },\r\n    { \"Verdana and Clones\", 12, \"Regular Class\", 'j' },\r\n    { \"Verdana and Clones\", 12, \"Regular Class\", 'l' },\r\n    { \"Verdana and Clones\", 12, \"Regular Class\", 'm' },\r\n    { \"Verdana and Clones\", 13, \"Regular Class\", 'i' },\r\n    { \"Verdana and Clones\", 13, \"Regular Class\", 'j' },\r\n    { \"Verdana and Clones\", 13, \"Regular Class\", 'l' },\r\n    { \"Verdana and Clones\", 14, \"Regular Class\", 'm' },\r\n  };\r\n\r\n\r\n  /* Scaling slightly in the x-direction prior to hinting results in       */\r\n  /* more visually pleasing glyphs in certain cases.                       */\r\n  /* This sometimes needs to be coordinated with compatible width rules.   */\r\n  /* A value of 1000 corresponds to a scaled value of 1.0.                 */\r\n#define X_SCALING_RULES_SIZE  50\r\n\r\n  SPH_ScaleRule  X_SCALING_Rules\r\n                   [X_SCALING_RULES_SIZE] =\r\n  {\r\n    { \"DejaVu Sans\", 12, \"Regular Class\", 'm', 950 },\r\n    { \"Verdana and Clones\", 12, \"Regular Class\", 'a', 1100 },\r\n    { \"Verdana and Clones\", 13, \"Regular Class\", 'a', 1050 },\r\n    { \"Arial\", 11, \"Regular Class\", 'm', 975 },\r\n    { \"Arial\", 12, \"Regular Class\", 'm', 1050 },\r\n    /* Cyrillic small letter el */\r\n    { \"Arial\", 13, \"Regular Class\", 0x43B, 950 },\r\n    { \"Arial\", 13, \"Regular Class\", 'o', 950 },\r\n    { \"Arial\", 13, \"Regular Class\", 'e', 950 },\r\n    { \"Arial\", 14, \"Regular Class\", 'm', 950 },\r\n    /* Cyrillic small letter el */\r\n    { \"Arial\", 15, \"Regular Class\", 0x43B, 925 },\r\n    { \"Bitstream Vera Sans\", 10, \"Regular/Italic Class\", 0, 1100 },\r\n    { \"Bitstream Vera Sans\", 12, \"Regular/Italic Class\", 0, 1050 },\r\n    { \"Bitstream Vera Sans\", 16, \"Regular Class\", 0, 1050 },\r\n    { \"Bitstream Vera Sans\", 9, \"Regular/Italic Class\", 0, 1050 },\r\n    { \"DejaVu Sans\", 12, \"Regular Class\", 'l', 975 },\r\n    { \"DejaVu Sans\", 12, \"Regular Class\", 'i', 975 },\r\n    { \"DejaVu Sans\", 12, \"Regular Class\", 'j', 975 },\r\n    { \"DejaVu Sans\", 13, \"Regular Class\", 'l', 950 },\r\n    { \"DejaVu Sans\", 13, \"Regular Class\", 'i', 950 },\r\n    { \"DejaVu Sans\", 13, \"Regular Class\", 'j', 950 },\r\n    { \"DejaVu Sans\", 10, \"Regular/Italic Class\", 0, 1100 },\r\n    { \"DejaVu Sans\", 12, \"Regular/Italic Class\", 0, 1050 },\r\n    { \"Georgia\", 10, \"\", 0, 1050 },\r\n    { \"Georgia\", 11, \"\", 0, 1100 },\r\n    { \"Georgia\", 12, \"\", 0, 1025 },\r\n    { \"Georgia\", 13, \"\", 0, 1050 },\r\n    { \"Georgia\", 16, \"\", 0, 1050 },\r\n    { \"Georgia\", 17, \"\", 0, 1030 },\r\n    { \"Liberation Sans\", 12, \"Regular Class\", 'm', 1100 },\r\n    { \"Lucida Grande\", 11, \"Regular Class\", 'm', 1100 },\r\n    { \"Microsoft Sans Serif\", 11, \"Regular Class\", 'm', 950 },\r\n    { \"Microsoft Sans Serif\", 12, \"Regular Class\", 'm', 1050 },\r\n    { \"Segoe UI\", 12, \"Regular Class\", 'H', 1050 },\r\n    { \"Segoe UI\", 12, \"Regular Class\", 'm', 1050 },\r\n    { \"Segoe UI\", 14, \"Regular Class\", 'm', 1050 },\r\n    { \"Tahoma\", 11, \"Regular Class\", 'i', 975 },\r\n    { \"Tahoma\", 11, \"Regular Class\", 'l', 975 },\r\n    { \"Tahoma\", 11, \"Regular Class\", 'j', 900 },\r\n    { \"Tahoma\", 11, \"Regular Class\", 'm', 918 },\r\n    { \"Verdana\", 10, \"Regular/Italic Class\", 0, 1100 },\r\n    { \"Verdana\", 12, \"Regular Class\", 'm', 975 },\r\n    { \"Verdana\", 12, \"Regular/Italic Class\", 0, 1050 },\r\n    { \"Verdana\", 13, \"Regular/Italic Class\", 'i', 950 },\r\n    { \"Verdana\", 13, \"Regular/Italic Class\", 'j', 950 },\r\n    { \"Verdana\", 13, \"Regular/Italic Class\", 'l', 950 },\r\n    { \"Verdana\", 16, \"Regular Class\", 0, 1050 },\r\n    { \"Verdana\", 9, \"Regular/Italic Class\", 0, 1050 },\r\n    { \"Times New Roman\", 16, \"Regular Class\", 'm', 918 },\r\n    { \"Trebuchet MS\", 11, \"Regular Class\", 'm', 800 },\r\n    { \"Trebuchet MS\", 12, \"Regular Class\", 'm', 800 },\r\n  };\r\n\r\n#else\r\n\r\n#define COMPATIBLE_WIDTHS_RULES_SIZE  1\r\n\r\n  SPH_TweakRule  COMPATIBLE_WIDTHS_Rules\r\n                   [COMPATIBLE_WIDTHS_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0 },\r\n  };\r\n\r\n\r\n#define X_SCALING_RULES_SIZE  1\r\n\r\n  SPH_ScaleRule  X_SCALING_Rules\r\n                   [X_SCALING_RULES_SIZE] =\r\n  {\r\n    { \"-\", 0, \"\", 0, 1000 },\r\n  };\r\n\r\n#endif /* FORCE_NATURAL_WIDTHS */\r\n\r\n#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTSUBPIX_H__ */\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/Jamfile",
    "content": "# FreeType 2 src/type1 Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) type1 ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = t1afm t1driver t1objs t1load t1gload t1parse ;\r\n  }\r\n  else\r\n  {\r\n    _sources = type1 ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/type1 Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/module.mk",
    "content": "#\r\n# FreeType 2 Type1 module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += TYPE1_DRIVER\r\n\r\ndefine TYPE1_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, t1_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)type1     $(ECHO_DRIVER_DESC)Postscript font files with extension *.pfa or *.pfb$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/rules.mk",
    "content": "#\r\n# FreeType 2 Type1 driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# Type1 driver directory\r\n#\r\nT1_DIR := $(SRC_DIR)/type1\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nT1_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(T1_DIR))\r\n\r\n\r\n# Type1 driver sources (i.e., C files)\r\n#\r\nT1_DRV_SRC := $(T1_DIR)/t1parse.c  \\\r\n              $(T1_DIR)/t1load.c   \\\r\n              $(T1_DIR)/t1driver.c \\\r\n              $(T1_DIR)/t1afm.c    \\\r\n              $(T1_DIR)/t1gload.c  \\\r\n              $(T1_DIR)/t1objs.c\r\n\r\n# Type1 driver headers\r\n#\r\nT1_DRV_H := $(T1_DRV_SRC:%.c=%.h) \\\r\n            $(T1_DIR)/t1tokens.h  \\\r\n            $(T1_DIR)/t1errors.h\r\n\r\n\r\n# Type1 driver object(s)\r\n#\r\n#   T1_DRV_OBJ_M is used during `multi' builds\r\n#   T1_DRV_OBJ_S is used during `single' builds\r\n#\r\nT1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nT1_DRV_OBJ_S := $(OBJ_DIR)/type1.$O\r\n\r\n# Type1 driver source file for single build\r\n#\r\nT1_DRV_SRC_S := $(T1_DIR)/type1.c\r\n\r\n\r\n# Type1 driver - single object\r\n#\r\n$(T1_DRV_OBJ_S): $(T1_DRV_SRC_S) $(T1_DRV_SRC) $(FREETYPE_H) $(T1_DRV_H)\r\n\t$(T1_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(T1_DRV_SRC_S))\r\n\r\n\r\n# Type1 driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(T1_DIR)/%.c $(FREETYPE_H) $(T1_DRV_H)\r\n\t$(T1_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(T1_DRV_OBJ_S)\r\nDRV_OBJS_M += $(T1_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1afm.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1afm.c                                                                */\r\n/*                                                                         */\r\n/*    AFM support for Type 1 fonts (body).                                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2011 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"t1afm.h\"\r\n#include \"t1errors.h\"\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1afm\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T1_Done_Metrics( FT_Memory     memory,\r\n                   AFM_FontInfo  fi )\r\n  {\r\n    FT_FREE( fi->KernPairs );\r\n    fi->NumKernPair = 0;\r\n\r\n    FT_FREE( fi->TrackKerns );\r\n    fi->NumTrackKern = 0;\r\n\r\n    FT_FREE( fi );\r\n  }\r\n\r\n\r\n  /* read a glyph name and return the equivalent glyph index */\r\n  static FT_Int\r\n  t1_get_index( const char*  name,\r\n                FT_Offset    len,\r\n                void*        user_data )\r\n  {\r\n    T1_Font  type1 = (T1_Font)user_data;\r\n    FT_Int   n;\r\n\r\n\r\n    /* PS string/name length must be < 16-bit */\r\n    if ( len > 0xFFFFU )\r\n      return 0;\r\n\r\n    for ( n = 0; n < type1->num_glyphs; n++ )\r\n    {\r\n      char*  gname = (char*)type1->glyph_names[n];\r\n\r\n\r\n      if ( gname && gname[0] == name[0]        &&\r\n           ft_strlen( gname ) == len           &&\r\n           ft_strncmp( gname, name, len ) == 0 )\r\n        return n;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n#undef  KERN_INDEX\r\n#define KERN_INDEX( g1, g2 )  ( ( (FT_ULong)(g1) << 16 ) | (g2) )\r\n\r\n\r\n  /* compare two kerning pairs */\r\n  FT_CALLBACK_DEF( int )\r\n  compare_kern_pairs( const void*  a,\r\n                      const void*  b )\r\n  {\r\n    AFM_KernPair  pair1 = (AFM_KernPair)a;\r\n    AFM_KernPair  pair2 = (AFM_KernPair)b;\r\n\r\n    FT_ULong  index1 = KERN_INDEX( pair1->index1, pair1->index2 );\r\n    FT_ULong  index2 = KERN_INDEX( pair2->index1, pair2->index2 );\r\n\r\n\r\n    if ( index1 > index2 )\r\n      return 1;\r\n    else if ( index1 < index2 )\r\n      return -1;\r\n    else\r\n      return 0;\r\n  }\r\n\r\n\r\n  /* parse a PFM file -- for now, only read the kerning pairs */\r\n  static FT_Error\r\n  T1_Read_PFM( FT_Face       t1_face,\r\n               FT_Stream     stream,\r\n               AFM_FontInfo  fi )\r\n  {\r\n    FT_Error      error = T1_Err_Ok;\r\n    FT_Memory     memory = stream->memory;\r\n    FT_Byte*      start;\r\n    FT_Byte*      limit;\r\n    FT_Byte*      p;\r\n    AFM_KernPair  kp;\r\n    FT_Int        width_table_length;\r\n    FT_CharMap    oldcharmap;\r\n    FT_CharMap    charmap;\r\n    FT_Int        n;\r\n\r\n\r\n    start = (FT_Byte*)stream->cursor;\r\n    limit = (FT_Byte*)stream->limit;\r\n    p     = start;\r\n\r\n    /* Figure out how long the width table is.          */\r\n    /* This info is a little-endian short at offset 99. */\r\n    p = start + 99;\r\n    if ( p + 2 > limit )\r\n    {\r\n      error = T1_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n    width_table_length = FT_PEEK_USHORT_LE( p );\r\n\r\n    p += 18 + width_table_length;\r\n    if ( p + 0x12 > limit || FT_PEEK_USHORT_LE( p ) < 0x12 )\r\n      /* extension table is probably optional */\r\n      goto Exit;\r\n\r\n    /* Kerning offset is 14 bytes from start of extensions table. */\r\n    p += 14;\r\n    p = start + FT_PEEK_ULONG_LE( p );\r\n\r\n    if ( p == start )\r\n      /* zero offset means no table */\r\n      goto Exit;\r\n\r\n    if ( p + 2 > limit )\r\n    {\r\n      error = T1_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    fi->NumKernPair = FT_PEEK_USHORT_LE( p );\r\n    p += 2;\r\n    if ( p + 4 * fi->NumKernPair > limit )\r\n    {\r\n      error = T1_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Actually, kerning pairs are simply optional! */\r\n    if ( fi->NumKernPair == 0 )\r\n      goto Exit;\r\n\r\n    /* allocate the pairs */\r\n    if ( FT_QNEW_ARRAY( fi->KernPairs, fi->NumKernPair ) )\r\n      goto Exit;\r\n\r\n    /* now, read each kern pair */\r\n    kp             = fi->KernPairs;\r\n    limit          = p + 4 * fi->NumKernPair;\r\n\r\n    /* PFM kerning data are stored by encoding rather than glyph index, */\r\n    /* so find the PostScript charmap of this font and install it       */\r\n    /* temporarily.  If we find no PostScript charmap, then just use    */\r\n    /* the default and hope it is the right one.                        */\r\n    oldcharmap = t1_face->charmap;\r\n    charmap    = NULL;\r\n\r\n    for ( n = 0; n < t1_face->num_charmaps; n++ )\r\n    {\r\n      charmap = t1_face->charmaps[n];\r\n      /* check against PostScript pseudo platform */\r\n      if ( charmap->platform_id == 7 )\r\n      {\r\n        error = FT_Set_Charmap( t1_face, charmap );\r\n        if ( error )\r\n          goto Exit;\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* Kerning info is stored as:             */\r\n    /*                                        */\r\n    /*   encoding of first glyph (1 byte)     */\r\n    /*   encoding of second glyph (1 byte)    */\r\n    /*   offset (little-endian short)         */\r\n    for ( ; p < limit ; p += 4 )\r\n    {\r\n      kp->index1 = FT_Get_Char_Index( t1_face, p[0] );\r\n      kp->index2 = FT_Get_Char_Index( t1_face, p[1] );\r\n\r\n      kp->x = (FT_Int)FT_PEEK_SHORT_LE(p + 2);\r\n      kp->y = 0;\r\n\r\n      kp++;\r\n    }\r\n\r\n    if ( oldcharmap != NULL )\r\n      error = FT_Set_Charmap( t1_face, oldcharmap );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* now, sort the kern pairs according to their glyph indices */\r\n    ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ),\r\n              compare_kern_pairs );\r\n\r\n  Exit:\r\n    if ( error )\r\n    {\r\n      FT_FREE( fi->KernPairs );\r\n      fi->NumKernPair = 0;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* parse a metrics file -- either AFM or PFM depending on what */\r\n  /* it turns out to be                                          */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Read_Metrics( FT_Face    t1_face,\r\n                   FT_Stream  stream )\r\n  {\r\n    PSAux_Service  psaux;\r\n    FT_Memory      memory  = stream->memory;\r\n    AFM_ParserRec  parser;\r\n    AFM_FontInfo   fi      = NULL;\r\n    FT_Error       error   = T1_Err_Unknown_File_Format;\r\n    T1_Font        t1_font = &( (T1_Face)t1_face )->type1;\r\n\r\n\r\n    if ( FT_NEW( fi )                   ||\r\n         FT_FRAME_ENTER( stream->size ) )\r\n      goto Exit;\r\n\r\n    fi->FontBBox  = t1_font->font_bbox;\r\n    fi->Ascender  = t1_font->font_bbox.yMax;\r\n    fi->Descender = t1_font->font_bbox.yMin;\r\n\r\n    psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux;\r\n    if ( psaux->afm_parser_funcs )\r\n    {\r\n      error = psaux->afm_parser_funcs->init( &parser,\r\n                                             stream->memory,\r\n                                             stream->cursor,\r\n                                             stream->limit );\r\n\r\n      if ( !error )\r\n      {\r\n        parser.FontInfo  = fi;\r\n        parser.get_index = t1_get_index;\r\n        parser.user_data = t1_font;\r\n\r\n        error = psaux->afm_parser_funcs->parse( &parser );\r\n        psaux->afm_parser_funcs->done( &parser );\r\n      }\r\n    }\r\n\r\n    if ( error == T1_Err_Unknown_File_Format )\r\n    {\r\n      FT_Byte*  start = stream->cursor;\r\n\r\n\r\n      /* MS Windows allows versions up to 0x3FF without complaining */\r\n      if ( stream->size > 6                              &&\r\n           start[1] < 4                                  &&\r\n           FT_PEEK_ULONG_LE( start + 2 ) == stream->size )\r\n        error = T1_Read_PFM( t1_face, stream, fi );\r\n    }\r\n\r\n    if ( !error )\r\n    {\r\n      t1_font->font_bbox = fi->FontBBox;\r\n\r\n      t1_face->bbox.xMin =   fi->FontBBox.xMin            >> 16;\r\n      t1_face->bbox.yMin =   fi->FontBBox.yMin            >> 16;\r\n      /* no `U' suffix here to 0xFFFF! */\r\n      t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16;\r\n      t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16;\r\n\r\n      /* no `U' suffix here to 0x8000! */\r\n      t1_face->ascender  = (FT_Short)( ( fi->Ascender  + 0x8000 ) >> 16 );\r\n      t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );\r\n\r\n      if ( fi->NumKernPair )\r\n      {\r\n        t1_face->face_flags |= FT_FACE_FLAG_KERNING;\r\n        ( (T1_Face)t1_face )->afm_data = fi;\r\n        fi = NULL;\r\n      }\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n  Exit:\r\n    if ( fi != NULL )\r\n      T1_Done_Metrics( memory, fi );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /* find the kerning for a given glyph pair */\r\n  FT_LOCAL_DEF( void )\r\n  T1_Get_Kerning( AFM_FontInfo  fi,\r\n                  FT_UInt       glyph1,\r\n                  FT_UInt       glyph2,\r\n                  FT_Vector*    kerning )\r\n  {\r\n    AFM_KernPair  min, mid, max;\r\n    FT_ULong      idx = KERN_INDEX( glyph1, glyph2 );\r\n\r\n\r\n    /* simple binary search */\r\n    min = fi->KernPairs;\r\n    max = min + fi->NumKernPair - 1;\r\n\r\n    while ( min <= max )\r\n    {\r\n      FT_ULong  midi;\r\n\r\n\r\n      mid  = min + ( max - min ) / 2;\r\n      midi = KERN_INDEX( mid->index1, mid->index2 );\r\n\r\n      if ( midi == idx )\r\n      {\r\n        kerning->x = mid->x;\r\n        kerning->y = mid->y;\r\n\r\n        return;\r\n      }\r\n\r\n      if ( midi < idx )\r\n        min = mid + 1;\r\n      else\r\n        max = mid - 1;\r\n    }\r\n\r\n    kerning->x = 0;\r\n    kerning->y = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Get_Track_Kerning( FT_Face    face,\r\n                        FT_Fixed   ptsize,\r\n                        FT_Int     degree,\r\n                        FT_Fixed*  kerning )\r\n  {\r\n    AFM_FontInfo  fi = (AFM_FontInfo)( (T1_Face)face )->afm_data;\r\n    FT_Int        i;\r\n\r\n\r\n    if ( !fi )\r\n      return T1_Err_Invalid_Argument;\r\n\r\n    for ( i = 0; i < fi->NumTrackKern; i++ )\r\n    {\r\n      AFM_TrackKern  tk = fi->TrackKerns + i;\r\n\r\n\r\n      if ( tk->degree != degree )\r\n        continue;\r\n\r\n      if ( ptsize < tk->min_ptsize )\r\n        *kerning = tk->min_kern;\r\n      else if ( ptsize > tk->max_ptsize )\r\n        *kerning = tk->max_kern;\r\n      else\r\n      {\r\n        *kerning = FT_MulDiv( ptsize - tk->min_ptsize,\r\n                              tk->max_kern - tk->min_kern,\r\n                              tk->max_ptsize - tk->min_ptsize ) +\r\n                   tk->min_kern;\r\n      }\r\n    }\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1afm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1afm.h                                                                */\r\n/*                                                                         */\r\n/*    AFM support for Type 1 fonts (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2006 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1AFM_H__\r\n#define __T1AFM_H__\r\n\r\n#include <ft2build.h>\r\n#include \"t1objs.h\"\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Read_Metrics( FT_Face    face,\r\n                   FT_Stream  stream );\r\n\r\n  FT_LOCAL( void )\r\n  T1_Done_Metrics( FT_Memory     memory,\r\n                   AFM_FontInfo  fi );\r\n\r\n  FT_LOCAL( void )\r\n  T1_Get_Kerning( AFM_FontInfo  fi,\r\n                  FT_UInt       glyph1,\r\n                  FT_UInt       glyph2,\r\n                  FT_Vector*    kerning );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Get_Track_Kerning( FT_Face    face,\r\n                        FT_Fixed   ptsize,\r\n                        FT_Int     degree,\r\n                        FT_Fixed*  kerning );\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1AFM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1driver.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1driver.c                                                             */\r\n/*                                                                         */\r\n/*    Type 1 driver interface (body).                                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006, 2007, 2009, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"t1driver.h\"\r\n#include \"t1gload.h\"\r\n#include \"t1load.h\"\r\n\r\n#include \"t1errors.h\"\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n#include \"t1afm.h\"\r\n#endif\r\n\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n#include FT_SERVICE_MULTIPLE_MASTERS_H\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n#include FT_SERVICE_KERNING_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1driver\r\n\r\n /*\r\n  *  GLYPH DICT SERVICE\r\n  *\r\n  */\r\n\r\n  static FT_Error\r\n  t1_get_glyph_name( T1_Face     face,\r\n                     FT_UInt     glyph_index,\r\n                     FT_Pointer  buffer,\r\n                     FT_UInt     buffer_max )\r\n  {\r\n    FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  t1_get_name_index( T1_Face     face,\r\n                     FT_String*  glyph_name )\r\n  {\r\n    FT_Int      i;\r\n    FT_String*  gname;\r\n\r\n\r\n    for ( i = 0; i < face->type1.num_glyphs; i++ )\r\n    {\r\n      gname = face->type1.glyph_names[i];\r\n\r\n      if ( !ft_strcmp( glyph_name, gname ) )\r\n        return (FT_UInt)i;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static const FT_Service_GlyphDictRec  t1_service_glyph_dict =\r\n  {\r\n    (FT_GlyphDict_GetNameFunc)  t1_get_glyph_name,\r\n    (FT_GlyphDict_NameIndexFunc)t1_get_name_index\r\n  };\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT NAME SERVICE\r\n   *\r\n   */\r\n\r\n  static const char*\r\n  t1_get_ps_name( T1_Face  face )\r\n  {\r\n    return (const char*) face->type1.font_name;\r\n  }\r\n\r\n\r\n  static const FT_Service_PsFontNameRec  t1_service_ps_name =\r\n  {\r\n    (FT_PsName_GetFunc)t1_get_ps_name\r\n  };\r\n\r\n\r\n  /*\r\n   *  MULTIPLE MASTERS SERVICE\r\n   *\r\n   */\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n  static const FT_Service_MultiMastersRec  t1_service_multi_masters =\r\n  {\r\n    (FT_Get_MM_Func)        T1_Get_Multi_Master,\r\n    (FT_Set_MM_Design_Func) T1_Set_MM_Design,\r\n    (FT_Set_MM_Blend_Func)  T1_Set_MM_Blend,\r\n    (FT_Get_MM_Var_Func)    T1_Get_MM_Var,\r\n    (FT_Set_Var_Design_Func)T1_Set_Var_Design\r\n  };\r\n#endif\r\n\r\n\r\n  /*\r\n   *  POSTSCRIPT INFO SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  t1_ps_get_font_info( FT_Face          face,\r\n                       PS_FontInfoRec*  afont_info )\r\n  {\r\n    *afont_info = ((T1_Face)face)->type1.font_info;\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  t1_ps_get_font_extra( FT_Face           face,\r\n                        PS_FontExtraRec*  afont_extra )\r\n  {\r\n    *afont_extra = ((T1_Face)face)->type1.font_extra;\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Int\r\n  t1_ps_has_glyph_names( FT_Face  face )\r\n  {\r\n    FT_UNUSED( face );\r\n\r\n    return 1;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  t1_ps_get_font_private( FT_Face         face,\r\n                          PS_PrivateRec*  afont_private )\r\n  {\r\n    *afont_private = ((T1_Face)face)->type1.private_dict;\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Long\r\n  t1_ps_get_font_value( FT_Face       face,\r\n                        PS_Dict_Keys  key,\r\n                        FT_UInt       idx,\r\n                        void         *value,\r\n                        FT_Long       value_len )\r\n  {\r\n    FT_Long  retval = -1;\r\n    T1_Face  t1face = (T1_Face)face;\r\n    T1_Font  type1  = &t1face->type1;\r\n\r\n\r\n    switch ( key )\r\n    {\r\n    case PS_DICT_FONT_TYPE:\r\n      retval = sizeof ( type1->font_type );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->font_type;\r\n      break;\r\n\r\n    case PS_DICT_FONT_MATRIX:\r\n      if ( idx < sizeof ( type1->font_matrix ) /\r\n                   sizeof ( type1->font_matrix.xx ) )\r\n      {\r\n        FT_Fixed  val = 0;\r\n\r\n\r\n        retval = sizeof ( val );\r\n        if ( value && value_len >= retval )\r\n        {\r\n          switch ( idx )\r\n          {\r\n          case 0:\r\n            val = type1->font_matrix.xx;\r\n            break;\r\n          case 1:\r\n            val = type1->font_matrix.xy;\r\n            break;\r\n          case 2:\r\n            val = type1->font_matrix.yx;\r\n            break;\r\n          case 3:\r\n            val = type1->font_matrix.yy;\r\n            break;\r\n          }\r\n          *((FT_Fixed *)value) = val;\r\n        }\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_FONT_BBOX:\r\n      if ( idx < sizeof ( type1->font_bbox ) /\r\n                   sizeof ( type1->font_bbox.xMin ) )\r\n      {\r\n        FT_Fixed val = 0;\r\n\r\n\r\n        retval = sizeof ( val );\r\n        if ( value && value_len >= retval )\r\n        {\r\n          switch ( idx )\r\n          {\r\n          case 0:\r\n            val = type1->font_bbox.xMin;\r\n            break;\r\n          case 1:\r\n            val = type1->font_bbox.yMin;\r\n            break;\r\n          case 2:\r\n            val = type1->font_bbox.xMax;\r\n            break;\r\n          case 3:\r\n            val = type1->font_bbox.yMax;\r\n            break;\r\n          }\r\n          *((FT_Fixed *)value) = val;\r\n        }\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_PAINT_TYPE:\r\n      retval = sizeof ( type1->paint_type );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->paint_type;\r\n      break;\r\n\r\n    case PS_DICT_FONT_NAME:\r\n      retval = ft_strlen( type1->font_name ) + 1;\r\n      if ( value && value_len >= retval )\r\n        ft_memcpy( value, (void *)( type1->font_name ), retval );\r\n      break;\r\n\r\n    case PS_DICT_UNIQUE_ID:\r\n      retval = sizeof ( type1->private_dict.unique_id );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Int *)value) = type1->private_dict.unique_id;\r\n      break;\r\n\r\n    case PS_DICT_NUM_CHAR_STRINGS:\r\n      retval = sizeof ( type1->num_glyphs );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Int *)value) = type1->num_glyphs;\r\n      break;\r\n\r\n    case PS_DICT_CHAR_STRING_KEY:\r\n      if ( idx < (FT_UInt)type1->num_glyphs )\r\n      {\r\n        retval = ft_strlen( type1->glyph_names[idx] ) + 1;\r\n        if ( value && value_len >= retval )\r\n        {\r\n          ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval );\r\n          ((FT_Char *)value)[retval - 1] = (FT_Char)'\\0';\r\n        }\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_CHAR_STRING:\r\n      if ( idx < (FT_UInt)type1->num_glyphs )\r\n      {\r\n        retval = type1->charstrings_len[idx] + 1;\r\n        if ( value && value_len >= retval )\r\n        {\r\n          ft_memcpy( value, (void *)( type1->charstrings[idx] ),\r\n                     retval - 1 );\r\n          ((FT_Char *)value)[retval - 1] = (FT_Char)'\\0';\r\n        }\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_ENCODING_TYPE:\r\n      retval = sizeof ( type1->encoding_type );\r\n      if ( value && value_len >= retval )\r\n        *((T1_EncodingType *)value) = type1->encoding_type;\r\n      break;\r\n\r\n    case PS_DICT_ENCODING_ENTRY:\r\n      if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY &&\r\n           idx < (FT_UInt)type1->encoding.num_chars       )\r\n      {\r\n        retval = ft_strlen( type1->encoding.char_name[idx] ) + 1;\r\n        if ( value && value_len >= retval )\r\n        {\r\n          ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ),\r\n                     retval - 1 );\r\n          ((FT_Char *)value)[retval - 1] = (FT_Char)'\\0';\r\n        }\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_NUM_SUBRS:\r\n      retval = sizeof ( type1->num_subrs );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Int *)value) = type1->num_subrs;\r\n      break;\r\n\r\n    case PS_DICT_SUBR:\r\n      if ( idx < (FT_UInt)type1->num_subrs )\r\n      {\r\n        retval = type1->subrs_len[idx] + 1;\r\n        if ( value && value_len >= retval )\r\n        {\r\n          ft_memcpy( value, (void *)( type1->subrs[idx] ), retval - 1 );\r\n          ((FT_Char *)value)[retval - 1] = (FT_Char)'\\0';\r\n        }\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_STD_HW:\r\n      retval = sizeof ( type1->private_dict.standard_width[0] );\r\n      if ( value && value_len >= retval )\r\n        *((FT_UShort *)value) = type1->private_dict.standard_width[0];\r\n      break;\r\n\r\n    case PS_DICT_STD_VW:\r\n      retval = sizeof ( type1->private_dict.standard_height[0] );\r\n      if ( value && value_len >= retval )\r\n        *((FT_UShort *)value) = type1->private_dict.standard_height[0];\r\n      break;\r\n\r\n    case PS_DICT_NUM_BLUE_VALUES:\r\n      retval = sizeof ( type1->private_dict.num_blue_values );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->private_dict.num_blue_values;\r\n      break;\r\n\r\n    case PS_DICT_BLUE_VALUE:\r\n      if ( idx < type1->private_dict.num_blue_values )\r\n      {\r\n        retval = sizeof ( type1->private_dict.blue_values[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.blue_values[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_BLUE_SCALE:\r\n      retval = sizeof ( type1->private_dict.blue_scale );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Fixed *)value) = type1->private_dict.blue_scale;\r\n      break;\r\n\r\n    case PS_DICT_BLUE_FUZZ:\r\n      retval = sizeof ( type1->private_dict.blue_fuzz );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Int *)value) = type1->private_dict.blue_fuzz;\r\n      break;\r\n\r\n    case PS_DICT_BLUE_SHIFT:\r\n      retval = sizeof ( type1->private_dict.blue_shift );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Int *)value) = type1->private_dict.blue_shift;\r\n      break;\r\n\r\n    case PS_DICT_NUM_OTHER_BLUES:\r\n      retval = sizeof ( type1->private_dict.num_other_blues );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->private_dict.num_other_blues;\r\n      break;\r\n\r\n    case PS_DICT_OTHER_BLUE:\r\n      if ( idx < type1->private_dict.num_other_blues )\r\n      {\r\n        retval = sizeof ( type1->private_dict.other_blues[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.other_blues[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_NUM_FAMILY_BLUES:\r\n      retval = sizeof ( type1->private_dict.num_family_blues );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->private_dict.num_family_blues;\r\n      break;\r\n\r\n    case PS_DICT_FAMILY_BLUE:\r\n      if ( idx < type1->private_dict.num_family_blues )\r\n      {\r\n        retval = sizeof ( type1->private_dict.family_blues[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.family_blues[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_NUM_FAMILY_OTHER_BLUES:\r\n      retval = sizeof ( type1->private_dict.num_family_other_blues );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->private_dict.num_family_other_blues;\r\n      break;\r\n\r\n    case PS_DICT_FAMILY_OTHER_BLUE:\r\n      if ( idx < type1->private_dict.num_family_other_blues )\r\n      {\r\n        retval = sizeof ( type1->private_dict.family_other_blues[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.family_other_blues[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_NUM_STEM_SNAP_H:\r\n      retval = sizeof ( type1->private_dict.num_snap_widths );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->private_dict.num_snap_widths;\r\n      break;\r\n\r\n    case PS_DICT_STEM_SNAP_H:\r\n      if ( idx < type1->private_dict.num_snap_widths )\r\n      {\r\n        retval = sizeof ( type1->private_dict.snap_widths[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.snap_widths[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_NUM_STEM_SNAP_V:\r\n      retval = sizeof ( type1->private_dict.num_snap_heights );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Byte *)value) = type1->private_dict.num_snap_heights;\r\n      break;\r\n\r\n    case PS_DICT_STEM_SNAP_V:\r\n      if ( idx < type1->private_dict.num_snap_heights )\r\n      {\r\n        retval = sizeof ( type1->private_dict.snap_heights[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.snap_heights[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_RND_STEM_UP:\r\n      retval = sizeof ( type1->private_dict.round_stem_up );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Bool *)value) = type1->private_dict.round_stem_up;\r\n      break;\r\n\r\n    case PS_DICT_FORCE_BOLD:\r\n      retval = sizeof ( type1->private_dict.force_bold );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Bool *)value) = type1->private_dict.force_bold;\r\n      break;\r\n\r\n    case PS_DICT_MIN_FEATURE:\r\n      if ( idx < sizeof ( type1->private_dict.min_feature ) /\r\n                   sizeof ( type1->private_dict.min_feature[0] ) )\r\n      {\r\n        retval = sizeof ( type1->private_dict.min_feature[idx] );\r\n        if ( value && value_len >= retval )\r\n          *((FT_Short *)value) = type1->private_dict.min_feature[idx];\r\n      }\r\n      break;\r\n\r\n    case PS_DICT_LEN_IV:\r\n      retval = sizeof ( type1->private_dict.lenIV );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Int *)value) = type1->private_dict.lenIV;\r\n      break;\r\n\r\n    case PS_DICT_PASSWORD:\r\n      retval = sizeof ( type1->private_dict.password );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Long *)value) = type1->private_dict.password;\r\n      break;\r\n\r\n    case PS_DICT_LANGUAGE_GROUP:\r\n      retval = sizeof ( type1->private_dict.language_group );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Long *)value) = type1->private_dict.language_group;\r\n      break;\r\n\r\n    case PS_DICT_IS_FIXED_PITCH:\r\n      retval = sizeof ( type1->font_info.is_fixed_pitch );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Bool *)value) = type1->font_info.is_fixed_pitch;\r\n      break;\r\n\r\n    case PS_DICT_UNDERLINE_POSITION:\r\n      retval = sizeof ( type1->font_info.underline_position );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Short *)value) = type1->font_info.underline_position;\r\n      break;\r\n\r\n    case PS_DICT_UNDERLINE_THICKNESS:\r\n      retval = sizeof ( type1->font_info.underline_thickness );\r\n      if ( value && value_len >= retval )\r\n        *((FT_UShort *)value) = type1->font_info.underline_thickness;\r\n      break;\r\n\r\n    case PS_DICT_FS_TYPE:\r\n      retval = sizeof ( type1->font_extra.fs_type );\r\n      if ( value && value_len >= retval )\r\n        *((FT_UShort *)value) = type1->font_extra.fs_type;\r\n      break;\r\n\r\n    case PS_DICT_VERSION:\r\n      retval = ft_strlen( type1->font_info.version ) + 1;\r\n      if ( value && value_len >= retval )\r\n        ft_memcpy( value, (void *)( type1->font_info.version ), retval );\r\n      break;\r\n\r\n    case PS_DICT_NOTICE:\r\n      retval = ft_strlen( type1->font_info.notice ) + 1;\r\n      if ( value && value_len >= retval )\r\n        ft_memcpy( value, (void *)( type1->font_info.notice ), retval );\r\n      break;\r\n\r\n    case PS_DICT_FULL_NAME:\r\n      retval = ft_strlen( type1->font_info.full_name ) + 1;\r\n      if ( value && value_len >= retval )\r\n        ft_memcpy( value, (void *)( type1->font_info.full_name ), retval );\r\n      break;\r\n\r\n    case PS_DICT_FAMILY_NAME:\r\n      retval = ft_strlen( type1->font_info.family_name ) + 1;\r\n      if ( value && value_len >= retval )\r\n        ft_memcpy( value, (void *)( type1->font_info.family_name ), retval );\r\n      break;\r\n\r\n    case PS_DICT_WEIGHT:\r\n      retval = ft_strlen( type1->font_info.weight ) + 1;\r\n      if ( value && value_len >= retval )\r\n        ft_memcpy( value, (void *)( type1->font_info.weight ), retval );\r\n      break;\r\n\r\n    case PS_DICT_ITALIC_ANGLE:\r\n      retval = sizeof ( type1->font_info.italic_angle );\r\n      if ( value && value_len >= retval )\r\n        *((FT_Long *)value) = type1->font_info.italic_angle;\r\n      break;\r\n\r\n    default:\r\n      break;\r\n    }\r\n\r\n    return retval;\r\n  }\r\n\r\n\r\n  static const FT_Service_PsInfoRec  t1_service_ps_info =\r\n  {\r\n    (PS_GetFontInfoFunc)   t1_ps_get_font_info,\r\n    (PS_GetFontExtraFunc)  t1_ps_get_font_extra,\r\n    (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,\r\n    (PS_GetFontPrivateFunc)t1_ps_get_font_private,\r\n    (PS_GetFontValueFunc)  t1_ps_get_font_value,\r\n  };\r\n\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n  static const FT_Service_KerningRec  t1_service_kerning =\r\n  {\r\n    T1_Get_Track_Kerning,\r\n  };\r\n#endif\r\n\r\n\r\n  /*\r\n   *  SERVICE LIST\r\n   *\r\n   */\r\n\r\n  static const FT_ServiceDescRec  t1_services[] =\r\n  {\r\n    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name },\r\n    { FT_SERVICE_ID_GLYPH_DICT,           &t1_service_glyph_dict },\r\n    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_TYPE_1 },\r\n    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &t1_service_ps_info },\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n    { FT_SERVICE_ID_KERNING,              &t1_service_kerning },\r\n#endif\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n    { FT_SERVICE_ID_MULTI_MASTERS,        &t1_service_multi_masters },\r\n#endif\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  Get_Interface( FT_Module         module,\r\n                 const FT_String*  t1_interface )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( t1_services, t1_interface );\r\n  }\r\n\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    Get_Kerning                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A driver method used to return the kerning vector between two      */\r\n  /*    glyphs of the same face.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to the source face object.                 */\r\n  /*                                                                       */\r\n  /*    left_glyph  :: The index of the left glyph in the kern pair.       */\r\n  /*                                                                       */\r\n  /*    right_glyph :: The index of the right glyph in the kern pair.      */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    kerning     :: The kerning vector.  This is in font units for      */\r\n  /*                   scalable formats, and in pixels for fixed-sizes     */\r\n  /*                   formats.                                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only horizontal layouts (left-to-right & right-to-left) are        */\r\n  /*    supported by this function.  Other layouts, or more sophisticated  */\r\n  /*    kernings are out of scope of this method (the basic driver         */\r\n  /*    interface is meant to be simple).                                  */\r\n  /*                                                                       */\r\n  /*    They can be implemented by format-specific interfaces.             */\r\n  /*                                                                       */\r\n  static FT_Error\r\n  Get_Kerning( FT_Face     t1face,        /* T1_Face */\r\n               FT_UInt     left_glyph,\r\n               FT_UInt     right_glyph,\r\n               FT_Vector*  kerning )\r\n  {\r\n    T1_Face  face = (T1_Face)t1face;\r\n\r\n\r\n    kerning->x = 0;\r\n    kerning->y = 0;\r\n\r\n    if ( face->afm_data )\r\n      T1_Get_Kerning( (AFM_FontInfo)face->afm_data,\r\n                      left_glyph,\r\n                      right_glyph,\r\n                      kerning );\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n#endif /* T1_CONFIG_OPTION_NO_AFM */\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Driver_ClassRec  t1_driver_class =\r\n  {\r\n    {\r\n      FT_MODULE_FONT_DRIVER       |\r\n      FT_MODULE_DRIVER_SCALABLE   |\r\n      FT_MODULE_DRIVER_HAS_HINTER,\r\n\r\n      sizeof ( FT_DriverRec ),\r\n\r\n      \"type1\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,   /* format interface */\r\n\r\n      T1_Driver_Init,\r\n      T1_Driver_Done,\r\n      Get_Interface,\r\n    },\r\n\r\n    sizeof ( T1_FaceRec ),\r\n    sizeof ( T1_SizeRec ),\r\n    sizeof ( T1_GlyphSlotRec ),\r\n\r\n    T1_Face_Init,\r\n    T1_Face_Done,\r\n    T1_Size_Init,\r\n    T1_Size_Done,\r\n    T1_GlyphSlot_Init,\r\n    T1_GlyphSlot_Done,\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n    T1_Load_Glyph,\r\n\r\n#ifdef T1_CONFIG_OPTION_NO_AFM\r\n    0,                     /* FT_Face_GetKerningFunc */\r\n    0,                     /* FT_Face_AttachFunc     */\r\n#else\r\n    Get_Kerning,\r\n    T1_Read_Metrics,\r\n#endif\r\n    T1_Get_Advances,\r\n    T1_Size_Request,\r\n    0                      /* FT_Size_SelectFunc     */\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1driver.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1driver.h                                                             */\r\n/*                                                                         */\r\n/*    High-level Type 1 driver interface (specification).                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1DRIVER_H__\r\n#define __T1DRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Driver_ClassRec )  t1_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1DRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1errors.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1errors.h                                                             */\r\n/*                                                                         */\r\n/*    Type 1 error codes (specification only).                             */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the Type 1 error enumeration constants.   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __T1ERRORS_H__\r\n#define __T1ERRORS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  T1_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Type1\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __T1ERRORS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1gload.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1gload.c                                                              */\r\n/*                                                                         */\r\n/*    Type 1 Glyph Loader (body).                                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"t1gload.h\"\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_OUTLINE_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n#include \"t1errors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1gload\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /**********                                                      *********/\r\n  /**********            COMPUTE THE MAXIMUM ADVANCE WIDTH         *********/\r\n  /**********                                                      *********/\r\n  /**********    The following code is in charge of computing      *********/\r\n  /**********    the maximum advance width of the font.  It        *********/\r\n  /**********    quickly processes each glyph charstring to        *********/\r\n  /**********    extract the value from either a `sbw' or `seac'   *********/\r\n  /**********    operator.                                         *********/\r\n  /**********                                                      *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Parse_Glyph_And_Get_Char_String( T1_Decoder  decoder,\r\n                                      FT_UInt     glyph_index,\r\n                                      FT_Data*    char_string )\r\n  {\r\n    T1_Face   face  = (T1_Face)decoder->builder.face;\r\n    T1_Font   type1 = &face->type1;\r\n    FT_Error  error = T1_Err_Ok;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_Incremental_InterfaceRec *inc =\r\n                      face->root.internal->incremental_interface;\r\n#endif\r\n\r\n\r\n    decoder->font_matrix = type1->font_matrix;\r\n    decoder->font_offset = type1->font_offset;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    /* For incremental fonts get the character data using the */\r\n    /* callback function.                                     */\r\n    if ( inc )\r\n      error = inc->funcs->get_glyph_data( inc->object,\r\n                                          glyph_index, char_string );\r\n    else\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    /* For ordinary fonts get the character data stored in the face record. */\r\n    {\r\n      char_string->pointer = type1->charstrings[glyph_index];\r\n      char_string->length  = (FT_Int)type1->charstrings_len[glyph_index];\r\n    }\r\n\r\n    if ( !error )\r\n      error = decoder->funcs.parse_charstrings(\r\n                decoder, (FT_Byte*)char_string->pointer,\r\n                char_string->length );\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    /* Incremental fonts can optionally override the metrics. */\r\n    if ( !error && inc && inc->funcs->get_glyph_metrics )\r\n    {\r\n      FT_Incremental_MetricsRec  metrics;\r\n\r\n\r\n      metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );\r\n      metrics.bearing_y = 0;\r\n      metrics.advance   = FIXED_TO_INT( decoder->builder.advance.x );\r\n      metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );\r\n\r\n      error = inc->funcs->get_glyph_metrics( inc->object,\r\n                                             glyph_index, FALSE, &metrics );\r\n\r\n      decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );\r\n      decoder->builder.advance.x      = INT_TO_FIXED( metrics.advance );\r\n      decoder->builder.advance.y      = INT_TO_FIXED( metrics.advance_v );\r\n    }\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Error )\r\n  T1_Parse_Glyph( T1_Decoder  decoder,\r\n                  FT_UInt     glyph_index )\r\n  {\r\n    FT_Data   glyph_data;\r\n    FT_Error  error = T1_Parse_Glyph_And_Get_Char_String(\r\n                        decoder, glyph_index, &glyph_data );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n    if ( !error )\r\n    {\r\n      T1_Face  face = (T1_Face)decoder->builder.face;\r\n\r\n\r\n      if ( face->root.internal->incremental_interface )\r\n        face->root.internal->incremental_interface->funcs->free_glyph_data(\r\n          face->root.internal->incremental_interface->object,\r\n          &glyph_data );\r\n    }\r\n\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Compute_Max_Advance( T1_Face  face,\r\n                          FT_Pos*  max_advance )\r\n  {\r\n    FT_Error       error;\r\n    T1_DecoderRec  decoder;\r\n    FT_Int         glyph_index;\r\n    T1_Font        type1 = &face->type1;\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n\r\n\r\n    FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );\r\n\r\n    *max_advance = 0;\r\n\r\n    /* initialize load decoder */\r\n    error = psaux->t1_decoder_funcs->init( &decoder,\r\n                                           (FT_Face)face,\r\n                                           0, /* size       */\r\n                                           0, /* glyph slot */\r\n                                           (FT_Byte**)type1->glyph_names,\r\n                                           face->blend,\r\n                                           0,\r\n                                           FT_RENDER_MODE_NORMAL,\r\n                                           T1_Parse_Glyph );\r\n    if ( error )\r\n      return error;\r\n\r\n    decoder.builder.metrics_only = 1;\r\n    decoder.builder.load_points  = 0;\r\n\r\n    decoder.num_subrs     = type1->num_subrs;\r\n    decoder.subrs         = type1->subrs;\r\n    decoder.subrs_len     = type1->subrs_len;\r\n\r\n    decoder.buildchar     = face->buildchar;\r\n    decoder.len_buildchar = face->len_buildchar;\r\n\r\n    *max_advance = 0;\r\n\r\n    /* for each glyph, parse the glyph charstring and extract */\r\n    /* the advance width                                      */\r\n    for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )\r\n    {\r\n      /* now get load the unscaled outline */\r\n      error = T1_Parse_Glyph( &decoder, glyph_index );\r\n      if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )\r\n        *max_advance = decoder.builder.advance.x;\r\n\r\n      /* ignore the error if one occurred - skip to next glyph */\r\n    }\r\n\r\n    psaux->t1_decoder_funcs->done( &decoder );\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Get_Advances( FT_Face    t1face,        /* T1_Face */\r\n                   FT_UInt    first,\r\n                   FT_UInt    count,\r\n                   FT_Int32   load_flags,\r\n                   FT_Fixed*  advances )\r\n  {\r\n    T1_Face        face  = (T1_Face)t1face;\r\n    T1_DecoderRec  decoder;\r\n    T1_Font        type1 = &face->type1;\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n    FT_UInt        nn;\r\n    FT_Error       error;\r\n\r\n\r\n    if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n    {\r\n      for ( nn = 0; nn < count; nn++ )\r\n        advances[nn] = 0;\r\n\r\n      return T1_Err_Ok;\r\n    }\r\n\r\n    error = psaux->t1_decoder_funcs->init( &decoder,\r\n                                           (FT_Face)face,\r\n                                           0, /* size       */\r\n                                           0, /* glyph slot */\r\n                                           (FT_Byte**)type1->glyph_names,\r\n                                           face->blend,\r\n                                           0,\r\n                                           FT_RENDER_MODE_NORMAL,\r\n                                           T1_Parse_Glyph );\r\n    if ( error )\r\n      return error;\r\n\r\n    decoder.builder.metrics_only = 1;\r\n    decoder.builder.load_points  = 0;\r\n\r\n    decoder.num_subrs = type1->num_subrs;\r\n    decoder.subrs     = type1->subrs;\r\n    decoder.subrs_len = type1->subrs_len;\r\n\r\n    decoder.buildchar     = face->buildchar;\r\n    decoder.len_buildchar = face->len_buildchar;\r\n\r\n    for ( nn = 0; nn < count; nn++ )\r\n    {\r\n      error = T1_Parse_Glyph( &decoder, first + nn );\r\n      if ( !error )\r\n        advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );\r\n      else\r\n        advances[nn] = 0;\r\n    }\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Load_Glyph( FT_GlyphSlot  t1glyph,          /* T1_GlyphSlot */\r\n                 FT_Size       t1size,           /* T1_Size      */\r\n                 FT_UInt       glyph_index,\r\n                 FT_Int32      load_flags )\r\n  {\r\n    T1_GlyphSlot            glyph = (T1_GlyphSlot)t1glyph;\r\n    FT_Error                error;\r\n    T1_DecoderRec           decoder;\r\n    T1_Face                 face = (T1_Face)t1glyph->face;\r\n    FT_Bool                 hinting;\r\n    T1_Font                 type1         = &face->type1;\r\n    PSAux_Service           psaux         = (PSAux_Service)face->psaux;\r\n    const T1_Decoder_Funcs  decoder_funcs = psaux->t1_decoder_funcs;\r\n\r\n    FT_Matrix               font_matrix;\r\n    FT_Vector               font_offset;\r\n    FT_Data                 glyph_data;\r\n    FT_Bool                 must_finish_decoder = FALSE;\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_Bool                 glyph_data_loaded = 0;\r\n#endif\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    if ( glyph_index >= (FT_UInt)face->root.num_glyphs &&\r\n         !face->root.internal->incremental_interface   )\r\n#else\r\n    if ( glyph_index >= (FT_UInt)face->root.num_glyphs )\r\n#endif /* FT_CONFIG_OPTION_INCREMENTAL */\r\n    {\r\n      error = T1_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );\r\n\r\n    if ( load_flags & FT_LOAD_NO_RECURSE )\r\n      load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;\r\n\r\n    if ( t1size )\r\n    {\r\n      glyph->x_scale = t1size->metrics.x_scale;\r\n      glyph->y_scale = t1size->metrics.y_scale;\r\n    }\r\n    else\r\n    {\r\n      glyph->x_scale = 0x10000L;\r\n      glyph->y_scale = 0x10000L;\r\n    }\r\n\r\n    t1glyph->outline.n_points   = 0;\r\n    t1glyph->outline.n_contours = 0;\r\n\r\n    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 &&\r\n                       ( load_flags & FT_LOAD_NO_HINTING ) == 0 );\r\n\r\n    t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;\r\n\r\n    error = decoder_funcs->init( &decoder,\r\n                                 t1glyph->face,\r\n                                 t1size,\r\n                                 t1glyph,\r\n                                 (FT_Byte**)type1->glyph_names,\r\n                                 face->blend,\r\n                                 FT_BOOL( hinting ),\r\n                                 FT_LOAD_TARGET_MODE( load_flags ),\r\n                                 T1_Parse_Glyph );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    must_finish_decoder = TRUE;\r\n\r\n    decoder.builder.no_recurse = FT_BOOL(\r\n                                   ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );\r\n\r\n    decoder.num_subrs     = type1->num_subrs;\r\n    decoder.subrs         = type1->subrs;\r\n    decoder.subrs_len     = type1->subrs_len;\r\n\r\n    decoder.buildchar     = face->buildchar;\r\n    decoder.len_buildchar = face->len_buildchar;\r\n\r\n    /* now load the unscaled outline */\r\n    error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,\r\n                                                &glyph_data );\r\n    if ( error )\r\n      goto Exit;\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    glyph_data_loaded = 1;\r\n#endif\r\n\r\n    font_matrix = decoder.font_matrix;\r\n    font_offset = decoder.font_offset;\r\n\r\n    /* save new glyph tables */\r\n    decoder_funcs->done( &decoder );\r\n\r\n    must_finish_decoder = FALSE;\r\n\r\n    /* now, set the metrics -- this is rather simple, as   */\r\n    /* the left side bearing is the xMin, and the top side */\r\n    /* bearing the yMax                                    */\r\n    if ( !error )\r\n    {\r\n      t1glyph->outline.flags &= FT_OUTLINE_OWNER;\r\n      t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;\r\n\r\n      /* for composite glyphs, return only left side bearing and */\r\n      /* advance width                                           */\r\n      if ( load_flags & FT_LOAD_NO_RECURSE )\r\n      {\r\n        FT_Slot_Internal  internal = t1glyph->internal;\r\n\r\n\r\n        t1glyph->metrics.horiBearingX =\r\n          FIXED_TO_INT( decoder.builder.left_bearing.x );\r\n        t1glyph->metrics.horiAdvance  =\r\n          FIXED_TO_INT( decoder.builder.advance.x );\r\n\r\n        internal->glyph_matrix      = font_matrix;\r\n        internal->glyph_delta       = font_offset;\r\n        internal->glyph_transformed = 1;\r\n      }\r\n      else\r\n      {\r\n        FT_BBox            cbox;\r\n        FT_Glyph_Metrics*  metrics = &t1glyph->metrics;\r\n        FT_Vector          advance;\r\n\r\n\r\n        /* copy the _unscaled_ advance width */\r\n        metrics->horiAdvance =\r\n          FIXED_TO_INT( decoder.builder.advance.x );\r\n        t1glyph->linearHoriAdvance =\r\n          FIXED_TO_INT( decoder.builder.advance.x );\r\n        t1glyph->internal->glyph_transformed = 0;\r\n\r\n        if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n        {\r\n          /* make up vertical ones */\r\n          metrics->vertAdvance = ( face->type1.font_bbox.yMax -\r\n                                   face->type1.font_bbox.yMin ) >> 16;\r\n          t1glyph->linearVertAdvance = metrics->vertAdvance;\r\n        }\r\n        else\r\n        {\r\n          metrics->vertAdvance =\r\n            FIXED_TO_INT( decoder.builder.advance.y );\r\n          t1glyph->linearVertAdvance =\r\n            FIXED_TO_INT( decoder.builder.advance.y );\r\n        }\r\n\r\n        t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;\r\n\r\n        if ( t1size && t1size->metrics.y_ppem < 24 )\r\n          t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;\r\n\r\n#if 1\r\n        /* apply the font matrix, if any */\r\n        if ( font_matrix.xx != 0x10000L || font_matrix.yy != font_matrix.xx ||\r\n             font_matrix.xy != 0        || font_matrix.yx != 0              )\r\n          FT_Outline_Transform( &t1glyph->outline, &font_matrix );\r\n\r\n        if ( font_offset.x || font_offset.y )\r\n          FT_Outline_Translate( &t1glyph->outline,\r\n                                font_offset.x,\r\n                                font_offset.y );\r\n\r\n        advance.x = metrics->horiAdvance;\r\n        advance.y = 0;\r\n        FT_Vector_Transform( &advance, &font_matrix );\r\n        metrics->horiAdvance = advance.x + font_offset.x;\r\n        advance.x = 0;\r\n        advance.y = metrics->vertAdvance;\r\n        FT_Vector_Transform( &advance, &font_matrix );\r\n        metrics->vertAdvance = advance.y + font_offset.y;\r\n#endif\r\n\r\n        if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )\r\n        {\r\n          /* scale the outline and the metrics */\r\n          FT_Int       n;\r\n          FT_Outline*  cur = decoder.builder.base;\r\n          FT_Vector*   vec = cur->points;\r\n          FT_Fixed     x_scale = glyph->x_scale;\r\n          FT_Fixed     y_scale = glyph->y_scale;\r\n\r\n\r\n          /* First of all, scale the points, if we are not hinting */\r\n          if ( !hinting || ! decoder.builder.hints_funcs )\r\n            for ( n = cur->n_points; n > 0; n--, vec++ )\r\n            {\r\n              vec->x = FT_MulFix( vec->x, x_scale );\r\n              vec->y = FT_MulFix( vec->y, y_scale );\r\n            }\r\n\r\n          /* Then scale the metrics */\r\n          metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );\r\n          metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );\r\n        }\r\n\r\n        /* compute the other metrics */\r\n        FT_Outline_Get_CBox( &t1glyph->outline, &cbox );\r\n\r\n        metrics->width  = cbox.xMax - cbox.xMin;\r\n        metrics->height = cbox.yMax - cbox.yMin;\r\n\r\n        metrics->horiBearingX = cbox.xMin;\r\n        metrics->horiBearingY = cbox.yMax;\r\n\r\n        if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )\r\n        {\r\n          /* make up vertical ones */\r\n          ft_synthesize_vertical_metrics( metrics,\r\n                                          metrics->vertAdvance );\r\n        }\r\n      }\r\n\r\n      /* Set control data to the glyph charstrings.  Note that this is */\r\n      /* _not_ zero-terminated.                                        */\r\n      t1glyph->control_data = (FT_Byte*)glyph_data.pointer;\r\n      t1glyph->control_len  = glyph_data.length;\r\n    }\r\n\r\n\r\n  Exit:\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    if ( glyph_data_loaded && face->root.internal->incremental_interface )\r\n    {\r\n      face->root.internal->incremental_interface->funcs->free_glyph_data(\r\n        face->root.internal->incremental_interface->object,\r\n        &glyph_data );\r\n\r\n      /* Set the control data to null - it is no longer available if   */\r\n      /* loaded incrementally.                                         */\r\n      t1glyph->control_data = 0;\r\n      t1glyph->control_len  = 0;\r\n    }\r\n#endif\r\n\r\n    if ( must_finish_decoder )\r\n      decoder_funcs->done( &decoder );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1gload.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1gload.h                                                              */\r\n/*                                                                         */\r\n/*    Type 1 Glyph Loader (specification).                                 */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2008, 2011 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1GLOAD_H__\r\n#define __T1GLOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include \"t1objs.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Compute_Max_Advance( T1_Face  face,\r\n                          FT_Pos*  max_advance );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Get_Advances( FT_Face    face,\r\n                   FT_UInt    first,\r\n                   FT_UInt    count,\r\n                   FT_Int32   load_flags,\r\n                   FT_Fixed*  advances );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Load_Glyph( FT_GlyphSlot  glyph,\r\n                 FT_Size       size,\r\n                 FT_UInt       glyph_index,\r\n                 FT_Int32      load_flags );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1GLOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1load.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1load.c                                                               */\r\n/*                                                                         */\r\n/*    Type 1 font loader (body).                                           */\r\n/*                                                                         */\r\n/*  Copyright 1996-2012 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This is the new and improved Type 1 data loader for FreeType 2.  The  */\r\n  /* old loader has several problems: it is slow, complex, difficult to    */\r\n  /* maintain, and contains incredible hacks to make it accept some        */\r\n  /* ill-formed Type 1 fonts without hiccup-ing.  Moreover, about 5% of    */\r\n  /* the Type 1 fonts on my machine still aren't loaded correctly by it.   */\r\n  /*                                                                       */\r\n  /* This version is much simpler, much faster and also easier to read and */\r\n  /* maintain by a great order of magnitude.  The idea behind it is to     */\r\n  /* _not_ try to read the Type 1 token stream with a state machine (i.e.  */\r\n  /* a Postscript-like interpreter) but rather to perform simple pattern   */\r\n  /* matching.                                                             */\r\n  /*                                                                       */\r\n  /* Indeed, nearly all data definitions follow a simple pattern like      */\r\n  /*                                                                       */\r\n  /*  ... /Field <data> ...                                                */\r\n  /*                                                                       */\r\n  /* where <data> can be a number, a boolean, a string, or an array of     */\r\n  /* numbers.  There are a few exceptions, namely the encoding, font name, */\r\n  /* charstrings, and subrs; they are handled with a special pattern       */\r\n  /* matching routine.                                                     */\r\n  /*                                                                       */\r\n  /* All other common cases are handled very simply.  The matching rules   */\r\n  /* are defined in the file `t1tokens.h' through the use of several       */\r\n  /* macros calls PARSE_XXX.  This file is included twice here; the first  */\r\n  /* time to generate parsing callback functions, the second time to       */\r\n  /* generate a table of keywords (with pointers to the associated         */\r\n  /* callback functions).                                                  */\r\n  /*                                                                       */\r\n  /* The function `parse_dict' simply scans *linearly* a given dictionary  */\r\n  /* (either the top-level or private one) and calls the appropriate       */\r\n  /* callback when it encounters an immediate keyword.                     */\r\n  /*                                                                       */\r\n  /* This is by far the fastest way one can find to parse and read all     */\r\n  /* data.                                                                 */\r\n  /*                                                                       */\r\n  /* This led to tremendous code size reduction.  Note that later, the     */\r\n  /* glyph loader will also be _greatly_ simplified, and the automatic     */\r\n  /* hinter will replace the clumsy `t1hinter'.                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n// Ignore Warnings\r\n// C4245 : 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch\r\n#pragma warning( disable : 4245 )\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_MULTIPLE_MASTERS_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include FT_INTERNAL_CALC_H\r\n\r\n#include \"t1load.h\"\r\n#include \"t1errors.h\"\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n#define IS_INCREMENTAL  ( face->root.internal->incremental_interface != 0 )\r\n#else\r\n#define IS_INCREMENTAL  0\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1load\r\n\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    MULTIPLE MASTERS SUPPORT                   *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static FT_Error\r\n  t1_allocate_blend( T1_Face  face,\r\n                     FT_UInt  num_designs,\r\n                     FT_UInt  num_axis )\r\n  {\r\n    PS_Blend   blend;\r\n    FT_Memory  memory = face->root.memory;\r\n    FT_Error   error  = T1_Err_Ok;\r\n\r\n\r\n    blend = face->blend;\r\n    if ( !blend )\r\n    {\r\n      if ( FT_NEW( blend ) )\r\n        goto Exit;\r\n\r\n      blend->num_default_design_vector = 0;\r\n\r\n      face->blend = blend;\r\n    }\r\n\r\n    /* allocate design data if needed */\r\n    if ( num_designs > 0 )\r\n    {\r\n      if ( blend->num_designs == 0 )\r\n      {\r\n        FT_UInt  nn;\r\n\r\n\r\n        /* allocate the blend `private' and `font_info' dictionaries */\r\n        if ( FT_NEW_ARRAY( blend->font_infos[1], num_designs     ) ||\r\n             FT_NEW_ARRAY( blend->privates[1], num_designs       ) ||\r\n             FT_NEW_ARRAY( blend->bboxes[1], num_designs         ) ||\r\n             FT_NEW_ARRAY( blend->weight_vector, num_designs * 2 ) )\r\n          goto Exit;\r\n\r\n        blend->default_weight_vector = blend->weight_vector + num_designs;\r\n\r\n        blend->font_infos[0] = &face->type1.font_info;\r\n        blend->privates  [0] = &face->type1.private_dict;\r\n        blend->bboxes    [0] = &face->type1.font_bbox;\r\n\r\n        for ( nn = 2; nn <= num_designs; nn++ )\r\n        {\r\n          blend->privates[nn]   = blend->privates  [nn - 1] + 1;\r\n          blend->font_infos[nn] = blend->font_infos[nn - 1] + 1;\r\n          blend->bboxes[nn]     = blend->bboxes    [nn - 1] + 1;\r\n        }\r\n\r\n        blend->num_designs   = num_designs;\r\n      }\r\n      else if ( blend->num_designs != num_designs )\r\n        goto Fail;\r\n    }\r\n\r\n    /* allocate axis data if needed */\r\n    if ( num_axis > 0 )\r\n    {\r\n      if ( blend->num_axis != 0 && blend->num_axis != num_axis )\r\n        goto Fail;\r\n\r\n      blend->num_axis = num_axis;\r\n    }\r\n\r\n    /* allocate the blend design pos table if needed */\r\n    num_designs = blend->num_designs;\r\n    num_axis    = blend->num_axis;\r\n    if ( num_designs && num_axis && blend->design_pos[0] == 0 )\r\n    {\r\n      FT_UInt  n;\r\n\r\n\r\n      if ( FT_NEW_ARRAY( blend->design_pos[0], num_designs * num_axis ) )\r\n        goto Exit;\r\n\r\n      for ( n = 1; n < num_designs; n++ )\r\n        blend->design_pos[n] = blend->design_pos[0] + num_axis * n;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n\r\n  Fail:\r\n    error = T1_Err_Invalid_File_Format;\r\n    goto Exit;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Get_Multi_Master( T1_Face           face,\r\n                       FT_Multi_Master*  master )\r\n  {\r\n    PS_Blend  blend = face->blend;\r\n    FT_UInt   n;\r\n    FT_Error  error;\r\n\r\n\r\n    error = T1_Err_Invalid_Argument;\r\n\r\n    if ( blend )\r\n    {\r\n      master->num_axis    = blend->num_axis;\r\n      master->num_designs = blend->num_designs;\r\n\r\n      for ( n = 0; n < blend->num_axis; n++ )\r\n      {\r\n        FT_MM_Axis*   axis = master->axis + n;\r\n        PS_DesignMap  map = blend->design_map + n;\r\n\r\n\r\n        axis->name    = blend->axis_names[n];\r\n        axis->minimum = map->design_points[0];\r\n        axis->maximum = map->design_points[map->num_points - 1];\r\n      }\r\n\r\n      error = T1_Err_Ok;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Given a normalized (blend) coordinate, figure out the design          */\r\n  /* coordinate appropriate for that value.                                */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Fixed )\r\n  mm_axis_unmap( PS_DesignMap  axismap,\r\n                 FT_Fixed      ncv )\r\n  {\r\n    int  j;\r\n\r\n\r\n    if ( ncv <= axismap->blend_points[0] )\r\n      return INT_TO_FIXED( axismap->design_points[0] );\r\n\r\n    for ( j = 1; j < axismap->num_points; ++j )\r\n    {\r\n      if ( ncv <= axismap->blend_points[j] )\r\n        return INT_TO_FIXED( axismap->design_points[j - 1] ) +\r\n               ( axismap->design_points[j] - axismap->design_points[j - 1] ) *\r\n               FT_DivFix( ncv - axismap->blend_points[j - 1],\r\n                          axismap->blend_points[j] -\r\n                            axismap->blend_points[j - 1] );\r\n    }\r\n\r\n    return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Given a vector of weights, one for each design, figure out the        */\r\n  /* normalized axis coordinates which gave rise to those weights.         */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  mm_weights_unmap( FT_Fixed*  weights,\r\n                    FT_Fixed*  axiscoords,\r\n                    FT_UInt    axis_count )\r\n  {\r\n    FT_ASSERT( axis_count <= T1_MAX_MM_AXIS );\r\n\r\n    if ( axis_count == 1 )\r\n      axiscoords[0] = weights[1];\r\n\r\n    else if ( axis_count == 2 )\r\n    {\r\n      axiscoords[0] = weights[3] + weights[1];\r\n      axiscoords[1] = weights[3] + weights[2];\r\n    }\r\n\r\n    else if ( axis_count == 3 )\r\n    {\r\n      axiscoords[0] = weights[7] + weights[5] + weights[3] + weights[1];\r\n      axiscoords[1] = weights[7] + weights[6] + weights[3] + weights[2];\r\n      axiscoords[2] = weights[7] + weights[6] + weights[5] + weights[4];\r\n    }\r\n\r\n    else\r\n    {\r\n      axiscoords[0] = weights[15] + weights[13] + weights[11] + weights[9] +\r\n                        weights[7] + weights[5] + weights[3] + weights[1];\r\n      axiscoords[1] = weights[15] + weights[14] + weights[11] + weights[10] +\r\n                        weights[7] + weights[6] + weights[3] + weights[2];\r\n      axiscoords[2] = weights[15] + weights[14] + weights[13] + weights[12] +\r\n                        weights[7] + weights[6] + weights[5] + weights[4];\r\n      axiscoords[3] = weights[15] + weights[14] + weights[13] + weights[12] +\r\n                        weights[11] + weights[10] + weights[9] + weights[8];\r\n    }\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Just a wrapper around T1_Get_Multi_Master to support the different    */\r\n  /*  arguments needed by the GX var distortable fonts.                    */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Get_MM_Var( T1_Face      face,\r\n                 FT_MM_Var*  *master )\r\n  {\r\n    FT_Memory        memory = face->root.memory;\r\n    FT_MM_Var       *mmvar = NULL;\r\n    FT_Multi_Master  mmaster;\r\n    FT_Error         error;\r\n    FT_UInt          i;\r\n    FT_Fixed         axiscoords[T1_MAX_MM_AXIS];\r\n    PS_Blend         blend = face->blend;\r\n\r\n\r\n    error = T1_Get_Multi_Master( face, &mmaster );\r\n    if ( error )\r\n      goto Exit;\r\n    if ( FT_ALLOC( mmvar,\r\n                   sizeof ( FT_MM_Var ) +\r\n                     mmaster.num_axis * sizeof ( FT_Var_Axis ) ) )\r\n      goto Exit;\r\n\r\n    mmvar->num_axis        = mmaster.num_axis;\r\n    mmvar->num_designs     = mmaster.num_designs;\r\n    mmvar->num_namedstyles = ~0;                         /* Does not apply */\r\n    mmvar->axis            = (FT_Var_Axis*)&mmvar[1];\r\n                                      /* Point to axes after MM_Var struct */\r\n    mmvar->namedstyle      = NULL;\r\n\r\n    for ( i = 0 ; i < mmaster.num_axis; ++i )\r\n    {\r\n      mmvar->axis[i].name    = mmaster.axis[i].name;\r\n      mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum);\r\n      mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum);\r\n      mmvar->axis[i].def     = ( mmvar->axis[i].minimum +\r\n                                   mmvar->axis[i].maximum ) / 2;\r\n                            /* Does not apply.  But this value is in range */\r\n      mmvar->axis[i].strid   = ~0;                       /* Does not apply */\r\n      mmvar->axis[i].tag     = ~0;                       /* Does not apply */\r\n\r\n      if ( ft_strcmp( mmvar->axis[i].name, \"Weight\" ) == 0 )\r\n        mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );\r\n      else if ( ft_strcmp( mmvar->axis[i].name, \"Width\" ) == 0 )\r\n        mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' );\r\n      else if ( ft_strcmp( mmvar->axis[i].name, \"OpticalSize\" ) == 0 )\r\n        mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );\r\n    }\r\n\r\n    if ( blend->num_designs == ( 1U << blend->num_axis ) )\r\n    {\r\n      mm_weights_unmap( blend->default_weight_vector,\r\n                        axiscoords,\r\n                        blend->num_axis );\r\n\r\n      for ( i = 0; i < mmaster.num_axis; ++i )\r\n        mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],\r\n                                            axiscoords[i] );\r\n    }\r\n\r\n    *master = mmvar;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Set_MM_Blend( T1_Face    face,\r\n                   FT_UInt    num_coords,\r\n                   FT_Fixed*  coords )\r\n  {\r\n    PS_Blend  blend = face->blend;\r\n    FT_Error  error;\r\n    FT_UInt   n, m;\r\n\r\n\r\n    error = T1_Err_Invalid_Argument;\r\n\r\n    if ( blend && blend->num_axis == num_coords )\r\n    {\r\n      /* recompute the weight vector from the blend coordinates */\r\n      error = T1_Err_Ok;\r\n\r\n      for ( n = 0; n < blend->num_designs; n++ )\r\n      {\r\n        FT_Fixed  result = 0x10000L;  /* 1.0 fixed */\r\n\r\n\r\n        for ( m = 0; m < blend->num_axis; m++ )\r\n        {\r\n          FT_Fixed  factor;\r\n\r\n\r\n          /* get current blend axis position */\r\n          factor = coords[m];\r\n          if ( factor < 0 )        factor = 0;\r\n          if ( factor > 0x10000L ) factor = 0x10000L;\r\n\r\n          if ( ( n & ( 1 << m ) ) == 0 )\r\n            factor = 0x10000L - factor;\r\n\r\n          result = FT_MulFix( result, factor );\r\n        }\r\n        blend->weight_vector[n] = result;\r\n      }\r\n\r\n      error = T1_Err_Ok;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Set_MM_Design( T1_Face   face,\r\n                    FT_UInt   num_coords,\r\n                    FT_Long*  coords )\r\n  {\r\n    PS_Blend  blend = face->blend;\r\n    FT_Error  error;\r\n    FT_UInt   n, p;\r\n\r\n\r\n    error = T1_Err_Invalid_Argument;\r\n    if ( blend && blend->num_axis == num_coords )\r\n    {\r\n      /* compute the blend coordinates through the blend design map */\r\n      FT_Fixed  final_blends[T1_MAX_MM_DESIGNS];\r\n\r\n\r\n      for ( n = 0; n < blend->num_axis; n++ )\r\n      {\r\n        FT_Long       design  = coords[n];\r\n        FT_Fixed      the_blend;\r\n        PS_DesignMap  map     = blend->design_map + n;\r\n        FT_Long*      designs = map->design_points;\r\n        FT_Fixed*     blends  = map->blend_points;\r\n        FT_Int        before  = -1, after = -1;\r\n\r\n\r\n        for ( p = 0; p < (FT_UInt)map->num_points; p++ )\r\n        {\r\n          FT_Long  p_design = designs[p];\r\n\r\n\r\n          /* exact match? */\r\n          if ( design == p_design )\r\n          {\r\n            the_blend = blends[p];\r\n            goto Found;\r\n          }\r\n\r\n          if ( design < p_design )\r\n          {\r\n            after = p;\r\n            break;\r\n          }\r\n\r\n          before = p;\r\n        }\r\n\r\n        /* now interpolate if necessary */\r\n        if ( before < 0 )\r\n          the_blend = blends[0];\r\n\r\n        else if ( after < 0 )\r\n          the_blend = blends[map->num_points - 1];\r\n\r\n        else\r\n          the_blend = FT_MulDiv( design         - designs[before],\r\n                                 blends [after] - blends [before],\r\n                                 designs[after] - designs[before] );\r\n\r\n      Found:\r\n        final_blends[n] = the_blend;\r\n      }\r\n\r\n      error = T1_Set_MM_Blend( face, num_coords, final_blends );\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Just a wrapper around T1_Set_MM_Design to support the different       */\r\n  /* arguments needed by the GX var distortable fonts.                     */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Set_Var_Design( T1_Face    face,\r\n                     FT_UInt    num_coords,\r\n                     FT_Fixed*  coords )\r\n  {\r\n     FT_Long   lcoords[4];          /* maximum axis count is 4 */\r\n     FT_UInt   i;\r\n     FT_Error  error;\r\n\r\n\r\n     error = T1_Err_Invalid_Argument;\r\n     if ( num_coords <= 4 && num_coords > 0 )\r\n     {\r\n       for ( i = 0; i < num_coords; ++i )\r\n         lcoords[i] = FIXED_TO_INT( coords[i] );\r\n       error = T1_Set_MM_Design( face, num_coords, lcoords );\r\n     }\r\n\r\n     return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T1_Done_Blend( T1_Face  face )\r\n  {\r\n    FT_Memory  memory = face->root.memory;\r\n    PS_Blend   blend  = face->blend;\r\n\r\n\r\n    if ( blend )\r\n    {\r\n      FT_UInt  num_designs = blend->num_designs;\r\n      FT_UInt  num_axis    = blend->num_axis;\r\n      FT_UInt  n;\r\n\r\n\r\n      /* release design pos table */\r\n      FT_FREE( blend->design_pos[0] );\r\n      for ( n = 1; n < num_designs; n++ )\r\n        blend->design_pos[n] = 0;\r\n\r\n      /* release blend `private' and `font info' dictionaries */\r\n      FT_FREE( blend->privates[1] );\r\n      FT_FREE( blend->font_infos[1] );\r\n      FT_FREE( blend->bboxes[1] );\r\n\r\n      for ( n = 0; n < num_designs; n++ )\r\n      {\r\n        blend->privates  [n] = 0;\r\n        blend->font_infos[n] = 0;\r\n        blend->bboxes    [n] = 0;\r\n      }\r\n\r\n      /* release weight vectors */\r\n      FT_FREE( blend->weight_vector );\r\n      blend->default_weight_vector = 0;\r\n\r\n      /* release axis names */\r\n      for ( n = 0; n < num_axis; n++ )\r\n        FT_FREE( blend->axis_names[n] );\r\n\r\n      /* release design map */\r\n      for ( n = 0; n < num_axis; n++ )\r\n      {\r\n        PS_DesignMap  dmap = blend->design_map + n;\r\n\r\n\r\n        FT_FREE( dmap->design_points );\r\n        dmap->num_points = 0;\r\n      }\r\n\r\n      FT_FREE( face->blend );\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  parse_blend_axis_types( T1_Face    face,\r\n                          T1_Loader  loader )\r\n  {\r\n    T1_TokenRec  axis_tokens[T1_MAX_MM_AXIS];\r\n    FT_Int       n, num_axis;\r\n    FT_Error     error = T1_Err_Ok;\r\n    PS_Blend     blend;\r\n    FT_Memory    memory;\r\n\r\n\r\n    /* take an array of objects */\r\n    T1_ToTokenArray( &loader->parser, axis_tokens,\r\n                     T1_MAX_MM_AXIS, &num_axis );\r\n    if ( num_axis < 0 )\r\n    {\r\n      error = T1_Err_Ignore;\r\n      goto Exit;\r\n    }\r\n    if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS )\r\n    {\r\n      FT_ERROR(( \"parse_blend_axis_types: incorrect number of axes: %d\\n\",\r\n                 num_axis ));\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* allocate blend if necessary */\r\n    error = t1_allocate_blend( face, 0, (FT_UInt)num_axis );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    blend  = face->blend;\r\n    memory = face->root.memory;\r\n\r\n    /* each token is an immediate containing the name of the axis */\r\n    for ( n = 0; n < num_axis; n++ )\r\n    {\r\n      T1_Token    token = axis_tokens + n;\r\n      FT_Byte*    name;\r\n      FT_PtrDist  len;\r\n\r\n\r\n      /* skip first slash, if any */\r\n      if ( token->start[0] == '/' )\r\n        token->start++;\r\n\r\n      len = token->limit - token->start;\r\n      if ( len == 0 )\r\n      {\r\n        error = T1_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( FT_ALLOC( blend->axis_names[n], (FT_Long)( len + 1 ) ) )\r\n        goto Exit;\r\n\r\n      name = (FT_Byte*)blend->axis_names[n];\r\n      FT_MEM_COPY( name, token->start, len );\r\n      name[len] = 0;\r\n    }\r\n\r\n  Exit:\r\n    loader->parser.root.error = error;\r\n  }\r\n\r\n\r\n  static void\r\n  parse_blend_design_positions( T1_Face    face,\r\n                                T1_Loader  loader )\r\n  {\r\n    T1_TokenRec  design_tokens[T1_MAX_MM_DESIGNS];\r\n    FT_Int       num_designs;\r\n    FT_Int       num_axis;\r\n    T1_Parser    parser = &loader->parser;\r\n\r\n    FT_Error     error = T1_Err_Ok;\r\n    PS_Blend     blend;\r\n\r\n\r\n    /* get the array of design tokens -- compute number of designs */\r\n    T1_ToTokenArray( parser, design_tokens,\r\n                     T1_MAX_MM_DESIGNS, &num_designs );\r\n    if ( num_designs < 0 )\r\n    {\r\n      error = T1_Err_Ignore;\r\n      goto Exit;\r\n    }\r\n    if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )\r\n    {\r\n      FT_ERROR(( \"parse_blend_design_positions:\"\r\n                 \" incorrect number of designs: %d\\n\",\r\n                 num_designs ));\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    {\r\n      FT_Byte*  old_cursor = parser->root.cursor;\r\n      FT_Byte*  old_limit  = parser->root.limit;\r\n      FT_Int    n;\r\n\r\n\r\n      blend    = face->blend;\r\n      num_axis = 0;  /* make compiler happy */\r\n\r\n      for ( n = 0; n < num_designs; n++ )\r\n      {\r\n        T1_TokenRec  axis_tokens[T1_MAX_MM_AXIS];\r\n        T1_Token     token;\r\n        FT_Int       axis, n_axis;\r\n\r\n\r\n        /* read axis/coordinates tokens */\r\n        token = design_tokens + n;\r\n        parser->root.cursor = token->start;\r\n        parser->root.limit  = token->limit;\r\n        T1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &n_axis );\r\n\r\n        if ( n == 0 )\r\n        {\r\n          if ( n_axis <= 0 || n_axis > T1_MAX_MM_AXIS )\r\n          {\r\n            FT_ERROR(( \"parse_blend_design_positions:\"\r\n                       \" invalid number of axes: %d\\n\",\r\n                       n_axis ));\r\n            error = T1_Err_Invalid_File_Format;\r\n            goto Exit;\r\n          }\r\n\r\n          num_axis = n_axis;\r\n          error = t1_allocate_blend( face, num_designs, num_axis );\r\n          if ( error )\r\n            goto Exit;\r\n          blend = face->blend;\r\n        }\r\n        else if ( n_axis != num_axis )\r\n        {\r\n          FT_ERROR(( \"parse_blend_design_positions: incorrect table\\n\" ));\r\n          error = T1_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        /* now read each axis token into the design position */\r\n        for ( axis = 0; axis < n_axis; axis++ )\r\n        {\r\n          T1_Token  token2 = axis_tokens + axis;\r\n\r\n\r\n          parser->root.cursor = token2->start;\r\n          parser->root.limit  = token2->limit;\r\n          blend->design_pos[n][axis] = T1_ToFixed( parser, 0 );\r\n        }\r\n      }\r\n\r\n      loader->parser.root.cursor = old_cursor;\r\n      loader->parser.root.limit  = old_limit;\r\n    }\r\n\r\n  Exit:\r\n    loader->parser.root.error = error;\r\n  }\r\n\r\n\r\n  static void\r\n  parse_blend_design_map( T1_Face    face,\r\n                          T1_Loader  loader )\r\n  {\r\n    FT_Error     error  = T1_Err_Ok;\r\n    T1_Parser    parser = &loader->parser;\r\n    PS_Blend     blend;\r\n    T1_TokenRec  axis_tokens[T1_MAX_MM_AXIS];\r\n    FT_Int       n, num_axis;\r\n    FT_Byte*     old_cursor;\r\n    FT_Byte*     old_limit;\r\n    FT_Memory    memory = face->root.memory;\r\n\r\n\r\n    T1_ToTokenArray( parser, axis_tokens,\r\n                     T1_MAX_MM_AXIS, &num_axis );\r\n    if ( num_axis < 0 )\r\n    {\r\n      error = T1_Err_Ignore;\r\n      goto Exit;\r\n    }\r\n    if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS )\r\n    {\r\n      FT_ERROR(( \"parse_blend_design_map: incorrect number of axes: %d\\n\",\r\n                 num_axis ));\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    old_cursor = parser->root.cursor;\r\n    old_limit  = parser->root.limit;\r\n\r\n    error = t1_allocate_blend( face, 0, num_axis );\r\n    if ( error )\r\n      goto Exit;\r\n    blend = face->blend;\r\n\r\n    /* now read each axis design map */\r\n    for ( n = 0; n < num_axis; n++ )\r\n    {\r\n      PS_DesignMap  map = blend->design_map + n;\r\n      T1_Token      axis_token;\r\n      T1_TokenRec   point_tokens[T1_MAX_MM_MAP_POINTS];\r\n      FT_Int        p, num_points;\r\n\r\n\r\n      axis_token = axis_tokens + n;\r\n\r\n      parser->root.cursor = axis_token->start;\r\n      parser->root.limit  = axis_token->limit;\r\n      T1_ToTokenArray( parser, point_tokens,\r\n                       T1_MAX_MM_MAP_POINTS, &num_points );\r\n\r\n      if ( num_points <= 0 || num_points > T1_MAX_MM_MAP_POINTS )\r\n      {\r\n        FT_ERROR(( \"parse_blend_design_map: incorrect table\\n\" ));\r\n        error = T1_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      /* allocate design map data */\r\n      if ( FT_NEW_ARRAY( map->design_points, num_points * 2 ) )\r\n        goto Exit;\r\n      map->blend_points = map->design_points + num_points;\r\n      map->num_points   = (FT_Byte)num_points;\r\n\r\n      for ( p = 0; p < num_points; p++ )\r\n      {\r\n        T1_Token  point_token;\r\n\r\n\r\n        point_token = point_tokens + p;\r\n\r\n        /* don't include delimiting brackets */\r\n        parser->root.cursor = point_token->start + 1;\r\n        parser->root.limit  = point_token->limit - 1;\r\n\r\n        map->design_points[p] = T1_ToInt( parser );\r\n        map->blend_points [p] = T1_ToFixed( parser, 0 );\r\n      }\r\n    }\r\n\r\n    parser->root.cursor = old_cursor;\r\n    parser->root.limit  = old_limit;\r\n\r\n  Exit:\r\n    parser->root.error = error;\r\n  }\r\n\r\n\r\n  static void\r\n  parse_weight_vector( T1_Face    face,\r\n                       T1_Loader  loader )\r\n  {\r\n    T1_TokenRec  design_tokens[T1_MAX_MM_DESIGNS];\r\n    FT_Int       num_designs;\r\n    FT_Error     error  = T1_Err_Ok;\r\n    T1_Parser    parser = &loader->parser;\r\n    PS_Blend     blend  = face->blend;\r\n    T1_Token     token;\r\n    FT_Int       n;\r\n    FT_Byte*     old_cursor;\r\n    FT_Byte*     old_limit;\r\n\r\n\r\n    T1_ToTokenArray( parser, design_tokens,\r\n                     T1_MAX_MM_DESIGNS, &num_designs );\r\n    if ( num_designs < 0 )\r\n    {\r\n      error = T1_Err_Ignore;\r\n      goto Exit;\r\n    }\r\n    if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )\r\n    {\r\n      FT_ERROR(( \"parse_weight_vector:\"\r\n                 \" incorrect number of designs: %d\\n\",\r\n                 num_designs ));\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( !blend || !blend->num_designs )\r\n    {\r\n      error = t1_allocate_blend( face, num_designs, 0 );\r\n      if ( error )\r\n        goto Exit;\r\n      blend = face->blend;\r\n    }\r\n    else if ( blend->num_designs != (FT_UInt)num_designs )\r\n    {\r\n      FT_ERROR(( \"parse_weight_vector:\"\r\n                 \" /BlendDesignPosition and /WeightVector have\\n\"\r\n                 \"                    \"\r\n                 \" different number of elements\\n\" ));\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    old_cursor = parser->root.cursor;\r\n    old_limit  = parser->root.limit;\r\n\r\n    for ( n = 0; n < num_designs; n++ )\r\n    {\r\n      token = design_tokens + n;\r\n      parser->root.cursor = token->start;\r\n      parser->root.limit  = token->limit;\r\n\r\n      blend->default_weight_vector[n] =\r\n      blend->weight_vector[n]         = T1_ToFixed( parser, 0 );\r\n    }\r\n\r\n    parser->root.cursor = old_cursor;\r\n    parser->root.limit  = old_limit;\r\n\r\n  Exit:\r\n    parser->root.error = error;\r\n  }\r\n\r\n\r\n  /* e.g., /BuildCharArray [0 0 0 0 0 0 0 0] def           */\r\n  /* we're only interested in the number of array elements */\r\n  static void\r\n  parse_buildchar( T1_Face    face,\r\n                   T1_Loader  loader )\r\n  {\r\n    face->len_buildchar = T1_ToFixedArray( &loader->parser, 0, NULL, 0 );\r\n\r\n    return;\r\n  }\r\n\r\n\r\n#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */\r\n\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      TYPE 1 SYMBOL PARSING                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  static FT_Error\r\n  t1_load_keyword( T1_Face         face,\r\n                   T1_Loader       loader,\r\n                   const T1_Field  field )\r\n  {\r\n    FT_Error  error;\r\n    void*     dummy_object;\r\n    void**    objects;\r\n    FT_UInt   max_objects;\r\n    PS_Blend  blend = face->blend;\r\n\r\n\r\n    if ( blend && blend->num_designs == 0 )\r\n      blend = NULL;\r\n\r\n    /* if the keyword has a dedicated callback, call it */\r\n    if ( field->type == T1_FIELD_TYPE_CALLBACK )\r\n    {\r\n      field->reader( (FT_Face)face, loader );\r\n      error = loader->parser.root.error;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now, the keyword is either a simple field, or a table of fields; */\r\n    /* we are now going to take care of it                              */\r\n    switch ( field->location )\r\n    {\r\n    case T1_FIELD_LOCATION_FONT_INFO:\r\n      dummy_object = &face->type1.font_info;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n\r\n      if ( blend )\r\n      {\r\n        objects     = (void**)blend->font_infos;\r\n        max_objects = blend->num_designs;\r\n      }\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_FONT_EXTRA:\r\n      dummy_object = &face->type1.font_extra;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_PRIVATE:\r\n      dummy_object = &face->type1.private_dict;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n\r\n      if ( blend )\r\n      {\r\n        objects     = (void**)blend->privates;\r\n        max_objects = blend->num_designs;\r\n      }\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_BBOX:\r\n      dummy_object = &face->type1.font_bbox;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n\r\n      if ( blend )\r\n      {\r\n        objects     = (void**)blend->bboxes;\r\n        max_objects = blend->num_designs;\r\n      }\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_LOADER:\r\n      dummy_object = loader;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_FACE:\r\n      dummy_object = face;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n      break;\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n    case T1_FIELD_LOCATION_BLEND:\r\n      dummy_object = face->blend;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n      break;\r\n#endif\r\n\r\n    default:\r\n      dummy_object = &face->type1;\r\n      objects      = &dummy_object;\r\n      max_objects  = 0;\r\n    }\r\n\r\n    if ( *objects )\r\n    {\r\n      if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||\r\n           field->type == T1_FIELD_TYPE_FIXED_ARRAY   )\r\n        error = T1_Load_Field_Table( &loader->parser, field,\r\n                                     objects, max_objects, 0 );\r\n      else\r\n        error = T1_Load_Field( &loader->parser, field,\r\n                               objects, max_objects, 0 );\r\n    }\r\n    else\r\n    {\r\n      FT_TRACE1(( \"t1_load_keyword: ignoring keyword `%s'\"\r\n                  \" which is not valid at this point\\n\"\r\n                  \"                 (probably due to missing keywords)\\n\",\r\n                 field->ident ));\r\n      error = T1_Err_Ok;\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static void\r\n  parse_private( T1_Face    face,\r\n                 T1_Loader  loader )\r\n  {\r\n    FT_UNUSED( face );\r\n\r\n    loader->keywords_encountered |= T1_PRIVATE;\r\n  }\r\n\r\n\r\n  static int\r\n  read_binary_data( T1_Parser  parser,\r\n                    FT_Long*   size,\r\n                    FT_Byte**  base,\r\n                    FT_Bool    incremental )\r\n  {\r\n    FT_Byte*  cur;\r\n    FT_Byte*  limit = parser->root.limit;\r\n\r\n\r\n    /* the binary data has one of the following formats */\r\n    /*                                                  */\r\n    /*   `size' [white*] RD white ....... ND            */\r\n    /*   `size' [white*] -| white ....... |-            */\r\n    /*                                                  */\r\n\r\n    T1_Skip_Spaces( parser );\r\n\r\n    cur = parser->root.cursor;\r\n\r\n    if ( cur < limit && ft_isdigit( *cur ) )\r\n    {\r\n      FT_Long  s = T1_ToInt( parser );\r\n\r\n\r\n      T1_Skip_PS_Token( parser );   /* `RD' or `-|' or something else */\r\n\r\n      /* there is only one whitespace char after the */\r\n      /* `RD' or `-|' token                          */\r\n      *base = parser->root.cursor + 1;\r\n\r\n      if ( s >= 0 && s < limit - *base )\r\n      {\r\n        parser->root.cursor += s + 1;\r\n        *size = s;\r\n        return !parser->root.error;\r\n      }\r\n    }\r\n\r\n    if( !incremental )\r\n    {\r\n      FT_ERROR(( \"read_binary_data: invalid size field\\n\" ));\r\n      parser->root.error = T1_Err_Invalid_File_Format;\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /* We now define the routines to handle the `/Encoding', `/Subrs', */\r\n  /* and `/CharStrings' dictionaries.                                */\r\n\r\n  static void\r\n  t1_parse_font_matrix( T1_Face    face,\r\n                        T1_Loader  loader )\r\n  {\r\n    T1_Parser   parser = &loader->parser;\r\n    FT_Matrix*  matrix = &face->type1.font_matrix;\r\n    FT_Vector*  offset = &face->type1.font_offset;\r\n    FT_Face     root   = (FT_Face)&face->root;\r\n    FT_Fixed    temp[6];\r\n    FT_Fixed    temp_scale;\r\n    FT_Int      result;\r\n\r\n\r\n    result = T1_ToFixedArray( parser, 6, temp, 3 );\r\n\r\n    if ( result < 0 )\r\n    {\r\n      parser->root.error = T1_Err_Invalid_File_Format;\r\n      return;\r\n    }\r\n\r\n    temp_scale = FT_ABS( temp[3] );\r\n\r\n    if ( temp_scale == 0 )\r\n    {\r\n      FT_ERROR(( \"t1_parse_font_matrix: invalid font matrix\\n\" ));\r\n      parser->root.error = T1_Err_Invalid_File_Format;\r\n      return;\r\n    }\r\n\r\n    /* Set Units per EM based on FontMatrix values.  We set the value to */\r\n    /* 1000 / temp_scale, because temp_scale was already multiplied by   */\r\n    /* 1000 (in t1_tofixed, from psobjs.c).                              */\r\n\r\n    root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );\r\n\r\n    /* we need to scale the values by 1.0/temp_scale */\r\n    if ( temp_scale != 0x10000L )\r\n    {\r\n      temp[0] = FT_DivFix( temp[0], temp_scale );\r\n      temp[1] = FT_DivFix( temp[1], temp_scale );\r\n      temp[2] = FT_DivFix( temp[2], temp_scale );\r\n      temp[4] = FT_DivFix( temp[4], temp_scale );\r\n      temp[5] = FT_DivFix( temp[5], temp_scale );\r\n      temp[3] = temp[3] < 0 ? -0x10000L : 0x10000L;\r\n    }\r\n\r\n    matrix->xx = temp[0];\r\n    matrix->yx = temp[1];\r\n    matrix->xy = temp[2];\r\n    matrix->yy = temp[3];\r\n\r\n    /* note that the offsets must be expressed in integer font units */\r\n    offset->x = temp[4] >> 16;\r\n    offset->y = temp[5] >> 16;\r\n  }\r\n\r\n\r\n  static void\r\n  parse_encoding( T1_Face    face,\r\n                  T1_Loader  loader )\r\n  {\r\n    T1_Parser  parser = &loader->parser;\r\n    FT_Byte*   cur;\r\n    FT_Byte*   limit  = parser->root.limit;\r\n\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n\r\n\r\n    T1_Skip_Spaces( parser );\r\n    cur = parser->root.cursor;\r\n    if ( cur >= limit )\r\n    {\r\n      FT_ERROR(( \"parse_encoding: out of bounds\\n\" ));\r\n      parser->root.error = T1_Err_Invalid_File_Format;\r\n      return;\r\n    }\r\n\r\n    /* if we have a number or `[', the encoding is an array, */\r\n    /* and we must load it now                               */\r\n    if ( ft_isdigit( *cur ) || *cur == '[' )\r\n    {\r\n      T1_Encoding  encode          = &face->type1.encoding;\r\n      FT_Int       count, n;\r\n      PS_Table     char_table      = &loader->encoding_table;\r\n      FT_Memory    memory          = parser->root.memory;\r\n      FT_Error     error;\r\n      FT_Bool      only_immediates = 0;\r\n\r\n\r\n      /* read the number of entries in the encoding; should be 256 */\r\n      if ( *cur == '[' )\r\n      {\r\n        count           = 256;\r\n        only_immediates = 1;\r\n        parser->root.cursor++;\r\n      }\r\n      else\r\n        count = (FT_Int)T1_ToInt( parser );\r\n\r\n      T1_Skip_Spaces( parser );\r\n      if ( parser->root.cursor >= limit )\r\n        return;\r\n\r\n      /* we use a T1_Table to store our charnames */\r\n      loader->num_chars = encode->num_chars = count;\r\n      if ( FT_NEW_ARRAY( encode->char_index, count )     ||\r\n           FT_NEW_ARRAY( encode->char_name,  count )     ||\r\n           FT_SET_ERROR( psaux->ps_table_funcs->init(\r\n                           char_table, count, memory ) ) )\r\n      {\r\n        parser->root.error = error;\r\n        return;\r\n      }\r\n\r\n      /* We need to `zero' out encoding_table.elements */\r\n      for ( n = 0; n < count; n++ )\r\n      {\r\n        char*  notdef = (char *)\".notdef\";\r\n\r\n\r\n        T1_Add_Table( char_table, n, notdef, 8 );\r\n      }\r\n\r\n      /* Now we need to read records of the form                */\r\n      /*                                                        */\r\n      /*   ... charcode /charname ...                           */\r\n      /*                                                        */\r\n      /* for each entry in our table.                           */\r\n      /*                                                        */\r\n      /* We simply look for a number followed by an immediate   */\r\n      /* name.  Note that this ignores correctly the sequence   */\r\n      /* that is often seen in type1 fonts:                     */\r\n      /*                                                        */\r\n      /*   0 1 255 { 1 index exch /.notdef put } for dup        */\r\n      /*                                                        */\r\n      /* used to clean the encoding array before anything else. */\r\n      /*                                                        */\r\n      /* Alternatively, if the array is directly given as       */\r\n      /*                                                        */\r\n      /*   /Encoding [ ... ]                                    */\r\n      /*                                                        */\r\n      /* we only read immediates.                               */\r\n\r\n      n = 0;\r\n      T1_Skip_Spaces( parser );\r\n\r\n      while ( parser->root.cursor < limit )\r\n      {\r\n        cur = parser->root.cursor;\r\n\r\n        /* we stop when we encounter a `def' or `]' */\r\n        if ( *cur == 'd' && cur + 3 < limit )\r\n        {\r\n          if ( cur[1] == 'e'         &&\r\n               cur[2] == 'f'         &&\r\n               IS_PS_DELIM( cur[3] ) )\r\n          {\r\n            FT_TRACE6(( \"encoding end\\n\" ));\r\n            cur += 3;\r\n            break;\r\n          }\r\n        }\r\n        if ( *cur == ']' )\r\n        {\r\n          FT_TRACE6(( \"encoding end\\n\" ));\r\n          cur++;\r\n          break;\r\n        }\r\n\r\n        /* check whether we've found an entry */\r\n        if ( ft_isdigit( *cur ) || only_immediates )\r\n        {\r\n          FT_Int  charcode;\r\n\r\n\r\n          if ( only_immediates )\r\n            charcode = n;\r\n          else\r\n          {\r\n            charcode = (FT_Int)T1_ToInt( parser );\r\n            T1_Skip_Spaces( parser );\r\n          }\r\n\r\n          cur = parser->root.cursor;\r\n\r\n          if ( cur + 2 < limit && *cur == '/' && n < count )\r\n          {\r\n            FT_PtrDist  len;\r\n\r\n\r\n            cur++;\r\n\r\n            parser->root.cursor = cur;\r\n            T1_Skip_PS_Token( parser );\r\n            if ( parser->root.cursor >= limit )\r\n              return;\r\n            if ( parser->root.error )\r\n              return;\r\n\r\n            len = parser->root.cursor - cur;\r\n\r\n            parser->root.error = T1_Add_Table( char_table, charcode,\r\n                                               cur, len + 1 );\r\n            if ( parser->root.error )\r\n              return;\r\n            char_table->elements[charcode][len] = '\\0';\r\n\r\n            n++;\r\n          }\r\n          else if ( only_immediates )\r\n          {\r\n            /* Since the current position is not updated for           */\r\n            /* immediates-only mode we would get an infinite loop if   */\r\n            /* we don't do anything here.                              */\r\n            /*                                                         */\r\n            /* This encoding array is not valid according to the type1 */\r\n            /* specification (it might be an encoding for a CID type1  */\r\n            /* font, however), so we conclude that this font is NOT a  */\r\n            /* type1 font.                                             */\r\n            parser->root.error = FT_Err_Unknown_File_Format;\r\n            return;\r\n          }\r\n        }\r\n        else\r\n        {\r\n          T1_Skip_PS_Token( parser );\r\n          if ( parser->root.error )\r\n            return;\r\n        }\r\n\r\n        T1_Skip_Spaces( parser );\r\n      }\r\n\r\n      face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY;\r\n      parser->root.cursor       = cur;\r\n    }\r\n\r\n    /* Otherwise, we should have either `StandardEncoding', */\r\n    /* `ExpertEncoding', or `ISOLatin1Encoding'             */\r\n    else\r\n    {\r\n      if ( cur + 17 < limit                                            &&\r\n           ft_strncmp( (const char*)cur, \"StandardEncoding\", 16 ) == 0 )\r\n        face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD;\r\n\r\n      else if ( cur + 15 < limit                                          &&\r\n                ft_strncmp( (const char*)cur, \"ExpertEncoding\", 14 ) == 0 )\r\n        face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT;\r\n\r\n      else if ( cur + 18 < limit                                             &&\r\n                ft_strncmp( (const char*)cur, \"ISOLatin1Encoding\", 17 ) == 0 )\r\n        face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;\r\n\r\n      else\r\n        parser->root.error = T1_Err_Ignore;\r\n    }\r\n  }\r\n\r\n\r\n  static void\r\n  parse_subrs( T1_Face    face,\r\n               T1_Loader  loader )\r\n  {\r\n    T1_Parser  parser = &loader->parser;\r\n    PS_Table   table  = &loader->subrs;\r\n    FT_Memory  memory = parser->root.memory;\r\n    FT_Error   error;\r\n    FT_Int     num_subrs;\r\n\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n\r\n\r\n    T1_Skip_Spaces( parser );\r\n\r\n    /* test for empty array */\r\n    if ( parser->root.cursor < parser->root.limit &&\r\n         *parser->root.cursor == '['              )\r\n    {\r\n      T1_Skip_PS_Token( parser );\r\n      T1_Skip_Spaces  ( parser );\r\n      if ( parser->root.cursor >= parser->root.limit ||\r\n           *parser->root.cursor != ']'               )\r\n        parser->root.error = T1_Err_Invalid_File_Format;\r\n      return;\r\n    }\r\n\r\n    num_subrs = (FT_Int)T1_ToInt( parser );\r\n\r\n    /* position the parser right before the `dup' of the first subr */\r\n    T1_Skip_PS_Token( parser );         /* `array' */\r\n    if ( parser->root.error )\r\n      return;\r\n    T1_Skip_Spaces( parser );\r\n\r\n    /* initialize subrs array -- with synthetic fonts it is possible */\r\n    /* we get here twice                                             */\r\n    if ( !loader->num_subrs )\r\n    {\r\n      error = psaux->ps_table_funcs->init( table, num_subrs, memory );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n\r\n    /* the format is simple:   */\r\n    /*                         */\r\n    /*   `index' + binary data */\r\n    /*                         */\r\n    for (;;)\r\n    {\r\n      FT_Long   idx, size;\r\n      FT_Byte*  base;\r\n\r\n\r\n      /* If we are out of data, or if the next token isn't `dup', */\r\n      /* we are done.                                             */\r\n      if ( parser->root.cursor + 4 >= parser->root.limit          ||\r\n          ft_strncmp( (char*)parser->root.cursor, \"dup\", 3 ) != 0 )\r\n        break;\r\n\r\n      T1_Skip_PS_Token( parser );       /* `dup' */\r\n\r\n      idx = T1_ToInt( parser );\r\n\r\n      if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )\r\n        return;\r\n\r\n      /* The binary string is followed by one token, e.g. `NP' */\r\n      /* (bound to `noaccess put') or by two separate tokens:  */\r\n      /* `noaccess' & `put'.  We position the parser right     */\r\n      /* before the next `dup', if any.                        */\r\n      T1_Skip_PS_Token( parser );   /* `NP' or `|' or `noaccess' */\r\n      if ( parser->root.error )\r\n        return;\r\n      T1_Skip_Spaces  ( parser );\r\n\r\n      if ( parser->root.cursor + 4 < parser->root.limit            &&\r\n           ft_strncmp( (char*)parser->root.cursor, \"put\", 3 ) == 0 )\r\n      {\r\n        T1_Skip_PS_Token( parser ); /* skip `put' */\r\n        T1_Skip_Spaces  ( parser );\r\n      }\r\n\r\n      /* with synthetic fonts it is possible we get here twice */\r\n      if ( loader->num_subrs )\r\n        continue;\r\n\r\n      /* some fonts use a value of -1 for lenIV to indicate that */\r\n      /* the charstrings are unencoded                           */\r\n      /*                                                         */\r\n      /* thanks to Tom Kacvinsky for pointing this out           */\r\n      /*                                                         */\r\n      if ( face->type1.private_dict.lenIV >= 0 )\r\n      {\r\n        FT_Byte*  temp;\r\n\r\n\r\n        /* some fonts define empty subr records -- this is not totally */\r\n        /* compliant to the specification (which says they should at   */\r\n        /* least contain a `return'), but we support them anyway       */\r\n        if ( size < face->type1.private_dict.lenIV )\r\n        {\r\n          error = T1_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n\r\n        /* t1_decrypt() shouldn't write to base -- make temporary copy */\r\n        if ( FT_ALLOC( temp, size ) )\r\n          goto Fail;\r\n        FT_MEM_COPY( temp, base, size );\r\n        psaux->t1_decrypt( temp, size, 4330 );\r\n        size -= face->type1.private_dict.lenIV;\r\n        error = T1_Add_Table( table, (FT_Int)idx,\r\n                              temp + face->type1.private_dict.lenIV, size );\r\n        FT_FREE( temp );\r\n      }\r\n      else\r\n        error = T1_Add_Table( table, (FT_Int)idx, base, size );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n\r\n    if ( !loader->num_subrs )\r\n      loader->num_subrs = num_subrs;\r\n\r\n    return;\r\n\r\n  Fail:\r\n    parser->root.error = error;\r\n  }\r\n\r\n\r\n#define TABLE_EXTEND  5\r\n\r\n\r\n  static void\r\n  parse_charstrings( T1_Face    face,\r\n                     T1_Loader  loader )\r\n  {\r\n    T1_Parser      parser       = &loader->parser;\r\n    PS_Table       code_table   = &loader->charstrings;\r\n    PS_Table       name_table   = &loader->glyph_names;\r\n    PS_Table       swap_table   = &loader->swap_table;\r\n    FT_Memory      memory       = parser->root.memory;\r\n    FT_Error       error;\r\n\r\n    PSAux_Service  psaux        = (PSAux_Service)face->psaux;\r\n\r\n    FT_Byte*       cur;\r\n    FT_Byte*       limit        = parser->root.limit;\r\n    FT_Int         n, num_glyphs;\r\n    FT_UInt        notdef_index = 0;\r\n    FT_Byte        notdef_found = 0;\r\n\r\n\r\n    num_glyphs = (FT_Int)T1_ToInt( parser );\r\n    if ( num_glyphs < 0 )\r\n    {\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    /* some fonts like Optima-Oblique not only define the /CharStrings */\r\n    /* array but access it also                                        */\r\n    if ( num_glyphs == 0 || parser->root.error )\r\n      return;\r\n\r\n    /* initialize tables, leaving space for addition of .notdef, */\r\n    /* if necessary, and a few other glyphs to handle buggy      */\r\n    /* fonts which have more glyphs than specified.              */\r\n\r\n    /* for some non-standard fonts like `Optima' which provides  */\r\n    /* different outlines depending on the resolution it is      */\r\n    /* possible to get here twice                                */\r\n    if ( !loader->num_glyphs )\r\n    {\r\n      error = psaux->ps_table_funcs->init(\r\n                code_table, num_glyphs + 1 + TABLE_EXTEND, memory );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = psaux->ps_table_funcs->init(\r\n                name_table, num_glyphs + 1 + TABLE_EXTEND, memory );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Initialize table for swapping index notdef_index and */\r\n      /* index 0 names and codes (if necessary).              */\r\n\r\n      error = psaux->ps_table_funcs->init( swap_table, 4, memory );\r\n      if ( error )\r\n        goto Fail;\r\n    }\r\n\r\n    n = 0;\r\n\r\n    for (;;)\r\n    {\r\n      FT_Long   size;\r\n      FT_Byte*  base;\r\n\r\n\r\n      /* the format is simple:        */\r\n      /*   `/glyphname' + binary data */\r\n\r\n      T1_Skip_Spaces( parser );\r\n\r\n      cur = parser->root.cursor;\r\n      if ( cur >= limit )\r\n        break;\r\n\r\n      /* we stop when we find a `def' or `end' keyword */\r\n      if ( cur + 3 < limit && IS_PS_DELIM( cur[3] ) )\r\n      {\r\n        if ( cur[0] == 'd' &&\r\n             cur[1] == 'e' &&\r\n             cur[2] == 'f' )\r\n        {\r\n          /* There are fonts which have this: */\r\n          /*                                  */\r\n          /*   /CharStrings 118 dict def      */\r\n          /*   Private begin                  */\r\n          /*   CharStrings begin              */\r\n          /*   ...                            */\r\n          /*                                  */\r\n          /* To catch this we ignore `def' if */\r\n          /* no charstring has actually been  */\r\n          /* seen.                            */\r\n          if ( n )\r\n            break;\r\n        }\r\n\r\n        if ( cur[0] == 'e' &&\r\n             cur[1] == 'n' &&\r\n             cur[2] == 'd' )\r\n          break;\r\n      }\r\n\r\n      T1_Skip_PS_Token( parser );\r\n      if ( parser->root.error )\r\n        return;\r\n\r\n      if ( *cur == '/' )\r\n      {\r\n        FT_PtrDist  len;\r\n\r\n\r\n        if ( cur + 1 >= limit )\r\n        {\r\n          error = T1_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n\r\n        cur++;                              /* skip `/' */\r\n        len = parser->root.cursor - cur;\r\n\r\n        if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )\r\n          return;\r\n\r\n        /* for some non-standard fonts like `Optima' which provides */\r\n        /* different outlines depending on the resolution it is     */\r\n        /* possible to get here twice                               */\r\n        if ( loader->num_glyphs )\r\n          continue;\r\n\r\n        error = T1_Add_Table( name_table, n, cur, len + 1 );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        /* add a trailing zero to the name table */\r\n        name_table->elements[n][len] = '\\0';\r\n\r\n        /* record index of /.notdef */\r\n        if ( *cur == '.'                                              &&\r\n             ft_strcmp( \".notdef\",\r\n                        (const char*)(name_table->elements[n]) ) == 0 )\r\n        {\r\n          notdef_index = n;\r\n          notdef_found = 1;\r\n        }\r\n\r\n        if ( face->type1.private_dict.lenIV >= 0 &&\r\n             n < num_glyphs + TABLE_EXTEND       )\r\n        {\r\n          FT_Byte*  temp;\r\n\r\n\r\n          if ( size <= face->type1.private_dict.lenIV )\r\n          {\r\n            error = T1_Err_Invalid_File_Format;\r\n            goto Fail;\r\n          }\r\n\r\n          /* t1_decrypt() shouldn't write to base -- make temporary copy */\r\n          if ( FT_ALLOC( temp, size ) )\r\n            goto Fail;\r\n          FT_MEM_COPY( temp, base, size );\r\n          psaux->t1_decrypt( temp, size, 4330 );\r\n          size -= face->type1.private_dict.lenIV;\r\n          error = T1_Add_Table( code_table, n,\r\n                                temp + face->type1.private_dict.lenIV, size );\r\n          FT_FREE( temp );\r\n        }\r\n        else\r\n          error = T1_Add_Table( code_table, n, base, size );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        n++;\r\n      }\r\n    }\r\n\r\n    loader->num_glyphs = n;\r\n\r\n    /* if /.notdef is found but does not occupy index 0, do our magic. */\r\n    if ( notdef_found                                                 &&\r\n         ft_strcmp( \".notdef\", (const char*)name_table->elements[0] ) )\r\n    {\r\n      /* Swap glyph in index 0 with /.notdef glyph.  First, add index 0  */\r\n      /* name and code entries to swap_table.  Then place notdef_index   */\r\n      /* name and code entries into swap_table.  Then swap name and code */\r\n      /* entries at indices notdef_index and 0 using values stored in    */\r\n      /* swap_table.                                                     */\r\n\r\n      /* Index 0 name */\r\n      error = T1_Add_Table( swap_table, 0,\r\n                            name_table->elements[0],\r\n                            name_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Index 0 code */\r\n      error = T1_Add_Table( swap_table, 1,\r\n                            code_table->elements[0],\r\n                            code_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Index notdef_index name */\r\n      error = T1_Add_Table( swap_table, 2,\r\n                            name_table->elements[notdef_index],\r\n                            name_table->lengths [notdef_index] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Index notdef_index code */\r\n      error = T1_Add_Table( swap_table, 3,\r\n                            code_table->elements[notdef_index],\r\n                            code_table->lengths [notdef_index] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( name_table, notdef_index,\r\n                            swap_table->elements[0],\r\n                            swap_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( code_table, notdef_index,\r\n                            swap_table->elements[1],\r\n                            swap_table->lengths [1] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( name_table, 0,\r\n                            swap_table->elements[2],\r\n                            swap_table->lengths [2] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( code_table, 0,\r\n                            swap_table->elements[3],\r\n                            swap_table->lengths [3] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n    }\r\n    else if ( !notdef_found )\r\n    {\r\n      /* notdef_index is already 0, or /.notdef is undefined in   */\r\n      /* charstrings dictionary.  Worry about /.notdef undefined. */\r\n      /* We take index 0 and add it to the end of the table(s)    */\r\n      /* and add our own /.notdef glyph to index 0.               */\r\n\r\n      /* 0 333 hsbw endchar */\r\n      FT_Byte  notdef_glyph[] = { 0x8B, 0xF7, 0xE1, 0x0D, 0x0E };\r\n      char*    notdef_name    = (char *)\".notdef\";\r\n\r\n\r\n      error = T1_Add_Table( swap_table, 0,\r\n                            name_table->elements[0],\r\n                            name_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( swap_table, 1,\r\n                            code_table->elements[0],\r\n                            code_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( name_table, 0, notdef_name, 8 );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( code_table, 0, notdef_glyph, 5 );\r\n\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( name_table, n,\r\n                            swap_table->elements[0],\r\n                            swap_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( code_table, n,\r\n                            swap_table->elements[1],\r\n                            swap_table->lengths [1] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* we added a glyph. */\r\n      loader->num_glyphs += 1;\r\n    }\r\n\r\n    return;\r\n\r\n  Fail:\r\n    parser->root.error = error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the token field static variables.  This is a set of            */\r\n  /* T1_FieldRec variables.                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static\r\n  const T1_FieldRec  t1_keywords[] =\r\n  {\r\n\r\n#include \"t1tokens.h\"\r\n\r\n    /* now add the special functions... */\r\n    T1_FIELD_CALLBACK( \"FontMatrix\",           t1_parse_font_matrix,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n    T1_FIELD_CALLBACK( \"Encoding\",             parse_encoding,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n    T1_FIELD_CALLBACK( \"Subrs\",                parse_subrs,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n    T1_FIELD_CALLBACK( \"CharStrings\",          parse_charstrings,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n    T1_FIELD_CALLBACK( \"Private\",              parse_private,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n    T1_FIELD_CALLBACK( \"BlendDesignPositions\", parse_blend_design_positions,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n    T1_FIELD_CALLBACK( \"BlendDesignMap\",       parse_blend_design_map,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n    T1_FIELD_CALLBACK( \"BlendAxisTypes\",       parse_blend_axis_types,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n    T1_FIELD_CALLBACK( \"WeightVector\",         parse_weight_vector,\r\n                       T1_FIELD_DICT_FONTDICT )\r\n    T1_FIELD_CALLBACK( \"BuildCharArray\",       parse_buildchar,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n#endif\r\n\r\n    { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }\r\n  };\r\n\r\n\r\n#define T1_FIELD_COUNT                                           \\\r\n          ( sizeof ( t1_keywords ) / sizeof ( t1_keywords[0] ) )\r\n\r\n\r\n  static FT_Error\r\n  parse_dict( T1_Face    face,\r\n              T1_Loader  loader,\r\n              FT_Byte*   base,\r\n              FT_Long    size )\r\n  {\r\n    T1_Parser  parser = &loader->parser;\r\n    FT_Byte   *limit, *start_binary = NULL;\r\n    FT_Bool    have_integer = 0;\r\n\r\n\r\n    parser->root.cursor = base;\r\n    parser->root.limit  = base + size;\r\n    parser->root.error  = T1_Err_Ok;\r\n\r\n    limit = parser->root.limit;\r\n\r\n    T1_Skip_Spaces( parser );\r\n\r\n    while ( parser->root.cursor < limit )\r\n    {\r\n      FT_Byte*  cur;\r\n\r\n\r\n      cur = parser->root.cursor;\r\n\r\n      /* look for `eexec' */\r\n      if ( IS_PS_TOKEN( cur, limit, \"eexec\" ) )\r\n        break;\r\n\r\n      /* look for `closefile' which ends the eexec section */\r\n      else if ( IS_PS_TOKEN( cur, limit, \"closefile\" ) )\r\n        break;\r\n\r\n      /* in a synthetic font the base font starts after a           */\r\n      /* `FontDictionary' token that is placed after a Private dict */\r\n      else if ( IS_PS_TOKEN( cur, limit, \"FontDirectory\" ) )\r\n      {\r\n        if ( loader->keywords_encountered & T1_PRIVATE )\r\n          loader->keywords_encountered |=\r\n            T1_FONTDIR_AFTER_PRIVATE;\r\n        parser->root.cursor += 13;\r\n      }\r\n\r\n      /* check whether we have an integer */\r\n      else if ( ft_isdigit( *cur ) )\r\n      {\r\n        start_binary = cur;\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          goto Exit;\r\n        have_integer = 1;\r\n      }\r\n\r\n      /* in valid Type 1 fonts we don't see `RD' or `-|' directly */\r\n      /* since those tokens are handled by parse_subrs and        */\r\n      /* parse_charstrings                                        */\r\n      else if ( *cur == 'R' && cur + 6 < limit && *(cur + 1) == 'D' &&\r\n                have_integer )\r\n      {\r\n        FT_Long   s;\r\n        FT_Byte*  b;\r\n\r\n\r\n        parser->root.cursor = start_binary;\r\n        if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) )\r\n          return T1_Err_Invalid_File_Format;\r\n        have_integer = 0;\r\n      }\r\n\r\n      else if ( *cur == '-' && cur + 6 < limit && *(cur + 1) == '|' &&\r\n                have_integer )\r\n      {\r\n        FT_Long   s;\r\n        FT_Byte*  b;\r\n\r\n\r\n        parser->root.cursor = start_binary;\r\n        if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) )\r\n          return T1_Err_Invalid_File_Format;\r\n        have_integer = 0;\r\n      }\r\n\r\n      /* look for immediates */\r\n      else if ( *cur == '/' && cur + 2 < limit )\r\n      {\r\n        FT_PtrDist  len;\r\n\r\n\r\n        cur++;\r\n\r\n        parser->root.cursor = cur;\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          goto Exit;\r\n\r\n        len = parser->root.cursor - cur;\r\n\r\n        if ( len > 0 && len < 22 && parser->root.cursor < limit )\r\n        {\r\n          /* now compare the immediate name to the keyword table */\r\n          T1_Field  keyword = (T1_Field)t1_keywords;\r\n\r\n\r\n          for (;;)\r\n          {\r\n            FT_Byte*  name;\r\n\r\n\r\n            name = (FT_Byte*)keyword->ident;\r\n            if ( !name )\r\n              break;\r\n\r\n            if ( cur[0] == name[0]                                  &&\r\n                 len == (FT_PtrDist)ft_strlen( (const char *)name ) &&\r\n                 ft_memcmp( cur, name, len ) == 0                   )\r\n            {\r\n              /* We found it -- run the parsing callback!     */\r\n              /* We record every instance of every field      */\r\n              /* (until we reach the base font of a           */\r\n              /* synthetic font) to deal adequately with      */\r\n              /* multiple master fonts; this is also          */\r\n              /* necessary because later PostScript           */\r\n              /* definitions override earlier ones.           */\r\n\r\n              /* Once we encounter `FontDirectory' after      */\r\n              /* `/Private', we know that this is a synthetic */\r\n              /* font; except for `/CharStrings' we are not   */\r\n              /* interested in anything that follows this     */\r\n              /* `FontDirectory'.                             */\r\n\r\n              /* MM fonts have more than one /Private token at */\r\n              /* the top level; let's hope that all the junk   */\r\n              /* that follows the first /Private token is not  */\r\n              /* interesting to us.                            */\r\n\r\n              /* According to Adobe Tech Note #5175 (CID-Keyed */\r\n              /* Font Installation for ATM Software) a `begin' */\r\n              /* must be followed by exactly one `end', and    */\r\n              /* `begin' -- `end' pairs must be accurately     */\r\n              /* paired.  We could use this to distinguish     */\r\n              /* between the global Private and the Private    */\r\n              /* dict that is a member of the Blend dict.      */\r\n\r\n              const FT_UInt dict =\r\n                ( loader->keywords_encountered & T1_PRIVATE )\r\n                    ? T1_FIELD_DICT_PRIVATE\r\n                    : T1_FIELD_DICT_FONTDICT;\r\n\r\n              if ( !( dict & keyword->dict ) )\r\n              {\r\n                FT_TRACE1(( \"parse_dict: found `%s' but ignoring it\"\r\n                            \" since it is in the wrong dictionary\\n\",\r\n                            keyword->ident ));\r\n                break;\r\n              }\r\n\r\n              if ( !( loader->keywords_encountered &\r\n                      T1_FONTDIR_AFTER_PRIVATE     )                  ||\r\n                   ft_strcmp( (const char*)name, \"CharStrings\" ) == 0 )\r\n              {\r\n                parser->root.error = t1_load_keyword( face,\r\n                                                      loader,\r\n                                                      keyword );\r\n                if ( parser->root.error != T1_Err_Ok )\r\n                {\r\n                  if ( FT_ERROR_BASE( parser->root.error ) == FT_Err_Ignore )\r\n                    parser->root.error = T1_Err_Ok;\r\n                  else\r\n                    return parser->root.error;\r\n                }\r\n              }\r\n              break;\r\n            }\r\n\r\n            keyword++;\r\n          }\r\n        }\r\n\r\n        have_integer = 0;\r\n      }\r\n      else\r\n      {\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          goto Exit;\r\n        have_integer = 0;\r\n      }\r\n\r\n      T1_Skip_Spaces( parser );\r\n    }\r\n\r\n  Exit:\r\n    return parser->root.error;\r\n  }\r\n\r\n\r\n  static void\r\n  t1_init_loader( T1_Loader  loader,\r\n                  T1_Face    face )\r\n  {\r\n    FT_UNUSED( face );\r\n\r\n    FT_MEM_ZERO( loader, sizeof ( *loader ) );\r\n    loader->num_glyphs = 0;\r\n    loader->num_chars  = 0;\r\n\r\n    /* initialize the tables -- simply set their `init' field to 0 */\r\n    loader->encoding_table.init  = 0;\r\n    loader->charstrings.init     = 0;\r\n    loader->glyph_names.init     = 0;\r\n    loader->subrs.init           = 0;\r\n    loader->swap_table.init      = 0;\r\n    loader->fontdata             = 0;\r\n    loader->keywords_encountered = 0;\r\n  }\r\n\r\n\r\n  static void\r\n  t1_done_loader( T1_Loader  loader )\r\n  {\r\n    T1_Parser  parser = &loader->parser;\r\n\r\n\r\n    /* finalize tables */\r\n    T1_Release_Table( &loader->encoding_table );\r\n    T1_Release_Table( &loader->charstrings );\r\n    T1_Release_Table( &loader->glyph_names );\r\n    T1_Release_Table( &loader->swap_table );\r\n    T1_Release_Table( &loader->subrs );\r\n\r\n    /* finalize parser */\r\n    T1_Finalize_Parser( parser );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Open_Face( T1_Face  face )\r\n  {\r\n    T1_LoaderRec   loader;\r\n    T1_Parser      parser;\r\n    T1_Font        type1 = &face->type1;\r\n    PS_Private     priv  = &type1->private_dict;\r\n    FT_Error       error;\r\n\r\n    PSAux_Service  psaux = (PSAux_Service)face->psaux;\r\n\r\n\r\n    t1_init_loader( &loader, face );\r\n\r\n    /* default values */\r\n    face->ndv_idx          = -1;\r\n    face->cdv_idx          = -1;\r\n    face->len_buildchar    = 0;\r\n\r\n    priv->blue_shift       = 7;\r\n    priv->blue_fuzz        = 1;\r\n    priv->lenIV            = 4;\r\n    priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );\r\n    priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );\r\n\r\n    parser = &loader.parser;\r\n    error  = T1_New_Parser( parser,\r\n                            face->root.stream,\r\n                            face->root.memory,\r\n                            psaux );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = parse_dict( face, &loader,\r\n                        parser->base_dict, parser->base_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = T1_Get_Private_Dict( parser, psaux );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = parse_dict( face, &loader,\r\n                        parser->private_dict, parser->private_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* ensure even-ness of `num_blue_values' */\r\n    priv->num_blue_values &= ~1;\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n\r\n    if ( face->blend                                                     &&\r\n         face->blend->num_default_design_vector != 0                     &&\r\n         face->blend->num_default_design_vector != face->blend->num_axis )\r\n    {\r\n      /* we don't use it currently so just warn, reset, and ignore */\r\n      FT_ERROR(( \"T1_Open_Face(): /DesignVector contains %u entries \"\r\n                 \"while there are %u axes.\\n\",\r\n                 face->blend->num_default_design_vector,\r\n                 face->blend->num_axis ));\r\n\r\n      face->blend->num_default_design_vector = 0;\r\n    }\r\n\r\n    /* the following can happen for MM instances; we then treat the */\r\n    /* font as a normal PS font                                     */\r\n    if ( face->blend                                             &&\r\n         ( !face->blend->num_designs || !face->blend->num_axis ) )\r\n      T1_Done_Blend( face );\r\n\r\n    /* another safety check */\r\n    if ( face->blend )\r\n    {\r\n      FT_UInt  i;\r\n\r\n\r\n      for ( i = 0; i < face->blend->num_axis; i++ )\r\n        if ( !face->blend->design_map[i].num_points )\r\n        {\r\n          T1_Done_Blend( face );\r\n          break;\r\n        }\r\n    }\r\n\r\n    if ( face->blend )\r\n    {\r\n      if ( face->len_buildchar > 0 )\r\n      {\r\n        FT_Memory  memory = face->root.memory;\r\n\r\n\r\n        if ( FT_NEW_ARRAY( face->buildchar, face->len_buildchar ) )\r\n        {\r\n          FT_ERROR(( \"T1_Open_Face: cannot allocate BuildCharArray\\n\" ));\r\n          face->len_buildchar = 0;\r\n          goto Exit;\r\n        }\r\n      }\r\n    }\r\n    else\r\n      face->len_buildchar = 0;\r\n\r\n#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */\r\n\r\n    /* now, propagate the subrs, charstrings, and glyphnames tables */\r\n    /* to the Type1 data                                            */\r\n    type1->num_glyphs = loader.num_glyphs;\r\n\r\n    if ( loader.subrs.init )\r\n    {\r\n      loader.subrs.init  = 0;\r\n      type1->num_subrs   = loader.num_subrs;\r\n      type1->subrs_block = loader.subrs.block;\r\n      type1->subrs       = loader.subrs.elements;\r\n      type1->subrs_len   = loader.subrs.lengths;\r\n    }\r\n\r\n    if ( !IS_INCREMENTAL )\r\n      if ( !loader.charstrings.init )\r\n      {\r\n        FT_ERROR(( \"T1_Open_Face: no `/CharStrings' array in face\\n\" ));\r\n        error = T1_Err_Invalid_File_Format;\r\n      }\r\n\r\n    loader.charstrings.init  = 0;\r\n    type1->charstrings_block = loader.charstrings.block;\r\n    type1->charstrings       = loader.charstrings.elements;\r\n    type1->charstrings_len   = loader.charstrings.lengths;\r\n\r\n    /* we copy the glyph names `block' and `elements' fields; */\r\n    /* the `lengths' field must be released later             */\r\n    type1->glyph_names_block    = loader.glyph_names.block;\r\n    type1->glyph_names          = (FT_String**)loader.glyph_names.elements;\r\n    loader.glyph_names.block    = 0;\r\n    loader.glyph_names.elements = 0;\r\n\r\n    /* we must now build type1.encoding when we have a custom array */\r\n    if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY )\r\n    {\r\n      FT_Int    charcode, idx, min_char, max_char;\r\n      FT_Byte*  char_name;\r\n      FT_Byte*  glyph_name;\r\n\r\n\r\n      /* OK, we do the following: for each element in the encoding  */\r\n      /* table, look up the index of the glyph having the same name */\r\n      /* the index is then stored in type1.encoding.char_index, and */\r\n      /* the name to type1.encoding.char_name                       */\r\n\r\n      min_char = 0;\r\n      max_char = 0;\r\n\r\n      charcode = 0;\r\n      for ( ; charcode < loader.encoding_table.max_elems; charcode++ )\r\n      {\r\n        type1->encoding.char_index[charcode] = 0;\r\n        type1->encoding.char_name [charcode] = (char *)\".notdef\";\r\n\r\n        char_name = loader.encoding_table.elements[charcode];\r\n        if ( char_name )\r\n          for ( idx = 0; idx < type1->num_glyphs; idx++ )\r\n          {\r\n            glyph_name = (FT_Byte*)type1->glyph_names[idx];\r\n            if ( ft_strcmp( (const char*)char_name,\r\n                            (const char*)glyph_name ) == 0 )\r\n            {\r\n              type1->encoding.char_index[charcode] = (FT_UShort)idx;\r\n              type1->encoding.char_name [charcode] = (char*)glyph_name;\r\n\r\n              /* Change min/max encoded char only if glyph name is */\r\n              /* not /.notdef                                      */\r\n              if ( ft_strcmp( (const char*)\".notdef\",\r\n                              (const char*)glyph_name ) != 0 )\r\n              {\r\n                if ( charcode < min_char )\r\n                  min_char = charcode;\r\n                if ( charcode >= max_char )\r\n                  max_char = charcode + 1;\r\n              }\r\n              break;\r\n            }\r\n          }\r\n      }\r\n\r\n      type1->encoding.code_first = min_char;\r\n      type1->encoding.code_last  = max_char;\r\n      type1->encoding.num_chars  = loader.num_chars;\r\n    }\r\n\r\n  Exit:\r\n    t1_done_loader( &loader );\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1load.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1load.h                                                               */\r\n/*                                                                         */\r\n/*    Type 1 font loader (specification).                                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2006, 2007 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1LOAD_H__\r\n#define __T1LOAD_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n#include FT_MULTIPLE_MASTERS_H\r\n\r\n#include \"t1parse.h\"\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef struct  T1_Loader_\r\n  {\r\n    T1_ParserRec  parser;          /* parser used to read the stream */\r\n\r\n    FT_Int        num_chars;       /* number of characters in encoding */\r\n    PS_TableRec   encoding_table;  /* PS_Table used to store the       */\r\n                                   /* encoding character names         */\r\n\r\n    FT_Int        num_glyphs;\r\n    PS_TableRec   glyph_names;\r\n    PS_TableRec   charstrings;\r\n    PS_TableRec   swap_table;      /* For moving .notdef glyph to index 0. */\r\n\r\n    FT_Int        num_subrs;\r\n    PS_TableRec   subrs;\r\n    FT_Bool       fontdata;\r\n\r\n    FT_UInt       keywords_encountered; /* T1_LOADER_ENCOUNTERED_XXX */\r\n\r\n  } T1_LoaderRec, *T1_Loader;\r\n\r\n\r\n  /* treatment of some keywords differs depending on whether */\r\n  /* they precede or follow certain other keywords           */\r\n\r\n#define T1_PRIVATE                ( 1 << 0 )\r\n#define T1_FONTDIR_AFTER_PRIVATE  ( 1 << 1 )\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Open_Face( T1_Face  face );\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Get_Multi_Master( T1_Face           face,\r\n                       FT_Multi_Master*  master );\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Get_MM_Var( T1_Face      face,\r\n                 FT_MM_Var*  *master );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Set_MM_Blend( T1_Face    face,\r\n                   FT_UInt    num_coords,\r\n                   FT_Fixed*  coords );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Set_MM_Design( T1_Face   face,\r\n                    FT_UInt   num_coords,\r\n                    FT_Long*  coords );\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Set_Var_Design( T1_Face    face,\r\n                     FT_UInt    num_coords,\r\n                     FT_Fixed*  coords );\r\n\r\n  FT_LOCAL( void )\r\n  T1_Done_Blend( T1_Face  face );\r\n\r\n#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1LOAD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1objs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1objs.c                                                               */\r\n/*                                                                         */\r\n/*    Type 1 objects manager (body).                                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2009, 2011 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_CALC_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n#include \"t1gload.h\"\r\n#include \"t1load.h\"\r\n\r\n#include \"t1errors.h\"\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n#include \"t1afm.h\"\r\n#endif\r\n\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1objs\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            SIZE FUNCTIONS                             */\r\n  /*                                                                       */\r\n  /*  note that we store the global hints in the size's \"internal\" root    */\r\n  /*  field                                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  static PSH_Globals_Funcs\r\n  T1_Size_Get_Globals_Funcs( T1_Size  size )\r\n  {\r\n    T1_Face           face     = (T1_Face)size->root.face;\r\n    PSHinter_Service  pshinter = (PSHinter_Service)face->pshinter;\r\n    FT_Module         module;\r\n\r\n\r\n    module = FT_Get_Module( size->root.face->driver->root.library,\r\n                            \"pshinter\" );\r\n    return ( module && pshinter && pshinter->get_globals_funcs )\r\n           ? pshinter->get_globals_funcs( module )\r\n           : 0 ;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T1_Size_Done( FT_Size  t1size )          /* T1_Size */\r\n  {\r\n    T1_Size  size = (T1_Size)t1size;\r\n\r\n\r\n    if ( size->root.internal )\r\n    {\r\n      PSH_Globals_Funcs  funcs;\r\n\r\n\r\n      funcs = T1_Size_Get_Globals_Funcs( size );\r\n      if ( funcs )\r\n        funcs->destroy( (PSH_Globals)size->root.internal );\r\n\r\n      size->root.internal = 0;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Size_Init( FT_Size  t1size )      /* T1_Size */\r\n  {\r\n    T1_Size            size  = (T1_Size)t1size;\r\n    FT_Error           error = T1_Err_Ok;\r\n    PSH_Globals_Funcs  funcs = T1_Size_Get_Globals_Funcs( size );\r\n\r\n\r\n    if ( funcs )\r\n    {\r\n      PSH_Globals  globals;\r\n      T1_Face      face = (T1_Face)size->root.face;\r\n\r\n\r\n      error = funcs->create( size->root.face->memory,\r\n                             &face->type1.private_dict, &globals );\r\n      if ( !error )\r\n        size->root.internal = (FT_Size_Internal)(void*)globals;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Size_Request( FT_Size          t1size,     /* T1_Size */\r\n                   FT_Size_Request  req )\r\n  {\r\n    T1_Size            size  = (T1_Size)t1size;\r\n    PSH_Globals_Funcs  funcs = T1_Size_Get_Globals_Funcs( size );\r\n\r\n\r\n    FT_Request_Metrics( size->root.face, req );\r\n\r\n    if ( funcs )\r\n      funcs->set_scale( (PSH_Globals)size->root.internal,\r\n                        size->root.metrics.x_scale,\r\n                        size->root.metrics.y_scale,\r\n                        0, 0 );\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            SLOT  FUNCTIONS                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T1_GlyphSlot_Done( FT_GlyphSlot  slot )\r\n  {\r\n    slot->internal->glyph_hints = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_GlyphSlot_Init( FT_GlyphSlot  slot )\r\n  {\r\n    T1_Face           face;\r\n    PSHinter_Service  pshinter;\r\n\r\n\r\n    face     = (T1_Face)slot->face;\r\n    pshinter = (PSHinter_Service)face->pshinter;\r\n\r\n    if ( pshinter )\r\n    {\r\n      FT_Module  module;\r\n\r\n\r\n      module = FT_Get_Module( slot->face->driver->root.library,\r\n                              \"pshinter\" );\r\n      if ( module )\r\n      {\r\n        T1_Hints_Funcs  funcs;\r\n\r\n\r\n        funcs = pshinter->get_t1_funcs( module );\r\n        slot->internal->glyph_hints = (void*)funcs;\r\n      }\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                            FACE  FUNCTIONS                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    T1_Face_Done                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The face object destructor.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A typeless pointer to the face object to destroy.          */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  T1_Face_Done( FT_Face  t1face )         /* T1_Face */\r\n  {\r\n    T1_Face    face = (T1_Face)t1face;\r\n    FT_Memory  memory;\r\n    T1_Font    type1;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = face->root.memory;\r\n    type1  = &face->type1;\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n    /* release multiple masters information */\r\n    FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );\r\n\r\n    if ( face->buildchar )\r\n    {\r\n      FT_FREE( face->buildchar );\r\n\r\n      face->buildchar     = NULL;\r\n      face->len_buildchar = 0;\r\n    }\r\n\r\n    T1_Done_Blend( face );\r\n    face->blend = 0;\r\n#endif\r\n\r\n    /* release font info strings */\r\n    {\r\n      PS_FontInfo  info = &type1->font_info;\r\n\r\n\r\n      FT_FREE( info->version );\r\n      FT_FREE( info->notice );\r\n      FT_FREE( info->full_name );\r\n      FT_FREE( info->family_name );\r\n      FT_FREE( info->weight );\r\n    }\r\n\r\n    /* release top dictionary */\r\n    FT_FREE( type1->charstrings_len );\r\n    FT_FREE( type1->charstrings );\r\n    FT_FREE( type1->glyph_names );\r\n\r\n    FT_FREE( type1->subrs );\r\n    FT_FREE( type1->subrs_len );\r\n\r\n    FT_FREE( type1->subrs_block );\r\n    FT_FREE( type1->charstrings_block );\r\n    FT_FREE( type1->glyph_names_block );\r\n\r\n    FT_FREE( type1->encoding.char_index );\r\n    FT_FREE( type1->encoding.char_name );\r\n    FT_FREE( type1->font_name );\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n    /* release afm data if present */\r\n    if ( face->afm_data )\r\n      T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );\r\n#endif\r\n\r\n    /* release unicode map, if any */\r\n#if 0\r\n    FT_FREE( face->unicode_map_rec.maps );\r\n    face->unicode_map_rec.num_maps = 0;\r\n    face->unicode_map              = NULL;\r\n#endif\r\n\r\n    face->root.family_name = NULL;\r\n    face->root.style_name  = NULL;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    T1_Face_Init                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The face object constructor.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     ::  input stream where to load font data.               */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the font face in the resource.          */\r\n  /*                                                                       */\r\n  /*    num_params :: Number of additional generic parameters.  Ignored.   */\r\n  /*                                                                       */\r\n  /*    params     :: Additional generic parameters.  Ignored.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The face record to build.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Face_Init( FT_Stream      stream,\r\n                FT_Face        t1face,          /* T1_Face */\r\n                FT_Int         face_index,\r\n                FT_Int         num_params,\r\n                FT_Parameter*  params )\r\n  {\r\n    T1_Face             face = (T1_Face)t1face;\r\n    FT_Error            error;\r\n    FT_Service_PsCMaps  psnames;\r\n    PSAux_Service       psaux;\r\n    T1_Font             type1 = &face->type1;\r\n    PS_FontInfo         info = &type1->font_info;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    face->root.num_faces = 1;\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );\r\n    face->psnames = psnames;\r\n\r\n    face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),\r\n                                           \"psaux\" );\r\n    psaux = (PSAux_Service)face->psaux;\r\n    if ( !psaux )\r\n    {\r\n      FT_ERROR(( \"T1_Face_Init: cannot access `psaux' module\\n\" ));\r\n      error = T1_Err_Missing_Module;\r\n      goto Exit;\r\n    }\r\n\r\n    face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),\r\n                                              \"pshinter\" );\r\n\r\n    FT_TRACE2(( \"Type 1 driver\\n\" ));\r\n\r\n    /* open the tokenizer; this will also check the font format */\r\n    error = T1_Open_Face( face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* if we just wanted to check the format, leave successfully now */\r\n    if ( face_index < 0 )\r\n      goto Exit;\r\n\r\n    /* check the face index */\r\n    if ( face_index > 0 )\r\n    {\r\n      FT_ERROR(( \"T1_Face_Init: invalid face index\\n\" ));\r\n      error = T1_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now load the font program into the face object */\r\n\r\n    /* initialize the face object fields */\r\n\r\n    /* set up root face fields */\r\n    {\r\n      FT_Face  root = (FT_Face)&face->root;\r\n\r\n\r\n      root->num_glyphs = type1->num_glyphs;\r\n      root->face_index = 0;\r\n\r\n      root->face_flags = FT_FACE_FLAG_SCALABLE    |\r\n                         FT_FACE_FLAG_HORIZONTAL  |\r\n                         FT_FACE_FLAG_GLYPH_NAMES |\r\n                         FT_FACE_FLAG_HINTER;\r\n\r\n      if ( info->is_fixed_pitch )\r\n        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      if ( face->blend )\r\n        root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;\r\n\r\n      /* XXX: TODO -- add kerning with .afm support */\r\n\r\n\r\n      /* The following code to extract the family and the style is very   */\r\n      /* simplistic and might get some things wrong.  For a full-featured */\r\n      /* algorithm you might have a look at the whitepaper given at       */\r\n      /*                                                                  */\r\n      /*   http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */\r\n\r\n      /* get style name -- be careful, some broken fonts only */\r\n      /* have a `/FontName' dictionary entry!                 */\r\n      root->family_name = info->family_name;\r\n      root->style_name  = NULL;\r\n\r\n      if ( root->family_name )\r\n      {\r\n        char*  full   = info->full_name;\r\n        char*  family = root->family_name;\r\n\r\n\r\n        if ( full )\r\n        {\r\n          FT_Bool  the_same = TRUE;\r\n\r\n\r\n          while ( *full )\r\n          {\r\n            if ( *full == *family )\r\n            {\r\n              family++;\r\n              full++;\r\n            }\r\n            else\r\n            {\r\n              if ( *full == ' ' || *full == '-' )\r\n                full++;\r\n              else if ( *family == ' ' || *family == '-' )\r\n                family++;\r\n              else\r\n              {\r\n                the_same = FALSE;\r\n\r\n                if ( !*family )\r\n                  root->style_name = full;\r\n                break;\r\n              }\r\n            }\r\n          }\r\n\r\n          if ( the_same )\r\n            root->style_name = (char *)\"Regular\";\r\n        }\r\n      }\r\n      else\r\n      {\r\n        /* do we have a `/FontName'? */\r\n        if ( type1->font_name )\r\n          root->family_name = type1->font_name;\r\n      }\r\n\r\n      if ( !root->style_name )\r\n      {\r\n        if ( info->weight )\r\n          root->style_name = info->weight;\r\n        else\r\n          /* assume `Regular' style because we don't know better */\r\n          root->style_name = (char *)\"Regular\";\r\n      }\r\n\r\n      /* compute style flags */\r\n      root->style_flags = 0;\r\n      if ( info->italic_angle )\r\n        root->style_flags |= FT_STYLE_FLAG_ITALIC;\r\n      if ( info->weight )\r\n      {\r\n        if ( !ft_strcmp( info->weight, \"Bold\"  ) ||\r\n             !ft_strcmp( info->weight, \"Black\" ) )\r\n          root->style_flags |= FT_STYLE_FLAG_BOLD;\r\n      }\r\n\r\n      /* no embedded bitmap support */\r\n      root->num_fixed_sizes = 0;\r\n      root->available_sizes = 0;\r\n\r\n      root->bbox.xMin =   type1->font_bbox.xMin            >> 16;\r\n      root->bbox.yMin =   type1->font_bbox.yMin            >> 16;\r\n      /* no `U' suffix here to 0xFFFF! */\r\n      root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16;\r\n      root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16;\r\n\r\n      /* Set units_per_EM if we didn't set it in t1_parse_font_matrix. */\r\n      if ( !root->units_per_EM )\r\n        root->units_per_EM = 1000;\r\n\r\n      root->ascender  = (FT_Short)( root->bbox.yMax );\r\n      root->descender = (FT_Short)( root->bbox.yMin );\r\n\r\n      root->height = (FT_Short)( ( root->units_per_EM * 12 ) / 10 );\r\n      if ( root->height < root->ascender - root->descender )\r\n        root->height = (FT_Short)( root->ascender - root->descender );\r\n\r\n      /* now compute the maximum advance width */\r\n      root->max_advance_width =\r\n        (FT_Short)( root->bbox.xMax );\r\n      {\r\n        FT_Pos  max_advance;\r\n\r\n\r\n        error = T1_Compute_Max_Advance( face, &max_advance );\r\n\r\n        /* in case of error, keep the standard width */\r\n        if ( !error )\r\n          root->max_advance_width = (FT_Short)FIXED_TO_INT( max_advance );\r\n        else\r\n          error = T1_Err_Ok;   /* clear error */\r\n      }\r\n\r\n      root->max_advance_height = root->height;\r\n\r\n      root->underline_position  = (FT_Short)info->underline_position;\r\n      root->underline_thickness = (FT_Short)info->underline_thickness;\r\n    }\r\n\r\n    {\r\n      FT_Face  root = &face->root;\r\n\r\n\r\n      if ( psnames )\r\n      {\r\n        FT_CharMapRec    charmap;\r\n        T1_CMap_Classes  cmap_classes = psaux->t1_cmap_classes;\r\n        FT_CMap_Class    clazz;\r\n\r\n\r\n        charmap.face = root;\r\n\r\n        /* first of all, try to synthesize a Unicode charmap */\r\n        charmap.platform_id = TT_PLATFORM_MICROSOFT;\r\n        charmap.encoding_id = TT_MS_ID_UNICODE_CS;\r\n        charmap.encoding    = FT_ENCODING_UNICODE;\r\n\r\n        error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );\r\n        if ( error && FT_Err_No_Unicode_Glyph_Name != error )\r\n          goto Exit;\r\n        error = FT_Err_Ok;\r\n\r\n        /* now, generate an Adobe Standard encoding when appropriate */\r\n        charmap.platform_id = TT_PLATFORM_ADOBE;\r\n        clazz               = NULL;\r\n\r\n        switch ( type1->encoding_type )\r\n        {\r\n        case T1_ENCODING_TYPE_STANDARD:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_STANDARD;\r\n          charmap.encoding_id = TT_ADOBE_ID_STANDARD;\r\n          clazz               = cmap_classes->standard;\r\n          break;\r\n\r\n        case T1_ENCODING_TYPE_EXPERT:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_EXPERT;\r\n          charmap.encoding_id = TT_ADOBE_ID_EXPERT;\r\n          clazz               = cmap_classes->expert;\r\n          break;\r\n\r\n        case T1_ENCODING_TYPE_ARRAY:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_CUSTOM;\r\n          charmap.encoding_id = TT_ADOBE_ID_CUSTOM;\r\n          clazz               = cmap_classes->custom;\r\n          break;\r\n\r\n        case T1_ENCODING_TYPE_ISOLATIN1:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_LATIN_1;\r\n          charmap.encoding_id = TT_ADOBE_ID_LATIN_1;\r\n          clazz               = cmap_classes->unicode;\r\n          break;\r\n\r\n        default:\r\n          ;\r\n        }\r\n\r\n        if ( clazz )\r\n          error = FT_CMap_New( clazz, NULL, &charmap, NULL );\r\n\r\n#if 0\r\n        /* Select default charmap */\r\n        if (root->num_charmaps)\r\n          root->charmap = root->charmaps[0];\r\n#endif\r\n      }\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    T1_Driver_Init                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given Type 1 driver object.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target driver object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Driver_Init( FT_Module  driver )\r\n  {\r\n    FT_UNUSED( driver );\r\n\r\n    return T1_Err_Ok;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    T1_Driver_Done                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finalizes a given Type 1 driver.                                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target Type 1 driver.                    */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( void )\r\n  T1_Driver_Done( FT_Module  driver )\r\n  {\r\n    FT_UNUSED( driver );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1objs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1objs.h                                                               */\r\n/*                                                                         */\r\n/*    Type 1 objects manager (specification).                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2006, 2011 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1OBJS_H__\r\n#define __T1OBJS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* The following structures must be defined by the hinter */\r\n  typedef struct T1_Size_Hints_   T1_Size_Hints;\r\n  typedef struct T1_Glyph_Hints_  T1_Glyph_Hints;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    T1_Size                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 size object.                                  */\r\n  /*                                                                       */\r\n  typedef struct T1_SizeRec_*  T1_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    T1_GlyphSlot                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 glyph slot object.                            */\r\n  /*                                                                       */\r\n  typedef struct T1_GlyphSlotRec_*  T1_GlyphSlot;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    T1_CharMap                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a Type 1 character mapping object.                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The Type 1 format doesn't use a charmap but an encoding table.     */\r\n  /*    The driver is responsible for making up charmap objects            */\r\n  /*    corresponding to these tables.                                     */\r\n  /*                                                                       */\r\n  typedef struct T1_CharMapRec_*   T1_CharMap;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                  HERE BEGINS THE TYPE1 SPECIFIC STUFF                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    T1_SizeRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Type 1 size record.                                                */\r\n  /*                                                                       */\r\n  typedef struct  T1_SizeRec_\r\n  {\r\n    FT_SizeRec  root;\r\n\r\n  } T1_SizeRec;\r\n\r\n\r\n  FT_LOCAL( void )\r\n  T1_Size_Done( FT_Size  size );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Size_Request( FT_Size          size,\r\n                   FT_Size_Request  req );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Size_Init( FT_Size  size );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    T1_GlyphSlotRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Type 1 glyph slot record.                                          */\r\n  /*                                                                       */\r\n  typedef struct  T1_GlyphSlotRec_\r\n  {\r\n    FT_GlyphSlotRec  root;\r\n\r\n    FT_Bool          hint;\r\n    FT_Bool          scaled;\r\n\r\n    FT_Int           max_points;\r\n    FT_Int           max_contours;\r\n\r\n    FT_Fixed         x_scale;\r\n    FT_Fixed         y_scale;\r\n\r\n  } T1_GlyphSlotRec;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Face_Init( FT_Stream      stream,\r\n                FT_Face        face,\r\n                FT_Int         face_index,\r\n                FT_Int         num_params,\r\n                FT_Parameter*  params );\r\n\r\n  FT_LOCAL( void )\r\n  T1_Face_Done( FT_Face  face );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_GlyphSlot_Init( FT_GlyphSlot  slot );\r\n\r\n  FT_LOCAL( void )\r\n  T1_GlyphSlot_Done( FT_GlyphSlot  slot );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Driver_Init( FT_Module  driver );\r\n\r\n  FT_LOCAL( void )\r\n  T1_Driver_Done( FT_Module  driver );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1OBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1parse.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1parse.c                                                              */\r\n/*                                                                         */\r\n/*    Type 1 parser (body).                                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2005, 2008, 2009, 2012 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The Type 1 parser is in charge of the following:                      */\r\n  /*                                                                       */\r\n  /*  - provide an implementation of a growing sequence of objects called  */\r\n  /*    a `T1_Table' (used to build various tables needed by the loader).  */\r\n  /*                                                                       */\r\n  /*  - opening .pfb and .pfa files to extract their top-level and private */\r\n  /*    dictionaries.                                                      */\r\n  /*                                                                       */\r\n  /*  - read numbers, arrays & strings from any dictionary.                */\r\n  /*                                                                       */\r\n  /* See `t1load.c' to see how data is loaded from the font file.          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n#include \"t1parse.h\"\r\n\r\n#include \"t1errors.h\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t1parse\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                   INPUT STREAM PARSER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* see Adobe Technical Note 5040.Download_Fonts.pdf */\r\n\r\n  static FT_Error\r\n  read_pfb_tag( FT_Stream   stream,\r\n                FT_UShort  *atag,\r\n                FT_ULong   *asize )\r\n  {\r\n    FT_Error   error;\r\n    FT_UShort  tag;\r\n    FT_ULong   size;\r\n\r\n\r\n    *atag  = 0;\r\n    *asize = 0;\r\n\r\n    if ( !FT_READ_USHORT( tag ) )\r\n    {\r\n      if ( tag == 0x8001U || tag == 0x8002U )\r\n      {\r\n        if ( !FT_READ_ULONG_LE( size ) )\r\n          *asize = size;\r\n      }\r\n\r\n      *atag = tag;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  check_type1_format( FT_Stream    stream,\r\n                      const char*  header_string,\r\n                      size_t       header_length )\r\n  {\r\n    FT_Error   error;\r\n    FT_UShort  tag;\r\n    FT_ULong   dummy;\r\n\r\n\r\n    if ( FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    error = read_pfb_tag( stream, &tag, &dummy );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* We assume that the first segment in a PFB is always encoded as   */\r\n    /* text.  This might be wrong (and the specification doesn't insist */\r\n    /* on that), but we have never seen a counterexample.               */\r\n    if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    if ( !FT_FRAME_ENTER( header_length ) )\r\n    {\r\n      error = T1_Err_Ok;\r\n\r\n      if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 )\r\n        error = T1_Err_Unknown_File_Format;\r\n\r\n      FT_FRAME_EXIT();\r\n    }\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_New_Parser( T1_Parser      parser,\r\n                 FT_Stream      stream,\r\n                 FT_Memory      memory,\r\n                 PSAux_Service  psaux )\r\n  {\r\n    FT_Error   error;\r\n    FT_UShort  tag;\r\n    FT_ULong   size;\r\n\r\n\r\n    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );\r\n\r\n    parser->stream       = stream;\r\n    parser->base_len     = 0;\r\n    parser->base_dict    = 0;\r\n    parser->private_len  = 0;\r\n    parser->private_dict = 0;\r\n    parser->in_pfb       = 0;\r\n    parser->in_memory    = 0;\r\n    parser->single_block = 0;\r\n\r\n    /* check the header format */\r\n    error = check_type1_format( stream, \"%!PS-AdobeFont\", 14 );\r\n    if ( error )\r\n    {\r\n      if ( error != T1_Err_Unknown_File_Format )\r\n        goto Exit;\r\n\r\n      error = check_type1_format( stream, \"%!FontType\", 10 );\r\n      if ( error )\r\n      {\r\n        FT_TRACE2(( \"  not a Type 1 font\\n\" ));\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n    /******************************************************************/\r\n    /*                                                                */\r\n    /* Here a short summary of what is going on:                      */\r\n    /*                                                                */\r\n    /*   When creating a new Type 1 parser, we try to locate and load */\r\n    /*   the base dictionary if this is possible (i.e., for PFB       */\r\n    /*   files).  Otherwise, we load the whole font into memory.      */\r\n    /*                                                                */\r\n    /*   When `loading' the base dictionary, we only setup pointers   */\r\n    /*   in the case of a memory-based stream.  Otherwise, we         */\r\n    /*   allocate and load the base dictionary in it.                 */\r\n    /*                                                                */\r\n    /*   parser->in_pfb is set if we are in a binary (`.pfb') font.   */\r\n    /*   parser->in_memory is set if we have a memory stream.         */\r\n    /*                                                                */\r\n\r\n    /* try to compute the size of the base dictionary;     */\r\n    /* look for a Postscript binary file tag, i.e., 0x8001 */\r\n    if ( FT_STREAM_SEEK( 0L ) )\r\n      goto Exit;\r\n\r\n    error = read_pfb_tag( stream, &tag, &size );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( tag != 0x8001U )\r\n    {\r\n      /* assume that this is a PFA file for now; an error will */\r\n      /* be produced later when more things are checked        */\r\n      if ( FT_STREAM_SEEK( 0L ) )\r\n        goto Exit;\r\n      size = stream->size;\r\n    }\r\n    else\r\n      parser->in_pfb = 1;\r\n\r\n    /* now, try to load `size' bytes of the `base' dictionary we */\r\n    /* found previously                                          */\r\n\r\n    /* if it is a memory-based resource, set up pointers */\r\n    if ( !stream->read )\r\n    {\r\n      parser->base_dict = (FT_Byte*)stream->base + stream->pos;\r\n      parser->base_len  = size;\r\n      parser->in_memory = 1;\r\n\r\n      /* check that the `size' field is valid */\r\n      if ( FT_STREAM_SKIP( size ) )\r\n        goto Exit;\r\n    }\r\n    else\r\n    {\r\n      /* read segment in memory -- this is clumsy, but so does the format */\r\n      if ( FT_ALLOC( parser->base_dict, size )       ||\r\n           FT_STREAM_READ( parser->base_dict, size ) )\r\n        goto Exit;\r\n      parser->base_len = size;\r\n    }\r\n\r\n    parser->root.base   = parser->base_dict;\r\n    parser->root.cursor = parser->base_dict;\r\n    parser->root.limit  = parser->root.cursor + parser->base_len;\r\n\r\n  Exit:\r\n    if ( error && !parser->in_memory )\r\n      FT_FREE( parser->base_dict );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T1_Finalize_Parser( T1_Parser  parser )\r\n  {\r\n    FT_Memory  memory = parser->root.memory;\r\n\r\n\r\n    /* always free the private dictionary */\r\n    FT_FREE( parser->private_dict );\r\n\r\n    /* free the base dictionary only when we have a disk stream */\r\n    if ( !parser->in_memory )\r\n      FT_FREE( parser->base_dict );\r\n\r\n    parser->root.funcs.done( &parser->root );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T1_Get_Private_Dict( T1_Parser      parser,\r\n                       PSAux_Service  psaux )\r\n  {\r\n    FT_Stream  stream = parser->stream;\r\n    FT_Memory  memory = parser->root.memory;\r\n    FT_Error   error  = T1_Err_Ok;\r\n    FT_ULong   size;\r\n\r\n\r\n    if ( parser->in_pfb )\r\n    {\r\n      /* in the case of the PFB format, the private dictionary can be  */\r\n      /* made of several segments.  We thus first read the number of   */\r\n      /* segments to compute the total size of the private dictionary  */\r\n      /* then re-read them into memory.                                */\r\n      FT_Long    start_pos = FT_STREAM_POS();\r\n      FT_UShort  tag;\r\n\r\n\r\n      parser->private_len = 0;\r\n      for (;;)\r\n      {\r\n        error = read_pfb_tag( stream, &tag, &size );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        if ( tag != 0x8002U )\r\n          break;\r\n\r\n        parser->private_len += size;\r\n\r\n        if ( FT_STREAM_SKIP( size ) )\r\n          goto Fail;\r\n      }\r\n\r\n      /* Check that we have a private dictionary there */\r\n      /* and allocate private dictionary buffer        */\r\n      if ( parser->private_len == 0 )\r\n      {\r\n        FT_ERROR(( \"T1_Get_Private_Dict:\"\r\n                   \" invalid private dictionary section\\n\" ));\r\n        error = T1_Err_Invalid_File_Format;\r\n        goto Fail;\r\n      }\r\n\r\n      if ( FT_STREAM_SEEK( start_pos )                           ||\r\n           FT_ALLOC( parser->private_dict, parser->private_len ) )\r\n        goto Fail;\r\n\r\n      parser->private_len = 0;\r\n      for (;;)\r\n      {\r\n        error = read_pfb_tag( stream, &tag, &size );\r\n        if ( error || tag != 0x8002U )\r\n        {\r\n          error = T1_Err_Ok;\r\n          break;\r\n        }\r\n\r\n        if ( FT_STREAM_READ( parser->private_dict + parser->private_len,\r\n                             size ) )\r\n          goto Fail;\r\n\r\n        parser->private_len += size;\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* We have already `loaded' the whole PFA font file into memory; */\r\n      /* if this is a memory resource, allocate a new block to hold    */\r\n      /* the private dict.  Otherwise, simply overwrite into the base  */\r\n      /* dictionary block in the heap.                                 */\r\n\r\n      /* first of all, look at the `eexec' keyword */\r\n      FT_Byte*  cur   = parser->base_dict;\r\n      FT_Byte*  limit = cur + parser->base_len;\r\n      FT_Byte   c;\r\n\r\n\r\n    Again:\r\n      for (;;)\r\n      {\r\n        c = cur[0];\r\n        if ( c == 'e' && cur + 9 < limit )  /* 9 = 5 letters for `eexec' + */\r\n                                            /* whitespace + 4 chars        */\r\n        {\r\n          if ( cur[1] == 'e' &&\r\n               cur[2] == 'x' &&\r\n               cur[3] == 'e' &&\r\n               cur[4] == 'c' )\r\n            break;\r\n        }\r\n        cur++;\r\n        if ( cur >= limit )\r\n        {\r\n          FT_ERROR(( \"T1_Get_Private_Dict:\"\r\n                     \" could not find `eexec' keyword\\n\" ));\r\n          error = T1_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n      }\r\n\r\n      /* check whether `eexec' was real -- it could be in a comment */\r\n      /* or string (as e.g. in u003043t.gsf from ghostscript)       */\r\n\r\n      parser->root.cursor = parser->base_dict;\r\n      /* set limit to `eexec' + whitespace + 4 characters */\r\n      parser->root.limit  = cur + 10;\r\n\r\n      cur   = parser->root.cursor;\r\n      limit = parser->root.limit;\r\n\r\n      while ( cur < limit )\r\n      {\r\n        if ( *cur == 'e' && ft_strncmp( (char*)cur, \"eexec\", 5 ) == 0 )\r\n          goto Found;\r\n\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          break;\r\n        T1_Skip_Spaces  ( parser );\r\n        cur = parser->root.cursor;\r\n      }\r\n\r\n      /* we haven't found the correct `eexec'; go back and continue */\r\n      /* searching                                                  */\r\n\r\n      cur   = limit;\r\n      limit = parser->base_dict + parser->base_len;\r\n      goto Again;\r\n\r\n      /* now determine where to write the _encrypted_ binary private  */\r\n      /* dictionary.  We overwrite the base dictionary for disk-based */\r\n      /* resources and allocate a new block otherwise                 */\r\n\r\n    Found:\r\n      parser->root.limit = parser->base_dict + parser->base_len;\r\n\r\n      T1_Skip_PS_Token( parser );\r\n      cur   = parser->root.cursor;\r\n      limit = parser->root.limit;\r\n\r\n      /* according to the Type1 spec, the first cipher byte must not be  */\r\n      /* an ASCII whitespace character code (blank, tab, carriage return */\r\n      /* or line feed).  We have seen Type 1 fonts with two line feed    */\r\n      /* characters...  So skip now all whitespace character codes.      */\r\n      while ( cur < limit       &&\r\n              ( *cur == ' '  ||\r\n                *cur == '\\t' ||\r\n                *cur == '\\r' ||\r\n                *cur == '\\n' ) )\r\n        ++cur;\r\n      if ( cur >= limit )\r\n      {\r\n        FT_ERROR(( \"T1_Get_Private_Dict:\"\r\n                   \" `eexec' not properly terminated\\n\" ));\r\n        error = T1_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      size = parser->base_len - ( cur - parser->base_dict );\r\n\r\n      if ( parser->in_memory )\r\n      {\r\n        /* note that we allocate one more byte to put a terminating `0' */\r\n        if ( FT_ALLOC( parser->private_dict, size + 1 ) )\r\n          goto Fail;\r\n        parser->private_len = size;\r\n      }\r\n      else\r\n      {\r\n        parser->single_block = 1;\r\n        parser->private_dict = parser->base_dict;\r\n        parser->private_len  = size;\r\n        parser->base_dict    = 0;\r\n        parser->base_len     = 0;\r\n      }\r\n\r\n      /* now determine whether the private dictionary is encoded in binary */\r\n      /* or hexadecimal ASCII format -- decode it accordingly              */\r\n\r\n      /* we need to access the next 4 bytes (after the final whitespace */\r\n      /* following the `eexec' keyword); if they all are hexadecimal    */\r\n      /* digits, then we have a case of ASCII storage                   */\r\n\r\n      if ( cur + 3 < limit                                &&\r\n           ft_isxdigit( cur[0] ) && ft_isxdigit( cur[1] ) &&\r\n           ft_isxdigit( cur[2] ) && ft_isxdigit( cur[3] ) )\r\n      {\r\n        /* ASCII hexadecimal encoding */\r\n        FT_Long  len;\r\n\r\n\r\n        parser->root.cursor = cur;\r\n        (void)psaux->ps_parser_funcs->to_bytes( &parser->root,\r\n                                                parser->private_dict,\r\n                                                parser->private_len,\r\n                                                &len,\r\n                                                0 );\r\n        parser->private_len = len;\r\n\r\n        /* put a safeguard */\r\n        parser->private_dict[len] = '\\0';\r\n      }\r\n      else\r\n        /* binary encoding -- copy the private dict */\r\n        FT_MEM_MOVE( parser->private_dict, cur, size );\r\n    }\r\n\r\n    /* we now decrypt the encoded binary private dictionary */\r\n    psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U );\r\n\r\n    if ( parser->private_len < 4 )\r\n    {\r\n      FT_ERROR(( \"T1_Get_Private_Dict:\"\r\n                 \" invalid private dictionary section\\n\" ));\r\n      error = T1_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    /* replace the four random bytes at the beginning with whitespace */\r\n    parser->private_dict[0] = ' ';\r\n    parser->private_dict[1] = ' ';\r\n    parser->private_dict[2] = ' ';\r\n    parser->private_dict[3] = ' ';\r\n\r\n    parser->root.base   = parser->private_dict;\r\n    parser->root.cursor = parser->private_dict;\r\n    parser->root.limit  = parser->root.cursor + parser->private_len;\r\n\r\n  Fail:\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1parse.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1parse.h                                                              */\r\n/*                                                                         */\r\n/*    Type 1 parser (specification).                                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2008 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1PARSE_H__\r\n#define __T1PARSE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include FT_INTERNAL_STREAM_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_ParserRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A PS_ParserRec is an object used to parse a Type 1 fonts very      */\r\n  /*    quickly.                                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root         :: The root parser.                                   */\r\n  /*                                                                       */\r\n  /*    stream       :: The current input stream.                          */\r\n  /*                                                                       */\r\n  /*    base_dict    :: A pointer to the top-level dictionary.             */\r\n  /*                                                                       */\r\n  /*    base_len     :: The length in bytes of the top dictionary.         */\r\n  /*                                                                       */\r\n  /*    private_dict :: A pointer to the private dictionary.               */\r\n  /*                                                                       */\r\n  /*    private_len  :: The length in bytes of the private dictionary.     */\r\n  /*                                                                       */\r\n  /*    in_pfb       :: A boolean.  Indicates that we are handling a PFB   */\r\n  /*                    file.                                              */\r\n  /*                                                                       */\r\n  /*    in_memory    :: A boolean.  Indicates a memory-based stream.       */\r\n  /*                                                                       */\r\n  /*    single_block :: A boolean.  Indicates that the private dictionary  */\r\n  /*                    is stored in lieu of the base dictionary.          */\r\n  /*                                                                       */\r\n  typedef struct  T1_ParserRec_\r\n  {\r\n    PS_ParserRec  root;\r\n    FT_Stream     stream;\r\n\r\n    FT_Byte*      base_dict;\r\n    FT_ULong      base_len;\r\n\r\n    FT_Byte*      private_dict;\r\n    FT_ULong      private_len;\r\n\r\n    FT_Bool       in_pfb;\r\n    FT_Bool       in_memory;\r\n    FT_Bool       single_block;\r\n\r\n  } T1_ParserRec, *T1_Parser;\r\n\r\n\r\n#define T1_Add_Table( p, i, o, l )  (p)->funcs.add( (p), i, o, l )\r\n#define T1_Done_Table( p )          \\\r\n          do                        \\\r\n          {                         \\\r\n            if ( (p)->funcs.done )  \\\r\n              (p)->funcs.done( p ); \\\r\n          } while ( 0 )\r\n#define T1_Release_Table( p )          \\\r\n          do                           \\\r\n          {                            \\\r\n            if ( (p)->funcs.release )  \\\r\n              (p)->funcs.release( p ); \\\r\n          } while ( 0 )\r\n\r\n\r\n#define T1_Skip_Spaces( p )    (p)->root.funcs.skip_spaces( &(p)->root )\r\n#define T1_Skip_PS_Token( p )  (p)->root.funcs.skip_PS_token( &(p)->root )\r\n\r\n#define T1_ToInt( p )       (p)->root.funcs.to_int( &(p)->root )\r\n#define T1_ToFixed( p, t )  (p)->root.funcs.to_fixed( &(p)->root, t )\r\n\r\n#define T1_ToCoordArray( p, m, c )                           \\\r\n          (p)->root.funcs.to_coord_array( &(p)->root, m, c )\r\n#define T1_ToFixedArray( p, m, f, t )                           \\\r\n          (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )\r\n#define T1_ToToken( p, t )                          \\\r\n          (p)->root.funcs.to_token( &(p)->root, t )\r\n#define T1_ToTokenArray( p, t, m, c )                           \\\r\n          (p)->root.funcs.to_token_array( &(p)->root, t, m, c )\r\n\r\n#define T1_Load_Field( p, f, o, m, pf )                         \\\r\n          (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )\r\n\r\n#define T1_Load_Field_Table( p, f, o, m, pf )                         \\\r\n          (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_New_Parser( T1_Parser      parser,\r\n                 FT_Stream      stream,\r\n                 FT_Memory      memory,\r\n                 PSAux_Service  psaux );\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T1_Get_Private_Dict( T1_Parser      parser,\r\n                       PSAux_Service  psaux );\r\n\r\n  FT_LOCAL( void )\r\n  T1_Finalize_Parser( T1_Parser  parser );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1PARSE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/t1tokens.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1tokens.h                                                             */\r\n/*                                                                         */\r\n/*    Type 1 tokenizer (specification).                                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_FontInfoRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_INFO\r\n\r\n  T1_FIELD_STRING( \"version\",            version,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_STRING( \"Notice\",             notice,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_STRING( \"FullName\",           full_name,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_STRING( \"FamilyName\",         family_name,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_STRING( \"Weight\",             weight,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n\r\n  /* we use pointers to detect modifications made by synthetic fonts */\r\n  T1_FIELD_NUM   ( \"ItalicAngle\",        italic_angle,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_BOOL  ( \"isFixedPitch\",       is_fixed_pitch,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_NUM   ( \"UnderlinePosition\",  underline_position,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_NUM   ( \"UnderlineThickness\", underline_thickness,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_FontExtraRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_EXTRA\r\n\r\n  T1_FIELD_NUM   ( \"FSType\", fs_type,\r\n                   T1_FIELD_DICT_FONTDICT )\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_PrivateRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_PRIVATE\r\n\r\n  T1_FIELD_NUM       ( \"UniqueID\",         unique_id,\r\n                       T1_FIELD_DICT_FONTDICT | T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM       ( \"lenIV\",            lenIV,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM       ( \"LanguageGroup\",    language_group,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM       ( \"password\",         password,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n\r\n  T1_FIELD_FIXED_1000( \"BlueScale\",        blue_scale,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM       ( \"BlueShift\",        blue_shift,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM       ( \"BlueFuzz\",         blue_fuzz,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n\r\n  T1_FIELD_NUM_TABLE ( \"BlueValues\",       blue_values,        14,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM_TABLE ( \"OtherBlues\",       other_blues,        10,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM_TABLE ( \"FamilyBlues\",      family_blues,       14,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM_TABLE ( \"FamilyOtherBlues\", family_other_blues, 10,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n\r\n  T1_FIELD_NUM_TABLE2( \"StdHW\",            standard_width,      1,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM_TABLE2( \"StdVW\",            standard_height,     1,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM_TABLE2( \"MinFeature\",       min_feature,         2,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n\r\n  T1_FIELD_NUM_TABLE ( \"StemSnapH\",        snap_widths,        12,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM_TABLE ( \"StemSnapV\",        snap_heights,       12,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n\r\n  T1_FIELD_FIXED     ( \"ExpansionFactor\",  expansion_factor,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_BOOL      ( \"ForceBold\",        force_bold,\r\n                       T1_FIELD_DICT_PRIVATE )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  T1_FontRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_DICT\r\n\r\n  T1_FIELD_KEY  ( \"FontName\",    font_name,    T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_NUM  ( \"PaintType\",   paint_type,   T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_NUM  ( \"FontType\",    font_type,    T1_FIELD_DICT_FONTDICT )\r\n  T1_FIELD_FIXED( \"StrokeWidth\", stroke_width, T1_FIELD_DICT_FONTDICT )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  FT_BBox\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_BBOX\r\n\r\n  T1_FIELD_BBOX( \"FontBBox\", xMin, T1_FIELD_DICT_FONTDICT )\r\n\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  T1_FaceRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FACE\r\n\r\n  T1_FIELD_NUM( \"NDV\", ndv_idx, T1_FIELD_DICT_PRIVATE )\r\n  T1_FIELD_NUM( \"CDV\", cdv_idx, T1_FIELD_DICT_PRIVATE )\r\n\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_BlendRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_BLEND\r\n\r\n  T1_FIELD_NUM_TABLE( \"DesignVector\", default_design_vector,\r\n                      T1_MAX_MM_DESIGNS, T1_FIELD_DICT_FONTDICT )\r\n\r\n\r\n#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type1/type1.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  type1.c                                                                */\r\n/*                                                                         */\r\n/*    FreeType Type 1 driver component (body only).                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001 by                                                 */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"t1parse.c\"\r\n#include \"t1load.c\"\r\n#include \"t1objs.c\"\r\n#include \"t1driver.c\"\r\n#include \"t1gload.c\"\r\n\r\n#ifndef T1_CONFIG_OPTION_NO_AFM\r\n#include \"t1afm.c\"\r\n#endif\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/Jamfile",
    "content": "# FreeType 2 src/type42 Jamfile\r\n#\r\n# Copyright 2002 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) type42 ;\r\n\r\n{\r\n  local  _sources ;\r\n\r\n  if $(FT2_MULTI)\r\n  {\r\n    _sources = t42objs t42parse t42drivr ;\r\n  }\r\n  else\r\n  {\r\n    _sources = type42 ;\r\n  }\r\n\r\n  Library  $(FT2_LIB) : $(_sources).c ;\r\n}\r\n\r\n# end of src/type42 Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/module.mk",
    "content": "#\r\n# FreeType 2 Type42 module definition\r\n#\r\n\r\n\r\n# Copyright 2002, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += TYPE42_DRIVER\r\n\r\ndefine TYPE42_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, t42_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)type42    $(ECHO_DRIVER_DESC)Type 42 font files with no known extension$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/rules.mk",
    "content": "#\r\n# FreeType 2 Type42 driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 2002, 2003, 2008 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# Type42 driver directory\r\n#\r\nT42_DIR := $(SRC_DIR)/type42\r\n\r\n\r\n# compilation flags for the driver\r\n#\r\nT42_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(T42_DIR))\r\n\r\n\r\n# Type42 driver source\r\n#\r\nT42_DRV_SRC := $(T42_DIR)/t42objs.c  \\\r\n               $(T42_DIR)/t42parse.c \\\r\n               $(T42_DIR)/t42drivr.c\r\n\r\n# Type42 driver headers\r\n#\r\nT42_DRV_H := $(T42_DRV_SRC:%.c=%.h) \\\r\n             $(T42_DIR)/t42error.h  \\\r\n             $(T42_DIR)/t42types.h\r\n\r\n\r\n# Type42 driver object(s)\r\n#\r\n#   T42_DRV_OBJ_M is used during `multi' builds\r\n#   T42_DRV_OBJ_S is used during `single' builds\r\n#\r\nT42_DRV_OBJ_M := $(T42_DRV_SRC:$(T42_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nT42_DRV_OBJ_S := $(OBJ_DIR)/type42.$O\r\n\r\n# Type42 driver source file for single build\r\n#\r\nT42_DRV_SRC_S := $(T42_DIR)/type42.c\r\n\r\n\r\n# Type42 driver - single object\r\n#\r\n$(T42_DRV_OBJ_S): $(T42_DRV_SRC_S) $(T42_DRV_SRC) $(FREETYPE_H) $(T42_DRV_H)\r\n\t$(T42_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(T42_DRV_SRC_S))\r\n\r\n\r\n# Type42 driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(T42_DIR)/%.c $(FREETYPE_H) $(T42_DRV_H)\r\n\t$(T42_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(T42_DRV_OBJ_S)\r\nDRV_OBJS_M += $(T42_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42drivr.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42drivr.c                                                             */\r\n/*                                                                         */\r\n/*    High-level Type 42 driver interface (body).                          */\r\n/*                                                                         */\r\n/*  Copyright 2002-2004, 2006, 2007, 2009, 2011 by Roberto Alameda.        */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This driver implements Type42 fonts as described in the               */\r\n  /* Technical Note #5012 from Adobe, with these limitations:              */\r\n  /*                                                                       */\r\n  /* 1) CID Fonts are not currently supported.                             */\r\n  /* 2) Incremental fonts making use of the GlyphDirectory keyword         */\r\n  /*    will be loaded, but the rendering will be using the TrueType       */\r\n  /*    tables.                                                            */\r\n  /* 3) As for Type1 fonts, CDevProc is not supported.                     */\r\n  /* 4) The Metrics dictionary is not supported.                           */\r\n  /* 5) AFM metrics are not supported.                                     */\r\n  /*                                                                       */\r\n  /* In other words, this driver supports Type42 fonts derived from        */\r\n  /* TrueType fonts in a non-CID manner, as done by usual conversion       */\r\n  /* programs.                                                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include \"t42drivr.h\"\r\n#include \"t42objs.h\"\r\n#include \"t42error.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n#include FT_SERVICE_GLYPH_DICT_H\r\n#include FT_SERVICE_POSTSCRIPT_NAME_H\r\n#include FT_SERVICE_POSTSCRIPT_INFO_H\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t42\r\n\r\n\r\n  /*\r\n   *\r\n   *  GLYPH DICT SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  t42_get_glyph_name( T42_Face    face,\r\n                      FT_UInt     glyph_index,\r\n                      FT_Pointer  buffer,\r\n                      FT_UInt     buffer_max )\r\n  {\r\n    FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );\r\n\r\n    return T42_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  t42_get_name_index( T42_Face    face,\r\n                      FT_String*  glyph_name )\r\n  {\r\n    FT_Int      i;\r\n    FT_String*  gname;\r\n\r\n\r\n    for ( i = 0; i < face->type1.num_glyphs; i++ )\r\n    {\r\n      gname = face->type1.glyph_names[i];\r\n\r\n      if ( glyph_name[0] == gname[0] && !ft_strcmp( glyph_name, gname ) )\r\n        return (FT_UInt)ft_atol( (const char *)face->type1.charstrings[i] );\r\n    }\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static const FT_Service_GlyphDictRec  t42_service_glyph_dict =\r\n  {\r\n    (FT_GlyphDict_GetNameFunc)  t42_get_glyph_name,\r\n    (FT_GlyphDict_NameIndexFunc)t42_get_name_index\r\n  };\r\n\r\n\r\n  /*\r\n   *\r\n   *  POSTSCRIPT NAME SERVICE\r\n   *\r\n   */\r\n\r\n  static const char*\r\n  t42_get_ps_font_name( T42_Face  face )\r\n  {\r\n    return (const char*)face->type1.font_name;\r\n  }\r\n\r\n\r\n  static const FT_Service_PsFontNameRec  t42_service_ps_font_name =\r\n  {\r\n    (FT_PsName_GetFunc)t42_get_ps_font_name\r\n  };\r\n\r\n\r\n  /*\r\n   *\r\n   *  POSTSCRIPT INFO SERVICE\r\n   *\r\n   */\r\n\r\n  static FT_Error\r\n  t42_ps_get_font_info( FT_Face          face,\r\n                        PS_FontInfoRec*  afont_info )\r\n  {\r\n    *afont_info = ((T42_Face)face)->type1.font_info;\r\n\r\n    return T42_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  t42_ps_get_font_extra( FT_Face           face,\r\n                         PS_FontExtraRec*  afont_extra )\r\n  {\r\n    *afont_extra = ((T42_Face)face)->type1.font_extra;\r\n\r\n    return T42_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Int\r\n  t42_ps_has_glyph_names( FT_Face  face )\r\n  {\r\n    FT_UNUSED( face );\r\n\r\n    return 1;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  t42_ps_get_font_private( FT_Face         face,\r\n                           PS_PrivateRec*  afont_private )\r\n  {\r\n    *afont_private = ((T42_Face)face)->type1.private_dict;\r\n\r\n    return T42_Err_Ok;\r\n  }\r\n\r\n\r\n  static const FT_Service_PsInfoRec  t42_service_ps_info =\r\n  {\r\n    (PS_GetFontInfoFunc)   t42_ps_get_font_info,\r\n    (PS_GetFontExtraFunc)  t42_ps_get_font_extra,\r\n    (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,\r\n    (PS_GetFontPrivateFunc)t42_ps_get_font_private,\r\n    (PS_GetFontValueFunc)  NULL             /* not implemented */\r\n  };\r\n\r\n\r\n  /*\r\n   *\r\n   *  SERVICE LIST\r\n   *\r\n   */\r\n\r\n  static const FT_ServiceDescRec  t42_services[] =\r\n  {\r\n    { FT_SERVICE_ID_GLYPH_DICT,           &t42_service_glyph_dict },\r\n    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t42_service_ps_font_name },\r\n    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &t42_service_ps_info },\r\n    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_TYPE_42 },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  FT_CALLBACK_DEF( FT_Module_Interface )\r\n  T42_Get_Interface( FT_Module         module,\r\n                     const FT_String*  t42_interface )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( t42_services, t42_interface );\r\n  }\r\n\r\n\r\n  const FT_Driver_ClassRec  t42_driver_class =\r\n  {\r\n    {\r\n      FT_MODULE_FONT_DRIVER       |\r\n      FT_MODULE_DRIVER_SCALABLE   |\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n      FT_MODULE_DRIVER_HAS_HINTER,\r\n#else\r\n      0,\r\n#endif\r\n\r\n      sizeof ( T42_DriverRec ),\r\n\r\n      \"type42\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,    /* format interface */\r\n\r\n      T42_Driver_Init,\r\n      T42_Driver_Done,\r\n      T42_Get_Interface,\r\n    },\r\n\r\n    sizeof ( T42_FaceRec ),\r\n    sizeof ( T42_SizeRec ),\r\n    sizeof ( T42_GlyphSlotRec ),\r\n\r\n    T42_Face_Init,\r\n    T42_Face_Done,\r\n    T42_Size_Init,\r\n    T42_Size_Done,\r\n    T42_GlyphSlot_Init,\r\n    T42_GlyphSlot_Done,\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n    T42_GlyphSlot_Load,\r\n\r\n    0,                 /* FT_Face_GetKerningFunc  */\r\n    0,                 /* FT_Face_AttachFunc      */\r\n\r\n    0,                 /* FT_Face_GetAdvancesFunc */\r\n    T42_Size_Request,\r\n    T42_Size_Select\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42drivr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42drivr.h                                                             */\r\n/*                                                                         */\r\n/*    High-level Type 42 driver interface (specification).                 */\r\n/*                                                                         */\r\n/*  Copyright 2002 by Roberto Alameda.                                     */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T42DRIVR_H__\r\n#define __T42DRIVR_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Driver_ClassRec )  t42_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __T42DRIVR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42error.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42error.h                                                             */\r\n/*                                                                         */\r\n/*    Type 42 error codes (specification only).                            */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2012 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the Type 42 error enumeration constants.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __T42ERROR_H__\r\n#define __T42ERROR_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  T42_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Type42\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __T42ERROR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42objs.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42objs.c                                                              */\r\n/*                                                                         */\r\n/*    Type 42 objects manager (body).                                      */\r\n/*                                                                         */\r\n/*  Copyright 2002-2009, 2011                                              */\r\n/*  by Roberto Alameda.                                                    */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"t42objs.h\"\r\n#include \"t42parse.h\"\r\n#include \"t42error.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_LIST_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t42\r\n\r\n\r\n  static FT_Error\r\n  T42_Open_Face( T42_Face  face )\r\n  {\r\n    T42_LoaderRec  loader;\r\n    T42_Parser     parser;\r\n    T1_Font        type1 = &face->type1;\r\n    FT_Memory      memory = face->root.memory;\r\n    FT_Error       error;\r\n\r\n    PSAux_Service  psaux  = (PSAux_Service)face->psaux;\r\n\r\n\r\n    t42_loader_init( &loader, face );\r\n\r\n    parser = &loader.parser;\r\n\r\n    if ( FT_ALLOC( face->ttf_data, 12 ) )\r\n      goto Exit;\r\n\r\n    error = t42_parser_init( parser,\r\n                             face->root.stream,\r\n                             memory,\r\n                             psaux);\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    error = t42_parse_dict( face, &loader,\r\n                            parser->base_dict, parser->base_len );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    if ( type1->font_type != 42 )\r\n    {\r\n      FT_ERROR(( \"T42_Open_Face: cannot handle FontType %d\\n\",\r\n                 type1->font_type ));\r\n      error = T42_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now, propagate the charstrings and glyphnames tables */\r\n    /* to the Type1 data                                    */\r\n    type1->num_glyphs = loader.num_glyphs;\r\n\r\n    if ( !loader.charstrings.init )\r\n    {\r\n      FT_ERROR(( \"T42_Open_Face: no charstrings array in face\\n\" ));\r\n      error = T42_Err_Invalid_File_Format;\r\n    }\r\n\r\n    loader.charstrings.init  = 0;\r\n    type1->charstrings_block = loader.charstrings.block;\r\n    type1->charstrings       = loader.charstrings.elements;\r\n    type1->charstrings_len   = loader.charstrings.lengths;\r\n\r\n    /* we copy the glyph names `block' and `elements' fields; */\r\n    /* the `lengths' field must be released later             */\r\n    type1->glyph_names_block    = loader.glyph_names.block;\r\n    type1->glyph_names          = (FT_String**)loader.glyph_names.elements;\r\n    loader.glyph_names.block    = 0;\r\n    loader.glyph_names.elements = 0;\r\n\r\n    /* we must now build type1.encoding when we have a custom array */\r\n    if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY )\r\n    {\r\n      FT_Int    charcode, idx, min_char, max_char;\r\n      FT_Byte*  char_name;\r\n      FT_Byte*  glyph_name;\r\n\r\n\r\n      /* OK, we do the following: for each element in the encoding   */\r\n      /* table, look up the index of the glyph having the same name  */\r\n      /* as defined in the CharStrings array.                        */\r\n      /* The index is then stored in type1.encoding.char_index, and  */\r\n      /* the name in type1.encoding.char_name                        */\r\n\r\n      min_char = 0;\r\n      max_char = 0;\r\n\r\n      charcode = 0;\r\n      for ( ; charcode < loader.encoding_table.max_elems; charcode++ )\r\n      {\r\n        type1->encoding.char_index[charcode] = 0;\r\n        type1->encoding.char_name [charcode] = (char *)\".notdef\";\r\n\r\n        char_name = loader.encoding_table.elements[charcode];\r\n        if ( char_name )\r\n          for ( idx = 0; idx < type1->num_glyphs; idx++ )\r\n          {\r\n            glyph_name = (FT_Byte*)type1->glyph_names[idx];\r\n            if ( ft_strcmp( (const char*)char_name,\r\n                            (const char*)glyph_name ) == 0 )\r\n            {\r\n              type1->encoding.char_index[charcode] = (FT_UShort)idx;\r\n              type1->encoding.char_name [charcode] = (char*)glyph_name;\r\n\r\n              /* Change min/max encoded char only if glyph name is */\r\n              /* not /.notdef                                      */\r\n              if ( ft_strcmp( (const char*)\".notdef\",\r\n                              (const char*)glyph_name ) != 0 )\r\n              {\r\n                if ( charcode < min_char )\r\n                  min_char = charcode;\r\n                if ( charcode >= max_char )\r\n                  max_char = charcode + 1;\r\n              }\r\n              break;\r\n            }\r\n          }\r\n      }\r\n\r\n      type1->encoding.code_first = min_char;\r\n      type1->encoding.code_last  = max_char;\r\n      type1->encoding.num_chars  = loader.num_chars;\r\n    }\r\n\r\n  Exit:\r\n    t42_loader_done( &loader );\r\n    return error;\r\n  }\r\n\r\n\r\n  /***************** Driver Functions *************/\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_Face_Init( FT_Stream      stream,\r\n                 FT_Face        t42face,       /* T42_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    T42_Face            face  = (T42_Face)t42face;\r\n    FT_Error            error;\r\n    FT_Service_PsCMaps  psnames;\r\n    PSAux_Service       psaux;\r\n    FT_Face             root  = (FT_Face)&face->root;\r\n    T1_Font             type1 = &face->type1;\r\n    PS_FontInfo         info  = &type1->font_info;\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n    FT_UNUSED( face_index );\r\n    FT_UNUSED( stream );\r\n\r\n\r\n    face->ttf_face       = NULL;\r\n    face->root.num_faces = 1;\r\n\r\n    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );\r\n    face->psnames = psnames;\r\n\r\n    face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),\r\n                                           \"psaux\" );\r\n    psaux = (PSAux_Service)face->psaux;\r\n    if ( !psaux )\r\n    {\r\n      FT_ERROR(( \"T42_Face_Init: cannot access `psaux' module\\n\" ));\r\n      error = T42_Err_Missing_Module;\r\n      goto Exit;\r\n    }\r\n\r\n    FT_TRACE2(( \"Type 42 driver\\n\" ));\r\n\r\n    /* open the tokenizer, this will also check the font format */\r\n    error = T42_Open_Face( face );\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    /* if we just wanted to check the format, leave successfully now */\r\n    if ( face_index < 0 )\r\n      goto Exit;\r\n\r\n    /* check the face index */\r\n    if ( face_index > 0 )\r\n    {\r\n      FT_ERROR(( \"T42_Face_Init: invalid face index\\n\" ));\r\n      error = T42_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Now load the font program into the face object */\r\n\r\n    /* Init the face object fields */\r\n    /* Now set up root face fields */\r\n\r\n    root->num_glyphs   = type1->num_glyphs;\r\n    root->num_charmaps = 0;\r\n    root->face_index   = 0;\r\n\r\n    root->face_flags = FT_FACE_FLAG_SCALABLE    |\r\n                       FT_FACE_FLAG_HORIZONTAL  |\r\n                       FT_FACE_FLAG_GLYPH_NAMES;\r\n\r\n    if ( info->is_fixed_pitch )\r\n      root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n    /* We only set this flag if we have the patented bytecode interpreter. */\r\n    /* There are no known `tricky' Type42 fonts that could be loaded with  */\r\n    /* the unpatented interpreter.                                         */\r\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n    root->face_flags |= FT_FACE_FLAG_HINTER;\r\n#endif\r\n\r\n    /* XXX: TODO -- add kerning with .afm support */\r\n\r\n    /* get style name -- be careful, some broken fonts only */\r\n    /* have a `/FontName' dictionary entry!                 */\r\n    root->family_name = info->family_name;\r\n    /* assume \"Regular\" style if we don't know better */\r\n    root->style_name = (char *)\"Regular\";\r\n    if ( root->family_name )\r\n    {\r\n      char*  full   = info->full_name;\r\n      char*  family = root->family_name;\r\n\r\n\r\n      if ( full )\r\n      {\r\n        while ( *full )\r\n        {\r\n          if ( *full == *family )\r\n          {\r\n            family++;\r\n            full++;\r\n          }\r\n          else\r\n          {\r\n            if ( *full == ' ' || *full == '-' )\r\n              full++;\r\n            else if ( *family == ' ' || *family == '-' )\r\n              family++;\r\n            else\r\n            {\r\n              if ( !*family )\r\n                root->style_name = full;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n    else\r\n    {\r\n      /* do we have a `/FontName'? */\r\n      if ( type1->font_name )\r\n        root->family_name = type1->font_name;\r\n    }\r\n\r\n    /* no embedded bitmap support */\r\n    root->num_fixed_sizes = 0;\r\n    root->available_sizes = 0;\r\n\r\n    /* Load the TTF font embedded in the T42 font */\r\n    {\r\n      FT_Open_Args  args;\r\n\r\n\r\n      args.flags       = FT_OPEN_MEMORY;\r\n      args.memory_base = face->ttf_data;\r\n      args.memory_size = face->ttf_size;\r\n\r\n      if ( num_params )\r\n      {\r\n        args.flags     |= FT_OPEN_PARAMS;\r\n        args.num_params = num_params;\r\n        args.params     = params;\r\n      }\r\n\r\n      error = FT_Open_Face( FT_FACE_LIBRARY( face ),\r\n                            &args, 0, &face->ttf_face );\r\n    }\r\n\r\n    if ( error )\r\n      goto Exit;\r\n\r\n    FT_Done_Size( face->ttf_face->size );\r\n\r\n    /* Ignore info in FontInfo dictionary and use the info from the  */\r\n    /* loaded TTF font.  The PostScript interpreter also ignores it. */\r\n    root->bbox         = face->ttf_face->bbox;\r\n    root->units_per_EM = face->ttf_face->units_per_EM;\r\n\r\n    root->ascender  = face->ttf_face->ascender;\r\n    root->descender = face->ttf_face->descender;\r\n    root->height    = face->ttf_face->height;\r\n\r\n    root->max_advance_width  = face->ttf_face->max_advance_width;\r\n    root->max_advance_height = face->ttf_face->max_advance_height;\r\n\r\n    root->underline_position  = (FT_Short)info->underline_position;\r\n    root->underline_thickness = (FT_Short)info->underline_thickness;\r\n\r\n    /* compute style flags */\r\n    root->style_flags = 0;\r\n    if ( info->italic_angle )\r\n      root->style_flags |= FT_STYLE_FLAG_ITALIC;\r\n\r\n    if ( face->ttf_face->style_flags & FT_STYLE_FLAG_BOLD )\r\n      root->style_flags |= FT_STYLE_FLAG_BOLD;\r\n\r\n    if ( face->ttf_face->face_flags & FT_FACE_FLAG_VERTICAL )\r\n      root->face_flags |= FT_FACE_FLAG_VERTICAL;\r\n\r\n    {\r\n      if ( psnames )\r\n      {\r\n        FT_CharMapRec    charmap;\r\n        T1_CMap_Classes  cmap_classes = psaux->t1_cmap_classes;\r\n        FT_CMap_Class    clazz;\r\n\r\n\r\n        charmap.face = root;\r\n\r\n        /* first of all, try to synthesize a Unicode charmap */\r\n        charmap.platform_id = TT_PLATFORM_MICROSOFT;\r\n        charmap.encoding_id = TT_MS_ID_UNICODE_CS;\r\n        charmap.encoding    = FT_ENCODING_UNICODE;\r\n\r\n        error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );\r\n        if ( error && FT_Err_No_Unicode_Glyph_Name != error )\r\n          goto Exit;\r\n        error = FT_Err_Ok;\r\n\r\n        /* now, generate an Adobe Standard encoding when appropriate */\r\n        charmap.platform_id = TT_PLATFORM_ADOBE;\r\n        clazz               = NULL;\r\n\r\n        switch ( type1->encoding_type )\r\n        {\r\n        case T1_ENCODING_TYPE_STANDARD:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_STANDARD;\r\n          charmap.encoding_id = TT_ADOBE_ID_STANDARD;\r\n          clazz               = cmap_classes->standard;\r\n          break;\r\n\r\n        case T1_ENCODING_TYPE_EXPERT:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_EXPERT;\r\n          charmap.encoding_id = TT_ADOBE_ID_EXPERT;\r\n          clazz               = cmap_classes->expert;\r\n          break;\r\n\r\n        case T1_ENCODING_TYPE_ARRAY:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_CUSTOM;\r\n          charmap.encoding_id = TT_ADOBE_ID_CUSTOM;\r\n          clazz               = cmap_classes->custom;\r\n          break;\r\n\r\n        case T1_ENCODING_TYPE_ISOLATIN1:\r\n          charmap.encoding    = FT_ENCODING_ADOBE_LATIN_1;\r\n          charmap.encoding_id = TT_ADOBE_ID_LATIN_1;\r\n          clazz               = cmap_classes->unicode;\r\n          break;\r\n\r\n        default:\r\n          ;\r\n        }\r\n\r\n        if ( clazz )\r\n          error = FT_CMap_New( clazz, NULL, &charmap, NULL );\r\n\r\n#if 0\r\n        /* Select default charmap */\r\n        if ( root->num_charmaps )\r\n          root->charmap = root->charmaps[0];\r\n#endif\r\n      }\r\n    }\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T42_Face_Done( FT_Face  t42face )\r\n  {\r\n    T42_Face     face = (T42_Face)t42face;\r\n    T1_Font      type1;\r\n    PS_FontInfo  info;\r\n    FT_Memory    memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    type1  = &face->type1;\r\n    info   = &type1->font_info;\r\n    memory = face->root.memory;\r\n\r\n    /* delete internal ttf face prior to freeing face->ttf_data */\r\n    if ( face->ttf_face )\r\n      FT_Done_Face( face->ttf_face );\r\n\r\n    /* release font info strings */\r\n    FT_FREE( info->version );\r\n    FT_FREE( info->notice );\r\n    FT_FREE( info->full_name );\r\n    FT_FREE( info->family_name );\r\n    FT_FREE( info->weight );\r\n\r\n    /* release top dictionary */\r\n    FT_FREE( type1->charstrings_len );\r\n    FT_FREE( type1->charstrings );\r\n    FT_FREE( type1->glyph_names );\r\n\r\n    FT_FREE( type1->charstrings_block );\r\n    FT_FREE( type1->glyph_names_block );\r\n\r\n    FT_FREE( type1->encoding.char_index );\r\n    FT_FREE( type1->encoding.char_name );\r\n    FT_FREE( type1->font_name );\r\n\r\n    FT_FREE( face->ttf_data );\r\n\r\n#if 0\r\n    /* release afm data if present */\r\n    if ( face->afm_data )\r\n      T1_Done_AFM( memory, (T1_AFM*)face->afm_data );\r\n#endif\r\n\r\n    /* release unicode map, if any */\r\n    FT_FREE( face->unicode_map.maps );\r\n    face->unicode_map.num_maps = 0;\r\n\r\n    face->root.family_name = 0;\r\n    face->root.style_name  = 0;\r\n  }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    T42_Driver_Init                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initializes a given Type 42 driver object.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    driver :: A handle to the target driver object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_Driver_Init( FT_Module  module )        /* T42_Driver */\r\n  {\r\n    T42_Driver  driver = (T42_Driver)module;\r\n    FT_Module   ttmodule;\r\n\r\n\r\n    ttmodule = FT_Get_Module( module->library, \"truetype\" );\r\n    if ( !ttmodule )\r\n    {\r\n      FT_ERROR(( \"T42_Driver_Init: cannot access `truetype' module\\n\" ));\r\n      return T42_Err_Missing_Module;\r\n    }\r\n\r\n    driver->ttclazz = (FT_Driver_Class)ttmodule->clazz;\r\n\r\n    return T42_Err_Ok;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T42_Driver_Done( FT_Module  module )\r\n  {\r\n    FT_UNUSED( module );\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_Size_Init( FT_Size  size )         /* T42_Size */\r\n  {\r\n    T42_Size  t42size = (T42_Size)size;\r\n    FT_Face   face    = size->face;\r\n    T42_Face  t42face = (T42_Face)face;\r\n    FT_Size   ttsize;\r\n    FT_Error  error   = T42_Err_Ok;\r\n\r\n\r\n    error = FT_New_Size( t42face->ttf_face, &ttsize );\r\n    t42size->ttsize = ttsize;\r\n\r\n    FT_Activate_Size( ttsize );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_Size_Request( FT_Size          t42size,      /* T42_Size */\r\n                    FT_Size_Request  req )\r\n  {\r\n    T42_Size  size = (T42_Size)t42size;\r\n    T42_Face  face = (T42_Face)t42size->face;\r\n    FT_Error  error;\r\n\r\n\r\n    FT_Activate_Size( size->ttsize );\r\n\r\n    error = FT_Request_Size( face->ttf_face, req );\r\n    if ( !error )\r\n      t42size->metrics = face->ttf_face->size->metrics;\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_Size_Select( FT_Size   t42size,         /* T42_Size */\r\n                   FT_ULong  strike_index )\r\n  {\r\n    T42_Size  size = (T42_Size)t42size;\r\n    T42_Face  face = (T42_Face)t42size->face;\r\n    FT_Error  error;\r\n\r\n\r\n    FT_Activate_Size( size->ttsize );\r\n\r\n    error = FT_Select_Size( face->ttf_face, (FT_Int)strike_index );\r\n    if ( !error )\r\n      t42size->metrics = face->ttf_face->size->metrics;\r\n\r\n    return error;\r\n\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T42_Size_Done( FT_Size  t42size )             /* T42_Size */\r\n  {\r\n    T42_Size     size    = (T42_Size)t42size;\r\n    FT_Face      face    = t42size->face;\r\n    T42_Face     t42face = (T42_Face)face;\r\n    FT_ListNode  node;\r\n\r\n\r\n    node = FT_List_Find( &t42face->ttf_face->sizes_list, size->ttsize );\r\n    if ( node )\r\n    {\r\n      FT_Done_Size( size->ttsize );\r\n      size->ttsize = NULL;\r\n    }\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_GlyphSlot_Init( FT_GlyphSlot  t42slot )        /* T42_GlyphSlot */\r\n  {\r\n    T42_GlyphSlot  slot    = (T42_GlyphSlot)t42slot;\r\n    FT_Face        face    = t42slot->face;\r\n    T42_Face       t42face = (T42_Face)face;\r\n    FT_GlyphSlot   ttslot;\r\n    FT_Error       error   = T42_Err_Ok;\r\n\r\n\r\n    if ( face->glyph == NULL )\r\n    {\r\n      /* First glyph slot for this face */\r\n      slot->ttslot = t42face->ttf_face->glyph;\r\n    }\r\n    else\r\n    {\r\n      error = FT_New_GlyphSlot( t42face->ttf_face, &ttslot );\r\n      slot->ttslot = ttslot;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  T42_GlyphSlot_Done( FT_GlyphSlot  t42slot )       /* T42_GlyphSlot */\r\n  {\r\n    T42_GlyphSlot  slot = (T42_GlyphSlot)t42slot;\r\n\r\n\r\n    FT_Done_GlyphSlot( slot->ttslot );\r\n  }\r\n\r\n\r\n  static void\r\n  t42_glyphslot_clear( FT_GlyphSlot  slot )\r\n  {\r\n    /* free bitmap if needed */\r\n    ft_glyphslot_free_bitmap( slot );\r\n\r\n    /* clear all public fields in the glyph slot */\r\n    FT_ZERO( &slot->metrics );\r\n    FT_ZERO( &slot->outline );\r\n    FT_ZERO( &slot->bitmap );\r\n\r\n    slot->bitmap_left   = 0;\r\n    slot->bitmap_top    = 0;\r\n    slot->num_subglyphs = 0;\r\n    slot->subglyphs     = 0;\r\n    slot->control_data  = 0;\r\n    slot->control_len   = 0;\r\n    slot->other         = 0;\r\n    slot->format        = FT_GLYPH_FORMAT_NONE;\r\n\r\n    slot->linearHoriAdvance = 0;\r\n    slot->linearVertAdvance = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  T42_GlyphSlot_Load( FT_GlyphSlot  glyph,\r\n                      FT_Size       size,\r\n                      FT_UInt       glyph_index,\r\n                      FT_Int32      load_flags )\r\n  {\r\n    FT_Error         error;\r\n    T42_GlyphSlot    t42slot = (T42_GlyphSlot)glyph;\r\n    T42_Size         t42size = (T42_Size)size;\r\n    FT_Driver_Class  ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz;\r\n\r\n\r\n    t42_glyphslot_clear( t42slot->ttslot );\r\n    error = ttclazz->load_glyph( t42slot->ttslot,\r\n                                 t42size->ttsize,\r\n                                 glyph_index,\r\n                                 load_flags | FT_LOAD_NO_BITMAP );\r\n\r\n    if ( !error )\r\n    {\r\n      glyph->metrics = t42slot->ttslot->metrics;\r\n\r\n      glyph->linearHoriAdvance = t42slot->ttslot->linearHoriAdvance;\r\n      glyph->linearVertAdvance = t42slot->ttslot->linearVertAdvance;\r\n\r\n      glyph->format  = t42slot->ttslot->format;\r\n      glyph->outline = t42slot->ttslot->outline;\r\n\r\n      glyph->bitmap      = t42slot->ttslot->bitmap;\r\n      glyph->bitmap_left = t42slot->ttslot->bitmap_left;\r\n      glyph->bitmap_top  = t42slot->ttslot->bitmap_top;\r\n\r\n      glyph->num_subglyphs = t42slot->ttslot->num_subglyphs;\r\n      glyph->subglyphs     = t42slot->ttslot->subglyphs;\r\n\r\n      glyph->control_data  = t42slot->ttslot->control_data;\r\n      glyph->control_len   = t42slot->ttslot->control_len;\r\n    }\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42objs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42objs.h                                                              */\r\n/*                                                                         */\r\n/*    Type 42 objects manager (specification).                             */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006, 2007, 2011 by Roberto Alameda.             */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T42OBJS_H__\r\n#define __T42OBJS_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TYPE1_TABLES_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include \"t42types.h\"\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_DRIVER_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* Type42 size */\r\n  typedef struct  T42_SizeRec_\r\n  {\r\n    FT_SizeRec  root;\r\n    FT_Size     ttsize;\r\n\r\n  } T42_SizeRec, *T42_Size;\r\n\r\n\r\n  /* Type42 slot */\r\n  typedef struct  T42_GlyphSlotRec_\r\n  {\r\n    FT_GlyphSlotRec  root;\r\n    FT_GlyphSlot     ttslot;\r\n\r\n  } T42_GlyphSlotRec, *T42_GlyphSlot;\r\n\r\n\r\n  /* Type 42 driver */\r\n  typedef struct  T42_DriverRec_\r\n  {\r\n    FT_DriverRec     root;\r\n    FT_Driver_Class  ttclazz;\r\n    void*            extension_component;\r\n\r\n  } T42_DriverRec, *T42_Driver;\r\n\r\n\r\n  /* */\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_Face_Init( FT_Stream      stream,\r\n                 FT_Face        face,\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  T42_Face_Done( FT_Face  face );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_Size_Init( FT_Size  size );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_Size_Request( FT_Size          size,\r\n                    FT_Size_Request  req );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_Size_Select( FT_Size   size,\r\n                   FT_ULong  strike_index );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  T42_Size_Done( FT_Size  size );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_GlyphSlot_Init( FT_GlyphSlot  slot );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_GlyphSlot_Load( FT_GlyphSlot  glyph,\r\n                      FT_Size       size,\r\n                      FT_UInt       glyph_index,\r\n                      FT_Int32      load_flags );\r\n\r\n  FT_LOCAL( void )\r\n  T42_GlyphSlot_Done( FT_GlyphSlot  slot );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  T42_Driver_Init( FT_Module  module );\r\n\r\n  FT_LOCAL( void )\r\n  T42_Driver_Done( FT_Module  module );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __T42OBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42parse.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42parse.c                                                             */\r\n/*                                                                         */\r\n/*    Type 42 font parser (body).                                          */\r\n/*                                                                         */\r\n/*  Copyright 2002-2012 by                                                 */\r\n/*  Roberto Alameda.                                                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include \"t42parse.h\"\r\n#include \"t42error.h\"\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_t42\r\n\r\n\r\n  static void\r\n  t42_parse_font_matrix( T42_Face    face,\r\n                         T42_Loader  loader );\r\n  static void\r\n  t42_parse_encoding( T42_Face    face,\r\n                      T42_Loader  loader );\r\n\r\n  static void\r\n  t42_parse_charstrings( T42_Face    face,\r\n                         T42_Loader  loader );\r\n\r\n  static void\r\n  t42_parse_sfnts( T42_Face    face,\r\n                   T42_Loader  loader );\r\n\r\n\r\n  /* as Type42 fonts have no Private dict,         */\r\n  /* we set the last argument of T1_FIELD_XXX to 0 */\r\n  static const\r\n  T1_FieldRec  t42_keywords[] =\r\n  {\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  T1_FontInfo\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_INFO\r\n\r\n    T1_FIELD_STRING( \"version\",            version,             0 )\r\n    T1_FIELD_STRING( \"Notice\",             notice,              0 )\r\n    T1_FIELD_STRING( \"FullName\",           full_name,           0 )\r\n    T1_FIELD_STRING( \"FamilyName\",         family_name,         0 )\r\n    T1_FIELD_STRING( \"Weight\",             weight,              0 )\r\n    T1_FIELD_NUM   ( \"ItalicAngle\",        italic_angle,        0 )\r\n    T1_FIELD_BOOL  ( \"isFixedPitch\",       is_fixed_pitch,      0 )\r\n    T1_FIELD_NUM   ( \"UnderlinePosition\",  underline_position,  0 )\r\n    T1_FIELD_NUM   ( \"UnderlineThickness\", underline_thickness, 0 )\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  PS_FontExtraRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_EXTRA\r\n\r\n    T1_FIELD_NUM   ( \"FSType\",             fs_type,             0 )\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  T1_FontRec\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_FONT_DICT\r\n\r\n    T1_FIELD_KEY  ( \"FontName\",    font_name,    0 )\r\n    T1_FIELD_NUM  ( \"PaintType\",   paint_type,   0 )\r\n    T1_FIELD_NUM  ( \"FontType\",    font_type,    0 )\r\n    T1_FIELD_FIXED( \"StrokeWidth\", stroke_width, 0 )\r\n\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  FT_BBox\r\n#undef  T1CODE\r\n#define T1CODE        T1_FIELD_LOCATION_BBOX\r\n\r\n    T1_FIELD_BBOX(\"FontBBox\", xMin, 0 )\r\n\r\n    T1_FIELD_CALLBACK( \"FontMatrix\",  t42_parse_font_matrix, 0 )\r\n    T1_FIELD_CALLBACK( \"Encoding\",    t42_parse_encoding,    0 )\r\n    T1_FIELD_CALLBACK( \"CharStrings\", t42_parse_charstrings, 0 )\r\n    T1_FIELD_CALLBACK( \"sfnts\",       t42_parse_sfnts,       0 )\r\n\r\n    { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }\r\n  };\r\n\r\n\r\n#define T1_Add_Table( p, i, o, l )  (p)->funcs.add( (p), i, o, l )\r\n#define T1_Done_Table( p )          \\\r\n          do                        \\\r\n          {                         \\\r\n            if ( (p)->funcs.done )  \\\r\n              (p)->funcs.done( p ); \\\r\n          } while ( 0 )\r\n#define T1_Release_Table( p )          \\\r\n          do                           \\\r\n          {                            \\\r\n            if ( (p)->funcs.release )  \\\r\n              (p)->funcs.release( p ); \\\r\n          } while ( 0 )\r\n\r\n#define T1_Skip_Spaces( p )    (p)->root.funcs.skip_spaces( &(p)->root )\r\n#define T1_Skip_PS_Token( p )  (p)->root.funcs.skip_PS_token( &(p)->root )\r\n\r\n#define T1_ToInt( p )                          \\\r\n          (p)->root.funcs.to_int( &(p)->root )\r\n#define T1_ToBytes( p, b, m, n, d )                          \\\r\n          (p)->root.funcs.to_bytes( &(p)->root, b, m, n, d )\r\n\r\n#define T1_ToFixedArray( p, m, f, t )                           \\\r\n          (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )\r\n#define T1_ToToken( p, t )                          \\\r\n          (p)->root.funcs.to_token( &(p)->root, t )\r\n\r\n#define T1_Load_Field( p, f, o, m, pf )                         \\\r\n          (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )\r\n#define T1_Load_Field_Table( p, f, o, m, pf )                         \\\r\n          (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )\r\n\r\n\r\n  /********************* Parsing Functions ******************/\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t42_parser_init( T42_Parser     parser,\r\n                   FT_Stream      stream,\r\n                   FT_Memory      memory,\r\n                   PSAux_Service  psaux )\r\n  {\r\n    FT_Error  error = T42_Err_Ok;\r\n    FT_Long   size;\r\n\r\n\r\n    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );\r\n\r\n    parser->stream    = stream;\r\n    parser->base_len  = 0;\r\n    parser->base_dict = 0;\r\n    parser->in_memory = 0;\r\n\r\n    /*******************************************************************/\r\n    /*                                                                 */\r\n    /* Here a short summary of what is going on:                       */\r\n    /*                                                                 */\r\n    /*   When creating a new Type 42 parser, we try to locate and load */\r\n    /*   the base dictionary, loading the whole font into memory.      */\r\n    /*                                                                 */\r\n    /*   When `loading' the base dictionary, we only set up pointers   */\r\n    /*   in the case of a memory-based stream.  Otherwise, we allocate */\r\n    /*   and load the base dictionary in it.                           */\r\n    /*                                                                 */\r\n    /*   parser->in_memory is set if we have a memory stream.          */\r\n    /*                                                                 */\r\n\r\n    if ( FT_STREAM_SEEK( 0L ) ||\r\n         FT_FRAME_ENTER( 17 ) )\r\n      goto Exit;\r\n\r\n    if ( ft_memcmp( stream->cursor, \"%!PS-TrueTypeFont\", 17 ) != 0 )\r\n    {\r\n      FT_TRACE2(( \"  not a Type42 font\\n\" ));\r\n      error = T42_Err_Unknown_File_Format;\r\n    }\r\n\r\n    FT_FRAME_EXIT();\r\n\r\n    if ( error || FT_STREAM_SEEK( 0 ) )\r\n      goto Exit;\r\n\r\n    size = stream->size;\r\n\r\n    /* now, try to load `size' bytes of the `base' dictionary we */\r\n    /* found previously                                          */\r\n\r\n    /* if it is a memory-based resource, set up pointers */\r\n    if ( !stream->read )\r\n    {\r\n      parser->base_dict = (FT_Byte*)stream->base + stream->pos;\r\n      parser->base_len  = size;\r\n      parser->in_memory = 1;\r\n\r\n      /* check that the `size' field is valid */\r\n      if ( FT_STREAM_SKIP( size ) )\r\n        goto Exit;\r\n    }\r\n    else\r\n    {\r\n      /* read segment in memory */\r\n      if ( FT_ALLOC( parser->base_dict, size )       ||\r\n           FT_STREAM_READ( parser->base_dict, size ) )\r\n        goto Exit;\r\n\r\n      parser->base_len = size;\r\n    }\r\n\r\n    parser->root.base   = parser->base_dict;\r\n    parser->root.cursor = parser->base_dict;\r\n    parser->root.limit  = parser->root.cursor + parser->base_len;\r\n\r\n  Exit:\r\n    if ( error && !parser->in_memory )\r\n      FT_FREE( parser->base_dict );\r\n\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  t42_parser_done( T42_Parser  parser )\r\n  {\r\n    FT_Memory  memory = parser->root.memory;\r\n\r\n\r\n    /* free the base dictionary only when we have a disk stream */\r\n    if ( !parser->in_memory )\r\n      FT_FREE( parser->base_dict );\r\n\r\n    parser->root.funcs.done( &parser->root );\r\n  }\r\n\r\n\r\n  static int\r\n  t42_is_space( FT_Byte  c )\r\n  {\r\n    return ( c == ' '  || c == '\\t'              ||\r\n             c == '\\r' || c == '\\n' || c == '\\f' ||\r\n             c == '\\0'                           );\r\n  }\r\n\r\n\r\n  static void\r\n  t42_parse_font_matrix( T42_Face    face,\r\n                         T42_Loader  loader )\r\n  {\r\n    T42_Parser  parser = &loader->parser;\r\n    FT_Matrix*  matrix = &face->type1.font_matrix;\r\n    FT_Vector*  offset = &face->type1.font_offset;\r\n    FT_Face     root   = (FT_Face)&face->root;\r\n    FT_Fixed    temp[6];\r\n    FT_Fixed    temp_scale;\r\n\r\n\r\n    (void)T1_ToFixedArray( parser, 6, temp, 3 );\r\n\r\n    temp_scale = FT_ABS( temp[3] );\r\n\r\n    /* Set Units per EM based on FontMatrix values.  We set the value to */\r\n    /* 1000 / temp_scale, because temp_scale was already multiplied by   */\r\n    /* 1000 (in t1_tofixed, from psobjs.c).                              */\r\n\r\n    root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );\r\n\r\n    /* we need to scale the values by 1.0/temp_scale */\r\n    if ( temp_scale != 0x10000L )\r\n    {\r\n      temp[0] = FT_DivFix( temp[0], temp_scale );\r\n      temp[1] = FT_DivFix( temp[1], temp_scale );\r\n      temp[2] = FT_DivFix( temp[2], temp_scale );\r\n      temp[4] = FT_DivFix( temp[4], temp_scale );\r\n      temp[5] = FT_DivFix( temp[5], temp_scale );\r\n      temp[3] = 0x10000L;\r\n    }\r\n\r\n    matrix->xx = temp[0];\r\n    matrix->yx = temp[1];\r\n    matrix->xy = temp[2];\r\n    matrix->yy = temp[3];\r\n\r\n    /* note that the offsets must be expressed in integer font units */\r\n    offset->x = temp[4] >> 16;\r\n    offset->y = temp[5] >> 16;\r\n  }\r\n\r\n\r\n  static void\r\n  t42_parse_encoding( T42_Face    face,\r\n                      T42_Loader  loader )\r\n  {\r\n    T42_Parser  parser = &loader->parser;\r\n    FT_Byte*    cur;\r\n    FT_Byte*    limit  = parser->root.limit;\r\n\r\n    PSAux_Service  psaux  = (PSAux_Service)face->psaux;\r\n\r\n\r\n    T1_Skip_Spaces( parser );\r\n    cur = parser->root.cursor;\r\n    if ( cur >= limit )\r\n    {\r\n      FT_ERROR(( \"t42_parse_encoding: out of bounds\\n\" ));\r\n      parser->root.error = T42_Err_Invalid_File_Format;\r\n      return;\r\n    }\r\n\r\n    /* if we have a number or `[', the encoding is an array, */\r\n    /* and we must load it now                               */\r\n    if ( ft_isdigit( *cur ) || *cur == '[' )\r\n    {\r\n      T1_Encoding  encode          = &face->type1.encoding;\r\n      FT_UInt      count, n;\r\n      PS_Table     char_table      = &loader->encoding_table;\r\n      FT_Memory    memory          = parser->root.memory;\r\n      FT_Error     error;\r\n      FT_Bool      only_immediates = 0;\r\n\r\n\r\n      /* read the number of entries in the encoding; should be 256 */\r\n      if ( *cur == '[' )\r\n      {\r\n        count           = 256;\r\n        only_immediates = 1;\r\n        parser->root.cursor++;\r\n      }\r\n      else\r\n        count = (FT_UInt)T1_ToInt( parser );\r\n\r\n      T1_Skip_Spaces( parser );\r\n      if ( parser->root.cursor >= limit )\r\n        return;\r\n\r\n      /* we use a T1_Table to store our charnames */\r\n      loader->num_chars = encode->num_chars = count;\r\n      if ( FT_NEW_ARRAY( encode->char_index, count )     ||\r\n           FT_NEW_ARRAY( encode->char_name,  count )     ||\r\n           FT_SET_ERROR( psaux->ps_table_funcs->init(\r\n                           char_table, count, memory ) ) )\r\n      {\r\n        parser->root.error = error;\r\n        return;\r\n      }\r\n\r\n      /* We need to `zero' out encoding_table.elements */\r\n      for ( n = 0; n < count; n++ )\r\n      {\r\n        char*  notdef = (char *)\".notdef\";\r\n\r\n\r\n        T1_Add_Table( char_table, n, notdef, 8 );\r\n      }\r\n\r\n      /* Now we need to read records of the form                */\r\n      /*                                                        */\r\n      /*   ... charcode /charname ...                           */\r\n      /*                                                        */\r\n      /* for each entry in our table.                           */\r\n      /*                                                        */\r\n      /* We simply look for a number followed by an immediate   */\r\n      /* name.  Note that this ignores correctly the sequence   */\r\n      /* that is often seen in type42 fonts:                    */\r\n      /*                                                        */\r\n      /*   0 1 255 { 1 index exch /.notdef put } for dup        */\r\n      /*                                                        */\r\n      /* used to clean the encoding array before anything else. */\r\n      /*                                                        */\r\n      /* Alternatively, if the array is directly given as       */\r\n      /*                                                        */\r\n      /*   /Encoding [ ... ]                                    */\r\n      /*                                                        */\r\n      /* we only read immediates.                               */\r\n\r\n      n = 0;\r\n      T1_Skip_Spaces( parser );\r\n\r\n      while ( parser->root.cursor < limit )\r\n      {\r\n        cur = parser->root.cursor;\r\n\r\n        /* we stop when we encounter `def' or `]' */\r\n        if ( *cur == 'd' && cur + 3 < limit )\r\n        {\r\n          if ( cur[1] == 'e'          &&\r\n               cur[2] == 'f'          &&\r\n               t42_is_space( cur[3] ) )\r\n          {\r\n            FT_TRACE6(( \"encoding end\\n\" ));\r\n            cur += 3;\r\n            break;\r\n          }\r\n        }\r\n        if ( *cur == ']' )\r\n        {\r\n          FT_TRACE6(( \"encoding end\\n\" ));\r\n          cur++;\r\n          break;\r\n        }\r\n\r\n        /* check whether we have found an entry */\r\n        if ( ft_isdigit( *cur ) || only_immediates )\r\n        {\r\n          FT_Int  charcode;\r\n\r\n\r\n          if ( only_immediates )\r\n            charcode = n;\r\n          else\r\n          {\r\n            charcode = (FT_Int)T1_ToInt( parser );\r\n            T1_Skip_Spaces( parser );\r\n          }\r\n\r\n          cur = parser->root.cursor;\r\n\r\n          if ( *cur == '/' && cur + 2 < limit && n < count )\r\n          {\r\n            FT_PtrDist  len;\r\n\r\n\r\n            cur++;\r\n\r\n            parser->root.cursor = cur;\r\n            T1_Skip_PS_Token( parser );\r\n            if ( parser->root.error )\r\n              return;\r\n\r\n            len = parser->root.cursor - cur;\r\n\r\n            parser->root.error = T1_Add_Table( char_table, charcode,\r\n                                               cur, len + 1 );\r\n            if ( parser->root.error )\r\n              return;\r\n            char_table->elements[charcode][len] = '\\0';\r\n\r\n            n++;\r\n          }\r\n        }\r\n        else\r\n        {\r\n          T1_Skip_PS_Token( parser );\r\n          if ( parser->root.error )\r\n            return;\r\n        }\r\n\r\n        T1_Skip_Spaces( parser );\r\n      }\r\n\r\n      face->type1.encoding_type  = T1_ENCODING_TYPE_ARRAY;\r\n      parser->root.cursor        = cur;\r\n    }\r\n\r\n    /* Otherwise, we should have either `StandardEncoding', */\r\n    /* `ExpertEncoding', or `ISOLatin1Encoding'             */\r\n    else\r\n    {\r\n      if ( cur + 17 < limit                                            &&\r\n           ft_strncmp( (const char*)cur, \"StandardEncoding\", 16 ) == 0 )\r\n        face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD;\r\n\r\n      else if ( cur + 15 < limit                                          &&\r\n                ft_strncmp( (const char*)cur, \"ExpertEncoding\", 14 ) == 0 )\r\n        face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT;\r\n\r\n      else if ( cur + 18 < limit                                             &&\r\n                ft_strncmp( (const char*)cur, \"ISOLatin1Encoding\", 17 ) == 0 )\r\n        face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;\r\n\r\n      else\r\n      {\r\n        FT_ERROR(( \"t42_parse_encoding: invalid token\\n\" ));\r\n        parser->root.error = T42_Err_Invalid_File_Format;\r\n      }\r\n    }\r\n  }\r\n\r\n\r\n  typedef enum  T42_Load_Status_\r\n  {\r\n    BEFORE_START,\r\n    BEFORE_TABLE_DIR,\r\n    OTHER_TABLES\r\n\r\n  } T42_Load_Status;\r\n\r\n\r\n  static void\r\n  t42_parse_sfnts( T42_Face    face,\r\n                   T42_Loader  loader )\r\n  {\r\n    T42_Parser  parser = &loader->parser;\r\n    FT_Memory   memory = parser->root.memory;\r\n    FT_Byte*    cur;\r\n    FT_Byte*    limit  = parser->root.limit;\r\n    FT_Error    error;\r\n    FT_Int      num_tables = 0;\r\n    FT_ULong    count, ttf_size = 0;\r\n\r\n    FT_Long     n, string_size, old_string_size, real_size;\r\n    FT_Byte*    string_buf = NULL;\r\n    FT_Bool     allocated  = 0;\r\n\r\n    T42_Load_Status  status;\r\n\r\n\r\n    /* The format is                                */\r\n    /*                                              */\r\n    /*   /sfnts [ <hexstring> <hexstring> ... ] def */\r\n    /*                                              */\r\n    /* or                                           */\r\n    /*                                              */\r\n    /*   /sfnts [                                   */\r\n    /*      <num_bin_bytes> RD <binary data>        */\r\n    /*      <num_bin_bytes> RD <binary data>        */\r\n    /*      ...                                     */\r\n    /*   ] def                                      */\r\n    /*                                              */\r\n    /* with exactly one space after the `RD' token. */\r\n\r\n    T1_Skip_Spaces( parser );\r\n\r\n    if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' )\r\n    {\r\n      FT_ERROR(( \"t42_parse_sfnts: can't find begin of sfnts vector\\n\" ));\r\n      error = T42_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    T1_Skip_Spaces( parser );\r\n    status          = BEFORE_START;\r\n    string_size     = 0;\r\n    old_string_size = 0;\r\n    count           = 0;\r\n\r\n    while ( parser->root.cursor < limit )\r\n    {\r\n      cur = parser->root.cursor;\r\n\r\n      if ( *cur == ']' )\r\n      {\r\n        parser->root.cursor++;\r\n        goto Exit;\r\n      }\r\n\r\n      else if ( *cur == '<' )\r\n      {\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          goto Exit;\r\n\r\n        /* don't include delimiters */\r\n        string_size = (FT_Long)( ( parser->root.cursor - cur - 2 + 1 ) / 2 );\r\n        if ( FT_REALLOC( string_buf, old_string_size, string_size ) )\r\n          goto Fail;\r\n\r\n        allocated = 1;\r\n\r\n        parser->root.cursor = cur;\r\n        (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 );\r\n        old_string_size = string_size;\r\n        string_size = real_size;\r\n      }\r\n\r\n      else if ( ft_isdigit( *cur ) )\r\n      {\r\n        if ( allocated )\r\n        {\r\n          FT_ERROR(( \"t42_parse_sfnts: \"\r\n                     \"can't handle mixed binary and hex strings\\n\" ));\r\n          error = T42_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n\r\n        string_size = T1_ToInt( parser );\r\n        if ( string_size < 0 )\r\n        {\r\n          FT_ERROR(( \"t42_parse_sfnts: invalid string size\\n\" ));\r\n          error = T42_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n\r\n        T1_Skip_PS_Token( parser );             /* `RD' */\r\n        if ( parser->root.error )\r\n          return;\r\n\r\n        string_buf = parser->root.cursor + 1;   /* one space after `RD' */\r\n\r\n        if ( limit - parser->root.cursor < string_size )\r\n        {\r\n          FT_ERROR(( \"t42_parse_sfnts: too many binary data\\n\" ));\r\n          error = T42_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n        else\r\n          parser->root.cursor += string_size + 1;\r\n      }\r\n\r\n      if ( !string_buf )\r\n      {\r\n        FT_ERROR(( \"t42_parse_sfnts: invalid data in sfnts array\\n\" ));\r\n        error = T42_Err_Invalid_File_Format;\r\n        goto Fail;\r\n      }\r\n\r\n      /* A string can have a trailing zero (odd) byte for padding. */\r\n      /* Ignore it.                                                */\r\n      if ( ( string_size & 1 ) && string_buf[string_size - 1] == 0 )\r\n        string_size--;\r\n\r\n      if ( !string_size )\r\n      {\r\n        FT_ERROR(( \"t42_parse_sfnts: invalid string\\n\" ));\r\n        error = T42_Err_Invalid_File_Format;\r\n        goto Fail;\r\n      }\r\n\r\n      for ( n = 0; n < string_size; n++ )\r\n      {\r\n        switch ( status )\r\n        {\r\n        case BEFORE_START:\r\n          /* load offset table, 12 bytes */\r\n          if ( count < 12 )\r\n          {\r\n            face->ttf_data[count++] = string_buf[n];\r\n            continue;\r\n          }\r\n          else\r\n          {\r\n            num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];\r\n            status     = BEFORE_TABLE_DIR;\r\n            ttf_size   = 12 + 16 * num_tables;\r\n\r\n            if ( FT_REALLOC( face->ttf_data, 12, ttf_size ) )\r\n              goto Fail;\r\n          }\r\n          /* fall through */\r\n\r\n        case BEFORE_TABLE_DIR:\r\n          /* the offset table is read; read the table directory */\r\n          if ( count < ttf_size )\r\n          {\r\n            face->ttf_data[count++] = string_buf[n];\r\n            continue;\r\n          }\r\n          else\r\n          {\r\n            int       i;\r\n            FT_ULong  len;\r\n\r\n\r\n            for ( i = 0; i < num_tables; i++ )\r\n            {\r\n              FT_Byte*  p = face->ttf_data + 12 + 16 * i + 12;\r\n\r\n\r\n              len = FT_PEEK_ULONG( p );\r\n\r\n              /* Pad to a 4-byte boundary length */\r\n              ttf_size += ( len + 3 ) & ~3;\r\n            }\r\n\r\n            status         = OTHER_TABLES;\r\n            face->ttf_size = ttf_size;\r\n\r\n            /* there are no more than 256 tables, so no size check here */\r\n            if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,\r\n                             ttf_size + 1 ) )\r\n              goto Fail;\r\n          }\r\n          /* fall through */\r\n\r\n        case OTHER_TABLES:\r\n          /* all other tables are just copied */\r\n          if ( count >= ttf_size )\r\n          {\r\n            FT_ERROR(( \"t42_parse_sfnts: too many binary data\\n\" ));\r\n            error = T42_Err_Invalid_File_Format;\r\n            goto Fail;\r\n          }\r\n          face->ttf_data[count++] = string_buf[n];\r\n        }\r\n      }\r\n\r\n      T1_Skip_Spaces( parser );\r\n    }\r\n\r\n    /* if control reaches this point, the format was not valid */\r\n    error = T42_Err_Invalid_File_Format;\r\n\r\n  Fail:\r\n    parser->root.error = error;\r\n\r\n  Exit:\r\n    if ( allocated )\r\n      FT_FREE( string_buf );\r\n  }\r\n\r\n\r\n  static void\r\n  t42_parse_charstrings( T42_Face    face,\r\n                         T42_Loader  loader )\r\n  {\r\n    T42_Parser     parser       = &loader->parser;\r\n    PS_Table       code_table   = &loader->charstrings;\r\n    PS_Table       name_table   = &loader->glyph_names;\r\n    PS_Table       swap_table   = &loader->swap_table;\r\n    FT_Memory      memory       = parser->root.memory;\r\n    FT_Error       error;\r\n\r\n    PSAux_Service  psaux        = (PSAux_Service)face->psaux;\r\n\r\n    FT_Byte*       cur;\r\n    FT_Byte*       limit        = parser->root.limit;\r\n    FT_UInt        n;\r\n    FT_UInt        notdef_index = 0;\r\n    FT_Byte        notdef_found = 0;\r\n\r\n\r\n    T1_Skip_Spaces( parser );\r\n\r\n    if ( parser->root.cursor >= limit )\r\n    {\r\n      FT_ERROR(( \"t42_parse_charstrings: out of bounds\\n\" ));\r\n      error = T42_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( ft_isdigit( *parser->root.cursor ) )\r\n    {\r\n      loader->num_glyphs = (FT_UInt)T1_ToInt( parser );\r\n      if ( parser->root.error )\r\n        return;\r\n    }\r\n    else if ( *parser->root.cursor == '<' )\r\n    {\r\n      /* We have `<< ... >>'.  Count the number of `/' in the dictionary */\r\n      /* to get its size.                                                */\r\n      FT_UInt  count = 0;\r\n\r\n\r\n      T1_Skip_PS_Token( parser );\r\n      if ( parser->root.error )\r\n        return;\r\n      T1_Skip_Spaces( parser );\r\n      cur = parser->root.cursor;\r\n\r\n      while ( parser->root.cursor < limit )\r\n      {\r\n        if ( *parser->root.cursor == '/' )\r\n          count++;\r\n        else if ( *parser->root.cursor == '>' )\r\n        {\r\n          loader->num_glyphs  = count;\r\n          parser->root.cursor = cur;        /* rewind */\r\n          break;\r\n        }\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          return;\r\n        T1_Skip_Spaces( parser );\r\n      }\r\n    }\r\n    else\r\n    {\r\n      FT_ERROR(( \"t42_parse_charstrings: invalid token\\n\" ));\r\n      error = T42_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    if ( parser->root.cursor >= limit )\r\n    {\r\n      FT_ERROR(( \"t42_parse_charstrings: out of bounds\\n\" ));\r\n      error = T42_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    /* initialize tables */\r\n\r\n    error = psaux->ps_table_funcs->init( code_table,\r\n                                         loader->num_glyphs,\r\n                                         memory );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    error = psaux->ps_table_funcs->init( name_table,\r\n                                         loader->num_glyphs,\r\n                                         memory );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    /* Initialize table for swapping index notdef_index and */\r\n    /* index 0 names and codes (if necessary).              */\r\n\r\n    error = psaux->ps_table_funcs->init( swap_table, 4, memory );\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    n = 0;\r\n\r\n    for (;;)\r\n    {\r\n      /* The format is simple:                   */\r\n      /*   `/glyphname' + index [+ def]          */\r\n\r\n      T1_Skip_Spaces( parser );\r\n\r\n      cur = parser->root.cursor;\r\n      if ( cur >= limit )\r\n        break;\r\n\r\n      /* We stop when we find an `end' keyword or '>' */\r\n      if ( *cur   == 'e'          &&\r\n           cur + 3 < limit        &&\r\n           cur[1] == 'n'          &&\r\n           cur[2] == 'd'          &&\r\n           t42_is_space( cur[3] ) )\r\n        break;\r\n      if ( *cur == '>' )\r\n        break;\r\n\r\n      T1_Skip_PS_Token( parser );\r\n      if ( parser->root.error )\r\n        return;\r\n\r\n      if ( *cur == '/' )\r\n      {\r\n        FT_PtrDist  len;\r\n\r\n\r\n        if ( cur + 1 >= limit )\r\n        {\r\n          FT_ERROR(( \"t42_parse_charstrings: out of bounds\\n\" ));\r\n          error = T42_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n\r\n        cur++;                              /* skip `/' */\r\n        len = parser->root.cursor - cur;\r\n\r\n        error = T1_Add_Table( name_table, n, cur, len + 1 );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        /* add a trailing zero to the name table */\r\n        name_table->elements[n][len] = '\\0';\r\n\r\n        /* record index of /.notdef */\r\n        if ( *cur == '.'                                              &&\r\n             ft_strcmp( \".notdef\",\r\n                        (const char*)(name_table->elements[n]) ) == 0 )\r\n        {\r\n          notdef_index = n;\r\n          notdef_found = 1;\r\n        }\r\n\r\n        T1_Skip_Spaces( parser );\r\n\r\n        cur = parser->root.cursor;\r\n\r\n        (void)T1_ToInt( parser );\r\n        if ( parser->root.cursor >= limit )\r\n        {\r\n          FT_ERROR(( \"t42_parse_charstrings: out of bounds\\n\" ));\r\n          error = T42_Err_Invalid_File_Format;\r\n          goto Fail;\r\n        }\r\n\r\n        len = parser->root.cursor - cur;\r\n\r\n        error = T1_Add_Table( code_table, n, cur, len + 1 );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        code_table->elements[n][len] = '\\0';\r\n\r\n        n++;\r\n        if ( n >= loader->num_glyphs )\r\n          break;\r\n      }\r\n    }\r\n\r\n    loader->num_glyphs = n;\r\n\r\n    if ( !notdef_found )\r\n    {\r\n      FT_ERROR(( \"t42_parse_charstrings: no /.notdef glyph\\n\" ));\r\n      error = T42_Err_Invalid_File_Format;\r\n      goto Fail;\r\n    }\r\n\r\n    /* if /.notdef does not occupy index 0, do our magic. */\r\n    if ( ft_strcmp( (const char*)\".notdef\",\r\n                    (const char*)name_table->elements[0] ) )\r\n    {\r\n      /* Swap glyph in index 0 with /.notdef glyph.  First, add index 0  */\r\n      /* name and code entries to swap_table.  Then place notdef_index   */\r\n      /* name and code entries into swap_table.  Then swap name and code */\r\n      /* entries at indices notdef_index and 0 using values stored in    */\r\n      /* swap_table.                                                     */\r\n\r\n      /* Index 0 name */\r\n      error = T1_Add_Table( swap_table, 0,\r\n                            name_table->elements[0],\r\n                            name_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Index 0 code */\r\n      error = T1_Add_Table( swap_table, 1,\r\n                            code_table->elements[0],\r\n                            code_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Index notdef_index name */\r\n      error = T1_Add_Table( swap_table, 2,\r\n                            name_table->elements[notdef_index],\r\n                            name_table->lengths [notdef_index] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      /* Index notdef_index code */\r\n      error = T1_Add_Table( swap_table, 3,\r\n                            code_table->elements[notdef_index],\r\n                            code_table->lengths [notdef_index] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( name_table, notdef_index,\r\n                            swap_table->elements[0],\r\n                            swap_table->lengths [0] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( code_table, notdef_index,\r\n                            swap_table->elements[1],\r\n                            swap_table->lengths [1] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( name_table, 0,\r\n                            swap_table->elements[2],\r\n                            swap_table->lengths [2] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n      error = T1_Add_Table( code_table, 0,\r\n                            swap_table->elements[3],\r\n                            swap_table->lengths [3] );\r\n      if ( error )\r\n        goto Fail;\r\n\r\n    }\r\n\r\n    return;\r\n\r\n  Fail:\r\n    parser->root.error = error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  t42_load_keyword( T42_Face    face,\r\n                    T42_Loader  loader,\r\n                    T1_Field    field )\r\n  {\r\n    FT_Error  error;\r\n    void*     dummy_object;\r\n    void**    objects;\r\n    FT_UInt   max_objects = 0;\r\n\r\n\r\n    /* if the keyword has a dedicated callback, call it */\r\n    if ( field->type == T1_FIELD_TYPE_CALLBACK )\r\n    {\r\n      field->reader( (FT_Face)face, loader );\r\n      error = loader->parser.root.error;\r\n      goto Exit;\r\n    }\r\n\r\n    /* now the keyword is either a simple field or a table of fields; */\r\n    /* we are now going to take care of it                            */\r\n\r\n    switch ( field->location )\r\n    {\r\n    case T1_FIELD_LOCATION_FONT_INFO:\r\n      dummy_object = &face->type1.font_info;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_FONT_EXTRA:\r\n      dummy_object = &face->type1.font_extra;\r\n      break;\r\n\r\n    case T1_FIELD_LOCATION_BBOX:\r\n      dummy_object = &face->type1.font_bbox;\r\n      break;\r\n\r\n    default:\r\n      dummy_object = &face->type1;\r\n    }\r\n\r\n    objects = &dummy_object;\r\n\r\n    if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||\r\n         field->type == T1_FIELD_TYPE_FIXED_ARRAY   )\r\n      error = T1_Load_Field_Table( &loader->parser, field,\r\n                                   objects, max_objects, 0 );\r\n    else\r\n      error = T1_Load_Field( &loader->parser, field,\r\n                             objects, max_objects, 0 );\r\n\r\n   Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( FT_Error )\r\n  t42_parse_dict( T42_Face    face,\r\n                  T42_Loader  loader,\r\n                  FT_Byte*    base,\r\n                  FT_Long     size )\r\n  {\r\n    T42_Parser  parser     = &loader->parser;\r\n    FT_Byte*    limit;\r\n    FT_Int      n_keywords = (FT_Int)( sizeof ( t42_keywords ) /\r\n                                         sizeof ( t42_keywords[0] ) );\r\n\r\n\r\n    parser->root.cursor = base;\r\n    parser->root.limit  = base + size;\r\n    parser->root.error  = T42_Err_Ok;\r\n\r\n    limit = parser->root.limit;\r\n\r\n    T1_Skip_Spaces( parser );\r\n\r\n    while ( parser->root.cursor < limit )\r\n    {\r\n      FT_Byte*  cur;\r\n\r\n\r\n      cur = parser->root.cursor;\r\n\r\n      /* look for `FontDirectory' which causes problems for some fonts */\r\n      if ( *cur == 'F' && cur + 25 < limit                    &&\r\n           ft_strncmp( (char*)cur, \"FontDirectory\", 13 ) == 0 )\r\n      {\r\n        FT_Byte*  cur2;\r\n\r\n\r\n        /* skip the `FontDirectory' keyword */\r\n        T1_Skip_PS_Token( parser );\r\n        T1_Skip_Spaces  ( parser );\r\n        cur = cur2 = parser->root.cursor;\r\n\r\n        /* look up the `known' keyword */\r\n        while ( cur < limit )\r\n        {\r\n          if ( *cur == 'k' && cur + 5 < limit             &&\r\n                ft_strncmp( (char*)cur, \"known\", 5 ) == 0 )\r\n            break;\r\n\r\n          T1_Skip_PS_Token( parser );\r\n          if ( parser->root.error )\r\n            goto Exit;\r\n          T1_Skip_Spaces  ( parser );\r\n          cur = parser->root.cursor;\r\n        }\r\n\r\n        if ( cur < limit )\r\n        {\r\n          T1_TokenRec  token;\r\n\r\n\r\n          /* skip the `known' keyword and the token following it */\r\n          T1_Skip_PS_Token( parser );\r\n          T1_ToToken( parser, &token );\r\n\r\n          /* if the last token was an array, skip it! */\r\n          if ( token.type == T1_TOKEN_TYPE_ARRAY )\r\n            cur2 = parser->root.cursor;\r\n        }\r\n        parser->root.cursor = cur2;\r\n      }\r\n\r\n      /* look for immediates */\r\n      else if ( *cur == '/' && cur + 2 < limit )\r\n      {\r\n        FT_PtrDist  len;\r\n\r\n\r\n        cur++;\r\n\r\n        parser->root.cursor = cur;\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          goto Exit;\r\n\r\n        len = parser->root.cursor - cur;\r\n\r\n        if ( len > 0 && len < 22 && parser->root.cursor < limit )\r\n        {\r\n          int  i;\r\n\r\n\r\n          /* now compare the immediate name to the keyword table */\r\n\r\n          /* loop through all known keywords */\r\n          for ( i = 0; i < n_keywords; i++ )\r\n          {\r\n            T1_Field  keyword = (T1_Field)&t42_keywords[i];\r\n            FT_Byte   *name   = (FT_Byte*)keyword->ident;\r\n\r\n\r\n            if ( !name )\r\n              continue;\r\n\r\n            if ( cur[0] == name[0]                                  &&\r\n                 len == (FT_PtrDist)ft_strlen( (const char *)name ) &&\r\n                 ft_memcmp( cur, name, len ) == 0                   )\r\n            {\r\n              /* we found it -- run the parsing callback! */\r\n              parser->root.error = t42_load_keyword( face,\r\n                                                     loader,\r\n                                                     keyword );\r\n              if ( parser->root.error )\r\n                return parser->root.error;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n      else\r\n      {\r\n        T1_Skip_PS_Token( parser );\r\n        if ( parser->root.error )\r\n          goto Exit;\r\n      }\r\n\r\n      T1_Skip_Spaces( parser );\r\n    }\r\n\r\n  Exit:\r\n    return parser->root.error;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  t42_loader_init( T42_Loader  loader,\r\n                   T42_Face    face )\r\n  {\r\n    FT_UNUSED( face );\r\n\r\n    FT_MEM_ZERO( loader, sizeof ( *loader ) );\r\n    loader->num_glyphs = 0;\r\n    loader->num_chars  = 0;\r\n\r\n    /* initialize the tables -- simply set their `init' field to 0 */\r\n    loader->encoding_table.init = 0;\r\n    loader->charstrings.init    = 0;\r\n    loader->glyph_names.init    = 0;\r\n  }\r\n\r\n\r\n  FT_LOCAL_DEF( void )\r\n  t42_loader_done( T42_Loader  loader )\r\n  {\r\n    T42_Parser  parser = &loader->parser;\r\n\r\n\r\n    /* finalize tables */\r\n    T1_Release_Table( &loader->encoding_table );\r\n    T1_Release_Table( &loader->charstrings );\r\n    T1_Release_Table( &loader->glyph_names );\r\n    T1_Release_Table( &loader->swap_table );\r\n\r\n    /* finalize parser */\r\n    t42_parser_done( parser );\r\n  }\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42parse.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42parse.h                                                             */\r\n/*                                                                         */\r\n/*    Type 42 font parser (specification).                                 */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003 by Roberto Alameda.                               */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T42PARSE_H__\r\n#define __T42PARSE_H__\r\n\r\n\r\n#include \"t42objs.h\"\r\n#include FT_INTERNAL_POSTSCRIPT_AUX_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  typedef struct  T42_ParserRec_\r\n  {\r\n    PS_ParserRec  root;\r\n    FT_Stream     stream;\r\n\r\n    FT_Byte*      base_dict;\r\n    FT_Long       base_len;\r\n\r\n    FT_Bool       in_memory;\r\n\r\n  } T42_ParserRec, *T42_Parser;\r\n\r\n\r\n  typedef struct  T42_Loader_\r\n  {\r\n    T42_ParserRec  parser;          /* parser used to read the stream */\r\n\r\n    FT_UInt        num_chars;       /* number of characters in encoding */\r\n    PS_TableRec    encoding_table;  /* PS_Table used to store the       */\r\n                                    /* encoding character names         */\r\n\r\n    FT_UInt        num_glyphs;\r\n    PS_TableRec    glyph_names;\r\n    PS_TableRec    charstrings;\r\n    PS_TableRec    swap_table;      /* For moving .notdef glyph to index 0. */\r\n\r\n  } T42_LoaderRec, *T42_Loader;\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t42_parser_init( T42_Parser     parser,\r\n                   FT_Stream      stream,\r\n                   FT_Memory      memory,\r\n                   PSAux_Service  psaux );\r\n\r\n  FT_LOCAL( void )\r\n  t42_parser_done( T42_Parser  parser );\r\n\r\n\r\n  FT_LOCAL( FT_Error )\r\n  t42_parse_dict( T42_Face    face,\r\n                  T42_Loader  loader,\r\n                  FT_Byte*    base,\r\n                  FT_Long     size );\r\n\r\n\r\n  FT_LOCAL( void )\r\n  t42_loader_init( T42_Loader  loader,\r\n                   T42_Face    face );\r\n\r\n  FT_LOCAL( void )\r\n  t42_loader_done( T42_Loader  loader );\r\n\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __T42PARSE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/t42types.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t42types.h                                                             */\r\n/*                                                                         */\r\n/*    Type 42 font data types (specification only).                        */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006, 2008 by Roberto Alameda.                   */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T42TYPES_H__\r\n#define __T42TYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TYPE1_TABLES_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef struct  T42_FaceRec_\r\n  {\r\n    FT_FaceRec      root;\r\n    T1_FontRec      type1;\r\n    const void*     psnames;\r\n    const void*     psaux;\r\n#if 0\r\n    const void*     afm_data;\r\n#endif\r\n    FT_Byte*        ttf_data;\r\n    FT_ULong        ttf_size;\r\n    FT_Face         ttf_face;\r\n    FT_CharMapRec   charmaprecs[2];\r\n    FT_CharMap      charmaps[2];\r\n    PS_UnicodesRec  unicode_map;\r\n\r\n  } T42_FaceRec, *T42_Face;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T42TYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/type42/type42.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  type42.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType Type 42 driver component.                                   */\r\n/*                                                                         */\r\n/*  Copyright 2002 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#define FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#include <ft2build.h>\r\n#include \"t42objs.c\"\r\n#include \"t42parse.c\"\r\n#include \"t42drivr.c\"\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/winfonts/Jamfile",
    "content": "# FreeType 2 src/winfonts Jamfile\r\n#\r\n# Copyright 2001 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\nSubDir  FT2_TOP $(FT2_SRC_DIR) winfonts ;\r\n\r\nLibrary  $(FT2_LIB) : winfnt.c ;\r\n\r\n# end of src/winfonts Jamfile\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/winfonts/fnterrs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fnterrs.h                                                              */\r\n/*                                                                         */\r\n/*    Win FNT/FON error codes (specification only).                        */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2012 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the Windows FNT/FON error enumeration     */\r\n  /* constants.                                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __FNTERRS_H__\r\n#define __FNTERRS_H__\r\n\r\n#include FT_MODULE_ERRORS_H\r\n\r\n#undef __FTERRORS_H__\r\n\r\n#undef  FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  FNT_Err_\r\n#define FT_ERR_BASE    FT_Mod_Err_Winfonts\r\n\r\n#include FT_ERRORS_H\r\n\r\n#endif /* __FNTERRS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/winfonts/module.mk",
    "content": "#\r\n# FreeType 2 Windows FNT/FON module definition\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2006 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\nFTMODULE_H_COMMANDS += WINDOWS_DRIVER\r\n\r\ndefine WINDOWS_DRIVER\r\n$(OPEN_DRIVER) FT_Driver_ClassRec, winfnt_driver_class $(CLOSE_DRIVER)\r\n$(ECHO_DRIVER)winfnt    $(ECHO_DRIVER_DESC)Windows bitmap fonts with extension *.fnt or *.fon$(ECHO_DRIVER_DONE)\r\nendef\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/winfonts/rules.mk",
    "content": "#\r\n# FreeType 2 Windows FNT/FON driver configuration rules\r\n#\r\n\r\n\r\n# Copyright 1996-2000, 2001, 2003 by\r\n# David Turner, Robert Wilhelm, and Werner Lemberg.\r\n#\r\n# This file is part of the FreeType project, and may only be used, modified,\r\n# and distributed under the terms of the FreeType project license,\r\n# LICENSE.TXT.  By continuing to use, modify, or distribute this file you\r\n# indicate that you have read the license and understand and accept it\r\n# fully.\r\n\r\n\r\n# Windows driver directory\r\n#\r\nFNT_DIR := $(SRC_DIR)/winfonts\r\n\r\n\r\nFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(FNT_DIR))\r\n\r\n\r\n# Windows driver sources (i.e., C files)\r\n#\r\nFNT_DRV_SRC := $(FNT_DIR)/winfnt.c\r\n\r\n# Windows driver headers\r\n#\r\nFNT_DRV_H := $(FNT_DRV_SRC:%.c=%.h) \\\r\n             $(FNT_DIR)/fnterrs.h\r\n\r\n\r\n# Windows driver object(s)\r\n#\r\n#   FNT_DRV_OBJ_M is used during `multi' builds\r\n#   FNT_DRV_OBJ_S is used during `single' builds\r\n#\r\nFNT_DRV_OBJ_M := $(FNT_DRV_SRC:$(FNT_DIR)/%.c=$(OBJ_DIR)/%.$O)\r\nFNT_DRV_OBJ_S := $(OBJ_DIR)/winfnt.$O\r\n\r\n# Windows driver source file for single build\r\n#\r\nFNT_DRV_SRC_S := $(FNT_DIR)/winfnt.c\r\n\r\n\r\n# Windows driver - single object\r\n#\r\n$(FNT_DRV_OBJ_S): $(FNT_DRV_SRC_S) $(FNT_DRV_SRC) $(FREETYPE_H) $(FNT_DRV_H)\r\n\t$(FNT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(FNT_DRV_SRC_S))\r\n\r\n\r\n# Windows driver - multiple objects\r\n#\r\n$(OBJ_DIR)/%.$O: $(FNT_DIR)/%.c $(FREETYPE_H) $(FNT_DRV_H)\r\n\t$(FNT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)\r\n\r\n\r\n# update main driver object lists\r\n#\r\nDRV_OBJS_S += $(FNT_DRV_OBJ_S)\r\nDRV_OBJS_M += $(FNT_DRV_OBJ_M)\r\n\r\n\r\n# EOF\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/winfonts/winfnt.c",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  winfnt.c                                                               */\r\n/*                                                                         */\r\n/*    FreeType font driver for Windows FNT/FON files                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2004, 2006-2012 by                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*  Copyright 2003 Huw D M Davies for Codeweavers                          */\r\n/*  Copyright 2007 Dmitry Timoshkov for Codeweavers                        */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_WINFONTS_H\r\n#include FT_INTERNAL_DEBUG_H\r\n#include FT_INTERNAL_STREAM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_TRUETYPE_IDS_H\r\n\r\n#include \"winfnt.h\"\r\n#include \"fnterrs.h\"\r\n#include FT_SERVICE_WINFNT_H\r\n#include FT_SERVICE_XFREE86_NAME_H\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */\r\n  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */\r\n  /* messages during execution.                                            */\r\n  /*                                                                       */\r\n#undef  FT_COMPONENT\r\n#define FT_COMPONENT  trace_winfnt\r\n\r\n\r\n  static const FT_Frame_Field  winmz_header_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinMZ_HeaderRec\r\n\r\n    FT_FRAME_START( 64 ),\r\n      FT_FRAME_USHORT_LE ( magic ),\r\n      FT_FRAME_SKIP_BYTES( 29 * 2 ),\r\n      FT_FRAME_ULONG_LE  ( lfanew ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winne_header_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinNE_HeaderRec\r\n\r\n    FT_FRAME_START( 40 ),\r\n      FT_FRAME_USHORT_LE ( magic ),\r\n      FT_FRAME_SKIP_BYTES( 34 ),\r\n      FT_FRAME_USHORT_LE ( resource_tab_offset ),\r\n      FT_FRAME_USHORT_LE ( rname_tab_offset ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winpe32_header_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinPE32_HeaderRec\r\n\r\n    FT_FRAME_START( 248 ),\r\n      FT_FRAME_ULONG_LE  ( magic ),   /* PE00 */\r\n      FT_FRAME_USHORT_LE ( machine ), /* 0x014c - i386 */\r\n      FT_FRAME_USHORT_LE ( number_of_sections ),\r\n      FT_FRAME_SKIP_BYTES( 12 ),\r\n      FT_FRAME_USHORT_LE ( size_of_optional_header ),\r\n      FT_FRAME_SKIP_BYTES( 2 ),\r\n      FT_FRAME_USHORT_LE ( magic32 ), /* 0x10b */\r\n      FT_FRAME_SKIP_BYTES( 110 ),\r\n      FT_FRAME_ULONG_LE  ( rsrc_virtual_address ),\r\n      FT_FRAME_ULONG_LE  ( rsrc_size ),\r\n      FT_FRAME_SKIP_BYTES( 104 ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winpe32_section_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinPE32_SectionRec\r\n\r\n    FT_FRAME_START( 40 ),\r\n      FT_FRAME_BYTES     ( name, 8 ),\r\n      FT_FRAME_SKIP_BYTES( 4 ),\r\n      FT_FRAME_ULONG_LE  ( virtual_address ),\r\n      FT_FRAME_ULONG_LE  ( size_of_raw_data ),\r\n      FT_FRAME_ULONG_LE  ( pointer_to_raw_data ),\r\n      FT_FRAME_SKIP_BYTES( 16 ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winpe_rsrc_dir_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinPE_RsrcDirRec\r\n\r\n    FT_FRAME_START( 16 ),\r\n      FT_FRAME_ULONG_LE ( characteristics ),\r\n      FT_FRAME_ULONG_LE ( time_date_stamp ),\r\n      FT_FRAME_USHORT_LE( major_version ),\r\n      FT_FRAME_USHORT_LE( minor_version ),\r\n      FT_FRAME_USHORT_LE( number_of_named_entries ),\r\n      FT_FRAME_USHORT_LE( number_of_id_entries ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winpe_rsrc_dir_entry_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinPE_RsrcDirEntryRec\r\n\r\n    FT_FRAME_START( 8 ),\r\n      FT_FRAME_ULONG_LE( name ),\r\n      FT_FRAME_ULONG_LE( offset ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winpe_rsrc_data_entry_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  WinPE_RsrcDataEntryRec\r\n\r\n    FT_FRAME_START( 16 ),\r\n      FT_FRAME_ULONG_LE( offset_to_data ),\r\n      FT_FRAME_ULONG_LE( size ),\r\n      FT_FRAME_ULONG_LE( code_page ),\r\n      FT_FRAME_ULONG_LE( reserved ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n  static const FT_Frame_Field  winfnt_header_fields[] =\r\n  {\r\n#undef  FT_STRUCTURE\r\n#define FT_STRUCTURE  FT_WinFNT_HeaderRec\r\n\r\n    FT_FRAME_START( 148 ),\r\n      FT_FRAME_USHORT_LE( version ),\r\n      FT_FRAME_ULONG_LE ( file_size ),\r\n      FT_FRAME_BYTES    ( copyright, 60 ),\r\n      FT_FRAME_USHORT_LE( file_type ),\r\n      FT_FRAME_USHORT_LE( nominal_point_size ),\r\n      FT_FRAME_USHORT_LE( vertical_resolution ),\r\n      FT_FRAME_USHORT_LE( horizontal_resolution ),\r\n      FT_FRAME_USHORT_LE( ascent ),\r\n      FT_FRAME_USHORT_LE( internal_leading ),\r\n      FT_FRAME_USHORT_LE( external_leading ),\r\n      FT_FRAME_BYTE     ( italic ),\r\n      FT_FRAME_BYTE     ( underline ),\r\n      FT_FRAME_BYTE     ( strike_out ),\r\n      FT_FRAME_USHORT_LE( weight ),\r\n      FT_FRAME_BYTE     ( charset ),\r\n      FT_FRAME_USHORT_LE( pixel_width ),\r\n      FT_FRAME_USHORT_LE( pixel_height ),\r\n      FT_FRAME_BYTE     ( pitch_and_family ),\r\n      FT_FRAME_USHORT_LE( avg_width ),\r\n      FT_FRAME_USHORT_LE( max_width ),\r\n      FT_FRAME_BYTE     ( first_char ),\r\n      FT_FRAME_BYTE     ( last_char ),\r\n      FT_FRAME_BYTE     ( default_char ),\r\n      FT_FRAME_BYTE     ( break_char ),\r\n      FT_FRAME_USHORT_LE( bytes_per_row ),\r\n      FT_FRAME_ULONG_LE ( device_offset ),\r\n      FT_FRAME_ULONG_LE ( face_name_offset ),\r\n      FT_FRAME_ULONG_LE ( bits_pointer ),\r\n      FT_FRAME_ULONG_LE ( bits_offset ),\r\n      FT_FRAME_BYTE     ( reserved ),\r\n      FT_FRAME_ULONG_LE ( flags ),\r\n      FT_FRAME_USHORT_LE( A_space ),\r\n      FT_FRAME_USHORT_LE( B_space ),\r\n      FT_FRAME_USHORT_LE( C_space ),\r\n      FT_FRAME_ULONG_LE ( color_table_offset ),\r\n      FT_FRAME_BYTES    ( reserved1, 16 ),\r\n    FT_FRAME_END\r\n  };\r\n\r\n\r\n  static void\r\n  fnt_font_done( FNT_Face face )\r\n  {\r\n    FT_Memory  memory = FT_FACE( face )->memory;\r\n    FT_Stream  stream = FT_FACE( face )->stream;\r\n    FNT_Font   font   = face->font;\r\n\r\n\r\n    if ( !font )\r\n      return;\r\n\r\n    if ( font->fnt_frame )\r\n      FT_FRAME_RELEASE( font->fnt_frame );\r\n    FT_FREE( font->family_name );\r\n\r\n    FT_FREE( font );\r\n    face->font = 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  fnt_font_load( FNT_Font   font,\r\n                 FT_Stream  stream )\r\n  {\r\n    FT_Error          error;\r\n    FT_WinFNT_Header  header = &font->header;\r\n    FT_Bool           new_format;\r\n    FT_UInt           size;\r\n\r\n\r\n    /* first of all, read the FNT header */\r\n    if ( FT_STREAM_SEEK( font->offset )                        ||\r\n         FT_STREAM_READ_FIELDS( winfnt_header_fields, header ) )\r\n      goto Exit;\r\n\r\n    /* check header */\r\n    if ( header->version != 0x200 &&\r\n         header->version != 0x300 )\r\n    {\r\n      FT_TRACE2(( \"  not a Windows FNT file\\n\" ));\r\n      error = FNT_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    new_format = FT_BOOL( font->header.version == 0x300 );\r\n    size       = new_format ? 148 : 118;\r\n\r\n    if ( header->file_size < size )\r\n    {\r\n      FT_TRACE2(( \"  not a Windows FNT file\\n\" ));\r\n      error = FNT_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* Version 2 doesn't have these fields */\r\n    if ( header->version == 0x200 )\r\n    {\r\n      header->flags   = 0;\r\n      header->A_space = 0;\r\n      header->B_space = 0;\r\n      header->C_space = 0;\r\n\r\n      header->color_table_offset = 0;\r\n    }\r\n\r\n    if ( header->file_type & 1 )\r\n    {\r\n      FT_TRACE2(( \"[can't handle vector FNT fonts]\\n\" ));\r\n      error = FNT_Err_Unknown_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* this is a FNT file/table; extract its frame */\r\n    if ( FT_STREAM_SEEK( font->offset )                         ||\r\n         FT_FRAME_EXTRACT( header->file_size, font->fnt_frame ) )\r\n      goto Exit;\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  fnt_face_get_dll_font( FNT_Face  face,\r\n                         FT_Int    face_index )\r\n  {\r\n    FT_Error         error;\r\n    FT_Stream        stream = FT_FACE( face )->stream;\r\n    FT_Memory        memory = FT_FACE( face )->memory;\r\n    WinMZ_HeaderRec  mz_header;\r\n\r\n\r\n    face->font = 0;\r\n\r\n    /* does it begin with an MZ header? */\r\n    if ( FT_STREAM_SEEK( 0 )                                      ||\r\n         FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) )\r\n      goto Exit;\r\n\r\n    error = FNT_Err_Unknown_File_Format;\r\n    if ( mz_header.magic == WINFNT_MZ_MAGIC )\r\n    {\r\n      /* yes, now look for an NE header in the file */\r\n      WinNE_HeaderRec  ne_header;\r\n\r\n\r\n      FT_TRACE2(( \"MZ signature found\\n\" ));\r\n\r\n      if ( FT_STREAM_SEEK( mz_header.lfanew )                       ||\r\n           FT_STREAM_READ_FIELDS( winne_header_fields, &ne_header ) )\r\n        goto Exit;\r\n\r\n      error = FNT_Err_Unknown_File_Format;\r\n      if ( ne_header.magic == WINFNT_NE_MAGIC )\r\n      {\r\n        /* good, now look into the resource table for each FNT resource */\r\n        FT_ULong   res_offset  = mz_header.lfanew +\r\n                                   ne_header.resource_tab_offset;\r\n        FT_UShort  size_shift;\r\n        FT_UShort  font_count  = 0;\r\n        FT_ULong   font_offset = 0;\r\n\r\n\r\n        FT_TRACE2(( \"NE signature found\\n\" ));\r\n\r\n        if ( FT_STREAM_SEEK( res_offset )                    ||\r\n             FT_FRAME_ENTER( ne_header.rname_tab_offset -\r\n                             ne_header.resource_tab_offset ) )\r\n          goto Exit;\r\n\r\n        size_shift = FT_GET_USHORT_LE();\r\n\r\n        for (;;)\r\n        {\r\n          FT_UShort  type_id, count;\r\n\r\n\r\n          type_id = FT_GET_USHORT_LE();\r\n          if ( !type_id )\r\n            break;\r\n\r\n          count = FT_GET_USHORT_LE();\r\n\r\n          if ( type_id == 0x8008U )\r\n          {\r\n            font_count  = count;\r\n            font_offset = (FT_ULong)( FT_STREAM_POS() + 4 +\r\n                                      ( stream->cursor - stream->limit ) );\r\n            break;\r\n          }\r\n\r\n          stream->cursor += 4 + count * 12;\r\n        }\r\n\r\n        FT_FRAME_EXIT();\r\n\r\n        if ( !font_count || !font_offset )\r\n        {\r\n          FT_TRACE2(( \"this file doesn't contain any FNT resources\\n\" ));\r\n          error = FNT_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        /* loading `winfnt_header_fields' needs at least 118 bytes;    */\r\n        /* use this as a rough measure to check the expected font size */\r\n        if ( font_count * 118UL > stream->size )\r\n        {\r\n          FT_TRACE2(( \"invalid number of faces\\n\" ));\r\n          error = FNT_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        face->root.num_faces = font_count;\r\n\r\n        if ( face_index >= font_count )\r\n        {\r\n          error = FNT_Err_Invalid_Argument;\r\n          goto Exit;\r\n        }\r\n        else if ( face_index < 0 )\r\n          goto Exit;\r\n\r\n        if ( FT_NEW( face->font ) )\r\n          goto Exit;\r\n\r\n        if ( FT_STREAM_SEEK( font_offset + face_index * 12 ) ||\r\n             FT_FRAME_ENTER( 12 )                            )\r\n          goto Fail;\r\n\r\n        face->font->offset   = (FT_ULong)FT_GET_USHORT_LE() << size_shift;\r\n        face->font->fnt_size = (FT_ULong)FT_GET_USHORT_LE() << size_shift;\r\n\r\n        stream->cursor += 8;\r\n\r\n        FT_FRAME_EXIT();\r\n\r\n        error = fnt_font_load( face->font, stream );\r\n      }\r\n      else if ( ne_header.magic == WINFNT_PE_MAGIC )\r\n      {\r\n        WinPE32_HeaderRec       pe32_header;\r\n        WinPE32_SectionRec      pe32_section;\r\n        WinPE_RsrcDirRec        root_dir, name_dir, lang_dir;\r\n        WinPE_RsrcDirEntryRec   dir_entry1, dir_entry2, dir_entry3;\r\n        WinPE_RsrcDataEntryRec  data_entry;\r\n\r\n        FT_Long    root_dir_offset, name_dir_offset, lang_dir_offset;\r\n        FT_UShort  i, j, k;\r\n\r\n\r\n        FT_TRACE2(( \"PE signature found\\n\" ));\r\n\r\n        if ( FT_STREAM_SEEK( mz_header.lfanew )                           ||\r\n             FT_STREAM_READ_FIELDS( winpe32_header_fields, &pe32_header ) )\r\n          goto Exit;\r\n\r\n        FT_TRACE2(( \"magic %04lx, machine %02x, number_of_sections %u, \"\r\n                    \"size_of_optional_header %02x\\n\"\r\n                    \"magic32 %02x, rsrc_virtual_address %04lx, \"\r\n                    \"rsrc_size %04lx\\n\",\r\n                    pe32_header.magic, pe32_header.machine,\r\n                    pe32_header.number_of_sections,\r\n                    pe32_header.size_of_optional_header,\r\n                    pe32_header.magic32, pe32_header.rsrc_virtual_address,\r\n                    pe32_header.rsrc_size ));\r\n\r\n        if ( pe32_header.magic != WINFNT_PE_MAGIC /* check full signature */ ||\r\n             pe32_header.machine != 0x014c /* i386 */                        ||\r\n             pe32_header.size_of_optional_header != 0xe0 /* FIXME */         ||\r\n             pe32_header.magic32 != 0x10b                                    )\r\n        {\r\n          FT_TRACE2(( \"this file has an invalid PE header\\n\" ));\r\n          error = FNT_Err_Invalid_File_Format;\r\n          goto Exit;\r\n        }\r\n\r\n        face->root.num_faces = 0;\r\n\r\n        for ( i = 0; i < pe32_header.number_of_sections; i++ )\r\n        {\r\n          if ( FT_STREAM_READ_FIELDS( winpe32_section_fields,\r\n                                      &pe32_section ) )\r\n            goto Exit;\r\n\r\n          FT_TRACE2(( \"name %.8s, va %04lx, size %04lx, offset %04lx\\n\",\r\n                      pe32_section.name, pe32_section.virtual_address,\r\n                      pe32_section.size_of_raw_data,\r\n                      pe32_section.pointer_to_raw_data ));\r\n\r\n          if ( pe32_header.rsrc_virtual_address ==\r\n                 pe32_section.virtual_address )\r\n            goto Found_rsrc_section;\r\n        }\r\n\r\n        FT_TRACE2(( \"this file doesn't contain any resources\\n\" ));\r\n        error = FNT_Err_Invalid_File_Format;\r\n        goto Exit;\r\n\r\n      Found_rsrc_section:\r\n        FT_TRACE2(( \"found resources section %.8s\\n\", pe32_section.name ));\r\n\r\n        if ( FT_STREAM_SEEK( pe32_section.pointer_to_raw_data )        ||\r\n             FT_STREAM_READ_FIELDS( winpe_rsrc_dir_fields, &root_dir ) )\r\n          goto Exit;\r\n\r\n        root_dir_offset = pe32_section.pointer_to_raw_data;\r\n\r\n        for ( i = 0; i < root_dir.number_of_named_entries +\r\n                           root_dir.number_of_id_entries; i++ )\r\n        {\r\n          if ( FT_STREAM_SEEK( root_dir_offset + 16 + i * 8 )      ||\r\n               FT_STREAM_READ_FIELDS( winpe_rsrc_dir_entry_fields,\r\n                                      &dir_entry1 )                )\r\n            goto Exit;\r\n\r\n          if ( !(dir_entry1.offset & 0x80000000UL ) /* DataIsDirectory */ )\r\n          {\r\n            error = FNT_Err_Invalid_File_Format;\r\n            goto Exit;\r\n          }\r\n\r\n          dir_entry1.offset &= ~0x80000000UL;\r\n\r\n          name_dir_offset = pe32_section.pointer_to_raw_data +\r\n                            dir_entry1.offset;\r\n\r\n          if ( FT_STREAM_SEEK( pe32_section.pointer_to_raw_data +\r\n                               dir_entry1.offset )                       ||\r\n               FT_STREAM_READ_FIELDS( winpe_rsrc_dir_fields, &name_dir ) )\r\n            goto Exit;\r\n\r\n          for ( j = 0; j < name_dir.number_of_named_entries +\r\n                             name_dir.number_of_id_entries; j++ )\r\n          {\r\n            if ( FT_STREAM_SEEK( name_dir_offset + 16 + j * 8 )      ||\r\n                 FT_STREAM_READ_FIELDS( winpe_rsrc_dir_entry_fields,\r\n                                        &dir_entry2 )                )\r\n              goto Exit;\r\n\r\n            if ( !(dir_entry2.offset & 0x80000000UL ) /* DataIsDirectory */ )\r\n            {\r\n              error = FNT_Err_Invalid_File_Format;\r\n              goto Exit;\r\n            }\r\n\r\n            dir_entry2.offset &= ~0x80000000UL;\r\n\r\n            lang_dir_offset = pe32_section.pointer_to_raw_data +\r\n                                dir_entry2.offset;\r\n\r\n            if ( FT_STREAM_SEEK( pe32_section.pointer_to_raw_data +\r\n                                   dir_entry2.offset )                     ||\r\n                 FT_STREAM_READ_FIELDS( winpe_rsrc_dir_fields, &lang_dir ) )\r\n              goto Exit;\r\n\r\n            for ( k = 0; k < lang_dir.number_of_named_entries +\r\n                               lang_dir.number_of_id_entries; k++ )\r\n            {\r\n              if ( FT_STREAM_SEEK( lang_dir_offset + 16 + k * 8 )      ||\r\n                   FT_STREAM_READ_FIELDS( winpe_rsrc_dir_entry_fields,\r\n                                          &dir_entry3 )                )\r\n                goto Exit;\r\n\r\n              if ( dir_entry2.offset & 0x80000000UL /* DataIsDirectory */ )\r\n              {\r\n                error = FNT_Err_Invalid_File_Format;\r\n                goto Exit;\r\n              }\r\n\r\n              if ( dir_entry1.name == 8 /* RT_FONT */ )\r\n              {\r\n                if ( FT_STREAM_SEEK( root_dir_offset + dir_entry3.offset ) ||\r\n                     FT_STREAM_READ_FIELDS( winpe_rsrc_data_entry_fields,\r\n                                            &data_entry )                  )\r\n                  goto Exit;\r\n\r\n                FT_TRACE2(( \"found font #%lu, offset %04lx, \"\r\n                            \"size %04lx, cp %lu\\n\",\r\n                            dir_entry2.name,\r\n                            pe32_section.pointer_to_raw_data +\r\n                              data_entry.offset_to_data -\r\n                              pe32_section.virtual_address,\r\n                            data_entry.size, data_entry.code_page ));\r\n\r\n                if ( face_index == face->root.num_faces )\r\n                {\r\n                  if ( FT_NEW( face->font ) )\r\n                    goto Exit;\r\n\r\n                  face->font->offset   = pe32_section.pointer_to_raw_data +\r\n                                           data_entry.offset_to_data -\r\n                                           pe32_section.virtual_address;\r\n                  face->font->fnt_size = data_entry.size;\r\n\r\n                  error = fnt_font_load( face->font, stream );\r\n                  if ( error )\r\n                  {\r\n                    FT_TRACE2(( \"font #%lu load error %d\\n\",\r\n                                dir_entry2.name, error ));\r\n                    goto Fail;\r\n                  }\r\n                  else\r\n                    FT_TRACE2(( \"font #%lu successfully loaded\\n\",\r\n                                dir_entry2.name ));\r\n                }\r\n\r\n                face->root.num_faces++;\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      if ( !face->root.num_faces )\r\n      {\r\n        FT_TRACE2(( \"this file doesn't contain any RT_FONT resources\\n\" ));\r\n        error = FNT_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      if ( face_index >= face->root.num_faces )\r\n      {\r\n        error = FNT_Err_Invalid_Argument;\r\n        goto Exit;\r\n      }\r\n    }\r\n\r\n  Fail:\r\n    if ( error )\r\n      fnt_font_done( face );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  typedef struct  FNT_CMapRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_UInt32   first;\r\n    FT_UInt32   count;\r\n\r\n  } FNT_CMapRec, *FNT_CMap;\r\n\r\n\r\n  static FT_Error\r\n  fnt_cmap_init( FNT_CMap  cmap )\r\n  {\r\n    FNT_Face  face = (FNT_Face)FT_CMAP_FACE( cmap );\r\n    FNT_Font  font = face->font;\r\n\r\n\r\n    cmap->first = (FT_UInt32)  font->header.first_char;\r\n    cmap->count = (FT_UInt32)( font->header.last_char - cmap->first + 1 );\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static FT_UInt\r\n  fnt_cmap_char_index( FNT_CMap   cmap,\r\n                       FT_UInt32  char_code )\r\n  {\r\n    FT_UInt  gindex = 0;\r\n\r\n\r\n    char_code -= cmap->first;\r\n    if ( char_code < cmap->count )\r\n      /* we artificially increase the glyph index; */\r\n      /* FNT_Load_Glyph reverts to the right one   */\r\n      gindex = (FT_UInt)( char_code + 1 );\r\n    return gindex;\r\n  }\r\n\r\n\r\n  static FT_UInt32\r\n  fnt_cmap_char_next( FNT_CMap    cmap,\r\n                      FT_UInt32  *pchar_code )\r\n  {\r\n    FT_UInt    gindex = 0;\r\n    FT_UInt32  result = 0;\r\n    FT_UInt32  char_code = *pchar_code + 1;\r\n\r\n\r\n    if ( char_code <= cmap->first )\r\n    {\r\n      result = cmap->first;\r\n      gindex = 1;\r\n    }\r\n    else\r\n    {\r\n      char_code -= cmap->first;\r\n      if ( char_code < cmap->count )\r\n      {\r\n        result = cmap->first + char_code;\r\n        gindex = (FT_UInt)( char_code + 1 );\r\n      }\r\n    }\r\n\r\n    *pchar_code = result;\r\n    return gindex;\r\n  }\r\n\r\n\r\n  static const FT_CMap_ClassRec  fnt_cmap_class_rec =\r\n  {\r\n    sizeof ( FNT_CMapRec ),\r\n\r\n    (FT_CMap_InitFunc)     fnt_cmap_init,\r\n    (FT_CMap_DoneFunc)     NULL,\r\n    (FT_CMap_CharIndexFunc)fnt_cmap_char_index,\r\n    (FT_CMap_CharNextFunc) fnt_cmap_char_next,\r\n\r\n    NULL, NULL, NULL, NULL, NULL\r\n  };\r\n\r\n  static FT_CMap_Class const  fnt_cmap_class = &fnt_cmap_class_rec;\r\n\r\n\r\n  static void\r\n  FNT_Face_Done( FT_Face  fntface )       /* FNT_Face */\r\n  {\r\n    FNT_Face   face = (FNT_Face)fntface;\r\n    FT_Memory  memory;\r\n\r\n\r\n    if ( !face )\r\n      return;\r\n\r\n    memory = FT_FACE_MEMORY( face );\r\n\r\n    fnt_font_done( face );\r\n\r\n    FT_FREE( fntface->available_sizes );\r\n    fntface->num_fixed_sizes = 0;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  FNT_Face_Init( FT_Stream      stream,\r\n                 FT_Face        fntface,        /* FNT_Face */\r\n                 FT_Int         face_index,\r\n                 FT_Int         num_params,\r\n                 FT_Parameter*  params )\r\n  {\r\n    FNT_Face   face   = (FNT_Face)fntface;\r\n    FT_Error   error;\r\n    FT_Memory  memory = FT_FACE_MEMORY( face );\r\n\r\n    FT_UNUSED( num_params );\r\n    FT_UNUSED( params );\r\n\r\n\r\n    FT_TRACE2(( \"Windows FNT driver\\n\" ));\r\n\r\n    /* try to load font from a DLL */\r\n    error = fnt_face_get_dll_font( face, face_index );\r\n    if ( !error && face_index < 0 )\r\n      goto Exit;\r\n\r\n    if ( error == FNT_Err_Unknown_File_Format )\r\n    {\r\n      /* this didn't work; try to load a single FNT font */\r\n      FNT_Font  font;\r\n\r\n      if ( FT_NEW( face->font ) )\r\n        goto Exit;\r\n\r\n      fntface->num_faces = 1;\r\n\r\n      font           = face->font;\r\n      font->offset   = 0;\r\n      font->fnt_size = stream->size;\r\n\r\n      error = fnt_font_load( font, stream );\r\n\r\n      if ( !error )\r\n      {\r\n        if ( face_index > 0 )\r\n          error = FNT_Err_Invalid_Argument;\r\n        else if ( face_index < 0 )\r\n          goto Exit;\r\n      }\r\n    }\r\n\r\n    if ( error )\r\n      goto Fail;\r\n\r\n    /* we now need to fill the root FT_Face fields */\r\n    /* with relevant information                   */\r\n    {\r\n      FT_Face     root = FT_FACE( face );\r\n      FNT_Font    font = face->font;\r\n      FT_PtrDist  family_size;\r\n\r\n\r\n      root->face_index = face_index;\r\n\r\n      root->face_flags = FT_FACE_FLAG_FIXED_SIZES |\r\n                         FT_FACE_FLAG_HORIZONTAL;\r\n\r\n      if ( font->header.avg_width == font->header.max_width )\r\n        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;\r\n\r\n      if ( font->header.italic )\r\n        root->style_flags |= FT_STYLE_FLAG_ITALIC;\r\n\r\n      if ( font->header.weight >= 800 )\r\n        root->style_flags |= FT_STYLE_FLAG_BOLD;\r\n\r\n      /* set up the `fixed_sizes' array */\r\n      if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )\r\n        goto Fail;\r\n\r\n      root->num_fixed_sizes = 1;\r\n\r\n      {\r\n        FT_Bitmap_Size*  bsize = root->available_sizes;\r\n        FT_UShort        x_res, y_res;\r\n\r\n\r\n        bsize->width  = font->header.avg_width;\r\n        bsize->height = (FT_Short)(\r\n          font->header.pixel_height + font->header.external_leading );\r\n        bsize->size   = font->header.nominal_point_size << 6;\r\n\r\n        x_res = font->header.horizontal_resolution;\r\n        if ( !x_res )\r\n          x_res = 72;\r\n\r\n        y_res = font->header.vertical_resolution;\r\n        if ( !y_res )\r\n          y_res = 72;\r\n\r\n        bsize->y_ppem = FT_MulDiv( bsize->size, y_res, 72 );\r\n        bsize->y_ppem = FT_PIX_ROUND( bsize->y_ppem );\r\n\r\n        /*\r\n         * this reads:\r\n         *\r\n         * the nominal height is larger than the bbox's height\r\n         *\r\n         * => nominal_point_size contains incorrect value;\r\n         *    use pixel_height as the nominal height\r\n         */\r\n        if ( bsize->y_ppem > ( font->header.pixel_height << 6 ) )\r\n        {\r\n          FT_TRACE2(( \"use pixel_height as the nominal height\\n\" ));\r\n\r\n          bsize->y_ppem = font->header.pixel_height << 6;\r\n          bsize->size   = FT_MulDiv( bsize->y_ppem, 72, y_res );\r\n        }\r\n\r\n        bsize->x_ppem = FT_MulDiv( bsize->size, x_res, 72 );\r\n        bsize->x_ppem = FT_PIX_ROUND( bsize->x_ppem );\r\n      }\r\n\r\n      {\r\n        FT_CharMapRec  charmap;\r\n\r\n\r\n        charmap.encoding    = FT_ENCODING_NONE;\r\n        /* initial platform/encoding should indicate unset status? */\r\n        charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;\r\n        charmap.encoding_id = TT_APPLE_ID_DEFAULT;\r\n        charmap.face        = root;\r\n\r\n        if ( font->header.charset == FT_WinFNT_ID_MAC )\r\n        {\r\n          charmap.encoding    = FT_ENCODING_APPLE_ROMAN;\r\n          charmap.platform_id = TT_PLATFORM_MACINTOSH;\r\n/*        charmap.encoding_id = TT_MAC_ID_ROMAN; */\r\n        }\r\n\r\n        error = FT_CMap_New( fnt_cmap_class,\r\n                             NULL,\r\n                             &charmap,\r\n                             NULL );\r\n        if ( error )\r\n          goto Fail;\r\n\r\n        /* Select default charmap */\r\n        if ( root->num_charmaps )\r\n          root->charmap = root->charmaps[0];\r\n      }\r\n\r\n      /* set up remaining flags */\r\n\r\n      if ( font->header.last_char < font->header.first_char )\r\n      {\r\n        FT_TRACE2(( \"invalid number of glyphs\\n\" ));\r\n        error = FNT_Err_Invalid_File_Format;\r\n        goto Fail;\r\n      }\r\n\r\n      /* reserve one slot for the .notdef glyph at index 0 */\r\n      root->num_glyphs = font->header.last_char -\r\n                         font->header.first_char + 1 + 1;\r\n\r\n      if ( font->header.face_name_offset >= font->header.file_size )\r\n      {\r\n        FT_TRACE2(( \"invalid family name offset\\n\" ));\r\n        error = FNT_Err_Invalid_File_Format;\r\n        goto Fail;\r\n      }\r\n      family_size = font->header.file_size - font->header.face_name_offset;\r\n      /* Some broken fonts don't delimit the face name with a final */\r\n      /* NULL byte -- the frame is erroneously one byte too small.  */\r\n      /* We thus allocate one more byte, setting it explicitly to   */\r\n      /* zero.                                                      */\r\n      if ( FT_ALLOC( font->family_name, family_size + 1 ) )\r\n        goto Fail;\r\n\r\n      FT_MEM_COPY( font->family_name,\r\n                   font->fnt_frame + font->header.face_name_offset,\r\n                   family_size );\r\n\r\n      font->family_name[family_size] = '\\0';\r\n\r\n      if ( FT_REALLOC( font->family_name,\r\n                       family_size,\r\n                       ft_strlen( font->family_name ) + 1 ) )\r\n        goto Fail;\r\n\r\n      root->family_name = font->family_name;\r\n      root->style_name  = (char *)\"Regular\";\r\n\r\n      if ( root->style_flags & FT_STYLE_FLAG_BOLD )\r\n      {\r\n        if ( root->style_flags & FT_STYLE_FLAG_ITALIC )\r\n          root->style_name = (char *)\"Bold Italic\";\r\n        else\r\n          root->style_name = (char *)\"Bold\";\r\n      }\r\n      else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )\r\n        root->style_name = (char *)\"Italic\";\r\n    }\r\n    goto Exit;\r\n\r\n  Fail:\r\n    FNT_Face_Done( fntface );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  FNT_Size_Select( FT_Size   size,\r\n                   FT_ULong  strike_index )\r\n  {\r\n    FNT_Face          face   = (FNT_Face)size->face;\r\n    FT_WinFNT_Header  header = &face->font->header;\r\n\r\n    FT_UNUSED( strike_index );\r\n\r\n\r\n    FT_Select_Metrics( size->face, 0 );\r\n\r\n    size->metrics.ascender    = header->ascent * 64;\r\n    size->metrics.descender   = -( header->pixel_height -\r\n                                   header->ascent ) * 64;\r\n    size->metrics.max_advance = header->max_width * 64;\r\n\r\n    return FNT_Err_Ok;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  FNT_Size_Request( FT_Size          size,\r\n                    FT_Size_Request  req )\r\n  {\r\n    FNT_Face          face    = (FNT_Face)size->face;\r\n    FT_WinFNT_Header  header  = &face->font->header;\r\n    FT_Bitmap_Size*   bsize   = size->face->available_sizes;\r\n    FT_Error          error   = FNT_Err_Invalid_Pixel_Size;\r\n    FT_Long           height;\r\n\r\n\r\n    height = FT_REQUEST_HEIGHT( req );\r\n    height = ( height + 32 ) >> 6;\r\n\r\n    switch ( req->type )\r\n    {\r\n    case FT_SIZE_REQUEST_TYPE_NOMINAL:\r\n      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )\r\n        error = FNT_Err_Ok;\r\n      break;\r\n\r\n    case FT_SIZE_REQUEST_TYPE_REAL_DIM:\r\n      if ( height == header->pixel_height )\r\n        error = FNT_Err_Ok;\r\n      break;\r\n\r\n    default:\r\n      error = FNT_Err_Unimplemented_Feature;\r\n      break;\r\n    }\r\n\r\n    if ( error )\r\n      return error;\r\n    else\r\n      return FNT_Size_Select( size, 0 );\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  FNT_Load_Glyph( FT_GlyphSlot  slot,\r\n                  FT_Size       size,\r\n                  FT_UInt       glyph_index,\r\n                  FT_Int32      load_flags )\r\n  {\r\n    FNT_Face    face   = (FNT_Face)FT_SIZE_FACE( size );\r\n    FNT_Font    font;\r\n    FT_Error    error  = FNT_Err_Ok;\r\n    FT_Byte*    p;\r\n    FT_Int      len;\r\n    FT_Bitmap*  bitmap = &slot->bitmap;\r\n    FT_ULong    offset;\r\n    FT_Bool     new_format;\r\n\r\n    FT_UNUSED( load_flags );\r\n\r\n\r\n    if ( !face )\r\n    {\r\n      error = FNT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    font = face->font;\r\n\r\n    if ( !font ||\r\n         glyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) )\r\n    {\r\n      error = FNT_Err_Invalid_Argument;\r\n      goto Exit;\r\n    }\r\n\r\n    if ( glyph_index > 0 )\r\n      glyph_index--;                           /* revert to real index */\r\n    else\r\n      glyph_index = font->header.default_char; /* the .notdef glyph */\r\n\r\n    new_format = FT_BOOL( font->header.version == 0x300 );\r\n    len        = new_format ? 6 : 4;\r\n\r\n    /* jump to glyph entry */\r\n    p = font->fnt_frame + ( new_format ? 148 : 118 ) + len * glyph_index;\r\n\r\n    bitmap->width = FT_NEXT_SHORT_LE( p );\r\n\r\n    if ( new_format )\r\n      offset = FT_NEXT_ULONG_LE( p );\r\n    else\r\n      offset = FT_NEXT_USHORT_LE( p );\r\n\r\n    if ( offset >= font->header.file_size )\r\n    {\r\n      FT_TRACE2(( \"invalid FNT offset\\n\" ));\r\n      error = FNT_Err_Invalid_File_Format;\r\n      goto Exit;\r\n    }\r\n\r\n    /* jump to glyph data */\r\n    p = font->fnt_frame + /* font->header.bits_offset */ + offset;\r\n\r\n    /* allocate and build bitmap */\r\n    {\r\n      FT_Memory  memory = FT_FACE_MEMORY( slot->face );\r\n      FT_Int     pitch  = ( bitmap->width + 7 ) >> 3;\r\n      FT_Byte*   column;\r\n      FT_Byte*   write;\r\n\r\n\r\n      bitmap->pitch      = pitch;\r\n      bitmap->rows       = font->header.pixel_height;\r\n      bitmap->pixel_mode = FT_PIXEL_MODE_MONO;\r\n\r\n      if ( offset + pitch * bitmap->rows >= font->header.file_size )\r\n      {\r\n        FT_TRACE2(( \"invalid bitmap width\\n\" ));\r\n        error = FNT_Err_Invalid_File_Format;\r\n        goto Exit;\r\n      }\r\n\r\n      /* note: since glyphs are stored in columns and not in rows we */\r\n      /*       can't use ft_glyphslot_set_bitmap                     */\r\n      if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) )\r\n        goto Exit;\r\n\r\n      column = (FT_Byte*)bitmap->buffer;\r\n\r\n      for ( ; pitch > 0; pitch--, column++ )\r\n      {\r\n        FT_Byte*  limit = p + bitmap->rows;\r\n\r\n\r\n        for ( write = column; p < limit; p++, write += bitmap->pitch )\r\n          *write = *p;\r\n      }\r\n    }\r\n\r\n    slot->internal->flags = FT_GLYPH_OWN_BITMAP;\r\n    slot->bitmap_left     = 0;\r\n    slot->bitmap_top      = font->header.ascent;\r\n    slot->format          = FT_GLYPH_FORMAT_BITMAP;\r\n\r\n    /* now set up metrics */\r\n    slot->metrics.width        = bitmap->width << 6;\r\n    slot->metrics.height       = bitmap->rows << 6;\r\n    slot->metrics.horiAdvance  = bitmap->width << 6;\r\n    slot->metrics.horiBearingX = 0;\r\n    slot->metrics.horiBearingY = slot->bitmap_top << 6;\r\n\r\n    ft_synthesize_vertical_metrics( &slot->metrics,\r\n                                    bitmap->rows << 6 );\r\n\r\n  Exit:\r\n    return error;\r\n  }\r\n\r\n\r\n  static FT_Error\r\n  winfnt_get_header( FT_Face               face,\r\n                     FT_WinFNT_HeaderRec  *aheader )\r\n  {\r\n    FNT_Font  font = ((FNT_Face)face)->font;\r\n\r\n\r\n    *aheader = font->header;\r\n\r\n    return 0;\r\n  }\r\n\r\n\r\n  static const FT_Service_WinFntRec  winfnt_service_rec =\r\n  {\r\n    winfnt_get_header\r\n  };\r\n\r\n /*\r\n  *  SERVICE LIST\r\n  *\r\n  */\r\n\r\n  static const FT_ServiceDescRec  winfnt_services[] =\r\n  {\r\n    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_WINFNT },\r\n    { FT_SERVICE_ID_WINFNT,    &winfnt_service_rec },\r\n    { NULL, NULL }\r\n  };\r\n\r\n\r\n  static FT_Module_Interface\r\n  winfnt_get_service( FT_Module         module,\r\n                      const FT_String*  service_id )\r\n  {\r\n    FT_UNUSED( module );\r\n\r\n    return ft_service_list_lookup( winfnt_services, service_id );\r\n  }\r\n\r\n\r\n\r\n\r\n  FT_CALLBACK_TABLE_DEF\r\n  const FT_Driver_ClassRec  winfnt_driver_class =\r\n  {\r\n    {\r\n      FT_MODULE_FONT_DRIVER        |\r\n      FT_MODULE_DRIVER_NO_OUTLINES,\r\n      sizeof ( FT_DriverRec ),\r\n\r\n      \"winfonts\",\r\n      0x10000L,\r\n      0x20000L,\r\n\r\n      0,\r\n\r\n      0,                  /* FT_Module_Constructor */\r\n      0,                  /* FT_Module_Destructor  */\r\n      winfnt_get_service\r\n    },\r\n\r\n    sizeof ( FNT_FaceRec ),\r\n    sizeof ( FT_SizeRec ),\r\n    sizeof ( FT_GlyphSlotRec ),\r\n\r\n    FNT_Face_Init,\r\n    FNT_Face_Done,\r\n    0,                    /* FT_Size_InitFunc */\r\n    0,                    /* FT_Size_DoneFunc */\r\n    0,                    /* FT_Slot_InitFunc */\r\n    0,                    /* FT_Slot_DoneFunc */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    ft_stub_set_char_sizes,\r\n    ft_stub_set_pixel_sizes,\r\n#endif\r\n    FNT_Load_Glyph,\r\n\r\n    0,                    /* FT_Face_GetKerningFunc  */\r\n    0,                    /* FT_Face_AttachFunc      */\r\n    0,                    /* FT_Face_GetAdvancesFunc */\r\n\r\n    FNT_Size_Request,\r\n    FNT_Size_Select\r\n  };\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/freeType/src/winfonts/winfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  winfnt.h                                                               */\r\n/*                                                                         */\r\n/*    FreeType font driver for Windows FNT/FON files                       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2007 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*  Copyright 2007 Dmitry Timoshkov for Codeweavers                        */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __WINFNT_H__\r\n#define __WINFNT_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_WINFONTS_H\r\n#include FT_INTERNAL_DRIVER_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n#error \"this module does not support PIC yet\"\r\n#endif\r\n\r\n  typedef struct  WinMZ_HeaderRec_\r\n  {\r\n    FT_UShort  magic;\r\n    /* skipped content */\r\n    FT_UShort  lfanew;\r\n\r\n  } WinMZ_HeaderRec;\r\n\r\n\r\n  typedef struct  WinNE_HeaderRec_\r\n  {\r\n    FT_UShort  magic;\r\n    /* skipped content */\r\n    FT_UShort  resource_tab_offset;\r\n    FT_UShort  rname_tab_offset;\r\n\r\n  } WinNE_HeaderRec;\r\n\r\n\r\n  typedef struct  WinPE32_HeaderRec_\r\n  {\r\n    FT_ULong   magic;\r\n    FT_UShort  machine;\r\n    FT_UShort  number_of_sections;\r\n    /* skipped content */\r\n    FT_UShort  size_of_optional_header;\r\n    /* skipped content */\r\n    FT_UShort  magic32;\r\n    /* skipped content */\r\n    FT_ULong   rsrc_virtual_address;\r\n    FT_ULong   rsrc_size;\r\n    /* skipped content */\r\n\r\n  } WinPE32_HeaderRec;\r\n\r\n\r\n  typedef struct  WinPE32_SectionRec_\r\n  {\r\n    FT_Byte   name[8];\r\n    /* skipped content */\r\n    FT_ULong  virtual_address;\r\n    FT_ULong  size_of_raw_data;\r\n    FT_ULong  pointer_to_raw_data;\r\n    /* skipped content */\r\n\r\n  } WinPE32_SectionRec;\r\n\r\n\r\n  typedef struct  WinPE_RsrcDirRec_\r\n  {\r\n    FT_ULong   characteristics;\r\n    FT_ULong   time_date_stamp;\r\n    FT_UShort  major_version;\r\n    FT_UShort  minor_version;\r\n    FT_UShort  number_of_named_entries;\r\n    FT_UShort  number_of_id_entries;\r\n\r\n  } WinPE_RsrcDirRec;\r\n\r\n\r\n  typedef struct  WinPE_RsrcDirEntryRec_\r\n  {\r\n    FT_ULong  name;\r\n    FT_ULong  offset;\r\n\r\n  } WinPE_RsrcDirEntryRec;\r\n\r\n\r\n  typedef struct  WinPE_RsrcDataEntryRec_\r\n  {\r\n    FT_ULong  offset_to_data;\r\n    FT_ULong  size;\r\n    FT_ULong  code_page;\r\n    FT_ULong  reserved;\r\n\r\n  } WinPE_RsrcDataEntryRec;\r\n\r\n\r\n  typedef struct  WinNameInfoRec_\r\n  {\r\n    FT_UShort  offset;\r\n    FT_UShort  length;\r\n    FT_UShort  flags;\r\n    FT_UShort  id;\r\n    FT_UShort  handle;\r\n    FT_UShort  usage;\r\n\r\n  } WinNameInfoRec;\r\n\r\n\r\n  typedef struct  WinResourceInfoRec_\r\n  {\r\n    FT_UShort  type_id;\r\n    FT_UShort  count;\r\n\r\n  } WinResourceInfoRec;\r\n\r\n\r\n#define WINFNT_MZ_MAGIC  0x5A4D\r\n#define WINFNT_NE_MAGIC  0x454E\r\n#define WINFNT_PE_MAGIC  0x4550\r\n\r\n\r\n  typedef struct  FNT_FontRec_\r\n  {\r\n    FT_ULong             offset;\r\n\r\n    FT_WinFNT_HeaderRec  header;\r\n\r\n    FT_Byte*             fnt_frame;\r\n    FT_ULong             fnt_size;\r\n    FT_String*           family_name;\r\n\r\n  } FNT_FontRec, *FNT_Font;\r\n\r\n\r\n  typedef struct  FNT_FaceRec_\r\n  {\r\n    FT_FaceRec     root;\r\n    FNT_Font       font;\r\n\r\n    FT_CharMap     charmap_handle;\r\n    FT_CharMapRec  charmap;  /* a single charmap per face */\r\n\r\n  } FNT_FaceRec, *FNT_Face;\r\n\r\n\r\n  FT_EXPORT_VAR( const FT_Driver_ClassRec )  winfnt_driver_class;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __WINFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/FTL.txt",
    "content": "                    The FreeType Project LICENSE\r\n                    ----------------------------\r\n\r\n                            2006-Jan-27\r\n\r\n                    Copyright 1996-2002, 2006 by\r\n          David Turner, Robert Wilhelm, and Werner Lemberg\r\n\r\n\r\n\r\nIntroduction\r\n============\r\n\r\n  The FreeType  Project is distributed in  several archive packages;\r\n  some of them may contain, in addition to the FreeType font engine,\r\n  various tools and  contributions which rely on, or  relate to, the\r\n  FreeType Project.\r\n\r\n  This  license applies  to all  files found  in such  packages, and\r\n  which do not  fall under their own explicit  license.  The license\r\n  affects  thus  the  FreeType   font  engine,  the  test  programs,\r\n  documentation and makefiles, at the very least.\r\n\r\n  This  license   was  inspired  by  the  BSD,   Artistic,  and  IJG\r\n  (Independent JPEG  Group) licenses, which  all encourage inclusion\r\n  and  use of  free  software in  commercial  and freeware  products\r\n  alike.  As a consequence, its main points are that:\r\n\r\n    o We don't promise that this software works. However, we will be\r\n      interested in any kind of bug reports. (`as is' distribution)\r\n\r\n    o You can  use this software for whatever you  want, in parts or\r\n      full form, without having to pay us. (`royalty-free' usage)\r\n\r\n    o You may not pretend that  you wrote this software.  If you use\r\n      it, or  only parts of it,  in a program,  you must acknowledge\r\n      somewhere  in  your  documentation  that  you  have  used  the\r\n      FreeType code. (`credits')\r\n\r\n  We  specifically  permit  and  encourage  the  inclusion  of  this\r\n  software, with  or without modifications,  in commercial products.\r\n  We  disclaim  all warranties  covering  The  FreeType Project  and\r\n  assume no liability related to The FreeType Project.\r\n\r\n\r\n  Finally,  many  people  asked  us  for  a  preferred  form  for  a\r\n  credit/disclaimer to use in compliance with this license.  We thus\r\n  encourage you to use the following text:\r\n\r\n   \"\"\"  \r\n    Portions of this software are copyright  <year> The FreeType\r\n    Project (www.freetype.org).  All rights reserved.\r\n   \"\"\"\r\n\r\n  Please replace <year> with the value from the FreeType version you\r\n  actually use.\r\n\r\n\r\nLegal Terms\r\n===========\r\n\r\n0. Definitions\r\n--------------\r\n\r\n  Throughout this license,  the terms `package', `FreeType Project',\r\n  and  `FreeType  archive' refer  to  the  set  of files  originally\r\n  distributed  by the  authors  (David Turner,  Robert Wilhelm,  and\r\n  Werner Lemberg) as the `FreeType Project', be they named as alpha,\r\n  beta or final release.\r\n\r\n  `You' refers to  the licensee, or person using  the project, where\r\n  `using' is a generic term including compiling the project's source\r\n  code as  well as linking it  to form a  `program' or `executable'.\r\n  This  program is  referred to  as  `a program  using the  FreeType\r\n  engine'.\r\n\r\n  This  license applies  to all  files distributed  in  the original\r\n  FreeType  Project,   including  all  source   code,  binaries  and\r\n  documentation,  unless  otherwise  stated   in  the  file  in  its\r\n  original, unmodified form as  distributed in the original archive.\r\n  If you are  unsure whether or not a particular  file is covered by\r\n  this license, you must contact us to verify this.\r\n\r\n  The FreeType  Project is copyright (C) 1996-2000  by David Turner,\r\n  Robert Wilhelm, and Werner Lemberg.  All rights reserved except as\r\n  specified below.\r\n\r\n1. No Warranty\r\n--------------\r\n\r\n  THE FREETYPE PROJECT  IS PROVIDED `AS IS' WITHOUT  WARRANTY OF ANY\r\n  KIND, EITHER  EXPRESS OR IMPLIED,  INCLUDING, BUT NOT  LIMITED TO,\r\n  WARRANTIES  OF  MERCHANTABILITY   AND  FITNESS  FOR  A  PARTICULAR\r\n  PURPOSE.  IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS\r\n  BE LIABLE  FOR ANY DAMAGES CAUSED  BY THE USE OR  THE INABILITY TO\r\n  USE, OF THE FREETYPE PROJECT.\r\n\r\n2. Redistribution\r\n-----------------\r\n\r\n  This  license  grants  a  worldwide, royalty-free,  perpetual  and\r\n  irrevocable right  and license to use,  execute, perform, compile,\r\n  display,  copy,   create  derivative  works   of,  distribute  and\r\n  sublicense the  FreeType Project (in  both source and  object code\r\n  forms)  and  derivative works  thereof  for  any  purpose; and  to\r\n  authorize others  to exercise  some or all  of the  rights granted\r\n  herein, subject to the following conditions:\r\n\r\n    o Redistribution of  source code  must retain this  license file\r\n      (`FTL.TXT') unaltered; any  additions, deletions or changes to\r\n      the original  files must be clearly  indicated in accompanying\r\n      documentation.   The  copyright   notices  of  the  unaltered,\r\n      original  files must  be  preserved in  all  copies of  source\r\n      files.\r\n\r\n    o Redistribution in binary form must provide a  disclaimer  that\r\n      states  that  the software is based in part of the work of the\r\n      FreeType Team,  in  the  distribution  documentation.  We also\r\n      encourage you to put an URL to the FreeType web page  in  your\r\n      documentation, though this isn't mandatory.\r\n\r\n  These conditions  apply to any  software derived from or  based on\r\n  the FreeType Project,  not just the unmodified files.   If you use\r\n  our work, you  must acknowledge us.  However, no  fee need be paid\r\n  to us.\r\n\r\n3. Advertising\r\n--------------\r\n\r\n  Neither the  FreeType authors and  contributors nor you  shall use\r\n  the name of the  other for commercial, advertising, or promotional\r\n  purposes without specific prior written permission.\r\n\r\n  We suggest,  but do not require, that  you use one or  more of the\r\n  following phrases to refer  to this software in your documentation\r\n  or advertising  materials: `FreeType Project',  `FreeType Engine',\r\n  `FreeType library', or `FreeType Distribution'.\r\n\r\n  As  you have  not signed  this license,  you are  not  required to\r\n  accept  it.   However,  as  the FreeType  Project  is  copyrighted\r\n  material, only  this license, or  another one contracted  with the\r\n  authors, grants you  the right to use, distribute,  and modify it.\r\n  Therefore,  by  using,  distributing,  or modifying  the  FreeType\r\n  Project, you indicate that you understand and accept all the terms\r\n  of this license.\r\n\r\n4. Contacts\r\n-----------\r\n\r\n  There are two mailing lists related to FreeType:\r\n\r\n    o freetype@nongnu.org\r\n\r\n      Discusses general use and applications of FreeType, as well as\r\n      future and  wanted additions to the  library and distribution.\r\n      If  you are looking  for support,  start in  this list  if you\r\n      haven't found anything to help you in the documentation.\r\n\r\n    o freetype-devel@nongnu.org\r\n\r\n      Discusses bugs,  as well  as engine internals,  design issues,\r\n      specific licenses, porting, etc.\r\n\r\n  Our home page can be found at\r\n\r\n    http://www.freetype.org\r\n\r\n\r\n--- end of FTL.TXT ---\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/README.md",
    "content": "# Freetype 2 Android\r\n\r\nThis is simply a distribution of the Freetype 2 library, that includes Android make files ready to build the Freetype 2 library into a static and shared binaries for version 2.2 of the Android operating system.  This distribution requires release 5 of the Android Native Development Kit.\r\n\r\nThe project only includes the Freetype modules for processing TrueType and OpenType fonts.  Other font modules have been disabled.  If you want to re-enable these modules, you will need to download the Freetype 2 source code, and then copy the module source files to the appropriate location in either the \"include/\" or \"src/\" folders of this distribution.  The Freetype source code is [available here](http://download.savannah.gnu.org/releases/freetype/).  The instructions for including these new modules in the Android makefile is left as an exercise, but if you follow the pattern of the truetype module in the Android makefile, your module should compile correctly.\r\n\r\nThe code in this distribution comes from version 2.4.4 of the Freetype library.   \r\n\r\nThere is an analogous library for Xcode and iOS [here](https://github.com/cdave1/freetype2-ios).\r\n\r\n\r\n# Install\r\n\r\nThis distribution requires release 5 of the Android Native Development Kit.\r\n\r\nTo build, execute following (assuming your ndk distribution located at `~/workspace/android-ndk`):\r\n\r\n    NDK_PROJECT_PATH=. ~/workspace/android-ndk/ndk-build -j8\r\n\r\nThe file jni/Application.mk contains the target and platform settings used by ndk-build. The current settings are:\r\n\r\n    APP_ABI := all\r\n    APP_PLATFORM := android-8\r\n\r\nTo use the library in another ndk library, you will need to include the `jni/static.mk` or `jni/shared.mk` in the `Android.mk` of the library you want to use freetype with.\r\n\r\n\r\n# License\r\n\r\nThis code is distributed under the terms of the [Freetype License](http://www.freetype.org/FTL.TXT).  The Freetype License is also included in this distribution.  If you are going to use code in this project, please make sure you follow the instructions in the Freetype License."
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/config/ftconfig.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftconfig.h                                                             */\r\n/*                                                                         */\r\n/*    ANSI-specific configuration file (specification only).               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2010 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This header file contains a number of macro definitions that are used */\r\n  /* by the rest of the engine.  Most of the macros here are automatically */\r\n  /* determined at compile time, and you should not need to change it to   */\r\n  /* port FreeType, except to compile the library with a non-ANSI          */\r\n  /* compiler.                                                             */\r\n  /*                                                                       */\r\n  /* Note however that if some specific modifications are needed, we       */\r\n  /* advise you to place a modified copy in your build directory.          */\r\n  /*                                                                       */\r\n  /* The build directory is usually `freetype/builds/<system>', and        */\r\n  /* contains system-specific files that are always included first when    */\r\n  /* building the library.                                                 */\r\n  /*                                                                       */\r\n  /* This ANSI version should stay in `include/freetype/config'.           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifndef __FTCONFIG_H__\r\n#define __FTCONFIG_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_OPTIONS_H\r\n#include FT_CONFIG_STANDARD_LIBRARY_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*               PLATFORM-SPECIFIC CONFIGURATION MACROS                  */\r\n  /*                                                                       */\r\n  /* These macros can be toggled to suit a specific system.  The current   */\r\n  /* ones are defaults used to compile FreeType in an ANSI C environment   */\r\n  /* (16bit compilers are also supported).  Copy this file to your own     */\r\n  /* `freetype/builds/<system>' directory, and edit it to port the engine. */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* There are systems (like the Texas Instruments 'C54x) where a `char' */\r\n  /* has 16 bits.  ANSI C says that sizeof(char) is always 1.  Since an  */\r\n  /* `int' has 16 bits also for this system, sizeof(int) gives 1 which   */\r\n  /* is probably unexpected.                                             */\r\n  /*                                                                     */\r\n  /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a      */\r\n  /* `char' type.                                                        */\r\n\r\n#ifndef FT_CHAR_BIT\r\n#define FT_CHAR_BIT  CHAR_BIT\r\n#endif\r\n\r\n\r\n  /* The size of an `int' type.  */\r\n#if                                 FT_UINT_MAX == 0xFFFFUL\r\n#define FT_SIZEOF_INT  (16 / FT_CHAR_BIT)\r\n#elif                               FT_UINT_MAX == 0xFFFFFFFFUL\r\n#define FT_SIZEOF_INT  (32 / FT_CHAR_BIT)\r\n#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL\r\n#define FT_SIZEOF_INT  (64 / FT_CHAR_BIT)\r\n#else\r\n#error \"Unsupported size of `int' type!\"\r\n#endif\r\n\r\n  /* The size of a `long' type.  A five-byte `long' (as used e.g. on the */\r\n  /* DM642) is recognized but avoided.                                   */\r\n#if                                  FT_ULONG_MAX == 0xFFFFFFFFUL\r\n#define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)\r\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL\r\n#define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)\r\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL\r\n#define FT_SIZEOF_LONG  (64 / FT_CHAR_BIT)\r\n#else\r\n#error \"Unsupported size of `long' type!\"\r\n#endif\r\n\r\n\r\n  /* Preferred alignment of data */\r\n#define FT_ALIGNMENT  8\r\n\r\n\r\n  /* FT_UNUSED is a macro used to indicate that a given parameter is not  */\r\n  /* used -- this is only used to get rid of unpleasant compiler warnings */\r\n#ifndef FT_UNUSED\r\n#define FT_UNUSED( arg )  ( (arg) = (arg) )\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                     AUTOMATIC CONFIGURATION MACROS                    */\r\n  /*                                                                       */\r\n  /* These macros are computed from the ones defined above.  Don't touch   */\r\n  /* their definition, unless you know precisely what you are doing.  No   */\r\n  /* porter should need to mess with them.                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Mac support                                                           */\r\n  /*                                                                       */\r\n  /*   This is the only necessary change, so it is defined here instead    */\r\n  /*   providing a new configuration file.                                 */\r\n  /*                                                                       */\r\n#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \\\r\n    ( defined( __MWERKS__ ) && defined( macintosh )        )\r\n  /* no Carbon frameworks for 64bit 10.4.x */\r\n#include \"AvailabilityMacros.h\"\r\n#if defined( __LP64__ ) && \\\r\n    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )\r\n#define DARWIN_NO_CARBON 1\r\n#else\r\n#define FT_MACINTOSH 1\r\n#endif\r\n\r\n#elif defined( __SC__ ) || defined( __MRC__ )\r\n  /* Classic MacOS compilers */\r\n#include \"ConditionalMacros.h\"\r\n#if TARGET_OS_MAC\r\n#define FT_MACINTOSH 1\r\n#endif\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Int16                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for a 16bit signed integer type.                         */\r\n  /*                                                                       */\r\n  typedef signed short  FT_Int16;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UInt16                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for a 16bit unsigned integer type.                       */\r\n  /*                                                                       */\r\n  typedef unsigned short  FT_UInt16;\r\n\r\n  /* */\r\n\r\n\r\n  /* this #if 0 ... #endif clause is for documentation purposes */\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Int32                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for a 32bit signed integer type.  The size depends on    */\r\n  /*    the configuration.                                                 */\r\n  /*                                                                       */\r\n  typedef signed XXX  FT_Int32;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UInt32                                                          */\r\n  /*                                                                       */\r\n  /*    A typedef for a 32bit unsigned integer type.  The size depends on  */\r\n  /*    the configuration.                                                 */\r\n  /*                                                                       */\r\n  typedef unsigned XXX  FT_UInt32;\r\n\r\n  /* */\r\n\r\n#endif\r\n\r\n#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)\r\n\r\n  typedef signed int      FT_Int32;\r\n  typedef unsigned int    FT_UInt32;\r\n\r\n#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)\r\n\r\n  typedef signed long     FT_Int32;\r\n  typedef unsigned long   FT_UInt32;\r\n\r\n#else\r\n#error \"no 32bit type found -- please check your configuration files\"\r\n#endif\r\n\r\n\r\n  /* look up an integer type that is at least 32 bits */\r\n#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)\r\n\r\n  typedef int            FT_Fast;\r\n  typedef unsigned int   FT_UFast;\r\n\r\n#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)\r\n\r\n  typedef long           FT_Fast;\r\n  typedef unsigned long  FT_UFast;\r\n\r\n#endif\r\n\r\n\r\n  /* determine whether we have a 64-bit int type for platforms without */\r\n  /* Autoconf                                                          */\r\n#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)\r\n\r\n  /* FT_LONG64 must be defined if a 64-bit type is available */\r\n#define FT_LONG64\r\n#define FT_INT64  long\r\n\r\n#elif defined( _MSC_VER ) && _MSC_VER >= 900  /* Visual C++ (and Intel C++) */\r\n\r\n  /* this compiler provides the __int64 type */\r\n#define FT_LONG64\r\n#define FT_INT64  __int64\r\n\r\n#elif defined( __BORLANDC__ )  /* Borland C++ */\r\n\r\n  /* XXXX: We should probably check the value of __BORLANDC__ in order */\r\n  /*       to test the compiler version.                               */\r\n\r\n  /* this compiler provides the __int64 type */\r\n#define FT_LONG64\r\n#define FT_INT64  __int64\r\n\r\n#elif defined( __WATCOMC__ )   /* Watcom C++ */\r\n\r\n  /* Watcom doesn't provide 64-bit data types */\r\n\r\n#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */\r\n\r\n#define FT_LONG64\r\n#define FT_INT64  long long int\r\n\r\n#elif defined( __GNUC__ )\r\n\r\n  /* GCC provides the `long long' type */\r\n#define FT_LONG64\r\n#define FT_INT64  long long int\r\n\r\n#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A 64-bit data type will create compilation problems if you compile    */\r\n  /* in strict ANSI mode.  To avoid them, we disable its use if __STDC__   */\r\n  /* is defined.  You can however ignore this rule by defining the         */\r\n  /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro.                     */\r\n  /*                                                                       */\r\n#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )\r\n\r\n#ifdef __STDC__\r\n\r\n  /* undefine the 64-bit macros in strict ANSI compilation mode */\r\n#undef FT_LONG64\r\n#undef FT_INT64\r\n\r\n#endif /* __STDC__ */\r\n\r\n#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */\r\n\r\n\r\n#define FT_BEGIN_STMNT  do {\r\n#define FT_END_STMNT    } while ( 0 )\r\n#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT\r\n\r\n\r\n#ifndef  FT_CONFIG_OPTION_NO_ASSEMBLER\r\n  /* Provide assembler fragments for performance-critical functions. */\r\n  /* These must be defined `static __inline__' with GCC.             */\r\n\r\n#if defined( __CC_ARM ) || defined( __ARMCC__ )  /* RVCT */\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_arm\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline FT_Int32\r\n  FT_MulFix_arm( FT_Int32  a,\r\n                 FT_Int32  b )\r\n  {\r\n    register FT_Int32  t, t2;\r\n\r\n\r\n    __asm\r\n    {\r\n      smull t2, t,  b,  a           /* (lo=t2,hi=t) = a*b */\r\n      mov   a,  t,  asr #31         /* a   = (hi >> 31) */\r\n      add   a,  a,  #0x8000         /* a  += 0x8000 */\r\n      adds  t2, t2, a               /* t2 += a */\r\n      adc   t,  t,  #0              /* t  += carry */\r\n      mov   a,  t2, lsr #16         /* a   = t2 >> 16 */\r\n      orr   a,  a,  t,  lsl #16     /* a  |= t << 16 */\r\n    }\r\n    return a;\r\n  }\r\n\r\n#endif /* __CC_ARM || __ARMCC__ */\r\n\r\n\r\n#ifdef __GNUC__\r\n\r\n#if defined( __arm__ ) && !defined( __thumb__ )    && \\\r\n    !( defined( __CC_ARM ) || defined( __ARMCC__ ) )\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_arm\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline__ FT_Int32\r\n  FT_MulFix_arm( FT_Int32  a,\r\n                 FT_Int32  b )\r\n  {\r\n    register FT_Int32  t, t2;\r\n\r\n\r\n    __asm__ __volatile__ (\r\n      \"smull  %1, %2, %4, %3\\n\\t\"   /* (lo=%1,hi=%2) = a*b */\r\n      \"mov    %0, %2, asr #31\\n\\t\"  /* %0  = (hi >> 31) */\r\n      \"add    %0, %0, #0x8000\\n\\t\"  /* %0 += 0x8000 */\r\n      \"adds   %1, %1, %0\\n\\t\"       /* %1 += %0 */\r\n      \"adc    %2, %2, #0\\n\\t\"       /* %2 += carry */\r\n      \"mov    %0, %1, lsr #16\\n\\t\"  /* %0  = %1 >> 16 */\r\n      \"orr    %0, %2, lsl #16\\n\\t\"  /* %0 |= %2 << 16 */\r\n      : \"=r\"(a), \"=&r\"(t2), \"=&r\"(t)\r\n      : \"r\"(a), \"r\"(b) );\r\n    return a;\r\n  }\r\n\r\n#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */\r\n\r\n#if defined( __i386__ )\r\n#define FT_MULFIX_ASSEMBLER  FT_MulFix_i386\r\n\r\n  /* documentation is in freetype.h */\r\n\r\n  static __inline__ FT_Int32\r\n  FT_MulFix_i386( FT_Int32  a,\r\n                  FT_Int32  b )\r\n  {\r\n    register FT_Int32  result;\r\n\r\n\r\n    __asm__ __volatile__ (\r\n      \"imul  %%edx\\n\"\r\n      \"movl  %%edx, %%ecx\\n\"\r\n      \"sarl  $31, %%ecx\\n\"\r\n      \"addl  $0x8000, %%ecx\\n\"\r\n      \"addl  %%ecx, %%eax\\n\"\r\n      \"adcl  $0, %%edx\\n\"\r\n      \"shrl  $16, %%eax\\n\"\r\n      \"shll  $16, %%edx\\n\"\r\n      \"addl  %%edx, %%eax\\n\"\r\n      : \"=a\"(result), \"=d\"(b)\r\n      : \"a\"(a), \"d\"(b)\r\n      : \"%ecx\", \"cc\" );\r\n    return result;\r\n  }\r\n\r\n#endif /* i386 */\r\n\r\n#endif /* __GNUC__ */\r\n\r\n#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_INLINE_MULFIX\r\n#ifdef FT_MULFIX_ASSEMBLER\r\n#define FT_MULFIX_INLINED  FT_MULFIX_ASSEMBLER\r\n#endif\r\n#endif\r\n\r\n\r\n#ifdef FT_MAKE_OPTION_SINGLE_OBJECT\r\n\r\n#define FT_LOCAL( x )      static  x\r\n#define FT_LOCAL_DEF( x )  static  x\r\n\r\n#else\r\n\r\n#ifdef __cplusplus\r\n#define FT_LOCAL( x )      extern \"C\"  x\r\n#define FT_LOCAL_DEF( x )  extern \"C\"  x\r\n#else\r\n#define FT_LOCAL( x )      extern  x\r\n#define FT_LOCAL_DEF( x )  x\r\n#endif\r\n\r\n#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */\r\n\r\n\r\n#ifndef FT_BASE\r\n\r\n#ifdef __cplusplus\r\n#define FT_BASE( x )  extern \"C\"  x\r\n#else\r\n#define FT_BASE( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_BASE */\r\n\r\n\r\n#ifndef FT_BASE_DEF\r\n\r\n#ifdef __cplusplus\r\n#define FT_BASE_DEF( x )  x\r\n#else\r\n#define FT_BASE_DEF( x )  x\r\n#endif\r\n\r\n#endif /* !FT_BASE_DEF */\r\n\r\n\r\n#ifndef FT_EXPORT\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXPORT( x )  extern \"C\"  x\r\n#else\r\n#define FT_EXPORT( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_EXPORT */\r\n\r\n\r\n#ifndef FT_EXPORT_DEF\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXPORT_DEF( x )  extern \"C\"  x\r\n#else\r\n#define FT_EXPORT_DEF( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_EXPORT_DEF */\r\n\r\n\r\n#ifndef FT_EXPORT_VAR\r\n\r\n#ifdef __cplusplus\r\n#define FT_EXPORT_VAR( x )  extern \"C\"  x\r\n#else\r\n#define FT_EXPORT_VAR( x )  extern  x\r\n#endif\r\n\r\n#endif /* !FT_EXPORT_VAR */\r\n\r\n  /* The following macros are needed to compile the library with a   */\r\n  /* C++ compiler and with 16bit compilers.                          */\r\n  /*                                                                 */\r\n\r\n  /* This is special.  Within C++, you must specify `extern \"C\"' for */\r\n  /* functions which are used via function pointers, and you also    */\r\n  /* must do that for structures which contain function pointers to  */\r\n  /* assure C linkage -- it's not possible to have (local) anonymous */\r\n  /* functions which are accessed by (global) function pointers.     */\r\n  /*                                                                 */\r\n  /*                                                                 */\r\n  /* FT_CALLBACK_DEF is used to _define_ a callback function.        */\r\n  /*                                                                 */\r\n  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */\r\n  /* contains pointers to callback functions.                        */\r\n  /*                                                                 */\r\n  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */\r\n  /* that contains pointers to callback functions.                   */\r\n  /*                                                                 */\r\n  /*                                                                 */\r\n  /* Some 16bit compilers have to redefine these macros to insert    */\r\n  /* the infamous `_cdecl' or `__fastcall' declarations.             */\r\n  /*                                                                 */\r\n#ifndef FT_CALLBACK_DEF\r\n#ifdef __cplusplus\r\n#define FT_CALLBACK_DEF( x )  extern \"C\"  x\r\n#else\r\n#define FT_CALLBACK_DEF( x )  static  x\r\n#endif\r\n#endif /* FT_CALLBACK_DEF */\r\n\r\n#ifndef FT_CALLBACK_TABLE\r\n#ifdef __cplusplus\r\n#define FT_CALLBACK_TABLE      extern \"C\"\r\n#define FT_CALLBACK_TABLE_DEF  extern \"C\"\r\n#else\r\n#define FT_CALLBACK_TABLE      extern\r\n#define FT_CALLBACK_TABLE_DEF  /* nothing */\r\n#endif\r\n#endif /* FT_CALLBACK_TABLE */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTCONFIG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/config/ftheader.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftheader.h                                                             */\r\n/*                                                                         */\r\n/*    Build macros of the FreeType 2 library.                              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#ifndef __FT_HEADER_H__\r\n#define __FT_HEADER_H__\r\n\r\n\r\n  /*@***********************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_BEGIN_HEADER                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro is used in association with @FT_END_HEADER in header    */\r\n  /*    files to ensure that the declarations within are properly          */\r\n  /*    encapsulated in an `extern \"C\" { .. }' block when included from a  */\r\n  /*    C++ compiler.                                                      */\r\n  /*                                                                       */\r\n#ifdef __cplusplus\r\n#define FT_BEGIN_HEADER  extern \"C\" {\r\n#else\r\n#define FT_BEGIN_HEADER  /* nothing */\r\n#endif\r\n\r\n\r\n  /*@***********************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_END_HEADER                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro is used in association with @FT_BEGIN_HEADER in header  */\r\n  /*    files to ensure that the declarations within are properly          */\r\n  /*    encapsulated in an `extern \"C\" { .. }' block when included from a  */\r\n  /*    C++ compiler.                                                      */\r\n  /*                                                                       */\r\n#ifdef __cplusplus\r\n#define FT_END_HEADER  }\r\n#else\r\n#define FT_END_HEADER  /* nothing */\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Aliases for the FreeType 2 public and configuration files.            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    header_file_macros                                                 */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Header File Macros                                                 */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Macro definitions used to #include specific header files.          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The following macros are defined to the name of specific           */\r\n  /*    FreeType~2 header files.  They can be used directly in #include    */\r\n  /*    statements as in:                                                  */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      #include FT_FREETYPE_H                                           */\r\n  /*      #include FT_MULTIPLE_MASTERS_H                                   */\r\n  /*      #include FT_GLYPH_H                                              */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    There are several reasons why we are now using macros to name      */\r\n  /*    public header files.  The first one is that such macros are not    */\r\n  /*    limited to the infamous 8.3~naming rule required by DOS (and       */\r\n  /*    `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h').   */\r\n  /*                                                                       */\r\n  /*    The second reason is that it allows for more flexibility in the    */\r\n  /*    way FreeType~2 is installed on a given system.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* configuration files */\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_CONFIG_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   FreeType~2 configuration data.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_CONFIG_H\r\n#define FT_CONFIG_CONFIG_H  <freetype/config/ftconfig.h>\r\n#endif\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_STANDARD_LIBRARY_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   FreeType~2 interface to the standard C library functions.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_STANDARD_LIBRARY_H\r\n#define FT_CONFIG_STANDARD_LIBRARY_H  <freetype/config/ftstdlib.h>\r\n#endif\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_OPTIONS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing\r\n   *   FreeType~2 project-specific configuration options.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_OPTIONS_H\r\n#define FT_CONFIG_OPTIONS_H  <freetype/config/ftoption.h>\r\n#endif\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CONFIG_MODULES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list of FreeType~2 modules that are statically linked to new library\r\n   *   instances in @FT_Init_FreeType.\r\n   *\r\n   */\r\n#ifndef FT_CONFIG_MODULES_H\r\n#define FT_CONFIG_MODULES_H  <freetype/config/ftmodule.h>\r\n#endif\r\n\r\n  /* */\r\n\r\n  /* public headers */\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_FREETYPE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   base FreeType~2 API.\r\n   *\r\n   */\r\n#define FT_FREETYPE_H  <freetype/freetype.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ERRORS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list of FreeType~2 error codes (and messages).\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_ERRORS_H  <freetype/fterrors.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MODULE_ERRORS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list of FreeType~2 module error offsets (and messages).\r\n   *\r\n   */\r\n#define FT_MODULE_ERRORS_H  <freetype/ftmoderr.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SYSTEM_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 interface to low-level operations (i.e., memory management\r\n   *   and stream i/o).\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_SYSTEM_H  <freetype/ftsystem.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IMAGE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing type\r\n   *   definitions related to glyph images (i.e., bitmaps, outlines,\r\n   *   scan-converter parameters).\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_IMAGE_H  <freetype/ftimage.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TYPES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   basic data types defined by FreeType~2.\r\n   *\r\n   *   It is included by @FT_FREETYPE_H.\r\n   *\r\n   */\r\n#define FT_TYPES_H  <freetype/fttypes.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LIST_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   list management API of FreeType~2.\r\n   *\r\n   *   (Most applications will never need to include this file.)\r\n   *\r\n   */\r\n#define FT_LIST_H  <freetype/ftlist.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_OUTLINE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   scalable outline management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_OUTLINE_H  <freetype/ftoutln.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SIZES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API which manages multiple @FT_Size objects per face.\r\n   *\r\n   */\r\n#define FT_SIZES_H  <freetype/ftsizes.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MODULE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   module management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_MODULE_H  <freetype/ftmodapi.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_RENDER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   renderer module management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_RENDER_H  <freetype/ftrender.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TYPE1_TABLES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   types and API specific to the Type~1 format.\r\n   *\r\n   */\r\n#define FT_TYPE1_TABLES_H  <freetype/t1tables.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRUETYPE_IDS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   enumeration values which identify name strings, languages, encodings,\r\n   *   etc.  This file really contains a _large_ set of constant macro\r\n   *   definitions, taken from the TrueType and OpenType specifications.\r\n   *\r\n   */\r\n#define FT_TRUETYPE_IDS_H  <freetype/ttnameid.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRUETYPE_TABLES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   types and API specific to the TrueType (as well as OpenType) format.\r\n   *\r\n   */\r\n#define FT_TRUETYPE_TABLES_H  <freetype/tttables.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRUETYPE_TAGS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of TrueType four-byte `tags' which identify blocks in\r\n   *   SFNT-based font formats (i.e., TrueType and OpenType).\r\n   *\r\n   */\r\n#define FT_TRUETYPE_TAGS_H  <freetype/tttags.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BDF_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which accesses BDF-specific strings from a\r\n   *   face.\r\n   *\r\n   */\r\n#define FT_BDF_H  <freetype/ftbdf.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CID_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which access CID font information from a\r\n   *   face.\r\n   *\r\n   */\r\n#define FT_CID_H  <freetype/ftcid.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GZIP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports gzip-compressed files.\r\n   *\r\n   */\r\n#define FT_GZIP_H  <freetype/ftgzip.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LZW_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports LZW-compressed files.\r\n   *\r\n   */\r\n#define FT_LZW_H  <freetype/ftlzw.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_WINFONTS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   definitions of an API which supports Windows FNT files.\r\n   *\r\n   */\r\n#define FT_WINFONTS_H   <freetype/ftwinfnt.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GLYPH_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional glyph management component.\r\n   *\r\n   */\r\n#define FT_GLYPH_H  <freetype/ftglyph.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BITMAP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional bitmap conversion component.\r\n   *\r\n   */\r\n#define FT_BITMAP_H  <freetype/ftbitmap.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_BBOX_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional exact bounding box computation routines.\r\n   *\r\n   */\r\n#define FT_BBOX_H  <freetype/ftbbox.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   API of the optional FreeType~2 cache sub-system.\r\n   *\r\n   */\r\n#define FT_CACHE_H  <freetype/ftcache.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_IMAGE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   `glyph image' API of the FreeType~2 cache sub-system.\r\n   *\r\n   *   It is used to define a cache for @FT_Glyph elements.  You can also\r\n   *   use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to\r\n   *   store small glyph bitmaps, as it will use less memory.\r\n   *\r\n   *   This macro is deprecated.  Simply include @FT_CACHE_H to have all\r\n   *   glyph image-related cache declarations.\r\n   *\r\n   */\r\n#define FT_CACHE_IMAGE_H  FT_CACHE_H\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_SMALL_BITMAPS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   `small bitmaps' API of the FreeType~2 cache sub-system.\r\n   *\r\n   *   It is used to define a cache for small glyph bitmaps in a relatively\r\n   *   memory-efficient way.  You can also use the API defined in\r\n   *   @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,\r\n   *   including scalable outlines.\r\n   *\r\n   *   This macro is deprecated.  Simply include @FT_CACHE_H to have all\r\n   *   small bitmaps-related cache declarations.\r\n   *\r\n   */\r\n#define FT_CACHE_SMALL_BITMAPS_H  FT_CACHE_H\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_CACHE_CHARMAP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   `charmap' API of the FreeType~2 cache sub-system.\r\n   *\r\n   *   This macro is deprecated.  Simply include @FT_CACHE_H to have all\r\n   *   charmap-based cache declarations.\r\n   *\r\n   */\r\n#define FT_CACHE_CHARMAP_H  FT_CACHE_H\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MAC_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   Macintosh-specific FreeType~2 API.  The latter is used to access\r\n   *   fonts embedded in resource forks.\r\n   *\r\n   *   This header file must be explicitly included by client applications\r\n   *   compiled on the Mac (note that the base API still works though).\r\n   *\r\n   */\r\n#define FT_MAC_H  <freetype/ftmac.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_MULTIPLE_MASTERS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional multiple-masters management API of FreeType~2.\r\n   *\r\n   */\r\n#define FT_MULTIPLE_MASTERS_H  <freetype/ftmm.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SFNT_NAMES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional FreeType~2 API which accesses embedded `name' strings in\r\n   *   SFNT-based font formats (i.e., TrueType and OpenType).\r\n   *\r\n   */\r\n#define FT_SFNT_NAMES_H  <freetype/ftsnames.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_OPENTYPE_VALIDATE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional FreeType~2 API which validates OpenType tables (BASE, GDEF,\r\n   *   GPOS, GSUB, JSTF).\r\n   *\r\n   */\r\n#define FT_OPENTYPE_VALIDATE_H  <freetype/ftotval.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GX_VALIDATE_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,\r\n   *   mort, morx, bsln, just, kern, opbd, trak, prop).\r\n   *\r\n   */\r\n#define FT_GX_VALIDATE_H  <freetype/ftgxval.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_PFR_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which accesses PFR-specific data.\r\n   *\r\n   */\r\n#define FT_PFR_H  <freetype/ftpfr.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_STROKER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which provides functions to stroke outline paths.\r\n   */\r\n#define FT_STROKER_H  <freetype/ftstroke.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SYNTHESIS_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs artificial obliquing and emboldening.\r\n   */\r\n#define FT_SYNTHESIS_H  <freetype/ftsynth.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_XFREE86_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which provides functions specific to the XFree86 and\r\n   *   X.Org X11 servers.\r\n   */\r\n#define FT_XFREE86_H  <freetype/ftxf86.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_TRIGONOMETRY_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs trigonometric computations (e.g.,\r\n   *   cosines and arc tangents).\r\n   */\r\n#define FT_TRIGONOMETRY_H  <freetype/fttrigon.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LCD_FILTER_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs color filtering for subpixel rendering.\r\n   */\r\n#define FT_LCD_FILTER_H  <freetype/ftlcdfil.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_UNPATENTED_HINTING_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs color filtering for subpixel rendering.\r\n   */\r\n#define FT_UNPATENTED_HINTING_H  <freetype/ttunpat.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_INCREMENTAL_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which performs color filtering for subpixel rendering.\r\n   */\r\n#define FT_INCREMENTAL_H  <freetype/ftincrem.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_GASP_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which returns entries from the TrueType GASP table.\r\n   */\r\n#define FT_GASP_H  <freetype/ftgasp.h>\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ADVANCES_H\r\n   *\r\n   * @description:\r\n   *   A macro used in #include statements to name the file containing the\r\n   *   FreeType~2 API which returns individual and ranged glyph advances.\r\n   */\r\n#define FT_ADVANCES_H  <freetype/ftadvanc.h>\r\n\r\n\r\n  /* */\r\n\r\n#define FT_ERROR_DEFINITIONS_H  <freetype/fterrdef.h>\r\n\r\n\r\n  /* The internals of the cache sub-system are no longer exposed.  We */\r\n  /* default to FT_CACHE_H at the moment just in case, but we know of */\r\n  /* no rogue client that uses them.                                  */\r\n  /*                                                                  */\r\n#define FT_CACHE_MANAGER_H           <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_MRU_H      <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_MANAGER_H  <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_CACHE_H    <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_GLYPH_H    <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_IMAGE_H    <freetype/ftcache.h>\r\n#define FT_CACHE_INTERNAL_SBITS_H    <freetype/ftcache.h>\r\n\r\n\r\n#define FT_INCREMENTAL_H          <freetype/ftincrem.h>\r\n\r\n#define FT_TRUETYPE_UNPATENTED_H  <freetype/ttunpat.h>\r\n\r\n\r\n  /*\r\n   * Include internal headers definitions from <freetype/internal/...>\r\n   * only when building the library.\r\n   */\r\n#ifdef FT2_BUILD_LIBRARY\r\n#define  FT_INTERNAL_INTERNAL_H  <freetype/internal/internal.h>\r\n#include FT_INTERNAL_INTERNAL_H\r\n#endif /* FT2_BUILD_LIBRARY */\r\n\r\n\r\n#endif /* __FT2_BUILD_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/config/ftmodule.h",
    "content": "/*\r\n *  This file registers the FreeType modules compiled into the library.\r\n *\r\n *  If you use GNU make, this file IS NOT USED!  Instead, it is created in\r\n *  the objects directory (normally `<topdir>/objs/') based on information\r\n *  from `<topdir>/modules.cfg'.\r\n *\r\n *  Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile\r\n *  FreeType without GNU make.\r\n *\r\n */\r\n\r\n//FT_USE_MODULE( FT_Module_Class, autofit_module_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )\r\nFT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )\r\n//FT_USE_MODULE( FT_Module_Class, psaux_module_class )\r\nFT_USE_MODULE( FT_Module_Class, psnames_module_class )\r\nFT_USE_MODULE( FT_Module_Class, pshinter_module_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )\r\nFT_USE_MODULE( FT_Module_Class, sfnt_module_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )\r\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )\r\n//FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )\r\n\r\n/* EOF */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/config/ftoption.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftoption.h                                                             */\r\n/*                                                                         */\r\n/*    User-selectable configuration macros (specification only).           */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */\r\n/*            2010 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTOPTION_H__\r\n#define __FTOPTION_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                 USER-SELECTABLE CONFIGURATION MACROS                  */\r\n  /*                                                                       */\r\n  /* This file contains the default configuration macro definitions for    */\r\n  /* a standard build of the FreeType library.  There are three ways to    */\r\n  /* use this file to build project-specific versions of the library:      */\r\n  /*                                                                       */\r\n  /*  - You can modify this file by hand, but this is not recommended in   */\r\n  /*    cases where you would like to build several versions of the        */\r\n  /*    library from a single source directory.                            */\r\n  /*                                                                       */\r\n  /*  - You can put a copy of this file in your build directory, more      */\r\n  /*    precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD'   */\r\n  /*    is the name of a directory that is included _before_ the FreeType  */\r\n  /*    include path during compilation.                                   */\r\n  /*                                                                       */\r\n  /*    The default FreeType Makefiles and Jamfiles use the build          */\r\n  /*    directory `builds/<system>' by default, but you can easily change  */\r\n  /*    that for your own projects.                                        */\r\n  /*                                                                       */\r\n  /*  - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it    */\r\n  /*    slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to       */\r\n  /*    locate this file during the build.  For example,                   */\r\n  /*                                                                       */\r\n  /*      #define FT_CONFIG_OPTIONS_H  <myftoptions.h>                     */\r\n  /*      #include <freetype/config/ftheader.h>                            */\r\n  /*                                                                       */\r\n  /*    will use `$BUILD/myftoptions.h' instead of this file for macro     */\r\n  /*    definitions.                                                       */\r\n  /*                                                                       */\r\n  /*    Note also that you can similarly pre-define the macro              */\r\n  /*    FT_CONFIG_MODULES_H used to locate the file listing of the modules */\r\n  /*    that are statically linked to the library at compile time.  By     */\r\n  /*    default, this file is <freetype/config/ftmodule.h>.                */\r\n  /*                                                                       */\r\n  /*  We highly recommend using the third method whenever possible.        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /**** G E N E R A L   F R E E T Y P E   2   C O N F I G U R A T I O N ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Uncomment the line below if you want to activate sub-pixel rendering  */\r\n  /* (a.k.a. LCD rendering, or ClearType) in this build of the library.    */\r\n  /*                                                                       */\r\n  /* Note that this feature is covered by several Microsoft patents        */\r\n  /* and should not be activated in any default build of the library.      */\r\n  /*                                                                       */\r\n  /* This macro has no impact on the FreeType API, only on its             */\r\n  /* _implementation_.  For example, using FT_RENDER_MODE_LCD when calling */\r\n  /* FT_Render_Glyph still generates a bitmap that is 3 times wider than   */\r\n  /* the original size in case this macro isn't defined; however, each     */\r\n  /* triplet of subpixels has R=G=B.                                       */\r\n  /*                                                                       */\r\n  /* This is done to allow FreeType clients to run unmodified, forcing     */\r\n  /* them to display normal gray-level anti-aliased glyphs.                */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Many compilers provide a non-ANSI 64-bit data type that can be used   */\r\n  /* by FreeType to speed up some computations.  However, this will create */\r\n  /* some problems when compiling the library in strict ANSI mode.         */\r\n  /*                                                                       */\r\n  /* For this reason, the use of 64-bit integers is normally disabled when */\r\n  /* the __STDC__ macro is defined.  You can however disable this by       */\r\n  /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here.                 */\r\n  /*                                                                       */\r\n  /* For most compilers, this will only create compilation warnings when   */\r\n  /* building the library.                                                 */\r\n  /*                                                                       */\r\n  /* ObNote: The compiler-specific 64-bit integers are detected in the     */\r\n  /*         file `ftconfig.h' either statically or through the            */\r\n  /*         `configure' script on supported platforms.                    */\r\n  /*                                                                       */\r\n#undef FT_CONFIG_OPTION_FORCE_INT64\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* If this macro is defined, do not try to use an assembler version of   */\r\n  /* performance-critical functions (e.g. FT_MulFix).  You should only do  */\r\n  /* that to verify that the assembler function works properly, or to      */\r\n  /* execute benchmark tests of the various implementations.               */\r\n/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* If this macro is defined, try to use an inlined assembler version of  */\r\n  /* the `FT_MulFix' function, which is a `hotspot' when loading and       */\r\n  /* hinting glyphs, and which should be executed as fast as possible.     */\r\n  /*                                                                       */\r\n  /* Note that if your compiler or CPU is not supported, this will default */\r\n  /* to the standard and portable implementation found in `ftcalc.c'.      */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_INLINE_MULFIX\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* LZW-compressed file support.                                          */\r\n  /*                                                                       */\r\n  /*   FreeType now handles font files that have been compressed with the  */\r\n  /*   `compress' program.  This is mostly used to parse many of the PCF   */\r\n  /*   files that come with various X11 distributions.  The implementation */\r\n  /*   uses NetBSD's `zopen' to partially uncompress the file on the fly   */\r\n  /*   (see src/lzw/ftgzip.c).                                             */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want to enable this `feature'.             */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_USE_LZW\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Gzip-compressed file support.                                         */\r\n  /*                                                                       */\r\n  /*   FreeType now handles font files that have been compressed with the  */\r\n  /*   `gzip' program.  This is mostly used to parse many of the PCF files */\r\n  /*   that come with XFree86.  The implementation uses `zlib' to          */\r\n  /*   partially uncompress the file on the fly (see src/gzip/ftgzip.c).   */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want to enable this `feature'.  See also   */\r\n  /*   the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below.                       */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_USE_ZLIB\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* ZLib library selection                                                */\r\n  /*                                                                       */\r\n  /*   This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined.  */\r\n  /*   It allows FreeType's `ftgzip' component to link to the system's     */\r\n  /*   installation of the ZLib library.  This is useful on systems like   */\r\n  /*   Unix or VMS where it generally is already available.                */\r\n  /*                                                                       */\r\n  /*   If you let it undefined, the component will use its own copy        */\r\n  /*   of the zlib sources instead.  These have been modified to be        */\r\n  /*   included directly within the component and *not* export external    */\r\n  /*   function names.  This allows you to link any program with FreeType  */\r\n  /*   _and_ ZLib without linking conflicts.                               */\r\n  /*                                                                       */\r\n  /*   Do not #undef this macro here since the build system might define   */\r\n  /*   it for certain configurations only.                                 */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* DLL export compilation                                                */\r\n  /*                                                                       */\r\n  /*   When compiling FreeType as a DLL, some systems/compilers need a     */\r\n  /*   special keyword in front OR after the return type of function       */\r\n  /*   declarations.                                                       */\r\n  /*                                                                       */\r\n  /*   Two macros are used within the FreeType source code to define       */\r\n  /*   exported library functions: FT_EXPORT and FT_EXPORT_DEF.            */\r\n  /*                                                                       */\r\n  /*     FT_EXPORT( return_type )                                          */\r\n  /*                                                                       */\r\n  /*       is used in a function declaration, as in                        */\r\n  /*                                                                       */\r\n  /*         FT_EXPORT( FT_Error )                                         */\r\n  /*         FT_Init_FreeType( FT_Library*  alibrary );                    */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*     FT_EXPORT_DEF( return_type )                                      */\r\n  /*                                                                       */\r\n  /*       is used in a function definition, as in                         */\r\n  /*                                                                       */\r\n  /*         FT_EXPORT_DEF( FT_Error )                                     */\r\n  /*         FT_Init_FreeType( FT_Library*  alibrary )                     */\r\n  /*         {                                                             */\r\n  /*           ... some code ...                                           */\r\n  /*           return FT_Err_Ok;                                           */\r\n  /*         }                                                             */\r\n  /*                                                                       */\r\n  /*   You can provide your own implementation of FT_EXPORT and            */\r\n  /*   FT_EXPORT_DEF here if you want.  If you leave them undefined, they  */\r\n  /*   will be later automatically defined as `extern return_type' to      */\r\n  /*   allow normal compilation.                                           */\r\n  /*                                                                       */\r\n  /*   Do not #undef these macros here since the build system might define */\r\n  /*   them for certain configurations only.                               */\r\n  /*                                                                       */\r\n/* #define FT_EXPORT(x)      extern x */\r\n/* #define FT_EXPORT_DEF(x)  x */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Glyph Postscript Names handling                                       */\r\n  /*                                                                       */\r\n  /*   By default, FreeType 2 is compiled with the `psnames' module.  This */\r\n  /*   module is in charge of converting a glyph name string into a        */\r\n  /*   Unicode value, or return a Macintosh standard glyph name for the    */\r\n  /*   use with the TrueType `post' table.                                 */\r\n  /*                                                                       */\r\n  /*   Undefine this macro if you do not want `psnames' compiled in your   */\r\n  /*   build of FreeType.  This has the following effects:                 */\r\n  /*                                                                       */\r\n  /*   - The TrueType driver will provide its own set of glyph names,      */\r\n  /*     if you build it to support postscript names in the TrueType       */\r\n  /*     `post' table.                                                     */\r\n  /*                                                                       */\r\n  /*   - The Type 1 driver will not be able to synthesize a Unicode        */\r\n  /*     charmap out of the glyphs found in the fonts.                     */\r\n  /*                                                                       */\r\n  /*   You would normally undefine this configuration macro when building  */\r\n  /*   a version of FreeType that doesn't contain a Type 1 or CFF driver.  */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Postscript Names to Unicode Values support                            */\r\n  /*                                                                       */\r\n  /*   By default, FreeType 2 is built with the `PSNames' module compiled  */\r\n  /*   in.  Among other things, the module is used to convert a glyph name */\r\n  /*   into a Unicode value.  This is especially useful in order to        */\r\n  /*   synthesize on the fly a Unicode charmap from the CFF/Type 1 driver  */\r\n  /*   through a big table named the `Adobe Glyph List' (AGL).             */\r\n  /*                                                                       */\r\n  /*   Undefine this macro if you do not want the Adobe Glyph List         */\r\n  /*   compiled in your `PSNames' module.  The Type 1 driver will not be   */\r\n  /*   able to synthesize a Unicode charmap out of the glyphs found in the */\r\n  /*   fonts.                                                              */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Support for Mac fonts                                                 */\r\n  /*                                                                       */\r\n  /*   Define this macro if you want support for outline fonts in Mac      */\r\n  /*   format (mac dfont, mac resource, macbinary containing a mac         */\r\n  /*   resource) on non-Mac platforms.                                     */\r\n  /*                                                                       */\r\n  /*   Note that the `FOND' resource isn't checked.                        */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_MAC_FONTS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Guessing methods to access embedded resource forks                    */\r\n  /*                                                                       */\r\n  /*   Enable extra Mac fonts support on non-Mac platforms (e.g.           */\r\n  /*   GNU/Linux).                                                         */\r\n  /*                                                                       */\r\n  /*   Resource forks which include fonts data are stored sometimes in     */\r\n  /*   locations which users or developers don't expected.  In some cases, */\r\n  /*   resource forks start with some offset from the head of a file.  In  */\r\n  /*   other cases, the actual resource fork is stored in file different   */\r\n  /*   from what the user specifies.  If this option is activated,         */\r\n  /*   FreeType tries to guess whether such offsets or different file      */\r\n  /*   names must be used.                                                 */\r\n  /*                                                                       */\r\n  /*   Note that normal, direct access of resource forks is controlled via */\r\n  /*   the FT_CONFIG_OPTION_MAC_FONTS option.                              */\r\n  /*                                                                       */\r\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\r\n#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Allow the use of FT_Incremental_Interface to load typefaces that      */\r\n  /* contain no glyph data, but supply it via a callback function.         */\r\n  /* This is required by clients supporting document formats which         */\r\n  /* supply font data incrementally as the document is parsed, such        */\r\n  /* as the Ghostscript interpreter for the PostScript language.           */\r\n  /*                                                                       */\r\n#define FT_CONFIG_OPTION_INCREMENTAL\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The size in bytes of the render pool used by the scan-line converter  */\r\n  /* to do all of its work.                                                */\r\n  /*                                                                       */\r\n  /* This must be greater than 4KByte if you use FreeType to rasterize     */\r\n  /* glyphs; otherwise, you may set it to zero to avoid unnecessary        */\r\n  /* allocation of the render pool.                                        */\r\n  /*                                                                       */\r\n#define FT_RENDER_POOL_SIZE  16384L\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FT_MAX_MODULES                                                        */\r\n  /*                                                                       */\r\n  /*   The maximum number of modules that can be registered in a single    */\r\n  /*   FreeType library object.  32 is the default.                        */\r\n  /*                                                                       */\r\n#define FT_MAX_MODULES  32\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Debug level                                                           */\r\n  /*                                                                       */\r\n  /*   FreeType can be compiled in debug or trace mode.  In debug mode,    */\r\n  /*   errors are reported through the `ftdebug' component.  In trace      */\r\n  /*   mode, additional messages are sent to the standard output during    */\r\n  /*   execution.                                                          */\r\n  /*                                                                       */\r\n  /*   Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode.     */\r\n  /*   Define FT_DEBUG_LEVEL_TRACE to build it in trace mode.              */\r\n  /*                                                                       */\r\n  /*   Don't define any of these macros to compile in `release' mode!      */\r\n  /*                                                                       */\r\n  /*   Do not #undef these macros here since the build system might define */\r\n  /*   them for certain configurations only.                               */\r\n  /*                                                                       */\r\n/* #define FT_DEBUG_LEVEL_ERROR */\r\n/* #define FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Memory Debugging                                                      */\r\n  /*                                                                       */\r\n  /*   FreeType now comes with an integrated memory debugger that is       */\r\n  /*   capable of detecting simple errors like memory leaks or double      */\r\n  /*   deletes.  To compile it within your build of the library, you       */\r\n  /*   should define FT_DEBUG_MEMORY here.                                 */\r\n  /*                                                                       */\r\n  /*   Note that the memory debugger is only activated at runtime when     */\r\n  /*   when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */\r\n  /*                                                                       */\r\n  /*   Do not #undef this macro here since the build system might define   */\r\n  /*   it for certain configurations only.                                 */\r\n  /*                                                                       */\r\n/* #define FT_DEBUG_MEMORY */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Module errors                                                         */\r\n  /*                                                                       */\r\n  /*   If this macro is set (which is _not_ the default), the higher byte  */\r\n  /*   of an error code gives the module in which the error has occurred,  */\r\n  /*   while the lower byte is the real error code.                        */\r\n  /*                                                                       */\r\n  /*   Setting this macro makes sense for debugging purposes only, since   */\r\n  /*   it would break source compatibility of certain programs that use    */\r\n  /*   FreeType 2.                                                         */\r\n  /*                                                                       */\r\n  /*   More details can be found in the files ftmoderr.h and fterrors.h.   */\r\n  /*                                                                       */\r\n#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Position Independent Code                                             */\r\n  /*                                                                       */\r\n  /*   If this macro is set (which is _not_ the default), FreeType2 will   */\r\n  /*   avoid creating constants that require address fixups.  Instead the  */\r\n  /*   constants will be moved into a struct and additional intialization  */\r\n  /*   code will be used.                                                  */\r\n  /*                                                                       */\r\n  /*   Setting this macro is needed for systems that prohibit address      */\r\n  /*   fixups, such as BREW.                                               */\r\n  /*                                                                       */\r\n/* #define FT_CONFIG_OPTION_PIC */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****        S F N T   D R I V E R    C O N F I G U R A T I O N       ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support       */\r\n  /* embedded bitmaps in all formats using the SFNT module (namely         */\r\n  /* TrueType & OpenType).                                                 */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to    */\r\n  /* load and enumerate the glyph Postscript names in a TrueType or        */\r\n  /* OpenType file.                                                        */\r\n  /*                                                                       */\r\n  /* Note that when you do not compile the `PSNames' module by undefining  */\r\n  /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will   */\r\n  /* contain additional code used to read the PS Names table from a font.  */\r\n  /*                                                                       */\r\n  /* (By default, the module uses `PSNames' to extract glyph names.)       */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to       */\r\n  /* access the internal name table in a SFNT-based format like TrueType   */\r\n  /* or OpenType.  The name table contains various strings used to         */\r\n  /* describe the font, like family name, copyright, version, etc.  It     */\r\n  /* does not contain any glyph name though.                               */\r\n  /*                                                                       */\r\n  /* Accessing SFNT names is done through the functions declared in        */\r\n  /* `freetype/ftsnames.h'.                                                */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_SFNT_NAMES\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* TrueType CMap support                                                 */\r\n  /*                                                                       */\r\n  /*   Here you can fine-tune which TrueType CMap table format shall be    */\r\n  /*   supported.                                                          */\r\n#define TT_CONFIG_CMAP_FORMAT_0\r\n#define TT_CONFIG_CMAP_FORMAT_2\r\n#define TT_CONFIG_CMAP_FORMAT_4\r\n#define TT_CONFIG_CMAP_FORMAT_6\r\n#define TT_CONFIG_CMAP_FORMAT_8\r\n#define TT_CONFIG_CMAP_FORMAT_10\r\n#define TT_CONFIG_CMAP_FORMAT_12\r\n#define TT_CONFIG_CMAP_FORMAT_13\r\n#define TT_CONFIG_CMAP_FORMAT_14\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****    T R U E T Y P E   D R I V E R    C O N F I G U R A T I O N   ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile   */\r\n  /* a bytecode interpreter in the TrueType driver.                        */\r\n  /*                                                                       */\r\n  /* By undefining this, you will only compile the code necessary to load  */\r\n  /* TrueType glyphs without hinting.                                      */\r\n  /*                                                                       */\r\n  /*   Do not #undef this macro here, since the build system might         */\r\n  /*   define it for certain configurations only.                          */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */\r\n  /* of the TrueType bytecode interpreter is used that doesn't implement   */\r\n  /* any of the patented opcodes and algorithms.  The patents related to   */\r\n  /* TrueType hinting have expired worldwide since May 2010; this option   */\r\n  /* is now deprecated.                                                    */\r\n  /*                                                                       */\r\n  /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored*  */\r\n  /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words,  */\r\n  /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                */\r\n  /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */\r\n  /*                                                                       */\r\n  /* This macro is only useful for a small number of font files (mostly    */\r\n  /* for Asian scripts) that require bytecode interpretation to properly   */\r\n  /* load glyphs.  For all other fonts, this produces unpleasant results,  */\r\n  /* thus the unpatented interpreter is never used to load glyphs from     */\r\n  /* TrueType fonts unless one of the following two options is used.       */\r\n  /*                                                                       */\r\n  /*   - The unpatented interpreter is explicitly activated by the user    */\r\n  /*     through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag         */\r\n  /*     when opening the FT_Face.                                         */\r\n  /*                                                                       */\r\n  /*   - FreeType detects that the FT_Face corresponds to one of the       */\r\n  /*     `trick' fonts (e.g., `Mingliu') it knows about.  The font engine  */\r\n  /*     contains a hard-coded list of font names and other matching       */\r\n  /*     parameters (see function `tt_face_init' in file                   */\r\n  /*     `src/truetype/ttobjs.c').                                         */\r\n  /*                                                                       */\r\n  /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */\r\n  /*                                                                       */\r\n  /*   {                                                                   */\r\n  /*     FT_Parameter  parameter;                                          */\r\n  /*     FT_Open_Args  open_args;                                          */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*     parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING;                  */\r\n  /*                                                                       */\r\n  /*     open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;         */\r\n  /*     open_args.pathname   = my_font_pathname;                          */\r\n  /*     open_args.num_params = 1;                                         */\r\n  /*     open_args.params     = &parameter;                                */\r\n  /*                                                                       */\r\n  /*     error = FT_Open_Face( library, &open_args, index, &face );        */\r\n  /*     ...                                                               */\r\n  /*   }                                                                   */\r\n  /*                                                                       */\r\n/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType    */\r\n  /* bytecode interpreter with a huge switch statement, rather than a call */\r\n  /* table.  This results in smaller and faster code for a number of       */\r\n  /* architectures.                                                        */\r\n  /*                                                                       */\r\n  /* Note however that on some compiler/processor combinations, undefining */\r\n  /* this macro will generate faster, though larger, code.                 */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_INTERPRETER_SWITCH\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the        */\r\n  /* TrueType glyph loader to use Apple's definition of how to handle      */\r\n  /* component offsets in composite glyphs.                                */\r\n  /*                                                                       */\r\n  /* Apple and MS disagree on the default behavior of component offsets    */\r\n  /* in composites.  Apple says that they should be scaled by the scaling  */\r\n  /* factors in the transformation matrix (roughly, it's more complex)     */\r\n  /* while MS says they should not.  OpenType defines two bits in the      */\r\n  /* composite flags array which can be used to disambiguate, but old      */\r\n  /* fonts will not have them.                                             */\r\n  /*                                                                       */\r\n  /*   http://partners.adobe.com/asn/developer/opentype/glyf.html          */\r\n  /*   http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html                 */\r\n  /*                                                                       */\r\n#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include         */\r\n  /* support for Apple's distortable font technology (fvar, gvar, cvar,    */\r\n  /* and avar tables).  This has many similarities to Type 1 Multiple      */\r\n  /* Masters support.                                                      */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define TT_CONFIG_OPTION_BDF if you want to include support for        */\r\n  /* an embedded `BDF ' table within SFNT-based bitmap formats.            */\r\n  /*                                                                       */\r\n#define TT_CONFIG_OPTION_BDF\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****      T Y P E 1   D R I V E R    C O N F I G U R A T I O N       ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and       */\r\n  /* arrays in the Type 1 stream (see t1load.c).  A minimum of 4 is        */\r\n  /* required.                                                             */\r\n  /*                                                                       */\r\n#define T1_MAX_DICT_DEPTH  5\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine   */\r\n  /* calls during glyph loading.                                           */\r\n  /*                                                                       */\r\n#define T1_MAX_SUBRS_CALLS  16\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity.  A     */\r\n  /* minimum of 16 is required.                                            */\r\n  /*                                                                       */\r\n  /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */\r\n  /*                                                                       */\r\n#define T1_MAX_CHARSTRINGS_OPERANDS  256\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define this configuration macro if you want to prevent the            */\r\n  /* compilation of `t1afm', which is in charge of reading Type 1 AFM      */\r\n  /* files into an existing face.  Note that if set, the T1 driver will be */\r\n  /* unable to produce kerning distances.                                  */\r\n  /*                                                                       */\r\n#undef T1_CONFIG_OPTION_NO_AFM\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define this configuration macro if you want to prevent the            */\r\n  /* compilation of the Multiple Masters font support in the Type 1        */\r\n  /* driver.                                                               */\r\n  /*                                                                       */\r\n#undef T1_CONFIG_OPTION_NO_MM_SUPPORT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****    A U T O F I T   M O D U L E    C O N F I G U R A T I O N     ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Compile autofit module with CJK (Chinese, Japanese, Korean) script    */\r\n  /* support.                                                              */\r\n  /*                                                                       */\r\n#define AF_CONFIG_OPTION_CJK\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Compile autofit module with Indic script support.                     */\r\n  /*                                                                       */\r\n#define AF_CONFIG_OPTION_INDIC\r\n\r\n  /* */\r\n\r\n\r\n  /*\r\n   * Define this variable if you want to keep the layout of internal\r\n   * structures that was used prior to FreeType 2.2.  This also compiles in\r\n   * a few obsolete functions to avoid linking problems on typical Unix\r\n   * distributions.\r\n   *\r\n   * For embedded systems or building a new distribution from scratch, it\r\n   * is recommended to disable the macro since it reduces the library's code\r\n   * size and activates a few memory-saving optimizations as well.\r\n   */\r\n#define FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n\r\n  /*\r\n   *  To detect legacy cache-lookup call from a rogue client (<= 2.1.7),\r\n   *  we restrict the number of charmaps in a font.  The current API of\r\n   *  FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API\r\n   *  takes charcode only.  To determine the passed value is for cmap_index\r\n   *  or charcode, the possible cmap_index is restricted not to exceed\r\n   *  the minimum possible charcode by a rogue client.  It is also very\r\n   *  unlikely that a rogue client is interested in Unicode values 0 to 15.\r\n   *\r\n   *  NOTE: The original threshold was 4 deduced from popular number of\r\n   *        cmap subtables in UCS-4 TrueType fonts, but now it is not\r\n   *        irregular for OpenType fonts to have more than 4 subtables,\r\n   *        because variation selector subtables are available for Apple\r\n   *        and Microsoft platforms.\r\n   */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_MAX_CHARMAP_CACHEABLE 15\r\n#endif\r\n\r\n\r\n  /*\r\n   * This macro is defined if either unpatented or native TrueType\r\n   * hinting is requested by the definitions above.\r\n   */\r\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\r\n#define  TT_USE_BYTECODE_INTERPRETER\r\n#undef   TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n#define  TT_USE_BYTECODE_INTERPRETER\r\n#endif\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTOPTION_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/config/ftstdlib.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstdlib.h                                                             */\r\n/*                                                                         */\r\n/*    ANSI-specific library and header configuration file (specification   */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to group all #includes to the ANSI C library that   */\r\n  /* FreeType normally requires.  It also defines macros to rename the     */\r\n  /* standard functions within the FreeType source code.                   */\r\n  /*                                                                       */\r\n  /* Load a file which defines __FTSTDLIB_H__ before this one to override  */\r\n  /* it.                                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTSTDLIB_H__\r\n#define __FTSTDLIB_H__\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#define ft_ptrdiff_t  ptrdiff_t\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                           integer limits                           */\r\n  /*                                                                    */\r\n  /* UINT_MAX and ULONG_MAX are used to automatically compute the size  */\r\n  /* of `int' and `long' in bytes at compile-time.  So far, this works  */\r\n  /* for all platforms the library has been tested on.                  */\r\n  /*                                                                    */\r\n  /* Note that on the extremely rare platforms that do not provide      */\r\n  /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some    */\r\n  /* old Crays where `int' is 36 bits), we do not make any guarantee    */\r\n  /* about the correct behaviour of FT2 with all fonts.                 */\r\n  /*                                                                    */\r\n  /* In these case, `ftconfig.h' will refuse to compile anyway with a   */\r\n  /* message like `couldn't find 32-bit type' or something similar.     */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <limits.h>\r\n\r\n#define FT_CHAR_BIT   CHAR_BIT\r\n#define FT_INT_MAX    INT_MAX\r\n#define FT_INT_MIN    INT_MIN\r\n#define FT_UINT_MAX   UINT_MAX\r\n#define FT_ULONG_MAX  ULONG_MAX\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                 character and string processing                    */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <string.h>\r\n\r\n#define ft_memchr   memchr\r\n#define ft_memcmp   memcmp\r\n#define ft_memcpy   memcpy\r\n#define ft_memmove  memmove\r\n#define ft_memset   memset\r\n#define ft_strcat   strcat\r\n#define ft_strcmp   strcmp\r\n#define ft_strcpy   strcpy\r\n#define ft_strlen   strlen\r\n#define ft_strncmp  strncmp\r\n#define ft_strncpy  strncpy\r\n#define ft_strrchr  strrchr\r\n#define ft_strstr   strstr\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                           file handling                            */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <stdio.h>\r\n\r\n#define FT_FILE     FILE\r\n#define ft_fclose   fclose\r\n#define ft_fopen    fopen\r\n#define ft_fread    fread\r\n#define ft_fseek    fseek\r\n#define ft_ftell    ftell\r\n#define ft_sprintf  sprintf\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                             sorting                                */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <stdlib.h>\r\n\r\n#define ft_qsort  qsort\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                        memory allocation                           */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#define ft_scalloc   calloc\r\n#define ft_sfree     free\r\n#define ft_smalloc   malloc\r\n#define ft_srealloc  realloc\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                          miscellaneous                             */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#define ft_atol   atol\r\n#define ft_labs   labs\r\n\r\n\r\n  /**********************************************************************/\r\n  /*                                                                    */\r\n  /*                         execution control                          */\r\n  /*                                                                    */\r\n  /**********************************************************************/\r\n\r\n\r\n#include <setjmp.h>\r\n\r\n#define ft_jmp_buf     jmp_buf  /* note: this cannot be a typedef since */\r\n                                /*       jmp_buf is defined as a macro  */\r\n                                /*       on certain platforms           */\r\n\r\n#define ft_longjmp     longjmp\r\n#define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) )    /* same thing here */\r\n\r\n\r\n  /* the following is only used for debugging purposes, i.e., if */\r\n  /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined    */\r\n\r\n#include <stdarg.h>\r\n\r\n\r\n#endif /* __FTSTDLIB_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/freetype.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  freetype.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType high-level API and common types (specification only).       */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */\r\n/*            2010 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef FT_FREETYPE_H\r\n#error \"`ft2build.h' hasn't been included yet!\"\r\n#error \"Please always use macros to include FreeType header files.\"\r\n#error \"Example:\"\r\n#error \"  #include <ft2build.h>\"\r\n#error \"  #include FT_FREETYPE_H\"\r\n#endif\r\n\r\n\r\n#ifndef __FREETYPE_H__\r\n#define __FREETYPE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_ERRORS_H\r\n#include FT_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    user_allocation                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    User allocation                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How client applications should allocate FreeType data structures.  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType assumes that structures allocated by the user and passed  */\r\n  /*    as arguments are zeroed out except for the actual data.  In other  */\r\n  /*    words, it is recommended to use `calloc' (or variants of it)       */\r\n  /*    instead of `malloc' for allocation.                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                        B A S I C   T Y P E S                          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    base_interface                                                     */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Base Interface                                                     */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    The FreeType~2 base font interface.                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section describes the public high-level API of FreeType~2.    */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_Library                                                         */\r\n  /*    FT_Face                                                            */\r\n  /*    FT_Size                                                            */\r\n  /*    FT_GlyphSlot                                                       */\r\n  /*    FT_CharMap                                                         */\r\n  /*    FT_Encoding                                                        */\r\n  /*                                                                       */\r\n  /*    FT_FaceRec                                                         */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_SCALABLE                                              */\r\n  /*    FT_FACE_FLAG_FIXED_SIZES                                           */\r\n  /*    FT_FACE_FLAG_FIXED_WIDTH                                           */\r\n  /*    FT_FACE_FLAG_HORIZONTAL                                            */\r\n  /*    FT_FACE_FLAG_VERTICAL                                              */\r\n  /*    FT_FACE_FLAG_SFNT                                                  */\r\n  /*    FT_FACE_FLAG_KERNING                                               */\r\n  /*    FT_FACE_FLAG_MULTIPLE_MASTERS                                      */\r\n  /*    FT_FACE_FLAG_GLYPH_NAMES                                           */\r\n  /*    FT_FACE_FLAG_EXTERNAL_STREAM                                       */\r\n  /*    FT_FACE_FLAG_FAST_GLYPHS                                           */\r\n  /*    FT_FACE_FLAG_HINTER                                                */\r\n  /*                                                                       */\r\n  /*    FT_STYLE_FLAG_BOLD                                                 */\r\n  /*    FT_STYLE_FLAG_ITALIC                                               */\r\n  /*                                                                       */\r\n  /*    FT_SizeRec                                                         */\r\n  /*    FT_Size_Metrics                                                    */\r\n  /*                                                                       */\r\n  /*    FT_GlyphSlotRec                                                    */\r\n  /*    FT_Glyph_Metrics                                                   */\r\n  /*    FT_SubGlyph                                                        */\r\n  /*                                                                       */\r\n  /*    FT_Bitmap_Size                                                     */\r\n  /*                                                                       */\r\n  /*    FT_Init_FreeType                                                   */\r\n  /*    FT_Done_FreeType                                                   */\r\n  /*                                                                       */\r\n  /*    FT_New_Face                                                        */\r\n  /*    FT_Done_Face                                                       */\r\n  /*    FT_New_Memory_Face                                                 */\r\n  /*    FT_Open_Face                                                       */\r\n  /*    FT_Open_Args                                                       */\r\n  /*    FT_Parameter                                                       */\r\n  /*    FT_Attach_File                                                     */\r\n  /*    FT_Attach_Stream                                                   */\r\n  /*                                                                       */\r\n  /*    FT_Set_Char_Size                                                   */\r\n  /*    FT_Set_Pixel_Sizes                                                 */\r\n  /*    FT_Request_Size                                                    */\r\n  /*    FT_Select_Size                                                     */\r\n  /*    FT_Size_Request_Type                                               */\r\n  /*    FT_Size_Request                                                    */\r\n  /*    FT_Set_Transform                                                   */\r\n  /*    FT_Load_Glyph                                                      */\r\n  /*    FT_Get_Char_Index                                                  */\r\n  /*    FT_Get_Name_Index                                                  */\r\n  /*    FT_Load_Char                                                       */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_MEMORY                                                     */\r\n  /*    FT_OPEN_STREAM                                                     */\r\n  /*    FT_OPEN_PATHNAME                                                   */\r\n  /*    FT_OPEN_DRIVER                                                     */\r\n  /*    FT_OPEN_PARAMS                                                     */\r\n  /*                                                                       */\r\n  /*    FT_LOAD_DEFAULT                                                    */\r\n  /*    FT_LOAD_RENDER                                                     */\r\n  /*    FT_LOAD_MONOCHROME                                                 */\r\n  /*    FT_LOAD_LINEAR_DESIGN                                              */\r\n  /*    FT_LOAD_NO_SCALE                                                   */\r\n  /*    FT_LOAD_NO_HINTING                                                 */\r\n  /*    FT_LOAD_NO_BITMAP                                                  */\r\n  /*    FT_LOAD_CROP_BITMAP                                                */\r\n  /*                                                                       */\r\n  /*    FT_LOAD_VERTICAL_LAYOUT                                            */\r\n  /*    FT_LOAD_IGNORE_TRANSFORM                                           */\r\n  /*    FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH                                */\r\n  /*    FT_LOAD_FORCE_AUTOHINT                                             */\r\n  /*    FT_LOAD_NO_RECURSE                                                 */\r\n  /*    FT_LOAD_PEDANTIC                                                   */\r\n  /*                                                                       */\r\n  /*    FT_LOAD_TARGET_NORMAL                                              */\r\n  /*    FT_LOAD_TARGET_LIGHT                                               */\r\n  /*    FT_LOAD_TARGET_MONO                                                */\r\n  /*    FT_LOAD_TARGET_LCD                                                 */\r\n  /*    FT_LOAD_TARGET_LCD_V                                               */\r\n  /*                                                                       */\r\n  /*    FT_Render_Glyph                                                    */\r\n  /*    FT_Render_Mode                                                     */\r\n  /*    FT_Get_Kerning                                                     */\r\n  /*    FT_Kerning_Mode                                                    */\r\n  /*    FT_Get_Track_Kerning                                               */\r\n  /*    FT_Get_Glyph_Name                                                  */\r\n  /*    FT_Get_Postscript_Name                                             */\r\n  /*                                                                       */\r\n  /*    FT_CharMapRec                                                      */\r\n  /*    FT_Select_Charmap                                                  */\r\n  /*    FT_Set_Charmap                                                     */\r\n  /*    FT_Get_Charmap_Index                                               */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING                                    */\r\n  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING                             */\r\n  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING                              */\r\n  /*    FT_FSTYPE_EDITABLE_EMBEDDING                                       */\r\n  /*    FT_FSTYPE_NO_SUBSETTING                                            */\r\n  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY                                    */\r\n  /*                                                                       */\r\n  /*    FT_Get_FSType_Flags                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Glyph_Metrics                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the metrics of a single glyph.  The      */\r\n  /*    values are expressed in 26.6 fractional pixel format; if the flag  */\r\n  /*    @FT_LOAD_NO_SCALE has been used while loading the glyph, values    */\r\n  /*    are expressed in font units instead.                               */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    width ::                                                           */\r\n  /*      The glyph's width.                                               */\r\n  /*                                                                       */\r\n  /*    height ::                                                          */\r\n  /*      The glyph's height.                                              */\r\n  /*                                                                       */\r\n  /*    horiBearingX ::                                                    */\r\n  /*      Left side bearing for horizontal layout.                         */\r\n  /*                                                                       */\r\n  /*    horiBearingY ::                                                    */\r\n  /*      Top side bearing for horizontal layout.                          */\r\n  /*                                                                       */\r\n  /*    horiAdvance ::                                                     */\r\n  /*      Advance width for horizontal layout.                             */\r\n  /*                                                                       */\r\n  /*    vertBearingX ::                                                    */\r\n  /*      Left side bearing for vertical layout.                           */\r\n  /*                                                                       */\r\n  /*    vertBearingY ::                                                    */\r\n  /*      Top side bearing for vertical layout.                            */\r\n  /*                                                                       */\r\n  /*    vertAdvance ::                                                     */\r\n  /*      Advance height for vertical layout.                              */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If not disabled with @FT_LOAD_NO_HINTING, the values represent     */\r\n  /*    dimensions of the hinted glyph (in case hinting is applicable).    */\r\n  /*                                                                       */\r\n  typedef struct  FT_Glyph_Metrics_\r\n  {\r\n    FT_Pos  width;\r\n    FT_Pos  height;\r\n\r\n    FT_Pos  horiBearingX;\r\n    FT_Pos  horiBearingY;\r\n    FT_Pos  horiAdvance;\r\n\r\n    FT_Pos  vertBearingX;\r\n    FT_Pos  vertBearingY;\r\n    FT_Pos  vertAdvance;\r\n\r\n  } FT_Glyph_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Bitmap_Size                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure models the metrics of a bitmap strike (i.e., a set  */\r\n  /*    of glyphs for a given point size and resolution) in a bitmap font. */\r\n  /*    It is used for the `available_sizes' field of @FT_Face.            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    height :: The vertical distance, in pixels, between two            */\r\n  /*              consecutive baselines.  It is always positive.           */\r\n  /*                                                                       */\r\n  /*    width  :: The average width, in pixels, of all glyphs in the       */\r\n  /*              strike.                                                  */\r\n  /*                                                                       */\r\n  /*    size   :: The nominal size of the strike in 26.6 fractional        */\r\n  /*              points.  This field is not very useful.                  */\r\n  /*                                                                       */\r\n  /*    x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional   */\r\n  /*              pixels.                                                  */\r\n  /*                                                                       */\r\n  /*    y_ppem :: The vertical ppem (nominal height) in 26.6 fractional    */\r\n  /*              pixels.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Windows FNT:                                                       */\r\n  /*      The nominal size given in a FNT font is not reliable.  Thus when */\r\n  /*      the driver finds it incorrect, it sets `size' to some calculated */\r\n  /*      values and sets `x_ppem' and `y_ppem' to the pixel width and     */\r\n  /*      height given in the font, respectively.                          */\r\n  /*                                                                       */\r\n  /*    TrueType embedded bitmaps:                                         */\r\n  /*      `size', `width', and `height' values are not contained in the    */\r\n  /*      bitmap strike itself.  They are computed from the global font    */\r\n  /*      parameters.                                                      */\r\n  /*                                                                       */\r\n  typedef struct  FT_Bitmap_Size_\r\n  {\r\n    FT_Short  height;\r\n    FT_Short  width;\r\n\r\n    FT_Pos    size;\r\n\r\n    FT_Pos    x_ppem;\r\n    FT_Pos    y_ppem;\r\n\r\n  } FT_Bitmap_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                     O B J E C T   C L A S S E S                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Library                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a FreeType library instance.  Each `library' is        */\r\n  /*    completely independent from the others; it is the `root' of a set  */\r\n  /*    of objects like fonts, faces, sizes, etc.                          */\r\n  /*                                                                       */\r\n  /*    It also embeds a memory manager (see @FT_Memory), as well as a     */\r\n  /*    scan-line converter object (see @FT_Raster).                       */\r\n  /*                                                                       */\r\n  /*    For multi-threading applications each thread should have its own   */\r\n  /*    FT_Library object.                                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Library objects are normally created by @FT_Init_FreeType, and     */\r\n  /*    destroyed with @FT_Done_FreeType.                                  */\r\n  /*                                                                       */\r\n  typedef struct FT_LibraryRec_  *FT_Library;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Module                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given FreeType module object.  Each module can be a  */\r\n  /*    font driver, a renderer, or anything else that provides services   */\r\n  /*    to the formers.                                                    */\r\n  /*                                                                       */\r\n  typedef struct FT_ModuleRec_*  FT_Module;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Driver                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given FreeType font driver object.  Each font driver */\r\n  /*    is a special module capable of creating faces from font files.     */\r\n  /*                                                                       */\r\n  typedef struct FT_DriverRec_*  FT_Driver;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Renderer                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given FreeType renderer.  A renderer is a special    */\r\n  /*    module in charge of converting a glyph image to a bitmap, when     */\r\n  /*    necessary.  Each renderer supports a given glyph image format, and */\r\n  /*    one or more target surface depths.                                 */\r\n  /*                                                                       */\r\n  typedef struct FT_RendererRec_*  FT_Renderer;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Face                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given typographic face object.  A face object models */\r\n  /*    a given typeface, in a given style.                                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Each face object also owns a single @FT_GlyphSlot object, as well  */\r\n  /*    as one or more @FT_Size objects.                                   */\r\n  /*                                                                       */\r\n  /*    Use @FT_New_Face or @FT_Open_Face to create a new face object from */\r\n  /*    a given filepathname or a custom input stream.                     */\r\n  /*                                                                       */\r\n  /*    Use @FT_Done_Face to destroy it (along with its slot and sizes).   */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_FaceRec for the publicly accessible fields of a given face */\r\n  /*    object.                                                            */\r\n  /*                                                                       */\r\n  typedef struct FT_FaceRec_*  FT_Face;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Size                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an object used to model a face scaled to a given       */\r\n  /*    character size.                                                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Each @FT_Face has an _active_ @FT_Size object that is used by      */\r\n  /*    functions like @FT_Load_Glyph to determine the scaling             */\r\n  /*    transformation which is used to load and hint glyphs and metrics.  */\r\n  /*                                                                       */\r\n  /*    You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes,                */\r\n  /*    @FT_Request_Size or even @FT_Select_Size to change the content     */\r\n  /*    (i.e., the scaling values) of the active @FT_Size.                 */\r\n  /*                                                                       */\r\n  /*    You can use @FT_New_Size to create additional size objects for a   */\r\n  /*    given @FT_Face, but they won't be used by other functions until    */\r\n  /*    you activate it through @FT_Activate_Size.  Only one size can be   */\r\n  /*    activated at any given time per face.                              */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_SizeRec for the publicly accessible fields of a given size */\r\n  /*    object.                                                            */\r\n  /*                                                                       */\r\n  typedef struct FT_SizeRec_*  FT_Size;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_GlyphSlot                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given `glyph slot'.  A slot is a container where it  */\r\n  /*    is possible to load any of the glyphs contained in its parent      */\r\n  /*    face.                                                              */\r\n  /*                                                                       */\r\n  /*    In other words, each time you call @FT_Load_Glyph or               */\r\n  /*    @FT_Load_Char, the slot's content is erased by the new glyph data, */\r\n  /*    i.e., the glyph's metrics, its image (bitmap or outline), and      */\r\n  /*    other control information.                                         */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_GlyphSlotRec for the publicly accessible glyph fields.     */\r\n  /*                                                                       */\r\n  typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_CharMap                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a given character map.  A charmap is used to translate */\r\n  /*    character codes in a given encoding into glyph indexes for its     */\r\n  /*    parent's face.  Some font formats may provide several charmaps per */\r\n  /*    font.                                                              */\r\n  /*                                                                       */\r\n  /*    Each face object owns zero or more charmaps, but only one of them  */\r\n  /*    can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char.   */\r\n  /*                                                                       */\r\n  /*    The list of available charmaps in a face is available through the  */\r\n  /*    `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec.   */\r\n  /*                                                                       */\r\n  /*    The currently active charmap is available as `face->charmap'.      */\r\n  /*    You should call @FT_Set_Charmap to change it.                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    When a new face is created (either through @FT_New_Face or         */\r\n  /*    @FT_Open_Face), the library looks for a Unicode charmap within     */\r\n  /*    the list and automatically activates it.                           */\r\n  /*                                                                       */\r\n  /* <Also>                                                                */\r\n  /*    See @FT_CharMapRec for the publicly accessible fields of a given   */\r\n  /*    character map.                                                     */\r\n  /*                                                                       */\r\n  typedef struct FT_CharMapRec_*  FT_CharMap;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_ENC_TAG                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro converts four-letter tags into an unsigned long.  It is */\r\n  /*    used to define `encoding' identifiers (see @FT_Encoding).          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */\r\n  /*    should redefine this macro in case of problems to something like   */\r\n  /*    this:                                                              */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      #define FT_ENC_TAG( value, a, b, c, d )  value                   */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    to get a simple enumeration without assigning special numbers.     */\r\n  /*                                                                       */\r\n\r\n#ifndef FT_ENC_TAG\r\n#define FT_ENC_TAG( value, a, b, c, d )         \\\r\n          value = ( ( (FT_UInt32)(a) << 24 ) |  \\\r\n                    ( (FT_UInt32)(b) << 16 ) |  \\\r\n                    ( (FT_UInt32)(c) <<  8 ) |  \\\r\n                      (FT_UInt32)(d)         )\r\n\r\n#endif /* FT_ENC_TAG */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Encoding                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used to specify character sets supported by         */\r\n  /*    charmaps.  Used in the @FT_Select_Charmap API function.            */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Despite the name, this enumeration lists specific character        */\r\n  /*    repertories (i.e., charsets), and not text encoding methods (e.g., */\r\n  /*    UTF-8, UTF-16, etc.).                                              */\r\n  /*                                                                       */\r\n  /*    Other encodings might be defined in the future.                    */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_ENCODING_NONE ::                                                */\r\n  /*      The encoding value~0 is reserved.                                */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_UNICODE ::                                             */\r\n  /*      Corresponds to the Unicode character set.  This value covers     */\r\n  /*      all versions of the Unicode repertoire, including ASCII and      */\r\n  /*      Latin-1.  Most fonts include a Unicode charmap, but not all      */\r\n  /*      of them.                                                         */\r\n  /*                                                                       */\r\n  /*      For example, if you want to access Unicode value U+1F028 (and    */\r\n  /*      the font contains it), use value 0x1F028 as the input value for  */\r\n  /*      @FT_Get_Char_Index.                                              */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_SYMBOL ::                                           */\r\n  /*      Corresponds to the Microsoft Symbol encoding, used to encode     */\r\n  /*      mathematical symbols in the 32..255 character code range.  For   */\r\n  /*      more information, see `http://www.ceviz.net/symbol.htm'.         */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_SJIS ::                                                */\r\n  /*      Corresponds to Japanese SJIS encoding.  More info at             */\r\n  /*      at `http://langsupport.japanreference.com/encoding.shtml'.       */\r\n  /*      See note on multi-byte encodings below.                          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_GB2312 ::                                              */\r\n  /*      Corresponds to an encoding system for Simplified Chinese as used */\r\n  /*      used in mainland China.                                          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_BIG5 ::                                                */\r\n  /*      Corresponds to an encoding system for Traditional Chinese as     */\r\n  /*      used in Taiwan and Hong Kong.                                    */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_WANSUNG ::                                             */\r\n  /*      Corresponds to the Korean encoding system known as Wansung.      */\r\n  /*      For more information see                                         */\r\n  /*      `http://www.microsoft.com/typography/unicode/949.txt'.           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_JOHAB ::                                               */\r\n  /*      The Korean standard character set (KS~C 5601-1992), which        */\r\n  /*      corresponds to MS Windows code page 1361.  This character set    */\r\n  /*      includes all possible Hangeul character combinations.            */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_LATIN_1 ::                                       */\r\n  /*      Corresponds to a Latin-1 encoding as defined in a Type~1         */\r\n  /*      PostScript font.  It is limited to 256 character codes.          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_STANDARD ::                                      */\r\n  /*      Corresponds to the Adobe Standard encoding, as found in Type~1,  */\r\n  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */\r\n  /*      codes.                                                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_EXPERT ::                                        */\r\n  /*      Corresponds to the Adobe Expert encoding, as found in Type~1,    */\r\n  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */\r\n  /*      codes.                                                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_ADOBE_CUSTOM ::                                        */\r\n  /*      Corresponds to a custom encoding, as found in Type~1, CFF, and   */\r\n  /*      OpenType/CFF fonts.  It is limited to 256 character codes.       */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_APPLE_ROMAN ::                                         */\r\n  /*      Corresponds to the 8-bit Apple roman encoding.  Many TrueType    */\r\n  /*      and OpenType fonts contain a charmap for this encoding, since    */\r\n  /*      older versions of Mac OS are able to use it.                     */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_OLD_LATIN_2 ::                                         */\r\n  /*      This value is deprecated and was never used nor reported by      */\r\n  /*      FreeType.  Don't use or test for it.                             */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_SJIS ::                                             */\r\n  /*      Same as FT_ENCODING_SJIS.  Deprecated.                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_GB2312 ::                                           */\r\n  /*      Same as FT_ENCODING_GB2312.  Deprecated.                         */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_BIG5 ::                                             */\r\n  /*      Same as FT_ENCODING_BIG5.  Deprecated.                           */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_WANSUNG ::                                          */\r\n  /*      Same as FT_ENCODING_WANSUNG.  Deprecated.                        */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_MS_JOHAB ::                                            */\r\n  /*      Same as FT_ENCODING_JOHAB.  Deprecated.                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    By default, FreeType automatically synthesizes a Unicode charmap   */\r\n  /*    for PostScript fonts, using their glyph names dictionaries.        */\r\n  /*    However, it also reports the encodings defined explicitly in the   */\r\n  /*    font file, for the cases when they are needed, with the Adobe      */\r\n  /*    values as well.                                                    */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap  */\r\n  /*    is neither Unicode nor ISO-8859-1 (otherwise it is set to          */\r\n  /*    FT_ENCODING_UNICODE).  Use @FT_Get_BDF_Charset_ID to find out      */\r\n  /*    which encoding is really present.  If, for example, the            */\r\n  /*    `cs_registry' field is `KOI8' and the `cs_encoding' field is `R',  */\r\n  /*    the font is encoded in KOI8-R.                                     */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_NONE is always set (with a single exception) by the    */\r\n  /*    winfonts driver.  Use @FT_Get_WinFNT_Header and examine the        */\r\n  /*    `charset' field of the @FT_WinFNT_HeaderRec structure to find out  */\r\n  /*    which encoding is really present.  For example,                    */\r\n  /*    @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for       */\r\n  /*    Russian).                                                          */\r\n  /*                                                                       */\r\n  /*    FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */\r\n  /*    and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to  */\r\n  /*    FT_ENCODING_APPLE_ROMAN).                                          */\r\n  /*                                                                       */\r\n  /*    If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function       */\r\n  /*    @FT_Get_CMap_Language_ID  to query the Mac language ID which may   */\r\n  /*    be needed to be able to distinguish Apple encoding variants.  See  */\r\n  /*                                                                       */\r\n  /*      http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT  */\r\n  /*                                                                       */\r\n  /*    to get an idea how to do that.  Basically, if the language ID      */\r\n  /*    is~0, don't use it, otherwise subtract 1 from the language ID.     */\r\n  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */\r\n  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */\r\n  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */\r\n  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */\r\n  /*    variant the Arabic encoding.                                       */\r\n  /*                                                                       */\r\n  typedef enum  FT_Encoding_\r\n  {\r\n    FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),\r\n    FT_ENC_TAG( FT_ENCODING_UNICODE,   'u', 'n', 'i', 'c' ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_SJIS,    's', 'j', 'i', 's' ),\r\n    FT_ENC_TAG( FT_ENCODING_GB2312,  'g', 'b', ' ', ' ' ),\r\n    FT_ENC_TAG( FT_ENCODING_BIG5,    'b', 'i', 'g', '5' ),\r\n    FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),\r\n    FT_ENC_TAG( FT_ENCODING_JOHAB,   'j', 'o', 'h', 'a' ),\r\n\r\n    /* for backwards compatibility */\r\n    FT_ENCODING_MS_SJIS    = FT_ENCODING_SJIS,\r\n    FT_ENCODING_MS_GB2312  = FT_ENCODING_GB2312,\r\n    FT_ENCODING_MS_BIG5    = FT_ENCODING_BIG5,\r\n    FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,\r\n    FT_ENCODING_MS_JOHAB   = FT_ENCODING_JOHAB,\r\n\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT,   'A', 'D', 'B', 'E' ),\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM,   'A', 'D', 'B', 'C' ),\r\n    FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1,  'l', 'a', 't', '1' ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),\r\n\r\n    FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )\r\n\r\n  } FT_Encoding;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_encoding_xxx                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    These constants are deprecated; use the corresponding @FT_Encoding */\r\n  /*    values instead.                                                    */\r\n  /*                                                                       */\r\n#define ft_encoding_none            FT_ENCODING_NONE\r\n#define ft_encoding_unicode         FT_ENCODING_UNICODE\r\n#define ft_encoding_symbol          FT_ENCODING_MS_SYMBOL\r\n#define ft_encoding_latin_1         FT_ENCODING_ADOBE_LATIN_1\r\n#define ft_encoding_latin_2         FT_ENCODING_OLD_LATIN_2\r\n#define ft_encoding_sjis            FT_ENCODING_SJIS\r\n#define ft_encoding_gb2312          FT_ENCODING_GB2312\r\n#define ft_encoding_big5            FT_ENCODING_BIG5\r\n#define ft_encoding_wansung         FT_ENCODING_WANSUNG\r\n#define ft_encoding_johab           FT_ENCODING_JOHAB\r\n\r\n#define ft_encoding_adobe_standard  FT_ENCODING_ADOBE_STANDARD\r\n#define ft_encoding_adobe_expert    FT_ENCODING_ADOBE_EXPERT\r\n#define ft_encoding_adobe_custom    FT_ENCODING_ADOBE_CUSTOM\r\n#define ft_encoding_apple_roman     FT_ENCODING_APPLE_ROMAN\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_CharMapRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The base charmap structure.                                        */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face        :: A handle to the parent face object.                 */\r\n  /*                                                                       */\r\n  /*    encoding    :: An @FT_Encoding tag identifying the charmap.  Use   */\r\n  /*                   this with @FT_Select_Charmap.                       */\r\n  /*                                                                       */\r\n  /*    platform_id :: An ID number describing the platform for the        */\r\n  /*                   following encoding ID.  This comes directly from    */\r\n  /*                   the TrueType specification and should be emulated   */\r\n  /*                   for other formats.                                  */\r\n  /*                                                                       */\r\n  /*    encoding_id :: A platform specific encoding number.  This also     */\r\n  /*                   comes from the TrueType specification and should be */\r\n  /*                   emulated similarly.                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_CharMapRec_\r\n  {\r\n    FT_Face      face;\r\n    FT_Encoding  encoding;\r\n    FT_UShort    platform_id;\r\n    FT_UShort    encoding_id;\r\n\r\n  } FT_CharMapRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                 B A S E   O B J E C T   C L A S S E S                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Face_Internal                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to an `FT_Face_InternalRec' structure, used to    */\r\n  /*    model private data of a given @FT_Face object.                     */\r\n  /*                                                                       */\r\n  /*    This structure might change between releases of FreeType~2 and is  */\r\n  /*    not generally available to client applications.                    */\r\n  /*                                                                       */\r\n  typedef struct FT_Face_InternalRec_*  FT_Face_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_FaceRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType root face class structure.  A face object models a        */\r\n  /*    typeface in a font file.                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_faces           :: The number of faces in the font file.  Some */\r\n  /*                           font formats can have multiple faces in     */\r\n  /*                           a font file.                                */\r\n  /*                                                                       */\r\n  /*    face_index          :: The index of the face in the font file.  It */\r\n  /*                           is set to~0 if there is only one face in    */\r\n  /*                           the font file.                              */\r\n  /*                                                                       */\r\n  /*    face_flags          :: A set of bit flags that give important      */\r\n  /*                           information about the face; see             */\r\n  /*                           @FT_FACE_FLAG_XXX for the details.          */\r\n  /*                                                                       */\r\n  /*    style_flags         :: A set of bit flags indicating the style of  */\r\n  /*                           the face; see @FT_STYLE_FLAG_XXX for the    */\r\n  /*                           details.                                    */\r\n  /*                                                                       */\r\n  /*    num_glyphs          :: The number of glyphs in the face.  If the   */\r\n  /*                           face is scalable and has sbits (see         */\r\n  /*                           `num_fixed_sizes'), it is set to the number */\r\n  /*                           of outline glyphs.                          */\r\n  /*                                                                       */\r\n  /*                           For CID-keyed fonts, this value gives the   */\r\n  /*                           highest CID used in the font.               */\r\n  /*                                                                       */\r\n  /*    family_name         :: The face's family name.  This is an ASCII   */\r\n  /*                           string, usually in English, which describes */\r\n  /*                           the typeface's family (like `Times New      */\r\n  /*                           Roman', `Bodoni', `Garamond', etc).  This   */\r\n  /*                           is a least common denominator used to list  */\r\n  /*                           fonts.  Some formats (TrueType & OpenType)  */\r\n  /*                           provide localized and Unicode versions of   */\r\n  /*                           this string.  Applications should use the   */\r\n  /*                           format specific interface to access them.   */\r\n  /*                           Can be NULL (e.g., in fonts embedded in a   */\r\n  /*                           PDF file).                                  */\r\n  /*                                                                       */\r\n  /*    style_name          :: The face's style name.  This is an ASCII    */\r\n  /*                           string, usually in English, which describes */\r\n  /*                           the typeface's style (like `Italic',        */\r\n  /*                           `Bold', `Condensed', etc).  Not all font    */\r\n  /*                           formats provide a style name, so this field */\r\n  /*                           is optional, and can be set to NULL.  As    */\r\n  /*                           for `family_name', some formats provide     */\r\n  /*                           localized and Unicode versions of this      */\r\n  /*                           string.  Applications should use the format */\r\n  /*                           specific interface to access them.          */\r\n  /*                                                                       */\r\n  /*    num_fixed_sizes     :: The number of bitmap strikes in the face.   */\r\n  /*                           Even if the face is scalable, there might   */\r\n  /*                           still be bitmap strikes, which are called   */\r\n  /*                           `sbits' in that case.                       */\r\n  /*                                                                       */\r\n  /*    available_sizes     :: An array of @FT_Bitmap_Size for all bitmap  */\r\n  /*                           strikes in the face.  It is set to NULL if  */\r\n  /*                           there is no bitmap strike.                  */\r\n  /*                                                                       */\r\n  /*    num_charmaps        :: The number of charmaps in the face.         */\r\n  /*                                                                       */\r\n  /*    charmaps            :: An array of the charmaps of the face.       */\r\n  /*                                                                       */\r\n  /*    generic             :: A field reserved for client uses.  See the  */\r\n  /*                           @FT_Generic type description.               */\r\n  /*                                                                       */\r\n  /*    bbox                :: The font bounding box.  Coordinates are     */\r\n  /*                           expressed in font units (see                */\r\n  /*                           `units_per_EM').  The box is large enough   */\r\n  /*                           to contain any glyph from the font.  Thus,  */\r\n  /*                           `bbox.yMax' can be seen as the `maximal     */\r\n  /*                           ascender', and `bbox.yMin' as the `minimal  */\r\n  /*                           descender'.  Only relevant for scalable     */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*                           Note that the bounding box might be off by  */\r\n  /*                           (at least) one pixel for hinted fonts.  See */\r\n  /*                           @FT_Size_Metrics for further discussion.    */\r\n  /*                                                                       */\r\n  /*    units_per_EM        :: The number of font units per EM square for  */\r\n  /*                           this face.  This is typically 2048 for      */\r\n  /*                           TrueType fonts, and 1000 for Type~1 fonts.  */\r\n  /*                           Only relevant for scalable formats.         */\r\n  /*                                                                       */\r\n  /*    ascender            :: The typographic ascender of the face,       */\r\n  /*                           expressed in font units.  For font formats  */\r\n  /*                           not having this information, it is set to   */\r\n  /*                           `bbox.yMax'.  Only relevant for scalable    */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*    descender           :: The typographic descender of the face,      */\r\n  /*                           expressed in font units.  For font formats  */\r\n  /*                           not having this information, it is set to   */\r\n  /*                           `bbox.yMin'.  Note that this field is       */\r\n  /*                           usually negative.  Only relevant for        */\r\n  /*                           scalable formats.                           */\r\n  /*                                                                       */\r\n  /*    height              :: The height is the vertical distance         */\r\n  /*                           between two consecutive baselines,          */\r\n  /*                           expressed in font units.  It is always      */\r\n  /*                           positive.  Only relevant for scalable       */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*    max_advance_width   :: The maximal advance width, in font units,   */\r\n  /*                           for all glyphs in this face.  This can be   */\r\n  /*                           used to make word wrapping computations     */\r\n  /*                           faster.  Only relevant for scalable         */\r\n  /*                           formats.                                    */\r\n  /*                                                                       */\r\n  /*    max_advance_height  :: The maximal advance height, in font units,  */\r\n  /*                           for all glyphs in this face.  This is only  */\r\n  /*                           relevant for vertical layouts, and is set   */\r\n  /*                           to `height' for fonts that do not provide   */\r\n  /*                           vertical metrics.  Only relevant for        */\r\n  /*                           scalable formats.                           */\r\n  /*                                                                       */\r\n  /*    underline_position  :: The position, in font units, of the         */\r\n  /*                           underline line for this face.  It is the    */\r\n  /*                           center of the underlining stem.  Only       */\r\n  /*                           relevant for scalable formats.              */\r\n  /*                                                                       */\r\n  /*    underline_thickness :: The thickness, in font units, of the        */\r\n  /*                           underline for this face.  Only relevant for */\r\n  /*                           scalable formats.                           */\r\n  /*                                                                       */\r\n  /*    glyph               :: The face's associated glyph slot(s).        */\r\n  /*                                                                       */\r\n  /*    size                :: The current active size for this face.      */\r\n  /*                                                                       */\r\n  /*    charmap             :: The current active charmap for this face.   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Fields may be changed after a call to @FT_Attach_File or           */\r\n  /*    @FT_Attach_Stream.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_FaceRec_\r\n  {\r\n    FT_Long           num_faces;\r\n    FT_Long           face_index;\r\n\r\n    FT_Long           face_flags;\r\n    FT_Long           style_flags;\r\n\r\n    FT_Long           num_glyphs;\r\n\r\n    FT_String*        family_name;\r\n    FT_String*        style_name;\r\n\r\n    FT_Int            num_fixed_sizes;\r\n    FT_Bitmap_Size*   available_sizes;\r\n\r\n    FT_Int            num_charmaps;\r\n    FT_CharMap*       charmaps;\r\n\r\n    FT_Generic        generic;\r\n\r\n    /*# The following member variables (down to `underline_thickness') */\r\n    /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size    */\r\n    /*# for bitmap fonts.                                              */\r\n    FT_BBox           bbox;\r\n\r\n    FT_UShort         units_per_EM;\r\n    FT_Short          ascender;\r\n    FT_Short          descender;\r\n    FT_Short          height;\r\n\r\n    FT_Short          max_advance_width;\r\n    FT_Short          max_advance_height;\r\n\r\n    FT_Short          underline_position;\r\n    FT_Short          underline_thickness;\r\n\r\n    FT_GlyphSlot      glyph;\r\n    FT_Size           size;\r\n    FT_CharMap        charmap;\r\n\r\n    /*@private begin */\r\n\r\n    FT_Driver         driver;\r\n    FT_Memory         memory;\r\n    FT_Stream         stream;\r\n\r\n    FT_ListRec        sizes_list;\r\n\r\n    FT_Generic        autohint;\r\n    void*             extensions;\r\n\r\n    FT_Face_Internal  internal;\r\n\r\n    /*@private end */\r\n\r\n  } FT_FaceRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_FACE_FLAG_XXX                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit flags used in the `face_flags' field of the          */\r\n  /*    @FT_FaceRec structure.  They inform client applications of         */\r\n  /*    properties of the corresponding face.                              */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_FACE_FLAG_SCALABLE ::                                           */\r\n  /*      Indicates that the face contains outline glyphs.  This doesn't   */\r\n  /*      prevent bitmap strikes, i.e., a face can have both this and      */\r\n  /*      and @FT_FACE_FLAG_FIXED_SIZES set.                               */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_FIXED_SIZES ::                                        */\r\n  /*      Indicates that the face contains bitmap strikes.  See also the   */\r\n  /*      `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec.   */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_FIXED_WIDTH ::                                        */\r\n  /*      Indicates that the face contains fixed-width characters (like    */\r\n  /*      Courier, Lucido, MonoType, etc.).                                */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_SFNT ::                                               */\r\n  /*      Indicates that the face uses the `sfnt' storage scheme.  For     */\r\n  /*      now, this means TrueType and OpenType.                           */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_HORIZONTAL ::                                         */\r\n  /*      Indicates that the face contains horizontal glyph metrics.  This */\r\n  /*      should be set for all common formats.                            */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_VERTICAL ::                                           */\r\n  /*      Indicates that the face contains vertical glyph metrics.  This   */\r\n  /*      is only available in some formats, not all of them.              */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_KERNING ::                                            */\r\n  /*      Indicates that the face contains kerning information.  If set,   */\r\n  /*      the kerning distance can be retrieved through the function       */\r\n  /*      @FT_Get_Kerning.  Otherwise the function always return the       */\r\n  /*      vector (0,0).  Note that FreeType doesn't handle kerning data    */\r\n  /*      from the `GPOS' table (as present in some OpenType fonts).       */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_FAST_GLYPHS ::                                        */\r\n  /*      THIS FLAG IS DEPRECATED.  DO NOT USE OR TEST IT.                 */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_MULTIPLE_MASTERS ::                                   */\r\n  /*      Indicates that the font contains multiple masters and is capable */\r\n  /*      of interpolating between them.  See the multiple-masters         */\r\n  /*      specific API for details.                                        */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_GLYPH_NAMES ::                                        */\r\n  /*      Indicates that the font contains glyph names that can be         */\r\n  /*      retrieved through @FT_Get_Glyph_Name.  Note that some TrueType   */\r\n  /*      fonts contain broken glyph name tables.  Use the function        */\r\n  /*      @FT_Has_PS_Glyph_Names when needed.                              */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_EXTERNAL_STREAM ::                                    */\r\n  /*      Used internally by FreeType to indicate that a face's stream was */\r\n  /*      provided by the client application and should not be destroyed   */\r\n  /*      when @FT_Done_Face is called.  Don't read or test this flag.     */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_HINTER ::                                             */\r\n  /*      Set if the font driver has a hinting machine of its own.  For    */\r\n  /*      example, with TrueType fonts, it makes sense to use data from    */\r\n  /*      the SFNT `gasp' table only if the native TrueType hinting engine */\r\n  /*      (with the bytecode interpreter) is available and active.         */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_CID_KEYED ::                                          */\r\n  /*      Set if the font is CID-keyed.  In that case, the font is not     */\r\n  /*      accessed by glyph indices but by CID values.  For subsetted      */\r\n  /*      CID-keyed fonts this has the consequence that not all index      */\r\n  /*      values are a valid argument to FT_Load_Glyph.  Only the CID      */\r\n  /*      values for which corresponding glyphs in the subsetted font      */\r\n  /*      exist make FT_Load_Glyph return successfully; in all other cases */\r\n  /*      you get an `FT_Err_Invalid_Argument' error.                      */\r\n  /*                                                                       */\r\n  /*      Note that CID-keyed fonts which are in an SFNT wrapper don't     */\r\n  /*      have this flag set since the glyphs are accessed in the normal   */\r\n  /*      way (using contiguous indices); the `CID-ness' isn't visible to  */\r\n  /*      the application.                                                 */\r\n  /*                                                                       */\r\n  /*    FT_FACE_FLAG_TRICKY ::                                             */\r\n  /*      Set if the font is `tricky', this is, it always needs the        */\r\n  /*      font format's native hinting engine to get a reasonable result.  */\r\n  /*      A typical example is the Chinese font `mingli.ttf' which uses    */\r\n  /*      TrueType bytecode instructions to move and scale all of its      */\r\n  /*      subglyphs.                                                       */\r\n  /*                                                                       */\r\n  /*      It is not possible to autohint such fonts using                  */\r\n  /*      @FT_LOAD_FORCE_AUTOHINT; it will also ignore                     */\r\n  /*      @FT_LOAD_NO_HINTING.  You have to set both FT_LOAD_NO_HINTING    */\r\n  /*      and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */\r\n  /*      probably never want this except for demonstration purposes.      */\r\n  /*                                                                       */\r\n  /*      Currently, there are six TrueType fonts in the list of tricky    */\r\n  /*      fonts; they are hard-coded in file `ttobjs.c'.                   */\r\n  /*                                                                       */\r\n#define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )\r\n#define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )\r\n#define FT_FACE_FLAG_FIXED_WIDTH       ( 1L <<  2 )\r\n#define FT_FACE_FLAG_SFNT              ( 1L <<  3 )\r\n#define FT_FACE_FLAG_HORIZONTAL        ( 1L <<  4 )\r\n#define FT_FACE_FLAG_VERTICAL          ( 1L <<  5 )\r\n#define FT_FACE_FLAG_KERNING           ( 1L <<  6 )\r\n#define FT_FACE_FLAG_FAST_GLYPHS       ( 1L <<  7 )\r\n#define FT_FACE_FLAG_MULTIPLE_MASTERS  ( 1L <<  8 )\r\n#define FT_FACE_FLAG_GLYPH_NAMES       ( 1L <<  9 )\r\n#define FT_FACE_FLAG_EXTERNAL_STREAM   ( 1L << 10 )\r\n#define FT_FACE_FLAG_HINTER            ( 1L << 11 )\r\n#define FT_FACE_FLAG_CID_KEYED         ( 1L << 12 )\r\n#define FT_FACE_FLAG_TRICKY            ( 1L << 13 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_HORIZONTAL( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains\r\n   *   horizontal metrics (this is true for all font formats though).\r\n   *\r\n   * @also:\r\n   *   @FT_HAS_VERTICAL can be used to check for vertical metrics.\r\n   *\r\n   */\r\n#define FT_HAS_HORIZONTAL( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_VERTICAL( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains vertical\r\n   *   metrics.\r\n   *\r\n   */\r\n#define FT_HAS_VERTICAL( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_VERTICAL )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_KERNING( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains kerning\r\n   *   data that can be accessed with @FT_Get_Kerning.\r\n   *\r\n   */\r\n#define FT_HAS_KERNING( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_KERNING )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_SCALABLE( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a scalable\r\n   *   font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,\r\n   *   and PFR font formats.\r\n   *\r\n   */\r\n#define FT_IS_SCALABLE( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_SCALABLE )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_SFNT( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a font\r\n   *   whose format is based on the SFNT storage scheme.  This usually\r\n   *   means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded\r\n   *   bitmap fonts.\r\n   *\r\n   *   If this macro is true, all functions defined in @FT_SFNT_NAMES_H and\r\n   *   @FT_TRUETYPE_TABLES_H are available.\r\n   *\r\n   */\r\n#define FT_IS_SFNT( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_SFNT )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_FIXED_WIDTH( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a font face\r\n   *   that contains fixed-width (or `monospace', `fixed-pitch', etc.)\r\n   *   glyphs.\r\n   *\r\n   */\r\n#define FT_IS_FIXED_WIDTH( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_FIXED_SIZES( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains some\r\n   *   embedded bitmaps.  See the `available_sizes' field of the\r\n   *   @FT_FaceRec structure.\r\n   *\r\n   */\r\n#define FT_HAS_FIXED_SIZES( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_FAST_GLYPHS( face )\r\n   *\r\n   * @description:\r\n   *   Deprecated.\r\n   *\r\n   */\r\n#define FT_HAS_FAST_GLYPHS( face )  0\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_GLYPH_NAMES( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains some glyph\r\n   *   names that can be accessed through @FT_Get_Glyph_Name.\r\n   *\r\n   */\r\n#define FT_HAS_GLYPH_NAMES( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_HAS_MULTIPLE_MASTERS( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains some\r\n   *   multiple masters.  The functions provided by @FT_MULTIPLE_MASTERS_H\r\n   *   are then available to choose the exact design you want.\r\n   *\r\n   */\r\n#define FT_HAS_MULTIPLE_MASTERS( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_CID_KEYED( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face object contains a CID-keyed\r\n   *   font.  See the discussion of @FT_FACE_FLAG_CID_KEYED for more\r\n   *   details.\r\n   *\r\n   *   If this macro is true, all functions defined in @FT_CID_H are\r\n   *   available.\r\n   *\r\n   */\r\n#define FT_IS_CID_KEYED( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_CID_KEYED )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_IS_TRICKY( face )\r\n   *\r\n   * @description:\r\n   *   A macro that returns true whenever a face represents a `tricky' font.\r\n   *   See the discussion of @FT_FACE_FLAG_TRICKY for more details.\r\n   *\r\n   */\r\n#define FT_IS_TRICKY( face ) \\\r\n          ( face->face_flags & FT_FACE_FLAG_TRICKY )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    FT_STYLE_FLAG_XXX                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit-flags used to indicate the style of a given face.    */\r\n  /*    These are used in the `style_flags' field of @FT_FaceRec.          */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_STYLE_FLAG_ITALIC ::                                            */\r\n  /*      Indicates that a given face style is italic or oblique.          */\r\n  /*                                                                       */\r\n  /*    FT_STYLE_FLAG_BOLD ::                                              */\r\n  /*      Indicates that a given face is bold.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The style information as provided by FreeType is very basic.  More */\r\n  /*    details are beyond the scope and should be done on a higher level  */\r\n  /*    (for example, by analyzing various fields of the `OS/2' table in   */\r\n  /*    SFNT based fonts).                                                 */\r\n  /*                                                                       */\r\n#define FT_STYLE_FLAG_ITALIC  ( 1 << 0 )\r\n#define FT_STYLE_FLAG_BOLD    ( 1 << 1 )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Size_Internal                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to an `FT_Size_InternalRec' structure, used to    */\r\n  /*    model private data of a given @FT_Size object.                     */\r\n  /*                                                                       */\r\n  typedef struct FT_Size_InternalRec_*  FT_Size_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_Metrics                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The size metrics structure gives the metrics of a size object.     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x_ppem       :: The width of the scaled EM square in pixels, hence */\r\n  /*                    the term `ppem' (pixels per EM).  It is also       */\r\n  /*                    referred to as `nominal width'.                    */\r\n  /*                                                                       */\r\n  /*    y_ppem       :: The height of the scaled EM square in pixels,      */\r\n  /*                    hence the term `ppem' (pixels per EM).  It is also */\r\n  /*                    referred to as `nominal height'.                   */\r\n  /*                                                                       */\r\n  /*    x_scale      :: A 16.16 fractional scaling value used to convert   */\r\n  /*                    horizontal metrics from font units to 26.6         */\r\n  /*                    fractional pixels.  Only relevant for scalable     */\r\n  /*                    font formats.                                      */\r\n  /*                                                                       */\r\n  /*    y_scale      :: A 16.16 fractional scaling value used to convert   */\r\n  /*                    vertical metrics from font units to 26.6           */\r\n  /*                    fractional pixels.  Only relevant for scalable     */\r\n  /*                    font formats.                                      */\r\n  /*                                                                       */\r\n  /*    ascender     :: The ascender in 26.6 fractional pixels.  See       */\r\n  /*                    @FT_FaceRec for the details.                       */\r\n  /*                                                                       */\r\n  /*    descender    :: The descender in 26.6 fractional pixels.  See      */\r\n  /*                    @FT_FaceRec for the details.                       */\r\n  /*                                                                       */\r\n  /*    height       :: The height in 26.6 fractional pixels.  See         */\r\n  /*                    @FT_FaceRec for the details.                       */\r\n  /*                                                                       */\r\n  /*    max_advance  :: The maximal advance width in 26.6 fractional       */\r\n  /*                    pixels.  See @FT_FaceRec for the details.          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The scaling values, if relevant, are determined first during a     */\r\n  /*    size changing operation.  The remaining fields are then set by the */\r\n  /*    driver.  For scalable formats, they are usually set to scaled      */\r\n  /*    values of the corresponding fields in @FT_FaceRec.                 */\r\n  /*                                                                       */\r\n  /*    Note that due to glyph hinting, these values might not be exact    */\r\n  /*    for certain fonts.  Thus they must be treated as unreliable        */\r\n  /*    with an error margin of at least one pixel!                        */\r\n  /*                                                                       */\r\n  /*    Indeed, the only way to get the exact metrics is to render _all_   */\r\n  /*    glyphs.  As this would be a definite performance hit, it is up to  */\r\n  /*    client applications to perform such computations.                  */\r\n  /*                                                                       */\r\n  /*    The FT_Size_Metrics structure is valid for bitmap fonts also.      */\r\n  /*                                                                       */\r\n  typedef struct  FT_Size_Metrics_\r\n  {\r\n    FT_UShort  x_ppem;      /* horizontal pixels per EM               */\r\n    FT_UShort  y_ppem;      /* vertical pixels per EM                 */\r\n\r\n    FT_Fixed   x_scale;     /* scaling values used to convert font    */\r\n    FT_Fixed   y_scale;     /* units to 26.6 fractional pixels        */\r\n\r\n    FT_Pos     ascender;    /* ascender in 26.6 frac. pixels          */\r\n    FT_Pos     descender;   /* descender in 26.6 frac. pixels         */\r\n    FT_Pos     height;      /* text height in 26.6 frac. pixels       */\r\n    FT_Pos     max_advance; /* max horizontal advance, in 26.6 pixels */\r\n\r\n  } FT_Size_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_SizeRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType root size class structure.  A size object models a face   */\r\n  /*    object at a given size.                                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face    :: Handle to the parent face object.                       */\r\n  /*                                                                       */\r\n  /*    generic :: A typeless pointer, which is unused by the FreeType     */\r\n  /*               library or any of its drivers.  It can be used by       */\r\n  /*               client applications to link their own data to each size */\r\n  /*               object.                                                 */\r\n  /*                                                                       */\r\n  /*    metrics :: Metrics for this size object.  This field is read-only. */\r\n  /*                                                                       */\r\n  typedef struct  FT_SizeRec_\r\n  {\r\n    FT_Face           face;      /* parent face object              */\r\n    FT_Generic        generic;   /* generic pointer for client uses */\r\n    FT_Size_Metrics   metrics;   /* size metrics                    */\r\n    FT_Size_Internal  internal;\r\n\r\n  } FT_SizeRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_SubGlyph                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The subglyph structure is an internal object used to describe      */\r\n  /*    subglyphs (for example, in the case of composites).                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The subglyph implementation is not part of the high-level API,     */\r\n  /*    hence the forward structure declaration.                           */\r\n  /*                                                                       */\r\n  /*    You can however retrieve subglyph information with                 */\r\n  /*    @FT_Get_SubGlyph_Info.                                             */\r\n  /*                                                                       */\r\n  typedef struct FT_SubGlyphRec_*  FT_SubGlyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Slot_Internal                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to an `FT_Slot_InternalRec' structure, used to    */\r\n  /*    model private data of a given @FT_GlyphSlot object.                */\r\n  /*                                                                       */\r\n  typedef struct FT_Slot_InternalRec_*  FT_Slot_Internal;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_GlyphSlotRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType root glyph slot class structure.  A glyph slot is a       */\r\n  /*    container where individual glyphs can be loaded, be they in        */\r\n  /*    outline or bitmap format.                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    library           :: A handle to the FreeType library instance     */\r\n  /*                         this slot belongs to.                         */\r\n  /*                                                                       */\r\n  /*    face              :: A handle to the parent face object.           */\r\n  /*                                                                       */\r\n  /*    next              :: In some cases (like some font tools), several */\r\n  /*                         glyph slots per face object can be a good     */\r\n  /*                         thing.  As this is rare, the glyph slots are  */\r\n  /*                         listed through a direct, single-linked list   */\r\n  /*                         using its `next' field.                       */\r\n  /*                                                                       */\r\n  /*    generic           :: A typeless pointer which is unused by the     */\r\n  /*                         FreeType library or any of its drivers.  It   */\r\n  /*                         can be used by client applications to link    */\r\n  /*                         their own data to each glyph slot object.     */\r\n  /*                                                                       */\r\n  /*    metrics           :: The metrics of the last loaded glyph in the   */\r\n  /*                         slot.  The returned values depend on the last */\r\n  /*                         load flags (see the @FT_Load_Glyph API        */\r\n  /*                         function) and can be expressed either in 26.6 */\r\n  /*                         fractional pixels or font units.              */\r\n  /*                                                                       */\r\n  /*                         Note that even when the glyph image is        */\r\n  /*                         transformed, the metrics are not.             */\r\n  /*                                                                       */\r\n  /*    linearHoriAdvance :: The advance width of the unhinted glyph.      */\r\n  /*                         Its value is expressed in 16.16 fractional    */\r\n  /*                         pixels, unless @FT_LOAD_LINEAR_DESIGN is set  */\r\n  /*                         when loading the glyph.  This field can be    */\r\n  /*                         important to perform correct WYSIWYG layout.  */\r\n  /*                         Only relevant for outline glyphs.             */\r\n  /*                                                                       */\r\n  /*    linearVertAdvance :: The advance height of the unhinted glyph.     */\r\n  /*                         Its value is expressed in 16.16 fractional    */\r\n  /*                         pixels, unless @FT_LOAD_LINEAR_DESIGN is set  */\r\n  /*                         when loading the glyph.  This field can be    */\r\n  /*                         important to perform correct WYSIWYG layout.  */\r\n  /*                         Only relevant for outline glyphs.             */\r\n  /*                                                                       */\r\n  /*    advance           :: This shorthand is, depending on               */\r\n  /*                         @FT_LOAD_IGNORE_TRANSFORM, the transformed    */\r\n  /*                         advance width for the glyph (in 26.6          */\r\n  /*                         fractional pixel format).  As specified with  */\r\n  /*                         @FT_LOAD_VERTICAL_LAYOUT, it uses either the  */\r\n  /*                         `horiAdvance' or the `vertAdvance' value of   */\r\n  /*                         `metrics' field.                              */\r\n  /*                                                                       */\r\n  /*    format            :: This field indicates the format of the image  */\r\n  /*                         contained in the glyph slot.  Typically       */\r\n  /*                         @FT_GLYPH_FORMAT_BITMAP,                      */\r\n  /*                         @FT_GLYPH_FORMAT_OUTLINE, or                  */\r\n  /*                         @FT_GLYPH_FORMAT_COMPOSITE, but others are    */\r\n  /*                         possible.                                     */\r\n  /*                                                                       */\r\n  /*    bitmap            :: This field is used as a bitmap descriptor     */\r\n  /*                         when the slot format is                       */\r\n  /*                         @FT_GLYPH_FORMAT_BITMAP.  Note that the       */\r\n  /*                         address and content of the bitmap buffer can  */\r\n  /*                         change between calls of @FT_Load_Glyph and a  */\r\n  /*                         few other functions.                          */\r\n  /*                                                                       */\r\n  /*    bitmap_left       :: This is the bitmap's left bearing expressed   */\r\n  /*                         in integer pixels.  Of course, this is only   */\r\n  /*                         valid if the format is                        */\r\n  /*                         @FT_GLYPH_FORMAT_BITMAP.                      */\r\n  /*                                                                       */\r\n  /*    bitmap_top        :: This is the bitmap's top bearing expressed in */\r\n  /*                         integer pixels.  Remember that this is the    */\r\n  /*                         distance from the baseline to the top-most    */\r\n  /*                         glyph scanline, upwards y~coordinates being   */\r\n  /*                         *positive*.                                   */\r\n  /*                                                                       */\r\n  /*    outline           :: The outline descriptor for the current glyph  */\r\n  /*                         image if its format is                        */\r\n  /*                         @FT_GLYPH_FORMAT_OUTLINE.  Once a glyph is    */\r\n  /*                         loaded, `outline' can be transformed,         */\r\n  /*                         distorted, embolded, etc.  However, it must   */\r\n  /*                         not be freed.                                 */\r\n  /*                                                                       */\r\n  /*    num_subglyphs     :: The number of subglyphs in a composite glyph. */\r\n  /*                         This field is only valid for the composite    */\r\n  /*                         glyph format that should normally only be     */\r\n  /*                         loaded with the @FT_LOAD_NO_RECURSE flag.     */\r\n  /*                         For now this is internal to FreeType.         */\r\n  /*                                                                       */\r\n  /*    subglyphs         :: An array of subglyph descriptors for          */\r\n  /*                         composite glyphs.  There are `num_subglyphs'  */\r\n  /*                         elements in there.  Currently internal to     */\r\n  /*                         FreeType.                                     */\r\n  /*                                                                       */\r\n  /*    control_data      :: Certain font drivers can also return the      */\r\n  /*                         control data for a given glyph image (e.g.    */\r\n  /*                         TrueType bytecode, Type~1 charstrings, etc.). */\r\n  /*                         This field is a pointer to such data.         */\r\n  /*                                                                       */\r\n  /*    control_len       :: This is the length in bytes of the control    */\r\n  /*                         data.                                         */\r\n  /*                                                                       */\r\n  /*    other             :: Really wicked formats can use this pointer to */\r\n  /*                         present their own glyph image to client       */\r\n  /*                         applications.  Note that the application      */\r\n  /*                         needs to know about the image format.         */\r\n  /*                                                                       */\r\n  /*    lsb_delta         :: The difference between hinted and unhinted    */\r\n  /*                         left side bearing while autohinting is        */\r\n  /*                         active.  Zero otherwise.                      */\r\n  /*                                                                       */\r\n  /*    rsb_delta         :: The difference between hinted and unhinted    */\r\n  /*                         right side bearing while autohinting is       */\r\n  /*                         active.  Zero otherwise.                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If @FT_Load_Glyph is called with default flags (see                */\r\n  /*    @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in   */\r\n  /*    its native format (e.g., an outline glyph for TrueType and Type~1  */\r\n  /*    formats).                                                          */\r\n  /*                                                                       */\r\n  /*    This image can later be converted into a bitmap by calling         */\r\n  /*    @FT_Render_Glyph.  This function finds the current renderer for    */\r\n  /*    the native image's format, then invokes it.                        */\r\n  /*                                                                       */\r\n  /*    The renderer is in charge of transforming the native image through */\r\n  /*    the slot's face transformation fields, then converting it into a   */\r\n  /*    bitmap that is returned in `slot->bitmap'.                         */\r\n  /*                                                                       */\r\n  /*    Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */\r\n  /*    to specify the position of the bitmap relative to the current pen  */\r\n  /*    position (e.g., coordinates (0,0) on the baseline).  Of course,    */\r\n  /*    `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP.         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Here a small pseudo code fragment which shows how to use           */\r\n  /*    `lsb_delta' and `rsb_delta':                                       */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      FT_Pos  origin_x       = 0;                                      */\r\n  /*      FT_Pos  prev_rsb_delta = 0;                                      */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      for all glyphs do                                                */\r\n  /*        <compute kern between current and previous glyph and add it to */\r\n  /*         `origin_x'>                                                   */\r\n  /*                                                                       */\r\n  /*        <load glyph with `FT_Load_Glyph'>                              */\r\n  /*                                                                       */\r\n  /*        if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 )           */\r\n  /*          origin_x -= 64;                                              */\r\n  /*        else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 )      */\r\n  /*          origin_x += 64;                                              */\r\n  /*                                                                       */\r\n  /*        prev_rsb_delta = face->glyph->rsb_delta;                       */\r\n  /*                                                                       */\r\n  /*        <save glyph image, or render glyph, or ...>                    */\r\n  /*                                                                       */\r\n  /*        origin_x += face->glyph->advance.x;                            */\r\n  /*      endfor                                                           */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  typedef struct  FT_GlyphSlotRec_\r\n  {\r\n    FT_Library        library;\r\n    FT_Face           face;\r\n    FT_GlyphSlot      next;\r\n    FT_UInt           reserved;       /* retained for binary compatibility */\r\n    FT_Generic        generic;\r\n\r\n    FT_Glyph_Metrics  metrics;\r\n    FT_Fixed          linearHoriAdvance;\r\n    FT_Fixed          linearVertAdvance;\r\n    FT_Vector         advance;\r\n\r\n    FT_Glyph_Format   format;\r\n\r\n    FT_Bitmap         bitmap;\r\n    FT_Int            bitmap_left;\r\n    FT_Int            bitmap_top;\r\n\r\n    FT_Outline        outline;\r\n\r\n    FT_UInt           num_subglyphs;\r\n    FT_SubGlyph       subglyphs;\r\n\r\n    void*             control_data;\r\n    long              control_len;\r\n\r\n    FT_Pos            lsb_delta;\r\n    FT_Pos            rsb_delta;\r\n\r\n    void*             other;\r\n\r\n    FT_Slot_Internal  internal;\r\n\r\n  } FT_GlyphSlotRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                         F U N C T I O N S                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Init_FreeType                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a new FreeType library object.  The set of modules      */\r\n  /*    that are registered by this function is determined at build time.  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    alibrary :: A handle to a new library object.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In case you want to provide your own memory allocating routines,   */\r\n  /*    use @FT_New_Library instead, followed by a call to                 */\r\n  /*    @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module).  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Init_FreeType( FT_Library  *alibrary );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_FreeType                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a given FreeType library object and all of its children,   */\r\n  /*    including resources, drivers, faces, sizes, etc.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to the target library object.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_FreeType( FT_Library  library );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_OPEN_XXX                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit-field constants used within the `flags' field of the */\r\n  /*    @FT_Open_Args structure.                                           */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_OPEN_MEMORY   :: This is a memory-based stream.                 */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_STREAM   :: Copy the stream from the `stream' field.       */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_PATHNAME :: Create a new input stream from a C~path        */\r\n  /*                        name.                                          */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_DRIVER   :: Use the `driver' field.                        */\r\n  /*                                                                       */\r\n  /*    FT_OPEN_PARAMS   :: Use the `num_params' and `params' fields.      */\r\n  /*                                                                       */\r\n  /*    ft_open_memory   :: Deprecated; use @FT_OPEN_MEMORY instead.       */\r\n  /*                                                                       */\r\n  /*    ft_open_stream   :: Deprecated; use @FT_OPEN_STREAM instead.       */\r\n  /*                                                                       */\r\n  /*    ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead.     */\r\n  /*                                                                       */\r\n  /*    ft_open_driver   :: Deprecated; use @FT_OPEN_DRIVER instead.       */\r\n  /*                                                                       */\r\n  /*    ft_open_params   :: Deprecated; use @FT_OPEN_PARAMS instead.       */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */\r\n  /*    flags are mutually exclusive.                                      */\r\n  /*                                                                       */\r\n#define FT_OPEN_MEMORY    0x1\r\n#define FT_OPEN_STREAM    0x2\r\n#define FT_OPEN_PATHNAME  0x4\r\n#define FT_OPEN_DRIVER    0x8\r\n#define FT_OPEN_PARAMS    0x10\r\n\r\n#define ft_open_memory    FT_OPEN_MEMORY     /* deprecated */\r\n#define ft_open_stream    FT_OPEN_STREAM     /* deprecated */\r\n#define ft_open_pathname  FT_OPEN_PATHNAME   /* deprecated */\r\n#define ft_open_driver    FT_OPEN_DRIVER     /* deprecated */\r\n#define ft_open_params    FT_OPEN_PARAMS     /* deprecated */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Parameter                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to pass more or less generic parameters to */\r\n  /*    @FT_Open_Face.                                                     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    tag  :: A four-byte identification tag.                            */\r\n  /*                                                                       */\r\n  /*    data :: A pointer to the parameter data.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The ID and function of parameters are driver-specific.  See the    */\r\n  /*    various FT_PARAM_TAG_XXX flags for more information.               */\r\n  /*                                                                       */\r\n  typedef struct  FT_Parameter_\r\n  {\r\n    FT_ULong    tag;\r\n    FT_Pointer  data;\r\n\r\n  } FT_Parameter;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Open_Args                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to indicate how to open a new font file or        */\r\n  /*    stream.  A pointer to such a structure can be used as a parameter  */\r\n  /*    for the functions @FT_Open_Face and @FT_Attach_Stream.             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    flags       :: A set of bit flags indicating how to use the        */\r\n  /*                   structure.                                          */\r\n  /*                                                                       */\r\n  /*    memory_base :: The first byte of the file in memory.               */\r\n  /*                                                                       */\r\n  /*    memory_size :: The size in bytes of the file in memory.            */\r\n  /*                                                                       */\r\n  /*    pathname    :: A pointer to an 8-bit file pathname.                */\r\n  /*                                                                       */\r\n  /*    stream      :: A handle to a source stream object.                 */\r\n  /*                                                                       */\r\n  /*    driver      :: This field is exclusively used by @FT_Open_Face;    */\r\n  /*                   it simply specifies the font driver to use to open  */\r\n  /*                   the face.  If set to~0, FreeType tries to load the  */\r\n  /*                   face with each one of the drivers in its list.      */\r\n  /*                                                                       */\r\n  /*    num_params  :: The number of extra parameters.                     */\r\n  /*                                                                       */\r\n  /*    params      :: Extra parameters passed to the font driver when     */\r\n  /*                   opening a new face.                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream type is determined by the contents of `flags' which     */\r\n  /*    are tested in the following order by @FT_Open_Face:                */\r\n  /*                                                                       */\r\n  /*    If the `FT_OPEN_MEMORY' bit is set, assume that this is a          */\r\n  /*    memory file of `memory_size' bytes, located at `memory_address'.   */\r\n  /*    The data are are not copied, and the client is responsible for     */\r\n  /*    releasing and destroying them _after_ the corresponding call to    */\r\n  /*    @FT_Done_Face.                                                     */\r\n  /*                                                                       */\r\n  /*    Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a       */\r\n  /*    custom input stream `stream' is used.                              */\r\n  /*                                                                       */\r\n  /*    Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this  */\r\n  /*    is a normal file and use `pathname' to open it.                    */\r\n  /*                                                                       */\r\n  /*    If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to    */\r\n  /*    open the file with the driver whose handler is in `driver'.        */\r\n  /*                                                                       */\r\n  /*    If the `FT_OPEN_PARAMS' bit is set, the parameters given by        */\r\n  /*    `num_params' and `params' is used.  They are ignored otherwise.    */\r\n  /*                                                                       */\r\n  /*    Ideally, both the `pathname' and `params' fields should be tagged  */\r\n  /*    as `const'; this is missing for API backwards compatibility.  In   */\r\n  /*    other words, applications should treat them as read-only.          */\r\n  /*                                                                       */\r\n  typedef struct  FT_Open_Args_\r\n  {\r\n    FT_UInt         flags;\r\n    const FT_Byte*  memory_base;\r\n    FT_Long         memory_size;\r\n    FT_String*      pathname;\r\n    FT_Stream       stream;\r\n    FT_Module       driver;\r\n    FT_Int          num_params;\r\n    FT_Parameter*   params;\r\n\r\n  } FT_Open_Args;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Open_Face to open a font by its pathname.  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    pathname   :: A path to the font file.                             */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the font.  The first    */\r\n  /*                  face has index~0.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.  If `face_index' is   */\r\n  /*                  greater than or equal to zero, it must be non-NULL.  */\r\n  /*                  See @FT_Open_Face for more details.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face( FT_Library   library,\r\n               const char*  filepathname,\r\n               FT_Long      face_index,\r\n               FT_Face     *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Memory_Face                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Open_Face to open a font which has been    */\r\n  /*    loaded into memory.                                                */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    file_base  :: A pointer to the beginning of the font data.         */\r\n  /*                                                                       */\r\n  /*    file_size  :: The size of the memory chunk used by the font data.  */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the font.  The first    */\r\n  /*                  face has index~0.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.  If `face_index' is   */\r\n  /*                  greater than or equal to zero, it must be non-NULL.  */\r\n  /*                  See @FT_Open_Face for more details.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You must not deallocate the memory before calling @FT_Done_Face.   */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Memory_Face( FT_Library      library,\r\n                      const FT_Byte*  file_base,\r\n                      FT_Long         file_size,\r\n                      FT_Long         face_index,\r\n                      FT_Face        *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Open_Face                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a face object from a given resource described by            */\r\n  /*    @FT_Open_Args.                                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    args       :: A pointer to an `FT_Open_Args' structure which must  */\r\n  /*                  be filled by the caller.                             */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the font.  The first    */\r\n  /*                  face has index~0.                                    */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.  If `face_index' is   */\r\n  /*                  greater than or equal to zero, it must be non-NULL.  */\r\n  /*                  See note below.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Unlike FreeType 1.x, this function automatically creates a glyph   */\r\n  /*    slot for the face object which can be accessed directly through    */\r\n  /*    `face->glyph'.                                                     */\r\n  /*                                                                       */\r\n  /*    FT_Open_Face can be used to quickly check whether the font         */\r\n  /*    format of a given font resource is supported by FreeType.  If the  */\r\n  /*    `face_index' field is negative, the function's return value is~0   */\r\n  /*    if the font format is recognized, or non-zero otherwise;           */\r\n  /*    the function returns a more or less empty face handle in `*aface'  */\r\n  /*    (if `aface' isn't NULL).  The only useful field in this special    */\r\n  /*    case is `face->num_faces' which gives the number of faces within   */\r\n  /*    the font file.  After examination, the returned @FT_Face structure */\r\n  /*    should be deallocated with a call to @FT_Done_Face.                */\r\n  /*                                                                       */\r\n  /*    Each new face object created with this function also owns a        */\r\n  /*    default @FT_Size object, accessible as `face->size'.               */\r\n  /*                                                                       */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Face.                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Open_Face( FT_Library           library,\r\n                const FT_Open_Args*  args,\r\n                FT_Long              face_index,\r\n                FT_Face             *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Attach_File                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Attach_Stream to attach a file.            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face         :: The target face object.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    filepathname :: The pathname.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Attach_File( FT_Face      face,\r\n                  const char*  filepathname );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Attach_Stream                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    `Attach' data to a face object.  Normally, this is used to read    */\r\n  /*    additional information for the face object.  For example, you can  */\r\n  /*    attach an AFM file that comes with a Type~1 font to get the        */\r\n  /*    kerning values and other metrics.                                  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: The target face object.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    parameters :: A pointer to @FT_Open_Args which must be filled by   */\r\n  /*                  the caller.                                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The meaning of the `attach' (i.e., what really happens when the    */\r\n  /*    new file is read) is not fixed by FreeType itself.  It really      */\r\n  /*    depends on the font format (and thus the font driver).             */\r\n  /*                                                                       */\r\n  /*    Client applications are expected to know what they are doing       */\r\n  /*    when invoking this function.  Most drivers simply do not implement */\r\n  /*    file attachments.                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Attach_Stream( FT_Face        face,\r\n                    FT_Open_Args*  parameters );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Reference_Face                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A counter gets initialized to~1 at the time an @FT_Face structure  */\r\n  /*    is created.  This function increments the counter.  @FT_Done_Face  */\r\n  /*    then only destroys a face if the counter is~1, otherwise it simply */\r\n  /*    decrements the counter.                                            */\r\n  /*                                                                       */\r\n  /*    This function helps in managing life-cycles of structures which    */\r\n  /*    reference @FT_Face objects.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to a target face object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.4.2                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Reference_Face( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Face                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard a given face object, as well as all of its child slots and */\r\n  /*    sizes.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to a target face object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Face.                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_Face( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Select_Size                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select a bitmap strike.                                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face         :: A handle to a target face object.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    strike_index :: The index of the bitmap strike in the              */\r\n  /*                    `available_sizes' field of @FT_FaceRec structure.  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Select_Size( FT_Face  face,\r\n                  FT_Int   strike_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Size_Request_Type                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type that lists the supported size request types.   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_SIZE_REQUEST_TYPE_NOMINAL ::                                    */\r\n  /*      The nominal size.  The `units_per_EM' field of @FT_FaceRec is    */\r\n  /*      used to determine both scaling values.                           */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_REAL_DIM ::                                   */\r\n  /*      The real dimension.  The sum of the the `Ascender' and (minus    */\r\n  /*      of) the `Descender' fields of @FT_FaceRec are used to determine  */\r\n  /*      both scaling values.                                             */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_BBOX ::                                       */\r\n  /*      The font bounding box.  The width and height of the `bbox' field */\r\n  /*      of @FT_FaceRec are used to determine the horizontal and vertical */\r\n  /*      scaling value, respectively.                                     */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_CELL ::                                       */\r\n  /*      The `max_advance_width' field of @FT_FaceRec is used to          */\r\n  /*      determine the horizontal scaling value; the vertical scaling     */\r\n  /*      value is determined the same way as                              */\r\n  /*      @FT_SIZE_REQUEST_TYPE_REAL_DIM does.  Finally, both scaling      */\r\n  /*      values are set to the smaller one.  This type is useful if you   */\r\n  /*      want to specify the font size for, say, a window of a given      */\r\n  /*      dimension and 80x24 cells.                                       */\r\n  /*                                                                       */\r\n  /*    FT_SIZE_REQUEST_TYPE_SCALES ::                                     */\r\n  /*      Specify the scaling values directly.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The above descriptions only apply to scalable formats.  For bitmap */\r\n  /*    formats, the behaviour is up to the driver.                        */\r\n  /*                                                                       */\r\n  /*    See the note section of @FT_Size_Metrics if you wonder how size    */\r\n  /*    requesting relates to scaling values.                              */\r\n  /*                                                                       */\r\n  typedef enum  FT_Size_Request_Type_\r\n  {\r\n    FT_SIZE_REQUEST_TYPE_NOMINAL,\r\n    FT_SIZE_REQUEST_TYPE_REAL_DIM,\r\n    FT_SIZE_REQUEST_TYPE_BBOX,\r\n    FT_SIZE_REQUEST_TYPE_CELL,\r\n    FT_SIZE_REQUEST_TYPE_SCALES,\r\n\r\n    FT_SIZE_REQUEST_TYPE_MAX\r\n\r\n  } FT_Size_Request_Type;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_RequestRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a size request.                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    type           :: See @FT_Size_Request_Type.                       */\r\n  /*                                                                       */\r\n  /*    width          :: The desired width.                               */\r\n  /*                                                                       */\r\n  /*    height         :: The desired height.                              */\r\n  /*                                                                       */\r\n  /*    horiResolution :: The horizontal resolution.  If set to zero,      */\r\n  /*                      `width' is treated as a 26.6 fractional pixel    */\r\n  /*                      value.                                           */\r\n  /*                                                                       */\r\n  /*    vertResolution :: The vertical resolution.  If set to zero,        */\r\n  /*                      `height' is treated as a 26.6 fractional pixel   */\r\n  /*                      value.                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If `width' is zero, then the horizontal scaling value is set equal */\r\n  /*    to the vertical scaling value, and vice versa.                     */\r\n  /*                                                                       */\r\n  typedef struct  FT_Size_RequestRec_\r\n  {\r\n    FT_Size_Request_Type  type;\r\n    FT_Long               width;\r\n    FT_Long               height;\r\n    FT_UInt               horiResolution;\r\n    FT_UInt               vertResolution;\r\n\r\n  } FT_Size_RequestRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_Request                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a size request structure.                              */\r\n  /*                                                                       */\r\n  typedef struct FT_Size_RequestRec_  *FT_Size_Request;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Request_Size                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Resize the scale of the active @FT_Size object in a face.          */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face :: A handle to a target face object.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    req  :: A pointer to a @FT_Size_RequestRec.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Although drivers may select the bitmap strike matching the         */\r\n  /*    request, you should not rely on this if you intend to select a     */\r\n  /*    particular bitmap strike.  Use @FT_Select_Size instead in that     */\r\n  /*    case.                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Request_Size( FT_Face          face,\r\n                   FT_Size_Request  req );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Char_Size                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Request_Size to request the nominal size   */\r\n  /*    (in points).                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face            :: A handle to a target face object.               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    char_width      :: The nominal width, in 26.6 fractional points.   */\r\n  /*                                                                       */\r\n  /*    char_height     :: The nominal height, in 26.6 fractional points.  */\r\n  /*                                                                       */\r\n  /*    horz_resolution :: The horizontal resolution in dpi.               */\r\n  /*                                                                       */\r\n  /*    vert_resolution :: The vertical resolution in dpi.                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If either the character width or height is zero, it is set equal   */\r\n  /*    to the other value.                                                */\r\n  /*                                                                       */\r\n  /*    If either the horizontal or vertical resolution is zero, it is set */\r\n  /*    equal to the other value.                                          */\r\n  /*                                                                       */\r\n  /*    A character width or height smaller than 1pt is set to 1pt; if     */\r\n  /*    both resolution values are zero, they are set to 72dpi.            */\r\n  /*                                                                       */\r\n  /*    Don't use this function if you are using the FreeType cache API.   */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Char_Size( FT_Face     face,\r\n                    FT_F26Dot6  char_width,\r\n                    FT_F26Dot6  char_height,\r\n                    FT_UInt     horz_resolution,\r\n                    FT_UInt     vert_resolution );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Pixel_Sizes                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function calls @FT_Request_Size to request the nominal size   */\r\n  /*    (in pixels).                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face         :: A handle to the target face object.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    pixel_width  :: The nominal width, in pixels.                      */\r\n  /*                                                                       */\r\n  /*    pixel_height :: The nominal height, in pixels.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Pixel_Sizes( FT_Face  face,\r\n                      FT_UInt  pixel_width,\r\n                      FT_UInt  pixel_height );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Load_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to load a single glyph into the glyph slot of a    */\r\n  /*    face object.                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face        :: A handle to the target face object where the glyph  */\r\n  /*                   is loaded.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph_index :: The index of the glyph in the font file.  For       */\r\n  /*                   CID-keyed fonts (either in PS or in CFF format)     */\r\n  /*                   this argument specifies the CID value.              */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   @FT_LOAD_XXX constants can be used to control the   */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The loaded glyph may be transformed.  See @FT_Set_Transform for    */\r\n  /*    the details.                                                       */\r\n  /*                                                                       */\r\n  /*    For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is        */\r\n  /*    returned for invalid CID values (this is, for CID values which     */\r\n  /*    don't have a corresponding glyph in the font).  See the discussion */\r\n  /*    of the @FT_FACE_FLAG_CID_KEYED flag for more details.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Load_Glyph( FT_Face   face,\r\n                 FT_UInt   glyph_index,\r\n                 FT_Int32  load_flags );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Load_Char                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to load a single glyph into the glyph slot of a    */\r\n  /*    face object, according to its character code.                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face        :: A handle to a target face object where the glyph    */\r\n  /*                   is loaded.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    char_code   :: The glyph's character code, according to the        */\r\n  /*                   current charmap used in the face.                   */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A flag indicating what to load for this glyph.  The */\r\n  /*                   @FT_LOAD_XXX constants can be used to control the   */\r\n  /*                   glyph loading process (e.g., whether the outline    */\r\n  /*                   should be scaled, whether to load bitmaps or not,   */\r\n  /*                   whether to hint the outline, etc).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Load_Char( FT_Face   face,\r\n                FT_ULong  char_code,\r\n                FT_Int32  load_flags );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_LOAD_XXX\r\n   *\r\n   * @description:\r\n   *   A list of bit-field constants used with @FT_Load_Glyph to indicate\r\n   *   what kind of operations to perform during glyph loading.\r\n   *\r\n   * @values:\r\n   *   FT_LOAD_DEFAULT ::\r\n   *     Corresponding to~0, this value is used as the default glyph load\r\n   *     operation.  In this case, the following happens:\r\n   *\r\n   *     1. FreeType looks for a bitmap for the glyph corresponding to the\r\n   *        face's current size.  If one is found, the function returns.\r\n   *        The bitmap data can be accessed from the glyph slot (see note\r\n   *        below).\r\n   *\r\n   *     2. If no embedded bitmap is searched or found, FreeType looks for a\r\n   *        scalable outline.  If one is found, it is loaded from the font\r\n   *        file, scaled to device pixels, then `hinted' to the pixel grid\r\n   *        in order to optimize it.  The outline data can be accessed from\r\n   *        the glyph slot (see note below).\r\n   *\r\n   *     Note that by default, the glyph loader doesn't render outlines into\r\n   *     bitmaps.  The following flags are used to modify this default\r\n   *     behaviour to more specific and useful cases.\r\n   *\r\n   *   FT_LOAD_NO_SCALE ::\r\n   *     Don't scale the outline glyph loaded, but keep it in font units.\r\n   *\r\n   *     This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and\r\n   *     unsets @FT_LOAD_RENDER.\r\n   *\r\n   *   FT_LOAD_NO_HINTING ::\r\n   *     Disable hinting.  This generally generates `blurrier' bitmap glyph\r\n   *     when the glyph is rendered in any of the anti-aliased modes.  See\r\n   *     also the note below.\r\n   *\r\n   *     This flag is implied by @FT_LOAD_NO_SCALE.\r\n   *\r\n   *   FT_LOAD_RENDER ::\r\n   *     Call @FT_Render_Glyph after the glyph is loaded.  By default, the\r\n   *     glyph is rendered in @FT_RENDER_MODE_NORMAL mode.  This can be\r\n   *     overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.\r\n   *\r\n   *     This flag is unset by @FT_LOAD_NO_SCALE.\r\n   *\r\n   *   FT_LOAD_NO_BITMAP ::\r\n   *     Ignore bitmap strikes when loading.  Bitmap-only fonts ignore this\r\n   *     flag.\r\n   *\r\n   *     @FT_LOAD_NO_SCALE always sets this flag.\r\n   *\r\n   *   FT_LOAD_VERTICAL_LAYOUT ::\r\n   *     Load the glyph for vertical text layout.  _Don't_ use it as it is\r\n   *     problematic currently.\r\n   *\r\n   *   FT_LOAD_FORCE_AUTOHINT ::\r\n   *     Indicates that the auto-hinter is preferred over the font's native\r\n   *     hinter.  See also the note below.\r\n   *\r\n   *   FT_LOAD_CROP_BITMAP ::\r\n   *     Indicates that the font driver should crop the loaded bitmap glyph\r\n   *     (i.e., remove all space around its black bits).  Not all drivers\r\n   *     implement this.\r\n   *\r\n   *   FT_LOAD_PEDANTIC ::\r\n   *     Indicates that the font driver should perform pedantic verifications\r\n   *     during glyph loading.  This is mostly used to detect broken glyphs\r\n   *     in fonts.  By default, FreeType tries to handle broken fonts also.\r\n   *\r\n   *   FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::\r\n   *     Indicates that the font driver should ignore the global advance\r\n   *     width defined in the font.  By default, that value is used as the\r\n   *     advance width for all glyphs when the face has\r\n   *     @FT_FACE_FLAG_FIXED_WIDTH set.\r\n   *\r\n   *     This flag exists for historical reasons (to support buggy CJK\r\n   *     fonts).\r\n   *\r\n   *   FT_LOAD_NO_RECURSE ::\r\n   *     This flag is only used internally.  It merely indicates that the\r\n   *     font driver should not load composite glyphs recursively.  Instead,\r\n   *     it should set the `num_subglyph' and `subglyphs' values of the\r\n   *     glyph slot accordingly, and set `glyph->format' to\r\n   *     @FT_GLYPH_FORMAT_COMPOSITE.\r\n   *\r\n   *     The description of sub-glyphs is not available to client\r\n   *     applications for now.\r\n   *\r\n   *     This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.\r\n   *\r\n   *   FT_LOAD_IGNORE_TRANSFORM ::\r\n   *     Indicates that the transform matrix set by @FT_Set_Transform should\r\n   *     be ignored.\r\n   *\r\n   *   FT_LOAD_MONOCHROME ::\r\n   *     This flag is used with @FT_LOAD_RENDER to indicate that you want to\r\n   *     render an outline glyph to a 1-bit monochrome bitmap glyph, with\r\n   *     8~pixels packed into each byte of the bitmap data.\r\n   *\r\n   *     Note that this has no effect on the hinting algorithm used.  You\r\n   *     should rather use @FT_LOAD_TARGET_MONO so that the\r\n   *     monochrome-optimized hinting algorithm is used.\r\n   *\r\n   *   FT_LOAD_LINEAR_DESIGN ::\r\n   *     Indicates that the `linearHoriAdvance' and `linearVertAdvance'\r\n   *     fields of @FT_GlyphSlotRec should be kept in font units.  See\r\n   *     @FT_GlyphSlotRec for details.\r\n   *\r\n   *   FT_LOAD_NO_AUTOHINT ::\r\n   *     Disable auto-hinter.  See also the note below.\r\n   *\r\n   * @note:\r\n   *   By default, hinting is enabled and the font's native hinter (see\r\n   *   @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter.  You can\r\n   *   disable hinting by setting @FT_LOAD_NO_HINTING or change the\r\n   *   precedence by setting @FT_LOAD_FORCE_AUTOHINT.  You can also set\r\n   *   @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be\r\n   *   used at all.\r\n   *\r\n   *   See the description of @FT_FACE_FLAG_TRICKY for a special exception\r\n   *   (affecting only a handful of Asian fonts).\r\n   *\r\n   *   Besides deciding which hinter to use, you can also decide which\r\n   *   hinting algorithm to use.  See @FT_LOAD_TARGET_XXX for details.\r\n   *\r\n   */\r\n#define FT_LOAD_DEFAULT                      0x0\r\n#define FT_LOAD_NO_SCALE                     0x1\r\n#define FT_LOAD_NO_HINTING                   0x2\r\n#define FT_LOAD_RENDER                       0x4\r\n#define FT_LOAD_NO_BITMAP                    0x8\r\n#define FT_LOAD_VERTICAL_LAYOUT              0x10\r\n#define FT_LOAD_FORCE_AUTOHINT               0x20\r\n#define FT_LOAD_CROP_BITMAP                  0x40\r\n#define FT_LOAD_PEDANTIC                     0x80\r\n#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH  0x200\r\n#define FT_LOAD_NO_RECURSE                   0x400\r\n#define FT_LOAD_IGNORE_TRANSFORM             0x800\r\n#define FT_LOAD_MONOCHROME                   0x1000\r\n#define FT_LOAD_LINEAR_DESIGN                0x2000\r\n#define FT_LOAD_NO_AUTOHINT                  0x8000U\r\n\r\n  /* */\r\n\r\n  /* used internally only by certain font drivers! */\r\n#define FT_LOAD_ADVANCE_ONLY                 0x100\r\n#define FT_LOAD_SBITS_ONLY                   0x4000\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_LOAD_TARGET_XXX\r\n   *\r\n   * @description:\r\n   *   A list of values that are used to select a specific hinting algorithm\r\n   *   to use by the hinter.  You should OR one of these values to your\r\n   *   `load_flags' when calling @FT_Load_Glyph.\r\n   *\r\n   *   Note that font's native hinters may ignore the hinting algorithm you\r\n   *   have specified (e.g., the TrueType bytecode interpreter).  You can set\r\n   *   @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.\r\n   *\r\n   *   Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it\r\n   *   always implies @FT_LOAD_FORCE_AUTOHINT.\r\n   *\r\n   * @values:\r\n   *   FT_LOAD_TARGET_NORMAL ::\r\n   *     This corresponds to the default hinting algorithm, optimized for\r\n   *     standard gray-level rendering.  For monochrome output, use\r\n   *     @FT_LOAD_TARGET_MONO instead.\r\n   *\r\n   *   FT_LOAD_TARGET_LIGHT ::\r\n   *     A lighter hinting algorithm for non-monochrome modes.  Many\r\n   *     generated glyphs are more fuzzy but better resemble its original\r\n   *     shape.  A bit like rendering on Mac OS~X.\r\n   *\r\n   *     As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.\r\n   *\r\n   *   FT_LOAD_TARGET_MONO ::\r\n   *     Strong hinting algorithm that should only be used for monochrome\r\n   *     output.  The result is probably unpleasant if the glyph is rendered\r\n   *     in non-monochrome modes.\r\n   *\r\n   *   FT_LOAD_TARGET_LCD ::\r\n   *     A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally\r\n   *     decimated LCD displays.\r\n   *\r\n   *   FT_LOAD_TARGET_LCD_V ::\r\n   *     A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically\r\n   *     decimated LCD displays.\r\n   *\r\n   * @note:\r\n   *   You should use only _one_ of the FT_LOAD_TARGET_XXX values in your\r\n   *   `load_flags'.  They can't be ORed.\r\n   *\r\n   *   If @FT_LOAD_RENDER is also set, the glyph is rendered in the\r\n   *   corresponding mode (i.e., the mode which matches the used algorithm\r\n   *   best) unless @FT_LOAD_MONOCHROME is set.\r\n   *\r\n   *   You can use a hinting algorithm that doesn't correspond to the same\r\n   *   rendering mode.  As an example, it is possible to use the `light'\r\n   *   hinting algorithm and have the results rendered in horizontal LCD\r\n   *   pixel mode, with code like\r\n   *\r\n   *     {\r\n   *       FT_Load_Glyph( face, glyph_index,\r\n   *                      load_flags | FT_LOAD_TARGET_LIGHT );\r\n   *\r\n   *       FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );\r\n   *     }\r\n   *\r\n   */\r\n#define FT_LOAD_TARGET_( x )   ( (FT_Int32)( (x) & 15 ) << 16 )\r\n\r\n#define FT_LOAD_TARGET_NORMAL  FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )\r\n#define FT_LOAD_TARGET_LIGHT   FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )\r\n#define FT_LOAD_TARGET_MONO    FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )\r\n#define FT_LOAD_TARGET_LCD     FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )\r\n#define FT_LOAD_TARGET_LCD_V   FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_LOAD_TARGET_MODE\r\n   *\r\n   * @description:\r\n   *   Return the @FT_Render_Mode corresponding to a given\r\n   *   @FT_LOAD_TARGET_XXX value.\r\n   *\r\n   */\r\n#define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Transform                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to set the transformation that is applied to glyph */\r\n  /*    images when they are loaded into a glyph slot through              */\r\n  /*    @FT_Load_Glyph.                                                    */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face   :: A handle to the source face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix :: A pointer to the transformation's 2x2 matrix.  Use~0 for */\r\n  /*              the identity matrix.                                     */\r\n  /*    delta  :: A pointer to the translation vector.  Use~0 for the null */\r\n  /*              vector.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The transformation is only applied to scalable image formats after */\r\n  /*    the glyph has been loaded.  It means that hinting is unaltered by  */\r\n  /*    the transformation and is performed on the character size given in */\r\n  /*    the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes.         */\r\n  /*                                                                       */\r\n  /*    Note that this also transforms the `face.glyph.advance' field, but */\r\n  /*    *not* the values in `face.glyph.metrics'.                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Set_Transform( FT_Face     face,\r\n                    FT_Matrix*  matrix,\r\n                    FT_Vector*  delta );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Render_Mode                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type that lists the render modes supported by       */\r\n  /*    FreeType~2.  Each mode corresponds to a specific type of scanline  */\r\n  /*    conversion performed on the outline.                               */\r\n  /*                                                                       */\r\n  /*    For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode'     */\r\n  /*    field in the @FT_GlyphSlotRec structure gives the format of the    */\r\n  /*    returned bitmap.                                                   */\r\n  /*                                                                       */\r\n  /*    All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity.   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_RENDER_MODE_NORMAL ::                                           */\r\n  /*      This is the default render mode; it corresponds to 8-bit         */\r\n  /*      anti-aliased bitmaps.                                            */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_LIGHT ::                                            */\r\n  /*      This is equivalent to @FT_RENDER_MODE_NORMAL.  It is only        */\r\n  /*      defined as a separate value because render modes are also used   */\r\n  /*      indirectly to define hinting algorithm selectors.  See           */\r\n  /*      @FT_LOAD_TARGET_XXX for details.                                 */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_MONO ::                                             */\r\n  /*      This mode corresponds to 1-bit bitmaps (with 2~levels of         */\r\n  /*      opacity).                                                        */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_LCD ::                                              */\r\n  /*      This mode corresponds to horizontal RGB and BGR sub-pixel        */\r\n  /*      displays like LCD screens.  It produces 8-bit bitmaps that are   */\r\n  /*      3~times the width of the original glyph outline in pixels, and   */\r\n  /*      which use the @FT_PIXEL_MODE_LCD mode.                           */\r\n  /*                                                                       */\r\n  /*    FT_RENDER_MODE_LCD_V ::                                            */\r\n  /*      This mode corresponds to vertical RGB and BGR sub-pixel displays */\r\n  /*      (like PDA screens, rotated LCD displays, etc.).  It produces     */\r\n  /*      8-bit bitmaps that are 3~times the height of the original        */\r\n  /*      glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode.   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */\r\n  /*    filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */\r\n  /*    (not active in the default builds).  It is up to the caller to     */\r\n  /*    either call @FT_Library_SetLcdFilter (if available) or do the      */\r\n  /*    filtering itself.                                                  */\r\n  /*                                                                       */\r\n  /*    The selected render mode only affects vector glyphs of a font.     */\r\n  /*    Embedded bitmaps often have a different pixel mode like            */\r\n  /*    @FT_PIXEL_MODE_MONO.  You can use @FT_Bitmap_Convert to transform  */\r\n  /*    them into 8-bit pixmaps.                                           */\r\n  /*                                                                       */\r\n  typedef enum  FT_Render_Mode_\r\n  {\r\n    FT_RENDER_MODE_NORMAL = 0,\r\n    FT_RENDER_MODE_LIGHT,\r\n    FT_RENDER_MODE_MONO,\r\n    FT_RENDER_MODE_LCD,\r\n    FT_RENDER_MODE_LCD_V,\r\n\r\n    FT_RENDER_MODE_MAX\r\n\r\n  } FT_Render_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_render_mode_xxx                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    These constants are deprecated.  Use the corresponding             */\r\n  /*    @FT_Render_Mode values instead.                                    */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL                */\r\n  /*    ft_render_mode_mono   :: see @FT_RENDER_MODE_MONO                  */\r\n  /*                                                                       */\r\n#define ft_render_mode_normal  FT_RENDER_MODE_NORMAL\r\n#define ft_render_mode_mono    FT_RENDER_MODE_MONO\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Render_Glyph                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a given glyph image to a bitmap.  It does so by inspecting */\r\n  /*    the glyph image format, finding the relevant renderer, and         */\r\n  /*    invoking it.                                                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    slot        :: A handle to the glyph slot containing the image to  */\r\n  /*                   convert.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    render_mode :: This is the render mode used to render the glyph    */\r\n  /*                   image into a bitmap.  See @FT_Render_Mode for a     */\r\n  /*                   list of possible values.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Render_Glyph( FT_GlyphSlot    slot,\r\n                   FT_Render_Mode  render_mode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Kerning_Mode                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used to specify which kerning values to return in   */\r\n  /*    @FT_Get_Kerning.                                                   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_KERNING_DEFAULT  :: Return scaled and grid-fitted kerning       */\r\n  /*                           distances (value is~0).                     */\r\n  /*                                                                       */\r\n  /*    FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning    */\r\n  /*                           distances.                                  */\r\n  /*                                                                       */\r\n  /*    FT_KERNING_UNSCALED :: Return the kerning vector in original font  */\r\n  /*                           units.                                      */\r\n  /*                                                                       */\r\n  typedef enum  FT_Kerning_Mode_\r\n  {\r\n    FT_KERNING_DEFAULT  = 0,\r\n    FT_KERNING_UNFITTED,\r\n    FT_KERNING_UNSCALED\r\n\r\n  } FT_Kerning_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    ft_kerning_default                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This constant is deprecated.  Please use @FT_KERNING_DEFAULT       */\r\n  /*    instead.                                                           */\r\n  /*                                                                       */\r\n#define ft_kerning_default   FT_KERNING_DEFAULT\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    ft_kerning_unfitted                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This constant is deprecated.  Please use @FT_KERNING_UNFITTED      */\r\n  /*    instead.                                                           */\r\n  /*                                                                       */\r\n#define ft_kerning_unfitted  FT_KERNING_UNFITTED\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    ft_kerning_unscaled                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This constant is deprecated.  Please use @FT_KERNING_UNSCALED      */\r\n  /*    instead.                                                           */\r\n  /*                                                                       */\r\n#define ft_kerning_unscaled  FT_KERNING_UNSCALED\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Kerning                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the kerning vector between two glyphs of a same face.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to a source face object.                   */\r\n  /*                                                                       */\r\n  /*    left_glyph  :: The index of the left glyph in the kern pair.       */\r\n  /*                                                                       */\r\n  /*    right_glyph :: The index of the right glyph in the kern pair.      */\r\n  /*                                                                       */\r\n  /*    kern_mode   :: See @FT_Kerning_Mode for more information.          */\r\n  /*                   Determines the scale and dimension of the returned  */\r\n  /*                   kerning vector.                                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    akerning    :: The kerning vector.  This is either in font units   */\r\n  /*                   or in pixels (26.6 format) for scalable formats,    */\r\n  /*                   and in pixels for fixed-sizes formats.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Only horizontal layouts (left-to-right & right-to-left) are        */\r\n  /*    supported by this method.  Other layouts, or more sophisticated    */\r\n  /*    kernings, are out of the scope of this API function -- they can be */\r\n  /*    implemented through format-specific interfaces.                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Kerning( FT_Face     face,\r\n                  FT_UInt     left_glyph,\r\n                  FT_UInt     right_glyph,\r\n                  FT_UInt     kern_mode,\r\n                  FT_Vector  *akerning );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Track_Kerning                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the track kerning for a given face object at a given size.  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to a source face object.                    */\r\n  /*                                                                       */\r\n  /*    point_size :: The point size in 16.16 fractional points.           */\r\n  /*                                                                       */\r\n  /*    degree     :: The degree of tightness.                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    akerning   :: The kerning in 16.16 fractional points.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Track_Kerning( FT_Face    face,\r\n                        FT_Fixed   point_size,\r\n                        FT_Int     degree,\r\n                        FT_Fixed*  akerning );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Glyph_Name                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the ASCII name of a given glyph in a face.  This only     */\r\n  /*    works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to a source face object.                   */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The glyph index.                                    */\r\n  /*                                                                       */\r\n  /*    buffer_max  :: The maximal number of bytes available in the        */\r\n  /*                   buffer.                                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    buffer      :: A pointer to a target buffer where the name is      */\r\n  /*                   copied to.                                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An error is returned if the face doesn't provide glyph names or if */\r\n  /*    the glyph index is invalid.  In all cases of failure, the first    */\r\n  /*    byte of `buffer' is set to~0 to indicate an empty name.            */\r\n  /*                                                                       */\r\n  /*    The glyph name is truncated to fit within the buffer if it is too  */\r\n  /*    long.  The returned string is always zero-terminated.              */\r\n  /*                                                                       */\r\n  /*    This function is not compiled within the library if the config     */\r\n  /*    macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in              */\r\n  /*    `include/freetype/config/ftoptions.h'.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Glyph_Name( FT_Face     face,\r\n                     FT_UInt     glyph_index,\r\n                     FT_Pointer  buffer,\r\n                     FT_UInt     buffer_max );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Postscript_Name                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the ASCII PostScript name of a given face, if available.  */\r\n  /*    This only works with PostScript and TrueType fonts.                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face object.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to the face's PostScript name.  NULL if unavailable.     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned pointer is owned by the face and is destroyed with    */\r\n  /*    it.                                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( const char* )\r\n  FT_Get_Postscript_Name( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Select_Charmap                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select a given charmap by its encoding tag (as listed in           */\r\n  /*    `freetype.h').                                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face     :: A handle to the source face object.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    encoding :: A handle to the selected encoding.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function returns an error if no charmap in the face           */\r\n  /*    corresponds to the encoding queried here.                          */\r\n  /*                                                                       */\r\n  /*    Because many fonts contain more than a single cmap for Unicode     */\r\n  /*    encoding, this function has some special code to select the one    */\r\n  /*    which covers Unicode best (`best' in the sense that a UCS-4 cmap   */\r\n  /*    is preferred to a UCS-2 cmap).  It is thus preferable to           */\r\n  /*    @FT_Set_Charmap in this case.                                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Select_Charmap( FT_Face      face,\r\n                     FT_Encoding  encoding );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Charmap                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select a given charmap for character code to glyph index mapping.  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face    :: A handle to the source face object.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charmap :: A handle to the selected charmap.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function returns an error if the charmap is not part of       */\r\n  /*    the face (i.e., if it is not listed in the `face->charmaps'        */\r\n  /*    table).                                                            */\r\n  /*                                                                       */\r\n  /*    It also fails if a type~14 charmap is selected.                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Charmap( FT_Face     face,\r\n                  FT_CharMap  charmap );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Get_Charmap_Index\r\n   *\r\n   * @description:\r\n   *   Retrieve index of a given charmap.\r\n   *\r\n   * @input:\r\n   *   charmap ::\r\n   *     A handle to a charmap.\r\n   *\r\n   * @return:\r\n   *   The index into the array of character maps within the face to which\r\n   *   `charmap' belongs.  If an error occurs, -1 is returned.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Get_Charmap_Index( FT_CharMap  charmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Char_Index                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the glyph index of a given character code.  This function   */\r\n  /*    uses a charmap object to do the mapping.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the source face object.                    */\r\n  /*                                                                       */\r\n  /*    charcode :: The character code.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The glyph index.  0~means `undefined character code'.              */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If you use FreeType to manipulate the contents of font files       */\r\n  /*    directly, be aware that the glyph index returned by this function  */\r\n  /*    doesn't always correspond to the internal indices used within      */\r\n  /*    the file.  This is done to ensure that value~0 always corresponds  */\r\n  /*    to the `missing glyph'.                                            */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Get_Char_Index( FT_Face   face,\r\n                     FT_ULong  charcode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_First_Char                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to return the first character code in the    */\r\n  /*    current charmap of a given face.  It also returns the              */\r\n  /*    corresponding glyph index.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: A handle to the source face object.                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    agindex :: Glyph index of first character code.  0~if charmap is   */\r\n  /*               empty.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The charmap's first character code.                                */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should use this function with @FT_Get_Next_Char to be able to  */\r\n  /*    parse all character codes available in a given charmap.  The code  */\r\n  /*    should look like this:                                             */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      FT_ULong  charcode;                                              */\r\n  /*      FT_UInt   gindex;                                                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      charcode = FT_Get_First_Char( face, &gindex );                   */\r\n  /*      while ( gindex != 0 )                                            */\r\n  /*      {                                                                */\r\n  /*        ... do something with (charcode,gindex) pair ...               */\r\n  /*                                                                       */\r\n  /*        charcode = FT_Get_Next_Char( face, charcode, &gindex );        */\r\n  /*      }                                                                */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Note that `*agindex' is set to~0 if the charmap is empty.  The     */\r\n  /*    result itself can be~0 in two cases: if the charmap is empty or    */\r\n  /*    if the value~0 is the first valid character code.                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ULong )\r\n  FT_Get_First_Char( FT_Face   face,\r\n                     FT_UInt  *agindex );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Next_Char                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to return the next character code in the     */\r\n  /*    current charmap of a given face following the value `char_code',   */\r\n  /*    as well as the corresponding glyph index.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face      :: A handle to the source face object.                   */\r\n  /*    char_code :: The starting character code.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    agindex   :: Glyph index of next character code.  0~if charmap     */\r\n  /*                 is empty.                                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The charmap's next character code.                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should use this function with @FT_Get_First_Char to walk       */\r\n  /*    over all character codes available in a given charmap.  See the    */\r\n  /*    note for this function for a simple code example.                  */\r\n  /*                                                                       */\r\n  /*    Note that `*agindex' is set to~0 when there are no more codes in   */\r\n  /*    the charmap.                                                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ULong )\r\n  FT_Get_Next_Char( FT_Face    face,\r\n                    FT_ULong   char_code,\r\n                    FT_UInt   *agindex );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Name_Index                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the glyph index of a given glyph name.  This function uses  */\r\n  /*    driver specific objects to do the translation.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to the source face object.                  */\r\n  /*                                                                       */\r\n  /*    glyph_name :: The glyph name.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The glyph index.  0~means `undefined character code'.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Get_Name_Index( FT_Face     face,\r\n                     FT_String*  glyph_name );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_SUBGLYPH_FLAG_XXX\r\n   *\r\n   * @description:\r\n   *   A list of constants used to describe subglyphs.  Please refer to the\r\n   *   TrueType specification for the meaning of the various flags.\r\n   *\r\n   * @values:\r\n   *   FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::\r\n   *   FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::\r\n   *   FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::\r\n   *   FT_SUBGLYPH_FLAG_SCALE ::\r\n   *   FT_SUBGLYPH_FLAG_XY_SCALE ::\r\n   *   FT_SUBGLYPH_FLAG_2X2 ::\r\n   *   FT_SUBGLYPH_FLAG_USE_MY_METRICS ::\r\n   *\r\n   */\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2\r\n#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4\r\n#define FT_SUBGLYPH_FLAG_SCALE                   8\r\n#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40\r\n#define FT_SUBGLYPH_FLAG_2X2                  0x80\r\n#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Get_SubGlyph_Info\r\n   *\r\n   * @description:\r\n   *   Retrieve a description of a given subglyph.  Only use it if\r\n   *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is\r\n   *   returned otherwise.\r\n   *\r\n   * @input:\r\n   *   glyph ::\r\n   *     The source glyph slot.\r\n   *\r\n   *   sub_index ::\r\n   *     The index of the subglyph.  Must be less than\r\n   *     `glyph->num_subglyphs'.\r\n   *\r\n   * @output:\r\n   *   p_index ::\r\n   *     The glyph index of the subglyph.\r\n   *\r\n   *   p_flags ::\r\n   *     The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.\r\n   *\r\n   *   p_arg1 ::\r\n   *     The subglyph's first argument (if any).\r\n   *\r\n   *   p_arg2 ::\r\n   *     The subglyph's second argument (if any).\r\n   *\r\n   *   p_transform ::\r\n   *     The subglyph transformation (if any).\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be\r\n   *   interpreted depending on the flags returned in `*p_flags'.  See the\r\n   *   TrueType specification for details.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,\r\n                        FT_UInt       sub_index,\r\n                        FT_Int       *p_index,\r\n                        FT_UInt      *p_flags,\r\n                        FT_Int       *p_arg1,\r\n                        FT_Int       *p_arg2,\r\n                        FT_Matrix    *p_transform );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_FSTYPE_XXX                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit flags used in the `fsType' field of the OS/2 table   */\r\n  /*    in a TrueType or OpenType font and the `FSType' entry in a         */\r\n  /*    PostScript font.  These bit flags are returned by                  */\r\n  /*    @FT_Get_FSType_Flags; they inform client applications of embedding */\r\n  /*    and subsetting restrictions associated with a font.                */\r\n  /*                                                                       */\r\n  /*    See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for  */\r\n  /*    more details.                                                      */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING ::                                 */\r\n  /*      Fonts with no fsType bit set may be embedded and permanently     */\r\n  /*      installed on the remote system by an application.                */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING ::                          */\r\n  /*      Fonts that have only this bit set must not be modified, embedded */\r\n  /*      or exchanged in any manner without first obtaining permission of */\r\n  /*      the font software copyright owner.                               */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING ::                           */\r\n  /*      If this bit is set, the font may be embedded and temporarily     */\r\n  /*      loaded on the remote system.  Documents containing Preview &     */\r\n  /*      Print fonts must be opened `read-only'; no edits can be applied  */\r\n  /*      to the document.                                                 */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_EDITABLE_EMBEDDING ::                                    */\r\n  /*      If this bit is set, the font may be embedded but must only be    */\r\n  /*      installed temporarily on other systems.  In contrast to Preview  */\r\n  /*      & Print fonts, documents containing editable fonts may be opened */\r\n  /*      for reading, editing is permitted, and changes may be saved.     */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_NO_SUBSETTING ::                                         */\r\n  /*      If this bit is set, the font may not be subsetted prior to       */\r\n  /*      embedding.                                                       */\r\n  /*                                                                       */\r\n  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY ::                                 */\r\n  /*      If this bit is set, only bitmaps contained in the font may be    */\r\n  /*      embedded; no outline data may be embedded.  If there are no      */\r\n  /*      bitmaps available in the font, then the font is unembeddable.    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    While the fsType flags can indicate that a font may be embedded, a */\r\n  /*    license with the font vendor may be separately required to use the */\r\n  /*    font in this way.                                                  */\r\n  /*                                                                       */\r\n#define FT_FSTYPE_INSTALLABLE_EMBEDDING         0x0000\r\n#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING  0x0002\r\n#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING   0x0004\r\n#define FT_FSTYPE_EDITABLE_EMBEDDING            0x0008\r\n#define FT_FSTYPE_NO_SUBSETTING                 0x0100\r\n#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY         0x0200\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_FSType_Flags                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the fsType flags for a font.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face object.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The fsType flags, @FT_FSTYPE_XXX.                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Use this function rather than directly reading the `fs_type' field */\r\n  /*    in the @PS_FontInfoRec structure which is only guaranteed to       */\r\n  /*    return the correct results for Type~1 fonts.                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UShort )\r\n  FT_Get_FSType_Flags( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    glyph_variants                                                     */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Glyph Variants                                                     */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    The FreeType~2 interface to Unicode Ideographic Variation          */\r\n  /*    Sequences (IVS), using the SFNT cmap format~14.                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Many CJK characters have variant forms.  They are a sort of grey   */\r\n  /*    area somewhere between being totally irrelevant and semantically   */\r\n  /*    distinct; for this reason, the Unicode consortium decided to       */\r\n  /*    introduce Ideographic Variation Sequences (IVS), consisting of a   */\r\n  /*    Unicode base character and one of 240 variant selectors            */\r\n  /*    (U+E0100-U+E01EF), instead of further extending the already huge   */\r\n  /*    code range for CJK characters.                                     */\r\n  /*                                                                       */\r\n  /*    An IVS is registered and unique; for further details please refer  */\r\n  /*    to Unicode Technical Report #37, the Ideographic Variation         */\r\n  /*    Database.  To date (October 2007), the character with the most     */\r\n  /*    variants is U+908A, having 8~such IVS.                             */\r\n  /*                                                                       */\r\n  /*    Adobe and MS decided to support IVS with a new cmap subtable       */\r\n  /*    (format~14).  It is an odd subtable because it is not a mapping of */\r\n  /*    input code points to glyphs, but contains lists of all variants    */\r\n  /*    supported by the font.                                             */\r\n  /*                                                                       */\r\n  /*    A variant may be either `default' or `non-default'.  A default     */\r\n  /*    variant is the one you will get for that code point if you look it */\r\n  /*    up in the standard Unicode cmap.  A non-default variant is a       */\r\n  /*    different glyph.                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetCharVariantIndex                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the glyph index of a given character code as modified by    */\r\n  /*    the variation selector.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    charcode ::                                                        */\r\n  /*      The character code point in Unicode.                             */\r\n  /*                                                                       */\r\n  /*    variantSelector ::                                                 */\r\n  /*      The Unicode code point of the variation selector.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The glyph index.  0~means either `undefined character code', or    */\r\n  /*    `undefined selector code', or `no variation selector cmap          */\r\n  /*    subtable', or `current CharMap is not Unicode'.                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If you use FreeType to manipulate the contents of font files       */\r\n  /*    directly, be aware that the glyph index returned by this function  */\r\n  /*    doesn't always correspond to the internal indices used within      */\r\n  /*    the file.  This is done to ensure that value~0 always corresponds  */\r\n  /*    to the `missing glyph'.                                            */\r\n  /*                                                                       */\r\n  /*    This function is only meaningful if                                */\r\n  /*      a) the font has a variation selector cmap sub table,             */\r\n  /*    and                                                                */\r\n  /*      b) the current charmap has a Unicode encoding.                   */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Face_GetCharVariantIndex( FT_Face   face,\r\n                               FT_ULong  charcode,\r\n                               FT_ULong  variantSelector );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetCharVariantIsDefault                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check whether this variant of this Unicode character is the one to */\r\n  /*    be found in the `cmap'.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    charcode ::                                                        */\r\n  /*      The character codepoint in Unicode.                              */\r\n  /*                                                                       */\r\n  /*    variantSelector ::                                                 */\r\n  /*      The Unicode codepoint of the variation selector.                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    1~if found in the standard (Unicode) cmap, 0~if found in the       */\r\n  /*    variation selector cmap, or -1 if it is not a variant.             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is only meaningful if the font has a variation       */\r\n  /*    selector cmap subtable.                                            */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Face_GetCharVariantIsDefault( FT_Face   face,\r\n                                   FT_ULong  charcode,\r\n                                   FT_ULong  variantSelector );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetVariantSelectors                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a zero-terminated list of Unicode variant selectors found   */\r\n  /*    in the font.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to an array of selector code points, or NULL if there is */\r\n  /*    no valid variant selector cmap subtable.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The last item in the array is~0; the array is owned by the         */\r\n  /*    @FT_Face object but can be overwritten or released on the next     */\r\n  /*    call to a FreeType function.                                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt32* )\r\n  FT_Face_GetVariantSelectors( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetVariantsOfChar                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a zero-terminated list of Unicode variant selectors found   */\r\n  /*    for the specified character code.                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    charcode ::                                                        */\r\n  /*      The character codepoint in Unicode.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to an array of variant selector code points which are    */\r\n  /*    active for the given character, or NULL if the corresponding list  */\r\n  /*    is empty.                                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The last item in the array is~0; the array is owned by the         */\r\n  /*    @FT_Face object but can be overwritten or released on the next     */\r\n  /*    call to a FreeType function.                                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt32* )\r\n  FT_Face_GetVariantsOfChar( FT_Face   face,\r\n                             FT_ULong  charcode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_GetCharsOfVariant                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a zero-terminated list of Unicode character codes found for */\r\n  /*    the specified variant selector.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      A handle to the source face object.                              */\r\n  /*                                                                       */\r\n  /*    variantSelector ::                                                 */\r\n  /*      The variant selector code point in Unicode.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A list of all the code points which are specified by this selector */\r\n  /*    (both default and non-default codes are returned) or NULL if there */\r\n  /*    is no valid cmap or the variant selector is invalid.               */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The last item in the array is~0; the array is owned by the         */\r\n  /*    @FT_Face object but can be overwritten or released on the next     */\r\n  /*    call to a FreeType function.                                       */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.6                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt32* )\r\n  FT_Face_GetCharsOfVariant( FT_Face   face,\r\n                             FT_ULong  variantSelector );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    computations                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Computations                                                       */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Crunching fixed numbers and vectors.                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains various functions used to perform            */\r\n  /*    computations on 16.16 fixed-float numbers or 2d vectors.           */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_MulDiv                                                          */\r\n  /*    FT_MulFix                                                          */\r\n  /*    FT_DivFix                                                          */\r\n  /*    FT_RoundFix                                                        */\r\n  /*    FT_CeilFix                                                         */\r\n  /*    FT_FloorFix                                                        */\r\n  /*    FT_Vector_Transform                                                */\r\n  /*    FT_Matrix_Multiply                                                 */\r\n  /*    FT_Matrix_Invert                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_MulDiv                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation `(a*b)/c'   */\r\n  /*    with maximal accuracy (it uses a 64-bit intermediate integer       */\r\n  /*    whenever necessary).                                               */\r\n  /*                                                                       */\r\n  /*    This function isn't necessarily as fast as some processor specific */\r\n  /*    operations, but is at least completely portable.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.                                        */\r\n  /*    c :: The divisor.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*b)/c'.  This function never traps when trying to */\r\n  /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */\r\n  /*    on the signs of `a' and `b'.                                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_MulDiv( FT_Long  a,\r\n             FT_Long  b,\r\n             FT_Long  c );\r\n\r\n\r\n  /* */\r\n\r\n  /* The following #if 0 ... #endif is for the documentation formatter, */\r\n  /* hiding the internal `FT_MULFIX_INLINED' macro.                     */\r\n\r\n#if 0\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_MulFix                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation             */\r\n  /*    `(a*b)/0x10000' with maximal accuracy.  Most of the time this is   */\r\n  /*    used to multiply a given value by a 16.16 fixed float factor.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */\r\n  /*         possible (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*b)/0x10000'.                                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function has been optimized for the case where the absolute   */\r\n  /*    value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */\r\n  /*    As this happens mainly when scaling from notional units to         */\r\n  /*    fractional pixels in FreeType, it resulted in noticeable speed     */\r\n  /*    improvements between versions 2.x and 1.x.                         */\r\n  /*                                                                       */\r\n  /*    As a conclusion, always try to place a 16.16 factor as the         */\r\n  /*    _second_ argument of this function; this can make a great          */\r\n  /*    difference.                                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_MulFix( FT_Long  a,\r\n             FT_Long  b );\r\n\r\n  /* */\r\n#endif\r\n\r\n#ifdef FT_MULFIX_INLINED\r\n#define FT_MulFix( a, b )  FT_MULFIX_INLINED( a, b )\r\n#else\r\n  FT_EXPORT( FT_Long )\r\n  FT_MulFix( FT_Long  a,\r\n             FT_Long  b );\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_DivFix                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation             */\r\n  /*    `(a*0x10000)/b' with maximal accuracy.  Most of the time, this is  */\r\n  /*    used to divide a given value by a 16.16 fixed float factor.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */\r\n  /*         possible (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*0x10000)/b'.                                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The optimization for FT_DivFix() is simple: If (a~<<~16) fits in   */\r\n  /*    32~bits, then the division is computed directly.  Otherwise, we    */\r\n  /*    use a specialized version of @FT_MulDiv.                           */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_DivFix( FT_Long  a,\r\n             FT_Long  b );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_RoundFix                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to round a 16.16 fixed number.         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The number to be rounded.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a + 0x8000) & -0x10000'.                           */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_RoundFix( FT_Fixed  a );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_CeilFix                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to compute the ceiling function of a   */\r\n  /*    16.16 fixed number.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The number for which the ceiling function is to be computed.  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a + 0x10000 - 1) & -0x10000'.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_CeilFix( FT_Fixed  a );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_FloorFix                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to compute the floor function of a     */\r\n  /*    16.16 fixed number.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The number for which the floor function is to be computed.    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `a & -0x10000'.                                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_FloorFix( FT_Fixed  a );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Vector_Transform                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Transform a single vector through a 2x2 matrix.                    */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    vector :: The target vector to transform.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix :: A pointer to the source 2x2 matrix.                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The result is undefined if either `vector' or `matrix' is invalid. */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Transform( FT_Vector*        vec,\r\n                       const FT_Matrix*  matrix );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    version                                                            */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    FreeType Version                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Functions and macros related to FreeType versions.                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Note that those functions and macros are of limited use because    */\r\n  /*    even a new release of FreeType with only documentation changes     */\r\n  /*    increases the version number.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FREETYPE_XXX\r\n   *\r\n   * @description:\r\n   *   These three macros identify the FreeType source code version.\r\n   *   Use @FT_Library_Version to access them at runtime.\r\n   *\r\n   * @values:\r\n   *   FREETYPE_MAJOR :: The major version number.\r\n   *   FREETYPE_MINOR :: The minor version number.\r\n   *   FREETYPE_PATCH :: The patch level.\r\n   *\r\n   * @note:\r\n   *   The version number of FreeType if built as a dynamic link library\r\n   *   with the `libtool' package is _not_ controlled by these three\r\n   *   macros.\r\n   *\r\n   */\r\n#define FREETYPE_MAJOR  2\r\n#define FREETYPE_MINOR  4\r\n#define FREETYPE_PATCH  4\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Library_Version                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the version of the FreeType library being used.  This is    */\r\n  /*    useful when dynamically linking to the library, since one cannot   */\r\n  /*    use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and               */\r\n  /*    @FREETYPE_PATCH.                                                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A source library handle.                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amajor  :: The major version number.                               */\r\n  /*                                                                       */\r\n  /*    aminor  :: The minor version number.                               */\r\n  /*                                                                       */\r\n  /*    apatch  :: The patch version number.                               */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The reason why this function takes a `library' argument is because */\r\n  /*    certain programs implement library initialization in a custom way  */\r\n  /*    that doesn't use @FT_Init_FreeType.                                */\r\n  /*                                                                       */\r\n  /*    In such cases, the library version might not be available before   */\r\n  /*    the library object has been created.                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Library_Version( FT_Library   library,\r\n                      FT_Int      *amajor,\r\n                      FT_Int      *aminor,\r\n                      FT_Int      *apatch );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_CheckTrueTypePatents                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parse all bytecode instructions of a TrueType font file to check   */\r\n  /*    whether any of the patented opcodes are used.  This is only useful */\r\n  /*    if you want to be able to use the unpatented hinter with           */\r\n  /*    fonts that do *not* use these opcodes.                             */\r\n  /*                                                                       */\r\n  /*    Note that this function parses *all* glyph instructions in the     */\r\n  /*    font file, which may be slow.                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A face handle.                                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    1~if this is a TrueType font that uses one of the patented         */\r\n  /*    opcodes, 0~otherwise.                                              */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since May 2010, TrueType hinting is no longer patented.            */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.5                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Bool )\r\n  FT_Face_CheckTrueTypePatents( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Face_SetUnpatentedHinting                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Enable or disable the unpatented hinter for a given face.          */\r\n  /*    Only enable it if you have determined that the face doesn't        */\r\n  /*    use any patented opcodes (see @FT_Face_CheckTrueTypePatents).      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face  :: A face handle.                                            */\r\n  /*                                                                       */\r\n  /*    value :: New boolean setting.                                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The old setting value.  This will always be false if this is not   */\r\n  /*    an SFNT font, or if the unpatented hinter is not compiled in this  */\r\n  /*    instance of the library.                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since May 2010, TrueType hinting is no longer patented.            */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.3.5                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Bool )\r\n  FT_Face_SetUnpatentedHinting( FT_Face  face,\r\n                                FT_Bool  value );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FREETYPE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftadvanc.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftadvanc.h                                                             */\r\n/*                                                                         */\r\n/*    Quick computation of advance widths (specification only).            */\r\n/*                                                                         */\r\n/*  Copyright 2008 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTADVANC_H__\r\n#define __FTADVANC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @section:\r\n   *   quick_advance\r\n   *\r\n   * @title:\r\n   *   Quick retrieval of advance values\r\n   *\r\n   * @abstract:\r\n   *   Retrieve horizontal and vertical advance values without processing\r\n   *   glyph outlines, if possible.\r\n   *\r\n   * @description:\r\n   *   This section contains functions to quickly extract advance values\r\n   *   without handling glyph outlines, if possible.\r\n   */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Const>                                                               */\r\n  /*    FT_ADVANCE_FLAG_FAST_ONLY                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A bit-flag to be OR-ed with the `flags' parameter of the           */\r\n  /*    @FT_Get_Advance and @FT_Get_Advances functions.                    */\r\n  /*                                                                       */\r\n  /*    If set, it indicates that you want these functions to fail if the  */\r\n  /*    corresponding hinting mode or font driver doesn't allow for very   */\r\n  /*    quick advance computation.                                         */\r\n  /*                                                                       */\r\n  /*    Typically, glyphs which are either unscaled, unhinted, bitmapped,  */\r\n  /*    or light-hinted can have their advance width computed very         */\r\n  /*    quickly.                                                           */\r\n  /*                                                                       */\r\n  /*    Normal and bytecode hinted modes, which require loading, scaling,  */\r\n  /*    and hinting of the glyph outline, are extremely slow by            */\r\n  /*    comparison.                                                        */\r\n  /*                                                                       */\r\n#define FT_ADVANCE_FLAG_FAST_ONLY  0x20000000UL\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Advance                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the advance value of a given glyph outline in an          */\r\n  /*    @FT_Face.  By default, the unhinted advance is returned in font    */\r\n  /*    units.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: The source @FT_Face handle.                          */\r\n  /*                                                                       */\r\n  /*    gindex     :: The glyph index.                                     */\r\n  /*                                                                       */\r\n  /*    load_flags :: A set of bit flags similar to those used when        */\r\n  /*                  calling @FT_Load_Glyph, used to determine what kind  */\r\n  /*                  of advances you need.                                */\r\n  /* <Output>                                                              */\r\n  /*    padvance :: The advance value, in either font units or 16.16       */\r\n  /*                format.                                                */\r\n  /*                                                                       */\r\n  /*                If @FT_LOAD_VERTICAL_LAYOUT is set, this is the        */\r\n  /*                vertical advance corresponding to a vertical layout.   */\r\n  /*                Otherwise, it is the horizontal advance in a           */\r\n  /*                horizontal layout.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */\r\n  /*    if the corresponding font backend doesn't have a quick way to      */\r\n  /*    retrieve the advances.                                             */\r\n  /*                                                                       */\r\n  /*    A scaled advance is returned in 16.16 format but isn't transformed */\r\n  /*    by the affine transformation specified by @FT_Set_Transform.       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Advance( FT_Face    face,\r\n                  FT_UInt    gindex,\r\n                  FT_Int32   load_flags,\r\n                  FT_Fixed  *padvance );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Advances                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the advance values of several glyph outlines in an        */\r\n  /*    @FT_Face.  By default, the unhinted advances are returned in font  */\r\n  /*    units.                                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: The source @FT_Face handle.                         */\r\n  /*                                                                       */\r\n  /*    start       :: The first glyph index.                              */\r\n  /*                                                                       */\r\n  /*    count       :: The number of advance values you want to retrieve.  */\r\n  /*                                                                       */\r\n  /*    load_flags  :: A set of bit flags similar to those used when       */\r\n  /*                   calling @FT_Load_Glyph.                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    padvance :: The advances, in either font units or 16.16 format.    */\r\n  /*                This array must contain at least `count' elements.     */\r\n  /*                                                                       */\r\n  /*                If @FT_LOAD_VERTICAL_LAYOUT is set, these are the      */\r\n  /*                vertical advances corresponding to a vertical layout.  */\r\n  /*                Otherwise, they are the horizontal advances in a       */\r\n  /*                horizontal layout.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */\r\n  /*    if the corresponding font backend doesn't have a quick way to      */\r\n  /*    retrieve the advances.                                             */\r\n  /*                                                                       */\r\n  /*    Scaled advances are returned in 16.16 format but aren't            */\r\n  /*    transformed by the affine transformation specified by              */\r\n  /*    @FT_Set_Transform.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Advances( FT_Face    face,\r\n                   FT_UInt    start,\r\n                   FT_UInt    count,\r\n                   FT_Int32   load_flags,\r\n                   FT_Fixed  *padvances );\r\n\r\n/* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTADVANC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftbbox.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbbox.h                                                               */\r\n/*                                                                         */\r\n/*    FreeType exact bbox computation (specification).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2007 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This component has a _single_ role: to compute exact outline bounding */\r\n  /* boxes.                                                                */\r\n  /*                                                                       */\r\n  /* It is separated from the rest of the engine for various technical     */\r\n  /* reasons.  It may well be integrated in `ftoutln' later.               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTBBOX_H__\r\n#define __FTBBOX_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    outline_processing                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Get_BBox                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Compute the exact bounding box of an outline.  This is slower      */\r\n  /*    than computing the control box.  However, it uses an advanced      */\r\n  /*    algorithm which returns _very_ quickly when the two boxes          */\r\n  /*    coincide.  Otherwise, the outline Bézier arcs are traversed to     */\r\n  /*    extract their extrema.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline :: A pointer to the source outline.                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    abbox   :: The outline's exact bounding box.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Get_BBox( FT_Outline*  outline,\r\n                       FT_BBox     *abbox );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBBOX_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftbdf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbdf.h                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing BDF-specific strings (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006, 2009 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTBDF_H__\r\n#define __FTBDF_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    bdf_fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    BDF and PCF Files                                                  */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    BDF and PCF specific API.                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of functions specific to BDF */\r\n  /*    and PCF fonts.                                                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @enum:\r\n   *    FT_PropertyType\r\n   *\r\n   * @description:\r\n   *    A list of BDF property types.\r\n   *\r\n   * @values:\r\n   *    BDF_PROPERTY_TYPE_NONE ::\r\n   *      Value~0 is used to indicate a missing property.\r\n   *\r\n   *    BDF_PROPERTY_TYPE_ATOM ::\r\n   *      Property is a string atom.\r\n   *\r\n   *    BDF_PROPERTY_TYPE_INTEGER ::\r\n   *      Property is a 32-bit signed integer.\r\n   *\r\n   *    BDF_PROPERTY_TYPE_CARDINAL ::\r\n   *      Property is a 32-bit unsigned integer.\r\n   */\r\n  typedef enum  BDF_PropertyType_\r\n  {\r\n    BDF_PROPERTY_TYPE_NONE     = 0,\r\n    BDF_PROPERTY_TYPE_ATOM     = 1,\r\n    BDF_PROPERTY_TYPE_INTEGER  = 2,\r\n    BDF_PROPERTY_TYPE_CARDINAL = 3\r\n\r\n  } BDF_PropertyType;\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @type:\r\n   *    BDF_Property\r\n   *\r\n   * @description:\r\n   *    A handle to a @BDF_PropertyRec structure to model a given\r\n   *    BDF/PCF property.\r\n   */\r\n  typedef struct BDF_PropertyRec_*  BDF_Property;\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @struct:\r\n  *    BDF_PropertyRec\r\n  *\r\n  * @description:\r\n  *    This structure models a given BDF/PCF property.\r\n  *\r\n  * @fields:\r\n  *    type ::\r\n  *      The property type.\r\n  *\r\n  *    u.atom ::\r\n  *      The atom string, if type is @BDF_PROPERTY_TYPE_ATOM.\r\n  *\r\n  *    u.integer ::\r\n  *      A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.\r\n  *\r\n  *    u.cardinal ::\r\n  *      An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.\r\n  */\r\n  typedef struct  BDF_PropertyRec_\r\n  {\r\n    BDF_PropertyType  type;\r\n    union {\r\n      const char*     atom;\r\n      FT_Int32        integer;\r\n      FT_UInt32       cardinal;\r\n\r\n    } u;\r\n\r\n  } BDF_PropertyRec;\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_BDF_Charset_ID\r\n  *\r\n  * @description:\r\n  *    Retrieve a BDF font character set identity, according to\r\n  *    the BDF specification.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  * @output:\r\n  *    acharset_encoding ::\r\n  *       Charset encoding, as a C~string, owned by the face.\r\n  *\r\n  *    acharset_registry ::\r\n  *       Charset registry, as a C~string, owned by the face.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function only works with BDF faces, returning an error otherwise.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_BDF_Charset_ID( FT_Face       face,\r\n                         const char*  *acharset_encoding,\r\n                         const char*  *acharset_registry );\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_BDF_Property\r\n  *\r\n  * @description:\r\n  *    Retrieve a BDF property from a BDF or PCF font file.\r\n  *\r\n  * @input:\r\n  *    face :: A handle to the input face.\r\n  *\r\n  *    name :: The property name.\r\n  *\r\n  * @output:\r\n  *    aproperty :: The property.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function works with BDF _and_ PCF fonts.  It returns an error\r\n  *   otherwise.  It also returns an error if the property is not in the\r\n  *   font.\r\n  *\r\n  *   A `property' is a either key-value pair within the STARTPROPERTIES\r\n  *   ... ENDPROPERTIES block of a BDF font or a key-value pair from the\r\n  *   `info->props' array within a `FontRec' structure of a PCF font.\r\n  *\r\n  *   Integer properties are always stored as `signed' within PCF fonts;\r\n  *   consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value\r\n  *   for BDF fonts only.\r\n  *\r\n  *   In case of error, `aproperty->type' is always set to\r\n  *   @BDF_PROPERTY_TYPE_NONE.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_BDF_Property( FT_Face           face,\r\n                       const char*       prop_name,\r\n                       BDF_PropertyRec  *aproperty );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBDF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftbitmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftbitmap.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType utility functions for bitmaps (specification).              */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2008 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTBITMAP_H__\r\n#define __FTBITMAP_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    bitmap_handling                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Bitmap Handling                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Handling FT_Bitmap objects.                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains functions for converting FT_Bitmap objects.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_New                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Initialize a pointer to an @FT_Bitmap structure.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    abitmap :: A pointer to the bitmap structure.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Bitmap_New( FT_Bitmap  *abitmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Copy                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Copy a bitmap into another one.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a library object.                           */\r\n  /*                                                                       */\r\n  /*    source  :: A handle to the source bitmap.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target  :: A handle to the target bitmap.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Copy( FT_Library        library,\r\n                  const FT_Bitmap  *source,\r\n                  FT_Bitmap        *target);\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Embolden                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Embolden a bitmap.  The new bitmap will be about `xStrength'       */\r\n  /*    pixels wider and `yStrength' pixels higher.  The left and bottom   */\r\n  /*    borders are kept unchanged.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library   :: A handle to a library object.                         */\r\n  /*                                                                       */\r\n  /*    xStrength :: How strong the glyph is emboldened horizontally.      */\r\n  /*                 Expressed in 26.6 pixel format.                       */\r\n  /*                                                                       */\r\n  /*    yStrength :: How strong the glyph is emboldened vertically.        */\r\n  /*                 Expressed in 26.6 pixel format.                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    bitmap    :: A handle to the target bitmap.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The current implementation restricts `xStrength' to be less than   */\r\n  /*    or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.      */\r\n  /*                                                                       */\r\n  /*    If you want to embolden the bitmap owned by a @FT_GlyphSlotRec,    */\r\n  /*    you should call @FT_GlyphSlot_Own_Bitmap on the slot first.        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Embolden( FT_Library  library,\r\n                      FT_Bitmap*  bitmap,\r\n                      FT_Pos      xStrength,\r\n                      FT_Pos      yStrength );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Convert                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a  */\r\n  /*    bitmap object with depth 8bpp, making the number of used bytes per */\r\n  /*    line (a.k.a. the `pitch') a multiple of `alignment'.               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library   :: A handle to a library object.                         */\r\n  /*                                                                       */\r\n  /*    source    :: The source bitmap.                                    */\r\n  /*                                                                       */\r\n  /*    alignment :: The pitch of the bitmap is a multiple of this         */\r\n  /*                 parameter.  Common values are 1, 2, or 4.             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target    :: The target bitmap.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    It is possible to call @FT_Bitmap_Convert multiple times without   */\r\n  /*    calling @FT_Bitmap_Done (the memory is simply reallocated).        */\r\n  /*                                                                       */\r\n  /*    Use @FT_Bitmap_Done to finally remove the bitmap object.           */\r\n  /*                                                                       */\r\n  /*    The `library' argument is taken to have access to FreeType's       */\r\n  /*    memory handling functions.                                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Convert( FT_Library        library,\r\n                     const FT_Bitmap  *source,\r\n                     FT_Bitmap        *target,\r\n                     FT_Int            alignment );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GlyphSlot_Own_Bitmap                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Make sure that a glyph slot owns `slot->bitmap'.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot :: The glyph slot.                                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is to be used in combination with                    */\r\n  /*    @FT_Bitmap_Embolden.                                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Bitmap_Done                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a bitmap object created with @FT_Bitmap_New.               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a library object.                           */\r\n  /*                                                                       */\r\n  /*    bitmap  :: The bitmap object to be freed.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `library' argument is taken to have access to FreeType's       */\r\n  /*    memory handling functions.                                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Bitmap_Done( FT_Library  library,\r\n                  FT_Bitmap  *bitmap );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTBITMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftcache.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcache.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType Cache subsystem (specification).                            */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCACHE_H__\r\n#define __FTCACHE_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_GLYPH_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * <Section>\r\n   *    cache_subsystem\r\n   *\r\n   * <Title>\r\n   *    Cache Sub-System\r\n   *\r\n   * <Abstract>\r\n   *    How to cache face, size, and glyph data with FreeType~2.\r\n   *\r\n   * <Description>\r\n   *   This section describes the FreeType~2 cache sub-system, which is used\r\n   *   to limit the number of concurrently opened @FT_Face and @FT_Size\r\n   *   objects, as well as caching information like character maps and glyph\r\n   *   images while limiting their maximum memory usage.\r\n   *\r\n   *   Note that all types and functions begin with the `FTC_' prefix.\r\n   *\r\n   *   The cache is highly portable and thus doesn't know anything about the\r\n   *   fonts installed on your system, or how to access them.  This implies\r\n   *   the following scheme:\r\n   *\r\n   *   First, available or installed font faces are uniquely identified by\r\n   *   @FTC_FaceID values, provided to the cache by the client.  Note that\r\n   *   the cache only stores and compares these values, and doesn't try to\r\n   *   interpret them in any way.\r\n   *\r\n   *   Second, the cache calls, only when needed, a client-provided function\r\n   *   to convert an @FTC_FaceID into a new @FT_Face object.  The latter is\r\n   *   then completely managed by the cache, including its termination\r\n   *   through @FT_Done_Face.  To monitor termination of face objects, the\r\n   *   finalizer callback in the `generic' field of the @FT_Face object can\r\n   *   be used, which might also be used to store the @FTC_FaceID of the\r\n   *   face.\r\n   *\r\n   *   Clients are free to map face IDs to anything else.  The most simple\r\n   *   usage is to associate them to a (pathname,face_index) pair that is\r\n   *   used to call @FT_New_Face.  However, more complex schemes are also\r\n   *   possible.\r\n   *\r\n   *   Note that for the cache to work correctly, the face ID values must be\r\n   *   *persistent*, which means that the contents they point to should not\r\n   *   change at runtime, or that their value should not become invalid.\r\n   *\r\n   *   If this is unavoidable (e.g., when a font is uninstalled at runtime),\r\n   *   you should call @FTC_Manager_RemoveFaceID as soon as possible, to let\r\n   *   the cache get rid of any references to the old @FTC_FaceID it may\r\n   *   keep internally.  Failure to do so will lead to incorrect behaviour\r\n   *   or even crashes.\r\n   *\r\n   *   To use the cache, start with calling @FTC_Manager_New to create a new\r\n   *   @FTC_Manager object, which models a single cache instance.  You can\r\n   *   then look up @FT_Face and @FT_Size objects with\r\n   *   @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.\r\n   *\r\n   *   If you want to use the charmap caching, call @FTC_CMapCache_New, then\r\n   *   later use @FTC_CMapCache_Lookup to perform the equivalent of\r\n   *   @FT_Get_Char_Index, only much faster.\r\n   *\r\n   *   If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then\r\n   *   later use @FTC_ImageCache_Lookup to retrieve the corresponding\r\n   *   @FT_Glyph objects from the cache.\r\n   *\r\n   *   If you need lots of small bitmaps, it is much more memory efficient\r\n   *   to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup.  This\r\n   *   returns @FTC_SBitRec structures, which are used to store small\r\n   *   bitmaps directly.  (A small bitmap is one whose metrics and\r\n   *   dimensions all fit into 8-bit integers).\r\n   *\r\n   *   We hope to also provide a kerning cache in the near future.\r\n   *\r\n   *\r\n   * <Order>\r\n   *   FTC_Manager\r\n   *   FTC_FaceID\r\n   *   FTC_Face_Requester\r\n   *\r\n   *   FTC_Manager_New\r\n   *   FTC_Manager_Reset\r\n   *   FTC_Manager_Done\r\n   *   FTC_Manager_LookupFace\r\n   *   FTC_Manager_LookupSize\r\n   *   FTC_Manager_RemoveFaceID\r\n   *\r\n   *   FTC_Node\r\n   *   FTC_Node_Unref\r\n   *\r\n   *   FTC_ImageCache\r\n   *   FTC_ImageCache_New\r\n   *   FTC_ImageCache_Lookup\r\n   *\r\n   *   FTC_SBit\r\n   *   FTC_SBitCache\r\n   *   FTC_SBitCache_New\r\n   *   FTC_SBitCache_Lookup\r\n   *\r\n   *   FTC_CMapCache\r\n   *   FTC_CMapCache_New\r\n   *   FTC_CMapCache_Lookup\r\n   *\r\n   *************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                    BASIC TYPE DEFINITIONS                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type: FTC_FaceID\r\n   *\r\n   * @description:\r\n   *   An opaque pointer type that is used to identity face objects.  The\r\n   *   contents of such objects is application-dependent.\r\n   *\r\n   *   These pointers are typically used to point to a user-defined\r\n   *   structure containing a font file path, and face index.\r\n   *\r\n   * @note:\r\n   *   Never use NULL as a valid @FTC_FaceID.\r\n   *\r\n   *   Face IDs are passed by the client to the cache manager, which calls,\r\n   *   when needed, the @FTC_Face_Requester to translate them into new\r\n   *   @FT_Face objects.\r\n   *\r\n   *   If the content of a given face ID changes at runtime, or if the value\r\n   *   becomes invalid (e.g., when uninstalling a font), you should\r\n   *   immediately call @FTC_Manager_RemoveFaceID before any other cache\r\n   *   function.\r\n   *\r\n   *   Failure to do so will result in incorrect behaviour or even\r\n   *   memory leaks and crashes.\r\n   */\r\n  typedef FT_Pointer  FTC_FaceID;\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FTC_Face_Requester\r\n   *\r\n   * @description:\r\n   *   A callback function provided by client applications.  It is used by\r\n   *   the cache manager to translate a given @FTC_FaceID into a new valid\r\n   *   @FT_Face object, on demand.\r\n   *\r\n   * <Input>\r\n   *   face_id ::\r\n   *     The face ID to resolve.\r\n   *\r\n   *   library ::\r\n   *     A handle to a FreeType library object.\r\n   *\r\n   *   req_data ::\r\n   *     Application-provided request data (see note below).\r\n   *\r\n   * <Output>\r\n   *   aface ::\r\n   *     A new @FT_Face handle.\r\n   *\r\n   * <Return>\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * <Note>\r\n   *   The third parameter `req_data' is the same as the one passed by the\r\n   *   client when @FTC_Manager_New is called.\r\n   *\r\n   *   The face requester should not perform funny things on the returned\r\n   *   face object, like creating a new @FT_Size for it, or setting a\r\n   *   transformation through @FT_Set_Transform!\r\n   */\r\n  typedef FT_Error\r\n  (*FTC_Face_Requester)( FTC_FaceID  face_id,\r\n                         FT_Library  library,\r\n                         FT_Pointer  request_data,\r\n                         FT_Face*    aface );\r\n\r\n /* */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /* these macros are incompatible with LLP64, should not be used */\r\n\r\n#define FT_POINTER_TO_ULONG( p )  ( (FT_ULong)(FT_Pointer)(p) )\r\n\r\n#define FTC_FACE_ID_HASH( i )                                \\\r\n          ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^   \\\r\n                       ( FT_POINTER_TO_ULONG( i ) << 7 ) ) )\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                      CACHE MANAGER OBJECT                     *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_Manager                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This object corresponds to one instance of the cache-subsystem.    */\r\n  /*    It is used to cache one or more @FT_Face objects, along with       */\r\n  /*    corresponding @FT_Size objects.                                    */\r\n  /*                                                                       */\r\n  /*    The manager intentionally limits the total number of opened        */\r\n  /*    @FT_Face and @FT_Size objects to control memory usage.  See the    */\r\n  /*    `max_faces' and `max_sizes' parameters of @FTC_Manager_New.        */\r\n  /*                                                                       */\r\n  /*    The manager is also used to cache `nodes' of various types while   */\r\n  /*    limiting their total memory usage.                                 */\r\n  /*                                                                       */\r\n  /*    All limitations are enforced by keeping lists of managed objects   */\r\n  /*    in most-recently-used order, and flushing old nodes to make room   */\r\n  /*    for new ones.                                                      */\r\n  /*                                                                       */\r\n  typedef struct FTC_ManagerRec_*  FTC_Manager;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_Node                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An opaque handle to a cache node object.  Each cache node is       */\r\n  /*    reference-counted.  A node with a count of~0 might be flushed      */\r\n  /*    out of a full cache whenever a lookup request is performed.        */\r\n  /*                                                                       */\r\n  /*    If you look up nodes, you have the ability to `acquire' them,      */\r\n  /*    i.e., to increment their reference count.  This will prevent the   */\r\n  /*    node from being flushed out of the cache until you explicitly      */\r\n  /*    `release' it (see @FTC_Node_Unref).                                */\r\n  /*                                                                       */\r\n  /*    See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup.         */\r\n  /*                                                                       */\r\n  typedef struct FTC_NodeRec_*  FTC_Node;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_New                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new cache manager.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library   :: The parent FreeType library handle to use.            */\r\n  /*                                                                       */\r\n  /*    max_faces :: Maximum number of opened @FT_Face objects managed by  */\r\n  /*                 this cache instance.  Use~0 for defaults.             */\r\n  /*                                                                       */\r\n  /*    max_sizes :: Maximum number of opened @FT_Size objects managed by  */\r\n  /*                 this cache instance.  Use~0 for defaults.             */\r\n  /*                                                                       */\r\n  /*    max_bytes :: Maximum number of bytes to use for cached data nodes. */\r\n  /*                 Use~0 for defaults.  Note that this value does not    */\r\n  /*                 account for managed @FT_Face and @FT_Size objects.    */\r\n  /*                                                                       */\r\n  /*    requester :: An application-provided callback used to translate    */\r\n  /*                 face IDs into real @FT_Face objects.                  */\r\n  /*                                                                       */\r\n  /*    req_data  :: A generic pointer that is passed to the requester     */\r\n  /*                 each time it is called (see @FTC_Face_Requester).     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amanager  :: A handle to a new manager object.  0~in case of       */\r\n  /*                 failure.                                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_New( FT_Library          library,\r\n                   FT_UInt             max_faces,\r\n                   FT_UInt             max_sizes,\r\n                   FT_ULong            max_bytes,\r\n                   FTC_Face_Requester  requester,\r\n                   FT_Pointer          req_data,\r\n                   FTC_Manager        *amanager );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_Reset                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Empty a given cache manager.  This simply gets rid of all the      */\r\n  /*    currently cached @FT_Face and @FT_Size objects within the manager. */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    manager :: A handle to the manager.                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FTC_Manager_Reset( FTC_Manager  manager );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_Done                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a given manager after emptying it.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the target cache manager object.            */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FTC_Manager_Done( FTC_Manager  manager );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_LookupFace                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the @FT_Face object that corresponds to a given face ID   */\r\n  /*    through a cache manager.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the cache manager.                          */\r\n  /*                                                                       */\r\n  /*    face_id :: The ID of the face object.                              */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface   :: A handle to the face object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned @FT_Face object is always owned by the manager.  You  */\r\n  /*    should never try to discard it yourself.                           */\r\n  /*                                                                       */\r\n  /*    The @FT_Face object doesn't necessarily have a current size object */\r\n  /*    (i.e., face->size can be 0).  If you need a specific `font size',  */\r\n  /*    use @FTC_Manager_LookupSize instead.                               */\r\n  /*                                                                       */\r\n  /*    Never change the face's transformation matrix (i.e., never call    */\r\n  /*    the @FT_Set_Transform function) on a returned face!  If you need   */\r\n  /*    to transform glyphs, do it yourself after glyph loading.           */\r\n  /*                                                                       */\r\n  /*    When you perform a lookup, out-of-memory errors are detected       */\r\n  /*    _within_ the lookup and force incremental flushes of the cache     */\r\n  /*    until enough memory is released for the lookup to succeed.         */\r\n  /*                                                                       */\r\n  /*    If a lookup fails with `FT_Err_Out_Of_Memory' the cache has        */\r\n  /*    already been completely flushed, and still no memory was available */\r\n  /*    for the operation.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_LookupFace( FTC_Manager  manager,\r\n                          FTC_FaceID   face_id,\r\n                          FT_Face     *aface );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_ScalerRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to describe a given character size in either      */\r\n  /*    pixels or points to the cache manager.  See                        */\r\n  /*    @FTC_Manager_LookupSize.                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face_id :: The source face ID.                                     */\r\n  /*                                                                       */\r\n  /*    width   :: The character width.                                    */\r\n  /*                                                                       */\r\n  /*    height  :: The character height.                                   */\r\n  /*                                                                       */\r\n  /*    pixel   :: A Boolean.  If 1, the `width' and `height' fields are   */\r\n  /*               interpreted as integer pixel character sizes.           */\r\n  /*               Otherwise, they are expressed as 1/64th of points.      */\r\n  /*                                                                       */\r\n  /*    x_res   :: Only used when `pixel' is value~0 to indicate the       */\r\n  /*               horizontal resolution in dpi.                           */\r\n  /*                                                                       */\r\n  /*    y_res   :: Only used when `pixel' is value~0 to indicate the       */\r\n  /*               vertical resolution in dpi.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This type is mainly used to retrieve @FT_Size objects through the  */\r\n  /*    cache manager.                                                     */\r\n  /*                                                                       */\r\n  typedef struct  FTC_ScalerRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_UInt     width;\r\n    FT_UInt     height;\r\n    FT_Int      pixel;\r\n    FT_UInt     x_res;\r\n    FT_UInt     y_res;\r\n\r\n  } FTC_ScalerRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_Scaler                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an @FTC_ScalerRec structure.                           */\r\n  /*                                                                       */\r\n  typedef struct FTC_ScalerRec_*  FTC_Scaler;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Manager_LookupSize                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the @FT_Size object that corresponds to a given           */\r\n  /*    @FTC_ScalerRec pointer through a cache manager.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the cache manager.                          */\r\n  /*                                                                       */\r\n  /*    scaler  :: A scaler handle.                                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    asize   :: A handle to the size object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned @FT_Size object is always owned by the manager.  You  */\r\n  /*    should never try to discard it by yourself.                        */\r\n  /*                                                                       */\r\n  /*    You can access the parent @FT_Face object simply as `size->face'   */\r\n  /*    if you need it.  Note that this object is also owned by the        */\r\n  /*    manager.                                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    When you perform a lookup, out-of-memory errors are detected       */\r\n  /*    _within_ the lookup and force incremental flushes of the cache     */\r\n  /*    until enough memory is released for the lookup to succeed.         */\r\n  /*                                                                       */\r\n  /*    If a lookup fails with `FT_Err_Out_Of_Memory' the cache has        */\r\n  /*    already been completely flushed, and still no memory is available  */\r\n  /*    for the operation.                                                 */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_LookupSize( FTC_Manager  manager,\r\n                          FTC_Scaler   scaler,\r\n                          FT_Size     *asize );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_Node_Unref                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Decrement a cache node's internal reference count.  When the count */\r\n  /*    reaches 0, it is not destroyed but becomes eligible for subsequent */\r\n  /*    cache flushes.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    node    :: The cache node handle.                                  */\r\n  /*                                                                       */\r\n  /*    manager :: The cache manager handle.                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FTC_Node_Unref( FTC_Node     node,\r\n                  FTC_Manager  manager );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FTC_Manager_RemoveFaceID\r\n   *\r\n   * @description:\r\n   *   A special function used to indicate to the cache manager that\r\n   *   a given @FTC_FaceID is no longer valid, either because its\r\n   *   content changed, or because it was deallocated or uninstalled.\r\n   *\r\n   * @input:\r\n   *   manager ::\r\n   *     The cache manager handle.\r\n   *\r\n   *   face_id ::\r\n   *     The @FTC_FaceID to be removed.\r\n   *\r\n   * @note:\r\n   *   This function flushes all nodes from the cache corresponding to this\r\n   *   `face_id', with the exception of nodes with a non-null reference\r\n   *   count.\r\n   *\r\n   *   Such nodes are however modified internally so as to never appear\r\n   *   in later lookups with the same `face_id' value, and to be immediately\r\n   *   destroyed when released by all their users.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FTC_Manager_RemoveFaceID( FTC_Manager  manager,\r\n                            FTC_FaceID   face_id );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cache_subsystem                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FTC_CMapCache\r\n   *\r\n   * @description:\r\n   *   An opaque handle used to model a charmap cache.  This cache is to\r\n   *   hold character codes -> glyph indices mappings.\r\n   *\r\n   */\r\n  typedef struct FTC_CMapCacheRec_*  FTC_CMapCache;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FTC_CMapCache_New\r\n   *\r\n   * @description:\r\n   *   Create a new charmap cache.\r\n   *\r\n   * @input:\r\n   *   manager ::\r\n   *     A handle to the cache manager.\r\n   *\r\n   * @output:\r\n   *   acache ::\r\n   *     A new cache handle.  NULL in case of error.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   Like all other caches, this one will be destroyed with the cache\r\n   *   manager.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_CMapCache_New( FTC_Manager     manager,\r\n                     FTC_CMapCache  *acache );\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *   FTC_CMapCache_Lookup\r\n   *\r\n   * @description:\r\n   *   Translate a character code into a glyph index, using the charmap\r\n   *   cache.\r\n   *\r\n   * @input:\r\n   *   cache ::\r\n   *     A charmap cache handle.\r\n   *\r\n   *   face_id ::\r\n   *     The source face ID.\r\n   *\r\n   *   cmap_index ::\r\n   *     The index of the charmap in the source face.  Any negative value\r\n   *     means to use the cache @FT_Face's default charmap.\r\n   *\r\n   *   char_code ::\r\n   *     The character code (in the corresponding charmap).\r\n   *\r\n   * @return:\r\n   *    Glyph index.  0~means `no glyph'.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_UInt )\r\n  FTC_CMapCache_Lookup( FTC_CMapCache  cache,\r\n                        FTC_FaceID     face_id,\r\n                        FT_Int         cmap_index,\r\n                        FT_UInt32      char_code );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cache_subsystem                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       IMAGE CACHE OBJECT                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FTC_ImageTypeRec\r\n   *\r\n   * @description:\r\n   *   A structure used to model the type of images in a glyph cache.\r\n   *\r\n   * @fields:\r\n   *   face_id ::\r\n   *     The face ID.\r\n   *\r\n   *   width ::\r\n   *     The width in pixels.\r\n   *\r\n   *   height ::\r\n   *     The height in pixels.\r\n   *\r\n   *   flags ::\r\n   *     The load flags, as in @FT_Load_Glyph.\r\n   *\r\n   */\r\n  typedef struct  FTC_ImageTypeRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_Int      width;\r\n    FT_Int      height;\r\n    FT_Int32    flags;\r\n\r\n  } FTC_ImageTypeRec;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FTC_ImageType\r\n   *\r\n   * @description:\r\n   *   A handle to an @FTC_ImageTypeRec structure.\r\n   *\r\n   */\r\n  typedef struct FTC_ImageTypeRec_*  FTC_ImageType;\r\n\r\n\r\n  /* */\r\n\r\n\r\n#define FTC_IMAGE_TYPE_COMPARE( d1, d2 )      \\\r\n          ( (d1)->face_id == (d2)->face_id && \\\r\n            (d1)->width   == (d2)->width   && \\\r\n            (d1)->flags   == (d2)->flags   )\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /* this macro is incompatible with LLP64, should not be used */\r\n\r\n#define FTC_IMAGE_TYPE_HASH( d )                          \\\r\n          (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id )  ^ \\\r\n                      ( (d)->width << 8 ) ^ (d)->height ^ \\\r\n                      ( (d)->flags << 4 )               )\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_ImageCache                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an glyph image cache object.  They are designed to     */\r\n  /*    hold many distinct glyph images while not exceeding a certain      */\r\n  /*    memory threshold.                                                  */\r\n  /*                                                                       */\r\n  typedef struct FTC_ImageCacheRec_*  FTC_ImageCache;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_ImageCache_New                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new glyph image cache.                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: The parent manager for the image cache.                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acache  :: A handle to the new glyph image cache object.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_ImageCache_New( FTC_Manager      manager,\r\n                      FTC_ImageCache  *acache );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_ImageCache_Lookup                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve a given glyph image from a glyph image cache.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache  :: A handle to the source glyph image cache.                */\r\n  /*                                                                       */\r\n  /*    type   :: A pointer to a glyph image type descriptor.              */\r\n  /*                                                                       */\r\n  /*    gindex :: The glyph index to retrieve.                             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aglyph :: The corresponding @FT_Glyph object.  0~in case of        */\r\n  /*              failure.                                                 */\r\n  /*                                                                       */\r\n  /*    anode  :: Used to return the address of of the corresponding cache */\r\n  /*              node after incrementing its reference count (see note    */\r\n  /*              below).                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned glyph is owned and managed by the glyph image cache.  */\r\n  /*    Never try to transform or discard it manually!  You can however    */\r\n  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the glyph image, after increasing its reference    */\r\n  /*    count.  This ensures that the node (as well as the @FT_Glyph) will */\r\n  /*    always be kept in the cache until you call @FTC_Node_Unref to      */\r\n  /*    `release' it.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the @FT_Glyph could be flushed out of the cache on the next   */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_ImageCache_Lookup( FTC_ImageCache  cache,\r\n                         FTC_ImageType   type,\r\n                         FT_UInt         gindex,\r\n                         FT_Glyph       *aglyph,\r\n                         FTC_Node       *anode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_ImageCache_LookupScaler                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec    */\r\n  /*    to specify the face ID and its size.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache      :: A handle to the source glyph image cache.            */\r\n  /*                                                                       */\r\n  /*    scaler     :: A pointer to a scaler descriptor.                    */\r\n  /*                                                                       */\r\n  /*    load_flags :: The corresponding load flags.                        */\r\n  /*                                                                       */\r\n  /*    gindex     :: The glyph index to retrieve.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aglyph     :: The corresponding @FT_Glyph object.  0~in case of    */\r\n  /*                  failure.                                             */\r\n  /*                                                                       */\r\n  /*    anode      :: Used to return the address of of the corresponding   */\r\n  /*                  cache node after incrementing its reference count    */\r\n  /*                  (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The returned glyph is owned and managed by the glyph image cache.  */\r\n  /*    Never try to transform or discard it manually!  You can however    */\r\n  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the glyph image, after increasing its reference    */\r\n  /*    count.  This ensures that the node (as well as the @FT_Glyph) will */\r\n  /*    always be kept in the cache until you call @FTC_Node_Unref to      */\r\n  /*    `release' it.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the @FT_Glyph could be flushed out of the cache on the next   */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  /*    Calls to @FT_Set_Char_Size and friends have no effect on cached    */\r\n  /*    glyphs; you should always use the FreeType cache API instead.      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_ImageCache_LookupScaler( FTC_ImageCache  cache,\r\n                               FTC_Scaler      scaler,\r\n                               FT_ULong        load_flags,\r\n                               FT_UInt         gindex,\r\n                               FT_Glyph       *aglyph,\r\n                               FTC_Node       *anode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_SBit                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a small bitmap descriptor.  See the @FTC_SBitRec       */\r\n  /*    structure for details.                                             */\r\n  /*                                                                       */\r\n  typedef struct FTC_SBitRec_*  FTC_SBit;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_SBitRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very compact structure used to describe a small glyph bitmap.    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    width     :: The bitmap width in pixels.                           */\r\n  /*                                                                       */\r\n  /*    height    :: The bitmap height in pixels.                          */\r\n  /*                                                                       */\r\n  /*    left      :: The horizontal distance from the pen position to the  */\r\n  /*                 left bitmap border (a.k.a. `left side bearing', or    */\r\n  /*                 `lsb').                                               */\r\n  /*                                                                       */\r\n  /*    top       :: The vertical distance from the pen position (on the   */\r\n  /*                 baseline) to the upper bitmap border (a.k.a. `top     */\r\n  /*                 side bearing').  The distance is positive for upwards */\r\n  /*                 y~coordinates.                                        */\r\n  /*                                                                       */\r\n  /*    format    :: The format of the glyph bitmap (monochrome or gray).  */\r\n  /*                                                                       */\r\n  /*    max_grays :: Maximum gray level value (in the range 1 to~255).     */\r\n  /*                                                                       */\r\n  /*    pitch     :: The number of bytes per bitmap line.  May be positive */\r\n  /*                 or negative.                                          */\r\n  /*                                                                       */\r\n  /*    xadvance  :: The horizontal advance width in pixels.               */\r\n  /*                                                                       */\r\n  /*    yadvance  :: The vertical advance height in pixels.                */\r\n  /*                                                                       */\r\n  /*    buffer    :: A pointer to the bitmap pixels.                       */\r\n  /*                                                                       */\r\n  typedef struct  FTC_SBitRec_\r\n  {\r\n    FT_Byte   width;\r\n    FT_Byte   height;\r\n    FT_Char   left;\r\n    FT_Char   top;\r\n\r\n    FT_Byte   format;\r\n    FT_Byte   max_grays;\r\n    FT_Short  pitch;\r\n    FT_Char   xadvance;\r\n    FT_Char   yadvance;\r\n\r\n    FT_Byte*  buffer;\r\n\r\n  } FTC_SBitRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FTC_SBitCache                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a small bitmap cache.  These are special cache objects */\r\n  /*    used to store small glyph bitmaps (and anti-aliased pixmaps) in a  */\r\n  /*    much more efficient way than the traditional glyph image cache     */\r\n  /*    implemented by @FTC_ImageCache.                                    */\r\n  /*                                                                       */\r\n  typedef struct FTC_SBitCacheRec_*  FTC_SBitCache;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_SBitCache_New                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new cache to store small glyph bitmaps.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    manager :: A handle to the source cache manager.                   */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBitCache_New( FTC_Manager     manager,\r\n                     FTC_SBitCache  *acache );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_SBitCache_Lookup                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Look up a given small glyph bitmap in a given sbit cache and       */\r\n  /*    `lock' it to prevent its flushing from the cache until needed.     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache  :: A handle to the source sbit cache.                       */\r\n  /*                                                                       */\r\n  /*    type   :: A pointer to the glyph image type descriptor.            */\r\n  /*                                                                       */\r\n  /*    gindex :: The glyph index.                                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sbit   :: A handle to a small bitmap descriptor.                   */\r\n  /*                                                                       */\r\n  /*    anode  :: Used to return the address of of the corresponding cache */\r\n  /*              node after incrementing its reference count (see note    */\r\n  /*              below).                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The small bitmap descriptor and its bit buffer are owned by the    */\r\n  /*    cache and should never be freed by the application.  They might    */\r\n  /*    as well disappear from memory on the next cache lookup, so don't   */\r\n  /*    treat them as persistent data.                                     */\r\n  /*                                                                       */\r\n  /*    The descriptor's `buffer' field is set to~0 to indicate a missing  */\r\n  /*    glyph bitmap.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the bitmap, after increasing its reference count.  */\r\n  /*    This ensures that the node (as well as the image) will always be   */\r\n  /*    kept in the cache until you call @FTC_Node_Unref to `release' it.  */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the bitmap could be flushed out of the cache on the next      */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBitCache_Lookup( FTC_SBitCache    cache,\r\n                        FTC_ImageType    type,\r\n                        FT_UInt          gindex,\r\n                        FTC_SBit        *sbit,\r\n                        FTC_Node        *anode );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FTC_SBitCache_LookupScaler                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec     */\r\n  /*    to specify the face ID and its size.                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    cache      :: A handle to the source sbit cache.                   */\r\n  /*                                                                       */\r\n  /*    scaler     :: A pointer to the scaler descriptor.                  */\r\n  /*                                                                       */\r\n  /*    load_flags :: The corresponding load flags.                        */\r\n  /*                                                                       */\r\n  /*    gindex     :: The glyph index.                                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sbit       :: A handle to a small bitmap descriptor.               */\r\n  /*                                                                       */\r\n  /*    anode      :: Used to return the address of of the corresponding   */\r\n  /*                  cache node after incrementing its reference count    */\r\n  /*                  (see note below).                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The small bitmap descriptor and its bit buffer are owned by the    */\r\n  /*    cache and should never be freed by the application.  They might    */\r\n  /*    as well disappear from memory on the next cache lookup, so don't   */\r\n  /*    treat them as persistent data.                                     */\r\n  /*                                                                       */\r\n  /*    The descriptor's `buffer' field is set to~0 to indicate a missing  */\r\n  /*    glyph bitmap.                                                      */\r\n  /*                                                                       */\r\n  /*    If `anode' is _not_ NULL, it receives the address of the cache     */\r\n  /*    node containing the bitmap, after increasing its reference count.  */\r\n  /*    This ensures that the node (as well as the image) will always be   */\r\n  /*    kept in the cache until you call @FTC_Node_Unref to `release' it.  */\r\n  /*                                                                       */\r\n  /*    If `anode' is NULL, the cache node is left unchanged, which means  */\r\n  /*    that the bitmap could be flushed out of the cache on the next      */\r\n  /*    call to one of the caching sub-system APIs.  Don't assume that it  */\r\n  /*    is persistent!                                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FTC_SBitCache_LookupScaler( FTC_SBitCache  cache,\r\n                              FTC_Scaler     scaler,\r\n                              FT_ULong       load_flags,\r\n                              FT_UInt        gindex,\r\n                              FTC_SBit      *sbit,\r\n                              FTC_Node      *anode );\r\n\r\n\r\n /* */\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*@***********************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FTC_FontRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to describe a given `font' to the cache    */\r\n  /*    manager.  Note that a `font' is the combination of a given face    */\r\n  /*    with a given character size.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    face_id    :: The ID of the face to use.                           */\r\n  /*                                                                       */\r\n  /*    pix_width  :: The character width in integer pixels.               */\r\n  /*                                                                       */\r\n  /*    pix_height :: The character height in integer pixels.              */\r\n  /*                                                                       */\r\n  typedef struct  FTC_FontRec_\r\n  {\r\n    FTC_FaceID  face_id;\r\n    FT_UShort   pix_width;\r\n    FT_UShort   pix_height;\r\n\r\n  } FTC_FontRec;\r\n\r\n\r\n  /* */\r\n\r\n\r\n#define FTC_FONT_COMPARE( f1, f2 )                  \\\r\n          ( (f1)->face_id    == (f2)->face_id    && \\\r\n            (f1)->pix_width  == (f2)->pix_width  && \\\r\n            (f1)->pix_height == (f2)->pix_height )\r\n\r\n  /* this macro is incompatible with LLP64, should not be used */\r\n#define FTC_FONT_HASH( f )                              \\\r\n          (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \\\r\n                       ((f)->pix_width << 8)          ^ \\\r\n                       ((f)->pix_height)              )\r\n\r\n  typedef FTC_FontRec*  FTC_Font;\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_Lookup_Face( FTC_Manager  manager,\r\n                           FTC_FaceID   face_id,\r\n                           FT_Face     *aface );\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FTC_Manager_Lookup_Size( FTC_Manager  manager,\r\n                           FTC_Font     font,\r\n                           FT_Face     *aface,\r\n                           FT_Size     *asize );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCACHE_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftchapters.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/* This file defines the structure of the FreeType reference.              */\r\n/* It is used by the python script which generates the HTML files.         */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    general_remarks                                                      */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    General Remarks                                                      */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    user_allocation                                                      */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    core_api                                                             */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Core API                                                             */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    version                                                              */\r\n/*    basic_types                                                          */\r\n/*    base_interface                                                       */\r\n/*    glyph_variants                                                       */\r\n/*    glyph_management                                                     */\r\n/*    mac_specific                                                         */\r\n/*    sizes_management                                                     */\r\n/*    header_file_macros                                                   */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    format_specific                                                      */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Format-Specific API                                                  */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    multiple_masters                                                     */\r\n/*    truetype_tables                                                      */\r\n/*    type1_tables                                                         */\r\n/*    sfnt_names                                                           */\r\n/*    bdf_fonts                                                            */\r\n/*    cid_fonts                                                            */\r\n/*    pfr_fonts                                                            */\r\n/*    winfnt_fonts                                                         */\r\n/*    font_formats                                                         */\r\n/*    gasp_table                                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    cache_subsystem                                                      */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Cache Sub-System                                                     */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    cache_subsystem                                                      */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* <Chapter>                                                               */\r\n/*    support_api                                                          */\r\n/*                                                                         */\r\n/* <Title>                                                                 */\r\n/*    Support API                                                          */\r\n/*                                                                         */\r\n/* <Sections>                                                              */\r\n/*    computations                                                         */\r\n/*    list_processing                                                      */\r\n/*    outline_processing                                                   */\r\n/*    quick_advance                                                        */\r\n/*    bitmap_handling                                                      */\r\n/*    raster                                                               */\r\n/*    glyph_stroker                                                        */\r\n/*    system_interface                                                     */\r\n/*    module_management                                                    */\r\n/*    gzip                                                                 */\r\n/*    lzw                                                                  */\r\n/*    lcd_filtering                                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftcid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcid.h                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing CID font information (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal.                  */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCID_H__\r\n#define __FTCID_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    cid_fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    CID Fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    CID-keyed font specific API.                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of CID-keyed font specific   */\r\n  /*    functions.                                                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_CID_Registry_Ordering_Supplement\r\n   *\r\n   * @description:\r\n   *    Retrieve the Registry/Ordering/Supplement triple (also known as the\r\n   *    \"R/O/S\") from a CID-keyed font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       A handle to the input face.\r\n   *\r\n   * @output:\r\n   *    registry ::\r\n   *       The registry, as a C~string, owned by the face.\r\n   *\r\n   *    ordering ::\r\n   *       The ordering, as a C~string, owned by the face.\r\n   *\r\n   *    supplement ::\r\n   *       The supplement.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    This function only works with CID faces, returning an error\r\n   *    otherwise.\r\n   *\r\n   * @since:\r\n   *    2.3.6\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_CID_Registry_Ordering_Supplement( FT_Face       face,\r\n                                           const char*  *registry,\r\n                                           const char*  *ordering,\r\n                                           FT_Int       *supplement);\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_CID_Is_Internally_CID_Keyed\r\n   *\r\n   * @description:\r\n   *    Retrieve the type of the input face, CID keyed or not.  In\r\n   *    constrast to the @FT_IS_CID_KEYED macro this function returns\r\n   *    successfully also for CID-keyed fonts in an SNFT wrapper.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       A handle to the input face.\r\n   *\r\n   * @output:\r\n   *    is_cid ::\r\n   *       The type of the face as an @FT_Bool.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    This function only works with CID faces and OpenType fonts,\r\n   *    returning an error otherwise.\r\n   *\r\n   * @since:\r\n   *    2.3.9\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_CID_Is_Internally_CID_Keyed( FT_Face   face,\r\n                                      FT_Bool  *is_cid );\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_CID_From_Glyph_Index\r\n   *\r\n   * @description:\r\n   *    Retrieve the CID of the input glyph index.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       A handle to the input face.\r\n   *\r\n   *    glyph_index ::\r\n   *       The input glyph index.\r\n   *\r\n   * @output:\r\n   *    cid ::\r\n   *       The CID as an @FT_UInt.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    This function only works with CID faces and OpenType fonts,\r\n   *    returning an error otherwise.\r\n   *\r\n   * @since:\r\n   *    2.3.9\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_CID_From_Glyph_Index( FT_Face   face,\r\n                               FT_UInt   glyph_index,\r\n                               FT_UInt  *cid );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/fterrdef.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fterrdef.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType error codes (specification).                                */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2004, 2006, 2007, 2010 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                LIST OF ERROR CODES/MESSAGES             *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n  /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */\r\n  /* including this file.                                           */\r\n\r\n\r\n  /* generic errors */\r\n\r\n  FT_NOERRORDEF_( Ok,                                        0x00, \\\r\n                  \"no error\" )\r\n\r\n  FT_ERRORDEF_( Cannot_Open_Resource,                        0x01, \\\r\n                \"cannot open resource\" )\r\n  FT_ERRORDEF_( Unknown_File_Format,                         0x02, \\\r\n                \"unknown file format\" )\r\n  FT_ERRORDEF_( Invalid_File_Format,                         0x03, \\\r\n                \"broken file\" )\r\n  FT_ERRORDEF_( Invalid_Version,                             0x04, \\\r\n                \"invalid FreeType version\" )\r\n  FT_ERRORDEF_( Lower_Module_Version,                        0x05, \\\r\n                \"module version is too low\" )\r\n  FT_ERRORDEF_( Invalid_Argument,                            0x06, \\\r\n                \"invalid argument\" )\r\n  FT_ERRORDEF_( Unimplemented_Feature,                       0x07, \\\r\n                \"unimplemented feature\" )\r\n  FT_ERRORDEF_( Invalid_Table,                               0x08, \\\r\n                \"broken table\" )\r\n  FT_ERRORDEF_( Invalid_Offset,                              0x09, \\\r\n                \"broken offset within table\" )\r\n  FT_ERRORDEF_( Array_Too_Large,                             0x0A, \\\r\n                \"array allocation size too large\" )\r\n\r\n  /* glyph/character errors */\r\n\r\n  FT_ERRORDEF_( Invalid_Glyph_Index,                         0x10, \\\r\n                \"invalid glyph index\" )\r\n  FT_ERRORDEF_( Invalid_Character_Code,                      0x11, \\\r\n                \"invalid character code\" )\r\n  FT_ERRORDEF_( Invalid_Glyph_Format,                        0x12, \\\r\n                \"unsupported glyph image format\" )\r\n  FT_ERRORDEF_( Cannot_Render_Glyph,                         0x13, \\\r\n                \"cannot render this glyph format\" )\r\n  FT_ERRORDEF_( Invalid_Outline,                             0x14, \\\r\n                \"invalid outline\" )\r\n  FT_ERRORDEF_( Invalid_Composite,                           0x15, \\\r\n                \"invalid composite glyph\" )\r\n  FT_ERRORDEF_( Too_Many_Hints,                              0x16, \\\r\n                \"too many hints\" )\r\n  FT_ERRORDEF_( Invalid_Pixel_Size,                          0x17, \\\r\n                \"invalid pixel size\" )\r\n\r\n  /* handle errors */\r\n\r\n  FT_ERRORDEF_( Invalid_Handle,                              0x20, \\\r\n                \"invalid object handle\" )\r\n  FT_ERRORDEF_( Invalid_Library_Handle,                      0x21, \\\r\n                \"invalid library handle\" )\r\n  FT_ERRORDEF_( Invalid_Driver_Handle,                       0x22, \\\r\n                \"invalid module handle\" )\r\n  FT_ERRORDEF_( Invalid_Face_Handle,                         0x23, \\\r\n                \"invalid face handle\" )\r\n  FT_ERRORDEF_( Invalid_Size_Handle,                         0x24, \\\r\n                \"invalid size handle\" )\r\n  FT_ERRORDEF_( Invalid_Slot_Handle,                         0x25, \\\r\n                \"invalid glyph slot handle\" )\r\n  FT_ERRORDEF_( Invalid_CharMap_Handle,                      0x26, \\\r\n                \"invalid charmap handle\" )\r\n  FT_ERRORDEF_( Invalid_Cache_Handle,                        0x27, \\\r\n                \"invalid cache manager handle\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Handle,                       0x28, \\\r\n                \"invalid stream handle\" )\r\n\r\n  /* driver errors */\r\n\r\n  FT_ERRORDEF_( Too_Many_Drivers,                            0x30, \\\r\n                \"too many modules\" )\r\n  FT_ERRORDEF_( Too_Many_Extensions,                         0x31, \\\r\n                \"too many extensions\" )\r\n\r\n  /* memory errors */\r\n\r\n  FT_ERRORDEF_( Out_Of_Memory,                               0x40, \\\r\n                \"out of memory\" )\r\n  FT_ERRORDEF_( Unlisted_Object,                             0x41, \\\r\n                \"unlisted object\" )\r\n\r\n  /* stream errors */\r\n\r\n  FT_ERRORDEF_( Cannot_Open_Stream,                          0x51, \\\r\n                \"cannot open stream\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Seek,                         0x52, \\\r\n                \"invalid stream seek\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Skip,                         0x53, \\\r\n                \"invalid stream skip\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Read,                         0x54, \\\r\n                \"invalid stream read\" )\r\n  FT_ERRORDEF_( Invalid_Stream_Operation,                    0x55, \\\r\n                \"invalid stream operation\" )\r\n  FT_ERRORDEF_( Invalid_Frame_Operation,                     0x56, \\\r\n                \"invalid frame operation\" )\r\n  FT_ERRORDEF_( Nested_Frame_Access,                         0x57, \\\r\n                \"nested frame access\" )\r\n  FT_ERRORDEF_( Invalid_Frame_Read,                          0x58, \\\r\n                \"invalid frame read\" )\r\n\r\n  /* raster errors */\r\n\r\n  FT_ERRORDEF_( Raster_Uninitialized,                        0x60, \\\r\n                \"raster uninitialized\" )\r\n  FT_ERRORDEF_( Raster_Corrupted,                            0x61, \\\r\n                \"raster corrupted\" )\r\n  FT_ERRORDEF_( Raster_Overflow,                             0x62, \\\r\n                \"raster overflow\" )\r\n  FT_ERRORDEF_( Raster_Negative_Height,                      0x63, \\\r\n                \"negative height while rastering\" )\r\n\r\n  /* cache errors */\r\n\r\n  FT_ERRORDEF_( Too_Many_Caches,                             0x70, \\\r\n                \"too many registered caches\" )\r\n\r\n  /* TrueType and SFNT errors */\r\n\r\n  FT_ERRORDEF_( Invalid_Opcode,                              0x80, \\\r\n                \"invalid opcode\" )\r\n  FT_ERRORDEF_( Too_Few_Arguments,                           0x81, \\\r\n                \"too few arguments\" )\r\n  FT_ERRORDEF_( Stack_Overflow,                              0x82, \\\r\n                \"stack overflow\" )\r\n  FT_ERRORDEF_( Code_Overflow,                               0x83, \\\r\n                \"code overflow\" )\r\n  FT_ERRORDEF_( Bad_Argument,                                0x84, \\\r\n                \"bad argument\" )\r\n  FT_ERRORDEF_( Divide_By_Zero,                              0x85, \\\r\n                \"division by zero\" )\r\n  FT_ERRORDEF_( Invalid_Reference,                           0x86, \\\r\n                \"invalid reference\" )\r\n  FT_ERRORDEF_( Debug_OpCode,                                0x87, \\\r\n                \"found debug opcode\" )\r\n  FT_ERRORDEF_( ENDF_In_Exec_Stream,                         0x88, \\\r\n                \"found ENDF opcode in execution stream\" )\r\n  FT_ERRORDEF_( Nested_DEFS,                                 0x89, \\\r\n                \"nested DEFS\" )\r\n  FT_ERRORDEF_( Invalid_CodeRange,                           0x8A, \\\r\n                \"invalid code range\" )\r\n  FT_ERRORDEF_( Execution_Too_Long,                          0x8B, \\\r\n                \"execution context too long\" )\r\n  FT_ERRORDEF_( Too_Many_Function_Defs,                      0x8C, \\\r\n                \"too many function definitions\" )\r\n  FT_ERRORDEF_( Too_Many_Instruction_Defs,                   0x8D, \\\r\n                \"too many instruction definitions\" )\r\n  FT_ERRORDEF_( Table_Missing,                               0x8E, \\\r\n                \"SFNT font table missing\" )\r\n  FT_ERRORDEF_( Horiz_Header_Missing,                        0x8F, \\\r\n                \"horizontal header (hhea) table missing\" )\r\n  FT_ERRORDEF_( Locations_Missing,                           0x90, \\\r\n                \"locations (loca) table missing\" )\r\n  FT_ERRORDEF_( Name_Table_Missing,                          0x91, \\\r\n                \"name table missing\" )\r\n  FT_ERRORDEF_( CMap_Table_Missing,                          0x92, \\\r\n                \"character map (cmap) table missing\" )\r\n  FT_ERRORDEF_( Hmtx_Table_Missing,                          0x93, \\\r\n                \"horizontal metrics (hmtx) table missing\" )\r\n  FT_ERRORDEF_( Post_Table_Missing,                          0x94, \\\r\n                \"PostScript (post) table missing\" )\r\n  FT_ERRORDEF_( Invalid_Horiz_Metrics,                       0x95, \\\r\n                \"invalid horizontal metrics\" )\r\n  FT_ERRORDEF_( Invalid_CharMap_Format,                      0x96, \\\r\n                \"invalid character map (cmap) format\" )\r\n  FT_ERRORDEF_( Invalid_PPem,                                0x97, \\\r\n                \"invalid ppem value\" )\r\n  FT_ERRORDEF_( Invalid_Vert_Metrics,                        0x98, \\\r\n                \"invalid vertical metrics\" )\r\n  FT_ERRORDEF_( Could_Not_Find_Context,                      0x99, \\\r\n                \"could not find context\" )\r\n  FT_ERRORDEF_( Invalid_Post_Table_Format,                   0x9A, \\\r\n                \"invalid PostScript (post) table format\" )\r\n  FT_ERRORDEF_( Invalid_Post_Table,                          0x9B, \\\r\n                \"invalid PostScript (post) table\" )\r\n\r\n  /* CFF, CID, and Type 1 errors */\r\n\r\n  FT_ERRORDEF_( Syntax_Error,                                0xA0, \\\r\n                \"opcode syntax error\" )\r\n  FT_ERRORDEF_( Stack_Underflow,                             0xA1, \\\r\n                \"argument stack underflow\" )\r\n  FT_ERRORDEF_( Ignore,                                      0xA2, \\\r\n                \"ignore\" )\r\n  FT_ERRORDEF_( No_Unicode_Glyph_Name,                       0xA3, \\\r\n                \"no Unicode glyph name found\" )\r\n\r\n\r\n  /* BDF errors */\r\n\r\n  FT_ERRORDEF_( Missing_Startfont_Field,                     0xB0, \\\r\n                \"`STARTFONT' field missing\" )\r\n  FT_ERRORDEF_( Missing_Font_Field,                          0xB1, \\\r\n                \"`FONT' field missing\" )\r\n  FT_ERRORDEF_( Missing_Size_Field,                          0xB2, \\\r\n                \"`SIZE' field missing\" )\r\n  FT_ERRORDEF_( Missing_Fontboundingbox_Field,               0xB3, \\\r\n                \"`FONTBOUNDINGBOX' field missing\" )\r\n  FT_ERRORDEF_( Missing_Chars_Field,                         0xB4, \\\r\n                \"`CHARS' field missing\" )\r\n  FT_ERRORDEF_( Missing_Startchar_Field,                     0xB5, \\\r\n                \"`STARTCHAR' field missing\" )\r\n  FT_ERRORDEF_( Missing_Encoding_Field,                      0xB6, \\\r\n                \"`ENCODING' field missing\" )\r\n  FT_ERRORDEF_( Missing_Bbx_Field,                           0xB7, \\\r\n                \"`BBX' field missing\" )\r\n  FT_ERRORDEF_( Bbx_Too_Big,                                 0xB8, \\\r\n                \"`BBX' too big\" )\r\n  FT_ERRORDEF_( Corrupted_Font_Header,                       0xB9, \\\r\n                \"Font header corrupted or missing fields\" )\r\n  FT_ERRORDEF_( Corrupted_Font_Glyphs,                       0xBA, \\\r\n                \"Font glyphs corrupted or missing fields\" )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/fterrors.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fterrors.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType error code handling (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2007 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This special header file is used to define the handling of FT2        */\r\n  /* enumeration constants.  It can also be used to generate error message */\r\n  /* strings with a small macro trick explained below.                     */\r\n  /*                                                                       */\r\n  /* I - Error Formats                                                     */\r\n  /* -----------------                                                     */\r\n  /*                                                                       */\r\n  /*   The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be   */\r\n  /*   defined in ftoption.h in order to make the higher byte indicate     */\r\n  /*   the module where the error has happened (this is not compatible     */\r\n  /*   with standard builds of FreeType 2).  You can then use the macro    */\r\n  /*   FT_ERROR_BASE macro to extract the generic error code from an       */\r\n  /*   FT_Error value.                                                     */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* II - Error Message strings                                            */\r\n  /* --------------------------                                            */\r\n  /*                                                                       */\r\n  /*   The error definitions below are made through special macros that    */\r\n  /*   allow client applications to build a table of error message strings */\r\n  /*   if they need it.  The strings are not included in a normal build of */\r\n  /*   FreeType 2 to save space (most client applications do not use       */\r\n  /*   them).                                                              */\r\n  /*                                                                       */\r\n  /*   To do so, you have to define the following macros before including  */\r\n  /*   this file:                                                          */\r\n  /*                                                                       */\r\n  /*   FT_ERROR_START_LIST ::                                              */\r\n  /*     This macro is called before anything else to define the start of  */\r\n  /*     the error list.  It is followed by several FT_ERROR_DEF calls     */\r\n  /*     (see below).                                                      */\r\n  /*                                                                       */\r\n  /*   FT_ERROR_DEF( e, v, s ) ::                                          */\r\n  /*     This macro is called to define one single error.                  */\r\n  /*     `e' is the error code identifier (e.g. FT_Err_Invalid_Argument).  */\r\n  /*     `v' is the error numerical value.                                 */\r\n  /*     `s' is the corresponding error string.                            */\r\n  /*                                                                       */\r\n  /*   FT_ERROR_END_LIST ::                                                */\r\n  /*     This macro ends the list.                                         */\r\n  /*                                                                       */\r\n  /*   Additionally, you have to undefine __FTERRORS_H__ before #including */\r\n  /*   this file.                                                          */\r\n  /*                                                                       */\r\n  /*   Here is a simple example:                                           */\r\n  /*                                                                       */\r\n  /*     {                                                                 */\r\n  /*       #undef __FTERRORS_H__                                           */\r\n  /*       #define FT_ERRORDEF( e, v, s )  { e, s },                       */\r\n  /*       #define FT_ERROR_START_LIST     {                               */\r\n  /*       #define FT_ERROR_END_LIST       { 0, 0 } };                     */\r\n  /*                                                                       */\r\n  /*       const struct                                                    */\r\n  /*       {                                                               */\r\n  /*         int          err_code;                                        */\r\n  /*         const char*  err_msg;                                         */\r\n  /*       } ft_errors[] =                                                 */\r\n  /*                                                                       */\r\n  /*       #include FT_ERRORS_H                                            */\r\n  /*     }                                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTERRORS_H__\r\n#define __FTERRORS_H__\r\n\r\n\r\n  /* include module base error codes */\r\n#include FT_MODULE_ERRORS_H\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                       SETUP MACROS                      *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#undef  FT_NEED_EXTERN_C\r\n\r\n#undef  FT_ERR_XCAT\r\n#undef  FT_ERR_CAT\r\n\r\n#define FT_ERR_XCAT( x, y )  x ## y\r\n#define FT_ERR_CAT( x, y )   FT_ERR_XCAT( x, y )\r\n\r\n\r\n  /* FT_ERR_PREFIX is used as a prefix for error identifiers. */\r\n  /* By default, we use `FT_Err_'.                            */\r\n  /*                                                          */\r\n#ifndef FT_ERR_PREFIX\r\n#define FT_ERR_PREFIX  FT_Err_\r\n#endif\r\n\r\n\r\n  /* FT_ERR_BASE is used as the base for module-specific errors. */\r\n  /*                                                             */\r\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\r\n\r\n#ifndef FT_ERR_BASE\r\n#define FT_ERR_BASE  FT_Mod_Err_Base\r\n#endif\r\n\r\n#else\r\n\r\n#undef FT_ERR_BASE\r\n#define FT_ERR_BASE  0\r\n\r\n#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */\r\n\r\n\r\n  /* If FT_ERRORDEF is not defined, we need to define a simple */\r\n  /* enumeration type.                                         */\r\n  /*                                                           */\r\n#ifndef FT_ERRORDEF\r\n\r\n#define FT_ERRORDEF( e, v, s )  e = v,\r\n#define FT_ERROR_START_LIST     enum {\r\n#define FT_ERROR_END_LIST       FT_ERR_CAT( FT_ERR_PREFIX, Max ) };\r\n\r\n#ifdef __cplusplus\r\n#define FT_NEED_EXTERN_C\r\n  extern \"C\" {\r\n#endif\r\n\r\n#endif /* !FT_ERRORDEF */\r\n\r\n\r\n  /* this macro is used to define an error */\r\n#define FT_ERRORDEF_( e, v, s )   \\\r\n          FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )\r\n\r\n  /* this is only used for <module>_Err_Ok, which must be 0! */\r\n#define FT_NOERRORDEF_( e, v, s ) \\\r\n          FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )\r\n\r\n\r\n#ifdef FT_ERROR_START_LIST\r\n  FT_ERROR_START_LIST\r\n#endif\r\n\r\n\r\n  /* now include the error codes */\r\n#include FT_ERROR_DEFINITIONS_H\r\n\r\n\r\n#ifdef FT_ERROR_END_LIST\r\n  FT_ERROR_END_LIST\r\n#endif\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                      SIMPLE CLEANUP                     *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n#ifdef FT_NEED_EXTERN_C\r\n  }\r\n#endif\r\n\r\n#undef FT_ERROR_START_LIST\r\n#undef FT_ERROR_END_LIST\r\n\r\n#undef FT_ERRORDEF\r\n#undef FT_ERRORDEF_\r\n#undef FT_NOERRORDEF_\r\n\r\n#undef FT_NEED_EXTERN_C\r\n#undef FT_ERR_CONCAT\r\n#undef FT_ERR_BASE\r\n\r\n  /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */\r\n#ifndef FT_KEEP_ERR_PREFIX\r\n#undef FT_ERR_PREFIX\r\n#endif\r\n\r\n#endif /* __FTERRORS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftgasp.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgasp.h                                                               */\r\n/*                                                                         */\r\n/*    Access of TrueType's `gasp' table (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2008 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef _FT_GASP_H_\r\n#define _FT_GASP_H_\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @section:\r\n   *   gasp_table\r\n   *\r\n   * @title:\r\n   *   Gasp Table\r\n   *\r\n   * @abstract:\r\n   *   Retrieving TrueType `gasp' table entries.\r\n   *\r\n   * @description:\r\n   *   The function @FT_Get_Gasp can be used to query a TrueType or OpenType\r\n   *   font for specific entries in its `gasp' table, if any.  This is\r\n   *   mainly useful when implementing native TrueType hinting with the\r\n   *   bytecode interpreter to duplicate the Windows text rendering results.\r\n   */\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_GASP_XXX\r\n   *\r\n   * @description:\r\n   *   A list of values and/or bit-flags returned by the @FT_Get_Gasp\r\n   *   function.\r\n   *\r\n   * @values:\r\n   *   FT_GASP_NO_TABLE ::\r\n   *     This special value means that there is no GASP table in this face.\r\n   *     It is up to the client to decide what to do.\r\n   *\r\n   *   FT_GASP_DO_GRIDFIT ::\r\n   *     Grid-fitting and hinting should be performed at the specified ppem.\r\n   *     This *really* means TrueType bytecode interpretation.\r\n   *\r\n   *   FT_GASP_DO_GRAY ::\r\n   *     Anti-aliased rendering should be performed at the specified ppem.\r\n   *\r\n   *   FT_GASP_SYMMETRIC_SMOOTHING ::\r\n   *     Smoothing along multiple axes must be used with ClearType.\r\n   *\r\n   *   FT_GASP_SYMMETRIC_GRIDFIT ::\r\n   *     Grid-fitting must be used with ClearType's symmetric smoothing.\r\n   *\r\n   * @note:\r\n   *   `ClearType' is Microsoft's implementation of LCD rendering, partly\r\n   *   protected by patents.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n#define FT_GASP_NO_TABLE               -1\r\n#define FT_GASP_DO_GRIDFIT           0x01\r\n#define FT_GASP_DO_GRAY              0x02\r\n#define FT_GASP_SYMMETRIC_SMOOTHING  0x08\r\n#define FT_GASP_SYMMETRIC_GRIDFIT    0x10\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Get_Gasp\r\n   *\r\n   * @description:\r\n   *   Read the `gasp' table from a TrueType or OpenType font file and\r\n   *   return the entry corresponding to a given character pixel size.\r\n   *\r\n   * @input:\r\n   *   face :: The source face handle.\r\n   *   ppem :: The vertical character pixel size.\r\n   *\r\n   * @return:\r\n   *   Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no\r\n   *   `gasp' table in the face.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Get_Gasp( FT_Face  face,\r\n               FT_UInt  ppem );\r\n\r\n/* */\r\n\r\n#endif /* _FT_GASP_H_ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftglyph.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftglyph.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType convenience functions to handle glyphs (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file contains the definition of several convenience functions    */\r\n  /* that can be used by client applications to easily retrieve glyph      */\r\n  /* bitmaps and outlines from a given face.                               */\r\n  /*                                                                       */\r\n  /* These functions should be optional if you are writing a font server   */\r\n  /* or text layout engine on top of FreeType.  However, they are pretty   */\r\n  /* handy for many other simple uses of the library.                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTGLYPH_H__\r\n#define __FTGLYPH_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    glyph_management                                                   */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Glyph Management                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Generic interface to manage individual glyph data.                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains definitions used to manage glyph data        */\r\n  /*    through generic FT_Glyph objects.  Each of them can contain a      */\r\n  /*    bitmap, a vector outline, or even images in other formats.         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* forward declaration to a private type */\r\n  typedef struct FT_Glyph_Class_  FT_Glyph_Class;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Glyph                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Handle to an object used to model generic glyph images.  It is a   */\r\n  /*    pointer to the @FT_GlyphRec structure and can contain a glyph      */\r\n  /*    bitmap or pointer.                                                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Glyph objects are not owned by the library.  You must thus release */\r\n  /*    them manually (through @FT_Done_Glyph) _before_ calling            */\r\n  /*    @FT_Done_FreeType.                                                 */\r\n  /*                                                                       */\r\n  typedef struct FT_GlyphRec_*  FT_Glyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_GlyphRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The root glyph structure contains a given glyph image plus its     */\r\n  /*    advance width in 16.16 fixed float format.                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    library :: A handle to the FreeType library object.                */\r\n  /*                                                                       */\r\n  /*    clazz   :: A pointer to the glyph's class.  Private.               */\r\n  /*                                                                       */\r\n  /*    format  :: The format of the glyph's image.                        */\r\n  /*                                                                       */\r\n  /*    advance :: A 16.16 vector that gives the glyph's advance width.    */\r\n  /*                                                                       */\r\n  typedef struct  FT_GlyphRec_\r\n  {\r\n    FT_Library             library;\r\n    const FT_Glyph_Class*  clazz;\r\n    FT_Glyph_Format        format;\r\n    FT_Vector              advance;\r\n\r\n  } FT_GlyphRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_BitmapGlyph                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an object used to model a bitmap glyph image.  This is */\r\n  /*    a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.     */\r\n  /*                                                                       */\r\n  typedef struct FT_BitmapGlyphRec_*  FT_BitmapGlyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_BitmapGlyphRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used for bitmap glyph images.  This really is a        */\r\n  /*    `sub-class' of @FT_GlyphRec.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root   :: The root @FT_Glyph fields.                               */\r\n  /*                                                                       */\r\n  /*    left   :: The left-side bearing, i.e., the horizontal distance     */\r\n  /*              from the current pen position to the left border of the  */\r\n  /*              glyph bitmap.                                            */\r\n  /*                                                                       */\r\n  /*    top    :: The top-side bearing, i.e., the vertical distance from   */\r\n  /*              the current pen position to the top border of the glyph  */\r\n  /*              bitmap.  This distance is positive for upwards~y!        */\r\n  /*                                                                       */\r\n  /*    bitmap :: A descriptor for the bitmap.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have       */\r\n  /*    `glyph->format == FT_GLYPH_FORMAT_BITMAP'.  This lets you access   */\r\n  /*    the bitmap's contents easily.                                      */\r\n  /*                                                                       */\r\n  /*    The corresponding pixel buffer is always owned by @FT_BitmapGlyph  */\r\n  /*    and is thus created and destroyed with it.                         */\r\n  /*                                                                       */\r\n  typedef struct  FT_BitmapGlyphRec_\r\n  {\r\n    FT_GlyphRec  root;\r\n    FT_Int       left;\r\n    FT_Int       top;\r\n    FT_Bitmap    bitmap;\r\n\r\n  } FT_BitmapGlyphRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_OutlineGlyph                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an object used to model an outline glyph image.  This  */\r\n  /*    is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */\r\n  /*                                                                       */\r\n  typedef struct FT_OutlineGlyphRec_*  FT_OutlineGlyph;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_OutlineGlyphRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used for outline (vectorial) glyph images.  This       */\r\n  /*    really is a `sub-class' of @FT_GlyphRec.                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root    :: The root @FT_Glyph fields.                              */\r\n  /*                                                                       */\r\n  /*    outline :: A descriptor for the outline.                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have      */\r\n  /*    `glyph->format == FT_GLYPH_FORMAT_OUTLINE'.  This lets you access  */\r\n  /*    the outline's content easily.                                      */\r\n  /*                                                                       */\r\n  /*    As the outline is extracted from a glyph slot, its coordinates are */\r\n  /*    expressed normally in 26.6 pixels, unless the flag                 */\r\n  /*    @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */\r\n  /*                                                                       */\r\n  /*    The outline's tables are always owned by the object and are        */\r\n  /*    destroyed with it.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_OutlineGlyphRec_\r\n  {\r\n    FT_GlyphRec  root;\r\n    FT_Outline   outline;\r\n\r\n  } FT_OutlineGlyphRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Glyph                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to extract a glyph image from a slot.  Note that   */\r\n  /*    the created @FT_Glyph object must be released with @FT_Done_Glyph. */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot   :: A handle to the source glyph slot.                       */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aglyph :: A handle to the glyph object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Glyph( FT_GlyphSlot  slot,\r\n                FT_Glyph     *aglyph );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_Copy                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to copy a glyph image.  Note that the created      */\r\n  /*    @FT_Glyph object must be released with @FT_Done_Glyph.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    source :: A handle to the source glyph object.                     */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target :: A handle to the target glyph object.  0~in case of       */\r\n  /*              error.                                                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_Copy( FT_Glyph   source,\r\n                 FT_Glyph  *target );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_Transform                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Transform a glyph image if its format is scalable.                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    glyph  :: A handle to the target glyph object.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix :: A pointer to a 2x2 matrix to apply.                      */\r\n  /*                                                                       */\r\n  /*    delta  :: A pointer to a 2d vector to apply.  Coordinates are      */\r\n  /*              expressed in 1/64th of a pixel.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code (if not 0, the glyph format is not scalable).  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The 2x2 transformation matrix is also applied to the glyph's       */\r\n  /*    advance vector.                                                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_Transform( FT_Glyph    glyph,\r\n                      FT_Matrix*  matrix,\r\n                      FT_Vector*  delta );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Glyph_BBox_Mode                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The mode how the values of @FT_Glyph_Get_CBox are returned.        */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_GLYPH_BBOX_UNSCALED ::                                          */\r\n  /*      Return unscaled font units.                                      */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_SUBPIXELS ::                                         */\r\n  /*      Return unfitted 26.6 coordinates.                                */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_GRIDFIT ::                                           */\r\n  /*      Return grid-fitted 26.6 coordinates.                             */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_TRUNCATE ::                                          */\r\n  /*      Return coordinates in integer pixels.                            */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_BBOX_PIXELS ::                                            */\r\n  /*      Return grid-fitted pixel coordinates.                            */\r\n  /*                                                                       */\r\n  typedef enum  FT_Glyph_BBox_Mode_\r\n  {\r\n    FT_GLYPH_BBOX_UNSCALED  = 0,\r\n    FT_GLYPH_BBOX_SUBPIXELS = 0,\r\n    FT_GLYPH_BBOX_GRIDFIT   = 1,\r\n    FT_GLYPH_BBOX_TRUNCATE  = 2,\r\n    FT_GLYPH_BBOX_PIXELS    = 3\r\n\r\n  } FT_Glyph_BBox_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_glyph_bbox_xxx                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    These constants are deprecated.  Use the corresponding             */\r\n  /*    @FT_Glyph_BBox_Mode values instead.                                */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*   ft_glyph_bbox_unscaled  :: See @FT_GLYPH_BBOX_UNSCALED.             */\r\n  /*   ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS.            */\r\n  /*   ft_glyph_bbox_gridfit   :: See @FT_GLYPH_BBOX_GRIDFIT.              */\r\n  /*   ft_glyph_bbox_truncate  :: See @FT_GLYPH_BBOX_TRUNCATE.             */\r\n  /*   ft_glyph_bbox_pixels    :: See @FT_GLYPH_BBOX_PIXELS.               */\r\n  /*                                                                       */\r\n#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED\r\n#define ft_glyph_bbox_subpixels  FT_GLYPH_BBOX_SUBPIXELS\r\n#define ft_glyph_bbox_gridfit    FT_GLYPH_BBOX_GRIDFIT\r\n#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE\r\n#define ft_glyph_bbox_pixels     FT_GLYPH_BBOX_PIXELS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_Get_CBox                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a glyph's `control box'.  The control box encloses all the  */\r\n  /*    outline's points, including Bézier control points.  Though it      */\r\n  /*    coincides with the exact bounding box for most glyphs, it can be   */\r\n  /*    slightly larger in some situations (like when rotating an outline  */\r\n  /*    which contains Bézier outside arcs).                               */\r\n  /*                                                                       */\r\n  /*    Computing the control box is very fast, while getting the bounding */\r\n  /*    box can take much more time as it needs to walk over all segments  */\r\n  /*    and arcs in the outline.  To get the latter, you can use the       */\r\n  /*    `ftbbox' component which is dedicated to this single task.         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph :: A handle to the source glyph object.                      */\r\n  /*                                                                       */\r\n  /*    mode  :: The mode which indicates how to interpret the returned    */\r\n  /*             bounding box values.                                      */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acbox :: The glyph coordinate bounding box.  Coordinates are       */\r\n  /*             expressed in 1/64th of pixels if it is grid-fitted.       */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Coordinates are relative to the glyph origin, using the y~upwards  */\r\n  /*    convention.                                                        */\r\n  /*                                                                       */\r\n  /*    If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode'   */\r\n  /*    must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font        */\r\n  /*    units in 26.6 pixel format.  The value @FT_GLYPH_BBOX_SUBPIXELS    */\r\n  /*    is another name for this constant.                                 */\r\n  /*                                                                       */\r\n  /*    Note that the maximum coordinates are exclusive, which means that  */\r\n  /*    one can compute the width and height of the glyph image (be it in  */\r\n  /*    integer or 26.6 pixels) as:                                        */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      width  = bbox.xMax - bbox.xMin;                                  */\r\n  /*      height = bbox.yMax - bbox.yMin;                                  */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Note also that for 26.6 coordinates, if `bbox_mode' is set to      */\r\n  /*    @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted,  */\r\n  /*    which corresponds to:                                              */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      bbox.xMin = FLOOR(bbox.xMin);                                    */\r\n  /*      bbox.yMin = FLOOR(bbox.yMin);                                    */\r\n  /*      bbox.xMax = CEILING(bbox.xMax);                                  */\r\n  /*      bbox.yMax = CEILING(bbox.yMax);                                  */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    To get the bbox in pixel coordinates, set `bbox_mode' to           */\r\n  /*    @FT_GLYPH_BBOX_TRUNCATE.                                           */\r\n  /*                                                                       */\r\n  /*    To get the bbox in grid-fitted pixel coordinates, set `bbox_mode'  */\r\n  /*    to @FT_GLYPH_BBOX_PIXELS.                                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Glyph_Get_CBox( FT_Glyph  glyph,\r\n                     FT_UInt   bbox_mode,\r\n                     FT_BBox  *acbox );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Glyph_To_Bitmap                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Convert a given glyph object to a bitmap glyph object.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    the_glyph   :: A pointer to a handle to the target glyph.          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    render_mode :: An enumeration that describes how the data is       */\r\n  /*                   rendered.                                           */\r\n  /*                                                                       */\r\n  /*    origin      :: A pointer to a vector used to translate the glyph   */\r\n  /*                   image before rendering.  Can be~0 (if no            */\r\n  /*                   translation).  The origin is expressed in           */\r\n  /*                   26.6 pixels.                                        */\r\n  /*                                                                       */\r\n  /*    destroy     :: A boolean that indicates that the original glyph    */\r\n  /*                   image should be destroyed by this function.  It is  */\r\n  /*                   never destroyed in case of error.                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does nothing if the glyph format isn't scalable.     */\r\n  /*                                                                       */\r\n  /*    The glyph image is translated with the `origin' vector before      */\r\n  /*    rendering.                                                         */\r\n  /*                                                                       */\r\n  /*    The first parameter is a pointer to an @FT_Glyph handle, that will */\r\n  /*    be _replaced_ by this function (with newly allocated data).        */\r\n  /*    Typically, you would use (omitting error handling):                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      {                                                                */\r\n  /*        FT_Glyph        glyph;                                         */\r\n  /*        FT_BitmapGlyph  glyph_bitmap;                                  */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*        // load glyph                                                  */\r\n  /*        error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT );     */\r\n  /*                                                                       */\r\n  /*        // extract glyph image                                         */\r\n  /*        error = FT_Get_Glyph( face->glyph, &glyph );                   */\r\n  /*                                                                       */\r\n  /*        // convert to a bitmap (default render mode + destroying old)  */\r\n  /*        if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )                 */\r\n  /*        {                                                              */\r\n  /*          error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,   */\r\n  /*                                      0, 1 );                          */\r\n  /*          if ( error ) // `glyph' unchanged                            */\r\n  /*            ...                                                        */\r\n  /*        }                                                              */\r\n  /*                                                                       */\r\n  /*        // access bitmap content by typecasting                        */\r\n  /*        glyph_bitmap = (FT_BitmapGlyph)glyph;                          */\r\n  /*                                                                       */\r\n  /*        // do funny stuff with it, like blitting/drawing               */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        // discard glyph image (bitmap or not)                         */\r\n  /*        FT_Done_Glyph( glyph );                                        */\r\n  /*      }                                                                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*    Here another example, again without error handling:                */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*      {                                                                */\r\n  /*        FT_Glyph  glyphs[MAX_GLYPHS]                                   */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */\r\n  /*          error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||       */\r\n  /*                  FT_Get_Glyph ( face->glyph, &glyph[idx] );           */\r\n  /*                                                                       */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */\r\n  /*        {                                                              */\r\n  /*          FT_Glyph  bitmap = glyphs[idx];                              */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*          ...                                                          */\r\n  /*                                                                       */\r\n  /*          // after this call, `bitmap' no longer points into           */\r\n  /*          // the `glyphs' array (and the old value isn't destroyed)    */\r\n  /*          FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );    */\r\n  /*                                                                       */\r\n  /*          ...                                                          */\r\n  /*                                                                       */\r\n  /*          FT_Done_Glyph( bitmap );                                     */\r\n  /*        }                                                              */\r\n  /*                                                                       */\r\n  /*        ...                                                            */\r\n  /*                                                                       */\r\n  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */\r\n  /*          FT_Done_Glyph( glyphs[idx] );                                */\r\n  /*      }                                                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,\r\n                      FT_Render_Mode  render_mode,\r\n                      FT_Vector*      origin,\r\n                      FT_Bool         destroy );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Glyph                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy a given glyph.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    glyph :: A handle to the target glyph object.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Done_Glyph( FT_Glyph  glyph );\r\n\r\n  /* */\r\n\r\n\r\n  /* other helpful functions */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    computations                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Matrix_Multiply                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Perform the matrix operation `b = a*b'.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: A pointer to matrix `a'.                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    b :: A pointer to matrix `b'.                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The result is undefined if either `a' or `b' is zero.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Matrix_Multiply( const FT_Matrix*  a,\r\n                      FT_Matrix*        b );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Matrix_Invert                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Invert a 2x2 matrix.  Return an error if it can't be inverted.     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */\r\n  /*              case of error.                                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Matrix_Invert( FT_Matrix*  matrix );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGLYPH_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftgxval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgxval.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating TrueTypeGX/AAT tables (specification).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006 by                                          */\r\n/*  Masatake YAMATO, Redhat K.K,                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGXVAL_H__\r\n#define __FTGXVAL_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    gx_validation                                                      */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    TrueTypeGX/AAT Validation                                          */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    An API to validate TrueTypeGX/AAT tables.                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of functions to validate     */\r\n  /*    some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd,  */\r\n  /*    trak, prop, lcar).                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /* Warning: Use FT_VALIDATE_XXX to validate a table.                     */\r\n  /*          Following definitions are for gxvalid developers.            */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#define FT_VALIDATE_feat_INDEX     0\r\n#define FT_VALIDATE_mort_INDEX     1\r\n#define FT_VALIDATE_morx_INDEX     2\r\n#define FT_VALIDATE_bsln_INDEX     3\r\n#define FT_VALIDATE_just_INDEX     4\r\n#define FT_VALIDATE_kern_INDEX     5\r\n#define FT_VALIDATE_opbd_INDEX     6\r\n#define FT_VALIDATE_trak_INDEX     7\r\n#define FT_VALIDATE_prop_INDEX     8\r\n#define FT_VALIDATE_lcar_INDEX     9\r\n#define FT_VALIDATE_GX_LAST_INDEX  FT_VALIDATE_lcar_INDEX\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_VALIDATE_GX_LENGTH\r\n   *\r\n   * @description:\r\n   *   The number of tables checked in this module.  Use it as a parameter\r\n   *   for the `table-length' argument of function @FT_TrueTypeGX_Validate.\r\n   */\r\n#define FT_VALIDATE_GX_LENGTH     (FT_VALIDATE_GX_LAST_INDEX + 1)\r\n\r\n  /* */\r\n\r\n  /* Up to 0x1000 is used by otvalid.\r\n     Ox2xxx is reserved for feature OT extension. */\r\n#define FT_VALIDATE_GX_START 0x4000\r\n#define FT_VALIDATE_GX_BITFIELD( tag )                  \\\r\n  ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @enum:\r\n  *    FT_VALIDATE_GXXXX\r\n  *\r\n  * @description:\r\n  *    A list of bit-field constants used with @FT_TrueTypeGX_Validate to\r\n  *    indicate which TrueTypeGX/AAT Type tables should be validated.\r\n  *\r\n  * @values:\r\n  *    FT_VALIDATE_feat ::\r\n  *      Validate `feat' table.\r\n  *\r\n  *    FT_VALIDATE_mort ::\r\n  *      Validate `mort' table.\r\n  *\r\n  *    FT_VALIDATE_morx ::\r\n  *      Validate `morx' table.\r\n  *\r\n  *    FT_VALIDATE_bsln ::\r\n  *      Validate `bsln' table.\r\n  *\r\n  *    FT_VALIDATE_just ::\r\n  *      Validate `just' table.\r\n  *\r\n  *    FT_VALIDATE_kern ::\r\n  *      Validate `kern' table.\r\n  *\r\n  *    FT_VALIDATE_opbd ::\r\n  *      Validate `opbd' table.\r\n  *\r\n  *    FT_VALIDATE_trak ::\r\n  *      Validate `trak' table.\r\n  *\r\n  *    FT_VALIDATE_prop ::\r\n  *      Validate `prop' table.\r\n  *\r\n  *    FT_VALIDATE_lcar ::\r\n  *      Validate `lcar' table.\r\n  *\r\n  *    FT_VALIDATE_GX ::\r\n  *      Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,\r\n  *      opbd, trak, prop and lcar).\r\n  *\r\n  */\r\n\r\n#define FT_VALIDATE_feat  FT_VALIDATE_GX_BITFIELD( feat )\r\n#define FT_VALIDATE_mort  FT_VALIDATE_GX_BITFIELD( mort )\r\n#define FT_VALIDATE_morx  FT_VALIDATE_GX_BITFIELD( morx )\r\n#define FT_VALIDATE_bsln  FT_VALIDATE_GX_BITFIELD( bsln )\r\n#define FT_VALIDATE_just  FT_VALIDATE_GX_BITFIELD( just )\r\n#define FT_VALIDATE_kern  FT_VALIDATE_GX_BITFIELD( kern )\r\n#define FT_VALIDATE_opbd  FT_VALIDATE_GX_BITFIELD( opbd )\r\n#define FT_VALIDATE_trak  FT_VALIDATE_GX_BITFIELD( trak )\r\n#define FT_VALIDATE_prop  FT_VALIDATE_GX_BITFIELD( prop )\r\n#define FT_VALIDATE_lcar  FT_VALIDATE_GX_BITFIELD( lcar )\r\n\r\n#define FT_VALIDATE_GX  ( FT_VALIDATE_feat | \\\r\n                          FT_VALIDATE_mort | \\\r\n                          FT_VALIDATE_morx | \\\r\n                          FT_VALIDATE_bsln | \\\r\n                          FT_VALIDATE_just | \\\r\n                          FT_VALIDATE_kern | \\\r\n                          FT_VALIDATE_opbd | \\\r\n                          FT_VALIDATE_trak | \\\r\n                          FT_VALIDATE_prop | \\\r\n                          FT_VALIDATE_lcar )\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_TrueTypeGX_Validate\r\n  *\r\n  * @description:\r\n  *    Validate various TrueTypeGX tables to assure that all offsets and\r\n  *    indices are valid.  The idea is that a higher-level library which\r\n  *    actually does the text layout can access those tables without\r\n  *    error checking (which can be quite time consuming).\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    validation_flags ::\r\n  *       A bit field which specifies the tables to be validated.  See\r\n  *       @FT_VALIDATE_GXXXX for possible values.\r\n  *\r\n  *    table_length ::\r\n  *       The size of the `tables' array.  Normally, @FT_VALIDATE_GX_LENGTH\r\n  *       should be passed.\r\n  *\r\n  * @output:\r\n  *    tables ::\r\n  *       The array where all validated sfnt tables are stored.\r\n  *       The array itself must be allocated by a client.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function only works with TrueTypeGX fonts, returning an error\r\n  *   otherwise.\r\n  *\r\n  *   After use, the application should deallocate the buffers pointed to by\r\n  *   each `tables' element, by calling @FT_TrueTypeGX_Free.  A NULL value\r\n  *   indicates that the table either doesn't exist in the font, the\r\n  *   application hasn't asked for validation, or the validator doesn't have\r\n  *   the ability to validate the sfnt table.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_TrueTypeGX_Validate( FT_Face   face,\r\n                          FT_UInt   validation_flags,\r\n                          FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],\r\n                          FT_UInt   table_length );\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_TrueTypeGX_Free\r\n  *\r\n  * @description:\r\n  *    Free the buffer allocated by TrueTypeGX validator.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    table ::\r\n  *       The pointer to the buffer allocated by\r\n  *       @FT_TrueTypeGX_Validate.\r\n  *\r\n  * @note:\r\n  *   This function must be used to free the buffer allocated by\r\n  *   @FT_TrueTypeGX_Validate only.\r\n  */\r\n  FT_EXPORT( void )\r\n  FT_TrueTypeGX_Free( FT_Face   face,\r\n                      FT_Bytes  table );\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @enum:\r\n  *    FT_VALIDATE_CKERNXXX\r\n  *\r\n  * @description:\r\n  *    A list of bit-field constants used with @FT_ClassicKern_Validate\r\n  *    to indicate the classic kern dialect or dialects.  If the selected\r\n  *    type doesn't fit, @FT_ClassicKern_Validate regards the table as\r\n  *    invalid.\r\n  *\r\n  * @values:\r\n  *    FT_VALIDATE_MS ::\r\n  *      Handle the `kern' table as a classic Microsoft kern table.\r\n  *\r\n  *    FT_VALIDATE_APPLE ::\r\n  *      Handle the `kern' table as a classic Apple kern table.\r\n  *\r\n  *    FT_VALIDATE_CKERN ::\r\n  *      Handle the `kern' as either classic Apple or Microsoft kern table.\r\n  */\r\n#define FT_VALIDATE_MS     ( FT_VALIDATE_GX_START << 0 )\r\n#define FT_VALIDATE_APPLE  ( FT_VALIDATE_GX_START << 1 )\r\n\r\n#define FT_VALIDATE_CKERN  ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_ClassicKern_Validate\r\n  *\r\n  * @description:\r\n  *    Validate classic (16-bit format) kern table to assure that the offsets\r\n  *    and indices are valid.  The idea is that a higher-level library which\r\n  *    actually does the text layout can access those tables without error\r\n  *    checking (which can be quite time consuming).\r\n  *\r\n  *    The `kern' table validator in @FT_TrueTypeGX_Validate deals with both\r\n  *    the new 32-bit format and the classic 16-bit format, while\r\n  *    FT_ClassicKern_Validate only supports the classic 16-bit format.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    validation_flags ::\r\n  *       A bit field which specifies the dialect to be validated.  See\r\n  *       @FT_VALIDATE_CKERNXXX for possible values.\r\n  *\r\n  * @output:\r\n  *    ckern_table ::\r\n  *       A pointer to the kern table.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   After use, the application should deallocate the buffers pointed to by\r\n  *   `ckern_table', by calling @FT_ClassicKern_Free.  A NULL value\r\n  *   indicates that the table doesn't exist in the font.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_ClassicKern_Validate( FT_Face    face,\r\n                           FT_UInt    validation_flags,\r\n                           FT_Bytes  *ckern_table );\r\n\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_ClassicKern_Free\r\n  *\r\n  * @description:\r\n  *    Free the buffer allocated by classic Kern validator.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    table ::\r\n  *       The pointer to the buffer that is allocated by\r\n  *       @FT_ClassicKern_Validate.\r\n  *\r\n  * @note:\r\n  *   This function must be used to free the buffer allocated by\r\n  *   @FT_ClassicKern_Validate only.\r\n  */\r\n  FT_EXPORT( void )\r\n  FT_ClassicKern_Free( FT_Face   face,\r\n                       FT_Bytes  table );\r\n\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGXVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftgzip.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgzip.h                                                               */\r\n/*                                                                         */\r\n/*    Gzip-compressed stream support.                                      */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGZIP_H__\r\n#define __FTGZIP_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    gzip                                                               */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    GZIP Streams                                                       */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Using gzip-compressed font files.                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of Gzip-specific functions.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Stream_OpenGzip\r\n  *\r\n  * @description:\r\n  *   Open a new stream to parse gzip-compressed font files.  This is\r\n  *   mainly used to support the compressed `*.pcf.gz' fonts that come\r\n  *   with XFree86.\r\n  *\r\n  * @input:\r\n  *   stream ::\r\n  *     The target embedding stream.\r\n  *\r\n  *   source ::\r\n  *     The source stream.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   The source stream must be opened _before_ calling this function.\r\n  *\r\n  *   Calling the internal function `FT_Stream_Close' on the new stream will\r\n  *   *not* call `FT_Stream_Close' on the source stream.  None of the stream\r\n  *   objects will be released to the heap.\r\n  *\r\n  *   The stream implementation is very basic and resets the decompression\r\n  *   process each time seeking backwards is needed within the stream.\r\n  *\r\n  *   In certain builds of the library, gzip compression recognition is\r\n  *   automatically handled when calling @FT_New_Face or @FT_Open_Face.\r\n  *   This means that if no font driver is capable of handling the raw\r\n  *   compressed file, the library will try to open a gzipped stream from\r\n  *   it and re-open the face with it.\r\n  *\r\n  *   This function may return `FT_Err_Unimplemented_Feature' if your build\r\n  *   of FreeType was not compiled with zlib support.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stream_OpenGzip( FT_Stream  stream,\r\n                      FT_Stream  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGZIP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftimage.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftimage.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType glyph image formats and default raster interface            */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */\r\n/*            2010 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Note: A `raster' is simply a scan-line converter, used to render      */\r\n  /*       FT_Outlines into FT_Bitmaps.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTIMAGE_H__\r\n#define __FTIMAGE_H__\r\n\r\n\r\n  /* _STANDALONE_ is from ftgrays.c */\r\n#ifndef _STANDALONE_\r\n#include <ft2build.h>\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Pos                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The type FT_Pos is used to store vectorial coordinates.  Depending */\r\n  /*    on the context, these can represent distances in integer font      */\r\n  /*    units, or 16.16, or 26.6 fixed float pixel coordinates.            */\r\n  /*                                                                       */\r\n  typedef signed long  FT_Pos;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Vector                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to store a 2D vector; coordinates are of   */\r\n  /*    the FT_Pos type.                                                   */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x :: The horizontal coordinate.                                    */\r\n  /*    y :: The vertical coordinate.                                      */\r\n  /*                                                                       */\r\n  typedef struct  FT_Vector_\r\n  {\r\n    FT_Pos  x;\r\n    FT_Pos  y;\r\n\r\n  } FT_Vector;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_BBox                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold an outline's bounding box, i.e., the      */\r\n  /*    coordinates of its extrema in the horizontal and vertical          */\r\n  /*    directions.                                                        */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    xMin :: The horizontal minimum (left-most).                        */\r\n  /*                                                                       */\r\n  /*    yMin :: The vertical minimum (bottom-most).                        */\r\n  /*                                                                       */\r\n  /*    xMax :: The horizontal maximum (right-most).                       */\r\n  /*                                                                       */\r\n  /*    yMax :: The vertical maximum (top-most).                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The bounding box is specified with the coordinates of the lower    */\r\n  /*    left and the upper right corner.  In PostScript, those values are  */\r\n  /*    often called (llx,lly) and (urx,ury), respectively.                */\r\n  /*                                                                       */\r\n  /*    If `yMin' is negative, this value gives the glyph's descender.     */\r\n  /*    Otherwise, the glyph doesn't descend below the baseline.           */\r\n  /*    Similarly, if `ymax' is positive, this value gives the glyph's     */\r\n  /*    ascender.                                                          */\r\n  /*                                                                       */\r\n  /*    `xMin' gives the horizontal distance from the glyph's origin to    */\r\n  /*    the left edge of the glyph's bounding box.  If `xMin' is negative, */\r\n  /*    the glyph extends to the left of the origin.                       */\r\n  /*                                                                       */\r\n  typedef struct  FT_BBox_\r\n  {\r\n    FT_Pos  xMin, yMin;\r\n    FT_Pos  xMax, yMax;\r\n\r\n  } FT_BBox;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Pixel_Mode                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type used to describe the format of pixels in a     */\r\n  /*    given bitmap.  Note that additional formats may be added in the    */\r\n  /*    future.                                                            */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_PIXEL_MODE_NONE ::                                              */\r\n  /*      Value~0 is reserved.                                             */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_MONO ::                                              */\r\n  /*      A monochrome bitmap, using 1~bit per pixel.  Note that pixels    */\r\n  /*      are stored in most-significant order (MSB), which means that     */\r\n  /*      the left-most pixel in a byte has value 128.                     */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_GRAY ::                                              */\r\n  /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */\r\n  /*      images.  Each pixel is stored in one byte.  Note that the number */\r\n  /*      of `gray' levels is stored in the `num_grays' field of the       */\r\n  /*      @FT_Bitmap structure (it generally is 256).                      */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_GRAY2 ::                                             */\r\n  /*      A 2-bit per pixel bitmap, used to represent embedded             */\r\n  /*      anti-aliased bitmaps in font files according to the OpenType     */\r\n  /*      specification.  We haven't found a single font using this        */\r\n  /*      format, however.                                                 */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_GRAY4 ::                                             */\r\n  /*      A 4-bit per pixel bitmap, representing embedded anti-aliased     */\r\n  /*      bitmaps in font files according to the OpenType specification.   */\r\n  /*      We haven't found a single font using this format, however.       */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_LCD ::                                               */\r\n  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */\r\n  /*      used for display on LCD displays; the bitmap is three times      */\r\n  /*      wider than the original glyph image.  See also                   */\r\n  /*      @FT_RENDER_MODE_LCD.                                             */\r\n  /*                                                                       */\r\n  /*    FT_PIXEL_MODE_LCD_V ::                                             */\r\n  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */\r\n  /*      used for display on rotated LCD displays; the bitmap is three    */\r\n  /*      times taller than the original glyph image.  See also            */\r\n  /*      @FT_RENDER_MODE_LCD_V.                                           */\r\n  /*                                                                       */\r\n  typedef enum  FT_Pixel_Mode_\r\n  {\r\n    FT_PIXEL_MODE_NONE = 0,\r\n    FT_PIXEL_MODE_MONO,\r\n    FT_PIXEL_MODE_GRAY,\r\n    FT_PIXEL_MODE_GRAY2,\r\n    FT_PIXEL_MODE_GRAY4,\r\n    FT_PIXEL_MODE_LCD,\r\n    FT_PIXEL_MODE_LCD_V,\r\n\r\n    FT_PIXEL_MODE_MAX      /* do not remove */\r\n\r\n  } FT_Pixel_Mode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_pixel_mode_xxx                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of deprecated constants.  Use the corresponding             */\r\n  /*    @FT_Pixel_Mode values instead.                                     */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_pixel_mode_none  :: See @FT_PIXEL_MODE_NONE.                    */\r\n  /*    ft_pixel_mode_mono  :: See @FT_PIXEL_MODE_MONO.                    */\r\n  /*    ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY.                    */\r\n  /*    ft_pixel_mode_pal2  :: See @FT_PIXEL_MODE_GRAY2.                   */\r\n  /*    ft_pixel_mode_pal4  :: See @FT_PIXEL_MODE_GRAY4.                   */\r\n  /*                                                                       */\r\n#define ft_pixel_mode_none   FT_PIXEL_MODE_NONE\r\n#define ft_pixel_mode_mono   FT_PIXEL_MODE_MONO\r\n#define ft_pixel_mode_grays  FT_PIXEL_MODE_GRAY\r\n#define ft_pixel_mode_pal2   FT_PIXEL_MODE_GRAY2\r\n#define ft_pixel_mode_pal4   FT_PIXEL_MODE_GRAY4\r\n\r\n /* */\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Palette_Mode                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT!                           */\r\n  /*                                                                       */\r\n  /*    An enumeration type to describe the format of a bitmap palette,    */\r\n  /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_palette_mode_rgb  :: The palette is an array of 3-byte RGB      */\r\n  /*                            records.                                   */\r\n  /*                                                                       */\r\n  /*    ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA     */\r\n  /*                            records.                                   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by       */\r\n  /*    FreeType, these types are not handled by the library itself.       */\r\n  /*                                                                       */\r\n  typedef enum  FT_Palette_Mode_\r\n  {\r\n    ft_palette_mode_rgb = 0,\r\n    ft_palette_mode_rgba,\r\n\r\n    ft_palette_mode_max   /* do not remove */\r\n\r\n  } FT_Palette_Mode;\r\n\r\n  /* */\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Bitmap                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to describe a bitmap or pixmap to the raster.     */\r\n  /*    Note that we now manage pixmaps of various depths through the      */\r\n  /*    `pixel_mode' field.                                                */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    rows         :: The number of bitmap rows.                         */\r\n  /*                                                                       */\r\n  /*    width        :: The number of pixels in bitmap row.                */\r\n  /*                                                                       */\r\n  /*    pitch        :: The pitch's absolute value is the number of bytes  */\r\n  /*                    taken by one bitmap row, including padding.        */\r\n  /*                    However, the pitch is positive when the bitmap has */\r\n  /*                    a `down' flow, and negative when it has an `up'    */\r\n  /*                    flow.  In all cases, the pitch is an offset to add */\r\n  /*                    to a bitmap pointer in order to go down one row.   */\r\n  /*                                                                       */\r\n  /*                    Note that `padding' means the alignment of a       */\r\n  /*                    bitmap to a byte border, and FreeType functions    */\r\n  /*                    normally align to the smallest possible integer    */\r\n  /*                    value.                                             */\r\n  /*                                                                       */\r\n  /*                    For the B/W rasterizer, `pitch' is always an even  */\r\n  /*                    number.                                            */\r\n  /*                                                                       */\r\n  /*                    To change the pitch of a bitmap (say, to make it a */\r\n  /*                    multiple of 4), use @FT_Bitmap_Convert.            */\r\n  /*                    Alternatively, you might use callback functions to */\r\n  /*                    directly render to the application's surface; see  */\r\n  /*                    the file `example2.cpp' in the tutorial for a      */\r\n  /*                    demonstration.                                     */\r\n  /*                                                                       */\r\n  /*    buffer       :: A typeless pointer to the bitmap buffer.  This     */\r\n  /*                    value should be aligned on 32-bit boundaries in    */\r\n  /*                    most cases.                                        */\r\n  /*                                                                       */\r\n  /*    num_grays    :: This field is only used with                       */\r\n  /*                    @FT_PIXEL_MODE_GRAY; it gives the number of gray   */\r\n  /*                    levels used in the bitmap.                         */\r\n  /*                                                                       */\r\n  /*    pixel_mode   :: The pixel mode, i.e., how pixel bits are stored.   */\r\n  /*                    See @FT_Pixel_Mode for possible values.            */\r\n  /*                                                                       */\r\n  /*    palette_mode :: This field is intended for paletted pixel modes;   */\r\n  /*                    it indicates how the palette is stored.  Not       */\r\n  /*                    used currently.                                    */\r\n  /*                                                                       */\r\n  /*    palette      :: A typeless pointer to the bitmap palette; this     */\r\n  /*                    field is intended for paletted pixel modes.  Not   */\r\n  /*                    used currently.                                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*   For now, the only pixel modes supported by FreeType are mono and    */\r\n  /*   grays.  However, drivers might be added in the future to support    */\r\n  /*   more `colorful' options.                                            */\r\n  /*                                                                       */\r\n  typedef struct  FT_Bitmap_\r\n  {\r\n    int             rows;\r\n    int             width;\r\n    int             pitch;\r\n    unsigned char*  buffer;\r\n    short           num_grays;\r\n    char            pixel_mode;\r\n    char            palette_mode;\r\n    void*           palette;\r\n\r\n  } FT_Bitmap;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    outline_processing                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Outline                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure is used to describe an outline to the scan-line     */\r\n  /*    converter.                                                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    n_contours :: The number of contours in the outline.               */\r\n  /*                                                                       */\r\n  /*    n_points   :: The number of points in the outline.                 */\r\n  /*                                                                       */\r\n  /*    points     :: A pointer to an array of `n_points' @FT_Vector       */\r\n  /*                  elements, giving the outline's point coordinates.    */\r\n  /*                                                                       */\r\n  /*    tags       :: A pointer to an array of `n_points' chars, giving    */\r\n  /*                  each outline point's type.                           */\r\n  /*                                                                       */\r\n  /*                  If bit~0 is unset, the point is `off' the curve,     */\r\n  /*                  i.e., a Bézier control point, while it is `on' if    */\r\n  /*                  set.                                                 */\r\n  /*                                                                       */\r\n  /*                  Bit~1 is meaningful for `off' points only.  If set,  */\r\n  /*                  it indicates a third-order Bézier arc control point; */\r\n  /*                  and a second-order control point if unset.           */\r\n  /*                                                                       */\r\n  /*                  If bit~2 is set, bits 5-7 contain the drop-out mode  */\r\n  /*                  (as defined in the OpenType specification; the value */\r\n  /*                  is the same as the argument to the SCANMODE          */\r\n  /*                  instruction).                                        */\r\n  /*                                                                       */\r\n  /*                  Bits 3 and~4 are reserved for internal purposes.     */\r\n  /*                                                                       */\r\n  /*    contours   :: An array of `n_contours' shorts, giving the end      */\r\n  /*                  point of each contour within the outline.  For       */\r\n  /*                  example, the first contour is defined by the points  */\r\n  /*                  `0' to `contours[0]', the second one is defined by   */\r\n  /*                  the points `contours[0]+1' to `contours[1]', etc.    */\r\n  /*                                                                       */\r\n  /*    flags      :: A set of bit flags used to characterize the outline  */\r\n  /*                  and give hints to the scan-converter and hinter on   */\r\n  /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The B/W rasterizer only checks bit~2 in the `tags' array for the   */\r\n  /*    first point of each contour.  The drop-out mode as given with      */\r\n  /*    @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and       */\r\n  /*    @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden.           */\r\n  /*                                                                       */\r\n  typedef struct  FT_Outline_\r\n  {\r\n    short       n_contours;      /* number of contours in glyph        */\r\n    short       n_points;        /* number of points in the glyph      */\r\n\r\n    FT_Vector*  points;          /* the outline's points               */\r\n    char*       tags;            /* the points flags                   */\r\n    short*      contours;        /* the contour end points             */\r\n\r\n    int         flags;           /* outline masks                      */\r\n\r\n  } FT_Outline;\r\n\r\n  /* Following limits must be consistent with */\r\n  /* FT_Outline.{n_contours,n_points}         */\r\n#define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX\r\n#define FT_OUTLINE_POINTS_MAX    SHRT_MAX\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_OUTLINE_FLAGS                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit-field constants use for the flags in an outline's    */\r\n  /*    `flags' field.                                                     */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_OUTLINE_NONE ::                                                 */\r\n  /*      Value~0 is reserved.                                             */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_OWNER ::                                                */\r\n  /*      If set, this flag indicates that the outline's field arrays      */\r\n  /*      (i.e., `points', `flags', and `contours') are `owned' by the     */\r\n  /*      outline object, and should thus be freed when it is destroyed.   */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_EVEN_ODD_FILL ::                                        */\r\n  /*      By default, outlines are filled using the non-zero winding rule. */\r\n  /*      If set to 1, the outline will be filled using the even-odd fill  */\r\n  /*      rule (only works with the smooth rasterizer).                    */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_REVERSE_FILL ::                                         */\r\n  /*      By default, outside contours of an outline are oriented in       */\r\n  /*      clock-wise direction, as defined in the TrueType specification.  */\r\n  /*      This flag is set if the outline uses the opposite direction      */\r\n  /*      (typically for Type~1 fonts).  This flag is ignored by the scan  */\r\n  /*      converter.                                                       */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_IGNORE_DROPOUTS ::                                      */\r\n  /*      By default, the scan converter will try to detect drop-outs in   */\r\n  /*      an outline and correct the glyph bitmap to ensure consistent     */\r\n  /*      shape continuity.  If set, this flag hints the scan-line         */\r\n  /*      converter to ignore such cases.  See below for more information. */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_SMART_DROPOUTS ::                                       */\r\n  /*      Select smart dropout control.  If unset, use simple dropout      */\r\n  /*      control.  Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See    */\r\n  /*      below for more information.                                      */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_INCLUDE_STUBS ::                                        */\r\n  /*      If set, turn pixels on for `stubs', otherwise exclude them.      */\r\n  /*      Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See below for    */\r\n  /*      more information.                                                */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_HIGH_PRECISION ::                                       */\r\n  /*      This flag indicates that the scan-line converter should try to   */\r\n  /*      convert this outline to bitmaps with the highest possible        */\r\n  /*      quality.  It is typically set for small character sizes.  Note   */\r\n  /*      that this is only a hint that might be completely ignored by a   */\r\n  /*      given scan-converter.                                            */\r\n  /*                                                                       */\r\n  /*    FT_OUTLINE_SINGLE_PASS ::                                          */\r\n  /*      This flag is set to force a given scan-converter to only use a   */\r\n  /*      single pass over the outline to render a bitmap glyph image.     */\r\n  /*      Normally, it is set for very large character sizes.  It is only  */\r\n  /*      a hint that might be completely ignored by a given               */\r\n  /*      scan-converter.                                                  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */\r\n  /*    and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth            */\r\n  /*    rasterizer.                                                        */\r\n  /*                                                                       */\r\n  /*    There exists a second mechanism to pass the drop-out mode to the   */\r\n  /*    B/W rasterizer; see the `tags' field in @FT_Outline.               */\r\n  /*                                                                       */\r\n  /*    Please refer to the description of the `SCANTYPE' instruction in   */\r\n  /*    the OpenType specification (in file `ttinst1.doc') how simple      */\r\n  /*    drop-outs, smart drop-outs, and stubs are defined.                 */\r\n  /*                                                                       */\r\n#define FT_OUTLINE_NONE             0x0\r\n#define FT_OUTLINE_OWNER            0x1\r\n#define FT_OUTLINE_EVEN_ODD_FILL    0x2\r\n#define FT_OUTLINE_REVERSE_FILL     0x4\r\n#define FT_OUTLINE_IGNORE_DROPOUTS  0x8\r\n#define FT_OUTLINE_SMART_DROPOUTS   0x10\r\n#define FT_OUTLINE_INCLUDE_STUBS    0x20\r\n\r\n#define FT_OUTLINE_HIGH_PRECISION   0x100\r\n#define FT_OUTLINE_SINGLE_PASS      0x200\r\n\r\n\r\n /*************************************************************************\r\n  *\r\n  * @enum:\r\n  *   ft_outline_flags\r\n  *\r\n  * @description:\r\n  *   These constants are deprecated.  Please use the corresponding\r\n  *   @FT_OUTLINE_FLAGS values.\r\n  *\r\n  * @values:\r\n  *   ft_outline_none            :: See @FT_OUTLINE_NONE.\r\n  *   ft_outline_owner           :: See @FT_OUTLINE_OWNER.\r\n  *   ft_outline_even_odd_fill   :: See @FT_OUTLINE_EVEN_ODD_FILL.\r\n  *   ft_outline_reverse_fill    :: See @FT_OUTLINE_REVERSE_FILL.\r\n  *   ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.\r\n  *   ft_outline_high_precision  :: See @FT_OUTLINE_HIGH_PRECISION.\r\n  *   ft_outline_single_pass     :: See @FT_OUTLINE_SINGLE_PASS.\r\n  */\r\n#define ft_outline_none             FT_OUTLINE_NONE\r\n#define ft_outline_owner            FT_OUTLINE_OWNER\r\n#define ft_outline_even_odd_fill    FT_OUTLINE_EVEN_ODD_FILL\r\n#define ft_outline_reverse_fill     FT_OUTLINE_REVERSE_FILL\r\n#define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS\r\n#define ft_outline_high_precision   FT_OUTLINE_HIGH_PRECISION\r\n#define ft_outline_single_pass      FT_OUTLINE_SINGLE_PASS\r\n\r\n  /* */\r\n\r\n#define FT_CURVE_TAG( flag )  ( flag & 3 )\r\n\r\n#define FT_CURVE_TAG_ON            1\r\n#define FT_CURVE_TAG_CONIC         0\r\n#define FT_CURVE_TAG_CUBIC         2\r\n\r\n#define FT_CURVE_TAG_HAS_SCANMODE  4\r\n\r\n#define FT_CURVE_TAG_TOUCH_X       8  /* reserved for the TrueType hinter */\r\n#define FT_CURVE_TAG_TOUCH_Y      16  /* reserved for the TrueType hinter */\r\n\r\n#define FT_CURVE_TAG_TOUCH_BOTH    ( FT_CURVE_TAG_TOUCH_X | \\\r\n                                     FT_CURVE_TAG_TOUCH_Y )\r\n\r\n#define FT_Curve_Tag_On       FT_CURVE_TAG_ON\r\n#define FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC\r\n#define FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC\r\n#define FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X\r\n#define FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_MoveToFunc                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `move  */\r\n  /*    to' function during outline walking/decomposition.                 */\r\n  /*                                                                       */\r\n  /*    A `move to' is emitted to start a new contour in an outline.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    to   :: A pointer to the target point of the `move to'.            */\r\n  /*                                                                       */\r\n  /*    user :: A typeless pointer which is passed from the caller of the  */\r\n  /*            decomposition function.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_MoveToFunc)( const FT_Vector*  to,\r\n                            void*             user );\r\n\r\n#define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_LineToFunc                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `line  */\r\n  /*    to' function during outline walking/decomposition.                 */\r\n  /*                                                                       */\r\n  /*    A `line to' is emitted to indicate a segment in the outline.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    to   :: A pointer to the target point of the `line to'.            */\r\n  /*                                                                       */\r\n  /*    user :: A typeless pointer which is passed from the caller of the  */\r\n  /*            decomposition function.                                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_LineToFunc)( const FT_Vector*  to,\r\n                            void*             user );\r\n\r\n#define FT_Outline_LineTo_Func  FT_Outline_LineToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_ConicToFunc                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `conic */\r\n  /*    to' function during outline walking or decomposition.              */\r\n  /*                                                                       */\r\n  /*    A `conic to' is emitted to indicate a second-order Bézier arc in   */\r\n  /*    the outline.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    control :: An intermediate control point between the last position */\r\n  /*               and the new target in `to'.                             */\r\n  /*                                                                       */\r\n  /*    to      :: A pointer to the target end point of the conic arc.     */\r\n  /*                                                                       */\r\n  /*    user    :: A typeless pointer which is passed from the caller of   */\r\n  /*               the decomposition function.                             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_ConicToFunc)( const FT_Vector*  control,\r\n                             const FT_Vector*  to,\r\n                             void*             user );\r\n\r\n#define FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Outline_CubicToFunc                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function pointer type used to describe the signature of a `cubic */\r\n  /*    to' function during outline walking or decomposition.              */\r\n  /*                                                                       */\r\n  /*    A `cubic to' is emitted to indicate a third-order Bézier arc.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    control1 :: A pointer to the first Bézier control point.           */\r\n  /*                                                                       */\r\n  /*    control2 :: A pointer to the second Bézier control point.          */\r\n  /*                                                                       */\r\n  /*    to       :: A pointer to the target end point.                     */\r\n  /*                                                                       */\r\n  /*    user     :: A typeless pointer which is passed from the caller of  */\r\n  /*                the decomposition function.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,\r\n                             const FT_Vector*  control2,\r\n                             const FT_Vector*  to,\r\n                             void*             user );\r\n\r\n#define FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Outline_Funcs                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure to hold various function pointers used during outline  */\r\n  /*    decomposition in order to emit segments, conic, and cubic Béziers. */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    move_to  :: The `move to' emitter.                                 */\r\n  /*                                                                       */\r\n  /*    line_to  :: The segment emitter.                                   */\r\n  /*                                                                       */\r\n  /*    conic_to :: The second-order Bézier arc emitter.                   */\r\n  /*                                                                       */\r\n  /*    cubic_to :: The third-order Bézier arc emitter.                    */\r\n  /*                                                                       */\r\n  /*    shift    :: The shift that is applied to coordinates before they   */\r\n  /*                are sent to the emitter.                               */\r\n  /*                                                                       */\r\n  /*    delta    :: The delta that is applied to coordinates before they   */\r\n  /*                are sent to the emitter, but after the shift.          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The point coordinates sent to the emitters are the transformed     */\r\n  /*    version of the original coordinates (this is important for high    */\r\n  /*    accuracy during scan-conversion).  The transformation is simple:   */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      x' = (x << shift) - delta                                        */\r\n  /*      y' = (x << shift) - delta                                        */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    Set the values of `shift' and `delta' to~0 to get the original     */\r\n  /*    point coordinates.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_Outline_Funcs_\r\n  {\r\n    FT_Outline_MoveToFunc   move_to;\r\n    FT_Outline_LineToFunc   line_to;\r\n    FT_Outline_ConicToFunc  conic_to;\r\n    FT_Outline_CubicToFunc  cubic_to;\r\n\r\n    int                     shift;\r\n    FT_Pos                  delta;\r\n\r\n  } FT_Outline_Funcs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_IMAGE_TAG                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro converts four-letter tags to an unsigned long type.     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */\r\n  /*    should redefine this macro in case of problems to something like   */\r\n  /*    this:                                                              */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  value         */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  /*    to get a simple enumeration without assigning special numbers.     */\r\n  /*                                                                       */\r\n#ifndef FT_IMAGE_TAG\r\n#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  \\\r\n          value = ( ( (unsigned long)_x1 << 24 ) | \\\r\n                    ( (unsigned long)_x2 << 16 ) | \\\r\n                    ( (unsigned long)_x3 << 8  ) | \\\r\n                      (unsigned long)_x4         )\r\n#endif /* FT_IMAGE_TAG */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Glyph_Format                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration type used to describe the format of a given glyph   */\r\n  /*    image.  Note that this version of FreeType only supports two image */\r\n  /*    formats, even though future font drivers will be able to register  */\r\n  /*    their own format.                                                  */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_GLYPH_FORMAT_NONE ::                                            */\r\n  /*      The value~0 is reserved.                                         */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */\r\n  /*      The glyph image is a composite of several other images.  This    */\r\n  /*      format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to   */\r\n  /*      report compound glyphs (like accented characters).               */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_BITMAP ::                                          */\r\n  /*      The glyph image is a bitmap, and can be described as an          */\r\n  /*      @FT_Bitmap.  You generally need to access the `bitmap' field of  */\r\n  /*      the @FT_GlyphSlotRec structure to read it.                       */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_OUTLINE ::                                         */\r\n  /*      The glyph image is a vectorial outline made of line segments     */\r\n  /*      and Bézier arcs; it can be described as an @FT_Outline; you      */\r\n  /*      generally want to access the `outline' field of the              */\r\n  /*      @FT_GlyphSlotRec structure to read it.                           */\r\n  /*                                                                       */\r\n  /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */\r\n  /*      The glyph image is a vectorial path with no inside and outside   */\r\n  /*      contours.  Some Type~1 fonts, like those in the Hershey family,  */\r\n  /*      contain glyphs in this format.  These are described as           */\r\n  /*      @FT_Outline, but FreeType isn't currently capable of rendering   */\r\n  /*      them correctly.                                                  */\r\n  /*                                                                       */\r\n  typedef enum  FT_Glyph_Format_\r\n  {\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),\r\n\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP,    'b', 'i', 't', 's' ),\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE,   'o', 'u', 't', 'l' ),\r\n    FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' )\r\n\r\n  } FT_Glyph_Format;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    ft_glyph_format_xxx                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of deprecated constants.  Use the corresponding             */\r\n  /*    @FT_Glyph_Format values instead.                                   */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    ft_glyph_format_none      :: See @FT_GLYPH_FORMAT_NONE.            */\r\n  /*    ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE.       */\r\n  /*    ft_glyph_format_bitmap    :: See @FT_GLYPH_FORMAT_BITMAP.          */\r\n  /*    ft_glyph_format_outline   :: See @FT_GLYPH_FORMAT_OUTLINE.         */\r\n  /*    ft_glyph_format_plotter   :: See @FT_GLYPH_FORMAT_PLOTTER.         */\r\n  /*                                                                       */\r\n#define ft_glyph_format_none       FT_GLYPH_FORMAT_NONE\r\n#define ft_glyph_format_composite  FT_GLYPH_FORMAT_COMPOSITE\r\n#define ft_glyph_format_bitmap     FT_GLYPH_FORMAT_BITMAP\r\n#define ft_glyph_format_outline    FT_GLYPH_FORMAT_OUTLINE\r\n#define ft_glyph_format_plotter    FT_GLYPH_FORMAT_PLOTTER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****            R A S T E R   D E F I N I T I O N S                *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A raster is a scan converter, in charge of rendering an outline into  */\r\n  /* a a bitmap.  This section contains the public API for rasters.        */\r\n  /*                                                                       */\r\n  /* Note that in FreeType 2, all rasters are now encapsulated within      */\r\n  /* specific modules called `renderers'.  See `freetype/ftrender.h' for   */\r\n  /* more details on renderers.                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    raster                                                             */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Scanline Converter                                                 */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How vectorial outlines are converted into bitmaps and pixmaps.     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains technical definitions.                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Raster                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle (pointer) to a raster object.  Each object can be used    */\r\n  /*    independently to convert an outline into a bitmap or pixmap.       */\r\n  /*                                                                       */\r\n  typedef struct FT_RasterRec_*  FT_Raster;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Span                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a single span of gray (or black) pixels  */\r\n  /*    when rendering a monochrome or anti-aliased bitmap.                */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x        :: The span's horizontal start position.                  */\r\n  /*                                                                       */\r\n  /*    len      :: The span's length in pixels.                           */\r\n  /*                                                                       */\r\n  /*    coverage :: The span color/coverage, ranging from 0 (background)   */\r\n  /*                to 255 (foreground).  Only used for anti-aliased       */\r\n  /*                rendering.                                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This structure is used by the span drawing callback type named     */\r\n  /*    @FT_SpanFunc which takes the y~coordinate of the span as a         */\r\n  /*    a parameter.                                                       */\r\n  /*                                                                       */\r\n  /*    The coverage value is always between 0 and 255.  If you want less  */\r\n  /*    gray values, the callback function has to reduce them.             */\r\n  /*                                                                       */\r\n  typedef struct  FT_Span_\r\n  {\r\n    short           x;\r\n    unsigned short  len;\r\n    unsigned char   coverage;\r\n\r\n  } FT_Span;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_SpanFunc                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used as a call-back by the anti-aliased renderer in     */\r\n  /*    order to let client applications draw themselves the gray pixel    */\r\n  /*    spans on each scan line.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y     :: The scanline's y~coordinate.                              */\r\n  /*                                                                       */\r\n  /*    count :: The number of spans to draw on this scanline.             */\r\n  /*                                                                       */\r\n  /*    spans :: A table of `count' spans to draw on the scanline.         */\r\n  /*                                                                       */\r\n  /*    user  :: User-supplied data that is passed to the callback.        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This callback allows client applications to directly render the    */\r\n  /*    gray spans of the anti-aliased bitmap to any kind of surfaces.     */\r\n  /*                                                                       */\r\n  /*    This can be used to write anti-aliased outlines directly to a      */\r\n  /*    given background bitmap, and even perform translucency.            */\r\n  /*                                                                       */\r\n  /*    Note that the `count' field cannot be greater than a fixed value   */\r\n  /*    defined by the `FT_MAX_GRAY_SPANS' configuration macro in          */\r\n  /*    `ftoption.h'.  By default, this value is set to~32, which means    */\r\n  /*    that if there are more than 32~spans on a given scanline, the      */\r\n  /*    callback is called several times with the same `y' parameter in    */\r\n  /*    order to draw all callbacks.                                       */\r\n  /*                                                                       */\r\n  /*    Otherwise, the callback is only called once per scan-line, and     */\r\n  /*    only for those scanlines that do have `gray' pixels on them.       */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_SpanFunc)( int             y,\r\n                  int             count,\r\n                  const FT_Span*  spans,\r\n                  void*           user );\r\n\r\n#define FT_Raster_Span_Func  FT_SpanFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_BitTest_Func                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */\r\n  /*                                                                       */\r\n  /*    A function used as a call-back by the monochrome scan-converter    */\r\n  /*    to test whether a given target pixel is already set to the drawing */\r\n  /*    `color'.  These tests are crucial to implement drop-out control    */\r\n  /*    per-se the TrueType spec.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y     :: The pixel's y~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    x     :: The pixel's x~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    user  :: User-supplied data that is passed to the callback.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   1~if the pixel is `set', 0~otherwise.                               */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_BitTest_Func)( int    y,\r\n                             int    x,\r\n                             void*  user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_BitSet_Func                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT.                           */\r\n  /*                                                                       */\r\n  /*    A function used as a call-back by the monochrome scan-converter    */\r\n  /*    to set an individual target pixel.  This is crucial to implement   */\r\n  /*    drop-out control according to the TrueType specification.          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    y     :: The pixel's y~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    x     :: The pixel's x~coordinate.                                 */\r\n  /*                                                                       */\r\n  /*    user  :: User-supplied data that is passed to the callback.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    1~if the pixel is `set', 0~otherwise.                              */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Raster_BitSet_Func)( int    y,\r\n                            int    x,\r\n                            void*  user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_RASTER_FLAG_XXX                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A list of bit flag constants as used in the `flags' field of a     */\r\n  /*    @FT_Raster_Params structure.                                       */\r\n  /*                                                                       */\r\n  /* <Values>                                                              */\r\n  /*    FT_RASTER_FLAG_DEFAULT :: This value is 0.                         */\r\n  /*                                                                       */\r\n  /*    FT_RASTER_FLAG_AA      :: This flag is set to indicate that an     */\r\n  /*                              anti-aliased glyph image should be       */\r\n  /*                              generated.  Otherwise, it will be        */\r\n  /*                              monochrome (1-bit).                      */\r\n  /*                                                                       */\r\n  /*    FT_RASTER_FLAG_DIRECT  :: This flag is set to indicate direct      */\r\n  /*                              rendering.  In this mode, client         */\r\n  /*                              applications must provide their own span */\r\n  /*                              callback.  This lets them directly       */\r\n  /*                              draw or compose over an existing bitmap. */\r\n  /*                              If this bit is not set, the target       */\r\n  /*                              pixmap's buffer _must_ be zeroed before  */\r\n  /*                              rendering.                               */\r\n  /*                                                                       */\r\n  /*                              Note that for now, direct rendering is   */\r\n  /*                              only possible with anti-aliased glyphs.  */\r\n  /*                                                                       */\r\n  /*    FT_RASTER_FLAG_CLIP    :: This flag is only used in direct         */\r\n  /*                              rendering mode.  If set, the output will */\r\n  /*                              be clipped to a box specified in the     */\r\n  /*                              `clip_box' field of the                  */\r\n  /*                              @FT_Raster_Params structure.             */\r\n  /*                                                                       */\r\n  /*                              Note that by default, the glyph bitmap   */\r\n  /*                              is clipped to the target pixmap, except  */\r\n  /*                              in direct rendering mode where all spans */\r\n  /*                              are generated if no clipping box is set. */\r\n  /*                                                                       */\r\n#define FT_RASTER_FLAG_DEFAULT  0x0\r\n#define FT_RASTER_FLAG_AA       0x1\r\n#define FT_RASTER_FLAG_DIRECT   0x2\r\n#define FT_RASTER_FLAG_CLIP     0x4\r\n\r\n  /* deprecated */\r\n#define ft_raster_flag_default  FT_RASTER_FLAG_DEFAULT\r\n#define ft_raster_flag_aa       FT_RASTER_FLAG_AA\r\n#define ft_raster_flag_direct   FT_RASTER_FLAG_DIRECT\r\n#define ft_raster_flag_clip     FT_RASTER_FLAG_CLIP\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Raster_Params                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure to hold the arguments used by a raster's render        */\r\n  /*    function.                                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    target      :: The target bitmap.                                  */\r\n  /*                                                                       */\r\n  /*    source      :: A pointer to the source glyph image (e.g., an       */\r\n  /*                   @FT_Outline).                                       */\r\n  /*                                                                       */\r\n  /*    flags       :: The rendering flags.                                */\r\n  /*                                                                       */\r\n  /*    gray_spans  :: The gray span drawing callback.                     */\r\n  /*                                                                       */\r\n  /*    black_spans :: The black span drawing callback.  UNIMPLEMENTED!    */\r\n  /*                                                                       */\r\n  /*    bit_test    :: The bit test callback.  UNIMPLEMENTED!              */\r\n  /*                                                                       */\r\n  /*    bit_set     :: The bit set callback.  UNIMPLEMENTED!               */\r\n  /*                                                                       */\r\n  /*    user        :: User-supplied data that is passed to each drawing   */\r\n  /*                   callback.                                           */\r\n  /*                                                                       */\r\n  /*    clip_box    :: An optional clipping box.  It is only used in       */\r\n  /*                   direct rendering mode.  Note that coordinates here  */\r\n  /*                   should be expressed in _integer_ pixels (and not in */\r\n  /*                   26.6 fixed-point units).                            */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA    */\r\n  /*    bit flag is set in the `flags' field, otherwise a monochrome       */\r\n  /*    bitmap is generated.                                               */\r\n  /*                                                                       */\r\n  /*    If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the      */\r\n  /*    raster will call the `gray_spans' callback to draw gray pixel      */\r\n  /*    spans, in the case of an aa glyph bitmap, it will call             */\r\n  /*    `black_spans', and `bit_test' and `bit_set' in the case of a       */\r\n  /*    monochrome bitmap.  This allows direct composition over a          */\r\n  /*    pre-existing bitmap through user-provided callbacks to perform the */\r\n  /*    span drawing/composition.                                          */\r\n  /*                                                                       */\r\n  /*    Note that the `bit_test' and `bit_set' callbacks are required when */\r\n  /*    rendering a monochrome bitmap, as they are crucial to implement    */\r\n  /*    correct drop-out control as defined in the TrueType specification. */\r\n  /*                                                                       */\r\n  typedef struct  FT_Raster_Params_\r\n  {\r\n    const FT_Bitmap*        target;\r\n    const void*             source;\r\n    int                     flags;\r\n    FT_SpanFunc             gray_spans;\r\n    FT_SpanFunc             black_spans;  /* doesn't work! */\r\n    FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */\r\n    FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */\r\n    void*                   user;\r\n    FT_BBox                 clip_box;\r\n\r\n  } FT_Raster_Params;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_NewFunc                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to create a new raster object.                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the memory allocator.                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    raster :: A handle to the new raster object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `memory' parameter is a typeless pointer in order to avoid     */\r\n  /*    un-wanted dependencies on the rest of the FreeType code.  In       */\r\n  /*    practice, it is an @FT_Memory object, i.e., a handle to the        */\r\n  /*    standard FreeType memory allocator.  However, this field can be    */\r\n  /*    completely ignored by a given raster implementation.               */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_NewFunc)( void*       memory,\r\n                        FT_Raster*  raster );\r\n\r\n#define FT_Raster_New_Func  FT_Raster_NewFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_DoneFunc                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to destroy a given raster object.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster :: A handle to the raster object.                           */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Raster_DoneFunc)( FT_Raster  raster );\r\n\r\n#define FT_Raster_Done_Func  FT_Raster_DoneFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_ResetFunc                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    FreeType provides an area of memory called the `render pool',      */\r\n  /*    available to all registered rasters.  This pool can be freely used */\r\n  /*    during a given scan-conversion but is shared by all rasters.  Its  */\r\n  /*    content is thus transient.                                         */\r\n  /*                                                                       */\r\n  /*    This function is called each time the render pool changes, or just */\r\n  /*    after a new raster object is created.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster    :: A handle to the new raster object.                    */\r\n  /*                                                                       */\r\n  /*    pool_base :: The address in memory of the render pool.             */\r\n  /*                                                                       */\r\n  /*    pool_size :: The size in bytes of the render pool.                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Rasters can ignore the render pool and rely on dynamic memory      */\r\n  /*    allocation if they want to (a handle to the memory allocator is    */\r\n  /*    passed to the raster constructor).  However, this is not           */\r\n  /*    recommended for efficiency purposes.                               */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Raster_ResetFunc)( FT_Raster       raster,\r\n                          unsigned char*  pool_base,\r\n                          unsigned long   pool_size );\r\n\r\n#define FT_Raster_Reset_Func  FT_Raster_ResetFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_SetModeFunc                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is a generic facility to change modes or attributes  */\r\n  /*    in a given raster.  This can be used for debugging purposes, or    */\r\n  /*    simply to allow implementation-specific `features' in a given      */\r\n  /*    raster module.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster :: A handle to the new raster object.                       */\r\n  /*                                                                       */\r\n  /*    mode   :: A 4-byte tag used to name the mode or property.          */\r\n  /*                                                                       */\r\n  /*    args   :: A pointer to the new mode/property to use.               */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_SetModeFunc)( FT_Raster      raster,\r\n                            unsigned long  mode,\r\n                            void*          args );\r\n\r\n#define FT_Raster_Set_Mode_Func  FT_Raster_SetModeFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Raster_RenderFunc                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Invoke a given raster to scan-convert a given glyph image into a   */\r\n  /*    target bitmap.                                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    raster :: A handle to the raster object.                           */\r\n  /*                                                                       */\r\n  /*    params :: A pointer to an @FT_Raster_Params structure used to      */\r\n  /*              store the rendering parameters.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    Error code.  0~means success.                                      */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The exact format of the source image depends on the raster's glyph */\r\n  /*    format defined in its @FT_Raster_Funcs structure.  It can be an    */\r\n  /*    @FT_Outline or anything else in order to support a large array of  */\r\n  /*    glyph formats.                                                     */\r\n  /*                                                                       */\r\n  /*    Note also that the render function can fail and return a           */\r\n  /*    `FT_Err_Unimplemented_Feature' error code if the raster used does  */\r\n  /*    not support direct composition.                                    */\r\n  /*                                                                       */\r\n  /*    XXX: For now, the standard raster doesn't support direct           */\r\n  /*         composition but this should change for the final release (see */\r\n  /*         the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c'    */\r\n  /*         for examples of distinct implementations which support direct */\r\n  /*         composition).                                                 */\r\n  /*                                                                       */\r\n  typedef int\r\n  (*FT_Raster_RenderFunc)( FT_Raster                raster,\r\n                           const FT_Raster_Params*  params );\r\n\r\n#define FT_Raster_Render_Func  FT_Raster_RenderFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Raster_Funcs                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   A structure used to describe a given raster class to the library.   */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    glyph_format  :: The supported glyph format for this raster.       */\r\n  /*                                                                       */\r\n  /*    raster_new    :: The raster constructor.                           */\r\n  /*                                                                       */\r\n  /*    raster_reset  :: Used to reset the render pool within the raster.  */\r\n  /*                                                                       */\r\n  /*    raster_render :: A function to render a glyph into a given bitmap. */\r\n  /*                                                                       */\r\n  /*    raster_done   :: The raster destructor.                            */\r\n  /*                                                                       */\r\n  typedef struct  FT_Raster_Funcs_\r\n  {\r\n    FT_Glyph_Format        glyph_format;\r\n    FT_Raster_NewFunc      raster_new;\r\n    FT_Raster_ResetFunc    raster_reset;\r\n    FT_Raster_SetModeFunc  raster_set_mode;\r\n    FT_Raster_RenderFunc   raster_render;\r\n    FT_Raster_DoneFunc     raster_done;\r\n\r\n  } FT_Raster_Funcs;\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTIMAGE_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftincrem.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftincrem.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType incremental loading (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2006, 2007, 2008, 2010 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTINCREM_H__\r\n#define __FTINCREM_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @section:\r\n   *    incremental\r\n   *\r\n   * @title:\r\n   *    Incremental Loading\r\n   *\r\n   * @abstract:\r\n   *    Custom Glyph Loading.\r\n   *\r\n   * @description:\r\n   *   This section contains various functions used to perform so-called\r\n   *   `incremental' glyph loading.  This is a mode where all glyphs loaded\r\n   *   from a given @FT_Face are provided by the client application,\r\n   *\r\n   *   Apart from that, all other tables are loaded normally from the font\r\n   *   file.  This mode is useful when FreeType is used within another\r\n   *   engine, e.g., a PostScript Imaging Processor.\r\n   *\r\n   *   To enable this mode, you must use @FT_Open_Face, passing an\r\n   *   @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an\r\n   *   @FT_Incremental_Interface value.  See the comments for\r\n   *   @FT_Incremental_InterfaceRec for an example.\r\n   *\r\n   */\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental\r\n   *\r\n   * @description:\r\n   *   An opaque type describing a user-provided object used to implement\r\n   *   `incremental' glyph loading within FreeType.  This is used to support\r\n   *   embedded fonts in certain environments (e.g., PostScript interpreters),\r\n   *   where the glyph data isn't in the font file, or must be overridden by\r\n   *   different values.\r\n   *\r\n   * @note:\r\n   *   It is up to client applications to create and implement @FT_Incremental\r\n   *   objects, as long as they provide implementations for the methods\r\n   *   @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc\r\n   *   and @FT_Incremental_GetGlyphMetricsFunc.\r\n   *\r\n   *   See the description of @FT_Incremental_InterfaceRec to understand how\r\n   *   to use incremental objects with FreeType.\r\n   *\r\n   */\r\n  typedef struct FT_IncrementalRec_*  FT_Incremental;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_MetricsRec\r\n   *\r\n   * @description:\r\n   *   A small structure used to contain the basic glyph metrics returned\r\n   *   by the @FT_Incremental_GetGlyphMetricsFunc method.\r\n   *\r\n   * @fields:\r\n   *   bearing_x ::\r\n   *     Left bearing, in font units.\r\n   *\r\n   *   bearing_y ::\r\n   *     Top bearing, in font units.\r\n   *\r\n   *   advance ::\r\n   *     Horizontal component of glyph advance, in font units.\r\n   *\r\n   *   advance_v ::\r\n   *     Vertical component of glyph advance, in font units.\r\n   *\r\n   * @note:\r\n   *   These correspond to horizontal or vertical metrics depending on the\r\n   *   value of the `vertical' argument to the function\r\n   *   @FT_Incremental_GetGlyphMetricsFunc.\r\n   *\r\n   */\r\n  typedef struct  FT_Incremental_MetricsRec_\r\n  {\r\n    FT_Long  bearing_x;\r\n    FT_Long  bearing_y;\r\n    FT_Long  advance;\r\n    FT_Long  advance_v;     /* since 2.3.12 */\r\n\r\n  } FT_Incremental_MetricsRec;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_Metrics\r\n   *\r\n   * @description:\r\n   *   A handle to an @FT_Incremental_MetricsRec structure.\r\n   *\r\n   */\r\n   typedef struct FT_Incremental_MetricsRec_*  FT_Incremental_Metrics;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_GetGlyphDataFunc\r\n   *\r\n   * @description:\r\n   *   A function called by FreeType to access a given glyph's data bytes\r\n   *   during @FT_Load_Glyph or @FT_Load_Char if incremental loading is\r\n   *   enabled.\r\n   *\r\n   *   Note that the format of the glyph's data bytes depends on the font\r\n   *   file format.  For TrueType, it must correspond to the raw bytes within\r\n   *   the `glyf' table.  For PostScript formats, it must correspond to the\r\n   *   *unencrypted* charstring bytes, without any `lenIV' header.  It is\r\n   *   undefined for any other format.\r\n   *\r\n   * @input:\r\n   *   incremental ::\r\n   *     Handle to an opaque @FT_Incremental handle provided by the client\r\n   *     application.\r\n   *\r\n   *   glyph_index ::\r\n   *     Index of relevant glyph.\r\n   *\r\n   * @output:\r\n   *   adata ::\r\n   *     A structure describing the returned glyph data bytes (which will be\r\n   *     accessed as a read-only byte block).\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   If this function returns successfully the method\r\n   *   @FT_Incremental_FreeGlyphDataFunc will be called later to release\r\n   *   the data bytes.\r\n   *\r\n   *   Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for\r\n   *   compound glyphs.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental  incremental,\r\n                                      FT_UInt         glyph_index,\r\n                                      FT_Data*        adata );\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_FreeGlyphDataFunc\r\n   *\r\n   * @description:\r\n   *   A function used to release the glyph data bytes returned by a\r\n   *   successful call to @FT_Incremental_GetGlyphDataFunc.\r\n   *\r\n   * @input:\r\n   *   incremental ::\r\n   *     A handle to an opaque @FT_Incremental handle provided by the client\r\n   *     application.\r\n   *\r\n   *   data ::\r\n   *     A structure describing the glyph data bytes (which will be accessed\r\n   *     as a read-only byte block).\r\n   *\r\n   */\r\n  typedef void\r\n  (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental  incremental,\r\n                                       FT_Data*        data );\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_GetGlyphMetricsFunc\r\n   *\r\n   * @description:\r\n   *   A function used to retrieve the basic metrics of a given glyph index\r\n   *   before accessing its data.  This is necessary because, in certain\r\n   *   formats like TrueType, the metrics are stored in a different place from\r\n   *   the glyph images proper.\r\n   *\r\n   * @input:\r\n   *   incremental ::\r\n   *     A handle to an opaque @FT_Incremental handle provided by the client\r\n   *     application.\r\n   *\r\n   *   glyph_index ::\r\n   *     Index of relevant glyph.\r\n   *\r\n   *   vertical ::\r\n   *     If true, return vertical metrics.\r\n   *\r\n   *   ametrics ::\r\n   *     This parameter is used for both input and output.\r\n   *     The original glyph metrics, if any, in font units.  If metrics are\r\n   *     not available all the values must be set to zero.\r\n   *\r\n   * @output:\r\n   *   ametrics ::\r\n   *     The replacement glyph metrics in font units.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*FT_Incremental_GetGlyphMetricsFunc)\r\n                      ( FT_Incremental              incremental,\r\n                        FT_UInt                     glyph_index,\r\n                        FT_Bool                     vertical,\r\n                        FT_Incremental_MetricsRec  *ametrics );\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_FuncsRec\r\n   *\r\n   * @description:\r\n   *   A table of functions for accessing fonts that load data\r\n   *   incrementally.  Used in @FT_Incremental_InterfaceRec.\r\n   *\r\n   * @fields:\r\n   *   get_glyph_data ::\r\n   *     The function to get glyph data.  Must not be null.\r\n   *\r\n   *   free_glyph_data ::\r\n   *     The function to release glyph data.  Must not be null.\r\n   *\r\n   *   get_glyph_metrics ::\r\n   *     The function to get glyph metrics.  May be null if the font does\r\n   *     not provide overriding glyph metrics.\r\n   *\r\n   */\r\n  typedef struct  FT_Incremental_FuncsRec_\r\n  {\r\n    FT_Incremental_GetGlyphDataFunc     get_glyph_data;\r\n    FT_Incremental_FreeGlyphDataFunc    free_glyph_data;\r\n    FT_Incremental_GetGlyphMetricsFunc  get_glyph_metrics;\r\n\r\n  } FT_Incremental_FuncsRec;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_Incremental_InterfaceRec\r\n   *\r\n   * @description:\r\n   *   A structure to be used with @FT_Open_Face to indicate that the user\r\n   *   wants to support incremental glyph loading.  You should use it with\r\n   *   @FT_PARAM_TAG_INCREMENTAL as in the following example:\r\n   *\r\n   *     {\r\n   *       FT_Incremental_InterfaceRec  inc_int;\r\n   *       FT_Parameter                 parameter;\r\n   *       FT_Open_Args                 open_args;\r\n   *\r\n   *\r\n   *       // set up incremental descriptor\r\n   *       inc_int.funcs  = my_funcs;\r\n   *       inc_int.object = my_object;\r\n   *\r\n   *       // set up optional parameter\r\n   *       parameter.tag  = FT_PARAM_TAG_INCREMENTAL;\r\n   *       parameter.data = &inc_int;\r\n   *\r\n   *       // set up FT_Open_Args structure\r\n   *       open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;\r\n   *       open_args.pathname   = my_font_pathname;\r\n   *       open_args.num_params = 1;\r\n   *       open_args.params     = &parameter; // we use one optional argument\r\n   *\r\n   *       // open the font\r\n   *       error = FT_Open_Face( library, &open_args, index, &face );\r\n   *       ...\r\n   *     }\r\n   *\r\n   */\r\n  typedef struct  FT_Incremental_InterfaceRec_\r\n  {\r\n    const FT_Incremental_FuncsRec*  funcs;\r\n    FT_Incremental                  object;\r\n\r\n  } FT_Incremental_InterfaceRec;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Incremental_Interface\r\n   *\r\n   * @description:\r\n   *   A pointer to an @FT_Incremental_InterfaceRec structure.\r\n   *\r\n   */\r\n  typedef FT_Incremental_InterfaceRec*   FT_Incremental_Interface;\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @constant:\r\n   *   FT_PARAM_TAG_INCREMENTAL\r\n   *\r\n   * @description:\r\n   *   A constant used as the tag of @FT_Parameter structures to indicate\r\n   *   an incremental loading object to be used by FreeType.\r\n   *\r\n   */\r\n#define FT_PARAM_TAG_INCREMENTAL  FT_MAKE_TAG( 'i', 'n', 'c', 'r' )\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTINCREM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftlcdfil.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlcdfil.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for color filtering of subpixel bitmap glyphs           */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2006, 2007, 2008, 2010 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FT_LCD_FILTER_H__\r\n#define __FT_LCD_FILTER_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @section:\r\n   *   lcd_filtering\r\n   *\r\n   * @title:\r\n   *   LCD Filtering\r\n   *\r\n   * @abstract:\r\n   *   Reduce color fringes of LCD-optimized bitmaps.\r\n   *\r\n   * @description:\r\n   *   The @FT_Library_SetLcdFilter API can be used to specify a low-pass\r\n   *   filter which is then applied to LCD-optimized bitmaps generated\r\n   *   through @FT_Render_Glyph.  This is useful to reduce color fringes\r\n   *   which would occur with unfiltered rendering.\r\n   *\r\n   *   Note that no filter is active by default, and that this function is\r\n   *   *not* implemented in default builds of the library.  You need to\r\n   *   #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file\r\n   *   in order to activate it.\r\n   */\r\n\r\n\r\n  /****************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_LcdFilter\r\n   *\r\n   * @description:\r\n   *   A list of values to identify various types of LCD filters.\r\n   *\r\n   * @values:\r\n   *   FT_LCD_FILTER_NONE ::\r\n   *     Do not perform filtering.  When used with subpixel rendering, this\r\n   *     results in sometimes severe color fringes.\r\n   *\r\n   *   FT_LCD_FILTER_DEFAULT ::\r\n   *     The default filter reduces color fringes considerably, at the cost\r\n   *     of a slight blurriness in the output.\r\n   *\r\n   *   FT_LCD_FILTER_LIGHT ::\r\n   *     The light filter is a variant that produces less blurriness at the\r\n   *     cost of slightly more color fringes than the default one.  It might\r\n   *     be better, depending on taste, your monitor, or your personal vision.\r\n   *\r\n   *   FT_LCD_FILTER_LEGACY ::\r\n   *     This filter corresponds to the original libXft color filter.  It\r\n   *     provides high contrast output but can exhibit really bad color\r\n   *     fringes if glyphs are not extremely well hinted to the pixel grid.\r\n   *     In other words, it only works well if the TrueType bytecode\r\n   *     interpreter is enabled *and* high-quality hinted fonts are used.\r\n   *\r\n   *     This filter is only provided for comparison purposes, and might be\r\n   *     disabled or stay unsupported in the future.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n  typedef enum  FT_LcdFilter_\r\n  {\r\n    FT_LCD_FILTER_NONE    = 0,\r\n    FT_LCD_FILTER_DEFAULT = 1,\r\n    FT_LCD_FILTER_LIGHT   = 2,\r\n    FT_LCD_FILTER_LEGACY  = 16,\r\n\r\n    FT_LCD_FILTER_MAX   /* do not remove */\r\n\r\n  } FT_LcdFilter;\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Library_SetLcdFilter\r\n   *\r\n   * @description:\r\n   *   This function is used to apply color filtering to LCD decimated\r\n   *   bitmaps, like the ones used when calling @FT_Render_Glyph with\r\n   *   @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.\r\n   *\r\n   * @input:\r\n   *   library ::\r\n   *     A handle to the target library instance.\r\n   *\r\n   *   filter ::\r\n   *     The filter type.\r\n   *\r\n   *     You can use @FT_LCD_FILTER_NONE here to disable this feature, or\r\n   *     @FT_LCD_FILTER_DEFAULT to use a default filter that should work\r\n   *     well on most LCD screens.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   This feature is always disabled by default.  Clients must make an\r\n   *   explicit call to this function with a `filter' value other than\r\n   *   @FT_LCD_FILTER_NONE in order to enable it.\r\n   *\r\n   *   Due to *PATENTS* covering subpixel rendering, this function doesn't\r\n   *   do anything except returning `FT_Err_Unimplemented_Feature' if the\r\n   *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not\r\n   *   defined in your build of the library, which should correspond to all\r\n   *   default builds of FreeType.\r\n   *\r\n   *   The filter affects glyph bitmaps rendered through @FT_Render_Glyph,\r\n   *   @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char.\r\n   *\r\n   *   It does _not_ affect the output of @FT_Outline_Render and\r\n   *   @FT_Outline_Get_Bitmap.\r\n   *\r\n   *   If this feature is activated, the dimensions of LCD glyph bitmaps are\r\n   *   either larger or taller than the dimensions of the corresponding\r\n   *   outline with regards to the pixel grid.  For example, for\r\n   *   @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and\r\n   *   up to 3~pixels to the right.\r\n   *\r\n   *   The bitmap offset values are adjusted correctly, so clients shouldn't\r\n   *   need to modify their layout and glyph positioning code when enabling\r\n   *   the filter.\r\n   *\r\n   * @since:\r\n   *   2.3.0\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Library_SetLcdFilter( FT_Library    library,\r\n                           FT_LcdFilter  filter );\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @func:\r\n   *   FT_Library_SetLcdFilterWeights\r\n   *\r\n   * @description:\r\n   *   Use this function to override the filter weights selected by\r\n   *   @FT_Library_SetLcdFilter.  By default, FreeType uses the quintuple\r\n   *   (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10,\r\n   *   0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and\r\n   *   FT_LCD_FILTER_LEGACY.\r\n   *\r\n   * @input:\r\n   *   library ::\r\n   *     A handle to the target library instance.\r\n   *\r\n   *   weights ::\r\n   *     A pointer to an array; the function copies the first five bytes and\r\n   *     uses them to specify the filter weights.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   Due to *PATENTS* covering subpixel rendering, this function doesn't\r\n   *   do anything except returning `FT_Err_Unimplemented_Feature' if the\r\n   *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not\r\n   *   defined in your build of the library, which should correspond to all\r\n   *   default builds of FreeType.\r\n   *\r\n   *   This function must be called after @FT_Library_SetLcdFilter to have\r\n   *   any effect.\r\n   *\r\n   * @since:\r\n   *   2.4.0\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Library_SetLcdFilterWeights( FT_Library      library,\r\n                                  unsigned char  *weights );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FT_LCD_FILTER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftlist.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlist.h                                                               */\r\n/*                                                                         */\r\n/*    Generic list support for FreeType (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2007, 2010 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  This file implements functions relative to list processing.  Its     */\r\n  /*  data structures are defined in `freetype.h'.                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTLIST_H__\r\n#define __FTLIST_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    list_processing                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    List Processing                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Simple management of lists.                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains various definitions related to list          */\r\n  /*    processing using doubly-linked nodes.                              */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_List                                                            */\r\n  /*    FT_ListNode                                                        */\r\n  /*    FT_ListRec                                                         */\r\n  /*    FT_ListNodeRec                                                     */\r\n  /*                                                                       */\r\n  /*    FT_List_Add                                                        */\r\n  /*    FT_List_Insert                                                     */\r\n  /*    FT_List_Find                                                       */\r\n  /*    FT_List_Remove                                                     */\r\n  /*    FT_List_Up                                                         */\r\n  /*    FT_List_Iterate                                                    */\r\n  /*    FT_List_Iterator                                                   */\r\n  /*    FT_List_Finalize                                                   */\r\n  /*    FT_List_Destructor                                                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Find                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Find the list node for a given listed object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*    data :: The address of the listed object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    List node.  NULL if it wasn't found.                               */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ListNode )\r\n  FT_List_Find( FT_List  list,\r\n                void*    data );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Add                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Append an element to the end of a list.                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*    node :: The node to append.                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Add( FT_List      list,\r\n               FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Insert                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Insert an element at the head of a list.                           */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to parent list.                                  */\r\n  /*    node :: The node to insert.                                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Insert( FT_List      list,\r\n                  FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Remove                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Remove a node from a list.  This function doesn't check whether    */\r\n  /*    the node is in the list!                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    node :: The node to remove.                                        */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Remove( FT_List      list,\r\n                  FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Up                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Move a node to the head/top of a list.  Used to maintain LRU       */\r\n  /*    lists.                                                             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    list :: A pointer to the parent list.                              */\r\n  /*    node :: The node to move.                                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Up( FT_List      list,\r\n              FT_ListNode  node );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_List_Iterator                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An FT_List iterator function which is called during a list parse   */\r\n  /*    by @FT_List_Iterate.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    node :: The current iteration list node.                           */\r\n  /*                                                                       */\r\n  /*    user :: A typeless pointer passed to @FT_List_Iterate.             */\r\n  /*            Can be used to point to the iteration's state.             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_List_Iterator)( FT_ListNode  node,\r\n                       void*        user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Iterate                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Parse a list and calls a given iterator function on each element.  */\r\n  /*    Note that parsing is stopped as soon as one of the iterator calls  */\r\n  /*    returns a non-zero value.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    list     :: A handle to the list.                                  */\r\n  /*    iterator :: An iterator function, called on each node of the list. */\r\n  /*    user     :: A user-supplied field which is passed as the second    */\r\n  /*                argument to the iterator.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result (a FreeType error code) of the last iterator call.      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_List_Iterate( FT_List           list,\r\n                   FT_List_Iterator  iterator,\r\n                   void*             user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_List_Destructor                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An @FT_List iterator function which is called during a list        */\r\n  /*    finalization by @FT_List_Finalize to destroy all elements in a     */\r\n  /*    given list.                                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    system :: The current system object.                               */\r\n  /*                                                                       */\r\n  /*    data   :: The current object to destroy.                           */\r\n  /*                                                                       */\r\n  /*    user   :: A typeless pointer passed to @FT_List_Iterate.  It can   */\r\n  /*              be used to point to the iteration's state.               */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_List_Destructor)( FT_Memory  memory,\r\n                         void*      data,\r\n                         void*      user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_List_Finalize                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy all elements in the list as well as the list itself.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    list    :: A handle to the list.                                   */\r\n  /*                                                                       */\r\n  /*    destroy :: A list destructor that will be applied to each element  */\r\n  /*               of the list.                                            */\r\n  /*                                                                       */\r\n  /*    memory  :: The current memory object which handles deallocation.   */\r\n  /*                                                                       */\r\n  /*    user    :: A user-supplied field which is passed as the last       */\r\n  /*               argument to the destructor.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function expects that all nodes added by @FT_List_Add or      */\r\n  /*    @FT_List_Insert have been dynamically allocated.                   */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_List_Finalize( FT_List             list,\r\n                    FT_List_Destructor  destroy,\r\n                    FT_Memory           memory,\r\n                    void*               user );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTLIST_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftlzw.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftlzw.h                                                                */\r\n/*                                                                         */\r\n/*    LZW-compressed stream support.                                       */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTLZW_H__\r\n#define __FTLZW_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    lzw                                                                */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    LZW Streams                                                        */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Using LZW-compressed font files.                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of LZW-specific functions.   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n /************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Stream_OpenLZW\r\n  *\r\n  * @description:\r\n  *   Open a new stream to parse LZW-compressed font files.  This is\r\n  *   mainly used to support the compressed `*.pcf.Z' fonts that come\r\n  *   with XFree86.\r\n  *\r\n  * @input:\r\n  *   stream :: The target embedding stream.\r\n  *\r\n  *   source :: The source stream.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   The source stream must be opened _before_ calling this function.\r\n  *\r\n  *   Calling the internal function `FT_Stream_Close' on the new stream will\r\n  *   *not* call `FT_Stream_Close' on the source stream.  None of the stream\r\n  *   objects will be released to the heap.\r\n  *\r\n  *   The stream implementation is very basic and resets the decompression\r\n  *   process each time seeking backwards is needed within the stream\r\n  *\r\n  *   In certain builds of the library, LZW compression recognition is\r\n  *   automatically handled when calling @FT_New_Face or @FT_Open_Face.\r\n  *   This means that if no font driver is capable of handling the raw\r\n  *   compressed file, the library will try to open a LZW stream from it\r\n  *   and re-open the face with it.\r\n  *\r\n  *   This function may return `FT_Err_Unimplemented_Feature' if your build\r\n  *   of FreeType was not compiled with LZW support.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stream_OpenLZW( FT_Stream  stream,\r\n                     FT_Stream  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTLZW_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftmac.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmac.h                                                                */\r\n/*                                                                         */\r\n/*    Additional Mac-specific API.                                         */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2004, 2006, 2007 by                               */\r\n/*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* NOTE: Include this file after <freetype/freetype.h> and after any       */\r\n/*       Mac-specific headers (because this header uses Mac types such as  */\r\n/*       Handle, FSSpec, FSRef, etc.)                                      */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMAC_H__\r\n#define __FTMAC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n/* gcc-3.4.1 and later can warn about functions tagged as deprecated */\r\n#ifndef FT_DEPRECATED_ATTRIBUTE\r\n#if defined(__GNUC__)                                               && \\\r\n    ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))\r\n#define FT_DEPRECATED_ATTRIBUTE  __attribute__((deprecated))\r\n#else\r\n#define FT_DEPRECATED_ATTRIBUTE\r\n#endif\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    mac_specific                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Mac Specific Interface                                             */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Only available on the Macintosh.                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The following definitions are only available if FreeType is        */\r\n  /*    compiled on a Macintosh.                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FOND                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new face object from a FOND resource.                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fond       :: A FOND resource.                                     */\r\n  /*                                                                       */\r\n  /*    face_index :: Only supported for the -1 `sanity check' special     */\r\n  /*                  case.                                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Notes>                                                               */\r\n  /*    This function can be used to create @FT_Face objects from fonts    */\r\n  /*    that are installed in the system as follows.                       */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      fond = GetResource( 'FOND', fontName );                          */\r\n  /*      error = FT_New_Face_From_FOND( library, fond, 0, &face );        */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face_From_FOND( FT_Library  library,\r\n                         Handle      fond,\r\n                         FT_Long     face_index,\r\n                         FT_Face    *aface )\r\n                       FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GetFile_From_Mac_Name                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return an FSSpec for the disk file containing the named font.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fontName   :: Mac OS name of the font (e.g., Times New Roman       */\r\n  /*                  Bold).                                               */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    pathSpec   :: FSSpec to the file.  For passing to                  */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /*    face_index :: Index of the face.  For passing to                   */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GetFile_From_Mac_Name( const char*  fontName,\r\n                            FSSpec*      pathSpec,\r\n                            FT_Long*     face_index )\r\n                          FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GetFile_From_Mac_ATS_Name                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return an FSSpec for the disk file containing the named font.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fontName   :: Mac OS name of the font in ATS framework.            */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    pathSpec   :: FSSpec to the file. For passing to                   */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /*    face_index :: Index of the face. For passing to                    */\r\n  /*                  @FT_New_Face_From_FSSpec.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GetFile_From_Mac_ATS_Name( const char*  fontName,\r\n                                FSSpec*      pathSpec,\r\n                                FT_Long*     face_index )\r\n                              FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_GetFilePath_From_Mac_ATS_Name                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a pathname of the disk file and face index for given font   */\r\n  /*    name which is handled by ATS framework.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    fontName    :: Mac OS name of the font in ATS framework.           */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    path        :: Buffer to store pathname of the file.  For passing  */\r\n  /*                   to @FT_New_Face.  The client must allocate this     */\r\n  /*                   buffer before calling this function.                */\r\n  /*                                                                       */\r\n  /*    maxPathSize :: Lengths of the buffer `path' that client allocated. */\r\n  /*                                                                       */\r\n  /*    face_index  :: Index of the face.  For passing to @FT_New_Face.    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_GetFilePath_From_Mac_ATS_Name( const char*  fontName,\r\n                                    UInt8*       path,\r\n                                    UInt32       maxPathSize,\r\n                                    FT_Long*     face_index )\r\n                                  FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FSSpec                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new face object from a given resource and typeface index  */\r\n  /*    using an FSSpec to the font file.                                  */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    spec       :: FSSpec to the font file.                             */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the resource.  The      */\r\n  /*                  first face has index~0.                              */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    @FT_New_Face_From_FSSpec is identical to @FT_New_Face except       */\r\n  /*    it accepts an FSSpec instead of a path.                            */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face_From_FSSpec( FT_Library     library,\r\n                           const FSSpec  *spec,\r\n                           FT_Long        face_index,\r\n                           FT_Face       *aface )\r\n                         FT_DEPRECATED_ATTRIBUTE;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Face_From_FSRef                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new face object from a given resource and typeface index  */\r\n  /*    using an FSRef to the font file.                                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library resource.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    spec       :: FSRef to the font file.                              */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the face within the resource.  The      */\r\n  /*                  first face has index~0.                              */\r\n  /* <Output>                                                              */\r\n  /*    aface      :: A handle to a new face object.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    @FT_New_Face_From_FSRef is identical to @FT_New_Face except        */\r\n  /*    it accepts an FSRef instead of a path.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Face_From_FSRef( FT_Library    library,\r\n                          const FSRef  *ref,\r\n                          FT_Long       face_index,\r\n                          FT_Face      *aface )\r\n                        FT_DEPRECATED_ATTRIBUTE;\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __FTMAC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftmm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmm.h                                                                 */\r\n/*                                                                         */\r\n/*    FreeType Multiple Master font interface (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2004, 2006, 2009 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMM_H__\r\n#define __FTMM_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TYPE1_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    multiple_masters                                                   */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Multiple Masters                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How to manage Multiple Masters fonts.                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The following types and functions are used to manage Multiple      */\r\n  /*    Master fonts, i.e., the selection of specific design instances by  */\r\n  /*    setting design axis coordinates.                                   */\r\n  /*                                                                       */\r\n  /*    George Williams has extended this interface to make it work with   */\r\n  /*    both Type~1 Multiple Masters fonts and GX distortable (var)        */\r\n  /*    fonts.  Some of these routines only work with MM fonts, others     */\r\n  /*    will work with both types.  They are similar enough that a         */\r\n  /*    consistent interface makes sense.                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_MM_Axis                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to model a given axis in design space for  */\r\n  /*    Multiple Masters fonts.                                            */\r\n  /*                                                                       */\r\n  /*    This structure can't be used for GX var fonts.                     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    name    :: The axis's name.                                        */\r\n  /*                                                                       */\r\n  /*    minimum :: The axis's minimum design coordinate.                   */\r\n  /*                                                                       */\r\n  /*    maximum :: The axis's maximum design coordinate.                   */\r\n  /*                                                                       */\r\n  typedef struct  FT_MM_Axis_\r\n  {\r\n    FT_String*  name;\r\n    FT_Long     minimum;\r\n    FT_Long     maximum;\r\n\r\n  } FT_MM_Axis;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Multi_Master                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the axes and space of a Multiple Masters */\r\n  /*    font.                                                              */\r\n  /*                                                                       */\r\n  /*    This structure can't be used for GX var fonts.                     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_axis    :: Number of axes.  Cannot exceed~4.                   */\r\n  /*                                                                       */\r\n  /*    num_designs :: Number of designs; should be normally 2^num_axis    */\r\n  /*                   even though the Type~1 specification strangely      */\r\n  /*                   allows for intermediate designs to be present. This */\r\n  /*                   number cannot exceed~16.                            */\r\n  /*                                                                       */\r\n  /*    axis        :: A table of axis descriptors.                        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Multi_Master_\r\n  {\r\n    FT_UInt     num_axis;\r\n    FT_UInt     num_designs;\r\n    FT_MM_Axis  axis[T1_MAX_MM_AXIS];\r\n\r\n  } FT_Multi_Master;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Var_Axis                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to model a given axis in design space for  */\r\n  /*    Multiple Masters and GX var fonts.                                 */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    name    :: The axis's name.                                        */\r\n  /*               Not always meaningful for GX.                           */\r\n  /*                                                                       */\r\n  /*    minimum :: The axis's minimum design coordinate.                   */\r\n  /*                                                                       */\r\n  /*    def     :: The axis's default design coordinate.                   */\r\n  /*               FreeType computes meaningful default values for MM; it  */\r\n  /*               is then an integer value, not in 16.16 format.          */\r\n  /*                                                                       */\r\n  /*    maximum :: The axis's maximum design coordinate.                   */\r\n  /*                                                                       */\r\n  /*    tag     :: The axis's tag (the GX equivalent to `name').           */\r\n  /*               FreeType provides default values for MM if possible.    */\r\n  /*                                                                       */\r\n  /*    strid   :: The entry in `name' table (another GX version of        */\r\n  /*               `name').                                                */\r\n  /*               Not meaningful for MM.                                  */\r\n  /*                                                                       */\r\n  typedef struct  FT_Var_Axis_\r\n  {\r\n    FT_String*  name;\r\n\r\n    FT_Fixed    minimum;\r\n    FT_Fixed    def;\r\n    FT_Fixed    maximum;\r\n\r\n    FT_ULong    tag;\r\n    FT_UInt     strid;\r\n\r\n  } FT_Var_Axis;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Var_Named_Style                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to model a named style in a GX var font.   */\r\n  /*                                                                       */\r\n  /*    This structure can't be used for MM fonts.                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    coords :: The design coordinates for this style.                   */\r\n  /*              This is an array with one entry for each axis.           */\r\n  /*                                                                       */\r\n  /*    strid  :: The entry in `name' table identifying this style.        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Var_Named_Style_\r\n  {\r\n    FT_Fixed*  coords;\r\n    FT_UInt    strid;\r\n\r\n  } FT_Var_Named_Style;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_MM_Var                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the axes and space of a Multiple Masters */\r\n  /*    or GX var distortable font.                                        */\r\n  /*                                                                       */\r\n  /*    Some fields are specific to one format and not to the other.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_axis        :: The number of axes.  The maximum value is~4 for */\r\n  /*                       MM; no limit in GX.                             */\r\n  /*                                                                       */\r\n  /*    num_designs     :: The number of designs; should be normally       */\r\n  /*                       2^num_axis for MM fonts.  Not meaningful for GX */\r\n  /*                       (where every glyph could have a different       */\r\n  /*                       number of designs).                             */\r\n  /*                                                                       */\r\n  /*    num_namedstyles :: The number of named styles; only meaningful for */\r\n  /*                       GX which allows certain design coordinates to   */\r\n  /*                       have a string ID (in the `name' table)          */\r\n  /*                       associated with them.  The font can tell the    */\r\n  /*                       user that, for example, Weight=1.5 is `Bold'.   */\r\n  /*                                                                       */\r\n  /*    axis            :: A table of axis descriptors.                    */\r\n  /*                       GX fonts contain slightly more data than MM.    */\r\n  /*                                                                       */\r\n  /*    namedstyles     :: A table of named styles.                        */\r\n  /*                       Only meaningful with GX.                        */\r\n  /*                                                                       */\r\n  typedef struct  FT_MM_Var_\r\n  {\r\n    FT_UInt              num_axis;\r\n    FT_UInt              num_designs;\r\n    FT_UInt              num_namedstyles;\r\n    FT_Var_Axis*         axis;\r\n    FT_Var_Named_Style*  namedstyle;\r\n\r\n  } FT_MM_Var;\r\n\r\n\r\n  /* */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Multi_Master                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the Multiple Master descriptor of a given font.           */\r\n  /*                                                                       */\r\n  /*    This function can't be used with GX fonts.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: A handle to the source face.                            */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amaster :: The Multiple Masters descriptor.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Multi_Master( FT_Face           face,\r\n                       FT_Multi_Master  *amaster );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_MM_Var                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the Multiple Master/GX var descriptor of a given font.    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face    :: A handle to the source face.                            */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amaster :: The Multiple Masters/GX var descriptor.                 */\r\n  /*               Allocates a data structure, which the user must free    */\r\n  /*               (a single call to FT_FREE will do it).                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_MM_Var( FT_Face      face,\r\n                 FT_MM_Var*  *amaster );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_MM_Design_Coordinates                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    For Multiple Masters fonts, choose an interpolated font design     */\r\n  /*    through design coordinates.                                        */\r\n  /*                                                                       */\r\n  /*    This function can't be used with GX fonts.                         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: A handle to the source face.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: The number of design coordinates (must be equal to   */\r\n  /*                  the number of axes in the font).                     */\r\n  /*                                                                       */\r\n  /*    coords     :: An array of design coordinates.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_MM_Design_Coordinates( FT_Face   face,\r\n                                FT_UInt   num_coords,\r\n                                FT_Long*  coords );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Var_Design_Coordinates                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    For Multiple Master or GX Var fonts, choose an interpolated font   */\r\n  /*    design through design coordinates.                                 */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: A handle to the source face.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: The number of design coordinates (must be equal to   */\r\n  /*                  the number of axes in the font).                     */\r\n  /*                                                                       */\r\n  /*    coords     :: An array of design coordinates.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Var_Design_Coordinates( FT_Face    face,\r\n                                 FT_UInt    num_coords,\r\n                                 FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_MM_Blend_Coordinates                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    For Multiple Masters and GX var fonts, choose an interpolated font */\r\n  /*    design through normalized blend coordinates.                       */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    face       :: A handle to the source face.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    num_coords :: The number of design coordinates (must be equal to   */\r\n  /*                  the number of axes in the font).                     */\r\n  /*                                                                       */\r\n  /*    coords     :: The design coordinates array (each element must be   */\r\n  /*                  between 0 and 1.0).                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_MM_Blend_Coordinates( FT_Face    face,\r\n                               FT_UInt    num_coords,\r\n                               FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Var_Blend_Coordinates                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is another name of @FT_Set_MM_Blend_Coordinates.              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Var_Blend_Coordinates( FT_Face    face,\r\n                                FT_UInt    num_coords,\r\n                                FT_Fixed*  coords );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTMM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftmodapi.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmodapi.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType modules public interface (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009, 2010 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMODAPI_H__\r\n#define __FTMODAPI_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    module_management                                                  */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Module Management                                                  */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    How to add, upgrade, and remove modules from FreeType.             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The definitions below are used to manage modules within FreeType.  */\r\n  /*    Modules can be added, upgraded, and removed at runtime.            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* module bit flags */\r\n#define FT_MODULE_FONT_DRIVER         1  /* this module is a font driver  */\r\n#define FT_MODULE_RENDERER            2  /* this module is a renderer     */\r\n#define FT_MODULE_HINTER              4  /* this module is a glyph hinter */\r\n#define FT_MODULE_STYLER              8  /* this module is a styler       */\r\n\r\n#define FT_MODULE_DRIVER_SCALABLE     0x100   /* the driver supports      */\r\n                                              /* scalable fonts           */\r\n#define FT_MODULE_DRIVER_NO_OUTLINES  0x200   /* the driver does not      */\r\n                                              /* support vector outlines  */\r\n#define FT_MODULE_DRIVER_HAS_HINTER   0x400   /* the driver provides its  */\r\n                                              /* own hinter               */\r\n\r\n\r\n  /* deprecated values */\r\n#define ft_module_font_driver         FT_MODULE_FONT_DRIVER\r\n#define ft_module_renderer            FT_MODULE_RENDERER\r\n#define ft_module_hinter              FT_MODULE_HINTER\r\n#define ft_module_styler              FT_MODULE_STYLER\r\n\r\n#define ft_module_driver_scalable     FT_MODULE_DRIVER_SCALABLE\r\n#define ft_module_driver_no_outlines  FT_MODULE_DRIVER_NO_OUTLINES\r\n#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER\r\n\r\n\r\n  typedef FT_Pointer  FT_Module_Interface;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Constructor                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to initialize (not create) a new module object.    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module :: The module to initialize.                                */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_Module_Constructor)( FT_Module  module );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Destructor                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to finalize (not destroy) a given module object.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module :: The module to finalize.                                  */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Module_Destructor)( FT_Module  module );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Requester                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to query a given module for a specific interface.  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module :: The module to finalize.                                  */\r\n  /*                                                                       */\r\n  /*    name ::   The name of the interface in the module.                 */\r\n  /*                                                                       */\r\n  typedef FT_Module_Interface\r\n  (*FT_Module_Requester)( FT_Module    module,\r\n                          const char*  name );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Module_Class                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The module class descriptor.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    module_flags    :: Bit flags describing the module.                */\r\n  /*                                                                       */\r\n  /*    module_size     :: The size of one module object/instance in       */\r\n  /*                       bytes.                                          */\r\n  /*                                                                       */\r\n  /*    module_name     :: The name of the module.                         */\r\n  /*                                                                       */\r\n  /*    module_version  :: The version, as a 16.16 fixed number            */\r\n  /*                       (major.minor).                                  */\r\n  /*                                                                       */\r\n  /*    module_requires :: The version of FreeType this module requires,   */\r\n  /*                       as a 16.16 fixed number (major.minor).  Starts  */\r\n  /*                       at version 2.0, i.e., 0x20000.                  */\r\n  /*                                                                       */\r\n  /*    module_init     :: The initializing function.                      */\r\n  /*                                                                       */\r\n  /*    module_done     :: The finalizing function.                        */\r\n  /*                                                                       */\r\n  /*    get_interface   :: The interface requesting function.              */\r\n  /*                                                                       */\r\n  typedef struct  FT_Module_Class_\r\n  {\r\n    FT_ULong               module_flags;\r\n    FT_Long                module_size;\r\n    const FT_String*       module_name;\r\n    FT_Fixed               module_version;\r\n    FT_Fixed               module_requires;\r\n\r\n    const void*            module_interface;\r\n\r\n    FT_Module_Constructor  module_init;\r\n    FT_Module_Destructor   module_done;\r\n    FT_Module_Requester    get_interface;\r\n\r\n  } FT_Module_Class;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Add_Module                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Add a new module to a given library instance.                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library :: A handle to the library object.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    clazz   :: A pointer to class descriptor for the module.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An error will be returned if a module already exists by that name, */\r\n  /*    or if the module requires a version of FreeType that is too great. */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Add_Module( FT_Library              library,\r\n                 const FT_Module_Class*  clazz );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Module                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Find a module by its name.                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library     :: A handle to the library object.                     */\r\n  /*                                                                       */\r\n  /*    module_name :: The module's name (as an ASCII string).             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A module handle.  0~if none was found.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    FreeType's internal modules aren't documented very well, and you   */\r\n  /*    should look up the source code for details.                        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Module )\r\n  FT_Get_Module( FT_Library   library,\r\n                 const char*  module_name );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Remove_Module                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Remove a given module from a library instance.                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library :: A handle to a library object.                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    module  :: A handle to a module object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The module object is destroyed by the function in case of success. */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Remove_Module( FT_Library  library,\r\n                    FT_Module   module );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Reference_Library                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A counter gets initialized to~1 at the time an @FT_Library         */\r\n  /*    structure is created.  This function increments the counter.       */\r\n  /*    @FT_Done_Library then only destroys a library if the counter is~1, */\r\n  /*    otherwise it simply decrements the counter.                        */\r\n  /*                                                                       */\r\n  /*    This function helps in managing life-cycles of structures which    */\r\n  /*    reference @FT_Library objects.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a target library object.                    */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Since>                                                               */\r\n  /*    2.4.2                                                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Reference_Library( FT_Library  library );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Library                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to create a new FreeType library instance    */\r\n  /*    from a given memory object.  It is thus possible to use libraries  */\r\n  /*    with distinct memory allocators within the same program.           */\r\n  /*                                                                       */\r\n  /*    Normally, you would call this function (followed by a call to      */\r\n  /*    @FT_Add_Default_Modules or a series of calls to @FT_Add_Module)    */\r\n  /*    instead of @FT_Init_FreeType to initialize the FreeType library.   */\r\n  /*                                                                       */\r\n  /*    Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a      */\r\n  /*    library instance.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory   :: A handle to the original memory object.                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    alibrary :: A pointer to handle of a new library object.           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Library.                                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Library( FT_Memory    memory,\r\n                  FT_Library  *alibrary );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Library                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard a given library object.  This closes all drivers and       */\r\n  /*    discards all resource objects.                                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to the target library.                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    See the discussion of reference counters in the description of     */\r\n  /*    @FT_Reference_Library.                                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_Library( FT_Library  library );\r\n\r\n/* */\r\n\r\n  typedef void\r\n  (*FT_DebugHook_Func)( void*  arg );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Debug_Hook                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set a debug hook function for debugging the interpreter of a font  */\r\n  /*    format.                                                            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hook_index :: The index of the debug hook.  You should use the     */\r\n  /*                  values defined in `ftobjs.h', e.g.,                  */\r\n  /*                  `FT_DEBUG_HOOK_TRUETYPE'.                            */\r\n  /*                                                                       */\r\n  /*    debug_hook :: The function used to debug the interpreter.          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Currently, four debug hook slots are available, but only two (for  */\r\n  /*    the TrueType and the Type~1 interpreter) are defined.              */\r\n  /*                                                                       */\r\n  /*    Since the internal headers of FreeType are no longer installed,    */\r\n  /*    the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly.      */\r\n  /*    This is a bug and will be fixed in a forthcoming release.          */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Set_Debug_Hook( FT_Library         library,\r\n                     FT_UInt            hook_index,\r\n                     FT_DebugHook_Func  debug_hook );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Add_Default_Modules                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Add the set of default drivers to a given library object.          */\r\n  /*    This is only useful when you create a library object with          */\r\n  /*    @FT_New_Library (usually to plug a custom memory manager).         */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library :: A handle to a new library object.                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Add_Default_Modules( FT_Library  library );\r\n\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   * @section:\r\n   *   truetype_engine\r\n   *\r\n   * @title:\r\n   *   The TrueType Engine\r\n   *\r\n   * @abstract:\r\n   *   TrueType bytecode support.\r\n   *\r\n   * @description:\r\n   *   This section contains a function used to query the level of TrueType\r\n   *   bytecode support compiled in this version of the library.\r\n   *\r\n   */\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   *  @enum:\r\n   *     FT_TrueTypeEngineType\r\n   *\r\n   *  @description:\r\n   *     A list of values describing which kind of TrueType bytecode\r\n   *     engine is implemented in a given FT_Library instance.  It is used\r\n   *     by the @FT_Get_TrueType_Engine_Type function.\r\n   *\r\n   *  @values:\r\n   *     FT_TRUETYPE_ENGINE_TYPE_NONE ::\r\n   *       The library doesn't implement any kind of bytecode interpreter.\r\n   *\r\n   *     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::\r\n   *       The library implements a bytecode interpreter that doesn't\r\n   *       support the patented operations of the TrueType virtual machine.\r\n   *\r\n   *       Its main use is to load certain Asian fonts which position and\r\n   *       scale glyph components with bytecode instructions.  It produces\r\n   *       bad output for most other fonts.\r\n   *\r\n   *    FT_TRUETYPE_ENGINE_TYPE_PATENTED ::\r\n   *       The library implements a bytecode interpreter that covers\r\n   *       the full instruction set of the TrueType virtual machine (this\r\n   *       was governed by patents until May 2010, hence the name).\r\n   *\r\n   *  @since:\r\n   *       2.2\r\n   *\r\n   */\r\n  typedef enum  FT_TrueTypeEngineType_\r\n  {\r\n    FT_TRUETYPE_ENGINE_TYPE_NONE = 0,\r\n    FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,\r\n    FT_TRUETYPE_ENGINE_TYPE_PATENTED\r\n\r\n  } FT_TrueTypeEngineType;\r\n\r\n\r\n  /**************************************************************************\r\n   *\r\n   *  @func:\r\n   *     FT_Get_TrueType_Engine_Type\r\n   *\r\n   *  @description:\r\n   *     Return an @FT_TrueTypeEngineType value to indicate which level of\r\n   *     the TrueType virtual machine a given library instance supports.\r\n   *\r\n   *  @input:\r\n   *     library ::\r\n   *       A library instance.\r\n   *\r\n   *  @return:\r\n   *     A value indicating which level is supported.\r\n   *\r\n   *  @since:\r\n   *     2.2\r\n   *\r\n   */\r\n  FT_EXPORT( FT_TrueTypeEngineType )\r\n  FT_Get_TrueType_Engine_Type( FT_Library  library );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTMODAPI_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftmoderr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmoderr.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType module error offsets (specification).                       */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2004, 2005 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is used to define the FreeType module error offsets.        */\r\n  /*                                                                       */\r\n  /* The lower byte gives the error code, the higher byte gives the        */\r\n  /* module.  The base module has error offset 0.  For example, the error  */\r\n  /* `FT_Err_Invalid_File_Format' has value 0x003, the error               */\r\n  /* `TT_Err_Invalid_File_Format' has value 0x1103, the error              */\r\n  /* `T1_Err_Invalid_File_Format' has value 0x1203, etc.                   */\r\n  /*                                                                       */\r\n  /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h   */\r\n  /* to make the higher byte always zero (disabling the module error       */\r\n  /* mechanism).                                                           */\r\n  /*                                                                       */\r\n  /* It can also be used to create a module error message table easily     */\r\n  /* with something like                                                   */\r\n  /*                                                                       */\r\n  /*   {                                                                   */\r\n  /*     #undef __FTMODERR_H__                                             */\r\n  /*     #define FT_MODERRDEF( e, v, s )  { FT_Mod_Err_ ## e, s },         */\r\n  /*     #define FT_MODERR_START_LIST     {                                */\r\n  /*     #define FT_MODERR_END_LIST       { 0, 0 } };                      */\r\n  /*                                                                       */\r\n  /*     const struct                                                      */\r\n  /*     {                                                                 */\r\n  /*       int          mod_err_offset;                                    */\r\n  /*       const char*  mod_err_msg                                        */\r\n  /*     } ft_mod_errors[] =                                               */\r\n  /*                                                                       */\r\n  /*     #include FT_MODULE_ERRORS_H                                       */\r\n  /*   }                                                                   */\r\n  /*                                                                       */\r\n  /* To use such a table, all errors must be ANDed with 0xFF00 to remove   */\r\n  /* the error code.                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTMODERR_H__\r\n#define __FTMODERR_H__\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                       SETUP MACROS                      *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#undef  FT_NEED_EXTERN_C\r\n\r\n#ifndef FT_MODERRDEF\r\n\r\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\r\n#define FT_MODERRDEF( e, v, s )  FT_Mod_Err_ ## e = v,\r\n#else\r\n#define FT_MODERRDEF( e, v, s )  FT_Mod_Err_ ## e = 0,\r\n#endif\r\n\r\n#define FT_MODERR_START_LIST  enum {\r\n#define FT_MODERR_END_LIST    FT_Mod_Err_Max };\r\n\r\n#ifdef __cplusplus\r\n#define FT_NEED_EXTERN_C\r\n  extern \"C\" {\r\n#endif\r\n\r\n#endif /* !FT_MODERRDEF */\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****               LIST MODULE ERROR BASES                   *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#ifdef FT_MODERR_START_LIST\r\n  FT_MODERR_START_LIST\r\n#endif\r\n\r\n\r\n  FT_MODERRDEF( Base,      0x000, \"base module\" )\r\n  FT_MODERRDEF( Autofit,   0x100, \"autofitter module\" )\r\n  FT_MODERRDEF( BDF,       0x200, \"BDF module\" )\r\n  FT_MODERRDEF( Cache,     0x300, \"cache module\" )\r\n  FT_MODERRDEF( CFF,       0x400, \"CFF module\" )\r\n  FT_MODERRDEF( CID,       0x500, \"CID module\" )\r\n  FT_MODERRDEF( Gzip,      0x600, \"Gzip module\" )\r\n  FT_MODERRDEF( LZW,       0x700, \"LZW module\" )\r\n  FT_MODERRDEF( OTvalid,   0x800, \"OpenType validation module\" )\r\n  FT_MODERRDEF( PCF,       0x900, \"PCF module\" )\r\n  FT_MODERRDEF( PFR,       0xA00, \"PFR module\" )\r\n  FT_MODERRDEF( PSaux,     0xB00, \"PS auxiliary module\" )\r\n  FT_MODERRDEF( PShinter,  0xC00, \"PS hinter module\" )\r\n  FT_MODERRDEF( PSnames,   0xD00, \"PS names module\" )\r\n  FT_MODERRDEF( Raster,    0xE00, \"raster module\" )\r\n  FT_MODERRDEF( SFNT,      0xF00, \"SFNT module\" )\r\n  FT_MODERRDEF( Smooth,   0x1000, \"smooth raster module\" )\r\n  FT_MODERRDEF( TrueType, 0x1100, \"TrueType module\" )\r\n  FT_MODERRDEF( Type1,    0x1200, \"Type 1 module\" )\r\n  FT_MODERRDEF( Type42,   0x1300, \"Type 42 module\" )\r\n  FT_MODERRDEF( Winfonts, 0x1400, \"Windows FON/FNT module\" )\r\n\r\n\r\n#ifdef FT_MODERR_END_LIST\r\n  FT_MODERR_END_LIST\r\n#endif\r\n\r\n\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n  /*****                                                         *****/\r\n  /*****                      CLEANUP                            *****/\r\n  /*****                                                         *****/\r\n  /*******************************************************************/\r\n  /*******************************************************************/\r\n\r\n\r\n#ifdef FT_NEED_EXTERN_C\r\n  }\r\n#endif\r\n\r\n#undef FT_MODERR_START_LIST\r\n#undef FT_MODERR_END_LIST\r\n#undef FT_MODERRDEF\r\n#undef FT_NEED_EXTERN_C\r\n\r\n\r\n#endif /* __FTMODERR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftotval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftotval.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating OpenType tables (specification).         */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005, 2006, 2007 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/*                                                                         */\r\n/* Warning: This module might be moved to a different library in the       */\r\n/*          future to avoid a tight dependency between FreeType and the    */\r\n/*          OpenType specification.                                        */\r\n/*                                                                         */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTOTVAL_H__\r\n#define __FTOTVAL_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    ot_validation                                                      */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    OpenType Validation                                                */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    An API to validate OpenType tables.                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of functions to validate     */\r\n  /*    some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @enum:\r\n  *    FT_VALIDATE_OTXXX\r\n  *\r\n  * @description:\r\n  *    A list of bit-field constants used with @FT_OpenType_Validate to\r\n  *    indicate which OpenType tables should be validated.\r\n  *\r\n  * @values:\r\n  *    FT_VALIDATE_BASE ::\r\n  *      Validate BASE table.\r\n  *\r\n  *    FT_VALIDATE_GDEF ::\r\n  *      Validate GDEF table.\r\n  *\r\n  *    FT_VALIDATE_GPOS ::\r\n  *      Validate GPOS table.\r\n  *\r\n  *    FT_VALIDATE_GSUB ::\r\n  *      Validate GSUB table.\r\n  *\r\n  *    FT_VALIDATE_JSTF ::\r\n  *      Validate JSTF table.\r\n  *\r\n  *    FT_VALIDATE_MATH ::\r\n  *      Validate MATH table.\r\n  *\r\n  *    FT_VALIDATE_OT ::\r\n  *      Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).\r\n  *\r\n  */\r\n#define FT_VALIDATE_BASE  0x0100\r\n#define FT_VALIDATE_GDEF  0x0200\r\n#define FT_VALIDATE_GPOS  0x0400\r\n#define FT_VALIDATE_GSUB  0x0800\r\n#define FT_VALIDATE_JSTF  0x1000\r\n#define FT_VALIDATE_MATH  0x2000\r\n\r\n#define FT_VALIDATE_OT  FT_VALIDATE_BASE | \\\r\n                        FT_VALIDATE_GDEF | \\\r\n                        FT_VALIDATE_GPOS | \\\r\n                        FT_VALIDATE_GSUB | \\\r\n                        FT_VALIDATE_JSTF | \\\r\n                        FT_VALIDATE_MATH\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_OpenType_Validate\r\n  *\r\n  * @description:\r\n  *    Validate various OpenType tables to assure that all offsets and\r\n  *    indices are valid.  The idea is that a higher-level library which\r\n  *    actually does the text layout can access those tables without\r\n  *    error checking (which can be quite time consuming).\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    validation_flags ::\r\n  *       A bit field which specifies the tables to be validated.  See\r\n  *       @FT_VALIDATE_OTXXX for possible values.\r\n  *\r\n  * @output:\r\n  *    BASE_table ::\r\n  *       A pointer to the BASE table.\r\n  *\r\n  *    GDEF_table ::\r\n  *       A pointer to the GDEF table.\r\n  *\r\n  *    GPOS_table ::\r\n  *       A pointer to the GPOS table.\r\n  *\r\n  *    GSUB_table ::\r\n  *       A pointer to the GSUB table.\r\n  *\r\n  *    JSTF_table ::\r\n  *       A pointer to the JSTF table.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   This function only works with OpenType fonts, returning an error\r\n  *   otherwise.\r\n  *\r\n  *   After use, the application should deallocate the five tables with\r\n  *   @FT_OpenType_Free.  A NULL value indicates that the table either\r\n  *   doesn't exist in the font, or the application hasn't asked for\r\n  *   validation.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_OpenType_Validate( FT_Face    face,\r\n                        FT_UInt    validation_flags,\r\n                        FT_Bytes  *BASE_table,\r\n                        FT_Bytes  *GDEF_table,\r\n                        FT_Bytes  *GPOS_table,\r\n                        FT_Bytes  *GSUB_table,\r\n                        FT_Bytes  *JSTF_table );\r\n\r\n  /* */\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_OpenType_Free\r\n  *\r\n  * @description:\r\n  *    Free the buffer allocated by OpenType validator.\r\n  *\r\n  * @input:\r\n  *    face ::\r\n  *       A handle to the input face.\r\n  *\r\n  *    table ::\r\n  *       The pointer to the buffer that is allocated by\r\n  *       @FT_OpenType_Validate.\r\n  *\r\n  * @note:\r\n  *   This function must be used to free the buffer allocated by\r\n  *   @FT_OpenType_Validate only.\r\n  */\r\n  FT_EXPORT( void )\r\n  FT_OpenType_Free( FT_Face   face,\r\n                    FT_Bytes  table );\r\n\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTOTVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftoutln.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftoutln.h                                                              */\r\n/*                                                                         */\r\n/*    Support for the FT_Outline type used to store glyph shapes of        */\r\n/*    most scalable font formats (specification).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTOUTLN_H__\r\n#define __FTOUTLN_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    outline_processing                                                 */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Outline Processing                                                 */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Functions to create, transform, and render vectorial glyph images. */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains routines used to create and destroy scalable */\r\n  /*    glyph images known as `outlines'.  These can also be measured,     */\r\n  /*    transformed, and converted into bitmaps and pixmaps.               */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_Outline                                                         */\r\n  /*    FT_OUTLINE_FLAGS                                                   */\r\n  /*    FT_Outline_New                                                     */\r\n  /*    FT_Outline_Done                                                    */\r\n  /*    FT_Outline_Copy                                                    */\r\n  /*    FT_Outline_Translate                                               */\r\n  /*    FT_Outline_Transform                                               */\r\n  /*    FT_Outline_Embolden                                                */\r\n  /*    FT_Outline_Reverse                                                 */\r\n  /*    FT_Outline_Check                                                   */\r\n  /*                                                                       */\r\n  /*    FT_Outline_Get_CBox                                                */\r\n  /*    FT_Outline_Get_BBox                                                */\r\n  /*                                                                       */\r\n  /*    FT_Outline_Get_Bitmap                                              */\r\n  /*    FT_Outline_Render                                                  */\r\n  /*                                                                       */\r\n  /*    FT_Outline_Decompose                                               */\r\n  /*    FT_Outline_Funcs                                                   */\r\n  /*    FT_Outline_MoveTo_Func                                             */\r\n  /*    FT_Outline_LineTo_Func                                             */\r\n  /*    FT_Outline_ConicTo_Func                                            */\r\n  /*    FT_Outline_CubicTo_Func                                            */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Decompose                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Walk over an outline's structure to decompose it into individual   */\r\n  /*    segments and Bézier arcs.  This function also emits `move to'      */\r\n  /*    operations to indicate the start of new contours in the outline.   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline        :: A pointer to the source target.                  */\r\n  /*                                                                       */\r\n  /*    func_interface :: A table of `emitters', i.e., function pointers   */\r\n  /*                      called during decomposition to indicate path     */\r\n  /*                      operations.                                      */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    user           :: A typeless pointer which is passed to each       */\r\n  /*                      emitter during the decomposition.  It can be     */\r\n  /*                      used to store the state during the               */\r\n  /*                      decomposition.                                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Decompose( FT_Outline*              outline,\r\n                        const FT_Outline_Funcs*  func_interface,\r\n                        void*                    user );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_New                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new outline of a given size.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library     :: A handle to the library object from where the       */\r\n  /*                   outline is allocated.  Note however that the new    */\r\n  /*                   outline will *not* necessarily be *freed*, when     */\r\n  /*                   destroying the library, by @FT_Done_FreeType.       */\r\n  /*                                                                       */\r\n  /*    numPoints   :: The maximal number of points within the outline.    */\r\n  /*                                                                       */\r\n  /*    numContours :: The maximal number of contours within the outline.  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    anoutline   :: A handle to the new outline.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The reason why this function takes a `library' parameter is simply */\r\n  /*    to use the library's memory allocator.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_New( FT_Library   library,\r\n                  FT_UInt      numPoints,\r\n                  FT_Int       numContours,\r\n                  FT_Outline  *anoutline );\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_New_Internal( FT_Memory    memory,\r\n                           FT_UInt      numPoints,\r\n                           FT_Int       numContours,\r\n                           FT_Outline  *anoutline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Done                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroy an outline created with @FT_Outline_New.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle of the library object used to allocate the     */\r\n  /*               outline.                                                */\r\n  /*                                                                       */\r\n  /*    outline :: A pointer to the outline object to be discarded.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If the outline's `owner' field is not set, only the outline        */\r\n  /*    descriptor will be released.                                       */\r\n  /*                                                                       */\r\n  /*    The reason why this function takes an `library' parameter is       */\r\n  /*    simply to use ft_mem_free().                                       */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Done( FT_Library   library,\r\n                   FT_Outline*  outline );\r\n\r\n\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Done_Internal( FT_Memory    memory,\r\n                            FT_Outline*  outline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Check                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check the contents of an outline descriptor.                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline :: A handle to a source outline.                           */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Check( FT_Outline*  outline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Get_CBox                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return an outline's `control box'.  The control box encloses all   */\r\n  /*    the outline's points, including Bézier control points.  Though it  */\r\n  /*    coincides with the exact bounding box for most glyphs, it can be   */\r\n  /*    slightly larger in some situations (like when rotating an outline  */\r\n  /*    which contains Bézier outside arcs).                               */\r\n  /*                                                                       */\r\n  /*    Computing the control box is very fast, while getting the bounding */\r\n  /*    box can take much more time as it needs to walk over all segments  */\r\n  /*    and arcs in the outline.  To get the latter, you can use the       */\r\n  /*    `ftbbox' component which is dedicated to this single task.         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    outline :: A pointer to the source outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    acbox   :: The outline's control box.                              */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Get_CBox( const FT_Outline*  outline,\r\n                       FT_BBox           *acbox );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Translate                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Apply a simple translation to the points of an outline.            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline :: A pointer to the target outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    xOffset :: The horizontal offset.                                  */\r\n  /*                                                                       */\r\n  /*    yOffset :: The vertical offset.                                    */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Translate( const FT_Outline*  outline,\r\n                        FT_Pos             xOffset,\r\n                        FT_Pos             yOffset );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Copy                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Copy an outline into another one.  Both objects must have the      */\r\n  /*    same sizes (number of points & number of contours) when this       */\r\n  /*    function is called.                                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    source :: A handle to the source outline.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    target :: A handle to the target outline.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Copy( const FT_Outline*  source,\r\n                   FT_Outline        *target );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Transform                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Apply a simple 2x2 matrix to all of an outline's points.  Useful   */\r\n  /*    for applying rotations, slanting, flipping, etc.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline :: A pointer to the target outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    matrix  :: A pointer to the transformation matrix.                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You can use @FT_Outline_Translate if you need to translate the     */\r\n  /*    outline's points.                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Transform( const FT_Outline*  outline,\r\n                        const FT_Matrix*   matrix );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Embolden                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Embolden an outline.  The new outline will be at most 4~times      */\r\n  /*    `strength' pixels wider and higher.  You may think of the left and */\r\n  /*    bottom borders as unchanged.                                       */\r\n  /*                                                                       */\r\n  /*    Negative `strength' values to reduce the outline thickness are     */\r\n  /*    possible also.                                                     */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline  :: A handle to the target outline.                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    strength :: How strong the glyph is emboldened.  Expressed in      */\r\n  /*                26.6 pixel format.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The used algorithm to increase or decrease the thickness of the    */\r\n  /*    glyph doesn't change the number of points; this means that certain */\r\n  /*    situations like acute angles or intersections are sometimes        */\r\n  /*    handled incorrectly.                                               */\r\n  /*                                                                       */\r\n  /*    If you need `better' metrics values you should call                */\r\n  /*    @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox.                      */\r\n  /*                                                                       */\r\n  /*    Example call:                                                      */\r\n  /*                                                                       */\r\n  /*    {                                                                  */\r\n  /*      FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );                   */\r\n  /*      if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE )             */\r\n  /*        FT_Outline_Embolden( &face->slot->outline, strength );         */\r\n  /*    }                                                                  */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Embolden( FT_Outline*  outline,\r\n                       FT_Pos       strength );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Reverse                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Reverse the drawing direction of an outline.  This is used to      */\r\n  /*    ensure consistent fill conventions for mirrored glyphs.            */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    outline :: A pointer to the target outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in     */\r\n  /*    the outline's `flags' field.                                       */\r\n  /*                                                                       */\r\n  /*    It shouldn't be used by a normal client application, unless it     */\r\n  /*    knows what it is doing.                                            */\r\n  /*                                                                       */\r\n  FT_EXPORT( void )\r\n  FT_Outline_Reverse( FT_Outline*  outline );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Get_Bitmap                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Render an outline within a bitmap.  The outline's image is simply  */\r\n  /*    OR-ed to the target bitmap.                                        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a FreeType library object.                  */\r\n  /*                                                                       */\r\n  /*    outline :: A pointer to the source outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    abitmap :: A pointer to the target bitmap descriptor.              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does NOT CREATE the bitmap, it only renders an       */\r\n  /*    outline image within the one you pass to it!  Consequently, the    */\r\n  /*    various fields in `abitmap' should be set accordingly.             */\r\n  /*                                                                       */\r\n  /*    It will use the raster corresponding to the default glyph format.  */\r\n  /*                                                                       */\r\n  /*    The value of the `num_grays' field in `abitmap' is ignored.  If    */\r\n  /*    you select the gray-level rasterizer, and you want less than 256   */\r\n  /*    gray levels, you have to use @FT_Outline_Render directly.          */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Get_Bitmap( FT_Library        library,\r\n                         FT_Outline*       outline,\r\n                         const FT_Bitmap  *abitmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Outline_Render                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Render an outline within a bitmap using the current scan-convert.  */\r\n  /*    This function uses an @FT_Raster_Params structure as an argument,  */\r\n  /*    allowing advanced features like direct composition, translucency,  */\r\n  /*    etc.                                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to a FreeType library object.                  */\r\n  /*                                                                       */\r\n  /*    outline :: A pointer to the source outline descriptor.             */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    params  :: A pointer to an @FT_Raster_Params structure used to     */\r\n  /*               describe the rendering operation.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should know what you are doing and how @FT_Raster_Params works */\r\n  /*    to use this function.                                              */\r\n  /*                                                                       */\r\n  /*    The field `params.source' will be set to `outline' before the scan */\r\n  /*    converter is called, which means that the value you give to it is  */\r\n  /*    actually ignored.                                                  */\r\n  /*                                                                       */\r\n  /*    The gray-level rasterizer always uses 256 gray levels.  If you     */\r\n  /*    want less gray levels, you have to provide your own span callback. */\r\n  /*    See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the   */\r\n  /*    @FT_Raster_Params structure for more details.                      */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Outline_Render( FT_Library         library,\r\n                     FT_Outline*        outline,\r\n                     FT_Raster_Params*  params );\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @enum:\r\n  *   FT_Orientation\r\n  *\r\n  * @description:\r\n  *   A list of values used to describe an outline's contour orientation.\r\n  *\r\n  *   The TrueType and PostScript specifications use different conventions\r\n  *   to determine whether outline contours should be filled or unfilled.\r\n  *\r\n  * @values:\r\n  *   FT_ORIENTATION_TRUETYPE ::\r\n  *     According to the TrueType specification, clockwise contours must\r\n  *     be filled, and counter-clockwise ones must be unfilled.\r\n  *\r\n  *   FT_ORIENTATION_POSTSCRIPT ::\r\n  *     According to the PostScript specification, counter-clockwise contours\r\n  *     must be filled, and clockwise ones must be unfilled.\r\n  *\r\n  *   FT_ORIENTATION_FILL_RIGHT ::\r\n  *     This is identical to @FT_ORIENTATION_TRUETYPE, but is used to\r\n  *     remember that in TrueType, everything that is to the right of\r\n  *     the drawing direction of a contour must be filled.\r\n  *\r\n  *   FT_ORIENTATION_FILL_LEFT ::\r\n  *     This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to\r\n  *     remember that in PostScript, everything that is to the left of\r\n  *     the drawing direction of a contour must be filled.\r\n  *\r\n  *   FT_ORIENTATION_NONE ::\r\n  *     The orientation cannot be determined.  That is, different parts of\r\n  *     the glyph have different orientation.\r\n  *\r\n  */\r\n  typedef enum  FT_Orientation_\r\n  {\r\n    FT_ORIENTATION_TRUETYPE   = 0,\r\n    FT_ORIENTATION_POSTSCRIPT = 1,\r\n    FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,\r\n    FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT,\r\n    FT_ORIENTATION_NONE\r\n\r\n  } FT_Orientation;\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Outline_Get_Orientation\r\n  *\r\n  * @description:\r\n  *   This function analyzes a glyph outline and tries to compute its\r\n  *   fill orientation (see @FT_Orientation).  This is done by computing\r\n  *   the direction of each global horizontal and/or vertical extrema\r\n  *   within the outline.\r\n  *\r\n  *   Note that this will return @FT_ORIENTATION_TRUETYPE for empty\r\n  *   outlines.\r\n  *\r\n  * @input:\r\n  *   outline ::\r\n  *     A handle to the source outline.\r\n  *\r\n  * @return:\r\n  *   The orientation.\r\n  *\r\n  */\r\n  FT_EXPORT( FT_Orientation )\r\n  FT_Outline_Get_Orientation( FT_Outline*  outline );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTOUTLN_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftpfr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpfr.h                                                                */\r\n/*                                                                         */\r\n/*    FreeType API for accessing PFR-specific data (specification only).   */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006, 2008, 2009 by                        */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTPFR_H__\r\n#define __FTPFR_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    pfr_fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    PFR Fonts                                                          */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    PFR/TrueDoc specific API.                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of PFR-specific functions.   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_PFR_Metrics\r\n  *\r\n  * @description:\r\n  *    Return the outline and metrics resolutions of a given PFR face.\r\n  *\r\n  * @input:\r\n  *    face :: Handle to the input face.  It can be a non-PFR face.\r\n  *\r\n  * @output:\r\n  *    aoutline_resolution ::\r\n  *      Outline resolution.  This is equivalent to `face->units_per_EM'\r\n  *      for non-PFR fonts.  Optional (parameter can be NULL).\r\n  *\r\n  *    ametrics_resolution ::\r\n  *      Metrics resolution.  This is equivalent to `outline_resolution'\r\n  *      for non-PFR fonts.  Optional (parameter can be NULL).\r\n  *\r\n  *    ametrics_x_scale ::\r\n  *      A 16.16 fixed-point number used to scale distance expressed\r\n  *      in metrics units to device sub-pixels.  This is equivalent to\r\n  *      `face->size->x_scale', but for metrics only.  Optional (parameter\r\n  *      can be NULL).\r\n  *\r\n  *    ametrics_y_scale ::\r\n  *      Same as `ametrics_x_scale' but for the vertical direction.\r\n  *      optional (parameter can be NULL).\r\n  *\r\n  * @return:\r\n  *    FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   If the input face is not a PFR, this function will return an error.\r\n  *   However, in all cases, it will return valid values.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PFR_Metrics( FT_Face    face,\r\n                      FT_UInt   *aoutline_resolution,\r\n                      FT_UInt   *ametrics_resolution,\r\n                      FT_Fixed  *ametrics_x_scale,\r\n                      FT_Fixed  *ametrics_y_scale );\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_PFR_Kerning\r\n  *\r\n  * @description:\r\n  *    Return the kerning pair corresponding to two glyphs in a PFR face.\r\n  *    The distance is expressed in metrics units, unlike the result of\r\n  *    @FT_Get_Kerning.\r\n  *\r\n  * @input:\r\n  *    face  :: A handle to the input face.\r\n  *\r\n  *    left  :: Index of the left glyph.\r\n  *\r\n  *    right :: Index of the right glyph.\r\n  *\r\n  * @output:\r\n  *    avector :: A kerning vector.\r\n  *\r\n  * @return:\r\n  *    FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *    This function always return distances in original PFR metrics\r\n  *    units.  This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED\r\n  *    mode, which always returns distances converted to outline units.\r\n  *\r\n  *    You can use the value of the `x_scale' and `y_scale' parameters\r\n  *    returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels.\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PFR_Kerning( FT_Face     face,\r\n                      FT_UInt     left,\r\n                      FT_UInt     right,\r\n                      FT_Vector  *avector );\r\n\r\n\r\n /**********************************************************************\r\n  *\r\n  * @function:\r\n  *    FT_Get_PFR_Advance\r\n  *\r\n  * @description:\r\n  *    Return a given glyph advance, expressed in original metrics units,\r\n  *    from a PFR font.\r\n  *\r\n  * @input:\r\n  *    face   :: A handle to the input face.\r\n  *\r\n  *    gindex :: The glyph index.\r\n  *\r\n  * @output:\r\n  *    aadvance :: The glyph advance in metrics units.\r\n  *\r\n  * @return:\r\n  *    FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *    You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics\r\n  *    to convert the advance to device sub-pixels (i.e., 1/64th of pixels).\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PFR_Advance( FT_Face   face,\r\n                      FT_UInt   gindex,\r\n                      FT_Pos   *aadvance );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTPFR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftrender.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrender.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType renderer modules public interface (specification).          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2005, 2006, 2010 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTRENDER_H__\r\n#define __FTRENDER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n#include FT_GLYPH_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    module_management                                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* create a new glyph object */\r\n  typedef FT_Error\r\n  (*FT_Glyph_InitFunc)( FT_Glyph      glyph,\r\n                        FT_GlyphSlot  slot );\r\n\r\n  /* destroys a given glyph object */\r\n  typedef void\r\n  (*FT_Glyph_DoneFunc)( FT_Glyph  glyph );\r\n\r\n  typedef void\r\n  (*FT_Glyph_TransformFunc)( FT_Glyph          glyph,\r\n                             const FT_Matrix*  matrix,\r\n                             const FT_Vector*  delta );\r\n\r\n  typedef void\r\n  (*FT_Glyph_GetBBoxFunc)( FT_Glyph  glyph,\r\n                           FT_BBox*  abbox );\r\n\r\n  typedef FT_Error\r\n  (*FT_Glyph_CopyFunc)( FT_Glyph   source,\r\n                        FT_Glyph   target );\r\n\r\n  typedef FT_Error\r\n  (*FT_Glyph_PrepareFunc)( FT_Glyph      glyph,\r\n                           FT_GlyphSlot  slot );\r\n\r\n/* deprecated */\r\n#define FT_Glyph_Init_Func       FT_Glyph_InitFunc\r\n#define FT_Glyph_Done_Func       FT_Glyph_DoneFunc\r\n#define FT_Glyph_Transform_Func  FT_Glyph_TransformFunc\r\n#define FT_Glyph_BBox_Func       FT_Glyph_GetBBoxFunc\r\n#define FT_Glyph_Copy_Func       FT_Glyph_CopyFunc\r\n#define FT_Glyph_Prepare_Func    FT_Glyph_PrepareFunc\r\n\r\n\r\n  struct  FT_Glyph_Class_\r\n  {\r\n    FT_Long                 glyph_size;\r\n    FT_Glyph_Format         glyph_format;\r\n    FT_Glyph_InitFunc       glyph_init;\r\n    FT_Glyph_DoneFunc       glyph_done;\r\n    FT_Glyph_CopyFunc       glyph_copy;\r\n    FT_Glyph_TransformFunc  glyph_transform;\r\n    FT_Glyph_GetBBoxFunc    glyph_bbox;\r\n    FT_Glyph_PrepareFunc    glyph_prepare;\r\n  };\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Renderer_RenderFunc)( FT_Renderer       renderer,\r\n                             FT_GlyphSlot      slot,\r\n                             FT_UInt           mode,\r\n                             const FT_Vector*  origin );\r\n\r\n  typedef FT_Error\r\n  (*FT_Renderer_TransformFunc)( FT_Renderer       renderer,\r\n                                FT_GlyphSlot      slot,\r\n                                const FT_Matrix*  matrix,\r\n                                const FT_Vector*  delta );\r\n\r\n\r\n  typedef void\r\n  (*FT_Renderer_GetCBoxFunc)( FT_Renderer   renderer,\r\n                              FT_GlyphSlot  slot,\r\n                              FT_BBox*      cbox );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Renderer_SetModeFunc)( FT_Renderer  renderer,\r\n                              FT_ULong     mode_tag,\r\n                              FT_Pointer   mode_ptr );\r\n\r\n/* deprecated identifiers */\r\n#define FTRenderer_render  FT_Renderer_RenderFunc\r\n#define FTRenderer_transform  FT_Renderer_TransformFunc\r\n#define FTRenderer_getCBox  FT_Renderer_GetCBoxFunc\r\n#define FTRenderer_setMode  FT_Renderer_SetModeFunc\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Renderer_Class                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The renderer module class descriptor.                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root            :: The root @FT_Module_Class fields.               */\r\n  /*                                                                       */\r\n  /*    glyph_format    :: The glyph image format this renderer handles.   */\r\n  /*                                                                       */\r\n  /*    render_glyph    :: A method used to render the image that is in a  */\r\n  /*                       given glyph slot into a bitmap.                 */\r\n  /*                                                                       */\r\n  /*    transform_glyph :: A method used to transform the image that is in */\r\n  /*                       a given glyph slot.                             */\r\n  /*                                                                       */\r\n  /*    get_glyph_cbox  :: A method used to access the glyph's cbox.       */\r\n  /*                                                                       */\r\n  /*    set_mode        :: A method used to pass additional parameters.    */\r\n  /*                                                                       */\r\n  /*    raster_class    :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.    */\r\n  /*                       This is a pointer to its raster's class.        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Renderer_Class_\r\n  {\r\n    FT_Module_Class            root;\r\n\r\n    FT_Glyph_Format            glyph_format;\r\n\r\n    FT_Renderer_RenderFunc     render_glyph;\r\n    FT_Renderer_TransformFunc  transform_glyph;\r\n    FT_Renderer_GetCBoxFunc    get_glyph_cbox;\r\n    FT_Renderer_SetModeFunc    set_mode;\r\n\r\n    FT_Raster_Funcs*           raster_class;\r\n\r\n  } FT_Renderer_Class;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Renderer                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the current renderer for a given glyph format.            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library :: A handle to the library object.                         */\r\n  /*                                                                       */\r\n  /*    format  :: The glyph format.                                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A renderer handle.  0~if none found.                               */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    An error will be returned if a module already exists by that name, */\r\n  /*    or if the module requires a version of FreeType that is too great. */\r\n  /*                                                                       */\r\n  /*    To add a new renderer, simply use @FT_Add_Module.  To retrieve a   */\r\n  /*    renderer by its name, use @FT_Get_Module.                          */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Renderer )\r\n  FT_Get_Renderer( FT_Library       library,\r\n                   FT_Glyph_Format  format );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Set_Renderer                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Set the current renderer to use, and set additional mode.          */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    library    :: A handle to the library object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    renderer   :: A handle to the renderer object.                     */\r\n  /*                                                                       */\r\n  /*    num_params :: The number of additional parameters.                 */\r\n  /*                                                                       */\r\n  /*    parameters :: Additional parameters.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    In case of success, the renderer will be used to convert glyph     */\r\n  /*    images in the renderer's known format into bitmaps.                */\r\n  /*                                                                       */\r\n  /*    This doesn't change the current renderer for other formats.        */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Set_Renderer( FT_Library     library,\r\n                   FT_Renderer    renderer,\r\n                   FT_UInt        num_params,\r\n                   FT_Parameter*  parameters );\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTRENDER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftsizes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsizes.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType size objects management (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2003, 2004, 2006, 2009 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Typical application would normally not need to use these functions.   */\r\n  /* However, they have been placed in a public API for the rare cases     */\r\n  /* where they are needed.                                                */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTSIZES_H__\r\n#define __FTSIZES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    sizes_management                                                   */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Size Management                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Managing multiple sizes per face.                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    When creating a new face object (e.g., with @FT_New_Face), an      */\r\n  /*    @FT_Size object is automatically created and used to store all     */\r\n  /*    pixel-size dependent information, available in the `face->size'    */\r\n  /*    field.                                                             */\r\n  /*                                                                       */\r\n  /*    It is however possible to create more sizes for a given face,      */\r\n  /*    mostly in order to manage several character pixel sizes of the     */\r\n  /*    same font family and style.  See @FT_New_Size and @FT_Done_Size.   */\r\n  /*                                                                       */\r\n  /*    Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only           */\r\n  /*    modify the contents of the current `active' size; you thus need    */\r\n  /*    to use @FT_Activate_Size to change it.                             */\r\n  /*                                                                       */\r\n  /*    99% of applications won't need the functions provided here,        */\r\n  /*    especially if they use the caching sub-system, so be cautious      */\r\n  /*    when using these.                                                  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Size                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Create a new size object from a given face object.                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to a parent face object.                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    asize :: A handle to a new size object.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You need to call @FT_Activate_Size in order to select the new size */\r\n  /*    for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size,      */\r\n  /*    @FT_Load_Glyph, @FT_Load_Char, etc.                                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_New_Size( FT_Face   face,\r\n               FT_Size*  size );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Size                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discard a given size object.  Note that @FT_Done_Face              */\r\n  /*    automatically discards all size objects allocated with             */\r\n  /*    @FT_New_Size.                                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size :: A handle to a target size object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Done_Size( FT_Size  size );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Activate_Size                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Even though it is possible to create several size objects for a    */\r\n  /*    given face (see @FT_New_Size for details), functions like          */\r\n  /*    @FT_Load_Glyph or @FT_Load_Char only use the one which has been    */\r\n  /*    activated last to determine the `current character pixel size'.    */\r\n  /*                                                                       */\r\n  /*    This function can be used to `activate' a previously created size  */\r\n  /*    object.                                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    size :: A handle to a target size object.                          */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    If `face' is the size's parent face object, this function changes  */\r\n  /*    the value of `face->size' to the input size handle.                */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Activate_Size( FT_Size  size );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSIZES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftsnames.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsnames.h                                                             */\r\n/*                                                                         */\r\n/*    Simple interface to access SFNT name tables (which are used          */\r\n/*    to hold font names, copyright info, notices, etc.) (specification).  */\r\n/*                                                                         */\r\n/*    This is _not_ used to retrieve glyph names!                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FT_SFNT_NAMES_H__\r\n#define __FT_SFNT_NAMES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    sfnt_names                                                         */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    SFNT Names                                                         */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Access the names embedded in TrueType and OpenType files.          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The TrueType and OpenType specifications allow the inclusion of    */\r\n  /*    a special `names table' in font files.  This table contains        */\r\n  /*    textual (and internationalized) information regarding the font,    */\r\n  /*    like family name, copyright, version, etc.                         */\r\n  /*                                                                       */\r\n  /*    The definitions below are used to access them if available.        */\r\n  /*                                                                       */\r\n  /*    Note that this has nothing to do with glyph names!                 */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_SfntName                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model an SFNT `name' table entry.              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    platform_id :: The platform ID for `string'.                       */\r\n  /*                                                                       */\r\n  /*    encoding_id :: The encoding ID for `string'.                       */\r\n  /*                                                                       */\r\n  /*    language_id :: The language ID for `string'.                       */\r\n  /*                                                                       */\r\n  /*    name_id     :: An identifier for `string'.                         */\r\n  /*                                                                       */\r\n  /*    string      :: The `name' string.  Note that its format differs    */\r\n  /*                   depending on the (platform,encoding) pair.  It can  */\r\n  /*                   be a Pascal String, a UTF-16 one, etc.              */\r\n  /*                                                                       */\r\n  /*                   Generally speaking, the string is not               */\r\n  /*                   zero-terminated.  Please refer to the TrueType      */\r\n  /*                   specification for details.                          */\r\n  /*                                                                       */\r\n  /*    string_len  :: The length of `string' in bytes.                    */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Possible values for `platform_id', `encoding_id', `language_id',   */\r\n  /*    and `name_id' are given in the file `ttnameid.h'.  For details     */\r\n  /*    please refer to the TrueType or OpenType specification.            */\r\n  /*                                                                       */\r\n  /*    See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX,       */\r\n  /*    @TT_ISO_ID_XXX, and @TT_MS_ID_XXX.                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_SfntName_\r\n  {\r\n    FT_UShort  platform_id;\r\n    FT_UShort  encoding_id;\r\n    FT_UShort  language_id;\r\n    FT_UShort  name_id;\r\n\r\n    FT_Byte*   string;      /* this string is *not* null-terminated! */\r\n    FT_UInt    string_len;  /* in bytes */\r\n\r\n  } FT_SfntName;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Sfnt_Name_Count                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve the number of name strings in the SFNT `name' table.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source face.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The number of strings in the `name' table.                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_UInt )\r\n  FT_Get_Sfnt_Name_Count( FT_Face  face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Sfnt_Name                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieve a string of the SFNT `name' table for a given index.      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face  :: A handle to the source face.                              */\r\n  /*                                                                       */\r\n  /*    idx   :: The index of the `name' string.                           */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aname :: The indexed @FT_SfntName structure.                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0~means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The `string' array returned in the `aname' structure is not        */\r\n  /*    null-terminated.  The application should deallocate it if it is no */\r\n  /*    longer in use.                                                     */\r\n  /*                                                                       */\r\n  /*    Use @FT_Get_Sfnt_Name_Count to get the total number of available   */\r\n  /*    `name' table entries, then do a loop until you get the right       */\r\n  /*    platform, encoding, and name ID.                                   */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_Sfnt_Name( FT_Face       face,\r\n                    FT_UInt       idx,\r\n                    FT_SfntName  *aname );\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @constant:\r\n   *   FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY\r\n   *\r\n   * @description:\r\n   *   A constant used as the tag of @FT_Parameter structures to make\r\n   *   FT_Open_Face() ignore preferred family subfamily names in `name'\r\n   *   table since OpenType version 1.4.  For backwards compatibility with\r\n   *   legacy systems which has 4-face-per-family restriction.\r\n   *\r\n   */\r\n#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY  FT_MAKE_TAG( 'i', 'g', 'p', 'f' )\r\n\r\n\r\n  /***************************************************************************\r\n   *\r\n   * @constant:\r\n   *   FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY\r\n   *\r\n   * @description:\r\n   *   A constant used as the tag of @FT_Parameter structures to make\r\n   *   FT_Open_Face() ignore preferred subfamily names in `name' table since\r\n   *   OpenType version 1.4.  For backwards compatibility with legacy\r\n   *   systems which has 4-face-per-family restriction.\r\n   *\r\n   */\r\n#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY  FT_MAKE_TAG( 'i', 'g', 'p', 's' )\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FT_SFNT_NAMES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftstroke.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstroke.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType path stroker (specification).                               */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FT_STROKE_H__\r\n#define __FT_STROKE_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_OUTLINE_H\r\n#include FT_GLYPH_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n /************************************************************************\r\n  *\r\n  * @section:\r\n  *    glyph_stroker\r\n  *\r\n  * @title:\r\n  *    Glyph Stroker\r\n  *\r\n  * @abstract:\r\n  *    Generating bordered and stroked glyphs.\r\n  *\r\n  * @description:\r\n  *    This component generates stroked outlines of a given vectorial\r\n  *    glyph.  It also allows you to retrieve the `outside' and/or the\r\n  *    `inside' borders of the stroke.\r\n  *\r\n  *    This can be useful to generate `bordered' glyph, i.e., glyphs\r\n  *    displayed with a coloured (and anti-aliased) border around their\r\n  *    shape.\r\n  */\r\n\r\n\r\n /**************************************************************\r\n  *\r\n  * @type:\r\n  *   FT_Stroker\r\n  *\r\n  * @description:\r\n  *   Opaque handler to a path stroker object.\r\n  */\r\n  typedef struct FT_StrokerRec_*  FT_Stroker;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_Stroker_LineJoin\r\n   *\r\n   * @description:\r\n   *   These values determine how two joining lines are rendered\r\n   *   in a stroker.\r\n   *\r\n   * @values:\r\n   *   FT_STROKER_LINEJOIN_ROUND ::\r\n   *     Used to render rounded line joins.  Circular arcs are used\r\n   *     to join two lines smoothly.\r\n   *\r\n   *   FT_STROKER_LINEJOIN_BEVEL ::\r\n   *     Used to render beveled line joins; i.e., the two joining lines\r\n   *     are extended until they intersect.\r\n   *\r\n   *   FT_STROKER_LINEJOIN_MITER ::\r\n   *     Same as beveled rendering, except that an additional line\r\n   *     break is added if the angle between the two joining lines\r\n   *     is too closed (this is useful to avoid unpleasant spikes\r\n   *     in beveled rendering).\r\n   */\r\n  typedef enum  FT_Stroker_LineJoin_\r\n  {\r\n    FT_STROKER_LINEJOIN_ROUND = 0,\r\n    FT_STROKER_LINEJOIN_BEVEL,\r\n    FT_STROKER_LINEJOIN_MITER\r\n\r\n  } FT_Stroker_LineJoin;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_Stroker_LineCap\r\n   *\r\n   * @description:\r\n   *   These values determine how the end of opened sub-paths are\r\n   *   rendered in a stroke.\r\n   *\r\n   * @values:\r\n   *   FT_STROKER_LINECAP_BUTT ::\r\n   *     The end of lines is rendered as a full stop on the last\r\n   *     point itself.\r\n   *\r\n   *   FT_STROKER_LINECAP_ROUND ::\r\n   *     The end of lines is rendered as a half-circle around the\r\n   *     last point.\r\n   *\r\n   *   FT_STROKER_LINECAP_SQUARE ::\r\n   *     The end of lines is rendered as a square around the\r\n   *     last point.\r\n   */\r\n  typedef enum  FT_Stroker_LineCap_\r\n  {\r\n    FT_STROKER_LINECAP_BUTT = 0,\r\n    FT_STROKER_LINECAP_ROUND,\r\n    FT_STROKER_LINECAP_SQUARE\r\n\r\n  } FT_Stroker_LineCap;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_StrokerBorder\r\n   *\r\n   * @description:\r\n   *   These values are used to select a given stroke border\r\n   *   in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.\r\n   *\r\n   * @values:\r\n   *   FT_STROKER_BORDER_LEFT ::\r\n   *     Select the left border, relative to the drawing direction.\r\n   *\r\n   *   FT_STROKER_BORDER_RIGHT ::\r\n   *     Select the right border, relative to the drawing direction.\r\n   *\r\n   * @note:\r\n   *   Applications are generally interested in the `inside' and `outside'\r\n   *   borders.  However, there is no direct mapping between these and the\r\n   *   `left' and `right' ones, since this really depends on the glyph's\r\n   *   drawing orientation, which varies between font formats.\r\n   *\r\n   *   You can however use @FT_Outline_GetInsideBorder and\r\n   *   @FT_Outline_GetOutsideBorder to get these.\r\n   */\r\n  typedef enum  FT_StrokerBorder_\r\n  {\r\n    FT_STROKER_BORDER_LEFT = 0,\r\n    FT_STROKER_BORDER_RIGHT\r\n\r\n  } FT_StrokerBorder;\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Outline_GetInsideBorder\r\n   *\r\n   * @description:\r\n   *   Retrieve the @FT_StrokerBorder value corresponding to the\r\n   *   `inside' borders of a given outline.\r\n   *\r\n   * @input:\r\n   *   outline ::\r\n   *     The source outline handle.\r\n   *\r\n   * @return:\r\n   *   The border index.  @FT_STROKER_BORDER_RIGHT for empty or invalid\r\n   *   outlines.\r\n   */\r\n  FT_EXPORT( FT_StrokerBorder )\r\n  FT_Outline_GetInsideBorder( FT_Outline*  outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Outline_GetOutsideBorder\r\n   *\r\n   * @description:\r\n   *   Retrieve the @FT_StrokerBorder value corresponding to the\r\n   *   `outside' borders of a given outline.\r\n   *\r\n   * @input:\r\n   *   outline ::\r\n   *     The source outline handle.\r\n   *\r\n   * @return:\r\n   *   The border index.  @FT_STROKER_BORDER_LEFT for empty or invalid\r\n   *   outlines.\r\n   */\r\n  FT_EXPORT( FT_StrokerBorder )\r\n  FT_Outline_GetOutsideBorder( FT_Outline*  outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_New\r\n   *\r\n   * @description:\r\n   *   Create a new stroker object.\r\n   *\r\n   * @input:\r\n   *   library ::\r\n   *     FreeType library handle.\r\n   *\r\n   * @output:\r\n   *   astroker ::\r\n   *     A new stroker object handle.  NULL in case of error.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_New( FT_Library   library,\r\n                  FT_Stroker  *astroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Set\r\n   *\r\n   * @description:\r\n   *   Reset a stroker object's attributes.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   radius ::\r\n   *     The border radius.\r\n   *\r\n   *   line_cap ::\r\n   *     The line cap style.\r\n   *\r\n   *   line_join ::\r\n   *     The line join style.\r\n   *\r\n   *   miter_limit ::\r\n   *     The miter limit for the FT_STROKER_LINEJOIN_MITER style,\r\n   *     expressed as 16.16 fixed point value.\r\n   *\r\n   * @note:\r\n   *   The radius is expressed in the same units as the outline\r\n   *   coordinates.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Set( FT_Stroker           stroker,\r\n                  FT_Fixed             radius,\r\n                  FT_Stroker_LineCap   line_cap,\r\n                  FT_Stroker_LineJoin  line_join,\r\n                  FT_Fixed             miter_limit );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Rewind\r\n   *\r\n   * @description:\r\n   *   Reset a stroker object without changing its attributes.\r\n   *   You should call this function before beginning a new\r\n   *   series of calls to @FT_Stroker_BeginSubPath or\r\n   *   @FT_Stroker_EndSubPath.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Rewind( FT_Stroker  stroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_ParseOutline\r\n   *\r\n   * @description:\r\n   *   A convenience function used to parse a whole outline with\r\n   *   the stroker.  The resulting outline(s) can be retrieved\r\n   *   later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   outline ::\r\n   *     The source outline.\r\n   *\r\n   *   opened ::\r\n   *     A boolean.  If~1, the outline is treated as an open path instead\r\n   *     of a closed one.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   If `opened' is~0 (the default), the outline is treated as a closed\r\n   *   path, and the stroker generates two distinct `border' outlines.\r\n   *\r\n   *   If `opened' is~1, the outline is processed as an open path, and the\r\n   *   stroker generates a single `stroke' outline.\r\n   *\r\n   *   This function calls @FT_Stroker_Rewind automatically.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_ParseOutline( FT_Stroker   stroker,\r\n                           FT_Outline*  outline,\r\n                           FT_Bool      opened );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_BeginSubPath\r\n   *\r\n   * @description:\r\n   *   Start a new sub-path in the stroker.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the start vector.\r\n   *\r\n   *   open ::\r\n   *     A boolean.  If~1, the sub-path is treated as an open one.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   This function is useful when you need to stroke a path that is\r\n   *   not stored as an @FT_Outline object.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_BeginSubPath( FT_Stroker  stroker,\r\n                           FT_Vector*  to,\r\n                           FT_Bool     open );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_EndSubPath\r\n   *\r\n   * @description:\r\n   *   Close the current sub-path in the stroker.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function after @FT_Stroker_BeginSubPath.\r\n   *   If the subpath was not `opened', this function `draws' a\r\n   *   single line segment to the start position when needed.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_EndSubPath( FT_Stroker  stroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_LineTo\r\n   *\r\n   * @description:\r\n   *   `Draw' a single line segment in the stroker's current sub-path,\r\n   *   from the last position.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the destination point.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function between @FT_Stroker_BeginSubPath and\r\n   *   @FT_Stroker_EndSubPath.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_LineTo( FT_Stroker  stroker,\r\n                     FT_Vector*  to );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_ConicTo\r\n   *\r\n   * @description:\r\n   *   `Draw' a single quadratic Bézier in the stroker's current sub-path,\r\n   *   from the last position.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   control ::\r\n   *     A pointer to a Bézier control point.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the destination point.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function between @FT_Stroker_BeginSubPath and\r\n   *   @FT_Stroker_EndSubPath.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_ConicTo( FT_Stroker  stroker,\r\n                      FT_Vector*  control,\r\n                      FT_Vector*  to );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_CubicTo\r\n   *\r\n   * @description:\r\n   *   `Draw' a single cubic Bézier in the stroker's current sub-path,\r\n   *   from the last position.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   control1 ::\r\n   *     A pointer to the first Bézier control point.\r\n   *\r\n   *   control2 ::\r\n   *     A pointer to second Bézier control point.\r\n   *\r\n   *   to ::\r\n   *     A pointer to the destination point.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   You should call this function between @FT_Stroker_BeginSubPath and\r\n   *   @FT_Stroker_EndSubPath.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_CubicTo( FT_Stroker  stroker,\r\n                      FT_Vector*  control1,\r\n                      FT_Vector*  control2,\r\n                      FT_Vector*  to );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_GetBorderCounts\r\n   *\r\n   * @description:\r\n   *   Call this function once you have finished parsing your paths\r\n   *   with the stroker.  It returns the number of points and\r\n   *   contours necessary to export one of the `border' or `stroke'\r\n   *   outlines generated by the stroker.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   border ::\r\n   *     The border index.\r\n   *\r\n   * @output:\r\n   *   anum_points ::\r\n   *     The number of points.\r\n   *\r\n   *   anum_contours ::\r\n   *     The number of contours.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   When an outline, or a sub-path, is `closed', the stroker generates\r\n   *   two independent `border' outlines, named `left' and `right'.\r\n   *\r\n   *   When the outline, or a sub-path, is `opened', the stroker merges\r\n   *   the `border' outlines with caps.  The `left' border receives all\r\n   *   points, while the `right' border becomes empty.\r\n   *\r\n   *   Use the function @FT_Stroker_GetCounts instead if you want to\r\n   *   retrieve the counts associated to both borders.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_GetBorderCounts( FT_Stroker        stroker,\r\n                              FT_StrokerBorder  border,\r\n                              FT_UInt          *anum_points,\r\n                              FT_UInt          *anum_contours );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_ExportBorder\r\n   *\r\n   * @description:\r\n   *   Call this function after @FT_Stroker_GetBorderCounts to\r\n   *   export the corresponding border to your own @FT_Outline\r\n   *   structure.\r\n   *\r\n   *   Note that this function appends the border points and\r\n   *   contours to your outline, but does not try to resize its\r\n   *   arrays.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   border ::\r\n   *     The border index.\r\n   *\r\n   *   outline ::\r\n   *     The target outline handle.\r\n   *\r\n   * @note:\r\n   *   Always call this function after @FT_Stroker_GetBorderCounts to\r\n   *   get sure that there is enough room in your @FT_Outline object to\r\n   *   receive all new data.\r\n   *\r\n   *   When an outline, or a sub-path, is `closed', the stroker generates\r\n   *   two independent `border' outlines, named `left' and `right'\r\n   *\r\n   *   When the outline, or a sub-path, is `opened', the stroker merges\r\n   *   the `border' outlines with caps. The `left' border receives all\r\n   *   points, while the `right' border becomes empty.\r\n   *\r\n   *   Use the function @FT_Stroker_Export instead if you want to\r\n   *   retrieve all borders at once.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_ExportBorder( FT_Stroker        stroker,\r\n                           FT_StrokerBorder  border,\r\n                           FT_Outline*       outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_GetCounts\r\n   *\r\n   * @description:\r\n   *   Call this function once you have finished parsing your paths\r\n   *   with the stroker.  It returns the number of points and\r\n   *   contours necessary to export all points/borders from the stroked\r\n   *   outline/path.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   * @output:\r\n   *   anum_points ::\r\n   *     The number of points.\r\n   *\r\n   *   anum_contours ::\r\n   *     The number of contours.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Stroker_GetCounts( FT_Stroker  stroker,\r\n                        FT_UInt    *anum_points,\r\n                        FT_UInt    *anum_contours );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Export\r\n   *\r\n   * @description:\r\n   *   Call this function after @FT_Stroker_GetBorderCounts to\r\n   *   export all borders to your own @FT_Outline structure.\r\n   *\r\n   *   Note that this function appends the border points and\r\n   *   contours to your outline, but does not try to resize its\r\n   *   arrays.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     The target stroker handle.\r\n   *\r\n   *   outline ::\r\n   *     The target outline handle.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Export( FT_Stroker   stroker,\r\n                     FT_Outline*  outline );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Stroker_Done\r\n   *\r\n   * @description:\r\n   *   Destroy a stroker object.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     A stroker handle.  Can be NULL.\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Stroker_Done( FT_Stroker  stroker );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Glyph_Stroke\r\n   *\r\n   * @description:\r\n   *   Stroke a given outline glyph object with a given stroker.\r\n   *\r\n   * @inout:\r\n   *   pglyph ::\r\n   *     Source glyph handle on input, new glyph handle on output.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     A stroker handle.\r\n   *\r\n   *   destroy ::\r\n   *     A Boolean.  If~1, the source glyph object is destroyed\r\n   *     on success.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   The source glyph is untouched in case of error.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_Stroke( FT_Glyph    *pglyph,\r\n                   FT_Stroker   stroker,\r\n                   FT_Bool      destroy );\r\n\r\n\r\n  /**************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Glyph_StrokeBorder\r\n   *\r\n   * @description:\r\n   *   Stroke a given outline glyph object with a given stroker, but\r\n   *   only return either its inside or outside border.\r\n   *\r\n   * @inout:\r\n   *   pglyph ::\r\n   *     Source glyph handle on input, new glyph handle on output.\r\n   *\r\n   * @input:\r\n   *   stroker ::\r\n   *     A stroker handle.\r\n   *\r\n   *   inside ::\r\n   *     A Boolean.  If~1, return the inside border, otherwise\r\n   *     the outside border.\r\n   *\r\n   *   destroy ::\r\n   *     A Boolean.  If~1, the source glyph object is destroyed\r\n   *     on success.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   The source glyph is untouched in case of error.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Glyph_StrokeBorder( FT_Glyph    *pglyph,\r\n                         FT_Stroker   stroker,\r\n                         FT_Bool      inside,\r\n                         FT_Bool      destroy );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FT_STROKE_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftsynth.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsynth.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType synthesizing code for emboldening and slanting              */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 2000-2001, 2003, 2006, 2008 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*********                                                       *********/\r\n  /*********        WARNING, THIS IS ALPHA CODE!  THIS API         *********/\r\n  /*********    IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE    *********/\r\n  /*********            FREETYPE DEVELOPMENT TEAM                  *********/\r\n  /*********                                                       *********/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Main reason for not lifting the functions in this module to a  */\r\n  /* `standard' API is that the used parameters for emboldening and */\r\n  /* slanting are not configurable.  Consider the functions as a    */\r\n  /* code resource which should be copied into the application and  */\r\n  /* adapted to the particular needs.                               */\r\n\r\n\r\n#ifndef __FTSYNTH_H__\r\n#define __FTSYNTH_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /* Embolden a glyph by a `reasonable' value (which is highly a matter of */\r\n  /* taste).  This function is actually a convenience function, providing  */\r\n  /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden.           */\r\n  /*                                                                       */\r\n  /* For emboldened outlines the metrics are estimates only; if you need   */\r\n  /* precise values you should call @FT_Outline_Get_CBox.                  */\r\n  FT_EXPORT( void )\r\n  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );\r\n\r\n  /* Slant an outline glyph to the right by about 12 degrees. */\r\n  FT_EXPORT( void )\r\n  FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSYNTH_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftsystem.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftsystem.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType low-level system interface definition (specification).      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2005, 2010 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTSYSTEM_H__\r\n#define __FTSYSTEM_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*   system_interface                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*   System Interface                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*   How FreeType manages memory and i/o.                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   This section contains various definitions related to memory         */\r\n  /*   management and i/o access.  You need to understand this             */\r\n  /*   information if you want to use a custom memory manager or you own   */\r\n  /*   i/o streams.                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                  M E M O R Y   M A N A G E M E N T                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Memory\r\n   *\r\n   * @description:\r\n   *   A handle to a given memory manager object, defined with an\r\n   *   @FT_MemoryRec structure.\r\n   *\r\n   */\r\n  typedef struct FT_MemoryRec_*  FT_Memory;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Alloc_Func\r\n   *\r\n   * @description:\r\n   *   A function used to allocate `size' bytes from `memory'.\r\n   *\r\n   * @input:\r\n   *   memory ::\r\n   *     A handle to the source memory manager.\r\n   *\r\n   *   size ::\r\n   *     The size in bytes to allocate.\r\n   *\r\n   * @return:\r\n   *   Address of new memory block.  0~in case of failure.\r\n   *\r\n   */\r\n  typedef void*\r\n  (*FT_Alloc_Func)( FT_Memory  memory,\r\n                    long       size );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Free_Func\r\n   *\r\n   * @description:\r\n   *   A function used to release a given block of memory.\r\n   *\r\n   * @input:\r\n   *   memory ::\r\n   *     A handle to the source memory manager.\r\n   *\r\n   *   block ::\r\n   *     The address of the target memory block.\r\n   *\r\n   */\r\n  typedef void\r\n  (*FT_Free_Func)( FT_Memory  memory,\r\n                   void*      block );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Realloc_Func\r\n   *\r\n   * @description:\r\n   *   A function used to re-allocate a given block of memory.\r\n   *\r\n   * @input:\r\n   *   memory ::\r\n   *     A handle to the source memory manager.\r\n   *\r\n   *   cur_size ::\r\n   *     The block's current size in bytes.\r\n   *\r\n   *   new_size ::\r\n   *     The block's requested new size.\r\n   *\r\n   *   block ::\r\n   *     The block's current address.\r\n   *\r\n   * @return:\r\n   *   New block address.  0~in case of memory shortage.\r\n   *\r\n   * @note:\r\n   *   In case of error, the old block must still be available.\r\n   *\r\n   */\r\n  typedef void*\r\n  (*FT_Realloc_Func)( FT_Memory  memory,\r\n                      long       cur_size,\r\n                      long       new_size,\r\n                      void*      block );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_MemoryRec\r\n   *\r\n   * @description:\r\n   *   A structure used to describe a given memory manager to FreeType~2.\r\n   *\r\n   * @fields:\r\n   *   user ::\r\n   *     A generic typeless pointer for user data.\r\n   *\r\n   *   alloc ::\r\n   *     A pointer type to an allocation function.\r\n   *\r\n   *   free ::\r\n   *     A pointer type to an memory freeing function.\r\n   *\r\n   *   realloc ::\r\n   *     A pointer type to a reallocation function.\r\n   *\r\n   */\r\n  struct  FT_MemoryRec_\r\n  {\r\n    void*            user;\r\n    FT_Alloc_Func    alloc;\r\n    FT_Free_Func     free;\r\n    FT_Realloc_Func  realloc;\r\n  };\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                       I / O   M A N A G E M E N T                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Stream\r\n   *\r\n   * @description:\r\n   *   A handle to an input stream.\r\n   *\r\n   */\r\n  typedef struct FT_StreamRec_*  FT_Stream;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_StreamDesc\r\n   *\r\n   * @description:\r\n   *   A union type used to store either a long or a pointer.  This is used\r\n   *   to store a file descriptor or a `FILE*' in an input stream.\r\n   *\r\n   */\r\n  typedef union  FT_StreamDesc_\r\n  {\r\n    long   value;\r\n    void*  pointer;\r\n\r\n  } FT_StreamDesc;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Stream_IoFunc\r\n   *\r\n   * @description:\r\n   *   A function used to seek and read data from a given input stream.\r\n   *\r\n   * @input:\r\n   *   stream ::\r\n   *     A handle to the source stream.\r\n   *\r\n   *   offset ::\r\n   *     The offset of read in stream (always from start).\r\n   *\r\n   *   buffer ::\r\n   *     The address of the read buffer.\r\n   *\r\n   *   count ::\r\n   *     The number of bytes to read from the stream.\r\n   *\r\n   * @return:\r\n   *   The number of bytes effectively read by the stream.\r\n   *\r\n   * @note:\r\n   *   This function might be called to perform a seek or skip operation\r\n   *   with a `count' of~0.  A non-zero return value then indicates an\r\n   *   error.\r\n   *\r\n   */\r\n  typedef unsigned long\r\n  (*FT_Stream_IoFunc)( FT_Stream       stream,\r\n                       unsigned long   offset,\r\n                       unsigned char*  buffer,\r\n                       unsigned long   count );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   FT_Stream_CloseFunc\r\n   *\r\n   * @description:\r\n   *   A function used to close a given input stream.\r\n   *\r\n   * @input:\r\n   *  stream ::\r\n   *     A handle to the target stream.\r\n   *\r\n   */\r\n  typedef void\r\n  (*FT_Stream_CloseFunc)( FT_Stream  stream );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   FT_StreamRec\r\n   *\r\n   * @description:\r\n   *   A structure used to describe an input stream.\r\n   *\r\n   * @input:\r\n   *   base ::\r\n   *     For memory-based streams, this is the address of the first stream\r\n   *     byte in memory.  This field should always be set to NULL for\r\n   *     disk-based streams.\r\n   *\r\n   *   size ::\r\n   *     The stream size in bytes.\r\n   *\r\n   *   pos ::\r\n   *     The current position within the stream.\r\n   *\r\n   *   descriptor ::\r\n   *     This field is a union that can hold an integer or a pointer.  It is\r\n   *     used by stream implementations to store file descriptors or `FILE*'\r\n   *     pointers.\r\n   *\r\n   *   pathname ::\r\n   *     This field is completely ignored by FreeType.  However, it is often\r\n   *     useful during debugging to use it to store the stream's filename\r\n   *     (where available).\r\n   *\r\n   *   read ::\r\n   *     The stream's input function.\r\n   *\r\n   *   close ::\r\n   *     The stream's close function.\r\n   *\r\n   *   memory ::\r\n   *     The memory manager to use to preload frames.  This is set\r\n   *     internally by FreeType and shouldn't be touched by stream\r\n   *     implementations.\r\n   *\r\n   *   cursor ::\r\n   *     This field is set and used internally by FreeType when parsing\r\n   *     frames.\r\n   *\r\n   *   limit ::\r\n   *     This field is set and used internally by FreeType when parsing\r\n   *     frames.\r\n   *\r\n   */\r\n  typedef struct  FT_StreamRec_\r\n  {\r\n    unsigned char*       base;\r\n    unsigned long        size;\r\n    unsigned long        pos;\r\n\r\n    FT_StreamDesc        descriptor;\r\n    FT_StreamDesc        pathname;\r\n    FT_Stream_IoFunc     read;\r\n    FT_Stream_CloseFunc  close;\r\n\r\n    FT_Memory            memory;\r\n    unsigned char*       cursor;\r\n    unsigned char*       limit;\r\n\r\n  } FT_StreamRec;\r\n\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSYSTEM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/fttrigon.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttrigon.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType trigonometric functions (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2003, 2005, 2007 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTTRIGON_H__\r\n#define __FTTRIGON_H__\r\n\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*   computations                                                        */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   FT_Angle\r\n   *\r\n   * @description:\r\n   *   This type is used to model angle values in FreeType.  Note that the\r\n   *   angle is a 16.16 fixed float value expressed in degrees.\r\n   *\r\n   */\r\n  typedef FT_Fixed  FT_Angle;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_PI\r\n   *\r\n   * @description:\r\n   *   The angle pi expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_PI  ( 180L << 16 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_2PI\r\n   *\r\n   * @description:\r\n   *   The angle 2*pi expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_2PI  ( FT_ANGLE_PI * 2 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_PI2\r\n   *\r\n   * @description:\r\n   *   The angle pi/2 expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_PI2  ( FT_ANGLE_PI / 2 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @macro:\r\n   *   FT_ANGLE_PI4\r\n   *\r\n   * @description:\r\n   *   The angle pi/4 expressed in @FT_Angle units.\r\n   *\r\n   */\r\n#define FT_ANGLE_PI4  ( FT_ANGLE_PI / 4 )\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Sin\r\n   *\r\n   * @description:\r\n   *   Return the sinus of a given angle in fixed point format.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The input angle.\r\n   *\r\n   * @return:\r\n   *   The sinus value.\r\n   *\r\n   * @note:\r\n   *   If you need both the sinus and cosinus for a given angle, use the\r\n   *   function @FT_Vector_Unit.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Sin( FT_Angle  angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Cos\r\n   *\r\n   * @description:\r\n   *   Return the cosinus of a given angle in fixed point format.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The input angle.\r\n   *\r\n   * @return:\r\n   *   The cosinus value.\r\n   *\r\n   * @note:\r\n   *   If you need both the sinus and cosinus for a given angle, use the\r\n   *   function @FT_Vector_Unit.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Cos( FT_Angle  angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Tan\r\n   *\r\n   * @description:\r\n   *   Return the tangent of a given angle in fixed point format.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The input angle.\r\n   *\r\n   * @return:\r\n   *   The tangent value.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Tan( FT_Angle  angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Atan2\r\n   *\r\n   * @description:\r\n   *   Return the arc-tangent corresponding to a given vector (x,y) in\r\n   *   the 2d plane.\r\n   *\r\n   * @input:\r\n   *   x ::\r\n   *     The horizontal vector coordinate.\r\n   *\r\n   *   y ::\r\n   *     The vertical vector coordinate.\r\n   *\r\n   * @return:\r\n   *   The arc-tangent value (i.e. angle).\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Angle )\r\n  FT_Atan2( FT_Fixed  x,\r\n            FT_Fixed  y );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Angle_Diff\r\n   *\r\n   * @description:\r\n   *   Return the difference between two angles.  The result is always\r\n   *   constrained to the ]-PI..PI] interval.\r\n   *\r\n   * @input:\r\n   *   angle1 ::\r\n   *     First angle.\r\n   *\r\n   *   angle2 ::\r\n   *     Second angle.\r\n   *\r\n   * @return:\r\n   *   Constrained value of `value2-value1'.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Angle )\r\n  FT_Angle_Diff( FT_Angle  angle1,\r\n                 FT_Angle  angle2 );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Unit\r\n   *\r\n   * @description:\r\n   *   Return the unit vector corresponding to a given angle.  After the\r\n   *   call, the value of `vec.x' will be `sin(angle)', and the value of\r\n   *   `vec.y' will be `cos(angle)'.\r\n   *\r\n   *   This function is useful to retrieve both the sinus and cosinus of a\r\n   *   given angle quickly.\r\n   *\r\n   * @output:\r\n   *   vec ::\r\n   *     The address of target vector.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The address of angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Unit( FT_Vector*  vec,\r\n                  FT_Angle    angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Rotate\r\n   *\r\n   * @description:\r\n   *   Rotate a vector by a given angle.\r\n   *\r\n   * @inout:\r\n   *   vec ::\r\n   *     The address of target vector.\r\n   *\r\n   * @input:\r\n   *   angle ::\r\n   *     The address of angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Rotate( FT_Vector*  vec,\r\n                    FT_Angle    angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Length\r\n   *\r\n   * @description:\r\n   *   Return the length of a given vector.\r\n   *\r\n   * @input:\r\n   *   vec ::\r\n   *     The address of target vector.\r\n   *\r\n   * @return:\r\n   *   The vector length, expressed in the same units that the original\r\n   *   vector coordinates.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Fixed )\r\n  FT_Vector_Length( FT_Vector*  vec );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_Polarize\r\n   *\r\n   * @description:\r\n   *   Compute both the length and angle of a given vector.\r\n   *\r\n   * @input:\r\n   *   vec ::\r\n   *     The address of source vector.\r\n   *\r\n   * @output:\r\n   *   length ::\r\n   *     The vector length.\r\n   *\r\n   *   angle ::\r\n   *     The vector angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_Polarize( FT_Vector*  vec,\r\n                      FT_Fixed   *length,\r\n                      FT_Angle   *angle );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @function:\r\n   *   FT_Vector_From_Polar\r\n   *\r\n   * @description:\r\n   *   Compute vector coordinates from a length and angle.\r\n   *\r\n   * @output:\r\n   *   vec ::\r\n   *     The address of source vector.\r\n   *\r\n   * @input:\r\n   *   length ::\r\n   *     The vector length.\r\n   *\r\n   *   angle ::\r\n   *     The vector angle.\r\n   *\r\n   */\r\n  FT_EXPORT( void )\r\n  FT_Vector_From_Polar( FT_Vector*  vec,\r\n                        FT_Fixed    length,\r\n                        FT_Angle    angle );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTTRIGON_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/fttypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttypes.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType simple types definitions (specification only).              */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTTYPES_H__\r\n#define __FTTYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_SYSTEM_H\r\n#include FT_IMAGE_H\r\n\r\n#include <stddef.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    basic_types                                                        */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Basic Data Types                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    The basic data types defined by the library.                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the basic data types defined by FreeType~2,  */\r\n  /*    ranging from simple scalar types to bitmap descriptors.  More      */\r\n  /*    font-specific structures are defined in a different section.       */\r\n  /*                                                                       */\r\n  /* <Order>                                                               */\r\n  /*    FT_Byte                                                            */\r\n  /*    FT_Bytes                                                           */\r\n  /*    FT_Char                                                            */\r\n  /*    FT_Int                                                             */\r\n  /*    FT_UInt                                                            */\r\n  /*    FT_Int16                                                           */\r\n  /*    FT_UInt16                                                          */\r\n  /*    FT_Int32                                                           */\r\n  /*    FT_UInt32                                                          */\r\n  /*    FT_Short                                                           */\r\n  /*    FT_UShort                                                          */\r\n  /*    FT_Long                                                            */\r\n  /*    FT_ULong                                                           */\r\n  /*    FT_Bool                                                            */\r\n  /*    FT_Offset                                                          */\r\n  /*    FT_PtrDist                                                         */\r\n  /*    FT_String                                                          */\r\n  /*    FT_Tag                                                             */\r\n  /*    FT_Error                                                           */\r\n  /*    FT_Fixed                                                           */\r\n  /*    FT_Pointer                                                         */\r\n  /*    FT_Pos                                                             */\r\n  /*    FT_Vector                                                          */\r\n  /*    FT_BBox                                                            */\r\n  /*    FT_Matrix                                                          */\r\n  /*    FT_FWord                                                           */\r\n  /*    FT_UFWord                                                          */\r\n  /*    FT_F2Dot14                                                         */\r\n  /*    FT_UnitVector                                                      */\r\n  /*    FT_F26Dot6                                                         */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*    FT_Generic                                                         */\r\n  /*    FT_Generic_Finalizer                                               */\r\n  /*                                                                       */\r\n  /*    FT_Bitmap                                                          */\r\n  /*    FT_Pixel_Mode                                                      */\r\n  /*    FT_Palette_Mode                                                    */\r\n  /*    FT_Glyph_Format                                                    */\r\n  /*    FT_IMAGE_TAG                                                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Bool                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef of unsigned char, used for simple booleans.  As usual,   */\r\n  /*    values 1 and~0 represent true and false, respectively.             */\r\n  /*                                                                       */\r\n  typedef unsigned char  FT_Bool;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_FWord                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A signed 16-bit integer used to store a distance in original font  */\r\n  /*    units.                                                             */\r\n  /*                                                                       */\r\n  typedef signed short  FT_FWord;   /* distance in FUnits */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UFWord                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An unsigned 16-bit integer used to store a distance in original    */\r\n  /*    font units.                                                        */\r\n  /*                                                                       */\r\n  typedef unsigned short  FT_UFWord;  /* unsigned distance */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Char                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for the _signed_ char type.                       */\r\n  /*                                                                       */\r\n  typedef signed char  FT_Char;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Byte                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for the _unsigned_ char type.                     */\r\n  /*                                                                       */\r\n  typedef unsigned char  FT_Byte;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Bytes                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for constant memory areas.                               */\r\n  /*                                                                       */\r\n  typedef const FT_Byte*  FT_Bytes;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Tag                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for 32-bit tags (as used in the SFNT format).            */\r\n  /*                                                                       */\r\n  typedef FT_UInt32  FT_Tag;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_String                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for the char type, usually used for strings.      */\r\n  /*                                                                       */\r\n  typedef char  FT_String;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Short                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for signed short.                                        */\r\n  /*                                                                       */\r\n  typedef signed short  FT_Short;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UShort                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for unsigned short.                                      */\r\n  /*                                                                       */\r\n  typedef unsigned short  FT_UShort;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Int                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for the int type.                                        */\r\n  /*                                                                       */\r\n  typedef signed int  FT_Int;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_UInt                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for the unsigned int type.                               */\r\n  /*                                                                       */\r\n  typedef unsigned int  FT_UInt;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Long                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for signed long.                                         */\r\n  /*                                                                       */\r\n  typedef signed long  FT_Long;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_ULong                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A typedef for unsigned long.                                       */\r\n  /*                                                                       */\r\n  typedef unsigned long  FT_ULong;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_F2Dot14                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A signed 2.14 fixed float type used for unit vectors.              */\r\n  /*                                                                       */\r\n  typedef signed short  FT_F2Dot14;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_F26Dot6                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A signed 26.6 fixed float type used for vectorial pixel            */\r\n  /*    coordinates.                                                       */\r\n  /*                                                                       */\r\n  typedef signed long  FT_F26Dot6;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Fixed                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This type is used to store 16.16 fixed float values, like scaling  */\r\n  /*    values or matrix coefficients.                                     */\r\n  /*                                                                       */\r\n  typedef signed long  FT_Fixed;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Error                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The FreeType error code type.  A value of~0 is always interpreted  */\r\n  /*    as a successful operation.                                         */\r\n  /*                                                                       */\r\n  typedef int  FT_Error;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Pointer                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple typedef for a typeless pointer.                           */\r\n  /*                                                                       */\r\n  typedef void*  FT_Pointer;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_Offset                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is equivalent to the ANSI~C `size_t' type, i.e., the largest  */\r\n  /*    _unsigned_ integer type used to express a file size or position,   */\r\n  /*    or a memory block size.                                            */\r\n  /*                                                                       */\r\n  typedef size_t  FT_Offset;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_PtrDist                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the       */\r\n  /*    largest _signed_ integer type used to express the distance         */\r\n  /*    between two pointers.                                              */\r\n  /*                                                                       */\r\n  typedef ft_ptrdiff_t  FT_PtrDist;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_UnitVector                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to store a 2D vector unit vector.  Uses    */\r\n  /*    FT_F2Dot14 types.                                                  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    x :: Horizontal coordinate.                                        */\r\n  /*                                                                       */\r\n  /*    y :: Vertical coordinate.                                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_UnitVector_\r\n  {\r\n    FT_F2Dot14  x;\r\n    FT_F2Dot14  y;\r\n\r\n  } FT_UnitVector;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Matrix                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure used to store a 2x2 matrix.  Coefficients are   */\r\n  /*    in 16.16 fixed float format.  The computation performed is:        */\r\n  /*                                                                       */\r\n  /*       {                                                               */\r\n  /*          x' = x*xx + y*xy                                             */\r\n  /*          y' = x*yx + y*yy                                             */\r\n  /*       }                                                               */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    xx :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  /*    xy :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  /*    yx :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  /*    yy :: Matrix coefficient.                                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_Matrix_\r\n  {\r\n    FT_Fixed  xx, xy;\r\n    FT_Fixed  yx, yy;\r\n\r\n  } FT_Matrix;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Data                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Read-only binary data represented as a pointer and a length.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    pointer :: The data.                                               */\r\n  /*                                                                       */\r\n  /*    length  :: The length of the data in bytes.                        */\r\n  /*                                                                       */\r\n  typedef struct  FT_Data_\r\n  {\r\n    const FT_Byte*  pointer;\r\n    FT_Int          length;\r\n\r\n  } FT_Data;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Generic_Finalizer                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Describe a function used to destroy the `client' data of any       */\r\n  /*    FreeType object.  See the description of the @FT_Generic type for  */\r\n  /*    details of usage.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    The address of the FreeType object which is under finalization.    */\r\n  /*    Its client data is accessed through its `generic' field.           */\r\n  /*                                                                       */\r\n  typedef void  (*FT_Generic_Finalizer)(void*  object);\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Generic                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Client applications often need to associate their own data to a    */\r\n  /*    variety of FreeType core objects.  For example, a text layout API  */\r\n  /*    might want to associate a glyph cache to a given size object.      */\r\n  /*                                                                       */\r\n  /*    Most FreeType object contains a `generic' field, of type           */\r\n  /*    FT_Generic, which usage is left to client applications and font    */\r\n  /*    servers.                                                           */\r\n  /*                                                                       */\r\n  /*    It can be used to store a pointer to client-specific data, as well */\r\n  /*    as the address of a `finalizer' function, which will be called by  */\r\n  /*    FreeType when the object is destroyed (for example, the previous   */\r\n  /*    client example would put the address of the glyph cache destructor */\r\n  /*    in the `finalizer' field).                                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    data      :: A typeless pointer to any client-specified data. This */\r\n  /*                 field is completely ignored by the FreeType library.  */\r\n  /*                                                                       */\r\n  /*    finalizer :: A pointer to a `generic finalizer' function, which    */\r\n  /*                 will be called when the object is destroyed.  If this */\r\n  /*                 field is set to NULL, no code will be called.         */\r\n  /*                                                                       */\r\n  typedef struct  FT_Generic_\r\n  {\r\n    void*                 data;\r\n    FT_Generic_Finalizer  finalizer;\r\n\r\n  } FT_Generic;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_MAKE_TAG                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro converts four-letter tags which are used to label       */\r\n  /*    TrueType tables into an unsigned long to be used within FreeType.  */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The produced values *must* be 32-bit integers.  Don't redefine     */\r\n  /*    this macro.                                                        */\r\n  /*                                                                       */\r\n#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \\\r\n          (FT_Tag)                        \\\r\n          ( ( (FT_ULong)_x1 << 24 ) |     \\\r\n            ( (FT_ULong)_x2 << 16 ) |     \\\r\n            ( (FT_ULong)_x3 <<  8 ) |     \\\r\n              (FT_ULong)_x4         )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                    L I S T   M A N A G E M E N T                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    list_processing                                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_ListNode                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*     Many elements and objects in FreeType are listed through an       */\r\n  /*     @FT_List record (see @FT_ListRec).  As its name suggests, an      */\r\n  /*     FT_ListNode is a handle to a single list element.                 */\r\n  /*                                                                       */\r\n  typedef struct FT_ListNodeRec_*  FT_ListNode;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    FT_List                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a list record (see @FT_ListRec).                       */\r\n  /*                                                                       */\r\n  typedef struct FT_ListRec_*  FT_List;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_ListNodeRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold a single list element.                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    prev :: The previous element in the list.  NULL if first.          */\r\n  /*                                                                       */\r\n  /*    next :: The next element in the list.  NULL if last.               */\r\n  /*                                                                       */\r\n  /*    data :: A typeless pointer to the listed object.                   */\r\n  /*                                                                       */\r\n  typedef struct  FT_ListNodeRec_\r\n  {\r\n    FT_ListNode  prev;\r\n    FT_ListNode  next;\r\n    void*        data;\r\n\r\n  } FT_ListNodeRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_ListRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold a simple doubly-linked list.  These are   */\r\n  /*    used in many parts of FreeType.                                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    head :: The head (first element) of doubly-linked list.            */\r\n  /*                                                                       */\r\n  /*    tail :: The tail (last element) of doubly-linked list.             */\r\n  /*                                                                       */\r\n  typedef struct  FT_ListRec_\r\n  {\r\n    FT_ListNode  head;\r\n    FT_ListNode  tail;\r\n\r\n  } FT_ListRec;\r\n\r\n\r\n  /* */\r\n\r\n#define FT_IS_EMPTY( list )  ( (list).head == 0 )\r\n\r\n  /* return base error code (without module-specific prefix) */\r\n#define FT_ERROR_BASE( x )    ( (x) & 0xFF )\r\n\r\n  /* return module error code */\r\n#define FT_ERROR_MODULE( x )  ( (x) & 0xFF00U )\r\n\r\n#define FT_BOOL( x )  ( (FT_Bool)( x ) )\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftwinfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftwinfnt.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType API for accessing Windows fnt-specific data.                */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2008 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTWINFNT_H__\r\n#define __FTWINFNT_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    winfnt_fonts                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Window FNT Files                                                   */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Windows FNT specific API.                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the declaration of Windows FNT specific      */\r\n  /*    functions.                                                         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @enum:\r\n   *   FT_WinFNT_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `charset' byte in\r\n   *   @FT_WinFNT_HeaderRec.  Exact mapping tables for the various cpXXXX\r\n   *   encodings (except for cp1361) can be found at ftp://ftp.unicode.org\r\n   *   in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory.  cp1361 is\r\n   *   roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.\r\n   *\r\n   * @values:\r\n   *   FT_WinFNT_ID_DEFAULT ::\r\n   *     This is used for font enumeration and font creation as a\r\n   *     `don't care' value.  Valid font files don't contain this value.\r\n   *     When querying for information about the character set of the font\r\n   *     that is currently selected into a specified device context, this\r\n   *     return value (of the related Windows API) simply denotes failure.\r\n   *\r\n   *   FT_WinFNT_ID_SYMBOL ::\r\n   *     There is no known mapping table available.\r\n   *\r\n   *   FT_WinFNT_ID_MAC ::\r\n   *     Mac Roman encoding.\r\n   *\r\n   *   FT_WinFNT_ID_OEM ::\r\n   *     From Michael Pöttgen <michael@poettgen.de>:\r\n   *\r\n   *       The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM\r\n   *       is used for the charset of vector fonts, like `modern.fon',\r\n   *       `roman.fon', and `script.fon' on Windows.\r\n   *\r\n   *       The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value\r\n   *       specifies a character set that is operating-system dependent.\r\n   *\r\n   *       The `IFIMETRICS' documentation from the `Windows Driver\r\n   *       Development Kit' says: This font supports an OEM-specific\r\n   *       character set.  The OEM character set is system dependent.\r\n   *\r\n   *       In general OEM, as opposed to ANSI (i.e., cp1252), denotes the\r\n   *       second default codepage that most international versions of\r\n   *       Windows have.  It is one of the OEM codepages from\r\n   *\r\n   *         http://www.microsoft.com/globaldev/reference/cphome.mspx,\r\n   *\r\n   *       and is used for the `DOS boxes', to support legacy applications.\r\n   *       A German Windows version for example usually uses ANSI codepage\r\n   *       1252 and OEM codepage 850.\r\n   *\r\n   *   FT_WinFNT_ID_CP874 ::\r\n   *     A superset of Thai TIS 620 and ISO 8859-11.\r\n   *\r\n   *   FT_WinFNT_ID_CP932 ::\r\n   *     A superset of Japanese Shift-JIS (with minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP936 ::\r\n   *     A superset of simplified Chinese GB 2312-1980 (with different\r\n   *     ordering and minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP949 ::\r\n   *     A superset of Korean Hangul KS~C 5601-1987 (with different\r\n   *     ordering and minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP950 ::\r\n   *     A superset of traditional Chinese Big~5 ETen (with different\r\n   *     ordering and minor deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP1250 ::\r\n   *     A superset of East European ISO 8859-2 (with slightly different\r\n   *     ordering).\r\n   *\r\n   *   FT_WinFNT_ID_CP1251 ::\r\n   *     A superset of Russian ISO 8859-5 (with different ordering).\r\n   *\r\n   *   FT_WinFNT_ID_CP1252 ::\r\n   *     ANSI encoding.  A superset of ISO 8859-1.\r\n   *\r\n   *   FT_WinFNT_ID_CP1253 ::\r\n   *     A superset of Greek ISO 8859-7 (with minor modifications).\r\n   *\r\n   *   FT_WinFNT_ID_CP1254 ::\r\n   *     A superset of Turkish ISO 8859-9.\r\n   *\r\n   *   FT_WinFNT_ID_CP1255 ::\r\n   *     A superset of Hebrew ISO 8859-8 (with some modifications).\r\n   *\r\n   *   FT_WinFNT_ID_CP1256 ::\r\n   *     A superset of Arabic ISO 8859-6 (with different ordering).\r\n   *\r\n   *   FT_WinFNT_ID_CP1257 ::\r\n   *     A superset of Baltic ISO 8859-13 (with some deviations).\r\n   *\r\n   *   FT_WinFNT_ID_CP1258 ::\r\n   *     For Vietnamese.  This encoding doesn't cover all necessary\r\n   *     characters.\r\n   *\r\n   *   FT_WinFNT_ID_CP1361 ::\r\n   *     Korean (Johab).\r\n   */\r\n\r\n#define FT_WinFNT_ID_CP1252    0\r\n#define FT_WinFNT_ID_DEFAULT   1\r\n#define FT_WinFNT_ID_SYMBOL    2\r\n#define FT_WinFNT_ID_MAC      77\r\n#define FT_WinFNT_ID_CP932   128\r\n#define FT_WinFNT_ID_CP949   129\r\n#define FT_WinFNT_ID_CP1361  130\r\n#define FT_WinFNT_ID_CP936   134\r\n#define FT_WinFNT_ID_CP950   136\r\n#define FT_WinFNT_ID_CP1253  161\r\n#define FT_WinFNT_ID_CP1254  162\r\n#define FT_WinFNT_ID_CP1258  163\r\n#define FT_WinFNT_ID_CP1255  177\r\n#define FT_WinFNT_ID_CP1256  178\r\n#define FT_WinFNT_ID_CP1257  186\r\n#define FT_WinFNT_ID_CP1251  204\r\n#define FT_WinFNT_ID_CP874   222\r\n#define FT_WinFNT_ID_CP1250  238\r\n#define FT_WinFNT_ID_OEM     255\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_WinFNT_HeaderRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Windows FNT Header info.                                           */\r\n  /*                                                                       */\r\n  typedef struct  FT_WinFNT_HeaderRec_\r\n  {\r\n    FT_UShort  version;\r\n    FT_ULong   file_size;\r\n    FT_Byte    copyright[60];\r\n    FT_UShort  file_type;\r\n    FT_UShort  nominal_point_size;\r\n    FT_UShort  vertical_resolution;\r\n    FT_UShort  horizontal_resolution;\r\n    FT_UShort  ascent;\r\n    FT_UShort  internal_leading;\r\n    FT_UShort  external_leading;\r\n    FT_Byte    italic;\r\n    FT_Byte    underline;\r\n    FT_Byte    strike_out;\r\n    FT_UShort  weight;\r\n    FT_Byte    charset;\r\n    FT_UShort  pixel_width;\r\n    FT_UShort  pixel_height;\r\n    FT_Byte    pitch_and_family;\r\n    FT_UShort  avg_width;\r\n    FT_UShort  max_width;\r\n    FT_Byte    first_char;\r\n    FT_Byte    last_char;\r\n    FT_Byte    default_char;\r\n    FT_Byte    break_char;\r\n    FT_UShort  bytes_per_row;\r\n    FT_ULong   device_offset;\r\n    FT_ULong   face_name_offset;\r\n    FT_ULong   bits_pointer;\r\n    FT_ULong   bits_offset;\r\n    FT_Byte    reserved;\r\n    FT_ULong   flags;\r\n    FT_UShort  A_space;\r\n    FT_UShort  B_space;\r\n    FT_UShort  C_space;\r\n    FT_UShort  color_table_offset;\r\n    FT_ULong   reserved1[4];\r\n\r\n  } FT_WinFNT_HeaderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_WinFNT_Header                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to an @FT_WinFNT_HeaderRec structure.                     */\r\n  /*                                                                       */\r\n  typedef struct FT_WinFNT_HeaderRec_*  FT_WinFNT_Header;\r\n\r\n\r\n  /**********************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_WinFNT_Header\r\n   *\r\n   * @description:\r\n   *    Retrieve a Windows FNT font info header.\r\n   *\r\n   * @input:\r\n   *    face    :: A handle to the input face.\r\n   *\r\n   * @output:\r\n   *    aheader :: The WinFNT header.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *   This function only works with Windows FNT faces, returning an error\r\n   *   otherwise.\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_WinFNT_Header( FT_Face               face,\r\n                        FT_WinFNT_HeaderRec  *aheader );\r\n\r\n\r\n  /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTWINFNT_H__ */\r\n\r\n\r\n/* END */\r\n\r\n\r\n/* Local Variables: */\r\n/* coding: utf-8    */\r\n/* End:             */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ftxf86.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftxf86.h                                                               */\r\n/*                                                                         */\r\n/*    Support functions for X11.                                           */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2004, 2006, 2007 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTXF86_H__\r\n#define __FTXF86_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*   font_formats                                                        */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*   Font Formats                                                        */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*   Getting the font format.                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   The single function in this section can be used to get the font     */\r\n  /*   format.  Note that this information is not needed normally;         */\r\n  /*   however, there are special cases (like in PDF devices) where it is  */\r\n  /*   important to differentiate, in spite of FreeType's uniform API.     */\r\n  /*                                                                       */\r\n  /*   This function is in the X11/xf86 namespace for historical reasons   */\r\n  /*   and in no way depends on that windowing system.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*   FT_Get_X11_Font_Format                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   Return a string describing the format of a given face, using values */\r\n  /*   which can be used as an X11 FONT_PROPERTY.  Possible values are     */\r\n  /*   `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */\r\n  /*   `PFR', and `Windows~FNT'.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*   face ::                                                             */\r\n  /*     Input face handle.                                                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*   Font format string.  NULL in case of error.                         */\r\n  /*                                                                       */\r\n  FT_EXPORT( const char* )\r\n  FT_Get_X11_Font_Format( FT_Face  face );\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTXF86_H__ */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/autohint.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  autohint.h                                                             */\r\n/*                                                                         */\r\n/*    High-level `autohint' module-specific interface (specification).     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2007 by                                     */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The auto-hinter is used to load and automatically hint glyphs if a    */\r\n  /* format-specific hinter isn't available.                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __AUTOHINT_H__\r\n#define __AUTOHINT_H__\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* A small technical note regarding automatic hinting in order to        */\r\n  /* clarify this module interface.                                        */\r\n  /*                                                                       */\r\n  /* An automatic hinter might compute two kinds of data for a given face: */\r\n  /*                                                                       */\r\n  /* - global hints: Usually some metrics that describe global properties  */\r\n  /*                 of the face.  It is computed by scanning more or less */\r\n  /*                 aggressively the glyphs in the face, and thus can be  */\r\n  /*                 very slow to compute (even if the size of global      */\r\n  /*                 hints is really small).                               */\r\n  /*                                                                       */\r\n  /* - glyph hints:  These describe some important features of the glyph   */\r\n  /*                 outline, as well as how to align them.  They are      */\r\n  /*                 generally much faster to compute than global hints.   */\r\n  /*                                                                       */\r\n  /* The current FreeType auto-hinter does a pretty good job while         */\r\n  /* performing fast computations for both global and glyph hints.         */\r\n  /* However, we might be interested in introducing more complex and       */\r\n  /* powerful algorithms in the future, like the one described in the John */\r\n  /* D. Hobby paper, which unfortunately requires a lot more horsepower.   */\r\n  /*                                                                       */\r\n  /* Because a sufficiently sophisticated font management system would     */\r\n  /* typically implement an LRU cache of opened face objects to reduce     */\r\n  /* memory usage, it is a good idea to be able to avoid recomputing       */\r\n  /* global hints every time the same face is re-opened.                   */\r\n  /*                                                                       */\r\n  /* We thus provide the ability to cache global hints outside of the face */\r\n  /* object, in order to speed up font re-opening time.  Of course, this   */\r\n  /* feature is purely optional, so most client programs won't even notice */\r\n  /* it.                                                                   */\r\n  /*                                                                       */\r\n  /* I initially thought that it would be a good idea to cache the glyph   */\r\n  /* hints too.  However, my general idea now is that if you really need   */\r\n  /* to cache these too, you are simply in need of a new font format,      */\r\n  /* where all this information could be stored within the font file and   */\r\n  /* decoded on the fly.                                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef struct FT_AutoHinterRec_  *FT_AutoHinter;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlobalGetFunc                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Retrieves the global hints computed for a given face object the    */\r\n  /*    resulting data is dissociated from the face and will survive a     */\r\n  /*    call to FT_Done_Face().  It must be discarded through the API      */\r\n  /*    FT_AutoHinter_GlobalDoneFunc().                                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hinter        :: A handle to the source auto-hinter.               */\r\n  /*                                                                       */\r\n  /*    face          :: A handle to the source face object.               */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    global_hints  :: A typeless pointer to the global hints.           */\r\n  /*                                                                       */\r\n  /*    global_len    :: The size in bytes of the global hints.            */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter  hinter,\r\n                                  FT_Face        face,\r\n                                  void**         global_hints,\r\n                                  long*          global_len );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlobalDoneFunc                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discards the global hints retrieved through                        */\r\n  /*    FT_AutoHinter_GlobalGetFunc().  This is the only way these hints   */\r\n  /*    are freed from memory.                                             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hinter :: A handle to the auto-hinter module.                      */\r\n  /*                                                                       */\r\n  /*    global :: A pointer to retrieved global hints to discard.          */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter  hinter,\r\n                                   void*          global );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlobalResetFunc                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to recompute the global metrics in a given   */\r\n  /*    font.  This is useful when global font data changes (e.g. Multiple */\r\n  /*    Masters fonts where blend coordinates change).                     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    hinter :: A handle to the source auto-hinter.                      */\r\n  /*                                                                       */\r\n  /*    face   :: A handle to the face.                                    */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter  hinter,\r\n                                    FT_Face        face );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_AutoHinter_GlyphLoadFunc                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This function is used to load, scale, and automatically hint a     */\r\n  /*    glyph from a given face.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face        :: A handle to the face.                               */\r\n  /*                                                                       */\r\n  /*    glyph_index :: The glyph index.                                    */\r\n  /*                                                                       */\r\n  /*    load_flags  :: The load flags.                                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is capable of loading composite glyphs by hinting    */\r\n  /*    each sub-glyph independently (which improves quality).             */\r\n  /*                                                                       */\r\n  /*    It will call the font driver with FT_Load_Glyph(), with            */\r\n  /*    FT_LOAD_NO_SCALE set.                                              */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter  hinter,\r\n                                  FT_GlyphSlot   slot,\r\n                                  FT_Size        size,\r\n                                  FT_UInt        glyph_index,\r\n                                  FT_Int32       load_flags );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_AutoHinter_ServiceRec                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The auto-hinter module's interface.                                */\r\n  /*                                                                       */\r\n  typedef struct  FT_AutoHinter_ServiceRec_\r\n  {\r\n    FT_AutoHinter_GlobalResetFunc  reset_face;\r\n    FT_AutoHinter_GlobalGetFunc    get_global_hints;\r\n    FT_AutoHinter_GlobalDoneFunc   done_global_hints;\r\n    FT_AutoHinter_GlyphLoadFunc    load_glyph;\r\n\r\n  } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \\\r\n                                     done_global_hints_, load_glyph_)        \\\r\n  FT_CALLBACK_TABLE_DEF                                                      \\\r\n  const FT_AutoHinter_ServiceRec class_ =                                    \\\r\n  {                                                                          \\\r\n    reset_face_, get_global_hints_, done_global_hints_, load_glyph_          \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \\\r\n                                     done_global_hints_, load_glyph_)        \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library,                                \\\r\n                          FT_AutoHinter_ServiceRec* clazz)                   \\\r\n  {                                                                          \\\r\n    FT_UNUSED(library);                                                      \\\r\n    clazz->reset_face = reset_face_;                                         \\\r\n    clazz->get_global_hints = get_global_hints_;                             \\\r\n    clazz->done_global_hints = done_global_hints_;                           \\\r\n    clazz->load_glyph = load_glyph_;                                         \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __AUTOHINT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftcalc.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftcalc.h                                                               */\r\n/*                                                                         */\r\n/*    Arithmetic computations (specification).                             */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTCALC_H__\r\n#define __FTCALC_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_FixedSqrt                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the square root of a 16.16 fixed point value.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    x :: The value to compute the root for.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `sqrt(x)'.                                           */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is not very fast.                                    */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Int32 )\r\n  FT_SqrtFixed( FT_Int32  x );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Sqrt32                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Computes the square root of an Int32 integer (which will be        */\r\n  /*    handled as an unsigned long value).                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    x :: The value to compute the root for.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `sqrt(x)'.                                           */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Int32 )\r\n  FT_Sqrt32( FT_Int32  x );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* FT_MulDiv() and FT_MulFix() are declared in freetype.h.               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifdef TT_USE_BYTECODE_INTERPRETER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_MulDiv_No_Round                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A very simple function used to perform the computation `(a*b)/c'   */\r\n  /*    (without rounding) with maximal accuracy (it uses a 64-bit         */\r\n  /*    intermediate integer whenever necessary).                          */\r\n  /*                                                                       */\r\n  /*    This function isn't necessarily as fast as some processor specific */\r\n  /*    operations, but is at least completely portable.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    a :: The first multiplier.                                         */\r\n  /*    b :: The second multiplier.                                        */\r\n  /*    c :: The divisor.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The result of `(a*b)/c'.  This function never traps when trying to */\r\n  /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */\r\n  /*    on the signs of `a' and `b'.                                       */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Long )\r\n  FT_MulDiv_No_Round( FT_Long  a,\r\n                      FT_Long  b,\r\n                      FT_Long  c );\r\n\r\n#endif /* TT_USE_BYTECODE_INTERPRETER */\r\n\r\n\r\n  /*\r\n   *  A variant of FT_Matrix_Multiply which scales its result afterwards.\r\n   *  The idea is that both `a' and `b' are scaled by factors of 10 so that\r\n   *  the values are as precise as possible to get a correct result during\r\n   *  the 64bit multiplication.  Let `sa' and `sb' be the scaling factors of\r\n   *  `a' and `b', respectively, then the scaling factor of the result is\r\n   *  `sa*sb'.\r\n   */\r\n  FT_BASE( void )\r\n  FT_Matrix_Multiply_Scaled( const FT_Matrix*  a,\r\n                             FT_Matrix        *b,\r\n                             FT_Long           scaling );\r\n\r\n\r\n  /*\r\n   *  A variant of FT_Vector_Transform.  See comments for\r\n   *  FT_Matrix_Multiply_Scaled.\r\n   */\r\n\r\n  FT_BASE( void )\r\n  FT_Vector_Transform_Scaled( FT_Vector*        vector,\r\n                              const FT_Matrix*  matrix,\r\n                              FT_Long           scaling );\r\n\r\n\r\n  /*\r\n   *  Return -1, 0, or +1, depending on the orientation of a given corner.\r\n   *  We use the Cartesian coordinate system, with positive vertical values\r\n   *  going upwards.  The function returns +1 if the corner turns to the\r\n   *  left, -1 to the right, and 0 for undecidable cases.\r\n   */\r\n  FT_BASE( FT_Int )\r\n  ft_corner_orientation( FT_Pos  in_x,\r\n                         FT_Pos  in_y,\r\n                         FT_Pos  out_x,\r\n                         FT_Pos  out_y );\r\n\r\n  /*\r\n   *  Return TRUE if a corner is flat or nearly flat.  This is equivalent to\r\n   *  saying that the angle difference between the `in' and `out' vectors is\r\n   *  very small.\r\n   */\r\n  FT_BASE( FT_Int )\r\n  ft_corner_is_flat( FT_Pos  in_x,\r\n                     FT_Pos  in_y,\r\n                     FT_Pos  out_x,\r\n                     FT_Pos  out_y );\r\n\r\n\r\n#define INT_TO_F26DOT6( x )    ( (FT_Long)(x) << 6  )\r\n#define INT_TO_F2DOT14( x )    ( (FT_Long)(x) << 14 )\r\n#define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )\r\n#define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )\r\n#define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )\r\n#define FIXED_TO_INT( x )      ( FT_RoundFix( x ) >> 16 )\r\n\r\n#define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \\\r\n                                        : ( -( ( 32 - (x) ) & -64 ) ) )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTCALC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftdebug.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdebug.h                                                              */\r\n/*                                                                         */\r\n/*    Debugging and logging component (specification).                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/*                                                                         */\r\n/*  IMPORTANT: A description of FreeType's debugging support can be        */\r\n/*             found in `docs/DEBUG.TXT'.  Read it if you need to use or   */\r\n/*             understand this code.                                       */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTDEBUG_H__\r\n#define __FTDEBUG_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */\r\n  /* is already defined; this simplifies the following #ifdefs            */\r\n  /*                                                                      */\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n#undef  FT_DEBUG_LEVEL_ERROR\r\n#define FT_DEBUG_LEVEL_ERROR\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the trace enums as well as the trace levels array when they    */\r\n  /* are needed.                                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n#define FT_TRACE_DEF( x )  trace_ ## x ,\r\n\r\n  /* defining the enumeration */\r\n  typedef enum  FT_Trace_\r\n  {\r\n#include FT_INTERNAL_TRACE_H\r\n    trace_count\r\n\r\n  } FT_Trace;\r\n\r\n\r\n  /* defining the array of trace levels, provided by `src/base/ftdebug.c' */\r\n  extern int  ft_trace_levels[trace_count];\r\n\r\n#undef FT_TRACE_DEF\r\n\r\n#endif /* FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the FT_TRACE macro                                             */\r\n  /*                                                                       */\r\n  /* IMPORTANT!                                                            */\r\n  /*                                                                       */\r\n  /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */\r\n  /* value before using any TRACE macro.                                   */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_TRACE\r\n\r\n#define FT_TRACE( level, varformat )                      \\\r\n          do                                              \\\r\n          {                                               \\\r\n            if ( ft_trace_levels[FT_COMPONENT] >= level ) \\\r\n              FT_Message varformat;                       \\\r\n          } while ( 0 )\r\n\r\n#else /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n#define FT_TRACE( level, varformat )  do { } while ( 0 )      /* nothing */\r\n\r\n#endif /* !FT_DEBUG_LEVEL_TRACE */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Trace_Get_Count                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the number of available trace components.                   */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The number of trace components.  0 if FreeType 2 is not built with */\r\n  /*    FT_DEBUG_LEVEL_TRACE definition.                                   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function may be useful if you want to access elements of      */\r\n  /*    the internal `ft_trace_levels' array by an index.                  */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Int )\r\n  FT_Trace_Get_Count( void );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Trace_Get_Name                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return the name of a trace component.                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    The index of the trace component.                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The name of the trace component.  This is a statically allocated   */\r\n  /*    C string, so do not free it after use.  NULL if FreeType 2 is not  */\r\n  /*    built with FT_DEBUG_LEVEL_TRACE definition.                        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Use @FT_Trace_Get_Count to get the number of available trace       */\r\n  /*    components.                                                        */\r\n  /*                                                                       */\r\n  /*    This function may be useful if you want to control FreeType 2's    */\r\n  /*    debug level in your application.                                   */\r\n  /*                                                                       */\r\n  FT_BASE( const char * )\r\n  FT_Trace_Get_Name( FT_Int  idx );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* You need two opening and closing parentheses!                         */\r\n  /*                                                                       */\r\n  /* Example: FT_TRACE0(( \"Value is %i\", foo ))                            */\r\n  /*                                                                       */\r\n  /* Output of the FT_TRACEX macros is sent to stderr.                     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#define FT_TRACE0( varformat )  FT_TRACE( 0, varformat )\r\n#define FT_TRACE1( varformat )  FT_TRACE( 1, varformat )\r\n#define FT_TRACE2( varformat )  FT_TRACE( 2, varformat )\r\n#define FT_TRACE3( varformat )  FT_TRACE( 3, varformat )\r\n#define FT_TRACE4( varformat )  FT_TRACE( 4, varformat )\r\n#define FT_TRACE5( varformat )  FT_TRACE( 5, varformat )\r\n#define FT_TRACE6( varformat )  FT_TRACE( 6, varformat )\r\n#define FT_TRACE7( varformat )  FT_TRACE( 7, varformat )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the FT_ERROR macro.                                            */\r\n  /*                                                                       */\r\n  /* Output of this macro is sent to stderr.                               */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n#define FT_ERROR( varformat )  FT_Message  varformat\r\n\r\n#else  /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n#define FT_ERROR( varformat )  do { } while ( 0 )      /* nothing */\r\n\r\n#endif /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define the FT_ASSERT macro.                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n#define FT_ASSERT( condition )                                      \\\r\n          do                                                        \\\r\n          {                                                         \\\r\n            if ( !( condition ) )                                   \\\r\n              FT_Panic( \"assertion failed on line %d of file %s\\n\", \\\r\n                        __LINE__, __FILE__ );                       \\\r\n          } while ( 0 )\r\n\r\n#else /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n#define FT_ASSERT( condition )  do { } while ( 0 )\r\n\r\n#endif /* !FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Define `FT_Message' and `FT_Panic' when needed.                       */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n#ifdef FT_DEBUG_LEVEL_ERROR\r\n\r\n#include \"stdio.h\"  /* for vfprintf() */\r\n\r\n  /* print a message */\r\n  FT_BASE( void )\r\n  FT_Message( const char*  fmt,\r\n              ... );\r\n\r\n  /* print a message and exit */\r\n  FT_BASE( void )\r\n  FT_Panic( const char*  fmt,\r\n            ... );\r\n\r\n#endif /* FT_DEBUG_LEVEL_ERROR */\r\n\r\n\r\n  FT_BASE( void )\r\n  ft_debug_init( void );\r\n\r\n\r\n#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */\r\n\r\n  /* We disable the warning `conditional expression is constant' here */\r\n  /* in order to compile cleanly with the maximum level of warnings.  */\r\n#pragma warning( disable : 4127 )\r\n\r\n#endif /* _MSC_VER */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTDEBUG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftdriver.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftdriver.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType font driver interface (specification).                      */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2006, 2008 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTDRIVER_H__\r\n#define __FTDRIVER_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_InitFunc)( FT_Stream      stream,\r\n                       FT_Face        face,\r\n                       FT_Int         typeface_index,\r\n                       FT_Int         num_params,\r\n                       FT_Parameter*  parameters );\r\n\r\n  typedef void\r\n  (*FT_Face_DoneFunc)( FT_Face  face );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_InitFunc)( FT_Size  size );\r\n\r\n  typedef void\r\n  (*FT_Size_DoneFunc)( FT_Size  size );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Slot_InitFunc)( FT_GlyphSlot  slot );\r\n\r\n  typedef void\r\n  (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_RequestFunc)( FT_Size          size,\r\n                          FT_Size_Request  req );\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_SelectFunc)( FT_Size   size,\r\n                         FT_ULong  size_index );\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_ResetPointsFunc)( FT_Size     size,\r\n                              FT_F26Dot6  char_width,\r\n                              FT_F26Dot6  char_height,\r\n                              FT_UInt     horz_resolution,\r\n                              FT_UInt     vert_resolution );\r\n\r\n  typedef FT_Error\r\n  (*FT_Size_ResetPixelsFunc)( FT_Size  size,\r\n                              FT_UInt  pixel_width,\r\n                              FT_UInt  pixel_height );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  typedef FT_Error\r\n  (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,\r\n                       FT_Size       size,\r\n                       FT_UInt       glyph_index,\r\n                       FT_Int32      load_flags );\r\n\r\n\r\n  typedef FT_UInt\r\n  (*FT_CharMap_CharIndexFunc)( FT_CharMap  charmap,\r\n                               FT_Long     charcode );\r\n\r\n  typedef FT_Long\r\n  (*FT_CharMap_CharNextFunc)( FT_CharMap  charmap,\r\n                              FT_Long     charcode );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_GetKerningFunc)( FT_Face     face,\r\n                             FT_UInt     left_glyph,\r\n                             FT_UInt     right_glyph,\r\n                             FT_Vector*  kerning );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_AttachFunc)( FT_Face    face,\r\n                         FT_Stream  stream );\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_GetAdvancesFunc)( FT_Face    face,\r\n                              FT_UInt    first,\r\n                              FT_UInt    count,\r\n                              FT_Int32   flags,\r\n                              FT_Fixed*  advances );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Driver_ClassRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The font driver class.  This structure mostly contains pointers to */\r\n  /*    driver methods.                                                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root             :: The parent module.                             */\r\n  /*                                                                       */\r\n  /*    face_object_size :: The size of a face object in bytes.            */\r\n  /*                                                                       */\r\n  /*    size_object_size :: The size of a size object in bytes.            */\r\n  /*                                                                       */\r\n  /*    slot_object_size :: The size of a glyph object in bytes.           */\r\n  /*                                                                       */\r\n  /*    init_face        :: The format-specific face constructor.          */\r\n  /*                                                                       */\r\n  /*    done_face        :: The format-specific face destructor.           */\r\n  /*                                                                       */\r\n  /*    init_size        :: The format-specific size constructor.          */\r\n  /*                                                                       */\r\n  /*    done_size        :: The format-specific size destructor.           */\r\n  /*                                                                       */\r\n  /*    init_slot        :: The format-specific slot constructor.          */\r\n  /*                                                                       */\r\n  /*    done_slot        :: The format-specific slot destructor.           */\r\n  /*                                                                       */\r\n  /*                                                                       */\r\n  /*    load_glyph       :: A function handle to load a glyph to a slot.   */\r\n  /*                        This field is mandatory!                       */\r\n  /*                                                                       */\r\n  /*    get_kerning      :: A function handle to return the unscaled       */\r\n  /*                        kerning for a given pair of glyphs.  Can be    */\r\n  /*                        set to 0 if the format doesn't support         */\r\n  /*                        kerning.                                       */\r\n  /*                                                                       */\r\n  /*    attach_file      :: This function handle is used to read           */\r\n  /*                        additional data for a face from another        */\r\n  /*                        file/stream.  For example, this can be used to */\r\n  /*                        add data from AFM or PFM files on a Type 1     */\r\n  /*                        face, or a CIDMap on a CID-keyed face.         */\r\n  /*                                                                       */\r\n  /*    get_advances     :: A function handle used to return advance       */\r\n  /*                        widths of `count' glyphs (in font units),      */\r\n  /*                        starting at `first'.  The `vertical' flag must */\r\n  /*                        be set to get vertical advance heights.  The   */\r\n  /*                        `advances' buffer is caller-allocated.         */\r\n  /*                        Currently not implemented.  The idea of this   */\r\n  /*                        function is to be able to perform              */\r\n  /*                        device-independent text layout without loading */\r\n  /*                        a single glyph image.                          */\r\n  /*                                                                       */\r\n  /*    request_size     :: A handle to a function used to request the new */\r\n  /*                        character size.  Can be set to 0 if the        */\r\n  /*                        scaling done in the base layer suffices.       */\r\n  /*                                                                       */\r\n  /*    select_size      :: A handle to a function used to select a new    */\r\n  /*                        fixed size.  It is used only if                */\r\n  /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */\r\n  /*                        to 0 if the scaling done in the base layer     */\r\n  /*                        suffices.                                      */\r\n  /* <Note>                                                                */\r\n  /*    Most function pointers, with the exception of `load_glyph', can be */\r\n  /*    set to 0 to indicate a default behaviour.                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_Driver_ClassRec_\r\n  {\r\n    FT_Module_Class           root;\r\n\r\n    FT_Long                   face_object_size;\r\n    FT_Long                   size_object_size;\r\n    FT_Long                   slot_object_size;\r\n\r\n    FT_Face_InitFunc          init_face;\r\n    FT_Face_DoneFunc          done_face;\r\n\r\n    FT_Size_InitFunc          init_size;\r\n    FT_Size_DoneFunc          done_size;\r\n\r\n    FT_Slot_InitFunc          init_slot;\r\n    FT_Slot_DoneFunc          done_slot;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n    FT_Size_ResetPointsFunc   set_char_sizes;\r\n    FT_Size_ResetPixelsFunc   set_pixel_sizes;\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n    FT_Slot_LoadFunc          load_glyph;\r\n\r\n    FT_Face_GetKerningFunc    get_kerning;\r\n    FT_Face_AttachFunc        attach_file;\r\n    FT_Face_GetAdvancesFunc   get_advances;\r\n\r\n    /* since version 2.2 */\r\n    FT_Size_RequestFunc       request_size;\r\n    FT_Size_SelectFunc        select_size;\r\n\r\n  } FT_Driver_ClassRec, *FT_Driver_Class;\r\n\r\n\r\n  /*\r\n   *  The following functions are used as stubs for `set_char_sizes' and\r\n   *  `set_pixel_sizes'; the code uses `request_size' and `select_size'\r\n   *  functions instead.\r\n   *\r\n   *  Implementation is in `src/base/ftobjs.c'.\r\n   */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_BASE( FT_Error )\r\n  ft_stub_set_char_sizes( FT_Size     size,\r\n                          FT_F26Dot6  width,\r\n                          FT_F26Dot6  height,\r\n                          FT_UInt     horz_res,\r\n                          FT_UInt     vert_res );\r\n\r\n  FT_BASE( FT_Error )\r\n  ft_stub_set_pixel_sizes( FT_Size  size,\r\n                           FT_UInt  width,\r\n                           FT_UInt  height );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DECLARE_DRIVER                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to create a forward declaration of a                          */\r\n  /*    FT_Driver_ClassRec stract instance.                                */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_DRIVER                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Driver_ClassRec struct.       */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */\r\n  /*    to called with a pointer where the allocated stracture is returned.*/\r\n  /*    And when it is no longer needed a Destroy function needs           */\r\n  /*    to be called to release that allocation.                           */\r\n  /*    fcinit.c (ft_create_default_module_classes) already contains       */\r\n  /*    a mechanism to call these functions for the default modules        */\r\n  /*    described in ftmodule.h                                            */\r\n  /*                                                                       */\r\n  /*    Notice that the created Create and Destroy functions call          */\r\n  /*    pic_init and pic_free function to allow you to manually allocate   */\r\n  /*    and initialize any additional global data, like module specific    */\r\n  /*    interface, and put them in the global pic container defined in     */\r\n  /*    ftpic.h. if you don't need them just implement the functions as    */\r\n  /*    empty to resolve the link error.                                   */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \\\r\n  a_, b_,\r\n#else\r\n  #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)\r\n#endif\r\n\r\n#define FT_DECLARE_DRIVER(class_)    \\\r\n  FT_CALLBACK_TABLE                  \\\r\n  const FT_Driver_ClassRec  class_;  \r\n\r\n#define FT_DEFINE_DRIVER(class_,                                             \\\r\n                         flags_, size_, name_, version_, requires_,          \\\r\n                         interface_, init_, done_, get_interface_,           \\\r\n                         face_object_size_, size_object_size_,               \\\r\n                         slot_object_size_, init_face_, done_face_,          \\\r\n                         init_size_, done_size_, init_slot_, done_slot_,     \\\r\n                         old_set_char_sizes_, old_set_pixel_sizes_,          \\\r\n                         load_glyph_, get_kerning_, attach_file_,            \\\r\n                         get_advances_, request_size_, select_size_ )        \\\r\n  FT_CALLBACK_TABLE_DEF                                                      \\\r\n  const FT_Driver_ClassRec class_ =                                          \\\r\n  {                                                                          \\\r\n    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_,  \\\r\n                          init_,done_,get_interface_)                        \\\r\n                                                                             \\\r\n    face_object_size_,                                                       \\\r\n    size_object_size_,                                                       \\\r\n    slot_object_size_,                                                       \\\r\n                                                                             \\\r\n    init_face_,                                                              \\\r\n    done_face_,                                                              \\\r\n                                                                             \\\r\n    init_size_,                                                              \\\r\n    done_size_,                                                              \\\r\n                                                                             \\\r\n    init_slot_,                                                              \\\r\n    done_slot_,                                                              \\\r\n                                                                             \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \\\r\n                                                                             \\\r\n    load_glyph_,                                                             \\\r\n                                                                             \\\r\n    get_kerning_,                                                            \\\r\n    attach_file_,                                                            \\\r\n    get_advances_,                                                           \\\r\n                                                                             \\\r\n    request_size_,                                                           \\\r\n    select_size_                                                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \\\r\n  clazz->set_char_sizes = a_; \\\r\n  clazz->set_pixel_sizes = b_;\r\n#else\r\n  #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)\r\n#endif\r\n\r\n#define FT_DECLARE_DRIVER(class_)    FT_DECLARE_MODULE(class_)\r\n\r\n#define FT_DEFINE_DRIVER(class_,                                             \\\r\n                         flags_, size_, name_, version_, requires_,          \\\r\n                         interface_, init_, done_, get_interface_,           \\\r\n                         face_object_size_, size_object_size_,               \\\r\n                         slot_object_size_, init_face_, done_face_,          \\\r\n                         init_size_, done_size_, init_slot_, done_slot_,     \\\r\n                         old_set_char_sizes_, old_set_pixel_sizes_,          \\\r\n                         load_glyph_, get_kerning_, attach_file_,            \\\r\n                         get_advances_, request_size_, select_size_ )        \\\r\n  void class_##_pic_free( FT_Library library );                              \\\r\n  FT_Error class_##_pic_init( FT_Library library );                          \\\r\n                                                                             \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library        library,                      \\\r\n                             FT_Module_Class*  clazz )                       \\\r\n  {                                                                          \\\r\n    FT_Memory       memory = library->memory;                                \\\r\n    FT_Driver_Class dclazz = (FT_Driver_Class)clazz;                         \\\r\n    class_##_pic_free( library );                                            \\\r\n    if ( dclazz )                                                            \\\r\n      FT_FREE( dclazz );                                                     \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library        library,                       \\\r\n                            FT_Module_Class**  output_class )                \\\r\n  {                                                                          \\\r\n    FT_Driver_Class  clazz;                                                  \\\r\n    FT_Error         error;                                                  \\\r\n    FT_Memory        memory = library->memory;                               \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \\\r\n      return error;                                                          \\\r\n                                                                             \\\r\n    error = class_##_pic_init( library );                                    \\\r\n    if(error)                                                                \\\r\n    {                                                                        \\\r\n      FT_FREE( clazz );                                                      \\\r\n      return error;                                                          \\\r\n    }                                                                        \\\r\n                                                                             \\\r\n    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_,  \\\r\n                          init_,done_,get_interface_)                        \\\r\n                                                                             \\\r\n    clazz->face_object_size    = face_object_size_;                          \\\r\n    clazz->size_object_size    = size_object_size_;                          \\\r\n    clazz->slot_object_size    = slot_object_size_;                          \\\r\n                                                                             \\\r\n    clazz->init_face           = init_face_;                                 \\\r\n    clazz->done_face           = done_face_;                                 \\\r\n                                                                             \\\r\n    clazz->init_size           = init_size_;                                 \\\r\n    clazz->done_size           = done_size_;                                 \\\r\n                                                                             \\\r\n    clazz->init_slot           = init_slot_;                                 \\\r\n    clazz->done_slot           = done_slot_;                                 \\\r\n                                                                             \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \\\r\n                                                                             \\\r\n    clazz->load_glyph          = load_glyph_;                                \\\r\n                                                                             \\\r\n    clazz->get_kerning         = get_kerning_;                               \\\r\n    clazz->attach_file         = attach_file_;                               \\\r\n    clazz->get_advances        = get_advances_;                              \\\r\n                                                                             \\\r\n    clazz->request_size        = request_size_;                              \\\r\n    clazz->select_size         = select_size_;                               \\\r\n                                                                             \\\r\n    *output_class = (FT_Module_Class*)clazz;                                 \\\r\n    return FT_Err_Ok;                                                        \\\r\n  }                \r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTDRIVER_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftgloadr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftgloadr.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph loader (specification).                           */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2003, 2005, 2006 by                                    */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTGLOADR_H__\r\n#define __FTGLOADR_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_GlyphLoader                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The glyph loader is an internal object used to load several glyphs */\r\n  /*    together (for example, in the case of composites).                 */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The glyph loader implementation is not part of the high-level API, */\r\n  /*    hence the forward structure declaration.                           */\r\n  /*                                                                       */\r\n  typedef struct FT_GlyphLoaderRec_*  FT_GlyphLoader ;\r\n\r\n\r\n#if 0  /* moved to freetype.h in version 2.2 */\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1\r\n#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2\r\n#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4\r\n#define FT_SUBGLYPH_FLAG_SCALE                   8\r\n#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40\r\n#define FT_SUBGLYPH_FLAG_2X2                  0x80\r\n#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200\r\n#endif\r\n\r\n\r\n  typedef struct  FT_SubGlyphRec_\r\n  {\r\n    FT_Int     index;\r\n    FT_UShort  flags;\r\n    FT_Int     arg1;\r\n    FT_Int     arg2;\r\n    FT_Matrix  transform;\r\n\r\n  } FT_SubGlyphRec;\r\n\r\n\r\n  typedef struct  FT_GlyphLoadRec_\r\n  {\r\n    FT_Outline   outline;       /* outline                   */\r\n    FT_Vector*   extra_points;  /* extra points table        */\r\n    FT_Vector*   extra_points2; /* second extra points table */\r\n    FT_UInt      num_subglyphs; /* number of subglyphs       */\r\n    FT_SubGlyph  subglyphs;     /* subglyphs                 */\r\n\r\n  } FT_GlyphLoadRec, *FT_GlyphLoad;\r\n\r\n\r\n  typedef struct  FT_GlyphLoaderRec_\r\n  {\r\n    FT_Memory        memory;\r\n    FT_UInt          max_points;\r\n    FT_UInt          max_contours;\r\n    FT_UInt          max_subglyphs;\r\n    FT_Bool          use_extra;\r\n\r\n    FT_GlyphLoadRec  base;\r\n    FT_GlyphLoadRec  current;\r\n\r\n    void*            other;            /* for possible future extension? */\r\n\r\n  } FT_GlyphLoaderRec;\r\n\r\n\r\n  /* create new empty glyph loader */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_New( FT_Memory        memory,\r\n                      FT_GlyphLoader  *aloader );\r\n\r\n  /* add an extra points table to a glyph loader */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CreateExtra( FT_GlyphLoader  loader );\r\n\r\n  /* destroy a glyph loader */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Done( FT_GlyphLoader  loader );\r\n\r\n  /* reset a glyph loader (frees everything int it) */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Reset( FT_GlyphLoader  loader );\r\n\r\n  /* rewind a glyph loader */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Rewind( FT_GlyphLoader  loader );\r\n\r\n  /* check that there is enough space to add `n_points' and `n_contours' */\r\n  /* to the glyph loader                                                 */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CheckPoints( FT_GlyphLoader  loader,\r\n                              FT_UInt         n_points,\r\n                              FT_UInt         n_contours );\r\n\r\n\r\n#define FT_GLYPHLOADER_CHECK_P( _loader, _count )                         \\\r\n   ( (_count) == 0 || ((_loader)->base.outline.n_points    +              \\\r\n                       (_loader)->current.outline.n_points +              \\\r\n                       (unsigned long)(_count)) <= (_loader)->max_points )\r\n\r\n#define FT_GLYPHLOADER_CHECK_C( _loader, _count )                          \\\r\n  ( (_count) == 0 || ((_loader)->base.outline.n_contours    +              \\\r\n                      (_loader)->current.outline.n_contours +              \\\r\n                      (unsigned long)(_count)) <= (_loader)->max_contours )\r\n\r\n#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \\\r\n  ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \\\r\n      FT_GLYPHLOADER_CHECK_C( _loader, _contours ) )                   \\\r\n    ? 0                                                                \\\r\n    : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )\r\n\r\n\r\n  /* check that there is enough space to add `n_subs' sub-glyphs to */\r\n  /* a glyph loader                                                 */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader  loader,\r\n                                 FT_UInt         n_subs );\r\n\r\n  /* prepare a glyph loader, i.e. empty the current glyph */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Prepare( FT_GlyphLoader  loader );\r\n\r\n  /* add the current glyph to the base glyph */\r\n  FT_BASE( void )\r\n  FT_GlyphLoader_Add( FT_GlyphLoader  loader );\r\n\r\n  /* copy points from one glyph loader to another */\r\n  FT_BASE( FT_Error )\r\n  FT_GlyphLoader_CopyPoints( FT_GlyphLoader  target,\r\n                             FT_GlyphLoader  source );\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTGLOADR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftmemory.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftmemory.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType memory management macros (specification).               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg                       */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTMEMORY_H__\r\n#define __FTMEMORY_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_CONFIG_H\r\n#include FT_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_SET_ERROR                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This macro is used to set an implicit `error' variable to a given  */\r\n  /*    expression's value (usually a function call), and convert it to a  */\r\n  /*    boolean which is set whenever the value is != 0.                   */\r\n  /*                                                                       */\r\n#undef  FT_SET_ERROR\r\n#define FT_SET_ERROR( expression ) \\\r\n          ( ( error = (expression) ) != 0 )\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                           M E M O R Y                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*\r\n   *  C++ refuses to handle statements like p = (void*)anything, with `p' a\r\n   *  typed pointer.  Since we don't have a `typeof' operator in standard\r\n   *  C++, we have to use a template to emulate it.\r\n   */\r\n\r\n#ifdef __cplusplus\r\n\r\n  extern \"C++\"\r\n  template <typename T> inline T*\r\n  cplusplus_typeof(        T*,\r\n                    void  *v )\r\n  {\r\n    return static_cast <T*> ( v );\r\n  }\r\n\r\n#define FT_ASSIGNP( p, val )  (p) = cplusplus_typeof( (p), (val) )\r\n\r\n#else\r\n\r\n#define FT_ASSIGNP( p, val )  (p) = (val)\r\n\r\n#endif\r\n\r\n\r\n\r\n#ifdef FT_DEBUG_MEMORY\r\n\r\n  FT_BASE( const char* )  _ft_debug_file;\r\n  FT_BASE( long )         _ft_debug_lineno;\r\n\r\n#define FT_DEBUG_INNER( exp )  ( _ft_debug_file   = __FILE__, \\\r\n                                 _ft_debug_lineno = __LINE__, \\\r\n                                 (exp) )\r\n\r\n#define FT_ASSIGNP_INNER( p, exp )  ( _ft_debug_file   = __FILE__, \\\r\n                                      _ft_debug_lineno = __LINE__, \\\r\n                                      FT_ASSIGNP( p, exp ) )\r\n\r\n#else /* !FT_DEBUG_MEMORY */\r\n\r\n#define FT_DEBUG_INNER( exp )       (exp)\r\n#define FT_ASSIGNP_INNER( p, exp )  FT_ASSIGNP( p, exp )\r\n\r\n#endif /* !FT_DEBUG_MEMORY */\r\n\r\n\r\n  /*\r\n   *  The allocation functions return a pointer, and the error code\r\n   *  is written to through the `p_error' parameter.  See below for\r\n   *  for documentation.\r\n   */\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_alloc( FT_Memory  memory,\r\n                FT_Long    size,\r\n                FT_Error  *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_qalloc( FT_Memory  memory,\r\n                 FT_Long    size,\r\n                 FT_Error  *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_realloc( FT_Memory  memory,\r\n                  FT_Long    item_size,\r\n                  FT_Long    cur_count,\r\n                  FT_Long    new_count,\r\n                  void*      block,\r\n                  FT_Error  *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_qrealloc( FT_Memory  memory,\r\n                   FT_Long    item_size,\r\n                   FT_Long    cur_count,\r\n                   FT_Long    new_count,\r\n                   void*      block,\r\n                   FT_Error  *p_error );\r\n\r\n  FT_BASE( void )\r\n  ft_mem_free( FT_Memory    memory,\r\n               const void*  P );\r\n\r\n\r\n#define FT_MEM_ALLOC( ptr, size )                                         \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) )\r\n\r\n#define FT_MEM_FREE( ptr )                \\\r\n          FT_BEGIN_STMNT                  \\\r\n            ft_mem_free( memory, (ptr) ); \\\r\n            (ptr) = NULL;                 \\\r\n          FT_END_STMNT\r\n\r\n#define FT_MEM_NEW( ptr )                        \\\r\n          FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )\r\n\r\n#define FT_MEM_REALLOC( ptr, cursz, newsz )                        \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1,        \\\r\n                                                 (cursz), (newsz), \\\r\n                                                 (ptr), &error ) )\r\n\r\n#define FT_MEM_QALLOC( ptr, size )                                         \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) )\r\n\r\n#define FT_MEM_QNEW( ptr )                        \\\r\n          FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )\r\n\r\n#define FT_MEM_QREALLOC( ptr, cursz, newsz )                         \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1,        \\\r\n                                                  (cursz), (newsz), \\\r\n                                                  (ptr), &error ) )\r\n\r\n#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz )                             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \\\r\n                                                  (cursz), (newsz),          \\\r\n                                                  (ptr), &error ) )\r\n\r\n#define FT_MEM_ALLOC_MULT( ptr, count, item_size )                    \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \\\r\n                                                 0, (count),          \\\r\n                                                 NULL, &error ) )\r\n\r\n#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz )            \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz),    \\\r\n                                                 (oldcnt), (newcnt), \\\r\n                                                 (ptr), &error ) )\r\n\r\n#define FT_MEM_QALLOC_MULT( ptr, count, item_size )                    \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \\\r\n                                                  0, (count),          \\\r\n                                                  NULL, &error ) )\r\n\r\n#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz)             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz),    \\\r\n                                                  (oldcnt), (newcnt), \\\r\n                                                  (ptr), &error ) )\r\n\r\n\r\n#define FT_MEM_SET_ERROR( cond )  ( (cond), error != 0 )\r\n\r\n\r\n#define FT_MEM_SET( dest, byte, count )     ft_memset( dest, byte, count )\r\n\r\n#define FT_MEM_COPY( dest, source, count )  ft_memcpy( dest, source, count )\r\n\r\n#define FT_MEM_MOVE( dest, source, count )  ft_memmove( dest, source, count )\r\n\r\n\r\n#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )\r\n\r\n#define FT_ZERO( p )                FT_MEM_ZERO( p, sizeof ( *(p) ) )\r\n\r\n\r\n#define FT_ARRAY_ZERO( dest, count )                        \\\r\n          FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) )\r\n\r\n#define FT_ARRAY_COPY( dest, source, count )                        \\\r\n          FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) )\r\n\r\n#define FT_ARRAY_MOVE( dest, source, count )                        \\\r\n          FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )\r\n\r\n\r\n  /*\r\n   *  Return the maximum number of addressable elements in an array.\r\n   *  We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid\r\n   *  any problems.\r\n   */\r\n#define FT_ARRAY_MAX( ptr )           ( FT_INT_MAX / sizeof ( *(ptr) ) )\r\n\r\n#define FT_ARRAY_CHECK( ptr, count )  ( (count) <= FT_ARRAY_MAX( ptr ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The following functions macros expect that their pointer argument is  */\r\n  /* _typed_ in order to automatically compute array element sizes.        */\r\n  /*                                                                       */\r\n\r\n#define FT_MEM_NEW_ARRAY( ptr, count )                                      \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \\\r\n                                                 0, (count),                \\\r\n                                                 NULL, &error ) )\r\n\r\n#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz )                             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \\\r\n                                                 (cursz), (newsz),          \\\r\n                                                 (ptr), &error ) )\r\n\r\n#define FT_MEM_QNEW_ARRAY( ptr, count )                                      \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \\\r\n                                                  0, (count),                \\\r\n                                                  NULL, &error ) )\r\n\r\n#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz )                             \\\r\n          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \\\r\n                                                  (cursz), (newsz),          \\\r\n                                                  (ptr), &error ) )\r\n\r\n\r\n#define FT_ALLOC( ptr, size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )\r\n\r\n#define FT_REALLOC( ptr, cursz, newsz )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )\r\n\r\n#define FT_ALLOC_MULT( ptr, count, item_size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )\r\n\r\n#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz )              \\\r\n          FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt,      \\\r\n                                                 newcnt, itmsz ) )\r\n\r\n#define FT_QALLOC( ptr, size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )\r\n\r\n#define FT_QREALLOC( ptr, cursz, newsz )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )\r\n\r\n#define FT_QALLOC_MULT( ptr, count, item_size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )\r\n\r\n#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz )              \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt,      \\\r\n                                                  newcnt, itmsz ) )\r\n\r\n#define FT_FREE( ptr )  FT_MEM_FREE( ptr )\r\n\r\n#define FT_NEW( ptr )  FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )\r\n\r\n#define FT_NEW_ARRAY( ptr, count )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\r\n\r\n#define FT_RENEW_ARRAY( ptr, curcnt, newcnt )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\r\n\r\n#define FT_QNEW( ptr )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )\r\n\r\n#define FT_QNEW_ARRAY( ptr, count )                          \\\r\n          FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\r\n\r\n#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt )                          \\\r\n          FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_Alloc( FT_Memory  memory,\r\n            FT_Long    size,\r\n            void*     *P );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_QAlloc( FT_Memory  memory,\r\n             FT_Long    size,\r\n             void*     *p );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_Realloc( FT_Memory  memory,\r\n              FT_Long    current,\r\n              FT_Long    size,\r\n              void*     *P );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_QRealloc( FT_Memory  memory,\r\n               FT_Long    current,\r\n               FT_Long    size,\r\n               void*     *p );\r\n\r\n  FT_BASE( void )\r\n  FT_Free( FT_Memory  memory,\r\n           void*     *P );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_strdup( FT_Memory    memory,\r\n                 const char*  str,\r\n                 FT_Error    *p_error );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_mem_dup( FT_Memory    memory,\r\n              const void*  address,\r\n              FT_ULong     size,\r\n              FT_Error    *p_error );\r\n\r\n#define FT_MEM_STRDUP( dst, str )                                            \\\r\n          (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )\r\n\r\n#define FT_STRDUP( dst, str )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )\r\n\r\n#define FT_MEM_DUP( dst, address, size )                                    \\\r\n          (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )\r\n\r\n#define FT_DUP( dst, address, size )                           \\\r\n          FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )\r\n\r\n\r\n  /* Return >= 1 if a truncation occurs.            */\r\n  /* Return 0 if the source string fits the buffer. */\r\n  /* This is *not* the same as strlcpy().           */\r\n  FT_BASE( FT_Int )\r\n  ft_mem_strcpyn( char*        dst,\r\n                  const char*  src,\r\n                  FT_ULong     size );\r\n\r\n#define FT_STRCPYN( dst, src, size )                                         \\\r\n          ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )\r\n\r\n /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTMEMORY_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftobjs.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftobjs.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType private base classes (specification).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  This file contains the definition of all internal FreeType classes.  */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTOBJS_H__\r\n#define __FTOBJS_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_RENDER_H\r\n#include FT_SIZES_H\r\n#include FT_LCD_FILTER_H\r\n#include FT_INTERNAL_MEMORY_H\r\n#include FT_INTERNAL_GLYPH_LOADER_H\r\n#include FT_INTERNAL_DRIVER_H\r\n#include FT_INTERNAL_AUTOHINT_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_INTERNAL_PIC_H\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n#include FT_INCREMENTAL_H\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Some generic definitions.                                             */\r\n  /*                                                                       */\r\n#ifndef TRUE\r\n#define TRUE  1\r\n#endif\r\n\r\n#ifndef FALSE\r\n#define FALSE  0\r\n#endif\r\n\r\n#ifndef NULL\r\n#define NULL  (void*)0\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* The min and max functions missing in C.  As usual, be careful not to  */\r\n  /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */\r\n  /*                                                                       */\r\n#define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )\r\n#define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )\r\n\r\n#define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )\r\n\r\n\r\n#define FT_PAD_FLOOR( x, n )  ( (x) & ~((n)-1) )\r\n#define FT_PAD_ROUND( x, n )  FT_PAD_FLOOR( (x) + ((n)/2), n )\r\n#define FT_PAD_CEIL( x, n )   FT_PAD_FLOOR( (x) + ((n)-1), n )\r\n\r\n#define FT_PIX_FLOOR( x )     ( (x) & ~63 )\r\n#define FT_PIX_ROUND( x )     FT_PIX_FLOOR( (x) + 32 )\r\n#define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )\r\n\r\n\r\n  /*\r\n   *  Return the highest power of 2 that is <= value; this correspond to\r\n   *  the highest bit in a given 32-bit value.\r\n   */\r\n  FT_BASE( FT_UInt32 )\r\n  ft_highpow2( FT_UInt32  value );\r\n\r\n\r\n  /*\r\n   *  character classification functions -- since these are used to parse\r\n   *  font files, we must not use those in <ctypes.h> which are\r\n   *  locale-dependent\r\n   */\r\n#define  ft_isdigit( x )   ( ( (unsigned)(x) - '0' ) < 10U )\r\n\r\n#define  ft_isxdigit( x )  ( ( (unsigned)(x) - '0' ) < 10U || \\\r\n                             ( (unsigned)(x) - 'a' ) < 6U  || \\\r\n                             ( (unsigned)(x) - 'A' ) < 6U  )\r\n\r\n  /* the next two macros assume ASCII representation */\r\n#define  ft_isupper( x )  ( ( (unsigned)(x) - 'A' ) < 26U )\r\n#define  ft_islower( x )  ( ( (unsigned)(x) - 'a' ) < 26U )\r\n\r\n#define  ft_isalpha( x )  ( ft_isupper( x ) || ft_islower( x ) )\r\n#define  ft_isalnum( x )  ( ft_isdigit( x ) || ft_isalpha( x ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                       C H A R M A P S                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* handle to internal charmap object */\r\n  typedef struct FT_CMapRec_*              FT_CMap;\r\n\r\n  /* handle to charmap class structure */\r\n  typedef const struct FT_CMap_ClassRec_*  FT_CMap_Class;\r\n\r\n  /* internal charmap object structure */\r\n  typedef struct  FT_CMapRec_\r\n  {\r\n    FT_CharMapRec  charmap;\r\n    FT_CMap_Class  clazz;\r\n\r\n  } FT_CMapRec;\r\n\r\n  /* typecase any pointer to a charmap handle */\r\n#define FT_CMAP( x )              ((FT_CMap)( x ))\r\n\r\n  /* obvious macros */\r\n#define FT_CMAP_PLATFORM_ID( x )  FT_CMAP( x )->charmap.platform_id\r\n#define FT_CMAP_ENCODING_ID( x )  FT_CMAP( x )->charmap.encoding_id\r\n#define FT_CMAP_ENCODING( x )     FT_CMAP( x )->charmap.encoding\r\n#define FT_CMAP_FACE( x )         FT_CMAP( x )->charmap.face\r\n\r\n\r\n  /* class method definitions */\r\n  typedef FT_Error\r\n  (*FT_CMap_InitFunc)( FT_CMap     cmap,\r\n                       FT_Pointer  init_data );\r\n\r\n  typedef void\r\n  (*FT_CMap_DoneFunc)( FT_CMap  cmap );\r\n\r\n  typedef FT_UInt\r\n  (*FT_CMap_CharIndexFunc)( FT_CMap    cmap,\r\n                            FT_UInt32  char_code );\r\n\r\n  typedef FT_UInt\r\n  (*FT_CMap_CharNextFunc)( FT_CMap     cmap,\r\n                           FT_UInt32  *achar_code );\r\n\r\n  typedef FT_UInt\r\n  (*FT_CMap_CharVarIndexFunc)( FT_CMap    cmap,\r\n                               FT_CMap    unicode_cmap,\r\n                               FT_UInt32  char_code,\r\n                               FT_UInt32  variant_selector );\r\n\r\n  typedef FT_Bool\r\n  (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap    cmap,\r\n                                   FT_UInt32  char_code,\r\n                                   FT_UInt32  variant_selector );\r\n\r\n  typedef FT_UInt32 *\r\n  (*FT_CMap_VariantListFunc)( FT_CMap    cmap,\r\n                              FT_Memory  mem );\r\n\r\n  typedef FT_UInt32 *\r\n  (*FT_CMap_CharVariantListFunc)( FT_CMap    cmap,\r\n                                  FT_Memory  mem,\r\n                                  FT_UInt32  char_code );\r\n\r\n  typedef FT_UInt32 *\r\n  (*FT_CMap_VariantCharListFunc)( FT_CMap    cmap,\r\n                                  FT_Memory  mem,\r\n                                  FT_UInt32  variant_selector );\r\n\r\n\r\n  typedef struct  FT_CMap_ClassRec_\r\n  {\r\n    FT_ULong               size;\r\n    FT_CMap_InitFunc       init;\r\n    FT_CMap_DoneFunc       done;\r\n    FT_CMap_CharIndexFunc  char_index;\r\n    FT_CMap_CharNextFunc   char_next;\r\n\r\n    /* Subsequent entries are special ones for format 14 -- the variant */\r\n    /* selector subtable which behaves like no other                    */\r\n\r\n    FT_CMap_CharVarIndexFunc      char_var_index;\r\n    FT_CMap_CharVarIsDefaultFunc  char_var_default;\r\n    FT_CMap_VariantListFunc       variant_list;\r\n    FT_CMap_CharVariantListFunc   charvariant_list;\r\n    FT_CMap_VariantCharListFunc   variantchar_list;\r\n\r\n  } FT_CMap_ClassRec;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DECLARE_CMAP_CLASS(class_) \\\r\n    FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;\r\n\r\n#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_,       \\\r\n        char_next_, char_var_index_, char_var_default_, variant_list_,       \\\r\n        charvariant_list_, variantchar_list_)                                \\\r\n  FT_CALLBACK_TABLE_DEF                                                      \\\r\n  const FT_CMap_ClassRec class_ =                                            \\\r\n  {                                                                          \\\r\n    size_, init_, done_, char_index_, char_next_, char_var_index_,           \\\r\n    char_var_default_, variant_list_, charvariant_list_, variantchar_list_   \\\r\n  };\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DECLARE_CMAP_CLASS(class_) \\\r\n    void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec*  clazz);\r\n\r\n#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_,       \\\r\n        char_next_, char_var_index_, char_var_default_, variant_list_,       \\\r\n        charvariant_list_, variantchar_list_)                                \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library,                                \\\r\n                          FT_CMap_ClassRec*  clazz)                          \\\r\n  {                                                                          \\\r\n    FT_UNUSED(library);                                                      \\\r\n    clazz->size = size_;                                                     \\\r\n    clazz->init = init_;                                                     \\\r\n    clazz->done = done_;                                                     \\\r\n    clazz->char_index = char_index_;                                         \\\r\n    clazz->char_next = char_next_;                                           \\\r\n    clazz->char_var_index = char_var_index_;                                 \\\r\n    clazz->char_var_default = char_var_default_;                             \\\r\n    clazz->variant_list = variant_list_;                                     \\\r\n    clazz->charvariant_list = charvariant_list_;                             \\\r\n    clazz->variantchar_list = variantchar_list_;                             \\\r\n  } \r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n  /* create a new charmap and add it to charmap->face */\r\n  FT_BASE( FT_Error )\r\n  FT_CMap_New( FT_CMap_Class  clazz,\r\n               FT_Pointer     init_data,\r\n               FT_CharMap     charmap,\r\n               FT_CMap       *acmap );\r\n\r\n  /* destroy a charmap and remove it from face's list */\r\n  FT_BASE( void )\r\n  FT_CMap_Done( FT_CMap  cmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Face_InternalRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure contains the internal fields of each FT_Face        */\r\n  /*    object.  These fields may change between different releases of     */\r\n  /*    FreeType.                                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    max_points ::                                                      */\r\n  /*      The maximal number of points used to store the vectorial outline */\r\n  /*      of any glyph in this face.  If this value cannot be known in     */\r\n  /*      advance, or if the face isn't scalable, this should be set to 0. */\r\n  /*      Only relevant for scalable formats.                              */\r\n  /*                                                                       */\r\n  /*    max_contours ::                                                    */\r\n  /*      The maximal number of contours used to store the vectorial       */\r\n  /*      outline of any glyph in this face.  If this value cannot be      */\r\n  /*      known in advance, or if the face isn't scalable, this should be  */\r\n  /*      set to 0.  Only relevant for scalable formats.                   */\r\n  /*                                                                       */\r\n  /*    transform_matrix ::                                                */\r\n  /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */\r\n  /*      outlines after they are loaded from the font.  Only used by the  */\r\n  /*      convenience functions.                                           */\r\n  /*                                                                       */\r\n  /*    transform_delta ::                                                 */\r\n  /*      A translation vector used to transform glyph outlines after they */\r\n  /*      are loaded from the font.  Only used by the convenience          */\r\n  /*      functions.                                                       */\r\n  /*                                                                       */\r\n  /*    transform_flags ::                                                 */\r\n  /*      Some flags used to classify the transform.  Only used by the     */\r\n  /*      convenience functions.                                           */\r\n  /*                                                                       */\r\n  /*    services ::                                                        */\r\n  /*      A cache for frequently used services.  It should be only         */\r\n  /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */\r\n  /*                                                                       */\r\n  /*    incremental_interface ::                                           */\r\n  /*      If non-null, the interface through which glyph data and metrics  */\r\n  /*      are loaded incrementally for faces that do not provide all of    */\r\n  /*      this data when first opened.  This field exists only if          */\r\n  /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */\r\n  /*                                                                       */\r\n  /*    ignore_unpatented_hinter ::                                        */\r\n  /*      This boolean flag instructs the glyph loader to ignore the       */\r\n  /*      native font hinter, if one is found.  This is exclusively used   */\r\n  /*      in the case when the unpatented hinter is compiled within the    */\r\n  /*      library.                                                         */\r\n  /*                                                                       */\r\n  /*    refcount ::                                                        */\r\n  /*      A counter initialized to~1 at the time an @FT_Face structure is  */\r\n  /*      created.  @FT_Reference_Face increments this counter, and        */\r\n  /*      @FT_Done_Face only destroys a face if the counter is~1,          */\r\n  /*      otherwise it simply decrements it.                               */\r\n  /*                                                                       */\r\n  typedef struct  FT_Face_InternalRec_\r\n  {\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_UShort           reserved1;\r\n    FT_Short            reserved2;\r\n#endif\r\n    FT_Matrix           transform_matrix;\r\n    FT_Vector           transform_delta;\r\n    FT_Int              transform_flags;\r\n\r\n    FT_ServiceCacheRec  services;\r\n\r\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\r\n    FT_Incremental_InterfaceRec*  incremental_interface;\r\n#endif\r\n\r\n    FT_Bool             ignore_unpatented_hinter;\r\n    FT_UInt             refcount;\r\n\r\n  } FT_Face_InternalRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Slot_InternalRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure contains the internal fields of each FT_GlyphSlot   */\r\n  /*    object.  These fields may change between different releases of     */\r\n  /*    FreeType.                                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    loader            :: The glyph loader object used to load outlines */\r\n  /*                         into the glyph slot.                          */\r\n  /*                                                                       */\r\n  /*    flags             :: Possible values are zero or                   */\r\n  /*                         FT_GLYPH_OWN_BITMAP.  The latter indicates    */\r\n  /*                         that the FT_GlyphSlot structure owns the      */\r\n  /*                         bitmap buffer.                                */\r\n  /*                                                                       */\r\n  /*    glyph_transformed :: Boolean.  Set to TRUE when the loaded glyph   */\r\n  /*                         must be transformed through a specific        */\r\n  /*                         font transformation.  This is _not_ the same  */\r\n  /*                         as the face transform set through             */\r\n  /*                         FT_Set_Transform().                           */\r\n  /*                                                                       */\r\n  /*    glyph_matrix      :: The 2x2 matrix corresponding to the glyph     */\r\n  /*                         transformation, if necessary.                 */\r\n  /*                                                                       */\r\n  /*    glyph_delta       :: The 2d translation vector corresponding to    */\r\n  /*                         the glyph transformation, if necessary.       */\r\n  /*                                                                       */\r\n  /*    glyph_hints       :: Format-specific glyph hints management.       */\r\n  /*                                                                       */\r\n\r\n#define FT_GLYPH_OWN_BITMAP  0x1\r\n\r\n  typedef struct  FT_Slot_InternalRec_\r\n  {\r\n    FT_GlyphLoader  loader;\r\n    FT_UInt         flags;\r\n    FT_Bool         glyph_transformed;\r\n    FT_Matrix       glyph_matrix;\r\n    FT_Vector       glyph_delta;\r\n    void*           glyph_hints;\r\n\r\n  } FT_GlyphSlot_InternalRec;\r\n\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_Size_InternalRec                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure contains the internal fields of each FT_Size        */\r\n  /*    object.  Currently, it's empty.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n  typedef struct  FT_Size_InternalRec_\r\n  {\r\n    /* empty */\r\n\r\n  } FT_Size_InternalRec;\r\n\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                         M O D U L E S                           ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_ModuleRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A module object instance.                                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    clazz   :: A pointer to the module's class.                        */\r\n  /*                                                                       */\r\n  /*    library :: A handle to the parent library object.                  */\r\n  /*                                                                       */\r\n  /*    memory  :: A handle to the memory manager.                         */\r\n  /*                                                                       */\r\n  /*    generic :: A generic structure for user-level extensibility (?).   */\r\n  /*                                                                       */\r\n  typedef struct  FT_ModuleRec_\r\n  {\r\n    FT_Module_Class*  clazz;\r\n    FT_Library        library;\r\n    FT_Memory         memory;\r\n    FT_Generic        generic;\r\n\r\n  } FT_ModuleRec;\r\n\r\n\r\n  /* typecast an object to a FT_Module */\r\n#define FT_MODULE( x )          ((FT_Module)( x ))\r\n#define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz\r\n#define FT_MODULE_LIBRARY( x )  FT_MODULE( x )->library\r\n#define FT_MODULE_MEMORY( x )   FT_MODULE( x )->memory\r\n\r\n\r\n#define FT_MODULE_IS_DRIVER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                    FT_MODULE_FONT_DRIVER )\r\n\r\n#define FT_MODULE_IS_RENDERER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                      FT_MODULE_RENDERER )\r\n\r\n#define FT_MODULE_IS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                    FT_MODULE_HINTER )\r\n\r\n#define FT_MODULE_IS_STYLER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                    FT_MODULE_STYLER )\r\n\r\n#define FT_DRIVER_IS_SCALABLE( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                      FT_MODULE_DRIVER_SCALABLE )\r\n\r\n#define FT_DRIVER_USES_OUTLINES( x )  !( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                         FT_MODULE_DRIVER_NO_OUTLINES )\r\n\r\n#define FT_DRIVER_HAS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \\\r\n                                     FT_MODULE_DRIVER_HAS_HINTER )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Module_Interface                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Finds a module and returns its specific interface as a typeless    */\r\n  /*    pointer.                                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library     :: A handle to the library object.                     */\r\n  /*                                                                       */\r\n  /*    module_name :: The module's name (as an ASCII string).             */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A module-specific interface if available, 0 otherwise.             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    You should better be familiar with FreeType internals to know      */\r\n  /*    which module to look for, and what its interface is :-)            */\r\n  /*                                                                       */\r\n  FT_BASE( const void* )\r\n  FT_Get_Module_Interface( FT_Library   library,\r\n                           const char*  mod_name );\r\n\r\n  FT_BASE( FT_Pointer )\r\n  ft_module_get_service( FT_Module    module,\r\n                         const char*  service_id );\r\n\r\n /* */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****               FACE, SIZE & GLYPH SLOT OBJECTS                   ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* a few macros used to perform easy typecasts with minimal brain damage */\r\n\r\n#define FT_FACE( x )          ((FT_Face)(x))\r\n#define FT_SIZE( x )          ((FT_Size)(x))\r\n#define FT_SLOT( x )          ((FT_GlyphSlot)(x))\r\n\r\n#define FT_FACE_DRIVER( x )   FT_FACE( x )->driver\r\n#define FT_FACE_LIBRARY( x )  FT_FACE_DRIVER( x )->root.library\r\n#define FT_FACE_MEMORY( x )   FT_FACE( x )->memory\r\n#define FT_FACE_STREAM( x )   FT_FACE( x )->stream\r\n\r\n#define FT_SIZE_FACE( x )     FT_SIZE( x )->face\r\n#define FT_SLOT_FACE( x )     FT_SLOT( x )->face\r\n\r\n#define FT_FACE_SLOT( x )     FT_FACE( x )->glyph\r\n#define FT_FACE_SIZE( x )     FT_FACE( x )->size\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_GlyphSlot                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    It is sometimes useful to have more than one glyph slot for a      */\r\n  /*    given face object.  This function is used to create additional     */\r\n  /*    slots.  All of them are automatically discarded when the face is   */\r\n  /*    destroyed.                                                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face  :: A handle to a parent face object.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    aslot :: A handle to a new glyph slot object.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Error )\r\n  FT_New_GlyphSlot( FT_Face        face,\r\n                    FT_GlyphSlot  *aslot );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_GlyphSlot                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroys a given glyph slot.  Remember however that all slots are  */\r\n  /*    automatically destroyed with its parent.  Using this function is   */\r\n  /*    not always mandatory.                                              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    slot :: A handle to a target glyph slot.                           */\r\n  /*                                                                       */\r\n  FT_BASE( void )\r\n  FT_Done_GlyphSlot( FT_GlyphSlot  slot );\r\n\r\n /* */\r\n\r\n#define FT_REQUEST_WIDTH( req )                                            \\\r\n          ( (req)->horiResolution                                          \\\r\n              ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \\\r\n              : (req)->width )\r\n\r\n#define FT_REQUEST_HEIGHT( req )                                            \\\r\n          ( (req)->vertResolution                                           \\\r\n              ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \\\r\n              : (req)->height )\r\n\r\n\r\n  /* Set the metrics according to a bitmap strike. */\r\n  FT_BASE( void )\r\n  FT_Select_Metrics( FT_Face   face,\r\n                     FT_ULong  strike_index );\r\n\r\n\r\n  /* Set the metrics according to a size request. */\r\n  FT_BASE( void )\r\n  FT_Request_Metrics( FT_Face          face,\r\n                      FT_Size_Request  req );\r\n\r\n\r\n  /* Match a size request against `available_sizes'. */\r\n  FT_BASE( FT_Error )\r\n  FT_Match_Size( FT_Face          face,\r\n                 FT_Size_Request  req,\r\n                 FT_Bool          ignore_width,\r\n                 FT_ULong*        size_index );\r\n\r\n\r\n  /* Use the horizontal metrics to synthesize the vertical metrics. */\r\n  /* If `advance' is zero, it is also synthesized.                  */\r\n  FT_BASE( void )\r\n  ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,\r\n                                  FT_Pos             advance );\r\n\r\n\r\n  /* Free the bitmap of a given glyphslot when needed (i.e., only when it */\r\n  /* was allocated with ft_glyphslot_alloc_bitmap).                       */\r\n  FT_BASE( void )\r\n  ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );\r\n\r\n\r\n  /* Allocate a new bitmap buffer in a glyph slot. */\r\n  FT_BASE( FT_Error )\r\n  ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,\r\n                             FT_ULong      size );\r\n\r\n\r\n  /* Set the bitmap buffer in a glyph slot to a given pointer.  The buffer */\r\n  /* will not be freed by a later call to ft_glyphslot_free_bitmap.        */\r\n  FT_BASE( void )\r\n  ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,\r\n                           FT_Byte*      buffer );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                        R E N D E R E R S                        ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#define FT_RENDERER( x )      ((FT_Renderer)( x ))\r\n#define FT_GLYPH( x )         ((FT_Glyph)( x ))\r\n#define FT_BITMAP_GLYPH( x )  ((FT_BitmapGlyph)( x ))\r\n#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))\r\n\r\n\r\n  typedef struct  FT_RendererRec_\r\n  {\r\n    FT_ModuleRec            root;\r\n    FT_Renderer_Class*      clazz;\r\n    FT_Glyph_Format         glyph_format;\r\n    FT_Glyph_Class          glyph_class;\r\n\r\n    FT_Raster               raster;\r\n    FT_Raster_Render_Func   raster_render;\r\n    FT_Renderer_RenderFunc  render;\r\n\r\n  } FT_RendererRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                    F O N T   D R I V E R S                      ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* typecast a module into a driver easily */\r\n#define FT_DRIVER( x )        ((FT_Driver)(x))\r\n\r\n  /* typecast a module as a driver, and get its driver class */\r\n#define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_DriverRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The root font driver class.  A font driver is responsible for      */\r\n  /*    managing and loading font files of a given format.                 */\r\n  /*                                                                       */\r\n  /*  <Fields>                                                             */\r\n  /*     root         :: Contains the fields of the root module class.     */\r\n  /*                                                                       */\r\n  /*     clazz        :: A pointer to the font driver's class.  Note that  */\r\n  /*                     this is NOT root.clazz.  `class' wasn't used      */\r\n  /*                     as it is a reserved word in C++.                  */\r\n  /*                                                                       */\r\n  /*     faces_list   :: The list of faces currently opened by this        */\r\n  /*                     driver.                                           */\r\n  /*                                                                       */\r\n  /*     extensions   :: A typeless pointer to the driver's extensions     */\r\n  /*                     registry, if they are supported through the       */\r\n  /*                     configuration macro FT_CONFIG_OPTION_EXTENSIONS.  */\r\n  /*                                                                       */\r\n  /*     glyph_loader :: The glyph loader for all faces managed by this    */\r\n  /*                     driver.  This object isn't defined for unscalable */\r\n  /*                     formats.                                          */\r\n  /*                                                                       */\r\n  typedef struct  FT_DriverRec_\r\n  {\r\n    FT_ModuleRec     root;\r\n    FT_Driver_Class  clazz;\r\n\r\n    FT_ListRec       faces_list;\r\n    void*            extensions;\r\n\r\n    FT_GlyphLoader   glyph_loader;\r\n\r\n  } FT_DriverRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                       L I B R A R I E S                         ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /* This hook is used by the TrueType debugger.  It must be set to an */\r\n  /* alternate truetype bytecode interpreter function.                 */\r\n#define FT_DEBUG_HOOK_TRUETYPE            0\r\n\r\n\r\n  /* Set this debug hook to a non-null pointer to force unpatented hinting */\r\n  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */\r\n  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */\r\n  /* during debugging.                                                     */\r\n#define FT_DEBUG_HOOK_UNPATENTED_HINTING  1\r\n\r\n\r\n  typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,\r\n                                            FT_Render_Mode  render_mode,\r\n                                            FT_Library      library );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    FT_LibraryRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The FreeType library class.  This is the root of all FreeType      */\r\n  /*    data.  Use FT_New_Library() to create a library object, and        */\r\n  /*    FT_Done_Library() to discard it and all child objects.             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory           :: The library's memory object.  Manages memory   */\r\n  /*                        allocation.                                    */\r\n  /*                                                                       */\r\n  /*    generic          :: Client data variable.  Used to extend the      */\r\n  /*                        Library class by higher levels and clients.    */\r\n  /*                                                                       */\r\n  /*    version_major    :: The major version number of the library.       */\r\n  /*                                                                       */\r\n  /*    version_minor    :: The minor version number of the library.       */\r\n  /*                                                                       */\r\n  /*    version_patch    :: The current patch level of the library.        */\r\n  /*                                                                       */\r\n  /*    num_modules      :: The number of modules currently registered     */\r\n  /*                        within this library.  This is set to 0 for new */\r\n  /*                        libraries.  New modules are added through the  */\r\n  /*                        FT_Add_Module() API function.                  */\r\n  /*                                                                       */\r\n  /*    modules          :: A table used to store handles to the currently */\r\n  /*                        registered modules. Note that each font driver */\r\n  /*                        contains a list of its opened faces.           */\r\n  /*                                                                       */\r\n  /*    renderers        :: The list of renderers currently registered     */\r\n  /*                        within the library.                            */\r\n  /*                                                                       */\r\n  /*    cur_renderer     :: The current outline renderer.  This is a       */\r\n  /*                        shortcut used to avoid parsing the list on     */\r\n  /*                        each call to FT_Outline_Render().  It is a     */\r\n  /*                        handle to the current renderer for the         */\r\n  /*                        FT_GLYPH_FORMAT_OUTLINE format.                */\r\n  /*                                                                       */\r\n  /*    auto_hinter      :: XXX                                            */\r\n  /*                                                                       */\r\n  /*    raster_pool      :: The raster object's render pool.  This can     */\r\n  /*                        ideally be changed dynamically at run-time.    */\r\n  /*                                                                       */\r\n  /*    raster_pool_size :: The size of the render pool in bytes.          */\r\n  /*                                                                       */\r\n  /*    debug_hooks      :: XXX                                            */\r\n  /*                                                                       */\r\n  /*    lcd_filter       :: If subpixel rendering is activated, the        */\r\n  /*                        selected LCD filter mode.                      */\r\n  /*                                                                       */\r\n  /*    lcd_extra        :: If subpixel rendering is activated, the number */\r\n  /*                        of extra pixels needed for the LCD filter.     */\r\n  /*                                                                       */\r\n  /*    lcd_weights      :: If subpixel rendering is activated, the LCD    */\r\n  /*                        filter weights, if any.                        */\r\n  /*                                                                       */\r\n  /*    lcd_filter_func  :: If subpixel rendering is activated, the LCD    */\r\n  /*                        filtering callback function.                   */\r\n  /*                                                                       */\r\n  /*    pic_container    :: Contains global structs and tables, instead    */\r\n  /*                        of defining them globallly.                    */\r\n  /*                                                                       */\r\n  /*    refcount         :: A counter initialized to~1 at the time an      */\r\n  /*                        @FT_Library structure is created.              */\r\n  /*                        @FT_Reference_Library increments this counter, */\r\n  /*                        and @FT_Done_Library only destroys a library   */\r\n  /*                        if the counter is~1, otherwise it simply       */\r\n  /*                        decrements it.                                 */\r\n  /*                                                                       */\r\n  typedef struct  FT_LibraryRec_\r\n  {\r\n    FT_Memory          memory;           /* library's memory manager */\r\n\r\n    FT_Generic         generic;\r\n\r\n    FT_Int             version_major;\r\n    FT_Int             version_minor;\r\n    FT_Int             version_patch;\r\n\r\n    FT_UInt            num_modules;\r\n    FT_Module          modules[FT_MAX_MODULES];  /* module objects  */\r\n\r\n    FT_ListRec         renderers;        /* list of renderers        */\r\n    FT_Renderer        cur_renderer;     /* current outline renderer */\r\n    FT_Module          auto_hinter;\r\n\r\n    FT_Byte*           raster_pool;      /* scan-line conversion */\r\n                                         /* render pool          */\r\n    FT_ULong           raster_pool_size; /* size of render pool in bytes */\r\n\r\n    FT_DebugHook_Func  debug_hooks[4];\r\n\r\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\r\n    FT_LcdFilter             lcd_filter;\r\n    FT_Int                   lcd_extra;        /* number of extra pixels */\r\n    FT_Byte                  lcd_weights[7];   /* filter weights, if any */\r\n    FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */\r\n#endif\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n    FT_PIC_Container   pic_container;\r\n#endif\r\n\r\n    FT_UInt            refcount;\r\n\r\n  } FT_LibraryRec;\r\n\r\n\r\n  FT_BASE( FT_Renderer )\r\n  FT_Lookup_Renderer( FT_Library       library,\r\n                      FT_Glyph_Format  format,\r\n                      FT_ListNode*     node );\r\n\r\n  FT_BASE( FT_Error )\r\n  FT_Render_Glyph_Internal( FT_Library      library,\r\n                            FT_GlyphSlot    slot,\r\n                            FT_Render_Mode  render_mode );\r\n\r\n  typedef const char*\r\n  (*FT_Face_GetPostscriptNameFunc)( FT_Face  face );\r\n\r\n  typedef FT_Error\r\n  (*FT_Face_GetGlyphNameFunc)( FT_Face     face,\r\n                               FT_UInt     glyph_index,\r\n                               FT_Pointer  buffer,\r\n                               FT_UInt     buffer_max );\r\n\r\n  typedef FT_UInt\r\n  (*FT_Face_GetGlyphNameIndexFunc)( FT_Face     face,\r\n                                    FT_String*  glyph_name );\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_New_Memory                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Creates a new memory object.                                       */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A pointer to the new memory object.  0 in case of error.           */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Memory )\r\n  FT_New_Memory( void );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Done_Memory                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Discards memory manager.                                           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the memory manager.                          */\r\n  /*                                                                       */\r\n  FT_BASE( void )\r\n  FT_Done_Memory( FT_Memory  memory );\r\n\r\n#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\r\n\r\n\r\n  /* Define default raster's interface.  The default raster is located in  */\r\n  /* `src/base/ftraster.c'.                                                */\r\n  /*                                                                       */\r\n  /* Client applications can register new rasters through the              */\r\n  /* FT_Set_Raster() API.                                                  */\r\n\r\n#ifndef FT_NO_DEFAULT_RASTER\r\n  FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****              PIC-Support Macros for ftimage.h                   ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_OUTLINE_FUNCS                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Outline_Funcs struct.         */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */\r\n  /*    called with a pre-allocated stracture to be filled.                */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_,       \\\r\n                                cubic_to_, shift_, delta_)                   \\\r\n  static const FT_Outline_Funcs class_ =                                     \\\r\n  {                                                                          \\\r\n    move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_                 \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_,       \\\r\n                                cubic_to_, shift_, delta_)                   \\\r\n  static FT_Error                                                            \\\r\n  Init_Class_##class_( FT_Outline_Funcs*  clazz )                            \\\r\n  {                                                                          \\\r\n    clazz->move_to = move_to_;                                               \\\r\n    clazz->line_to = line_to_;                                               \\\r\n    clazz->conic_to = conic_to_;                                             \\\r\n    clazz->cubic_to = cubic_to_;                                             \\\r\n    clazz->shift = shift_;                                                   \\\r\n    clazz->delta = delta_;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_RASTER_FUNCS                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Raster_Funcs struct.          */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */\r\n  /*    called with a pre-allocated stracture to be filled.                */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,           \\\r\n                               raster_reset_, raster_set_mode_,              \\\r\n                               raster_render_, raster_done_)                 \\\r\n  const FT_Raster_Funcs class_ =                                      \\\r\n  {                                                                          \\\r\n    glyph_format_, raster_new_, raster_reset_,                               \\\r\n    raster_set_mode_, raster_render_, raster_done_                           \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,           \\\r\n    raster_reset_, raster_set_mode_, raster_render_, raster_done_)           \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Raster_Funcs*  clazz )                          \\\r\n  {                                                                          \\\r\n    clazz->glyph_format = glyph_format_;                                     \\\r\n    clazz->raster_new = raster_new_;                                         \\\r\n    clazz->raster_reset = raster_reset_;                                     \\\r\n    clazz->raster_set_mode = raster_set_mode_;                               \\\r\n    clazz->raster_render = raster_render_;                                   \\\r\n    clazz->raster_done = raster_done_;                                       \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****              PIC-Support Macros for ftrender.h                  ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_GLYPH                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Glyph_Class struct.           */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */\r\n  /*    called with a pre-allocated stracture to be filled.                */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_,         \\\r\n                        transform_, bbox_, prepare_)                         \\\r\n  FT_CALLBACK_TABLE_DEF                                                      \\\r\n  const FT_Glyph_Class class_ =                                              \\\r\n  {                                                                          \\\r\n    size_, format_, init_, done_, copy_, transform_, bbox_, prepare_         \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_,         \\\r\n                        transform_, bbox_, prepare_)                         \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Glyph_Class*  clazz )                           \\\r\n  {                                                                          \\\r\n    clazz->glyph_size = size_;                                               \\\r\n    clazz->glyph_format = format_;                                           \\\r\n    clazz->glyph_init = init_;                                               \\\r\n    clazz->glyph_done = done_;                                               \\\r\n    clazz->glyph_copy = copy_;                                               \\\r\n    clazz->glyph_transform = transform_;                                     \\\r\n    clazz->glyph_bbox = bbox_;                                               \\\r\n    clazz->glyph_prepare = prepare_;                                         \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DECLARE_RENDERER                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to create a forward declaration of a                          */\r\n  /*    FT_Renderer_Class stract instance.                                 */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_RENDERER                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Renderer_Class struct.        */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */\r\n  /*    to called with a pointer where the allocated stracture is returned.*/\r\n  /*    And when it is no longer needed a Destroy function needs           */\r\n  /*    to be called to release that allocation.                           */\r\n  /*    fcinit.c (ft_create_default_module_classes) already contains       */\r\n  /*    a mechanism to call these functions for the default modules        */\r\n  /*    described in ftmodule.h                                            */\r\n  /*                                                                       */\r\n  /*    Notice that the created Create and Destroy functions call          */\r\n  /*    pic_init and pic_free function to allow you to manually allocate   */\r\n  /*    and initialize any additional global data, like module specific    */\r\n  /*    interface, and put them in the global pic container defined in     */\r\n  /*    ftpic.h. if you don't need them just implement the functions as    */\r\n  /*    empty to resolve the link error.                                   */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DECLARE_RENDERER(class_)                                          \\\r\n    FT_EXPORT_VAR( const FT_Renderer_Class ) class_;\r\n\r\n#define FT_DEFINE_RENDERER(class_,                                           \\\r\n                           flags_, size_, name_, version_, requires_,        \\\r\n                           interface_, init_, done_, get_interface_,         \\\r\n                           glyph_format_, render_glyph_, transform_glyph_,   \\\r\n                           get_glyph_cbox_, set_mode_, raster_class_ )       \\\r\n  FT_CALLBACK_TABLE_DEF                                                      \\\r\n  const FT_Renderer_Class  class_ =                                          \\\r\n  {                                                                          \\\r\n    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,             \\\r\n                          interface_,init_,done_,get_interface_)             \\\r\n    glyph_format_,                                                           \\\r\n                                                                             \\\r\n    render_glyph_,                                                           \\\r\n    transform_glyph_,                                                        \\\r\n    get_glyph_cbox_,                                                         \\\r\n    set_mode_,                                                               \\\r\n                                                                             \\\r\n    raster_class_                                                            \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DECLARE_RENDERER(class_)  FT_DECLARE_MODULE(class_)\r\n\r\n#define FT_DEFINE_RENDERER(class_, \\\r\n                           flags_, size_, name_, version_, requires_,        \\\r\n                           interface_, init_, done_, get_interface_,         \\\r\n                           glyph_format_, render_glyph_, transform_glyph_,   \\\r\n                           get_glyph_cbox_, set_mode_, raster_class_ )       \\\r\n  void class_##_pic_free( FT_Library library );                              \\\r\n  FT_Error class_##_pic_init( FT_Library library );                          \\\r\n                                                                             \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library        library,                      \\\r\n                        FT_Module_Class*  clazz )                            \\\r\n  {                                                                          \\\r\n    FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz;                   \\\r\n    FT_Memory         memory = library->memory;                              \\\r\n    class_##_pic_free( library );                                            \\\r\n    if ( rclazz )                                                            \\\r\n      FT_FREE( rclazz );                                                     \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library         library,                      \\\r\n                            FT_Module_Class**  output_class )                \\\r\n  {                                                                          \\\r\n    FT_Renderer_Class*  clazz;                                               \\\r\n    FT_Error            error;                                               \\\r\n    FT_Memory           memory = library->memory;                            \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \\\r\n      return error;                                                          \\\r\n                                                                             \\\r\n    error = class_##_pic_init( library );                                    \\\r\n    if(error)                                                                \\\r\n    {                                                                        \\\r\n      FT_FREE( clazz );                                                      \\\r\n      return error;                                                          \\\r\n    }                                                                        \\\r\n                                                                             \\\r\n    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,             \\\r\n                          interface_,init_,done_,get_interface_)             \\\r\n                                                                             \\\r\n    clazz->glyph_format       = glyph_format_;                               \\\r\n                                                                             \\\r\n    clazz->render_glyph       = render_glyph_;                               \\\r\n    clazz->transform_glyph    = transform_glyph_;                            \\\r\n    clazz->get_glyph_cbox     = get_glyph_cbox_;                             \\\r\n    clazz->set_mode           = set_mode_;                                   \\\r\n                                                                             \\\r\n    clazz->raster_class       = raster_class_;                               \\\r\n                                                                             \\\r\n    *output_class = (FT_Module_Class*)clazz;                                 \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****              PIC-Support Macros for ftmodapi.h                  ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Creator                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to create (allocate) a new module class object.    */\r\n  /*    The object's members are initialized, but the module itself is     */\r\n  /*    not.                                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory       :: A handle to the memory manager.                    */\r\n  /*    output_class :: Initialized with the newly allocated class.        */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*FT_Module_Creator)( FT_Memory          memory,\r\n                        FT_Module_Class**  output_class );\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    FT_Module_Destroyer                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A function used to destroy (deallocate) a module class object.     */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    memory :: A handle to the memory manager.                          */\r\n  /*    clazz  :: Module class to destroy.                                 */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*FT_Module_Destroyer)( FT_Memory         memory,\r\n                          FT_Module_Class*  clazz );\r\n\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DECLARE_MODULE                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to create a forward declaration of a                          */\r\n  /*    FT_Module_Class stract instance.                                   */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_MODULE                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Module_Class struct.          */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */\r\n  /*    to called with a pointer where the allocated stracture is returned.*/\r\n  /*    And when it is no longer needed a Destroy function needs           */\r\n  /*    to be called to release that allocation.                           */\r\n  /*    fcinit.c (ft_create_default_module_classes) already contains       */\r\n  /*    a mechanism to call these functions for the default modules        */\r\n  /*    described in ftmodule.h                                            */\r\n  /*                                                                       */\r\n  /*    Notice that the created Create and Destroy functions call          */\r\n  /*    pic_init and pic_free function to allow you to manually allocate   */\r\n  /*    and initialize any additional global data, like module specific    */\r\n  /*    interface, and put them in the global pic container defined in     */\r\n  /*    ftpic.h. if you don't need them just implement the functions as    */\r\n  /*    empty to resolve the link error.                                   */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_ROOT_MODULE                                              */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an instance of FT_Module_Class struct inside    */\r\n  /*    another stract that contains it or in a function that initializes  */\r\n  /*    that containing stract                                             */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DECLARE_MODULE(class_)                                            \\\r\n  FT_CALLBACK_TABLE                                                          \\\r\n  const FT_Module_Class  class_;                                             \\\r\n\r\n#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_,     \\\r\n                              interface_, init_, done_, get_interface_)      \\\r\n  {                                                                          \\\r\n    flags_,                                                                  \\\r\n    size_,                                                                   \\\r\n                                                                             \\\r\n    name_,                                                                   \\\r\n    version_,                                                                \\\r\n    requires_,                                                               \\\r\n                                                                             \\\r\n    interface_,                                                              \\\r\n                                                                             \\\r\n    init_,                                                                   \\\r\n    done_,                                                                   \\\r\n    get_interface_,                                                          \\\r\n  },\r\n\r\n#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_,  \\\r\n                         interface_, init_, done_, get_interface_)           \\\r\n  FT_CALLBACK_TABLE_DEF                                                      \\\r\n  const FT_Module_Class class_ =                                             \\\r\n  {                                                                          \\\r\n    flags_,                                                                  \\\r\n    size_,                                                                   \\\r\n                                                                             \\\r\n    name_,                                                                   \\\r\n    version_,                                                                \\\r\n    requires_,                                                               \\\r\n                                                                             \\\r\n    interface_,                                                              \\\r\n                                                                             \\\r\n    init_,                                                                   \\\r\n    done_,                                                                   \\\r\n    get_interface_,                                                          \\\r\n  };\r\n\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */\r\n\r\n#define FT_DECLARE_MODULE(class_)                                            \\\r\n  FT_Error FT_Create_Class_##class_( FT_Library library,                     \\\r\n                                     FT_Module_Class** output_class );       \\\r\n  void     FT_Destroy_Class_##class_( FT_Library library,                    \\\r\n                                      FT_Module_Class*  clazz );\r\n\r\n#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_,     \\\r\n                              interface_, init_, done_, get_interface_)      \\\r\n    clazz->root.module_flags       = flags_;                                 \\\r\n    clazz->root.module_size        = size_;                                  \\\r\n    clazz->root.module_name        = name_;                                  \\\r\n    clazz->root.module_version     = version_;                               \\\r\n    clazz->root.module_requires    = requires_;                              \\\r\n                                                                             \\\r\n    clazz->root.module_interface   = interface_;                             \\\r\n                                                                             \\\r\n    clazz->root.module_init        = init_;                                  \\\r\n    clazz->root.module_done        = done_;                                  \\\r\n    clazz->root.get_interface      = get_interface_;               \r\n\r\n#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_,  \\\r\n                         interface_, init_, done_, get_interface_)           \\\r\n  void class_##_pic_free( FT_Library library );                              \\\r\n  FT_Error class_##_pic_init( FT_Library library );                          \\\r\n                                                                             \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_Module_Class*  clazz )                       \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    class_##_pic_free( library );                                            \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_Module_Class**  output_class )                \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    FT_Module_Class*  clazz;                                                 \\\r\n    FT_Error          error;                                                 \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \\\r\n      return error;                                                          \\\r\n    error = class_##_pic_init( library );                                    \\\r\n    if(error)                                                                \\\r\n    {                                                                        \\\r\n      FT_FREE( clazz );                                                      \\\r\n      return error;                                                          \\\r\n    }                                                                        \\\r\n                                                                             \\\r\n    clazz->module_flags       = flags_;                                      \\\r\n    clazz->module_size        = size_;                                       \\\r\n    clazz->module_name        = name_;                                       \\\r\n    clazz->module_version     = version_;                                    \\\r\n    clazz->module_requires    = requires_;                                   \\\r\n                                                                             \\\r\n    clazz->module_interface   = interface_;                                  \\\r\n                                                                             \\\r\n    clazz->module_init        = init_;                                       \\\r\n    clazz->module_done        = done_;                                       \\\r\n    clazz->get_interface      = get_interface_;                              \\\r\n                                                                             \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTOBJS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftpic.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftpic.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType position independent code services (declaration).       */\r\n/*                                                                         */\r\n/*  Copyright 2009 by                                                      */\r\n/*  Oran Agra and Mickey Gabel.                                            */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Modules that ordinarily have const global data that need address     */\r\n  /*  can instead define pointers here.                                    */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTPIC_H__\r\n#define __FTPIC_H__\r\n\r\n  \r\nFT_BEGIN_HEADER\r\n\r\n#ifdef FT_CONFIG_OPTION_PIC\r\n\r\n  typedef struct FT_PIC_Container_\r\n  {\r\n    /* pic containers for base */\r\n    void* base;\r\n    /* pic containers for modules */\r\n    void* autofit;   \r\n    void* cff;    \r\n    void* pshinter;    \r\n    void* psnames;    \r\n    void* raster;     \r\n    void* sfnt;     \r\n    void* smooth;     \r\n    void* truetype;     \r\n  } FT_PIC_Container;\r\n\r\n  /* Initialize the various function tables, structs, etc. stored in the container. */\r\n  FT_BASE( FT_Error )\r\n  ft_pic_container_init( FT_Library library );\r\n\r\n\r\n  /* Destroy the contents of the container. */\r\n  FT_BASE( void )\r\n  ft_pic_container_destroy( FT_Library library );\r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTPIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftrfork.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftrfork.h                                                              */\r\n/*                                                                         */\r\n/*    Embedded resource forks accessor (specification).                    */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006, 2007 by                                          */\r\n/*  Masatake YAMATO and Redhat K.K.                                        */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/* Development of the code in this file is support of                      */\r\n/* Information-technology Promotion Agency, Japan.                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTRFORK_H__\r\n#define __FTRFORK_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* Number of guessing rules supported in `FT_Raccess_Guess'.            */\r\n  /* Don't forget to increment the number if you add a new guessing rule. */\r\n#define FT_RACCESS_N_RULES  9\r\n\r\n\r\n  /* A structure to describe a reference in a resource by its resource ID */\r\n  /* and internal offset.  The `POST' resource expects to be concatenated */\r\n  /* by the order of resource IDs instead of its appearance in the file.  */\r\n\r\n  typedef struct  FT_RFork_Ref_\r\n  {\r\n    FT_UShort  res_id;\r\n    FT_ULong   offset;\r\n\r\n  } FT_RFork_Ref;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Raccess_Guess                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Guess a file name and offset where the actual resource fork is     */\r\n  /*    stored.  The macro FT_RACCESS_N_RULES holds the number of          */\r\n  /*    guessing rules;  the guessed result for the Nth rule is            */\r\n  /*    represented as a triplet: a new file name (new_names[N]), a file   */\r\n  /*    offset (offsets[N]), and an error code (errors[N]).                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library ::                                                         */\r\n  /*      A FreeType library instance.                                     */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      A file stream containing the resource fork.                      */\r\n  /*                                                                       */\r\n  /*    base_name ::                                                       */\r\n  /*      The (base) file name of the resource fork used for some          */\r\n  /*      guessing rules.                                                  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    new_names ::                                                       */\r\n  /*      An array of guessed file names in which the resource forks may   */\r\n  /*      exist.  If `new_names[N]' is NULL, the guessed file name is      */\r\n  /*      equal to `base_name'.                                            */\r\n  /*                                                                       */\r\n  /*    offsets ::                                                         */\r\n  /*      An array of guessed file offsets.  `offsets[N]' holds the file   */\r\n  /*      offset of the possible start of the resource fork in file        */\r\n  /*      `new_names[N]'.                                                  */\r\n  /*                                                                       */\r\n  /*    errors ::                                                          */\r\n  /*      An array of FreeType error codes.  `errors[N]' is the error      */\r\n  /*      code of Nth guessing rule function.  If `errors[N]' is not       */\r\n  /*      FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless.      */\r\n  /*                                                                       */\r\n  FT_BASE( void )\r\n  FT_Raccess_Guess( FT_Library  library,\r\n                    FT_Stream   stream,\r\n                    char*       base_name,\r\n                    char**      new_names,\r\n                    FT_Long*    offsets,\r\n                    FT_Error*   errors );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Raccess_Get_HeaderInfo                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the information from the header of resource fork.  The         */\r\n  /*    information includes the file offset where the resource map        */\r\n  /*    starts, and the file offset where the resource data starts.        */\r\n  /*    `FT_Raccess_Get_DataOffsets' requires these two data.              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library ::                                                         */\r\n  /*      A FreeType library instance.                                     */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      A file stream containing the resource fork.                      */\r\n  /*                                                                       */\r\n  /*    rfork_offset ::                                                    */\r\n  /*      The file offset where the resource fork starts.                  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    map_offset ::                                                      */\r\n  /*      The file offset where the resource map starts.                   */\r\n  /*                                                                       */\r\n  /*    rdata_pos ::                                                       */\r\n  /*      The file offset where the resource data starts.                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  FT_Err_Ok means success.                     */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Error )\r\n  FT_Raccess_Get_HeaderInfo( FT_Library  library,\r\n                             FT_Stream   stream,\r\n                             FT_Long     rfork_offset,\r\n                             FT_Long    *map_offset,\r\n                             FT_Long    *rdata_pos );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Raccess_Get_DataOffsets                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the data offsets for a tag in a resource fork.  Offsets are    */\r\n  /*    stored in an array because, in some cases, resources in a resource */\r\n  /*    fork have the same tag.                                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    library ::                                                         */\r\n  /*      A FreeType library instance.                                     */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      A file stream containing the resource fork.                      */\r\n  /*                                                                       */\r\n  /*    map_offset ::                                                      */\r\n  /*      The file offset where the resource map starts.                   */\r\n  /*                                                                       */\r\n  /*    rdata_pos ::                                                       */\r\n  /*      The file offset where the resource data starts.                  */\r\n  /*                                                                       */\r\n  /*    tag ::                                                             */\r\n  /*      The resource tag.                                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    offsets ::                                                         */\r\n  /*      The stream offsets for the resource data specified by `tag'.     */\r\n  /*      This array is allocated by the function, so you have to call     */\r\n  /*      @ft_mem_free after use.                                          */\r\n  /*                                                                       */\r\n  /*    count ::                                                           */\r\n  /*      The length of offsets array.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  FT_Err_Ok means success.                     */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    Normally you should use `FT_Raccess_Get_HeaderInfo' to get the     */\r\n  /*    value for `map_offset' and `rdata_pos'.                            */\r\n  /*                                                                       */\r\n  FT_BASE( FT_Error )\r\n  FT_Raccess_Get_DataOffsets( FT_Library  library,\r\n                              FT_Stream   stream,\r\n                              FT_Long     map_offset,\r\n                              FT_Long     rdata_pos,\r\n                              FT_Long     tag,\r\n                              FT_Long   **offsets,\r\n                              FT_Long    *count );\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTRFORK_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftserv.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftserv.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType services (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  Each module can export one or more `services'.  Each service is      */\r\n  /*  identified by a constant string and modeled by a pointer; the latter */\r\n  /*  generally corresponds to a structure containing function pointers.   */\r\n  /*                                                                       */\r\n  /*  Note that a service's data cannot be a mere function pointer because */\r\n  /*  in C it is possible that function pointers might be implemented      */\r\n  /*  differently than data pointers (e.g. 48 bits instead of 32).         */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FTSERV_H__\r\n#define __FTSERV_H__\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */\r\n\r\n  /* we disable the warning `conditional expression is constant' here */\r\n  /* in order to compile cleanly with the maximum level of warnings   */\r\n#pragma warning( disable : 4127 )\r\n\r\n#endif /* _MSC_VER */\r\n\r\n  /*\r\n   * @macro:\r\n   *   FT_FACE_FIND_SERVICE\r\n   *\r\n   * @description:\r\n   *   This macro is used to look up a service from a face's driver module.\r\n   *\r\n   * @input:\r\n   *   face ::\r\n   *     The source face handle.\r\n   *\r\n   *   id ::\r\n   *     A string describing the service as defined in the service's\r\n   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\r\n   *     `multi-masters').  It is automatically prefixed with\r\n   *     `FT_SERVICE_ID_'.\r\n   *\r\n   * @output:\r\n   *   ptr ::\r\n   *     A variable that receives the service pointer.  Will be NULL\r\n   *     if not found.\r\n   */\r\n#ifdef __cplusplus\r\n\r\n#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \\\r\n  FT_BEGIN_STMNT                                                            \\\r\n    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );             \\\r\n    FT_Pointer   _tmp_  = NULL;                                             \\\r\n    FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                              \\\r\n                                                                            \\\r\n                                                                            \\\r\n    if ( module->clazz->get_interface )                                     \\\r\n      _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\r\n    *_pptr_ = _tmp_;                                                        \\\r\n  FT_END_STMNT\r\n\r\n#else /* !C++ */\r\n\r\n#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \\\r\n  FT_BEGIN_STMNT                                                            \\\r\n    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );              \\\r\n    FT_Pointer  _tmp_  = NULL;                                              \\\r\n                                                                            \\\r\n    if ( module->clazz->get_interface )                                     \\\r\n      _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\r\n    ptr = _tmp_;                                                            \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !C++ */\r\n\r\n  /*\r\n   * @macro:\r\n   *   FT_FACE_FIND_GLOBAL_SERVICE\r\n   *\r\n   * @description:\r\n   *   This macro is used to look up a service from all modules.\r\n   *\r\n   * @input:\r\n   *   face ::\r\n   *     The source face handle.\r\n   *\r\n   *   id ::\r\n   *     A string describing the service as defined in the service's\r\n   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\r\n   *     `multi-masters').  It is automatically prefixed with\r\n   *     `FT_SERVICE_ID_'.\r\n   *\r\n   * @output:\r\n   *   ptr ::\r\n   *     A variable that receives the service pointer.  Will be NULL\r\n   *     if not found.\r\n   */\r\n#ifdef __cplusplus\r\n\r\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \\\r\n  FT_BEGIN_STMNT                                                   \\\r\n    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );    \\\r\n    FT_Pointer   _tmp_;                                            \\\r\n    FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                     \\\r\n                                                                   \\\r\n                                                                   \\\r\n    _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \\\r\n    *_pptr_ = _tmp_;                                               \\\r\n  FT_END_STMNT\r\n\r\n#else /* !C++ */\r\n\r\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \\\r\n  FT_BEGIN_STMNT                                                   \\\r\n    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );     \\\r\n    FT_Pointer  _tmp_;                                             \\\r\n                                                                   \\\r\n                                                                   \\\r\n    _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \\\r\n    ptr   = _tmp_;                                                 \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !C++ */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****         S E R V I C E   D E S C R I P T O R S                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  The following structure is used to _describe_ a given service\r\n   *  to the library.  This is useful to build simple static service lists.\r\n   */\r\n  typedef struct  FT_ServiceDescRec_\r\n  {\r\n    const char*  serv_id;     /* service name         */\r\n    const void*  serv_data;   /* service pointer/data */\r\n\r\n  } FT_ServiceDescRec;\r\n\r\n  typedef const FT_ServiceDescRec*  FT_ServiceDesc;\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Macro>                                                               */\r\n  /*    FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Used to initialize an array of FT_ServiceDescRec structs.          */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */\r\n  /*    to called with a pointer where the allocated array is returned.    */\r\n  /*    And when it is no longer needed a Destroy function needs           */\r\n  /*    to be called to release that allocation.                           */\r\n  /*                                                                       */\r\n  /*    These functions should be manyally called from the pic_init and    */\r\n  /*    pic_free functions of your module (see FT_DEFINE_MODULE)           */\r\n  /*                                                                       */\r\n  /*    When FT_CONFIG_OPTION_PIC is not defined the array will be         */\r\n  /*    allocated in the global scope (or the scope where the macro        */\r\n  /*    is used).                                                          */\r\n  /*                                                                       */\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \\\r\n  static const FT_ServiceDescRec class_[] =                                  \\\r\n  {                                                                          \\\r\n  {serv_id_1, serv_data_1},                                                  \\\r\n  {NULL, NULL}                                                               \\\r\n  };\r\n#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2)                                              \\\r\n  static const FT_ServiceDescRec class_[] =                                  \\\r\n  {                                                                          \\\r\n  {serv_id_1, serv_data_1},                                                  \\\r\n  {serv_id_2, serv_data_2},                                                  \\\r\n  {NULL, NULL}                                                               \\\r\n  };\r\n#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \\\r\n  static const FT_ServiceDescRec class_[] =                                  \\\r\n  {                                                                          \\\r\n  {serv_id_1, serv_data_1},                                                  \\\r\n  {serv_id_2, serv_data_2},                                                  \\\r\n  {serv_id_3, serv_data_3},                                                  \\\r\n  {NULL, NULL}                                                               \\\r\n  };\r\n#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \\\r\n        serv_id_4, serv_data_4)                                              \\\r\n  static const FT_ServiceDescRec class_[] =                                  \\\r\n  {                                                                          \\\r\n  {serv_id_1, serv_data_1},                                                  \\\r\n  {serv_id_2, serv_data_2},                                                  \\\r\n  {serv_id_3, serv_data_3},                                                  \\\r\n  {serv_id_4, serv_data_4},                                                  \\\r\n  {NULL, NULL}                                                               \\\r\n  };\r\n#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \\\r\n        serv_id_4, serv_data_4, serv_id_5, serv_data_5)                      \\\r\n  static const FT_ServiceDescRec class_[] =                                  \\\r\n  {                                                                          \\\r\n  {serv_id_1, serv_data_1},                                                  \\\r\n  {serv_id_2, serv_data_2},                                                  \\\r\n  {serv_id_3, serv_data_3},                                                  \\\r\n  {serv_id_4, serv_data_4},                                                  \\\r\n  {serv_id_5, serv_data_5},                                                  \\\r\n  {NULL, NULL}                                                               \\\r\n  };\r\n#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \\\r\n        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \\\r\n        serv_id_6, serv_data_6)                                              \\\r\n  static const FT_ServiceDescRec class_[] =                                  \\\r\n  {                                                                          \\\r\n  {serv_id_1, serv_data_1},                                                  \\\r\n  {serv_id_2, serv_data_2},                                                  \\\r\n  {serv_id_3, serv_data_3},                                                  \\\r\n  {serv_id_4, serv_data_4},                                                  \\\r\n  {serv_id_5, serv_data_5},                                                  \\\r\n  {serv_id_6, serv_data_6},                                                  \\\r\n  {NULL, NULL}                                                               \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_ServiceDescRec* clazz )                      \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_ServiceDescRec** output_class)                \\\r\n  {                                                                          \\\r\n    FT_ServiceDescRec*  clazz;                                               \\\r\n    FT_Error          error;                                                 \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz)*2 ) )                               \\\r\n      return error;                                                          \\\r\n    clazz[0].serv_id = serv_id_1;                                            \\\r\n    clazz[0].serv_data = serv_data_1;                                        \\\r\n    clazz[1].serv_id = NULL;                                                 \\\r\n    clazz[1].serv_data = NULL;                                               \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2)                                              \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_ServiceDescRec* clazz )                      \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_ServiceDescRec** output_class)                \\\r\n  {                                                                          \\\r\n    FT_ServiceDescRec*  clazz;                                               \\\r\n    FT_Error          error;                                                 \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz)*3 ) )                               \\\r\n      return error;                                                          \\\r\n    clazz[0].serv_id = serv_id_1;                                            \\\r\n    clazz[0].serv_data = serv_data_1;                                        \\\r\n    clazz[1].serv_id = serv_id_2;                                            \\\r\n    clazz[1].serv_data = serv_data_2;                                        \\\r\n    clazz[2].serv_id = NULL;                                                 \\\r\n    clazz[2].serv_data = NULL;                                               \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_ServiceDescRec* clazz )                      \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_ServiceDescRec** output_class)                \\\r\n  {                                                                          \\\r\n    FT_ServiceDescRec*  clazz;                                               \\\r\n    FT_Error          error;                                                 \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz)*4 ) )                               \\\r\n      return error;                                                          \\\r\n    clazz[0].serv_id = serv_id_1;                                            \\\r\n    clazz[0].serv_data = serv_data_1;                                        \\\r\n    clazz[1].serv_id = serv_id_2;                                            \\\r\n    clazz[1].serv_data = serv_data_2;                                        \\\r\n    clazz[2].serv_id = serv_id_3;                                            \\\r\n    clazz[2].serv_data = serv_data_3;                                        \\\r\n    clazz[3].serv_id = NULL;                                                 \\\r\n    clazz[3].serv_data = NULL;                                               \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \\\r\n        serv_id_4, serv_data_4)                                              \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_ServiceDescRec* clazz )                      \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_ServiceDescRec** output_class)                \\\r\n  {                                                                          \\\r\n    FT_ServiceDescRec*  clazz;                                               \\\r\n    FT_Error          error;                                                 \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz)*5 ) )                               \\\r\n      return error;                                                          \\\r\n    clazz[0].serv_id = serv_id_1;                                            \\\r\n    clazz[0].serv_data = serv_data_1;                                        \\\r\n    clazz[1].serv_id = serv_id_2;                                            \\\r\n    clazz[1].serv_data = serv_data_2;                                        \\\r\n    clazz[2].serv_id = serv_id_3;                                            \\\r\n    clazz[2].serv_data = serv_data_3;                                        \\\r\n    clazz[3].serv_id = serv_id_4;                                            \\\r\n    clazz[3].serv_data = serv_data_4;                                        \\\r\n    clazz[4].serv_id = NULL;                                                 \\\r\n    clazz[4].serv_data = NULL;                                               \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4,           \\\r\n        serv_data_4, serv_id_5, serv_data_5)                                 \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_ServiceDescRec* clazz )                      \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_ServiceDescRec** output_class)                \\\r\n  {                                                                          \\\r\n    FT_ServiceDescRec*  clazz;                                               \\\r\n    FT_Error          error;                                                 \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz)*6 ) )                               \\\r\n      return error;                                                          \\\r\n    clazz[0].serv_id = serv_id_1;                                            \\\r\n    clazz[0].serv_data = serv_data_1;                                        \\\r\n    clazz[1].serv_id = serv_id_2;                                            \\\r\n    clazz[1].serv_data = serv_data_2;                                        \\\r\n    clazz[2].serv_id = serv_id_3;                                            \\\r\n    clazz[2].serv_data = serv_data_3;                                        \\\r\n    clazz[3].serv_id = serv_id_4;                                            \\\r\n    clazz[3].serv_data = serv_data_4;                                        \\\r\n    clazz[4].serv_id = serv_id_5;                                            \\\r\n    clazz[4].serv_data = serv_data_5;                                        \\\r\n    clazz[5].serv_id = NULL;                                                 \\\r\n    clazz[5].serv_data = NULL;                                               \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n\r\n#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \\\r\n        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \\\r\n        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \\\r\n        serv_id_6, serv_data_6)                                              \\\r\n  void                                                                       \\\r\n  FT_Destroy_Class_##class_( FT_Library library,                             \\\r\n                             FT_ServiceDescRec* clazz )                      \\\r\n  {                                                                          \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n    if ( clazz )                                                             \\\r\n      FT_FREE( clazz );                                                      \\\r\n  }                                                                          \\\r\n                                                                             \\\r\n  FT_Error                                                                   \\\r\n  FT_Create_Class_##class_( FT_Library library,                              \\\r\n                            FT_ServiceDescRec** output_class)                \\\r\n  {                                                                          \\\r\n    FT_ServiceDescRec*  clazz;                                               \\\r\n    FT_Error          error;                                                 \\\r\n    FT_Memory memory = library->memory;                                      \\\r\n                                                                             \\\r\n    if ( FT_ALLOC( clazz, sizeof(*clazz)*7 ) )                               \\\r\n      return error;                                                          \\\r\n    clazz[0].serv_id = serv_id_1;                                            \\\r\n    clazz[0].serv_data = serv_data_1;                                        \\\r\n    clazz[1].serv_id = serv_id_2;                                            \\\r\n    clazz[1].serv_data = serv_data_2;                                        \\\r\n    clazz[2].serv_id = serv_id_3;                                            \\\r\n    clazz[2].serv_data = serv_data_3;                                        \\\r\n    clazz[3].serv_id = serv_id_4;                                            \\\r\n    clazz[3].serv_data = serv_data_4;                                        \\\r\n    clazz[4].serv_id = serv_id_5;                                            \\\r\n    clazz[4].serv_data = serv_data_5;                                        \\\r\n    clazz[5].serv_id = serv_id_6;                                            \\\r\n    clazz[5].serv_data = serv_data_6;                                        \\\r\n    clazz[6].serv_id = NULL;                                                 \\\r\n    clazz[6].serv_data = NULL;                                               \\\r\n    *output_class = clazz;                                                   \\\r\n    return FT_Err_Ok;                                                        \\\r\n  } \r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /*\r\n   *  Parse a list of FT_ServiceDescRec descriptors and look for\r\n   *  a specific service by ID.  Note that the last element in the\r\n   *  array must be { NULL, NULL }, and that the function should\r\n   *  return NULL if the service isn't available.\r\n   *\r\n   *  This function can be used by modules to implement their\r\n   *  `get_service' method.\r\n   */\r\n  FT_BASE( FT_Pointer )\r\n  ft_service_list_lookup( FT_ServiceDesc  service_descriptors,\r\n                          const char*     service_id );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****             S E R V I C E S   C A C H E                       *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   *  This structure is used to store a cache for several frequently used\r\n   *  services.  It is the type of `face->internal->services'.  You\r\n   *  should only use FT_FACE_LOOKUP_SERVICE to access it.\r\n   *\r\n   *  All fields should have the type FT_Pointer to relax compilation\r\n   *  dependencies.  We assume the developer isn't completely stupid.\r\n   *\r\n   *  Each field must be named `service_XXXX' where `XXX' corresponds to\r\n   *  the correct FT_SERVICE_ID_XXXX macro.  See the definition of\r\n   *  FT_FACE_LOOKUP_SERVICE below how this is implemented.\r\n   *\r\n   */\r\n  typedef struct  FT_ServiceCacheRec_\r\n  {\r\n    FT_Pointer  service_POSTSCRIPT_FONT_NAME;\r\n    FT_Pointer  service_MULTI_MASTERS;\r\n    FT_Pointer  service_GLYPH_DICT;\r\n    FT_Pointer  service_PFR_METRICS;\r\n    FT_Pointer  service_WINFNT;\r\n\r\n  } FT_ServiceCacheRec, *FT_ServiceCache;\r\n\r\n\r\n  /*\r\n   *  A magic number used within the services cache.\r\n   */\r\n#define FT_SERVICE_UNAVAILABLE  ((FT_Pointer)-2)  /* magic number */\r\n\r\n\r\n  /*\r\n   * @macro:\r\n   *   FT_FACE_LOOKUP_SERVICE\r\n   *\r\n   * @description:\r\n   *   This macro is used to lookup a service from a face's driver module\r\n   *   using its cache.\r\n   *\r\n   * @input:\r\n   *   face::\r\n   *     The source face handle containing the cache.\r\n   *\r\n   *   field ::\r\n   *     The field name in the cache.\r\n   *\r\n   *   id ::\r\n   *     The service ID.\r\n   *\r\n   * @output:\r\n   *   ptr ::\r\n   *     A variable receiving the service data.  NULL if not available.\r\n   */\r\n#ifdef __cplusplus\r\n\r\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \\\r\n  FT_BEGIN_STMNT                                               \\\r\n    FT_Pointer   svc;                                          \\\r\n    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                   \\\r\n                                                               \\\r\n                                                               \\\r\n    svc = FT_FACE( face )->internal->services. service_ ## id; \\\r\n    if ( svc == FT_SERVICE_UNAVAILABLE )                       \\\r\n      svc = NULL;                                              \\\r\n    else if ( svc == NULL )                                    \\\r\n    {                                                          \\\r\n      FT_FACE_FIND_SERVICE( face, svc, id );                   \\\r\n                                                               \\\r\n      FT_FACE( face )->internal->services. service_ ## id =    \\\r\n        (FT_Pointer)( svc != NULL ? svc                        \\\r\n                                  : FT_SERVICE_UNAVAILABLE );  \\\r\n    }                                                          \\\r\n    *Pptr = svc;                                               \\\r\n  FT_END_STMNT\r\n\r\n#else /* !C++ */\r\n\r\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \\\r\n  FT_BEGIN_STMNT                                               \\\r\n    FT_Pointer  svc;                                           \\\r\n                                                               \\\r\n                                                               \\\r\n    svc = FT_FACE( face )->internal->services. service_ ## id; \\\r\n    if ( svc == FT_SERVICE_UNAVAILABLE )                       \\\r\n      svc = NULL;                                              \\\r\n    else if ( svc == NULL )                                    \\\r\n    {                                                          \\\r\n      FT_FACE_FIND_SERVICE( face, svc, id );                   \\\r\n                                                               \\\r\n      FT_FACE( face )->internal->services. service_ ## id =    \\\r\n        (FT_Pointer)( svc != NULL ? svc                        \\\r\n                                  : FT_SERVICE_UNAVAILABLE );  \\\r\n    }                                                          \\\r\n    ptr = svc;                                                 \\\r\n  FT_END_STMNT\r\n\r\n#endif /* !C++ */\r\n\r\n  /*\r\n   *  A macro used to define new service structure types.\r\n   */\r\n\r\n#define FT_DEFINE_SERVICE( name )            \\\r\n  typedef struct FT_Service_ ## name ## Rec_ \\\r\n    FT_Service_ ## name ## Rec ;             \\\r\n  typedef struct FT_Service_ ## name ## Rec_ \\\r\n    const * FT_Service_ ## name ;            \\\r\n  struct FT_Service_ ## name ## Rec_\r\n\r\n  /* */\r\n\r\n  /*\r\n   *  The header files containing the services.\r\n   */\r\n\r\n#define FT_SERVICE_BDF_H                <freetype/internal/services/svbdf.h>\r\n#define FT_SERVICE_CID_H                <freetype/internal/services/svcid.h>\r\n#define FT_SERVICE_GLYPH_DICT_H         <freetype/internal/services/svgldict.h>\r\n#define FT_SERVICE_GX_VALIDATE_H        <freetype/internal/services/svgxval.h>\r\n#define FT_SERVICE_KERNING_H            <freetype/internal/services/svkern.h>\r\n#define FT_SERVICE_MULTIPLE_MASTERS_H   <freetype/internal/services/svmm.h>\r\n#define FT_SERVICE_OPENTYPE_VALIDATE_H  <freetype/internal/services/svotval.h>\r\n#define FT_SERVICE_PFR_H                <freetype/internal/services/svpfr.h>\r\n#define FT_SERVICE_POSTSCRIPT_CMAPS_H   <freetype/internal/services/svpscmap.h>\r\n#define FT_SERVICE_POSTSCRIPT_INFO_H    <freetype/internal/services/svpsinfo.h>\r\n#define FT_SERVICE_POSTSCRIPT_NAME_H    <freetype/internal/services/svpostnm.h>\r\n#define FT_SERVICE_SFNT_H               <freetype/internal/services/svsfnt.h>\r\n#define FT_SERVICE_TRUETYPE_ENGINE_H    <freetype/internal/services/svtteng.h>\r\n#define FT_SERVICE_TT_CMAP_H            <freetype/internal/services/svttcmap.h>\r\n#define FT_SERVICE_WINFNT_H             <freetype/internal/services/svwinfnt.h>\r\n#define FT_SERVICE_XFREE86_NAME_H       <freetype/internal/services/svxf86nm.h>\r\n#define FT_SERVICE_TRUETYPE_GLYF_H      <freetype/internal/services/svttglyf.h>\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSERV_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftstream.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftstream.h                                                             */\r\n/*                                                                         */\r\n/*    Stream handling (specification).                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2005, 2006 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTSTREAM_H__\r\n#define __FTSTREAM_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_SYSTEM_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /* format of an 8-bit frame_op value:           */\r\n  /*                                              */\r\n  /* bit  76543210                                */\r\n  /*      xxxxxxes                                */\r\n  /*                                              */\r\n  /* s is set to 1 if the value is signed.        */\r\n  /* e is set to 1 if the value is little-endian. */\r\n  /* xxx is a command.                            */\r\n\r\n#define FT_FRAME_OP_SHIFT         2\r\n#define FT_FRAME_OP_SIGNED        1\r\n#define FT_FRAME_OP_LITTLE        2\r\n#define FT_FRAME_OP_COMMAND( x )  ( x >> FT_FRAME_OP_SHIFT )\r\n\r\n#define FT_MAKE_FRAME_OP( command, little, sign ) \\\r\n          ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )\r\n\r\n#define FT_FRAME_OP_END    0\r\n#define FT_FRAME_OP_START  1  /* start a new frame     */\r\n#define FT_FRAME_OP_BYTE   2  /* read 1-byte value     */\r\n#define FT_FRAME_OP_SHORT  3  /* read 2-byte value     */\r\n#define FT_FRAME_OP_LONG   4  /* read 4-byte value     */\r\n#define FT_FRAME_OP_OFF3   5  /* read 3-byte value     */\r\n#define FT_FRAME_OP_BYTES  6  /* read a bytes sequence */\r\n\r\n\r\n  typedef enum  FT_Frame_Op_\r\n  {\r\n    ft_frame_end       = 0,\r\n    ft_frame_start     = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),\r\n\r\n    ft_frame_byte      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 0 ),\r\n    ft_frame_schar     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 1 ),\r\n\r\n    ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),\r\n    ft_frame_short_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),\r\n    ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),\r\n    ft_frame_short_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),\r\n\r\n    ft_frame_ulong_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),\r\n    ft_frame_long_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),\r\n    ft_frame_ulong_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),\r\n    ft_frame_long_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),\r\n\r\n    ft_frame_uoff3_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),\r\n    ft_frame_off3_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),\r\n    ft_frame_uoff3_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),\r\n    ft_frame_off3_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),\r\n\r\n    ft_frame_bytes     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),\r\n    ft_frame_skip      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )\r\n\r\n  } FT_Frame_Op;\r\n\r\n\r\n  typedef struct  FT_Frame_Field_\r\n  {\r\n    FT_Byte    value;\r\n    FT_Byte    size;\r\n    FT_UShort  offset;\r\n\r\n  } FT_Frame_Field;\r\n\r\n\r\n  /* Construct an FT_Frame_Field out of a structure type and a field name. */\r\n  /* The structure type must be set in the FT_STRUCTURE macro before       */\r\n  /* calling the FT_FRAME_START() macro.                                   */\r\n  /*                                                                       */\r\n#define FT_FIELD_SIZE( f ) \\\r\n          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )\r\n\r\n#define FT_FIELD_SIZE_DELTA( f ) \\\r\n          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )\r\n\r\n#define FT_FIELD_OFFSET( f ) \\\r\n          (FT_UShort)( offsetof( FT_STRUCTURE, f ) )\r\n\r\n#define FT_FRAME_FIELD( frame_op, field ) \\\r\n          {                               \\\r\n            frame_op,                     \\\r\n            FT_FIELD_SIZE( field ),       \\\r\n            FT_FIELD_OFFSET( field )      \\\r\n          }\r\n\r\n#define FT_MAKE_EMPTY_FIELD( frame_op )  { frame_op, 0, 0 }\r\n\r\n#define FT_FRAME_START( size )   { ft_frame_start, 0, size }\r\n#define FT_FRAME_END             { ft_frame_end, 0, 0 }\r\n\r\n#define FT_FRAME_LONG( f )       FT_FRAME_FIELD( ft_frame_long_be, f )\r\n#define FT_FRAME_ULONG( f )      FT_FRAME_FIELD( ft_frame_ulong_be, f )\r\n#define FT_FRAME_SHORT( f )      FT_FRAME_FIELD( ft_frame_short_be, f )\r\n#define FT_FRAME_USHORT( f )     FT_FRAME_FIELD( ft_frame_ushort_be, f )\r\n#define FT_FRAME_OFF3( f )       FT_FRAME_FIELD( ft_frame_off3_be, f )\r\n#define FT_FRAME_UOFF3( f )      FT_FRAME_FIELD( ft_frame_uoff3_be, f )\r\n#define FT_FRAME_BYTE( f )       FT_FRAME_FIELD( ft_frame_byte, f )\r\n#define FT_FRAME_CHAR( f )       FT_FRAME_FIELD( ft_frame_schar, f )\r\n\r\n#define FT_FRAME_LONG_LE( f )    FT_FRAME_FIELD( ft_frame_long_le, f )\r\n#define FT_FRAME_ULONG_LE( f )   FT_FRAME_FIELD( ft_frame_ulong_le, f )\r\n#define FT_FRAME_SHORT_LE( f )   FT_FRAME_FIELD( ft_frame_short_le, f )\r\n#define FT_FRAME_USHORT_LE( f )  FT_FRAME_FIELD( ft_frame_ushort_le, f )\r\n#define FT_FRAME_OFF3_LE( f )    FT_FRAME_FIELD( ft_frame_off3_le, f )\r\n#define FT_FRAME_UOFF3_LE( f )   FT_FRAME_FIELD( ft_frame_uoff3_le, f )\r\n\r\n#define FT_FRAME_SKIP_LONG       { ft_frame_long_be, 0, 0 }\r\n#define FT_FRAME_SKIP_SHORT      { ft_frame_short_be, 0, 0 }\r\n#define FT_FRAME_SKIP_BYTE       { ft_frame_byte, 0, 0 }\r\n\r\n#define FT_FRAME_BYTES( field, count ) \\\r\n          {                            \\\r\n            ft_frame_bytes,            \\\r\n            count,                     \\\r\n            FT_FIELD_OFFSET( field )   \\\r\n          }\r\n\r\n#define FT_FRAME_SKIP_BYTES( count )  { ft_frame_skip, count, 0 }\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */\r\n  /* type `char*' or equivalent (1-byte elements).                         */\r\n  /*                                                                       */\r\n\r\n#define FT_BYTE_( p, i )  ( ((const FT_Byte*)(p))[(i)] )\r\n#define FT_INT8_( p, i )  ( ((const FT_Char*)(p))[(i)] )\r\n\r\n#define FT_INT16( x )   ( (FT_Int16)(x)  )\r\n#define FT_UINT16( x )  ( (FT_UInt16)(x) )\r\n#define FT_INT32( x )   ( (FT_Int32)(x)  )\r\n#define FT_UINT32( x )  ( (FT_UInt32)(x) )\r\n\r\n#define FT_BYTE_I16( p, i, s )  ( FT_INT16(  FT_BYTE_( p, i ) ) << (s) )\r\n#define FT_BYTE_U16( p, i, s )  ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )\r\n#define FT_BYTE_I32( p, i, s )  ( FT_INT32(  FT_BYTE_( p, i ) ) << (s) )\r\n#define FT_BYTE_U32( p, i, s )  ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )\r\n\r\n#define FT_INT8_I16( p, i, s )  ( FT_INT16(  FT_INT8_( p, i ) ) << (s) )\r\n#define FT_INT8_U16( p, i, s )  ( FT_UINT16( FT_INT8_( p, i ) ) << (s) )\r\n#define FT_INT8_I32( p, i, s )  ( FT_INT32(  FT_INT8_( p, i ) ) << (s) )\r\n#define FT_INT8_U32( p, i, s )  ( FT_UINT32( FT_INT8_( p, i ) ) << (s) )\r\n\r\n\r\n#define FT_PEEK_SHORT( p )  FT_INT16( FT_INT8_I16( p, 0, 8) | \\\r\n                                      FT_BYTE_I16( p, 1, 0) )\r\n\r\n#define FT_PEEK_USHORT( p )  FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \\\r\n                                        FT_BYTE_U16( p, 1, 0 ) )\r\n\r\n#define FT_PEEK_LONG( p )  FT_INT32( FT_INT8_I32( p, 0, 24 ) | \\\r\n                                     FT_BYTE_I32( p, 1, 16 ) | \\\r\n                                     FT_BYTE_I32( p, 2,  8 ) | \\\r\n                                     FT_BYTE_I32( p, 3,  0 ) )\r\n\r\n#define FT_PEEK_ULONG( p )  FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \\\r\n                                       FT_BYTE_U32( p, 1, 16 ) | \\\r\n                                       FT_BYTE_U32( p, 2,  8 ) | \\\r\n                                       FT_BYTE_U32( p, 3,  0 ) )\r\n\r\n#define FT_PEEK_OFF3( p )  FT_INT32( FT_INT8_I32( p, 0, 16 ) | \\\r\n                                     FT_BYTE_I32( p, 1,  8 ) | \\\r\n                                     FT_BYTE_I32( p, 2,  0 ) )\r\n\r\n#define FT_PEEK_UOFF3( p )  FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \\\r\n                                       FT_BYTE_U32( p, 1,  8 ) | \\\r\n                                       FT_BYTE_U32( p, 2,  0 ) )\r\n\r\n#define FT_PEEK_SHORT_LE( p )  FT_INT16( FT_INT8_I16( p, 1, 8 ) | \\\r\n                                         FT_BYTE_I16( p, 0, 0 ) )\r\n\r\n#define FT_PEEK_USHORT_LE( p )  FT_UINT16( FT_BYTE_U16( p, 1, 8 ) |  \\\r\n                                           FT_BYTE_U16( p, 0, 0 ) )\r\n\r\n#define FT_PEEK_LONG_LE( p )  FT_INT32( FT_INT8_I32( p, 3, 24 ) | \\\r\n                                        FT_BYTE_I32( p, 2, 16 ) | \\\r\n                                        FT_BYTE_I32( p, 1,  8 ) | \\\r\n                                        FT_BYTE_I32( p, 0,  0 ) )\r\n\r\n#define FT_PEEK_ULONG_LE( p )  FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \\\r\n                                          FT_BYTE_U32( p, 2, 16 ) | \\\r\n                                          FT_BYTE_U32( p, 1,  8 ) | \\\r\n                                          FT_BYTE_U32( p, 0,  0 ) )\r\n\r\n#define FT_PEEK_OFF3_LE( p )  FT_INT32( FT_INT8_I32( p, 2, 16 ) | \\\r\n                                        FT_BYTE_I32( p, 1,  8 ) | \\\r\n                                        FT_BYTE_I32( p, 0,  0 ) )\r\n\r\n#define FT_PEEK_UOFF3_LE( p )  FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \\\r\n                                          FT_BYTE_U32( p, 1,  8 ) | \\\r\n                                          FT_BYTE_U32( p, 0,  0 ) )\r\n\r\n\r\n#define FT_NEXT_CHAR( buffer )       \\\r\n          ( (signed char)*buffer++ )\r\n\r\n#define FT_NEXT_BYTE( buffer )         \\\r\n          ( (unsigned char)*buffer++ )\r\n\r\n#define FT_NEXT_SHORT( buffer )                                   \\\r\n          ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_USHORT( buffer )                                            \\\r\n          ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_OFF3( buffer )                                  \\\r\n          ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_UOFF3( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_LONG( buffer )                                  \\\r\n          ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )\r\n\r\n#define FT_NEXT_ULONG( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )\r\n\r\n\r\n#define FT_NEXT_SHORT_LE( buffer )                                   \\\r\n          ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_USHORT_LE( buffer )                                            \\\r\n          ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )\r\n\r\n#define FT_NEXT_OFF3_LE( buffer )                                  \\\r\n          ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_UOFF3_LE( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )\r\n\r\n#define FT_NEXT_LONG_LE( buffer )                                  \\\r\n          ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )\r\n\r\n#define FT_NEXT_ULONG_LE( buffer )                                           \\\r\n          ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Each GET_xxxx() macro uses an implicit `stream' variable.             */\r\n  /*                                                                       */\r\n#if 0\r\n#define FT_GET_MACRO( type )    FT_NEXT_ ## type ( stream->cursor )\r\n\r\n#define FT_GET_CHAR()       FT_GET_MACRO( CHAR )\r\n#define FT_GET_BYTE()       FT_GET_MACRO( BYTE )\r\n#define FT_GET_SHORT()      FT_GET_MACRO( SHORT )\r\n#define FT_GET_USHORT()     FT_GET_MACRO( USHORT )\r\n#define FT_GET_OFF3()       FT_GET_MACRO( OFF3 )\r\n#define FT_GET_UOFF3()      FT_GET_MACRO( UOFF3 )\r\n#define FT_GET_LONG()       FT_GET_MACRO( LONG )\r\n#define FT_GET_ULONG()      FT_GET_MACRO( ULONG )\r\n#define FT_GET_TAG4()       FT_GET_MACRO( ULONG )\r\n\r\n#define FT_GET_SHORT_LE()   FT_GET_MACRO( SHORT_LE )\r\n#define FT_GET_USHORT_LE()  FT_GET_MACRO( USHORT_LE )\r\n#define FT_GET_LONG_LE()    FT_GET_MACRO( LONG_LE )\r\n#define FT_GET_ULONG_LE()   FT_GET_MACRO( ULONG_LE )\r\n\r\n#else\r\n#define FT_GET_MACRO( func, type )        ( (type)func( stream ) )\r\n\r\n#define FT_GET_CHAR()       FT_GET_MACRO( FT_Stream_GetChar, FT_Char )\r\n#define FT_GET_BYTE()       FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )\r\n#define FT_GET_SHORT()      FT_GET_MACRO( FT_Stream_GetShort, FT_Short )\r\n#define FT_GET_USHORT()     FT_GET_MACRO( FT_Stream_GetShort, FT_UShort )\r\n#define FT_GET_OFF3()       FT_GET_MACRO( FT_Stream_GetOffset, FT_Long )\r\n#define FT_GET_UOFF3()      FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong )\r\n#define FT_GET_LONG()       FT_GET_MACRO( FT_Stream_GetLong, FT_Long )\r\n#define FT_GET_ULONG()      FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )\r\n#define FT_GET_TAG4()       FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )\r\n\r\n#define FT_GET_SHORT_LE()   FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short )\r\n#define FT_GET_USHORT_LE()  FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort )\r\n#define FT_GET_LONG_LE()    FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long )\r\n#define FT_GET_ULONG_LE()   FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong )\r\n#endif\r\n\r\n#define FT_READ_MACRO( func, type, var )        \\\r\n          ( var = (type)func( stream, &error ), \\\r\n            error != FT_Err_Ok )\r\n\r\n#define FT_READ_BYTE( var )       FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )\r\n#define FT_READ_CHAR( var )       FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )\r\n#define FT_READ_SHORT( var )      FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var )\r\n#define FT_READ_USHORT( var )     FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var )\r\n#define FT_READ_OFF3( var )       FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var )\r\n#define FT_READ_UOFF3( var )      FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var )\r\n#define FT_READ_LONG( var )       FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var )\r\n#define FT_READ_ULONG( var )      FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var )\r\n\r\n#define FT_READ_SHORT_LE( var )   FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var )\r\n#define FT_READ_USHORT_LE( var )  FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var )\r\n#define FT_READ_LONG_LE( var )    FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var )\r\n#define FT_READ_ULONG_LE( var )   FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var )\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\r\n\r\n  /* initialize a stream for reading a regular system stream */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Open( FT_Stream    stream,\r\n                  const char*  filepathname );\r\n\r\n#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\r\n\r\n\r\n  /* create a new (input) stream from an FT_Open_Args structure */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_New( FT_Library           library,\r\n                 const FT_Open_Args*  args,\r\n                 FT_Stream           *astream );\r\n\r\n  /* free a stream */\r\n  FT_BASE( void )\r\n  FT_Stream_Free( FT_Stream  stream,\r\n                  FT_Int     external );\r\n\r\n  /* initialize a stream for reading in-memory data */\r\n  FT_BASE( void )\r\n  FT_Stream_OpenMemory( FT_Stream       stream,\r\n                        const FT_Byte*  base,\r\n                        FT_ULong        size );\r\n\r\n  /* close a stream (does not destroy the stream structure) */\r\n  FT_BASE( void )\r\n  FT_Stream_Close( FT_Stream  stream );\r\n\r\n\r\n  /* seek within a stream. position is relative to start of stream */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Seek( FT_Stream  stream,\r\n                  FT_ULong   pos );\r\n\r\n  /* skip bytes in a stream */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Skip( FT_Stream  stream,\r\n                  FT_Long    distance );\r\n\r\n  /* return current stream position */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_Pos( FT_Stream  stream );\r\n\r\n  /* read bytes from a stream into a user-allocated buffer, returns an */\r\n  /* error if not all bytes could be read.                             */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_Read( FT_Stream  stream,\r\n                  FT_Byte*   buffer,\r\n                  FT_ULong   count );\r\n\r\n  /* read bytes from a stream at a given position */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_ReadAt( FT_Stream  stream,\r\n                    FT_ULong   pos,\r\n                    FT_Byte*   buffer,\r\n                    FT_ULong   count );\r\n\r\n  /* try to read bytes at the end of a stream; return number of bytes */\r\n  /* really available                                                 */\r\n  FT_BASE( FT_ULong )\r\n  FT_Stream_TryRead( FT_Stream  stream,\r\n                     FT_Byte*   buffer,\r\n                     FT_ULong   count );\r\n\r\n  /* Enter a frame of `count' consecutive bytes in a stream.  Returns an */\r\n  /* error if the frame could not be read/accessed.  The caller can use  */\r\n  /* the FT_Stream_Get_XXX functions to retrieve frame data without      */\r\n  /* error checks.                                                       */\r\n  /*                                                                     */\r\n  /* You must _always_ call FT_Stream_ExitFrame() once you have entered  */\r\n  /* a stream frame!                                                     */\r\n  /*                                                                     */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_EnterFrame( FT_Stream  stream,\r\n                        FT_ULong   count );\r\n\r\n  /* exit a stream frame */\r\n  FT_BASE( void )\r\n  FT_Stream_ExitFrame( FT_Stream  stream );\r\n\r\n  /* Extract a stream frame.  If the stream is disk-based, a heap block */\r\n  /* is allocated and the frame bytes are read into it.  If the stream  */\r\n  /* is memory-based, this function simply set a pointer to the data.   */\r\n  /*                                                                    */\r\n  /* Useful to optimize access to memory-based streams transparently.   */\r\n  /*                                                                    */\r\n  /* All extracted frames must be `freed' with a call to the function   */\r\n  /* FT_Stream_ReleaseFrame().                                          */\r\n  /*                                                                    */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_ExtractFrame( FT_Stream  stream,\r\n                          FT_ULong   count,\r\n                          FT_Byte**  pbytes );\r\n\r\n  /* release an extract frame (see FT_Stream_ExtractFrame) */\r\n  FT_BASE( void )\r\n  FT_Stream_ReleaseFrame( FT_Stream  stream,\r\n                          FT_Byte**  pbytes );\r\n\r\n  /* read a byte from an entered frame */\r\n  FT_BASE( FT_Char )\r\n  FT_Stream_GetChar( FT_Stream  stream );\r\n\r\n  /* read a 16-bit big-endian integer from an entered frame */\r\n  FT_BASE( FT_Short )\r\n  FT_Stream_GetShort( FT_Stream  stream );\r\n\r\n  /* read a 24-bit big-endian integer from an entered frame */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_GetOffset( FT_Stream  stream );\r\n\r\n  /* read a 32-bit big-endian integer from an entered frame */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_GetLong( FT_Stream  stream );\r\n\r\n  /* read a 16-bit little-endian integer from an entered frame */\r\n  FT_BASE( FT_Short )\r\n  FT_Stream_GetShortLE( FT_Stream  stream );\r\n\r\n  /* read a 32-bit little-endian integer from an entered frame */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_GetLongLE( FT_Stream  stream );\r\n\r\n\r\n  /* read a byte from a stream */\r\n  FT_BASE( FT_Char )\r\n  FT_Stream_ReadChar( FT_Stream  stream,\r\n                      FT_Error*  error );\r\n\r\n  /* read a 16-bit big-endian integer from a stream */\r\n  FT_BASE( FT_Short )\r\n  FT_Stream_ReadShort( FT_Stream  stream,\r\n                       FT_Error*  error );\r\n\r\n  /* read a 24-bit big-endian integer from a stream */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_ReadOffset( FT_Stream  stream,\r\n                        FT_Error*  error );\r\n\r\n  /* read a 32-bit big-endian integer from a stream */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_ReadLong( FT_Stream  stream,\r\n                      FT_Error*  error );\r\n\r\n  /* read a 16-bit little-endian integer from a stream */\r\n  FT_BASE( FT_Short )\r\n  FT_Stream_ReadShortLE( FT_Stream  stream,\r\n                         FT_Error*  error );\r\n\r\n  /* read a 32-bit little-endian integer from a stream */\r\n  FT_BASE( FT_Long )\r\n  FT_Stream_ReadLongLE( FT_Stream  stream,\r\n                        FT_Error*  error );\r\n\r\n  /* Read a structure from a stream.  The structure must be described */\r\n  /* by an array of FT_Frame_Field records.                           */\r\n  FT_BASE( FT_Error )\r\n  FT_Stream_ReadFields( FT_Stream              stream,\r\n                        const FT_Frame_Field*  fields,\r\n                        void*                  structure );\r\n\r\n\r\n#define FT_STREAM_POS()           \\\r\n          FT_Stream_Pos( stream )\r\n\r\n#define FT_STREAM_SEEK( position )                           \\\r\n          FT_SET_ERROR( FT_Stream_Seek( stream, position ) )\r\n\r\n#define FT_STREAM_SKIP( distance )                           \\\r\n          FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )\r\n\r\n#define FT_STREAM_READ( buffer, count )                   \\\r\n          FT_SET_ERROR( FT_Stream_Read( stream,           \\\r\n                                        (FT_Byte*)buffer, \\\r\n                                        count ) )\r\n\r\n#define FT_STREAM_READ_AT( position, buffer, count )         \\\r\n          FT_SET_ERROR( FT_Stream_ReadAt( stream,            \\\r\n                                           position,         \\\r\n                                           (FT_Byte*)buffer, \\\r\n                                           count ) )\r\n\r\n#define FT_STREAM_READ_FIELDS( fields, object )                          \\\r\n          FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )\r\n\r\n\r\n#define FT_FRAME_ENTER( size )                                       \\\r\n          FT_SET_ERROR(                                              \\\r\n            FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )\r\n\r\n#define FT_FRAME_EXIT()                 \\\r\n          FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )\r\n\r\n#define FT_FRAME_EXTRACT( size, bytes )                                       \\\r\n          FT_SET_ERROR(                                                       \\\r\n            FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size,             \\\r\n                                                    (FT_Byte**)&(bytes) ) ) )\r\n\r\n#define FT_FRAME_RELEASE( bytes )                                         \\\r\n          FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream,                 \\\r\n                                                  (FT_Byte**)&(bytes) ) )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTSTREAM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/fttrace.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  fttrace.h                                                              */\r\n/*                                                                         */\r\n/*    Tracing handling (specification only).                               */\r\n/*                                                                         */\r\n/*  Copyright 2002, 2004, 2005, 2006, 2007 by                              */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /* definitions of trace levels for FreeType 2 */\r\n\r\n  /* the first level must always be `trace_any' */\r\nFT_TRACE_DEF( any )\r\n\r\n  /* base components */\r\nFT_TRACE_DEF( calc )      /* calculations            (ftcalc.c)   */\r\nFT_TRACE_DEF( memory )    /* memory manager          (ftobjs.c)   */\r\nFT_TRACE_DEF( stream )    /* stream manager          (ftstream.c) */\r\nFT_TRACE_DEF( io )        /* i/o interface           (ftsystem.c) */\r\nFT_TRACE_DEF( list )      /* list management         (ftlist.c)   */\r\nFT_TRACE_DEF( init )      /* initialization          (ftinit.c)   */\r\nFT_TRACE_DEF( objs )      /* base objects            (ftobjs.c)   */\r\nFT_TRACE_DEF( outline )   /* outline management      (ftoutln.c)  */\r\nFT_TRACE_DEF( glyph )     /* glyph management        (ftglyph.c)  */\r\nFT_TRACE_DEF( gloader )   /* glyph loader            (ftgloadr.c) */\r\n\r\nFT_TRACE_DEF( raster )    /* monochrome rasterizer   (ftraster.c) */\r\nFT_TRACE_DEF( smooth )    /* anti-aliasing raster    (ftgrays.c)  */\r\nFT_TRACE_DEF( mm )        /* MM interface            (ftmm.c)     */\r\nFT_TRACE_DEF( raccess )   /* resource fork accessor  (ftrfork.c)  */\r\nFT_TRACE_DEF( synth )     /* bold/slant synthesizer  (ftsynth.c)  */\r\n\r\n  /* Cache sub-system */\r\nFT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc.) */\r\n\r\n  /* SFNT driver components */\r\nFT_TRACE_DEF( sfdriver )  /* SFNT font driver        (sfdriver.c) */\r\nFT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */\r\nFT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */\r\nFT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */\r\nFT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */\r\nFT_TRACE_DEF( ttmtx )     /* metrics-related tables  (ttmtx.c)    */\r\nFT_TRACE_DEF( ttpost )    /* PS table processing     (ttpost.c)   */\r\nFT_TRACE_DEF( ttsbit )    /* TrueType sbit handling  (ttsbit.c)   */\r\nFT_TRACE_DEF( ttbdf )     /* TrueType embedded BDF   (ttbdf.c)    */\r\n\r\n  /* TrueType driver components */\r\nFT_TRACE_DEF( ttdriver )  /* TT font driver          (ttdriver.c) */\r\nFT_TRACE_DEF( ttgload )   /* TT glyph loader         (ttgload.c)  */\r\nFT_TRACE_DEF( ttinterp )  /* bytecode interpreter    (ttinterp.c) */\r\nFT_TRACE_DEF( ttobjs )    /* TT objects manager      (ttobjs.c)   */\r\nFT_TRACE_DEF( ttpload )   /* TT data/program loader  (ttpload.c)  */\r\nFT_TRACE_DEF( ttgxvar )   /* TrueType GX var handler (ttgxvar.c)  */\r\n\r\n  /* Type 1 driver components */\r\nFT_TRACE_DEF( t1afm )\r\nFT_TRACE_DEF( t1driver )\r\nFT_TRACE_DEF( t1gload )\r\nFT_TRACE_DEF( t1hint )\r\nFT_TRACE_DEF( t1load )\r\nFT_TRACE_DEF( t1objs )\r\nFT_TRACE_DEF( t1parse )\r\n\r\n  /* PostScript helper module `psaux' */\r\nFT_TRACE_DEF( t1decode )\r\nFT_TRACE_DEF( psobjs )\r\n\r\n  /* PostScript hinting module `pshinter' */\r\nFT_TRACE_DEF( pshrec )\r\nFT_TRACE_DEF( pshalgo1 )\r\nFT_TRACE_DEF( pshalgo2 )\r\n\r\n  /* Type 2 driver components */\r\nFT_TRACE_DEF( cffdriver )\r\nFT_TRACE_DEF( cffgload )\r\nFT_TRACE_DEF( cffload )\r\nFT_TRACE_DEF( cffobjs )\r\nFT_TRACE_DEF( cffparse )\r\n\r\n  /* Type 42 driver component */\r\nFT_TRACE_DEF( t42 )\r\n\r\n  /* CID driver components */\r\nFT_TRACE_DEF( cidafm )\r\nFT_TRACE_DEF( ciddriver )\r\nFT_TRACE_DEF( cidgload )\r\nFT_TRACE_DEF( cidload )\r\nFT_TRACE_DEF( cidobjs )\r\nFT_TRACE_DEF( cidparse )\r\n\r\n  /* Windows font component */\r\nFT_TRACE_DEF( winfnt )\r\n\r\n  /* PCF font components */\r\nFT_TRACE_DEF( pcfdriver )\r\nFT_TRACE_DEF( pcfread )\r\n\r\n  /* BDF font components */\r\nFT_TRACE_DEF( bdfdriver )\r\nFT_TRACE_DEF( bdflib )\r\n\r\n  /* PFR font component */\r\nFT_TRACE_DEF( pfr )\r\n\r\n  /* OpenType validation components */\r\nFT_TRACE_DEF( otvmodule )\r\nFT_TRACE_DEF( otvcommon )\r\nFT_TRACE_DEF( otvbase )\r\nFT_TRACE_DEF( otvgdef )\r\nFT_TRACE_DEF( otvgpos )\r\nFT_TRACE_DEF( otvgsub )\r\nFT_TRACE_DEF( otvjstf )\r\nFT_TRACE_DEF( otvmath )\r\n\r\n  /* TrueTypeGX/AAT validation components */\r\nFT_TRACE_DEF( gxvmodule )\r\nFT_TRACE_DEF( gxvcommon )\r\nFT_TRACE_DEF( gxvfeat )\r\nFT_TRACE_DEF( gxvmort )\r\nFT_TRACE_DEF( gxvmorx )\r\nFT_TRACE_DEF( gxvbsln )\r\nFT_TRACE_DEF( gxvjust )\r\nFT_TRACE_DEF( gxvkern )\r\nFT_TRACE_DEF( gxvopbd )\r\nFT_TRACE_DEF( gxvtrak )\r\nFT_TRACE_DEF( gxvprop )\r\nFT_TRACE_DEF( gxvlcar )\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/ftvalid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ftvalid.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType validation support (specification).                         */\r\n/*                                                                         */\r\n/*  Copyright 2004 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __FTVALID_H__\r\n#define __FTVALID_H__\r\n\r\n#include <ft2build.h>\r\n#include FT_CONFIG_STANDARD_LIBRARY_H   /* for ft_setjmp and ft_longjmp */\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /****                    V A L I D A T I O N                          ****/\r\n  /****                                                                 ****/\r\n  /****                                                                 ****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /* handle to a validation object */\r\n  typedef struct FT_ValidatorRec_ volatile*  FT_Validator;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* There are three distinct validation levels defined here:              */\r\n  /*                                                                       */\r\n  /* FT_VALIDATE_DEFAULT ::                                                */\r\n  /*   A table that passes this validation level can be used reliably by   */\r\n  /*   FreeType.  It generally means that all offsets have been checked to */\r\n  /*   prevent out-of-bound reads, that array counts are correct, etc.     */\r\n  /*                                                                       */\r\n  /* FT_VALIDATE_TIGHT ::                                                  */\r\n  /*   A table that passes this validation level can be used reliably and  */\r\n  /*   doesn't contain invalid data.  For example, a charmap table that    */\r\n  /*   returns invalid glyph indices will not pass, even though it can     */\r\n  /*   be used with FreeType in default mode (the library will simply      */\r\n  /*   return an error later when trying to load the glyph).               */\r\n  /*                                                                       */\r\n  /*   It also checks that fields which must be a multiple of 2, 4, or 8,  */\r\n  /*   don't have incorrect values, etc.                                   */\r\n  /*                                                                       */\r\n  /* FT_VALIDATE_PARANOID ::                                               */\r\n  /*   Only for font debugging.  Checks that a table follows the           */\r\n  /*   specification by 100%.  Very few fonts will be able to pass this    */\r\n  /*   level anyway but it can be useful for certain tools like font       */\r\n  /*   editors/converters.                                                 */\r\n  /*                                                                       */\r\n  typedef enum  FT_ValidationLevel_\r\n  {\r\n    FT_VALIDATE_DEFAULT = 0,\r\n    FT_VALIDATE_TIGHT,\r\n    FT_VALIDATE_PARANOID\r\n\r\n  } FT_ValidationLevel;\r\n\r\n\r\n  /* validator structure */\r\n  typedef struct  FT_ValidatorRec_\r\n  {\r\n    const FT_Byte*      base;        /* address of table in memory       */\r\n    const FT_Byte*      limit;       /* `base' + sizeof(table) in memory */\r\n    FT_ValidationLevel  level;       /* validation level                 */\r\n    FT_Error            error;       /* error returned. 0 means success  */\r\n\r\n    ft_jmp_buf          jump_buffer; /* used for exception handling      */\r\n\r\n  } FT_ValidatorRec;\r\n\r\n\r\n#define FT_VALIDATOR( x )  ((FT_Validator)( x ))\r\n\r\n\r\n  FT_BASE( void )\r\n  ft_validator_init( FT_Validator        valid,\r\n                     const FT_Byte*      base,\r\n                     const FT_Byte*      limit,\r\n                     FT_ValidationLevel  level );\r\n\r\n  /* Do not use this. It's broken and will cause your validator to crash */\r\n  /* if you run it on an invalid font.                                   */\r\n  FT_BASE( FT_Int )\r\n  ft_validator_run( FT_Validator  valid );\r\n\r\n  /* Sets the error field in a validator, then calls `longjmp' to return */\r\n  /* to high-level caller.  Using `setjmp/longjmp' avoids many stupid    */\r\n  /* error checks within the validation routines.                        */\r\n  /*                                                                     */\r\n  FT_BASE( void )\r\n  ft_validator_error( FT_Validator  valid,\r\n                      FT_Error      error );\r\n\r\n\r\n  /* Calls ft_validate_error.  Assumes that the `valid' local variable */\r\n  /* holds a pointer to the current validator object.                  */\r\n  /*                                                                   */\r\n  /* Use preprocessor prescan to pass FT_ERR_PREFIX.                   */\r\n  /*                                                                   */\r\n#define FT_INVALID( _prefix, _error )  FT_INVALID_( _prefix, _error )\r\n#define FT_INVALID_( _prefix, _error ) \\\r\n          ft_validator_error( valid, _prefix ## _error )\r\n\r\n  /* called when a broken table is detected */\r\n#define FT_INVALID_TOO_SHORT \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Table )\r\n\r\n  /* called when an invalid offset is detected */\r\n#define FT_INVALID_OFFSET \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Offset )\r\n\r\n  /* called when an invalid format/value is detected */\r\n#define FT_INVALID_FORMAT \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Table )\r\n\r\n  /* called when an invalid glyph index is detected */\r\n#define FT_INVALID_GLYPH_ID \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Glyph_Index )\r\n\r\n  /* called when an invalid field value is detected */\r\n#define FT_INVALID_DATA \\\r\n          FT_INVALID( FT_ERR_PREFIX, Invalid_Table )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __FTVALID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/internal.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  internal.h                                                             */\r\n/*                                                                         */\r\n/*    Internal header files (specification only).                          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file is automatically included by `ft2build.h'.                  */\r\n  /* Do not include it manually!                                           */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>\r\n#define FT_INTERNAL_PIC_H                 <freetype/internal/ftpic.h>\r\n#define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>\r\n#define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>\r\n#define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>\r\n#define FT_INTERNAL_CALC_H                <freetype/internal/ftcalc.h>\r\n#define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdriver.h>\r\n#define FT_INTERNAL_TRACE_H               <freetype/internal/fttrace.h>\r\n#define FT_INTERNAL_GLYPH_LOADER_H        <freetype/internal/ftgloadr.h>\r\n#define FT_INTERNAL_SFNT_H                <freetype/internal/sfnt.h>\r\n#define FT_INTERNAL_SERVICE_H             <freetype/internal/ftserv.h>\r\n#define FT_INTERNAL_RFORK_H               <freetype/internal/ftrfork.h>\r\n#define FT_INTERNAL_VALIDATE_H            <freetype/internal/ftvalid.h>\r\n\r\n#define FT_INTERNAL_TRUETYPE_TYPES_H      <freetype/internal/tttypes.h>\r\n#define FT_INTERNAL_TYPE1_TYPES_H         <freetype/internal/t1types.h>\r\n\r\n#define FT_INTERNAL_POSTSCRIPT_AUX_H      <freetype/internal/psaux.h>\r\n#define FT_INTERNAL_POSTSCRIPT_HINTS_H    <freetype/internal/pshints.h>\r\n#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H  <freetype/internal/psglobal.h>\r\n\r\n#define FT_INTERNAL_AUTOHINT_H            <freetype/internal/autohint.h>\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/pcftypes.h",
    "content": "/*  pcftypes.h\r\n\r\n  FreeType font driver for pcf fonts\r\n\r\n  Copyright (C) 2000, 2001, 2002 by\r\n  Francesco Zappa Nardelli\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n\r\n#ifndef __PCFTYPES_H__\r\n#define __PCFTYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  typedef struct  PCF_Public_FaceRec_\r\n  {\r\n    FT_FaceRec    root;\r\n    FT_StreamRec  gzip_stream;\r\n    FT_Stream     gzip_source;\r\n\r\n    char*         charset_encoding;\r\n    char*         charset_registry;\r\n\r\n  } PCF_Public_FaceRec, *PCF_Public_Face;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif  /* __PCFTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/psaux.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  psaux.h                                                                */\r\n/*                                                                         */\r\n/*    Auxiliary functions and data structures related to PostScript fonts  */\r\n/*    (specification).                                                     */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSAUX_H__\r\n#define __PSAUX_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_OBJECTS_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                             T1_TABLE                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct PS_TableRec_*              PS_Table;\r\n  typedef const struct PS_Table_FuncsRec_*  PS_Table_Funcs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_Table_FuncsRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A set of function pointers to manage PS_Table objects.             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    table_init    :: Used to initialize a table.                       */\r\n  /*                                                                       */\r\n  /*    table_done    :: Finalizes resp. destroy a given table.            */\r\n  /*                                                                       */\r\n  /*    table_add     :: Adds a new object to a table.                     */\r\n  /*                                                                       */\r\n  /*    table_release :: Releases table data, then finalizes it.           */\r\n  /*                                                                       */\r\n  typedef struct  PS_Table_FuncsRec_\r\n  {\r\n    FT_Error\r\n    (*init)( PS_Table   table,\r\n             FT_Int     count,\r\n             FT_Memory  memory );\r\n\r\n    void\r\n    (*done)( PS_Table  table );\r\n\r\n    FT_Error\r\n    (*add)( PS_Table    table,\r\n            FT_Int      idx,\r\n            void*       object,\r\n            FT_PtrDist  length );\r\n\r\n    void\r\n    (*release)( PS_Table  table );\r\n\r\n  } PS_Table_FuncsRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_TableRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A PS_Table is a simple object used to store an array of objects in */\r\n  /*    a single memory block.                                             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    block     :: The address in memory of the growheap's block.  This  */\r\n  /*                 can change between two object adds, due to            */\r\n  /*                 reallocation.                                         */\r\n  /*                                                                       */\r\n  /*    cursor    :: The current top of the grow heap within its block.    */\r\n  /*                                                                       */\r\n  /*    capacity  :: The current size of the heap block.  Increments by    */\r\n  /*                 1kByte chunks.                                        */\r\n  /*                                                                       */\r\n  /*    max_elems :: The maximum number of elements in table.              */\r\n  /*                                                                       */\r\n  /*    num_elems :: The current number of elements in table.              */\r\n  /*                                                                       */\r\n  /*    elements  :: A table of element addresses within the block.        */\r\n  /*                                                                       */\r\n  /*    lengths   :: A table of element sizes within the block.            */\r\n  /*                                                                       */\r\n  /*    memory    :: The object used for memory operations                 */\r\n  /*                 (alloc/realloc).                                      */\r\n  /*                                                                       */\r\n  /*    funcs     :: A table of method pointers for this object.           */\r\n  /*                                                                       */\r\n  typedef struct  PS_TableRec_\r\n  {\r\n    FT_Byte*           block;          /* current memory block           */\r\n    FT_Offset          cursor;         /* current cursor in memory block */\r\n    FT_Offset          capacity;       /* current size of memory block   */\r\n    FT_Long            init;\r\n\r\n    FT_Int             max_elems;\r\n    FT_Int             num_elems;\r\n    FT_Byte**          elements;       /* addresses of table elements */\r\n    FT_PtrDist*        lengths;        /* lengths of table elements   */\r\n\r\n    FT_Memory          memory;\r\n    PS_Table_FuncsRec  funcs;\r\n\r\n  } PS_TableRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                       T1 FIELDS & TOKENS                      *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct PS_ParserRec_*  PS_Parser;\r\n\r\n  typedef struct T1_TokenRec_*   T1_Token;\r\n\r\n  typedef struct T1_FieldRec_*   T1_Field;\r\n\r\n\r\n  /* simple enumeration type used to identify token types */\r\n  typedef enum  T1_TokenType_\r\n  {\r\n    T1_TOKEN_TYPE_NONE = 0,\r\n    T1_TOKEN_TYPE_ANY,\r\n    T1_TOKEN_TYPE_STRING,\r\n    T1_TOKEN_TYPE_ARRAY,\r\n    T1_TOKEN_TYPE_KEY, /* aka `name' */\r\n\r\n    /* do not remove */\r\n    T1_TOKEN_TYPE_MAX\r\n\r\n  } T1_TokenType;\r\n\r\n\r\n  /* a simple structure used to identify tokens */\r\n  typedef struct  T1_TokenRec_\r\n  {\r\n    FT_Byte*      start;   /* first character of token in input stream */\r\n    FT_Byte*      limit;   /* first character after the token          */\r\n    T1_TokenType  type;    /* type of token                            */\r\n\r\n  } T1_TokenRec;\r\n\r\n\r\n  /* enumeration type used to identify object fields */\r\n  typedef enum  T1_FieldType_\r\n  {\r\n    T1_FIELD_TYPE_NONE = 0,\r\n    T1_FIELD_TYPE_BOOL,\r\n    T1_FIELD_TYPE_INTEGER,\r\n    T1_FIELD_TYPE_FIXED,\r\n    T1_FIELD_TYPE_FIXED_1000,\r\n    T1_FIELD_TYPE_STRING,\r\n    T1_FIELD_TYPE_KEY,\r\n    T1_FIELD_TYPE_BBOX,\r\n    T1_FIELD_TYPE_INTEGER_ARRAY,\r\n    T1_FIELD_TYPE_FIXED_ARRAY,\r\n    T1_FIELD_TYPE_CALLBACK,\r\n\r\n    /* do not remove */\r\n    T1_FIELD_TYPE_MAX\r\n\r\n  } T1_FieldType;\r\n\r\n\r\n  typedef enum  T1_FieldLocation_\r\n  {\r\n    T1_FIELD_LOCATION_CID_INFO,\r\n    T1_FIELD_LOCATION_FONT_DICT,\r\n    T1_FIELD_LOCATION_FONT_EXTRA,\r\n    T1_FIELD_LOCATION_FONT_INFO,\r\n    T1_FIELD_LOCATION_PRIVATE,\r\n    T1_FIELD_LOCATION_BBOX,\r\n    T1_FIELD_LOCATION_LOADER,\r\n    T1_FIELD_LOCATION_FACE,\r\n    T1_FIELD_LOCATION_BLEND,\r\n\r\n    /* do not remove */\r\n    T1_FIELD_LOCATION_MAX\r\n\r\n  } T1_FieldLocation;\r\n\r\n\r\n  typedef void\r\n  (*T1_Field_ParseFunc)( FT_Face     face,\r\n                         FT_Pointer  parser );\r\n\r\n\r\n  /* structure type used to model object fields */\r\n  typedef struct  T1_FieldRec_\r\n  {\r\n    const char*         ident;        /* field identifier               */\r\n    T1_FieldLocation    location;\r\n    T1_FieldType        type;         /* type of field                  */\r\n    T1_Field_ParseFunc  reader;\r\n    FT_UInt             offset;       /* offset of field in object      */\r\n    FT_Byte             size;         /* size of field in bytes         */\r\n    FT_UInt             array_max;    /* maximal number of elements for */\r\n                                      /* array                          */\r\n    FT_UInt             count_offset; /* offset of element count for    */\r\n                                      /* arrays; must not be zero if in */\r\n                                      /* use -- in other words, a       */\r\n                                      /* `num_FOO' element must not     */\r\n                                      /* start the used structure if we */\r\n                                      /* parse a `FOO' array            */\r\n    FT_UInt             dict;         /* where we expect it             */\r\n  } T1_FieldRec;\r\n\r\n#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */\r\n#define T1_FIELD_DICT_PRIVATE  ( 1 << 1 )\r\n\r\n\r\n\r\n#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \\\r\n          {                                                 \\\r\n            _ident, T1CODE, _type,                          \\\r\n            0,                                              \\\r\n            FT_FIELD_OFFSET( _fname ),                      \\\r\n            FT_FIELD_SIZE( _fname ),                        \\\r\n            0, 0,                                           \\\r\n            _dict                                           \\\r\n          },\r\n\r\n#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \\\r\n          {                                             \\\r\n            _ident, T1CODE, T1_FIELD_TYPE_CALLBACK,     \\\r\n            (T1_Field_ParseFunc)_reader,                \\\r\n            0, 0,                                       \\\r\n            0, 0,                                       \\\r\n            _dict                                       \\\r\n          },\r\n\r\n#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \\\r\n          {                                                      \\\r\n            _ident, T1CODE, _type,                               \\\r\n            0,                                                   \\\r\n            FT_FIELD_OFFSET( _fname ),                           \\\r\n            FT_FIELD_SIZE_DELTA( _fname ),                       \\\r\n            _max,                                                \\\r\n            FT_FIELD_OFFSET( num_ ## _fname ),                   \\\r\n            _dict                                                \\\r\n          },\r\n\r\n#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \\\r\n          {                                                       \\\r\n            _ident, T1CODE, _type,                                \\\r\n            0,                                                    \\\r\n            FT_FIELD_OFFSET( _fname ),                            \\\r\n            FT_FIELD_SIZE_DELTA( _fname ),                        \\\r\n            _max, 0,                                              \\\r\n            _dict                                                 \\\r\n          },\r\n\r\n\r\n#define T1_FIELD_BOOL( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )\r\n\r\n#define T1_FIELD_NUM( _ident, _fname, _dict )                                 \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )\r\n\r\n#define T1_FIELD_FIXED( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )\r\n\r\n#define T1_FIELD_FIXED_1000( _ident, _fname, _dict )                     \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \\\r\n                               _dict )\r\n\r\n#define T1_FIELD_STRING( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )\r\n\r\n#define T1_FIELD_KEY( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )\r\n\r\n#define T1_FIELD_BBOX( _ident, _fname, _dict )                             \\\r\n          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )\r\n\r\n\r\n#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict )         \\\r\n          T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\r\n                              _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict )     \\\r\n          T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\r\n                              _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict )         \\\r\n          T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\r\n                               _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict )     \\\r\n          T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\r\n                               _fname, _fmax, _dict )\r\n\r\n#define T1_FIELD_CALLBACK( _ident, _name, _dict )       \\\r\n          T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            T1 PARSER                          *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef const struct PS_Parser_FuncsRec_*  PS_Parser_Funcs;\r\n\r\n  typedef struct  PS_Parser_FuncsRec_\r\n  {\r\n    void\r\n    (*init)( PS_Parser  parser,\r\n             FT_Byte*   base,\r\n             FT_Byte*   limit,\r\n             FT_Memory  memory );\r\n\r\n    void\r\n    (*done)( PS_Parser  parser );\r\n\r\n    void\r\n    (*skip_spaces)( PS_Parser  parser );\r\n    void\r\n    (*skip_PS_token)( PS_Parser  parser );\r\n\r\n    FT_Long\r\n    (*to_int)( PS_Parser  parser );\r\n    FT_Fixed\r\n    (*to_fixed)( PS_Parser  parser,\r\n                 FT_Int     power_ten );\r\n\r\n    FT_Error\r\n    (*to_bytes)( PS_Parser  parser,\r\n                 FT_Byte*   bytes,\r\n                 FT_Offset  max_bytes,\r\n                 FT_Long*   pnum_bytes,\r\n                 FT_Bool    delimiters );\r\n\r\n    FT_Int\r\n    (*to_coord_array)( PS_Parser  parser,\r\n                       FT_Int     max_coords,\r\n                       FT_Short*  coords );\r\n    FT_Int\r\n    (*to_fixed_array)( PS_Parser  parser,\r\n                       FT_Int     max_values,\r\n                       FT_Fixed*  values,\r\n                       FT_Int     power_ten );\r\n\r\n    void\r\n    (*to_token)( PS_Parser  parser,\r\n                 T1_Token   token );\r\n    void\r\n    (*to_token_array)( PS_Parser  parser,\r\n                       T1_Token   tokens,\r\n                       FT_UInt    max_tokens,\r\n                       FT_Int*    pnum_tokens );\r\n\r\n    FT_Error\r\n    (*load_field)( PS_Parser       parser,\r\n                   const T1_Field  field,\r\n                   void**          objects,\r\n                   FT_UInt         max_objects,\r\n                   FT_ULong*       pflags );\r\n\r\n    FT_Error\r\n    (*load_field_table)( PS_Parser       parser,\r\n                         const T1_Field  field,\r\n                         void**          objects,\r\n                         FT_UInt         max_objects,\r\n                         FT_ULong*       pflags );\r\n\r\n  } PS_Parser_FuncsRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_ParserRec                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A PS_Parser is an object used to parse a Type 1 font very quickly. */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    cursor :: The current position in the text.                        */\r\n  /*                                                                       */\r\n  /*    base   :: Start of the processed text.                             */\r\n  /*                                                                       */\r\n  /*    limit  :: End of the processed text.                               */\r\n  /*                                                                       */\r\n  /*    error  :: The last error returned.                                 */\r\n  /*                                                                       */\r\n  /*    memory :: The object used for memory operations (alloc/realloc).   */\r\n  /*                                                                       */\r\n  /*    funcs  :: A table of functions for the parser.                     */\r\n  /*                                                                       */\r\n  typedef struct  PS_ParserRec_\r\n  {\r\n    FT_Byte*   cursor;\r\n    FT_Byte*   base;\r\n    FT_Byte*   limit;\r\n    FT_Error   error;\r\n    FT_Memory  memory;\r\n\r\n    PS_Parser_FuncsRec  funcs;\r\n\r\n  } PS_ParserRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         T1 BUILDER                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct T1_BuilderRec_*  T1_Builder;\r\n\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Check_Points_Func)( T1_Builder  builder,\r\n                                   FT_Int      count );\r\n\r\n  typedef void\r\n  (*T1_Builder_Add_Point_Func)( T1_Builder  builder,\r\n                                FT_Pos      x,\r\n                                FT_Pos      y,\r\n                                FT_Byte     flag );\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Add_Point1_Func)( T1_Builder  builder,\r\n                                 FT_Pos      x,\r\n                                 FT_Pos      y );\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Add_Contour_Func)( T1_Builder  builder );\r\n\r\n  typedef FT_Error\r\n  (*T1_Builder_Start_Point_Func)( T1_Builder  builder,\r\n                                  FT_Pos      x,\r\n                                  FT_Pos      y );\r\n\r\n  typedef void\r\n  (*T1_Builder_Close_Contour_Func)( T1_Builder  builder );\r\n\r\n\r\n  typedef const struct T1_Builder_FuncsRec_*  T1_Builder_Funcs;\r\n\r\n  typedef struct  T1_Builder_FuncsRec_\r\n  {\r\n    void\r\n    (*init)( T1_Builder    builder,\r\n             FT_Face       face,\r\n             FT_Size       size,\r\n             FT_GlyphSlot  slot,\r\n             FT_Bool       hinting );\r\n\r\n    void\r\n    (*done)( T1_Builder   builder );\r\n\r\n    T1_Builder_Check_Points_Func   check_points;\r\n    T1_Builder_Add_Point_Func      add_point;\r\n    T1_Builder_Add_Point1_Func     add_point1;\r\n    T1_Builder_Add_Contour_Func    add_contour;\r\n    T1_Builder_Start_Point_Func    start_point;\r\n    T1_Builder_Close_Contour_Func  close_contour;\r\n\r\n  } T1_Builder_FuncsRec;\r\n\r\n\r\n  /* an enumeration type to handle charstring parsing states */\r\n  typedef enum  T1_ParseState_\r\n  {\r\n    T1_Parse_Start,\r\n    T1_Parse_Have_Width,\r\n    T1_Parse_Have_Moveto,\r\n    T1_Parse_Have_Path\r\n\r\n  } T1_ParseState;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Structure>                                                           */\r\n  /*    T1_BuilderRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*     A structure used during glyph loading to store its outline.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory       :: The current memory object.                         */\r\n  /*                                                                       */\r\n  /*    face         :: The current face object.                           */\r\n  /*                                                                       */\r\n  /*    glyph        :: The current glyph slot.                            */\r\n  /*                                                                       */\r\n  /*    loader       :: XXX                                                */\r\n  /*                                                                       */\r\n  /*    base         :: The base glyph outline.                            */\r\n  /*                                                                       */\r\n  /*    current      :: The current glyph outline.                         */\r\n  /*                                                                       */\r\n  /*    max_points   :: maximum points in builder outline                  */\r\n  /*                                                                       */\r\n  /*    max_contours :: Maximal number of contours in builder outline.     */\r\n  /*                                                                       */\r\n  /*    pos_x        :: The horizontal translation (if composite glyph).   */\r\n  /*                                                                       */\r\n  /*    pos_y        :: The vertical translation (if composite glyph).     */\r\n  /*                                                                       */\r\n  /*    left_bearing :: The left side bearing point.                       */\r\n  /*                                                                       */\r\n  /*    advance      :: The horizontal advance vector.                     */\r\n  /*                                                                       */\r\n  /*    bbox         :: Unused.                                            */\r\n  /*                                                                       */\r\n  /*    parse_state  :: An enumeration which controls the charstring       */\r\n  /*                    parsing state.                                     */\r\n  /*                                                                       */\r\n  /*    load_points  :: If this flag is not set, no points are loaded.     */\r\n  /*                                                                       */\r\n  /*    no_recurse   :: Set but not used.                                  */\r\n  /*                                                                       */\r\n  /*    metrics_only :: A boolean indicating that we only want to compute  */\r\n  /*                    the metrics of a given glyph, not load all of its  */\r\n  /*                    points.                                            */\r\n  /*                                                                       */\r\n  /*    funcs        :: An array of function pointers for the builder.     */\r\n  /*                                                                       */\r\n  typedef struct  T1_BuilderRec_\r\n  {\r\n    FT_Memory       memory;\r\n    FT_Face         face;\r\n    FT_GlyphSlot    glyph;\r\n    FT_GlyphLoader  loader;\r\n    FT_Outline*     base;\r\n    FT_Outline*     current;\r\n\r\n    FT_Pos          pos_x;\r\n    FT_Pos          pos_y;\r\n\r\n    FT_Vector       left_bearing;\r\n    FT_Vector       advance;\r\n\r\n    FT_BBox         bbox;          /* bounding box */\r\n    T1_ParseState   parse_state;\r\n    FT_Bool         load_points;\r\n    FT_Bool         no_recurse;\r\n\r\n    FT_Bool         metrics_only;\r\n\r\n    void*           hints_funcs;    /* hinter-specific */\r\n    void*           hints_globals;  /* hinter-specific */\r\n\r\n    T1_Builder_FuncsRec  funcs;\r\n\r\n  } T1_BuilderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                         T1 DECODER                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#if 0\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine   */\r\n  /* calls during glyph loading.                                           */\r\n  /*                                                                       */\r\n#define T1_MAX_SUBRS_CALLS  8\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity.  A     */\r\n  /* minimum of 16 is required.                                            */\r\n  /*                                                                       */\r\n#define T1_MAX_CHARSTRINGS_OPERANDS  32\r\n\r\n#endif /* 0 */\r\n\r\n\r\n  typedef struct  T1_Decoder_ZoneRec_\r\n  {\r\n    FT_Byte*  cursor;\r\n    FT_Byte*  base;\r\n    FT_Byte*  limit;\r\n\r\n  } T1_Decoder_ZoneRec, *T1_Decoder_Zone;\r\n\r\n\r\n  typedef struct T1_DecoderRec_*              T1_Decoder;\r\n  typedef const struct T1_Decoder_FuncsRec_*  T1_Decoder_Funcs;\r\n\r\n\r\n  typedef FT_Error\r\n  (*T1_Decoder_Callback)( T1_Decoder  decoder,\r\n                          FT_UInt     glyph_index );\r\n\r\n\r\n  typedef struct  T1_Decoder_FuncsRec_\r\n  {\r\n    FT_Error\r\n    (*init)( T1_Decoder           decoder,\r\n             FT_Face              face,\r\n             FT_Size              size,\r\n             FT_GlyphSlot         slot,\r\n             FT_Byte**            glyph_names,\r\n             PS_Blend             blend,\r\n             FT_Bool              hinting,\r\n             FT_Render_Mode       hint_mode,\r\n             T1_Decoder_Callback  callback );\r\n\r\n    void\r\n    (*done)( T1_Decoder  decoder );\r\n\r\n    FT_Error\r\n    (*parse_charstrings)( T1_Decoder  decoder,\r\n                          FT_Byte*    base,\r\n                          FT_UInt     len );\r\n\r\n  } T1_Decoder_FuncsRec;\r\n\r\n\r\n  typedef struct  T1_DecoderRec_\r\n  {\r\n    T1_BuilderRec        builder;\r\n\r\n    FT_Long              stack[T1_MAX_CHARSTRINGS_OPERANDS];\r\n    FT_Long*             top;\r\n\r\n    T1_Decoder_ZoneRec   zones[T1_MAX_SUBRS_CALLS + 1];\r\n    T1_Decoder_Zone      zone;\r\n\r\n    FT_Service_PsCMaps   psnames;      /* for seac */\r\n    FT_UInt              num_glyphs;\r\n    FT_Byte**            glyph_names;\r\n\r\n    FT_Int               lenIV;        /* internal for sub routine calls */\r\n    FT_UInt              num_subrs;\r\n    FT_Byte**            subrs;\r\n    FT_PtrDist*          subrs_len;    /* array of subrs length (optional) */\r\n\r\n    FT_Matrix            font_matrix;\r\n    FT_Vector            font_offset;\r\n\r\n    FT_Int               flex_state;\r\n    FT_Int               num_flex_vectors;\r\n    FT_Vector            flex_vectors[7];\r\n\r\n    PS_Blend             blend;       /* for multiple master support */\r\n\r\n    FT_Render_Mode       hint_mode;\r\n\r\n    T1_Decoder_Callback  parse_callback;\r\n    T1_Decoder_FuncsRec  funcs;\r\n\r\n    FT_Long*             buildchar;\r\n    FT_UInt              len_buildchar;\r\n\r\n    FT_Bool              seac;\r\n\r\n  } T1_DecoderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                            AFM PARSER                         *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct AFM_ParserRec_*  AFM_Parser;\r\n\r\n  typedef struct  AFM_Parser_FuncsRec_\r\n  {\r\n    FT_Error\r\n    (*init)( AFM_Parser  parser,\r\n             FT_Memory   memory,\r\n             FT_Byte*    base,\r\n             FT_Byte*    limit );\r\n\r\n    void\r\n    (*done)( AFM_Parser  parser );\r\n\r\n    FT_Error\r\n    (*parse)( AFM_Parser  parser );\r\n\r\n  } AFM_Parser_FuncsRec;\r\n\r\n\r\n  typedef struct AFM_StreamRec_*  AFM_Stream;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    AFM_ParserRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An AFM_Parser is a parser for the AFM files.                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    memory    :: The object used for memory operations (alloc and      */\r\n  /*                 realloc).                                             */\r\n  /*                                                                       */\r\n  /*    stream    :: This is an opaque object.                             */\r\n  /*                                                                       */\r\n  /*    FontInfo  :: The result will be stored here.                       */\r\n  /*                                                                       */\r\n  /*    get_index :: A user provided function to get a glyph index by its  */\r\n  /*                 name.                                                 */\r\n  /*                                                                       */\r\n  typedef struct  AFM_ParserRec_\r\n  {\r\n    FT_Memory     memory;\r\n    AFM_Stream    stream;\r\n\r\n    AFM_FontInfo  FontInfo;\r\n\r\n    FT_Int\r\n    (*get_index)( const char*  name,\r\n                  FT_Offset    len,\r\n                  void*        user_data );\r\n\r\n    void*         user_data;\r\n\r\n  } AFM_ParserRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                     TYPE1 CHARMAPS                            *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef const struct T1_CMap_ClassesRec_*  T1_CMap_Classes;\r\n\r\n  typedef struct T1_CMap_ClassesRec_\r\n  {\r\n    FT_CMap_Class  standard;\r\n    FT_CMap_Class  expert;\r\n    FT_CMap_Class  custom;\r\n    FT_CMap_Class  unicode;\r\n\r\n  } T1_CMap_ClassesRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                        PSAux Module Interface                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  PSAux_ServiceRec_\r\n  {\r\n    /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */\r\n    const PS_Table_FuncsRec*    ps_table_funcs;\r\n    const PS_Parser_FuncsRec*   ps_parser_funcs;\r\n    const T1_Builder_FuncsRec*  t1_builder_funcs;\r\n    const T1_Decoder_FuncsRec*  t1_decoder_funcs;\r\n\r\n    void\r\n    (*t1_decrypt)( FT_Byte*   buffer,\r\n                   FT_Offset  length,\r\n                   FT_UShort  seed );\r\n\r\n    T1_CMap_Classes  t1_cmap_classes;\r\n\r\n    /* fields after this comment line were added after version 2.1.10 */\r\n    const AFM_Parser_FuncsRec*  afm_parser_funcs;\r\n\r\n  } PSAux_ServiceRec, *PSAux_Service;\r\n\r\n  /* backwards-compatible type definition */\r\n  typedef PSAux_ServiceRec   PSAux_Interface;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                 Some convenience functions                    *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n#define IS_PS_NEWLINE( ch ) \\\r\n  ( (ch) == '\\r' ||         \\\r\n    (ch) == '\\n' )\r\n\r\n#define IS_PS_SPACE( ch )  \\\r\n  ( (ch) == ' '         || \\\r\n    IS_PS_NEWLINE( ch ) || \\\r\n    (ch) == '\\t'        || \\\r\n    (ch) == '\\f'        || \\\r\n    (ch) == '\\0' )\r\n\r\n#define IS_PS_SPECIAL( ch )       \\\r\n  ( (ch) == '/'                || \\\r\n    (ch) == '(' || (ch) == ')' || \\\r\n    (ch) == '<' || (ch) == '>' || \\\r\n    (ch) == '[' || (ch) == ']' || \\\r\n    (ch) == '{' || (ch) == '}' || \\\r\n    (ch) == '%'                )\r\n\r\n#define IS_PS_DELIM( ch )  \\\r\n  ( IS_PS_SPACE( ch )   || \\\r\n    IS_PS_SPECIAL( ch ) )\r\n\r\n#define IS_PS_DIGIT( ch )        \\\r\n  ( (ch) >= '0' && (ch) <= '9' )\r\n\r\n#define IS_PS_XDIGIT( ch )            \\\r\n  ( IS_PS_DIGIT( ch )              || \\\r\n    ( (ch) >= 'A' && (ch) <= 'F' ) || \\\r\n    ( (ch) >= 'a' && (ch) <= 'f' ) )\r\n\r\n#define IS_PS_BASE85( ch )       \\\r\n  ( (ch) >= '!' && (ch) <= 'u' )\r\n\r\n#define IS_PS_TOKEN( cur, limit, token )                                \\\r\n  ( (char)(cur)[0] == (token)[0]                                     && \\\r\n    ( (cur) + sizeof ( (token) ) == (limit) ||                          \\\r\n      ( (cur) + sizeof( (token) ) < (limit)          &&                 \\\r\n        IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) )             && \\\r\n    ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSAUX_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/pshints.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  pshints.h                                                              */\r\n/*                                                                         */\r\n/*    Interface to Postscript-specific (Type 1 and Type 2) hints           */\r\n/*    recorders (specification only).  These are used to support native    */\r\n/*    T1/T2 hints in the `type1', `cid', and `cff' font drivers.           */\r\n/*                                                                         */\r\n/*  Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2009 by                  */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __PSHINTS_H__\r\n#define __PSHINTS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n#include FT_TYPE1_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****               INTERNAL REPRESENTATION OF GLOBALS              *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct PSH_GlobalsRec_*  PSH_Globals;\r\n\r\n  typedef FT_Error\r\n  (*PSH_Globals_NewFunc)( FT_Memory     memory,\r\n                          T1_Private*   private_dict,\r\n                          PSH_Globals*  aglobals );\r\n\r\n  typedef FT_Error\r\n  (*PSH_Globals_SetScaleFunc)( PSH_Globals  globals,\r\n                               FT_Fixed     x_scale,\r\n                               FT_Fixed     y_scale,\r\n                               FT_Fixed     x_delta,\r\n                               FT_Fixed     y_delta );\r\n\r\n  typedef void\r\n  (*PSH_Globals_DestroyFunc)( PSH_Globals  globals );\r\n\r\n\r\n  typedef struct  PSH_Globals_FuncsRec_\r\n  {\r\n    PSH_Globals_NewFunc       create;\r\n    PSH_Globals_SetScaleFunc  set_scale;\r\n    PSH_Globals_DestroyFunc   destroy;\r\n\r\n  } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  PUBLIC TYPE 1 HINTS RECORDER                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T1_Hints\r\n   *\r\n   * @description:\r\n   *   This is a handle to an opaque structure used to record glyph hints\r\n   *   from a Type 1 character glyph character string.\r\n   *\r\n   *   The methods used to operate on this object are defined by the\r\n   *   @T1_Hints_FuncsRec structure.  Recording glyph hints is normally\r\n   *   achieved through the following scheme:\r\n   *\r\n   *   - Open a new hint recording session by calling the `open' method.\r\n   *     This rewinds the recorder and prepare it for new input.\r\n   *\r\n   *   - For each hint found in the glyph charstring, call the corresponding\r\n   *     method (`stem', `stem3', or `reset').  Note that these functions do\r\n   *     not return an error code.\r\n   *\r\n   *   - Close the recording session by calling the `close' method.  It\r\n   *     returns an error code if the hints were invalid or something\r\n   *     strange happened (e.g., memory shortage).\r\n   *\r\n   *   The hints accumulated in the object can later be used by the\r\n   *   PostScript hinter.\r\n   *\r\n   */\r\n  typedef struct T1_HintsRec_*  T1_Hints;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T1_Hints_Funcs\r\n   *\r\n   * @description:\r\n   *   A pointer to the @T1_Hints_FuncsRec structure that defines the API of\r\n   *   a given @T1_Hints object.\r\n   *\r\n   */\r\n  typedef const struct T1_Hints_FuncsRec_*  T1_Hints_Funcs;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_OpenFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to prepare it for a new Type 1\r\n   *   hints recording session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   * @note:\r\n   *   You should always call the @T1_Hints_CloseFunc method in order to\r\n   *   close an opened recording session.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_OpenFunc)( T1_Hints  hints );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_SetStemFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to record a new horizontal or\r\n   *   vertical stem.  This corresponds to the Type 1 `hstem' and `vstem'\r\n   *   operators.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   dimension ::\r\n   *     0 for horizontal stems (hstem), 1 for vertical ones (vstem).\r\n   *\r\n   *   coords ::\r\n   *     Array of 2 coordinates in 16.16 format, used as (position,length)\r\n   *     stem descriptor.\r\n   *\r\n   * @note:\r\n   *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use\r\n   *   horizontal coordinates (x) for vertical stems (dim=1).\r\n   *\r\n   *   `coords[0]' is the absolute stem position (lowest coordinate);\r\n   *   `coords[1]' is the length.\r\n   *\r\n   *   The length can be negative, in which case it must be either -20 or\r\n   *   -21.  It is interpreted as a `ghost' stem, according to the Type 1\r\n   *   specification.\r\n   *\r\n   *   If the length is -21 (corresponding to a bottom ghost stem), then\r\n   *   the real stem position is `coords[0]+coords[1]'.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_SetStemFunc)( T1_Hints   hints,\r\n                           FT_UInt    dimension,\r\n                           FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_SetStem3Func\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to record three\r\n   *   counter-controlled horizontal or vertical stems at once.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   dimension ::\r\n   *     0 for horizontal stems, 1 for vertical ones.\r\n   *\r\n   *   coords ::\r\n   *     An array of 6 values in 16.16 format, holding 3 (position,length)\r\n   *     pairs for the counter-controlled stems.\r\n   *\r\n   * @note:\r\n   *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use\r\n   *   horizontal coordinates (x) for vertical stems (dim=1).\r\n   *\r\n   *   The lengths cannot be negative (ghost stems are never\r\n   *   counter-controlled).\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_SetStem3Func)( T1_Hints   hints,\r\n                            FT_UInt    dimension,\r\n                            FT_Fixed*  coords );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_ResetFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to reset the stems hints in a\r\n   *   recording session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The index of the last point in the input glyph in which the\r\n   *     previously defined hints apply.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T1_Hints_ResetFunc)( T1_Hints  hints,\r\n                         FT_UInt   end_point );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_CloseFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to close a hint recording\r\n   *   session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The index of the last point in the input glyph.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   The error code is set to indicate that an error occurred during the\r\n   *   recording session.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T1_Hints_CloseFunc)( T1_Hints  hints,\r\n                         FT_UInt   end_point );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T1_Hints_ApplyFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T1_Hints class used to apply hints to the\r\n   *   corresponding glyph outline.  Must be called once all hints have been\r\n   *   recorded.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 1 hints recorder.\r\n   *\r\n   *   outline ::\r\n   *     A pointer to the target outline descriptor.\r\n   *\r\n   *   globals ::\r\n   *     The hinter globals for this font.\r\n   *\r\n   *   hint_mode ::\r\n   *     Hinting information.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   On input, all points within the outline are in font coordinates. On\r\n   *   output, they are in 1/64th of pixels.\r\n   *\r\n   *   The scaling transformation is taken from the `globals' object which\r\n   *   must correspond to the same font as the glyph.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T1_Hints_ApplyFunc)( T1_Hints        hints,\r\n                         FT_Outline*     outline,\r\n                         PSH_Globals     globals,\r\n                         FT_Render_Mode  hint_mode );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   T1_Hints_FuncsRec\r\n   *\r\n   * @description:\r\n   *   The structure used to provide the API to @T1_Hints objects.\r\n   *\r\n   * @fields:\r\n   *   hints ::\r\n   *     A handle to the T1 Hints recorder.\r\n   *\r\n   *   open ::\r\n   *     The function to open a recording session.\r\n   *\r\n   *   close ::\r\n   *     The function to close a recording session.\r\n   *\r\n   *   stem ::\r\n   *     The function to set a simple stem.\r\n   *\r\n   *   stem3 ::\r\n   *     The function to set counter-controlled stems.\r\n   *\r\n   *   reset ::\r\n   *     The function to reset stem hints.\r\n   *\r\n   *   apply ::\r\n   *     The function to apply the hints to the corresponding glyph outline.\r\n   *\r\n   */\r\n  typedef struct  T1_Hints_FuncsRec_\r\n  {\r\n    T1_Hints               hints;\r\n    T1_Hints_OpenFunc      open;\r\n    T1_Hints_CloseFunc     close;\r\n    T1_Hints_SetStemFunc   stem;\r\n    T1_Hints_SetStem3Func  stem3;\r\n    T1_Hints_ResetFunc     reset;\r\n    T1_Hints_ApplyFunc     apply;\r\n\r\n  } T1_Hints_FuncsRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*****                                                               *****/\r\n  /*****                  PUBLIC TYPE 2 HINTS RECORDER                 *****/\r\n  /*****                                                               *****/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T2_Hints\r\n   *\r\n   * @description:\r\n   *   This is a handle to an opaque structure used to record glyph hints\r\n   *   from a Type 2 character glyph character string.\r\n   *\r\n   *   The methods used to operate on this object are defined by the\r\n   *   @T2_Hints_FuncsRec structure.  Recording glyph hints is normally\r\n   *   achieved through the following scheme:\r\n   *\r\n   *   - Open a new hint recording session by calling the `open' method.\r\n   *     This rewinds the recorder and prepare it for new input.\r\n   *\r\n   *   - For each hint found in the glyph charstring, call the corresponding\r\n   *     method (`stems', `hintmask', `counters').  Note that these\r\n   *     functions do not return an error code.\r\n   *\r\n   *   - Close the recording session by calling the `close' method.  It\r\n   *     returns an error code if the hints were invalid or something\r\n   *     strange happened (e.g., memory shortage).\r\n   *\r\n   *   The hints accumulated in the object can later be used by the\r\n   *   Postscript hinter.\r\n   *\r\n   */\r\n  typedef struct T2_HintsRec_*  T2_Hints;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @type:\r\n   *   T2_Hints_Funcs\r\n   *\r\n   * @description:\r\n   *   A pointer to the @T2_Hints_FuncsRec structure that defines the API of\r\n   *   a given @T2_Hints object.\r\n   *\r\n   */\r\n  typedef const struct T2_Hints_FuncsRec_*  T2_Hints_Funcs;\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_OpenFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to prepare it for a new Type 2\r\n   *   hints recording session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   * @note:\r\n   *   You should always call the @T2_Hints_CloseFunc method in order to\r\n   *   close an opened recording session.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_OpenFunc)( T2_Hints  hints );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_StemsFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to set the table of stems in\r\n   *   either the vertical or horizontal dimension.  Equivalent to the\r\n   *   `hstem', `vstem', `hstemhm', and `vstemhm' Type 2 operators.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   dimension ::\r\n   *     0 for horizontal stems (hstem), 1 for vertical ones (vstem).\r\n   *\r\n   *   count ::\r\n   *     The number of stems.\r\n   *\r\n   *   coords ::\r\n   *     An array of `count' (position,length) pairs in 16.16 format.\r\n   *\r\n   * @note:\r\n   *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use\r\n   *   horizontal coordinates (x) for vertical stems (dim=1).\r\n   *\r\n   *   There are `2*count' elements in the `coords' array.  Each even\r\n   *   element is an absolute position in font units, each odd element is a\r\n   *   length in font units.\r\n   *\r\n   *   A length can be negative, in which case it must be either -20 or\r\n   *   -21.  It is interpreted as a `ghost' stem, according to the Type 1\r\n   *   specification.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_StemsFunc)( T2_Hints   hints,\r\n                         FT_UInt    dimension,\r\n                         FT_UInt    count,\r\n                         FT_Fixed*  coordinates );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_MaskFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to set a given hintmask (this\r\n   *   corresponds to the `hintmask' Type 2 operator).\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The glyph index of the last point to which the previously defined\r\n   *     or activated hints apply.\r\n   *\r\n   *   bit_count ::\r\n   *     The number of bits in the hint mask.\r\n   *\r\n   *   bytes ::\r\n   *     An array of bytes modelling the hint mask.\r\n   *\r\n   * @note:\r\n   *   If the hintmask starts the charstring (before any glyph point\r\n   *   definition), the value of `end_point' should be 0.\r\n   *\r\n   *   `bit_count' is the number of meaningful bits in the `bytes' array; it\r\n   *   must be equal to the total number of hints defined so far (i.e.,\r\n   *   horizontal+verticals).\r\n   *\r\n   *   The `bytes' array can come directly from the Type 2 charstring and\r\n   *   respects the same format.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_MaskFunc)( T2_Hints        hints,\r\n                        FT_UInt         end_point,\r\n                        FT_UInt         bit_count,\r\n                        const FT_Byte*  bytes );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_CounterFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to set a given counter mask\r\n   *   (this corresponds to the `hintmask' Type 2 operator).\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     A glyph index of the last point to which the previously defined or\r\n   *     active hints apply.\r\n   *\r\n   *   bit_count ::\r\n   *     The number of bits in the hint mask.\r\n   *\r\n   *   bytes ::\r\n   *     An array of bytes modelling the hint mask.\r\n   *\r\n   * @note:\r\n   *   If the hintmask starts the charstring (before any glyph point\r\n   *   definition), the value of `end_point' should be 0.\r\n   *\r\n   *   `bit_count' is the number of meaningful bits in the `bytes' array; it\r\n   *   must be equal to the total number of hints defined so far (i.e.,\r\n   *   horizontal+verticals).\r\n   *\r\n   *    The `bytes' array can come directly from the Type 2 charstring and\r\n   *    respects the same format.\r\n   *\r\n   */\r\n  typedef void\r\n  (*T2_Hints_CounterFunc)( T2_Hints        hints,\r\n                           FT_UInt         bit_count,\r\n                           const FT_Byte*  bytes );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_CloseFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to close a hint recording\r\n   *   session.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   end_point ::\r\n   *     The index of the last point in the input glyph.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   The error code is set to indicate that an error occurred during the\r\n   *   recording session.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T2_Hints_CloseFunc)( T2_Hints  hints,\r\n                         FT_UInt   end_point );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @functype:\r\n   *   T2_Hints_ApplyFunc\r\n   *\r\n   * @description:\r\n   *   A method of the @T2_Hints class used to apply hints to the\r\n   *   corresponding glyph outline.  Must be called after the `close'\r\n   *   method.\r\n   *\r\n   * @input:\r\n   *   hints ::\r\n   *     A handle to the Type 2 hints recorder.\r\n   *\r\n   *   outline ::\r\n   *     A pointer to the target outline descriptor.\r\n   *\r\n   *   globals ::\r\n   *     The hinter globals for this font.\r\n   *\r\n   *   hint_mode ::\r\n   *     Hinting information.\r\n   *\r\n   * @return:\r\n   *   FreeType error code.  0 means success.\r\n   *\r\n   * @note:\r\n   *   On input, all points within the outline are in font coordinates. On\r\n   *   output, they are in 1/64th of pixels.\r\n   *\r\n   *   The scaling transformation is taken from the `globals' object which\r\n   *   must correspond to the same font than the glyph.\r\n   *\r\n   */\r\n  typedef FT_Error\r\n  (*T2_Hints_ApplyFunc)( T2_Hints        hints,\r\n                         FT_Outline*     outline,\r\n                         PSH_Globals     globals,\r\n                         FT_Render_Mode  hint_mode );\r\n\r\n\r\n  /*************************************************************************\r\n   *\r\n   * @struct:\r\n   *   T2_Hints_FuncsRec\r\n   *\r\n   * @description:\r\n   *   The structure used to provide the API to @T2_Hints objects.\r\n   *\r\n   * @fields:\r\n   *   hints ::\r\n   *     A handle to the T2 hints recorder object.\r\n   *\r\n   *   open ::\r\n   *     The function to open a recording session.\r\n   *\r\n   *   close ::\r\n   *     The function to close a recording session.\r\n   *\r\n   *   stems ::\r\n   *     The function to set the dimension's stems table.\r\n   *\r\n   *   hintmask ::\r\n   *     The function to set hint masks.\r\n   *\r\n   *   counter ::\r\n   *     The function to set counter masks.\r\n   *\r\n   *   apply ::\r\n   *     The function to apply the hints on the corresponding glyph outline.\r\n   *\r\n   */\r\n  typedef struct  T2_Hints_FuncsRec_\r\n  {\r\n    T2_Hints              hints;\r\n    T2_Hints_OpenFunc     open;\r\n    T2_Hints_CloseFunc    close;\r\n    T2_Hints_StemsFunc    stems;\r\n    T2_Hints_MaskFunc     hintmask;\r\n    T2_Hints_CounterFunc  counter;\r\n    T2_Hints_ApplyFunc    apply;\r\n\r\n  } T2_Hints_FuncsRec;\r\n\r\n\r\n  /* */\r\n\r\n\r\n  typedef struct  PSHinter_Interface_\r\n  {\r\n    PSH_Globals_Funcs  (*get_globals_funcs)( FT_Module  module );\r\n    T1_Hints_Funcs     (*get_t1_funcs)     ( FT_Module  module );\r\n    T2_Hints_Funcs     (*get_t2_funcs)     ( FT_Module  module );\r\n\r\n  } PSHinter_Interface;\r\n\r\n  typedef PSHinter_Interface*  PSHinter_Service;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_,             \\\r\n                                     get_t1_funcs_, get_t2_funcs_)           \\\r\n  static const PSHinter_Interface class_ =                                   \\\r\n  {                                                                          \\\r\n    get_globals_funcs_, get_t1_funcs_, get_t2_funcs_                         \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_,             \\\r\n                                     get_t1_funcs_, get_t2_funcs_)           \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library,                                \\\r\n                          PSHinter_Interface*  clazz)                        \\\r\n  {                                                                          \\\r\n    FT_UNUSED(library);                                                      \\\r\n    clazz->get_globals_funcs = get_globals_funcs_;                           \\\r\n    clazz->get_t1_funcs = get_t1_funcs_;                                     \\\r\n    clazz->get_t2_funcs = get_t2_funcs_;                                     \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __PSHINTS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svbdf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svbdf.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType BDF services (specification).                           */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVBDF_H__\r\n#define __SVBDF_H__\r\n\r\n#include FT_BDF_H\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_BDF  \"bdf\"\r\n\r\n  typedef FT_Error\r\n  (*FT_BDF_GetCharsetIdFunc)( FT_Face       face,\r\n                              const char*  *acharset_encoding,\r\n                              const char*  *acharset_registry );\r\n\r\n  typedef FT_Error\r\n  (*FT_BDF_GetPropertyFunc)( FT_Face           face,\r\n                             const char*       prop_name,\r\n                             BDF_PropertyRec  *aproperty );\r\n\r\n\r\n  FT_DEFINE_SERVICE( BDF )\r\n  {\r\n    FT_BDF_GetCharsetIdFunc  get_charset_id;\r\n    FT_BDF_GetPropertyFunc   get_property;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \\\r\n  static const FT_Service_BDFRec class_ =                                \\\r\n  {                                                                      \\\r\n    get_charset_id_, get_property_                                       \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \\\r\n  void                                                                   \\\r\n  FT_Init_Class_##class_( FT_Service_BDFRec*  clazz )                    \\\r\n  {                                                                      \\\r\n    clazz->get_charset_id = get_charset_id_;                             \\\r\n    clazz->get_property = get_property_;                                 \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVBDF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svcid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svcid.h                                                                */\r\n/*                                                                         */\r\n/*    The FreeType CID font services (specification).                      */\r\n/*                                                                         */\r\n/*  Copyright 2007, 2009 by Derek Clegg, Michael Toftdal.                  */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVCID_H__\r\n#define __SVCID_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_CID  \"CID\"\r\n\r\n  typedef FT_Error\r\n  (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face       face,\r\n                                               const char*  *registry,\r\n                                               const char*  *ordering,\r\n                                               FT_Int       *supplement );\r\n  typedef FT_Error\r\n  (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face   face,\r\n                                         FT_Bool  *is_cid );\r\n  typedef FT_Error\r\n  (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face   face,\r\n                                      FT_UInt   glyph_index,\r\n                                      FT_UInt  *cid );\r\n\r\n  FT_DEFINE_SERVICE( CID )\r\n  {\r\n    FT_CID_GetRegistryOrderingSupplementFunc  get_ros;\r\n    FT_CID_GetIsInternallyCIDKeyedFunc        get_is_cid;\r\n    FT_CID_GetCIDFromGlyphIndexFunc           get_cid_from_glyph_index;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_,                           \\\r\n        get_is_cid_, get_cid_from_glyph_index_ )                             \\\r\n  static const FT_Service_CIDRec class_ =                                    \\\r\n  {                                                                          \\\r\n    get_ros_, get_is_cid_, get_cid_from_glyph_index_                         \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_,                           \\\r\n        get_is_cid_, get_cid_from_glyph_index_ )                             \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library,                                \\\r\n                          FT_Service_CIDRec* clazz)                          \\\r\n  {                                                                          \\\r\n    FT_UNUSED(library);                                                      \\\r\n    clazz->get_ros = get_ros_;                                               \\\r\n    clazz->get_is_cid = get_is_cid_;                                         \\\r\n    clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_;             \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVCID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svgldict.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svgldict.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType glyph dictionary services (specification).              */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVGLDICT_H__\r\n#define __SVGLDICT_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  A service used to retrieve glyph names, as well as to find the\r\n   *  index of a given glyph name in a font.\r\n   *\r\n   */\r\n\r\n#define FT_SERVICE_ID_GLYPH_DICT  \"glyph-dict\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_GlyphDict_GetNameFunc)( FT_Face     face,\r\n                               FT_UInt     glyph_index,\r\n                               FT_Pointer  buffer,\r\n                               FT_UInt     buffer_max );\r\n\r\n  typedef FT_UInt\r\n  (*FT_GlyphDict_NameIndexFunc)( FT_Face     face,\r\n                                 FT_String*  glyph_name );\r\n\r\n\r\n  FT_DEFINE_SERVICE( GlyphDict )\r\n  {\r\n    FT_GlyphDict_GetNameFunc    get_name;\r\n    FT_GlyphDict_NameIndexFunc  name_index;  /* optional */\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \\\r\n  static const FT_Service_GlyphDictRec class_ =                        \\\r\n  {                                                                    \\\r\n    get_name_, name_index_                                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \\\r\n  void                                                                 \\\r\n  FT_Init_Class_##class_( FT_Library library,                          \\\r\n                          FT_Service_GlyphDictRec* clazz)              \\\r\n  {                                                                    \\\r\n    FT_UNUSED(library);                                                \\\r\n    clazz->get_name = get_name_;                                       \\\r\n    clazz->name_index = name_index_;                                   \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVGLDICT_H__ */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svgxval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svgxval.h                                                              */\r\n/*                                                                         */\r\n/*    FreeType API for validating TrueTypeGX/AAT tables (specification).   */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2005 by                                                */\r\n/*  Masatake YAMATO, Red Hat K.K.,                                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/***************************************************************************/\r\n/*                                                                         */\r\n/* gxvalid is derived from both gxlayout module and otvalid module.        */\r\n/* Development of gxlayout is supported by the Information-technology      */\r\n/* Promotion Agency(IPA), Japan.                                           */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVGXVAL_H__\r\n#define __SVGXVAL_H__\r\n\r\n#include FT_GX_VALIDATE_H\r\n#include FT_INTERNAL_VALIDATE_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_GX_VALIDATE           \"truetypegx-validate\"\r\n#define FT_SERVICE_ID_CLASSICKERN_VALIDATE  \"classickern-validate\"\r\n\r\n  typedef FT_Error\r\n  (*gxv_validate_func)( FT_Face   face,\r\n                        FT_UInt   gx_flags,\r\n                        FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],\r\n                        FT_UInt   table_length );\r\n\r\n\r\n  typedef FT_Error\r\n  (*ckern_validate_func)( FT_Face   face,\r\n                          FT_UInt   ckern_flags,\r\n                          FT_Bytes  *ckern_table );\r\n\r\n\r\n  FT_DEFINE_SERVICE( GXvalidate )\r\n  {\r\n    gxv_validate_func  validate;\r\n  };\r\n\r\n  FT_DEFINE_SERVICE( CKERNvalidate )\r\n  {\r\n    ckern_validate_func  validate;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVGXVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svkern.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svkern.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType Kerning service (specification).                        */\r\n/*                                                                         */\r\n/*  Copyright 2006 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVKERN_H__\r\n#define __SVKERN_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n#define FT_SERVICE_ID_KERNING  \"kerning\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Kerning_TrackGetFunc)( FT_Face    face,\r\n                              FT_Fixed   point_size,\r\n                              FT_Int     degree,\r\n                              FT_Fixed*  akerning );\r\n\r\n  FT_DEFINE_SERVICE( Kerning )\r\n  {\r\n    FT_Kerning_TrackGetFunc  get_track;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVKERN_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svmm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svmm.h                                                                 */\r\n/*                                                                         */\r\n/*    The FreeType Multiple Masters and GX var services (specification).   */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVMM_H__\r\n#define __SVMM_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  A service used to manage multiple-masters data in a given face.\r\n   *\r\n   *  See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).\r\n   *\r\n   */\r\n\r\n#define FT_SERVICE_ID_MULTI_MASTERS  \"multi-masters\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_Get_MM_Func)( FT_Face           face,\r\n                     FT_Multi_Master*  master );\r\n\r\n  typedef FT_Error\r\n  (*FT_Get_MM_Var_Func)( FT_Face      face,\r\n                         FT_MM_Var*  *master );\r\n\r\n  typedef FT_Error\r\n  (*FT_Set_MM_Design_Func)( FT_Face   face,\r\n                            FT_UInt   num_coords,\r\n                            FT_Long*  coords );\r\n\r\n  typedef FT_Error\r\n  (*FT_Set_Var_Design_Func)( FT_Face    face,\r\n                             FT_UInt    num_coords,\r\n                             FT_Fixed*  coords );\r\n\r\n  typedef FT_Error\r\n  (*FT_Set_MM_Blend_Func)( FT_Face   face,\r\n                           FT_UInt   num_coords,\r\n                           FT_Long*  coords );\r\n\r\n\r\n  FT_DEFINE_SERVICE( MultiMasters )\r\n  {\r\n    FT_Get_MM_Func          get_mm;\r\n    FT_Set_MM_Design_Func   set_mm_design;\r\n    FT_Set_MM_Blend_Func    set_mm_blend;\r\n    FT_Get_MM_Var_Func      get_mm_var;\r\n    FT_Set_Var_Design_Func  set_var_design;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_,   \\\r\n        set_mm_blend_, get_mm_var_, set_var_design_)                         \\\r\n  static const FT_Service_MultiMastersRec class_ =                           \\\r\n  {                                                                          \\\r\n    get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_     \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_,   \\\r\n        set_mm_blend_, get_mm_var_, set_var_design_)                         \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Service_MultiMastersRec*  clazz )               \\\r\n  {                                                                          \\\r\n    clazz->get_mm = get_mm_;                                                 \\\r\n    clazz->set_mm_design = set_mm_design_;                                   \\\r\n    clazz->set_mm_blend = set_mm_blend_;                                     \\\r\n    clazz->get_mm_var = get_mm_var_;                                         \\\r\n    clazz->set_var_design = set_var_design_;                                 \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVMM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svotval.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svotval.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType OpenType validation service (specification).            */\r\n/*                                                                         */\r\n/*  Copyright 2004, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVOTVAL_H__\r\n#define __SVOTVAL_H__\r\n\r\n#include FT_OPENTYPE_VALIDATE_H\r\n#include FT_INTERNAL_VALIDATE_H\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_OPENTYPE_VALIDATE  \"opentype-validate\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*otv_validate_func)( FT_Face volatile  face,\r\n                        FT_UInt           ot_flags,\r\n                        FT_Bytes         *base,\r\n                        FT_Bytes         *gdef,\r\n                        FT_Bytes         *gpos,\r\n                        FT_Bytes         *gsub,\r\n                        FT_Bytes         *jstf );\r\n\r\n\r\n  FT_DEFINE_SERVICE( OTvalidate )\r\n  {\r\n    otv_validate_func  validate;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVOTVAL_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svpfr.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpfr.h                                                                */\r\n/*                                                                         */\r\n/*    Internal PFR service functions (specification).                      */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPFR_H__\r\n#define __SVPFR_H__\r\n\r\n#include FT_PFR_H\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_PFR_METRICS  \"pfr-metrics\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*FT_PFR_GetMetricsFunc)( FT_Face    face,\r\n                            FT_UInt   *aoutline,\r\n                            FT_UInt   *ametrics,\r\n                            FT_Fixed  *ax_scale,\r\n                            FT_Fixed  *ay_scale );\r\n\r\n  typedef FT_Error\r\n  (*FT_PFR_GetKerningFunc)( FT_Face     face,\r\n                            FT_UInt     left,\r\n                            FT_UInt     right,\r\n                            FT_Vector  *avector );\r\n\r\n  typedef FT_Error\r\n  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,\r\n                            FT_UInt   gindex,\r\n                            FT_Pos   *aadvance );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PfrMetrics )\r\n  {\r\n    FT_PFR_GetMetricsFunc  get_metrics;\r\n    FT_PFR_GetKerningFunc  get_kerning;\r\n    FT_PFR_GetAdvanceFunc  get_advance;\r\n\r\n  };\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVPFR_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svpostnm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpostnm.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType PostScript name services (specification).               */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2007 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPOSTNM_H__\r\n#define __SVPOSTNM_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*\r\n   *  A trivial service used to retrieve the PostScript name of a given\r\n   *  font when available.  The `get_name' field should never be NULL.\r\n   *\r\n   *  The corresponding function can return NULL to indicate that the\r\n   *  PostScript name is not available.\r\n   *\r\n   *  The name is owned by the face and will be destroyed with it.\r\n   */\r\n\r\n#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME  \"postscript-font-name\"\r\n\r\n\r\n  typedef const char*\r\n  (*FT_PsName_GetFunc)( FT_Face  face );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PsFontName )\r\n  {\r\n    FT_PsName_GetFunc  get_ps_font_name;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \\\r\n  static const FT_Service_PsFontNameRec class_ =                   \\\r\n  {                                                                \\\r\n    get_ps_font_name_                                              \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \\\r\n  void                                                             \\\r\n  FT_Init_Class_##class_( FT_Library library,                      \\\r\n                          FT_Service_PsFontNameRec* clazz)         \\\r\n  {                                                                \\\r\n    FT_UNUSED(library);                                            \\\r\n    clazz->get_ps_font_name = get_ps_font_name_;                   \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPOSTNM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svpscmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpscmap.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType PostScript charmap service (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPSCMAP_H__\r\n#define __SVPSCMAP_H__\r\n\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_POSTSCRIPT_CMAPS  \"postscript-cmaps\"\r\n\r\n\r\n  /*\r\n   *  Adobe glyph name to unicode value.\r\n   */\r\n  typedef FT_UInt32\r\n  (*PS_Unicode_ValueFunc)( const char*  glyph_name );\r\n\r\n  /*\r\n   *  Macintosh name id to glyph name.  NULL if invalid index.\r\n   */\r\n  typedef const char*\r\n  (*PS_Macintosh_NameFunc)( FT_UInt  name_index );\r\n\r\n  /*\r\n   *  Adobe standard string ID to glyph name.  NULL if invalid index.\r\n   */\r\n  typedef const char*\r\n  (*PS_Adobe_Std_StringsFunc)( FT_UInt  string_index );\r\n\r\n\r\n  /*\r\n   *  Simple unicode -> glyph index charmap built from font glyph names\r\n   *  table.\r\n   */\r\n  typedef struct  PS_UniMap_\r\n  {\r\n    FT_UInt32  unicode;      /* bit 31 set: is glyph variant */\r\n    FT_UInt    glyph_index;\r\n\r\n  } PS_UniMap;\r\n\r\n\r\n  typedef struct PS_UnicodesRec_*  PS_Unicodes;\r\n\r\n  typedef struct  PS_UnicodesRec_\r\n  {\r\n    FT_CMapRec  cmap;\r\n    FT_UInt     num_maps;\r\n    PS_UniMap*  maps;\r\n\r\n  } PS_UnicodesRec;\r\n\r\n\r\n  /*\r\n   *  A function which returns a glyph name for a given index.  Returns\r\n   *  NULL if invalid index.\r\n   */\r\n  typedef const char*\r\n  (*PS_GetGlyphNameFunc)( FT_Pointer  data,\r\n                          FT_UInt     string_index );\r\n\r\n  /*\r\n   *  A function used to release the glyph name returned by\r\n   *  PS_GetGlyphNameFunc, when needed\r\n   */\r\n  typedef void\r\n  (*PS_FreeGlyphNameFunc)( FT_Pointer  data,\r\n                           const char*  name );\r\n\r\n  typedef FT_Error\r\n  (*PS_Unicodes_InitFunc)( FT_Memory             memory,\r\n                           PS_Unicodes           unicodes,\r\n                           FT_UInt               num_glyphs,\r\n                           PS_GetGlyphNameFunc   get_glyph_name,\r\n                           PS_FreeGlyphNameFunc  free_glyph_name,\r\n                           FT_Pointer            glyph_data );\r\n\r\n  typedef FT_UInt\r\n  (*PS_Unicodes_CharIndexFunc)( PS_Unicodes  unicodes,\r\n                                FT_UInt32    unicode );\r\n\r\n  typedef FT_UInt32\r\n  (*PS_Unicodes_CharNextFunc)( PS_Unicodes  unicodes,\r\n                               FT_UInt32   *unicode );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PsCMaps )\r\n  {\r\n    PS_Unicode_ValueFunc       unicode_value;\r\n\r\n    PS_Unicodes_InitFunc       unicodes_init;\r\n    PS_Unicodes_CharIndexFunc  unicodes_char_index;\r\n    PS_Unicodes_CharNextFunc   unicodes_char_next;\r\n\r\n    PS_Macintosh_NameFunc      macintosh_name;\r\n    PS_Adobe_Std_StringsFunc   adobe_std_strings;\r\n    const unsigned short*      adobe_std_encoding;\r\n    const unsigned short*      adobe_expert_encoding;\r\n  };\r\n\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \\\r\n        unicodes_char_index_, unicodes_char_next_, macintosh_name_,          \\\r\n        adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_)     \\\r\n  static const FT_Service_PsCMapsRec class_ =                                \\\r\n  {                                                                          \\\r\n    unicode_value_, unicodes_init_,                                          \\\r\n    unicodes_char_index_, unicodes_char_next_, macintosh_name_,              \\\r\n    adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_          \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \\\r\n        unicodes_char_index_, unicodes_char_next_, macintosh_name_,          \\\r\n        adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_)     \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library,                                \\\r\n                          FT_Service_PsCMapsRec* clazz)                      \\\r\n  {                                                                          \\\r\n    FT_UNUSED(library);                                                      \\\r\n    clazz->unicode_value = unicode_value_;                                   \\\r\n    clazz->unicodes_init = unicodes_init_;                                   \\\r\n    clazz->unicodes_char_index = unicodes_char_index_;                       \\\r\n    clazz->unicodes_char_next = unicodes_char_next_;                         \\\r\n    clazz->macintosh_name = macintosh_name_;                                 \\\r\n    clazz->adobe_std_strings = adobe_std_strings_;                           \\\r\n    clazz->adobe_std_encoding = adobe_std_encoding_;                         \\\r\n    clazz->adobe_expert_encoding = adobe_expert_encoding_;                   \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPSCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svpsinfo.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svpsinfo.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType PostScript info service (specification).                */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004, 2009 by                                          */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVPSINFO_H__\r\n#define __SVPSINFO_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_INTERNAL_TYPE1_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_POSTSCRIPT_INFO  \"postscript-info\"\r\n\r\n\r\n  typedef FT_Error\r\n  (*PS_GetFontInfoFunc)( FT_Face          face,\r\n                         PS_FontInfoRec*  afont_info );\r\n\r\n  typedef FT_Error\r\n  (*PS_GetFontExtraFunc)( FT_Face           face,\r\n                          PS_FontExtraRec*  afont_extra );\r\n\r\n  typedef FT_Int\r\n  (*PS_HasGlyphNamesFunc)( FT_Face   face );\r\n\r\n  typedef FT_Error\r\n  (*PS_GetFontPrivateFunc)( FT_Face         face,\r\n                            PS_PrivateRec*  afont_private );\r\n\r\n\r\n  FT_DEFINE_SERVICE( PsInfo )\r\n  {\r\n    PS_GetFontInfoFunc     ps_get_font_info;\r\n    PS_GetFontExtraFunc    ps_get_font_extra;\r\n    PS_HasGlyphNamesFunc   ps_has_glyph_names;\r\n    PS_GetFontPrivateFunc  ps_get_font_private;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_,      \\\r\n        ps_get_font_extra_, has_glyph_names_, get_font_private_) \\\r\n  static const FT_Service_PsInfoRec class_ =                     \\\r\n  {                                                              \\\r\n    get_font_info_, ps_get_font_extra_, has_glyph_names_,        \\\r\n    get_font_private_                                            \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_,      \\\r\n        ps_get_font_extra_, has_glyph_names_, get_font_private_) \\\r\n  void                                                           \\\r\n  FT_Init_Class_##class_( FT_Library library,                    \\\r\n                          FT_Service_PsInfoRec*  clazz)          \\\r\n  {                                                              \\\r\n    FT_UNUSED(library);                                          \\\r\n    clazz->ps_get_font_info = get_font_info_;                    \\\r\n    clazz->ps_get_font_extra = ps_get_font_extra_;               \\\r\n    clazz->ps_has_glyph_names = has_glyph_names_;                \\\r\n    clazz->ps_get_font_private = get_font_private_;              \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVPSINFO_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svsfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svsfnt.h                                                               */\r\n/*                                                                         */\r\n/*    The FreeType SFNT table loading service (specification).             */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2004 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVSFNT_H__\r\n#define __SVSFNT_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  SFNT table loading service.\r\n   */\r\n\r\n#define FT_SERVICE_ID_SFNT_TABLE  \"sfnt-table\"\r\n\r\n\r\n  /*\r\n   * Used to implement FT_Load_Sfnt_Table().\r\n   */\r\n  typedef FT_Error\r\n  (*FT_SFNT_TableLoadFunc)( FT_Face    face,\r\n                            FT_ULong   tag,\r\n                            FT_Long    offset,\r\n                            FT_Byte*   buffer,\r\n                            FT_ULong*  length );\r\n\r\n  /*\r\n   * Used to implement FT_Get_Sfnt_Table().\r\n   */\r\n  typedef void*\r\n  (*FT_SFNT_TableGetFunc)( FT_Face      face,\r\n                           FT_Sfnt_Tag  tag );\r\n\r\n\r\n  /*\r\n   * Used to implement FT_Sfnt_Table_Info().\r\n   */\r\n  typedef FT_Error\r\n  (*FT_SFNT_TableInfoFunc)( FT_Face    face,\r\n                            FT_UInt    idx,\r\n                            FT_ULong  *tag,\r\n                            FT_ULong  *offset,\r\n                            FT_ULong  *length );\r\n\r\n\r\n  FT_DEFINE_SERVICE( SFNT_Table )\r\n  {\r\n    FT_SFNT_TableLoadFunc  load_table;\r\n    FT_SFNT_TableGetFunc   get_table;\r\n    FT_SFNT_TableInfoFunc  table_info;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_)  \\\r\n  static const FT_Service_SFNT_TableRec class_ =                     \\\r\n  {                                                                  \\\r\n    load_, get_, info_                                               \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \\\r\n  void                                                              \\\r\n  FT_Init_Class_##class_( FT_Service_SFNT_TableRec*  clazz )        \\\r\n  {                                                                 \\\r\n    clazz->load_table = load_;                                      \\\r\n    clazz->get_table = get_;                                        \\\r\n    clazz->table_info = info_;                                      \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVSFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svttcmap.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svttcmap.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType TrueType/sfnt cmap extra information service.           */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  Masatake YAMATO, Redhat K.K.                                           */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2008 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n/* Development of this service is support of\r\n   Information-technology Promotion Agency, Japan. */\r\n\r\n#ifndef __SVTTCMAP_H__\r\n#define __SVTTCMAP_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_TT_CMAP \"tt-cmaps\"\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_CMapInfo                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to store TrueType/sfnt specific cmap information  */\r\n  /*    which is not covered by the generic @FT_CharMap structure.  This   */\r\n  /*    structure can be accessed with the @FT_Get_TT_CMap_Info function.  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    language ::                                                        */\r\n  /*      The language ID used in Mac fonts.  Definitions of values are in */\r\n  /*      freetype/ttnameid.h.                                             */\r\n  /*                                                                       */\r\n  /*    format ::                                                          */\r\n  /*      The cmap format.  OpenType 1.5 defines the formats 0 (byte       */\r\n  /*      encoding table), 2~(high-byte mapping through table), 4~(segment */\r\n  /*      mapping to delta values), 6~(trimmed table mapping), 8~(mixed    */\r\n  /*      16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented   */\r\n  /*      coverage), and 14 (Unicode Variation Sequences).                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_CMapInfo_\r\n  {\r\n    FT_ULong language;\r\n    FT_Long  format;\r\n\r\n  } TT_CMapInfo;\r\n\r\n\r\n  typedef FT_Error\r\n  (*TT_CMap_Info_GetFunc)( FT_CharMap    charmap,\r\n                           TT_CMapInfo  *cmap_info );\r\n\r\n\r\n  FT_DEFINE_SERVICE( TTCMaps )\r\n  {\r\n    TT_CMap_Info_GetFunc  get_cmap_info;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_)  \\\r\n  static const FT_Service_TTCMapsRec class_ =                 \\\r\n  {                                                           \\\r\n    get_cmap_info_                                            \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \\\r\n  void                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library,                \\\r\n                          FT_Service_TTCMapsRec*  clazz)     \\\r\n  {                                                          \\\r\n    FT_UNUSED(library);                                      \\\r\n    clazz->get_cmap_info = get_cmap_info_;                   \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVTTCMAP_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svtteng.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svtteng.h                                                              */\r\n/*                                                                         */\r\n/*    The FreeType TrueType engine query service (specification).          */\r\n/*                                                                         */\r\n/*  Copyright 2006 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVTTENG_H__\r\n#define __SVTTENG_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_MODULE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  SFNT table loading service.\r\n   */\r\n\r\n#define FT_SERVICE_ID_TRUETYPE_ENGINE  \"truetype-engine\"\r\n\r\n  /*\r\n   * Used to implement FT_Get_TrueType_Engine_Type\r\n   */\r\n\r\n  FT_DEFINE_SERVICE( TrueTypeEngine )\r\n  {\r\n    FT_TrueTypeEngineType  engine_type;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVTTENG_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svttglyf.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svttglyf.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType TrueType glyph service.                                 */\r\n/*                                                                         */\r\n/*  Copyright 2007 by David Turner.                                        */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n#ifndef __SVTTGLYF_H__\r\n#define __SVTTGLYF_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_TRUETYPE_TABLES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_TT_GLYF \"tt-glyf\"\r\n\r\n\r\n  typedef FT_ULong\r\n  (*TT_Glyf_GetLocationFunc)( FT_Face    face,\r\n                              FT_UInt    gindex,\r\n                              FT_ULong  *psize );\r\n\r\n  FT_DEFINE_SERVICE( TTGlyf )\r\n  {\r\n    TT_Glyf_GetLocationFunc  get_location;\r\n  };\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ )   \\\r\n  static const FT_Service_TTGlyfRec class_ =                  \\\r\n  {                                                           \\\r\n    get_location_                                             \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ )   \\\r\n  void                                                        \\\r\n  FT_Init_Class_##class_( FT_Service_TTGlyfRec*  clazz )      \\\r\n  {                                                           \\\r\n    clazz->get_location = get_location_;                      \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SVTTGLYF_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svwinfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svwinfnt.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType Windows FNT/FONT service (specification).               */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVWINFNT_H__\r\n#define __SVWINFNT_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_WINFONTS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define FT_SERVICE_ID_WINFNT  \"winfonts\"\r\n\r\n  typedef FT_Error\r\n  (*FT_WinFnt_GetHeaderFunc)( FT_Face               face,\r\n                              FT_WinFNT_HeaderRec  *aheader );\r\n\r\n\r\n  FT_DEFINE_SERVICE( WinFnt )\r\n  {\r\n    FT_WinFnt_GetHeaderFunc  get_header;\r\n  };\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVWINFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/services/svxf86nm.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  svxf86nm.h                                                             */\r\n/*                                                                         */\r\n/*    The FreeType XFree86 services (specification only).                  */\r\n/*                                                                         */\r\n/*  Copyright 2003 by                                                      */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SVXF86NM_H__\r\n#define __SVXF86NM_H__\r\n\r\n#include FT_INTERNAL_SERVICE_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*\r\n   *  A trivial service used to return the name of a face's font driver,\r\n   *  according to the XFree86 nomenclature.  Note that the service data\r\n   *  is a simple constant string pointer.\r\n   */\r\n\r\n#define FT_SERVICE_ID_XF86_NAME  \"xf86-driver-name\"\r\n\r\n#define FT_XF86_FORMAT_TRUETYPE  \"TrueType\"\r\n#define FT_XF86_FORMAT_TYPE_1    \"Type 1\"\r\n#define FT_XF86_FORMAT_BDF       \"BDF\"\r\n#define FT_XF86_FORMAT_PCF       \"PCF\"\r\n#define FT_XF86_FORMAT_TYPE_42   \"Type 42\"\r\n#define FT_XF86_FORMAT_CID       \"CID Type 1\"\r\n#define FT_XF86_FORMAT_CFF       \"CFF\"\r\n#define FT_XF86_FORMAT_PFR       \"PFR\"\r\n#define FT_XF86_FORMAT_WINFNT    \"Windows FNT\"\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __SVXF86NM_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/sfnt.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  sfnt.h                                                                 */\r\n/*                                                                         */\r\n/*    High-level `sfnt' driver interface (specification).                  */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __SFNT_H__\r\n#define __SFNT_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_INTERNAL_DRIVER_H\r\n#include FT_INTERNAL_TRUETYPE_TYPES_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Init_Face_Func                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    First part of the SFNT face object initialization.  This finds     */\r\n  /*    the face in a SFNT file or collection, and load its format tag in  */\r\n  /*    face->format_tag.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the TrueType font, if we are opening a  */\r\n  /*                  collection.                                          */\r\n  /*                                                                       */\r\n  /*    num_params :: The number of additional parameters.                 */\r\n  /*                                                                       */\r\n  /*    params     :: Optional additional parameters.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the font file's origin.               */\r\n  /*                                                                       */\r\n  /*    This function recognizes fonts embedded in a `TrueType             */\r\n  /*    collection'.                                                       */\r\n  /*                                                                       */\r\n  /*    Once the format tag has been validated by the font driver, it      */\r\n  /*    should then call the TT_Load_Face_Func() callback to read the rest */\r\n  /*    of the SFNT tables in the object.                                  */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Init_Face_Func)( FT_Stream      stream,\r\n                        TT_Face        face,\r\n                        FT_Int         face_index,\r\n                        FT_Int         num_params,\r\n                        FT_Parameter*  params );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Face_Func                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Second part of the SFNT face object initialization.  This loads    */\r\n  /*    the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the    */\r\n  /*    face object.                                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the TrueType font, if we are opening a  */\r\n  /*                  collection.                                          */\r\n  /*                                                                       */\r\n  /*    num_params :: The number of additional parameters.                 */\r\n  /*                                                                       */\r\n  /*    params     :: Optional additional parameters.                      */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function must be called after TT_Init_Face_Func().            */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Face_Func)( FT_Stream      stream,\r\n                        TT_Face        face,\r\n                        FT_Int         face_index,\r\n                        FT_Int         num_params,\r\n                        FT_Parameter*  params );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Done_Face_Func                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A callback used to delete the common SFNT data from a face.        */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the target face object.                        */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function does NOT destroy the face object.                    */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*TT_Done_Face_Func)( TT_Face  face );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_SFNT_HeaderRec_Func                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the header of a SFNT font file.  Supports collections.       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face       :: A handle to the target face object.                  */\r\n  /*                                                                       */\r\n  /*    stream     :: The input stream.                                    */\r\n  /*                                                                       */\r\n  /*    face_index :: The index of the TrueType font, if we are opening a  */\r\n  /*                  collection.                                          */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    sfnt       :: The SFNT header.                                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the font file's origin.               */\r\n  /*                                                                       */\r\n  /*    This function recognizes fonts embedded in a `TrueType             */\r\n  /*    collection'.                                                       */\r\n  /*                                                                       */\r\n  /*    This function checks that the header is valid by looking at the    */\r\n  /*    values of `search_range', `entry_selector', and `range_shift'.     */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_SFNT_HeaderRec_Func)( TT_Face      face,\r\n                                  FT_Stream    stream,\r\n                                  FT_Long      face_index,\r\n                                  SFNT_Header  sfnt );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Directory_Func                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads the table directory into a face object.                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /*    sfnt   :: The SFNT header.                                         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be on the first byte after the 4-byte font  */\r\n  /*    format tag.  This is the case just after a call to                 */\r\n  /*    TT_Load_Format_Tag().                                              */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Directory_Func)( TT_Face      face,\r\n                             FT_Stream    stream,\r\n                             SFNT_Header  sfnt );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Any_Func                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load any font table into client memory.                            */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: The face object to look for.                             */\r\n  /*                                                                       */\r\n  /*    tag    :: The tag of table to load.  Use the value 0 if you want   */\r\n  /*              to access the whole font file, else set this parameter   */\r\n  /*              to a valid TrueType table tag that you can forge with    */\r\n  /*              the MAKE_TT_TAG macro.                                   */\r\n  /*                                                                       */\r\n  /*    offset :: The starting offset in the table (or the file if         */\r\n  /*              tag == 0).                                               */\r\n  /*                                                                       */\r\n  /*    length :: The address of the decision variable:                    */\r\n  /*                                                                       */\r\n  /*                If length == NULL:                                     */\r\n  /*                  Loads the whole table.  Returns an error if          */\r\n  /*                  `offset' == 0!                                       */\r\n  /*                                                                       */\r\n  /*                If *length == 0:                                       */\r\n  /*                  Exits immediately; returning the length of the given */\r\n  /*                  table or of the font file, depending on the value of */\r\n  /*                  `tag'.                                               */\r\n  /*                                                                       */\r\n  /*                If *length != 0:                                       */\r\n  /*                  Loads the next `length' bytes of table or font,      */\r\n  /*                  starting at offset `offset' (in table or font too).  */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    buffer :: The address of target buffer.                            */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    TrueType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Any_Func)( TT_Face    face,\r\n                       FT_ULong   tag,\r\n                       FT_Long    offset,\r\n                       FT_Byte   *buffer,\r\n                       FT_ULong*  length );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Find_SBit_Image_Func                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Check whether an embedded bitmap (an `sbit') exists for a given    */\r\n  /*    glyph, at a given strike.                                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    glyph_index   :: The glyph index.                                  */\r\n  /*                                                                       */\r\n  /*    strike_index  :: The current strike index.                         */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    arange        :: The SBit range containing the glyph index.        */\r\n  /*                                                                       */\r\n  /*    astrike       :: The SBit strike containing the glyph index.       */\r\n  /*                                                                       */\r\n  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns                    */\r\n  /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */\r\n  /*    glyph.                                                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Find_SBit_Image_Func)( TT_Face          face,\r\n                              FT_UInt          glyph_index,\r\n                              FT_ULong         strike_index,\r\n                              TT_SBit_Range   *arange,\r\n                              TT_SBit_Strike  *astrike,\r\n                              FT_ULong        *aglyph_offset );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_SBit_Metrics_Func                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the big metrics for a given embedded bitmap.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    stream      :: The input stream.                                   */\r\n  /*                                                                       */\r\n  /*    range       :: The SBit range containing the glyph.                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    big_metrics :: A big SBit metrics structure for the glyph.         */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be positioned at the glyph's offset within  */\r\n  /*    the `EBDT' table before the call.                                  */\r\n  /*                                                                       */\r\n  /*    If the image format uses variable metrics, the stream cursor is    */\r\n  /*    positioned just after the metrics header in the `EBDT' table on    */\r\n  /*    function exit.                                                     */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_SBit_Metrics_Func)( FT_Stream        stream,\r\n                                TT_SBit_Range    range,\r\n                                TT_SBit_Metrics  metrics );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_SBit_Image_Func                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load a given glyph sbit image from the font resource.  This also   */\r\n  /*    returns its metrics.                                               */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face ::                                                            */\r\n  /*      The target face object.                                          */\r\n  /*                                                                       */\r\n  /*    strike_index ::                                                    */\r\n  /*      The strike index.                                                */\r\n  /*                                                                       */\r\n  /*    glyph_index ::                                                     */\r\n  /*      The current glyph index.                                         */\r\n  /*                                                                       */\r\n  /*    load_flags ::                                                      */\r\n  /*      The current load flags.                                          */\r\n  /*                                                                       */\r\n  /*    stream ::                                                          */\r\n  /*      The input stream.                                                */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    amap ::                                                            */\r\n  /*      The target pixmap.                                               */\r\n  /*                                                                       */\r\n  /*    ametrics ::                                                        */\r\n  /*      A big sbit metrics structure for the glyph image.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    glyph sbit exists for the index.                                   */\r\n  /*                                                                       */\r\n  /*  <Note>                                                               */\r\n  /*    The `map.buffer' field is always freed before the glyph is loaded. */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_SBit_Image_Func)( TT_Face              face,\r\n                              FT_ULong             strike_index,\r\n                              FT_UInt              glyph_index,\r\n                              FT_UInt              load_flags,\r\n                              FT_Stream            stream,\r\n                              FT_Bitmap           *amap,\r\n                              TT_SBit_MetricsRec  *ametrics );\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Set_SBit_Strike_OldFunc                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select an sbit strike for a given size request.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    req           :: The size request.                                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    astrike_index :: The index of the sbit strike.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    sbit strike exists for the selected ppem values.                   */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Set_SBit_Strike_OldFunc)( TT_Face    face,\r\n                                 FT_UInt    x_ppem,\r\n                                 FT_UInt    y_ppem,\r\n                                 FT_ULong*  astrike_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_CharMap_Load_Func                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Loads a given TrueType character map into memory.                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the parent face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: A handle to the current stream object.                   */\r\n  /*                                                                       */\r\n  /* <InOut>                                                               */\r\n  /*    cmap   :: A pointer to a cmap object.                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The function assumes that the stream is already in use (i.e.,      */\r\n  /*    opened).  In case of error, all partially allocated tables are     */\r\n  /*    released.                                                          */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_CharMap_Load_Func)( TT_Face    face,\r\n                           void*      cmap,\r\n                           FT_Stream  input );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_CharMap_Free_Func                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Destroys a character mapping table.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the parent face object.                        */\r\n  /*                                                                       */\r\n  /*    cmap :: A handle to a cmap object.                                 */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_CharMap_Free_Func)( TT_Face       face,\r\n                           void*         cmap );\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Set_SBit_Strike_Func                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Select an sbit strike for a given size request.                    */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    req           :: The size request.                                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    astrike_index :: The index of the sbit strike.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    sbit strike exists for the selected ppem values.                   */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Set_SBit_Strike_Func)( TT_Face          face,\r\n                              FT_Size_Request  req,\r\n                              FT_ULong*        astrike_index );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Strike_Metrics_Func                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the metrics of a given strike.                                */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face          :: The target face object.                           */\r\n  /*                                                                       */\r\n  /*    strike_index  :: The strike index.                                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    metrics       :: the metrics of the strike.                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.  Returns an error if no     */\r\n  /*    such sbit strike exists.                                           */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Strike_Metrics_Func)( TT_Face           face,\r\n                                  FT_ULong          strike_index,\r\n                                  FT_Size_Metrics*  metrics );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Get_PS_Name_Func                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Get the PostScript glyph name of a glyph.                          */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    idx  :: The glyph index.                                           */\r\n  /*                                                                       */\r\n  /*    PSname :: The address of a string pointer.  Will be NULL in case   */\r\n  /*              of error, otherwise it is a pointer to the glyph name.   */\r\n  /*                                                                       */\r\n  /*              You must not modify the returned string!                 */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Get_PS_Name_Func)( TT_Face      face,\r\n                          FT_UInt      idx,\r\n                          FT_String**  PSname );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Metrics_Func                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load a metrics table, which is a table with a horizontal and a     */\r\n  /*    vertical version.                                                  */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the target face object.                    */\r\n  /*                                                                       */\r\n  /*    stream   :: The input stream.                                      */\r\n  /*                                                                       */\r\n  /*    vertical :: A boolean flag.  If set, load the vertical one.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Metrics_Func)( TT_Face    face,\r\n                           FT_Stream  stream,\r\n                           FT_Bool    vertical );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Get_Metrics_Func                                                */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load the horizontal or vertical header in a face object.           */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face     :: A handle to the target face object.                    */\r\n  /*                                                                       */\r\n  /*    stream   :: The input stream.                                      */\r\n  /*                                                                       */\r\n  /*    vertical :: A boolean flag.  If set, load vertical metrics.        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Get_Metrics_Func)( TT_Face     face,\r\n                          FT_Bool     vertical,\r\n                          FT_UInt     gindex,\r\n                          FT_Short*   abearing,\r\n                          FT_UShort*  aadvance );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Load_Table_Func                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Load a given TrueType table.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The function uses `face->goto_table' to seek the stream to the     */\r\n  /*    start of the table, except while loading the font directory.       */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Load_Table_Func)( TT_Face    face,\r\n                         FT_Stream  stream );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Free_Table_Func                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Free a given TrueType table.                                       */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the target face object.                        */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*TT_Free_Table_Func)( TT_Face  face );\r\n\r\n\r\n  /*\r\n   * @functype:\r\n   *    TT_Face_GetKerningFunc\r\n   *\r\n   * @description:\r\n   *    Return the horizontal kerning value between two glyphs.\r\n   *\r\n   * @input:\r\n   *    face        :: A handle to the source face object.\r\n   *    left_glyph  :: The left glyph index.\r\n   *    right_glyph :: The right glyph index.\r\n   *\r\n   * @return:\r\n   *    The kerning value in font units.\r\n   */\r\n  typedef FT_Int\r\n  (*TT_Face_GetKerningFunc)( TT_Face  face,\r\n                             FT_UInt  left_glyph,\r\n                             FT_UInt  right_glyph );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    SFNT_Interface                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure holds pointers to the functions used to load and    */\r\n  /*    free the basic tables that are required in a `sfnt' font file.     */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Check the various xxx_Func() descriptions for details.             */\r\n  /*                                                                       */\r\n  typedef struct  SFNT_Interface_\r\n  {\r\n    TT_Loader_GotoTableFunc      goto_table;\r\n\r\n    TT_Init_Face_Func            init_face;\r\n    TT_Load_Face_Func            load_face;\r\n    TT_Done_Face_Func            done_face;\r\n    FT_Module_Requester          get_interface;\r\n\r\n    TT_Load_Any_Func             load_any;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_Load_SFNT_HeaderRec_Func  load_sfnt_header;\r\n    TT_Load_Directory_Func       load_directory;\r\n#endif\r\n\r\n    /* these functions are called by `load_face' but they can also  */\r\n    /* be called from external modules, if there is a need to do so */\r\n    TT_Load_Table_Func           load_head;\r\n    TT_Load_Metrics_Func         load_hhea;\r\n    TT_Load_Table_Func           load_cmap;\r\n    TT_Load_Table_Func           load_maxp;\r\n    TT_Load_Table_Func           load_os2;\r\n    TT_Load_Table_Func           load_post;\r\n\r\n    TT_Load_Table_Func           load_name;\r\n    TT_Free_Table_Func           free_name;\r\n\r\n    /* optional tables */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_Load_Table_Func           load_hdmx_stub;\r\n    TT_Free_Table_Func           free_hdmx_stub;\r\n#endif\r\n\r\n    /* this field was called `load_kerning' up to version 2.1.10 */\r\n    TT_Load_Table_Func           load_kern;\r\n\r\n    TT_Load_Table_Func           load_gasp;\r\n    TT_Load_Table_Func           load_pclt;\r\n\r\n    /* see `ttload.h'; this field was called `load_bitmap_header' up to */\r\n    /* version 2.1.10                                                   */\r\n    TT_Load_Table_Func           load_bhed;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n    /* see `ttsbit.h' */\r\n    TT_Set_SBit_Strike_OldFunc   set_sbit_strike_stub;\r\n    TT_Load_Table_Func           load_sbits_stub;\r\n\r\n    /*\r\n     *  The following two fields appeared in version 2.1.8, and were placed\r\n     *  between `load_sbits' and `load_sbit_image'.  We support them as a\r\n     *  special exception since they are used by Xfont library within the\r\n     *  X.Org xserver, and because the probability that other rogue clients\r\n     *  use the other version 2.1.7 fields below is _extremely_ low.\r\n     *\r\n     *  Note that this forces us to disable an interesting memory-saving\r\n     *  optimization though...\r\n     */\r\n\r\n    TT_Find_SBit_Image_Func      find_sbit_image;\r\n    TT_Load_SBit_Metrics_Func    load_sbit_metrics;\r\n\r\n#endif\r\n\r\n    TT_Load_SBit_Image_Func      load_sbit_image;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_Free_Table_Func           free_sbits_stub;\r\n#endif\r\n\r\n    /* see `ttpost.h' */\r\n    TT_Get_PS_Name_Func          get_psname;\r\n    TT_Free_Table_Func           free_psnames;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_CharMap_Load_Func         load_charmap_stub;\r\n    TT_CharMap_Free_Func         free_charmap_stub;\r\n#endif\r\n\r\n    /* starting here, the structure differs from version 2.1.7 */\r\n\r\n    /* this field was introduced in version 2.1.8, named `get_psname' */\r\n    TT_Face_GetKerningFunc       get_kerning;\r\n\r\n    /* new elements introduced after version 2.1.10 */\r\n\r\n    /* load the font directory, i.e., the offset table and */\r\n    /* the table directory                                 */\r\n    TT_Load_Table_Func           load_font_dir;\r\n    TT_Load_Metrics_Func         load_hmtx;\r\n\r\n    TT_Load_Table_Func           load_eblc;\r\n    TT_Free_Table_Func           free_eblc;\r\n\r\n    TT_Set_SBit_Strike_Func      set_sbit_strike;\r\n    TT_Load_Strike_Metrics_Func  load_strike_metrics;\r\n\r\n    TT_Get_Metrics_Func          get_metrics;\r\n\r\n  } SFNT_Interface;\r\n\r\n\r\n  /* transitional */\r\n  typedef SFNT_Interface*   SFNT_Service;\r\n\r\n#ifndef FT_CONFIG_OPTION_PIC\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \\\r\n  a, \r\n#else\r\n  #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a)\r\n#endif\r\n#define FT_INTERNAL(a) \\\r\n  a, \r\n\r\n#define FT_DEFINE_SFNT_INTERFACE(class_,                                     \\\r\n    goto_table_, init_face_, load_face_, done_face_, get_interface_,         \\\r\n    load_any_, load_sfnt_header_, load_directory_, load_head_,               \\\r\n    load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_,               \\\r\n    load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_,                \\\r\n    load_kern_, load_gasp_, load_pclt_, load_bhed_,                          \\\r\n    set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_,               \\\r\n    load_sbit_metrics_, load_sbit_image_, free_sbits_stub_,                  \\\r\n    get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_,      \\\r\n    get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_,        \\\r\n    set_sbit_strike_, load_strike_metrics_, get_metrics_ )                   \\\r\n  static const SFNT_Interface class_ =                                       \\\r\n  {                                                                          \\\r\n    FT_INTERNAL(goto_table_) \\\r\n    FT_INTERNAL(init_face_) \\\r\n    FT_INTERNAL(load_face_) \\\r\n    FT_INTERNAL(done_face_) \\\r\n    FT_INTERNAL(get_interface_) \\\r\n    FT_INTERNAL(load_any_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \\\r\n    FT_INTERNAL(load_head_) \\\r\n    FT_INTERNAL(load_hhea_) \\\r\n    FT_INTERNAL(load_cmap_) \\\r\n    FT_INTERNAL(load_maxp_) \\\r\n    FT_INTERNAL(load_os2_) \\\r\n    FT_INTERNAL(load_post_) \\\r\n    FT_INTERNAL(load_name_) \\\r\n    FT_INTERNAL(free_name_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \\\r\n    FT_INTERNAL(load_kern_) \\\r\n    FT_INTERNAL(load_gasp_) \\\r\n    FT_INTERNAL(load_pclt_) \\\r\n    FT_INTERNAL(load_bhed_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \\\r\n    FT_INTERNAL(load_sbit_image_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \\\r\n    FT_INTERNAL(get_psname_) \\\r\n    FT_INTERNAL(free_psnames_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \\\r\n    FT_INTERNAL(get_kerning_) \\\r\n    FT_INTERNAL(load_font_dir_) \\\r\n    FT_INTERNAL(load_hmtx_) \\\r\n    FT_INTERNAL(load_eblc_) \\\r\n    FT_INTERNAL(free_eblc_) \\\r\n    FT_INTERNAL(set_sbit_strike_) \\\r\n    FT_INTERNAL(load_strike_metrics_) \\\r\n    FT_INTERNAL(get_metrics_) \\\r\n  };\r\n\r\n#else /* FT_CONFIG_OPTION_PIC */ \r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \\\r\n  clazz->a = a_;\r\n#else\r\n  #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_)\r\n#endif\r\n#define FT_INTERNAL(a, a_) \\\r\n  clazz->a = a_;\r\n\r\n#define FT_DEFINE_SFNT_INTERFACE(class_,                                     \\\r\n    goto_table_, init_face_, load_face_, done_face_, get_interface_,         \\\r\n    load_any_, load_sfnt_header_, load_directory_, load_head_,               \\\r\n    load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_,               \\\r\n    load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_,                \\\r\n    load_kern_, load_gasp_, load_pclt_, load_bhed_,                          \\\r\n    set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_,               \\\r\n    load_sbit_metrics_, load_sbit_image_, free_sbits_stub_,                  \\\r\n    get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_,      \\\r\n    get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_,        \\\r\n    set_sbit_strike_, load_strike_metrics_, get_metrics_ )                   \\\r\n  void                                                                       \\\r\n  FT_Init_Class_##class_( FT_Library library, SFNT_Interface*  clazz )       \\\r\n  {                                                                          \\\r\n    FT_UNUSED(library);                                                      \\\r\n    FT_INTERNAL(goto_table,goto_table_) \\\r\n    FT_INTERNAL(init_face,init_face_) \\\r\n    FT_INTERNAL(load_face,load_face_) \\\r\n    FT_INTERNAL(done_face,done_face_) \\\r\n    FT_INTERNAL(get_interface,get_interface_) \\\r\n    FT_INTERNAL(load_any,load_any_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \\\r\n    FT_INTERNAL(load_head,load_head_) \\\r\n    FT_INTERNAL(load_hhea,load_hhea_) \\\r\n    FT_INTERNAL(load_cmap,load_cmap_) \\\r\n    FT_INTERNAL(load_maxp,load_maxp_) \\\r\n    FT_INTERNAL(load_os2,load_os2_) \\\r\n    FT_INTERNAL(load_post,load_post_) \\\r\n    FT_INTERNAL(load_name,load_name_) \\\r\n    FT_INTERNAL(free_name,free_name_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \\\r\n    FT_INTERNAL(load_kern,load_kern_) \\\r\n    FT_INTERNAL(load_gasp,load_gasp_) \\\r\n    FT_INTERNAL(load_pclt,load_pclt_) \\\r\n    FT_INTERNAL(load_bhed,load_bhed_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \\\r\n    FT_INTERNAL(load_sbit_image,load_sbit_image_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \\\r\n    FT_INTERNAL(get_psname,get_psname_) \\\r\n    FT_INTERNAL(free_psnames,free_psnames_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \\\r\n    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \\\r\n    FT_INTERNAL(get_kerning,get_kerning_) \\\r\n    FT_INTERNAL(load_font_dir,load_font_dir_) \\\r\n    FT_INTERNAL(load_hmtx,load_hmtx_) \\\r\n    FT_INTERNAL(load_eblc,load_eblc_) \\\r\n    FT_INTERNAL(free_eblc,free_eblc_) \\\r\n    FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \\\r\n    FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \\\r\n    FT_INTERNAL(get_metrics,get_metrics_) \\\r\n  } \r\n\r\n#endif /* FT_CONFIG_OPTION_PIC */ \r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __SFNT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/t1types.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1types.h                                                              */\r\n/*                                                                         */\r\n/*    Basic Type1/Type2 type definitions and interface (specification      */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1TYPES_H__\r\n#define __T1TYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TYPE1_TABLES_H\r\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\r\n#include FT_INTERNAL_SERVICE_H\r\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***              REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS              ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_EncodingRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling a custom encoding.                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_chars  :: The number of character codes in the encoding.       */\r\n  /*                  Usually 256.                                         */\r\n  /*                                                                       */\r\n  /*    code_first :: The lowest valid character code in the encoding.     */\r\n  /*                                                                       */\r\n  /*    code_last  :: The highest valid character code in the encoding     */\r\n  /*                  + 1. When equal to code_first there are no valid     */\r\n  /*                  character codes.                                     */\r\n  /*                                                                       */\r\n  /*    char_index :: An array of corresponding glyph indices.             */\r\n  /*                                                                       */\r\n  /*    char_name  :: An array of corresponding glyph names.               */\r\n  /*                                                                       */\r\n  typedef struct  T1_EncodingRecRec_\r\n  {\r\n    FT_Int       num_chars;\r\n    FT_Int       code_first;\r\n    FT_Int       code_last;\r\n\r\n    FT_UShort*   char_index;\r\n    FT_String**  char_name;\r\n\r\n  } T1_EncodingRec, *T1_Encoding;\r\n\r\n\r\n  typedef enum  T1_EncodingType_\r\n  {\r\n    T1_ENCODING_TYPE_NONE = 0,\r\n    T1_ENCODING_TYPE_ARRAY,\r\n    T1_ENCODING_TYPE_STANDARD,\r\n    T1_ENCODING_TYPE_ISOLATIN1,\r\n    T1_ENCODING_TYPE_EXPERT\r\n\r\n  } T1_EncodingType;\r\n\r\n\r\n  /* used to hold extra data of PS_FontInfoRec that\r\n   * cannot be stored in the publicly defined structure.\r\n   *\r\n   * Note these can't be blended with multiple-masters.\r\n   */\r\n  typedef struct  PS_FontExtraRec_\r\n  {\r\n    FT_UShort  fs_type;\r\n\r\n  } PS_FontExtraRec;\r\n\r\n\r\n  typedef struct  T1_FontRec_\r\n  {\r\n    PS_FontInfoRec   font_info;         /* font info dictionary   */\r\n    PS_FontExtraRec  font_extra;        /* font info extra fields */\r\n    PS_PrivateRec    private_dict;      /* private dictionary     */\r\n    FT_String*       font_name;         /* top-level dictionary   */\r\n\r\n    T1_EncodingType  encoding_type;\r\n    T1_EncodingRec   encoding;\r\n\r\n    FT_Byte*         subrs_block;\r\n    FT_Byte*         charstrings_block;\r\n    FT_Byte*         glyph_names_block;\r\n\r\n    FT_Int           num_subrs;\r\n    FT_Byte**        subrs;\r\n    FT_PtrDist*      subrs_len;\r\n\r\n    FT_Int           num_glyphs;\r\n    FT_String**      glyph_names;       /* array of glyph names       */\r\n    FT_Byte**        charstrings;       /* array of glyph charstrings */\r\n    FT_PtrDist*      charstrings_len;\r\n\r\n    FT_Byte          paint_type;\r\n    FT_Byte          font_type;\r\n    FT_Matrix        font_matrix;\r\n    FT_Vector        font_offset;\r\n    FT_BBox          font_bbox;\r\n    FT_Long          font_id;\r\n\r\n    FT_Fixed         stroke_width;\r\n\r\n  } T1_FontRec, *T1_Font;\r\n\r\n\r\n  typedef struct  CID_SubrsRec_\r\n  {\r\n    FT_UInt    num_subrs;\r\n    FT_Byte**  code;\r\n\r\n  } CID_SubrsRec, *CID_Subrs;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                AFM FONT INFORMATION STRUCTURES                    ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  typedef struct  AFM_TrackKernRec_\r\n  {\r\n    FT_Int    degree;\r\n    FT_Fixed  min_ptsize;\r\n    FT_Fixed  min_kern;\r\n    FT_Fixed  max_ptsize;\r\n    FT_Fixed  max_kern;\r\n\r\n  } AFM_TrackKernRec, *AFM_TrackKern;\r\n\r\n  typedef struct  AFM_KernPairRec_\r\n  {\r\n    FT_Int  index1;\r\n    FT_Int  index2;\r\n    FT_Int  x;\r\n    FT_Int  y;\r\n\r\n  } AFM_KernPairRec, *AFM_KernPair;\r\n\r\n  typedef struct  AFM_FontInfoRec_\r\n  {\r\n    FT_Bool        IsCIDFont;\r\n    FT_BBox        FontBBox;\r\n    FT_Fixed       Ascender;\r\n    FT_Fixed       Descender;\r\n    AFM_TrackKern  TrackKerns;   /* free if non-NULL */\r\n    FT_Int         NumTrackKern;\r\n    AFM_KernPair   KernPairs;    /* free if non-NULL */\r\n    FT_Int         NumKernPair;\r\n\r\n  } AFM_FontInfoRec, *AFM_FontInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                ORIGINAL T1_FACE CLASS DEFINITION                  ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  typedef struct T1_FaceRec_*   T1_Face;\r\n  typedef struct CID_FaceRec_*  CID_Face;\r\n\r\n\r\n  typedef struct  T1_FaceRec_\r\n  {\r\n    FT_FaceRec      root;\r\n    T1_FontRec      type1;\r\n    const void*     psnames;\r\n    const void*     psaux;\r\n    const void*     afm_data;\r\n    FT_CharMapRec   charmaprecs[2];\r\n    FT_CharMap      charmaps[2];\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    PS_Unicodes     unicode_map;\r\n#endif\r\n\r\n    /* support for Multiple Masters fonts */\r\n    PS_Blend        blend;\r\n\r\n    /* undocumented, optional: indices of subroutines that express      */\r\n    /* the NormalizeDesignVector and the ConvertDesignVector procedure, */\r\n    /* respectively, as Type 2 charstrings; -1 if keywords not present  */\r\n    FT_Int           ndv_idx;\r\n    FT_Int           cdv_idx;\r\n\r\n    /* undocumented, optional: has the same meaning as len_buildchar */\r\n    /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25    */\r\n    FT_UInt          len_buildchar;\r\n    FT_Long*         buildchar;\r\n\r\n    /* since version 2.1 - interface to PostScript hinter */\r\n    const void*     pshinter;\r\n\r\n  } T1_FaceRec;\r\n\r\n\r\n  typedef struct  CID_FaceRec_\r\n  {\r\n    FT_FaceRec       root;\r\n    void*            psnames;\r\n    void*            psaux;\r\n    CID_FaceInfoRec  cid;\r\n    PS_FontExtraRec  font_extra;\r\n#if 0\r\n    void*            afm_data;\r\n#endif\r\n    CID_Subrs        subrs;\r\n\r\n    /* since version 2.1 - interface to PostScript hinter */\r\n    void*            pshinter;\r\n\r\n    /* since version 2.1.8, but was originally positioned after `afm_data' */\r\n    FT_Byte*         binary_data; /* used if hex data has been converted */\r\n    FT_Stream        cid_stream;\r\n\r\n  } CID_FaceRec;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1TYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/internal/tttypes.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tttypes.h                                                              */\r\n/*                                                                         */\r\n/*    Basic SFNT/TrueType type definitions and interface (specification    */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTTYPES_H__\r\n#define __TTTYPES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_TRUETYPE_TABLES_H\r\n#include FT_INTERNAL_OBJECTS_H\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n#include FT_MULTIPLE_MASTERS_H\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***             REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TTC_HeaderRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    TrueType collection header.  This table contains the offsets of    */\r\n  /*    the font headers of each distinct TrueType face in the file.       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    tag     :: Must be `ttc ' to indicate a TrueType collection.       */\r\n  /*                                                                       */\r\n  /*    version :: The version number.                                     */\r\n  /*                                                                       */\r\n  /*    count   :: The number of faces in the collection.  The             */\r\n  /*               specification says this should be an unsigned long, but */\r\n  /*               we use a signed long since we need the value -1 for     */\r\n  /*               specific purposes.                                      */\r\n  /*                                                                       */\r\n  /*    offsets :: The offsets of the font headers, one per face.          */\r\n  /*                                                                       */\r\n  typedef struct  TTC_HeaderRec_\r\n  {\r\n    FT_ULong   tag;\r\n    FT_Fixed   version;\r\n    FT_Long    count;\r\n    FT_ULong*  offsets;\r\n\r\n  } TTC_HeaderRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    SFNT_HeaderRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    SFNT file format header.                                           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    format_tag     :: The font format tag.                             */\r\n  /*                                                                       */\r\n  /*    num_tables     :: The number of tables in file.                    */\r\n  /*                                                                       */\r\n  /*    search_range   :: Must be `16 * (max power of 2 <= num_tables)'.   */\r\n  /*                                                                       */\r\n  /*    entry_selector :: Must be log2 of `search_range / 16'.             */\r\n  /*                                                                       */\r\n  /*    range_shift    :: Must be `num_tables * 16 - search_range'.        */\r\n  /*                                                                       */\r\n  typedef struct  SFNT_HeaderRec_\r\n  {\r\n    FT_ULong   format_tag;\r\n    FT_UShort  num_tables;\r\n    FT_UShort  search_range;\r\n    FT_UShort  entry_selector;\r\n    FT_UShort  range_shift;\r\n\r\n    FT_ULong   offset;  /* not in file */\r\n\r\n  } SFNT_HeaderRec, *SFNT_Header;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_TableRec                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This structure describes a given table of a TrueType font.         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Tag      :: A four-bytes tag describing the table.                 */\r\n  /*                                                                       */\r\n  /*    CheckSum :: The table checksum.  This value can be ignored.        */\r\n  /*                                                                       */\r\n  /*    Offset   :: The offset of the table from the start of the TrueType */\r\n  /*                font in its resource.                                  */\r\n  /*                                                                       */\r\n  /*    Length   :: The table length (in bytes).                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_TableRec_\r\n  {\r\n    FT_ULong  Tag;        /*        table type */\r\n    FT_ULong  CheckSum;   /*    table checksum */\r\n    FT_ULong  Offset;     /* table file offset */\r\n    FT_ULong  Length;     /*      table length */\r\n\r\n  } TT_TableRec, *TT_Table;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_LongMetricsRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling the long metrics of the `hmtx' and `vmtx'     */\r\n  /*    TrueType tables.  The values are expressed in font units.          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    advance :: The advance width or height for the glyph.              */\r\n  /*                                                                       */\r\n  /*    bearing :: The left-side or top-side bearing for the glyph.        */\r\n  /*                                                                       */\r\n  typedef struct  TT_LongMetricsRec_\r\n  {\r\n    FT_UShort  advance;\r\n    FT_Short   bearing;\r\n\r\n  } TT_LongMetricsRec, *TT_LongMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_ShortMetrics                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple type to model the short metrics of the `hmtx' and `vmtx'  */\r\n  /*    tables.                                                            */\r\n  /*                                                                       */\r\n  typedef FT_Short  TT_ShortMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_NameEntryRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling TrueType name records.  Name records are used */\r\n  /*    to store important strings like family name, style name,           */\r\n  /*    copyright, etc. in _localized_ versions (i.e., language, encoding, */\r\n  /*    etc).                                                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    platformID   :: The ID of the name's encoding platform.            */\r\n  /*                                                                       */\r\n  /*    encodingID   :: The platform-specific ID for the name's encoding.  */\r\n  /*                                                                       */\r\n  /*    languageID   :: The platform-specific ID for the name's language.  */\r\n  /*                                                                       */\r\n  /*    nameID       :: The ID specifying what kind of name this is.       */\r\n  /*                                                                       */\r\n  /*    stringLength :: The length of the string in bytes.                 */\r\n  /*                                                                       */\r\n  /*    stringOffset :: The offset to the string in the `name' table.      */\r\n  /*                                                                       */\r\n  /*    string       :: A pointer to the string's bytes.  Note that these  */\r\n  /*                    are usually UTF-16 encoded characters.             */\r\n  /*                                                                       */\r\n  typedef struct  TT_NameEntryRec_\r\n  {\r\n    FT_UShort  platformID;\r\n    FT_UShort  encodingID;\r\n    FT_UShort  languageID;\r\n    FT_UShort  nameID;\r\n    FT_UShort  stringLength;\r\n    FT_ULong   stringOffset;\r\n\r\n    /* this last field is not defined in the spec */\r\n    /* but used by the FreeType engine            */\r\n\r\n    FT_Byte*   string;\r\n\r\n  } TT_NameEntryRec, *TT_NameEntry;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_NameTableRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling the TrueType name table.                      */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    format         :: The format of the name table.                    */\r\n  /*                                                                       */\r\n  /*    numNameRecords :: The number of names in table.                    */\r\n  /*                                                                       */\r\n  /*    storageOffset  :: The offset of the name table in the `name'       */\r\n  /*                      TrueType table.                                  */\r\n  /*                                                                       */\r\n  /*    names          :: An array of name records.                        */\r\n  /*                                                                       */\r\n  /*    stream         :: the file's input stream.                         */\r\n  /*                                                                       */\r\n  typedef struct  TT_NameTableRec_\r\n  {\r\n    FT_UShort         format;\r\n    FT_UInt           numNameRecords;\r\n    FT_UInt           storageOffset;\r\n    TT_NameEntryRec*  names;\r\n    FT_Stream         stream;\r\n\r\n  } TT_NameTableRec, *TT_NameTable;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***             OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_GaspRangeRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A tiny structure used to model a gasp range according to the       */\r\n  /*    TrueType specification.                                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    maxPPEM  :: The maximum ppem value to which `gaspFlag' applies.    */\r\n  /*                                                                       */\r\n  /*    gaspFlag :: A flag describing the grid-fitting and anti-aliasing   */\r\n  /*                modes to be used.                                      */\r\n  /*                                                                       */\r\n  typedef struct  TT_GaspRangeRec_\r\n  {\r\n    FT_UShort  maxPPEM;\r\n    FT_UShort  gaspFlag;\r\n\r\n  } TT_GaspRangeRec, *TT_GaspRange;\r\n\r\n\r\n#define TT_GASP_GRIDFIT  0x01\r\n#define TT_GASP_DOGRAY   0x02\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_GaspRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure modeling the TrueType `gasp' table used to specify     */\r\n  /*    grid-fitting and anti-aliasing behaviour.                          */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    version    :: The version number.                                  */\r\n  /*                                                                       */\r\n  /*    numRanges  :: The number of gasp ranges in table.                  */\r\n  /*                                                                       */\r\n  /*    gaspRanges :: An array of gasp ranges.                             */\r\n  /*                                                                       */\r\n  typedef struct  TT_Gasp_\r\n  {\r\n    FT_UShort     version;\r\n    FT_UShort     numRanges;\r\n    TT_GaspRange  gaspRanges;\r\n\r\n  } TT_GaspRec;\r\n\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_HdmxEntryRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A small structure used to model the pre-computed widths of a given */\r\n  /*    size.  They are found in the `hdmx' table.                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    ppem      :: The pixels per EM value at which these metrics apply. */\r\n  /*                                                                       */\r\n  /*    max_width :: The maximum advance width for this metric.            */\r\n  /*                                                                       */\r\n  /*    widths    :: An array of widths.  Note: These are 8-bit bytes.     */\r\n  /*                                                                       */\r\n  typedef struct  TT_HdmxEntryRec_\r\n  {\r\n    FT_Byte   ppem;\r\n    FT_Byte   max_width;\r\n    FT_Byte*  widths;\r\n\r\n  } TT_HdmxEntryRec, *TT_HdmxEntry;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_HdmxRec                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model the `hdmx' table, which contains         */\r\n  /*    pre-computed widths for a set of given sizes/dimensions.           */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    version     :: The version number.                                 */\r\n  /*                                                                       */\r\n  /*    num_records :: The number of hdmx records.                         */\r\n  /*                                                                       */\r\n  /*    records     :: An array of hdmx records.                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_HdmxRec_\r\n  {\r\n    FT_UShort     version;\r\n    FT_Short      num_records;\r\n    TT_HdmxEntry  records;\r\n\r\n  } TT_HdmxRec, *TT_Hdmx;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Kern0_PairRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a kerning pair for the kerning table     */\r\n  /*    format 0.  The engine now loads this table if it finds one in the  */\r\n  /*    font file.                                                         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    left  :: The index of the left glyph in pair.                      */\r\n  /*                                                                       */\r\n  /*    right :: The index of the right glyph in pair.                     */\r\n  /*                                                                       */\r\n  /*    value :: The kerning distance.  A positive value spaces the        */\r\n  /*             glyphs, a negative one makes them closer.                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_Kern0_PairRec_\r\n  {\r\n    FT_UShort  left;   /* index of left  glyph in pair */\r\n    FT_UShort  right;  /* index of right glyph in pair */\r\n    FT_FWord   value;  /* kerning value                */\r\n\r\n  } TT_Kern0_PairRec, *TT_Kern0_Pair;\r\n\r\n#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                    EMBEDDED BITMAPS SUPPORT                       ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_MetricsRec                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold the big metrics of a given glyph bitmap   */\r\n  /*    in a TrueType or OpenType font.  These are usually found in the    */\r\n  /*    `EBDT' (Microsoft) or `bloc' (Apple) table.                        */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    height       :: The glyph height in pixels.                        */\r\n  /*                                                                       */\r\n  /*    width        :: The glyph width in pixels.                         */\r\n  /*                                                                       */\r\n  /*    horiBearingX :: The horizontal left bearing.                       */\r\n  /*                                                                       */\r\n  /*    horiBearingY :: The horizontal top bearing.                        */\r\n  /*                                                                       */\r\n  /*    horiAdvance  :: The horizontal advance.                            */\r\n  /*                                                                       */\r\n  /*    vertBearingX :: The vertical left bearing.                         */\r\n  /*                                                                       */\r\n  /*    vertBearingY :: The vertical top bearing.                          */\r\n  /*                                                                       */\r\n  /*    vertAdvance  :: The vertical advance.                              */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_MetricsRec_\r\n  {\r\n    FT_Byte  height;\r\n    FT_Byte  width;\r\n\r\n    FT_Char  horiBearingX;\r\n    FT_Char  horiBearingY;\r\n    FT_Byte  horiAdvance;\r\n\r\n    FT_Char  vertBearingX;\r\n    FT_Char  vertBearingY;\r\n    FT_Byte  vertAdvance;\r\n\r\n  } TT_SBit_MetricsRec, *TT_SBit_Metrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_SmallMetricsRec                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to hold the small metrics of a given glyph bitmap */\r\n  /*    in a TrueType or OpenType font.  These are usually found in the    */\r\n  /*    `EBDT' (Microsoft) or the `bdat' (Apple) table.                    */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    height   :: The glyph height in pixels.                            */\r\n  /*                                                                       */\r\n  /*    width    :: The glyph width in pixels.                             */\r\n  /*                                                                       */\r\n  /*    bearingX :: The left-side bearing.                                 */\r\n  /*                                                                       */\r\n  /*    bearingY :: The top-side bearing.                                  */\r\n  /*                                                                       */\r\n  /*    advance  :: The advance width or height.                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_Small_Metrics_\r\n  {\r\n    FT_Byte  height;\r\n    FT_Byte  width;\r\n\r\n    FT_Char  bearingX;\r\n    FT_Char  bearingY;\r\n    FT_Byte  advance;\r\n\r\n  } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_LineMetricsRec                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to describe the text line metrics of a given      */\r\n  /*    bitmap strike, for either a horizontal or vertical layout.         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    ascender                :: The ascender in pixels.                 */\r\n  /*                                                                       */\r\n  /*    descender               :: The descender in pixels.                */\r\n  /*                                                                       */\r\n  /*    max_width               :: The maximum glyph width in pixels.      */\r\n  /*                                                                       */\r\n  /*    caret_slope_enumerator  :: Rise of the caret slope, typically set  */\r\n  /*                               to 1 for non-italic fonts.              */\r\n  /*                                                                       */\r\n  /*    caret_slope_denominator :: Rise of the caret slope, typically set  */\r\n  /*                               to 0 for non-italic fonts.              */\r\n  /*                                                                       */\r\n  /*    caret_offset            :: Offset in pixels to move the caret for  */\r\n  /*                               proper positioning.                     */\r\n  /*                                                                       */\r\n  /*    min_origin_SB           :: Minimum of horiBearingX (resp.          */\r\n  /*                               vertBearingY).                          */\r\n  /*    min_advance_SB          :: Minimum of                              */\r\n  /*                                                                       */\r\n  /*                                 horizontal advance -                  */\r\n  /*                                   ( horiBearingX + width )            */\r\n  /*                                                                       */\r\n  /*                               resp.                                   */\r\n  /*                                                                       */\r\n  /*                                 vertical advance -                    */\r\n  /*                                   ( vertBearingY + height )           */\r\n  /*                                                                       */\r\n  /*    max_before_BL           :: Maximum of horiBearingY (resp.          */\r\n  /*                               vertBearingY).                          */\r\n  /*                                                                       */\r\n  /*    min_after_BL            :: Minimum of                              */\r\n  /*                                                                       */\r\n  /*                                 horiBearingY - height                 */\r\n  /*                                                                       */\r\n  /*                               resp.                                   */\r\n  /*                                                                       */\r\n  /*                                 vertBearingX - width                  */\r\n  /*                                                                       */\r\n  /*    pads                    :: Unused (to make the size of the record  */\r\n  /*                               a multiple of 32 bits.                  */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_LineMetricsRec_\r\n  {\r\n    FT_Char  ascender;\r\n    FT_Char  descender;\r\n    FT_Byte  max_width;\r\n    FT_Char  caret_slope_numerator;\r\n    FT_Char  caret_slope_denominator;\r\n    FT_Char  caret_offset;\r\n    FT_Char  min_origin_SB;\r\n    FT_Char  min_advance_SB;\r\n    FT_Char  max_before_BL;\r\n    FT_Char  min_after_BL;\r\n    FT_Char  pads[2];\r\n\r\n  } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_RangeRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A TrueType/OpenType subIndexTable as defined in the `EBLC'         */\r\n  /*    (Microsoft) or `bloc' (Apple) tables.                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    first_glyph   :: The first glyph index in the range.               */\r\n  /*                                                                       */\r\n  /*    last_glyph    :: The last glyph index in the range.                */\r\n  /*                                                                       */\r\n  /*    index_format  :: The format of index table.  Valid values are 1    */\r\n  /*                     to 5.                                             */\r\n  /*                                                                       */\r\n  /*    image_format  :: The format of `EBDT' image data.                  */\r\n  /*                                                                       */\r\n  /*    image_offset  :: The offset to image data in `EBDT'.               */\r\n  /*                                                                       */\r\n  /*    image_size    :: For index formats 2 and 5.  This is the size in   */\r\n  /*                     bytes of each glyph bitmap.                       */\r\n  /*                                                                       */\r\n  /*    big_metrics   :: For index formats 2 and 5.  This is the big       */\r\n  /*                     metrics for each glyph bitmap.                    */\r\n  /*                                                                       */\r\n  /*    num_glyphs    :: For index formats 4 and 5.  This is the number of */\r\n  /*                     glyphs in the code array.                         */\r\n  /*                                                                       */\r\n  /*    glyph_offsets :: For index formats 1 and 3.                        */\r\n  /*                                                                       */\r\n  /*    glyph_codes   :: For index formats 4 and 5.                        */\r\n  /*                                                                       */\r\n  /*    table_offset  :: The offset of the index table in the `EBLC'       */\r\n  /*                     table.  Only used during strike loading.          */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_RangeRec_\r\n  {\r\n    FT_UShort           first_glyph;\r\n    FT_UShort           last_glyph;\r\n\r\n    FT_UShort           index_format;\r\n    FT_UShort           image_format;\r\n    FT_ULong            image_offset;\r\n\r\n    FT_ULong            image_size;\r\n    TT_SBit_MetricsRec  metrics;\r\n    FT_ULong            num_glyphs;\r\n\r\n    FT_ULong*           glyph_offsets;\r\n    FT_UShort*          glyph_codes;\r\n\r\n    FT_ULong            table_offset;\r\n\r\n  } TT_SBit_RangeRec, *TT_SBit_Range;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_StrikeRec                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used describe a given bitmap strike in the `EBLC'      */\r\n  /*    (Microsoft) or `bloc' (Apple) tables.                              */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*   num_index_ranges :: The number of index ranges.                     */\r\n  /*                                                                       */\r\n  /*   index_ranges     :: An array of glyph index ranges.                 */\r\n  /*                                                                       */\r\n  /*   color_ref        :: Unused.  `color_ref' is put in for future       */\r\n  /*                       enhancements, but these fields are already      */\r\n  /*                       in use by other platforms (e.g. Newton).        */\r\n  /*                       For details, please see                         */\r\n  /*                                                                       */\r\n  /*                         http://fonts.apple.com/                       */\r\n  /*                                TTRefMan/RM06/Chap6bloc.html           */\r\n  /*                                                                       */\r\n  /*   hori             :: The line metrics for horizontal layouts.        */\r\n  /*                                                                       */\r\n  /*   vert             :: The line metrics for vertical layouts.          */\r\n  /*                                                                       */\r\n  /*   start_glyph      :: The lowest glyph index for this strike.         */\r\n  /*                                                                       */\r\n  /*   end_glyph        :: The highest glyph index for this strike.        */\r\n  /*                                                                       */\r\n  /*   x_ppem           :: The number of horizontal pixels per EM.         */\r\n  /*                                                                       */\r\n  /*   y_ppem           :: The number of vertical pixels per EM.           */\r\n  /*                                                                       */\r\n  /*   bit_depth        :: The bit depth.  Valid values are 1, 2, 4,       */\r\n  /*                       and 8.                                          */\r\n  /*                                                                       */\r\n  /*   flags            :: Is this a vertical or horizontal strike?  For   */\r\n  /*                       details, please see                             */\r\n  /*                                                                       */\r\n  /*                         http://fonts.apple.com/                       */\r\n  /*                                TTRefMan/RM06/Chap6bloc.html           */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_StrikeRec_\r\n  {\r\n    FT_Int                  num_ranges;\r\n    TT_SBit_Range           sbit_ranges;\r\n    FT_ULong                ranges_offset;\r\n\r\n    FT_ULong                color_ref;\r\n\r\n    TT_SBit_LineMetricsRec  hori;\r\n    TT_SBit_LineMetricsRec  vert;\r\n\r\n    FT_UShort               start_glyph;\r\n    FT_UShort               end_glyph;\r\n\r\n    FT_Byte                 x_ppem;\r\n    FT_Byte                 y_ppem;\r\n\r\n    FT_Byte                 bit_depth;\r\n    FT_Char                 flags;\r\n\r\n  } TT_SBit_StrikeRec, *TT_SBit_Strike;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_ComponentRec                                               */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A simple structure to describe a compound sbit element.            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    glyph_code :: The element's glyph index.                           */\r\n  /*                                                                       */\r\n  /*    x_offset   :: The element's left bearing.                          */\r\n  /*                                                                       */\r\n  /*    y_offset   :: The element's top bearing.                           */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_ComponentRec_\r\n  {\r\n    FT_UShort  glyph_code;\r\n    FT_Char    x_offset;\r\n    FT_Char    y_offset;\r\n\r\n  } TT_SBit_ComponentRec, *TT_SBit_Component;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_SBit_ScaleRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used describe a given bitmap scaling table, as defined */\r\n  /*    in the `EBSC' table.                                               */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    hori              :: The horizontal line metrics.                  */\r\n  /*                                                                       */\r\n  /*    vert              :: The vertical line metrics.                    */\r\n  /*                                                                       */\r\n  /*    x_ppem            :: The number of horizontal pixels per EM.       */\r\n  /*                                                                       */\r\n  /*    y_ppem            :: The number of vertical pixels per EM.         */\r\n  /*                                                                       */\r\n  /*    x_ppem_substitute :: Substitution x_ppem value.                    */\r\n  /*                                                                       */\r\n  /*    y_ppem_substitute :: Substitution y_ppem value.                    */\r\n  /*                                                                       */\r\n  typedef struct  TT_SBit_ScaleRec_\r\n  {\r\n    TT_SBit_LineMetricsRec  hori;\r\n    TT_SBit_LineMetricsRec  vert;\r\n\r\n    FT_Byte                 x_ppem;\r\n    FT_Byte                 y_ppem;\r\n\r\n    FT_Byte                 x_ppem_substitute;\r\n    FT_Byte                 y_ppem_substitute;\r\n\r\n  } TT_SBit_ScaleRec, *TT_SBit_Scale;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                  POSTSCRIPT GLYPH NAMES SUPPORT                   ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Post_20Rec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Postscript names sub-table, format 2.0.  Stores the PS name of     */\r\n  /*    each glyph in the font face.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_glyphs    :: The number of named glyphs in the table.          */\r\n  /*                                                                       */\r\n  /*    num_names     :: The number of PS names stored in the table.       */\r\n  /*                                                                       */\r\n  /*    glyph_indices :: The indices of the glyphs in the names arrays.    */\r\n  /*                                                                       */\r\n  /*    glyph_names   :: The PS names not in Mac Encoding.                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_Post_20Rec_\r\n  {\r\n    FT_UShort   num_glyphs;\r\n    FT_UShort   num_names;\r\n    FT_UShort*  glyph_indices;\r\n    FT_Char**   glyph_names;\r\n\r\n  } TT_Post_20Rec, *TT_Post_20;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Post_25Rec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Postscript names sub-table, format 2.5.  Stores the PS name of     */\r\n  /*    each glyph in the font face.                                       */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    num_glyphs :: The number of glyphs in the table.                   */\r\n  /*                                                                       */\r\n  /*    offsets    :: An array of signed offsets in a normal Mac           */\r\n  /*                  Postscript name encoding.                            */\r\n  /*                                                                       */\r\n  typedef struct  TT_Post_25_\r\n  {\r\n    FT_UShort  num_glyphs;\r\n    FT_Char*   offsets;\r\n\r\n  } TT_Post_25Rec, *TT_Post_25;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Post_NamesRec                                                   */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Postscript names table, either format 2.0 or 2.5.                  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    loaded    :: A flag to indicate whether the PS names are loaded.   */\r\n  /*                                                                       */\r\n  /*    format_20 :: The sub-table used for format 2.0.                    */\r\n  /*                                                                       */\r\n  /*    format_25 :: The sub-table used for format 2.5.                    */\r\n  /*                                                                       */\r\n  typedef struct  TT_Post_NamesRec_\r\n  {\r\n    FT_Bool  loaded;\r\n\r\n    union\r\n    {\r\n      TT_Post_20Rec  format_20;\r\n      TT_Post_25Rec  format_25;\r\n\r\n    } names;\r\n\r\n  } TT_Post_NamesRec, *TT_Post_Names;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                    GX VARIATION TABLE SUPPORT                     ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n  typedef struct GX_BlendRec_  *GX_Blend;\r\n#endif\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***              EMBEDDED BDF PROPERTIES TABLE SUPPORT                ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n  /*\r\n   * These types are used to support a `BDF ' table that isn't part of the\r\n   * official TrueType specification.  It is mainly used in SFNT-based\r\n   * bitmap fonts that were generated from a set of BDF fonts.\r\n   *\r\n   * The format of the table is as follows.\r\n   *\r\n   *   USHORT   version      `BDF ' table version number, should be 0x0001.\r\n   *   USHORT   strikeCount  Number of strikes (bitmap sizes) in this table.\r\n   *   ULONG    stringTable  Offset (from start of BDF table) to string\r\n   *                         table.\r\n   *\r\n   * This is followed by an array of `strikeCount' descriptors, having the\r\n   * following format.\r\n   *\r\n   *   USHORT   ppem         Vertical pixels per EM for this strike.\r\n   *   USHORT   numItems     Number of items for this strike (properties and\r\n   *                         atoms).  Maximum is 255.\r\n   *\r\n   * This array in turn is followed by `strikeCount' value sets.  Each\r\n   * `value set' is an array of `numItems' items with the following format.\r\n   *\r\n   *   ULONG    item_name    Offset in string table to item name.\r\n   *   USHORT   item_type    The item type.  Possible values are\r\n   *                            0 => string (e.g., COMMENT)\r\n   *                            1 => atom   (e.g., FONT or even SIZE)\r\n   *                            2 => int32\r\n   *                            3 => uint32\r\n   *                         0x10 => A flag to indicate a properties.  This\r\n   *                                 is ORed with the above values.\r\n   *   ULONG    item_value   For strings  => Offset into string table without\r\n   *                                         the corresponding double quotes.\r\n   *                         For atoms    => Offset into string table.\r\n   *                         For integers => Direct value.\r\n   *\r\n   * All strings in the string table consist of bytes and are\r\n   * zero-terminated.\r\n   *\r\n   */\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n\r\n  typedef struct  TT_BDFRec_\r\n  {\r\n    FT_Byte*   table;\r\n    FT_Byte*   table_end;\r\n    FT_Byte*   strings;\r\n    FT_ULong   strings_size;\r\n    FT_UInt    num_strikes;\r\n    FT_Bool    loaded;\r\n\r\n  } TT_BDFRec, *TT_BDF;\r\n\r\n#endif /* TT_CONFIG_OPTION_BDF */\r\n\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /***                  ORIGINAL TT_FACE CLASS DEFINITION                ***/\r\n  /***                                                                   ***/\r\n  /***                                                                   ***/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This structure/class is defined here because it is common to the      */\r\n  /* following formats: TTF, OpenType-TT, and OpenType-CFF.                */\r\n  /*                                                                       */\r\n  /* Note, however, that the classes TT_Size and TT_GlyphSlot are not      */\r\n  /* shared between font drivers, and are thus defined in `ttobjs.h'.      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Type>                                                                */\r\n  /*    TT_Face                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a TrueType face/font object.  A TT_Face encapsulates   */\r\n  /*    the resolution and scaling independent parts of a TrueType font    */\r\n  /*    resource.                                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The TT_Face structure is also used as a `parent class' for the     */\r\n  /*    OpenType-CFF class (T2_Face).                                      */\r\n  /*                                                                       */\r\n  typedef struct TT_FaceRec_*  TT_Face;\r\n\r\n\r\n  /* a function type used for the truetype bytecode interpreter hooks */\r\n  typedef FT_Error\r\n  (*TT_Interpreter)( void*  exec_context );\r\n\r\n  /* forward declaration */\r\n  typedef struct TT_LoaderRec_*  TT_Loader;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_GotoTableFunc                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Seeks a stream to the start of a given TrueType table.             */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face   :: A handle to the target face object.                      */\r\n  /*                                                                       */\r\n  /*    tag    :: A 4-byte tag used to name the table.                     */\r\n  /*                                                                       */\r\n  /*    stream :: The input stream.                                        */\r\n  /*                                                                       */\r\n  /* <Output>                                                              */\r\n  /*    length :: The length of the table in bytes.  Set to 0 if not       */\r\n  /*              needed.                                                  */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The stream cursor must be at the font file's origin.               */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Loader_GotoTableFunc)( TT_Face    face,\r\n                              FT_ULong   tag,\r\n                              FT_Stream  stream,\r\n                              FT_ULong*  length );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_StartGlyphFunc                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Seeks a stream to the start of a given glyph element, and opens a  */\r\n  /*    frame for it.                                                      */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    loader      :: The current TrueType glyph loader object.           */\r\n  /*                                                                       */\r\n  /*    glyph index :: The index of the glyph to access.                   */\r\n  /*                                                                       */\r\n  /*    offset      :: The offset of the glyph according to the            */\r\n  /*                   `locations' table.                                  */\r\n  /*                                                                       */\r\n  /*    byte_count  :: The size of the frame in bytes.                     */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This function is normally equivalent to FT_STREAM_SEEK(offset)     */\r\n  /*    followed by FT_FRAME_ENTER(byte_count) with the loader's stream,   */\r\n  /*    but alternative formats (e.g. compressed ones) might use something */\r\n  /*    different.                                                         */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Loader_StartGlyphFunc)( TT_Loader  loader,\r\n                               FT_UInt    glyph_index,\r\n                               FT_ULong   offset,\r\n                               FT_UInt    byte_count );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_ReadGlyphFunc                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Reads one glyph element (its header, a simple glyph, or a          */\r\n  /*    composite) from the loader's current stream frame.                 */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    loader :: The current TrueType glyph loader object.                */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    FreeType error code.  0 means success.                             */\r\n  /*                                                                       */\r\n  typedef FT_Error\r\n  (*TT_Loader_ReadGlyphFunc)( TT_Loader  loader );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <FuncType>                                                            */\r\n  /*    TT_Loader_EndGlyphFunc                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Closes the current loader stream frame for the glyph.              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    loader :: The current TrueType glyph loader object.                */\r\n  /*                                                                       */\r\n  typedef void\r\n  (*TT_Loader_EndGlyphFunc)( TT_Loader  loader );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*                         TrueType Face Type                            */\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Face                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The TrueType face class.  These objects model the resolution and   */\r\n  /*    point-size independent data found in a TrueType font file.         */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    root                 :: The base FT_Face structure, managed by the */\r\n  /*                            base layer.                                */\r\n  /*                                                                       */\r\n  /*    ttc_header           :: The TrueType collection header, used when  */\r\n  /*                            the file is a `ttc' rather than a `ttf'.   */\r\n  /*                            For ordinary font files, the field         */\r\n  /*                            `ttc_header.count' is set to 0.            */\r\n  /*                                                                       */\r\n  /*    format_tag           :: The font format tag.                       */\r\n  /*                                                                       */\r\n  /*    num_tables           :: The number of TrueType tables in this font */\r\n  /*                            file.                                      */\r\n  /*                                                                       */\r\n  /*    dir_tables           :: The directory of TrueType tables for this  */\r\n  /*                            font file.                                 */\r\n  /*                                                                       */\r\n  /*    header               :: The font's font header (`head' table).     */\r\n  /*                            Read on font opening.                      */\r\n  /*                                                                       */\r\n  /*    horizontal           :: The font's horizontal header (`hhea'       */\r\n  /*                            table).  This field also contains the      */\r\n  /*                            associated horizontal metrics table        */\r\n  /*                            (`hmtx').                                  */\r\n  /*                                                                       */\r\n  /*    max_profile          :: The font's maximum profile table.  Read on */\r\n  /*                            font opening.  Note that some maximum      */\r\n  /*                            values cannot be taken directly from this  */\r\n  /*                            table.  We thus define additional fields   */\r\n  /*                            below to hold the computed maxima.         */\r\n  /*                                                                       */\r\n  /*    vertical_info        :: A boolean which is set when the font file  */\r\n  /*                            contains vertical metrics.  If not, the    */\r\n  /*                            value of the `vertical' field is           */\r\n  /*                            undefined.                                 */\r\n  /*                                                                       */\r\n  /*    vertical             :: The font's vertical header (`vhea' table). */\r\n  /*                            This field also contains the associated    */\r\n  /*                            vertical metrics table (`vmtx'), if found. */\r\n  /*                            IMPORTANT: The contents of this field is   */\r\n  /*                            undefined if the `verticalInfo' field is   */\r\n  /*                            unset.                                     */\r\n  /*                                                                       */\r\n  /*    num_names            :: The number of name records within this     */\r\n  /*                            TrueType font.                             */\r\n  /*                                                                       */\r\n  /*    name_table           :: The table of name records (`name').        */\r\n  /*                                                                       */\r\n  /*    os2                  :: The font's OS/2 table (`OS/2').            */\r\n  /*                                                                       */\r\n  /*    postscript           :: The font's PostScript table (`post'        */\r\n  /*                            table).  The PostScript glyph names are    */\r\n  /*                            not loaded by the driver on face opening.  */\r\n  /*                            See the `ttpost' module for more details.  */\r\n  /*                                                                       */\r\n  /*    cmap_table           :: Address of the face's `cmap' SFNT table    */\r\n  /*                            in memory (it's an extracted frame).       */\r\n  /*                                                                       */\r\n  /*    cmap_size            :: The size in bytes of the `cmap_table'      */\r\n  /*                            described above.                           */\r\n  /*                                                                       */\r\n  /*    goto_table           :: A function called by each TrueType table   */\r\n  /*                            loader to position a stream's cursor to    */\r\n  /*                            the start of a given table according to    */\r\n  /*                            its tag.  It defaults to TT_Goto_Face but  */\r\n  /*                            can be different for strange formats (e.g. */\r\n  /*                            Type 42).                                  */\r\n  /*                                                                       */\r\n  /*    access_glyph_frame   :: A function used to access the frame of a   */\r\n  /*                            given glyph within the face's font file.   */\r\n  /*                                                                       */\r\n  /*    forget_glyph_frame   :: A function used to forget the frame of a   */\r\n  /*                            given glyph when all data has been loaded. */\r\n  /*                                                                       */\r\n  /*    read_glyph_header    :: A function used to read a glyph header.    */\r\n  /*                            It must be called between an `access' and  */\r\n  /*                            `forget'.                                  */\r\n  /*                                                                       */\r\n  /*    read_simple_glyph    :: A function used to read a simple glyph.    */\r\n  /*                            It must be called after the header was     */\r\n  /*                            read, and before the `forget'.             */\r\n  /*                                                                       */\r\n  /*    read_composite_glyph :: A function used to read a composite glyph. */\r\n  /*                            It must be called after the header was     */\r\n  /*                            read, and before the `forget'.             */\r\n  /*                                                                       */\r\n  /*    sfnt                 :: A pointer to the SFNT service.             */\r\n  /*                                                                       */\r\n  /*    psnames              :: A pointer to the PostScript names service. */\r\n  /*                                                                       */\r\n  /*    hdmx                 :: The face's horizontal device metrics       */\r\n  /*                            (`hdmx' table).  This table is optional in */\r\n  /*                            TrueType/OpenType fonts.                   */\r\n  /*                                                                       */\r\n  /*    gasp                 :: The grid-fitting and scaling properties    */\r\n  /*                            table (`gasp').  This table is optional in */\r\n  /*                            TrueType/OpenType fonts.                   */\r\n  /*                                                                       */\r\n  /*    pclt                 :: The `pclt' SFNT table.                     */\r\n  /*                                                                       */\r\n  /*    num_sbit_strikes     :: The number of sbit strikes, i.e., bitmap   */\r\n  /*                            sizes, embedded in this font.              */\r\n  /*                                                                       */\r\n  /*    sbit_strikes         :: An array of sbit strikes embedded in this  */\r\n  /*                            font.  This table is optional in a         */\r\n  /*                            TrueType/OpenType font.                    */\r\n  /*                                                                       */\r\n  /*    num_sbit_scales      :: The number of sbit scales for this font.   */\r\n  /*                                                                       */\r\n  /*    sbit_scales          :: Array of sbit scales embedded in this      */\r\n  /*                            font.  This table is optional in a         */\r\n  /*                            TrueType/OpenType font.                    */\r\n  /*                                                                       */\r\n  /*    postscript_names     :: A table used to store the Postscript names */\r\n  /*                            of  the glyphs for this font.  See the     */\r\n  /*                            file  `ttconfig.h' for comments on the     */\r\n  /*                            TT_CONFIG_OPTION_POSTSCRIPT_NAMES option.  */\r\n  /*                                                                       */\r\n  /*    num_locations        :: The number of glyph locations in this      */\r\n  /*                            TrueType file.  This should be             */\r\n  /*                            identical to the number of glyphs.         */\r\n  /*                            Ignored for Type 2 fonts.                  */\r\n  /*                                                                       */\r\n  /*    glyph_locations      :: An array of longs.  These are offsets to   */\r\n  /*                            glyph data within the `glyf' table.        */\r\n  /*                            Ignored for Type 2 font faces.             */\r\n  /*                                                                       */\r\n  /*    glyf_len             :: The length of the `glyf' table.  Needed    */\r\n  /*                            for malformed `loca' tables.               */\r\n  /*                                                                       */\r\n  /*    font_program_size    :: Size in bytecodes of the face's font       */\r\n  /*                            program.  0 if none defined.  Ignored for  */\r\n  /*                            Type 2 fonts.                              */\r\n  /*                                                                       */\r\n  /*    font_program         :: The face's font program (bytecode stream)  */\r\n  /*                            executed at load time, also used during    */\r\n  /*                            glyph rendering.  Comes from the `fpgm'    */\r\n  /*                            table.  Ignored for Type 2 font fonts.     */\r\n  /*                                                                       */\r\n  /*    cvt_program_size     :: The size in bytecodes of the face's cvt    */\r\n  /*                            program.  Ignored for Type 2 fonts.        */\r\n  /*                                                                       */\r\n  /*    cvt_program          :: The face's cvt program (bytecode stream)   */\r\n  /*                            executed each time an instance/size is     */\r\n  /*                            changed/reset.  Comes from the `prep'      */\r\n  /*                            table.  Ignored for Type 2 fonts.          */\r\n  /*                                                                       */\r\n  /*    cvt_size             :: Size of the control value table (in        */\r\n  /*                            entries).   Ignored for Type 2 fonts.      */\r\n  /*                                                                       */\r\n  /*    cvt                  :: The face's original control value table.   */\r\n  /*                            Coordinates are expressed in unscaled font */\r\n  /*                            units.  Comes from the `cvt ' table.       */\r\n  /*                            Ignored for Type 2 fonts.                  */\r\n  /*                                                                       */\r\n  /*    num_kern_pairs       :: The number of kerning pairs present in the */\r\n  /*                            font file.  The engine only loads the      */\r\n  /*                            first horizontal format 0 kern table it    */\r\n  /*                            finds in the font file.  Ignored for       */\r\n  /*                            Type 2 fonts.                              */\r\n  /*                                                                       */\r\n  /*    kern_table_index     :: The index of the kerning table in the font */\r\n  /*                            kerning directory.  Ignored for Type 2     */\r\n  /*                            fonts.                                     */\r\n  /*                                                                       */\r\n  /*    interpreter          :: A pointer to the TrueType bytecode         */\r\n  /*                            interpreters field is also used to hook    */\r\n  /*                            the debugger in `ttdebug'.                 */\r\n  /*                                                                       */\r\n  /*    unpatented_hinting   :: If true, use only unpatented methods in    */\r\n  /*                            the bytecode interpreter.                  */\r\n  /*                                                                       */\r\n  /*    doblend              :: A boolean which is set if the font should  */\r\n  /*                            be blended (this is for GX var).           */\r\n  /*                                                                       */\r\n  /*    blend                :: Contains the data needed to control GX     */\r\n  /*                            variation tables (rather like Multiple     */\r\n  /*                            Master data).                              */\r\n  /*                                                                       */\r\n  /*    extra                :: Reserved for third-party font drivers.     */\r\n  /*                                                                       */\r\n  /*    postscript_name      :: The PS name of the font.  Used by the      */\r\n  /*                            postscript name service.                   */\r\n  /*                                                                       */\r\n  typedef struct  TT_FaceRec_\r\n  {\r\n    FT_FaceRec            root;\r\n\r\n    TTC_HeaderRec         ttc_header;\r\n\r\n    FT_ULong              format_tag;\r\n    FT_UShort             num_tables;\r\n    TT_Table              dir_tables;\r\n\r\n    TT_Header             header;       /* TrueType header table          */\r\n    TT_HoriHeader         horizontal;   /* TrueType horizontal header     */\r\n\r\n    TT_MaxProfile         max_profile;\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_ULong              max_components;  /* stubbed to 0 */\r\n#endif\r\n\r\n    FT_Bool               vertical_info;\r\n    TT_VertHeader         vertical;     /* TT Vertical header, if present */\r\n\r\n    FT_UShort             num_names;    /* number of name records  */\r\n    TT_NameTableRec       name_table;   /* name table              */\r\n\r\n    TT_OS2                os2;          /* TrueType OS/2 table            */\r\n    TT_Postscript         postscript;   /* TrueType Postscript table      */\r\n\r\n    FT_Byte*              cmap_table;   /* extracted `cmap' table */\r\n    FT_ULong              cmap_size;\r\n\r\n    TT_Loader_GotoTableFunc   goto_table;\r\n\r\n    TT_Loader_StartGlyphFunc  access_glyph_frame;\r\n    TT_Loader_EndGlyphFunc    forget_glyph_frame;\r\n    TT_Loader_ReadGlyphFunc   read_glyph_header;\r\n    TT_Loader_ReadGlyphFunc   read_simple_glyph;\r\n    TT_Loader_ReadGlyphFunc   read_composite_glyph;\r\n\r\n    /* a typeless pointer to the SFNT_Interface table used to load */\r\n    /* the basic TrueType tables in the face object                */\r\n    void*                 sfnt;\r\n\r\n    /* a typeless pointer to the FT_Service_PsCMapsRec table used to */\r\n    /* handle glyph names <-> unicode & Mac values                   */\r\n    void*                 psnames;\r\n\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* Optional TrueType/OpenType tables                                   */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    /* horizontal device metrics */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    TT_HdmxRec            hdmx;\r\n#endif\r\n\r\n    /* grid-fitting and scaling table */\r\n    TT_GaspRec            gasp;                 /* the `gasp' table */\r\n\r\n    /* PCL 5 table */\r\n    TT_PCLT               pclt;\r\n\r\n    /* embedded bitmaps support */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_ULong              num_sbit_strikes;\r\n    TT_SBit_Strike        sbit_strikes;\r\n#endif\r\n\r\n    FT_ULong              num_sbit_scales;\r\n    TT_SBit_Scale         sbit_scales;\r\n\r\n    /* postscript names table */\r\n    TT_Post_NamesRec      postscript_names;\r\n\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* TrueType-specific fields (ignored by the OTF-Type2 driver)          */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    /* the glyph locations */\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    FT_UShort             num_locations_stub;\r\n    FT_Long*              glyph_locations_stub;\r\n#endif\r\n\r\n    /* the font program, if any */\r\n    FT_ULong              font_program_size;\r\n    FT_Byte*              font_program;\r\n\r\n    /* the cvt program, if any */\r\n    FT_ULong              cvt_program_size;\r\n    FT_Byte*              cvt_program;\r\n\r\n    /* the original, unscaled, control value table */\r\n    FT_ULong              cvt_size;\r\n    FT_Short*             cvt;\r\n\r\n#ifdef FT_CONFIG_OPTION_OLD_INTERNALS\r\n    /* the format 0 kerning table, if any */\r\n    FT_Int                num_kern_pairs;\r\n    FT_Int                kern_table_index;\r\n    TT_Kern0_Pair         kern_pairs;\r\n#endif\r\n\r\n    /* A pointer to the bytecode interpreter to use.  This is also */\r\n    /* used to hook the debugger for the `ttdebug' utility.        */\r\n    TT_Interpreter        interpreter;\r\n\r\n#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING\r\n    /* Use unpatented hinting only. */\r\n    FT_Bool               unpatented_hinting;\r\n#endif\r\n\r\n    /***********************************************************************/\r\n    /*                                                                     */\r\n    /* Other tables or fields. This is used by derivative formats like     */\r\n    /* OpenType.                                                           */\r\n    /*                                                                     */\r\n    /***********************************************************************/\r\n\r\n    FT_Generic            extra;\r\n\r\n    const char*           postscript_name;\r\n\r\n    /* since version 2.1.8, but was originally placed after */\r\n    /* `glyph_locations_stub'                               */\r\n    FT_ULong              glyf_len;\r\n\r\n    /* since version 2.1.8, but was originally placed before `extra' */\r\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\r\n    FT_Bool               doblend;\r\n    GX_Blend              blend;\r\n#endif\r\n\r\n    /* since version 2.2 */\r\n\r\n    FT_Byte*              horz_metrics;\r\n    FT_ULong              horz_metrics_size;\r\n\r\n    FT_Byte*              vert_metrics;\r\n    FT_ULong              vert_metrics_size;\r\n\r\n    FT_ULong              num_locations; /* in broken TTF, gid > 0xFFFF */ \r\n    FT_Byte*              glyph_locations;\r\n\r\n    FT_Byte*              hdmx_table;\r\n    FT_ULong              hdmx_table_size;\r\n    FT_UInt               hdmx_record_count;\r\n    FT_ULong              hdmx_record_size;\r\n    FT_Byte*              hdmx_record_sizes;\r\n\r\n    FT_Byte*              sbit_table;\r\n    FT_ULong              sbit_table_size;\r\n    FT_UInt               sbit_num_strikes;\r\n\r\n    FT_Byte*              kern_table;\r\n    FT_ULong              kern_table_size;\r\n    FT_UInt               num_kern_tables;\r\n    FT_UInt32             kern_avail_bits;\r\n    FT_UInt32             kern_order_bits;\r\n\r\n#ifdef TT_CONFIG_OPTION_BDF\r\n    TT_BDFRec             bdf;\r\n#endif /* TT_CONFIG_OPTION_BDF */\r\n\r\n    /* since 2.3.0 */\r\n    FT_ULong              horz_metrics_offset;\r\n    FT_ULong              vert_metrics_offset;\r\n\r\n  } TT_FaceRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /*  <Struct>                                                             */\r\n  /*     TT_GlyphZoneRec                                                   */\r\n  /*                                                                       */\r\n  /*  <Description>                                                        */\r\n  /*     A glyph zone is used to load, scale and hint glyph outline        */\r\n  /*     coordinates.                                                      */\r\n  /*                                                                       */\r\n  /*  <Fields>                                                             */\r\n  /*     memory       :: A handle to the memory manager.                   */\r\n  /*                                                                       */\r\n  /*     max_points   :: The maximal size in points of the zone.           */\r\n  /*                                                                       */\r\n  /*     max_contours :: Max size in links contours of the zone.           */\r\n  /*                                                                       */\r\n  /*     n_points     :: The current number of points in the zone.         */\r\n  /*                                                                       */\r\n  /*     n_contours   :: The current number of contours in the zone.       */\r\n  /*                                                                       */\r\n  /*     org          :: The original glyph coordinates (font              */\r\n  /*                     units/scaled).                                    */\r\n  /*                                                                       */\r\n  /*     cur          :: The current glyph coordinates (scaled/hinted).    */\r\n  /*                                                                       */\r\n  /*     tags         :: The point control tags.                           */\r\n  /*                                                                       */\r\n  /*     contours     :: The contours end points.                          */\r\n  /*                                                                       */\r\n  /*     first_point  :: Offset of the current subglyph's first point.     */\r\n  /*                                                                       */\r\n  typedef struct  TT_GlyphZoneRec_\r\n  {\r\n    FT_Memory   memory;\r\n    FT_UShort   max_points;\r\n    FT_UShort   max_contours;\r\n    FT_UShort   n_points;    /* number of points in zone    */\r\n    FT_Short    n_contours;  /* number of contours          */\r\n\r\n    FT_Vector*  org;         /* original point coordinates  */\r\n    FT_Vector*  cur;         /* current point coordinates   */\r\n    FT_Vector*  orus;        /* original (unscaled) point coordinates */\r\n\r\n    FT_Byte*    tags;        /* current touch flags         */\r\n    FT_UShort*  contours;    /* contour end points          */\r\n\r\n    FT_UShort   first_point; /* offset of first (#0) point  */\r\n\r\n  } TT_GlyphZoneRec, *TT_GlyphZone;\r\n\r\n\r\n  /* handle to execution context */\r\n  typedef struct TT_ExecContextRec_*  TT_ExecContext;\r\n\r\n  /* glyph loader structure */\r\n  typedef struct  TT_LoaderRec_\r\n  {\r\n    FT_Face          face;\r\n    FT_Size          size;\r\n    FT_GlyphSlot     glyph;\r\n    FT_GlyphLoader   gloader;\r\n\r\n    FT_ULong         load_flags;\r\n    FT_UInt          glyph_index;\r\n\r\n    FT_Stream        stream;\r\n    FT_Int           byte_len;\r\n\r\n    FT_Short         n_contours;\r\n    FT_BBox          bbox;\r\n    FT_Int           left_bearing;\r\n    FT_Int           advance;\r\n    FT_Int           linear;\r\n    FT_Bool          linear_def;\r\n    FT_Bool          preserve_pps;\r\n    FT_Vector        pp1;\r\n    FT_Vector        pp2;\r\n\r\n    FT_ULong         glyf_offset;\r\n\r\n    /* the zone where we load our glyphs */\r\n    TT_GlyphZoneRec  base;\r\n    TT_GlyphZoneRec  zone;\r\n\r\n    TT_ExecContext   exec;\r\n    FT_Byte*         instructions;\r\n    FT_ULong         ins_pos;\r\n\r\n    /* for possible extensibility in other formats */\r\n    void*            other;\r\n\r\n    /* since version 2.1.8 */\r\n    FT_Int           top_bearing;\r\n    FT_Int           vadvance;\r\n    FT_Vector        pp3;\r\n    FT_Vector        pp4;\r\n\r\n    /* since version 2.2.1 */\r\n    FT_Byte*         cursor;\r\n    FT_Byte*         limit;\r\n\r\n  } TT_LoaderRec;\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTTYPES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/t1tables.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  t1tables.h                                                             */\r\n/*                                                                         */\r\n/*    Basic Type 1/Type 2 tables definitions and interface (specification  */\r\n/*    only).                                                               */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __T1TABLES_H__\r\n#define __T1TABLES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    type1_tables                                                       */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    Type 1 Tables                                                      */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    Type~1 (PostScript) specific font tables.                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the definition of Type 1-specific tables,    */\r\n  /*    including structures related to other PostScript font formats.     */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */\r\n  /* structures in order to support Multiple Master fonts.               */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_FontInfoRec                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a Type~1 or Type~2 FontInfo dictionary.  */\r\n  /*    Note that for Multiple Master fonts, each instance has its own     */\r\n  /*    FontInfo dictionary.                                               */\r\n  /*                                                                       */\r\n  typedef struct  PS_FontInfoRec_\r\n  {\r\n    FT_String*  version;\r\n    FT_String*  notice;\r\n    FT_String*  full_name;\r\n    FT_String*  family_name;\r\n    FT_String*  weight;\r\n    FT_Long     italic_angle;\r\n    FT_Bool     is_fixed_pitch;\r\n    FT_Short    underline_position;\r\n    FT_UShort   underline_thickness;\r\n\r\n  } PS_FontInfoRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_FontInfo                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @PS_FontInfoRec structure.                           */\r\n  /*                                                                       */\r\n  typedef struct PS_FontInfoRec_*  PS_FontInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_FontInfo                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This type is equivalent to @PS_FontInfoRec.  It is deprecated but  */\r\n  /*    kept to maintain source compatibility between various versions of  */\r\n  /*    FreeType.                                                          */\r\n  /*                                                                       */\r\n  typedef PS_FontInfoRec  T1_FontInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_PrivateRec                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a Type~1 or Type~2 private dictionary.   */\r\n  /*    Note that for Multiple Master fonts, each instance has its own     */\r\n  /*    Private dictionary.                                                */\r\n  /*                                                                       */\r\n  typedef struct  PS_PrivateRec_\r\n  {\r\n    FT_Int     unique_id;\r\n    FT_Int     lenIV;\r\n\r\n    FT_Byte    num_blue_values;\r\n    FT_Byte    num_other_blues;\r\n    FT_Byte    num_family_blues;\r\n    FT_Byte    num_family_other_blues;\r\n\r\n    FT_Short   blue_values[14];\r\n    FT_Short   other_blues[10];\r\n\r\n    FT_Short   family_blues      [14];\r\n    FT_Short   family_other_blues[10];\r\n\r\n    FT_Fixed   blue_scale;\r\n    FT_Int     blue_shift;\r\n    FT_Int     blue_fuzz;\r\n\r\n    FT_UShort  standard_width[1];\r\n    FT_UShort  standard_height[1];\r\n\r\n    FT_Byte    num_snap_widths;\r\n    FT_Byte    num_snap_heights;\r\n    FT_Bool    force_bold;\r\n    FT_Bool    round_stem_up;\r\n\r\n    FT_Short   snap_widths [13];  /* including std width  */\r\n    FT_Short   snap_heights[13];  /* including std height */\r\n\r\n    FT_Fixed   expansion_factor;\r\n\r\n    FT_Long    language_group;\r\n    FT_Long    password;\r\n\r\n    FT_Short   min_feature[2];\r\n\r\n  } PS_PrivateRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    PS_Private                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @PS_PrivateRec structure.                            */\r\n  /*                                                                       */\r\n  typedef struct PS_PrivateRec_*  PS_Private;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    T1_Private                                                         */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   This type is equivalent to @PS_PrivateRec.  It is deprecated but    */\r\n  /*   kept to maintain source compatibility between various versions of   */\r\n  /*   FreeType.                                                           */\r\n  /*                                                                       */\r\n  typedef PS_PrivateRec  T1_Private;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    T1_Blend_Flags                                                     */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A set of flags used to indicate which fields are present in a      */\r\n  /*    given blend dictionary (font info or private).  Used to support    */\r\n  /*    Multiple Masters fonts.                                            */\r\n  /*                                                                       */\r\n  typedef enum  T1_Blend_Flags_\r\n  {\r\n    /*# required fields in a FontInfo blend dictionary */\r\n    T1_BLEND_UNDERLINE_POSITION = 0,\r\n    T1_BLEND_UNDERLINE_THICKNESS,\r\n    T1_BLEND_ITALIC_ANGLE,\r\n\r\n    /*# required fields in a Private blend dictionary */\r\n    T1_BLEND_BLUE_VALUES,\r\n    T1_BLEND_OTHER_BLUES,\r\n    T1_BLEND_STANDARD_WIDTH,\r\n    T1_BLEND_STANDARD_HEIGHT,\r\n    T1_BLEND_STEM_SNAP_WIDTHS,\r\n    T1_BLEND_STEM_SNAP_HEIGHTS,\r\n    T1_BLEND_BLUE_SCALE,\r\n    T1_BLEND_BLUE_SHIFT,\r\n    T1_BLEND_FAMILY_BLUES,\r\n    T1_BLEND_FAMILY_OTHER_BLUES,\r\n    T1_BLEND_FORCE_BOLD,\r\n\r\n    /*# never remove */\r\n    T1_BLEND_MAX\r\n\r\n  } T1_Blend_Flags;\r\n\r\n  /* */\r\n\r\n\r\n  /*# backwards compatible definitions */\r\n#define t1_blend_underline_position   T1_BLEND_UNDERLINE_POSITION\r\n#define t1_blend_underline_thickness  T1_BLEND_UNDERLINE_THICKNESS\r\n#define t1_blend_italic_angle         T1_BLEND_ITALIC_ANGLE\r\n#define t1_blend_blue_values          T1_BLEND_BLUE_VALUES\r\n#define t1_blend_other_blues          T1_BLEND_OTHER_BLUES\r\n#define t1_blend_standard_widths      T1_BLEND_STANDARD_WIDTH\r\n#define t1_blend_standard_height      T1_BLEND_STANDARD_HEIGHT\r\n#define t1_blend_stem_snap_widths     T1_BLEND_STEM_SNAP_WIDTHS\r\n#define t1_blend_stem_snap_heights    T1_BLEND_STEM_SNAP_HEIGHTS\r\n#define t1_blend_blue_scale           T1_BLEND_BLUE_SCALE\r\n#define t1_blend_blue_shift           T1_BLEND_BLUE_SHIFT\r\n#define t1_blend_family_blues         T1_BLEND_FAMILY_BLUES\r\n#define t1_blend_family_other_blues   T1_BLEND_FAMILY_OTHER_BLUES\r\n#define t1_blend_force_bold           T1_BLEND_FORCE_BOLD\r\n#define t1_blend_max                  T1_BLEND_MAX\r\n\r\n\r\n  /* maximum number of Multiple Masters designs, as defined in the spec */\r\n#define T1_MAX_MM_DESIGNS     16\r\n\r\n  /* maximum number of Multiple Masters axes, as defined in the spec */\r\n#define T1_MAX_MM_AXIS        4\r\n\r\n  /* maximum number of elements in a design map */\r\n#define T1_MAX_MM_MAP_POINTS  20\r\n\r\n\r\n  /* this structure is used to store the BlendDesignMap entry for an axis */\r\n  typedef struct  PS_DesignMap_\r\n  {\r\n    FT_Byte    num_points;\r\n    FT_Long*   design_points;\r\n    FT_Fixed*  blend_points;\r\n\r\n  } PS_DesignMapRec, *PS_DesignMap;\r\n\r\n  /* backwards-compatible definition */\r\n  typedef PS_DesignMapRec  T1_DesignMap;\r\n\r\n\r\n  typedef struct  PS_BlendRec_\r\n  {\r\n    FT_UInt          num_designs;\r\n    FT_UInt          num_axis;\r\n\r\n    FT_String*       axis_names[T1_MAX_MM_AXIS];\r\n    FT_Fixed*        design_pos[T1_MAX_MM_DESIGNS];\r\n    PS_DesignMapRec  design_map[T1_MAX_MM_AXIS];\r\n\r\n    FT_Fixed*        weight_vector;\r\n    FT_Fixed*        default_weight_vector;\r\n\r\n    PS_FontInfo      font_infos[T1_MAX_MM_DESIGNS + 1];\r\n    PS_Private       privates  [T1_MAX_MM_DESIGNS + 1];\r\n\r\n    FT_ULong         blend_bitflags;\r\n\r\n    FT_BBox*         bboxes    [T1_MAX_MM_DESIGNS + 1];\r\n\r\n    /* since 2.3.0 */\r\n\r\n    /* undocumented, optional: the default design instance;   */\r\n    /* corresponds to default_weight_vector --                */\r\n    /* num_default_design_vector == 0 means it is not present */\r\n    /* in the font and associated metrics files               */\r\n    FT_UInt          default_design_vector[T1_MAX_MM_DESIGNS];\r\n    FT_UInt          num_default_design_vector;\r\n\r\n  } PS_BlendRec, *PS_Blend;\r\n\r\n\r\n  /* backwards-compatible definition */\r\n  typedef PS_BlendRec  T1_Blend;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceDictRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to represent data in a CID top-level dictionary.  */\r\n  /*                                                                       */\r\n  typedef struct  CID_FaceDictRec_\r\n  {\r\n    PS_PrivateRec  private_dict;\r\n\r\n    FT_UInt        len_buildchar;\r\n    FT_Fixed       forcebold_threshold;\r\n    FT_Pos         stroke_width;\r\n    FT_Fixed       expansion_factor;\r\n\r\n    FT_Byte        paint_type;\r\n    FT_Byte        font_type;\r\n    FT_Matrix      font_matrix;\r\n    FT_Vector      font_offset;\r\n\r\n    FT_UInt        num_subrs;\r\n    FT_ULong       subrmap_offset;\r\n    FT_Int         sd_bytes;\r\n\r\n  } CID_FaceDictRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceDict                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @CID_FaceDictRec structure.                          */\r\n  /*                                                                       */\r\n  typedef struct CID_FaceDictRec_*  CID_FaceDict;\r\n\r\n  /* */\r\n\r\n\r\n  /* backwards-compatible definition */\r\n  typedef CID_FaceDictRec  CID_FontDict;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceInfoRec                                                    */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to represent CID Face information.                */\r\n  /*                                                                       */\r\n  typedef struct  CID_FaceInfoRec_\r\n  {\r\n    FT_String*      cid_font_name;\r\n    FT_Fixed        cid_version;\r\n    FT_Int          cid_font_type;\r\n\r\n    FT_String*      registry;\r\n    FT_String*      ordering;\r\n    FT_Int          supplement;\r\n\r\n    PS_FontInfoRec  font_info;\r\n    FT_BBox         font_bbox;\r\n    FT_ULong        uid_base;\r\n\r\n    FT_Int          num_xuid;\r\n    FT_ULong        xuid[16];\r\n\r\n    FT_ULong        cidmap_offset;\r\n    FT_Int          fd_bytes;\r\n    FT_Int          gd_bytes;\r\n    FT_ULong        cid_count;\r\n\r\n    FT_Int          num_dicts;\r\n    CID_FaceDict    font_dicts;\r\n\r\n    FT_ULong        data_offset;\r\n\r\n  } CID_FaceInfoRec;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_FaceInfo                                                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A handle to a @CID_FaceInfoRec structure.                          */\r\n  /*                                                                       */\r\n  typedef struct CID_FaceInfoRec_*  CID_FaceInfo;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    CID_Info                                                           */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*   This type is equivalent to @CID_FaceInfoRec.  It is deprecated but  */\r\n  /*   kept to maintain source compatibility between various versions of   */\r\n  /*   FreeType.                                                           */\r\n  /*                                                                       */\r\n  typedef CID_FaceInfoRec  CID_Info;\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Has_PS_Glyph_Names\r\n   *\r\n   * @description:\r\n   *    Return true if a given face provides reliable PostScript glyph\r\n   *    names.  This is similar to using the @FT_HAS_GLYPH_NAMES macro,\r\n   *    except that certain fonts (mostly TrueType) contain incorrect\r\n   *    glyph name tables.\r\n   *\r\n   *    When this function returns true, the caller is sure that the glyph\r\n   *    names returned by @FT_Get_Glyph_Name are reliable.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       face handle\r\n   *\r\n   * @return:\r\n   *    Boolean.  True if glyph names are reliable.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Int )\r\n  FT_Has_PS_Glyph_Names( FT_Face  face );\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_PS_Font_Info\r\n   *\r\n   * @description:\r\n   *    Retrieve the @PS_FontInfoRec structure corresponding to a given\r\n   *    PostScript font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       PostScript face handle.\r\n   *\r\n   * @output:\r\n   *    afont_info ::\r\n   *       Output font info structure pointer.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    The string pointers within the font info structure are owned by\r\n   *    the face and don't need to be freed by the caller.\r\n   *\r\n   *    If the font's format is not PostScript-based, this function will\r\n   *    return the `FT_Err_Invalid_Argument' error code.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PS_Font_Info( FT_Face      face,\r\n                       PS_FontInfo  afont_info );\r\n\r\n\r\n  /************************************************************************\r\n   *\r\n   * @function:\r\n   *    FT_Get_PS_Font_Private\r\n   *\r\n   * @description:\r\n   *    Retrieve the @PS_PrivateRec structure corresponding to a given\r\n   *    PostScript font.\r\n   *\r\n   * @input:\r\n   *    face ::\r\n   *       PostScript face handle.\r\n   *\r\n   * @output:\r\n   *    afont_private ::\r\n   *       Output private dictionary structure pointer.\r\n   *\r\n   * @return:\r\n   *    FreeType error code.  0~means success.\r\n   *\r\n   * @note:\r\n   *    The string pointers within the @PS_PrivateRec structure are owned by\r\n   *    the face and don't need to be freed by the caller.\r\n   *\r\n   *    If the font's format is not PostScript-based, this function returns\r\n   *    the `FT_Err_Invalid_Argument' error code.\r\n   *\r\n   */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Get_PS_Font_Private( FT_Face     face,\r\n                          PS_Private  afont_private );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __T1TABLES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ttnameid.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttnameid.h                                                             */\r\n/*                                                                         */\r\n/*    TrueType name ID definitions (specification only).                   */\r\n/*                                                                         */\r\n/*  Copyright 1996-2002, 2003, 2004, 2006, 2007, 2008 by                   */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTNAMEID_H__\r\n#define __TTNAMEID_H__\r\n\r\n\r\n#include <ft2build.h>\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    truetype_tables                                                    */\r\n  /*                                                                       */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values for the `platform' identifier code in the name        */\r\n  /* records of the TTF `name' table.                                      */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_PLATFORM_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `platform_id' identifier code in\r\n   *   @FT_CharMapRec and @FT_SfntName structures.\r\n   *\r\n   * @values:\r\n   *   TT_PLATFORM_APPLE_UNICODE ::\r\n   *     Used by Apple to indicate a Unicode character map and/or name entry.\r\n   *     See @TT_APPLE_ID_XXX for corresponding `encoding_id' values.  Note\r\n   *     that name entries in this format are coded as big-endian UCS-2\r\n   *     character codes _only_.\r\n   *\r\n   *   TT_PLATFORM_MACINTOSH ::\r\n   *     Used by Apple to indicate a MacOS-specific charmap and/or name entry.\r\n   *     See @TT_MAC_ID_XXX for corresponding `encoding_id' values.  Note that\r\n   *     most TrueType fonts contain an Apple roman charmap to be usable on\r\n   *     MacOS systems (even if they contain a Microsoft charmap as well).\r\n   *\r\n   *   TT_PLATFORM_ISO ::\r\n   *     This value was used to specify ISO/IEC 10646 charmaps.  It is however\r\n   *     now deprecated.  See @TT_ISO_ID_XXX for a list of corresponding\r\n   *     `encoding_id' values.\r\n   *\r\n   *   TT_PLATFORM_MICROSOFT ::\r\n   *     Used by Microsoft to indicate Windows-specific charmaps.  See\r\n   *     @TT_MS_ID_XXX for a list of corresponding `encoding_id' values.\r\n   *     Note that most fonts contain a Unicode charmap using\r\n   *     (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS).\r\n   *\r\n   *   TT_PLATFORM_CUSTOM ::\r\n   *     Used to indicate application-specific charmaps.\r\n   *\r\n   *   TT_PLATFORM_ADOBE ::\r\n   *     This value isn't part of any font format specification, but is used\r\n   *     by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec\r\n   *     structure.  See @TT_ADOBE_ID_XXX.\r\n   */\r\n\r\n#define TT_PLATFORM_APPLE_UNICODE  0\r\n#define TT_PLATFORM_MACINTOSH      1\r\n#define TT_PLATFORM_ISO            2 /* deprecated */\r\n#define TT_PLATFORM_MICROSOFT      3\r\n#define TT_PLATFORM_CUSTOM         4\r\n#define TT_PLATFORM_ADOBE          7 /* artificial */\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_APPLE_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.\r\n   *\r\n   * @values:\r\n   *   TT_APPLE_ID_DEFAULT ::\r\n   *     Unicode version 1.0.\r\n   *\r\n   *   TT_APPLE_ID_UNICODE_1_1 ::\r\n   *     Unicode 1.1; specifies Hangul characters starting at U+34xx.\r\n   *\r\n   *   TT_APPLE_ID_ISO_10646 ::\r\n   *     Deprecated (identical to preceding).\r\n   *\r\n   *   TT_APPLE_ID_UNICODE_2_0 ::\r\n   *     Unicode 2.0 and beyond (UTF-16 BMP only).\r\n   *\r\n   *   TT_APPLE_ID_UNICODE_32 ::\r\n   *     Unicode 3.1 and beyond, using UTF-32.\r\n   *\r\n   *   TT_APPLE_ID_VARIANT_SELECTOR ::\r\n   *     From Adobe, not Apple.  Not a normal cmap.  Specifies variations\r\n   *     on a real cmap.\r\n   */\r\n\r\n#define TT_APPLE_ID_DEFAULT           0 /* Unicode 1.0 */\r\n#define TT_APPLE_ID_UNICODE_1_1       1 /* specify Hangul at U+34xx */\r\n#define TT_APPLE_ID_ISO_10646         2 /* deprecated */\r\n#define TT_APPLE_ID_UNICODE_2_0       3 /* or later */\r\n#define TT_APPLE_ID_UNICODE_32        4 /* 2.0 or later, full repertoire */\r\n#define TT_APPLE_ID_VARIANT_SELECTOR  5 /* variation selector data */\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_MAC_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_MACINTOSH charmaps and name entries.\r\n   *\r\n   * @values:\r\n   *   TT_MAC_ID_ROMAN ::\r\n   *   TT_MAC_ID_JAPANESE ::\r\n   *   TT_MAC_ID_TRADITIONAL_CHINESE ::\r\n   *   TT_MAC_ID_KOREAN ::\r\n   *   TT_MAC_ID_ARABIC ::\r\n   *   TT_MAC_ID_HEBREW ::\r\n   *   TT_MAC_ID_GREEK ::\r\n   *   TT_MAC_ID_RUSSIAN ::\r\n   *   TT_MAC_ID_RSYMBOL ::\r\n   *   TT_MAC_ID_DEVANAGARI ::\r\n   *   TT_MAC_ID_GURMUKHI ::\r\n   *   TT_MAC_ID_GUJARATI ::\r\n   *   TT_MAC_ID_ORIYA ::\r\n   *   TT_MAC_ID_BENGALI ::\r\n   *   TT_MAC_ID_TAMIL ::\r\n   *   TT_MAC_ID_TELUGU ::\r\n   *   TT_MAC_ID_KANNADA ::\r\n   *   TT_MAC_ID_MALAYALAM ::\r\n   *   TT_MAC_ID_SINHALESE ::\r\n   *   TT_MAC_ID_BURMESE ::\r\n   *   TT_MAC_ID_KHMER ::\r\n   *   TT_MAC_ID_THAI ::\r\n   *   TT_MAC_ID_LAOTIAN ::\r\n   *   TT_MAC_ID_GEORGIAN ::\r\n   *   TT_MAC_ID_ARMENIAN ::\r\n   *   TT_MAC_ID_MALDIVIAN ::\r\n   *   TT_MAC_ID_SIMPLIFIED_CHINESE ::\r\n   *   TT_MAC_ID_TIBETAN ::\r\n   *   TT_MAC_ID_MONGOLIAN ::\r\n   *   TT_MAC_ID_GEEZ ::\r\n   *   TT_MAC_ID_SLAVIC ::\r\n   *   TT_MAC_ID_VIETNAMESE ::\r\n   *   TT_MAC_ID_SINDHI ::\r\n   *   TT_MAC_ID_UNINTERP ::\r\n   */\r\n\r\n#define TT_MAC_ID_ROMAN                 0\r\n#define TT_MAC_ID_JAPANESE              1\r\n#define TT_MAC_ID_TRADITIONAL_CHINESE   2\r\n#define TT_MAC_ID_KOREAN                3\r\n#define TT_MAC_ID_ARABIC                4\r\n#define TT_MAC_ID_HEBREW                5\r\n#define TT_MAC_ID_GREEK                 6\r\n#define TT_MAC_ID_RUSSIAN               7\r\n#define TT_MAC_ID_RSYMBOL               8\r\n#define TT_MAC_ID_DEVANAGARI            9\r\n#define TT_MAC_ID_GURMUKHI             10\r\n#define TT_MAC_ID_GUJARATI             11\r\n#define TT_MAC_ID_ORIYA                12\r\n#define TT_MAC_ID_BENGALI              13\r\n#define TT_MAC_ID_TAMIL                14\r\n#define TT_MAC_ID_TELUGU               15\r\n#define TT_MAC_ID_KANNADA              16\r\n#define TT_MAC_ID_MALAYALAM            17\r\n#define TT_MAC_ID_SINHALESE            18\r\n#define TT_MAC_ID_BURMESE              19\r\n#define TT_MAC_ID_KHMER                20\r\n#define TT_MAC_ID_THAI                 21\r\n#define TT_MAC_ID_LAOTIAN              22\r\n#define TT_MAC_ID_GEORGIAN             23\r\n#define TT_MAC_ID_ARMENIAN             24\r\n#define TT_MAC_ID_MALDIVIAN            25\r\n#define TT_MAC_ID_SIMPLIFIED_CHINESE   25\r\n#define TT_MAC_ID_TIBETAN              26\r\n#define TT_MAC_ID_MONGOLIAN            27\r\n#define TT_MAC_ID_GEEZ                 28\r\n#define TT_MAC_ID_SLAVIC               29\r\n#define TT_MAC_ID_VIETNAMESE           30\r\n#define TT_MAC_ID_SINDHI               31\r\n#define TT_MAC_ID_UNINTERP             32\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_ISO_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_ISO charmaps and name entries.\r\n   *\r\n   *   Their use is now deprecated.\r\n   *\r\n   * @values:\r\n   *   TT_ISO_ID_7BIT_ASCII ::\r\n   *     ASCII.\r\n   *   TT_ISO_ID_10646 ::\r\n   *     ISO/10646.\r\n   *   TT_ISO_ID_8859_1 ::\r\n   *     Also known as Latin-1.\r\n   */\r\n\r\n#define TT_ISO_ID_7BIT_ASCII  0\r\n#define TT_ISO_ID_10646       1\r\n#define TT_ISO_ID_8859_1      2\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_MS_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_MICROSOFT charmaps and name entries.\r\n   *\r\n   * @values:\r\n   *   TT_MS_ID_SYMBOL_CS ::\r\n   *     Corresponds to Microsoft symbol encoding. See\r\n   *     @FT_ENCODING_MS_SYMBOL.\r\n   *\r\n   *   TT_MS_ID_UNICODE_CS ::\r\n   *     Corresponds to a Microsoft WGL4 charmap, matching Unicode.  See\r\n   *     @FT_ENCODING_UNICODE.\r\n   *\r\n   *   TT_MS_ID_SJIS ::\r\n   *     Corresponds to SJIS Japanese encoding.  See @FT_ENCODING_SJIS.\r\n   *\r\n   *   TT_MS_ID_GB2312 ::\r\n   *     Corresponds to Simplified Chinese as used in Mainland China.  See\r\n   *     @FT_ENCODING_GB2312.\r\n   *\r\n   *   TT_MS_ID_BIG_5 ::\r\n   *     Corresponds to Traditional Chinese as used in Taiwan and Hong Kong.\r\n   *     See @FT_ENCODING_BIG5.\r\n   *\r\n   *   TT_MS_ID_WANSUNG ::\r\n   *     Corresponds to Korean Wansung encoding.  See @FT_ENCODING_WANSUNG.\r\n   *\r\n   *   TT_MS_ID_JOHAB ::\r\n   *     Corresponds to Johab encoding.  See @FT_ENCODING_JOHAB.\r\n   *\r\n   *   TT_MS_ID_UCS_4 ::\r\n   *     Corresponds to UCS-4 or UTF-32 charmaps.  This has been added to\r\n   *     the OpenType specification version 1.4 (mid-2001.)\r\n   */\r\n\r\n#define TT_MS_ID_SYMBOL_CS    0\r\n#define TT_MS_ID_UNICODE_CS   1\r\n#define TT_MS_ID_SJIS         2\r\n#define TT_MS_ID_GB2312       3\r\n#define TT_MS_ID_BIG_5        4\r\n#define TT_MS_ID_WANSUNG      5\r\n#define TT_MS_ID_JOHAB        6\r\n#define TT_MS_ID_UCS_4       10\r\n\r\n\r\n  /***********************************************************************\r\n   *\r\n   * @enum:\r\n   *   TT_ADOBE_ID_XXX\r\n   *\r\n   * @description:\r\n   *   A list of valid values for the `encoding_id' for\r\n   *   @TT_PLATFORM_ADOBE charmaps.  This is a FreeType-specific extension!\r\n   *\r\n   * @values:\r\n   *   TT_ADOBE_ID_STANDARD ::\r\n   *     Adobe standard encoding.\r\n   *   TT_ADOBE_ID_EXPERT ::\r\n   *     Adobe expert encoding.\r\n   *   TT_ADOBE_ID_CUSTOM ::\r\n   *     Adobe custom encoding.\r\n   *   TT_ADOBE_ID_LATIN_1 ::\r\n   *     Adobe Latin~1 encoding.\r\n   */\r\n\r\n#define TT_ADOBE_ID_STANDARD  0\r\n#define TT_ADOBE_ID_EXPERT    1\r\n#define TT_ADOBE_ID_CUSTOM    2\r\n#define TT_ADOBE_ID_LATIN_1   3\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values of the language identifier field in the name records  */\r\n  /* of the TTF `name' table if the `platform' identifier code is          */\r\n  /* TT_PLATFORM_MACINTOSH.                                                */\r\n  /*                                                                       */\r\n  /* The canonical source for the Apple assigned Language ID's is at       */\r\n  /*                                                                       */\r\n  /*   http://fonts.apple.com/TTRefMan/RM06/Chap6name.html                 */\r\n  /*                                                                       */\r\n#define TT_MAC_LANGID_ENGLISH                       0\r\n#define TT_MAC_LANGID_FRENCH                        1\r\n#define TT_MAC_LANGID_GERMAN                        2\r\n#define TT_MAC_LANGID_ITALIAN                       3\r\n#define TT_MAC_LANGID_DUTCH                         4\r\n#define TT_MAC_LANGID_SWEDISH                       5\r\n#define TT_MAC_LANGID_SPANISH                       6\r\n#define TT_MAC_LANGID_DANISH                        7\r\n#define TT_MAC_LANGID_PORTUGUESE                    8\r\n#define TT_MAC_LANGID_NORWEGIAN                     9\r\n#define TT_MAC_LANGID_HEBREW                       10\r\n#define TT_MAC_LANGID_JAPANESE                     11\r\n#define TT_MAC_LANGID_ARABIC                       12\r\n#define TT_MAC_LANGID_FINNISH                      13\r\n#define TT_MAC_LANGID_GREEK                        14\r\n#define TT_MAC_LANGID_ICELANDIC                    15\r\n#define TT_MAC_LANGID_MALTESE                      16\r\n#define TT_MAC_LANGID_TURKISH                      17\r\n#define TT_MAC_LANGID_CROATIAN                     18\r\n#define TT_MAC_LANGID_CHINESE_TRADITIONAL          19\r\n#define TT_MAC_LANGID_URDU                         20\r\n#define TT_MAC_LANGID_HINDI                        21\r\n#define TT_MAC_LANGID_THAI                         22\r\n#define TT_MAC_LANGID_KOREAN                       23\r\n#define TT_MAC_LANGID_LITHUANIAN                   24\r\n#define TT_MAC_LANGID_POLISH                       25\r\n#define TT_MAC_LANGID_HUNGARIAN                    26\r\n#define TT_MAC_LANGID_ESTONIAN                     27\r\n#define TT_MAC_LANGID_LETTISH                      28\r\n#define TT_MAC_LANGID_SAAMISK                      29\r\n#define TT_MAC_LANGID_FAEROESE                     30\r\n#define TT_MAC_LANGID_FARSI                        31\r\n#define TT_MAC_LANGID_RUSSIAN                      32\r\n#define TT_MAC_LANGID_CHINESE_SIMPLIFIED           33\r\n#define TT_MAC_LANGID_FLEMISH                      34\r\n#define TT_MAC_LANGID_IRISH                        35\r\n#define TT_MAC_LANGID_ALBANIAN                     36\r\n#define TT_MAC_LANGID_ROMANIAN                     37\r\n#define TT_MAC_LANGID_CZECH                        38\r\n#define TT_MAC_LANGID_SLOVAK                       39\r\n#define TT_MAC_LANGID_SLOVENIAN                    40\r\n#define TT_MAC_LANGID_YIDDISH                      41\r\n#define TT_MAC_LANGID_SERBIAN                      42\r\n#define TT_MAC_LANGID_MACEDONIAN                   43\r\n#define TT_MAC_LANGID_BULGARIAN                    44\r\n#define TT_MAC_LANGID_UKRAINIAN                    45\r\n#define TT_MAC_LANGID_BYELORUSSIAN                 46\r\n#define TT_MAC_LANGID_UZBEK                        47\r\n#define TT_MAC_LANGID_KAZAKH                       48\r\n#define TT_MAC_LANGID_AZERBAIJANI                  49\r\n#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT  49\r\n#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT    50\r\n#define TT_MAC_LANGID_ARMENIAN                     51\r\n#define TT_MAC_LANGID_GEORGIAN                     52\r\n#define TT_MAC_LANGID_MOLDAVIAN                    53\r\n#define TT_MAC_LANGID_KIRGHIZ                      54\r\n#define TT_MAC_LANGID_TAJIKI                       55\r\n#define TT_MAC_LANGID_TURKMEN                      56\r\n#define TT_MAC_LANGID_MONGOLIAN                    57\r\n#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT   57\r\n#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT    58\r\n#define TT_MAC_LANGID_PASHTO                       59\r\n#define TT_MAC_LANGID_KURDISH                      60\r\n#define TT_MAC_LANGID_KASHMIRI                     61\r\n#define TT_MAC_LANGID_SINDHI                       62\r\n#define TT_MAC_LANGID_TIBETAN                      63\r\n#define TT_MAC_LANGID_NEPALI                       64\r\n#define TT_MAC_LANGID_SANSKRIT                     65\r\n#define TT_MAC_LANGID_MARATHI                      66\r\n#define TT_MAC_LANGID_BENGALI                      67\r\n#define TT_MAC_LANGID_ASSAMESE                     68\r\n#define TT_MAC_LANGID_GUJARATI                     69\r\n#define TT_MAC_LANGID_PUNJABI                      70\r\n#define TT_MAC_LANGID_ORIYA                        71\r\n#define TT_MAC_LANGID_MALAYALAM                    72\r\n#define TT_MAC_LANGID_KANNADA                      73\r\n#define TT_MAC_LANGID_TAMIL                        74\r\n#define TT_MAC_LANGID_TELUGU                       75\r\n#define TT_MAC_LANGID_SINHALESE                    76\r\n#define TT_MAC_LANGID_BURMESE                      77\r\n#define TT_MAC_LANGID_KHMER                        78\r\n#define TT_MAC_LANGID_LAO                          79\r\n#define TT_MAC_LANGID_VIETNAMESE                   80\r\n#define TT_MAC_LANGID_INDONESIAN                   81\r\n#define TT_MAC_LANGID_TAGALOG                      82\r\n#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT           83\r\n#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT          84\r\n#define TT_MAC_LANGID_AMHARIC                      85\r\n#define TT_MAC_LANGID_TIGRINYA                     86\r\n#define TT_MAC_LANGID_GALLA                        87\r\n#define TT_MAC_LANGID_SOMALI                       88\r\n#define TT_MAC_LANGID_SWAHILI                      89\r\n#define TT_MAC_LANGID_RUANDA                       90\r\n#define TT_MAC_LANGID_RUNDI                        91\r\n#define TT_MAC_LANGID_CHEWA                        92\r\n#define TT_MAC_LANGID_MALAGASY                     93\r\n#define TT_MAC_LANGID_ESPERANTO                    94\r\n#define TT_MAC_LANGID_WELSH                       128\r\n#define TT_MAC_LANGID_BASQUE                      129\r\n#define TT_MAC_LANGID_CATALAN                     130\r\n#define TT_MAC_LANGID_LATIN                       131\r\n#define TT_MAC_LANGID_QUECHUA                     132\r\n#define TT_MAC_LANGID_GUARANI                     133\r\n#define TT_MAC_LANGID_AYMARA                      134\r\n#define TT_MAC_LANGID_TATAR                       135\r\n#define TT_MAC_LANGID_UIGHUR                      136\r\n#define TT_MAC_LANGID_DZONGKHA                    137\r\n#define TT_MAC_LANGID_JAVANESE                    138\r\n#define TT_MAC_LANGID_SUNDANESE                   139\r\n\r\n\r\n#if 0  /* these seem to be errors that have been dropped */\r\n\r\n#define TT_MAC_LANGID_SCOTTISH_GAELIC             140\r\n#define TT_MAC_LANGID_IRISH_GAELIC                141\r\n\r\n#endif\r\n\r\n\r\n  /* The following codes are new as of 2000-03-10 */\r\n#define TT_MAC_LANGID_GALICIAN                    140\r\n#define TT_MAC_LANGID_AFRIKAANS                   141\r\n#define TT_MAC_LANGID_BRETON                      142\r\n#define TT_MAC_LANGID_INUKTITUT                   143\r\n#define TT_MAC_LANGID_SCOTTISH_GAELIC             144\r\n#define TT_MAC_LANGID_MANX_GAELIC                 145\r\n#define TT_MAC_LANGID_IRISH_GAELIC                146\r\n#define TT_MAC_LANGID_TONGAN                      147\r\n#define TT_MAC_LANGID_GREEK_POLYTONIC             148\r\n#define TT_MAC_LANGID_GREELANDIC                  149\r\n#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT    150\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values of the language identifier field in the name records  */\r\n  /* of the TTF `name' table if the `platform' identifier code is          */\r\n  /* TT_PLATFORM_MICROSOFT.                                                */\r\n  /*                                                                       */\r\n  /* The canonical source for the MS assigned LCID's (seems to) be at      */\r\n  /*                                                                       */\r\n  /*   http://www.microsoft.com/globaldev/reference/lcid-all.mspx          */\r\n  /*                                                                       */\r\n  /* It used to be at various places, among them                           */\r\n  /*                                                                       */\r\n  /*   http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt              */\r\n  /*   http://www.microsoft.com/globaldev/reference/loclanghome.asp        */\r\n  /*   http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP      */\r\n  /*   http://msdn.microsoft.com/library/en-us/passport25/                 */\r\n  /*           NET_Passport_VBScript_Documentation/Single_Sign_In/         */\r\n  /*           Advanced_Single_Sign_In/Localization_and_LCIDs.asp          */\r\n  /*                                                                       */\r\n  /* Hopefully, it seems now that the Globaldev site prevails...           */\r\n  /*                                   (updated by Antoine, 2004-02-17)    */\r\n\r\n#define TT_MS_LANGID_ARABIC_GENERAL                    0x0001\r\n#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA               0x0401\r\n#define TT_MS_LANGID_ARABIC_IRAQ                       0x0801\r\n#define TT_MS_LANGID_ARABIC_EGYPT                      0x0c01\r\n#define TT_MS_LANGID_ARABIC_LIBYA                      0x1001\r\n#define TT_MS_LANGID_ARABIC_ALGERIA                    0x1401\r\n#define TT_MS_LANGID_ARABIC_MOROCCO                    0x1801\r\n#define TT_MS_LANGID_ARABIC_TUNISIA                    0x1c01\r\n#define TT_MS_LANGID_ARABIC_OMAN                       0x2001\r\n#define TT_MS_LANGID_ARABIC_YEMEN                      0x2401\r\n#define TT_MS_LANGID_ARABIC_SYRIA                      0x2801\r\n#define TT_MS_LANGID_ARABIC_JORDAN                     0x2c01\r\n#define TT_MS_LANGID_ARABIC_LEBANON                    0x3001\r\n#define TT_MS_LANGID_ARABIC_KUWAIT                     0x3401\r\n#define TT_MS_LANGID_ARABIC_UAE                        0x3801\r\n#define TT_MS_LANGID_ARABIC_BAHRAIN                    0x3c01\r\n#define TT_MS_LANGID_ARABIC_QATAR                      0x4001\r\n#define TT_MS_LANGID_BULGARIAN_BULGARIA                0x0402\r\n#define TT_MS_LANGID_CATALAN_SPAIN                     0x0403\r\n#define TT_MS_LANGID_CHINESE_GENERAL                   0x0004\r\n#define TT_MS_LANGID_CHINESE_TAIWAN                    0x0404\r\n#define TT_MS_LANGID_CHINESE_PRC                       0x0804\r\n#define TT_MS_LANGID_CHINESE_HONG_KONG                 0x0c04\r\n#define TT_MS_LANGID_CHINESE_SINGAPORE                 0x1004\r\n\r\n#if 1  /* this looks like the correct value */\r\n#define TT_MS_LANGID_CHINESE_MACAU                     0x1404\r\n#else  /* but beware, Microsoft may change its mind...\r\n          the most recent Word reference has the following: */\r\n#define TT_MS_LANGID_CHINESE_MACAU  TT_MS_LANGID_CHINESE_HONG_KONG\r\n#endif\r\n\r\n#if 0  /* used only with .NET `cultures'; commented out */\r\n#define TT_MS_LANGID_CHINESE_TRADITIONAL               0x7C04\r\n#endif\r\n\r\n#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC              0x0405\r\n#define TT_MS_LANGID_DANISH_DENMARK                    0x0406\r\n#define TT_MS_LANGID_GERMAN_GERMANY                    0x0407\r\n#define TT_MS_LANGID_GERMAN_SWITZERLAND                0x0807\r\n#define TT_MS_LANGID_GERMAN_AUSTRIA                    0x0c07\r\n#define TT_MS_LANGID_GERMAN_LUXEMBOURG                 0x1007\r\n#define TT_MS_LANGID_GERMAN_LIECHTENSTEI               0x1407\r\n#define TT_MS_LANGID_GREEK_GREECE                      0x0408\r\n\r\n  /* don't ask what this one means... It is commented out currently. */\r\n#if 0\r\n#define TT_MS_LANGID_GREEK_GREECE2                     0x2008\r\n#endif\r\n\r\n#define TT_MS_LANGID_ENGLISH_GENERAL                   0x0009\r\n#define TT_MS_LANGID_ENGLISH_UNITED_STATES             0x0409\r\n#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM            0x0809\r\n#define TT_MS_LANGID_ENGLISH_AUSTRALIA                 0x0c09\r\n#define TT_MS_LANGID_ENGLISH_CANADA                    0x1009\r\n#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND               0x1409\r\n#define TT_MS_LANGID_ENGLISH_IRELAND                   0x1809\r\n#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA              0x1c09\r\n#define TT_MS_LANGID_ENGLISH_JAMAICA                   0x2009\r\n#define TT_MS_LANGID_ENGLISH_CARIBBEAN                 0x2409\r\n#define TT_MS_LANGID_ENGLISH_BELIZE                    0x2809\r\n#define TT_MS_LANGID_ENGLISH_TRINIDAD                  0x2c09\r\n#define TT_MS_LANGID_ENGLISH_ZIMBABWE                  0x3009\r\n#define TT_MS_LANGID_ENGLISH_PHILIPPINES               0x3409\r\n#define TT_MS_LANGID_ENGLISH_INDONESIA                 0x3809\r\n#define TT_MS_LANGID_ENGLISH_HONG_KONG                 0x3c09\r\n#define TT_MS_LANGID_ENGLISH_INDIA                     0x4009\r\n#define TT_MS_LANGID_ENGLISH_MALAYSIA                  0x4409\r\n#define TT_MS_LANGID_ENGLISH_SINGAPORE                 0x4809\r\n#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT    0x040a\r\n#define TT_MS_LANGID_SPANISH_MEXICO                    0x080a\r\n#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT  0x0c0a\r\n#define TT_MS_LANGID_SPANISH_GUATEMALA                 0x100a\r\n#define TT_MS_LANGID_SPANISH_COSTA_RICA                0x140a\r\n#define TT_MS_LANGID_SPANISH_PANAMA                    0x180a\r\n#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC        0x1c0a\r\n#define TT_MS_LANGID_SPANISH_VENEZUELA                 0x200a\r\n#define TT_MS_LANGID_SPANISH_COLOMBIA                  0x240a\r\n#define TT_MS_LANGID_SPANISH_PERU                      0x280a\r\n#define TT_MS_LANGID_SPANISH_ARGENTINA                 0x2c0a\r\n#define TT_MS_LANGID_SPANISH_ECUADOR                   0x300a\r\n#define TT_MS_LANGID_SPANISH_CHILE                     0x340a\r\n#define TT_MS_LANGID_SPANISH_URUGUAY                   0x380a\r\n#define TT_MS_LANGID_SPANISH_PARAGUAY                  0x3c0a\r\n#define TT_MS_LANGID_SPANISH_BOLIVIA                   0x400a\r\n#define TT_MS_LANGID_SPANISH_EL_SALVADOR               0x440a\r\n#define TT_MS_LANGID_SPANISH_HONDURAS                  0x480a\r\n#define TT_MS_LANGID_SPANISH_NICARAGUA                 0x4c0a\r\n#define TT_MS_LANGID_SPANISH_PUERTO_RICO               0x500a\r\n#define TT_MS_LANGID_SPANISH_UNITED_STATES             0x540a\r\n  /* The following ID blatantly violate MS specs by using a */\r\n  /* sublanguage > 0x1F.                                    */\r\n#define TT_MS_LANGID_SPANISH_LATIN_AMERICA             0xE40aU\r\n#define TT_MS_LANGID_FINNISH_FINLAND                   0x040b\r\n#define TT_MS_LANGID_FRENCH_FRANCE                     0x040c\r\n#define TT_MS_LANGID_FRENCH_BELGIUM                    0x080c\r\n#define TT_MS_LANGID_FRENCH_CANADA                     0x0c0c\r\n#define TT_MS_LANGID_FRENCH_SWITZERLAND                0x100c\r\n#define TT_MS_LANGID_FRENCH_LUXEMBOURG                 0x140c\r\n#define TT_MS_LANGID_FRENCH_MONACO                     0x180c\r\n#define TT_MS_LANGID_FRENCH_WEST_INDIES                0x1c0c\r\n#define TT_MS_LANGID_FRENCH_REUNION                    0x200c\r\n#define TT_MS_LANGID_FRENCH_CONGO                      0x240c\r\n  /* which was formerly: */\r\n#define TT_MS_LANGID_FRENCH_ZAIRE  TT_MS_LANGID_FRENCH_CONGO\r\n#define TT_MS_LANGID_FRENCH_SENEGAL                    0x280c\r\n#define TT_MS_LANGID_FRENCH_CAMEROON                   0x2c0c\r\n#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE              0x300c\r\n#define TT_MS_LANGID_FRENCH_MALI                       0x340c\r\n#define TT_MS_LANGID_FRENCH_MOROCCO                    0x380c\r\n#define TT_MS_LANGID_FRENCH_HAITI                      0x3c0c\r\n  /* and another violation of the spec (see 0xE40aU) */\r\n#define TT_MS_LANGID_FRENCH_NORTH_AFRICA               0xE40cU\r\n#define TT_MS_LANGID_HEBREW_ISRAEL                     0x040d\r\n#define TT_MS_LANGID_HUNGARIAN_HUNGARY                 0x040e\r\n#define TT_MS_LANGID_ICELANDIC_ICELAND                 0x040f\r\n#define TT_MS_LANGID_ITALIAN_ITALY                     0x0410\r\n#define TT_MS_LANGID_ITALIAN_SWITZERLAND               0x0810\r\n#define TT_MS_LANGID_JAPANESE_JAPAN                    0x0411\r\n#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA     0x0412\r\n#define TT_MS_LANGID_KOREAN_JOHAB_KOREA                0x0812\r\n#define TT_MS_LANGID_DUTCH_NETHERLANDS                 0x0413\r\n#define TT_MS_LANGID_DUTCH_BELGIUM                     0x0813\r\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL           0x0414\r\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK          0x0814\r\n#define TT_MS_LANGID_POLISH_POLAND                     0x0415\r\n#define TT_MS_LANGID_PORTUGUESE_BRAZIL                 0x0416\r\n#define TT_MS_LANGID_PORTUGUESE_PORTUGAL               0x0816\r\n#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND        0x0417\r\n#define TT_MS_LANGID_ROMANIAN_ROMANIA                  0x0418\r\n#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA                0x0818\r\n#define TT_MS_LANGID_RUSSIAN_RUSSIA                    0x0419\r\n#define TT_MS_LANGID_RUSSIAN_MOLDAVIA                  0x0819\r\n#define TT_MS_LANGID_CROATIAN_CROATIA                  0x041a\r\n#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN              0x081a\r\n#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC           0x0c1a\r\n\r\n#if 0  /* this used to be this value, but it looks like we were wrong */\r\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA        0x101a\r\n#else  /* current sources say */\r\n#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA       0x101a\r\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA        0x141a\r\n       /* and XPsp2 Platform SDK added (2004-07-26) */\r\n       /* Names are shortened to be significant within 40 chars. */\r\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN         0x181a\r\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC      0x181a\r\n#endif\r\n\r\n#define TT_MS_LANGID_SLOVAK_SLOVAKIA                   0x041b\r\n#define TT_MS_LANGID_ALBANIAN_ALBANIA                  0x041c\r\n#define TT_MS_LANGID_SWEDISH_SWEDEN                    0x041d\r\n#define TT_MS_LANGID_SWEDISH_FINLAND                   0x081d\r\n#define TT_MS_LANGID_THAI_THAILAND                     0x041e\r\n#define TT_MS_LANGID_TURKISH_TURKEY                    0x041f\r\n#define TT_MS_LANGID_URDU_PAKISTAN                     0x0420\r\n#define TT_MS_LANGID_URDU_INDIA                        0x0820\r\n#define TT_MS_LANGID_INDONESIAN_INDONESIA              0x0421\r\n#define TT_MS_LANGID_UKRAINIAN_UKRAINE                 0x0422\r\n#define TT_MS_LANGID_BELARUSIAN_BELARUS                0x0423\r\n#define TT_MS_LANGID_SLOVENE_SLOVENIA                  0x0424\r\n#define TT_MS_LANGID_ESTONIAN_ESTONIA                  0x0425\r\n#define TT_MS_LANGID_LATVIAN_LATVIA                    0x0426\r\n#define TT_MS_LANGID_LITHUANIAN_LITHUANIA              0x0427\r\n#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA      0x0827\r\n#define TT_MS_LANGID_TAJIK_TAJIKISTAN                  0x0428\r\n#define TT_MS_LANGID_FARSI_IRAN                        0x0429\r\n#define TT_MS_LANGID_VIETNAMESE_VIET_NAM               0x042a\r\n#define TT_MS_LANGID_ARMENIAN_ARMENIA                  0x042b\r\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN            0x042c\r\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC         0x082c\r\n#define TT_MS_LANGID_BASQUE_SPAIN                      0x042d\r\n#define TT_MS_LANGID_SORBIAN_GERMANY                   0x042e\r\n#define TT_MS_LANGID_MACEDONIAN_MACEDONIA              0x042f\r\n#define TT_MS_LANGID_SUTU_SOUTH_AFRICA                 0x0430\r\n#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA               0x0431\r\n#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA               0x0432\r\n#define TT_MS_LANGID_VENDA_SOUTH_AFRICA                0x0433\r\n#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA                0x0434\r\n#define TT_MS_LANGID_ZULU_SOUTH_AFRICA                 0x0435\r\n#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA            0x0436\r\n#define TT_MS_LANGID_GEORGIAN_GEORGIA                  0x0437\r\n#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS           0x0438\r\n#define TT_MS_LANGID_HINDI_INDIA                       0x0439\r\n#define TT_MS_LANGID_MALTESE_MALTA                     0x043a\r\n  /* Added by XPsp2 Platform SDK (2004-07-26) */\r\n#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY              0x043b\r\n#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN              0x083b\r\n#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND             0x0C3b\r\n#define TT_MS_LANGID_SAMI_LULE_NORWAY                  0x103b\r\n#define TT_MS_LANGID_SAMI_LULE_SWEDEN                  0x143b\r\n#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY              0x183b\r\n#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN              0x1C3b\r\n#define TT_MS_LANGID_SAMI_SKOLT_FINLAND                0x203b\r\n#define TT_MS_LANGID_SAMI_INARI_FINLAND                0x243b\r\n  /* ... and we also keep our old identifier... */\r\n#define TT_MS_LANGID_SAAMI_LAPONIA                     0x043b\r\n\r\n#if 0 /* this seems to be a previous inversion */\r\n#define TT_MS_LANGID_IRISH_GAELIC_IRELAND              0x043c\r\n#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM    0x083c\r\n#else\r\n#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM    0x083c\r\n#define TT_MS_LANGID_IRISH_GAELIC_IRELAND              0x043c\r\n#endif\r\n\r\n#define TT_MS_LANGID_YIDDISH_GERMANY                   0x043d\r\n#define TT_MS_LANGID_MALAY_MALAYSIA                    0x043e\r\n#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM           0x083e\r\n#define TT_MS_LANGID_KAZAK_KAZAKSTAN                   0x043f\r\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440\r\n  /* alias declared in Windows 2000 */\r\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \\\r\n          TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN\r\n\r\n#define TT_MS_LANGID_SWAHILI_KENYA                     0x0441\r\n#define TT_MS_LANGID_TURKMEN_TURKMENISTAN              0x0442\r\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN            0x0443\r\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC         0x0843\r\n#define TT_MS_LANGID_TATAR_TATARSTAN                   0x0444\r\n#define TT_MS_LANGID_BENGALI_INDIA                     0x0445\r\n#define TT_MS_LANGID_BENGALI_BANGLADESH                0x0845\r\n#define TT_MS_LANGID_PUNJABI_INDIA                     0x0446\r\n#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN           0x0846\r\n#define TT_MS_LANGID_GUJARATI_INDIA                    0x0447\r\n#define TT_MS_LANGID_ORIYA_INDIA                       0x0448\r\n#define TT_MS_LANGID_TAMIL_INDIA                       0x0449\r\n#define TT_MS_LANGID_TELUGU_INDIA                      0x044a\r\n#define TT_MS_LANGID_KANNADA_INDIA                     0x044b\r\n#define TT_MS_LANGID_MALAYALAM_INDIA                   0x044c\r\n#define TT_MS_LANGID_ASSAMESE_INDIA                    0x044d\r\n#define TT_MS_LANGID_MARATHI_INDIA                     0x044e\r\n#define TT_MS_LANGID_SANSKRIT_INDIA                    0x044f\r\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450\r\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN      0x0850\r\n#define TT_MS_LANGID_TIBETAN_CHINA                     0x0451\r\n  /* Don't use the next constant!  It has            */\r\n  /*   (1) the wrong spelling (Dzonghka)             */\r\n  /*   (2) Microsoft doesn't officially define it -- */\r\n  /*       at least it is not in the List of Local   */\r\n  /*       ID Values.                                */\r\n  /*   (3) Dzongkha is not the same language as      */\r\n  /*       Tibetan, so merging it is wrong anyway.   */\r\n  /*                                                 */\r\n  /* TT_MS_LANGID_TIBETAN_BHUTAN is correct, BTW.    */\r\n#define TT_MS_LANGID_DZONGHKA_BHUTAN                   0x0851\r\n\r\n#if 0\r\n  /* the following used to be defined */\r\n#define TT_MS_LANGID_TIBETAN_BHUTAN                    0x0451\r\n  /* ... but it was changed; */\r\n#else\r\n  /* So we will continue to #define it, but with the correct value */\r\n#define TT_MS_LANGID_TIBETAN_BHUTAN   TT_MS_LANGID_DZONGHKA_BHUTAN\r\n#endif\r\n\r\n#define TT_MS_LANGID_WELSH_WALES                       0x0452\r\n#define TT_MS_LANGID_KHMER_CAMBODIA                    0x0453\r\n#define TT_MS_LANGID_LAO_LAOS                          0x0454\r\n#define TT_MS_LANGID_BURMESE_MYANMAR                   0x0455\r\n#define TT_MS_LANGID_GALICIAN_SPAIN                    0x0456\r\n#define TT_MS_LANGID_KONKANI_INDIA                     0x0457\r\n#define TT_MS_LANGID_MANIPURI_INDIA  /* Bengali */     0x0458\r\n#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */         0x0459\r\n#define TT_MS_LANGID_SINDHI_PAKISTAN                   0x0859\r\n  /* Missing a LCID for Sindhi in Devanagari script */\r\n#define TT_MS_LANGID_SYRIAC_SYRIA                      0x045a\r\n#define TT_MS_LANGID_SINHALESE_SRI_LANKA               0x045b\r\n#define TT_MS_LANGID_CHEROKEE_UNITED_STATES            0x045c\r\n#define TT_MS_LANGID_INUKTITUT_CANADA                  0x045d\r\n#define TT_MS_LANGID_AMHARIC_ETHIOPIA                  0x045e\r\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */    0x045f\r\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN           0x085f\r\n  /* Missing a LCID for Tifinagh script */\r\n#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */    0x0460\r\n  /* Spelled this way by XPsp2 Platform SDK (2004-07-26) */\r\n  /* script is yet unclear... might be Arabic, Nagari or Sharada */\r\n#define TT_MS_LANGID_KASHMIRI_SASIA                    0x0860\r\n  /* ... and aliased (by MS) for compatibility reasons. */\r\n#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA\r\n#define TT_MS_LANGID_NEPALI_NEPAL                      0x0461\r\n#define TT_MS_LANGID_NEPALI_INDIA                      0x0861\r\n#define TT_MS_LANGID_FRISIAN_NETHERLANDS               0x0462\r\n#define TT_MS_LANGID_PASHTO_AFGHANISTAN                0x0463\r\n#define TT_MS_LANGID_FILIPINO_PHILIPPINES              0x0464\r\n#define TT_MS_LANGID_DHIVEHI_MALDIVES                  0x0465\r\n  /* alias declared in Windows 2000 */\r\n#define TT_MS_LANGID_DIVEHI_MALDIVES  TT_MS_LANGID_DHIVEHI_MALDIVES\r\n#define TT_MS_LANGID_EDO_NIGERIA                       0x0466\r\n#define TT_MS_LANGID_FULFULDE_NIGERIA                  0x0467\r\n#define TT_MS_LANGID_HAUSA_NIGERIA                     0x0468\r\n#define TT_MS_LANGID_IBIBIO_NIGERIA                    0x0469\r\n#define TT_MS_LANGID_YORUBA_NIGERIA                    0x046a\r\n#define TT_MS_LANGID_QUECHUA_BOLIVIA                   0x046b\r\n#define TT_MS_LANGID_QUECHUA_ECUADOR                   0x086b\r\n#define TT_MS_LANGID_QUECHUA_PERU                      0x0c6b\r\n#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA               0x046c\r\n  /* Also spelled by XPsp2 Platform SDK (2004-07-26) */\r\n#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \\\r\n          TT_MS_LANGID_SEPEDI_SOUTH_AFRICA\r\n  /* language codes 0x046d, 0x046e and 0x046f are (still) unknown. */\r\n#define TT_MS_LANGID_IGBO_NIGERIA                      0x0470\r\n#define TT_MS_LANGID_KANURI_NIGERIA                    0x0471\r\n#define TT_MS_LANGID_OROMO_ETHIOPIA                    0x0472\r\n#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA                 0x0473\r\n#define TT_MS_LANGID_TIGRIGNA_ERYTHREA                 0x0873\r\n  /* also spelled in the `Passport SDK' list as: */\r\n#define TT_MS_LANGID_TIGRIGNA_ERYTREA  TT_MS_LANGID_TIGRIGNA_ERYTHREA\r\n#define TT_MS_LANGID_GUARANI_PARAGUAY                  0x0474\r\n#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES            0x0475\r\n#define TT_MS_LANGID_LATIN                             0x0476\r\n#define TT_MS_LANGID_SOMALI_SOMALIA                    0x0477\r\n  /* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */\r\n  /*       not written (but OTOH the peculiar writing system is worth     */\r\n  /*       studying).                                                     */\r\n#define TT_MS_LANGID_YI_CHINA                          0x0478\r\n#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES   0x0479\r\n  /* language codes from 0x047a to 0x047f are (still) unknown. */\r\n#define TT_MS_LANGID_UIGHUR_CHINA                      0x0480\r\n#define TT_MS_LANGID_MAORI_NEW_ZEALAND                 0x0481\r\n\r\n#if 0  /* not deemed useful for fonts */\r\n#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE            0x04ff\r\n#endif\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Possible values of the `name' identifier field in the name records of */\r\n  /* the TTF `name' table.  These values are platform independent.         */\r\n  /*                                                                       */\r\n#define TT_NAME_ID_COPYRIGHT            0\r\n#define TT_NAME_ID_FONT_FAMILY          1\r\n#define TT_NAME_ID_FONT_SUBFAMILY       2\r\n#define TT_NAME_ID_UNIQUE_ID            3\r\n#define TT_NAME_ID_FULL_NAME            4\r\n#define TT_NAME_ID_VERSION_STRING       5\r\n#define TT_NAME_ID_PS_NAME              6\r\n#define TT_NAME_ID_TRADEMARK            7\r\n\r\n  /* the following values are from the OpenType spec */\r\n#define TT_NAME_ID_MANUFACTURER         8\r\n#define TT_NAME_ID_DESIGNER             9\r\n#define TT_NAME_ID_DESCRIPTION          10\r\n#define TT_NAME_ID_VENDOR_URL           11\r\n#define TT_NAME_ID_DESIGNER_URL         12\r\n#define TT_NAME_ID_LICENSE              13\r\n#define TT_NAME_ID_LICENSE_URL          14\r\n  /* number 15 is reserved */\r\n#define TT_NAME_ID_PREFERRED_FAMILY     16\r\n#define TT_NAME_ID_PREFERRED_SUBFAMILY  17\r\n#define TT_NAME_ID_MAC_FULL_NAME        18\r\n\r\n  /* The following code is new as of 2000-01-21 */\r\n#define TT_NAME_ID_SAMPLE_TEXT          19\r\n\r\n  /* This is new in OpenType 1.3 */\r\n#define TT_NAME_ID_CID_FINDFONT_NAME    20\r\n\r\n  /* This is new in OpenType 1.5 */\r\n#define TT_NAME_ID_WWS_FAMILY           21\r\n#define TT_NAME_ID_WWS_SUBFAMILY        22\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table.     */\r\n  /*                                                                       */\r\n  /* Updated 08-Nov-2008.                                                  */\r\n  /*                                                                       */\r\n\r\n  /* Bit  0   Basic Latin */\r\n#define TT_UCR_BASIC_LATIN                     (1L <<  0) /* U+0020-U+007E */\r\n  /* Bit  1   C1 Controls and Latin-1 Supplement */\r\n#define TT_UCR_LATIN1_SUPPLEMENT               (1L <<  1) /* U+0080-U+00FF */\r\n  /* Bit  2   Latin Extended-A */\r\n#define TT_UCR_LATIN_EXTENDED_A                (1L <<  2) /* U+0100-U+017F */\r\n  /* Bit  3   Latin Extended-B */\r\n#define TT_UCR_LATIN_EXTENDED_B                (1L <<  3) /* U+0180-U+024F */\r\n  /* Bit  4   IPA Extensions                 */\r\n  /*          Phonetic Extensions            */\r\n  /*          Phonetic Extensions Supplement */\r\n#define TT_UCR_IPA_EXTENSIONS                  (1L <<  4) /* U+0250-U+02AF */\r\n                                                          /* U+1D00-U+1D7F */\r\n                                                          /* U+1D80-U+1DBF */\r\n  /* Bit  5   Spacing Modifier Letters */\r\n  /*          Modifier Tone Letters    */\r\n#define TT_UCR_SPACING_MODIFIER                (1L <<  5) /* U+02B0-U+02FF */\r\n                                                          /* U+A700-U+A71F */\r\n  /* Bit  6   Combining Diacritical Marks            */\r\n  /*          Combining Diacritical Marks Supplement */\r\n#define TT_UCR_COMBINING_DIACRITICS            (1L <<  6) /* U+0300-U+036F */\r\n                                                          /* U+1DC0-U+1DFF */\r\n  /* Bit  7   Greek and Coptic */\r\n#define TT_UCR_GREEK                           (1L <<  7) /* U+0370-U+03FF */\r\n  /* Bit  8   Coptic */\r\n#define TT_UCR_COPTIC                          (1L <<  8) /* U+2C80-U+2CFF */\r\n  /* Bit  9   Cyrillic            */\r\n  /*          Cyrillic Supplement */\r\n  /*          Cyrillic Extended-A */\r\n  /*          Cyrillic Extended-B */\r\n#define TT_UCR_CYRILLIC                        (1L <<  9) /* U+0400-U+04FF */\r\n                                                          /* U+0500-U+052F */\r\n                                                          /* U+2DE0-U+2DFF */\r\n                                                          /* U+A640-U+A69F */\r\n  /* Bit 10   Armenian */\r\n#define TT_UCR_ARMENIAN                        (1L << 10) /* U+0530-U+058F */\r\n  /* Bit 11   Hebrew */\r\n#define TT_UCR_HEBREW                          (1L << 11) /* U+0590-U+05FF */\r\n  /* Bit 12   Vai */\r\n#define TT_UCR_VAI                             (1L << 12) /* U+A500-U+A63F */\r\n  /* Bit 13   Arabic            */\r\n  /*          Arabic Supplement */\r\n#define TT_UCR_ARABIC                          (1L << 13) /* U+0600-U+06FF */\r\n                                                          /* U+0750-U+077F */\r\n  /* Bit 14   NKo */\r\n#define TT_UCR_NKO                             (1L << 14) /* U+07C0-U+07FF */\r\n  /* Bit 15   Devanagari */\r\n#define TT_UCR_DEVANAGARI                      (1L << 15) /* U+0900-U+097F */\r\n  /* Bit 16   Bengali */\r\n#define TT_UCR_BENGALI                         (1L << 16) /* U+0980-U+09FF */\r\n  /* Bit 17   Gurmukhi */\r\n#define TT_UCR_GURMUKHI                        (1L << 17) /* U+0A00-U+0A7F */\r\n  /* Bit 18   Gujarati */\r\n#define TT_UCR_GUJARATI                        (1L << 18) /* U+0A80-U+0AFF */\r\n  /* Bit 19   Oriya */\r\n#define TT_UCR_ORIYA                           (1L << 19) /* U+0B00-U+0B7F */\r\n  /* Bit 20   Tamil */\r\n#define TT_UCR_TAMIL                           (1L << 20) /* U+0B80-U+0BFF */\r\n  /* Bit 21   Telugu */\r\n#define TT_UCR_TELUGU                          (1L << 21) /* U+0C00-U+0C7F */\r\n  /* Bit 22   Kannada */\r\n#define TT_UCR_KANNADA                         (1L << 22) /* U+0C80-U+0CFF */\r\n  /* Bit 23   Malayalam */\r\n#define TT_UCR_MALAYALAM                       (1L << 23) /* U+0D00-U+0D7F */\r\n  /* Bit 24   Thai */\r\n#define TT_UCR_THAI                            (1L << 24) /* U+0E00-U+0E7F */\r\n  /* Bit 25   Lao */\r\n#define TT_UCR_LAO                             (1L << 25) /* U+0E80-U+0EFF */\r\n  /* Bit 26   Georgian            */\r\n  /*          Georgian Supplement */\r\n#define TT_UCR_GEORGIAN                        (1L << 26) /* U+10A0-U+10FF */\r\n                                                          /* U+2D00-U+2D2F */\r\n  /* Bit 27   Balinese */\r\n#define TT_UCR_BALINESE                        (1L << 27) /* U+1B00-U+1B7F */\r\n  /* Bit 28   Hangul Jamo */\r\n#define TT_UCR_HANGUL_JAMO                     (1L << 28) /* U+1100-U+11FF */\r\n  /* Bit 29   Latin Extended Additional */\r\n  /*          Latin Extended-C          */\r\n  /*          Latin Extended-D          */\r\n#define TT_UCR_LATIN_EXTENDED_ADDITIONAL       (1L << 29) /* U+1E00-U+1EFF */\r\n                                                          /* U+2C60-U+2C7F */\r\n                                                          /* U+A720-U+A7FF */\r\n  /* Bit 30   Greek Extended */\r\n#define TT_UCR_GREEK_EXTENDED                  (1L << 30) /* U+1F00-U+1FFF */\r\n  /* Bit 31   General Punctuation      */\r\n  /*          Supplemental Punctuation */\r\n#define TT_UCR_GENERAL_PUNCTUATION             (1L << 31) /* U+2000-U+206F */\r\n                                                          /* U+2E00-U+2E7F */\r\n  /* Bit 32   Superscripts And Subscripts */\r\n#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS         (1L <<  0) /* U+2070-U+209F */\r\n  /* Bit 33   Currency Symbols */\r\n#define TT_UCR_CURRENCY_SYMBOLS                (1L <<  1) /* U+20A0-U+20CF */\r\n  /* Bit 34   Combining Diacritical Marks For Symbols */\r\n#define TT_UCR_COMBINING_DIACRITICS_SYMB       (1L <<  2) /* U+20D0-U+20FF */\r\n  /* Bit 35   Letterlike Symbols */\r\n#define TT_UCR_LETTERLIKE_SYMBOLS              (1L <<  3) /* U+2100-U+214F */\r\n  /* Bit 36   Number Forms */\r\n#define TT_UCR_NUMBER_FORMS                    (1L <<  4) /* U+2150-U+218F */\r\n  /* Bit 37   Arrows                           */\r\n  /*          Supplemental Arrows-A            */\r\n  /*          Supplemental Arrows-B            */\r\n  /*          Miscellaneous Symbols and Arrows */\r\n#define TT_UCR_ARROWS                          (1L <<  5) /* U+2190-U+21FF */\r\n                                                          /* U+27F0-U+27FF */\r\n                                                          /* U+2900-U+297F */\r\n                                                          /* U+2B00-U+2BFF */\r\n  /* Bit 38   Mathematical Operators               */\r\n  /*          Supplemental Mathematical Operators  */\r\n  /*          Miscellaneous Mathematical Symbols-A */\r\n  /*          Miscellaneous Mathematical Symbols-B */\r\n#define TT_UCR_MATHEMATICAL_OPERATORS          (1L <<  6) /* U+2200-U+22FF */\r\n                                                          /* U+2A00-U+2AFF */\r\n                                                          /* U+27C0-U+27EF */\r\n                                                          /* U+2980-U+29FF */\r\n  /* Bit 39 Miscellaneous Technical */\r\n#define TT_UCR_MISCELLANEOUS_TECHNICAL         (1L <<  7) /* U+2300-U+23FF */\r\n  /* Bit 40   Control Pictures */\r\n#define TT_UCR_CONTROL_PICTURES                (1L <<  8) /* U+2400-U+243F */\r\n  /* Bit 41   Optical Character Recognition */\r\n#define TT_UCR_OCR                             (1L <<  9) /* U+2440-U+245F */\r\n  /* Bit 42   Enclosed Alphanumerics */\r\n#define TT_UCR_ENCLOSED_ALPHANUMERICS          (1L << 10) /* U+2460-U+24FF */\r\n  /* Bit 43   Box Drawing */\r\n#define TT_UCR_BOX_DRAWING                     (1L << 11) /* U+2500-U+257F */\r\n  /* Bit 44   Block Elements */\r\n#define TT_UCR_BLOCK_ELEMENTS                  (1L << 12) /* U+2580-U+259F */\r\n  /* Bit 45   Geometric Shapes */\r\n#define TT_UCR_GEOMETRIC_SHAPES                (1L << 13) /* U+25A0-U+25FF */\r\n  /* Bit 46   Miscellaneous Symbols */\r\n#define TT_UCR_MISCELLANEOUS_SYMBOLS           (1L << 14) /* U+2600-U+26FF */\r\n  /* Bit 47   Dingbats */\r\n#define TT_UCR_DINGBATS                        (1L << 15) /* U+2700-U+27BF */\r\n  /* Bit 48   CJK Symbols and Punctuation */\r\n#define TT_UCR_CJK_SYMBOLS                     (1L << 16) /* U+3000-U+303F */\r\n  /* Bit 49   Hiragana */\r\n#define TT_UCR_HIRAGANA                        (1L << 17) /* U+3040-U+309F */\r\n  /* Bit 50   Katakana                     */\r\n  /*          Katakana Phonetic Extensions */\r\n#define TT_UCR_KATAKANA                        (1L << 18) /* U+30A0-U+30FF */\r\n                                                          /* U+31F0-U+31FF */\r\n  /* Bit 51   Bopomofo          */\r\n  /*          Bopomofo Extended */\r\n#define TT_UCR_BOPOMOFO                        (1L << 19) /* U+3100-U+312F */\r\n                                                          /* U+31A0-U+31BF */\r\n  /* Bit 52   Hangul Compatibility Jamo */\r\n#define TT_UCR_HANGUL_COMPATIBILITY_JAMO       (1L << 20) /* U+3130-U+318F */\r\n  /* Bit 53   Phags-Pa */\r\n#define TT_UCR_CJK_MISC                        (1L << 21) /* U+A840-U+A87F */\r\n#define TT_UCR_KANBUN  TT_UCR_CJK_MISC /* deprecated */\r\n#define TT_UCR_PHAGSPA\r\n  /* Bit 54   Enclosed CJK Letters and Months */\r\n#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS     (1L << 22) /* U+3200-U+32FF */\r\n  /* Bit 55   CJK Compatibility */\r\n#define TT_UCR_CJK_COMPATIBILITY               (1L << 23) /* U+3300-U+33FF */\r\n  /* Bit 56   Hangul Syllables */\r\n#define TT_UCR_HANGUL                          (1L << 24) /* U+AC00-U+D7A3 */\r\n  /* Bit 57   High Surrogates              */\r\n  /*          High Private Use Surrogates  */\r\n  /*          Low Surrogates               */\r\n  /*                                       */\r\n  /* According to OpenType specs v.1.3+,   */\r\n  /* setting bit 57 implies that there is  */\r\n  /* at least one codepoint beyond the     */\r\n  /* Basic Multilingual Plane that is      */\r\n  /* supported by this font.  So it really */\r\n  /* means >= U+10000                      */\r\n#define TT_UCR_SURROGATES                      (1L << 25) /* U+D800-U+DB7F */\r\n                                                          /* U+DB80-U+DBFF */\r\n                                                          /* U+DC00-U+DFFF */\r\n#define TT_UCR_NON_PLANE_0  TT_UCR_SURROGATES\r\n  /* Bit 58  Phoenician */\r\n#define TT_UCR_PHOENICIAN                      (1L << 26) /*U+10900-U+1091F*/\r\n  /* Bit 59   CJK Unified Ideographs             */\r\n  /*          CJK Radicals Supplement            */\r\n  /*          Kangxi Radicals                    */\r\n  /*          Ideographic Description Characters */\r\n  /*          CJK Unified Ideographs Extension A */\r\n  /*          CJK Unified Ideographs Extension B */\r\n  /*          Kanbun                             */\r\n#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS          (1L << 27) /* U+4E00-U+9FFF */\r\n                                                          /* U+2E80-U+2EFF */\r\n                                                          /* U+2F00-U+2FDF */\r\n                                                          /* U+2FF0-U+2FFF */\r\n                                                          /* U+3400-U+4DB5 */\r\n                                                          /*U+20000-U+2A6DF*/\r\n                                                          /* U+3190-U+319F */\r\n  /* Bit 60   Private Use */\r\n#define TT_UCR_PRIVATE_USE                     (1L << 28) /* U+E000-U+F8FF */\r\n  /* Bit 61   CJK Strokes                             */\r\n  /*          CJK Compatibility Ideographs            */\r\n  /*          CJK Compatibility Ideographs Supplement */\r\n#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS    (1L << 29) /* U+31C0-U+31EF */\r\n                                                          /* U+F900-U+FAFF */\r\n                                                          /*U+2F800-U+2FA1F*/\r\n  /* Bit 62   Alphabetic Presentation Forms */\r\n#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS   (1L << 30) /* U+FB00-U+FB4F */\r\n  /* Bit 63   Arabic Presentation Forms-A */\r\n#define TT_UCR_ARABIC_PRESENTATIONS_A          (1L << 31) /* U+FB50-U+FDFF */\r\n  /* Bit 64   Combining Half Marks */\r\n#define TT_UCR_COMBINING_HALF_MARKS            (1L <<  0) /* U+FE20-U+FE2F */\r\n  /* Bit 65   Vertical forms          */\r\n  /*          CJK Compatibility Forms */\r\n#define TT_UCR_CJK_COMPATIBILITY_FORMS         (1L <<  1) /* U+FE10-U+FE1F */\r\n                                                          /* U+FE30-U+FE4F */\r\n  /* Bit 66   Small Form Variants */\r\n#define TT_UCR_SMALL_FORM_VARIANTS             (1L <<  2) /* U+FE50-U+FE6F */\r\n  /* Bit 67   Arabic Presentation Forms-B */\r\n#define TT_UCR_ARABIC_PRESENTATIONS_B          (1L <<  3) /* U+FE70-U+FEFE */\r\n  /* Bit 68   Halfwidth and Fullwidth Forms */\r\n#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS       (1L <<  4) /* U+FF00-U+FFEF */\r\n  /* Bit 69   Specials */\r\n#define TT_UCR_SPECIALS                        (1L <<  5) /* U+FFF0-U+FFFD */\r\n  /* Bit 70   Tibetan */\r\n#define TT_UCR_TIBETAN                         (1L <<  6) /* U+0F00-U+0FFF */\r\n  /* Bit 71   Syriac */\r\n#define TT_UCR_SYRIAC                          (1L <<  7) /* U+0700-U+074F */\r\n  /* Bit 72   Thaana */\r\n#define TT_UCR_THAANA                          (1L <<  8) /* U+0780-U+07BF */\r\n  /* Bit 73   Sinhala */\r\n#define TT_UCR_SINHALA                         (1L <<  9) /* U+0D80-U+0DFF */\r\n  /* Bit 74   Myanmar */\r\n#define TT_UCR_MYANMAR                         (1L << 10) /* U+1000-U+109F */\r\n  /* Bit 75   Ethiopic            */\r\n  /*          Ethiopic Supplement */\r\n  /*          Ethiopic Extended   */\r\n#define TT_UCR_ETHIOPIC                        (1L << 11) /* U+1200-U+137F */\r\n                                                          /* U+1380-U+139F */\r\n                                                          /* U+2D80-U+2DDF */\r\n  /* Bit 76   Cherokee */\r\n#define TT_UCR_CHEROKEE                        (1L << 12) /* U+13A0-U+13FF */\r\n  /* Bit 77   Unified Canadian Aboriginal Syllabics */\r\n#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS   (1L << 13) /* U+1400-U+167F */\r\n  /* Bit 78   Ogham */\r\n#define TT_UCR_OGHAM                           (1L << 14) /* U+1680-U+169F */\r\n  /* Bit 79   Runic */\r\n#define TT_UCR_RUNIC                           (1L << 15) /* U+16A0-U+16FF */\r\n  /* Bit 80   Khmer         */\r\n  /*          Khmer Symbols */\r\n#define TT_UCR_KHMER                           (1L << 16) /* U+1780-U+17FF */\r\n                                                          /* U+19E0-U+19FF */\r\n  /* Bit 81   Mongolian */\r\n#define TT_UCR_MONGOLIAN                       (1L << 17) /* U+1800-U+18AF */\r\n  /* Bit 82   Braille Patterns */\r\n#define TT_UCR_BRAILLE                         (1L << 18) /* U+2800-U+28FF */\r\n  /* Bit 83   Yi Syllables */\r\n  /*          Yi Radicals  */\r\n#define TT_UCR_YI                              (1L << 19) /* U+A000-U+A48F */\r\n                                                          /* U+A490-U+A4CF */\r\n  /* Bit 84   Tagalog  */\r\n  /*          Hanunoo  */\r\n  /*          Buhid    */\r\n  /*          Tagbanwa */\r\n#define TT_UCR_PHILIPPINE                      (1L << 20) /* U+1700-U+171F */\r\n                                                          /* U+1720-U+173F */\r\n                                                          /* U+1740-U+175F */\r\n                                                          /* U+1760-U+177F */\r\n  /* Bit 85   Old Italic */\r\n#define TT_UCR_OLD_ITALIC                      (1L << 21) /*U+10300-U+1032F*/\r\n  /* Bit 86   Gothic */\r\n#define TT_UCR_GOTHIC                          (1L << 22) /*U+10330-U+1034F*/\r\n  /* Bit 87   Deseret */\r\n#define TT_UCR_DESERET                         (1L << 23) /*U+10400-U+1044F*/\r\n  /* Bit 88   Byzantine Musical Symbols      */\r\n  /*          Musical Symbols                */\r\n  /*          Ancient Greek Musical Notation */\r\n#define TT_UCR_MUSICAL_SYMBOLS                 (1L << 24) /*U+1D000-U+1D0FF*/\r\n                                                          /*U+1D100-U+1D1FF*/\r\n                                                          /*U+1D200-U+1D24F*/\r\n  /* Bit 89   Mathematical Alphanumeric Symbols */\r\n#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS       (1L << 25) /*U+1D400-U+1D7FF*/\r\n  /* Bit 90   Private Use (plane 15) */\r\n  /*          Private Use (plane 16) */\r\n#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY       (1L << 26) /*U+F0000-U+FFFFD*/\r\n                                                        /*U+100000-U+10FFFD*/\r\n  /* Bit 91   Variation Selectors            */\r\n  /*          Variation Selectors Supplement */\r\n#define TT_UCR_VARIATION_SELECTORS             (1L << 27) /* U+FE00-U+FE0F */\r\n                                                          /*U+E0100-U+E01EF*/\r\n  /* Bit 92   Tags */\r\n#define TT_UCR_TAGS                            (1L << 28) /*U+E0000-U+E007F*/\r\n  /* Bit 93   Limbu */\r\n#define TT_UCR_LIMBU                           (1L << 29) /* U+1900-U+194F */\r\n  /* Bit 94   Tai Le */\r\n#define TT_UCR_TAI_LE                          (1L << 30) /* U+1950-U+197F */\r\n  /* Bit 95   New Tai Lue */\r\n#define TT_UCR_NEW_TAI_LUE                     (1L << 31) /* U+1980-U+19DF */\r\n  /* Bit 96   Buginese */\r\n#define TT_UCR_BUGINESE                        (1L <<  0) /* U+1A00-U+1A1F */\r\n  /* Bit 97   Glagolitic */\r\n#define TT_UCR_GLAGOLITIC                      (1L <<  1) /* U+2C00-U+2C5F */\r\n  /* Bit 98   Tifinagh */\r\n#define TT_UCR_TIFINAGH                        (1L <<  2) /* U+2D30-U+2D7F */\r\n  /* Bit 99   Yijing Hexagram Symbols */\r\n#define TT_UCR_YIJING                          (1L <<  3) /* U+4DC0-U+4DFF */\r\n  /* Bit 100  Syloti Nagri */\r\n#define TT_UCR_SYLOTI_NAGRI                    (1L <<  4) /* U+A800-U+A82F */\r\n  /* Bit 101  Linear B Syllabary */\r\n  /*          Linear B Ideograms */\r\n  /*          Aegean Numbers     */\r\n#define TT_UCR_LINEAR_B                        (1L <<  5) /*U+10000-U+1007F*/\r\n                                                          /*U+10080-U+100FF*/\r\n                                                          /*U+10100-U+1013F*/\r\n  /* Bit 102  Ancient Greek Numbers */\r\n#define TT_UCR_ANCIENT_GREEK_NUMBERS           (1L <<  6) /*U+10140-U+1018F*/\r\n  /* Bit 103  Ugaritic */\r\n#define TT_UCR_UGARITIC                        (1L <<  7) /*U+10380-U+1039F*/\r\n  /* Bit 104  Old Persian */\r\n#define TT_UCR_OLD_PERSIAN                     (1L <<  8) /*U+103A0-U+103DF*/\r\n  /* Bit 105  Shavian */\r\n#define TT_UCR_SHAVIAN                         (1L <<  9) /*U+10450-U+1047F*/\r\n  /* Bit 106  Osmanya */\r\n#define TT_UCR_OSMANYA                         (1L << 10) /*U+10480-U+104AF*/\r\n  /* Bit 107  Cypriot Syllabary */\r\n#define TT_UCR_CYPRIOT_SYLLABARY               (1L << 11) /*U+10800-U+1083F*/\r\n  /* Bit 108  Kharoshthi */\r\n#define TT_UCR_KHAROSHTHI                      (1L << 12) /*U+10A00-U+10A5F*/\r\n  /* Bit 109  Tai Xuan Jing Symbols */\r\n#define TT_UCR_TAI_XUAN_JING                   (1L << 13) /*U+1D300-U+1D35F*/\r\n  /* Bit 110  Cuneiform                         */\r\n  /*          Cuneiform Numbers and Punctuation */\r\n#define TT_UCR_CUNEIFORM                       (1L << 14) /*U+12000-U+123FF*/\r\n                                                          /*U+12400-U+1247F*/\r\n  /* Bit 111  Counting Rod Numerals */\r\n#define TT_UCR_COUNTING_ROD_NUMERALS           (1L << 15) /*U+1D360-U+1D37F*/\r\n  /* Bit 112  Sundanese */\r\n#define TT_UCR_SUNDANESE                       (1L << 16) /* U+1B80-U+1BBF */\r\n  /* Bit 113  Lepcha */\r\n#define TT_UCR_LEPCHA                          (1L << 17) /* U+1C00-U+1C4F */\r\n  /* Bit 114  Ol Chiki */\r\n#define TT_UCR_OL_CHIKI                        (1L << 18) /* U+1C50-U+1C7F */\r\n  /* Bit 115  Saurashtra */\r\n#define TT_UCR_SAURASHTRA                      (1L << 19) /* U+A880-U+A8DF */\r\n  /* Bit 116  Kayah Li */\r\n#define TT_UCR_KAYAH_LI                        (1L << 20) /* U+A900-U+A92F */\r\n  /* Bit 117  Rejang */\r\n#define TT_UCR_REJANG                          (1L << 21) /* U+A930-U+A95F */\r\n  /* Bit 118  Cham */\r\n#define TT_UCR_CHAM                            (1L << 22) /* U+AA00-U+AA5F */\r\n  /* Bit 119  Ancient Symbols */\r\n#define TT_UCR_ANCIENT_SYMBOLS                 (1L << 23) /*U+10190-U+101CF*/\r\n  /* Bit 120  Phaistos Disc */\r\n#define TT_UCR_PHAISTOS_DISC                   (1L << 24) /*U+101D0-U+101FF*/\r\n  /* Bit 121  Carian */\r\n  /*          Lycian */\r\n  /*          Lydian */\r\n#define TT_UCR_OLD_ANATOLIAN                   (1L << 25) /*U+102A0-U+102DF*/\r\n                                                          /*U+10280-U+1029F*/\r\n                                                          /*U+10920-U+1093F*/\r\n  /* Bit 122  Domino Tiles  */\r\n  /*          Mahjong Tiles */\r\n#define TT_UCR_GAME_TILES                      (1L << 26) /*U+1F030-U+1F09F*/\r\n                                                          /*U+1F000-U+1F02F*/\r\n  /* Bit 123-127 Reserved for process-internal usage */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Some compilers have a very limited length of identifiers.             */\r\n  /*                                                                       */\r\n#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ )\r\n#define HAVE_LIMIT_ON_IDENTS\r\n#endif\r\n\r\n\r\n#ifndef HAVE_LIMIT_ON_IDENTS\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* Here some alias #defines in order to be clearer.                      */\r\n  /*                                                                       */\r\n  /* These are not always #defined to stay within the 31~character limit   */\r\n  /* which some compilers have.                                            */\r\n  /*                                                                       */\r\n  /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern  */\r\n  /* Borland compilers (read: from BC++ 3.1 on) can increase this limit.   */\r\n  /* If you get a warning with such a compiler, use the -i40 switch.       */\r\n  /*                                                                       */\r\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_A      \\\r\n         TT_UCR_ARABIC_PRESENTATIONS_A\r\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_B      \\\r\n         TT_UCR_ARABIC_PRESENTATIONS_B\r\n\r\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS      \\\r\n         TT_UCR_COMBINING_DIACRITICS\r\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \\\r\n         TT_UCR_COMBINING_DIACRITICS_SYMB\r\n\r\n\r\n#endif /* !HAVE_LIMIT_ON_IDENTS */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTNAMEID_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/tttables.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tttables.h                                                             */\r\n/*                                                                         */\r\n/*    Basic SFNT/TrueType tables definitions and interface                 */\r\n/*    (specification only).                                                */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010 by       */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTTABLES_H__\r\n#define __TTTABLES_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Section>                                                             */\r\n  /*    truetype_tables                                                    */\r\n  /*                                                                       */\r\n  /* <Title>                                                               */\r\n  /*    TrueType Tables                                                    */\r\n  /*                                                                       */\r\n  /* <Abstract>                                                            */\r\n  /*    TrueType specific table types and functions.                       */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    This section contains the definition of TrueType-specific tables   */\r\n  /*    as well as some routines used to access and process them.          */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Header                                                          */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType font header table.  All       */\r\n  /*    fields follow the TrueType specification.                          */\r\n  /*                                                                       */\r\n  typedef struct  TT_Header_\r\n  {\r\n    FT_Fixed   Table_Version;\r\n    FT_Fixed   Font_Revision;\r\n\r\n    FT_Long    CheckSum_Adjust;\r\n    FT_Long    Magic_Number;\r\n\r\n    FT_UShort  Flags;\r\n    FT_UShort  Units_Per_EM;\r\n\r\n    FT_Long    Created [2];\r\n    FT_Long    Modified[2];\r\n\r\n    FT_Short   xMin;\r\n    FT_Short   yMin;\r\n    FT_Short   xMax;\r\n    FT_Short   yMax;\r\n\r\n    FT_UShort  Mac_Style;\r\n    FT_UShort  Lowest_Rec_PPEM;\r\n\r\n    FT_Short   Font_Direction;\r\n    FT_Short   Index_To_Loc_Format;\r\n    FT_Short   Glyph_Data_Format;\r\n\r\n  } TT_Header;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_HoriHeader                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType horizontal header, the `hhea' */\r\n  /*    table, as well as the corresponding horizontal metrics table,      */\r\n  /*    i.e., the `hmtx' table.                                            */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Version                :: The table version.                       */\r\n  /*                                                                       */\r\n  /*    Ascender               :: The font's ascender, i.e., the distance  */\r\n  /*                              from the baseline to the top-most of all */\r\n  /*                              glyph points found in the font.          */\r\n  /*                                                                       */\r\n  /*                              This value is invalid in many fonts, as  */\r\n  /*                              it is usually set by the font designer,  */\r\n  /*                              and often reflects only a portion of the */\r\n  /*                              glyphs found in the font (maybe ASCII).  */\r\n  /*                                                                       */\r\n  /*                              You should use the `sTypoAscender' field */\r\n  /*                              of the OS/2 table instead if you want    */\r\n  /*                              the correct one.                         */\r\n  /*                                                                       */\r\n  /*    Descender              :: The font's descender, i.e., the distance */\r\n  /*                              from the baseline to the bottom-most of  */\r\n  /*                              all glyph points found in the font.  It  */\r\n  /*                              is negative.                             */\r\n  /*                                                                       */\r\n  /*                              This value is invalid in many fonts, as  */\r\n  /*                              it is usually set by the font designer,  */\r\n  /*                              and often reflects only a portion of the */\r\n  /*                              glyphs found in the font (maybe ASCII).  */\r\n  /*                                                                       */\r\n  /*                              You should use the `sTypoDescender'      */\r\n  /*                              field of the OS/2 table instead if you   */\r\n  /*                              want the correct one.                    */\r\n  /*                                                                       */\r\n  /*    Line_Gap               :: The font's line gap, i.e., the distance  */\r\n  /*                              to add to the ascender and descender to  */\r\n  /*                              get the BTB, i.e., the                   */\r\n  /*                              baseline-to-baseline distance for the    */\r\n  /*                              font.                                    */\r\n  /*                                                                       */\r\n  /*    advance_Width_Max      :: This field is the maximum of all advance */\r\n  /*                              widths found in the font.  It can be     */\r\n  /*                              used to compute the maximum width of an  */\r\n  /*                              arbitrary string of text.                */\r\n  /*                                                                       */\r\n  /*    min_Left_Side_Bearing  :: The minimum left side bearing of all     */\r\n  /*                              glyphs within the font.                  */\r\n  /*                                                                       */\r\n  /*    min_Right_Side_Bearing :: The minimum right side bearing of all    */\r\n  /*                              glyphs within the font.                  */\r\n  /*                                                                       */\r\n  /*    xMax_Extent            :: The maximum horizontal extent (i.e., the */\r\n  /*                              `width' of a glyph's bounding box) for   */\r\n  /*                              all glyphs in the font.                  */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Rise       :: The rise coefficient of the cursor's     */\r\n  /*                              slope of the cursor (slope=rise/run).    */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Run        :: The run coefficient of the cursor's      */\r\n  /*                              slope.                                   */\r\n  /*                                                                       */\r\n  /*    Reserved               :: 8~reserved bytes.                        */\r\n  /*                                                                       */\r\n  /*    metric_Data_Format     :: Always~0.                                */\r\n  /*                                                                       */\r\n  /*    number_Of_HMetrics     :: Number of HMetrics entries in the `hmtx' */\r\n  /*                              table -- this value can be smaller than  */\r\n  /*                              the total number of glyphs in the font.  */\r\n  /*                                                                       */\r\n  /*    long_metrics           :: A pointer into the `hmtx' table.         */\r\n  /*                                                                       */\r\n  /*    short_metrics          :: A pointer into the `hmtx' table.         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should   */\r\n  /*               be identical except for the names of their fields which */\r\n  /*               are different.                                          */\r\n  /*                                                                       */\r\n  /*               This ensures that a single function in the `ttload'     */\r\n  /*               module is able to read both the horizontal and vertical */\r\n  /*               headers.                                                */\r\n  /*                                                                       */\r\n  typedef struct  TT_HoriHeader_\r\n  {\r\n    FT_Fixed   Version;\r\n    FT_Short   Ascender;\r\n    FT_Short   Descender;\r\n    FT_Short   Line_Gap;\r\n\r\n    FT_UShort  advance_Width_Max;      /* advance width maximum */\r\n\r\n    FT_Short   min_Left_Side_Bearing;  /* minimum left-sb       */\r\n    FT_Short   min_Right_Side_Bearing; /* minimum right-sb      */\r\n    FT_Short   xMax_Extent;            /* xmax extents          */\r\n    FT_Short   caret_Slope_Rise;\r\n    FT_Short   caret_Slope_Run;\r\n    FT_Short   caret_Offset;\r\n\r\n    FT_Short   Reserved[4];\r\n\r\n    FT_Short   metric_Data_Format;\r\n    FT_UShort  number_Of_HMetrics;\r\n\r\n    /* The following fields are not defined by the TrueType specification */\r\n    /* but they are used to connect the metrics header to the relevant    */\r\n    /* `HMTX' table.                                                      */\r\n\r\n    void*      long_metrics;\r\n    void*      short_metrics;\r\n\r\n  } TT_HoriHeader;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_VertHeader                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType vertical header, the `vhea'   */\r\n  /*    table, as well as the corresponding vertical metrics table, i.e.,  */\r\n  /*    the `vmtx' table.                                                  */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    Version                 :: The table version.                      */\r\n  /*                                                                       */\r\n  /*    Ascender                :: The font's ascender, i.e., the distance */\r\n  /*                               from the baseline to the top-most of    */\r\n  /*                               all glyph points found in the font.     */\r\n  /*                                                                       */\r\n  /*                               This value is invalid in many fonts, as */\r\n  /*                               it is usually set by the font designer, */\r\n  /*                               and often reflects only a portion of    */\r\n  /*                               the glyphs found in the font (maybe     */\r\n  /*                               ASCII).                                 */\r\n  /*                                                                       */\r\n  /*                               You should use the `sTypoAscender'      */\r\n  /*                               field of the OS/2 table instead if you  */\r\n  /*                               want the correct one.                   */\r\n  /*                                                                       */\r\n  /*    Descender               :: The font's descender, i.e., the         */\r\n  /*                               distance from the baseline to the       */\r\n  /*                               bottom-most of all glyph points found   */\r\n  /*                               in the font.  It is negative.           */\r\n  /*                                                                       */\r\n  /*                               This value is invalid in many fonts, as */\r\n  /*                               it is usually set by the font designer, */\r\n  /*                               and often reflects only a portion of    */\r\n  /*                               the glyphs found in the font (maybe     */\r\n  /*                               ASCII).                                 */\r\n  /*                                                                       */\r\n  /*                               You should use the `sTypoDescender'     */\r\n  /*                               field of the OS/2 table instead if you  */\r\n  /*                               want the correct one.                   */\r\n  /*                                                                       */\r\n  /*    Line_Gap                :: The font's line gap, i.e., the distance */\r\n  /*                               to add to the ascender and descender to */\r\n  /*                               get the BTB, i.e., the                  */\r\n  /*                               baseline-to-baseline distance for the   */\r\n  /*                               font.                                   */\r\n  /*                                                                       */\r\n  /*    advance_Height_Max      :: This field is the maximum of all        */\r\n  /*                               advance heights found in the font.  It  */\r\n  /*                               can be used to compute the maximum      */\r\n  /*                               height of an arbitrary string of text.  */\r\n  /*                                                                       */\r\n  /*    min_Top_Side_Bearing    :: The minimum top side bearing of all     */\r\n  /*                               glyphs within the font.                 */\r\n  /*                                                                       */\r\n  /*    min_Bottom_Side_Bearing :: The minimum bottom side bearing of all  */\r\n  /*                               glyphs within the font.                 */\r\n  /*                                                                       */\r\n  /*    yMax_Extent             :: The maximum vertical extent (i.e., the  */\r\n  /*                               `height' of a glyph's bounding box) for */\r\n  /*                               all glyphs in the font.                 */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Rise        :: The rise coefficient of the cursor's    */\r\n  /*                               slope of the cursor (slope=rise/run).   */\r\n  /*                                                                       */\r\n  /*    caret_Slope_Run         :: The run coefficient of the cursor's     */\r\n  /*                               slope.                                  */\r\n  /*                                                                       */\r\n  /*    caret_Offset            :: The cursor's offset for slanted fonts.  */\r\n  /*                               This value is `reserved' in vmtx        */\r\n  /*                               version 1.0.                            */\r\n  /*                                                                       */\r\n  /*    Reserved                :: 8~reserved bytes.                       */\r\n  /*                                                                       */\r\n  /*    metric_Data_Format      :: Always~0.                               */\r\n  /*                                                                       */\r\n  /*    number_Of_HMetrics      :: Number of VMetrics entries in the       */\r\n  /*                               `vmtx' table -- this value can be       */\r\n  /*                               smaller than the total number of glyphs */\r\n  /*                               in the font.                            */\r\n  /*                                                                       */\r\n  /*    long_metrics           :: A pointer into the `vmtx' table.         */\r\n  /*                                                                       */\r\n  /*    short_metrics          :: A pointer into the `vmtx' table.         */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should   */\r\n  /*               be identical except for the names of their fields which */\r\n  /*               are different.                                          */\r\n  /*                                                                       */\r\n  /*               This ensures that a single function in the `ttload'     */\r\n  /*               module is able to read both the horizontal and vertical */\r\n  /*               headers.                                                */\r\n  /*                                                                       */\r\n  typedef struct  TT_VertHeader_\r\n  {\r\n    FT_Fixed   Version;\r\n    FT_Short   Ascender;\r\n    FT_Short   Descender;\r\n    FT_Short   Line_Gap;\r\n\r\n    FT_UShort  advance_Height_Max;      /* advance height maximum */\r\n\r\n    FT_Short   min_Top_Side_Bearing;    /* minimum left-sb or top-sb       */\r\n    FT_Short   min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb   */\r\n    FT_Short   yMax_Extent;             /* xmax or ymax extents            */\r\n    FT_Short   caret_Slope_Rise;\r\n    FT_Short   caret_Slope_Run;\r\n    FT_Short   caret_Offset;\r\n\r\n    FT_Short   Reserved[4];\r\n\r\n    FT_Short   metric_Data_Format;\r\n    FT_UShort  number_Of_VMetrics;\r\n\r\n    /* The following fields are not defined by the TrueType specification */\r\n    /* but they're used to connect the metrics header to the relevant     */\r\n    /* `HMTX' or `VMTX' table.                                            */\r\n\r\n    void*      long_metrics;\r\n    void*      short_metrics;\r\n\r\n  } TT_VertHeader;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_OS2                                                             */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType OS/2 table. This is the long  */\r\n  /*    table version.  All fields comply to the TrueType specification.   */\r\n  /*                                                                       */\r\n  /*    Note that we now support old Mac fonts which do not include an     */\r\n  /*    OS/2 table.  In this case, the `version' field is always set to    */\r\n  /*    0xFFFF.                                                            */\r\n  /*                                                                       */\r\n  typedef struct  TT_OS2_\r\n  {\r\n    FT_UShort  version;                /* 0x0001 - more or 0xFFFF */\r\n    FT_Short   xAvgCharWidth;\r\n    FT_UShort  usWeightClass;\r\n    FT_UShort  usWidthClass;\r\n    FT_Short   fsType;\r\n    FT_Short   ySubscriptXSize;\r\n    FT_Short   ySubscriptYSize;\r\n    FT_Short   ySubscriptXOffset;\r\n    FT_Short   ySubscriptYOffset;\r\n    FT_Short   ySuperscriptXSize;\r\n    FT_Short   ySuperscriptYSize;\r\n    FT_Short   ySuperscriptXOffset;\r\n    FT_Short   ySuperscriptYOffset;\r\n    FT_Short   yStrikeoutSize;\r\n    FT_Short   yStrikeoutPosition;\r\n    FT_Short   sFamilyClass;\r\n\r\n    FT_Byte    panose[10];\r\n\r\n    FT_ULong   ulUnicodeRange1;        /* Bits 0-31   */\r\n    FT_ULong   ulUnicodeRange2;        /* Bits 32-63  */\r\n    FT_ULong   ulUnicodeRange3;        /* Bits 64-95  */\r\n    FT_ULong   ulUnicodeRange4;        /* Bits 96-127 */\r\n\r\n    FT_Char    achVendID[4];\r\n\r\n    FT_UShort  fsSelection;\r\n    FT_UShort  usFirstCharIndex;\r\n    FT_UShort  usLastCharIndex;\r\n    FT_Short   sTypoAscender;\r\n    FT_Short   sTypoDescender;\r\n    FT_Short   sTypoLineGap;\r\n    FT_UShort  usWinAscent;\r\n    FT_UShort  usWinDescent;\r\n\r\n    /* only version 1 tables: */\r\n\r\n    FT_ULong   ulCodePageRange1;       /* Bits 0-31   */\r\n    FT_ULong   ulCodePageRange2;       /* Bits 32-63  */\r\n\r\n    /* only version 2 tables: */\r\n\r\n    FT_Short   sxHeight;\r\n    FT_Short   sCapHeight;\r\n    FT_UShort  usDefaultChar;\r\n    FT_UShort  usBreakChar;\r\n    FT_UShort  usMaxContext;\r\n\r\n  } TT_OS2;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_Postscript                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType PostScript table.  All fields */\r\n  /*    comply to the TrueType specification.  This structure does not     */\r\n  /*    reference the PostScript glyph names, which can be nevertheless    */\r\n  /*    accessed with the `ttpost' module.                                 */\r\n  /*                                                                       */\r\n  typedef struct  TT_Postscript_\r\n  {\r\n    FT_Fixed  FormatType;\r\n    FT_Fixed  italicAngle;\r\n    FT_Short  underlinePosition;\r\n    FT_Short  underlineThickness;\r\n    FT_ULong  isFixedPitch;\r\n    FT_ULong  minMemType42;\r\n    FT_ULong  maxMemType42;\r\n    FT_ULong  minMemType1;\r\n    FT_ULong  maxMemType1;\r\n\r\n    /* Glyph names follow in the file, but we don't   */\r\n    /* load them by default.  See the ttpost.c file.  */\r\n\r\n  } TT_Postscript;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_PCLT                                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    A structure used to model a TrueType PCLT table.  All fields       */\r\n  /*    comply to the TrueType specification.                              */\r\n  /*                                                                       */\r\n  typedef struct  TT_PCLT_\r\n  {\r\n    FT_Fixed   Version;\r\n    FT_ULong   FontNumber;\r\n    FT_UShort  Pitch;\r\n    FT_UShort  xHeight;\r\n    FT_UShort  Style;\r\n    FT_UShort  TypeFamily;\r\n    FT_UShort  CapHeight;\r\n    FT_UShort  SymbolSet;\r\n    FT_Char    TypeFace[16];\r\n    FT_Char    CharacterComplement[8];\r\n    FT_Char    FileName[6];\r\n    FT_Char    StrokeWeight;\r\n    FT_Char    WidthType;\r\n    FT_Byte    SerifStyle;\r\n    FT_Byte    Reserved;\r\n\r\n  } TT_PCLT;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Struct>                                                              */\r\n  /*    TT_MaxProfile                                                      */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    The maximum profile is a table containing many max values which    */\r\n  /*    can be used to pre-allocate arrays.  This ensures that no memory   */\r\n  /*    allocation occurs during a glyph load.                             */\r\n  /*                                                                       */\r\n  /* <Fields>                                                              */\r\n  /*    version               :: The version number.                       */\r\n  /*                                                                       */\r\n  /*    numGlyphs             :: The number of glyphs in this TrueType     */\r\n  /*                             font.                                     */\r\n  /*                                                                       */\r\n  /*    maxPoints             :: The maximum number of points in a         */\r\n  /*                             non-composite TrueType glyph.  See also   */\r\n  /*                             the structure element                     */\r\n  /*                             `maxCompositePoints'.                     */\r\n  /*                                                                       */\r\n  /*    maxContours           :: The maximum number of contours in a       */\r\n  /*                             non-composite TrueType glyph.  See also   */\r\n  /*                             the structure element                     */\r\n  /*                             `maxCompositeContours'.                   */\r\n  /*                                                                       */\r\n  /*    maxCompositePoints    :: The maximum number of points in a         */\r\n  /*                             composite TrueType glyph.  See also the   */\r\n  /*                             structure element `maxPoints'.            */\r\n  /*                                                                       */\r\n  /*    maxCompositeContours  :: The maximum number of contours in a       */\r\n  /*                             composite TrueType glyph.  See also the   */\r\n  /*                             structure element `maxContours'.          */\r\n  /*                                                                       */\r\n  /*    maxZones              :: The maximum number of zones used for      */\r\n  /*                             glyph hinting.                            */\r\n  /*                                                                       */\r\n  /*    maxTwilightPoints     :: The maximum number of points in the       */\r\n  /*                             twilight zone used for glyph hinting.     */\r\n  /*                                                                       */\r\n  /*    maxStorage            :: The maximum number of elements in the     */\r\n  /*                             storage area used for glyph hinting.      */\r\n  /*                                                                       */\r\n  /*    maxFunctionDefs       :: The maximum number of function            */\r\n  /*                             definitions in the TrueType bytecode for  */\r\n  /*                             this font.                                */\r\n  /*                                                                       */\r\n  /*    maxInstructionDefs    :: The maximum number of instruction         */\r\n  /*                             definitions in the TrueType bytecode for  */\r\n  /*                             this font.                                */\r\n  /*                                                                       */\r\n  /*    maxStackElements      :: The maximum number of stack elements used */\r\n  /*                             during bytecode interpretation.           */\r\n  /*                                                                       */\r\n  /*    maxSizeOfInstructions :: The maximum number of TrueType opcodes    */\r\n  /*                             used for glyph hinting.                   */\r\n  /*                                                                       */\r\n  /*    maxComponentElements  :: The maximum number of simple (i.e., non-  */\r\n  /*                             composite) glyphs in a composite glyph.   */\r\n  /*                                                                       */\r\n  /*    maxComponentDepth     :: The maximum nesting depth of composite    */\r\n  /*                             glyphs.                                   */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    This structure is only used during font loading.                   */\r\n  /*                                                                       */\r\n  typedef struct  TT_MaxProfile_\r\n  {\r\n    FT_Fixed   version;\r\n    FT_UShort  numGlyphs;\r\n    FT_UShort  maxPoints;\r\n    FT_UShort  maxContours;\r\n    FT_UShort  maxCompositePoints;\r\n    FT_UShort  maxCompositeContours;\r\n    FT_UShort  maxZones;\r\n    FT_UShort  maxTwilightPoints;\r\n    FT_UShort  maxStorage;\r\n    FT_UShort  maxFunctionDefs;\r\n    FT_UShort  maxInstructionDefs;\r\n    FT_UShort  maxStackElements;\r\n    FT_UShort  maxSizeOfInstructions;\r\n    FT_UShort  maxComponentElements;\r\n    FT_UShort  maxComponentDepth;\r\n\r\n  } TT_MaxProfile;\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Enum>                                                                */\r\n  /*    FT_Sfnt_Tag                                                        */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    An enumeration used to specify the index of an SFNT table.         */\r\n  /*    Used in the @FT_Get_Sfnt_Table API function.                       */\r\n  /*                                                                       */\r\n  typedef enum  FT_Sfnt_Tag_\r\n  {\r\n    ft_sfnt_head = 0,    /* TT_Header     */\r\n    ft_sfnt_maxp = 1,    /* TT_MaxProfile */\r\n    ft_sfnt_os2  = 2,    /* TT_OS2        */\r\n    ft_sfnt_hhea = 3,    /* TT_HoriHeader */\r\n    ft_sfnt_vhea = 4,    /* TT_VertHeader */\r\n    ft_sfnt_post = 5,    /* TT_Postscript */\r\n    ft_sfnt_pclt = 6,    /* TT_PCLT       */\r\n\r\n    sfnt_max   /* internal end mark */\r\n\r\n  } FT_Sfnt_Tag;\r\n\r\n  /* */\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_Sfnt_Table                                                  */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return a pointer to a given SFNT table within a face.              */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    face :: A handle to the source.                                    */\r\n  /*                                                                       */\r\n  /*    tag  :: The index of the SFNT table.                               */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    A type-less pointer to the table.  This will be~0 in case of       */\r\n  /*    error, or if the corresponding table was not found *OR* loaded     */\r\n  /*    from the file.                                                     */\r\n  /*                                                                       */\r\n  /*    Use a typecast according to `tag' to access the structure          */\r\n  /*    elements.                                                          */\r\n  /*                                                                       */\r\n  /* <Note>                                                                */\r\n  /*    The table is owned by the face object and disappears with it.      */\r\n  /*                                                                       */\r\n  /*    This function is only useful to access SFNT tables that are loaded */\r\n  /*    by the sfnt, truetype, and opentype drivers.  See @FT_Sfnt_Tag for */\r\n  /*    a list.                                                            */\r\n  /*                                                                       */\r\n  FT_EXPORT( void* )\r\n  FT_Get_Sfnt_Table( FT_Face      face,\r\n                     FT_Sfnt_Tag  tag );\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Load_Sfnt_Table\r\n  *\r\n  * @description:\r\n  *   Load any font table into client memory.\r\n  *\r\n  * @input:\r\n  *   face ::\r\n  *     A handle to the source face.\r\n  *\r\n  *   tag ::\r\n  *     The four-byte tag of the table to load.  Use the value~0 if you want\r\n  *     to access the whole font file.  Otherwise, you can use one of the\r\n  *     definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new\r\n  *     one with @FT_MAKE_TAG.\r\n  *\r\n  *   offset ::\r\n  *     The starting offset in the table (or file if tag == 0).\r\n  *\r\n  * @output:\r\n  *   buffer ::\r\n  *     The target buffer address.  The client must ensure that the memory\r\n  *     array is big enough to hold the data.\r\n  *\r\n  * @inout:\r\n  *   length ::\r\n  *     If the `length' parameter is NULL, then try to load the whole table.\r\n  *     Return an error code if it fails.\r\n  *\r\n  *     Else, if `*length' is~0, exit immediately while returning the\r\n  *     table's (or file) full size in it.\r\n  *\r\n  *     Else the number of bytes to read from the table or file, from the\r\n  *     starting offset.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   If you need to determine the table's length you should first call this\r\n  *   function with `*length' set to~0, as in the following example:\r\n  *\r\n  *     {\r\n  *       FT_ULong  length = 0;\r\n  *\r\n  *\r\n  *       error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );\r\n  *       if ( error ) { ... table does not exist ... }\r\n  *\r\n  *       buffer = malloc( length );\r\n  *       if ( buffer == NULL ) { ... not enough memory ... }\r\n  *\r\n  *       error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );\r\n  *       if ( error ) { ... could not load table ... }\r\n  *     }\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Load_Sfnt_Table( FT_Face    face,\r\n                      FT_ULong   tag,\r\n                      FT_Long    offset,\r\n                      FT_Byte*   buffer,\r\n                      FT_ULong*  length );\r\n\r\n\r\n /**************************************************************************\r\n  *\r\n  * @function:\r\n  *   FT_Sfnt_Table_Info\r\n  *\r\n  * @description:\r\n  *   Return information on an SFNT table.\r\n  *\r\n  * @input:\r\n  *   face ::\r\n  *     A handle to the source face.\r\n  *\r\n  *   table_index ::\r\n  *     The index of an SFNT table.  The function returns\r\n  *     FT_Err_Table_Missing for an invalid value.\r\n  *\r\n  * @output:\r\n  *   tag ::\r\n  *     The name tag of the SFNT table.\r\n  *\r\n  *   length ::\r\n  *     The length of the SFNT table.\r\n  *\r\n  * @return:\r\n  *   FreeType error code.  0~means success.\r\n  *\r\n  * @note:\r\n  *   SFNT tables with length zero are treated as missing.\r\n  *\r\n  */\r\n  FT_EXPORT( FT_Error )\r\n  FT_Sfnt_Table_Info( FT_Face    face,\r\n                      FT_UInt    table_index,\r\n                      FT_ULong  *tag,\r\n                      FT_ULong  *length );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_CMap_Language_ID                                            */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return TrueType/sfnt specific cmap language ID.  Definitions of    */\r\n  /*    language ID values are in `freetype/ttnameid.h'.                   */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charmap ::                                                         */\r\n  /*      The target charmap.                                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The language ID of `charmap'.  If `charmap' doesn't belong to a    */\r\n  /*    TrueType/sfnt face, just return~0 as the default value.            */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_ULong )\r\n  FT_Get_CMap_Language_ID( FT_CharMap  charmap );\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* <Function>                                                            */\r\n  /*    FT_Get_CMap_Format                                                 */\r\n  /*                                                                       */\r\n  /* <Description>                                                         */\r\n  /*    Return TrueType/sfnt specific cmap format.                         */\r\n  /*                                                                       */\r\n  /* <Input>                                                               */\r\n  /*    charmap ::                                                         */\r\n  /*      The target charmap.                                              */\r\n  /*                                                                       */\r\n  /* <Return>                                                              */\r\n  /*    The format of `charmap'.  If `charmap' doesn't belong to a         */\r\n  /*    TrueType/sfnt face, return -1.                                     */\r\n  /*                                                                       */\r\n  FT_EXPORT( FT_Long )\r\n  FT_Get_CMap_Format( FT_CharMap  charmap );\r\n\r\n  /* */\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTTABLES_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/tttags.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  tttags.h                                                               */\r\n/*                                                                         */\r\n/*    Tags for TrueType and OpenType tables (specification only).          */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2004, 2005, 2007, 2008 by                         */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTAGS_H__\r\n#define __TTAGS_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n#define TTAG_avar  FT_MAKE_TAG( 'a', 'v', 'a', 'r' )\r\n#define TTAG_BASE  FT_MAKE_TAG( 'B', 'A', 'S', 'E' )\r\n#define TTAG_bdat  FT_MAKE_TAG( 'b', 'd', 'a', 't' )\r\n#define TTAG_BDF   FT_MAKE_TAG( 'B', 'D', 'F', ' ' )\r\n#define TTAG_bhed  FT_MAKE_TAG( 'b', 'h', 'e', 'd' )\r\n#define TTAG_bloc  FT_MAKE_TAG( 'b', 'l', 'o', 'c' )\r\n#define TTAG_bsln  FT_MAKE_TAG( 'b', 's', 'l', 'n' )\r\n#define TTAG_CFF   FT_MAKE_TAG( 'C', 'F', 'F', ' ' )\r\n#define TTAG_CID   FT_MAKE_TAG( 'C', 'I', 'D', ' ' )\r\n#define TTAG_cmap  FT_MAKE_TAG( 'c', 'm', 'a', 'p' )\r\n#define TTAG_cvar  FT_MAKE_TAG( 'c', 'v', 'a', 'r' )\r\n#define TTAG_cvt   FT_MAKE_TAG( 'c', 'v', 't', ' ' )\r\n#define TTAG_DSIG  FT_MAKE_TAG( 'D', 'S', 'I', 'G' )\r\n#define TTAG_EBDT  FT_MAKE_TAG( 'E', 'B', 'D', 'T' )\r\n#define TTAG_EBLC  FT_MAKE_TAG( 'E', 'B', 'L', 'C' )\r\n#define TTAG_EBSC  FT_MAKE_TAG( 'E', 'B', 'S', 'C' )\r\n#define TTAG_feat  FT_MAKE_TAG( 'f', 'e', 'a', 't' )\r\n#define TTAG_FOND  FT_MAKE_TAG( 'F', 'O', 'N', 'D' )\r\n#define TTAG_fpgm  FT_MAKE_TAG( 'f', 'p', 'g', 'm' )\r\n#define TTAG_fvar  FT_MAKE_TAG( 'f', 'v', 'a', 'r' )\r\n#define TTAG_gasp  FT_MAKE_TAG( 'g', 'a', 's', 'p' )\r\n#define TTAG_GDEF  FT_MAKE_TAG( 'G', 'D', 'E', 'F' )\r\n#define TTAG_glyf  FT_MAKE_TAG( 'g', 'l', 'y', 'f' )\r\n#define TTAG_GPOS  FT_MAKE_TAG( 'G', 'P', 'O', 'S' )\r\n#define TTAG_GSUB  FT_MAKE_TAG( 'G', 'S', 'U', 'B' )\r\n#define TTAG_gvar  FT_MAKE_TAG( 'g', 'v', 'a', 'r' )\r\n#define TTAG_hdmx  FT_MAKE_TAG( 'h', 'd', 'm', 'x' )\r\n#define TTAG_head  FT_MAKE_TAG( 'h', 'e', 'a', 'd' )\r\n#define TTAG_hhea  FT_MAKE_TAG( 'h', 'h', 'e', 'a' )\r\n#define TTAG_hmtx  FT_MAKE_TAG( 'h', 'm', 't', 'x' )\r\n#define TTAG_JSTF  FT_MAKE_TAG( 'J', 'S', 'T', 'F' )\r\n#define TTAG_just  FT_MAKE_TAG( 'j', 'u', 's', 't' )\r\n#define TTAG_kern  FT_MAKE_TAG( 'k', 'e', 'r', 'n' )\r\n#define TTAG_lcar  FT_MAKE_TAG( 'l', 'c', 'a', 'r' )\r\n#define TTAG_loca  FT_MAKE_TAG( 'l', 'o', 'c', 'a' )\r\n#define TTAG_LTSH  FT_MAKE_TAG( 'L', 'T', 'S', 'H' )\r\n#define TTAG_LWFN  FT_MAKE_TAG( 'L', 'W', 'F', 'N' )\r\n#define TTAG_MATH  FT_MAKE_TAG( 'M', 'A', 'T', 'H' )\r\n#define TTAG_maxp  FT_MAKE_TAG( 'm', 'a', 'x', 'p' )\r\n#define TTAG_META  FT_MAKE_TAG( 'M', 'E', 'T', 'A' )\r\n#define TTAG_MMFX  FT_MAKE_TAG( 'M', 'M', 'F', 'X' )\r\n#define TTAG_MMSD  FT_MAKE_TAG( 'M', 'M', 'S', 'D' )\r\n#define TTAG_mort  FT_MAKE_TAG( 'm', 'o', 'r', 't' )\r\n#define TTAG_morx  FT_MAKE_TAG( 'm', 'o', 'r', 'x' )\r\n#define TTAG_name  FT_MAKE_TAG( 'n', 'a', 'm', 'e' )\r\n#define TTAG_opbd  FT_MAKE_TAG( 'o', 'p', 'b', 'd' )\r\n#define TTAG_OS2   FT_MAKE_TAG( 'O', 'S', '/', '2' )\r\n#define TTAG_OTTO  FT_MAKE_TAG( 'O', 'T', 'T', 'O' )\r\n#define TTAG_PCLT  FT_MAKE_TAG( 'P', 'C', 'L', 'T' )\r\n#define TTAG_POST  FT_MAKE_TAG( 'P', 'O', 'S', 'T' )\r\n#define TTAG_post  FT_MAKE_TAG( 'p', 'o', 's', 't' )\r\n#define TTAG_prep  FT_MAKE_TAG( 'p', 'r', 'e', 'p' )\r\n#define TTAG_prop  FT_MAKE_TAG( 'p', 'r', 'o', 'p' )\r\n#define TTAG_sfnt  FT_MAKE_TAG( 's', 'f', 'n', 't' )\r\n#define TTAG_SING  FT_MAKE_TAG( 'S', 'I', 'N', 'G' )\r\n#define TTAG_trak  FT_MAKE_TAG( 't', 'r', 'a', 'k' )\r\n#define TTAG_true  FT_MAKE_TAG( 't', 'r', 'u', 'e' )\r\n#define TTAG_ttc   FT_MAKE_TAG( 't', 't', 'c', ' ' )\r\n#define TTAG_ttcf  FT_MAKE_TAG( 't', 't', 'c', 'f' )\r\n#define TTAG_TYP1  FT_MAKE_TAG( 'T', 'Y', 'P', '1' )\r\n#define TTAG_typ1  FT_MAKE_TAG( 't', 'y', 'p', '1' )\r\n#define TTAG_VDMX  FT_MAKE_TAG( 'V', 'D', 'M', 'X' )\r\n#define TTAG_vhea  FT_MAKE_TAG( 'v', 'h', 'e', 'a' )\r\n#define TTAG_vmtx  FT_MAKE_TAG( 'v', 'm', 't', 'x' )\r\n\r\n\r\nFT_END_HEADER\r\n\r\n#endif /* __TTAGS_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/freetype/ttunpat.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ttunpat.h                                                              */\r\n/*                                                                         */\r\n/*    Definitions for the unpatented TrueType hinting system               */\r\n/*                                                                         */\r\n/*  Copyright 2003, 2006 by                                                */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  Written by Graham Asher <graham.asher@btinternet.com>                  */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n#ifndef __TTUNPAT_H__\r\n#define __TTUNPAT_H__\r\n\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n#ifdef FREETYPE_H\r\n#error \"freetype.h of FreeType 1 has been loaded!\"\r\n#error \"Please fix the directory search order for header files\"\r\n#error \"so that freetype.h of FreeType 2 is found first.\"\r\n#endif\r\n\r\n\r\nFT_BEGIN_HEADER\r\n\r\n\r\n /***************************************************************************\r\n  *\r\n  * @constant:\r\n  *   FT_PARAM_TAG_UNPATENTED_HINTING\r\n  *\r\n  * @description:\r\n  *   A constant used as the tag of an @FT_Parameter structure to indicate\r\n  *   that unpatented methods only should be used by the TrueType bytecode\r\n  *   interpreter for a typeface opened by @FT_Open_Face.\r\n  *\r\n  */\r\n#define FT_PARAM_TAG_UNPATENTED_HINTING  FT_MAKE_TAG( 'u', 'n', 'p', 'a' )\r\n\r\n /* */\r\n\r\nFT_END_HEADER\r\n\r\n\r\n#endif /* __TTUNPAT_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/include/ft2build.h",
    "content": "/***************************************************************************/\r\n/*                                                                         */\r\n/*  ft2build.h                                                             */\r\n/*                                                                         */\r\n/*    FreeType 2 build and setup macros.                                   */\r\n/*    (Generic version)                                                    */\r\n/*                                                                         */\r\n/*  Copyright 1996-2001, 2006 by                                           */\r\n/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\r\n/*                                                                         */\r\n/*  This file is part of the FreeType project, and may only be used,       */\r\n/*  modified, and distributed under the terms of the FreeType project      */\r\n/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\r\n/*  this file you indicate that you have read the license and              */\r\n/*  understand and accept it fully.                                        */\r\n/*                                                                         */\r\n/***************************************************************************/\r\n\r\n\r\n  /*************************************************************************/\r\n  /*                                                                       */\r\n  /* This file corresponds to the default `ft2build.h' file for            */\r\n  /* FreeType 2.  It uses the `freetype' include root.                     */\r\n  /*                                                                       */\r\n  /* Note that specific platforms might use a different configuration.     */\r\n  /* See builds/unix/ft2unix.h for an example.                             */\r\n  /*                                                                       */\r\n  /*************************************************************************/\r\n\r\n\r\n#ifndef __FT2_BUILD_GENERIC_H__\r\n#define __FT2_BUILD_GENERIC_H__\r\n\r\n#include <freetype/config/ftheader.h>\r\n\r\n#endif /* __FT2_BUILD_GENERIC_H__ */\r\n\r\n\r\n/* END */\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/jni/Android.mk",
    "content": "#\r\n# FreeType2 static and shared C++ libraries\r\n#\r\n\r\nLOCAL_PATH := $(call my-dir)\r\n\r\nSRC_PATH := ../src\r\n\r\nFT2_SRC_FILES := \\\r\n\t$(SRC_PATH)/autofit/autofit.c \\\r\n\t$(SRC_PATH)/base/basepic.c \\\r\n\t$(SRC_PATH)/base/ftapi.c \\\r\n\t$(SRC_PATH)/base/ftbase.c \\\r\n\t$(SRC_PATH)/base/ftbbox.c \\\r\n\t$(SRC_PATH)/base/ftbitmap.c \\\r\n\t$(SRC_PATH)/base/ftdbgmem.c \\\r\n\t$(SRC_PATH)/base/ftdebug.c \\\r\n\t$(SRC_PATH)/base/ftglyph.c \\\r\n\t$(SRC_PATH)/base/ftinit.c \\\r\n\t$(SRC_PATH)/base/ftpic.c \\\r\n\t$(SRC_PATH)/base/ftstroke.c \\\r\n\t$(SRC_PATH)/base/ftsynth.c \\\r\n\t$(SRC_PATH)/base/ftsystem.c \\\r\n\t$(SRC_PATH)/cff/cff.c \\\r\n\t$(SRC_PATH)/pshinter/pshinter.c \\\r\n\t$(SRC_PATH)/psnames/psnames.c \\\r\n\t$(SRC_PATH)/raster/raster.c \\\r\n\t$(SRC_PATH)/sfnt/sfnt.c \\\r\n\t$(SRC_PATH)/smooth/smooth.c \\\r\n\t$(SRC_PATH)/truetype/truetype.c\r\n\r\nFT2_CFLAGS := \\\r\n\t-DANDROID_NDK \\\r\n\t-DFT2_BUILD_LIBRARY=1\r\n\r\nFT2_INCLUDES := \\\r\n\t$(LOCAL_PATH)/../include \\\r\n\t$(LOCAL_PATH)/../src\r\n\r\n# $(LOCAL_PATH)/include_all \\\r\n\r\ninclude $(CLEAR_VARS)\r\n\r\nLOCAL_MODULE := freetype2_static\r\nLOCAL_MODULE_FILENAME := libfreetype2\r\n\r\nLOCAL_CFLAGS := $(FT2_CFLAGS)\r\nLOCAL_C_INCLUDES := $(FT2_INCLUDES)\r\nLOCAL_SRC_FILES := $(FT2_SRC_FILES)\r\n\r\nLOCAL_LDLIBS := -ldl -llog\r\n\r\ninclude $(BUILD_STATIC_LIBRARY)\r\n\r\ninclude $(CLEAR_VARS)\r\n\r\nLOCAL_MODULE := freetype2_shared\r\nLOCAL_MODULE_FILENAME := libfreetype2\r\n\r\nLOCAL_CFLAGS := $(FT2_CFLAGS)\r\nLOCAL_C_INCLUDES := $(FT2_INCLUDES)\r\nLOCAL_SRC_FILES := $(FT2_SRC_FILES)\r\n\r\nLOCAL_LDLIBS := -ldl -llog\r\n\r\ninclude $(BUILD_SHARED_LIBRARY)\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/jni/Application.mk",
    "content": "APP_MODULES      := freetype2_shared freetype2_static\r\nAPP_PLATFORM     := android-8\r\nAPP_ABI          := all\r\nAPP_OPTIM        := debug\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/jni/shared.mk",
    "content": "#\r\n# FreeType2 prebuilt shared C++ library\r\n#\r\n\r\n__WAS_PATH := $(LOCAL_PATH)\r\nLOCAL_PATH := $(call my-dir)\r\n\r\ninclude $(CLEAR_VARS)\r\n\r\nLOCAL_MODULE := freetype2_prebuilt_shared\r\nLOCAL_SRC_FILES := ../libs/$(TARGET_ARCH_ABI)/libfreetype2.so\r\nLOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include\r\n\r\ninclude $(PREBUILT_SHARED_LIBRARY)\r\n\r\nLOCAL_PATH := $(__WAS_PATH)\r\n"
  },
  {
    "path": "Engine/libs/libfreetype2/jni/static.mk",
    "content": "#\r\n# FreeType2 prebuilt static C++ library\r\n#\r\n\r\n__WAS_PATH := $(LOCAL_PATH)\r\nLOCAL_PATH := $(call my-dir)\r\n\r\ninclude $(CLEAR_VARS)\r\n\r\nLOCAL_MODULE := freetype2_prebuilt_static\r\nLOCAL_SRC_FILES := ../obj/local/$(TARGET_ARCH_ABI)/libfreetype2.a\r\nLOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include\r\n\r\ninclude $(PREBUILT_STATIC_LIBRARY)\r\n\r\nLOCAL_PATH := $(__WAS_PATH)\r\n"
  },
  {
    "path": "Engine/libs/lua/lapi.c",
    "content": "/*\r\n** $Id: lapi.c,v 2.159 2011/11/30 12:32:05 roberto Exp $\r\n** Lua API\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdarg.h>\r\n#include <string.h>\r\n\r\n#define lapi_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lapi.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lgc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n#include \"lundump.h\"\r\n#include \"lvm.h\"\r\n\r\n\r\n\r\nconst char lua_ident[] =\r\n  \"$LuaVersion: \" LUA_COPYRIGHT \" $\"\r\n  \"$LuaAuthors: \" LUA_AUTHORS \" $\";\r\n\r\n\r\n/* value at a non-valid index */\r\n#define NONVALIDVALUE\t\tcast(TValue *, luaO_nilobject)\r\n\r\n/* corresponding test */\r\n#define isvalid(o)\t((o) != luaO_nilobject)\r\n\r\n#define api_checkvalidindex(L, i)  api_check(L, isvalid(i), \"invalid index\")\r\n\r\n\r\nstatic TValue *index2addr (lua_State *L, int idx) {\r\n  CallInfo *ci = L->ci;\r\n  if (idx > 0) {\r\n    TValue *o = ci->func + idx;\r\n    api_check(L, idx <= ci->top - (ci->func + 1), \"unacceptable index\");\r\n    if (o >= L->top) return NONVALIDVALUE;\r\n    else return o;\r\n  }\r\n  else if (idx > LUA_REGISTRYINDEX) {\r\n    api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), \"invalid index\");\r\n    return L->top + idx;\r\n  }\r\n  else if (idx == LUA_REGISTRYINDEX)\r\n    return &G(L)->l_registry;\r\n  else {  /* upvalues */\r\n    idx = LUA_REGISTRYINDEX - idx;\r\n    api_check(L, idx <= MAXUPVAL + 1, \"upvalue index too large\");\r\n    if (ttislcf(ci->func))  /* light C function? */\r\n      return NONVALIDVALUE;  /* it has no upvalues */\r\n    else {\r\n      CClosure *func = clCvalue(ci->func);\r\n      return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE;\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** to be called by 'lua_checkstack' in protected mode, to grow stack\r\n** capturing memory errors\r\n*/\r\nstatic void growstack (lua_State *L, void *ud) {\r\n  int size = *(int *)ud;\r\n  luaD_growstack(L, size);\r\n}\r\n\r\n\r\nLUA_API int lua_checkstack (lua_State *L, int size) {\r\n  int res;\r\n  CallInfo *ci = L->ci;\r\n  lua_lock(L);\r\n  if (L->stack_last - L->top > size)  /* stack large enough? */\r\n    res = 1;  /* yes; check is OK */\r\n  else {  /* no; need to grow stack */\r\n    int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;\r\n    if (inuse > LUAI_MAXSTACK - size)  /* can grow without overflow? */\r\n      res = 0;  /* no */\r\n    else  /* try to grow stack */\r\n      res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);\r\n  }\r\n  if (res && ci->top < L->top + size)\r\n    ci->top = L->top + size;  /* adjust frame top */\r\n  lua_unlock(L);\r\n  return res;\r\n}\r\n\r\n\r\nLUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {\r\n  int i;\r\n  if (from == to) return;\r\n  lua_lock(to);\r\n  api_checknelems(from, n);\r\n  api_check(from, G(from) == G(to), \"moving among independent states\");\r\n  api_check(from, to->ci->top - to->top >= n, \"not enough elements to move\");\r\n  from->top -= n;\r\n  for (i = 0; i < n; i++) {\r\n    setobj2s(to, to->top++, from->top + i);\r\n  }\r\n  lua_unlock(to);\r\n}\r\n\r\n\r\nLUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {\r\n  lua_CFunction old;\r\n  lua_lock(L);\r\n  old = G(L)->panic;\r\n  G(L)->panic = panicf;\r\n  lua_unlock(L);\r\n  return old;\r\n}\r\n\r\n\r\nLUA_API const lua_Number *lua_version (lua_State *L) {\r\n  static const lua_Number version = LUA_VERSION_NUM;\r\n  if (L == NULL) return &version;\r\n  else return G(L)->version;\r\n}\r\n\r\n\r\n\r\n/*\r\n** basic stack manipulation\r\n*/\r\n\r\n\r\n/*\r\n** convert an acceptable stack index into an absolute index\r\n*/\r\nLUA_API int lua_absindex (lua_State *L, int idx) {\r\n  return (idx > 0 || idx <= LUA_REGISTRYINDEX)\r\n         ? idx\r\n         : cast_int(L->top - L->ci->func + idx);\r\n}\r\n\r\n\r\nLUA_API int lua_gettop (lua_State *L) {\r\n  return cast_int(L->top - (L->ci->func + 1));\r\n}\r\n\r\n\r\nLUA_API void lua_settop (lua_State *L, int idx) {\r\n  StkId func = L->ci->func;\r\n  lua_lock(L);\r\n  if (idx >= 0) {\r\n    api_check(L, idx <= L->stack_last - (func + 1), \"new top too large\");\r\n    while (L->top < (func + 1) + idx)\r\n      setnilvalue(L->top++);\r\n    L->top = (func + 1) + idx;\r\n  }\r\n  else {\r\n    api_check(L, -(idx+1) <= (L->top - (func + 1)), \"invalid new top\");\r\n    L->top += idx+1;  /* `subtract' index (index is negative) */\r\n  }\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_remove (lua_State *L, int idx) {\r\n  StkId p;\r\n  lua_lock(L);\r\n  p = index2addr(L, idx);\r\n  api_checkvalidindex(L, p);\r\n  while (++p < L->top) setobjs2s(L, p-1, p);\r\n  L->top--;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_insert (lua_State *L, int idx) {\r\n  StkId p;\r\n  StkId q;\r\n  lua_lock(L);\r\n  p = index2addr(L, idx);\r\n  api_checkvalidindex(L, p);\r\n  for (q = L->top; q>p; q--) setobjs2s(L, q, q-1);\r\n  setobjs2s(L, p, L->top);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nstatic void moveto (lua_State *L, TValue *fr, int idx) {\r\n  TValue *to = index2addr(L, idx);\r\n  api_checkvalidindex(L, to);\r\n  setobj(L, to, fr);\r\n  if (idx < LUA_REGISTRYINDEX)  /* function upvalue? */\r\n    luaC_barrier(L, clCvalue(L->ci->func), fr);\r\n  /* LUA_REGISTRYINDEX does not need gc barrier\r\n     (collector revisits it before finishing collection) */\r\n}\r\n\r\n\r\nLUA_API void lua_replace (lua_State *L, int idx) {\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  moveto(L, L->top - 1, idx);\r\n  L->top--;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_copy (lua_State *L, int fromidx, int toidx) {\r\n  TValue *fr;\r\n  lua_lock(L);\r\n  fr = index2addr(L, fromidx);\r\n  api_checkvalidindex(L, fr);\r\n  moveto(L, fr, toidx);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_pushvalue (lua_State *L, int idx) {\r\n  lua_lock(L);\r\n  setobj2s(L, L->top, index2addr(L, idx));\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\n\r\n/*\r\n** access functions (stack -> C)\r\n*/\r\n\r\n\r\nLUA_API int lua_type (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  return (isvalid(o) ? ttypenv(o) : LUA_TNONE);\r\n}\r\n\r\n\r\nLUA_API const char *lua_typename (lua_State *L, int t) {\r\n  UNUSED(L);\r\n  return ttypename(t);\r\n}\r\n\r\n\r\nLUA_API int lua_iscfunction (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  return (ttislcf(o) || (ttisCclosure(o)));\r\n}\r\n\r\n\r\nLUA_API int lua_isnumber (lua_State *L, int idx) {\r\n  TValue n;\r\n  const TValue *o = index2addr(L, idx);\r\n  return tonumber(o, &n);\r\n}\r\n\r\n\r\nLUA_API int lua_isstring (lua_State *L, int idx) {\r\n  int t = lua_type(L, idx);\r\n  return (t == LUA_TSTRING || t == LUA_TNUMBER);\r\n}\r\n\r\n\r\nLUA_API int lua_isuserdata (lua_State *L, int idx) {\r\n  const TValue *o = index2addr(L, idx);\r\n  return (ttisuserdata(o) || ttislightuserdata(o));\r\n}\r\n\r\n\r\nLUA_API int lua_rawequal (lua_State *L, int index1, int index2) {\r\n  StkId o1 = index2addr(L, index1);\r\n  StkId o2 = index2addr(L, index2);\r\n  return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0;\r\n}\r\n\r\n\r\nLUA_API void  lua_arith (lua_State *L, int op) {\r\n  StkId o1;  /* 1st operand */\r\n  StkId o2;  /* 2nd operand */\r\n  lua_lock(L);\r\n  if (op != LUA_OPUNM) /* all other operations expect two operands */\r\n    api_checknelems(L, 2);\r\n  else {  /* for unary minus, add fake 2nd operand */\r\n    api_checknelems(L, 1);\r\n    setobjs2s(L, L->top, L->top - 1);\r\n    L->top++;\r\n  }\r\n  o1 = L->top - 2;\r\n  o2 = L->top - 1;\r\n  if (ttisnumber(o1) && ttisnumber(o2)) {\r\n    changenvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2)));\r\n  }\r\n  else\r\n    luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD));\r\n  L->top--;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {\r\n  StkId o1, o2;\r\n  int i = 0;\r\n  lua_lock(L);  /* may call tag method */\r\n  o1 = index2addr(L, index1);\r\n  o2 = index2addr(L, index2);\r\n  if (isvalid(o1) && isvalid(o2)) {\r\n    switch (op) {\r\n      case LUA_OPEQ: i = equalobj(L, o1, o2); break;\r\n      case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break;\r\n      case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break;\r\n      default: api_check(L, 0, \"invalid option\");\r\n    }\r\n  }\r\n  lua_unlock(L);\r\n  return i;\r\n}\r\n\r\n\r\nLUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum) {\r\n  TValue n;\r\n  const TValue *o = index2addr(L, idx);\r\n  if (tonumber(o, &n)) {\r\n    if (isnum) *isnum = 1;\r\n    return nvalue(o);\r\n  }\r\n  else {\r\n    if (isnum) *isnum = 0;\r\n    return 0;\r\n  }\r\n}\r\n\r\n\r\nLUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum) {\r\n  TValue n;\r\n  const TValue *o = index2addr(L, idx);\r\n  if (tonumber(o, &n)) {\r\n    lua_Integer res;\r\n    lua_Number num = nvalue(o);\r\n    lua_number2integer(res, num);\r\n    if (isnum) *isnum = 1;\r\n    return res;\r\n  }\r\n  else {\r\n    if (isnum) *isnum = 0;\r\n    return 0;\r\n  }\r\n}\r\n\r\n\r\nLUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *isnum) {\r\n  TValue n;\r\n  const TValue *o = index2addr(L, idx);\r\n  if (tonumber(o, &n)) {\r\n    lua_Unsigned res;\r\n    lua_Number num = nvalue(o);\r\n    lua_number2unsigned(res, num);\r\n    if (isnum) *isnum = 1;\r\n    return res;\r\n  }\r\n  else {\r\n    if (isnum) *isnum = 0;\r\n    return 0;\r\n  }\r\n}\r\n\r\n\r\nLUA_API int lua_toboolean (lua_State *L, int idx) {\r\n  const TValue *o = index2addr(L, idx);\r\n  return !l_isfalse(o);\r\n}\r\n\r\n\r\nLUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {\r\n  StkId o = index2addr(L, idx);\r\n  if (!ttisstring(o)) {\r\n    lua_lock(L);  /* `luaV_tostring' may create a new string */\r\n    if (!luaV_tostring(L, o)) {  /* conversion failed? */\r\n      if (len != NULL) *len = 0;\r\n      lua_unlock(L);\r\n      return NULL;\r\n    }\r\n    luaC_checkGC(L);\r\n    o = index2addr(L, idx);  /* previous call may reallocate the stack */\r\n    lua_unlock(L);\r\n  }\r\n  if (len != NULL) *len = tsvalue(o)->len;\r\n  return svalue(o);\r\n}\r\n\r\n\r\nLUA_API size_t lua_rawlen (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  switch (ttypenv(o)) {\r\n    case LUA_TSTRING: return tsvalue(o)->len;\r\n    case LUA_TUSERDATA: return uvalue(o)->len;\r\n    case LUA_TTABLE: return luaH_getn(hvalue(o));\r\n    default: return 0;\r\n  }\r\n}\r\n\r\n\r\nLUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  if (ttislcf(o)) return fvalue(o);\r\n  else if (ttisCclosure(o))\r\n    return clCvalue(o)->f;\r\n  else return NULL;  /* not a C function */\r\n}\r\n\r\n\r\nLUA_API void *lua_touserdata (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  switch (ttypenv(o)) {\r\n    case LUA_TUSERDATA: return (rawuvalue(o) + 1);\r\n    case LUA_TLIGHTUSERDATA: return pvalue(o);\r\n    default: return NULL;\r\n  }\r\n}\r\n\r\n\r\nLUA_API lua_State *lua_tothread (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  return (!ttisthread(o)) ? NULL : thvalue(o);\r\n}\r\n\r\n\r\nLUA_API const void *lua_topointer (lua_State *L, int idx) {\r\n  StkId o = index2addr(L, idx);\r\n  switch (ttype(o)) {\r\n    case LUA_TTABLE: return hvalue(o);\r\n    case LUA_TLCL: return clLvalue(o);\r\n    case LUA_TCCL: return clCvalue(o);\r\n    case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o)));\r\n    case LUA_TTHREAD: return thvalue(o);\r\n    case LUA_TUSERDATA:\r\n    case LUA_TLIGHTUSERDATA:\r\n      return lua_touserdata(L, idx);\r\n    default: return NULL;\r\n  }\r\n}\r\n\r\n\r\n\r\n/*\r\n** push functions (C -> stack)\r\n*/\r\n\r\n\r\nLUA_API void lua_pushnil (lua_State *L) {\r\n  lua_lock(L);\r\n  setnilvalue(L->top);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_pushnumber (lua_State *L, lua_Number n) {\r\n  lua_lock(L);\r\n  setnvalue(L->top, n);\r\n  luai_checknum(L, L->top,\r\n    luaG_runerror(L, \"C API - attempt to push a signaling NaN\"));\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {\r\n  lua_lock(L);\r\n  setnvalue(L->top, cast_num(n));\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_pushunsigned (lua_State *L, lua_Unsigned u) {\r\n  lua_Number n;\r\n  lua_lock(L);\r\n  n = lua_unsigned2number(u);\r\n  setnvalue(L->top, n);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) {\r\n  TString *ts;\r\n  lua_lock(L);\r\n  luaC_checkGC(L);\r\n  ts = luaS_newlstr(L, s, len);\r\n  setsvalue2s(L, L->top, ts);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n  return getstr(ts);\r\n}\r\n\r\n\r\nLUA_API const char *lua_pushstring (lua_State *L, const char *s) {\r\n  if (s == NULL) {\r\n    lua_pushnil(L);\r\n    return NULL;\r\n  }\r\n  else {\r\n    TString *ts;\r\n    lua_lock(L);\r\n    luaC_checkGC(L);\r\n    ts = luaS_new(L, s);\r\n    setsvalue2s(L, L->top, ts);\r\n    api_incr_top(L);\r\n    lua_unlock(L);\r\n    return getstr(ts);\r\n  }\r\n}\r\n\r\n\r\nLUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,\r\n                                      va_list argp) {\r\n  const char *ret;\r\n  lua_lock(L);\r\n  luaC_checkGC(L);\r\n  ret = luaO_pushvfstring(L, fmt, argp);\r\n  lua_unlock(L);\r\n  return ret;\r\n}\r\n\r\n\r\nLUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {\r\n  const char *ret;\r\n  va_list argp;\r\n  lua_lock(L);\r\n  luaC_checkGC(L);\r\n  va_start(argp, fmt);\r\n  ret = luaO_pushvfstring(L, fmt, argp);\r\n  va_end(argp);\r\n  lua_unlock(L);\r\n  return ret;\r\n}\r\n\r\n\r\nLUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {\r\n  lua_lock(L);\r\n  if (n == 0) {\r\n    setfvalue(L->top, fn);\r\n  }\r\n  else {\r\n    Closure *cl;\r\n    api_checknelems(L, n);\r\n    api_check(L, n <= MAXUPVAL, \"upvalue index too large\");\r\n    luaC_checkGC(L);\r\n    cl = luaF_newCclosure(L, n);\r\n    cl->c.f = fn;\r\n    L->top -= n;\r\n    while (n--)\r\n      setobj2n(L, &cl->c.upvalue[n], L->top + n);\r\n    setclCvalue(L, L->top, cl);\r\n  }\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_pushboolean (lua_State *L, int b) {\r\n  lua_lock(L);\r\n  setbvalue(L->top, (b != 0));  /* ensure that true is 1 */\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_pushlightuserdata (lua_State *L, void *p) {\r\n  lua_lock(L);\r\n  setpvalue(L->top, p);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API int lua_pushthread (lua_State *L) {\r\n  lua_lock(L);\r\n  setthvalue(L, L->top, L);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n  return (G(L)->mainthread == L);\r\n}\r\n\r\n\r\n\r\n/*\r\n** get functions (Lua -> stack)\r\n*/\r\n\r\n\r\nLUA_API void lua_getglobal (lua_State *L, const char *var) {\r\n  Table *reg = hvalue(&G(L)->l_registry);\r\n  const TValue *gt;  /* global table */\r\n  lua_lock(L);\r\n  gt = luaH_getint(reg, LUA_RIDX_GLOBALS);\r\n  setsvalue2s(L, L->top++, luaS_new(L, var));\r\n  luaV_gettable(L, gt, L->top - 1, L->top - 1);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_gettable (lua_State *L, int idx) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  api_checkvalidindex(L, t);\r\n  luaV_gettable(L, t, L->top - 1, L->top - 1);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_getfield (lua_State *L, int idx, const char *k) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  api_checkvalidindex(L, t);\r\n  setsvalue2s(L, L->top, luaS_new(L, k));\r\n  api_incr_top(L);\r\n  luaV_gettable(L, t, L->top - 1, L->top - 1);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_rawget (lua_State *L, int idx) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_rawgeti (lua_State *L, int idx, int n) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  setobj2s(L, L->top, luaH_getint(hvalue(t), n));\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_rawgetp (lua_State *L, int idx, const void *p) {\r\n  StkId t;\r\n  TValue k;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  setpvalue(&k, cast(void *, p));\r\n  setobj2s(L, L->top, luaH_get(hvalue(t), &k));\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_createtable (lua_State *L, int narray, int nrec) {\r\n  Table *t;\r\n  lua_lock(L);\r\n  luaC_checkGC(L);\r\n  t = luaH_new(L);\r\n  sethvalue(L, L->top, t);\r\n  api_incr_top(L);\r\n  if (narray > 0 || nrec > 0)\r\n    luaH_resize(L, t, narray, nrec);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API int lua_getmetatable (lua_State *L, int objindex) {\r\n  const TValue *obj;\r\n  Table *mt = NULL;\r\n  int res;\r\n  lua_lock(L);\r\n  obj = index2addr(L, objindex);\r\n  switch (ttypenv(obj)) {\r\n    case LUA_TTABLE:\r\n      mt = hvalue(obj)->metatable;\r\n      break;\r\n    case LUA_TUSERDATA:\r\n      mt = uvalue(obj)->metatable;\r\n      break;\r\n    default:\r\n      mt = G(L)->mt[ttypenv(obj)];\r\n      break;\r\n  }\r\n  if (mt == NULL)\r\n    res = 0;\r\n  else {\r\n    sethvalue(L, L->top, mt);\r\n    api_incr_top(L);\r\n    res = 1;\r\n  }\r\n  lua_unlock(L);\r\n  return res;\r\n}\r\n\r\n\r\nLUA_API void lua_getuservalue (lua_State *L, int idx) {\r\n  StkId o;\r\n  lua_lock(L);\r\n  o = index2addr(L, idx);\r\n  api_checkvalidindex(L, o);\r\n  api_check(L, ttisuserdata(o), \"userdata expected\");\r\n  if (uvalue(o)->env) {\r\n    sethvalue(L, L->top, uvalue(o)->env);\r\n  } else\r\n    setnilvalue(L->top);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\n/*\r\n** set functions (stack -> Lua)\r\n*/\r\n\r\n\r\nLUA_API void lua_setglobal (lua_State *L, const char *var) {\r\n  Table *reg = hvalue(&G(L)->l_registry);\r\n  const TValue *gt;  /* global table */\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  gt = luaH_getint(reg, LUA_RIDX_GLOBALS);\r\n  setsvalue2s(L, L->top++, luaS_new(L, var));\r\n  luaV_settable(L, gt, L->top - 1, L->top - 2);\r\n  L->top -= 2;  /* pop value and key */\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_settable (lua_State *L, int idx) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  api_checknelems(L, 2);\r\n  t = index2addr(L, idx);\r\n  api_checkvalidindex(L, t);\r\n  luaV_settable(L, t, L->top - 2, L->top - 1);\r\n  L->top -= 2;  /* pop index and value */\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_setfield (lua_State *L, int idx, const char *k) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  t = index2addr(L, idx);\r\n  api_checkvalidindex(L, t);\r\n  setsvalue2s(L, L->top++, luaS_new(L, k));\r\n  luaV_settable(L, t, L->top - 1, L->top - 2);\r\n  L->top -= 2;  /* pop value and key */\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_rawset (lua_State *L, int idx) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  api_checknelems(L, 2);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);\r\n  invalidateTMcache(hvalue(t));\r\n  luaC_barrierback(L, gcvalue(t), L->top-1);\r\n  L->top -= 2;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_rawseti (lua_State *L, int idx, int n) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  luaH_setint(L, hvalue(t), n, L->top - 1);\r\n  luaC_barrierback(L, gcvalue(t), L->top-1);\r\n  L->top--;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {\r\n  StkId t;\r\n  TValue k;\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  setpvalue(&k, cast(void *, p));\r\n  setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);\r\n  luaC_barrierback(L, gcvalue(t), L->top - 1);\r\n  L->top--;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API int lua_setmetatable (lua_State *L, int objindex) {\r\n  TValue *obj;\r\n  Table *mt;\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  obj = index2addr(L, objindex);\r\n  api_checkvalidindex(L, obj);\r\n  if (ttisnil(L->top - 1))\r\n    mt = NULL;\r\n  else {\r\n    api_check(L, ttistable(L->top - 1), \"table expected\");\r\n    mt = hvalue(L->top - 1);\r\n  }\r\n  switch (ttypenv(obj)) {\r\n    case LUA_TTABLE: {\r\n      hvalue(obj)->metatable = mt;\r\n      if (mt)\r\n        luaC_objbarrierback(L, gcvalue(obj), mt);\r\n        luaC_checkfinalizer(L, gcvalue(obj), mt);\r\n      break;\r\n    }\r\n    case LUA_TUSERDATA: {\r\n      uvalue(obj)->metatable = mt;\r\n      if (mt) {\r\n        luaC_objbarrier(L, rawuvalue(obj), mt);\r\n        luaC_checkfinalizer(L, gcvalue(obj), mt);\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      G(L)->mt[ttypenv(obj)] = mt;\r\n      break;\r\n    }\r\n  }\r\n  L->top--;\r\n  lua_unlock(L);\r\n  return 1;\r\n}\r\n\r\n\r\nLUA_API void lua_setuservalue (lua_State *L, int idx) {\r\n  StkId o;\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  o = index2addr(L, idx);\r\n  api_checkvalidindex(L, o);\r\n  api_check(L, ttisuserdata(o), \"userdata expected\");\r\n  if (ttisnil(L->top - 1))\r\n    uvalue(o)->env = NULL;\r\n  else {\r\n    api_check(L, ttistable(L->top - 1), \"table expected\");\r\n    uvalue(o)->env = hvalue(L->top - 1);\r\n    luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));\r\n  }\r\n  L->top--;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\n/*\r\n** `load' and `call' functions (run Lua code)\r\n*/\r\n\r\n\r\n#define checkresults(L,na,nr) \\\r\n     api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \\\r\n\t\"results from function overflow current stack size\")\r\n\r\n\r\nLUA_API int lua_getctx (lua_State *L, int *ctx) {\r\n  if (L->ci->callstatus & CIST_YIELDED) {\r\n    if (ctx) *ctx = L->ci->u.c.ctx;\r\n    return L->ci->u.c.status;\r\n  }\r\n  else return LUA_OK;\r\n}\r\n\r\n\r\nLUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,\r\n                        lua_CFunction k) {\r\n  StkId func;\r\n  lua_lock(L);\r\n  api_check(L, k == NULL || !isLua(L->ci),\r\n    \"cannot use continuations inside hooks\");\r\n  api_checknelems(L, nargs+1);\r\n  api_check(L, L->status == LUA_OK, \"cannot do calls on non-normal thread\");\r\n  checkresults(L, nargs, nresults);\r\n  func = L->top - (nargs+1);\r\n  if (k != NULL && L->nny == 0) {  /* need to prepare continuation? */\r\n    L->ci->u.c.k = k;  /* save continuation */\r\n    L->ci->u.c.ctx = ctx;  /* save context */\r\n    luaD_call(L, func, nresults, 1);  /* do the call */\r\n  }\r\n  else  /* no continuation or no yieldable */\r\n    luaD_call(L, func, nresults, 0);  /* just do the call */\r\n  adjustresults(L, nresults);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\n\r\n/*\r\n** Execute a protected call.\r\n*/\r\nstruct CallS {  /* data to `f_call' */\r\n  StkId func;\r\n  int nresults;\r\n};\r\n\r\n\r\nstatic void f_call (lua_State *L, void *ud) {\r\n  struct CallS *c = cast(struct CallS *, ud);\r\n  luaD_call(L, c->func, c->nresults, 0);\r\n}\r\n\r\n\r\n\r\nLUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,\r\n                        int ctx, lua_CFunction k) {\r\n  struct CallS c;\r\n  int status;\r\n  ptrdiff_t func;\r\n  lua_lock(L);\r\n  api_check(L, k == NULL || !isLua(L->ci),\r\n    \"cannot use continuations inside hooks\");\r\n  api_checknelems(L, nargs+1);\r\n  api_check(L, L->status == LUA_OK, \"cannot do calls on non-normal thread\");\r\n  checkresults(L, nargs, nresults);\r\n  if (errfunc == 0)\r\n    func = 0;\r\n  else {\r\n    StkId o = index2addr(L, errfunc);\r\n    api_checkvalidindex(L, o);\r\n    func = savestack(L, o);\r\n  }\r\n  c.func = L->top - (nargs+1);  /* function to be called */\r\n  if (k == NULL || L->nny > 0) {  /* no continuation or no yieldable? */\r\n    c.nresults = nresults;  /* do a 'conventional' protected call */\r\n    status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);\r\n  }\r\n  else {  /* prepare continuation (call is already protected by 'resume') */\r\n    CallInfo *ci = L->ci;\r\n    ci->u.c.k = k;  /* save continuation */\r\n    ci->u.c.ctx = ctx;  /* save context */\r\n    /* save information for error recovery */\r\n    ci->u.c.extra = savestack(L, c.func);\r\n    ci->u.c.old_allowhook = L->allowhook;\r\n    ci->u.c.old_errfunc = L->errfunc;\r\n    L->errfunc = func;\r\n    /* mark that function may do error recovery */\r\n    ci->callstatus |= CIST_YPCALL;\r\n    luaD_call(L, c.func, nresults, 1);  /* do the call */\r\n    ci->callstatus &= ~CIST_YPCALL;\r\n    L->errfunc = ci->u.c.old_errfunc;\r\n    status = LUA_OK;  /* if it is here, there were no errors */\r\n  }\r\n  adjustresults(L, nresults);\r\n  lua_unlock(L);\r\n  return status;\r\n}\r\n\r\n\r\nLUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,\r\n                      const char *chunkname, const char *mode) {\r\n  ZIO z;\r\n  int status;\r\n  lua_lock(L);\r\n  if (!chunkname) chunkname = \"?\";\r\n  luaZ_init(L, &z, reader, data);\r\n  status = luaD_protectedparser(L, &z, chunkname, mode);\r\n  if (status == LUA_OK) {  /* no errors? */\r\n    LClosure *f = clLvalue(L->top - 1);  /* get newly created function */\r\n    if (f->nupvalues == 1) {  /* does it have one upvalue? */\r\n      /* get global table from registry */\r\n      Table *reg = hvalue(&G(L)->l_registry);\r\n      const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);\r\n      /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */\r\n      setobj(L, f->upvals[0]->v, gt);\r\n      luaC_barrier(L, f->upvals[0], gt);\r\n    }\r\n  }\r\n  lua_unlock(L);\r\n  return status;\r\n}\r\n\r\n\r\nLUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {\r\n  int status;\r\n  TValue *o;\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  o = L->top - 1;\r\n  if (isLfunction(o))\r\n    status = luaU_dump(L, getproto(o), writer, data, 0);\r\n  else\r\n    status = 1;\r\n  lua_unlock(L);\r\n  return status;\r\n}\r\n\r\n\r\nLUA_API int  lua_status (lua_State *L) {\r\n  return L->status;\r\n}\r\n\r\n\r\n/*\r\n** Garbage-collection function\r\n*/\r\n\r\nLUA_API int lua_gc (lua_State *L, int what, int data) {\r\n  int res = 0;\r\n  global_State *g;\r\n  lua_lock(L);\r\n  g = G(L);\r\n  switch (what) {\r\n    case LUA_GCSTOP: {\r\n      g->gcrunning = 0;\r\n      break;\r\n    }\r\n    case LUA_GCRESTART: {\r\n      luaE_setdebt(g, 0);\r\n      g->gcrunning = 1;\r\n      break;\r\n    }\r\n    case LUA_GCCOLLECT: {\r\n      luaC_fullgc(L, 0);\r\n      break;\r\n    }\r\n    case LUA_GCCOUNT: {\r\n      /* GC values are expressed in Kbytes: #bytes/2^10 */\r\n      res = cast_int(gettotalbytes(g) >> 10);\r\n      break;\r\n    }\r\n    case LUA_GCCOUNTB: {\r\n      res = cast_int(gettotalbytes(g) & 0x3ff);\r\n      break;\r\n    }\r\n    case LUA_GCSTEP: {\r\n      if (g->gckind == KGC_GEN) {  /* generational mode? */\r\n        res = (g->lastmajormem == 0);  /* 1 if will do major collection */\r\n        luaC_forcestep(L);  /* do a single step */\r\n      }\r\n      else {\r\n        while (data-- >= 0) {\r\n          luaC_forcestep(L);\r\n          if (g->gcstate == GCSpause) {  /* end of cycle? */\r\n            res = 1;  /* signal it */\r\n            break;\r\n          }\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case LUA_GCSETPAUSE: {\r\n      res = g->gcpause;\r\n      g->gcpause = data;\r\n      break;\r\n    }\r\n    case LUA_GCSETMAJORINC: {\r\n      res = g->gcmajorinc;\r\n      g->gcmajorinc = data;\r\n      break;\r\n    }\r\n    case LUA_GCSETSTEPMUL: {\r\n      res = g->gcstepmul;\r\n      g->gcstepmul = data;\r\n      break;\r\n    }\r\n    case LUA_GCISRUNNING: {\r\n      res = g->gcrunning;\r\n      break;\r\n    }\r\n    case LUA_GCGEN: {  /* change collector to generational mode */\r\n      luaC_changemode(L, KGC_GEN);\r\n      break;\r\n    }\r\n    case LUA_GCINC: {  /* change collector to incremental mode */\r\n      luaC_changemode(L, KGC_NORMAL);\r\n      break;\r\n    }\r\n    default: res = -1;  /* invalid option */\r\n  }\r\n  lua_unlock(L);\r\n  return res;\r\n}\r\n\r\n\r\n\r\n/*\r\n** miscellaneous functions\r\n*/\r\n\r\n\r\nLUA_API int lua_error (lua_State *L) {\r\n  lua_lock(L);\r\n  api_checknelems(L, 1);\r\n  luaG_errormsg(L);\r\n  lua_unlock(L);\r\n  return 0;  /* to avoid warnings */\r\n}\r\n\r\n\r\nLUA_API int lua_next (lua_State *L, int idx) {\r\n  StkId t;\r\n  int more;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  api_check(L, ttistable(t), \"table expected\");\r\n  more = luaH_next(L, hvalue(t), L->top - 1);\r\n  if (more) {\r\n    api_incr_top(L);\r\n  }\r\n  else  /* no more elements */\r\n    L->top -= 1;  /* remove key */\r\n  lua_unlock(L);\r\n  return more;\r\n}\r\n\r\n\r\nLUA_API void lua_concat (lua_State *L, int n) {\r\n  lua_lock(L);\r\n  api_checknelems(L, n);\r\n  if (n >= 2) {\r\n    luaC_checkGC(L);\r\n    luaV_concat(L, n);\r\n  }\r\n  else if (n == 0) {  /* push empty string */\r\n    setsvalue2s(L, L->top, luaS_newlstr(L, \"\", 0));\r\n    api_incr_top(L);\r\n  }\r\n  /* else n == 1; nothing to do */\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void lua_len (lua_State *L, int idx) {\r\n  StkId t;\r\n  lua_lock(L);\r\n  t = index2addr(L, idx);\r\n  luaV_objlen(L, L->top, t);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {\r\n  lua_Alloc f;\r\n  lua_lock(L);\r\n  if (ud) *ud = G(L)->ud;\r\n  f = G(L)->frealloc;\r\n  lua_unlock(L);\r\n  return f;\r\n}\r\n\r\n\r\nLUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {\r\n  lua_lock(L);\r\n  G(L)->ud = ud;\r\n  G(L)->frealloc = f;\r\n  lua_unlock(L);\r\n}\r\n\r\n\r\nLUA_API void *lua_newuserdata (lua_State *L, size_t size) {\r\n  Udata *u;\r\n  lua_lock(L);\r\n  luaC_checkGC(L);\r\n  u = luaS_newudata(L, size, NULL);\r\n  setuvalue(L, L->top, u);\r\n  api_incr_top(L);\r\n  lua_unlock(L);\r\n  return u + 1;\r\n}\r\n\r\n\r\n\r\nstatic const char *aux_upvalue (StkId fi, int n, TValue **val,\r\n                                GCObject **owner) {\r\n  switch (ttype(fi)) {\r\n    case LUA_TCCL: {  /* C closure */\r\n      CClosure *f = clCvalue(fi);\r\n      if (!(1 <= n && n <= f->nupvalues)) return NULL;\r\n      *val = &f->upvalue[n-1];\r\n      if (owner) *owner = obj2gco(f);\r\n      return \"\";\r\n    }\r\n    case LUA_TLCL: {  /* Lua closure */\r\n      LClosure *f = clLvalue(fi);\r\n      TString *name;\r\n      Proto *p = f->p;\r\n      if (!(1 <= n && n <= p->sizeupvalues)) return NULL;\r\n      *val = f->upvals[n-1]->v;\r\n      if (owner) *owner = obj2gco(f->upvals[n - 1]);\r\n      name = p->upvalues[n-1].name;\r\n      return (name == NULL) ? \"\" : getstr(name);\r\n    }\r\n    default: return NULL;  /* not a closure */\r\n  }\r\n}\r\n\r\n\r\nLUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {\r\n  const char *name;\r\n  TValue *val = NULL;  /* to avoid warnings */\r\n  lua_lock(L);\r\n  name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL);\r\n  if (name) {\r\n    setobj2s(L, L->top, val);\r\n    api_incr_top(L);\r\n  }\r\n  lua_unlock(L);\r\n  return name;\r\n}\r\n\r\n\r\nLUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {\r\n  const char *name;\r\n  TValue *val = NULL;  /* to avoid warnings */\r\n  GCObject *owner = NULL;  /* to avoid warnings */\r\n  StkId fi;\r\n  lua_lock(L);\r\n  fi = index2addr(L, funcindex);\r\n  api_checknelems(L, 1);\r\n  name = aux_upvalue(fi, n, &val, &owner);\r\n  if (name) {\r\n    L->top--;\r\n    setobj(L, val, L->top);\r\n    luaC_barrier(L, owner, L->top);\r\n  }\r\n  lua_unlock(L);\r\n  return name;\r\n}\r\n\r\n\r\nstatic UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {\r\n  LClosure *f;\r\n  StkId fi = index2addr(L, fidx);\r\n  api_check(L, ttisLclosure(fi), \"Lua function expected\");\r\n  f = clLvalue(fi);\r\n  api_check(L, (1 <= n && n <= f->p->sizeupvalues), \"invalid upvalue index\");\r\n  if (pf) *pf = f;\r\n  return &f->upvals[n - 1];  /* get its upvalue pointer */\r\n}\r\n\r\n\r\nLUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {\r\n  StkId fi = index2addr(L, fidx);\r\n  switch (ttype(fi)) {\r\n    case LUA_TLCL: {  /* lua closure */\r\n      return *getupvalref(L, fidx, n, NULL);\r\n    }\r\n    case LUA_TCCL: {  /* C closure */\r\n      CClosure *f = clCvalue(fi);\r\n      api_check(L, 1 <= n && n <= f->nupvalues, \"invalid upvalue index\");\r\n      return &f->upvalue[n - 1];\r\n    }\r\n    default: {\r\n      api_check(L, 0, \"closure expected\");\r\n      return NULL;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nLUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,\r\n                                            int fidx2, int n2) {\r\n  LClosure *f1;\r\n  UpVal **up1 = getupvalref(L, fidx1, n1, &f1);\r\n  UpVal **up2 = getupvalref(L, fidx2, n2, NULL);\r\n  *up1 = *up2;\r\n  luaC_objbarrier(L, f1, *up2);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lapi.h",
    "content": "/*\r\n** $Id: lapi.h,v 2.7 2009/11/27 15:37:59 roberto Exp $\r\n** Auxiliary functions from Lua API\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lapi_h\r\n#define lapi_h\r\n\r\n\r\n#include \"llimits.h\"\r\n#include \"lstate.h\"\r\n\r\n#define api_incr_top(L)   {L->top++; api_check(L, L->top <= L->ci->top, \\\r\n\t\t\t\t\"stack overflow\");}\r\n\r\n#define adjustresults(L,nres) \\\r\n    { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }\r\n\r\n#define api_checknelems(L,n)\tapi_check(L, (n) < (L->top - L->ci->func), \\\r\n\t\t\t\t  \"not enough elements in the stack\")\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lauxlib.c",
    "content": "/*\r\n** $Id: lauxlib.c,v 1.240 2011/12/06 16:33:55 roberto Exp $\r\n** Auxiliary functions for building Lua libraries\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <errno.h>\r\n#include <stdarg.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n\r\n/* This file uses only the official API of Lua.\r\n** Any function declared here could be written as an application function.\r\n*/\r\n\r\n#define lauxlib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Traceback\r\n** =======================================================\r\n*/\r\n\r\n\r\n#define LEVELS1\t12\t/* size of the first part of the stack */\r\n#define LEVELS2\t10\t/* size of the second part of the stack */\r\n\r\n\r\n\r\n/*\r\n** search for 'objidx' in table at index -1.\r\n** return 1 + string at top if find a good name.\r\n*/\r\nstatic int findfield (lua_State *L, int objidx, int level) {\r\n  if (level == 0 || !lua_istable(L, -1))\r\n    return 0;  /* not found */\r\n  lua_pushnil(L);  /* start 'next' loop */\r\n  while (lua_next(L, -2)) {  /* for each pair in table */\r\n    if (lua_type(L, -2) == LUA_TSTRING) {  /* ignore non-string keys */\r\n      if (lua_rawequal(L, objidx, -1)) {  /* found object? */\r\n        lua_pop(L, 1);  /* remove value (but keep name) */\r\n        return 1;\r\n      }\r\n      else if (findfield(L, objidx, level - 1)) {  /* try recursively */\r\n        lua_remove(L, -2);  /* remove table (but keep name) */\r\n        lua_pushliteral(L, \".\");\r\n        lua_insert(L, -2);  /* place '.' between the two names */\r\n        lua_concat(L, 3);\r\n        return 1;\r\n      }\r\n    }\r\n    lua_pop(L, 1);  /* remove value */\r\n  }\r\n  return 0;  /* not found */\r\n}\r\n\r\n\r\nstatic int pushglobalfuncname (lua_State *L, lua_Debug *ar) {\r\n  int top = lua_gettop(L);\r\n  lua_getinfo(L, \"f\", ar);  /* push function */\r\n  lua_pushglobaltable(L);\r\n  if (findfield(L, top + 1, 2)) {\r\n    lua_copy(L, -1, top + 1);  /* move name to proper place */\r\n    lua_pop(L, 2);  /* remove pushed values */\r\n    return 1;\r\n  }\r\n  else {\r\n    lua_settop(L, top);  /* remove function and global table */\r\n    return 0;\r\n  }\r\n}\r\n\r\n\r\nstatic void pushfuncname (lua_State *L, lua_Debug *ar) {\r\n  if (*ar->namewhat != '\\0')  /* is there a name? */\r\n    lua_pushfstring(L, \"function \" LUA_QS, ar->name);\r\n  else if (*ar->what == 'm')  /* main? */\r\n      lua_pushfstring(L, \"main chunk\");\r\n  else if (*ar->what == 'C') {\r\n    if (pushglobalfuncname(L, ar)) {\r\n      lua_pushfstring(L, \"function \" LUA_QS, lua_tostring(L, -1));\r\n      lua_remove(L, -2);  /* remove name */\r\n    }\r\n    else\r\n      lua_pushliteral(L, \"?\");\r\n  }\r\n  else\r\n    lua_pushfstring(L, \"function <%s:%d>\", ar->short_src, ar->linedefined);\r\n}\r\n\r\n\r\nstatic int countlevels (lua_State *L) {\r\n  lua_Debug ar;\r\n  int li = 1, le = 1;\r\n  /* find an upper bound */\r\n  while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }\r\n  /* do a binary search */\r\n  while (li < le) {\r\n    int m = (li + le)/2;\r\n    if (lua_getstack(L, m, &ar)) li = m + 1;\r\n    else le = m;\r\n  }\r\n  return le - 1;\r\n}\r\n\r\n\r\nLUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,\r\n                                const char *msg, int level) {\r\n  lua_Debug ar;\r\n  int top = lua_gettop(L);\r\n  int numlevels = countlevels(L1);\r\n  int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0;\r\n  if (msg) lua_pushfstring(L, \"%s\\n\", msg);\r\n  lua_pushliteral(L, \"stack traceback:\");\r\n  while (lua_getstack(L1, level++, &ar)) {\r\n    if (level == mark) {  /* too many levels? */\r\n      lua_pushliteral(L, \"\\n\\t...\");  /* add a '...' */\r\n      level = numlevels - LEVELS2;  /* and skip to last ones */\r\n    }\r\n    else {\r\n      lua_getinfo(L1, \"Slnt\", &ar);\r\n      lua_pushfstring(L, \"\\n\\t%s:\", ar.short_src);\r\n      if (ar.currentline > 0)\r\n        lua_pushfstring(L, \"%d:\", ar.currentline);\r\n      lua_pushliteral(L, \" in \");\r\n      pushfuncname(L, &ar);\r\n      if (ar.istailcall)\r\n        lua_pushliteral(L, \"\\n\\t(...tail calls...)\");\r\n      lua_concat(L, lua_gettop(L) - top);\r\n    }\r\n  }\r\n  lua_concat(L, lua_gettop(L) - top);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Error-report functions\r\n** =======================================================\r\n*/\r\n\r\nLUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {\r\n  lua_Debug ar;\r\n  if (!lua_getstack(L, 0, &ar))  /* no stack frame? */\r\n    return luaL_error(L, \"bad argument #%d (%s)\", narg, extramsg);\r\n  lua_getinfo(L, \"n\", &ar);\r\n  if (strcmp(ar.namewhat, \"method\") == 0) {\r\n    narg--;  /* do not count `self' */\r\n    if (narg == 0)  /* error is in the self argument itself? */\r\n      return luaL_error(L, \"calling \" LUA_QS \" on bad self\", ar.name);\r\n  }\r\n  if (ar.name == NULL)\r\n    ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : \"?\";\r\n  return luaL_error(L, \"bad argument #%d to \" LUA_QS \" (%s)\",\r\n                        narg, ar.name, extramsg);\r\n}\r\n\r\n\r\nstatic int typeerror (lua_State *L, int narg, const char *tname) {\r\n  const char *msg = lua_pushfstring(L, \"%s expected, got %s\",\r\n                                    tname, luaL_typename(L, narg));\r\n  return luaL_argerror(L, narg, msg);\r\n}\r\n\r\n\r\nstatic void tag_error (lua_State *L, int narg, int tag) {\r\n  typeerror(L, narg, lua_typename(L, tag));\r\n}\r\n\r\n\r\nLUALIB_API void luaL_where (lua_State *L, int level) {\r\n  lua_Debug ar;\r\n  if (lua_getstack(L, level, &ar)) {  /* check function at level */\r\n    lua_getinfo(L, \"Sl\", &ar);  /* get info about it */\r\n    if (ar.currentline > 0) {  /* is there info? */\r\n      lua_pushfstring(L, \"%s:%d: \", ar.short_src, ar.currentline);\r\n      return;\r\n    }\r\n  }\r\n  lua_pushliteral(L, \"\");  /* else, no information available... */\r\n}\r\n\r\n\r\nLUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {\r\n  va_list argp;\r\n  va_start(argp, fmt);\r\n  luaL_where(L, 1);\r\n  lua_pushvfstring(L, fmt, argp);\r\n  va_end(argp);\r\n  lua_concat(L, 2);\r\n  return lua_error(L);\r\n}\r\n\r\n\r\nLUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) {\r\n  int en = errno;  /* calls to Lua API may change this value */\r\n  if (stat) {\r\n    lua_pushboolean(L, 1);\r\n    return 1;\r\n  }\r\n  else {\r\n    lua_pushnil(L);\r\n    if (fname)\r\n      lua_pushfstring(L, \"%s: %s\", fname, strerror(en));\r\n    else\r\n      lua_pushfstring(L, \"%s\", strerror(en));\r\n    lua_pushinteger(L, en);\r\n    return 3;\r\n  }\r\n}\r\n\r\n\r\n#if !defined(inspectstat)\t/* { */\r\n\r\n#if defined(LUA_USE_POSIX)\r\n\r\n#include <sys/wait.h>\r\n\r\n/*\r\n** use appropriate macros to interpret 'pclose' return status\r\n*/\r\n#define inspectstat(stat,what)  \\\r\n   if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \\\r\n   else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = \"signal\"; }\r\n\r\n#else\r\n\r\n#define inspectstat(stat,what)  /* no op */\r\n\r\n#endif\r\n\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\nLUALIB_API int luaL_execresult (lua_State *L, int stat) {\r\n  const char *what = \"exit\";  /* type of termination */\r\n  if (stat == -1)  /* error? */\r\n    return luaL_fileresult(L, 0, NULL);\r\n  else {\r\n    inspectstat(stat, what);  /* interpret result */\r\n    if (*what == 'e' && stat == 0)  /* successful termination? */\r\n      lua_pushboolean(L, 1);\r\n    else\r\n      lua_pushnil(L);\r\n    lua_pushstring(L, what);\r\n    lua_pushinteger(L, stat);\r\n    return 3;  /* return true/nil,what,code */\r\n  }\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Userdata's metatable manipulation\r\n** =======================================================\r\n*/\r\n\r\nLUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {\r\n  luaL_getmetatable(L, tname);  /* try to get metatable */\r\n  if (!lua_isnil(L, -1))  /* name already in use? */\r\n    return 0;  /* leave previous value on top, but return 0 */\r\n  lua_pop(L, 1);\r\n  lua_newtable(L);  /* create metatable */\r\n  lua_pushvalue(L, -1);\r\n  lua_setfield(L, LUA_REGISTRYINDEX, tname);  /* registry.name = metatable */\r\n  return 1;\r\n}\r\n\r\n\r\nLUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) {\r\n  luaL_getmetatable(L, tname);\r\n  lua_setmetatable(L, -2);\r\n}\r\n\r\n\r\nLUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {\r\n  void *p = lua_touserdata(L, ud);\r\n  if (p != NULL) {  /* value is a userdata? */\r\n    if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */\r\n      luaL_getmetatable(L, tname);  /* get correct metatable */\r\n      if (!lua_rawequal(L, -1, -2))  /* not the same? */\r\n        p = NULL;  /* value is a userdata with wrong metatable */\r\n      lua_pop(L, 2);  /* remove both metatables */\r\n      return p;\r\n    }\r\n  }\r\n  return NULL;  /* value is not a userdata with a metatable */\r\n}\r\n\r\n\r\nLUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {\r\n  void *p = luaL_testudata(L, ud, tname);\r\n  if (p == NULL) typeerror(L, ud, tname);\r\n  return p;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Argument check functions\r\n** =======================================================\r\n*/\r\n\r\nLUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,\r\n                                 const char *const lst[]) {\r\n  const char *name = (def) ? luaL_optstring(L, narg, def) :\r\n                             luaL_checkstring(L, narg);\r\n  int i;\r\n  for (i=0; lst[i]; i++)\r\n    if (strcmp(lst[i], name) == 0)\r\n      return i;\r\n  return luaL_argerror(L, narg,\r\n                       lua_pushfstring(L, \"invalid option \" LUA_QS, name));\r\n}\r\n\r\n\r\nLUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) {\r\n  /* keep some extra space to run error routines, if needed */\r\n  const int extra = LUA_MINSTACK;\r\n  if (!lua_checkstack(L, space + extra)) {\r\n    if (msg)\r\n      luaL_error(L, \"stack overflow (%s)\", msg);\r\n    else\r\n      luaL_error(L, \"stack overflow\");\r\n  }\r\n}\r\n\r\n\r\nLUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {\r\n  if (lua_type(L, narg) != t)\r\n    tag_error(L, narg, t);\r\n}\r\n\r\n\r\nLUALIB_API void luaL_checkany (lua_State *L, int narg) {\r\n  if (lua_type(L, narg) == LUA_TNONE)\r\n    luaL_argerror(L, narg, \"value expected\");\r\n}\r\n\r\n\r\nLUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {\r\n  const char *s = lua_tolstring(L, narg, len);\r\n  if (!s) tag_error(L, narg, LUA_TSTRING);\r\n  return s;\r\n}\r\n\r\n\r\nLUALIB_API const char *luaL_optlstring (lua_State *L, int narg,\r\n                                        const char *def, size_t *len) {\r\n  if (lua_isnoneornil(L, narg)) {\r\n    if (len)\r\n      *len = (def ? strlen(def) : 0);\r\n    return def;\r\n  }\r\n  else return luaL_checklstring(L, narg, len);\r\n}\r\n\r\n\r\nLUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {\r\n  int isnum;\r\n  lua_Number d = lua_tonumberx(L, narg, &isnum);\r\n  if (!isnum)\r\n    tag_error(L, narg, LUA_TNUMBER);\r\n  return d;\r\n}\r\n\r\n\r\nLUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {\r\n  return luaL_opt(L, luaL_checknumber, narg, def);\r\n}\r\n\r\n\r\nLUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {\r\n  int isnum;\r\n  lua_Integer d = lua_tointegerx(L, narg, &isnum);\r\n  if (!isnum)\r\n    tag_error(L, narg, LUA_TNUMBER);\r\n  return d;\r\n}\r\n\r\n\r\nLUALIB_API lua_Unsigned luaL_checkunsigned (lua_State *L, int narg) {\r\n  int isnum;\r\n  lua_Unsigned d = lua_tounsignedx(L, narg, &isnum);\r\n  if (!isnum)\r\n    tag_error(L, narg, LUA_TNUMBER);\r\n  return d;\r\n}\r\n\r\n\r\nLUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,\r\n                                                      lua_Integer def) {\r\n  return luaL_opt(L, luaL_checkinteger, narg, def);\r\n}\r\n\r\n\r\nLUALIB_API lua_Unsigned luaL_optunsigned (lua_State *L, int narg,\r\n                                                        lua_Unsigned def) {\r\n  return luaL_opt(L, luaL_checkunsigned, narg, def);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Generic Buffer manipulation\r\n** =======================================================\r\n*/\r\n\r\n/*\r\n** check whether buffer is using a userdata on the stack as a temporary\r\n** buffer\r\n*/\r\n#define buffonstack(B)\t((B)->b != (B)->initb)\r\n\r\n\r\n/*\r\n** returns a pointer to a free area with at least 'sz' bytes\r\n*/\r\nLUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) {\r\n  lua_State *L = B->L;\r\n  if (B->size - B->n < sz) {  /* not enough space? */\r\n    char *newbuff;\r\n    size_t newsize = B->size * 2;  /* double buffer size */\r\n    if (newsize - B->n < sz)  /* not bit enough? */\r\n      newsize = B->n + sz;\r\n    if (newsize < B->n || newsize - B->n < sz)\r\n      luaL_error(L, \"buffer too large\");\r\n    /* create larger buffer */\r\n    newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char));\r\n    /* move content to new buffer */\r\n    memcpy(newbuff, B->b, B->n * sizeof(char));\r\n    if (buffonstack(B))\r\n      lua_remove(L, -2);  /* remove old buffer */\r\n    B->b = newbuff;\r\n    B->size = newsize;\r\n  }\r\n  return &B->b[B->n];\r\n}\r\n\r\n\r\nLUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {\r\n  char *b = luaL_prepbuffsize(B, l);\r\n  memcpy(b, s, l * sizeof(char));\r\n  luaL_addsize(B, l);\r\n}\r\n\r\n\r\nLUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {\r\n  luaL_addlstring(B, s, strlen(s));\r\n}\r\n\r\n\r\nLUALIB_API void luaL_pushresult (luaL_Buffer *B) {\r\n  lua_State *L = B->L;\r\n  lua_pushlstring(L, B->b, B->n);\r\n  if (buffonstack(B))\r\n    lua_remove(L, -2);  /* remove old buffer */\r\n}\r\n\r\n\r\nLUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) {\r\n  luaL_addsize(B, sz);\r\n  luaL_pushresult(B);\r\n}\r\n\r\n\r\nLUALIB_API void luaL_addvalue (luaL_Buffer *B) {\r\n  lua_State *L = B->L;\r\n  size_t l;\r\n  const char *s = lua_tolstring(L, -1, &l);\r\n  if (buffonstack(B))\r\n    lua_insert(L, -2);  /* put value below buffer */\r\n  luaL_addlstring(B, s, l);\r\n  lua_remove(L, (buffonstack(B)) ? -2 : -1);  /* remove value */\r\n}\r\n\r\n\r\nLUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {\r\n  B->L = L;\r\n  B->b = B->initb;\r\n  B->n = 0;\r\n  B->size = LUAL_BUFFERSIZE;\r\n}\r\n\r\n\r\nLUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) {\r\n  luaL_buffinit(L, B);\r\n  return luaL_prepbuffsize(B, sz);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Reference system\r\n** =======================================================\r\n*/\r\n\r\n/* index of free-list header */\r\n#define freelist\t0\r\n\r\n\r\nLUALIB_API int luaL_ref (lua_State *L, int t) {\r\n  int ref;\r\n  t = lua_absindex(L, t);\r\n  if (lua_isnil(L, -1)) {\r\n    lua_pop(L, 1);  /* remove from stack */\r\n    return LUA_REFNIL;  /* `nil' has a unique fixed reference */\r\n  }\r\n  lua_rawgeti(L, t, freelist);  /* get first free element */\r\n  ref = (int)lua_tointeger(L, -1);  /* ref = t[freelist] */\r\n  lua_pop(L, 1);  /* remove it from stack */\r\n  if (ref != 0) {  /* any free element? */\r\n    lua_rawgeti(L, t, ref);  /* remove it from list */\r\n    lua_rawseti(L, t, freelist);  /* (t[freelist] = t[ref]) */\r\n  }\r\n  else  /* no free elements */\r\n    ref = (int)lua_rawlen(L, t) + 1;  /* get a new reference */\r\n  lua_rawseti(L, t, ref);\r\n  return ref;\r\n}\r\n\r\n\r\nLUALIB_API void luaL_unref (lua_State *L, int t, int ref) {\r\n  if (ref >= 0) {\r\n    t = lua_absindex(L, t);\r\n    lua_rawgeti(L, t, freelist);\r\n    lua_rawseti(L, t, ref);  /* t[ref] = t[freelist] */\r\n    lua_pushinteger(L, ref);\r\n    lua_rawseti(L, t, freelist);  /* t[freelist] = ref */\r\n  }\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Load functions\r\n** =======================================================\r\n*/\r\n\r\ntypedef struct LoadF {\r\n  int n;  /* number of pre-read characters */\r\n  FILE *f;  /* file being read */\r\n  char buff[LUAL_BUFFERSIZE];  /* area for reading file */\r\n} LoadF;\r\n\r\n\r\nstatic const char *getF (lua_State *L, void *ud, size_t *size) {\r\n  LoadF *lf = (LoadF *)ud;\r\n  (void)L;  /* not used */\r\n  if (lf->n > 0) {  /* are there pre-read characters to be read? */\r\n    *size = lf->n;  /* return them (chars already in buffer) */\r\n    lf->n = 0;  /* no more pre-read characters */\r\n  }\r\n  else {  /* read a block from file */\r\n    /* 'fread' can return > 0 *and* set the EOF flag. If next call to\r\n       'getF' called 'fread', it might still wait for user input.\r\n       The next check avoids this problem. */\r\n    if (feof(lf->f)) return NULL;\r\n    *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);  /* read block */\r\n  }\r\n  return lf->buff;\r\n}\r\n\r\n\r\nstatic int errfile (lua_State *L, const char *what, int fnameindex) {\r\n  const char *serr = strerror(errno);\r\n  const char *filename = lua_tostring(L, fnameindex) + 1;\r\n  lua_pushfstring(L, \"cannot %s %s: %s\", what, filename, serr);\r\n  lua_remove(L, fnameindex);\r\n  return LUA_ERRFILE;\r\n}\r\n\r\n\r\nstatic int skipBOM (LoadF *lf) {\r\n  const char *p = \"\\xEF\\xBB\\xBF\";  /* Utf8 BOM mark */\r\n  int c;\r\n  lf->n = 0;\r\n  do {\r\n    c = getc(lf->f);\r\n    if (c == EOF || c != *(unsigned char *)p++) return c;\r\n    lf->buff[lf->n++] = c;  /* to be read by the parser */\r\n  } while (*p != '\\0');\r\n  lf->n = 0;  /* prefix matched; discard it */\r\n  return getc(lf->f);  /* return next character */\r\n}\r\n\r\n\r\n/*\r\n** reads the first character of file 'f' and skips an optional BOM mark\r\n** in its beginning plus its first line if it starts with '#'. Returns\r\n** true if it skipped the first line.  In any case, '*cp' has the\r\n** first \"valid\" character of the file (after the optional BOM and\r\n** a first-line comment).\r\n*/\r\nstatic int skipcomment (LoadF *lf, int *cp) {\r\n  int c = *cp = skipBOM(lf);\r\n  if (c == '#') {  /* first line is a comment (Unix exec. file)? */\r\n    while ((c = getc(lf->f)) != EOF && c != '\\n') ;  /* skip first line */\r\n    *cp = getc(lf->f);  /* skip end-of-line */\r\n    return 1;  /* there was a comment */\r\n  }\r\n  else return 0;  /* no comment */\r\n}\r\n\r\n\r\nLUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,\r\n                                             const char *mode) {\r\n  LoadF lf;\r\n  int status, readstatus;\r\n  int c;\r\n  int fnameindex = lua_gettop(L) + 1;  /* index of filename on the stack */\r\n  if (filename == NULL) {\r\n    lua_pushliteral(L, \"=stdin\");\r\n    lf.f = stdin;\r\n  }\r\n  else {\r\n    lua_pushfstring(L, \"@%s\", filename);\r\n    lf.f = fopen(filename, \"r\");\r\n    if (lf.f == NULL) return errfile(L, \"open\", fnameindex);\r\n  }\r\n  if (skipcomment(&lf, &c))  /* read initial portion */\r\n    lf.buff[lf.n++] = '\\n';  /* add line to correct line numbers */\r\n  if (c == LUA_SIGNATURE[0] && filename) {  /* binary file? */\r\n    lf.f = freopen(filename, \"rb\", lf.f);  /* reopen in binary mode */\r\n    if (lf.f == NULL) return errfile(L, \"reopen\", fnameindex);\r\n    skipcomment(&lf, &c);  /* re-read initial portion */\r\n  }\r\n  if (c != EOF)\r\n    lf.buff[lf.n++] = c;  /* 'c' is the first character of the stream */\r\n  status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);\r\n  readstatus = ferror(lf.f);\r\n  if (filename) fclose(lf.f);  /* close file (even in case of errors) */\r\n  if (readstatus) {\r\n    lua_settop(L, fnameindex);  /* ignore results from `lua_load' */\r\n    return errfile(L, \"read\", fnameindex);\r\n  }\r\n  lua_remove(L, fnameindex);\r\n  return status;\r\n}\r\n\r\n\r\ntypedef struct LoadS {\r\n  const char *s;\r\n  size_t size;\r\n} LoadS;\r\n\r\n\r\nstatic const char *getS (lua_State *L, void *ud, size_t *size) {\r\n  LoadS *ls = (LoadS *)ud;\r\n  (void)L;  /* not used */\r\n  if (ls->size == 0) return NULL;\r\n  *size = ls->size;\r\n  ls->size = 0;\r\n  return ls->s;\r\n}\r\n\r\n\r\nLUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size,\r\n                                 const char *name, const char *mode) {\r\n  LoadS ls;\r\n  ls.s = buff;\r\n  ls.size = size;\r\n  return lua_load(L, getS, &ls, name, mode);\r\n}\r\n\r\n\r\nLUALIB_API int luaL_loadstring (lua_State *L, const char *s) {\r\n  return luaL_loadbuffer(L, s, strlen(s), s);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\nLUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {\r\n  if (!lua_getmetatable(L, obj))  /* no metatable? */\r\n    return 0;\r\n  lua_pushstring(L, event);\r\n  lua_rawget(L, -2);\r\n  if (lua_isnil(L, -1)) {\r\n    lua_pop(L, 2);  /* remove metatable and metafield */\r\n    return 0;\r\n  }\r\n  else {\r\n    lua_remove(L, -2);  /* remove only metatable */\r\n    return 1;\r\n  }\r\n}\r\n\r\n\r\nLUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {\r\n  obj = lua_absindex(L, obj);\r\n  if (!luaL_getmetafield(L, obj, event))  /* no metafield? */\r\n    return 0;\r\n  lua_pushvalue(L, obj);\r\n  lua_call(L, 1, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nLUALIB_API int luaL_len (lua_State *L, int idx) {\r\n  int l;\r\n  int isnum;\r\n  lua_len(L, idx);\r\n  l = (int)lua_tointegerx(L, -1, &isnum);\r\n  if (!isnum)\r\n    luaL_error(L, \"object length is not a number\");\r\n  lua_pop(L, 1);  /* remove object */\r\n  return l;\r\n}\r\n\r\n\r\nLUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {\r\n  if (!luaL_callmeta(L, idx, \"__tostring\")) {  /* no metafield? */\r\n    switch (lua_type(L, idx)) {\r\n      case LUA_TNUMBER:\r\n      case LUA_TSTRING:\r\n        lua_pushvalue(L, idx);\r\n        break;\r\n      case LUA_TBOOLEAN:\r\n        lua_pushstring(L, (lua_toboolean(L, idx) ? \"true\" : \"false\"));\r\n        break;\r\n      case LUA_TNIL:\r\n        lua_pushliteral(L, \"nil\");\r\n        break;\r\n      default:\r\n        lua_pushfstring(L, \"%s: %p\", luaL_typename(L, idx),\r\n                                            lua_topointer(L, idx));\r\n        break;\r\n    }\r\n  }\r\n  return lua_tolstring(L, -1, len);\r\n}\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Compatibility with 5.1 module functions\r\n** =======================================================\r\n*/\r\n#if defined(LUA_COMPAT_MODULE)\r\n\r\nstatic const char *luaL_findtable (lua_State *L, int idx,\r\n                                   const char *fname, int szhint) {\r\n  const char *e;\r\n  if (idx) lua_pushvalue(L, idx);\r\n  do {\r\n    e = strchr(fname, '.');\r\n    if (e == NULL) e = fname + strlen(fname);\r\n    lua_pushlstring(L, fname, e - fname);\r\n    lua_rawget(L, -2);\r\n    if (lua_isnil(L, -1)) {  /* no such field? */\r\n      lua_pop(L, 1);  /* remove this nil */\r\n      lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */\r\n      lua_pushlstring(L, fname, e - fname);\r\n      lua_pushvalue(L, -2);\r\n      lua_settable(L, -4);  /* set new table into field */\r\n    }\r\n    else if (!lua_istable(L, -1)) {  /* field has a non-table value? */\r\n      lua_pop(L, 2);  /* remove table and value */\r\n      return fname;  /* return problematic part of the name */\r\n    }\r\n    lua_remove(L, -2);  /* remove previous table */\r\n    fname = e + 1;\r\n  } while (*e == '.');\r\n  return NULL;\r\n}\r\n\r\n\r\n/*\r\n** Count number of elements in a luaL_Reg list.\r\n*/\r\nstatic int libsize (const luaL_Reg *l) {\r\n  int size = 0;\r\n  for (; l && l->name; l++) size++;\r\n  return size;\r\n}\r\n\r\n\r\n/*\r\n** Find or create a module table with a given name. The function\r\n** first looks at the _LOADED table and, if that fails, try a\r\n** global variable with that name. In any case, leaves on the stack\r\n** the module table.\r\n*/\r\nLUALIB_API void luaL_pushmodule (lua_State *L, const char *modname,\r\n                                 int sizehint) {\r\n  luaL_findtable(L, LUA_REGISTRYINDEX, \"_LOADED\", 1);  /* get _LOADED table */\r\n  lua_getfield(L, -1, modname);  /* get _LOADED[modname] */\r\n  if (!lua_istable(L, -1)) {  /* not found? */\r\n    lua_pop(L, 1);  /* remove previous result */\r\n    /* try global variable (and create one if it does not exist) */\r\n    lua_pushglobaltable(L);\r\n    if (luaL_findtable(L, 0, modname, sizehint) != NULL)\r\n      luaL_error(L, \"name conflict for module \" LUA_QS, modname);\r\n    lua_pushvalue(L, -1);\r\n    lua_setfield(L, -3, modname);  /* _LOADED[modname] = new table */\r\n  }\r\n  lua_remove(L, -2);  /* remove _LOADED table */\r\n}\r\n\r\n\r\nLUALIB_API void luaL_openlib (lua_State *L, const char *libname,\r\n                               const luaL_Reg *l, int nup) {\r\n  luaL_checkversion(L);\r\n  if (libname) {\r\n    luaL_pushmodule(L, libname, libsize(l));  /* get/create library table */\r\n    lua_insert(L, -(nup + 1));  /* move library table to below upvalues */\r\n  }\r\n  if (l)\r\n    luaL_setfuncs(L, l, nup);\r\n  else\r\n    lua_pop(L, nup);  /* remove upvalues */\r\n}\r\n\r\n#endif\r\n/* }====================================================== */\r\n\r\n/*\r\n** set functions from list 'l' into table at top - 'nup'; each\r\n** function gets the 'nup' elements at the top as upvalues.\r\n** Returns with only the table at the stack.\r\n*/\r\nLUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {\r\n  luaL_checkstack(L, nup, \"too many upvalues\");\r\n  for (; l->name != NULL; l++) {  /* fill the table with given functions */\r\n    int i;\r\n    for (i = 0; i < nup; i++)  /* copy upvalues to the top */\r\n      lua_pushvalue(L, -nup);\r\n    lua_pushcclosure(L, l->func, nup);  /* closure with those upvalues */\r\n    lua_setfield(L, -(nup + 2), l->name);\r\n  }\r\n  lua_pop(L, nup);  /* remove upvalues */\r\n}\r\n\r\n\r\n/*\r\n** ensure that stack[idx][fname] has a table and push that table\r\n** into the stack\r\n*/\r\nLUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {\r\n  lua_getfield(L, idx, fname);\r\n  if (lua_istable(L, -1)) return 1;  /* table already there */\r\n  else {\r\n    idx = lua_absindex(L, idx);\r\n    lua_pop(L, 1);  /* remove previous result */\r\n    lua_newtable(L);\r\n    lua_pushvalue(L, -1);  /* copy to be left at top */\r\n    lua_setfield(L, idx, fname);  /* assign new table to field */\r\n    return 0;  /* false, because did not find table there */\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** stripped-down 'require'. Calls 'openf' to open a module,\r\n** registers the result in 'package.loaded' table and, if 'glb'\r\n** is true, also registers the result in the global table.\r\n** Leaves resulting module on the top.\r\n*/\r\nLUALIB_API void luaL_requiref (lua_State *L, const char *modname,\r\n                               lua_CFunction openf, int glb) {\r\n  lua_pushcfunction(L, openf);\r\n  lua_pushstring(L, modname);  /* argument to open function */\r\n  lua_call(L, 1, 1);  /* open module */\r\n  luaL_getsubtable(L, LUA_REGISTRYINDEX, \"_LOADED\");\r\n  lua_pushvalue(L, -2);  /* make copy of module (call result) */\r\n  lua_setfield(L, -2, modname);  /* _LOADED[modname] = module */\r\n  lua_pop(L, 1);  /* remove _LOADED table */\r\n  if (glb) {\r\n    lua_pushglobaltable(L);\r\n    lua_pushvalue(L, -2);  /* copy of 'mod' */\r\n    lua_setfield(L, -2, modname);  /* _G[modname] = module */\r\n    lua_pop(L, 1);  /* remove _G table */\r\n  }\r\n}\r\n\r\n\r\nLUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,\r\n                                                               const char *r) {\r\n  const char *wild;\r\n  size_t l = strlen(p);\r\n  luaL_Buffer b;\r\n  luaL_buffinit(L, &b);\r\n  while ((wild = strstr(s, p)) != NULL) {\r\n    luaL_addlstring(&b, s, wild - s);  /* push prefix */\r\n    luaL_addstring(&b, r);  /* push replacement in place of pattern */\r\n    s = wild + l;  /* continue after `p' */\r\n  }\r\n  luaL_addstring(&b, s);  /* push last suffix */\r\n  luaL_pushresult(&b);\r\n  return lua_tostring(L, -1);\r\n}\r\n\r\n\r\nstatic void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {\r\n  (void)ud; (void)osize;  /* not used */\r\n  if (nsize == 0) {\r\n    free(ptr);\r\n    return NULL;\r\n  }\r\n  else\r\n    return realloc(ptr, nsize);\r\n}\r\n\r\n\r\nstatic int panic (lua_State *L) {\r\n  luai_writestringerror(\"PANIC: unprotected error in call to Lua API (%s)\\n\",\r\n                   lua_tostring(L, -1));\r\n  return 0;  /* return to Lua to abort */\r\n}\r\n\r\n\r\nLUALIB_API lua_State *luaL_newstate (void) {\r\n  lua_State *L = lua_newstate(l_alloc, NULL);\r\n  if (L) lua_atpanic(L, &panic);\r\n  return L;\r\n}\r\n\r\n\r\nLUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) {\r\n  const lua_Number *v = lua_version(L);\r\n  if (v != lua_version(NULL))\r\n    luaL_error(L, \"multiple Lua VMs detected\");\r\n  else if (*v != ver)\r\n    luaL_error(L, \"version mismatch: app. needs %f, Lua core provides %f\",\r\n                  ver, *v);\r\n  /* check conversions number -> integer types */\r\n  lua_pushnumber(L, -(lua_Number)0x1234);\r\n  if (lua_tointeger(L, -1) != -0x1234 ||\r\n      lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234)\r\n    luaL_error(L, \"bad conversion number->int;\"\r\n                  \" must recompile Lua with proper settings\");\r\n  lua_pop(L, 1);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lauxlib.h",
    "content": "/*\r\n** $Id: lauxlib.h,v 1.120 2011/11/29 15:55:08 roberto Exp $\r\n** Auxiliary functions for building Lua libraries\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#ifndef lauxlib_h\r\n#define lauxlib_h\r\n\r\n\r\n#include <stddef.h>\r\n#include <stdio.h>\r\n\r\n#include \"lua.h\"\r\n\r\n\r\n\r\n/* extra error code for `luaL_load' */\r\n#define LUA_ERRFILE     (LUA_ERRERR+1)\r\n\r\n\r\ntypedef struct luaL_Reg {\r\n  const char *name;\r\n  lua_CFunction func;\r\n} luaL_Reg;\r\n\r\n\r\nLUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver);\r\n#define luaL_checkversion(L)\tluaL_checkversion_(L, LUA_VERSION_NUM)\r\n\r\nLUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);\r\nLUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);\r\nLUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);\r\nLUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);\r\nLUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,\r\n                                                          size_t *l);\r\nLUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,\r\n                                          const char *def, size_t *l);\r\nLUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);\r\nLUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);\r\n\r\nLUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);\r\nLUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,\r\n                                          lua_Integer def);\r\nLUALIB_API lua_Unsigned (luaL_checkunsigned) (lua_State *L, int numArg);\r\nLUALIB_API lua_Unsigned (luaL_optunsigned) (lua_State *L, int numArg,\r\n                                            lua_Unsigned def);\r\n\r\nLUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);\r\nLUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);\r\nLUALIB_API void (luaL_checkany) (lua_State *L, int narg);\r\n\r\nLUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);\r\nLUALIB_API void  (luaL_setmetatable) (lua_State *L, const char *tname);\r\nLUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);\r\nLUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);\r\n\r\nLUALIB_API void (luaL_where) (lua_State *L, int lvl);\r\nLUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);\r\n\r\nLUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,\r\n                                   const char *const lst[]);\r\n\r\nLUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);\r\nLUALIB_API int (luaL_execresult) (lua_State *L, int stat);\r\n\r\n/* pre-defined references */\r\n#define LUA_NOREF       (-2)\r\n#define LUA_REFNIL      (-1)\r\n\r\nLUALIB_API int (luaL_ref) (lua_State *L, int t);\r\nLUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);\r\n\r\nLUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,\r\n                                               const char *mode);\r\n\r\n#define luaL_loadfile(L,f)\tluaL_loadfilex(L,f,NULL)\r\n\r\nLUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,\r\n                                   const char *name, const char *mode);\r\nLUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);\r\n\r\nLUALIB_API lua_State *(luaL_newstate) (void);\r\n\r\nLUALIB_API int (luaL_len) (lua_State *L, int idx);\r\n\r\nLUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,\r\n                                                  const char *r);\r\n\r\nLUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);\r\n\r\nLUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);\r\n\r\nLUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,\r\n                                  const char *msg, int level);\r\n\r\nLUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,\r\n                                 lua_CFunction openf, int glb);\r\n\r\n/*\r\n** ===============================================================\r\n** some useful macros\r\n** ===============================================================\r\n*/\r\n\r\n\r\n#define luaL_newlibtable(L,l)\t\\\r\n  lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)\r\n\r\n#define luaL_newlib(L,l)\t(luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))\r\n\r\n#define luaL_argcheck(L, cond,numarg,extramsg)\t\\\r\n\t\t((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))\r\n#define luaL_checkstring(L,n)\t(luaL_checklstring(L, (n), NULL))\r\n#define luaL_optstring(L,n,d)\t(luaL_optlstring(L, (n), (d), NULL))\r\n#define luaL_checkint(L,n)\t((int)luaL_checkinteger(L, (n)))\r\n#define luaL_optint(L,n,d)\t((int)luaL_optinteger(L, (n), (d)))\r\n#define luaL_checklong(L,n)\t((long)luaL_checkinteger(L, (n)))\r\n#define luaL_optlong(L,n,d)\t((long)luaL_optinteger(L, (n), (d)))\r\n\r\n#define luaL_typename(L,i)\tlua_typename(L, lua_type(L,(i)))\r\n\r\n#define luaL_dofile(L, fn) \\\r\n\t(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))\r\n\r\n#define luaL_dostring(L, s) \\\r\n\t(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))\r\n\r\n#define luaL_getmetatable(L,n)\t(lua_getfield(L, LUA_REGISTRYINDEX, (n)))\r\n\r\n#define luaL_opt(L,f,n,d)\t(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))\r\n\r\n#ifndef DEBUG_LUAEDIT\r\n#define luaL_loadbuffer(L,s,sz,n)\tluaL_loadbufferx(L,s,sz,n,NULL)\r\n#else\r\nLUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, const char *name);\r\n#endif\r\n/*\r\n** {======================================================\r\n** Generic Buffer manipulation\r\n** =======================================================\r\n*/\r\n\r\ntypedef struct luaL_Buffer {\r\n  char *b;  /* buffer address */\r\n  size_t size;  /* buffer size */\r\n  size_t n;  /* number of characters in buffer */\r\n  lua_State *L;\r\n  char initb[LUAL_BUFFERSIZE];  /* initial buffer */\r\n} luaL_Buffer;\r\n\r\n\r\n#define luaL_addchar(B,c) \\\r\n  ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \\\r\n   ((B)->b[(B)->n++] = (c)))\r\n\r\n#define luaL_addsize(B,s)\t((B)->n += (s))\r\n\r\nLUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);\r\nLUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);\r\nLUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);\r\nLUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);\r\nLUALIB_API void (luaL_addvalue) (luaL_Buffer *B);\r\nLUALIB_API void (luaL_pushresult) (luaL_Buffer *B);\r\nLUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);\r\nLUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);\r\n\r\n#define luaL_prepbuffer(B)\tluaL_prepbuffsize(B, LUAL_BUFFERSIZE)\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** File handles for IO library\r\n** =======================================================\r\n*/\r\n\r\n/*\r\n** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and\r\n** initial structure 'luaL_Stream' (it may contain other fields\r\n** after that initial structure).\r\n*/\r\n\r\n#define LUA_FILEHANDLE          \"FILE*\"\r\n\r\n\r\ntypedef struct luaL_Stream {\r\n  FILE *f;  /* stream (NULL for incompletely created streams) */\r\n  lua_CFunction closef;  /* to close stream (NULL for closed streams) */\r\n} luaL_Stream;\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/* compatibility with old module system */\r\n#if defined(LUA_COMPAT_MODULE)\r\n\r\nLUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,\r\n                                   int sizehint);\r\nLUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,\r\n                                const luaL_Reg *l, int nup);\r\n\r\n#define luaL_register(L,n,l)\t(luaL_openlib(L,(n),(l),0))\r\n\r\n#endif\r\n\r\n\r\n#endif\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lbaselib.c",
    "content": "/*\r\n** $Id: lbaselib.c,v 1.273 2011/11/30 13:03:24 roberto Exp $\r\n** Basic library\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n\r\n#include <ctype.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define lbaselib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\nstatic int luaB_print (lua_State *L) {\r\n  int n = lua_gettop(L);  /* number of arguments */\r\n  int i;\r\n  lua_getglobal(L, \"tostring\");\r\n  for (i=1; i<=n; i++) {\r\n    const char *s;\r\n    size_t l;\r\n    lua_pushvalue(L, -1);  /* function to be called */\r\n    lua_pushvalue(L, i);   /* value to print */\r\n    lua_call(L, 1, 1);\r\n    s = lua_tolstring(L, -1, &l);  /* get result */\r\n    if (s == NULL)\r\n      return luaL_error(L,\r\n         LUA_QL(\"tostring\") \" must return a string to \" LUA_QL(\"print\"));\r\n    if (i>1) luai_writestring(\"\\t\", 1);\r\n    luai_writestring(s, l);\r\n    lua_pop(L, 1);  /* pop result */\r\n  }\r\n  luai_writeline();\r\n  return 0;\r\n}\r\n\r\n\r\n#define SPACECHARS\t\" \\f\\n\\r\\t\\v\"\r\n\r\nstatic int luaB_tonumber (lua_State *L) {\r\n  if (lua_isnoneornil(L, 2)) {  /* standard conversion */\r\n    int isnum;\r\n    lua_Number n = lua_tonumberx(L, 1, &isnum);\r\n    if (isnum) {\r\n      lua_pushnumber(L, n);\r\n      return 1;\r\n    }  /* else not a number; must be something */\r\n    luaL_checkany(L, 1);\r\n  }\r\n  else {\r\n    size_t l;\r\n    const char *s = luaL_checklstring(L, 1, &l);\r\n    const char *e = s + l;  /* end point for 's' */\r\n    int base = luaL_checkint(L, 2);\r\n    int neg = 0;\r\n    luaL_argcheck(L, 2 <= base && base <= 36, 2, \"base out of range\");\r\n    s += strspn(s, SPACECHARS);  /* skip initial spaces */\r\n    if (*s == '-') { s++; neg = 1; }  /* handle signal */\r\n    else if (*s == '+') s++;\r\n    if (isalnum((unsigned char)*s)) {\r\n      lua_Number n = 0;\r\n      do {\r\n        int digit = (isdigit((unsigned char)*s)) ? *s - '0'\r\n                       : toupper((unsigned char)*s) - 'A' + 10;\r\n        if (digit >= base) break;  /* invalid numeral; force a fail */\r\n        n = n * (lua_Number)base + (lua_Number)digit;\r\n        s++;\r\n      } while (isalnum((unsigned char)*s));\r\n      s += strspn(s, SPACECHARS);  /* skip trailing spaces */\r\n      if (s == e) {  /* no invalid trailing characters? */\r\n        lua_pushnumber(L, (neg) ? -n : n);\r\n        return 1;\r\n      }  /* else not a number */\r\n    }  /* else not a number */\r\n  }\r\n  lua_pushnil(L);  /* not a number */\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_error (lua_State *L) {\r\n  int level = luaL_optint(L, 2, 1);\r\n  lua_settop(L, 1);\r\n  if (lua_isstring(L, 1) && level > 0) {  /* add extra information? */\r\n    luaL_where(L, level);\r\n    lua_pushvalue(L, 1);\r\n    lua_concat(L, 2);\r\n  }\r\n  return lua_error(L);\r\n}\r\n\r\n\r\nstatic int luaB_getmetatable (lua_State *L) {\r\n  luaL_checkany(L, 1);\r\n  if (!lua_getmetatable(L, 1)) {\r\n    lua_pushnil(L);\r\n    return 1;  /* no metatable */\r\n  }\r\n  luaL_getmetafield(L, 1, \"__metatable\");\r\n  return 1;  /* returns either __metatable field (if present) or metatable */\r\n}\r\n\r\n\r\nstatic int luaB_setmetatable (lua_State *L) {\r\n  int t = lua_type(L, 2);\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,\r\n                    \"nil or table expected\");\r\n  if (luaL_getmetafield(L, 1, \"__metatable\"))\r\n    return luaL_error(L, \"cannot change a protected metatable\");\r\n  lua_settop(L, 2);\r\n  lua_setmetatable(L, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_rawequal (lua_State *L) {\r\n  luaL_checkany(L, 1);\r\n  luaL_checkany(L, 2);\r\n  lua_pushboolean(L, lua_rawequal(L, 1, 2));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_rawlen (lua_State *L) {\r\n  int t = lua_type(L, 1);\r\n  luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1,\r\n                   \"table or string expected\");\r\n  lua_pushinteger(L, lua_rawlen(L, 1));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_rawget (lua_State *L) {\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  luaL_checkany(L, 2);\r\n  lua_settop(L, 2);\r\n  lua_rawget(L, 1);\r\n  return 1;\r\n}\r\n\r\nstatic int luaB_rawset (lua_State *L) {\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  luaL_checkany(L, 2);\r\n  luaL_checkany(L, 3);\r\n  lua_settop(L, 3);\r\n  lua_rawset(L, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_collectgarbage (lua_State *L) {\r\n  static const char *const opts[] = {\"stop\", \"restart\", \"collect\",\r\n    \"count\", \"step\", \"setpause\", \"setstepmul\",\r\n    \"setmajorinc\", \"isrunning\", \"generational\", \"incremental\", NULL};\r\n  static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,\r\n    LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL,\r\n    LUA_GCSETMAJORINC, LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC};\r\n  int o = optsnum[luaL_checkoption(L, 1, \"collect\", opts)];\r\n  int ex = luaL_optint(L, 2, 0);\r\n  int res = lua_gc(L, o, ex);\r\n  switch (o) {\r\n    case LUA_GCCOUNT: {\r\n      int b = lua_gc(L, LUA_GCCOUNTB, 0);\r\n      lua_pushnumber(L, res + ((lua_Number)b/1024));\r\n      lua_pushinteger(L, b);\r\n      return 2;\r\n    }\r\n    case LUA_GCSTEP: case LUA_GCISRUNNING: {\r\n      lua_pushboolean(L, res);\r\n      return 1;\r\n    }\r\n    default: {\r\n      lua_pushinteger(L, res);\r\n      return 1;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic int luaB_type (lua_State *L) {\r\n  luaL_checkany(L, 1);\r\n  lua_pushstring(L, luaL_typename(L, 1));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int pairsmeta (lua_State *L, const char *method, int iszero,\r\n                      lua_CFunction iter) {\r\n  if (!luaL_getmetafield(L, 1, method)) {  /* no metamethod? */\r\n    luaL_checktype(L, 1, LUA_TTABLE);  /* argument must be a table */\r\n    lua_pushcfunction(L, iter);  /* will return generator, */\r\n    lua_pushvalue(L, 1);  /* state, */\r\n    if (iszero) lua_pushinteger(L, 0);  /* and initial value */\r\n    else lua_pushnil(L);\r\n  }\r\n  else {\r\n    lua_pushvalue(L, 1);  /* argument 'self' to metamethod */\r\n    lua_call(L, 1, 3);  /* get 3 values from metamethod */\r\n  }\r\n  return 3;\r\n}\r\n\r\n\r\nstatic int luaB_next (lua_State *L) {\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  lua_settop(L, 2);  /* create a 2nd argument if there isn't one */\r\n  if (lua_next(L, 1))\r\n    return 2;\r\n  else {\r\n    lua_pushnil(L);\r\n    return 1;\r\n  }\r\n}\r\n\r\n\r\nstatic int luaB_pairs (lua_State *L) {\r\n  return pairsmeta(L, \"__pairs\", 0, luaB_next);\r\n}\r\n\r\n\r\nstatic int ipairsaux (lua_State *L) {\r\n  int i = luaL_checkint(L, 2);\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  i++;  /* next value */\r\n  lua_pushinteger(L, i);\r\n  lua_rawgeti(L, 1, i);\r\n  return (lua_isnil(L, -1)) ? 1 : 2;\r\n}\r\n\r\n\r\nstatic int luaB_ipairs (lua_State *L) {\r\n  return pairsmeta(L, \"__ipairs\", 1, ipairsaux);\r\n}\r\n\r\n\r\nstatic int load_aux (lua_State *L, int status) {\r\n  if (status == LUA_OK)\r\n    return 1;\r\n  else {\r\n    lua_pushnil(L);\r\n    lua_insert(L, -2);  /* put before error message */\r\n    return 2;  /* return nil plus error message */\r\n  }\r\n}\r\n\r\n\r\nstatic int luaB_loadfile (lua_State *L) {\r\n  const char *fname = luaL_optstring(L, 1, NULL);\r\n  const char *mode = luaL_optstring(L, 2, NULL);\r\n  int env = !lua_isnone(L, 3);  /* 'env' parameter? */\r\n  int status = luaL_loadfilex(L, fname, mode);\r\n  if (status == LUA_OK && env) {  /* 'env' parameter? */\r\n    lua_pushvalue(L, 3);\r\n    lua_setupvalue(L, -2, 1);  /* set it as 1st upvalue of loaded chunk */\r\n  }\r\n  return load_aux(L, status);\r\n}\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Generic Read function\r\n** =======================================================\r\n*/\r\n\r\n\r\n/*\r\n** reserved slot, above all arguments, to hold a copy of the returned\r\n** string to avoid it being collected while parsed. 'load' has four\r\n** optional arguments (chunk, source name, mode, and environment).\r\n*/\r\n#define RESERVEDSLOT\t5\r\n\r\n\r\n/*\r\n** Reader for generic `load' function: `lua_load' uses the\r\n** stack for internal stuff, so the reader cannot change the\r\n** stack top. Instead, it keeps its resulting string in a\r\n** reserved slot inside the stack.\r\n*/\r\nstatic const char *generic_reader (lua_State *L, void *ud, size_t *size) {\r\n  (void)(ud);  /* not used */\r\n  luaL_checkstack(L, 2, \"too many nested functions\");\r\n  lua_pushvalue(L, 1);  /* get function */\r\n  lua_call(L, 0, 1);  /* call it */\r\n  if (lua_isnil(L, -1)) {\r\n    *size = 0;\r\n    return NULL;\r\n  }\r\n  else if (!lua_isstring(L, -1))\r\n    luaL_error(L, \"reader function must return a string\");\r\n  lua_replace(L, RESERVEDSLOT);  /* save string in reserved slot */\r\n  return lua_tolstring(L, RESERVEDSLOT, size);\r\n}\r\n\r\n\r\nstatic int luaB_load (lua_State *L) {\r\n  int status;\r\n  size_t l;\r\n  int top = lua_gettop(L);\r\n  const char *s = lua_tolstring(L, 1, &l);\r\n  const char *mode = luaL_optstring(L, 3, \"bt\");\r\n  if (s != NULL) {  /* loading a string? */\r\n    const char *chunkname = luaL_optstring(L, 2, s);\r\n    status = luaL_loadbufferx(L, s, l, chunkname, mode);\r\n  }\r\n  else {  /* loading from a reader function */\r\n    const char *chunkname = luaL_optstring(L, 2, \"=(load)\");\r\n    luaL_checktype(L, 1, LUA_TFUNCTION);\r\n    lua_settop(L, RESERVEDSLOT);  /* create reserved slot */\r\n    status = lua_load(L, generic_reader, NULL, chunkname, mode);\r\n  }\r\n  if (status == LUA_OK && top >= 4) {  /* is there an 'env' argument */\r\n    lua_pushvalue(L, 4);  /* environment for loaded function */\r\n    lua_setupvalue(L, -2, 1);  /* set it as 1st upvalue */\r\n  }\r\n  return load_aux(L, status);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\nstatic int dofilecont (lua_State *L) {\r\n  return lua_gettop(L) - 1;\r\n}\r\n\r\n\r\nstatic int luaB_dofile (lua_State *L) {\r\n  const char *fname = luaL_optstring(L, 1, NULL);\r\n  lua_settop(L, 1);\r\n  if (luaL_loadfile(L, fname) != LUA_OK) lua_error(L);\r\n  lua_callk(L, 0, LUA_MULTRET, 0, dofilecont);\r\n  return dofilecont(L);\r\n}\r\n\r\n\r\nstatic int luaB_assert (lua_State *L) {\r\n  if (!lua_toboolean(L, 1))\r\n    return luaL_error(L, \"%s\", luaL_optstring(L, 2, \"assertion failed!\"));\r\n  return lua_gettop(L);\r\n}\r\n\r\n\r\nstatic int luaB_select (lua_State *L) {\r\n  int n = lua_gettop(L);\r\n  if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {\r\n    lua_pushinteger(L, n-1);\r\n    return 1;\r\n  }\r\n  else {\r\n    int i = luaL_checkint(L, 1);\r\n    if (i < 0) i = n + i;\r\n    else if (i > n) i = n;\r\n    luaL_argcheck(L, 1 <= i, 1, \"index out of range\");\r\n    return n - i;\r\n  }\r\n}\r\n\r\n\r\nstatic int finishpcall (lua_State *L, int status) {\r\n  if (!lua_checkstack(L, 1)) {  /* no space for extra boolean? */\r\n    lua_settop(L, 0);  /* create space for return values */\r\n    lua_pushboolean(L, 0);\r\n    lua_pushstring(L, \"stack overflow\");\r\n    return 2;  /* return false, msg */\r\n  }\r\n  lua_pushboolean(L, status);  /* first result (status) */\r\n  lua_replace(L, 1);  /* put first result in first slot */\r\n  return lua_gettop(L);\r\n}\r\n\r\n\r\nstatic int pcallcont (lua_State *L) {\r\n  int status = lua_getctx(L, NULL);\r\n  return finishpcall(L, (status == LUA_YIELD));\r\n}\r\n\r\n\r\nstatic int luaB_pcall (lua_State *L) {\r\n  int status;\r\n  luaL_checkany(L, 1);\r\n  lua_pushnil(L);\r\n  lua_insert(L, 1);  /* create space for status result */\r\n  status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, pcallcont);\r\n  return finishpcall(L, (status == LUA_OK));\r\n}\r\n\r\n\r\nstatic int luaB_xpcall (lua_State *L) {\r\n  int status;\r\n  int n = lua_gettop(L);\r\n  luaL_argcheck(L, n >= 2, 2, \"value expected\");\r\n  lua_pushvalue(L, 1);  /* exchange function... */\r\n  lua_copy(L, 2, 1);  /* ...and error handler */\r\n  lua_replace(L, 2);\r\n  status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 0, pcallcont);\r\n  return finishpcall(L, (status == LUA_OK));\r\n}\r\n\r\n\r\nstatic int luaB_tostring (lua_State *L) {\r\n  luaL_checkany(L, 1);\r\n  luaL_tolstring(L, 1, NULL);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic const luaL_Reg base_funcs[] = {\r\n  {\"assert\", luaB_assert},\r\n  {\"collectgarbage\", luaB_collectgarbage},\r\n  {\"dofile\", luaB_dofile},\r\n  {\"error\", luaB_error},\r\n  {\"getmetatable\", luaB_getmetatable},\r\n  {\"ipairs\", luaB_ipairs},\r\n  {\"loadfile\", luaB_loadfile},\r\n  {\"load\", luaB_load},\r\n#if defined(LUA_COMPAT_LOADSTRING)\r\n  {\"loadstring\", luaB_load},\r\n#endif\r\n  {\"next\", luaB_next},\r\n  {\"pairs\", luaB_pairs},\r\n  {\"pcall\", luaB_pcall},\r\n  {\"print\", luaB_print},\r\n  {\"rawequal\", luaB_rawequal},\r\n  {\"rawlen\", luaB_rawlen},\r\n  {\"rawget\", luaB_rawget},\r\n  {\"rawset\", luaB_rawset},\r\n  {\"select\", luaB_select},\r\n  {\"setmetatable\", luaB_setmetatable},\r\n  {\"tonumber\", luaB_tonumber},\r\n  {\"tostring\", luaB_tostring},\r\n  {\"type\", luaB_type},\r\n  {\"xpcall\", luaB_xpcall},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nLUAMOD_API int luaopen_base (lua_State *L) {\r\n  /* set global _G */\r\n  lua_pushglobaltable(L);\r\n  lua_pushglobaltable(L);\r\n  lua_setfield(L, -2, \"_G\");\r\n  /* open lib into global table */\r\n  luaL_setfuncs(L, base_funcs, 0);\r\n  lua_pushliteral(L, LUA_VERSION);\r\n  lua_setfield(L, -2, \"_VERSION\");  /* set global _VERSION */\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lbitlib.c",
    "content": "/*\r\n** $Id: lbitlib.c,v 1.16 2011/06/20 16:35:23 roberto Exp $\r\n** Standard library for bitwise operations\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#define lbitlib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n/* number of bits to consider in a number */\r\n#if !defined(LUA_NBITS)\r\n#define LUA_NBITS\t32\r\n#endif\r\n\r\n\r\n#define ALLONES\t\t(~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1))\r\n\r\n/* macro to trim extra bits */\r\n#define trim(x)\t\t((x) & ALLONES)\r\n\r\n\r\n/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */\r\n#define mask(n)\t\t(~((ALLONES << 1) << ((n) - 1)))\r\n\r\n\r\ntypedef lua_Unsigned b_uint;\r\n\r\n\r\n\r\nstatic b_uint andaux (lua_State *L) {\r\n  int i, n = lua_gettop(L);\r\n  b_uint r = ~(b_uint)0;\r\n  for (i = 1; i <= n; i++)\r\n    r &= luaL_checkunsigned(L, i);\r\n  return trim(r);\r\n}\r\n\r\n\r\nstatic int b_and (lua_State *L) {\r\n  b_uint r = andaux(L);\r\n  lua_pushunsigned(L, r);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_test (lua_State *L) {\r\n  b_uint r = andaux(L);\r\n  lua_pushboolean(L, r != 0);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_or (lua_State *L) {\r\n  int i, n = lua_gettop(L);\r\n  b_uint r = 0;\r\n  for (i = 1; i <= n; i++)\r\n    r |= luaL_checkunsigned(L, i);\r\n  lua_pushunsigned(L, trim(r));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_xor (lua_State *L) {\r\n  int i, n = lua_gettop(L);\r\n  b_uint r = 0;\r\n  for (i = 1; i <= n; i++)\r\n    r ^= luaL_checkunsigned(L, i);\r\n  lua_pushunsigned(L, trim(r));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_not (lua_State *L) {\r\n  b_uint r = ~luaL_checkunsigned(L, 1);\r\n  lua_pushunsigned(L, trim(r));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_shift (lua_State *L, b_uint r, int i) {\r\n  if (i < 0) {  /* shift right? */\r\n    i = -i;\r\n    r = trim(r);\r\n    if (i >= LUA_NBITS) r = 0;\r\n    else r >>= i;\r\n  }\r\n  else {  /* shift left */\r\n    if (i >= LUA_NBITS) r = 0;\r\n    else r <<= i;\r\n    r = trim(r);\r\n  }\r\n  lua_pushunsigned(L, r);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_lshift (lua_State *L) {\r\n  return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkint(L, 2));\r\n}\r\n\r\n\r\nstatic int b_rshift (lua_State *L) {\r\n  return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkint(L, 2));\r\n}\r\n\r\n\r\nstatic int b_arshift (lua_State *L) {\r\n  b_uint r = luaL_checkunsigned(L, 1);\r\n  int i = luaL_checkint(L, 2);\r\n  if (i < 0 || !(r & ((b_uint)1 << (LUA_NBITS - 1))))\r\n    return b_shift(L, r, -i);\r\n  else {  /* arithmetic shift for 'negative' number */\r\n    if (i >= LUA_NBITS) r = ALLONES;\r\n    else\r\n      r = trim((r >> i) | ~(~(b_uint)0 >> i));  /* add signal bit */\r\n    lua_pushunsigned(L, r);\r\n    return 1;\r\n  }\r\n}\r\n\r\n\r\nstatic int b_rot (lua_State *L, int i) {\r\n  b_uint r = luaL_checkunsigned(L, 1);\r\n  i &= (LUA_NBITS - 1);  /* i = i % NBITS */\r\n  r = trim(r);\r\n  r = (r << i) | (r >> (LUA_NBITS - i));\r\n  lua_pushunsigned(L, trim(r));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_lrot (lua_State *L) {\r\n  return b_rot(L, luaL_checkint(L, 2));\r\n}\r\n\r\n\r\nstatic int b_rrot (lua_State *L) {\r\n  return b_rot(L, -luaL_checkint(L, 2));\r\n}\r\n\r\n\r\n/*\r\n** get field and width arguments for field-manipulation functions,\r\n** checking whether they are valid\r\n*/\r\nstatic int fieldargs (lua_State *L, int farg, int *width) {\r\n  int f = luaL_checkint(L, farg);\r\n  int w = luaL_optint(L, farg + 1, 1);\r\n  luaL_argcheck(L, 0 <= f, farg, \"field cannot be negative\");\r\n  luaL_argcheck(L, 0 < w, farg + 1, \"width must be positive\");\r\n  if (f + w > LUA_NBITS)\r\n    luaL_error(L, \"trying to access non-existent bits\");\r\n  *width = w;\r\n  return f;\r\n}\r\n\r\n\r\nstatic int b_extract (lua_State *L) {\r\n  int w;\r\n  b_uint r = luaL_checkunsigned(L, 1);\r\n  int f = fieldargs(L, 2, &w);\r\n  r = (r >> f) & mask(w);\r\n  lua_pushunsigned(L, r);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int b_replace (lua_State *L) {\r\n  int w;\r\n  b_uint r = luaL_checkunsigned(L, 1);\r\n  b_uint v = luaL_checkunsigned(L, 2);\r\n  int f = fieldargs(L, 3, &w);\r\n  int m = mask(w);\r\n  v &= m;  /* erase bits outside given width */\r\n  r = (r & ~(m << f)) | (v << f);\r\n  lua_pushunsigned(L, r);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic const luaL_Reg bitlib[] = {\r\n  {\"arshift\", b_arshift},\r\n  {\"band\", b_and},\r\n  {\"bnot\", b_not},\r\n  {\"bor\", b_or},\r\n  {\"bxor\", b_xor},\r\n  {\"btest\", b_test},\r\n  {\"extract\", b_extract},\r\n  {\"lrotate\", b_lrot},\r\n  {\"lshift\", b_lshift},\r\n  {\"replace\", b_replace},\r\n  {\"rrotate\", b_rrot},\r\n  {\"rshift\", b_rshift},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\n\r\nLUAMOD_API int luaopen_bit32 (lua_State *L) {\r\n  luaL_newlib(L, bitlib);\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lcode.c",
    "content": "/*\r\n** $Id: lcode.c,v 2.60 2011/08/30 16:26:41 roberto Exp $\r\n** Code generator for Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdlib.h>\r\n\r\n#define lcode_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lcode.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lgc.h\"\r\n#include \"llex.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lopcodes.h\"\r\n#include \"lparser.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"lvm.h\"\r\n\r\n\r\n#define hasjumps(e)\t((e)->t != (e)->f)\r\n\r\n\r\nstatic int isnumeral(expdesc *e) {\r\n  return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);\r\n}\r\n\r\n\r\nvoid luaK_nil (FuncState *fs, int from, int n) {\r\n  Instruction *previous;\r\n  int l = from + n - 1;  /* last register to set nil */\r\n  if (fs->pc > fs->lasttarget) {  /* no jumps to current position? */\r\n    previous = &fs->f->code[fs->pc-1];\r\n    if (GET_OPCODE(*previous) == OP_LOADNIL) {\r\n      int pfrom = GETARG_A(*previous);\r\n      int pl = pfrom + GETARG_B(*previous);\r\n      if ((pfrom <= from && from <= pl + 1) ||\r\n          (from <= pfrom && pfrom <= l + 1)) {  /* can connect both? */\r\n        if (pfrom < from) from = pfrom;  /* from = min(from, pfrom) */\r\n        if (pl > l) l = pl;  /* l = max(l, pl) */\r\n        SETARG_A(*previous, from);\r\n        SETARG_B(*previous, l - from);\r\n        return;\r\n      }\r\n    }  /* else go through */\r\n  }\r\n  luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0);  /* else no optimization */\r\n}\r\n\r\n\r\nint luaK_jump (FuncState *fs) {\r\n  int jpc = fs->jpc;  /* save list of jumps to here */\r\n  int j;\r\n  fs->jpc = NO_JUMP;\r\n  j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);\r\n  luaK_concat(fs, &j, jpc);  /* keep them on hold */\r\n  return j;\r\n}\r\n\r\n\r\nvoid luaK_ret (FuncState *fs, int first, int nret) {\r\n  luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);\r\n}\r\n\r\n\r\nstatic int condjump (FuncState *fs, OpCode op, int A, int B, int C) {\r\n  luaK_codeABC(fs, op, A, B, C);\r\n  return luaK_jump(fs);\r\n}\r\n\r\n\r\nstatic void fixjump (FuncState *fs, int pc, int dest) {\r\n  Instruction *jmp = &fs->f->code[pc];\r\n  int offset = dest-(pc+1);\r\n  lua_assert(dest != NO_JUMP);\r\n  if (abs(offset) > MAXARG_sBx)\r\n    luaX_syntaxerror(fs->ls, \"control structure too long\");\r\n  SETARG_sBx(*jmp, offset);\r\n}\r\n\r\n\r\n/*\r\n** returns current `pc' and marks it as a jump target (to avoid wrong\r\n** optimizations with consecutive instructions not in the same basic block).\r\n*/\r\nint luaK_getlabel (FuncState *fs) {\r\n  fs->lasttarget = fs->pc;\r\n  return fs->pc;\r\n}\r\n\r\n\r\nstatic int getjump (FuncState *fs, int pc) {\r\n  int offset = GETARG_sBx(fs->f->code[pc]);\r\n  if (offset == NO_JUMP)  /* point to itself represents end of list */\r\n    return NO_JUMP;  /* end of list */\r\n  else\r\n    return (pc+1)+offset;  /* turn offset into absolute position */\r\n}\r\n\r\n\r\nstatic Instruction *getjumpcontrol (FuncState *fs, int pc) {\r\n  Instruction *pi = &fs->f->code[pc];\r\n  if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))\r\n    return pi-1;\r\n  else\r\n    return pi;\r\n}\r\n\r\n\r\n/*\r\n** check whether list has any jump that do not produce a value\r\n** (or produce an inverted value)\r\n*/\r\nstatic int need_value (FuncState *fs, int list) {\r\n  for (; list != NO_JUMP; list = getjump(fs, list)) {\r\n    Instruction i = *getjumpcontrol(fs, list);\r\n    if (GET_OPCODE(i) != OP_TESTSET) return 1;\r\n  }\r\n  return 0;  /* not found */\r\n}\r\n\r\n\r\nstatic int patchtestreg (FuncState *fs, int node, int reg) {\r\n  Instruction *i = getjumpcontrol(fs, node);\r\n  if (GET_OPCODE(*i) != OP_TESTSET)\r\n    return 0;  /* cannot patch other instructions */\r\n  if (reg != NO_REG && reg != GETARG_B(*i))\r\n    SETARG_A(*i, reg);\r\n  else  /* no register to put value or register already has the value */\r\n    *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));\r\n\r\n  return 1;\r\n}\r\n\r\n\r\nstatic void removevalues (FuncState *fs, int list) {\r\n  for (; list != NO_JUMP; list = getjump(fs, list))\r\n      patchtestreg(fs, list, NO_REG);\r\n}\r\n\r\n\r\nstatic void patchlistaux (FuncState *fs, int list, int vtarget, int reg,\r\n                          int dtarget) {\r\n  while (list != NO_JUMP) {\r\n    int next = getjump(fs, list);\r\n    if (patchtestreg(fs, list, reg))\r\n      fixjump(fs, list, vtarget);\r\n    else\r\n      fixjump(fs, list, dtarget);  /* jump to default target */\r\n    list = next;\r\n  }\r\n}\r\n\r\n\r\nstatic void dischargejpc (FuncState *fs) {\r\n  patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);\r\n  fs->jpc = NO_JUMP;\r\n}\r\n\r\n\r\nvoid luaK_patchlist (FuncState *fs, int list, int target) {\r\n  if (target == fs->pc)\r\n    luaK_patchtohere(fs, list);\r\n  else {\r\n    lua_assert(target < fs->pc);\r\n    patchlistaux(fs, list, target, NO_REG, target);\r\n  }\r\n}\r\n\r\n\r\nLUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level) {\r\n  level++;  /* argument is +1 to reserve 0 as non-op */\r\n  while (list != NO_JUMP) {\r\n    int next = getjump(fs, list);\r\n    lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP &&\r\n                (GETARG_A(fs->f->code[list]) == 0 ||\r\n                 GETARG_A(fs->f->code[list]) >= level));\r\n    SETARG_A(fs->f->code[list], level);\r\n    list = next;\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_patchtohere (FuncState *fs, int list) {\r\n  luaK_getlabel(fs);\r\n  luaK_concat(fs, &fs->jpc, list);\r\n}\r\n\r\n\r\nvoid luaK_concat (FuncState *fs, int *l1, int l2) {\r\n  if (l2 == NO_JUMP) return;\r\n  else if (*l1 == NO_JUMP)\r\n    *l1 = l2;\r\n  else {\r\n    int list = *l1;\r\n    int next;\r\n    while ((next = getjump(fs, list)) != NO_JUMP)  /* find last element */\r\n      list = next;\r\n    fixjump(fs, list, l2);\r\n  }\r\n}\r\n\r\n\r\nstatic int luaK_code (FuncState *fs, Instruction i) {\r\n  Proto *f = fs->f;\r\n  dischargejpc(fs);  /* `pc' will change */\r\n  /* put new instruction in code array */\r\n  luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction,\r\n                  MAX_INT, \"opcodes\");\r\n  f->code[fs->pc] = i;\r\n  /* save corresponding line information */\r\n  luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int,\r\n                  MAX_INT, \"opcodes\");\r\n  f->lineinfo[fs->pc] = fs->ls->lastline;\r\n  return fs->pc++;\r\n}\r\n\r\n\r\nint luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {\r\n  lua_assert(getOpMode(o) == iABC);\r\n  lua_assert(getBMode(o) != OpArgN || b == 0);\r\n  lua_assert(getCMode(o) != OpArgN || c == 0);\r\n  lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C);\r\n  return luaK_code(fs, CREATE_ABC(o, a, b, c));\r\n}\r\n\r\n\r\nint luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {\r\n  lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);\r\n  lua_assert(getCMode(o) == OpArgN);\r\n  lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx);\r\n  return luaK_code(fs, CREATE_ABx(o, a, bc));\r\n}\r\n\r\n\r\nstatic int codeextraarg (FuncState *fs, int a) {\r\n  lua_assert(a <= MAXARG_Ax);\r\n  return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a));\r\n}\r\n\r\n\r\nint luaK_codek (FuncState *fs, int reg, int k) {\r\n  if (k <= MAXARG_Bx)\r\n    return luaK_codeABx(fs, OP_LOADK, reg, k);\r\n  else {\r\n    int p = luaK_codeABx(fs, OP_LOADKX, reg, 0);\r\n    codeextraarg(fs, k);\r\n    return p;\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_checkstack (FuncState *fs, int n) {\r\n  int newstack = fs->freereg + n;\r\n  if (newstack > fs->f->maxstacksize) {\r\n    if (newstack >= MAXSTACK)\r\n      luaX_syntaxerror(fs->ls, \"function or expression too complex\");\r\n    fs->f->maxstacksize = cast_byte(newstack);\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_reserveregs (FuncState *fs, int n) {\r\n  luaK_checkstack(fs, n);\r\n  fs->freereg += n;\r\n}\r\n\r\n\r\nstatic void freereg (FuncState *fs, int reg) {\r\n  if (!ISK(reg) && reg >= fs->nactvar) {\r\n    fs->freereg--;\r\n    lua_assert(reg == fs->freereg);\r\n  }\r\n}\r\n\r\n\r\nstatic void freeexp (FuncState *fs, expdesc *e) {\r\n  if (e->k == VNONRELOC)\r\n    freereg(fs, e->u.info);\r\n}\r\n\r\n\r\nstatic int addk (FuncState *fs, TValue *key, TValue *v) {\r\n  lua_State *L = fs->ls->L;\r\n  TValue *idx = luaH_set(L, fs->h, key);\r\n  Proto *f = fs->f;\r\n  int k, oldsize;\r\n  if (ttisnumber(idx)) {\r\n    lua_Number n = nvalue(idx);\r\n    lua_number2int(k, n);\r\n    if (luaV_rawequalobj(&f->k[k], v))\r\n      return k;\r\n    /* else may be a collision (e.g., between 0.0 and \"\\0\\0\\0\\0\\0\\0\\0\\0\");\r\n       go through and create a new entry for this value */\r\n  }\r\n  /* constant not found; create a new entry */\r\n  oldsize = f->sizek;\r\n  k = fs->nk;\r\n  /* numerical value does not need GC barrier;\r\n     table has no metatable, so it does not need to invalidate cache */\r\n  setnvalue(idx, cast_num(k));\r\n  luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, \"constants\");\r\n  while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);\r\n  setobj(L, &f->k[k], v);\r\n  fs->nk++;\r\n  luaC_barrier(L, f, v);\r\n  return k;\r\n}\r\n\r\n\r\nint luaK_stringK (FuncState *fs, TString *s) {\r\n  TValue o;\r\n  setsvalue(fs->ls->L, &o, s);\r\n  return addk(fs, &o, &o);\r\n}\r\n\r\n\r\nint luaK_numberK (FuncState *fs, lua_Number r) {\r\n  int n;\r\n  lua_State *L = fs->ls->L;\r\n  TValue o;\r\n  setnvalue(&o, r);\r\n  if (r == 0 || luai_numisnan(NULL, r)) {  /* handle -0 and NaN */\r\n    /* use raw representation as key to avoid numeric problems */\r\n    setsvalue(L, L->top, luaS_newlstr(L, (char *)&r, sizeof(r)));\r\n     incr_top(L);\r\n     n = addk(fs, L->top - 1, &o);\r\n     L->top--;\r\n  }\r\n  else\r\n    n = addk(fs, &o, &o);  /* regular case */\r\n  return n;\r\n}\r\n\r\n\r\nstatic int boolK (FuncState *fs, int b) {\r\n  TValue o;\r\n  setbvalue(&o, b);\r\n  return addk(fs, &o, &o);\r\n}\r\n\r\n\r\nstatic int nilK (FuncState *fs) {\r\n  TValue k, v;\r\n  setnilvalue(&v);\r\n  /* cannot use nil as key; instead use table itself to represent nil */\r\n  sethvalue(fs->ls->L, &k, fs->h);\r\n  return addk(fs, &k, &v);\r\n}\r\n\r\n\r\nvoid luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {\r\n  if (e->k == VCALL) {  /* expression is an open function call? */\r\n    SETARG_C(getcode(fs, e), nresults+1);\r\n  }\r\n  else if (e->k == VVARARG) {\r\n    SETARG_B(getcode(fs, e), nresults+1);\r\n    SETARG_A(getcode(fs, e), fs->freereg);\r\n    luaK_reserveregs(fs, 1);\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_setoneret (FuncState *fs, expdesc *e) {\r\n  if (e->k == VCALL) {  /* expression is an open function call? */\r\n    e->k = VNONRELOC;\r\n    e->u.info = GETARG_A(getcode(fs, e));\r\n  }\r\n  else if (e->k == VVARARG) {\r\n    SETARG_B(getcode(fs, e), 2);\r\n    e->k = VRELOCABLE;  /* can relocate its simple result */\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_dischargevars (FuncState *fs, expdesc *e) {\r\n  switch (e->k) {\r\n    case VLOCAL: {\r\n      e->k = VNONRELOC;\r\n      break;\r\n    }\r\n    case VUPVAL: {\r\n      e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0);\r\n      e->k = VRELOCABLE;\r\n      break;\r\n    }\r\n    case VINDEXED: {\r\n      OpCode op = OP_GETTABUP;  /* assume 't' is in an upvalue */\r\n      freereg(fs, e->u.ind.idx);\r\n      if (e->u.ind.vt == VLOCAL) {  /* 't' is in a register? */\r\n        freereg(fs, e->u.ind.t);\r\n        op = OP_GETTABLE;\r\n      }\r\n      e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx);\r\n      e->k = VRELOCABLE;\r\n      break;\r\n    }\r\n    case VVARARG:\r\n    case VCALL: {\r\n      luaK_setoneret(fs, e);\r\n      break;\r\n    }\r\n    default: break;  /* there is one value available (somewhere) */\r\n  }\r\n}\r\n\r\n\r\nstatic int code_label (FuncState *fs, int A, int b, int jump) {\r\n  luaK_getlabel(fs);  /* those instructions may be jump targets */\r\n  return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump);\r\n}\r\n\r\n\r\nstatic void discharge2reg (FuncState *fs, expdesc *e, int reg) {\r\n  luaK_dischargevars(fs, e);\r\n  switch (e->k) {\r\n    case VNIL: {\r\n      luaK_nil(fs, reg, 1);\r\n      break;\r\n    }\r\n    case VFALSE:  case VTRUE: {\r\n      luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);\r\n      break;\r\n    }\r\n    case VK: {\r\n      luaK_codek(fs, reg, e->u.info);\r\n      break;\r\n    }\r\n    case VKNUM: {\r\n      luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval));\r\n      break;\r\n    }\r\n    case VRELOCABLE: {\r\n      Instruction *pc = &getcode(fs, e);\r\n      SETARG_A(*pc, reg);\r\n      break;\r\n    }\r\n    case VNONRELOC: {\r\n      if (reg != e->u.info)\r\n        luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0);\r\n      break;\r\n    }\r\n    default: {\r\n      lua_assert(e->k == VVOID || e->k == VJMP);\r\n      return;  /* nothing to do... */\r\n    }\r\n  }\r\n  e->u.info = reg;\r\n  e->k = VNONRELOC;\r\n}\r\n\r\n\r\nstatic void discharge2anyreg (FuncState *fs, expdesc *e) {\r\n  if (e->k != VNONRELOC) {\r\n    luaK_reserveregs(fs, 1);\r\n    discharge2reg(fs, e, fs->freereg-1);\r\n  }\r\n}\r\n\r\n\r\nstatic void exp2reg (FuncState *fs, expdesc *e, int reg) {\r\n  discharge2reg(fs, e, reg);\r\n  if (e->k == VJMP)\r\n    luaK_concat(fs, &e->t, e->u.info);  /* put this jump in `t' list */\r\n  if (hasjumps(e)) {\r\n    int final;  /* position after whole expression */\r\n    int p_f = NO_JUMP;  /* position of an eventual LOAD false */\r\n    int p_t = NO_JUMP;  /* position of an eventual LOAD true */\r\n    if (need_value(fs, e->t) || need_value(fs, e->f)) {\r\n      int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);\r\n      p_f = code_label(fs, reg, 0, 1);\r\n      p_t = code_label(fs, reg, 1, 0);\r\n      luaK_patchtohere(fs, fj);\r\n    }\r\n    final = luaK_getlabel(fs);\r\n    patchlistaux(fs, e->f, final, reg, p_f);\r\n    patchlistaux(fs, e->t, final, reg, p_t);\r\n  }\r\n  e->f = e->t = NO_JUMP;\r\n  e->u.info = reg;\r\n  e->k = VNONRELOC;\r\n}\r\n\r\n\r\nvoid luaK_exp2nextreg (FuncState *fs, expdesc *e) {\r\n  luaK_dischargevars(fs, e);\r\n  freeexp(fs, e);\r\n  luaK_reserveregs(fs, 1);\r\n  exp2reg(fs, e, fs->freereg - 1);\r\n}\r\n\r\n\r\nint luaK_exp2anyreg (FuncState *fs, expdesc *e) {\r\n  luaK_dischargevars(fs, e);\r\n  if (e->k == VNONRELOC) {\r\n    if (!hasjumps(e)) return e->u.info;  /* exp is already in a register */\r\n    if (e->u.info >= fs->nactvar) {  /* reg. is not a local? */\r\n      exp2reg(fs, e, e->u.info);  /* put value on it */\r\n      return e->u.info;\r\n    }\r\n  }\r\n  luaK_exp2nextreg(fs, e);  /* default */\r\n  return e->u.info;\r\n}\r\n\r\n\r\nvoid luaK_exp2anyregup (FuncState *fs, expdesc *e) {\r\n  if (e->k != VUPVAL || hasjumps(e))\r\n    luaK_exp2anyreg(fs, e);\r\n}\r\n\r\n\r\nvoid luaK_exp2val (FuncState *fs, expdesc *e) {\r\n  if (hasjumps(e))\r\n    luaK_exp2anyreg(fs, e);\r\n  else\r\n    luaK_dischargevars(fs, e);\r\n}\r\n\r\n\r\nint luaK_exp2RK (FuncState *fs, expdesc *e) {\r\n  luaK_exp2val(fs, e);\r\n  switch (e->k) {\r\n    case VTRUE:\r\n    case VFALSE:\r\n    case VNIL: {\r\n      if (fs->nk <= MAXINDEXRK) {  /* constant fits in RK operand? */\r\n        e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE));\r\n        e->k = VK;\r\n        return RKASK(e->u.info);\r\n      }\r\n      else break;\r\n    }\r\n    case VKNUM: {\r\n      e->u.info = luaK_numberK(fs, e->u.nval);\r\n      e->k = VK;\r\n      /* go through */\r\n    }\r\n    case VK: {\r\n      if (e->u.info <= MAXINDEXRK)  /* constant fits in argC? */\r\n        return RKASK(e->u.info);\r\n      else break;\r\n    }\r\n    default: break;\r\n  }\r\n  /* not a constant in the right range: put it in a register */\r\n  return luaK_exp2anyreg(fs, e);\r\n}\r\n\r\n\r\nvoid luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {\r\n  switch (var->k) {\r\n    case VLOCAL: {\r\n      freeexp(fs, ex);\r\n      exp2reg(fs, ex, var->u.info);\r\n      return;\r\n    }\r\n    case VUPVAL: {\r\n      int e = luaK_exp2anyreg(fs, ex);\r\n      luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0);\r\n      break;\r\n    }\r\n    case VINDEXED: {\r\n      OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP;\r\n      int e = luaK_exp2RK(fs, ex);\r\n      luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);\r\n      break;\r\n    }\r\n    default: {\r\n      lua_assert(0);  /* invalid var kind to store */\r\n      break;\r\n    }\r\n  }\r\n  freeexp(fs, ex);\r\n}\r\n\r\n\r\nvoid luaK_self (FuncState *fs, expdesc *e, expdesc *key) {\r\n  int ereg;\r\n  luaK_exp2anyreg(fs, e);\r\n  ereg = e->u.info;  /* register where 'e' was placed */\r\n  freeexp(fs, e);\r\n  e->u.info = fs->freereg;  /* base register for op_self */\r\n  e->k = VNONRELOC;\r\n  luaK_reserveregs(fs, 2);  /* function and 'self' produced by op_self */\r\n  luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key));\r\n  freeexp(fs, key);\r\n}\r\n\r\n\r\nstatic void invertjump (FuncState *fs, expdesc *e) {\r\n  Instruction *pc = getjumpcontrol(fs, e->u.info);\r\n  lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&\r\n                                           GET_OPCODE(*pc) != OP_TEST);\r\n  SETARG_A(*pc, !(GETARG_A(*pc)));\r\n}\r\n\r\n\r\nstatic int jumponcond (FuncState *fs, expdesc *e, int cond) {\r\n  if (e->k == VRELOCABLE) {\r\n    Instruction ie = getcode(fs, e);\r\n    if (GET_OPCODE(ie) == OP_NOT) {\r\n      fs->pc--;  /* remove previous OP_NOT */\r\n      return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);\r\n    }\r\n    /* else go through */\r\n  }\r\n  discharge2anyreg(fs, e);\r\n  freeexp(fs, e);\r\n  return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond);\r\n}\r\n\r\n\r\nvoid luaK_goiftrue (FuncState *fs, expdesc *e) {\r\n  int pc;  /* pc of last jump */\r\n  luaK_dischargevars(fs, e);\r\n  switch (e->k) {\r\n    case VJMP: {\r\n      invertjump(fs, e);\r\n      pc = e->u.info;\r\n      break;\r\n    }\r\n    case VK: case VKNUM: case VTRUE: {\r\n      pc = NO_JUMP;  /* always true; do nothing */\r\n      break;\r\n    }\r\n    default: {\r\n      pc = jumponcond(fs, e, 0);\r\n      break;\r\n    }\r\n  }\r\n  luaK_concat(fs, &e->f, pc);  /* insert last jump in `f' list */\r\n  luaK_patchtohere(fs, e->t);\r\n  e->t = NO_JUMP;\r\n}\r\n\r\n\r\nvoid luaK_goiffalse (FuncState *fs, expdesc *e) {\r\n  int pc;  /* pc of last jump */\r\n  luaK_dischargevars(fs, e);\r\n  switch (e->k) {\r\n    case VJMP: {\r\n      pc = e->u.info;\r\n      break;\r\n    }\r\n    case VNIL: case VFALSE: {\r\n      pc = NO_JUMP;  /* always false; do nothing */\r\n      break;\r\n    }\r\n    default: {\r\n      pc = jumponcond(fs, e, 1);\r\n      break;\r\n    }\r\n  }\r\n  luaK_concat(fs, &e->t, pc);  /* insert last jump in `t' list */\r\n  luaK_patchtohere(fs, e->f);\r\n  e->f = NO_JUMP;\r\n}\r\n\r\n\r\nstatic void codenot (FuncState *fs, expdesc *e) {\r\n  luaK_dischargevars(fs, e);\r\n  switch (e->k) {\r\n    case VNIL: case VFALSE: {\r\n      e->k = VTRUE;\r\n      break;\r\n    }\r\n    case VK: case VKNUM: case VTRUE: {\r\n      e->k = VFALSE;\r\n      break;\r\n    }\r\n    case VJMP: {\r\n      invertjump(fs, e);\r\n      break;\r\n    }\r\n    case VRELOCABLE:\r\n    case VNONRELOC: {\r\n      discharge2anyreg(fs, e);\r\n      freeexp(fs, e);\r\n      e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0);\r\n      e->k = VRELOCABLE;\r\n      break;\r\n    }\r\n    default: {\r\n      lua_assert(0);  /* cannot happen */\r\n      break;\r\n    }\r\n  }\r\n  /* interchange true and false lists */\r\n  { int temp = e->f; e->f = e->t; e->t = temp; }\r\n  removevalues(fs, e->f);\r\n  removevalues(fs, e->t);\r\n}\r\n\r\n\r\nvoid luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {\r\n  lua_assert(!hasjumps(t));\r\n  t->u.ind.t = t->u.info;\r\n  t->u.ind.idx = luaK_exp2RK(fs, k);\r\n  t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL\r\n                                 : check_exp(vkisinreg(t->k), VLOCAL);\r\n  t->k = VINDEXED;\r\n}\r\n\r\n\r\nstatic int constfolding (OpCode op, expdesc *e1, expdesc *e2) {\r\n  lua_Number r;\r\n  if (!isnumeral(e1) || !isnumeral(e2)) return 0;\r\n  if ((op == OP_DIV || op == OP_MOD) && e2->u.nval == 0)\r\n    return 0;  /* do not attempt to divide by 0 */\r\n  r = luaO_arith(op - OP_ADD + LUA_OPADD, e1->u.nval, e2->u.nval);\r\n  e1->u.nval = r;\r\n  return 1;\r\n}\r\n\r\n\r\nstatic void codearith (FuncState *fs, OpCode op,\r\n                       expdesc *e1, expdesc *e2, int line) {\r\n  if (constfolding(op, e1, e2))\r\n    return;\r\n  else {\r\n    int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;\r\n    int o1 = luaK_exp2RK(fs, e1);\r\n    if (o1 > o2) {\r\n      freeexp(fs, e1);\r\n      freeexp(fs, e2);\r\n    }\r\n    else {\r\n      freeexp(fs, e2);\r\n      freeexp(fs, e1);\r\n    }\r\n    e1->u.info = luaK_codeABC(fs, op, 0, o1, o2);\r\n    e1->k = VRELOCABLE;\r\n    luaK_fixline(fs, line);\r\n  }\r\n}\r\n\r\n\r\nstatic void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,\r\n                                                          expdesc *e2) {\r\n  int o1 = luaK_exp2RK(fs, e1);\r\n  int o2 = luaK_exp2RK(fs, e2);\r\n  freeexp(fs, e2);\r\n  freeexp(fs, e1);\r\n  if (cond == 0 && op != OP_EQ) {\r\n    int temp;  /* exchange args to replace by `<' or `<=' */\r\n    temp = o1; o1 = o2; o2 = temp;  /* o1 <==> o2 */\r\n    cond = 1;\r\n  }\r\n  e1->u.info = condjump(fs, op, cond, o1, o2);\r\n  e1->k = VJMP;\r\n}\r\n\r\n\r\nvoid luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {\r\n  expdesc e2;\r\n  e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;\r\n  switch (op) {\r\n    case OPR_MINUS: {\r\n      if (isnumeral(e))  /* minus constant? */\r\n        e->u.nval = luai_numunm(NULL, e->u.nval);  /* fold it */\r\n      else {\r\n        luaK_exp2anyreg(fs, e);\r\n        codearith(fs, OP_UNM, e, &e2, line);\r\n      }\r\n      break;\r\n    }\r\n    case OPR_NOT: codenot(fs, e); break;\r\n    case OPR_LEN: {\r\n      luaK_exp2anyreg(fs, e);  /* cannot operate on constants */\r\n      codearith(fs, OP_LEN, e, &e2, line);\r\n      break;\r\n    }\r\n    default: lua_assert(0);\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {\r\n  switch (op) {\r\n    case OPR_AND: {\r\n      luaK_goiftrue(fs, v);\r\n      break;\r\n    }\r\n    case OPR_OR: {\r\n      luaK_goiffalse(fs, v);\r\n      break;\r\n    }\r\n    case OPR_CONCAT: {\r\n      luaK_exp2nextreg(fs, v);  /* operand must be on the `stack' */\r\n      break;\r\n    }\r\n    case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:\r\n    case OPR_MOD: case OPR_POW: {\r\n      if (!isnumeral(v)) luaK_exp2RK(fs, v);\r\n      break;\r\n    }\r\n    default: {\r\n      luaK_exp2RK(fs, v);\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_posfix (FuncState *fs, BinOpr op,\r\n                  expdesc *e1, expdesc *e2, int line) {\r\n  switch (op) {\r\n    case OPR_AND: {\r\n      lua_assert(e1->t == NO_JUMP);  /* list must be closed */\r\n      luaK_dischargevars(fs, e2);\r\n      luaK_concat(fs, &e2->f, e1->f);\r\n      *e1 = *e2;\r\n      break;\r\n    }\r\n    case OPR_OR: {\r\n      lua_assert(e1->f == NO_JUMP);  /* list must be closed */\r\n      luaK_dischargevars(fs, e2);\r\n      luaK_concat(fs, &e2->t, e1->t);\r\n      *e1 = *e2;\r\n      break;\r\n    }\r\n    case OPR_CONCAT: {\r\n      luaK_exp2val(fs, e2);\r\n      if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {\r\n        lua_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1);\r\n        freeexp(fs, e1);\r\n        SETARG_B(getcode(fs, e2), e1->u.info);\r\n        e1->k = VRELOCABLE; e1->u.info = e2->u.info;\r\n      }\r\n      else {\r\n        luaK_exp2nextreg(fs, e2);  /* operand must be on the 'stack' */\r\n        codearith(fs, OP_CONCAT, e1, e2, line);\r\n      }\r\n      break;\r\n    }\r\n    case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:\r\n    case OPR_MOD: case OPR_POW: {\r\n      codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2, line);\r\n      break;\r\n    }\r\n    case OPR_EQ: case OPR_LT: case OPR_LE: {\r\n      codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2);\r\n      break;\r\n    }\r\n    case OPR_NE: case OPR_GT: case OPR_GE: {\r\n      codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2);\r\n      break;\r\n    }\r\n    default: lua_assert(0);\r\n  }\r\n}\r\n\r\n\r\nvoid luaK_fixline (FuncState *fs, int line) {\r\n  fs->f->lineinfo[fs->pc - 1] = line;\r\n}\r\n\r\n\r\nvoid luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {\r\n  int c =  (nelems - 1)/LFIELDS_PER_FLUSH + 1;\r\n  int b = (tostore == LUA_MULTRET) ? 0 : tostore;\r\n  lua_assert(tostore != 0);\r\n  if (c <= MAXARG_C)\r\n    luaK_codeABC(fs, OP_SETLIST, base, b, c);\r\n  else if (c <= MAXARG_Ax) {\r\n    luaK_codeABC(fs, OP_SETLIST, base, b, 0);\r\n    codeextraarg(fs, c);\r\n  }\r\n  else\r\n    luaX_syntaxerror(fs->ls, \"constructor too long\");\r\n  fs->freereg = base + 1;  /* free registers with list values */\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lcode.h",
    "content": "/*\r\n** $Id: lcode.h,v 1.58 2011/08/30 16:26:41 roberto Exp $\r\n** Code generator for Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lcode_h\r\n#define lcode_h\r\n\r\n#include \"llex.h\"\r\n#include \"lobject.h\"\r\n#include \"lopcodes.h\"\r\n#include \"lparser.h\"\r\n\r\n\r\n/*\r\n** Marks the end of a patch list. It is an invalid value both as an absolute\r\n** address, and as a list link (would link an element to itself).\r\n*/\r\n#define NO_JUMP (-1)\r\n\r\n\r\n/*\r\n** grep \"ORDER OPR\" if you change these enums  (ORDER OP)\r\n*/\r\ntypedef enum BinOpr {\r\n  OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,\r\n  OPR_CONCAT,\r\n  OPR_EQ, OPR_LT, OPR_LE,\r\n  OPR_NE, OPR_GT, OPR_GE,\r\n  OPR_AND, OPR_OR,\r\n  OPR_NOBINOPR\r\n} BinOpr;\r\n\r\n\r\ntypedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;\r\n\r\n\r\n#define getcode(fs,e)\t((fs)->f->code[(e)->u.info])\r\n\r\n#define luaK_codeAsBx(fs,o,A,sBx)\tluaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)\r\n\r\n#define luaK_setmultret(fs,e)\tluaK_setreturns(fs, e, LUA_MULTRET)\r\n\r\n#define luaK_jumpto(fs,t)\tluaK_patchlist(fs, luaK_jump(fs), t)\r\n\r\nLUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);\r\nLUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);\r\nLUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k);\r\nLUAI_FUNC void luaK_fixline (FuncState *fs, int line);\r\nLUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);\r\nLUAI_FUNC void luaK_reserveregs (FuncState *fs, int n);\r\nLUAI_FUNC void luaK_checkstack (FuncState *fs, int n);\r\nLUAI_FUNC int luaK_stringK (FuncState *fs, TString *s);\r\nLUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r);\r\nLUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e);\r\nLUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);\r\nLUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e);\r\nLUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e);\r\nLUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e);\r\nLUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e);\r\nLUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key);\r\nLUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);\r\nLUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e);\r\nLUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e);\r\nLUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);\r\nLUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);\r\nLUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e);\r\nLUAI_FUNC int luaK_jump (FuncState *fs);\r\nLUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);\r\nLUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);\r\nLUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);\r\nLUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level);\r\nLUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);\r\nLUAI_FUNC int luaK_getlabel (FuncState *fs);\r\nLUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line);\r\nLUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);\r\nLUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1,\r\n                            expdesc *v2, int line);\r\nLUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lcorolib.c",
    "content": "/*\r\n** $Id: lcorolib.c,v 1.3 2011/08/23 17:24:34 roberto Exp $\r\n** Coroutine Library\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdlib.h>\r\n\r\n\r\n#define lcorolib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\nstatic int auxresume (lua_State *L, lua_State *co, int narg) {\r\n  int status;\r\n  if (!lua_checkstack(co, narg)) {\r\n    lua_pushliteral(L, \"too many arguments to resume\");\r\n    return -1;  /* error flag */\r\n  }\r\n  if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) {\r\n    lua_pushliteral(L, \"cannot resume dead coroutine\");\r\n    return -1;  /* error flag */\r\n  }\r\n  lua_xmove(L, co, narg);\r\n  status = lua_resume(co, L, narg);\r\n  if (status == LUA_OK || status == LUA_YIELD) {\r\n    int nres = lua_gettop(co);\r\n    if (!lua_checkstack(L, nres + 1)) {\r\n      lua_pop(co, nres);  /* remove results anyway */\r\n      lua_pushliteral(L, \"too many results to resume\");\r\n      return -1;  /* error flag */\r\n    }\r\n    lua_xmove(co, L, nres);  /* move yielded values */\r\n    return nres;\r\n  }\r\n  else {\r\n    lua_xmove(co, L, 1);  /* move error message */\r\n    return -1;  /* error flag */\r\n  }\r\n}\r\n\r\n\r\nstatic int luaB_coresume (lua_State *L) {\r\n  lua_State *co = lua_tothread(L, 1);\r\n  int r;\r\n  luaL_argcheck(L, co, 1, \"coroutine expected\");\r\n  r = auxresume(L, co, lua_gettop(L) - 1);\r\n  if (r < 0) {\r\n    lua_pushboolean(L, 0);\r\n    lua_insert(L, -2);\r\n    return 2;  /* return false + error message */\r\n  }\r\n  else {\r\n    lua_pushboolean(L, 1);\r\n    lua_insert(L, -(r + 1));\r\n    return r + 1;  /* return true + `resume' returns */\r\n  }\r\n}\r\n\r\n\r\nstatic int luaB_auxwrap (lua_State *L) {\r\n  lua_State *co = lua_tothread(L, lua_upvalueindex(1));\r\n  int r = auxresume(L, co, lua_gettop(L));\r\n  if (r < 0) {\r\n    if (lua_isstring(L, -1)) {  /* error object is a string? */\r\n      luaL_where(L, 1);  /* add extra info */\r\n      lua_insert(L, -2);\r\n      lua_concat(L, 2);\r\n    }\r\n    lua_error(L);  /* propagate error */\r\n  }\r\n  return r;\r\n}\r\n\r\n\r\nstatic int luaB_cocreate (lua_State *L) {\r\n  lua_State *NL = lua_newthread(L);\r\n  luaL_checktype(L, 1, LUA_TFUNCTION);\r\n  lua_pushvalue(L, 1);  /* move function to top */\r\n  lua_xmove(L, NL, 1);  /* move function from L to NL */\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_cowrap (lua_State *L) {\r\n  luaB_cocreate(L);\r\n  lua_pushcclosure(L, luaB_auxwrap, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_yield (lua_State *L) {\r\n  return lua_yield(L, lua_gettop(L));\r\n}\r\n\r\n\r\nstatic int luaB_costatus (lua_State *L) {\r\n  lua_State *co = lua_tothread(L, 1);\r\n  luaL_argcheck(L, co, 1, \"coroutine expected\");\r\n  if (L == co) lua_pushliteral(L, \"running\");\r\n  else {\r\n    switch (lua_status(co)) {\r\n      case LUA_YIELD:\r\n        lua_pushliteral(L, \"suspended\");\r\n        break;\r\n      case LUA_OK: {\r\n        lua_Debug ar;\r\n        if (lua_getstack(co, 0, &ar) > 0)  /* does it have frames? */\r\n          lua_pushliteral(L, \"normal\");  /* it is running */\r\n        else if (lua_gettop(co) == 0)\r\n            lua_pushliteral(L, \"dead\");\r\n        else\r\n          lua_pushliteral(L, \"suspended\");  /* initial state */\r\n        break;\r\n      }\r\n      default:  /* some error occurred */\r\n        lua_pushliteral(L, \"dead\");\r\n        break;\r\n    }\r\n  }\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int luaB_corunning (lua_State *L) {\r\n  int ismain = lua_pushthread(L);\r\n  lua_pushboolean(L, ismain);\r\n  return 2;\r\n}\r\n\r\n\r\nstatic const luaL_Reg co_funcs[] = {\r\n  {\"create\", luaB_cocreate},\r\n  {\"resume\", luaB_coresume},\r\n  {\"running\", luaB_corunning},\r\n  {\"status\", luaB_costatus},\r\n  {\"wrap\", luaB_cowrap},\r\n  {\"yield\", luaB_yield},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\n\r\nLUAMOD_API int luaopen_coroutine (lua_State *L) {\r\n  luaL_newlib(L, co_funcs);\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lctype.c",
    "content": "/*\r\n** $Id: lctype.c,v 1.11 2011/10/03 16:19:23 roberto Exp $\r\n** 'ctype' functions for Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#define lctype_c\r\n#define LUA_CORE\r\n\r\n#include \"lctype.h\"\r\n\r\n#if !LUA_USE_CTYPE\t/* { */\r\n\r\n#include <limits.h>\r\n\r\nLUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {\r\n  0x00,  /* EOZ */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* 0. */\r\n  0x00,  0x08,  0x08,  0x08,  0x08,  0x08,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* 1. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x0c,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,\t/* 2. */\r\n  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,\r\n  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,\t/* 3. */\r\n  0x16,  0x16,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,\r\n  0x04,  0x15,  0x15,  0x15,  0x15,  0x15,  0x15,  0x05,\t/* 4. */\r\n  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,\r\n  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,\t/* 5. */\r\n  0x05,  0x05,  0x05,  0x04,  0x04,  0x04,  0x04,  0x05,\r\n  0x04,  0x15,  0x15,  0x15,  0x15,  0x15,  0x15,  0x05,\t/* 6. */\r\n  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,\r\n  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,\t/* 7. */\r\n  0x05,  0x05,  0x05,  0x04,  0x04,  0x04,  0x04,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* 8. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* 9. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* a. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* b. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* c. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* d. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* e. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\t/* f. */\r\n  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,\r\n};\r\n\r\n#endif\t\t\t/* } */\r\n"
  },
  {
    "path": "Engine/libs/lua/lctype.h",
    "content": "/*\r\n** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $\r\n** 'ctype' functions for Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lctype_h\r\n#define lctype_h\r\n\r\n#include \"lua.h\"\r\n\r\n\r\n/*\r\n** WARNING: the functions defined here do not necessarily correspond\r\n** to the similar functions in the standard C ctype.h. They are\r\n** optimized for the specific needs of Lua\r\n*/\r\n\r\n#if !defined(LUA_USE_CTYPE)\r\n\r\n#if 'A' == 65 && '0' == 48\r\n/* ASCII case: can use its own tables; faster and fixed */\r\n#define LUA_USE_CTYPE\t0\r\n#else\r\n/* must use standard C ctype */\r\n#define LUA_USE_CTYPE\t1\r\n#endif\r\n\r\n#endif\r\n\r\n\r\n#if !LUA_USE_CTYPE\t/* { */\r\n\r\n#include <limits.h>\r\n\r\n#include \"llimits.h\"\r\n\r\n\r\n#define ALPHABIT\t0\r\n#define DIGITBIT\t1\r\n#define PRINTBIT\t2\r\n#define SPACEBIT\t3\r\n#define XDIGITBIT\t4\r\n\r\n\r\n#define MASK(B)\t\t(1 << (B))\r\n\r\n\r\n/*\r\n** add 1 to char to allow index -1 (EOZ)\r\n*/\r\n#define testprop(c,p)\t(luai_ctype_[(c)+1] & (p))\r\n\r\n/*\r\n** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_'\r\n*/\r\n#define lislalpha(c)\ttestprop(c, MASK(ALPHABIT))\r\n#define lislalnum(c)\ttestprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT)))\r\n#define lisdigit(c)\ttestprop(c, MASK(DIGITBIT))\r\n#define lisspace(c)\ttestprop(c, MASK(SPACEBIT))\r\n#define lisprint(c)\ttestprop(c, MASK(PRINTBIT))\r\n#define lisxdigit(c)\ttestprop(c, MASK(XDIGITBIT))\r\n\r\n/*\r\n** this 'ltolower' only works for alphabetic characters\r\n*/\r\n#define ltolower(c)\t((c) | ('A' ^ 'a'))\r\n\r\n\r\n/* two more entries for 0 and -1 (EOZ) */\r\nLUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2];\r\n\r\n\r\n#else\t\t\t/* }{ */\r\n\r\n/*\r\n** use standard C ctypes\r\n*/\r\n\r\n#include <ctype.h>\r\n\r\n\r\n#define lislalpha(c)\t(isalpha(c) || (c) == '_')\r\n#define lislalnum(c)\t(isalnum(c) || (c) == '_')\r\n#define lisdigit(c)\t(isdigit(c))\r\n#define lisspace(c)\t(isspace(c))\r\n#define lisprint(c)\t(isprint(c))\r\n#define lisxdigit(c)\t(isxdigit(c))\r\n\r\n#define ltolower(c)\t(tolower(c))\r\n\r\n#endif\t\t\t/* } */\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ldblib.c",
    "content": "/*\r\n** $Id: ldblib.c,v 1.131 2011/10/24 14:54:05 roberto Exp $\r\n** Interface from Lua to its debug API\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define ldblib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n#define HOOKKEY\t\t\"_HKEY\"\r\n\r\n\r\n\r\nstatic int db_getregistry (lua_State *L) {\r\n  lua_pushvalue(L, LUA_REGISTRYINDEX);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int db_getmetatable (lua_State *L) {\r\n  luaL_checkany(L, 1);\r\n  if (!lua_getmetatable(L, 1)) {\r\n    lua_pushnil(L);  /* no metatable */\r\n  }\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int db_setmetatable (lua_State *L) {\r\n  int t = lua_type(L, 2);\r\n  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,\r\n                    \"nil or table expected\");\r\n  lua_settop(L, 2);\r\n  lua_setmetatable(L, 1);\r\n  return 1;  /* return 1st argument */\r\n}\r\n\r\n\r\nstatic int db_getuservalue (lua_State *L) {\r\n  if (lua_type(L, 1) != LUA_TUSERDATA)\r\n    lua_pushnil(L);\r\n  else\r\n    lua_getuservalue(L, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int db_setuservalue (lua_State *L) {\r\n  if (lua_type(L, 1) == LUA_TLIGHTUSERDATA)\r\n    luaL_argerror(L, 1, \"full userdata expected, got light userdata\");\r\n  luaL_checktype(L, 1, LUA_TUSERDATA);\r\n  if (!lua_isnoneornil(L, 2))\r\n    luaL_checktype(L, 2, LUA_TTABLE);\r\n  lua_settop(L, 2);\r\n  lua_setuservalue(L, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic void settabss (lua_State *L, const char *i, const char *v) {\r\n  lua_pushstring(L, v);\r\n  lua_setfield(L, -2, i);\r\n}\r\n\r\n\r\nstatic void settabsi (lua_State *L, const char *i, int v) {\r\n  lua_pushinteger(L, v);\r\n  lua_setfield(L, -2, i);\r\n}\r\n\r\n\r\nstatic void settabsb (lua_State *L, const char *i, int v) {\r\n  lua_pushboolean(L, v);\r\n  lua_setfield(L, -2, i);\r\n}\r\n\r\n\r\nstatic lua_State *getthread (lua_State *L, int *arg) {\r\n  if (lua_isthread(L, 1)) {\r\n    *arg = 1;\r\n    return lua_tothread(L, 1);\r\n  }\r\n  else {\r\n    *arg = 0;\r\n    return L;\r\n  }\r\n}\r\n\r\n\r\nstatic void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {\r\n  if (L == L1) {\r\n    lua_pushvalue(L, -2);\r\n    lua_remove(L, -3);\r\n  }\r\n  else\r\n    lua_xmove(L1, L, 1);\r\n  lua_setfield(L, -2, fname);\r\n}\r\n\r\n\r\nstatic int db_getinfo (lua_State *L) {\r\n  lua_Debug ar;\r\n  int arg;\r\n  lua_State *L1 = getthread(L, &arg);\r\n  const char *options = luaL_optstring(L, arg+2, \"flnStu\");\r\n  if (lua_isnumber(L, arg+1)) {\r\n    if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {\r\n      lua_pushnil(L);  /* level out of range */\r\n      return 1;\r\n    }\r\n  }\r\n  else if (lua_isfunction(L, arg+1)) {\r\n    lua_pushfstring(L, \">%s\", options);\r\n    options = lua_tostring(L, -1);\r\n    lua_pushvalue(L, arg+1);\r\n    lua_xmove(L, L1, 1);\r\n  }\r\n  else\r\n    return luaL_argerror(L, arg+1, \"function or level expected\");\r\n  if (!lua_getinfo(L1, options, &ar))\r\n    return luaL_argerror(L, arg+2, \"invalid option\");\r\n  lua_createtable(L, 0, 2);\r\n  if (strchr(options, 'S')) {\r\n    settabss(L, \"source\", ar.source);\r\n    settabss(L, \"short_src\", ar.short_src);\r\n    settabsi(L, \"linedefined\", ar.linedefined);\r\n    settabsi(L, \"lastlinedefined\", ar.lastlinedefined);\r\n    settabss(L, \"what\", ar.what);\r\n  }\r\n  if (strchr(options, 'l'))\r\n    settabsi(L, \"currentline\", ar.currentline);\r\n  if (strchr(options, 'u')) {\r\n    settabsi(L, \"nups\", ar.nups);\r\n    settabsi(L, \"nparams\", ar.nparams);\r\n    settabsb(L, \"isvararg\", ar.isvararg);\r\n  }\r\n  if (strchr(options, 'n')) {\r\n    settabss(L, \"name\", ar.name);\r\n    settabss(L, \"namewhat\", ar.namewhat);\r\n  }\r\n  if (strchr(options, 't'))\r\n    settabsb(L, \"istailcall\", ar.istailcall);\r\n  if (strchr(options, 'L'))\r\n    treatstackoption(L, L1, \"activelines\");\r\n  if (strchr(options, 'f'))\r\n    treatstackoption(L, L1, \"func\");\r\n  return 1;  /* return table */\r\n}\r\n\r\n\r\nstatic int db_getlocal (lua_State *L) {\r\n  int arg;\r\n  lua_State *L1 = getthread(L, &arg);\r\n  lua_Debug ar;\r\n  const char *name;\r\n  int nvar = luaL_checkint(L, arg+2);  /* local-variable index */\r\n  if (lua_isfunction(L, arg + 1)) {  /* function argument? */\r\n    lua_pushvalue(L, arg + 1);  /* push function */\r\n    lua_pushstring(L, lua_getlocal(L, NULL, nvar));  /* push local name */\r\n    return 1;\r\n  }\r\n  else {  /* stack-level argument */\r\n    if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */\r\n      return luaL_argerror(L, arg+1, \"level out of range\");\r\n    name = lua_getlocal(L1, &ar, nvar);\r\n    if (name) {\r\n      lua_xmove(L1, L, 1);  /* push local value */\r\n      lua_pushstring(L, name);  /* push name */\r\n      lua_pushvalue(L, -2);  /* re-order */\r\n      return 2;\r\n    }\r\n    else {\r\n      lua_pushnil(L);  /* no name (nor value) */\r\n      return 1;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic int db_setlocal (lua_State *L) {\r\n  int arg;\r\n  lua_State *L1 = getthread(L, &arg);\r\n  lua_Debug ar;\r\n  if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */\r\n    return luaL_argerror(L, arg+1, \"level out of range\");\r\n  luaL_checkany(L, arg+3);\r\n  lua_settop(L, arg+3);\r\n  lua_xmove(L, L1, 1);\r\n  lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2)));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int auxupvalue (lua_State *L, int get) {\r\n  const char *name;\r\n  int n = luaL_checkint(L, 2);\r\n  luaL_checktype(L, 1, LUA_TFUNCTION);\r\n  name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);\r\n  if (name == NULL) return 0;\r\n  lua_pushstring(L, name);\r\n  lua_insert(L, -(get+1));\r\n  return get + 1;\r\n}\r\n\r\n\r\nstatic int db_getupvalue (lua_State *L) {\r\n  return auxupvalue(L, 1);\r\n}\r\n\r\n\r\nstatic int db_setupvalue (lua_State *L) {\r\n  luaL_checkany(L, 3);\r\n  return auxupvalue(L, 0);\r\n}\r\n\r\n\r\nstatic int checkupval (lua_State *L, int argf, int argnup) {\r\n  lua_Debug ar;\r\n  int nup = luaL_checkint(L, argnup);\r\n  luaL_checktype(L, argf, LUA_TFUNCTION);\r\n  lua_pushvalue(L, argf);\r\n  lua_getinfo(L, \">u\", &ar);\r\n  luaL_argcheck(L, 1 <= nup && nup <= ar.nups, argnup, \"invalid upvalue index\");\r\n  return nup;\r\n}\r\n\r\n\r\nstatic int db_upvalueid (lua_State *L) {\r\n  int n = checkupval(L, 1, 2);\r\n  lua_pushlightuserdata(L, lua_upvalueid(L, 1, n));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int db_upvaluejoin (lua_State *L) {\r\n  int n1 = checkupval(L, 1, 2);\r\n  int n2 = checkupval(L, 3, 4);\r\n  luaL_argcheck(L, !lua_iscfunction(L, 1), 1, \"Lua function expected\");\r\n  luaL_argcheck(L, !lua_iscfunction(L, 3), 3, \"Lua function expected\");\r\n  lua_upvaluejoin(L, 1, n1, 3, n2);\r\n  return 0;\r\n}\r\n\r\n\r\n#define gethooktable(L)\tluaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY);\r\n\r\n\r\nstatic void hookf (lua_State *L, lua_Debug *ar) {\r\n  static const char *const hooknames[] =\r\n    {\"call\", \"return\", \"line\", \"count\", \"tail call\"};\r\n  gethooktable(L);\r\n  lua_rawgetp(L, -1, L);\r\n  if (lua_isfunction(L, -1)) {\r\n    lua_pushstring(L, hooknames[(int)ar->event]);\r\n    if (ar->currentline >= 0)\r\n      lua_pushinteger(L, ar->currentline);\r\n    else lua_pushnil(L);\r\n    lua_assert(lua_getinfo(L, \"lS\", ar));\r\n    lua_call(L, 2, 0);\r\n  }\r\n}\r\n\r\n\r\nstatic int makemask (const char *smask, int count) {\r\n  int mask = 0;\r\n  if (strchr(smask, 'c')) mask |= LUA_MASKCALL;\r\n  if (strchr(smask, 'r')) mask |= LUA_MASKRET;\r\n  if (strchr(smask, 'l')) mask |= LUA_MASKLINE;\r\n  if (count > 0) mask |= LUA_MASKCOUNT;\r\n  return mask;\r\n}\r\n\r\n\r\nstatic char *unmakemask (int mask, char *smask) {\r\n  int i = 0;\r\n  if (mask & LUA_MASKCALL) smask[i++] = 'c';\r\n  if (mask & LUA_MASKRET) smask[i++] = 'r';\r\n  if (mask & LUA_MASKLINE) smask[i++] = 'l';\r\n  smask[i] = '\\0';\r\n  return smask;\r\n}\r\n\r\n\r\nstatic int db_sethook (lua_State *L) {\r\n  int arg, mask, count;\r\n  lua_Hook func;\r\n  lua_State *L1 = getthread(L, &arg);\r\n  if (lua_isnoneornil(L, arg+1)) {\r\n    lua_settop(L, arg+1);\r\n    func = NULL; mask = 0; count = 0;  /* turn off hooks */\r\n  }\r\n  else {\r\n    const char *smask = luaL_checkstring(L, arg+2);\r\n    luaL_checktype(L, arg+1, LUA_TFUNCTION);\r\n    count = luaL_optint(L, arg+3, 0);\r\n    func = hookf; mask = makemask(smask, count);\r\n  }\r\n  gethooktable(L);\r\n  lua_pushvalue(L, arg+1);\r\n  lua_rawsetp(L, -2, L1);  /* set new hook */\r\n  lua_pop(L, 1);  /* remove hook table */\r\n  lua_sethook(L1, func, mask, count);  /* set hooks */\r\n  return 0;\r\n}\r\n\r\n\r\nstatic int db_gethook (lua_State *L) {\r\n  int arg;\r\n  lua_State *L1 = getthread(L, &arg);\r\n  char buff[5];\r\n  int mask = lua_gethookmask(L1);\r\n  lua_Hook hook = lua_gethook(L1);\r\n  if (hook != NULL && hook != hookf)  /* external hook? */\r\n    lua_pushliteral(L, \"external hook\");\r\n  else {\r\n    gethooktable(L);\r\n    lua_rawgetp(L, -1, L1);   /* get hook */\r\n    lua_remove(L, -2);  /* remove hook table */\r\n  }\r\n  lua_pushstring(L, unmakemask(mask, buff));\r\n  lua_pushinteger(L, lua_gethookcount(L1));\r\n  return 3;\r\n}\r\n\r\n\r\nstatic int db_debug (lua_State *L) {\r\n  for (;;) {\r\n    char buffer[250];\r\n    luai_writestringerror(\"%s\", \"lua_debug> \");\r\n    if (fgets(buffer, sizeof(buffer), stdin) == 0 ||\r\n        strcmp(buffer, \"cont\\n\") == 0)\r\n      return 0;\r\n    if (luaL_loadbuffer(L, buffer, strlen(buffer), \"=(debug command)\") ||\r\n        lua_pcall(L, 0, 0, 0))\r\n      luai_writestringerror(\"%s\\n\", lua_tostring(L, -1));\r\n    lua_settop(L, 0);  /* remove eventual returns */\r\n  }\r\n}\r\n\r\n\r\nstatic int db_traceback (lua_State *L) {\r\n  int arg;\r\n  lua_State *L1 = getthread(L, &arg);\r\n  const char *msg = lua_tostring(L, arg + 1);\r\n  if (msg == NULL && !lua_isnoneornil(L, arg + 1))  /* non-string 'msg'? */\r\n    lua_pushvalue(L, arg + 1);  /* return it untouched */\r\n  else {\r\n    int level = luaL_optint(L, arg + 2, (L == L1) ? 1 : 0);\r\n    luaL_traceback(L, L1, msg, level);\r\n  }\r\n  return 1;\r\n}\r\n\r\n\r\nstatic const luaL_Reg dblib[] = {\r\n  {\"debug\", db_debug},\r\n  {\"getuservalue\", db_getuservalue},\r\n  {\"gethook\", db_gethook},\r\n  {\"getinfo\", db_getinfo},\r\n  {\"getlocal\", db_getlocal},\r\n  {\"getregistry\", db_getregistry},\r\n  {\"getmetatable\", db_getmetatable},\r\n  {\"getupvalue\", db_getupvalue},\r\n  {\"upvaluejoin\", db_upvaluejoin},\r\n  {\"upvalueid\", db_upvalueid},\r\n  {\"setuservalue\", db_setuservalue},\r\n  {\"sethook\", db_sethook},\r\n  {\"setlocal\", db_setlocal},\r\n  {\"setmetatable\", db_setmetatable},\r\n  {\"setupvalue\", db_setupvalue},\r\n  {\"traceback\", db_traceback},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nLUAMOD_API int luaopen_debug (lua_State *L) {\r\n  luaL_newlib(L, dblib);\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ldebug.c",
    "content": "/*\r\n** $Id: ldebug.c,v 2.88 2011/11/30 12:43:51 roberto Exp $\r\n** Debug Interface\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdarg.h>\r\n#include <stddef.h>\r\n#include <string.h>\r\n\r\n\r\n#define ldebug_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lapi.h\"\r\n#include \"lcode.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lobject.h\"\r\n#include \"lopcodes.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n#include \"lvm.h\"\r\n\r\n\r\n\r\nstatic const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);\r\n\r\n\r\nstatic int currentpc (CallInfo *ci) {\r\n  lua_assert(isLua(ci));\r\n  return pcRel(ci->u.l.savedpc, ci_func(ci)->p);\r\n}\r\n\r\n\r\nstatic int currentline (CallInfo *ci) {\r\n  return getfuncline(ci_func(ci)->p, currentpc(ci));\r\n}\r\n\r\n\r\n/*\r\n** this function can be called asynchronous (e.g. during a signal)\r\n*/\r\nLUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {\r\n  if (func == NULL || mask == 0) {  /* turn off hooks? */\r\n    mask = 0;\r\n    func = NULL;\r\n  }\r\n  if (isLua(L->ci))\r\n    L->oldpc = L->ci->u.l.savedpc;\r\n  L->hook = func;\r\n  L->basehookcount = count;\r\n  resethookcount(L);\r\n  L->hookmask = cast_byte(mask);\r\n  return 1;\r\n}\r\n\r\n\r\nLUA_API lua_Hook lua_gethook (lua_State *L) {\r\n  return L->hook;\r\n}\r\n\r\n\r\nLUA_API int lua_gethookmask (lua_State *L) {\r\n  return L->hookmask;\r\n}\r\n\r\n\r\nLUA_API int lua_gethookcount (lua_State *L) {\r\n  return L->basehookcount;\r\n}\r\n\r\n\r\nLUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {\r\n  int status;\r\n  CallInfo *ci;\r\n  if (level < 0) return 0;  /* invalid (negative) level */\r\n  lua_lock(L);\r\n  for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous)\r\n    level--;\r\n  if (level == 0 && ci != &L->base_ci) {  /* level found? */\r\n    status = 1;\r\n    ar->i_ci = ci;\r\n  }\r\n  else status = 0;  /* no such level */\r\n  lua_unlock(L);\r\n  return status;\r\n}\r\n\r\n\r\nstatic const char *upvalname (Proto *p, int uv) {\r\n  TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name);\r\n  if (s == NULL) return \"?\";\r\n  else return getstr(s);\r\n}\r\n\r\n\r\nstatic const char *findvararg (CallInfo *ci, int n, StkId *pos) {\r\n  int nparams = clLvalue(ci->func)->p->numparams;\r\n  if (n >= ci->u.l.base - ci->func - nparams)\r\n    return NULL;  /* no such vararg */\r\n  else {\r\n    *pos = ci->func + nparams + n;\r\n    return \"(*vararg)\";  /* generic name for any vararg */\r\n  }\r\n}\r\n\r\n\r\nstatic const char *findlocal (lua_State *L, CallInfo *ci, int n,\r\n                              StkId *pos) {\r\n  const char *name = NULL;\r\n  StkId base;\r\n  if (isLua(ci)) {\r\n    if (n < 0)  /* access to vararg values? */\r\n      return findvararg(ci, -n, pos);\r\n    else {\r\n      base = ci->u.l.base;\r\n      name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));\r\n    }\r\n  }\r\n  else\r\n    base = ci->func + 1;\r\n  if (name == NULL) {  /* no 'standard' name? */\r\n    StkId limit = (ci == L->ci) ? L->top : ci->next->func;\r\n    if (limit - base >= n && n > 0)  /* is 'n' inside 'ci' stack? */\r\n      name = \"(*temporary)\";  /* generic name for any valid slot */\r\n    else\r\n      return NULL;  /* no name */\r\n  }\r\n  *pos = base + (n - 1);\r\n  return name;\r\n}\r\n\r\n\r\nLUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {\r\n  const char *name;\r\n  lua_lock(L);\r\n  if (ar == NULL) {  /* information about non-active function? */\r\n    if (!isLfunction(L->top - 1))  /* not a Lua function? */\r\n      name = NULL;\r\n    else  /* consider live variables at function start (parameters) */\r\n      name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0);\r\n  }\r\n  else {  /* active function; get information through 'ar' */\r\n    StkId pos = 0;  /* to avoid warnings */\r\n    name = findlocal(L, ar->i_ci, n, &pos);\r\n    if (name) {\r\n      setobj2s(L, L->top, pos);\r\n      api_incr_top(L);\r\n    }\r\n  }\r\n  lua_unlock(L);\r\n  return name;\r\n}\r\n\r\n\r\nLUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {\r\n  StkId pos = 0;  /* to avoid warnings */\r\n  const char *name = findlocal(L, ar->i_ci, n, &pos);\r\n  lua_lock(L);\r\n  if (name)\r\n    setobjs2s(L, pos, L->top - 1);\r\n  L->top--;  /* pop value */\r\n  lua_unlock(L);\r\n  return name;\r\n}\r\n\r\n\r\nstatic void funcinfo (lua_Debug *ar, Closure *cl) {\r\n  if (cl == NULL || cl->c.isC) {\r\n    ar->source = \"=[C]\";\r\n    ar->linedefined = -1;\r\n    ar->lastlinedefined = -1;\r\n    ar->what = \"C\";\r\n  }\r\n  else {\r\n    Proto *p = cl->l.p;\r\n    ar->source = p->source ? getstr(p->source) : \"=?\";\r\n    ar->linedefined = p->linedefined;\r\n    ar->lastlinedefined = p->lastlinedefined;\r\n    ar->what = (ar->linedefined == 0) ? \"main\" : \"Lua\";\r\n  }\r\n  luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);\r\n}\r\n\r\n\r\nstatic void collectvalidlines (lua_State *L, Closure *f) {\r\n  if (f == NULL || f->c.isC) {\r\n    setnilvalue(L->top);\r\n    incr_top(L);\r\n  }\r\n  else {\r\n    int i;\r\n    TValue v;\r\n    int *lineinfo = f->l.p->lineinfo;\r\n    Table *t = luaH_new(L);  /* new table to store active lines */\r\n    sethvalue(L, L->top, t);  /* push it on stack */\r\n    incr_top(L);\r\n    setbvalue(&v, 1);  /* boolean 'true' to be the value of all indices */\r\n    for (i = 0; i < f->l.p->sizelineinfo; i++)  /* for all lines with code */\r\n      luaH_setint(L, t, lineinfo[i], &v);  /* table[line] = true */\r\n  }\r\n}\r\n\r\n\r\nstatic int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,\r\n                    Closure *f, CallInfo *ci) {\r\n  int status = 1;\r\n  for (; *what; what++) {\r\n    switch (*what) {\r\n      case 'S': {\r\n        funcinfo(ar, f);\r\n        break;\r\n      }\r\n      case 'l': {\r\n        ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1;\r\n        break;\r\n      }\r\n      case 'u': {\r\n        ar->nups = (f == NULL) ? 0 : f->c.nupvalues;\r\n        if (f == NULL || f->c.isC) {\r\n          ar->isvararg = 1;\r\n          ar->nparams = 0;\r\n        }\r\n        else {\r\n          ar->isvararg = f->l.p->is_vararg;\r\n          ar->nparams = f->l.p->numparams;\r\n        }\r\n        break;\r\n      }\r\n      case 't': {\r\n        ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0;\r\n        break;\r\n      }\r\n      case 'n': {\r\n        /* calling function is a known Lua function? */\r\n        if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous))\r\n          ar->namewhat = getfuncname(L, ci->previous, &ar->name);\r\n        else\r\n          ar->namewhat = NULL;\r\n        if (ar->namewhat == NULL) {\r\n          ar->namewhat = \"\";  /* not found */\r\n          ar->name = NULL;\r\n        }\r\n        break;\r\n      }\r\n      case 'L':\r\n      case 'f':  /* handled by lua_getinfo */\r\n        break;\r\n      default: status = 0;  /* invalid option */\r\n    }\r\n  }\r\n  return status;\r\n}\r\n\r\n\r\nLUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {\r\n  int status;\r\n  Closure *cl;\r\n  CallInfo *ci;\r\n  StkId func;\r\n  lua_lock(L);\r\n  if (*what == '>') {\r\n    ci = NULL;\r\n    func = L->top - 1;\r\n    api_check(L, ttisfunction(func), \"function expected\");\r\n    what++;  /* skip the '>' */\r\n    L->top--;  /* pop function */\r\n  }\r\n  else {\r\n    ci = ar->i_ci;\r\n    func = ci->func;\r\n    lua_assert(ttisfunction(ci->func));\r\n  }\r\n  cl = ttisclosure(func) ? clvalue(func) : NULL;\r\n  status = auxgetinfo(L, what, ar, cl, ci);\r\n  if (strchr(what, 'f')) {\r\n    setobjs2s(L, L->top, func);\r\n    incr_top(L);\r\n  }\r\n  if (strchr(what, 'L'))\r\n    collectvalidlines(L, cl);\r\n  lua_unlock(L);\r\n  return status;\r\n}\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Symbolic Execution\r\n** =======================================================\r\n*/\r\n\r\nstatic const char *getobjname (Proto *p, int lastpc, int reg,\r\n                               const char **name);\r\n\r\n\r\n/*\r\n** find a \"name\" for the RK value 'c'\r\n*/\r\nstatic void kname (Proto *p, int pc, int c, const char **name) {\r\n  if (ISK(c)) {  /* is 'c' a constant? */\r\n    TValue *kvalue = &p->k[INDEXK(c)];\r\n    if (ttisstring(kvalue)) {  /* literal constant? */\r\n      *name = svalue(kvalue);  /* it is its own name */\r\n      return;\r\n    }\r\n    /* else no reasonable name found */\r\n  }\r\n  else {  /* 'c' is a register */\r\n    const char *what = getobjname(p, pc, c, name); /* search for 'c' */\r\n    if (what && *what == 'c') {  /* found a constant name? */\r\n      return;  /* 'name' already filled */\r\n    }\r\n    /* else no reasonable name found */\r\n  }\r\n  *name = \"?\";  /* no reasonable name found */\r\n}\r\n\r\n\r\n/*\r\n** try to find last instruction before 'lastpc' that modified register 'reg'\r\n*/\r\nstatic int findsetreg (Proto *p, int lastpc, int reg) {\r\n  int pc;\r\n  int setreg = -1;  /* keep last instruction that changed 'reg' */\r\n  for (pc = 0; pc < lastpc; pc++) {\r\n    Instruction i = p->code[pc];\r\n    OpCode op = GET_OPCODE(i);\r\n    int a = GETARG_A(i);\r\n    switch (op) {\r\n      case OP_LOADNIL: {\r\n        int b = GETARG_B(i);\r\n        if (a <= reg && reg <= a + b)  /* set registers from 'a' to 'a+b' */\r\n          setreg = pc;\r\n        break;\r\n      }\r\n      case OP_TFORCALL: {\r\n        if (reg >= a + 2) setreg = pc;  /* affect all regs above its base */\r\n        break;\r\n      }\r\n      case OP_CALL:\r\n      case OP_TAILCALL: {\r\n        if (reg >= a) setreg = pc;  /* affect all registers above base */\r\n        break;\r\n      }\r\n      case OP_JMP: {\r\n        int b = GETARG_sBx(i);\r\n        int dest = pc + 1 + b;\r\n        /* jump is forward and do not skip `lastpc'? */\r\n        if (pc < dest && dest <= lastpc)\r\n          pc += b;  /* do the jump */\r\n        break;\r\n      }\r\n      case OP_TEST: {\r\n        if (reg == a) setreg = pc;  /* jumped code can change 'a' */\r\n        break;\r\n      }\r\n      default:\r\n        if (testAMode(op) && reg == a)  /* any instruction that set A */\r\n          setreg = pc;\r\n        break;\r\n    }\r\n  }\r\n  return setreg;\r\n}\r\n\r\n\r\nstatic const char *getobjname (Proto *p, int lastpc, int reg,\r\n                               const char **name) {\r\n  int pc;\r\n  *name = luaF_getlocalname(p, reg + 1, lastpc);\r\n  if (*name)  /* is a local? */\r\n    return \"local\";\r\n  /* else try symbolic execution */\r\n  pc = findsetreg(p, lastpc, reg);\r\n  if (pc != -1) {  /* could find instruction? */\r\n    Instruction i = p->code[pc];\r\n    OpCode op = GET_OPCODE(i);\r\n    switch (op) {\r\n      case OP_MOVE: {\r\n        int b = GETARG_B(i);  /* move from 'b' to 'a' */\r\n        if (b < GETARG_A(i))\r\n          return getobjname(p, pc, b, name);  /* get name for 'b' */\r\n        break;\r\n      }\r\n      case OP_GETTABUP:\r\n      case OP_GETTABLE: {\r\n        int k = GETARG_C(i);  /* key index */\r\n        int t = GETARG_B(i);  /* table index */\r\n        const char *vn = (op == OP_GETTABLE)  /* name of indexed variable */\r\n                         ? luaF_getlocalname(p, t + 1, pc)\r\n                         : upvalname(p, t);\r\n        kname(p, pc, k, name);\r\n        return (vn && strcmp(vn, LUA_ENV) == 0) ? \"global\" : \"field\";\r\n      }\r\n      case OP_GETUPVAL: {\r\n        *name = upvalname(p, GETARG_B(i));\r\n        return \"upvalue\";\r\n      }\r\n      case OP_LOADK:\r\n      case OP_LOADKX: {\r\n        int b = (op == OP_LOADK) ? GETARG_Bx(i)\r\n                                 : GETARG_Ax(p->code[pc + 1]);\r\n        if (ttisstring(&p->k[b])) {\r\n          *name = svalue(&p->k[b]);\r\n          return \"constant\";\r\n        }\r\n        break;\r\n      }\r\n      case OP_SELF: {\r\n        int k = GETARG_C(i);  /* key index */\r\n        kname(p, pc, k, name);\r\n        return \"method\";\r\n      }\r\n      default: break;  /* go through to return NULL */\r\n    }\r\n  }\r\n  return NULL;  /* could not find reasonable name */\r\n}\r\n\r\n\r\nstatic const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {\r\n  TMS tm;\r\n  Proto *p = ci_func(ci)->p;  /* calling function */\r\n  int pc = currentpc(ci);  /* calling instruction index */\r\n  Instruction i = p->code[pc];  /* calling instruction */\r\n  switch (GET_OPCODE(i)) {\r\n    case OP_CALL:\r\n    case OP_TAILCALL:  /* get function name */\r\n      return getobjname(p, pc, GETARG_A(i), name);\r\n    case OP_TFORCALL: {  /* for iterator */\r\n      *name = \"for iterator\";\r\n       return \"for iterator\";\r\n    }\r\n    /* all other instructions can call only through metamethods */\r\n    case OP_SELF:\r\n    case OP_GETTABUP:\r\n    case OP_GETTABLE: tm = TM_INDEX; break;\r\n    case OP_SETTABUP:\r\n    case OP_SETTABLE: tm = TM_NEWINDEX; break;\r\n    case OP_EQ: tm = TM_EQ; break;\r\n    case OP_ADD: tm = TM_ADD; break;\r\n    case OP_SUB: tm = TM_SUB; break;\r\n    case OP_MUL: tm = TM_MUL; break;\r\n    case OP_DIV: tm = TM_DIV; break;\r\n    case OP_MOD: tm = TM_MOD; break;\r\n    case OP_POW: tm = TM_POW; break;\r\n    case OP_UNM: tm = TM_UNM; break;\r\n    case OP_LEN: tm = TM_LEN; break;\r\n    case OP_LT: tm = TM_LT; break;\r\n    case OP_LE: tm = TM_LE; break;\r\n    case OP_CONCAT: tm = TM_CONCAT; break;\r\n    default:\r\n      return NULL;  /* else no useful name can be found */\r\n  }\r\n  *name = getstr(G(L)->tmname[tm]);\r\n  return \"metamethod\";\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** only ANSI way to check whether a pointer points to an array\r\n** (used only for error messages, so efficiency is not a big concern)\r\n*/\r\nstatic int isinstack (CallInfo *ci, const TValue *o) {\r\n  StkId p;\r\n  for (p = ci->u.l.base; p < ci->top; p++)\r\n    if (o == p) return 1;\r\n  return 0;\r\n}\r\n\r\n\r\nstatic const char *getupvalname (CallInfo *ci, const TValue *o,\r\n                                 const char **name) {\r\n  LClosure *c = ci_func(ci);\r\n  int i;\r\n  for (i = 0; i < c->nupvalues; i++) {\r\n    if (c->upvals[i]->v == o) {\r\n      *name = upvalname(c->p, i);\r\n      return \"upvalue\";\r\n    }\r\n  }\r\n  return NULL;\r\n}\r\n\r\n\r\nl_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {\r\n  CallInfo *ci = L->ci;\r\n  const char *name = NULL;\r\n  const char *t = objtypename(o);\r\n  const char *kind = NULL;\r\n  if (isLua(ci)) {\r\n    kind = getupvalname(ci, o, &name);  /* check whether 'o' is an upvalue */\r\n    if (!kind && isinstack(ci, o))  /* no? try a register */\r\n      kind = getobjname(ci_func(ci)->p, currentpc(ci),\r\n                        cast_int(o - ci->u.l.base), &name);\r\n  }\r\n  if (kind)\r\n    luaG_runerror(L, \"attempt to %s %s \" LUA_QS \" (a %s value)\",\r\n                op, kind, name, t);\r\n  else\r\n    luaG_runerror(L, \"attempt to %s a %s value\", op, t);\r\n}\r\n\r\n\r\nl_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2) {\r\n  if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;\r\n  lua_assert(!ttisstring(p1) && !ttisnumber(p2));\r\n  luaG_typeerror(L, p1, \"concatenate\");\r\n}\r\n\r\n\r\nl_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {\r\n  TValue temp;\r\n  if (luaV_tonumber(p1, &temp) == NULL)\r\n    p2 = p1;  /* first operand is wrong */\r\n  luaG_typeerror(L, p2, \"perform arithmetic on\");\r\n}\r\n\r\n\r\nl_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {\r\n  const char *t1 = objtypename(p1);\r\n  const char *t2 = objtypename(p2);\r\n  if (t1 == t2)\r\n    luaG_runerror(L, \"attempt to compare two %s values\", t1);\r\n  else\r\n    luaG_runerror(L, \"attempt to compare %s with %s\", t1, t2);\r\n}\r\n\r\n\r\nstatic void addinfo (lua_State *L, const char *msg) {\r\n  CallInfo *ci = L->ci;\r\n  if (isLua(ci)) {  /* is Lua code? */\r\n    char buff[LUA_IDSIZE];  /* add file:line information */\r\n    int line = currentline(ci);\r\n    TString *src = ci_func(ci)->p->source;\r\n    if (src)\r\n      luaO_chunkid(buff, getstr(src), LUA_IDSIZE);\r\n    else {  /* no source available; use \"?\" instead */\r\n      buff[0] = '?'; buff[1] = '\\0';\r\n    }\r\n    luaO_pushfstring(L, \"%s:%d: %s\", buff, line, msg);\r\n  }\r\n}\r\n\r\n\r\nl_noret luaG_errormsg (lua_State *L) {\r\n  if (L->errfunc != 0) {  /* is there an error handling function? */\r\n    StkId errfunc = restorestack(L, L->errfunc);\r\n    if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);\r\n    setobjs2s(L, L->top, L->top - 1);  /* move argument */\r\n    setobjs2s(L, L->top - 1, errfunc);  /* push function */\r\n    incr_top(L);\r\n    luaD_call(L, L->top - 2, 1, 0);  /* call it */\r\n  }\r\n  luaD_throw(L, LUA_ERRRUN);\r\n}\r\n\r\n\r\nl_noret luaG_runerror (lua_State *L, const char *fmt, ...) {\r\n  va_list argp;\r\n  va_start(argp, fmt);\r\n  addinfo(L, luaO_pushvfstring(L, fmt, argp));\r\n  va_end(argp);\r\n  luaG_errormsg(L);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ldebug.h",
    "content": "/*\r\n** $Id: ldebug.h,v 2.7 2011/10/07 20:45:19 roberto Exp $\r\n** Auxiliary functions from Debug Interface module\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef ldebug_h\r\n#define ldebug_h\r\n\r\n\r\n#include \"lstate.h\"\r\n\r\n\r\n#define pcRel(pc, p)\t(cast(int, (pc) - (p)->code) - 1)\r\n\r\n#define getfuncline(f,pc)\t(((f)->lineinfo) ? (f)->lineinfo[pc] : 0)\r\n\r\n#define resethookcount(L)\t(L->hookcount = L->basehookcount)\r\n\r\n/* Active Lua function (given call info) */\r\n#define ci_func(ci)\t\t(clLvalue((ci)->func))\r\n\r\n\r\nLUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,\r\n                                                const char *opname);\r\nLUAI_FUNC l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2);\r\nLUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1,\r\n                                                 const TValue *p2);\r\nLUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1,\r\n                                                 const TValue *p2);\r\nLUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...);\r\nLUAI_FUNC l_noret luaG_errormsg (lua_State *L);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/ldo.c",
    "content": "/*\r\n** $Id: ldo.c,v 2.102 2011/11/29 15:55:08 roberto Exp $\r\n** Stack and Call structure of Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <setjmp.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define ldo_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lapi.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lgc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lopcodes.h\"\r\n#include \"lparser.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n#include \"lundump.h\"\r\n#include \"lvm.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Error-recovery functions\r\n** =======================================================\r\n*/\r\n\r\n/*\r\n** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By\r\n** default, Lua handles errors with exceptions when compiling as\r\n** C++ code, with _longjmp/_setjmp when asked to use them, and with\r\n** longjmp/setjmp otherwise.\r\n*/\r\n#if !defined(LUAI_THROW)\r\n\r\n#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)\r\n/* C++ exceptions */\r\n#define LUAI_THROW(L,c)\t\tthrow(c)\r\n#define LUAI_TRY(L,c,a) \\\r\n\ttry { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }\r\n#define luai_jmpbuf\t\tint  /* dummy variable */\r\n\r\n#elif defined(LUA_USE_ULONGJMP)\r\n/* in Unix, try _longjmp/_setjmp (more efficient) */\r\n#define LUAI_THROW(L,c)\t\t_longjmp((c)->b, 1)\r\n#define LUAI_TRY(L,c,a)\t\tif (_setjmp((c)->b) == 0) { a }\r\n#define luai_jmpbuf\t\tjmp_buf\r\n\r\n#else\r\n/* default handling with long jumps */\r\n#define LUAI_THROW(L,c)\t\tlongjmp((c)->b, 1)\r\n#define LUAI_TRY(L,c,a)\t\tif (setjmp((c)->b) == 0) { a }\r\n#define luai_jmpbuf\t\tjmp_buf\r\n\r\n#endif\r\n\r\n#endif\r\n\r\n\r\n\r\n/* chain list of long jump buffers */\r\nstruct lua_longjmp {\r\n  struct lua_longjmp *previous;\r\n  luai_jmpbuf b;\r\n  volatile int status;  /* error code */\r\n};\r\n\r\n\r\nstatic void seterrorobj (lua_State *L, int errcode, StkId oldtop) {\r\n  switch (errcode) {\r\n    case LUA_ERRMEM: {  /* memory error? */\r\n      setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */\r\n      break;\r\n    }\r\n    case LUA_ERRERR: {\r\n      setsvalue2s(L, oldtop, luaS_newliteral(L, \"error in error handling\"));\r\n      break;\r\n    }\r\n    default: {\r\n      setobjs2s(L, oldtop, L->top - 1);  /* error message on current top */\r\n      break;\r\n    }\r\n  }\r\n  L->top = oldtop + 1;\r\n}\r\n\r\n\r\nl_noret luaD_throw (lua_State *L, int errcode) {\r\n  if (L->errorJmp) {  /* thread has an error handler? */\r\n    L->errorJmp->status = errcode;  /* set status */\r\n    LUAI_THROW(L, L->errorJmp);  /* jump to it */\r\n  }\r\n  else {  /* thread has no error handler */\r\n    L->status = cast_byte(errcode);  /* mark it as dead */\r\n    if (G(L)->mainthread->errorJmp) {  /* main thread has a handler? */\r\n      setobjs2s(L, G(L)->mainthread->top++, L->top - 1);  /* copy error obj. */\r\n      luaD_throw(G(L)->mainthread, errcode);  /* re-throw in main thread */\r\n    }\r\n    else {  /* no handler at all; abort */\r\n      if (G(L)->panic) {  /* panic function? */\r\n        lua_unlock(L);\r\n        G(L)->panic(L);  /* call it (last chance to jump out) */\r\n      }\r\n      abort();\r\n    }\r\n  }\r\n}\r\n\r\n\r\nint luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {\r\n  unsigned short oldnCcalls = L->nCcalls;\r\n  struct lua_longjmp lj;\r\n  lj.status = LUA_OK;\r\n  lj.previous = L->errorJmp;  /* chain new error handler */\r\n  L->errorJmp = &lj;\r\n  LUAI_TRY(L, &lj,\r\n    (*f)(L, ud);\r\n  );\r\n  L->errorJmp = lj.previous;  /* restore old error handler */\r\n  L->nCcalls = oldnCcalls;\r\n  return lj.status;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\nstatic void correctstack (lua_State *L, TValue *oldstack) {\r\n  CallInfo *ci;\r\n  GCObject *up;\r\n  L->top = (L->top - oldstack) + L->stack;\r\n  for (up = L->openupval; up != NULL; up = up->gch.next)\r\n    gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack;\r\n  for (ci = L->ci; ci != NULL; ci = ci->previous) {\r\n    ci->top = (ci->top - oldstack) + L->stack;\r\n    ci->func = (ci->func - oldstack) + L->stack;\r\n    if (isLua(ci))\r\n      ci->u.l.base = (ci->u.l.base - oldstack) + L->stack;\r\n  }\r\n}\r\n\r\n\r\n/* some space for error handling */\r\n#define ERRORSTACKSIZE\t(LUAI_MAXSTACK + 200)\r\n\r\n\r\nvoid luaD_reallocstack (lua_State *L, int newsize) {\r\n  TValue *oldstack = L->stack;\r\n  int lim = L->stacksize;\r\n  lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE);\r\n  lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK);\r\n  luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue);\r\n  for (; lim < newsize; lim++)\r\n    setnilvalue(L->stack + lim); /* erase new segment */\r\n  L->stacksize = newsize;\r\n  L->stack_last = L->stack + newsize - EXTRA_STACK;\r\n  correctstack(L, oldstack);\r\n}\r\n\r\n\r\nvoid luaD_growstack (lua_State *L, int n) {\r\n  int size = L->stacksize;\r\n  if (size > LUAI_MAXSTACK)  /* error after extra size? */\r\n    luaD_throw(L, LUA_ERRERR);\r\n  else {\r\n    int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK;\r\n    int newsize = 2 * size;\r\n    if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK;\r\n    if (newsize < needed) newsize = needed;\r\n    if (newsize > LUAI_MAXSTACK) {  /* stack overflow? */\r\n      luaD_reallocstack(L, ERRORSTACKSIZE);\r\n      luaG_runerror(L, \"stack overflow\");\r\n    }\r\n    else\r\n      luaD_reallocstack(L, newsize);\r\n  }\r\n}\r\n\r\n\r\nstatic int stackinuse (lua_State *L) {\r\n  CallInfo *ci;\r\n  StkId lim = L->top;\r\n  for (ci = L->ci; ci != NULL; ci = ci->previous) {\r\n    lua_assert(ci->top <= L->stack_last);\r\n    if (lim < ci->top) lim = ci->top;\r\n  }\r\n  return cast_int(lim - L->stack) + 1;  /* part of stack in use */\r\n}\r\n\r\n\r\nvoid luaD_shrinkstack (lua_State *L) {\r\n  int inuse = stackinuse(L);\r\n  int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;\r\n  if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK;\r\n  if (inuse > LUAI_MAXSTACK ||  /* handling stack overflow? */\r\n      goodsize >= L->stacksize)  /* would grow instead of shrink? */\r\n    condmovestack(L);  /* don't change stack (change only for debugging) */\r\n  else\r\n    luaD_reallocstack(L, goodsize);  /* shrink it */\r\n}\r\n\r\n\r\nvoid luaD_hook (lua_State *L, int event, int line) {\r\n  lua_Hook hook = L->hook;\r\n  if (hook && L->allowhook) {\r\n    CallInfo *ci = L->ci;\r\n    ptrdiff_t top = savestack(L, L->top);\r\n    ptrdiff_t ci_top = savestack(L, ci->top);\r\n    lua_Debug ar;\r\n    ar.event = event;\r\n    ar.currentline = line;\r\n    ar.i_ci = ci;\r\n    luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */\r\n    ci->top = L->top + LUA_MINSTACK;\r\n    lua_assert(ci->top <= L->stack_last);\r\n    L->allowhook = 0;  /* cannot call hooks inside a hook */\r\n    ci->callstatus |= CIST_HOOKED;\r\n    lua_unlock(L);\r\n    (*hook)(L, &ar);\r\n    lua_lock(L);\r\n    lua_assert(!L->allowhook);\r\n    L->allowhook = 1;\r\n    ci->top = restorestack(L, ci_top);\r\n    L->top = restorestack(L, top);\r\n    ci->callstatus &= ~CIST_HOOKED;\r\n  }\r\n}\r\n\r\n\r\nstatic void callhook (lua_State *L, CallInfo *ci) {\r\n  int hook = LUA_HOOKCALL;\r\n  ci->u.l.savedpc++;  /* hooks assume 'pc' is already incremented */\r\n  if (isLua(ci->previous) &&\r\n      GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) {\r\n    ci->callstatus |= CIST_TAIL;\r\n    hook = LUA_HOOKTAILCALL;\r\n  }\r\n  luaD_hook(L, hook, -1);\r\n  ci->u.l.savedpc--;  /* correct 'pc' */\r\n}\r\n\r\n\r\nstatic StkId adjust_varargs (lua_State *L, Proto *p, int actual) {\r\n  int i;\r\n  int nfixargs = p->numparams;\r\n  StkId base, fixed;\r\n  lua_assert(actual >= nfixargs);\r\n  /* move fixed parameters to final position */\r\n  fixed = L->top - actual;  /* first fixed argument */\r\n  base = L->top;  /* final position of first argument */\r\n  for (i=0; i<nfixargs; i++) {\r\n    setobjs2s(L, L->top++, fixed + i);\r\n    setnilvalue(fixed + i);\r\n  }\r\n  return base;\r\n}\r\n\r\n\r\nstatic StkId tryfuncTM (lua_State *L, StkId func) {\r\n  const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);\r\n  StkId p;\r\n  ptrdiff_t funcr = savestack(L, func);\r\n  if (!ttisfunction(tm))\r\n    luaG_typeerror(L, func, \"call\");\r\n  /* Open a hole inside the stack at `func' */\r\n  for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);\r\n  incr_top(L);\r\n  func = restorestack(L, funcr);  /* previous call may change stack */\r\n  setobj2s(L, func, tm);  /* tag method is the new function to be called */\r\n  return func;\r\n}\r\n\r\n\r\n\r\n#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L)))\r\n\r\n\r\n/*\r\n** returns true if function has been executed (C function)\r\n*/\r\nint luaD_precall (lua_State *L, StkId func, int nresults) {\r\n  lua_CFunction f;\r\n  CallInfo *ci;\r\n  int n;  /* number of arguments (Lua) or returns (C) */\r\n  ptrdiff_t funcr = savestack(L, func);\r\n  switch (ttype(func)) {\r\n    case LUA_TLCF:  /* light C function */\r\n      f = fvalue(func);\r\n      goto Cfunc;\r\n    case LUA_TCCL: {  /* C closure */\r\n      f = clCvalue(func)->f;\r\n     Cfunc:\r\n      luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */\r\n      ci = next_ci(L);  /* now 'enter' new function */\r\n      ci->nresults = nresults;\r\n      ci->func = restorestack(L, funcr);\r\n      ci->top = L->top + LUA_MINSTACK;\r\n      lua_assert(ci->top <= L->stack_last);\r\n      ci->callstatus = 0;\r\n      if (L->hookmask & LUA_MASKCALL)\r\n        luaD_hook(L, LUA_HOOKCALL, -1);\r\n      lua_unlock(L);\r\n      n = (*f)(L);  /* do the actual call */\r\n      lua_lock(L);\r\n      api_checknelems(L, n);\r\n      luaD_poscall(L, L->top - n);\r\n      return 1;\r\n    }\r\n    case LUA_TLCL: {  /* Lua function: prepare its call */\r\n      StkId base;\r\n      Proto *p = clLvalue(func)->p;\r\n      luaD_checkstack(L, p->maxstacksize);\r\n      func = restorestack(L, funcr);\r\n      n = cast_int(L->top - func) - 1;  /* number of real arguments */\r\n      for (; n < p->numparams; n++)\r\n        setnilvalue(L->top++);  /* complete missing arguments */\r\n      base = (!p->is_vararg) ? func + 1 : adjust_varargs(L, p, n);\r\n      ci = next_ci(L);  /* now 'enter' new function */\r\n      ci->nresults = nresults;\r\n      ci->func = func;\r\n      ci->u.l.base = base;\r\n      ci->top = base + p->maxstacksize;\r\n      lua_assert(ci->top <= L->stack_last);\r\n      ci->u.l.savedpc = p->code;  /* starting point */\r\n      ci->callstatus = CIST_LUA;\r\n      L->top = ci->top;\r\n      if (L->hookmask & LUA_MASKCALL)\r\n        callhook(L, ci);\r\n      return 0;\r\n    }\r\n    default: {  /* not a function */\r\n      func = tryfuncTM(L, func);  /* retry with 'function' tag method */\r\n      return luaD_precall(L, func, nresults);  /* now it must be a function */\r\n    }\r\n  }\r\n}\r\n\r\n\r\nint luaD_poscall (lua_State *L, StkId firstResult) {\r\n  StkId res;\r\n  int wanted, i;\r\n  CallInfo *ci = L->ci;\r\n  if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {\r\n    if (L->hookmask & LUA_MASKRET) {\r\n      ptrdiff_t fr = savestack(L, firstResult);  /* hook may change stack */\r\n      luaD_hook(L, LUA_HOOKRET, -1);\r\n      firstResult = restorestack(L, fr);\r\n    }\r\n    L->oldpc = ci->previous->u.l.savedpc;  /* 'oldpc' for caller function */\r\n  }\r\n  res = ci->func;  /* res == final position of 1st result */\r\n  wanted = ci->nresults;\r\n  L->ci = ci = ci->previous;  /* back to caller */\r\n  /* move results to correct place */\r\n  for (i = wanted; i != 0 && firstResult < L->top; i--)\r\n    setobjs2s(L, res++, firstResult++);\r\n  while (i-- > 0)\r\n    setnilvalue(res++);\r\n  L->top = res;\r\n  return (wanted - LUA_MULTRET);  /* 0 iff wanted == LUA_MULTRET */\r\n}\r\n\r\n\r\n/*\r\n** Call a function (C or Lua). The function to be called is at *func.\r\n** The arguments are on the stack, right after the function.\r\n** When returns, all the results are on the stack, starting at the original\r\n** function position.\r\n*/\r\nvoid luaD_call (lua_State *L, StkId func, int nResults, int allowyield) {\r\n  if (++L->nCcalls >= LUAI_MAXCCALLS) {\r\n    if (L->nCcalls == LUAI_MAXCCALLS)\r\n      luaG_runerror(L, \"C stack overflow\");\r\n    else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))\r\n      luaD_throw(L, LUA_ERRERR);  /* error while handing stack error */\r\n  }\r\n  if (!allowyield) L->nny++;\r\n  if (!luaD_precall(L, func, nResults))  /* is a Lua function? */\r\n    luaV_execute(L);  /* call it */\r\n  if (!allowyield) L->nny--;\r\n  L->nCcalls--;\r\n  luaC_checkGC(L);\r\n}\r\n\r\n\r\nstatic void finishCcall (lua_State *L) {\r\n  CallInfo *ci = L->ci;\r\n  int n;\r\n  lua_assert(ci->u.c.k != NULL);  /* must have a continuation */\r\n  lua_assert(L->nny == 0);\r\n  /* finish 'luaD_call' */\r\n  L->nCcalls--;\r\n  /* finish 'lua_callk' */\r\n  adjustresults(L, ci->nresults);\r\n  /* call continuation function */\r\n  if (!(ci->callstatus & CIST_STAT))  /* no call status? */\r\n    ci->u.c.status = LUA_YIELD;  /* 'default' status */\r\n  lua_assert(ci->u.c.status != LUA_OK);\r\n  ci->callstatus = (ci->callstatus & ~(CIST_YPCALL | CIST_STAT)) | CIST_YIELDED;\r\n  lua_unlock(L);\r\n  n = (*ci->u.c.k)(L);\r\n  lua_lock(L);\r\n  api_checknelems(L, n);\r\n  /* finish 'luaD_precall' */\r\n  luaD_poscall(L, L->top - n);\r\n}\r\n\r\n\r\nstatic void unroll (lua_State *L, void *ud) {\r\n  UNUSED(ud);\r\n  for (;;) {\r\n    if (L->ci == &L->base_ci)  /* stack is empty? */\r\n      return;  /* coroutine finished normally */\r\n    if (!isLua(L->ci))  /* C function? */\r\n      finishCcall(L);\r\n    else {  /* Lua function */\r\n      luaV_finishOp(L);  /* finish interrupted instruction */\r\n      luaV_execute(L);  /* execute down to higher C 'boundary' */\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** check whether thread has a suspended protected call\r\n*/\r\nstatic CallInfo *findpcall (lua_State *L) {\r\n  CallInfo *ci;\r\n  for (ci = L->ci; ci != NULL; ci = ci->previous) {  /* search for a pcall */\r\n    if (ci->callstatus & CIST_YPCALL)\r\n      return ci;\r\n  }\r\n  return NULL;  /* no pending pcall */\r\n}\r\n\r\n\r\nstatic int recover (lua_State *L, int status) {\r\n  StkId oldtop;\r\n  CallInfo *ci = findpcall(L);\r\n  if (ci == NULL) return 0;  /* no recovery point */\r\n  /* \"finish\" luaD_pcall */\r\n  oldtop = restorestack(L, ci->u.c.extra);\r\n  luaF_close(L, oldtop);\r\n  seterrorobj(L, status, oldtop);\r\n  L->ci = ci;\r\n  L->allowhook = ci->u.c.old_allowhook;\r\n  L->nny = 0;  /* should be zero to be yieldable */\r\n  luaD_shrinkstack(L);\r\n  L->errfunc = ci->u.c.old_errfunc;\r\n  ci->callstatus |= CIST_STAT;  /* call has error status */\r\n  ci->u.c.status = status;  /* (here it is) */\r\n  return 1;  /* continue running the coroutine */\r\n}\r\n\r\n\r\n/*\r\n** signal an error in the call to 'resume', not in the execution of the\r\n** coroutine itself. (Such errors should not be handled by any coroutine\r\n** error handler and should not kill the coroutine.)\r\n*/\r\nstatic l_noret resume_error (lua_State *L, const char *msg, StkId firstArg) {\r\n  L->top = firstArg;  /* remove args from the stack */\r\n  setsvalue2s(L, L->top, luaS_new(L, msg));  /* push error message */\r\n  incr_top(L);\r\n  luaD_throw(L, -1);  /* jump back to 'lua_resume' */\r\n}\r\n\r\n\r\n/*\r\n** do the work for 'lua_resume' in protected mode\r\n*/\r\nstatic void resume (lua_State *L, void *ud) {\r\n  StkId firstArg = cast(StkId, ud);\r\n  CallInfo *ci = L->ci;\r\n  if (L->nCcalls >= LUAI_MAXCCALLS)\r\n    resume_error(L, \"C stack overflow\", firstArg);\r\n  if (L->status == LUA_OK) {  /* may be starting a coroutine */\r\n    if (ci != &L->base_ci)  /* not in base level? */\r\n      resume_error(L, \"cannot resume non-suspended coroutine\", firstArg);\r\n    /* coroutine is in base level; start running it */\r\n    if (!luaD_precall(L, firstArg - 1, LUA_MULTRET))  /* Lua function? */\r\n      luaV_execute(L);  /* call it */\r\n  }\r\n  else if (L->status != LUA_YIELD)\r\n    resume_error(L, \"cannot resume dead coroutine\", firstArg);\r\n  else {  /* resuming from previous yield */\r\n    L->status = LUA_OK;\r\n    if (isLua(ci))  /* yielded inside a hook? */\r\n      luaV_execute(L);  /* just continue running Lua code */\r\n    else {  /* 'common' yield */\r\n      ci->func = restorestack(L, ci->u.c.extra);\r\n      if (ci->u.c.k != NULL) {  /* does it have a continuation? */\r\n        int n;\r\n        ci->u.c.status = LUA_YIELD;  /* 'default' status */\r\n        ci->callstatus |= CIST_YIELDED;\r\n        lua_unlock(L);\r\n        n = (*ci->u.c.k)(L);  /* call continuation */\r\n        lua_lock(L);\r\n        api_checknelems(L, n);\r\n        firstArg = L->top - n;  /* yield results come from continuation */\r\n      }\r\n      L->nCcalls--;  /* finish 'luaD_call' */\r\n      luaD_poscall(L, firstArg);  /* finish 'luaD_precall' */\r\n    }\r\n    unroll(L, NULL);\r\n  }\r\n}\r\n\r\n\r\nLUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {\r\n  int status;\r\n  lua_lock(L);\r\n  luai_userstateresume(L, nargs);\r\n  L->nCcalls = (from) ? from->nCcalls + 1 : 1;\r\n  L->nny = 0;  /* allow yields */\r\n  api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);\r\n  status = luaD_rawrunprotected(L, resume, L->top - nargs);\r\n  if (status == -1)  /* error calling 'lua_resume'? */\r\n    status = LUA_ERRRUN;\r\n  else {  /* yield or regular error */\r\n    while (status != LUA_OK && status != LUA_YIELD) {  /* error? */\r\n      if (recover(L, status))  /* recover point? */\r\n        status = luaD_rawrunprotected(L, unroll, NULL);  /* run continuation */\r\n      else {  /* unrecoverable error */\r\n        L->status = cast_byte(status);  /* mark thread as `dead' */\r\n        seterrorobj(L, status, L->top);\r\n        L->ci->top = L->top;\r\n        break;\r\n      }\r\n    }\r\n    lua_assert(status == L->status);\r\n  }\r\n  L->nny = 1;  /* do not allow yields */\r\n  L->nCcalls--;\r\n  lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));\r\n  lua_unlock(L);\r\n  return status;\r\n}\r\n\r\n\r\nLUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) {\r\n  CallInfo *ci = L->ci;\r\n  luai_userstateyield(L, nresults);\r\n  lua_lock(L);\r\n  api_checknelems(L, nresults);\r\n  if (L->nny > 0) {\r\n    if (L != G(L)->mainthread)\r\n      luaG_runerror(L, \"attempt to yield across metamethod/C-call boundary\");\r\n    else\r\n      luaG_runerror(L, \"attempt to yield from outside a coroutine\");\r\n  }\r\n  L->status = LUA_YIELD;\r\n  if (isLua(ci)) {  /* inside a hook? */\r\n    api_check(L, k == NULL, \"hooks cannot continue after yielding\");\r\n  }\r\n  else {\r\n    if ((ci->u.c.k = k) != NULL)  /* is there a continuation? */\r\n      ci->u.c.ctx = ctx;  /* save context */\r\n    ci->u.c.extra = savestack(L, ci->func);  /* save current 'func' */\r\n    ci->func = L->top - nresults - 1;  /* protect stack below results */\r\n    luaD_throw(L, LUA_YIELD);\r\n  }\r\n  lua_assert(ci->callstatus & CIST_HOOKED);  /* must be inside a hook */\r\n  lua_unlock(L);\r\n  return 0;  /* return to 'luaD_hook' */\r\n}\r\n\r\n\r\nint luaD_pcall (lua_State *L, Pfunc func, void *u,\r\n                ptrdiff_t old_top, ptrdiff_t ef) {\r\n  int status;\r\n  CallInfo *old_ci = L->ci;\r\n  lu_byte old_allowhooks = L->allowhook;\r\n  unsigned short old_nny = L->nny;\r\n  ptrdiff_t old_errfunc = L->errfunc;\r\n  L->errfunc = ef;\r\n  status = luaD_rawrunprotected(L, func, u);\r\n  if (status != LUA_OK) {  /* an error occurred? */\r\n    StkId oldtop = restorestack(L, old_top);\r\n    luaF_close(L, oldtop);  /* close possible pending closures */\r\n    seterrorobj(L, status, oldtop);\r\n    L->ci = old_ci;\r\n    L->allowhook = old_allowhooks;\r\n    L->nny = old_nny;\r\n    luaD_shrinkstack(L);\r\n  }\r\n  L->errfunc = old_errfunc;\r\n  return status;\r\n}\r\n\r\n\r\n\r\n/*\r\n** Execute a protected parser.\r\n*/\r\nstruct SParser {  /* data to `f_parser' */\r\n  ZIO *z;\r\n  Mbuffer buff;  /* dynamic structure used by the scanner */\r\n  Dyndata dyd;  /* dynamic structures used by the parser */\r\n  const char *mode;\r\n  const char *name;\r\n};\r\n\r\n\r\nstatic void checkmode (lua_State *L, const char *mode, const char *x) {\r\n  if (mode && strchr(mode, x[0]) == NULL) {\r\n    luaO_pushfstring(L,\r\n       \"attempt to load a %s chunk (mode is \" LUA_QS \")\", x, mode);\r\n    luaD_throw(L, LUA_ERRSYNTAX);\r\n  }\r\n}\r\n\r\n\r\nstatic void f_parser (lua_State *L, void *ud) {\r\n  int i;\r\n  Proto *tf;\r\n  Closure *cl;\r\n  struct SParser *p = cast(struct SParser *, ud);\r\n  int c = zgetc(p->z);  /* read first character */\r\n  if (c == LUA_SIGNATURE[0]) {\r\n    checkmode(L, p->mode, \"binary\");\r\n    tf = luaU_undump(L, p->z, &p->buff, p->name);\r\n  }\r\n  else {\r\n    checkmode(L, p->mode, \"text\");\r\n    tf = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);\r\n  }\r\n  setptvalue2s(L, L->top, tf);\r\n  incr_top(L);\r\n  cl = luaF_newLclosure(L, tf);\r\n  setclLvalue(L, L->top - 1, cl);\r\n  for (i = 0; i < tf->sizeupvalues; i++)  /* initialize upvalues */\r\n    cl->l.upvals[i] = luaF_newupval(L);\r\n}\r\n\r\n\r\nint luaD_protectedparser (lua_State *L, ZIO *z, const char *name,\r\n                                        const char *mode) {\r\n  struct SParser p;\r\n  int status;\r\n  L->nny++;  /* cannot yield during parsing */\r\n  p.z = z; p.name = name; p.mode = mode;\r\n  p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0;\r\n  p.dyd.gt.arr = NULL; p.dyd.gt.size = 0;\r\n  p.dyd.label.arr = NULL; p.dyd.label.size = 0;\r\n  luaZ_initbuffer(L, &p.buff);\r\n  status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);\r\n  luaZ_freebuffer(L, &p.buff);\r\n  luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size);\r\n  luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size);\r\n  luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size);\r\n  L->nny--;\r\n  return status;\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ldo.h",
    "content": "/*\r\n** $Id: ldo.h,v 2.20 2011/11/29 15:55:08 roberto Exp $\r\n** Stack and Call structure of Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef ldo_h\r\n#define ldo_h\r\n\r\n\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\n#define luaD_checkstack(L,n)\tif (L->stack_last - L->top <= (n)) \\\r\n\t\t\t\t    luaD_growstack(L, n); else condmovestack(L);\r\n\r\n\r\n#define incr_top(L) {L->top++; luaD_checkstack(L,0);}\r\n\r\n#define savestack(L,p)\t\t((char *)(p) - (char *)L->stack)\r\n#define restorestack(L,n)\t((TValue *)((char *)L->stack + (n)))\r\n\r\n\r\n/* type of protected functions, to be ran by `runprotected' */\r\ntypedef void (*Pfunc) (lua_State *L, void *ud);\r\n\r\nLUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,\r\n                                                  const char *mode);\r\nLUAI_FUNC void luaD_hook (lua_State *L, int event, int line);\r\nLUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);\r\nLUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults,\r\n                                        int allowyield);\r\nLUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,\r\n                                        ptrdiff_t oldtop, ptrdiff_t ef);\r\nLUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);\r\nLUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);\r\nLUAI_FUNC void luaD_growstack (lua_State *L, int n);\r\nLUAI_FUNC void luaD_shrinkstack (lua_State *L);\r\n\r\nLUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);\r\nLUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ldump.c",
    "content": "/*\r\n** $Id: ldump.c,v 1.19 2011/11/23 17:48:18 lhf Exp $\r\n** save precompiled Lua chunks\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#include <stddef.h>\r\n\r\n#define ldump_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lundump.h\"\r\n\r\ntypedef struct {\r\n lua_State* L;\r\n lua_Writer writer;\r\n void* data;\r\n int strip;\r\n int status;\r\n} DumpState;\r\n\r\n#define DumpMem(b,n,size,D)\tDumpBlock(b,(n)*(size),D)\r\n#define DumpVar(x,D)\t\tDumpMem(&x,1,sizeof(x),D)\r\n\r\nstatic void DumpBlock(const void* b, size_t size, DumpState* D)\r\n{\r\n if (D->status==0)\r\n {\r\n  lua_unlock(D->L);\r\n  D->status=(*D->writer)(D->L,b,size,D->data);\r\n  lua_lock(D->L);\r\n }\r\n}\r\n\r\nstatic void DumpChar(int y, DumpState* D)\r\n{\r\n char x=(char)y;\r\n DumpVar(x,D);\r\n}\r\n\r\nstatic void DumpInt(int x, DumpState* D)\r\n{\r\n DumpVar(x,D);\r\n}\r\n\r\nstatic void DumpNumber(lua_Number x, DumpState* D)\r\n{\r\n DumpVar(x,D);\r\n}\r\n\r\nstatic void DumpVector(const void* b, int n, size_t size, DumpState* D)\r\n{\r\n DumpInt(n,D);\r\n DumpMem(b,n,size,D);\r\n}\r\n\r\nstatic void DumpString(const TString* s, DumpState* D)\r\n{\r\n if (s==NULL)\r\n {\r\n  size_t size=0;\r\n  DumpVar(size,D);\r\n }\r\n else\r\n {\r\n  size_t size=s->tsv.len+1;\t\t/* include trailing '\\0' */\r\n  DumpVar(size,D);\r\n  DumpBlock(getstr(s),size*sizeof(char),D);\r\n }\r\n}\r\n\r\n#define DumpCode(f,D)\t DumpVector(f->code,f->sizecode,sizeof(Instruction),D)\r\n\r\nstatic void DumpFunction(const Proto* f, DumpState* D);\r\n\r\nstatic void DumpConstants(const Proto* f, DumpState* D)\r\n{\r\n int i,n=f->sizek;\r\n DumpInt(n,D);\r\n for (i=0; i<n; i++)\r\n {\r\n  const TValue* o=&f->k[i];\r\n  DumpChar(ttype(o),D);\r\n  switch (ttype(o))\r\n  {\r\n   case LUA_TNIL:\r\n\tbreak;\r\n   case LUA_TBOOLEAN:\r\n\tDumpChar(bvalue(o),D);\r\n\tbreak;\r\n   case LUA_TNUMBER:\r\n\tDumpNumber(nvalue(o),D);\r\n\tbreak;\r\n   case LUA_TSTRING:\r\n\tDumpString(rawtsvalue(o),D);\r\n\tbreak;\r\n  }\r\n }\r\n n=f->sizep;\r\n DumpInt(n,D);\r\n for (i=0; i<n; i++) DumpFunction(f->p[i],D);\r\n}\r\n\r\nstatic void DumpUpvalues(const Proto* f, DumpState* D)\r\n{\r\n int i,n=f->sizeupvalues;\r\n DumpInt(n,D);\r\n for (i=0; i<n; i++)\r\n {\r\n  DumpChar(f->upvalues[i].instack,D);\r\n  DumpChar(f->upvalues[i].idx,D);\r\n }\r\n}\r\n\r\nstatic void DumpDebug(const Proto* f, DumpState* D)\r\n{\r\n int i,n;\r\n DumpString((D->strip) ? NULL : f->source,D);\r\n n= (D->strip) ? 0 : f->sizelineinfo;\r\n DumpVector(f->lineinfo,n,sizeof(int),D);\r\n n= (D->strip) ? 0 : f->sizelocvars;\r\n DumpInt(n,D);\r\n for (i=0; i<n; i++)\r\n {\r\n  DumpString(f->locvars[i].varname,D);\r\n  DumpInt(f->locvars[i].startpc,D);\r\n  DumpInt(f->locvars[i].endpc,D);\r\n }\r\n n= (D->strip) ? 0 : f->sizeupvalues;\r\n DumpInt(n,D);\r\n for (i=0; i<n; i++) DumpString(f->upvalues[i].name,D);\r\n}\r\n\r\nstatic void DumpFunction(const Proto* f, DumpState* D)\r\n{\r\n DumpInt(f->linedefined,D);\r\n DumpInt(f->lastlinedefined,D);\r\n DumpChar(f->numparams,D);\r\n DumpChar(f->is_vararg,D);\r\n DumpChar(f->maxstacksize,D);\r\n DumpCode(f,D);\r\n DumpConstants(f,D);\r\n DumpUpvalues(f,D);\r\n DumpDebug(f,D);\r\n}\r\n\r\nstatic void DumpHeader(DumpState* D)\r\n{\r\n lu_byte h[LUAC_HEADERSIZE];\r\n luaU_header(h);\r\n DumpBlock(h,LUAC_HEADERSIZE,D);\r\n}\r\n\r\n/*\r\n** dump Lua function as precompiled chunk\r\n*/\r\nint luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)\r\n{\r\n DumpState D;\r\n D.L=L;\r\n D.writer=w;\r\n D.data=data;\r\n D.strip=strip;\r\n D.status=0;\r\n DumpHeader(&D);\r\n DumpFunction(f,&D);\r\n return D.status;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/lua/lfunc.c",
    "content": "/*\r\n** $Id: lfunc.c,v 2.27 2010/06/30 14:11:17 roberto Exp $\r\n** Auxiliary functions to manipulate prototypes and closures\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#define lfunc_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lfunc.h\"\r\n#include \"lgc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n\r\n\r\n\r\nClosure *luaF_newCclosure (lua_State *L, int n) {\r\n  Closure *c = &luaC_newobj(L, LUA_TFUNCTION, sizeCclosure(n), NULL, 0)->cl;\r\n  c->c.isC = 1;\r\n  c->c.nupvalues = cast_byte(n);\r\n  return c;\r\n}\r\n\r\n\r\nClosure *luaF_newLclosure (lua_State *L, Proto *p) {\r\n  int n = p->sizeupvalues;\r\n  Closure *c = &luaC_newobj(L, LUA_TFUNCTION, sizeLclosure(n), NULL, 0)->cl;\r\n  c->l.isC = 0;\r\n  c->l.p = p;\r\n  c->l.nupvalues = cast_byte(n);\r\n  while (n--) c->l.upvals[n] = NULL;\r\n  return c;\r\n}\r\n\r\n\r\nUpVal *luaF_newupval (lua_State *L) {\r\n  UpVal *uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), NULL, 0)->uv;\r\n  uv->v = &uv->u.value;\r\n  setnilvalue(uv->v);\r\n  return uv;\r\n}\r\n\r\n\r\nUpVal *luaF_findupval (lua_State *L, StkId level) {\r\n  global_State *g = G(L);\r\n  GCObject **pp = &L->openupval;\r\n  UpVal *p;\r\n  UpVal *uv;\r\n  while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {\r\n    GCObject *o = obj2gco(p);\r\n    lua_assert(p->v != &p->u.value);\r\n    if (p->v == level) {  /* found a corresponding upvalue? */\r\n      if (isdead(g, o))  /* is it dead? */\r\n        changewhite(o);  /* resurrect it */\r\n      return p;\r\n    }\r\n    resetoldbit(o);  /* may create a newer upval after this one */\r\n    pp = &p->next;\r\n  }\r\n  /* not found: create a new one */\r\n  uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), pp, 0)->uv;\r\n  uv->v = level;  /* current value lives in the stack */\r\n  uv->u.l.prev = &g->uvhead;  /* double link it in `uvhead' list */\r\n  uv->u.l.next = g->uvhead.u.l.next;\r\n  uv->u.l.next->u.l.prev = uv;\r\n  g->uvhead.u.l.next = uv;\r\n  lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);\r\n  return uv;\r\n}\r\n\r\n\r\nstatic void unlinkupval (UpVal *uv) {\r\n  lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);\r\n  uv->u.l.next->u.l.prev = uv->u.l.prev;  /* remove from `uvhead' list */\r\n  uv->u.l.prev->u.l.next = uv->u.l.next;\r\n}\r\n\r\n\r\nvoid luaF_freeupval (lua_State *L, UpVal *uv) {\r\n  if (uv->v != &uv->u.value)  /* is it open? */\r\n    unlinkupval(uv);  /* remove from open list */\r\n  luaM_free(L, uv);  /* free upvalue */\r\n}\r\n\r\n\r\nvoid luaF_close (lua_State *L, StkId level) {\r\n  UpVal *uv;\r\n  global_State *g = G(L);\r\n  while (L->openupval != NULL && (uv = gco2uv(L->openupval))->v >= level) {\r\n    GCObject *o = obj2gco(uv);\r\n    lua_assert(!isblack(o) && uv->v != &uv->u.value);\r\n    L->openupval = uv->next;  /* remove from `open' list */\r\n    if (isdead(g, o))\r\n      luaF_freeupval(L, uv);  /* free upvalue */\r\n    else {\r\n      unlinkupval(uv);  /* remove upvalue from 'uvhead' list */\r\n      setobj(L, &uv->u.value, uv->v);  /* move value to upvalue slot */\r\n      uv->v = &uv->u.value;  /* now current value lives here */\r\n      gch(o)->next = g->allgc;  /* link upvalue into 'allgc' list */\r\n      g->allgc = o;\r\n      luaC_checkupvalcolor(g, uv);\r\n    }\r\n  }\r\n}\r\n\r\n\r\nProto *luaF_newproto (lua_State *L) {\r\n  Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), NULL, 0)->p;\r\n  f->k = NULL;\r\n  f->sizek = 0;\r\n  f->p = NULL;\r\n  f->sizep = 0;\r\n  f->code = NULL;\r\n  f->cache = NULL;\r\n  f->sizecode = 0;\r\n  f->lineinfo = NULL;\r\n  f->sizelineinfo = 0;\r\n  f->upvalues = NULL;\r\n  f->sizeupvalues = 0;\r\n  f->numparams = 0;\r\n  f->is_vararg = 0;\r\n  f->maxstacksize = 0;\r\n  f->locvars = NULL;\r\n  f->sizelocvars = 0;\r\n  f->linedefined = 0;\r\n  f->lastlinedefined = 0;\r\n  f->source = NULL;\r\n  return f;\r\n}\r\n\r\n\r\nvoid luaF_freeproto (lua_State *L, Proto *f) {\r\n  luaM_freearray(L, f->code, f->sizecode);\r\n  luaM_freearray(L, f->p, f->sizep);\r\n  luaM_freearray(L, f->k, f->sizek);\r\n  luaM_freearray(L, f->lineinfo, f->sizelineinfo);\r\n  luaM_freearray(L, f->locvars, f->sizelocvars);\r\n  luaM_freearray(L, f->upvalues, f->sizeupvalues);\r\n  luaM_free(L, f);\r\n}\r\n\r\n\r\nvoid luaF_freeclosure (lua_State *L, Closure *c) {\r\n  int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) :\r\n                          sizeLclosure(c->l.nupvalues);\r\n  luaM_freemem(L, c, size);\r\n}\r\n\r\n\r\n/*\r\n** Look for n-th local variable at line `line' in function `func'.\r\n** Returns NULL if not found.\r\n*/\r\nconst char *luaF_getlocalname (const Proto *f, int local_number, int pc) {\r\n  int i;\r\n  for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {\r\n    if (pc < f->locvars[i].endpc) {  /* is variable active? */\r\n      local_number--;\r\n      if (local_number == 0)\r\n        return getstr(f->locvars[i].varname);\r\n    }\r\n  }\r\n  return NULL;  /* not found */\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lfunc.h",
    "content": "/*\r\n** $Id: lfunc.h,v 2.6 2010/06/04 13:06:15 roberto Exp $\r\n** Auxiliary functions to manipulate prototypes and closures\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lfunc_h\r\n#define lfunc_h\r\n\r\n\r\n#include \"lobject.h\"\r\n\r\n\r\n#define sizeCclosure(n)\t(cast(int, sizeof(CClosure)) + \\\r\n                         cast(int, sizeof(TValue)*((n)-1)))\r\n\r\n#define sizeLclosure(n)\t(cast(int, sizeof(LClosure)) + \\\r\n                         cast(int, sizeof(TValue *)*((n)-1)))\r\n\r\n\r\nLUAI_FUNC Proto *luaF_newproto (lua_State *L);\r\nLUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems);\r\nLUAI_FUNC Closure *luaF_newLclosure (lua_State *L, Proto *p);\r\nLUAI_FUNC UpVal *luaF_newupval (lua_State *L);\r\nLUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);\r\nLUAI_FUNC void luaF_close (lua_State *L, StkId level);\r\nLUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);\r\nLUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c);\r\nLUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv);\r\nLUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,\r\n                                         int pc);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lgc.c",
    "content": "/*\r\n** $Id: lgc.c,v 2.116 2011/12/02 13:18:41 roberto Exp $\r\n** Garbage Collector\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#include <string.h>\r\n\r\n#define lgc_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lgc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n\r\n\r\n\r\n/* how much to allocate before next GC step */\r\n#define GCSTEPSIZE\t1024\r\n\r\n/* maximum number of elements to sweep in each single step */\r\n#define GCSWEEPMAX\t40\r\n\r\n/* cost of sweeping one element */\r\n#define GCSWEEPCOST\t1\r\n\r\n/* maximum number of finalizers to call in each GC step */\r\n#define GCFINALIZENUM\t4\r\n\r\n/* cost of marking the root set */\r\n#define GCROOTCOST\t10\r\n\r\n/* cost of atomic step */\r\n#define GCATOMICCOST\t1000\r\n\r\n/* basic cost to traverse one object (to be added to the links the\r\n   object may have) */\r\n#define TRAVCOST\t5\r\n\r\n\r\n/*\r\n** standard negative debt for GC; a reasonable \"time\" to wait before\r\n** starting a new cycle\r\n*/\r\n#define stddebt(g)\t(-cast(l_mem, gettotalbytes(g)/100) * g->gcpause)\r\n\r\n\r\n/*\r\n** 'makewhite' erases all color bits plus the old bit and then\r\n** sets only the current white bit\r\n*/\r\n#define maskcolors\t(~(bit2mask(BLACKBIT, OLDBIT) | WHITEBITS))\r\n#define makewhite(g,x)\t\\\r\n (gch(x)->marked = cast_byte((gch(x)->marked & maskcolors) | luaC_white(g)))\r\n\r\n#define white2gray(x)\tresetbits(gch(x)->marked, WHITEBITS)\r\n#define black2gray(x)\tresetbit(gch(x)->marked, BLACKBIT)\r\n\r\n#define stringmark(s)\t((void)((s) && resetbits((s)->tsv.marked, WHITEBITS)))\r\n\r\n\r\n#define isfinalized(x)\t\ttestbit(gch(x)->marked, FINALIZEDBIT)\r\n\r\n#define checkdeadkey(n)\tlua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n)))\r\n\r\n\r\n#define checkconsistency(obj)  \\\r\n  lua_longassert(!iscollectable(obj) || righttt(obj))\r\n\r\n\r\n#define markvalue(g,o) { checkconsistency(o); \\\r\n  if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); }\r\n\r\n#define markobject(g,t) { if ((t) && iswhite(obj2gco(t))) \\\r\n\t\treallymarkobject(g, obj2gco(t)); }\r\n\r\nstatic void reallymarkobject (global_State *g, GCObject *o);\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Generic functions\r\n** =======================================================\r\n*/\r\n\r\n\r\n/*\r\n** one after last element in a hash array\r\n*/\r\n#define gnodelast(h)\tgnode(h, cast(size_t, sizenode(h)))\r\n\r\n\r\n/*\r\n** link table 'h' into list pointed by 'p'\r\n*/\r\n#define linktable(h,p)\t((h)->gclist = *(p), *(p) = obj2gco(h))\r\n\r\n\r\n/*\r\n** if key is not marked, mark its entry as dead (therefore removing it\r\n** from the table)\r\n*/\r\nstatic void removeentry (Node *n) {\r\n  lua_assert(ttisnil(gval(n)));\r\n  if (valiswhite(gkey(n)))\r\n    setdeadvalue(gkey(n));  /* unused and unmarked key; remove it */\r\n}\r\n\r\n\r\n/*\r\n** tells whether a key or value can be cleared from a weak\r\n** table. Non-collectable objects are never removed from weak\r\n** tables. Strings behave as `values', so are never removed too. for\r\n** other objects: if really collected, cannot keep them; for objects\r\n** being finalized, keep them in keys, but not in values\r\n*/\r\nstatic int iscleared (const TValue *o) {\r\n  if (!iscollectable(o)) return 0;\r\n  else if (ttisstring(o)) {\r\n    stringmark(rawtsvalue(o));  /* strings are `values', so are never weak */\r\n    return 0;\r\n  }\r\n  else return iswhite(gcvalue(o));\r\n}\r\n\r\n\r\n/*\r\n** barrier that moves collector forward, that is, mark the white object\r\n** being pointed by a black object.\r\n*/\r\nvoid luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) {\r\n  global_State *g = G(L);\r\n  lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));\r\n  lua_assert(isgenerational(g) || g->gcstate != GCSpause);\r\n  lua_assert(gch(o)->tt != LUA_TTABLE);\r\n  if (keepinvariant(g))  /* must keep invariant? */\r\n    reallymarkobject(g, v);  /* restore invariant */\r\n  else {  /* sweep phase */\r\n    lua_assert(issweepphase(g));\r\n    makewhite(g, o);  /* mark main obj. as white to avoid other barriers */\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** barrier that moves collector backward, that is, mark the black object\r\n** pointing to a white object as gray again. (Current implementation\r\n** only works for tables; access to 'gclist' is not uniform across\r\n** different types.)\r\n*/\r\nvoid luaC_barrierback_ (lua_State *L, GCObject *o) {\r\n  global_State *g = G(L);\r\n  lua_assert(isblack(o) && !isdead(g, o) && gch(o)->tt == LUA_TTABLE);\r\n  black2gray(o);  /* make object gray (again) */\r\n  gco2t(o)->gclist = g->grayagain;\r\n  g->grayagain = o;\r\n}\r\n\r\n\r\n/*\r\n** barrier for prototypes. When creating first closure (cache is\r\n** NULL), use a forward barrier; this may be the only closure of the\r\n** prototype (if it is a \"regular\" function, with a single instance)\r\n** and the prototype may be big, so it is better to avoid traversing\r\n** it again. Otherwise, use a backward barrier, to avoid marking all\r\n** possible instances.\r\n*/\r\nLUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c) {\r\n  global_State *g = G(L);\r\n  lua_assert(isblack(obj2gco(p)));\r\n  if (p->cache == NULL) {  /* first time? */\r\n    luaC_objbarrier(L, p, c);\r\n  }\r\n  else {  /* use a backward barrier */\r\n    black2gray(obj2gco(p));  /* make prototype gray (again) */\r\n    p->gclist = g->grayagain;\r\n    g->grayagain = obj2gco(p);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** check color (and invariants) for an upvalue that was closed,\r\n** i.e., moved into the 'allgc' list\r\n*/\r\nvoid luaC_checkupvalcolor (global_State *g, UpVal *uv) {\r\n  GCObject *o = obj2gco(uv);\r\n  lua_assert(!isblack(o));  /* open upvalues are never black */\r\n  if (isgray(o)) {\r\n    if (keepinvariant(g)) {\r\n      resetoldbit(o);  /* see MOVE OLD rule */\r\n      gray2black(o);  /* it is being visited now */\r\n      markvalue(g, uv->v);\r\n    }\r\n    else {\r\n      lua_assert(issweepphase(g));\r\n      makewhite(g, o);\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** create a new collectable object (with given type and size) and link\r\n** it to '*list'. 'offset' tells how many bytes to allocate before the\r\n** object itself (used only by states).\r\n*/\r\nGCObject *luaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list,\r\n                       int offset) {\r\n  global_State *g = G(L);\r\n  GCObject *o = obj2gco(cast(char *, luaM_newobject(L, tt, sz)) + offset);\r\n  if (list == NULL)\r\n    list = &g->allgc;  /* standard list for collectable objects */\r\n  gch(o)->marked = luaC_white(g);\r\n  gch(o)->tt = tt;\r\n  gch(o)->next = *list;\r\n  *list = o;\r\n  return o;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Mark functions\r\n** =======================================================\r\n*/\r\n\r\n\r\n/*\r\n** mark an object. Userdata and closed upvalues are visited and turned\r\n** black here. Strings remain gray (it is the same as making them\r\n** black). Other objects are marked gray and added to appropriate list\r\n** to be visited (and turned black) later. (Open upvalues are already\r\n** linked in 'headuv' list.)\r\n*/\r\nstatic void reallymarkobject (global_State *g, GCObject *o) {\r\n  lua_assert(iswhite(o) && !isdead(g, o));\r\n  white2gray(o);\r\n  switch (gch(o)->tt) {\r\n    case LUA_TSTRING: {\r\n      return;  /* for strings, gray is as good as black */\r\n    }\r\n    case LUA_TUSERDATA: {\r\n      Table *mt = gco2u(o)->metatable;\r\n      markobject(g, mt);\r\n      markobject(g, gco2u(o)->env);\r\n      gray2black(o);  /* all pointers marked */\r\n      return;\r\n    }\r\n    case LUA_TUPVAL: {\r\n      UpVal *uv = gco2uv(o);\r\n      markvalue(g, uv->v);\r\n      if (uv->v == &uv->u.value)  /* closed? (open upvalues remain gray) */\r\n        gray2black(o);  /* make it black */\r\n      return;\r\n    }\r\n    case LUA_TFUNCTION: {\r\n      gco2cl(o)->c.gclist = g->gray;\r\n      g->gray = o;\r\n      break;\r\n    }\r\n    case LUA_TTABLE: {\r\n      linktable(gco2t(o), &g->gray);\r\n      break;\r\n    }\r\n    case LUA_TTHREAD: {\r\n      gco2th(o)->gclist = g->gray;\r\n      g->gray = o;\r\n      break;\r\n    }\r\n    case LUA_TPROTO: {\r\n      gco2p(o)->gclist = g->gray;\r\n      g->gray = o;\r\n      break;\r\n    }\r\n    default: lua_assert(0);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** mark metamethods for basic types\r\n*/\r\nstatic void markmt (global_State *g) {\r\n  int i;\r\n  for (i=0; i < LUA_NUMTAGS; i++)\r\n    markobject(g, g->mt[i]);\r\n}\r\n\r\n\r\n/*\r\n** mark all objects in list of being-finalized\r\n*/\r\nstatic void markbeingfnz (global_State *g) {\r\n  GCObject *o;\r\n  for (o = g->tobefnz; o != NULL; o = gch(o)->next) {\r\n    makewhite(g, o);\r\n    reallymarkobject(g, o);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** mark all values stored in marked open upvalues. (See comment in\r\n** 'lstate.h'.)\r\n*/\r\nstatic void remarkupvals (global_State *g) {\r\n  UpVal *uv;\r\n  for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) {\r\n    if (isgray(obj2gco(uv)))\r\n      markvalue(g, uv->v);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** mark root set and reset all gray lists, to start a new\r\n** incremental (or full) collection\r\n*/\r\nstatic void markroot (global_State *g) {\r\n  g->gray = g->grayagain = NULL;\r\n  g->weak = g->allweak = g->ephemeron = NULL;\r\n  markobject(g, g->mainthread);\r\n  markvalue(g, &g->l_registry);\r\n  markmt(g);\r\n  markbeingfnz(g);  /* mark any finalizing object left from previous cycle */\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Traverse functions\r\n** =======================================================\r\n*/\r\n\r\nstatic void traverseweakvalue (global_State *g, Table *h) {\r\n  Node *n, *limit = gnodelast(h);\r\n  /* if there is array part, assume it may have white values (do not\r\n     traverse it just to check) */\r\n  int hasclears = (h->sizearray > 0);\r\n  for (n = gnode(h, 0); n < limit; n++) {\r\n    checkdeadkey(n);\r\n    if (ttisnil(gval(n)))  /* entry is empty? */\r\n      removeentry(n);  /* remove it */\r\n    else {\r\n      lua_assert(!ttisnil(gkey(n)));\r\n      markvalue(g, gkey(n));  /* mark key */\r\n      if (!hasclears && iscleared(gval(n)))  /* is there a white value? */\r\n        hasclears = 1;  /* table will have to be cleared */\r\n    }\r\n  }\r\n  if (hasclears)\r\n    linktable(h, &g->weak);  /* has to be cleared later */\r\n  else  /* no white values */\r\n    linktable(h, &g->grayagain);  /* no need to clean */\r\n}\r\n\r\n\r\nstatic int traverseephemeron (global_State *g, Table *h) {\r\n  int marked = 0;  /* true if an object is marked in this traversal */\r\n  int hasclears = 0;  /* true if table has white keys */\r\n  int prop = 0;  /* true if table has entry \"white-key -> white-value\" */\r\n  Node *n, *limit = gnodelast(h);\r\n  int i;\r\n  /* traverse array part (numeric keys are 'strong') */\r\n  for (i = 0; i < h->sizearray; i++) {\r\n    if (valiswhite(&h->array[i])) {\r\n      marked = 1;\r\n      reallymarkobject(g, gcvalue(&h->array[i]));\r\n    }\r\n  }\r\n  /* traverse hash part */\r\n  for (n = gnode(h, 0); n < limit; n++) {\r\n    checkdeadkey(n);\r\n    if (ttisnil(gval(n)))  /* entry is empty? */\r\n      removeentry(n);  /* remove it */\r\n    else if (iscleared(gkey(n))) {  /* key is not marked (yet)? */\r\n      hasclears = 1;  /* table must be cleared */\r\n      if (valiswhite(gval(n)))  /* value not marked yet? */\r\n        prop = 1;  /* must propagate again */\r\n    }\r\n    else if (valiswhite(gval(n))) {  /* value not marked yet? */\r\n      marked = 1;\r\n      reallymarkobject(g, gcvalue(gval(n)));  /* mark it now */\r\n    }\r\n  }\r\n  if (prop)\r\n    linktable(h, &g->ephemeron);  /* have to propagate again */\r\n  else if (hasclears)  /* does table have white keys? */\r\n    linktable(h, &g->allweak);  /* may have to clean white keys */\r\n  else  /* no white keys */\r\n    linktable(h, &g->grayagain);  /* no need to clean */\r\n  return marked;\r\n}\r\n\r\n\r\nstatic void traversestrongtable (global_State *g, Table *h) {\r\n  Node *n, *limit = gnodelast(h);\r\n  int i;\r\n  for (i = 0; i < h->sizearray; i++)  /* traverse array part */\r\n    markvalue(g, &h->array[i]);\r\n  for (n = gnode(h, 0); n < limit; n++) {  /* traverse hash part */\r\n    checkdeadkey(n);\r\n    if (ttisnil(gval(n)))  /* entry is empty? */\r\n      removeentry(n);  /* remove it */\r\n    else {\r\n      lua_assert(!ttisnil(gkey(n)));\r\n      markvalue(g, gkey(n));  /* mark key */\r\n      markvalue(g, gval(n));  /* mark value */\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic int traversetable (global_State *g, Table *h) {\r\n  const TValue *mode = gfasttm(g, h->metatable, TM_MODE);\r\n  markobject(g, h->metatable);\r\n  if (mode && ttisstring(mode)) {  /* is there a weak mode? */\r\n    int weakkey = (strchr(svalue(mode), 'k') != NULL);\r\n    int weakvalue = (strchr(svalue(mode), 'v') != NULL);\r\n    if (weakkey || weakvalue) {  /* is really weak? */\r\n      black2gray(obj2gco(h));  /* keep table gray */\r\n      if (!weakkey) {  /* strong keys? */\r\n        traverseweakvalue(g, h);\r\n        return TRAVCOST + sizenode(h);\r\n      }\r\n      else if (!weakvalue) {  /* strong values? */\r\n        traverseephemeron(g, h);\r\n        return TRAVCOST + h->sizearray + sizenode(h);\r\n      }\r\n      else {\r\n        linktable(h, &g->allweak);  /* nothing to traverse now */\r\n        return TRAVCOST;\r\n      }\r\n    }  /* else go through */\r\n  }\r\n  traversestrongtable(g, h);\r\n  return TRAVCOST + h->sizearray + (2 * sizenode(h));\r\n}\r\n\r\n\r\nstatic int traverseproto (global_State *g, Proto *f) {\r\n  int i;\r\n  if (f->cache && iswhite(obj2gco(f->cache)))\r\n    f->cache = NULL;  /* allow cache to be collected */\r\n  stringmark(f->source);\r\n  for (i = 0; i < f->sizek; i++)  /* mark literals */\r\n    markvalue(g, &f->k[i]);\r\n  for (i = 0; i < f->sizeupvalues; i++)  /* mark upvalue names */\r\n    stringmark(f->upvalues[i].name);\r\n  for (i = 0; i < f->sizep; i++)  /* mark nested protos */\r\n    markobject(g, f->p[i]);\r\n  for (i = 0; i < f->sizelocvars; i++)  /* mark local-variable names */\r\n    stringmark(f->locvars[i].varname);\r\n  return TRAVCOST + f->sizek + f->sizeupvalues + f->sizep + f->sizelocvars;\r\n}\r\n\r\n\r\nstatic int traverseclosure (global_State *g, Closure *cl) {\r\n  if (cl->c.isC) {\r\n    int i;\r\n    for (i=0; i<cl->c.nupvalues; i++)  /* mark its upvalues */\r\n      markvalue(g, &cl->c.upvalue[i]);\r\n  }\r\n  else {\r\n    int i;\r\n    lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues);\r\n    markobject(g, cl->l.p);  /* mark its prototype */\r\n    for (i=0; i<cl->l.nupvalues; i++)  /* mark its upvalues */\r\n      markobject(g, cl->l.upvals[i]);\r\n  }\r\n  return TRAVCOST + cl->c.nupvalues;\r\n}\r\n\r\n\r\nstatic int traversestack (global_State *g, lua_State *L) {\r\n  StkId o = L->stack;\r\n  if (o == NULL)\r\n    return 1;  /* stack not completely built yet */\r\n  for (; o < L->top; o++)\r\n    markvalue(g, o);\r\n  if (g->gcstate == GCSatomic) {  /* final traversal? */\r\n    StkId lim = L->stack + L->stacksize;  /* real end of stack */\r\n    for (; o < lim; o++)  /* clear not-marked stack slice */\r\n      setnilvalue(o);\r\n  }\r\n  return TRAVCOST + cast_int(o - L->stack);\r\n}\r\n\r\n\r\n/*\r\n** traverse one gray object, turning it to black (except for threads,\r\n** which are always gray).\r\n** Returns number of values traversed.\r\n*/\r\nstatic int propagatemark (global_State *g) {\r\n  GCObject *o = g->gray;\r\n  lua_assert(isgray(o));\r\n  gray2black(o);\r\n  switch (gch(o)->tt) {\r\n    case LUA_TTABLE: {\r\n      Table *h = gco2t(o);\r\n      g->gray = h->gclist;\r\n      return traversetable(g, h);\r\n    }\r\n    case LUA_TFUNCTION: {\r\n      Closure *cl = gco2cl(o);\r\n      g->gray = cl->c.gclist;\r\n      return traverseclosure(g, cl);\r\n    }\r\n    case LUA_TTHREAD: {\r\n      lua_State *th = gco2th(o);\r\n      g->gray = th->gclist;\r\n      th->gclist = g->grayagain;\r\n      g->grayagain = o;\r\n      black2gray(o);\r\n      return traversestack(g, th);\r\n    }\r\n    case LUA_TPROTO: {\r\n      Proto *p = gco2p(o);\r\n      g->gray = p->gclist;\r\n      return traverseproto(g, p);\r\n    }\r\n    default: lua_assert(0); return 0;\r\n  }\r\n}\r\n\r\n\r\nstatic void propagateall (global_State *g) {\r\n  while (g->gray) propagatemark(g);\r\n}\r\n\r\n\r\nstatic void propagatelist (global_State *g, GCObject *l) {\r\n  lua_assert(g->gray == NULL);  /* no grays left */\r\n  g->gray = l;\r\n  propagateall(g);  /* traverse all elements from 'l' */\r\n}\r\n\r\n/*\r\n** retraverse all gray lists. Because tables may be reinserted in other\r\n** lists when traversed, traverse the original lists to avoid traversing\r\n** twice the same table (which is not wrong, but inefficient)\r\n*/\r\nstatic void retraversegrays (global_State *g) {\r\n  GCObject *weak = g->weak;  /* save original lists */\r\n  GCObject *grayagain = g->grayagain;\r\n  GCObject *ephemeron = g->ephemeron;\r\n  g->weak = g->grayagain = g->ephemeron = NULL;\r\n  propagateall(g);  /* traverse main gray list */\r\n  propagatelist(g, grayagain);\r\n  propagatelist(g, weak);\r\n  propagatelist(g, ephemeron);\r\n}\r\n\r\n\r\nstatic void convergeephemerons (global_State *g) {\r\n  int changed;\r\n  do {\r\n    GCObject *w;\r\n    GCObject *next = g->ephemeron;  /* get ephemeron list */\r\n    g->ephemeron = NULL;  /* tables will return to this list when traversed */\r\n    changed = 0;\r\n    while ((w = next) != NULL) {\r\n      next = gco2t(w)->gclist;\r\n      if (traverseephemeron(g, gco2t(w))) {  /* traverse marked some value? */\r\n        propagateall(g);  /* propagate changes */\r\n        changed = 1;  /* will have to revisit all ephemeron tables */\r\n      }\r\n    }\r\n  } while (changed);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Sweep Functions\r\n** =======================================================\r\n*/\r\n\r\n\r\n/*\r\n** clear entries with unmarked keys from all weaktables in list 'l' up\r\n** to element 'f'\r\n*/\r\nstatic void clearkeys (GCObject *l, GCObject *f) {\r\n  for (; l != f; l = gco2t(l)->gclist) {\r\n    Table *h = gco2t(l);\r\n    Node *n, *limit = gnodelast(h);\r\n    for (n = gnode(h, 0); n < limit; n++) {\r\n      if (!ttisnil(gval(n)) && (iscleared(gkey(n)))) {\r\n        setnilvalue(gval(n));  /* remove value ... */\r\n        removeentry(n);  /* and remove entry from table */\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** clear entries with unmarked values from all weaktables in list 'l' up\r\n** to element 'f'\r\n*/\r\nstatic void clearvalues (GCObject *l, GCObject *f) {\r\n  for (; l != f; l = gco2t(l)->gclist) {\r\n    Table *h = gco2t(l);\r\n    Node *n, *limit = gnodelast(h);\r\n    int i;\r\n    for (i = 0; i < h->sizearray; i++) {\r\n      TValue *o = &h->array[i];\r\n      if (iscleared(o))  /* value was collected? */\r\n        setnilvalue(o);  /* remove value */\r\n    }\r\n    for (n = gnode(h, 0); n < limit; n++) {\r\n      if (!ttisnil(gval(n)) && iscleared(gval(n))) {\r\n        setnilvalue(gval(n));  /* remove value ... */\r\n        removeentry(n);  /* and remove entry from table */\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void freeobj (lua_State *L, GCObject *o) {\r\n  switch (gch(o)->tt) {\r\n    case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;\r\n    case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break;\r\n    case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;\r\n    case LUA_TTABLE: luaH_free(L, gco2t(o)); break;\r\n    case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break;\r\n    case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;\r\n    case LUA_TSTRING: {\r\n      G(L)->strt.nuse--;\r\n      luaM_freemem(L, o, sizestring(gco2ts(o)));\r\n      break;\r\n    }\r\n    default: lua_assert(0);\r\n  }\r\n}\r\n\r\n\r\n#define sweepwholelist(L,p)\tsweeplist(L,p,MAX_LUMEM)\r\nstatic GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count);\r\n\r\n\r\n/*\r\n** sweep the (open) upvalues of a thread and resize its stack and\r\n** list of call-info structures.\r\n*/\r\nstatic void sweepthread (lua_State *L, lua_State *L1) {\r\n  if (L1->stack == NULL) return;  /* stack not completely built yet */\r\n  sweepwholelist(L, &L1->openupval);  /* sweep open upvalues */\r\n  luaE_freeCI(L1);  /* free extra CallInfo slots */\r\n  /* should not change the stack during an emergency gc cycle */\r\n  if (G(L)->gckind != KGC_EMERGENCY)\r\n    luaD_shrinkstack(L1);\r\n}\r\n\r\n\r\n/*\r\n** sweep at most 'count' elements from a list of GCObjects erasing dead\r\n** objects, where a dead (not alive) object is one marked with the \"old\"\r\n** (non current) white and not fixed.\r\n** In non-generational mode, change all non-dead objects back to white,\r\n** preparing for next collection cycle.\r\n** In generational mode, keep black objects black, and also mark them as\r\n** old; stop when hitting an old object, as all objects after that\r\n** one will be old too.\r\n** When object is a thread, sweep its list of open upvalues too.\r\n*/\r\nstatic GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {\r\n  global_State *g = G(L);\r\n  int ow = otherwhite(g);\r\n  int toclear, toset;  /* bits to clear and to set in all live objects */\r\n  int tostop;  /* stop sweep when this is true */\r\n  l_mem debt = g->GCdebt;  /* current debt */\r\n  if (isgenerational(g)) {  /* generational mode? */\r\n    toclear = ~0;  /* clear nothing */\r\n    toset = bitmask(OLDBIT);  /* set the old bit of all surviving objects */\r\n    tostop = bitmask(OLDBIT);  /* do not sweep old generation */\r\n  }\r\n  else {  /* normal mode */\r\n    toclear = maskcolors;  /* clear all color bits + old bit */\r\n    toset = luaC_white(g);  /* make object white */\r\n    tostop = 0;  /* do not stop */\r\n  }\r\n  while (*p != NULL && count-- > 0) {\r\n    GCObject *curr = *p;\r\n    int marked = gch(curr)->marked;\r\n    if (isdeadm(ow, marked)) {  /* is 'curr' dead? */\r\n      *p = gch(curr)->next;  /* remove 'curr' from list */\r\n      freeobj(L, curr);  /* erase 'curr' */\r\n    }\r\n    else {\r\n      if (gch(curr)->tt == LUA_TTHREAD)\r\n        sweepthread(L, gco2th(curr));  /* sweep thread's upvalues */\r\n      if (testbits(marked, tostop)) {\r\n        static GCObject *nullp = NULL;\r\n        p = &nullp;  /* stop sweeping this list */\r\n        break;\r\n      }\r\n      /* update marks */\r\n      gch(curr)->marked = cast_byte((marked & toclear) | toset);\r\n      p = &gch(curr)->next;  /* go to next element */\r\n    }\r\n  }\r\n  luaE_setdebt(g, debt);  /* sweeping should not change debt */\r\n  return p;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Finalization\r\n** =======================================================\r\n*/\r\n\r\nstatic void checkSizes (lua_State *L) {\r\n  global_State *g = G(L);\r\n  if (g->gckind != KGC_EMERGENCY) {  /* do not change sizes in emergency */\r\n    int hs = g->strt.size / 2;  /* half the size of the string table */\r\n    if (g->strt.nuse < cast(lu_int32, hs))  /* using less than that half? */\r\n      luaS_resize(L, hs);  /* halve its size */\r\n    luaZ_freebuffer(L, &g->buff);  /* free concatenation buffer */\r\n  }\r\n}\r\n\r\n\r\nstatic GCObject *udata2finalize (global_State *g) {\r\n  GCObject *o = g->tobefnz;  /* get first element */\r\n  lua_assert(isfinalized(o));\r\n  g->tobefnz = gch(o)->next;  /* remove it from 'tobefnz' list */\r\n  gch(o)->next = g->allgc;  /* return it to 'allgc' list */\r\n  g->allgc = o;\r\n  resetbit(gch(o)->marked, SEPARATED);  /* mark that it is not in 'tobefnz' */\r\n  lua_assert(!isold(o));  /* see MOVE OLD rule */\r\n  if (!keepinvariant(g))  /* not keeping invariant? */\r\n    makewhite(g, o);  /* \"sweep\" object */\r\n  return o;\r\n}\r\n\r\n\r\nstatic void dothecall (lua_State *L, void *ud) {\r\n  UNUSED(ud);\r\n  luaD_call(L, L->top - 2, 0, 0);\r\n}\r\n\r\n\r\nstatic void GCTM (lua_State *L, int propagateerrors) {\r\n  global_State *g = G(L);\r\n  const TValue *tm;\r\n  TValue v;\r\n  setgcovalue(L, &v, udata2finalize(g));\r\n  tm = luaT_gettmbyobj(L, &v, TM_GC);\r\n  if (tm != NULL && ttisfunction(tm)) {  /* is there a finalizer? */\r\n    int status;\r\n    lu_byte oldah = L->allowhook;\r\n    int running  = g->gcrunning;\r\n    L->allowhook = 0;  /* stop debug hooks during GC metamethod */\r\n    g->gcrunning = 0;  /* avoid GC steps */\r\n    setobj2s(L, L->top, tm);  /* push finalizer... */\r\n    setobj2s(L, L->top + 1, &v);  /* ... and its argument */\r\n    L->top += 2;  /* and (next line) call the finalizer */\r\n    status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);\r\n    L->allowhook = oldah;  /* restore hooks */\r\n    g->gcrunning = running;  /* restore state */\r\n    if (status != LUA_OK && propagateerrors) {  /* error while running __gc? */\r\n      if (status == LUA_ERRRUN) {  /* is there an error msg.? */\r\n        luaO_pushfstring(L, \"error in __gc metamethod (%s)\",\r\n                                        lua_tostring(L, -1));\r\n        status = LUA_ERRGCMM;  /* error in __gc metamethod */\r\n      }\r\n      luaD_throw(L, status);  /* re-send error */\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** move all unreachable objects (or 'all' objects) that need\r\n** finalization from list 'finobj' to list 'tobefnz' (to be finalized)\r\n*/\r\nstatic void separatetobefnz (lua_State *L, int all) {\r\n  global_State *g = G(L);\r\n  GCObject **p = &g->finobj;\r\n  GCObject *curr;\r\n  GCObject **lastnext = &g->tobefnz;\r\n  /* find last 'next' field in 'tobefnz' list (to add elements in its end) */\r\n  while (*lastnext != NULL)\r\n    lastnext = &gch(*lastnext)->next;\r\n  while ((curr = *p) != NULL) {  /* traverse all finalizable objects */\r\n    lua_assert(!isfinalized(curr));\r\n    lua_assert(testbit(gch(curr)->marked, SEPARATED));\r\n    if (!(all || iswhite(curr)))  /* not being collected? */\r\n      p = &gch(curr)->next;  /* don't bother with it */\r\n    else {\r\n      l_setbit(gch(curr)->marked, FINALIZEDBIT); /* won't be finalized again */\r\n      *p = gch(curr)->next;  /* remove 'curr' from 'finobj' list */\r\n      gch(curr)->next = *lastnext;  /* link at the end of 'tobefnz' list */\r\n      *lastnext = curr;\r\n      lastnext = &gch(curr)->next;\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** if object 'o' has a finalizer, remove it from 'allgc' list (must\r\n** search the list to find it) and link it in 'finobj' list.\r\n*/\r\nvoid luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {\r\n  global_State *g = G(L);\r\n  if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */\r\n      isfinalized(o) ||                           /* ... or is finalized... */\r\n      gfasttm(g, mt, TM_GC) == NULL)                /* or has no finalizer? */\r\n    return;  /* nothing to be done */\r\n  else {  /* move 'o' to 'finobj' list */\r\n    GCObject **p;\r\n    for (p = &g->allgc; *p != o; p = &gch(*p)->next) ;\r\n    *p = gch(o)->next;  /* remove 'o' from root list */\r\n    gch(o)->next = g->finobj;  /* link it in list 'finobj' */\r\n    g->finobj = o;\r\n    l_setbit(gch(o)->marked, SEPARATED);  /* mark it as such */\r\n    resetoldbit(o);  /* see MOVE OLD rule */\r\n  }\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** GC control\r\n** =======================================================\r\n*/\r\n\r\n\r\n#define sweepphases  \\\r\n\t(bitmask(GCSsweepstring) | bitmask(GCSsweepudata) | bitmask(GCSsweep))\r\n\r\n/*\r\n** change GC mode\r\n*/\r\nvoid luaC_changemode (lua_State *L, int mode) {\r\n  global_State *g = G(L);\r\n  if (mode == g->gckind) return;  /* nothing to change */\r\n  if (mode == KGC_GEN) {  /* change to generational mode */\r\n    /* make sure gray lists are consistent */\r\n    luaC_runtilstate(L, bitmask(GCSpropagate));\r\n    g->lastmajormem = gettotalbytes(g);\r\n    g->gckind = KGC_GEN;\r\n  }\r\n  else {  /* change to incremental mode */\r\n    /* sweep all objects to turn them back to white\r\n       (as white has not changed, nothing extra will be collected) */\r\n    g->sweepstrgc = 0;\r\n    g->gcstate = GCSsweepstring;\r\n    g->gckind = KGC_NORMAL;\r\n    luaC_runtilstate(L, ~sweepphases);\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** call all pending finalizers\r\n*/\r\nstatic void callallpendingfinalizers (lua_State *L, int propagateerrors) {\r\n  global_State *g = G(L);\r\n  while (g->tobefnz) {\r\n    resetoldbit(g->tobefnz);\r\n    GCTM(L, propagateerrors);\r\n  }\r\n}\r\n\r\n\r\nvoid luaC_freeallobjects (lua_State *L) {\r\n  global_State *g = G(L);\r\n  int i;\r\n  separatetobefnz(L, 1);  /* separate all objects with finalizers */\r\n  lua_assert(g->finobj == NULL);\r\n  callallpendingfinalizers(L, 0);\r\n  g->currentwhite = WHITEBITS; /* this \"white\" makes all objects look dead */\r\n  g->gckind = KGC_NORMAL;\r\n  sweepwholelist(L, &g->finobj);  /* finalizers can create objs. in 'finobj' */\r\n  sweepwholelist(L, &g->allgc);\r\n  for (i = 0; i < g->strt.size; i++)  /* free all string lists */\r\n    sweepwholelist(L, &g->strt.hash[i]);\r\n  lua_assert(g->strt.nuse == 0);\r\n}\r\n\r\n\r\nstatic void atomic (lua_State *L) {\r\n  global_State *g = G(L);\r\n  GCObject *origweak, *origall;\r\n  lua_assert(!iswhite(obj2gco(g->mainthread)));\r\n  markobject(g, L);  /* mark running thread */\r\n  /* registry and global metatables may be changed by API */\r\n  markvalue(g, &g->l_registry);\r\n  markmt(g);  /* mark basic metatables */\r\n  /* remark occasional upvalues of (maybe) dead threads */\r\n  remarkupvals(g);\r\n  /* traverse objects caught by write barrier and by 'remarkupvals' */\r\n  retraversegrays(g);\r\n  convergeephemerons(g);\r\n  /* at this point, all strongly accessible objects are marked. */\r\n  /* clear values from weak tables, before checking finalizers */\r\n  clearvalues(g->weak, NULL);\r\n  clearvalues(g->allweak, NULL);\r\n  origweak = g->weak; origall = g->allweak;\r\n  separatetobefnz(L, 0);  /* separate objects to be finalized */\r\n  markbeingfnz(g);  /* mark userdata that will be finalized */\r\n  propagateall(g);  /* remark, to propagate `preserveness' */\r\n  convergeephemerons(g);\r\n  /* at this point, all resurrected objects are marked. */\r\n  /* remove dead objects from weak tables */\r\n  clearkeys(g->ephemeron, NULL);  /* clear keys from all ephemeron tables */\r\n  clearkeys(g->allweak, NULL);  /* clear keys from all allweak tables */\r\n  /* clear values from resurrected weak tables */\r\n  clearvalues(g->weak, origweak);\r\n  clearvalues(g->allweak, origall);\r\n  g->sweepstrgc = 0;  /* prepare to sweep strings */\r\n  g->gcstate = GCSsweepstring;\r\n  g->currentwhite = cast_byte(otherwhite(g));  /* flip current white */\r\n  /*lua_checkmemory(L);*/\r\n}\r\n\r\n\r\nstatic l_mem singlestep (lua_State *L) {\r\n  global_State *g = G(L);\r\n  switch (g->gcstate) {\r\n    case GCSpause: {\r\n      if (!isgenerational(g))\r\n        markroot(g);  /* start a new collection */\r\n      /* in any case, root must be marked */\r\n      lua_assert(!iswhite(obj2gco(g->mainthread))\r\n              && !iswhite(gcvalue(&g->l_registry)));\r\n      g->gcstate = GCSpropagate;\r\n      return GCROOTCOST;\r\n    }\r\n    case GCSpropagate: {\r\n      if (g->gray)\r\n        return propagatemark(g);\r\n      else {  /* no more `gray' objects */\r\n        g->gcstate = GCSatomic;  /* finish mark phase */\r\n        atomic(L);\r\n        return GCATOMICCOST;\r\n      }\r\n    }\r\n    case GCSsweepstring: {\r\n      if (g->sweepstrgc < g->strt.size) {\r\n        sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]);\r\n        return GCSWEEPCOST;\r\n      }\r\n      else {  /* no more strings to sweep */\r\n        g->sweepgc = &g->finobj;  /* prepare to sweep finalizable objects */\r\n        g->gcstate = GCSsweepudata;\r\n        return 0;\r\n      }\r\n    }\r\n    case GCSsweepudata: {\r\n      if (*g->sweepgc) {\r\n        g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);\r\n        return GCSWEEPMAX*GCSWEEPCOST;\r\n      }\r\n      else {\r\n        g->sweepgc = &g->allgc;  /* go to next phase */\r\n        g->gcstate = GCSsweep;\r\n        return GCSWEEPCOST;\r\n      }\r\n    }\r\n    case GCSsweep: {\r\n      if (*g->sweepgc) {\r\n        g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);\r\n        return GCSWEEPMAX*GCSWEEPCOST;\r\n      }\r\n      else {\r\n        /* sweep main thread */\r\n        GCObject *mt = obj2gco(g->mainthread);\r\n        sweeplist(L, &mt, 1);\r\n        checkSizes(L);\r\n        g->gcstate = GCSpause;  /* finish collection */\r\n        return GCSWEEPCOST;\r\n      }\r\n    }\r\n    default: lua_assert(0); return 0;\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** advances the garbage collector until it reaches a state allowed\r\n** by 'statemask'\r\n*/\r\nvoid luaC_runtilstate (lua_State *L, int statesmask) {\r\n  global_State *g = G(L);\r\n  while (!testbit(statesmask, g->gcstate))\r\n    singlestep(L);\r\n}\r\n\r\n\r\nstatic void generationalcollection (lua_State *L) {\r\n  global_State *g = G(L);\r\n  if (g->lastmajormem == 0) {  /* signal for another major collection? */\r\n    luaC_fullgc(L, 0);  /* perform a full regular collection */\r\n    g->lastmajormem = gettotalbytes(g);  /* update control */\r\n  }\r\n  else {\r\n    luaC_runtilstate(L, ~bitmask(GCSpause));  /* run complete cycle */\r\n    luaC_runtilstate(L, bitmask(GCSpause));\r\n    if (gettotalbytes(g) > g->lastmajormem/100 * g->gcmajorinc)\r\n      g->lastmajormem = 0;  /* signal for a major collection */\r\n  }\r\n  luaE_setdebt(g, stddebt(g));\r\n}\r\n\r\n\r\nstatic void step (lua_State *L) {\r\n  global_State *g = G(L);\r\n  l_mem lim = g->gcstepmul;  /* how much to work */\r\n  do {  /* always perform at least one single step */\r\n    lim -= singlestep(L);\r\n  } while (lim > 0 && g->gcstate != GCSpause);\r\n  if (g->gcstate != GCSpause)\r\n    luaE_setdebt(g, g->GCdebt - GCSTEPSIZE);\r\n  else\r\n    luaE_setdebt(g, stddebt(g));\r\n}\r\n\r\n\r\n/*\r\n** performs a basic GC step even if the collector is stopped\r\n*/\r\nvoid luaC_forcestep (lua_State *L) {\r\n  global_State *g = G(L);\r\n  int i;\r\n  if (isgenerational(g)) generationalcollection(L);\r\n  else step(L);\r\n  for (i = 0; i < GCFINALIZENUM && g->tobefnz; i++)\r\n    GCTM(L, 1);  /* Call a few pending finalizers */\r\n}\r\n\r\n\r\n/*\r\n** performs a basic GC step only if collector is running\r\n*/\r\nvoid luaC_step (lua_State *L) {\r\n  if (G(L)->gcrunning) luaC_forcestep(L);\r\n}\r\n\r\n\r\n/*\r\n** performs a full GC cycle; if \"isemergency\", does not call\r\n** finalizers (which could change stack positions)\r\n*/\r\nvoid luaC_fullgc (lua_State *L, int isemergency) {\r\n  global_State *g = G(L);\r\n  int origkind = g->gckind;\r\n  lua_assert(origkind != KGC_EMERGENCY);\r\n  if (!isemergency)   /* do not run finalizers during emergency GC */\r\n    callallpendingfinalizers(L, 1);\r\n  if (keepinvariant(g)) {  /* marking phase? */\r\n    /* must sweep all objects to turn them back to white\r\n       (as white has not changed, nothing will be collected) */\r\n    g->sweepstrgc = 0;\r\n    g->gcstate = GCSsweepstring;\r\n  }\r\n  g->gckind = isemergency ? KGC_EMERGENCY : KGC_NORMAL;\r\n  /* finish any pending sweep phase to start a new cycle */\r\n  luaC_runtilstate(L, bitmask(GCSpause));\r\n  /* run entire collector */\r\n  luaC_runtilstate(L, ~bitmask(GCSpause));\r\n  luaC_runtilstate(L, bitmask(GCSpause));\r\n  if (origkind == KGC_GEN) {  /* generational mode? */\r\n    /* generational mode must always start in propagate phase */\r\n    luaC_runtilstate(L, bitmask(GCSpropagate));\r\n  }\r\n  g->gckind = origkind;\r\n  luaE_setdebt(g, stddebt(g));\r\n  if (!isemergency)   /* do not run finalizers during emergency GC */\r\n    callallpendingfinalizers(L, 1);\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lgc.h",
    "content": "/*\r\n** $Id: lgc.h,v 2.52 2011/10/03 17:54:25 roberto Exp $\r\n** Garbage Collector\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lgc_h\r\n#define lgc_h\r\n\r\n\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n\r\n/*\r\n** Collectable objects may have one of three colors: white, which\r\n** means the object is not marked; gray, which means the\r\n** object is marked, but its references may be not marked; and\r\n** black, which means that the object and all its references are marked.\r\n** The main invariant of the garbage collector, while marking objects,\r\n** is that a black object can never point to a white one. Moreover,\r\n** any gray object must be in a \"gray list\" (gray, grayagain, weak,\r\n** allweak, ephemeron) so that it can be visited again before finishing\r\n** the collection cycle. These lists have no meaning when the invariant\r\n** is not being enforced (e.g., sweep phase).\r\n*/\r\n\r\n\r\n/*\r\n** Possible states of the Garbage Collector\r\n*/\r\n#define GCSpropagate\t0\r\n#define GCSatomic\t1\r\n#define GCSsweepstring\t2\r\n#define GCSsweepudata\t3\r\n#define GCSsweep\t4\r\n#define GCSpause\t5\r\n\r\n\r\n#define issweepphase(g)  \\\r\n\t(GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)\r\n\r\n#define isgenerational(g)\t((g)->gckind == KGC_GEN)\r\n\r\n/*\r\n** macro to tell when main invariant (white objects cannot point to black\r\n** ones) must be kept. During a non-generational collection, the sweep\r\n** phase may break the invariant, as objects turned white may point to\r\n** still-black objects. The invariant is restored when sweep ends and\r\n** all objects are white again. During a generational collection, the\r\n** invariant must be kept all times.\r\n*/\r\n#define keepinvariant(g)  (isgenerational(g) || g->gcstate <= GCSatomic)\r\n\r\n\r\n/*\r\n** some useful bit tricks\r\n*/\r\n#define resetbits(x,m)\t\t((x) &= cast(lu_byte, ~(m)))\r\n#define setbits(x,m)\t\t((x) |= (m))\r\n#define testbits(x,m)\t\t((x) & (m))\r\n#define bitmask(b)\t\t(1<<(b))\r\n#define bit2mask(b1,b2)\t\t(bitmask(b1) | bitmask(b2))\r\n#define l_setbit(x,b)\t\tsetbits(x, bitmask(b))\r\n#define resetbit(x,b)\t\tresetbits(x, bitmask(b))\r\n#define testbit(x,b)\t\ttestbits(x, bitmask(b))\r\n\r\n\r\n/* Layout for bit use in `marked' field: */\r\n#define WHITE0BIT\t0  /* object is white (type 0) */\r\n#define WHITE1BIT\t1  /* object is white (type 1) */\r\n#define BLACKBIT\t2  /* object is black */\r\n#define FINALIZEDBIT\t3  /* object has been separated for finalization */\r\n#define SEPARATED\t4  /* object is in 'finobj' list or in 'tobefnz' */\r\n#define FIXEDBIT\t5  /* object is fixed (should not be collected) */\r\n#define OLDBIT\t\t6  /* object is old (only in generational mode) */\r\n/* bit 7 is currently used by tests (luaL_checkmemory) */\r\n\r\n#define WHITEBITS\tbit2mask(WHITE0BIT, WHITE1BIT)\r\n\r\n\r\n#define iswhite(x)      testbits((x)->gch.marked, WHITEBITS)\r\n#define isblack(x)      testbit((x)->gch.marked, BLACKBIT)\r\n#define isgray(x)  /* neither white nor black */  \\\r\n\t(!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))\r\n\r\n#define isold(x)\ttestbit((x)->gch.marked, OLDBIT)\r\n\r\n/* MOVE OLD rule: whenever an object is moved to the beginning of\r\n   a GC list, its old bit must be cleared */\r\n#define resetoldbit(o)\tresetbit((o)->gch.marked, OLDBIT)\r\n\r\n#define otherwhite(g)\t(g->currentwhite ^ WHITEBITS)\r\n#define isdeadm(ow,m)\t(!(((m) ^ WHITEBITS) & (ow)))\r\n#define isdead(g,v)\tisdeadm(otherwhite(g), (v)->gch.marked)\r\n\r\n#define changewhite(x)\t((x)->gch.marked ^= WHITEBITS)\r\n#define gray2black(x)\tl_setbit((x)->gch.marked, BLACKBIT)\r\n\r\n#define valiswhite(x)\t(iscollectable(x) && iswhite(gcvalue(x)))\r\n\r\n#define luaC_white(g)\tcast(lu_byte, (g)->currentwhite & WHITEBITS)\r\n\r\n\r\n#define luaC_condGC(L,c) \\\r\n\t{if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}\r\n#define luaC_checkGC(L)\t\tluaC_condGC(L, luaC_step(L);)\r\n\r\n\r\n#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p)))  \\\r\n\tluaC_barrier_(L,obj2gco(p),gcvalue(v)); }\r\n\r\n#define luaC_barrierback(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p)))  \\\r\n\tluaC_barrierback_(L,p); }\r\n\r\n#define luaC_objbarrier(L,p,o)  \\\r\n\t{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \\\r\n\t\tluaC_barrier_(L,obj2gco(p),obj2gco(o)); }\r\n\r\n#define luaC_objbarrierback(L,p,o)  \\\r\n   { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); }\r\n\r\n#define luaC_barrierproto(L,p,c) \\\r\n   { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); }\r\n\r\nLUAI_FUNC void luaC_freeallobjects (lua_State *L);\r\nLUAI_FUNC void luaC_step (lua_State *L);\r\nLUAI_FUNC void luaC_forcestep (lua_State *L);\r\nLUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask);\r\nLUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency);\r\nLUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz,\r\n                                 GCObject **list, int offset);\r\nLUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v);\r\nLUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o);\r\nLUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c);\r\nLUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt);\r\nLUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv);\r\nLUAI_FUNC void luaC_changemode (lua_State *L, int mode);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/linit.c",
    "content": "/*\r\n** $Id: linit.c,v 1.32 2011/04/08 19:17:36 roberto Exp $\r\n** Initialization of libraries for lua.c and other clients\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n/*\r\n** If you embed Lua in your program and need to open the standard\r\n** libraries, call luaL_openlibs in your program. If you need a\r\n** different set of libraries, copy this file to your project and edit\r\n** it to suit your needs.\r\n*/\r\n\r\n\r\n#define linit_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lualib.h\"\r\n#include \"lauxlib.h\"\r\n\r\n\r\n/*\r\n** these libs are loaded by lua.c and are readily available to any Lua\r\n** program\r\n*/\r\nstatic const luaL_Reg loadedlibs[] = {\r\n  {\"_G\", luaopen_base},\r\n  {LUA_LOADLIBNAME, luaopen_package},\r\n  {LUA_COLIBNAME, luaopen_coroutine},\r\n  {LUA_TABLIBNAME, luaopen_table},\r\n  {LUA_IOLIBNAME, luaopen_io},\r\n  {LUA_OSLIBNAME, luaopen_os},\r\n  {LUA_STRLIBNAME, luaopen_string},\r\n  {LUA_BITLIBNAME, luaopen_bit32},\r\n  {LUA_MATHLIBNAME, luaopen_math},\r\n  {LUA_DBLIBNAME, luaopen_debug},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\n/*\r\n** these libs are preloaded and must be required before used\r\n*/\r\nstatic const luaL_Reg preloadedlibs[] = {\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nLUALIB_API void luaL_openlibs (lua_State *L) {\r\n  const luaL_Reg *lib;\r\n  /* call open functions from 'loadedlibs' and set results to global table */\r\n  for (lib = loadedlibs; lib->func; lib++) {\r\n    luaL_requiref(L, lib->name, lib->func, 1);\r\n    lua_pop(L, 1);  /* remove lib */\r\n  }\r\n  /* add open functions from 'preloadedlibs' into 'package.preload' table */\r\n  luaL_getsubtable(L, LUA_REGISTRYINDEX, \"_PRELOAD\");\r\n  for (lib = preloadedlibs; lib->func; lib++) {\r\n    lua_pushcfunction(L, lib->func);\r\n    lua_setfield(L, -2, lib->name);\r\n  }\r\n  lua_pop(L, 1);  /* remove _PRELOAD table */\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/liolib.c",
    "content": "/*\r\n** $Id: liolib.c,v 2.108 2011/11/25 12:50:03 roberto Exp $\r\n** Standard I/O (and system) library\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n/*\r\n** POSIX idiosyncrasy!\r\n** This definition must come before the inclusion of 'stdio.h'; it\r\n** should not affect non-POSIX systems\r\n*/\r\n#if !defined(_FILE_OFFSET_BITS)\r\n#define _FILE_OFFSET_BITS 64\r\n#endif\r\n\r\n\r\n#include <errno.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define liolib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** lua_popen spawns a new process connected to the current\r\n** one through the file streams.\r\n** =======================================================\r\n*/\r\n\r\n#if !defined(lua_popen)\t/* { */\r\n\r\n#if defined(LUA_USE_POPEN)\t/* { */\r\n\r\n#define lua_popen(L,c,m)\t((void)L, fflush(NULL), popen(c,m))\r\n#define lua_pclose(L,file)\t((void)L, pclose(file))\r\n\r\n#elif defined(LUA_WIN)\t\t/* }{ */\r\n\r\n#define lua_popen(L,c,m)\t\t((void)L, _popen(c,m))\r\n#define lua_pclose(L,file)\t\t((void)L, _pclose(file))\r\n\r\n\r\n#else\t\t\t\t/* }{ */\r\n\r\n#define lua_popen(L,c,m)\t\t((void)((void)c, m),  \\\r\n\t\tluaL_error(L, LUA_QL(\"popen\") \" not supported\"), (FILE*)0)\r\n#define lua_pclose(L,file)\t\t((void)((void)L, file), -1)\r\n\r\n\r\n#endif\t\t\t\t/* } */\r\n\r\n#endif\t\t\t/* } */\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/*\r\n** {======================================================\r\n** lua_fseek/lua_ftell: configuration for longer offsets\r\n** =======================================================\r\n*/\r\n\r\n#if !defined(lua_fseek)\t/* { */\r\n\r\n#if defined(LUA_USE_POSIX)\r\n\r\n#define l_fseek(f,o,w)\t\tfseeko(f,o,w)\r\n#define l_ftell(f)\t\tftello(f)\r\n#define l_seeknum\t\toff_t\r\n\r\n#elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \\\r\n   && defined(_MSC_VER) && (_MSC_VER >= 1400)\r\n/* Windows (but not DDK) and Visual C++ 2005 or higher */\r\n\r\n#define l_fseek(f,o,w)\t\t_fseeki64(f,o,w)\r\n#define l_ftell(f)\t\t_ftelli64(f)\r\n#define l_seeknum\t\t__int64\r\n\r\n#else\r\n\r\n#define l_fseek(f,o,w)\t\tfseek(f,o,w)\r\n#define l_ftell(f)\t\tftell(f)\r\n#define l_seeknum\t\tlong\r\n\r\n#endif\r\n\r\n#endif\t\t\t/* } */\r\n\r\n/* }====================================================== */\r\n\r\n\r\n#define IO_PREFIX\t\"_IO_\"\r\n#define IO_INPUT\t(IO_PREFIX \"input\")\r\n#define IO_OUTPUT\t(IO_PREFIX \"output\")\r\n\r\n\r\ntypedef luaL_Stream LStream;\r\n\r\n\r\n#define tolstream(L)\t((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))\r\n\r\n#define isclosed(p)\t((p)->closef == NULL)\r\n\r\n\r\nstatic int io_type (lua_State *L) {\r\n  LStream *p;\r\n  luaL_checkany(L, 1);\r\n  p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE);\r\n  if (p == NULL)\r\n    lua_pushnil(L);  /* not a file */\r\n  else if (isclosed(p))\r\n    lua_pushliteral(L, \"closed file\");\r\n  else\r\n    lua_pushliteral(L, \"file\");\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int f_tostring (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  if (isclosed(p))\r\n    lua_pushliteral(L, \"file (closed)\");\r\n  else\r\n    lua_pushfstring(L, \"file (%p)\", p->f);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic FILE *tofile (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  if (isclosed(p))\r\n    luaL_error(L, \"attempt to use a closed file\");\r\n  lua_assert(p->f);\r\n  return p->f;\r\n}\r\n\r\n\r\n/*\r\n** When creating file handles, always creates a `closed' file handle\r\n** before opening the actual file; so, if there is a memory error, the\r\n** file is not left opened.\r\n*/\r\nstatic LStream *newprefile (lua_State *L) {\r\n  LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream));\r\n  p->closef = NULL;  /* mark file handle as 'closed' */\r\n  luaL_setmetatable(L, LUA_FILEHANDLE);\r\n  return p;\r\n}\r\n\r\n\r\nstatic int aux_close (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  lua_CFunction cf = p->closef;\r\n  p->closef = NULL;  /* mark stream as closed */\r\n  return (*cf)(L);  /* close it */\r\n}\r\n\r\n\r\nstatic int io_close (lua_State *L) {\r\n  if (lua_isnone(L, 1))  /* no argument? */\r\n    lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT);  /* use standard output */\r\n  tofile(L);  /* make sure argument is an open stream */\r\n  return aux_close(L);\r\n}\r\n\r\n\r\nstatic int f_gc (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  if (!isclosed(p) && p->f != NULL)\r\n    aux_close(L);  /* ignore closed and incompletely open files */\r\n  return 0;\r\n}\r\n\r\n\r\n/*\r\n** function to close regular files\r\n*/\r\nstatic int io_fclose (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  int res = fclose(p->f);\r\n  return luaL_fileresult(L, (res == 0), NULL);\r\n}\r\n\r\n\r\nstatic LStream *newfile (lua_State *L) {\r\n  LStream *p = newprefile(L);\r\n  p->f = NULL;\r\n  p->closef = &io_fclose;\r\n  return p;\r\n}\r\n\r\n\r\nstatic void opencheck (lua_State *L, const char *fname, const char *mode) {\r\n  LStream *p = newfile(L);\r\n  p->f = fopen(fname, mode);\r\n  if (p->f == NULL)\r\n    luaL_error(L, \"cannot open file \" LUA_QS \" (%s)\", fname, strerror(errno));\r\n}\r\n\r\n\r\nstatic int io_open (lua_State *L) {\r\n  const char *filename = luaL_checkstring(L, 1);\r\n  const char *mode = luaL_optstring(L, 2, \"r\");\r\n  LStream *p = newfile(L);\r\n  int i = 0;\r\n  /* check whether 'mode' matches '[rwa]%+?b?' */\r\n  if (!(mode[i] != '\\0' && strchr(\"rwa\", mode[i++]) != NULL &&\r\n       (mode[i] != '+' || ++i) &&  /* skip if char is '+' */\r\n       (mode[i] != 'b' || ++i) &&  /* skip if char is 'b' */\r\n       (mode[i] == '\\0')))\r\n    return luaL_error(L, \"invalid mode \" LUA_QS\r\n                         \" (should match \" LUA_QL(\"[rwa]%%+?b?\") \")\", mode);\r\n  p->f = fopen(filename, mode);\r\n  return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;\r\n}\r\n\r\n\r\n/*\r\n** function to close 'popen' files\r\n*/\r\nstatic int io_pclose (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  return luaL_execresult(L, lua_pclose(L, p->f));\r\n}\r\n\r\n\r\nstatic int io_popen (lua_State *L) {\r\n  const char *filename = luaL_checkstring(L, 1);\r\n  const char *mode = luaL_optstring(L, 2, \"r\");\r\n  LStream *p = newprefile(L);\r\n  p->f = lua_popen(L, filename, mode);\r\n  p->closef = &io_pclose;\r\n  return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;\r\n}\r\n\r\n\r\nstatic int io_tmpfile (lua_State *L) {\r\n  LStream *p = newfile(L);\r\n  p->f = tmpfile();\r\n  return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1;\r\n}\r\n\r\n\r\nstatic FILE *getiofile (lua_State *L, const char *findex) {\r\n  LStream *p;\r\n  lua_getfield(L, LUA_REGISTRYINDEX, findex);\r\n  p = (LStream *)lua_touserdata(L, -1);\r\n  if (isclosed(p))\r\n    luaL_error(L, \"standard %s file is closed\", findex + strlen(IO_PREFIX));\r\n  return p->f;\r\n}\r\n\r\n\r\nstatic int g_iofile (lua_State *L, const char *f, const char *mode) {\r\n  if (!lua_isnoneornil(L, 1)) {\r\n    const char *filename = lua_tostring(L, 1);\r\n    if (filename)\r\n      opencheck(L, filename, mode);\r\n    else {\r\n      tofile(L);  /* check that it's a valid file handle */\r\n      lua_pushvalue(L, 1);\r\n    }\r\n    lua_setfield(L, LUA_REGISTRYINDEX, f);\r\n  }\r\n  /* return current value */\r\n  lua_getfield(L, LUA_REGISTRYINDEX, f);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int io_input (lua_State *L) {\r\n  return g_iofile(L, IO_INPUT, \"r\");\r\n}\r\n\r\n\r\nstatic int io_output (lua_State *L) {\r\n  return g_iofile(L, IO_OUTPUT, \"w\");\r\n}\r\n\r\n\r\nstatic int io_readline (lua_State *L);\r\n\r\n\r\nstatic void aux_lines (lua_State *L, int toclose) {\r\n  int i;\r\n  int n = lua_gettop(L) - 1;  /* number of arguments to read */\r\n  /* ensure that arguments will fit here and into 'io_readline' stack */\r\n  luaL_argcheck(L, n <= LUA_MINSTACK - 3, LUA_MINSTACK - 3, \"too many options\");\r\n  lua_pushvalue(L, 1);  /* file handle */\r\n  lua_pushinteger(L, n);  /* number of arguments to read */\r\n  lua_pushboolean(L, toclose);  /* close/not close file when finished */\r\n  for (i = 1; i <= n; i++) lua_pushvalue(L, i + 1);  /* copy arguments */\r\n  lua_pushcclosure(L, io_readline, 3 + n);\r\n}\r\n\r\n\r\nstatic int f_lines (lua_State *L) {\r\n  tofile(L);  /* check that it's a valid file handle */\r\n  aux_lines(L, 0);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int io_lines (lua_State *L) {\r\n  int toclose;\r\n  if (lua_isnone(L, 1)) lua_pushnil(L);  /* at least one argument */\r\n  if (lua_isnil(L, 1)) {  /* no file name? */\r\n    lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT);  /* get default input */\r\n    lua_replace(L, 1);  /* put it at index 1 */\r\n    tofile(L);  /* check that it's a valid file handle */\r\n    toclose = 0;  /* do not close it after iteration */\r\n  }\r\n  else {  /* open a new file */\r\n    const char *filename = luaL_checkstring(L, 1);\r\n    opencheck(L, filename, \"r\");\r\n    lua_replace(L, 1);  /* put file at index 1 */\r\n    toclose = 1;  /* close it after iteration */\r\n  }\r\n  aux_lines(L, toclose);\r\n  return 1;\r\n}\r\n\r\n\r\n/*\r\n** {======================================================\r\n** READ\r\n** =======================================================\r\n*/\r\n\r\n\r\nstatic int read_number (lua_State *L, FILE *f) {\r\n  lua_Number d;\r\n  if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {\r\n    lua_pushnumber(L, d);\r\n    return 1;\r\n  }\r\n  else {\r\n   lua_pushnil(L);  /* \"result\" to be removed */\r\n   return 0;  /* read fails */\r\n  }\r\n}\r\n\r\n\r\nstatic int test_eof (lua_State *L, FILE *f) {\r\n  int c = getc(f);\r\n  ungetc(c, f);\r\n  lua_pushlstring(L, NULL, 0);\r\n  return (c != EOF);\r\n}\r\n\r\n\r\nstatic int read_line (lua_State *L, FILE *f, int chop) {\r\n  luaL_Buffer b;\r\n  luaL_buffinit(L, &b);\r\n  for (;;) {\r\n    size_t l;\r\n    char *p = luaL_prepbuffer(&b);\r\n    if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) {  /* eof? */\r\n      luaL_pushresult(&b);  /* close buffer */\r\n      return (lua_rawlen(L, -1) > 0);  /* check whether read something */\r\n    }\r\n    l = strlen(p);\r\n    if (l == 0 || p[l-1] != '\\n')\r\n      luaL_addsize(&b, l);\r\n    else {\r\n      luaL_addsize(&b, l - chop);  /* chop 'eol' if needed */\r\n      luaL_pushresult(&b);  /* close buffer */\r\n      return 1;  /* read at least an `eol' */\r\n    }\r\n  }\r\n}\r\n\r\n\r\n#define MAX_SIZE_T\t(~(size_t)0)\r\n\r\nstatic void read_all (lua_State *L, FILE *f) {\r\n  size_t rlen = LUAL_BUFFERSIZE;  /* how much to read in each cycle */\r\n  luaL_Buffer b;\r\n  luaL_buffinit(L, &b);\r\n  for (;;) {\r\n    char *p = luaL_prepbuffsize(&b, rlen);\r\n    size_t nr = fread(p, sizeof(char), rlen, f);\r\n    luaL_addsize(&b, nr);\r\n    if (nr < rlen) break;  /* eof? */\r\n    else if (rlen <= (MAX_SIZE_T / 4))  /* avoid buffers too large */\r\n      rlen *= 2;  /* double buffer size at each iteration */\r\n  }\r\n  luaL_pushresult(&b);  /* close buffer */\r\n}\r\n\r\n\r\nstatic int read_chars (lua_State *L, FILE *f, size_t n) {\r\n  size_t nr;  /* number of chars actually read */\r\n  char *p;\r\n  luaL_Buffer b;\r\n  luaL_buffinit(L, &b);\r\n  p = luaL_prepbuffsize(&b, n);  /* prepare buffer to read whole block */\r\n  nr = fread(p, sizeof(char), n, f);  /* try to read 'n' chars */\r\n  luaL_addsize(&b, nr);\r\n  luaL_pushresult(&b);  /* close buffer */\r\n  return (nr > 0);  /* true iff read something */\r\n}\r\n\r\n\r\nstatic int g_read (lua_State *L, FILE *f, int first) {\r\n  int nargs = lua_gettop(L) - 1;\r\n  int success;\r\n  int n;\r\n  clearerr(f);\r\n  if (nargs == 0) {  /* no arguments? */\r\n    success = read_line(L, f, 1);\r\n    n = first+1;  /* to return 1 result */\r\n  }\r\n  else {  /* ensure stack space for all results and for auxlib's buffer */\r\n    luaL_checkstack(L, nargs+LUA_MINSTACK, \"too many arguments\");\r\n    success = 1;\r\n    for (n = first; nargs-- && success; n++) {\r\n      if (lua_type(L, n) == LUA_TNUMBER) {\r\n        size_t l = (size_t)lua_tointeger(L, n);\r\n        success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);\r\n      }\r\n      else {\r\n        const char *p = lua_tostring(L, n);\r\n        luaL_argcheck(L, p && p[0] == '*', n, \"invalid option\");\r\n        switch (p[1]) {\r\n          case 'n':  /* number */\r\n            success = read_number(L, f);\r\n            break;\r\n          case 'l':  /* line */\r\n            success = read_line(L, f, 1);\r\n            break;\r\n          case 'L':  /* line with end-of-line */\r\n            success = read_line(L, f, 0);\r\n            break;\r\n          case 'a':  /* file */\r\n            read_all(L, f);  /* read entire file */\r\n            success = 1; /* always success */\r\n            break;\r\n          default:\r\n            return luaL_argerror(L, n, \"invalid format\");\r\n        }\r\n      }\r\n    }\r\n  }\r\n  if (ferror(f))\r\n    return luaL_fileresult(L, 0, NULL);\r\n  if (!success) {\r\n    lua_pop(L, 1);  /* remove last result */\r\n    lua_pushnil(L);  /* push nil instead */\r\n  }\r\n  return n - first;\r\n}\r\n\r\n\r\nstatic int io_read (lua_State *L) {\r\n  return g_read(L, getiofile(L, IO_INPUT), 1);\r\n}\r\n\r\n\r\nstatic int f_read (lua_State *L) {\r\n  return g_read(L, tofile(L), 2);\r\n}\r\n\r\n\r\nstatic int io_readline (lua_State *L) {\r\n  LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1));\r\n  int i;\r\n  int n = (int)lua_tointeger(L, lua_upvalueindex(2));\r\n  if (isclosed(p))  /* file is already closed? */\r\n    return luaL_error(L, \"file is already closed\");\r\n  lua_settop(L , 1);\r\n  for (i = 1; i <= n; i++)  /* push arguments to 'g_read' */\r\n    lua_pushvalue(L, lua_upvalueindex(3 + i));\r\n  n = g_read(L, p->f, 2);  /* 'n' is number of results */\r\n  lua_assert(n > 0);  /* should return at least a nil */\r\n  if (!lua_isnil(L, -n))  /* read at least one value? */\r\n    return n;  /* return them */\r\n  else {  /* first result is nil: EOF or error */\r\n    if (n > 1) {  /* is there error information? */\r\n      /* 2nd result is error message */\r\n      return luaL_error(L, \"%s\", lua_tostring(L, -n + 1));\r\n    }\r\n    if (lua_toboolean(L, lua_upvalueindex(3))) {  /* generator created file? */\r\n      lua_settop(L, 0);\r\n      lua_pushvalue(L, lua_upvalueindex(1));\r\n      aux_close(L);  /* close it */\r\n    }\r\n    return 0;\r\n  }\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\nstatic int g_write (lua_State *L, FILE *f, int arg) {\r\n  int nargs = lua_gettop(L) - arg;\r\n  int status = 1;\r\n  for (; nargs--; arg++) {\r\n    if (lua_type(L, arg) == LUA_TNUMBER) {\r\n      /* optimization: could be done exactly as for strings */\r\n      status = status &&\r\n          fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;\r\n    }\r\n    else {\r\n      size_t l;\r\n      const char *s = luaL_checklstring(L, arg, &l);\r\n      status = status && (fwrite(s, sizeof(char), l, f) == l);\r\n    }\r\n  }\r\n  if (status) return 1;  /* file handle already on stack top */\r\n  else return luaL_fileresult(L, status, NULL);\r\n}\r\n\r\n\r\nstatic int io_write (lua_State *L) {\r\n  return g_write(L, getiofile(L, IO_OUTPUT), 1);\r\n}\r\n\r\n\r\nstatic int f_write (lua_State *L) {\r\n  FILE *f = tofile(L);\r\n  lua_pushvalue(L, 1);  /* push file at the stack top (to be returned) */\r\n  return g_write(L, f, 2);\r\n}\r\n\r\n\r\nstatic int f_seek (lua_State *L) {\r\n  static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};\r\n  static const char *const modenames[] = {\"set\", \"cur\", \"end\", NULL};\r\n  FILE *f = tofile(L);\r\n  int op = luaL_checkoption(L, 2, \"cur\", modenames);\r\n  lua_Number p3 = luaL_optnumber(L, 3, 0);\r\n  l_seeknum offset = (l_seeknum)p3;\r\n  luaL_argcheck(L, (lua_Number)offset == p3, 3,\r\n                  \"not an integer in proper range\");\r\n  op = l_fseek(f, offset, mode[op]);\r\n  if (op)\r\n    return luaL_fileresult(L, 0, NULL);  /* error */\r\n  else {\r\n    lua_pushnumber(L, (lua_Number)l_ftell(f));\r\n    return 1;\r\n  }\r\n}\r\n\r\n\r\nstatic int f_setvbuf (lua_State *L) {\r\n  static const int mode[] = {_IONBF, _IOFBF, _IOLBF};\r\n  static const char *const modenames[] = {\"no\", \"full\", \"line\", NULL};\r\n  FILE *f = tofile(L);\r\n  int op = luaL_checkoption(L, 2, NULL, modenames);\r\n  lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);\r\n  int res = setvbuf(f, NULL, mode[op], sz);\r\n  return luaL_fileresult(L, res == 0, NULL);\r\n}\r\n\r\n\r\n\r\nstatic int io_flush (lua_State *L) {\r\n  return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL);\r\n}\r\n\r\n\r\nstatic int f_flush (lua_State *L) {\r\n  return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL);\r\n}\r\n\r\n\r\n/*\r\n** functions for 'io' library\r\n*/\r\nstatic const luaL_Reg iolib[] = {\r\n  {\"close\", io_close},\r\n  {\"flush\", io_flush},\r\n  {\"input\", io_input},\r\n  {\"lines\", io_lines},\r\n  {\"open\", io_open},\r\n  {\"output\", io_output},\r\n  {\"popen\", io_popen},\r\n  {\"read\", io_read},\r\n  {\"tmpfile\", io_tmpfile},\r\n  {\"type\", io_type},\r\n  {\"write\", io_write},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\n/*\r\n** methods for file handles\r\n*/\r\nstatic const luaL_Reg flib[] = {\r\n  {\"close\", io_close},\r\n  {\"flush\", f_flush},\r\n  {\"lines\", f_lines},\r\n  {\"read\", f_read},\r\n  {\"seek\", f_seek},\r\n  {\"setvbuf\", f_setvbuf},\r\n  {\"write\", f_write},\r\n  {\"__gc\", f_gc},\r\n  {\"__tostring\", f_tostring},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nstatic void createmeta (lua_State *L) {\r\n  luaL_newmetatable(L, LUA_FILEHANDLE);  /* create metatable for file handles */\r\n  lua_pushvalue(L, -1);  /* push metatable */\r\n  lua_setfield(L, -2, \"__index\");  /* metatable.__index = metatable */\r\n  luaL_setfuncs(L, flib, 0);  /* add file methods to new metatable */\r\n  lua_pop(L, 1);  /* pop new metatable */\r\n}\r\n\r\n\r\n/*\r\n** function to (not) close the standard files stdin, stdout, and stderr\r\n*/\r\nstatic int io_noclose (lua_State *L) {\r\n  LStream *p = tolstream(L);\r\n  p->closef = &io_noclose;  /* keep file opened */\r\n  lua_pushnil(L);\r\n  lua_pushliteral(L, \"cannot close standard file\");\r\n  return 2;\r\n}\r\n\r\n\r\nstatic void createstdfile (lua_State *L, FILE *f, const char *k,\r\n                           const char *fname) {\r\n  LStream *p = newprefile(L);\r\n  p->f = f;\r\n  p->closef = &io_noclose;\r\n  if (k != NULL) {\r\n    lua_pushvalue(L, -1);\r\n    lua_setfield(L, LUA_REGISTRYINDEX, k);  /* add file to registry */\r\n  }\r\n  lua_setfield(L, -2, fname);  /* add file to module */\r\n}\r\n\r\n\r\nLUAMOD_API int luaopen_io (lua_State *L) {\r\n  luaL_newlib(L, iolib);  /* new module */\r\n  createmeta(L);\r\n  /* create (and set) default files */\r\n  createstdfile(L, stdin, IO_INPUT, \"stdin\");\r\n  createstdfile(L, stdout, IO_OUTPUT, \"stdout\");\r\n  createstdfile(L, stderr, NULL, \"stderr\");\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/llex.c",
    "content": "/*\r\n** $Id: llex.c,v 2.59 2011/11/30 12:43:51 roberto Exp $\r\n** Lexical Analyzer\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <locale.h>\r\n#include <string.h>\r\n\r\n#define llex_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lctype.h\"\r\n#include \"ldo.h\"\r\n#include \"llex.h\"\r\n#include \"lobject.h\"\r\n#include \"lparser.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\n\r\n#define next(ls) (ls->current = zgetc(ls->z))\r\n\r\n\r\n\r\n#define currIsNewline(ls)\t(ls->current == '\\n' || ls->current == '\\r')\r\n\r\n\r\n/* ORDER RESERVED */\r\nstatic const char *const luaX_tokens [] = {\r\n    \"and\", \"break\", \"do\", \"else\", \"elseif\",\r\n    \"end\", \"false\", \"for\", \"function\", \"goto\", \"if\",\r\n    \"in\", \"local\", \"nil\", \"not\", \"or\", \"repeat\",\r\n    \"return\", \"then\", \"true\", \"until\", \"while\",\r\n    \"..\", \"...\", \"==\", \">=\", \"<=\", \"~=\", \"::\", \"<eof>\",\r\n    \"<number>\", \"<name>\", \"<string>\"\r\n};\r\n\r\n\r\n#define save_and_next(ls) (save(ls, ls->current), next(ls))\r\n\r\n\r\nstatic l_noret lexerror (LexState *ls, const char *msg, int token);\r\n\r\n\r\nstatic void save (LexState *ls, int c) {\r\n  Mbuffer *b = ls->buff;\r\n  if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) {\r\n    size_t newsize;\r\n    if (luaZ_sizebuffer(b) >= MAX_SIZET/2)\r\n      lexerror(ls, \"lexical element too long\", 0);\r\n    newsize = luaZ_sizebuffer(b) * 2;\r\n    luaZ_resizebuffer(ls->L, b, newsize);\r\n  }\r\n  b->buffer[luaZ_bufflen(b)++] = cast(char, c);\r\n}\r\n\r\n\r\nvoid luaX_init (lua_State *L) {\r\n  int i;\r\n  for (i=0; i<NUM_RESERVED; i++) {\r\n    TString *ts = luaS_new(L, luaX_tokens[i]);\r\n    luaS_fix(ts);  /* reserved words are never collected */\r\n    ts->tsv.reserved = cast_byte(i+1);  /* reserved word */\r\n  }\r\n}\r\n\r\n\r\nconst char *luaX_token2str (LexState *ls, int token) {\r\n  if (token < FIRST_RESERVED) {\r\n    lua_assert(token == cast(unsigned char, token));\r\n    return (lisprint(token)) ? luaO_pushfstring(ls->L, LUA_QL(\"%c\"), token) :\r\n                              luaO_pushfstring(ls->L, \"char(%d)\", token);\r\n  }\r\n  else {\r\n    const char *s = luaX_tokens[token - FIRST_RESERVED];\r\n    if (token < TK_EOS)\r\n      return luaO_pushfstring(ls->L, LUA_QS, s);\r\n    else\r\n      return s;\r\n  }\r\n}\r\n\r\n\r\nstatic const char *txtToken (LexState *ls, int token) {\r\n  switch (token) {\r\n    case TK_NAME:\r\n    case TK_STRING:\r\n    case TK_NUMBER:\r\n      save(ls, '\\0');\r\n      return luaO_pushfstring(ls->L, LUA_QS, luaZ_buffer(ls->buff));\r\n    default:\r\n      return luaX_token2str(ls, token);\r\n  }\r\n}\r\n\r\n\r\nstatic l_noret lexerror (LexState *ls, const char *msg, int token) {\r\n  char buff[LUA_IDSIZE];\r\n  luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE);\r\n  msg = luaO_pushfstring(ls->L, \"%s:%d: %s\", buff, ls->linenumber, msg);\r\n  if (token)\r\n    luaO_pushfstring(ls->L, \"%s near %s\", msg, txtToken(ls, token));\r\n  luaD_throw(ls->L, LUA_ERRSYNTAX);\r\n}\r\n\r\n\r\nl_noret luaX_syntaxerror (LexState *ls, const char *msg) {\r\n  lexerror(ls, msg, ls->t.token);\r\n}\r\n\r\n\r\n/*\r\n** creates a new string and anchors it in function's table so that\r\n** it will not be collected until the end of the function's compilation\r\n** (by that time it should be anchored in function's prototype)\r\n*/\r\nTString *luaX_newstring (LexState *ls, const char *str, size_t l) {\r\n  lua_State *L = ls->L;\r\n  TValue *o;  /* entry for `str' */\r\n  TString *ts = luaS_newlstr(L, str, l);  /* create new string */\r\n  setsvalue2s(L, L->top++, ts);  /* temporarily anchor it in stack */\r\n  o = luaH_set(L, ls->fs->h, L->top - 1);\r\n  if (ttisnil(o)) {  /* not in use yet? (see 'addK') */\r\n    /* boolean value does not need GC barrier;\r\n       table has no metatable, so it does not need to invalidate cache */\r\n    setbvalue(o, 1);  /* t[string] = true */\r\n    luaC_checkGC(L);\r\n  }\r\n  L->top--;  /* remove string from stack */\r\n  return ts;\r\n}\r\n\r\n\r\n/*\r\n** increment line number and skips newline sequence (any of\r\n** \\n, \\r, \\n\\r, or \\r\\n)\r\n*/\r\nstatic void inclinenumber (LexState *ls) {\r\n  int old = ls->current;\r\n  lua_assert(currIsNewline(ls));\r\n  next(ls);  /* skip `\\n' or `\\r' */\r\n  if (currIsNewline(ls) && ls->current != old)\r\n    next(ls);  /* skip `\\n\\r' or `\\r\\n' */\r\n  if (++ls->linenumber >= MAX_INT)\r\n    luaX_syntaxerror(ls, \"chunk has too many lines\");\r\n}\r\n\r\n\r\nvoid luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,\r\n                    int firstchar) {\r\n  ls->decpoint = '.';\r\n  ls->L = L;\r\n  ls->current = firstchar;\r\n  ls->lookahead.token = TK_EOS;  /* no look-ahead token */\r\n  ls->z = z;\r\n  ls->fs = NULL;\r\n  ls->linenumber = 1;\r\n  ls->lastline = 1;\r\n  ls->source = source;\r\n  ls->envn = luaS_new(L, LUA_ENV);  /* create env name */\r\n  luaS_fix(ls->envn);  /* never collect this name */\r\n  luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER);  /* initialize buffer */\r\n}\r\n\r\n\r\n\r\n/*\r\n** =======================================================\r\n** LEXICAL ANALYZER\r\n** =======================================================\r\n*/\r\n\r\n\r\n\r\nstatic int check_next (LexState *ls, const char *set) {\r\n  if (ls->current == '\\0' || !strchr(set, ls->current))\r\n    return 0;\r\n  save_and_next(ls);\r\n  return 1;\r\n}\r\n\r\n\r\n/*\r\n** change all characters 'from' in buffer to 'to'\r\n*/\r\nstatic void buffreplace (LexState *ls, char from, char to) {\r\n  size_t n = luaZ_bufflen(ls->buff);\r\n  char *p = luaZ_buffer(ls->buff);\r\n  while (n--)\r\n    if (p[n] == from) p[n] = to;\r\n}\r\n\r\n\r\n#if !defined(getlocaledecpoint)\r\n//#define getlocaledecpoint()\t(localeconv()->decimal_point[0])\r\n#define getlocaledecpoint()\t'.'\r\n#endif\r\n\r\n\r\n#define buff2d(b,e)\tluaO_str2d(luaZ_buffer(b), luaZ_bufflen(b) - 1, e)\r\n\r\n/*\r\n** in case of format error, try to change decimal point separator to\r\n** the one defined in the current locale and check again\r\n*/\r\nstatic void trydecpoint (LexState *ls, SemInfo *seminfo) {\r\n  char old = ls->decpoint;\r\n  ls->decpoint = getlocaledecpoint();\r\n  buffreplace(ls, old, ls->decpoint);  /* try new decimal separator */\r\n  if (!buff2d(ls->buff, &seminfo->r)) {\r\n    /* format error with correct decimal point: no more options */\r\n    buffreplace(ls, ls->decpoint, '.');  /* undo change (for error message) */\r\n    lexerror(ls, \"malformed number\", TK_NUMBER);\r\n  }\r\n}\r\n\r\n\r\n/* LUA_NUMBER */\r\nstatic void read_numeral (LexState *ls, SemInfo *seminfo) {\r\n  lua_assert(lisdigit(ls->current));\r\n  do {\r\n    save_and_next(ls);\r\n    if (check_next(ls, \"EePp\"))  /* exponent part? */\r\n      check_next(ls, \"+-\");  /* optional exponent sign */\r\n  } while (lislalnum(ls->current) || ls->current == '.');\r\n  save(ls, '\\0');\r\n  buffreplace(ls, '.', ls->decpoint);  /* follow locale for decimal point */\r\n  if (!buff2d(ls->buff, &seminfo->r))  /* format error? */\r\n    trydecpoint(ls, seminfo); /* try to update decimal point separator */\r\n}\r\n\r\n\r\n/*\r\n** skip a sequence '[=*[' or ']=*]' and return its number of '='s or\r\n** -1 if sequence is malformed\r\n*/\r\nstatic int skip_sep (LexState *ls) {\r\n  int count = 0;\r\n  int s = ls->current;\r\n  lua_assert(s == '[' || s == ']');\r\n  save_and_next(ls);\r\n  while (ls->current == '=') {\r\n    save_and_next(ls);\r\n    count++;\r\n  }\r\n  return (ls->current == s) ? count : (-count) - 1;\r\n}\r\n\r\n\r\nstatic void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {\r\n  save_and_next(ls);  /* skip 2nd `[' */\r\n  if (currIsNewline(ls))  /* string starts with a newline? */\r\n    inclinenumber(ls);  /* skip it */\r\n  for (;;) {\r\n    switch (ls->current) {\r\n      case EOZ:\r\n        lexerror(ls, (seminfo) ? \"unfinished long string\" :\r\n                                 \"unfinished long comment\", TK_EOS);\r\n        break;  /* to avoid warnings */\r\n      case ']': {\r\n        if (skip_sep(ls) == sep) {\r\n          save_and_next(ls);  /* skip 2nd `]' */\r\n          goto endloop;\r\n        }\r\n        break;\r\n      }\r\n      case '\\n': case '\\r': {\r\n        save(ls, '\\n');\r\n        inclinenumber(ls);\r\n        if (!seminfo) luaZ_resetbuffer(ls->buff);  /* avoid wasting space */\r\n        break;\r\n      }\r\n      default: {\r\n        if (seminfo) save_and_next(ls);\r\n        else next(ls);\r\n      }\r\n    }\r\n  } endloop:\r\n  if (seminfo)\r\n    seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),\r\n                                     luaZ_bufflen(ls->buff) - 2*(2 + sep));\r\n}\r\n\r\n\r\nstatic void escerror (LexState *ls, int *c, int n, const char *msg) {\r\n  int i;\r\n  luaZ_resetbuffer(ls->buff);  /* prepare error message */\r\n  save(ls, '\\\\');\r\n  for (i = 0; i < n && c[i] != EOZ; i++)\r\n    save(ls, c[i]);\r\n  lexerror(ls, msg, TK_STRING);\r\n}\r\n\r\n\r\nstatic int readhexaesc (LexState *ls) {\r\n  int c[3], i;  /* keep input for error message */\r\n  int r = 0;  /* result accumulator */\r\n  c[0] = 'x';  /* for error message */\r\n  for (i = 1; i < 3; i++) {  /* read two hexa digits */\r\n    c[i] = next(ls);\r\n    if (!lisxdigit(c[i]))\r\n      escerror(ls, c, i + 1, \"hexadecimal digit expected\");\r\n    r = (r << 4) + luaO_hexavalue(c[i]);\r\n  }\r\n  return r;\r\n}\r\n\r\n\r\nstatic int readdecesc (LexState *ls) {\r\n  int c[3], i;\r\n  int r = 0;  /* result accumulator */\r\n  for (i = 0; i < 3 && lisdigit(ls->current); i++) {  /* read up to 3 digits */\r\n    c[i] = ls->current;\r\n    r = 10*r + c[i] - '0';\r\n    next(ls);\r\n  }\r\n  if (r > UCHAR_MAX)\r\n    escerror(ls, c, i, \"decimal escape too large\");\r\n  return r;\r\n}\r\n\r\n\r\nstatic void read_string (LexState *ls, int del, SemInfo *seminfo) {\r\n  save_and_next(ls);  /* keep delimiter (for error messages) */\r\n  while (ls->current != del) {\r\n    switch (ls->current) {\r\n      case EOZ:\r\n        lexerror(ls, \"unfinished string\", TK_EOS);\r\n        break;  /* to avoid warnings */\r\n      case '\\n':\r\n      case '\\r':\r\n        lexerror(ls, \"unfinished string\", TK_STRING);\r\n        break;  /* to avoid warnings */\r\n      case '\\\\': {  /* escape sequences */\r\n        int c;  /* final character to be saved */\r\n        next(ls);  /* do not save the `\\' */\r\n        switch (ls->current) {\r\n          case 'a': c = '\\a'; goto read_save;\r\n          case 'b': c = '\\b'; goto read_save;\r\n          case 'f': c = '\\f'; goto read_save;\r\n          case 'n': c = '\\n'; goto read_save;\r\n          case 'r': c = '\\r'; goto read_save;\r\n          case 't': c = '\\t'; goto read_save;\r\n          case 'v': c = '\\v'; goto read_save;\r\n          case 'x': c = readhexaesc(ls); goto read_save;\r\n          case '\\n': case '\\r':\r\n            inclinenumber(ls); c = '\\n'; goto only_save;\r\n          case '\\\\': case '\\\"': case '\\'':\r\n            c = ls->current; goto read_save;\r\n          case EOZ: goto no_save;  /* will raise an error next loop */\r\n          case 'z': {  /* zap following span of spaces */\r\n            next(ls);  /* skip the 'z' */\r\n            while (lisspace(ls->current)) {\r\n              if (currIsNewline(ls)) inclinenumber(ls);\r\n              else next(ls);\r\n            }\r\n            goto no_save;\r\n          }\r\n          default: {\r\n            if (!lisdigit(ls->current))\r\n              escerror(ls, &ls->current, 1, \"invalid escape sequence\");\r\n            /* digital escape \\ddd */\r\n            c = readdecesc(ls);\r\n            goto only_save;\r\n          }\r\n        }\r\n       read_save: next(ls);  /* read next character */\r\n       only_save: save(ls, c);  /* save 'c' */\r\n       no_save: break;\r\n      }\r\n      default:\r\n        save_and_next(ls);\r\n    }\r\n  }\r\n  save_and_next(ls);  /* skip delimiter */\r\n  seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,\r\n                                   luaZ_bufflen(ls->buff) - 2);\r\n}\r\n\r\n\r\nstatic int llex (LexState *ls, SemInfo *seminfo) {\r\n  luaZ_resetbuffer(ls->buff);\r\n  for (;;) {\r\n    switch (ls->current) {\r\n      case '\\n': case '\\r': {  /* line breaks */\r\n        inclinenumber(ls);\r\n        break;\r\n      }\r\n      case ' ': case '\\f': case '\\t': case '\\v': {  /* spaces */\r\n        next(ls);\r\n        break;\r\n      }\r\n      case '-': {  /* '-' or '--' (comment) */\r\n        next(ls);\r\n        if (ls->current != '-') return '-';\r\n        /* else is a comment */\r\n        next(ls);\r\n        if (ls->current == '[') {  /* long comment? */\r\n          int sep = skip_sep(ls);\r\n          luaZ_resetbuffer(ls->buff);  /* `skip_sep' may dirty the buffer */\r\n          if (sep >= 0) {\r\n            read_long_string(ls, NULL, sep);  /* skip long comment */\r\n            luaZ_resetbuffer(ls->buff);  /* previous call may dirty the buff. */\r\n            break;\r\n          }\r\n        }\r\n        /* else short comment */\r\n        while (!currIsNewline(ls) && ls->current != EOZ)\r\n          next(ls);  /* skip until end of line (or end of file) */\r\n        break;\r\n      }\r\n      case '[': {  /* long string or simply '[' */\r\n        int sep = skip_sep(ls);\r\n        if (sep >= 0) {\r\n          read_long_string(ls, seminfo, sep);\r\n          return TK_STRING;\r\n        }\r\n        else if (sep == -1) return '[';\r\n        else lexerror(ls, \"invalid long string delimiter\", TK_STRING);\r\n      }\r\n      case '=': {\r\n        next(ls);\r\n        if (ls->current != '=') return '=';\r\n        else { next(ls); return TK_EQ; }\r\n      }\r\n      case '<': {\r\n        next(ls);\r\n        if (ls->current != '=') return '<';\r\n        else { next(ls); return TK_LE; }\r\n      }\r\n      case '>': {\r\n        next(ls);\r\n        if (ls->current != '=') return '>';\r\n        else { next(ls); return TK_GE; }\r\n      }\r\n      case '~': {\r\n        next(ls);\r\n        if (ls->current != '=') return '~';\r\n        else { next(ls); return TK_NE; }\r\n      }\r\n      case ':': {\r\n        next(ls);\r\n        if (ls->current != ':') return ':';\r\n        else { next(ls); return TK_DBCOLON; }\r\n      }\r\n      case '\"': case '\\'': {  /* short literal strings */\r\n        read_string(ls, ls->current, seminfo);\r\n        return TK_STRING;\r\n      }\r\n      case '.': {  /* '.', '..', '...', or number */\r\n        save_and_next(ls);\r\n        if (check_next(ls, \".\")) {\r\n          if (check_next(ls, \".\"))\r\n            return TK_DOTS;   /* '...' */\r\n          else return TK_CONCAT;   /* '..' */\r\n        }\r\n        else if (!lisdigit(ls->current)) return '.';\r\n        /* else go through */\r\n      }\r\n      case '0': case '1': case '2': case '3': case '4':\r\n      case '5': case '6': case '7': case '8': case '9': {\r\n        read_numeral(ls, seminfo);\r\n        return TK_NUMBER;\r\n      }\r\n      case EOZ: {\r\n        return TK_EOS;\r\n      }\r\n      default: {\r\n        if (lislalpha(ls->current)) {  /* identifier or reserved word? */\r\n          TString *ts;\r\n          do {\r\n            save_and_next(ls);\r\n          } while (lislalnum(ls->current));\r\n          ts = luaX_newstring(ls, luaZ_buffer(ls->buff),\r\n                                  luaZ_bufflen(ls->buff));\r\n          seminfo->ts = ts;\r\n          if (ts->tsv.reserved > 0)  /* reserved word? */\r\n            return ts->tsv.reserved - 1 + FIRST_RESERVED;\r\n          else {\r\n            return TK_NAME;\r\n          }\r\n        }\r\n        else {  /* single-char tokens (+ - / ...) */\r\n          int c = ls->current;\r\n          next(ls);\r\n          return c;\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\nvoid luaX_next (LexState *ls) {\r\n  ls->lastline = ls->linenumber;\r\n  if (ls->lookahead.token != TK_EOS) {  /* is there a look-ahead token? */\r\n    ls->t = ls->lookahead;  /* use this one */\r\n    ls->lookahead.token = TK_EOS;  /* and discharge it */\r\n  }\r\n  else\r\n    ls->t.token = llex(ls, &ls->t.seminfo);  /* read next token */\r\n}\r\n\r\n\r\nint luaX_lookahead (LexState *ls) {\r\n  lua_assert(ls->lookahead.token == TK_EOS);\r\n  ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);\r\n  return ls->lookahead.token;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/llex.h",
    "content": "/*\r\n** $Id: llex.h,v 1.72 2011/11/30 12:43:51 roberto Exp $\r\n** Lexical Analyzer\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef llex_h\r\n#define llex_h\r\n\r\n#include \"lobject.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\n#define FIRST_RESERVED\t257\r\n\r\n\r\n\r\n/*\r\n* WARNING: if you change the order of this enumeration,\r\n* grep \"ORDER RESERVED\"\r\n*/\r\nenum RESERVED {\r\n  /* terminal symbols denoted by reserved words */\r\n  TK_AND = FIRST_RESERVED, TK_BREAK,\r\n  TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,\r\n  TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,\r\n  TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,\r\n  /* other terminal symbols */\r\n  TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS,\r\n  TK_NUMBER, TK_NAME, TK_STRING\r\n};\r\n\r\n/* number of reserved words */\r\n#define NUM_RESERVED\t(cast(int, TK_WHILE-FIRST_RESERVED+1))\r\n\r\n\r\ntypedef union {\r\n  lua_Number r;\r\n  TString *ts;\r\n} SemInfo;  /* semantics information */\r\n\r\n\r\ntypedef struct Token {\r\n  int token;\r\n  SemInfo seminfo;\r\n} Token;\r\n\r\n\r\n/* state of the lexer plus state of the parser when shared by all\r\n   functions */\r\ntypedef struct LexState {\r\n  int current;  /* current character (charint) */\r\n  int linenumber;  /* input line counter */\r\n  int lastline;  /* line of last token `consumed' */\r\n  Token t;  /* current token */\r\n  Token lookahead;  /* look ahead token */\r\n  struct FuncState *fs;  /* current function (parser) */\r\n  struct lua_State *L;\r\n  ZIO *z;  /* input stream */\r\n  Mbuffer *buff;  /* buffer for tokens */\r\n  struct Dyndata *dyd;  /* dynamic structures used by the parser */\r\n  TString *source;  /* current source name */\r\n  TString *envn;  /* environment variable name */\r\n  char decpoint;  /* locale decimal point */\r\n} LexState;\r\n\r\n\r\nLUAI_FUNC void luaX_init (lua_State *L);\r\nLUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,\r\n                              TString *source, int firstchar);\r\nLUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);\r\nLUAI_FUNC void luaX_next (LexState *ls);\r\nLUAI_FUNC int luaX_lookahead (LexState *ls);\r\nLUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);\r\nLUAI_FUNC const char *luaX_token2str (LexState *ls, int token);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/llimits.h",
    "content": "/*\r\n** $Id: llimits.h,v 1.95 2011/12/06 16:58:36 roberto Exp $\r\n** Limits, basic types, and some other `installation-dependent' definitions\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef llimits_h\r\n#define llimits_h\r\n\r\n\r\n#include <limits.h>\r\n#include <stddef.h>\r\n\r\n\r\n#include \"lua.h\"\r\n\r\n\r\ntypedef unsigned LUA_INT32 lu_int32;\r\n\r\ntypedef LUAI_UMEM lu_mem;\r\n\r\ntypedef LUAI_MEM l_mem;\r\n\r\n\r\n\r\n/* chars used as small naturals (so that `char' is reserved for characters) */\r\ntypedef unsigned char lu_byte;\r\n\r\n\r\n#define MAX_SIZET\t((size_t)(~(size_t)0)-2)\r\n\r\n#define MAX_LUMEM\t((lu_mem)(~(lu_mem)0)-2)\r\n\r\n\r\n#define MAX_INT (INT_MAX-2)  /* maximum value of an int (-2 for safety) */\r\n\r\n/*\r\n** conversion of pointer to integer\r\n** this is for hashing only; there is no problem if the integer\r\n** cannot hold the whole pointer value\r\n*/\r\n#define IntPoint(p)  ((unsigned int)(lu_mem)(p))\r\n\r\n\r\n\r\n/* type to ensure maximum alignment */\r\n#if !defined(LUAI_USER_ALIGNMENT_T)\r\n#define LUAI_USER_ALIGNMENT_T\tunion { double u; void *s; long l; }\r\n#endif\r\n\r\ntypedef LUAI_USER_ALIGNMENT_T L_Umaxalign;\r\n\r\n\r\n/* result of a `usual argument conversion' over lua_Number */\r\ntypedef LUAI_UACNUMBER l_uacNumber;\r\n\r\n\r\n/* internal assertions for in-house debugging */\r\n#if defined(lua_assert)\r\n#define check_exp(c,e)\t\t(lua_assert(c), (e))\r\n/* to avoid problems with conditions too long */\r\n#define lua_longassert(c)\t{ if (!(c)) lua_assert(0); }\r\n#else\r\n#define lua_assert(c)\t\t((void)0)\r\n#define check_exp(c,e)\t\t(e)\r\n#define lua_longassert(c)\t((void)0)\r\n#endif\r\n\r\n/*\r\n** assertion for checking API calls\r\n*/\r\n#if !defined(luai_apicheck)\r\n\r\n#if defined(LUA_USE_APICHECK)\r\n#include <assert.h>\r\n#define luai_apicheck(L,e)\tassert(e)\r\n#else\r\n#define luai_apicheck(L,e)\tlua_assert(e)\r\n#endif\r\n\r\n#endif\r\n\r\n#define api_check(l,e,msg)\tluai_apicheck(l,(e) && msg)\r\n\r\n\r\n#if !defined(UNUSED)\r\n#define UNUSED(x)\t((void)(x))\t/* to avoid warnings */\r\n#endif\r\n\r\n\r\n#define cast(t, exp)\t((t)(exp))\r\n\r\n#define cast_byte(i)\tcast(lu_byte, (i))\r\n#define cast_num(i)\tcast(lua_Number, (i))\r\n#define cast_int(i)\tcast(int, (i))\r\n#define cast_uchar(i)\tcast(unsigned char, (i))\r\n\r\n\r\n/*\r\n** non-return type\r\n*/\r\n#if defined(__GNUC__)\r\n#define l_noret\t\tvoid __attribute__((noreturn))\r\n#elif defined(_MSC_VER)\r\n#define l_noret\t\tvoid __declspec(noreturn)\r\n#else\r\n#define l_noret\t\tvoid\r\n#endif\r\n\r\n\r\n\r\n/*\r\n** maximum depth for nested C calls and syntactical nested non-terminals\r\n** in a program. (Value must fit in an unsigned short int.)\r\n*/\r\n#if !defined(LUAI_MAXCCALLS)\r\n#define LUAI_MAXCCALLS\t\t200\r\n#endif\r\n\r\n/*\r\n** maximum number of upvalues in a closure (both C and Lua). (Value\r\n** must fit in an unsigned char.)\r\n*/\r\n#define MAXUPVAL\tUCHAR_MAX\r\n\r\n\r\n/*\r\n** type for virtual-machine instructions\r\n** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)\r\n*/\r\ntypedef lu_int32 Instruction;\r\n\r\n\r\n\r\n/* maximum stack for a Lua function */\r\n#define MAXSTACK\t250\r\n\r\n\r\n\r\n/* minimum size for the string table (must be power of 2) */\r\n#if !defined(MINSTRTABSIZE)\r\n#define MINSTRTABSIZE\t32\r\n#endif\r\n\r\n\r\n/* minimum size for string buffer */\r\n#if !defined(LUA_MINBUFFER)\r\n#define LUA_MINBUFFER\t32\r\n#endif\r\n\r\n\r\n#if !defined(lua_lock)\r\n#define lua_lock(L)     ((void) 0)\r\n#define lua_unlock(L)   ((void) 0)\r\n#endif\r\n\r\n#if !defined(luai_threadyield)\r\n#define luai_threadyield(L)     {lua_unlock(L); lua_lock(L);}\r\n#endif\r\n\r\n\r\n/*\r\n** these macros allow user-specific actions on threads when you defined\r\n** LUAI_EXTRASPACE and need to do something extra when a thread is\r\n** created/deleted/resumed/yielded.\r\n*/\r\n#if !defined(luai_userstateopen)\r\n#define luai_userstateopen(L)\t\t((void)L)\r\n#endif\r\n\r\n#if !defined(luai_userstateclose)\r\n#define luai_userstateclose(L)\t\t((void)L)\r\n#endif\r\n\r\n#if !defined(luai_userstatethread)\r\n#define luai_userstatethread(L,L1)\t((void)L)\r\n#endif\r\n\r\n#if !defined(luai_userstatefree)\r\n#define luai_userstatefree(L,L1)\t((void)L)\r\n#endif\r\n\r\n#if !defined(luai_userstateresume)\r\n#define luai_userstateresume(L,n)       ((void)L)\r\n#endif\r\n\r\n#if !defined(luai_userstateyield)\r\n#define luai_userstateyield(L,n)        ((void)L)\r\n#endif\r\n\r\n/*\r\n** lua_number2int is a macro to convert lua_Number to int.\r\n** lua_number2integer is a macro to convert lua_Number to lua_Integer.\r\n** lua_number2unsigned is a macro to convert a lua_Number to a lua_Unsigned.\r\n** lua_unsigned2number is a macro to convert a lua_Unsigned to a lua_Number.\r\n** luai_hashnum is a macro to hash a lua_Number value into an integer.\r\n** The hash must be deterministic and give reasonable values for\r\n** both small and large values (outside the range of integers).\r\n*/\r\n\r\n#if defined(MS_ASMTRICK)\t/* { */\r\n/* trick with Microsoft assembler for X86 */\r\n\r\n#define lua_number2int(i,n)  __asm {__asm fld n   __asm fistp i}\r\n#define lua_number2integer(i,n)\t\tlua_number2int(i, n)\r\n#define lua_number2unsigned(i,n)  \\\r\n  {__int64 l; __asm {__asm fld n   __asm fistp l} i = (unsigned int)l;}\r\n\r\n\r\n#elif defined(LUA_IEEE754TRICK)\t\t/* }{ */\r\n/* the next trick should work on any machine using IEEE754 with\r\n   a 32-bit integer type */\r\n\r\nunion luai_Cast { double l_d; LUA_INT32 l_p[2]; };\r\n\r\n#if !defined(LUA_IEEEENDIAN)\t/* { */\r\n#define LUAI_EXTRAIEEE\t\\\r\n  static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)};\r\n#define LUA_IEEEENDIAN\t\t(ieeeendian.l_p[1] == 33)\r\n#else\r\n#define LUAI_EXTRAIEEE\t\t/* empty */\r\n#endif\t\t\t\t/* } */\r\n\r\n#define lua_number2int32(i,n,t) \\\r\n  { LUAI_EXTRAIEEE \\\r\n    volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \\\r\n    (i) = (t)u.l_p[LUA_IEEEENDIAN]; }\r\n\r\n#define luai_hashnum(i,n)  \\\r\n  { volatile union luai_Cast u; u.l_d = (n) + 1.0;  /* avoid -0 */ \\\r\n    (i) = u.l_p[0]; (i) += u.l_p[1]; }  /* add double bits for his hash */\r\n\r\n#define lua_number2int(i,n)\t\tlua_number2int32(i, n, int)\r\n#define lua_number2integer(i,n)\t\tlua_number2int32(i, n, lua_Integer)\r\n#define lua_number2unsigned(i,n)\tlua_number2int32(i, n, lua_Unsigned)\r\n\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\n/* the following definitions always work, but may be slow */\r\n\r\n#if !defined(lua_number2int)\r\n#define lua_number2int(i,n)\t((i)=(int)(n))\r\n#endif\r\n\r\n#if !defined(lua_number2integer)\r\n#define lua_number2integer(i,n)\t((i)=(lua_Integer)(n))\r\n#endif\r\n\r\n#if !defined(lua_number2unsigned)\t/* { */\r\n/* the following definition assures proper modulo behavior */\r\n#if defined(LUA_NUMBER_DOUBLE)\r\n#include <math.h>\r\n#define SUPUNSIGNED\t((lua_Number)(~(lua_Unsigned)0) + 1)\r\n#define lua_number2unsigned(i,n)  \\\r\n\t((i)=(lua_Unsigned)((n) - floor((n)/SUPUNSIGNED)*SUPUNSIGNED))\r\n#else\r\n#define lua_number2unsigned(i,n)\t((i)=(lua_Unsigned)(n))\r\n#endif\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\n#if !defined(lua_unsigned2number)\r\n/* on several machines, coercion from unsigned to double is slow,\r\n   so it may be worth to avoid */\r\n#define lua_unsigned2number(u)  \\\r\n    (((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u))\r\n#endif\r\n\r\n\r\n\r\n#if defined(ltable_c) && !defined(luai_hashnum)\r\n\r\n#include <float.h>\r\n#include <math.h>\r\n\r\n#define luai_hashnum(i,n) { int e;  \\\r\n  n = frexp(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP);  \\\r\n  lua_number2int(i, n); i += e; }\r\n\r\n#endif\r\n\r\n\r\n\r\n/*\r\n** macro to control inclusion of some hard tests on stack reallocation\r\n*/\r\n#if !defined(HARDSTACKTESTS)\r\n#define condmovestack(L)\t((void)0)\r\n#else\r\n/* realloc stack keeping its size */\r\n#define condmovestack(L)\tluaD_reallocstack((L), (L)->stacksize)\r\n#endif\r\n\r\n#if !defined(HARDMEMTESTS)\r\n#define condchangemem(L)\tcondmovestack(L)\r\n#else\r\n#define condchangemem(L)  \\\r\n\t((void)(!(G(L)->gcrunning) || (luaC_fullgc(L, 0), 1)))\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lmathlib.c",
    "content": "/*\r\n** $Id: lmathlib.c,v 1.80 2011/07/05 12:49:35 roberto Exp $\r\n** Standard mathematical library\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\n#define lmathlib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n#undef PI\r\n#define PI (3.14159265358979323846)\r\n#define RADIANS_PER_DEGREE (PI/180.0)\r\n\r\n\r\n/* macro 'l_tg' allows the addition of an 'l' or 'f' to all math operations */\r\n#if !defined(l_tg)\r\n#define l_tg(x)\t\t(x)\r\n#endif\r\n\r\n\r\n\r\nstatic int math_abs (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(fabs)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_sin (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(sin)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_sinh (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(sinh)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_cos (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(cos)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_cosh (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(cosh)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_tan (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(tan)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_tanh (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(tanh)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_asin (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(asin)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_acos (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(acos)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_atan (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(atan)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_atan2 (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(atan2)(luaL_checknumber(L, 1),\r\n                                luaL_checknumber(L, 2)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_ceil (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(ceil)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_floor (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(floor)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_fmod (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(fmod)(luaL_checknumber(L, 1),\r\n                               luaL_checknumber(L, 2)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_modf (lua_State *L) {\r\n  lua_Number ip;\r\n  lua_Number fp = l_tg(modf)(luaL_checknumber(L, 1), &ip);\r\n  lua_pushnumber(L, ip);\r\n  lua_pushnumber(L, fp);\r\n  return 2;\r\n}\r\n\r\nstatic int math_sqrt (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(sqrt)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_pow (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(pow)(luaL_checknumber(L, 1),\r\n                              luaL_checknumber(L, 2)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_log (lua_State *L) {\r\n  lua_Number x = luaL_checknumber(L, 1);\r\n  lua_Number res;\r\n  if (lua_isnoneornil(L, 2))\r\n    res = l_tg(log)(x);\r\n  else {\r\n    lua_Number base = luaL_checknumber(L, 2);\r\n    if (base == 10.0) res = l_tg(log10)(x);\r\n    else res = l_tg(log)(x)/l_tg(log)(base);\r\n  }\r\n  lua_pushnumber(L, res);\r\n  return 1;\r\n}\r\n\r\n#if defined(LUA_COMPAT_LOG10)\r\nstatic int math_log10 (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(log10)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n#endif\r\n\r\nstatic int math_exp (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(exp)(luaL_checknumber(L, 1)));\r\n  return 1;\r\n}\r\n\r\nstatic int math_deg (lua_State *L) {\r\n  lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE);\r\n  return 1;\r\n}\r\n\r\nstatic int math_rad (lua_State *L) {\r\n  lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE);\r\n  return 1;\r\n}\r\n\r\nstatic int math_frexp (lua_State *L) {\r\n  int e;\r\n  lua_pushnumber(L, l_tg(frexp)(luaL_checknumber(L, 1), &e));\r\n  lua_pushinteger(L, e);\r\n  return 2;\r\n}\r\n\r\nstatic int math_ldexp (lua_State *L) {\r\n  lua_pushnumber(L, l_tg(ldexp)(luaL_checknumber(L, 1),\r\n                                luaL_checkint(L, 2)));\r\n  return 1;\r\n}\r\n\r\n\r\n\r\nstatic int math_min (lua_State *L) {\r\n  int n = lua_gettop(L);  /* number of arguments */\r\n  lua_Number dmin = luaL_checknumber(L, 1);\r\n  int i;\r\n  for (i=2; i<=n; i++) {\r\n    lua_Number d = luaL_checknumber(L, i);\r\n    if (d < dmin)\r\n      dmin = d;\r\n  }\r\n  lua_pushnumber(L, dmin);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int math_max (lua_State *L) {\r\n  int n = lua_gettop(L);  /* number of arguments */\r\n  lua_Number dmax = luaL_checknumber(L, 1);\r\n  int i;\r\n  for (i=2; i<=n; i++) {\r\n    lua_Number d = luaL_checknumber(L, i);\r\n    if (d > dmax)\r\n      dmax = d;\r\n  }\r\n  lua_pushnumber(L, dmax);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int math_random (lua_State *L) {\r\n  /* the `%' avoids the (rare) case of r==1, and is needed also because on\r\n     some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */\r\n  lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;\r\n  switch (lua_gettop(L)) {  /* check number of arguments */\r\n    case 0: {  /* no arguments */\r\n      lua_pushnumber(L, r);  /* Number between 0 and 1 */\r\n      break;\r\n    }\r\n    case 1: {  /* only upper limit */\r\n      lua_Number u = luaL_checknumber(L, 1);\r\n      luaL_argcheck(L, 1.0 <= u, 1, \"interval is empty\");\r\n      lua_pushnumber(L, l_tg(floor)(r*u) + 1.0);  /* int in [1, u] */\r\n      break;\r\n    }\r\n    case 2: {  /* lower and upper limits */\r\n      lua_Number l = luaL_checknumber(L, 1);\r\n      lua_Number u = luaL_checknumber(L, 2);\r\n      luaL_argcheck(L, l <= u, 2, \"interval is empty\");\r\n      lua_pushnumber(L, l_tg(floor)(r*(u-l+1)) + l);  /* int in [l, u] */\r\n      break;\r\n    }\r\n    default: return luaL_error(L, \"wrong number of arguments\");\r\n  }\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int math_randomseed (lua_State *L) {\r\n  srand(luaL_checkunsigned(L, 1));\r\n  (void)rand(); /* discard first value to avoid undesirable correlations */\r\n  return 0;\r\n}\r\n\r\n\r\nstatic const luaL_Reg mathlib[] = {\r\n  {\"abs\",   math_abs},\r\n  {\"acos\",  math_acos},\r\n  {\"asin\",  math_asin},\r\n  {\"atan2\", math_atan2},\r\n  {\"atan\",  math_atan},\r\n  {\"ceil\",  math_ceil},\r\n  {\"cosh\",   math_cosh},\r\n  {\"cos\",   math_cos},\r\n  {\"deg\",   math_deg},\r\n  {\"exp\",   math_exp},\r\n  {\"floor\", math_floor},\r\n  {\"fmod\",   math_fmod},\r\n  {\"frexp\", math_frexp},\r\n  {\"ldexp\", math_ldexp},\r\n#if defined(LUA_COMPAT_LOG10)\r\n  {\"log10\", math_log10},\r\n#endif\r\n  {\"log\",   math_log},\r\n  {\"max\",   math_max},\r\n  {\"min\",   math_min},\r\n  {\"modf\",   math_modf},\r\n  {\"pow\",   math_pow},\r\n  {\"rad\",   math_rad},\r\n  {\"random\",     math_random},\r\n  {\"randomseed\", math_randomseed},\r\n  {\"sinh\",   math_sinh},\r\n  {\"sin\",   math_sin},\r\n  {\"sqrt\",  math_sqrt},\r\n  {\"tanh\",   math_tanh},\r\n  {\"tan\",   math_tan},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\n/*\r\n** Open math library\r\n*/\r\nLUAMOD_API int luaopen_math (lua_State *L) {\r\n  luaL_newlib(L, mathlib);\r\n  lua_pushnumber(L, PI);\r\n  lua_setfield(L, -2, \"pi\");\r\n  lua_pushnumber(L, HUGE_VAL);\r\n  lua_setfield(L, -2, \"huge\");\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lmem.c",
    "content": "/*\r\n** $Id: lmem.c,v 1.83 2011/11/30 12:42:49 roberto Exp $\r\n** Interface to Memory Manager\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#define lmem_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lgc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n\r\n\r\n\r\n/*\r\n** About the realloc function:\r\n** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize);\r\n** (`osize' is the old size, `nsize' is the new size)\r\n**\r\n** * frealloc(ud, NULL, x, s) creates a new block of size `s' (no\r\n** matter 'x').\r\n**\r\n** * frealloc(ud, p, x, 0) frees the block `p'\r\n** (in this specific case, frealloc must return NULL);\r\n** particularly, frealloc(ud, NULL, 0, 0) does nothing\r\n** (which is equivalent to free(NULL) in ANSI C)\r\n**\r\n** frealloc returns NULL if it cannot create or reallocate the area\r\n** (any reallocation to an equal or smaller size cannot fail!)\r\n*/\r\n\r\n\r\n\r\n#define MINSIZEARRAY\t4\r\n\r\n\r\nvoid *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,\r\n                     int limit, const char *what) {\r\n  void *newblock;\r\n  int newsize;\r\n  if (*size >= limit/2) {  /* cannot double it? */\r\n    if (*size >= limit)  /* cannot grow even a little? */\r\n      luaG_runerror(L, \"too many %s (limit is %d)\", what, limit);\r\n    newsize = limit;  /* still have at least one free place */\r\n  }\r\n  else {\r\n    newsize = (*size)*2;\r\n    if (newsize < MINSIZEARRAY)\r\n      newsize = MINSIZEARRAY;  /* minimum size */\r\n  }\r\n  newblock = luaM_reallocv(L, block, *size, newsize, size_elems);\r\n  *size = newsize;  /* update only when everything else is OK */\r\n  return newblock;\r\n}\r\n\r\n\r\nl_noret luaM_toobig (lua_State *L) {\r\n  luaG_runerror(L, \"memory allocation error: block too big\");\r\n}\r\n\r\n\r\n\r\n/*\r\n** generic allocation routine.\r\n*/\r\nvoid *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {\r\n  void *newblock;\r\n  global_State *g = G(L);\r\n  size_t realosize = (block) ? osize : 0;\r\n  lua_assert((realosize == 0) == (block == NULL));\r\n#if defined(HARDMEMTESTS)\r\n  if (nsize > realosize && g->gcrunning)\r\n    luaC_fullgc(L, 1);  /* force a GC whenever possible */\r\n#endif\r\n  newblock = (*g->frealloc)(g->ud, block, osize, nsize);\r\n  if (newblock == NULL && nsize > 0) {\r\n    api_check(L, nsize > realosize,\r\n                 \"realloc cannot fail when shrinking a block\");\r\n    if (g->gcrunning) {\r\n      luaC_fullgc(L, 1);  /* try to free some memory... */\r\n      newblock = (*g->frealloc)(g->ud, block, osize, nsize);  /* try again */\r\n    }\r\n    if (newblock == NULL)\r\n      luaD_throw(L, LUA_ERRMEM);\r\n  }\r\n  lua_assert((nsize == 0) == (newblock == NULL));\r\n  g->GCdebt = (g->GCdebt + nsize) - realosize;\r\n#if defined(TRACEMEM)\r\n  { /* auxiliary patch to monitor garbage collection.\r\n    ** To plot, gnuplot with following command:\r\n    ** plot TRACEMEM using 1:2 with lines, TRACEMEM using 1:3 with lines\r\n    */\r\n    static unsigned long total = 0;  /* our \"time\" */\r\n    static FILE *f = NULL;  /* output file */\r\n    total++;  /* \"time\" always grows */\r\n    if ((total % 200) == 0) {\r\n      if (f == NULL) f = fopen(TRACEMEM, \"w\");\r\n      fprintf(f, \"%lu %u %d %d\\n\", total,\r\n              gettotalbytes(g), g->GCdebt, g->gcstate * 10000);\r\n    }\r\n  }\r\n#endif\r\n\r\n  return newblock;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lmem.h",
    "content": "/*\r\n** $Id: lmem.h,v 1.38 2011/12/02 13:26:54 roberto Exp $\r\n** Interface to Memory Manager\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lmem_h\r\n#define lmem_h\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#include \"llimits.h\"\r\n#include \"lua.h\"\r\n\r\n\r\n#define luaM_reallocv(L,b,on,n,e) \\\r\n\t((cast(size_t, (n)+1) > MAX_SIZET/(e)) ?  /* +1 to avoid warnings */ \\\r\n\t\t(luaM_toobig(L), (void *)0) : \\\r\n\t\tluaM_realloc_(L, (b), (on)*(e), (n)*(e)))\r\n\r\n#define luaM_freemem(L, b, s)\tluaM_realloc_(L, (b), (s), 0)\r\n#define luaM_free(L, b)\t\tluaM_realloc_(L, (b), sizeof(*(b)), 0)\r\n#define luaM_freearray(L, b, n)   luaM_reallocv(L, (b), n, 0, sizeof((b)[0]))\r\n\r\n#define luaM_malloc(L,s)\tluaM_realloc_(L, NULL, 0, (s))\r\n#define luaM_new(L,t)\t\tcast(t *, luaM_malloc(L, sizeof(t)))\r\n#define luaM_newvector(L,n,t) \\\r\n\t\tcast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))\r\n\r\n#define luaM_newobject(L,tag,s)\tluaM_realloc_(L, NULL, tag, (s))\r\n\r\n#define luaM_growvector(L,v,nelems,size,t,limit,e) \\\r\n          if ((nelems)+1 > (size)) \\\r\n            ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))\r\n\r\n#define luaM_reallocvector(L, v,oldn,n,t) \\\r\n   ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))\r\n\r\nLUAI_FUNC l_noret luaM_toobig (lua_State *L);\r\n\r\n/* not to be called directly */\r\nLUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,\r\n                                                          size_t size);\r\nLUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,\r\n                               size_t size_elem, int limit,\r\n                               const char *what);\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/loadlib.c",
    "content": "/*\r\n** $Id: loadlib.c,v 1.108 2011/12/12 16:34:03 roberto Exp $\r\n** Dynamic library loader for Lua\r\n** See Copyright Notice in lua.h\r\n**\r\n** This module contains an implementation of loadlib for Unix systems\r\n** that have dlfcn, an implementation for Windows, and a stub for other\r\n** systems.\r\n*/\r\n\r\n\r\n/*\r\n** if needed, includes windows header before everything else\r\n*/\r\n#if defined(_WIN32)\r\n#include <windows.h>\r\n#endif\r\n\r\n\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n\r\n#define loadlib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n/*\r\n** LUA_PATH and LUA_CPATH are the names of the environment\r\n** variables that Lua check to set its paths.\r\n*/\r\n#if !defined(LUA_PATH)\r\n#define LUA_PATH\t\"LUA_PATH\"\r\n#endif\r\n\r\n#if !defined(LUA_CPATH)\r\n#define LUA_CPATH\t\"LUA_CPATH\"\r\n#endif\r\n\r\n#define LUA_PATHSUFFIX\t\t\"_\" LUA_VERSION_MAJOR \"_\" LUA_VERSION_MINOR\r\n\r\n#define LUA_PATHVERSION\t\tLUA_PATH LUA_PATHSUFFIX\r\n#define LUA_CPATHVERSION\tLUA_CPATH LUA_PATHSUFFIX\r\n\r\n/*\r\n** LUA_PATH_SEP is the character that separates templates in a path.\r\n** LUA_PATH_MARK is the string that marks the substitution points in a\r\n** template.\r\n** LUA_EXEC_DIR in a Windows path is replaced by the executable's\r\n** directory.\r\n** LUA_IGMARK is a mark to ignore all before it when building the\r\n** luaopen_ function name.\r\n*/\r\n#if !defined (LUA_PATH_SEP)\r\n#define LUA_PATH_SEP\t\t\";\"\r\n#endif\r\n#if !defined (LUA_PATH_MARK)\r\n#define LUA_PATH_MARK\t\t\"?\"\r\n#endif\r\n#if !defined (LUA_EXEC_DIR)\r\n#define LUA_EXEC_DIR\t\t\"!\"\r\n#endif\r\n#if !defined (LUA_IGMARK)\r\n#define LUA_IGMARK\t\t\"-\"\r\n#endif\r\n\r\n\r\n/*\r\n** LUA_CSUBSEP is the character that replaces dots in submodule names\r\n** when searching for a C loader.\r\n** LUA_LSUBSEP is the character that replaces dots in submodule names\r\n** when searching for a Lua loader.\r\n*/\r\n#if !defined(LUA_CSUBSEP)\r\n#define LUA_CSUBSEP\t\tLUA_DIRSEP\r\n#endif\r\n\r\n#if !defined(LUA_LSUBSEP)\r\n#define LUA_LSUBSEP\t\tLUA_DIRSEP\r\n#endif\r\n\r\n\r\n/* prefix for open functions in C libraries */\r\n#define LUA_POF\t\t\"luaopen_\"\r\n\r\n/* separator for open functions in C libraries */\r\n#define LUA_OFSEP\t\"_\"\r\n\r\n\r\n#define LIBPREFIX\t\"LOADLIB: \"\r\n\r\n#define POF\t\tLUA_POF\r\n#define LIB_FAIL\t\"open\"\r\n\r\n\r\n/* error codes for ll_loadfunc */\r\n#define ERRLIB\t\t1\r\n#define ERRFUNC\t\t2\r\n\r\n#define setprogdir(L)\t\t((void)0)\r\n\r\n\r\n/*\r\n** system-dependent functions\r\n*/\r\nstatic void ll_unloadlib (void *lib);\r\nstatic void *ll_load (lua_State *L, const char *path, int seeglb);\r\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym);\r\n\r\n\r\n\r\n#if defined(LUA_USE_DLOPEN)\r\n/*\r\n** {========================================================================\r\n** This is an implementation of loadlib based on the dlfcn interface.\r\n** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,\r\n** NetBSD, AIX 4.2, HPUX 11, and  probably most other Unix flavors, at least\r\n** as an emulation layer on top of native functions.\r\n** =========================================================================\r\n*/\r\n\r\n#include <dlfcn.h>\r\n\r\nstatic void ll_unloadlib (void *lib) {\r\n  dlclose(lib);\r\n}\r\n\r\n\r\nstatic void *ll_load (lua_State *L, const char *path, int seeglb) {\r\n  void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL));\r\n  if (lib == NULL) lua_pushstring(L, dlerror());\r\n  return lib;\r\n}\r\n\r\n\r\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\r\n  lua_CFunction f = (lua_CFunction)dlsym(lib, sym);\r\n  if (f == NULL) lua_pushstring(L, dlerror());\r\n  return f;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n#elif defined(LUA_DL_DLL)\r\n/*\r\n** {======================================================================\r\n** This is an implementation of loadlib for Windows using native functions.\r\n** =======================================================================\r\n*/\r\n\r\n#undef setprogdir\r\n\r\n/*\r\n** optional flags for LoadLibraryEx\r\n*/\r\n#if !defined(LUA_LLE_FLAGS)\r\n#define LUA_LLE_FLAGS\t0\r\n#endif\r\n\r\n\r\nstatic void setprogdir (lua_State *L) {\r\n  char buff[MAX_PATH + 1];\r\n  char *lb;\r\n  DWORD nsize = sizeof(buff)/sizeof(char);\r\n  DWORD n = GetModuleFileNameA(NULL, buff, nsize);\r\n  if (n == 0 || n == nsize || (lb = strrchr(buff, '\\\\')) == NULL)\r\n    luaL_error(L, \"unable to get ModuleFileName\");\r\n  else {\r\n    *lb = '\\0';\r\n    luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff);\r\n    lua_remove(L, -2);  /* remove original string */\r\n  }\r\n}\r\n\r\n\r\nstatic void pusherror (lua_State *L) {\r\n  int error = GetLastError();\r\n  char buffer[128];\r\n  if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,\r\n      NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))\r\n    lua_pushstring(L, buffer);\r\n  else\r\n    lua_pushfstring(L, \"system error %d\\n\", error);\r\n}\r\n\r\nstatic void ll_unloadlib (void *lib) {\r\n  FreeLibrary((HMODULE)lib);\r\n}\r\n\r\n\r\nstatic void *ll_load (lua_State *L, const char *path, int seeglb) {\r\n  HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS);\r\n  (void)(seeglb);  /* not used: symbols are 'global' by default */\r\n  if (lib == NULL) pusherror(L);\r\n  return lib;\r\n}\r\n\r\n\r\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\r\n  lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym);\r\n  if (f == NULL) pusherror(L);\r\n  return f;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n#else\r\n/*\r\n** {======================================================\r\n** Fallback for other systems\r\n** =======================================================\r\n*/\r\n\r\n#undef LIB_FAIL\r\n#define LIB_FAIL\t\"absent\"\r\n\r\n\r\n#define DLMSG\t\"dynamic libraries not enabled; check your Lua installation\"\r\n\r\n\r\nstatic void ll_unloadlib (void *lib) {\r\n  (void)(lib);  /* not used */\r\n}\r\n\r\n\r\nstatic void *ll_load (lua_State *L, const char *path, int seeglb) {\r\n  (void)(path); (void)(seeglb);  /* not used */\r\n  lua_pushliteral(L, DLMSG);\r\n  return NULL;\r\n}\r\n\r\n\r\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\r\n  (void)(lib); (void)(sym);  /* not used */\r\n  lua_pushliteral(L, DLMSG);\r\n  return NULL;\r\n}\r\n\r\n/* }====================================================== */\r\n#endif\r\n\r\n\r\n\r\nstatic void **ll_register (lua_State *L, const char *path) {\r\n  void **plib;\r\n  lua_pushfstring(L, \"%s%s\", LIBPREFIX, path);\r\n  lua_gettable(L, LUA_REGISTRYINDEX);  /* check library in registry? */\r\n  if (!lua_isnil(L, -1))  /* is there an entry? */\r\n    plib = (void **)lua_touserdata(L, -1);\r\n  else {  /* no entry yet; create one */\r\n    lua_pop(L, 1);  /* remove result from gettable */\r\n    plib = (void **)lua_newuserdata(L, sizeof(const void *));\r\n    *plib = NULL;\r\n    luaL_setmetatable(L, \"_LOADLIB\");\r\n    lua_pushfstring(L, \"%s%s\", LIBPREFIX, path);\r\n    lua_pushvalue(L, -2);\r\n    lua_settable(L, LUA_REGISTRYINDEX);\r\n  }\r\n  return plib;\r\n}\r\n\r\n\r\n/*\r\n** __gc tag method: calls library's `ll_unloadlib' function with the lib\r\n** handle\r\n*/\r\nstatic int gctm (lua_State *L) {\r\n  void **lib = (void **)luaL_checkudata(L, 1, \"_LOADLIB\");\r\n  if (*lib) ll_unloadlib(*lib);\r\n  *lib = NULL;  /* mark library as closed */\r\n  return 0;\r\n}\r\n\r\n\r\nstatic int ll_loadfunc (lua_State *L, const char *path, const char *sym) {\r\n  void **reg = ll_register(L, path);\r\n  if (*reg == NULL) *reg = ll_load(L, path, *sym == '*');\r\n  if (*reg == NULL) return ERRLIB;  /* unable to load library */\r\n  if (*sym == '*') {  /* loading only library (no function)? */\r\n    lua_pushboolean(L, 1);  /* return 'true' */\r\n    return 0;  /* no errors */\r\n  }\r\n  else {\r\n    lua_CFunction f = ll_sym(L, *reg, sym);\r\n    if (f == NULL)\r\n      return ERRFUNC;  /* unable to find function */\r\n    lua_pushcfunction(L, f);  /* else create new function */\r\n    return 0;  /* no errors */\r\n  }\r\n}\r\n\r\n\r\nstatic int ll_loadlib (lua_State *L) {\r\n  const char *path = luaL_checkstring(L, 1);\r\n  const char *init = luaL_checkstring(L, 2);\r\n  int stat = ll_loadfunc(L, path, init);\r\n  if (stat == 0)  /* no errors? */\r\n    return 1;  /* return the loaded function */\r\n  else {  /* error; error message is on stack top */\r\n    lua_pushnil(L);\r\n    lua_insert(L, -2);\r\n    lua_pushstring(L, (stat == ERRLIB) ?  LIB_FAIL : \"init\");\r\n    return 3;  /* return nil, error message, and where */\r\n  }\r\n}\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** 'require' function\r\n** =======================================================\r\n*/\r\n\r\n\r\nstatic int readable (const char *filename) {\r\n  FILE *f = fopen(filename, \"r\");  /* try to open file */\r\n  if (f == NULL) return 0;  /* open failed */\r\n  fclose(f);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic const char *pushnexttemplate (lua_State *L, const char *path) {\r\n  const char *l;\r\n  while (*path == *LUA_PATH_SEP) path++;  /* skip separators */\r\n  if (*path == '\\0') return NULL;  /* no more templates */\r\n  l = strchr(path, *LUA_PATH_SEP);  /* find next separator */\r\n  if (l == NULL) l = path + strlen(path);\r\n  lua_pushlstring(L, path, l - path);  /* template */\r\n  return l;\r\n}\r\n\r\n\r\nstatic const char *searchpath (lua_State *L, const char *name,\r\n                                             const char *path,\r\n                                             const char *sep,\r\n                                             const char *dirsep) {\r\n  luaL_Buffer msg;  /* to build error message */\r\n  luaL_buffinit(L, &msg);\r\n  if (*sep != '\\0')  /* non-empty separator? */\r\n    name = luaL_gsub(L, name, sep, dirsep);  /* replace it by 'dirsep' */\r\n  while ((path = pushnexttemplate(L, path)) != NULL) {\r\n    const char *filename = luaL_gsub(L, lua_tostring(L, -1),\r\n                                     LUA_PATH_MARK, name);\r\n    lua_remove(L, -2);  /* remove path template */\r\n    if (readable(filename))  /* does file exist and is readable? */\r\n      return filename;  /* return that file name */\r\n    lua_pushfstring(L, \"\\n\\tno file \" LUA_QS, filename);\r\n    lua_remove(L, -2);  /* remove file name */\r\n    luaL_addvalue(&msg);  /* concatenate error msg. entry */\r\n  }\r\n  luaL_pushresult(&msg);  /* create error message */\r\n  return NULL;  /* not found */\r\n}\r\n\r\n\r\nstatic int ll_searchpath (lua_State *L) {\r\n  const char *f = searchpath(L, luaL_checkstring(L, 1),\r\n                                luaL_checkstring(L, 2),\r\n                                luaL_optstring(L, 3, \".\"),\r\n                                luaL_optstring(L, 4, LUA_DIRSEP));\r\n  if (f != NULL) return 1;\r\n  else {  /* error message is on top of the stack */\r\n    lua_pushnil(L);\r\n    lua_insert(L, -2);\r\n    return 2;  /* return nil + error message */\r\n  }\r\n}\r\n\r\n\r\nstatic const char *findfile (lua_State *L, const char *name,\r\n                                           const char *pname,\r\n                                           const char *dirsep) {\r\n  const char *path;\r\n  lua_getfield(L, lua_upvalueindex(1), pname);\r\n  path = lua_tostring(L, -1);\r\n  if (path == NULL)\r\n    luaL_error(L, LUA_QL(\"package.%s\") \" must be a string\", pname);\r\n  return searchpath(L, name, path, \".\", dirsep);\r\n}\r\n\r\n\r\nstatic int checkload (lua_State *L, int stat, const char *filename) {\r\n  if (stat) {  /* module loaded successfully? */\r\n    lua_pushstring(L, filename);  /* will be 2nd argument to module */\r\n    return 2;  /* return open function and file name */\r\n  }\r\n  else\r\n    return luaL_error(L, \"error loading module \" LUA_QS\r\n                         \" from file \" LUA_QS \":\\n\\t%s\",\r\n                          lua_tostring(L, 1), filename, lua_tostring(L, -1));\r\n}\r\n\r\n\r\nstatic int searcher_Lua (lua_State *L) {\r\n  const char *filename;\r\n  const char *name = luaL_checkstring(L, 1);\r\n  filename = findfile(L, name, \"path\", LUA_LSUBSEP);\r\n  if (filename == NULL) return 1;  /* module not found in this path */\r\n  return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename);\r\n}\r\n\r\n\r\nstatic int loadfunc (lua_State *L, const char *filename, const char *modname) {\r\n  const char *funcname;\r\n  const char *mark;\r\n  modname = luaL_gsub(L, modname, \".\", LUA_OFSEP);\r\n  mark = strchr(modname, *LUA_IGMARK);\r\n  if (mark) {\r\n    int stat;\r\n    funcname = lua_pushlstring(L, modname, mark - modname);\r\n    funcname = lua_pushfstring(L, POF\"%s\", funcname);\r\n    stat = ll_loadfunc(L, filename, funcname);\r\n    if (stat != ERRFUNC) return stat;\r\n    modname = mark + 1;  /* else go ahead and try old-style name */\r\n  }\r\n  funcname = lua_pushfstring(L, POF\"%s\", modname);\r\n  return ll_loadfunc(L, filename, funcname);\r\n}\r\n\r\n\r\nstatic int searcher_C (lua_State *L) {\r\n  const char *name = luaL_checkstring(L, 1);\r\n  const char *filename = findfile(L, name, \"cpath\", LUA_CSUBSEP);\r\n  if (filename == NULL) return 1;  /* module not found in this path */\r\n  return checkload(L, (loadfunc(L, filename, name) == 0), filename);\r\n}\r\n\r\n\r\nstatic int searcher_Croot (lua_State *L) {\r\n  const char *filename;\r\n  const char *name = luaL_checkstring(L, 1);\r\n  const char *p = strchr(name, '.');\r\n  int stat;\r\n  if (p == NULL) return 0;  /* is root */\r\n  lua_pushlstring(L, name, p - name);\r\n  filename = findfile(L, lua_tostring(L, -1), \"cpath\", LUA_CSUBSEP);\r\n  if (filename == NULL) return 1;  /* root not found */\r\n  if ((stat = loadfunc(L, filename, name)) != 0) {\r\n    if (stat != ERRFUNC)\r\n      return checkload(L, 0, filename);  /* real error */\r\n    else {  /* open function not found */\r\n      lua_pushfstring(L, \"\\n\\tno module \" LUA_QS \" in file \" LUA_QS,\r\n                         name, filename);\r\n      return 1;\r\n    }\r\n  }\r\n  lua_pushstring(L, filename);  /* will be 2nd argument to module */\r\n  return 2;\r\n}\r\n\r\n\r\nstatic int searcher_preload (lua_State *L) {\r\n  const char *name = luaL_checkstring(L, 1);\r\n  lua_getfield(L, LUA_REGISTRYINDEX, \"_PRELOAD\");\r\n  lua_getfield(L, -1, name);\r\n  if (lua_isnil(L, -1))  /* not found? */\r\n    lua_pushfstring(L, \"\\n\\tno field package.preload['%s']\", name);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic void findloader (lua_State *L, const char *name) {\r\n  int i;\r\n  luaL_Buffer msg;  /* to build error message */\r\n  luaL_buffinit(L, &msg);\r\n  lua_getfield(L, lua_upvalueindex(1), \"searchers\");  /* will be at index 3 */\r\n  if (!lua_istable(L, 3))\r\n    luaL_error(L, LUA_QL(\"package.searchers\") \" must be a table\");\r\n  /*  iterate over available seachers to find a loader */\r\n  for (i = 1; ; i++) {\r\n    lua_rawgeti(L, 3, i);  /* get a seacher */\r\n    if (lua_isnil(L, -1)) {  /* no more searchers? */\r\n      lua_pop(L, 1);  /* remove nil */\r\n      luaL_pushresult(&msg);  /* create error message */\r\n      luaL_error(L, \"module \" LUA_QS \" not found:%s\",\r\n                    name, lua_tostring(L, -1));\r\n    }\r\n    lua_pushstring(L, name);\r\n    lua_call(L, 1, 2);  /* call it */\r\n    if (lua_isfunction(L, -2))  /* did it find a loader? */\r\n      return;  /* module loader found */\r\n    else if (lua_isstring(L, -2)) {  /* searcher returned error message? */\r\n      lua_pop(L, 1);  /* remove extra return */\r\n      luaL_addvalue(&msg);  /* concatenate error message */\r\n    }\r\n    else\r\n      lua_pop(L, 2);  /* remove both returns */\r\n  }\r\n}\r\n\r\n\r\nstatic int ll_require (lua_State *L) {\r\n  const char *name = luaL_checkstring(L, 1);\r\n  lua_settop(L, 1);  /* _LOADED table will be at index 2 */\r\n  lua_getfield(L, LUA_REGISTRYINDEX, \"_LOADED\");\r\n  lua_getfield(L, 2, name);  /* _LOADED[name] */\r\n  if (lua_toboolean(L, -1))  /* is it there? */\r\n    return 1;  /* package is already loaded */\r\n  /* else must load package */\r\n  lua_pop(L, 1);  /* remove 'getfield' result */\r\n  findloader(L, name);\r\n  lua_pushstring(L, name);  /* pass name as argument to module loader */\r\n  lua_insert(L, -2);  /* name is 1st argument (before search data) */\r\n  lua_call(L, 2, 1);  /* run loader to load module */\r\n  if (!lua_isnil(L, -1))  /* non-nil return? */\r\n    lua_setfield(L, 2, name);  /* _LOADED[name] = returned value */\r\n  lua_getfield(L, 2, name);\r\n  if (lua_isnil(L, -1)) {   /* module did not set a value? */\r\n    lua_pushboolean(L, 1);  /* use true as result */\r\n    lua_pushvalue(L, -1);  /* extra copy to be returned */\r\n    lua_setfield(L, 2, name);  /* _LOADED[name] = true */\r\n  }\r\n  return 1;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** 'module' function\r\n** =======================================================\r\n*/\r\n#if defined(LUA_COMPAT_MODULE)\r\n\r\n/*\r\n** changes the environment variable of calling function\r\n*/\r\nstatic void set_env (lua_State *L) {\r\n  lua_Debug ar;\r\n  if (lua_getstack(L, 1, &ar) == 0 ||\r\n      lua_getinfo(L, \"f\", &ar) == 0 ||  /* get calling function */\r\n      lua_iscfunction(L, -1))\r\n    luaL_error(L, LUA_QL(\"module\") \" not called from a Lua function\");\r\n  lua_pushvalue(L, -2);  /* copy new environment table to top */\r\n  lua_setupvalue(L, -2, 1);\r\n  lua_pop(L, 1);  /* remove function */\r\n}\r\n\r\n\r\nstatic void dooptions (lua_State *L, int n) {\r\n  int i;\r\n  for (i = 2; i <= n; i++) {\r\n    if (lua_isfunction(L, i)) {  /* avoid 'calling' extra info. */\r\n      lua_pushvalue(L, i);  /* get option (a function) */\r\n      lua_pushvalue(L, -2);  /* module */\r\n      lua_call(L, 1, 0);\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void modinit (lua_State *L, const char *modname) {\r\n  const char *dot;\r\n  lua_pushvalue(L, -1);\r\n  lua_setfield(L, -2, \"_M\");  /* module._M = module */\r\n  lua_pushstring(L, modname);\r\n  lua_setfield(L, -2, \"_NAME\");\r\n  dot = strrchr(modname, '.');  /* look for last dot in module name */\r\n  if (dot == NULL) dot = modname;\r\n  else dot++;\r\n  /* set _PACKAGE as package name (full module name minus last part) */\r\n  lua_pushlstring(L, modname, dot - modname);\r\n  lua_setfield(L, -2, \"_PACKAGE\");\r\n}\r\n\r\n\r\nstatic int ll_module (lua_State *L) {\r\n  const char *modname = luaL_checkstring(L, 1);\r\n  int lastarg = lua_gettop(L);  /* last parameter */\r\n  luaL_pushmodule(L, modname, 1);  /* get/create module table */\r\n  /* check whether table already has a _NAME field */\r\n  lua_getfield(L, -1, \"_NAME\");\r\n  if (!lua_isnil(L, -1))  /* is table an initialized module? */\r\n    lua_pop(L, 1);\r\n  else {  /* no; initialize it */\r\n    lua_pop(L, 1);\r\n    modinit(L, modname);\r\n  }\r\n  lua_pushvalue(L, -1);\r\n  set_env(L);\r\n  dooptions(L, lastarg);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int ll_seeall (lua_State *L) {\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  if (!lua_getmetatable(L, 1)) {\r\n    lua_createtable(L, 0, 1); /* create new metatable */\r\n    lua_pushvalue(L, -1);\r\n    lua_setmetatable(L, 1);\r\n  }\r\n  lua_pushglobaltable(L);\r\n  lua_setfield(L, -2, \"__index\");  /* mt.__index = _G */\r\n  return 0;\r\n}\r\n\r\n#endif\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/* auxiliary mark (for internal use) */\r\n#define AUXMARK\t\t\"\\1\"\r\n\r\n\r\n/*\r\n** return registry.LUA_NOENV as a boolean\r\n*/\r\nstatic int noenv (lua_State *L) {\r\n  int b;\r\n  lua_getfield(L, LUA_REGISTRYINDEX, \"LUA_NOENV\");\r\n  b = lua_toboolean(L, -1);\r\n  lua_pop(L, 1);  /* remove value */\r\n  return b;\r\n}\r\n\r\n\r\nstatic void setpath (lua_State *L, const char *fieldname, const char *envname1,\r\n                                   const char *envname2, const char *def) {\r\n  const char *path = getenv(envname1);\r\n  if (path == NULL)  /* no environment variable? */\r\n    path = getenv(envname2);  /* try alternative name */\r\n  if (path == NULL || noenv(L))  /* no environment variable? */\r\n    lua_pushstring(L, def);  /* use default */\r\n  else {\r\n    /* replace \";;\" by \";AUXMARK;\" and then AUXMARK by default path */\r\n    path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,\r\n                              LUA_PATH_SEP AUXMARK LUA_PATH_SEP);\r\n    luaL_gsub(L, path, AUXMARK, def);\r\n    lua_remove(L, -2);\r\n  }\r\n  setprogdir(L);\r\n  lua_setfield(L, -2, fieldname);\r\n}\r\n\r\n\r\nstatic const luaL_Reg pk_funcs[] = {\r\n  {\"loadlib\", ll_loadlib},\r\n  {\"searchpath\", ll_searchpath},\r\n#if defined(LUA_COMPAT_MODULE)\r\n  {\"seeall\", ll_seeall},\r\n#endif\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nstatic const luaL_Reg ll_funcs[] = {\r\n#if defined(LUA_COMPAT_MODULE)\r\n  {\"module\", ll_module},\r\n#endif\r\n  {\"require\", ll_require},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nstatic const lua_CFunction searchers[] =\r\n  {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL};\r\n\r\n\r\nLUAMOD_API int luaopen_package (lua_State *L) {\r\n  int i;\r\n  /* create new type _LOADLIB */\r\n  luaL_newmetatable(L, \"_LOADLIB\");\r\n  lua_pushcfunction(L, gctm);\r\n  lua_setfield(L, -2, \"__gc\");\r\n  /* create `package' table */\r\n  luaL_newlib(L, pk_funcs);\r\n  /* create 'searchers' table */\r\n  lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0);\r\n  /* fill it with pre-defined searchers */\r\n  for (i=0; searchers[i] != NULL; i++) {\r\n    lua_pushvalue(L, -2);  /* set 'package' as upvalue for all searchers */\r\n    lua_pushcclosure(L, searchers[i], 1);\r\n    lua_rawseti(L, -2, i+1);\r\n  }\r\n#if defined(LUA_COMPAT_LOADERS)\r\n  lua_pushvalue(L, -1);  /* make a copy of 'searchers' table */\r\n  lua_setfield(L, -3, \"loaders\");  /* put it in field `loaders' */\r\n#endif\r\n  lua_setfield(L, -2, \"searchers\");  /* put it in field 'searchers' */\r\n  /* set field 'path' */\r\n  setpath(L, \"path\", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT);\r\n  /* set field 'cpath' */\r\n  setpath(L, \"cpath\", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT);\r\n  /* store config information */\r\n  lua_pushliteral(L, LUA_DIRSEP \"\\n\" LUA_PATH_SEP \"\\n\" LUA_PATH_MARK \"\\n\"\r\n                     LUA_EXEC_DIR \"\\n\" LUA_IGMARK \"\\n\");\r\n  lua_setfield(L, -2, \"config\");\r\n  /* set field `loaded' */\r\n  luaL_getsubtable(L, LUA_REGISTRYINDEX, \"_LOADED\");\r\n  lua_setfield(L, -2, \"loaded\");\r\n  /* set field `preload' */\r\n  luaL_getsubtable(L, LUA_REGISTRYINDEX, \"_PRELOAD\");\r\n  lua_setfield(L, -2, \"preload\");\r\n  lua_pushglobaltable(L);\r\n  lua_pushvalue(L, -2);  /* set 'package' as upvalue for next lib */\r\n  luaL_setfuncs(L, ll_funcs, 1);  /* open lib into global table */\r\n  lua_pop(L, 1);  /* pop global table */\r\n  return 1;  /* return 'package' table */\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lobject.c",
    "content": "/*\r\n** $Id: lobject.c,v 2.55 2011/11/30 19:30:16 roberto Exp $\r\n** Some generic functions over Lua objects\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#include <stdarg.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define lobject_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lctype.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"lvm.h\"\r\n\r\n\r\n\r\nLUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT};\r\n\r\n\r\n/*\r\n** converts an integer to a \"floating point byte\", represented as\r\n** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if\r\n** eeeee != 0 and (xxx) otherwise.\r\n*/\r\nint luaO_int2fb (unsigned int x) {\r\n  int e = 0;  /* exponent */\r\n  if (x < 8) return x;\r\n  while (x >= 0x10) {\r\n    x = (x+1) >> 1;\r\n    e++;\r\n  }\r\n  return ((e+1) << 3) | (cast_int(x) - 8);\r\n}\r\n\r\n\r\n/* converts back */\r\nint luaO_fb2int (int x) {\r\n  int e = (x >> 3) & 0x1f;\r\n  if (e == 0) return x;\r\n  else return ((x & 7) + 8) << (e - 1);\r\n}\r\n\r\n\r\nint luaO_ceillog2 (unsigned int x) {\r\n  static const lu_byte log_2[256] = {\r\n    0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\r\n    6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\r\n    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\r\n    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\r\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\r\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\r\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\r\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8\r\n  };\r\n  int l = 0;\r\n  x--;\r\n  while (x >= 256) { l += 8; x >>= 8; }\r\n  return l + log_2[x];\r\n}\r\n\r\n\r\nlua_Number luaO_arith (int op, lua_Number v1, lua_Number v2) {\r\n  switch (op) {\r\n    case LUA_OPADD: return luai_numadd(NULL, v1, v2);\r\n    case LUA_OPSUB: return luai_numsub(NULL, v1, v2);\r\n    case LUA_OPMUL: return luai_nummul(NULL, v1, v2);\r\n    case LUA_OPDIV: return luai_numdiv(NULL, v1, v2);\r\n    case LUA_OPMOD: return luai_nummod(NULL, v1, v2);\r\n    case LUA_OPPOW: return luai_numpow(NULL, v1, v2);\r\n    case LUA_OPUNM: return luai_numunm(NULL, v1);\r\n    default: lua_assert(0); return 0;\r\n  }\r\n}\r\n\r\n\r\nint luaO_hexavalue (int c) {\r\n  if (lisdigit(c)) return c - '0';\r\n  else return ltolower(c) - 'a' + 10;\r\n}\r\n\r\n\r\n#if !defined(lua_strx2number)\r\n\r\n#include <math.h>\r\n\r\n\r\nstatic int isneg (const char **s) {\r\n  if (**s == '-') { (*s)++; return 1; }\r\n  else if (**s == '+') (*s)++;\r\n  return 0;\r\n}\r\n\r\n\r\nstatic lua_Number readhexa (const char **s, lua_Number r, int *count) {\r\n  for (; lisxdigit(cast_uchar(**s)); (*s)++) {  /* read integer part */\r\n    r = (r * 16.0) + cast_num(luaO_hexavalue(cast_uchar(**s)));\r\n    (*count)++;\r\n  }\r\n  return r;\r\n}\r\n\r\n\r\n/*\r\n** convert an hexadecimal numeric string to a number, following\r\n** C99 specification for 'strtod'\r\n*/\r\nstatic lua_Number lua_strx2number (const char *s, char **endptr) {\r\n  lua_Number r = 0.0;\r\n  int e = 0, i = 0;\r\n  int neg = 0;  /* 1 if number is negative */\r\n  *endptr = cast(char *, s);  /* nothing is valid yet */\r\n  while (lisspace(cast_uchar(*s))) s++;  /* skip initial spaces */\r\n  neg = isneg(&s);  /* check signal */\r\n  if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')))  /* check '0x' */\r\n    return 0.0;  /* invalid format (no '0x') */\r\n  s += 2;  /* skip '0x' */\r\n  r = readhexa(&s, r, &i);  /* read integer part */\r\n  if (*s == '.') {\r\n    s++;  /* skip dot */\r\n    r = readhexa(&s, r, &e);  /* read fractional part */\r\n  }\r\n  if (i == 0 && e == 0)\r\n    return 0.0;  /* invalid format (no digit) */\r\n  e *= -4;  /* each fractional digit divides value by 2^-4 */\r\n  *endptr = cast(char *, s);  /* valid up to here */\r\n  if (*s == 'p' || *s == 'P') {  /* exponent part? */\r\n    int exp1 = 0;\r\n    int neg1;\r\n    s++;  /* skip 'p' */\r\n    neg1 = isneg(&s);  /* signal */\r\n    if (!lisdigit(cast_uchar(*s)))\r\n      goto ret;  /* must have at least one digit */\r\n    while (lisdigit(cast_uchar(*s)))  /* read exponent */\r\n      exp1 = exp1 * 10 + *(s++) - '0';\r\n    if (neg1) exp1 = -exp1;\r\n    e += exp1;\r\n  }\r\n  *endptr = cast(char *, s);  /* valid up to here */\r\n ret:\r\n  if (neg) r = -r;\r\n  return ldexp(r, e);\r\n}\r\n\r\n#endif\r\n\r\n\r\nint luaO_str2d (const char *s, size_t len, lua_Number *result) {\r\n  char *endptr;\r\n  if (strpbrk(s, \"nN\"))  /* reject 'inf' and 'nan' */\r\n    return 0;\r\n  else if (strpbrk(s, \"xX\"))  /* hexa? */\r\n    *result = lua_strx2number(s, &endptr);\r\n  else\r\n    *result = lua_str2number(s, &endptr);\r\n  if (endptr == s) return 0;  /* nothing recognized */\r\n  while (lisspace(cast_uchar(*endptr))) endptr++;\r\n  return (endptr == s + len);  /* OK if no trailing characters */\r\n}\r\n\r\n\r\n\r\nstatic void pushstr (lua_State *L, const char *str, size_t l) {\r\n  setsvalue2s(L, L->top, luaS_newlstr(L, str, l));\r\n  incr_top(L);\r\n}\r\n\r\n\r\n/* this function handles only `%d', `%c', %f, %p, and `%s' formats */\r\nconst char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {\r\n  int n = 0;\r\n  for (;;) {\r\n    const char *e = strchr(fmt, '%');\r\n    if (e == NULL) break;\r\n    setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt));\r\n    incr_top(L);\r\n    switch (*(e+1)) {\r\n      case 's': {\r\n        const char *s = va_arg(argp, char *);\r\n        if (s == NULL) s = \"(null)\";\r\n        pushstr(L, s, strlen(s));\r\n        break;\r\n      }\r\n      case 'c': {\r\n        char buff;\r\n        buff = cast(char, va_arg(argp, int));\r\n        pushstr(L, &buff, 1);\r\n        break;\r\n      }\r\n      case 'd': {\r\n        setnvalue(L->top, cast_num(va_arg(argp, int)));\r\n        incr_top(L);\r\n        break;\r\n      }\r\n      case 'f': {\r\n        setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber)));\r\n        incr_top(L);\r\n        break;\r\n      }\r\n      case 'p': {\r\n        char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */\r\n        int l = sprintf(buff, \"%p\", va_arg(argp, void *));\r\n        pushstr(L, buff, l);\r\n        break;\r\n      }\r\n      case '%': {\r\n        pushstr(L, \"%\", 1);\r\n        break;\r\n      }\r\n      default: {\r\n        luaG_runerror(L,\r\n            \"invalid option \" LUA_QL(\"%%%c\") \" to \" LUA_QL(\"lua_pushfstring\"),\r\n            *(e + 1));\r\n      }\r\n    }\r\n    n += 2;\r\n    fmt = e+2;\r\n  }\r\n  pushstr(L, fmt, strlen(fmt));\r\n  if (n > 0) luaV_concat(L, n + 1);\r\n  return svalue(L->top - 1);\r\n}\r\n\r\n\r\nconst char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {\r\n  const char *msg;\r\n  va_list argp;\r\n  va_start(argp, fmt);\r\n  msg = luaO_pushvfstring(L, fmt, argp);\r\n  va_end(argp);\r\n  return msg;\r\n}\r\n\r\n\r\n/* number of chars of a literal string without the ending \\0 */\r\n#define LL(x)\t(sizeof(x)/sizeof(char) - 1)\r\n\r\n#define RETS\t\"...\"\r\n#define PRE\t\"[string \\\"\"\r\n#define POS\t\"\\\"]\"\r\n\r\n#define addstr(a,b,l)\t( memcpy(a,b,(l) * sizeof(char)), a += (l) )\r\n\r\nvoid luaO_chunkid (char *out, const char *source, size_t bufflen) {\r\n  size_t l = strlen(source);\r\n  if (*source == '=') {  /* 'literal' source */\r\n    if (l <= bufflen)  /* small enough? */\r\n      memcpy(out, source + 1, l * sizeof(char));\r\n    else {  /* truncate it */\r\n      addstr(out, source + 1, bufflen - 1);\r\n      *out = '\\0';\r\n    }\r\n  }\r\n  else if (*source == '@') {  /* file name */\r\n    if (l <= bufflen)  /* small enough? */\r\n      memcpy(out, source + 1, l * sizeof(char));\r\n    else {  /* add '...' before rest of name */\r\n      addstr(out, RETS, LL(RETS));\r\n      bufflen -= LL(RETS);\r\n      memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char));\r\n    }\r\n  }\r\n  else {  /* string; format as [string \"source\"] */\r\n    const char *nl = strchr(source, '\\n');  /* find first new line (if any) */\r\n    addstr(out, PRE, LL(PRE));  /* add prefix */\r\n    bufflen -= LL(PRE RETS POS) + 1;  /* save space for prefix+suffix+'\\0' */\r\n    if (l < bufflen && nl == NULL) {  /* small one-line source? */\r\n      addstr(out, source, l);  /* keep it */\r\n    }\r\n    else {\r\n      if (nl != NULL) l = nl - source;  /* stop at first newline */\r\n      if (l > bufflen) l = bufflen;\r\n      addstr(out, source, l);\r\n      addstr(out, RETS, LL(RETS));\r\n    }\r\n    memcpy(out, POS, (LL(POS) + 1) * sizeof(char));\r\n  }\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lobject.h",
    "content": "/*\r\n** $Id: lobject.h,v 2.64 2011/10/31 17:48:22 roberto Exp $\r\n** Type definitions for Lua objects\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#ifndef lobject_h\r\n#define lobject_h\r\n\r\n\r\n#include <stdarg.h>\r\n\r\n\r\n#include \"llimits.h\"\r\n#include \"lua.h\"\r\n\r\n\r\n/*\r\n** Extra tags for non-values\r\n*/\r\n#define LUA_TPROTO\tLUA_NUMTAGS\r\n#define LUA_TUPVAL\t(LUA_NUMTAGS+1)\r\n#define LUA_TDEADKEY\t(LUA_NUMTAGS+2)\r\n\r\n/*\r\n** number of all possible tags (including LUA_TNONE but excluding DEADKEY)\r\n*/\r\n#define LUA_TOTALTAGS\t(LUA_TUPVAL+2)\r\n\r\n\r\n/*\r\n** tags for Tagged Values have the following use of bits:\r\n** bits 0-3: actual tag (a LUA_T* value)\r\n** bits 4-5: variant bits\r\n** bit 6: whether value is collectable\r\n*/\r\n\r\n/*\r\n** LUA_TFUNCTION variants:\r\n** 0 - Lua function\r\n** 1 - light C function\r\n** 2 - regular C function (closure)\r\n*/\r\n\r\n/* Variant tags for functions */\r\n#define LUA_TLCL\t(LUA_TFUNCTION | (0 << 4))  /* Lua closure */\r\n#define LUA_TLCF\t(LUA_TFUNCTION | (1 << 4))  /* light C function */\r\n#define LUA_TCCL\t(LUA_TFUNCTION | (2 << 4))  /* C closure */\r\n\r\n\r\n/* Bit mark for collectable types */\r\n#define BIT_ISCOLLECTABLE\t(1 << 6)\r\n\r\n/* mark a tag as collectable */\r\n#define ctb(t)\t\t\t((t) | BIT_ISCOLLECTABLE)\r\n\r\n\r\n/*\r\n** Union of all collectable objects\r\n*/\r\ntypedef union GCObject GCObject;\r\n\r\n\r\n/*\r\n** Common Header for all collectable objects (in macro form, to be\r\n** included in other objects)\r\n*/\r\n#define CommonHeader\tGCObject *next; lu_byte tt; lu_byte marked\r\n\r\n\r\n/*\r\n** Common header in struct form\r\n*/\r\ntypedef struct GCheader {\r\n  CommonHeader;\r\n} GCheader;\r\n\r\n\r\n\r\n/*\r\n** Union of all Lua values\r\n*/\r\ntypedef union Value Value;\r\n\r\n\r\n#define numfield\tlua_Number n;    /* numbers */\r\n\r\n\r\n\r\n/*\r\n** Tagged Values. This is the basic representation of values in Lua,\r\n** an actual value plus a tag with its type.\r\n*/\r\n\r\n#define TValuefields\tValue value_; int tt_\r\n\r\ntypedef struct lua_TValue TValue;\r\n\r\n\r\n/* macro defining a nil value */\r\n#define NILCONSTANT\t{NULL}, LUA_TNIL\r\n\r\n\r\n#define val_(o)\t\t((o)->value_)\r\n#define num_(o)\t\t(val_(o).n)\r\n\r\n\r\n/* raw type tag of a TValue */\r\n#define rttype(o)\t((o)->tt_)\r\n\r\n/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */\r\n#define ttype(o)\t(rttype(o) & 0x3F)\r\n\r\n\r\n/* type tag of a TValue with no variants (bits 0-3) */\r\n#define ttypenv(o)\t(rttype(o) & 0x0F)\r\n\r\n\r\n/* Macros to test type */\r\n#define checktag(o,t)\t\t(rttype(o) == (t))\r\n#define ttisnumber(o)\t\tchecktag((o), LUA_TNUMBER)\r\n#define ttisnil(o)\t\tchecktag((o), LUA_TNIL)\r\n#define ttisboolean(o)\t\tchecktag((o), LUA_TBOOLEAN)\r\n#define ttislightuserdata(o)\tchecktag((o), LUA_TLIGHTUSERDATA)\r\n#define ttisstring(o)\t\tchecktag((o), ctb(LUA_TSTRING))\r\n#define ttistable(o)\t\tchecktag((o), ctb(LUA_TTABLE))\r\n#define ttisfunction(o)\t\t(ttypenv(o) == LUA_TFUNCTION)\r\n#define ttisclosure(o)\t\t((rttype(o) & 0x1F) == LUA_TFUNCTION)\r\n#define ttisCclosure(o)\t\tchecktag((o), ctb(LUA_TCCL))\r\n#define ttisLclosure(o)\t\tchecktag((o), ctb(LUA_TLCL))\r\n#define ttislcf(o)\t\tchecktag((o), LUA_TLCF)\r\n#define ttisuserdata(o)\t\tchecktag((o), ctb(LUA_TUSERDATA))\r\n#define ttisthread(o)\t\tchecktag((o), ctb(LUA_TTHREAD))\r\n#define ttisdeadkey(o)\t\tchecktag((o), LUA_TDEADKEY)\r\n\r\n#define ttisequal(o1,o2)\t(rttype(o1) == rttype(o2))\r\n\r\n/* Macros to access values */\r\n#define nvalue(o)\tcheck_exp(ttisnumber(o), num_(o))\r\n#define gcvalue(o)\tcheck_exp(iscollectable(o), val_(o).gc)\r\n#define pvalue(o)\tcheck_exp(ttislightuserdata(o), val_(o).p)\r\n#define rawtsvalue(o)\tcheck_exp(ttisstring(o), &val_(o).gc->ts)\r\n#define tsvalue(o)\t(&rawtsvalue(o)->tsv)\r\n#define rawuvalue(o)\tcheck_exp(ttisuserdata(o), &val_(o).gc->u)\r\n#define uvalue(o)\t(&rawuvalue(o)->uv)\r\n#define clvalue(o)\tcheck_exp(ttisclosure(o), &val_(o).gc->cl)\r\n#define clLvalue(o)\tcheck_exp(ttisLclosure(o), &val_(o).gc->cl.l)\r\n#define clCvalue(o)\tcheck_exp(ttisCclosure(o), &val_(o).gc->cl.c)\r\n#define fvalue(o)\tcheck_exp(ttislcf(o), val_(o).f)\r\n#define hvalue(o)\tcheck_exp(ttistable(o), &val_(o).gc->h)\r\n#define bvalue(o)\tcheck_exp(ttisboolean(o), val_(o).b)\r\n#define thvalue(o)\tcheck_exp(ttisthread(o), &val_(o).gc->th)\r\n/* a dead value may get the 'gc' field, but cannot access its contents */\r\n#define deadvalue(o)\tcheck_exp(ttisdeadkey(o), cast(void *, val_(o).gc))\r\n\r\n#define l_isfalse(o)\t(ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))\r\n\r\n\r\n#define iscollectable(o)\t(rttype(o) & BIT_ISCOLLECTABLE)\r\n\r\n\r\n/* Macros for internal tests */\r\n#define righttt(obj)\t\t(ttypenv(obj) == gcvalue(obj)->gch.tt)\r\n\r\n#define checkliveness(g,obj) \\\r\n\tlua_longassert(!iscollectable(obj) || \\\r\n\t\t\t(righttt(obj) && !isdead(g,gcvalue(obj))))\r\n\r\n\r\n/* Macros to set values */\r\n#define settt_(o,t)\t((o)->tt_=(t))\r\n\r\n#define setnvalue(obj,x) \\\r\n  { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); }\r\n\r\n#define changenvalue(o,x)\tcheck_exp(ttisnumber(o), num_(o)=(x))\r\n\r\n#define setnilvalue(obj) settt_(obj, LUA_TNIL)\r\n\r\n#define setfvalue(obj,x) \\\r\n  { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); }\r\n\r\n#define setpvalue(obj,x) \\\r\n  { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); }\r\n\r\n#define setbvalue(obj,x) \\\r\n  { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); }\r\n\r\n#define setgcovalue(L,obj,x) \\\r\n  { TValue *io=(obj); GCObject *i_g=(x); \\\r\n    val_(io).gc=i_g; settt_(io, ctb(gch(i_g)->tt)); }\r\n\r\n#define setsvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TSTRING)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define setuvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TUSERDATA)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define setthvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTHREAD)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define setclLvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TLCL)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define setclCvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TCCL)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define sethvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTABLE)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define setptvalue(L,obj,x) \\\r\n  { TValue *io=(obj); \\\r\n    val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TPROTO)); \\\r\n    checkliveness(G(L),io); }\r\n\r\n#define setdeadvalue(obj)\tsettt_(obj, LUA_TDEADKEY)\r\n\r\n\r\n\r\n#define setobj(L,obj1,obj2) \\\r\n\t{ const TValue *io2=(obj2); TValue *io1=(obj1); \\\r\n\t  io1->value_ = io2->value_; io1->tt_ = io2->tt_; \\\r\n\t  checkliveness(G(L),io1); }\r\n\r\n\r\n/*\r\n** different types of assignments, according to destination\r\n*/\r\n\r\n/* from stack to (same) stack */\r\n#define setobjs2s\tsetobj\r\n/* to stack (not from same stack) */\r\n#define setobj2s\tsetobj\r\n#define setsvalue2s\tsetsvalue\r\n#define sethvalue2s\tsethvalue\r\n#define setptvalue2s\tsetptvalue\r\n/* from table to same table */\r\n#define setobjt2t\tsetobj\r\n/* to table */\r\n#define setobj2t\tsetobj\r\n/* to new object */\r\n#define setobj2n\tsetobj\r\n#define setsvalue2n\tsetsvalue\r\n\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** NaN Trick\r\n** =======================================================\r\n*/\r\n\r\n#if defined(LUA_NANTRICK) \\\r\n || defined(LUA_NANTRICK_LE) \\\r\n || defined(LUA_NANTRICK_BE)\r\n\r\n/*\r\n** numbers are represented in the 'd_' field. All other values have the\r\n** value (NNMARK | tag) in 'tt__'. A number with such pattern would be\r\n** a \"signaled NaN\", which is never generated by regular operations by\r\n** the CPU (nor by 'strtod')\r\n*/\r\n#if !defined(NNMARK)\r\n#define NNMARK\t\t0x7FF7A500\r\n#define NNMASK\t\t0x7FFFFF00\r\n#endif\r\n\r\n#undef TValuefields\r\n#undef NILCONSTANT\r\n\r\n#if defined(LUA_NANTRICK_LE)\r\n\r\n/* little endian */\r\n#define TValuefields  \\\r\n\tunion { struct { Value v__; int tt__; } i; double d__; } u\r\n#define NILCONSTANT\t{{{NULL}, tag2tt(LUA_TNIL)}}\r\n/* field-access macros */\r\n#define v_(o)\t\t((o)->u.i.v__)\r\n#define d_(o)\t\t((o)->u.d__)\r\n#define tt_(o)\t\t((o)->u.i.tt__)\r\n\r\n#elif defined(LUA_NANTRICK_BE)\r\n\r\n/* big endian */\r\n#define TValuefields  \\\r\n\tunion { struct { int tt__; Value v__; } i; double d__; } u\r\n#define NILCONSTANT\t{{tag2tt(LUA_TNIL), {NULL}}}\r\n/* field-access macros */\r\n#define v_(o)\t\t((o)->u.i.v__)\r\n#define d_(o)\t\t((o)->u.d__)\r\n#define tt_(o)\t\t((o)->u.i.tt__)\r\n\r\n#elif !defined(TValuefields)\r\n#error option 'LUA_NANTRICK' needs declaration for 'TValuefields'\r\n\r\n#endif\r\n\r\n\r\n/* correspondence with standard representation */\r\n#undef val_\r\n#define val_(o)\t\tv_(o)\r\n#undef num_\r\n#define num_(o)\t\td_(o)\r\n\r\n\r\n#undef numfield\r\n#define numfield\t/* no such field; numbers are the entire struct */\r\n\r\n/* basic check to distinguish numbers from non-numbers */\r\n#undef ttisnumber\r\n#define ttisnumber(o)\t((tt_(o) & NNMASK) != NNMARK)\r\n\r\n#define tag2tt(t)\t(NNMARK | (t))\r\n\r\n#undef rttype\r\n#define rttype(o)\t(ttisnumber(o) ? LUA_TNUMBER : tt_(o) & 0xff)\r\n\r\n#undef settt_\r\n#define settt_(o,t)\t(tt_(o) = tag2tt(t))\r\n\r\n#undef setnvalue\r\n#define setnvalue(obj,x) \\\r\n\t{ TValue *io_=(obj); num_(io_)=(x); lua_assert(ttisnumber(io_)); }\r\n\r\n#undef setobj\r\n#define setobj(L,obj1,obj2) \\\r\n\t{ const TValue *o2_=(obj2); TValue *o1_=(obj1); \\\r\n\t  o1_->u = o2_->u; \\\r\n\t  checkliveness(G(L),o1_); }\r\n\r\n\r\n/*\r\n** these redefinitions are not mandatory, but these forms are more efficient\r\n*/\r\n\r\n#undef checktag\r\n#define checktag(o,t)\t(tt_(o) == tag2tt(t))\r\n\r\n#undef ttisequal\r\n#define ttisequal(o1,o2)  \\\r\n\t(ttisnumber(o1) ? ttisnumber(o2) : (tt_(o1) == tt_(o2)))\r\n\r\n\r\n\r\n#define luai_checknum(L,o,c)\t{ if (!ttisnumber(o)) c; }\r\n\r\n\r\n#else\r\n\r\n#define luai_checknum(L,o,c)\t{ /* empty */ }\r\n\r\n#endif\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** types and prototypes\r\n** =======================================================\r\n*/\r\n\r\n\r\nunion Value {\r\n  GCObject *gc;    /* collectable objects */\r\n  void *p;         /* light userdata */\r\n  int b;           /* booleans */\r\n  lua_CFunction f; /* light C functions */\r\n  numfield         /* numbers */\r\n};\r\n\r\n\r\nstruct lua_TValue {\r\n  TValuefields;\r\n};\r\n\r\n\r\ntypedef TValue *StkId;  /* index to stack elements */\r\n\r\n\r\n\r\n\r\n/*\r\n** Header for string value; string bytes follow the end of this structure\r\n*/\r\ntypedef union TString {\r\n  L_Umaxalign dummy;  /* ensures maximum alignment for strings */\r\n  struct {\r\n    CommonHeader;\r\n    lu_byte reserved;\r\n    unsigned int hash;\r\n    size_t len;  /* number of characters in string */\r\n  } tsv;\r\n} TString;\r\n\r\n\r\n/* get the actual string (array of bytes) from a TString */\r\n#define getstr(ts)\tcast(const char *, (ts) + 1)\r\n\r\n/* get the actual string (array of bytes) from a Lua value */\r\n#define svalue(o)       getstr(rawtsvalue(o))\r\n\r\n\r\n/*\r\n** Header for userdata; memory area follows the end of this structure\r\n*/\r\ntypedef union Udata {\r\n  L_Umaxalign dummy;  /* ensures maximum alignment for `local' udata */\r\n  struct {\r\n    CommonHeader;\r\n    struct Table *metatable;\r\n    struct Table *env;\r\n    size_t len;  /* number of bytes */\r\n  } uv;\r\n} Udata;\r\n\r\n\r\n\r\n/*\r\n** Description of an upvalue for function prototypes\r\n*/\r\ntypedef struct Upvaldesc {\r\n  TString *name;  /* upvalue name (for debug information) */\r\n  lu_byte instack;  /* whether it is in stack */\r\n  lu_byte idx;  /* index of upvalue (in stack or in outer function's list) */\r\n} Upvaldesc;\r\n\r\n\r\n/*\r\n** Description of a local variable for function prototypes\r\n** (used for debug information)\r\n*/\r\ntypedef struct LocVar {\r\n  TString *varname;\r\n  int startpc;  /* first point where variable is active */\r\n  int endpc;    /* first point where variable is dead */\r\n} LocVar;\r\n\r\n\r\n/*\r\n** Function Prototypes\r\n*/\r\ntypedef struct Proto {\r\n  CommonHeader;\r\n  TValue *k;  /* constants used by the function */\r\n  Instruction *code;\r\n  struct Proto **p;  /* functions defined inside the function */\r\n  int *lineinfo;  /* map from opcodes to source lines (debug information) */\r\n  LocVar *locvars;  /* information about local variables (debug information) */\r\n  Upvaldesc *upvalues;  /* upvalue information */\r\n  union Closure *cache;  /* last created closure with this prototype */\r\n  TString  *source;  /* used for debug information */\r\n  int sizeupvalues;  /* size of 'upvalues' */\r\n  int sizek;  /* size of `k' */\r\n  int sizecode;\r\n  int sizelineinfo;\r\n  int sizep;  /* size of `p' */\r\n  int sizelocvars;\r\n  int linedefined;\r\n  int lastlinedefined;\r\n  GCObject *gclist;\r\n  lu_byte numparams;  /* number of fixed parameters */\r\n  lu_byte is_vararg;\r\n  lu_byte maxstacksize;  /* maximum stack used by this function */\r\n} Proto;\r\n\r\n\r\n\r\n/*\r\n** Lua Upvalues\r\n*/\r\ntypedef struct UpVal {\r\n  CommonHeader;\r\n  TValue *v;  /* points to stack or to its own value */\r\n  union {\r\n    TValue value;  /* the value (when closed) */\r\n    struct {  /* double linked list (when open) */\r\n      struct UpVal *prev;\r\n      struct UpVal *next;\r\n    } l;\r\n  } u;\r\n} UpVal;\r\n\r\n\r\n/*\r\n** Closures\r\n*/\r\n\r\n#define ClosureHeader \\\r\n\tCommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist\r\n\r\ntypedef struct CClosure {\r\n  ClosureHeader;\r\n  lua_CFunction f;\r\n  TValue upvalue[1];  /* list of upvalues */\r\n} CClosure;\r\n\r\n\r\ntypedef struct LClosure {\r\n  ClosureHeader;\r\n  struct Proto *p;\r\n  UpVal *upvals[1];  /* list of upvalues */\r\n} LClosure;\r\n\r\n\r\ntypedef union Closure {\r\n  CClosure c;\r\n  LClosure l;\r\n} Closure;\r\n\r\n\r\n#define isLfunction(o)\tttisLclosure(o)\r\n\r\n#define getproto(o)\t(clLvalue(o)->p)\r\n\r\n\r\n/*\r\n** Tables\r\n*/\r\n\r\ntypedef union TKey {\r\n  struct {\r\n    TValuefields;\r\n    struct Node *next;  /* for chaining */\r\n  } nk;\r\n  TValue tvk;\r\n} TKey;\r\n\r\n\r\ntypedef struct Node {\r\n  TValue i_val;\r\n  TKey i_key;\r\n} Node;\r\n\r\n\r\ntypedef struct Table {\r\n  CommonHeader;\r\n  lu_byte flags;  /* 1<<p means tagmethod(p) is not present */\r\n  lu_byte lsizenode;  /* log2 of size of `node' array */\r\n  struct Table *metatable;\r\n  TValue *array;  /* array part */\r\n  Node *node;\r\n  Node *lastfree;  /* any free position is before this position */\r\n  GCObject *gclist;\r\n  int sizearray;  /* size of `array' array */\r\n} Table;\r\n\r\n\r\n\r\n/*\r\n** `module' operation for hashing (size is always a power of 2)\r\n*/\r\n#define lmod(s,size) \\\r\n\t(check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))\r\n\r\n\r\n#define twoto(x)\t(1<<(x))\r\n#define sizenode(t)\t(twoto((t)->lsizenode))\r\n\r\n\r\n/*\r\n** (address of) a fixed nil value\r\n*/\r\n#define luaO_nilobject\t\t(&luaO_nilobject_)\r\n\r\n\r\nLUAI_DDEC const TValue luaO_nilobject_;\r\n\r\n\r\nLUAI_FUNC int luaO_int2fb (unsigned int x);\r\nLUAI_FUNC int luaO_fb2int (int x);\r\nLUAI_FUNC int luaO_ceillog2 (unsigned int x);\r\nLUAI_FUNC lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2);\r\nLUAI_FUNC int luaO_str2d (const char *s, size_t len, lua_Number *result);\r\nLUAI_FUNC int luaO_hexavalue (int c);\r\nLUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,\r\n                                                       va_list argp);\r\nLUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);\r\nLUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);\r\n\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lopcodes.c",
    "content": "/*\r\n** $Id: lopcodes.c,v 1.48 2011/04/19 16:22:13 roberto Exp $\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#define lopcodes_c\r\n#define LUA_CORE\r\n\r\n\r\n#include \"lopcodes.h\"\r\n\r\n\r\n/* ORDER OP */\r\n\r\nLUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {\r\n  \"MOVE\",\r\n  \"LOADK\",\r\n  \"LOADKX\",\r\n  \"LOADBOOL\",\r\n  \"LOADNIL\",\r\n  \"GETUPVAL\",\r\n  \"GETTABUP\",\r\n  \"GETTABLE\",\r\n  \"SETTABUP\",\r\n  \"SETUPVAL\",\r\n  \"SETTABLE\",\r\n  \"NEWTABLE\",\r\n  \"SELF\",\r\n  \"ADD\",\r\n  \"SUB\",\r\n  \"MUL\",\r\n  \"DIV\",\r\n  \"MOD\",\r\n  \"POW\",\r\n  \"UNM\",\r\n  \"NOT\",\r\n  \"LEN\",\r\n  \"CONCAT\",\r\n  \"JMP\",\r\n  \"EQ\",\r\n  \"LT\",\r\n  \"LE\",\r\n  \"TEST\",\r\n  \"TESTSET\",\r\n  \"CALL\",\r\n  \"TAILCALL\",\r\n  \"RETURN\",\r\n  \"FORLOOP\",\r\n  \"FORPREP\",\r\n  \"TFORCALL\",\r\n  \"TFORLOOP\",\r\n  \"SETLIST\",\r\n  \"CLOSURE\",\r\n  \"VARARG\",\r\n  \"EXTRAARG\",\r\n  NULL\r\n};\r\n\r\n\r\n#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))\r\n\r\nLUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {\r\n/*       T  A    B       C     mode\t\t   opcode\t*/\r\n  opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_MOVE */\r\n ,opmode(0, 1, OpArgK, OpArgN, iABx)\t\t/* OP_LOADK */\r\n ,opmode(0, 1, OpArgN, OpArgN, iABx)\t\t/* OP_LOADKX */\r\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_LOADBOOL */\r\n ,opmode(0, 1, OpArgU, OpArgN, iABC)\t\t/* OP_LOADNIL */\r\n ,opmode(0, 1, OpArgU, OpArgN, iABC)\t\t/* OP_GETUPVAL */\r\n ,opmode(0, 1, OpArgU, OpArgK, iABC)\t\t/* OP_GETTABUP */\r\n ,opmode(0, 1, OpArgR, OpArgK, iABC)\t\t/* OP_GETTABLE */\r\n ,opmode(0, 0, OpArgK, OpArgK, iABC)\t\t/* OP_SETTABUP */\r\n ,opmode(0, 0, OpArgU, OpArgN, iABC)\t\t/* OP_SETUPVAL */\r\n ,opmode(0, 0, OpArgK, OpArgK, iABC)\t\t/* OP_SETTABLE */\r\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_NEWTABLE */\r\n ,opmode(0, 1, OpArgR, OpArgK, iABC)\t\t/* OP_SELF */\r\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_ADD */\r\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_SUB */\r\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_MUL */\r\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_DIV */\r\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_MOD */\r\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_POW */\r\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_UNM */\r\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_NOT */\r\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_LEN */\r\n ,opmode(0, 1, OpArgR, OpArgR, iABC)\t\t/* OP_CONCAT */\r\n ,opmode(0, 0, OpArgR, OpArgN, iAsBx)\t\t/* OP_JMP */\r\n ,opmode(1, 0, OpArgK, OpArgK, iABC)\t\t/* OP_EQ */\r\n ,opmode(1, 0, OpArgK, OpArgK, iABC)\t\t/* OP_LT */\r\n ,opmode(1, 0, OpArgK, OpArgK, iABC)\t\t/* OP_LE */\r\n ,opmode(1, 0, OpArgN, OpArgU, iABC)\t\t/* OP_TEST */\r\n ,opmode(1, 1, OpArgR, OpArgU, iABC)\t\t/* OP_TESTSET */\r\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_CALL */\r\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_TAILCALL */\r\n ,opmode(0, 0, OpArgU, OpArgN, iABC)\t\t/* OP_RETURN */\r\n ,opmode(0, 1, OpArgR, OpArgN, iAsBx)\t\t/* OP_FORLOOP */\r\n ,opmode(0, 1, OpArgR, OpArgN, iAsBx)\t\t/* OP_FORPREP */\r\n ,opmode(0, 0, OpArgN, OpArgU, iABC)\t\t/* OP_TFORCALL */\r\n ,opmode(0, 1, OpArgR, OpArgN, iAsBx)\t\t/* OP_TFORLOOP */\r\n ,opmode(0, 0, OpArgU, OpArgU, iABC)\t\t/* OP_SETLIST */\r\n ,opmode(0, 1, OpArgU, OpArgN, iABx)\t\t/* OP_CLOSURE */\r\n ,opmode(0, 1, OpArgU, OpArgN, iABC)\t\t/* OP_VARARG */\r\n ,opmode(0, 0, OpArgU, OpArgU, iAx)\t\t/* OP_EXTRAARG */\r\n};\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lopcodes.h",
    "content": "/*\r\n** $Id: lopcodes.h,v 1.142 2011/07/15 12:50:29 roberto Exp $\r\n** Opcodes for Lua virtual machine\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lopcodes_h\r\n#define lopcodes_h\r\n\r\n#include \"llimits.h\"\r\n\r\n\r\n/*===========================================================================\r\n  We assume that instructions are unsigned numbers.\r\n  All instructions have an opcode in the first 6 bits.\r\n  Instructions can have the following fields:\r\n\t`A' : 8 bits\r\n\t`B' : 9 bits\r\n\t`C' : 9 bits\r\n\t'Ax' : 26 bits ('A', 'B', and 'C' together)\r\n\t`Bx' : 18 bits (`B' and `C' together)\r\n\t`sBx' : signed Bx\r\n\r\n  A signed argument is represented in excess K; that is, the number\r\n  value is the unsigned value minus K. K is exactly the maximum value\r\n  for that argument (so that -max is represented by 0, and +max is\r\n  represented by 2*max), which is half the maximum for the corresponding\r\n  unsigned argument.\r\n===========================================================================*/\r\n\r\n\r\nenum OpMode {iABC, iABx, iAsBx, iAx};  /* basic instruction format */\r\n\r\n\r\n/*\r\n** size and position of opcode arguments.\r\n*/\r\n#define SIZE_C\t\t9\r\n#define SIZE_B\t\t9\r\n#define SIZE_Bx\t\t(SIZE_C + SIZE_B)\r\n#define SIZE_A\t\t8\r\n#define SIZE_Ax\t\t(SIZE_C + SIZE_B + SIZE_A)\r\n\r\n#define SIZE_OP\t\t6\r\n\r\n#define POS_OP\t\t0\r\n#define POS_A\t\t(POS_OP + SIZE_OP)\r\n#define POS_C\t\t(POS_A + SIZE_A)\r\n#define POS_B\t\t(POS_C + SIZE_C)\r\n#define POS_Bx\t\tPOS_C\r\n#define POS_Ax\t\tPOS_A\r\n\r\n\r\n/*\r\n** limits for opcode arguments.\r\n** we use (signed) int to manipulate most arguments,\r\n** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)\r\n*/\r\n#if SIZE_Bx < LUAI_BITSINT-1\r\n#define MAXARG_Bx        ((1<<SIZE_Bx)-1)\r\n#define MAXARG_sBx        (MAXARG_Bx>>1)         /* `sBx' is signed */\r\n#else\r\n#define MAXARG_Bx        MAX_INT\r\n#define MAXARG_sBx        MAX_INT\r\n#endif\r\n\r\n#if SIZE_Ax < LUAI_BITSINT-1\r\n#define MAXARG_Ax\t((1<<SIZE_Ax)-1)\r\n#else\r\n#define MAXARG_Ax\tMAX_INT\r\n#endif\r\n\r\n\r\n#define MAXARG_A        ((1<<SIZE_A)-1)\r\n#define MAXARG_B        ((1<<SIZE_B)-1)\r\n#define MAXARG_C        ((1<<SIZE_C)-1)\r\n\r\n\r\n/* creates a mask with `n' 1 bits at position `p' */\r\n#define MASK1(n,p)\t((~((~(Instruction)0)<<(n)))<<(p))\r\n\r\n/* creates a mask with `n' 0 bits at position `p' */\r\n#define MASK0(n,p)\t(~MASK1(n,p))\r\n\r\n/*\r\n** the following macros help to manipulate instructions\r\n*/\r\n\r\n#define GET_OPCODE(i)\t(cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))\r\n#define SET_OPCODE(i,o)\t((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \\\r\n\t\t((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))\r\n\r\n#define getarg(i,pos,size)\t(cast(int, ((i)>>pos) & MASK1(size,0)))\r\n#define setarg(i,v,pos,size)\t((i) = (((i)&MASK0(size,pos)) | \\\r\n                ((cast(Instruction, v)<<pos)&MASK1(size,pos))))\r\n\r\n#define GETARG_A(i)\tgetarg(i, POS_A, SIZE_A)\r\n#define SETARG_A(i,v)\tsetarg(i, v, POS_A, SIZE_A)\r\n\r\n#define GETARG_B(i)\tgetarg(i, POS_B, SIZE_B)\r\n#define SETARG_B(i,v)\tsetarg(i, v, POS_B, SIZE_B)\r\n\r\n#define GETARG_C(i)\tgetarg(i, POS_C, SIZE_C)\r\n#define SETARG_C(i,v)\tsetarg(i, v, POS_C, SIZE_C)\r\n\r\n#define GETARG_Bx(i)\tgetarg(i, POS_Bx, SIZE_Bx)\r\n#define SETARG_Bx(i,v)\tsetarg(i, v, POS_Bx, SIZE_Bx)\r\n\r\n#define GETARG_Ax(i)\tgetarg(i, POS_Ax, SIZE_Ax)\r\n#define SETARG_Ax(i,v)\tsetarg(i, v, POS_Ax, SIZE_Ax)\r\n\r\n#define GETARG_sBx(i)\t(GETARG_Bx(i)-MAXARG_sBx)\r\n#define SETARG_sBx(i,b)\tSETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))\r\n\r\n\r\n#define CREATE_ABC(o,a,b,c)\t((cast(Instruction, o)<<POS_OP) \\\r\n\t\t\t| (cast(Instruction, a)<<POS_A) \\\r\n\t\t\t| (cast(Instruction, b)<<POS_B) \\\r\n\t\t\t| (cast(Instruction, c)<<POS_C))\r\n\r\n#define CREATE_ABx(o,a,bc)\t((cast(Instruction, o)<<POS_OP) \\\r\n\t\t\t| (cast(Instruction, a)<<POS_A) \\\r\n\t\t\t| (cast(Instruction, bc)<<POS_Bx))\r\n\r\n#define CREATE_Ax(o,a)\t\t((cast(Instruction, o)<<POS_OP) \\\r\n\t\t\t| (cast(Instruction, a)<<POS_Ax))\r\n\r\n\r\n/*\r\n** Macros to operate RK indices\r\n*/\r\n\r\n/* this bit 1 means constant (0 means register) */\r\n#define BITRK\t\t(1 << (SIZE_B - 1))\r\n\r\n/* test whether value is a constant */\r\n#define ISK(x)\t\t((x) & BITRK)\r\n\r\n/* gets the index of the constant */\r\n#define INDEXK(r)\t((int)(r) & ~BITRK)\r\n\r\n#define MAXINDEXRK\t(BITRK - 1)\r\n\r\n/* code a constant index as a RK value */\r\n#define RKASK(x)\t((x) | BITRK)\r\n\r\n\r\n/*\r\n** invalid register that fits in 8 bits\r\n*/\r\n#define NO_REG\t\tMAXARG_A\r\n\r\n\r\n/*\r\n** R(x) - register\r\n** Kst(x) - constant (in constant table)\r\n** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)\r\n*/\r\n\r\n\r\n/*\r\n** grep \"ORDER OP\" if you change these enums\r\n*/\r\n\r\ntypedef enum {\r\n/*----------------------------------------------------------------------\r\nname\t\targs\tdescription\r\n------------------------------------------------------------------------*/\r\nOP_MOVE,/*\tA B\tR(A) := R(B)\t\t\t\t\t*/\r\nOP_LOADK,/*\tA Bx\tR(A) := Kst(Bx)\t\t\t\t\t*/\r\nOP_LOADKX,/*\tA \tR(A) := Kst(extra arg)\t\t\t\t*/\r\nOP_LOADBOOL,/*\tA B C\tR(A) := (Bool)B; if (C) pc++\t\t\t*/\r\nOP_LOADNIL,/*\tA B\tR(A), R(A+1), ..., R(A+B) := nil\t\t*/\r\nOP_GETUPVAL,/*\tA B\tR(A) := UpValue[B]\t\t\t\t*/\r\n\r\nOP_GETTABUP,/*\tA B C\tR(A) := UpValue[B][RK(C)]\t\t\t*/\r\nOP_GETTABLE,/*\tA B C\tR(A) := R(B)[RK(C)]\t\t\t\t*/\r\n\r\nOP_SETTABUP,/*\tA B C\tUpValue[A][RK(B)] := RK(C)\t\t\t*/\r\nOP_SETUPVAL,/*\tA B\tUpValue[B] := R(A)\t\t\t\t*/\r\nOP_SETTABLE,/*\tA B C\tR(A)[RK(B)] := RK(C)\t\t\t\t*/\r\n\r\nOP_NEWTABLE,/*\tA B C\tR(A) := {} (size = B,C)\t\t\t\t*/\r\n\r\nOP_SELF,/*\tA B C\tR(A+1) := R(B); R(A) := R(B)[RK(C)]\t\t*/\r\n\r\nOP_ADD,/*\tA B C\tR(A) := RK(B) + RK(C)\t\t\t\t*/\r\nOP_SUB,/*\tA B C\tR(A) := RK(B) - RK(C)\t\t\t\t*/\r\nOP_MUL,/*\tA B C\tR(A) := RK(B) * RK(C)\t\t\t\t*/\r\nOP_DIV,/*\tA B C\tR(A) := RK(B) / RK(C)\t\t\t\t*/\r\nOP_MOD,/*\tA B C\tR(A) := RK(B) % RK(C)\t\t\t\t*/\r\nOP_POW,/*\tA B C\tR(A) := RK(B) ^ RK(C)\t\t\t\t*/\r\nOP_UNM,/*\tA B\tR(A) := -R(B)\t\t\t\t\t*/\r\nOP_NOT,/*\tA B\tR(A) := not R(B)\t\t\t\t*/\r\nOP_LEN,/*\tA B\tR(A) := length of R(B)\t\t\t\t*/\r\n\r\nOP_CONCAT,/*\tA B C\tR(A) := R(B).. ... ..R(C)\t\t\t*/\r\n\r\nOP_JMP,/*\tA sBx\tpc+=sBx; if (A) close all upvalues >= R(A) + 1\t*/\r\nOP_EQ,/*\tA B C\tif ((RK(B) == RK(C)) ~= A) then pc++\t\t*/\r\nOP_LT,/*\tA B C\tif ((RK(B) <  RK(C)) ~= A) then pc++\t\t*/\r\nOP_LE,/*\tA B C\tif ((RK(B) <= RK(C)) ~= A) then pc++\t\t*/\r\n\r\nOP_TEST,/*\tA C\tif not (R(A) <=> C) then pc++\t\t\t*/\r\nOP_TESTSET,/*\tA B C\tif (R(B) <=> C) then R(A) := R(B) else pc++\t*/\r\n\r\nOP_CALL,/*\tA B C\tR(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */\r\nOP_TAILCALL,/*\tA B C\treturn R(A)(R(A+1), ... ,R(A+B-1))\t\t*/\r\nOP_RETURN,/*\tA B\treturn R(A), ... ,R(A+B-2)\t(see note)\t*/\r\n\r\nOP_FORLOOP,/*\tA sBx\tR(A)+=R(A+2);\r\n\t\t\tif R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/\r\nOP_FORPREP,/*\tA sBx\tR(A)-=R(A+2); pc+=sBx\t\t\t\t*/\r\n\r\nOP_TFORCALL,/*\tA C\tR(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));\t*/\r\nOP_TFORLOOP,/*\tA sBx\tif R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/\r\n\r\nOP_SETLIST,/*\tA B C\tR(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B\t*/\r\n\r\nOP_CLOSURE,/*\tA Bx\tR(A) := closure(KPROTO[Bx])\t\t\t*/\r\n\r\nOP_VARARG,/*\tA B\tR(A), R(A+1), ..., R(A+B-2) = vararg\t\t*/\r\n\r\nOP_EXTRAARG/*\tAx\textra (larger) argument for previous opcode\t*/\r\n} OpCode;\r\n\r\n\r\n#define NUM_OPCODES\t(cast(int, OP_EXTRAARG) + 1)\r\n\r\n\r\n\r\n/*===========================================================================\r\n  Notes:\r\n  (*) In OP_CALL, if (B == 0) then B = top. If (C == 0), then `top' is\r\n  set to last_result+1, so next open instruction (OP_CALL, OP_RETURN,\r\n  OP_SETLIST) may use `top'.\r\n\r\n  (*) In OP_VARARG, if (B == 0) then use actual number of varargs and\r\n  set top (like in OP_CALL with C == 0).\r\n\r\n  (*) In OP_RETURN, if (B == 0) then return up to `top'.\r\n\r\n  (*) In OP_SETLIST, if (B == 0) then B = `top'; if (C == 0) then next\r\n  'instruction' is EXTRAARG(real C).\r\n\r\n  (*) In OP_LOADKX, the next 'instruction' is always EXTRAARG.\r\n\r\n  (*) For comparisons, A specifies what condition the test should accept\r\n  (true or false).\r\n\r\n  (*) All `skips' (pc++) assume that next instruction is a jump.\r\n\r\n===========================================================================*/\r\n\r\n\r\n/*\r\n** masks for instruction properties. The format is:\r\n** bits 0-1: op mode\r\n** bits 2-3: C arg mode\r\n** bits 4-5: B arg mode\r\n** bit 6: instruction set register A\r\n** bit 7: operator is a test (next instruction must be a jump)\r\n*/\r\n\r\nenum OpArgMask {\r\n  OpArgN,  /* argument is not used */\r\n  OpArgU,  /* argument is used */\r\n  OpArgR,  /* argument is a register or a jump offset */\r\n  OpArgK   /* argument is a constant or register/constant */\r\n};\r\n\r\nLUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];\r\n\r\n#define getOpMode(m)\t(cast(enum OpMode, luaP_opmodes[m] & 3))\r\n#define getBMode(m)\t(cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))\r\n#define getCMode(m)\t(cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))\r\n#define testAMode(m)\t(luaP_opmodes[m] & (1 << 6))\r\n#define testTMode(m)\t(luaP_opmodes[m] & (1 << 7))\r\n\r\n\r\nLUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1];  /* opcode names */\r\n\r\n\r\n/* number of list items to accumulate before a SETLIST instruction */\r\n#define LFIELDS_PER_FLUSH\t50\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/loslib.c",
    "content": "/*\r\n** $Id: loslib.c,v 1.38 2011/11/30 12:35:05 roberto Exp $\r\n** Standard Operating System library\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <errno.h>\r\n#include <locale.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <time.h>\r\n\r\n#define loslib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n/*\r\n** list of valid conversion specifiers for the 'strftime' function\r\n*/\r\n#if !defined(LUA_STRFTIMEOPTIONS)\r\n\r\n#if !defined(LUA_USE_POSIX)\r\n#define LUA_STRFTIMEOPTIONS     { \"aAbBcdHIjmMpSUwWxXyYz%\", \"\" }\r\n#else\r\n#define LUA_STRFTIMEOPTIONS     { \"aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%\", \"\", \\\r\n                                \"E\", \"cCxXyY\",  \\\r\n                                \"O\", \"deHImMSuUVwWy\" }\r\n#endif\r\n\r\n#endif\r\n\r\n\r\n\r\n/*\r\n** By default, Lua uses tmpnam except when POSIX is available, where it\r\n** uses mkstemp.\r\n*/\r\n#if defined(LUA_USE_MKSTEMP)\r\n#include <unistd.h>\r\n#define LUA_TMPNAMBUFSIZE       32\r\n#define lua_tmpnam(b,e) { \\\r\n        strcpy(b, \"/tmp/lua_XXXXXX\"); \\\r\n        e = mkstemp(b); \\\r\n        if (e != -1) close(e); \\\r\n        e = (e == -1); }\r\n\r\n#elif !defined(lua_tmpnam)\r\n\r\n#define LUA_TMPNAMBUFSIZE       L_tmpnam\r\n#define lua_tmpnam(b,e)         { e = (tmpnam(b) == NULL); }\r\n\r\n#endif\r\n\r\n\r\n/*\r\n** By default, Lua uses gmtime/localtime, except when POSIX is available,\r\n** where it uses gmtime_r/localtime_r\r\n*/\r\n#if defined(LUA_USE_GMTIME_R)\r\n\r\n#define l_gmtime(t,r)\t\tgmtime_r(t,r)\r\n#define l_localtime(t,r)\tlocaltime_r(t,r)\r\n\r\n#elif !defined(l_gmtime)\r\n\r\n#define l_gmtime(t,r)\t\t((void)r, gmtime(t))\r\n#define l_localtime(t,r)  \t((void)r, localtime(t))\r\n\r\n#endif\r\n\r\n\r\n\r\nstatic int os_execute (lua_State *L) {\r\n  const char *cmd = luaL_optstring(L, 1, NULL);\r\n  int stat = system(cmd);\r\n  if (cmd != NULL)\r\n    return luaL_execresult(L, stat);\r\n  else {\r\n    lua_pushboolean(L, stat);  /* true if there is a shell */\r\n    return 1;\r\n  }\r\n}\r\n\r\n\r\nstatic int os_remove (lua_State *L) {\r\n  const char *filename = luaL_checkstring(L, 1);\r\n  return luaL_fileresult(L, remove(filename) == 0, filename);\r\n}\r\n\r\n\r\nstatic int os_rename (lua_State *L) {\r\n  const char *fromname = luaL_checkstring(L, 1);\r\n  const char *toname = luaL_checkstring(L, 2);\r\n  return luaL_fileresult(L, rename(fromname, toname) == 0, fromname);\r\n}\r\n\r\n\r\nstatic int os_tmpname (lua_State *L) {\r\n  char buff[LUA_TMPNAMBUFSIZE];\r\n  int err;\r\n  lua_tmpnam(buff, err);\r\n  if (err)\r\n    return luaL_error(L, \"unable to generate a unique filename\");\r\n  lua_pushstring(L, buff);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int os_getenv (lua_State *L) {\r\n  lua_pushstring(L, getenv(luaL_checkstring(L, 1)));  /* if NULL push nil */\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int os_clock (lua_State *L) {\r\n  lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC);\r\n  return 1;\r\n}\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Time/Date operations\r\n** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S,\r\n**   wday=%w+1, yday=%j, isdst=? }\r\n** =======================================================\r\n*/\r\n\r\nstatic void setfield (lua_State *L, const char *key, int value) {\r\n  lua_pushinteger(L, value);\r\n  lua_setfield(L, -2, key);\r\n}\r\n\r\nstatic void setboolfield (lua_State *L, const char *key, int value) {\r\n  if (value < 0)  /* undefined? */\r\n    return;  /* does not set field */\r\n  lua_pushboolean(L, value);\r\n  lua_setfield(L, -2, key);\r\n}\r\n\r\nstatic int getboolfield (lua_State *L, const char *key) {\r\n  int res;\r\n  lua_getfield(L, -1, key);\r\n  res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1);\r\n  lua_pop(L, 1);\r\n  return res;\r\n}\r\n\r\n\r\nstatic int getfield (lua_State *L, const char *key, int d) {\r\n  int res, isnum;\r\n  lua_getfield(L, -1, key);\r\n  res = (int)lua_tointegerx(L, -1, &isnum);\r\n  if (!isnum) {\r\n    if (d < 0)\r\n      return luaL_error(L, \"field \" LUA_QS \" missing in date table\", key);\r\n    res = d;\r\n  }\r\n  lua_pop(L, 1);\r\n  return res;\r\n}\r\n\r\n\r\nstatic const char *checkoption (lua_State *L, const char *conv, char *buff) {\r\n  static const char *const options[] = LUA_STRFTIMEOPTIONS;\r\n  unsigned int i;\r\n  for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) {\r\n    if (*conv != '\\0' && strchr(options[i], *conv) != NULL) {\r\n      buff[1] = *conv;\r\n      if (*options[i + 1] == '\\0') {  /* one-char conversion specifier? */\r\n        buff[2] = '\\0';  /* end buffer */\r\n        return conv + 1;\r\n      }\r\n      else if (*(conv + 1) != '\\0' &&\r\n               strchr(options[i + 1], *(conv + 1)) != NULL) {\r\n        buff[2] = *(conv + 1);  /* valid two-char conversion specifier */\r\n        buff[3] = '\\0';  /* end buffer */\r\n        return conv + 2;\r\n      }\r\n    }\r\n  }\r\n  luaL_argerror(L, 1,\r\n    lua_pushfstring(L, \"invalid conversion specifier '%%%s'\", conv));\r\n  return conv;  /* to avoid warnings */\r\n}\r\n\r\n\r\nstatic int os_date (lua_State *L) {\r\n  const char *s = luaL_optstring(L, 1, \"%c\");\r\n  time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL));\r\n  struct tm tmr, *stm;\r\n  if (*s == '!') {  /* UTC? */\r\n    stm = l_gmtime(&t, &tmr);\r\n    s++;  /* skip `!' */\r\n  }\r\n  else\r\n    stm = l_localtime(&t, &tmr);\r\n  if (stm == NULL)  /* invalid date? */\r\n    lua_pushnil(L);\r\n  else if (strcmp(s, \"*t\") == 0) {\r\n    lua_createtable(L, 0, 9);  /* 9 = number of fields */\r\n    setfield(L, \"sec\", stm->tm_sec);\r\n    setfield(L, \"min\", stm->tm_min);\r\n    setfield(L, \"hour\", stm->tm_hour);\r\n    setfield(L, \"day\", stm->tm_mday);\r\n    setfield(L, \"month\", stm->tm_mon+1);\r\n    setfield(L, \"year\", stm->tm_year+1900);\r\n    setfield(L, \"wday\", stm->tm_wday+1);\r\n    setfield(L, \"yday\", stm->tm_yday+1);\r\n    setboolfield(L, \"isdst\", stm->tm_isdst);\r\n  }\r\n  else {\r\n    char cc[4];\r\n    luaL_Buffer b;\r\n    cc[0] = '%';\r\n    luaL_buffinit(L, &b);\r\n    while (*s) {\r\n      if (*s != '%')  /* no conversion specifier? */\r\n        luaL_addchar(&b, *s++);\r\n      else {\r\n        size_t reslen;\r\n        char buff[200];  /* should be big enough for any conversion result */\r\n        s = checkoption(L, s + 1, cc);\r\n        reslen = strftime(buff, sizeof(buff), cc, stm);\r\n        luaL_addlstring(&b, buff, reslen);\r\n      }\r\n    }\r\n    luaL_pushresult(&b);\r\n  }\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int os_time (lua_State *L) {\r\n  time_t t;\r\n  if (lua_isnoneornil(L, 1))  /* called without args? */\r\n    t = time(NULL);  /* get current time */\r\n  else {\r\n    struct tm ts;\r\n    luaL_checktype(L, 1, LUA_TTABLE);\r\n    lua_settop(L, 1);  /* make sure table is at the top */\r\n    ts.tm_sec = getfield(L, \"sec\", 0);\r\n    ts.tm_min = getfield(L, \"min\", 0);\r\n    ts.tm_hour = getfield(L, \"hour\", 12);\r\n    ts.tm_mday = getfield(L, \"day\", -1);\r\n    ts.tm_mon = getfield(L, \"month\", -1) - 1;\r\n    ts.tm_year = getfield(L, \"year\", -1) - 1900;\r\n    ts.tm_isdst = getboolfield(L, \"isdst\");\r\n    t = mktime(&ts);\r\n  }\r\n  if (t == (time_t)(-1))\r\n    lua_pushnil(L);\r\n  else\r\n    lua_pushnumber(L, (lua_Number)t);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int os_difftime (lua_State *L) {\r\n  lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)),\r\n                             (time_t)(luaL_optnumber(L, 2, 0))));\r\n  return 1;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\nstatic int os_setlocale (lua_State *L) {\r\n  static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,\r\n                      LC_NUMERIC, LC_TIME};\r\n  static const char *const catnames[] = {\"all\", \"collate\", \"ctype\", \"monetary\",\r\n     \"numeric\", \"time\", NULL};\r\n  const char *l = luaL_optstring(L, 1, NULL);\r\n  int op = luaL_checkoption(L, 2, \"all\", catnames);\r\n  lua_pushstring(L, setlocale(cat[op], l));\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int os_exit (lua_State *L) {\r\n  int status;\r\n  if (lua_isboolean(L, 1))\r\n    status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE);\r\n  else\r\n    status = luaL_optint(L, 1, EXIT_SUCCESS);\r\n  if (lua_toboolean(L, 2))\r\n    lua_close(L);\r\n  if (L) exit(status);  /* 'if' to avoid warnings for unreachable 'return' */\r\n  return 0;\r\n}\r\n\r\n\r\nstatic const luaL_Reg syslib[] = {\r\n  {\"clock\",     os_clock},\r\n  {\"date\",      os_date},\r\n  {\"difftime\",  os_difftime},\r\n  {\"execute\",   os_execute},\r\n  {\"exit\",      os_exit},\r\n  {\"getenv\",    os_getenv},\r\n  {\"remove\",    os_remove},\r\n  {\"rename\",    os_rename},\r\n  {\"setlocale\", os_setlocale},\r\n  {\"time\",      os_time},\r\n  {\"tmpname\",   os_tmpname},\r\n  {NULL, NULL}\r\n};\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\nLUAMOD_API int luaopen_os (lua_State *L) {\r\n  luaL_newlib(L, syslib);\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lparser.c",
    "content": "/*\r\n** $Id: lparser.c,v 2.124 2011/12/02 13:23:56 roberto Exp $\r\n** Lua Parser\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <string.h>\r\n\r\n#define lparser_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lcode.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"llex.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lopcodes.h\"\r\n#include \"lparser.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n\r\n\r\n\r\n/* maximum number of local variables per function (must be smaller\r\n   than 250, due to the bytecode format) */\r\n#define MAXVARS\t\t200\r\n\r\n\r\n#define hasmultret(k)\t\t((k) == VCALL || (k) == VVARARG)\r\n\r\n\r\n\r\n/*\r\n** nodes for block list (list of active blocks)\r\n*/\r\ntypedef struct BlockCnt {\r\n  struct BlockCnt *previous;  /* chain */\r\n  short firstlabel;  /* index of first label in this block */\r\n  short firstgoto;  /* index of first pending goto in this block */\r\n  lu_byte nactvar;  /* # active locals outside the block */\r\n  lu_byte upval;  /* true if some variable in the block is an upvalue */\r\n  lu_byte isloop;  /* true if `block' is a loop */\r\n} BlockCnt;\r\n\r\n\r\n\r\n/*\r\n** prototypes for recursive non-terminal functions\r\n*/\r\nstatic void statement (LexState *ls);\r\nstatic void expr (LexState *ls, expdesc *v);\r\n\r\n\r\nstatic void anchor_token (LexState *ls) {\r\n  /* last token from outer function must be EOS */\r\n  lua_assert(ls->fs != NULL || ls->t.token == TK_EOS);\r\n  if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {\r\n    TString *ts = ls->t.seminfo.ts;\r\n    luaX_newstring(ls, getstr(ts), ts->tsv.len);\r\n  }\r\n}\r\n\r\n\r\n/* semantic error */\r\nstatic l_noret semerror (LexState *ls, const char *msg) {\r\n  ls->t.token = 0;  /* remove 'near to' from final message */\r\n  luaX_syntaxerror(ls, msg);\r\n}\r\n\r\n\r\nstatic l_noret error_expected (LexState *ls, int token) {\r\n  luaX_syntaxerror(ls,\r\n      luaO_pushfstring(ls->L, \"%s expected\", luaX_token2str(ls, token)));\r\n}\r\n\r\n\r\nstatic l_noret errorlimit (FuncState *fs, int limit, const char *what) {\r\n  lua_State *L = fs->ls->L;\r\n  const char *msg;\r\n  int line = fs->f->linedefined;\r\n  const char *where = (line == 0)\r\n                      ? \"main function\"\r\n                      : luaO_pushfstring(L, \"function at line %d\", line);\r\n  msg = luaO_pushfstring(L, \"too many %s (limit is %d) in %s\",\r\n                             what, limit, where);\r\n  luaX_syntaxerror(fs->ls, msg);\r\n}\r\n\r\n\r\nstatic void checklimit (FuncState *fs, int v, int l, const char *what) {\r\n  if (v > l) errorlimit(fs, l, what);\r\n}\r\n\r\n\r\nstatic int testnext (LexState *ls, int c) {\r\n  if (ls->t.token == c) {\r\n    luaX_next(ls);\r\n    return 1;\r\n  }\r\n  else return 0;\r\n}\r\n\r\n\r\nstatic void check (LexState *ls, int c) {\r\n  if (ls->t.token != c)\r\n    error_expected(ls, c);\r\n}\r\n\r\n\r\nstatic void checknext (LexState *ls, int c) {\r\n  check(ls, c);\r\n  luaX_next(ls);\r\n}\r\n\r\n\r\n#define check_condition(ls,c,msg)\t{ if (!(c)) luaX_syntaxerror(ls, msg); }\r\n\r\n\r\n\r\nstatic void check_match (LexState *ls, int what, int who, int where) {\r\n  if (!testnext(ls, what)) {\r\n    if (where == ls->linenumber)\r\n      error_expected(ls, what);\r\n    else {\r\n      luaX_syntaxerror(ls, luaO_pushfstring(ls->L,\r\n             \"%s expected (to close %s at line %d)\",\r\n              luaX_token2str(ls, what), luaX_token2str(ls, who), where));\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic TString *str_checkname (LexState *ls) {\r\n  TString *ts;\r\n  check(ls, TK_NAME);\r\n  ts = ls->t.seminfo.ts;\r\n  luaX_next(ls);\r\n  return ts;\r\n}\r\n\r\n\r\nstatic void init_exp (expdesc *e, expkind k, int i) {\r\n  e->f = e->t = NO_JUMP;\r\n  e->k = k;\r\n  e->u.info = i;\r\n}\r\n\r\n\r\nstatic void codestring (LexState *ls, expdesc *e, TString *s) {\r\n  init_exp(e, VK, luaK_stringK(ls->fs, s));\r\n}\r\n\r\n\r\nstatic void checkname (LexState *ls, expdesc *e) {\r\n  codestring(ls, e, str_checkname(ls));\r\n}\r\n\r\n\r\nstatic int registerlocalvar (LexState *ls, TString *varname) {\r\n  FuncState *fs = ls->fs;\r\n  Proto *f = fs->f;\r\n  int oldsize = f->sizelocvars;\r\n  luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,\r\n                  LocVar, SHRT_MAX, \"local variables\");\r\n  while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;\r\n  f->locvars[fs->nlocvars].varname = varname;\r\n  luaC_objbarrier(ls->L, f, varname);\r\n  return fs->nlocvars++;\r\n}\r\n\r\n\r\nstatic void new_localvar (LexState *ls, TString *name) {\r\n  FuncState *fs = ls->fs;\r\n  Dyndata *dyd = ls->dyd;\r\n  int reg = registerlocalvar(ls, name);\r\n  checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,\r\n                  MAXVARS, \"local variables\");\r\n  luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1,\r\n                  dyd->actvar.size, Vardesc, MAX_INT, \"local variables\");\r\n  dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg);\r\n}\r\n\r\n\r\nstatic void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) {\r\n  new_localvar(ls, luaX_newstring(ls, name, sz));\r\n}\r\n\r\n#define new_localvarliteral(ls,v) \\\r\n\tnew_localvarliteral_(ls, \"\" v, (sizeof(v)/sizeof(char))-1)\r\n\r\n\r\nstatic LocVar *getlocvar (FuncState *fs, int i) {\r\n  int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx;\r\n  lua_assert(idx < fs->nlocvars);\r\n  return &fs->f->locvars[idx];\r\n}\r\n\r\n\r\nstatic void adjustlocalvars (LexState *ls, int nvars) {\r\n  FuncState *fs = ls->fs;\r\n  fs->nactvar = cast_byte(fs->nactvar + nvars);\r\n  for (; nvars; nvars--) {\r\n    getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc;\r\n  }\r\n}\r\n\r\n\r\nstatic void removevars (FuncState *fs, int tolevel) {\r\n  fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel);\r\n  while (fs->nactvar > tolevel)\r\n    getlocvar(fs, --fs->nactvar)->endpc = fs->pc;\r\n}\r\n\r\n\r\nstatic int searchupvalue (FuncState *fs, TString *name) {\r\n  int i;\r\n  Upvaldesc *up = fs->f->upvalues;\r\n  for (i = 0; i < fs->nups; i++) {\r\n    if (eqstr(up[i].name, name)) return i;\r\n  }\r\n  return -1;  /* not found */\r\n}\r\n\r\n\r\nstatic int newupvalue (FuncState *fs, TString *name, expdesc *v) {\r\n  Proto *f = fs->f;\r\n  int oldsize = f->sizeupvalues;\r\n  checklimit(fs, fs->nups + 1, MAXUPVAL, \"upvalues\");\r\n  luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues,\r\n                  Upvaldesc, MAXUPVAL, \"upvalues\");\r\n  while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL;\r\n  f->upvalues[fs->nups].instack = (v->k == VLOCAL);\r\n  f->upvalues[fs->nups].idx = cast_byte(v->u.info);\r\n  f->upvalues[fs->nups].name = name;\r\n  luaC_objbarrier(fs->ls->L, f, name);\r\n  return fs->nups++;\r\n}\r\n\r\n\r\nstatic int searchvar (FuncState *fs, TString *n) {\r\n  int i;\r\n  for (i=fs->nactvar-1; i >= 0; i--) {\r\n    if (eqstr(n, getlocvar(fs, i)->varname))\r\n      return i;\r\n  }\r\n  return -1;  /* not found */\r\n}\r\n\r\n\r\n/*\r\n  Mark block where variable at given level was defined\r\n  (to emit close instructions later).\r\n*/\r\nstatic void markupval (FuncState *fs, int level) {\r\n  BlockCnt *bl = fs->bl;\r\n  while (bl->nactvar > level) bl = bl->previous;\r\n  bl->upval = 1;\r\n}\r\n\r\n\r\n/*\r\n  Find variable with given name 'n'. If it is an upvalue, add this\r\n  upvalue into all intermediate functions.\r\n*/\r\nstatic int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {\r\n  if (fs == NULL)  /* no more levels? */\r\n    return VVOID;  /* default is global */\r\n  else {\r\n    int v = searchvar(fs, n);  /* look up locals at current level */\r\n    if (v >= 0) {  /* found? */\r\n      init_exp(var, VLOCAL, v);  /* variable is local */\r\n      if (!base)\r\n        markupval(fs, v);  /* local will be used as an upval */\r\n      return VLOCAL;\r\n    }\r\n    else {  /* not found as local at current level; try upvalues */\r\n      int idx = searchupvalue(fs, n);  /* try existing upvalues */\r\n      if (idx < 0) {  /* not found? */\r\n        if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */\r\n          return VVOID;  /* not found; is a global */\r\n        /* else was LOCAL or UPVAL */\r\n        idx  = newupvalue(fs, n, var);  /* will be a new upvalue */\r\n      }\r\n      init_exp(var, VUPVAL, idx);\r\n      return VUPVAL;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void singlevar (LexState *ls, expdesc *var) {\r\n  TString *varname = str_checkname(ls);\r\n  FuncState *fs = ls->fs;\r\n  if (singlevaraux(fs, varname, var, 1) == VVOID) {  /* global name? */\r\n    expdesc key;\r\n    singlevaraux(fs, ls->envn, var, 1);  /* get environment variable */\r\n    lua_assert(var->k == VLOCAL || var->k == VUPVAL);\r\n    codestring(ls, &key, varname);  /* key is variable name */\r\n    luaK_indexed(fs, var, &key);  /* env[varname] */\r\n  }\r\n}\r\n\r\n\r\nstatic void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {\r\n  FuncState *fs = ls->fs;\r\n  int extra = nvars - nexps;\r\n  if (hasmultret(e->k)) {\r\n    extra++;  /* includes call itself */\r\n    if (extra < 0) extra = 0;\r\n    luaK_setreturns(fs, e, extra);  /* last exp. provides the difference */\r\n    if (extra > 1) luaK_reserveregs(fs, extra-1);\r\n  }\r\n  else {\r\n    if (e->k != VVOID) luaK_exp2nextreg(fs, e);  /* close last expression */\r\n    if (extra > 0) {\r\n      int reg = fs->freereg;\r\n      luaK_reserveregs(fs, extra);\r\n      luaK_nil(fs, reg, extra);\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void enterlevel (LexState *ls) {\r\n  lua_State *L = ls->L;\r\n  ++L->nCcalls;\r\n  checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, \"C levels\");\r\n}\r\n\r\n\r\n#define leavelevel(ls)\t((ls)->L->nCcalls--)\r\n\r\n\r\nstatic void closegoto (LexState *ls, int g, Labeldesc *label) {\r\n  int i;\r\n  FuncState *fs = ls->fs;\r\n  Labellist *gl = &ls->dyd->gt;\r\n  Labeldesc *gt = &gl->arr[g];\r\n  lua_assert(eqstr(gt->name, label->name));\r\n  if (gt->nactvar < label->nactvar) {\r\n    TString *vname = getlocvar(fs, gt->nactvar)->varname;\r\n    const char *msg = luaO_pushfstring(ls->L,\r\n      \"<goto %s> at line %d jumps into the scope of local \" LUA_QS,\r\n      getstr(gt->name), gt->line, getstr(vname));\r\n    semerror(ls, msg);\r\n  }\r\n  luaK_patchlist(fs, gt->pc, label->pc);\r\n  /* remove goto from pending list */\r\n  for (i = g; i < gl->n - 1; i++)\r\n    gl->arr[i] = gl->arr[i + 1];\r\n  gl->n--;\r\n}\r\n\r\n\r\n/*\r\n** try to close a goto with existing labels; this solves backward jumps\r\n*/\r\nstatic int findlabel (LexState *ls, int g) {\r\n  int i;\r\n  BlockCnt *bl = ls->fs->bl;\r\n  Dyndata *dyd = ls->dyd;\r\n  Labeldesc *gt = &dyd->gt.arr[g];\r\n  /* check labels in current block for a match */\r\n  for (i = bl->firstlabel; i < dyd->label.n; i++) {\r\n    Labeldesc *lb = &dyd->label.arr[i];\r\n    if (eqstr(lb->name, gt->name)) {  /* correct label? */\r\n      if (gt->nactvar > lb->nactvar &&\r\n          (bl->upval || dyd->label.n > bl->firstlabel))\r\n        luaK_patchclose(ls->fs, gt->pc, lb->nactvar);\r\n      closegoto(ls, g, lb);  /* close it */\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;  /* label not found; cannot close goto */\r\n}\r\n\r\n\r\nstatic int newlabelentry (LexState *ls, Labellist *l, TString *name,\r\n                          int line, int pc) {\r\n  int n = l->n;\r\n  luaM_growvector(ls->L, l->arr, n, l->size,\r\n                  Labeldesc, SHRT_MAX, \"labels/gotos\");\r\n  l->arr[n].name = name;\r\n  l->arr[n].line = line;\r\n  l->arr[n].nactvar = ls->fs->nactvar;\r\n  l->arr[n].pc = pc;\r\n  l->n++;\r\n  return n;\r\n}\r\n\r\n\r\n/*\r\n** check whether new label 'lb' matches any pending gotos in current\r\n** block; solves forward jumps\r\n*/\r\nstatic void findgotos (LexState *ls, Labeldesc *lb) {\r\n  Labellist *gl = &ls->dyd->gt;\r\n  int i = ls->fs->bl->firstgoto;\r\n  while (i < gl->n) {\r\n    if (eqstr(gl->arr[i].name, lb->name))\r\n      closegoto(ls, i, lb);\r\n    else\r\n      i++;\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** \"export\" pending gotos to outer level, to check them against\r\n** outer labels; if the block being exited has upvalues, and\r\n** the goto exits the scope of any variable (which can be the\r\n** upvalue), close those variables being exited.\r\n*/\r\nstatic void movegotosout (FuncState *fs, BlockCnt *bl) {\r\n  int i = bl->firstgoto;\r\n  Labellist *gl = &fs->ls->dyd->gt;\r\n  /* correct pending gotos to current block and try to close it\r\n     with visible labels */\r\n  while (i < gl->n) {\r\n    Labeldesc *gt = &gl->arr[i];\r\n    if (gt->nactvar > bl->nactvar) {\r\n      if (bl->upval)\r\n        luaK_patchclose(fs, gt->pc, bl->nactvar);\r\n      gt->nactvar = bl->nactvar;\r\n    }\r\n    if (!findlabel(fs->ls, i))\r\n      i++;  /* move to next one */\r\n  }\r\n}\r\n\r\n\r\nstatic void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) {\r\n  bl->isloop = isloop;\r\n  bl->nactvar = fs->nactvar;\r\n  bl->firstlabel = fs->ls->dyd->label.n;\r\n  bl->firstgoto = fs->ls->dyd->gt.n;\r\n  bl->upval = 0;\r\n  bl->previous = fs->bl;\r\n  fs->bl = bl;\r\n  lua_assert(fs->freereg == fs->nactvar);\r\n}\r\n\r\n\r\n/*\r\n** create a label named \"break\" to resolve break statements\r\n*/\r\nstatic void breaklabel (LexState *ls) {\r\n  TString *n = luaS_new(ls->L, \"break\");\r\n  int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc);\r\n  findgotos(ls, &ls->dyd->label.arr[l]);\r\n}\r\n\r\n/*\r\n** generates an error for an undefined 'goto'; choose appropriate\r\n** message when label name is a reserved word (which can only be 'break')\r\n*/\r\nstatic l_noret undefgoto (LexState *ls, Labeldesc *gt) {\r\n  const char *msg = (gt->name->tsv.reserved > 0)\r\n                    ? \"<%s> at line %d not inside a loop\"\r\n                    : \"no visible label \" LUA_QS \" for <goto> at line %d\";\r\n  msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line);\r\n  semerror(ls, msg);\r\n}\r\n\r\n\r\nstatic void leaveblock (FuncState *fs) {\r\n  BlockCnt *bl = fs->bl;\r\n  LexState *ls = fs->ls;\r\n  if (bl->previous && bl->upval) {\r\n    /* create a 'jump to here' to close upvalues */\r\n    int j = luaK_jump(fs);\r\n    luaK_patchclose(fs, j, bl->nactvar);\r\n    luaK_patchtohere(fs, j);\r\n  }\r\n  if (bl->isloop)\r\n    breaklabel(ls);  /* close pending breaks */\r\n  fs->bl = bl->previous;\r\n  removevars(fs, bl->nactvar);\r\n  lua_assert(bl->nactvar == fs->nactvar);\r\n  fs->freereg = fs->nactvar;  /* free registers */\r\n  ls->dyd->label.n = bl->firstlabel;  /* remove local labels */\r\n  if (bl->previous)  /* inner block? */\r\n    movegotosout(fs, bl);  /* update pending gotos to outer block */\r\n  else if (bl->firstgoto < ls->dyd->gt.n)  /* pending gotos in outer block? */\r\n    undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]);  /* error */\r\n}\r\n\r\n\r\n/*\r\n** adds prototype being created into its parent list of prototypes\r\n** and codes instruction to create new closure\r\n*/\r\nstatic void codeclosure (LexState *ls, Proto *clp, expdesc *v) {\r\n  FuncState *fs = ls->fs->prev;\r\n  Proto *f = fs->f;  /* prototype of function creating new closure */\r\n  if (fs->np >= f->sizep) {\r\n    int oldsize = f->sizep;\r\n    luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *,\r\n                    MAXARG_Bx, \"functions\");\r\n    while (oldsize < f->sizep) f->p[oldsize++] = NULL;\r\n  }\r\n  f->p[fs->np++] = clp;\r\n  luaC_objbarrier(ls->L, f, clp);\r\n  init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1));\r\n  luaK_exp2nextreg(fs, v);  /* fix it at stack top (for GC) */\r\n}\r\n\r\n\r\nstatic void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {\r\n  lua_State *L = ls->L;\r\n  Proto *f;\r\n  fs->prev = ls->fs;  /* linked list of funcstates */\r\n  fs->ls = ls;\r\n  ls->fs = fs;\r\n  fs->pc = 0;\r\n  fs->lasttarget = 0;\r\n  fs->jpc = NO_JUMP;\r\n  fs->freereg = 0;\r\n  fs->nk = 0;\r\n  fs->np = 0;\r\n  fs->nups = 0;\r\n  fs->nlocvars = 0;\r\n  fs->nactvar = 0;\r\n  fs->firstlocal = ls->dyd->actvar.n;\r\n  fs->bl = NULL;\r\n  f = luaF_newproto(L);\r\n  fs->f = f;\r\n  f->source = ls->source;\r\n  f->maxstacksize = 2;  /* registers 0/1 are always valid */\r\n  /* anchor prototype (to avoid being collected) */\r\n  setptvalue2s(L, L->top, f);\r\n  incr_top(L);\r\n  fs->h = luaH_new(L);\r\n  /* anchor table of constants (to avoid being collected) */\r\n  sethvalue2s(L, L->top, fs->h);\r\n  incr_top(L);\r\n  enterblock(fs, bl, 0);\r\n}\r\n\r\n\r\nstatic void close_func (LexState *ls) {\r\n  lua_State *L = ls->L;\r\n  FuncState *fs = ls->fs;\r\n  Proto *f = fs->f;\r\n  luaK_ret(fs, 0, 0);  /* final return */\r\n  leaveblock(fs);\r\n  luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);\r\n  f->sizecode = fs->pc;\r\n  luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);\r\n  f->sizelineinfo = fs->pc;\r\n  luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);\r\n  f->sizek = fs->nk;\r\n  luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);\r\n  f->sizep = fs->np;\r\n  luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);\r\n  f->sizelocvars = fs->nlocvars;\r\n  luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc);\r\n  f->sizeupvalues = fs->nups;\r\n  lua_assert(fs->bl == NULL);\r\n  ls->fs = fs->prev;\r\n  /* last token read was anchored in defunct function; must re-anchor it */\r\n  anchor_token(ls);\r\n  L->top--;  /* pop table of constants */\r\n  luaC_checkGC(L);\r\n  L->top--;  /* pop prototype (after possible collection) */\r\n}\r\n\r\n\r\n/*\r\n** opens the main function, which is a regular vararg function with an\r\n** upvalue named LUA_ENV\r\n*/\r\nstatic void open_mainfunc (LexState *ls, FuncState *fs, BlockCnt *bl) {\r\n  expdesc v;\r\n  open_func(ls, fs, bl);\r\n  fs->f->is_vararg = 1;  /* main function is always vararg */\r\n  init_exp(&v, VLOCAL, 0);\r\n  newupvalue(fs, ls->envn, &v);  /* create environment upvalue */\r\n}\r\n\r\n\r\n\r\n/*============================================================*/\r\n/* GRAMMAR RULES */\r\n/*============================================================*/\r\n\r\n\r\n/*\r\n** check whether current token is in the follow set of a block.\r\n** 'until' closes syntactical blocks, but do not close scope,\r\n** so it handled in separate.\r\n*/\r\nstatic int block_follow (LexState *ls, int withuntil) {\r\n  switch (ls->t.token) {\r\n    case TK_ELSE: case TK_ELSEIF:\r\n    case TK_END: case TK_EOS:\r\n      return 1;\r\n    case TK_UNTIL: return withuntil;\r\n    default: return 0;\r\n  }\r\n}\r\n\r\n\r\nstatic void statlist (LexState *ls) {\r\n  /* statlist -> { stat [`;'] } */\r\n  while (!block_follow(ls, 1)) {\r\n    if (ls->t.token == TK_RETURN) {\r\n      statement(ls);\r\n      return;  /* 'return' must be last statement */\r\n    }\r\n    statement(ls);\r\n  }\r\n}\r\n\r\n\r\nstatic void fieldsel (LexState *ls, expdesc *v) {\r\n  /* fieldsel -> ['.' | ':'] NAME */\r\n  FuncState *fs = ls->fs;\r\n  expdesc key;\r\n  luaK_exp2anyregup(fs, v);\r\n  luaX_next(ls);  /* skip the dot or colon */\r\n  checkname(ls, &key);\r\n  luaK_indexed(fs, v, &key);\r\n}\r\n\r\n\r\nstatic void yindex (LexState *ls, expdesc *v) {\r\n  /* index -> '[' expr ']' */\r\n  luaX_next(ls);  /* skip the '[' */\r\n  expr(ls, v);\r\n  luaK_exp2val(ls->fs, v);\r\n  checknext(ls, ']');\r\n}\r\n\r\n\r\n/*\r\n** {======================================================================\r\n** Rules for Constructors\r\n** =======================================================================\r\n*/\r\n\r\n\r\nstruct ConsControl {\r\n  expdesc v;  /* last list item read */\r\n  expdesc *t;  /* table descriptor */\r\n  int nh;  /* total number of `record' elements */\r\n  int na;  /* total number of array elements */\r\n  int tostore;  /* number of array elements pending to be stored */\r\n};\r\n\r\n\r\nstatic void recfield (LexState *ls, struct ConsControl *cc) {\r\n  /* recfield -> (NAME | `['exp1`]') = exp1 */\r\n  FuncState *fs = ls->fs;\r\n  int reg = ls->fs->freereg;\r\n  expdesc key, val;\r\n  int rkkey;\r\n  if (ls->t.token == TK_NAME) {\r\n    checklimit(fs, cc->nh, MAX_INT, \"items in a constructor\");\r\n    checkname(ls, &key);\r\n  }\r\n  else  /* ls->t.token == '[' */\r\n    yindex(ls, &key);\r\n  cc->nh++;\r\n  checknext(ls, '=');\r\n  rkkey = luaK_exp2RK(fs, &key);\r\n  expr(ls, &val);\r\n  luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val));\r\n  fs->freereg = reg;  /* free registers */\r\n}\r\n\r\n\r\nstatic void closelistfield (FuncState *fs, struct ConsControl *cc) {\r\n  if (cc->v.k == VVOID) return;  /* there is no list item */\r\n  luaK_exp2nextreg(fs, &cc->v);\r\n  cc->v.k = VVOID;\r\n  if (cc->tostore == LFIELDS_PER_FLUSH) {\r\n    luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore);  /* flush */\r\n    cc->tostore = 0;  /* no more items pending */\r\n  }\r\n}\r\n\r\n\r\nstatic void lastlistfield (FuncState *fs, struct ConsControl *cc) {\r\n  if (cc->tostore == 0) return;\r\n  if (hasmultret(cc->v.k)) {\r\n    luaK_setmultret(fs, &cc->v);\r\n    luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET);\r\n    cc->na--;  /* do not count last expression (unknown number of elements) */\r\n  }\r\n  else {\r\n    if (cc->v.k != VVOID)\r\n      luaK_exp2nextreg(fs, &cc->v);\r\n    luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore);\r\n  }\r\n}\r\n\r\n\r\nstatic void listfield (LexState *ls, struct ConsControl *cc) {\r\n  /* listfield -> exp */\r\n  expr(ls, &cc->v);\r\n  checklimit(ls->fs, cc->na, MAX_INT, \"items in a constructor\");\r\n  cc->na++;\r\n  cc->tostore++;\r\n}\r\n\r\n\r\nstatic void field (LexState *ls, struct ConsControl *cc) {\r\n  /* field -> listfield | recfield */\r\n  switch(ls->t.token) {\r\n    case TK_NAME: {  /* may be 'listfield' or 'recfield' */\r\n      if (luaX_lookahead(ls) != '=')  /* expression? */\r\n        listfield(ls, cc);\r\n      else\r\n        recfield(ls, cc);\r\n      break;\r\n    }\r\n    case '[': {\r\n      recfield(ls, cc);\r\n      break;\r\n    }\r\n    default: {\r\n      listfield(ls, cc);\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void constructor (LexState *ls, expdesc *t) {\r\n  /* constructor -> '{' [ field { sep field } [sep] ] '}'\r\n     sep -> ',' | ';' */\r\n  FuncState *fs = ls->fs;\r\n  int line = ls->linenumber;\r\n  int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);\r\n  struct ConsControl cc;\r\n  cc.na = cc.nh = cc.tostore = 0;\r\n  cc.t = t;\r\n  init_exp(t, VRELOCABLE, pc);\r\n  init_exp(&cc.v, VVOID, 0);  /* no value (yet) */\r\n  luaK_exp2nextreg(ls->fs, t);  /* fix it at stack top */\r\n  checknext(ls, '{');\r\n  do {\r\n    lua_assert(cc.v.k == VVOID || cc.tostore > 0);\r\n    if (ls->t.token == '}') break;\r\n    closelistfield(fs, &cc);\r\n    field(ls, &cc);\r\n  } while (testnext(ls, ',') || testnext(ls, ';'));\r\n  check_match(ls, '}', '{', line);\r\n  lastlistfield(fs, &cc);\r\n  SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */\r\n  SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh));  /* set initial table size */\r\n}\r\n\r\n/* }====================================================================== */\r\n\r\n\r\n\r\nstatic void parlist (LexState *ls) {\r\n  /* parlist -> [ param { `,' param } ] */\r\n  FuncState *fs = ls->fs;\r\n  Proto *f = fs->f;\r\n  int nparams = 0;\r\n  f->is_vararg = 0;\r\n  if (ls->t.token != ')') {  /* is `parlist' not empty? */\r\n    do {\r\n      switch (ls->t.token) {\r\n        case TK_NAME: {  /* param -> NAME */\r\n          new_localvar(ls, str_checkname(ls));\r\n          nparams++;\r\n          break;\r\n        }\r\n        case TK_DOTS: {  /* param -> `...' */\r\n          luaX_next(ls);\r\n          f->is_vararg = 1;\r\n          break;\r\n        }\r\n        default: luaX_syntaxerror(ls, \"<name> or \" LUA_QL(\"...\") \" expected\");\r\n      }\r\n    } while (!f->is_vararg && testnext(ls, ','));\r\n  }\r\n  adjustlocalvars(ls, nparams);\r\n  f->numparams = cast_byte(fs->nactvar);\r\n  luaK_reserveregs(fs, fs->nactvar);  /* reserve register for parameters */\r\n}\r\n\r\n\r\nstatic void body (LexState *ls, expdesc *e, int ismethod, int line) {\r\n  /* body ->  `(' parlist `)' block END */\r\n  FuncState new_fs;\r\n  BlockCnt bl;\r\n  open_func(ls, &new_fs, &bl);\r\n  new_fs.f->linedefined = line;\r\n  checknext(ls, '(');\r\n  if (ismethod) {\r\n    new_localvarliteral(ls, \"self\");  /* create 'self' parameter */\r\n    adjustlocalvars(ls, 1);\r\n  }\r\n  parlist(ls);\r\n  checknext(ls, ')');\r\n  statlist(ls);\r\n  new_fs.f->lastlinedefined = ls->linenumber;\r\n  check_match(ls, TK_END, TK_FUNCTION, line);\r\n  codeclosure(ls, new_fs.f, e);\r\n  close_func(ls);\r\n}\r\n\r\n\r\nstatic int explist (LexState *ls, expdesc *v) {\r\n  /* explist -> expr { `,' expr } */\r\n  int n = 1;  /* at least one expression */\r\n  expr(ls, v);\r\n  while (testnext(ls, ',')) {\r\n    luaK_exp2nextreg(ls->fs, v);\r\n    expr(ls, v);\r\n    n++;\r\n  }\r\n  return n;\r\n}\r\n\r\n\r\nstatic void funcargs (LexState *ls, expdesc *f, int line) {\r\n  FuncState *fs = ls->fs;\r\n  expdesc args;\r\n  int base, nparams;\r\n  switch (ls->t.token) {\r\n    case '(': {  /* funcargs -> `(' [ explist ] `)' */\r\n      luaX_next(ls);\r\n      if (ls->t.token == ')')  /* arg list is empty? */\r\n        args.k = VVOID;\r\n      else {\r\n        explist(ls, &args);\r\n        luaK_setmultret(fs, &args);\r\n      }\r\n      check_match(ls, ')', '(', line);\r\n      break;\r\n    }\r\n    case '{': {  /* funcargs -> constructor */\r\n      constructor(ls, &args);\r\n      break;\r\n    }\r\n    case TK_STRING: {  /* funcargs -> STRING */\r\n      codestring(ls, &args, ls->t.seminfo.ts);\r\n      luaX_next(ls);  /* must use `seminfo' before `next' */\r\n      break;\r\n    }\r\n    default: {\r\n      luaX_syntaxerror(ls, \"function arguments expected\");\r\n    }\r\n  }\r\n  lua_assert(f->k == VNONRELOC);\r\n  base = f->u.info;  /* base register for call */\r\n  if (hasmultret(args.k))\r\n    nparams = LUA_MULTRET;  /* open call */\r\n  else {\r\n    if (args.k != VVOID)\r\n      luaK_exp2nextreg(fs, &args);  /* close last argument */\r\n    nparams = fs->freereg - (base+1);\r\n  }\r\n  init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));\r\n  luaK_fixline(fs, line);\r\n  fs->freereg = base+1;  /* call remove function and arguments and leaves\r\n                            (unless changed) one result */\r\n}\r\n\r\n\r\n\r\n\r\n/*\r\n** {======================================================================\r\n** Expression parsing\r\n** =======================================================================\r\n*/\r\n\r\n\r\nstatic void prefixexp (LexState *ls, expdesc *v) {\r\n  /* prefixexp -> NAME | '(' expr ')' */\r\n  switch (ls->t.token) {\r\n    case '(': {\r\n      int line = ls->linenumber;\r\n      luaX_next(ls);\r\n      expr(ls, v);\r\n      check_match(ls, ')', '(', line);\r\n      luaK_dischargevars(ls->fs, v);\r\n      return;\r\n    }\r\n    case TK_NAME: {\r\n      singlevar(ls, v);\r\n      return;\r\n    }\r\n    default: {\r\n      luaX_syntaxerror(ls, \"unexpected symbol\");\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void primaryexp (LexState *ls, expdesc *v) {\r\n  /* primaryexp ->\r\n        prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */\r\n  FuncState *fs = ls->fs;\r\n  int line = ls->linenumber;\r\n  prefixexp(ls, v);\r\n  for (;;) {\r\n    switch (ls->t.token) {\r\n      case '.': {  /* fieldsel */\r\n        fieldsel(ls, v);\r\n        break;\r\n      }\r\n      case '[': {  /* `[' exp1 `]' */\r\n        expdesc key;\r\n        luaK_exp2anyregup(fs, v);\r\n        yindex(ls, &key);\r\n        luaK_indexed(fs, v, &key);\r\n        break;\r\n      }\r\n      case ':': {  /* `:' NAME funcargs */\r\n        expdesc key;\r\n        luaX_next(ls);\r\n        checkname(ls, &key);\r\n        luaK_self(fs, v, &key);\r\n        funcargs(ls, v, line);\r\n        break;\r\n      }\r\n      case '(': case TK_STRING: case '{': {  /* funcargs */\r\n        luaK_exp2nextreg(fs, v);\r\n        funcargs(ls, v, line);\r\n        break;\r\n      }\r\n      default: return;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void simpleexp (LexState *ls, expdesc *v) {\r\n  /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |\r\n                  constructor | FUNCTION body | primaryexp */\r\n  switch (ls->t.token) {\r\n    case TK_NUMBER: {\r\n      init_exp(v, VKNUM, 0);\r\n      v->u.nval = ls->t.seminfo.r;\r\n      break;\r\n    }\r\n    case TK_STRING: {\r\n      codestring(ls, v, ls->t.seminfo.ts);\r\n      break;\r\n    }\r\n    case TK_NIL: {\r\n      init_exp(v, VNIL, 0);\r\n      break;\r\n    }\r\n    case TK_TRUE: {\r\n      init_exp(v, VTRUE, 0);\r\n      break;\r\n    }\r\n    case TK_FALSE: {\r\n      init_exp(v, VFALSE, 0);\r\n      break;\r\n    }\r\n    case TK_DOTS: {  /* vararg */\r\n      FuncState *fs = ls->fs;\r\n      check_condition(ls, fs->f->is_vararg,\r\n                      \"cannot use \" LUA_QL(\"...\") \" outside a vararg function\");\r\n      init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));\r\n      break;\r\n    }\r\n    case '{': {  /* constructor */\r\n      constructor(ls, v);\r\n      return;\r\n    }\r\n    case TK_FUNCTION: {\r\n      luaX_next(ls);\r\n      body(ls, v, 0, ls->linenumber);\r\n      return;\r\n    }\r\n    default: {\r\n      primaryexp(ls, v);\r\n      return;\r\n    }\r\n  }\r\n  luaX_next(ls);\r\n}\r\n\r\n\r\nstatic UnOpr getunopr (int op) {\r\n  switch (op) {\r\n    case TK_NOT: return OPR_NOT;\r\n    case '-': return OPR_MINUS;\r\n    case '#': return OPR_LEN;\r\n    default: return OPR_NOUNOPR;\r\n  }\r\n}\r\n\r\n\r\nstatic BinOpr getbinopr (int op) {\r\n  switch (op) {\r\n    case '+': return OPR_ADD;\r\n    case '-': return OPR_SUB;\r\n    case '*': return OPR_MUL;\r\n    case '/': return OPR_DIV;\r\n    case '%': return OPR_MOD;\r\n    case '^': return OPR_POW;\r\n    case TK_CONCAT: return OPR_CONCAT;\r\n    case TK_NE: return OPR_NE;\r\n    case TK_EQ: return OPR_EQ;\r\n    case '<': return OPR_LT;\r\n    case TK_LE: return OPR_LE;\r\n    case '>': return OPR_GT;\r\n    case TK_GE: return OPR_GE;\r\n    case TK_AND: return OPR_AND;\r\n    case TK_OR: return OPR_OR;\r\n    default: return OPR_NOBINOPR;\r\n  }\r\n}\r\n\r\n\r\nstatic const struct {\r\n  lu_byte left;  /* left priority for each binary operator */\r\n  lu_byte right; /* right priority */\r\n} priority[] = {  /* ORDER OPR */\r\n   {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7},  /* `+' `-' `*' `/' `%' */\r\n   {10, 9}, {5, 4},                 /* ^, .. (right associative) */\r\n   {3, 3}, {3, 3}, {3, 3},          /* ==, <, <= */\r\n   {3, 3}, {3, 3}, {3, 3},          /* ~=, >, >= */\r\n   {2, 2}, {1, 1}                   /* and, or */\r\n};\r\n\r\n#define UNARY_PRIORITY\t8  /* priority for unary operators */\r\n\r\n\r\n/*\r\n** subexpr -> (simpleexp | unop subexpr) { binop subexpr }\r\n** where `binop' is any binary operator with a priority higher than `limit'\r\n*/\r\nstatic BinOpr subexpr (LexState *ls, expdesc *v, int limit) {\r\n  BinOpr op;\r\n  UnOpr uop;\r\n  enterlevel(ls);\r\n  uop = getunopr(ls->t.token);\r\n  if (uop != OPR_NOUNOPR) {\r\n    int line = ls->linenumber;\r\n    luaX_next(ls);\r\n    subexpr(ls, v, UNARY_PRIORITY);\r\n    luaK_prefix(ls->fs, uop, v, line);\r\n  }\r\n  else simpleexp(ls, v);\r\n  /* expand while operators have priorities higher than `limit' */\r\n  op = getbinopr(ls->t.token);\r\n  while (op != OPR_NOBINOPR && priority[op].left > limit) {\r\n    expdesc v2;\r\n    BinOpr nextop;\r\n    int line = ls->linenumber;\r\n    luaX_next(ls);\r\n    luaK_infix(ls->fs, op, v);\r\n    /* read sub-expression with higher priority */\r\n    nextop = subexpr(ls, &v2, priority[op].right);\r\n    luaK_posfix(ls->fs, op, v, &v2, line);\r\n    op = nextop;\r\n  }\r\n  leavelevel(ls);\r\n  return op;  /* return first untreated operator */\r\n}\r\n\r\n\r\nstatic void expr (LexState *ls, expdesc *v) {\r\n  subexpr(ls, v, 0);\r\n}\r\n\r\n/* }==================================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================================\r\n** Rules for Statements\r\n** =======================================================================\r\n*/\r\n\r\n\r\nstatic void block (LexState *ls) {\r\n  /* block -> statlist */\r\n  FuncState *fs = ls->fs;\r\n  BlockCnt bl;\r\n  enterblock(fs, &bl, 0);\r\n  statlist(ls);\r\n  leaveblock(fs);\r\n}\r\n\r\n\r\n/*\r\n** structure to chain all variables in the left-hand side of an\r\n** assignment\r\n*/\r\nstruct LHS_assign {\r\n  struct LHS_assign *prev;\r\n  expdesc v;  /* variable (global, local, upvalue, or indexed) */\r\n};\r\n\r\n\r\n/*\r\n** check whether, in an assignment to an upvalue/local variable, the\r\n** upvalue/local variable is begin used in a previous assignment to a\r\n** table. If so, save original upvalue/local value in a safe place and\r\n** use this safe copy in the previous assignment.\r\n*/\r\nstatic void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {\r\n  FuncState *fs = ls->fs;\r\n  int extra = fs->freereg;  /* eventual position to save local variable */\r\n  int conflict = 0;\r\n  for (; lh; lh = lh->prev) {  /* check all previous assignments */\r\n    if (lh->v.k == VINDEXED) {  /* assigning to a table? */\r\n      /* table is the upvalue/local being assigned now? */\r\n      if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) {\r\n        conflict = 1;\r\n        lh->v.u.ind.vt = VLOCAL;\r\n        lh->v.u.ind.t = extra;  /* previous assignment will use safe copy */\r\n      }\r\n      /* index is the local being assigned? (index cannot be upvalue) */\r\n      if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) {\r\n        conflict = 1;\r\n        lh->v.u.ind.idx = extra;  /* previous assignment will use safe copy */\r\n      }\r\n    }\r\n  }\r\n  if (conflict) {\r\n    /* copy upvalue/local value to a temporary (in position 'extra') */\r\n    OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL;\r\n    luaK_codeABC(fs, op, extra, v->u.info, 0);\r\n    luaK_reserveregs(fs, 1);\r\n  }\r\n}\r\n\r\n\r\nstatic void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {\r\n  expdesc e;\r\n  check_condition(ls, vkisvar(lh->v.k), \"syntax error\");\r\n  if (testnext(ls, ',')) {  /* assignment -> `,' primaryexp assignment */\r\n    struct LHS_assign nv;\r\n    nv.prev = lh;\r\n    primaryexp(ls, &nv.v);\r\n    if (nv.v.k != VINDEXED)\r\n      check_conflict(ls, lh, &nv.v);\r\n    checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS,\r\n                    \"C levels\");\r\n    assignment(ls, &nv, nvars+1);\r\n  }\r\n  else {  /* assignment -> `=' explist */\r\n    int nexps;\r\n    checknext(ls, '=');\r\n    nexps = explist(ls, &e);\r\n    if (nexps != nvars) {\r\n      adjust_assign(ls, nvars, nexps, &e);\r\n      if (nexps > nvars)\r\n        ls->fs->freereg -= nexps - nvars;  /* remove extra values */\r\n    }\r\n    else {\r\n      luaK_setoneret(ls->fs, &e);  /* close last expression */\r\n      luaK_storevar(ls->fs, &lh->v, &e);\r\n      return;  /* avoid default */\r\n    }\r\n  }\r\n  init_exp(&e, VNONRELOC, ls->fs->freereg-1);  /* default assignment */\r\n  luaK_storevar(ls->fs, &lh->v, &e);\r\n}\r\n\r\n\r\nstatic int cond (LexState *ls) {\r\n  /* cond -> exp */\r\n  expdesc v;\r\n  expr(ls, &v);  /* read condition */\r\n  if (v.k == VNIL) v.k = VFALSE;  /* `falses' are all equal here */\r\n  luaK_goiftrue(ls->fs, &v);\r\n  return v.f;\r\n}\r\n\r\n\r\nstatic void gotostat (LexState *ls, int pc) {\r\n  int line = ls->linenumber;\r\n  TString *label;\r\n  int g;\r\n  if (testnext(ls, TK_GOTO))\r\n    label = str_checkname(ls);\r\n  else {\r\n    luaX_next(ls);  /* skip break */\r\n    label = luaS_new(ls->L, \"break\");\r\n  }\r\n  g = newlabelentry(ls, &ls->dyd->gt, label, line, pc);\r\n  findlabel(ls, g);  /* close it if label already defined */\r\n}\r\n\r\n\r\n/* check for repeated labels on the same block */\r\nstatic void checkrepeated (FuncState *fs, Labellist *ll, TString *label) {\r\n  int i;\r\n  for (i = fs->bl->firstlabel; i < ll->n; i++) {\r\n    if (eqstr(label, ll->arr[i].name)) {\r\n      const char *msg = luaO_pushfstring(fs->ls->L,\r\n                          \"label \" LUA_QS \" already defined on line %d\",\r\n                          getstr(label), ll->arr[i].line);\r\n      semerror(fs->ls, msg);\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void labelstat (LexState *ls, TString *label, int line) {\r\n  /* label -> '::' NAME '::' */\r\n  FuncState *fs = ls->fs;\r\n  Labellist *ll = &ls->dyd->label;\r\n  int l;  /* index of new label being created */\r\n  checkrepeated(fs, ll, label);  /* check for repeated labels */\r\n  checknext(ls, TK_DBCOLON);  /* skip double colon */\r\n  /* create new entry for this label */\r\n  l = newlabelentry(ls, ll, label, line, fs->pc);\r\n  /* skip other no-op statements */\r\n  while (ls->t.token == ';' || ls->t.token == TK_DBCOLON)\r\n    statement(ls);\r\n  if (block_follow(ls, 0)) {  /* label is last no-op statement in the block? */\r\n    /* assume that locals are already out of scope */\r\n    ll->arr[l].nactvar = fs->bl->nactvar;\r\n  }\r\n  findgotos(ls, &ll->arr[l]);\r\n}\r\n\r\n\r\nstatic void whilestat (LexState *ls, int line) {\r\n  /* whilestat -> WHILE cond DO block END */\r\n  FuncState *fs = ls->fs;\r\n  int whileinit;\r\n  int condexit;\r\n  BlockCnt bl;\r\n  luaX_next(ls);  /* skip WHILE */\r\n  whileinit = luaK_getlabel(fs);\r\n  condexit = cond(ls);\r\n  enterblock(fs, &bl, 1);\r\n  checknext(ls, TK_DO);\r\n  block(ls);\r\n  luaK_jumpto(fs, whileinit);\r\n  check_match(ls, TK_END, TK_WHILE, line);\r\n  leaveblock(fs);\r\n  luaK_patchtohere(fs, condexit);  /* false conditions finish the loop */\r\n}\r\n\r\n\r\nstatic void repeatstat (LexState *ls, int line) {\r\n  /* repeatstat -> REPEAT block UNTIL cond */\r\n  int condexit;\r\n  FuncState *fs = ls->fs;\r\n  int repeat_init = luaK_getlabel(fs);\r\n  BlockCnt bl1, bl2;\r\n  enterblock(fs, &bl1, 1);  /* loop block */\r\n  enterblock(fs, &bl2, 0);  /* scope block */\r\n  luaX_next(ls);  /* skip REPEAT */\r\n  statlist(ls);\r\n  check_match(ls, TK_UNTIL, TK_REPEAT, line);\r\n  condexit = cond(ls);  /* read condition (inside scope block) */\r\n  if (bl2.upval)  /* upvalues? */\r\n    luaK_patchclose(fs, condexit, bl2.nactvar);\r\n  leaveblock(fs);  /* finish scope */\r\n  luaK_patchlist(fs, condexit, repeat_init);  /* close the loop */\r\n  leaveblock(fs);  /* finish loop */\r\n}\r\n\r\n\r\nstatic int exp1 (LexState *ls) {\r\n  expdesc e;\r\n  int reg;\r\n  expr(ls, &e);\r\n  luaK_exp2nextreg(ls->fs, &e);\r\n  lua_assert(e.k == VNONRELOC);\r\n  reg = e.u.info;\r\n  return reg;\r\n}\r\n\r\n\r\nstatic void forbody (LexState *ls, int base, int line, int nvars, int isnum) {\r\n  /* forbody -> DO block */\r\n  BlockCnt bl;\r\n  FuncState *fs = ls->fs;\r\n  int prep, endfor;\r\n  adjustlocalvars(ls, 3);  /* control variables */\r\n  checknext(ls, TK_DO);\r\n  prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);\r\n  enterblock(fs, &bl, 0);  /* scope for declared variables */\r\n  adjustlocalvars(ls, nvars);\r\n  luaK_reserveregs(fs, nvars);\r\n  block(ls);\r\n  leaveblock(fs);  /* end of scope for declared variables */\r\n  luaK_patchtohere(fs, prep);\r\n  if (isnum)  /* numeric for? */\r\n    endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);\r\n  else {  /* generic for */\r\n    luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars);\r\n    luaK_fixline(fs, line);\r\n    endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);\r\n  }\r\n  luaK_patchlist(fs, endfor, prep + 1);\r\n  luaK_fixline(fs, line);\r\n}\r\n\r\n\r\nstatic void fornum (LexState *ls, TString *varname, int line) {\r\n  /* fornum -> NAME = exp1,exp1[,exp1] forbody */\r\n  FuncState *fs = ls->fs;\r\n  int base = fs->freereg;\r\n  new_localvarliteral(ls, \"(for index)\");\r\n  new_localvarliteral(ls, \"(for limit)\");\r\n  new_localvarliteral(ls, \"(for step)\");\r\n  new_localvar(ls, varname);\r\n  checknext(ls, '=');\r\n  exp1(ls);  /* initial value */\r\n  checknext(ls, ',');\r\n  exp1(ls);  /* limit */\r\n  if (testnext(ls, ','))\r\n    exp1(ls);  /* optional step */\r\n  else {  /* default step = 1 */\r\n    luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1));\r\n    luaK_reserveregs(fs, 1);\r\n  }\r\n  forbody(ls, base, line, 1, 1);\r\n}\r\n\r\n\r\nstatic void forlist (LexState *ls, TString *indexname) {\r\n  /* forlist -> NAME {,NAME} IN explist forbody */\r\n  FuncState *fs = ls->fs;\r\n  expdesc e;\r\n  int nvars = 4;  /* gen, state, control, plus at least one declared var */\r\n  int line;\r\n  int base = fs->freereg;\r\n  /* create control variables */\r\n  new_localvarliteral(ls, \"(for generator)\");\r\n  new_localvarliteral(ls, \"(for state)\");\r\n  new_localvarliteral(ls, \"(for control)\");\r\n  /* create declared variables */\r\n  new_localvar(ls, indexname);\r\n  while (testnext(ls, ',')) {\r\n    new_localvar(ls, str_checkname(ls));\r\n    nvars++;\r\n  }\r\n  checknext(ls, TK_IN);\r\n  line = ls->linenumber;\r\n  adjust_assign(ls, 3, explist(ls, &e), &e);\r\n  luaK_checkstack(fs, 3);  /* extra space to call generator */\r\n  forbody(ls, base, line, nvars - 3, 0);\r\n}\r\n\r\n\r\nstatic void forstat (LexState *ls, int line) {\r\n  /* forstat -> FOR (fornum | forlist) END */\r\n  FuncState *fs = ls->fs;\r\n  TString *varname;\r\n  BlockCnt bl;\r\n  enterblock(fs, &bl, 1);  /* scope for loop and control variables */\r\n  luaX_next(ls);  /* skip `for' */\r\n  varname = str_checkname(ls);  /* first variable name */\r\n  switch (ls->t.token) {\r\n    case '=': fornum(ls, varname, line); break;\r\n    case ',': case TK_IN: forlist(ls, varname); break;\r\n    default: luaX_syntaxerror(ls, LUA_QL(\"=\") \" or \" LUA_QL(\"in\") \" expected\");\r\n  }\r\n  check_match(ls, TK_END, TK_FOR, line);\r\n  leaveblock(fs);  /* loop scope (`break' jumps to this point) */\r\n}\r\n\r\n\r\nstatic void test_then_block (LexState *ls, int *escapelist) {\r\n  /* test_then_block -> [IF | ELSEIF] cond THEN block */\r\n  BlockCnt bl;\r\n  FuncState *fs = ls->fs;\r\n  expdesc v;\r\n  int jf;  /* instruction to skip 'then' code (if condition is false) */\r\n  luaX_next(ls);  /* skip IF or ELSEIF */\r\n  expr(ls, &v);  /* read condition */\r\n  checknext(ls, TK_THEN);\r\n  if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) {\r\n    luaK_goiffalse(ls->fs, &v);  /* will jump to label if condition is true */\r\n    enterblock(fs, &bl, 0);  /* must enter block before 'goto' */\r\n    gotostat(ls, v.t);  /* handle goto/break */\r\n    if (block_follow(ls, 0)) {  /* 'goto' is the entire block? */\r\n      leaveblock(fs);\r\n      return;  /* and that is it */\r\n    }\r\n    else  /* must skip over 'then' part if condition is false */\r\n      jf = luaK_jump(fs);\r\n  }\r\n  else {  /* regular case (not goto/break) */\r\n    luaK_goiftrue(ls->fs, &v);  /* skip over block if condition is false */\r\n    enterblock(fs, &bl, 0);\r\n    jf = v.f;\r\n  }\r\n  statlist(ls);  /* `then' part */\r\n  leaveblock(fs);\r\n  if (ls->t.token == TK_ELSE ||\r\n      ls->t.token == TK_ELSEIF)  /* followed by 'else'/'elseif'? */\r\n    luaK_concat(fs, escapelist, luaK_jump(fs));  /* must jump over it */\r\n  luaK_patchtohere(fs, jf);\r\n}\r\n\r\n\r\nstatic void ifstat (LexState *ls, int line) {\r\n  /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */\r\n  FuncState *fs = ls->fs;\r\n  int escapelist = NO_JUMP;  /* exit list for finished parts */\r\n  test_then_block(ls, &escapelist);  /* IF cond THEN block */\r\n  while (ls->t.token == TK_ELSEIF)\r\n    test_then_block(ls, &escapelist);  /* ELSEIF cond THEN block */\r\n  if (testnext(ls, TK_ELSE))\r\n    block(ls);  /* `else' part */\r\n  check_match(ls, TK_END, TK_IF, line);\r\n  luaK_patchtohere(fs, escapelist);  /* patch escape list to 'if' end */\r\n}\r\n\r\n\r\nstatic void localfunc (LexState *ls) {\r\n  expdesc b;\r\n  FuncState *fs = ls->fs;\r\n  new_localvar(ls, str_checkname(ls));  /* new local variable */\r\n  adjustlocalvars(ls, 1);  /* enter its scope */\r\n  body(ls, &b, 0, ls->linenumber);  /* function created in next register */\r\n  /* debug information will only see the variable after this point! */\r\n  getlocvar(fs, b.u.info)->startpc = fs->pc;\r\n}\r\n\r\n\r\nstatic void localstat (LexState *ls) {\r\n  /* stat -> LOCAL NAME {`,' NAME} [`=' explist] */\r\n  int nvars = 0;\r\n  int nexps;\r\n  expdesc e;\r\n  do {\r\n    new_localvar(ls, str_checkname(ls));\r\n    nvars++;\r\n  } while (testnext(ls, ','));\r\n  if (testnext(ls, '='))\r\n    nexps = explist(ls, &e);\r\n  else {\r\n    e.k = VVOID;\r\n    nexps = 0;\r\n  }\r\n  adjust_assign(ls, nvars, nexps, &e);\r\n  adjustlocalvars(ls, nvars);\r\n}\r\n\r\n\r\nstatic int funcname (LexState *ls, expdesc *v) {\r\n  /* funcname -> NAME {fieldsel} [`:' NAME] */\r\n  int ismethod = 0;\r\n  singlevar(ls, v);\r\n  while (ls->t.token == '.')\r\n    fieldsel(ls, v);\r\n  if (ls->t.token == ':') {\r\n    ismethod = 1;\r\n    fieldsel(ls, v);\r\n  }\r\n  return ismethod;\r\n}\r\n\r\n\r\nstatic void funcstat (LexState *ls, int line) {\r\n  /* funcstat -> FUNCTION funcname body */\r\n  int ismethod;\r\n  expdesc v, b;\r\n  luaX_next(ls);  /* skip FUNCTION */\r\n  ismethod = funcname(ls, &v);\r\n  body(ls, &b, ismethod, line);\r\n  luaK_storevar(ls->fs, &v, &b);\r\n  luaK_fixline(ls->fs, line);  /* definition `happens' in the first line */\r\n}\r\n\r\n\r\nstatic void exprstat (LexState *ls) {\r\n  /* stat -> func | assignment */\r\n  FuncState *fs = ls->fs;\r\n  struct LHS_assign v;\r\n  primaryexp(ls, &v.v);\r\n  if (v.v.k == VCALL)  /* stat -> func */\r\n    SETARG_C(getcode(fs, &v.v), 1);  /* call statement uses no results */\r\n  else {  /* stat -> assignment */\r\n    v.prev = NULL;\r\n    assignment(ls, &v, 1);\r\n  }\r\n}\r\n\r\n\r\nstatic void retstat (LexState *ls) {\r\n  /* stat -> RETURN [explist] [';'] */\r\n  FuncState *fs = ls->fs;\r\n  expdesc e;\r\n  int first, nret;  /* registers with returned values */\r\n  if (block_follow(ls, 1) || ls->t.token == ';')\r\n    first = nret = 0;  /* return no values */\r\n  else {\r\n    nret = explist(ls, &e);  /* optional return values */\r\n    if (hasmultret(e.k)) {\r\n      luaK_setmultret(fs, &e);\r\n      if (e.k == VCALL && nret == 1) {  /* tail call? */\r\n        SET_OPCODE(getcode(fs,&e), OP_TAILCALL);\r\n        lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);\r\n      }\r\n      first = fs->nactvar;\r\n      nret = LUA_MULTRET;  /* return all values */\r\n    }\r\n    else {\r\n      if (nret == 1)  /* only one single value? */\r\n        first = luaK_exp2anyreg(fs, &e);\r\n      else {\r\n        luaK_exp2nextreg(fs, &e);  /* values must go to the `stack' */\r\n        first = fs->nactvar;  /* return all `active' values */\r\n        lua_assert(nret == fs->freereg - first);\r\n      }\r\n    }\r\n  }\r\n  luaK_ret(fs, first, nret);\r\n  testnext(ls, ';');  /* skip optional semicolon */\r\n}\r\n\r\n\r\nstatic void statement (LexState *ls) {\r\n  int line = ls->linenumber;  /* may be needed for error messages */\r\n  enterlevel(ls);\r\n  switch (ls->t.token) {\r\n    case ';': {  /* stat -> ';' (empty statement) */\r\n      luaX_next(ls);  /* skip ';' */\r\n      break;\r\n    }\r\n    case TK_IF: {  /* stat -> ifstat */\r\n      ifstat(ls, line);\r\n      break;\r\n    }\r\n    case TK_WHILE: {  /* stat -> whilestat */\r\n      whilestat(ls, line);\r\n      break;\r\n    }\r\n    case TK_DO: {  /* stat -> DO block END */\r\n      luaX_next(ls);  /* skip DO */\r\n      block(ls);\r\n      check_match(ls, TK_END, TK_DO, line);\r\n      break;\r\n    }\r\n    case TK_FOR: {  /* stat -> forstat */\r\n      forstat(ls, line);\r\n      break;\r\n    }\r\n    case TK_REPEAT: {  /* stat -> repeatstat */\r\n      repeatstat(ls, line);\r\n      break;\r\n    }\r\n    case TK_FUNCTION: {  /* stat -> funcstat */\r\n      funcstat(ls, line);\r\n      break;\r\n    }\r\n    case TK_LOCAL: {  /* stat -> localstat */\r\n      luaX_next(ls);  /* skip LOCAL */\r\n      if (testnext(ls, TK_FUNCTION))  /* local function? */\r\n        localfunc(ls);\r\n      else\r\n        localstat(ls);\r\n      break;\r\n    }\r\n    case TK_DBCOLON: {  /* stat -> label */\r\n      luaX_next(ls);  /* skip double colon */\r\n      labelstat(ls, str_checkname(ls), line);\r\n      break;\r\n    }\r\n    case TK_RETURN: {  /* stat -> retstat */\r\n      luaX_next(ls);  /* skip RETURN */\r\n      retstat(ls);\r\n      break;\r\n    }\r\n    case TK_BREAK:   /* stat -> breakstat */\r\n    case TK_GOTO: {  /* stat -> 'goto' NAME */\r\n      gotostat(ls, luaK_jump(ls->fs));\r\n      break;\r\n    }\r\n    default: {  /* stat -> func | assignment */\r\n      exprstat(ls);\r\n      break;\r\n    }\r\n  }\r\n  lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg &&\r\n             ls->fs->freereg >= ls->fs->nactvar);\r\n  ls->fs->freereg = ls->fs->nactvar;  /* free registers */\r\n  leavelevel(ls);\r\n}\r\n\r\n/* }====================================================================== */\r\n\r\n\r\nProto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,\r\n                    Dyndata *dyd, const char *name, int firstchar) {\r\n  LexState lexstate;\r\n  FuncState funcstate;\r\n  BlockCnt bl;\r\n  TString *tname = luaS_new(L, name);\r\n  setsvalue2s(L, L->top, tname);  /* push name to protect it */\r\n  incr_top(L);\r\n  lexstate.buff = buff;\r\n  lexstate.dyd = dyd;\r\n  dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;\r\n  luaX_setinput(L, &lexstate, z, tname, firstchar);\r\n  open_mainfunc(&lexstate, &funcstate, &bl);\r\n  luaX_next(&lexstate);  /* read first token */\r\n  statlist(&lexstate);  /* main body */\r\n  check(&lexstate, TK_EOS);\r\n  close_func(&lexstate);\r\n  L->top--;  /* pop name */\r\n  lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);\r\n  /* all scopes should be correctly finished */\r\n  lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);\r\n  return funcstate.f;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lparser.h",
    "content": "/*\r\n** $Id: lparser.h,v 1.69 2011/07/27 18:09:01 roberto Exp $\r\n** Lua Parser\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lparser_h\r\n#define lparser_h\r\n\r\n#include \"llimits.h\"\r\n#include \"lobject.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\n/*\r\n** Expression descriptor\r\n*/\r\n\r\ntypedef enum {\r\n  VVOID,\t/* no value */\r\n  VNIL,\r\n  VTRUE,\r\n  VFALSE,\r\n  VK,\t\t/* info = index of constant in `k' */\r\n  VKNUM,\t/* nval = numerical value */\r\n  VNONRELOC,\t/* info = result register */\r\n  VLOCAL,\t/* info = local register */\r\n  VUPVAL,       /* info = index of upvalue in 'upvalues' */\r\n  VINDEXED,\t/* t = table register/upvalue; idx = index R/K */\r\n  VJMP,\t\t/* info = instruction pc */\r\n  VRELOCABLE,\t/* info = instruction pc */\r\n  VCALL,\t/* info = instruction pc */\r\n  VVARARG\t/* info = instruction pc */\r\n} expkind;\r\n\r\n\r\n#define vkisvar(k)\t(VLOCAL <= (k) && (k) <= VINDEXED)\r\n#define vkisinreg(k)\t((k) == VNONRELOC || (k) == VLOCAL)\r\n\r\ntypedef struct expdesc {\r\n  expkind k;\r\n  union {\r\n    struct {  /* for indexed variables (VINDEXED) */\r\n      short idx;  /* index (R/K) */\r\n      lu_byte t;  /* table (register or upvalue) */\r\n      lu_byte vt;  /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */\r\n    } ind;\r\n    int info;  /* for generic use */\r\n    lua_Number nval;  /* for VKNUM */\r\n  } u;\r\n  int t;  /* patch list of `exit when true' */\r\n  int f;  /* patch list of `exit when false' */\r\n} expdesc;\r\n\r\n\r\n/* description of active local variable */\r\ntypedef struct Vardesc {\r\n  short idx;  /* variable index in stack */\r\n} Vardesc;\r\n\r\n\r\n/* description of pending goto statements and label statements */\r\ntypedef struct Labeldesc {\r\n  TString *name;  /* label identifier */\r\n  int pc;  /* position in code */\r\n  int line;  /* line where it appeared */\r\n  lu_byte nactvar;  /* local level where it appears in current block */\r\n} Labeldesc;\r\n\r\n\r\n/* list of labels or gotos */\r\ntypedef struct Labellist {\r\n  Labeldesc *arr;  /* array */\r\n  int n;  /* number of entries in use */\r\n  int size;  /* array size */\r\n} Labellist;\r\n\r\n\r\n/* dynamic structures used by the parser */\r\ntypedef struct Dyndata {\r\n  struct {  /* list of active local variables */\r\n    Vardesc *arr;\r\n    int n;\r\n    int size;\r\n  } actvar;\r\n  Labellist gt;  /* list of pending gotos */\r\n  Labellist label;   /* list of active labels */\r\n} Dyndata;\r\n\r\n\r\n/* control of blocks */\r\nstruct BlockCnt;  /* defined in lparser.c */\r\n\r\n\r\n/* state needed to generate code for a given function */\r\ntypedef struct FuncState {\r\n  Proto *f;  /* current function header */\r\n  Table *h;  /* table to find (and reuse) elements in `k' */\r\n  struct FuncState *prev;  /* enclosing function */\r\n  struct LexState *ls;  /* lexical state */\r\n  struct BlockCnt *bl;  /* chain of current blocks */\r\n  int pc;  /* next position to code (equivalent to `ncode') */\r\n  int lasttarget;   /* 'label' of last 'jump label' */\r\n  int jpc;  /* list of pending jumps to `pc' */\r\n  int nk;  /* number of elements in `k' */\r\n  int np;  /* number of elements in `p' */\r\n  int firstlocal;  /* index of first local var (in Dyndata array) */\r\n  short nlocvars;  /* number of elements in 'f->locvars' */\r\n  lu_byte nactvar;  /* number of active local variables */\r\n  lu_byte nups;  /* number of upvalues */\r\n  lu_byte freereg;  /* first free register */\r\n} FuncState;\r\n\r\n\r\nLUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,\r\n                              Dyndata *dyd, const char *name, int firstchar);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lstate.c",
    "content": "/*\r\n** $Id: lstate.c,v 2.92 2011/10/03 17:54:25 roberto Exp $\r\n** Global State\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#define lstate_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lapi.h\"\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lgc.h\"\r\n#include \"llex.h\"\r\n#include \"lmem.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n\r\n\r\n#if !defined(LUAI_GCPAUSE)\r\n#define LUAI_GCPAUSE\t200  /* 200% */\r\n#endif\r\n\r\n#if !defined(LUAI_GCMAJOR)\r\n#define LUAI_GCMAJOR\t200  /* 200% */\r\n#endif\r\n\r\n#if !defined(LUAI_GCMUL)\r\n#define LUAI_GCMUL\t200 /* GC runs 'twice the speed' of memory allocation */\r\n#endif\r\n\r\n\r\n#define MEMERRMSG       \"not enough memory\"\r\n\r\n\r\n/*\r\n** thread state + extra space\r\n*/\r\ntypedef struct LX {\r\n#if defined(LUAI_EXTRASPACE)\r\n  char buff[LUAI_EXTRASPACE];\r\n#endif\r\n  lua_State l;\r\n} LX;\r\n\r\n\r\n/*\r\n** Main thread combines a thread state and the global state\r\n*/\r\ntypedef struct LG {\r\n  LX l;\r\n  global_State g;\r\n} LG;\r\n\r\n\r\n\r\n#define fromstate(L)\t(cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l)))\r\n\r\n\r\n/*\r\n** set GCdebt to a new value keeping the value (totalbytes + GCdebt)\r\n** invariant\r\n*/\r\nvoid luaE_setdebt (global_State *g, l_mem debt) {\r\n  g->totalbytes -= (debt - g->GCdebt);\r\n  g->GCdebt = debt;\r\n}\r\n\r\n\r\nCallInfo *luaE_extendCI (lua_State *L) {\r\n  CallInfo *ci = luaM_new(L, CallInfo);\r\n  lua_assert(L->ci->next == NULL);\r\n  L->ci->next = ci;\r\n  ci->previous = L->ci;\r\n  ci->next = NULL;\r\n  return ci;\r\n}\r\n\r\n\r\nvoid luaE_freeCI (lua_State *L) {\r\n  CallInfo *ci = L->ci;\r\n  CallInfo *next = ci->next;\r\n  ci->next = NULL;\r\n  while ((ci = next) != NULL) {\r\n    next = ci->next;\r\n    luaM_free(L, ci);\r\n  }\r\n}\r\n\r\n\r\nstatic void stack_init (lua_State *L1, lua_State *L) {\r\n  int i; CallInfo *ci;\r\n  /* initialize stack array */\r\n  L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue);\r\n  L1->stacksize = BASIC_STACK_SIZE;\r\n  for (i = 0; i < BASIC_STACK_SIZE; i++)\r\n    setnilvalue(L1->stack + i);  /* erase new stack */\r\n  L1->top = L1->stack;\r\n  L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK;\r\n  /* initialize first ci */\r\n  ci = &L1->base_ci;\r\n  ci->next = ci->previous = NULL;\r\n  ci->callstatus = 0;\r\n  ci->func = L1->top;\r\n  setnilvalue(L1->top++);  /* 'function' entry for this 'ci' */\r\n  ci->top = L1->top + LUA_MINSTACK;\r\n  L1->ci = ci;\r\n}\r\n\r\n\r\nstatic void freestack (lua_State *L) {\r\n  if (L->stack == NULL)\r\n    return;  /* stack not completely built yet */\r\n  L->ci = &L->base_ci;  /* free the entire 'ci' list */\r\n  luaE_freeCI(L);\r\n  luaM_freearray(L, L->stack, L->stacksize);  /* free stack array */\r\n}\r\n\r\n\r\n/*\r\n** Create registry table and its predefined values\r\n*/\r\nstatic void init_registry (lua_State *L, global_State *g) {\r\n  TValue mt;\r\n  /* create registry */\r\n  Table *registry = luaH_new(L);\r\n  sethvalue(L, &g->l_registry, registry);\r\n  luaH_resize(L, registry, LUA_RIDX_LAST, 0);\r\n  /* registry[LUA_RIDX_MAINTHREAD] = L */\r\n  setthvalue(L, &mt, L);\r\n  luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt);\r\n  /* registry[LUA_RIDX_GLOBALS] = table of globals */\r\n  sethvalue(L, &mt, luaH_new(L));\r\n  luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt);\r\n}\r\n\r\n\r\n/*\r\n** open parts of the state that may cause memory-allocation errors\r\n*/\r\nstatic void f_luaopen (lua_State *L, void *ud) {\r\n  global_State *g = G(L);\r\n  UNUSED(ud);\r\n  stack_init(L, L);  /* init stack */\r\n  init_registry(L, g);\r\n  luaS_resize(L, MINSTRTABSIZE);  /* initial size of string table */\r\n  luaT_init(L);\r\n  luaX_init(L);\r\n  /* pre-create memory-error message */\r\n  g->memerrmsg = luaS_newliteral(L, MEMERRMSG);\r\n  luaS_fix(g->memerrmsg);  /* it should never be collected */\r\n  g->gcrunning = 1;  /* allow gc */\r\n}\r\n\r\n\r\n/*\r\n** preinitialize a state with consistent values without allocating\r\n** any memory (to avoid errors)\r\n*/\r\nstatic void preinit_state (lua_State *L, global_State *g) {\r\n  G(L) = g;\r\n  L->stack = NULL;\r\n  L->ci = NULL;\r\n  L->stacksize = 0;\r\n  L->errorJmp = NULL;\r\n  L->nCcalls = 0;\r\n  L->hook = NULL;\r\n  L->hookmask = 0;\r\n  L->basehookcount = 0;\r\n  L->allowhook = 1;\r\n  resethookcount(L);\r\n  L->openupval = NULL;\r\n  L->nny = 1;\r\n  L->status = LUA_OK;\r\n  L->errfunc = 0;\r\n}\r\n\r\n\r\nstatic void close_state (lua_State *L) {\r\n  global_State *g = G(L);\r\n  luaF_close(L, L->stack);  /* close all upvalues for this thread */\r\n  luaC_freeallobjects(L);  /* collect all objects */\r\n  luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);\r\n  luaZ_freebuffer(L, &g->buff);\r\n  freestack(L);\r\n  lua_assert(gettotalbytes(g) == sizeof(LG));\r\n  (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0);  /* free main block */\r\n}\r\n\r\n\r\nLUA_API lua_State *lua_newthread (lua_State *L) {\r\n  lua_State *L1;\r\n  lua_lock(L);\r\n  luaC_checkGC(L);\r\n  L1 = &luaC_newobj(L, LUA_TTHREAD, sizeof(LX), NULL, offsetof(LX, l))->th;\r\n  setthvalue(L, L->top, L1);\r\n  api_incr_top(L);\r\n  preinit_state(L1, G(L));\r\n  L1->hookmask = L->hookmask;\r\n  L1->basehookcount = L->basehookcount;\r\n  L1->hook = L->hook;\r\n  resethookcount(L1);\r\n  luai_userstatethread(L, L1);\r\n  stack_init(L1, L);  /* init stack */\r\n  lua_unlock(L);\r\n  return L1;\r\n}\r\n\r\n\r\nvoid luaE_freethread (lua_State *L, lua_State *L1) {\r\n  LX *l = fromstate(L1);\r\n  luaF_close(L1, L1->stack);  /* close all upvalues for this thread */\r\n  lua_assert(L1->openupval == NULL);\r\n  luai_userstatefree(L, L1);\r\n  freestack(L1);\r\n  luaM_free(L, l);\r\n}\r\n\r\n\r\nLUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {\r\n  int i;\r\n  lua_State *L;\r\n  global_State *g;\r\n  LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG)));\r\n  if (l == NULL) return NULL;\r\n  L = &l->l.l;\r\n  g = &l->g;\r\n  L->next = NULL;\r\n  L->tt = LUA_TTHREAD;\r\n  g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);\r\n  L->marked = luaC_white(g);\r\n  g->gckind = KGC_NORMAL;\r\n  preinit_state(L, g);\r\n  g->frealloc = f;\r\n  g->ud = ud;\r\n  g->mainthread = L;\r\n  g->uvhead.u.l.prev = &g->uvhead;\r\n  g->uvhead.u.l.next = &g->uvhead;\r\n  g->gcrunning = 0;  /* no GC while building state */\r\n  g->lastmajormem = 0;\r\n  g->strt.size = 0;\r\n  g->strt.nuse = 0;\r\n  g->strt.hash = NULL;\r\n  setnilvalue(&g->l_registry);\r\n  luaZ_initbuffer(L, &g->buff);\r\n  g->panic = NULL;\r\n  g->version = lua_version(NULL);\r\n  g->gcstate = GCSpause;\r\n  g->allgc = NULL;\r\n  g->finobj = NULL;\r\n  g->tobefnz = NULL;\r\n  g->gray = g->grayagain = NULL;\r\n  g->weak = g->ephemeron = g->allweak = NULL;\r\n  g->totalbytes = sizeof(LG);\r\n  g->GCdebt = 0;\r\n  g->gcpause = LUAI_GCPAUSE;\r\n  g->gcmajorinc = LUAI_GCMAJOR;\r\n  g->gcstepmul = LUAI_GCMUL;\r\n  for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;\r\n  if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {\r\n    /* memory allocation error: free partial state */\r\n    close_state(L);\r\n    L = NULL;\r\n  }\r\n  else\r\n    luai_userstateopen(L);\r\n  return L;\r\n}\r\n\r\n\r\nLUA_API void lua_close (lua_State *L) {\r\n  L = G(L)->mainthread;  /* only the main thread can be closed */\r\n  lua_lock(L);\r\n  luai_userstateclose(L);\r\n  close_state(L);\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lstate.h",
    "content": "/*\r\n** $Id: lstate.h,v 2.74 2011/09/30 12:45:07 roberto Exp $\r\n** Global State\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lstate_h\r\n#define lstate_h\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lobject.h\"\r\n#include \"ltm.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\n/*\r\n\r\n** Some notes about garbage-collected objects:  All objects in Lua must\r\n** be kept somehow accessible until being freed.\r\n**\r\n** Lua keeps most objects linked in list g->allgc. The link uses field\r\n** 'next' of the CommonHeader.\r\n**\r\n** Strings are kept in several lists headed by the array g->strt.hash.\r\n**\r\n** Open upvalues are not subject to independent garbage collection. They\r\n** are collected together with their respective threads. Lua keeps a\r\n** double-linked list with all open upvalues (g->uvhead) so that it can\r\n** mark objects referred by them. (They are always gray, so they must\r\n** be remarked in the atomic step. Usually their contents would be marked\r\n** when traversing the respective threads, but the thread may already be\r\n** dead, while the upvalue is still accessible through closures.)\r\n**\r\n** Objects with finalizers are kept in the list g->finobj.\r\n**\r\n** The list g->tobefnz links all objects being finalized.\r\n\r\n*/\r\n\r\n\r\nstruct lua_longjmp;  /* defined in ldo.c */\r\n\r\n\r\n\r\n/* extra stack space to handle TM calls and some other extras */\r\n#define EXTRA_STACK   5\r\n\r\n\r\n#define BASIC_STACK_SIZE        (2*LUA_MINSTACK)\r\n\r\n\r\n/* kinds of Garbage Collection */\r\n#define KGC_NORMAL\t0\r\n#define KGC_EMERGENCY\t1\t/* gc was forced by an allocation failure */\r\n#define KGC_GEN\t\t2\t/* generational collection */\r\n\r\n\r\ntypedef struct stringtable {\r\n  GCObject **hash;\r\n  lu_int32 nuse;  /* number of elements */\r\n  int size;\r\n} stringtable;\r\n\r\n\r\n/*\r\n** information about a call\r\n*/\r\ntypedef struct CallInfo {\r\n  StkId func;  /* function index in the stack */\r\n  StkId\ttop;  /* top for this function */\r\n  struct CallInfo *previous, *next;  /* dynamic call link */\r\n  short nresults;  /* expected number of results from this function */\r\n  lu_byte callstatus;\r\n  union {\r\n    struct {  /* only for Lua functions */\r\n      StkId base;  /* base for this function */\r\n      const Instruction *savedpc;\r\n    } l;\r\n    struct {  /* only for C functions */\r\n      int ctx;  /* context info. in case of yields */\r\n      lua_CFunction k;  /* continuation in case of yields */\r\n      ptrdiff_t old_errfunc;\r\n      ptrdiff_t extra;\r\n      lu_byte old_allowhook;\r\n      lu_byte status;\r\n    } c;\r\n  } u;\r\n} CallInfo;\r\n\r\n\r\n/*\r\n** Bits in CallInfo status\r\n*/\r\n#define CIST_LUA\t(1<<0)\t/* call is running a Lua function */\r\n#define CIST_HOOKED\t(1<<1)\t/* call is running a debug hook */\r\n#define CIST_REENTRY\t(1<<2)\t/* call is running on same invocation of\r\n                                   luaV_execute of previous call */\r\n#define CIST_YIELDED\t(1<<3)\t/* call reentered after suspension */\r\n#define CIST_YPCALL\t(1<<4)\t/* call is a yieldable protected call */\r\n#define CIST_STAT\t(1<<5)\t/* call has an error status (pcall) */\r\n#define CIST_TAIL\t(1<<6)\t/* call was tail called */\r\n\r\n\r\n#define isLua(ci)\t((ci)->callstatus & CIST_LUA)\r\n\r\n\r\n/*\r\n** `global state', shared by all threads of this state\r\n*/\r\ntypedef struct global_State {\r\n  lua_Alloc frealloc;  /* function to reallocate memory */\r\n  void *ud;         /* auxiliary data to `frealloc' */\r\n  lu_mem totalbytes;  /* number of bytes currently allocated - GCdebt */\r\n  l_mem GCdebt;  /* bytes allocated not yet compensated by the collector */\r\n  lu_mem lastmajormem;  /* memory in use after last major collection */\r\n  stringtable strt;  /* hash table for strings */\r\n  TValue l_registry;\r\n  lu_byte currentwhite;\r\n  lu_byte gcstate;  /* state of garbage collector */\r\n  lu_byte gckind;  /* kind of GC running */\r\n  lu_byte gcrunning;  /* true if GC is running */\r\n  int sweepstrgc;  /* position of sweep in `strt' */\r\n  GCObject *allgc;  /* list of all collectable objects */\r\n  GCObject *finobj;  /* list of collectable objects with finalizers */\r\n  GCObject **sweepgc;  /* current position of sweep */\r\n  GCObject *gray;  /* list of gray objects */\r\n  GCObject *grayagain;  /* list of objects to be traversed atomically */\r\n  GCObject *weak;  /* list of tables with weak values */\r\n  GCObject *ephemeron;  /* list of ephemeron tables (weak keys) */\r\n  GCObject *allweak;  /* list of all-weak tables */\r\n  GCObject *tobefnz;  /* list of userdata to be GC */\r\n  UpVal uvhead;  /* head of double-linked list of all open upvalues */\r\n  Mbuffer buff;  /* temporary buffer for string concatenation */\r\n  int gcpause;  /* size of pause between successive GCs */\r\n  int gcmajorinc;  /* how much to wait for a major GC (only in gen. mode) */\r\n  int gcstepmul;  /* GC `granularity' */\r\n  lua_CFunction panic;  /* to be called in unprotected errors */\r\n  struct lua_State *mainthread;\r\n  const lua_Number *version;  /* pointer to version number */\r\n  TString *memerrmsg;  /* memory-error message */\r\n  TString *tmname[TM_N];  /* array with tag-method names */\r\n  struct Table *mt[LUA_NUMTAGS];  /* metatables for basic types */\r\n} global_State;\r\n\r\n\r\n/*\r\n** `per thread' state\r\n*/\r\nstruct lua_State {\r\n  CommonHeader;\r\n  lu_byte status;\r\n  StkId top;  /* first free slot in the stack */\r\n  global_State *l_G;\r\n  CallInfo *ci;  /* call info for current function */\r\n  const Instruction *oldpc;  /* last pc traced */\r\n  StkId stack_last;  /* last free slot in the stack */\r\n  StkId stack;  /* stack base */\r\n  int stacksize;\r\n  unsigned short nny;  /* number of non-yieldable calls in stack */\r\n  unsigned short nCcalls;  /* number of nested C calls */\r\n  lu_byte hookmask;\r\n  lu_byte allowhook;\r\n  int basehookcount;\r\n  int hookcount;\r\n  lua_Hook hook;\r\n  GCObject *openupval;  /* list of open upvalues in this stack */\r\n  GCObject *gclist;\r\n  struct lua_longjmp *errorJmp;  /* current error recover point */\r\n  ptrdiff_t errfunc;  /* current error handling function (stack index) */\r\n  CallInfo base_ci;  /* CallInfo for first level (C calling Lua) */\r\n};\r\n\r\n\r\n#define G(L)\t(L->l_G)\r\n\r\n\r\n/*\r\n** Union of all collectable objects\r\n*/\r\nunion GCObject {\r\n  GCheader gch;  /* common header */\r\n  union TString ts;\r\n  union Udata u;\r\n  union Closure cl;\r\n  struct Table h;\r\n  struct Proto p;\r\n  struct UpVal uv;\r\n  struct lua_State th;  /* thread */\r\n};\r\n\r\n\r\n#define gch(o)\t\t(&(o)->gch)\r\n\r\n/* macros to convert a GCObject into a specific value */\r\n#define rawgco2ts(o)\tcheck_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))\r\n#define gco2ts(o)\t(&rawgco2ts(o)->tsv)\r\n#define rawgco2u(o)\tcheck_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))\r\n#define gco2u(o)\t(&rawgco2u(o)->uv)\r\n#define gco2cl(o)\tcheck_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))\r\n#define gco2t(o)\tcheck_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))\r\n#define gco2p(o)\tcheck_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))\r\n#define gco2uv(o)\tcheck_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))\r\n#define gco2th(o)\tcheck_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))\r\n\r\n/* macro to convert any Lua object into a GCObject */\r\n#define obj2gco(v)\t(cast(GCObject *, (v)))\r\n\r\n\r\n/* actual number of total bytes allocated */\r\n#define gettotalbytes(g)\t((g)->totalbytes + (g)->GCdebt)\r\n\r\nLUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);\r\nLUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);\r\nLUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);\r\nLUAI_FUNC void luaE_freeCI (lua_State *L);\r\n\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lstring.c",
    "content": "/*\r\n** $Id: lstring.c,v 2.19 2011/05/03 16:01:57 roberto Exp $\r\n** String table (keeps all strings handled by Lua)\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <string.h>\r\n\r\n#define lstring_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n\r\n\r\n\r\nvoid luaS_resize (lua_State *L, int newsize) {\r\n  int i;\r\n  stringtable *tb = &G(L)->strt;\r\n  /* cannot resize while GC is traversing strings */\r\n  luaC_runtilstate(L, ~bitmask(GCSsweepstring));\r\n  if (newsize > tb->size) {\r\n    luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);\r\n    for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL;\r\n  }\r\n  /* rehash */\r\n  for (i=0; i<tb->size; i++) {\r\n    GCObject *p = tb->hash[i];\r\n    tb->hash[i] = NULL;\r\n    while (p) {  /* for each node in the list */\r\n      GCObject *next = gch(p)->next;  /* save next */\r\n      unsigned int h = lmod(gco2ts(p)->hash, newsize);  /* new position */\r\n      gch(p)->next = tb->hash[h];  /* chain it */\r\n      tb->hash[h] = p;\r\n      resetoldbit(p);  /* see MOVE OLD rule */\r\n      p = next;\r\n    }\r\n  }\r\n  if (newsize < tb->size) {\r\n    /* shrinking slice must be empty */\r\n    lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL);\r\n    luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);\r\n  }\r\n  tb->size = newsize;\r\n}\r\n\r\n\r\nstatic TString *newlstr (lua_State *L, const char *str, size_t l,\r\n                                       unsigned int h) {\r\n  size_t totalsize;  /* total size of TString object */\r\n  GCObject **list;  /* (pointer to) list where it will be inserted */\r\n  TString *ts;\r\n  stringtable *tb = &G(L)->strt;\r\n  if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char))\r\n    luaM_toobig(L);\r\n  if (tb->nuse >= cast(lu_int32, tb->size) && tb->size <= MAX_INT/2)\r\n    luaS_resize(L, tb->size*2);  /* too crowded */\r\n  totalsize = sizeof(TString) + ((l + 1) * sizeof(char));\r\n  list = &tb->hash[lmod(h, tb->size)];\r\n  ts = &luaC_newobj(L, LUA_TSTRING, totalsize, list, 0)->ts;\r\n  ts->tsv.len = l;\r\n  ts->tsv.hash = h;\r\n  ts->tsv.reserved = 0;\r\n  memcpy(ts+1, str, l*sizeof(char));\r\n  ((char *)(ts+1))[l] = '\\0';  /* ending 0 */\r\n  tb->nuse++;\r\n  return ts;\r\n}\r\n\r\n\r\nTString *luaS_newlstr (lua_State *L, const char *str, size_t l) {\r\n  GCObject *o;\r\n  unsigned int h = cast(unsigned int, l);  /* seed */\r\n  size_t step = (l>>5)+1;  /* if string is too long, don't hash all its chars */\r\n  size_t l1;\r\n  for (l1=l; l1>=step; l1-=step)  /* compute hash */\r\n    h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));\r\n  for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)];\r\n       o != NULL;\r\n       o = gch(o)->next) {\r\n    TString *ts = rawgco2ts(o);\r\n    if (h == ts->tsv.hash &&\r\n        ts->tsv.len == l &&\r\n        (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) {\r\n      if (isdead(G(L), o))  /* string is dead (but was not collected yet)? */\r\n        changewhite(o);  /* resurrect it */\r\n      return ts;\r\n    }\r\n  }\r\n  return newlstr(L, str, l, h);  /* not found; create a new string */\r\n}\r\n\r\n\r\nTString *luaS_new (lua_State *L, const char *str) {\r\n  return luaS_newlstr(L, str, strlen(str));\r\n}\r\n\r\n\r\nUdata *luaS_newudata (lua_State *L, size_t s, Table *e) {\r\n  Udata *u;\r\n  if (s > MAX_SIZET - sizeof(Udata))\r\n    luaM_toobig(L);\r\n  u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;\r\n  u->uv.len = s;\r\n  u->uv.metatable = NULL;\r\n  u->uv.env = e;\r\n  return u;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lstring.h",
    "content": "/*\r\n** $Id: lstring.h,v 1.46 2010/04/05 16:26:37 roberto Exp $\r\n** String table (keep all strings handled by Lua)\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lstring_h\r\n#define lstring_h\r\n\r\n#include \"lgc.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n\r\n\r\n#define sizestring(s)\t(sizeof(union TString)+((s)->len+1)*sizeof(char))\r\n\r\n#define sizeudata(u)\t(sizeof(union Udata)+(u)->len)\r\n\r\n#define luaS_newliteral(L, s)\t(luaS_newlstr(L, \"\" s, \\\r\n                                 (sizeof(s)/sizeof(char))-1))\r\n\r\n#define luaS_fix(s)\tl_setbit((s)->tsv.marked, FIXEDBIT)\r\n\r\n\r\n/*\r\n** as all string are internalized, string equality becomes\r\n** pointer equality\r\n*/\r\n#define eqstr(a,b)\t((a) == (b))\r\n\r\nLUAI_FUNC void luaS_resize (lua_State *L, int newsize);\r\nLUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);\r\nLUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);\r\nLUAI_FUNC TString *luaS_new (lua_State *L, const char *str);\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lstrlib.c",
    "content": "/*\r\n** $Id: lstrlib.c,v 1.173 2011/11/30 18:24:56 roberto Exp $\r\n** Standard library for string operations and pattern-matching\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <ctype.h>\r\n#include <stddef.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define lstrlib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n/*\r\n** maximum number of captures that a pattern can do during\r\n** pattern-matching. This limit is arbitrary.\r\n*/\r\n#if !defined(LUA_MAXCAPTURES)\r\n#define LUA_MAXCAPTURES\t\t32\r\n#endif\r\n\r\n\r\n/* macro to `unsign' a character */\r\n#define uchar(c)        ((unsigned char)(c))\r\n\r\n\r\n\r\nstatic int str_len (lua_State *L) {\r\n  size_t l;\r\n  luaL_checklstring(L, 1, &l);\r\n  lua_pushinteger(L, (lua_Integer)l);\r\n  return 1;\r\n}\r\n\r\n\r\n/* translate a relative string position: negative means back from end */\r\nstatic size_t posrelat (ptrdiff_t pos, size_t len) {\r\n  if (pos >= 0) return (size_t)pos;\r\n  else if (0u - (size_t)pos > len) return 0;\r\n  else return len - ((size_t)-pos) + 1;\r\n}\r\n\r\n\r\nstatic int str_sub (lua_State *L) {\r\n  size_t l;\r\n  const char *s = luaL_checklstring(L, 1, &l);\r\n  size_t start = posrelat(luaL_checkinteger(L, 2), l);\r\n  size_t end = posrelat(luaL_optinteger(L, 3, -1), l);\r\n  if (start < 1) start = 1;\r\n  if (end > l) end = l;\r\n  if (start <= end)\r\n    lua_pushlstring(L, s + start - 1, end - start + 1);\r\n  else lua_pushliteral(L, \"\");\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int str_reverse (lua_State *L) {\r\n  size_t l, i;\r\n  luaL_Buffer b;\r\n  const char *s = luaL_checklstring(L, 1, &l);\r\n  char *p = luaL_buffinitsize(L, &b, l);\r\n  for (i = 0; i < l; i++)\r\n    p[i] = s[l - i - 1];\r\n  luaL_pushresultsize(&b, l);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int str_lower (lua_State *L) {\r\n  size_t l;\r\n  size_t i;\r\n  luaL_Buffer b;\r\n  const char *s = luaL_checklstring(L, 1, &l);\r\n  char *p = luaL_buffinitsize(L, &b, l);\r\n  for (i=0; i<l; i++)\r\n    p[i] = tolower(uchar(s[i]));\r\n  luaL_pushresultsize(&b, l);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int str_upper (lua_State *L) {\r\n  size_t l;\r\n  size_t i;\r\n  luaL_Buffer b;\r\n  const char *s = luaL_checklstring(L, 1, &l);\r\n  char *p = luaL_buffinitsize(L, &b, l);\r\n  for (i=0; i<l; i++)\r\n    p[i] = toupper(uchar(s[i]));\r\n  luaL_pushresultsize(&b, l);\r\n  return 1;\r\n}\r\n\r\n\r\n/* reasonable limit to avoid arithmetic overflow */\r\n#define MAXSIZE\t\t((~(size_t)0) >> 1)\r\n\r\nstatic int str_rep (lua_State *L) {\r\n  size_t l, lsep;\r\n  const char *s = luaL_checklstring(L, 1, &l);\r\n  int n = luaL_checkint(L, 2);\r\n  const char *sep = luaL_optlstring(L, 3, \"\", &lsep);\r\n  if (n <= 0) lua_pushliteral(L, \"\");\r\n  else if (l + lsep < l || l + lsep >= MAXSIZE / n)  /* may overflow? */\r\n    return luaL_error(L, \"resulting string too large\");\r\n  else {\r\n    size_t totallen = n * l + (n - 1) * lsep;\r\n    luaL_Buffer b;\r\n    char *p = luaL_buffinitsize(L, &b, totallen);\r\n    while (n-- > 1) {  /* first n-1 copies (followed by separator) */\r\n      memcpy(p, s, l * sizeof(char)); p += l;\r\n      memcpy(p, sep, lsep * sizeof(char)); p += lsep;\r\n    }\r\n    memcpy(p, s, l * sizeof(char));  /* last copy (not followed by separator) */\r\n    luaL_pushresultsize(&b, totallen);\r\n  }\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int str_byte (lua_State *L) {\r\n  size_t l;\r\n  const char *s = luaL_checklstring(L, 1, &l);\r\n  size_t posi = posrelat(luaL_optinteger(L, 2, 1), l);\r\n  size_t pose = posrelat(luaL_optinteger(L, 3, posi), l);\r\n  int n, i;\r\n  if (posi < 1) posi = 1;\r\n  if (pose > l) pose = l;\r\n  if (posi > pose) return 0;  /* empty interval; return no values */\r\n  n = (int)(pose -  posi + 1);\r\n  if (posi + n <= pose)  /* (size_t -> int) overflow? */\r\n    return luaL_error(L, \"string slice too long\");\r\n  luaL_checkstack(L, n, \"string slice too long\");\r\n  for (i=0; i<n; i++)\r\n    lua_pushinteger(L, uchar(s[posi+i-1]));\r\n  return n;\r\n}\r\n\r\n\r\nstatic int str_char (lua_State *L) {\r\n  int n = lua_gettop(L);  /* number of arguments */\r\n  int i;\r\n  luaL_Buffer b;\r\n  char *p = luaL_buffinitsize(L, &b, n);\r\n  for (i=1; i<=n; i++) {\r\n    int c = luaL_checkint(L, i);\r\n    luaL_argcheck(L, uchar(c) == c, i, \"value out of range\");\r\n    p[i - 1] = uchar(c);\r\n  }\r\n  luaL_pushresultsize(&b, n);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int writer (lua_State *L, const void* b, size_t size, void* B) {\r\n  (void)L;\r\n  luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);\r\n  return 0;\r\n}\r\n\r\n\r\nstatic int str_dump (lua_State *L) {\r\n  luaL_Buffer b;\r\n  luaL_checktype(L, 1, LUA_TFUNCTION);\r\n  lua_settop(L, 1);\r\n  luaL_buffinit(L,&b);\r\n  if (lua_dump(L, writer, &b) != 0)\r\n    return luaL_error(L, \"unable to dump given function\");\r\n  luaL_pushresult(&b);\r\n  return 1;\r\n}\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** PATTERN MATCHING\r\n** =======================================================\r\n*/\r\n\r\n\r\n#define CAP_UNFINISHED\t(-1)\r\n#define CAP_POSITION\t(-2)\r\n\r\ntypedef struct MatchState {\r\n  const char *src_init;  /* init of source string */\r\n  const char *src_end;  /* end ('\\0') of source string */\r\n  const char *p_end;  /* end ('\\0') of pattern */\r\n  lua_State *L;\r\n  int level;  /* total number of captures (finished or unfinished) */\r\n  struct {\r\n    const char *init;\r\n    ptrdiff_t len;\r\n  } capture[LUA_MAXCAPTURES];\r\n} MatchState;\r\n\r\n\r\n#define L_ESC\t\t'%'\r\n#define SPECIALS\t\"^$*+?.([%-\"\r\n\r\n\r\nstatic int check_capture (MatchState *ms, int l) {\r\n  l -= '1';\r\n  if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)\r\n    return luaL_error(ms->L, \"invalid capture index %%%d\", l + 1);\r\n  return l;\r\n}\r\n\r\n\r\nstatic int capture_to_close (MatchState *ms) {\r\n  int level = ms->level;\r\n  for (level--; level>=0; level--)\r\n    if (ms->capture[level].len == CAP_UNFINISHED) return level;\r\n  return luaL_error(ms->L, \"invalid pattern capture\");\r\n}\r\n\r\n\r\nstatic const char *classend (MatchState *ms, const char *p) {\r\n  switch (*p++) {\r\n    case L_ESC: {\r\n      if (p == ms->p_end)\r\n        luaL_error(ms->L, \"malformed pattern (ends with \" LUA_QL(\"%%\") \")\");\r\n      return p+1;\r\n    }\r\n    case '[': {\r\n      if (*p == '^') p++;\r\n      do {  /* look for a `]' */\r\n        if (p == ms->p_end)\r\n          luaL_error(ms->L, \"malformed pattern (missing \" LUA_QL(\"]\") \")\");\r\n        if (*(p++) == L_ESC && p < ms->p_end)\r\n          p++;  /* skip escapes (e.g. `%]') */\r\n      } while (*p != ']');\r\n      return p+1;\r\n    }\r\n    default: {\r\n      return p;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic int match_class (int c, int cl) {\r\n  int res;\r\n  switch (tolower(cl)) {\r\n    case 'a' : res = isalpha(c); break;\r\n    case 'c' : res = iscntrl(c); break;\r\n    case 'd' : res = isdigit(c); break;\r\n    case 'g' : res = isgraph(c); break;\r\n    case 'l' : res = islower(c); break;\r\n    case 'p' : res = ispunct(c); break;\r\n    case 's' : res = isspace(c); break;\r\n    case 'u' : res = isupper(c); break;\r\n    case 'w' : res = isalnum(c); break;\r\n    case 'x' : res = isxdigit(c); break;\r\n    case 'z' : res = (c == 0); break;  /* deprecated option */\r\n    default: return (cl == c);\r\n  }\r\n  return (islower(cl) ? res : !res);\r\n}\r\n\r\n\r\nstatic int matchbracketclass (int c, const char *p, const char *ec) {\r\n  int sig = 1;\r\n  if (*(p+1) == '^') {\r\n    sig = 0;\r\n    p++;  /* skip the `^' */\r\n  }\r\n  while (++p < ec) {\r\n    if (*p == L_ESC) {\r\n      p++;\r\n      if (match_class(c, uchar(*p)))\r\n        return sig;\r\n    }\r\n    else if ((*(p+1) == '-') && (p+2 < ec)) {\r\n      p+=2;\r\n      if (uchar(*(p-2)) <= c && c <= uchar(*p))\r\n        return sig;\r\n    }\r\n    else if (uchar(*p) == c) return sig;\r\n  }\r\n  return !sig;\r\n}\r\n\r\n\r\nstatic int singlematch (int c, const char *p, const char *ep) {\r\n  switch (*p) {\r\n    case '.': return 1;  /* matches any char */\r\n    case L_ESC: return match_class(c, uchar(*(p+1)));\r\n    case '[': return matchbracketclass(c, p, ep-1);\r\n    default:  return (uchar(*p) == c);\r\n  }\r\n}\r\n\r\n\r\nstatic const char *match (MatchState *ms, const char *s, const char *p);\r\n\r\n\r\nstatic const char *matchbalance (MatchState *ms, const char *s,\r\n                                   const char *p) {\r\n  if (p >= ms->p_end - 1)\r\n    luaL_error(ms->L, \"malformed pattern \"\r\n                      \"(missing arguments to \" LUA_QL(\"%%b\") \")\");\r\n  if (*s != *p) return NULL;\r\n  else {\r\n    int b = *p;\r\n    int e = *(p+1);\r\n    int cont = 1;\r\n    while (++s < ms->src_end) {\r\n      if (*s == e) {\r\n        if (--cont == 0) return s+1;\r\n      }\r\n      else if (*s == b) cont++;\r\n    }\r\n  }\r\n  return NULL;  /* string ends out of balance */\r\n}\r\n\r\n\r\nstatic const char *max_expand (MatchState *ms, const char *s,\r\n                                 const char *p, const char *ep) {\r\n  ptrdiff_t i = 0;  /* counts maximum expand for item */\r\n  while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))\r\n    i++;\r\n  /* keeps trying to match with the maximum repetitions */\r\n  while (i>=0) {\r\n    const char *res = match(ms, (s+i), ep+1);\r\n    if (res) return res;\r\n    i--;  /* else didn't match; reduce 1 repetition to try again */\r\n  }\r\n  return NULL;\r\n}\r\n\r\n\r\nstatic const char *min_expand (MatchState *ms, const char *s,\r\n                                 const char *p, const char *ep) {\r\n  for (;;) {\r\n    const char *res = match(ms, s, ep+1);\r\n    if (res != NULL)\r\n      return res;\r\n    else if (s<ms->src_end && singlematch(uchar(*s), p, ep))\r\n      s++;  /* try with one more repetition */\r\n    else return NULL;\r\n  }\r\n}\r\n\r\n\r\nstatic const char *start_capture (MatchState *ms, const char *s,\r\n                                    const char *p, int what) {\r\n  const char *res;\r\n  int level = ms->level;\r\n  if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, \"too many captures\");\r\n  ms->capture[level].init = s;\r\n  ms->capture[level].len = what;\r\n  ms->level = level+1;\r\n  if ((res=match(ms, s, p)) == NULL)  /* match failed? */\r\n    ms->level--;  /* undo capture */\r\n  return res;\r\n}\r\n\r\n\r\nstatic const char *end_capture (MatchState *ms, const char *s,\r\n                                  const char *p) {\r\n  int l = capture_to_close(ms);\r\n  const char *res;\r\n  ms->capture[l].len = s - ms->capture[l].init;  /* close capture */\r\n  if ((res = match(ms, s, p)) == NULL)  /* match failed? */\r\n    ms->capture[l].len = CAP_UNFINISHED;  /* undo capture */\r\n  return res;\r\n}\r\n\r\n\r\nstatic const char *match_capture (MatchState *ms, const char *s, int l) {\r\n  size_t len;\r\n  l = check_capture(ms, l);\r\n  len = ms->capture[l].len;\r\n  if ((size_t)(ms->src_end-s) >= len &&\r\n      memcmp(ms->capture[l].init, s, len) == 0)\r\n    return s+len;\r\n  else return NULL;\r\n}\r\n\r\n\r\nstatic const char *match (MatchState *ms, const char *s, const char *p) {\r\n  init: /* using goto's to optimize tail recursion */\r\n  if (p == ms->p_end)  /* end of pattern? */\r\n    return s;  /* match succeeded */\r\n  switch (*p) {\r\n    case '(': {  /* start capture */\r\n      if (*(p+1) == ')')  /* position capture? */\r\n        return start_capture(ms, s, p+2, CAP_POSITION);\r\n      else\r\n        return start_capture(ms, s, p+1, CAP_UNFINISHED);\r\n    }\r\n    case ')': {  /* end capture */\r\n      return end_capture(ms, s, p+1);\r\n    }\r\n    case '$': {\r\n      if ((p+1) == ms->p_end)  /* is the `$' the last char in pattern? */\r\n        return (s == ms->src_end) ? s : NULL;  /* check end of string */\r\n      else goto dflt;\r\n    }\r\n    case L_ESC: {  /* escaped sequences not in the format class[*+?-]? */\r\n      switch (*(p+1)) {\r\n        case 'b': {  /* balanced string? */\r\n          s = matchbalance(ms, s, p+2);\r\n          if (s == NULL) return NULL;\r\n          p+=4; goto init;  /* else return match(ms, s, p+4); */\r\n        }\r\n        case 'f': {  /* frontier? */\r\n          const char *ep; char previous;\r\n          p += 2;\r\n          if (*p != '[')\r\n            luaL_error(ms->L, \"missing \" LUA_QL(\"[\") \" after \"\r\n                               LUA_QL(\"%%f\") \" in pattern\");\r\n          ep = classend(ms, p);  /* points to what is next */\r\n          previous = (s == ms->src_init) ? '\\0' : *(s-1);\r\n          if (matchbracketclass(uchar(previous), p, ep-1) ||\r\n             !matchbracketclass(uchar(*s), p, ep-1)) return NULL;\r\n          p=ep; goto init;  /* else return match(ms, s, ep); */\r\n        }\r\n        case '0': case '1': case '2': case '3':\r\n        case '4': case '5': case '6': case '7':\r\n        case '8': case '9': {  /* capture results (%0-%9)? */\r\n          s = match_capture(ms, s, uchar(*(p+1)));\r\n          if (s == NULL) return NULL;\r\n          p+=2; goto init;  /* else return match(ms, s, p+2) */\r\n        }\r\n        default: goto dflt;\r\n      }\r\n    }\r\n    default: dflt: {  /* pattern class plus optional suffix */\r\n      const char *ep = classend(ms, p);  /* points to what is next */\r\n      int m = s < ms->src_end && singlematch(uchar(*s), p, ep);\r\n      switch (*ep) {\r\n        case '?': {  /* optional */\r\n          const char *res;\r\n          if (m && ((res=match(ms, s+1, ep+1)) != NULL))\r\n            return res;\r\n          p=ep+1; goto init;  /* else return match(ms, s, ep+1); */\r\n        }\r\n        case '*': {  /* 0 or more repetitions */\r\n          return max_expand(ms, s, p, ep);\r\n        }\r\n        case '+': {  /* 1 or more repetitions */\r\n          return (m ? max_expand(ms, s+1, p, ep) : NULL);\r\n        }\r\n        case '-': {  /* 0 or more repetitions (minimum) */\r\n          return min_expand(ms, s, p, ep);\r\n        }\r\n        default: {\r\n          if (!m) return NULL;\r\n          s++; p=ep; goto init;  /* else return match(ms, s+1, ep); */\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\n\r\nstatic const char *lmemfind (const char *s1, size_t l1,\r\n                               const char *s2, size_t l2) {\r\n  if (l2 == 0) return s1;  /* empty strings are everywhere */\r\n  else if (l2 > l1) return NULL;  /* avoids a negative `l1' */\r\n  else {\r\n    const char *init;  /* to search for a `*s2' inside `s1' */\r\n    l2--;  /* 1st char will be checked by `memchr' */\r\n    l1 = l1-l2;  /* `s2' cannot be found after that */\r\n    while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {\r\n      init++;   /* 1st char is already checked */\r\n      if (memcmp(init, s2+1, l2) == 0)\r\n        return init-1;\r\n      else {  /* correct `l1' and `s1' to try again */\r\n        l1 -= init-s1;\r\n        s1 = init;\r\n      }\r\n    }\r\n    return NULL;  /* not found */\r\n  }\r\n}\r\n\r\n\r\nstatic void push_onecapture (MatchState *ms, int i, const char *s,\r\n                                                    const char *e) {\r\n  if (i >= ms->level) {\r\n    if (i == 0)  /* ms->level == 0, too */\r\n      lua_pushlstring(ms->L, s, e - s);  /* add whole match */\r\n    else\r\n      luaL_error(ms->L, \"invalid capture index\");\r\n  }\r\n  else {\r\n    ptrdiff_t l = ms->capture[i].len;\r\n    if (l == CAP_UNFINISHED) luaL_error(ms->L, \"unfinished capture\");\r\n    if (l == CAP_POSITION)\r\n      lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);\r\n    else\r\n      lua_pushlstring(ms->L, ms->capture[i].init, l);\r\n  }\r\n}\r\n\r\n\r\nstatic int push_captures (MatchState *ms, const char *s, const char *e) {\r\n  int i;\r\n  int nlevels = (ms->level == 0 && s) ? 1 : ms->level;\r\n  luaL_checkstack(ms->L, nlevels, \"too many captures\");\r\n  for (i = 0; i < nlevels; i++)\r\n    push_onecapture(ms, i, s, e);\r\n  return nlevels;  /* number of strings pushed */\r\n}\r\n\r\n\r\n/* check whether pattern has no special characters */\r\nstatic int nospecials (const char *p, size_t l) {\r\n  size_t upto = 0;\r\n  do {\r\n    if (strpbrk(p + upto, SPECIALS))\r\n      return 0;  /* pattern has a special character */\r\n    upto += strlen(p + upto) + 1;  /* may have more after \\0 */\r\n  } while (upto <= l);\r\n  return 1;  /* no special chars found */\r\n}\r\n\r\n\r\nstatic int str_find_aux (lua_State *L, int find) {\r\n  size_t ls, lp;\r\n  const char *s = luaL_checklstring(L, 1, &ls);\r\n  const char *p = luaL_checklstring(L, 2, &lp);\r\n  size_t init = posrelat(luaL_optinteger(L, 3, 1), ls);\r\n  if (init < 1) init = 1;\r\n  else if (init > ls + 1) {  /* start after string's end? */\r\n    lua_pushnil(L);  /* cannot find anything */\r\n    return 1;\r\n  }\r\n  /* explicit request or no special characters? */\r\n  if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) {\r\n    /* do a plain search */\r\n    const char *s2 = lmemfind(s + init - 1, ls - init + 1, p, lp);\r\n    if (s2) {\r\n      lua_pushinteger(L, s2 - s + 1);\r\n      lua_pushinteger(L, s2 - s + lp);\r\n      return 2;\r\n    }\r\n  }\r\n  else {\r\n    MatchState ms;\r\n    const char *s1 = s + init - 1;\r\n    int anchor = (*p == '^');\r\n    if (anchor) {\r\n      p++; lp--;  /* skip anchor character */\r\n    }\r\n    ms.L = L;\r\n    ms.src_init = s;\r\n    ms.src_end = s + ls;\r\n    ms.p_end = p + lp;\r\n    do {\r\n      const char *res;\r\n      ms.level = 0;\r\n      if ((res=match(&ms, s1, p)) != NULL) {\r\n        if (find) {\r\n          lua_pushinteger(L, s1 - s + 1);  /* start */\r\n          lua_pushinteger(L, res - s);   /* end */\r\n          return push_captures(&ms, NULL, 0) + 2;\r\n        }\r\n        else\r\n          return push_captures(&ms, s1, res);\r\n      }\r\n    } while (s1++ < ms.src_end && !anchor);\r\n  }\r\n  lua_pushnil(L);  /* not found */\r\n  return 1;\r\n}\r\n\r\n\r\nstatic int str_find (lua_State *L) {\r\n  return str_find_aux(L, 1);\r\n}\r\n\r\n\r\nstatic int str_match (lua_State *L) {\r\n  return str_find_aux(L, 0);\r\n}\r\n\r\n\r\nstatic int gmatch_aux (lua_State *L) {\r\n  MatchState ms;\r\n  size_t ls, lp;\r\n  const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);\r\n  const char *p = lua_tolstring(L, lua_upvalueindex(2), &lp);\r\n  const char *src;\r\n  ms.L = L;\r\n  ms.src_init = s;\r\n  ms.src_end = s+ls;\r\n  ms.p_end = p + lp;\r\n  for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3));\r\n       src <= ms.src_end;\r\n       src++) {\r\n    const char *e;\r\n    ms.level = 0;\r\n    if ((e = match(&ms, src, p)) != NULL) {\r\n      lua_Integer newstart = e-s;\r\n      if (e == src) newstart++;  /* empty match? go at least one position */\r\n      lua_pushinteger(L, newstart);\r\n      lua_replace(L, lua_upvalueindex(3));\r\n      return push_captures(&ms, src, e);\r\n    }\r\n  }\r\n  return 0;  /* not found */\r\n}\r\n\r\n\r\nstatic int gmatch (lua_State *L) {\r\n  luaL_checkstring(L, 1);\r\n  luaL_checkstring(L, 2);\r\n  lua_settop(L, 2);\r\n  lua_pushinteger(L, 0);\r\n  lua_pushcclosure(L, gmatch_aux, 3);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic void add_s (MatchState *ms, luaL_Buffer *b, const char *s,\r\n                                                   const char *e) {\r\n  size_t l, i;\r\n  const char *news = lua_tolstring(ms->L, 3, &l);\r\n  for (i = 0; i < l; i++) {\r\n    if (news[i] != L_ESC)\r\n      luaL_addchar(b, news[i]);\r\n    else {\r\n      i++;  /* skip ESC */\r\n      if (!isdigit(uchar(news[i]))) {\r\n        if (news[i] != L_ESC)\r\n          luaL_error(ms->L, \"invalid use of \" LUA_QL(\"%c\")\r\n                           \" in replacement string\", L_ESC);\r\n        luaL_addchar(b, news[i]);\r\n      }\r\n      else if (news[i] == '0')\r\n          luaL_addlstring(b, s, e - s);\r\n      else {\r\n        push_onecapture(ms, news[i] - '1', s, e);\r\n        luaL_addvalue(b);  /* add capture to accumulated result */\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\nstatic void add_value (MatchState *ms, luaL_Buffer *b, const char *s,\r\n                                       const char *e, int tr) {\r\n  lua_State *L = ms->L;\r\n  switch (tr) {\r\n    case LUA_TFUNCTION: {\r\n      int n;\r\n      lua_pushvalue(L, 3);\r\n      n = push_captures(ms, s, e);\r\n      lua_call(L, n, 1);\r\n      break;\r\n    }\r\n    case LUA_TTABLE: {\r\n      push_onecapture(ms, 0, s, e);\r\n      lua_gettable(L, 3);\r\n      break;\r\n    }\r\n    default: {  /* LUA_TNUMBER or LUA_TSTRING */\r\n      add_s(ms, b, s, e);\r\n      return;\r\n    }\r\n  }\r\n  if (!lua_toboolean(L, -1)) {  /* nil or false? */\r\n    lua_pop(L, 1);\r\n    lua_pushlstring(L, s, e - s);  /* keep original text */\r\n  }\r\n  else if (!lua_isstring(L, -1))\r\n    luaL_error(L, \"invalid replacement value (a %s)\", luaL_typename(L, -1));\r\n  luaL_addvalue(b);  /* add result to accumulator */\r\n}\r\n\r\n\r\nstatic int str_gsub (lua_State *L) {\r\n  size_t srcl, lp;\r\n  const char *src = luaL_checklstring(L, 1, &srcl);\r\n  const char *p = luaL_checklstring(L, 2, &lp);\r\n  int tr = lua_type(L, 3);\r\n  size_t max_s = luaL_optinteger(L, 4, srcl+1);\r\n  int anchor = (*p == '^');\r\n  size_t n = 0;\r\n  MatchState ms;\r\n  luaL_Buffer b;\r\n  luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||\r\n                   tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,\r\n                      \"string/function/table expected\");\r\n  luaL_buffinit(L, &b);\r\n  if (anchor) {\r\n    p++; lp--;  /* skip anchor character */\r\n  }\r\n  ms.L = L;\r\n  ms.src_init = src;\r\n  ms.src_end = src+srcl;\r\n  ms.p_end = p + lp;\r\n  while (n < max_s) {\r\n    const char *e;\r\n    ms.level = 0;\r\n    e = match(&ms, src, p);\r\n    if (e) {\r\n      n++;\r\n      add_value(&ms, &b, src, e, tr);\r\n    }\r\n    if (e && e>src) /* non empty match? */\r\n      src = e;  /* skip it */\r\n    else if (src < ms.src_end)\r\n      luaL_addchar(&b, *src++);\r\n    else break;\r\n    if (anchor) break;\r\n  }\r\n  luaL_addlstring(&b, src, ms.src_end-src);\r\n  luaL_pushresult(&b);\r\n  lua_pushinteger(L, n);  /* number of substitutions */\r\n  return 2;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** STRING FORMAT\r\n** =======================================================\r\n*/\r\n\r\n/*\r\n** LUA_INTFRMLEN is the length modifier for integer conversions in\r\n** 'string.format'; LUA_INTFRM_T is the integer type corresponding to\r\n** the previous length\r\n*/\r\n#if !defined(LUA_INTFRMLEN)\t/* { */\r\n#if defined(LUA_USE_LONGLONG)\r\n\r\n#define LUA_INTFRMLEN           \"ll\"\r\n#define LUA_INTFRM_T            long long\r\n\r\n#else\r\n\r\n#define LUA_INTFRMLEN           \"l\"\r\n#define LUA_INTFRM_T            long\r\n\r\n#endif\r\n#endif\t\t\t\t/* } */\r\n\r\n#define MAX_UINTFRM\t((lua_Number)(~(unsigned LUA_INTFRM_T)0))\r\n#define MAX_INTFRM\t((lua_Number)((~(unsigned LUA_INTFRM_T)0)/2))\r\n#define MIN_INTFRM\t(-(lua_Number)((~(unsigned LUA_INTFRM_T)0)/2) - 1)\r\n\r\n/*\r\n** LUA_FLTFRMLEN is the length modifier for float conversions in\r\n** 'string.format'; LUA_FLTFRM_T is the float type corresponding to\r\n** the previous length\r\n*/\r\n#if !defined(LUA_FLTFRMLEN)\r\n\r\n#define LUA_FLTFRMLEN           \"\"\r\n#define LUA_FLTFRM_T            double\r\n\r\n#endif\r\n\r\n\r\n/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */\r\n#define MAX_ITEM\t512\r\n/* valid flags in a format specification */\r\n#define FLAGS\t\"-+ #0\"\r\n/*\r\n** maximum size of each format specification (such as '%-099.99d')\r\n** (+10 accounts for %99.99x plus margin of error)\r\n*/\r\n#define MAX_FORMAT\t(sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10)\r\n\r\n\r\nstatic void addquoted (lua_State *L, luaL_Buffer *b, int arg) {\r\n  size_t l;\r\n  const char *s = luaL_checklstring(L, arg, &l);\r\n  luaL_addchar(b, '\"');\r\n  while (l--) {\r\n    if (*s == '\"' || *s == '\\\\' || *s == '\\n') {\r\n      luaL_addchar(b, '\\\\');\r\n      luaL_addchar(b, *s);\r\n    }\r\n    else if (*s == '\\0' || iscntrl(uchar(*s))) {\r\n      char buff[10];\r\n      if (!isdigit(uchar(*(s+1))))\r\n        sprintf(buff, \"\\\\%d\", (int)uchar(*s));\r\n      else\r\n        sprintf(buff, \"\\\\%03d\", (int)uchar(*s));\r\n      luaL_addstring(b, buff);\r\n    }\r\n    else\r\n      luaL_addchar(b, *s);\r\n    s++;\r\n  }\r\n  luaL_addchar(b, '\"');\r\n}\r\n\r\nstatic const char *scanformat (lua_State *L, const char *strfrmt, char *form) {\r\n  const char *p = strfrmt;\r\n  while (*p != '\\0' && strchr(FLAGS, *p) != NULL) p++;  /* skip flags */\r\n  if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char))\r\n    luaL_error(L, \"invalid format (repeated flags)\");\r\n  if (isdigit(uchar(*p))) p++;  /* skip width */\r\n  if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */\r\n  if (*p == '.') {\r\n    p++;\r\n    if (isdigit(uchar(*p))) p++;  /* skip precision */\r\n    if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */\r\n  }\r\n  if (isdigit(uchar(*p)))\r\n    luaL_error(L, \"invalid format (width or precision too long)\");\r\n  *(form++) = '%';\r\n  memcpy(form, strfrmt, (p - strfrmt + 1) * sizeof(char));\r\n  form += p - strfrmt + 1;\r\n  *form = '\\0';\r\n  return p;\r\n}\r\n\r\n\r\n/*\r\n** add length modifier into formats\r\n*/\r\nstatic void addlenmod (char *form, const char *lenmod) {\r\n  size_t l = strlen(form);\r\n  size_t lm = strlen(lenmod);\r\n  char spec = form[l - 1];\r\n  strcpy(form + l - 1, lenmod);\r\n  form[l + lm - 1] = spec;\r\n  form[l + lm] = '\\0';\r\n}\r\n\r\n\r\nstatic int str_format (lua_State *L) {\r\n  int top = lua_gettop(L);\r\n  int arg = 1;\r\n  size_t sfl;\r\n  const char *strfrmt = luaL_checklstring(L, arg, &sfl);\r\n  const char *strfrmt_end = strfrmt+sfl;\r\n  luaL_Buffer b;\r\n  luaL_buffinit(L, &b);\r\n  while (strfrmt < strfrmt_end) {\r\n    if (*strfrmt != L_ESC)\r\n      luaL_addchar(&b, *strfrmt++);\r\n    else if (*++strfrmt == L_ESC)\r\n      luaL_addchar(&b, *strfrmt++);  /* %% */\r\n    else { /* format item */\r\n      char form[MAX_FORMAT];  /* to store the format (`%...') */\r\n      char *buff = luaL_prepbuffsize(&b, MAX_ITEM);  /* to put formatted item */\r\n      int nb = 0;  /* number of bytes in added item */\r\n      if (++arg > top)\r\n        luaL_argerror(L, arg, \"no value\");\r\n      strfrmt = scanformat(L, strfrmt, form);\r\n      switch (*strfrmt++) {\r\n        case 'c': {\r\n          nb = sprintf(buff, form, luaL_checkint(L, arg));\r\n          break;\r\n        }\r\n        case 'd':  case 'i': {\r\n          lua_Number n = luaL_checknumber(L, arg);\r\n          luaL_argcheck(L, (MIN_INTFRM - 1) < n && n < (MAX_INTFRM + 1), arg,\r\n                        \"not a number in proper range\");\r\n          addlenmod(form, LUA_INTFRMLEN);\r\n          nb = sprintf(buff, form, (LUA_INTFRM_T)n);\r\n          break;\r\n        }\r\n        case 'o':  case 'u':  case 'x':  case 'X': {\r\n          lua_Number n = luaL_checknumber(L, arg);\r\n          luaL_argcheck(L, 0 <= n && n < (MAX_UINTFRM + 1), arg,\r\n                        \"not a non-negative number in proper range\");\r\n          addlenmod(form, LUA_INTFRMLEN);\r\n          nb = sprintf(buff, form, (unsigned LUA_INTFRM_T)n);\r\n          break;\r\n        }\r\n        case 'e':  case 'E': case 'f':\r\n#if defined(LUA_USE_AFORMAT)\r\n        case 'a': case 'A':\r\n#endif\r\n        case 'g': case 'G': {\r\n          addlenmod(form, LUA_FLTFRMLEN);\r\n          nb = sprintf(buff, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg));\r\n          break;\r\n        }\r\n        case 'q': {\r\n          addquoted(L, &b, arg);\r\n          break;\r\n        }\r\n        case 's': {\r\n          size_t l;\r\n          const char *s = luaL_tolstring(L, arg, &l);\r\n          if (!strchr(form, '.') && l >= 100) {\r\n            /* no precision and string is too long to be formatted;\r\n               keep original string */\r\n            luaL_addvalue(&b);\r\n            break;\r\n          }\r\n          else {\r\n            nb = sprintf(buff, form, s);\r\n            lua_pop(L, 1);  /* remove result from 'luaL_tolstring' */\r\n            break;\r\n          }\r\n        }\r\n        default: {  /* also treat cases `pnLlh' */\r\n          return luaL_error(L, \"invalid option \" LUA_QL(\"%%%c\") \" to \"\r\n                               LUA_QL(\"format\"), *(strfrmt - 1));\r\n        }\r\n      }\r\n      luaL_addsize(&b, nb);\r\n    }\r\n  }\r\n  luaL_pushresult(&b);\r\n  return 1;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\nstatic const luaL_Reg strlib[] = {\r\n  {\"byte\", str_byte},\r\n  {\"char\", str_char},\r\n  {\"dump\", str_dump},\r\n  {\"find\", str_find},\r\n  {\"format\", str_format},\r\n  {\"gmatch\", gmatch},\r\n  {\"gsub\", str_gsub},\r\n  {\"len\", str_len},\r\n  {\"lower\", str_lower},\r\n  {\"match\", str_match},\r\n  {\"rep\", str_rep},\r\n  {\"reverse\", str_reverse},\r\n  {\"sub\", str_sub},\r\n  {\"upper\", str_upper},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nstatic void createmetatable (lua_State *L) {\r\n  lua_createtable(L, 0, 1);  /* table to be metatable for strings */\r\n  lua_pushliteral(L, \"\");  /* dummy string */\r\n  lua_pushvalue(L, -2);  /* copy table */\r\n  lua_setmetatable(L, -2);  /* set table as metatable for strings */\r\n  lua_pop(L, 1);  /* pop dummy string */\r\n  lua_pushvalue(L, -2);  /* get string library */\r\n  lua_setfield(L, -2, \"__index\");  /* metatable.__index = string */\r\n  lua_pop(L, 1);  /* pop metatable */\r\n}\r\n\r\n\r\n/*\r\n** Open string library\r\n*/\r\nLUAMOD_API int luaopen_string (lua_State *L) {\r\n  luaL_newlib(L, strlib);\r\n  createmetatable(L);\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ltable.c",
    "content": "/*\r\n** $Id: ltable.c,v 2.67 2011/11/30 12:41:45 roberto Exp $\r\n** Lua tables (hash)\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n/*\r\n** Implementation of tables (aka arrays, objects, or hash tables).\r\n** Tables keep its elements in two parts: an array part and a hash part.\r\n** Non-negative integer keys are all candidates to be kept in the array\r\n** part. The actual size of the array is the largest `n' such that at\r\n** least half the slots between 0 and n are in use.\r\n** Hash uses a mix of chained scatter table with Brent's variation.\r\n** A main invariant of these tables is that, if an element is not\r\n** in its main position (i.e. the `original' position that its hash gives\r\n** to it), then the colliding element is in its own main position.\r\n** Hence even when the load factor reaches 100%, performance remains good.\r\n*/\r\n\r\n#include <string.h>\r\n\r\n#define ltable_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lgc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"lvm.h\"\r\n\r\n\r\n/*\r\n** max size of array part is 2^MAXBITS\r\n*/\r\n#if LUAI_BITSINT >= 32\r\n#define MAXBITS\t\t30\r\n#else\r\n#define MAXBITS\t\t(LUAI_BITSINT-2)\r\n#endif\r\n\r\n#define MAXASIZE\t(1 << MAXBITS)\r\n\r\n\r\n#define hashpow2(t,n)      (gnode(t, lmod((n), sizenode(t))))\r\n\r\n#define hashstr(t,str)  hashpow2(t, (str)->tsv.hash)\r\n#define hashboolean(t,p)        hashpow2(t, p)\r\n\r\n\r\n/*\r\n** for some types, it is better to avoid modulus by power of 2, as\r\n** they tend to have many 2 factors.\r\n*/\r\n#define hashmod(t,n)\t(gnode(t, ((n) % ((sizenode(t)-1)|1))))\r\n\r\n\r\n#define hashpointer(t,p)\thashmod(t, IntPoint(p))\r\n\r\n\r\n#define dummynode\t\t(&dummynode_)\r\n\r\n#define isdummy(n)\t\t((n) == dummynode)\r\n\r\nstatic const Node dummynode_ = {\r\n  {NILCONSTANT},  /* value */\r\n  {{NILCONSTANT, NULL}}  /* key */\r\n};\r\n\r\n\r\n/*\r\n** hash for lua_Numbers\r\n*/\r\nstatic Node *hashnum (const Table *t, lua_Number n) {\r\n  int i;\r\n  luai_hashnum(i, n);\r\n  if (i < 0) {\r\n    if (cast(unsigned int, i) == 0u - i)  /* use unsigned to avoid overflows */\r\n      i = 0;  /* handle INT_MIN */\r\n    i = -i;  /* must be a positive value */\r\n  }\r\n  return hashmod(t, i);\r\n}\r\n\r\n\r\n\r\n/*\r\n** returns the `main' position of an element in a table (that is, the index\r\n** of its hash value)\r\n*/\r\nstatic Node *mainposition (const Table *t, const TValue *key) {\r\n  switch (ttype(key)) {\r\n    case LUA_TNUMBER:\r\n      return hashnum(t, nvalue(key));\r\n    case LUA_TSTRING:\r\n      return hashstr(t, rawtsvalue(key));\r\n    case LUA_TBOOLEAN:\r\n      return hashboolean(t, bvalue(key));\r\n    case LUA_TLIGHTUSERDATA:\r\n      return hashpointer(t, pvalue(key));\r\n    case LUA_TLCF:\r\n      return hashpointer(t, fvalue(key));\r\n    default:\r\n      return hashpointer(t, gcvalue(key));\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** returns the index for `key' if `key' is an appropriate key to live in\r\n** the array part of the table, -1 otherwise.\r\n*/\r\nstatic int arrayindex (const TValue *key) {\r\n  if (ttisnumber(key)) {\r\n    lua_Number n = nvalue(key);\r\n    int k;\r\n    lua_number2int(k, n);\r\n    if (luai_numeq(cast_num(k), n))\r\n      return k;\r\n  }\r\n  return -1;  /* `key' did not match some condition */\r\n}\r\n\r\n\r\n/*\r\n** returns the index of a `key' for table traversals. First goes all\r\n** elements in the array part, then elements in the hash part. The\r\n** beginning of a traversal is signaled by -1.\r\n*/\r\nstatic int findindex (lua_State *L, Table *t, StkId key) {\r\n  int i;\r\n  if (ttisnil(key)) return -1;  /* first iteration */\r\n  i = arrayindex(key);\r\n  if (0 < i && i <= t->sizearray)  /* is `key' inside array part? */\r\n    return i-1;  /* yes; that's the index (corrected to C) */\r\n  else {\r\n    Node *n = mainposition(t, key);\r\n    for (;;) {  /* check whether `key' is somewhere in the chain */\r\n      /* key may be dead already, but it is ok to use it in `next' */\r\n      if (luaV_rawequalobj(gkey(n), key) ||\r\n            (ttisdeadkey(gkey(n)) && iscollectable(key) &&\r\n             deadvalue(gkey(n)) == gcvalue(key))) {\r\n        i = cast_int(n - gnode(t, 0));  /* key index in hash table */\r\n        /* hash elements are numbered after array ones */\r\n        return i + t->sizearray;\r\n      }\r\n      else n = gnext(n);\r\n      if (n == NULL)\r\n        luaG_runerror(L, \"invalid key to \" LUA_QL(\"next\"));  /* key not found */\r\n    }\r\n  }\r\n}\r\n\r\n\r\nint luaH_next (lua_State *L, Table *t, StkId key) {\r\n  int i = findindex(L, t, key);  /* find original element */\r\n  for (i++; i < t->sizearray; i++) {  /* try first array part */\r\n    if (!ttisnil(&t->array[i])) {  /* a non-nil value? */\r\n      setnvalue(key, cast_num(i+1));\r\n      setobj2s(L, key+1, &t->array[i]);\r\n      return 1;\r\n    }\r\n  }\r\n  for (i -= t->sizearray; i < sizenode(t); i++) {  /* then hash part */\r\n    if (!ttisnil(gval(gnode(t, i)))) {  /* a non-nil value? */\r\n      setobj2s(L, key, gkey(gnode(t, i)));\r\n      setobj2s(L, key+1, gval(gnode(t, i)));\r\n      return 1;\r\n    }\r\n  }\r\n  return 0;  /* no more elements */\r\n}\r\n\r\n\r\n/*\r\n** {=============================================================\r\n** Rehash\r\n** ==============================================================\r\n*/\r\n\r\n\r\nstatic int computesizes (int nums[], int *narray) {\r\n  int i;\r\n  int twotoi;  /* 2^i */\r\n  int a = 0;  /* number of elements smaller than 2^i */\r\n  int na = 0;  /* number of elements to go to array part */\r\n  int n = 0;  /* optimal size for array part */\r\n  for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) {\r\n    if (nums[i] > 0) {\r\n      a += nums[i];\r\n      if (a > twotoi/2) {  /* more than half elements present? */\r\n        n = twotoi;  /* optimal size (till now) */\r\n        na = a;  /* all elements smaller than n will go to array part */\r\n      }\r\n    }\r\n    if (a == *narray) break;  /* all elements already counted */\r\n  }\r\n  *narray = n;\r\n  lua_assert(*narray/2 <= na && na <= *narray);\r\n  return na;\r\n}\r\n\r\n\r\nstatic int countint (const TValue *key, int *nums) {\r\n  int k = arrayindex(key);\r\n  if (0 < k && k <= MAXASIZE) {  /* is `key' an appropriate array index? */\r\n    nums[luaO_ceillog2(k)]++;  /* count as such */\r\n    return 1;\r\n  }\r\n  else\r\n    return 0;\r\n}\r\n\r\n\r\nstatic int numusearray (const Table *t, int *nums) {\r\n  int lg;\r\n  int ttlg;  /* 2^lg */\r\n  int ause = 0;  /* summation of `nums' */\r\n  int i = 1;  /* count to traverse all array keys */\r\n  for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) {  /* for each slice */\r\n    int lc = 0;  /* counter */\r\n    int lim = ttlg;\r\n    if (lim > t->sizearray) {\r\n      lim = t->sizearray;  /* adjust upper limit */\r\n      if (i > lim)\r\n        break;  /* no more elements to count */\r\n    }\r\n    /* count elements in range (2^(lg-1), 2^lg] */\r\n    for (; i <= lim; i++) {\r\n      if (!ttisnil(&t->array[i-1]))\r\n        lc++;\r\n    }\r\n    nums[lg] += lc;\r\n    ause += lc;\r\n  }\r\n  return ause;\r\n}\r\n\r\n\r\nstatic int numusehash (const Table *t, int *nums, int *pnasize) {\r\n  int totaluse = 0;  /* total number of elements */\r\n  int ause = 0;  /* summation of `nums' */\r\n  int i = sizenode(t);\r\n  while (i--) {\r\n    Node *n = &t->node[i];\r\n    if (!ttisnil(gval(n))) {\r\n      ause += countint(gkey(n), nums);\r\n      totaluse++;\r\n    }\r\n  }\r\n  *pnasize += ause;\r\n  return totaluse;\r\n}\r\n\r\n\r\nstatic void setarrayvector (lua_State *L, Table *t, int size) {\r\n  int i;\r\n  luaM_reallocvector(L, t->array, t->sizearray, size, TValue);\r\n  for (i=t->sizearray; i<size; i++)\r\n     setnilvalue(&t->array[i]);\r\n  t->sizearray = size;\r\n}\r\n\r\n\r\nstatic void setnodevector (lua_State *L, Table *t, int size) {\r\n  int lsize;\r\n  if (size == 0) {  /* no elements to hash part? */\r\n    t->node = cast(Node *, dummynode);  /* use common `dummynode' */\r\n    lsize = 0;\r\n  }\r\n  else {\r\n    int i;\r\n    lsize = luaO_ceillog2(size);\r\n    if (lsize > MAXBITS)\r\n      luaG_runerror(L, \"table overflow\");\r\n    size = twoto(lsize);\r\n    t->node = luaM_newvector(L, size, Node);\r\n    for (i=0; i<size; i++) {\r\n      Node *n = gnode(t, i);\r\n      gnext(n) = NULL;\r\n      setnilvalue(gkey(n));\r\n      setnilvalue(gval(n));\r\n    }\r\n  }\r\n  t->lsizenode = cast_byte(lsize);\r\n  t->lastfree = gnode(t, size);  /* all positions are free */\r\n}\r\n\r\n\r\nvoid luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) {\r\n  int i;\r\n  int oldasize = t->sizearray;\r\n  int oldhsize = t->lsizenode;\r\n  Node *nold = t->node;  /* save old hash ... */\r\n  if (nasize > oldasize)  /* array part must grow? */\r\n    setarrayvector(L, t, nasize);\r\n  /* create new hash part with appropriate size */\r\n  setnodevector(L, t, nhsize);\r\n  if (nasize < oldasize) {  /* array part must shrink? */\r\n    t->sizearray = nasize;\r\n    /* re-insert elements from vanishing slice */\r\n    for (i=nasize; i<oldasize; i++) {\r\n      if (!ttisnil(&t->array[i]))\r\n        luaH_setint(L, t, i + 1, &t->array[i]);\r\n    }\r\n    /* shrink array */\r\n    luaM_reallocvector(L, t->array, oldasize, nasize, TValue);\r\n  }\r\n  /* re-insert elements from hash part */\r\n  for (i = twoto(oldhsize) - 1; i >= 0; i--) {\r\n    Node *old = nold+i;\r\n    if (!ttisnil(gval(old))) {\r\n      /* doesn't need barrier/invalidate cache, as entry was\r\n         already present in the table */\r\n      setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old));\r\n    }\r\n  }\r\n  if (!isdummy(nold))\r\n    luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old array */\r\n}\r\n\r\n\r\nvoid luaH_resizearray (lua_State *L, Table *t, int nasize) {\r\n  int nsize = isdummy(t->node) ? 0 : sizenode(t);\r\n  luaH_resize(L, t, nasize, nsize);\r\n}\r\n\r\n\r\nstatic void rehash (lua_State *L, Table *t, const TValue *ek) {\r\n  int nasize, na;\r\n  int nums[MAXBITS+1];  /* nums[i] = number of keys with 2^(i-1) < k <= 2^i */\r\n  int i;\r\n  int totaluse;\r\n  for (i=0; i<=MAXBITS; i++) nums[i] = 0;  /* reset counts */\r\n  nasize = numusearray(t, nums);  /* count keys in array part */\r\n  totaluse = nasize;  /* all those keys are integer keys */\r\n  totaluse += numusehash(t, nums, &nasize);  /* count keys in hash part */\r\n  /* count extra key */\r\n  nasize += countint(ek, nums);\r\n  totaluse++;\r\n  /* compute new size for array part */\r\n  na = computesizes(nums, &nasize);\r\n  /* resize the table to new computed sizes */\r\n  luaH_resize(L, t, nasize, totaluse - na);\r\n}\r\n\r\n\r\n\r\n/*\r\n** }=============================================================\r\n*/\r\n\r\n\r\nTable *luaH_new (lua_State *L) {\r\n  Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), NULL, 0)->h;\r\n  t->metatable = NULL;\r\n  t->flags = cast_byte(~0);\r\n  t->array = NULL;\r\n  t->sizearray = 0;\r\n  setnodevector(L, t, 0);\r\n  return t;\r\n}\r\n\r\n\r\nvoid luaH_free (lua_State *L, Table *t) {\r\n  if (!isdummy(t->node))\r\n    luaM_freearray(L, t->node, cast(size_t, sizenode(t)));\r\n  luaM_freearray(L, t->array, t->sizearray);\r\n  luaM_free(L, t);\r\n}\r\n\r\n\r\nstatic Node *getfreepos (Table *t) {\r\n  while (t->lastfree > t->node) {\r\n    t->lastfree--;\r\n    if (ttisnil(gkey(t->lastfree)))\r\n      return t->lastfree;\r\n  }\r\n  return NULL;  /* could not find a free place */\r\n}\r\n\r\n\r\n\r\n/*\r\n** inserts a new key into a hash table; first, check whether key's main\r\n** position is free. If not, check whether colliding node is in its main\r\n** position or not: if it is not, move colliding node to an empty place and\r\n** put new key in its main position; otherwise (colliding node is in its main\r\n** position), new key goes to an empty position.\r\n*/\r\nTValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {\r\n  Node *mp;\r\n  if (ttisnil(key)) luaG_runerror(L, \"table index is nil\");\r\n  else if (ttisnumber(key) && luai_numisnan(L, nvalue(key)))\r\n    luaG_runerror(L, \"table index is NaN\");\r\n  mp = mainposition(t, key);\r\n  if (!ttisnil(gval(mp)) || isdummy(mp)) {  /* main position is taken? */\r\n    Node *othern;\r\n    Node *n = getfreepos(t);  /* get a free place */\r\n    if (n == NULL) {  /* cannot find a free place? */\r\n      rehash(L, t, key);  /* grow table */\r\n      /* whatever called 'newkey' take care of TM cache and GC barrier */\r\n      return luaH_set(L, t, key);  /* insert key into grown table */\r\n    }\r\n    lua_assert(!isdummy(n));\r\n    othern = mainposition(t, gkey(mp));\r\n    if (othern != mp) {  /* is colliding node out of its main position? */\r\n      /* yes; move colliding node into free position */\r\n      while (gnext(othern) != mp) othern = gnext(othern);  /* find previous */\r\n      gnext(othern) = n;  /* redo the chain with `n' in place of `mp' */\r\n      *n = *mp;  /* copy colliding node into free pos. (mp->next also goes) */\r\n      gnext(mp) = NULL;  /* now `mp' is free */\r\n      setnilvalue(gval(mp));\r\n    }\r\n    else {  /* colliding node is in its own main position */\r\n      /* new node will go into free position */\r\n      gnext(n) = gnext(mp);  /* chain new position */\r\n      gnext(mp) = n;\r\n      mp = n;\r\n    }\r\n  }\r\n  setobj2t(L, gkey(mp), key);\r\n  luaC_barrierback(L, obj2gco(t), key);\r\n  lua_assert(ttisnil(gval(mp)));\r\n  return gval(mp);\r\n}\r\n\r\n\r\n/*\r\n** search function for integers\r\n*/\r\nconst TValue *luaH_getint (Table *t, int key) {\r\n  /* (1 <= key && key <= t->sizearray) */\r\n  if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))\r\n    return &t->array[key-1];\r\n  else {\r\n    lua_Number nk = cast_num(key);\r\n    Node *n = hashnum(t, nk);\r\n    do {  /* check whether `key' is somewhere in the chain */\r\n      if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))\r\n        return gval(n);  /* that's it */\r\n      else n = gnext(n);\r\n    } while (n);\r\n    return luaO_nilobject;\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** search function for strings\r\n*/\r\nconst TValue *luaH_getstr (Table *t, TString *key) {\r\n  Node *n = hashstr(t, key);\r\n  do {  /* check whether `key' is somewhere in the chain */\r\n    if (ttisstring(gkey(n)) && eqstr(rawtsvalue(gkey(n)), key))\r\n      return gval(n);  /* that's it */\r\n    else n = gnext(n);\r\n  } while (n);\r\n  return luaO_nilobject;\r\n}\r\n\r\n\r\n/*\r\n** main search function\r\n*/\r\nconst TValue *luaH_get (Table *t, const TValue *key) {\r\n  switch (ttypenv(key)) {\r\n    case LUA_TNIL: return luaO_nilobject;\r\n    case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));\r\n    case LUA_TNUMBER: {\r\n      int k;\r\n      lua_Number n = nvalue(key);\r\n      lua_number2int(k, n);\r\n      if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */\r\n        return luaH_getint(t, k);  /* use specialized version */\r\n      /* else go through */\r\n    }\r\n    default: {\r\n      Node *n = mainposition(t, key);\r\n      do {  /* check whether `key' is somewhere in the chain */\r\n        if (luaV_rawequalobj(gkey(n), key))\r\n          return gval(n);  /* that's it */\r\n        else n = gnext(n);\r\n      } while (n);\r\n      return luaO_nilobject;\r\n    }\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** beware: when using this function you probably need to check a GC\r\n** barrier and invalidate the TM cache.\r\n*/\r\nTValue *luaH_set (lua_State *L, Table *t, const TValue *key) {\r\n  const TValue *p = luaH_get(t, key);\r\n  if (p != luaO_nilobject)\r\n    return cast(TValue *, p);\r\n  else return luaH_newkey(L, t, key);\r\n}\r\n\r\n\r\nvoid luaH_setint (lua_State *L, Table *t, int key, TValue *value) {\r\n  const TValue *p = luaH_getint(t, key);\r\n  TValue *cell;\r\n  if (p != luaO_nilobject)\r\n    cell = cast(TValue *, p);\r\n  else {\r\n    TValue k;\r\n    setnvalue(&k, cast_num(key));\r\n    cell = luaH_newkey(L, t, &k);\r\n  }\r\n  setobj2t(L, cell, value);\r\n}\r\n\r\n\r\nstatic int unbound_search (Table *t, unsigned int j) {\r\n  unsigned int i = j;  /* i is zero or a present index */\r\n  j++;\r\n  /* find `i' and `j' such that i is present and j is not */\r\n  while (!ttisnil(luaH_getint(t, j))) {\r\n    i = j;\r\n    j *= 2;\r\n    if (j > cast(unsigned int, MAX_INT)) {  /* overflow? */\r\n      /* table was built with bad purposes: resort to linear search */\r\n      i = 1;\r\n      while (!ttisnil(luaH_getint(t, i))) i++;\r\n      return i - 1;\r\n    }\r\n  }\r\n  /* now do a binary search between them */\r\n  while (j - i > 1) {\r\n    unsigned int m = (i+j)/2;\r\n    if (ttisnil(luaH_getint(t, m))) j = m;\r\n    else i = m;\r\n  }\r\n  return i;\r\n}\r\n\r\n\r\n/*\r\n** Try to find a boundary in table `t'. A `boundary' is an integer index\r\n** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).\r\n*/\r\nint luaH_getn (Table *t) {\r\n  unsigned int j = t->sizearray;\r\n  if (j > 0 && ttisnil(&t->array[j - 1])) {\r\n    /* there is a boundary in the array part: (binary) search for it */\r\n    unsigned int i = 0;\r\n    while (j - i > 1) {\r\n      unsigned int m = (i+j)/2;\r\n      if (ttisnil(&t->array[m - 1])) j = m;\r\n      else i = m;\r\n    }\r\n    return i;\r\n  }\r\n  /* else must find a boundary in hash part */\r\n  else if (isdummy(t->node))  /* hash part is empty? */\r\n    return j;  /* that is easy... */\r\n  else return unbound_search(t, j);\r\n}\r\n\r\n\r\n\r\n#if defined(LUA_DEBUG)\r\n\r\nNode *luaH_mainposition (const Table *t, const TValue *key) {\r\n  return mainposition(t, key);\r\n}\r\n\r\nint luaH_isdummy (Node *n) { return isdummy(n); }\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/ltable.h",
    "content": "/*\r\n** $Id: ltable.h,v 2.16 2011/08/17 20:26:47 roberto Exp $\r\n** Lua tables (hash)\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef ltable_h\r\n#define ltable_h\r\n\r\n#include \"lobject.h\"\r\n\r\n\r\n#define gnode(t,i)\t(&(t)->node[i])\r\n#define gkey(n)\t\t(&(n)->i_key.tvk)\r\n#define gval(n)\t\t(&(n)->i_val)\r\n#define gnext(n)\t((n)->i_key.nk.next)\r\n\r\n#define invalidateTMcache(t)\t((t)->flags = 0)\r\n\r\n\r\nLUAI_FUNC const TValue *luaH_getint (Table *t, int key);\r\nLUAI_FUNC void luaH_setint (lua_State *L, Table *t, int key, TValue *value);\r\nLUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);\r\nLUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);\r\nLUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key);\r\nLUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);\r\nLUAI_FUNC Table *luaH_new (lua_State *L);\r\nLUAI_FUNC void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize);\r\nLUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize);\r\nLUAI_FUNC void luaH_free (lua_State *L, Table *t);\r\nLUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);\r\nLUAI_FUNC int luaH_getn (Table *t);\r\n\r\n\r\n#if defined(LUA_DEBUG)\r\nLUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);\r\nLUAI_FUNC int luaH_isdummy (Node *n);\r\n#endif\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/ltablib.c",
    "content": "/*\r\n** $Id: ltablib.c,v 1.63 2011/11/28 17:26:30 roberto Exp $\r\n** Library for Table Manipulation\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stddef.h>\r\n\r\n#define ltablib_c\r\n#define LUA_LIB\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n\r\n\r\n#define aux_getn(L,n)  \\\r\n\t(luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n))\r\n\r\n\r\n#if defined(LUA_COMPAT_MAXN)\r\nstatic int maxn (lua_State *L) {\r\n  lua_Number max = 0;\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  lua_pushnil(L);  /* first key */\r\n  while (lua_next(L, 1)) {\r\n    lua_pop(L, 1);  /* remove value */\r\n    if (lua_type(L, -1) == LUA_TNUMBER) {\r\n      lua_Number v = lua_tonumber(L, -1);\r\n      if (v > max) max = v;\r\n    }\r\n  }\r\n  lua_pushnumber(L, max);\r\n  return 1;\r\n}\r\n#endif\r\n\r\n\r\nstatic int tinsert (lua_State *L) {\r\n  int e = aux_getn(L, 1) + 1;  /* first empty element */\r\n  int pos;  /* where to insert new element */\r\n  switch (lua_gettop(L)) {\r\n    case 2: {  /* called with only 2 arguments */\r\n      pos = e;  /* insert new element at the end */\r\n      break;\r\n    }\r\n    case 3: {\r\n      int i;\r\n      pos = luaL_checkint(L, 2);  /* 2nd argument is the position */\r\n      if (pos > e) e = pos;  /* `grow' array if necessary */\r\n      for (i = e; i > pos; i--) {  /* move up elements */\r\n        lua_rawgeti(L, 1, i-1);\r\n        lua_rawseti(L, 1, i);  /* t[i] = t[i-1] */\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      return luaL_error(L, \"wrong number of arguments to \" LUA_QL(\"insert\"));\r\n    }\r\n  }\r\n  lua_rawseti(L, 1, pos);  /* t[pos] = v */\r\n  return 0;\r\n}\r\n\r\n\r\nstatic int tremove (lua_State *L) {\r\n  int e = aux_getn(L, 1);\r\n  int pos = luaL_optint(L, 2, e);\r\n  if (!(1 <= pos && pos <= e))  /* position is outside bounds? */\r\n    return 0;  /* nothing to remove */\r\n  lua_rawgeti(L, 1, pos);  /* result = t[pos] */\r\n  for ( ;pos<e; pos++) {\r\n    lua_rawgeti(L, 1, pos+1);\r\n    lua_rawseti(L, 1, pos);  /* t[pos] = t[pos+1] */\r\n  }\r\n  lua_pushnil(L);\r\n  lua_rawseti(L, 1, e);  /* t[e] = nil */\r\n  return 1;\r\n}\r\n\r\n\r\nstatic void addfield (lua_State *L, luaL_Buffer *b, int i) {\r\n  lua_rawgeti(L, 1, i);\r\n  if (!lua_isstring(L, -1))\r\n    luaL_error(L, \"invalid value (%s) at index %d in table for \"\r\n                  LUA_QL(\"concat\"), luaL_typename(L, -1), i);\r\n  luaL_addvalue(b);\r\n}\r\n\r\n\r\nstatic int tconcat (lua_State *L) {\r\n  luaL_Buffer b;\r\n  size_t lsep;\r\n  int i, last;\r\n  const char *sep = luaL_optlstring(L, 2, \"\", &lsep);\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  i = luaL_optint(L, 3, 1);\r\n  last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1));\r\n  luaL_buffinit(L, &b);\r\n  for (; i < last; i++) {\r\n    addfield(L, &b, i);\r\n    luaL_addlstring(&b, sep, lsep);\r\n  }\r\n  if (i == last)  /* add last value (if interval was not empty) */\r\n    addfield(L, &b, i);\r\n  luaL_pushresult(&b);\r\n  return 1;\r\n}\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Pack/unpack\r\n** =======================================================\r\n*/\r\n\r\nstatic int pack (lua_State *L) {\r\n  int n = lua_gettop(L);  /* number of elements to pack */\r\n  lua_createtable(L, n, 1);  /* create result table */\r\n  lua_pushinteger(L, n);\r\n  lua_setfield(L, -2, \"n\");  /* t.n = number of elements */\r\n  if (n > 0) {  /* at least one element? */\r\n    int i;\r\n    lua_pushvalue(L, 1);\r\n    lua_rawseti(L, -2, 1);  /* insert first element */\r\n    lua_replace(L, 1);  /* move table into index 1 */\r\n    for (i = n; i >= 2; i--)  /* assign other elements */\r\n      lua_rawseti(L, 1, i);\r\n  }\r\n  return 1;  /* return table */\r\n}\r\n\r\n\r\nstatic int unpack (lua_State *L) {\r\n  int i, e, n;\r\n  luaL_checktype(L, 1, LUA_TTABLE);\r\n  i = luaL_optint(L, 2, 1);\r\n  e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));\r\n  if (i > e) return 0;  /* empty range */\r\n  n = e - i + 1;  /* number of elements */\r\n  if (n <= 0 || !lua_checkstack(L, n))  /* n <= 0 means arith. overflow */\r\n    return luaL_error(L, \"too many results to unpack\");\r\n  lua_rawgeti(L, 1, i);  /* push arg[i] (avoiding overflow problems) */\r\n  while (i++ < e)  /* push arg[i + 1...e] */\r\n    lua_rawgeti(L, 1, i);\r\n  return n;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\n\r\n/*\r\n** {======================================================\r\n** Quicksort\r\n** (based on `Algorithms in MODULA-3', Robert Sedgewick;\r\n**  Addison-Wesley, 1993.)\r\n** =======================================================\r\n*/\r\n\r\n\r\nstatic void set2 (lua_State *L, int i, int j) {\r\n  lua_rawseti(L, 1, i);\r\n  lua_rawseti(L, 1, j);\r\n}\r\n\r\nstatic int sort_comp (lua_State *L, int a, int b) {\r\n  if (!lua_isnil(L, 2)) {  /* function? */\r\n    int res;\r\n    lua_pushvalue(L, 2);\r\n    lua_pushvalue(L, a-1);  /* -1 to compensate function */\r\n    lua_pushvalue(L, b-2);  /* -2 to compensate function and `a' */\r\n    lua_call(L, 2, 1);\r\n    res = lua_toboolean(L, -1);\r\n    lua_pop(L, 1);\r\n    return res;\r\n  }\r\n  else  /* a < b? */\r\n    return lua_compare(L, a, b, LUA_OPLT);\r\n}\r\n\r\nstatic void auxsort (lua_State *L, int l, int u) {\r\n  while (l < u) {  /* for tail recursion */\r\n    int i, j;\r\n    /* sort elements a[l], a[(l+u)/2] and a[u] */\r\n    lua_rawgeti(L, 1, l);\r\n    lua_rawgeti(L, 1, u);\r\n    if (sort_comp(L, -1, -2))  /* a[u] < a[l]? */\r\n      set2(L, l, u);  /* swap a[l] - a[u] */\r\n    else\r\n      lua_pop(L, 2);\r\n    if (u-l == 1) break;  /* only 2 elements */\r\n    i = (l+u)/2;\r\n    lua_rawgeti(L, 1, i);\r\n    lua_rawgeti(L, 1, l);\r\n    if (sort_comp(L, -2, -1))  /* a[i]<a[l]? */\r\n      set2(L, i, l);\r\n    else {\r\n      lua_pop(L, 1);  /* remove a[l] */\r\n      lua_rawgeti(L, 1, u);\r\n      if (sort_comp(L, -1, -2))  /* a[u]<a[i]? */\r\n        set2(L, i, u);\r\n      else\r\n        lua_pop(L, 2);\r\n    }\r\n    if (u-l == 2) break;  /* only 3 elements */\r\n    lua_rawgeti(L, 1, i);  /* Pivot */\r\n    lua_pushvalue(L, -1);\r\n    lua_rawgeti(L, 1, u-1);\r\n    set2(L, i, u-1);\r\n    /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */\r\n    i = l; j = u-1;\r\n    for (;;) {  /* invariant: a[l..i] <= P <= a[j..u] */\r\n      /* repeat ++i until a[i] >= P */\r\n      while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {\r\n        if (i>=u) luaL_error(L, \"invalid order function for sorting\");\r\n        lua_pop(L, 1);  /* remove a[i] */\r\n      }\r\n      /* repeat --j until a[j] <= P */\r\n      while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {\r\n        if (j<=l) luaL_error(L, \"invalid order function for sorting\");\r\n        lua_pop(L, 1);  /* remove a[j] */\r\n      }\r\n      if (j<i) {\r\n        lua_pop(L, 3);  /* pop pivot, a[i], a[j] */\r\n        break;\r\n      }\r\n      set2(L, i, j);\r\n    }\r\n    lua_rawgeti(L, 1, u-1);\r\n    lua_rawgeti(L, 1, i);\r\n    set2(L, u-1, i);  /* swap pivot (a[u-1]) with a[i] */\r\n    /* a[l..i-1] <= a[i] == P <= a[i+1..u] */\r\n    /* adjust so that smaller half is in [j..i] and larger one in [l..u] */\r\n    if (i-l < u-i) {\r\n      j=l; i=i-1; l=i+2;\r\n    }\r\n    else {\r\n      j=i+1; i=u; u=j-2;\r\n    }\r\n    auxsort(L, j, i);  /* call recursively the smaller one */\r\n  }  /* repeat the routine for the larger one */\r\n}\r\n\r\nstatic int sort (lua_State *L) {\r\n  int n = aux_getn(L, 1);\r\n  luaL_checkstack(L, 40, \"\");  /* assume array is smaller than 2^40 */\r\n  if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */\r\n    luaL_checktype(L, 2, LUA_TFUNCTION);\r\n  lua_settop(L, 2);  /* make sure there is two arguments */\r\n  auxsort(L, 1, n);\r\n  return 0;\r\n}\r\n\r\n/* }====================================================== */\r\n\r\n\r\nstatic const luaL_Reg tab_funcs[] = {\r\n  {\"concat\", tconcat},\r\n#if defined(LUA_COMPAT_MAXN)\r\n  {\"maxn\", maxn},\r\n#endif\r\n  {\"insert\", tinsert},\r\n  {\"pack\", pack},\r\n  {\"unpack\", unpack},\r\n  {\"remove\", tremove},\r\n  {\"sort\", sort},\r\n  {NULL, NULL}\r\n};\r\n\r\n\r\nLUAMOD_API int luaopen_table (lua_State *L) {\r\n  luaL_newlib(L, tab_funcs);\r\n#if defined(LUA_COMPAT_UNPACK)\r\n  /* _G.unpack = table.unpack */\r\n  lua_getfield(L, -1, \"unpack\");\r\n  lua_setglobal(L, \"unpack\");\r\n#endif\r\n  return 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ltm.c",
    "content": "/*\r\n** $Id: ltm.c,v 2.14 2011/06/02 19:31:40 roberto Exp $\r\n** Tag methods\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <string.h>\r\n\r\n#define ltm_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lobject.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n\r\n\r\nstatic const char udatatypename[] = \"userdata\";\r\n\r\nLUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {\r\n  \"no value\",\r\n  \"nil\", \"boolean\", udatatypename, \"number\",\r\n  \"string\", \"table\", \"function\", udatatypename, \"thread\",\r\n  \"proto\", \"upval\"  /* these last two cases are used for tests only */\r\n};\r\n\r\n\r\nvoid luaT_init (lua_State *L) {\r\n  static const char *const luaT_eventname[] = {  /* ORDER TM */\r\n    \"__index\", \"__newindex\",\r\n    \"__gc\", \"__mode\", \"__len\", \"__eq\",\r\n    \"__add\", \"__sub\", \"__mul\", \"__div\", \"__mod\",\r\n    \"__pow\", \"__unm\", \"__lt\", \"__le\",\r\n    \"__concat\", \"__call\"\r\n  };\r\n  int i;\r\n  for (i=0; i<TM_N; i++) {\r\n    G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);\r\n    luaS_fix(G(L)->tmname[i]);  /* never collect these names */\r\n  }\r\n}\r\n\r\n\r\n/*\r\n** function to be used with macro \"fasttm\": optimized for absence of\r\n** tag methods\r\n*/\r\nconst TValue *luaT_gettm (Table *events, TMS event, TString *ename) {\r\n  const TValue *tm = luaH_getstr(events, ename);\r\n  lua_assert(event <= TM_EQ);\r\n  if (ttisnil(tm)) {  /* no tag method? */\r\n    events->flags |= cast_byte(1u<<event);  /* cache this fact */\r\n    return NULL;\r\n  }\r\n  else return tm;\r\n}\r\n\r\n\r\nconst TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {\r\n  Table *mt;\r\n  switch (ttypenv(o)) {\r\n    case LUA_TTABLE:\r\n      mt = hvalue(o)->metatable;\r\n      break;\r\n    case LUA_TUSERDATA:\r\n      mt = uvalue(o)->metatable;\r\n      break;\r\n    default:\r\n      mt = G(L)->mt[ttypenv(o)];\r\n  }\r\n  return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/ltm.h",
    "content": "/*\r\n** $Id: ltm.h,v 2.11 2011/02/28 17:32:10 roberto Exp $\r\n** Tag methods\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef ltm_h\r\n#define ltm_h\r\n\r\n\r\n#include \"lobject.h\"\r\n\r\n\r\n/*\r\n* WARNING: if you change the order of this enumeration,\r\n* grep \"ORDER TM\"\r\n*/\r\ntypedef enum {\r\n  TM_INDEX,\r\n  TM_NEWINDEX,\r\n  TM_GC,\r\n  TM_MODE,\r\n  TM_LEN,\r\n  TM_EQ,  /* last tag method with `fast' access */\r\n  TM_ADD,\r\n  TM_SUB,\r\n  TM_MUL,\r\n  TM_DIV,\r\n  TM_MOD,\r\n  TM_POW,\r\n  TM_UNM,\r\n  TM_LT,\r\n  TM_LE,\r\n  TM_CONCAT,\r\n  TM_CALL,\r\n  TM_N\t\t/* number of elements in the enum */\r\n} TMS;\r\n\r\n\r\n\r\n#define gfasttm(g,et,e) ((et) == NULL ? NULL : \\\r\n  ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))\r\n\r\n#define fasttm(l,et,e)\tgfasttm(G(l), et, e)\r\n\r\n#define ttypename(x)\tluaT_typenames_[(x) + 1]\r\n#define objtypename(x)\tttypename(ttypenv(x))\r\n\r\nLUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];\r\n\r\n\r\nLUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);\r\nLUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,\r\n                                                       TMS event);\r\nLUAI_FUNC void luaT_init (lua_State *L);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lua.h",
    "content": "/*\r\n** $Id: lua.h,v 1.282 2011/11/29 15:55:08 roberto Exp $\r\n** Lua - A Scripting Language\r\n** Lua.org, PUC-Rio, Brazil (http://www.lua.org)\r\n** See Copyright Notice at the end of this file\r\n*/\r\n\r\n\r\n#ifndef lua_h\r\n#define lua_h\r\n#ifdef _WIN32\r\n#pragma warning(disable:4996)\r\n#endif\r\n\r\n#include <stdarg.h>\r\n#include <stddef.h>\r\n\r\n\r\n#include \"luaconf.h\"\r\n\r\n\r\n#define LUA_VERSION_MAJOR\t\"5\"\r\n#define LUA_VERSION_MINOR\t\"2\"\r\n#define LUA_VERSION_NUM\t\t502\r\n#define LUA_VERSION_RELEASE\t\"0\"\r\n\r\n#define LUA_VERSION\t\"Lua \" LUA_VERSION_MAJOR \".\" LUA_VERSION_MINOR\r\n#define LUA_RELEASE\tLUA_VERSION \".\" LUA_VERSION_RELEASE\r\n#define LUA_COPYRIGHT\tLUA_RELEASE \"  Copyright (C) 1994-2011 Lua.org, PUC-Rio\"\r\n#define LUA_AUTHORS\t\"R. Ierusalimschy, L. H. de Figueiredo, W. Celes\"\r\n\r\n\r\n/* mark for precompiled code ('<esc>Lua') */\r\n#define LUA_SIGNATURE\t\"\\033Lua\"\r\n\r\n/* option for multiple returns in 'lua_pcall' and 'lua_call' */\r\n#define LUA_MULTRET\t(-1)\r\n\r\n\r\n/*\r\n** pseudo-indices\r\n*/\r\n#define LUA_REGISTRYINDEX\tLUAI_FIRSTPSEUDOIDX\r\n#define lua_upvalueindex(i)\t(LUA_REGISTRYINDEX - (i))\r\n\r\n\r\n/* thread status */\r\n#define LUA_OK\t\t0\r\n#define LUA_YIELD\t1\r\n#define LUA_ERRRUN\t2\r\n#define LUA_ERRSYNTAX\t3\r\n#define LUA_ERRMEM\t4\r\n#define LUA_ERRGCMM\t5\r\n#define LUA_ERRERR\t6\r\n\r\n\r\ntypedef struct lua_State lua_State;\r\n\r\ntypedef int (*lua_CFunction) (lua_State *L);\r\n\r\n\r\n/*\r\n** functions that read/write blocks when loading/dumping Lua chunks\r\n*/\r\ntypedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);\r\n\r\ntypedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);\r\n\r\n\r\n/*\r\n** prototype for memory-allocation functions\r\n*/\r\ntypedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);\r\n\r\n\r\n/*\r\n** basic types\r\n*/\r\n#define LUA_TNONE\t\t(-1)\r\n\r\n#define LUA_TNIL\t\t0\r\n#define LUA_TBOOLEAN\t\t1\r\n#define LUA_TLIGHTUSERDATA\t2\r\n#define LUA_TNUMBER\t\t3\r\n#define LUA_TSTRING\t\t4\r\n#define LUA_TTABLE\t\t5\r\n#define LUA_TFUNCTION\t\t6\r\n#define LUA_TUSERDATA\t\t7\r\n#define LUA_TTHREAD\t\t8\r\n\r\n#define LUA_NUMTAGS\t\t9\r\n\r\n\r\n\r\n/* minimum Lua stack available to a C function */\r\n#define LUA_MINSTACK\t20\r\n\r\n\r\n/* predefined values in the registry */\r\n#define LUA_RIDX_MAINTHREAD\t1\r\n#define LUA_RIDX_GLOBALS\t2\r\n#define LUA_RIDX_LAST\t\tLUA_RIDX_GLOBALS\r\n\r\n\r\n/* type of numbers in Lua */\r\ntypedef LUA_NUMBER lua_Number;\r\n\r\n\r\n/* type for integer functions */\r\ntypedef LUA_INTEGER lua_Integer;\r\n\r\n/* unsigned integer type */\r\ntypedef LUA_UNSIGNED lua_Unsigned;\r\n\r\n\r\n\r\n/*\r\n** generic extra include file\r\n*/\r\n#if defined(LUA_USER_H)\r\n#include LUA_USER_H\r\n#endif\r\n\r\n\r\n\r\n/*\r\n** state manipulation\r\n*/\r\nLUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);\r\nLUA_API void       (lua_close) (lua_State *L);\r\nLUA_API lua_State *(lua_newthread) (lua_State *L);\r\n\r\nLUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);\r\n\r\n\r\nLUA_API const lua_Number *(lua_version) (lua_State *L);\r\n\r\n\r\n/*\r\n** basic stack manipulation\r\n*/\r\nLUA_API int   (lua_absindex) (lua_State *L, int idx);\r\nLUA_API int   (lua_gettop) (lua_State *L);\r\nLUA_API void  (lua_settop) (lua_State *L, int idx);\r\nLUA_API void  (lua_pushvalue) (lua_State *L, int idx);\r\nLUA_API void  (lua_remove) (lua_State *L, int idx);\r\nLUA_API void  (lua_insert) (lua_State *L, int idx);\r\nLUA_API void  (lua_replace) (lua_State *L, int idx);\r\nLUA_API void  (lua_copy) (lua_State *L, int fromidx, int toidx);\r\nLUA_API int   (lua_checkstack) (lua_State *L, int sz);\r\n\r\nLUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);\r\n\r\n\r\n/*\r\n** access functions (stack -> C)\r\n*/\r\n\r\nLUA_API int             (lua_isnumber) (lua_State *L, int idx);\r\nLUA_API int             (lua_isstring) (lua_State *L, int idx);\r\nLUA_API int             (lua_iscfunction) (lua_State *L, int idx);\r\nLUA_API int             (lua_isuserdata) (lua_State *L, int idx);\r\nLUA_API int             (lua_type) (lua_State *L, int idx);\r\nLUA_API const char     *(lua_typename) (lua_State *L, int tp);\r\n\r\nLUA_API lua_Number      (lua_tonumberx) (lua_State *L, int idx, int *isnum);\r\nLUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);\r\nLUA_API lua_Unsigned    (lua_tounsignedx) (lua_State *L, int idx, int *isnum);\r\nLUA_API int             (lua_toboolean) (lua_State *L, int idx);\r\nLUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);\r\nLUA_API size_t          (lua_rawlen) (lua_State *L, int idx);\r\nLUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);\r\nLUA_API void\t       *(lua_touserdata) (lua_State *L, int idx);\r\nLUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);\r\nLUA_API const void     *(lua_topointer) (lua_State *L, int idx);\r\n\r\n\r\n/*\r\n** Comparison and arithmetic functions\r\n*/\r\n\r\n#define LUA_OPADD\t0\t/* ORDER TM */\r\n#define LUA_OPSUB\t1\r\n#define LUA_OPMUL\t2\r\n#define LUA_OPDIV\t3\r\n#define LUA_OPMOD\t4\r\n#define LUA_OPPOW\t5\r\n#define LUA_OPUNM\t6\r\n\r\nLUA_API void  (lua_arith) (lua_State *L, int op);\r\n\r\n#define LUA_OPEQ\t0\r\n#define LUA_OPLT\t1\r\n#define LUA_OPLE\t2\r\n\r\nLUA_API int   (lua_rawequal) (lua_State *L, int idx1, int idx2);\r\nLUA_API int   (lua_compare) (lua_State *L, int idx1, int idx2, int op);\r\n\r\n\r\n/*\r\n** push functions (C -> stack)\r\n*/\r\nLUA_API void        (lua_pushnil) (lua_State *L);\r\nLUA_API void        (lua_pushnumber) (lua_State *L, lua_Number n);\r\nLUA_API void        (lua_pushinteger) (lua_State *L, lua_Integer n);\r\nLUA_API void        (lua_pushunsigned) (lua_State *L, lua_Unsigned n);\r\nLUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t l);\r\nLUA_API const char *(lua_pushstring) (lua_State *L, const char *s);\r\nLUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,\r\n                                                      va_list argp);\r\nLUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);\r\nLUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);\r\nLUA_API void  (lua_pushboolean) (lua_State *L, int b);\r\nLUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);\r\nLUA_API int   (lua_pushthread) (lua_State *L);\r\n\r\n\r\n/*\r\n** get functions (Lua -> stack)\r\n*/\r\nLUA_API void  (lua_getglobal) (lua_State *L, const char *var);\r\nLUA_API void  (lua_gettable) (lua_State *L, int idx);\r\nLUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);\r\nLUA_API void  (lua_rawget) (lua_State *L, int idx);\r\nLUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);\r\nLUA_API void  (lua_rawgetp) (lua_State *L, int idx, const void *p);\r\nLUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);\r\nLUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);\r\nLUA_API int   (lua_getmetatable) (lua_State *L, int objindex);\r\nLUA_API void  (lua_getuservalue) (lua_State *L, int idx);\r\n\r\n\r\n/*\r\n** set functions (stack -> Lua)\r\n*/\r\nLUA_API void  (lua_setglobal) (lua_State *L, const char *var);\r\nLUA_API void  (lua_settable) (lua_State *L, int idx);\r\nLUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);\r\nLUA_API void  (lua_rawset) (lua_State *L, int idx);\r\nLUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);\r\nLUA_API void  (lua_rawsetp) (lua_State *L, int idx, const void *p);\r\nLUA_API int   (lua_setmetatable) (lua_State *L, int objindex);\r\nLUA_API void  (lua_setuservalue) (lua_State *L, int idx);\r\n\r\n\r\n/*\r\n** 'load' and 'call' functions (load and run Lua code)\r\n*/\r\nLUA_API void  (lua_callk) (lua_State *L, int nargs, int nresults, int ctx,\r\n                           lua_CFunction k);\r\n#define lua_call(L,n,r)\t\tlua_callk(L, (n), (r), 0, NULL)\r\n\r\nLUA_API int   (lua_getctx) (lua_State *L, int *ctx);\r\n\r\nLUA_API int   (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,\r\n                            int ctx, lua_CFunction k);\r\n#define lua_pcall(L,n,r,f)\tlua_pcallk(L, (n), (r), (f), 0, NULL)\r\n\r\nLUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,\r\n                                        const char *chunkname,\r\n                                        const char *mode);\r\n\r\nLUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);\r\n\r\n\r\n/*\r\n** coroutine functions\r\n*/\r\nLUA_API int  (lua_yieldk) (lua_State *L, int nresults, int ctx,\r\n                           lua_CFunction k);\r\n#define lua_yield(L,n)\t\tlua_yieldk(L, (n), 0, NULL)\r\nLUA_API int  (lua_resume) (lua_State *L, lua_State *from, int narg);\r\nLUA_API int  (lua_status) (lua_State *L);\r\n\r\n/*\r\n** garbage-collection function and options\r\n*/\r\n\r\n#define LUA_GCSTOP\t\t0\r\n#define LUA_GCRESTART\t\t1\r\n#define LUA_GCCOLLECT\t\t2\r\n#define LUA_GCCOUNT\t\t3\r\n#define LUA_GCCOUNTB\t\t4\r\n#define LUA_GCSTEP\t\t5\r\n#define LUA_GCSETPAUSE\t\t6\r\n#define LUA_GCSETSTEPMUL\t7\r\n#define LUA_GCSETMAJORINC\t8\r\n#define LUA_GCISRUNNING\t\t9\r\n#define LUA_GCGEN\t\t10\r\n#define LUA_GCINC\t\t11\r\n\r\nLUA_API int (lua_gc) (lua_State *L, int what, int data);\r\n\r\n\r\n/*\r\n** miscellaneous functions\r\n*/\r\n\r\nLUA_API int   (lua_error) (lua_State *L);\r\n\r\nLUA_API int   (lua_next) (lua_State *L, int idx);\r\n\r\nLUA_API void  (lua_concat) (lua_State *L, int n);\r\nLUA_API void  (lua_len)    (lua_State *L, int idx);\r\n\r\nLUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);\r\nLUA_API void      (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);\r\n\r\n\r\n\r\n/*\r\n** ===============================================================\r\n** some useful macros\r\n** ===============================================================\r\n*/\r\n\r\n#define lua_tonumber(L,i)\tlua_tonumberx(L,i,NULL)\r\n#define lua_tointeger(L,i)\tlua_tointegerx(L,i,NULL)\r\n#define lua_tounsigned(L,i)\tlua_tounsignedx(L,i,NULL)\r\n\r\n#define lua_pop(L,n)\t\tlua_settop(L, -(n)-1)\r\n\r\n#define lua_newtable(L)\t\tlua_createtable(L, 0, 0)\r\n\r\n#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))\r\n\r\n#define lua_pushcfunction(L,f)\tlua_pushcclosure(L, (f), 0)\r\n\r\n#define lua_isfunction(L,n)\t(lua_type(L, (n)) == LUA_TFUNCTION)\r\n#define lua_istable(L,n)\t(lua_type(L, (n)) == LUA_TTABLE)\r\n#define lua_islightuserdata(L,n)\t(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)\r\n#define lua_isnil(L,n)\t\t(lua_type(L, (n)) == LUA_TNIL)\r\n#define lua_isboolean(L,n)\t(lua_type(L, (n)) == LUA_TBOOLEAN)\r\n#define lua_isthread(L,n)\t(lua_type(L, (n)) == LUA_TTHREAD)\r\n#define lua_isnone(L,n)\t\t(lua_type(L, (n)) == LUA_TNONE)\r\n#define lua_isnoneornil(L, n)\t(lua_type(L, (n)) <= 0)\r\n\r\n#define lua_pushliteral(L, s)\t\\\r\n\tlua_pushlstring(L, \"\" s, (sizeof(s)/sizeof(char))-1)\r\n\r\n#define lua_pushglobaltable(L)  \\\r\n\tlua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)\r\n\r\n#define lua_tostring(L,i)\tlua_tolstring(L, (i), NULL)\r\n\r\n\r\n\r\n/*\r\n** {======================================================================\r\n** Debug API\r\n** =======================================================================\r\n*/\r\n\r\n\r\n/*\r\n** Event codes\r\n*/\r\n#define LUA_HOOKCALL\t0\r\n#define LUA_HOOKRET\t1\r\n#define LUA_HOOKLINE\t2\r\n#define LUA_HOOKCOUNT\t3\r\n#define LUA_HOOKTAILCALL 4\r\n\r\n\r\n/*\r\n** Event masks\r\n*/\r\n#define LUA_MASKCALL\t(1 << LUA_HOOKCALL)\r\n#define LUA_MASKRET\t(1 << LUA_HOOKRET)\r\n#define LUA_MASKLINE\t(1 << LUA_HOOKLINE)\r\n#define LUA_MASKCOUNT\t(1 << LUA_HOOKCOUNT)\r\n\r\ntypedef struct lua_Debug lua_Debug;  /* activation record */\r\n\r\n\r\n/* Functions to be called by the debugger in specific events */\r\ntypedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);\r\n\r\n\r\nLUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);\r\nLUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);\r\nLUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);\r\nLUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);\r\nLUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n);\r\nLUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n);\r\n\r\nLUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n);\r\nLUA_API void  (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,\r\n                                               int fidx2, int n2);\r\n\r\nLUA_API int (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);\r\nLUA_API lua_Hook (lua_gethook) (lua_State *L);\r\nLUA_API int (lua_gethookmask) (lua_State *L);\r\nLUA_API int (lua_gethookcount) (lua_State *L);\r\n\r\n\r\nstruct lua_Debug {\r\n  int event;\r\n  const char *name;\t/* (n) */\r\n  const char *namewhat;\t/* (n) 'global', 'local', 'field', 'method' */\r\n  const char *what;\t/* (S) 'Lua', 'C', 'main', 'tail' */\r\n  const char *source;\t/* (S) */\r\n  int currentline;\t/* (l) */\r\n  int linedefined;\t/* (S) */\r\n  int lastlinedefined;\t/* (S) */\r\n  unsigned char nups;\t/* (u) number of upvalues */\r\n  unsigned char nparams;/* (u) number of parameters */\r\n  char isvararg;        /* (u) */\r\n  char istailcall;\t/* (t) */\r\n  char short_src[LUA_IDSIZE]; /* (S) */\r\n  /* private part */\r\n  struct CallInfo *i_ci;  /* active function */\r\n};\r\n\r\n/* }====================================================================== */\r\n\r\n\r\n/******************************************************************************\r\n* Copyright (C) 1994-2011 Lua.org, PUC-Rio.  All rights reserved.\r\n*\r\n* Permission is hereby granted, free of charge, to any person obtaining\r\n* a copy of this software and associated documentation files (the\r\n* \"Software\"), to deal in the Software without restriction, including\r\n* without limitation the rights to use, copy, modify, merge, publish,\r\n* distribute, sublicense, and/or sell copies of the Software, and to\r\n* permit persons to whom the Software is furnished to do so, subject to\r\n* the following conditions:\r\n*\r\n* The above copyright notice and this permission notice shall be\r\n* included in all copies or substantial portions of the Software.\r\n*\r\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n******************************************************************************/\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lua.hpp",
    "content": "// lua.hpp\r\n// Lua header files for C++\r\n// <<extern \"C\">> not supplied automatically because Lua also compiles as C++\r\n\r\nextern \"C\" {\r\n#include \"lua.h\"\r\n#include \"lualib.h\"\r\n#include \"lauxlib.h\"\r\n}\r\n"
  },
  {
    "path": "Engine/libs/lua/luaconf.h",
    "content": "﻿/*\r\n** $Id: luaconf.h,v 1.170 2011/12/06 16:58:36 roberto Exp $\r\n** Configuration file for Lua\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#ifndef lconfig_h\r\n#define lconfig_h\r\n\r\n#include <limits.h>\r\n#include <stddef.h>\r\n\r\n\r\n/*\r\n** ==================================================================\r\n** Search for \"@@\" to find all configurable definitions.\r\n** ===================================================================\r\n*/\r\n\r\n\r\n/*\r\n@@ LUA_ANSI controls the use of non-ansi features.\r\n** CHANGE it (define it) if you want Lua to avoid the use of any\r\n** non-ansi feature or library.\r\n*/\r\n#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__)\r\n#define LUA_ANSI\r\n#endif\r\n\r\n\r\n#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE)\r\n#define LUA_WIN\t\t/* enable goodies for regular Windows platforms */\r\n#endif\r\n\r\n#if defined(LUA_WIN)\r\n#define LUA_DL_DLL\r\n#define LUA_USE_AFORMAT\t\t/* assume 'printf' handles 'aA' specifiers */\r\n#endif\r\n\r\n\r\n\r\n#if defined(LUA_USE_LINUX)\r\n#define LUA_USE_POSIX\r\n#define LUA_USE_DLOPEN\t\t/* needs an extra library: -ldl */\r\n#define LUA_USE_READLINE\t/* needs some extra libraries */\r\n#define LUA_USE_STRTODHEX\t/* assume 'strtod' handles hexa formats */\r\n#define LUA_USE_AFORMAT\t\t/* assume 'printf' handles 'aA' specifiers */\r\n#define LUA_USE_LONGLONG\t/* assume support for long long */\r\n#endif\r\n\r\n#if defined(LUA_USE_MACOSX)\r\n#define LUA_USE_POSIX\r\n#define LUA_USE_DLOPEN\t\t/* does not need -ldl */\r\n#define LUA_USE_READLINE\t/* needs an extra library: -lreadline */\r\n#define LUA_USE_STRTODHEX\t/* assume 'strtod' handles hexa formats */\r\n#define LUA_USE_AFORMAT\t\t/* assume 'printf' handles 'aA' specifiers */\r\n#define LUA_USE_LONGLONG\t/* assume support for long long */\r\n#endif\r\n\r\n\r\n\r\n/*\r\n@@ LUA_USE_POSIX includes all functionality listed as X/Open System\r\n@* Interfaces Extension (XSI).\r\n** CHANGE it (define it) if your system is XSI compatible.\r\n*/\r\n#if defined(LUA_USE_POSIX)\r\n#define LUA_USE_MKSTEMP\r\n#define LUA_USE_ISATTY\r\n#define LUA_USE_POPEN\r\n#define LUA_USE_ULONGJMP\r\n#define LUA_USE_GMTIME_R\r\n#endif\r\n\r\n\r\n\r\n/*\r\n@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for\r\n@* Lua libraries.\r\n@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for\r\n@* C libraries.\r\n** CHANGE them if your machine has a non-conventional directory\r\n** hierarchy or if you want to install your libraries in\r\n** non-conventional directories.\r\n*/\r\n#if defined(_WIN32)\t/* { */\r\n/*\r\n** In Windows, any exclamation mark ('!') in the path is replaced by the\r\n** path of the directory of the executable file of the current process.\r\n*/\r\n#define LUA_LDIR\t\"!\\\\lua\\\\\"\r\n#define LUA_CDIR\t\"!\\\\\"\r\n#define LUA_PATH_DEFAULT  \\\r\n\t\tLUA_LDIR\"?.lua;\"  LUA_LDIR\"?\\\\init.lua;\" \\\r\n\t\tLUA_CDIR\"?.lua;\"  LUA_CDIR\"?\\\\init.lua;\" \".\\\\?.lua\"\r\n#define LUA_CPATH_DEFAULT \\\r\n\t\tLUA_CDIR\"?.dll;\" LUA_CDIR\"loadall.dll;\" \".\\\\?.dll\"\r\n\r\n#else\t\t\t/* }{ */\r\n\r\n#define LUA_VDIR\tLUA_VERSION_MAJOR \".\" LUA_VERSION_MINOR \"/\"\r\n#define LUA_ROOT\t\"/usr/local/\"\r\n#define LUA_LDIR\tLUA_ROOT \"share/lua/\" LUA_VDIR\r\n#define LUA_CDIR\tLUA_ROOT \"lib/lua/\" LUA_VDIR\r\n#define LUA_PATH_DEFAULT  \\\r\n\t\tLUA_LDIR\"?.lua;\"  LUA_LDIR\"?/init.lua;\" \\\r\n\t\tLUA_CDIR\"?.lua;\"  LUA_CDIR\"?/init.lua;\" \"./?.lua\"\r\n#define LUA_CPATH_DEFAULT \\\r\n\t\tLUA_CDIR\"?.so;\" LUA_CDIR\"loadall.so;\" \"./?.so\"\r\n#endif\t\t\t/* } */\r\n\r\n\r\n/*\r\n@@ LUA_DIRSEP is the directory separator (for submodules).\r\n** CHANGE it if your machine does not use \"/\" as the directory separator\r\n** and is not Windows. (On Windows Lua automatically uses \"\\\".)\r\n*/\r\n#if defined(_WIN32)\r\n#define LUA_DIRSEP\t\"\\\\\"\r\n#else\r\n#define LUA_DIRSEP\t\"/\"\r\n#endif\r\n\r\n\r\n/*\r\n@@ LUA_ENV is the name of the variable that holds the current\r\n@@ environment, used to access global names.\r\n** CHANGE it if you do not like this name.\r\n*/\r\n#define LUA_ENV\t\t\"_ENV\"\r\n\r\n\r\n/*\r\n@@ LUA_API is a mark for all core API functions.\r\n@@ LUALIB_API is a mark for all auxiliary library functions.\r\n@@ LUAMOD_API is a mark for all standard library opening functions.\r\n** CHANGE them if you need to define those functions in some special way.\r\n** For instance, if you want to create one Windows DLL with the core and\r\n** the libraries, you may want to use the following definition (define\r\n** LUA_BUILD_AS_DLL to get it).\r\n*/\r\n#if defined(LUA_BUILD_AS_DLL)\t/* { */\r\n\r\n#if defined(LUA_CORE) || defined(LUA_LIB)\t/* { */\r\n#define LUA_API __declspec(dllexport)\r\n#else\t\t\t\t\t\t/* }{ */\r\n#define LUA_API __declspec(dllimport)\r\n#endif\t\t\t\t\t\t/* } */\r\n\r\n#else\t\t\t\t/* }{ */\r\n\r\n#define LUA_API\t\textern\r\n\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\n/* more often than not the libs go together with the core */\r\n#define LUALIB_API\tLUA_API\r\n#define LUAMOD_API\tLUALIB_API\r\n\r\n\r\n/*\r\n@@ LUAI_FUNC is a mark for all extern functions that are not to be\r\n@* exported to outside modules.\r\n@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables\r\n@* that are not to be exported to outside modules (LUAI_DDEF for\r\n@* definitions and LUAI_DDEC for declarations).\r\n** CHANGE them if you need to mark them in some special way. Elf/gcc\r\n** (versions 3.2 and later) mark them as \"hidden\" to optimize access\r\n** when Lua is compiled as a shared library. Not all elf targets support\r\n** this attribute. Unfortunately, gcc does not offer a way to check\r\n** whether the target offers that support, and those without support\r\n** give a warning about it. To avoid these warnings, change to the\r\n** default definition.\r\n*/\r\n#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \\\r\n    defined(__ELF__)\t\t/* { */\r\n#define LUAI_FUNC\t__attribute__((visibility(\"hidden\"))) extern\r\n#define LUAI_DDEC\tLUAI_FUNC\r\n#define LUAI_DDEF\t/* empty */\r\n\r\n#else\t\t\t\t/* }{ */\r\n#define LUAI_FUNC\textern\r\n#define LUAI_DDEC\textern\r\n#define LUAI_DDEF\t/* empty */\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\n\r\n/*\r\n@@ LUA_QL describes how error messages quote program elements.\r\n** CHANGE it if you want a different appearance.\r\n*/\r\n#define LUA_QL(x)\t\"'\" x \"'\"\r\n#define LUA_QS\t\tLUA_QL(\"%s\")\r\n\r\n\r\n/*\r\n@@ LUA_IDSIZE gives the maximum size for the description of the source\r\n@* of a function in debug information.\r\n** CHANGE it if you want a different size.\r\n*/\r\n#define LUA_IDSIZE\t60\r\n\r\n\r\n/*\r\n@@ luai_writestring/luai_writeline define how 'print' prints its results.\r\n** They are only used in libraries and the stand-alone program. (The #if\r\n** avoids including 'stdio.h' everywhere.)\r\n*/\r\n#if defined(LUA_LIB) || defined(lua_c)\r\n#include <stdio.h>\r\n#define luai_writestring(s,l)\tfwrite((s), sizeof(char), (l), stdout)\r\n#define luai_writeline()\t(luai_writestring(\"\\n\", 1), fflush(stdout))\r\n#endif\r\n\r\n/*\r\n@@ luai_writestringerror defines how to print error messages.\r\n** (A format string with one argument is enough for Lua...)\r\n*/\r\n#define luai_writestringerror(s,p) \\\r\n\t(fprintf(stderr, (s), (p)), fflush(stderr))\r\n\r\n\r\n\r\n\r\n\r\n/*\r\n** {==================================================================\r\n** Compatibility with previous versions\r\n** ===================================================================\r\n*/\r\n\r\n/*\r\n@@ LUA_COMPAT_ALL controls all compatibility options.\r\n** You can define it to get all options, or change specific options\r\n** to fit your specific needs.\r\n*/\r\n#if defined(LUA_COMPAT_ALL)\t/* { */\r\n\r\n/*\r\n@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.\r\n** You can replace it with 'table.unpack'.\r\n*/\r\n#define LUA_COMPAT_UNPACK\r\n\r\n/*\r\n@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.\r\n** You can replace it with 'package.searchers'.\r\n*/\r\n#define LUA_COMPAT_LOADERS\r\n\r\n/*\r\n@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.\r\n** You can call your C function directly (with light C functions).\r\n*/\r\n#define lua_cpcall(L,f,u)  \\\r\n\t(lua_pushcfunction(L, (f)), \\\r\n\t lua_pushlightuserdata(L,(u)), \\\r\n\t lua_pcall(L,1,0,0))\r\n\r\n\r\n/*\r\n@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.\r\n** You can rewrite 'log10(x)' as 'log(x, 10)'.\r\n*/\r\n#define LUA_COMPAT_LOG10\r\n\r\n/*\r\n@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base\r\n** library. You can rewrite 'loadstring(s)' as 'load(s)'.\r\n*/\r\n#define LUA_COMPAT_LOADSTRING\r\n\r\n/*\r\n@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.\r\n*/\r\n#define LUA_COMPAT_MAXN\r\n\r\n/*\r\n@@ The following macros supply trivial compatibility for some\r\n** changes in the API. The macros themselves document how to\r\n** change your code to avoid using them.\r\n*/\r\n#define lua_strlen(L,i)\t\tlua_rawlen(L, (i))\r\n\r\n#define lua_objlen(L,i)\t\tlua_rawlen(L, (i))\r\n\r\n#define lua_equal(L,idx1,idx2)\t\tlua_compare(L,(idx1),(idx2),LUA_OPEQ)\r\n#define lua_lessthan(L,idx1,idx2)\tlua_compare(L,(idx1),(idx2),LUA_OPLT)\r\n\r\n/*\r\n@@ LUA_COMPAT_MODULE controls compatibility with previous\r\n** module functions 'module' (Lua) and 'luaL_register' (C).\r\n*/\r\n#define LUA_COMPAT_MODULE\r\n\r\n#endif\t\t\t\t/* } */\r\n\r\n/* }================================================================== */\r\n\r\n\r\n\r\n/*\r\n@@ LUAI_BITSINT defines the number of bits in an int.\r\n** CHANGE here if Lua cannot automatically detect the number of bits of\r\n** your machine. Probably you do not need to change this.\r\n*/\r\n/* avoid overflows in comparison */\r\n#if INT_MAX-20 < 32760\t\t/* { */\r\n#define LUAI_BITSINT\t16\r\n#elif INT_MAX > 2147483640L\t/* }{ */\r\n/* int has at least 32 bits */\r\n#define LUAI_BITSINT\t32\r\n#else\t\t\t\t/* }{ */\r\n#error \"you must define LUA_BITSINT with number of bits in an integer\"\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\n/*\r\n@@ LUA_INT32 is an signed integer with exactly 32 bits.\r\n@@ LUAI_UMEM is an unsigned integer big enough to count the total\r\n@* memory used by Lua.\r\n@@ LUAI_MEM is a signed integer big enough to count the total memory\r\n@* used by Lua.\r\n** CHANGE here if for some weird reason the default definitions are not\r\n** good enough for your machine. Probably you do not need to change\r\n** this.\r\n*/\r\n#if LUAI_BITSINT >= 32\t\t/* { */\r\n#define LUA_INT32\tint\r\n#define LUAI_UMEM\tsize_t\r\n#define LUAI_MEM\tptrdiff_t\r\n#else\t\t\t\t/* }{ */\r\n/* 16-bit ints */\r\n#define LUA_INT32\tlong\r\n#define LUAI_UMEM\tunsigned long\r\n#define LUAI_MEM\tlong\r\n#endif\t\t\t\t/* } */\r\n\r\n\r\n/*\r\n@@ LUAI_MAXSTACK limits the size of the Lua stack.\r\n** CHANGE it if you need a different limit. This limit is arbitrary;\r\n** its only purpose is to stop Lua to consume unlimited stack\r\n** space (and to reserve some numbers for pseudo-indices).\r\n*/\r\n#if LUAI_BITSINT >= 32\r\n#define LUAI_MAXSTACK\t\t1000000\r\n#else\r\n#define LUAI_MAXSTACK\t\t15000\r\n#endif\r\n\r\n/* reserve some space for error handling */\r\n#define LUAI_FIRSTPSEUDOIDX\t(-LUAI_MAXSTACK - 1000)\r\n\r\n\r\n\r\n\r\n/*\r\n@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.\r\n** CHANGE it if it uses too much C-stack space.\r\n*/\r\n#define LUAL_BUFFERSIZE\t\tBUFSIZ\r\n\r\n\r\n\r\n\r\n/*\r\n** {==================================================================\r\n@@ LUA_NUMBER is the type of numbers in Lua.\r\n** CHANGE the following definitions only if you want to build Lua\r\n** with a number type different from double. You may also need to\r\n** change lua_number2int & lua_number2integer.\r\n** ===================================================================\r\n*/\r\n//#ifdef DEBUG_LUAEDIT\r\n// LuaEditによるデバッグに対応するため、デフォルトのdouble で扱う\r\n#define LUA_NUMBER_DOUBLE\r\n#define LUA_NUMBER\tdouble\r\n/*\r\n#else\r\n// 本来的にはこちらのfloatで扱いたい\r\n#define LUA_NUMBER\t\tfloat\r\n#endif\r\n*/\r\n\r\n/*\r\n@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'\r\n@* over a number.\r\n*/\r\n#define LUAI_UACNUMBER\tdouble\r\n\r\n\r\n/*\r\n@@ LUA_NUMBER_SCAN is the format for reading numbers.\r\n@@ LUA_NUMBER_FMT is the format for writing numbers.\r\n@@ lua_number2str converts a number to a string.\r\n@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.\r\n*/\r\n#define LUA_NUMBER_SCAN\t\t\"%lf\"\r\n#define LUA_NUMBER_FMT\t\t\"%.14g\"\r\n#define lua_number2str(s,n)\tsprintf((s), LUA_NUMBER_FMT, (n))\r\n#define LUAI_MAXNUMBER2STR\t32 /* 16 digits, sign, point, and \\0 */\r\n\r\n\r\n/*\r\n@@ lua_str2number converts a decimal numeric string to a number.\r\n@@ lua_strx2number converts an hexadecimal numeric string to a number.\r\n** In C99, 'strtod' do both conversions. C89, however, has no function\r\n** to convert floating hexadecimal strings to numbers. For these\r\n** systems, you can leave 'lua_strx2number' undefined and Lua will\r\n** provide its own implementation.\r\n*/\r\n#define lua_str2number(s,p)\tstrtod((s), (p))\r\n\r\n#if defined(LUA_USE_STRTODHEX)\r\n#define lua_strx2number(s,p)\tstrtod((s), (p))\r\n#endif\r\n\r\n\r\n/*\r\n@@ The luai_num* macros define the primitive operations over numbers.\r\n*/\r\n\r\n/* the following operations need the math library */\r\n#if defined(lobject_c) || defined(lvm_c)\r\n#include <math.h>\r\n#define luai_nummod(L,a,b)\t((a) - floor((a)/(b))*(b))\r\n#define luai_numpow(L,a,b)\t(pow(a,b))\r\n#endif\r\n\r\n/* these are quite standard operations */\r\n#if defined(LUA_CORE)\r\n#define luai_numadd(L,a,b)\t((a)+(b))\r\n#define luai_numsub(L,a,b)\t((a)-(b))\r\n#define luai_nummul(L,a,b)\t((a)*(b))\r\n#define luai_numdiv(L,a,b)\t((a)/(b))\r\n#define luai_numunm(L,a)\t(-(a))\r\n#define luai_numeq(a,b)\t\t((a)==(b))\r\n#define luai_numlt(L,a,b)\t((a)<(b))\r\n#define luai_numle(L,a,b)\t((a)<=(b))\r\n#define luai_numisnan(L,a)\t(!luai_numeq((a), (a)))\r\n#endif\r\n\r\n\r\n\r\n/*\r\n@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.\r\n** CHANGE that if ptrdiff_t is not adequate on your machine. (On most\r\n** machines, ptrdiff_t gives a good choice between int or long.)\r\n*/\r\n#define LUA_INTEGER\tptrdiff_t\r\n\r\n/*\r\n@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned.\r\n** It must have at least 32 bits.\r\n*/\r\n#define LUA_UNSIGNED\tunsigned LUA_INT32\r\n\r\n\r\n#if defined(LUA_CORE)\t\t/* { */\r\n\r\n#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI)\t/* { */\r\n\r\n/* On a Microsoft compiler on a Pentium, use assembler to avoid clashes\r\n   with a DirectX idiosyncrasy */\r\n#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86)\t/* { */\r\n\r\n#define MS_ASMTRICK\r\n\r\n#else\t\t\t\t/* }{ */\r\n/* the next definition uses a trick that should work on any machine\r\n   using IEEE754 with a 32-bit integer type */\r\n\r\n#define LUA_IEEE754TRICK\r\n\r\n/*\r\n@@ LUA_IEEEENDIAN is the endianness of doubles in your machine\r\n** (0 for little endian, 1 for big endian); if not defined, Lua will\r\n** check it dynamically.\r\n*/\r\n/* check for known architectures */\r\n#if defined(__i386__) || defined(__i386) || defined(__X86__) || \\\r\n    defined (__x86_64)\r\n#define LUA_IEEEENDIAN\t0\r\n#elif defined(__POWERPC__) || defined(__ppc__)\r\n#define LUA_IEEEENDIAN\t1\r\n#endif\r\n\r\n#endif\t\t\t\t/* } */\r\n\r\n#endif\t\t\t/* } */\r\n\r\n#endif\t\t\t/* } */\r\n\r\n/* }================================================================== */\r\n\r\n\r\n/*\r\n@@ LUA_NANTRICK_LE/LUA_NANTRICK_BE controls the use of a trick to\r\n** pack all types into a single double value, using NaN values to\r\n** represent non-number values. The trick only works on 32-bit machines\r\n** (ints and pointers are 32-bit values) with numbers represented as\r\n** IEEE 754-2008 doubles with conventional endianess (12345678 or\r\n** 87654321), in CPUs that do not produce signaling NaN values (all NaNs\r\n** are quiet).\r\n*/\r\n#if defined(LUA_CORE) && \\\r\n    defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI)\t/* { */\r\n\r\n/* little-endian architectures that satisfy those conditions */\r\n#if defined(__i386__) || defined(__i386) || defined(__X86__) || \\\r\n    defined(_M_IX86)\r\n\r\n#define LUA_NANTRICK_LE\r\n\r\n#endif\r\n\r\n#endif\t\t\t\t\t\t\t/* } */\r\n\r\n\r\n\r\n\r\n/* =================================================================== */\r\n\r\n/*\r\n** Local configuration. You can use this space to add your redefinitions\r\n** without modifying the main part of the file.\r\n*/\r\n\r\n\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lualib.h",
    "content": "/*\r\n** $Id: lualib.h,v 1.43 2011/12/08 12:11:37 roberto Exp $\r\n** Lua standard libraries\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#ifndef lualib_h\r\n#define lualib_h\r\n\r\n#include \"lua.h\"\r\n\r\n\r\n\r\nLUAMOD_API int (luaopen_base) (lua_State *L);\r\n\r\n#define LUA_COLIBNAME\t\"coroutine\"\r\nLUAMOD_API int (luaopen_coroutine) (lua_State *L);\r\n\r\n#define LUA_TABLIBNAME\t\"table\"\r\nLUAMOD_API int (luaopen_table) (lua_State *L);\r\n\r\n#define LUA_IOLIBNAME\t\"io\"\r\nLUAMOD_API int (luaopen_io) (lua_State *L);\r\n\r\n#define LUA_OSLIBNAME\t\"os\"\r\nLUAMOD_API int (luaopen_os) (lua_State *L);\r\n\r\n#define LUA_STRLIBNAME\t\"string\"\r\nLUAMOD_API int (luaopen_string) (lua_State *L);\r\n\r\n#define LUA_BITLIBNAME\t\"bit32\"\r\nLUAMOD_API int (luaopen_bit32) (lua_State *L);\r\n\r\n#define LUA_MATHLIBNAME\t\"math\"\r\nLUAMOD_API int (luaopen_math) (lua_State *L);\r\n\r\n#define LUA_DBLIBNAME\t\"debug\"\r\nLUAMOD_API int (luaopen_debug) (lua_State *L);\r\n\r\n#define LUA_LOADLIBNAME\t\"package\"\r\nLUAMOD_API int (luaopen_package) (lua_State *L);\r\n\r\n\r\n/* open all previous libraries */\r\nLUALIB_API void (luaL_openlibs) (lua_State *L);\r\n\r\n\r\n\r\n#if !defined(lua_assert)\r\n#define lua_assert(x)\t((void)0)\r\n#endif\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lundump.c",
    "content": "/*\r\n** $Id: lundump.c,v 1.71 2011/12/07 10:39:12 lhf Exp $\r\n** load precompiled Lua chunks\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#include <string.h>\r\n\r\n#define lundump_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lmem.h\"\r\n#include \"lobject.h\"\r\n#include \"lstring.h\"\r\n#include \"lundump.h\"\r\n#include \"lzio.h\"\r\n\r\ntypedef struct {\r\n lua_State* L;\r\n ZIO* Z;\r\n Mbuffer* b;\r\n const char* name;\r\n} LoadState;\r\n\r\nstatic void error(LoadState* S, const char* why)\r\n{\r\n luaO_pushfstring(S->L,\"%s: %s precompiled chunk\",S->name,why);\r\n luaD_throw(S->L,LUA_ERRSYNTAX);\r\n}\r\n\r\n#define LoadMem(S,b,n,size)\tLoadBlock(S,b,(n)*(size))\r\n#define LoadByte(S)\t\t(lu_byte)LoadChar(S)\r\n#define LoadVar(S,x)\t\tLoadMem(S,&x,1,sizeof(x))\r\n#define LoadVector(S,b,n,size)\tLoadMem(S,b,n,size)\r\n\r\n#if !defined(luai_verifycode)\r\n#define luai_verifycode(L,b,f)\t(f)\r\n#endif\r\n\r\nstatic void LoadBlock(LoadState* S, void* b, size_t size)\r\n{\r\n if (luaZ_read(S->Z,b,size)!=0) error(S,\"truncated\");\r\n}\r\n\r\nstatic int LoadChar(LoadState* S)\r\n{\r\n char x;\r\n LoadVar(S,x);\r\n return x;\r\n}\r\n\r\nstatic int LoadInt(LoadState* S)\r\n{\r\n int x;\r\n LoadVar(S,x);\r\n if (x<0) error(S,\"corrupted\");\r\n return x;\r\n}\r\n\r\nstatic lua_Number LoadNumber(LoadState* S)\r\n{\r\n lua_Number x;\r\n LoadVar(S,x);\r\n return x;\r\n}\r\n\r\nstatic TString* LoadString(LoadState* S)\r\n{\r\n size_t size;\r\n LoadVar(S,size);\r\n if (size==0)\r\n  return NULL;\r\n else\r\n {\r\n  char* s=luaZ_openspace(S->L,S->b,size);\r\n  LoadBlock(S,s,size*sizeof(char));\r\n  return luaS_newlstr(S->L,s,size-1);\t\t/* remove trailing '\\0' */\r\n }\r\n}\r\n\r\nstatic void LoadCode(LoadState* S, Proto* f)\r\n{\r\n int n=LoadInt(S);\r\n f->code=luaM_newvector(S->L,n,Instruction);\r\n f->sizecode=n;\r\n LoadVector(S,f->code,n,sizeof(Instruction));\r\n}\r\n\r\nstatic Proto* LoadFunction(LoadState* S);\r\n\r\nstatic void LoadConstants(LoadState* S, Proto* f)\r\n{\r\n int i,n;\r\n n=LoadInt(S);\r\n f->k=luaM_newvector(S->L,n,TValue);\r\n f->sizek=n;\r\n for (i=0; i<n; i++) setnilvalue(&f->k[i]);\r\n for (i=0; i<n; i++)\r\n {\r\n  TValue* o=&f->k[i];\r\n  int t=LoadChar(S);\r\n  switch (t)\r\n  {\r\n   case LUA_TNIL:\r\n\tsetnilvalue(o);\r\n\tbreak;\r\n   case LUA_TBOOLEAN:\r\n\tsetbvalue(o,LoadChar(S));\r\n\tbreak;\r\n   case LUA_TNUMBER:\r\n\tsetnvalue(o,LoadNumber(S));\r\n\tbreak;\r\n   case LUA_TSTRING:\r\n\tsetsvalue2n(S->L,o,LoadString(S));\r\n\tbreak;\r\n  }\r\n }\r\n n=LoadInt(S);\r\n f->p=luaM_newvector(S->L,n,Proto*);\r\n f->sizep=n;\r\n for (i=0; i<n; i++) f->p[i]=NULL;\r\n for (i=0; i<n; i++) f->p[i]=LoadFunction(S);\r\n}\r\n\r\nstatic void LoadUpvalues(LoadState* S, Proto* f)\r\n{\r\n int i,n;\r\n n=LoadInt(S);\r\n f->upvalues=luaM_newvector(S->L,n,Upvaldesc);\r\n f->sizeupvalues=n;\r\n for (i=0; i<n; i++) f->upvalues[i].name=NULL;\r\n for (i=0; i<n; i++)\r\n {\r\n  f->upvalues[i].instack=LoadByte(S);\r\n  f->upvalues[i].idx=LoadByte(S);\r\n }\r\n}\r\n\r\nstatic void LoadDebug(LoadState* S, Proto* f)\r\n{\r\n int i,n;\r\n f->source=LoadString(S);\r\n n=LoadInt(S);\r\n f->lineinfo=luaM_newvector(S->L,n,int);\r\n f->sizelineinfo=n;\r\n LoadVector(S,f->lineinfo,n,sizeof(int));\r\n n=LoadInt(S);\r\n f->locvars=luaM_newvector(S->L,n,LocVar);\r\n f->sizelocvars=n;\r\n for (i=0; i<n; i++) f->locvars[i].varname=NULL;\r\n for (i=0; i<n; i++)\r\n {\r\n  f->locvars[i].varname=LoadString(S);\r\n  f->locvars[i].startpc=LoadInt(S);\r\n  f->locvars[i].endpc=LoadInt(S);\r\n }\r\n n=LoadInt(S);\r\n for (i=0; i<n; i++) f->upvalues[i].name=LoadString(S);\r\n}\r\n\r\nstatic Proto* LoadFunction(LoadState* S)\r\n{\r\n Proto* f=luaF_newproto(S->L);\r\n setptvalue2s(S->L,S->L->top,f); incr_top(S->L);\r\n f->linedefined=LoadInt(S);\r\n f->lastlinedefined=LoadInt(S);\r\n f->numparams=LoadByte(S);\r\n f->is_vararg=LoadByte(S);\r\n f->maxstacksize=LoadByte(S);\r\n LoadCode(S,f);\r\n LoadConstants(S,f);\r\n LoadUpvalues(S,f);\r\n LoadDebug(S,f);\r\n S->L->top--;\r\n return f;\r\n}\r\n\r\n/* the code below must be consistent with the code in luaU_header */\r\n#define N0\tLUAC_HEADERSIZE\r\n#define N1\t(sizeof(LUA_SIGNATURE)-sizeof(char))\r\n#define N2\tN1+2\r\n#define N3\tN2+6\r\n\r\nstatic void LoadHeader(LoadState* S)\r\n{\r\n lu_byte h[LUAC_HEADERSIZE];\r\n lu_byte s[LUAC_HEADERSIZE];\r\n luaU_header(h);\r\n memcpy(s,h,sizeof(char));\t\t\t/* first char already read */\r\n LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char));\r\n if (memcmp(h,s,N0)==0) return;\r\n if (memcmp(h,s,N1)!=0) error(S,\"not a\");\r\n if (memcmp(h,s,N2)!=0) error(S,\"version mismatch in\");\r\n if (memcmp(h,s,N3)!=0) error(S,\"incompatible\"); else error(S,\"corrupted\");\r\n}\r\n\r\n/*\r\n** load precompiled chunk\r\n*/\r\nProto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)\r\n{\r\n LoadState S;\r\n if (*name=='@' || *name=='=')\r\n  S.name=name+1;\r\n else if (*name==LUA_SIGNATURE[0])\r\n  S.name=\"binary string\";\r\n else\r\n  S.name=name;\r\n S.L=L;\r\n S.Z=Z;\r\n S.b=buff;\r\n LoadHeader(&S);\r\n return luai_verifycode(L,buff,LoadFunction(&S));\r\n}\r\n\r\n#define MYINT(s)\t(s[0]-'0')\r\n#define VERSION\t\tMYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)\r\n#define FORMAT\t\t0\t\t/* this is the official format */\r\n\r\n/*\r\n* make header for precompiled chunks\r\n* if you change the code below be sure to update LoadHeader and FORMAT above\r\n* and LUAC_HEADERSIZE in lundump.h\r\n*/\r\nvoid luaU_header (lu_byte* h)\r\n{\r\n int x=1;\r\n memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-sizeof(char));\r\n h+=sizeof(LUA_SIGNATURE)-sizeof(char);\r\n *h++=cast_byte(VERSION);\r\n *h++=cast_byte(FORMAT);\r\n *h++=cast_byte(*(char*)&x);\t\t\t/* endianness */\r\n *h++=cast_byte(sizeof(int));\r\n *h++=cast_byte(sizeof(size_t));\r\n *h++=cast_byte(sizeof(Instruction));\r\n *h++=cast_byte(sizeof(lua_Number));\r\n *h++=cast_byte(((lua_Number)0.5)==0);\t\t/* is lua_Number integral? */\r\n memcpy(h,LUAC_TAIL,sizeof(LUAC_TAIL)-sizeof(char));\r\n}\r\n"
  },
  {
    "path": "Engine/libs/lua/lundump.h",
    "content": "/*\r\n** $Id: lundump.h,v 1.44 2011/05/06 13:35:17 lhf Exp $\r\n** load precompiled Lua chunks\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lundump_h\r\n#define lundump_h\r\n\r\n#include \"lobject.h\"\r\n#include \"lzio.h\"\r\n\r\n/* load one chunk; from lundump.c */\r\nLUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);\r\n\r\n/* make header; from lundump.c */\r\nLUAI_FUNC void luaU_header (lu_byte* h);\r\n\r\n/* dump one chunk; from ldump.c */\r\nLUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);\r\n\r\n/* data to catch conversion errors */\r\n#define LUAC_TAIL\t\t\"\\x19\\x93\\r\\n\\x1a\\n\"\r\n\r\n/* size in bytes of header of binary files */\r\n#define LUAC_HEADERSIZE\t\t(sizeof(LUA_SIGNATURE)-sizeof(char)+2+6+sizeof(LUAC_TAIL)-sizeof(char))\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lvm.c",
    "content": "/*\r\n** $Id: lvm.c,v 2.147 2011/12/07 14:43:55 roberto Exp $\r\n** Lua virtual machine\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#define lvm_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"ldebug.h\"\r\n#include \"ldo.h\"\r\n#include \"lfunc.h\"\r\n#include \"lgc.h\"\r\n#include \"lobject.h\"\r\n#include \"lopcodes.h\"\r\n#include \"lstate.h\"\r\n#include \"lstring.h\"\r\n#include \"ltable.h\"\r\n#include \"ltm.h\"\r\n#include \"lvm.h\"\r\n\r\n\r\n\r\n/* limit for table tag-method chains (to avoid loops) */\r\n#define MAXTAGLOOP\t100\r\n\r\n\r\nconst TValue *luaV_tonumber (const TValue *obj, TValue *n) {\r\n  lua_Number num;\r\n  if (ttisnumber(obj)) return obj;\r\n  if (ttisstring(obj) && luaO_str2d(svalue(obj), tsvalue(obj)->len, &num)) {\r\n    setnvalue(n, num);\r\n    return n;\r\n  }\r\n  else\r\n    return NULL;\r\n}\r\n\r\n\r\nint luaV_tostring (lua_State *L, StkId obj) {\r\n  if (!ttisnumber(obj))\r\n    return 0;\r\n  else {\r\n    char s[LUAI_MAXNUMBER2STR];\r\n    lua_Number n = nvalue(obj);\r\n    int l = lua_number2str(s, n);\r\n    setsvalue2s(L, obj, luaS_newlstr(L, s, l));\r\n    return 1;\r\n  }\r\n}\r\n\r\n\r\nstatic void traceexec (lua_State *L) {\r\n  CallInfo *ci = L->ci;\r\n  lu_byte mask = L->hookmask;\r\n  if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) {\r\n    resethookcount(L);\r\n    luaD_hook(L, LUA_HOOKCOUNT, -1);\r\n  }\r\n  if (mask & LUA_MASKLINE) {\r\n    Proto *p = ci_func(ci)->p;\r\n    int npc = pcRel(ci->u.l.savedpc, p);\r\n    int newline = getfuncline(p, npc);\r\n    if (npc == 0 ||  /* call linehook when enter a new function, */\r\n        ci->u.l.savedpc <= L->oldpc ||  /* when jump back (loop), or when */\r\n        newline != getfuncline(p, pcRel(L->oldpc, p)))  /* enter a new line */\r\n      luaD_hook(L, LUA_HOOKLINE, newline);\r\n  }\r\n  L->oldpc = ci->u.l.savedpc;\r\n  if (L->status == LUA_YIELD) {  /* did hook yield? */\r\n    ci->u.l.savedpc--;  /* undo increment (resume will increment it again) */\r\n    luaD_throw(L, LUA_YIELD);\r\n  }\r\n}\r\n\r\n\r\nstatic void callTM (lua_State *L, const TValue *f, const TValue *p1,\r\n                    const TValue *p2, TValue *p3, int hasres) {\r\n  ptrdiff_t result = savestack(L, p3);\r\n  setobj2s(L, L->top++, f);  /* push function */\r\n  setobj2s(L, L->top++, p1);  /* 1st argument */\r\n  setobj2s(L, L->top++, p2);  /* 2nd argument */\r\n  if (!hasres)  /* no result? 'p3' is third argument */\r\n    setobj2s(L, L->top++, p3);  /* 3rd argument */\r\n  luaD_checkstack(L, 0);\r\n  /* metamethod may yield only when called from Lua code */\r\n  luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci));\r\n  if (hasres) {  /* if has result, move it to its place */\r\n    p3 = restorestack(L, result);\r\n    setobjs2s(L, p3, --L->top);\r\n  }\r\n}\r\n\r\n\r\nvoid luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {\r\n  int loop;\r\n  for (loop = 0; loop < MAXTAGLOOP; loop++) {\r\n    const TValue *tm;\r\n    if (ttistable(t)) {  /* `t' is a table? */\r\n      Table *h = hvalue(t);\r\n      const TValue *res = luaH_get(h, key); /* do a primitive get */\r\n      if (!ttisnil(res) ||  /* result is not nil? */\r\n          (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */\r\n        setobj2s(L, val, res);\r\n        return;\r\n      }\r\n      /* else will try the tag method */\r\n    }\r\n    else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))\r\n      luaG_typeerror(L, t, \"index\");\r\n    if (ttisfunction(tm)) {\r\n      callTM(L, tm, t, key, val, 1);\r\n      return;\r\n    }\r\n    t = tm;  /* else repeat with 'tm' */\r\n  }\r\n  luaG_runerror(L, \"loop in gettable\");\r\n}\r\n\r\n\r\nvoid luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {\r\n  int loop;\r\n  for (loop = 0; loop < MAXTAGLOOP; loop++) {\r\n    const TValue *tm;\r\n    if (ttistable(t)) {  /* `t' is a table? */\r\n      Table *h = hvalue(t);\r\n      TValue *oldval = cast(TValue *, luaH_get(h, key));\r\n      /* if previous value is not nil, there must be a previous entry\r\n         in the table; moreover, a metamethod has no relevance */\r\n      if (!ttisnil(oldval) ||\r\n         /* previous value is nil; must check the metamethod */\r\n         ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL &&\r\n         /* no metamethod; is there a previous entry in the table? */\r\n         (oldval != luaO_nilobject ||\r\n         /* no previous entry; must create one. (The next test is\r\n            always true; we only need the assignment.) */\r\n         (oldval = luaH_newkey(L, h, key), 1)))) {\r\n        /* no metamethod and (now) there is an entry with given key */\r\n        setobj2t(L, oldval, val);  /* assign new value to that entry */\r\n        invalidateTMcache(h);\r\n        luaC_barrierback(L, obj2gco(h), val);\r\n        return;\r\n      }\r\n      /* else will try the metamethod */\r\n    }\r\n    else  /* not a table; check metamethod */\r\n      if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))\r\n        luaG_typeerror(L, t, \"index\");\r\n    /* there is a metamethod */\r\n    if (ttisfunction(tm)) {\r\n      callTM(L, tm, t, key, val, 0);\r\n      return;\r\n    }\r\n    t = tm;  /* else repeat with 'tm' */\r\n  }\r\n  luaG_runerror(L, \"loop in settable\");\r\n}\r\n\r\n\r\nstatic int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,\r\n                       StkId res, TMS event) {\r\n  const TValue *tm = luaT_gettmbyobj(L, p1, event);  /* try first operand */\r\n  if (ttisnil(tm))\r\n    tm = luaT_gettmbyobj(L, p2, event);  /* try second operand */\r\n  if (ttisnil(tm)) return 0;\r\n  callTM(L, tm, p1, p2, res, 1);\r\n  return 1;\r\n}\r\n\r\n\r\nstatic const TValue *get_equalTM (lua_State *L, Table *mt1, Table *mt2,\r\n                                  TMS event) {\r\n  const TValue *tm1 = fasttm(L, mt1, event);\r\n  const TValue *tm2;\r\n  if (tm1 == NULL) return NULL;  /* no metamethod */\r\n  if (mt1 == mt2) return tm1;  /* same metatables => same metamethods */\r\n  tm2 = fasttm(L, mt2, event);\r\n  if (tm2 == NULL) return NULL;  /* no metamethod */\r\n  if (luaV_rawequalobj(tm1, tm2))  /* same metamethods? */\r\n    return tm1;\r\n  return NULL;\r\n}\r\n\r\n\r\nstatic int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,\r\n                         TMS event) {\r\n  if (!call_binTM(L, p1, p2, L->top, event))\r\n    return -1;  /* no metamethod */\r\n  else\r\n    return !l_isfalse(L->top);\r\n}\r\n\r\n\r\nstatic int l_strcmp (const TString *ls, const TString *rs) {\r\n  const char *l = getstr(ls);\r\n  size_t ll = ls->tsv.len;\r\n  const char *r = getstr(rs);\r\n  size_t lr = rs->tsv.len;\r\n  for (;;) {\r\n    int temp = strcoll(l, r);\r\n    if (temp != 0) return temp;\r\n    else {  /* strings are equal up to a `\\0' */\r\n      size_t len = strlen(l);  /* index of first `\\0' in both strings */\r\n      if (len == lr)  /* r is finished? */\r\n        return (len == ll) ? 0 : 1;\r\n      else if (len == ll)  /* l is finished? */\r\n        return -1;  /* l is smaller than r (because r is not finished) */\r\n      /* both strings longer than `len'; go on comparing (after the `\\0') */\r\n      len++;\r\n      l += len; ll -= len; r += len; lr -= len;\r\n    }\r\n  }\r\n}\r\n\r\n\r\nint luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {\r\n  int res;\r\n  if (ttisnumber(l) && ttisnumber(r))\r\n    return luai_numlt(L, nvalue(l), nvalue(r));\r\n  else if (ttisstring(l) && ttisstring(r))\r\n    return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;\r\n  else if ((res = call_orderTM(L, l, r, TM_LT)) < 0)\r\n    luaG_ordererror(L, l, r);\r\n  return res;\r\n}\r\n\r\n\r\nint luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {\r\n  int res;\r\n  if (ttisnumber(l) && ttisnumber(r))\r\n    return luai_numle(L, nvalue(l), nvalue(r));\r\n  else if (ttisstring(l) && ttisstring(r))\r\n    return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;\r\n  else if ((res = call_orderTM(L, l, r, TM_LE)) >= 0)  /* first try `le' */\r\n    return res;\r\n  else if ((res = call_orderTM(L, r, l, TM_LT)) < 0)  /* else try `lt' */\r\n    luaG_ordererror(L, l, r);\r\n  return !res;\r\n}\r\n\r\n\r\n/*\r\n** equality of Lua values. L == NULL means raw equality (no metamethods)\r\n*/\r\nint luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {\r\n  const TValue *tm;\r\n  lua_assert(ttisequal(t1, t2));\r\n  switch (ttype(t1)) {\r\n    case LUA_TNIL: return 1;\r\n    case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));\r\n    case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2);  /* true must be 1 !! */\r\n    case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);\r\n    case LUA_TLCF: return fvalue(t1) == fvalue(t2);\r\n    case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2));\r\n    case LUA_TUSERDATA: {\r\n      if (uvalue(t1) == uvalue(t2)) return 1;\r\n      else if (L == NULL) return 0;\r\n      tm = get_equalTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ);\r\n      break;  /* will try TM */\r\n    }\r\n    case LUA_TTABLE: {\r\n      if (hvalue(t1) == hvalue(t2)) return 1;\r\n      else if (L == NULL) return 0;\r\n      tm = get_equalTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);\r\n      break;  /* will try TM */\r\n    }\r\n    default:\r\n      lua_assert(iscollectable(t1));\r\n      return gcvalue(t1) == gcvalue(t2);\r\n  }\r\n  if (tm == NULL) return 0;  /* no TM? */\r\n  callTM(L, tm, t1, t2, L->top, 1);  /* call TM */\r\n  return !l_isfalse(L->top);\r\n}\r\n\r\n\r\nvoid luaV_concat (lua_State *L, int total) {\r\n  lua_assert(total >= 2);\r\n  do {\r\n    StkId top = L->top;\r\n    int n = 2;  /* number of elements handled in this pass (at least 2) */\r\n    if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {\r\n      if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))\r\n        luaG_concaterror(L, top-2, top-1);\r\n    }\r\n    else if (tsvalue(top-1)->len == 0)  /* second operand is empty? */\r\n      (void)tostring(L, top - 2);  /* result is first operand */\r\n    else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) {\r\n      setsvalue2s(L, top-2, rawtsvalue(top-1));  /* result is second op. */\r\n    }\r\n    else {\r\n      /* at least two non-empty string values; get as many as possible */\r\n      size_t tl = tsvalue(top-1)->len;\r\n      char *buffer;\r\n      int i;\r\n      /* collect total length */\r\n      for (i = 1; i < total && tostring(L, top-i-1); i++) {\r\n        size_t l = tsvalue(top-i-1)->len;\r\n        if (l >= (MAX_SIZET/sizeof(char)) - tl)\r\n          luaG_runerror(L, \"string length overflow\");\r\n        tl += l;\r\n      }\r\n      buffer = luaZ_openspace(L, &G(L)->buff, tl);\r\n      tl = 0;\r\n      n = i;\r\n      do {  /* concat all strings */\r\n        size_t l = tsvalue(top-i)->len;\r\n        memcpy(buffer+tl, svalue(top-i), l * sizeof(char));\r\n        tl += l;\r\n      } while (--i > 0);\r\n      setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));\r\n    }\r\n    total -= n-1;  /* got 'n' strings to create 1 new */\r\n    L->top -= n-1;  /* popped 'n' strings and pushed one */\r\n  } while (total > 1);  /* repeat until only 1 result left */\r\n}\r\n\r\n\r\nvoid luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {\r\n  const TValue *tm;\r\n  switch (ttypenv(rb)) {\r\n    case LUA_TTABLE: {\r\n      Table *h = hvalue(rb);\r\n      tm = fasttm(L, h->metatable, TM_LEN);\r\n      if (tm) break;  /* metamethod? break switch to call it */\r\n      setnvalue(ra, cast_num(luaH_getn(h)));  /* else primitive len */\r\n      return;\r\n    }\r\n    case LUA_TSTRING: {\r\n      setnvalue(ra, cast_num(tsvalue(rb)->len));\r\n      return;\r\n    }\r\n    default: {  /* try metamethod */\r\n      tm = luaT_gettmbyobj(L, rb, TM_LEN);\r\n      if (ttisnil(tm))  /* no metamethod? */\r\n        luaG_typeerror(L, rb, \"get length of\");\r\n      break;\r\n    }\r\n  }\r\n  callTM(L, tm, rb, rb, ra, 1);\r\n}\r\n\r\n\r\nvoid luaV_arith (lua_State *L, StkId ra, const TValue *rb,\r\n                 const TValue *rc, TMS op) {\r\n  TValue tempb, tempc;\r\n  const TValue *b, *c;\r\n  if ((b = luaV_tonumber(rb, &tempb)) != NULL &&\r\n      (c = luaV_tonumber(rc, &tempc)) != NULL) {\r\n    lua_Number res = luaO_arith(op - TM_ADD + LUA_OPADD, nvalue(b), nvalue(c));\r\n    setnvalue(ra, res);\r\n  }\r\n  else if (!call_binTM(L, rb, rc, ra, op))\r\n    luaG_aritherror(L, rb, rc);\r\n}\r\n\r\n\r\n/*\r\n** check whether cached closure in prototype 'p' may be reused, that is,\r\n** whether there is a cached closure with the same upvalues needed by\r\n** new closure to be created.\r\n*/\r\nstatic Closure *getcached (Proto *p, UpVal **encup, StkId base) {\r\n  Closure *c = p->cache;\r\n  if (c != NULL) {  /* is there a cached closure? */\r\n    int nup = p->sizeupvalues;\r\n    Upvaldesc *uv = p->upvalues;\r\n    int i;\r\n    for (i = 0; i < nup; i++) {  /* check whether it has right upvalues */\r\n      TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v;\r\n      if (c->l.upvals[i]->v != v)\r\n        return NULL;  /* wrong upvalue; cannot reuse closure */\r\n    }\r\n  }\r\n  return c;  /* return cached closure (or NULL if no cached closure) */\r\n}\r\n\r\n\r\n/*\r\n** create a new Lua closure, push it in the stack, and initialize\r\n** its upvalues. Note that the call to 'luaC_barrierproto' must come\r\n** before the assignment to 'p->cache', as the function needs the\r\n** original value of that field.\r\n*/\r\nstatic void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base,\r\n                         StkId ra) {\r\n  int nup = p->sizeupvalues;\r\n  Upvaldesc *uv = p->upvalues;\r\n  int i;\r\n  Closure *ncl = luaF_newLclosure(L, p);\r\n  setclLvalue(L, ra, ncl);  /* anchor new closure in stack */\r\n  for (i = 0; i < nup; i++) {  /* fill in its upvalues */\r\n    if (uv[i].instack)  /* upvalue refers to local variable? */\r\n      ncl->l.upvals[i] = luaF_findupval(L, base + uv[i].idx);\r\n    else  /* get upvalue from enclosing function */\r\n      ncl->l.upvals[i] = encup[uv[i].idx];\r\n  }\r\n  luaC_barrierproto(L, p, ncl);\r\n  p->cache = ncl;  /* save it on cache for reuse */\r\n}\r\n\r\n\r\n/*\r\n** finish execution of an opcode interrupted by an yield\r\n*/\r\nvoid luaV_finishOp (lua_State *L) {\r\n  CallInfo *ci = L->ci;\r\n  StkId base = ci->u.l.base;\r\n  Instruction inst = *(ci->u.l.savedpc - 1);  /* interrupted instruction */\r\n  OpCode op = GET_OPCODE(inst);\r\n  switch (op) {  /* finish its execution */\r\n    case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:\r\n    case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN:\r\n    case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: {\r\n      setobjs2s(L, base + GETARG_A(inst), --L->top);\r\n      break;\r\n    }\r\n    case OP_LE: case OP_LT: case OP_EQ: {\r\n      int res = !l_isfalse(L->top - 1);\r\n      L->top--;\r\n      /* metamethod should not be called when operand is K */\r\n      lua_assert(!ISK(GETARG_B(inst)));\r\n      if (op == OP_LE &&  /* \"<=\" using \"<\" instead? */\r\n          ttisnil(luaT_gettmbyobj(L, base + GETARG_B(inst), TM_LE)))\r\n        res = !res;  /* invert result */\r\n      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);\r\n      if (res != GETARG_A(inst))  /* condition failed? */\r\n        ci->u.l.savedpc++;  /* skip jump instruction */\r\n      break;\r\n    }\r\n    case OP_CONCAT: {\r\n      StkId top = L->top - 1;  /* top when 'call_binTM' was called */\r\n      int b = GETARG_B(inst);      /* first element to concatenate */\r\n      int total = cast_int(top - 1 - (base + b));  /* yet to concatenate */\r\n      setobj2s(L, top - 2, top);  /* put TM result in proper position */\r\n      if (total > 1) {  /* are there elements to concat? */\r\n        L->top = top - 1;  /* top is one after last element (at top-2) */\r\n        luaV_concat(L, total);  /* concat them (may yield again) */\r\n      }\r\n      /* move final result to final position */\r\n      setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1);\r\n      L->top = ci->top;  /* restore top */\r\n      break;\r\n    }\r\n    case OP_TFORCALL: {\r\n      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP);\r\n      L->top = ci->top;  /* correct top */\r\n      break;\r\n    }\r\n    case OP_CALL: {\r\n      if (GETARG_C(inst) - 1 >= 0)  /* nresults >= 0? */\r\n        L->top = ci->top;  /* adjust results */\r\n      break;\r\n    }\r\n    case OP_TAILCALL: case OP_SETTABUP:  case OP_SETTABLE:\r\n      break;\r\n    default: lua_assert(0);\r\n  }\r\n}\r\n\r\n\r\n\r\n/*\r\n** some macros for common tasks in `luaV_execute'\r\n*/\r\n\r\n#if !defined luai_runtimecheck\r\n#define luai_runtimecheck(L, c)\t\t/* void */\r\n#endif\r\n\r\n\r\n#define RA(i)\t(base+GETARG_A(i))\r\n/* to be used after possible stack reallocation */\r\n#define RB(i)\tcheck_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))\r\n#define RC(i)\tcheck_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))\r\n#define RKB(i)\tcheck_exp(getBMode(GET_OPCODE(i)) == OpArgK, \\\r\n\tISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))\r\n#define RKC(i)\tcheck_exp(getCMode(GET_OPCODE(i)) == OpArgK, \\\r\n\tISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))\r\n#define KBx(i)  \\\r\n  (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++)))\r\n\r\n\r\n/* execute a jump instruction */\r\n#define dojump(ci,i,e) \\\r\n  { int a = GETARG_A(i); \\\r\n    if (a > 0) luaF_close(L, ci->u.l.base + a - 1); \\\r\n    ci->u.l.savedpc += GETARG_sBx(i) + e; }\r\n\r\n/* for test instructions, execute the jump instruction that follows it */\r\n#define donextjump(ci)\t{ i = *ci->u.l.savedpc; dojump(ci, i, 1); }\r\n\r\n\r\n#define Protect(x)\t{ {x;}; base = ci->u.l.base; }\r\n\r\n#define checkGC(L,c)\tProtect(luaC_condGC(L, c); luai_threadyield(L);)\r\n\r\n\r\n#define arith_op(op,tm) { \\\r\n        TValue *rb = RKB(i); \\\r\n        TValue *rc = RKC(i); \\\r\n        if (ttisnumber(rb) && ttisnumber(rc)) { \\\r\n          lua_Number nb = nvalue(rb), nc = nvalue(rc); \\\r\n          setnvalue(ra, op(L, nb, nc)); \\\r\n        } \\\r\n        else { Protect(luaV_arith(L, ra, rb, rc, tm)); } }\r\n\r\n\r\n#define vmdispatch(o)\tswitch(o)\r\n#define vmcase(l,b)\tcase l: {b}  break;\r\n#define vmcasenb(l,b)\tcase l: {b}\t\t/* nb = no break */\r\n\r\nvoid luaV_execute (lua_State *L) {\r\n  CallInfo *ci = L->ci;\r\n  LClosure *cl;\r\n  TValue *k;\r\n  StkId base;\r\n newframe:  /* reentry point when frame changes (call/return) */\r\n  lua_assert(ci == L->ci);\r\n  cl = clLvalue(ci->func);\r\n  k = cl->p->k;\r\n  base = ci->u.l.base;\r\n  /* main loop of interpreter */\r\n  for (;;) {\r\n    Instruction i = *(ci->u.l.savedpc++);\r\n    StkId ra;\r\n    if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&\r\n        (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {\r\n      Protect(traceexec(L));\r\n    }\r\n    /* WARNING: several calls may realloc the stack and invalidate `ra' */\r\n    ra = RA(i);\r\n    lua_assert(base == ci->u.l.base);\r\n    lua_assert(base <= L->top && L->top < L->stack + L->stacksize);\r\n    vmdispatch (GET_OPCODE(i)) {\r\n      vmcase(OP_MOVE,\r\n        setobjs2s(L, ra, RB(i));\r\n      )\r\n      vmcase(OP_LOADK,\r\n        TValue *rb = k + GETARG_Bx(i);\r\n        setobj2s(L, ra, rb);\r\n      )\r\n      vmcase(OP_LOADKX,\r\n        TValue *rb;\r\n        lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);\r\n        rb = k + GETARG_Ax(*ci->u.l.savedpc++);\r\n        setobj2s(L, ra, rb);\r\n      )\r\n      vmcase(OP_LOADBOOL,\r\n        setbvalue(ra, GETARG_B(i));\r\n        if (GETARG_C(i)) ci->u.l.savedpc++;  /* skip next instruction (if C) */\r\n      )\r\n      vmcase(OP_LOADNIL,\r\n        int b = GETARG_B(i);\r\n        do {\r\n          setnilvalue(ra++);\r\n        } while (b--);\r\n      )\r\n      vmcase(OP_GETUPVAL,\r\n        int b = GETARG_B(i);\r\n        setobj2s(L, ra, cl->upvals[b]->v);\r\n      )\r\n      vmcase(OP_GETTABUP,\r\n        int b = GETARG_B(i);\r\n        Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));\r\n      )\r\n      vmcase(OP_GETTABLE,\r\n        Protect(luaV_gettable(L, RB(i), RKC(i), ra));\r\n      )\r\n      vmcase(OP_SETTABUP,\r\n        int a = GETARG_A(i);\r\n        Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i)));\r\n      )\r\n      vmcase(OP_SETUPVAL,\r\n        UpVal *uv = cl->upvals[GETARG_B(i)];\r\n        setobj(L, uv->v, ra);\r\n        luaC_barrier(L, uv, ra);\r\n      )\r\n      vmcase(OP_SETTABLE,\r\n        Protect(luaV_settable(L, ra, RKB(i), RKC(i)));\r\n      )\r\n      vmcase(OP_NEWTABLE,\r\n        int b = GETARG_B(i);\r\n        int c = GETARG_C(i);\r\n        Table *t = luaH_new(L);\r\n        sethvalue(L, ra, t);\r\n        if (b != 0 || c != 0)\r\n          luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c));\r\n        checkGC(L,\r\n          L->top = ra + 1;  /* limit of live values */\r\n          luaC_step(L);\r\n          L->top = ci->top;  /* restore top */\r\n        )\r\n      )\r\n      vmcase(OP_SELF,\r\n        StkId rb = RB(i);\r\n        setobjs2s(L, ra+1, rb);\r\n        Protect(luaV_gettable(L, rb, RKC(i), ra));\r\n      )\r\n      vmcase(OP_ADD,\r\n        arith_op(luai_numadd, TM_ADD);\r\n      )\r\n      vmcase(OP_SUB,\r\n        arith_op(luai_numsub, TM_SUB);\r\n      )\r\n      vmcase(OP_MUL,\r\n        arith_op(luai_nummul, TM_MUL);\r\n      )\r\n      vmcase(OP_DIV,\r\n        arith_op(luai_numdiv, TM_DIV);\r\n      )\r\n      vmcase(OP_MOD,\r\n        arith_op(luai_nummod, TM_MOD);\r\n      )\r\n      vmcase(OP_POW,\r\n        arith_op(luai_numpow, TM_POW);\r\n      )\r\n      vmcase(OP_UNM,\r\n        TValue *rb = RB(i);\r\n        if (ttisnumber(rb)) {\r\n          lua_Number nb = nvalue(rb);\r\n          setnvalue(ra, luai_numunm(L, nb));\r\n        }\r\n        else {\r\n          Protect(luaV_arith(L, ra, rb, rb, TM_UNM));\r\n        }\r\n      )\r\n      vmcase(OP_NOT,\r\n        TValue *rb = RB(i);\r\n        int res = l_isfalse(rb);  /* next assignment may change this value */\r\n        setbvalue(ra, res);\r\n      )\r\n      vmcase(OP_LEN,\r\n        Protect(luaV_objlen(L, ra, RB(i)));\r\n      )\r\n      vmcase(OP_CONCAT,\r\n        int b = GETARG_B(i);\r\n        int c = GETARG_C(i);\r\n        StkId rb;\r\n        L->top = base + c + 1;  /* mark the end of concat operands */\r\n        Protect(luaV_concat(L, c - b + 1));\r\n        ra = RA(i);  /* 'luav_concat' may invoke TMs and move the stack */\r\n        rb = b + base;\r\n        setobjs2s(L, ra, rb);\r\n        checkGC(L,\r\n          L->top = (ra >= rb ? ra + 1 : rb);  /* limit of live values */\r\n          luaC_step(L);\r\n        )\r\n        L->top = ci->top;  /* restore top */\r\n      )\r\n      vmcase(OP_JMP,\r\n        dojump(ci, i, 0);\r\n      )\r\n      vmcase(OP_EQ,\r\n        TValue *rb = RKB(i);\r\n        TValue *rc = RKC(i);\r\n        Protect(\r\n          if (cast_int(equalobj(L, rb, rc)) != GETARG_A(i))\r\n            ci->u.l.savedpc++;\r\n          else\r\n            donextjump(ci);\r\n        )\r\n      )\r\n      vmcase(OP_LT,\r\n        Protect(\r\n          if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i))\r\n            ci->u.l.savedpc++;\r\n          else\r\n            donextjump(ci);\r\n        )\r\n      )\r\n      vmcase(OP_LE,\r\n        Protect(\r\n          if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i))\r\n            ci->u.l.savedpc++;\r\n          else\r\n            donextjump(ci);\r\n        )\r\n      )\r\n      vmcase(OP_TEST,\r\n        if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra))\r\n            ci->u.l.savedpc++;\r\n          else\r\n          donextjump(ci);\r\n      )\r\n      vmcase(OP_TESTSET,\r\n        TValue *rb = RB(i);\r\n        if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb))\r\n          ci->u.l.savedpc++;\r\n        else {\r\n          setobjs2s(L, ra, rb);\r\n          donextjump(ci);\r\n        }\r\n      )\r\n      vmcase(OP_CALL,\r\n        int b = GETARG_B(i);\r\n        int nresults = GETARG_C(i) - 1;\r\n        if (b != 0) L->top = ra+b;  /* else previous instruction set top */\r\n        if (luaD_precall(L, ra, nresults)) {  /* C function? */\r\n          if (nresults >= 0) L->top = ci->top;  /* adjust results */\r\n          base = ci->u.l.base;\r\n        }\r\n        else {  /* Lua function */\r\n          ci = L->ci;\r\n          ci->callstatus |= CIST_REENTRY;\r\n          goto newframe;  /* restart luaV_execute over new Lua function */\r\n        }\r\n      )\r\n      vmcase(OP_TAILCALL,\r\n        int b = GETARG_B(i);\r\n        if (b != 0) L->top = ra+b;  /* else previous instruction set top */\r\n        lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);\r\n        if (luaD_precall(L, ra, LUA_MULTRET))  /* C function? */\r\n          base = ci->u.l.base;\r\n        else {\r\n          /* tail call: put called frame (n) in place of caller one (o) */\r\n          CallInfo *nci = L->ci;  /* called frame */\r\n          CallInfo *oci = nci->previous;  /* caller frame */\r\n          StkId nfunc = nci->func;  /* called function */\r\n          StkId ofunc = oci->func;  /* caller function */\r\n          /* last stack slot filled by 'precall' */\r\n          StkId lim = nci->u.l.base + getproto(nfunc)->numparams;\r\n          int aux;\r\n          /* close all upvalues from previous call */\r\n          if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base);\r\n          /* move new frame into old one */\r\n          for (aux = 0; nfunc + aux < lim; aux++)\r\n            setobjs2s(L, ofunc + aux, nfunc + aux);\r\n          oci->u.l.base = ofunc + (nci->u.l.base - nfunc);  /* correct base */\r\n          oci->top = L->top = ofunc + (L->top - nfunc);  /* correct top */\r\n          oci->u.l.savedpc = nci->u.l.savedpc;\r\n          oci->callstatus |= CIST_TAIL;  /* function was tail called */\r\n          ci = L->ci = oci;  /* remove new frame */\r\n          lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize);\r\n          goto newframe;  /* restart luaV_execute over new Lua function */\r\n        }\r\n      )\r\n      vmcasenb(OP_RETURN,\r\n        int b = GETARG_B(i);\r\n        if (b != 0) L->top = ra+b-1;\r\n        if (cl->p->sizep > 0) luaF_close(L, base);\r\n        b = luaD_poscall(L, ra);\r\n        if (!(ci->callstatus & CIST_REENTRY))  /* 'ci' still the called one */\r\n          return;  /* external invocation: return */\r\n        else {  /* invocation via reentry: continue execution */\r\n          ci = L->ci;\r\n          if (b) L->top = ci->top;\r\n          lua_assert(isLua(ci));\r\n          lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL);\r\n          goto newframe;  /* restart luaV_execute over new Lua function */\r\n        }\r\n      )\r\n      vmcase(OP_FORLOOP,\r\n        lua_Number step = nvalue(ra+2);\r\n        lua_Number idx = luai_numadd(L, nvalue(ra), step); /* increment index */\r\n        lua_Number limit = nvalue(ra+1);\r\n        if (luai_numlt(L, 0, step) ? luai_numle(L, idx, limit)\r\n                                   : luai_numle(L, limit, idx)) {\r\n          ci->u.l.savedpc += GETARG_sBx(i);  /* jump back */\r\n          setnvalue(ra, idx);  /* update internal index... */\r\n          setnvalue(ra+3, idx);  /* ...and external index */\r\n        }\r\n      )\r\n      vmcase(OP_FORPREP,\r\n        const TValue *init = ra;\r\n        const TValue *plimit = ra+1;\r\n        const TValue *pstep = ra+2;\r\n        if (!tonumber(init, ra))\r\n          luaG_runerror(L, LUA_QL(\"for\") \" initial value must be a number\");\r\n        else if (!tonumber(plimit, ra+1))\r\n          luaG_runerror(L, LUA_QL(\"for\") \" limit must be a number\");\r\n        else if (!tonumber(pstep, ra+2))\r\n          luaG_runerror(L, LUA_QL(\"for\") \" step must be a number\");\r\n        setnvalue(ra, luai_numsub(L, nvalue(ra), nvalue(pstep)));\r\n        ci->u.l.savedpc += GETARG_sBx(i);\r\n      )\r\n      vmcasenb(OP_TFORCALL,\r\n        StkId cb = ra + 3;  /* call base */\r\n        setobjs2s(L, cb+2, ra+2);\r\n        setobjs2s(L, cb+1, ra+1);\r\n        setobjs2s(L, cb, ra);\r\n        L->top = cb + 3;  /* func. + 2 args (state and index) */\r\n        Protect(luaD_call(L, cb, GETARG_C(i), 1));\r\n        L->top = ci->top;\r\n        i = *(ci->u.l.savedpc++);  /* go to next instruction */\r\n        ra = RA(i);\r\n        lua_assert(GET_OPCODE(i) == OP_TFORLOOP);\r\n        goto l_tforloop;\r\n      )\r\n      vmcase(OP_TFORLOOP,\r\n        l_tforloop:\r\n        if (!ttisnil(ra + 1)) {  /* continue loop? */\r\n          setobjs2s(L, ra, ra + 1);  /* save control variable */\r\n           ci->u.l.savedpc += GETARG_sBx(i);  /* jump back */\r\n        }\r\n      )\r\n      vmcase(OP_SETLIST,\r\n        int n = GETARG_B(i);\r\n        int c = GETARG_C(i);\r\n        int last;\r\n        Table *h;\r\n        if (n == 0) n = cast_int(L->top - ra) - 1;\r\n        if (c == 0) {\r\n          lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);\r\n          c = GETARG_Ax(*ci->u.l.savedpc++);\r\n        }\r\n        luai_runtimecheck(L, ttistable(ra));\r\n        h = hvalue(ra);\r\n        last = ((c-1)*LFIELDS_PER_FLUSH) + n;\r\n        if (last > h->sizearray)  /* needs more space? */\r\n          luaH_resizearray(L, h, last);  /* pre-allocate it at once */\r\n        for (; n > 0; n--) {\r\n          TValue *val = ra+n;\r\n          luaH_setint(L, h, last--, val);\r\n          luaC_barrierback(L, obj2gco(h), val);\r\n        }\r\n        L->top = ci->top;  /* correct top (in case of previous open call) */\r\n      )\r\n      vmcase(OP_CLOSURE,\r\n        Proto *p = cl->p->p[GETARG_Bx(i)];\r\n        Closure *ncl = getcached(p, cl->upvals, base);  /* cached closure */\r\n        if (ncl == NULL)  /* no match? */\r\n          pushclosure(L, p, cl->upvals, base, ra);  /* create a new one */\r\n        else\r\n          setclLvalue(L, ra, ncl);  /* push cashed closure */\r\n        checkGC(L,\r\n          L->top = ra + 1;  /* limit of live values */\r\n          luaC_step(L);\r\n          L->top = ci->top;  /* restore top */\r\n        )\r\n      )\r\n      vmcase(OP_VARARG,\r\n        int b = GETARG_B(i) - 1;\r\n        int j;\r\n        int n = cast_int(base - ci->func) - cl->p->numparams - 1;\r\n        if (b < 0) {  /* B == 0? */\r\n          b = n;  /* get all var. arguments */\r\n          Protect(luaD_checkstack(L, n));\r\n          ra = RA(i);  /* previous call may change the stack */\r\n          L->top = ra + n;\r\n        }\r\n        for (j = 0; j < b; j++) {\r\n          if (j < n) {\r\n            setobjs2s(L, ra + j, base - n + j);\r\n          }\r\n          else {\r\n            setnilvalue(ra + j);\r\n          }\r\n        }\r\n      )\r\n      vmcase(OP_EXTRAARG,\r\n        lua_assert(0);\r\n      )\r\n    }\r\n  }\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lvm.h",
    "content": "/*\r\n** $Id: lvm.h,v 2.17 2011/05/31 18:27:56 roberto Exp $\r\n** Lua virtual machine\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n#ifndef lvm_h\r\n#define lvm_h\r\n\r\n\r\n#include \"ldo.h\"\r\n#include \"lobject.h\"\r\n#include \"ltm.h\"\r\n\r\n\r\n#define tostring(L,o) (ttisstring(o) || (luaV_tostring(L, o)))\r\n\r\n#define tonumber(o,n)\t(ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL))\r\n\r\n#define equalobj(L,o1,o2)  (ttisequal(o1, o2) && luaV_equalobj_(L, o1, o2))\r\n\r\n#define luaV_rawequalobj(t1,t2)  \\\r\n        (ttisequal(t1,t2) && luaV_equalobj_(NULL,t1,t2))\r\n\r\n\r\n/* not to called directly */\r\nLUAI_FUNC int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2);\r\n\r\n\r\nLUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);\r\nLUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r);\r\nLUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n);\r\nLUAI_FUNC int luaV_tostring (lua_State *L, StkId obj);\r\nLUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key,\r\n                                            StkId val);\r\nLUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key,\r\n                                            StkId val);\r\nLUAI_FUNC void luaV_finishOp (lua_State *L);\r\nLUAI_FUNC void luaV_execute (lua_State *L);\r\nLUAI_FUNC void luaV_concat (lua_State *L, int total);\r\nLUAI_FUNC void luaV_arith (lua_State *L, StkId ra, const TValue *rb,\r\n                           const TValue *rc, TMS op);\r\nLUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/lua/lzio.c",
    "content": "/*\r\n** $Id: lzio.c,v 1.34 2011/07/15 12:35:32 roberto Exp $\r\n** a generic input stream interface\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#include <string.h>\r\n\r\n#define lzio_c\r\n#define LUA_CORE\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"llimits.h\"\r\n#include \"lmem.h\"\r\n#include \"lstate.h\"\r\n#include \"lzio.h\"\r\n\r\n\r\nint luaZ_fill (ZIO *z) {\r\n  size_t size;\r\n  lua_State *L = z->L;\r\n  const char *buff;\r\n  lua_unlock(L);\r\n  buff = z->reader(L, z->data, &size);\r\n  lua_lock(L);\r\n  if (buff == NULL || size == 0)\r\n    return EOZ;\r\n  z->n = size - 1;  /* discount char being returned */\r\n  z->p = buff;\r\n  return cast_uchar(*(z->p++));\r\n}\r\n\r\n\r\nvoid luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {\r\n  z->L = L;\r\n  z->reader = reader;\r\n  z->data = data;\r\n  z->n = 0;\r\n  z->p = NULL;\r\n}\r\n\r\n\r\n/* --------------------------------------------------------------- read --- */\r\nsize_t luaZ_read (ZIO *z, void *b, size_t n) {\r\n  while (n) {\r\n    size_t m;\r\n    if (z->n == 0) {  /* no bytes in buffer? */\r\n      if (luaZ_fill(z) == EOZ)  /* try to read more */\r\n        return n;  /* no more input; return number of missing bytes */\r\n      else {\r\n        z->n++;  /* luaZ_fill consumed first byte; put it back */\r\n        z->p--;\r\n      }\r\n    }\r\n    m = (n <= z->n) ? n : z->n;  /* min. between n and z->n */\r\n    memcpy(b, z->p, m);\r\n    z->n -= m;\r\n    z->p += m;\r\n    b = (char *)b + m;\r\n    n -= m;\r\n  }\r\n  return 0;\r\n}\r\n\r\n/* ------------------------------------------------------------------------ */\r\nchar *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {\r\n  if (n > buff->buffsize) {\r\n    if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;\r\n    luaZ_resizebuffer(L, buff, n);\r\n  }\r\n  return buff->buffer;\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/lua/lzio.h",
    "content": "/*\r\n** $Id: lzio.h,v 1.26 2011/07/15 12:48:03 roberto Exp $\r\n** Buffered streams\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#ifndef lzio_h\r\n#define lzio_h\r\n\r\n#include \"lua.h\"\r\n\r\n#include \"lmem.h\"\r\n\r\n\r\n#define EOZ\t(-1)\t\t\t/* end of stream */\r\n\r\ntypedef struct Zio ZIO;\r\n\r\n#define zgetc(z)  (((z)->n--)>0 ?  cast_uchar(*(z)->p++) : luaZ_fill(z))\r\n\r\n\r\ntypedef struct Mbuffer {\r\n  char *buffer;\r\n  size_t n;\r\n  size_t buffsize;\r\n} Mbuffer;\r\n\r\n#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)\r\n\r\n#define luaZ_buffer(buff)\t((buff)->buffer)\r\n#define luaZ_sizebuffer(buff)\t((buff)->buffsize)\r\n#define luaZ_bufflen(buff)\t((buff)->n)\r\n\r\n#define luaZ_resetbuffer(buff) ((buff)->n = 0)\r\n\r\n\r\n#define luaZ_resizebuffer(L, buff, size) \\\r\n\t(luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \\\r\n\t(buff)->buffsize = size)\r\n\r\n#define luaZ_freebuffer(L, buff)\tluaZ_resizebuffer(L, buff, 0)\r\n\r\n\r\nLUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);\r\nLUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,\r\n                                        void *data);\r\nLUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n);\t/* read next n bytes */\r\n\r\n\r\n\r\n/* --------- Private Part ------------------ */\r\n\r\nstruct Zio {\r\n  size_t n;\t\t\t/* bytes still unread */\r\n  const char *p;\t\t/* current position in buffer */\r\n  lua_Reader reader;\t\t/* reader function */\r\n  void* data;\t\t\t/* additional data */\r\n  lua_State *L;\t\t\t/* Lua state (for reader) */\r\n};\r\n\r\n\r\nLUAI_FUNC int luaZ_fill (ZIO *z);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/minizip/crypt.h",
    "content": "/* crypt.h -- base code for crypt/uncrypt ZIPfile\r\n\r\n\r\n   Version 1.01e, February 12th, 2005\r\n\r\n   Copyright (C) 1998-2005 Gilles Vollant\r\n\r\n   This code is a modified version of crypting code in Infozip distribution\r\n\r\n   The encryption/decryption parts of this source code (as opposed to the\r\n   non-echoing password parts) were originally written in Europe.  The\r\n   whole source package can be freely distributed, including from the USA.\r\n   (Prior to January 2000, re-export from the US was a violation of US law.)\r\n\r\n   This encryption code is a direct transcription of the algorithm from\r\n   Roger Schlafly, described by Phil Katz in the file appnote.txt.  This\r\n   file (appnote.txt) is distributed with the PKZIP program (even in the\r\n   version without encryption capabilities).\r\n\r\n   If you don't need crypting in your application, just define symbols\r\n   NOCRYPT and NOUNCRYPT.\r\n\r\n   This code support the \"Traditional PKWARE Encryption\".\r\n\r\n   The new AES encryption added on Zip format by Winzip (see the page\r\n   http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong\r\n   Encryption is not supported.\r\n*/\r\n\r\n#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))\r\n\r\n/***********************************************************************\r\n * Return the next byte in the pseudo-random sequence\r\n */\r\nstatic int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)\r\n{\r\n    unsigned temp;  /* POTENTIAL BUG:  temp*(temp^1) may overflow in an\r\n                     * unpredictable manner on 16-bit systems; not a problem\r\n                     * with any known compiler so far, though */\r\n\r\n    temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;\r\n    return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);\r\n}\r\n\r\n/***********************************************************************\r\n * Update the encryption keys with the next byte of plain text\r\n */\r\nstatic int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)\r\n{\r\n    (*(pkeys+0)) = CRC32((*(pkeys+0)), c);\r\n    (*(pkeys+1)) += (*(pkeys+0)) & 0xff;\r\n    (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;\r\n    {\r\n      register int keyshift = (int)((*(pkeys+1)) >> 24);\r\n      (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);\r\n    }\r\n    return c;\r\n}\r\n\r\n\r\n/***********************************************************************\r\n * Initialize the encryption keys and the random header according to\r\n * the given password.\r\n */\r\nstatic void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)\r\n{\r\n    *(pkeys+0) = 305419896L;\r\n    *(pkeys+1) = 591751049L;\r\n    *(pkeys+2) = 878082192L;\r\n    while (*passwd != '\\0') {\r\n        update_keys(pkeys,pcrc_32_tab,(int)*passwd);\r\n        passwd++;\r\n    }\r\n}\r\n\r\n#define zdecode(pkeys,pcrc_32_tab,c) \\\r\n    (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))\r\n\r\n#define zencode(pkeys,pcrc_32_tab,c,t) \\\r\n    (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))\r\n\r\n#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED\r\n\r\n#define RAND_HEAD_LEN  12\r\n   /* \"last resort\" source for second part of crypt seed pattern */\r\n#  ifndef ZCR_SEED2\r\n#    define ZCR_SEED2 3141592654UL     /* use PI as default pattern */\r\n#  endif\r\n\r\nstatic int crypthead(const char* passwd,      /* password string */\r\n                     unsigned char* buf,      /* where to write header */\r\n                     int bufSize,\r\n                     unsigned long* pkeys,\r\n                     const unsigned long* pcrc_32_tab,\r\n                     unsigned long crcForCrypting)\r\n{\r\n    int n;                       /* index in random header */\r\n    int t;                       /* temporary */\r\n    int c;                       /* random byte */\r\n    unsigned char header[RAND_HEAD_LEN-2]; /* random header */\r\n    static unsigned calls = 0;   /* ensure different random header each time */\r\n\r\n    if (bufSize<RAND_HEAD_LEN)\r\n      return 0;\r\n\r\n    /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the\r\n     * output of rand() to get less predictability, since rand() is\r\n     * often poorly implemented.\r\n     */\r\n    if (++calls == 1)\r\n    {\r\n        srand((unsigned)(time(NULL) ^ ZCR_SEED2));\r\n    }\r\n    init_keys(passwd, pkeys, pcrc_32_tab);\r\n    for (n = 0; n < RAND_HEAD_LEN-2; n++)\r\n    {\r\n        c = (rand() >> 7) & 0xff;\r\n        header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);\r\n    }\r\n    /* Encrypt random header (last two bytes is high word of crc) */\r\n    init_keys(passwd, pkeys, pcrc_32_tab);\r\n    for (n = 0; n < RAND_HEAD_LEN-2; n++)\r\n    {\r\n        buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);\r\n    }\r\n    buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);\r\n    buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);\r\n    return n;\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/minizip/ioapi.c",
    "content": "/* ioapi.h -- IO base function header for compress/uncompress .zip\r\n   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Modifications for Zip64 support\r\n         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )\r\n\r\n         For more info read MiniZip_info.txt\r\n\r\n*/\r\n\r\n// Ignore Warnings\r\n// C4100 : 'identifier' : unreferenced formal parameter\r\n// C4131 : 'function' : uses old-style declarator\r\n#pragma warning( disable : 4100 )\r\n#pragma warning( disable : 4131 )\r\n\r\n#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))\r\n        #define _CRT_SECURE_NO_WARNINGS\r\n#endif\r\n\r\n#if defined(__APPLE__) || defined(IOAPI_NO_64)\r\n// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions\r\n#define FOPEN_FUNC(filename, mode) fopen(filename, mode)\r\n#define FTELLO_FUNC(stream) ftello(stream)\r\n#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)\r\n#else\r\n#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)\r\n#define FTELLO_FUNC(stream) ftello64(stream)\r\n#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)\r\n#endif\r\n\r\n\r\n#include \"ioapi.h\"\r\n\r\nvoidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)\r\n{\r\n    if (pfilefunc->zfile_func64.zopen64_file != NULL)\r\n        return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);\r\n    else\r\n    {\r\n        return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);\r\n    }\r\n}\r\n\r\nlong call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)\r\n{\r\n    if (pfilefunc->zfile_func64.zseek64_file != NULL)\r\n        return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);\r\n    else\r\n    {\r\n        uLong offsetTruncated = (uLong)offset;\r\n        if (offsetTruncated != offset)\r\n            return -1;\r\n        else\r\n            return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);\r\n    }\r\n}\r\n\r\nZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)\r\n{\r\n    if (pfilefunc->zfile_func64.zseek64_file != NULL)\r\n        return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);\r\n    else\r\n    {\r\n        uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);\r\n        if ((tell_uLong) == MAXU32)\r\n            return (ZPOS64_T)-1;\r\n        else\r\n            return tell_uLong;\r\n    }\r\n}\r\n\r\nvoid fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)\r\n{\r\n    p_filefunc64_32->zfile_func64.zopen64_file = NULL;\r\n    p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;\r\n    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;\r\n    p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;\r\n    p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;\r\n    p_filefunc64_32->zfile_func64.ztell64_file = NULL;\r\n    p_filefunc64_32->zfile_func64.zseek64_file = NULL;\r\n    p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;\r\n    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;\r\n    p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;\r\n    p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;\r\n    p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;\r\n}\r\n\r\n\r\n\r\nstatic voidpf  ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));\r\nstatic uLong   ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));\r\nstatic uLong   ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));\r\nstatic ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));\r\nstatic long    ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));\r\nstatic int     ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));\r\nstatic int     ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));\r\n\r\nstatic voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)\r\n{\r\n    FILE* file = NULL;\r\n    const char* mode_fopen = NULL;\r\n    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)\r\n        mode_fopen = \"rb\";\r\n    else\r\n    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)\r\n        mode_fopen = \"r+b\";\r\n    else\r\n    if (mode & ZLIB_FILEFUNC_MODE_CREATE)\r\n        mode_fopen = \"wb\";\r\n\r\n    if ((filename!=NULL) && (mode_fopen != NULL))\r\n        file = fopen(filename, mode_fopen);\r\n    return file;\r\n}\r\n\r\nstatic voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)\r\n{\r\n    FILE* file = NULL;\r\n    const char* mode_fopen = NULL;\r\n    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)\r\n        mode_fopen = \"rb\";\r\n    else\r\n    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)\r\n        mode_fopen = \"r+b\";\r\n    else\r\n    if (mode & ZLIB_FILEFUNC_MODE_CREATE)\r\n        mode_fopen = \"wb\";\r\n\r\n    if ((filename!=NULL) && (mode_fopen != NULL))\r\n        file = FOPEN_FUNC((const char*)filename, mode_fopen);\r\n    return file;\r\n}\r\n\r\n\r\nstatic uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)\r\n{\r\n    uLong ret;\r\n    ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);\r\n    return ret;\r\n}\r\n\r\nstatic uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)\r\n{\r\n    uLong ret;\r\n    ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);\r\n    return ret;\r\n}\r\n\r\nstatic long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)\r\n{\r\n    long ret;\r\n    ret = ftell((FILE *)stream);\r\n    return ret;\r\n}\r\n\r\n\r\nstatic ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)\r\n{\r\n    ZPOS64_T ret;\r\n    ret = FTELLO_FUNC((FILE *)stream);\r\n    return ret;\r\n}\r\n\r\nstatic long ZCALLBACK fseek_file_func (voidpf  opaque, voidpf stream, uLong offset, int origin)\r\n{\r\n    int fseek_origin=0;\r\n    long ret;\r\n    switch (origin)\r\n    {\r\n    case ZLIB_FILEFUNC_SEEK_CUR :\r\n        fseek_origin = SEEK_CUR;\r\n        break;\r\n    case ZLIB_FILEFUNC_SEEK_END :\r\n        fseek_origin = SEEK_END;\r\n        break;\r\n    case ZLIB_FILEFUNC_SEEK_SET :\r\n        fseek_origin = SEEK_SET;\r\n        break;\r\n    default: return -1;\r\n    }\r\n    ret = 0;\r\n    if (fseek((FILE *)stream, offset, fseek_origin) != 0)\r\n        ret = -1;\r\n    return ret;\r\n}\r\n\r\nstatic long ZCALLBACK fseek64_file_func (voidpf  opaque, voidpf stream, ZPOS64_T offset, int origin)\r\n{\r\n    int fseek_origin=0;\r\n    long ret;\r\n    switch (origin)\r\n    {\r\n    case ZLIB_FILEFUNC_SEEK_CUR :\r\n        fseek_origin = SEEK_CUR;\r\n        break;\r\n    case ZLIB_FILEFUNC_SEEK_END :\r\n        fseek_origin = SEEK_END;\r\n        break;\r\n    case ZLIB_FILEFUNC_SEEK_SET :\r\n        fseek_origin = SEEK_SET;\r\n        break;\r\n    default: return -1;\r\n    }\r\n    ret = 0;\r\n\r\n    if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)\r\n                        ret = -1;\r\n\r\n    return ret;\r\n}\r\n\r\n\r\nstatic int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)\r\n{\r\n    int ret;\r\n    ret = fclose((FILE *)stream);\r\n    return ret;\r\n}\r\n\r\nstatic int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)\r\n{\r\n    int ret;\r\n    ret = ferror((FILE *)stream);\r\n    return ret;\r\n}\r\n\r\nvoid fill_fopen_filefunc (pzlib_filefunc_def)\r\n  zlib_filefunc_def* pzlib_filefunc_def;\r\n{\r\n    pzlib_filefunc_def->zopen_file = fopen_file_func;\r\n    pzlib_filefunc_def->zread_file = fread_file_func;\r\n    pzlib_filefunc_def->zwrite_file = fwrite_file_func;\r\n    pzlib_filefunc_def->ztell_file = ftell_file_func;\r\n    pzlib_filefunc_def->zseek_file = fseek_file_func;\r\n    pzlib_filefunc_def->zclose_file = fclose_file_func;\r\n    pzlib_filefunc_def->zerror_file = ferror_file_func;\r\n    pzlib_filefunc_def->opaque = NULL;\r\n}\r\n\r\nvoid fill_fopen64_filefunc (zlib_filefunc64_def*  pzlib_filefunc_def)\r\n{\r\n    pzlib_filefunc_def->zopen64_file = fopen64_file_func;\r\n    pzlib_filefunc_def->zread_file = fread_file_func;\r\n    pzlib_filefunc_def->zwrite_file = fwrite_file_func;\r\n    pzlib_filefunc_def->ztell64_file = ftell64_file_func;\r\n    pzlib_filefunc_def->zseek64_file = fseek64_file_func;\r\n    pzlib_filefunc_def->zclose_file = fclose_file_func;\r\n    pzlib_filefunc_def->zerror_file = ferror_file_func;\r\n    pzlib_filefunc_def->opaque = NULL;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/minizip/ioapi.h",
    "content": "/* ioapi.h -- IO base function header for compress/uncompress .zip\r\n   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Modifications for Zip64 support\r\n         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )\r\n\r\n         For more info read MiniZip_info.txt\r\n\r\n         Changes\r\n\r\n    Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)\r\n    Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.\r\n               More if/def section may be needed to support other platforms\r\n    Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.\r\n                          (but you should use iowin32.c for windows instead)\r\n\r\n*/\r\n\r\n#ifndef _ZLIBIOAPI64_H\r\n#define _ZLIBIOAPI64_H\r\n\r\n#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))\r\n\r\n  // Linux needs this to support file operation on files larger then 4+GB\r\n  // But might need better if/def to select just the platforms that needs them.\r\n\r\n        #ifndef __USE_FILE_OFFSET64\r\n                #define __USE_FILE_OFFSET64\r\n        #endif\r\n        #ifndef __USE_LARGEFILE64\r\n                #define __USE_LARGEFILE64\r\n        #endif\r\n        #ifndef _LARGEFILE64_SOURCE\r\n                #define _LARGEFILE64_SOURCE\r\n        #endif\r\n        #ifndef _FILE_OFFSET_BIT\r\n                #define _FILE_OFFSET_BIT 64\r\n        #endif\r\n\r\n#endif\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include \"zlib.h\"\r\n\r\n#if defined(USE_FILE32API)\r\n#define fopen64 fopen\r\n#define ftello64 ftell\r\n#define fseeko64 fseek\r\n#else\r\n#ifdef __FreeBSD__\r\n#define fopen64 fopen\r\n#define ftello64 ftello\r\n#define fseeko64 fseeko\r\n#endif\r\n#ifdef _MSC_VER\r\n #define fopen64 fopen\r\n #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))\r\n  #define ftello64 _ftelli64\r\n  #define fseeko64 _fseeki64\r\n #else // old MSC\r\n  #define ftello64 ftell\r\n  #define fseeko64 fseek\r\n #endif\r\n#endif\r\n#endif\r\n\r\n/*\r\n#ifndef ZPOS64_T\r\n  #ifdef _WIN32\r\n                #define ZPOS64_T fpos_t\r\n  #else\r\n    #include <stdint.h>\r\n    #define ZPOS64_T uint64_t\r\n  #endif\r\n#endif\r\n*/\r\n\r\n#ifdef HAVE_MINIZIP64_CONF_H\r\n#include \"mz64conf.h\"\r\n#endif\r\n\r\n/* a type choosen by DEFINE */\r\n#ifdef HAVE_64BIT_INT_CUSTOM\r\ntypedef  64BIT_INT_CUSTOM_TYPE ZPOS64_T;\r\n#else\r\n#ifdef HAS_STDINT_H\r\n#include \"stdint.h\"\r\ntypedef uint64_t ZPOS64_T;\r\n#else\r\n\r\n/* Maximum unsigned 32-bit value used as placeholder for zip64 */\r\n#define MAXU32 0xffffffff\r\n\r\n#if defined(_MSC_VER) || defined(__BORLANDC__)\r\ntypedef unsigned __int64 ZPOS64_T;\r\n#else\r\ntypedef unsigned long long int ZPOS64_T;\r\n#endif\r\n#endif\r\n#endif\r\n\r\n\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\n#define ZLIB_FILEFUNC_SEEK_CUR (1)\r\n#define ZLIB_FILEFUNC_SEEK_END (2)\r\n#define ZLIB_FILEFUNC_SEEK_SET (0)\r\n\r\n#define ZLIB_FILEFUNC_MODE_READ      (1)\r\n#define ZLIB_FILEFUNC_MODE_WRITE     (2)\r\n#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)\r\n\r\n#define ZLIB_FILEFUNC_MODE_EXISTING (4)\r\n#define ZLIB_FILEFUNC_MODE_CREATE   (8)\r\n\r\n\r\n#ifndef ZCALLBACK\r\n #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)\r\n   #define ZCALLBACK CALLBACK\r\n #else\r\n   #define ZCALLBACK\r\n #endif\r\n#endif\r\n\r\n\r\n\r\n\r\ntypedef voidpf   (ZCALLBACK *open_file_func)      OF((voidpf opaque, const char* filename, int mode));\r\ntypedef uLong    (ZCALLBACK *read_file_func)      OF((voidpf opaque, voidpf stream, void* buf, uLong size));\r\ntypedef uLong    (ZCALLBACK *write_file_func)     OF((voidpf opaque, voidpf stream, const void* buf, uLong size));\r\ntypedef int      (ZCALLBACK *close_file_func)     OF((voidpf opaque, voidpf stream));\r\ntypedef int      (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));\r\n\r\ntypedef long     (ZCALLBACK *tell_file_func)      OF((voidpf opaque, voidpf stream));\r\ntypedef long     (ZCALLBACK *seek_file_func)      OF((voidpf opaque, voidpf stream, uLong offset, int origin));\r\n\r\n\r\n/* here is the \"old\" 32 bits structure structure */\r\ntypedef struct zlib_filefunc_def_s\r\n{\r\n    open_file_func      zopen_file;\r\n    read_file_func      zread_file;\r\n    write_file_func     zwrite_file;\r\n    tell_file_func      ztell_file;\r\n    seek_file_func      zseek_file;\r\n    close_file_func     zclose_file;\r\n    testerror_file_func zerror_file;\r\n    voidpf              opaque;\r\n} zlib_filefunc_def;\r\n\r\ntypedef ZPOS64_T (ZCALLBACK *tell64_file_func)    OF((voidpf opaque, voidpf stream));\r\ntypedef long     (ZCALLBACK *seek64_file_func)    OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));\r\ntypedef voidpf   (ZCALLBACK *open64_file_func)    OF((voidpf opaque, const void* filename, int mode));\r\n\r\ntypedef struct zlib_filefunc64_def_s\r\n{\r\n    open64_file_func    zopen64_file;\r\n    read_file_func      zread_file;\r\n    write_file_func     zwrite_file;\r\n    tell64_file_func    ztell64_file;\r\n    seek64_file_func    zseek64_file;\r\n    close_file_func     zclose_file;\r\n    testerror_file_func zerror_file;\r\n    voidpf              opaque;\r\n} zlib_filefunc64_def;\r\n\r\nvoid fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));\r\nvoid fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));\r\n\r\n/* now internal definition, only for zip.c and unzip.h */\r\ntypedef struct zlib_filefunc64_32_def_s\r\n{\r\n    zlib_filefunc64_def zfile_func64;\r\n    open_file_func      zopen32_file;\r\n    tell_file_func      ztell32_file;\r\n    seek_file_func      zseek32_file;\r\n} zlib_filefunc64_32_def;\r\n\r\n\r\n#define ZREAD64(filefunc,filestream,buf,size)     ((*((filefunc).zfile_func64.zread_file))   ((filefunc).zfile_func64.opaque,filestream,buf,size))\r\n#define ZWRITE64(filefunc,filestream,buf,size)    ((*((filefunc).zfile_func64.zwrite_file))  ((filefunc).zfile_func64.opaque,filestream,buf,size))\r\n//#define ZTELL64(filefunc,filestream)            ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))\r\n//#define ZSEEK64(filefunc,filestream,pos,mode)   ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))\r\n#define ZCLOSE64(filefunc,filestream)             ((*((filefunc).zfile_func64.zclose_file))  ((filefunc).zfile_func64.opaque,filestream))\r\n#define ZERROR64(filefunc,filestream)             ((*((filefunc).zfile_func64.zerror_file))  ((filefunc).zfile_func64.opaque,filestream))\r\n\r\nvoidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));\r\nlong    call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));\r\nZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));\r\n\r\nvoid    fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);\r\n\r\n#define ZOPEN64(filefunc,filename,mode)         (call_zopen64((&(filefunc)),(filename),(mode)))\r\n#define ZTELL64(filefunc,filestream)            (call_ztell64((&(filefunc)),(filestream)))\r\n#define ZSEEK64(filefunc,filestream,pos,mode)   (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/minizip/mztools.c",
    "content": "/*\r\n  Additional tools for Minizip\r\n  Code: Xavier Roche '2004\r\n  License: Same as ZLIB (www.gzip.org)\r\n*/\r\n\r\n\r\n// Ignore warnings\r\n// C4127 : conditional expression is constant\r\n// C4131 : 'function' : uses old-style declarator\r\n#pragma warning( disable : 4127 )\r\n#pragma warning( disable : 4131 )\r\n\r\n\r\n/* Code */\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include \"zlib.h\"\r\n#include \"unzip.h\"\r\n\r\n#define READ_8(adr)  ((unsigned char)*(adr))\r\n#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )\r\n#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )\r\n\r\n#define WRITE_8(buff, n) do { \\\r\n  *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \\\r\n} while(0)\r\n#define WRITE_16(buff, n) do { \\\r\n  WRITE_8((unsigned char*)(buff), n); \\\r\n  WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \\\r\n} while(0)\r\n#define WRITE_32(buff, n) do { \\\r\n  WRITE_16((unsigned char*)(buff), (n) & 0xffff); \\\r\n  WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \\\r\n} while(0)\r\n\r\nextern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)\r\nconst char* file;\r\nconst char* fileOut;\r\nconst char* fileOutTmp;\r\nuLong* nRecovered;\r\nuLong* bytesRecovered;\r\n{\r\n  int err = Z_OK;\r\n  FILE* fpZip = fopen(file, \"rb\");\r\n  FILE* fpOut = fopen(fileOut, \"wb\");\r\n  FILE* fpOutCD = fopen(fileOutTmp, \"wb\");\r\n  if (fpZip != NULL &&  fpOut != NULL) {\r\n    int entries = 0;\r\n    uLong totalBytes = 0;\r\n    char header[30];\r\n    char filename[1024];\r\n    char extra[1024];\r\n    int offset = 0;\r\n    int offsetCD = 0;\r\n    while ( fread(header, 1, 30, fpZip) == 30 ) {\r\n      int currentOffset = offset;\r\n\r\n      /* File entry */\r\n      if (READ_32(header) == 0x04034b50) {\r\n        unsigned int version = READ_16(header + 4);\r\n        unsigned int gpflag = READ_16(header + 6);\r\n        unsigned int method = READ_16(header + 8);\r\n        unsigned int filetime = READ_16(header + 10);\r\n        unsigned int filedate = READ_16(header + 12);\r\n        unsigned int crc = READ_32(header + 14); /* crc */\r\n        unsigned int cpsize = READ_32(header + 18); /* compressed size */\r\n        unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */\r\n        unsigned int fnsize = READ_16(header + 26); /* file name length */\r\n        unsigned int extsize = READ_16(header + 28); /* extra field length */\r\n        filename[0] = extra[0] = '\\0';\r\n\r\n        /* Header */\r\n        if (fwrite(header, 1, 30, fpOut) == 30) {\r\n          offset += 30;\r\n        } else {\r\n          err = Z_ERRNO;\r\n          break;\r\n        }\r\n\r\n        /* Filename */\r\n        if (fnsize > 0) {\r\n          if (fnsize < sizeof(filename)) {\r\n            if (fread(filename, 1, fnsize, fpZip) == fnsize) {\r\n                if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {\r\n                offset += fnsize;\r\n              } else {\r\n                err = Z_ERRNO;\r\n                break;\r\n              }\r\n            } else {\r\n              err = Z_ERRNO;\r\n              break;\r\n            }\r\n          } else {\r\n            err = Z_ERRNO;\r\n            break;\r\n          }\r\n        } else {\r\n          err = Z_STREAM_ERROR;\r\n          break;\r\n        }\r\n\r\n        /* Extra field */\r\n        if (extsize > 0) {\r\n          if (extsize < sizeof(extra)) {\r\n            if (fread(extra, 1, extsize, fpZip) == extsize) {\r\n              if (fwrite(extra, 1, extsize, fpOut) == extsize) {\r\n                offset += extsize;\r\n                } else {\r\n                err = Z_ERRNO;\r\n                break;\r\n              }\r\n            } else {\r\n              err = Z_ERRNO;\r\n              break;\r\n            }\r\n          } else {\r\n            err = Z_ERRNO;\r\n            break;\r\n          }\r\n        }\r\n\r\n        /* Data */\r\n        {\r\n          int dataSize = cpsize;\r\n          if (dataSize == 0) {\r\n            dataSize = uncpsize;\r\n          }\r\n          if (dataSize > 0) {\r\n            char* data = malloc(dataSize);\r\n            if (data != NULL) {\r\n              if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {\r\n                if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {\r\n                  offset += dataSize;\r\n                  totalBytes += dataSize;\r\n                } else {\r\n                  err = Z_ERRNO;\r\n                }\r\n              } else {\r\n                err = Z_ERRNO;\r\n              }\r\n              free(data);\r\n              if (err != Z_OK) {\r\n                break;\r\n              }\r\n            } else {\r\n              err = Z_MEM_ERROR;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n\r\n        /* Central directory entry */\r\n        {\r\n          char header[46];\r\n          char* comment = \"\";\r\n          int comsize = (int) strlen(comment);\r\n          WRITE_32(header, 0x02014b50);\r\n          WRITE_16(header + 4, version);\r\n          WRITE_16(header + 6, version);\r\n          WRITE_16(header + 8, gpflag);\r\n          WRITE_16(header + 10, method);\r\n          WRITE_16(header + 12, filetime);\r\n          WRITE_16(header + 14, filedate);\r\n          WRITE_32(header + 16, crc);\r\n          WRITE_32(header + 20, cpsize);\r\n          WRITE_32(header + 24, uncpsize);\r\n          WRITE_16(header + 28, fnsize);\r\n          WRITE_16(header + 30, extsize);\r\n          WRITE_16(header + 32, comsize);\r\n          WRITE_16(header + 34, 0);     /* disk # */\r\n          WRITE_16(header + 36, 0);     /* int attrb */\r\n          WRITE_32(header + 38, 0);     /* ext attrb */\r\n          WRITE_32(header + 42, currentOffset);\r\n          /* Header */\r\n          if (fwrite(header, 1, 46, fpOutCD) == 46) {\r\n            offsetCD += 46;\r\n\r\n            /* Filename */\r\n            if (fnsize > 0) {\r\n              if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {\r\n                offsetCD += fnsize;\r\n              } else {\r\n                err = Z_ERRNO;\r\n                break;\r\n              }\r\n            } else {\r\n              err = Z_STREAM_ERROR;\r\n              break;\r\n            }\r\n\r\n            /* Extra field */\r\n            if (extsize > 0) {\r\n              if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {\r\n                offsetCD += extsize;\r\n              } else {\r\n                err = Z_ERRNO;\r\n                break;\r\n              }\r\n            }\r\n\r\n            /* Comment field */\r\n            if (comsize > 0) {\r\n              if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {\r\n                offsetCD += comsize;\r\n              } else {\r\n                err = Z_ERRNO;\r\n                break;\r\n              }\r\n            }\r\n\r\n\r\n          } else {\r\n            err = Z_ERRNO;\r\n            break;\r\n          }\r\n        }\r\n\r\n        /* Success */\r\n        entries++;\r\n\r\n      } else {\r\n        break;\r\n      }\r\n    }\r\n\r\n    /* Final central directory  */\r\n    {\r\n      int entriesZip = entries;\r\n      char header[22];\r\n      char* comment = \"\"; // \"ZIP File recovered by zlib/minizip/mztools\";\r\n      int comsize = (int) strlen(comment);\r\n      if (entriesZip > 0xffff) {\r\n        entriesZip = 0xffff;\r\n      }\r\n      WRITE_32(header, 0x06054b50);\r\n      WRITE_16(header + 4, 0);    /* disk # */\r\n      WRITE_16(header + 6, 0);    /* disk # */\r\n      WRITE_16(header + 8, entriesZip);   /* hack */\r\n      WRITE_16(header + 10, entriesZip);  /* hack */\r\n      WRITE_32(header + 12, offsetCD);    /* size of CD */\r\n      WRITE_32(header + 16, offset);      /* offset to CD */\r\n      WRITE_16(header + 20, comsize);     /* comment */\r\n\r\n      /* Header */\r\n      if (fwrite(header, 1, 22, fpOutCD) == 22) {\r\n\r\n        /* Comment field */\r\n        if (comsize > 0) {\r\n          if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {\r\n            err = Z_ERRNO;\r\n          }\r\n        }\r\n\r\n      } else {\r\n        err = Z_ERRNO;\r\n      }\r\n    }\r\n\r\n    /* Final merge (file + central directory) */\r\n    fclose(fpOutCD);\r\n    if (err == Z_OK) {\r\n      fpOutCD = fopen(fileOutTmp, \"rb\");\r\n      if (fpOutCD != NULL) {\r\n        int nRead;\r\n        char buffer[8192];\r\n        while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {\r\n          if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {\r\n            err = Z_ERRNO;\r\n            break;\r\n          }\r\n        }\r\n        fclose(fpOutCD);\r\n      }\r\n    }\r\n\r\n    /* Close */\r\n    fclose(fpZip);\r\n    fclose(fpOut);\r\n\r\n    /* Wipe temporary file */\r\n    (void)remove(fileOutTmp);\r\n\r\n    /* Number of recovered entries */\r\n    if (err == Z_OK) {\r\n      if (nRecovered != NULL) {\r\n        *nRecovered = entries;\r\n      }\r\n      if (bytesRecovered != NULL) {\r\n        *bytesRecovered = totalBytes;\r\n      }\r\n    }\r\n  } else {\r\n    err = Z_STREAM_ERROR;\r\n  }\r\n  return err;\r\n}\r\n"
  },
  {
    "path": "Engine/libs/minizip/mztools.h",
    "content": "/*\r\n  Additional tools for Minizip\r\n  Code: Xavier Roche '2004\r\n  License: Same as ZLIB (www.gzip.org)\r\n*/\r\n\r\n#ifndef _zip_tools_H\r\n#define _zip_tools_H\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifndef _ZLIB_H\r\n#include \"zlib.h\"\r\n#endif\r\n\r\n#include \"unzip.h\"\r\n\r\n/* Repair a ZIP file (missing central directory)\r\n   file: file to recover\r\n   fileOut: output file after recovery\r\n   fileOutTmp: temporary file name used for recovery\r\n*/\r\nextern int ZEXPORT unzRepair(const char* file,\r\n                             const char* fileOut,\r\n                             const char* fileOutTmp,\r\n                             uLong* nRecovered,\r\n                             uLong* bytesRecovered);\r\n\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/minizip/unzip.c",
    "content": "/* unzip.c -- IO for uncompress .zip files using zlib\r\n   Version 1.1, February 14h, 2010\r\n   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Modifications of Unzip for Zip64\r\n         Copyright (C) 2007-2008 Even Rouault\r\n\r\n         Modifications for Zip64 support on both zip and unzip\r\n         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )\r\n\r\n         For more info read MiniZip_info.txt\r\n\r\n\r\n  ------------------------------------------------------------------------------------\r\n  Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of\r\n  compatibility with older software. The following is from the original crypt.c.\r\n  Code woven in by Terry Thorsen 1/2003.\r\n\r\n  Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.\r\n\r\n  See the accompanying file LICENSE, version 2000-Apr-09 or later\r\n  (the contents of which are also included in zip.h) for terms of use.\r\n  If, for some reason, all these files are missing, the Info-ZIP license\r\n  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html\r\n\r\n        crypt.c (full version) by Info-ZIP.      Last revised:  [see crypt.h]\r\n\r\n  The encryption/decryption parts of this source code (as opposed to the\r\n  non-echoing password parts) were originally written in Europe.  The\r\n  whole source package can be freely distributed, including from the USA.\r\n  (Prior to January 2000, re-export from the US was a violation of US law.)\r\n\r\n        This encryption code is a direct transcription of the algorithm from\r\n  Roger Schlafly, described by Phil Katz in the file appnote.txt.  This\r\n  file (appnote.txt) is distributed with the PKZIP program (even in the\r\n  version without encryption capabilities).\r\n\r\n        ------------------------------------------------------------------------------------\r\n\r\n        Changes in unzip.c\r\n\r\n        2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos\r\n  2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz*\r\n  2007-2008 - Even Rouault - Remove old C style function prototypes\r\n  2007-2008 - Even Rouault - Add unzip support for ZIP64\r\n\r\n        Copyright (C) 2007-2008 Even Rouault\r\n\r\n\r\n        Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).\r\n  Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G\r\n                                should only read the compressed/uncompressed size from the Zip64 format if\r\n                                the size from normal header was 0xFFFFFFFF\r\n  Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant\r\n        Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)\r\n                                Patch created by Daniel Borca\r\n\r\n  Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer\r\n\r\n  Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson\r\n\r\n*/\r\n\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#ifndef NOUNCRYPT\r\n        #define NOUNCRYPT\r\n#endif\r\n\r\n#include \"zlib.h\"\r\n#include \"unzip.h\"\r\n\r\n#ifdef STDC\r\n#  include <stddef.h>\r\n#  include <string.h>\r\n#  include <stdlib.h>\r\n#endif\r\n#ifdef NO_ERRNO_H\r\n    extern int errno;\r\n#else\r\n#   include <errno.h>\r\n#endif\r\n\r\n\r\n#ifndef local\r\n#  define local static\r\n#endif\r\n/* compile with -Dlocal if your debugger can't find static symbols */\r\n\r\n\r\n#ifndef CASESENSITIVITYDEFAULT_NO\r\n#  if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)\r\n#    define CASESENSITIVITYDEFAULT_NO\r\n#  endif\r\n#endif\r\n\r\n\r\n#ifndef UNZ_BUFSIZE\r\n#define UNZ_BUFSIZE (16384)\r\n#endif\r\n\r\n#ifndef UNZ_MAXFILENAMEINZIP\r\n#define UNZ_MAXFILENAMEINZIP (256)\r\n#endif\r\n\r\n#ifndef ALLOC\r\n# define ALLOC(size) (malloc(size))\r\n#endif\r\n#ifndef TRYFREE\r\n# define TRYFREE(p) {if (p) free(p);}\r\n#endif\r\n\r\n#define SIZECENTRALDIRITEM (0x2e)\r\n#define SIZEZIPLOCALHEADER (0x1e)\r\n\r\n\r\nconst char unz_copyright[] =\r\n   \" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll\";\r\n\r\n/* unz_file_info_interntal contain internal info about a file in zipfile*/\r\ntypedef struct unz_file_info64_internal_s\r\n{\r\n    ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */\r\n} unz_file_info64_internal;\r\n\r\n\r\n/* file_in_zip_read_info_s contain internal information about a file in zipfile,\r\n    when reading and decompress it */\r\ntypedef struct\r\n{\r\n    char  *read_buffer;         /* internal buffer for compressed data */\r\n    z_stream stream;            /* zLib stream structure for inflate */\r\n\r\n#ifdef HAVE_BZIP2\r\n    bz_stream bstream;          /* bzLib stream structure for bziped */\r\n#endif\r\n\r\n    ZPOS64_T pos_in_zipfile;       /* position in byte on the zipfile, for fseek*/\r\n    uLong stream_initialised;   /* flag set if stream structure is initialised*/\r\n\r\n    ZPOS64_T offset_local_extrafield;/* offset of the local extra field */\r\n    uInt  size_local_extrafield;/* size of the local extra field */\r\n    ZPOS64_T pos_local_extrafield;   /* position in the local extra field in read*/\r\n    ZPOS64_T total_out_64;\r\n\r\n    uLong crc32;                /* crc32 of all data uncompressed */\r\n    uLong crc32_wait;           /* crc32 we must obtain after decompress all */\r\n    ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */\r\n    ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/\r\n    zlib_filefunc64_32_def z_filefunc;\r\n    voidpf filestream;        /* io structore of the zipfile */\r\n    uLong compression_method;   /* compression method (0==store) */\r\n    ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/\r\n    int   raw;\r\n} file_in_zip64_read_info_s;\r\n\r\n\r\n/* unz64_s contain internal information about the zipfile\r\n*/\r\ntypedef struct\r\n{\r\n    zlib_filefunc64_32_def z_filefunc;\r\n    int is64bitOpenFunction;\r\n    voidpf filestream;        /* io structore of the zipfile */\r\n    unz_global_info64 gi;       /* public global information */\r\n    ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/\r\n    ZPOS64_T num_file;             /* number of the current file in the zipfile*/\r\n    ZPOS64_T pos_in_central_dir;   /* pos of the current file in the central dir*/\r\n    ZPOS64_T current_file_ok;      /* flag about the usability of the current file*/\r\n    ZPOS64_T central_pos;          /* position of the beginning of the central dir*/\r\n\r\n    ZPOS64_T size_central_dir;     /* size of the central directory  */\r\n    ZPOS64_T offset_central_dir;   /* offset of start of central directory with\r\n                                   respect to the starting disk number */\r\n\r\n    unz_file_info64 cur_file_info; /* public info about the current file in zip*/\r\n    unz_file_info64_internal cur_file_info_internal; /* private info about it*/\r\n    file_in_zip64_read_info_s* pfile_in_zip_read; /* structure about the current\r\n                                        file if we are decompressing it */\r\n    int encrypted;\r\n\r\n    int isZip64;\r\n\r\n#    ifndef NOUNCRYPT\r\n    unsigned long keys[3];     /* keys defining the pseudo-random sequence */\r\n    const unsigned long* pcrc_32_tab;\r\n#    endif\r\n} unz64_s;\r\n\r\n\r\n#ifndef NOUNCRYPT\r\n#include \"crypt.h\"\r\n#endif\r\n\r\n/* ===========================================================================\r\n     Read a byte from a gz_stream; update next_in and avail_in. Return EOF\r\n   for end of file.\r\n   IN assertion: the stream s has been sucessfully opened for reading.\r\n*/\r\n\r\n\r\nlocal int unz64local_getByte OF((\r\n    const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n    voidpf filestream,\r\n    int *pi));\r\n\r\nlocal int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)\r\n{\r\n    unsigned char c;\r\n    int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);\r\n    if (err==1)\r\n    {\r\n        *pi = (int)c;\r\n        return UNZ_OK;\r\n    }\r\n    else\r\n    {\r\n        if (ZERROR64(*pzlib_filefunc_def,filestream))\r\n            return UNZ_ERRNO;\r\n        else\r\n            return UNZ_EOF;\r\n    }\r\n}\r\n\r\n\r\n/* ===========================================================================\r\n   Reads a long in LSB order from the given gz_stream. Sets\r\n*/\r\nlocal int unz64local_getShort OF((\r\n    const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n    voidpf filestream,\r\n    uLong *pX));\r\n\r\nlocal int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n                             voidpf filestream,\r\n                             uLong *pX)\r\n{\r\n    uLong x ;\r\n    int i = 0;\r\n    int err;\r\n\r\n    err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x = (uLong)i;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((uLong)i)<<8;\r\n\r\n    if (err==UNZ_OK)\r\n        *pX = x;\r\n    else\r\n        *pX = 0;\r\n    return err;\r\n}\r\n\r\nlocal int unz64local_getLong OF((\r\n    const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n    voidpf filestream,\r\n    uLong *pX));\r\n\r\nlocal int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n                            voidpf filestream,\r\n                            uLong *pX)\r\n{\r\n    uLong x ;\r\n    int i = 0;\r\n    int err;\r\n\r\n    err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x = (uLong)i;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((uLong)i)<<8;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((uLong)i)<<16;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x += ((uLong)i)<<24;\r\n\r\n    if (err==UNZ_OK)\r\n        *pX = x;\r\n    else\r\n        *pX = 0;\r\n    return err;\r\n}\r\n\r\nlocal int unz64local_getLong64 OF((\r\n    const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n    voidpf filestream,\r\n    ZPOS64_T *pX));\r\n\r\n\r\nlocal int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n                            voidpf filestream,\r\n                            ZPOS64_T *pX)\r\n{\r\n    ZPOS64_T x ;\r\n    int i = 0;\r\n    int err;\r\n\r\n    err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x = (ZPOS64_T)i;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<8;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<16;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<24;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<32;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<40;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<48;\r\n\r\n    if (err==UNZ_OK)\r\n        err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);\r\n    x |= ((ZPOS64_T)i)<<56;\r\n\r\n    if (err==UNZ_OK)\r\n        *pX = x;\r\n    else\r\n        *pX = 0;\r\n    return err;\r\n}\r\n\r\n/* My own strcmpi / strcasecmp */\r\nlocal int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)\r\n{\r\n    for (;;)\r\n    {\r\n        char c1=*(fileName1++);\r\n        char c2=*(fileName2++);\r\n        if ((c1>='a') && (c1<='z'))\r\n            c1 -= 0x20;\r\n        if ((c2>='a') && (c2<='z'))\r\n            c2 -= 0x20;\r\n        if (c1=='\\0')\r\n            return ((c2=='\\0') ? 0 : -1);\r\n        if (c2=='\\0')\r\n            return 1;\r\n        if (c1<c2)\r\n            return -1;\r\n        if (c1>c2)\r\n            return 1;\r\n    }\r\n}\r\n\r\n\r\n#ifdef  CASESENSITIVITYDEFAULT_NO\r\n#define CASESENSITIVITYDEFAULTVALUE 2\r\n#else\r\n#define CASESENSITIVITYDEFAULTVALUE 1\r\n#endif\r\n\r\n#ifndef STRCMPCASENOSENTIVEFUNCTION\r\n#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal\r\n#endif\r\n\r\n/*\r\n   Compare two filename (fileName1,fileName2).\r\n   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)\r\n   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi\r\n                                                                or strcasecmp)\r\n   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system\r\n        (like 1 on Unix, 2 on Windows)\r\n\r\n*/\r\nextern int ZEXPORT unzStringFileNameCompare (const char*  fileName1,\r\n                                                 const char*  fileName2,\r\n                                                 int iCaseSensitivity)\r\n\r\n{\r\n    if (iCaseSensitivity==0)\r\n        iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;\r\n\r\n    if (iCaseSensitivity==1)\r\n        return strcmp(fileName1,fileName2);\r\n\r\n    return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);\r\n}\r\n\r\n#ifndef BUFREADCOMMENT\r\n#define BUFREADCOMMENT (0x400)\r\n#endif\r\n\r\n/*\r\n  Locate the Central directory of a zipfile (at the end, just before\r\n    the global comment)\r\n*/\r\nlocal ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));\r\nlocal ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)\r\n{\r\n    unsigned char* buf;\r\n    ZPOS64_T uSizeFile;\r\n    ZPOS64_T uBackRead;\r\n    ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */\r\n    ZPOS64_T uPosFound=0;\r\n\r\n    if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)\r\n        return 0;\r\n\r\n\r\n    uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);\r\n\r\n    if (uMaxBack>uSizeFile)\r\n        uMaxBack = uSizeFile;\r\n\r\n    buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);\r\n    if (buf==NULL)\r\n        return 0;\r\n\r\n    uBackRead = 4;\r\n    while (uBackRead<uMaxBack)\r\n    {\r\n        uLong uReadSize;\r\n        ZPOS64_T uReadPos ;\r\n        int i;\r\n        if (uBackRead+BUFREADCOMMENT>uMaxBack)\r\n            uBackRead = uMaxBack;\r\n        else\r\n            uBackRead+=BUFREADCOMMENT;\r\n        uReadPos = uSizeFile-uBackRead ;\r\n\r\n        uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?\r\n                     (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);\r\n        if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n            break;\r\n\r\n        if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)\r\n            break;\r\n\r\n        for (i=(int)uReadSize-3; (i--)>0;)\r\n            if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&\r\n                ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))\r\n            {\r\n                uPosFound = uReadPos+i;\r\n                break;\r\n            }\r\n\r\n        if (uPosFound!=0)\r\n            break;\r\n    }\r\n    TRYFREE(buf);\r\n    return uPosFound;\r\n}\r\n\r\n\r\n/*\r\n  Locate the Central directory 64 of a zipfile (at the end, just before\r\n    the global comment)\r\n*/\r\nlocal ZPOS64_T unz64local_SearchCentralDir64 OF((\r\n    const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n    voidpf filestream));\r\n\r\nlocal ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,\r\n                                      voidpf filestream)\r\n{\r\n    unsigned char* buf;\r\n    ZPOS64_T uSizeFile;\r\n    ZPOS64_T uBackRead;\r\n    ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */\r\n    ZPOS64_T uPosFound=0;\r\n    uLong uL;\r\n                ZPOS64_T relativeOffset;\r\n\r\n    if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)\r\n        return 0;\r\n\r\n\r\n    uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);\r\n\r\n    if (uMaxBack>uSizeFile)\r\n        uMaxBack = uSizeFile;\r\n\r\n    buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);\r\n    if (buf==NULL)\r\n        return 0;\r\n\r\n    uBackRead = 4;\r\n    while (uBackRead<uMaxBack)\r\n    {\r\n        uLong uReadSize;\r\n        ZPOS64_T uReadPos;\r\n        int i;\r\n        if (uBackRead+BUFREADCOMMENT>uMaxBack)\r\n            uBackRead = uMaxBack;\r\n        else\r\n            uBackRead+=BUFREADCOMMENT;\r\n        uReadPos = uSizeFile-uBackRead ;\r\n\r\n        uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?\r\n                     (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);\r\n        if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n            break;\r\n\r\n        if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)\r\n            break;\r\n\r\n        for (i=(int)uReadSize-3; (i--)>0;)\r\n            if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&\r\n                ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))\r\n            {\r\n                uPosFound = uReadPos+i;\r\n                break;\r\n            }\r\n\r\n        if (uPosFound!=0)\r\n            break;\r\n    }\r\n    TRYFREE(buf);\r\n    if (uPosFound == 0)\r\n        return 0;\r\n\r\n    /* Zip64 end of central directory locator */\r\n    if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        return 0;\r\n\r\n    /* the signature, already checked */\r\n    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)\r\n        return 0;\r\n\r\n    /* number of the disk with the start of the zip64 end of  central directory */\r\n    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)\r\n        return 0;\r\n    if (uL != 0)\r\n        return 0;\r\n\r\n    /* relative offset of the zip64 end of central directory record */\r\n    if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)\r\n        return 0;\r\n\r\n    /* total number of disks */\r\n    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)\r\n        return 0;\r\n    if (uL != 1)\r\n        return 0;\r\n\r\n    /* Goto end of central directory record */\r\n    if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        return 0;\r\n\r\n     /* the signature */\r\n    if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)\r\n        return 0;\r\n\r\n    if (uL != 0x06064b50)\r\n        return 0;\r\n\r\n    return relativeOffset;\r\n}\r\n\r\n/*\r\n  Open a Zip file. path contain the full pathname (by example,\r\n     on a Windows NT computer \"c:\\\\test\\\\zlib114.zip\" or on an Unix computer\r\n     \"zlib/zlib114.zip\".\r\n     If the zipfile cannot be opened (file doesn't exist or in not valid), the\r\n       return value is NULL.\r\n     Else, the return value is a unzFile Handle, usable with other function\r\n       of this unzip package.\r\n*/\r\nlocal unzFile unzOpenInternal (const void *path,\r\n                               zlib_filefunc64_32_def* pzlib_filefunc64_32_def,\r\n                               int is64bitOpenFunction)\r\n{\r\n    unz64_s us;\r\n    unz64_s *s;\r\n    ZPOS64_T central_pos;\r\n    uLong   uL;\r\n\r\n    uLong number_disk;          /* number of the current dist, used for\r\n                                   spaning ZIP, unsupported, always 0*/\r\n    uLong number_disk_with_CD;  /* number the the disk with central dir, used\r\n                                   for spaning ZIP, unsupported, always 0*/\r\n    ZPOS64_T number_entry_CD;      /* total number of entries in\r\n                                   the central dir\r\n                                   (same than number_entry on nospan) */\r\n\r\n    int err=UNZ_OK;\r\n\r\n    if (unz_copyright[0]!=' ')\r\n        return NULL;\r\n\r\n    us.z_filefunc.zseek32_file = NULL;\r\n    us.z_filefunc.ztell32_file = NULL;\r\n    if (pzlib_filefunc64_32_def==NULL)\r\n        fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);\r\n    else\r\n        us.z_filefunc = *pzlib_filefunc64_32_def;\r\n    us.is64bitOpenFunction = is64bitOpenFunction;\r\n\r\n\r\n\r\n    us.filestream = ZOPEN64(us.z_filefunc,\r\n                                                 path,\r\n                                                 ZLIB_FILEFUNC_MODE_READ |\r\n                                                 ZLIB_FILEFUNC_MODE_EXISTING);\r\n    if (us.filestream==NULL)\r\n        return NULL;\r\n\r\n    central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);\r\n    if (central_pos)\r\n    {\r\n        uLong uS;\r\n        ZPOS64_T uL64;\r\n\r\n        us.isZip64 = 1;\r\n\r\n        if (ZSEEK64(us.z_filefunc, us.filestream,\r\n                                      central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        err=UNZ_ERRNO;\r\n\r\n        /* the signature, already checked */\r\n        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* size of zip64 end of central directory record */\r\n        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* version made by */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* version needed to extract */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* number of this disk */\r\n        if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* number of the disk with the start of the central directory */\r\n        if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* total number of entries in the central directory on this disk */\r\n        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* total number of entries in the central directory */\r\n        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        if ((number_entry_CD!=us.gi.number_entry) ||\r\n            (number_disk_with_CD!=0) ||\r\n            (number_disk!=0))\r\n            err=UNZ_BADZIPFILE;\r\n\r\n        /* size of the central directory */\r\n        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* offset of start of central directory with respect to the\r\n          starting disk number */\r\n        if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        us.gi.size_comment = 0;\r\n    }\r\n    else\r\n    {\r\n        central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);\r\n        if (central_pos==0)\r\n            err=UNZ_ERRNO;\r\n\r\n        us.isZip64 = 0;\r\n\r\n        if (ZSEEK64(us.z_filefunc, us.filestream,\r\n                                        central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* the signature, already checked */\r\n        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* number of this disk */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* number of the disk with the start of the central directory */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n\r\n        /* total number of entries in the central dir on this disk */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n        us.gi.number_entry = uL;\r\n\r\n        /* total number of entries in the central dir */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n        number_entry_CD = uL;\r\n\r\n        if ((number_entry_CD!=us.gi.number_entry) ||\r\n            (number_disk_with_CD!=0) ||\r\n            (number_disk!=0))\r\n            err=UNZ_BADZIPFILE;\r\n\r\n        /* size of the central directory */\r\n        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n        us.size_central_dir = uL;\r\n\r\n        /* offset of start of central directory with respect to the\r\n            starting disk number */\r\n        if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n        us.offset_central_dir = uL;\r\n\r\n        /* zipfile comment length */\r\n        if (unz64local_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n    }\r\n\r\n    if ((central_pos<us.offset_central_dir+us.size_central_dir) &&\r\n        (err==UNZ_OK))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    if (err!=UNZ_OK)\r\n    {\r\n        ZCLOSE64(us.z_filefunc, us.filestream);\r\n        return NULL;\r\n    }\r\n\r\n    us.byte_before_the_zipfile = central_pos -\r\n                            (us.offset_central_dir+us.size_central_dir);\r\n    us.central_pos = central_pos;\r\n    us.pfile_in_zip_read = NULL;\r\n    us.encrypted = 0;\r\n\r\n\r\n    s=(unz64_s*)ALLOC(sizeof(unz64_s));\r\n    if( s != NULL)\r\n    {\r\n        *s=us;\r\n        unzGoToFirstFile((unzFile)s);\r\n    }\r\n    return (unzFile)s;\r\n}\r\n\r\n\r\nextern unzFile ZEXPORT unzOpen2 (const char *path,\r\n                                        zlib_filefunc_def* pzlib_filefunc32_def)\r\n{\r\n    if (pzlib_filefunc32_def != NULL)\r\n    {\r\n        zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;\r\n        fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);\r\n        return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);\r\n    }\r\n    else\r\n        return unzOpenInternal(path, NULL, 0);\r\n}\r\n\r\nextern unzFile ZEXPORT unzOpen2_64 (const void *path,\r\n                                     zlib_filefunc64_def* pzlib_filefunc_def)\r\n{\r\n    if (pzlib_filefunc_def != NULL)\r\n    {\r\n        zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;\r\n        zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;\r\n        zlib_filefunc64_32_def_fill.ztell32_file = NULL;\r\n        zlib_filefunc64_32_def_fill.zseek32_file = NULL;\r\n        return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);\r\n    }\r\n    else\r\n        return unzOpenInternal(path, NULL, 1);\r\n}\r\n\r\nextern unzFile ZEXPORT unzOpen (const char *path)\r\n{\r\n    return unzOpenInternal(path, NULL, 0);\r\n}\r\n\r\nextern unzFile ZEXPORT unzOpen64 (const void *path)\r\n{\r\n    return unzOpenInternal(path, NULL, 1);\r\n}\r\n\r\n/*\r\n  Close a ZipFile opened with unzipOpen.\r\n  If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),\r\n    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.\r\n  return UNZ_OK if there is no problem. */\r\nextern int ZEXPORT unzClose (unzFile file)\r\n{\r\n    unz64_s* s;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n\r\n    if (s->pfile_in_zip_read!=NULL)\r\n        unzCloseCurrentFile(file);\r\n\r\n    ZCLOSE64(s->z_filefunc, s->filestream);\r\n    TRYFREE(s);\r\n    return UNZ_OK;\r\n}\r\n\r\n\r\n/*\r\n  Write info about the ZipFile in the *pglobal_info structure.\r\n  No preparation of the structure is needed\r\n  return UNZ_OK if there is no problem. */\r\nextern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info)\r\n{\r\n    unz64_s* s;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    *pglobal_info=s->gi;\r\n    return UNZ_OK;\r\n}\r\n\r\nextern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32)\r\n{\r\n    unz64_s* s;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    /* to do : check if number_entry is not truncated */\r\n    pglobal_info32->number_entry = (uLong)s->gi.number_entry;\r\n    pglobal_info32->size_comment = s->gi.size_comment;\r\n    return UNZ_OK;\r\n}\r\n/*\r\n   Translate date/time from Dos format to tm_unz (readable more easilty)\r\n*/\r\nlocal void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)\r\n{\r\n    ZPOS64_T uDate;\r\n    uDate = (ZPOS64_T)(ulDosDate>>16);\r\n    ptm->tm_mday = (uInt)(uDate&0x1f) ;\r\n    ptm->tm_mon =  (uInt)((((uDate)&0x1E0)/0x20)-1) ;\r\n    ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;\r\n\r\n    ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);\r\n    ptm->tm_min =  (uInt) ((ulDosDate&0x7E0)/0x20) ;\r\n    ptm->tm_sec =  (uInt) (2*(ulDosDate&0x1f)) ;\r\n}\r\n\r\n/*\r\n  Get Info about the current file in the zipfile, with internal only info\r\n*/\r\nlocal int unz64local_GetCurrentFileInfoInternal OF((unzFile file,\r\n                                                  unz_file_info64 *pfile_info,\r\n                                                  unz_file_info64_internal\r\n                                                  *pfile_info_internal,\r\n                                                  char *szFileName,\r\n                                                  uLong fileNameBufferSize,\r\n                                                  void *extraField,\r\n                                                  uLong extraFieldBufferSize,\r\n                                                  char *szComment,\r\n                                                  uLong commentBufferSize));\r\n\r\nlocal int unz64local_GetCurrentFileInfoInternal (unzFile file,\r\n                                                  unz_file_info64 *pfile_info,\r\n                                                  unz_file_info64_internal\r\n                                                  *pfile_info_internal,\r\n                                                  char *szFileName,\r\n                                                  uLong fileNameBufferSize,\r\n                                                  void *extraField,\r\n                                                  uLong extraFieldBufferSize,\r\n                                                  char *szComment,\r\n                                                  uLong commentBufferSize)\r\n{\r\n    unz64_s* s;\r\n    unz_file_info64 file_info;\r\n    unz_file_info64_internal file_info_internal;\r\n    int err=UNZ_OK;\r\n    uLong uMagic;\r\n    long lSeek=0;\r\n    uLong uL;\r\n\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    if (ZSEEK64(s->z_filefunc, s->filestream,\r\n              s->pos_in_central_dir+s->byte_before_the_zipfile,\r\n              ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        err=UNZ_ERRNO;\r\n\r\n\r\n    /* we check the magic */\r\n    if (err==UNZ_OK)\r\n    {\r\n        if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n        else if (uMagic!=0x02014b50)\r\n            err=UNZ_BADZIPFILE;\r\n    }\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    unz64local_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n    file_info.compressed_size = uL;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n    file_info.uncompressed_size = uL;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n                // relative offset of local header\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n    file_info_internal.offset_curfile = uL;\r\n\r\n    lSeek+=file_info.size_filename;\r\n    if ((err==UNZ_OK) && (szFileName!=NULL))\r\n    {\r\n        uLong uSizeRead ;\r\n        if (file_info.size_filename<fileNameBufferSize)\r\n        {\r\n            *(szFileName+file_info.size_filename)='\\0';\r\n            uSizeRead = file_info.size_filename;\r\n        }\r\n        else\r\n            uSizeRead = fileNameBufferSize;\r\n\r\n        if ((file_info.size_filename>0) && (fileNameBufferSize>0))\r\n            if (ZREAD64(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)\r\n                err=UNZ_ERRNO;\r\n        lSeek -= uSizeRead;\r\n    }\r\n\r\n    // Read extrafield\r\n    if ((err==UNZ_OK) && (extraField!=NULL))\r\n    {\r\n        ZPOS64_T uSizeRead ;\r\n        if (file_info.size_file_extra<extraFieldBufferSize)\r\n            uSizeRead = file_info.size_file_extra;\r\n        else\r\n            uSizeRead = extraFieldBufferSize;\r\n\r\n        if (lSeek!=0)\r\n        {\r\n            if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)\r\n                lSeek=0;\r\n            else\r\n                err=UNZ_ERRNO;\r\n        }\r\n\r\n        if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))\r\n            if (ZREAD64(s->z_filefunc, s->filestream,extraField,(uLong)uSizeRead)!=uSizeRead)\r\n                err=UNZ_ERRNO;\r\n\r\n        lSeek += file_info.size_file_extra - (uLong)uSizeRead;\r\n    }\r\n    else\r\n        lSeek += file_info.size_file_extra;\r\n\r\n\r\n    if ((err==UNZ_OK) && (file_info.size_file_extra != 0))\r\n    {\r\n                                uLong acc = 0;\r\n\r\n        // since lSeek now points to after the extra field we need to move back\r\n        lSeek -= file_info.size_file_extra;\r\n\r\n        if (lSeek!=0)\r\n        {\r\n            if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)\r\n                lSeek=0;\r\n            else\r\n                err=UNZ_ERRNO;\r\n        }\r\n\r\n        while(acc < file_info.size_file_extra)\r\n        {\r\n            uLong headerId;\r\n                                                uLong dataSize;\r\n\r\n            if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)\r\n                err=UNZ_ERRNO;\r\n\r\n            if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK)\r\n                err=UNZ_ERRNO;\r\n\r\n            /* ZIP64 extra fields */\r\n            if (headerId == 0x0001)\r\n            {\r\n                                                        uLong uL;\r\n\r\n                                                                if(file_info.uncompressed_size == MAXU32)\r\n                                                                {\r\n                                                                        if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)\r\n                                                                                        err=UNZ_ERRNO;\r\n                                                                }\r\n\r\n                                                                if(file_info.compressed_size == MAXU32)\r\n                                                                {\r\n                                                                        if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)\r\n                                                                                  err=UNZ_ERRNO;\r\n                                                                }\r\n\r\n                                                                if(file_info_internal.offset_curfile == MAXU32)\r\n                                                                {\r\n                                                                        /* Relative Header offset */\r\n                                                                        if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)\r\n                                                                                err=UNZ_ERRNO;\r\n                                                                }\r\n\r\n                                                                if(file_info.disk_num_start == MAXU32)\r\n                                                                {\r\n                                                                        /* Disk Start Number */\r\n                                                                        if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)\r\n                                                                                err=UNZ_ERRNO;\r\n                                                                }\r\n\r\n            }\r\n            else\r\n            {\r\n                if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)\r\n                    err=UNZ_ERRNO;\r\n            }\r\n\r\n            acc += 2 + 2 + dataSize;\r\n        }\r\n    }\r\n\r\n    if ((err==UNZ_OK) && (szComment!=NULL))\r\n    {\r\n        uLong uSizeRead ;\r\n        if (file_info.size_file_comment<commentBufferSize)\r\n        {\r\n            *(szComment+file_info.size_file_comment)='\\0';\r\n            uSizeRead = file_info.size_file_comment;\r\n        }\r\n        else\r\n            uSizeRead = commentBufferSize;\r\n\r\n        if (lSeek!=0)\r\n        {\r\n            if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)\r\n                lSeek=0;\r\n            else\r\n                err=UNZ_ERRNO;\r\n        }\r\n\r\n        if ((file_info.size_file_comment>0) && (commentBufferSize>0))\r\n            if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)\r\n                err=UNZ_ERRNO;\r\n        lSeek+=file_info.size_file_comment - uSizeRead;\r\n    }\r\n    else\r\n        lSeek+=file_info.size_file_comment;\r\n\r\n\r\n    if ((err==UNZ_OK) && (pfile_info!=NULL))\r\n        *pfile_info=file_info;\r\n\r\n    if ((err==UNZ_OK) && (pfile_info_internal!=NULL))\r\n        *pfile_info_internal=file_info_internal;\r\n\r\n    return err;\r\n}\r\n\r\n\r\n\r\n/*\r\n  Write info about the ZipFile in the *pglobal_info structure.\r\n  No preparation of the structure is needed\r\n  return UNZ_OK if there is no problem.\r\n*/\r\nextern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,\r\n                                          unz_file_info64 * pfile_info,\r\n                                          char * szFileName, uLong fileNameBufferSize,\r\n                                          void *extraField, uLong extraFieldBufferSize,\r\n                                          char* szComment,  uLong commentBufferSize)\r\n{\r\n    return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,\r\n                                                szFileName,fileNameBufferSize,\r\n                                                extraField,extraFieldBufferSize,\r\n                                                szComment,commentBufferSize);\r\n}\r\n\r\nextern int ZEXPORT unzGetCurrentFileInfo (unzFile file,\r\n                                          unz_file_info * pfile_info,\r\n                                          char * szFileName, uLong fileNameBufferSize,\r\n                                          void *extraField, uLong extraFieldBufferSize,\r\n                                          char* szComment,  uLong commentBufferSize)\r\n{\r\n    int err;\r\n    unz_file_info64 file_info64;\r\n    err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,\r\n                                                szFileName,fileNameBufferSize,\r\n                                                extraField,extraFieldBufferSize,\r\n                                                szComment,commentBufferSize);\r\n    if ((err==UNZ_OK) && (pfile_info != NULL))\r\n    {\r\n        pfile_info->version = file_info64.version;\r\n        pfile_info->version_needed = file_info64.version_needed;\r\n        pfile_info->flag = file_info64.flag;\r\n        pfile_info->compression_method = file_info64.compression_method;\r\n        pfile_info->dosDate = file_info64.dosDate;\r\n        pfile_info->crc = file_info64.crc;\r\n\r\n        pfile_info->size_filename = file_info64.size_filename;\r\n        pfile_info->size_file_extra = file_info64.size_file_extra;\r\n        pfile_info->size_file_comment = file_info64.size_file_comment;\r\n\r\n        pfile_info->disk_num_start = file_info64.disk_num_start;\r\n        pfile_info->internal_fa = file_info64.internal_fa;\r\n        pfile_info->external_fa = file_info64.external_fa;\r\n\r\n        pfile_info->tmu_date = file_info64.tmu_date,\r\n\r\n\r\n        pfile_info->compressed_size = (uLong)file_info64.compressed_size;\r\n        pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;\r\n\r\n    }\r\n    return err;\r\n}\r\n/*\r\n  Set the current file of the zipfile to the first file.\r\n  return UNZ_OK if there is no problem\r\n*/\r\nextern int ZEXPORT unzGoToFirstFile (unzFile file)\r\n{\r\n    int err=UNZ_OK;\r\n    unz64_s* s;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    s->pos_in_central_dir=s->offset_central_dir;\r\n    s->num_file=0;\r\n    err=unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,\r\n                                             &s->cur_file_info_internal,\r\n                                             NULL,0,NULL,0,NULL,0);\r\n    s->current_file_ok = (err == UNZ_OK);\r\n    return err;\r\n}\r\n\r\n/*\r\n  Set the current file of the zipfile to the next file.\r\n  return UNZ_OK if there is no problem\r\n  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.\r\n*/\r\nextern int ZEXPORT unzGoToNextFile (unzFile  file)\r\n{\r\n    unz64_s* s;\r\n    int err;\r\n\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    if (!s->current_file_ok)\r\n        return UNZ_END_OF_LIST_OF_FILE;\r\n    if (s->gi.number_entry != 0xffff)    /* 2^16 files overflow hack */\r\n      if (s->num_file+1==s->gi.number_entry)\r\n        return UNZ_END_OF_LIST_OF_FILE;\r\n\r\n    s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +\r\n            s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;\r\n    s->num_file++;\r\n    err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,\r\n                                               &s->cur_file_info_internal,\r\n                                               NULL,0,NULL,0,NULL,0);\r\n    s->current_file_ok = (err == UNZ_OK);\r\n    return err;\r\n}\r\n\r\n\r\n/*\r\n  Try locate the file szFileName in the zipfile.\r\n  For the iCaseSensitivity signification, see unzipStringFileNameCompare\r\n\r\n  return value :\r\n  UNZ_OK if the file is found. It becomes the current file.\r\n  UNZ_END_OF_LIST_OF_FILE if the file is not found\r\n*/\r\nextern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)\r\n{\r\n    unz64_s* s;\r\n    int err;\r\n\r\n    /* We remember the 'current' position in the file so that we can jump\r\n     * back there if we fail.\r\n     */\r\n    unz_file_info64 cur_file_infoSaved;\r\n    unz_file_info64_internal cur_file_info_internalSaved;\r\n    ZPOS64_T num_fileSaved;\r\n    ZPOS64_T pos_in_central_dirSaved;\r\n\r\n\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n    if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)\r\n        return UNZ_PARAMERROR;\r\n\r\n    s=(unz64_s*)file;\r\n    if (!s->current_file_ok)\r\n        return UNZ_END_OF_LIST_OF_FILE;\r\n\r\n    /* Save the current state */\r\n    num_fileSaved = s->num_file;\r\n    pos_in_central_dirSaved = s->pos_in_central_dir;\r\n    cur_file_infoSaved = s->cur_file_info;\r\n    cur_file_info_internalSaved = s->cur_file_info_internal;\r\n\r\n    err = unzGoToFirstFile(file);\r\n\r\n    while (err == UNZ_OK)\r\n    {\r\n        char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];\r\n        err = unzGetCurrentFileInfo64(file,NULL,\r\n                                    szCurrentFileName,sizeof(szCurrentFileName)-1,\r\n                                    NULL,0,NULL,0);\r\n        if (err == UNZ_OK)\r\n        {\r\n            if (unzStringFileNameCompare(szCurrentFileName,\r\n                                            szFileName,iCaseSensitivity)==0)\r\n                return UNZ_OK;\r\n            err = unzGoToNextFile(file);\r\n        }\r\n    }\r\n\r\n    /* We failed, so restore the state of the 'current file' to where we\r\n     * were.\r\n     */\r\n    s->num_file = num_fileSaved ;\r\n    s->pos_in_central_dir = pos_in_central_dirSaved ;\r\n    s->cur_file_info = cur_file_infoSaved;\r\n    s->cur_file_info_internal = cur_file_info_internalSaved;\r\n    return err;\r\n}\r\n\r\n\r\n/*\r\n///////////////////////////////////////////\r\n// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)\r\n// I need random access\r\n//\r\n// Further optimization could be realized by adding an ability\r\n// to cache the directory in memory. The goal being a single\r\n// comprehensive file read to put the file I need in a memory.\r\n*/\r\n\r\n/*\r\ntypedef struct unz_file_pos_s\r\n{\r\n    ZPOS64_T pos_in_zip_directory;   // offset in file\r\n    ZPOS64_T num_of_file;            // # of file\r\n} unz_file_pos;\r\n*/\r\n\r\nextern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos*  file_pos)\r\n{\r\n    unz64_s* s;\r\n\r\n    if (file==NULL || file_pos==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    if (!s->current_file_ok)\r\n        return UNZ_END_OF_LIST_OF_FILE;\r\n\r\n    file_pos->pos_in_zip_directory  = s->pos_in_central_dir;\r\n    file_pos->num_of_file           = s->num_file;\r\n\r\n    return UNZ_OK;\r\n}\r\n\r\nextern int ZEXPORT unzGetFilePos(\r\n    unzFile file,\r\n    unz_file_pos* file_pos)\r\n{\r\n    unz64_file_pos file_pos64;\r\n    int err = unzGetFilePos64(file,&file_pos64);\r\n    if (err==UNZ_OK)\r\n    {\r\n        file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;\r\n        file_pos->num_of_file = (uLong)file_pos64.num_of_file;\r\n    }\r\n    return err;\r\n}\r\n\r\nextern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos)\r\n{\r\n    unz64_s* s;\r\n    int err;\r\n\r\n    if (file==NULL || file_pos==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n\r\n    /* jump to the right spot */\r\n    s->pos_in_central_dir = file_pos->pos_in_zip_directory;\r\n    s->num_file           = file_pos->num_of_file;\r\n\r\n    /* set the current file */\r\n    err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,\r\n                                               &s->cur_file_info_internal,\r\n                                               NULL,0,NULL,0,NULL,0);\r\n    /* return results */\r\n    s->current_file_ok = (err == UNZ_OK);\r\n    return err;\r\n}\r\n\r\nextern int ZEXPORT unzGoToFilePos(\r\n    unzFile file,\r\n    unz_file_pos* file_pos)\r\n{\r\n    unz64_file_pos file_pos64;\r\n    if (file_pos == NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n    file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;\r\n    file_pos64.num_of_file = file_pos->num_of_file;\r\n    return unzGoToFilePos64(file,&file_pos64);\r\n}\r\n\r\n/*\r\n// Unzip Helper Functions - should be here?\r\n///////////////////////////////////////////\r\n*/\r\n\r\n/*\r\n  Read the local header of the current zipfile\r\n  Check the coherency of the local header and info in the end of central\r\n        directory about this file\r\n  store in *piSizeVar the size of extra info in local header\r\n        (filename and size of extra field data)\r\n*/\r\nlocal int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,\r\n                                                    ZPOS64_T * poffset_local_extrafield,\r\n                                                    uInt  * psize_local_extrafield)\r\n{\r\n    uLong uMagic,uData,uFlags;\r\n    uLong size_filename;\r\n    uLong size_extra_field;\r\n    int err=UNZ_OK;\r\n\r\n    *piSizeVar = 0;\r\n    *poffset_local_extrafield = 0;\r\n    *psize_local_extrafield = 0;\r\n\r\n    if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +\r\n                                s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        return UNZ_ERRNO;\r\n\r\n\r\n    if (err==UNZ_OK)\r\n    {\r\n        if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)\r\n            err=UNZ_ERRNO;\r\n        else if (uMagic!=0x04034b50)\r\n            err=UNZ_BADZIPFILE;\r\n    }\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n/*\r\n    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))\r\n        err=UNZ_BADZIPFILE;\r\n*/\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&\r\n/* #ifdef HAVE_BZIP2 */\r\n                         (s->cur_file_info.compression_method!=Z_BZIP2ED) &&\r\n/* #endif */\r\n                         (s->cur_file_info.compression_method!=Z_DEFLATED))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */\r\n        err=UNZ_ERRNO;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */\r\n        err=UNZ_ERRNO;\r\n    else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */\r\n        err=UNZ_ERRNO;\r\n    else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */\r\n        err=UNZ_ERRNO;\r\n    else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n    else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    *piSizeVar += (uInt)size_filename;\r\n\r\n    if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)\r\n        err=UNZ_ERRNO;\r\n    *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +\r\n                                    SIZEZIPLOCALHEADER + size_filename;\r\n    *psize_local_extrafield = (uInt)size_extra_field;\r\n\r\n    *piSizeVar += (uInt)size_extra_field;\r\n\r\n    return err;\r\n}\r\n\r\n/*\r\n  Open for reading data the current file in the zipfile.\r\n  If there is no error and the file is opened, the return value is UNZ_OK.\r\n*/\r\nextern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,\r\n                                            int* level, int raw, const char* password)\r\n{\r\n    int err=UNZ_OK;\r\n    uInt iSizeVar;\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    ZPOS64_T offset_local_extrafield;  /* offset of the local extra field */\r\n    uInt  size_local_extrafield;    /* size of the local extra field */\r\n#    ifndef NOUNCRYPT\r\n    char source[12];\r\n#    else\r\n    if (password != NULL)\r\n        return UNZ_PARAMERROR;\r\n#    endif\r\n\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    if (!s->current_file_ok)\r\n        return UNZ_PARAMERROR;\r\n\r\n    if (s->pfile_in_zip_read != NULL)\r\n        unzCloseCurrentFile(file);\r\n\r\n    if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)\r\n        return UNZ_BADZIPFILE;\r\n\r\n    pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return UNZ_INTERNALERROR;\r\n\r\n    pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);\r\n    pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;\r\n    pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;\r\n    pfile_in_zip_read_info->pos_local_extrafield=0;\r\n    pfile_in_zip_read_info->raw=raw;\r\n\r\n    if (pfile_in_zip_read_info->read_buffer==NULL)\r\n    {\r\n        TRYFREE(pfile_in_zip_read_info);\r\n        return UNZ_INTERNALERROR;\r\n    }\r\n\r\n    pfile_in_zip_read_info->stream_initialised=0;\r\n\r\n    if (method!=NULL)\r\n        *method = (int)s->cur_file_info.compression_method;\r\n\r\n    if (level!=NULL)\r\n    {\r\n        *level = 6;\r\n        switch (s->cur_file_info.flag & 0x06)\r\n        {\r\n          case 6 : *level = 1; break;\r\n          case 4 : *level = 2; break;\r\n          case 2 : *level = 9; break;\r\n        }\r\n    }\r\n\r\n    if ((s->cur_file_info.compression_method!=0) &&\r\n/* #ifdef HAVE_BZIP2 */\r\n        (s->cur_file_info.compression_method!=Z_BZIP2ED) &&\r\n/* #endif */\r\n        (s->cur_file_info.compression_method!=Z_DEFLATED))\r\n\r\n        err=UNZ_BADZIPFILE;\r\n\r\n    pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;\r\n    pfile_in_zip_read_info->crc32=0;\r\n    pfile_in_zip_read_info->total_out_64=0;\r\n    pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method;\r\n    pfile_in_zip_read_info->filestream=s->filestream;\r\n    pfile_in_zip_read_info->z_filefunc=s->z_filefunc;\r\n    pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;\r\n\r\n    pfile_in_zip_read_info->stream.total_out = 0;\r\n\r\n    if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw))\r\n    {\r\n#ifdef HAVE_BZIP2\r\n      pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0;\r\n      pfile_in_zip_read_info->bstream.bzfree = (free_func)0;\r\n      pfile_in_zip_read_info->bstream.opaque = (voidpf)0;\r\n      pfile_in_zip_read_info->bstream.state = (voidpf)0;\r\n\r\n      pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;\r\n      pfile_in_zip_read_info->stream.zfree = (free_func)0;\r\n      pfile_in_zip_read_info->stream.opaque = (voidpf)0;\r\n      pfile_in_zip_read_info->stream.next_in = (voidpf)0;\r\n      pfile_in_zip_read_info->stream.avail_in = 0;\r\n\r\n      err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);\r\n      if (err == Z_OK)\r\n        pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;\r\n      else\r\n      {\r\n        TRYFREE(pfile_in_zip_read_info);\r\n        return err;\r\n      }\r\n#else\r\n      pfile_in_zip_read_info->raw=1;\r\n#endif\r\n    }\r\n    else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))\r\n    {\r\n      pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;\r\n      pfile_in_zip_read_info->stream.zfree = (free_func)0;\r\n      pfile_in_zip_read_info->stream.opaque = (voidpf)0;\r\n      pfile_in_zip_read_info->stream.next_in = 0;\r\n      pfile_in_zip_read_info->stream.avail_in = 0;\r\n\r\n      err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);\r\n      if (err == Z_OK)\r\n        pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;\r\n      else\r\n      {\r\n        TRYFREE(pfile_in_zip_read_info);\r\n        return err;\r\n      }\r\n        /* windowBits is passed < 0 to tell that there is no zlib header.\r\n         * Note that in this case inflate *requires* an extra \"dummy\" byte\r\n         * after the compressed stream in order to complete decompression and\r\n         * return Z_STREAM_END.\r\n         * In unzip, i don't wait absolutely Z_STREAM_END because I known the\r\n         * size of both compressed and uncompressed data\r\n         */\r\n    }\r\n    pfile_in_zip_read_info->rest_read_compressed =\r\n            s->cur_file_info.compressed_size ;\r\n    pfile_in_zip_read_info->rest_read_uncompressed =\r\n            s->cur_file_info.uncompressed_size ;\r\n\r\n\r\n    pfile_in_zip_read_info->pos_in_zipfile =\r\n            s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +\r\n              iSizeVar;\r\n\r\n    pfile_in_zip_read_info->stream.avail_in = (uInt)0;\r\n\r\n    s->pfile_in_zip_read = pfile_in_zip_read_info;\r\n                s->encrypted = 0;\r\n\r\n#    ifndef NOUNCRYPT\r\n    if (password != NULL)\r\n    {\r\n        int i;\r\n        s->pcrc_32_tab = get_crc_table();\r\n        init_keys(password,s->keys,s->pcrc_32_tab);\r\n        if (ZSEEK64(s->z_filefunc, s->filestream,\r\n                  s->pfile_in_zip_read->pos_in_zipfile +\r\n                     s->pfile_in_zip_read->byte_before_the_zipfile,\r\n                  SEEK_SET)!=0)\r\n            return UNZ_INTERNALERROR;\r\n        if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12)\r\n            return UNZ_INTERNALERROR;\r\n\r\n        for (i = 0; i<12; i++)\r\n            zdecode(s->keys,s->pcrc_32_tab,source[i]);\r\n\r\n        s->pfile_in_zip_read->pos_in_zipfile+=12;\r\n        s->encrypted=1;\r\n    }\r\n#    endif\r\n\r\n\r\n    return UNZ_OK;\r\n}\r\n\r\nextern int ZEXPORT unzOpenCurrentFile (unzFile file)\r\n{\r\n    return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);\r\n}\r\n\r\nextern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char*  password)\r\n{\r\n    return unzOpenCurrentFile3(file, NULL, NULL, 0, password);\r\n}\r\n\r\nextern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw)\r\n{\r\n    return unzOpenCurrentFile3(file, method, level, raw, NULL);\r\n}\r\n\r\n/** Addition for GDAL : START */\r\n\r\nextern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)\r\n{\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    s=(unz64_s*)file;\r\n    if (file==NULL)\r\n        return 0; //UNZ_PARAMERROR;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return 0; //UNZ_PARAMERROR;\r\n    return pfile_in_zip_read_info->pos_in_zipfile +\r\n                         pfile_in_zip_read_info->byte_before_the_zipfile;\r\n}\r\n\r\n/** Addition for GDAL : END */\r\n\r\n/*\r\n  Read bytes from the current file.\r\n  buf contain buffer where data must be copied\r\n  len the size of buf.\r\n\r\n  return the number of byte copied if somes bytes are copied\r\n  return 0 if the end of file was reached\r\n  return <0 with error code if there is an error\r\n    (UNZ_ERRNO for IO error, or zLib error for uncompress error)\r\n*/\r\nextern int ZEXPORT unzReadCurrentFile  (unzFile file, voidp buf, unsigned len)\r\n{\r\n    int err=UNZ_OK;\r\n    uInt iRead = 0;\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n\r\n    if (pfile_in_zip_read_info->read_buffer == NULL)\r\n        return UNZ_END_OF_LIST_OF_FILE;\r\n    if (len==0)\r\n        return 0;\r\n\r\n    pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;\r\n\r\n    pfile_in_zip_read_info->stream.avail_out = (uInt)len;\r\n\r\n    if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&\r\n        (!(pfile_in_zip_read_info->raw)))\r\n        pfile_in_zip_read_info->stream.avail_out =\r\n            (uInt)pfile_in_zip_read_info->rest_read_uncompressed;\r\n\r\n    if ((len>pfile_in_zip_read_info->rest_read_compressed+\r\n           pfile_in_zip_read_info->stream.avail_in) &&\r\n         (pfile_in_zip_read_info->raw))\r\n        pfile_in_zip_read_info->stream.avail_out =\r\n            (uInt)pfile_in_zip_read_info->rest_read_compressed+\r\n            pfile_in_zip_read_info->stream.avail_in;\r\n\r\n    while (pfile_in_zip_read_info->stream.avail_out>0)\r\n    {\r\n        if ((pfile_in_zip_read_info->stream.avail_in==0) &&\r\n            (pfile_in_zip_read_info->rest_read_compressed>0))\r\n        {\r\n            uInt uReadThis = UNZ_BUFSIZE;\r\n            if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)\r\n                uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;\r\n            if (uReadThis == 0)\r\n                return UNZ_EOF;\r\n            if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,\r\n                      pfile_in_zip_read_info->filestream,\r\n                      pfile_in_zip_read_info->pos_in_zipfile +\r\n                         pfile_in_zip_read_info->byte_before_the_zipfile,\r\n                         ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n                return UNZ_ERRNO;\r\n            if (ZREAD64(pfile_in_zip_read_info->z_filefunc,\r\n                      pfile_in_zip_read_info->filestream,\r\n                      pfile_in_zip_read_info->read_buffer,\r\n                      uReadThis)!=uReadThis)\r\n                return UNZ_ERRNO;\r\n\r\n\r\n#            ifndef NOUNCRYPT\r\n            if(s->encrypted)\r\n            {\r\n                uInt i;\r\n                for(i=0;i<uReadThis;i++)\r\n                  pfile_in_zip_read_info->read_buffer[i] =\r\n                      zdecode(s->keys,s->pcrc_32_tab,\r\n                              pfile_in_zip_read_info->read_buffer[i]);\r\n            }\r\n#            endif\r\n\r\n\r\n            pfile_in_zip_read_info->pos_in_zipfile += uReadThis;\r\n\r\n            pfile_in_zip_read_info->rest_read_compressed-=uReadThis;\r\n\r\n            pfile_in_zip_read_info->stream.next_in =\r\n                (Bytef*)pfile_in_zip_read_info->read_buffer;\r\n            pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;\r\n        }\r\n\r\n        if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))\r\n        {\r\n            uInt uDoCopy,i ;\r\n\r\n            if ((pfile_in_zip_read_info->stream.avail_in == 0) &&\r\n                (pfile_in_zip_read_info->rest_read_compressed == 0))\r\n                return (iRead==0) ? UNZ_EOF : iRead;\r\n\r\n            if (pfile_in_zip_read_info->stream.avail_out <\r\n                            pfile_in_zip_read_info->stream.avail_in)\r\n                uDoCopy = pfile_in_zip_read_info->stream.avail_out ;\r\n            else\r\n                uDoCopy = pfile_in_zip_read_info->stream.avail_in ;\r\n\r\n            for (i=0;i<uDoCopy;i++)\r\n                *(pfile_in_zip_read_info->stream.next_out+i) =\r\n                        *(pfile_in_zip_read_info->stream.next_in+i);\r\n\r\n            pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy;\r\n\r\n            pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,\r\n                                pfile_in_zip_read_info->stream.next_out,\r\n                                uDoCopy);\r\n            pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;\r\n            pfile_in_zip_read_info->stream.avail_in -= uDoCopy;\r\n            pfile_in_zip_read_info->stream.avail_out -= uDoCopy;\r\n            pfile_in_zip_read_info->stream.next_out += uDoCopy;\r\n            pfile_in_zip_read_info->stream.next_in += uDoCopy;\r\n            pfile_in_zip_read_info->stream.total_out += uDoCopy;\r\n            iRead += uDoCopy;\r\n        }\r\n        else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED)\r\n        {\r\n#ifdef HAVE_BZIP2\r\n            uLong uTotalOutBefore,uTotalOutAfter;\r\n            const Bytef *bufBefore;\r\n            uLong uOutThis;\r\n\r\n            pfile_in_zip_read_info->bstream.next_in        = (char*)pfile_in_zip_read_info->stream.next_in;\r\n            pfile_in_zip_read_info->bstream.avail_in       = pfile_in_zip_read_info->stream.avail_in;\r\n            pfile_in_zip_read_info->bstream.total_in_lo32  = pfile_in_zip_read_info->stream.total_in;\r\n            pfile_in_zip_read_info->bstream.total_in_hi32  = 0;\r\n            pfile_in_zip_read_info->bstream.next_out       = (char*)pfile_in_zip_read_info->stream.next_out;\r\n            pfile_in_zip_read_info->bstream.avail_out      = pfile_in_zip_read_info->stream.avail_out;\r\n            pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out;\r\n            pfile_in_zip_read_info->bstream.total_out_hi32 = 0;\r\n\r\n            uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32;\r\n            bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out;\r\n\r\n            err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream);\r\n\r\n            uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32;\r\n            uOutThis = uTotalOutAfter-uTotalOutBefore;\r\n\r\n            pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;\r\n\r\n            pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis));\r\n            pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;\r\n            iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);\r\n\r\n            pfile_in_zip_read_info->stream.next_in   = (Bytef*)pfile_in_zip_read_info->bstream.next_in;\r\n            pfile_in_zip_read_info->stream.avail_in  = pfile_in_zip_read_info->bstream.avail_in;\r\n            pfile_in_zip_read_info->stream.total_in  = pfile_in_zip_read_info->bstream.total_in_lo32;\r\n            pfile_in_zip_read_info->stream.next_out  = (Bytef*)pfile_in_zip_read_info->bstream.next_out;\r\n            pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out;\r\n            pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32;\r\n\r\n            if (err==BZ_STREAM_END)\r\n              return (iRead==0) ? UNZ_EOF : iRead;\r\n            if (err!=BZ_OK)\r\n              break;\r\n#endif\r\n        } // end Z_BZIP2ED\r\n        else\r\n        {\r\n            ZPOS64_T uTotalOutBefore,uTotalOutAfter;\r\n            const Bytef *bufBefore;\r\n            ZPOS64_T uOutThis;\r\n            int flush=Z_SYNC_FLUSH;\r\n\r\n            uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;\r\n            bufBefore = pfile_in_zip_read_info->stream.next_out;\r\n\r\n            /*\r\n            if ((pfile_in_zip_read_info->rest_read_uncompressed ==\r\n                     pfile_in_zip_read_info->stream.avail_out) &&\r\n                (pfile_in_zip_read_info->rest_read_compressed == 0))\r\n                flush = Z_FINISH;\r\n            */\r\n            err=inflate(&pfile_in_zip_read_info->stream,flush);\r\n\r\n            if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))\r\n              err = Z_DATA_ERROR;\r\n\r\n            uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;\r\n            uOutThis = uTotalOutAfter-uTotalOutBefore;\r\n\r\n            pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;\r\n\r\n            pfile_in_zip_read_info->crc32 =\r\n                crc32(pfile_in_zip_read_info->crc32,bufBefore,\r\n                        (uInt)(uOutThis));\r\n\r\n            pfile_in_zip_read_info->rest_read_uncompressed -=\r\n                uOutThis;\r\n\r\n            iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);\r\n\r\n            if (err==Z_STREAM_END)\r\n                return (iRead==0) ? UNZ_EOF : iRead;\r\n            if (err!=Z_OK)\r\n                break;\r\n        }\r\n    }\r\n\r\n    if (err==Z_OK)\r\n        return iRead;\r\n    return err;\r\n}\r\n\r\n\r\n/*\r\n  Give the current position in uncompressed data\r\n*/\r\nextern z_off_t ZEXPORT unztell (unzFile file)\r\n{\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n    return (z_off_t)pfile_in_zip_read_info->stream.total_out;\r\n}\r\n\r\nextern ZPOS64_T ZEXPORT unztell64 (unzFile file)\r\n{\r\n\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    if (file==NULL)\r\n        return (ZPOS64_T)-1;\r\n    s=(unz64_s*)file;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return (ZPOS64_T)-1;\r\n\r\n    return pfile_in_zip_read_info->total_out_64;\r\n}\r\n\r\n\r\n/*\r\n  return 1 if the end of file was reached, 0 elsewhere\r\n*/\r\nextern int ZEXPORT unzeof (unzFile file)\r\n{\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n    if (pfile_in_zip_read_info->rest_read_uncompressed == 0)\r\n        return 1;\r\n    else\r\n        return 0;\r\n}\r\n\r\n\r\n\r\n/*\r\nRead extra field from the current file (opened by unzOpenCurrentFile)\r\nThis is the local-header version of the extra field (sometimes, there is\r\nmore info in the local-header version than in the central-header)\r\n\r\n  if buf==NULL, it return the size of the local extra field that can be read\r\n\r\n  if buf!=NULL, len is the size of the buffer, the extra header is copied in\r\n    buf.\r\n  the return value is the number of bytes copied in buf, or (if <0)\r\n    the error code\r\n*/\r\nextern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)\r\n{\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    uInt read_now;\r\n    ZPOS64_T size_to_read;\r\n\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n    size_to_read = (pfile_in_zip_read_info->size_local_extrafield -\r\n                pfile_in_zip_read_info->pos_local_extrafield);\r\n\r\n    if (buf==NULL)\r\n        return (int)size_to_read;\r\n\r\n    if (len>size_to_read)\r\n        read_now = (uInt)size_to_read;\r\n    else\r\n        read_now = (uInt)len ;\r\n\r\n    if (read_now==0)\r\n        return 0;\r\n\r\n    if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,\r\n              pfile_in_zip_read_info->filestream,\r\n              pfile_in_zip_read_info->offset_local_extrafield +\r\n              pfile_in_zip_read_info->pos_local_extrafield,\r\n              ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        return UNZ_ERRNO;\r\n\r\n    if (ZREAD64(pfile_in_zip_read_info->z_filefunc,\r\n              pfile_in_zip_read_info->filestream,\r\n              buf,read_now)!=read_now)\r\n        return UNZ_ERRNO;\r\n\r\n    return (int)read_now;\r\n}\r\n\r\n/*\r\n  Close the file in zip opened with unzipOpenCurrentFile\r\n  Return UNZ_CRCERROR if all the file was read but the CRC is not good\r\n*/\r\nextern int ZEXPORT unzCloseCurrentFile (unzFile file)\r\n{\r\n    int err=UNZ_OK;\r\n\r\n    unz64_s* s;\r\n    file_in_zip64_read_info_s* pfile_in_zip_read_info;\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    pfile_in_zip_read_info=s->pfile_in_zip_read;\r\n\r\n    if (pfile_in_zip_read_info==NULL)\r\n        return UNZ_PARAMERROR;\r\n\r\n\r\n    if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&\r\n        (!pfile_in_zip_read_info->raw))\r\n    {\r\n        if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)\r\n            err=UNZ_CRCERROR;\r\n    }\r\n\r\n\r\n    TRYFREE(pfile_in_zip_read_info->read_buffer);\r\n    pfile_in_zip_read_info->read_buffer = NULL;\r\n    if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)\r\n        inflateEnd(&pfile_in_zip_read_info->stream);\r\n#ifdef HAVE_BZIP2\r\n    else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)\r\n        BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);\r\n#endif\r\n\r\n\r\n    pfile_in_zip_read_info->stream_initialised = 0;\r\n    TRYFREE(pfile_in_zip_read_info);\r\n\r\n    s->pfile_in_zip_read=NULL;\r\n\r\n    return err;\r\n}\r\n\r\n\r\n/*\r\n  Get the global comment string of the ZipFile, in the szComment buffer.\r\n  uSizeBuf is the size of the szComment buffer.\r\n  return the number of byte copied or an error code <0\r\n*/\r\nextern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)\r\n{\r\n    unz64_s* s;\r\n    uLong uReadThis ;\r\n    if (file==NULL)\r\n        return (int)UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n\r\n    uReadThis = uSizeBuf;\r\n    if (uReadThis>s->gi.size_comment)\r\n        uReadThis = s->gi.size_comment;\r\n\r\n    if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)\r\n        return UNZ_ERRNO;\r\n\r\n    if (uReadThis>0)\r\n    {\r\n      *szComment='\\0';\r\n      if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)\r\n        return UNZ_ERRNO;\r\n    }\r\n\r\n    if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))\r\n        *(szComment+s->gi.size_comment)='\\0';\r\n    return (int)uReadThis;\r\n}\r\n\r\n/* Additions by RX '2004 */\r\nextern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)\r\n{\r\n    unz64_s* s;\r\n\r\n    if (file==NULL)\r\n          return 0; //UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n    if (!s->current_file_ok)\r\n      return 0;\r\n    if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)\r\n      if (s->num_file==s->gi.number_entry)\r\n         return 0;\r\n    return s->pos_in_central_dir;\r\n}\r\n\r\nextern uLong ZEXPORT unzGetOffset (unzFile file)\r\n{\r\n    ZPOS64_T offset64;\r\n\r\n    if (file==NULL)\r\n          return 0; //UNZ_PARAMERROR;\r\n    offset64 = unzGetOffset64(file);\r\n    return (uLong)offset64;\r\n}\r\n\r\nextern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)\r\n{\r\n    unz64_s* s;\r\n    int err;\r\n\r\n    if (file==NULL)\r\n        return UNZ_PARAMERROR;\r\n    s=(unz64_s*)file;\r\n\r\n    s->pos_in_central_dir = pos;\r\n    s->num_file = s->gi.number_entry;      /* hack */\r\n    err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,\r\n                                              &s->cur_file_info_internal,\r\n                                              NULL,0,NULL,0,NULL,0);\r\n    s->current_file_ok = (err == UNZ_OK);\r\n    return err;\r\n}\r\n\r\nextern int ZEXPORT unzSetOffset (unzFile file, uLong pos)\r\n{\r\n    return unzSetOffset64(file,pos);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/minizip/unzip.h",
    "content": "/* unzip.h -- IO for uncompress .zip files using zlib\r\n   Version 1.1, February 14h, 2010\r\n   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )\r\n\r\n         Modifications of Unzip for Zip64\r\n         Copyright (C) 2007-2008 Even Rouault\r\n\r\n         Modifications for Zip64 support on both zip and unzip\r\n         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )\r\n\r\n         For more info read MiniZip_info.txt\r\n\r\n         ---------------------------------------------------------------------------------\r\n\r\n        Condition of use and distribution are the same than zlib :\r\n\r\n  This software is provided 'as-is', without any express or implied\r\n  warranty.  In no event will the authors be held liable for any damages\r\n  arising from the use of this software.\r\n\r\n  Permission is granted to anyone to use this software for any purpose,\r\n  including commercial applications, and to alter it and redistribute it\r\n  freely, subject to the following restrictions:\r\n\r\n  1. The origin of this software must not be misrepresented; you must not\r\n     claim that you wrote the original software. If you use this software\r\n     in a product, an acknowledgment in the product documentation would be\r\n     appreciated but is not required.\r\n  2. Altered source versions must be plainly marked as such, and must not be\r\n     misrepresented as being the original software.\r\n  3. This notice may not be removed or altered from any source distribution.\r\n\r\n  ---------------------------------------------------------------------------------\r\n\r\n        Changes\r\n\r\n        See header of unzip64.c\r\n\r\n*/\r\n\r\n#ifndef _unz64_H\r\n#define _unz64_H\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifndef _ZLIB_H\r\n#include \"zlib.h\"\r\n#endif\r\n\r\n#ifndef  _ZLIBIOAPI_H\r\n#include \"ioapi.h\"\r\n#endif\r\n\r\n#ifdef HAVE_BZIP2\r\n#include \"bzlib.h\"\r\n#endif\r\n\r\n#define Z_BZIP2ED 12\r\n\r\n#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)\r\n/* like the STRICT of WIN32, we define a pointer that cannot be converted\r\n    from (void*) without cast */\r\ntypedef struct TagunzFile__ { int unused; } unzFile__;\r\ntypedef unzFile__ *unzFile;\r\n#else\r\ntypedef voidp unzFile;\r\n#endif\r\n\r\n\r\n#define UNZ_OK                          (0)\r\n#define UNZ_END_OF_LIST_OF_FILE         (-100)\r\n#define UNZ_ERRNO                       (Z_ERRNO)\r\n#define UNZ_EOF                         (0)\r\n#define UNZ_PARAMERROR                  (-102)\r\n#define UNZ_BADZIPFILE                  (-103)\r\n#define UNZ_INTERNALERROR               (-104)\r\n#define UNZ_CRCERROR                    (-105)\r\n\r\n/* tm_unz contain date/time info */\r\ntypedef struct tm_unz_s\r\n{\r\n    uInt tm_sec;            /* seconds after the minute - [0,59] */\r\n    uInt tm_min;            /* minutes after the hour - [0,59] */\r\n    uInt tm_hour;           /* hours since midnight - [0,23] */\r\n    uInt tm_mday;           /* day of the month - [1,31] */\r\n    uInt tm_mon;            /* months since January - [0,11] */\r\n    uInt tm_year;           /* years - [1980..2044] */\r\n} tm_unz;\r\n\r\n/* unz_global_info structure contain global data about the ZIPfile\r\n   These data comes from the end of central dir */\r\ntypedef struct unz_global_info64_s\r\n{\r\n    ZPOS64_T number_entry;         /* total number of entries in\r\n                                     the central dir on this disk */\r\n    uLong size_comment;         /* size of the global comment of the zipfile */\r\n} unz_global_info64;\r\n\r\ntypedef struct unz_global_info_s\r\n{\r\n    uLong number_entry;         /* total number of entries in\r\n                                     the central dir on this disk */\r\n    uLong size_comment;         /* size of the global comment of the zipfile */\r\n} unz_global_info;\r\n\r\n/* unz_file_info contain information about a file in the zipfile */\r\ntypedef struct unz_file_info64_s\r\n{\r\n    uLong version;              /* version made by                 2 bytes */\r\n    uLong version_needed;       /* version needed to extract       2 bytes */\r\n    uLong flag;                 /* general purpose bit flag        2 bytes */\r\n    uLong compression_method;   /* compression method              2 bytes */\r\n    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */\r\n    uLong crc;                  /* crc-32                          4 bytes */\r\n    ZPOS64_T compressed_size;   /* compressed size                 8 bytes */\r\n    ZPOS64_T uncompressed_size; /* uncompressed size               8 bytes */\r\n    uLong size_filename;        /* filename length                 2 bytes */\r\n    uLong size_file_extra;      /* extra field length              2 bytes */\r\n    uLong size_file_comment;    /* file comment length             2 bytes */\r\n\r\n    uLong disk_num_start;       /* disk number start               2 bytes */\r\n    uLong internal_fa;          /* internal file attributes        2 bytes */\r\n    uLong external_fa;          /* external file attributes        4 bytes */\r\n\r\n    tm_unz tmu_date;\r\n} unz_file_info64;\r\n\r\ntypedef struct unz_file_info_s\r\n{\r\n    uLong version;              /* version made by                 2 bytes */\r\n    uLong version_needed;       /* version needed to extract       2 bytes */\r\n    uLong flag;                 /* general purpose bit flag        2 bytes */\r\n    uLong compression_method;   /* compression method              2 bytes */\r\n    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */\r\n    uLong crc;                  /* crc-32                          4 bytes */\r\n    uLong compressed_size;      /* compressed size                 4 bytes */\r\n    uLong uncompressed_size;    /* uncompressed size               4 bytes */\r\n    uLong size_filename;        /* filename length                 2 bytes */\r\n    uLong size_file_extra;      /* extra field length              2 bytes */\r\n    uLong size_file_comment;    /* file comment length             2 bytes */\r\n\r\n    uLong disk_num_start;       /* disk number start               2 bytes */\r\n    uLong internal_fa;          /* internal file attributes        2 bytes */\r\n    uLong external_fa;          /* external file attributes        4 bytes */\r\n\r\n    tm_unz tmu_date;\r\n} unz_file_info;\r\n\r\nextern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,\r\n                                                 const char* fileName2,\r\n                                                 int iCaseSensitivity));\r\n/*\r\n   Compare two filename (fileName1,fileName2).\r\n   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)\r\n   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi\r\n                                or strcasecmp)\r\n   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system\r\n    (like 1 on Unix, 2 on Windows)\r\n*/\r\n\r\n\r\nextern unzFile ZEXPORT unzOpen OF((const char *path));\r\nextern unzFile ZEXPORT unzOpen64 OF((const void *path));\r\n/*\r\n  Open a Zip file. path contain the full pathname (by example,\r\n     on a Windows XP computer \"c:\\\\zlib\\\\zlib113.zip\" or on an Unix computer\r\n     \"zlib/zlib113.zip\".\r\n     If the zipfile cannot be opened (file don't exist or in not valid), the\r\n       return value is NULL.\r\n     Else, the return value is a unzFile Handle, usable with other function\r\n       of this unzip package.\r\n     the \"64\" function take a const void* pointer, because the path is just the\r\n       value passed to the open64_file_func callback.\r\n     Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path\r\n       is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*\r\n       does not describe the reality\r\n*/\r\n\r\n\r\nextern unzFile ZEXPORT unzOpen2 OF((const char *path,\r\n                                    zlib_filefunc_def* pzlib_filefunc_def));\r\n/*\r\n   Open a Zip file, like unzOpen, but provide a set of file low level API\r\n      for read/write the zip file (see ioapi.h)\r\n*/\r\n\r\nextern unzFile ZEXPORT unzOpen2_64 OF((const void *path,\r\n                                    zlib_filefunc64_def* pzlib_filefunc_def));\r\n/*\r\n   Open a Zip file, like unz64Open, but provide a set of file low level API\r\n      for read/write the zip file (see ioapi.h)\r\n*/\r\n\r\nextern int ZEXPORT unzClose OF((unzFile file));\r\n/*\r\n  Close a ZipFile opened with unzipOpen.\r\n  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),\r\n    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.\r\n  return UNZ_OK if there is no problem. */\r\n\r\nextern int ZEXPORT unzGetGlobalInfo OF((unzFile file,\r\n                                        unz_global_info *pglobal_info));\r\n\r\nextern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,\r\n                                        unz_global_info64 *pglobal_info));\r\n/*\r\n  Write info about the ZipFile in the *pglobal_info structure.\r\n  No preparation of the structure is needed\r\n  return UNZ_OK if there is no problem. */\r\n\r\n\r\nextern int ZEXPORT unzGetGlobalComment OF((unzFile file,\r\n                                           char *szComment,\r\n                                           uLong uSizeBuf));\r\n/*\r\n  Get the global comment string of the ZipFile, in the szComment buffer.\r\n  uSizeBuf is the size of the szComment buffer.\r\n  return the number of byte copied or an error code <0\r\n*/\r\n\r\n\r\n/***************************************************************************/\r\n/* Unzip package allow you browse the directory of the zipfile */\r\n\r\nextern int ZEXPORT unzGoToFirstFile OF((unzFile file));\r\n/*\r\n  Set the current file of the zipfile to the first file.\r\n  return UNZ_OK if there is no problem\r\n*/\r\n\r\nextern int ZEXPORT unzGoToNextFile OF((unzFile file));\r\n/*\r\n  Set the current file of the zipfile to the next file.\r\n  return UNZ_OK if there is no problem\r\n  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.\r\n*/\r\n\r\nextern int ZEXPORT unzLocateFile OF((unzFile file,\r\n                     const char *szFileName,\r\n                     int iCaseSensitivity));\r\n/*\r\n  Try locate the file szFileName in the zipfile.\r\n  For the iCaseSensitivity signification, see unzStringFileNameCompare\r\n\r\n  return value :\r\n  UNZ_OK if the file is found. It becomes the current file.\r\n  UNZ_END_OF_LIST_OF_FILE if the file is not found\r\n*/\r\n\r\n\r\n/* ****************************************** */\r\n/* Ryan supplied functions */\r\n/* unz_file_info contain information about a file in the zipfile */\r\ntypedef struct unz_file_pos_s\r\n{\r\n    uLong pos_in_zip_directory;   /* offset in zip file directory */\r\n    uLong num_of_file;            /* # of file */\r\n} unz_file_pos;\r\n\r\nextern int ZEXPORT unzGetFilePos(\r\n    unzFile file,\r\n    unz_file_pos* file_pos);\r\n\r\nextern int ZEXPORT unzGoToFilePos(\r\n    unzFile file,\r\n    unz_file_pos* file_pos);\r\n\r\ntypedef struct unz64_file_pos_s\r\n{\r\n    ZPOS64_T pos_in_zip_directory;   /* offset in zip file directory */\r\n    ZPOS64_T num_of_file;            /* # of file */\r\n} unz64_file_pos;\r\n\r\nextern int ZEXPORT unzGetFilePos64(\r\n    unzFile file,\r\n    unz64_file_pos* file_pos);\r\n\r\nextern int ZEXPORT unzGoToFilePos64(\r\n    unzFile file,\r\n    const unz64_file_pos* file_pos);\r\n\r\n/* ****************************************** */\r\n\r\nextern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,\r\n                         unz_file_info64 *pfile_info,\r\n                         char *szFileName,\r\n                         uLong fileNameBufferSize,\r\n                         void *extraField,\r\n                         uLong extraFieldBufferSize,\r\n                         char *szComment,\r\n                         uLong commentBufferSize));\r\n\r\nextern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,\r\n                         unz_file_info *pfile_info,\r\n                         char *szFileName,\r\n                         uLong fileNameBufferSize,\r\n                         void *extraField,\r\n                         uLong extraFieldBufferSize,\r\n                         char *szComment,\r\n                         uLong commentBufferSize));\r\n/*\r\n  Get Info about the current file\r\n  if pfile_info!=NULL, the *pfile_info structure will contain somes info about\r\n        the current file\r\n  if szFileName!=NULL, the filemane string will be copied in szFileName\r\n            (fileNameBufferSize is the size of the buffer)\r\n  if extraField!=NULL, the extra field information will be copied in extraField\r\n            (extraFieldBufferSize is the size of the buffer).\r\n            This is the Central-header version of the extra field\r\n  if szComment!=NULL, the comment string of the file will be copied in szComment\r\n            (commentBufferSize is the size of the buffer)\r\n*/\r\n\r\n\r\n/** Addition for GDAL : START */\r\n\r\nextern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));\r\n\r\n/** Addition for GDAL : END */\r\n\r\n\r\n/***************************************************************************/\r\n/* for reading the content of the current zipfile, you can open it, read data\r\n   from it, and close it (you can close it before reading all the file)\r\n   */\r\n\r\nextern int ZEXPORT unzOpenCurrentFile OF((unzFile file));\r\n/*\r\n  Open for reading data the current file in the zipfile.\r\n  If there is no error, the return value is UNZ_OK.\r\n*/\r\n\r\nextern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,\r\n                                                  const char* password));\r\n/*\r\n  Open for reading data the current file in the zipfile.\r\n  password is a crypting password\r\n  If there is no error, the return value is UNZ_OK.\r\n*/\r\n\r\nextern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,\r\n                                           int* method,\r\n                                           int* level,\r\n                                           int raw));\r\n/*\r\n  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)\r\n    if raw==1\r\n  *method will receive method of compression, *level will receive level of\r\n     compression\r\n  note : you can set level parameter as NULL (if you did not want known level,\r\n         but you CANNOT set method parameter as NULL\r\n*/\r\n\r\nextern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,\r\n                                           int* method,\r\n                                           int* level,\r\n                                           int raw,\r\n                                           const char* password));\r\n/*\r\n  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)\r\n    if raw==1\r\n  *method will receive method of compression, *level will receive level of\r\n     compression\r\n  note : you can set level parameter as NULL (if you did not want known level,\r\n         but you CANNOT set method parameter as NULL\r\n*/\r\n\r\n\r\nextern int ZEXPORT unzCloseCurrentFile OF((unzFile file));\r\n/*\r\n  Close the file in zip opened with unzOpenCurrentFile\r\n  Return UNZ_CRCERROR if all the file was read but the CRC is not good\r\n*/\r\n\r\nextern int ZEXPORT unzReadCurrentFile OF((unzFile file,\r\n                      voidp buf,\r\n                      unsigned len));\r\n/*\r\n  Read bytes from the current file (opened by unzOpenCurrentFile)\r\n  buf contain buffer where data must be copied\r\n  len the size of buf.\r\n\r\n  return the number of byte copied if somes bytes are copied\r\n  return 0 if the end of file was reached\r\n  return <0 with error code if there is an error\r\n    (UNZ_ERRNO for IO error, or zLib error for uncompress error)\r\n*/\r\n\r\nextern z_off_t ZEXPORT unztell OF((unzFile file));\r\n\r\nextern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));\r\n/*\r\n  Give the current position in uncompressed data\r\n*/\r\n\r\nextern int ZEXPORT unzeof OF((unzFile file));\r\n/*\r\n  return 1 if the end of file was reached, 0 elsewhere\r\n*/\r\n\r\nextern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,\r\n                                             voidp buf,\r\n                                             unsigned len));\r\n/*\r\n  Read extra field from the current file (opened by unzOpenCurrentFile)\r\n  This is the local-header version of the extra field (sometimes, there is\r\n    more info in the local-header version than in the central-header)\r\n\r\n  if buf==NULL, it return the size of the local extra field\r\n\r\n  if buf!=NULL, len is the size of the buffer, the extra header is copied in\r\n    buf.\r\n  the return value is the number of bytes copied in buf, or (if <0)\r\n    the error code\r\n*/\r\n\r\n/***************************************************************************/\r\n\r\n/* Get the current file offset */\r\nextern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file);\r\nextern uLong ZEXPORT unzGetOffset (unzFile file);\r\n\r\n/* Set the current file offset */\r\nextern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos);\r\nextern int ZEXPORT unzSetOffset (unzFile file, uLong pos);\r\n\r\n\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* _unz64_H */\r\n"
  },
  {
    "path": "Engine/libs/mono/cil/opcode.def",
    "content": "OPDEF(CEE_NOP, \"nop\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x00, NEXT)\r\nOPDEF(CEE_BREAK, \"break\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x01, ERROR)\r\nOPDEF(CEE_LDARG_0, \"ldarg.0\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x02, NEXT)\r\nOPDEF(CEE_LDARG_1, \"ldarg.1\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x03, NEXT)\r\nOPDEF(CEE_LDARG_2, \"ldarg.2\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x04, NEXT)\r\nOPDEF(CEE_LDARG_3, \"ldarg.3\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x05, NEXT)\r\nOPDEF(CEE_LDLOC_0, \"ldloc.0\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x06, NEXT)\r\nOPDEF(CEE_LDLOC_1, \"ldloc.1\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x07, NEXT)\r\nOPDEF(CEE_LDLOC_2, \"ldloc.2\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x08, NEXT)\r\nOPDEF(CEE_LDLOC_3, \"ldloc.3\", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x09, NEXT)\r\nOPDEF(CEE_STLOC_0, \"stloc.0\", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0A, NEXT)\r\nOPDEF(CEE_STLOC_1, \"stloc.1\", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0B, NEXT)\r\nOPDEF(CEE_STLOC_2, \"stloc.2\", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0C, NEXT)\r\nOPDEF(CEE_STLOC_3, \"stloc.3\", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0D, NEXT)\r\nOPDEF(CEE_LDARG_S, \"ldarg.s\", Pop0, Push1, ShortInlineVar, X, 1, 0xFF, 0x0E, NEXT)\r\nOPDEF(CEE_LDARGA_S, \"ldarga.s\", Pop0, PushI, ShortInlineVar, X, 1, 0xFF, 0x0F, NEXT)\r\nOPDEF(CEE_STARG_S, \"starg.s\", Pop1, Push0, ShortInlineVar, X, 1, 0xFF, 0x10, NEXT)\r\nOPDEF(CEE_LDLOC_S, \"ldloc.s\", Pop0, Push1, ShortInlineVar, X, 1, 0xFF, 0x11, NEXT)\r\nOPDEF(CEE_LDLOCA_S, \"ldloca.s\", Pop0, PushI, ShortInlineVar, X, 1, 0xFF, 0x12, NEXT)\r\nOPDEF(CEE_STLOC_S, \"stloc.s\", Pop1, Push0, ShortInlineVar, X, 1, 0xFF, 0x13, NEXT)\r\nOPDEF(CEE_LDNULL, \"ldnull\", Pop0, PushRef, InlineNone, X, 1, 0xFF, 0x14, NEXT)\r\nOPDEF(CEE_LDC_I4_M1, \"ldc.i4.m1\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x15, NEXT)\r\nOPDEF(CEE_LDC_I4_0, \"ldc.i4.0\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x16, NEXT)\r\nOPDEF(CEE_LDC_I4_1, \"ldc.i4.1\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x17, NEXT)\r\nOPDEF(CEE_LDC_I4_2, \"ldc.i4.2\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x18, NEXT)\r\nOPDEF(CEE_LDC_I4_3, \"ldc.i4.3\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x19, NEXT)\r\nOPDEF(CEE_LDC_I4_4, \"ldc.i4.4\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1A, NEXT)\r\nOPDEF(CEE_LDC_I4_5, \"ldc.i4.5\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1B, NEXT)\r\nOPDEF(CEE_LDC_I4_6, \"ldc.i4.6\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1C, NEXT)\r\nOPDEF(CEE_LDC_I4_7, \"ldc.i4.7\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1D, NEXT)\r\nOPDEF(CEE_LDC_I4_8, \"ldc.i4.8\", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1E, NEXT)\r\nOPDEF(CEE_LDC_I4_S, \"ldc.i4.s\", Pop0, PushI, ShortInlineI, X, 1, 0xFF, 0x1F, NEXT)\r\nOPDEF(CEE_LDC_I4, \"ldc.i4\", Pop0, PushI, InlineI, X, 1, 0xFF, 0x20, NEXT)\r\nOPDEF(CEE_LDC_I8, \"ldc.i8\", Pop0, PushI8, InlineI8, X, 1, 0xFF, 0x21, NEXT)\r\nOPDEF(CEE_LDC_R4, \"ldc.r4\", Pop0, PushR4, ShortInlineR, X, 1, 0xFF, 0x22, NEXT)\r\nOPDEF(CEE_LDC_R8, \"ldc.r8\", Pop0, PushR8, InlineR, X, 1, 0xFF, 0x23, NEXT)\r\nOPDEF(CEE_UNUSED99, \"unused99\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x24, NEXT)\r\nOPDEF(CEE_DUP, \"dup\", Pop1, Push1+Push1, InlineNone, X, 1, 0xFF, 0x25, NEXT)\r\nOPDEF(CEE_POP, \"pop\", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x26, NEXT)\r\nOPDEF(CEE_JMP, \"jmp\", Pop0, Push0, InlineMethod, X, 1, 0xFF, 0x27, CALL)\r\nOPDEF(CEE_CALL, \"call\", VarPop, VarPush, InlineMethod, X, 1, 0xFF, 0x28, CALL)\r\nOPDEF(CEE_CALLI, \"calli\", VarPop, VarPush, InlineSig, X, 1, 0xFF, 0x29, CALL)\r\nOPDEF(CEE_RET, \"ret\", VarPop, Push0, InlineNone, X, 1, 0xFF, 0x2A, RETURN)\r\nOPDEF(CEE_BR_S, \"br.s\", Pop0, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2B, BRANCH)\r\nOPDEF(CEE_BRFALSE_S, \"brfalse.s\", PopI, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2C, COND_BRANCH)\r\nOPDEF(CEE_BRTRUE_S, \"brtrue.s\", PopI, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2D, COND_BRANCH)\r\nOPDEF(CEE_BEQ_S, \"beq.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2E, COND_BRANCH)\r\nOPDEF(CEE_BGE_S, \"bge.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2F, COND_BRANCH)\r\nOPDEF(CEE_BGT_S, \"bgt.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x30, COND_BRANCH)\r\nOPDEF(CEE_BLE_S, \"ble.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x31, COND_BRANCH)\r\nOPDEF(CEE_BLT_S, \"blt.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x32, COND_BRANCH)\r\nOPDEF(CEE_BNE_UN_S, \"bne.un.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x33, COND_BRANCH)\r\nOPDEF(CEE_BGE_UN_S, \"bge.un.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x34, COND_BRANCH)\r\nOPDEF(CEE_BGT_UN_S, \"bgt.un.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x35, COND_BRANCH)\r\nOPDEF(CEE_BLE_UN_S, \"ble.un.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x36, COND_BRANCH)\r\nOPDEF(CEE_BLT_UN_S, \"blt.un.s\", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x37, COND_BRANCH)\r\nOPDEF(CEE_BR, \"br\", Pop0, Push0, InlineBrTarget, X, 1, 0xFF, 0x38, BRANCH)\r\nOPDEF(CEE_BRFALSE, \"brfalse\", PopI, Push0, InlineBrTarget, X, 1, 0xFF, 0x39, COND_BRANCH)\r\nOPDEF(CEE_BRTRUE, \"brtrue\", PopI, Push0, InlineBrTarget, X, 1, 0xFF, 0x3A, COND_BRANCH)\r\nOPDEF(CEE_BEQ, \"beq\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3B, COND_BRANCH)\r\nOPDEF(CEE_BGE, \"bge\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3C, COND_BRANCH)\r\nOPDEF(CEE_BGT, \"bgt\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3D, COND_BRANCH)\r\nOPDEF(CEE_BLE, \"ble\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3E, COND_BRANCH)\r\nOPDEF(CEE_BLT, \"blt\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3F, COND_BRANCH)\r\nOPDEF(CEE_BNE_UN, \"bne.un\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x40, COND_BRANCH)\r\nOPDEF(CEE_BGE_UN, \"bge.un\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x41, COND_BRANCH)\r\nOPDEF(CEE_BGT_UN, \"bgt.un\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x42, COND_BRANCH)\r\nOPDEF(CEE_BLE_UN, \"ble.un\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x43, COND_BRANCH)\r\nOPDEF(CEE_BLT_UN, \"blt.un\", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x44, COND_BRANCH)\r\nOPDEF(CEE_SWITCH, \"switch\", PopI, Push0, InlineSwitch, X, 1, 0xFF, 0x45, COND_BRANCH)\r\nOPDEF(CEE_LDIND_I1, \"ldind.i1\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x46, NEXT)\r\nOPDEF(CEE_LDIND_U1, \"ldind.u1\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x47, NEXT)\r\nOPDEF(CEE_LDIND_I2, \"ldind.i2\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x48, NEXT)\r\nOPDEF(CEE_LDIND_U2, \"ldind.u2\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x49, NEXT)\r\nOPDEF(CEE_LDIND_I4, \"ldind.i4\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4A, NEXT)\r\nOPDEF(CEE_LDIND_U4, \"ldind.u4\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4B, NEXT)\r\nOPDEF(CEE_LDIND_I8, \"ldind.i8\", PopI, PushI8, InlineNone, X, 1, 0xFF, 0x4C, NEXT)\r\nOPDEF(CEE_LDIND_I, \"ldind.i\", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4D, NEXT)\r\nOPDEF(CEE_LDIND_R4, \"ldind.r4\", PopI, PushR4, InlineNone, X, 1, 0xFF, 0x4E, NEXT)\r\nOPDEF(CEE_LDIND_R8, \"ldind.r8\", PopI, PushR8, InlineNone, X, 1, 0xFF, 0x4F, NEXT)\r\nOPDEF(CEE_LDIND_REF, \"ldind.ref\", PopI, PushRef, InlineNone, X, 1, 0xFF, 0x50, NEXT)\r\nOPDEF(CEE_STIND_REF, \"stind.ref\", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x51, NEXT)\r\nOPDEF(CEE_STIND_I1, \"stind.i1\", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x52, NEXT)\r\nOPDEF(CEE_STIND_I2, \"stind.i2\", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x53, NEXT)\r\nOPDEF(CEE_STIND_I4, \"stind.i4\", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x54, NEXT)\r\nOPDEF(CEE_STIND_I8, \"stind.i8\", PopI+PopI8, Push0, InlineNone, X, 1, 0xFF, 0x55, NEXT)\r\nOPDEF(CEE_STIND_R4, \"stind.r4\", PopI+PopR4, Push0, InlineNone, X, 1, 0xFF, 0x56, NEXT)\r\nOPDEF(CEE_STIND_R8, \"stind.r8\", PopI+PopR8, Push0, InlineNone, X, 1, 0xFF, 0x57, NEXT)\r\nOPDEF(CEE_ADD, \"add\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x58, NEXT)\r\nOPDEF(CEE_SUB, \"sub\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x59, NEXT)\r\nOPDEF(CEE_MUL, \"mul\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5A, NEXT)\r\nOPDEF(CEE_DIV, \"div\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5B, NEXT)\r\nOPDEF(CEE_DIV_UN, \"div.un\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5C, NEXT)\r\nOPDEF(CEE_REM, \"rem\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5D, NEXT)\r\nOPDEF(CEE_REM_UN, \"rem.un\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5E, NEXT)\r\nOPDEF(CEE_AND, \"and\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5F, NEXT)\r\nOPDEF(CEE_OR, \"or\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x60, NEXT)\r\nOPDEF(CEE_XOR, \"xor\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x61, NEXT)\r\nOPDEF(CEE_SHL, \"shl\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x62, NEXT)\r\nOPDEF(CEE_SHR, \"shr\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x63, NEXT)\r\nOPDEF(CEE_SHR_UN, \"shr.un\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x64, NEXT)\r\nOPDEF(CEE_NEG, \"neg\", Pop1, Push1, InlineNone, X, 1, 0xFF, 0x65, NEXT)\r\nOPDEF(CEE_NOT, \"not\", Pop1, Push1, InlineNone, X, 1, 0xFF, 0x66, NEXT)\r\nOPDEF(CEE_CONV_I1, \"conv.i1\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x67, NEXT)\r\nOPDEF(CEE_CONV_I2, \"conv.i2\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x68, NEXT)\r\nOPDEF(CEE_CONV_I4, \"conv.i4\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x69, NEXT)\r\nOPDEF(CEE_CONV_I8, \"conv.i8\", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x6A, NEXT)\r\nOPDEF(CEE_CONV_R4, \"conv.r4\", Pop1, PushR4, InlineNone, X, 1, 0xFF, 0x6B, NEXT)\r\nOPDEF(CEE_CONV_R8, \"conv.r8\", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0x6C, NEXT)\r\nOPDEF(CEE_CONV_U4, \"conv.u4\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x6D, NEXT)\r\nOPDEF(CEE_CONV_U8, \"conv.u8\", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x6E, NEXT)\r\nOPDEF(CEE_CALLVIRT, \"callvirt\", VarPop, VarPush, InlineMethod, X, 1, 0xFF, 0x6F, CALL)\r\nOPDEF(CEE_CPOBJ, \"cpobj\", PopI+PopI, Push0, InlineType, X, 1, 0xFF, 0x70, NEXT)\r\nOPDEF(CEE_LDOBJ, \"ldobj\", PopI, Push1, InlineType, X, 1, 0xFF, 0x71, NEXT)\r\nOPDEF(CEE_LDSTR, \"ldstr\", Pop0, PushRef, InlineString, X, 1, 0xFF, 0x72, NEXT)\r\nOPDEF(CEE_NEWOBJ, \"newobj\", VarPop, PushRef, InlineMethod, X, 1, 0xFF, 0x73, CALL)\r\nOPDEF(CEE_CASTCLASS, \"castclass\", PopRef, PushRef, InlineType, X, 1, 0xFF, 0x74, NEXT)\r\nOPDEF(CEE_ISINST, \"isinst\", PopRef, PushI, InlineType, X, 1, 0xFF, 0x75, NEXT)\r\nOPDEF(CEE_CONV_R_UN, \"conv.r.un\", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0x76, NEXT)\r\nOPDEF(CEE_UNUSED58, \"unused58\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x77, NEXT)\r\nOPDEF(CEE_UNUSED1, \"unused1\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x78, NEXT)\r\nOPDEF(CEE_UNBOX, \"unbox\", PopRef, PushI, InlineType, X, 1, 0xFF, 0x79, NEXT)\r\nOPDEF(CEE_THROW, \"throw\", PopRef, Push0, InlineNone, X, 1, 0xFF, 0x7A, ERROR)\r\nOPDEF(CEE_LDFLD, \"ldfld\", PopRef, Push1, InlineField, X, 1, 0xFF, 0x7B, NEXT)\r\nOPDEF(CEE_LDFLDA, \"ldflda\", PopRef, PushI, InlineField, X, 1, 0xFF, 0x7C, NEXT)\r\nOPDEF(CEE_STFLD, \"stfld\", PopRef+Pop1, Push0, InlineField, X, 1, 0xFF, 0x7D, NEXT)\r\nOPDEF(CEE_LDSFLD, \"ldsfld\", Pop0, Push1, InlineField, X, 1, 0xFF, 0x7E, NEXT)\r\nOPDEF(CEE_LDSFLDA, \"ldsflda\", Pop0, PushI, InlineField, X, 1, 0xFF, 0x7F, NEXT)\r\nOPDEF(CEE_STSFLD, \"stsfld\", Pop1, Push0, InlineField, X, 1, 0xFF, 0x80, NEXT)\r\nOPDEF(CEE_STOBJ, \"stobj\", PopI+Pop1, Push0, InlineType, X, 1, 0xFF, 0x81, NEXT)\r\nOPDEF(CEE_CONV_OVF_I1_UN, \"conv.ovf.i1.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x82, NEXT)\r\nOPDEF(CEE_CONV_OVF_I2_UN, \"conv.ovf.i2.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x83, NEXT)\r\nOPDEF(CEE_CONV_OVF_I4_UN, \"conv.ovf.i4.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x84, NEXT)\r\nOPDEF(CEE_CONV_OVF_I8_UN, \"conv.ovf.i8.un\", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x85, NEXT)\r\nOPDEF(CEE_CONV_OVF_U1_UN, \"conv.ovf.u1.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x86, NEXT)\r\nOPDEF(CEE_CONV_OVF_U2_UN, \"conv.ovf.u2.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x87, NEXT)\r\nOPDEF(CEE_CONV_OVF_U4_UN, \"conv.ovf.u4.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x88, NEXT)\r\nOPDEF(CEE_CONV_OVF_U8_UN, \"conv.ovf.u8.un\", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x89, NEXT)\r\nOPDEF(CEE_CONV_OVF_I_UN, \"conv.ovf.i.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x8A, NEXT)\r\nOPDEF(CEE_CONV_OVF_U_UN, \"conv.ovf.u.un\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x8B, NEXT)\r\nOPDEF(CEE_BOX, \"box\", Pop1, PushRef, InlineType, X, 1, 0xFF, 0x8C, NEXT)\r\nOPDEF(CEE_NEWARR, \"newarr\", PopI, PushRef, InlineType, X, 1, 0xFF, 0x8D, NEXT)\r\nOPDEF(CEE_LDLEN, \"ldlen\", PopRef, PushI, InlineNone, X, 1, 0xFF, 0x8E, NEXT)\r\nOPDEF(CEE_LDELEMA, \"ldelema\", PopRef+PopI, PushI, InlineType, X, 1, 0xFF, 0x8F, NEXT)\r\nOPDEF(CEE_LDELEM_I1, \"ldelem.i1\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x90, NEXT)\r\nOPDEF(CEE_LDELEM_U1, \"ldelem.u1\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x91, NEXT)\r\nOPDEF(CEE_LDELEM_I2, \"ldelem.i2\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x92, NEXT)\r\nOPDEF(CEE_LDELEM_U2, \"ldelem.u2\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x93, NEXT)\r\nOPDEF(CEE_LDELEM_I4, \"ldelem.i4\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x94, NEXT)\r\nOPDEF(CEE_LDELEM_U4, \"ldelem.u4\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x95, NEXT)\r\nOPDEF(CEE_LDELEM_I8, \"ldelem.i8\", PopRef+PopI, PushI8, InlineNone, X, 1, 0xFF, 0x96, NEXT)\r\nOPDEF(CEE_LDELEM_I, \"ldelem.i\", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x97, NEXT)\r\nOPDEF(CEE_LDELEM_R4, \"ldelem.r4\", PopRef+PopI, PushR4, InlineNone, X, 1, 0xFF, 0x98, NEXT)\r\nOPDEF(CEE_LDELEM_R8, \"ldelem.r8\", PopRef+PopI, PushR8, InlineNone, X, 1, 0xFF, 0x99, NEXT)\r\nOPDEF(CEE_LDELEM_REF, \"ldelem.ref\", PopRef+PopI, PushRef, InlineNone, X, 1, 0xFF, 0x9A, NEXT)\r\nOPDEF(CEE_STELEM_I, \"stelem.i\", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9B, NEXT)\r\nOPDEF(CEE_STELEM_I1, \"stelem.i1\", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9C, NEXT)\r\nOPDEF(CEE_STELEM_I2, \"stelem.i2\", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9D, NEXT)\r\nOPDEF(CEE_STELEM_I4, \"stelem.i4\", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9E, NEXT)\r\nOPDEF(CEE_STELEM_I8, \"stelem.i8\", PopRef+PopI+PopI8, Push0, InlineNone, X, 1, 0xFF, 0x9F, NEXT)\r\nOPDEF(CEE_STELEM_R4, \"stelem.r4\", PopRef+PopI+PopR4, Push0, InlineNone, X, 1, 0xFF, 0xA0, NEXT)\r\nOPDEF(CEE_STELEM_R8, \"stelem.r8\", PopRef+PopI+PopR8, Push0, InlineNone, X, 1, 0xFF, 0xA1, NEXT)\r\nOPDEF(CEE_STELEM_REF, \"stelem.ref\", PopRef+PopI+PopRef, Push0, InlineNone, X, 1, 0xFF, 0xA2, NEXT)\r\nOPDEF(CEE_LDELEM, \"ldelem\", PopRef+PopI, Push1, InlineType, X, 1, 0xFF, 0xA3, NEXT)\r\nOPDEF(CEE_STELEM, \"stelem\", PopRef+PopI+Pop1, Push0, InlineType, X, 1, 0xFF, 0xA4, NEXT)\r\nOPDEF(CEE_UNBOX_ANY, \"unbox.any\", PopRef, Push1, InlineType, X, 1, 0xFF, 0xA5, NEXT)\r\nOPDEF(CEE_UNUSED5, \"unused5\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA6, NEXT)\r\nOPDEF(CEE_UNUSED6, \"unused6\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA7, NEXT)\r\nOPDEF(CEE_UNUSED7, \"unused7\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA8, NEXT)\r\nOPDEF(CEE_UNUSED8, \"unused8\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA9, NEXT)\r\nOPDEF(CEE_UNUSED9, \"unused9\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAA, NEXT)\r\nOPDEF(CEE_UNUSED10, \"unused10\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAB, NEXT)\r\nOPDEF(CEE_UNUSED11, \"unused11\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAC, NEXT)\r\nOPDEF(CEE_UNUSED12, \"unused12\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAD, NEXT)\r\nOPDEF(CEE_UNUSED13, \"unused13\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAE, NEXT)\r\nOPDEF(CEE_UNUSED14, \"unused14\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAF, NEXT)\r\nOPDEF(CEE_UNUSED15, \"unused15\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB0, NEXT)\r\nOPDEF(CEE_UNUSED16, \"unused16\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB1, NEXT)\r\nOPDEF(CEE_UNUSED17, \"unused17\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB2, NEXT)\r\nOPDEF(CEE_CONV_OVF_I1, \"conv.ovf.i1\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB3, NEXT)\r\nOPDEF(CEE_CONV_OVF_U1, \"conv.ovf.u1\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB4, NEXT)\r\nOPDEF(CEE_CONV_OVF_I2, \"conv.ovf.i2\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB5, NEXT)\r\nOPDEF(CEE_CONV_OVF_U2, \"conv.ovf.u2\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB6, NEXT)\r\nOPDEF(CEE_CONV_OVF_I4, \"conv.ovf.i4\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB7, NEXT)\r\nOPDEF(CEE_CONV_OVF_U4, \"conv.ovf.u4\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB8, NEXT)\r\nOPDEF(CEE_CONV_OVF_I8, \"conv.ovf.i8\", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0xB9, NEXT)\r\nOPDEF(CEE_CONV_OVF_U8, \"conv.ovf.u8\", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0xBA, NEXT)\r\nOPDEF(CEE_UNUSED50, \"unused50\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBB, NEXT)\r\nOPDEF(CEE_UNUSED18, \"unused18\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBC, NEXT)\r\nOPDEF(CEE_UNUSED19, \"unused19\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBD, NEXT)\r\nOPDEF(CEE_UNUSED20, \"unused20\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBE, NEXT)\r\nOPDEF(CEE_UNUSED21, \"unused21\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBF, NEXT)\r\nOPDEF(CEE_UNUSED22, \"unused22\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC0, NEXT)\r\nOPDEF(CEE_UNUSED23, \"unused23\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC1, NEXT)\r\nOPDEF(CEE_REFANYVAL, \"refanyval\", Pop1, PushI, InlineType, X, 1, 0xFF, 0xC2, NEXT)\r\nOPDEF(CEE_CKFINITE, \"ckfinite\", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0xC3, NEXT)\r\nOPDEF(CEE_UNUSED24, \"unused24\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC4, NEXT)\r\nOPDEF(CEE_UNUSED25, \"unused25\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC5, NEXT)\r\nOPDEF(CEE_MKREFANY, \"mkrefany\", PopI, Push1, InlineType, X, 1, 0xFF, 0xC6, NEXT)\r\nOPDEF(CEE_UNUSED59, \"unused59\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC7, NEXT)\r\nOPDEF(CEE_UNUSED60, \"unused60\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC8, NEXT)\r\nOPDEF(CEE_UNUSED61, \"unused61\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC9, NEXT)\r\nOPDEF(CEE_UNUSED62, \"unused62\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCA, NEXT)\r\nOPDEF(CEE_UNUSED63, \"unused63\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCB, NEXT)\r\nOPDEF(CEE_UNUSED64, \"unused64\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCC, NEXT)\r\nOPDEF(CEE_UNUSED65, \"unused65\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCD, NEXT)\r\nOPDEF(CEE_UNUSED66, \"unused66\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCE, NEXT)\r\nOPDEF(CEE_UNUSED67, \"unused67\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCF, NEXT)\r\nOPDEF(CEE_LDTOKEN, \"ldtoken\", Pop0, PushI, InlineTok, X, 1, 0xFF, 0xD0, NEXT)\r\nOPDEF(CEE_CONV_U2, \"conv.u2\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD1, NEXT)\r\nOPDEF(CEE_CONV_U1, \"conv.u1\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD2, NEXT)\r\nOPDEF(CEE_CONV_I, \"conv.i\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD3, NEXT)\r\nOPDEF(CEE_CONV_OVF_I, \"conv.ovf.i\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD4, NEXT)\r\nOPDEF(CEE_CONV_OVF_U, \"conv.ovf.u\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD5, NEXT)\r\nOPDEF(CEE_ADD_OVF, \"add.ovf\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD6, NEXT)\r\nOPDEF(CEE_ADD_OVF_UN, \"add.ovf.un\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD7, NEXT)\r\nOPDEF(CEE_MUL_OVF, \"mul.ovf\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD8, NEXT)\r\nOPDEF(CEE_MUL_OVF_UN, \"mul.ovf.un\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD9, NEXT)\r\nOPDEF(CEE_SUB_OVF, \"sub.ovf\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xDA, NEXT)\r\nOPDEF(CEE_SUB_OVF_UN, \"sub.ovf.un\", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xDB, NEXT)\r\nOPDEF(CEE_ENDFINALLY, \"endfinally\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xDC, RETURN)\r\nOPDEF(CEE_LEAVE, \"leave\", Pop0, Push0, InlineBrTarget, X, 1, 0xFF, 0xDD, BRANCH)\r\nOPDEF(CEE_LEAVE_S, \"leave.s\", Pop0, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0xDE, BRANCH)\r\nOPDEF(CEE_STIND_I, \"stind.i\", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0xDF, NEXT)\r\nOPDEF(CEE_CONV_U, \"conv.u\", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xE0, NEXT)\r\nOPDEF(CEE_UNUSED26, \"unused26\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE1, NEXT)\r\nOPDEF(CEE_UNUSED27, \"unused27\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE2, NEXT)\r\nOPDEF(CEE_UNUSED28, \"unused28\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE3, NEXT)\r\nOPDEF(CEE_UNUSED29, \"unused29\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE4, NEXT)\r\nOPDEF(CEE_UNUSED30, \"unused30\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE5, NEXT)\r\nOPDEF(CEE_UNUSED31, \"unused31\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE6, NEXT)\r\nOPDEF(CEE_UNUSED32, \"unused32\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE7, NEXT)\r\nOPDEF(CEE_UNUSED33, \"unused33\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE8, NEXT)\r\nOPDEF(CEE_UNUSED34, \"unused34\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE9, NEXT)\r\nOPDEF(CEE_UNUSED35, \"unused35\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEA, NEXT)\r\nOPDEF(CEE_UNUSED36, \"unused36\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEB, NEXT)\r\nOPDEF(CEE_UNUSED37, \"unused37\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEC, NEXT)\r\nOPDEF(CEE_UNUSED38, \"unused38\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xED, NEXT)\r\nOPDEF(CEE_UNUSED39, \"unused39\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEE, NEXT)\r\nOPDEF(CEE_UNUSED40, \"unused40\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEF, NEXT)\r\nOPDEF(CEE_UNUSED41, \"unused41\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF0, NEXT)\r\nOPDEF(CEE_UNUSED42, \"unused42\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF1, NEXT)\r\nOPDEF(CEE_UNUSED43, \"unused43\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF2, NEXT)\r\nOPDEF(CEE_UNUSED44, \"unused44\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF3, NEXT)\r\nOPDEF(CEE_UNUSED45, \"unused45\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF4, NEXT)\r\nOPDEF(CEE_UNUSED46, \"unused46\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF5, NEXT)\r\nOPDEF(CEE_UNUSED47, \"unused47\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF6, NEXT)\r\nOPDEF(CEE_UNUSED48, \"unused48\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF7, NEXT)\r\nOPDEF(CEE_PREFIX7, \"prefix7\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF8, META)\r\nOPDEF(CEE_PREFIX6, \"prefix6\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF9, META)\r\nOPDEF(CEE_PREFIX5, \"prefix5\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFA, META)\r\nOPDEF(CEE_PREFIX4, \"prefix4\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFB, META)\r\nOPDEF(CEE_PREFIX3, \"prefix3\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFC, META)\r\nOPDEF(CEE_PREFIX2, \"prefix2\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFD, META)\r\nOPDEF(CEE_PREFIX1, \"prefix1\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFE, META)\r\nOPDEF(CEE_PREFIXREF, \"prefixref\", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFF, META)\r\nOPDEF(CEE_ARGLIST, \"arglist\", Pop0, PushI, InlineNone, X, 2, 0xFE, 0x00, NEXT)\r\nOPDEF(CEE_CEQ, \"ceq\", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x01, NEXT)\r\nOPDEF(CEE_CGT, \"cgt\", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x02, NEXT)\r\nOPDEF(CEE_CGT_UN, \"cgt.un\", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x03, NEXT)\r\nOPDEF(CEE_CLT, \"clt\", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x04, NEXT)\r\nOPDEF(CEE_CLT_UN, \"clt.un\", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x05, NEXT)\r\nOPDEF(CEE_LDFTN, \"ldftn\", Pop0, PushI, InlineMethod, X, 2, 0xFE, 0x06, NEXT)\r\nOPDEF(CEE_LDVIRTFTN, \"ldvirtftn\", PopRef, PushI, InlineMethod, X, 2, 0xFE, 0x07, NEXT)\r\nOPDEF(CEE_UNUSED56, \"unused56\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x08, NEXT)\r\nOPDEF(CEE_LDARG, \"ldarg\", Pop0, Push1, InlineVar, X, 2, 0xFE, 0x09, NEXT)\r\nOPDEF(CEE_LDARGA, \"ldarga\", Pop0, PushI, InlineVar, X, 2, 0xFE, 0x0A, NEXT)\r\nOPDEF(CEE_STARG, \"starg\", Pop1, Push0, InlineVar, X, 2, 0xFE, 0x0B, NEXT)\r\nOPDEF(CEE_LDLOC, \"ldloc\", Pop0, Push1, InlineVar, X, 2, 0xFE, 0x0C, NEXT)\r\nOPDEF(CEE_LDLOCA, \"ldloca\", Pop0, PushI, InlineVar, X, 2, 0xFE, 0x0D, NEXT)\r\nOPDEF(CEE_STLOC, \"stloc\", Pop1, Push0, InlineVar, X, 2, 0xFE, 0x0E, NEXT)\r\nOPDEF(CEE_LOCALLOC, \"localloc\", PopI, PushI, InlineNone, X, 2, 0xFE, 0x0F, NEXT)\r\nOPDEF(CEE_UNUSED57, \"unused57\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x10, NEXT)\r\nOPDEF(CEE_ENDFILTER, \"endfilter\", PopI, Push0, InlineNone, X, 2, 0xFE, 0x11, RETURN)\r\nOPDEF(CEE_UNALIGNED_, \"unaligned.\", Pop0, Push0, ShortInlineI, X, 2, 0xFE, 0x12, META)\r\nOPDEF(CEE_VOLATILE_, \"volatile.\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x13, META)\r\nOPDEF(CEE_TAIL_, \"tail.\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x14, META)\r\nOPDEF(CEE_INITOBJ, \"initobj\", PopI, Push0, InlineType, X, 2, 0xFE, 0x15, NEXT)\r\nOPDEF(CEE_CONSTRAINED_, \"constrained.\", Pop0, Push0, InlineType, X, 2, 0xFE, 0x16, META)\r\nOPDEF(CEE_CPBLK, \"cpblk\", PopI+PopI+PopI, Push0, InlineNone, X, 2, 0xFE, 0x17, NEXT)\r\nOPDEF(CEE_INITBLK, \"initblk\", PopI+PopI+PopI, Push0, InlineNone, X, 2, 0xFE, 0x18, NEXT)\r\nOPDEF(CEE_NO_, \"no.\", Pop0, Push0, ShortInlineI, X, 2, 0xFE, 0x19, NEXT)\r\nOPDEF(CEE_RETHROW, \"rethrow\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1A, ERROR)\r\nOPDEF(CEE_UNUSED, \"unused\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1B, NEXT)\r\nOPDEF(CEE_SIZEOF, \"sizeof\", Pop0, PushI, InlineType, X, 2, 0xFE, 0x1C, NEXT)\r\nOPDEF(CEE_REFANYTYPE, \"refanytype\", Pop1, PushI, InlineNone, X, 2, 0xFE, 0x1D, NEXT)\r\nOPDEF(CEE_READONLY_, \"readonly.\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1E, META)\r\nOPDEF(CEE_UNUSED53, \"unused53\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1F, NEXT)\r\nOPDEF(CEE_UNUSED54, \"unused54\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x20, NEXT)\r\nOPDEF(CEE_UNUSED55, \"unused55\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x21, NEXT)\r\nOPDEF(CEE_UNUSED70, \"unused70\", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x22, NEXT)\r\nOPDEF(CEE_ILLEGAL, \"illegal\", Pop0, Push0, InlineNone, X, 2, 0x00, 0x00, META)\r\nOPDEF(CEE_ENDMAC, \"endmac\", Pop0, Push0, InlineNone, X, 2, 0x00, 0x00, META)\r\nOPDEF(CEE_MONO_ICALL, \"mono_icall\", VarPop, VarPush, ShortInlineI, X, 2, 0xF0, 0x00, NEXT)\r\nOPDEF(CEE_MONO_OBJADDR, \"mono_objaddr\", Pop1, PushI, InlineNone, X, 2, 0xF0, 0x01, NEXT)\r\nOPDEF(CEE_MONO_LDPTR, \"mono_ldptr\", Pop0, PushI, InlineI, X, 2, 0xF0, 0x02, NEXT)\r\nOPDEF(CEE_MONO_VTADDR, \"mono_vtaddr\", Pop1, PushI, InlineNone, X, 2, 0xF0, 0x03, NEXT)\r\nOPDEF(CEE_MONO_NEWOBJ, \"mono_newobj\", Pop0, PushRef, InlineType, X, 2, 0xF0, 0x04, NEXT)\r\nOPDEF(CEE_MONO_RETOBJ, \"mono_retobj\", PopI, Push0, InlineType, X, 2, 0xF0, 0x05, RETURN)\r\nOPDEF(CEE_MONO_LDNATIVEOBJ, \"mono_ldnativeobj\", PopI, Push1, InlineType, X, 2, 0xF0, 0x06, RETURN)\r\nOPDEF(CEE_MONO_CISINST, \"mono_cisinst\", PopRef, Push1, InlineType, X, 2, 0xF0, 0x07, NEXT)\r\nOPDEF(CEE_MONO_CCASTCLASS, \"mono_ccastclass\", PopRef, Push1, InlineType, X, 2, 0xF0, 0x08, NEXT)\r\nOPDEF(CEE_MONO_SAVE_LMF, \"mono_save_lmf\", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x09, NEXT)\r\nOPDEF(CEE_MONO_RESTORE_LMF, \"mono_restore_lmf\", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x0A, NEXT)\r\nOPDEF(CEE_MONO_CLASSCONST, \"mono_classconst\", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0B, NEXT)\r\nOPDEF(CEE_MONO_NOT_TAKEN, \"mono_not_taken\", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x0C, NEXT)\r\nOPDEF(CEE_MONO_TLS, \"mono_tls\", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0D, NEXT)\r\nOPDEF(CEE_MONO_ICALL_ADDR, \"mono_icall_addr\", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0E, NEXT)\r\nOPDEF(CEE_MONO_DYN_CALL, \"mono_dyn_call\", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0F, NEXT)\r\n#ifndef OPALIAS\r\n#define _MONO_CIL_OPALIAS_DEFINED_\r\n#define OPALIAS(a,s,r)\r\n#endif\r\n\r\nOPALIAS(CEE_BRNULL,     \"brnull\",    CEE_BRFALSE)\r\nOPALIAS(CEE_BRNULL_S,   \"brnull.s\",  CEE_BRFALSE_S)\r\nOPALIAS(CEE_BRZERO,     \"brzero\",    CEE_BRFALSE)\r\nOPALIAS(CEE_BRZERO_S,   \"brzero.s\",  CEE_BRFALSE_S)\r\nOPALIAS(CEE_BRINST,     \"brinst\",    CEE_BRTRUE)\r\nOPALIAS(CEE_BRINST_S,   \"brinst.s\",  CEE_BRTRUE_S)\r\nOPALIAS(CEE_LDIND_U8,   \"ldind.u8\",  CEE_LDIND_I8)\r\nOPALIAS(CEE_LDELEM_U8,  \"ldelem.u8\", CEE_LDELEM_I8)\r\nOPALIAS(CEE_LDX_I4_MIX, \"ldc.i4.M1\", CEE_LDC_I4_M1)\r\nOPALIAS(CEE_ENDFAULT,   \"endfault\",  CEE_ENDFINALLY)\r\n\r\n#ifdef _MONO_CIL_OPALIAS_DEFINED_\r\n#undef OPALIAS\r\n#undef _MONO_CIL_OPALIAS_DEFINED_\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/mono/jit/jit.h",
    "content": "/*\r\n * Author:\r\n *   Dietmar Maurer (dietmar@ximian.com)\r\n *\r\n * (C) 2001, 2002, 2003 Ximian, Inc.\r\n */\r\n\r\n#ifndef _MONO_JIT_JIT_H_\r\n#define _MONO_JIT_JIT_H_\r\n\r\n#include <mono/metadata/appdomain.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nMonoDomain * \r\nmono_jit_init              (const char *file);\r\n\r\nMonoDomain * \r\nmono_jit_init_version      (const char *root_domain_name, const char *runtime_version);\r\n\r\nint\r\nmono_jit_exec              (MonoDomain *domain, MonoAssembly *assembly, \r\n\t\t\t    int argc, char *argv[]);\r\nvoid        \r\nmono_jit_cleanup           (MonoDomain *domain);\r\n\r\nmono_bool\r\nmono_jit_set_trace_options (const char* options);\r\n\r\nvoid\r\nmono_set_signal_chaining   (mono_bool chain_signals);\r\n\r\nvoid\r\nmono_jit_set_aot_only      (mono_bool aot_only);\r\n\r\n/* Allow embedders to decide wherther to actually obey breakpoint instructions\r\n * in specific methods (works for both break IL instructions and Debugger.Break ()\r\n * method calls).\r\n */\r\ntypedef enum {\r\n\t/* the default is to always obey the breakpoint */\r\n\tMONO_BREAK_POLICY_ALWAYS,\r\n\t/* a nop is inserted instead of a breakpoint */\r\n\tMONO_BREAK_POLICY_NEVER,\r\n\t/* the breakpoint is executed only if the program has ben started under\r\n\t * the debugger (that is if a debugger was attached at the time the method\r\n\t * was compiled).\r\n\t */\r\n\tMONO_BREAK_POLICY_ON_DBG\r\n} MonoBreakPolicy;\r\n\r\ntypedef MonoBreakPolicy (*MonoBreakPolicyFunc) (MonoMethod *method);\r\nvoid mono_set_break_policy (MonoBreakPolicyFunc policy_callback);\r\n\r\nvoid\r\nmono_jit_parse_options     (int argc, char * argv[]);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/appdomain.h",
    "content": "/*\r\n * appdomain.h: AppDomain functions\r\n *\r\n * Author:\r\n *\tDietmar Maurer (dietmar@ximian.com)\r\n *\r\n * (C) 2001 Ximian, Inc.\r\n */\r\n\r\n#ifndef _MONO_METADATA_APPDOMAIN_H_\r\n#define _MONO_METADATA_APPDOMAIN_H_\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\n#include <mono/metadata/object.h>\r\n#include <mono/metadata/reflection.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef void (*MonoThreadStartCB) (intptr_t tid, void* stack_start,\r\n\t\t\t\t   void* func);\r\ntypedef void (*MonoThreadAttachCB) (intptr_t tid, void* stack_start);\r\n\r\ntypedef struct _MonoAppDomain MonoAppDomain;\r\ntypedef struct _MonoJitInfo MonoJitInfo;\r\n\r\ntypedef void (*MonoDomainFunc) (MonoDomain *domain, void* user_data);\r\n\r\nMonoDomain*\r\nmono_init                  (const char *filename);\r\n\r\nMonoDomain *\r\nmono_init_from_assembly    (const char *domain_name, const char *filename);\r\n\r\nMonoDomain *\r\nmono_init_version          (const char *domain_name, const char *version);\r\n\r\nMonoDomain*\r\nmono_get_root_domain       (void);\r\n\r\nvoid\r\nmono_runtime_init          (MonoDomain *domain, MonoThreadStartCB start_cb,\r\n\t\t\t    MonoThreadAttachCB attach_cb);\r\n\r\nvoid\r\nmono_runtime_cleanup       (MonoDomain *domain);\r\n\r\nvoid\r\nmono_install_runtime_cleanup (MonoDomainFunc func);\r\n\r\nvoid\r\nmono_runtime_quit (void);\r\n\r\nvoid\r\nmono_runtime_set_shutting_down (void);\r\n\r\nmono_bool\r\nmono_runtime_is_shutting_down (void);\r\n\r\nconst char*\r\nmono_check_corlib_version (void);\r\n\r\nMonoDomain *\r\nmono_domain_create         (void);\r\n\r\nMonoDomain *\r\nmono_domain_create_appdomain (char *friendly_name, char *configuration_file);\r\n\r\nMonoDomain *\r\nmono_domain_get            (void);\r\n\r\nMonoDomain *\r\nmono_domain_get_by_id      (int32_t domainid);\r\n\r\nint32_t\r\nmono_domain_get_id         (MonoDomain *domain);\r\n\r\nmono_bool\r\nmono_domain_set            (MonoDomain *domain, mono_bool force);\r\n\r\nvoid\r\nmono_domain_set_internal   (MonoDomain *domain);\r\n\r\nvoid\r\nmono_domain_unload (MonoDomain *domain);\r\n\r\nvoid\r\nmono_domain_try_unload (MonoDomain *domain, MonoObject **exc);\r\n\r\nmono_bool\r\nmono_domain_is_unloading   (MonoDomain *domain);\r\n\r\nMonoDomain *\r\nmono_domain_from_appdomain (MonoAppDomain *appdomain);\r\n\r\nvoid\r\nmono_domain_foreach        (MonoDomainFunc func, void* user_data);\r\n\r\nMonoAssembly *\r\nmono_domain_assembly_open  (MonoDomain *domain, const char *name);\r\n\r\nmono_bool\r\nmono_domain_finalize       (MonoDomain *domain, uint32_t timeout);\r\n\r\nvoid\r\nmono_domain_free           (MonoDomain *domain, mono_bool force);\r\n\r\nmono_bool\r\nmono_domain_has_type_resolve (MonoDomain *domain);\r\n\r\nMonoReflectionAssembly *\r\nmono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb);\r\n\r\nmono_bool\r\nmono_domain_owns_vtable_slot (MonoDomain *domain, void* vtable_slot);\r\n\r\nvoid\r\nmono_context_init \t\t\t\t   (MonoDomain *domain);\r\n\r\nvoid \r\nmono_context_set\t\t\t\t   (MonoAppContext *new_context);\r\n\r\nMonoAppContext * \r\nmono_context_get\t\t\t\t   (void);\r\n\r\nMonoJitInfo *\r\nmono_jit_info_table_find   (MonoDomain *domain, char *addr);\r\n\r\n/* MonoJitInfo accessors */\r\n\r\nvoid*\r\nmono_jit_info_get_code_start (MonoJitInfo* ji);\r\n\r\nint\r\nmono_jit_info_get_code_size (MonoJitInfo* ji);\r\n\r\nMonoMethod*\r\nmono_jit_info_get_method (MonoJitInfo* ji);\r\n\r\n\r\nMonoImage*\r\nmono_get_corlib            (void);\r\n\r\nMonoClass*\r\nmono_get_object_class      (void);\r\n\r\nMonoClass*\r\nmono_get_byte_class        (void);\r\n\r\nMonoClass*\r\nmono_get_void_class        (void);\r\n\r\nMonoClass*\r\nmono_get_boolean_class     (void);\r\n\r\nMonoClass*\r\nmono_get_sbyte_class       (void);\r\n\r\nMonoClass*\r\nmono_get_int16_class       (void);\r\n\r\nMonoClass*\r\nmono_get_uint16_class      (void);\r\n\r\nMonoClass*\r\nmono_get_int32_class       (void);\r\n\r\nMonoClass*\r\nmono_get_uint32_class      (void);\r\n\r\nMonoClass*\r\nmono_get_intptr_class         (void);\r\n\r\nMonoClass*\r\nmono_get_uintptr_class        (void);\r\n\r\nMonoClass*\r\nmono_get_int64_class       (void);\r\n\r\nMonoClass*\r\nmono_get_uint64_class      (void);\r\n\r\nMonoClass*\r\nmono_get_single_class      (void);\r\n\r\nMonoClass*\r\nmono_get_double_class      (void);\r\n\r\nMonoClass*\r\nmono_get_char_class        (void);\r\n\r\nMonoClass*\r\nmono_get_string_class      (void);\r\n\r\nMonoClass*\r\nmono_get_enum_class        (void);\r\n\r\nMonoClass*\r\nmono_get_array_class       (void);\r\n\r\nMonoClass*\r\nmono_get_thread_class       (void);\r\n\r\nMonoClass*\r\nmono_get_exception_class    (void);\r\n\r\nvoid\r\nmono_security_enable_core_clr (void);\r\n\r\ntypedef mono_bool (*MonoCoreClrPlatformCB) (const char *image_name);\r\n\r\nvoid\r\nmono_security_set_core_clr_platform_callback (MonoCoreClrPlatformCB callback);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* _MONO_METADATA_APPDOMAIN_H_ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/assembly.h",
    "content": "#ifndef _MONONET_METADATA_ASSEMBLY_H_ \r\n#define _MONONET_METADATA_ASSEMBLY_H_\r\n\r\n#include <mono/metadata/image.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nvoid          mono_assemblies_init     (void);\r\nvoid          mono_assemblies_cleanup  (void);\r\nMonoAssembly *mono_assembly_open       (const char *filename,\r\n\t\t\t\t       \tMonoImageOpenStatus *status);\r\nMonoAssembly *mono_assembly_open_full (const char *filename,\r\n\t\t\t\t       \tMonoImageOpenStatus *status,\r\n\t\t\t\t\tmono_bool refonly);\r\nMonoAssembly* mono_assembly_load       (MonoAssemblyName *aname, \r\n                                       \tconst char       *basedir, \r\n\t\t\t\t     \tMonoImageOpenStatus *status);\r\nMonoAssembly* mono_assembly_load_full (MonoAssemblyName *aname, \r\n                                       \tconst char       *basedir, \r\n\t\t\t\t     \tMonoImageOpenStatus *status,\r\n\t\t\t\t\tmono_bool refonly);\r\nMonoAssembly* mono_assembly_load_from  (MonoImage *image, const char *fname,\r\n\t\t\t\t\tMonoImageOpenStatus *status);\r\nMonoAssembly* mono_assembly_load_from_full  (MonoImage *image, const char *fname,\r\n\t\t\t\t\tMonoImageOpenStatus *status,\r\n\t\t\t\t\tmono_bool refonly);\r\n\r\nMonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *status);\r\n\r\nMonoAssembly* mono_assembly_loaded     (MonoAssemblyName *aname);\r\nMonoAssembly* mono_assembly_loaded_full (MonoAssemblyName *aname, mono_bool refonly);\r\nvoid          mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname);\r\nvoid          mono_assembly_load_reference (MonoImage *image, int index);\r\nvoid          mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status);\r\nMonoImage*    mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx);\r\nvoid          mono_assembly_close      (MonoAssembly *assembly);\r\nvoid          mono_assembly_setrootdir (const char *root_dir);\r\nMONO_CONST_RETURN char *mono_assembly_getrootdir (void);\r\nvoid\t      mono_assembly_foreach    (MonoFunc func, void* user_data);\r\nvoid          mono_assembly_set_main   (MonoAssembly *assembly);\r\nMonoAssembly *mono_assembly_get_main   (void);\r\nMonoImage    *mono_assembly_get_image  (MonoAssembly *assembly);\r\nmono_bool      mono_assembly_fill_assembly_name (MonoImage *image, MonoAssemblyName *aname);\r\nmono_bool      mono_assembly_names_equal (MonoAssemblyName *l, MonoAssemblyName *r);\r\nchar*         mono_stringify_assembly_name (MonoAssemblyName *aname);\r\n\r\n/* Installs a function which is called each time a new assembly is loaded. */\r\ntypedef void  (*MonoAssemblyLoadFunc)         (MonoAssembly *assembly, void* user_data);\r\nvoid          mono_install_assembly_load_hook (MonoAssemblyLoadFunc func, void* user_data);\r\n\r\n/* \r\n * Installs a new function which is used to search the list of loaded \r\n * assemblies for a given assembly name.\r\n */\r\ntypedef MonoAssembly *(*MonoAssemblySearchFunc)         (MonoAssemblyName *aname, void* user_data);\r\nvoid          mono_install_assembly_search_hook (MonoAssemblySearchFunc func, void* user_data);\r\nvoid \t      mono_install_assembly_refonly_search_hook (MonoAssemblySearchFunc func, void* user_data);\r\n\r\nMonoAssembly* mono_assembly_invoke_search_hook (MonoAssemblyName *aname);\r\n\r\n/*\r\n * Installs a new search function which is used as a last resort when loading \r\n * an assembly fails. This could invoke AssemblyResolve events.\r\n */\r\nvoid          \r\nmono_install_assembly_postload_search_hook (MonoAssemblySearchFunc func, void* user_data);\r\n\r\nvoid          \r\nmono_install_assembly_postload_refonly_search_hook (MonoAssemblySearchFunc func, void* user_data);\r\n\r\n\r\n/* Installs a function which is called before a new assembly is loaded\r\n * The hook are invoked from last hooked to first. If any of them returns\r\n * a non-null value, that will be the value returned in mono_assembly_load */\r\ntypedef MonoAssembly * (*MonoAssemblyPreLoadFunc) (MonoAssemblyName *aname,\r\n\t\t\t\t\t\t   char **assemblies_path,\r\n\t\t\t\t\t\t   void* user_data);\r\n\r\nvoid          mono_install_assembly_preload_hook (MonoAssemblyPreLoadFunc func,\r\n\t\t\t\t\t\t  void* user_data);\r\nvoid          mono_install_assembly_refonly_preload_hook (MonoAssemblyPreLoadFunc func,\r\n\t\t\t\t\t\t  void* user_data);\r\n\r\nvoid          mono_assembly_invoke_load_hook (MonoAssembly *ass);\r\n\r\nMonoAssemblyName* mono_assembly_name_new             (const char *name);\r\nconst char*       mono_assembly_name_get_name        (MonoAssemblyName *aname);\r\nconst char*       mono_assembly_name_get_culture     (MonoAssemblyName *aname);\r\nuint16_t          mono_assembly_name_get_version     (MonoAssemblyName *aname,\r\n\t\t\t\t\t\t      uint16_t *minor, uint16_t *build, uint16_t *revision);\r\nmono_byte*        mono_assembly_name_get_pubkeytoken (MonoAssemblyName *aname);\r\nvoid              mono_assembly_name_free            (MonoAssemblyName *aname);\r\n\r\ntypedef struct {\r\n\tconst char *name;\r\n\tconst unsigned char *data;\r\n\tconst unsigned int size;\r\n} MonoBundledAssembly;\r\n\r\nvoid          mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies);\r\nvoid          mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);\r\nvoid          mono_register_symfile_for_assembly (const char* assembly_name, const mono_byte *raw_contents, int size);\r\nvoid\t      mono_register_machine_config (const char *config_xml);\r\n\r\nvoid          mono_set_rootdir (void);\r\nvoid          mono_set_dirs (const char *assembly_dir, const char *config_dir);\r\nvoid          mono_set_assemblies_path (const char* path);\r\nMONO_END_DECLS\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/attrdefs.h",
    "content": "/*\r\n * attredefs.h: This file contains the various definitions for constants\r\n * found on the metadata tables\r\n *\r\n * Author:\r\n *   Miguel de Icaza (miguel@ximian.com)\r\n *   Paolo Molaro (lupus@ximian.com)\r\n *\r\n * (C) 2001 Ximian, Inc.\r\n * (C) 2006 Novell, Inc.\r\n *\r\n * From the ECMA documentation\r\n */\r\n \r\n#ifndef _MONO_METADATA_ATTRDEFS_H_\r\n#define\t_MONO_METADATA_ATTRDEFS_H_\r\n\r\n/*\r\n * 23.1.1  Values for AssemblyHashAlgorithm \r\n */\r\nenum {\r\n\tMONO_ASSEMBLY_HASH_NONE,\r\n\tMONO_ASSEMBLY_HASH_MD5  = 0x8003,\r\n\tMONO_ASSEMBLY_HASH_SHA1 = 0x8004\r\n};\r\n\r\n/*\r\n * 23.1.2 AssemblyRefs\r\n */\r\nenum {\r\n\tMONO_ASSEMBLYREF_FULL_PUBLIC_KEY = 0x0001,\r\n\tMONO_ASSEMBLYREF_RETARGETABLE    = 0x0100,\r\n\tMONO_ASSEMBLYREF_JIT_TRACKING    = 0x8000,\r\n\tMONO_ASSEMBLYREF_NO_JIT_OPT      = 0x4000\r\n};\r\n\r\n/*\r\n * 23.1.4 Flags for Event.EventAttributes\r\n */\r\nenum {\r\n\tMONO_EVENT_SPECIALNAME   = 0x0200,\r\n\tMONO_EVENT_RTSPECIALNAME = 0x0400\r\n};\r\n\r\n/*\r\n * Field Attributes (23.1.5).\r\n */\r\nenum {\r\n\tMONO_FIELD_ATTR_FIELD_ACCESS_MASK     = 0x0007,\r\n\tMONO_FIELD_ATTR_COMPILER_CONTROLLED   = 0x0000,\r\n\tMONO_FIELD_ATTR_PRIVATE               = 0x0001,\r\n\tMONO_FIELD_ATTR_FAM_AND_ASSEM         = 0x0002,\r\n\tMONO_FIELD_ATTR_ASSEMBLY              = 0x0003,\r\n\tMONO_FIELD_ATTR_FAMILY                = 0x0004,\r\n\tMONO_FIELD_ATTR_FAM_OR_ASSEM          = 0x0005,\r\n\tMONO_FIELD_ATTR_PUBLIC                = 0x0006,\r\n\r\n\tMONO_FIELD_ATTR_STATIC                = 0x0010,\r\n\tMONO_FIELD_ATTR_INIT_ONLY             = 0x0020,\r\n\tMONO_FIELD_ATTR_LITERAL               = 0x0040,\r\n\tMONO_FIELD_ATTR_NOT_SERIALIZED        = 0x0080,\r\n\tMONO_FIELD_ATTR_SPECIAL_NAME          = 0x0200,\r\n\tMONO_FIELD_ATTR_PINVOKE_IMPL          = 0x2000,\r\n\r\n/* For runtime use only */\r\n\tMONO_FIELD_ATTR_RESERVED_MASK         = 0x9500,\r\n\tMONO_FIELD_ATTR_RT_SPECIAL_NAME       = 0x0400,\r\n\tMONO_FIELD_ATTR_HAS_MARSHAL           = 0x1000,\r\n\tMONO_FIELD_ATTR_HAS_DEFAULT           = 0x8000,\r\n\tMONO_FIELD_ATTR_HAS_RVA               = 0x0100\r\n};\r\n\r\n/*\r\n * 23.1.6 Flags for FileAttributes\r\n */\r\nenum {\r\n\tMONO_FILE_HAS_METADATA      = 0,\r\n\tMONO_FILE_HAS_NO_METADATA   = 1\r\n};\r\n\r\n/*\r\n * 23.1.7 Flags for generic parameters\r\n */\r\nenum {\r\n\tMONO_GEN_PARAM_VARIANCE_MASK    = 0x0003,\r\n\tMONO_GEN_PARAM_NON_VARIANT      = 0x0000,\r\n\tMONO_GEN_PARAM_VARIANT          = 0x0001,\r\n\tMONO_GEN_PARAM_COVARIANT        = 0x0002,\r\n\tMONO_GEN_PARAM_CONSTRAINT_MASK  = 0x001c,\r\n\tMONO_GEN_PARAM_CONSTRAINT_CLASS = 0x0004,\r\n\tMONO_GEN_PARAM_CONSTRAINT_VTYPE = 0x0008,\r\n\tMONO_GEN_PARAM_CONSTRAINT_DCTOR = 0x0010\r\n};\r\n\r\n/*\r\n * 23.1.8 Flags for ImplMap [PInvokeAttributes]\r\n */\r\nenum {\r\n\tMONO_PINVOKE_NO_MANGLE           = 0x0001,\r\n\tMONO_PINVOKE_CHAR_SET_MASK       = 0x0006,\r\n\tMONO_PINVOKE_CHAR_SET_NOT_SPEC   = 0x0000,\r\n\tMONO_PINVOKE_CHAR_SET_ANSI       = 0x0002,\r\n\tMONO_PINVOKE_CHAR_SET_UNICODE    = 0x0004,\r\n\tMONO_PINVOKE_CHAR_SET_AUTO       = 0x0006,\r\n\tMONO_PINVOKE_BEST_FIT_ENABLED    = 0x0010,\r\n\tMONO_PINVOKE_BEST_FIT_DISABLED   = 0x0020,\r\n\tMONO_PINVOKE_BEST_FIT_MASK       = 0x0030,\r\n\tMONO_PINVOKE_SUPPORTS_LAST_ERROR = 0x0040,\r\n\tMONO_PINVOKE_CALL_CONV_MASK      = 0x0700,\r\n\tMONO_PINVOKE_CALL_CONV_WINAPI    = 0x0100,\r\n\tMONO_PINVOKE_CALL_CONV_CDECL     = 0x0200,\r\n\tMONO_PINVOKE_CALL_CONV_STDCALL   = 0x0300,\r\n\tMONO_PINVOKE_CALL_CONV_THISCALL  = 0x0400,\r\n\tMONO_PINVOKE_CALL_CONV_FASTCALL  = 0x0500,\r\n\tMONO_PINVOKE_THROW_ON_UNMAPPABLE_ENABLED    = 0x1000,\r\n\tMONO_PINVOKE_THROW_ON_UNMAPPABLE_DISABLED   = 0x2000,\r\n\tMONO_PINVOKE_THROW_ON_UNMAPPABLE_MASK       = 0x3000,\r\n\tMONO_PINVOKE_CALL_CONV_GENERIC     = 0x0010,\r\n\tMONO_PINVOKE_CALL_CONV_GENERICINST = 0x000a\r\n};\r\n\r\n/*\r\n * 23.1.9 Flags for ManifestResource\r\n */\r\nenum {\r\n\tMONO_MANIFEST_RESOURCE_VISIBILITY_MASK    = 0x00000007,\r\n\tMONO_MANIFEST_RESOURCE_PUBLIC             = 0x00000001,\r\n\tMONO_MANIFEST_RESOURCE_PRIVATE            = 0x00000002\r\n};\r\n\r\n/*\r\n * Method Attributes (23.1.10)\r\n */\r\nenum {\r\n\tMONO_METHOD_ATTR_ACCESS_MASK               = 0x0007,\r\n\tMONO_METHOD_ATTR_COMPILER_CONTROLLED       = 0x0000,\r\n\tMONO_METHOD_ATTR_PRIVATE                   = 0x0001,\r\n\tMONO_METHOD_ATTR_FAM_AND_ASSEM             = 0x0002,\r\n\tMONO_METHOD_ATTR_ASSEM                     = 0x0003,\r\n\tMONO_METHOD_ATTR_FAMILY                    = 0x0004,\r\n\tMONO_METHOD_ATTR_FAM_OR_ASSEM              = 0x0005,\r\n\tMONO_METHOD_ATTR_PUBLIC                    = 0x0006,\r\n\r\n\tMONO_METHOD_ATTR_STATIC                    = 0x0010,\r\n\tMONO_METHOD_ATTR_FINAL                     = 0x0020,\r\n\tMONO_METHOD_ATTR_VIRTUAL                   = 0x0040,\r\n\tMONO_METHOD_ATTR_HIDE_BY_SIG               = 0x0080,\r\n\r\n\tMONO_METHOD_ATTR_VTABLE_LAYOUT_MASK        = 0x0100,\r\n\tMONO_METHOD_ATTR_REUSE_SLOT                = 0x0000,\r\n\tMONO_METHOD_ATTR_NEW_SLOT                  = 0x0100,\r\n\tMONO_METHOD_ATTR_STRICT                    = 0x0200,\r\n\tMONO_METHOD_ATTR_ABSTRACT                  = 0x0400,\r\n\r\n\tMONO_METHOD_ATTR_SPECIAL_NAME              = 0x0800,\r\n\r\n\tMONO_METHOD_ATTR_PINVOKE_IMPL              = 0x2000,\r\n\tMONO_METHOD_ATTR_UNMANAGED_EXPORT          = 0x0008,\r\n\r\n/*\r\n * For runtime use only\r\n */\r\n\tMONO_METHOD_ATTR_RESERVED_MASK             = 0xd000,\r\n\tMONO_METHOD_ATTR_RT_SPECIAL_NAME           = 0x1000,\r\n\tMONO_METHOD_ATTR_HAS_SECURITY              = 0x4000,\r\n\tMONO_METHOD_ATTR_REQUIRE_SEC_OBJECT        = 0x8000\r\n};\r\n\r\n/*\r\n * Method Impl Attributes (23.1.11)\r\n */\r\nenum {\r\n\tMONO_METHOD_IMPL_ATTR_CODE_TYPE_MASK       = 0x0003,\r\n\tMONO_METHOD_IMPL_ATTR_IL                   = 0x0000,\r\n\tMONO_METHOD_IMPL_ATTR_NATIVE               = 0x0001,\r\n\tMONO_METHOD_IMPL_ATTR_OPTIL                = 0x0002,\r\n\tMONO_METHOD_IMPL_ATTR_RUNTIME              = 0x0003,\r\n\r\n\tMONO_METHOD_IMPL_ATTR_MANAGED_MASK         = 0x0004,\r\n\tMONO_METHOD_IMPL_ATTR_UNMANAGED            = 0x0004,\r\n\tMONO_METHOD_IMPL_ATTR_MANAGED              = 0x0000,\r\n\r\n\tMONO_METHOD_IMPL_ATTR_FORWARD_REF          = 0x0010,\r\n\tMONO_METHOD_IMPL_ATTR_PRESERVE_SIG         = 0x0080,\r\n\tMONO_METHOD_IMPL_ATTR_INTERNAL_CALL        = 0x1000,\r\n\tMONO_METHOD_IMPL_ATTR_SYNCHRONIZED         = 0x0020,\r\n\tMONO_METHOD_IMPL_ATTR_NOINLINING           = 0x0008,\r\n\tMONO_METHOD_IMPL_ATTR_NOOPTIMIZATION       = 0x0040,\t\r\n\tMONO_METHOD_IMPL_ATTR_MAX_METHOD_IMPL_VAL  = 0xffff\r\n};\r\n\r\n/*\r\n * Method Semantics ([MethodSemanticAttributes]) 23.1.12,\r\n */\r\nenum {\r\n\tMONO_METHOD_SEMANTIC_SETTER    = 0x0001,\r\n\tMONO_METHOD_SEMANTIC_GETTER    = 0x0002,\r\n\tMONO_METHOD_SEMANTIC_OTHER     = 0x0004,\r\n\tMONO_METHOD_SEMANTIC_ADD_ON    = 0x0008,\r\n\tMONO_METHOD_SEMANTIC_REMOVE_ON = 0x0010,\r\n\tMONO_METHOD_SEMANTIC_FIRE      = 0x0020\r\n};\r\n\r\n/*\r\n * Flags for Params (23.1.13)\r\n */\r\nenum {\r\n\tMONO_PARAM_ATTR_IN                 = 0x0001,\r\n\tMONO_PARAM_ATTR_OUT                = 0x0002,\r\n\tMONO_PARAM_ATTR_OPTIONAL           = 0x0010,\r\n\tMONO_PARAM_ATTR_RESERVED_MASK      = 0xf000,\r\n\tMONO_PARAM_ATTR_HAS_DEFAULT        = 0x1000,\r\n\tMONO_PARAM_ATTR_HAS_MARSHAL        = 0x2000,\r\n\tMONO_PARAM_ATTR_UNUSED             = 0xcfe0\r\n};\r\n\r\n/*\r\n * 23.1.14 PropertyAttributes\r\n */\r\nenum {\r\n\tMONO_PROPERTY_ATTR_SPECIAL_NAME    = 0x0200,\r\n\tMONO_PROPERTY_ATTR_RESERVED_MASK   = 0xf400,\r\n\tMONO_PROPERTY_ATTR_RT_SPECIAL_NAME = 0x0400,\r\n\tMONO_PROPERTY_ATTR_HAS_DEFAULT     = 0x1000,\r\n\tMONO_PROPERTY_ATTR_UNUSED          = 0xe9ff\r\n};\r\n\r\n/*\r\n * Type Attributes (23.1.15).\r\n */\r\nenum {\r\n\tMONO_TYPE_ATTR_VISIBILITY_MASK       = 0x00000007,\r\n\tMONO_TYPE_ATTR_NOT_PUBLIC            = 0x00000000,\r\n\tMONO_TYPE_ATTR_PUBLIC                = 0x00000001,\r\n\tMONO_TYPE_ATTR_NESTED_PUBLIC         = 0x00000002,\r\n\tMONO_TYPE_ATTR_NESTED_PRIVATE        = 0x00000003,\r\n\tMONO_TYPE_ATTR_NESTED_FAMILY         = 0x00000004,\r\n\tMONO_TYPE_ATTR_NESTED_ASSEMBLY       = 0x00000005,\r\n\tMONO_TYPE_ATTR_NESTED_FAM_AND_ASSEM  = 0x00000006,\r\n\tMONO_TYPE_ATTR_NESTED_FAM_OR_ASSEM   = 0x00000007,\r\n\r\n\tMONO_TYPE_ATTR_LAYOUT_MASK           = 0x00000018,\r\n\tMONO_TYPE_ATTR_AUTO_LAYOUT           = 0x00000000,\r\n\tMONO_TYPE_ATTR_SEQUENTIAL_LAYOUT     = 0x00000008,\r\n\tMONO_TYPE_ATTR_EXPLICIT_LAYOUT       = 0x00000010,\r\n\r\n\tMONO_TYPE_ATTR_CLASS_SEMANTIC_MASK   = 0x00000020,\r\n\tMONO_TYPE_ATTR_CLASS                 = 0x00000000,\r\n\tMONO_TYPE_ATTR_INTERFACE             = 0x00000020,\r\n\r\n\tMONO_TYPE_ATTR_ABSTRACT              = 0x00000080,\r\n\tMONO_TYPE_ATTR_SEALED                = 0x00000100,\r\n\tMONO_TYPE_ATTR_SPECIAL_NAME          = 0x00000400,\r\n\r\n\tMONO_TYPE_ATTR_IMPORT                = 0x00001000,\r\n\tMONO_TYPE_ATTR_SERIALIZABLE          = 0x00002000,\r\n\r\n\tMONO_TYPE_ATTR_STRING_FORMAT_MASK    = 0x00030000,\r\n\tMONO_TYPE_ATTR_ANSI_CLASS            = 0x00000000,\r\n\tMONO_TYPE_ATTR_UNICODE_CLASS         = 0x00010000,\r\n\tMONO_TYPE_ATTR_AUTO_CLASS            = 0x00020000,\r\n\tMONO_TYPE_ATTR_CUSTOM_CLASS          = 0x00030000,\r\n\tMONO_TYPE_ATTR_CUSTOM_MASK           = 0x00c00000,\r\n\r\n\tMONO_TYPE_ATTR_BEFORE_FIELD_INIT     = 0x00100000,\r\n\tMONO_TYPE_ATTR_FORWARDER             = 0x00200000,\r\n\r\n\tMONO_TYPE_ATTR_RESERVED_MASK         = 0x00040800,\r\n\tMONO_TYPE_ATTR_RT_SPECIAL_NAME       = 0x00000800,\r\n\tMONO_TYPE_ATTR_HAS_SECURITY          = 0x00040000\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/blob.h",
    "content": "/*\r\n * blob.h: Definitions used to pull information out of the Blob\r\n *\r\n */\r\n#ifndef _MONO_METADATA_BLOB_H_\r\n#define _MONO_METADATA_BLOB_H_\r\n\r\n/*\r\n * Encoding for type signatures used in the Metadata\r\n */\r\ntypedef enum {\r\n\tMONO_TYPE_END        = 0x00,       /* End of List */\r\n\tMONO_TYPE_VOID       = 0x01,\r\n\tMONO_TYPE_BOOLEAN    = 0x02,\r\n\tMONO_TYPE_CHAR       = 0x03,\r\n\tMONO_TYPE_I1         = 0x04,\r\n\tMONO_TYPE_U1         = 0x05,\r\n\tMONO_TYPE_I2         = 0x06,\r\n\tMONO_TYPE_U2         = 0x07,\r\n\tMONO_TYPE_I4         = 0x08,\r\n\tMONO_TYPE_U4         = 0x09,\r\n\tMONO_TYPE_I8         = 0x0a,\r\n\tMONO_TYPE_U8         = 0x0b,\r\n\tMONO_TYPE_R4         = 0x0c,\r\n\tMONO_TYPE_R8         = 0x0d,\r\n\tMONO_TYPE_STRING     = 0x0e,\r\n\tMONO_TYPE_PTR        = 0x0f,       /* arg: <type> token */\r\n\tMONO_TYPE_BYREF      = 0x10,       /* arg: <type> token */\r\n\tMONO_TYPE_VALUETYPE  = 0x11,       /* arg: <type> token */\r\n\tMONO_TYPE_CLASS      = 0x12,       /* arg: <type> token */\r\n\tMONO_TYPE_VAR\t     = 0x13,\t   /* number */\r\n\tMONO_TYPE_ARRAY      = 0x14,       /* type, rank, boundsCount, bound1, loCount, lo1 */\r\n\tMONO_TYPE_GENERICINST= 0x15,\t   /* <type> <type-arg-count> <type-1> \\x{2026} <type-n> */\r\n\tMONO_TYPE_TYPEDBYREF = 0x16,\r\n\tMONO_TYPE_I          = 0x18,\r\n\tMONO_TYPE_U          = 0x19,\r\n\tMONO_TYPE_FNPTR      = 0x1b,\t      /* arg: full method signature */\r\n\tMONO_TYPE_OBJECT     = 0x1c,\r\n\tMONO_TYPE_SZARRAY    = 0x1d,       /* 0-based one-dim-array */\r\n\tMONO_TYPE_MVAR\t     = 0x1e,       /* number */\r\n\tMONO_TYPE_CMOD_REQD  = 0x1f,       /* arg: typedef or typeref token */\r\n\tMONO_TYPE_CMOD_OPT   = 0x20,       /* optional arg: typedef or typref token */\r\n\tMONO_TYPE_INTERNAL   = 0x21,       /* CLR internal type */\r\n\r\n\tMONO_TYPE_MODIFIER   = 0x40,       /* Or with the following types */\r\n\tMONO_TYPE_SENTINEL   = 0x41,       /* Sentinel for varargs method signature */\r\n\tMONO_TYPE_PINNED     = 0x45,       /* Local var that points to pinned object */\r\n\r\n\tMONO_TYPE_ENUM       = 0x55        /* an enumeration */\r\n} MonoTypeEnum;\r\n\r\ntypedef enum {\r\n\tMONO_TABLE_MODULE,\r\n\tMONO_TABLE_TYPEREF,\r\n\tMONO_TABLE_TYPEDEF,\r\n\tMONO_TABLE_FIELD_POINTER,\r\n\tMONO_TABLE_FIELD,\r\n\tMONO_TABLE_METHOD_POINTER,\r\n\tMONO_TABLE_METHOD,\r\n\tMONO_TABLE_PARAM_POINTER,\r\n\tMONO_TABLE_PARAM,\r\n\tMONO_TABLE_INTERFACEIMPL,\r\n\tMONO_TABLE_MEMBERREF, /* 0xa */\r\n\tMONO_TABLE_CONSTANT,\r\n\tMONO_TABLE_CUSTOMATTRIBUTE,\r\n\tMONO_TABLE_FIELDMARSHAL,\r\n\tMONO_TABLE_DECLSECURITY,\r\n\tMONO_TABLE_CLASSLAYOUT,\r\n\tMONO_TABLE_FIELDLAYOUT, /* 0x10 */\r\n\tMONO_TABLE_STANDALONESIG,\r\n\tMONO_TABLE_EVENTMAP,\r\n\tMONO_TABLE_EVENT_POINTER,\r\n\tMONO_TABLE_EVENT,\r\n\tMONO_TABLE_PROPERTYMAP,\r\n\tMONO_TABLE_PROPERTY_POINTER,\r\n\tMONO_TABLE_PROPERTY,\r\n\tMONO_TABLE_METHODSEMANTICS,\r\n\tMONO_TABLE_METHODIMPL,\r\n\tMONO_TABLE_MODULEREF, /* 0x1a */\r\n\tMONO_TABLE_TYPESPEC,\r\n\tMONO_TABLE_IMPLMAP,\r\n\tMONO_TABLE_FIELDRVA,\r\n\tMONO_TABLE_UNUSED6,\r\n\tMONO_TABLE_UNUSED7,\r\n\tMONO_TABLE_ASSEMBLY, /* 0x20 */\r\n\tMONO_TABLE_ASSEMBLYPROCESSOR,\r\n\tMONO_TABLE_ASSEMBLYOS,\r\n\tMONO_TABLE_ASSEMBLYREF,\r\n\tMONO_TABLE_ASSEMBLYREFPROCESSOR,\r\n\tMONO_TABLE_ASSEMBLYREFOS,\r\n\tMONO_TABLE_FILE,\r\n\tMONO_TABLE_EXPORTEDTYPE,\r\n\tMONO_TABLE_MANIFESTRESOURCE,\r\n\tMONO_TABLE_NESTEDCLASS,\r\n\tMONO_TABLE_GENERICPARAM, /* 0x2a */\r\n\tMONO_TABLE_METHODSPEC,\r\n\tMONO_TABLE_GENERICPARAMCONSTRAINT\r\n\r\n#define MONO_TABLE_LAST MONO_TABLE_GENERICPARAMCONSTRAINT\r\n#define MONO_TABLE_NUM (MONO_TABLE_LAST + 1)\r\n\r\n} MonoMetaTableEnum;\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/class.h",
    "content": "#ifndef _MONO_CLI_CLASS_H_\r\n#define _MONO_CLI_CLASS_H_\r\n\r\n#include <mono/metadata/metadata.h>\r\n#include <mono/metadata/image.h>\r\n#include <mono/metadata/loader.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef struct MonoVTable MonoVTable;\r\n\r\ntypedef struct _MonoClassField MonoClassField;\r\ntypedef struct _MonoProperty MonoProperty;\r\ntypedef struct _MonoEvent MonoEvent;\r\n\r\nMonoClass *\r\nmono_class_get             (MonoImage *image, uint32_t type_token);\r\n\r\nMonoClass *\r\nmono_class_get_full        (MonoImage *image, uint32_t type_token, MonoGenericContext *context);\r\n\r\nmono_bool\r\nmono_class_init            (MonoClass *klass);\r\n\r\nMonoVTable *\r\nmono_class_vtable          (MonoDomain *domain, MonoClass *klass);\r\n\r\nMonoClass *\r\nmono_class_from_name       (MonoImage *image, const char* name_space, const char *name);\r\n\r\nMonoClass *\r\nmono_class_from_name_case  (MonoImage *image, const char* name_space, const char *name);\r\n\r\nMonoMethod *\r\nmono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int param_count, int flags);\r\n\r\nMonoClass * \r\nmono_class_from_typeref    (MonoImage *image, uint32_t type_token);\r\n\r\nMonoClass *\r\nmono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, mono_bool is_mvar);\r\n\r\nMonoType*\r\nmono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context) /* MONO_DEPRECATED */;\r\n\r\nMonoMethod*\r\nmono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context);\r\n\r\nMonoMethod *\r\nmono_get_inflated_method (MonoMethod *method);\r\n\r\nMonoClassField*\r\nmono_field_from_token      (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context);\r\n\r\nMonoClass *\r\nmono_bounded_array_class_get (MonoClass *element_class, uint32_t rank, mono_bool bounded);\r\n\r\nMonoClass *\r\nmono_array_class_get       (MonoClass *element_class, uint32_t rank);\r\n\r\nMonoClass *\r\nmono_ptr_class_get         (MonoType *type);\r\n\r\nMonoClassField *\r\nmono_class_get_field       (MonoClass *klass, uint32_t field_token);\r\n\r\nMonoClassField *\r\nmono_class_get_field_from_name (MonoClass *klass, const char *name);\r\n\r\nuint32_t\r\nmono_class_get_field_token (MonoClassField *field);\r\n\r\nuint32_t\r\nmono_class_get_event_token (MonoEvent *event);\r\n\r\nMonoProperty*\r\nmono_class_get_property_from_name (MonoClass *klass, const char *name);\r\n\r\nuint32_t\r\nmono_class_get_property_token (MonoProperty *prop);\r\n\r\nint32_t\r\nmono_array_element_size    (MonoClass *ac);\r\n\r\nint32_t\r\nmono_class_instance_size   (MonoClass *klass);\r\n\r\nint32_t\r\nmono_class_array_element_size (MonoClass *klass);\r\n\r\nint32_t\r\nmono_class_data_size       (MonoClass *klass);\r\n\r\nint32_t\r\nmono_class_value_size      (MonoClass *klass, uint32_t *align);\r\n\r\nint32_t\r\nmono_class_min_align       (MonoClass *klass);\r\n\r\nMonoClass *\r\nmono_class_from_mono_type  (MonoType *type);\r\n\r\nmono_bool\r\nmono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc, \r\n\t\t\t\t\t\t   mono_bool check_interfaces);\r\n\r\nmono_bool\r\nmono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass);\r\n\r\nvoid*\r\nmono_ldtoken               (MonoImage *image, uint32_t token, MonoClass **retclass, MonoGenericContext *context);\r\n\r\nchar*         \r\nmono_type_get_name         (MonoType *type);\r\n\r\nMonoType*\r\nmono_type_get_underlying_type (MonoType *type);\r\n\r\n/* MonoClass accessors */\r\nMonoImage*\r\nmono_class_get_image         (MonoClass *klass);\r\n\r\nMonoClass*\r\nmono_class_get_element_class (MonoClass *klass);\r\n\r\nmono_bool\r\nmono_class_is_valuetype      (MonoClass *klass);\r\n\r\nmono_bool\r\nmono_class_is_enum          (MonoClass *klass);\r\n\r\nMonoType*\r\nmono_class_enum_basetype    (MonoClass *klass);\r\n\r\nMonoClass*\r\nmono_class_get_parent        (MonoClass *klass);\r\n\r\nMonoClass*\r\nmono_class_get_nesting_type  (MonoClass *klass);\r\n\r\nint\r\nmono_class_get_rank          (MonoClass *klass);\r\n\r\nuint32_t\r\nmono_class_get_flags         (MonoClass *klass);\r\n\r\nconst char*\r\nmono_class_get_name          (MonoClass *klass);\r\n\r\nconst char*\r\nmono_class_get_namespace     (MonoClass *klass);\r\n\r\nMonoType*\r\nmono_class_get_type          (MonoClass *klass);\r\n\r\nuint32_t\r\nmono_class_get_type_token    (MonoClass *klass);\r\n\r\nMonoType*\r\nmono_class_get_byref_type    (MonoClass *klass);\r\n\r\nint\r\nmono_class_num_fields        (MonoClass *klass);\r\n\r\nint\r\nmono_class_num_methods       (MonoClass *klass);\r\n\r\nint\r\nmono_class_num_properties    (MonoClass *klass);\r\n\r\nint\r\nmono_class_num_events        (MonoClass *klass);\r\n\r\nMonoClassField*\r\nmono_class_get_fields        (MonoClass* klass, void **iter);\r\n\r\nMonoMethod*\r\nmono_class_get_methods       (MonoClass* klass, void **iter);\r\n\r\nMonoProperty*\r\nmono_class_get_properties    (MonoClass* klass, void **iter);\r\n\r\nMonoEvent*\r\nmono_class_get_events        (MonoClass* klass, void **iter);\r\n\r\nMonoClass*\r\nmono_class_get_interfaces    (MonoClass* klass, void **iter);\r\n\r\nMonoClass*\r\nmono_class_get_nested_types  (MonoClass* klass, void **iter);\r\n\r\n/* MonoClassField accessors */\r\nconst char*\r\nmono_field_get_name   (MonoClassField *field);\r\n\r\nMonoType*\r\nmono_field_get_type   (MonoClassField *field);\r\n\r\nMonoClass*\r\nmono_field_get_parent (MonoClassField *field);\r\n\r\nuint32_t\r\nmono_field_get_flags  (MonoClassField *field);\r\n\r\nuint32_t\r\nmono_field_get_offset  (MonoClassField *field);\r\n\r\nconst char *\r\nmono_field_get_data  (MonoClassField *field);\r\n\r\n/* MonoProperty acessors */\r\nconst char*\r\nmono_property_get_name       (MonoProperty *prop);\r\n\r\nMonoMethod*\r\nmono_property_get_set_method (MonoProperty *prop);\r\n\r\nMonoMethod*\r\nmono_property_get_get_method (MonoProperty *prop);\r\n\r\nMonoClass*\r\nmono_property_get_parent     (MonoProperty *prop);\r\n\r\nuint32_t\r\nmono_property_get_flags      (MonoProperty *prop);\r\n\r\n/* MonoEvent accessors */\r\nconst char*\r\nmono_event_get_name          (MonoEvent *event);\r\n\r\nMonoMethod*\r\nmono_event_get_add_method    (MonoEvent *event);\r\n\r\nMonoMethod*\r\nmono_event_get_remove_method (MonoEvent *event);\r\n\r\nMonoMethod*\r\nmono_event_get_remove_method (MonoEvent *event);\r\n\r\nMonoMethod*\r\nmono_event_get_raise_method  (MonoEvent *event);\r\n\r\nMonoClass*\r\nmono_event_get_parent        (MonoEvent *event);\r\n\r\nuint32_t\r\nmono_event_get_flags         (MonoEvent *event);\r\n\r\nMonoMethod *\r\nmono_class_get_method_from_name (MonoClass *klass, const char *name, int param_count);\r\n\r\nchar *\r\nmono_class_name_from_token (MonoImage *image, uint32_t type_token);\r\n\r\nmono_bool\r\nmono_method_can_access_field (MonoMethod *method, MonoClassField *field);\r\n\r\nmono_bool\r\nmono_method_can_access_method (MonoMethod *method, MonoMethod *called);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* _MONO_CLI_CLASS_H_ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/debug-helpers.h",
    "content": "#ifndef __MONO_DEBUG_HELPERS_H__\r\n#define __MONO_DEBUG_HELPERS_H__\r\n\r\n#include <mono/metadata/class.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef struct MonoDisHelper MonoDisHelper;\r\n\r\ntypedef char* (*MonoDisIndenter) (MonoDisHelper *dh, MonoMethod *method, uint32_t ip_offset);\r\ntypedef char* (*MonoDisTokener)  (MonoDisHelper *dh, MonoMethod *method, uint32_t token);\r\n\r\nstruct MonoDisHelper {\r\n\tconst char *newline;\r\n\tconst char *label_format;\r\n\tconst char *label_target;\r\n\tMonoDisIndenter indenter;\r\n\tMonoDisTokener  tokener;\r\n\tvoid* user_data;\r\n};\r\n\r\nchar* mono_disasm_code_one (MonoDisHelper *dh, MonoMethod *method, const mono_byte *ip, const mono_byte** endp);\r\nchar* mono_disasm_code     (MonoDisHelper *dh, MonoMethod *method, const mono_byte *ip, const mono_byte* end);\r\n\r\ntypedef struct MonoMethodDesc MonoMethodDesc;\r\n\r\nchar*           mono_type_full_name (MonoType *type);\r\n\r\nchar*           mono_signature_get_desc (MonoMethodSignature *sig, mono_bool include_namespace);\r\n\r\nchar*           mono_context_get_desc (MonoGenericContext *context);\r\n\r\nMonoMethodDesc* mono_method_desc_new (const char *name, mono_bool include_namespace);\r\nMonoMethodDesc* mono_method_desc_from_method (MonoMethod *method);\r\nvoid            mono_method_desc_free (MonoMethodDesc *desc);\r\nmono_bool       mono_method_desc_match (MonoMethodDesc *desc, MonoMethod *method);\r\nmono_bool       mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method);\r\nMonoMethod*     mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass);\r\nMonoMethod*     mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image);\r\n\r\nchar*           mono_method_full_name (MonoMethod *method, mono_bool signature);\r\n\r\nchar*           mono_field_full_name (MonoClassField *field);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_DEBUG_HELPERS_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/debug-mono-symfile.h",
    "content": "/*\r\n * This header is only installed for use by the debugger:\r\n * the structures and the API declared here are not supported.\r\n */\r\n\r\n#ifndef __MONO_DEBUG_MONO_SYMFILE_H__\r\n#define __MONO_DEBUG_MONO_SYMFILE_H__\r\n\r\n#include <mono/metadata/class.h>\r\n#include <mono/metadata/reflection.h>\r\n#include <mono/metadata/mono-debug.h>\r\n\r\ntypedef struct MonoSymbolFileOffsetTable\tMonoSymbolFileOffsetTable;\r\ntypedef struct MonoSymbolFileLineNumberEntry\tMonoSymbolFileLineNumberEntry;\r\ntypedef struct MonoSymbolFileMethodAddress\tMonoSymbolFileMethodAddress;\r\ntypedef struct MonoSymbolFileDynamicTable\tMonoSymbolFileDynamicTable;\r\ntypedef struct MonoSymbolFileSourceEntry\tMonoSymbolFileSourceEntry;\r\ntypedef struct MonoSymbolFileMethodEntry\tMonoSymbolFileMethodEntry;\r\n\r\n/* Keep in sync with OffsetTable in mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs */\r\nstruct MonoSymbolFileOffsetTable {\r\n\tuint32_t _total_file_size;\r\n\tuint32_t _data_section_offset;\r\n\tuint32_t _data_section_size;\r\n\tuint32_t _compile_unit_count;\r\n\tuint32_t _compile_unit_table_offset;\r\n\tuint32_t _compile_unit_table_size;\r\n\tuint32_t _source_count;\r\n\tuint32_t _source_table_offset;\r\n\tuint32_t _source_table_size;\r\n\tuint32_t _method_count;\r\n\tuint32_t _method_table_offset;\r\n\tuint32_t _method_table_size;\r\n\tuint32_t _type_count;\r\n\tuint32_t _anonymous_scope_count;\r\n\tuint32_t _anonymous_scope_table_offset;\r\n\tuint32_t _anonymous_scope_table_size;\r\n\tuint32_t _line_number_table_line_base;\r\n\tuint32_t _line_number_table_line_range;\r\n\tuint32_t _line_number_table_opcode_base;\r\n\tuint32_t _is_aspx_source;\r\n};\r\n\r\nstruct MonoSymbolFileSourceEntry {\r\n\tuint32_t _index;\r\n\tuint32_t _data_offset;\r\n};\r\n\r\nstruct MonoSymbolFileMethodEntry {\r\n\tuint32_t _token;\r\n\tuint32_t _data_offset;\r\n\tuint32_t _line_number_table;\r\n};\r\n\r\nstruct MonoSymbolFileMethodAddress {\r\n\tuint32_t size;\r\n\tconst uint8_t *start_address;\r\n\tconst uint8_t *end_address;\r\n\tconst uint8_t *method_start_address;\r\n\tconst uint8_t *method_end_address;\r\n\tconst uint8_t *wrapper_address;\r\n\tuint32_t has_this;\r\n\tuint32_t num_params;\r\n\tuint32_t variable_table_offset;\r\n\tuint32_t type_table_offset;\r\n\tuint32_t num_line_numbers;\r\n\tuint32_t line_number_offset;\r\n\tuint8_t data [MONO_ZERO_LEN_ARRAY];\r\n};\r\n\r\nstruct _MonoDebugMethodInfo {\r\n\tMonoMethod *method;\r\n\tMonoDebugHandle *handle;\r\n\tuint32_t index;\r\n\tuint32_t data_offset;\r\n\tuint32_t lnt_offset;\r\n};\r\n\r\ntypedef struct {\r\n\tint parent;\r\n\tint type;\r\n\t/* IL offsets */\r\n\tint start_offset, end_offset;\r\n} MonoDebugCodeBlock;\r\n\r\ntypedef struct {\r\n\tchar *name;\r\n\tint index;\r\n\t/* Might be null for the main scope */\r\n\tMonoDebugCodeBlock *block;\r\n} MonoDebugLocalVar;\r\n\r\n/*\r\n * Information about local variables retrieved from a symbol file.\r\n */\r\nstruct _MonoDebugLocalsInfo {\r\n\tint num_locals;\r\n\tMonoDebugLocalVar *locals;\r\n\tint num_blocks;\r\n\tMonoDebugCodeBlock *code_blocks;\r\n};\r\n\r\nstruct _MonoDebugLineNumberEntry {\r\n\tuint32_t il_offset;\r\n\tuint32_t native_offset;\r\n};\r\n\r\n#define MONO_SYMBOL_FILE_MAJOR_VERSION\t\t50\r\n#define MONO_SYMBOL_FILE_MINOR_VERSION\t\t0\r\n#define MONO_SYMBOL_FILE_MAGIC\t\t\t0x45e82623fd7fa614ULL\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nMonoSymbolFile *\r\nmono_debug_open_mono_symbols       (MonoDebugHandle          *handle,\r\n\t\t\t\t    const uint8_t            *raw_contents,\r\n\t\t\t\t    int                       size,\r\n\t\t\t\t    mono_bool                 in_the_debugger);\r\n\r\nvoid\r\nmono_debug_close_mono_symbol_file  (MonoSymbolFile           *symfile);\r\n\r\nmono_bool\r\nmono_debug_symfile_is_loaded       (MonoSymbolFile           *symfile);\r\n\r\nMonoDebugSourceLocation *\r\nmono_debug_symfile_lookup_location (MonoDebugMethodInfo      *minfo,\r\n\t\t\t\t    uint32_t                  offset);\r\n\r\nvoid\r\nmono_debug_symfile_free_location   (MonoDebugSourceLocation  *location);\r\n\r\nint32_t\r\n_mono_debug_address_from_il_offset (MonoDebugMethodJitInfo   *jit,\r\n\t\t\t\t    uint32_t                  il_offset);\r\n\r\nMonoDebugMethodInfo *\r\nmono_debug_symfile_lookup_method   (MonoDebugHandle          *handle,\r\n\t\t\t\t    MonoMethod               *method);\r\n\r\nMonoDebugLocalsInfo*\r\nmono_debug_symfile_lookup_locals (MonoDebugMethodInfo *minfo);\r\n\r\nvoid\r\nmono_debug_symfile_free_locals (MonoDebugLocalsInfo *info);\r\n\r\nvoid\r\nmono_debug_symfile_get_line_numbers (MonoDebugMethodInfo *minfo, char **source_file, int *n_il_offsets, int **il_offsets, int **line_numbers);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_SYMFILE_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/environment.h",
    "content": "/*\r\n * environment.h: System.Environment support internal calls\r\n *\r\n * Author:\r\n *\tDick Porter (dick@ximian.com)\r\n *\r\n * (C) 2002 Ximian, Inc\r\n */\r\n\r\n#ifndef _MONO_METADATA_ENVIRONMENT_H_\r\n#define _MONO_METADATA_ENVIRONMENT_H_\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nextern int32_t mono_environment_exitcode_get (void);\r\nextern void mono_environment_exitcode_set (int32_t value);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* _MONO_METADATA_ENVIRONMENT_H_ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/exception.h",
    "content": "#ifndef _MONO_METADATA_EXCEPTION_H_\r\n#define _MONO_METADATA_EXCEPTION_H_\r\n\r\n/* here for compat: should not be used anymore */\r\n#define MONO_ARCH_SAVE_REGS \r\n\r\n#include <mono/metadata/object.h>\r\n#include <mono/metadata/image.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nextern MonoException *\r\nmono_exception_from_name               (MonoImage *image, \r\n\t\t\t\t\tconst char* name_space, \r\n\t\t\t\t\tconst char *name);\r\n\r\nMonoException *\r\nmono_exception_from_token              (MonoImage *image, uint32_t token);\r\n\r\nMonoException *\r\nmono_exception_from_name_two_strings (MonoImage *image, const char *name_space,\r\n\t\t\t\t      const char *name, MonoString *a1, MonoString *a2);\r\n\r\nMonoException *\r\nmono_exception_from_name_msg\t       (MonoImage *image, const char *name_space,\r\n\t\t\t\t\tconst char *name, const char *msg);\r\n\r\nMonoException *\r\nmono_exception_from_token_two_strings (MonoImage *image, uint32_t token,\r\n\t\t\t\t\t\t   MonoString *a1, MonoString *a2);\r\n\r\nextern MonoException *\r\nmono_exception_from_name_domain        (MonoDomain *domain, MonoImage *image, \r\n\t\t\t\t\tconst char* name_space, \r\n\t\t\t\t\tconst char *name);\r\n\r\nMonoException *\r\nmono_get_exception_divide_by_zero      (void);\r\n\r\nMonoException *\r\nmono_get_exception_security            (void);\r\n\r\nMonoException *\r\nmono_get_exception_arithmetic          (void);\r\n\r\nMonoException *\r\nmono_get_exception_overflow            (void);\r\n\r\nMonoException *\r\nmono_get_exception_null_reference      (void);\r\n\r\nMonoException *\r\nmono_get_exception_execution_engine    (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_thread_abort        (void);\r\n\r\nMonoException *\r\nmono_get_exception_thread_state        (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_thread_interrupted  (void);\r\n\r\nMonoException *\r\nmono_get_exception_serialization       (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_invalid_cast        (void);\r\n\r\nMonoException *\r\nmono_get_exception_invalid_operation (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_index_out_of_range  (void);\r\n\r\nMonoException *\r\nmono_get_exception_array_type_mismatch (void);\r\n\r\nMonoException *\r\nmono_get_exception_type_load           (MonoString *class_name, char *assembly_name);\r\n\r\nMonoException *\r\nmono_get_exception_missing_method      (const char *class_name, const char *member_name);\r\n\r\nMonoException *\r\nmono_get_exception_missing_field       (const char *class_name, const char *member_name);\r\n\r\nMonoException *\r\nmono_get_exception_not_implemented     (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_not_supported       (const char *msg);\r\n\r\nMonoException*\r\nmono_get_exception_argument_null       (const char *arg);\r\n\r\nMonoException *\r\nmono_get_exception_argument            (const char *arg, const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_argument_out_of_range (const char *arg);\r\n\r\nMonoException *\r\nmono_get_exception_io                    (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_file_not_found        (MonoString *fname);\r\n\r\nMonoException *\r\nmono_get_exception_file_not_found2       (const char *msg, MonoString *fname);\r\n\r\nMonoException *\r\nmono_get_exception_type_initialization (const char *type_name, MonoException *inner);\r\n\r\nMonoException *\r\nmono_get_exception_synchronization_lock (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_cannot_unload_appdomain (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_appdomain_unloaded (void);\r\n\r\nMonoException *\r\nmono_get_exception_bad_image_format (const char *msg);\r\n\r\nMonoException *\r\nmono_get_exception_bad_image_format2 (const char *msg, MonoString *fname);\r\n\r\nMonoException *\r\nmono_get_exception_stack_overflow (void);\r\n\r\nMonoException *\r\nmono_get_exception_out_of_memory (void);\r\n\r\nMonoException *\r\nmono_get_exception_field_access (void);\r\n\r\nMonoException *\r\nmono_get_exception_method_access (void);\r\n\r\nMonoException *\r\nmono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions);\r\n\r\nMonoException *\r\nmono_get_exception_runtime_wrapped (MonoObject *wrapped_exception);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* _MONO_METADATA_EXCEPTION_H_ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/image.h",
    "content": "#ifndef _MONONET_METADATA_IMAGE_H_ \r\n#define _MONONET_METADATA_IMAGE_H_\r\n\r\n#include <stdio.h>\r\n#include <mono/utils/mono-publib.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef struct _MonoImage MonoImage;\r\ntypedef struct _MonoAssembly MonoAssembly;\r\ntypedef struct _MonoAssemblyName MonoAssemblyName;\r\ntypedef struct _MonoTableInfo MonoTableInfo;\r\n\r\ntypedef enum {\r\n\tMONO_IMAGE_OK,\r\n\tMONO_IMAGE_ERROR_ERRNO,\r\n\tMONO_IMAGE_MISSING_ASSEMBLYREF,\r\n\tMONO_IMAGE_IMAGE_INVALID\r\n} MonoImageOpenStatus;\r\n\r\nvoid          mono_images_init    (void);\r\nvoid          mono_images_cleanup (void);\r\n\r\nMonoImage    *mono_image_open     (const char *fname,\r\n\t\t\t\t   MonoImageOpenStatus *status);\r\nMonoImage    *mono_image_open_full (const char *fname,\r\n\t\t\t\t   MonoImageOpenStatus *status, mono_bool refonly);\r\nMonoImage    *mono_pe_file_open     (const char *fname,\r\n\t\t\t\t     MonoImageOpenStatus *status);\r\nMonoImage    *mono_image_open_from_data (char *data, uint32_t data_len, mono_bool need_copy,\r\n                                         MonoImageOpenStatus *status);\r\nMonoImage    *mono_image_open_from_data_full (char *data, uint32_t data_len, mono_bool need_copy,\r\n                                         MonoImageOpenStatus *status, mono_bool refonly);\r\nMonoImage    *mono_image_open_from_data_with_name (char *data, uint32_t data_len, mono_bool need_copy,\r\n                                                   MonoImageOpenStatus *status, mono_bool refonly, const char *name);\r\nvoid          mono_image_fixup_vtable (MonoImage *image);\r\nMonoImage    *mono_image_loaded   (const char *name);\r\nMonoImage    *mono_image_loaded_full   (const char *name, mono_bool refonly);\r\nMonoImage    *mono_image_loaded_by_guid (const char *guid);\r\nMonoImage    *mono_image_loaded_by_guid_full (const char *guid, mono_bool refonly);\r\nvoid          mono_image_init     (MonoImage *image);\r\nvoid          mono_image_close    (MonoImage *image);\r\nvoid          mono_image_addref   (MonoImage *image);\r\nconst char   *mono_image_strerror (MonoImageOpenStatus status);\r\n\r\nint           mono_image_ensure_section     (MonoImage *image,\r\n\t\t\t\t\t     const char *section);\r\nint           mono_image_ensure_section_idx (MonoImage *image,\r\n\t\t\t\t\t     int section);\r\n\r\nuint32_t       mono_image_get_entry_point    (MonoImage *image);\r\nconst char   *mono_image_get_resource       (MonoImage *image, uint32_t offset, uint32_t *size);\r\nMonoImage*    mono_image_load_file_for_image (MonoImage *image, int fileidx);\r\n\r\nMonoImage*    mono_image_load_module (MonoImage *image, int idx);\r\n\r\nconst char*   mono_image_get_name       (MonoImage *image);\r\nconst char*   mono_image_get_filename   (MonoImage *image);\r\nconst char *  mono_image_get_guid       (MonoImage *image);\r\nMonoAssembly* mono_image_get_assembly   (MonoImage *image);\r\nmono_bool     mono_image_is_dynamic     (MonoImage *image);\r\nchar*         mono_image_rva_map        (MonoImage *image, uint32_t rva);\r\n\r\nconst MonoTableInfo *mono_image_get_table_info (MonoImage *image, int table_id);\r\nint                  mono_image_get_table_rows (MonoImage *image, int table_id);\r\nint                  mono_table_info_get_rows  (const MonoTableInfo *table);\r\n\r\n/* This actually returns a MonoPEResourceDataEntry *, but declaring it\r\n * causes an include file loop.\r\n */\r\nvoid*      mono_image_lookup_resource (MonoImage *image, uint32_t res_id,\r\n\t\t\t\t\t  uint32_t lang_id, mono_unichar2 *name);\r\n\r\nconst char*   mono_image_get_public_key  (MonoImage *image, uint32_t *size);\r\nconst char*   mono_image_get_strong_name (MonoImage *image, uint32_t *size);\r\nuint32_t       mono_image_strong_name_position (MonoImage *image, uint32_t *size);\r\nvoid          mono_image_add_to_name_cache (MonoImage *image, \r\n\t\t\tconst char *nspace, const char *name, uint32_t idx);\r\nmono_bool     mono_image_has_authenticode_entry (MonoImage *image);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/loader.h",
    "content": "#ifndef _MONO_METADATA_LOADER_H_\r\n#define _MONO_METADATA_LOADER_H_ 1\r\n\r\n#include <mono/metadata/metadata.h>\r\n#include <mono/metadata/image.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef mono_bool (*MonoStackWalk)     (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data);\r\n\r\nMonoMethod *\r\nmono_get_method             (MonoImage *image, uint32_t token, MonoClass *klass);\r\n\r\nMonoMethod *\r\nmono_get_method_full        (MonoImage *image, uint32_t token, MonoClass *klass,\r\n\t\t\t     MonoGenericContext *context);\r\n\r\nMonoMethod *\r\nmono_get_method_constrained (MonoImage *image, uint32_t token, MonoClass *constrained_class,\r\n\t\t\t     MonoGenericContext *context, MonoMethod **cil_method);\r\n\r\nvoid               \r\nmono_free_method           (MonoMethod *method);\r\n\r\nMonoMethodSignature*\r\nmono_method_get_signature_full (MonoMethod *method, MonoImage *image, uint32_t token,\r\n\t\t\t\tMonoGenericContext *context);\r\n\r\nMonoMethodSignature* \r\nmono_method_get_signature  (MonoMethod *method, MonoImage *image, uint32_t token);\r\n\r\nMonoMethodSignature* \r\nmono_method_signature      (MonoMethod *method);\r\n\r\nMonoMethodHeader* \r\nmono_method_get_header     (MonoMethod *method);\r\n\r\nconst char*\r\nmono_method_get_name       (MonoMethod *method);\r\n\r\nMonoClass*\r\nmono_method_get_class      (MonoMethod *method);\r\n\r\nuint32_t\r\nmono_method_get_token      (MonoMethod *method);\r\n\r\nuint32_t\r\nmono_method_get_flags      (MonoMethod *method, uint32_t *iflags);\r\n\r\nuint32_t\r\nmono_method_get_index      (MonoMethod *method);\r\n\r\nMonoImage *\r\nmono_load_image            (const char *fname, MonoImageOpenStatus *status);\r\n\r\nvoid\r\nmono_add_internal_call     (const char *name, const void* method);\r\n\r\nvoid*\r\nmono_lookup_internal_call (MonoMethod *method);\r\n\r\nvoid\r\nmono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfunc);\r\n\r\nvoid*\r\nmono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char **exc_arg);\r\n\r\nvoid\r\nmono_method_get_param_names (MonoMethod *method, const char **names);\r\n\r\nuint32_t\r\nmono_method_get_param_token (MonoMethod *method, int idx);\r\n\r\nvoid\r\nmono_method_get_marshal_info (MonoMethod *method, MonoMarshalSpec **mspecs);\r\n\r\nmono_bool\r\nmono_method_has_marshal_info (MonoMethod *method);\r\n\r\nMonoMethod*\r\nmono_method_get_last_managed  (void);\r\n\r\nvoid\r\nmono_stack_walk         (MonoStackWalk func, void* user_data);\r\n\r\n/* Use this if the IL offset is not needed: it's faster */\r\nvoid\r\nmono_stack_walk_no_il   (MonoStackWalk func, void* user_data);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/metadata.h",
    "content": "\r\n#ifndef __MONO_METADATA_H__\r\n#define __MONO_METADATA_H__\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\n#include <mono/metadata/blob.h>\r\n#include <mono/metadata/row-indexes.h>\r\n#include <mono/metadata/image.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\n/*\r\n * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any\r\n * other Mono header file if you use a different compiler from the one used to\r\n * build Mono.\r\n */\r\n#ifndef MONO_ZERO_LEN_ARRAY\r\n#ifdef __GNUC__\r\n#define MONO_ZERO_LEN_ARRAY 0\r\n#else\r\n#define MONO_ZERO_LEN_ARRAY 1\r\n#endif\r\n#endif\r\n\r\n#define MONO_TYPE_ISSTRUCT(t) mono_type_is_struct (t)\r\n#define MONO_TYPE_IS_VOID(t) mono_type_is_void (t)\r\n#define MONO_TYPE_IS_POINTER(t) mono_type_is_pointer (t)\r\n#define MONO_TYPE_IS_REFERENCE(t) mono_type_is_reference (t)\r\n\r\n#define MONO_CLASS_IS_INTERFACE(c) ((c->flags & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))\r\n\r\n#define MONO_CLASS_IS_IMPORT(c) ((c->flags & TYPE_ATTRIBUTE_IMPORT))\r\n\r\ntypedef struct _MonoClass MonoClass;\r\ntypedef struct _MonoDomain MonoDomain;\r\ntypedef struct _MonoMethod MonoMethod;\r\n\r\ntypedef enum {\r\n\tMONO_EXCEPTION_CLAUSE_NONE,\r\n\tMONO_EXCEPTION_CLAUSE_FILTER,\r\n\tMONO_EXCEPTION_CLAUSE_FINALLY,\r\n\tMONO_EXCEPTION_CLAUSE_FAULT = 4\r\n} MonoExceptionEnum;\r\n\r\ntypedef enum {\r\n\tMONO_CALL_DEFAULT,\r\n\tMONO_CALL_C,\r\n\tMONO_CALL_STDCALL,\r\n\tMONO_CALL_THISCALL,\r\n\tMONO_CALL_FASTCALL,\r\n\tMONO_CALL_VARARG\r\n} MonoCallConvention;\r\n\r\n/* ECMA lamespec: the old spec had more info... */\r\ntypedef enum {\r\n\tMONO_NATIVE_BOOLEAN = 0x02, /* 4 bytes, 0 is false, != 0 is true */\r\n\tMONO_NATIVE_I1 = 0x03,\r\n\tMONO_NATIVE_U1 = 0x04,\r\n\tMONO_NATIVE_I2 = 0x05,\r\n\tMONO_NATIVE_U2 = 0x06,\r\n\tMONO_NATIVE_I4 = 0x07,\r\n\tMONO_NATIVE_U4 = 0x08,\r\n\tMONO_NATIVE_I8 = 0x09,\r\n\tMONO_NATIVE_U8 = 0x0a,\r\n\tMONO_NATIVE_R4 = 0x0b,\r\n\tMONO_NATIVE_R8 = 0x0c,\r\n\tMONO_NATIVE_CURRENCY = 0x0f,\r\n\tMONO_NATIVE_BSTR = 0x13, /* prefixed length, Unicode */\r\n\tMONO_NATIVE_LPSTR = 0x14, /* ANSI, null terminated */\r\n\tMONO_NATIVE_LPWSTR = 0x15, /* UNICODE, null terminated */\r\n\tMONO_NATIVE_LPTSTR = 0x16, /* plattform dep., null terminated */\r\n\tMONO_NATIVE_BYVALTSTR = 0x17,\r\n\tMONO_NATIVE_IUNKNOWN = 0x19,\r\n\tMONO_NATIVE_IDISPATCH = 0x1a,\r\n\tMONO_NATIVE_STRUCT = 0x1b,\r\n\tMONO_NATIVE_INTERFACE = 0x1c,\r\n\tMONO_NATIVE_SAFEARRAY = 0x1d,\r\n\tMONO_NATIVE_BYVALARRAY = 0x1e,\r\n\tMONO_NATIVE_INT   = 0x1f,\r\n\tMONO_NATIVE_UINT  = 0x20,\r\n\tMONO_NATIVE_VBBYREFSTR  = 0x22,\r\n\tMONO_NATIVE_ANSIBSTR  = 0x23,  /* prefixed length, ANSI */\r\n\tMONO_NATIVE_TBSTR  = 0x24, /* prefixed length, plattform dep. */\r\n\tMONO_NATIVE_VARIANTBOOL  = 0x25,\r\n\tMONO_NATIVE_FUNC  = 0x26,\r\n\tMONO_NATIVE_ASANY = 0x28,\r\n\tMONO_NATIVE_LPARRAY = 0x2a,\r\n\tMONO_NATIVE_LPSTRUCT = 0x2b,\r\n\tMONO_NATIVE_CUSTOM = 0x2c,\r\n\tMONO_NATIVE_ERROR = 0x2d,\r\n\tMONO_NATIVE_MAX = 0x50 /* no info */\r\n} MonoMarshalNative;\r\n\r\n/* Used only in context of SafeArray */\r\ntypedef enum {\r\n\tMONO_VARIANT_EMPTY = 0x00,\r\n\tMONO_VARIANT_NULL = 0x01,\r\n\tMONO_VARIANT_I2 = 0x02,\r\n\tMONO_VARIANT_I4 = 0x03,\r\n\tMONO_VARIANT_R4 = 0x04,\r\n\tMONO_VARIANT_R8 = 0x05,\r\n\tMONO_VARIANT_CY = 0x06,\r\n\tMONO_VARIANT_DATE = 0x07,\r\n\tMONO_VARIANT_BSTR = 0x08,\r\n\tMONO_VARIANT_DISPATCH = 0x09,\r\n\tMONO_VARIANT_ERROR = 0x0a,\r\n\tMONO_VARIANT_BOOL = 0x0b,\r\n\tMONO_VARIANT_VARIANT = 0x0c,\r\n\tMONO_VARIANT_UNKNOWN = 0x0d,\r\n\tMONO_VARIANT_DECIMAL = 0x0e,\r\n\tMONO_VARIANT_I1 = 0x10,\r\n\tMONO_VARIANT_UI1 = 0x11,\r\n\tMONO_VARIANT_UI2 = 0x12,\r\n\tMONO_VARIANT_UI4 = 0x13,\r\n\tMONO_VARIANT_I8 = 0x14,\r\n\tMONO_VARIANT_UI8 = 0x15,\r\n\tMONO_VARIANT_INT = 0x16,\r\n\tMONO_VARIANT_UINT = 0x17,\r\n\tMONO_VARIANT_VOID = 0x18,\r\n\tMONO_VARIANT_HRESULT = 0x19,\r\n\tMONO_VARIANT_PTR = 0x1a,\r\n\tMONO_VARIANT_SAFEARRAY = 0x1b,\r\n\tMONO_VARIANT_CARRAY = 0x1c,\r\n\tMONO_VARIANT_USERDEFINED = 0x1d,\r\n\tMONO_VARIANT_LPSTR = 0x1e,\r\n\tMONO_VARIANT_LPWSTR = 0x1f,\r\n\tMONO_VARIANT_RECORD = 0x24,\r\n\tMONO_VARIANT_FILETIME = 0x40,\r\n\tMONO_VARIANT_BLOB = 0x41,\r\n\tMONO_VARIANT_STREAM = 0x42,\r\n\tMONO_VARIANT_STORAGE = 0x43,\r\n\tMONO_VARIANT_STREAMED_OBJECT = 0x44,\r\n\tMONO_VARIANT_STORED_OBJECT = 0x45,\r\n\tMONO_VARIANT_BLOB_OBJECT = 0x46,\r\n\tMONO_VARIANT_CF = 0x47,\r\n\tMONO_VARIANT_CLSID = 0x48,\r\n\tMONO_VARIANT_VECTOR = 0x1000,\r\n\tMONO_VARIANT_ARRAY = 0x2000,\r\n\tMONO_VARIANT_BYREF = 0x4000\r\n} MonoMarshalVariant;\r\n\r\ntypedef enum {\r\n\tMONO_MARSHAL_CONV_NONE,\r\n\tMONO_MARSHAL_CONV_BOOL_VARIANTBOOL,\r\n\tMONO_MARSHAL_CONV_BOOL_I4,\r\n\tMONO_MARSHAL_CONV_STR_BSTR,\r\n\tMONO_MARSHAL_CONV_STR_LPSTR,\r\n\tMONO_MARSHAL_CONV_LPSTR_STR,\r\n\tMONO_MARSHAL_CONV_LPTSTR_STR,\r\n\tMONO_MARSHAL_CONV_STR_LPWSTR,\r\n\tMONO_MARSHAL_CONV_LPWSTR_STR,\r\n\tMONO_MARSHAL_CONV_STR_LPTSTR,\r\n\tMONO_MARSHAL_CONV_STR_ANSIBSTR,\r\n\tMONO_MARSHAL_CONV_STR_TBSTR,\r\n\tMONO_MARSHAL_CONV_STR_BYVALSTR,\r\n\tMONO_MARSHAL_CONV_STR_BYVALWSTR,\r\n\tMONO_MARSHAL_CONV_SB_LPSTR,\r\n\tMONO_MARSHAL_CONV_SB_LPTSTR,\r\n\tMONO_MARSHAL_CONV_SB_LPWSTR,\r\n\tMONO_MARSHAL_CONV_LPSTR_SB,\r\n\tMONO_MARSHAL_CONV_LPTSTR_SB,\r\n\tMONO_MARSHAL_CONV_LPWSTR_SB,\r\n\tMONO_MARSHAL_CONV_ARRAY_BYVALARRAY,\r\n\tMONO_MARSHAL_CONV_ARRAY_BYVALCHARARRAY,\r\n\tMONO_MARSHAL_CONV_ARRAY_SAVEARRAY,\r\n\tMONO_MARSHAL_CONV_ARRAY_LPARRAY,\r\n\tMONO_MARSHAL_FREE_LPARRAY,\r\n\tMONO_MARSHAL_CONV_OBJECT_INTERFACE,\r\n\tMONO_MARSHAL_CONV_OBJECT_IDISPATCH,\r\n\tMONO_MARSHAL_CONV_OBJECT_IUNKNOWN,\r\n\tMONO_MARSHAL_CONV_OBJECT_STRUCT,\r\n\tMONO_MARSHAL_CONV_DEL_FTN,\r\n\tMONO_MARSHAL_CONV_FTN_DEL,\r\n\tMONO_MARSHAL_FREE_ARRAY,\r\n\tMONO_MARSHAL_CONV_BSTR_STR,\r\n\tMONO_MARSHAL_CONV_SAFEHANDLE,\r\n\tMONO_MARSHAL_CONV_HANDLEREF\r\n} MonoMarshalConv;\r\n\r\ntypedef struct {\r\n\tMonoMarshalNative native;\r\n\tunion {\r\n\t\tstruct {\r\n\t\t\tMonoMarshalNative elem_type;\r\n\t\t\tint32_t num_elem; /* -1 if not set */\r\n\t\t\tint16_t param_num; /* -1 if not set */\r\n\t\t\tint16_t elem_mult; /* -1 if not set */\r\n\t\t} array_data;\r\n\t\tstruct {\r\n\t\t\tchar *custom_name;\r\n\t\t\tchar *cookie;\r\n\t\t} custom_data;\r\n\t\tstruct {\r\n\t\t\tMonoMarshalVariant elem_type;\r\n\t\t\tint32_t num_elem;\r\n\t\t} safearray_data;\r\n\t} data;\r\n} MonoMarshalSpec;\r\n\r\nvoid         mono_metadata_init (void);\r\n\r\nvoid         mono_metadata_decode_row (const MonoTableInfo   *t,\r\n\t\t\t\t       int                    idx,\r\n\t\t\t\t       uint32_t               *res,\r\n\t\t\t\t       int                    res_size);\r\n\r\nuint32_t      mono_metadata_decode_row_col (const MonoTableInfo *t, \r\n\t\t\t\t\t   int            idx, \r\n\t\t\t\t\t   unsigned int          col);\r\n\r\n/*\r\n * This macro is used to extract the size of the table encoded in\r\n * the size_bitfield of MonoTableInfo.\r\n */\r\n#define mono_metadata_table_size(bitfield,table) ((((bitfield) >> ((table)*2)) & 0x3) + 1)\r\n#define mono_metadata_table_count(bitfield) ((bitfield) >> 24)\r\n\r\nint mono_metadata_compute_size (MonoImage   *meta,\r\n                                int             tableindex,\r\n                                uint32_t        *result_bitfield);\r\n\r\n/*\r\n *\r\n */\r\nconst char    *mono_metadata_locate        (MonoImage *meta, int table, int idx);\r\nconst char    *mono_metadata_locate_token  (MonoImage *meta, uint32_t token);\r\n\t\t\t\t\t   \r\nconst char    *mono_metadata_string_heap   (MonoImage *meta, uint32_t table_index);\r\nconst char    *mono_metadata_blob_heap     (MonoImage *meta, uint32_t table_index);\r\nconst char    *mono_metadata_user_string   (MonoImage *meta, uint32_t table_index);\r\nconst char    *mono_metadata_guid_heap     (MonoImage *meta, uint32_t table_index);\r\n\r\nuint32_t mono_metadata_typedef_from_field  (MonoImage *meta, uint32_t table_index);\r\nuint32_t mono_metadata_typedef_from_method (MonoImage *meta, uint32_t table_index);\r\nuint32_t mono_metadata_nested_in_typedef   (MonoImage *meta, uint32_t table_index);\r\nuint32_t mono_metadata_nesting_typedef     (MonoImage *meta, uint32_t table_index, uint32_t start_index);\r\n\r\nMonoClass** mono_metadata_interfaces_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *count);\r\n\r\nuint32_t     mono_metadata_events_from_typedef     (MonoImage *meta, uint32_t table_index, unsigned int *end_idx);\r\nuint32_t     mono_metadata_methods_from_event      (MonoImage *meta, uint32_t table_index, unsigned int *end);\r\nuint32_t     mono_metadata_properties_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *end);\r\nuint32_t     mono_metadata_methods_from_property   (MonoImage *meta, uint32_t table_index, unsigned int *end);\r\nuint32_t     mono_metadata_packing_from_typedef    (MonoImage *meta, uint32_t table_index, uint32_t *packing, uint32_t *size);\r\nconst char* mono_metadata_get_marshal_info        (MonoImage *meta, uint32_t idx, mono_bool is_field);\r\nuint32_t     mono_metadata_custom_attrs_from_index (MonoImage *meta, uint32_t cattr_index);\r\n\r\nMonoMarshalSpec *mono_metadata_parse_marshal_spec (MonoImage *image, const char *ptr);\r\n\r\nvoid mono_metadata_free_marshal_spec (MonoMarshalSpec *spec);\r\n\r\nuint32_t     mono_metadata_implmap_from_method     (MonoImage *meta, uint32_t method_idx);\r\n\r\nvoid        mono_metadata_field_info (MonoImage *meta, \r\n\t\t\t\t      uint32_t       table_index,\r\n\t\t\t\t      uint32_t      *offset,\r\n\t\t\t\t      uint32_t      *rva,\r\n\t\t\t\t      MonoMarshalSpec **marshal_spec);\r\n\r\nuint32_t     mono_metadata_get_constant_index (MonoImage *meta, uint32_t token, uint32_t hint);\r\n\r\n/*\r\n * Functions to extract information from the Blobs\r\n */\r\nuint32_t mono_metadata_decode_value     (const char            *ptr,\r\n                                        const char           **rptr);\r\nint32_t mono_metadata_decode_signed_value (const char *ptr, const char **rptr);\r\n\r\nuint32_t mono_metadata_decode_blob_size (const char            *ptr,\r\n                                        const char           **rptr);\r\n\r\nvoid mono_metadata_encode_value (uint32_t value, char *bug, char **endbuf);\r\n\r\n#define MONO_OFFSET_IN_CLAUSE(clause,offset) \\\r\n\t((clause)->try_offset <= (offset) && (offset) < ((clause)->try_offset + (clause)->try_len))\r\n#define MONO_OFFSET_IN_HANDLER(clause,offset) \\\r\n\t((clause)->handler_offset <= (offset) && (offset) < ((clause)->handler_offset + (clause)->handler_len))\r\n#define MONO_OFFSET_IN_FILTER(clause,offset) \\\r\n\t((clause)->flags == MONO_EXCEPTION_CLAUSE_FILTER && (clause)->data.filter_offset <= (offset) && (offset) < ((clause)->handler_offset))\r\n\r\ntypedef struct {\r\n\tuint32_t flags;\r\n\tuint32_t try_offset;\r\n\tuint32_t try_len;\r\n\tuint32_t handler_offset;\r\n\tuint32_t handler_len;\r\n\tunion {\r\n\t\tuint32_t filter_offset;\r\n\t\tMonoClass *catch_class;\r\n\t} data;\r\n} MonoExceptionClause;\r\n\r\ntypedef struct _MonoType MonoType;\r\ntypedef struct _MonoGenericInst MonoGenericInst;\r\ntypedef struct _MonoGenericClass MonoGenericClass;\r\ntypedef struct _MonoDynamicGenericClass MonoDynamicGenericClass;\r\ntypedef struct _MonoGenericContext MonoGenericContext;\r\ntypedef struct _MonoGenericContainer MonoGenericContainer;\r\ntypedef struct _MonoGenericParam MonoGenericParam;\r\ntypedef struct _MonoArrayType MonoArrayType;\r\ntypedef struct _MonoMethodSignature MonoMethodSignature;\r\n\r\n/* FIXME: Keeping this name alive for now, since it is part of the exposed API, even though no entrypoint uses it.  */\r\ntypedef struct invalid_name MonoGenericMethod;\r\n\r\ntypedef struct {\r\n\tunsigned int required : 1;\r\n\tunsigned int token    : 31;\r\n} MonoCustomMod;\r\n\r\nstruct _MonoArrayType {\r\n\tMonoClass *eklass;\r\n\tuint8_t rank;\r\n\tuint8_t numsizes;\r\n\tuint8_t numlobounds;\r\n\tint *sizes;\r\n\tint *lobounds;\r\n};\r\n\r\ntypedef struct _MonoMethodHeader MonoMethodHeader;\r\n\r\ntypedef enum {\r\n\tMONO_PARSE_TYPE,\r\n\tMONO_PARSE_MOD_TYPE,\r\n\tMONO_PARSE_LOCAL,\r\n\tMONO_PARSE_PARAM,\r\n\tMONO_PARSE_RET,\r\n\tMONO_PARSE_FIELD\r\n} MonoParseTypeMode;\r\n\r\nmono_bool\r\nmono_type_is_byref       (MonoType *type);\r\n\r\nint\r\nmono_type_get_type       (MonoType *type);\r\n\r\n/* For MONO_TYPE_FNPTR */\r\nMonoMethodSignature*\r\nmono_type_get_signature  (MonoType *type);\r\n\r\n/* For MONO_TYPE_CLASS, VALUETYPE */\r\nMonoClass*\r\nmono_type_get_class      (MonoType *type);\r\n\r\nMonoArrayType*\r\nmono_type_get_array_type (MonoType *type);\r\n\r\n/* For MONO_TYPE_PTR */\r\nMonoType*\r\nmono_type_get_ptr_type (MonoType *type);\r\n\r\nMonoClass*\r\nmono_type_get_modifiers  (MonoType *type, mono_bool *is_required, void **iter);\r\n\r\nmono_bool mono_type_is_struct    (MonoType *type);\r\nmono_bool mono_type_is_void      (MonoType *type);\r\nmono_bool mono_type_is_pointer   (MonoType *type);\r\nmono_bool mono_type_is_reference (MonoType *type);\r\n\r\nMonoType*\r\nmono_signature_get_return_type (MonoMethodSignature *sig);\r\n\r\nMonoType*\r\nmono_signature_get_params      (MonoMethodSignature *sig, void **iter);\r\n\r\nuint32_t\r\nmono_signature_get_param_count (MonoMethodSignature *sig);\r\n\r\nuint32_t\r\nmono_signature_get_call_conv   (MonoMethodSignature *sig);\r\n\r\nint\r\nmono_signature_vararg_start    (MonoMethodSignature *sig);\r\n\r\nmono_bool\r\nmono_signature_is_instance     (MonoMethodSignature *sig);\r\n\r\nmono_bool\r\nmono_signature_explicit_this   (MonoMethodSignature *sig);\r\n\r\nuint32_t     mono_metadata_parse_typedef_or_ref (MonoImage      *m,\r\n                                                const char      *ptr,\r\n                                                const char     **rptr);\r\nint            mono_metadata_parse_custom_mod  (MonoImage      *m,\r\n\t\t\t\t\t\tMonoCustomMod   *dest,\r\n\t\t\t\t\t\tconst char      *ptr,\r\n\t\t\t\t\t\tconst char     **rptr);\r\nMonoArrayType *mono_metadata_parse_array       (MonoImage      *m,\r\n\t\t\t\t\t\tconst char      *ptr,\r\n\t\t\t\t\t\tconst char     **rptr);\r\nvoid           mono_metadata_free_array        (MonoArrayType     *array);\r\nMonoType      *mono_metadata_parse_type        (MonoImage      *m,\r\n\t\t\t\t\t\tMonoParseTypeMode  mode,\r\n\t\t\t\t\t\tshort              opt_attrs,\r\n\t\t\t\t\t\tconst char        *ptr,\r\n\t\t\t\t\t\tconst char       **rptr);\r\nMonoType      *mono_metadata_parse_param       (MonoImage      *m,\r\n\t\t\t\t\t\tconst char      *ptr,\r\n\t\t\t\t\t\tconst char      **rptr);\r\nMonoType      *mono_metadata_parse_ret_type    (MonoImage      *m,\r\n\t\t\t\t\t\tconst char      *ptr,\r\n\t\t\t\t\t\tconst char      **rptr);\r\nMonoType      *mono_metadata_parse_field_type  (MonoImage      *m,\r\n\t\t                                short            field_flags,\r\n\t\t\t\t\t\tconst char      *ptr,\r\n\t\t\t\t\t\tconst char      **rptr);\r\nMonoType      *mono_type_create_from_typespec  (MonoImage        *image, \r\n\t\t\t\t\t        uint32_t           type_spec);\r\nvoid           mono_metadata_free_type         (MonoType        *type);\r\nint            mono_type_size                  (MonoType        *type, \r\n\t\t\t\t\t\tint             *alignment);\r\nint            mono_type_stack_size            (MonoType        *type, \r\n\t\t\t\t\t\tint             *alignment);\r\n\r\nmono_bool       mono_type_generic_inst_is_valuetype      (MonoType *type);\r\nmono_bool       mono_metadata_generic_class_is_valuetype (MonoGenericClass *gclass);\r\nunsigned int          mono_metadata_generic_class_hash  (MonoGenericClass *gclass);\r\nmono_bool       mono_metadata_generic_class_equal (MonoGenericClass *g1, MonoGenericClass *g2);\r\n\r\nunsigned int          mono_metadata_type_hash         (MonoType *t1);\r\nmono_bool       mono_metadata_type_equal        (MonoType *t1, MonoType *t2);\r\n\r\nMonoMethodSignature  *mono_metadata_signature_alloc (MonoImage *image, uint32_t nparams);\r\n\r\nMonoMethodSignature  *mono_metadata_signature_dup (MonoMethodSignature *sig);\r\n\r\nMonoMethodSignature  *mono_metadata_parse_signature (MonoImage *image, \r\n\t\t\t\t\t\t     uint32_t    token);\r\n\r\nMonoMethodSignature  *mono_metadata_parse_method_signature (MonoImage            *m,\r\n                                                            int                    def,\r\n                                                            const char            *ptr,\r\n                                                            const char           **rptr);\r\nvoid                  mono_metadata_free_method_signature  (MonoMethodSignature   *method);\r\n\r\nmono_bool          mono_metadata_signature_equal (MonoMethodSignature *sig1, \r\n\t\t\t\t\t\t MonoMethodSignature *sig2);\r\n\r\nunsigned int             mono_signature_hash (MonoMethodSignature *sig);\r\n\r\nMonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr);\r\nvoid              mono_metadata_free_mh  (MonoMethodHeader *mh);\r\n\r\n/* MonoMethodHeader acccessors */\r\nconst unsigned char*\r\nmono_method_header_get_code (MonoMethodHeader *header, uint32_t* code_size, uint32_t* max_stack);\r\n\r\nMonoType**\r\nmono_method_header_get_locals (MonoMethodHeader *header, uint32_t* num_locals, mono_bool *init_locals);\r\n\r\nint\r\nmono_method_header_get_num_clauses (MonoMethodHeader *header);\r\n\r\nint\r\nmono_method_header_get_clauses (MonoMethodHeader *header, MonoMethod *method, void **iter, MonoExceptionClause *clause);\r\n\r\nuint32_t \r\nmono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, \r\n\t\t\tmono_bool as_field, mono_bool unicode, MonoMarshalConv *conv);\r\n\r\n/*\r\n * Makes a token based on a table and an index\r\n */\r\n#define mono_metadata_make_token(table,idx) (((table) << 24)| (idx))\r\n\r\n/*\r\n * Returns the table index that this token encodes.\r\n */\r\n#define mono_metadata_token_table(token) ((token) >> 24)\r\n\r\n /*\r\n * Returns the index that a token refers to\r\n */\r\n#define mono_metadata_token_index(token) ((token & 0xffffff))\r\n\r\n\r\n#define mono_metadata_token_code(token) ((token & 0xff000000))\r\n\r\nuint32_t mono_metadata_token_from_dor (uint32_t dor_index);\r\n\r\nchar *mono_guid_to_string (const uint8_t *guid);\r\n\r\nuint32_t mono_metadata_declsec_from_index (MonoImage *meta, uint32_t idx);\r\n\r\nuint32_t mono_metadata_translate_token_index (MonoImage *image, int table, uint32_t idx);\r\n\r\nvoid    mono_metadata_decode_table_row (MonoImage *image, int table,\r\n\t\t\t\t       int                    idx,\r\n\t\t\t\t       uint32_t               *res,\r\n\t\t\t\t       int                    res_size);\r\n\r\nuint32_t      mono_metadata_decode_table_row_col (MonoImage *image, int table,\r\n\t\t\t\t\t   int            idx, \r\n\t\t\t\t\t   unsigned int          col);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_METADATA_H__ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/mono-config.h",
    "content": "/*\r\n * mono-config.h\r\n *\r\n * Author: Paolo Molaro (lupus@ximian.com)\r\n *\r\n * (C) 2002 Ximian, Inc.\r\n */\r\n#ifndef __MONO_METADATA_CONFIG_H__\r\n#define __MONO_METADATA_CONFIG_H__\r\n\r\n#include <mono/utils/mono-publib.h>\r\n#include <mono/metadata/image.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nconst char* mono_get_config_dir (void);\r\nvoid        mono_set_config_dir (const char *dir);\r\n\r\nconst char* mono_get_machine_config (void);\r\n\r\nvoid mono_config_cleanup      (void);\r\nvoid mono_config_parse        (const char *filename);\r\nvoid mono_config_for_assembly (MonoImage *assembly);\r\nvoid mono_config_parse_memory (const char *buffer);\r\n\r\nconst char* mono_config_string_for_assembly_file (const char *filename);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_METADATA_CONFIG_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/mono-debug.h",
    "content": "/*\r\n * This header is only installed for use by the debugger:\r\n * the structures and the API declared here are not supported.\r\n */\r\n\r\n#ifndef __MONO_DEBUG_H__\r\n#define __MONO_DEBUG_H__\r\n\r\n#include <mono/utils/mono-publib.h>\r\n#include <mono/metadata/image.h>\r\n#include <mono/metadata/appdomain.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef struct _MonoSymbolTable\t\t\tMonoSymbolTable;\r\ntypedef struct _MonoDebugDataTable\t\tMonoDebugDataTable;\r\n\r\ntypedef struct _MonoSymbolFile\t\t\tMonoSymbolFile;\r\n\r\ntypedef struct _MonoDebugHandle\t\t\tMonoDebugHandle;\r\n\r\ntypedef struct _MonoDebugLineNumberEntry\tMonoDebugLineNumberEntry;\r\n\r\ntypedef struct _MonoDebugVarInfo\t\tMonoDebugVarInfo;\r\ntypedef struct _MonoDebugMethodJitInfo\t\tMonoDebugMethodJitInfo;\r\ntypedef struct _MonoDebugMethodAddress\t\tMonoDebugMethodAddress;\r\ntypedef struct _MonoDebugMethodAddressList\tMonoDebugMethodAddressList;\r\ntypedef struct _MonoDebugClassEntry\t\tMonoDebugClassEntry;\r\n\r\ntypedef struct _MonoDebugMethodInfo\t\tMonoDebugMethodInfo;\r\ntypedef struct _MonoDebugLocalsInfo\t\tMonoDebugLocalsInfo;\r\ntypedef struct _MonoDebugSourceLocation\t\tMonoDebugSourceLocation;\r\n\r\ntypedef struct _MonoDebugList\t\t\tMonoDebugList;\r\n\r\ntypedef enum {\r\n\tMONO_DEBUG_FORMAT_NONE,\r\n\tMONO_DEBUG_FORMAT_MONO,\r\n\tMONO_DEBUG_FORMAT_DEBUGGER\r\n} MonoDebugFormat;\r\n\r\n/*\r\n * NOTE:\r\n * We intentionally do not use GList here since the debugger needs to know about\r\n * the layout of the fields.\r\n*/\r\nstruct _MonoDebugList {\r\n\tMonoDebugList *next;\r\n\tconst void* data;\r\n};\r\n\r\nstruct _MonoSymbolTable {\r\n\tuint64_t magic;\r\n\tuint32_t version;\r\n\tuint32_t total_size;\r\n\r\n\t/*\r\n\t * Corlib and metadata info.\r\n\t */\r\n\tMonoDebugHandle *corlib;\r\n\tMonoDebugDataTable *global_data_table;\r\n\tMonoDebugList *data_tables;\r\n\r\n\t/*\r\n\t * The symbol files.\r\n\t */\r\n\tMonoDebugList *symbol_files;\r\n};\r\n\r\nstruct _MonoDebugHandle {\r\n\tuint32_t index;\r\n\tchar *image_file;\r\n\tMonoImage *image;\r\n\tMonoDebugDataTable *type_table;\r\n\tMonoSymbolFile *symfile;\r\n};\r\n\r\nstruct _MonoDebugMethodJitInfo {\r\n\tconst mono_byte *code_start;\r\n\tuint32_t code_size;\r\n\tuint32_t prologue_end;\r\n\tuint32_t epilogue_begin;\r\n\tconst mono_byte *wrapper_addr;\r\n\tuint32_t num_line_numbers;\r\n\tMonoDebugLineNumberEntry *line_numbers;\r\n\tuint32_t num_params;\r\n\tMonoDebugVarInfo *this_var;\r\n\tMonoDebugVarInfo *params;\r\n\tuint32_t num_locals;\r\n\tMonoDebugVarInfo *locals;\r\n};\r\n\r\nstruct _MonoDebugMethodAddressList {\r\n\tuint32_t size;\r\n\tuint32_t count;\r\n\tmono_byte data [MONO_ZERO_LEN_ARRAY];\r\n};\r\n\r\nstruct _MonoDebugSourceLocation {\r\n\tchar *source_file;\r\n\tuint32_t row, column;\r\n\tuint32_t il_offset;\r\n};\r\n\r\n/*\r\n * These bits of the MonoDebugLocalInfo's \"index\" field are flags specifying\r\n * where the variable is actually stored.\r\n *\r\n * See relocate_variable() in debug-symfile.c for more info.\r\n */\r\n#define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS\t\t0xf0000000\r\n\r\n/* The variable is in register \"index\". */\r\n#define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER\t\t0\r\n\r\n/* The variable is at offset \"offset\" from register \"index\". */\r\n#define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET\t\t0x10000000\r\n\r\n/* The variable is in the two registers \"offset\" and \"index\". */\r\n#define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS\t0x20000000\r\n\r\n/* The variable is dead. */\r\n#define MONO_DEBUG_VAR_ADDRESS_MODE_DEAD\t\t0x30000000\r\n\r\nstruct _MonoDebugVarInfo {\r\n\tuint32_t index;\r\n\tuint32_t offset;\r\n\tuint32_t size;\r\n\tuint32_t begin_scope;\r\n\tuint32_t end_scope;\r\n\tMonoType *type;\r\n};\r\n\r\n#define MONO_DEBUGGER_MAJOR_VERSION\t\t\t81\r\n#define MONO_DEBUGGER_MINOR_VERSION\t\t\t6\r\n#define MONO_DEBUGGER_MAGIC\t\t\t\t0x7aff65af4253d427ULL\r\n\r\nextern MonoSymbolTable *mono_symbol_table;\r\nextern MonoDebugFormat mono_debug_format;\r\nextern int32_t mono_debug_debugger_version;\r\nextern int32_t _mono_debug_using_mono_debugger;\r\n\r\nvoid mono_debug_list_add (MonoDebugList **list, const void* data);\r\nvoid mono_debug_list_remove (MonoDebugList **list, const void* data);\r\n\r\nvoid mono_debug_init (MonoDebugFormat format);\r\nvoid mono_debug_open_image_from_memory (MonoImage *image, const mono_byte *raw_contents, int size);\r\nvoid mono_debug_cleanup (void);\r\n\r\nvoid mono_debug_close_image (MonoImage *image);\r\n\r\nvoid mono_debug_domain_unload (MonoDomain *domain);\r\nvoid mono_debug_domain_create (MonoDomain *domain);\r\n\r\nmono_bool mono_debug_using_mono_debugger (void);\r\n\r\nMonoDebugMethodAddress *\r\nmono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDomain *domain);\r\n\r\nvoid\r\nmono_debug_remove_method (MonoMethod *method, MonoDomain *domain);\r\n\r\nMonoDebugMethodInfo *\r\nmono_debug_lookup_method (MonoMethod *method);\r\n\r\nMonoDebugMethodAddressList *\r\nmono_debug_lookup_method_addresses (MonoMethod *method);\r\n\r\nMonoDebugMethodJitInfo*\r\nmono_debug_find_method (MonoMethod *method, MonoDomain *domain);\r\n\r\nvoid\r\nmono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);\r\n\r\n\r\nvoid\r\nmono_debug_add_delegate_trampoline (void* code, int size);\r\n\r\nMonoDebugLocalsInfo*\r\nmono_debug_lookup_locals (MonoMethod *method);\r\n\r\n/*\r\n * Line number support.\r\n */\r\n\r\nMonoDebugSourceLocation *\r\nmono_debug_lookup_source_location (MonoMethod *method, uint32_t address, MonoDomain *domain);\r\n\r\nint32_t\r\nmono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, uint32_t native_offset);\r\n\r\nvoid\r\nmono_debug_free_source_location (MonoDebugSourceLocation *location);\r\n\r\nchar *\r\nmono_debug_print_stack_frame (MonoMethod *method, uint32_t native_offset, MonoDomain *domain);\r\n\r\n/*\r\n * Mono Debugger support functions\r\n *\r\n * These methods are used by the JIT while running inside the Mono Debugger.\r\n */\r\n\r\nint             mono_debugger_method_has_breakpoint       (MonoMethod *method);\r\nint             mono_debugger_insert_breakpoint           (const char *method_name, mono_bool include_namespace);\r\n\r\nvoid mono_set_is_debugger_attached (mono_bool attached);\r\nmono_bool mono_is_debugger_attached (void);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_DEBUG_H__ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/mono-gc.h",
    "content": "/*\r\n * mono-gc.h: GC related public interface\r\n *\r\n */\r\n#ifndef __METADATA_MONO_GC_H__\r\n#define __METADATA_MONO_GC_H__\r\n\r\n#include <mono/metadata/object.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data);\r\n\r\nvoid   mono_gc_collect         (int generation);\r\nint    mono_gc_max_generation  (void);\r\nint    mono_gc_get_generation  (MonoObject *object);\r\nint    mono_gc_collection_count (int generation);\r\nint64_t mono_gc_get_used_size   (void);\r\nint64_t mono_gc_get_heap_size   (void);\r\nint    mono_gc_invoke_finalizers (void);\r\n/* heap walking is only valid in the pre-stop-world event callback */\r\nint    mono_gc_walk_heap        (int flags, MonoGCReferences callback, void *data);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __METADATA_MONO_GC_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/object.h",
    "content": "#ifndef _MONO_CLI_OBJECT_H_\r\n#define _MONO_CLI_OBJECT_H_\r\n\r\n#include <mono/metadata/class.h>\r\n#include <mono/utils/mono-error.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef mono_byte MonoBoolean;\r\n\r\ntypedef struct _MonoString MonoString;\r\ntypedef struct _MonoArray MonoArray;\r\ntypedef struct _MonoReflectionMethod MonoReflectionMethod;\r\ntypedef struct _MonoReflectionAssembly MonoReflectionAssembly;\r\ntypedef struct _MonoReflectionModule MonoReflectionModule;\r\ntypedef struct _MonoReflectionField MonoReflectionField;\r\ntypedef struct _MonoReflectionProperty MonoReflectionProperty;\r\ntypedef struct _MonoReflectionEvent MonoReflectionEvent;\r\ntypedef struct _MonoReflectionType MonoReflectionType;\r\ntypedef struct _MonoDelegate MonoDelegate;\r\ntypedef struct _MonoException MonoException;\r\ntypedef struct _MonoThreadsSync MonoThreadsSync;\r\ntypedef struct _MonoThread MonoThread;\r\ntypedef struct _MonoDynamicAssembly MonoDynamicAssembly;\r\ntypedef struct _MonoDynamicImage MonoDynamicImage;\r\ntypedef struct _MonoReflectionMethodBody MonoReflectionMethodBody;\r\ntypedef struct _MonoAppContext MonoAppContext;\r\n\r\ntypedef struct {\r\n\tMonoVTable *vtable;\r\n\tMonoThreadsSync *synchronisation;\r\n} MonoObject;\r\n\r\ntypedef MonoObject* (*MonoInvokeFunc)\t     (MonoMethod *method, void *obj, void **params, MonoObject **exc);\r\ntypedef void*    (*MonoCompileFunc)\t     (MonoMethod *method);\r\ntypedef void\t    (*MonoMainThreadFunc)    (void* user_data);\r\n\r\n#define MONO_OBJECT_SETREF(obj,fieldname,value) do {\t\\\r\n\t\tmono_gc_wbarrier_set_field ((MonoObject*)(obj), &((obj)->fieldname), (MonoObject*)value);\t\\\r\n\t\t/*(obj)->fieldname = (value);*/\t\\\r\n\t} while (0)\r\n\r\n/* This should be used if 's' can reside on the heap */\r\n#define MONO_STRUCT_SETREF(s,field,value) do { \\\r\n        mono_gc_wbarrier_generic_store (&((s)->field), (MonoObject*)(value)); \\\r\n    } while (0)\r\n\r\n#define mono_array_addr(array,type,index) ((type*)(void*) mono_array_addr_with_size (array, sizeof (type), index))\r\n#define mono_array_get(array,type,index) ( *(type*)mono_array_addr ((array), type, (index)) ) \r\n#define mono_array_set(array,type,index,value)\t\\\r\n\tdo {\t\\\r\n\t\ttype *__p = (type *) mono_array_addr ((array), type, (index));\t\\\r\n\t\t*__p = (value);\t\\\r\n\t} while (0)\r\n#define mono_array_setref(array,index,value)\t\\\r\n\tdo {\t\\\r\n\t\tvoid **__p = (void **) mono_array_addr ((array), void*, (index));\t\\\r\n\t\tmono_gc_wbarrier_set_arrayref ((array), __p, (MonoObject*)(value));\t\\\r\n\t\t/* *__p = (value);*/\t\\\r\n\t} while (0)\r\n#define mono_array_memcpy_refs(dest,destidx,src,srcidx,count)\t\\\r\n\tdo {\t\\\r\n\t\tvoid **__p = (void **) mono_array_addr ((dest), void*, (destidx));\t\\\r\n\t\tvoid **__s = mono_array_addr ((src), void*, (srcidx));\t\\\r\n\t\tmono_gc_wbarrier_arrayref_copy (__p, __s, (count));\t\\\r\n\t} while (0)\r\n\r\nmono_unichar2 *mono_string_chars  (MonoString *s);\r\nint            mono_string_length (MonoString *s);\r\n\r\nMonoObject *\r\nmono_object_new\t\t    (MonoDomain *domain, MonoClass *klass);\r\n\r\nMonoObject *\r\nmono_object_new_specific    (MonoVTable *vtable);\r\n\r\n/* can be used for classes without finalizer in non-profiling mode */\r\nMonoObject *\r\nmono_object_new_fast\t    (MonoVTable *vtable);\r\n\r\nMonoObject *\r\nmono_object_new_alloc_specific (MonoVTable *vtable);\r\n\r\nMonoObject *\r\nmono_object_new_from_token  (MonoDomain *domain, MonoImage *image, uint32_t token);\r\n\r\nMonoArray*\r\nmono_array_new\t\t    (MonoDomain *domain, MonoClass *eclass, uintptr_t n);\r\n\r\nMonoArray*\r\nmono_array_new_full\t    (MonoDomain *domain, MonoClass *array_class,\r\n\t\t\t     uintptr_t *lengths, intptr_t *lower_bounds);\r\n\r\nMonoArray *\r\nmono_array_new_specific\t    (MonoVTable *vtable, uintptr_t n);\r\n\r\nMonoArray*\r\nmono_array_clone\t    (MonoArray *array);\r\n\r\nchar*\r\nmono_array_addr_with_size   (MonoArray *array, int size, uintptr_t idx);\r\n\r\nuintptr_t\r\nmono_array_length           (MonoArray *array);\r\n\r\nMonoString*\r\nmono_string_new_utf16\t    (MonoDomain *domain, const mono_unichar2 *text, int32_t len);\r\n\r\nMonoString*\r\nmono_string_new_size\t    (MonoDomain *domain, int32_t len);\r\n\r\nMonoString*\r\nmono_ldstr\t\t    (MonoDomain *domain, MonoImage *image, uint32_t str_index);\r\n\r\nMonoString*\r\nmono_string_is_interned\t    (MonoString *str);\r\n\r\nMonoString*\r\nmono_string_intern\t    (MonoString *str);\r\n\r\nMonoString*\r\nmono_string_new\t\t    (MonoDomain *domain, const char *text);\r\n\r\nMonoString*\r\nmono_string_new_wrapper\t    (const char *text);\r\n\r\nMonoString*\r\nmono_string_new_len\t    (MonoDomain *domain, const char *text, unsigned int length);\r\n\r\nchar *\r\nmono_string_to_utf8\t    (MonoString *string_obj);\r\n\r\nchar *\r\nmono_string_to_utf8_checked (MonoString *string_obj, MonoError *error);\r\n\r\nmono_unichar2 *\r\nmono_string_to_utf16\t    (MonoString *string_obj);\r\n\r\nMonoString *\r\nmono_string_from_utf16\t    (mono_unichar2 *data);\r\n\r\nmono_bool\r\nmono_string_equal           (MonoString *s1, MonoString *s2);\r\n\r\nunsigned int\r\nmono_string_hash            (MonoString *s);\r\n\r\nint\r\nmono_object_hash            (MonoObject* obj);\r\n\r\nMonoString *\r\nmono_object_to_string (MonoObject *obj, MonoObject **exc);\r\n\r\nMonoObject *\r\nmono_value_box\t\t    (MonoDomain *domain, MonoClass *klass, void* val);\r\n\r\nvoid\r\nmono_value_copy             (void* dest, void* src, MonoClass *klass);\r\n\r\nvoid\r\nmono_value_copy_array       (MonoArray *dest, int dest_idx, void* src, int count);\r\n\r\nMonoDomain*\r\nmono_object_get_domain      (MonoObject *obj);\r\n\r\nMonoClass*\r\nmono_object_get_class       (MonoObject *obj);\r\n\r\nvoid*\r\nmono_object_unbox\t    (MonoObject *obj);\r\n\r\nMonoObject *\r\nmono_object_clone\t    (MonoObject *obj);\r\n\r\nMonoObject *\r\nmono_object_isinst\t    (MonoObject *obj, MonoClass *klass);\r\n\r\nMonoObject *\r\nmono_object_isinst_mbyref   (MonoObject *obj, MonoClass *klass);\r\n\r\nMonoObject *\r\nmono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass);\r\n\r\nmono_bool \r\nmono_monitor_try_enter       (MonoObject *obj, uint32_t ms);\r\n\r\nmono_bool\r\nmono_monitor_enter           (MonoObject *obj);\r\n\r\nunsigned int\r\nmono_object_get_size         (MonoObject *o);\r\n\r\nvoid \r\nmono_monitor_exit            (MonoObject *obj);\r\n\r\nvoid\r\nmono_raise_exception\t    (MonoException *ex);\r\n\r\nvoid\r\nmono_runtime_object_init    (MonoObject *this_obj);\r\n\r\nvoid\r\nmono_runtime_class_init\t    (MonoVTable *vtable);\r\n\r\nMonoMethod*\r\nmono_object_get_virtual_method (MonoObject *obj, MonoMethod *method);\r\n\r\nMonoObject*\r\nmono_runtime_invoke\t    (MonoMethod *method, void *obj, void **params,\r\n\t\t\t     MonoObject **exc);\r\n\r\nMonoMethod *\r\nmono_get_delegate_invoke    (MonoClass *klass);\r\n\r\nMonoObject*\r\nmono_runtime_delegate_invoke (MonoObject *delegate, void **params, \r\n\t\t\t      MonoObject **exc);\r\n\r\nMonoObject*\r\nmono_runtime_invoke_array   (MonoMethod *method, void *obj, MonoArray *params,\r\n\t\t\t     MonoObject **exc);\r\n\r\nvoid*\r\nmono_method_get_unmanaged_thunk (MonoMethod *method);\r\n\r\nMonoArray*\r\nmono_runtime_get_main_args  (void);\r\n\r\nvoid\r\nmono_runtime_exec_managed_code (MonoDomain *domain,\r\n\t\t\t\tMonoMainThreadFunc main_func,\r\n\t\t\t\tvoid* main_args);\r\n\r\nint\r\nmono_runtime_run_main\t    (MonoMethod *method, int argc, char* argv[], \r\n\t\t\t     MonoObject **exc);\r\n\r\nint\r\nmono_runtime_exec_main\t    (MonoMethod *method, MonoArray *args,\r\n\t\t\t     MonoObject **exc);\r\n\r\nvoid*\r\nmono_load_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void **res);\r\n\r\nMonoObject *\r\nmono_load_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field);\r\n\r\nvoid\r\nmono_store_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void* val);\r\n\r\nvoid\r\nmono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg);\r\n\r\nvoid\r\nmono_unhandled_exception    (MonoObject *exc);\r\n\r\nvoid\r\nmono_print_unhandled_exception (MonoObject *exc);\r\n\r\nvoid* \r\nmono_compile_method\t   (MonoMethod *method);\r\n\r\n/* accessors for fields and properties */\r\nvoid\r\nmono_field_set_value (MonoObject *obj, MonoClassField *field, void *value);\r\n\r\nvoid\r\nmono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value);\r\n\r\nvoid\r\nmono_field_get_value (MonoObject *obj, MonoClassField *field, void *value);\r\n\r\nvoid\r\nmono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value);\r\n\r\nMonoObject *\r\nmono_field_get_value_object (MonoDomain *domain, MonoClassField *field, MonoObject *obj);\r\n\r\nvoid\r\nmono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc);\r\n\r\nMonoObject*\r\nmono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc);\r\n\r\n/* GC handles support \r\n *\r\n * A handle can be created to refer to a managed object and either prevent it\r\n * from being garbage collected or moved or to be able to know if it has been \r\n * collected or not (weak references).\r\n * mono_gchandle_new () is used to prevent an object from being garbage collected\r\n * until mono_gchandle_free() is called. Use a TRUE value for the pinned argument to\r\n * prevent the object from being moved (this should be avoided as much as possible \r\n * and this should be used only for shorts periods of time or performance will suffer).\r\n * To create a weakref use mono_gchandle_new_weakref (): track_resurrection should\r\n * usually be false (see the GC docs for more details).\r\n * mono_gchandle_get_target () can be used to get the object referenced by both kinds\r\n * of handle: for a weakref handle, if an object has been collected, it will return NULL.\r\n */\r\nuint32_t      mono_gchandle_new         (MonoObject *obj, mono_bool pinned);\r\nuint32_t      mono_gchandle_new_weakref (MonoObject *obj, mono_bool track_resurrection);\r\nMonoObject*  mono_gchandle_get_target  (uint32_t gchandle);\r\nvoid         mono_gchandle_free        (uint32_t gchandle);\r\n\r\n/* GC write barriers support */\r\nvoid mono_gc_wbarrier_set_field     (MonoObject *obj, void* field_ptr, MonoObject* value);\r\nvoid mono_gc_wbarrier_set_arrayref  (MonoArray *arr, void* slot_ptr, MonoObject* value);\r\nvoid mono_gc_wbarrier_arrayref_copy (void* dest_ptr, void* src_ptr, int count);\r\nvoid mono_gc_wbarrier_generic_store (void* ptr, MonoObject* value);\r\nvoid mono_gc_wbarrier_generic_nostore (void* ptr);\r\nvoid mono_gc_wbarrier_value_copy    (void* dest, void* src, int count, MonoClass *klass);\r\nvoid mono_gc_wbarrier_object_copy   (MonoObject* obj, MonoObject *src);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/opcodes.h",
    "content": "#ifndef __MONO_METADATA_OPCODES_H__\r\n#define __MONO_METADATA_OPCODES_H__\r\n\r\n/*\r\n * opcodes.h: CIL instruction information\r\n *\r\n * Author:\r\n *   Paolo Molaro (lupus@ximian.com)\r\n *\r\n * (C) 2002 Ximian, Inc.\r\n */\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\n#define MONO_CUSTOM_PREFIX 0xf0\r\n\r\n#define OPDEF(a,b,c,d,e,f,g,h,i,j) \\\r\n\tMONO_ ## a,\r\n\r\ntypedef enum {\r\n#include \"mono/cil/opcode.def\"\r\n\tMONO_CEE_LAST\r\n} MonoOpcodeEnum;\r\n\r\n#undef OPDEF\r\n\r\nenum {\r\n\tMONO_FLOW_NEXT,\r\n\tMONO_FLOW_BRANCH,\r\n\tMONO_FLOW_COND_BRANCH,\r\n\tMONO_FLOW_ERROR,\r\n\tMONO_FLOW_CALL,\r\n\tMONO_FLOW_RETURN,\r\n\tMONO_FLOW_META\r\n};\r\n\r\nenum {\r\n\tMonoInlineNone,\r\n\tMonoInlineType,\r\n\tMonoInlineField,\r\n\tMonoInlineMethod,\r\n\tMonoInlineTok,\r\n\tMonoInlineString,\r\n\tMonoInlineSig,\r\n\tMonoInlineVar,\r\n\tMonoShortInlineVar,\r\n\tMonoInlineBrTarget,\r\n\tMonoShortInlineBrTarget,\r\n\tMonoInlineSwitch,\r\n\tMonoInlineR,\r\n\tMonoShortInlineR,\r\n\tMonoInlineI,\r\n\tMonoShortInlineI,\r\n\tMonoInlineI8\r\n};\r\n\r\ntypedef struct {\r\n\tunsigned char argument;\r\n\tunsigned char flow_type;\r\n\tunsigned short opval;\r\n} MonoOpcode;\r\n\r\nextern const MonoOpcode mono_opcodes [];\r\n\r\nconst char*\r\nmono_opcode_name (int opcode);\r\n\r\nMonoOpcodeEnum\r\nmono_opcode_value (const mono_byte **ip, const mono_byte *end);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_METADATA_OPCODES_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/profiler.h",
    "content": "#ifndef __MONO_PROFILER_H__\r\n#define __MONO_PROFILER_H__\r\n\r\n#include <mono/metadata/object.h>\r\n#include <mono/metadata/appdomain.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\n#define MONO_PROFILER_MAX_STAT_CALL_CHAIN_DEPTH 128\r\n\r\ntypedef enum {\r\n\tMONO_PROFILE_NONE = 0,\r\n\tMONO_PROFILE_APPDOMAIN_EVENTS = 1 << 0,\r\n\tMONO_PROFILE_ASSEMBLY_EVENTS  = 1 << 1,\r\n\tMONO_PROFILE_MODULE_EVENTS    = 1 << 2,\r\n\tMONO_PROFILE_CLASS_EVENTS     = 1 << 3,\r\n\tMONO_PROFILE_JIT_COMPILATION  = 1 << 4,\r\n\tMONO_PROFILE_INLINING         = 1 << 5,\r\n\tMONO_PROFILE_EXCEPTIONS       = 1 << 6,\r\n\tMONO_PROFILE_ALLOCATIONS      = 1 << 7,\r\n\tMONO_PROFILE_GC               = 1 << 8,\r\n\tMONO_PROFILE_THREADS          = 1 << 9,\r\n\tMONO_PROFILE_REMOTING         = 1 << 10,\r\n\tMONO_PROFILE_TRANSITIONS      = 1 << 11,\r\n\tMONO_PROFILE_ENTER_LEAVE      = 1 << 12,\r\n\tMONO_PROFILE_COVERAGE         = 1 << 13,\r\n\tMONO_PROFILE_INS_COVERAGE     = 1 << 14,\r\n\tMONO_PROFILE_STATISTICAL      = 1 << 15,\r\n\tMONO_PROFILE_METHOD_EVENTS    = 1 << 16,\r\n\tMONO_PROFILE_MONITOR_EVENTS   = 1 << 17,\r\n\tMONO_PROFILE_IOMAP_EVENTS     = 1 << 18, /* this should likely be removed, too */\r\n\tMONO_PROFILE_GC_MOVES         = 1 << 19,\r\n\tMONO_PROFILE_GC_ROOTS         = 1 << 20\r\n} MonoProfileFlags;\r\n\r\ntypedef enum {\r\n\tMONO_PROFILE_OK,\r\n\tMONO_PROFILE_FAILED\r\n} MonoProfileResult;\r\n\r\ntypedef enum {\r\n\tMONO_GC_EVENT_START,\r\n\tMONO_GC_EVENT_MARK_START,\r\n\tMONO_GC_EVENT_MARK_END,\r\n\tMONO_GC_EVENT_RECLAIM_START,\r\n\tMONO_GC_EVENT_RECLAIM_END,\r\n\tMONO_GC_EVENT_END,\r\n\tMONO_GC_EVENT_PRE_STOP_WORLD,\r\n\tMONO_GC_EVENT_POST_STOP_WORLD,\r\n\tMONO_GC_EVENT_PRE_START_WORLD,\r\n\tMONO_GC_EVENT_POST_START_WORLD\r\n} MonoGCEvent;\r\n\r\n/* coverage info */\r\ntypedef struct {\r\n\tMonoMethod *method;\r\n\tint iloffset;\r\n\tint counter;\r\n\tconst char *filename;\r\n\tint line;\r\n\tint col;\r\n} MonoProfileCoverageEntry;\r\n\r\n/* executable code buffer info */\r\ntypedef enum {\r\n\tMONO_PROFILER_CODE_BUFFER_UNKNOWN,\r\n\tMONO_PROFILER_CODE_BUFFER_METHOD,\r\n\tMONO_PROFILER_CODE_BUFFER_LAST\r\n} MonoProfilerCodeBufferType;\r\n\r\ntypedef struct _MonoProfiler MonoProfiler;\r\n\r\ntypedef enum {\r\n\tMONO_PROFILER_MONITOR_CONTENTION = 1,\r\n\tMONO_PROFILER_MONITOR_DONE = 2,\r\n\tMONO_PROFILER_MONITOR_FAIL = 3\r\n} MonoProfilerMonitorEvent;\r\n\r\ntypedef enum {\r\n\tMONO_PROFILER_CALL_CHAIN_NONE = 0,\r\n\tMONO_PROFILER_CALL_CHAIN_NATIVE = 1,\r\n\tMONO_PROFILER_CALL_CHAIN_GLIBC = 2,\r\n\tMONO_PROFILER_CALL_CHAIN_MANAGED = 3,\r\n\tMONO_PROFILER_CALL_CHAIN_INVALID = 4\r\n} MonoProfilerCallChainStrategy;\r\n\r\ntypedef enum {\r\n\tMONO_PROFILER_GC_HANDLE_CREATED,\r\n\tMONO_PROFILER_GC_HANDLE_DESTROYED\r\n} MonoProfileGCHandleEvent;\r\n\r\ntypedef enum {\r\n\tMONO_PROFILE_GC_ROOT_PINNING  = 1 << 8,\r\n\tMONO_PROFILE_GC_ROOT_WEAKREF  = 2 << 8,\r\n\tMONO_PROFILE_GC_ROOT_INTERIOR = 4 << 8,\r\n\t/* the above are flags, the type is in the low 2 bytes */\r\n\tMONO_PROFILE_GC_ROOT_STACK = 0,\r\n\tMONO_PROFILE_GC_ROOT_FINALIZER = 1,\r\n\tMONO_PROFILE_GC_ROOT_HANDLE = 2,\r\n\tMONO_PROFILE_GC_ROOT_OTHER = 3,\r\n\tMONO_PROFILE_GC_ROOT_MISC = 4, /* could be stack, handle, etc. */\r\n\tMONO_PROFILE_GC_ROOT_TYPEMASK = 0xff\r\n} MonoProfileGCRootType;\r\n\r\n/*\r\n * Functions that the runtime will call on the profiler.\r\n */\r\n\r\ntypedef void (*MonoProfileFunc) (MonoProfiler *prof);\r\n\r\ntypedef void (*MonoProfileAppDomainFunc) (MonoProfiler *prof, MonoDomain   *domain);\r\ntypedef void (*MonoProfileMethodFunc)   (MonoProfiler *prof, MonoMethod   *method);\r\ntypedef void (*MonoProfileClassFunc)    (MonoProfiler *prof, MonoClass    *klass);\r\ntypedef void (*MonoProfileModuleFunc)   (MonoProfiler *prof, MonoImage    *module);\r\ntypedef void (*MonoProfileAssemblyFunc) (MonoProfiler *prof, MonoAssembly *assembly);\r\ntypedef void (*MonoProfileMonitorFunc)  (MonoProfiler *prof, MonoObject *obj, MonoProfilerMonitorEvent event);\r\n\r\ntypedef void (*MonoProfileExceptionFunc) (MonoProfiler *prof, MonoObject *object);\r\ntypedef void (*MonoProfileExceptionClauseFunc) (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num);\r\n\r\ntypedef void (*MonoProfileAppDomainResult)(MonoProfiler *prof, MonoDomain   *domain,   int result);\r\ntypedef void (*MonoProfileMethodResult)   (MonoProfiler *prof, MonoMethod   *method,   int result);\r\ntypedef void (*MonoProfileJitResult)      (MonoProfiler *prof, MonoMethod   *method,   MonoJitInfo* jinfo,   int result);\r\ntypedef void (*MonoProfileClassResult)    (MonoProfiler *prof, MonoClass    *klass,    int result);\r\ntypedef void (*MonoProfileModuleResult)   (MonoProfiler *prof, MonoImage    *module,   int result);\r\ntypedef void (*MonoProfileAssemblyResult) (MonoProfiler *prof, MonoAssembly *assembly, int result);\r\n\r\ntypedef void (*MonoProfileMethodInline)   (MonoProfiler *prof, MonoMethod   *parent, MonoMethod *child, int *ok);\r\n\r\ntypedef void (*MonoProfileThreadFunc)     (MonoProfiler *prof, uintptr_t tid);\r\ntypedef void (*MonoProfileThreadNameFunc) (MonoProfiler *prof, uintptr_t tid, const char *name);\r\ntypedef void (*MonoProfileAllocFunc)      (MonoProfiler *prof, MonoObject *obj, MonoClass *klass);\r\ntypedef void (*MonoProfileStatFunc)       (MonoProfiler *prof, mono_byte *ip, void *context);\r\ntypedef void (*MonoProfileStatCallChainFunc) (MonoProfiler *prof, int call_chain_depth, mono_byte **ip, void *context);\r\ntypedef void (*MonoProfileGCFunc)         (MonoProfiler *prof, MonoGCEvent event, int generation);\r\ntypedef void (*MonoProfileGCMoveFunc)     (MonoProfiler *prof, void **objects, int num);\r\ntypedef void (*MonoProfileGCResizeFunc)   (MonoProfiler *prof, int64_t new_size);\r\ntypedef void (*MonoProfileGCHandleFunc)   (MonoProfiler *prof, int op, int type, uintptr_t handle, MonoObject *obj);\r\ntypedef void (*MonoProfileGCRootFunc)     (MonoProfiler *prof, int num_roots, void **objects, int *root_types, uintptr_t *extra_info);\r\n\r\ntypedef void (*MonoProfileIomapFunc) (MonoProfiler *prof, const char *report, const char *pathname, const char *new_pathname);\r\n\r\ntypedef mono_bool (*MonoProfileCoverageFilterFunc)   (MonoProfiler *prof, MonoMethod *method);\r\n\r\ntypedef void (*MonoProfileCoverageFunc)   (MonoProfiler *prof, const MonoProfileCoverageEntry *entry);\r\n\r\ntypedef void (*MonoProfilerCodeChunkNew) (MonoProfiler *prof, void* chunk, int size);\r\ntypedef void (*MonoProfilerCodeChunkDestroy) (MonoProfiler *prof, void* chunk);\r\ntypedef void (*MonoProfilerCodeBufferNew) (MonoProfiler *prof, void* buffer, int size, MonoProfilerCodeBufferType type, void *data);\r\n\r\n/*\r\n * Function the profiler may call.\r\n */\r\nvoid mono_profiler_install       (MonoProfiler *prof, MonoProfileFunc shutdown_callback);\r\nvoid mono_profiler_set_events    (MonoProfileFlags events);\r\n\r\nMonoProfileFlags mono_profiler_get_events (void);\r\n\r\nvoid mono_profiler_install_appdomain   (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load,\r\n                                        MonoProfileAppDomainFunc start_unload, MonoProfileAppDomainFunc end_unload);\r\nvoid mono_profiler_install_assembly    (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load,\r\n                                        MonoProfileAssemblyFunc start_unload, MonoProfileAssemblyFunc end_unload);\r\nvoid mono_profiler_install_module      (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load,\r\n                                        MonoProfileModuleFunc start_unload, MonoProfileModuleFunc end_unload);\r\nvoid mono_profiler_install_class       (MonoProfileClassFunc start_load, MonoProfileClassResult end_load,\r\n                                        MonoProfileClassFunc start_unload, MonoProfileClassFunc end_unload);\r\n\r\nvoid mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end);\r\nvoid mono_profiler_install_jit_end (MonoProfileJitResult end);\r\nvoid mono_profiler_install_method_free (MonoProfileMethodFunc callback);\r\nvoid mono_profiler_install_method_invoke (MonoProfileMethodFunc start, MonoProfileMethodFunc end);\r\nvoid mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc fleave);\r\nvoid mono_profiler_install_thread      (MonoProfileThreadFunc start, MonoProfileThreadFunc end);\r\nvoid mono_profiler_install_thread_name (MonoProfileThreadNameFunc thread_name_cb);\r\nvoid mono_profiler_install_transition  (MonoProfileMethodResult callback);\r\nvoid mono_profiler_install_allocation  (MonoProfileAllocFunc callback);\r\nvoid mono_profiler_install_monitor     (MonoProfileMonitorFunc callback);\r\nvoid mono_profiler_install_statistical (MonoProfileStatFunc callback);\r\nvoid mono_profiler_install_statistical_call_chain (MonoProfileStatCallChainFunc callback, int call_chain_depth, MonoProfilerCallChainStrategy call_chain_strategy);\r\nvoid mono_profiler_install_exception   (MonoProfileExceptionFunc throw_callback, MonoProfileMethodFunc exc_method_leave, MonoProfileExceptionClauseFunc clause_callback);\r\nvoid mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc callback);\r\nvoid mono_profiler_coverage_get  (MonoProfiler *prof, MonoMethod *method, MonoProfileCoverageFunc func);\r\nvoid mono_profiler_install_gc    (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback);\r\nvoid mono_profiler_install_gc_moves    (MonoProfileGCMoveFunc callback);\r\nvoid mono_profiler_install_gc_roots    (MonoProfileGCHandleFunc handle_callback, MonoProfileGCRootFunc roots_callback);\r\nvoid mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback);\r\n\r\nvoid mono_profiler_install_code_chunk_new (MonoProfilerCodeChunkNew callback);\r\nvoid mono_profiler_install_code_chunk_destroy (MonoProfilerCodeChunkDestroy callback);\r\nvoid mono_profiler_install_code_buffer_new (MonoProfilerCodeBufferNew callback);\r\n\r\nvoid mono_profiler_install_iomap (MonoProfileIomapFunc callback);\r\n\r\nvoid mono_profiler_load             (const char *desc);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_PROFILER_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/reflection.h",
    "content": "#ifndef __METADATA_REFLECTION_H__\r\n#define __METADATA_REFLECTION_H__\r\n\r\n#include <mono/metadata/object.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef struct MonoTypeNameParse MonoTypeNameParse;\r\n\r\ntypedef struct {\r\n\tMonoMethod *ctor;\r\n\tuint32_t     data_size;\r\n\tconst mono_byte* data;\r\n} MonoCustomAttrEntry;\r\n\r\ntypedef struct {\r\n\tint num_attrs;\r\n\tint cached;\r\n\tMonoImage *image;\r\n\tMonoCustomAttrEntry attrs [MONO_ZERO_LEN_ARRAY];\r\n} MonoCustomAttrInfo;\r\n\r\n#define MONO_SIZEOF_CUSTOM_ATTR_INFO (offsetof (MonoCustomAttrInfo, attrs))\r\n\r\n/* \r\n * Information which isn't in the MonoMethod structure is stored here for\r\n * dynamic methods.\r\n */\r\ntypedef struct {\r\n\tchar **param_names;\r\n\tMonoMarshalSpec **param_marshall;\r\n\tMonoCustomAttrInfo **param_cattr;\r\n\tuint8_t** param_defaults;\r\n\tuint32_t *param_default_types;\r\n\tchar *dllentry, *dll;\r\n} MonoReflectionMethodAux;\r\n\r\ntypedef enum {\r\n\tResolveTokenError_OutOfRange,\r\n\tResolveTokenError_BadTable,\r\n\tResolveTokenError_Other\r\n} MonoResolveTokenError;\r\n\r\nint           mono_reflection_parse_type (char *name, MonoTypeNameParse *info);\r\nMonoType*     mono_reflection_get_type   (MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve);\r\nvoid          mono_reflection_free_type_info (MonoTypeNameParse *info);\r\nMonoType*     mono_reflection_type_from_name (char *name, MonoImage *image);\r\nuint32_t      mono_reflection_get_token (MonoObject *obj);\r\n\r\nMonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly);\r\nMonoReflectionModule*   mono_module_get_object   (MonoDomain *domain, MonoImage *image);\r\nMonoReflectionModule*   mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index);\r\nMonoReflectionType*     mono_type_get_object     (MonoDomain *domain, MonoType *type);\r\nMonoReflectionMethod*   mono_method_get_object   (MonoDomain *domain, MonoMethod *method, MonoClass *refclass);\r\nMonoReflectionField*    mono_field_get_object    (MonoDomain *domain, MonoClass *klass, MonoClassField *field);\r\nMonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property);\r\nMonoReflectionEvent*    mono_event_get_object    (MonoDomain *domain, MonoClass *klass, MonoEvent *event);\r\n/* note: this one is slightly different: we keep the whole array of params in the cache */\r\nMonoArray* mono_param_get_objects  (MonoDomain *domain, MonoMethod *method);\r\nMonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method);\r\n\r\nMonoObject *mono_get_dbnull_object (MonoDomain *domain);\r\n\r\nMonoArray*  mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error);\r\nMonoArray*  mono_reflection_get_custom_attrs (MonoObject *obj);\r\nMonoArray*  mono_reflection_get_custom_attrs_data (MonoObject *obj);\r\nMonoArray*  mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);\r\n\r\nMonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj);\r\nMonoArray*  mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_index    (MonoImage *image, uint32_t idx);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_method   (MonoMethod *method);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_class    (MonoClass *klass);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_assembly (MonoAssembly *assembly);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_event    (MonoClass *klass, MonoEvent *event);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_field    (MonoClass *klass, MonoClassField *field);\r\nMonoCustomAttrInfo* mono_custom_attrs_from_param    (MonoMethod *method, uint32_t param);\r\nmono_bool           mono_custom_attrs_has_attr      (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);\r\nMonoObject*         mono_custom_attrs_get_attr      (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);\r\nvoid                mono_custom_attrs_free          (MonoCustomAttrInfo *ainfo);\r\n\r\n\r\n#define MONO_DECLSEC_ACTION_MIN\t\t0x1\r\n#define MONO_DECLSEC_ACTION_MAX\t\t0x12\r\n\r\nenum {\r\n\tMONO_DECLSEC_FLAG_REQUEST \t\t\t= 0x00000001,\r\n\tMONO_DECLSEC_FLAG_DEMAND\t\t\t= 0x00000002,\r\n\tMONO_DECLSEC_FLAG_ASSERT\t\t\t= 0x00000004,\r\n\tMONO_DECLSEC_FLAG_DENY\t\t\t\t= 0x00000008,\r\n\tMONO_DECLSEC_FLAG_PERMITONLY\t\t\t= 0x00000010,\r\n\tMONO_DECLSEC_FLAG_LINKDEMAND\t\t\t= 0x00000020,\r\n\tMONO_DECLSEC_FLAG_INHERITANCEDEMAND\t\t= 0x00000040,\r\n\tMONO_DECLSEC_FLAG_REQUEST_MINIMUM\t\t= 0x00000080,\r\n\tMONO_DECLSEC_FLAG_REQUEST_OPTIONAL\t\t= 0x00000100,\r\n\tMONO_DECLSEC_FLAG_REQUEST_REFUSE\t\t= 0x00000200,\r\n\tMONO_DECLSEC_FLAG_PREJIT_GRANT\t\t\t= 0x00000400,\r\n\tMONO_DECLSEC_FLAG_PREJIT_DENY\t\t\t= 0x00000800,\r\n\tMONO_DECLSEC_FLAG_NONCAS_DEMAND\t\t\t= 0x00001000,\r\n\tMONO_DECLSEC_FLAG_NONCAS_LINKDEMAND\t\t= 0x00002000,\r\n\tMONO_DECLSEC_FLAG_NONCAS_INHERITANCEDEMAND\t= 0x00004000,\r\n\tMONO_DECLSEC_FLAG_LINKDEMAND_CHOICE\t\t= 0x00008000,\r\n\tMONO_DECLSEC_FLAG_INHERITANCEDEMAND_CHOICE\t= 0x00010000,\r\n\tMONO_DECLSEC_FLAG_DEMAND_CHOICE\t\t\t= 0x00020000\r\n};\r\n\r\nuint32_t mono_declsec_flags_from_method (MonoMethod *method);\r\nuint32_t mono_declsec_flags_from_class (MonoClass *klass);\r\nuint32_t mono_declsec_flags_from_assembly (MonoAssembly *assembly);\r\n\r\n/* this structure MUST be kept in synch with RuntimeDeclSecurityEntry\r\n * located in /mcs/class/corlib/System.Security/SecurityFrame.cs */\r\ntypedef struct {\r\n\tchar *blob;\t\t\t\t/* pointer to metadata blob */\r\n\tuint32_t size;\t\t\t\t/* size of the metadata blob */\r\n\tuint32_t index;\r\n} MonoDeclSecurityEntry;\r\n\r\ntypedef struct {\r\n\tMonoDeclSecurityEntry demand;\r\n\tMonoDeclSecurityEntry noncasdemand;\r\n\tMonoDeclSecurityEntry demandchoice;\r\n} MonoDeclSecurityActions;\r\n\r\nMonoBoolean mono_declsec_get_demands (MonoMethod *callee, MonoDeclSecurityActions* demands);\r\nMonoBoolean mono_declsec_get_linkdemands (MonoMethod *callee, MonoDeclSecurityActions* klass, MonoDeclSecurityActions* cmethod);\r\nMonoBoolean mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions* demands);\r\nMonoBoolean mono_declsec_get_inheritdemands_method (MonoMethod *callee, MonoDeclSecurityActions* demands);\r\n\r\nMonoBoolean mono_declsec_get_method_action (MonoMethod *method, uint32_t action, MonoDeclSecurityEntry *entry);\r\nMonoBoolean mono_declsec_get_class_action (MonoClass *klass, uint32_t action, MonoDeclSecurityEntry *entry);\r\nMonoBoolean mono_declsec_get_assembly_action (MonoAssembly *assembly, uint32_t action, MonoDeclSecurityEntry *entry);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __METADATA_REFLECTION_H__ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/row-indexes.h",
    "content": "\r\n#ifndef __MONO_METADATA_ROW_INDEXES_H__\r\n#define __MONO_METADATA_ROW_INDEXES_H__\r\n\r\n/*\r\n * The last entry in the enum is used to give the number\r\n * of columns in the row.\r\n */\r\n\r\nenum {\r\n\tMONO_ASSEMBLY_HASH_ALG,\r\n\tMONO_ASSEMBLY_MAJOR_VERSION,\r\n\tMONO_ASSEMBLY_MINOR_VERSION,\r\n\tMONO_ASSEMBLY_BUILD_NUMBER,\r\n\tMONO_ASSEMBLY_REV_NUMBER,\r\n\tMONO_ASSEMBLY_FLAGS,\r\n\tMONO_ASSEMBLY_PUBLIC_KEY,\r\n\tMONO_ASSEMBLY_NAME,\r\n\tMONO_ASSEMBLY_CULTURE,\r\n\tMONO_ASSEMBLY_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_ASSEMBLYOS_PLATFORM,\r\n\tMONO_ASSEMBLYOS_MAJOR_VERSION,\r\n\tMONO_ASSEMBLYOS_MINOR_VERSION,\r\n\tMONO_ASSEMBLYOS_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_ASSEMBLY_PROCESSOR,\r\n\tMONO_ASSEMBLY_PROCESSOR_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_ASSEMBLYREF_MAJOR_VERSION,\r\n\tMONO_ASSEMBLYREF_MINOR_VERSION,\r\n\tMONO_ASSEMBLYREF_BUILD_NUMBER,\r\n\tMONO_ASSEMBLYREF_REV_NUMBER,\r\n\tMONO_ASSEMBLYREF_FLAGS,\r\n\tMONO_ASSEMBLYREF_PUBLIC_KEY,\r\n\tMONO_ASSEMBLYREF_NAME,\r\n\tMONO_ASSEMBLYREF_CULTURE,\r\n\tMONO_ASSEMBLYREF_HASH_VALUE,\r\n\tMONO_ASSEMBLYREF_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_ASSEMBLYREFOS_PLATFORM,\r\n\tMONO_ASSEMBLYREFOS_MAJOR_VERSION,\r\n\tMONO_ASSEMBLYREFOS_MINOR_VERSION,\r\n\tMONO_ASSEMBLYREFOS_ASSEMBLYREF,\r\n\tMONO_ASSEMBLYREFOS_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_ASSEMBLYREFPROC_PROCESSOR,\r\n\tMONO_ASSEMBLYREFPROC_ASSEMBLYREF,\r\n\tMONO_ASSEMBLYREFPROC_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_CLASS_LAYOUT_PACKING_SIZE,\r\n\tMONO_CLASS_LAYOUT_CLASS_SIZE,\r\n\tMONO_CLASS_LAYOUT_PARENT,\r\n\tMONO_CLASS_LAYOUT_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_CONSTANT_TYPE,\r\n\tMONO_CONSTANT_PADDING,\r\n\tMONO_CONSTANT_PARENT,\r\n\tMONO_CONSTANT_VALUE,\r\n\tMONO_CONSTANT_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_CUSTOM_ATTR_PARENT,\r\n\tMONO_CUSTOM_ATTR_TYPE,\r\n\tMONO_CUSTOM_ATTR_VALUE,\r\n\tMONO_CUSTOM_ATTR_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_DECL_SECURITY_ACTION,\r\n\tMONO_DECL_SECURITY_PARENT,\r\n\tMONO_DECL_SECURITY_PERMISSIONSET,\r\n\tMONO_DECL_SECURITY_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_EVENT_MAP_PARENT,\r\n\tMONO_EVENT_MAP_EVENTLIST,\r\n\tMONO_EVENT_MAP_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_EVENT_FLAGS,\r\n\tMONO_EVENT_NAME,\r\n\tMONO_EVENT_TYPE,\r\n\tMONO_EVENT_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_EVENT_POINTER_EVENT,\r\n\tMONO_EVENT_POINTER_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_EXP_TYPE_FLAGS,\r\n\tMONO_EXP_TYPE_TYPEDEF,\r\n\tMONO_EXP_TYPE_NAME,\r\n\tMONO_EXP_TYPE_NAMESPACE,\r\n\tMONO_EXP_TYPE_IMPLEMENTATION,\r\n\tMONO_EXP_TYPE_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_FIELD_FLAGS,\r\n\tMONO_FIELD_NAME,\r\n\tMONO_FIELD_SIGNATURE,\r\n\tMONO_FIELD_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_FIELD_LAYOUT_OFFSET,\r\n\tMONO_FIELD_LAYOUT_FIELD,\r\n\tMONO_FIELD_LAYOUT_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_FIELD_MARSHAL_PARENT,\r\n\tMONO_FIELD_MARSHAL_NATIVE_TYPE,\r\n\tMONO_FIELD_MARSHAL_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_FIELD_POINTER_FIELD,\r\n\tMONO_FIELD_POINTER_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_FIELD_RVA_RVA,\r\n\tMONO_FIELD_RVA_FIELD,\r\n\tMONO_FIELD_RVA_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_FILE_FLAGS,\r\n\tMONO_FILE_NAME,\r\n\tMONO_FILE_HASH_VALUE,\r\n\tMONO_FILE_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_IMPLMAP_FLAGS,\r\n\tMONO_IMPLMAP_MEMBER,\r\n\tMONO_IMPLMAP_NAME,\r\n\tMONO_IMPLMAP_SCOPE,\r\n\tMONO_IMPLMAP_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_INTERFACEIMPL_CLASS,\r\n\tMONO_INTERFACEIMPL_INTERFACE,\r\n\tMONO_INTERFACEIMPL_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_MANIFEST_OFFSET,\r\n\tMONO_MANIFEST_FLAGS,\r\n\tMONO_MANIFEST_NAME,\r\n\tMONO_MANIFEST_IMPLEMENTATION,\r\n\tMONO_MANIFEST_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_MEMBERREF_CLASS,\r\n\tMONO_MEMBERREF_NAME,\r\n\tMONO_MEMBERREF_SIGNATURE,\r\n\tMONO_MEMBERREF_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_METHOD_RVA,\r\n\tMONO_METHOD_IMPLFLAGS,\r\n\tMONO_METHOD_FLAGS,\r\n\tMONO_METHOD_NAME,\r\n\tMONO_METHOD_SIGNATURE,\r\n\tMONO_METHOD_PARAMLIST,\r\n\tMONO_METHOD_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_METHODIMPL_CLASS,\r\n\tMONO_METHODIMPL_BODY,\r\n\tMONO_METHODIMPL_DECLARATION,\r\n\tMONO_METHODIMPL_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_METHOD_POINTER_METHOD,\r\n\tMONO_METHOD_POINTER_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_METHOD_SEMA_SEMANTICS,\r\n\tMONO_METHOD_SEMA_METHOD,\r\n\tMONO_METHOD_SEMA_ASSOCIATION,\r\n\tMONO_METHOD_SEMA_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_MODULE_GENERATION,\r\n\tMONO_MODULE_NAME,\r\n\tMONO_MODULE_MVID,\r\n\tMONO_MODULE_ENC,\r\n\tMONO_MODULE_ENCBASE,\r\n\tMONO_MODULE_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_MODULEREF_NAME,\r\n\tMONO_MODULEREF_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_NESTED_CLASS_NESTED,\r\n\tMONO_NESTED_CLASS_ENCLOSING,\r\n\tMONO_NESTED_CLASS_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_PARAM_FLAGS,\r\n\tMONO_PARAM_SEQUENCE,\r\n\tMONO_PARAM_NAME,\r\n\tMONO_PARAM_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_PARAM_POINTER_PARAM,\r\n\tMONO_PARAM_POINTER_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_PROPERTY_FLAGS,\r\n\tMONO_PROPERTY_NAME,\r\n\tMONO_PROPERTY_TYPE,\r\n\tMONO_PROPERTY_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_PROPERTY_POINTER_PROPERTY,\r\n\tMONO_PROPERTY_POINTER_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_PROPERTY_MAP_PARENT,\r\n\tMONO_PROPERTY_MAP_PROPERTY_LIST,\r\n\tMONO_PROPERTY_MAP_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_STAND_ALONE_SIGNATURE,\r\n\tMONO_STAND_ALONE_SIGNATURE_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_TYPEDEF_FLAGS,\r\n\tMONO_TYPEDEF_NAME,\r\n\tMONO_TYPEDEF_NAMESPACE,\r\n\tMONO_TYPEDEF_EXTENDS,\r\n\tMONO_TYPEDEF_FIELD_LIST,\r\n\tMONO_TYPEDEF_METHOD_LIST,\r\n\tMONO_TYPEDEF_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_TYPEREF_SCOPE,\r\n\tMONO_TYPEREF_NAME,\r\n\tMONO_TYPEREF_NAMESPACE,\r\n\tMONO_TYPEREF_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_TYPESPEC_SIGNATURE,\r\n\tMONO_TYPESPEC_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_GENERICPARAM_NUMBER,\r\n\tMONO_GENERICPARAM_FLAGS,\r\n\tMONO_GENERICPARAM_OWNER,\r\n\tMONO_GENERICPARAM_NAME,\r\n\t\r\n\tMONO_GENERICPARAM_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_METHODSPEC_METHOD,\r\n\tMONO_METHODSPEC_SIGNATURE,\r\n\tMONO_METHODSPEC_SIZE\r\n};\r\n\r\nenum {\r\n\tMONO_GENPARCONSTRAINT_GENERICPAR,\r\n\tMONO_GENPARCONSTRAINT_CONSTRAINT,\r\n\tMONO_GENPARCONSTRAINT_SIZE\r\n};\r\n\r\n/*\r\n * Coded Tokens\r\n * The _BITS entry is for the bits used in the token.\r\n * The _MASK entry is for mask the index out.\r\n */\r\n\r\nenum {\r\n\tMONO_TYPEDEFORREF_TYPEDEF,\r\n\tMONO_TYPEDEFORREF_TYPEREF,\r\n\tMONO_TYPEDEFORREF_TYPESPEC,\r\n\tMONO_TYPEDEFORREF_BITS = 2,\r\n\tMONO_TYPEDEFORREF_MASK = 3\r\n};\r\n\r\nenum {\r\n\tMONO_HASCONSTANT_FIEDDEF,\r\n\tMONO_HASCONSTANT_PARAM,\r\n\tMONO_HASCONSTANT_PROPERTY,\r\n\tMONO_HASCONSTANT_BITS = 2,\r\n\tMONO_HASCONSTANT_MASK = 3\r\n};\r\n\r\nenum {\r\n\tMONO_CUSTOM_ATTR_METHODDEF,\r\n\tMONO_CUSTOM_ATTR_FIELDDEF,\r\n\tMONO_CUSTOM_ATTR_TYPEREF,\r\n\tMONO_CUSTOM_ATTR_TYPEDEF,\r\n\tMONO_CUSTOM_ATTR_PARAMDEF,\r\n\tMONO_CUSTOM_ATTR_INTERFACE,\r\n\tMONO_CUSTOM_ATTR_MEMBERREF,\r\n\tMONO_CUSTOM_ATTR_MODULE,\r\n\tMONO_CUSTOM_ATTR_PERMISSION,\r\n\tMONO_CUSTOM_ATTR_PROPERTY,\r\n\tMONO_CUSTOM_ATTR_EVENT,\r\n\tMONO_CUSTOM_ATTR_SIGNATURE,\r\n\tMONO_CUSTOM_ATTR_MODULEREF,\r\n\tMONO_CUSTOM_ATTR_TYPESPEC,\r\n\tMONO_CUSTOM_ATTR_ASSEMBLY,\r\n\tMONO_CUSTOM_ATTR_ASSEMBLYREF,\r\n\tMONO_CUSTOM_ATTR_FILE,\r\n\tMONO_CUSTOM_ATTR_EXP_TYPE,\r\n\tMONO_CUSTOM_ATTR_MANIFEST,\r\n\tMONO_CUSTOM_ATTR_GENERICPAR,\r\n\tMONO_CUSTOM_ATTR_BITS = 5,\r\n\tMONO_CUSTOM_ATTR_MASK = 0x1F\r\n};\r\n\r\nenum {\r\n\tMONO_HAS_FIELD_MARSHAL_FIELDSREF,\r\n\tMONO_HAS_FIELD_MARSHAL_PARAMDEF,\r\n\tMONO_HAS_FIELD_MARSHAL_BITS = 1,\r\n\tMONO_HAS_FIELD_MARSHAL_MASK = 1\r\n};\r\n\r\nenum {\r\n\tMONO_HAS_DECL_SECURITY_TYPEDEF,\r\n\tMONO_HAS_DECL_SECURITY_METHODDEF,\r\n\tMONO_HAS_DECL_SECURITY_ASSEMBLY,\r\n\tMONO_HAS_DECL_SECURITY_BITS = 2,\r\n\tMONO_HAS_DECL_SECURITY_MASK = 3\r\n};\r\n\r\nenum {\r\n\tMONO_MEMBERREF_PARENT_TYPEDEF, /* not used */\r\n\tMONO_MEMBERREF_PARENT_TYPEREF,\r\n\tMONO_MEMBERREF_PARENT_MODULEREF,\r\n\tMONO_MEMBERREF_PARENT_METHODDEF,\r\n\tMONO_MEMBERREF_PARENT_TYPESPEC,\r\n\tMONO_MEMBERREF_PARENT_BITS = 3,\r\n\tMONO_MEMBERREF_PARENT_MASK = 7\r\n};\r\n\r\nenum {\r\n\tMONO_HAS_SEMANTICS_EVENT,\r\n\tMONO_HAS_SEMANTICS_PROPERTY,\r\n\tMONO_HAS_SEMANTICS_BITS = 1,\r\n\tMONO_HAS_SEMANTICS_MASK = 1\r\n};\r\n\r\nenum {\r\n\tMONO_METHODDEFORREF_METHODDEF,\r\n\tMONO_METHODDEFORREF_METHODREF,\r\n\tMONO_METHODDEFORREF_BITS = 1,\r\n\tMONO_METHODDEFORREF_MASK = 1\r\n};\r\n\r\nenum {\r\n\tMONO_MEMBERFORWD_FIELDDEF,\r\n\tMONO_MEMBERFORWD_METHODDEF,\r\n\tMONO_MEMBERFORWD_BITS = 1,\r\n\tMONO_MEMBERFORWD_MASK = 1\r\n};\r\n\r\nenum {\r\n\tMONO_IMPLEMENTATION_FILE,\r\n\tMONO_IMPLEMENTATION_ASSEMBLYREF,\r\n\tMONO_IMPLEMENTATION_EXP_TYPE,\r\n\tMONO_IMPLEMENTATION_BITS = 2,\r\n\tMONO_IMPLEMENTATION_MASK = 3\r\n};\r\n\r\nenum {\r\n\tMONO_CUSTOM_ATTR_TYPE_TYPEREF, /* not used */\r\n\tMONO_CUSTOM_ATTR_TYPE_TYPEDEF, /* not used */\r\n\tMONO_CUSTOM_ATTR_TYPE_METHODDEF,\r\n\tMONO_CUSTOM_ATTR_TYPE_MEMBERREF,\r\n\tMONO_CUSTOM_ATTR_TYPE_STRING, /* not used */\r\n\tMONO_CUSTOM_ATTR_TYPE_BITS = 3,\r\n\tMONO_CUSTOM_ATTR_TYPE_MASK = 7\r\n};\r\n\r\nenum {\r\n\tMONO_RESOLTION_SCOPE_MODULE,\r\n\tMONO_RESOLTION_SCOPE_MODULEREF,\r\n\tMONO_RESOLTION_SCOPE_ASSEMBLYREF,\r\n\tMONO_RESOLTION_SCOPE_TYPEREF,\r\n\tMONO_RESOLTION_SCOPE_BITS = 2,\r\n\tMONO_RESOLTION_SCOPE_MASK = 3\r\n};\r\n\r\nenum {\r\n\tMONO_TYPEORMETHOD_TYPE,\r\n\tMONO_TYPEORMETHOD_METHOD,\r\n\tMONO_TYPEORMETHOD_BITS = 1,\r\n\tMONO_TYPEORMETHOD_MASK = 1\r\n};\r\n\r\n#endif /* __MONO_METADATA_ROW_INDEXES_H__ */\r\n\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/sgen-bridge.h",
    "content": "/*\r\n * Copyright 2011 Novell, Inc.\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining\r\n * a copy of this software and associated documentation files (the\r\n * \"Software\"), to deal in the Software without restriction, including\r\n * without limitation the rights to use, copy, modify, merge, publish,\r\n * distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to\r\n * the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n#ifndef _MONO_SGEN_BRIDGE_H_\r\n#define _MONO_SGEN_BRIDGE_H_\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef struct {\r\n\tint num_objs;\r\n\tMonoObject *objs [MONO_ZERO_LEN_ARRAY];\r\n} MonoGCBridgeSCC;\r\n\r\ntypedef struct {\r\n\tint src_scc_index;\r\n\tint dst_scc_index;\r\n} MonoGCBridgeXRef;\r\n\r\ntypedef struct {\r\n\tmono_bool (*is_bridge_object) (MonoObject *obj);\r\n\tvoid (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, MonoGCBridgeXRef *xrefs);\r\n} MonoGCBridgeCallbacks;\r\n\r\nvoid mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/threads.h",
    "content": "/*\r\n * threads.h: Threading API\r\n *\r\n * Author:\r\n *\tDick Porter (dick@ximian.com)\r\n *\tPatrik Torstensson (patrik.torstensson@labs2.com)\r\n *\r\n * (C) 2001 Ximian, Inc\r\n */\r\n\r\n#ifndef _MONO_METADATA_THREADS_H_\r\n#define _MONO_METADATA_THREADS_H_\r\n\r\n#include <mono/utils/mono-publib.h>\r\n#include <mono/metadata/object.h>\r\n#include <mono/metadata/appdomain.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\n/* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */\r\ntypedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread);\r\n\r\nextern void mono_thread_init (MonoThreadStartCB start_cb,\r\n\t\t\t      MonoThreadAttachCB attach_cb);\r\nextern void mono_thread_cleanup (void);\r\nextern void mono_thread_manage(void);\r\n\r\nextern MonoThread *mono_thread_current (void);\r\n\r\nextern void        mono_thread_set_main (MonoThread *thread);\r\nextern MonoThread *mono_thread_get_main (void);\r\n\r\nextern void mono_thread_stop (MonoThread *thread);\r\n\r\nextern void mono_thread_new_init (intptr_t tid, void* stack_start,\r\n\t\t\t\t  void* func);\r\nextern void mono_thread_create (MonoDomain *domain, void* func, void* arg);\r\nextern MonoThread *mono_thread_attach (MonoDomain *domain);\r\nextern void mono_thread_detach (MonoThread *thread);\r\nextern void mono_thread_exit (void);\r\n\r\nvoid     mono_thread_set_manage_callback (MonoThread *thread, MonoThreadManageCallback func);\r\n\r\nextern void mono_threads_set_default_stacksize (uint32_t stacksize);\r\nextern uint32_t mono_threads_get_default_stacksize (void);\r\n\r\nvoid mono_threads_request_thread_dump (void);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* _MONO_METADATA_THREADS_H_ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/tokentype.h",
    "content": "#ifndef _MONO_METADATA_TOKENTYPE_H_\r\n#define _MONO_METADATA_TOKENTYPE_H_\r\n\r\n/*\r\n * These tokens match the table ID except for the last\r\n * three (string, name and base type which are special)\r\n */\r\n \r\ntypedef enum {\r\n\tMONO_TOKEN_MODULE            = 0x00000000,\r\n\tMONO_TOKEN_TYPE_REF          = 0x01000000,\r\n\tMONO_TOKEN_TYPE_DEF          = 0x02000000,\r\n\tMONO_TOKEN_FIELD_DEF         = 0x04000000,\r\n\tMONO_TOKEN_METHOD_DEF        = 0x06000000, \r\n\tMONO_TOKEN_PARAM_DEF         = 0x08000000,\r\n\tMONO_TOKEN_INTERFACE_IMPL    = 0x09000000,\r\n\tMONO_TOKEN_MEMBER_REF        = 0x0a000000,\r\n\tMONO_TOKEN_CUSTOM_ATTRIBUTE  = 0x0c000000,\r\n\tMONO_TOKEN_PERMISSION        = 0x0e000000,\r\n\tMONO_TOKEN_SIGNATURE         = 0x11000000,\r\n\tMONO_TOKEN_EVENT             = 0x14000000,\r\n\tMONO_TOKEN_PROPERTY          = 0x17000000,\r\n\tMONO_TOKEN_MODULE_REF        = 0x1a000000,\r\n\tMONO_TOKEN_TYPE_SPEC         = 0x1b000000,\r\n\tMONO_TOKEN_ASSEMBLY          = 0x20000000,\r\n\tMONO_TOKEN_ASSEMBLY_REF      = 0x23000000,\r\n\tMONO_TOKEN_FILE              = 0x26000000,\r\n\tMONO_TOKEN_EXPORTED_TYPE     = 0x27000000,\r\n\tMONO_TOKEN_MANIFEST_RESOURCE = 0x28000000,\r\n\tMONO_TOKEN_GENERIC_PARAM     = 0x2a000000,\r\n\tMONO_TOKEN_METHOD_SPEC       = 0x2b000000,\r\n\r\n\t/*\r\n\t * These do not match metadata tables directly\r\n\t */\r\n\tMONO_TOKEN_STRING            = 0x70000000,\r\n\tMONO_TOKEN_NAME              = 0x71000000,\r\n\tMONO_TOKEN_BASE_TYPE         = 0x72000000\r\n} MonoTokenType;\r\n\r\n#endif /* _MONO_METADATA_TOKENTYPE_H_ */\r\n"
  },
  {
    "path": "Engine/libs/mono/metadata/verify.h",
    "content": "#ifndef __MONO_METADATA_VERIFY_H__\r\n#define __MONO_METADATA_VERIFY_H__\r\n\r\n#include <mono/metadata/metadata.h>\r\n#include <mono/metadata/image.h>\r\n#include <mono/metadata/loader.h>\r\n#include <glib.h> /* GSList dep */\r\n\r\nMONO_BEGIN_DECLS\r\n\r\ntypedef enum {\r\n\tMONO_VERIFY_OK,\r\n\tMONO_VERIFY_ERROR,\r\n\tMONO_VERIFY_WARNING,\r\n\tMONO_VERIFY_CLS = 4,\r\n\tMONO_VERIFY_ALL = 7,\r\n\r\n\t/* Status signaling code that is not verifiable.*/\r\n\tMONO_VERIFY_NOT_VERIFIABLE = 8,\r\n\r\n\t/*OR it with other flags*/\r\n\t\r\n\t/* Abort the verification if the code is not verifiable.\r\n\t * The standard behavior is to abort if the code is not valid.\r\n\t * */\r\n\tMONO_VERIFY_FAIL_FAST = 16,\r\n\r\n\r\n\t/* Perform less verification of the code. This flag should be used\r\n\t * if one wants the verifier to be more compatible to the MS runtime.\r\n\t * Mind that this is not to be more compatible with MS peverify, but\r\n\t * with the runtime itself, that has a less strict verifier.\r\n\t */\r\n\tMONO_VERIFY_NON_STRICT = 32,\r\n\r\n\t/*Skip all visibility related checks*/\r\n\tMONO_VERIFY_SKIP_VISIBILITY = 64,\r\n\r\n\t/*Skip all visibility related checks*/\r\n\tMONO_VERIFY_REPORT_ALL_ERRORS = 128\r\n\r\n} MonoVerifyStatus;\r\n\r\ntypedef struct {\r\n\tchar            *message;\r\n\tMonoVerifyStatus status;\r\n} MonoVerifyInfo;\r\n\r\ntypedef struct {\r\n\tMonoVerifyInfo info;\r\n\tint8_t exception_type; /*should be one of MONO_EXCEPTION_* */\r\n} MonoVerifyInfoExtended;\r\n\r\n\r\nGSList* mono_method_verify       (MonoMethod *method, int level);\r\nvoid    mono_free_verify_list    (GSList *list);\r\nchar*   mono_verify_corlib       (void);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif  /* __MONO_METADATA_VERIFY_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/utils/mono-dl-fallback.h",
    "content": "#ifndef __MONO_UTILS_DL_FALLBACK_H__\r\n#define __MONO_UTILS_DL_FALLBACK_H__\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nenum {\r\n\tMONO_DL_LAZY  = 1,\r\n\tMONO_DL_LOCAL = 2,\r\n\tMONO_DL_MASK  = 3\r\n};\r\n\r\n/*\r\n * This is the dynamic loader fallback API\r\n */\r\ntypedef struct MonoDlFallbackHandler MonoDlFallbackHandler;\r\n\r\n/*\r\n * The \"err\" variable contents must be allocated using g_malloc or g_strdup\r\n */\r\ntypedef void* (*MonoDlFallbackLoad) (const char *name, int flags, char **err, void *user_data);\r\ntypedef void* (*MonoDlFallbackSymbol) (void *handle, const char *name, char **err, void *user_data);\r\ntypedef void* (*MonoDlFallbackClose) (void *handle, void *user_data);\r\n\r\nMonoDlFallbackHandler *mono_dl_fallback_register (MonoDlFallbackLoad load_func, MonoDlFallbackSymbol symbol_func,\r\n\t\t\t\t\t\t  MonoDlFallbackClose close_func, void *user_data);\r\n\r\nvoid                   mono_dl_fallback_unregister (MonoDlFallbackHandler *handler);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_UTILS_DL_FALLBACK_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/mono/utils/mono-error.h",
    "content": "#ifndef __MONO_ERROR_H__\r\n#define __MONO_ERROR_H__\r\n\r\n#include <mono/utils/mono-publib.h>\r\n\r\nenum {\r\n\t/*\r\n\tThe supplied strings were dup'd by means of calling mono_error_dup_strings.\r\n\t*/\r\n\tMONO_ERROR_FREE_STRINGS = 0x0001,\r\n\r\n\t/*\r\n\tSomething happened while processing the error and the resulting message is incomplete.\r\n\t*/\r\n\tMONO_ERROR_INCOMPLETE = 0x0002\r\n};\r\n\r\nenum {\r\n\tMONO_ERROR_NONE = 0,\r\n\tMONO_ERROR_MISSING_METHOD = 1,\r\n\tMONO_ERROR_MISSING_FIELD = 2,\r\n\tMONO_ERROR_TYPE_LOAD = 3,\r\n\tMONO_ERROR_FILE_NOT_FOUND = 4,\r\n\tMONO_ERROR_BAD_IMAGE = 5,\r\n\tMONO_ERROR_OUT_OF_MEMORY = 6,\r\n\tMONO_ERROR_ARGUMENT = 7,\r\n\tMONO_ERROR_NOT_VERIFIABLE = 8,\r\n\t/*\r\n\t * This is a generic error mechanism is you need to raise an arbitrary corlib exception.\r\n\t * You must pass the exception name otherwise prepare_exception will fail with internal execution. \r\n\t */\r\n\tMONO_ERROR_GENERIC = 9\r\n};\r\n\r\n/*Keep in sync with MonoErrorInternal*/\r\ntypedef struct {\r\n\tunsigned short error_code;\r\n    unsigned short hidden_0; /*DON'T TOUCH */\r\n\r\n\tvoid *hidden_1 [12]; /*DON'T TOUCH */\r\n    char hidden_2 [128]; /*DON'T TOUCH */\r\n} MonoError;\r\n\r\nMONO_BEGIN_DECLS\r\n\r\nvoid\r\nmono_error_init (MonoError *error);\r\n\r\nvoid\r\nmono_error_init_flags (MonoError *error, unsigned short flags);\r\n\r\nvoid\r\nmono_error_cleanup (MonoError *error);\r\n\r\nmono_bool\r\nmono_error_ok (MonoError *error);\r\n\r\nunsigned short\r\nmono_error_get_error_code (MonoError *error);\r\n\r\nconst char*\r\nmono_error_get_message (MonoError *error);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/libs/mono/utils/mono-logger.h",
    "content": "#ifndef __MONO_LOGGER_H__\r\n#define __MONO_LOGGER_H__\r\n\r\n#include <mono/utils/mono-publib.h>\r\nMONO_BEGIN_DECLS\r\n\r\nvoid \r\nmono_trace_set_level_string (const char *value);\r\n\r\nvoid \r\nmono_trace_set_mask_string (const char *value);\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_LOGGER_H__ */\r\n"
  },
  {
    "path": "Engine/libs/mono/utils/mono-publib.h",
    "content": "#ifndef __MONO_PUBLIB_H__\r\n#define __MONO_PUBLIB_H__\r\n\r\n/* \r\n * Minimal general purpose header for use in public mono header files.\r\n * We can't include config.h, so we use compiler-specific preprocessor\r\n * directives where needed.\r\n */\r\n\r\n#ifdef  __cplusplus\r\n#define MONO_BEGIN_DECLS  extern \"C\" {\r\n#define MONO_END_DECLS    }\r\n#else\r\n#define MONO_BEGIN_DECLS\r\n#define MONO_END_DECLS\r\n#endif\r\n\r\nMONO_BEGIN_DECLS\r\n\r\n/* VS 2010 and later have stdint.h */\r\n#if defined(_MSC_VER) && _MSC_VER < 1600\r\n\r\ntypedef __int8\t\t\tint8_t;\r\ntypedef unsigned __int8\t\tuint8_t;\r\ntypedef __int16\t\t\tint16_t;\r\ntypedef unsigned __int16\tuint16_t;\r\ntypedef __int32\t\t\tint32_t;\r\ntypedef unsigned __int32\tuint32_t;\r\ntypedef __int64\t\t\tint64_t;\r\ntypedef unsigned __int64\tuint64_t;\r\n\r\n#else\r\n\r\n#include <stdint.h>\r\n\r\n#endif /* end of compiler-specific stuff */\r\n\r\ntypedef int32_t\t\tmono_bool;\r\ntypedef uint8_t\t\tmono_byte;\r\ntypedef uint16_t\tmono_unichar2;\r\n\r\ntypedef void\t(*MonoFunc)\t(void* data, void* user_data);\r\ntypedef void\t(*MonoHFunc)\t(void* key, void* value, void* user_data);\r\n\r\nvoid mono_free (void *);\r\n\r\n#define MONO_CONST_RETURN const\r\n\r\nMONO_END_DECLS\r\n\r\n#endif /* __MONO_PUBLIB_H__ */\r\n\r\n"
  },
  {
    "path": "Engine/libs/sha1/hash_sha1.c",
    "content": "/*\r\n *  sha1.c\r\n *\r\n *  Copyright (C) 1998, 2009\r\n *  Paul E. Jones <paulej@packetizer.com>\r\n *  All Rights Reserved\r\n *\r\n *****************************************************************************\r\n *  $Id: sha1.c 12 2009-06-22 19:34:25Z paulej $\r\n *****************************************************************************\r\n *\r\n *  Description:\r\n *      This file implements the Secure Hashing Standard as defined\r\n *      in FIPS PUB 180-1 published April 17, 1995.\r\n *\r\n *      The Secure Hashing Standard, which uses the Secure Hashing\r\n *      Algorithm (SHA), produces a 160-bit message digest for a\r\n *      given data stream.  In theory, it is highly improbable that\r\n *      two messages will produce the same message digest.  Therefore,\r\n *      this algorithm can serve as a means of providing a \"fingerprint\"\r\n *      for a message.\r\n *\r\n *  Portability Issues:\r\n *      SHA-1 is defined in terms of 32-bit \"words\".  This code was\r\n *      written with the expectation that the processor has at least\r\n *      a 32-bit machine word size.  If the machine word size is larger,\r\n *      the code should still function properly.  One caveat to that\r\n *      is that the input functions taking characters and character\r\n *      arrays assume that only 8 bits of information are stored in each\r\n *      character.\r\n *\r\n *  Caveats:\r\n *      SHA-1 is designed to work with messages less than 2^64 bits\r\n *      long. Although SHA-1 allows a message digest to be generated for\r\n *      messages of any number of bits less than 2^64, this\r\n *      implementation only works with messages with a length that is a\r\n *      multiple of the size of an 8-bit character.\r\n *\r\n */\r\n\r\n#include \"hash_sha1.h\"\r\n\r\n/*\r\n *  Define the circular shift macro\r\n */\r\n#define SHA1CircularShift(bits,word) \\\r\n                ((((word) << (bits)) & 0xFFFFFFFF) | \\\r\n                ((word) >> (32-(bits))))\r\n\r\n/* Function prototypes */\r\nvoid SHA1ProcessMessageBlock(SHA1Context *);\r\nvoid SHA1PadMessage(SHA1Context *);\r\n\r\n/*  \r\n *  SHA1Reset\r\n *\r\n *  Description:\r\n *      This function will initialize the SHA1Context in preparation\r\n *      for computing a new message digest.\r\n *\r\n *  Parameters:\r\n *      context: [in/out]\r\n *          The context to reset.\r\n *\r\n *  Returns:\r\n *      Nothing.\r\n *\r\n *  Comments:\r\n *\r\n */\r\nvoid SHA1Reset(SHA1Context *context)\r\n{\r\n    context->Length_Low             = 0;\r\n    context->Length_High            = 0;\r\n    context->Message_Block_Index    = 0;\r\n\r\n    context->Message_Digest[0]      = 0x67452301;\r\n    context->Message_Digest[1]      = 0xEFCDAB89;\r\n    context->Message_Digest[2]      = 0x98BADCFE;\r\n    context->Message_Digest[3]      = 0x10325476;\r\n    context->Message_Digest[4]      = 0xC3D2E1F0;\r\n\r\n    context->Computed   = 0;\r\n    context->Corrupted  = 0;\r\n}\r\n\r\n/*  \r\n *  SHA1Result\r\n *\r\n *  Description:\r\n *      This function will return the 160-bit message digest into the\r\n *      Message_Digest array within the SHA1Context provided\r\n *\r\n *  Parameters:\r\n *      context: [in/out]\r\n *          The context to use to calculate the SHA-1 hash.\r\n *\r\n *  Returns:\r\n *      1 if successful, 0 if it failed.\r\n *\r\n *  Comments:\r\n *\r\n */\r\nint SHA1Result(SHA1Context *context)\r\n{\r\n\r\n    if (context->Corrupted)\r\n    {\r\n        return 0;\r\n    }\r\n\r\n    if (!context->Computed)\r\n    {\r\n        SHA1PadMessage(context);\r\n        context->Computed = 1;\r\n    }\r\n\r\n    return 1;\r\n}\r\n\r\n/*  \r\n *  SHA1Input\r\n *\r\n *  Description:\r\n *      This function accepts an array of octets as the next portion of\r\n *      the message.\r\n *\r\n *  Parameters:\r\n *      context: [in/out]\r\n *          The SHA-1 context to update\r\n *      message_array: [in]\r\n *          An array of characters representing the next portion of the\r\n *          message.\r\n *      length: [in]\r\n *          The length of the message in message_array\r\n *\r\n *  Returns:\r\n *      Nothing.\r\n *\r\n *  Comments:\r\n *\r\n */\r\nvoid SHA1Input(     SHA1Context         *context,\r\n                    const unsigned char *message_array,\r\n                    unsigned            length)\r\n{\r\n    if (!length)\r\n    {\r\n        return;\r\n    }\r\n\r\n    if (context->Computed || context->Corrupted)\r\n    {\r\n        context->Corrupted = 1;\r\n        return;\r\n    }\r\n\r\n    while(length-- && !context->Corrupted)\r\n    {\r\n        context->Message_Block[context->Message_Block_Index++] =\r\n                                                (*message_array & 0xFF);\r\n\r\n        context->Length_Low += 8;\r\n        /* Force it to 32 bits */\r\n        context->Length_Low &= 0xFFFFFFFF;\r\n        if (context->Length_Low == 0)\r\n        {\r\n            context->Length_High++;\r\n            /* Force it to 32 bits */\r\n            context->Length_High &= 0xFFFFFFFF;\r\n            if (context->Length_High == 0)\r\n            {\r\n                /* Message is too long */\r\n                context->Corrupted = 1;\r\n            }\r\n        }\r\n\r\n        if (context->Message_Block_Index == 64)\r\n        {\r\n            SHA1ProcessMessageBlock(context);\r\n        }\r\n\r\n        message_array++;\r\n    }\r\n}\r\n\r\n/*  \r\n *  SHA1ProcessMessageBlock\r\n *\r\n *  Description:\r\n *      This function will process the next 512 bits of the message\r\n *      stored in the Message_Block array.\r\n *\r\n *  Parameters:\r\n *      None.\r\n *\r\n *  Returns:\r\n *      Nothing.\r\n *\r\n *  Comments:\r\n *      Many of the variable names in the SHAContext, especially the\r\n *      single character names, were used because those were the names\r\n *      used in the publication.\r\n *         \r\n *\r\n */\r\nvoid SHA1ProcessMessageBlock(SHA1Context *context)\r\n{\r\n    const unsigned K[] =            /* Constants defined in SHA-1   */      \r\n    {\r\n        0x5A827999,\r\n        0x6ED9EBA1,\r\n        0x8F1BBCDC,\r\n        0xCA62C1D6\r\n    };\r\n    int         t;                  /* Loop counter                 */\r\n    unsigned    temp;               /* Temporary word value         */\r\n    unsigned    W[80];              /* Word sequence                */\r\n    unsigned    A, B, C, D, E;      /* Word buffers                 */\r\n\r\n    /*\r\n     *  Initialize the first 16 words in the array W\r\n     */\r\n    for(t = 0; t < 16; t++)\r\n    {\r\n        W[t] = ((unsigned) context->Message_Block[t * 4]) << 24;\r\n        W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16;\r\n        W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8;\r\n        W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]);\r\n    }\r\n\r\n    for(t = 16; t < 80; t++)\r\n    {\r\n       W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);\r\n    }\r\n\r\n    A = context->Message_Digest[0];\r\n    B = context->Message_Digest[1];\r\n    C = context->Message_Digest[2];\r\n    D = context->Message_Digest[3];\r\n    E = context->Message_Digest[4];\r\n\r\n    for(t = 0; t < 20; t++)\r\n    {\r\n        temp =  SHA1CircularShift(5,A) +\r\n                ((B & C) | ((~B) & D)) + E + W[t] + K[0];\r\n        temp &= 0xFFFFFFFF;\r\n        E = D;\r\n        D = C;\r\n        C = SHA1CircularShift(30,B);\r\n        B = A;\r\n        A = temp;\r\n    }\r\n\r\n    for(t = 20; t < 40; t++)\r\n    {\r\n        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];\r\n        temp &= 0xFFFFFFFF;\r\n        E = D;\r\n        D = C;\r\n        C = SHA1CircularShift(30,B);\r\n        B = A;\r\n        A = temp;\r\n    }\r\n\r\n    for(t = 40; t < 60; t++)\r\n    {\r\n        temp = SHA1CircularShift(5,A) +\r\n               ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];\r\n        temp &= 0xFFFFFFFF;\r\n        E = D;\r\n        D = C;\r\n        C = SHA1CircularShift(30,B);\r\n        B = A;\r\n        A = temp;\r\n    }\r\n\r\n    for(t = 60; t < 80; t++)\r\n    {\r\n        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];\r\n        temp &= 0xFFFFFFFF;\r\n        E = D;\r\n        D = C;\r\n        C = SHA1CircularShift(30,B);\r\n        B = A;\r\n        A = temp;\r\n    }\r\n\r\n    context->Message_Digest[0] =\r\n                        (context->Message_Digest[0] + A) & 0xFFFFFFFF;\r\n    context->Message_Digest[1] =\r\n                        (context->Message_Digest[1] + B) & 0xFFFFFFFF;\r\n    context->Message_Digest[2] =\r\n                        (context->Message_Digest[2] + C) & 0xFFFFFFFF;\r\n    context->Message_Digest[3] =\r\n                        (context->Message_Digest[3] + D) & 0xFFFFFFFF;\r\n    context->Message_Digest[4] =\r\n                        (context->Message_Digest[4] + E) & 0xFFFFFFFF;\r\n\r\n    context->Message_Block_Index = 0;\r\n}\r\n\r\n/*  \r\n *  SHA1PadMessage\r\n *\r\n *  Description:\r\n *      According to the standard, the message must be padded to an even\r\n *      512 bits.  The first padding bit must be a '1'.  The last 64\r\n *      bits represent the length of the original message.  All bits in\r\n *      between should be 0.  This function will pad the message\r\n *      according to those rules by filling the Message_Block array\r\n *      accordingly.  It will also call SHA1ProcessMessageBlock()\r\n *      appropriately.  When it returns, it can be assumed that the\r\n *      message digest has been computed.\r\n *\r\n *  Parameters:\r\n *      context: [in/out]\r\n *          The context to pad\r\n *\r\n *  Returns:\r\n *      Nothing.\r\n *\r\n *  Comments:\r\n *\r\n */\r\nvoid SHA1PadMessage(SHA1Context *context)\r\n{\r\n    /*\r\n     *  Check to see if the current message block is too small to hold\r\n     *  the initial padding bits and length.  If so, we will pad the\r\n     *  block, process it, and then continue padding into a second\r\n     *  block.\r\n     */\r\n    if (context->Message_Block_Index > 55)\r\n    {\r\n        context->Message_Block[context->Message_Block_Index++] = 0x80;\r\n        while(context->Message_Block_Index < 64)\r\n        {\r\n            context->Message_Block[context->Message_Block_Index++] = 0;\r\n        }\r\n\r\n        SHA1ProcessMessageBlock(context);\r\n\r\n        while(context->Message_Block_Index < 56)\r\n        {\r\n            context->Message_Block[context->Message_Block_Index++] = 0;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        context->Message_Block[context->Message_Block_Index++] = 0x80;\r\n        while(context->Message_Block_Index < 56)\r\n        {\r\n            context->Message_Block[context->Message_Block_Index++] = 0;\r\n        }\r\n    }\r\n\r\n    /*\r\n     *  Store the message length as the last 8 octets\r\n     */\r\n    context->Message_Block[56] = (context->Length_High >> 24) & 0xFF;\r\n    context->Message_Block[57] = (context->Length_High >> 16) & 0xFF;\r\n    context->Message_Block[58] = (context->Length_High >> 8) & 0xFF;\r\n    context->Message_Block[59] = (context->Length_High) & 0xFF;\r\n    context->Message_Block[60] = (context->Length_Low >> 24) & 0xFF;\r\n    context->Message_Block[61] = (context->Length_Low >> 16) & 0xFF;\r\n    context->Message_Block[62] = (context->Length_Low >> 8) & 0xFF;\r\n    context->Message_Block[63] = (context->Length_Low) & 0xFF;\r\n\r\n    SHA1ProcessMessageBlock(context);\r\n}\r\n"
  },
  {
    "path": "Engine/libs/sha1/hash_sha1.h",
    "content": "/*\r\n *  sha1.h\r\n *\r\n *  Copyright (C) 1998, 2009\r\n *  Paul E. Jones <paulej@packetizer.com>\r\n *  All Rights Reserved\r\n *\r\n *****************************************************************************\r\n *  $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $\r\n *****************************************************************************\r\n *\r\n *  Description:\r\n *      This class implements the Secure Hashing Standard as defined\r\n *      in FIPS PUB 180-1 published April 17, 1995.\r\n *\r\n *      Many of the variable names in the SHA1Context, especially the\r\n *      single character names, were used because those were the names\r\n *      used in the publication.\r\n *\r\n *      Please read the file sha1.c for more information.\r\n *\r\n */\r\n\r\n#pragma once\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif /* __cplusplus */\r\n\r\n/* \r\n *  This structure will hold context information for the hashing\r\n *  operation\r\n */\r\ntypedef struct SHA1Context\r\n{\r\n    unsigned Message_Digest[5]; /* Message Digest (output)          */\r\n\r\n    unsigned Length_Low;        /* Message length in bits           */\r\n    unsigned Length_High;       /* Message length in bits           */\r\n\r\n    unsigned char Message_Block[64]; /* 512-bit message blocks      */\r\n    int Message_Block_Index;    /* Index into message block array   */\r\n\r\n    int Computed;               /* Is the digest computed?          */\r\n    int Corrupted;              /* Is the message digest corruped?  */\r\n} SHA1Context;\r\n\r\n/*\r\n *  Function Prototypes\r\n */\r\nvoid SHA1Reset(SHA1Context *);\r\nint SHA1Result(SHA1Context *);\r\nvoid SHA1Input( SHA1Context *,\r\n                const unsigned char *,\r\n                unsigned);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif /* __cplusplus */\r\n"
  },
  {
    "path": "Engine/libs/utf8_converter/utf8.c",
    "content": "/*\r\n * Copyright (c) 2004, 2006, 2007, 2008 Kungliga Tekniska Högskolan\r\n * (Royal Institute of Technology, Stockholm, Sweden).\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the Institute nor the names of its contributors\r\n *    may be used to endorse or promote products derived from this software\r\n *    without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n */\r\n\r\n/*\r\n * original: http://www.opensource.apple.com/source/Heimdal/Heimdal-247.6/lib/wind/utf8.c\r\n * tweaks: removed dependency and re-defined errcodes\r\n */\r\n\r\n#include \"utf8.h\"\r\n\r\nint utf8toutf32(const unsigned char **pp, uint32_t *out)\r\n{\r\n\tconst unsigned char *p = *pp;\r\n\tunsigned c = *p;\r\n\r\n\tif (c & 0x80) {\r\n\t\tif ((c & 0xE0) == 0xC0) {\r\n\t\t\tconst unsigned c2 = *++p;\r\n\t\t\tif ((c2 & 0xC0) == 0x80) {\r\n\t\t\t\t*out =  ((c  & 0x1F) << 6)\r\n\t\t\t\t\t| (c2 & 0x3F);\r\n\t\t\t} else {\r\n\t\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t\t}\r\n\t\t} else if ((c & 0xF0) == 0xE0) {\r\n\t\t\tconst unsigned c2 = *++p;\r\n\t\t\tif ((c2 & 0xC0) == 0x80) {\r\n\t\t\t\tconst unsigned c3 = *++p;\r\n\t\t\t\tif ((c3 & 0xC0) == 0x80) {\r\n\t\t\t\t\t*out =   ((c  & 0x0F) << 12)\r\n\t\t\t\t\t\t| ((c2 & 0x3F) << 6)\r\n\t\t\t\t\t\t|  (c3 & 0x3F);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t\t}\r\n\t\t} else if ((c & 0xF8) == 0xF0) {\r\n\t\t\tconst unsigned c2 = *++p;\r\n\t\t\tif ((c2 & 0xC0) == 0x80) {\r\n\t\t\t\tconst unsigned c3 = *++p;\r\n\t\t\t\tif ((c3 & 0xC0) == 0x80) {\r\n\t\t\t\t\tconst unsigned c4 = *++p;\r\n\t\t\t\t\tif ((c4 & 0xC0) == 0x80) {\r\n\t\t\t\t\t\t*out =   ((c  & 0x07) << 18)\r\n\t\t\t\t\t\t\t| ((c2 & 0x3F) << 12)\r\n\t\t\t\t\t\t\t| ((c3 & 0x3F) <<  6)\r\n\t\t\t\t\t\t\t|  (c4 & 0x3F);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn WIND_ERR_INVALID_UTF8;\r\n\t\t}\r\n\t} else {\r\n\t\t*out = c;\r\n\t}\r\n\r\n\t*pp = p;\r\n\r\n\treturn 0;\r\n}\r\n\r\n/**\r\n * Convert an UTF-8 string to an UCS4 string.\r\n *\r\n * @param in an UTF-8 string to convert.\r\n * @param out the resulting UCS4 strint, must be at least\r\n * wind_utf8ucs4_length() long.  If out is NULL, the function will\r\n * calculate the needed space for the out variable (just like\r\n * wind_utf8ucs4_length()).\r\n * @param out_len before processing out_len should be the length of\r\n * the out variable, after processing it will be the length of the out\r\n * string.\r\n *\r\n * @return returns 0 on success, an wind error code otherwise\r\n * @ingroup wind\r\n */\r\n\r\nint wind_utf8ucs4(const char *in, unsigned *out, unsigned *out_len)\r\n{\r\n\tconst unsigned char *p;\r\n\tsize_t o = 0;\r\n\tint ret;\r\n\r\n\tfor (p = (const unsigned char *)in; *p != '\\0'; ++p) {\r\n\t\tuint32_t u;\r\n\r\n\t\tret = utf8toutf32(&p, &u);\r\n\t\tif (ret)\r\n\t\t\treturn ret;\r\n\r\n\t\tif (out) {\r\n\t\t\tif (o >= *out_len)\r\n\t\t\t\treturn WIND_ERR_OVERRUN;\r\n\t\t\tout[o] = u;\r\n\t\t}\r\n\t\to++;\r\n\t}\r\n\t*out_len = o;\r\n\treturn 0;\r\n}\r\n\r\n/**\r\n * Calculate the length of from converting a UTF-8 string to a UCS4\r\n * string.\r\n *\r\n * @param in an UTF-8 string to convert.\r\n * @param out_len the length of the resulting UCS4 string.\r\n *\r\n * @return returns 0 on success, an wind error code otherwise\r\n * @ingroup wind\r\n */\r\n\r\nint wind_utf8ucs4_length(const char *in, size_t *out_len)\r\n{\r\n\treturn wind_utf8ucs4(in, NULL, out_len);\r\n}\r\n\r\n/**\r\n * Convert an UTF-8 string to an UCS4 string.\r\n *\r\n * @param in an UTF-8 string to convert.\r\n * @param out the resulting UCS4 strint, must be free with free().\r\n * @param out_len will be the length of the out string.\r\n *\r\n * @return returns 0 on success, an wind error code otherwise\r\n * @ingroup wind\r\n */\r\n\r\nint wind_utf8ucs4_copy(const char *in, uint32_t **out, size_t *out_len)\r\n{\r\n\tint ret;\r\n\r\n\tret = wind_utf8ucs4_length(in, out_len);\r\n\tif (ret)\r\n\t\treturn ret;\r\n\tif (*out_len > UINT_MAX / sizeof((*out)[0]))\r\n\t\treturn ERANGE;\r\n\r\n\t*out = (uint32_t*)malloc(*out_len * sizeof(*out_len));\r\n\tif (*out == NULL) {\r\n\t\t*out_len = 0;\r\n\t\treturn ENOMEM;\r\n\t}\r\n\r\n\tret = wind_utf8ucs4(in, *out, out_len);\r\n\tif (ret) {\r\n\t\tfree(*out);\r\n\t\t*out = NULL;\r\n\t\t*out_len = 0;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/libs/utf8_converter/utf8.h",
    "content": "/*\r\n * original: http://www.opensource.apple.com/source/Heimdal/Heimdal-247.6/lib/wind/utf8.c\r\n * tweaks: removed dependency and re-defined errcodes\r\n */\r\n\r\n#pragma once\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif /* __cplusplus */\r\n\r\n#include <errno.h>\r\n#include <limits.h>\r\n#include <stddef.h>\r\n#include <stdlib.h>\r\n\r\n#define WIND_ERR_INVALID_UTF8 -969269754\r\n#define WIND_ERR_OVERRUN -969269758\r\n\r\n// uint32_t is already defined in standard Android headers\r\n#if !defined(__ANDROID__)\r\ntypedef unsigned int uint32_t;\r\n#endif\r\n\r\nint utf8toutf32(const unsigned char **pp, uint32_t *out);\r\nint wind_utf8ucs4(const char *in, unsigned *out, unsigned *out_len);\r\nint wind_utf8ucs4_length(const char *in, size_t *out_len);\r\nint wind_utf8ucs4_copy(const char *in, uint32_t **out, size_t *out_len);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif /* __cplusplus */\r\n"
  },
  {
    "path": "Engine/porting/Android/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    package=\"klb.android.GameEngine\"\r\n    android:versionCode=\"1\"\r\n    android:installLocation=\"auto\"\r\n    android:versionName=\"1.0\" >\r\n\r\n    <permission android:name=\"klb.android.GameEngine.permission.C2D_MESSAGE\"\r\n        android:protectionLevel=\"signature\" />\r\n    <uses-permission android:name=\"klb.android.GameEngine.permission.C2D_MESSAGE\" />\r\n    \r\n    <uses-permission android:name=\"com.google.android.c2dm.permission.RECEIVE\" />\r\n    <uses-permission android:name=\"android.permission.INTERNET\" />\r\n    <uses-permission android:name=\"com.android.vending.BILLING\" />\r\n    <uses-permission android:name=\"android.permission.WAKE_LOCK\" />\r\n\t<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>\r\n    \r\n    <uses-sdk android:minSdkVersion=\"9\" android:targetSdkVersion=\"17\" />\r\n\r\n    <application\r\n        android:icon=\"@drawable/ic_launcher\"\r\n        android:name=\".GameEngineApplication\"\r\n        android:label=\"@string/app_name\">\r\n        \r\n        <service android:name=\"klb.android.GameEngine.GCMIntentService\" />\r\n        <receiver \r\n            android:name=\"com.google.android.gcm.GCMBroadcastReceiver\"\r\n            android:permission=\"com.google.android.c2dm.permission.SEND\">\r\n            <intent-filter>\r\n                <action android:name=\"com.google.android.c2dm.intent.RECEIVE\" />\r\n                <action android:name=\"com.google.android.c2dm.intent.REGISTRATION\" />\r\n                <category android:name=\"klb.android.GameEngine\" />\r\n            </intent-filter>\r\n        </receiver>\r\n        <activity\r\n            android:label=\"@string/app_name\"\r\n            android:name=\"GameEngineActivity\"\r\n            android:screenOrientation=\"landscape\"\r\n\t\t\tandroid:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"\r\n            android:configChanges=\"screenSize|orientation|keyboardHidden\"\r\n\t\t\tandroid:launchMode=\"singleTop\" >\r\n            <intent-filter >\r\n                <action android:name=\"android.intent.action.MAIN\" />\r\n\r\n                <category android:name=\"android.intent.category.LAUNCHER\" />\r\n            </intent-filter>\r\n        </activity>\r\n        \r\n        <meta-data android:value=\"@string/sender_id\" android:name=\"GCM_SENDER_ID\" />\r\n    </application>\r\n\r\n</manifest>\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.classpath",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<classpath>\r\n\t<classpathentry kind=\"con\" path=\"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK\"/>\r\n\t<classpathentry kind=\"con\" path=\"com.android.ide.eclipse.adt.LIBRARIES\"/>\r\n\t<classpathentry kind=\"src\" path=\"src\"/>\r\n\t<classpathentry kind=\"src\" path=\"gen\"/>\r\n\t<classpathentry kind=\"output\" path=\"bin/classes\"/>\r\n</classpath>\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.cproject",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n<?fileVersion 4.0.0?>\r\n\r\n<cproject storage_type_id=\"org.eclipse.cdt.core.XmlProjectDescriptionStorage\">\r\n\t<storageModule moduleId=\"org.eclipse.cdt.core.settings\">\r\n\t\t<cconfiguration id=\"0.37582010\">\r\n\t\t\t<storageModule buildSystemId=\"org.eclipse.cdt.managedbuilder.core.configurationDataProvider\" id=\"0.37582010\" moduleId=\"org.eclipse.cdt.core.settings\" name=\"Default\">\r\n\t\t\t\t<externalSettings/>\r\n\t\t\t\t<extensions>\r\n\t\t\t\t\t<extension id=\"org.eclipse.cdt.core.VCErrorParser\" point=\"org.eclipse.cdt.core.ErrorParser\"/>\r\n\t\t\t\t\t<extension id=\"org.eclipse.cdt.core.GmakeErrorParser\" point=\"org.eclipse.cdt.core.ErrorParser\"/>\r\n\t\t\t\t\t<extension id=\"org.eclipse.cdt.core.CWDLocator\" point=\"org.eclipse.cdt.core.ErrorParser\"/>\r\n\t\t\t\t\t<extension id=\"org.eclipse.cdt.core.GCCErrorParser\" point=\"org.eclipse.cdt.core.ErrorParser\"/>\r\n\t\t\t\t\t<extension id=\"org.eclipse.cdt.core.GASErrorParser\" point=\"org.eclipse.cdt.core.ErrorParser\"/>\r\n\t\t\t\t\t<extension id=\"org.eclipse.cdt.core.GLDErrorParser\" point=\"org.eclipse.cdt.core.ErrorParser\"/>\r\n\t\t\t\t</extensions>\r\n\t\t\t</storageModule>\r\n\t\t\t<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\r\n\t\t\t\t<configuration artifactName=\"${ProjName}\" buildProperties=\"\" description=\"\" id=\"0.37582010\" name=\"Default\" parent=\"org.eclipse.cdt.build.core.prefbase.cfg\">\r\n\t\t\t\t\t<folderInfo id=\"0.37582010.\" name=\"/\" resourcePath=\"\">\r\n\t\t\t\t\t\t<toolChain id=\"org.eclipse.cdt.build.core.prefbase.toolchain.783883158\" name=\"No ToolChain\" resourceTypeBasedDiscovery=\"false\" superClass=\"org.eclipse.cdt.build.core.prefbase.toolchain\">\r\n\t\t\t\t\t\t\t<targetPlatform id=\"org.eclipse.cdt.build.core.prefbase.toolchain.783883158.569686895\" name=\"\"/>\r\n\t\t\t\t\t\t\t<builder command=\"/Applications/ADT-Bundle/android-ndk-r9/ndk-build\" id=\"org.eclipse.cdt.build.core.settings.default.builder.358281500\" incrementalBuildTarget=\"\" keepEnvironmentInBuildfile=\"false\" managedBuildOn=\"false\" name=\"Gnu Make Builder\" parallelBuildOn=\"true\" parallelizationNumber=\"-1\" superClass=\"org.eclipse.cdt.build.core.settings.default.builder\">\r\n\t\t\t\t\t\t\t\t<outputEntries>\r\n\t\t\t\t\t\t\t\t\t<entry flags=\"VALUE_WORKSPACE_PATH\" kind=\"outputPath\" name=\"libs\"/>\r\n\t\t\t\t\t\t\t\t\t<entry flags=\"VALUE_WORKSPACE_PATH\" kind=\"outputPath\" name=\"obj\"/>\r\n\t\t\t\t\t\t\t\t</outputEntries>\r\n\t\t\t\t\t\t\t</builder>\r\n\t\t\t\t\t\t\t<tool id=\"org.eclipse.cdt.build.core.settings.holder.libs.1619471859\" name=\"holder for library settings\" superClass=\"org.eclipse.cdt.build.core.settings.holder.libs\"/>\r\n\t\t\t\t\t\t\t<tool id=\"org.eclipse.cdt.build.core.settings.holder.115484600\" name=\"Assembly\" superClass=\"org.eclipse.cdt.build.core.settings.holder\">\r\n\t\t\t\t\t\t\t\t<inputType id=\"org.eclipse.cdt.build.core.settings.holder.inType.1767771847\" languageId=\"org.eclipse.cdt.core.assembly\" languageName=\"Assembly\" sourceContentType=\"org.eclipse.cdt.core.asmSource\" superClass=\"org.eclipse.cdt.build.core.settings.holder.inType\"/>\r\n\t\t\t\t\t\t\t</tool>\r\n\t\t\t\t\t\t\t<tool id=\"org.eclipse.cdt.build.core.settings.holder.1335184742\" name=\"GNU C++\" superClass=\"org.eclipse.cdt.build.core.settings.holder\">\r\n\t\t\t\t\t\t\t\t<inputType id=\"org.eclipse.cdt.build.core.settings.holder.inType.588010270\" languageId=\"org.eclipse.cdt.core.g++\" languageName=\"GNU C++\" sourceContentType=\"org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader\" superClass=\"org.eclipse.cdt.build.core.settings.holder.inType\"/>\r\n\t\t\t\t\t\t\t</tool>\r\n\t\t\t\t\t\t\t<tool id=\"org.eclipse.cdt.build.core.settings.holder.609757791\" name=\"GNU C\" superClass=\"org.eclipse.cdt.build.core.settings.holder\">\r\n\t\t\t\t\t\t\t\t<inputType id=\"org.eclipse.cdt.build.core.settings.holder.inType.1406340904\" languageId=\"org.eclipse.cdt.core.gcc\" languageName=\"GNU C\" sourceContentType=\"org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader\" superClass=\"org.eclipse.cdt.build.core.settings.holder.inType\"/>\r\n\t\t\t\t\t\t\t</tool>\r\n\t\t\t\t\t\t</toolChain>\r\n\t\t\t\t\t</folderInfo>\r\n\t\t\t\t\t<sourceEntries>\r\n\t\t\t\t\t\t<entry flags=\"VALUE_WORKSPACE_PATH\" kind=\"sourcePath\" name=\"jni\"/>\r\n\t\t\t\t\t</sourceEntries>\r\n\t\t\t\t</configuration>\r\n\t\t\t</storageModule>\r\n\t\t\t<storageModule moduleId=\"org.eclipse.cdt.core.externalSettings\"/>\r\n\t\t\t<storageModule moduleId=\"org.eclipse.cdt.core.language.mapping\"/>\r\n\t\t\t<storageModule moduleId=\"org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings\"/>\r\n\t\t</cconfiguration>\r\n\t</storageModule>\r\n\t<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\r\n\t\t<project id=\"GameEngine.null.1887324441\" name=\"GameEngine\"/>\r\n\t</storageModule>\r\n\t<storageModule moduleId=\"refreshScope\" versionNumber=\"1\">\r\n\t\t<resource resourceType=\"PROJECT\" workspacePath=\"/GameEngine\"/>\r\n\t</storageModule>\r\n\t<storageModule moduleId=\"scannerConfiguration\">\r\n\t\t<autodiscovery enabled=\"true\" problemReportingEnabled=\"true\" selectedProfileId=\"\"/>\r\n\t\t<profile id=\"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile\">\r\n\t\t\t<buildOutputProvider>\r\n\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</buildOutputProvider>\r\n\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/${specs_file}\" command=\"gcc\" useDefault=\"true\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</scannerInfoProvider>\r\n\t\t</profile>\r\n\t\t<profile id=\"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile\">\r\n\t\t\t<buildOutputProvider>\r\n\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</buildOutputProvider>\r\n\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/${specs_file}\" command=\"gcc\" useDefault=\"true\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</scannerInfoProvider>\r\n\t\t</profile>\r\n\t\t<profile id=\"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP\">\r\n\t\t\t<buildOutputProvider>\r\n\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</buildOutputProvider>\r\n\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/specs.cpp\" command=\"g++\" useDefault=\"true\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</scannerInfoProvider>\r\n\t\t</profile>\r\n\t\t<profile id=\"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC\">\r\n\t\t\t<buildOutputProvider>\r\n\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</buildOutputProvider>\r\n\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/specs.c\" command=\"gcc\" useDefault=\"true\"/>\r\n\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t</scannerInfoProvider>\r\n\t\t</profile>\r\n\t\t<scannerConfigBuildInfo instanceId=\"0.37582010\">\r\n\t\t\t<autodiscovery enabled=\"true\" problemReportingEnabled=\"true\" selectedProfileId=\"\"/>\r\n\t\t\t<profile id=\"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile\">\r\n\t\t\t\t<buildOutputProvider>\r\n\t\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</buildOutputProvider>\r\n\t\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/${specs_file}\" command=\"gcc\" useDefault=\"true\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</scannerInfoProvider>\r\n\t\t\t</profile>\r\n\t\t\t<profile id=\"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile\">\r\n\t\t\t\t<buildOutputProvider>\r\n\t\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</buildOutputProvider>\r\n\t\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/${specs_file}\" command=\"gcc\" useDefault=\"true\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</scannerInfoProvider>\r\n\t\t\t</profile>\r\n\t\t\t<profile id=\"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP\">\r\n\t\t\t\t<buildOutputProvider>\r\n\t\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</buildOutputProvider>\r\n\t\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/specs.cpp\" command=\"g++\" useDefault=\"true\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</scannerInfoProvider>\r\n\t\t\t</profile>\r\n\t\t\t<profile id=\"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC\">\r\n\t\t\t\t<buildOutputProvider>\r\n\t\t\t\t\t<openAction enabled=\"true\" filePath=\"\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</buildOutputProvider>\r\n\t\t\t\t<scannerInfoProvider id=\"specsFile\">\r\n\t\t\t\t\t<runAction arguments=\"-E -P -v -dD ${plugin_state_location}/specs.c\" command=\"gcc\" useDefault=\"true\"/>\r\n\t\t\t\t\t<parser enabled=\"true\"/>\r\n\t\t\t\t</scannerInfoProvider>\r\n\t\t\t</profile>\r\n\t\t</scannerConfigBuildInfo>\r\n\t</storageModule>\r\n</cproject>\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.gitattributes",
    "content": "gradlew.bat eol=crlf\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.project",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<projectDescription>\r\n\t<name>GameEngine</name>\r\n\t<comment></comment>\r\n\t<projects>\r\n\t</projects>\r\n\t<buildSpec>\r\n\t\t<buildCommand>\r\n\t\t\t<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>\r\n\t\t\t<triggers>clean,full,incremental,</triggers>\r\n\t\t\t<arguments>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>?children?</key>\r\n\t\t\t\t\t<value>?name?=outputEntries\\|?children?=?name?=entry\\\\\\\\\\\\\\|\\\\\\|?name?=entry\\\\\\\\\\\\\\|\\\\\\|\\||</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>?name?</key>\r\n\t\t\t\t\t<value></value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.append_environment</key>\r\n\t\t\t\t\t<value>true</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.autoBuildTarget</key>\r\n\t\t\t\t\t<value>all</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.buildArguments</key>\r\n\t\t\t\t\t<value>-j</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.buildCommand</key>\r\n\t\t\t\t\t<value>/Applications/ADT-Bundle/android-ndk-r9/ndk-build</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>\r\n\t\t\t\t\t<value>clean</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.contents</key>\r\n\t\t\t\t\t<value>org.eclipse.cdt.make.core.activeConfigSettings</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.enableAutoBuild</key>\r\n\t\t\t\t\t<value>false</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.enableCleanBuild</key>\r\n\t\t\t\t\t<value>true</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.enableFullBuild</key>\r\n\t\t\t\t\t<value>true</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.fullBuildTarget</key>\r\n\t\t\t\t\t<value></value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.stopOnError</key>\r\n\t\t\t\t\t<value>true</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t\t<dictionary>\r\n\t\t\t\t\t<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>\r\n\t\t\t\t\t<value>false</value>\r\n\t\t\t\t</dictionary>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>org.eclipse.jdt.core.javabuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>com.android.ide.eclipse.adt.ApkBuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>\r\n\t\t\t<triggers>full,incremental,</triggers>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t</buildSpec>\r\n\t<natures>\r\n\t\t<nature>com.android.ide.eclipse.adt.AndroidNature</nature>\r\n\t\t<nature>org.eclipse.jdt.core.javanature</nature>\r\n\t\t<nature>org.eclipse.cdt.core.cnature</nature>\r\n\t\t<nature>org.eclipse.cdt.core.ccnature</nature>\r\n\t\t<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>\r\n\t\t<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>\r\n\t</natures>\r\n</projectDescription>\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.settings/org.eclipse.cdt.core.prefs",
    "content": "eclipse.preferences.version=1\r\nenvironment/project/0.37582010/ANDROID_NDK_ROOT/delimiter=\\:\r\nenvironment/project/0.37582010/ANDROID_NDK_ROOT/operation=append\r\nenvironment/project/0.37582010/ANDROID_NDK_ROOT/value=/Applications/ADT-Bundle/android-ndk-r8d\r\nenvironment/project/0.37582010/append=true\r\nenvironment/project/0.37582010/appendContributed=true\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.settings/org.eclipse.core.resources.prefs",
    "content": "#Fri Jul 20 15:23:40 JST 2012\r\neclipse.preferences.version=1\r\nencoding/<project>=UTF-8\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/.settings/org.eclipse.jdt.core.prefs",
    "content": "eclipse.preferences.version=1\r\norg.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r\norg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r\norg.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r\norg.eclipse.jdt.core.compiler.compliance=1.6\r\norg.eclipse.jdt.core.compiler.debug.lineNumber=generate\r\norg.eclipse.jdt.core.compiler.debug.localVariable=generate\r\norg.eclipse.jdt.core.compiler.debug.sourceFile=generate\r\norg.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r\norg.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r\norg.eclipse.jdt.core.compiler.source=1.6\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    package=\"klb.android.GameEngine\"\r\n    android:versionCode=\"1\"\r\n    android:installLocation=\"auto\"\r\n    android:versionName=\"1.0\" >\r\n\r\n    <permission android:name=\"klb.android.GameEngine.permission.C2D_MESSAGE\"\r\n        android:protectionLevel=\"signature\" />\r\n    <uses-permission android:name=\"klb.android.GameEngine.permission.C2D_MESSAGE\" />\r\n    \r\n    <uses-permission android:name=\"com.google.android.c2dm.permission.RECEIVE\" />\r\n    <uses-permission android:name=\"android.permission.INTERNET\" />\r\n    <uses-permission android:name=\"com.android.vending.BILLING\" />\r\n    <uses-permission android:name=\"android.permission.WAKE_LOCK\" />\r\n\t<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>\r\n    \r\n    <uses-sdk android:minSdkVersion=\"9\" android:targetSdkVersion=\"17\" />\r\n\r\n    <application\r\n        android:icon=\"@drawable/ic_launcher\"\r\n        android:name=\".GameEngineApplication\"\r\n        android:label=\"@string/app_name\">\r\n        \r\n        <service android:name=\"klb.android.GameEngine.GCMIntentService\" />\r\n        <receiver \r\n            android:name=\"com.google.android.gcm.GCMBroadcastReceiver\"\r\n            android:permission=\"com.google.android.c2dm.permission.SEND\">\r\n            <intent-filter>\r\n                <action android:name=\"com.google.android.c2dm.intent.RECEIVE\" />\r\n                <action android:name=\"com.google.android.c2dm.intent.REGISTRATION\" />\r\n                <category android:name=\"klb.android.GameEngine\" />\r\n            </intent-filter>\r\n        </receiver>\r\n        <activity\r\n            android:label=\"@string/app_name\"\r\n            android:name=\"GameEngineActivity\"\r\n            android:screenOrientation=\"landscape\"\r\n\t\t\tandroid:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"\r\n            android:configChanges=\"screenSize|orientation|keyboardHidden\"\r\n\t\t\tandroid:launchMode=\"singleTop\" >\r\n            <intent-filter >\r\n                <action android:name=\"android.intent.action.MAIN\" />\r\n\r\n                <category android:name=\"android.intent.category.LAUNCHER\" />\r\n            </intent-filter>\r\n        </activity>\r\n        \r\n        <meta-data android:value=\"@string/sender_id\" android:name=\"GCM_SENDER_ID\" />\r\n    </application>\r\n\r\n</manifest>\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/build.gradle",
    "content": "buildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:0.6.+'\n    }\n}\napply plugin: 'android'\n\ndependencies {\n    compile fileTree(dir: 'libs', include: '*.jar')\n}\n\nandroid {\n    compileSdkVersion 17\n    buildToolsVersion \"18.1.0\"\n\n    sourceSets {\n        main {\n            manifest.srcFile 'AndroidManifest.xml'\n            java.srcDirs = ['src']\n            resources.srcDirs = ['src']\n            aidl.srcDirs = ['src']\n            renderscript.srcDirs = ['src']\n            res.srcDirs = ['res']\n            assets.srcDirs = ['assets']\n        }\n\n        // Move the tests to tests/java, tests/res, etc...\n        instrumentTest.setRoot('tests')\n\n        // Move the build types to build-types/<type>\n        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...\n        // This moves them out of them default location under src/<type>/... which would\n        // conflict with src/ being used by the main source set.\n        // Adding new build types or product flavors should be accompanied\n        // by a similar customization.\n        debug.setRoot('build-types/debug')\n        release.setRoot('build-types/release')\n    }\n\n    buildTypes {\n        release {\n            if (file(\"proguard-project.txt\").exists()) {\n                runProguard true\n                proguardFile getDefaultProguardFile('proguard-android.txt')\n                proguardFile file('proguard-project.txt')\n            }\n\n            if (project.hasProperty('storeFile')) {\n                signingConfig signingConfigs.release\n            }\n        }\n    }\n\n    task ndkBuild(type:Exec) {\n        commandLine 'ndk-build', '-j'\n    }\n\n    task ndkClean(type:Exec) {\n        commandLine 'ndk-build', 'clean'\n    }\n\n    task libsClean(type:Exec) {\n        commandLine 'rm', '-rf', 'libs/armeabi', 'libs/armeabi-v7a', 'libs/x86', 'libs/mips'\n    }\n\n    if(new File(projectDir, \"jni\").exists()){\n        tasks.withType(Compile) {\n            compileTask -> compileTask.dependsOn ndkBuild\n        }\n\n        tasks.withType(com.android.build.gradle.tasks.PackageApplication) {\n            pkgTask -> pkgTask.jniDir new File(projectDir, 'libs')\n        }\n\n        clean.dependsOn 'ndkClean'\n        clean.dependsOn 'libsClean'\n    }\n}\n\nif (project.hasProperty('storeFile')) {\n    android.signingConfigs.release.storeFile = file(storeFile)\n}\nif (project.hasProperty('storePassword')) {\n    android.signingConfigs.release.storePassword = storePassword\n}\nif (project.hasProperty('keyAlias')) {\n    android.signingConfigs.release.keyAlias = keyAlias\n}\nif (project.hasProperty('keyPassword')) {\n    android.signingConfigs.release.keyPassword = keyPassword\n}\n\ntask wrapper(type: Wrapper) {\n    gradleVersion = '1.8'\n}\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/build.py",
    "content": "#!/usr/bin/env python\n\nfrom __future__ import print_function\nfrom decimal import *\nfrom os import makedirs, path, remove, chdir\nfrom shutil import copy2, copytree, rmtree\nimport argparse\nimport subprocess\nimport sys\n\nclass PlaygroundBuilder:\n    _rootdir = None\n\n    def __init__(self):\n        self._rootdir = path.dirname(path.realpath(__file__))\n\n    def getAbsPath(self, relpath):\n        return path.normpath(path.join(self._rootdir, relpath))\n\n    def decor_print(self, header, content, color):\n        print('%s%s%s: %s' % (color, header, bcolors.ENDC, content))\n\n    def print_error(self, content):\n        self.decor_print('ERROR', content, bcolors.WARNING)\n\n    def makedirs(self, target_dir):\n        target_abs_dir = self.getAbsPath(target_dir)\n        if not path.isdir(target_abs_dir):\n            makedirs(target_abs_dir)\n\n    def rmfile(self, target_file):\n        target_abs_file = self.getAbsPath(target_file)\n        if path.isfile(target_abs_file):\n            self.decor_print('removing file', target_file, bcolors.WARNING)\n            remove(target_abs_file)\n\n    def rmtree(self, target_dir):\n        target_abs_dir = self.getAbsPath(target_dir)\n        if path.isdir(target_abs_dir):\n            self.decor_print('removing dir', target_dir, bcolors.WARNING)\n            rmtree(target_abs_dir)\n\n    def copytree(self, path_from, path_to):\n        return self._copyentity(path_from, path_to, False)\n\n    def copyfile(self, path_from, path_to):\n        return self._copyentity(path_from, path_to, True)\n\n    def _copyentity(self, path_from, path_to, is_file):\n        from_path = self.getAbsPath(path_from)\n        (from_base_path, from_leaf_path) = path.split(from_path)\n        params = (from_path, self.getAbsPath(path_to+'/'+from_leaf_path))\n        if is_file:\n            self.decor_print('copying file', '%s -> %s' % (path_from, path_to), bcolors.OKBLUE)\n            if path.exists(params[1]) and path.samefile(*params):\n                print(bcolors.NOTICE+'skipped (same file)'+bcolors.ENDC)\n            else:\n                copy2(*params)\n        else:\n            self.decor_print('copying dir', '%s -> %s' % (path_from, path_to), bcolors.OKBLUE)\n            if not path.exists(params[0]):\n                print(bcolors.NOTICE+'skipped (origin dir not found)'+bcolors.ENDC)\n            elif path.exists(params[1]) and path.samefile(*params):\n                print(bcolors.NOTICE+'skipped (same dir)'+bcolors.ENDC)\n            else:\n                copytree(*params) \n\n    # we'll return None unless any status markers are found\n    # note: return status is updated in every apperance of markers\n    def _output_log(self, p, success_marker=None, fail_marker=None):\n        is_succeeded = None\n        for l in iter(p.stdout.readline, b''):\n            log_line = l.rstrip().decode('utf-8')\n            if success_marker is not None and  log_line.find(success_marker) != -1:\n                is_succeeded = True\n            if fail_marker is not None and log_line.find(fail_marker) != -1:\n                is_succeeded = False\n            print('%s>>%s %s' % (bcolors.OKGREEN, bcolors.ENDC, log_line))\n        return is_succeeded\n\n    def _is_apk_sane(self, target_path):\n        if not path.exists(target_path):\n            return False\n        apk_path = path.realpath(target_path)\n        is_apk_sane = self._output_log(\n            subprocess.Popen('aapt dump badging %s' % apk_path, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT),\n            success_marker='package:', fail_marker='ERROR:')\n        return is_apk_sane is True\n\n    def build(self, project, use_luajit=False, gles_ver=Decimal('1.1'), perform_rebuild=False, is_release=False, perform_assemble=False):\n        chdir(path.dirname(sys.argv[0]) or '.')\n\n        if perform_rebuild:\n            self.rmtree('./jni')\n            self.rmtree('./src')\n\n\n        self.makedirs('./jni')\n        self.copytree('../jni/Android', './jni/')\n        self.copyfile('../jni/Android.mk', './jni/')\n        self.copyfile('../jni/Application.mk', './jni/')\n        self.copytree('../jni/proxy', './jni/')\n        self.copytree('../src', '.')\n        self.copytree('../../../custom', './jni/')\n        self.copytree('../../../include', './jni/')\n        self.copytree('../../../libs', './jni/')\n        self.copytree('../../../source', './jni/')\n        self.copytree('../../../../%s/world' % project, './jni/UserTask/')\n        self.copytree('../../../../%s/game' % project, './jni/UserTask/')\n\n        # layouts\n        self.copyfile('../GameEngine-android/res/layout/indicator.xml', './res/layout/')\n        self.copyfile('../GameEngine-android/res/layout/install.xml', './res/layout/')\n\n        # create location to put prebuilt *.a files in\n        self.makedirs('./obj/local/armeabi')\n        self.makedirs('./obj/local/x86')\n\n        # FreeType2\n        self.copyfile('../../../porting/FontRendering.cpp', './jni/Android/')\n        self.copyfile('../../../porting/FontRendering.h', './jni/Android/')\n        self.copyfile('./jni/libs/libfreetype2/obj/local/armeabi/libfreetype2.a', './obj/local/armeabi/')\n        self.copyfile('./jni/libs/libfreetype2/obj/local/x86/libfreetype2.a', './obj/local/x86/')\n\n        # libcurl\n        self.rmtree('./jni/libs/curl-7.29.0')\n        self.rmtree('./jni/libs/curl-7.29.0-minimal')\n        self.makedirs('./jni/libs/curl-7.29.0/include')\n        self.copytree('../jni/curl-7.29.0/include', './jni/libs/curl-7.29.0/include/')\n        self.copyfile('../jni/curl-7.29.0/armeabi/libcurl.a', './obj/local/armeabi')\n        self.copyfile('../jni/curl-7.29.0/x86/libcurl.a', './obj/local/x86')\n\n        # file delete API\n        self.copyfile('../../../porting/FileDelete.cpp', './jni/Android/')\n        self.copyfile('../../../porting/FileDelete.h', './jni/Android/')\n\n        # remove unused files (their presence could make build break)\n        self.rmfile('./jni/source/Core/CKLBStream.cpp')\n        self.rmfile('./jni/source/Rendering/FontSystem.cpp')\n        self.rmfile('./jni/source/Scripting/CKLBScriptEnv_forCSharp.cpp')\n        self.rmfile('./jni/source/Scripting/ExportListC_Likefunction.cpp')\n        self.rmfile('./jni/source/UnitSystem/UnitCompiler/serverCompiler.cpp')\n        self.rmfile('./jni/source/UnitSystem/CKLBUnitDefinitionServer.cpp')\n        self.rmfile('./jni/source/Core/OSSencryptFile.cpp')\n        self.rmfile('./jni/source/HTTP/CKLBNetAPIBasic.cpp')\n        self.rmfile('./jni/UserTask/game/framework.cpp')\n        self.rmfile('./jni/UserTask/game/framework.h')\n        self.rmfile('./jni/UserTask/game/out.cpp')\n        self.rmtree('./jni/libs/RuntimeCSharp')\n        self.rmtree('./jni/libs/freeType/')\n        self.rmtree('./jni/libs/libfreetype2/src/')\n        self.rmtree('./jni/libs/libfreetype2/jni/')\n\n        cmdline = ['ndk-build']\n        cmdline.append('-j')\n        if use_luajit:\n            self.rmtree('./jni/libs/lua')\n            self.makedirs('./jni/libs/luajit-2.0.1')\n            self.copytree('../jni/luajit-2.0.1/include', './jni/libs/luajit-2.0.1/')\n            self.copyfile('../jni/luajit-2.0.1/libluajit-5.1.a', './obj/local/armeabi')\n            cmdline.append('USE_LUAJIT=1')\n\n        if gles_ver is not Decimal('1.1'):\n            if Decimal('2.0') <= gles_ver:\n                cmdline.append('USE_GLES2=1')\n            if Decimal('3.0') <= gles_ver:\n                cmdline.append('USE_GLES3=1')\n\n        if is_release:\n            cmdline.append('NDK_DEBUG=0')\n            print(\"performing release build\")\n        cmdline_s = ' '.join(cmdline)\n\n        # if performing assemble, we should perform clean prior to main build to make sure latest binary is assembled.\n        if perform_assemble:\n            self._output_log(subprocess.Popen('./gradlew clean', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))\n\n        print('performing: %s' % (cmdline_s))\n        self._output_log(subprocess.Popen(cmdline_s, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))\n\n        if perform_assemble:\n            build_result = self._output_log(\n                subprocess.Popen('./gradlew build', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT),\n                success_marker='BUILD SUCCESSFUL', fail_marker='BUILD FAILED')\n            if build_result is not True:\n                self.print_error('Gradle build failed.')\n                return 1\n            if self._is_apk_sane('./build/apk/GameEngine-android-debug-unaligned.apk') is not True:\n                self.print_error('Generated APK file is corrupt.')\n                return 1\n\n        return 0\n\n# http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python\nclass bcolors:\n    HEADER = '\\033[95m'\n    OKBLUE = '\\033[94m'\n    OKGREEN = '\\033[92m'\n    WARNING = '\\033[91m'\n    NOTICE = '\\033[37m'\n    ENDC = '\\033[0m'\n\n    def disable(self):\n        self.HEADER = ''\n        self.OKBLUE = ''\n        self.OKGREEN = ''\n        self.WARNING = ''\n        self.FAIL = ''\n        self.ENDC = ''\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser(description='Playground for Android Native Binaries Builder')\n    parser.add_argument('-p', '--project', help='specify project name', required=True)\n    parser.add_argument('-l', '--luavm', help='choose Lua runtime', choices=['lua', 'luajit'], default='lua')\n    parser.add_argument('-g', '--gles', help='choose target OpenGL ES version', choices=['1.1', '2.0', '3.0'], default='1.1')\n    parser.add_argument('-m', '--mode', help='choose build binary mode', choices=['debug', 'release'], default='debug')\n    parser.add_argument('-r', '--rebuild', help='perform whole rebuild', action='store_true')\n    parser.add_argument('-a', '--assemble', help='assemble APK with gradle', action='store_true')\n\n    args = parser.parse_args()\n    builder = PlaygroundBuilder()\n    sys.exit(builder.build(\n            project=args.project,\n            use_luajit=(True if args.luavm == 'luajit' else False),\n            gles_ver=Decimal(args.gles),\n            perform_rebuild=args.rebuild,\n            is_release=(True if args.mode == 'release' else False),\n            perform_assemble=args.assemble))\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Oct 02 01:30:45 JST 2013\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=http\\://services.gradle.org/distributions/gradle-1.8-bin.zip\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/gradle.properties.forReleaseSigning",
    "content": "storeFile=キーストアファイルのパス\nstorePassword=<キーストアのパスワード>\nkeyAlias=<署名用の秘密鍵のエイリアス名>\nkeyPassword=<秘密鍵のパスワード>\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"-Dfile.encoding=UTF-8\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# For Cygwin, ensure paths are in UNIX format before anything is touched.\nif $cygwin ; then\n    [ -n \"$JAVA_HOME\" ] && JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\nfi\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >&-\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >&-\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:init\r\n@rem Get command-line arguments, handling Windowz variants\r\n\r\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\r\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\r\n\r\n:win9xME_args\r\n@rem Slurp the command line arguments.\r\nset CMD_LINE_ARGS=\r\nset _SKIP=2\r\n\r\n:win9xME_args_slurp\r\nif \"x%~1\" == \"x\" goto execute\r\n\r\nset CMD_LINE_ARGS=%*\r\ngoto execute\r\n\r\n:4NT_args\r\n@rem Get arguments from the 4NT Shell from JP Software\r\nset CMD_LINE_ARGS=%$\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/lint.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<lint>\r\n</lint>"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/proguard.cfg",
    "content": "-optimizationpasses 5\r\n-dontusemixedcaseclassnames\r\n-dontskipnonpubliclibraryclasses\r\n-dontpreverify\r\n-verbose\r\n-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*\r\n\r\n-keep public class * extends android.app.Activity\r\n-keep public class * extends android.app.Application\r\n-keep public class * extends android.app.Service\r\n-keep public class * extends android.content.BroadcastReceiver\r\n-keep public class * extends android.content.ContentProvider\r\n-keep public class * extends android.app.backup.BackupAgentHelper\r\n-keep public class * extends android.preference.Preference\r\n-keep public class com.android.vending.licensing.ILicensingService\r\n\r\n-keepclasseswithmembernames class * {\r\n    native <methods>;\r\n}\r\n\r\n-keepclasseswithmembers class * {\r\n    public <init>(android.content.Context, android.util.AttributeSet);\r\n}\r\n\r\n-keepclasseswithmembers class * {\r\n    public <init>(android.content.Context, android.util.AttributeSet, int);\r\n}\r\n\r\n-keepclassmembers class * extends android.app.Activity {\r\n   public void *(android.view.View);\r\n}\r\n\r\n-keepclassmembers enum * {\r\n    public static **[] values();\r\n    public static ** valueOf(java.lang.String);\r\n}\r\n\r\n-keep class * implements android.os.Parcelable {\r\n  public static final android.os.Parcelable$Creator *;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/project.properties",
    "content": "target=android-17\r\n"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/res/layout/indicator.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:layout_gravity=\"center\" >\r\n\r\n    <ProgressBar\r\n        android:id=\"@+id/progressBar1\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\" />\r\n\r\n</FrameLayout>"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/res/layout/install.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\" >\r\n\r\n    <ProgressBar\r\n        android:id=\"@+id/progressBar1\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_gravity=\"center\"\r\n        android:indeterminate=\"true\" />\r\n\r\n</FrameLayout>"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/res/layout/main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:orientation=\"vertical\" >\r\n\r\n    <TextView\r\n        android:layout_width=\"fill_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string/hello\" />\r\n\r\n</LinearLayout>"
  },
  {
    "path": "Engine/porting/Android/GameEngine-android/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<resources>\r\n\r\n    <string name=\"hello\">Hello World!</string>\r\n    <string name=\"app_name\">GameEngine</string>\r\n    \r\n    <string name=\"sender_id\">694365359580</string>\r\n\r\n</resources>"
  },
  {
    "path": "Engine/porting/Android/jni/Android/AndroidFileLocation.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n * AndroidFileLocation.h\r\n *\r\n */\r\n\r\n#ifndef AndroidFileLocation_h\r\n#define AndroidFileLocation_h\r\n\r\n#define PATH_EXTERN     \"/files/\"\r\n#define PATH_INSTALL    \"\"\r\n\r\n#endif // AndroidFileLocation_h\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidFont.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CAndroidFont.h\"\r\n#include \"CPFInterface.h\"\r\n\r\nCAndroidFont::CAndroidFont(int size, const char * fontName)\r\n{\r\n//\tfontName = NULL;\t// ハングするので一旦 //\r\n\t// フォント管理クラスを取得(static class)\r\n\tjclass cls_fntManage = CJNI::getJNIEnv()->FindClass(JNI_FONTMANAGER_LOAD_PATH);\r\n\r\n\t// Paint作成函数ID取得\r\n\tjmethodID mtd_createPaint = getEnv()->GetStaticMethodID(cls_fntManage, \"CreatePaint\", \"(Ljava/lang/String;)Landroid/graphics/Paint;\");\r\n\r\n\t// エイリアスからフォント名を取得\r\n\tconst char* fntName = NULL;\r\n\tfor( int i=0; fontName && ms_fontlist[i].alias; i++ )\r\n\t{\r\n\t\tif( !strcmp(ms_fontlist[i].alias, fontName) )\r\n\t\t{\r\n\t\t\tfntName = ms_fontlist[i].fontname;\r\n\t\t}\r\n\t}\r\n\r\n\tjstring strj = NULL;\r\n\tif( fntName ) {\r\n\t\tstrj = getEnv()->NewStringUTF(fntName);\r\n\t}\r\n\r\n\t// 指定フォント名でPaintを作成\r\n\tjobject local_font = CJNI::getJNIEnv()->CallStaticObjectMethod( cls_fntManage, mtd_createPaint, strj );\r\n\r\n\t// グローバル的な変数として設定\r\n\tm_paint = getEnv()->NewGlobalRef(local_font);\r\n\r\n\tm_getfontmetrics = getEnv()->GetStaticMethodID(cls_fntManage, \"getFontMetrics\", \"(Landroid/graphics/Paint;)Landroid/graphics/Paint$FontMetrics;\");\r\n\tm_settextsize\t = getEnv()->GetStaticMethodID(cls_fntManage, \"setTextSize\", \"(Landroid/graphics/Paint;F)V\");\r\n\tm_setantialias\t = getEnv()->GetStaticMethodID(cls_fntManage, \"setAntiAlias\", \"(Landroid/graphics/Paint;Z)V\");\r\n\tm_measuretext \t = getEnv()->GetStaticMethodID(cls_fntManage, \"measureText\", \"(Landroid/graphics/Paint;Ljava/lang/String;)F\");\r\n\t/*\r\n\t{\r\n\t\tchar buf[256];\r\n\t\tsprintf(buf, \"m_getfontmetrics = %d, m_settextsize = %d, m_setantialias = %d\", m_getfontmetrics, m_settextsize, m_setantialias);\r\n\t\t__android_log_write(ANDROID_LOG_DEBUG, \"Cpp\", buf);\r\n\t}\r\n\t */\r\n\r\n\t// アンチエイリアス設定(PFInterface.javaのdrawTextでの描画時と、ただ文章幅を取得したい場合の幅値が異なるため)  2013/04/11  \r\n\tsetAntiAlias(true);\r\n\t// テキストサイズを設定\r\n\tsetTextSize(size);\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_fntManage);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(strj);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(local_font);\r\n}\r\n\r\nCAndroidFont::~CAndroidFont()\r\n{\r\n\t// グローバル参照を解消\r\n\tgetEnv()->DeleteGlobalRef(m_paint);\r\n}\r\n\r\n// フォントサイズが変更されるたび、フォントパラメータを変更する\r\nvoid\r\nCAndroidFont::setTextSize(float size)\r\n{\r\n\tjclass cls_fntManage = CJNI::getJNIEnv()->FindClass(JNI_FONTMANAGER_LOAD_PATH);\r\n\tCJNI::getJNIEnv()->CallStaticVoidMethod( cls_fntManage, m_settextsize, (jobject)m_paint, (jfloat)size );\r\n\r\n\t// FontMetricsを取得\r\n\tjobject local_obj = getEnv()->CallStaticObjectMethod( cls_fntManage, m_getfontmetrics, (jobject)m_paint );\r\n\r\n\t// FontMetricsから詳細情報取得\r\n\tjclass clfontmetrics = getEnv()->FindClass(\"android/graphics/Paint$FontMetrics\");\r\n\tm_ascent \t= getEnv()->GetFieldID(clfontmetrics, \"ascent\", \"F\");\r\n\tm_descent\t= getEnv()->GetFieldID(clfontmetrics, \"descent\", \"F\");\r\n\tm_top \t\t= getEnv()->GetFieldID(clfontmetrics, \"top\", \"F\");\r\n\tm_bottom\t= getEnv()->GetFieldID(clfontmetrics, \"bottom\", \"F\");\r\n\r\n\t// フィールドIDからフォント各値を得る\r\n\tm_f_ascent\t= -(float)getEnv()->GetFloatField(local_obj, m_ascent);\r\n\tm_f_descent\t= -(float)getEnv()->GetFloatField(local_obj, m_descent);\r\n\tm_f_top\t\t= -(float)getEnv()->GetFloatField(local_obj, m_top);\r\n\tm_f_bottom\t= -(float)getEnv()->GetFloatField(local_obj, m_bottom);\r\n\r\n\tDEBUG_PRINT(\"ascent:%f descent:%f top:%f bottom:%f\", m_f_ascent, m_f_descent, m_f_top, m_f_bottom);\r\n    \r\n#if defined __LOVELIVE\r\n\t// Loveliveだけは既にあるヒント画面などの見た目維持のため小細工します  2013/05/07  \r\n\t// Lovelive Font Hack  2013/05/07  \r\n\tconst float HEIGHT_CHANGE_HINT_SIZE = 32;\r\n\tconst float HEIGHT_CHANGE_FRIEND_SIZE = 24;\r\n\tif(size == HEIGHT_CHANGE_HINT_SIZE)\r\n\t{\r\n\t\t// iOSと同じ値にしています\r\n\t\tm_f_ascent = 24.5391f;\r\n\t\tm_f_descent = -6.13333f;\r\n\t\tm_f_top = 24.9816f;\r\n\t\tm_f_bottom = -7.0184f;\r\n        //\tDEBUG_PRINT(\"LL Change  ascent:%f descent:%f top:%f bottom:%f\", m_f_ascent, m_f_descent, m_f_top, m_f_bottom);\r\n\t}\r\n\telse if(size == HEIGHT_CHANGE_FRIEND_SIZE)\r\n\t{\r\n\t\tm_f_ascent = 18.4062f;\r\n\t\tm_f_descent = -4.6f;\r\n\t\tm_f_top = 18.7375f;\r\n\t\tm_f_bottom = -5.2625f;\r\n\t}\r\n#endif\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_fntManage);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(local_obj);\r\n    CJNI::getJNIEnv()->DeleteLocalRef(clfontmetrics);\r\n}\r\n\r\nvoid\r\nCAndroidFont::setAntiAlias(bool aa)\r\n{\r\n\tjclass cls_fntManage = CJNI::getJNIEnv()->FindClass(JNI_FONTMANAGER_LOAD_PATH);\r\n\tgetEnv()->CallStaticVoidMethod( cls_fntManage, m_setantialias, (jobject)m_paint, (jboolean)aa );\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_fntManage);\r\n}\r\n\r\nfloat\r\nCAndroidFont::stringWidth(const char * strText)\r\n{\r\n    jstring strj = getEnv()->NewStringUTF(strText);\r\n    jclass cls_fntManage = CJNI::getJNIEnv()->FindClass(JNI_FONTMANAGER_LOAD_PATH);\r\n    jfloat jresult = getEnv()->CallStaticFloatMethod( cls_fntManage, m_measuretext, (jobject)m_paint, strj );\r\n\r\n    getEnv()->DeleteLocalRef( strj );\r\n    getEnv()->DeleteLocalRef(cls_fntManage);\r\n    return (float)jresult;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidFont.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#pragma once\r\n\r\n#include \"CJNI.h\"\r\n#include \"PackageDefine.h\"\r\n\r\n// フォント対応表。抽象化されたaliasと、実際iOSに渡すフォント名の対応をとる。\r\nstatic struct FONTLIST {\r\n\tconst char * alias;\r\n\tconst char * fontname;\r\n} ms_fontlist[] = {\r\n    // alias        Android-name\r\n    { \"Georgia\",    \"Georgia.TTF\" },\r\n    { \"ヒラギノ角ゴ pro\", \"MTLmr3m.ttf\" },\r\n    { 0, 0 }\r\n};\r\n\r\nclass CAndroidFont : public CJNI\r\n{\r\npublic:\r\n\tCAndroidFont(int size, const char * fontName = 0);\r\n\tvirtual ~CAndroidFont();\r\n\r\n\tvoid setAntiAlias(bool aa);\r\n\tvoid setTextSize(float size);\r\n\r\n\tfloat stringWidth(const char * strText);\r\n\r\n\t// フォント各値取得\r\n\tinline float\t\tascent() { return m_f_ascent; }\r\n\tinline float\t\tdescent() { return m_f_descent; }\r\n\tinline float\t\ttop() { return m_f_top; }\r\n\tinline float\t\tbottom() { return m_f_bottom; }\r\n\r\n\tinline jobject&\t\tgetPaint() { return m_paint; }\r\n\r\nprivate:\r\n\tjobject\t\tm_paint;\t\t// Paintオブジェクト\r\n\tjmethodID\tm_getfontmetrics;\t// getFontMetrics() method ID\r\n\tjmethodID\tm_setantialias;\t\t// setAntiAlias(boolean) method ID\r\n\tjmethodID\tm_settextsize;\t\t// setTextSize() method ID\r\n\tjmethodID\tm_measuretext;\t\t// measureText() method ID\r\n\r\n\tjfieldID\tm_ascent;\r\n\tjfieldID\tm_descent;\r\n\tjfieldID\tm_top;\r\n\tjfieldID\tm_bottom;\r\n\tjmethodID\tm_stringwidth;\r\n\r\n\tfloat\t\tm_f_ascent;\r\n\tfloat\t\tm_f_descent;\r\n\tfloat\t\tm_f_top;\r\n\tfloat\t\tm_f_bottom;\r\n};\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidPathConv.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <sys/stat.h>\r\n#include <errno.h>\r\n#include <string.h>\r\n#include \"CJNI.h\"\r\n#include \"CAndroidPathConv.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"PackageDefine.h\"\r\n\r\nCAndroidPathConv::CAndroidPathConv() : m_build(false), m_external(0), m_install(0) {}\r\nCAndroidPathConv::~CAndroidPathConv() {\r\n    delete [] m_external;\r\n    delete [] m_install;\r\n}\r\n\r\nCAndroidPathConv&\r\nCAndroidPathConv::getInstance()\r\n{\r\n    static CAndroidPathConv instance;\r\n    return instance;\r\n}\r\n\r\nconst char *\r\nCAndroidPathConv::makePath(const char * path, const char * suffix, const char * base)\r\n{\r\n    int extlen = (suffix) ? strlen(suffix) : 0;\r\n    int len = strlen(path) + strlen(base) + extlen + 2;\r\n    char * buf = new char [ len ];\r\n    strcpy(buf, base);\r\n    //strcat(buf, \"/\");\r\n    strcat(buf, path);\r\n    if(suffix) strcat(buf, suffix);\r\n    //DEBUG_PRINT(\"fullpath: %s\", buf);\r\n    return (const char *)buf;\r\n}\r\n\r\nbool\r\nCAndroidPathConv::checkExists(const char * path)\r\n{\r\n    bool bResult = true;\r\n    struct stat st;\r\n    int iRes = stat(path, &st);\r\n    if((iRes != 0) && (errno == ENOENT)) bResult = false;\r\n    return bResult;\r\n}\r\n\r\nconst char *\r\nCAndroidPathConv::fullpath(const char * url, const char * suffix, bool* isReadOnly)\r\n{\r\n    build();\r\n\r\n\t// Default\r\n\tif( isReadOnly ) *isReadOnly = true;\r\n\r\n    // assets が指定されている場合、まずは external から探し、\r\n    // 見つからなければ install から探す。どちらもなければ 0 を返す。\r\n    if (!strncmp(url, \"asset://\", 8)) {\r\n        const char * path;\r\n        path = makePath(url + 8, suffix, m_external);\r\n        if(checkExists(path))\r\n\t\t{\r\n\t\t\tif( isReadOnly ) { *isReadOnly = false; }\r\n\t\t\treturn path;\r\n\t\t}\r\n        delete [] path;\r\n\r\n        path = makePath(url + 8, suffix, m_install);\r\n        if(checkExists(path)) return path;\r\n        delete [] path;\r\n        return 0;\r\n    }\r\n\r\n\tconst char* path = url;\r\n\tif( !strncmp(url, \"external/\", 9) )\r\n\t{\r\n\t\tif( isReadOnly ) { *isReadOnly = false; }\r\n\t\treturn makePath(url + 9, suffix, m_external);\r\n\t}\r\n    if (!strncmp(url, \"install/\", 8)) return makePath(url + 8, suffix, m_install);\r\n    return 0;\r\n}\r\n\r\nvoid\r\nCAndroidPathConv::create_external()\r\n{\r\n    // Java 側で生成した、file://external に相当するpathを初回のみ取得し、以後保持する。\r\n\tjclass cls_pfif = CJNI::getJNIEnv()->FindClass(JNI_LOAD_PATH);\r\n\tjfieldID id_external = CJNI::getJNIEnv()->GetStaticFieldID(cls_pfif, \"m_path_external\", \"Ljava/lang/String;\");\r\n\tjstring obj_external = (jstring)CJNI::getJNIEnv()->GetStaticObjectField(cls_pfif, id_external);\r\n\tconst char* str1 = CJNI::getJNIEnv()->GetStringUTFChars(obj_external, 0);\r\n\tchar * buf = new char [ strlen(str1) + 1 ];\r\n\tstrcpy(buf, str1);\r\n\tm_external = (const char *)buf;\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_pfif);\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(id_external);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(obj_external);\r\n}\r\n\r\nvoid\r\nCAndroidPathConv::create_install()\r\n{\r\n    // Java 側で生成した、file://install に相当するpathを初回のみ取得し、以後保持する。\r\n\tjclass cls_pfif = CJNI::getJNIEnv()->FindClass(JNI_LOAD_PATH);\r\n\tjfieldID id_install = CJNI::getJNIEnv()->GetStaticFieldID(cls_pfif, \"m_path_install\", \"Ljava/lang/String;\");\r\n\tjstring obj_install = (jstring)CJNI::getJNIEnv()->GetStaticObjectField(cls_pfif, id_install);\r\n\tconst char* str1 = CJNI::getJNIEnv()->GetStringUTFChars(obj_install, 0);\r\n\tchar * buf = new char [ strlen(str1) + 1 ];\r\n\tstrcpy(buf, str1);\r\n\tm_install = (const char *)buf;\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_pfif);\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(id_install);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(obj_install);\r\n}\r\n\r\nvoid\r\nCAndroidPathConv::build()\r\n{\r\n    if(m_build) return;\r\n    CPFInterface::getInstance().platform().logging(\"build base path.\");\r\n    create_install();\r\n    create_external();\r\n    CPFInterface::getInstance().platform().logging(\"install: %s, external: %s\", m_install, m_external);\r\n    m_build = true;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidPathConv.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CAndroidPathConv_h\r\n#define CAndroidPathConv_h\r\n\r\n#include \"AndroidFileLocation.h\"\r\n\r\nclass CAndroidPathConv\r\n{\r\nprivate:\r\n    CAndroidPathConv();\r\n    virtual ~CAndroidPathConv();\r\n\r\npublic:\r\n    static CAndroidPathConv& getInstance();\r\n\r\n    const char * fullpath(const char * url, const char * suffix = 0 , bool* isReadOnly=0);\r\n\r\n    const char * install() { build(); return m_install; }\r\n    const char * external() { build(); return m_external; }\r\n\r\nprivate:\r\n    const char * makePath(const char * path, const char * suffix, const char * base);\r\n    bool checkExists(const char * path);\r\n\r\n    void build();\r\n    void create_external();\r\n    void create_install();\r\n\r\nprivate:\r\n    bool                m_build;\r\n    const char      *   m_external;\r\n    const char      *   m_install;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidReadFileStream.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CAndroidReadFileStream.cpp\r\n//\r\n//\r\n#include <stdio.h>\r\n#include <fcntl.h>\r\n#include <sys/types.h> \r\n#include <sys/stat.h> \r\n#include <unistd.h>\r\n// #include <iostream>\r\n\r\n#include \"CAndroidPathConv.h\"\r\n#include \"CAndroidReadFileStream.h\"\r\n#include \"CAndroidWriteFileStream.h\"\r\n#include \"AndroidFileLocation.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n\r\n// 論理トップレベルディレクトリと、物理ディレクトリパスの対応を行うテーブル。\r\nconst CAndroidReadFileStream::LOCLIST CAndroidReadFileStream::m_toplevel[3] = {\r\n    { \"external/\",  PATH_EXTERN,  false  },   // インストール後、更新の対象となる可変ファイル\r\n    { \"install/\",   PATH_INSTALL, true   },   // インストール時に配置される固定ファイル\r\n    { 0, 0 }\r\n};\r\n\r\nCAndroidReadFileStream::CAndroidReadFileStream()\r\n: m_bReadOnly(true)\r\n, m_fd(-1)\r\n, m_fp(0)\r\n, m_eStat(CLOSED)\r\n, m_fullpath(0)\r\n, m_writeStream(0)\r\n, m_decrypter()\r\n{}\r\n\r\nCAndroidReadFileStream::~CAndroidReadFileStream()\r\n{\r\n    if(m_fp) fclose(m_fp);\r\n    m_fd = -1;\r\n    m_eStat = CLOSED;    \r\n    delete [] m_fullpath;\r\n}\r\n\r\nCAndroidReadFileStream *\r\nCAndroidReadFileStream::openStream(const char * path, const char * home)\r\n{\r\n    CAndroidReadFileStream * pStream = 0;\r\n\r\n    pStream = new CAndroidReadFileStream();\r\n    if(!pStream) return 0;\r\n\r\n    CAndroidPathConv& pathconv = CAndroidPathConv::getInstance();\r\n    pStream->m_fullpath = pathconv.fullpath(path);\r\n\r\n    if(!pStream->m_fullpath) {\r\n        // ファイルセグメントが指定されていない\r\n        pStream->m_eStat = NOT_FOUND;\r\n        return pStream;\r\n    }\r\n\r\n    // 物理パスができたので、ファイルをオープンする。\r\n    pStream->m_fd = open(pStream->m_fullpath, O_RDONLY);\r\n    if(pStream->m_fd < 0) {\r\n    \t// オープンに失敗\r\n    \tpStream->m_eStat = NOT_FOUND;\r\n    \treturn pStream;\r\n    }\r\n    // fopen 系関数を使うために fdopen で m_fp も作っておく\r\n    pStream->m_fp = fdopen(pStream->m_fd, \"rb\");\r\n    if(!pStream->m_fp) {\r\n    \tclose(pStream->m_fd);\r\n    \tpStream->m_fd = -1;\r\n    \tpStream->m_eStat = NOT_FOUND;\r\n    \treturn pStream;\r\n    }\r\n        \r\n    // オープンに成功したので正常終了ステータスにする。\r\n    pStream->m_eStat = NORMAL;\r\n    return pStream;\r\n}\r\n\r\nCAndroidReadFileStream *\r\nCAndroidReadFileStream::openAssets(const char * path, const char * home)\r\n{\r\n\t// 今や内容が全く同じ\r\n\treturn openStream(path, home);\r\n}\r\n\r\n\r\ns32 \r\nCAndroidReadFileStream::getSize()\r\n{\r\n    struct stat file_stats;\r\n    if(fstat(m_fd, &file_stats) < 0) {\r\n        return -1;\r\n    }\r\n\r\n    return file_stats.st_size - (m_decrypter.m_useNew ? 4 : 0);\r\n}\r\n\r\ns32\r\nCAndroidReadFileStream::getPosition()\r\n{\r\n    return (s32)(ftell(m_fp) - (m_decrypter.m_useNew ? 4 : 0));\r\n}\r\n\r\nu8       \r\nCAndroidReadFileStream::readU8()\r\n{\r\n    // とりあえず動かすため、fgetc() で実装する。\r\n\tu8 val = fgetc(m_fp);\r\n\tdecrypt(&val,1);\r\n\treturn (u8)val;\r\n}\r\n\r\nu16      \r\nCAndroidReadFileStream::readU16()\r\n{\r\n    u8 buf[2];\r\n    if(1 == fread(buf, 2, 1, m_fp)) {\r\n\t\tdecrypt(buf,2);\r\n        u16 ret = ((u16)buf[0] << 8) | (u16)buf[1];\r\n        return ret;\r\n    }\r\n    return 0;\r\n}\r\n\r\nu32      \r\nCAndroidReadFileStream::readU32()\r\n{\r\n    u8 buf[4];\r\n    if(1 == fread(buf, 4, 1, m_fp)) {\r\n\t\tdecrypt(buf,4);\r\n        u32 ret = ((u32)buf[0] << 24) | ((u16)buf[1] <<16) | ((u16)buf[2] << 8) | (u16)buf[3];\r\n        return ret;\r\n    }\r\n    return 0;\r\n}\r\n\r\nfloat    \r\nCAndroidReadFileStream::readFloat()\r\n{\r\n    float f;\r\n    if(1 == fread(&f, sizeof(float), 1, m_fp)) {\r\n\t\tdecrypt(&f, sizeof(float));\r\n        return f;\r\n    }\r\n    return 0.0f;\r\n}\r\n\r\nbool     \r\nCAndroidReadFileStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n    u32 cnt;\r\n    \r\n    cnt = fread(buffer, 1, byteSize, m_fp);\r\n\tdecrypt(buffer, cnt);\r\n    return (cnt == byteSize) ? true : false; \r\n}\r\n\r\nIReadStream::ESTATUS  \r\nCAndroidReadFileStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\nIWriteStream *  \r\nCAndroidReadFileStream::getWriteStream()\r\n{\r\n    if(m_bReadOnly) return 0;\r\n    if(!m_writeStream) m_writeStream = new CAndroidWriteFileStream(*this);\r\n    return m_writeStream;\r\n}\r\n\r\n\r\nint\r\nCAndroidReadFileStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n    int cnt = fread(pBufferU16, sizeof(u16), items, m_fp);\r\n    decrypt(pBufferU16,sizeof(u16) * cnt);\r\n\r\n    // iOS と Android/ARM では元々big endian なので、バイトオーダーの入れ替えは特に不要。\r\n    // Windows 環境ではこれを使用して読む必要が生じるため、互換のために用意する。\r\n    return cnt;\r\n}\r\n\r\nint\r\nCAndroidReadFileStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n    int cnt = fread(pBufferU32, sizeof(u32), items, m_fp);\r\n    decrypt(pBufferU32,sizeof(u32) * cnt);\r\n\r\n    // iOS と Android/ARM では元々big endian なので、バイトオーダーの入れ替えは特に不要。\r\n    // Windows 環境ではこれを使用して読む必要が生じるため、互換のために用意する。\r\n    return cnt;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidReadFileStream.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CAndroidReadFileStream.h\r\n//\r\n//\r\n\r\n#ifndef CAndroidReadFileStream_h\r\n#define CAndroidReadFileStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n#include \"encryptFile.h\"\r\n\r\nclass CAndroidWriteFileStream;\r\n\r\n// ファイルアクセスクラス実装\r\nclass CAndroidReadFileStream : public IReadStream\r\n{\r\n\tfriend class CAndroidWriteFileStream;\r\nprivate:\r\n    typedef struct {\r\n        const char * top;\r\n        const char * phisical;\r\n        bool\t\t readonly;\r\n    } LOCLIST;\r\n    static const LOCLIST m_toplevel[];\r\n\r\n    // ファクトリとなるクラスメソッド以外で勝手に new はできない\r\n    CAndroidReadFileStream();\r\npublic:\r\n    // delete はできる。\r\n    virtual ~CAndroidReadFileStream();\r\n\r\n    // 指定されたパスで CAndroidReadStream インスタンスを作り、そのポインタを返す。\r\n    static CAndroidReadFileStream * openStream(const char * path, const char * home);\r\n    \r\n    // 指定されたパス名称を EXTERN -> INSTALL の順に検索し、先に見つかった方でCiOSReadStreamインスタンスを作る。\r\n    static CAndroidReadFileStream * openAssets(const char * path, const char * home);\r\n\r\n    s32     getSize();\r\n    s32     getPosition();\r\n    u8      readU8();\r\n    u16     readU16();\r\n    u32     readU32();\r\n    float   readFloat();\r\n    bool    readBlock(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus();\r\n    \r\n    int\t\treadU16arr(u16 * pBufferU16, int items);\r\n    int\t\treadU32arr(u32 * pBufferU32, int items);\r\n\r\n    IWriteStream * getWriteStream();\r\nprivate:\r\n\r\n    const char\t  * m_fullpath;\r\n    ESTATUS     m_eStat;\r\n    FILE      * m_fp;\r\n    int         m_fd;\r\n\r\n    bool\t\tm_bReadOnly;\r\n    CAndroidWriteFileStream * m_writeStream;\r\n\r\npublic:\r\n\tinline u32 decryptSetup(const u8* ptr) {\r\n\t\tu8 hdr[4];\r\n\t\thdr[0] = 0;\r\n\t\thdr[1] = 0;\r\n\t\thdr[2] = 0;\r\n\t\thdr[3] = 0;\r\n\r\n\t\tif (m_fp) {\r\n\t\t\tfread(hdr, 1, 4, m_fp); \r\n\t\t}\r\n\r\n\t\tu32 res = m_decrypter.decryptSetup(ptr, hdr);\r\n\t\tif (res == 0) {\r\n\t\t\tif (m_fp) {\r\n\t\t\t\tfseek(m_fp, 0, SEEK_SET);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\nprivate:\r\n    CDecryptBaseClass m_decrypter;\r\n    inline void decrypt(void* ptr, u32 length) {\r\n        m_decrypter.decryptBlck(ptr, length);\r\n    }\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidRequest.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// #include <iostream>\r\n// #include <string>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n\r\n#include <string.h>\r\n#include <pthread.h>\r\n#include <setjmp.h>\r\n#include <errno.h>\r\n#include <fcntl.h>\r\n#include <stdarg.h>\r\n#include <jni.h>\r\n#include <unistd.h>\r\n#include <linux/ioctl.h>\r\n#include <sys/vfs.h>\r\n#include <android/log.h>\r\n#include \"CAndroidPathConv.h\"\r\n#include \"CAndroidRequest.h\"\r\n#include \"CAndroidTmpFile.h\"\r\n#include \"CAndroidWidget.h\"\r\n#include \"CJNI.h\"\r\n#include \"KLBOpenSLAudioPlayer.h\"\r\n#include \"PackageDefine.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n#include \"FontRendering.h\"\r\n\r\n#include <vector>\r\n// #include \"klb_android_GameEngine_PFInterface.h\"\r\n\r\n// Android は stdarg.h をサポートしない(そのかわりincludeしてもエラーを出さない)ため、\r\n// va_start/va_arg/va_end が定義されない。gcc のビルトインを定義してやる。\r\n#if !defined(va_start)\r\n#define va_start(ap, last) __builtin_va_start(ap, last)\r\n#endif\r\n#if !defined(va_end)\r\n#define va_end(ap) __builtin_va_end(ap)\r\n#endif\r\n#if !defined(va_arg)\r\n#define va_arg(ap, type) __builtin_va_arg(ap, type)\r\n#endif\r\n#if !defined(va_list)\r\ntypedef __builtin_va_list va_list;\r\n#endif\r\n\r\nCAndroidRequest * CAndroidRequest::ms_instance = 0;\r\n\r\nCAndroidRequest::CAndroidRequest(const char* model, const char * brand, const char * board, const char * version, const char * tz)\r\n: m_homePath(0), m_master_BGM(1.0f), m_master_SE(1.0f), m_regId(0)\r\n{\r\n\tint len = strlen(model);\r\n\tlen += strlen(brand);\r\n\tlen += strlen(board);\r\n\tlen += strlen(version);\r\n\tlen += strlen(tz);\r\n\tlen += 15;\t// \"Android;%s %s %s;%s\"\r\n\r\n\tchar * buf = new char [ len ];\r\n\tsprintf(buf, \"Android;%s %s %s %s;%s\", model, brand, board, version, tz);\r\n\tm_platform = (const char *)buf;\r\n\tms_instance = this;\r\n}\r\n\r\nCAndroidRequest::~CAndroidRequest() {\r\n\tdelete [] m_homePath;\r\n\tdelete [] m_platform;\r\n        delete [] m_regId;\r\n}\r\n\r\nCAndroidRequest *\r\nCAndroidRequest::getInstance()\r\n{\r\n\treturn ms_instance;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::nativeSignal(int cmd, int param)\r\n{\r\n\tenum {\r\n\t\tMOVIE_FINISHED = 1,\r\n\t};\r\n\tDEBUG_PRINT(\"nativeSignal(%d, %d)\", cmd, param);\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tcase MOVIE_FINISHED:\r\n\t{\r\n\t\tCAndroidMovieWidget * pWidget = CAndroidMovieWidget::getWidget(param);\r\n\t\tif(pWidget) pWidget->m_status = 1;\r\n\t\tbreak;\r\n\t}\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid\r\nCAndroidRequest::init()\r\n{\r\n}\r\nvoid\r\nCAndroidRequest::detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...)\r\n{\r\n#if DEBUG\r\n#ifndef DEBUG_PRINT_OFF\r\n\tconst short logLength = 1024;\r\n    char log[logLength];\r\n\tint hdrLength = 0;\r\n\r\n\thdrLength = snprintf(log, logLength, \"[%d at %s][FUNC:%s] \", lineNo, basefile, functionName);\r\n\tif (hdrLength < 0 || hdrLength == logLength) {\r\n\t\treturn;\r\n\t}\r\n\r\n    // format済み文字列を生成\r\n    va_list ap;\r\n    va_start(ap, format);\r\n    int log_len = vsnprintf(log + hdrLength, logLength - hdrLength, format, ap);\r\n    va_end(ap);\r\n\r\n    // Java側のログ出力メソッドを呼ぶ\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Cpp\", log);\r\n\tKLBPlatformMetrics::getInstance()->appendLog(log, log_len);\r\n#endif // DEBUG_PRINT_OFF\r\n#endif // DEBUG\r\n}\r\n\r\nvoid\r\nCAndroidRequest::logging(const char * format, ...)\r\n{\r\n#if DEBUG\r\n    char log[1024];\r\n\r\n    // format済み文字列を生成\r\n    va_list ap;\r\n    va_start(ap, format);\r\n    vsprintf(log, format, ap);\r\n    va_end(ap);\r\n\r\n    // Java側のログ出力メソッドを呼ぶ\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Cpp\", log);\r\n#endif\r\n}\r\n\r\nconst char*\r\nCAndroidRequest::getBundleVersion() {\r\n    jvalue value;\r\n    CAndroidRequest::getInstance()->callJavaMethod(value, \"getVersionName\", 'S', \"\");\r\n    jstring jstr = (jstring)value.l;\r\n    const char * str = CJNI::getJNIEnv()->GetStringUTFChars(jstr, NULL);\r\n    CJNI::getJNIEnv()->ReleaseStringUTFChars(jstr, str);\r\n    // FIXME ReleaseStringUTFChars 後のポインタを返してしまっている\r\n    return str;\r\n}\r\n\r\nITmpFile *\r\nCAndroidRequest::openTmpFile(const char * tmpPath)\r\n{\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(tmpPath, target, len)) {\r\n\t\t// 平成24年11月27日(火)\r\n\t\t// CiOSTmpFileのファイルパスの解決の仕方が'file://'を抜いた状態で解釈するため、\r\n\t\t// CiOSTmpFileへ渡すファイルパスのprefixを'file://'分進めて渡しています。\r\n\t\ttmpPath = tmpPath + 7;\r\n\t\tCAndroidTmpFile * pTmpFile = new CAndroidTmpFile(tmpPath);\r\n\t\tif(!pTmpFile->isReady()) {\r\n\t\t\tdelete pTmpFile;\r\n\t\t\tpTmpFile = 0;\r\n\t\t}\r\n\t\treturn pTmpFile;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n#include \"FileDelete.h\"\r\n\r\nconst char* getFullNativePath(const char* path) {\r\n\tCAndroidPathConv& pathconv = CAndroidPathConv::getInstance();\r\n\treturn pathconv.fullpath(path + 7);\r\n}\r\n\r\nbool\r\nCAndroidRequest::removeFileOrFolder(const char* filePath) {\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(filePath, target, len)) {\r\n\t\treturn deleteFiles(filePath);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid removeTmpFileNative(const char* filePath) {\r\n\tremove(filePath);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::removeTmpFile(const char *tmpPath)\r\n{\r\n\tCAndroidPathConv& pathconv = CAndroidPathConv::getInstance();\r\n\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(tmpPath, target, len)) {\r\n\t\tconst char * fullpath = pathconv.fullpath(tmpPath + 7);\r\n\t\tunlink(fullpath);\r\n\t\tdelete [] fullpath;\r\n\t}\r\n}\r\n\r\nu32\r\nCAndroidRequest::getFreeSpaceExternalKB() {\r\n\tstruct statfs diskInfo;\r\n\tconst int ret = statfs(CAndroidPathConv::getInstance().fullpath(\"external/\"), &diskInfo);\r\n\tif (ret != 0) {\r\n\t\t// error fetching free space size. return \"no more space left\" for safety\r\n\t\treturn 0;\r\n\t}\r\n\t// calculate free space in KB available to non-superusers\r\n\tunsigned long long freeKB = (diskInfo.f_bavail * diskInfo.f_bsize) >> 10;\r\n\tif (freeKB & ~0xFFFFFF) {\r\n\t\treturn 0xFFFFFF;\r\n\t}\r\n\treturn (u32)freeKB;\r\n}\r\n\r\nu32\r\nCAndroidRequest::getPhysicalMemKB() {\r\n\tFILE* f = fopen(\"/proc/meminfo\", \"r\");\r\n\tu32 outValue = 0; // Default if fail\r\n\r\n\tif (f) {\r\n\t\tint state = 0; \t// Beginning of parsing state machine.\r\n\t\tchar title[64];\t// Storage for descriptor text.\r\n\t\tint titleWrite = 0;\r\n\t\tu32 value = 0;\r\n\r\n\t\twhile (!feof(f)) {\r\n\t\t\tchar c = fgetc(f);\r\n\t\t\t\r\n\t\t\tswitch (state) {\r\n\t\t\tcase 0:\t// Read Title\r\n\t\t\t\tif (c == ':') {\r\n\t\t\t\t\tstate = 1;\r\n\t\t\t\t\ttitle[titleWrite++] = 0; // Close string\r\n\t\t\t\t} else if (c >' ') { // Protect from 0xA or 0xD if multiple\r\n\t\t\t\t\ttitle[titleWrite++] = c;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\t// Cross the sea of spaces after ':'\r\n\t\t\t\t// Compute the value for value 0..9\r\n\t\t\t\t// Detect the end of line\r\n\t\t\t\tif ((c >= '0') && (c <= '9')) {\r\n\t\t\t\t\tvalue = (value * 10) + (c - '0');\r\n\t\t\t\t} else if ((c == 0xA) || (c == 0xD)) {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Here we check the value\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (strcmp(\"MemTotal\", title) == 0) {\r\n\t\t\t\t\t\toutValue = value;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Ready to read the next entry\r\n\t\t\t\t\tstate = 0;\r\n\t\t\t\t\tvalue = 0;\r\n\t\t\t\t\ttitleWrite = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// State machine fails if no EOF in last line, check here.\r\n\t\tif (state == 1) {\r\n\t\t\tif (strcmp(\"MemTotal\", title) == 0) {\r\n\t\t\t\toutValue = value;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tfclose(f);\r\n\t}\r\n\treturn outValue;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::excludePathFromBackup(const char * fullpath)\r\n{\r\n\t// TODO\r\n}\r\n\r\nbool CAndroidRequest::useEncryption() {\r\n\treturn true;\r\n}\r\n\r\ns64\r\nCAndroidRequest::nanotime()\r\n{\r\n#if 0\r\n\tjclass cls_pfif = CJNI::getJNIEnv()->FindClass(JNI_LOAD_PATH);\r\n\tjmethodID nanotime_id = CJNI::getJNIEnv()->GetStaticMethodID(cls_pfif, \"nanotime\", \"()J\");\r\n//\tjclass cls_pfif = CJNI::getJNIEnv()->FindClass(\"java/lang/System\");\r\n//\tjmethodID nanotime_id = CJNI::getJNIEnv()->GetStaticMethodID(cls_pfif, \"nanoTime\", \"()J\");\r\n\tjlong nanotime = CJNI::getJNIEnv()->CallStaticLongMethod(cls_pfif, nanotime_id);\r\n#endif\r\n\tstruct timespec tspec;\r\n\tclock_gettime(CLOCK_REALTIME, &tspec);\r\n\ts64 nanotime = (s64)tspec.tv_sec * 1000000000LL + (s64)tspec.tv_nsec;\r\n\treturn nanotime;\r\n}\r\n\r\nIReadStream *\r\nCAndroidRequest::openReadStream(const char *pathname, bool decrypt)\r\n{\r\n\t// DEBUG_PRINT(\"opening file: pathname=%s, decrypt=%d\", pathname, decrypt);\r\n    // ファイル名の scheme で、どのファイルを開くべきかが決まる。\r\n    if(!strncmp(pathname, \"file://\", 7)) {\r\n        // ファクトリには scheme を除いたパスが渡される。\r\n        CAndroidReadFileStream * pRds = CAndroidReadFileStream::openStream(pathname + 7, 0);\r\n        if (decrypt) { pRds->decryptSetup((const u8*)pathname + 7); }\r\n        return pRds;\r\n    }\r\n    if(!strncmp(pathname, \"asset://\", 8)) {\r\n        CAndroidReadFileStream * pRds = CAndroidReadFileStream::openAssets(pathname, 0);\r\n        if (decrypt) { pRds->decryptSetup((const u8*)pathname + 8); }\r\n        return pRds;\r\n    }\r\n\r\n    if(!strncmp(pathname, \"socket://\", 9)) {\r\n        CSockReadStream * pRds = CSockReadStream::openStream(pathname + 9);\r\n        logging(\"Socket: %s (%p)\", pathname, pRds);\r\n        return pRds;\r\n    }\r\n\r\n    if(!strncmp(pathname, \"http:\", 5)) {\r\n        return 0;\r\n    }\r\n    if(!strncmp(pathname, \"https:\", 6)) {\r\n        return 0;\r\n    }\r\n    return 0;\r\n}\r\n\r\nvoid *\r\nCAndroidRequest::loadAudio(const char * url, bool is_se)\r\n{\r\n\tconst char * path = (!strncmp(url, \"asset://\", 8)) ? url : (url + 7);\r\n\tDEBUG_PRINT(\"loading audio: %s\", path);\r\n\tKLBOpenSLSoundAsset * audio = KLBOpenSLEngine::getInstance()->load(path, is_se);\r\n\treturn audio;\r\n}\r\n\r\nbool\r\nCAndroidRequest::preLoad(void * handle)\r\n{\r\n\tif(!handle) return false;\r\n\tKLBOpenSLSoundAsset * audio = (KLBOpenSLSoundAsset *)handle;\r\n\taudio->prepare(-1);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCAndroidRequest::setBufSize(void *handle, int level)\r\n{\r\n    // TODO\r\n    return true;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::playAudio(void *handle, s32 _milisec, float _tgtVol, float _startVol)\r\n{\r\n\tif(!handle) return;\r\n\tKLBOpenSLSoundAsset * audio = (KLBOpenSLSoundAsset *)handle;\r\n\taudio->play(KLBOpenSLSoundAsset::ONCE, _milisec, _tgtVol, _startVol);\r\n\t// TODO:\r\n}\r\n\r\nvoid\r\nCAndroidRequest::stopAudio(void *handle, s32 _milisec, float _tgtVol)\r\n{\r\n\tif(!handle) return;\r\n\t//KLBOpenSLEngine::getInstance()->discardCorrespondingSoundHandles((KLBOpenSLSoundAsset *)handle);\r\n\tKLBOpenSLEngine::getInstance()->stopCorrespondingSoundHandles((KLBOpenSLSoundAsset *)handle, false, _tgtVol, _milisec);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::setMasterVolume(float volume, bool SEmode)\r\n{\r\n\tDEBUG_PRINT(\"AUDIO; setting master volume. seMode=%d, vol=%f\", SEmode, volume);\r\n\tKLBOpenSLEngine::getInstance()->setMasterVolume(volume, SEmode);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::setAudioVolume(void *handle, float volume)\r\n{\r\n    if(!handle) return;\r\n\tKLBOpenSLEngine::getInstance()->setVolumeOnCorrespondingSoundHandles((KLBOpenSLSoundAsset *)handle, volume);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::setAudioPan(void *handle, float pan)\r\n{\r\n\treturn;\r\n\tif(!handle) return;\r\n\t/*\r\n\tCAndroidAudio * audio = (CAndroidAudio *)handle;\r\n\taudio->setPan(pan);\r\n\t*/\r\n}\r\n\r\nvoid\r\nCAndroidRequest::releaseAudio(void * handle)\r\n{\r\n\tif(!handle) return;\r\n\tKLBOpenSLSoundAsset * audio = (KLBOpenSLSoundAsset *)handle;\r\n\tREPORT_METRICS(\"before closing audio asset\");\r\n\tdelete audio;\r\n\tREPORT_METRICS(\"after closing audio asset\");\r\n}\r\n\r\nvoid\r\nCAndroidRequest::pauseAudio(void * handle, s32 _milisec, float _tgtVol)\r\n{\r\n\tif(!handle) return;\r\n\tKLBOpenSLEngine::getInstance()->pauseCorrespondingSoundHandles((KLBOpenSLSoundAsset *)handle, false, _tgtVol, _milisec);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::resumeAudio(void * handle, s32 _milisec, float _tgtVol)\r\n{\r\n\tif(!handle) return;\r\n\tKLBOpenSLEngine::getInstance()->resumeCorrespondingSoundHandles((KLBOpenSLSoundAsset *)handle, false, _tgtVol, _milisec);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::seekAudio(void * handle, s32 millisec)\r\n{\r\n    // TODO\r\n}\r\n\r\ns32\r\nCAndroidRequest::tellAudio(void * handle)\r\n{\r\n\tif(!handle) return 0;\r\n\treturn KLBOpenSLEngine::getInstance()->tellCorrespondingSoundHandle((KLBOpenSLSoundAsset *)handle);\r\n}\r\n\r\ns32\r\nCAndroidRequest::totalTimeAudio(void * handle)\r\n{\r\n    if(!handle) return 0;\r\n\tKLBOpenSLSoundAsset * audio = (KLBOpenSLSoundAsset *)handle;\r\n\treturn audio->totalPlayTime();\r\n}\r\n\r\ns32\r\nCAndroidRequest::getState(void * handle)\r\n{\r\n\tif(!handle) return 0;\r\n\treturn KLBOpenSLEngine::getInstance()->getStateOfCorrespondingSoundHandle((KLBOpenSLSoundAsset *)handle);\r\n}\r\n\r\n//! サウンドとミュージックの並行処理タイプ設定\r\nvoid\r\nCAndroidRequest::setAudioMultiProcessType( s32 _processType )\r\n{\r\n\tswitch( _processType )\r\n\t{\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT:\r\n\t\t\tKLBOpenSLEngine::getInstance()->setAudioMultiProcessType(_processType);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n//! サウンドの割り込み処理をエンジン側で制御するかどうか\r\nvoid CAndroidRequest::setPauseOnInterruption(bool _bPauseOnInterruption)\r\n{\r\n    // TODO:2013/06/10 現在はiOSのみ対応が必要なのでAndroid側は特に対応なし\r\n}\r\n\r\n#define ANDROID_ALARM_ELAPSED_REALTIME (3)\r\ninline void CAndroidRequest::getElapsedTimeSpec(struct timespec * ts)\r\n{\r\n\t// ref: AOSP source code; frameworks/native/libs/utils/SystemClock.cpp\r\n\tint fd = open(\"/dev/alarm\", O_RDONLY);\r\n\tif (fd == -1) {\r\n\t\tklb_assertAlways(\"failed to claim alarm counter.\");\r\n\t}\r\n\r\n\tint result = ioctl(fd, _IOW('a', 4 | (ANDROID_ALARM_ELAPSED_REALTIME << 4), struct timespec), ts);\r\n\r\n\tclose(fd);\r\n\r\n\tif (result == -1) {\r\n\t\tklb_assertAlways(\"failed to fetch alarm clock via ioctl\");\r\n\t}\r\n}\r\n\r\ninline s64 CAndroidRequest::getElapsedNanoTime(void)\r\n{\r\n\tstruct timespec ts;\r\n\tgetElapsedTimeSpec(&ts);\r\n\treturn ((s64)ts.tv_sec * 1000000000) + ts.tv_nsec;\r\n}\r\n\r\n/*!\r\n    @brief  経過時間を取得(sec)\r\n    @param[in]  void\r\n    @return     s64     経過時間(sec)\r\n */\r\ns64 CAndroidRequest::getElapsedTime(void)\r\n{\r\n\tstruct timespec ts;\r\n\tgetElapsedTimeSpec(&ts);\r\n\treturn (s64)ts.tv_sec;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::setFadeParam(void* _handle, float _tgtVol, u32 _millisec)\r\n{\r\n\tif(!_handle) return;\r\n\tKLBOpenSLEngine::getInstance()->setFadeParamOnCorrespondingSoundHandles((KLBOpenSLSoundAsset *)_handle, _tgtVol, _millisec);\r\n}\r\n\r\n//! フォントオブジェクト取得\r\n\r\nbool CAndroidRequest::registerFont(const char* logicalName, const char* physFile, bool default_) {\r\n\treturn FontObject::registerFont(logicalName, physFile, default_);\r\n}\r\n\r\nvoid *\r\nCAndroidRequest::getFont(int size, const char * fontName, float* pAscent)\r\n{\r\n\tFontObject* pFont = FontObject::createFont(fontName, size);\r\n\tif (pFont) {\r\n\t\t// pFont->\r\n\t\tif (pAscent) {\r\n\t\t\t*pAscent = pFont->getAscent();\r\n\t\t}\r\n\t}\r\n\treturn pFont;\r\n}\r\n\r\nvoid *\r\nCAndroidRequest::getFontSystem(int size, const char * fontName)\r\n{\r\n\tCAndroidFont * pFont = new CAndroidFont(size, fontName);\r\n\treturn (void *)pFont;\r\n}\r\n\r\n//! フォントオブジェクト破棄\r\nvoid\r\nCAndroidRequest::deleteFont(void * pFont)\r\n{\r\n\tFontObject::destroyFont((FontObject*)pFont);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::deleteFontSystem(void * pFont)\r\n{\r\n\tCAndroidFont * p_cFont = (CAndroidFont *)pFont;\r\n\tdelete p_cFont;\r\n}\r\n\r\n//! フォントテクスチャ描画\r\nbool\r\nCAndroidRequest::renderText(const char* utf8String, void * pFont, u32 color,\t//!< 描画する文字列とフォントの指定\r\n\t\t\t\t\t\t\tu16 width, u16 height, u8 * pBuffer8888,    \t\t//!< 描画対象とするテクスチャバッファとそのピクセルサイズ\r\n\t\t\t\t\t\t\ts16 stride, s16 base_x, s16 base_y, bool use4444)         \t\t//!< baseline起点とするテクスチャ内の位置\r\n{\r\n\tFontObject* pObjFont = (FontObject*)pFont;\r\n\tif (pObjFont) {\r\n\t\tpObjFont->renderText(base_x, base_y, utf8String, pBuffer8888, color, width, height, stride, use4444);\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nextern \"C\" {\r\n\r\nbool\r\nCAndroidRequest::getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo)\r\n{\r\n\tFontObject* pF = (FontObject*)pFont;\r\n\tif (pF) {\r\n\t\tpF->getTextInfo(utf8String, pReturnInfo);\r\n\t} else {\r\n\t\tpReturnInfo->ascent\t\t= 0.0f;\r\n\t\tpReturnInfo->descent\t= 0.0f;\r\n\t\tpReturnInfo->bottom\t\t= 0.0f;\r\n\t\tpReturnInfo->top\t\t= 0.0f;\r\n\t\tpReturnInfo->width\t\t= 0.0f;\r\n\t\tpReturnInfo->height\t\t= 0.0f;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid*\r\nCAndroidRequest::getGLExtension(const char*)\r\n{\r\n\treturn 0;\r\n}\r\n\r\nconst char *\r\nCAndroidRequest::getFullPath(const char * assetPath,bool* isReadOnly)\r\n{\r\n    CAndroidPathConv& pathconv = CAndroidPathConv::getInstance();\r\n\r\n    // ファイル名の scheme で、どのファイルを開くべきかが決まる。\r\n    if(!strncmp(assetPath, \"file://\", 7)) {\r\n        return pathconv.fullpath(assetPath + 7,0,isReadOnly);\r\n    }\r\n    // scheme が asset であれば、作るのは CiOSReadFileStream だが、EXTERN -> INSTALL の順で検索する。\r\n    if(!strncmp(assetPath, \"asset://\", 8)) {\r\n        return pathconv.fullpath(assetPath,0,isReadOnly);\r\n    }\r\n    return 0;\r\n}\r\n\r\nconst char *\r\nCAndroidRequest::getPlatform()\r\n{\r\n\treturn m_platform;\r\n}\r\n\r\nIWidget *\r\nCAndroidRequest::createControl(IWidget::CONTROL type, int id, const char * caption, int x, int y, int width, int height, ...)\r\n{\r\n\tIWidget * pWidget = 0;\r\n\tva_list ap;\r\n\tva_start(ap, height);\r\n\tswitch(type)\r\n\t{\r\n\tcase IWidget::TEXTBOX:\r\n\tcase IWidget::PASSWDBOX:\r\n\t{\r\n\t\tint maxlen = va_arg(ap, int);\r\n\t\tCAndroidTextWidget * pTextWidget = new CAndroidTextWidget(this);\r\n\t\tif(!pTextWidget || !pTextWidget->create(type, id, caption, x, y, width, height)) {\r\n\t\t\tdelete pTextWidget;\r\n\t\t\tpTextWidget = 0;\r\n\t\t} else {\r\n\t\t\tpTextWidget->setMaxlen(maxlen);\r\n    }\r\n\t\tpWidget = pTextWidget;\r\n\t\tbreak;\r\n\t}\r\n\tcase IWidget::WEBVIEW:\r\n\tcase IWidget::WEBNOJUMP:\r\n\t{\r\n\t\tconst char * token  = va_arg(ap, const char *);\r\n\t\tconst char * region = va_arg(ap, const char *);\r\n\t\tconst char * client = va_arg(ap, const char *);\r\n\t\tconst char * cKey   = va_arg(ap, const char *);\r\n\t\tconst char * appId  = va_arg(ap, const char *);\r\n\t\tconst char * userId = va_arg(ap, const char *);\r\n\r\n\t\tCAndroidWebWidget * pWebWidget = new CAndroidWebWidget(this);\r\n\t\tif(!pWebWidget || !pWebWidget->create(type, id, caption, x, y, width, height,\r\n\t\t\t\t\t\t\t\t\t\t\t\ttoken, region, client, cKey, appId, userId)) {\r\n\t\t\tdelete pWebWidget;\r\n\t\t\tpWebWidget = 0;\r\n\t\t}\r\n\t\tpWidget = pWebWidget;\r\n\t\tbreak;\r\n\t}\r\n\tcase IWidget::MOVIEPLAYER:\r\n\t{\r\n\t\tCAndroidMovieWidget * pMovieWidget = new CAndroidMovieWidget(this);\r\n\t\tif(!pMovieWidget || !pMovieWidget->create(type, id, caption, x, y, width, height)) {\r\n\t\t\tdelete pMovieWidget;\r\n\t\t\tpMovieWidget = 0;\r\n\t\t}\r\n\t\tpWidget = pMovieWidget;\r\n\t\tbreak;\r\n\t}\r\n\tcase IWidget::ACTIVITYINDICATOR:\r\n\t{\r\n\t\tCAndroidActivityIndicator * actI = new CAndroidActivityIndicator(this);\r\n\t\tif(!actI || !actI->create(type, id, caption, x, y, width, height)) {\r\n\t\t\tdelete actI;\r\n\t\t\tactI = 0;\r\n\t\t}\r\n\t\tpWidget = actI;\r\n\t\tbreak;\r\n\t}\r\n\t}\r\n\tva_end(ap);\r\n\treturn pWidget;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::destroyControl(IWidget * pControl)\r\n{\r\n\tdelete pControl;\r\n}\r\n\r\nbool\r\nCAndroidRequest::callApplication(APP_TYPE type, ...)\r\n{\r\n\r\n    bool result = true;\r\n\r\n    va_list ap;\r\n    va_start(ap, type);\r\n\tswitch (type)\r\n\t{\r\n\t// メーラー起動\r\n\tcase IPlatformRequest::APP_MAIL:\r\n\t\t{\r\n\t\t\tconst char * addr = va_arg(ap, const char *);\r\n\t\t\tconst char * subject = va_arg(ap, const char *);\r\n\t\t\tconst char * body = va_arg(ap, const char *);\r\n\t\t\tjvalue value;\r\n\t\t\tcallJavaMethod(value, \"startMailer\", 'V', \"SSS\" , addr , subject , body );\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\t// ブラウザ起動\r\n\tcase IPlatformRequest::APP_BROWSER:\r\n\t\t{\r\n\t\t\tconst char * url = va_arg(ap, const char *);\r\n\t\t\tjvalue value;\r\n\t\t\tcallJavaMethod(value, \"startBrowser\", 'V', \"S\" , url );\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\t// アップデート\r\n\tcase IPlatformRequest::APP_UPDATE:\r\n\t\tresult = false;\r\n\t\tbreak;\r\n\r\n\tdefault:\r\n\t\tresult = false;\r\n\t\tbreak;\r\n\t}\r\n\tva_end(ap);\r\n\treturn result;\r\n\r\n}\r\n\r\nvoid *\r\nCAndroidRequest::createThread(s32 (*thread_func)(void * hThread, void * data), void * data)\r\n{\r\n\tPF_THREAD * thread = new PF_THREAD;\r\n\tif(!thread) return 0;\r\n\tthread->data = data;\r\n\tthread->thread_func = thread_func;\r\n\tthread->result = 0;\r\n\tpthread_create(&(thread->id), 0, ThreadProc, thread);\r\n\treturn thread;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::exitThread(void * hThread, s32 status)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tlongjmp(pThread->jmp, status);\r\n}\r\n\r\nbool\r\nCAndroidRequest::watchThread(void * hThread, s32 * status)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tif(pthread_kill(pThread->id, 0) != ESRCH) {\r\n\t\treturn true;\r\n\t}\r\n\t*status = pThread->result;\r\n\treturn false;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::deleteThread(void * hThread)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tpthread_join(pThread->id, 0);\r\n\tdelete pThread;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::breakThread(void * hThread)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tpthread_kill(pThread->id, SIGKILL);\r\n}\r\n\r\nvoid *\r\nCAndroidRequest::ThreadProc(void * data)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)data;\r\n\tif(!(pThread->result = setjmp(pThread->jmp))) {\r\n\t\tpThread->result = (pThread->thread_func)(pThread, pThread->data);\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCAndroidRequest::genUserID(char * retBuf, int maxlen)\r\n{\r\n\tjvalue value;\r\n\tcallJavaMethod(value, \"genUserID\", 'S', \"\");\r\n\tjstring jstr = (jstring)value.l;\r\n\tconst char * str = CJNI::getJNIEnv()->GetStringUTFChars(jstr, NULL);\r\n\tint i = 0;\r\n\tfor(i = 0; str[i] && i < maxlen - 1; i++) retBuf[i] = str[i];\r\n\tretBuf[i] = 0;\r\n\tCJNI::getJNIEnv()->ReleaseStringUTFChars(jstr, str);\r\n\treturn i;\r\n}\r\n\r\nint\r\nCAndroidRequest::genUserPW(const char * salt, char * retBuf, int maxlen)\r\n{\r\n\tchar buf[1024];\r\n\ttime_t tm;\r\n\tint rnd = rand();\r\n\ttime(&tm);\r\n\tsprintf(buf, \"%d.%d.%s\", rnd, (u32)tm, salt);\r\n\treturn sha512(buf, retBuf, maxlen);\r\n}\r\n\r\nbool\r\nCAndroidRequest::readyDevID()\r\n{\r\n\tif(m_regId) return true;\t// 既に取得していれば問題無し。\r\n\tbool bResult = false;\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"readyRegID\", 'S', \"\");\r\n\tJNIEnv * env = CJNI::getJNIEnv();\r\n\tconst char *bytes = env->GetStringUTFChars((jstring)ret.l, NULL);\r\n\t// DEBUG_PRINT(\"readyDevID ret.l:%s\", (char*)ret.l);\r\n\t// DEBUG_PRINT(\"readyDevID bytes:%s\", bytes);\r\n\tif(bytes) {\r\n\t\tint len = strlen(bytes);\r\n\t\tif(len > 0) {\r\n\t\t\tchar * buf = new char [len + 1];\r\n\t\t\tstrcpy(buf, bytes);\r\n\t\t\tm_regId = (const char *)buf;\r\n\t\t\tbResult = true;\r\n\t\t}\r\n\t\tenv->ReleaseStringUTFChars((jstring)ret.l, bytes);\r\n\t}\r\n\t// DEBUG_PRINT(\"readyDevID ret:%d\", bResult);\r\n\treturn bResult;\r\n}\r\n\r\nint\r\nCAndroidRequest::getDevID(char * retBuf, int maxlen)\r\n{\r\n\tif(!m_regId) return 0;\r\n\r\n\tint i;\r\n\tfor(i = 0; m_regId[i] && i < maxlen - 1; i++) retBuf[i] = m_regId[i];\r\n\tretBuf[i] = 0;\r\n\treturn i;\r\n}\r\n\r\nbool\r\nCAndroidRequest::setSecureDataID(const char * service_name, const char * user_id)\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"setKeyChain\", 'Z', \"SSS\", service_name, \"user_id\", user_id);\r\n\treturn (bool)ret.z;\r\n}\r\n\r\nbool\r\nCAndroidRequest::setSecureDataPW(const char * service_name, const char * passwd)\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"setKeyChain\", 'Z', \"SSS\", service_name, \"passwd\", passwd);\r\n\treturn (bool)ret.z;\r\n\r\n}\r\n\r\nint\r\nCAndroidRequest::getSecureDataID(const char * service_name, char * retBuf, int maxlen)\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"getKeyChain\", 'S', \"SS\", service_name, \"user_id\");\r\n\tJNIEnv * env = CJNI::getJNIEnv();\r\n\tconst char *bytes = env->GetStringUTFChars((jstring)ret.l, NULL);\r\n\tint i;\r\n\tfor(i = 0; bytes[i] && i < maxlen - 1; i++) retBuf[i] = bytes[i];\r\n\tretBuf[i] = 0;\r\n\r\n\tenv->ReleaseStringUTFChars((jstring)ret.l, bytes);\r\n\r\n\treturn i;\r\n}\r\n\r\nint\r\nCAndroidRequest::getSecureDataPW(const char * service_name, char * retBuf, int maxlen)\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"getKeyChain\", 'S', \"SS\", service_name, \"passwd\");\r\n\tJNIEnv * env = CJNI::getJNIEnv();\r\n\tconst char *bytes = env->GetStringUTFChars((jstring)ret.l, NULL);\r\n\tint i;\r\n\tfor(i = 0; bytes[i] && i < maxlen - 1; i++) retBuf[i] = bytes[i];\r\n\tretBuf[i] = 0;\r\n\r\n\tenv->ReleaseStringUTFChars((jstring)ret.l, bytes);\r\n\r\n\treturn i;\r\n}\r\n    \r\nbool\r\nCAndroidRequest::delSecureDataID(const char * service_name)\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"delKeyChain\", 'Z', \"SS\", service_name,\"user_id\");\r\n\treturn (bool)ret.z;\r\n}\r\n\r\nbool\r\nCAndroidRequest::delSecureDataPW(const char * service_name)\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"delKeyChain\", 'Z', \"SS\", service_name,\"passwd\");\r\n\treturn (bool)ret.z;\r\n}\r\n\r\nvoid\r\nCAndroidRequest::startAlertDialog( const char* title , const char* message )\r\n{\r\n\tjvalue ret;\r\n\tcallJavaMethod(ret, \"startAlertDialog\", 'V', \"SS\", title , message);\r\n}\r\n\r\nint\r\nCAndroidRequest::sha512(const char * string, char * buf, int maxlen)\r\n{\r\n\tJNIEnv * env = CJNI::getJNIEnv();\r\n\tjstring jstr = env->NewStringUTF(string);\r\n\tjclass cls_pfif = env->FindClass(JNI_LOAD_PATH);\r\n\tjmethodID methodID = env->GetStaticMethodID(cls_pfif, \"sha512\", \"(Ljava/lang/String;)[B\");\r\n\tjbyteArray jbarr = (jbyteArray)env->CallStaticObjectMethod(cls_pfif, methodID, jstr);\r\n\tjbyte* digest = env->GetByteArrayElements(jbarr, NULL);\r\n\r\n\tint len = env->GetArrayLength(jbarr);\r\n\tchar * ptr = buf;\r\n\tfor(int i = 0; i < len && i * 2 < maxlen - 1; i++) {\r\n\t\tsprintf(ptr, \"%02x\", 0xff & (int)digest[i]);\r\n\t\tptr += strlen(ptr);\r\n\t}\r\n\tenv->ReleaseByteArrayElements(jbarr, digest, 0);\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(jstr);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_pfif);\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(methodID);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(jbarr);\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(digest);\r\n\r\n\treturn strlen(buf);\r\n}\r\n\r\nbool\r\nCAndroidRequest::callJavaMethod(jvalue& ret, const char * method, const char rettype, const char * form, ...)\r\n{\r\n\tusing namespace std;\r\n\t//引数の数を数える\r\n\tint count = 0;\r\n\tfor(const char * ptr = form; *ptr; ptr++) {\r\n\t\tif(*ptr != ' ') count++;\r\n\t}\r\n\t//DEBUG_PRINT(\"args count: %d\", count);\r\n\tJNIEnv* env = CJNI::getJNIEnv();\r\n\r\n\tvector<jstring> jstrs;\r\n\tjvalue * arrArgs = NULL;\r\n\tjmethodID methodID = 0;\r\n\tchar signature[1024];\r\n\tchar * wp = signature;\r\n\tstrcpy(wp, \"(\");\r\n\twp += strlen(wp);\r\n\tif( count > 0 )\r\n\t{\r\n\t\tarrArgs = new jvalue [ count ];\r\n\r\n\t\tva_list ap;\r\n\t\tva_start(ap, form);\r\n\t\tcount = 0;\r\n\t\tfor(const char * ptr = form; *ptr; ptr++) {\r\n\t\t\tif(*ptr == ' ')continue;\r\n\t\t\tswitch(*ptr) {\r\n\t\t\tcase 'Z':\r\n\t\t\t{\r\n\t\t\t\tbool bval = (bool)va_arg(ap, int);\r\n\t\t\t\tarrArgs[count++].z = (jboolean)bval;\r\n\t\t\t\tstrcpy(wp, \"Z\");\r\n\t\t\t\twp += strlen(wp);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'C':\r\n\t\t\t{\r\n\t\t\t\tchar cval = (char)va_arg(ap, int);\r\n\t\t\t\tarrArgs[count++].c = (jchar)cval;\r\n\t\t\t\tstrcpy(wp, \"C\");\r\n\t\t\t\twp += strlen(wp);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'I':\r\n\t\t\t{\r\n\t\t\t\tint ival = va_arg(ap, int);\r\n\t\t\t\tarrArgs[count++].i = (jint)ival;\r\n\t\t\t\tstrcpy(wp, \"I\");\r\n\t\t\t\twp += strlen(wp);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'F':\r\n\t\t\t{\r\n\t\t\t\tfloat fval = (float)va_arg(ap, double);\r\n\t\t\t\tarrArgs[count++].f = (jfloat)fval;\r\n\t\t\t\tstrcpy(wp, \"F\");\r\n\t\t\t\twp += strlen(wp);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'D':\r\n\t\t\t{\r\n\t\t\t\tdouble dval = va_arg(ap, double);\r\n\t\t\t\tarrArgs[count++].d = (jdouble)dval;\r\n\t\t\t\tstrcpy(wp, \"D\");\r\n\t\t\t\twp += strlen(wp);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'S':\r\n\t\t\t{\r\n\t\t\t\tconst char * string = va_arg(ap, const char *);\r\n\t\t\t\tjstring jstr = env->NewStringUTF(string);\r\n\t\t\t\tarrArgs[count++].l = (jobject)jstr;\r\n\t\t\t\tstrcpy(wp, \"Ljava/lang/String;\");\r\n\t\t\t\twp += strlen(wp);\r\n\t\t\t\tjstrs.push_back(jstr);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tdefault:\r\n\t\t\t{\r\n\t\t\t\tklb_assertAlways(\"wrong JNI signature. unknown type: %c\", *ptr);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tva_end(ap);\r\n\t}\r\n\tstrcpy(wp, \")\");\r\n\twp += strlen(wp);\r\n\tjclass cls_pfif = env->FindClass(JNI_LOAD_PATH);\r\n\r\n\tswitch(rettype) {\r\n\tcase 'V':\r\n\t{\r\n\t\tstrcpy(wp, \"V\");\r\n\t\tmethodID = env->GetStaticMethodID(cls_pfif, method, signature);\r\n\t\tenv->CallStaticVoidMethodA(cls_pfif, methodID, arrArgs);\r\n\t\tbreak;\r\n\t}\r\n\tcase 'Z':\r\n\t{\r\n\t\tstrcpy(wp, \"Z\");\r\n\t\tmethodID = env->GetStaticMethodID(cls_pfif, method, signature);\r\n\t\tret.z = env->CallStaticBooleanMethodA(cls_pfif, methodID, arrArgs);\r\n\t\tbreak;\r\n\t}\r\n\tcase 'I':\r\n\t{\r\n\t\tstrcpy(wp, \"I\");\r\n\t\tDEBUG_PRINT(\"return I type method call.:<%s>\", signature);\r\n\t\tmethodID = env->GetStaticMethodID(cls_pfif, method, signature);\r\n\t\tret.i = env->CallStaticIntMethodA(cls_pfif, methodID, arrArgs);\r\n\t\tDEBUG_PRINT(\"return I type method call finished.\");\r\n\t\tbreak;\r\n\t}\r\n\tcase 'F':\r\n\t{\r\n\t\tstrcpy(wp, \"F\");\r\n\t\tmethodID = env->GetStaticMethodID(cls_pfif, method, signature);\r\n\t\tret.f = env->CallStaticFloatMethodA(cls_pfif, methodID, arrArgs);\r\n\t\tbreak;\r\n\t}\r\n\tcase 'D':\r\n\t{\r\n\t\tstrcpy(wp, \"D\");\r\n\t\tmethodID = env->GetStaticMethodID(cls_pfif, method, signature);\r\n\t\tret.d = env->CallStaticDoubleMethodA(cls_pfif, methodID, arrArgs);\r\n\t\tbreak;\r\n\t}\r\n\tcase 'S':\r\n\t{\r\n\t\tstrcpy(wp, \"Ljava/lang/String;\");\r\n\t\tmethodID = env->GetStaticMethodID(cls_pfif, method, signature);\r\n\t\t//DEBUG_PRINT(\"static methodID:%d\", methodID);\r\n\t\tif( methodID > 0 ) {\r\n\t\t\tret.l = env->CallStaticObjectMethodA(cls_pfif, methodID, arrArgs);\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// staticMethodから見つからなかった場合はstaticではないMethodから検索\r\n\t\tmethodID = env->GetMethodID(cls_pfif, method, signature);\r\n\t\t//DEBUG_PRINT(\"public methodID:%d\", methodID);\r\n\t\tif( methodID > 0 ) {\r\n\t\t\tret.l = env->CallObjectMethodA(cls_pfif, methodID, arrArgs);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\t}\r\n\r\n\t// 文字列を引数として渡した場合はそれを解放する。\r\n\tcount = 0;\r\n\tfor(const char * ptr = form; *ptr; ptr++) {\r\n\t\tif(*ptr == ' ')continue;\r\n\t\tif(*ptr != 'S') {\r\n\t\t\tcount++;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t// 平成25年8月14日(水)\r\n\t\t// jstringをchar*に変換しているわけではないからいらないのでは.\r\n\t\t// env->ReleaseStringUTFChars((jstring)arrArgs[count].l, 0);\r\n\t\tcount++;\r\n\t}\r\n\t// 引数として使用した配列を解放する\r\n\tif( arrArgs != NULL ) {\r\n\t\tdelete [] arrArgs;\r\n\t}\r\n\r\n\tenv->DeleteLocalRef(cls_pfif);\r\n\tvector<jstring>::iterator it = jstrs.begin();\r\n\twhile (it != jstrs.end()) {\r\n\t\tenv->DeleteLocalRef(*it);\r\n\t\t++it;\r\n\t}\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(arrArgs);\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(methodID);\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nJNIEXPORT jboolean JNICALL APP_FUNC(initSequence)\r\n  (JNIEnv *env, jobject obj, jint j_width, jint j_height, jstring j_strPath,\r\n\t\t  jstring j_model , jstring j_brand, jstring j_board, jstring j_version, jstring j_tz)\r\n{\r\n\tconst char * strPath  = env->GetStringUTFChars(j_strPath, 0);\r\n\tconst char * strModel = env->GetStringUTFChars(j_model, 0);\r\n\tconst char * strBrand = env->GetStringUTFChars(j_brand, 0);\r\n\tconst char * strBoard = env->GetStringUTFChars(j_board, 0);\r\n\tconst char * strVersion = env->GetStringUTFChars(j_version, 0);\r\n\tconst char * strTZ = env->GetStringUTFChars(j_tz, 0);\r\n\r\n#if DEBUG\r\n\tchar buf[1024];\r\n\tsprintf(buf, \"%s|%s|%s|%s|%s|%s\", strPath, strModel, strBrand, strBoard, strVersion, strTZ);\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", buf);\r\n#endif\r\n\r\n\tint width = j_width;\r\n\tint height = j_height;\r\n\r\n\tCAndroidRequest * pRequest = new CAndroidRequest(strModel, strBrand, strBoard, strVersion, strTZ);\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"platform plugin created.\");\r\n#endif\r\n\r\n\tCJNI::setJNIEnv(env);\t//　これでC++コードの中でも簡易版 SoundPool が使える。\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"JNIEnv initialize.\");\r\n#endif\r\n\r\n    pRequest->init();\r\n\tpRequest->setHomePath(strPath);\r\n\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"platform plugin created.\");\r\n#endif\r\n\r\n\tpfif.setPlatformRequest(pRequest);\r\n\r\n\t// サウンドシステム初期化\r\n\tKLBOpenSLEngine::getInstance();\r\n#if DEBUG\r\n\tKLBPlatformMetrics::getInstance()->start();\r\n#endif\r\n\r\n\tDEBUG_PRINT(\"initSequence() start!\");\r\n\tDEBUG_PRINT(\"initSequence(): platform = [%s]\", pfif.platform().getPlatform());\r\n\r\n\tGameSetup();\r\n\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"GameStartup() finished.\");\r\n#endif\r\n\r\n\t// 起動シーケンス順に呼び出す。この呼び出し順は厳守されねばならない。\r\n\tpfif.client().setScreenInfo(true, width, height);\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"setScreenInfo() finished.\");\r\n#endif\r\n\r\n    pfif.client().setFilePath(0);\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"setFilePath() finished.\");\r\n\tDEBUG_PRINT(\"initSequence() call initGame()\");\r\n#endif\r\n\tpfif.client().initGame();\r\n#if DEBUG\r\n    __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"initGame() finished.\");\r\n\tDEBUG_PRINT(\"initSequence() initGame() finish.\");\r\n#endif\r\n\r\n        env->ReleaseStringUTFChars(j_strPath, strPath);\r\n        env->ReleaseStringUTFChars(j_model, strModel);\r\n        env->ReleaseStringUTFChars(j_brand, strBrand);\r\n        env->ReleaseStringUTFChars(j_board, strBoard);\r\n        env->ReleaseStringUTFChars(j_version, strVersion);\r\n        env->ReleaseStringUTFChars(j_tz, strTZ);\r\n\r\n\t// 初期化終了。\r\n\treturn (jboolean)true;\r\n}\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    frameFlip\r\n * Signature: (I)V\r\n */\r\nJNIEXPORT void JNICALL APP_FUNC(frameFlip)\r\n  (JNIEnv *env, jobject obj, jint j_deltaT)\r\n{\r\n\tu32 deltaT = j_deltaT;\r\n\r\n#if defined(DEBUG) || defined(DEBUG_PERFORMANCE)\r\n\ts64 frameProcStart = CAndroidRequest::getInstance()->nanotime();\r\n#endif\r\n\r\n\tCPFInterface::getInstance().client().frameFlip(deltaT);\r\n\r\n#if defined(DEBUG) || defined(DEBUG_PERFORMANCE)\r\n\tKLBPlatformMetrics::getInstance()->logFrameSummary(deltaT, frameProcStart);\r\n#endif\r\n}\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    finishGame\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL APP_FUNC(finishGame)\r\n  (JNIEnv *env, jobject obj)\r\n{\r\n\tCPFInterface::getInstance().client().finishGame();\r\n\r\n\t// サウンドシステム終了\r\n\tKLBOpenSLEngine::terminate();\r\n\r\n\treturn;\r\n}\r\n\r\nJNIEXPORT void JNICALL APP_FUNC(inputPoint)\r\n  (JNIEnv *env, jobject obj, jint j_id, jint j_type, jint j_x, jint j_y)\r\n{\r\n\tstatic IClientRequest::INPUT_TYPE type[] = {\r\n\t\t\tIClientRequest::I_CLICK,\r\n\t\t\tIClientRequest::I_DRAG,\r\n\t\t\tIClientRequest::I_RELEASE\r\n\t};\r\n\tCPFInterface::getInstance().client().inputPoint(j_id, type[j_type], j_x, j_y);\r\n}\r\n\r\nJNIEXPORT void JNICALL APP_FUNC(inputDeviceKey)\r\n  (JNIEnv *env, jobject obj, jint keyId, jchar eventType)\r\n{\r\n\tCPFInterface::getInstance().client().inputDeviceKey(keyId, eventType);\r\n}\r\n\r\nJNIEXPORT void JNICALL APP_FUNC(rotateScreenOrientation)\r\n  (JNIEnv *env, jobject obj, jint j_origin, jint j_width, jint j_height)\r\n{\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tif(!pfif.isClient()) return;\r\n\tint width = j_width;\r\n\tint height = j_height;\r\n\tint origin = j_origin;\r\n\tIClientRequest::SCRMODE mode = (width > height) ? IClientRequest::LANDSCAPE : IClientRequest::PORTRAIT;\r\n\r\n\tstatic IClientRequest::ORIGIN arr_origin[] = {\r\n\t\t\tIClientRequest::LEFT_TOP,\r\n\t\t\tIClientRequest::LEFT_BOTTOM,\r\n\t\t\tIClientRequest::RIGHT_BOTTOM,\r\n\t\t\tIClientRequest::RIGHT_TOP\r\n\t};\r\n\r\n\tbool bResult = pfif.client().reportScreenRotation(arr_origin[origin], mode);\r\n\tif(bResult) {\r\n\t\tpfif.client().changeScreenInfo(arr_origin[origin], width, height);\r\n\t}\r\n}\r\n\r\nJNIEXPORT void JNICALL APP_FUNC(toNativeSignal)\r\n  (JNIEnv *env, jobject obj, jint j_cmd, jint j_param)\r\n{\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\r\n\t// porting layer class の instance を取得\r\n\tCAndroidRequest * instance = CAndroidRequest::getInstance();\r\n\tif(!instance) return;\r\n\r\n\tinstance->nativeSignal((int)j_cmd, (int)j_param);\r\n}\r\n\r\nJNIEXPORT jint JNICALL APP_FUNC(getGLVersion)\r\n  (JNIEnv * env, jobject obj)\r\n{\r\n#ifdef OPENGL2\r\n\treturn 2;\r\n#else\r\n\treturn 1;\r\n#endif\r\n}\r\n\r\nJNIEXPORT void  JNICALL APP_FUNC(resetViewport)\r\n  (JNIEnv * env, jobject obj)\r\n{\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tif(!pfif.isClient()) return;\r\n\tCPFInterface::getInstance().client().resetViewport();\r\n}\r\n\r\n// アプリにおけるバックグラウンドに行った際の動作\r\nJNIEXPORT void  JNICALL APP_FUNC(onActivityPause) (void)\r\n{\r\n\tDEBUG_PRINT(\"AUDIO; onPause..\");\r\n\tKLBOpenSLEngine::getInstance()->onActivityPause();\r\n\r\n    // ゲームのポーズ\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tif(!pfif.isClient()) return;\r\n\tpfif.client().pauseGame(true);\r\n}\r\n\r\n// アプリに置けるフォアグラウンドに行った際の動作\r\nJNIEXPORT void  JNICALL APP_FUNC(onActivityResume) (void)\r\n{\r\n    // ゲームのポーズ復帰\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tif(!pfif.isClient()) return;\r\n\tpfif.client().pauseGame(false);\r\n\r\n\tpfif.client().controlEvent(IClientRequest::E_RESUME, 0, 0, 0, 0, 0);\r\n\r\n\tDEBUG_PRINT(\"AUDIO; onResume..\");\r\n\tKLBOpenSLEngine::getInstance()->onActivityResume();\r\n}\r\n\r\n// WebViewの動作コールバック\r\nJNIEXPORT void  JNICALL APP_FUNC(WebViewControlEvent) ( JNIEnv *env, jobject obj, jobject _pWeb, jint _flg )\r\n{\r\n\tCAndroidWebWidget * pWidget = CAndroidWebWidget::get_webViewItem(_pWeb);\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tint status = -1;\r\n\tif(!pfif.isClient()) return;\r\n\r\n\tenum LOCAL_WEBEVENT_TYPE\r\n\t{\r\n\t\tE_DIDSTARTLOADWEB = 0,\r\n\t\tE_DIDLOADENDWEB,\r\n\t\tE_FAILEDLOADWEB,\r\n\t\tE_URLJUMP,\r\n\t};\r\n\r\n\tswitch((int)_flg)\r\n\t{\r\n\t\tcase E_DIDSTARTLOADWEB:\r\n\t\t\tstatus = IClientRequest::E_DIDSTARTLOADWEB;\r\n\t\t\tbreak;\r\n\t\tcase E_DIDLOADENDWEB:\r\n\t\t\tstatus = IClientRequest::E_DIDLOADENDWEB;\r\n\t\t\tbreak;\r\n\t\tcase E_FAILEDLOADWEB:\r\n\t\t\tstatus = IClientRequest::E_FAILEDLOADWEB;\r\n\t\t\tbreak;\r\n\t\tcase E_URLJUMP:\r\n\t\t{\r\n\t\t\tsize_t len = pWidget->getTmpTextLength();\r\n\t\t\tif(len > 0)\r\n\t\t\t{\r\n\t\t\t\tchar* pTmpBuff = NULL;\r\n\t\t\t\tpTmpBuff = KLBNEWA(char, len + 1);\r\n\t\t\t\tpWidget->getTmpText(pTmpBuff, len + 1);\r\n\t\t\t\tpWidget->setTmpString(pTmpBuff);\r\n\t\t\t\tKLBDELETEA(pTmpBuff);\r\n\t\t\t\tstatus = IClientRequest::E_URLJUMP;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// リンク先が無ければreturn\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault:\r\n\t\t\treturn; // 値が想定外なのでリターン\r\n\t}\r\n\tCPFInterface::getInstance().client().controlEvent((IClientRequest::EVENT_TYPE)status, pWidget, 0, 0, 0, 0);\r\n}\r\n\r\nJNIEXPORT void\tJNICALL APP_FUNC(clientControlEvent)\r\n\t(JNIEnv * env, jobject obj, jint j_type, jint j_widget, jstring j_data_1, jstring j_data_2)\r\n{\r\n\tIClientRequest& cli = CPFInterface::getInstance().client();\r\n\t// とりあえずストア関係だけ //\r\n\tstatic IClientRequest::EVENT_TYPE event_array[] =\r\n\t{\r\n\t\tIClientRequest::E_STORE_BAD_ITEMID,         // アイテムIDが無効\r\n\t\tIClientRequest::E_STORE_GET_PRODUCTS, // ProductListの取得.\r\n\t\tIClientRequest::E_STORE_PURCHASHING,        // 購入処理中\r\n\t\tIClientRequest::E_STORE_PURCHASHED,         // 購入処理終了\r\n\t\tIClientRequest::E_STORE_FAILED,             // 購入処理失敗\r\n\t\tIClientRequest::E_STORE_RESTORE,            // リストア終了\r\n\t\tIClientRequest::E_STORE_RESTORE_FAILED,     // リストア失敗\r\n\t\tIClientRequest::E_STORE_RESTORE_COMPLETED,  // 全リストア終了\r\n\t};\r\n\r\n\tconst char * char_1 = env->GetStringUTFChars(j_data_1, NULL);\r\n    const char * char_2 = env->GetStringUTFChars(j_data_2, NULL);\r\n    // FIXME ↑の２つは ReleaseStringUTFChars されてないけど影響範囲が広いのでとりあえず後回し\r\n\r\n    size_t len_1 = strlen(char_1);\r\n    size_t len_2 = strlen(char_2);\r\n\r\n    len_1 = len_1 == 0 ? 0 : len_1 + 1;\r\n    len_2 = len_2 == 0 ? 0 : len_2 + 1;\r\n\r\n    printf(\"clientEvent %d\\n\", j_type);\r\n\r\n\tcli.controlEvent(event_array[j_type], 0, len_1, (void *)char_1, len_2, (void *)char_2);\r\n}\r\n\r\nJNIEXPORT void JNICALL APP_FUNC(jniOnLoad) (JavaVM* vm, void* reserved)\r\n{\r\n\tCJNI::setJavaVM(vm);\r\n}\r\n\r\n// onPauseがコールされてからonDrawFrameが初めてコールされた際の処理 //\r\nJNIEXPORT void  JNICALL APP_FUNC(clientResumeGame) (void)\r\n{\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tif(!pfif.isClient()) return;\r\n\r\n\tpfif.client().pauseGame(false);\r\n\r\n\tpfif.client().controlEvent(IClientRequest::E_PAUSE, 0, 0, 0, 0, 0);\r\n\tpfif.client().frameFlip(1);    // 1フレーム分まわす。経過時間は 1[ms] という扱い。\r\n//\tpfif.client().controlEvent(IClientRequest::E_RESUME, 0, 0, 0, 0, 0);\r\n\r\n\tpfif.client().pauseGame(true);\r\n}\r\n\r\n//================================================\r\n// 課金\r\nvoid\r\nCAndroidRequest::initStoreTransactionObserver()\r\n{\r\n\tjvalue value;\r\n\tcallJavaMethod(value, \"billingInit\", 'V', \"\");\r\n}\r\n\r\nvoid\r\nCAndroidRequest::releaseStoreTransactionObserver()\r\n{\r\n\tjvalue value;\r\n\tcallJavaMethod(value, \"billingTerminate\", 'V', \"\");\r\n}\r\n\r\nvoid\r\nCAndroidRequest::buyStoreItems(const char * item_id)\r\n{\r\n\t// 購入処理\r\n\tjvalue value;\r\n\tcallJavaMethod(value, \"billingBuyItem\", 'V', \"S\" , item_id);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::getStoreProducts(const char* json, bool currency_mode)\r\n{\r\n\t// リスト問い合わせ\r\n\tjvalue value;\r\n\tcallJavaMethod(value, \"billingGetProducts\", 'V', \"S\" , json);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::finishStoreTransaction(const char* receipt)\r\n{\r\n\tjvalue value;\r\n\tcallJavaMethod(value, \"billingConsume\", 'V', \"S\", receipt);\r\n}\r\n\r\n//================================================\r\n// mutex\r\nvoid* CAndroidRequest::allocMutex\t()\r\n{\r\n\tpthread_mutex_t* pSection = new pthread_mutex_t();\r\n\tif (pSection) {\r\n\t\tif (pthread_mutex_init(pSection,NULL)) {\r\n\t\t\tdelete pSection;\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n\treturn pSection;\r\n}\r\n\r\nvoid CAndroidRequest::freeMutex\t\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tpthread_mutex_t* pSection = (pthread_mutex_t*)mutex;\t\r\n\t\tpthread_mutex_destroy(pSection); // Error handling useless here.\r\n\t\tdelete pSection;\r\n\t}\r\n}\r\n\r\nvoid CAndroidRequest::mutexLock\t\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tpthread_mutex_t* pSection = (pthread_mutex_t*)mutex;\r\n\t\tpthread_mutex_lock(pSection);\r\n\t}\r\n}\r\n\r\nvoid CAndroidRequest::mutexUnlock\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tpthread_mutex_t* pSection = (pthread_mutex_t*)mutex;\r\n\t\tpthread_mutex_unlock(pSection);\r\n\t}\r\n}\r\n\r\nstruct EventMutex {\r\n\tpthread_mutex_t\t\tmutex;\r\n\tpthread_cond_t\t\tcond;\r\n};\r\n\r\nvoid* CAndroidRequest::allocEventLock()\r\n{\r\n\tEventMutex* pEvent = new EventMutex();\r\n\tif (pEvent) {\r\n\t\tbool err = false;\r\n\t\tif (pthread_mutex_init(&pEvent->mutex, NULL) == 0) {\r\n\t\t\tif (pthread_cond_init(&pEvent->cond, NULL) == 0) {\r\n\t\t\t\t// Do nothing.\r\n\t\t\t} else {\r\n\t\t\t\tpthread_mutex_destroy(&pEvent->mutex);\r\n\t\t\t\terr = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\terr = true;\r\n\t\t}\r\n\t\t\r\n\t\tif (err) {\r\n\t\t\tdelete pEvent;\r\n\t\t\tpEvent = NULL;\r\n\t\t}\r\n\t}\r\n\treturn pEvent;\r\n}\r\n\r\nvoid CAndroidRequest::freeEventLock\t(void* lock)\r\n{\r\n\tEventMutex* pEvent = (EventMutex*)lock;\r\n\tif (pEvent) {\r\n\t\tpthread_mutex_destroy\t(&pEvent->mutex);\r\n\t\tpthread_cond_destroy\t(&pEvent->cond);\t\t\r\n\t}\r\n}\r\n\r\nvoid CAndroidRequest::eventSleep(void* lock)\r\n{\r\n\tEventMutex* pEvent = (EventMutex*)lock;\r\n\tif (pEvent) {\r\n\t\t// Own mutex [Lock]\r\n\t\tpthread_mutex_lock\t\t(&pEvent->mutex);\r\n\t\t// [Unlock] and go to [Sleep], atomically.\r\n\t\tpthread_cond_wait\t\t(&pEvent->cond, &pEvent->mutex);\r\n\t\t// [Lock] on wake up.\r\n\t\t\r\n\t\t// [Unlock] again.\r\n\t\tpthread_mutex_unlock\t(&pEvent->mutex);\r\n\t}\r\n}\r\n\r\nvoid CAndroidRequest::eventWakeup(void* lock)\r\n{\r\n\tEventMutex* pEvent = (EventMutex*)lock;\r\n\tif (pEvent) {\r\n\t\t// Own mutex [Lock]\r\n\t\tpthread_mutex_lock\t\t(&pEvent->mutex);\r\n\r\n\t\tpthread_cond_broadcast\t(&pEvent->cond);\r\n\r\n\t\t// [Unlock] again.\r\n\t\tpthread_mutex_unlock\t(&pEvent->mutex);\r\n\t}\r\n}\r\n\r\nvoid CAndroidRequest::forbidSleep(bool is_forbidden)\r\n{\r\n\tjvalue value;\r\n    CAndroidRequest::getInstance()->callJavaMethod(value, \"forbidSleep\", 'V', \"Z\", is_forbidden);\r\n}\r\n\r\n//================================================\r\n// FileIO\r\nvoid*\r\nCAndroidRequest::ifopen\t(const char* name, const char* mode)\r\n{\r\n\treturn fopen(name, mode);\r\n}\r\n\r\nvoid\r\nCAndroidRequest::ifclose(void* file)\r\n{\r\n\tif (file)\r\n\t{\r\n\t\tfclose((FILE*)file);\r\n\t}\r\n}\r\n\r\nint\r\nCAndroidRequest::ifseek(void* file, long int offset, int origin)\r\n{\r\n\treturn fseek((FILE*)file,offset,origin);\r\n}\r\n\r\nu32\r\nCAndroidRequest::ifread(void* ptr, u32 size, u32 count, void* file )\r\n{\r\n\treturn fread(ptr, size, count, (FILE*)file);\r\n}\r\n\r\nu32\r\nCAndroidRequest::ifwrite(const void * ptr, u32 size, u32 count, void* file)\r\n{\r\n\treturn fwrite(ptr, size, count, (FILE*)file);\r\n}\r\n\r\nint\r\nCAndroidRequest::ifflush(void* file)\r\n{\r\n\treturn fflush((FILE*)file);\r\n}\r\n\r\nlong int\r\nCAndroidRequest::iftell\t(void* file)\r\n{\r\n\treturn ftell((FILE*)file);\r\n}\r\n\r\nbool\r\nCAndroidRequest::icreateEmptyFile(const char* name)\r\n{\r\n\tFILE* f = fopen(name,\"a\");\r\n\tif (f) {\r\n\t\tfclose(f);\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\n};\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidRequest.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef cppinterface_h\r\n#define cppinterface_h\r\n\r\n#include <string.h>\r\n#include <time.h>\r\n#include <pthread.h>\r\n#include <setjmp.h>\r\n\r\n// #include \"klb_android_GameStartup_PFInterface.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CAndroidReadFileStream.h\"\r\n#include \"CSockReadStream.h\"\r\n#include \"CJNI.h\"\r\n\r\nclass CAndroidRequest : public IPlatformRequest\r\n{\r\npublic:\r\n\tCAndroidRequest(const char * model,const char * brand, const char * board, const char * version, const char * tz);\r\n\tvirtual ~CAndroidRequest();\r\n\r\n\tstatic CAndroidRequest * getInstance();\r\n\r\n\tvoid nativeSignal(int cmd, int param);\r\n\r\n\tvoid init();\r\n\r\n\t//! Use Encryption for disk I/O\r\n\tvirtual bool useEncryption();\r\n\r\n\tvoid detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...);\r\n\tvoid logging(const char * format, ...);\r\n\ts64\tnanotime();\r\n    \r\n    // バンドルバージョン取得\r\n    const char* getBundleVersion();\r\n\r\n\tIReadStream * openReadStream(const char * fileName, bool decrypt);\r\n\tITmpFile * openTmpFile(const char * tmpPath);\r\n    void removeTmpFile(const char * tmpPath);\r\n\tvirtual bool removeFileOrFolder\t (const char * filePath);\r\n\tvirtual u32 getFreeSpaceExternalKB();\r\n\tvirtual u32 getPhysicalMemKB\t ();\r\n    void excludePathFromBackup(const char * fullpath);\r\n    void*\t\tifopen\t(const char* name, const char* mode);\r\n\tvoid\t\tifclose\t(void* file);\r\n\tint\t\t\tifseek\t(void* file, long int offset, int origin);\r\n\tu32\t\t\tifread\t(void* ptr, u32 size, u32 count, void* file );\r\n\tu32\t\t\tifwrite\t(const void * ptr, u32 size, u32 count, void* file);\r\n\tint\t\t\tifflush\t(void* file);\r\n\tlong int\tiftell\t(void* file);\r\n\tbool\t\ticreateEmptyFile(const char* name);\r\n\r\n\tvoid * loadAudio(const char * url, bool is_se);\r\n    bool   preLoad(void * handle);\r\n    bool   setBufSize(void * handle, int level);\r\n    void   playAudio(void * handle, s32 _milisec=0, float _tgtVol=1.0f, float _startVol=1.0f);\r\n    void   stopAudio(void * handle, s32 _milisec=0, float _tgtVol=0.0f);\r\n    void   setMasterVolume(float volume, bool SEmode);\r\n    void   setAudioVolume(void * handle, float volume);\r\n    void   setAudioPan(void * handle, float pan);\r\n    void   releaseAudio(void * handle);\r\n\t\r\n\tvoid pauseAudio(void * handle, s32 _milisec=0, float _tgtVol=0.0f);\r\n    void resumeAudio(void * handle, s32 _milisec=0, float _tgtVol=1.0f);\r\n    void seekAudio(void * handle, s32 millisec);\r\n    s32  tellAudio(void * handle);\r\n    s32  totalTimeAudio(void * handle);\r\n\t\r\n    s32 getState(void * handle);\r\n    \r\n    //! サウンドとミュージックの並行処理タイプ設定\r\n    void setAudioMultiProcessType( s32 _processType );\r\n    \r\n    //! サウンドの割り込み処理をエンジン側で制御するかどうか\r\n    void setPauseOnInterruption(bool _bPauseOnInterruption);\r\n    \r\n    //! 経過時間を取得(sec)\r\n    s64 getElapsedTime(void);\r\n    \r\n    void setFadeParam(void* _handle, float _tgtVol, u32 _milisec);\r\n\r\n    //! フォントオブジェクト取得\r\n\tbool registerFont(const char* logicalName, const char* physFile, bool default_);\r\n\tvoid * getFont(int size, const char * fontName = 0, float* pAscent = NULL);\r\n\tvoid * getFontSystem(int size, const char * fontName = 0);\r\n\r\n    //! フォントオブジェクト破棄\r\n    void deleteFont(void * pFont);\r\n    void deleteFontSystem(void * pFont);\r\n\r\n    //! フォントテクスチャ描画\r\n    bool renderText(const char* utf8String, void * pFont, u32 color,    //!< 描画する文字列とフォントの指定\r\n                    u16 width, u16 height, u8 * pBuffer8888,    \t\t//!< 描画対象とするテクスチャバッファとそのピクセルサイズ\r\n                    s16 stride, s16 base_x, s16 base_y, bool use4444);  //!< baseline起点とするテクスチャ内の位置\r\n\r\n    bool getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo);\r\n\r\n    void* getGLExtension(const char*);\r\n\r\n    // 追加分method\r\n\r\n    const char * getFullPath(const char * assetPath, bool* isReadOnly);\r\n\r\n    const char * getPlatform();\r\n\r\n    IWidget * createControl(IWidget::CONTROL type, int id, const char * caption, int x, int y, int width, int height, ...);\r\n    void destroyControl(IWidget * pControl);\r\n    bool callApplication(APP_TYPE type, ...);\r\n\r\n    void * createThread(s32 (*thread_func)(void * hThread, void * data), void * data);\r\n    void exitThread(void * hThread, s32 status);\r\n    bool watchThread(void * hThread, s32 * status);\r\n    void deleteThread(void * hThread);\r\n    void breakThread(void * hThread);\r\n\r\n    int genUserID(char * retBuf, int maxlen);\r\n    int genUserPW(const char * salt, char * retBuf, int maxlen);\r\n\t\r\n    bool readyDevID();\r\n    int getDevID(char * retBuf, int maxlen);\r\n\t\r\n    bool setSecureDataID(const char * service_name, const char * user_id);\r\n    bool setSecureDataPW(const char * service_name, const char * passwd);\r\n    int getSecureDataID(const char * service_name, char * retBuf, int maxlen);\r\n    int getSecureDataPW(const char * service_name, char * retBuf, int maxlen);\r\n\r\n\tbool delSecureDataID(const char * service_name);\r\n    bool delSecureDataPW(const char * service_name);\r\n\t\r\n    // alert dialog\r\n    void startAlertDialog( const char* title , const char* message );\r\n\t\r\n\tinline void setHomePath(const char * home) {\r\n\t\tint len = strlen(home);\r\n\t\tm_homePath = new char [len + 1];\r\n\t\tstrcpy(m_homePath, home);\r\n\t}\r\n\tbool callJavaMethod(jvalue& ret, const char * method, const char rettype, const char * form, ...);\r\n\r\n\tinline float getMasterVolume(bool SEmode) const { return (SEmode) ? m_master_SE : m_master_BGM; }\r\n\r\n\r\n\t//! ストア機能\r\n\t//! トランザクション監視開始\r\n\tvoid initStoreTransactionObserver();\r\n\t//! トランザクション監視終了\r\n\tvoid releaseStoreTransactionObserver();\r\n\t//! 購入要求: アイテムID(文字列)の配列と、その数を渡す\r\n    void buyStoreItems(const char * item_id);\r\n\t//! プロダクトリスト取得要求: アイテムIDの配列とその数、及びcurrency表示にするかの判定とcallbackを渡す.\r\n    void getStoreProducts(const char* json, bool currency_mode);\r\n\t//! サーバー通信後にトランザクションを閉じて購入処理を確定させる。\r\n\tvoid finishStoreTransaction(const char* receipt);\r\n\r\n\tvirtual void*\tallocMutex\t\t();\r\n\tvirtual void\tfreeMutex\t\t(void* mutex);\r\n\tvirtual void\tmutexLock\t\t(void* mutex);\r\n\tvirtual void\tmutexUnlock\t\t(void* mutex);\r\n\r\n\tvirtual void*\tallocEventLock\t();\r\n\tvirtual void\tfreeEventLock\t(void* lock);\r\n\tvirtual void\teventSleep\t\t(void* lock);\r\n\tvirtual void\teventWakeup\t\t(void* lock);\r\n\r\n\tvoid forbidSleep(bool is_forbidden);\r\n\r\nprivate:\r\n\tstruct PF_THREAD {\r\n\t\tjmp_buf\t\tjmp;\r\n\t\tpthread_t\tid;\r\n\t\ts32 (*thread_func)(void *, void *);\r\n\t\tvoid * data;\r\n\t\ts32 result;\r\n\t};\r\n\tstatic void * ThreadProc(void * data);\r\n\tint sha512(const char * string, char * buf, int maxlen);\r\n\r\n\tenum {\r\n\t\tSND_SLOT = 256\r\n\t};\r\n\tchar \t\t\t*\tm_homePath;\r\n\tconst char\t\t*\tm_platform;\r\n\tfloat\t\t\t\tm_master_BGM;\r\n\tfloat\t\t\t\tm_master_SE;\r\n\r\n\tconst char\t\t*\tm_regId;\r\n\r\n\tstatic CAndroidRequest * ms_instance;\r\n\tstatic void getElapsedTimeSpec(struct timespec * ts);\r\n\tstatic s64 getElapsedNanoTime(void);\r\n};\r\n\r\n#endif // cppinterface_h\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidTmpFile.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CAndroidTmpFile.cpp\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n#include <unistd.h>\r\n#include <fcntl.h>\r\n#include <sys/types.h> \r\n#include <sys/stat.h>\r\n#include \"CAndroidPathConv.h\"\r\n#include \"CAndroidTmpFile.h\"\r\n#include \"CPFInterface.h\"\r\n\r\nCAndroidTmpFile::CAndroidTmpFile(const char * path) : m_fullpath(0)\r\n{\r\n    m_fullpath = CAndroidPathConv::getInstance().fullpath(path);\r\n    // 平成24年11月27日(火)\r\n    // ファイルが存在しない場合に該当ファイルが生成されない事への対応と\r\n    // 権限の付与を行いました。\r\n    m_fd = open(m_fullpath, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);\r\n    CPFInterface::getInstance().platform().excludePathFromBackup(m_fullpath);\r\n}\r\n\r\nCAndroidTmpFile::~CAndroidTmpFile()\r\n{\r\n    if(m_fd > 0) {\r\n        close(m_fd);\r\n    }\r\n    delete [] m_fullpath;\r\n}\r\n\r\nsize_t\r\nCAndroidTmpFile::writeTmp(void *ptr, size_t size)\r\n{\r\n    return write(m_fd, ptr, size);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidTmpFile.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CAndroidTmpFile.h\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#ifndef CAndroidTmpFile_h\r\n#define CAndroidTmpFile_h\r\n\r\n#include <iostream>\r\n#include \"ITmpFile.h\"\r\n\r\nclass CAndroidTmpFile : public ITmpFile\r\n{\r\npublic:\r\n    CAndroidTmpFile(const char * tmpPath);\r\n    virtual ~CAndroidTmpFile();\r\n\r\n    size_t writeTmp(void * ptr, size_t size);\r\n    inline bool isReady() { return (m_fd > 0) ? true : false; }\r\nprivate:\r\n    const char     *    m_fullpath;\r\n    int                 m_fd;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidWidget.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CAndroidWidget.h\"\r\n#include \"CAndroidRequest.h\"\r\n#include \"CAndroidPathConv.h\"\r\n#include \"CJNI.h\"\r\n#include \"../source/SystemTask/CKLBDrawTask.h\"\r\n#include \"PackageDefine.h\"\r\n\r\n// Android は stdarg.h をサポートしない(そのかわりincludeしてもエラーを出さない)ため、\r\n// va_start/va_arg/va_end が定義されない。gcc のビルトインを定義してやる。\r\n#if !defined(va_start)\r\n#define va_start(ap, last) __builtin_va_start(ap, last)\r\n#endif\r\n#if !defined(va_end)\r\n#define va_end(ap) __builtin_va_end(ap)\r\n#endif\r\n#if !defined(va_arg)\r\n#define va_arg(ap, type) __builtin_va_arg(ap, type)\r\n#endif\r\n#if !defined(va_list)\r\ntypedef __builtin_va_list va_list;\r\n#endif\r\n\r\n\r\nCAndroidWidget::CAndroidWidget(CAndroidRequest * pPlatform)\r\n: m_id(0), m_hIndex(0), m_x(0), m_y(0), m_width(0), m_height(0)\r\n, m_bVisible(true), m_bEnable(true), m_pParent(pPlatform) {}\r\n\r\nCAndroidWidget::~CAndroidWidget() {}\r\n\r\nvoid\r\nCAndroidWidget::cmd(int cmd, ...) {}\r\n\r\nint\r\nCAndroidWidget::status() { return 0; }\r\n\r\nbool\r\nCAndroidWidget::init(int hIndex, int id, int x, int y, int width, int height)\r\n{\r\n\tm_hIndex = hIndex;\r\n\tm_id = id;\r\n\tm_x = x;\r\n\tm_y = y;\r\n\tm_width = width;\r\n\tm_height = height;\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCAndroidWidget::move(int x, int y)\r\n{\r\n\tbool bUpdate = (m_x != x || m_y != y);\r\n\tm_x = x;\r\n\tm_y = y;\r\n    set_move(m_x,m_y,m_width,m_height);\r\n}\r\n\r\nvoid\r\nCAndroidWidget::resize(int width, int height)\r\n{\r\n\tbool bUpdate = (m_width != width || m_height != height);\r\n\tm_width = width;\r\n\tm_height = height;\r\n    set_move(m_x,m_y,m_width,m_height);\r\n}\r\n\r\nvoid\r\nCAndroidWidget::visible(bool bVisible)\r\n{\r\n\tif(bVisible != m_bVisible) {\r\n\t\tm_bVisible = bVisible;\r\n\t\tupdate();\r\n\t}\r\n}\r\n\r\nvoid\r\nCAndroidWidget::enable(bool bEnable)\r\n{\r\n\tif(bEnable != m_bEnable) {\r\n\t\tm_bEnable = bEnable;\r\n\t\tupdate();\r\n\t}\r\n}\r\n\r\n/////////////////////////////////////////////\r\n// CAndroidTextWidget\r\n/////////////////////////////////////////////\r\nCAndroidTextWidget\t*\tCAndroidTextWidget::m_begin = 0;\r\nCAndroidTextWidget\t*\tCAndroidTextWidget::m_end = 0;\r\nCAndroidTextWidget::CAndroidTextWidget(CAndroidRequest * pParent)\r\n: CAndroidWidget(pParent)\r\n, m_prev(NULL)\r\n, m_next(NULL)\r\n, m_pFont(0)\r\n{\r\n\tm_prev = m_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tm_begin = this;\r\n\t}\r\n\tm_end = this;\r\n}\r\nCAndroidTextWidget::~CAndroidTextWidget()\r\n{\r\n\tjvalue val;\r\n\tm_pParent->callJavaMethod(val, \"textbox_destroy\", 'Z', \"I\", m_hIndex);\r\n\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tm_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tm_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool\r\nCAndroidTextWidget::create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height)\r\n{\r\n\tjvalue jval;\r\n\tint hIndex = -1;\r\n\tbool passwd = false;\r\n\tm_id = id;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\treturn false;\r\n\r\n\tcase PASSWDBOX:\r\n\t\tpasswd = true;\r\n\tcase TEXTBOX:\r\n\t\tDEBUG_PRINT(\"x:%d y:%d width:%d height:%d caption:%s passwd:%d\", x, y, width, height, caption, passwd);\r\n\t\tm_pParent->callJavaMethod(jval, \"textbox_create\", 'I', \"IIIISZ\", x, y, width, height, caption, passwd);\r\n\t\thIndex = jval.i;\r\n\t\tbreak;\r\n\t}\r\n\r\n\tDEBUG_PRINT(\"CAndroidTextWidget::create() hIndex = %d\", hIndex);\r\n\tif(hIndex < 0) return false;\r\n\r\n\treturn init(hIndex, id, x, y, width, height);\r\n}\r\n\r\nvoid\r\nCAndroidTextWidget::update()\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"textbox_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, m_x, m_y, m_width, m_height, m_bEnable, m_bVisible);\r\n\r\n}\r\n\r\nint\r\nCAndroidTextWidget::getTextLength()\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"textbox_getText\", 'S', \"I\", m_hIndex);\r\n\tjstring jstr = (jstring)jval.l;\r\n\t// GetStringLengthではバイト数ではなくてUnicode文字のカウントだけするみたいなので変更  2013/03/25   //\r\n\treturn CJNI::getJNIEnv()->GetStringUTFLength(jstr);\r\n}\r\n\r\nbool\r\nCAndroidTextWidget::getText(char * pBuf, int maxlen)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"textbox_getText\", 'S', \"I\", m_hIndex);\r\n\tconst char * str = CJNI::getJNIEnv()->GetStringUTFChars((jstring)jval.l, 0);\r\n\r\n\tint i = 0;\r\n\tfor(i = 0; str[i] && i < maxlen - 1; i++) pBuf[i] = str[i];\r\n\tpBuf[i] = 0;\r\n\r\n\tCJNI::getJNIEnv()->ReleaseStringUTFChars((jstring)jval.l, str);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCAndroidTextWidget::setText(const char * string)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"textbox_setText\", 'Z', \"IS\", m_hIndex, string);\r\n\treturn (bool)jval.z;\r\n}\r\n\r\nvoid\r\nCAndroidTextWidget::setMaxlen(int maxlen)\r\n{\r\n  jvalue jval;\r\n  m_pParent->callJavaMethod(jval, \"textbox_setMaxlen\", 'V', \"II\", m_hIndex, maxlen);\r\n}\r\n\r\n\r\nvoid\r\nCAndroidTextWidget::set_move(int x,int y,int width,int height)\r\n{\r\n\t// 非常に不本意ながらAndroidのTextEditの枠が一定以下のサイズの場合枠表示が変になってしまうため下限を設けました  2013/04/04  //\r\n\tif(height > 0)\r\n\t{\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t\tfloat heightLogical = draw.toLogical(height);\r\n//\t\tm_pParent->logging(\"height : %d  org : %f\\n\", height, heightLogical);\r\n\t\tif(heightLogical < 56)\r\n\t\t{\r\n\t\t\tint tmpHeight = draw.toPhisical(56);\r\n\t\t\tm_height = tmpHeight;\r\n//\t\t\tm_pParent->logging(\"change height : %d\\n\", tmpHeight);\r\n\t\t}\r\n\t}\r\n\t\r\n    jvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"textbox_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, m_x, m_y, m_width, m_height, m_bEnable, m_bVisible);\r\n}\r\n\r\nvoid\r\nCAndroidTextWidget::cmd(int cmd, ...)\r\n{\r\n\tva_list ap;\r\n\tva_start(ap, cmd);\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\t\tcase TX_PLACEHOLDER:\r\n\t\t{\r\n\t\t\t// プレースホルダに文字設定\r\n\t\t\tconst char * placeholder = va_arg(ap, const char *);\r\n\r\n\t\t\tjvalue jval;\r\n\t\t\tm_pParent->callJavaMethod(jval, \"textbox_sethint\", 'V', \"IS\", GetIndex(), placeholder);\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TX_FONT:\r\n\t\t{\r\n\t\t\tCAndroidFont * pFont = (CAndroidFont *)va_arg(ap, void *);\r\n\t\t\tm_pFont = pFont;\r\n\r\n\t\t\tjmethodID methodID = 0;\r\n\t\t\tjclass cls_pfif = CJNI::getJNIEnv()->FindClass(JNI_LOAD_PATH);\r\n\t\t\tmethodID = CJNI::getJNIEnv()->GetStaticMethodID(cls_pfif, \"textbox_setpaint\", \"(ILandroid/graphics/Paint;)V\");\r\n\t\t\tjint ret = CJNI::getJNIEnv()->CallStaticIntMethod(cls_pfif, methodID, GetIndex(), (jobject)m_pFont->getPaint());\r\n\t\t\tCJNI::getJNIEnv()->DeleteLocalRef(cls_pfif);\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TX_MAXLEN:\r\n\t\t{\r\n\t\t\tint maxlen = va_arg(ap, int);\r\n\t\t\tthis->setMaxlen(maxlen);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TX_CHARTYPE:\r\n\t\t{\r\n#if 0\r\n\t\t\tint chartype = va_arg(ap, int);\r\n\t\t\tm_chartype = chartype;\r\n#endif\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TX_ALIGNMENTTYPE:\r\n\t\t{\r\n\t\t\t// setup text alignment.\r\n\t\t\t// Android implements \"normal / opposite\" model instead of \"left / right\" model.\r\n\t\t\t// so, make sure to work properly with RTL languages\r\n\t\t\tint alignType = va_arg(ap, int);\r\n\t\t\tint m_alignType;\r\n\t\t\tswitch( alignType )\r\n\t\t\t{\r\n\t\t\t\tcase TX_ALIGN_LEFT:\r\n\t\t\t\t\tm_alignType = ALIGN_LEFT;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TX_ALIGN_CENTER:\r\n\t\t\t\t\tm_alignType = ALIGN_CENTER;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TX_ALIGN_RIGHT:\r\n\t\t\t\t\tm_alignType = ALIGN_RIGHT;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tm_alignType = ALIGN_LEFT;\r\n\t\t\t}\r\n\t\t\tjvalue jval;\r\n\t\t\tm_pParent->callJavaMethod(jval, \"textbox_setAlignment\", 'V', \"II\", GetIndex(), m_alignType);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault:\r\n\t\t{\r\n#if 0\r\n\t\t\tunsigned int color = va_arg(ap, unsigned int);\r\n\t\t\tswitch (cmd)\r\n\t\t\t{\r\n\t\t\t\tcase TX_BGCOLOR_NORMAL: m_cols[0] = color; break;\r\n\t\t\t\tcase TX_FGCOLOR_NORMAL: m_cols[1] = color; break;\r\n\t\t\t\tcase TX_BGCOLOR_TOUCH:  m_cols[2] = color; break;\r\n\t\t\t\tcase TX_FGCOLOR_TOUCH:  m_cols[3] = color; break;\r\n\t\t\t}\r\n\t\t\tset_color();    // カラー設定\r\n#endif\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tva_end(ap);\r\n}\r\n\r\n/////////////////////////////////////////////\r\n// CAndroidWebWidget\r\n/////////////////////////////////////////////\r\nCAndroidWebWidget\t*\tCAndroidWebWidget::m_begin = 0;\r\nCAndroidWebWidget\t*\tCAndroidWebWidget::m_end = 0;\r\nCAndroidWebWidget::CAndroidWebWidget(CAndroidRequest * pParent)\r\n: CAndroidWidget(pParent)\r\n, m_bZoom(true)\r\n, m_bgalpha(0)\r\n, m_bgcolor(0xffffff)\r\n, m_prev(NULL)\r\n, m_next(NULL)\r\n{\r\n\tm_prev = m_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tm_begin = this;\r\n\t}\r\n\tm_end = this;\r\n}\r\nCAndroidWebWidget::~CAndroidWebWidget()\r\n{\r\n\tjvalue val;\r\n\tm_pParent->callJavaMethod(val, \"webview_destroy\", 'Z', \"I\", m_hIndex);\r\n\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tm_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tm_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool\r\nCAndroidWebWidget::create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height,\r\n\t\t\t\t\t\t\tconst char * token, const char * region, const char * client,\r\n\t\t\t\t\t\t\tconst char * consumerKey, const char * applicationId, const char * userID)\r\n{\r\n\tjvalue jval;\r\n\tint hIndex = -1;\r\n\tbool nojump = false;\r\n\tm_id = id;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\treturn false;\r\n\r\n\tcase WEBNOJUMP:\r\n\t\tnojump = true;\r\n\tcase WEBVIEW:\r\n\t\tm_pParent->logging(\"WebView create!\");\r\n\t\tm_pParent->callJavaMethod(jval, \"webview_create\", 'I', \"IIIISSSSSSSZ\",\r\n\t\t\t\tx, y, width, height,\r\n\t\t\t\tcaption, token, region, client, consumerKey, applicationId, userID, nojump);\r\n\t\thIndex = jval.i;\r\n\r\n\t\t// 背景色設定\r\n\t\tm_pParent->callJavaMethod(jval, \"webview_setColor\", 'V', \"III\", hIndex, m_bgalpha, m_bgcolor);\r\n\r\n\t\t// ズーム設定\r\n\t\tm_pParent->callJavaMethod(jval, \"webview_setZoom\", 'V', \"IZ\", m_hIndex, m_bZoom);\r\n\r\n\t\tm_pParent->logging(\"Create finished.: handle = %d\", hIndex);\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif(hIndex < 0) return false;\r\n\r\n\treturn init(hIndex, id, x, y, width, height);\r\n}\r\n\r\nvoid\r\nCAndroidWebWidget::cmd(int cmd, ...)\r\n{\r\n\tva_list ap;\r\n\tva_start(ap, cmd);\r\n\tswitch (cmd) {\r\n\t\tcase WEB_SET_SCALESPAGETOFIT:\r\n\t\t{\r\n\t\t\tint pagetofit = va_arg(ap, int);\r\n\t\t\tm_bZoom = (pagetofit) ? true : false;\r\n\t\t\tjvalue jval;\r\n\t\t\tm_pParent->callJavaMethod(jval, \"webview_setZoom\", 'V', \"IZ\", m_hIndex, m_bZoom);\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tcase WEB_BGCOLOR_NORMAL:    // WebViewの背景色の設定\r\n\t\t{\r\n\t\t\tunsigned int bgalpha = va_arg(ap, unsigned int);\r\n\t\t\tunsigned int bgcolor = va_arg(ap, unsigned int);\r\n\r\n\t\t\tm_bgalpha = bgalpha;\r\n\t\t\tm_bgcolor = bgcolor;\r\n\t\t\tjvalue jval;\r\n\t\t\tm_pParent->callJavaMethod(jval, \"webview_setColor\", 'V', \"III\", m_hIndex, m_bgalpha, m_bgcolor);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid\r\nCAndroidWebWidget::update()\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, m_x, m_y, m_width, m_height, m_bEnable, m_bVisible);\r\n\r\n}\r\n\r\nint\r\nCAndroidWebWidget::getTextLength()\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_getText\", 'S', \"I\", m_hIndex);\r\n\tjstring jstr = (jstring)jval.l;\r\n\treturn CJNI::getJNIEnv()->GetStringLength(jstr);\r\n}\r\n\r\nbool\r\nCAndroidWebWidget::getText(char * pBuf, int maxlen)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_getText\", 'S', \"I\", m_hIndex);\r\n\tconst char * str = CJNI::getJNIEnv()->GetStringUTFChars((jstring)jval.l, 0);\r\n\r\n\tint i = 0;\r\n\tfor(i = 0; str[i] && i < maxlen - 1; i++) pBuf[i] = str[i];\r\n\tpBuf[i] = 0;\r\n\r\n\tCJNI::getJNIEnv()->ReleaseStringUTFChars((jstring)jval.l, str);\r\n\treturn true;\r\n}\r\n\r\nint\r\nCAndroidWebWidget::getTmpTextLength()\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_getTmpText\", 'S', \"I\", m_hIndex);\r\n\tjstring jstr = (jstring)jval.l;\r\n\r\n\treturn CJNI::getJNIEnv()->GetStringUTFLength(jstr);\r\n}\r\n\r\nbool\r\nCAndroidWebWidget::getTmpText(char * pBuf, int maxlen)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_getTmpText\", 'S', \"I\", m_hIndex);\r\n\tconst char * str = CJNI::getJNIEnv()->GetStringUTFChars((jstring)jval.l, 0);\r\n\r\n\tint i = 0;\r\n\tfor(i = 0; str[i] && i < maxlen - 1; i++) pBuf[i] = str[i];\r\n\tpBuf[i] = 0;\r\n\r\n\tCJNI::getJNIEnv()->ReleaseStringUTFChars((jstring)jval.l, str);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCAndroidWebWidget::setText(const char * string)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_setText\", 'Z', \"IS\", m_hIndex, string);\r\n\treturn (bool)jval.z;\r\n}\r\n\r\nvoid\r\nCAndroidWebWidget::set_move(int x,int y,int width,int height)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"webview_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, m_x, m_y, m_width, m_height, m_bEnable, m_bVisible);\r\n}\r\n\r\nCAndroidWebWidget*\r\nCAndroidWebWidget::get_webViewItem(jobject _obj)\r\n{\r\n\tjmethodID methodID = 0;\r\n\tjclass cls_pfif = CJNI::getJNIEnv()->FindClass(JNI_LOAD_PATH);\r\n\tmethodID = CJNI::getJNIEnv()->GetStaticMethodID(cls_pfif, \"webview_getWebViewItem\", \"(Landroid/webkit/WebView;)I\");\r\n\tjint ret = CJNI::getJNIEnv()->CallStaticIntMethod(cls_pfif, methodID, _obj);\r\n\r\n\tCAndroidWebWidget* pWeb = m_begin;\r\n\tfor( ; pWeb; pWeb = pWeb->m_next )\r\n\t{\r\n\t\tif( pWeb->m_hIndex >= 0 && pWeb->m_hIndex == (int)ret ) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(cls_pfif);\r\n\treturn pWeb;\r\n}\r\n\r\n/////////////////////////////////////////////\r\n// CAndroidMovieWidget\r\n/////////////////////////////////////////////\r\nCAndroidMovieWidget\t*\tCAndroidMovieWidget::m_begin = 0;\r\nCAndroidMovieWidget\t*\tCAndroidMovieWidget::m_end = 0;\r\nCAndroidMovieWidget::CAndroidMovieWidget(CAndroidRequest * pParent)\r\n: CAndroidWidget(pParent)\r\n, m_asset(0)\r\n, m_prev(0)\r\n, m_next(0)\r\n, m_status(0)\r\n{\r\n\tm_prev = m_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tm_begin = this;\r\n\t}\r\n\tm_end = this;\r\n}\r\nCAndroidMovieWidget::~CAndroidMovieWidget()\r\n{\r\n\tjvalue val;\r\n\tm_pParent->callJavaMethod(val, \"movieview_destroy\", 'Z', \"I\", m_hIndex);\r\n\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tm_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tm_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool\r\nCAndroidMovieWidget::create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height)\r\n{\r\n\tjvalue jval;\r\n\tint hIndex = -1;\r\n\tm_id = id;\r\n\tm_status = 0;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\treturn false;\r\n\r\n\tcase MOVIEPLAYER:\r\n\t\tm_pParent->logging(\"MovieView create!\");\r\n\t\tint len = strlen(caption);\r\n\t\tchar * buf = new char [ len + 1 ];\r\n\t\tstrcpy(buf, caption);\r\n\t\tm_asset = buf;\r\n\t\tCAndroidPathConv& pathconv = CAndroidPathConv::getInstance();\r\n\t\tconst char * fullpath = pathconv.fullpath(caption);\r\n\r\n\t\tm_pParent->callJavaMethod(jval, \"movieview_create\", 'I', \"IIIISZ\",\r\n\t\t\t\tx, y, width, height, fullpath, true);\r\n\t\thIndex = jval.i;\r\n\t\tm_pParent->logging(\"Create finished.: handle = %d\", hIndex);\r\n\t\tbreak;\r\n\t}\r\n\tif(hIndex < 0) return false;\r\n\treturn init(hIndex, id, x, y, width, height);\r\n}\r\n\r\nvoid\r\nCAndroidMovieWidget::update()\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"movieview_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, m_x, m_y, m_width, m_height, m_bEnable, m_bVisible);\r\n\r\n}\r\n\r\nint\r\nCAndroidMovieWidget::getTextLength()\r\n{\r\n\tint len = strlen(m_asset);\r\n\treturn len;\r\n}\r\n\r\nbool\r\nCAndroidMovieWidget::getText(char * pBuf, int maxlen)\r\n{\r\n\tint i = 0;\r\n\tfor(i = 0; m_asset[i] && i < maxlen - 1; i++) pBuf[i] = m_asset[i];\r\n\tpBuf[i] = 0;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCAndroidMovieWidget::setText(const char * string)\r\n{\r\n\tint len = strlen(string);\r\n\tchar * buf = new char [ len + 1 ];\r\n\tif(!buf) return false;\r\n\tstrcpy(buf, string);\r\n\tif(m_asset) delete [] m_asset;\r\n\tm_asset = buf;\r\n\r\n\tCAndroidPathConv& pathconv = CAndroidPathConv::getInstance();\r\n\tconst char * fullpath = pathconv.fullpath(string);\r\n\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"movieview_setText\", 'Z', \"IS\", m_hIndex, fullpath);\r\n\treturn (bool)jval.z;\r\n}\r\n\r\nvoid\r\nCAndroidMovieWidget::cmd(int cmd, ...)\r\n{\r\n\tjvalue jval;\r\n\tif(cmd == IWidget::MV_PLAY) m_status = 0;\r\n\tm_pParent->callJavaMethod(jval, \"movieview_cmd\", 'V', \"II\", m_hIndex, cmd);\r\n}\r\n\r\nCAndroidMovieWidget *\r\nCAndroidMovieWidget::getWidget(int index)\r\n{\r\n\tCAndroidMovieWidget * pWidget = m_begin;\r\n\twhile(pWidget) {\r\n\t\tif(pWidget->m_hIndex == index) break;\r\n\t\tpWidget = pWidget->m_next;\r\n\t}\r\n\treturn pWidget;\r\n}\r\n\r\nint\r\nCAndroidMovieWidget::status()\r\n{\r\n\treturn m_status;\r\n}\r\n\r\n\r\nvoid\r\nCAndroidMovieWidget::set_move(int x,int y,int width,int height)\r\n{\r\n\tjvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"movieview_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, m_x, m_y, m_width, m_height, m_bEnable, m_bVisible);\r\n}\r\n\r\n\r\nCAndroidActivityIndicator\t*\tCAndroidActivityIndicator::m_begin = 0;\r\nCAndroidActivityIndicator\t*\tCAndroidActivityIndicator::m_end = 0;\r\n\r\nCAndroidActivityIndicator::CAndroidActivityIndicator(CAndroidRequest * pParent)\r\n: CAndroidWidget(pParent), m_prev(0), m_next(0)\r\n{\r\n    m_bVisible = false;\r\n    m_status = 0;\r\n    m_size = 0.0f;\r\n\r\n\tm_prev = m_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tm_begin = this;\r\n\t}\r\n\tm_end = this;\r\n}\r\nCAndroidActivityIndicator::~CAndroidActivityIndicator()\r\n{\r\n    jvalue jval;\r\n    m_pParent->callJavaMethod(jval, \"indicator_destroy\", 'Z', \"I\",0);\r\n\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tm_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tm_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool\r\nCAndroidActivityIndicator::create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height)\r\n{\r\n\tjvalue jval;\r\n\tint hIndex = -1;\r\n\tm_id = id;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\treturn false;\r\n\r\n\tcase ACTIVITYINDICATOR:\r\n\t\tm_pParent->logging(\"Indicator create!\");\r\n\r\n        m_pParent->callJavaMethod(jval, \"indicator_create\", 'I', \"IIIIZ\",x, y, width, height, true);\r\n\t\tm_pParent->logging(\"Indicator Create finished.\");\r\n\t\tbreak;\r\n\t}\r\n\treturn init(hIndex, id, x, y, width, height);\r\n}\r\n\r\nvoid\r\nCAndroidActivityIndicator::set_move(int x, int y, int width, int height)\r\n{\r\n\tm_pParent->logging(\"Indicator set move\");\r\n    jvalue jval;\r\n\tm_pParent->callJavaMethod(jval, \"indicator_update\", 'V', \"IIIIIZZ\",\r\n\t\t\t\t\t\t\tm_hIndex, x, y, width, height, m_bEnable, m_bVisible);\r\n}\r\n\r\nvoid\r\nCAndroidActivityIndicator::update()\r\n{\r\n}\r\n\r\nint\r\nCAndroidActivityIndicator::getTextLength()\r\n{\r\n\treturn 0;\r\n}\r\n\r\nbool\r\nCAndroidActivityIndicator::getText(char * pBuf, int maxlen)\r\n{\r\n\tpBuf[0] = 0;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCAndroidActivityIndicator::setText(const char * string)\r\n{\r\n\treturn (bool)true;\r\n}\r\n\r\nvoid\r\nCAndroidActivityIndicator::cmd(int cmd, ...)\r\n{\r\n\tm_pParent->logging(\"Indicator cmd\");\r\n\r\n    va_list ap;\r\n    va_start(ap,cmd);\r\n    switch( cmd )\r\n    {\r\n    case ACT_STARTANIM:\r\n    case ACT_STOPANIM:\r\n    default:\r\n        break;\r\n\r\n    case ACT_SET_STYLE:\r\n        {\r\n            int style = va_arg(ap,int);\r\n            m_size = 21.0f;\r\n            switch( style )\r\n            {\r\n            case 0:\r\n            case 1:\r\n            case 2:\r\n                m_size = 36.0f;\r\n                break;\r\n            default:\r\n                break;\r\n            }\r\n        }\r\n        break;\r\n    }\r\n\r\n    va_end(ap);\r\n\r\n}\r\n\r\nint\r\nCAndroidActivityIndicator::status()\r\n{\r\n\treturn 0;\r\n}\r\n\r\nvoid\r\nCAndroidActivityIndicator::visible(bool bVisible)\r\n{\r\n\tm_pParent->logging(\"Indicator visible\");\r\n    //    m_bVisible = bVisible;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidWidget.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CAndroidWidget_h\r\n#define CAndroidWidget_h\r\n\r\n#include \"CAndroidRequest.h\"\r\n#include \"CAndroidFont.h\"\r\n#include \"OSWidget.h\"\r\n#include \"jni.h\"\r\n\r\nclass CAndroidRequest;\r\n\r\nclass CAndroidWidget : public IWidget\r\n{\r\n\tfriend class CAndroidRequest;\r\nprotected:\r\n\tCAndroidWidget(CAndroidRequest * pRequest);\r\n\tvirtual ~CAndroidWidget();\r\n\r\npublic:\r\n\tvirtual int getTextLength() = 0;\r\n\tvirtual bool getText(char * pBuf, int maxlen) = 0;\r\n\tvirtual bool setText(const char * string) = 0;\r\n\r\n\tvirtual void move(int x, int y);\r\n\tvirtual void resize(int width, int height);\r\n\tvirtual void visible(bool bVisible);\r\n\tvirtual void enable(bool bEnable);\r\n\r\n\tvirtual void cmd(int cmd, ...);\r\n\tvirtual int status();\r\n\r\n\tinline int GetIndex() { return m_hIndex; }\r\n\r\nprotected:\r\n\tbool init(int hIndex, int id, int x, int y, int width, int height);\r\n\tvirtual void update() = 0;\r\n\r\n    virtual void set_move(int x,int y,int width,int height) = 0;\r\n\r\n\tint\t\t\t\tm_hIndex;\r\n\tint\t\t\t\tm_x;\r\n\tint\t\t\t\tm_y;\r\n\tint\t\t\t\tm_width;\r\n\tint\t\t\t\tm_height;\r\n\tint\t\t\t\tm_id;\r\n\r\n\tbool\t\t\tm_bEnable;\r\n\tbool\t\t\tm_bVisible;\r\n\r\n\tCAndroidRequest\t*\tm_pParent;\r\n};\r\n\r\nclass CAndroidTextWidget : public CAndroidWidget\r\n{\r\n\tfriend class CAndroidRequest;\r\nprivate:\r\n\tCAndroidTextWidget(CAndroidRequest * pParent);\r\n\tvirtual ~CAndroidTextWidget();\r\npublic:\r\n\tint getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\tvoid setMaxlen(int maxlen);\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\tint x, int y, int width, int height);\r\n\r\n\tvoid cmd(int cmd, ...);\r\nprivate:\r\n\tvoid update();\r\n    void set_move(int x,int y,int width,int height);\r\n\r\n    CAndroidTextWidget\t*\tm_prev;\r\n    CAndroidTextWidget\t*\tm_next;\r\n\r\n\tstatic CAndroidTextWidget\t*\tm_begin;\r\n\tstatic CAndroidTextWidget\t*\tm_end;\r\n\r\n    CAndroidFont*\tm_pFont;\r\n\tenum {\r\n\t\tALIGN_LEFT,\r\n\t\tALIGN_CENTER,\r\n\t\tALIGN_RIGHT\r\n\t};\r\n};\r\n\r\nclass CAndroidWebWidget : public CAndroidWidget\r\n{\r\n\tfriend class CAndroidRequest;\r\nprivate:\r\n\tCAndroidWebWidget(CAndroidRequest * pParent);\r\n\tvirtual ~CAndroidWebWidget();\r\npublic:\r\n\tint getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tint getTmpTextLength();\r\n\tbool getTmpText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\tint x, int y, int width, int height,\r\n\t\t\t\t\tconst char * token, const char * region, const char * client,\r\n\t\t\t\t\tconst char * consumerKey, const char * applicationId, const char * userID);\r\n\r\n\tvoid cmd(int cmd, ...);\r\n\r\n\tstatic CAndroidWebWidget* get_webViewItem(jobject _obj);\r\nprivate:\r\n\tvoid update();\r\n    void set_move(int x,int y,int width,int height);\r\n\r\n    bool\t\t\tm_bZoom;\t\t// ズームの可否\r\n    unsigned int    m_bgalpha;      // 背景色のアルファ値\r\n    unsigned int    m_bgcolor;      // 背景色\r\n\r\n    CAndroidWebWidget\t*\tm_prev;\r\n    CAndroidWebWidget\t*\tm_next;\r\n\r\n    static CAndroidWebWidget\t*\tm_begin;\r\n   \tstatic CAndroidWebWidget\t*\tm_end;\r\n};\r\n\r\nclass CAndroidMovieWidget : public CAndroidWidget\r\n{\r\n\tfriend class CAndroidRequest;\r\nprivate:\r\n\tCAndroidMovieWidget(CAndroidRequest * pParent);\r\n\tvirtual ~CAndroidMovieWidget();\r\npublic:\r\n\tint getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\tint x, int y, int width, int height);\r\n\r\n\tvoid cmd(int cmd, ...);\r\n\tint status();\r\n\r\n\tstatic CAndroidMovieWidget * getWidget(int index);\r\n\r\nprivate:\r\n\tvoid update();\r\n    void set_move(int x,int y,int width,int height);\r\n\r\n\tconst char\t\t\t*\tm_asset;\r\n\tint\t\t\t\t\t\tm_status;\r\n\tCAndroidMovieWidget\t*\tm_prev;\r\n\tCAndroidMovieWidget\t*\tm_next;\r\n\r\n\tstatic CAndroidMovieWidget\t*\tm_begin;\r\n\tstatic CAndroidMovieWidget\t*\tm_end;\r\n};\r\n\r\nclass CAndroidActivityIndicator : public CAndroidWidget\r\n{\r\n\tfriend class CAndroidRequest;\r\nprivate:\r\n\tCAndroidActivityIndicator(CAndroidRequest * pParent);\r\n\tvirtual ~CAndroidActivityIndicator();\r\npublic:\r\n\tint getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\tint x, int y, int width, int height);\r\n\r\n\tvoid cmd(int cmd, ...);\r\n\tint status();\r\n\r\n    void visible(bool bVisible);\r\n\r\nprivate:\r\n\tvoid set_move(int x, int y, int width, int height);\r\n    void update();\r\n\r\n    bool  m_bVisible;\r\n    int   m_status;\r\n    float m_size;\r\n\r\n\tCAndroidActivityIndicator\t*\tm_prev;\r\n\tCAndroidActivityIndicator\t*\tm_next;\r\n\r\n\tstatic CAndroidActivityIndicator\t*\tm_begin;\r\n\tstatic CAndroidActivityIndicator\t*\tm_end;\r\n\r\n};\r\n#endif // CAndroidWidget_h\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidWriteFileStream.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CAndroidWriteFileStream.cpp\r\n//\r\n//\r\n#include <fcntl.h>\r\n#include <sys/types.h> \r\n#include <sys/stat.h> \r\n#include <unistd.h>\r\n#include <stdio.h>\r\n\r\n#include \"CAndroidWriteFileStream.h\"\r\n#include \"CAndroidReadFileStream.h\"\r\n\r\n\r\nCAndroidWriteFileStream::CAndroidWriteFileStream(CAndroidReadFileStream& rdStream) : m_fd(-1), m_fp(0), m_eStat(CLOSED)\r\n{\r\n    if(rdStream.m_fp && rdStream.m_eStat == IReadStream::NORMAL) {\r\n        fclose(rdStream.m_fp);\r\n        rdStream.m_fp = 0;\r\n        rdStream.m_fd = -1;\r\n    }\r\n    \r\n    if(0 > (m_fd = open(rdStream.m_fullpath, O_CREAT|O_RDWR))) return;\r\n    m_fp = fdopen(m_fd, \"r+b\");\r\n    if(!m_fp) {\r\n        close(m_fd);\r\n        m_fd = -1;\r\n        return;\r\n    }\r\n    rdStream.m_fd = m_fd;\r\n    rdStream.m_fp = m_fp;    \r\n    m_eStat = NORMAL;\r\n}\r\n\r\n// 必ず ReadStream 経由で破棄されるため、こちらではクローズしない\r\nCAndroidWriteFileStream::~CAndroidWriteFileStream() {}\r\n\r\nIWriteStream::ESTATUS\r\nCAndroidWriteFileStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\ns32\r\nCAndroidWriteFileStream::getPosition()\r\n{\r\n    m_eStat = NORMAL;\r\n    return ftell(m_fp);\r\n}\r\n\r\nvoid\r\nCAndroidWriteFileStream::writeU8(u8 value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(EOF == fputc(value, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCAndroidWriteFileStream::writeU16(u16 value)\r\n{\r\n    u8 arr[2];\r\n    m_eStat = NORMAL;\r\n    arr[0] = (value >> 8) & 0xff;\r\n    arr[1] = value & 0xff;\r\n    if(1 > fwrite(arr, 2, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCAndroidWriteFileStream::writeU32(u32 value)\r\n{\r\n    u8 arr[4];\r\n    m_eStat = NORMAL;\r\n    arr[0] = (value >> 24) & 0xff;\r\n    arr[1] = (value >> 16) & 0xff;\r\n    arr[2] = (value >> 8) & 0xff;\r\n    arr[3] = value & 0xff;\r\n    if(1 > fwrite(arr, 4, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCAndroidWriteFileStream::writeFloat(float fval)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(1 > fwrite(&fval, sizeof(float), 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCAndroidWriteFileStream::writeBlock(void* buffer, u32 byteSize)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(1 > fwrite(buffer, byteSize, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CAndroidWriteFileStream.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWriteFileStream.h\r\n//\r\n//\r\n\r\n#ifndef CAndroidWriteFileStream_h\r\n#define CAndroidWriteFileStream_h\r\n\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CAndroidReadFileStream;\r\n\r\nclass CAndroidWriteFileStream : public IWriteStream\r\n{\r\n    friend class CAndroidReadFileStream;\r\nprivate:\r\n    CAndroidWriteFileStream(CAndroidReadFileStream& rdStream);\r\n    virtual ~CAndroidWriteFileStream();\r\n    \r\npublic:\r\n    ESTATUS\tgetStatus();\r\n\ts32\tgetPosition();\r\n\tvoid writeU8(u8 value);\t// Use cast to support s8\r\n\tvoid writeU16(u16 value);\t// Use cast to support s16\r\n\tvoid writeU32(u32 value);\t// Use cast to support s32\r\n\tvoid writeFloat(float);\r\n\tvoid writeBlock(void* buffer, u32 byteSize);\r\n    \r\nprivate:\r\n    int         m_fd;\r\n    FILE    *   m_fp;\r\n    \r\n    ESTATUS     m_eStat;\r\n};\r\n\r\n#endif // CAndroidWriteFileStream_h\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CJNI.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n * CJNI.cpp\r\n *\r\n */\r\n#include \"CJNI.h\"\r\n#include <cstddef>\r\n#include <jni.h>\r\n#include <android/log.h>\r\n\r\nJNIEnv * CJNI::p_jniEnv = NULL;\r\nJavaVM * CJNI::p_javaVM = NULL;\r\n\r\nvoid\r\nCJNI::setJavaVM(JavaVM* vm)\r\n{\r\n\tp_javaVM = vm;\r\n}\r\n\r\nJNIEnv *\r\nCJNI::setJNIEnv(JNIEnv * pEnv)\r\n{\r\n\tp_jniEnv = pEnv;\r\n\treturn p_jniEnv;\r\n}\r\n\r\nJNIEnv *\r\nCJNI::getJNIEnv()\r\n{\r\n\tif (p_javaVM != NULL) {\r\n\t\tJNIEnv *env;\r\n\t\tjint ret = p_javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);\r\n\t\tif(ret != JNI_OK) {\r\n\t\t\treturn  NULL;\r\n\t\t}\r\n\t\treturn env;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nJNIEnv *\r\nCJNI::attachJNIEnv()\r\n{\r\n\tif (p_javaVM != NULL) {\r\n\t\tJNIEnv *env;\r\n\t\tjint ret = p_javaVM->AttachCurrentThread(&env, NULL);\r\n\t\tif(ret != JNI_OK) {\r\n\t\t\treturn  NULL;\r\n\t\t}\r\n\t\treturn env;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid\r\nCJNI::detachJNIEnv()\r\n{\r\n\tif (p_javaVM != NULL) {\r\n\t\tp_javaVM->DetachCurrentThread();\r\n\t}\r\n}\r\n\r\nvoid\r\nCJNI::exceptionOccurred()\r\n{\r\n\tjthrowable throwObj;\r\n\tthrowObj = p_jniEnv->ExceptionOccurred();\r\n\tif(throwObj) {\r\n\t\tp_jniEnv->ExceptionDescribe();\r\n\t\tp_jniEnv->ExceptionClear();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CJNI.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n ¥brief\tJNI環境のラッピング基底クラス\r\n ¥file\tCJNI.h\r\n */\r\n#ifndef CJNI_h\r\n#define CJNI_h\r\n\r\n#include <jni.h>\r\n\r\nclass CJNI\r\n{\r\nprivate:\r\n\tstatic JNIEnv\t* p_jniEnv;\r\n\tstatic JavaVM   * p_javaVM;\r\nprotected:\r\n\tinline JNIEnv * getEnv() { return p_jniEnv; }\r\n\tvoid exceptionOccurred();\r\npublic:\r\n\tstatic void setJavaVM(JavaVM* vm);\r\n\tstatic JNIEnv * setJNIEnv(JNIEnv * pEnv);\r\n\tstatic JNIEnv * getJNIEnv();\r\n\tstatic JNIEnv * attachJNIEnv();\r\n\tstatic void detachJNIEnv();\r\n};\r\n\r\n#endif /* CJNI_h */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CMediaPlayer.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n * CMediaPlayer.cpp\r\n *\r\n */\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CMediaPlayer.h\"\r\n\r\nCMediaPlayer::CMediaPlayer()\r\n{\r\n\tjclass local_mp = getEnv()->FindClass(\"android/media/MediaPlayer\");\r\n\r\n\tjmethodID cns = getEnv()->GetMethodID(local_mp, \"<init>\", \"()V\");\r\n\tjobject local_obj = getEnv()->NewObject(local_mp, cns);\t// C++からアクセスするためのインスタンス作成\r\n\tm_obj = getEnv()->NewGlobalRef(local_obj);\r\n\r\n\t// サポートするメソッドのメソッドIDを取得しておく\r\n\tm_setDataSource = getEnv()->GetMethodID(local_mp, \"setDataSource\", \"(Ljava/io/FileDescriptor;)V\");\r\n\r\n\tm_prepare\t\t= getEnv()->GetMethodID(local_mp, \"prepare\", \"()V\");\r\n\tm_start\t\t\t= getEnv()->GetMethodID(local_mp, \"start\", \"()V\");\r\n\tm_stop\t\t\t= getEnv()->GetMethodID(local_mp, \"stop\", \"()V\");\r\n\tm_pause\t\t\t= getEnv()->GetMethodID(local_mp, \"pause\", \"()V\");\r\n\tm_release\t\t= getEnv()->GetMethodID(local_mp, \"release\", \"()V\");\r\n\tm_reset\t\t\t= getEnv()->GetMethodID(local_mp, \"reset\", \"()V\");\r\n\tm_getCurrentPos = getEnv()->GetMethodID(local_mp, \"getCurrentPosition\", \"()I\");\r\n\r\n\tm_isLooping\t\t= getEnv()->GetMethodID(local_mp, \"isLooping\", \"()Z\");\r\n\tm_isPlaying\t\t= getEnv()->GetMethodID(local_mp, \"isPlaying\", \"()Z\");\r\n\tm_setLooping\t= getEnv()->GetMethodID(local_mp, \"setLooping\", \"(Z)V\");\r\n\tm_setVolume\t\t= getEnv()->GetMethodID(local_mp, \"setVolume\", \"(FF)V\");\r\n\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(local_mp);\r\n\t//CJNI::getJNIEnv()->DeleteLocalRef(cns);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(local_obj);\r\n}\r\n\r\nCMediaPlayer::~CMediaPlayer()\r\n{\r\n\tstop();\r\n\trelease();\r\n\tgetEnv()->DeleteGlobalRef(m_obj);\r\n}\r\n\r\nvoid\r\nCMediaPlayer::setDataSource(const char * path)\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::setDataSource() in ... m_obj = %p\", m_obj);\r\n\tjstring jpath = getEnv()->NewStringUTF(path);\r\n\r\n\t//\r\n\tjclass local_fs = getEnv()->FindClass(\"java/io/FileInputStream\");\r\n\tjmethodID cns = getEnv()->GetMethodID(local_fs, \"<init>\", \"(Ljava/lang/String;)V\");\r\n\tjobject local_obj = getEnv()->NewObject(local_fs, cns, jpath);\t// C++からアクセスするためのインスタンス作成\r\n\tjobject global_obj = getEnv()->NewGlobalRef(local_obj);\r\n\tjmethodID getFD = getEnv()->GetMethodID(local_fs, \"getFD\", \"()Ljava/io/FileDescriptor;\");\r\n\r\n\tgetEnv()->CallVoidMethod( m_obj,\r\n\t\t\t\t\t\t\t  m_setDataSource,\r\n\t\t\t                  getEnv()->CallObjectMethod(global_obj, getFD) );\r\n\r\n\tgetEnv()->DeleteGlobalRef(global_obj);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(local_fs);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(local_obj);\r\n\tCJNI::getJNIEnv()->DeleteLocalRef(jpath);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::setDataSource(): path = %s\", path);\r\n}\r\n\r\nvoid\r\nCMediaPlayer::prepare()\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::prepare() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_prepare);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::prepare() exit.\");\r\n}\r\n\r\nvoid\r\nCMediaPlayer::start()\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::start() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_start);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::start() exit.\");\r\n}\r\n\r\nvoid\r\nCMediaPlayer::stop()\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::stop() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_stop);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::stop() exit.\");\r\n}\r\n\r\nvoid\r\nCMediaPlayer::pause()\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::pause() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_pause);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::pause() exit.\");\r\n}\r\n\r\nvoid\r\nCMediaPlayer::release()\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::release() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_release);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::release() exit.\");\r\n}\r\n\r\nvoid\r\nCMediaPlayer::reset()\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::reset() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_reset);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::reset() exit.\");\r\n}\r\n\r\ns32\r\nCMediaPlayer::getCurrentPos()\r\n{\r\n\ts32 ret = 0;\r\n\r\n\tDEBUG_PRINT(\"CMediaPlayer::getCurrentPos() in...\");\r\n\tret = getEnv()->CallIntMethod(m_obj, m_getCurrentPos);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::getCurrentPos() exit.\");\r\n\r\n\treturn ret;\r\n}\r\n\r\nbool\r\nCMediaPlayer::isLooping()\r\n{\r\n\tjboolean result = getEnv()->CallBooleanMethod(m_obj, m_isLooping);\r\n\texceptionOccurred();\r\n\treturn (result) ? true : false;\r\n}\r\n\r\nbool\r\nCMediaPlayer::isPlaying()\r\n{\r\n\tjboolean result = getEnv()->CallBooleanMethod(m_obj, m_isPlaying);\r\n\texceptionOccurred();\r\n\treturn (result) ? true : false;\r\n}\r\n\r\nvoid\r\nCMediaPlayer::setLooping(bool looping)\r\n{\r\n\tDEBUG_PRINT(\"CMediaPlayer::setLooping() in...\");\r\n\tgetEnv()->CallVoidMethod(m_obj, m_setLooping, (jboolean)looping);\r\n\texceptionOccurred();\r\n\tDEBUG_PRINT(\"CMediaPlayer::setLooping() exit.\");\r\n}\r\n\r\nvoid\r\nCMediaPlayer::setVolume(float leftVolume, float rightVolume)\r\n{\r\n\tgetEnv()->CallVoidMethod(m_obj, m_setVolume, leftVolume, rightVolume);\r\n\texceptionOccurred();\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CMediaPlayer.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n ¥brief Android SDK の android.media.MediaPlayer クラスをC++から使うためのサブセットラッピング\r\n */\r\n#ifndef CMediaPlayer_h\r\n#define CMediaPlayer_h\r\n\r\n#include <jni.h>\r\n#include \"CJNI.h\"\r\n\r\nclass CMediaPlayer : public CJNI\r\n{\r\nprivate:\r\n\tjclass\t\t\tm_mp;\r\n\tjobject\t\t\tm_obj;\r\n\r\n\tjmethodID\t\tm_setDataSource;\r\n\tjmethodID\t\tm_prepare;\r\n\tjmethodID\t\tm_start;\r\n\tjmethodID\t\tm_stop;\r\n\tjmethodID\t\tm_pause;\r\n\tjmethodID\t\tm_release;\r\n\tjmethodID\t\tm_reset;\r\n\tjmethodID\t\tm_isLooping;\r\n\tjmethodID\t\tm_isPlaying;\r\n\tjmethodID\t\tm_setLooping;\r\n\tjmethodID\t\tm_setVolume;\r\n\tjmethodID\t\tm_getCurrentPos;\r\n\r\n\tjobject\t\t\tm_fileDescriptorObj;\r\n\tjmethodID\t\tm_fileDescriptorFunc;\r\n\tjmethodID\t\tm_getFDFunc;\r\npublic:\r\n\tCMediaPlayer();\r\n\tvirtual ~CMediaPlayer();\r\n\r\n\tvoid setDataSource(const char * path);\r\n\tvoid prepare();\r\n\tvoid start();\r\n\tvoid stop();\r\n\tvoid pause();\r\n\tvoid release();\r\n\tvoid reset();\r\n\ts32  getCurrentPos();\r\n\tbool isLooping();\r\n\tbool isPlaying();\r\n\tvoid setLooping(bool looping);\r\n\tvoid setVolume(float leftVolume, float rightVolume);\r\n};\r\n#endif /* CMediaPlayer_h */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CSockReadStream.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockReadStream.cpp\r\n//\r\n//\r\n#include <sys/types.h>\r\n#include <sys/socket.h>\r\n#include <netinet/in.h>\r\n#include <arpa/inet.h>\r\n#include <fcntl.h>\r\n#include <sys/ioctl.h>\r\n#include <netdb.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <errno.h>\r\n// #include <iostream>\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CSockReadStream.h\"\r\n#include \"CSockWriteStream.h\"\r\n\r\nCSockReadStream::CSockReadStream() : m_writeStream(0), m_eStat(NORMAL), m_fd(0), m_lastPos(0), m_getPos(0) {}\r\nCSockReadStream::~CSockReadStream()\r\n{\r\n    // 生成時に作成した書き込み用ストリームオブジェクトを破棄\r\n    if(m_writeStream) delete m_writeStream;\r\n    // 破棄時にソケットをクローズする\r\n    if(m_fd) close(m_fd);    \r\n}\r\n\r\n/*!\r\n ¥param  hostname   IPアドレス表記またはFQDN表記のホスト指定\r\n ¥param  port       接続する TCP/IP の port 番号\r\n\r\n ¥return 接続成功ならば true, 失敗すれば false\r\n */\r\nint\r\nCSockReadStream::sock_connect(const char *hostname, int port)\r\n{\r\n    int dstSocket;\r\n    struct sockaddr_in dstAddr;\r\n\r\n    m_fd = 0;\r\n    memset(&dstAddr, 0, sizeof(dstAddr));\r\n    dstAddr.sin_port = htons(port);\r\n    dstAddr.sin_family = AF_INET;\r\n    dstAddr.sin_addr.s_addr = inet_addr(hostname);\r\n\r\n    if(dstAddr.sin_addr.s_addr == 0xffffffff) {\r\n        struct hostent *host;\r\n        host = gethostbyname(hostname);\r\n        if(!host) {\r\n        \tDEBUG_PRINT(\"CSockReadStream::gethostbyname() failed.\");\r\n        \treturn -1;\r\n        }\r\n        dstAddr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0];\r\n    }\r\n    dstSocket = socket(AF_INET, SOCK_STREAM, 0);\r\n\r\n    if(dstSocket < 0) {\r\n    \tDEBUG_PRINT(\"bad socket.(%d) errno=%d\", dstSocket, errno);\r\n    \treturn -1;\r\n    }\r\n\r\n    if(0 > connect(dstSocket, (struct sockaddr *)&dstAddr, sizeof(dstAddr))) {\r\n    \tDEBUG_PRINT(\"could not connect()\");\r\n    \tclose(dstSocket);\r\n    \treturn -1;\r\n    }\r\n\r\n    // 取得したディスクリプタは、ノンブロックモードにて運用する。\r\n    int flags = fcntl(dstSocket, F_GETFL, 0);\r\n    fcntl(dstSocket, F_SETFL, flags | O_NONBLOCK);\r\n\r\n    return dstSocket;\r\n}\r\n\r\nbool\r\nCSockReadStream::setStatus()\r\n{\r\n    switch(errno)\r\n    {\r\n        default:\r\n        \tm_eStat = CLOSED;\r\n        \tif(m_fd > 0) {\r\n        \t\tclose(m_fd);\r\n        \t\tm_fd = 0;\r\n        \t}\r\n            break;\r\n        case EAGAIN:\r\n            m_eStat = NOT_AVAILABLE;\r\n            break;\r\n        case ETIMEDOUT:\r\n            m_eStat = CLOSED;\r\n            if(m_fd > 0) {\r\n                close(m_fd);\r\n                m_fd = 0;\r\n            }\r\n            DEBUG_PRINT(\"errno = ETIMEDOUT\");\r\n            break;\r\n    }\r\n    return false;   // 必ず false を返す\r\n}\r\n/*!\r\n ¥return  リングバッファ読み込みが正常終了していれば true, 失敗ならば false\r\n \r\n 受信データをリングバッファに蓄積します。\r\n */\r\nbool\r\nCSockReadStream::readRingBuf()\r\n{\r\n    if((m_lastPos > m_getPos) && (m_lastPos < READ_BUFSIZ)) {\r\n        int result = read(m_fd, m_readBuf + m_lastPos, READ_BUFSIZ - m_lastPos);\r\n        if(result < 0) return false;\r\n        m_lastPos += result;\r\n    }\r\n    if((m_lastPos == READ_BUFSIZ) && (m_getPos > 0)) {\r\n        int result = read(m_fd, m_readBuf, m_getPos);\r\n        if(result < 0) return false;\r\n        if(result > 0) m_lastPos = result;\r\n    } else if(m_lastPos < m_getPos) {\r\n        int result = read(m_fd, m_readBuf + m_lastPos, m_getPos - m_lastPos);\r\n        if(result < 0) return false;\r\n        m_lastPos += result;\r\n    } else if(m_getPos == 0 && m_lastPos == 0) {\r\n        // バッファが完全に空の状態\r\n        int result = read(m_fd, m_readBuf, READ_BUFSIZ);\r\n        if(result < 0) return false;\r\n        m_lastPos += result;\r\n    }\r\n    return true;\r\n}\r\n\r\n\r\n/*!\r\n ¥param buf     データを受け取るバッファ\r\n ¥param size    要求サイズ\r\n\r\n 読み込みバッファを経由して、指定サイズのデータを取得する。\r\n ネットワークの読み込みが追いつかない場合、読み込みポインタが更新されない。\r\n */\r\nbool\r\nCSockReadStream::requestData(unsigned char * buf, size_t reqSize)\r\n{\r\n    // 最初にステータスを NORMAL にする。途中で問題があれば書きかわる。\r\n    // 正常系を通れば問題なくNORMALを維持できる。\r\n    m_eStat = NORMAL;\r\n\r\n    // リングバッファへの読み込みを試みる。\r\n    if(!readRingBuf())\r\n    {\r\n        setStatus();\r\n    }\r\n\r\n    // リングバッファの残りサイズが要求サイズ以上であるか確認し、サイズが足りなければ false を返す。\r\n    size_t leftSize = left_size();\r\n    if( !reqSize || leftSize < reqSize)\r\n    {\r\n        // m_eStat = NOT_AVAILABLE;\r\n        return false;\r\n    }\r\n    // リングバッファから指定のバッファに指定サイズを転送する\r\n    int rdsiz = ((READ_BUFSIZ - m_getPos) >= reqSize) ? reqSize : (READ_BUFSIZ - m_getPos);\r\n    memcpy(buf, m_readBuf + m_getPos, rdsiz);\r\n    m_getPos += rdsiz;\r\n    if(m_getPos == READ_BUFSIZ) {\r\n    \tm_getPos = 0;\r\n    \tif(m_lastPos==READ_BUFSIZ) m_lastPos = 0;\r\n    }\r\n    \r\n    if(0 < (reqSize - rdsiz)) {\r\n        memcpy(buf + rdsiz, m_readBuf, reqSize - rdsiz);\r\n        m_getPos += reqSize - rdsiz;\r\n    }\r\n\r\n    // 読み込み済みデータに追いついたら、一旦バッファを仕切り直す。\r\n    if(m_lastPos == m_getPos) m_lastPos = m_getPos = 0;\r\n    \r\n    return true;\r\n}\r\n\r\nCSockReadStream *\r\nCSockReadStream::openStream(const char * sockName)\r\n{\r\n    CSockReadStream * pStream = 0;\r\n\r\n    pStream = new CSockReadStream();\r\n\r\n    // 渡されたホスト:portを分解する\r\n    char * strHost = 0;\r\n    char * strPort = 0;\r\n\r\n    for(int i = 0; sockName[i]; i++) {\r\n    \tif(sockName[i] == ':') {\r\n    \t\tstrHost = new char [ i + 1 ];\r\n    \t\tstrncpy(strHost, sockName, i);\r\n    \t\tstrHost[i] = 0;\r\n    \t\tint plen = strlen(sockName + i + 1);\r\n    \t\tstrPort = new char [ plen + 1 ];\r\n            strcpy(strPort, sockName + i + 1);\r\n            break;\r\n    \t}\r\n    }\r\n    if(!strHost || !strPort) {\r\n    \t// 与えられた名称の書式が不正\r\n    \tpStream->m_eStat = NOT_FOUND;\r\n    \tDEBUG_PRINT(\"CSockReadStream::bad url.\");\r\n    \tif( strPort )\r\n    \t{\r\n    \t\tdelete [] strPort;\r\n    \t\tstrPort = NULL;\r\n    \t}\r\n    \tif( strHost )\r\n    \t{\r\n    \t\tdelete [] strHost;\r\n    \t\tstrHost = NULL;\r\n    \t}\r\n    \treturn pStream;\r\n    }\r\n\r\n\r\n    // port を数値に変換する。\r\n    // 数列であることを確認。\r\n    for(int i = 0; strPort[i]; i++) {\r\n    \tif(strPort[i] < '0' || strPort[i] > '9') {\r\n\t \t    // 数字以外が含まれている場合は接続先指定として不正\r\n    \t\tpStream->m_eStat = NOT_FOUND;\r\n        \tDEBUG_PRINT(\"CSockReadStream::bad port.\");\r\n            if( strPort )\r\n            {\r\n                delete [] strPort;\r\n                strPort = NULL;\r\n            }\r\n            if( strHost )\r\n            {\r\n                delete [] strHost;\r\n                strHost = NULL;\r\n            }\r\n\t\t    return pStream;\r\n\t    }\r\n    }\r\n\r\n    // 特に問題ないので、port を数値に変換する\r\n    int port = atoi(strPort);\r\n\r\n    // 接続を試みる\r\n    int fd = pStream->sock_connect(strHost, port);\r\n\r\n    if(fd < 0) {\r\n    \t// 接続に失敗した場合\r\n        pStream->m_eStat = NOT_FOUND;\r\n        DEBUG_PRINT(\"CSockReadStream::connection failed.:[%s][%d]\", strHost, port);\r\n    \tif( strPort )\r\n    \t{\r\n    \t\tdelete [] strPort;\r\n    \t\tstrPort = NULL;\r\n    \t}\r\n    \tif( strHost )\r\n    \t{\r\n    \t\tdelete [] strHost;\r\n    \t\tstrHost = NULL;\r\n    \t}\r\n        return pStream;\r\n    }\r\n    pStream->m_fd = fd;\r\n    // 同時に書き込み用クラスを生成\r\n    pStream->m_writeStream = new CSockWriteStream(*pStream);\r\n\r\n    pStream->m_eStat = NORMAL;\r\n    \r\n    if( strPort )\r\n    {\r\n    \tdelete [] strPort;\r\n    \tstrPort = NULL;\r\n    }\r\n    if( strHost )\r\n    {\r\n    \tdelete [] strHost;\r\n    \tstrHost = NULL;\r\n    }\r\n    return pStream;\r\n}\r\n\r\n\r\ns32  \r\nCSockReadStream::getSize()\r\n{\r\n\tm_eStat = NORMAL;\r\n\tif(!readRingBuf()) {\r\n\t\tsetStatus();\r\n\t}\r\n\tsize_t leftSize = left_size();\r\n\treturn (s32)leftSize;\r\n}\r\ns32\r\nCSockReadStream::getPosition()\r\n{\r\n    // ネットワークソケットは位置を取得できない\r\n    return 0;\r\n}\r\n\r\n/*\r\n ネットワークストリームの場合、全ての読み込みメソッドにおいて\r\n *必ずしも読み込みが成功するわけではない* ことに注意する必要がある。\r\n 相手ホストがデータを送信していない場合、たとえ8bitのデータでも読み込みに失敗することがある。\r\n \r\n readBlock() 以外は読み込みの成否を返すようには出来ていないため、\r\n 実行後に必ず getStatus() でステータスを確認し、NOT_AVAILABLE である場合は\r\n 戻り値に意味が無いものとして破棄する必要がある。\r\n*/\r\n\r\nu8\r\nCSockReadStream::readU8()\r\n{\r\n    u8 buf;\r\n    if(!requestData(&buf, 1))return 0xff;\r\n    return buf;\r\n}\r\n\r\n\r\nu16\r\nCSockReadStream::readU16()\r\n{\r\n    u8 buf[2];\r\n    if(!requestData(buf, 2))return 0xffff;\r\n    return (u16)buf[0] << 8 | (u16)buf[1];\r\n}\r\n\r\nu32\r\nCSockReadStream::readU32()\r\n{\r\n    u8 buf[4];\r\n    if(!requestData(buf, 4)) return 0xffff;\r\n    return ((u32)buf[0] << 24) | ((u32)buf[1] << 16) | ((u32)buf[2] << 8) | (u32)buf[3];\r\n    \r\n}\r\nfloat\r\nCSockReadStream::readFloat()\r\n{\r\n    float buf;\r\n    if(!requestData((unsigned char *)&buf, sizeof(float))) return -6e24;\r\n    return buf;\r\n}\r\n\r\n/*!\r\n 指定サイズ読み込み失敗時に読み込み位置を更新しないリングバッファ方式のため、\r\n byteSize にはリングバッファのサイズ以上を指定できない。\r\n */\r\nbool\r\nCSockReadStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n    if(!requestData((unsigned char *)buffer, byteSize)) return false;\r\n    return true;\r\n}\r\n\r\nCSockReadStream::ESTATUS\r\nCSockReadStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\n// この Stream から書き込み(送出)可能なストリームを生成する\r\nIWriteStream *\r\nCSockReadStream::getWriteStream()\r\n{\r\n    return m_writeStream;\r\n}\r\n\r\n\r\nint\r\nCSockReadStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n    // リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\r\n    if(!requestData((unsigned char *)pBufferU16, items * sizeof(u16))) return 0;\r\n\r\n    // iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\r\n\r\n    return items;\r\n}\r\n\r\nint\r\nCSockReadStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n    // リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\r\n    if(!requestData((unsigned char *)pBufferU32, items * sizeof(u32))) return 0;\r\n\r\n    // iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\r\n\r\n    return items;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CSockReadStream.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockReadStream.h\r\n//\r\n//\r\n\r\n#ifndef CSockReadStream_h\r\n#define CSockReadStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CSockWriteStream;\r\n\r\n// ファイルアクセスクラス実装\r\nclass CSockReadStream : public IReadStream\r\n{\r\n    friend class CSockWriteStream;\r\nprivate:\r\n    enum {\r\n        READ_BUFSIZ = 4096\r\n    };\r\n    // ファクトリとなるクラスメソッド以外で勝手に new はできない\r\n    CSockReadStream();\r\n\r\npublic:\r\n    // delete はできる。\r\n    virtual ~CSockReadStream();\r\n\r\n    // 指定されたIPアドレスまたはFQDNとPORTで CSockReadStream インスタンスを作り、そのポインタを返す。\r\n    // このクラスメソッドはプラットフォーム側のために用意され、ゲーム側では IReadStream のポインタとして\r\n    // 扱われるため、このメソッドを扱うことは出来ない(可能ではあるが推奨されない)\r\n    static CSockReadStream * openStream(const char * path);\r\n    \r\n\r\n    s32     getSize();\r\n    s32     getPosition();\r\n    u8      readU8();\r\n    u16     readU16();\r\n    u32     readU32();\r\n    float   readFloat();\r\n    bool    readBlock(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus();\r\n\r\n    int     readU16arr(u16 * pBufferU16, int items);\r\n    int     readU32arr(u32 * pBufferU32, int items);\r\n\r\n    IWriteStream * getWriteStream();\r\nprivate:\r\n    int     sock_connect(const char * hostname, int port);\r\n    bool    readRingBuf();\r\n    bool    requestData(unsigned char * buf, size_t size);\r\n    bool    setStatus();\r\n\r\n    inline size_t left_size() {\r\n    \tsize_t leftSize = 0;\r\n        if(m_lastPos > m_getPos) {\r\n        \tleftSize = m_lastPos - m_getPos;\r\n        } else if(m_lastPos < m_getPos) {\r\n        \tleftSize = m_lastPos + READ_BUFSIZ - m_getPos;\r\n        }\r\n        return leftSize;\r\n    }\r\n\r\nprivate:\r\n    ESTATUS     m_eStat;\r\n    int         m_fd;\r\n    \r\n    // 読み込みバッファ: 受信データは一度このバッファを経由する。\r\n    u8          m_readBuf[ READ_BUFSIZ ];\r\n    int         m_lastPos;  // データ終端\r\n    int         m_getPos;   // データ始端\r\n\r\n    // 同じ fd を使用して送出に使用される CSockWriteStream のポインタ\r\n    CSockWriteStream    *   m_writeStream;\r\n};\r\n\r\n\r\n#endif // CSockReadStream_h\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CSockWriteStream.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockWriteStream.cpp\r\n//\r\n//\r\n\r\n// #include <iostream>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <unistd.h>\r\n#include \"CSockWriteStream.h\"\r\n#include \"CSockReadStream.h\"\r\n\r\n\r\n// CSockWriteStream は、CSockReadStream が CSockReadStream::create() によって\r\n// 生成されたタイミングで作られる、書き込み(送出)用インタフェースとなるクラス。\r\n// socket は基本的に書き込み可能なストリームなので、必ず生成され、内部的に保持される。\r\nCSockWriteStream::CSockWriteStream(CSockReadStream& rdStream) : m_fd(rdStream.m_fd), m_eStat(NORMAL) {}\r\nCSockWriteStream::~CSockWriteStream() {}\r\n\r\nbool\r\nCSockWriteStream::sendData(unsigned char *buffer, size_t sndSize)\r\n{\r\n    // ひとまず、送出についてはその場で与えられたブロック全てを送出し終わるまで続ける形で実装する。\r\n    // ゲームで使う上で問題が生じたら、それはそれで考える。\r\n    size_t pos = 0;\r\n    do {\r\n        int result = write(m_fd, buffer + pos, sndSize - pos);\r\n        if(result < 0) return false;\r\n        pos += result;\r\n    } while(pos < sndSize);\r\n    return true;\r\n}\r\n\r\nCSockWriteStream::ESTATUS\r\nCSockWriteStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\ns32\r\nCSockWriteStream::getPosition()\r\n{\r\n    return 0;   // socket は位置の取得ができない\r\n}\r\nvoid\r\nCSockWriteStream::writeU8(u8 value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData(&value, 1)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }\r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU16(u16 value)\r\n{\r\n    unsigned char buf[2];\r\n    \r\n    // big endian\r\n    buf[0] = (value >> 8) & 0xff;\r\n    buf[1] = value & 0xff;\r\n    \r\n    m_eStat = NORMAL;\r\n    if(!sendData(buf, 2)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU32(u32 value)\r\n{\r\n    unsigned char buf[4];\r\n    \r\n    // big endian\r\n    buf[0] = (value >> 24) & 0xff;\r\n    buf[1] = (value >> 16) & 0xff;\r\n    buf[2] = (value >> 8) & 0xff;\r\n    buf[3] = value & 0xff;\r\n    \r\n    m_eStat = NORMAL;\r\n    if(!sendData(buf, 4)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeFloat(float value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData((unsigned char *)&value, sizeof(float))) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeBlock(void* buffer, u32 byteSize)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData((unsigned char *)buffer, byteSize)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/CSockWriteStream.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockWriteStream.h\r\n//\r\n//\r\n\r\n#ifndef CSockWriteStream_h\r\n#define CSockWriteStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CSockReadStream;\r\n\r\n// ファイルアクセスクラス実装\r\nclass CSockWriteStream : public IWriteStream\r\n{\r\n    friend class CSockReadStream;\r\nprivate:\r\n    CSockWriteStream(CSockReadStream& rdStream);\r\n    virtual ~CSockWriteStream();\r\n    \r\n    bool    sendData(unsigned char * buffer, size_t sndSize);\r\npublic:\t\r\n\tESTATUS\tgetStatus\t();\r\n\ts32\t\tgetPosition\t();\r\n\tvoid\twriteU8\t\t(u8 value);\t// Use cast to support s8\r\n\tvoid\twriteU16\t(u16 value);\t// Use cast to support s16\r\n\tvoid\twriteU32\t(u32 value);\t// Use cast to support s32\r\n\tvoid\twriteFloat\t(float);\r\n\tvoid\twriteBlock\t(void* buffer, u32 byteSize);\r\n\r\nprivate:\r\n    int         m_fd;\r\n    ESTATUS     m_eStat;\r\n};\r\n\r\n#endif // CSockWriteStream_h\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/GLcommon.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  GLcommon.h\r\n//\r\n//\r\n\r\n#ifndef GLcommon_h\r\n#define GLcommon_h\r\n\r\n#if defined(__APPLE__)\r\n#include \"ApplicationFramework.h\"\r\n#include \"RenderingFramework.h\"\r\n#endif\r\n#include <OpenGLES/ES2/gl.h>\r\n#include <OpenGLES/ES2/glext.h>\r\n#endif // GLcommon_h\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBOpenSLAudioPlayer.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLBOpenSLAudioPlayer_h\r\n#define KLBOpenSLAudioPlayer_h\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CAndroidRequest.h\"\r\n#include \"encryptFile.h\"\r\n#include \"ivorbisfile.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n#include <pthread.h>\r\n#include <assert.h>\r\n#include <jni.h>\r\n#include <string.h>\r\n#include <math.h>\r\n\r\n#include <SLES/OpenSLES.h>\r\n#include <SLES/OpenSLES_Android.h>\r\n\r\n#include <android/log.h>\r\n#include <sys/types.h>\r\n#include <android/asset_manager.h>\r\n#include <android/asset_manager_jni.h>\r\n\r\nclass KLBOpenSLEngine;\r\nclass KLBOpenSLSoundAssetLoader;\r\nclass KLBOpenSLSoundAsset;\r\nclass KLBOpenSLSoundHandle;\r\n\r\nclass KLBOpenSLEngine\r\n{\r\npublic:\r\n    ~KLBOpenSLEngine();\r\n\r\n    static KLBOpenSLEngine* getInstance();\r\n\tstatic inline void terminate()\r\n\t{\r\n\t\tdelete KLBOpenSLEngine::getInstance();\r\n\t}\r\n\tKLBOpenSLSoundHandle* assignSoundHandle(KLBOpenSLSoundAsset *pAsset);\r\n\tvoid discardCorrespondingSoundHandles(KLBOpenSLSoundAsset *pAsset, bool isLockGained = false);\r\n\ts32 tellCorrespondingSoundHandle(KLBOpenSLSoundAsset *pAsset);\r\n\tvoid setFadeParamOnCorrespondingSoundHandles(KLBOpenSLSoundAsset *pAsset, float _tgtVol, u32 _millisec);\r\n\tvoid stopCorrespondingSoundHandles(KLBOpenSLSoundAsset *pAsset, bool isLockGained = false, float _tgtVol=1.0f, u32 _millisec=0);\r\n\tvoid pauseCorrespondingSoundHandles(KLBOpenSLSoundAsset *pAsset, bool isLockGained = false, float _tgtVol=0.0f, u32 _millisec=0);\r\n\tvoid resumeCorrespondingSoundHandles(KLBOpenSLSoundAsset *pAsset, bool isLockGained = false, float _tgtVol=1.0f, u32 _millisec=0);\r\n\ts32 getStateOfCorrespondingSoundHandle(KLBOpenSLSoundAsset *pAsset);\r\n\tvoid setMasterVolume(float volume, bool is_se);\r\n\tinline float GetSEMasterVolume() {\r\n    \treturn is_se_off ? 0.0f : master_volume_se;\r\n\t}\r\n\tinline float GetBGMMasterVolume() {\r\n    \treturn is_bgm_off ? 0.0f : master_volume_bgm;\r\n\t}\r\n\tinline float GetMasterVolume(bool is_se) {\r\n\t\treturn is_se ? GetSEMasterVolume() : GetBGMMasterVolume();\r\n\t}\r\n\tinline bool isSoundPaused() { return is_sound_paused; }\r\n\tvoid setVolumeOnCorrespondingSoundHandles(KLBOpenSLSoundAsset *pAsset, float volume, bool isLockGained = false);\r\n\tKLBOpenSLSoundAsset* load(const char * path, bool is_se);\r\n\tvoid unload(KLBOpenSLSoundAsset* asset);\r\n\tinline void setAudioMultiProcessType(s32 _type) { m_multiProcessType = _type; }\r\n\tvoid chackAudioMasterVolume();\r\n\r\n\tSLObjectItf outputMixObject;\r\n\tSLEngineItf engineEngine;\r\n\tstatic s32 ThreadSoundEngineParam(void * hThread, void * data);\r\n\tvoid registerAssetForRefilling(KLBOpenSLSoundAsset* asset);\r\n\tvoid updateFadeRatio();\r\n\tvoid performRefillOnCurrentAsset();\r\n\tvoid onActivityPause();\r\n\tvoid onActivityResume();\r\n\tstatic const char MAX_SOUND_ASSETS = 32;\r\n\tstatic const char MAX_SOUND_HANDLE = 10;\r\n\t// サウンドの割り込みタイプ\r\n\tenum eINTERRUPTION_TYPE\r\n\t{\r\n\t\teINTERRUPTION_TYPE_NONE = -1,\r\n\r\n\t\teINTERRUPTION_TYPE_CALLING = 0,\t\t //!< 電話、Siriなどの割り込み\r\n\t\teINTERRUPTION_TYPE_RESIGN_ACTIVE,\t   //!< ホームボタンダブルタップなどによる非アクティブ状態\r\n\t\teINTERRUPTION_TYPE_ENTER_BACKGROUND,\t//!< ホームボタンなどによるアプリがバックグラウンドにある状態\r\n\r\n\t\teINTERRUPTION_TYPE_MAX\r\n\t};\r\n\r\nprivate:\r\n\tKLBOpenSLEngine();\r\n\tSLObjectItf engineObject;\r\n\tIPlatformRequest* platform;\r\n\tKLBOpenSLSoundAssetLoader* assetLoader;\r\n\tconst char *home;\r\n\tKLBOpenSLSoundHandle** soundHandles;\r\n\tKLBOpenSLSoundAsset** soundAssets;\r\n    void* observingThread;\r\n\tfloat master_volume_bgm;\r\n\tfloat master_volume_se;\r\n\tbool is_bgm_off;\r\n\tbool is_se_off;\r\n\tbool is_sound_paused;\r\n\ts32 m_multiProcessType;\r\n\t\r\n\tpthread_mutex_t cs_mutex;\r\n\tpthread_mutex_t asset_refill_mutex;\r\n\tKLBOpenSLSoundAsset* asset_waiting_refill;\r\n};\r\n\r\nclass KLBOpenSLSoundAssetLoader\r\n{\r\nfriend class KLBOpenSLEngine;\r\npublic:\r\n\tvirtual ~KLBOpenSLSoundAssetLoader();\r\n\tKLBOpenSLSoundAsset* openFile(const char * path, bool isFullBuffered);\r\n\r\nprivate:\r\n\tstatic const unsigned SRC_BUFFER_SIZE = 65536;\r\n\tKLBOpenSLSoundAssetLoader();\r\n\tvoid startObservation();\r\n\tvoid stopObservation();\r\n\tvoid fillBuffer(KLBOpenSLSoundAsset* soundAsset);\r\n\tvoid registerAsset(KLBOpenSLSoundAsset *pAsset);\r\n\tvoid unregisterAsset(KLBOpenSLSoundAsset *pAsset);\r\n\tstatic int FileObservationThreadParam(void* hThread, void* data);\r\n\r\n\tKLBOpenSLSoundAsset** assets;\r\n\tAAssetManager* mgr;\r\n\tJNIEnv* env;\r\n\tchar const *home;\r\n\tvoid* observationThread;\r\n};\r\n\r\nclass KLBOpenSLSoundAsset\r\n{\r\nfriend class KLBOpenSLSoundAssetLoader;\r\npublic:\r\n\tenum REPEAT_MODE {\r\n\t\tONCE,\r\n\t\tINFINITE_LOOP\r\n\t};\r\n\tstatic const int MAX_BUFFER_SAMPLES = 176400;\r\n\tstatic const int DEFAULT_LOAD_SAMPLES = 44100;\r\n\tstatic const int VORBIS_READ_BUFFER = 4096;\r\n\tKLBOpenSLSoundAsset(const char* path, bool isFullBuffered);\r\n\tvirtual ~KLBOpenSLSoundAsset();\r\n\r\n\tvoid prepare(int frames);\r\n\tinline bool isFullyBuffered() { return src_buf_flags & 0x04; }\r\n\tKLBOpenSLSoundHandle* play(REPEAT_MODE = ONCE, s32 _milisec=0, float _tgtVol=1.0f, float _startVol=0.0f);\r\n\tvoid stopAll();\r\n\tvoid fetchNextPcmBuffer(KLBOpenSLSoundHandle* soundHandle);\r\n\tinline void readVorbisSamples(int samplesToRead) {\r\n\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_SOUND_DECODE);\r\n\t\treadVorbisSamplesImpl(samplesToRead);\r\n\t\tMEASURE_THREAD_CPU_END(TASKTYPE_SOUND_DECODE);\r\n\t}\r\n\tvoid close();\r\n\tinline long getSrcFileSize() { return src_file_size; }\r\n\tinline const char* getSrcFullPath() { return src_full_path; }\r\n\tvoid seekSrcChunk(unsigned int new_pos);\r\n\tint putNextSrcChunk(void *ptraddr, int bytes_to_read);\r\n\tinline int getPcmSamplingRate() { return pcm_sampling_rate; }\r\n\tinline char getChannels() { return channels; }\r\n\tinline int totalPlayTime() { return playtime_ms; }\r\n\tinline unsigned int getPcmTotalReadPos() { return pcm_total_read_pos; }\r\n\tinline bool isBufferEndReached() { return pcm_total_samples == pcm_total_read_pos && pcm_buffer_read_pos == pcm_buffer_consumed_pos; }\r\n\tinline void resetBuffer() {\r\n\t\tpcm_total_read_pos = 0;\r\n\t\tpcm_buffer_read_pos = 0;\r\n\t\tpcm_buffer_consumed_pos = 0;\r\n\t\tov_raw_seek(vf, 0);\r\n\t}\r\n\tvoid closeVorbisFile();\r\n\tinline bool isSE() { return is_se; }\r\n\r\n\tstatic size_t read_func(void *ptr, size_t size, size_t nmemb, void *datasource);\r\n\tstatic int seek_func(void *datasource, ogg_int64_t offset, int whence);\r\n\tstatic int close_func(void *datasource);\r\n\tstatic long tell_func(void *datasource);\r\n\r\nprivate:\r\n\tvoid readVorbisSamplesImpl(int samplesToRead);\r\n\tKLBOpenSLSoundAssetLoader* assetLoader;\r\n\tconst char* src_path;\r\n\tconst char* src_full_path;\r\n\tlong src_file_size;\r\n\tchar channels;\r\n\tint playtime_ms;\r\n\tunsigned int src_location;\r\n\t// composite flag for buffer status.\r\n\t// b00000X000: 1 if initialization done\r\n\t// b000000X00: 1 if src file is fully buffered (target is SE or is smaller than buffer size)\r\n\t// b0000000X0: 1 if former half of this buffer is filled (no need to refill)\r\n\t// b00000000X: 1 if latter half of this buffer is filled (no need to refill)\r\n\tchar src_buf_flags;\r\n\tinline bool isBufferInitialized() { return src_buf_flags & 0x08; }\r\n\tinline bool isFormerHalfBufferFilled() { return src_buf_flags & 0x02; }\r\n\tinline bool isLatterHalfBufferFilled() { return src_buf_flags & 0x01; }\r\n\tshort* pcm_samples;\r\n\tint pcm_sampling_rate;\r\n\tint pcm_buffer_size;\r\n\tunsigned int pcm_total_samples;\r\n\tunsigned int pcm_total_read_pos;\r\n\tunsigned int pcm_buffer_read_pos;\r\n\tunsigned int pcm_buffer_consumed_pos;\r\n\tFILE* fp;\r\n\tCDecryptBaseClass decryptor;\r\n\tbool is_se;\r\n\r\n\tOggVorbis_File* vf;\r\n\tov_callbacks callbacks;\r\n};\r\n\r\nclass KLBOpenSLSoundHandle\r\n{\r\nfriend class KLBOpenSLSoundAsset;\r\npublic:\r\n\tKLBOpenSLSoundHandle();\r\n\tvirtual ~KLBOpenSLSoundHandle();\r\n\r\n\tstatic void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context);\r\n\r\n\tvoid play(int _msec=0, float _tgtVol=1.0f, float _startVol=1.0f);\r\n\tvoid stop(int _msec=0, float _tgtVol=0.0f);\r\n\tvoid pause(int _msec=0, float _tgtVol=0.0f);\r\n\tvoid resume(int _msec=0, float _tgtVol=1.0f);\r\n\tvoid closeAudio(void);\r\n\tvoid setVolume(float volume);\r\n\tvoid refreshVolume();\r\n\tvoid updateVolume();\r\n\ts32 tellAudio();\r\n\tvoid fillPcmBuffer(SLAndroidSimpleBufferQueueItf bq, bool is_starting);\r\n\r\n\tvoid setSoundAsset(KLBOpenSLSoundAsset *asset);\r\n\tinline KLBOpenSLSoundAsset* getSoundAsset() { return asset; }\r\n    bool setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType=INTER_TYPE_LINEAR, float _startVolume=1.0f);\r\n\tvoid updateFadeParam();\r\n\tinline float getVolume() { return volume; }\r\n\tvoid setPan(float pan);\r\n\tinline float getPan() { return m_pan; }\r\n\r\n\tinline bool isActive() { return m_bActive; }\r\n\tinline bool isInitiated() { return is_initiated; }\r\n\tinline bool isPlaying() { return state == IClientRequest::E_SOUND_STATE_PLAY; }\r\n\tinline int getInterruptionType() { return m_interruptionType; }\r\n\tinline void setInterruptionType( int _interruptionType ) { m_interruptionType = _interruptionType; }\r\n\tinline char getPcmDepth() { return pcm_depth; }\r\n    inline s32 getState() { return state; }\r\n\tinline SLuint32 getSlSampleFormat() {\r\n\t\tswitch (pcm_depth) {\r\n\t\t\tcase 1: return SL_PCMSAMPLEFORMAT_FIXED_8;\r\n\t\t\tcase 2: return SL_PCMSAMPLEFORMAT_FIXED_16;\r\n\t\t\tdefault: return SL_PCMSAMPLEFORMAT_FIXED_16;\r\n\t\t}\r\n\t}\r\n\tinline SLuint32 getSlChannelMask() {\r\n\t\tswitch (pcm_channels) {\r\n\t\t\tcase 1: return SL_SPEAKER_FRONT_CENTER;\r\n\t\t\tcase 2: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;\r\n\t\t\tdefault: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;\r\n\t\t}\r\n\t}\r\n\tinline char getPcmChannels() { return pcm_channels; }\r\n\tinline SLuint32 getSlSamplingRate() {\r\n\t\tswitch (pcm_sampling_rate) {\r\n\t\t\tcase   8000: return SL_SAMPLINGRATE_8;\r\n\t\t\tcase  11025: return SL_SAMPLINGRATE_11_025;\r\n\t\t\tcase  12000: return SL_SAMPLINGRATE_12;\r\n\t\t\tcase  16000: return SL_SAMPLINGRATE_16;\r\n\t\t\tcase  22050: return SL_SAMPLINGRATE_22_05;\r\n\t\t\tcase  24000: return SL_SAMPLINGRATE_24;\r\n\t\t\tcase  32000: return SL_SAMPLINGRATE_32;\r\n\t\t\tcase  44100: return SL_SAMPLINGRATE_44_1;\r\n\t\t\tcase  48000: return SL_SAMPLINGRATE_48;\r\n\t\t\tcase  64000: return SL_SAMPLINGRATE_64;\r\n\t\t\tcase  88200: return SL_SAMPLINGRATE_88_2;\r\n\t\t\tcase  96000: return SL_SAMPLINGRATE_96;\r\n\t\t\tcase 192000: return SL_SAMPLINGRATE_192;\r\n\t\t\tdefault:     return SL_SAMPLINGRATE_44_1;\r\n\t\t}\r\n\t}\r\n\tinline s64 getTimeStarted() { return time_started; }\r\n\r\n    // フェード関係のパラメータ\r\n    enum FADE_TYPE\r\n    {\r\n        FADE_TYPE_NONE = 0,\r\n        FADE_TYPE_PLAY,         //!< fade in\r\n        FADE_TYPE_STOP,         //!< fade out\r\n        FADE_TYPE_PAUSE,        //!< fade out\r\n        FADE_TYPE_RESUME,       //!< fade in\r\n        FADE_TYPE_PLAYING,      //!< fade\r\n\r\n        FADE_TYPE_NUM,\r\n    };\r\n\r\n    enum INTER_TYPE\r\n    {\r\n        INTER_TYPE_NONE = 0,\r\n        INTER_TYPE_LINEAR,         //!< Linear\r\n\r\n        INTER_TYPE_NUM,\r\n    };\r\n\r\nprivate:\r\n\tvoid initInternalResources();\r\n\tvoid destroyOpenSLObjects();\r\n\tinline void updateAsset(KLBOpenSLSoundAsset *asset) {\r\n\t\tthis->asset = asset;\r\n\t\tthis->pcm_depth = 2;\r\n\t\tthis->pcm_channels = asset->getChannels();\r\n\t\tthis->pcm_sampling_rate = asset->getPcmSamplingRate();\r\n\t}\r\n\tKLBOpenSLSoundAsset::REPEAT_MODE repeatMode;\r\n\tKLBOpenSLSoundAsset* asset;\r\n\tSLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;\r\n\tSLObjectItf bqPlayerObject;\r\n\tSLPlayItf bqPlayerPlay;\r\n\tSLVolumeItf bqPlayerVol;\r\n    float volume;\r\n    float m_pan;\r\n    bool m_bActive;\r\n    int m_interruptionType;\r\n\ts64 time_started;\r\n\ts64 time_elapsed;\r\n\tinline void updateTimeStarted() { time_started = CAndroidRequest::getInstance()->nanotime(); }\r\n\tinline SLmillibel gain_to_attenuation(float volume, SLmillibel max_mbel)\r\n\t{\r\n\t\t// using this code snippet. http://www.verious.com/qa/audio-output-level-in-a-form-that-can-be-converted-to-decibel/\r\n\t\tSLmillibel volume_mb;\r\n\t\tif(volume>=1.0f) volume_mb=max_mbel;\r\n\t\telse if(volume<=0.02f) volume_mb=SL_MILLIBEL_MIN;\r\n\t\telse\r\n\t\t{\r\n\t\t\tvolume_mb=M_LN2/log(1.0f/(1.0f-volume))*-1000.0f;\r\n\t\t\tif(volume_mb>0) volume_mb=SL_MILLIBEL_MIN;\r\n\t\t}\r\n\t\treturn volume_mb;\r\n\t}\r\n\tshort* current_head;\r\n\tunsigned head_bufsize;\r\n\tunsigned consumed_pos;\r\n\tchar pcm_depth;\r\n\tchar pcm_channels;\r\n\tunsigned pcm_sampling_rate;\r\n\tbool is_playing;\r\n\tbool is_initiated;\r\n\tbool is_destroyed;\r\n\tstruct fade_param_type {\r\n\t\ts32                 m_fadeCnt;          //!< フェードカウント(ミリ秒)\r\n\t\tfloat               m_startVol;         //!< フェード開始のボリューム値(0.0f~1.0f)\r\n\t\tfloat               m_endVol;           //!< フェード終了のボリューム値(0.0f~1.0f)\r\n\t\tfloat               m_fadeRatio;        //!< フェード割合(0.0f〜1.0f)\r\n\t\ts32                 m_fadeMiliSec;      //!< フェードに要する時間(ミリ秒)\r\n\t\ts16                 m_nowFadeInterType; //!< 現在のフェード補間タイプ\r\n\t\ts16                 m_nowFadeType;      //!< 現在のフェードタイプ\r\n\t\tbool                m_bfade;            //!< フェード中？\r\n\t\ts64                 m_prevmseq;         //!< 前回の再生時間\r\n\t} fade_param;\r\n\ts32 state;\r\n\tbool is_loop_requested;\r\n\tpthread_mutex_t buf_fill_lock;\r\n\ts32 last_error;\r\n\tSLmillibel cur_mbel;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBOpenSLEngine.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <pthread.h>\r\n#include <unistd.h>\r\n#include \"KLBOpenSLAudioPlayer.h\"\r\n#include \"ivorbisfile.h\"\r\n\r\nKLBOpenSLEngine::KLBOpenSLEngine() :\r\nengineObject(NULL),\r\nasset_waiting_refill(NULL),\r\nmaster_volume_bgm(1),\r\nmaster_volume_se(1),\r\nis_bgm_off(false),\r\nis_se_off(false),\r\nis_sound_paused(false),\r\nm_multiProcessType(IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT)\r\n{\r\n    // DEBUG_PRINT(\"AUDIO; construct KLBOpenSLEngine\");\r\n\tSLresult result;\r\n    // DEBUG_PRINT(\"AUDIO; slCreateEngine\");\r\n\tresult = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);\r\n    assert(SL_RESULT_SUCCESS == result);\r\n\r\n    // DEBUG_PRINT(\"AUDIO; realizing engineObject\");\r\n\tresult = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE);\r\n    assert(SL_RESULT_SUCCESS == result);\r\n\r\n    // get the engine interface, which is needed in order to create other objects\r\n    result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine);\r\n    assert(SL_RESULT_SUCCESS == result);\r\n\r\n    // DEBUG_PRINT(\"AUDIO; creating output mix\");\r\n\tresult = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, NULL, NULL);\r\n    assert(SL_RESULT_SUCCESS == result);\r\n\r\n    // DEBUG_PRINT(\"AUDIO; realizing output mix\");\r\n\tresult = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE);\r\n    assert(SL_RESULT_SUCCESS == result);\r\n\r\n    // DEBUG_PRINT(\"AUDIO; allocating memories for handlers\");\r\n\tsoundHandles = (KLBOpenSLSoundHandle**)calloc(KLBOpenSLEngine::MAX_SOUND_HANDLE, sizeof(KLBOpenSLSoundHandle*));\r\n\tsoundAssets = (KLBOpenSLSoundAsset**)calloc(KLBOpenSLEngine::MAX_SOUND_ASSETS, sizeof(KLBOpenSLSoundAsset*));\r\n\r\n    // DEBUG_PRINT(\"AUDIO; creating KLBOpenSLSoundAssetLoader\");\r\n\tassetLoader = new KLBOpenSLSoundAssetLoader();\r\n\tassetLoader->startObservation();\r\n\r\n\tcs_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;\r\n\tasset_refill_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;\r\n\r\n\tobservingThread = CPFInterface::getInstance().platform().createThread(ThreadSoundEngineParam, this);\r\n}\r\n\r\nKLBOpenSLEngine::~KLBOpenSLEngine()\r\n{\r\n\tif (outputMixObject != NULL)\r\n\t{\r\n\t\t(*outputMixObject)->Destroy(outputMixObject);\r\n\t}\r\n\tif (engineObject != NULL)\r\n\t{\r\n\t\t(*engineObject)->Destroy(engineObject);\r\n\t\tengineObject = NULL;\r\n\t\tengineEngine = NULL;\r\n\t}\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle* soundHandle = *(soundHandles + i);\r\n\t\tif (soundHandle != NULL)\r\n\t\t{\r\n\t\t\tdelete soundHandle;\r\n\t\t}\r\n\t}\r\n\tfree(soundHandles);\r\n\tfree(soundAssets);\r\n\tdelete assetLoader;\r\n    if(observingThread != NULL)\r\n    {\r\n        CPFInterface::getInstance().platform().deleteThread(observingThread);\r\n        observingThread = NULL;\r\n    }\r\n\tpthread_mutex_destroy(&cs_mutex);\r\n\tpthread_mutex_destroy(&asset_refill_mutex);\r\n}\r\n\r\nKLBOpenSLEngine* KLBOpenSLEngine::getInstance()\r\n{\r\n\tstatic KLBOpenSLEngine engine;\r\n\treturn &engine;\r\n}\r\n\r\nvoid KLBOpenSLEngine::registerAssetForRefilling(KLBOpenSLSoundAsset* asset) {\r\n\t// DEBUG_PRINT(\"AUDIO; registering asset for vorbis samples refilling.\");\r\n\tpthread_mutex_lock(&asset_refill_mutex);\r\n\tasset_waiting_refill = asset;\r\n\tpthread_mutex_unlock(&asset_refill_mutex);\r\n}\r\n\r\nvoid KLBOpenSLEngine::updateFadeRatio() {\r\n\tpthread_mutex_lock(&cs_mutex);\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i) {\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->isPlaying()) {\r\n\t\t\t(*handle)->updateFadeParam();\r\n\t\t}\r\n\t}\r\n\tpthread_mutex_unlock(&cs_mutex);\r\n}\r\n\r\nvoid KLBOpenSLEngine::performRefillOnCurrentAsset() {\r\n\tpthread_mutex_lock(&asset_refill_mutex);\r\n\tif (asset_waiting_refill != NULL) {\r\n\t\tasset_waiting_refill->readVorbisSamples(-1);\r\n\t\tasset_waiting_refill = NULL;\r\n\t}\r\n\tpthread_mutex_unlock(&asset_refill_mutex);\r\n}\r\n\r\ns32 KLBOpenSLEngine::ThreadSoundEngineParam(void * hThread, void * data)\r\n{\r\n\tKLBOpenSLEngine* engine = (KLBOpenSLEngine*)data;\r\n\tDEBUG_PRINT(\"AUDIO; sound engine observation thread started.\");\r\n    while(1)\r\n    {\r\n\t\tengine->performRefillOnCurrentAsset();\r\n\t\tengine->updateFadeRatio();\r\n        usleep(16000);\r\n    }\r\n    return 0; // 終了\r\n}\r\n\r\nKLBOpenSLSoundAsset *KLBOpenSLEngine::load(char const *path, bool is_se)\r\n{\r\n\tif (strlen(path) == 8 && !strncmp(path, \"asset://\", 8)) {\r\n\t\tDEBUG_PRINT(\"skipping load() due to empty asset is specified.\");\r\n\t\treturn NULL;\r\n\t}\r\n\tDEBUG_PRINT(\"AUDIO; loading %s, bufmode=%d\", path, is_se);\r\n\t// TODO: load beginning frames, then associate with assetLoader (if any)\r\n\t// search for vacant asset first\r\n\tKLBOpenSLSoundAsset* currentAsset = NULL;\r\n\tfor (int i = 0; i < MAX_SOUND_ASSETS; ++i)\r\n\t{\r\n\t\tif (soundAssets[i] == NULL)\r\n\t\t{\r\n\t\t\tDEBUG_PRINT(\"AUDIO; opening file\");\r\n\t\t\tsoundAssets[i] = currentAsset = assetLoader->openFile(path, is_se);\r\n\t\t\tif (currentAsset == NULL) {\r\n\t\t\t\tDEBUG_PRINT(\"AUDIO; failed to open file: %s (file not found?)\", path);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tif (currentAsset == NULL) {\r\n\t\treturn NULL;\r\n\t}\r\n\tif (is_se)\r\n\t{\r\n\t\tcurrentAsset->prepare(-1);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tcurrentAsset->prepare(KLBOpenSLSoundAsset::DEFAULT_LOAD_SAMPLES);\r\n\t\tif (!currentAsset->isFullyBuffered())\r\n\t\t{\r\n\t\t\tassetLoader->registerAsset(currentAsset);\r\n\t\t}\r\n\t}\r\n\treturn currentAsset;\r\n}\r\n\r\ns32 KLBOpenSLEngine::tellCorrespondingSoundHandle(KLBOpenSLSoundAsset *asset) {\r\n\tpthread_mutex_lock(&cs_mutex);\r\n\ts32 ret_val = 0;\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\t// DEBUG_PRINT(\"found tellAudio()\");\r\n\t\t\t// return result of first one\r\n\t\t\tret_val = (*handle)->tellAudio();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tpthread_mutex_unlock(&cs_mutex);\r\n\treturn ret_val;\r\n}\r\n\r\ns32 KLBOpenSLEngine::getStateOfCorrespondingSoundHandle(KLBOpenSLSoundAsset *asset) {\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\treturn (*handle)->getState();\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nvoid KLBOpenSLEngine::stopCorrespondingSoundHandles(KLBOpenSLSoundAsset *asset, bool isLockGained, float _tgtVol, u32 _millisec) {\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_lock(&cs_mutex);\r\n\t}\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\t(*handle)->stop(_millisec, _tgtVol);\r\n\t\t}\r\n\t}\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_unlock(&cs_mutex);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::pauseCorrespondingSoundHandles(KLBOpenSLSoundAsset *asset, bool isLockGained, float _tgtVol, u32 _millisec) {\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_lock(&cs_mutex);\r\n\t}\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\t(*handle)->pause(_millisec, _tgtVol);\r\n\t\t}\r\n\t}\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_unlock(&cs_mutex);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::resumeCorrespondingSoundHandles(KLBOpenSLSoundAsset *asset, bool isLockGained, float _tgtVol, u32 _millisec) {\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_lock(&cs_mutex);\r\n\t}\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\t(*handle)->resume(_millisec, _tgtVol);\r\n\t\t}\r\n\t}\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_unlock(&cs_mutex);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::setMasterVolume(float volume, bool is_se) {\r\n\tif (is_se) {\r\n\t\tmaster_volume_se = volume;\r\n\t}\r\n\telse {\r\n\t\tmaster_volume_bgm = volume;\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::setFadeParamOnCorrespondingSoundHandles(KLBOpenSLSoundAsset *asset, float _tgtVol, u32 _millisec) {\r\n\tpthread_mutex_lock(&cs_mutex);\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\t(*handle)->setFadeParam(KLBOpenSLSoundHandle::FADE_TYPE_PLAYING, _tgtVol, _millisec);\r\n\t\t}\r\n\t}\r\n\tpthread_mutex_unlock(&cs_mutex);\r\n}\r\n\r\nvoid KLBOpenSLEngine::setVolumeOnCorrespondingSoundHandles(KLBOpenSLSoundAsset *asset, float volume, bool isLockGained) {\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_lock(&cs_mutex);\r\n\t}\r\n\tDEBUG_PRINT(\"AUDIO; setting new volume(%f) for %s\", volume, asset->getSrcFullPath());\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\t(*handle)->setVolume(volume);\r\n\t\t}\r\n\t}\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_unlock(&cs_mutex);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::discardCorrespondingSoundHandles(KLBOpenSLSoundAsset *asset, bool isLockGained) {\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_lock(&cs_mutex);\r\n\t}\r\n\t// DEBUG_PRINT(\"AUDIO; discarding sound handle...(searching %d)\", (int)asset);\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\t// DEBUG_PRINT(\"AUDIO; - candidate: %d at %d\", (int)*handle, handle);\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == asset)\r\n\t\t{\r\n\t\t\tdelete *handle;\r\n\t\t\t*handle = NULL;\r\n\t\t}\r\n\t}\r\n\tif (!isLockGained) {\r\n\t\tpthread_mutex_unlock(&cs_mutex);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::onActivityPause() {\r\n\tDEBUG_PRINT(\"AUDIO; performing pause on all playing sounds\");\r\n\tis_sound_paused = true;\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i) {\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL) {\r\n\t\t\tDEBUG_PRINT(\"AUDIO; pause target: initd: %d, isPlaying: %d, intruType: %d\", (*handle)->isInitiated(), (*handle)->isPlaying(), (*handle)->getInterruptionType());\r\n\t\t\tif ((*handle)->isInitiated() && (*handle)->isPlaying() && ((*handle)->getInterruptionType() == eINTERRUPTION_TYPE_NONE)) {\r\n\t\t\t\t// サウンドを停止し割り込みフラグをたてる\r\n\t\t\t\t(*handle)->pause();\r\n\t\t\t\t(*handle)->setInterruptionType(eINTERRUPTION_TYPE_RESIGN_ACTIVE);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::onActivityResume() {\r\n\t// DEBUG_PRINT(\"AUDIO; performing resume on all playing sounds\");\r\n\tis_sound_paused = false;\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i) {\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL) {\r\n\t\t\tDEBUG_PRINT(\"AUDIO; resume target: initd: %d, isPlaying: %d, intruType: %d\", (*handle)->isInitiated(), (*handle)->isPlaying(), (*handle)->getInterruptionType());\r\n\t\t\tif ((*handle)->isInitiated() && !(*handle)->isPlaying() && ((*handle)->getInterruptionType() == eINTERRUPTION_TYPE_RESIGN_ACTIVE)) {\r\n\t\t\t\t// 割り込みフラグがたっている物に限り再生を再開\r\n\t\t\t\t(*handle)->resume();\r\n\t\t\t\t(*handle)->setInterruptionType(eINTERRUPTION_TYPE_NONE);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::chackAudioMasterVolume() {\r\n\tswitch (m_multiProcessType) {\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:    // ミュージックを無効\r\n\t\t    is_se_off  = false;\r\n\t\t    is_bgm_off = false;\r\n\t\t    break;\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:    // ゲームサウンドを無効\r\n\t\t    is_se_off  = true;\r\n\t\t    is_bgm_off = false;\r\n\t\t    break;\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT: // ゲームのBGMサウンドのみ無効\r\n\t\t    is_se_off  = false;\r\n\t\t    is_bgm_off = true;\r\n\t\t\t/*\r\n\t\t    if(!isMusicPlayerPlaying()) {\r\n\t\t    \tis_bgm_off = false;\r\n\t\t    }\r\n\t\t\t*/\r\n\t\t    break;\r\n\t}\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\tKLBOpenSLSoundHandle** handle = soundHandles + i;\r\n\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->isPlaying())\r\n\t\t{\r\n\t\t\t(*handle)->refreshVolume();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLEngine::unload(KLBOpenSLSoundAsset *asset) {\r\n\t// DEBUG_PRINT(\"unloading asset: %s\", asset->getSrcFullPath());\r\n\tKLBOpenSLSoundHandle** handle;\r\n\tpthread_mutex_lock(&cs_mutex);\r\n\r\n\t// wait for refilling if in process\r\n\tpthread_mutex_lock(&asset_refill_mutex);\r\n\t// remove from refilling list immediately\r\n\tif (asset == asset_waiting_refill) {\r\n\t\tasset_waiting_refill = NULL;\r\n\t}\r\n\tpthread_mutex_unlock(&asset_refill_mutex);\r\n\r\n\tthis->discardCorrespondingSoundHandles(asset, true);\r\n\tassetLoader->unregisterAsset(asset);\r\n\tKLBOpenSLSoundAsset* asset_candidate = NULL;\r\n\tfor (int i = 0; i < MAX_SOUND_ASSETS; ++i)\r\n\t{\r\n\t\tif (soundAssets[i] == asset)\r\n\t\t{\r\n\t\t\tDEBUG_PRINT(\"discarded asset idx=%d\", i);\r\n\t\t\tsoundAssets[i] = NULL;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tpthread_mutex_unlock(&cs_mutex);\r\n}\r\n\r\nKLBOpenSLSoundHandle* KLBOpenSLEngine::assignSoundHandle(KLBOpenSLSoundAsset *pAsset) {\r\n\tint dequeue_candidate = -1;\r\n\ts64 dequeue_candidate_start_at = 9223372036854775807LL;\r\n\tpthread_mutex_lock(&cs_mutex);\r\n\tKLBOpenSLSoundHandle** handle;\r\n\tif (!pAsset->isSE()) {\r\n\t\t// try to reuse sound-handle for BGM\r\n\t\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t\t{\r\n\t\t\thandle = soundHandles + i;\r\n\t\t\tif (*handle != NULL && (*handle)->isInitiated() && (*handle)->getSoundAsset() == pAsset) {\r\n\t\t\t\treturn *handle;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfor (int i = 0; i < MAX_SOUND_HANDLE; ++i)\r\n\t{\r\n\t\thandle = soundHandles + i;\r\n\t\tif (*handle == NULL)\r\n\t\t{\r\n\t\t\t// DEBUG_PRINT(\"assigning new sound handle: %d\", i);\r\n\t\t\t*handle = new KLBOpenSLSoundHandle();\r\n\t\t\tdequeue_candidate = -1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\telse if ((*handle)->isInitiated() && (*handle)->getSoundAsset()->isFullyBuffered() && !(*handle)->isPlaying())\r\n\t\t{\r\n\t\t\t// DEBUG_PRINT(\"reusing handle pointer: %d\", i);\r\n\t\t\tdequeue_candidate = -1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// TODO: prioritize. BGM > single SE > multi SE\r\n\t\t\tif ((*handle)->getSoundAsset()->isFullyBuffered() && (*handle)->getTimeStarted() < dequeue_candidate_start_at) {\r\n\t\t\t\tdequeue_candidate_start_at = (*handle)->getTimeStarted();\r\n\t\t\t\tdequeue_candidate = i;\r\n\t\t\t\t// DEBUG_PRINT(\"deque candidate updated: %d\", dequeue_candidate);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (dequeue_candidate != -1) {\r\n\t\t// DEBUG_PRINT(\"deque&reassign: %d\", dequeue_candidate);\r\n\t\thandle = soundHandles + dequeue_candidate;\r\n\t\t(*handle)->stop();\r\n\t}\r\n\r\n\t(*handle)->setSoundAsset(pAsset);\r\n\tpthread_mutex_unlock(&cs_mutex);\r\n\treturn *handle;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBOpenSLSoundAsset.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CAndroidPathConv.h\"\r\n#include \"KLBOpenSLAudioPlayer.h\"\r\n#include \"ivorbisfile.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n\r\n#define min(a, b) ((a) < (b) ? (a) : (b))\r\nsize_t KLBOpenSLSoundAsset::read_func(void *ptr, size_t size, size_t nmemb, void *datasource) {\r\n\tKLBOpenSLSoundAsset* me = (KLBOpenSLSoundAsset*)datasource;\r\n\r\n\t// http://xiph.org/vorbis/doc/vorbisfile/callbacks.html\r\n\t// > short reads mean nothing special (short reads are not treated as error conditions)\r\n\t// So, we actually don't need to perform memcpy(). Just rewrite pointer reference and\r\n\t// return length.\r\n\tunsigned int requested_size = (unsigned int)nmemb * (unsigned int)size;\r\n\tint bytes_read = 0;\r\n\tbytes_read = fread(ptr, 1, requested_size, me->fp);\r\n\tme->decryptor.decryptBlck(ptr, bytes_read);\r\n\tme->src_location += bytes_read;\r\n\t// DEBUG_PRINT(\"AUDIO; read_func(requested=%d, actually read=%d, loc=%d)\", requested_size, bytes_read, me->src_location);\r\n\treturn bytes_read;\r\n}\r\n\r\nint KLBOpenSLSoundAsset::seek_func(void *datasource, ogg_int64_t offset, int whence) {\r\n\tKLBOpenSLSoundAsset* me = (KLBOpenSLSoundAsset*)datasource;\r\n\r\n\tunsigned int new_pos = me->src_location;\r\n\t// DEBUG_PRINT(\"new_pos initiated as %d\", new_pos);\r\n\t// TODO: proper seeking(could contain synchronous blocks reading)\r\n\tif (whence == SEEK_SET)\r\n\t\tnew_pos = (unsigned int)offset;\r\n\telse if (whence == SEEK_CUR)\r\n\t\tnew_pos += (unsigned int)offset;\r\n\telse if (whence == SEEK_END)\r\n\t\tnew_pos = me->getSrcFileSize();\r\n\t// DEBUG_PRINT(\"AUDIO; seek_func(current=%d, offset=%d, whence=%d, new=%d)\", me->src_location, (unsigned int)offset, whence, new_pos);\r\n\tme->src_location = new_pos;\r\n\t\r\n\tfseek(me->fp, me->src_location + (me->decryptor.m_useNew ? 4 : 0), SEEK_SET);\r\n\tme->decryptor.gotoOffset(me->src_location);\r\n\t// TODO: update PCM buffer offset(pcm_total_read_pos)\r\n\r\n\treturn 0;\r\n}\r\n\r\nint KLBOpenSLSoundAsset::close_func(void *datasource) {\r\n\tKLBOpenSLSoundAsset* me = (KLBOpenSLSoundAsset*)datasource;\r\n\t// DEBUG_PRINT(\"AUDIO; close_func()\");\r\n\tif (me->fp != NULL) {\r\n\t\tfclose(me->fp);\r\n\t\tme->fp = NULL;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nlong KLBOpenSLSoundAsset::tell_func(void *datasource) {\r\n\tKLBOpenSLSoundAsset* me = (KLBOpenSLSoundAsset*)datasource;\r\n\t// DEBUG_PRINT(\"AUDIO; tell_func(): pos=%d\", (unsigned int)me->src_location);\r\n\r\n\treturn (long)me->src_location;\r\n}\r\n\r\nKLBOpenSLSoundAsset::KLBOpenSLSoundAsset(const char * path, bool is_se) :\r\npcm_samples(NULL),\r\nfp(NULL),\r\nsrc_location(0),\r\nsrc_buf_flags(0x00),\r\npcm_buffer_read_pos(0),\r\npcm_buffer_consumed_pos(0),\r\npcm_total_read_pos(0)\r\n{\r\n    DEBUG_PRINT(\"AUDIO; construct KLBOpenSLSoundAsset(path: %s)\", path);\r\n\tKLBOpenSLSoundAsset::is_se = is_se;\r\n\tsrc_path = path;\r\n    src_full_path = CAndroidPathConv::getInstance().fullpath(path, \".ogg\");\r\n    // DEBUG_PRINT(\"path=%s, fullpath=%s\", path, src_full_path);\r\n\tfp = fopen(src_full_path, \"rb\");\r\n\tassert(fp != NULL);\r\n\r\n\tfseek(fp, 0, SEEK_END);\r\n\tfgetpos(fp, (fpos_t*)&src_file_size);\r\n\tfseek(fp, 0, SEEK_SET);\r\n\r\n\tu8 hdr[4];\r\n\thdr[0] = 0;\r\n\thdr[1] = 0;\r\n\thdr[2] = 0;\r\n\thdr[3] = 0;\r\n\tfread(hdr, 1, 4, fp);\r\n\r\n\tif (is_se)\r\n\t{\r\n\t\tthis->src_buf_flags |= 0x04;\r\n\t}\r\n\r\n\tdecryptor.decryptSetup((const u8*)src_full_path, hdr);\r\n\tif (decryptor.m_useNew) {\r\n\t\tsrc_file_size -= 4;\r\n\t}\r\n\telse {\r\n\t\tfseek(fp, 0, SEEK_SET);\r\n\t}\r\n\r\n    DEBUG_PRINT(\"AUDIO; src_file=%s, src_file_size=%d\", src_full_path, src_file_size);\r\n    DEBUG_PRINT(\"AUDIO; allocating Vorbis-file object\");\r\n\tvf = (OggVorbis_File*)calloc(1, sizeof(OggVorbis_File));\r\n    // DEBUG_PRINT(\"AUDIO; setting callbacks\");\r\n    ov_callbacks callbacks;\r\n\tcallbacks.read_func = &KLBOpenSLSoundAsset::read_func;\r\n\tcallbacks.seek_func = &KLBOpenSLSoundAsset::seek_func;\r\n\tcallbacks.close_func = &KLBOpenSLSoundAsset::close_func;\r\n\tcallbacks.tell_func = &KLBOpenSLSoundAsset::tell_func;\r\n    // DEBUG_PRINT(\"AUDIO; opening ogg-vorbis stream\");\r\n    int iRet = ov_open_callbacks(this, vf, NULL, 0, callbacks);\r\n    // DEBUG_PRINT(\"AUDIO; ov_open_callbacks returned %d\", iRet);\r\n\r\n    assert(0 == iRet);\r\n\r\n\tvorbis_info* vi = ov_info(vf, -1);\r\n\togg_int64_t uiPCMSamples = ov_pcm_total(vf, -1);\r\n    // DEBUG_PRINT(\"AUDIO; total PCM samples=%d\", uiPCMSamples);\r\n\tassert(0 < uiPCMSamples);\r\n\tDEBUG_PRINT(\"uiPCMSamples size: %lld, channels: %d, version: %d, %ldHz\", uiPCMSamples, vi->channels, vi->version, vi->rate);\r\n\tif (uiPCMSamples == OV_EINVAL) {\r\n\t\t// TODO: proper error handling\r\n\t\treturn;\r\n\t}\r\n\tplaytime_ms = (int)((uiPCMSamples * 1000) / vi->rate);\r\n\tchannels = vi->channels;\r\n    DEBUG_PRINT(\"AUDIO; total channels=%d\", channels);\r\n\tpcm_total_samples = (unsigned int)uiPCMSamples * channels;\r\n\tpcm_buffer_size = isFullyBuffered() ? pcm_total_samples : min(pcm_total_samples, MAX_BUFFER_SAMPLES);\r\n\tpcm_samples = (short*)malloc(pcm_buffer_size * sizeof(s16));\r\n\tpcm_sampling_rate = vi->rate;\r\n    DEBUG_PRINT(\"AUDIO; PCM buffer size=%d, PCM samples addr=%d\", pcm_buffer_size, (int)pcm_samples);\r\n}\r\n\r\nKLBOpenSLSoundAsset::~KLBOpenSLSoundAsset()\r\n{\r\n\tDEBUG_PRINT(\"AUDIO; unloading asset: %s\", src_full_path);\r\n\tKLBOpenSLEngine::getInstance()->unload(this);\r\n\t// REPORT_METRICS(\"about to clear vf\");\r\n\tif (vf != NULL) {\r\n\t\tthis->closeVorbisFile();\r\n\t}\r\n\t// REPORT_METRICS(\"about to free pcm_samples\");\r\n\tfree(pcm_samples);\r\n\t// REPORT_METRICS(\"about to free vf\");\r\n\tfree(vf);\r\n\t// REPORT_METRICS(\"done\");\r\n\tdelete [] src_full_path;\r\n}\r\n\r\nvoid KLBOpenSLSoundAsset::closeVorbisFile()\r\n{\r\n\tif (vf != NULL) {\r\n\t\tov_clear(vf);\r\n\t\tvf = NULL;\r\n\t}\r\n\t// close file for sure (actually, this should've been done in ov_clear())\r\n\tif (fp != NULL)\r\n\t{\r\n\t\tfclose(fp);\r\n\t\tfp = NULL;\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundAsset::stopAll()\r\n{\r\n\tKLBOpenSLEngine::getInstance()->discardCorrespondingSoundHandles(this);\r\n}\r\n\r\nvoid KLBOpenSLSoundAsset::prepare(int frames)\r\n{\r\n\tif (frames == -1) {\r\n\t\tis_se = true;\r\n\t}\r\n\t// DEBUG_PRINT(\"AUDIO; performing prepare(%d against %d)\", frames, pcm_buffer_size);\r\n\tif (pcm_buffer_size < frames)\r\n\t{\r\n\t\tDEBUG_PRINT(\"AUDIO; quitting prepare\");\r\n\t\t// TODO: proper error handling\r\n\t\treturn;\r\n\t}\r\n\treadVorbisSamples(frames);\r\n}\r\n\r\nvoid KLBOpenSLSoundAsset::readVorbisSamplesImpl(int samplesToRead) {\r\n\tbool close_vorbis_after_reading = false;\r\n\tif (pcm_buffer_size < samplesToRead)\r\n\t{\r\n\t\t// too large samples count specified\r\n\t\t// TODO: proper error handling\r\n\t\treturn;\r\n\t}\r\n\tif (pcm_total_samples == pcm_total_read_pos) {\r\n\t\tDEBUG_PRINT(\"AUDIO; end of buffer reached\");\r\n\t\treturn;\r\n\t}\r\n\t// DEBUG_PRINT(\"start pos=%d, total samples=%d, total read=%d, samplesToRead=%d, offset=%d\", (int)pcm_samples, pcm_total_samples, pcm_total_read_pos, samplesToRead, pcm_buffer_read_pos);\r\n\tif (pcm_buffer_read_pos == pcm_buffer_size)\r\n\t{\r\n\t\tpcm_buffer_read_pos = 0;\r\n\t}\r\n\tif (pcm_buffer_consumed_pos == pcm_buffer_size)\r\n\t{\r\n\t\tpcm_buffer_consumed_pos = 0;\r\n\t}\r\n\tshort* pcm_buf_read_start_pos = pcm_samples + pcm_buffer_read_pos;\r\n\tif (samplesToRead == -1)\r\n\t{\r\n\t\tif (isFullyBuffered()) {\r\n\t\t\tsamplesToRead = pcm_buffer_size;\r\n\t\t\tclose_vorbis_after_reading = true;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tsamplesToRead = min(DEFAULT_LOAD_SAMPLES, pcm_total_samples - pcm_total_read_pos);\r\n\t\t}\r\n\t\t// DEBUG_PRINT(\"auto refill. size=%d\", samplesToRead);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tint buffer_size_overflow = pcm_buffer_read_pos + samplesToRead - pcm_buffer_size;\r\n\t\tDEBUG_PRINT(\"bufsize to overflow=%d\", buffer_size_overflow);\r\n\t\tif (0 < buffer_size_overflow)\r\n\t\t{\r\n\t\t\t// this should normally never happen (or, adjust buffer size not to happen)\r\n\t\t\tunsigned int buf_read_first_phase = pcm_buffer_size - pcm_buffer_read_pos;\r\n\t\t\tDEBUG_PRINT(\"read on first page=%d\", buf_read_first_phase);\r\n\t\t\treadVorbisSamples(buf_read_first_phase);\r\n\t\t\tpcm_buf_read_start_pos += buf_read_first_phase;\r\n\t\t\tsamplesToRead -= buf_read_first_phase;\r\n\t\t}\r\n\t}\r\n\tint currentSection = 0;\r\n\ts64 bytesRead = 0;\r\n\tint bufPos = 0;\r\n\t// DEBUG_PRINT(\"performing actual Vorbis->PCM decode: addr=%d\", (int)pcm_buf_read_start_pos);\r\n\tdo\r\n\t\t{\r\n\t\t\t// DEBUG_PRINT(\"filling ptr: %d, snd buffer pos: %d\", (int)(pcm_buf_read_start_pos + bufPos), bufPos);\r\n\t\t\tu16 bytesToRead = min(VORBIS_READ_BUFFER, (samplesToRead - bufPos) * 2);\r\n\t\t\tbytesRead = ov_read(vf, (char *)(pcm_buf_read_start_pos + bufPos), bytesToRead, &currentSection);\r\n\t\t\tbufPos += (int)bytesRead >> 1; /* divide by 2 for buffer=short */\r\n\t\t} while (0 < bytesRead && bufPos < samplesToRead);\r\n\tpcm_buffer_read_pos += samplesToRead;\r\n\tpcm_total_read_pos += samplesToRead;\r\n\tif (close_vorbis_after_reading)\r\n\t{\r\n\t\tcloseVorbisFile();\r\n\t}\r\n\t// DEBUG_PRINT(\"snd buffer filled with %d samples(pcm_buffer_read_pos=%d against pcm_buffer_size=%d)\", bufPos, pcm_buffer_read_pos, pcm_buffer_size);\r\n}\r\n\r\nvoid KLBOpenSLSoundAsset::fetchNextPcmBuffer(KLBOpenSLSoundHandle* soundHandle) {\r\n\t// DEBUG_PRINT(\"AUDIO; fetching next pcm buf. bits=%d\", soundHandle->getPcmDepth() * 8);\r\n\tif (!isFullyBuffered()) {\r\n\t\t// DEBUG_PRINT(\"AUDIO; pcm_buffer_read_pos=%d, pcm_buffer_consumed_pos=%d, pcm_total_samples=%d, pcm_total_read_pos=%d, soundHandle->consumed_pos=%d, pcm_buffer_size=%d\", pcm_buffer_read_pos, pcm_buffer_consumed_pos, pcm_total_samples, pcm_total_read_pos, soundHandle->consumed_pos, pcm_buffer_size);\r\n\t\tif (pcm_total_read_pos == pcm_total_samples && pcm_buffer_read_pos == pcm_buffer_consumed_pos) {\r\n\t\t\t// buffer end reached\r\n\t\t\tsoundHandle->head_bufsize = 0;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (soundHandle->consumed_pos == pcm_buffer_size) {\r\n\t\t\tsoundHandle->consumed_pos = 0;\r\n\t\t}\r\n\t}\r\n\tsoundHandle->current_head = (short*)(pcm_samples + soundHandle->consumed_pos);\r\n\tsoundHandle->head_bufsize = isFullyBuffered() ? DEFAULT_LOAD_SAMPLES : min(DEFAULT_LOAD_SAMPLES, pcm_buffer_read_pos - pcm_buffer_consumed_pos);\r\n\t// DEBUG_PRINT(\"AUDIO; consumed_pos=%d, head_bufsize=%d\", soundHandle->consumed_pos, soundHandle->head_bufsize);\r\n\tunsigned int new_consumed_pos = soundHandle->consumed_pos + soundHandle->head_bufsize;\r\n\tif (pcm_buffer_size < new_consumed_pos)\r\n\t{\r\n\t\tsoundHandle->head_bufsize -= new_consumed_pos - pcm_buffer_size;\r\n\t\tnew_consumed_pos = pcm_buffer_size;\r\n\t}\r\n\tsoundHandle->consumed_pos = new_consumed_pos;\r\n\tif (pcm_buffer_consumed_pos < new_consumed_pos)\r\n\t{\r\n\t\tpcm_buffer_consumed_pos = new_consumed_pos;\r\n\t}\r\n\tsoundHandle->head_bufsize *= soundHandle->getPcmDepth();\r\n\treturn;\r\n}\r\n\r\nvoid KLBOpenSLSoundAsset::close()\r\n{\r\n\r\n}\r\n\r\nKLBOpenSLSoundHandle* KLBOpenSLSoundAsset::play(KLBOpenSLSoundAsset::REPEAT_MODE mode, s32 _milisec, float _tgtVol, float _startVol)\r\n{\r\n\tDEBUG_PRINT(\"playing sound asset \\\"%s\\\" (mode=%d)\", src_full_path, mode);\r\n\tif (!isFullyBuffered() && mode == KLBOpenSLSoundAsset::INFINITE_LOOP)\r\n\t{\r\n\t\t// TODO: implement looping for BGMs\r\n\t}\r\n\tKLBOpenSLSoundHandle* soundHandle = KLBOpenSLEngine::getInstance()->assignSoundHandle(this);\r\n\tsoundHandle->play(_milisec, _tgtVol, _startVol);\r\n\treturn soundHandle;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBOpenSLSoundAssetLoader.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"KLBOpenSLAudioPlayer.h\"\r\n#include \"CAndroidPathConv.h\"\r\n#include \"ivorbisfile.h\"\r\n#include <unistd.h>\r\n\r\nKLBOpenSLSoundAssetLoader::KLBOpenSLSoundAssetLoader()\r\n{\r\n\tassets = (KLBOpenSLSoundAsset**) calloc(KLBOpenSLEngine::MAX_SOUND_ASSETS, sizeof(KLBOpenSLSoundAsset**));\r\n}\r\n\r\nKLBOpenSLSoundAssetLoader::~KLBOpenSLSoundAssetLoader()\r\n{\r\n\tstopObservation();\r\n\tfree(assets);\r\n}\r\n\r\nKLBOpenSLSoundAsset* KLBOpenSLSoundAssetLoader::openFile(char const *path, bool isFullBuffered)\r\n{\r\n    // DEBUG_PRINT(\"AUDIO; openFile\");\r\n    // DEBUG_PRINT(\"path: %s\", path);\r\n    const char* target_path = CAndroidPathConv::getInstance().fullpath(path, \".ogg\");\r\n\tKLBOpenSLSoundAsset* asset = NULL;\r\n\tif (access(target_path, F_OK) != -1) {\r\n\t\tasset = new KLBOpenSLSoundAsset(path, isFullBuffered);\r\n\t}\r\n\tdelete [] target_path;\r\n\treturn asset;\r\n}\r\n\r\nvoid KLBOpenSLSoundAssetLoader::startObservation() {\r\n\tif (observationThread == NULL)\r\n\t{\r\n\t\tobservationThread = CPFInterface::getInstance().platform().createThread(KLBOpenSLSoundAssetLoader::FileObservationThreadParam, this);\r\n\t}\r\n}\r\n\r\nint KLBOpenSLSoundAssetLoader::FileObservationThreadParam(void * hThread, void * data)\r\n{\r\n\tKLBOpenSLSoundAssetLoader* me = (KLBOpenSLSoundAssetLoader*)data;\r\n\twhile( 1 )\r\n\t{\r\n\t\tfor (int i = 0; i < KLBOpenSLEngine::MAX_SOUND_ASSETS; ++i)\r\n\t\t{\r\n\t\t\t// TODO: reuse unregistered assets\r\n\t\t\tKLBOpenSLSoundAsset* targetPtr = *(me->assets + i);\r\n\t\t\tif (targetPtr != NULL)\r\n\t\t\t{\r\n\t\t\t\t// DEBUG_PRINT(\"targetPtr: %d\", targetPtr);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tusleep(30000); // sleep for 30ms\r\n\t}\r\n\r\n\treturn 0; // exit\r\n}\r\n\r\nvoid KLBOpenSLSoundAssetLoader::registerAsset(KLBOpenSLSoundAsset *pAsset) {\r\n\tfor (int i = 0; i < KLBOpenSLEngine::MAX_SOUND_ASSETS; ++i)\r\n\t{\r\n\t\t// TODO: reuse unregistered assets\r\n\t\tKLBOpenSLSoundAsset* targetPtr = *(assets + i);\r\n\t\tif (targetPtr == NULL)\r\n\t\t{\r\n\t\t\ttargetPtr = pAsset;\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\t// buffer queue is full\r\n\t// TODO: remove unused asset from memory and retry\r\n}\r\n\r\nvoid KLBOpenSLSoundAssetLoader::stopObservation() {\r\n\tif (observationThread != NULL)\r\n\t{\r\n\t\tCPFInterface::getInstance().platform().deleteThread(observationThread);\r\n\t\tobservationThread = NULL;\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundAssetLoader::unregisterAsset(KLBOpenSLSoundAsset *pAsset) {\r\n\tfor (int i = 0; i < KLBOpenSLEngine::MAX_SOUND_ASSETS; ++i)\r\n\t{\r\n\t\t// TODO: reuse unregistered assets\r\n\t\tKLBOpenSLSoundAsset* targetPtr = *(assets + i);\r\n\t\tif (targetPtr != NULL && targetPtr == pAsset)\r\n\t\t{\r\n\t\t\ttargetPtr = NULL;\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\t// pointer not found\r\n\t// TODO: error handling\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBOpenSLSoundHandle.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// To change the template use AppCode | Preferences | File Templates.\r\n//\r\n\r\n\r\n#include \"KLBOpenSLAudioPlayer.h\"\r\n#include \"CAndroidRequest.h\"\r\n\r\nKLBOpenSLSoundHandle::KLBOpenSLSoundHandle() :\r\nis_initiated(false),\r\nis_loop_requested(false),\r\ncur_mbel(-1)\r\n{\r\n\tbuf_fill_lock = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;\r\n}\r\n\r\nKLBOpenSLSoundHandle::~KLBOpenSLSoundHandle()\r\n{\r\n\t// performing lock for sure (dtor could be called under playing status)\r\n\tpthread_mutex_lock(&buf_fill_lock);\r\n\tDEBUG_PRINT(\"AUDIO; destroying sound-handle\");\r\n\tdestroyOpenSLObjects();\r\n\tis_destroyed = true;\r\n\tpthread_mutex_unlock(&buf_fill_lock);\r\n\tpthread_mutex_destroy(&buf_fill_lock);\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::initInternalResources() {\r\n\tconsumed_pos = 0;\r\n\thead_bufsize = 0;\r\n\tis_playing = false;\r\n\tis_initiated = false;\r\n\tis_destroyed = false;\r\n\tstate = 0;\r\n\tvolume = 1.0f;\r\n\tm_interruptionType = KLBOpenSLEngine::eINTERRUPTION_TYPE_NONE;\r\n\tfade_param.m_fadeCnt = 0;\r\n\tfade_param.m_startVol = 1.0f;\r\n\tfade_param.m_endVol = 1.0f;\r\n\tfade_param.m_fadeRatio = 1.0f;\r\n\tfade_param.m_fadeMiliSec = 0;\r\n\tfade_param.m_nowFadeInterType = INTER_TYPE_NONE;\r\n\tfade_param.m_nowFadeType = FADE_TYPE_NONE;\r\n\tfade_param.m_bfade = false;\r\n\tfade_param.m_prevmseq = 0;\r\n\tlast_error = 0;\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::destroyOpenSLObjects() {\r\n\tif (bqPlayerObject != NULL)\r\n\t{\r\n\t\tif (bqPlayerPlay != NULL) {\r\n\t\t\tstop();\r\n\t\t}\r\n\t\t(*bqPlayerObject)->Destroy(bqPlayerObject);\r\n\t\tbqPlayerObject = NULL;\r\n\t\tbqPlayerPlay = NULL;\r\n\t\tbqPlayerBufferQueue = NULL;\r\n\t\tbqPlayerVol = NULL;\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::play(int _msec, float _tgtVol, float _startVol)\r\n{\r\n\tSLresult result;\r\n\ttime_elapsed = 0;\r\n\tconsumed_pos = 0;\r\n\tassert(bqPlayerPlay != NULL);\r\n\tresult = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\tfade_param.m_fadeRatio = (_startVol < 0.0f) ? (0.0f) : ((_startVol > 1.0f) ? 1.0f : _startVol);\r\n\tif( _msec > 0 ) {\r\n\t\tsetFadeParam(FADE_TYPE_PLAY, _tgtVol, _msec, INTER_TYPE_LINEAR, _startVol);\r\n\t}\r\n\trefreshVolume();\r\n\tfillPcmBuffer(bqPlayerBufferQueue, true);\r\n    state = IClientRequest::E_SOUND_STATE_PLAY;\r\n\tif (KLBOpenSLEngine::getInstance()->isSoundPaused()) {\r\n\t\tthis->pause();\r\n\t\tthis->setInterruptionType(KLBOpenSLEngine::eINTERRUPTION_TYPE_RESIGN_ACTIVE);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::stop(int _msec, float _tgtVol)\r\n{\r\n\tSLresult result;\r\n\tif( _msec <= 0 ) {\r\n\t\tif (state == IClientRequest::E_SOUND_STATE_PLAY) {\r\n\t\t\tDEBUG_PRINT(\"stop sound handle\");\r\n\t\t\tassert(bqPlayerPlay != NULL);\r\n\t\t\tresult = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_STOPPED);\r\n\t\t\tassert(SL_RESULT_SUCCESS == result);\r\n\t\t}\r\n\t\tif (bqPlayerBufferQueue != NULL) {\r\n\t\t\tresult = (*bqPlayerBufferQueue)->Clear(bqPlayerBufferQueue);\r\n\t\t\tassert(SL_RESULT_SUCCESS == result);\r\n\t\t}\r\n\t\ttime_elapsed = 0;\r\n\t\tconsumed_pos = 0;\r\n\t\tstate = IClientRequest::E_SOUND_STATE_STOP;\r\n\t} else {\r\n   \t\tsetFadeParam(FADE_TYPE_STOP, _tgtVol, _msec, INTER_TYPE_LINEAR, 0.0f);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::pause(int _msec, float _tgtVol)\r\n{\r\n    if (state == IClientRequest::E_SOUND_STATE_PLAY) {\r\n    \tif( _msec <= 0 ) {\r\n\t\t\tSLresult result;\r\n\t\t\tassert(bqPlayerPlay != NULL);\r\n\t\t\tresult = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);\r\n\t\t\tassert(SL_RESULT_SUCCESS == result);\r\n\t\t\ttime_elapsed += CAndroidRequest::getInstance()->nanotime() - time_started;\r\n\t\t\tstate = IClientRequest::E_SOUND_STATE_PAUSE;\r\n    \t} else {\r\n    \t\tsetFadeParam(FADE_TYPE_PAUSE, _tgtVol, _msec, INTER_TYPE_LINEAR, 0.0f);\r\n    \t}\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::resume(int _msec, float _tgtVol)\r\n{\r\n    if (state == IClientRequest::E_SOUND_STATE_PAUSE) {\r\n\t\tSLresult result;\r\n\t\tassert(bqPlayerPlay != NULL);\r\n\t\tresult = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);\r\n\t\tassert(SL_RESULT_SUCCESS == result);\r\n\t\tstate = IClientRequest::E_SOUND_STATE_PLAY;\r\n\t\tif( _msec > 0 ) {\r\n\t\t\tsetFadeParam(FADE_TYPE_RESUME, _tgtVol, _msec, INTER_TYPE_LINEAR, 0.0f);\r\n\t\t}\r\n\t\trefreshVolume();\r\n\t\tupdateTimeStarted();\r\n\t}\r\n}\r\n\r\ns32 KLBOpenSLSoundHandle::tellAudio()\r\n{\r\n\ts32 elapsed_sysclock_ms = 0;\r\n\tif (isPlaying()) {\r\n\t\telapsed_sysclock_ms = (s32)((CAndroidRequest::getInstance()->nanotime() - time_started + time_elapsed) / 1000000);\r\n\t}\r\n\telse {\r\n\t\telapsed_sysclock_ms = (s32)((time_elapsed) / 1000000);\r\n\t}\r\n\tSLresult result;\r\n\tSLmillisecond msec;\r\n\t// DEBUG_PRINT(\"before GetPosition\");\r\n\tresult = (*bqPlayerPlay)->GetPosition(bqPlayerPlay, &msec);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\t// DEBUG_PRINT(\"after GetPosition\");\r\n\ts32 ts_error = msec - elapsed_sysclock_ms;\r\n\ts32 ts_adj = (ts_error - last_error) >> 2;\r\n\t// DEBUG_PRINT(\"tellAudio ts_error=%d. diff delta=%d, adj=%d\", ts_error, ts_error - last_error, ts_adj);\r\n\tlast_error += ts_adj;\r\n\treturn elapsed_sysclock_ms + last_error;\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::closeAudio()\r\n{\r\n\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::setVolume(float volume)\r\n{\r\n\tKLBOpenSLSoundHandle::volume = volume;\r\n\trefreshVolume();\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::refreshVolume() {\r\n\tif (bqPlayerVol != NULL) {\r\n\t\tfloat actual_volume = KLBOpenSLEngine::getInstance()->GetMasterVolume(this->asset->isSE()) * fade_param.m_fadeRatio * volume;\r\n\t\tSLmillibel max_mbel = 0;\r\n\t\tint res = (*bqPlayerVol)->GetMaxVolumeLevel(bqPlayerVol, &max_mbel);\r\n\t\tassert(SL_RESULT_SUCCESS == res);\r\n\t\tSLmillibel mbel = gain_to_attenuation(actual_volume, max_mbel);\r\n\t\tif (mbel != cur_mbel) {\r\n\t\t\tDEBUG_PRINT(\"AUDIO; setting new volume: %f(%x), isSE=%d, masterVolume=%f, fadeRatio=%f, volume=%f\",\r\n\t\t\t\tactual_volume, mbel, this->asset->isSE(),\r\n\t\t\t\tKLBOpenSLEngine::getInstance()->GetMasterVolume(this->asset->isSE()), fade_param.m_fadeRatio, volume);\r\n\t\t\tres = (*bqPlayerVol)->SetVolumeLevel(bqPlayerVol, mbel);\r\n\t\t\tassert(SL_RESULT_SUCCESS == res);\r\n\t\t\tcur_mbel = mbel;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::updateFadeParam() {\r\n\ts64 nowSeq = 0;\r\n\r\n\tif ((fade_param.m_bfade == false) && (fade_param.m_nowFadeType != FADE_TYPE_NONE))\r\n\t{\r\n\t\tfade_param.m_bfade = true;\r\n\t\tfade_param.m_prevmseq = tellAudio();\r\n\t\t// DEBUG_PRINT(\"[sound] fade start!\");\r\n\t}\r\n\tif (fade_param.m_bfade)\r\n\t{\r\n\t\tnowSeq = tellAudio();\r\n\r\n\t\t// フェードカウントインクリメント\r\n\t\tfade_param.m_fadeCnt += (nowSeq - fade_param.m_prevmseq);\r\n\t\tif (fade_param.m_fadeCnt >= fade_param.m_fadeMiliSec) {\r\n\t\t\tfade_param.m_fadeCnt = fade_param.m_fadeMiliSec;\r\n\t\t} else if (fade_param.m_fadeCnt < 0) {\r\n\t\t\tfade_param.m_fadeCnt = 0;\r\n\t\t}\r\n\r\n\t\t// 係数計算\r\n\t\tif (fade_param.m_fadeCnt >= 0 && fade_param.m_fadeMiliSec > 0)\r\n\t\t{\r\n\t\t\tfade_param.m_fadeRatio = fade_param.m_startVol + ((fade_param.m_endVol - fade_param.m_startVol) * ((float)fade_param.m_fadeCnt / (float)fade_param.m_fadeMiliSec));\r\n\t\t\tif (fade_param.m_fadeRatio < 0.0f) {\r\n\t\t\t\tfade_param.m_fadeRatio = 0.0f;\r\n\t\t\t} else if (fade_param.m_fadeRatio > 1.0f) {\r\n\t\t\t\tfade_param.m_fadeRatio = 1.0f;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// サウンドに大して設定\r\n\t\trefreshVolume();\r\n\r\n\t\t// フェード終了の確認\r\n\t\tif (fade_param.m_fadeCnt >= fade_param.m_fadeMiliSec)\r\n\t\t{\r\n\t\t\tfade_param.m_fadeCnt = fade_param.m_fadeMiliSec;\r\n\t\t\tfade_param.m_bfade = false;\r\n\r\n\t\t\tif (fade_param.m_nowFadeType == FADE_TYPE_STOP)\r\n\t\t\t{\r\n\t\t\t\tDEBUG_PRINT(\"[sound] fade -> stopped\");\r\n\t\t\t\tstop();\r\n\t\t\t}\r\n\t\t\telse if (fade_param.m_nowFadeType == FADE_TYPE_PAUSE)\r\n\t\t\t{\r\n\t\t\t\tDEBUG_PRINT(\"[sound] fade -> paused\");\r\n\t\t\t\tpause();\r\n\t\t\t}\r\n\t\t\tfade_param.m_nowFadeType = FADE_TYPE_NONE;\r\n\t\t}\r\n\r\n\t\tfade_param.m_prevmseq = tellAudio();\r\n\t}\r\n}\r\n\r\nbool KLBOpenSLSoundHandle::setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVolume)\r\n{\r\n\tif (_startVolume < 0.0f) {\r\n\t\t_startVolume = 0.0f;\r\n\t}\r\n\telse if (1.0f < _startVolume) {\r\n\t\t_startVolume = 1.0f;\r\n\t}\r\n\tif (_msec <= 0 || _fadeType >= FADE_TYPE_NUM || _fadeType <= FADE_TYPE_NONE) {\r\n\t\t// フェードしないため初期化\r\n\t\tfade_param.m_nowFadeType = INTER_TYPE_NONE;\r\n\t\tfade_param.m_nowFadeType = FADE_TYPE_NONE;\r\n\t\tfade_param.m_endVol = 0.0f;\r\n\t\tfade_param.m_fadeCnt = 0;\r\n\t\tfade_param.m_fadeRatio = 1.0f;\r\n\t\tfade_param.m_fadeMiliSec = 0;\r\n\t\tfade_param.m_bfade = false;\r\n\t\tfade_param.m_prevmseq = 0;\r\n\t\treturn true;\r\n\t}\r\n\r\n\tfade_param.m_fadeCnt = 0;\r\n\tfade_param.m_endVol = _tgtVol;\r\n\tfade_param.m_nowFadeType = _fadeType;\r\n\tfade_param.m_nowFadeInterType = _interType;\r\n\tswitch (_fadeType) {\r\n\t\tcase FADE_TYPE_PLAY:\r\n\t\tcase FADE_TYPE_RESUME:\r\n\t\t\tfade_param.m_startVol = _startVolume;\r\n\t\t\tfade_param.m_fadeRatio = _startVolume;\r\n\t\t\tbreak;\r\n\r\n\t\tcase FADE_TYPE_STOP:\r\n\t\tcase FADE_TYPE_PAUSE:\r\n\t\tcase FADE_TYPE_PLAYING:\r\n\t\t\tfade_param.m_startVol = 1.0f;\r\n\t\t\tbreak;\r\n\t}\r\n\tfade_param.m_fadeMiliSec = _msec;\r\n\tfade_param.m_bfade = false;\r\n\tfade_param.m_prevmseq = 0;\r\n\treturn true;\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::setPan(float pan)\r\n{\r\n\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::setSoundAsset(KLBOpenSLSoundAsset *asset) {\r\n\t// destroy current OpenSL related objects if nb-channel or sampling-rate is not equal to prior sample\r\n\tif (is_initiated) {\r\n\t\tif (asset->getChannels() == this->pcm_channels && asset->getPcmSamplingRate() == this->pcm_sampling_rate) {\r\n\t\t\t// shortcut. simply change asset reference and initialize sound handle internal data\r\n\t\t\tDEBUG_PRINT(\"reusing most OpenSL stuff\");\r\n\t\t\tupdateAsset(asset);\r\n\t\t\tinitInternalResources();\r\n\t\t\tis_initiated = true;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tdestroyOpenSLObjects();\r\n\t\t}\r\n\t}\r\n\r\n\tinitInternalResources();\r\n\tupdateAsset(asset);\r\n\tSLEngineItf engine = KLBOpenSLEngine::getInstance()->engineEngine;\r\n\tSLresult result;\r\n\tSLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};\r\n\tSLDataFormat_PCM format_pcm = {\r\n\t\t\tSL_DATAFORMAT_PCM, this->getPcmChannels(), this->getSlSamplingRate(),\r\n\t\t\tthis->getSlSampleFormat(), this->getSlSampleFormat(),\r\n\t\t\tthis->getSlChannelMask(), SL_BYTEORDER_LITTLEENDIAN};\r\n\tSLDataSource audioSrc = {&loc_bufq, &format_pcm};\r\n\r\n\t// configure audio sink\r\n\tSLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, KLBOpenSLEngine::getInstance()->outputMixObject};\r\n\tSLDataSink audioSnk = {&loc_outmix, NULL};\r\n\r\n\t// create audio player\r\n\tconst SLInterfaceID ids[2] = {SL_IID_VOLUME, SL_IID_BUFFERQUEUE};\r\n\tconst SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};\r\n\tresult = (*engine)->CreateAudioPlayer(engine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\r\n\t// realize the player\r\n\tresult = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\r\n\t// get the play interface\r\n\tresult = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\r\n\t// get the buffer queue interface\r\n\tresult = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE,\r\n\t\t\t&bqPlayerBufferQueue);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\r\n\t// register callback on the buffer queue\r\n\tresult = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, KLBOpenSLSoundHandle::bqPlayerCallback, this);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\r\n\t// get the volume interface\r\n\tresult = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_VOLUME, &bqPlayerVol);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\r\n\tis_initiated = true;\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)\r\n{\r\n\tKLBOpenSLSoundHandle* soundHandle = (KLBOpenSLSoundHandle*)context;\r\n\tif (soundHandle != NULL) {\r\n\t\tsoundHandle->fillPcmBuffer(bq, false);\r\n\t}\r\n}\r\n\r\nvoid KLBOpenSLSoundHandle::fillPcmBuffer(SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue, bool is_starting) {\r\n\tpthread_mutex_lock(&buf_fill_lock);\r\n\tif (is_destroyed) {\r\n\t\tDEBUG_PRINT(\"called after object discarded\");\r\n\t\tpthread_mutex_unlock(&buf_fill_lock);\r\n\t\treturn;\r\n\t}\r\n\tSLresult result;\r\n\tasset->fetchNextPcmBuffer(this);\r\n\tif (head_bufsize == 0)\r\n\t{\r\n\t\tDEBUG_PRINT(\"AUDIO; playback finished\");\r\n\t\t// set the player's state to playing\r\n\t\tif (!asset->isSE())\r\n\t\t{\r\n\t\t\tif (!is_loop_requested) {\r\n\t\t\t\tDEBUG_PRINT(\"requesting loop\");\r\n\t\t\t\tis_loop_requested = true;\r\n\t\t\t\tpthread_mutex_unlock(&buf_fill_lock);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tDEBUG_PRINT(\"AUDIO; BGM loop detected. rebuffering\");\r\n\t\t\t\tasset->resetBuffer();\r\n\t\t\t\tasset->readVorbisSamples(-1);\r\n\t\t\t\tconsumed_pos = 0;\r\n\t\t\t\tasset->fetchNextPcmBuffer(this);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (repeatMode == KLBOpenSLSoundAsset::ONCE || true)\r\n\t\t{\r\n\t\t\tthis->stop();\r\n\t\t\tpthread_mutex_unlock(&buf_fill_lock);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tconsumed_pos = 0;\r\n\t\t\tpthread_mutex_unlock(&buf_fill_lock);\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\t// DEBUG_PRINT(\"AUDIO; enqueue PCM buffer (addr=%d, size=%d)\", (int)current_head, head_bufsize);\r\n\t// enqueue another buffer\r\n\tint bufsize_former = head_bufsize, bufsize_latter = 0;\r\n\tif ((is_starting || is_loop_requested) && !asset->isSE()) {\r\n\t\tDEBUG_PRINT(\"AUDIO; separating buffer queue\");\r\n\t\t// separate bufqueue\r\n\t\tbufsize_former >>= 1;\r\n\t\tbufsize_latter = head_bufsize - bufsize_former;\r\n\t}\r\n\tresult = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, current_head, bufsize_former);\r\n\tassert(SL_RESULT_SUCCESS == result);\r\n\tif (bufsize_latter != 0) {\r\n\t\tDEBUG_PRINT(\"AUDIO; enqueuing second buffer\");\r\n\t\tresult = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, (short*)((int)current_head + bufsize_former), bufsize_latter);\r\n\t\tassert(SL_RESULT_SUCCESS == result);\r\n\t}\r\n    if (is_starting) {\r\n    \tupdateTimeStarted();\r\n    }\r\n\r\n\tif (!asset->isFullyBuffered())\r\n\t{\r\n\t\t// DEBUG_PRINT(\"AUDIO; not a full buffer\");\r\n\t\tKLBOpenSLEngine::getInstance()->registerAssetForRefilling(asset);\r\n\t}\r\n\tif (is_loop_requested) {\r\n\t\tis_loop_requested = false;\r\n\t}\r\n\tpthread_mutex_unlock(&buf_fill_lock);\r\n\treturn;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBPlatformMetrics.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <sys/types.h>\r\n#include <unistd.h>\r\n\r\n#include \"BaseType.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n\r\nKLBPlatformMetrics::KLBPlatformMetrics() :\r\nlast_rss(-1),\r\nlog_buf_len(1024),\r\nlog_suffix(0),\r\nlogging_enabled(true),\r\nsignals_patched(false),\r\ndevice_ident(NULL),\r\ndevice_ident_len(0),\r\nlog_fp(NULL)\r\n{\r\n}\r\n\r\nKLBPlatformMetrics::~KLBPlatformMetrics() {\r\n}\r\n\r\nKLBPlatformMetrics* KLBPlatformMetrics::getInstance() {\r\n\tstatic KLBPlatformMetrics metrics;\r\n\treturn &metrics;\r\n}\r\n\r\nvoid KLBPlatformMetrics::patchSignals() {\r\n}\r\n\r\nvoid KLBPlatformMetrics::signalHandler(int signal, siginfo_t *info, void *reserved) {\r\n}\r\n\r\nvoid KLBPlatformMetrics::unpatchSignals() {\r\n}\r\n\r\nvoid KLBPlatformMetrics::start() {\r\n}\r\n\r\nvoid KLBPlatformMetrics::stop() {\r\n}\r\n\r\ns32 KLBPlatformMetrics::ReportingThreadParam(void * hThread, void * data)\r\n{\r\n    return 0;\r\n}\r\n\r\ns32 KLBPlatformMetrics::PostingThreadParam(void * hThread, void * data)\r\n{\r\n    return 0;\r\n}\r\n\r\nvoid KLBPlatformMetrics::rotateLog(bool is_lock_gained) {\r\n}\r\n\r\nint KLBPlatformMetrics::uploadLogs(bool is_terminating) {\r\n\treturn 0;\r\n}\r\n\r\nint KLBPlatformMetrics::rotateAndUploadLog(bool is_terminating) {\r\n\treturn 0;\r\n}\r\n\r\nvoid KLBPlatformMetrics::appendLog(const char* msg, int msg_len, u8 msg_type) {\r\n}\r\n\r\nvoid KLBPlatformMetrics::reportImmediately(const char* msg) {\r\n}\r\n\r\nint KLBPlatformMetrics::getFdCount() {\r\n\treturn 0;\r\n}\r\n\r\nvoid KLBPlatformMetrics::getOrGenerateDeviceIdent(const char* basefile_path) {\r\n}\r\n\r\nint KLBPlatformMetrics::generateDeviceIdent(char* outbuf, int buflen)\r\n{\r\n\treturn 0;\r\n}\r\n\r\ninline int KLBPlatformMetrics::logMeasuringThreadCpu(u16 target) {\r\n\treturn 0;\r\n}\r\n\r\nvoid KLBPlatformMetrics::measureThreadCpu(u16 target) {\r\n}\r\n\r\nvoid KLBPlatformMetrics::logFrameSummary(int deltaT, s64 frameProcStart) {\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/KLBPlatformMetrics.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLBPlatformMetrics_h\r\n#define KLBPlatformMetrics_h\r\n\r\n#include <malloc.h>\r\n#include <pthread.h>\r\n#include <sys/resource.h>\r\n#include <signal.h>\r\n\r\n#include \"curl.h\"\r\n#include \"KLBPlatformMetricsCommon.h\"\r\n\r\n#if defined(DEBUG) || defined(DEBUG_PERFORMANCE)\r\n# undef REPORT_METRICS\r\n# define REPORT_METRICS(msg) KLBPlatformMetrics::getInstance()->reportImmediately(msg)\r\n# undef MEASURE_THREAD_CPU_BEGIN\r\n# define MEASURE_THREAD_CPU_BEGIN(type) KLBPlatformMetrics::getInstance()->measureThreadCpu(TASKTYPE_BEGIN | (type))\r\n# undef MEASURE_THREAD_CPU_END\r\n# define MEASURE_THREAD_CPU_END(type)   KLBPlatformMetrics::getInstance()->measureThreadCpu(TASKTYPE_END   | (type))\r\n#endif\r\n\r\nclass KLBPlatformMetrics {\r\npublic:\r\n\t~KLBPlatformMetrics();\r\n    static KLBPlatformMetrics* getInstance();\r\n\tstatic s32 ReportingThreadParam(void * hThread, void * data);\r\n\tstatic s32 PostingThreadParam(void * hThread, void * data);\r\n\tvoid start();\r\n\tvoid stop();\r\n\tvoid reportImmediately(const char* msg = \"\");\r\n\tvoid appendLog(const char* msg, int msg_len = 0, u8 msg_type = MSGTYPE_RAWLOG);\r\n\tvoid rotateLog(bool is_lock_gained = false);\r\n\tint uploadLogs(bool is_terminating = false);\r\n\tint rotateAndUploadLog(bool is_terminating = false);\r\n\tinline struct sigaction* getDefaultSignalHandlers() { return &default_signal_handlers[0]; }\r\n\tvoid measureThreadCpu(u16 type);\r\n\tvoid logFrameSummary(int deltaT, s64 frameProcStart);\r\n\r\nprivate:\r\n\tKLBPlatformMetrics();\r\n\tvoid patchSignals();\r\n\tvoid unpatchSignals();\r\n\tstatic void signalHandler(int signal, siginfo_t *info, void *reserved);\r\n\tint getFdCount();\r\n\tvoid getOrGenerateDeviceIdent(const char* basefile_path);\r\n\tint generateDeviceIdent(char* outbuf, int buflen);\r\n\tint logMeasuringThreadCpu(u16 target);\r\n\r\n\tbool signals_patched;\r\n    void* reportingThread;\r\n    void* postingThread;\r\n\tstatic const int REPORT_INTERVAL_SEC = 2;\r\n\tint page_size;\r\n\tlong last_rss;\r\n\tpthread_mutex_t report_mutex;\r\n\tpthread_mutex_t logging_mutex;\r\n\tpthread_mutex_t thlog_mutex;\r\n\tstruct rusage basic_metrics;\r\n\tstruct mallinfo malloc_info;\r\n\tstruct sigaction pfmtrx_signal_handler;\r\n\tstruct sigaction default_signal_handlers[NSIG];\r\n\tchar* log_buf;\r\n\tunsigned log_buf_len;\r\n\tint log_suffix;\r\n    const char* log_fullpath;\r\n\tCURL* curl_obj;\r\n\tbool logging_enabled;\r\n\tchar* device_ident;\r\n\tint device_ident_len;\r\n\tFILE* log_fp;\r\n\tenum MSGTYPES {\r\n\t\tMSGTYPE_INIT = 1,\r\n\t\tMSGTYPE_RAWLOG = 2,\r\n\t\tMSGTYPE_RES_REPORT = 3,\r\n\t\tMSGTYPE_SCREENSHOT = 4,\r\n\t\tMSGTYPE_THREAD_MEASURE = 5,\r\n\t\tMSGTYPE_FRAME_SUMMARY = 6\r\n\t};\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/PackageDefine.h",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//====================================================================\r\n/*\r\n  パッケージ作成用define定義\r\n */\r\n//====================================================================\r\n#ifndef __PACKAGE_DEF_H__\r\n#define __PACKAGE_DEF_H__\r\n\r\n//#define __HAKONIWA\r\n//#define __LOVELIVE\r\n\r\n#define GET_XSTR(s) GET_STR(s)\r\n#define GET_STR(s) #s\r\n\r\n//====================================================================\r\n/*\r\n  javaとC,C++をつなげる部分用の定義\r\n  ※ パッケージ名を変更した場合、ここも変更する事!!!\r\n */\r\n//------------------------------------------------\r\n#if defined __HAKONIWA\r\n// 箱庭\r\n#define JAVA_FUNC( func ) Java_klb_android_hakoniwa_PFInterface_##func\r\n#define PROC_FUNC( func ) proc_app_klb_android_hakoniwa_PFInterface_##func\r\n#define APP_FUNC( func )  app_klb_android_hakoniwa_PFInterface_##func\r\n\r\n#define APP_LOAD_PATH \"/data/data/klb.android.hakoniwa/lib/libGame.so\"\r\n#define JNI_LOAD_PATH \"klb/android/hakoniwa/PFInterface\"\r\n#define JNI_FONTMANAGER_LOAD_PATH \"klb/android/hakoniwa/FontManager\"\r\n\r\n//------------------------------------------------\r\n#elif defined __LOVELIVE\r\n\r\n#define JAVA_FUNC( func ) Java_klb_android_lovelive_PFInterface_##func\r\n#define PROC_FUNC( func ) proc_app_klb_android_lovelive_PFInterface_##func\r\n#define APP_FUNC( func )  app_klb_android_lovelive_PFInterface_##func\r\n\r\n#define APP_LOAD_PATH \"/data/data/klb.android.lovelive/lib/libGame.so\"\r\n#define JNI_LOAD_PATH \"klb/android/lovelive/PFInterface\"\r\n#define JNI_FONTMANAGER_LOAD_PATH \"klb/android/lovelive/FontManager\"\r\n\r\n//------------------------------------------------\r\n#else\r\n// デフォルト(GameEngine)\r\n#define JAVA_FUNC( func ) Java_klb_android_GameEngine_PFInterface_##func\r\n#define PROC_FUNC( func ) proc_app_klb_android_GameEngine_PFInterface_##func\r\n#define APP_FUNC( func )  app_klb_android_GameEngine_PFInterface_##func\r\n\r\n#define APP_LOAD_PATH \"/data/data/klb.android.GameEngine/lib/libGame.so\"\r\n#define JNI_LOAD_PATH \"klb/android/GameEngine/PFInterface\"\r\n#define JNI_FONTMANAGER_LOAD_PATH \"klb/android/GameEngine/FontManager\"\r\n\r\n#endif\r\n\r\n#endif //__PACKAGE_DEF_H__\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android/assert.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"assert.h\"\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <android/log.h>\r\n#include \"CPFInterface.h\"\r\n//#include <stdarg.h>\r\n\r\nextern \"C\" {\r\nvoid assertFunction(int line, const char* file, const char* msg,...) {\r\n\tva_list\targp;\r\n\tchar pszBuf [1024];\r\n\tchar buf[1024];\r\n\r\n\tva_start(argp, msg);\r\n\tvsprintf( pszBuf, msg, argp);\r\n\tva_end(argp);\r\n\r\n\tsprintf(buf, \"Assert l.%i in %s : \\n%s\\n\", line, file, pszBuf);\r\n\tDEBUG_PRINT(buf);\r\n\tabort();\r\n}\r\n\r\nvoid msgBox(char * log)\r\n{\r\n\r\n}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Android.mk",
    "content": "LOCAL_PATH:= $(call my-dir)\r\n\r\n\r\n# ---------------------\r\ninclude $(CLEAR_VARS)\r\n#\r\nDEBUG_FLAGS\t\t:=\r\n#DEBUG_FLAGS\t\t+=\t-DDEBUG_MODIFIER\r\n#DEBUG_FLAGS\t\t+=\t-DDEBUG_PERFORMANCE\r\n#DEBUG_FLAGS\t\t+=\t-DDEBUG_MEMORY\r\n#DEBUG_FLAGS\t\t+=\t-DDEBUG_LUA\r\nDEBUG_FLAGS\t\t+=\t-DDEBUG_NULLTASK\r\nDEBUG_FLAGS\t\t+=\t-DDEBUG_MENU\r\n\r\nifeq ($(TARGET_ARCH),arm)\r\n  LOCAL_LDLIBS\t:= -L$(LOCAL_PATH)/../obj/local/armeabi -lcurl\r\nendif\r\n\r\nifeq ($(TARGET_ARCH),x86)\r\n  LOCAL_LDLIBS\t:= -L$(LOCAL_PATH)/../obj/local/x86 -lcurl\r\nendif\r\n\r\nifdef ($(USE_LUAJIT))\r\n  LOCAL_LDLIBS  += -lluajit-5.1\r\nendif\r\n\r\n# basic libraries\r\nLOCAL_LDLIBS    += -llog -lGLESv1_CM -ldl -lz -lOpenSLES\r\n\r\n# OpenGL ES 2.0/3.0 support\r\nifdef ($(USE_GLES2))\r\n  LOCAL_LDLIBS\t+=\t-lGLESv2\r\n  DEBUG_FLAGS\t+=\t-DOPENGL2\r\nendif\r\nifdef ($(USE_GLES3))\r\n  LOCAL_LDLIBS\t+=\t-lGLESv3\r\n  DEBUG_FLAGS\t+=\t-DOPENGL3\r\nendif\r\n\r\n# for freetype2\r\nLOCAL_LDLIBS    += -lfreetype2\r\n\r\n# all directories contain .h files is regarded as include dir\r\nLOCAL_C_INCLUDES :=\t$(ANDROID_NDK_ROOT)/platforms/android-9/arch-$(TARGET_ARCH)/usr/include/\r\nLOCAL_C_INCLUDES +=\t$(shell find ./jni -regex '.*\\.h$$' | sed 's/\\/[^\\/]*$$//' | sort | uniq)\r\n\r\n# all *.c/*.cpp files under src dirs are listed for building\r\nSRC_DIRS    := ./jni/include\r\nSRC_DIRS    += ./jni/libs\r\nSRC_DIRS    += ./jni/source\r\nSRC_DIRS    += ./jni/custom\r\nSRC_DIRS    += ./jni/Android\r\nSRC_DIRS    += ./jni/UserTask \r\nSRC_FILES   :=\t$(shell find $(SRC_DIRS) -name \"*.c\" -or -name \"*.cpp\")\r\n\r\nLOCAL_SRC_FILES\t:=\t$(subst ./jni/,,$(SRC_FILES))\r\n\r\nENGINE_GITHASH  := $(shell git log --pretty=format:%h -1)\r\n# force refresh engine hash\r\n$(shell touch ./jni/Android/KLBPlatformMetrics.cpp)\r\n\r\nLOCAL_CFLAGS    := -DDEBUG -DLUA_ANSI -DIOAPI_NO_64 $(DEBUG_FLAGS) -DENGINE_GITHASH='\"$(ENGINE_GITHASH)\"'\r\nLOCAL_CPPFLAGS  := -fexceptions -fno-rtti\r\nLOCAL_MODULE    := libGame\r\n\r\nifeq ($(TARGET_ARCH),arm)\r\n# notice: these assembly files (*.s) generate compile-time warnings under Clang but they are harmless.\r\n  LOCAL_SRC_FILES += \\\r\n\t./libs/Tremolo/bitwiseARM.s \\\r\n\t./libs/Tremolo/dpen.s \\\r\n\t./libs/Tremolo/floor1ARM.s \\\r\n\t./libs/Tremolo/mdctARM.s\r\n  LOCAL_CFLAGS += -D_ARM_ASSEM_\r\n\r\n  LOCAL_ARM_MODE  := arm\r\n  LOCAL_ARM_NEON  := true\r\n  TARGET_ARCH_ABI := armeabi-v7a\r\n  LOCAL_CFLAGS    += -O3 -mcpu=cortex-a8 -mfloat-abi=softfp -fPIC -march=armv7-a -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums\r\nelse\r\n  LOCAL_CFLAGS += -DONLY_C\r\nendif\r\n\t\t\t\t\t\r\n\r\ninclude $(BUILD_SHARED_LIBRARY)\r\n# ---------------------\r\n\r\n\r\n# ---------------------\r\ninclude $(CLEAR_VARS)\r\n\r\nifeq ($(TARGET_ARCH),arm)\r\n  LOCAL_ARM_MODE  := arm\r\n  LOCAL_ARM_NEON  := true\r\n  TARGET_ARCH_ABI := armeabi-v7a\r\nendif\r\n\r\nLOCAL_MODULE    := libjniproxy\r\nLOCAL_C_INCLUDES := ./jni/proxy\r\nLOCAL_CFLAGS    := -Werror\r\nLOCAL_SRC_FILES := proxy/jniproxy.cpp\r\nLOCAL_LDLIBS    := -llog\r\n\r\ninclude $(BUILD_SHARED_LIBRARY)\r\n# ---------------------\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/Application.mk",
    "content": "APP_PLATFORM := android-9\r\nAPP_STL := stlport_static\r\nNDK_TOOLCHAIN_VERSION=clang\r\nAPP_ABI := x86 armeabi\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/curl.h",
    "content": "#ifndef __CURL_CURL_H\r\n#define __CURL_CURL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * If you have libcurl problems, all docs and details are found here:\r\n *   http://curl.haxx.se/libcurl/\r\n *\r\n * curl-library mailing list subscription and unsubscription web interface:\r\n *   http://cool.haxx.se/mailman/listinfo/curl-library/\r\n */\r\n\r\n#include \"curlver.h\"         /* libcurl version defines   */\r\n#include \"curlbuild.h\"       /* libcurl build definitions */\r\n#include \"curlrules.h\"       /* libcurl rules enforcement */\r\n\r\n/*\r\n * Define WIN32 when build target is Win32 API\r\n */\r\n\r\n#if (defined(_WIN32) || defined(__WIN32__)) && \\\r\n     !defined(WIN32) && !defined(__SYMBIAN32__)\r\n#define WIN32\r\n#endif\r\n\r\n#include <stdio.h>\r\n#include <limits.h>\r\n\r\n#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)\r\n/* Needed for __FreeBSD_version symbol definition */\r\n#include <osreldate.h>\r\n#endif\r\n\r\n/* The include stuff here below is mainly for time_t! */\r\n#include <sys/types.h>\r\n#include <time.h>\r\n\r\n#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)\r\n#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))\r\n/* The check above prevents the winsock2 inclusion if winsock.h already was\r\n   included, since they can't co-exist without problems */\r\n#include <winsock2.h>\r\n#include <ws2tcpip.h>\r\n#endif\r\n#endif\r\n\r\n/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish\r\n   libc5-based Linux systems. Only include it on systems that are known to\r\n   require it! */\r\n#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \\\r\n    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \\\r\n    defined(ANDROID) || defined(__ANDROID__) || \\\r\n   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(_WIN32_WCE)\r\n#include <sys/socket.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)\r\n#include <sys/time.h>\r\n#endif\r\n\r\n#ifdef __BEOS__\r\n#include <support/SupportDefs.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURL;\r\n\r\n/*\r\n * Decorate exportable functions for Win32 and Symbian OS DLL linking.\r\n * This avoids using a .def file for building libcurl.dll.\r\n */\r\n#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \\\r\n     !defined(CURL_STATICLIB)\r\n#if defined(BUILDING_LIBCURL)\r\n#define CURL_EXTERN  __declspec(dllexport)\r\n#else\r\n#define CURL_EXTERN  __declspec(dllimport)\r\n#endif\r\n#else\r\n\r\n#ifdef CURL_HIDDEN_SYMBOLS\r\n/*\r\n * This definition is used to make external definitions visible in the\r\n * shared library when symbols are hidden by default.  It makes no\r\n * difference when compiling applications whether this is set or not,\r\n * only when compiling the library.\r\n */\r\n#define CURL_EXTERN CURL_EXTERN_SYMBOL\r\n#else\r\n#define CURL_EXTERN\r\n#endif\r\n#endif\r\n\r\n#ifndef curl_socket_typedef\r\n/* socket typedef */\r\n#if defined(WIN32) && !defined(__LWIP_OPT_H__)\r\ntypedef SOCKET curl_socket_t;\r\n#define CURL_SOCKET_BAD INVALID_SOCKET\r\n#else\r\ntypedef int curl_socket_t;\r\n#define CURL_SOCKET_BAD -1\r\n#endif\r\n#define curl_socket_typedef\r\n#endif /* curl_socket_typedef */\r\n\r\nstruct curl_httppost {\r\n  struct curl_httppost *next;       /* next entry in the list */\r\n  char *name;                       /* pointer to allocated name */\r\n  long namelength;                  /* length of name length */\r\n  char *contents;                   /* pointer to allocated data contents */\r\n  long contentslength;              /* length of contents field */\r\n  char *buffer;                     /* pointer to allocated buffer contents */\r\n  long bufferlength;                /* length of buffer field */\r\n  char *contenttype;                /* Content-Type */\r\n  struct curl_slist* contentheader; /* list of extra headers for this form */\r\n  struct curl_httppost *more;       /* if one field name has more than one\r\n                                       file, this link should link to following\r\n                                       files */\r\n  long flags;                       /* as defined below */\r\n#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */\r\n#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */\r\n#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */\r\n#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */\r\n#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the\r\n                                       regular read callback to get the data\r\n                                       and pass the given pointer as custom\r\n                                       pointer */\r\n\r\n  char *showfilename;               /* The file name to show. If not set, the\r\n                                       actual file name will be used (if this\r\n                                       is a file part) */\r\n  void *userp;                      /* custom pointer used for\r\n                                       HTTPPOST_CALLBACK posts */\r\n};\r\n\r\ntypedef int (*curl_progress_callback)(void *clientp,\r\n                                      double dltotal,\r\n                                      double dlnow,\r\n                                      double ultotal,\r\n                                      double ulnow);\r\n\r\n#ifndef CURL_MAX_WRITE_SIZE\r\n  /* Tests have proven that 20K is a very bad buffer size for uploads on\r\n     Windows, while 16K for some odd reason performed a lot better.\r\n     We do the ifndef check to allow this value to easier be changed at build\r\n     time for those who feel adventurous. The practical minimum is about\r\n     400 bytes since libcurl uses a buffer of this size as a scratch area\r\n     (unrelated to network send operations). */\r\n#define CURL_MAX_WRITE_SIZE 16384\r\n#endif\r\n\r\n#ifndef CURL_MAX_HTTP_HEADER\r\n/* The only reason to have a max limit for this is to avoid the risk of a bad\r\n   server feeding libcurl with a never-ending header that will cause reallocs\r\n   infinitely */\r\n#define CURL_MAX_HTTP_HEADER (100*1024)\r\n#endif\r\n\r\n/* This is a magic return code for the write callback that, when returned,\r\n   will signal libcurl to pause receiving on the current transfer. */\r\n#define CURL_WRITEFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_write_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *outstream);\r\n\r\n\r\n\r\n/* enumeration of file types */\r\ntypedef enum {\r\n  CURLFILETYPE_FILE = 0,\r\n  CURLFILETYPE_DIRECTORY,\r\n  CURLFILETYPE_SYMLINK,\r\n  CURLFILETYPE_DEVICE_BLOCK,\r\n  CURLFILETYPE_DEVICE_CHAR,\r\n  CURLFILETYPE_NAMEDPIPE,\r\n  CURLFILETYPE_SOCKET,\r\n  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */\r\n\r\n  CURLFILETYPE_UNKNOWN /* should never occur */\r\n} curlfiletype;\r\n\r\n#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)\r\n#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)\r\n#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)\r\n#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)\r\n#define CURLFINFOFLAG_KNOWN_UID         (1<<4)\r\n#define CURLFINFOFLAG_KNOWN_GID         (1<<5)\r\n#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)\r\n#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)\r\n\r\n/* Content of this structure depends on information which is known and is\r\n   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man\r\n   page for callbacks returning this structure -- some fields are mandatory,\r\n   some others are optional. The FLAG field has special meaning. */\r\nstruct curl_fileinfo {\r\n  char *filename;\r\n  curlfiletype filetype;\r\n  time_t time;\r\n  unsigned int perm;\r\n  int uid;\r\n  int gid;\r\n  curl_off_t size;\r\n  long int hardlinks;\r\n\r\n  struct {\r\n    /* If some of these fields is not NULL, it is a pointer to b_data. */\r\n    char *time;\r\n    char *perm;\r\n    char *user;\r\n    char *group;\r\n    char *target; /* pointer to the target filename of a symlink */\r\n  } strings;\r\n\r\n  unsigned int flags;\r\n\r\n  /* used internally */\r\n  char * b_data;\r\n  size_t b_size;\r\n  size_t b_used;\r\n};\r\n\r\n/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */\r\n#define CURL_CHUNK_BGN_FUNC_OK      0\r\n#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */\r\n#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */\r\n\r\n/* if splitting of data transfer is enabled, this callback is called before\r\n   download of an individual chunk started. Note that parameter \"remains\" works\r\n   only for FTP wildcard downloading (for now), otherwise is not used */\r\ntypedef long (*curl_chunk_bgn_callback)(const void *transfer_info,\r\n                                        void *ptr,\r\n                                        int remains);\r\n\r\n/* return codes for CURLOPT_CHUNK_END_FUNCTION */\r\n#define CURL_CHUNK_END_FUNC_OK      0\r\n#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */\r\n\r\n/* If splitting of data transfer is enabled this callback is called after\r\n   download of an individual chunk finished.\r\n   Note! After this callback was set then it have to be called FOR ALL chunks.\r\n   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.\r\n   This is the reason why we don't need \"transfer_info\" parameter in this\r\n   callback and we are not interested in \"remains\" parameter too. */\r\ntypedef long (*curl_chunk_end_callback)(void *ptr);\r\n\r\n/* return codes for FNMATCHFUNCTION */\r\n#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */\r\n#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */\r\n#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */\r\n\r\n/* callback type for wildcard downloading pattern matching. If the\r\n   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */\r\ntypedef int (*curl_fnmatch_callback)(void *ptr,\r\n                                     const char *pattern,\r\n                                     const char *string);\r\n\r\n/* These are the return codes for the seek callbacks */\r\n#define CURL_SEEKFUNC_OK       0\r\n#define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */\r\n#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so\r\n                                    libcurl might try other means instead */\r\ntypedef int (*curl_seek_callback)(void *instream,\r\n                                  curl_off_t offset,\r\n                                  int origin); /* 'whence' */\r\n\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to immediately abort the current transfer. */\r\n#define CURL_READFUNC_ABORT 0x10000000\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to pause sending data on the current transfer. */\r\n#define CURL_READFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_read_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *instream);\r\n\r\ntypedef enum  {\r\n  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */\r\n  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */\r\n  CURLSOCKTYPE_LAST    /* never use */\r\n} curlsocktype;\r\n\r\n/* The return code from the sockopt_callback can signal information back\r\n   to libcurl: */\r\n#define CURL_SOCKOPT_OK 0\r\n#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return\r\n                                CURLE_ABORTED_BY_CALLBACK */\r\n#define CURL_SOCKOPT_ALREADY_CONNECTED 2\r\n\r\ntypedef int (*curl_sockopt_callback)(void *clientp,\r\n                                     curl_socket_t curlfd,\r\n                                     curlsocktype purpose);\r\n\r\nstruct curl_sockaddr {\r\n  int family;\r\n  int socktype;\r\n  int protocol;\r\n  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it\r\n                           turned really ugly and painful on the systems that\r\n                           lack this type */\r\n  struct sockaddr addr;\r\n};\r\n\r\ntypedef curl_socket_t\r\n(*curl_opensocket_callback)(void *clientp,\r\n                            curlsocktype purpose,\r\n                            struct curl_sockaddr *address);\r\n\r\ntypedef int\r\n(*curl_closesocket_callback)(void *clientp, curl_socket_t item);\r\n\r\ntypedef enum {\r\n  CURLIOE_OK,            /* I/O operation successful */\r\n  CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */\r\n  CURLIOE_FAILRESTART,   /* failed to restart the read */\r\n  CURLIOE_LAST           /* never use */\r\n} curlioerr;\r\n\r\ntypedef enum  {\r\n  CURLIOCMD_NOP,         /* no operation */\r\n  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */\r\n  CURLIOCMD_LAST         /* never use */\r\n} curliocmd;\r\n\r\ntypedef curlioerr (*curl_ioctl_callback)(CURL *handle,\r\n                                         int cmd,\r\n                                         void *clientp);\r\n\r\n/*\r\n * The following typedef's are signatures of malloc, free, realloc, strdup and\r\n * calloc respectively.  Function pointers of these types can be passed to the\r\n * curl_global_init_mem() function to set user defined memory management\r\n * callback routines.\r\n */\r\ntypedef void *(*curl_malloc_callback)(size_t size);\r\ntypedef void (*curl_free_callback)(void *ptr);\r\ntypedef void *(*curl_realloc_callback)(void *ptr, size_t size);\r\ntypedef char *(*curl_strdup_callback)(const char *str);\r\ntypedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);\r\n\r\n/* the kind of data that is passed to information_callback*/\r\ntypedef enum {\r\n  CURLINFO_TEXT = 0,\r\n  CURLINFO_HEADER_IN,    /* 1 */\r\n  CURLINFO_HEADER_OUT,   /* 2 */\r\n  CURLINFO_DATA_IN,      /* 3 */\r\n  CURLINFO_DATA_OUT,     /* 4 */\r\n  CURLINFO_SSL_DATA_IN,  /* 5 */\r\n  CURLINFO_SSL_DATA_OUT, /* 6 */\r\n  CURLINFO_END\r\n} curl_infotype;\r\n\r\ntypedef int (*curl_debug_callback)\r\n       (CURL *handle,      /* the handle/transfer this concerns */\r\n        curl_infotype type, /* what kind of data */\r\n        char *data,        /* points to the data */\r\n        size_t size,       /* size of the data pointed to */\r\n        void *userptr);    /* whatever the user please */\r\n\r\n/* All possible error codes from all sorts of curl functions. Future versions\r\n   may return other values, stay prepared.\r\n\r\n   Always add new return codes last. Never *EVER* remove any. The return\r\n   codes must remain the same!\r\n */\r\n\r\ntypedef enum {\r\n  CURLE_OK = 0,\r\n  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */\r\n  CURLE_FAILED_INIT,             /* 2 */\r\n  CURLE_URL_MALFORMAT,           /* 3 */\r\n  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for\r\n                                    7.17.0, reused in April 2011 for 7.21.5] */\r\n  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */\r\n  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */\r\n  CURLE_COULDNT_CONNECT,         /* 7 */\r\n  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */\r\n  CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server\r\n                                    due to lack of access - when login fails\r\n                                    this is not returned. */\r\n  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for\r\n                                    7.15.4, reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */\r\n  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server\r\n                                    [was obsoleted in August 2007 for 7.17.0,\r\n                                    reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */\r\n  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */\r\n  CURLE_FTP_CANT_GET_HOST,       /* 15 */\r\n  CURLE_OBSOLETE16,              /* 16 - NOT USED */\r\n  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */\r\n  CURLE_PARTIAL_FILE,            /* 18 */\r\n  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */\r\n  CURLE_OBSOLETE20,              /* 20 - NOT USED */\r\n  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */\r\n  CURLE_HTTP_RETURNED_ERROR,     /* 22 */\r\n  CURLE_WRITE_ERROR,             /* 23 */\r\n  CURLE_OBSOLETE24,              /* 24 - NOT USED */\r\n  CURLE_UPLOAD_FAILED,           /* 25 - failed upload \"command\" */\r\n  CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */\r\n  CURLE_OUT_OF_MEMORY,           /* 27 */\r\n  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error\r\n           instead of a memory allocation error if CURL_DOES_CONVERSIONS\r\n           is defined\r\n  */\r\n  CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */\r\n  CURLE_OBSOLETE29,              /* 29 - NOT USED */\r\n  CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */\r\n  CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */\r\n  CURLE_OBSOLETE32,              /* 32 - NOT USED */\r\n  CURLE_RANGE_ERROR,             /* 33 - RANGE \"command\" didn't work */\r\n  CURLE_HTTP_POST_ERROR,         /* 34 */\r\n  CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */\r\n  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */\r\n  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */\r\n  CURLE_LDAP_CANNOT_BIND,        /* 38 */\r\n  CURLE_LDAP_SEARCH_FAILED,      /* 39 */\r\n  CURLE_OBSOLETE40,              /* 40 - NOT USED */\r\n  CURLE_FUNCTION_NOT_FOUND,      /* 41 */\r\n  CURLE_ABORTED_BY_CALLBACK,     /* 42 */\r\n  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */\r\n  CURLE_OBSOLETE44,              /* 44 - NOT USED */\r\n  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */\r\n  CURLE_OBSOLETE46,              /* 46 - NOT USED */\r\n  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */\r\n  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */\r\n  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */\r\n  CURLE_OBSOLETE50,              /* 50 - NOT USED */\r\n  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint\r\n                                     wasn't verified fine */\r\n  CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */\r\n  CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */\r\n  CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as\r\n                                    default */\r\n  CURLE_SEND_ERROR,              /* 55 - failed sending network data */\r\n  CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */\r\n  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */\r\n  CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */\r\n  CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */\r\n  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */\r\n  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */\r\n  CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */\r\n  CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */\r\n  CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */\r\n  CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind\r\n                                    that failed */\r\n  CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */\r\n  CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not\r\n                                    accepted and we failed to login */\r\n  CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */\r\n  CURLE_TFTP_PERM,               /* 69 - permission problem on server */\r\n  CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */\r\n  CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */\r\n  CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */\r\n  CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */\r\n  CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */\r\n  CURLE_CONV_FAILED,             /* 75 - conversion failed */\r\n  CURLE_CONV_REQD,               /* 76 - caller must register conversion\r\n                                    callbacks using curl_easy_setopt options\r\n                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,\r\n                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and\r\n                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */\r\n  CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing\r\n                                    or wrong format */\r\n  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */\r\n  CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat\r\n                                    generic so the error message will be of\r\n                                    interest when this has happened */\r\n\r\n  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL\r\n                                    connection */\r\n  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,\r\n                                    wait till it's ready and try again (Added\r\n                                    in 7.18.2) */\r\n  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or\r\n                                    wrong format (Added in 7.19.0) */\r\n  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in\r\n                                    7.19.0) */\r\n  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */\r\n  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */\r\n  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */\r\n  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */\r\n  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */\r\n  CURL_LAST /* never use! */\r\n} CURLcode;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Previously obsoletes error codes re-used in 7.24.0 */\r\n#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED\r\n#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT\r\n\r\n/*  compatibility with older names */\r\n#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING\r\n\r\n/* The following were added in 7.21.5, April 2011 */\r\n#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION\r\n\r\n/* The following were added in 7.17.1 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION\r\n\r\n/* The following were added in 7.17.0 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */\r\n#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46\r\n#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44\r\n#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10\r\n#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16\r\n#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32\r\n#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29\r\n#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12\r\n#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20\r\n#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40\r\n#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24\r\n#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57\r\n#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN\r\n\r\n#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED\r\n#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE\r\n#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR\r\n#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL\r\n#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS\r\n#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR\r\n#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT\r\n\r\n#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR\r\n#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED\r\n#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED\r\n\r\n#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE\r\n#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME\r\n\r\n/* This was the error code 50 in 7.7.3 and a few earlier versions, this\r\n   is no longer used by libcurl but is instead #defined here only to not\r\n   make programs break */\r\n#define CURLE_ALREADY_COMPLETE 99999\r\n\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* This prototype applies to all conversion callbacks */\r\ntypedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);\r\n\r\ntypedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */\r\n                                          void *ssl_ctx, /* actually an\r\n                                                            OpenSSL SSL_CTX */\r\n                                          void *userptr);\r\n\r\ntypedef enum {\r\n  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use\r\n                           CONNECT HTTP/1.1 */\r\n  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT\r\n                               HTTP/1.0  */\r\n  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already\r\n                           in 7.10 */\r\n  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */\r\n  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */\r\n  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the\r\n                                   host name rather than the IP address. added\r\n                                   in 7.18.0 */\r\n} curl_proxytype;  /* this enum was added in 7.10 */\r\n\r\n/*\r\n * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:\r\n *\r\n * CURLAUTH_NONE         - No HTTP authentication\r\n * CURLAUTH_BASIC        - HTTP Basic authentication (default)\r\n * CURLAUTH_DIGEST       - HTTP Digest authentication\r\n * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication\r\n * CURLAUTH_NTLM         - HTTP NTLM authentication\r\n * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour\r\n * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper\r\n * CURLAUTH_ONLY         - Use together with a single other type to force no\r\n *                         authentication or just that single type\r\n * CURLAUTH_ANY          - All fine types set\r\n * CURLAUTH_ANYSAFE      - All fine types except Basic\r\n */\r\n\r\n#define CURLAUTH_NONE         ((unsigned long)0)\r\n#define CURLAUTH_BASIC        (((unsigned long)1)<<0)\r\n#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)\r\n#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)\r\n#define CURLAUTH_NTLM         (((unsigned long)1)<<3)\r\n#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)\r\n#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)\r\n#define CURLAUTH_ONLY         (((unsigned long)1)<<31)\r\n#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)\r\n#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))\r\n\r\n#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */\r\n#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */\r\n#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */\r\n#define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */\r\n#define CURLSSH_AUTH_HOST      (1<<2) /* host key files */\r\n#define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */\r\n#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */\r\n#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY\r\n\r\n#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */\r\n#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */\r\n#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */\r\n\r\n#define CURL_ERROR_SIZE 256\r\n\r\nstruct curl_khkey {\r\n  const char *key; /* points to a zero-terminated string encoded with base64\r\n                      if len is zero, otherwise to the \"raw\" data */\r\n  size_t len;\r\n  enum type {\r\n    CURLKHTYPE_UNKNOWN,\r\n    CURLKHTYPE_RSA1,\r\n    CURLKHTYPE_RSA,\r\n    CURLKHTYPE_DSS\r\n  } keytype;\r\n};\r\n\r\n/* this is the set of return values expected from the curl_sshkeycallback\r\n   callback */\r\nenum curl_khstat {\r\n  CURLKHSTAT_FINE_ADD_TO_FILE,\r\n  CURLKHSTAT_FINE,\r\n  CURLKHSTAT_REJECT, /* reject the connection, return an error */\r\n  CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so\r\n                        this causes a CURLE_DEFER error but otherwise the\r\n                        connection will be left intact etc */\r\n  CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */\r\n};\r\n\r\n/* this is the set of status codes pass in to the callback */\r\nenum curl_khmatch {\r\n  CURLKHMATCH_OK,       /* match */\r\n  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */\r\n  CURLKHMATCH_MISSING,  /* no matching host/key found */\r\n  CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */\r\n};\r\n\r\ntypedef int\r\n  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */\r\n                          const struct curl_khkey *knownkey, /* known */\r\n                          const struct curl_khkey *foundkey, /* found */\r\n                          enum curl_khmatch, /* libcurl's view on the keys */\r\n                          void *clientp); /* custom pointer passed from app */\r\n\r\n/* parameter for the CURLOPT_USE_SSL option */\r\ntypedef enum {\r\n  CURLUSESSL_NONE,    /* do not attempt to use SSL */\r\n  CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */\r\n  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */\r\n  CURLUSESSL_ALL,     /* SSL for all communication or fail */\r\n  CURLUSESSL_LAST     /* not an option, never use */\r\n} curl_usessl;\r\n\r\n/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */\r\n\r\n/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the\r\n   name of improving interoperability with older servers. Some SSL libraries\r\n   have introduced work-arounds for this flaw but those work-arounds sometimes\r\n   make the SSL communication fail. To regain functionality with those broken\r\n   servers, a user can this way allow the vulnerability back. */\r\n#define CURLSSLOPT_ALLOW_BEAST (1<<0)\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n#define CURLFTPSSL_NONE CURLUSESSL_NONE\r\n#define CURLFTPSSL_TRY CURLUSESSL_TRY\r\n#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL\r\n#define CURLFTPSSL_ALL CURLUSESSL_ALL\r\n#define CURLFTPSSL_LAST CURLUSESSL_LAST\r\n#define curl_ftpssl curl_usessl\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* parameter for the CURLOPT_FTP_SSL_CCC option */\r\ntypedef enum {\r\n  CURLFTPSSL_CCC_NONE,    /* do not send CCC */\r\n  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */\r\n  CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */\r\n  CURLFTPSSL_CCC_LAST     /* not an option, never use */\r\n} curl_ftpccc;\r\n\r\n/* parameter for the CURLOPT_FTPSSLAUTH option */\r\ntypedef enum {\r\n  CURLFTPAUTH_DEFAULT, /* let libcurl decide */\r\n  CURLFTPAUTH_SSL,     /* use \"AUTH SSL\" */\r\n  CURLFTPAUTH_TLS,     /* use \"AUTH TLS\" */\r\n  CURLFTPAUTH_LAST /* not an option, never use */\r\n} curl_ftpauth;\r\n\r\n/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */\r\ntypedef enum {\r\n  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */\r\n  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD\r\n                               again if MKD succeeded, for SFTP this does\r\n                               similar magic */\r\n  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD\r\n                               again even if MKD failed! */\r\n  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */\r\n} curl_ftpcreatedir;\r\n\r\n/* parameter for the CURLOPT_FTP_FILEMETHOD option */\r\ntypedef enum {\r\n  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */\r\n  CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */\r\n  CURLFTPMETHOD_NOCWD,     /* no CWD at all */\r\n  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */\r\n  CURLFTPMETHOD_LAST       /* not an option, never use */\r\n} curl_ftpmethod;\r\n\r\n/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */\r\n#define CURLPROTO_HTTP   (1<<0)\r\n#define CURLPROTO_HTTPS  (1<<1)\r\n#define CURLPROTO_FTP    (1<<2)\r\n#define CURLPROTO_FTPS   (1<<3)\r\n#define CURLPROTO_SCP    (1<<4)\r\n#define CURLPROTO_SFTP   (1<<5)\r\n#define CURLPROTO_TELNET (1<<6)\r\n#define CURLPROTO_LDAP   (1<<7)\r\n#define CURLPROTO_LDAPS  (1<<8)\r\n#define CURLPROTO_DICT   (1<<9)\r\n#define CURLPROTO_FILE   (1<<10)\r\n#define CURLPROTO_TFTP   (1<<11)\r\n#define CURLPROTO_IMAP   (1<<12)\r\n#define CURLPROTO_IMAPS  (1<<13)\r\n#define CURLPROTO_POP3   (1<<14)\r\n#define CURLPROTO_POP3S  (1<<15)\r\n#define CURLPROTO_SMTP   (1<<16)\r\n#define CURLPROTO_SMTPS  (1<<17)\r\n#define CURLPROTO_RTSP   (1<<18)\r\n#define CURLPROTO_RTMP   (1<<19)\r\n#define CURLPROTO_RTMPT  (1<<20)\r\n#define CURLPROTO_RTMPE  (1<<21)\r\n#define CURLPROTO_RTMPTE (1<<22)\r\n#define CURLPROTO_RTMPS  (1<<23)\r\n#define CURLPROTO_RTMPTS (1<<24)\r\n#define CURLPROTO_GOPHER (1<<25)\r\n#define CURLPROTO_ALL    (~0) /* enable everything */\r\n\r\n/* long may be 32 or 64 bits, but we should never depend on anything else\r\n   but 32 */\r\n#define CURLOPTTYPE_LONG          0\r\n#define CURLOPTTYPE_OBJECTPOINT   10000\r\n#define CURLOPTTYPE_FUNCTIONPOINT 20000\r\n#define CURLOPTTYPE_OFF_T         30000\r\n\r\n/* name is uppercase CURLOPT_<name>,\r\n   type is one of the defined CURLOPTTYPE_<type>\r\n   number is unique identifier */\r\n#ifdef CINIT\r\n#undef CINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLOPT_/**/name = type + number\r\n#endif\r\n\r\n/*\r\n * This macro-mania below setups the CURLOPT_[what] enum, to be used with\r\n * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]\r\n * word.\r\n */\r\n\r\ntypedef enum {\r\n  /* This is the FILE * or void * the regular output should be written to. */\r\n  CINIT(FILE, OBJECTPOINT, 1),\r\n\r\n  /* The full URL to get/put */\r\n  CINIT(URL,  OBJECTPOINT, 2),\r\n\r\n  /* Port number to connect to, if other than default. */\r\n  CINIT(PORT, LONG, 3),\r\n\r\n  /* Name of proxy to use. */\r\n  CINIT(PROXY, OBJECTPOINT, 4),\r\n\r\n  /* \"name:password\" to use when fetching. */\r\n  CINIT(USERPWD, OBJECTPOINT, 5),\r\n\r\n  /* \"name:password\" to use with proxy. */\r\n  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),\r\n\r\n  /* Range to get, specified as an ASCII string. */\r\n  CINIT(RANGE, OBJECTPOINT, 7),\r\n\r\n  /* not used */\r\n\r\n  /* Specified file stream to upload from (use as input): */\r\n  CINIT(INFILE, OBJECTPOINT, 9),\r\n\r\n  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE\r\n   * bytes big. If this is not used, error messages go to stderr instead: */\r\n  CINIT(ERRORBUFFER, OBJECTPOINT, 10),\r\n\r\n  /* Function that will be called to store the output (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),\r\n\r\n  /* Function that will be called to read the input (instead of fread). The\r\n   * parameters will use fread() syntax, make sure to follow them. */\r\n  CINIT(READFUNCTION, FUNCTIONPOINT, 12),\r\n\r\n  /* Time-out the read operation after this amount of seconds */\r\n  CINIT(TIMEOUT, LONG, 13),\r\n\r\n  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about\r\n   * how large the file being sent really is. That allows better error\r\n   * checking and better verifies that the upload was successful. -1 means\r\n   * unknown size.\r\n   *\r\n   * For large file support, there is also a _LARGE version of the key\r\n   * which takes an off_t type, allowing platforms with larger off_t\r\n   * sizes to handle larger files.  See below for INFILESIZE_LARGE.\r\n   */\r\n  CINIT(INFILESIZE, LONG, 14),\r\n\r\n  /* POST static input fields. */\r\n  CINIT(POSTFIELDS, OBJECTPOINT, 15),\r\n\r\n  /* Set the referrer page (needed by some CGIs) */\r\n  CINIT(REFERER, OBJECTPOINT, 16),\r\n\r\n  /* Set the FTP PORT string (interface name, named or numerical IP address)\r\n     Use i.e '-' to use default address. */\r\n  CINIT(FTPPORT, OBJECTPOINT, 17),\r\n\r\n  /* Set the User-Agent string (examined by some CGIs) */\r\n  CINIT(USERAGENT, OBJECTPOINT, 18),\r\n\r\n  /* If the download receives less than \"low speed limit\" bytes/second\r\n   * during \"low speed time\" seconds, the operations is aborted.\r\n   * You could i.e if you have a pretty high speed connection, abort if\r\n   * it is less than 2000 bytes/sec during 20 seconds.\r\n   */\r\n\r\n  /* Set the \"low speed limit\" */\r\n  CINIT(LOW_SPEED_LIMIT, LONG, 19),\r\n\r\n  /* Set the \"low speed time\" */\r\n  CINIT(LOW_SPEED_TIME, LONG, 20),\r\n\r\n  /* Set the continuation offset.\r\n   *\r\n   * Note there is also a _LARGE version of this key which uses\r\n   * off_t types, allowing for large file offsets on platforms which\r\n   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.\r\n   */\r\n  CINIT(RESUME_FROM, LONG, 21),\r\n\r\n  /* Set cookie in request: */\r\n  CINIT(COOKIE, OBJECTPOINT, 22),\r\n\r\n  /* This points to a linked list of headers, struct curl_slist kind */\r\n  CINIT(HTTPHEADER, OBJECTPOINT, 23),\r\n\r\n  /* This points to a linked list of post entries, struct curl_httppost */\r\n  CINIT(HTTPPOST, OBJECTPOINT, 24),\r\n\r\n  /* name of the file keeping your private SSL-certificate */\r\n  CINIT(SSLCERT, OBJECTPOINT, 25),\r\n\r\n  /* password for the SSL or SSH private key */\r\n  CINIT(KEYPASSWD, OBJECTPOINT, 26),\r\n\r\n  /* send TYPE parameter? */\r\n  CINIT(CRLF, LONG, 27),\r\n\r\n  /* send linked-list of QUOTE commands */\r\n  CINIT(QUOTE, OBJECTPOINT, 28),\r\n\r\n  /* send FILE * or void * to store headers to, if you use a callback it\r\n     is simply passed to the callback unmodified */\r\n  CINIT(WRITEHEADER, OBJECTPOINT, 29),\r\n\r\n  /* point to a file to read the initial cookies from, also enables\r\n     \"cookie awareness\" */\r\n  CINIT(COOKIEFILE, OBJECTPOINT, 31),\r\n\r\n  /* What version to specifically try to use.\r\n     See CURL_SSLVERSION defines below. */\r\n  CINIT(SSLVERSION, LONG, 32),\r\n\r\n  /* What kind of HTTP time condition to use, see defines */\r\n  CINIT(TIMECONDITION, LONG, 33),\r\n\r\n  /* Time to use with the above condition. Specified in number of seconds\r\n     since 1 Jan 1970 */\r\n  CINIT(TIMEVALUE, LONG, 34),\r\n\r\n  /* 35 = OBSOLETE */\r\n\r\n  /* Custom request, for customizing the get command like\r\n     HTTP: DELETE, TRACE and others\r\n     FTP: to use a different list command\r\n     */\r\n  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),\r\n\r\n  /* HTTP request, for odd commands like DELETE, TRACE and others */\r\n  CINIT(STDERR, OBJECTPOINT, 37),\r\n\r\n  /* 38 is not used */\r\n\r\n  /* send linked-list of post-transfer QUOTE commands */\r\n  CINIT(POSTQUOTE, OBJECTPOINT, 39),\r\n\r\n  CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */\r\n\r\n  CINIT(VERBOSE, LONG, 41),      /* talk a lot */\r\n  CINIT(HEADER, LONG, 42),       /* throw the header out too */\r\n  CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */\r\n  CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */\r\n  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */\r\n  CINIT(UPLOAD, LONG, 46),       /* this is an upload */\r\n  CINIT(POST, LONG, 47),         /* HTTP POST method */\r\n  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */\r\n\r\n  CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */\r\n\r\n  /* Specify whether to read the user+password from the .netrc or the URL.\r\n   * This must be one of the CURL_NETRC_* enums below. */\r\n  CINIT(NETRC, LONG, 51),\r\n\r\n  CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */\r\n\r\n  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */\r\n  CINIT(PUT, LONG, 54),          /* HTTP PUT */\r\n\r\n  /* 55 = OBSOLETE */\r\n\r\n  /* Function that will be called instead of the internal progress display\r\n   * function. This function should be defined as the curl_progress_callback\r\n   * prototype defines. */\r\n  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),\r\n\r\n  /* Data passed to the progress callback */\r\n  CINIT(PROGRESSDATA, OBJECTPOINT, 57),\r\n\r\n  /* We want the referrer field set automatically when following locations */\r\n  CINIT(AUTOREFERER, LONG, 58),\r\n\r\n  /* Port of the proxy, can be set in the proxy string as well with:\r\n     \"[host]:[port]\" */\r\n  CINIT(PROXYPORT, LONG, 59),\r\n\r\n  /* size of the POST input data, if strlen() is not good to use */\r\n  CINIT(POSTFIELDSIZE, LONG, 60),\r\n\r\n  /* tunnel non-http operations through a HTTP proxy */\r\n  CINIT(HTTPPROXYTUNNEL, LONG, 61),\r\n\r\n  /* Set the interface string to use as outgoing network interface */\r\n  CINIT(INTERFACE, OBJECTPOINT, 62),\r\n\r\n  /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This\r\n   * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string\r\n   * is set but doesn't match one of these, 'private' will be used.  */\r\n  CINIT(KRBLEVEL, OBJECTPOINT, 63),\r\n\r\n  /* Set if we should verify the peer in ssl handshake, set 1 to verify. */\r\n  CINIT(SSL_VERIFYPEER, LONG, 64),\r\n\r\n  /* The CApath or CAfile used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAINFO, OBJECTPOINT, 65),\r\n\r\n  /* 66 = OBSOLETE */\r\n  /* 67 = OBSOLETE */\r\n\r\n  /* Maximum number of http redirects to follow */\r\n  CINIT(MAXREDIRS, LONG, 68),\r\n\r\n  /* Pass a long set to 1 to get the date of the requested document (if\r\n     possible)! Pass a zero to shut it off. */\r\n  CINIT(FILETIME, LONG, 69),\r\n\r\n  /* This points to a linked list of telnet options */\r\n  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),\r\n\r\n  /* Max amount of cached alive connections */\r\n  CINIT(MAXCONNECTS, LONG, 71),\r\n\r\n  CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */\r\n\r\n  /* 73 = OBSOLETE */\r\n\r\n  /* Set to explicitly use a new connection for the upcoming transfer.\r\n     Do not use this unless you're absolutely sure of this, as it makes the\r\n     operation slower and is less friendly for the network. */\r\n  CINIT(FRESH_CONNECT, LONG, 74),\r\n\r\n  /* Set to explicitly forbid the upcoming transfer's connection to be re-used\r\n     when done. Do not use this unless you're absolutely sure of this, as it\r\n     makes the operation slower and is less friendly for the network. */\r\n  CINIT(FORBID_REUSE, LONG, 75),\r\n\r\n  /* Set to a file name that contains random data for libcurl to use to\r\n     seed the random engine when doing SSL connects. */\r\n  CINIT(RANDOM_FILE, OBJECTPOINT, 76),\r\n\r\n  /* Set to the Entropy Gathering Daemon socket pathname */\r\n  CINIT(EGDSOCKET, OBJECTPOINT, 77),\r\n\r\n  /* Time-out connect operations after this amount of seconds, if connects are\r\n     OK within this time, then fine... This only aborts the connect phase. */\r\n  CINIT(CONNECTTIMEOUT, LONG, 78),\r\n\r\n  /* Function that will be called to store headers (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),\r\n\r\n  /* Set this to force the HTTP request to get back to GET. Only really usable\r\n     if POST, PUT or a custom request have been used first.\r\n   */\r\n  CINIT(HTTPGET, LONG, 80),\r\n\r\n  /* Set if we should verify the Common name from the peer certificate in ssl\r\n   * handshake, set 1 to check existence, 2 to ensure that it matches the\r\n   * provided hostname. */\r\n  CINIT(SSL_VERIFYHOST, LONG, 81),\r\n\r\n  /* Specify which file name to write all known cookies in after completed\r\n     operation. Set file name to \"-\" (dash) to make it go to stdout. */\r\n  CINIT(COOKIEJAR, OBJECTPOINT, 82),\r\n\r\n  /* Specify which SSL ciphers to use */\r\n  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),\r\n\r\n  /* Specify which HTTP version to use! This must be set to one of the\r\n     CURL_HTTP_VERSION* enums set below. */\r\n  CINIT(HTTP_VERSION, LONG, 84),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPSV command. By\r\n     default, that one will always be attempted before the more traditional\r\n     PASV command. */\r\n  CINIT(FTP_USE_EPSV, LONG, 85),\r\n\r\n  /* type of the file keeping your SSL-certificate (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),\r\n\r\n  /* name of the file keeping your private SSL-key */\r\n  CINIT(SSLKEY, OBJECTPOINT, 87),\r\n\r\n  /* type of the file keeping your private SSL-key (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),\r\n\r\n  /* crypto engine for the SSL-sub system */\r\n  CINIT(SSLENGINE, OBJECTPOINT, 89),\r\n\r\n  /* set the crypto engine for the SSL-sub system as default\r\n     the param has no meaning...\r\n   */\r\n  CINIT(SSLENGINE_DEFAULT, LONG, 90),\r\n\r\n  /* Non-zero value means to use the global dns cache */\r\n  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */\r\n\r\n  /* DNS cache timeout */\r\n  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),\r\n\r\n  /* send linked-list of pre-transfer QUOTE commands */\r\n  CINIT(PREQUOTE, OBJECTPOINT, 93),\r\n\r\n  /* set the debug function */\r\n  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),\r\n\r\n  /* set the data for the debug function */\r\n  CINIT(DEBUGDATA, OBJECTPOINT, 95),\r\n\r\n  /* mark this as start of a cookie session */\r\n  CINIT(COOKIESESSION, LONG, 96),\r\n\r\n  /* The CApath directory used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAPATH, OBJECTPOINT, 97),\r\n\r\n  /* Instruct libcurl to use a smaller receive buffer */\r\n  CINIT(BUFFERSIZE, LONG, 98),\r\n\r\n  /* Instruct libcurl to not use any signal/alarm handlers, even when using\r\n     timeouts. This option is useful for multi-threaded applications.\r\n     See libcurl-the-guide for more background information. */\r\n  CINIT(NOSIGNAL, LONG, 99),\r\n\r\n  /* Provide a CURLShare for mutexing non-ts data */\r\n  CINIT(SHARE, OBJECTPOINT, 100),\r\n\r\n  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),\r\n     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */\r\n  CINIT(PROXYTYPE, LONG, 101),\r\n\r\n  /* Set the Accept-Encoding string. Use this to tell a server you would like\r\n     the response to be compressed. Before 7.21.6, this was known as\r\n     CURLOPT_ENCODING */\r\n  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),\r\n\r\n  /* Set pointer to private data */\r\n  CINIT(PRIVATE, OBJECTPOINT, 103),\r\n\r\n  /* Set aliases for HTTP 200 in the HTTP Response header */\r\n  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),\r\n\r\n  /* Continue to send authentication (user+password) when following locations,\r\n     even when hostname changed. This can potentially send off the name\r\n     and password to whatever host the server decides. */\r\n  CINIT(UNRESTRICTED_AUTH, LONG, 105),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPRT command (\r\n     it also disables the LPRT attempt). By default, those ones will always be\r\n     attempted before the good old traditional PORT command. */\r\n  CINIT(FTP_USE_EPRT, LONG, 106),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_USERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(HTTPAUTH, LONG, 107),\r\n\r\n  /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx\r\n     in second argument. The function must be matching the\r\n     curl_ssl_ctx_callback proto. */\r\n  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),\r\n\r\n  /* Set the userdata for the ssl context callback function's third\r\n     argument */\r\n  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),\r\n\r\n  /* FTP Option that causes missing dirs to be created on the remote server.\r\n     In 7.19.4 we introduced the convenience enums for this option using the\r\n     CURLFTP_CREATE_DIR prefix.\r\n  */\r\n  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(PROXYAUTH, LONG, 111),\r\n\r\n  /* FTP option that changes the timeout, in seconds, associated with\r\n     getting a response.  This is different from transfer timeout time and\r\n     essentially places a demand on the FTP server to acknowledge commands\r\n     in a timely manner. */\r\n  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),\r\n#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT\r\n\r\n  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to\r\n     tell libcurl to resolve names to those IP versions only. This only has\r\n     affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */\r\n  CINIT(IPRESOLVE, LONG, 113),\r\n\r\n  /* Set this option to limit the size of a file that will be downloaded from\r\n     an HTTP or FTP server.\r\n\r\n     Note there is also _LARGE version which adds large file support for\r\n     platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */\r\n  CINIT(MAXFILESIZE, LONG, 114),\r\n\r\n  /* See the comment for INFILESIZE above, but in short, specifies\r\n   * the size of the file being uploaded.  -1 means unknown.\r\n   */\r\n  CINIT(INFILESIZE_LARGE, OFF_T, 115),\r\n\r\n  /* Sets the continuation offset.  There is also a LONG version of this;\r\n   * look above for RESUME_FROM.\r\n   */\r\n  CINIT(RESUME_FROM_LARGE, OFF_T, 116),\r\n\r\n  /* Sets the maximum size of data that will be downloaded from\r\n   * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.\r\n   */\r\n  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),\r\n\r\n  /* Set this option to the file name of your .netrc file you want libcurl\r\n     to parse (using the CURLOPT_NETRC option). If not set, libcurl will do\r\n     a poor attempt to find the user's home directory and check for a .netrc\r\n     file in there. */\r\n  CINIT(NETRC_FILE, OBJECTPOINT, 118),\r\n\r\n  /* Enable SSL/TLS for FTP, pick one of:\r\n     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise\r\n     CURLUSESSL_CONTROL - SSL for the control connection or fail\r\n     CURLUSESSL_ALL     - SSL for all communication or fail\r\n  */\r\n  CINIT(USE_SSL, LONG, 119),\r\n\r\n  /* The _LARGE version of the standard POSTFIELDSIZE option */\r\n  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),\r\n\r\n  /* Enable/disable the TCP Nagle algorithm */\r\n  CINIT(TCP_NODELAY, LONG, 121),\r\n\r\n  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 123 OBSOLETE. Gone in 7.16.0 */\r\n  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 127 OBSOLETE. Gone in 7.16.0 */\r\n  /* 128 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option\r\n     can be used to change libcurl's default action which is to first try\r\n     \"AUTH SSL\" and then \"AUTH TLS\" in this order, and proceed when a OK\r\n     response has been received.\r\n\r\n     Available parameters are:\r\n     CURLFTPAUTH_DEFAULT - let libcurl decide\r\n     CURLFTPAUTH_SSL     - try \"AUTH SSL\" first, then TLS\r\n     CURLFTPAUTH_TLS     - try \"AUTH TLS\" first, then SSL\r\n  */\r\n  CINIT(FTPSSLAUTH, LONG, 129),\r\n\r\n  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),\r\n  CINIT(IOCTLDATA, OBJECTPOINT, 131),\r\n\r\n  /* 132 OBSOLETE. Gone in 7.16.0 */\r\n  /* 133 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* zero terminated string for pass on to the FTP server when asked for\r\n     \"account\" info */\r\n  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),\r\n\r\n  /* feed cookies into cookie engine */\r\n  CINIT(COOKIELIST, OBJECTPOINT, 135),\r\n\r\n  /* ignore Content-Length */\r\n  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),\r\n\r\n  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server\r\n     response. Typically used for FTP-SSL purposes but is not restricted to\r\n     that. libcurl will then instead use the same IP address it used for the\r\n     control connection. */\r\n  CINIT(FTP_SKIP_PASV_IP, LONG, 137),\r\n\r\n  /* Select \"file method\" to use when doing FTP, see the curl_ftpmethod\r\n     above. */\r\n  CINIT(FTP_FILEMETHOD, LONG, 138),\r\n\r\n  /* Local port number to bind the socket to */\r\n  CINIT(LOCALPORT, LONG, 139),\r\n\r\n  /* Number of ports to try, including the first one set with LOCALPORT.\r\n     Thus, setting it to 1 will make no additional attempts but the first.\r\n  */\r\n  CINIT(LOCALPORTRANGE, LONG, 140),\r\n\r\n  /* no transfer, set up connection and let application use the socket by\r\n     extracting it with CURLINFO_LASTSOCKET */\r\n  CINIT(CONNECT_ONLY, LONG, 141),\r\n\r\n  /* Function that will be called to convert from the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),\r\n\r\n  /* Function that will be called to convert to the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),\r\n\r\n  /* Function that will be called to convert from UTF8\r\n     (instead of using the iconv calls in libcurl)\r\n     Note that this is used only for SSL certificate processing */\r\n  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),\r\n\r\n  /* if the connection proceeds too quickly then need to slow it down */\r\n  /* limit-rate: maximum number of bytes per second to send or receive */\r\n  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),\r\n  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),\r\n\r\n  /* Pointer to command string to send if USER/PASS fails. */\r\n  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),\r\n\r\n  /* callback function for setting socket options */\r\n  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),\r\n  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),\r\n\r\n  /* set to 0 to disable session ID re-use for this transfer, default is\r\n     enabled (== 1) */\r\n  CINIT(SSL_SESSIONID_CACHE, LONG, 150),\r\n\r\n  /* allowed SSH authentication methods */\r\n  CINIT(SSH_AUTH_TYPES, LONG, 151),\r\n\r\n  /* Used by scp/sftp to do public/private key authentication */\r\n  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),\r\n  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),\r\n\r\n  /* Send CCC (Clear Command Channel) after authentication */\r\n  CINIT(FTP_SSL_CCC, LONG, 154),\r\n\r\n  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */\r\n  CINIT(TIMEOUT_MS, LONG, 155),\r\n  CINIT(CONNECTTIMEOUT_MS, LONG, 156),\r\n\r\n  /* set to zero to disable the libcurl's decoding and thus pass the raw body\r\n     data to the application even when it is encoded/compressed */\r\n  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),\r\n  CINIT(HTTP_CONTENT_DECODING, LONG, 158),\r\n\r\n  /* Permission used when creating new files and directories on the remote\r\n     server for protocols that support it, SFTP/SCP/FILE */\r\n  CINIT(NEW_FILE_PERMS, LONG, 159),\r\n  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),\r\n\r\n  /* Set the behaviour of POST when redirecting. Values must be set to one\r\n     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */\r\n  CINIT(POSTREDIR, LONG, 161),\r\n\r\n  /* used by scp/sftp to verify the host's public key */\r\n  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),\r\n\r\n  /* Callback function for opening socket (instead of socket(2)). Optionally,\r\n     callback is able change the address or refuse to connect returning\r\n     CURL_SOCKET_BAD.  The callback should have type\r\n     curl_opensocket_callback */\r\n  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),\r\n  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),\r\n\r\n  /* POST volatile input fields. */\r\n  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),\r\n\r\n  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */\r\n  CINIT(PROXY_TRANSFER_MODE, LONG, 166),\r\n\r\n  /* Callback function for seeking in the input stream */\r\n  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),\r\n  CINIT(SEEKDATA, OBJECTPOINT, 168),\r\n\r\n  /* CRL file */\r\n  CINIT(CRLFILE, OBJECTPOINT, 169),\r\n\r\n  /* Issuer certificate */\r\n  CINIT(ISSUERCERT, OBJECTPOINT, 170),\r\n\r\n  /* (IPv6) Address scope */\r\n  CINIT(ADDRESS_SCOPE, LONG, 171),\r\n\r\n  /* Collect certificate chain info and allow it to get retrievable with\r\n     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only\r\n     working with OpenSSL-powered builds. */\r\n  CINIT(CERTINFO, LONG, 172),\r\n\r\n  /* \"name\" and \"pwd\" to use when fetching. */\r\n  CINIT(USERNAME, OBJECTPOINT, 173),\r\n  CINIT(PASSWORD, OBJECTPOINT, 174),\r\n\r\n    /* \"name\" and \"pwd\" to use with Proxy when fetching. */\r\n  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),\r\n  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),\r\n\r\n  /* Comma separated list of hostnames defining no-proxy zones. These should\r\n     match both hostnames directly, and hostnames within a domain. For\r\n     example, local.com will match local.com and www.local.com, but NOT\r\n     notlocal.com or www.notlocal.com. For compatibility with other\r\n     implementations of this, .local.com will be considered to be the same as\r\n     local.com. A single * is the only valid wildcard, and effectively\r\n     disables the use of proxy. */\r\n  CINIT(NOPROXY, OBJECTPOINT, 177),\r\n\r\n  /* block size for TFTP transfers */\r\n  CINIT(TFTP_BLKSIZE, LONG, 178),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),\r\n\r\n  /* set the bitmask for the protocols that are allowed to be used for the\r\n     transfer, which thus helps the app which takes URLs from users or other\r\n     external inputs and want to restrict what protocol(s) to deal\r\n     with. Defaults to CURLPROTO_ALL. */\r\n  CINIT(PROTOCOLS, LONG, 181),\r\n\r\n  /* set the bitmask for the protocols that libcurl is allowed to follow to,\r\n     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs\r\n     to be set in both bitmasks to be allowed to get redirected to. Defaults\r\n     to all protocols except FILE and SCP. */\r\n  CINIT(REDIR_PROTOCOLS, LONG, 182),\r\n\r\n  /* set the SSH knownhost file name to use */\r\n  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),\r\n\r\n  /* set the SSH host key callback, must point to a curl_sshkeycallback\r\n     function */\r\n  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),\r\n\r\n  /* set the SSH host key callback custom pointer */\r\n  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),\r\n\r\n  /* set the SMTP mail originator */\r\n  CINIT(MAIL_FROM, OBJECTPOINT, 186),\r\n\r\n  /* set the SMTP mail receiver(s) */\r\n  CINIT(MAIL_RCPT, OBJECTPOINT, 187),\r\n\r\n  /* FTP: send PRET before PASV */\r\n  CINIT(FTP_USE_PRET, LONG, 188),\r\n\r\n  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */\r\n  CINIT(RTSP_REQUEST, LONG, 189),\r\n\r\n  /* The RTSP session identifier */\r\n  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),\r\n\r\n  /* The RTSP stream URI */\r\n  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),\r\n\r\n  /* The Transport: header to use in RTSP requests */\r\n  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),\r\n\r\n  /* Manually initialize the client RTSP CSeq for this handle */\r\n  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),\r\n\r\n  /* Manually initialize the server RTSP CSeq for this handle */\r\n  CINIT(RTSP_SERVER_CSEQ, LONG, 194),\r\n\r\n  /* The stream to pass to INTERLEAVEFUNCTION. */\r\n  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),\r\n\r\n  /* Let the application define a custom write method for RTP data */\r\n  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),\r\n\r\n  /* Turn on wildcard matching */\r\n  CINIT(WILDCARDMATCH, LONG, 197),\r\n\r\n  /* Directory matching callback called before downloading of an\r\n     individual file (chunk) started */\r\n  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),\r\n\r\n  /* Directory matching callback called after the file (chunk)\r\n     was downloaded, or skipped */\r\n  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),\r\n\r\n  /* Change match (fnmatch-like) callback for wildcard matching */\r\n  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),\r\n\r\n  /* Let the application define custom chunk data pointer */\r\n  CINIT(CHUNK_DATA, OBJECTPOINT, 201),\r\n\r\n  /* FNMATCH_FUNCTION user pointer */\r\n  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),\r\n\r\n  /* send linked-list of name:port:address sets */\r\n  CINIT(RESOLVE, OBJECTPOINT, 203),\r\n\r\n  /* Set a username for authenticated TLS */\r\n  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),\r\n\r\n  /* Set a password for authenticated TLS */\r\n  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),\r\n\r\n  /* Set authentication type for authenticated TLS */\r\n  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),\r\n\r\n  /* Set to 1 to enable the \"TE:\" header in HTTP requests to ask for\r\n     compressed transfer-encoded responses. Set to 0 to disable the use of TE:\r\n     in outgoing requests. The current default is 0, but it might change in a\r\n     future libcurl release.\r\n\r\n     libcurl will ask for the compressed methods it knows of, and if that\r\n     isn't any, it will not ask for transfer-encoding at all even if this\r\n     option is set to 1.\r\n\r\n  */\r\n  CINIT(TRANSFER_ENCODING, LONG, 207),\r\n\r\n  /* Callback function for closing socket (instead of close(2)). The callback\r\n     should have type curl_closesocket_callback */\r\n  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),\r\n  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),\r\n\r\n  /* allow GSSAPI credential delegation */\r\n  CINIT(GSSAPI_DELEGATION, LONG, 210),\r\n\r\n  /* Set the name servers to use for DNS resolution */\r\n  CINIT(DNS_SERVERS, OBJECTPOINT, 211),\r\n\r\n  /* Time-out accept operations (currently for FTP only) after this amount\r\n     of miliseconds. */\r\n  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),\r\n\r\n  /* Set TCP keepalive */\r\n  CINIT(TCP_KEEPALIVE, LONG, 213),\r\n\r\n  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */\r\n  CINIT(TCP_KEEPIDLE, LONG, 214),\r\n  CINIT(TCP_KEEPINTVL, LONG, 215),\r\n\r\n  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */\r\n  CINIT(SSL_OPTIONS, LONG, 216),\r\n\r\n  /* set the SMTP auth originator */\r\n  CINIT(MAIL_AUTH, OBJECTPOINT, 217),\r\n\r\n  CURLOPT_LASTENTRY /* the last unused */\r\n} CURLoption;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2011 */\r\n\r\n/* This was added in version 7.19.1 */\r\n#define CURLOPT_POST301 CURLOPT_POSTREDIR\r\n\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n/* The following were added in 7.17.0 */\r\n#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_FTPAPPEND CURLOPT_APPEND\r\n#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY\r\n#define CURLOPT_FTP_SSL CURLOPT_USE_SSL\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL\r\n\r\n#else\r\n/* This is set if CURL_NO_OLDIES is defined at compile-time */\r\n#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */\r\n#endif\r\n\r\n\r\n  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host\r\n     name resolves addresses using more than one IP protocol version, this\r\n     option might be handy to force libcurl to use a specific IP version. */\r\n#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP\r\n                                     versions that your system allows */\r\n#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */\r\n#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */\r\n\r\n  /* three convenient \"aliases\" that follow the name scheme better */\r\n#define CURLOPT_WRITEDATA CURLOPT_FILE\r\n#define CURLOPT_READDATA  CURLOPT_INFILE\r\n#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER\r\n#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER\r\n\r\n  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */\r\nenum {\r\n  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd\r\n                             like the library to choose the best possible\r\n                             for us! */\r\n  CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */\r\n  CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */\r\n\r\n  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */\r\n};\r\n\r\n/*\r\n * Public API enums for RTSP requests\r\n */\r\nenum {\r\n    CURL_RTSPREQ_NONE, /* first in list */\r\n    CURL_RTSPREQ_OPTIONS,\r\n    CURL_RTSPREQ_DESCRIBE,\r\n    CURL_RTSPREQ_ANNOUNCE,\r\n    CURL_RTSPREQ_SETUP,\r\n    CURL_RTSPREQ_PLAY,\r\n    CURL_RTSPREQ_PAUSE,\r\n    CURL_RTSPREQ_TEARDOWN,\r\n    CURL_RTSPREQ_GET_PARAMETER,\r\n    CURL_RTSPREQ_SET_PARAMETER,\r\n    CURL_RTSPREQ_RECORD,\r\n    CURL_RTSPREQ_RECEIVE,\r\n    CURL_RTSPREQ_LAST /* last in list */\r\n};\r\n\r\n  /* These enums are for use with the CURLOPT_NETRC option. */\r\nenum CURL_NETRC_OPTION {\r\n  CURL_NETRC_IGNORED,     /* The .netrc will never be read.\r\n                           * This is the default. */\r\n  CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred\r\n                           * to one in the .netrc. */\r\n  CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.\r\n                           * Unless one is set programmatically, the .netrc\r\n                           * will be queried. */\r\n  CURL_NETRC_LAST\r\n};\r\n\r\nenum {\r\n  CURL_SSLVERSION_DEFAULT,\r\n  CURL_SSLVERSION_TLSv1,\r\n  CURL_SSLVERSION_SSLv2,\r\n  CURL_SSLVERSION_SSLv3,\r\n\r\n  CURL_SSLVERSION_LAST /* never use, keep last */\r\n};\r\n\r\nenum CURL_TLSAUTH {\r\n  CURL_TLSAUTH_NONE,\r\n  CURL_TLSAUTH_SRP,\r\n  CURL_TLSAUTH_LAST /* never use, keep last */\r\n};\r\n\r\n/* symbols to use with CURLOPT_POSTREDIR.\r\n   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303\r\n   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302\r\n   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */\r\n\r\n#define CURL_REDIR_GET_ALL  0\r\n#define CURL_REDIR_POST_301 1\r\n#define CURL_REDIR_POST_302 2\r\n#define CURL_REDIR_POST_303 4\r\n#define CURL_REDIR_POST_ALL \\\r\n    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)\r\n\r\ntypedef enum {\r\n  CURL_TIMECOND_NONE,\r\n\r\n  CURL_TIMECOND_IFMODSINCE,\r\n  CURL_TIMECOND_IFUNMODSINCE,\r\n  CURL_TIMECOND_LASTMOD,\r\n\r\n  CURL_TIMECOND_LAST\r\n} curl_TimeCond;\r\n\r\n\r\n/* curl_strequal() and curl_strnequal() are subject for removal in a future\r\n   libcurl, see lib/README.curlx for details */\r\nCURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);\r\nCURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);\r\n\r\n/* name is uppercase CURLFORM_<name> */\r\n#ifdef CFINIT\r\n#undef CFINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CFINIT(name) CURLFORM_ ## name\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define CFINIT(name) CURLFORM_/**/name\r\n#endif\r\n\r\ntypedef enum {\r\n  CFINIT(NOTHING),        /********* the first one is unused ************/\r\n\r\n  /*  */\r\n  CFINIT(COPYNAME),\r\n  CFINIT(PTRNAME),\r\n  CFINIT(NAMELENGTH),\r\n  CFINIT(COPYCONTENTS),\r\n  CFINIT(PTRCONTENTS),\r\n  CFINIT(CONTENTSLENGTH),\r\n  CFINIT(FILECONTENT),\r\n  CFINIT(ARRAY),\r\n  CFINIT(OBSOLETE),\r\n  CFINIT(FILE),\r\n\r\n  CFINIT(BUFFER),\r\n  CFINIT(BUFFERPTR),\r\n  CFINIT(BUFFERLENGTH),\r\n\r\n  CFINIT(CONTENTTYPE),\r\n  CFINIT(CONTENTHEADER),\r\n  CFINIT(FILENAME),\r\n  CFINIT(END),\r\n  CFINIT(OBSOLETE2),\r\n\r\n  CFINIT(STREAM),\r\n\r\n  CURLFORM_LASTENTRY /* the last unused */\r\n} CURLformoption;\r\n\r\n#undef CFINIT /* done */\r\n\r\n/* structure to be used as parameter for CURLFORM_ARRAY */\r\nstruct curl_forms {\r\n  CURLformoption option;\r\n  const char     *value;\r\n};\r\n\r\n/* use this for multipart formpost building */\r\n/* Returns code for curl_formadd()\r\n *\r\n * Returns:\r\n * CURL_FORMADD_OK             on success\r\n * CURL_FORMADD_MEMORY         if the FormInfo allocation fails\r\n * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form\r\n * CURL_FORMADD_NULL           if a null pointer was given for a char\r\n * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed\r\n * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used\r\n * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)\r\n * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated\r\n * CURL_FORMADD_MEMORY         if some allocation for string copying failed.\r\n * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array\r\n *\r\n ***************************************************************************/\r\ntypedef enum {\r\n  CURL_FORMADD_OK, /* first, no error */\r\n\r\n  CURL_FORMADD_MEMORY,\r\n  CURL_FORMADD_OPTION_TWICE,\r\n  CURL_FORMADD_NULL,\r\n  CURL_FORMADD_UNKNOWN_OPTION,\r\n  CURL_FORMADD_INCOMPLETE,\r\n  CURL_FORMADD_ILLEGAL_ARRAY,\r\n  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */\r\n\r\n  CURL_FORMADD_LAST /* last */\r\n} CURLFORMcode;\r\n\r\n/*\r\n * NAME curl_formadd()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Pretty advanced function for building multi-part formposts. Each invoke\r\n * adds one part that together construct a full post. Then use\r\n * CURLOPT_HTTPPOST to send it off to libcurl.\r\n */\r\nCURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,\r\n                                      struct curl_httppost **last_post,\r\n                                      ...);\r\n\r\n/*\r\n * callback function for curl_formget()\r\n * The void *arg pointer will be the one passed as second argument to\r\n *   curl_formget().\r\n * The character buffer passed to it must not be freed.\r\n * Should return the buffer length passed to it as the argument \"len\" on\r\n *   success.\r\n */\r\ntypedef size_t (*curl_formget_callback)(void *arg, const char *buf,\r\n                                        size_t len);\r\n\r\n/*\r\n * NAME curl_formget()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Serialize a curl_httppost struct built with curl_formadd().\r\n * Accepts a void pointer as second argument which will be passed to\r\n * the curl_formget_callback function.\r\n * Returns 0 on success.\r\n */\r\nCURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,\r\n                             curl_formget_callback append);\r\n/*\r\n * NAME curl_formfree()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Free a multipart formpost previously built with curl_formadd().\r\n */\r\nCURL_EXTERN void curl_formfree(struct curl_httppost *form);\r\n\r\n/*\r\n * NAME curl_getenv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a malloc()'ed string that MUST be curl_free()ed after usage is\r\n * complete. DEPRECATED - see lib/README.curlx\r\n */\r\nCURL_EXTERN char *curl_getenv(const char *variable);\r\n\r\n/*\r\n * NAME curl_version()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a static ascii string of the libcurl version.\r\n */\r\nCURL_EXTERN char *curl_version(void);\r\n\r\n/*\r\n * NAME curl_easy_escape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Escapes URL strings (converts all letters consider illegal in URLs to their\r\n * %XX versions). This function returns a new allocated string or NULL if an\r\n * error occurred.\r\n */\r\nCURL_EXTERN char *curl_easy_escape(CURL *handle,\r\n                                   const char *string,\r\n                                   int length);\r\n\r\n/* the previous version: */\r\nCURL_EXTERN char *curl_escape(const char *string,\r\n                              int length);\r\n\r\n\r\n/*\r\n * NAME curl_easy_unescape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Unescapes URL encoding in strings (converts all %XX codes to their 8bit\r\n * versions). This function returns a new allocated string or NULL if an error\r\n * occurred.\r\n * Conversion Note: On non-ASCII platforms the ASCII %XX codes are\r\n * converted into the host encoding.\r\n */\r\nCURL_EXTERN char *curl_easy_unescape(CURL *handle,\r\n                                     const char *string,\r\n                                     int length,\r\n                                     int *outlength);\r\n\r\n/* the previous version */\r\nCURL_EXTERN char *curl_unescape(const char *string,\r\n                                int length);\r\n\r\n/*\r\n * NAME curl_free()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Provided for de-allocation in the same translation unit that did the\r\n * allocation. Added in libcurl 7.10\r\n */\r\nCURL_EXTERN void curl_free(void *p);\r\n\r\n/*\r\n * NAME curl_global_init()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() should be invoked exactly once for each application that\r\n * uses libcurl and before any call of other libcurl functions.\r\n *\r\n * This function is not thread-safe!\r\n */\r\nCURL_EXTERN CURLcode curl_global_init(long flags);\r\n\r\n/*\r\n * NAME curl_global_init_mem()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() or curl_global_init_mem() should be invoked exactly once\r\n * for each application that uses libcurl.  This function can be used to\r\n * initialize libcurl and set user defined memory management callback\r\n * functions.  Users can implement memory management routines to check for\r\n * memory leaks, check for mis-use of the curl library etc.  User registered\r\n * callback routines with be invoked by this library instead of the system\r\n * memory management routines like malloc, free etc.\r\n */\r\nCURL_EXTERN CURLcode curl_global_init_mem(long flags,\r\n                                          curl_malloc_callback m,\r\n                                          curl_free_callback f,\r\n                                          curl_realloc_callback r,\r\n                                          curl_strdup_callback s,\r\n                                          curl_calloc_callback c);\r\n\r\n/*\r\n * NAME curl_global_cleanup()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_cleanup() should be invoked exactly once for each application\r\n * that uses libcurl\r\n */\r\nCURL_EXTERN void curl_global_cleanup(void);\r\n\r\n/* linked-list structure for the CURLOPT_QUOTE option (and other) */\r\nstruct curl_slist {\r\n  char *data;\r\n  struct curl_slist *next;\r\n};\r\n\r\n/*\r\n * NAME curl_slist_append()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Appends a string to a linked list. If no list exists, it will be created\r\n * first. Returns the new list, after appending.\r\n */\r\nCURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,\r\n                                                 const char *);\r\n\r\n/*\r\n * NAME curl_slist_free_all()\r\n *\r\n * DESCRIPTION\r\n *\r\n * free a previously built curl_slist.\r\n */\r\nCURL_EXTERN void curl_slist_free_all(struct curl_slist *);\r\n\r\n/*\r\n * NAME curl_getdate()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns the time, in seconds since 1 Jan 1970 of the time string given in\r\n * the first argument. The time argument in the second parameter is unused\r\n * and should be set to NULL.\r\n */\r\nCURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);\r\n\r\n/* info about the certificate chain, only for OpenSSL builds. Asked\r\n   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */\r\nstruct curl_certinfo {\r\n  int num_of_certs;             /* number of certificates with information */\r\n  struct curl_slist **certinfo; /* for each index in this array, there's a\r\n                                   linked list with textual information in the\r\n                                   format \"name: value\" */\r\n};\r\n\r\n#define CURLINFO_STRING   0x100000\r\n#define CURLINFO_LONG     0x200000\r\n#define CURLINFO_DOUBLE   0x300000\r\n#define CURLINFO_SLIST    0x400000\r\n#define CURLINFO_MASK     0x0fffff\r\n#define CURLINFO_TYPEMASK 0xf00000\r\n\r\ntypedef enum {\r\n  CURLINFO_NONE, /* first, never use this */\r\n  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,\r\n  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,\r\n  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,\r\n  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,\r\n  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,\r\n  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,\r\n  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,\r\n  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,\r\n  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,\r\n  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,\r\n  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,\r\n  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,\r\n  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,\r\n  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,\r\n  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,\r\n  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,\r\n  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,\r\n  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,\r\n  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,\r\n  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,\r\n  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,\r\n  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,\r\n  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,\r\n  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,\r\n  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,\r\n  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,\r\n  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,\r\n  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,\r\n  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,\r\n  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,\r\n  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,\r\n  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,\r\n  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,\r\n  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,\r\n  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,\r\n  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,\r\n  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,\r\n  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,\r\n  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,\r\n  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,\r\n  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,\r\n  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,\r\n  /* Fill in new entries below here! */\r\n\r\n  CURLINFO_LASTONE          = 42\r\n} CURLINFO;\r\n\r\n/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as\r\n   CURLINFO_HTTP_CODE */\r\n#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE\r\n\r\ntypedef enum {\r\n  CURLCLOSEPOLICY_NONE, /* first, never use this */\r\n\r\n  CURLCLOSEPOLICY_OLDEST,\r\n  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,\r\n  CURLCLOSEPOLICY_LEAST_TRAFFIC,\r\n  CURLCLOSEPOLICY_SLOWEST,\r\n  CURLCLOSEPOLICY_CALLBACK,\r\n\r\n  CURLCLOSEPOLICY_LAST /* last, never use this */\r\n} curl_closepolicy;\r\n\r\n#define CURL_GLOBAL_SSL (1<<0)\r\n#define CURL_GLOBAL_WIN32 (1<<1)\r\n#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)\r\n#define CURL_GLOBAL_NOTHING 0\r\n#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL\r\n\r\n\r\n/*****************************************************************************\r\n * Setup defines, protos etc for the sharing stuff.\r\n */\r\n\r\n/* Different data locks for a single share */\r\ntypedef enum {\r\n  CURL_LOCK_DATA_NONE = 0,\r\n  /*  CURL_LOCK_DATA_SHARE is used internally to say that\r\n   *  the locking is just made to change the internal state of the share\r\n   *  itself.\r\n   */\r\n  CURL_LOCK_DATA_SHARE,\r\n  CURL_LOCK_DATA_COOKIE,\r\n  CURL_LOCK_DATA_DNS,\r\n  CURL_LOCK_DATA_SSL_SESSION,\r\n  CURL_LOCK_DATA_CONNECT,\r\n  CURL_LOCK_DATA_LAST\r\n} curl_lock_data;\r\n\r\n/* Different lock access types */\r\ntypedef enum {\r\n  CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */\r\n  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */\r\n  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */\r\n  CURL_LOCK_ACCESS_LAST        /* never use */\r\n} curl_lock_access;\r\n\r\ntypedef void (*curl_lock_function)(CURL *handle,\r\n                                   curl_lock_data data,\r\n                                   curl_lock_access locktype,\r\n                                   void *userptr);\r\ntypedef void (*curl_unlock_function)(CURL *handle,\r\n                                     curl_lock_data data,\r\n                                     void *userptr);\r\n\r\ntypedef void CURLSH;\r\n\r\ntypedef enum {\r\n  CURLSHE_OK,  /* all is fine */\r\n  CURLSHE_BAD_OPTION, /* 1 */\r\n  CURLSHE_IN_USE,     /* 2 */\r\n  CURLSHE_INVALID,    /* 3 */\r\n  CURLSHE_NOMEM,      /* 4 out of memory */\r\n  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */\r\n  CURLSHE_LAST        /* never use */\r\n} CURLSHcode;\r\n\r\ntypedef enum {\r\n  CURLSHOPT_NONE,  /* don't use */\r\n  CURLSHOPT_SHARE,   /* specify a data type to share */\r\n  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */\r\n  CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */\r\n  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */\r\n  CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock\r\n                           callback functions */\r\n  CURLSHOPT_LAST  /* never use */\r\n} CURLSHoption;\r\n\r\nCURL_EXTERN CURLSH *curl_share_init(void);\r\nCURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);\r\nCURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);\r\n\r\n/****************************************************************************\r\n * Structures for querying information about the curl library at runtime.\r\n */\r\n\r\ntypedef enum {\r\n  CURLVERSION_FIRST,\r\n  CURLVERSION_SECOND,\r\n  CURLVERSION_THIRD,\r\n  CURLVERSION_FOURTH,\r\n  CURLVERSION_LAST /* never actually use this */\r\n} CURLversion;\r\n\r\n/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by\r\n   basically all programs ever that want to get version information. It is\r\n   meant to be a built-in version number for what kind of struct the caller\r\n   expects. If the struct ever changes, we redefine the NOW to another enum\r\n   from above. */\r\n#define CURLVERSION_NOW CURLVERSION_FOURTH\r\n\r\ntypedef struct {\r\n  CURLversion age;          /* age of the returned struct */\r\n  const char *version;      /* LIBCURL_VERSION */\r\n  unsigned int version_num; /* LIBCURL_VERSION_NUM */\r\n  const char *host;         /* OS/host/cpu/machine when configured */\r\n  int features;             /* bitmask, see defines below */\r\n  const char *ssl_version;  /* human readable string */\r\n  long ssl_version_num;     /* not used anymore, always 0 */\r\n  const char *libz_version; /* human readable string */\r\n  /* protocols is terminated by an entry with a NULL protoname */\r\n  const char * const *protocols;\r\n\r\n  /* The fields below this were added in CURLVERSION_SECOND */\r\n  const char *ares;\r\n  int ares_num;\r\n\r\n  /* This field was added in CURLVERSION_THIRD */\r\n  const char *libidn;\r\n\r\n  /* These field were added in CURLVERSION_FOURTH */\r\n\r\n  /* Same as '_libiconv_version' if built with HAVE_ICONV */\r\n  int iconv_ver_num;\r\n\r\n  const char *libssh_version; /* human readable string */\r\n\r\n} curl_version_info_data;\r\n\r\n#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */\r\n#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */\r\n#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */\r\n#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */\r\n#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */\r\n#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */\r\n#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */\r\n#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */\r\n#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */\r\n#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */\r\n#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */\r\n#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */\r\n#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */\r\n#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */\r\n#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */\r\n#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM delegating to winbind helper */\r\n\r\n /*\r\n * NAME curl_version_info()\r\n *\r\n * DESCRIPTION\r\n *\r\n * This function returns a pointer to a static copy of the version info\r\n * struct. See above.\r\n */\r\nCURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);\r\n\r\n/*\r\n * NAME curl_easy_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_strerror function may be used to turn a CURLcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_easy_strerror(CURLcode);\r\n\r\n/*\r\n * NAME curl_share_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_share_strerror function may be used to turn a CURLSHcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_share_strerror(CURLSHcode);\r\n\r\n/*\r\n * NAME curl_easy_pause()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_pause function pauses or unpauses transfers. Select the new\r\n * state by setting the bitmask, use the convenience defines below.\r\n *\r\n */\r\nCURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);\r\n\r\n#define CURLPAUSE_RECV      (1<<0)\r\n#define CURLPAUSE_RECV_CONT (0)\r\n\r\n#define CURLPAUSE_SEND      (1<<2)\r\n#define CURLPAUSE_SEND_CONT (0)\r\n\r\n#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)\r\n#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n/* unfortunately, the easy.h and multi.h include files need options and info\r\n  stuff before they can be included! */\r\n#include \"easy.h\" /* nothing in curl is fun without the easy stuff */\r\n#include \"multi.h\"\r\n\r\n/* the typechecker doesn't work in C++ (yet) */\r\n#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \\\r\n    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \\\r\n    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)\r\n#include \"typecheck-gcc.h\"\r\n#else\r\n#if defined(__STDC__) && (__STDC__ >= 1)\r\n/* This preprocessor magic that replaces a call with the exact same call is\r\n   only done to make sure application authors pass exactly three arguments\r\n   to these functions. */\r\n#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)\r\n#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n#endif /* __STDC__ >= 1 */\r\n#endif /* gcc >= 4.3 && !__cplusplus */\r\n\r\n#endif /* __CURL_CURL_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/curlbuild.h",
    "content": "/* include/curl/curlbuild.h.  Generated from curlbuild.h.in by configure.  */\r\n#ifndef __CURL_CURLBUILD_H\r\n#define __CURL_CURLBUILD_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * If you think that something actually needs to be changed, adjusted\r\n * or fixed in this file, then, report it on the libcurl development\r\n * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * This header file shall only export symbols which are 'curl' or 'CURL'\r\n * prefixed, otherwise public name space would be polluted.\r\n *\r\n * NOTE 2:\r\n * -------\r\n *\r\n * Right now you might be staring at file include/curl/curlbuild.h.in or\r\n * at file include/curl/curlbuild.h, this is due to the following reason:\r\n *\r\n * On systems capable of running the configure script, the configure process\r\n * will overwrite the distributed include/curl/curlbuild.h file with one that\r\n * is suitable and specific to the library being configured and built, which\r\n * is generated from the include/curl/curlbuild.h.in template file.\r\n *\r\n */\r\n\r\n/* ================================================================ */\r\n/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */\r\n/* ================================================================ */\r\n\r\n#ifdef CURL_SIZEOF_LONG\r\n#error \"CURL_SIZEOF_LONG shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#error \"CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#error \"CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_OFF_T\r\n#error \"CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_T\r\n#error \"CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_TU\r\n#error \"CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_OFF_T\r\n#error \"CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_OFF_T\r\n#error \"CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_T\r\n#error \"CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_TU\r\n#error \"CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n/* ================================================================ */\r\n/*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */\r\n/* ================================================================ */\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file ws2tcpip.h must be included by the external interface. */\r\n/* #undef CURL_PULL_WS2TCPIP_H */\r\n#ifdef CURL_PULL_WS2TCPIP_H\r\n#  ifndef WIN32_LEAN_AND_MEAN\r\n#    define WIN32_LEAN_AND_MEAN\r\n#  endif\r\n#  include <windows.h>\r\n#  include <winsock2.h>\r\n#  include <ws2tcpip.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system   */\r\n/* header file sys/types.h must be included by the external interface. */\r\n#define CURL_PULL_SYS_TYPES_H 1\r\n#ifdef CURL_PULL_SYS_TYPES_H\r\n#  include <sys/types.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system */\r\n/* header file stdint.h must be included by the external interface.  */\r\n#define CURL_PULL_STDINT_H 1\r\n#ifdef CURL_PULL_STDINT_H\r\n#  include <stdint.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file inttypes.h must be included by the external interface. */\r\n#define CURL_PULL_INTTYPES_H 1\r\n#ifdef CURL_PULL_INTTYPES_H\r\n#  include <inttypes.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system    */\r\n/* header file sys/socket.h must be included by the external interface. */\r\n#define CURL_PULL_SYS_SOCKET_H 1\r\n#ifdef CURL_PULL_SYS_SOCKET_H\r\n#  include <sys/socket.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file sys/poll.h must be included by the external interface. */\r\n/* #undef CURL_PULL_SYS_POLL_H */\r\n#ifdef CURL_PULL_SYS_POLL_H\r\n#  include <sys/poll.h>\r\n#endif\r\n\r\n/* The size of `long', as computed by sizeof. */\r\n#define CURL_SIZEOF_LONG 4\r\n\r\n/* Integral data type used for curl_socklen_t. */\r\n#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n\r\n/* The size of `curl_socklen_t', as computed by sizeof. */\r\n#define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n/* Data type definition of curl_socklen_t. */\r\ntypedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;\r\n\r\n/* Signed integral data type used for curl_off_t. */\r\n#define CURL_TYPEOF_CURL_OFF_T int64_t\r\n\r\n/* Data type definition of curl_off_t. */\r\ntypedef CURL_TYPEOF_CURL_OFF_T curl_off_t;\r\n\r\n/* curl_off_t formatting string directive without \"%\" conversion specifier. */\r\n#define CURL_FORMAT_CURL_OFF_T \"lld\"\r\n\r\n/* unsigned curl_off_t formatting string without \"%\" conversion specifier. */\r\n#define CURL_FORMAT_CURL_OFF_TU \"llu\"\r\n\r\n/* curl_off_t formatting string directive with \"%\" conversion specifier. */\r\n#define CURL_FORMAT_OFF_T \"%lld\"\r\n\r\n/* The size of `curl_off_t', as computed by sizeof. */\r\n#define CURL_SIZEOF_CURL_OFF_T 8\r\n\r\n/* curl_off_t constant suffix. */\r\n#define CURL_SUFFIX_CURL_OFF_T LL\r\n\r\n/* unsigned curl_off_t constant suffix. */\r\n#define CURL_SUFFIX_CURL_OFF_TU ULL\r\n\r\n#endif /* __CURL_CURLBUILD_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/curlrules.h",
    "content": "#ifndef __CURL_CURLRULES_H\r\n#define __CURL_CURLRULES_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*                    COMPILE TIME SANITY CHECKS                    */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * All checks done in this file are intentionally placed in a public\r\n * header file which is pulled by curl/curl.h when an application is\r\n * being built using an already built libcurl library. Additionally\r\n * this file is also included and used when building the library.\r\n *\r\n * If compilation fails on this file it is certainly sure that the\r\n * problem is elsewhere. It could be a problem in the curlbuild.h\r\n * header file, or simply that you are using different compilation\r\n * settings than those used to build the library.\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * Do not deactivate any check, these are done to make sure that the\r\n * library is properly built and used.\r\n *\r\n * You can find further help on the libcurl development mailing list:\r\n * http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * NOTE 2\r\n * ------\r\n *\r\n * Some of the following compile time checks are based on the fact\r\n * that the dimension of a constant array can not be a negative one.\r\n * In this way if the compile time verification fails, the compilation\r\n * will fail issuing an error. The error description wording is compiler\r\n * dependent but it will be quite similar to one of the following:\r\n *\r\n *   \"negative subscript or subscript is too large\"\r\n *   \"array must have at least one element\"\r\n *   \"-1 is an illegal array size\"\r\n *   \"size of array is negative\"\r\n *\r\n * If you are building an application which tries to use an already\r\n * built libcurl library and you are getting this kind of errors on\r\n * this file, it is a clear indication that there is a mismatch between\r\n * how the library was built and how you are trying to use it for your\r\n * application. Your already compiled or binary library provider is the\r\n * only one who can give you the details you need to properly use it.\r\n */\r\n\r\n/*\r\n * Verify that some macros are actually defined.\r\n */\r\n\r\n#ifndef CURL_SIZEOF_LONG\r\n#  error \"CURL_SIZEOF_LONG definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_OFF_T\r\n#  error \"CURL_TYPEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_T\r\n#  error \"CURL_FORMAT_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_TU\r\n#  error \"CURL_FORMAT_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_OFF_T\r\n#  error \"CURL_FORMAT_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_OFF_T\r\n#  error \"CURL_SIZEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_T\r\n#  error \"CURL_SUFFIX_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_TU\r\n#  error \"CURL_SUFFIX_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n/*\r\n * Macros private to this header file.\r\n */\r\n\r\n#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1\r\n\r\n#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1\r\n\r\n/*\r\n * Verify that the size previously defined and expected for long\r\n * is the same as the one reported by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_01__\r\n    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_off_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_02__\r\n    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_off_t as reported\r\n * by sizeof() is greater or equal than the one reported for long\r\n * for the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_03__\r\n    [CurlchkszGE(curl_off_t, long)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_socklen_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_04__\r\n    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_socklen_t as reported\r\n * by sizeof() is greater or equal than the one reported for int for\r\n * the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_05__\r\n    [CurlchkszGE(curl_socklen_t, int)];\r\n\r\n/* ================================================================ */\r\n/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */\r\n/* ================================================================ */\r\n\r\n/*\r\n * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow\r\n * these to be visible and exported by the external libcurl interface API,\r\n * while also making them visible to the library internals, simply including\r\n * curl_setup.h, without actually needing to include curl.h internally.\r\n * If some day this section would grow big enough, all this should be moved\r\n * to its own header file.\r\n */\r\n\r\n/*\r\n * Figure out if we can use the ## preprocessor operator, which is supported\r\n * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__\r\n * or  __cplusplus so we need to carefully check for them too.\r\n */\r\n\r\n#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \\\r\n  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \\\r\n  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \\\r\n  defined(__ILEC400__)\r\n  /* This compiler is believed to have an ISO compatible preprocessor */\r\n#define CURL_ISOCPP\r\n#else\r\n  /* This compiler is believed NOT to have an ISO compatible preprocessor */\r\n#undef CURL_ISOCPP\r\n#endif\r\n\r\n/*\r\n * Macros for minimum-width signed and unsigned curl_off_t integer constants.\r\n */\r\n\r\n#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)\r\n#  define __CURL_OFF_T_C_HLPR2(x) x\r\n#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)\r\n#else\r\n#  ifdef CURL_ISOCPP\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix\r\n#  else\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix\r\n#  endif\r\n#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)\r\n#endif\r\n\r\n/*\r\n * Get rid of macros private to this header file.\r\n */\r\n\r\n#undef CurlchkszEQ\r\n#undef CurlchkszGE\r\n\r\n/*\r\n * Get rid of macros not intended to exist beyond this point.\r\n */\r\n\r\n#undef CURL_PULL_WS2TCPIP_H\r\n#undef CURL_PULL_SYS_TYPES_H\r\n#undef CURL_PULL_SYS_SOCKET_H\r\n#undef CURL_PULL_SYS_POLL_H\r\n#undef CURL_PULL_STDINT_H\r\n#undef CURL_PULL_INTTYPES_H\r\n\r\n#undef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#undef CURL_TYPEOF_CURL_OFF_T\r\n\r\n#ifdef CURL_NO_OLDIES\r\n#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */\r\n#endif\r\n\r\n#endif /* __CURL_CURLRULES_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/curlver.h",
    "content": "#ifndef __CURL_CURLVER_H\r\n#define __CURL_CURLVER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* This header file contains nothing but libcurl version info, generated by\r\n   a script at release-time. This was made its own header file in 7.11.2 */\r\n\r\n/* This is the global package copyright */\r\n#define LIBCURL_COPYRIGHT \"1996 - 2013 Daniel Stenberg, <daniel@haxx.se>.\"\r\n\r\n/* This is the version number of the libcurl package from which this header\r\n   file origins: */\r\n#define LIBCURL_VERSION \"7.29.0\"\r\n\r\n/* The numeric version number is also available \"in parts\" by using these\r\n   defines: */\r\n#define LIBCURL_VERSION_MAJOR 7\r\n#define LIBCURL_VERSION_MINOR 29\r\n#define LIBCURL_VERSION_PATCH 0\r\n\r\n/* This is the numeric version of the libcurl version number, meant for easier\r\n   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will\r\n   always follow this syntax:\r\n\r\n         0xXXYYZZ\r\n\r\n   Where XX, YY and ZZ are the main version, release and patch numbers in\r\n   hexadecimal (using 8 bits each). All three numbers are always represented\r\n   using two digits.  1.2 would appear as \"0x010200\" while version 9.11.7\r\n   appears as \"0x090b07\".\r\n\r\n   This 6-digit (24 bits) hexadecimal number does not show pre-release number,\r\n   and it is always a greater number in a more recent release. It makes\r\n   comparisons with greater than and less than work.\r\n*/\r\n#define LIBCURL_VERSION_NUM 0x071d00\r\n\r\n/*\r\n * This is the date and time when the full source package was created. The\r\n * timestamp is not stored in git, as the timestamp is properly set in the\r\n * tarballs by the maketgz script.\r\n *\r\n * The format of the date should follow this template:\r\n *\r\n * \"Mon Feb 12 11:35:33 UTC 2007\"\r\n */\r\n#define LIBCURL_TIMESTAMP \"Wed Feb  6 10:13:08 UTC 2013\"\r\n\r\n#endif /* __CURL_CURLVER_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/easy.h",
    "content": "#ifndef __CURL_EASY_H\r\n#define __CURL_EASY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN CURL *curl_easy_init(void);\r\nCURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);\r\nCURL_EXTERN CURLcode curl_easy_perform(CURL *curl);\r\nCURL_EXTERN void curl_easy_cleanup(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_getinfo()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Request internal information from the curl session with this function.  The\r\n * third argument MUST be a pointer to a long, a pointer to a char * or a\r\n * pointer to a double (as the documentation describes elsewhere).  The data\r\n * pointed to will be filled in accordingly and can be relied upon only if the\r\n * function returns CURLE_OK.  This function is intended to get used *AFTER* a\r\n * performed transfer, all results from this function are undefined until the\r\n * transfer is completed.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);\r\n\r\n\r\n/*\r\n * NAME curl_easy_duphandle()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Creates a new curl session handle with the same options set for the handle\r\n * passed in. Duplicating a handle could only be a matter of cloning data and\r\n * options, internal state info and things like persistent connections cannot\r\n * be transferred. It is useful in multithreaded applications when you can run\r\n * curl_easy_duphandle() for each new thread to avoid a series of identical\r\n * curl_easy_setopt() invokes in every thread.\r\n */\r\nCURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_reset()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Re-initializes a CURL handle to the default values. This puts back the\r\n * handle to the same state as it was in when it was just created.\r\n *\r\n * It does keep: live connections, the Session ID cache, the DNS cache and the\r\n * cookies.\r\n */\r\nCURL_EXTERN void curl_easy_reset(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_recv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Receives data from the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,\r\n                                    size_t *n);\r\n\r\n/*\r\n * NAME curl_easy_send()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Sends data over the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,\r\n                                    size_t buflen, size_t *n);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/mprintf.h",
    "content": "#ifndef __CURL_MPRINTF_H\r\n#define __CURL_MPRINTF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <stdarg.h>\r\n#include <stdio.h> /* needed for FILE */\r\n\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN int curl_mprintf(const char *format, ...);\r\nCURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);\r\nCURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);\r\nCURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,\r\n                               const char *format, ...);\r\nCURL_EXTERN int curl_mvprintf(const char *format, va_list args);\r\nCURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,\r\n                                const char *format, va_list args);\r\nCURL_EXTERN char *curl_maprintf(const char *format, ...);\r\nCURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);\r\n\r\n#ifdef _MPRINTF_REPLACE\r\n# undef printf\r\n# undef fprintf\r\n# undef sprintf\r\n# undef vsprintf\r\n# undef snprintf\r\n# undef vprintf\r\n# undef vfprintf\r\n# undef vsnprintf\r\n# undef aprintf\r\n# undef vaprintf\r\n# define printf curl_mprintf\r\n# define fprintf curl_mfprintf\r\n#ifdef CURLDEBUG\r\n/* When built with CURLDEBUG we define away the sprintf() functions since we\r\n   don't want internal code to be using them */\r\n# define sprintf sprintf_was_used\r\n# define vsprintf vsprintf_was_used\r\n#else\r\n# define sprintf curl_msprintf\r\n# define vsprintf curl_mvsprintf\r\n#endif\r\n# define snprintf curl_msnprintf\r\n# define vprintf curl_mvprintf\r\n# define vfprintf curl_mvfprintf\r\n# define vsnprintf curl_mvsnprintf\r\n# define aprintf curl_maprintf\r\n# define vaprintf curl_mvaprintf\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* __CURL_MPRINTF_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/multi.h",
    "content": "#ifndef __CURL_MULTI_H\r\n#define __CURL_MULTI_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n  This is an \"external\" header file. Don't give away any internals here!\r\n\r\n  GOALS\r\n\r\n  o Enable a \"pull\" interface. The application that uses libcurl decides where\r\n    and when to ask libcurl to get/send data.\r\n\r\n  o Enable multiple simultaneous transfers in the same thread without making it\r\n    complicated for the application.\r\n\r\n  o Enable the application to select() on its own file descriptors and curl's\r\n    file descriptors simultaneous easily.\r\n\r\n*/\r\n\r\n/*\r\n * This header file should not really need to include \"curl.h\" since curl.h\r\n * itself includes this file and we expect user applications to do #include\r\n * <curl/curl.h> without the need for especially including multi.h.\r\n *\r\n * For some reason we added this include here at one point, and rather than to\r\n * break existing (wrongly written) libcurl applications, we leave it as-is\r\n * but with this warning attached.\r\n */\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURLM;\r\n\r\ntypedef enum {\r\n  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or\r\n                                    curl_multi_socket*() soon */\r\n  CURLM_OK,\r\n  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */\r\n  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */\r\n  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */\r\n  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */\r\n  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */\r\n  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */\r\n  CURLM_LAST\r\n} CURLMcode;\r\n\r\n/* just to make code nicer when using curl_multi_socket() you can now check\r\n   for CURLM_CALL_MULTI_SOCKET too in the same style it works for\r\n   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */\r\n#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM\r\n\r\ntypedef enum {\r\n  CURLMSG_NONE, /* first, not used */\r\n  CURLMSG_DONE, /* This easy handle has completed. 'result' contains\r\n                   the CURLcode of the transfer */\r\n  CURLMSG_LAST /* last, not used */\r\n} CURLMSG;\r\n\r\nstruct CURLMsg {\r\n  CURLMSG msg;       /* what this message means */\r\n  CURL *easy_handle; /* the handle it concerns */\r\n  union {\r\n    void *whatever;    /* message-specific data */\r\n    CURLcode result;   /* return code for transfer */\r\n  } data;\r\n};\r\ntypedef struct CURLMsg CURLMsg;\r\n\r\n/* Based on poll(2) structure and values.\r\n * We don't use pollfd and POLL* constants explicitly\r\n * to cover platforms without poll(). */\r\n#define CURL_WAIT_POLLIN    0x0001\r\n#define CURL_WAIT_POLLPRI   0x0002\r\n#define CURL_WAIT_POLLOUT   0x0004\r\n\r\nstruct curl_waitfd {\r\n  curl_socket_t fd;\r\n  short events;\r\n  short revents; /* not supported yet */\r\n};\r\n\r\n/*\r\n * Name:    curl_multi_init()\r\n *\r\n * Desc:    inititalize multi-style curl usage\r\n *\r\n * Returns: a new CURLM handle to use in all 'curl_multi' functions.\r\n */\r\nCURL_EXTERN CURLM *curl_multi_init(void);\r\n\r\n/*\r\n * Name:    curl_multi_add_handle()\r\n *\r\n * Desc:    add a standard curl handle to the multi stack\r\n *\r\n * Returns: CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,\r\n                                            CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_remove_handle()\r\n  *\r\n  * Desc:    removes a curl handle from the multi stack again\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,\r\n                                               CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_fdset()\r\n  *\r\n  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or\r\n  *          poll() on. We want curl_multi_perform() called as soon as one of\r\n  *          them are ready.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,\r\n                                       fd_set *read_fd_set,\r\n                                       fd_set *write_fd_set,\r\n                                       fd_set *exc_fd_set,\r\n                                       int *max_fd);\r\n\r\n/*\r\n * Name:     curl_multi_wait()\r\n *\r\n * Desc:     Poll on all fds within a CURLM set as well as any\r\n *           additional fds passed to the function.\r\n *\r\n * Returns:  CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,\r\n                                      struct curl_waitfd extra_fds[],\r\n                                      unsigned int extra_nfds,\r\n                                      int timeout_ms,\r\n                                      int *ret);\r\n\r\n /*\r\n  * Name:    curl_multi_perform()\r\n  *\r\n  * Desc:    When the app thinks there's data available for curl it calls this\r\n  *          function to read/write whatever there is right now. This returns\r\n  *          as soon as the reads and writes are done. This function does not\r\n  *          require that there actually is data available for reading or that\r\n  *          data can be written, it can be called just in case. It returns\r\n  *          the number of handles that still transfer data in the second\r\n  *          argument's integer-pointer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code. *NOTE* that this only\r\n  *          returns errors etc regarding the whole multi stack. There might\r\n  *          still have occurred problems on invidual transfers even when this\r\n  *          returns OK.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,\r\n                                         int *running_handles);\r\n\r\n /*\r\n  * Name:    curl_multi_cleanup()\r\n  *\r\n  * Desc:    Cleans up and removes a whole multi stack. It does not free or\r\n  *          touch any individual easy handles in any way. We need to define\r\n  *          in what state those handles will be if this function is called\r\n  *          in the middle of a transfer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);\r\n\r\n/*\r\n * Name:    curl_multi_info_read()\r\n *\r\n * Desc:    Ask the multi handle if there's any messages/informationals from\r\n *          the individual transfers. Messages include informationals such as\r\n *          error code from the transfer or just the fact that a transfer is\r\n *          completed. More details on these should be written down as well.\r\n *\r\n *          Repeated calls to this function will return a new struct each\r\n *          time, until a special \"end of msgs\" struct is returned as a signal\r\n *          that there is no more to get at this point.\r\n *\r\n *          The data the returned pointer points to will not survive calling\r\n *          curl_multi_cleanup().\r\n *\r\n *          The 'CURLMsg' struct is meant to be very simple and only contain\r\n *          very basic informations. If more involved information is wanted,\r\n *          we will provide the particular \"transfer handle\" in that struct\r\n *          and that should/could/would be used in subsequent\r\n *          curl_easy_getinfo() calls (or similar). The point being that we\r\n *          must never expose complex structs to applications, as then we'll\r\n *          undoubtably get backwards compatibility problems in the future.\r\n *\r\n * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out\r\n *          of structs. It also writes the number of messages left in the\r\n *          queue (after this read) in the integer the second argument points\r\n *          to.\r\n */\r\nCURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,\r\n                                          int *msgs_in_queue);\r\n\r\n/*\r\n * Name:    curl_multi_strerror()\r\n *\r\n * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode\r\n *          value into the equivalent human readable error string.  This is\r\n *          useful for printing meaningful error messages.\r\n *\r\n * Returns: A pointer to a zero-terminated error message.\r\n */\r\nCURL_EXTERN const char *curl_multi_strerror(CURLMcode);\r\n\r\n/*\r\n * Name:    curl_multi_socket() and\r\n *          curl_multi_socket_all()\r\n *\r\n * Desc:    An alternative version of curl_multi_perform() that allows the\r\n *          application to pass in one of the file descriptors that have been\r\n *          detected to have \"action\" on them and let libcurl perform.\r\n *          See man page for details.\r\n */\r\n#define CURL_POLL_NONE   0\r\n#define CURL_POLL_IN     1\r\n#define CURL_POLL_OUT    2\r\n#define CURL_POLL_INOUT  3\r\n#define CURL_POLL_REMOVE 4\r\n\r\n#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD\r\n\r\n#define CURL_CSELECT_IN   0x01\r\n#define CURL_CSELECT_OUT  0x02\r\n#define CURL_CSELECT_ERR  0x04\r\n\r\ntypedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */\r\n                                    curl_socket_t s, /* socket */\r\n                                    int what,        /* see above */\r\n                                    void *userp,     /* private callback\r\n                                                        pointer */\r\n                                    void *socketp);  /* private socket\r\n                                                        pointer */\r\n/*\r\n * Name:    curl_multi_timer_callback\r\n *\r\n * Desc:    Called by libcurl whenever the library detects a change in the\r\n *          maximum number of milliseconds the app is allowed to wait before\r\n *          curl_multi_socket() or curl_multi_perform() must be called\r\n *          (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: The callback should return zero.\r\n */\r\ntypedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */\r\n                                         long timeout_ms, /* see above */\r\n                                         void *userp);    /* private callback\r\n                                                             pointer */\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,\r\n                                        int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,\r\n                                               curl_socket_t s,\r\n                                               int ev_bitmask,\r\n                                               int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,\r\n                                            int *running_handles);\r\n\r\n#ifndef CURL_ALLOW_OLD_MULTI_SOCKET\r\n/* This macro below was added in 7.16.3 to push users who recompile to use\r\n   the new curl_multi_socket_action() instead of the old curl_multi_socket()\r\n*/\r\n#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)\r\n#endif\r\n\r\n/*\r\n * Name:    curl_multi_timeout()\r\n *\r\n * Desc:    Returns the maximum number of milliseconds the app is allowed to\r\n *          wait before curl_multi_socket() or curl_multi_perform() must be\r\n *          called (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,\r\n                                         long *milliseconds);\r\n\r\n#undef CINIT /* re-using the same name as in curl.h */\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLMOPT_/**/name = type + number\r\n#endif\r\n\r\ntypedef enum {\r\n  /* This is the socket callback function pointer */\r\n  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),\r\n\r\n  /* This is the argument passed to the socket callback */\r\n  CINIT(SOCKETDATA, OBJECTPOINT, 2),\r\n\r\n    /* set to 1 to enable pipelining for this multi handle */\r\n  CINIT(PIPELINING, LONG, 3),\r\n\r\n   /* This is the timer callback function pointer */\r\n  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),\r\n\r\n  /* This is the argument passed to the timer callback */\r\n  CINIT(TIMERDATA, OBJECTPOINT, 5),\r\n\r\n  /* maximum number of entries in the connection cache */\r\n  CINIT(MAXCONNECTS, LONG, 6),\r\n\r\n  CURLMOPT_LASTENTRY /* the last unused */\r\n} CURLMoption;\r\n\r\n\r\n/*\r\n * Name:    curl_multi_setopt()\r\n *\r\n * Desc:    Sets options for the multi handle.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,\r\n                                        CURLMoption option, ...);\r\n\r\n\r\n/*\r\n * Name:    curl_multi_assign()\r\n *\r\n * Desc:    This function sets an association in the multi handle between the\r\n *          given socket and a private pointer of the application. This is\r\n *          (only) useful for curl_multi_socket uses.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,\r\n                                        curl_socket_t sockfd, void *sockp);\r\n\r\n#ifdef __cplusplus\r\n} /* end of extern \"C\" */\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/stdcheaders.h",
    "content": "#ifndef __STDC_HEADERS_H\r\n#define __STDC_HEADERS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <sys/types.h>\r\n\r\nsize_t fread (void *, size_t, size_t, FILE *);\r\nsize_t fwrite (const void *, size_t, size_t, FILE *);\r\n\r\nint strcasecmp(const char *, const char *);\r\nint strncasecmp(const char *, const char *, size_t);\r\n\r\n#endif /* __STDC_HEADERS_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/curl-7.29.0/include/curl/typecheck-gcc.h",
    "content": "#ifndef __CURL_TYPECHECK_GCC_H\r\n#define __CURL_TYPECHECK_GCC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* wraps curl_easy_setopt() with typechecking */\r\n\r\n/* To add a new kind of warning, add an\r\n *   if(_curl_is_sometype_option(_curl_opt))\r\n *     if(!_curl_is_sometype(value))\r\n *       _curl_easy_setopt_err_sometype();\r\n * block and define _curl_is_sometype_option, _curl_is_sometype and\r\n * _curl_easy_setopt_err_sometype below\r\n *\r\n * NOTE: We use two nested 'if' statements here instead of the && operator, in\r\n *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x\r\n *       when compiling with -Wlogical-op.\r\n *\r\n * To add an option that uses the same type as an existing option, you'll just\r\n * need to extend the appropriate _curl_*_option macro\r\n */\r\n#define curl_easy_setopt(handle, option, value)                               \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (option) _curl_opt = option;                                     \\\r\n  if(__builtin_constant_p(_curl_opt)) {                                       \\\r\n    if(_curl_is_long_option(_curl_opt))                                       \\\r\n      if(!_curl_is_long(value))                                               \\\r\n        _curl_easy_setopt_err_long();                                         \\\r\n    if(_curl_is_off_t_option(_curl_opt))                                      \\\r\n      if(!_curl_is_off_t(value))                                              \\\r\n        _curl_easy_setopt_err_curl_off_t();                                   \\\r\n    if(_curl_is_string_option(_curl_opt))                                     \\\r\n      if(!_curl_is_string(value))                                             \\\r\n        _curl_easy_setopt_err_string();                                       \\\r\n    if(_curl_is_write_cb_option(_curl_opt))                                   \\\r\n      if(!_curl_is_write_cb(value))                                           \\\r\n        _curl_easy_setopt_err_write_callback();                               \\\r\n    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \\\r\n      if(!_curl_is_read_cb(value))                                            \\\r\n        _curl_easy_setopt_err_read_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \\\r\n      if(!_curl_is_ioctl_cb(value))                                           \\\r\n        _curl_easy_setopt_err_ioctl_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \\\r\n      if(!_curl_is_sockopt_cb(value))                                         \\\r\n        _curl_easy_setopt_err_sockopt_cb();                                   \\\r\n    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \\\r\n      if(!_curl_is_opensocket_cb(value))                                      \\\r\n        _curl_easy_setopt_err_opensocket_cb();                                \\\r\n    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \\\r\n      if(!_curl_is_progress_cb(value))                                        \\\r\n        _curl_easy_setopt_err_progress_cb();                                  \\\r\n    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \\\r\n      if(!_curl_is_debug_cb(value))                                           \\\r\n        _curl_easy_setopt_err_debug_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \\\r\n      if(!_curl_is_ssl_ctx_cb(value))                                         \\\r\n        _curl_easy_setopt_err_ssl_ctx_cb();                                   \\\r\n    if(_curl_is_conv_cb_option(_curl_opt))                                    \\\r\n      if(!_curl_is_conv_cb(value))                                            \\\r\n        _curl_easy_setopt_err_conv_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \\\r\n      if(!_curl_is_seek_cb(value))                                            \\\r\n        _curl_easy_setopt_err_seek_cb();                                      \\\r\n    if(_curl_is_cb_data_option(_curl_opt))                                    \\\r\n      if(!_curl_is_cb_data(value))                                            \\\r\n        _curl_easy_setopt_err_cb_data();                                      \\\r\n    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \\\r\n      if(!_curl_is_error_buffer(value))                                       \\\r\n        _curl_easy_setopt_err_error_buffer();                                 \\\r\n    if((_curl_opt) == CURLOPT_STDERR)                                         \\\r\n      if(!_curl_is_FILE(value))                                               \\\r\n        _curl_easy_setopt_err_FILE();                                         \\\r\n    if(_curl_is_postfields_option(_curl_opt))                                 \\\r\n      if(!_curl_is_postfields(value))                                         \\\r\n        _curl_easy_setopt_err_postfields();                                   \\\r\n    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \\\r\n      if(!_curl_is_arr((value), struct curl_httppost))                        \\\r\n        _curl_easy_setopt_err_curl_httpost();                                 \\\r\n    if(_curl_is_slist_option(_curl_opt))                                      \\\r\n      if(!_curl_is_arr((value), struct curl_slist))                           \\\r\n        _curl_easy_setopt_err_curl_slist();                                   \\\r\n    if((_curl_opt) == CURLOPT_SHARE)                                          \\\r\n      if(!_curl_is_ptr((value), CURLSH))                                      \\\r\n        _curl_easy_setopt_err_CURLSH();                                       \\\r\n  }                                                                           \\\r\n  curl_easy_setopt(handle, _curl_opt, value);                                 \\\r\n})\r\n\r\n/* wraps curl_easy_getinfo() with typechecking */\r\n/* FIXME: don't allow const pointers */\r\n#define curl_easy_getinfo(handle, info, arg)                                  \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (info) _curl_info = info;                                        \\\r\n  if(__builtin_constant_p(_curl_info)) {                                      \\\r\n    if(_curl_is_string_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), char *))                                        \\\r\n        _curl_easy_getinfo_err_string();                                      \\\r\n    if(_curl_is_long_info(_curl_info))                                        \\\r\n      if(!_curl_is_arr((arg), long))                                          \\\r\n        _curl_easy_getinfo_err_long();                                        \\\r\n    if(_curl_is_double_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), double))                                        \\\r\n        _curl_easy_getinfo_err_double();                                      \\\r\n    if(_curl_is_slist_info(_curl_info))                                       \\\r\n      if(!_curl_is_arr((arg), struct curl_slist *))                           \\\r\n        _curl_easy_getinfo_err_curl_slist();                                  \\\r\n  }                                                                           \\\r\n  curl_easy_getinfo(handle, _curl_info, arg);                                 \\\r\n})\r\n\r\n/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),\r\n * for now just make sure that the functions are called with three\r\n * arguments\r\n */\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n\r\n\r\n/* the actual warnings, triggered by calling the _curl_easy_setopt_err*\r\n * functions */\r\n\r\n/* To define a new warning, use _CURL_WARNING(identifier, \"message\") */\r\n#define _CURL_WARNING(id, message)                                            \\\r\n  static void __attribute__((__warning__(message)))                           \\\r\n  __attribute__((__unused__)) __attribute__((__noinline__))                   \\\r\n  id(void) { __asm__(\"\"); }\r\n\r\n_CURL_WARNING(_curl_easy_setopt_err_long,\r\n  \"curl_easy_setopt expects a long argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,\r\n  \"curl_easy_setopt expects a curl_off_t argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_string,\r\n              \"curl_easy_setopt expects a \"\r\n              \"string (char* or char[]) argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_write_callback,\r\n  \"curl_easy_setopt expects a curl_write_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_read_cb,\r\n  \"curl_easy_setopt expects a curl_read_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,\r\n  \"curl_easy_setopt expects a curl_ioctl_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,\r\n  \"curl_easy_setopt expects a curl_sockopt_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,\r\n              \"curl_easy_setopt expects a \"\r\n              \"curl_opensocket_callback argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_progress_cb,\r\n  \"curl_easy_setopt expects a curl_progress_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_debug_cb,\r\n  \"curl_easy_setopt expects a curl_debug_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,\r\n  \"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_conv_cb,\r\n  \"curl_easy_setopt expects a curl_conv_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_seek_cb,\r\n  \"curl_easy_setopt expects a curl_seek_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_cb_data,\r\n              \"curl_easy_setopt expects a \"\r\n              \"private data pointer as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_error_buffer,\r\n              \"curl_easy_setopt expects a \"\r\n              \"char buffer of CURL_ERROR_SIZE as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_FILE,\r\n  \"curl_easy_setopt expects a FILE* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_postfields,\r\n  \"curl_easy_setopt expects a void* or char* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,\r\n  \"curl_easy_setopt expects a struct curl_httppost* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_slist,\r\n  \"curl_easy_setopt expects a struct curl_slist* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_CURLSH,\r\n  \"curl_easy_setopt expects a CURLSH* argument for this option\")\r\n\r\n_CURL_WARNING(_curl_easy_getinfo_err_string,\r\n  \"curl_easy_getinfo expects a pointer to char * for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_long,\r\n  \"curl_easy_getinfo expects a pointer to long for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_double,\r\n  \"curl_easy_getinfo expects a pointer to double for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,\r\n  \"curl_easy_getinfo expects a pointer to struct curl_slist * for this info\")\r\n\r\n/* groups of curl_easy_setops options that take the same type of argument */\r\n\r\n/* To add a new option to one of the groups, just add\r\n *   (option) == CURLOPT_SOMETHING\r\n * to the or-expression. If the option takes a long or curl_off_t, you don't\r\n * have to do anything\r\n */\r\n\r\n/* evaluates to true if option takes a long argument */\r\n#define _curl_is_long_option(option)                                          \\\r\n  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)\r\n\r\n#define _curl_is_off_t_option(option)                                         \\\r\n  ((option) > CURLOPTTYPE_OFF_T)\r\n\r\n/* evaluates to true if option takes a char* argument */\r\n#define _curl_is_string_option(option)                                        \\\r\n  ((option) == CURLOPT_URL ||                                                 \\\r\n   (option) == CURLOPT_PROXY ||                                               \\\r\n   (option) == CURLOPT_INTERFACE ||                                           \\\r\n   (option) == CURLOPT_NETRC_FILE ||                                          \\\r\n   (option) == CURLOPT_USERPWD ||                                             \\\r\n   (option) == CURLOPT_USERNAME ||                                            \\\r\n   (option) == CURLOPT_PASSWORD ||                                            \\\r\n   (option) == CURLOPT_PROXYUSERPWD ||                                        \\\r\n   (option) == CURLOPT_PROXYUSERNAME ||                                       \\\r\n   (option) == CURLOPT_PROXYPASSWORD ||                                       \\\r\n   (option) == CURLOPT_NOPROXY ||                                             \\\r\n   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \\\r\n   (option) == CURLOPT_REFERER ||                                             \\\r\n   (option) == CURLOPT_USERAGENT ||                                           \\\r\n   (option) == CURLOPT_COOKIE ||                                              \\\r\n   (option) == CURLOPT_COOKIEFILE ||                                          \\\r\n   (option) == CURLOPT_COOKIEJAR ||                                           \\\r\n   (option) == CURLOPT_COOKIELIST ||                                          \\\r\n   (option) == CURLOPT_FTPPORT ||                                             \\\r\n   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \\\r\n   (option) == CURLOPT_FTP_ACCOUNT ||                                         \\\r\n   (option) == CURLOPT_RANGE ||                                               \\\r\n   (option) == CURLOPT_CUSTOMREQUEST ||                                       \\\r\n   (option) == CURLOPT_SSLCERT ||                                             \\\r\n   (option) == CURLOPT_SSLCERTTYPE ||                                         \\\r\n   (option) == CURLOPT_SSLKEY ||                                              \\\r\n   (option) == CURLOPT_SSLKEYTYPE ||                                          \\\r\n   (option) == CURLOPT_KEYPASSWD ||                                           \\\r\n   (option) == CURLOPT_SSLENGINE ||                                           \\\r\n   (option) == CURLOPT_CAINFO ||                                              \\\r\n   (option) == CURLOPT_CAPATH ||                                              \\\r\n   (option) == CURLOPT_RANDOM_FILE ||                                         \\\r\n   (option) == CURLOPT_EGDSOCKET ||                                           \\\r\n   (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \\\r\n   (option) == CURLOPT_KRBLEVEL ||                                            \\\r\n   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \\\r\n   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \\\r\n   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \\\r\n   (option) == CURLOPT_CRLFILE ||                                             \\\r\n   (option) == CURLOPT_ISSUERCERT ||                                          \\\r\n   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \\\r\n   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \\\r\n   (option) == CURLOPT_MAIL_FROM ||                                           \\\r\n   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \\\r\n   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \\\r\n   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a curl_write_callback argument */\r\n#define _curl_is_write_cb_option(option)                                      \\\r\n  ((option) == CURLOPT_HEADERFUNCTION ||                                      \\\r\n   (option) == CURLOPT_WRITEFUNCTION)\r\n\r\n/* evaluates to true if option takes a curl_conv_callback argument */\r\n#define _curl_is_conv_cb_option(option)                                       \\\r\n  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \\\r\n   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \\\r\n   (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)\r\n\r\n/* evaluates to true if option takes a data argument to pass to a callback */\r\n#define _curl_is_cb_data_option(option)                                       \\\r\n  ((option) == CURLOPT_WRITEDATA ||                                           \\\r\n   (option) == CURLOPT_READDATA ||                                            \\\r\n   (option) == CURLOPT_IOCTLDATA ||                                           \\\r\n   (option) == CURLOPT_SOCKOPTDATA ||                                         \\\r\n   (option) == CURLOPT_OPENSOCKETDATA ||                                      \\\r\n   (option) == CURLOPT_PROGRESSDATA ||                                        \\\r\n   (option) == CURLOPT_WRITEHEADER ||                                         \\\r\n   (option) == CURLOPT_DEBUGDATA ||                                           \\\r\n   (option) == CURLOPT_SSL_CTX_DATA ||                                        \\\r\n   (option) == CURLOPT_SEEKDATA ||                                            \\\r\n   (option) == CURLOPT_PRIVATE ||                                             \\\r\n   (option) == CURLOPT_SSH_KEYDATA ||                                         \\\r\n   (option) == CURLOPT_INTERLEAVEDATA ||                                      \\\r\n   (option) == CURLOPT_CHUNK_DATA ||                                          \\\r\n   (option) == CURLOPT_FNMATCH_DATA ||                                        \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a POST data argument (void* or char*) */\r\n#define _curl_is_postfields_option(option)                                    \\\r\n  ((option) == CURLOPT_POSTFIELDS ||                                          \\\r\n   (option) == CURLOPT_COPYPOSTFIELDS ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a struct curl_slist * argument */\r\n#define _curl_is_slist_option(option)                                         \\\r\n  ((option) == CURLOPT_HTTPHEADER ||                                          \\\r\n   (option) == CURLOPT_HTTP200ALIASES ||                                      \\\r\n   (option) == CURLOPT_QUOTE ||                                               \\\r\n   (option) == CURLOPT_POSTQUOTE ||                                           \\\r\n   (option) == CURLOPT_PREQUOTE ||                                            \\\r\n   (option) == CURLOPT_TELNETOPTIONS ||                                       \\\r\n   (option) == CURLOPT_MAIL_RCPT ||                                           \\\r\n   0)\r\n\r\n/* groups of curl_easy_getinfo infos that take the same type of argument */\r\n\r\n/* evaluates to true if info expects a pointer to char * argument */\r\n#define _curl_is_string_info(info)                                            \\\r\n  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)\r\n\r\n/* evaluates to true if info expects a pointer to long argument */\r\n#define _curl_is_long_info(info)                                              \\\r\n  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)\r\n\r\n/* evaluates to true if info expects a pointer to double argument */\r\n#define _curl_is_double_info(info)                                            \\\r\n  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)\r\n\r\n/* true if info expects a pointer to struct curl_slist * argument */\r\n#define _curl_is_slist_info(info)                                             \\\r\n  (CURLINFO_SLIST < (info))\r\n\r\n\r\n/* typecheck helpers -- check whether given expression has requested type*/\r\n\r\n/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,\r\n * otherwise define a new macro. Search for __builtin_types_compatible_p\r\n * in the GCC manual.\r\n * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is\r\n * the actual expression passed to the curl_easy_setopt macro. This\r\n * means that you can only apply the sizeof and __typeof__ operators, no\r\n * == or whatsoever.\r\n */\r\n\r\n/* XXX: should evaluate to true iff expr is a pointer */\r\n#define _curl_is_any_ptr(expr)                                                \\\r\n  (sizeof(expr) == sizeof(void*))\r\n\r\n/* evaluates to true if expr is NULL */\r\n/* XXX: must not evaluate expr, so this check is not accurate */\r\n#define _curl_is_NULL(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))\r\n\r\n/* evaluates to true if expr is type*, const type* or NULL */\r\n#define _curl_is_ptr(expr, type)                                              \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), const type *))\r\n\r\n/* evaluates to true if expr is one of type[], type*, NULL or const type* */\r\n#define _curl_is_arr(expr, type)                                              \\\r\n  (_curl_is_ptr((expr), type) ||                                              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type []))\r\n\r\n/* evaluates to true if expr is a string */\r\n#define _curl_is_string(expr)                                                 \\\r\n  (_curl_is_arr((expr), char) ||                                              \\\r\n   _curl_is_arr((expr), signed char) ||                                       \\\r\n   _curl_is_arr((expr), unsigned char))\r\n\r\n/* evaluates to true if expr is a long (no matter the signedness)\r\n * XXX: for now, int is also accepted (and therefore short and char, which\r\n * are promoted to int when passed to a variadic function) */\r\n#define _curl_is_long(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \\\r\n   __builtin_types_compatible_p(__typeof__(expr), int) ||                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed int) ||              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned int) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), short) ||                   \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed short) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned short) ||          \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed char) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned char))\r\n\r\n/* evaluates to true if expr is of type curl_off_t */\r\n#define _curl_is_off_t(expr)                                                  \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))\r\n\r\n/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */\r\n/* XXX: also check size of an char[] array? */\r\n#define _curl_is_error_buffer(expr)                                           \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char[]))\r\n\r\n/* evaluates to true if expr is of type (const) void* or (const) FILE* */\r\n#if 0\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_ptr((expr), FILE))\r\n#else /* be less strict */\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  _curl_is_any_ptr(expr)\r\n#endif\r\n\r\n/* evaluates to true if expr is of type FILE* */\r\n#define _curl_is_FILE(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), FILE *))\r\n\r\n/* evaluates to true if expr can be passed as POST data (void* or char*) */\r\n#define _curl_is_postfields(expr)                                             \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_arr((expr), char))\r\n\r\n/* FIXME: the whole callback checking is messy...\r\n * The idea is to tolerate char vs. void and const vs. not const\r\n * pointers in arguments at least\r\n */\r\n/* helper: __builtin_types_compatible_p distinguishes between functions and\r\n * function pointers, hide it */\r\n#define _curl_callback_compatible(func, type)                                 \\\r\n  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(func), type*))\r\n\r\n/* evaluates to true if expr is of type curl_read_callback or \"similar\" */\r\n#define _curl_is_read_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback6))\r\ntypedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_write_callback or \"similar\" */\r\n#define _curl_is_write_cb(expr)                                               \\\r\n  (_curl_is_read_cb(expr) ||                                            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_write_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback6))\r\ntypedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback2)(const char *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback5)(const void *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_ioctl_callback or \"similar\" */\r\n#define _curl_is_ioctl_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback4))\r\ntypedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);\r\ntypedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);\r\ntypedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);\r\ntypedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);\r\n\r\n/* evaluates to true if expr is of type curl_sockopt_callback or \"similar\" */\r\n#define _curl_is_sockopt_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback2))\r\ntypedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);\r\ntypedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,\r\n                                      curlsocktype);\r\n\r\n/* evaluates to true if expr is of type curl_opensocket_callback or\r\n   \"similar\" */\r\n#define _curl_is_opensocket_cb(expr)                                    \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback4))\r\ntypedef curl_socket_t (_curl_opensocket_callback1)\r\n  (void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback2)\r\n  (void *, curlsocktype, const struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback3)\r\n  (const void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback4)\r\n  (const void *, curlsocktype, const struct curl_sockaddr *);\r\n\r\n/* evaluates to true if expr is of type curl_progress_callback or \"similar\" */\r\n#define _curl_is_progress_cb(expr)                                      \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback2))\r\ntypedef int (_curl_progress_callback1)(void *,\r\n    double, double, double, double);\r\ntypedef int (_curl_progress_callback2)(const void *,\r\n    double, double, double, double);\r\n\r\n/* evaluates to true if expr is of type curl_debug_callback or \"similar\" */\r\n#define _curl_is_debug_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback8))\r\ntypedef int (_curl_debug_callback1) (CURL *,\r\n    curl_infotype, char *, size_t, void *);\r\ntypedef int (_curl_debug_callback2) (CURL *,\r\n    curl_infotype, char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback3) (CURL *,\r\n    curl_infotype, const char *, size_t, void *);\r\ntypedef int (_curl_debug_callback4) (CURL *,\r\n    curl_infotype, const char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback5) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback6) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback7) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback8) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, const void *);\r\n\r\n/* evaluates to true if expr is of type curl_ssl_ctx_callback or \"similar\" */\r\n/* this is getting even messier... */\r\n#define _curl_is_ssl_ctx_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))\r\ntypedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);\r\n#ifdef HEADER_SSL_H\r\n/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX\r\n * this will of course break if we're included before OpenSSL headers...\r\n */\r\ntypedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,\r\n                                           const void *);\r\n#else\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;\r\n#endif\r\n\r\n/* evaluates to true if expr is of type curl_conv_callback or \"similar\" */\r\n#define _curl_is_conv_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback4))\r\ntypedef CURLcode (*_curl_conv_callback1)(char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback3)(void *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);\r\n\r\n/* evaluates to true if expr is of type curl_seek_callback or \"similar\" */\r\n#define _curl_is_seek_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback2))\r\ntypedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);\r\ntypedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);\r\n\r\n\r\n#endif /* __CURL_TYPECHECK_GCC_H */\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/luajit-2.0.1/include/lauxlib.h",
    "content": "/*\r\n** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $\r\n** Auxiliary functions for building Lua libraries\r\n** See Copyright Notice in lua.h\r\n*/\r\n\r\n\r\n#ifndef lauxlib_h\r\n#define lauxlib_h\r\n\r\n\r\n#include <stddef.h>\r\n#include <stdio.h>\r\n\r\n#include \"lua.h\"\r\n\r\n\r\n#define luaL_getn(L,i)          ((int)lua_objlen(L, i))\r\n#define luaL_setn(L,i,j)        ((void)0)  /* no op! */\r\n\r\n/* extra error code for `luaL_load' */\r\n#define LUA_ERRFILE     (LUA_ERRERR+1)\r\n\r\ntypedef struct luaL_Reg {\r\n  const char *name;\r\n  lua_CFunction func;\r\n} luaL_Reg;\r\n\r\nLUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,\r\n                                const luaL_Reg *l, int nup);\r\nLUALIB_API void (luaL_register) (lua_State *L, const char *libname,\r\n                                const luaL_Reg *l);\r\nLUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);\r\nLUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);\r\nLUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);\r\nLUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);\r\nLUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,\r\n                                                          size_t *l);\r\nLUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,\r\n                                          const char *def, size_t *l);\r\nLUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);\r\nLUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);\r\n\r\nLUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);\r\nLUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,\r\n                                          lua_Integer def);\r\n\r\nLUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);\r\nLUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);\r\nLUALIB_API void (luaL_checkany) (lua_State *L, int narg);\r\n\r\nLUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);\r\nLUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);\r\n\r\nLUALIB_API void (luaL_where) (lua_State *L, int lvl);\r\nLUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);\r\n\r\nLUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,\r\n                                   const char *const lst[]);\r\n\r\nLUALIB_API int (luaL_ref) (lua_State *L, int t);\r\nLUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);\r\n\r\nLUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);\r\nLUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,\r\n                                  const char *name);\r\nLUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);\r\n\r\nLUALIB_API lua_State *(luaL_newstate) (void);\r\n\r\n\r\nLUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,\r\n                                                  const char *r);\r\n\r\nLUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,\r\n                                         const char *fname, int szhint);\r\n\r\n/* From Lua 5.2. */\r\nLUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname);\r\nLUALIB_API int luaL_execresult(lua_State *L, int stat);\r\nLUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,\r\n\t\t\t\t const char *mode);\r\nLUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,\r\n\t\t\t\t   const char *name, const char *mode);\r\nLUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,\r\n\t\t\t\tint level);\r\n\r\n\r\n/*\r\n** ===============================================================\r\n** some useful macros\r\n** ===============================================================\r\n*/\r\n\r\n#define luaL_argcheck(L, cond,numarg,extramsg)\t\\\r\n\t\t((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))\r\n#define luaL_checkstring(L,n)\t(luaL_checklstring(L, (n), NULL))\r\n#define luaL_optstring(L,n,d)\t(luaL_optlstring(L, (n), (d), NULL))\r\n#define luaL_checkint(L,n)\t((int)luaL_checkinteger(L, (n)))\r\n#define luaL_optint(L,n,d)\t((int)luaL_optinteger(L, (n), (d)))\r\n#define luaL_checklong(L,n)\t((long)luaL_checkinteger(L, (n)))\r\n#define luaL_optlong(L,n,d)\t((long)luaL_optinteger(L, (n), (d)))\r\n\r\n#define luaL_typename(L,i)\tlua_typename(L, lua_type(L,(i)))\r\n\r\n#define luaL_dofile(L, fn) \\\r\n\t(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))\r\n\r\n#define luaL_dostring(L, s) \\\r\n\t(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))\r\n\r\n#define luaL_getmetatable(L,n)\t(lua_getfield(L, LUA_REGISTRYINDEX, (n)))\r\n\r\n#define luaL_opt(L,f,n,d)\t(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))\r\n\r\n/*\r\n** {======================================================\r\n** Generic Buffer manipulation\r\n** =======================================================\r\n*/\r\n\r\n\r\n\r\ntypedef struct luaL_Buffer {\r\n  char *p;\t\t\t/* current position in buffer */\r\n  int lvl;  /* number of strings in the stack (level) */\r\n  lua_State *L;\r\n  char buffer[LUAL_BUFFERSIZE];\r\n} luaL_Buffer;\r\n\r\n#define luaL_addchar(B,c) \\\r\n  ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \\\r\n   (*(B)->p++ = (char)(c)))\r\n\r\n/* compatibility only */\r\n#define luaL_putchar(B,c)\tluaL_addchar(B,c)\r\n\r\n#define luaL_addsize(B,n)\t((B)->p += (n))\r\n\r\nLUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);\r\nLUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);\r\nLUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);\r\nLUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);\r\nLUALIB_API void (luaL_addvalue) (luaL_Buffer *B);\r\nLUALIB_API void (luaL_pushresult) (luaL_Buffer *B);\r\n\r\n\r\n/* }====================================================== */\r\n\r\n\r\n/* compatibility with ref system */\r\n\r\n/* pre-defined references */\r\n#define LUA_NOREF       (-2)\r\n#define LUA_REFNIL      (-1)\r\n\r\n#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \\\r\n      (lua_pushstring(L, \"unlocked references are obsolete\"), lua_error(L), 0))\r\n\r\n#define lua_unref(L,ref)        luaL_unref(L, LUA_REGISTRYINDEX, (ref))\r\n\r\n#define lua_getref(L,ref)       lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))\r\n\r\n\r\n#define luaL_reg\tluaL_Reg\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/luajit-2.0.1/include/lua.h",
    "content": "/*\r\n** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $\r\n** Lua - An Extensible Extension Language\r\n** Lua.org, PUC-Rio, Brazil (http://www.lua.org)\r\n** See Copyright Notice at the end of this file\r\n*/\r\n\r\n\r\n#ifndef lua_h\r\n#define lua_h\r\n\r\n#include <stdarg.h>\r\n#include <stddef.h>\r\n\r\n\r\n#include \"luaconf.h\"\r\n\r\n\r\n#define LUA_VERSION\t\"Lua 5.1\"\r\n#define LUA_RELEASE\t\"Lua 5.1.4\"\r\n#define LUA_VERSION_NUM\t501\r\n#define LUA_COPYRIGHT\t\"Copyright (C) 1994-2008 Lua.org, PUC-Rio\"\r\n#define LUA_AUTHORS\t\"R. Ierusalimschy, L. H. de Figueiredo & W. Celes\"\r\n\r\n\r\n/* mark for precompiled code (`<esc>Lua') */\r\n#define\tLUA_SIGNATURE\t\"\\033Lua\"\r\n\r\n/* option for multiple returns in `lua_pcall' and `lua_call' */\r\n#define LUA_MULTRET\t(-1)\r\n\r\n\r\n/*\r\n** pseudo-indices\r\n*/\r\n#define LUA_REGISTRYINDEX\t(-10000)\r\n#define LUA_ENVIRONINDEX\t(-10001)\r\n#define LUA_GLOBALSINDEX\t(-10002)\r\n#define lua_upvalueindex(i)\t(LUA_GLOBALSINDEX-(i))\r\n\r\n\r\n/* thread status; 0 is OK */\r\n#define LUA_YIELD\t1\r\n#define LUA_ERRRUN\t2\r\n#define LUA_ERRSYNTAX\t3\r\n#define LUA_ERRMEM\t4\r\n#define LUA_ERRERR\t5\r\n\r\n\r\ntypedef struct lua_State lua_State;\r\n\r\ntypedef int (*lua_CFunction) (lua_State *L);\r\n\r\n\r\n/*\r\n** functions that read/write blocks when loading/dumping Lua chunks\r\n*/\r\ntypedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);\r\n\r\ntypedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);\r\n\r\n\r\n/*\r\n** prototype for memory-allocation functions\r\n*/\r\ntypedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);\r\n\r\n\r\n/*\r\n** basic types\r\n*/\r\n#define LUA_TNONE\t\t(-1)\r\n\r\n#define LUA_TNIL\t\t0\r\n#define LUA_TBOOLEAN\t\t1\r\n#define LUA_TLIGHTUSERDATA\t2\r\n#define LUA_TNUMBER\t\t3\r\n#define LUA_TSTRING\t\t4\r\n#define LUA_TTABLE\t\t5\r\n#define LUA_TFUNCTION\t\t6\r\n#define LUA_TUSERDATA\t\t7\r\n#define LUA_TTHREAD\t\t8\r\n\r\n\r\n\r\n/* minimum Lua stack available to a C function */\r\n#define LUA_MINSTACK\t20\r\n\r\n\r\n/*\r\n** generic extra include file\r\n*/\r\n#if defined(LUA_USER_H)\r\n#include LUA_USER_H\r\n#endif\r\n\r\n\r\n/* type of numbers in Lua */\r\ntypedef LUA_NUMBER lua_Number;\r\n\r\n\r\n/* type for integer functions */\r\ntypedef LUA_INTEGER lua_Integer;\r\n\r\n\r\n\r\n/*\r\n** state manipulation\r\n*/\r\nLUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);\r\nLUA_API void       (lua_close) (lua_State *L);\r\nLUA_API lua_State *(lua_newthread) (lua_State *L);\r\n\r\nLUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);\r\n\r\n\r\n/*\r\n** basic stack manipulation\r\n*/\r\nLUA_API int   (lua_gettop) (lua_State *L);\r\nLUA_API void  (lua_settop) (lua_State *L, int idx);\r\nLUA_API void  (lua_pushvalue) (lua_State *L, int idx);\r\nLUA_API void  (lua_remove) (lua_State *L, int idx);\r\nLUA_API void  (lua_insert) (lua_State *L, int idx);\r\nLUA_API void  (lua_replace) (lua_State *L, int idx);\r\nLUA_API int   (lua_checkstack) (lua_State *L, int sz);\r\n\r\nLUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);\r\n\r\n\r\n/*\r\n** access functions (stack -> C)\r\n*/\r\n\r\nLUA_API int             (lua_isnumber) (lua_State *L, int idx);\r\nLUA_API int             (lua_isstring) (lua_State *L, int idx);\r\nLUA_API int             (lua_iscfunction) (lua_State *L, int idx);\r\nLUA_API int             (lua_isuserdata) (lua_State *L, int idx);\r\nLUA_API int             (lua_type) (lua_State *L, int idx);\r\nLUA_API const char     *(lua_typename) (lua_State *L, int tp);\r\n\r\nLUA_API int            (lua_equal) (lua_State *L, int idx1, int idx2);\r\nLUA_API int            (lua_rawequal) (lua_State *L, int idx1, int idx2);\r\nLUA_API int            (lua_lessthan) (lua_State *L, int idx1, int idx2);\r\n\r\nLUA_API lua_Number      (lua_tonumber) (lua_State *L, int idx);\r\nLUA_API lua_Integer     (lua_tointeger) (lua_State *L, int idx);\r\nLUA_API int             (lua_toboolean) (lua_State *L, int idx);\r\nLUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);\r\nLUA_API size_t          (lua_objlen) (lua_State *L, int idx);\r\nLUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);\r\nLUA_API void\t       *(lua_touserdata) (lua_State *L, int idx);\r\nLUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);\r\nLUA_API const void     *(lua_topointer) (lua_State *L, int idx);\r\n\r\n\r\n/*\r\n** push functions (C -> stack)\r\n*/\r\nLUA_API void  (lua_pushnil) (lua_State *L);\r\nLUA_API void  (lua_pushnumber) (lua_State *L, lua_Number n);\r\nLUA_API void  (lua_pushinteger) (lua_State *L, lua_Integer n);\r\nLUA_API void  (lua_pushlstring) (lua_State *L, const char *s, size_t l);\r\nLUA_API void  (lua_pushstring) (lua_State *L, const char *s);\r\nLUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,\r\n                                                      va_list argp);\r\nLUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);\r\nLUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);\r\nLUA_API void  (lua_pushboolean) (lua_State *L, int b);\r\nLUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);\r\nLUA_API int   (lua_pushthread) (lua_State *L);\r\n\r\n\r\n/*\r\n** get functions (Lua -> stack)\r\n*/\r\nLUA_API void  (lua_gettable) (lua_State *L, int idx);\r\nLUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);\r\nLUA_API void  (lua_rawget) (lua_State *L, int idx);\r\nLUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);\r\nLUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);\r\nLUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);\r\nLUA_API int   (lua_getmetatable) (lua_State *L, int objindex);\r\nLUA_API void  (lua_getfenv) (lua_State *L, int idx);\r\n\r\n\r\n/*\r\n** set functions (stack -> Lua)\r\n*/\r\nLUA_API void  (lua_settable) (lua_State *L, int idx);\r\nLUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);\r\nLUA_API void  (lua_rawset) (lua_State *L, int idx);\r\nLUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);\r\nLUA_API int   (lua_setmetatable) (lua_State *L, int objindex);\r\nLUA_API int   (lua_setfenv) (lua_State *L, int idx);\r\n\r\n\r\n/*\r\n** `load' and `call' functions (load and run Lua code)\r\n*/\r\nLUA_API void  (lua_call) (lua_State *L, int nargs, int nresults);\r\nLUA_API int   (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);\r\nLUA_API int   (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);\r\nLUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,\r\n                                        const char *chunkname);\r\n\r\nLUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);\r\n\r\n\r\n/*\r\n** coroutine functions\r\n*/\r\nLUA_API int  (lua_yield) (lua_State *L, int nresults);\r\nLUA_API int  (lua_resume) (lua_State *L, int narg);\r\nLUA_API int  (lua_status) (lua_State *L);\r\n\r\n/*\r\n** garbage-collection function and options\r\n*/\r\n\r\n#define LUA_GCSTOP\t\t0\r\n#define LUA_GCRESTART\t\t1\r\n#define LUA_GCCOLLECT\t\t2\r\n#define LUA_GCCOUNT\t\t3\r\n#define LUA_GCCOUNTB\t\t4\r\n#define LUA_GCSTEP\t\t5\r\n#define LUA_GCSETPAUSE\t\t6\r\n#define LUA_GCSETSTEPMUL\t7\r\n\r\nLUA_API int (lua_gc) (lua_State *L, int what, int data);\r\n\r\n\r\n/*\r\n** miscellaneous functions\r\n*/\r\n\r\nLUA_API int   (lua_error) (lua_State *L);\r\n\r\nLUA_API int   (lua_next) (lua_State *L, int idx);\r\n\r\nLUA_API void  (lua_concat) (lua_State *L, int n);\r\n\r\nLUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);\r\nLUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);\r\n\r\n\r\n\r\n/*\r\n** ===============================================================\r\n** some useful macros\r\n** ===============================================================\r\n*/\r\n\r\n#define lua_pop(L,n)\t\tlua_settop(L, -(n)-1)\r\n\r\n#define lua_newtable(L)\t\tlua_createtable(L, 0, 0)\r\n\r\n#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))\r\n\r\n#define lua_pushcfunction(L,f)\tlua_pushcclosure(L, (f), 0)\r\n\r\n#define lua_strlen(L,i)\t\tlua_objlen(L, (i))\r\n\r\n#define lua_isfunction(L,n)\t(lua_type(L, (n)) == LUA_TFUNCTION)\r\n#define lua_istable(L,n)\t(lua_type(L, (n)) == LUA_TTABLE)\r\n#define lua_islightuserdata(L,n)\t(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)\r\n#define lua_isnil(L,n)\t\t(lua_type(L, (n)) == LUA_TNIL)\r\n#define lua_isboolean(L,n)\t(lua_type(L, (n)) == LUA_TBOOLEAN)\r\n#define lua_isthread(L,n)\t(lua_type(L, (n)) == LUA_TTHREAD)\r\n#define lua_isnone(L,n)\t\t(lua_type(L, (n)) == LUA_TNONE)\r\n#define lua_isnoneornil(L, n)\t(lua_type(L, (n)) <= 0)\r\n\r\n#define lua_pushliteral(L, s)\t\\\r\n\tlua_pushlstring(L, \"\" s, (sizeof(s)/sizeof(char))-1)\r\n\r\n#define lua_setglobal(L,s)\tlua_setfield(L, LUA_GLOBALSINDEX, (s))\r\n#define lua_getglobal(L,s)\tlua_getfield(L, LUA_GLOBALSINDEX, (s))\r\n\r\n#define lua_tostring(L,i)\tlua_tolstring(L, (i), NULL)\r\n\r\n\r\n\r\n/*\r\n** compatibility macros and functions\r\n*/\r\n\r\n#define lua_open()\tluaL_newstate()\r\n\r\n#define lua_getregistry(L)\tlua_pushvalue(L, LUA_REGISTRYINDEX)\r\n\r\n#define lua_getgccount(L)\tlua_gc(L, LUA_GCCOUNT, 0)\r\n\r\n#define lua_Chunkreader\t\tlua_Reader\r\n#define lua_Chunkwriter\t\tlua_Writer\r\n\r\n\r\n/* hack */\r\nLUA_API void lua_setlevel\t(lua_State *from, lua_State *to);\r\n\r\n\r\n/*\r\n** {======================================================================\r\n** Debug API\r\n** =======================================================================\r\n*/\r\n\r\n\r\n/*\r\n** Event codes\r\n*/\r\n#define LUA_HOOKCALL\t0\r\n#define LUA_HOOKRET\t1\r\n#define LUA_HOOKLINE\t2\r\n#define LUA_HOOKCOUNT\t3\r\n#define LUA_HOOKTAILRET 4\r\n\r\n\r\n/*\r\n** Event masks\r\n*/\r\n#define LUA_MASKCALL\t(1 << LUA_HOOKCALL)\r\n#define LUA_MASKRET\t(1 << LUA_HOOKRET)\r\n#define LUA_MASKLINE\t(1 << LUA_HOOKLINE)\r\n#define LUA_MASKCOUNT\t(1 << LUA_HOOKCOUNT)\r\n\r\ntypedef struct lua_Debug lua_Debug;  /* activation record */\r\n\r\n\r\n/* Functions to be called by the debuger in specific events */\r\ntypedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);\r\n\r\n\r\nLUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);\r\nLUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);\r\nLUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);\r\nLUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);\r\nLUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);\r\nLUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);\r\nLUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);\r\nLUA_API lua_Hook lua_gethook (lua_State *L);\r\nLUA_API int lua_gethookmask (lua_State *L);\r\nLUA_API int lua_gethookcount (lua_State *L);\r\n\r\n/* From Lua 5.2. */\r\nLUA_API void *lua_upvalueid (lua_State *L, int idx, int n);\r\nLUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2);\r\nLUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt,\r\n\t\t       const char *chunkname, const char *mode);\r\n\r\n\r\nstruct lua_Debug {\r\n  int event;\r\n  const char *name;\t/* (n) */\r\n  const char *namewhat;\t/* (n) `global', `local', `field', `method' */\r\n  const char *what;\t/* (S) `Lua', `C', `main', `tail' */\r\n  const char *source;\t/* (S) */\r\n  int currentline;\t/* (l) */\r\n  int nups;\t\t/* (u) number of upvalues */\r\n  int linedefined;\t/* (S) */\r\n  int lastlinedefined;\t/* (S) */\r\n  char short_src[LUA_IDSIZE]; /* (S) */\r\n  /* private part */\r\n  int i_ci;  /* active function */\r\n};\r\n\r\n/* }====================================================================== */\r\n\r\n\r\n/******************************************************************************\r\n* Copyright (C) 1994-2008 Lua.org, PUC-Rio.  All rights reserved.\r\n*\r\n* Permission is hereby granted, free of charge, to any person obtaining\r\n* a copy of this software and associated documentation files (the\r\n* \"Software\"), to deal in the Software without restriction, including\r\n* without limitation the rights to use, copy, modify, merge, publish,\r\n* distribute, sublicense, and/or sell copies of the Software, and to\r\n* permit persons to whom the Software is furnished to do so, subject to\r\n* the following conditions:\r\n*\r\n* The above copyright notice and this permission notice shall be\r\n* included in all copies or substantial portions of the Software.\r\n*\r\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n******************************************************************************/\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/luajit-2.0.1/include/lua.hpp",
    "content": "// C++ wrapper for LuaJIT header files.\r\n\r\nextern \"C\" {\r\n#include \"lua.h\"\r\n#include \"lauxlib.h\"\r\n#include \"lualib.h\"\r\n#include \"luajit.h\"\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/luajit-2.0.1/include/luaconf.h",
    "content": "/*\r\n** Configuration header.\r\n** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h\r\n*/\r\n\r\n#ifndef luaconf_h\r\n#define luaconf_h\r\n\r\n#include <limits.h>\r\n#include <stddef.h>\r\n\r\n/* Default path for loading Lua and C modules with require(). */\r\n#if defined(_WIN32)\r\n/*\r\n** In Windows, any exclamation mark ('!') in the path is replaced by the\r\n** path of the directory of the executable file of the current process.\r\n*/\r\n#define LUA_LDIR\t\"!\\\\lua\\\\\"\r\n#define LUA_CDIR\t\"!\\\\\"\r\n#define LUA_PATH_DEFAULT \\\r\n  \".\\\\?.lua;\" LUA_LDIR\"?.lua;\" LUA_LDIR\"?\\\\init.lua;\"\r\n#define LUA_CPATH_DEFAULT \\\r\n  \".\\\\?.dll;\" LUA_CDIR\"?.dll;\" LUA_CDIR\"loadall.dll\"\r\n#else\r\n/*\r\n** Note to distribution maintainers: do NOT patch the following line!\r\n** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.\r\n*/\r\n#define LUA_ROOT\t\"/usr/local/\"\r\n#define LUA_LDIR\tLUA_ROOT \"share/lua/5.1/\"\r\n#define LUA_CDIR\tLUA_ROOT \"lib/lua/5.1/\"\r\n#ifdef LUA_XROOT\r\n#define LUA_JDIR\tLUA_XROOT \"share/luajit-2.0.1/\"\r\n#define LUA_XPATH \\\r\n  \";\" LUA_XROOT \"share/lua/5.1/?.lua;\" LUA_XROOT \"share/lua/5.1/?/init.lua\"\r\n#define LUA_XCPATH\tLUA_XROOT \"lib/lua/5.1/?.so;\"\r\n#else\r\n#define LUA_JDIR\tLUA_ROOT \"share/luajit-2.0.1/\"\r\n#define LUA_XPATH\r\n#define LUA_XCPATH\r\n#endif\r\n#define LUA_PATH_DEFAULT \\\r\n  \"./?.lua;\" LUA_JDIR\"?.lua;\" LUA_LDIR\"?.lua;\" LUA_LDIR\"?/init.lua\" LUA_XPATH\r\n#define LUA_CPATH_DEFAULT \\\r\n  \"./?.so;\" LUA_CDIR\"?.so;\" LUA_XCPATH LUA_CDIR\"loadall.so\"\r\n#endif\r\n\r\n/* Environment variable names for path overrides and initialization code. */\r\n#define LUA_PATH\t\"LUA_PATH\"\r\n#define LUA_CPATH\t\"LUA_CPATH\"\r\n#define LUA_INIT\t\"LUA_INIT\"\r\n\r\n/* Special file system characters. */\r\n#if defined(_WIN32)\r\n#define LUA_DIRSEP\t\"\\\\\"\r\n#else\r\n#define LUA_DIRSEP\t\"/\"\r\n#endif\r\n#define LUA_PATHSEP\t\";\"\r\n#define LUA_PATH_MARK\t\"?\"\r\n#define LUA_EXECDIR\t\"!\"\r\n#define LUA_IGMARK\t\"-\"\r\n#define LUA_PATH_CONFIG \\\r\n  LUA_DIRSEP \"\\n\" LUA_PATHSEP \"\\n\" LUA_PATH_MARK \"\\n\" \\\r\n  LUA_EXECDIR \"\\n\" LUA_IGMARK\r\n\r\n/* Quoting in error messages. */\r\n#define LUA_QL(x)\t\"'\" x \"'\"\r\n#define LUA_QS\t\tLUA_QL(\"%s\")\r\n\r\n/* Various tunables. */\r\n#define LUAI_MAXSTACK\t65500\t/* Max. # of stack slots for a thread (<64K). */\r\n#define LUAI_MAXCSTACK\t8000\t/* Max. # of stack slots for a C func (<10K). */\r\n#define LUAI_GCPAUSE\t200\t/* Pause GC until memory is at 200%. */\r\n#define LUAI_GCMUL\t200\t/* Run GC at 200% of allocation speed. */\r\n#define LUA_MAXCAPTURES\t32\t/* Max. pattern captures. */\r\n\r\n/* Compatibility with older library function names. */\r\n#define LUA_COMPAT_MOD\t\t/* OLD: math.mod, NEW: math.fmod */\r\n#define LUA_COMPAT_GFIND\t/* OLD: string.gfind, NEW: string.gmatch */\r\n\r\n/* Configuration for the frontend (the luajit executable). */\r\n#if defined(luajit_c)\r\n#define LUA_PROGNAME\t\"luajit\"  /* Fallback frontend name. */\r\n#define LUA_PROMPT\t\"> \"\t/* Interactive prompt. */\r\n#define LUA_PROMPT2\t\">> \"\t/* Continuation prompt. */\r\n#define LUA_MAXINPUT\t512\t/* Max. input line length. */\r\n#endif\r\n\r\n/* Note: changing the following defines breaks the Lua 5.1 ABI. */\r\n#define LUA_INTEGER\tptrdiff_t\r\n#define LUA_IDSIZE\t60\t/* Size of lua_Debug.short_src. */\r\n/*\r\n** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using\r\n** unreasonable amounts of stack space, but still retain ABI compatibility.\r\n** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.\r\n*/\r\n#define LUAL_BUFFERSIZE\t(BUFSIZ > 16384 ? 8192 : BUFSIZ)\r\n\r\n/* The following defines are here only for compatibility with luaconf.h\r\n** from the standard Lua distribution. They must not be changed for LuaJIT.\r\n*/\r\n#define LUA_NUMBER_DOUBLE\r\n#define LUA_NUMBER\t\tdouble\r\n#define LUAI_UACNUMBER\t\tdouble\r\n#define LUA_NUMBER_SCAN\t\t\"%lf\"\r\n#define LUA_NUMBER_FMT\t\t\"%.14g\"\r\n#define lua_number2str(s, n)\tsprintf((s), LUA_NUMBER_FMT, (n))\r\n#define LUAI_MAXNUMBER2STR\t32\r\n#define LUA_INTFRMLEN\t\t\"l\"\r\n#define LUA_INTFRM_T\t\tlong\r\n\r\n/* Linkage of public API functions. */\r\n#if defined(LUA_BUILD_AS_DLL)\r\n#if defined(LUA_CORE) || defined(LUA_LIB)\r\n#define LUA_API\t\t__declspec(dllexport)\r\n#else\r\n#define LUA_API\t\t__declspec(dllimport)\r\n#endif\r\n#else\r\n#define LUA_API\t\textern\r\n#endif\r\n\r\n#define LUALIB_API\tLUA_API\r\n\r\n/* Support for internal assertions. */\r\n#if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)\r\n#include <assert.h>\r\n#endif\r\n#ifdef LUA_USE_ASSERT\r\n#define lua_assert(x)\t\tassert(x)\r\n#endif\r\n#ifdef LUA_USE_APICHECK\r\n#define luai_apicheck(L, o)\t{ (void)L; assert(o); }\r\n#else\r\n#define luai_apicheck(L, o)\t{ (void)L; }\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/luajit-2.0.1/include/luajit.h",
    "content": "/*\r\n** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/\r\n**\r\n** Copyright (C) 2005-2013 Mike Pall. All rights reserved.\r\n**\r\n** Permission is hereby granted, free of charge, to any person obtaining\r\n** a copy of this software and associated documentation files (the\r\n** \"Software\"), to deal in the Software without restriction, including\r\n** without limitation the rights to use, copy, modify, merge, publish,\r\n** distribute, sublicense, and/or sell copies of the Software, and to\r\n** permit persons to whom the Software is furnished to do so, subject to\r\n** the following conditions:\r\n**\r\n** The above copyright notice and this permission notice shall be\r\n** included in all copies or substantial portions of the Software.\r\n**\r\n** THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n**\r\n** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]\r\n*/\r\n\r\n#ifndef _LUAJIT_H\r\n#define _LUAJIT_H\r\n\r\n#include \"lua.h\"\r\n\r\n#define LUAJIT_VERSION\t\t\"LuaJIT 2.0.1\"\r\n#define LUAJIT_VERSION_NUM\t20001  /* Version 2.0.1 = 02.00.01. */\r\n#define LUAJIT_VERSION_SYM\tluaJIT_version_2_0_1\r\n#define LUAJIT_COPYRIGHT\t\"Copyright (C) 2005-2013 Mike Pall\"\r\n#define LUAJIT_URL\t\t\"http://luajit.org/\"\r\n\r\n/* Modes for luaJIT_setmode. */\r\n#define LUAJIT_MODE_MASK\t0x00ff\r\n\r\nenum {\r\n  LUAJIT_MODE_ENGINE,\t\t/* Set mode for whole JIT engine. */\r\n  LUAJIT_MODE_DEBUG,\t\t/* Set debug mode (idx = level). */\r\n\r\n  LUAJIT_MODE_FUNC,\t\t/* Change mode for a function. */\r\n  LUAJIT_MODE_ALLFUNC,\t\t/* Recurse into subroutine protos. */\r\n  LUAJIT_MODE_ALLSUBFUNC,\t/* Change only the subroutines. */\r\n\r\n  LUAJIT_MODE_TRACE,\t\t/* Flush a compiled trace. */\r\n\r\n  LUAJIT_MODE_WRAPCFUNC = 0x10,\t/* Set wrapper mode for C function calls. */\r\n\r\n  LUAJIT_MODE_MAX\r\n};\r\n\r\n/* Flags or'ed in to the mode. */\r\n#define LUAJIT_MODE_OFF\t\t0x0000\t/* Turn feature off. */\r\n#define LUAJIT_MODE_ON\t\t0x0100\t/* Turn feature on. */\r\n#define LUAJIT_MODE_FLUSH\t0x0200\t/* Flush JIT-compiled code. */\r\n\r\n/* LuaJIT public C API. */\r\n\r\n/* Control the JIT engine. */\r\nLUA_API int luaJIT_setmode(lua_State *L, int idx, int mode);\r\n\r\n/* Enforce (dynamic) linker error for version mismatches. Call from main. */\r\nLUA_API void LUAJIT_VERSION_SYM(void);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/luajit-2.0.1/include/lualib.h",
    "content": "/*\r\n** Standard library header.\r\n** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h\r\n*/\r\n\r\n#ifndef _LUALIB_H\r\n#define _LUALIB_H\r\n\r\n#include \"lua.h\"\r\n\r\n#define LUA_FILEHANDLE\t\"FILE*\"\r\n\r\n#define LUA_COLIBNAME\t\"coroutine\"\r\n#define LUA_MATHLIBNAME\t\"math\"\r\n#define LUA_STRLIBNAME\t\"string\"\r\n#define LUA_TABLIBNAME\t\"table\"\r\n#define LUA_IOLIBNAME\t\"io\"\r\n#define LUA_OSLIBNAME\t\"os\"\r\n#define LUA_LOADLIBNAME\t\"package\"\r\n#define LUA_DBLIBNAME\t\"debug\"\r\n#define LUA_BITLIBNAME\t\"bit\"\r\n#define LUA_JITLIBNAME\t\"jit\"\r\n#define LUA_FFILIBNAME\t\"ffi\"\r\n\r\nLUALIB_API int luaopen_base(lua_State *L);\r\nLUALIB_API int luaopen_math(lua_State *L);\r\nLUALIB_API int luaopen_string(lua_State *L);\r\nLUALIB_API int luaopen_table(lua_State *L);\r\nLUALIB_API int luaopen_io(lua_State *L);\r\nLUALIB_API int luaopen_os(lua_State *L);\r\nLUALIB_API int luaopen_package(lua_State *L);\r\nLUALIB_API int luaopen_debug(lua_State *L);\r\nLUALIB_API int luaopen_bit(lua_State *L);\r\nLUALIB_API int luaopen_jit(lua_State *L);\r\nLUALIB_API int luaopen_ffi(lua_State *L);\r\n\r\nLUALIB_API void luaL_openlibs(lua_State *L);\r\n\r\n#ifndef lua_assert\r\n#define lua_assert(x)\t((void)0)\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/proxy/jniproxy.cpp",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n * jniproxy.cpp\r\n *\r\n */\r\n\r\n// jniproxy.cpp\r\n\r\n#include <stdio.h>\r\n#include    <jni.h>\r\n#include    <android/log.h>\r\n#include    <dlfcn.h>\r\n#include \"klb_android_GameEngine_PFInterface.h\"\r\n#include \"../Android/PackageDefine.h\"\r\n\r\nJavaVM  *javaVm = NULL;\r\n\r\n/*\r\ntemplate<typename T>\r\nvoid auto_load( T& a, void* ptr ,  const char * func_name )\r\n{\r\n \tif(!ptr) {\r\n \t\tchar buf[256];\r\n \t\tsprintf(buf, \"symbol not found in DLL: %s\", func_name);\r\n \t   __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", (const char *)buf);\r\n \t}\r\n    a= reinterpret_cast<T>( ptr );\r\n}\r\n#define get_proc_0( image, proc_func , app_func )  auto_load( proc_func , dlsym( image , #app_name ) , #app_func )\r\n#define get_proc( proc_func , app_func )   get_proc_0( LoadApplication, proc_func , app_func )\r\n*/\r\ntemplate<typename T>\r\nvoid auto_load( T& a, void* image ,  const char * func_name )\r\n{\r\n    void* ptr = dlsym( image , func_name );\r\n \tif(!ptr) {\r\n \t\tchar buf[256];\r\n \t\tsprintf(buf, \"symbol not found in DLL: %s\", func_name);\r\n \t   __android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", (const char *)buf);\r\n \t}\r\n    a= reinterpret_cast<T>( ptr );\r\n}\r\n\r\n\r\n//-----------------------------------------------------------------------------\r\nstatic jboolean JNICALL (*PROC_FUNC(initSequence))(JNIEnv *, jobject, jint, jint, jstring, jstring, jstring, jstring, jstring, jstring);\r\nstatic void     JNICALL (*PROC_FUNC(frameFlip))(JNIEnv *, jobject, jint);\r\nstatic void     JNICALL (*PROC_FUNC(finishGame))(JNIEnv *, jobject);\r\nstatic void     JNICALL (*PROC_FUNC(inputPoint))(JNIEnv *, jobject, jint, jint, jint, jint);\r\nstatic void     JNICALL (*PROC_FUNC(inputDeviceKey))(JNIEnv *, jobject, jint, jchar);\r\nstatic void     JNICALL (*PROC_FUNC(rotateScreenOrientation))(JNIEnv *, jobject, jint, jint, jint);\r\nstatic void     JNICALL (*PROC_FUNC(toNativeSignal))(JNIEnv *, jobject, jint, jint);\r\nstatic jint     JNICALL (*PROC_FUNC(getGLVersion))(JNIEnv *, jobject);\r\nstatic void     JNICALL (*PROC_FUNC(resetViewport))(JNIEnv *, jobject);\r\nstatic void     JNICALL (*PROC_FUNC(onActivityPause))( void );\r\nstatic void     JNICALL (*PROC_FUNC(onActivityResume))( void );\r\nstatic void\t\tJNICALL (*PROC_FUNC(clientControlEvent))(JNIEnv *, jobject, jint, jint, jstring, jstring);\r\nstatic void     JNICALL (*PROC_FUNC(WebViewControlEvent))( JNIEnv *, jobject, jobject, jint );\r\nstatic void\t\tJNICALL (*PROC_FUNC(clientResumeGame))( void );\r\nstatic void\t\tJNICALL (*PROC_FUNC(jniOnLoad))( JavaVM*, void* );\r\n\r\n//-----------------------------------------------------------------------------\r\n\r\nstatic void*   LoadApplication= NULL;\r\n\r\nstatic int InitializeApplication()\r\n{\r\n#if DEBUG\r\n\t__android_log_write(ANDROID_LOG_DEBUG, \"Proxy\", \"Initialize application DLL.\");\r\n#endif\r\n\r\n    // lib 読み込み\r\n    LoadApplication= dlopen( APP_LOAD_PATH , RTLD_LAZY );\r\n    if( !LoadApplication ){\r\n    \treturn -1;\r\n    }\r\n\r\n    // API 取り出し\r\n    auto_load( PROC_FUNC(getGLVersion)            , LoadApplication , GET_XSTR( APP_FUNC(getGLVersion) ) );\r\n    auto_load( PROC_FUNC(initSequence)            , LoadApplication , GET_XSTR( APP_FUNC(initSequence) ) );\r\n    auto_load( PROC_FUNC(frameFlip)               , LoadApplication , GET_XSTR( APP_FUNC(frameFlip) ) );\r\n    auto_load( PROC_FUNC(finishGame)              , LoadApplication , GET_XSTR( APP_FUNC(finishGame) ) );\r\n    auto_load( PROC_FUNC(inputPoint)              , LoadApplication , GET_XSTR( APP_FUNC(inputPoint) ) );\r\n    auto_load( PROC_FUNC(inputDeviceKey)          , LoadApplication , GET_XSTR( APP_FUNC(inputDeviceKey) ) );\r\n    auto_load( PROC_FUNC(rotateScreenOrientation) , LoadApplication , GET_XSTR( APP_FUNC(rotateScreenOrientation) ) );\r\n    auto_load( PROC_FUNC(toNativeSignal)          , LoadApplication , GET_XSTR( APP_FUNC(toNativeSignal) ) );\r\n    auto_load( PROC_FUNC(resetViewport)           , LoadApplication , GET_XSTR( APP_FUNC(resetViewport) ) );\r\n    auto_load( PROC_FUNC(onActivityPause)         , LoadApplication , GET_XSTR( APP_FUNC(onActivityPause) ) );\r\n    auto_load( PROC_FUNC(onActivityResume)        , LoadApplication , GET_XSTR( APP_FUNC(onActivityResume) ) );\r\n\tauto_load( PROC_FUNC(clientControlEvent)      , LoadApplication , GET_XSTR( APP_FUNC(clientControlEvent) ) );\r\n    auto_load( PROC_FUNC(WebViewControlEvent)     , LoadApplication , GET_XSTR( APP_FUNC(WebViewControlEvent) ) );\r\n    auto_load( PROC_FUNC(clientResumeGame)         , LoadApplication , GET_XSTR( APP_FUNC(clientResumeGame) ) );\r\n    auto_load( PROC_FUNC(jniOnLoad)               , LoadApplication , GET_XSTR( APP_FUNC(jniOnLoad) ) );\r\n\r\n\tif (javaVm != NULL) {\r\n\t\tPROC_FUNC(jniOnLoad)(javaVm, NULL);\r\n\t}\r\n    return 0;\r\n}\r\n\r\n\r\nstatic void FinalizeApplication()\r\n{\r\n    if( LoadApplication ){\r\n        dlclose( LoadApplication );\r\n        LoadApplication= NULL;\r\n    }\r\n}\r\n\r\n\r\nextern \"C\" {\r\n//-----------------------------------------------------------------------------\r\n\r\nJNIEXPORT jboolean JNICALL JAVA_FUNC(initSequence)\r\n  (JNIEnv *env, jobject obj, jint j_width, jint j_height, jstring j_strPath,\r\n\t\t  jstring j_model, jstring j_brand, jstring j_board, jstring j_version, jstring j_tz)\r\n{\r\n    if( !LoadApplication ){\r\n        if(InitializeApplication()) return 0;\r\n    }\r\n    return PROC_FUNC(initSequence)( env, obj, j_width, j_height, j_strPath, j_model, j_brand, j_board, j_version, j_tz );\r\n    return 0;\r\n}\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    frameFlip\r\n * Signature: (I)V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(frameFlip)\r\n  (JNIEnv *env, jobject obj, jint j_deltaT)\r\n{\r\n  if(LoadApplication) PROC_FUNC(frameFlip)( env, obj, j_deltaT );\r\n}\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    finishGame\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(finishGame)\r\n  (JNIEnv *env, jobject obj)\r\n{\r\n    if( LoadApplication ){\r\n      PROC_FUNC(finishGame)( env, obj );\r\n        FinalizeApplication();\r\n    }\r\n}\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(inputPoint)\r\n  (JNIEnv *env, jobject obj, jint j_id, jint j_type, jint j_x, jint j_y)\r\n{\r\n  if(LoadApplication) PROC_FUNC(inputPoint)( env, obj, j_id, j_type, j_x, j_y );\r\n}\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(inputDeviceKey)\r\n  (JNIEnv *env, jobject obj, jint keyId, jchar eventType)\r\n{\r\n  if(LoadApplication) PROC_FUNC(inputDeviceKey)( env, obj, keyId, eventType );\r\n}\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(rotateScreenOrientation)\r\n  (JNIEnv *env, jobject obj, jint j_origin, jint j_width, jint j_height)\r\n{\r\n  if(LoadApplication) PROC_FUNC(rotateScreenOrientation)( env, obj, j_origin, j_width, j_height );\r\n}\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(toNativeSignal)\r\n  (JNIEnv *env, jobject obj, jint j_cmd, jint j_param)\r\n{\r\n  if(LoadApplication) PROC_FUNC(toNativeSignal)( env, obj, j_cmd, j_param );\r\n}\r\n\r\nJNIEXPORT jint JNICALL JAVA_FUNC(getGLVersion)\r\n  (JNIEnv * env, jobject obj)\r\n{\r\n\tjint ret = 0;\r\n\tif(!LoadApplication) {\r\n        if(InitializeApplication()) return -1;\r\n\t}\r\n\tchar buf[256];\r\n\tif(PROC_FUNC(getGLVersion)) ret = PROC_FUNC(getGLVersion)( env, obj );\r\n\treturn ret;\r\n}\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(resetViewport)\r\n  (JNIEnv * env, jobject obj)\r\n{\r\n  if(LoadApplication) PROC_FUNC(resetViewport)( env, obj);\r\n}\r\n\r\n// アプリにおけるバックグラウンドに行った際の動作\r\nJNIEXPORT void  JNICALL JAVA_FUNC(onActivityPause) (void)\r\n{\r\n\tif(LoadApplication) PROC_FUNC(onActivityPause)();\r\n}\r\n\r\n// アプリに置けるフォアグラウンドに行った際の動作\r\nJNIEXPORT void  JNICALL JAVA_FUNC(onActivityResume) (void)\r\n{\r\n\tif(LoadApplication) PROC_FUNC(onActivityResume)();\r\n}\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(clientControlEvent)\r\n\t(JNIEnv * env, jobject obj, jint j_type, jint j_widget, jstring j_data_1, jstring j_data_2)\r\n{\r\n\t// j_widgetはちょっとどう扱っていいかわからないので、null渡しておきます //\r\n\tif(LoadApplication) PROC_FUNC(clientControlEvent)( env, obj, j_type, 0, j_data_1, j_data_2 );\r\n}\r\n\r\n// WebViewのコントロールイベント\r\nJNIEXPORT void JNICALL JAVA_FUNC(WebViewControlEvent) ( JNIEnv * env, jobject obj, jobject _pWeb, jint _int )\r\n{\r\n\tif(LoadApplication) PROC_FUNC(WebViewControlEvent)( env, obj, _pWeb, _int );\r\n}\r\n\r\nJNIEXPORT void  JNICALL JAVA_FUNC(clientResumeGame) (void)\r\n{\r\n\tif(LoadApplication) PROC_FUNC(clientResumeGame)();\r\n}\r\n\r\njint JNI_OnLoad(JavaVM* vm, void* reserved)\r\n{\r\n\tjavaVm = vm;\r\n\tif(LoadApplication) {\r\n\t\tPROC_FUNC(jniOnLoad)(vm, reserved);\r\n\t}\r\n\treturn JNI_VERSION_1_6;\r\n}\r\n//-----------------------------------------------------------------------------\r\n};\r\n"
  },
  {
    "path": "Engine/porting/Android/jni/proxy/klb_android_GameEngine_PFInterface.h",
    "content": "/* DO NOT EDIT THIS FILE - it is machine generated */\r\n#include <jni.h>\r\n/* Header for class klb_android_GameEngine_PFInterface */\r\n#include \"../Android/PackageDefine.h\"\r\n\r\n\r\n#ifndef _Included_klb_android_GameEngine_PFInterface\r\n#define _Included_klb_android_GameEngine_PFInterface\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    initSequence\r\n * Signature: (IILjava/lang/String;)Z\r\n */\r\nJNIEXPORT jboolean JNICALL JAVA_FUNC(initSequence)\r\n  (JNIEnv *, jobject, jint, jint, jstring, jstring, jstring, jstring, jstring, jstring);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    frameFlip\r\n * Signature: (I)V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(frameFlip)\r\n  (JNIEnv *, jobject, jint);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    finishGame\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(finishGame)\r\n  (JNIEnv *, jobject);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    inputPoint\r\n * Signature: (IIII)V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(inputPoint)\r\n  (JNIEnv *, jobject, jint, jint, jint, jint);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    inputDeviceKey\r\n * Signature: (IC)V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(inputDeviceKey)\r\n  (JNIEnv *, jobject, jint, jchar);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    rotateScreenOrientation\r\n * Signature: (III)V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(rotateScreenOrientation)\r\n  (JNIEnv *, jobject, jint, jint, jint);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    toNativeSignal\r\n * Signature: (II)V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(toNativeSignal)\r\n  (JNIEnv *, jobject, jint, jint);\r\n\r\nJNIEXPORT jint JNICALL JAVA_FUNC(getGLVersion)\r\n  (JNIEnv *, jobject);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    resetViewport\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(resetViewport)\r\n  (JNIEnv *, jobject);\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    onActivityPause\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(onActivityPause) ( void );\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    onActivityResume\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(onActivityResume) ( void );\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    WebViewControlEvent\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(WebViewControlEvent) ( JNIEnv *, jobject, jobject, jint );\r\n\r\n/*\r\n * Class:     klb_android_GameEngine_PFInterface\r\n * Method:    clientResumeGame\r\n * Signature: ()V\r\n */\r\nJNIEXPORT void JNICALL JAVA_FUNC(clientResumeGame) ( void );\r\n\r\nJNIEXPORT void JNICALL JAVA_FUNC(jniOnLoad) ( JavaVM*, void* );\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Android/lint.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<lint>\r\n</lint>"
  },
  {
    "path": "Engine/porting/Android/project.properties",
    "content": "# This file is automatically generated by Android Tools.\r\n# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\r\n#\r\n# This file must be checked in Version Control Systems.\r\n#\r\n# To customize properties used by the Ant build system edit\r\n# \"ant.properties\", and override values to adapt the script to your\r\n# project structure.\r\n#\r\n# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):\r\n#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt\r\n\r\n# Project target.\r\ntarget=Google Inc.:Google APIs:17\r\n"
  },
  {
    "path": "Engine/porting/Android/res/layout/indicator.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:layout_gravity=\"center\" >\r\n\r\n    <ProgressBar\r\n        android:id=\"@+id/progressBar1\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\" />\r\n\r\n</FrameLayout>"
  },
  {
    "path": "Engine/porting/Android/res/layout/install.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\" >\r\n\r\n    <ProgressBar\r\n        android:id=\"@+id/progressBar1\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_gravity=\"center\"\r\n        android:indeterminate=\"true\" />\r\n\r\n</FrameLayout>"
  },
  {
    "path": "Engine/porting/Android/res/layout/main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:orientation=\"vertical\" >\r\n\r\n    <TextView\r\n        android:layout_width=\"fill_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string/hello\" />\r\n\r\n</LinearLayout>"
  },
  {
    "path": "Engine/porting/Android/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<resources>\r\n\r\n    <string name=\"hello\">Hello World!</string>\r\n    <string name=\"app_name\">GameEngine</string>\r\n    \r\n    <string name=\"sender_id\">694365359580</string>\r\n\r\n</resources>"
  },
  {
    "path": "Engine/porting/Android/src/com/android/vending/billing/IInAppBillingService.aidl",
    "content": "/*\r\n * Copyright (C) 2012 The Android Open Source Project\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage com.android.vending.billing;\r\n\r\nimport android.os.Bundle;\r\n\r\n/**\r\n * InAppBillingService is the service that provides in-app billing version 3 and beyond.\r\n * This service provides the following features:\r\n * 1. Provides a new API to get details of in-app items published for the app including\r\n *    price, type, title and description.\r\n * 2. The purchase flow is synchronous and purchase information is available immediately\r\n *    after it completes.\r\n * 3. Purchase information of in-app purchases is maintained within the Google Play system\r\n *    till the purchase is consumed.\r\n * 4. An API to consume a purchase of an inapp item. All purchases of one-time\r\n *    in-app items are consumable and thereafter can be purchased again.\r\n * 5. An API to get current purchases of the user immediately. This will not contain any\r\n *    consumed purchases.\r\n *\r\n * All calls will give a response code with the following possible values\r\n * RESULT_OK = 0 - success\r\n * RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog\r\n * RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested\r\n * RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase\r\n * RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API\r\n * RESULT_ERROR = 6 - Fatal error during the API action\r\n * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned\r\n * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned\r\n */\r\ninterface IInAppBillingService {\r\n    /**\r\n     * Checks support for the requested billing API version, package and in-app type.\r\n     * Minimum API version supported by this interface is 3.\r\n     * @param apiVersion the billing version which the app is using\r\n     * @param packageName the package name of the calling app\r\n     * @param type type of the in-app item being purchased \"inapp\" for one-time purchases\r\n     *        and \"subs\" for subscription.\r\n     * @return RESULT_OK(0) on success, corresponding result code on failures\r\n     */\r\n    int isBillingSupported(int apiVersion, String packageName, String type);\r\n\r\n    /**\r\n     * Provides details of a list of SKUs\r\n     * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle\r\n     * with a list JSON strings containing the productId, price, title and description.\r\n     * This API can be called with a maximum of 20 SKUs.\r\n     * @param apiVersion billing API version that the Third-party is using\r\n     * @param packageName the package name of the calling app\r\n     * @param skusBundle bundle containing a StringArrayList of SKUs with key \"ITEM_ID_LIST\"\r\n     * @return Bundle containing the following key-value pairs\r\n     *         \"RESPONSE_CODE\" with int value, RESULT_OK(0) if success, other response codes on\r\n     *              failure as listed above.\r\n     *         \"DETAILS_LIST\" with a StringArrayList containing purchase information\r\n     *              in JSON format similar to:\r\n     *              '{ \"productId\" : \"exampleSku\", \"type\" : \"inapp\", \"price\" : \"$5.00\",\r\n     *                 \"title : \"Example Title\", \"description\" : \"This is an example description\" }'\r\n     */\r\n    Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);\r\n\r\n    /**\r\n     * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,\r\n     * the type, a unique purchase token and an optional developer payload.\r\n     * @param apiVersion billing API version that the app is using\r\n     * @param packageName package name of the calling app\r\n     * @param sku the SKU of the in-app item as published in the developer console\r\n     * @param type the type of the in-app item (\"inapp\" for one-time purchases\r\n     *        and \"subs\" for subscription).\r\n     * @param developerPayload optional argument to be sent back with the purchase information\r\n     * @return Bundle containing the following key-value pairs\r\n     *         \"RESPONSE_CODE\" with int value, RESULT_OK(0) if success, other response codes on\r\n     *              failure as listed above.\r\n     *         \"BUY_INTENT\" - PendingIntent to start the purchase flow\r\n     *\r\n     * The Pending intent should be launched with startIntentSenderForResult. When purchase flow\r\n     * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.\r\n     * If the purchase is successful, the result data will contain the following key-value pairs\r\n     *         \"RESPONSE_CODE\" with int value, RESULT_OK(0) if success, other response codes on\r\n     *              failure as listed above.\r\n     *         \"INAPP_PURCHASE_DATA\" - String in JSON format similar to\r\n     *              '{\"orderId\":\"12999763169054705758.1371079406387615\",\r\n     *                \"packageName\":\"com.example.app\",\r\n     *                \"productId\":\"exampleSku\",\r\n     *                \"purchaseTime\":1345678900000,\r\n     *                \"purchaseToken\" : \"122333444455555\",\r\n     *                \"developerPayload\":\"example developer payload\" }'\r\n     *         \"INAPP_DATA_SIGNATURE\" - String containing the signature of the purchase data that\r\n     *                                  was signed with the private key of the developer\r\n     *                                  TODO: change this to app-specific keys.\r\n     */\r\n    Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type,\r\n        String developerPayload);\r\n\r\n    /**\r\n     * Returns the current SKUs owned by the user of the type and package name specified along with\r\n     * purchase information and a signature of the data to be validated.\r\n     * This will return all SKUs that have been purchased in V3 and managed items purchased using\r\n     * V1 and V2 that have not been consumed.\r\n     * @param apiVersion billing API version that the app is using\r\n     * @param packageName package name of the calling app\r\n     * @param type the type of the in-app items being requested\r\n     *        (\"inapp\" for one-time purchases and \"subs\" for subscription).\r\n     * @param continuationToken to be set as null for the first call, if the number of owned\r\n     *        skus are too many, a continuationToken is returned in the response bundle.\r\n     *        This method can be called again with the continuation token to get the next set of\r\n     *        owned skus.\r\n     * @return Bundle containing the following key-value pairs\r\n     *         \"RESPONSE_CODE\" with int value, RESULT_OK(0) if success, other response codes on\r\n     *              failure as listed above.\r\n     *         \"INAPP_PURCHASE_ITEM_LIST\" - StringArrayList containing the list of SKUs\r\n     *         \"INAPP_PURCHASE_DATA_LIST\" - StringArrayList containing the purchase information\r\n     *         \"INAPP_DATA_SIGNATURE_LIST\"- StringArrayList containing the signatures\r\n     *                                      of the purchase information\r\n     *         \"INAPP_CONTINUATION_TOKEN\" - String containing a continuation token for the\r\n     *                                      next set of in-app purchases. Only set if the\r\n     *                                      user has more owned skus than the current list.\r\n     */\r\n    Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);\r\n\r\n    /**\r\n     * Consume the last purchase of the given SKU. This will result in this item being removed\r\n     * from all subsequent responses to getPurchases() and allow re-purchase of this item.\r\n     * @param apiVersion billing API version that the app is using\r\n     * @param packageName package name of the calling app\r\n     * @param purchaseToken token in the purchase information JSON that identifies the purchase\r\n     *        to be consumed\r\n     * @return 0 if consumption succeeded. Appropriate error values for failures.\r\n     */\r\n    int consumePurchase(int apiVersion, String packageName, String purchaseToken);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/EditBoxItem.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport klb.android.GameEngine.GameEngineActivity;\r\nimport android.content.Context;\r\nimport android.graphics.Paint;\r\nimport android.text.InputType;\r\nimport android.view.KeyEvent;\r\nimport android.view.View;\r\nimport android.view.View.OnKeyListener;\r\nimport android.view.ViewGroup;\r\nimport android.view.inputmethod.InputMethodManager;\r\nimport android.text.method.SingleLineTransformationMethod;\r\nimport android.util.TypedValue;\r\nimport android.widget.EditText;\r\nimport java.lang.String;\r\nimport android.widget.LinearLayout;\r\nimport android.text.InputFilter;\r\n\r\nclass EditBoxItem\r\n{\r\n\tprivate boolean m_passwdmode = false;\r\n\tprivate LinearLayout m_layout = null;\r\n\tprivate LinearLayout.LayoutParams m_params = null;\r\n\tprivate EditText m_edit = null;\r\n\tprivate String m_text;\r\n\tprivate int m_x;\r\n\tprivate int m_y;\r\n\tprivate int m_width;\r\n\tprivate int m_height;\r\n\tprivate GameEngineActivity m_context = null;\r\n\tpublic boolean m_created;\r\n\tpublic boolean m_update;\r\n\tpublic boolean m_remove;\r\n\tpublic boolean m_visible = true;\r\n\tpublic boolean m_enabled = true;\r\n\tpublic Paint m_Paint = null;\r\n\tprivate String m_hint;\r\n\tprivate int m_gravity;\r\n\tprivate int m_maxlen;\r\n\r\n\t// constructor はGLスレッドから呼ばれる\r\n\tpublic EditBoxItem(GameEngineActivity context, String text,\r\n\t\t\t\t\t\tint x, int y, int width, int height, boolean passwdmode) {\r\n\r\n\t\t//m_edit = new EditText(context);\r\n\t\tm_edit = null;\r\n\t\tm_passwdmode = passwdmode;\r\n\r\n\t\tm_text = text;\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_context = context;\r\n\t\tm_maxlen = 0;\r\n\t\tm_created = false;\r\n\t\tm_update = false;\r\n\t\tm_remove = false;\r\n\t\t\r\n\t\tm_gravity = -1;\r\n\t}\r\n\t\r\n\t// 値の設定もGLスレッドから呼ばれる\r\n\tpublic void move(int x, int y, int width, int height) {\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_update = true;\r\n\t}\r\n\t\r\n\t// 値の取得も主にGLスレッドから呼ばれる\r\n\tpublic String getText() {\r\n\t\tif(m_created) {\r\n\t\t\treturn m_edit.getText().toString();\r\n\t\t} else {\r\n\t\t\treturn m_text;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic void setText(String text) {\r\n\t\tm_text = text;\r\n\t\tif(null != m_edit) {\r\n\t\t\tm_edit.setText(text);\r\n\t\t}\r\n\t\tm_update = true;\r\n\t}\r\n\t\r\n\tprivate void setStatus() {\r\n\t\tif(m_visible) {\r\n\t\t\tm_edit.setEnabled(m_enabled);\r\n\t\t\tm_edit.setVisibility(View.VISIBLE);\r\n\t\t} else {\r\n\t\t\tm_edit.setEnabled(false);\r\n\t\t\tm_edit.setVisibility(View.INVISIBLE);\r\n\t\t}\r\n\t}\r\n\tpublic void setPaint(Paint paint)\r\n\t{\r\n\t\tm_Paint = paint;\r\n\t}\r\n\tpublic void setHint(String hint)\r\n\t{\r\n\t\tm_hint = hint;\r\n\t\tif(null != m_edit){\r\n\t\t\tm_edit.setHint(m_hint);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void setGravity(int gravity)\r\n\t{\r\n\t\tm_gravity = gravity;\r\n\t\tif(null != m_edit){\r\n\t\t\tm_edit.setGravity(gravity);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void setMaxlen(int maxlen)\r\n\t{\r\n\t\tif (m_edit != null) {\r\n\t\t\tif (maxlen > 0) {\r\n\t\t\t\tm_edit.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxlen)});\r\n\t\t\t} else {\r\n\t\t\t\tm_edit.setFilters(new InputFilter[0]); // NO_FILTERS;\r\n\t\t\t}\r\n\t\t}\r\n\t\tm_maxlen = maxlen;\r\n\t}\r\n\r\n\t// 以下はメインスレッドから呼ばれる(Runnable経由)\r\n\tpublic void create() {\r\n\t\tif(m_created) return;\r\n\t\tm_edit = new EditText(m_context);\r\n        m_edit.setMaxLines(1);\r\n\t\tm_edit.setHint(m_hint);\r\n\t\tsetMaxlen(m_maxlen);\r\n\t\tif (m_gravity != -1) {\r\n\t\t\tm_edit.setGravity(m_gravity);\r\n\t\t}\r\n\t\tif( m_Paint != null ) {\r\n\t\t\tm_edit.setTypeface(m_Paint.getTypeface());\r\n\t\t}\r\n\t\t// setPaddingしてやらないと文字表示がうまくいかないため  2013/03/21   //\r\n\t\tm_edit.setPadding(10, 0, 10, 0);\r\n\t\tm_edit.setOnKeyListener(new OnKeyListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic boolean onKey(View v, int keyCode, KeyEvent event) {\r\n\t\t\t\tif(event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {\r\n\t\t\t\t\tInputMethodManager inputMethodManager = (InputMethodManager)m_context.getSystemService(Context.INPUT_METHOD_SERVICE);\r\n\t\t\t\t\tinputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\t\tm_edit.setTransformationMethod(SingleLineTransformationMethod.getInstance());\r\n\t\tm_edit.setOnFocusChangeListener(new View.OnFocusChangeListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void onFocusChange(View v, boolean hasFocus) {\r\n\t\t\t\tInputMethodManager inputMethodManager = (InputMethodManager) m_context.getSystemService(Context.INPUT_METHOD_SERVICE);\r\n\t\t\t\tif(hasFocus) {\r\n\t\t\t\t//\tinputMethodManager.showSoftInput(v, InputMethodManager.SHOW_FORCED);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tinputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\t\tif(m_passwdmode) m_edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\r\n\r\n\t\tm_layout = new LinearLayout(m_context);\r\n\t\tm_params = new LinearLayout.LayoutParams(m_width, m_height);\r\n\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\tm_layout.addView(m_edit, m_params);\r\n\t\t//m_context.putControl(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\tm_context.putControl(m_layout, m_x, m_y, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);\r\n\t\tm_edit.setText(m_text);\r\n\t\t\r\n\t\tsetStatus();\r\n\t\tm_created = true;\r\n\t}\r\n\t\r\n\tpublic void update() {\r\n\t\tif(!m_update || m_edit == null) return;\r\n\t\t//m_layout.removeView(m_edit);\r\n\r\n\t\tif( m_Paint != null )\r\n\t\t{\r\n\t\t\tfloat textSize = m_Paint.getTextSize();\r\n\t\t\tm_edit.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);\r\n\t\t\tint tmpHeight = (int)(textSize * 2.0f);\r\n\t\t\tif(m_height < tmpHeight)\r\n\t\t\t{\r\n\t\t\t\tm_height = tmpHeight;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tm_params.width = m_width;\r\n\t\tm_params.height = m_height;\r\n\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\tm_edit.requestLayout();\r\n\t\t//m_layout.addView(m_edit, m_params);\r\n\t\t//m_context.replaceView(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\tsetStatus();\r\n\t\tm_text = m_edit.getText().toString();\r\n\t\tm_update = false;\r\n\t}\r\n\t\r\n\tpublic boolean remove() {\r\n\t\tif(!m_remove) return false;\r\n\t\tif(m_edit != null) m_context.removeView(m_layout);\r\n\t\treturn true;\r\n\t}\r\n\r\n\tpublic void setVisible(boolean visible) {\r\n\t\tm_update = true;\r\n\t\tm_visible = visible;\r\n\t}\r\n\r\n\tpublic void setEnable(boolean enabled) {\r\n\t\tm_update = true;\r\n\t\tm_enabled = enabled;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/FontManager.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport android.content.res.AssetManager;\r\nimport android.graphics.Paint;\r\n\r\npublic class FontManager \r\n{\r\n\tprivate static FontManager instance = new FontManager();\t// インスタンス実体はこのメンバ\r\n\t\r\n\t/*!\r\n\t * @brief\tコンストラクタ\r\n\t */\r\n\tprivate FontManager() {}\r\n\t\r\n\t/*!\r\n\t * @brief\tインスタンス取得\r\n\t */\r\n\tpublic static FontManager getInstance() {\r\n\t\treturn instance;\r\n\t}\r\n\t\r\n\t/*!\r\n\t * @brief\tPaint作成\r\n\t */\r\n\tstatic Paint \t\trenderTarget = null;\r\n\tstatic AssetManager\tmgrAsset\t = null;\r\n\tstatic String\t\tlastFont\t = null;\r\n\t\r\n\tpublic static Paint CreatePaint( String _fntName )\r\n\t{\r\n\t\tString fntName = _fntName;\r\n\t\t\r\n\t\tif (renderTarget == null) {\r\n\t\t\trenderTarget = new Paint();\r\n\t\t}\r\n\t\tif ( fntName==null ) return renderTarget;\r\n\t\t\r\n\t\tboolean refresh = false;\r\n\t\tif ( lastFont==null ) {\r\n\t\t\tlastFont = fntName;\r\n\t\t\trefresh = true;\r\n\t\t} else {\r\n\t\t\tif (lastFont.equals(fntName) == false) {\r\n\t\t\t\tlastFont = fntName;\r\n\t\t\t\trefresh = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (mgrAsset == null) {\r\n\t\t\tmgrAsset = GameEngineActivity.GetAssetManager();\r\n\t\t\trefresh = true;\r\n\t\t}\r\n\t\t\r\n\t\tif (refresh) {\r\n\t\t\ttry {\r\n\t\t\t\t// ファイルの存在チェック\r\n\t\t\t\tmgrAsset.open( fntName );\r\n\t\t\t\t\r\n\t\t\t\t// 指定のフォントを作成して設定\r\n\t\t\t\trenderTarget.setTypeface( Typefaces.get(mgrAsset, fntName) );\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn renderTarget;\r\n\t}\r\n\t\r\n\tpublic static void setTextSize( Paint _paint, float _size )\r\n\t{\r\n\t\tif( _paint == null ) return;\r\n\t\t_size = _size * 5.0f / 6.0f; // TODO：iOSでもやってる魔法の呪文・・・何だろう\r\n\t\t_paint.setTextSize(_size);\r\n\t}\r\n\t\r\n\tpublic static void setAntiAlias( Paint _paint, boolean _bAlias )\r\n\t{\r\n\t\tif( _paint == null ) return;\r\n\t\t_paint.setAntiAlias( _bAlias );\r\n\t}\r\n\t\r\n\tpublic static float measureText( Paint _paint, String _str )\r\n\t{\r\n\t\tif( _paint == null ) return 0.0f;\r\n\t\treturn _paint.measureText( _str );\r\n\t}\r\n\t\r\n\tpublic static Paint.FontMetrics getFontMetrics( Paint _paint )\r\n\t{\r\n\t\tif( _paint == null ) return null;\r\n\t\treturn _paint.getFontMetrics();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/GCMIntentService.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport java.util.Iterator;\r\n\r\nimport android.app.Notification;\r\nimport android.app.NotificationManager;\r\nimport android.app.PendingIntent;\r\nimport android.content.Context;\r\nimport android.content.Intent;\r\nimport android.os.Bundle;\r\nimport android.util.Log;\r\nimport com.google.android.gcm.GCMBaseIntentService;\r\n\r\npublic class GCMIntentService extends GCMBaseIntentService\r\n{\r\n\t/*\r\n\t * コンストラクタ\r\n\t */\r\n\tpublic GCMIntentService() {\r\n\t\tsuper(Integer.toString(R.string.sender_id));\r\n\t}\r\n\t\r\n\t/*\r\n\t * GCMサーバへの登録完了時の処理\r\n\t * @see com.google.android.gcm.GCMBaseIntentService#onRegistered(android.content.Context, java.lang.String)\r\n\t */\r\n\t@Override\r\n    protected void onRegistered(Context context, String registrationId) {\r\n    }\r\n\t\r\n\t/*\r\n\t * GCMサーバからの登録解除完了時の処理\r\n\t * @see com.google.android.gcm.GCMBaseIntentService#onUnregistered(android.content.Context, java.lang.String)\r\n\t */\r\n\t@Override\r\n\tprotected void onUnregistered(Context arg0, String arg1) {\r\n\t}   \r\n\r\n\t/*\r\n\t * メッセージ到着時の処理\r\n\t * @see com.google.android.gcm.GCMBaseIntentService#onMessage(android.content.Context, android.content.Intent)\r\n\t */\r\n    @Override\r\n    protected void onMessage(Context context, Intent intent)\r\n    {\r\n    \tshowNotification( context, intent );\r\n    \t/*\r\n    \tBundle messageBundle = intent.getExtras(); // Intent#getExtras() で受信したメッセージの内容を取得\r\n\r\n        // キー・バリュー形式のメッセージにBundleとしてアクセス\r\n        Iterator<String> iterator = messageBundle.keySet().iterator();\r\n        while (iterator.hasNext()) {\r\n            String key = iterator.next();\r\n            // 取得したキー・バリューの対をログ出力\r\n            Log.d(TAG, key + \" = \" + messageBundle.getString(key));\r\n        }\r\n        try {\r\n            showNotification(context,\r\n                    URLDecoder.decode(messageBundle.getString(\"message\"), \"UTF-8\"),\r\n                    URLDecoder.decode(messageBundle.getString(\"detail\"), \"UTF-8\"));\r\n        } catch (UnsupportedEncodingException e) {\r\n            e.printStackTrace();\r\n        }\r\n        */\r\n    }\r\n\r\n    /*\r\n     * エラー時の処理\r\n     * @see com.google.android.gcm.GCMBaseIntentService#onError(android.content.Context, java.lang.String)\r\n     */\r\n\t@Override\r\n\tprotected void onError(Context arg0, String arg1) {\r\n\t}\r\n    \r\n    /*\r\n     * NotificationManagerを使って、受信したメッセージの内容を表示\r\n     */\r\n    private void showNotification(Context _context, Intent _intent)\r\n    {\r\n    \tBundle messageBundle = _intent.getExtras(); // Intent#getExtras() で受信したメッセージの内容を取得\r\n    \t\r\n    \tIterator<String> iterator = messageBundle.keySet().iterator();\r\n    \tLog.d(TAG, \"-----------------------------\");\r\n    \tLog.d(TAG, \"  GCM Message\");\r\n    \tLog.d(TAG, \"-----------------------------\");\r\n        while (iterator.hasNext())\r\n        {\r\n            String key = iterator.next();\r\n            // 取得したキー・バリューの対をログ出力\r\n            Log.d(TAG, key + \" = \" + messageBundle.getString(key));\r\n        }\r\n        Log.d(TAG, \"-----------------------------\");\r\n        \r\n        String message_title = _context.getString(R.string.app_name);\r\n        String message_detail = _intent.getStringExtra(\"message\");\r\n        \r\n        Intent intent = new Intent( _context, GameEngineActivity.class );\r\n        intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP );\r\n        PendingIntent contentIntent = PendingIntent.getActivity( _context, 0, intent, 0 );\r\n        \r\n        int icon = R.drawable.ic_launcher;  // TODO : change icon\r\n        long when = System.currentTimeMillis();\r\n\t\tlong[] vibrates = {0, 100, 200, 300};\r\n        Notification notification = new Notification( icon, message_detail, when );\r\n        notification.setLatestEventInfo( _context, message_title, message_detail, contentIntent );\r\n\t\tnotification.defaults |= Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS;\r\n\t\tnotification.flags |= Notification.FLAG_AUTO_CANCEL | Notification.FLAG_SHOW_LIGHTS;\r\n\t\tnotification.ledARGB = 0xff00ff00;\r\n\t\tnotification.ledOnMS = 10000;\r\n\t\tnotification.ledOffMS = 300;\r\n\t\tnotification.vibrate = vibrates;\r\n\r\n\t\tNotificationManager notificationManager = (NotificationManager)_context.getSystemService(Context.NOTIFICATION_SERVICE); \r\n\t\tnotificationManager.notify(R.string.app_name, notification);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/GLES20GameRenderer.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport klb.android.GameEngine.GameEngineActivity;\r\nimport klb.android.GameEngine.PFInterface;\r\n\r\nimport javax.microedition.khronos.egl.EGLConfig;\r\nimport javax.microedition.khronos.opengles.GL10;\r\nimport java.lang.Runnable;\r\nimport java.lang.String;\r\nimport android.opengl.GLSurfaceView;\r\nimport android.os.SystemClock;\r\nimport android.util.Log;\r\n\r\npublic class GLES20GameRenderer implements GLSurfaceView.Renderer {\r\n\tprivate static String FILE_PATH = null;\t// ファイルパス\r\n\tprivate static boolean mBInitialize = false;\r\n\tprivate GameEngineActivity mContext = null;\r\n\tprivate long mPreTime;\r\n\tprivate int m_Width;\r\n\tprivate int m_Height;\r\n\r\n\tpublic GLES20GameRenderer(GameEngineActivity context, String path) {\r\n\t\tmContext = context;\r\n\t\tmPreTime = SystemClock.uptimeMillis();\r\n\t\tFILE_PATH = path;\r\n\t\trunCtrl = new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tPFInterface.getInstance().updateControl();\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\tRunnable runCtrl = null;\r\n\t\r\n\t@Override\r\n\tpublic void onDrawFrame(GL10 glUnused) {\r\n\t\t// 直前のフレーム呼び出しからの経過時間をミリ秒単位で求め、フレーム処理に渡す。\r\n\t\tlong nowTime = SystemClock.uptimeMillis();\r\n\t\tint deltaT = (mPreTime != 0) ? (int)(nowTime - mPreTime) : 1;\r\n\t\tmPreTime = nowTime;\t// 今回取得した時刻が、次回計算時の基準となる。\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tif(deltaT > 7000) {\r\n\t\t\tLog.d(\"Cpp\", \"long time frame!!\");\r\n\t\t}\r\n\t\t\r\n\t\t// インストール処理を別スレッドで行うことになったため  2013/04/22  \r\n\t\tif(mContext.IsInstallEnd() == false)\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t// onSurfaceChangedから移植  2013/04/22  \r\n\t\t// 最初のコールでマルチプラットフォームエンジンの初期化シーケンスを呼び出す。\r\n    \tif(!mBInitialize) {\r\n    \t\tPFInterface.getInstance().callInit(m_Width, m_Height, FILE_PATH);\r\n    \t\tmBInitialize = true;\t// 二回目以降は呼び出さない。\r\n    \t}\r\n   \t\r\n    \tif(mContext.IsUsePause() == true)\r\n    \t{\r\n    \t\tPFInterface.getInstance().clientResumeGame();\r\n    \t\tmContext.SetUsePause(false);\r\n    \t}\r\n\r\n\t\tpfif.frameFlip(deltaT);\t// C++ のフレーム処理が呼ばれる。\r\n\r\n\t\t// OS によるコントロールの処理を行う。\r\n\t\tmContext.runOnUiThread(runCtrl);\r\n\t}\r\n\t\r\n    @Override\r\n\tpublic void onSurfaceChanged(GL10 glUnused, int width, int height) {\r\n        // Ignore the passed-in GL10 interface, and use the GLES20\r\n        // class's static methods instead.\r\n        //        GLES20.glViewport(0, 0, width, height);\r\n\r\n        // ビューポート設定をスケーリングさせたのに再設定\r\n        //\t\tPFInterface pfif = PFInterface.getInstance();\r\n        //\t\tpfif.resetViewport();\r\n\r\n        // 上記でビューポートを設定していたから再設定が必要だった。ゲーム内で設定しているのだからここで設定する必要は無いはず。\r\n    \t\r\n    \t// インストール処理を別スレッドで行うことになった関係で下記をpublic void onDrawFrame(GL10 glUnused)に移動します  2013/04/22  \r\n    \tm_Width = width;\r\n    \tm_Height = height;\r\n/*\r\n    \t// 最初のコールでマルチプラットフォームエンジンの初期化シーケンスを呼び出す。\r\n    \tif(!mBInitialize) {\r\n    \t\tPFInterface.getInstance().callInit(width, height, FILE_PATH);\r\n    \t\tmBInitialize = true;\t// 二回目以降は呼び出さない。\r\n    \t}\r\n*/\r\n    }\r\n \r\n    @Override\r\n\tpublic void onSurfaceCreated(GL10 glUnused, EGLConfig config) {\r\n    }\r\n \r\n    public void resetPreTime() {\r\n    \tmPreTime = 0;\r\n    }\r\n    \r\n    // 再開された時、再開時点を元に deltaT を求められるようにしておく。\r\n    public void onRestart() {\r\n    \tmPreTime = SystemClock.uptimeMillis();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/GameEngineActivity.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport android.util.Log;\r\nimport android.view.KeyEvent;\r\nimport android.view.View;\r\nimport android.view.WindowManager;\r\nimport android.annotation.TargetApi;\r\nimport android.app.Activity;\r\nimport android.app.AlertDialog;\r\nimport android.content.ActivityNotFoundException;\r\nimport android.content.BroadcastReceiver;\r\nimport android.content.DialogInterface;\r\nimport android.content.Context;\r\nimport android.content.IntentFilter;\r\nimport android.content.SharedPreferences;\r\nimport android.content.res.AssetManager;\r\nimport android.hardware.SensorManager;\r\nimport android.os.Build;\r\nimport android.os.Bundle;\r\nimport android.os.Environment;\r\nimport android.os.Handler;\r\nimport android.os.Message;\r\nimport android.view.OrientationEventListener;\r\nimport android.content.res.Configuration;\r\nimport android.widget.FrameLayout;\r\nimport android.widget.Toast;\r\nimport android.view.ViewGroup;\r\nimport com.google.android.gcm.GCMRegistrar;\r\nimport android.content.pm.ApplicationInfo;\r\nimport android.content.pm.PackageManager;\r\nimport android.content.Intent;\r\nimport android.net.Uri;\r\nimport android.media.AudioManager;\r\nimport java.io.BufferedReader;\r\nimport java.io.File;\r\nimport java.io.FileOutputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.util.zip.ZipEntry;\r\nimport java.util.zip.ZipInputStream;\r\nimport java.io.InputStreamReader;\r\nimport java.io.Reader;\r\nimport java.lang.ref.WeakReference;\r\n\r\nimport klb.android.GameEngine.billing.manager.BillingManager;\r\n\r\npublic class GameEngineActivity extends Activity {\r\n\tprivate static final boolean USE_SD_CARD = false;  // SDカード優先フラグ\r\n\tOrientationEventListener mOrientationListener;\r\n\tprivate static AssetManager mAssetMgr = null;\r\n\tprivate GameGLSurfaceView mView;\r\n\tprivate String c_path_install; \r\n\tprivate String c_path_external;\r\n    private String c_path_base;\r\n\tprivate boolean m_initialized = false;\r\n\tprivate int\tm_prev_orientation;\r\n\tprivate FrameLayout m_layout = null;\r\n\tpublic FrameLayout m_MovieLayout = null;\r\n\tpublic FrameLayout m_IndicatorLayout = null;\r\n\tprivate ApplicationInfo m_appliInfo = null;\r\n\tfinal private String VERSION_KEY = \"[assets]version\";\r\n\tprivate View m_InstallProgressView = null;\r\n\tprivate boolean m_installEnd = false;\r\n\tprivate boolean m_UsePause = false;\r\n\tprivate boolean headsetEquipped = false;\r\n\tprivate int m_mediaVolume = 0;\r\n\tprivate BroadcastReceiver headsetReceiver = null;\r\n\tprivate Thread installThread = null;\r\n\tprivate long activityCreatedAt = 0;\r\n    final int DEFAULT_VOLUME = 5;\r\n\r\n\t// AlertDialog用\r\n\tprivate String m_alertTitle = null;\r\n\tprivate String m_alertMessage = null;\r\n\r\n\tprivate boolean isSuBinaryPresent() {\r\n\t\tString[] locationCandidates = { \"/data/local\", \"/data/local/bin\",\r\n\t\t\t\t\"/data/local/xbin\", \"/sbin\", \"/system/bin\", \"/system/sd/xbin\",\r\n\t\t\t\t\"/system/xbin\", \"/system/bin/failsafe\", \"/vendor/bin\" };\r\n\t\tfor (String candidateDir : locationCandidates) {\r\n\t\t\tString candidate = candidateDir + \"/su\";\r\n\t\t\ttry {\r\n\t\t\t\tFile f = new File(candidate);\r\n\t\t\t\tif (f.exists()) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t} catch (Exception e) {\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tFile f = new File(\"/system/app/Superuser.apk\");\r\n\t\t\tif (f.exists()) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tprivate boolean isInappropriateEnvSuspected() {\r\n\t\tif ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {\r\n\t\t\treturn Build.PRODUCT.equals(\"google_sdk\") || Build.PRODUCT.equals(\"sdk\") || isSuBinaryPresent();\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tpublic void startActivity(final Intent intent) {\r\n\t\tfinal Context ctx = this.getApplicationContext();\r\n\t\tintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n\t\tnew Thread(new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (installThread != null) {\r\n\t\t\t\t\t\tinstallThread.join();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlong sleepRemaining = 1000 - ((PFInterface.nanotime() - activityCreatedAt) / 1000000);\r\n\t\t\t\t\tif (0 < sleepRemaining) {\r\n\t\t\t\t\t\tThread.sleep(sleepRemaining);\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tctx.startActivity(intent);\r\n\t\t\t}\r\n\t\t}).start();\r\n\t}\r\n\r\n\t@SuppressWarnings(\"unused\")\r\n\t@Override\r\n    protected void onCreate(Bundle icicle) {\r\n        super.onCreate(icicle);\r\n        activityCreatedAt = PFInterface.nanotime();\r\n        if (isInappropriateEnvSuspected()) {\r\n\t\t\tToast.makeText(this, \"不正なアクセスを検出しました。アプリを起動出来ません。\", Toast.LENGTH_LONG).show();\r\n\t\t\tfinish();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// ボリュームボタンでの制御をメディア音量のみにする\r\n\t\tsetVolumeControlStream(AudioManager.STREAM_MUSIC);\r\n    \tinstanciateEarphoneChecker(); // イヤホンの接続状態の監視を設定\r\n\t\t\r\n        // SenderIDをマニフェストから取得する\r\n        String SenderID = null;\r\n        try {\r\n        \tm_appliInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);\r\n            SenderID = m_appliInfo.metaData.getString(\"GCM_SENDER_ID\");\r\n            if(SenderID.equals(\"\")) SenderID = null;\r\n        } catch(PackageManager.NameNotFoundException e) {\r\n        \tLog.v(\"GE\", \"GCM SenderID Not Found.\");\r\n        \tSenderID = null;\r\n        }\r\n        \r\n        if(!m_initialized) {\r\n        \tboolean install_sd = false;\r\n            String state = Environment.getExternalStorageState();\r\n     \r\n            // AssetsManager設定\r\n            mAssetMgr = getResources().getAssets();\r\n\r\n\t\t\tif( USE_SD_CARD==true )\r\n\t\t\t{\r\n\t\t\t\tif( Environment.MEDIA_MOUNTED.equals(state) )\r\n\t\t\t\t{// SDがマウントされている\r\n\t\t\t\t\t// 容量チェック\r\n        \t\t\r\n\t\t\t\t\t// 容量が十分空いている\r\n\t\t\t\t\tinstall_sd = true;\r\n\r\n\t\t\t\t\tif( Environment.MEDIA_MOUNTED_READ_ONLY.equals(state) )\r\n\t\t\t\t\t{// マウントされているが、READ_ONLY\r\n\t\t\t\t\t\tinstall_sd = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tinstall_sd = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n        \tif( install_sd==true )\r\n\t\t\t{\r\n        \t\tc_path_base = this.getExternalFilesDir(null).getAbsolutePath();\r\n\t\t\t\tif( c_path_base==null )\r\n\t\t\t\t{// これでいけるか…？\r\n\t\t\t\t\tc_path_base = this.getFilesDir().getAbsolutePath();\r\n\t\t\t\t}\r\n        \t}\r\n\t\t\telse\r\n\t\t\t{\r\n        \t\tc_path_base = this.getFilesDir().getAbsolutePath();\r\n\t\t\t}\r\n\t\t\tLog.d(\"GameEngineActivity\",\"FileDir:\"+c_path_base);\r\n        \t\r\n        \tm_prev_orientation = 0;\r\n        \tc_path_install =  c_path_base + \"/install/\";\r\n        \tc_path_external = c_path_base + \"/external/\";\r\n\r\n        \t// install / external に相当するディレクトリ文字列を PFInterface に渡しておく　\r\n        \tPFInterface.getInstance().setBasePath(c_path_install, c_path_external);\r\n        \tPFInterface.getInstance().setSenderID(SenderID);\r\n        \tPFInterface.getInstance().setContext(this);\r\n        \t\r\n        \t// instalフォルダが無ければ生成\r\n        \tFile installdir = new File(c_path_install);\r\n    \t\tif(!installdir.exists()) installdir.mkdir();\t// ディレクトリが無ければ生成\r\n    \t\t\r\n    \t\t// externalフォルダが無ければ生成\r\n        \tFile externaldir = new File(c_path_external);\r\n    \t\tif(!externaldir.exists()) externaldir.mkdir();\t// ディレクトリが無ければ生成\r\n\r\n    \t\t// unzipは別スレッドで行うことにしました  2013/04/22  \r\n    \t\t// assets/sound の内容をfile://install/ にコピーする。\r\n            //\tunzipAssets(c_path_install, c_path_external, \"AppAssets.zip\");\r\n\t    \t// copyAssets(c_path_install);\t// assets の内容を、ローカルにコピーする\r\n        \t\r\n        \t// GCMの RegistrationId を取得\r\n        \tqueryRegID(SenderID);\r\n        \t\r\n        \tm_MovieLayout = new FrameLayout(this);\t// BackgroundMovieはここに組み込む\r\n        \tm_IndicatorLayout = new FrameLayout(this);\r\n//        \tmView = new GameGLSurfaceView(this, getPackageName());\r\n        \tmView = new GameGLSurfaceView(this, c_path_base );\r\n        \tm_layout = new FrameLayout(this);\r\n        \tm_layout.addView(m_MovieLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));\r\n        \tm_layout.addView(mView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));\r\n        \tm_layout.addView(m_IndicatorLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));\r\n        \tsetContentView(m_layout);\r\n        \t\r\n        \tmOrientationListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_UI) {\r\n        \t\t@Override\r\n        \t\tpublic void onOrientationChanged(int orientation) {\r\n        \t\t\tint ori = ((orientation + 405) % 360) / 90;\r\n        \t\t\tif(ori != m_prev_orientation) {\r\n        \t\t\t\t// すくなくとも90度以上回転したことを検知        \t\t\t\t\r\n        \t\t\t\tConfiguration config = getResources().getConfiguration();\r\n        \t\t\t\tswitch(config.orientation)\r\n        \t\t\t\t{\r\n        \t\t\t\tcase Configuration.ORIENTATION_LANDSCAPE:\r\n        \t\t\t\t\tori = 1;\r\n        \t\t\t\t\tbreak;\r\n        \t\t\t\tcase Configuration.ORIENTATION_PORTRAIT:\r\n        \t\t\t\t\tori = 0;\r\n        \t\t\t\t\tbreak;\r\n        \t\t\t\tdefault:\r\n        \t\t\t\t\tbreak;\t\r\n        \t\t\t\t}        \t\t\t\t\r\n        \t\t\t\tm_prev_orientation = ori;\r\n        \t\t\t\tPFInterface.getInstance().screenRotation(ori);\r\n        \t\t\t}\r\n        \t\t}\r\n        \t};\r\n        \tmOrientationListener.enable();\r\n        \tm_initialized = true;\r\n        \t\r\n        \t// インストール用インジケータ（円のプログレスバー使用)  2013/04/22  \r\n        \tm_InstallProgressView = this.getLayoutInflater().inflate(R.layout.install, null);\r\n        \tm_layout.addView(m_InstallProgressView);\r\n        \tinstallThread = new Thread(new CInstall());\r\n        \tinstallThread.start();\r\n        }\r\n    }\r\n\r\n    @Override\r\n    protected void onRestart() {\r\n        super.onRestart();\r\n        mView.onRestart();\r\n    }\r\n\r\n    @Override\r\n    protected void onPause() {\r\n        super.onPause();\r\n\r\n        unregisterHeadsetReceiver();\r\n        \r\n        mView.onPause();\r\n        m_UsePause = true;\r\n    }\r\n\r\n\tboolean isWindowFocused = true;\r\n    boolean resumeRequested = false;\r\n    @Override\r\n\tpublic void onWindowFocusChanged(boolean hasFocus) {\r\n\t\tinvalidateSystemUi();\r\n    \tisWindowFocused = hasFocus;\r\n    \tif (resumeRequested) {\r\n\t\t\tresumeView();\r\n    \t\tresumeRequested = false;\r\n    \t}\r\n    }\r\n\r\n\tboolean isSystemUiDirty = false;\r\n\tprivate void invalidateSystemUi() {\r\n\t\tisSystemUiDirty = true;\r\n\t}\r\n\r\n\t@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)\r\n\tpublic void refreshSystemUi() {\r\n\t\tif (isSystemUiDirty) {\r\n\t\t\tif (Build.VERSION_CODES.ICE_CREAM_SANDWICH <= Build.VERSION.SDK_INT) {\r\n\t\t\t\tgetWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);\r\n\t\t\t}\r\n\t\t\tisSystemUiDirty = false;\r\n\t\t}\r\n\t}\r\n\r\n    @Override\r\n    protected void onResume() {\r\n        super.onResume();\r\n        m_UsePause = false;\r\n    \tinvalidateSystemUi();\r\n        \r\n    \tsetMannerMode();\r\n    \t// イヤホンのレシーバーを登録\r\n        registerHeadsetReceiver();\r\n        \r\n        if (!isWindowFocused) {\r\n        \tresumeRequested = true;\r\n        }\r\n        else {\r\n        \tresumeView();\r\n        }\r\n    }\r\n\r\n\tprivate void resumeView() {\r\n\t\tif (isInappropriateEnvSuspected()) {\r\n\t\t\tToast.makeText(this, \"不正なアクセスを検出しました。アプリを起動出来ません。\", Toast.LENGTH_LONG).show();\r\n\t\t\tfinish();\r\n\t\t}\r\n\t\telse {\r\n\t\t\trefreshSystemUi();\r\n\t\t\tmView.onResume();\r\n\t\t}\r\n\t}\r\n\r\n    @Override\r\n    protected void onDestroy() {\r\n    \tsuper.onDestroy();\r\n    \tPFInterface.billingTerminate();\r\n    }\r\n    \r\n    @Override\r\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\r\n    \tif (!BillingManager.getInstance(this).onActivityResult(requestCode, resultCode, data)) {\r\n    \t\tsuper.onActivityResult(requestCode, resultCode, data);\r\n    \t} else {\r\n    \t\tLog.d(\"GameEngineActivity\", \"handled IAB ActivityResult:\" + requestCode + \":\" + resultCode);\r\n    \t}\r\n    }\r\n \r\n    @Override\r\n    public void onConfigurationChanged(Configuration newConfig) {\r\n    \tsuper.onConfigurationChanged(newConfig);\r\n    }\r\n\r\n    /**\r\n     * handle device keys\r\n     */\r\n    @Override\r\n    public boolean dispatchKeyEvent(KeyEvent event)\r\n    {\r\n        if( event.getAction()==KeyEvent.ACTION_DOWN )\r\n        {\r\n            switch( event.getKeyCode() )\r\n            {\r\n            case KeyEvent.KEYCODE_BACK:\r\n            \tPFInterface.getInstance().inputDeviceKey(PFInterface.DeviceKeyMap.BACK, PFInterface.DeviceKeyEvent.CLICK);\r\n            \t// suppress finishing Activity\r\n                return true;\r\n\r\n            case KeyEvent.KEYCODE_MENU:\r\n            \tPFInterface.getInstance().inputDeviceKey(PFInterface.DeviceKeyMap.MENU, PFInterface.DeviceKeyEvent.CLICK);\r\n            \t// suppress finishing Activity\r\n                return true;\r\n            }\r\n        }\r\n        return super.dispatchKeyEvent(event);\r\n    }\r\n \r\n    // assets 以下の指定されたzipファイルをローカルにコピーする。\r\n    private boolean unzipAssets(String targetPath, String externalPath, String zipfile) {\r\n    \ttry {\r\n    \t\tAssetManager assetManager = getResources().getAssets();\r\n    \t\t// 現在 assets に置かれている .zip が、展開済みのバージョンと同じものであるかを確認する。\r\n    \t\t\r\n    \t\t// assets フォルダにあるversionファイルを読み込む\r\n    \t\tInputStream verStream = assetManager.open(\"version\");\r\n    \t\tReader r = new InputStreamReader(verStream);\r\n    \t\tBufferedReader br = new BufferedReader(r);\r\n    \t\tString verLine = br.readLine();\r\n    \t\tbr.close();\r\n    \t\tr.close();\r\n    \t\tverStream.close();\r\n    \t\t\r\n    \t\t// SharedPreferences に登録されているキー \"[assets]version\" の値が、現在展開済みのバージョン\r\n    \t\tSharedPreferences pref = getPreferences(Context.MODE_PRIVATE);\r\n    \t\tString ret = pref.getString(VERSION_KEY, \"\");\r\n    \t\t\r\n    \t\t// 展開済みバージョンと、versionファイルの内容を比較して、同じであれば展開済みとする。\r\n    \t\tif(ret.equals(verLine)) return true;\r\n    \t\t\r\n    \t\t// 展開済みのものと異なる場合は再展開する。\r\n    \t\t// 一旦ディレクトリ内容を削除する。\r\n    \t\tRuntime localRuntime = Runtime.getRuntime();\r\n    \t\tString cmd = \"rm -R \" + targetPath + \"/*\";\r\n    \t\ttry {\r\n    \t\t\tlocalRuntime.exec(cmd);\r\n    \t\t} catch(IOException ex) {\r\n    \t\t\treturn false;\r\n    \t\t}\r\n    \t\t\r\n    \t\t// externalフォルダが無ければ生成\r\n        \tFile externaldir = new File(externalPath);\r\n    \t\tif(!externaldir.exists()) externaldir.mkdir();\t// ディレクトリが無ければ生成\r\n    \t\t\r\n    \t\t// ディレクトリ作成\r\n    \t\tFile dir = new File(targetPath);\r\n    \t\tif(!dir.exists()) dir.mkdir();\t// ディレクトリが無ければ生成\r\n\r\n    \t\tInputStream inputStream = assetManager.open(zipfile);\r\n    \t\tZipInputStream zipInputStream = new ZipInputStream(inputStream);\r\n    \t\tZipEntry zipEntry = zipInputStream.getNextEntry();\r\n    \t\twhile(zipEntry != null) {\r\n    \t\t\tString entryName = zipEntry.getName();\r\n    \t\t\tint n;\r\n    \t\t\tString outpath = targetPath + entryName;\r\n    \t\t//\tLog.d(\"Cpp\", \"OutPath:\" + outpath);\r\n    \t\t\t// ディレクトリであれば、そのディレクトリを作成して次へ\r\n    \t\t\tif(zipEntry.isDirectory()) {\r\n    \t\t\t\tFile underDir = new File(outpath);\r\n    \t\t\t\tif(!underDir.exists()) underDir.mkdirs();\r\n    \t\t\t\tzipInputStream.closeEntry();\r\n    \t\t\t\tzipEntry = zipInputStream.getNextEntry();\r\n    \t\t\t\tcontinue;\r\n    \t\t\t}\r\n    \t\t\t// 親ディレクトリが無い場合は作成\r\n    \t\t\tFile file = new File(outpath);\r\n    \t\t\tFile underDir = file.getParentFile();\r\n    \t\t\tif(!underDir.exists()) {\r\n    \t\t\t\tunderDir.mkdirs();\r\n    \t\t\t}\r\n    \t\t\t// FileOutputStream fileOutputStream = openFileOutput(outpath, MODE_WORLD_READABLE);\r\n    \t\t\tFileOutputStream fileOutputStream = new FileOutputStream(outpath);\r\n\t\t\t\tint DEFAULT_BUFSIZ = 1024 * 4;\r\n\t\t\t\tbyte [] buf = new byte [ DEFAULT_BUFSIZ ];\r\n\t\t\t\twhile((n = zipInputStream.read(buf, 0, DEFAULT_BUFSIZ)) > -1) {\r\n\t\t\t\t\tfileOutputStream.write(buf, 0, n);\r\n\t\t\t\t}\r\n\t\t\t\tfileOutputStream.close();\r\n\t\t\t\tzipInputStream.closeEntry();\r\n\t\t\t\tzipEntry = zipInputStream.getNextEntry();\r\n    \t\t}\r\n    \t\tzipInputStream.close();\r\n    \t\t\r\n    \t\t// 展開が完了したので、現在のversionの内容をSharedPreferencesに記録する。\r\n    \t\tSharedPreferences.Editor e = pref.edit();\r\n    \t\te.putString(VERSION_KEY, verLine);\r\n    \t\te.commit();\r\n\r\n    \t\treturn true;\r\n    \t} catch(IOException ex) {\r\n    \t\treturn false;\r\n    \t}\r\n    }\r\n\r\n    public boolean putControl(View view, int x, int y, int width, int height) {\r\n    \tif(width == 0 || height == 0) return false;\r\n    \tViewGroup.LayoutParams param = new ViewGroup.LayoutParams(width, height);\r\n    \tm_layout.addView(view, param);\r\n    \treturn true;\r\n    }\r\n    \r\n    public boolean replaceView(View view, int x, int y, int width, int height) {\r\n    \tm_layout.removeView(view);\r\n    \treturn putControl(view, x, y, width, height);\r\n    \t// return true;\r\n    }\r\n    \r\n    public void removeView(View view) {\r\n    \tm_layout.removeView(view);\r\n    }\r\n    \r\n    public void queryRegID(String SenderID) {\r\n    \tif(SenderID == null) return;\r\n  \r\n    \t// GCMの RegistrationId を取得\r\n        GCMRegistrar.checkDevice(getApplicationContext());\r\n        GCMRegistrar.checkManifest(getApplicationContext());\r\n        String regId = GCMRegistrar.getRegistrationId(getApplicationContext());\r\n        if(regId.equals(\"\")) {\r\n        \tGCMRegistrar.register(getApplicationContext(), SenderID);\r\n        } else {\r\n        \tPFInterface.getInstance().setRegistrationID(regId);\r\n        \tLog.v(\"Cpp\", \"Already registered.\");\r\n        }\r\n    }\r\n    \r\n    /*!\r\n     * @brief\tAssetsManager取得\r\n     */\r\n    public static AssetManager GetAssetManager()\r\n    {\r\n    \treturn mAssetMgr;\r\n    }\r\n    \r\n    // 別スレッドでのインストール\r\n    private class CInstall implements Runnable {\r\n    \t@Override\r\n\t\tpublic void run()\r\n    \t{\r\n    \t\tunzipAssets(c_path_install, c_path_external, \"AppAssets.zip\");\r\n    \t\thandler.sendEmptyMessage(0);\r\n    \t}\r\n    }\r\n    \r\n    // インストール終了時処理\r\n    private static class InstallationPostProcessHandler extends Handler {\r\n        private final WeakReference<GameEngineActivity> mActivity;\r\n        public InstallationPostProcessHandler(GameEngineActivity activity) {\r\n            mActivity = new WeakReference<GameEngineActivity>(activity);\r\n        }\r\n\r\n        @Override\r\n        public void handleMessage(Message msg) {\r\n            final GameEngineActivity self = mActivity.get();\r\n            if (self == null) {\r\n                return;\r\n            }\r\n            self.m_layout.removeView(self.m_InstallProgressView);\r\n            self.m_InstallProgressView = null;\r\n            self.m_installEnd = true;\r\n            Log.v(\"Cpp\", \"InstallEnd\");\r\n        }\r\n    }\r\n\r\n    private Handler handler = new InstallationPostProcessHandler(this);\r\n    \r\n    public boolean IsInstallEnd() {\r\n    \treturn m_installEnd;\r\n    }\r\n\r\n    boolean isMannerModeOn = false;\r\n    boolean isWearingHeadset = false;\r\n\r\n    /**\r\n     * update volume using device's manner mode settings and head-set plug status\r\n     */\r\n    public void setMannerMode()\r\n    {\r\n    \tAudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);\r\n\t\tint mediaVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);\r\n\t\tint mode = audioManager.getRingerMode();\r\n\t\tboolean bManner = (mode == AudioManager.RINGER_MODE_SILENT || mode == AudioManager.RINGER_MODE_VIBRATE);\r\n\r\n\t\tif (isMannerModeOn == bManner && isWearingHeadset == headsetEquipped) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif (!isMannerModeOn && bManner) {\r\n\t\t\t// manner mode turned on\r\n\t\t\tif (!isWearingHeadset && headsetEquipped) {\r\n\t\t\t\t// head-set on\r\n\t\t\t\tm_mediaVolume = DEFAULT_VOLUME;\r\n\t\t\t}\r\n\t\t\telse if (isWearingHeadset && headsetEquipped) {\r\n\t\t\t\t// head-set kept on\r\n\t\t\t\tm_mediaVolume = mediaVolume;\r\n\t\t\t}\r\n\t\t\telse if ((!isWearingHeadset && !headsetEquipped) || (isWearingHeadset && !headsetEquipped)) {\r\n\t\t\t\t// head-set kept off or turned off\r\n\t\t\t\tm_mediaVolume = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (isMannerModeOn && !bManner) {\r\n\t\t\t// manner mode turned off\r\n\t\t\tif (!isWearingHeadset && headsetEquipped) {\r\n\t\t\t\t// head-set turned on\r\n\t\t\t\tm_mediaVolume = DEFAULT_VOLUME;\r\n\t\t\t}\r\n\t\t\telse if (isWearingHeadset == headsetEquipped) {\r\n\t\t\t\t// head-set kept (on or off)\r\n\t\t\t\tm_mediaVolume = mediaVolume;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// head-set turned off\r\n\t\t\t\t// this setting could be dependent on game policy\r\n\t\t\t\tm_mediaVolume = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (isMannerModeOn) {\r\n\t\t\t\t// manner mode kept on\r\n\t\t\t\tif (!isWearingHeadset && headsetEquipped) {\r\n\t\t\t\t\t// head-set turned on\r\n\t\t\t\t\tm_mediaVolume = DEFAULT_VOLUME;\r\n\t\t\t\t}\r\n\t\t\t\telse if (isWearingHeadset == headsetEquipped) {\r\n\t\t\t\t\t// head-set kept (on or off)\r\n\t\t\t\t\tm_mediaVolume = mediaVolume;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// head-set turned off\r\n\t\t\t\t\tm_mediaVolume = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (!isMannerModeOn) {\r\n\t\t\t\t// manner mode kept still off\r\n\t\t\t\tif (!isWearingHeadset && headsetEquipped) {\r\n\t\t\t\t\t// head-set turned on\r\n\t\t\t\t\tm_mediaVolume = DEFAULT_VOLUME;\r\n\t\t\t\t}\r\n\t\t\t\telse if (isWearingHeadset == headsetEquipped) {\r\n\t\t\t\t\t// head-set kept (on or off)\r\n\t\t\t\t\tm_mediaVolume = mediaVolume;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// head-set turned off\r\n\t\t\t\t\tm_mediaVolume = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (m_mediaVolume != mediaVolume) {\r\n\t\t\taudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, m_mediaVolume, 0);\r\n\t\t}\r\n\t\tisMannerModeOn = bManner;\r\n\t\tisWearingHeadset = headsetEquipped;\r\n    }\r\n    \r\n    //! イヤホン状態をチェック\r\n  \tpublic void instanciateEarphoneChecker() {\r\n  \t\theadsetReceiver = new BroadcastReceiver() {\r\n  \t\t\t@Override\r\n  \t\t    public void onReceive(Context context, Intent intent) {\r\n  \t\t        if (intent.getAction().equalsIgnoreCase(Intent.ACTION_HEADSET_PLUG)) {\r\n  \t\t            headsetEquipped = (intent.getIntExtra(\"state\", 0) == 1);\r\n  \t\t            \r\n  \t\t            // マナーモードチェック\r\n  \t\t            setMannerMode();\r\n  \t\t        }\r\n  \t\t    }\r\n  \t\t};\r\n  \t}\r\n  \t\r\n  \t//! イヤホンのレシーバーを登録\r\n  \tprivate void registerHeadsetReceiver()\r\n  \t{\r\n  \t\tif( headsetReceiver != null ) {\r\n  \t\t\tthis.registerReceiver(headsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));\r\n  \t\t}\r\n  \t}\r\n  \t\r\n  \t//! イヤホンのレシーバーを解除\r\n  \tprivate void unregisterHeadsetReceiver()\r\n  \t{\r\n  \t\tif( headsetReceiver != null ) {\r\n  \t\t\tunregisterReceiver(headsetReceiver);\r\n  \t\t}\r\n  \t}\r\n\r\n\t// メーラー起動\r\n    public void startExternalApplicationMail(String addr , String subject , String body)\r\n    {\r\n    \tIntent intent = new Intent(Intent.ACTION_SENDTO);\r\n    \tintent.setData(Uri.parse(\"mailto:\"+addr));\r\n    \tintent.putExtra(Intent.EXTRA_SUBJECT, subject);\r\n    \tintent.putExtra(Intent.EXTRA_TEXT, body);\r\n\t\ttry {\r\n\t\t\tsuper.startActivity(intent);\r\n\t\t} catch (ActivityNotFoundException e) {\r\n\t\t\tstartAlertDialog( \"Alert\" , \"メーラーを有効にして下さい\" );\r\n\t\t}\r\n    }\r\n    // アラートダイアログ起動\r\n    public void startAlertDialog( String title , String message )\r\n    {\r\n    \tm_alertTitle = title;\r\n    \tm_alertMessage = message;\r\n\t\trunOnUiThread(new Runnable() {\r\n            @Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\t\t//^^^^^\r\n            \t\t//Context context = getApplicationContext();\r\n                    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(GameEngineActivity.this);\r\n                    // アラートダイアログのタイトルを設定します\r\n                    alertDialogBuilder.setTitle( m_alertTitle );\r\n                    // アラートダイアログのメッセージを設定します\r\n                    alertDialogBuilder.setMessage( m_alertMessage );\r\n                    // アラートダイアログの肯定ボタンがクリックされた時に呼び出されるコールバックリスナーを登録します\r\n                    alertDialogBuilder.setPositiveButton(\"OK\",\r\n                            new DialogInterface.OnClickListener() {\r\n                                @Override\r\n                                public void onClick(DialogInterface dialog, int which) {\r\n                                }\r\n                            });       \r\n                    // アラートダイアログのキャンセルが可能かどうかを設定します\r\n                    alertDialogBuilder.setCancelable(false);\r\n                    AlertDialog alertDialog = alertDialogBuilder.create();\r\n                    // アラートダイアログを表示します\r\n                    alertDialog.show();\r\n            }\r\n        });        \t\t    \t\r\n    }\r\n    \r\n    // ブラウザ起動\r\n    public void startBrowser( String url )\r\n    {\r\n        Uri uri = Uri.parse(url);\r\n    \tIntent i = new Intent(Intent.ACTION_VIEW,uri);\r\n    \tstartActivity(i);\r\n    }\r\n\r\n\tpublic boolean IsUsePause()\r\n    {\r\n    \treturn m_UsePause;\r\n    }\r\n    public void SetUsePause(boolean bUsePause)\r\n    {\r\n    \tm_UsePause = bUsePause;\r\n    }\r\n\r\n\tpublic void forbidSleep(final boolean isForbidden) {\r\n\t\trunOnUiThread(new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tif (isForbidden) {\r\n\t\t\t\t\tgetWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tgetWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/GameEngineApplication.java",
    "content": "package klb.android.GameEngine;\n\nimport android.app.Application;\nimport klb.android.GameEngine.prngfix.PRNGFixes;\n\npublic class GameEngineApplication extends Application {\n\n    @Override\n    public void onCreate() {\n        super.onCreate();\n\n        PRNGFixes.apply();\n    }\n\n}\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/GameGLSurfaceView.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport klb.android.GameEngine.GameEngineActivity;\r\n//import android.content.Context;\r\nimport android.opengl.GLSurfaceView;\r\nimport android.view.MotionEvent;\r\n\r\npublic class GameGLSurfaceView extends GLSurfaceView {\r\n\tstatic final int TOUCH_MAX = 10;\r\n\tGLES20GameRenderer mRenderer;\r\n\tprivate int [] touch_id = new int [TOUCH_MAX];\r\n\tprivate int [] touch_x = new int [TOUCH_MAX];\r\n\tprivate int [] touch_y = new int [TOUCH_MAX];\r\n\tprivate int touch_alloc_cursor = 0;\r\n\tprivate GameEngineActivity context;\r\n\r\n    public GameGLSurfaceView(GameEngineActivity context, String path) {\r\n    \tsuper(context);\r\n    \tthis.context = context;\r\n        for(int i = 0; i < TOUCH_MAX; i++) touch_id[i] = -1;\r\n        PFInterface pfif = PFInterface.getInstance();\r\n        int glver = pfif.getGLVersion();\t// nativeがビルド対象としているGLのバージョンを取得\r\n        setEGLContextClientVersion(glver);\r\n        // setEGLContextClientVersion(1);\t// use OpenGL ES 1.1\r\n        // setEGLContextClientVersion(2);\t// use OpenGL ES 2.0\r\n        mRenderer = new GLES20GameRenderer(context, path);\r\n        setRenderer(mRenderer);\r\n    }\r\n    \r\n    public void onRestart()\r\n    {\r\n\t\tTouchClear();\r\n    \t// mRenderer.onRestart();\r\n    \tmRenderer.resetPreTime();\r\n    }\r\n    \r\n    @Override\r\n\tpublic void onPause()\r\n    {\r\n\t\tTouchClear();\r\n    \tPFInterface pfif = PFInterface.getInstance();\r\n    \tpfif.onActivityPause();\r\n    \t\r\n    \tmRenderer.resetPreTime();\r\n    }\r\n    \r\n    @Override\r\n\tpublic void onResume()\r\n    {\r\n\t\tTouchClear();\r\n    \tPFInterface pfif = PFInterface.getInstance();\r\n    \tpfif.onActivityResume();\r\n    \t\r\n    \tmRenderer.resetPreTime();\r\n    }\r\n    \r\n    @Override\r\n\tpublic boolean onTouchEvent(MotionEvent ev) {\r\n    \tPFInterface pfif = PFInterface.getInstance();\r\n        \r\n        // データコピー処理時のインジケータを表示するため、かなり無理めな実装となり、\r\n    \t// PFInterface.getInstance().callInit(m_Width, m_Height, FILE_PATH);\r\n    \t// が呼ばれるのがデータ終了後となっているため下記処理追加  2013/05/09  \r\n        if(pfif.IsInstallEnd() == false) return true;\r\n  \r\n        float x;\r\n        float y;\r\n\r\n        switch(ev.getActionMasked())\r\n        {\r\n        default:\r\n        \t\r\n        \tbreak;\r\n        case MotionEvent.ACTION_DOWN:\r\n        {\r\n        \t// 同時押しなら、押された分全てを送る\r\n        \tint count = ev.getPointerCount();\r\n        \tfor(int i = 0; i < count; i++) {\r\n        \t\tint id = -1;\r\n        \t\tfor(int j = 0; j < TOUCH_MAX; j++) {\r\n        \t\t\tint cursor = (touch_alloc_cursor + j) % TOUCH_MAX;\r\n        \t\t\tif(touch_id[cursor] < 0) {\r\n        \t\t\t\tid = cursor;\r\n        \t\t\t\ttouch_alloc_cursor = (cursor + 1) % TOUCH_MAX;\r\n        \t\t\t\tbreak;\r\n        \t\t\t}\r\n        \t\t}\r\n        \t\tif(id < 0) break;\t// idが割り当てられない\r\n        \t\ttouch_id[id] = ev.getPointerId(i);\r\n        \t\tx = ev.getX(i);\r\n        \t\ty = ev.getY(i);\r\n        \t\ttouch_x[id] = (int)x;\r\n        \t\ttouch_y[id] = (int)y;\r\n        \t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_CLICK, (int)x, (int)y);\r\n        \t}\r\n        }\r\n        break;\r\n        case MotionEvent.ACTION_POINTER_DOWN:\r\n        {\r\n        \t// 変化のあった pointer についてのみ送る\r\n            int index = ev.getActionIndex();\r\n       \t\tint jid = ev.getPointerId(index);\r\n       \t\tint id = -1;\r\n        \tfor(int j = 0; j < TOUCH_MAX; j++) {\r\n                int cursor = (touch_alloc_cursor + j) % TOUCH_MAX;\r\n       \t\t\tif(touch_id[cursor] < 0) {\t// 最初に見つけたブランク候補\r\n       \t\t\t\tid = cursor;\r\n        \t\t\ttouch_alloc_cursor = (cursor + 1) % TOUCH_MAX;\r\n       \t\t\t\tbreak;\r\n       \t\t\t}\r\n       \t\t}\r\n       \t\tif(id < 0) break;\t// idが割り当てられない\r\n       \t\ttouch_id[id] = jid;\r\n       \t\tx = ev.getX(index);\r\n       \t\ty = ev.getY(index);\r\n       \t\ttouch_x[id] = (int)x;\r\n       \t\ttouch_y[id] = (int)y;\r\n       \t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_CLICK, (int)x, (int)y);\r\n        }\r\n        break;\r\n        case MotionEvent.ACTION_MOVE:\r\n        {\r\n        \t// 同時押しなら、押された分全てを送る\r\n        \tint count = ev.getPointerCount();\r\n        \tfor(int i = 0; i < count; i++) {\r\n        \t\tint jid = ev.getPointerId(i);\r\n        \t\tint id = -1;\r\n        \t\tfor(int j = 0; j < TOUCH_MAX; j++) {\r\n        \t\t\tif(jid == touch_id[j]) {\r\n        \t\t\t\tid = j;\r\n        \t\t\t\tbreak;\r\n        \t\t\t}\r\n        \t\t}\r\n        \t\tif(id < 0) break;\t// 該当するIDのタッチが見つからなかった\r\n        \t\tx = ev.getX(i);\r\n        \t\ty = ev.getY(i);\r\n        \t\tif((int)x != touch_x[id] || (int)y != touch_y[id]) {\r\n        \t\t\t// move はポインタが動いた場合のみ通知する\r\n        \t\t\ttouch_x[id] = (int)x;\r\n        \t\t\ttouch_y[id] = (int)y;\r\n        \t\t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_DRAG, (int)x, (int)y);\r\n        \t\t}\r\n        \t}\r\n        }\r\n        break;\r\n        case MotionEvent.ACTION_POINTER_UP:\r\n        {\r\n            int index = ev.getActionIndex();\r\n        \tint jid = ev.getPointerId(index);\r\n        \tint id = -1;\r\n    \t\tfor(int j = 0; j < TOUCH_MAX; j++) {\r\n    \t\t\tif(jid == touch_id[j]) {\r\n    \t\t\t\tid = j;\r\n    \t\t\t\tbreak;\r\n    \t\t\t}\r\n    \t\t}\r\n    \t\tif(id < 0) break;\t// 該当するIDのタッチが見つからなかった\r\n    \t\tx = ev.getX(index);\r\n    \t\ty = ev.getY(index);\r\n    \t\ttouch_id[id] = -1;\r\n    \t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_RELEASE, (int)x, (int)y);\r\n        }\r\n        break;\r\n        case MotionEvent.ACTION_UP:\r\n        {\r\n        \tint count = ev.getPointerCount();\r\n        \tfor(int i = 0; i < count; i++) {\r\n        \t\tint jid = ev.getPointerId(i);\r\n        \t\tint id = -1;\r\n        \t\tfor(int j = 0; j < TOUCH_MAX; j++) {\r\n        \t\t\tif(jid == touch_id[j]) {\r\n        \t\t\t\tid = j;\r\n        \t\t\t\tbreak;\r\n        \t\t\t}\r\n        \t\t}\r\n        \t\tif(id < 0) break;\t// 該当するIDのタッチが見つからなかった\r\n        \t\tx = ev.getX(i);\r\n        \t\ty = ev.getY(i);\r\n        \t\ttouch_id[id] = -1;\r\n        \t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_RELEASE, (int)x, (int)y);\r\n        \t}\r\n        }\r\n        break;\r\n        case MotionEvent.ACTION_CANCEL:\r\n        {\r\n        \tint count = ev.getPointerCount();\r\n        \tfor(int i = 0; i < count; i++) {\r\n        \t\tint jid = ev.getPointerId(i);\r\n        \t\tint id = -1;\r\n        \t\tfor(int j = 0; j < TOUCH_MAX; j++) {\r\n        \t\t\tif(jid == touch_id[j]) {\r\n        \t\t\t\tid = j;\r\n        \t\t\t\tbreak;\r\n        \t\t\t}\r\n        \t\t}\r\n        \t\tif(id < 0) break;\t// 該当するIDのタッチが見つからなかった\r\n        \t\tx = ev.getX(i);\r\n        \t\ty = ev.getY(i);\r\n        \t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_RELEASE, (int)x, (int)y);\t// release\r\n        \t}\r\n        }\r\n        break;\r\n    \t}\r\n        context.refreshSystemUi();\r\n    \treturn true; // super.onTouchEvent(ev);\r\n    }\r\n\t\r\n\tprivate void TouchClear()\r\n\t{\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tfor( int i=0 ; i<TOUCH_MAX ; i++ )\r\n\t\t{\r\n\t\t\tint id = touch_id[i];\r\n\t\t\tif(id >= 0) {\r\n\t\t\t\tpfif.inputPoint(id, PFInterface.E_INPUT_TYPE_RELEASE, touch_x[id], touch_y[id]);\t// release\r\n\t\t\t}\r\n\t\t\ttouch_id[i] = -1;\r\n\t\t\ttouch_x[i] = touch_y[i] = 0;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/IndicaterItem.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport klb.android.GameEngine.GameEngineActivity;\r\nimport android.view.Gravity;\r\nimport android.view.View;\r\nimport android.widget.FrameLayout;\r\n\r\nclass IndicatorItem\r\n{\r\n\tprivate FrameLayout m_layout = null;\r\n\tprivate FrameLayout.LayoutParams m_params = null;\r\n\tprivate int m_x;\r\n\tprivate int m_y;\r\n\tprivate int m_width;\r\n\tprivate int m_height;\r\n\tprivate GameEngineActivity m_context = null;\r\n\tpublic boolean m_created;\r\n\tpublic boolean m_update;\r\n\tpublic boolean m_remove;\r\n\tpublic boolean m_reload;\r\n\tpublic boolean m_visible = true;\r\n\tpublic boolean m_enabled = true;\r\n\tpublic boolean m_background = false;\r\n\tprivate int [] cmdqueue = new int [50];\r\n\tprivate int cmd_count = 0;\r\n\r\n    private View m_IndicatorView = null;\r\n\r\n\t// constructor はGLスレッドから呼ばれる\r\n\tpublic IndicatorItem( GameEngineActivity context,int x, int y, int width, int height, boolean background)\r\n\t{\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_context = context;\r\n\t\tm_background = background;\r\n\t\tm_created = false;\r\n\t\tm_update = false;\r\n\t\tm_remove = false;\r\n\t\tm_reload = true;\r\n\r\n        /*\r\n          幅と高さはdefault値を入れておく(適当に100にしておきます)\r\n          小さくは出来るが、大きくは限界がある\r\n          xmlで用意されている大きさが最大でそれ以上は大きく出来ない\r\n        */\r\n        m_width = m_height = 80;\r\n\t}\r\n\t\r\n\t// 値の設定もGLスレッドから呼ばれる\r\n\tpublic void move(int x, int y, int width, int height) {\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_update = true;\r\n\t}\r\n\t\t\t\r\n\tprivate void setStatus()\r\n\t{\r\n        if( m_context==null ) return;\r\n        if( m_context.m_IndicatorLayout==null ) return;\r\n\r\n\t\tif(m_visible) {\r\n\t\t\tm_context.m_IndicatorLayout.setVisibility(View.VISIBLE);\r\n\t\t} else {\r\n\t\t\tm_context.m_IndicatorLayout.setVisibility(View.INVISIBLE);\r\n\t\t}\r\n\t}\r\n\t// 以下はメインスレッドから呼ばれる(Runnable経由)\r\n\tpublic void create()\r\n\t{\r\n\t\tif(m_created) return;\r\n\r\n        m_IndicatorView = m_context.getLayoutInflater().inflate(R.layout.indicator, null);\r\n        \r\n\t\tif(m_background)\r\n\t\t{\r\n\t        m_params = new FrameLayout.LayoutParams(m_width,m_height);\r\n\t        m_params.gravity = Gravity.LEFT|Gravity.TOP;\r\n\t        m_params.setMargins(m_x, m_y, m_x+m_width, m_y+m_height);\t\r\n\t\t\tm_context.m_IndicatorLayout.addView(m_IndicatorView,m_params);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tm_layout = new FrameLayout(m_context);\r\n\t\t\tm_params = new FrameLayout.LayoutParams(m_width, m_height);\r\n\t\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\t\tm_layout.addView(m_IndicatorView, m_params);\r\n\t\t\tm_context.putControl(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\t}\r\n\r\n        setVisible( true );\r\n\r\n\t\tsetStatus();\r\n\t\tm_reload = false;\r\n\t\tm_created = true;\r\n\t}\r\n\t\r\n\tpublic void update()\r\n    {\r\n        if( m_context==null ) return;\r\n        if( m_context.m_IndicatorLayout==null ) return;\r\n\r\n\t\tif( m_update )\r\n        {\r\n\t\t\tif(!m_background)\r\n\t\t\t{\r\n\t\t\t\tif( m_layout!=null )\r\n\t\t\t\t{\r\n\t\t\t\t\tm_layout.removeView(m_IndicatorView);\r\n\t\t\t\t\tm_params.width = m_width;\r\n\t\t\t\t\tm_params.height = m_height;\r\n\t\t\t\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\t\t\t\tm_layout.addView(m_IndicatorView, m_params);\r\n\t\t\t\t\tm_context.replaceView(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsetStatus();\r\n\t\t}\r\n\t\tif( cmd_count > 0 ) cmdQueue();\r\n\t\tm_update = false;\r\n\t}\r\n\t\r\n\tpublic boolean remove()\r\n    {\r\n\t\tif(!m_remove) return false;\r\n\t\tif(null != m_IndicatorView)\r\n\t\t{\r\n\t\t\tif(m_background) {\r\n\t\t\t\tm_context.m_IndicatorLayout.removeView(m_IndicatorView);\r\n\t\t\t} else {\r\n\t\t\t\tm_layout.removeView(m_IndicatorView);\r\n\t\t\t\tm_context.removeView(m_layout);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tpublic void cmd(int cmd)\r\n    {\r\n\t\tcmdqueue[cmd_count++] = cmd;\r\n\t}\r\n\tpublic void cmdQueue()\r\n    {\r\n\t\tif( cmd_count == 0) return;\r\n\t\tfor(int i = 0; i < cmd_count; i++)\r\n        {\r\n\t\t\tcmdProc(cmdqueue[i]);\r\n\t\t}\r\n\t\tcmd_count = 0;\r\n\t}\r\n\tpublic void cmdProc(int cmd)\r\n    {\r\n\t\tswitch(cmd)\r\n        {\r\n\t\tcase 0:\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n/*\r\n\tpublic boolean isFinish() {\r\n\t\tif(null == m_indicater_view) return false;\r\n\t\treturn m_indicater_view.isFinish();\r\n\t}\r\n*/\r\n\t\r\n\tpublic void setVisible(boolean visible)\r\n    {\r\n\t\tm_update = true;\r\n\t\tm_visible = visible;\r\n\t}\r\n\r\n\tpublic void setEnable(boolean enabled)\r\n    {\r\n\t\tm_update = true;\r\n\t\tm_enabled = enabled;\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/MovieView.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\n\r\nimport android.content.Context;\r\nimport android.media.MediaPlayer;\r\nimport android.view.SurfaceView;\r\nimport android.view.SurfaceHolder;\r\n\r\nclass MovieView extends SurfaceView\r\n\timplements SurfaceHolder.Callback, MediaPlayer.OnCompletionListener {\r\n\tprivate int m_index;\r\n\tprivate MediaPlayer mp = null;\r\n\tprivate String mPath = null;\r\n\tprivate boolean playing = false;\r\n\tprivate boolean pause = false;\r\n\tprivate boolean finished = false;\r\n\tprivate boolean m_bWaitPlayerCreated = false;\r\n    private int m_current = 0;  // 2013.1.29  途中からの再生に対応\r\n\t\r\n\tpublic MovieView(Context context, int index) {\r\n\t\tsuper(context);\r\n\t\tm_index = index;\r\n\t\tsetZOrderOnTop(true);\t// GLSurfaceView より手前に表示しなければならないため。\r\n\t\tSurfaceHolder holder = getHolder();\r\n\t\tholder.addCallback(this);\r\n\t\tholder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {\r\n\t\t\r\n\t}\r\n\r\n\tpublic boolean setMoviePath(String path) {\r\n\t\ttry {\r\n\t\t\tif(mp != null) {\r\n\t\t\t\tFileInputStream fis = null;\r\n\t\t\t\tfis = new FileInputStream(path);\r\n\t\t\t\tif( fis != null ) \r\n\t\t\t\t{\r\n\t\t\t\t\tmp.setDataSource(fis.getFD());\r\n\t\t\t\t\tmp.prepare();\r\n\t\t\t\t\tfis = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tmPath = path;\r\n\t\t\treturn true;\r\n\t\t} catch(IllegalArgumentException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn false;\r\n\t\t} catch(IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic boolean start() {\r\n\t\tif( mp != null )\r\n\t\t{\r\n\t\t\t// 既に再生中の場合は再生位置を先頭に戻す\r\n\t\t\tif( playing ) {\r\n\t\t\t\tmp.seekTo(m_current);  // 2013.1.29  途中からの再生に対応\r\n\t\t\t}\r\n\t\t\tmp.start();\r\n\t\t\tplaying = true;\r\n\t\t\tfinished = false;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// まだMediaPlayerが作成されていないので作成待ちフラグをあげる\r\n\t\t\tm_bWaitPlayerCreated = true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tpublic boolean stop() {\r\n\t\tif( mp != null && playing == true )\r\n\t\t{\r\n\t\t\tmp.stop();\r\n\t\t\tplaying = false;\r\n\t\t\tpause = false;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tpublic boolean pause() {\t\t\r\n\t\tif( playing == true && pause == false) \r\n\t\t{\r\n\t\t\tif(mp != null) mp.pause();\r\n\t\t\tpause = true;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tpublic boolean resume() {\r\n\t\tif( mp != null && playing == true && pause == true )\r\n\t\t{\r\n\t\t\tmp.start();\r\n\t\t\tpause = false;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) {\r\n\t\ttry {\r\n            if( mp==null )\r\n            {\r\n                mp = new MediaPlayer();\r\n                mp.setDisplay(holder);\r\n                mp.setOnCompletionListener(this);\r\n                if(mPath != null) {\r\n                    setMoviePath(mPath);\r\n                }\r\n                if( m_bWaitPlayerCreated )\r\n                {\r\n                    start();\r\n                    m_bWaitPlayerCreated = false;\r\n\r\n                    if(pause) mp.pause();\r\n                }\r\n                else\r\n                {\r\n                    start();\r\n                }\r\n            }\r\n\t\t} catch(IllegalArgumentException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch(IllegalStateException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic boolean isFinish() { return finished; }\r\n\t\r\n\t// 終了時に呼ばれる\r\n\t@Override\r\n\tpublic void onCompletion(MediaPlayer mediaPlayer) {\r\n\t\tmp.pause();\r\n\t\tplaying = false;\r\n\t\tpause = false;\r\n\t\tfinished = true;\r\n\r\n\t\t// 終了をnative側に通知する\r\n\t\tPFInterface.getInstance().toNativeSignal(PFInterface.MOVIE_FINISHED, m_index);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void surfaceDestroyed(SurfaceHolder holder) {\r\n\t\tif(mp != null) {\r\n            m_current = mp.getCurrentPosition();\r\n\t\t\tmp.release();\r\n\t\t\tmp = null;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/MovieViewItem.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport klb.android.GameEngine.GameEngineActivity;\r\n// import klb.android.GameEngine.PFInterface;\r\nimport java.lang.String;\r\n\r\nimport android.view.Gravity;\r\nimport android.view.View;\r\nimport android.widget.FrameLayout;\r\n\r\nclass MovieViewItem\r\n{\r\n\tprivate FrameLayout m_layout = null;\r\n\tprivate FrameLayout.LayoutParams m_params = null;\r\n\tprivate MovieView m_video = null;\r\n\tprivate String m_url;\r\n\tprivate int m_index;\r\n\tprivate int m_x;\r\n\tprivate int m_y;\r\n\tprivate int m_width;\r\n\tprivate int m_height;\r\n\tprivate GameEngineActivity m_context = null;\r\n\tpublic boolean m_created;\r\n\tpublic boolean m_update;\r\n\tpublic boolean m_remove;\r\n\tpublic boolean m_reload;\r\n\tpublic boolean m_visible = true;\r\n\tpublic boolean m_enabled = true;\r\n\tpublic boolean m_background = false;\r\n\tprivate int [] cmdqueue = new int [50];\r\n\tprivate int cmd_count = 0;\r\n\r\n\t// constructor はGLスレッドから呼ばれる\r\n\tpublic MovieViewItem(int index, GameEngineActivity context, String url,\r\n\t\t\t\t\t\tint x, int y, int width, int height, boolean background) {\r\n\r\n\t\tm_index = index;\r\n\t\tm_url = url;\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_context = context;\r\n\t\tm_background = background;\r\n\t\tm_created = false;\r\n\t\tm_update = false;\r\n\t\tm_remove = false;\r\n\t\tm_reload = true;\r\n\t}\r\n\t\r\n\t// 値の設定もGLスレッドから呼ばれる\r\n\tpublic void move(int x, int y, int width, int height) {\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_update = true;\r\n\t}\r\n\t\r\n\t// 値の取得も主にGLスレッドから呼ばれる\r\n\tpublic String getText() {\r\n\t\treturn m_url;\r\n\t}\r\n\t\r\n\tpublic void setText(String text) {\r\n\t\tm_url = text;\r\n\t\tm_reload = true;\r\n\t}\r\n\t\t\r\n\tprivate void setStatus() {\r\n\t\tif(m_visible) {\r\n\t\t\tm_video.setEnabled(m_enabled);\r\n\t\t\tm_video.setVisibility(View.VISIBLE);\r\n\t\t} else {\r\n\t\t\tm_video.setEnabled(false);\r\n\t\t\tm_video.setVisibility(View.INVISIBLE);\r\n\t\t}\r\n\t}\r\n\t// 以下はメインスレッドから呼ばれる(Runnable経由)\r\n\tpublic void create() {\r\n\t\tif(m_created) return;\r\n\r\n\t\tm_video = new MovieView(m_context, m_index);\r\n\t\tif(m_background) {\r\n\t\t\tm_params = new FrameLayout.LayoutParams(m_width, m_height);\r\n\t\t\tm_params.gravity = Gravity.CENTER;\r\n\t\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\t\tm_context.m_MovieLayout.addView(m_video,m_params);\r\n\t\t} else {\r\n\t\t\tm_layout = new FrameLayout(m_context);\r\n\t\t\tm_params = new FrameLayout.LayoutParams(m_width, m_height);\r\n\t\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\t\tm_layout.addView(m_video, m_params);\r\n\t\t\tm_context.putControl(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\t}\r\n\t\tm_video.setMoviePath(m_url);\r\n\t\tsetStatus();\r\n\t\tm_reload = false;\r\n\t\tm_created = true;\r\n\t}\r\n\t\r\n\tpublic void update() {\r\n\t\tif(m_update && m_video != null) {\r\n\t\t\tif(!m_background) {\r\n\t\t\t\tm_layout.removeView(m_video);\r\n\t\t\t\tm_params.width = m_width;\r\n\t\t\t\tm_params.height = m_height;\r\n\t\t\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\t\t\tm_layout.addView(m_video, m_params);\r\n\t\t\t\tm_context.replaceView(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\t\t}\r\n\t\t\tsetStatus();\r\n\t\t\tif(m_reload) {\r\n\t\t\t\tif(null != m_video) {\r\n\t\t\t\t\tm_video.setMoviePath(m_url);\r\n\t\t\t\t\tm_reload = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(cmd_count > 0 && m_video != null) cmdQueue();\r\n\t\tm_update = false;\r\n\t}\r\n\t\r\n\tpublic boolean remove() {\r\n\t\tif(!m_remove) return false;\r\n\t\tif(null != m_video)\r\n\t\t{\r\n\t\t\tif(m_background) {\r\n\t\t\t\tm_context.m_MovieLayout.removeView(m_video);\r\n\t\t\t} else {\r\n\t\t\t\tm_layout.removeView(m_video);\r\n\t\t\t\tm_context.removeView(m_layout);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tpublic void cmd(int cmd) {\r\n\t\tcmdqueue[cmd_count++] = cmd;\r\n\t}\r\n\tpublic void cmdQueue() {\r\n\t\tif(m_video == null || cmd_count == 0) return;\r\n\t\tfor(int i = 0; i < cmd_count; i++) {\r\n\t\t\tcmdProc(cmdqueue[i]);\r\n\t\t}\r\n\t\tcmd_count = 0;\r\n\t}\r\n\tpublic void cmdProc(int cmd) {\r\n\t\tif(m_video == null) return;\r\n\t\tswitch(cmd) {\r\n\t\tcase 0:\t// stop\r\n\t\t\tm_video.stop();\r\n\t\t\tbreak;\r\n\t\tcase 1:\t// play\r\n\t\t\tm_video.start();\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\tm_video.pause();\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\tm_video.resume();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic boolean isFinish() {\r\n\t\tif(null == m_video) return false;\r\n\t\treturn m_video.isFinish();\r\n\t}\r\n\t\r\n\t\r\n\tpublic void setVisible(boolean visible) {\r\n\t\tm_update = true;\r\n\t\tm_visible = visible;\r\n\t}\r\n\r\n\tpublic void setEnable(boolean enabled) {\r\n\t\tm_update = true;\r\n\t\tm_enabled = enabled;\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/PFInterface.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n ¥brief C++実装部分とのインタフェースを採るプラットフォームモジュール\r\n ¥file PFInterface.java\r\n */\r\npackage klb.android.GameEngine;\r\n\r\nimport android.content.Context;\r\nimport klb.android.GameEngine.EditBoxItem;\r\nimport klb.android.GameEngine.GameEngineActivity;\r\nimport klb.android.GameEngine.MovieViewItem;\r\nimport klb.android.GameEngine.WebViewItem;\r\nimport klb.android.GameEngine.billing.manager.BillingManager;\r\n\r\nimport android.graphics.Paint;\r\nimport android.graphics.Canvas;\r\nimport android.graphics.Bitmap;\r\nimport android.os.Build;\r\nimport android.util.Log;\r\nimport android.view.Gravity;\r\nimport android.webkit.WebView;\r\nimport android.content.SharedPreferences;\r\nimport android.content.pm.PackageInfo;\r\nimport android.content.pm.PackageManager;\r\nimport android.content.pm.PackageManager.NameNotFoundException;\r\n\r\nimport java.lang.String;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.UUID;\r\nimport java.security.MessageDigest;\r\nimport java.security.NoSuchAlgorithmException;\r\nimport java.io.UnsupportedEncodingException;\r\n\r\nimport org.json.JSONArray;\r\nimport org.json.JSONException;\r\n\r\npublic class PFInterface {\r\n\tpublic static int MOVIE_FINISHED = 1;\r\n\t\r\n\t// エターナルスタティックファイナル ------- 順番を間違えると相手は死ぬ \r\n\tpublic static final int E_STORE_BAD_ITEMID = 0;         // アイテムIDが無効\r\n\tpublic static final int E_STORE_GET_PRODUCTS = 1; // ProductListの取得.\r\n\tpublic static final int E_STORE_PURCHASHING = 2;        // 購入処理中\r\n\tpublic static final int E_STORE_PURCHASHED = 3;         // 購入処理終了\r\n\tpublic static final int E_STORE_FAILED = 4;             // 購入処理失敗\r\n\tpublic static final int E_STORE_RESTORE = 5;            // リストア終了\r\n\tpublic static final int E_STORE_RESTORE_FAILED = 6;     // リストア失敗\r\n\tpublic static final int E_STORE_RESTORE_COMPLETED = 7;  // 全リストア終了\r\n\r\n    // エターナルスタティックファイナル ------- 順番を間違えると相手は死なないけど困る\r\n    // CPFInterface.h の IClientRequest 内に定義された enum INPUT_TYPE と対応するようにメンテナンスすること\r\n    public static final int E_INPUT_TYPE_CLICK   = 0; //!< マウスのクリック、タッチパネルのタップ動作\r\n    public static final int E_INPUT_TYPE_DRAG    = 1; //!< ドラッグ動作\r\n    public static final int E_INPUT_TYPE_RELEASE = 2; //!< リリース動作(離す)\r\n    public static final int E_INPUT_TYPE_CANCEL  = 3; //!< Cancel event\r\n\r\n\tpublic enum WEBVIEW_STATUS {\r\n\t\tE_DIDSTARTLOADWEB(0),\r\n\t\tE_DIDLOADENDWEB(1),\r\n\t\tE_FAILEDLOADWEB(2),\r\n\t\tE_URLJUMP(3);\r\n\t\t\r\n\t\tprivate int m_num;\r\n\t\tprivate WEBVIEW_STATUS(int _num) {\r\n\t\t\tm_num = _num;\r\n\t\t}\r\n\t\t\r\n\t\tpublic int GetNum() { return m_num; }\r\n\t}\r\n\t\r\n\tpublic class DeviceKeyMap {\r\n\t\tpublic static final int BACK = 0x00000001;\r\n\t\tpublic static final int MENU = 0x00000002;\r\n\t}\r\n\t\r\n\tpublic class DeviceKeyEvent {\r\n\t\tpublic static final char PRESS = 0x01;\r\n\t\tpublic static final char RELEASE = 0x02;\r\n\t\tpublic static final char CLICK = 0x03;\r\n\t}\r\n\t\r\n\t// Java の Singleton 流儀。\r\n\tprivate static PFInterface instance = new PFInterface();\t// インスタンス実体はこのメンバ\r\n\tprivate static String m_path_external = null;\r\n\tprivate static String m_path_install = null;\r\n\tprivate\tint\tm_width;\r\n\tprivate int m_height;\r\n\tprivate boolean m_bexec = false;\r\n\tprivate GameEngineActivity m_context = null;\r\n\tprivate String m_osversion = null;\r\n\tprivate String m_tzone = null;\r\n\tprivate int MAX_EDIT_TEXT = 100;\r\n\tprivate int MAX_WEB_VIEW = 100;\r\n\tprivate int MAX_MOVIE_VIEW = 50;\r\n\r\n\tprivate String m_senderId = null;\r\n\tprivate String m_registrationId = null;\r\n\r\n\tprivate EditBoxItem[] m_textList = new EditBoxItem [ MAX_EDIT_TEXT ];\t// TextBox の配列\r\n\tprivate int m_textListCount = -1;\r\n\r\n\tprivate WebViewItem[] m_webList = new WebViewItem [ MAX_WEB_VIEW ];\t\t// WebView の配列\r\n\tprivate int m_webListCount = -1;\r\n\t\r\n\tprivate MovieViewItem[] m_movieList = new MovieViewItem [ MAX_MOVIE_VIEW ];\r\n\tprivate int m_movieListCount = -1;\r\n\r\n\tprivate IndicatorItem m_indicator;\r\n\r\n\tprivate PFInterface() {}\r\n\r\n\t//! インスタンス取得メソッド\r\n\t/*!\r\n\t \\return 唯一のインスタンス\r\n\t Singleton 実装されたPFInstanceのインスタンスを取得する。\r\n\t */\r\n\tpublic static PFInterface getInstance() {\r\n\t\treturn instance;\r\n\t}\r\n\t\r\n\tpublic void setSenderID(String senderId) {\r\n\t\tm_senderId = senderId;\r\n\t}\r\n\t\r\n\tpublic String getSenderID() {\r\n\t\treturn m_senderId;\r\n\t}\r\n\t\r\n\tpublic void setRegistrationID(String regId) {\r\n\t\tm_registrationId = regId;\r\n\t}\r\n\t\r\n\tpublic String getRegistrationID() {\r\n\t\treturn m_registrationId;\r\n\t}\r\n\t\r\n\tpublic String readyRegIDPublic() {\r\n\t\tif(m_registrationId == null) m_context.queryRegID(m_senderId);\r\n\t\treturn m_registrationId;\r\n\t}\r\n\r\n\tpublic void setContext(GameEngineActivity context) {\r\n\t\tm_context = context;\r\n\t\tfor(int i = 0; i < MAX_EDIT_TEXT; i++) m_textList[i] = null;\r\n\t\tfor(int i = 0; i < MAX_WEB_VIEW; i++) m_webList[i] = null;\r\n\t}\r\n\t\r\n\tpublic void setBasePath(String path_install, String path_external) {\r\n\t\tm_path_external = path_external;\r\n\t\tm_path_install = path_install;\r\n\t}\r\n\t\r\n\t// \r\n\tpublic static String readyRegID() {\r\n\t\tString regist = getInstance().readyRegIDPublic();\r\n\t\treturn regist;\r\n\t}\r\n\t\r\n\t//! UUIDを生成するメソッド。keychain機能で使用される。\r\n\tpublic static String genUserID() {\r\n\t\tString uuid = UUID.randomUUID().toString();\r\n\t\treturn uuid;\r\n\t}\r\n\r\n\t//! SHA512を生成\r\n\tpublic static byte[] sha512(String string) {\r\n\t\ttry {\r\n\t\t\tMessageDigest md = MessageDigest.getInstance(\"SHA-512\");\r\n\t\t\tbyte[] strdata = string.getBytes(\"UTF-8\");\r\n\t\t\tbyte[] digest = md.digest(strdata);\r\n\t\t\treturn digest;\r\n\t\t} catch(NoSuchAlgorithmException e) {\r\n\t\t\tthrow new RuntimeException(\"No Such Algorithm: SHA512\");\r\n\t\t} catch(UnsupportedEncodingException e) {\r\n\t\t\tthrow new RuntimeException(\"No Such Algorithm: SHA512\");\r\n\t\t}\r\n\t}\r\n\t\r\n\t//! keychain 機能 I/F (native から登録要求を受ける口)\r\n\tpublic static boolean setKeyChain(String service_name, String key, String value) {\r\n\t\tSharedPreferences pref = getInstance().m_context.getPreferences(Context.MODE_PRIVATE);\r\n\t\tString pkey = \"[\" + service_name + \"]\" + key;\r\n\t\tSharedPreferences.Editor e = pref.edit();\r\n\t\te.putString(pkey, value);\r\n\t\te.commit();\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//! keychain 機能 I/F (native から取得要求を受ける口)\r\n\tpublic static String getKeyChain(String service_name, String key) {\r\n\t\tSharedPreferences pref = getInstance().m_context.getPreferences(Context.MODE_PRIVATE);\r\n\t\tString pkey = \"[\" + service_name + \"]\" + key;\r\n\t\tString ret = pref.getString(pkey, \"\");\r\n\t\treturn ret;\r\n\t}\r\n\t\t\r\n\t//! keychain 機能 I/F (native から取得要求を受ける口)\r\n\tpublic static boolean delKeyChain(String service_name, String key) {\r\n\t\tSharedPreferences pref = getInstance().m_context.getPreferences(Context.MODE_PRIVATE);\r\n\t\tString pkey = \"[\" + service_name + \"]\" + key;\r\n\t\tSharedPreferences.Editor e = pref.edit();\r\n        e.remove(pkey);\r\n        e.commit();\r\n\t\treturn true;\r\n\t}\r\n\r\n\t//! TextBox を作る\r\n\tpublic static int textbox_create(int x, int y, int width, int height, String defText, boolean passwdmode) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tGameEngineActivity context = pfif.m_context;\r\n\t\tEditBoxItem ebox = new EditBoxItem(context, defText, x, y, width, height, passwdmode);\r\n\t\tfor(int i = 0; i < pfif.MAX_EDIT_TEXT; i++) {\r\n\t\t\tif(pfif.m_textList[i] == null) {\r\n\t\t\t\tpfif.m_textList[i] = ebox;\r\n\t\t\t\tif(i > pfif.m_textListCount) pfif.m_textListCount = i;\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\tebox = null;\r\n\t\treturn -1;\r\n\t}\r\n\t\r\n\t//! 指定された TextBox を破棄する\r\n\tpublic static boolean textbox_destroy(int index) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tEditBoxItem edit = pfif.m_textList[index];\r\n\t\tedit.m_remove = true;\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//! TextBoxに文字列を設定\r\n\tpublic static boolean textbox_setText(int index, String text) {\r\n\t\tfinal EditBoxItem control = PFInterface.getInstance().m_textList[index];\r\n\t\tfinal String inner_text = text;\r\n\t\tif(control == null) return false;\r\n\t\t// 平成25年8月14日(水)\r\n\t\t// EditBoxItemが動いているThread以外からsetTextがcallされる可能性があり、\r\n\t\t// その場合にCalledFromWrongThreadExceptionが投げられてしまうので\r\n\t\t// ActivityのrunOnUiThreadを利用してEditBoxItemが動いているThread上でsetTextがcallされるよう修正.\r\n\t\tPFInterface.getInstance().m_context.runOnUiThread(new Runnable() {\r\n\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\tcontrol.setText(inner_text);\r\n\t\t\t\t}\r\n\t\t});\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//! TextBoxから文字列を取得\r\n\tpublic static String textbox_getText(int index) {\r\n\t\tEditBoxItem control = PFInterface.getInstance().m_textList[index];\r\n\t\tif(control == null) return null;\r\n\t\tString text = control.getText();\r\n\t\treturn text;\r\n\t}\r\n\r\n\t//! TextBox の位置やサイズ,表示状態,有効/無効を変更\r\n\tpublic static void textbox_update(int index, int x, int y, int width, int height, boolean enable, boolean visible) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tEditBoxItem edit = pfif.m_textList[index];\r\n\t\tif(edit == null) return;\r\n\r\n\t\tedit.move(x, y, width, height);\r\n\t\tedit.setVisible(visible);\r\n\t\tedit.setEnable(enable);\r\n\t}\r\n\t\r\n\t//\r\n\tpublic static void textbox_setpaint(int index, Paint paint)\r\n\t{\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tEditBoxItem edit = pfif.m_textList[index];\r\n\t\tif(edit == null) return;\r\n\t\t\r\n\t\tedit.setPaint(paint);\r\n\t}\r\n\t\r\n\t// \r\n\tpublic static void textbox_sethint(int index, String hint)\r\n\t{\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tEditBoxItem edit = pfif.m_textList[index];\r\n\t\tif(edit == null) return;\r\n\t\t\r\n\t\tedit.setHint(hint);\r\n\t}\r\n\r\n\tpublic static void textbox_setMaxlen(int index, int maxlen)\r\n\t{\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tEditBoxItem edit = pfif.m_textList[index];\r\n\t\tif(edit == null) return;\r\n\r\n\t\tedit.setMaxlen(maxlen);\r\n\t}\r\n\r\n\tstatic final int TX_ALIGN_LEFT = 0;\r\n\tstatic final int TX_ALIGN_CENTER = 1;\r\n\tstatic final int TX_ALIGN_RIGHT = 2;\r\n\tpublic static void textbox_setAlignment(int index, int alignment)\r\n\t{\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tEditBoxItem edit = pfif.m_textList[index];\r\n\t\tif(edit == null) return;\r\n\r\n\t\tint gravity = 0;\r\n\t\tswitch (alignment) {\r\n\t\tcase TX_ALIGN_LEFT:\r\n\t\t\tgravity = Gravity.LEFT;\r\n\t\t\tbreak;\r\n\t\tcase TX_ALIGN_CENTER:\r\n\t\t\tgravity = Gravity.CENTER;\r\n\t\t\tbreak;\r\n\t\tcase TX_ALIGN_RIGHT:\r\n\t\t\tgravity = Gravity.RIGHT;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tedit.setGravity(gravity);\r\n\t}\r\n\r\n\t//! WebViewの生成\r\n\tpublic static int webview_create(int x, int y, int width, int height,\r\n\t\t\t\t\t\t\t\t\tString defURL, \r\n\t\t\t\t\t\t\t\t\tString token, String region, String client, String consumerKey,\r\n\t\t\t\t\t\t\t\t\tString applicationId, String userId, boolean nojump) {\r\n\t\t\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tGameEngineActivity context = pfif.m_context;\r\n\t\tWebViewItem web = new WebViewItem(context, defURL, x, y, width, height,\r\n\t\t\t\t\t\t\t\t\t\ttoken, region, client, consumerKey, applicationId, userId,\r\n\t\t\t\t\t\t\t\t\t\tpfif.m_tzone, pfif.m_osversion, nojump);\r\n\t\tfor(int i = 0; i < pfif.MAX_WEB_VIEW; i++) {\r\n\t\t\tif(pfif.m_webList[i] == null) {\r\n\t\t\t\tpfif.m_webList[i] = web;\r\n\t\t\t\tif(i > pfif.m_webListCount) pfif.m_webListCount = i;\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\tweb = null;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t//! WebViewの破棄\r\n\tpublic static boolean webview_destroy(int index) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tWebViewItem web = pfif.m_webList[index];\r\n\t\tweb.m_remove = true;\r\n\t\treturn true;\r\n\t}\r\n\r\n\t//! WebViewにURLを設定\r\n\tpublic static boolean webview_setText(int index, String text) {\r\n\t\tfinal WebViewItem control = PFInterface.getInstance().m_webList[index];\r\n\t\tfinal String inner_text = text;\r\n\t\tif(control == null) return false;\r\n\t\t// 平成25年8月15日(木)\r\n\t\t// EditBoxに習い修正\r\n\t\tPFInterface.getInstance().m_context.runOnUiThread(new Runnable() {\r\n\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\tcontrol.setText(inner_text);\r\n\t\t\t\t}\r\n\t\t});\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//! WebViewからWebViewItemを取得\r\n\tpublic static int webview_getWebViewItem(WebView _webView) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tfor(int i = 0; i < pfif.MAX_WEB_VIEW; i++)\r\n\t\t{\r\n\t\t\tif(pfif.m_webList[i] != null && pfif.m_webList[i].isEqual(_webView)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\t\r\n\t//! WebViewの拡大縮小設定\r\n\tpublic static void webview_setZoom(int _index, boolean _flg)\r\n\t{\r\n\t\tWebViewItem control = PFInterface.getInstance().m_webList[_index];\r\n\t\tif(control == null) return;\r\n\t\tcontrol.setZoom(_flg);\r\n\t}\r\n\t\r\n\t//! WebViewの背景色を設定\r\n\tpublic static void webview_setColor(int _index, int _alpha, int _col) \r\n\t{\r\n\t\tWebViewItem control = PFInterface.getInstance().m_webList[_index];\r\n\t\tif(control == null) return;\r\n\t\tcontrol.setColor(_alpha, _col);\r\n\t}\r\n\t\r\n\t//! WebViewから文字列を取得\r\n\tpublic static String webview_getText(int index) {\r\n\t\tWebViewItem control = PFInterface.getInstance().m_webList[index];\r\n\t\tif(control == null) return null;\r\n\t\tString text = control.getText();\r\n\t\treturn text;\r\n\t}\r\n\t\r\n\t//! WebViewから文字列を取得\r\n\tpublic static String webview_getTmpText(int index) {\r\n\t\tWebViewItem control = PFInterface.getInstance().m_webList[index];\r\n\t\tif(control == null) return null;\r\n\t\tString tmpText = control.getTmpText();\r\n\t\treturn tmpText;\r\n\t}\r\n\r\n\t//! TextBox の位置やサイズ,表示状態,有効/無効を変更\r\n\tpublic static void webview_update(int index, int x, int y, int width, int height, boolean enable, boolean visible) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tWebViewItem web = pfif.m_webList[index];\r\n\t\tif(web != null) {\r\n\t\t\tweb.move(x, y, width, height);\t\t\r\n\t\t\tweb.setVisible(visible);\r\n\t\t\tweb.setEnable(enable);\r\n\t\t}\r\n\t}\r\n\r\n\t//! MovieViewの生成\r\n\tpublic static int movieview_create(int x, int y, int width, int height, String defURL, boolean background) {\r\n\t\t\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tGameEngineActivity context = pfif.m_context;\r\n\t\tfor(int i = 0; i < pfif.MAX_MOVIE_VIEW; i++) {\r\n\t\t\tif(pfif.m_movieList[i] == null) {\r\n\t\t\t\tMovieViewItem movie = new MovieViewItem(i, context, defURL, x, y, width, height, background);\r\n\t\t\t\tpfif.m_movieList[i] = movie;\r\n\t\t\t\tif(i > pfif.m_movieListCount) pfif.m_movieListCount = i;\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t//! MovieViewの破棄\r\n\tpublic static boolean movieview_destroy(int index) {\r\n\t\tPFInterface pfif = getInstance();\r\n\t\tMovieViewItem movie = pfif.m_movieList[index];\r\n\t\tmovie.m_remove = true;\r\n\t\treturn true;\r\n\t}\r\n\r\n\t//! MovieViewにURLを設定\r\n\tpublic static boolean movieview_setText(int index, String text) {\r\n\t\tfinal MovieViewItem control = getInstance().m_movieList[index];\r\n\t\tfinal String inner_text = text;\r\n\t\tif(control == null) return false;\r\n\t\t// 平成25年8月15日(木)\r\n\t\t// EditBoxに習い修正\r\n\t\tPFInterface.getInstance().m_context.runOnUiThread(new Runnable() {\r\n\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\tcontrol.setText(inner_text);\r\n\t\t\t\t}\r\n\t\t});\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//! MovieBoxから文字列を取得\r\n\tpublic static String movieview_getText(int index) {\r\n\t\tWebViewItem control = PFInterface.getInstance().m_webList[index];\r\n\t\tif(control == null) return null;\r\n\t\tString text = control.getText();\r\n\t\treturn text;\r\n\t}\r\n\r\n\t//! MovieBox の位置やサイズ,表示状態,有効/無効を変更\r\n\tpublic static void movieview_update(int index, int x, int y, int width, int height, boolean enable, boolean visible) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tMovieViewItem movie = pfif.m_movieList[index];\r\n\t\tif(movie != null) {\r\n\t\t\tmovie.move(x, y, width, height);\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t//! MovieView に対するコマンド処理\r\n\tpublic static void movieview_cmd(int index, int cmd) {\r\n\t\tMovieViewItem movie = getInstance().m_movieList[index];\r\n\t\tmovie.cmd(cmd);\r\n\t}\r\n\t\t\r\n\t//-------------------------------------------\r\n\t//! Indicatorの生成\r\n\tpublic static int indicator_create(int x, int y, int width, int height, boolean background) {\r\n\t\t\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tGameEngineActivity context = pfif.m_context;\r\n\t\tif(pfif.m_indicator == null)\r\n\t\t{\r\n\t\t\tIndicatorItem indicator = new IndicatorItem( context, x, y, width, height, background);\r\n\t\t\tpfif.m_indicator = indicator;\r\n\t\t\treturn 0;\r\n\t\t}\r\n        else\r\n        {\r\n            pfif.m_indicator.setVisible(true);\r\n        }\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t//! Indicatorの破棄\r\n\tpublic static boolean indicator_destroy(int index) {\r\n\t\tPFInterface pfif = getInstance();\r\n        if( pfif.m_indicator!=null )\r\n        {\r\n            pfif.m_indicator.m_remove = true;\r\n        }\r\n\t\treturn true;\r\n\t}\r\n\r\n\t\r\n\t//! IndicatorにURLを設定\r\n\tpublic static boolean indicator_setText(int index, String text) {\r\n\t\tIndicatorItem indicator = getInstance().m_indicator;\r\n\t\tif(indicator == null) return false;\r\n//\t\tindicator.setText(text);\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//! Indicatorから文字列を取得\r\n\tpublic static String indicator_getText(int index) {\r\n\t\tWebViewItem control = PFInterface.getInstance().m_webList[index];\r\n\t\tif(control == null) return null;\r\n\t\tString text = control.getText();\r\n\t\treturn text;\r\n\t}\r\n\r\n\t//! Indicator の位置やサイズ,表示状態,有効/無効を変更\r\n\tpublic static void indicator_update(int index, int x, int y, int width, int height, boolean enable, boolean visible) {\r\n\t\tPFInterface pfif = PFInterface.getInstance();\r\n\t\tIndicatorItem indicator = pfif.m_indicator;\r\n\t\tif(indicator != null) {\r\n\t\t\tindicator.move(x, y, width, height);\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t//! Indicator に対するコマンド処理\r\n\tpublic static void indicator_cmd(int index, int cmd) {\r\n\t\tIndicatorItem indicator = getInstance().m_indicator;\r\n\t\tif(indicator != null) {\r\n            indicator.cmd(cmd);\r\n        }\r\n\t}\r\n\r\n\t//-------------------------------------------\r\n\t// メインスレッドから呼ぶ\r\n\tpublic synchronized void updateControl() {\r\n\t\tfor(int i = 0; i <= m_textListCount; i++) {\r\n\t\t\tif(m_textList[i] == null) continue;\r\n\t\t\tif(m_textList[i].remove()) {\r\n\t\t\t\tm_textList[i] = null;\r\n\t\t\t\tcontinue;\t// 削除処理対象なら次へ\r\n\t\t\t}\r\n\t\t\tm_textList[i].create();\t// 生成されたばかりなら、実際の生成処理を行う\r\n\t\t\tm_textList[i].update(); // 変更内容があるならそこで反映する\r\n\t\t}\r\n\t\tif(m_textListCount >= 0 && m_textList[m_textListCount] == null) {\r\n\t\t\tint max = -1;\r\n\t\t\tfor(int i = 0; i < m_textListCount; i++) {\r\n\t\t\t\tif(m_textList[i] != null) max = i;\r\n\t\t\t}\r\n\t\t\tm_textListCount = max;\r\n\t\t}\r\n\t\t// WebView の更新を確認\r\n\t\tfor(int i = 0; i <= m_webListCount; i++) {\r\n\t\t\tif(m_webList[i] == null) continue;\r\n\t\t\tif(m_webList[i].remove()) {\r\n\t\t\t\tm_webList[i] = null;\r\n\t\t\t\tcontinue;\t// 削除処理対象なら次へ\r\n\t\t\t}\r\n\t\t\tm_webList[i].create();\t// 生成されたばかりなら、実際の生成処理を行う\r\n\t\t\tm_webList[i].update(); // 変更内容があるならそこで反映する\r\n\t\t}\r\n\t\tif(m_webListCount >= 0 && m_webList[m_webListCount] == null) {\r\n\t\t\tint max = -1;\r\n\t\t\tfor(int i = 0; i < m_webListCount; i++) {\r\n\t\t\t\tif(m_webList[i] != null) max = i;\r\n\t\t\t}\r\n\t\t\tm_webListCount = max;\r\n\t\t}\r\n\t\t// MovieView の更新を確認\r\n\t\tfor(int i = 0; i <= m_movieListCount; i++) {\r\n\t\t\tif(m_movieList[i] == null) continue;\r\n\t\t\tif(m_movieList[i].remove()) {\r\n\t\t\t\tm_movieList[i] = null;\r\n\t\t\t\tcontinue;\t// 削除処理対象なら次へ\r\n\t\t\t}\r\n\t\t\tm_movieList[i].create();\t// 生成されたばかりなら、実際の生成処理を行う\r\n\t\t\tm_movieList[i].update(); // 変更内容があるならそこで反映する\r\n\t\t}\r\n\t\tif(m_movieListCount >= 0 && m_movieList[m_movieListCount] == null) {\r\n\t\t\tint max = -1;\r\n\t\t\tfor(int i = 0; i < m_movieListCount; i++) {\r\n\t\t\t\tif(m_movieList[i] != null) max = i;\r\n\t\t\t}\r\n\t\t\tm_movieListCount = max;\r\n\t\t}\r\n\t\t// IndicatorView の更新を確認\r\n \r\n        if( m_indicator!=null )\r\n        {\r\n            if( m_indicator.remove() )\r\n            {\r\n            \tm_indicator = null;\r\n            }\r\n            if( m_indicator!=null )\r\n            {\r\n                m_indicator.create();\r\n                m_indicator.update();\r\n            }\r\n        }\r\n\r\n\t}\r\n\t\r\n\t//! renderText() で呼び出される、Java側でフォントテクスチャを生成するメソッド。\r\n\tpublic static void drawText(Paint paint, int [] image, int color, int width, int height, float x, float y, String text) {\r\n\t\tpaint.setAntiAlias(true);\r\n\t\tpaint.setColor(color);\r\n\t\tBitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\r\n\t\t//bitmap.setPixels(image, width * (height - 1), -width, 0, 0, width, height);\r\n\t\tbitmap.setPixels(image, 0, width, 0, 0, width, height);\r\n\t\tCanvas canvas = new Canvas(bitmap);\r\n\t\tcanvas.drawText(text, x, y, paint);\r\n\t\t//bitmap.getPixels(image, width * (height - 1), -width, 0, 0, width, height);\r\n\t\tbitmap.getPixels(image, 0, width, 0, 0, width, height);\r\n\t}\r\n\t\r\n\tpublic static long nanotime() {\r\n\t\treturn System.nanoTime();\r\n\t}\r\n\t\r\n\tpublic boolean callInit(int width, int height, String path) {\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tString model = Build.MODEL;\r\n\t\tString brand = Build.BRAND;\r\n\t\tString board = Build.BOARD;\r\n\t\tString version = Build.VERSION.RELEASE;\r\n\t\tString tz = \"JST\"; // TimeZone.getDefault().toString();\r\n\t\tm_osversion = model + \" \" + brand + \" \" + board + \" \" + version;\r\n\t\tm_tzone = tz;\r\n\t\tboolean result = initSequence(width, height, path, model, brand, board, version, tz);\r\n\t\tm_bexec = true;\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\tpublic void screenRotation(int origin) {\r\n\t\tif(!m_bexec) return;\r\n\t\tint width, height;\r\n\t\tif((origin & 1) == 0) {\r\n\t\t\twidth = (m_width < m_height) ? m_height : m_width;\r\n\t\t\theight = (m_width > m_height) ? m_height : m_width;\r\n//\t\t\twidth = (m_width < m_height) ? m_width : m_height;\r\n//\t\t\theight = (m_width > m_height) ? m_width : m_height;\r\n\t\t} else {\r\n\t\t\twidth = (m_width > m_height) ? m_width : m_height;\r\n\t\t\theight = (m_width < m_height) ? m_width : m_height;\r\n\r\n\t\t}\r\n\t\trotateScreenOrientation(0, width, height);\r\n\t}\r\n\r\n\tpublic static String generateDeviceIdent() {\r\n\t\treturn Build.MANUFACTURER + \"`\" + Build.MODEL + \"`\" + ((int)(Math.random() * 16777216));\r\n\t}\r\n\t\r\n\tpublic static void\tbillingInit()\r\n\t{\r\n\t\tBillingManager.init(getInstance().m_context);\r\n\t}\r\n\r\n\tpublic static void\tbillingTerminate()\r\n\t{\r\n\t\tBillingManager.requestTerminate();\r\n\t}\r\n\t\r\n\tpublic static void\tbillingConsume(String receipt)\r\n\t{\r\n\t\tBillingManager.getInstance(getInstance().m_context).requestConsume(receipt);\r\n\t}\r\n\r\n\tpublic static void\tbillingGetProducts(String jsonStr)\r\n\t{\r\n\t\tLog.d(\"PFInterface\", \"json = \" + jsonStr);\r\n\t\tList<String> skuList = new ArrayList<String>();\r\n\t\t\r\n\t\ttry {\r\n\t\t\tJSONArray json = new JSONArray(jsonStr);\r\n\t\t\tint len = json.length();\r\n\t\t\t\r\n\t        for(int i = 0; i < len; ++i) {\r\n\t        \tskuList.add(json.getString(i));\r\n\t        \tLog.d(\"PFInterface\", \"item = \" + json.getString(i));\r\n\t        }\r\n\t\t} catch (JSONException e) {\r\n\t\t\tLog.e(\"PFInterface\", \"illegal json string: \" + jsonStr);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tBillingManager.getInstance(getInstance().m_context).requestGetProducts(skuList);\r\n\t}\r\n\r\n\t// 課金：購入処理\r\n\tpublic static void billingBuyItem(String sku)\r\n \t{\r\n\t\tBillingManager.getInstance(getInstance().m_context).requestBuy(sku);\r\n \t}\r\n    \r\n    public boolean IsInstallEnd() {\r\n\t\tGameEngineActivity context = getInstance().m_context;\r\n\t\treturn context.IsInstallEnd();\r\n\t}\r\n\r\n    // メーラー起動\r\n    public static void startMailer( String addr , String subject , String body )\r\n    {\r\n    \tGameEngineActivity context = getInstance().m_context;\r\n    \tcontext.startExternalApplicationMail( addr , subject , body );\r\n    }\r\n\r\n    // アラートダイアログ起動\r\n    public static void startAlertDialog( String title , String message )\r\n    {\r\n    \tGameEngineActivity context = getInstance().m_context;\r\n    \tcontext.startAlertDialog( title , message );\r\n    }\r\n\r\n\t// メーラー起動\r\n    public static void startBrowser( String url )\r\n    {\r\n    \tGameEngineActivity context = getInstance().m_context;\r\n    \tcontext.startBrowser( url );\r\n    }\r\n    \r\n    public static int getVersionCode(){\r\n        GameEngineActivity context = getInstance().m_context;\r\n        PackageManager pm = context.getPackageManager();\r\n        int versionCode = 0;\r\n        try{\r\n            PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);\r\n            versionCode = packageInfo.versionCode;\r\n        }catch(NameNotFoundException e){\r\n            // placing printStackTrace() because we'll most likely never hit this exception as long as package file is correct\r\n            e.printStackTrace();\r\n        }\r\n        return versionCode;\r\n    }\r\n\r\n    public static String getVersionName(){\r\n        GameEngineActivity context = getInstance().m_context;\r\n        PackageManager pm = context.getPackageManager();\r\n        String versionName = \"\";\r\n        try{\r\n            PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);\r\n            versionName = packageInfo.versionName;\r\n        }catch(NameNotFoundException e){\r\n            // placing printStackTrace() because we'll most likely never hit this exception as long as package file is correct\r\n            e.printStackTrace();\r\n        }\r\n        return versionName;\r\n    }\r\n    \r\n    public static void forbidSleep(boolean isForbidden) {\r\n    \tGameEngineActivity engineActivity = getInstance().m_context;\r\n    \tif (engineActivity != null) {\r\n    \t\tengineActivity.forbidSleep(isForbidden);\r\n    \t}\r\n    }\r\n\r\n\tpublic native boolean initSequence(int width, int height, String path,\r\n\t\t\t\t\t\t\t\t\t\tString model, String brand, String board, String version, String tz);\r\n\tpublic native void frameFlip(int deltaT);\r\n\tpublic native void finishGame();\r\n\tpublic native void inputDeviceKey(int keyId, char eventType);\r\n\tpublic native void inputPoint(int id, int type, int x, int y);\r\n\tpublic native void rotateScreenOrientation(int origin, int width, int height);\r\n\tpublic native void toNativeSignal(int cmd, int param);\r\n\tpublic native int getGLVersion();\r\n    public native void resetViewport();\r\n    public native void onActivityPause();\r\n    public native void onActivityResume();\r\n    public native void WebViewControlEvent(WebView _pWeb, int _flg);\r\n\tpublic native void clientControlEvent(int type, int widget, String data_1, String data_2);\r\n\tpublic native void clientResumeGame();\r\n\r\n\tstatic {\r\n\t\tSystem.loadLibrary(\"jniproxy\");\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/RClassReference.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport android.content.Context;\r\n\r\n/**\r\n * @class RClassReference\r\n * @breif R classを参照するためのclass.\r\n * Activityの最初(の方)で、\r\n * RClassReference.initialize(getApplicationContext())\r\n * とする事でApplicationのpackage名を取得しそこからR classの各要素をキャッシュ、\r\n * その後R classの要素が必要になるタイミングでget系Methodを使用する.\r\n *\r\n * @note\r\n * これを使用する事によって、package名の違いによって R class を参照する時に逐一renameしないといけなかった部分がなくなる.\r\n * ApplicationContextからApplicationのpackage名を取得して文字列を連結、そこからReflectionでclassのfieldを取得している.\r\n * Reflectionを使用しているので呼び出す度に計算取得し直すのではなく、Application起動時に必要な要素を滑て取得してキャッシュしておくようにしている.\r\n * @note\r\n * ApplicationContextのextendsとして専用ApplicationContextを作る方がよかったかもしれない.\r\n */\r\npublic class RClassReference {\r\n    private static int gcm_sender_id; /** R$string sender_id */\r\n    private static int app_name; /** R&string app_name */\r\n    private static String gcm_sender_id_string; /** R$string sender_id をAppicationContext.getString()でString化したもの. */\r\n    private static String app_name_string; /** R&string app_name をAppicationContext.getString()でString化したもの. */\r\n    private static int install; /** R$layout install */\r\n    private static int indicator; /** R$layout indicator */\r\n    private static int ic_launcher; /** R$drawable ic_launcher */\r\n\r\n    /**\r\n     * @func initialize\r\n     * @brief 初期化. Activityの最初(正確にはR classのFieldを使う前)にcallしておく必要がある.\r\n     * @param appContext ApplicationContext\r\n     */\r\n    public static void initialize(Context appContext) {\r\n        try\r\n            {\r\n                // Reflectionを利用してApplication package名からR classの各要素を取得する.\r\n                // package.name.R$string\r\n                // stringはマニフェストファイルにmeta-dataを追加してそれ経由で取得しても良いかもしれない.\r\n                Class<?> stringClass = Class.forName(appContext.getPackageName() + \".R$string\");\r\n                java.lang.reflect.Field stringAppName = stringClass.getField(\"app_name\");\r\n                app_name = stringAppName.getInt(null);\r\n                app_name_string = appContext.getString(app_name);\r\n                java.lang.reflect.Field stringGCMSenderID = stringClass.getField(\"sender_id\");\r\n                gcm_sender_id = stringGCMSenderID.getInt(null);\r\n                gcm_sender_id_string = appContext.getString(gcm_sender_id);\r\n\r\n                // package.name.R$layout\r\n                Class<?> layoutClass = Class.forName(appContext.getPackageName() + \".R$layout\");\r\n                java.lang.reflect.Field layoutInstall = layoutClass.getField(\"install\");\r\n                install = layoutInstall.getInt(null);\r\n\r\n                java.lang.reflect.Field layoutIndicator = layoutClass.getField(\"indicator\");\r\n                indicator = layoutIndicator.getInt(null);\r\n\r\n                // package.name.R$drawable\r\n                Class<?> drawableClass = Class.forName(appContext.getPackageName() + \".R$drawable\");\r\n                java.lang.reflect.Field drawableICLauncher = drawableClass.getField(\"ic_launcher\");\r\n                ic_launcher = drawableICLauncher.getInt(null);\r\n            }\r\n          catch (ClassNotFoundException e)\r\n              {\r\n                  throw new RuntimeException(e);\r\n              }\r\n          catch (NoSuchFieldException e)\r\n              {\r\n                  throw new RuntimeException(e);\r\n              }\r\n          catch (IllegalAccessException e)\r\n              {\r\n                  throw new RuntimeException(e);\r\n              }\r\n    }\r\n\r\n    /**\r\n     * @func getAppName\r\n     * @brief R.string.app_nameを返す.\r\n     * @return R.string.app_nameの値\r\n     */\r\n    public static int getAppName() {\r\n        return app_name;\r\n    }\r\n\r\n    /**\r\n     * @func getGCMSenderID\r\n     * @brief R.string.sender_idを返す.\r\n     * @return R.string.sender_idの値\r\n     */\r\n    public static int getGCMSenderID() {\r\n        return gcm_sender_id;\r\n    }\r\n\r\n    /**\r\n     * @func getAppNameString\r\n     * @brief R.string.app_nameの文字列を返す.\r\n     * @return R.string.app_nameの値\r\n     */\r\n    public static String getAppNameString() {\r\n        return app_name_string;\r\n    }\r\n\r\n    /**\r\n     * @func getGCMSenderIDString\r\n     * @brief R.string.sender_idの文字列を返す.\r\n     * @return R.string.sender_idの値\r\n     */\r\n    public static String getGCMSenderIDString() {\r\n        return gcm_sender_id_string;\r\n    }\r\n\r\n    /**\r\n     * @func getInstall\r\n     * @brief R.layout.installを返す.\r\n     * @return R.layout.installの値\r\n     */\r\n    public static int getInstall() {\r\n        return install;\r\n    }\r\n\r\n    /**\r\n     * @func getIndicator\r\n     * @brief R.layout.indicatorを返す.\r\n     * @return R.layout.indicatorの値\r\n     */\r\n    public static int getIndicator() {\r\n        return indicator;\r\n    }\r\n\r\n    /**\r\n     * @func getICLauncher\r\n     * @brief R.drawable.ic_launcherを返す.\r\n     * @return R.drawable.ic_launcherの値\r\n     */\r\n    public static int getICLauncher() {\r\n        return ic_launcher;\r\n    }\r\n\r\n    /**\r\n     * @func getAppName\r\n     * @brief R.string.app_nameをappContextを介してstring化した物を返す.\r\n     * @param appContext ApplicationContext\r\n     * @return app_nameの正式な文字列.\r\n     */\r\n    public static String getAppName(Context appContext) {\r\n        return appContext.getString(app_name);\r\n    }\r\n\r\n    /**\r\n     * @func getGCMSenderID\r\n     * @brief R.string.sender_idをappContextを介してstring化した物を返す.\r\n     * @param appContext ApplicationContext\r\n     * @return sender_idの正式な文字列.\r\n     */\r\n    public static String getGCMSenderID(Context appContext) {\r\n        return appContext.getString(gcm_sender_id);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/Typefaces.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport java.util.Hashtable;\r\n\r\nimport android.content.res.AssetManager;\r\nimport android.graphics.Typeface;\r\n\r\npublic class Typefaces {\r\n\r\n\tprivate static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();\r\n\r\n\tpublic static Typeface get(AssetManager assets, String name) {\r\n\t\tsynchronized (cache) {\r\n\t\t\tif (!cache.containsKey(name)) {\r\n\t\t\t\tTypeface t = Typeface.createFromAsset(assets, name);\r\n\t\t\t\tcache.put(name, t);\r\n\t\t\t}\r\n\t\t\treturn cache.get(name);\r\n\t\t}\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/WebViewItem.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine;\r\n\r\nimport klb.android.GameEngine.GameEngineActivity;\r\n// import klb.android.GameEngine.PFInterface;\r\nimport android.view.GestureDetector;\r\nimport android.view.MotionEvent;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.view.View.OnLongClickListener;\r\nimport android.webkit.WebView;\r\nimport android.webkit.WebViewClient;\r\nimport android.widget.LinearLayout;\r\nimport android.content.Context;\r\nimport android.graphics.Bitmap;\r\nimport java.lang.String;\r\nimport java.lang.System;\r\n//import java.lang.Exception;\r\nimport java.util.Map;\r\nimport java.util.HashMap;\r\nimport android.webkit.JavascriptInterface;\r\n\r\nclass WebViewItem\r\n{\r\n\tprivate Map<String, String> m_extraHeaders = null;\r\n\tprivate LinearLayout m_layout = null;\r\n\tprivate LinearLayout.LayoutParams m_params = null;\r\n//\tprivate WebView m_web = null;\r\n\tprivate HelpWebView m_web = null;\r\n\tprivate String m_url;\r\n\tprivate String m_tmpUrl;\r\n\tprivate String m_consumerKey = null;\r\n\tprivate String m_token = null;\r\n\tprivate int m_x;\r\n\tprivate int m_y;\r\n\tprivate int m_width;\r\n\tprivate int m_height;\r\n\tprivate GameEngineActivity m_context = null;\r\n\tprivate boolean m_nojump;\r\n\tpublic boolean m_created;\r\n\tpublic boolean m_update;\r\n\tpublic boolean m_remove;\r\n\tpublic boolean m_reload;\r\n\tpublic boolean m_visible = true;\r\n\tpublic boolean m_enabled = true;\r\n\tpublic int m_alpha = 0;\r\n\tpublic int m_color = 0xffffff;\r\n\tpublic boolean m_bZoom = true;\r\n\tprivate static int m_nonceSeed = 0;\r\n\tprivate static final String NATIVE_PROTOCOL = \"native://\";\r\n\t\r\n\t// class\r\n\tpublic class JsObject\r\n\t{\r\n\t\tprivate Context m_context;\r\n\t\tpublic JsObject(Context _context) {\r\n\t\t\tthis.m_context = _context;\r\n\t\t}\r\n\t\t\r\n\t\t@JavascriptInterface\r\n\t\tpublic void cmd(String _str) {\r\n//\t\t\tint findPos = _str.indexOf(\"native://\");\r\n//\t\t\tif( findPos < 0 )\r\n//\t\t\t{\r\n//\t\t\t\treturn;\r\n//\t\t\t}\r\n\t\t\t// native://が見つかったのでコントロールイベントを通知\r\n\t\t\tm_tmpUrl = _str;//_str.substring(findPos);\r\n\t\t\tPFInterface.getInstance().WebViewControlEvent(m_web, PFInterface.WEBVIEW_STATUS.E_URLJUMP.GetNum());\r\n\t\t}\r\n\t}\r\n\t\r\n\t// constructor はGLスレッドから呼ばれる\r\n\tpublic WebViewItem(GameEngineActivity context, String url,\r\n\t\t\t\t\t\tint x, int y, int width, int height,\r\n\t\t\t\t\t\tString token, String region, String client, String consumerKey,\r\n\t\t\t\t\t\tString applicationId, String userId,\r\n\t\t\t\t\t\tString tzone, String version,\r\n\t\t\t\t\t\tboolean nojump) {\r\n\r\n\t\t// カスタマイズヘッダを作る\r\n\t\tm_extraHeaders = new HashMap<String, String>();\r\n\t\tm_extraHeaders.put(\"API-Model\", \"straightforward\");\r\n\t\t\r\n\t\tif(client != null) m_extraHeaders.put(\"Client-Version\", client);\r\n\t\tif(region != null) m_extraHeaders.put(\"Region\",\tregion);\r\n\t\tif(applicationId != null) m_extraHeaders.put(\"Application-ID\", applicationId);\r\n\t\tif(userId != null) m_extraHeaders.put(\"User-ID\", userId);\r\n\t\t\r\n\t\tm_extraHeaders.put(\"OS\", \"Android\");\r\n\t\tm_extraHeaders.put(\"Time-Zone\", tzone);\r\n\t\tm_extraHeaders.put(\"OS-Version\", version);\r\n\r\n\t\tm_consumerKey = consumerKey;\r\n\t\tm_token = token;\r\n\t\t\r\n\t\tm_nojump = nojump;\r\n\r\n\t\tm_url = url;\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_context = context;\r\n\t\t\r\n\t\tm_created = false;\r\n\t\tm_update = false;\r\n\t\tm_remove = false;\r\n\t\tm_reload = true;\r\n\t}\r\n\t\r\n\t// 値の設定もGLスレッドから呼ばれる\r\n\tpublic void move(int x, int y, int width, int height) {\r\n\t\tm_x = x;\r\n\t\tm_y = y;\r\n\t\tm_width = width;\r\n\t\tm_height = height;\r\n\t\tm_update = true;\r\n\t}\r\n\t\r\n\t// 値の取得も主にGLスレッドから呼ばれる\r\n\tpublic String getText() {\r\n\t\treturn m_url;\r\n\t}\r\n\t\r\n\tpublic String getTmpText() {\r\n\t\treturn m_tmpUrl;\r\n\t}\r\n\t\r\n\tpublic void setText(String text) {\r\n\t\tm_url = text;\r\n\t\tm_reload = true;\r\n\t}\r\n\t\r\n\tprivate void authHeader() {\r\n\t\tlong unixtime = System.currentTimeMillis() / 1000L;\r\n\t\tString auth = \"consumerKey=\" + m_consumerKey + \"&token=\" + m_token + \"&version=1.1&timeStamp=\" + unixtime + \"&nonce=WV\" + m_nonceSeed;\r\n\t\tm_extraHeaders.remove(\"authorize\");\r\n\t\tm_extraHeaders.put(\"authorize\", auth);\r\n\t}\r\n\t\r\n\tprivate void setStatus() {\r\n\t\tif(m_visible) {\r\n\t\t\tm_web.setEnabled(m_enabled);\r\n\t\t\tm_web.setVisibility(View.VISIBLE);\r\n\t\t} else {\r\n\t\t\tm_web.setEnabled(false);\r\n\t\t\tm_web.setVisibility(View.INVISIBLE);\r\n\t\t}\r\n\t}\r\n\t// 以下はメインスレッドから呼ばれる(Runnable経由)\r\n\tpublic void create() {\r\n\t\tif(m_created) return;\r\n\t//\tm_web = new WebView(m_context);\r\n\t\tm_web = new HelpWebView(m_context);\r\n\t\t// m_web.getSettings().setJavaScriptEnabled(true);\r\n\t\t\r\n\t\t// ロングタップでの範囲選択off\r\n\t\tm_web.setOnLongClickListener(new OnLongClickListener() {\r\n\t\t@Override\r\n\t\tpublic boolean onLongClick(View v) {\r\n\t\t    return true;\r\n\t\t}\r\n\t\t});\r\n\t\tm_web.setLongClickable(false);\r\n\t\t\r\n\t\tm_layout = new LinearLayout(m_context);\r\n\t\tm_params = new LinearLayout.LayoutParams(m_width, m_height);\r\n\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\t\r\n\t\t// 背景色再設定\r\n\t\tsetColor(m_alpha, m_color);\r\n\t\t\r\n\t\t// ズーム設定\r\n\t\tsetZoom(m_bZoom);\r\n\t\t\t\t\r\n\t\t//\r\n\t\tm_layout.addView(m_web, m_params);\r\n\t\tm_layout.setBackgroundColor(0x01FFFFFF);\t// αの部分を0にすると黒い画面がでてしまうので、1を入れています　2013.6.20 \r\n\t\t//m_context.putControl(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\tm_context.putControl(m_layout, m_x, m_y, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);\r\n\t\t\r\n\t\t// authorized header を作る\r\n\t\tauthHeader();\r\n//\t\tm_web.setWebChromeClient(new WebChromeClient()\r\n//\t\t{\r\n//\t\t});\r\n\t\tm_web.setWebViewClient(new WebViewClient()\r\n\t\t{\r\n\t\t\t// 画面更新時のコールバック\r\n\t\t\t@Override\r\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView webView, String url)\r\n\t\t\t{\r\n\t\t\t\tint native_protocol_begin = url.indexOf(WebViewItem.NATIVE_PROTOCOL);\r\n\t\t\t\tif( native_protocol_begin < 0 ) {\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * ここでm_nojumpをiOSの挙動に合わせる。\r\n\t\t\t\t\t * Luaから渡してる間違ったパラメータが既成事実化している模様 \r\n\t\t\t\t\t */\r\n\t\t\t\t\t//if (!m_nojump) {\r\n\t\t\t\t\twebView.loadUrl(url, m_extraHeaders);\r\n\t\t\t\t\t//}\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tm_tmpUrl = url.substring(native_protocol_begin + WebViewItem.NATIVE_PROTOCOL.length());\r\n\t\t\t\tPFInterface.getInstance().WebViewControlEvent(webView, PFInterface.WEBVIEW_STATUS.E_URLJUMP.GetNum());\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// ロード開始\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon)\r\n\t\t\t{\r\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\r\n\t\t\t\tPFInterface.getInstance().WebViewControlEvent(view, PFInterface.WEBVIEW_STATUS.E_DIDSTARTLOADWEB.GetNum());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// ロードが完了\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageFinished(WebView view, String url)\r\n\t\t\t{\r\n\t\t\t\tsuper.onPageFinished(view, url);\r\n\t\t\t\tPFInterface.getInstance().WebViewControlEvent(view, PFInterface.WEBVIEW_STATUS.E_DIDLOADENDWEB.GetNum());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// ロードがエラー\r\n\t\t\t@Override\r\n\t\t\tpublic void onReceivedError(WebView view, int errorCode, String description, String failingUrl)\r\n\t\t\t{\r\n\t\t\t\tsuper.onReceivedError(view, errorCode, description, failingUrl);\r\n\t\t\t\tPFInterface.getInstance().WebViewControlEvent(view, PFInterface.WEBVIEW_STATUS.E_FAILEDLOADWEB.GetNum());\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tm_web.getSettings().setJavaScriptEnabled(true);\r\n\t\tm_web.getSettings().setLoadWithOverviewMode(true);\r\n\t\tm_web.getSettings().setUseWideViewPort(true);\r\n        m_web.getSettings().setBuiltInZoomControls(false);\r\n        m_web.setInitialScale(100);\r\n\t\t\r\n\t\tJsObject jsObj = new JsObject(m_context);\r\n\t\tm_web.addJavascriptInterface(jsObj, \"eng\");\r\n\t\t\r\n\t\tm_web.loadUrl(m_url, m_extraHeaders);\r\n\t\tsetStatus();\r\n\t\tm_reload = false;\r\n\t\tm_created = true;\r\n\t}\r\n\t\r\n\tpublic void update() {\r\n\t\tif(!m_update || m_web == null) return;\r\n\t\t//m_layout.removeView(m_web);\r\n\t\t\r\n\t\tm_params.width = m_width;\r\n\t\tm_params.height = m_height;\r\n\t\tm_params.setMargins(m_x, m_y, 0, 0);\r\n\t\tm_web.requestLayout();\r\n\t\t\r\n\t\t// 背景色再設定\r\n\t\tsetColor(m_alpha, m_color);\r\n\t\t\r\n\t\t//m_layout.addView(m_web, m_params);\r\n\t\t//m_context.replaceView(m_layout, m_x, m_y, m_x + m_width, m_y + m_height);\r\n\t\tsetStatus();\r\n\r\n\t\tif(m_reload) {\r\n\t\t\tauthHeader();\r\n\t\t\tif(null != m_web) {\r\n\t\t\t\tm_web.loadUrl(m_url, m_extraHeaders);\r\n\t\t\t\tm_reload = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tm_update = false;\r\n\t}\r\n\t\r\n\tpublic boolean remove() {\r\n\t\tif(!m_remove) return false;\r\n\t\tif(null != m_web) m_context.removeView(m_layout);\r\n\t\treturn true;\r\n\t}\r\n\r\n\tpublic void setVisible(boolean visible) {\r\n\t\tm_update = true;\r\n\t\tm_visible = visible;\r\n\t}\r\n\r\n\tpublic void setEnable(boolean enabled) {\r\n\t\tm_update = true;\r\n\t\tm_enabled = enabled;\r\n\t}\r\n\t\r\n\tpublic void setZoom(boolean _flg)\r\n\t{\r\n\t\tm_bZoom = _flg;\r\n\t\tif( m_web == null ) return;\r\n\t\tm_web.getSettings().setBuiltInZoomControls(m_bZoom);\r\n\t}\r\n\t\r\n\tpublic void setColor(int _alpha, int _color)\r\n\t{\r\n\t\tm_alpha = _alpha;\r\n\t\tm_color = _color;\r\n\t\tif( m_web == null ) return;\r\n\t\tint col = (m_alpha << 24) | m_color;\r\n\t\tm_web.setBackgroundColor(col);\r\n\t}\r\n\t\r\n\tpublic boolean isEqual(WebView _webView) {\r\n\t\tif(m_web != null && m_web == _webView) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\n\r\nclass HelpWebView extends WebView {\r\n\r\n    private GestureDetector gestureDetector;\r\n//    private AtomicBoolean mPreventAction = new AtomicBoolean(false);\r\n//    private AtomicLong mPreventActionTime = new AtomicLong(0);\r\n    private boolean mDoubleTouch = false;\r\n\r\n    public HelpWebView(Context context) {\r\n        super(context);\r\n        gestureDetector = new GestureDetector(context, new GestureListener());\r\n    }\r\n/*\r\n    public HelpWebView(Context context, AttributeSet attrs) {\r\n        super(context, attrs);\r\n        gestureDetector = new GestureDetector(context, new GestureListener());\r\n    }\r\n*/\r\n/*\r\n    public HelpWebView(Context context, AttributeSet attrs, int defStyle) {\r\n        super(context, attrs, defStyle);\r\n        gestureDetector = new GestureDetector(context, new GestureListener());\r\n    }\r\n*/\r\n/*\r\n    public HelpWebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {\r\n        super(context, attrs, defStyle, privateBrowsing);\r\n        gestureDetector = new GestureDetector(context, new GestureListener());\r\n    }\r\n*/\r\n\r\n    @Override\r\n    public boolean onTouchEvent(MotionEvent event) {\r\n    \tgestureDetector.onTouchEvent(event);\r\n    \tif(mDoubleTouch)\r\n    \t{\r\n    \t\tmDoubleTouch = false;\r\n    \t\treturn false;\r\n    \t}\r\n    \treturn super.onTouchEvent(event);\r\n/*\r\n        int index = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\r\n        int pointId = event.getPointerId(index);\r\n\r\n        // just use one(first) finger, prevent double tap with two and more fingers\r\n        if (pointId == 0){\r\n            gestureDetector.onTouchEvent(event);\r\n\r\n            if (mPreventAction.get()){\r\n                if (System.currentTimeMillis() - mPreventActionTime.get() > ViewConfiguration.getDoubleTapTimeout()){\r\n                    mPreventAction.set(false);\r\n                } else {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return super.onTouchEvent(event);\r\n        } else {\r\n            return true;\r\n        }\r\n*/\r\n    }\r\n\r\n    private class GestureListener extends GestureDetector.SimpleOnGestureListener {\r\n        @Override\r\n        public boolean onDoubleTap(MotionEvent e) {\r\n        //    mPreventAction.set(true);\r\n        //    mPreventActionTime.set(System.currentTimeMillis());\r\n            return true;\r\n        }\r\n        @Override\r\n        public boolean onDoubleTapEvent(MotionEvent e) {\r\n        \tmDoubleTouch = true;\r\n        //    mPreventAction.set(true);\r\n        //    mPreventActionTime.set(System.currentTimeMillis());\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/listener/IOnConsumeFinishedListener.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine.billing.listener;\r\n\r\nimport android.util.Log;\r\n\r\nimport klb.android.GameEngine.billing.util.IabHelper.OnConsumeFinishedListener;\r\nimport klb.android.GameEngine.billing.util.IabResult;\r\nimport klb.android.GameEngine.billing.util.Purchase;\r\n\r\n\r\n/**\r\n * \r\n *  \r\n *\r\n */\r\npublic class IOnConsumeFinishedListener implements OnConsumeFinishedListener {\r\n\r\n\tprivate static final String kClassName = IOnConsumeFinishedListener.class.getSimpleName();\r\n\t\r\n\t//private BillingManager billingManager = null;\r\n\tPurchase purchase = null;\r\n\tpublic IOnConsumeFinishedListener(Purchase _purchase) {\r\n\t\t\r\n\t\tLog.d(kClassName, \"IOnConsumeFinishedListener\");\r\n\t\t\r\n\t\tthis.purchase = _purchase;\r\n\t}\r\n\r\n\tprivate void onConsumeFinishedError(IabResult result, Purchase purchase) {\r\n\t\tLog.e(kClassName, \"onConsumeFinishedError: \" + result.toString());\r\n\t\t\r\n\t\t// oh hell.. we are doomed. try again disparately?\r\n\t}\r\n\r\n\tprivate void onConsumeFinishedSuccess(Purchase purchase) {\r\n\t\tLog.e(kClassName, \"onConsumeFinishedSuccess: \" + purchase.toString());\r\n\t\t// 消費終了お疲れさま \r\n\t}\r\n\r\n\t\r\n\t@Override\r\n\tpublic void onConsumeFinished(Purchase purchase, IabResult result) {\r\n\t\t\r\n\t\tLog.d(kClassName, \"onConsumeFinished\");\r\n\t\t\r\n\t\tif (!result.isSuccess() || result.isFailure()) {\r\n\t\t\tLog.e(kClassName, \"Failure: \" + result.toString());\r\n\t\t\t\r\n\t\t\tonConsumeFinishedError(result, purchase);\r\n\t\t} else {\r\n\t\t\tonConsumeFinishedSuccess(purchase);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/listener/IOnIabPurchaseFinishedListener.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine.billing.listener;\r\n\r\nimport android.util.Log;\r\n\r\nimport klb.android.GameEngine.PFInterface;\r\nimport klb.android.GameEngine.billing.util.IabHelper.OnIabPurchaseFinishedListener;\r\nimport klb.android.GameEngine.billing.util.IabResult;\r\nimport klb.android.GameEngine.billing.util.Purchase;\r\n\r\n/**\r\n * \r\n *  \r\n * \r\n * bikking 課金処理（失敗／成功）インンターフェイス　リスナー\r\n *\r\n */\r\npublic class IOnIabPurchaseFinishedListener implements OnIabPurchaseFinishedListener {\r\n\r\n\tprivate static final String kClassName = IOnIabPurchaseFinishedListener.class.getSimpleName();\r\n\r\n\tprivate String sku = null;\r\n\t\r\n\tprivate void sendMessageFailed()\r\n\t{\r\n\t\tLog.d(kClassName, \"sendMessageFailed\");\r\n\t\tPFInterface.getInstance().clientControlEvent(\r\n\t\t\t\tPFInterface.E_STORE_FAILED, 0, this.sku,\"\");\r\n\t}\r\n\t\r\n\tprivate void sendMessagePurchasing()\r\n\t{\r\n\t\tLog.d(kClassName, \"sendMessagePurchasing\");\r\n\t\tPFInterface.getInstance().clientControlEvent(\r\n\t\t\t\tPFInterface.E_STORE_PURCHASHING, 0, this.sku, \"\");\r\n\t}\r\n\t\r\n\t// 購入処理途中の情報をLuaに返す処理を他の場所でも使うので、このインタフェースを公開しておく\r\n\tpublic static void sendMessagePurchased(String sku, Purchase purchase)\r\n\t{\r\n\t\tString data_str = purchase.toReceiptString();\r\n\t\t\r\n\t\t// デバッグ：内容確認\r\n\t\tLog.d(kClassName, \"Purchased\" + sku);\r\n\t\tLog.d(kClassName, \"Receipt:\\n\" + data_str);\r\n\t\r\n\t\tPFInterface.getInstance().clientControlEvent(\r\n\t\t\t\tPFInterface.E_STORE_PURCHASHED, 0, sku, data_str);\r\n\t}\r\n\t\r\n\tpublic IOnIabPurchaseFinishedListener(String _sku) {\r\n\t\t\r\n\t\tLog.d(kClassName, \"IOnIabPurchaseFinishedListener\");\r\n\t\t\r\n\t\tthis.sku = _sku;\r\n\r\n\t\tsendMessagePurchasing();\r\n\t}\r\n\t\r\n\tprivate void onIabPurchaseFinishedError(Purchase purchase) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tLog.d(kClassName, \"onIabPurchaseFinishedError\");\r\n\t\t// TODO Auto-generated method stub\r\n\t\tsendMessageFailed();\r\n\t}\r\n\r\n\r\n\tprivate void onIabPurchaseFinishedComplete(Purchase purchase) {\r\n\t\tLog.e(kClassName, \"onIabPurchaseFinishedComplete\");\r\n\r\n\t\tIOnIabPurchaseFinishedListener.sendMessagePurchased(this.sku, purchase);\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic void onIabPurchaseFinished(IabResult result, Purchase purchase) {\r\n\t\t\r\n\t\tLog.d(kClassName, \"onIabPurchaseFinished\");\r\n\t\t\r\n\t\tif (!result.isSuccess() || result.isFailure() || purchase == null) {\r\n\t\t\tLog.e(kClassName, \"Failure\");\r\n\t\t\t/*\r\n\t\t\t * ここに来るパターン:\r\n\t\t\t *  - 購入済みで未消費の商品を買おうとした場合\r\n\t\t\t *  \r\n\t\t\t *  2013/05/23\r\n\t\t\t */\r\n\t\t\t\r\n\t\t\tonIabPurchaseFinishedError(purchase);\r\n\t\t} else {\r\n\t\t\tonIabPurchaseFinishedComplete(purchase);\r\n\t\t}\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/listener/IOnIabSetupFinishedListener.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine.billing.listener;\r\n\r\nimport android.util.Log;\r\n\r\nimport klb.android.GameEngine.billing.util.IabHelper.OnIabSetupFinishedListener;\r\nimport klb.android.GameEngine.billing.util.IabResult;\r\n\r\n/**\r\n * \r\n *  \r\n * \r\n * billing setup 終了処理（失敗／成功）　インターフェイス　リスナー\r\n *\r\n */\r\npublic class IOnIabSetupFinishedListener implements OnIabSetupFinishedListener {\r\n\r\n\tprivate static final String kClassName = IOnIabSetupFinishedListener.class.getSimpleName();\r\n\r\n\tpublic IOnIabSetupFinishedListener() {\r\n\t\tLog.d(kClassName, \"IOnIabSetupFinishedListener\");\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic void onIabSetupFinished(IabResult result) {\r\n\r\n\t\tLog.d(kClassName, \"onIabSetupFinished\");\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/listener/IQueryInventoryFinishedListener.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine.billing.listener;\r\n\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\n\r\nimport org.json.JSONArray;\r\nimport org.json.JSONException;\r\nimport org.json.JSONObject;\r\n\r\nimport android.util.Log;\r\n\r\nimport klb.android.GameEngine.PFInterface;\r\nimport klb.android.GameEngine.billing.util.IabHelper.QueryInventoryFinishedListener;\r\nimport klb.android.GameEngine.billing.util.IabResult;\r\nimport klb.android.GameEngine.billing.util.Inventory;\r\nimport klb.android.GameEngine.billing.util.Purchase;\r\nimport klb.android.GameEngine.billing.util.SkuDetails;\r\n/**\r\n * \r\n *  \r\n *\r\n */\r\npublic class IQueryInventoryFinishedListener implements QueryInventoryFinishedListener {\r\n\r\n\tprivate static final String kClassName = IQueryInventoryFinishedListener.class.getSimpleName();\r\n\t\r\n\tprivate List<String> skuList = null;\r\n\t\r\n\tpublic IQueryInventoryFinishedListener(List<String> _skuList) {\r\n\t\tLog.d(kClassName, \"IQueryInventoryFinishedListener\");\r\n\t\t\r\n\t\tthis.skuList = _skuList;\r\n\t}\r\n\r\n\tprivate void onQueryInventoryError() {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tLog.d(kClassName, \"onQueryInventoryError\");\r\n\t}\r\n\r\n\tprivate void onQueryInventorySuccess(Inventory inventory) {\r\n\t\tJSONArray resultArray = new JSONArray();\r\n\t\tfor(Iterator<String> itr = this.skuList.iterator(); itr.hasNext();) {\r\n\t\t\tString sku = itr.next();\r\n\t\t\t\r\n\t\t\tif (inventory.hasDetails(sku)) {\r\n\t \t\t\tSkuDetails detail = inventory.getSkuDetails(sku);\r\n\t\t\t\tJSONObject obj    = new JSONObject();\r\n\r\n\t\t\t\ttry {\r\n\t\t\t\t\tobj.put(\"id\", detail.getSku());\r\n\t\t\t\t\tobj.put(\"price\", detail.getPrice());\r\n\t\t\t\t\tobj.put(\"description\", detail.getDescription());\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Google Playのアプリ名がtitleにくっついてきてしまっているので、\r\n\t\t\t\t\t * これをそのままクライアントに返すとiOSのtitleの内容と異なってしまう。\r\n\t\t\t\t\t * なので、()に含まれる文字列を削除する。\r\n\t\t\t\t\t * アプリ名・商品名設定にはこの点に留意する必要が有る。\r\n\t\t\t\t\t * GPを考慮した場合、商品名はアプリローカルから取った方がマシかもしれない - 2013/05/23\r\n\t\t\t\t\t */\r\n\t\t\t\t\tobj.put(\"title\", detail.getTitle().replaceAll(\"\\\\([^)]*\\\\)\", \"\").trim());\t\t\t\t\r\n\t\t\t\t\tresultArray.put(obj);\r\n\t\t\t\t} catch (JSONException e) {\r\n\t\t\t\t\tLog.e(kClassName, e.toString());\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tLog.i(kClassName, \"Invalid SKU: \" + sku);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tString resultStr = resultArray.toString();\r\n\t\t\r\n\t\tLog.i(kClassName, \"SKU Json: \" + resultStr);\r\n\t\tLog.i(kClassName, \"length: \" + resultStr.length());\r\n\r\n\t\tPFInterface.getInstance().clientControlEvent(\r\n\t\t\t\tPFInterface.E_STORE_GET_PRODUCTS, 0, resultStr, \"\");\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onQueryInventoryFinished(IabResult result, Inventory inventory) {\r\n\t\tLog.d(kClassName, \"onQueryInventoryFinished\");\r\n\t\tList<String> ownedItem = inventory.getAllOwnedSkus();\r\n\t\t\r\n\t\tfor(Iterator<String> itr = ownedItem.iterator(); itr.hasNext();) {\r\n\t\t\tString sku = itr.next();\r\n\t\t\tLog.w(kClassName, \"Pending(Owned) sku: \" + sku);\r\n\t\t\t\r\n\t\t\tPurchase pendingPurchase = inventory.getPurchase(sku);\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * 未消費のアイテムを中断されたトランザクションと見なして、\r\n\t\t\t * Luaに購入済み情報である事を返して問い合わせ処理させる。\r\n\t\t\t * iOSのporting layerと挙動を合わせるため\r\n\t\t\t */\r\n\t\t\tIOnIabPurchaseFinishedListener.sendMessagePurchased(sku, pendingPurchase);\r\n\t\t}\r\n\r\n\t\tif (!result.isSuccess() || result.isFailure()) {\r\n\t\t\tLog.e(kClassName, \"Failure\");\r\n\t\t\t\r\n\t\t\tonQueryInventoryError();\r\n\t\t} else {\r\n\t\t\tonQueryInventorySuccess(inventory);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/manager/BillingManager.java",
    "content": "/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\npackage klb.android.GameEngine.billing.manager;\r\n\r\nimport java.util.List;\r\n\r\nimport klb.android.GameEngine.PFInterface;\r\n\r\nimport klb.android.GameEngine.billing.util.IabHelper;\r\nimport klb.android.GameEngine.billing.util.Purchase;\r\n\r\nimport android.content.pm.PackageManager;\r\nimport android.content.pm.ResolveInfo;\r\n\r\nimport android.app.Activity;\r\nimport android.content.Intent;\r\nimport android.util.Log;\r\n\r\nimport klb.android.GameEngine.billing.listener.IOnIabSetupFinishedListener;\r\nimport klb.android.GameEngine.billing.listener.IQueryInventoryFinishedListener;\r\nimport klb.android.GameEngine.billing.listener.IOnConsumeFinishedListener;\r\nimport klb.android.GameEngine.billing.listener.IOnIabPurchaseFinishedListener;\r\n/**\r\n * \r\n *  \r\n *\r\n */\r\npublic class BillingManager {\r\n\t\r\n\tprivate static final String kClassName = BillingManager.class.getSimpleName();\r\n\t\r\n\tprivate Activity activity = null;\r\n\tprivate IabHelper iabHelper = null;\r\n\tprivate static BillingManager billingManager = null;\r\n\r\n\tpublic static BillingManager getInstance(Activity context) {\r\n\t\tBillingManager.init(context);\r\n\t\treturn billingManager;\r\n\t}\r\n\t\r\n\tprivate boolean isBillingAvailable() {\r\n\t\t/*\r\n\t\t *  Manifestが正しく設定されていてもIntentが使えない状況が存在する:\r\n\t\t *   - 端末初期化後に一度もGoogle Playを開いてない状態でapkをadb installして起動した場合\r\n\t\t *\r\n\t\t *  2013/5/23\r\n\t\t */\r\n\t\t\r\n\t    final PackageManager packageManager = this.activity.getPackageManager();\r\n\t    final Intent intent = new Intent(\"com.android.vending.billing.InAppBillingService.BIND\");\r\n\t    List<ResolveInfo> list = packageManager.queryIntentServices(intent, 0);\r\n\t    return list.size() > 0;\r\n\t}\r\n\t\r\n\tprivate BillingManager(Activity context) {\r\n\t\tLog.d(kClassName, \"BillingManager\");\r\n\t\t\r\n\t\tthis.activity  = context;\r\n\t\tthis.iabHelper = new IabHelper(this.activity);\r\n\t\t\r\n\t\tthis.iabHelper.enableDebugLogging(true); // TODO : Production is false : Debug is true\r\n\t\t\r\n\t\tif (!isBillingAvailable()) {\r\n\t\t\tPFInterface.startAlertDialog(\"課金制限\", \"Google Playアカウントを確認してください\");\r\n\t\t} else {\r\n\t\t\tthis.iabHelper.startSetup(new IOnIabSetupFinishedListener());\r\n\t\t}\r\n\t}\r\n\t\r\n\t// INIT\r\n\tpublic static void init(Activity context) {\r\n\t\tif (billingManager == null)  {\r\n\t\t\tbillingManager = new BillingManager(context);\r\n\t\t}\r\n\t\t\r\n\t\t//Handler handler = new Handler();\r\n\t}\r\n\t// GET_PRODUCTS\r\n\tpublic void requestGetProducts(List<String> skuList) {\r\n\t\tthis.iabHelper.queryInventoryAsync(\r\n\t\t\t\ttrue,\r\n\t\t\t\tskuList,\r\n\t\t\t\tnew IQueryInventoryFinishedListener(skuList));\r\n\t}\r\n\r\n\t// FINISH_TRANSACTION\r\n\tpublic void requestConsume(String receipt) {\r\n\t\tPurchase purchase = Purchase.fromReceiptString(receipt);\r\n\t\tthis.iabHelper.consumeAsync(\r\n\t\t\t\tpurchase,\r\n\t\t\t\tnew IOnConsumeFinishedListener(purchase));\r\n\t}\r\n\t\r\n\t// BUY_ITEM\r\n\tpublic void requestBuy(String sku) {\r\n\t\tint requestCode = 4649;\r\n\t\tthis.iabHelper.launchPurchaseFlow(\r\n\t\t\t\tsku,\r\n\t\t\t\trequestCode,\r\n\t\t\t\tnew IOnIabPurchaseFinishedListener(sku));\r\n\t}\r\n\r\n\t// RELEASE\r\n\tpublic static void requestTerminate()\r\n\t{\r\n\t\tif (billingManager != null) {\r\n\t\t\tif (billingManager.iabHelper != null){\r\n\t\t\t\tbillingManager.iabHelper.dispose();\r\n\t\t\t\tbillingManager.iabHelper = null;\r\n\t\t\t}\r\n\t\t\tbillingManager = null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic boolean onActivityResult(int requestCode, int resultCode, Intent data)\r\n\t{\r\n\t\treturn this.iabHelper.handleActivityResult(requestCode, resultCode, data);\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/Base64.java",
    "content": "// Portions copyright 2002, Google, Inc.\r\n//\r\n// Licensed under the Apache License, Version 2.0 (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n//     http://www.apache.org/licenses/LICENSE-2.0\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\n// This code was converted from code at http://iharder.sourceforge.net/base64/\r\n// Lots of extraneous features were removed.\r\n/* The original code said:\r\n * <p>\r\n * I am placing this code in the Public Domain. Do with it as you will.\r\n * This software comes with no guarantees or warranties but with\r\n * plenty of well-wishing instead!\r\n * Please visit\r\n * <a href=\"http://iharder.net/xmlizable\">http://iharder.net/xmlizable</a>\r\n * periodically to check for updates or to contribute improvements.\r\n * </p>\r\n *\r\n * @author Robert Harder\r\n * @author rharder@usa.net\r\n * @version 1.3\r\n */\r\n\r\n/**\r\n * Base64 converter class. This code is not a complete MIME encoder;\r\n * it simply converts binary data to base64 data and back.\r\n *\r\n * <p>Note {@link CharBase64} is a GWT-compatible implementation of this\r\n * class.\r\n */\r\npublic class Base64 {\r\n    /** Specify encoding (value is {@code true}). */\r\n    public final static boolean ENCODE = true;\r\n\r\n    /** Specify decoding (value is {@code false}). */\r\n    public final static boolean DECODE = false;\r\n\r\n    /** The equals sign (=) as a byte. */\r\n    private final static byte EQUALS_SIGN = (byte) '=';\r\n\r\n    /** The new line character (\\n) as a byte. */\r\n    private final static byte NEW_LINE = (byte) '\\n';\r\n\r\n    /**\r\n     * The 64 valid Base64 values.\r\n     */\r\n    private final static byte[] ALPHABET =\r\n        {(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F',\r\n        (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K',\r\n        (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P',\r\n        (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',\r\n        (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z',\r\n        (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e',\r\n        (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j',\r\n        (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o',\r\n        (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't',\r\n        (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y',\r\n        (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3',\r\n        (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8',\r\n        (byte) '9', (byte) '+', (byte) '/'};\r\n\r\n    /**\r\n     * The 64 valid web safe Base64 values.\r\n     */\r\n    private final static byte[] WEBSAFE_ALPHABET =\r\n        {(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F',\r\n        (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K',\r\n        (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P',\r\n        (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',\r\n        (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z',\r\n        (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e',\r\n        (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j',\r\n        (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o',\r\n        (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't',\r\n        (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y',\r\n        (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3',\r\n        (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8',\r\n        (byte) '9', (byte) '-', (byte) '_'};\r\n\r\n    /**\r\n     * Translates a Base64 value to either its 6-bit reconstruction value\r\n     * or a negative number indicating some other meaning.\r\n     **/\r\n    private final static byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal  0 -  8\r\n        -5, -5, // Whitespace: Tab and Linefeed\r\n        -9, -9, // Decimal 11 - 12\r\n        -5, // Whitespace: Carriage Return\r\n        -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26\r\n        -9, -9, -9, -9, -9, // Decimal 27 - 31\r\n        -5, // Whitespace: Space\r\n        -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42\r\n        62, // Plus sign at decimal 43\r\n        -9, -9, -9, // Decimal 44 - 46\r\n        63, // Slash at decimal 47\r\n        52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine\r\n        -9, -9, -9, // Decimal 58 - 60\r\n        -1, // Equals sign at decimal 61\r\n        -9, -9, -9, // Decimal 62 - 64\r\n        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N'\r\n        14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z'\r\n        -9, -9, -9, -9, -9, -9, // Decimal 91 - 96\r\n        26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm'\r\n        39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z'\r\n        -9, -9, -9, -9, -9 // Decimal 123 - 127\r\n        /*  ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 128 - 139\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 140 - 152\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 153 - 165\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 166 - 178\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 179 - 191\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 192 - 204\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 205 - 217\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 218 - 230\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 231 - 243\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9         // Decimal 244 - 255 */\r\n    };\r\n\r\n    /** The web safe decodabet */\r\n    private final static byte[] WEBSAFE_DECODABET =\r\n        {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal  0 -  8\r\n        -5, -5, // Whitespace: Tab and Linefeed\r\n        -9, -9, // Decimal 11 - 12\r\n        -5, // Whitespace: Carriage Return\r\n        -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26\r\n        -9, -9, -9, -9, -9, // Decimal 27 - 31\r\n        -5, // Whitespace: Space\r\n        -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 44\r\n        62, // Dash '-' sign at decimal 45\r\n        -9, -9, // Decimal 46-47\r\n        52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine\r\n        -9, -9, -9, // Decimal 58 - 60\r\n        -1, // Equals sign at decimal 61\r\n        -9, -9, -9, // Decimal 62 - 64\r\n        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N'\r\n        14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z'\r\n        -9, -9, -9, -9, // Decimal 91-94\r\n        63, // Underscore '_' at decimal 95\r\n        -9, // Decimal 96\r\n        26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm'\r\n        39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z'\r\n        -9, -9, -9, -9, -9 // Decimal 123 - 127\r\n        /*  ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 128 - 139\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 140 - 152\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 153 - 165\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 166 - 178\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 179 - 191\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 192 - 204\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 205 - 217\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 218 - 230\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 231 - 243\r\n        -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9         // Decimal 244 - 255 */\r\n        };\r\n\r\n    // Indicates white space in encoding\r\n    private final static byte WHITE_SPACE_ENC = -5;\r\n    // Indicates equals sign in encoding\r\n    private final static byte EQUALS_SIGN_ENC = -1;\r\n\r\n    /** Defeats instantiation. */\r\n    private Base64() {\r\n    }\r\n\r\n    /* ********  E N C O D I N G   M E T H O D S  ******** */\r\n\r\n    /**\r\n     * Encodes up to three bytes of the array <var>source</var>\r\n     * and writes the resulting four Base64 bytes to <var>destination</var>.\r\n     * The source and destination arrays can be manipulated\r\n     * anywhere along their length by specifying\r\n     * <var>srcOffset</var> and <var>destOffset</var>.\r\n     * This method does not check to make sure your arrays\r\n     * are large enough to accommodate <var>srcOffset</var> + 3 for\r\n     * the <var>source</var> array or <var>destOffset</var> + 4 for\r\n     * the <var>destination</var> array.\r\n     * The actual number of significant bytes in your array is\r\n     * given by <var>numSigBytes</var>.\r\n     *\r\n     * @param source the array to convert\r\n     * @param srcOffset the index where conversion begins\r\n     * @param numSigBytes the number of significant bytes in your array\r\n     * @param destination the array to hold the conversion\r\n     * @param destOffset the index where output will be put\r\n     * @param alphabet is the encoding alphabet\r\n     * @return the <var>destination</var> array\r\n     * @since 1.3\r\n     */\r\n    private static byte[] encode3to4(byte[] source, int srcOffset,\r\n            int numSigBytes, byte[] destination, int destOffset, byte[] alphabet) {\r\n        //           1         2         3\r\n        // 01234567890123456789012345678901 Bit position\r\n        // --------000000001111111122222222 Array position from threeBytes\r\n        // --------|    ||    ||    ||    | Six bit groups to index alphabet\r\n        //          >>18  >>12  >> 6  >> 0  Right shift necessary\r\n        //                0x3f  0x3f  0x3f  Additional AND\r\n\r\n        // Create buffer with zero-padding if there are only one or two\r\n        // significant bytes passed in the array.\r\n        // We have to shift left 24 in order to flush out the 1's that appear\r\n        // when Java treats a value as negative that is cast from a byte to an int.\r\n        int inBuff =\r\n                (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0)\r\n                | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0)\r\n                | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0);\r\n\r\n        switch (numSigBytes) {\r\n            case 3:\r\n                destination[destOffset] = alphabet[(inBuff >>> 18)];\r\n                destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f];\r\n                destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f];\r\n                destination[destOffset + 3] = alphabet[(inBuff) & 0x3f];\r\n                return destination;\r\n            case 2:\r\n                destination[destOffset] = alphabet[(inBuff >>> 18)];\r\n                destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f];\r\n                destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f];\r\n                destination[destOffset + 3] = EQUALS_SIGN;\r\n                return destination;\r\n            case 1:\r\n                destination[destOffset] = alphabet[(inBuff >>> 18)];\r\n                destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f];\r\n                destination[destOffset + 2] = EQUALS_SIGN;\r\n                destination[destOffset + 3] = EQUALS_SIGN;\r\n                return destination;\r\n            default:\r\n                return destination;\r\n        } // end switch\r\n    } // end encode3to4\r\n\r\n    /**\r\n     * Encodes a byte array into Base64 notation.\r\n     * Equivalent to calling\r\n     * {@code encodeBytes(source, 0, source.length)}\r\n     *\r\n     * @param source The data to convert\r\n     * @since 1.4\r\n     */\r\n    public static String encode(byte[] source) {\r\n        return encode(source, 0, source.length, ALPHABET, true);\r\n    }\r\n\r\n    /**\r\n     * Encodes a byte array into web safe Base64 notation.\r\n     *\r\n     * @param source The data to convert\r\n     * @param doPadding is {@code true} to pad result with '=' chars\r\n     *        if it does not fall on 3 byte boundaries\r\n     */\r\n    public static String encodeWebSafe(byte[] source, boolean doPadding) {\r\n        return encode(source, 0, source.length, WEBSAFE_ALPHABET, doPadding);\r\n    }\r\n\r\n    /**\r\n     * Encodes a byte array into Base64 notation.\r\n     *\r\n     * @param source the data to convert\r\n     * @param off offset in array where conversion should begin\r\n     * @param len length of data to convert\r\n     * @param alphabet the encoding alphabet\r\n     * @param doPadding is {@code true} to pad result with '=' chars\r\n     * if it does not fall on 3 byte boundaries\r\n     * @since 1.4\r\n     */\r\n    public static String encode(byte[] source, int off, int len, byte[] alphabet,\r\n            boolean doPadding) {\r\n        byte[] outBuff = encode(source, off, len, alphabet, Integer.MAX_VALUE);\r\n        int outLen = outBuff.length;\r\n\r\n        // If doPadding is false, set length to truncate '='\r\n        // padding characters\r\n        while (doPadding == false && outLen > 0) {\r\n            if (outBuff[outLen - 1] != '=') {\r\n                break;\r\n            }\r\n            outLen -= 1;\r\n        }\r\n\r\n        return new String(outBuff, 0, outLen);\r\n    }\r\n\r\n    /**\r\n     * Encodes a byte array into Base64 notation.\r\n     *\r\n     * @param source the data to convert\r\n     * @param off offset in array where conversion should begin\r\n     * @param len length of data to convert\r\n     * @param alphabet is the encoding alphabet\r\n     * @param maxLineLength maximum length of one line.\r\n     * @return the BASE64-encoded byte array\r\n     */\r\n    public static byte[] encode(byte[] source, int off, int len, byte[] alphabet,\r\n            int maxLineLength) {\r\n        int lenDiv3 = (len + 2) / 3; // ceil(len / 3)\r\n        int len43 = lenDiv3 * 4;\r\n        byte[] outBuff = new byte[len43 // Main 4:3\r\n                                  + (len43 / maxLineLength)]; // New lines\r\n\r\n        int d = 0;\r\n        int e = 0;\r\n        int len2 = len - 2;\r\n        int lineLength = 0;\r\n        for (; d < len2; d += 3, e += 4) {\r\n\r\n            // The following block of code is the same as\r\n            // encode3to4( source, d + off, 3, outBuff, e, alphabet );\r\n            // but inlined for faster encoding (~20% improvement)\r\n            int inBuff =\r\n                    ((source[d + off] << 24) >>> 8)\r\n                    | ((source[d + 1 + off] << 24) >>> 16)\r\n                    | ((source[d + 2 + off] << 24) >>> 24);\r\n            outBuff[e] = alphabet[(inBuff >>> 18)];\r\n            outBuff[e + 1] = alphabet[(inBuff >>> 12) & 0x3f];\r\n            outBuff[e + 2] = alphabet[(inBuff >>> 6) & 0x3f];\r\n            outBuff[e + 3] = alphabet[(inBuff) & 0x3f];\r\n\r\n            lineLength += 4;\r\n            if (lineLength == maxLineLength) {\r\n                outBuff[e + 4] = NEW_LINE;\r\n                e++;\r\n                lineLength = 0;\r\n            } // end if: end of line\r\n        } // end for: each piece of array\r\n\r\n        if (d < len) {\r\n            encode3to4(source, d + off, len - d, outBuff, e, alphabet);\r\n\r\n            lineLength += 4;\r\n            if (lineLength == maxLineLength) {\r\n                // Add a last newline\r\n                outBuff[e + 4] = NEW_LINE;\r\n                e++;\r\n            }\r\n            e += 4;\r\n        }\r\n\r\n        assert (e == outBuff.length);\r\n        return outBuff;\r\n    }\r\n\r\n\r\n    /* ********  D E C O D I N G   M E T H O D S  ******** */\r\n\r\n\r\n    /**\r\n     * Decodes four bytes from array <var>source</var>\r\n     * and writes the resulting bytes (up to three of them)\r\n     * to <var>destination</var>.\r\n     * The source and destination arrays can be manipulated\r\n     * anywhere along their length by specifying\r\n     * <var>srcOffset</var> and <var>destOffset</var>.\r\n     * This method does not check to make sure your arrays\r\n     * are large enough to accommodate <var>srcOffset</var> + 4 for\r\n     * the <var>source</var> array or <var>destOffset</var> + 3 for\r\n     * the <var>destination</var> array.\r\n     * This method returns the actual number of bytes that\r\n     * were converted from the Base64 encoding.\r\n     *\r\n     *\r\n     * @param source the array to convert\r\n     * @param srcOffset the index where conversion begins\r\n     * @param destination the array to hold the conversion\r\n     * @param destOffset the index where output will be put\r\n     * @param decodabet the decodabet for decoding Base64 content\r\n     * @return the number of decoded bytes converted\r\n     * @since 1.3\r\n     */\r\n    private static int decode4to3(byte[] source, int srcOffset,\r\n            byte[] destination, int destOffset, byte[] decodabet) {\r\n        // Example: Dk==\r\n        if (source[srcOffset + 2] == EQUALS_SIGN) {\r\n            int outBuff =\r\n                    ((decodabet[source[srcOffset]] << 24) >>> 6)\r\n                    | ((decodabet[source[srcOffset + 1]] << 24) >>> 12);\r\n\r\n            destination[destOffset] = (byte) (outBuff >>> 16);\r\n            return 1;\r\n        } else if (source[srcOffset + 3] == EQUALS_SIGN) {\r\n            // Example: DkL=\r\n            int outBuff =\r\n                    ((decodabet[source[srcOffset]] << 24) >>> 6)\r\n                    | ((decodabet[source[srcOffset + 1]] << 24) >>> 12)\r\n                    | ((decodabet[source[srcOffset + 2]] << 24) >>> 18);\r\n\r\n            destination[destOffset] = (byte) (outBuff >>> 16);\r\n            destination[destOffset + 1] = (byte) (outBuff >>> 8);\r\n            return 2;\r\n        } else {\r\n            // Example: DkLE\r\n            int outBuff =\r\n                    ((decodabet[source[srcOffset]] << 24) >>> 6)\r\n                    | ((decodabet[source[srcOffset + 1]] << 24) >>> 12)\r\n                    | ((decodabet[source[srcOffset + 2]] << 24) >>> 18)\r\n                    | ((decodabet[source[srcOffset + 3]] << 24) >>> 24);\r\n\r\n            destination[destOffset] = (byte) (outBuff >> 16);\r\n            destination[destOffset + 1] = (byte) (outBuff >> 8);\r\n            destination[destOffset + 2] = (byte) (outBuff);\r\n            return 3;\r\n        }\r\n    } // end decodeToBytes\r\n\r\n\r\n    /**\r\n     * Decodes data from Base64 notation.\r\n     *\r\n     * @param s the string to decode (decoded in default encoding)\r\n     * @return the decoded data\r\n     * @since 1.4\r\n     */\r\n    public static byte[] decode(String s) throws Base64DecoderException {\r\n        byte[] bytes = s.getBytes();\r\n        return decode(bytes, 0, bytes.length);\r\n    }\r\n\r\n    /**\r\n     * Decodes data from web safe Base64 notation.\r\n     * Web safe encoding uses '-' instead of '+', '_' instead of '/'\r\n     *\r\n     * @param s the string to decode (decoded in default encoding)\r\n     * @return the decoded data\r\n     */\r\n    public static byte[] decodeWebSafe(String s) throws Base64DecoderException {\r\n        byte[] bytes = s.getBytes();\r\n        return decodeWebSafe(bytes, 0, bytes.length);\r\n    }\r\n\r\n    /**\r\n     * Decodes Base64 content in byte array format and returns\r\n     * the decoded byte array.\r\n     *\r\n     * @param source The Base64 encoded data\r\n     * @return decoded data\r\n     * @since 1.3\r\n     * @throws Base64DecoderException\r\n     */\r\n    public static byte[] decode(byte[] source) throws Base64DecoderException {\r\n        return decode(source, 0, source.length);\r\n    }\r\n\r\n    /**\r\n     * Decodes web safe Base64 content in byte array format and returns\r\n     * the decoded data.\r\n     * Web safe encoding uses '-' instead of '+', '_' instead of '/'\r\n     *\r\n     * @param source the string to decode (decoded in default encoding)\r\n     * @return the decoded data\r\n     */\r\n    public static byte[] decodeWebSafe(byte[] source)\r\n            throws Base64DecoderException {\r\n        return decodeWebSafe(source, 0, source.length);\r\n    }\r\n\r\n    /**\r\n     * Decodes Base64 content in byte array format and returns\r\n     * the decoded byte array.\r\n     *\r\n     * @param source the Base64 encoded data\r\n     * @param off    the offset of where to begin decoding\r\n     * @param len    the length of characters to decode\r\n     * @return decoded data\r\n     * @since 1.3\r\n     * @throws Base64DecoderException\r\n     */\r\n    public static byte[] decode(byte[] source, int off, int len)\r\n            throws Base64DecoderException {\r\n        return decode(source, off, len, DECODABET);\r\n    }\r\n\r\n    /**\r\n     * Decodes web safe Base64 content in byte array format and returns\r\n     * the decoded byte array.\r\n     * Web safe encoding uses '-' instead of '+', '_' instead of '/'\r\n     *\r\n     * @param source the Base64 encoded data\r\n     * @param off    the offset of where to begin decoding\r\n     * @param len    the length of characters to decode\r\n     * @return decoded data\r\n     */\r\n    public static byte[] decodeWebSafe(byte[] source, int off, int len)\r\n            throws Base64DecoderException {\r\n        return decode(source, off, len, WEBSAFE_DECODABET);\r\n    }\r\n\r\n    /**\r\n     * Decodes Base64 content using the supplied decodabet and returns\r\n     * the decoded byte array.\r\n     *\r\n     * @param source the Base64 encoded data\r\n     * @param off the offset of where to begin decoding\r\n     * @param len the length of characters to decode\r\n     * @param decodabet the decodabet for decoding Base64 content\r\n     * @return decoded data\r\n     */\r\n    public static byte[] decode(byte[] source, int off, int len, byte[] decodabet)\r\n            throws Base64DecoderException {\r\n        int len34 = len * 3 / 4;\r\n        byte[] outBuff = new byte[2 + len34]; // Upper limit on size of output\r\n        int outBuffPosn = 0;\r\n\r\n        byte[] b4 = new byte[4];\r\n        int b4Posn = 0;\r\n        int i = 0;\r\n        byte sbiCrop = 0;\r\n        byte sbiDecode = 0;\r\n        for (i = 0; i < len; i++) {\r\n            sbiCrop = (byte) (source[i + off] & 0x7f); // Only the low seven bits\r\n            sbiDecode = decodabet[sbiCrop];\r\n\r\n            if (sbiDecode >= WHITE_SPACE_ENC) { // White space Equals sign or better\r\n                if (sbiDecode >= EQUALS_SIGN_ENC) {\r\n                    // An equals sign (for padding) must not occur at position 0 or 1\r\n                    // and must be the last byte[s] in the encoded value\r\n                    if (sbiCrop == EQUALS_SIGN) {\r\n                        int bytesLeft = len - i;\r\n                        byte lastByte = (byte) (source[len - 1 + off] & 0x7f);\r\n                        if (b4Posn == 0 || b4Posn == 1) {\r\n                            throw new Base64DecoderException(\r\n                                    \"invalid padding byte '=' at byte offset \" + i);\r\n                        } else if ((b4Posn == 3 && bytesLeft > 2)\r\n                                || (b4Posn == 4 && bytesLeft > 1)) {\r\n                            throw new Base64DecoderException(\r\n                                    \"padding byte '=' falsely signals end of encoded value \"\r\n                                            + \"at offset \" + i);\r\n                        } else if (lastByte != EQUALS_SIGN && lastByte != NEW_LINE) {\r\n                            throw new Base64DecoderException(\r\n                                    \"encoded value has invalid trailing byte\");\r\n                        }\r\n                        break;\r\n                    }\r\n\r\n                    b4[b4Posn++] = sbiCrop;\r\n                    if (b4Posn == 4) {\r\n                        outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet);\r\n                        b4Posn = 0;\r\n                    }\r\n                }\r\n            } else {\r\n                throw new Base64DecoderException(\"Bad Base64 input character at \" + i\r\n                        + \": \" + source[i + off] + \"(decimal)\");\r\n            }\r\n        }\r\n\r\n        // Because web safe encoding allows non padding base64 encodes, we\r\n        // need to pad the rest of the b4 buffer with equal signs when\r\n        // b4Posn != 0.  There can be at most 2 equal signs at the end of\r\n        // four characters, so the b4 buffer must have two or three\r\n        // characters.  This also catches the case where the input is\r\n        // padded with EQUALS_SIGN\r\n        if (b4Posn != 0) {\r\n            if (b4Posn == 1) {\r\n                throw new Base64DecoderException(\"single trailing character at offset \"\r\n                        + (len - 1));\r\n            }\r\n            b4[b4Posn++] = EQUALS_SIGN;\r\n            outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet);\r\n        }\r\n\r\n        byte[] out = new byte[outBuffPosn];\r\n        System.arraycopy(outBuff, 0, out, 0, outBuffPosn);\r\n        return out;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/Base64DecoderException.java",
    "content": "// Copyright 2002, Google, Inc.\r\n//\r\n// Licensed under the Apache License, Version 2.0 (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n//     http://www.apache.org/licenses/LICENSE-2.0\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\n/**\r\n * Exception thrown when encountering an invalid Base64 input character.\r\n *\r\n * @author nelson\r\n */\r\npublic class Base64DecoderException extends Exception {\r\n    public Base64DecoderException() {\r\n        super();\r\n    }\r\n\r\n    public Base64DecoderException(String s) {\r\n        super(s);\r\n    }\r\n\r\n    private static final long serialVersionUID = 1L;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/IabException.java",
    "content": "/* Copyright (c) 2012 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\n/**\r\n * Exception thrown when something went wrong with in-app billing.\r\n * An IabException has an associated IabResult (an error).\r\n * To get the IAB result that caused this exception to be thrown,\r\n * call {@link #getResult()}.\r\n */\r\npublic class IabException extends Exception {\r\n    /**\r\n\t * \r\n\t */\r\n\tprivate static final long serialVersionUID = 1L;\r\n\t\r\n\tIabResult mResult;\r\n\r\n    public IabException(IabResult r) {\r\n        this(r, null);\r\n    }\r\n    public IabException(int response, String message) {\r\n        this(new IabResult(response, message));\r\n    }\r\n    public IabException(IabResult r, Exception cause) {\r\n        super(r.getMessage(), cause);\r\n        mResult = r;\r\n    }\r\n    public IabException(int response, String message, Exception cause) {\r\n        this(new IabResult(response, message), cause);\r\n    }\r\n\r\n    /** Returns the IAB result (error) that this exception signals. */\r\n    public IabResult getResult() { return mResult; }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/IabHelper.java",
    "content": "/* Copyright (c) 2012 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\nimport android.app.Activity;\r\nimport android.app.PendingIntent;\r\nimport android.content.ComponentName;\r\nimport android.content.Context;\r\nimport android.content.Intent;\r\nimport android.content.IntentSender.SendIntentException;\r\nimport android.content.ServiceConnection;\r\nimport android.os.Bundle;\r\nimport android.os.IBinder;\r\nimport android.os.RemoteException;\r\nimport android.text.TextUtils;\r\nimport android.util.Log;\r\n\r\nimport com.android.vending.billing.IInAppBillingService;\r\n\r\nimport org.json.JSONException;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nimport klb.android.GameEngine.PFInterface;\r\n\r\n\r\n/**\r\n * Provides convenience methods for in-app billing. Create one instance of this\r\n * class for your application and use it to process in-app billing operations.\r\n * It provides synchronous (blocking) and asynchronous (non-blocking) methods for\r\n * many common in-app billing operations, as well as automatic signature\r\n * verification.\r\n *\r\n * After instantiating, you must perform setup in order to start using the object.\r\n * To perform setup, call the {@link #startSetup} method and provide a listener;\r\n * that listener will be notified when setup is complete, after which (and not before)\r\n * you may call other methods.\r\n *\r\n * After setup is complete, you may query whether the user owns a given item or\r\n * not by calling {@link #isOwned}, get all items owned with {@link #getOwnedSkus},\r\n * get an item's price with {@link #getPrice}, amongst others (see documentation\r\n * for specific methods).\r\n *\r\n * Please notice that the object will only have knowledge about owned items; it\r\n * will not automatically have information (such as price, description) for items\r\n * that are not owned by the user, because the server will not automatically\r\n * provide those. In order to query information for an item that's not owned\r\n * (such as to display the price to the user before a purchase), you should first\r\n * bring the item's sku to the object's knowledge by calling {@link #addSku}\r\n * and then perform an inventory refresh by calling {@link #refreshInventory()}\r\n * or its corresponding asynchronous version {@link #refreshInventoryAsync}.\r\n *\r\n * If you know the skus of all the items that you can possibly be interested in,\r\n * you can call {@link #addSku} for those items before {@link #startSetup}, and\r\n * that way all the information about them will be available from the start,\r\n * with no need to refresh the inventory later.\r\n *\r\n * When you are done with this object, don't forget to call {@link #dispose}\r\n * to ensure proper cleanup. This object holds a binding to the in-app billing\r\n * service, which will leak unless you dispose of it correctly. If you created\r\n * the object on an Activity's onCreate method, then the recommended\r\n * place to dispose of it is the Activity's onDestroy method.\r\n *\r\n * A note about threading: When using this object from a background thread, you may\r\n * call the blocking versions of methods; when using from a UI thread, call\r\n * only the asynchronous versions and handle the results via callbacks.\r\n * Also, notice that you can only call one asynchronous operation at a time;\r\n * attempting to start a second asynchronous operation while the first one\r\n * has not yet completed will result in an exception being thrown.\r\n *\r\n * @author Bruno Oliveira (Google)\r\n *\r\n */\r\npublic class IabHelper {\r\n    // Is debug logging enabled?\r\n    boolean mDebugLog = false;\r\n    String mDebugTag = \"IabHelper\";\r\n\r\n    // Is setup done?\r\n    volatile boolean mSetupDone = false;\r\n\r\n    // Is an asynchronous operation in progress?\r\n    // (only one at a time can be in progress)\r\n    volatile boolean mAsyncInProgress = false;\r\n\r\n    // (for logging/debugging)\r\n    // if mAsyncInProgress == true, what asynchronous operation is in progress?\r\n    volatile String mAsyncOperation = \"\";\r\n\r\n    // Context we were passed during initialization\r\n    Activity mActivity;\r\n\r\n    // Connection to the service\r\n    IInAppBillingService mService;\r\n    ServiceConnection mServiceConn;\r\n\r\n    // The request code used to launch purchase flow\r\n    volatile int mRequestCode;\r\n\r\n    // Billing response codes\r\n    public static final int BILLING_RESPONSE_RESULT_OK = 0;\r\n    public static final int BILLING_RESPONSE_RESULT_USER_CANCELED = 1;\r\n    public static final int BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE = 3;\r\n    public static final int BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE = 4;\r\n    public static final int BILLING_RESPONSE_RESULT_DEVELOPER_ERROR = 5;\r\n    public static final int BILLING_RESPONSE_RESULT_ERROR = 6;\r\n    public static final int BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED = 7;\r\n    public static final int BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED = 8;\r\n\r\n    // IAB Helper error codes\r\n    public static final int IABHELPER_ERROR_BASE = -1000;\r\n    public static final int IABHELPER_REMOTE_EXCEPTION = -1001;\r\n    public static final int IABHELPER_BAD_RESPONSE = -1002;\r\n    public static final int IABHELPER_VERIFICATION_FAILED = -1003;\r\n    public static final int IABHELPER_SEND_INTENT_FAILED = -1004;\r\n    public static final int IABHELPER_USER_CANCELLED = -1005;\r\n    public static final int IABHELPER_UNKNOWN_PURCHASE_RESPONSE = -1006;\r\n    public static final int IABHELPER_MISSING_TOKEN = -1007;\r\n    public static final int IABHELPER_UNKNOWN_ERROR = -1008;\r\n\r\n    // Keys for the responses from InAppBillingService\r\n    public static final String RESPONSE_CODE = \"RESPONSE_CODE\";\r\n    public static final String RESPONSE_GET_SKU_DETAILS_LIST = \"DETAILS_LIST\";\r\n    public static final String RESPONSE_BUY_INTENT = \"BUY_INTENT\";\r\n    public static final String RESPONSE_INAPP_PURCHASE_DATA = \"INAPP_PURCHASE_DATA\";\r\n    public static final String RESPONSE_INAPP_SIGNATURE = \"INAPP_DATA_SIGNATURE\";\r\n    public static final String RESPONSE_INAPP_ITEM_LIST = \"INAPP_PURCHASE_ITEM_LIST\";\r\n    public static final String RESPONSE_INAPP_PURCHASE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";\r\n    public static final String RESPONSE_INAPP_SIGNATURE_LIST = \"INAPP_DATA_SIGNATURE_LIST\";\r\n    public static final String INAPP_CONTINUATION_TOKEN = \"INAPP_CONTINUATION_TOKEN\";\r\n\r\n    // Item type: in-app item\r\n    public static final String ITEM_TYPE_INAPP = \"inapp\";\r\n\r\n    // some fields on the getSkuDetails response bundle\r\n    public static final String GET_SKU_DETAILS_ITEM_LIST = \"ITEM_ID_LIST\";\r\n    public static final String GET_SKU_DETAILS_ITEM_TYPE_LIST = \"ITEM_TYPE_LIST\";\r\n\r\n    /**\r\n     * Creates an instance. After creation, it will not yet be ready to use. You must perform\r\n     * setup by calling {@link #startSetup} and wait for setup to complete. This constructor does not\r\n     * block and is safe to call from a UI thread.\r\n     *\r\n     * @param ctx Your application or Activity context. Needed to bind to the in-app billing service.\r\n     */\r\n    public IabHelper(Activity act) {\r\n        mActivity = act;//.getctx.getApplicationContext();\r\n\r\n        logDebug(\"IAB helper created.\");\r\n    }\r\n    \r\n    /**\r\n     * Enables or disable debug logging through LogCat.\r\n     */\r\n    public void enableDebugLogging(boolean enable, String tag) {\r\n        mDebugLog = enable;\r\n        mDebugTag = tag;\r\n    }\r\n    \r\n    public void enableDebugLogging(boolean enable) {\r\n        mDebugLog = enable;\r\n    }\r\n\r\n    /**\r\n     * Callback for setup process. This listener's {@link #onIabSetupFinished} method is called\r\n     * when the setup process is complete.\r\n     */\r\n    public interface OnIabSetupFinishedListener {\r\n        /**\r\n         * Called to notify that setup is complete.\r\n         *\r\n         * @param result The result of the setup process.\r\n         */\r\n        public void onIabSetupFinished(IabResult result);\r\n    }\r\n\r\n    public boolean isSetupDone()\r\n    {\r\n    \treturn mSetupDone;\r\n    }\r\n    /**\r\n     * Starts the setup process. This will start up the setup process asynchronously.\r\n     * You will be notified through the listener when the setup process is complete.\r\n     * This method is safe to call from a UI thread.\r\n     *\r\n     * @param listener The listener to notify when the setup process is complete.\r\n     */\r\n    public void startSetup(final OnIabSetupFinishedListener listener) {\r\n        // If already set up, can't do it again.\r\n        if (mSetupDone) throw new IllegalStateException(\"IAB helper is already set up.\");\r\n\r\n        \r\n        //final Handler handler = new Handler();\r\n        // Connection to IAB service\r\n        logDebug(\"Starting in-app billing setup.\");\r\n        (new Thread(new Runnable() {\r\n            public void run() {\r\n            \t// wait for other threads\r\n            \tflagStartAsync(\"startSetup\");\r\n            \tif (isSetupDone()) {\r\n            \t\t/*\r\n            \t\t *  直前に待っていた処理がsetupだった場合は再度投げ直さない\r\n            \t\t */\r\n                    if (listener != null) {\r\n                    \tmActivity.runOnUiThread(new Runnable() {\r\n                            public void run() {\r\n                            \tlistener.onIabSetupFinished(\r\n                            \t\t\tnew IabResult(\r\n                            \t\t\t\t\tIabHelper.BILLING_RESPONSE_RESULT_OK , \"Already Initialized\"));\r\n                            }\r\n                        });\t\t                        \r\n                    }            \t\t\r\n            \t}\r\n\t\t            \r\n\t\t        mServiceConn = new ServiceConnection() {\r\n\t\t            @Override\r\n\t\t            public void onServiceDisconnected(ComponentName name) {\r\n\t\t                logDebug(\"Billing service disconnected.\");\r\n\t\t                mService = null;\r\n\t\t            }\r\n\t\t\r\n\t\t            @Override\r\n\t\t            public void onServiceConnected(ComponentName name, IBinder service) {\r\n\t\t                logDebug(\"Billing service connected.\");\r\n\t\t                mService = IInAppBillingService.Stub.asInterface(service);\r\n\t\t                String packageName = mActivity.getPackageName();\r\n\t\t                \r\n\t\t                flagEndAsync();\r\n\t\t                \r\n\t\t                try {\r\n\t\t                    logDebug(\"Checking for in-app billing 3 support.\");\r\n\t\t                    final int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);\r\n\t\t                    if (response != BILLING_RESPONSE_RESULT_OK) {\r\n\t\t                        if (listener != null) {\r\n\t\t                        \tmActivity.runOnUiThread(new Runnable() {\r\n\t\t                                public void run() {\r\n\t\t                                \tlistener.onIabSetupFinished(\r\n\t\t                                \t\t\tnew IabResult(response, \"Error checking for billing v3 support.\"));\r\n\t\t                                \tPFInterface.startAlertDialog(\"課金制限\", \"お使いの端末はサポートされていません [IABv3]\");\r\n\t\t                                }\r\n\t\t                            });\t\t                        \r\n\t\t                        }\r\n\r\n\t\t                        return;\r\n\t\t                    }\r\n\t\t                    logDebug(\"In-app billing version 3 supported for \" + packageName);\r\n\t\t                    mSetupDone = true;\r\n\t\t                }\r\n\t\t                catch (RemoteException e) {\r\n\t\t                    if (listener != null) {\r\n\t\t                    \tmActivity.runOnUiThread(new Runnable() {\r\n\t                                public void run() {\r\n\t\t\t\t                        listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,\r\n\t\t\t\t                                                    \"RemoteException while setting up in-app billing.\"));\r\n\t\t                    \r\n\t                                }\r\n\t                            });\r\n\t                        }\r\n\t\t                    e.printStackTrace();\r\n\t\t                }\r\n\t\t\r\n\t\t                if (listener != null) {\r\n                            mActivity.runOnUiThread(new Runnable() {\r\n                                public void run() {\r\n                                \tlistener.onIabSetupFinished(\r\n                                \t\t\tnew IabResult(BILLING_RESPONSE_RESULT_OK, \"Setup successful.\"));\r\n                                }\r\n                            });\r\n\t\t                }\r\n\t\t            }\r\n\t\t        };\r\n\t\t        boolean ret = mActivity.bindService(new Intent(\"com.android.vending.billing.InAppBillingService.BIND\"),\r\n\t\t                             mServiceConn, Context.BIND_AUTO_CREATE);\r\n\t\t        if(!ret) {\r\n\t\t        \tlogError(\"Failed to bind service\");\r\n\t\t        }\r\n            }})).start();\r\n    }\r\n\r\n    /**\r\n     * Dispose of object, releasing resources. It's very important to call this\r\n     * method when you are done with this object. It will release any resources\r\n     * used by it such as service connections. Naturally, once the object is\r\n     * disposed of, it can't be used again.\r\n     */\r\n    public void dispose() {\r\n        logDebug(\"Disposing.\");\r\n        mSetupDone = false;\r\n        if (mServiceConn != null) {\r\n            logDebug(\"Unbinding from service.\");\r\n            if (mActivity != null) mActivity.unbindService(mServiceConn);\r\n            mServiceConn = null;\r\n            mService = null;\r\n            mPurchaseListener = null;\r\n        }\r\n    }\r\n\r\n\r\n    /**\r\n     * Callback that notifies when a purchase is finished.\r\n     */\r\n    public interface OnIabPurchaseFinishedListener {\r\n        /**\r\n         * Called to notify that an in-app purchase finished. If the purchase was successful,\r\n         * then the sku parameter specifies which item was purchased. If the purchase failed,\r\n         * the sku and extraData parameters may or may not be null, depending on how far the purchase\r\n         * process went.\r\n         *\r\n         * @param result The result of the purchase.\r\n         * @param info The purchase information (null if purchase failed)\r\n         */\r\n        public void onIabPurchaseFinished(IabResult result, Purchase info);\r\n    }\r\n\r\n    // The listener registered on launchPurchaseFlow, which we have to call back when\r\n    // the purchase finishes\r\n    OnIabPurchaseFinishedListener mPurchaseListener;\r\n\r\n    /**\r\n     * Same as calling {@link #launchPurchaseFlow(Activity, String, int, OnIabPurchaseFinishedListener, String)}\r\n     * with null as extraData.\r\n     */\r\n    public void launchPurchaseFlow(String sku, int requestCode, OnIabPurchaseFinishedListener listener) {\r\n        launchPurchaseFlow(sku, requestCode, listener, \"\");\r\n    }\r\n\r\n    /**\r\n     * Initiate the UI flow for an in-app purchase. Call this method to initiate an in-app purchase,\r\n     * which will involve bringing up the Google Play screen. The calling activity will be paused while\r\n     * the user interacts with Google Play, and the result will be delivered via the activity's\r\n     * {@link android.app.Activity#onActivityResult} method, at which point you must call\r\n     * this object's {@link #handleActivityResult} method to continue the purchase flow. This method\r\n     * MUST be called from the UI thread of the Activity.\r\n     *\r\n     * @param sku The sku of the item to purchase.\r\n     * @param requestCode A request code (to differentiate from other responses --\r\n     *     as in {@link android.app.Activity#startActivityForResult}).\r\n     * @param listener The listener to notify when the purchase process finishes\r\n     * @param extraData Extra data (developer payload), which will be returned with the purchase data\r\n     *     when the purchase completes. This extra data will be permanently bound to that purchase\r\n     *     and will always be returned when the purchase is queried.\r\n     */\r\n    public void launchPurchaseFlow(final String sku,\r\n    \t\t\t\t\t\t\t   final int requestCode,\r\n    \t\t\t\t\t\t\t   final OnIabPurchaseFinishedListener listener,\r\n    \t\t\t\t\t\t\t   final String extraData) {\r\n        checkSetupDone(\"launchPurchaseFlow\");\r\n        \r\n        (new Thread(new Runnable() {\r\n            public void run() {\r\n            \t// wait for other threads\r\n\t\t        flagStartAsync(\"launchPurchaseFlow\");\r\n\r\n\t\t        try {\r\n\t\t            logDebug(\"Constructing buy intent for \" + sku);\r\n\t\t            Bundle buyIntentBundle = mService.getBuyIntent(3, mActivity.getPackageName(), sku, ITEM_TYPE_INAPP, extraData);\r\n\t\t            int response = getResponseCodeFromBundle(buyIntentBundle);\r\n\t\t            if (response != BILLING_RESPONSE_RESULT_OK) {\r\n\t\t                logError(\"Unable to buy item, Error response: \" + getResponseDesc(response));\r\n\t\t\r\n\t\t                flagEndAsync();\r\n\t\t                \r\n\t\t                final IabResult result = new IabResult(response, \"Unable to buy item\");\r\n\t\r\n\t\t                if (listener != null) {\r\n\t\t                \tmActivity.runOnUiThread(new Runnable() {\r\n\t\t                        public void run() {\r\n\t\t                        \tlistener.onIabPurchaseFinished(result, null);\r\n\t\t                        }\r\n\t\t                    });\r\n\t\t                }\r\n\t\t                /*\r\n\t\t                 * Stop purchasing when error is occurred.\r\n\t\t                 * 2013/05/23\r\n\t\t                 */\r\n\t\t                return;\r\n\t\t            }\r\n\t\t\r\n\t\t            PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);\r\n\t\t            logDebug(\"Launching buy intent for \" + sku + \". Request code: \" + requestCode);\r\n\t\t            mRequestCode = requestCode;\r\n\t\t            mPurchaseListener = listener;\r\n\t\t            mActivity.startIntentSenderForResult(pendingIntent.getIntentSender(),\r\n\t\t                                           requestCode, new Intent(),\r\n\t\t                                           Integer.valueOf(0), Integer.valueOf(0),\r\n\t\t                                           Integer.valueOf(0));\r\n\t\t        }\r\n\t\t        catch (SendIntentException e) {\r\n\t\t        \tflagEndAsync();\r\n\t\t            logError(\"SendIntentException while launching purchase flow for sku \" + sku);\r\n\t\t            e.printStackTrace();\r\n\t\t\r\n\t\t            final IabResult result = new IabResult(IABHELPER_SEND_INTENT_FAILED, \"Failed to send intent.\");\r\n\t\t            if (listener != null) {\r\n\t\t            \tmActivity.runOnUiThread(new Runnable() {\r\n\t                        public void run() {\r\n\t                        \tlistener.onIabPurchaseFinished(result, null);\r\n\t                        }\r\n\t                    });\r\n\t\t            }\r\n\t\t        }\r\n\t\t        catch (RemoteException e) {\r\n\t\t        \tflagEndAsync();\r\n\t\t            logError(\"RemoteException while launching purchase flow for sku \" + sku);\r\n\t\t            e.printStackTrace();\r\n\t\t\r\n\t\t            final IabResult result = new IabResult(IABHELPER_REMOTE_EXCEPTION, \"Remote exception while starting purchase flow\");\r\n\t\t            if (listener != null) {\r\n\t\t            \tmActivity.runOnUiThread(new Runnable() {\r\n\t                        public void run() {\r\n\t                        \tlistener.onIabPurchaseFinished(result, null);\r\n\t                        }\r\n\t                    });\r\n\t\t            }\r\n\t\t        }\r\n\t\t    }})).start();\r\n    }\r\n\r\n    /**\r\n     * Handles an activity result that's part of the purchase flow in in-app billing. If you\r\n     * are calling {@link #launchPurchaseFlow}, then you must call this method from your\r\n     * Activity's {@link android.app.Activity@onActivityResult} method. This method\r\n     * MUST be called from the UI thread of the Activity.\r\n     *\r\n     * @param requestCode The requestCode as you received it.\r\n     * @param resultCode The resultCode as you received it.\r\n     * @param data The data (Intent) as you received it.\r\n     * @return Returns true if the result was related to a purchase flow and was handled;\r\n     *     false if the result was not related to a purchase, in which case you should\r\n     *     handle it normally.\r\n     */\r\n    public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {\r\n    \tlogDebug(\"handleActivityResult\");\r\n    \tIabResult result;\r\n        if (requestCode != mRequestCode) {\r\n        \tlogDebug(\"unknown request code: \" + requestCode);\r\n        \treturn false;\r\n        }\r\n        checkSetupDone(\"handleActivityResult\");\r\n\r\n        // end of async purchase operation\r\n        flagEndAsync();\r\n\r\n        if (data == null) {\r\n            logError(\"Null data in IAB activity result.\");\r\n            result = new IabResult(IABHELPER_BAD_RESPONSE, \"Null data in IAB result\");\r\n            if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);\r\n            return true;\r\n        }\r\n        int responseCode = getResponseCodeFromIntent(data);\r\n        String purchaseData = data.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);\r\n        String dataSignature = data.getStringExtra(RESPONSE_INAPP_SIGNATURE);\r\n\r\n        if (resultCode == Activity.RESULT_OK && responseCode == BILLING_RESPONSE_RESULT_OK) {\r\n            logDebug(\"Successful resultcode from purchase activity.\");\r\n            logDebug(\"Purchase data: \" + purchaseData);\r\n            logDebug(\"Data signature: \" + dataSignature);\r\n            logDebug(\"Extras: \" + data.getExtras());\r\n\r\n            if (purchaseData == null || dataSignature == null) {\r\n                logError(\"BUG: either purchaseData or dataSignature is null.\");\r\n                logDebug(\"Extras: \" + data.getExtras().toString());\r\n                result = new IabResult(IABHELPER_UNKNOWN_ERROR, \"IAB returned null purchaseData or dataSignature\");\r\n                if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);\r\n                return true;\r\n            }\r\n\r\n            Purchase purchase = null;\r\n            try {\r\n\r\n                purchase = new Purchase(purchaseData, dataSignature);\r\n                /*\r\n                 * アプリ内で完結する課金の場合はここでシグネチャを検証する必要が有る。\r\n                 * ただし、コードから検証ロジックや鍵を解析されないように手間をかけないといけない \r\n                 */\r\n            }\r\n            catch (JSONException e) {\r\n                logError(\"Failed to parse purchase data.\");\r\n                e.printStackTrace();\r\n                result = new IabResult(IABHELPER_BAD_RESPONSE, \"Failed to parse purchase data.\");\r\n                if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);\r\n                return true;\r\n            }\r\n            if (mPurchaseListener != null) {\r\n                mPurchaseListener.onIabPurchaseFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, \"Success\"), purchase);\r\n            }\r\n        }\r\n        else if (resultCode == Activity.RESULT_OK) {\r\n            // result code was OK, but in-app billing response was not OK.\r\n            logDebug(\"Result code was OK but in-app billing response was not OK: \" + getResponseDesc(responseCode));\r\n            if (mPurchaseListener != null) {\r\n                result = new IabResult(responseCode, \"Problem purchashing item.\");\r\n                mPurchaseListener.onIabPurchaseFinished(result, null);\r\n            }\r\n        }\r\n        else if (resultCode == Activity.RESULT_CANCELED) {\r\n            logDebug(\"Purchase canceled - Response: \" + getResponseDesc(responseCode));\r\n            result = new IabResult(IABHELPER_USER_CANCELLED, \"User canceled.\");\r\n            if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);\r\n        }\r\n        else {\r\n            logError(\"Purchase failed. Result code: \" + Integer.toString(resultCode)\r\n                    + \". Response: \" + getResponseDesc(responseCode));\r\n            result = new IabResult(IABHELPER_UNKNOWN_PURCHASE_RESPONSE, \"Unknown purchase response.\");\r\n            if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);\r\n        }\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * Queries the inventory. This will query all owned items from the server, as well as\r\n     * information on additional skus, if specified. This method may block or take long to execute.\r\n     * Do not call from a UI thread. For that, use the non-blocking version {@link #refreshInventoryAsync}.\r\n     *\r\n     * @param querySkuDetails if true, SKU details (price, description, etc) will be queried as well\r\n     *     as purchase information.\r\n     * @param moreSkus additional skus to query information on, regardless of ownership. Ignored\r\n     *     if null or if querySkuDetails is false.\r\n     * @throws IabException if a problem occurs while refreshing the inventory.\r\n     */\r\n    public Inventory queryInventory(boolean querySkuDetails, List<String> moreSkus) throws IabException {\r\n        checkSetupDone(\"queryInventory\");\r\n        try {\r\n            Inventory inv = new Inventory();\r\n            int r = queryPurchases(inv);\r\n            if (r != BILLING_RESPONSE_RESULT_OK) {\r\n                throw new IabException(r, \"Error refreshing inventory (querying owned items).\");\r\n            }\r\n\r\n            if (querySkuDetails) {\r\n                r = querySkuDetails(inv, moreSkus);\r\n                if (r != BILLING_RESPONSE_RESULT_OK) {\r\n                    throw new IabException(r, \"Error refreshing inventory (querying prices of items).\");\r\n                }\r\n            }\r\n            return inv;\r\n        }\r\n        catch (RemoteException e) {\r\n            throw new IabException(IABHELPER_REMOTE_EXCEPTION, \"Remote exception while refreshing inventory.\", e);\r\n        }\r\n        catch (JSONException e) {\r\n            throw new IabException(IABHELPER_BAD_RESPONSE, \"Error parsing JSON response while refreshing inventory.\", e);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Listener that notifies when an inventory query operation completes.\r\n     */\r\n    public interface QueryInventoryFinishedListener {\r\n        /**\r\n         * Called to notify that an inventory query operation completed.\r\n         *\r\n         * @param result The result of the operation.\r\n         * @param inv The inventory.\r\n         */\r\n        public void onQueryInventoryFinished(IabResult result, Inventory inv);\r\n    }\r\n\r\n\r\n    /**\r\n     * Asynchronous wrapper for inventory query. This will perform an inventory\r\n     * query as described in {@link #queryInventory}, but will do so asynchronously\r\n     * and call back the specified listener upon completion. This method is safe to\r\n     * call from a UI thread.\r\n     *\r\n     * @param querySkuDetails as in {@link #queryInventory}\r\n     * @param moreSkus as in {@link #queryInventory}\r\n     * @param listener The listener to notify when the refresh operation completes.\r\n     */\r\n    public void queryInventoryAsync(final boolean querySkuDetails,\r\n                               final List<String> moreSkus,\r\n                               final QueryInventoryFinishedListener listener) {\r\n        checkSetupDone(\"queryInventory\");\r\n        (new Thread(new Runnable() {\r\n            public void run() {\r\n            \t// wait for other threads\r\n                flagStartAsync(\"refresh inventory\");\r\n                \r\n                IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, \"Inventory refresh successful.\");\r\n                Inventory inv = null;\r\n                try {\r\n                    inv = queryInventory(querySkuDetails, moreSkus);\r\n                }\r\n                catch (IabException ex) {\r\n                    result = ex.getResult();\r\n                }\r\n\r\n                flagEndAsync();\r\n\r\n                final IabResult result_f = result;\r\n                final Inventory inv_f = inv;\r\n                \r\n                mActivity.runOnUiThread(new Runnable() {\r\n                    public void run() {\r\n                        listener.onQueryInventoryFinished(result_f, inv_f);\r\n                    }\r\n                });\r\n            }\r\n        })).start();\r\n    }\r\n\r\n    public void queryInventoryAsync(QueryInventoryFinishedListener listener) {\r\n    \tqueryInventoryAsync(true, null, listener);\r\n    }\r\n\r\n    public void queryInventoryAsync(boolean querySkuDetails, QueryInventoryFinishedListener listener) {\r\n    \tqueryInventoryAsync(querySkuDetails, null, listener);\r\n    }\r\n\r\n\r\n    /**\r\n     * Consumes a given in-app product. Consuming can only be done on an item\r\n     * that's owned, and as a result of consumption, the user will no longer own it.\r\n     * This method may block or take long to return. Do not call from the UI thread.\r\n     * For that, see {@link #consumeAsync}.\r\n     *\r\n     * @param itemInfo The PurchaseInfo that represents the item to consume.\r\n     * @throws IabException if there is a problem during consumption.\r\n     */\r\n    void consume(Purchase itemInfo) throws IabException {\r\n        checkSetupDone(\"consume\");\r\n        try {\r\n            String token = itemInfo.getToken();\r\n            String sku = itemInfo.getSku();\r\n            if (token == null || token.equals(\"\")) {\r\n               logError(\"Can't consume \"+ sku + \". No token.\");\r\n               throw new IabException(IABHELPER_MISSING_TOKEN, \"PurchaseInfo is missing token for sku: \"\r\n                   + sku + \" \" + itemInfo);\r\n            }\r\n\r\n            logDebug(\"Consuming sku: \" + sku + \", token: \" + token);\r\n            int response = mService.consumePurchase(3, mActivity.getPackageName(), token);\r\n            if (response == BILLING_RESPONSE_RESULT_OK) {\r\n               logDebug(\"Successfully consumed sku: \" + sku);\r\n            }\r\n            else {\r\n               logDebug(\"Error consuming consuming sku \" + sku + \". \" + getResponseDesc(response));\r\n               throw new IabException(response, \"Error consuming sku \" + sku);\r\n            }\r\n        }\r\n        catch (RemoteException e) {\r\n            throw new IabException(IABHELPER_REMOTE_EXCEPTION, \"Remote exception while consuming. PurchaseInfo: \" + itemInfo, e);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Callback that notifies when a consumption operation finishes.\r\n     */\r\n    public interface OnConsumeFinishedListener {\r\n        /**\r\n         * Called to notify that a consumption has finished.\r\n         *\r\n         * @param purchase The purchase that was (or was to be) consumed.\r\n         * @param result The result of the consumption operation.\r\n         */\r\n        public void onConsumeFinished(Purchase purchase, IabResult result);\r\n    }\r\n\r\n    /**\r\n     * Callback that notifies when a multi-item consumption operation finishes.\r\n     */\r\n    public interface OnConsumeMultiFinishedListener {\r\n        /**\r\n         * Called to notify that a consumption of multiple items has finished.\r\n         *\r\n         * @param purchases The purchases that were (or were to be) consumed.\r\n         * @param results The results of each consumption operation, corresponding to each\r\n         *     sku.\r\n         */\r\n        public void onConsumeMultiFinished(List<Purchase> purchases, List<IabResult> results);\r\n    }\r\n\r\n    /**\r\n     * Asynchronous wrapper to item consumption. Works like {@link #consume}, but\r\n     * performs the consumption in the background and notifies completion through\r\n     * the provided listener. This method is safe to call from a UI thread.\r\n     *\r\n     * @param purchase The purchase to be consumed.\r\n     * @param listener The listener to notify when the consumption operation finishes.\r\n     */\r\n    public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) {\r\n        checkSetupDone(\"consume\");\r\n        List<Purchase> purchases = new ArrayList<Purchase>();\r\n        purchases.add(purchase);\r\n        consumeAsyncInternal(purchases, listener, null);\r\n    }\r\n\r\n    /**\r\n     * Same as {@link consumeAsync}, but for multiple items at once.\r\n     * @param purchases The list of PurchaseInfo objects representing the purchases to consume.\r\n     * @param listener The listener to notify when the consumption operation finishes.\r\n     */\r\n    public void consumeAsync(List<Purchase> purchases, OnConsumeMultiFinishedListener listener) {\r\n        checkSetupDone(\"consume\");\r\n        consumeAsyncInternal(purchases, null, listener);\r\n    }\r\n\r\n    /**\r\n     * Returns a human-readable description for the given response code.\r\n     *\r\n     * @param code The response code\r\n     * @return A human-readable string explaining the result code.\r\n     *     It also includes the result code numerically.\r\n     */\r\n    public static String getResponseDesc(int code) {\r\n        String[] iab_msgs = (\"0:OK/1:User Canceled/2:Unknown/\" +\r\n                \"3:Billing Unavailable/4:Item unavailable/\" +\r\n                \"5:Developer Error/6:Error/7:Item Already Owned/\" +\r\n                \"8:Item not owned\").split(\"/\");\r\n        String[] iabhelper_msgs = (\"0:OK/-1001:Remote exception during initialization/\" +\r\n                                   \"-1002:Bad response received/\" +\r\n                                   \"-1003:Purchase signature verification failed/\" +\r\n                                   \"-1004:Send intent failed/\" +\r\n                                   \"-1005:User cancelled/\" +\r\n                                   \"-1006:Unknown purchase response/\" +\r\n                                   \"-1007:Missing token/\" +\r\n                                   \"-1008:Unknown error\").split(\"/\");\r\n\r\n        if (code <= IABHELPER_ERROR_BASE) {\r\n            int index = IABHELPER_ERROR_BASE - code;\r\n            if (index >= 0 && index < iabhelper_msgs.length) return iabhelper_msgs[index];\r\n            else return String.valueOf(code) + \":Unknown IAB Helper Error\";\r\n        }\r\n        else if (code < 0 || code >= iab_msgs.length)\r\n            return String.valueOf(code) + \":Unknown\";\r\n        else\r\n            return iab_msgs[code];\r\n    }\r\n\r\n\r\n    // Checks that setup was done; if not, throws an exception.\r\n    void checkSetupDone(String operation) {\r\n        if (!mSetupDone) {\r\n            logError(\"Illegal state for operation (\" + operation + \"): IAB helper is not set up.\");\r\n            throw new IllegalStateException(\"IAB helper is not set up. Can't perform operation: \" + operation);\r\n        }\r\n    }\r\n\r\n    // Workaround to bug where sometimes response codes come as Long instead of Integer\r\n    int getResponseCodeFromBundle(Bundle b) {\r\n        Object o = b.get(RESPONSE_CODE);\r\n        if (o == null) {\r\n            logDebug(\"Bundle with null response code, assuming OK (known issue)\");\r\n            return BILLING_RESPONSE_RESULT_OK;\r\n        }\r\n        else if (o instanceof Integer) return ((Integer)o).intValue();\r\n        else if (o instanceof Long) return (int)((Long)o).longValue();\r\n        else {\r\n            logError(\"Unexpected type for bundle response code.\");\r\n            logError(o.getClass().getName());\r\n            throw new RuntimeException(\"Unexpected type for bundle response code: \" + o.getClass().getName());\r\n        }\r\n    }\r\n\r\n    // Workaround to bug where sometimes response codes come as Long instead of Integer\r\n    int getResponseCodeFromIntent(Intent i) {\r\n        Object o = i.getExtras().get(RESPONSE_CODE);\r\n        if (o == null) {\r\n            logError(\"Intent with no response code, assuming OK (known issue)\");\r\n            return BILLING_RESPONSE_RESULT_OK;\r\n        }\r\n        else if (o instanceof Integer) return ((Integer)o).intValue();\r\n        else if (o instanceof Long) return (int)((Long)o).longValue();\r\n        else {\r\n            logError(\"Unexpected type for intent response code.\");\r\n            logError(o.getClass().getName());\r\n            throw new RuntimeException(\"Unexpected type for intent response code: \" + o.getClass().getName());\r\n        }\r\n    }\r\n    \r\n    /*\r\n     * Luaからエンジンに対して多重リクエストを送る事を許している関係上、\r\n     * 複数のAsyncスレッドを交通整理するためにここでポーリングによる待ち合わせを行う。\r\n     * これが特に必要になるのはペンディングした複数のPurchaseのconsumeを行う時で、\r\n     * iOS側でfinishTransactionが非同期で待ちを気にせず投げられる仕様になっていることから、\r\n     * Androidでもこれが連続でLuaから呼ばれる可能性がある。\r\n     * この関数はUIスレッドから呼ばれてはならない。 \r\n     */\r\n    void flagStartAsync(String operation) {\r\n    \tboolean needsWait = true;\r\n    \tint waitCount \t  = 0;\r\n    \t\r\n    \twhile(needsWait) {\r\n\t    \tif (++waitCount > 300) {\r\n\t    \t\tthrow new IllegalStateException(\"Can't start async operation (\" +\r\n\t    \t\t\t\toperation + \") because another async operation(\" + mAsyncOperation + \") is in progress.\");\r\n\t    \t}\r\n\t    \t\r\n\t    \tsynchronized(this) {\r\n\t\t        if (!this.mAsyncInProgress) {\r\n\t\t        \tmAsyncInProgress = true;\r\n\t\t        \tneedsWait = false;\r\n\t\t        } else {\r\n\t\t        \tlogDebug(operation + \" is waiting \" + mAsyncOperation + \" running in another thread\");\r\n\t\t        }\r\n\t    \t}\r\n\r\n\t    \tif (needsWait) {\r\n\t    \t\ttry {\r\n\t    \t\t\tThread.sleep(100);\r\n\t    \t\t} catch (InterruptedException e) {\r\n\t    \t\t\t/*\r\n\t    \t\t\t * See:  http://www.javaspecialists.co.za/archive/Issue056.html\"\r\n\t    \t\t\t */\r\n\t    \t\t\tThread.currentThread().interrupt();\r\n\t    \t\t}\r\n\t    \t}\r\n    \t}\r\n\t                \r\n\t    mAsyncOperation = operation;\r\n\t    logDebug(\"Starting async operation: \" + operation);\r\n    }\r\n\r\n    void flagEndAsync() {\r\n        logDebug(\"Ending async operation: \" + mAsyncOperation);\r\n        mAsyncOperation = \"\";\r\n        mAsyncInProgress = false;\r\n    }\r\n\r\n\r\n    int queryPurchases(Inventory inv) throws JSONException, RemoteException {\r\n        // Query purchases\r\n        logDebug(\"Querying owned items...\");\r\n        logDebug(\"Package name: \" + mActivity.getPackageName());\r\n        boolean verificationFailed = false;\r\n        String continueToken = null;\r\n\r\n        do {\r\n            logDebug(\"Calling getPurchases with continuation token: \" + continueToken);\r\n            Bundle ownedItems = mService.getPurchases(3, mActivity.getPackageName(),\r\n                    ITEM_TYPE_INAPP, continueToken);\r\n\r\n            int response = getResponseCodeFromBundle(ownedItems);\r\n            logDebug(\"Owned items response: \" + String.valueOf(response));\r\n            if (response != BILLING_RESPONSE_RESULT_OK) {\r\n                logDebug(\"getPurchases() failed: \" + getResponseDesc(response));\r\n                return response;\r\n            }\r\n            if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)\r\n                    || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)\r\n                    || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {\r\n                logError(\"Bundle returned from getPurchases() doesn't contain required fields.\");\r\n                return IABHELPER_BAD_RESPONSE;\r\n            }\r\n\r\n            ArrayList<String> ownedSkus = ownedItems.getStringArrayList(\r\n                        RESPONSE_INAPP_ITEM_LIST);\r\n            ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(\r\n                        RESPONSE_INAPP_PURCHASE_DATA_LIST);\r\n            ArrayList<String> signatureList = ownedItems.getStringArrayList(\r\n                        RESPONSE_INAPP_SIGNATURE_LIST);\r\n\r\n            for (int i = 0; i < purchaseDataList.size(); ++i) {\r\n                String purchaseData = purchaseDataList.get(i);\r\n                String signature = signatureList.get(i);\r\n                String sku = ownedSkus.get(i);\r\n                \r\n                //if (Security.verifyPurchase(mSignatureBase64, purchaseData, signature)) {\r\n                    logDebug(\"Sku is owned: \" + sku);\r\n                    Purchase purchase = new Purchase(purchaseData, signature);\r\n\r\n                    if (TextUtils.isEmpty(purchase.getToken())) {\r\n                        logWarn(\"BUG: empty/null token!\");\r\n                        logDebug(\"Purchase data: \" + purchaseData);\r\n                    }\r\n\r\n                    // Record ownership and token\r\n                    inv.addPurchase(purchase);\r\n                // }\r\n                 /*\r\n                else {\r\n                    logWarn(\"Purchase signature verification **FAILED**. Not adding item.\");\r\n                    logDebug(\"   Purchase data: \" + purchaseData);\r\n                    logDebug(\"   Signature: \" + signature);\r\n                    verificationFailed = true;\r\n                }\r\n                */\r\n            }\r\n\r\n            continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);\r\n            logDebug(\"Continuation token: \" + continueToken);\r\n        } while (!TextUtils.isEmpty(continueToken));\r\n\r\n        return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK;\r\n    }\r\n\r\n    int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {\r\n        logDebug(\"Querying SKU details.\");\r\n        ArrayList<String> skuList = new ArrayList<String>();\r\n        skuList.addAll(inv.getAllOwnedSkus());\r\n        if (moreSkus != null) skuList.addAll(moreSkus);\r\n\r\n        if (skuList.size() == 0) {\r\n            logDebug(\"queryPrices: nothing to do because there are no SKUs.\");\r\n            return BILLING_RESPONSE_RESULT_OK;\r\n        }\r\n\r\n        Bundle querySkus = new Bundle();\r\n        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);\r\n        Bundle skuDetails = mService.getSkuDetails(3, mActivity.getPackageName(),\r\n                ITEM_TYPE_INAPP, querySkus);\r\n        \r\n        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {\r\n        \tint response = getResponseCodeFromBundle(skuDetails);\r\n            if (response != BILLING_RESPONSE_RESULT_OK) {\r\n                logDebug(\"getSkuDetails() failed: \" + getResponseDesc(response));\r\n                return response;\r\n            }\r\n            else {\r\n            \tlogError(\"getSkuDetails() returned a bundle with neither an error nor a detail list.\");\r\n                return IABHELPER_BAD_RESPONSE;\r\n            }\r\n        }\r\n\r\n        ArrayList<String> responseList = skuDetails.getStringArrayList(\r\n                RESPONSE_GET_SKU_DETAILS_LIST);\r\n\r\n        for (String thisResponse : responseList) {\r\n            SkuDetails d = new SkuDetails(thisResponse);\r\n            logDebug(\"Got sku details: \" + d);\r\n            inv.addSkuDetails(d);\r\n        }\r\n        return BILLING_RESPONSE_RESULT_OK;\r\n    }\r\n\r\n\r\n    void consumeAsyncInternal(final List<Purchase> purchases,\r\n                              final OnConsumeFinishedListener singleListener,\r\n                              final OnConsumeMultiFinishedListener multiListener) {\r\n        (new Thread(new Runnable() {\r\n            public void run() {\r\n            \t// wait for other threads\r\n                flagStartAsync(\"consume\");\r\n                \r\n                final List<IabResult> results = new ArrayList<IabResult>();\r\n                for (Purchase purchase : purchases) {\r\n                    try {\r\n                        consume(purchase);\r\n                        results.add(new IabResult(BILLING_RESPONSE_RESULT_OK, \"Successful consume of sku \" + purchase.getSku()));\r\n                    }\r\n                    catch (IabException ex) {\r\n                        results.add(ex.getResult());\r\n                    }\r\n                }\r\n\r\n                flagEndAsync();\r\n                if (singleListener != null) {\r\n                \tmActivity.runOnUiThread(new Runnable() {\r\n                        public void run() {\r\n                            singleListener.onConsumeFinished(purchases.get(0), results.get(0));\r\n                        }\r\n                    });\r\n                }\r\n                if (multiListener != null) {\r\n                \tmActivity.runOnUiThread(new Runnable() {\r\n                        public void run() {\r\n                            multiListener.onConsumeMultiFinished(purchases, results);\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n        })).start();\r\n    }\r\n    \r\n    void logDebug(String msg) {\r\n        if (mDebugLog) {\r\n        \tLog.d(mDebugTag, Thread.currentThread().getStackTrace()[2].getLineNumber() + \":\" + msg);\r\n        }\r\n    }\r\n    \r\n    void logError(String msg) {\r\n        Log.e(mDebugTag, Thread.currentThread().getStackTrace()[2].getLineNumber() + \":\" +\"In-app billing error: \" + msg);\r\n    }\r\n    \r\n    void logWarn(String msg) {\r\n        Log.w(mDebugTag, Thread.currentThread().getStackTrace()[2].getLineNumber() + \":\" +\"In-app billing warning: \" + msg);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/IabResult.java",
    "content": "/* Copyright (c) 2012 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\n/**\r\n * Represents the result of an in-app billing operation.\r\n * A result is composed of a response code (an integer) and possibly a\r\n * message (String). You can get those by calling\r\n * {@link #getResponse} and {@link #getMessage()}, respectively. You\r\n * can also inquire whether a result is a success or a failure by\r\n * calling {@link #isSuccess()} and {@link #isFailure()}.\r\n */\r\npublic class IabResult {\r\n    int mResponse;\r\n    String mMessage;\r\n\r\n    public IabResult(int response, String message) {\r\n        mResponse = response;\r\n        if (message == null || message.trim().length() == 0) {\r\n            mMessage = IabHelper.getResponseDesc(response);\r\n        }\r\n        else {\r\n            mMessage = message + \" (response: \" + IabHelper.getResponseDesc(response) + \")\";\r\n        }\r\n    }\r\n    public int getResponse() { return mResponse; }\r\n    public String getMessage() { return mMessage; }\r\n    public boolean isSuccess() { return mResponse == IabHelper.BILLING_RESPONSE_RESULT_OK; }\r\n    public boolean isFailure() { return !isSuccess(); }\r\n    public String toString() { return \"IabResult: \" + getMessage(); }\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/Inventory.java",
    "content": "/* Copyright (c) 2012 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * Represents a block of information about in-app items.\r\n * An Inventory is returned by such methods as {@link IabHelper#queryInventory}.\r\n */\r\npublic class Inventory {\r\n    Map<String,SkuDetails> mSkuMap = new HashMap<String,SkuDetails>();\r\n    Map<String,Purchase> mPurchaseMap = new HashMap<String,Purchase>();\r\n\r\n    Inventory() { }\r\n\r\n    /** Returns the listing details for an in-app product. */\r\n    public SkuDetails getSkuDetails(String sku) {\r\n        return mSkuMap.get(sku);\r\n    }\r\n\r\n    /** Returns purchase information for a given product, or null if there is no purchase. */\r\n    public Purchase getPurchase(String sku) {\r\n        return mPurchaseMap.get(sku);\r\n    }\r\n\r\n    /** Returns whether or not there exists a purchase of the given product. */\r\n    public boolean hasPurchase(String sku) {\r\n        return mPurchaseMap.containsKey(sku);\r\n    }\r\n\r\n    /** Return whether or not details about the given product are available. */\r\n    public boolean hasDetails(String sku) {\r\n        return mSkuMap.containsKey(sku);\r\n    }\r\n\r\n    /**\r\n     * Erase a purchase (locally) from the inventory, given its product ID. This just\r\n     * modifies the Inventory object locally and has no effect on the server! This is\r\n     * useful when you have an existing Inventory object which you know to be up to date,\r\n     * and you have just consumed an item successfully, which means that erasing its\r\n     * purchase data from the Inventory you already have is quicker than querying for\r\n     * a new Inventory.\r\n     */\r\n    public void erasePurchase(String sku) {\r\n        if (mPurchaseMap.containsKey(sku)) mPurchaseMap.remove(sku);\r\n    }\r\n\r\n    /** Returns a list of all owned product IDs. */\r\n    /*\r\n     * 2013.3.29  外から使いたい為、publicに変更\r\n     */\r\n    public List<String> getAllOwnedSkus() {\r\n        return new ArrayList<String>(mPurchaseMap.keySet());\r\n    }\r\n\r\n    /** Returns a list of all purchases. */\r\n    /*\r\n     * 2013.3.29  外から使いたい為、publicに変更\r\n     */\r\n    public List<Purchase> getAllPurchases() {\r\n        return new ArrayList<Purchase>(mPurchaseMap.values());\r\n    }\r\n\r\n    void addSkuDetails(SkuDetails d) {\r\n        mSkuMap.put(d.getSku(), d);\r\n    }\r\n\r\n    void addPurchase(Purchase p) {\r\n        mPurchaseMap.put(p.getSku(), p);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/Purchase.java",
    "content": "/* Copyright (c) 2012 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\nimport org.json.JSONException;\r\nimport org.json.JSONObject;\r\n\r\nimport android.util.Log;\r\n\r\n/**\r\n * Represents an in-app billing purchase.\r\n */\r\npublic class Purchase {\r\n    String mOrderId;\r\n    String mPackageName;\r\n    String mSku;\r\n    long mPurchaseTime;\r\n    int mPurchaseState;\r\n    String mDeveloperPayload;\r\n    String mToken;\r\n    String mOriginalJson;\r\n    String mSignature;\r\n    \r\n    public static Purchase fromReceiptString(String receiptString) {    \t\r\n\t    try {\r\n\t    \tJSONObject o = new JSONObject(receiptString);\r\n\t    \tString signature = o.getString(\"signature\");\r\n\t    \tString jsonPurchaseInfo = new String(Base64.decode(o.getString(\"data\")));\r\n\t    \t\r\n\t    \treturn new Purchase(jsonPurchaseInfo, signature);\r\n\t    } catch (Base64DecoderException e) {\r\n\t        Log.e(\"Purchase\", e.toString());\r\n\t        return null;\r\n\t    } catch (JSONException e) {\r\n\t    \tLog.e(\"Purchase\", e.toString());\r\n\t    \treturn null;\r\n\t    }\r\n    }\r\n\r\n    public Purchase(String jsonPurchaseInfo, String signature) throws JSONException {\r\n        mOriginalJson = jsonPurchaseInfo;\r\n        JSONObject o = new JSONObject(mOriginalJson);\r\n        mOrderId = o.optString(\"orderId\");\r\n        mPackageName = o.optString(\"packageName\");\r\n        mSku = o.optString(\"productId\");\r\n        mPurchaseTime = o.optLong(\"purchaseTime\");\r\n        mPurchaseState = o.optInt(\"purchaseState\");\r\n        mDeveloperPayload = o.optString(\"developerPayload\");\r\n        mToken = o.optString(\"token\", o.optString(\"purchaseToken\"));\r\n        mSignature = signature;\r\n    }\r\n\r\n    public String getOrderId() { return mOrderId; }\r\n    public String getPackageName() { return mPackageName; }\r\n    public String getSku() { return mSku; }\r\n    public long getPurchaseTime() { return mPurchaseTime; }\r\n    public int getPurchaseState() { return mPurchaseState; }\r\n    public String getDeveloperPayload() { return mDeveloperPayload; }\r\n    public String getToken() { return mToken; }\r\n    public String getOriginalJson() { return mOriginalJson; }\r\n    public String getSignature() { return mSignature; }\r\n\r\n    public String toReceiptString() {\r\n    \tJSONObject obj    = new JSONObject();\r\n    \t\r\n    \ttry {\r\n\t    \tobj.put(\"signature\", mSignature);\r\n\t    \tobj.put(\"data\", Base64.encode(mOriginalJson.getBytes()));\r\n    \t} catch (JSONException e) {\r\n    \t\tLog.e(\"Purchase\", \"Could not generate receiptString: \" + e.toString());\r\n    \t}\r\n    \treturn obj.toString();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/billing/util/SkuDetails.java",
    "content": "/* Copyright (c) 2012 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage klb.android.GameEngine.billing.util;\r\n\r\nimport org.json.JSONException;\r\nimport org.json.JSONObject;\r\n\r\n/**\r\n * Represents an in-app product's listing details.\r\n */\r\npublic class SkuDetails {\r\n    String mSku;\r\n    String mType;\r\n    String mPrice;\r\n    String mTitle;\r\n    String mDescription;\r\n    String mJson;\r\n\r\n    public SkuDetails(String jsonSkuDetails) throws JSONException {\r\n        mJson = jsonSkuDetails;\r\n        JSONObject o = new JSONObject(mJson);\r\n        mSku = o.optString(\"productId\");\r\n        mType = o.optString(\"type\");\r\n        mPrice = o.optString(\"price\");\r\n        mTitle = o.optString(\"title\");\r\n        mDescription = o.optString(\"description\");\r\n    }\r\n\r\n    public String getSku() { return mSku; }\r\n    public String getType() { return mType; }\r\n    public String getPrice() { return mPrice; }\r\n    public String getTitle() { return mTitle; }\r\n    public String getDescription() { return mDescription; }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"SkuDetails:\" + mJson;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Android/src/klb/android/GameEngine/prngfix/PRNGFixes.java",
    "content": "package klb.android.GameEngine.prngfix;\n\n/*\n * This software is provided 'as-is', without any express or implied\n * warranty.  In no event will Google be held liable for any damages\n * arising from the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, as long as the origin is not misrepresented.\n */\n\n/*\n  from http://android-developers.blogspot.jp/2013/08/some-securerandom-thoughts.html\n  SecureRandom が適切に初期化されていない問題への対処。\n */\n\n\nimport android.os.Build;\nimport android.os.Process;\n\nimport java.io.*;\nimport java.security.*;\n\n/**\n * Fixes for the output of the default PRNG having low entropy.\n *\n * The fixes need to be applied via {@link #apply()} before any use of Java\n * Cryptography Architecture primitives. A good place to invoke them is in the\n * application's {@code onCreate}.\n */\npublic final class PRNGFixes {\n\n    private static final int VERSION_CODE_JELLY_BEAN = 16;\n    private static final int VERSION_CODE_JELLY_BEAN_MR2 = 18;\n    private static final byte[] BUILD_FINGERPRINT_AND_DEVICE_SERIAL =\n            getBuildFingerprintAndDeviceSerial();\n\n    /** Hidden constructor to prevent instantiation. */\n    private PRNGFixes() {}\n\n    /**\n     * Applies all fixes.\n     *\n     * @throws SecurityException if a fix is needed but could not be applied.\n     */\n    public static void apply() {\n        applyOpenSSLFix();\n        installLinuxPRNGSecureRandom();\n    }\n\n    /**\n     * Applies the fix for OpenSSL PRNG having low entropy. Does nothing if the\n     * fix is not needed.\n     *\n     * @throws SecurityException if the fix is needed but could not be applied.\n     */\n    private static void applyOpenSSLFix() throws SecurityException {\n        if ((Build.VERSION.SDK_INT < VERSION_CODE_JELLY_BEAN)\n                || (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2)) {\n            // No need to apply the fix\n            return;\n        }\n\n        try {\n            // Mix in the device- and invocation-specific seed.\n            Class.forName(\"org.apache.harmony.xnet.provider.jsse.NativeCrypto\")\n                    .getMethod(\"RAND_seed\", byte[].class)\n                    .invoke(null, new Object[] {generateSeed()});\n\n            // Mix output of Linux PRNG into OpenSSL's PRNG\n            int bytesRead = (Integer) Class.forName(\n                    \"org.apache.harmony.xnet.provider.jsse.NativeCrypto\")\n                    .getMethod(\"RAND_load_file\", String.class, long.class)\n                    .invoke(null, \"/dev/urandom\", 1024);\n            if (bytesRead != 1024) {\n                throw new IOException(\n                        \"Unexpected number of bytes read from Linux PRNG: \"\n                                + bytesRead);\n            }\n        } catch (Exception e) {\n            throw new SecurityException(\"Failed to seed OpenSSL PRNG\", e);\n        }\n    }\n\n    /**\n     * Installs a Linux PRNG-backed {@code SecureRandom} implementation as the\n     * default. Does nothing if the implementation is already the default or if\n     * there is not need to install the implementation.\n     *\n     * @throws SecurityException if the fix is needed but could not be applied.\n     */\n    private static void installLinuxPRNGSecureRandom()\n            throws SecurityException {\n        if (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2) {\n            // No need to apply the fix\n            return;\n        }\n\n        // Install a Linux PRNG-based SecureRandom implementation as the\n        // default, if not yet installed.\n        Provider[] secureRandomProviders =\n                Security.getProviders(\"SecureRandom.SHA1PRNG\");\n        if ((secureRandomProviders == null)\n                || (secureRandomProviders.length < 1)\n                || (!LinuxPRNGSecureRandomProvider.class.equals(\n                secureRandomProviders[0].getClass()))) {\n            Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1);\n        }\n\n        // Assert that new SecureRandom() and\n        // SecureRandom.getInstance(\"SHA1PRNG\") return a SecureRandom backed\n        // by the Linux PRNG-based SecureRandom implementation.\n        SecureRandom rng1 = new SecureRandom();\n        if (!LinuxPRNGSecureRandomProvider.class.equals(\n                rng1.getProvider().getClass())) {\n            throw new SecurityException(\n                    \"new SecureRandom() backed by wrong Provider: \"\n                            + rng1.getProvider().getClass());\n        }\n\n        SecureRandom rng2;\n        try {\n            rng2 = SecureRandom.getInstance(\"SHA1PRNG\");\n        } catch (NoSuchAlgorithmException e) {\n            throw new SecurityException(\"SHA1PRNG not available\", e);\n        }\n        if (!LinuxPRNGSecureRandomProvider.class.equals(\n                rng2.getProvider().getClass())) {\n            throw new SecurityException(\n                    \"SecureRandom.getInstance(\\\"SHA1PRNG\\\") backed by wrong\"\n                            + \" Provider: \" + rng2.getProvider().getClass());\n        }\n    }\n\n    /**\n     * {@code Provider} of {@code SecureRandom} engines which pass through\n     * all requests to the Linux PRNG.\n     */\n    private static class LinuxPRNGSecureRandomProvider extends Provider {\n\n        public LinuxPRNGSecureRandomProvider() {\n            super(\"LinuxPRNG\",\n                    1.0,\n                    \"A Linux-specific random number provider that uses\"\n                            + \" /dev/urandom\");\n            // Although /dev/urandom is not a SHA-1 PRNG, some apps\n            // explicitly request a SHA1PRNG SecureRandom and we thus need to\n            // prevent them from getting the default implementation whose output\n            // may have low entropy.\n            put(\"SecureRandom.SHA1PRNG\", LinuxPRNGSecureRandom.class.getName());\n            put(\"SecureRandom.SHA1PRNG ImplementedIn\", \"Software\");\n        }\n    }\n\n    /**\n     * {@link java.security.SecureRandomSpi} which passes all requests to the Linux PRNG\n     * ({@code /dev/urandom}).\n     */\n    public static class LinuxPRNGSecureRandom extends SecureRandomSpi {\n\n        /*\n         * IMPLEMENTATION NOTE: Requests to generate bytes and to mix in a seed\n         * are passed through to the Linux PRNG (/dev/urandom). Instances of\n         * this class seed themselves by mixing in the current time, PID, UID,\n         * build fingerprint, and hardware serial number (where available) into\n         * Linux PRNG.\n         *\n         * Concurrency: Read requests to the underlying Linux PRNG are\n         * serialized (on sLock) to ensure that multiple threads do not get\n         * duplicated PRNG output.\n         */\n\n        private static final File URANDOM_FILE = new File(\"/dev/urandom\");\n\n        private static final Object sLock = new Object();\n\n        /**\n         * Input stream for reading from Linux PRNG or {@code null} if not yet\n         * opened.\n         *\n         * @GuardedBy(\"sLock\")\n         */\n        @SuppressWarnings(\"JavaDoc\")\n        private static DataInputStream sUrandomIn;\n\n        /**\n         * Output stream for writing to Linux PRNG or {@code null} if not yet\n         * opened.\n         *\n         * @GuardedBy(\"sLock\")\n         */\n        @SuppressWarnings(\"JavaDoc\")\n        private static OutputStream sUrandomOut;\n\n        /**\n         * Whether this engine instance has been seeded. This is needed because\n         * each instance needs to seed itself if the client does not explicitly\n         * seed it.\n         */\n        private boolean mSeeded;\n\n        @Override\n        protected void engineSetSeed(byte[] bytes) {\n            try {\n                OutputStream out;\n                synchronized (sLock) {\n                    out = getUrandomOutputStream();\n                }\n                out.write(bytes);\n                out.flush();\n                mSeeded = true;\n            } catch (IOException e) {\n                throw new SecurityException(\n                        \"Failed to mix seed into \" + URANDOM_FILE, e);\n            }\n        }\n\n        @Override\n        protected void engineNextBytes(byte[] bytes) {\n            if (!mSeeded) {\n                // Mix in the device- and invocation-specific seed.\n                engineSetSeed(generateSeed());\n            }\n\n            try {\n                DataInputStream in;\n                synchronized (sLock) {\n                    in = getUrandomInputStream();\n                }\n                //noinspection SynchronizationOnLocalVariableOrMethodParameter\n                synchronized (in) {\n                    in.readFully(bytes);\n                }\n            } catch (IOException e) {\n                throw new SecurityException(\n                        \"Failed to read from \" + URANDOM_FILE, e);\n            }\n        }\n\n        @Override\n        protected byte[] engineGenerateSeed(int size) {\n            byte[] seed = new byte[size];\n            engineNextBytes(seed);\n            return seed;\n        }\n\n        private DataInputStream getUrandomInputStream() {\n            synchronized (sLock) {\n                if (sUrandomIn == null) {\n                    // NOTE: Consider inserting a BufferedInputStream between\n                    // DataInputStream and FileInputStream if you need higher\n                    // PRNG output performance and can live with future PRNG\n                    // output being pulled into this process prematurely.\n                    try {\n                        sUrandomIn = new DataInputStream(\n                                new FileInputStream(URANDOM_FILE));\n                    } catch (IOException e) {\n                        throw new SecurityException(\"Failed to open \"\n                                + URANDOM_FILE + \" for reading\", e);\n                    }\n                }\n                return sUrandomIn;\n            }\n        }\n\n        private OutputStream getUrandomOutputStream() {\n            synchronized (sLock) {\n                if (sUrandomOut == null) {\n                    try {\n                        sUrandomOut = new FileOutputStream(URANDOM_FILE);\n                    } catch (IOException e) {\n                        throw new SecurityException(\"Failed to open \"\n                                + URANDOM_FILE + \" for writing\", e);\n                    }\n                }\n                return sUrandomOut;\n            }\n        }\n    }\n\n    /**\n     * Generates a device- and invocation-specific seed to be mixed into the\n     * Linux PRNG.\n     */\n    private static byte[] generateSeed() {\n        try {\n            ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();\n            DataOutputStream seedBufferOut =\n                    new DataOutputStream(seedBuffer);\n            seedBufferOut.writeLong(System.currentTimeMillis());\n            seedBufferOut.writeLong(System.nanoTime());\n            seedBufferOut.writeInt(Process.myPid());\n            seedBufferOut.writeInt(Process.myUid());\n            seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);\n            seedBufferOut.close();\n            return seedBuffer.toByteArray();\n        } catch (IOException e) {\n            throw new SecurityException(\"Failed to generate seed\", e);\n        }\n    }\n\n    /**\n     * Gets the hardware serial number of this device.\n     *\n     * @return serial number or {@code null} if not available.\n     */\n    private static String getDeviceSerialNumber() {\n        // We're using the Reflection API because Build.SERIAL is only available\n        // since API Level 9 (Gingerbread, Android 2.3).\n        try {\n            return (String) Build.class.getField(\"SERIAL\").get(null);\n        } catch (Exception ignored) {\n            return null;\n        }\n    }\n\n    private static byte[] getBuildFingerprintAndDeviceSerial() {\n        StringBuilder result = new StringBuilder();\n        String fingerprint = Build.FINGERPRINT;\n        if (fingerprint != null) {\n            result.append(fingerprint);\n        }\n        String serial = getDeviceSerialNumber();\n        if (serial != null) {\n            result.append(serial);\n        }\n        try {\n            return result.toString().getBytes(\"UTF-8\");\n        } catch (UnsupportedEncodingException e) {\n            throw new RuntimeException(\"UTF-8 encoding not supported\");\n        }\n    }\n}\n"
  },
  {
    "path": "Engine/porting/FileDelete.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"FileDelete.h\"\r\n\r\n#define MAX_SIZE_BUFFER_QUEUE_PATH\t(200000)\r\n#define MAX_SIZE_ENTRY_COUNT\t\t(1000)\r\n\r\n// Prototypes\r\nstruct SDelContext;\r\nvoid EmptyQueue(SDelContext* pCtx);\r\nvoid QueueList(SDelContext* pCtx, const char* path);\r\nconst char* GetQueueItem(SDelContext* pCtx);\r\nvoid deleteRecurse(SDelContext* pCtx, const char* path, bool delFile);\r\n\r\nstruct SDelContext {\r\n\tchar*\tm_deleteQueue;\r\n\tu32*\tm_deleteQueueIndex;\r\n\r\n\tchar*\tm_deleteQueueStart;\r\n\tu32\t\tm_deleteCountCount;\r\n\tu32\t\tm_deleteCountCountParse;\r\n};\r\n\r\nvoid EmptyQueue(SDelContext* pCtx) {\r\n\tpCtx->m_deleteCountCount\t\t\t= 0;\r\n\tpCtx->m_deleteCountCountParse\t\t= 0;\r\n\tpCtx->m_deleteQueueStart\t\t\t= pCtx->m_deleteQueue;\r\n}\r\n\r\nvoid QueueList(SDelContext* pCtx, const char* path) {\r\n\tu32 length = strlen(path) + 1; // Include zero.\r\n\r\n\t// Index.\r\n\tklb_assert(pCtx->m_deleteCountCount < MAX_SIZE_ENTRY_COUNT, \"Reach limit\");\r\n\r\n\tpCtx->m_deleteQueueIndex[pCtx->m_deleteCountCount++] = pCtx->m_deleteQueueStart - pCtx->m_deleteQueue;\r\n\t\r\n\tklb_assert(pCtx->m_deleteQueueIndex[pCtx->m_deleteCountCount-1] + length < MAX_SIZE_BUFFER_QUEUE_PATH,\"Reach limit\");\r\n\r\n\t// Copy String.\r\n\tmemcpy(pCtx->m_deleteQueueStart, path, length); // Copy string\r\n\t// Go next\r\n\tpCtx->m_deleteQueueStart += length;\r\n}\r\n\r\nconst char* GetQueueItem(SDelContext* pCtx) {\r\n\tif (pCtx->m_deleteCountCountParse < pCtx->m_deleteCountCount) {\r\n\t\treturn &pCtx->m_deleteQueue[pCtx->m_deleteQueueIndex[pCtx->m_deleteCountCountParse++]];\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nvoid deleteRecurse(SDelContext* pCtx, const char* path, bool delFile) {\r\n\tDIR *pDIR = opendir(path);\r\n\tif (pDIR) {\r\n\r\n\t\t//\r\n\t\t// 1.Recursive phase folder only, just for \"parsing\"\r\n\t\t//\r\n\t\tDIR *pDIR2;\r\n\t\tstruct dirent* entry = readdir(pDIR);\r\n\t\twhile(entry) {\r\n\t\t\tif( strcmp(entry->d_name, \".\") != 0 && strcmp(entry->d_name, \"..\") != 0 ) {\r\n\t\t\t\tchar buff[1000];\r\n\t\t\t\tsprintf(buff, \"%s/%s\",path, entry->d_name);\r\n\t\t\t\tif ((pDIR2=opendir(buff))) {\r\n\t\t\t\t\tdeleteRecurse(pCtx, buff, false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tentry = readdir(pDIR);\r\n\t\t}\r\n\t\tclosedir(pDIR);\r\n\r\n\t\t//\r\n\t\t// 2.Reopen current path now we know that ALL content is empty (empty folder or files only : no more recursion)\r\n\t\t//\r\n\t\tEmptyQueue(pCtx);\r\n\r\n\t\tpDIR = opendir(path);\r\n\t\tentry = readdir(pDIR);\r\n\t\twhile(entry) {\r\n\t\t\tif( strcmp(entry->d_name, \".\") != 0 && strcmp(entry->d_name, \"..\") != 0 ) {\r\n\t\t\t\tchar buff[1000];\r\n\t\t\t\tsprintf(buff, \"%s/%s\",path, entry->d_name);\r\n\t\t\t\tQueueList(pCtx, buff);\r\n\t\t\t}\r\n\t\t\tentry = readdir(pDIR);\r\n\t\t}\r\n\t\tclosedir(pDIR);\r\n\r\n\t\tconst char* pathToDelete = GetQueueItem(pCtx);\r\n\t\twhile (pathToDelete) {\r\n\t\t\tremoveTmpFileNative(pathToDelete);\r\n\t\t\tpathToDelete = GetQueueItem(pCtx);\r\n\t\t}\r\n\t} else {\r\n\t\tif (delFile) {\r\n\t\t\tremoveTmpFileNative(path);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nbool deleteFiles(const char* path) {\r\n\tSDelContext ctx;\r\n\t// 0. Alloc a buffer of 200 KB for text buffering. \r\n\tctx.m_deleteQueue\t\t= new char[MAX_SIZE_BUFFER_QUEUE_PATH];\r\n\tctx.m_deleteQueueIndex\t= new u32[MAX_SIZE_ENTRY_COUNT];\r\n\r\n\tbool res = false;\r\n\tif (ctx.m_deleteQueue && ctx.m_deleteQueueIndex) {\r\n\t\t// 1. Convert abstract path to OS path.\r\n\t\tconst char* pathNative;\r\n\t\tif ((pathNative = getFullNativePath(path))) {\r\n\t\t\t// Check if there is a \"/\" at the end, if so remove it.\r\n\t\t\tu32 length = strlen(pathNative);\r\n\t\t\tif ((pathNative[length-1] == '/') || (pathNative[length-1] == '\\\\'))\r\n\t\t\t{\r\n\t\t\t\tconst char* patchAdr = &pathNative[length-1];\r\n\t\t\t\tchar* writeAdr = (char*)patchAdr;\r\n\t\t\t\t*writeAdr = 0; // End string.\r\n\t\t\t}\r\n\r\n\t\t\tdeleteRecurse(&ctx, pathNative, true);\r\n\t\t\t// 2. Call to free\r\n\t\t\tres = true;\r\n\r\n\t\t\t// Delete path after finishing using it.\r\n\t\t\tdelete pathNative;\r\n\t\t}\r\n\t}\r\n\r\n\t// 3. Free buffer\r\n\tdelete ctx.m_deleteQueue;\r\n\tdelete ctx.m_deleteQueueIndex;\r\n\treturn res;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/FileDelete.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _KLB_FILE_DELETE_\r\n#define _KLB_FILE_DELETE_\r\n\r\n#include <dirent.h>\r\n\r\n#include \"CPFInterface.h\"\r\n\r\nbool deleteFiles(const char* path);\r\nconst char* getFullNativePath(const char* path);\r\nvoid removeTmpFileNative(const char* filePath);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/FontRendering.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"FontRendering.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"utf8.h\"\r\n\r\n// Prototype to avoid warning.\r\nvoid test();\r\n\r\nclass FntDebug {\r\npublic:\r\n\tstatic void check();\r\nprivate:\r\n\tstatic void checkTreeRec(u32 depth, u32 idx, u32 code);\r\n};\r\n\r\n// ==========================================================================================\r\n//   Global Static Variables\r\n// ==========================================================================================\r\n\r\n/*static*/ CharDictionnary\tCharDictionnary::s_dicoArray[DICO_ELEMENT_COUNT];\r\n/*static*/ u16\t\t\t\tCharDictionnary::s_freeList = 0xFFFF;\r\n/*static*/ u16\t\t\t\tCharDictionnary::s_usedList = 0xFFFF;\r\n\r\n/*static*/ CharCache\t\tCharCache::s_cacheArray[CHAR_CACHE_SIZE];\r\n/*static*/ u16\t\t\t\tCharCache::s_cacheStart\t\t= 0xFFFF;\r\n/*static*/ u16\t\t\t\tCharCache::s_cacheEnd\t\t= 0;// First allocated object.\r\n/*static*/ u16\t\t\t\tCharCache::s_allocCounter\t= 0;\r\n\r\n/*static*/ FontObject*\t\tFontObject::s_list\t\t\t= NULL;\r\n/*static*/ bool\t\t\t\tFontObject::s_init\t\t\t= false;\r\n/*static*/ FT_Library\t\tFontObject::s_library;\r\n/*static*/ FontObject::FONTALIAS\tFontObject::g_fonts[5];\r\n/*static*/ u32\t\t\t\tFontObject::g_fontInstalled\t= 0;\r\n\r\n/*static*/ MemoryBlock*\t\tMemoryBlock::s_blockList\t= NULL;\r\n/*static*/ u16\t\t\t\tMemoryBlock::s_blockCounter\t= 0;\r\n\r\n// ==========================================================================================\r\n//   Global reboot function\r\n// ==========================================================================================\r\n\r\nint g_checkCount = 0;\r\nint g_counterChar;\r\n\r\nvoid FntDebug::check() {\r\n\t/*\r\n\t// 1. For each font\r\n\tFontObject* pFnt = FontObject::s_list;\r\n\tint totalCount = 0;\r\n\twhile (pFnt) {\r\n//\t\tprintf(\"===== Font : '%s' [%i]\\n\", pFnt->m_name, pFnt->m_refCount);\r\n\t\tg_counterChar = 0;\r\n\t\t// 2. Parse the cache tree and lookup.\r\n\t\tcheckTreeRec(0,pFnt->m_dicoStart, 0);\r\n\t\tpFnt = pFnt->m_next;\r\n//\t\tprintf(\"===== Has %i unicode entry\\n\", g_counterChar);\r\n\t\ttotalCount += g_counterChar;\r\n\t}\r\n//\tprintf(\"===== Total %i charFont, Alloc Total : %i\\n\", totalCount, CharCache::s_allocCounter);\r\n\tg_checkCount++;\r\n\t*/\r\n}\r\n\r\nvoid FntDebug::checkTreeRec(u32 depth, u32 idx, u32 code) {\r\n\tif (depth < 8) {\r\n\t\tCharDictionnary* pEntry = &CharDictionnary::s_dicoArray[idx];\r\n//\t\tprintf(\"D:%i %04i \", depth, idx);\r\n\r\n\t\tfor (u32 n=0; n < depth; n++) {\r\n//\t\t\tprintf(\" \");\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < 16; n++) {\r\n\t\t\tif (pEntry->m_idxTbl[n] != 0xFFFF) {\r\n//\t\t\t\tprintf(\"[%2i]%04i \", n, pEntry->m_idxTbl[n]);\r\n\t\t\t} else {\r\n//\t\t\t\tprintf(\"[%2i]NULL \", n);\r\n\t\t\t}\r\n\t\t}\r\n//\t\tprintf(\"\\n\");\r\n\t\t\r\n\t\tfor (int n=0; n < 16; n++) {\r\n\t\t\tif (pEntry->m_idxTbl[n] != 0xFFFF) {\r\n\t\t\t\tcheckTreeRec(depth + 1, pEntry->m_idxTbl[n], (code << 4) | n);\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tCharCache* pChar = &CharCache::s_cacheArray[idx];\r\n\t\tif (pChar->m_unicode != code) {\r\n\t\t\tklb_assertAlways(\" Adr Code : %08X <-> Char : %08X\\n\", code, pChar->m_unicode);\r\n\t\t} else {\r\n//\t\t\tprintf(\" Char : %08X\\n\", code);\r\n\t\t\tg_counterChar++;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nnamespace FontSystem {\r\n\tvoid reboot() {\r\n\t\t// Release Font\r\n\t\tFontObject::releaseFontSystem();\r\n\t\t// Clean Dictionnary entries.\r\n\t\tCharDictionnary::reboot();\r\n\t\t// Clean Character cache.\r\n\t\tCharCache::reboot();\r\n\t\t// Clean Memory Block\r\n\t\tMemoryBlock::reboot();\r\n\t}\r\n} // end FontSystem\r\n\r\n/*static*/ void test() {\r\n\tFontObject::test();\r\n\tCharDictionnary::test();\r\n\tMemoryBlock::test();\r\n\tCharCache::test();\r\n}\r\n\r\n/*static*/ void FontObject::test() {\r\n\tDEBUG_PRINT(\"Font Object Test====\\n\");\r\n\tFontObject* p    = s_list;\r\n\tFontObject* prev = NULL;\r\n\tDEBUG_PRINT(\"Init : %i\\n\", s_init ? 1 : 0);\r\n\tDEBUG_PRINT(\"Forward Parse.\\n\");\r\n\twhile (p) {\r\n\t\tDEBUG_PRINT(\"\\t%8X RefCount\\n\",p, p->m_refCount);\r\n\t\tprev = p;\r\n\t\tp = p->m_next;\r\n\t}\r\n\tp = prev;\r\n\tDEBUG_PRINT(\"Backward Parse.\\n\");\r\n\twhile (p) {\r\n\t\tDEBUG_PRINT(\"\\t%8X\\n\",p);\r\n\t\tp = p->m_prev;\r\n\t}\r\n}\r\n\r\n/*static*/ void CharDictionnary::test() {\r\n\tDEBUG_PRINT(\"Char Dictionnary Test====\\n\");\r\n\tu16 p\t\t= s_freeList;\r\n\tu16 prev\t= 0xFFFF;\r\n\tDEBUG_PRINT(\"Forward Parse Free List.\\n\");\r\n\twhile (p != 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"\\t%4X\\n\",p);\r\n\t\tprev = p;\r\n\t\tp = s_dicoArray[p].m_next;\r\n\t}\r\n\r\n\tp = prev;\r\n\tDEBUG_PRINT(\"Backward Parse free list.\\n\");\r\n\twhile (p != 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"\\t%4X\\n\",p);\r\n\t\tp = s_dicoArray[p].m_prev;\r\n\t}\r\n\r\n\tp\t\t= s_usedList;\r\n\tprev\t= 0xFFFF;\r\n\tDEBUG_PRINT(\"Forward Parse used List.\\n\");\r\n\twhile (p != 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"\\t%4X\\n\",p);\r\n\t\tprev = p;\r\n\t\tp = s_dicoArray[p].m_next;\r\n\t}\r\n\r\n\tp = (u16)prev;\r\n\tDEBUG_PRINT(\"Backward Parse used list.\\n\");\r\n\twhile (p != 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"\\t%4X\\n\",p);\r\n\t\tp = s_dicoArray[p].m_prev;\r\n\t};\r\n}\r\n\r\n/*static*/ void CharCache::test() {\r\n\tDEBUG_PRINT(\"Char Cache Test====\\n\");\r\n\tDEBUG_PRINT(\"\\tAlloc Count : %i\\n\",s_allocCounter);\r\n\r\n\tu16 p\t\t= s_cacheStart;\r\n\tu16 prev\t= 0xFFFF;\r\n\tDEBUG_PRINT(\"Forward Parse Allocated List.\\n\");\r\n\twhile (p != 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"\\t%4X\\n\",p);\r\n\t\tprev = p;\r\n\t\tp = s_cacheArray[p].m_next;\r\n\t}\r\n\r\n\tif ((prev != s_cacheEnd) && (s_cacheStart != 0xFFFF)) {\r\n\t\tDEBUG_PRINT(\"ERROR !!! Char cache\");\r\n\t}\r\n\r\n\tp = prev;\r\n\tDEBUG_PRINT(\"Backward Parse Allocated list.\\n\");\r\n\twhile (p != 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"\\t%4X\\n\",p);\r\n\t\tp = s_cacheArray[p].m_prev;\r\n\t}\r\n}\r\n\r\n/*static*/ void MemoryBlock::test() {\r\n}\r\n\r\n\r\n// ==========================================================================================\r\n//   Implementation CharCache\r\n// ==========================================================================================\r\n\r\nstruct SubEntry {\r\npublic:\r\n\tu16 offsetBitTable;\r\n};\r\n\r\nCharCache::CharCache() {\r\n}\r\n\r\nCharCache::~CharCache() {\r\n}\r\n\r\n// ==========================================================================================\r\n//   Implementation CharDictionnary\r\n// ==========================================================================================\r\n\r\nCharDictionnary::CharDictionnary()\r\n{\r\n\tm_next = 0xFFFF;\r\n\tm_prev = 0xFFFF;\r\n\tmemset(m_idxTbl, 0xFF, 16 * sizeof(u16));\r\n}\r\n\r\n/*static*/ CharCache* CharDictionnary::getChar(u32 uniCode, FontObject* pFont) {\r\n\tFntDebug::check();\t// Only place with one check.\r\n\r\n\tCharCache* pEntry = findEntry(pFont, uniCode);\r\n\r\n\tif (pEntry == NULL) {\r\n\t\tCharDictionnary* pParse = &s_dicoArray[pFont->m_dicoStart];\r\n\t\tu32 copyCode = uniCode;\r\n\t\tfor (int n=0; n < 7; n++) {\r\n\t\t\tu16 idx = pParse->m_idxTbl[copyCode>>28];\r\n\t\t\tif (idx == 0xFFFF) {\r\n\t\t\t\tidx = CharDictionnary::createDicoEntry();\r\n\t\t\t\tpParse->m_idxTbl[copyCode>>28] = idx;\r\n\t\t\t\tif (idx == 0xFFFF) {\r\n\t\t\t\t\treturn NULL;\r\n\t\t\t\t}\r\n\t\t\t\tpParse = &s_dicoArray[idx];\r\n\t\t\t} else {\r\n\t\t\t\tpParse = &s_dicoArray[idx];\r\n\t\t\t}\r\n\t\t\tcopyCode <<=4;\r\n\t\t}\r\n\r\n\t\tu16 idxChar;\r\n\t\tpEntry = CharCache::createEntry(uniCode, &idxChar, pFont);\r\n\t\tif (pEntry) {\r\n\t\t\tpParse->m_idxTbl[copyCode>>28] = idxChar;\r\n\t\t}\r\n\t}\r\n\treturn pEntry;\r\n}\r\n\r\n/*static*/ CharCache* CharDictionnary::findEntry(FontObject* pFont, u32 uniCode) {\r\n\tCharDictionnary* pParse = &s_dicoArray[pFont->m_dicoStart];\r\n\tu16 idx = 0;\r\n\tfor (int n=0; n < 8; n++) {\r\n\t\tidx = pParse->m_idxTbl[uniCode>>28];\r\n\t\tif (idx == 0xFFFF) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tpParse = &s_dicoArray[idx];\r\n\t\tuniCode <<=4;\r\n\t}\r\n\r\n\tif (idx != 0xFFFF) {\r\n\t\treturn &CharCache::s_cacheArray[idx];\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\n/*static*/ u16\t\t CharDictionnary::createDicoEntry() {\r\n\tif (s_freeList == 0xFFFF && s_usedList == 0xFFFF) {\r\n\t\tfor (int n=0; n < DICO_ELEMENT_COUNT; n++) {\r\n\t\t\ts_dicoArray[n].m_next = n+1;\r\n\t\t\ts_dicoArray[n].m_prev = n-1;\r\n\t\t}\r\n\t\ts_dicoArray[DICO_ELEMENT_COUNT-1].m_next = 0xFFFF;\r\n\r\n\t\ts_usedList = 0xFFFF;\r\n\t\ts_freeList = 0;\r\n\t}\r\n\r\n\tif (s_freeList != 0xFFFF) {\r\n\t\tif (s_dicoArray[s_freeList].m_next != 0xFFFF) {\r\n\t\t\ts_dicoArray[s_dicoArray[s_freeList].m_next].m_prev = s_dicoArray[s_freeList].m_prev;\r\n\t\t}\r\n\r\n\t\tif (s_dicoArray[s_freeList].m_prev != 0xFFFF) {\r\n\t\t\ts_dicoArray[s_dicoArray[s_freeList].m_prev].m_next = s_dicoArray[s_freeList].m_next;\t\t\t\r\n\t\t}\r\n\r\n\t\tif (s_usedList != 0xFFFF) {\r\n\t\t\ts_dicoArray[s_usedList].m_prev = s_freeList;\r\n\t\t}\r\n\t\t\r\n\t\tu16 nextFree = s_dicoArray[s_freeList].m_next;\r\n\r\n\t\ts_dicoArray[s_freeList].m_next = s_usedList;\r\n\t\ts_dicoArray[s_freeList].m_prev = 0xFFFF;\r\n\t\tmemset(s_dicoArray[s_freeList].m_idxTbl, 0xFF, 16 * sizeof(u16));\r\n\r\n\t\ts_usedList = s_freeList;\r\n\t\ts_freeList = nextFree;\r\n\t\treturn s_usedList;\r\n\t} else {\r\n\t\treturn 0xFFFF;\r\n\t}\r\n}\r\n\r\n/*static*/ void CharDictionnary::destroyTree(u16 entry, u16 depth) {\r\n\tif (entry != 0xFFFF) {\r\n\t\tif (depth <= 7) {\r\n\t\t\tu16* p16 = s_dicoArray[entry].m_idxTbl;\r\n\t\t\tfor (int n=0; n < 16; n++) {\r\n\t\t\t\tdestroyTree(p16[n], depth+1);\r\n\t\t\t}\r\n\r\n\t\t\tremoveEntry(entry);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*static*/ void CharDictionnary::removeEntry(u16 entry) {\r\n\tif (s_dicoArray[entry].m_next != 0xFFFF) {\r\n\t\ts_dicoArray[s_dicoArray[entry].m_next].m_prev = s_dicoArray[entry].m_prev;\r\n\t}\r\n\r\n\tif (s_dicoArray[entry].m_prev != 0xFFFF) {\r\n\t\ts_dicoArray[s_dicoArray[entry].m_prev].m_next = s_dicoArray[entry].m_next;\t\t\t\r\n\t} else {\r\n\t\ts_usedList = s_dicoArray[entry].m_next;\r\n\t}\r\n\r\n\ts_dicoArray[entry].m_next = s_freeList;\r\n\ts_dicoArray[entry].m_prev = 0xFFFF;\r\n\r\n\tif (s_freeList != 0xFFFF) {\r\n\t\ts_dicoArray[s_freeList].m_prev = entry;\r\n\t}\r\n\r\n\ts_freeList = entry;\r\n}\r\n\r\n/*static*/ void\tCharDictionnary::removeDicoEntry(u16 startEntry, u32 unicode) {\r\n\tremoveDicoEntryRec(startEntry, 0, unicode,startEntry);\r\n}\r\n\r\n/*static*/ u16 CharDictionnary::removeDicoEntryRec(u16 entry, u32 depth, u32 unicode,u16 startEntry) {\r\n\tif (depth < 7) {\r\n\t\tu16 next = s_dicoArray[entry].m_idxTbl[unicode>>28];\r\n\t\tu16 idx  = 0xFFFF;\r\n\t\tif (next != 0xFFFF) {\r\n\t\t\tidx = removeDicoEntryRec(next, depth + 1, unicode << 4, startEntry);\r\n\t\t\tif (idx != 0xFFFF) {\r\n\t\t\t\ts_dicoArray[entry].m_idxTbl[unicode>>28] = 0xFFFF;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t// Remove entry.\r\n\t\ts_dicoArray[entry].m_idxTbl[unicode>>28] = 0xFFFF;\r\n\t}\r\n\r\n\tu16* p16 = s_dicoArray[entry].m_idxTbl;\r\n\tif ((p16[0] == 0xFFFF) && (p16[1] == 0xFFFF) && (p16[2] == 0xFFFF) && (p16[3] == 0xFFFF) && (p16[4] == 0xFFFF) && (p16[5] == 0xFFFF) && (p16[6] == 0xFFFF) && (p16[7] == 0xFFFF) \r\n\t\t&& (p16[8] == 0xFFFF) && (p16[9] == 0xFFFF) && (p16[10] == 0xFFFF) && (p16[11] == 0xFFFF) && (p16[12] == 0xFFFF) && (p16[13] == 0xFFFF) && (p16[14] == 0xFFFF) && (p16[15] == 0xFFFF)) {\r\n\r\n\t\tif (entry != startEntry) {\t// Never delete the root node\r\n\t\t\tremoveEntry(entry);\r\n\t\t}\r\n\r\n\t\treturn entry;\r\n\t} else {\r\n\t\treturn 0xFFFF;\r\n\t}\r\n}\r\n\r\n// ==========================================================================================\r\n//   Implementation Memory Block\r\n// ==========================================================================================\r\n\r\n/*static*/ void MemoryBlock::reboot() {\r\n\tMemoryBlock* parse = s_blockList;\r\n\twhile (parse) {\r\n\t\tMemoryBlock* next = parse->m_next;\r\n\t\tdelete parse;\r\n\t\tparse = next;\r\n\t}\r\n\ts_blockList\t\t= NULL;\r\n\ts_blockCounter\t= 0;\r\n}\r\n\r\n/*static*/ void MemoryBlock::freeBlock(u16 blockID, u16 subID) {\r\n\tMemoryBlock* parse = s_blockList;\r\n\tMemoryBlock* prev  = NULL;\r\n\twhile (parse) {\r\n\t\tif (parse->m_id == blockID) {\r\n\t\t\tparse->m_allocFlag &= ~(1<<subID);\t// Reset flag subID\r\n\r\n\t\t\tif (parse->m_allocFlag == 0) {\r\n\t\t\t\tif (parse != s_blockList) {\t// Better to keep always ONE block as we need to render text anyway.\r\n\t\t\t\t\t// ... prev is then ALWAYS a valid pointer.\r\n\t\t\t\t\tprev->m_next = parse->m_next;\r\n\t\t\t\t\tdelete parse;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tprev  = parse;\r\n\t\tparse = parse->m_next;\r\n\t}\r\n}\r\n\r\n/*static*/ bool MemoryBlock::allocBlock(u16* returnBlock, u16* returnSubID, u8** ppData) {\r\n\tMemoryBlock* parse = s_blockList;\r\n\twhile (parse) {\r\n\t\tu32 flag = parse->m_allocFlag; \r\n\t\tif (flag != 0xFFFFFFFF) {\r\n\t\t\tu16 size = 16;\r\n\t\t\tu16 mask = (1 << size)-1;\r\n\t\t\tu16 idx  = 0;\r\n\r\n\t\t\t// log free bit search : 5 iteration only.\r\n\t\t\twhile (size > 1) {\r\n\t\t\t\tif (((flag>>idx) & mask) != mask) {\r\n\t\t\t\t\t// Lower part\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Higher part\r\n\t\t\t\t\tidx += size;\r\n\t\t\t\t}\r\n\t\t\t\tsize >>= 1;\r\n\t\t\t\tmask >>= size;\r\n\t\t\t}\r\n\r\n\t\t\tif (((flag>>idx) & mask) == mask) {\r\n\t\t\t\t// Higher part\r\n\t\t\t\tidx++;\r\n\t\t\t}\r\n\t\t\tparse->m_allocFlag |= 1<<idx;\r\n\t\t\t*returnBlock\t= parse->m_id;\r\n\t\t\t*returnSubID\t= idx;\r\n\t\t\t*ppData\t\t\t= &parse->m_mem[MB_BLOCK_ITEM_SIZE * idx];\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tparse = parse->m_next;\r\n\t}\r\n\r\n\tparse = new MemoryBlock();\r\n\tif (parse) {\r\n\t\tparse->m_next\t= s_blockList;\r\n\t\ts_blockList\t\t= parse;\r\n\r\n\t\tparse->m_allocFlag\t= 1;\r\n\t\tparse->m_id\t\t\t= s_blockCounter++;\r\n\t\tparse->partSize\t\t= MB_BLOCK_ITEM_SIZE;\r\n\r\n\t\t*returnBlock\t= parse->m_id;\r\n\t\t*returnSubID\t= 0;\r\n\t\t*ppData\t\t\t= &parse->m_mem[0];\r\n\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\n/*static*/ const char* FontObject::getFileFromFontName(const char* fontName, char* tmpBuffer) {\r\n\r\n\tu32 idx\t\t\t= 0xFFFF;\r\n\tu32 defaultIdx\t= 0xFFFF;\r\n\r\n\t// Search logical name\r\n\tfor (u32 n=0; n < g_fontInstalled; n++) {\r\n\t\tif (fontName && stricmp(fontName, g_fonts[n].logicalName) == 0) {\r\n\t\t\tidx = n;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (g_fonts[n].isDefault) {\r\n\t\t\tdefaultIdx = n;\r\n\t\t}\r\n\t}\r\n\r\n\t// Search physical name\r\n\tif ((idx == 0xFFFF) && fontName) {\r\n\t\tfor (u32 n=0; n < g_fontInstalled; n++) {\r\n\t\t\tif (strstr(g_fonts[n].physicalName, fontName)) {\r\n\t\t\t\tidx = n;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// If not found, use default.\r\n\tif (idx == 0xFFFF) {\r\n\t\tidx = defaultIdx;\r\n\t}\r\n\r\n\tif (idx == 0xFFFF) {\r\n\t\tDEBUG_PRINT(\"Call porting registerFont function from entry point (ie entrance) or LUA start.\");\r\n\t\treturn NULL;\r\n\t} else {\r\n\t\t// Copy back to user\r\n\t\tsprintf(tmpBuffer,\"%s\",g_fonts[idx].physicalName);\r\n\r\n\t\t// return input buffer;\r\n\t\treturn tmpBuffer;\r\n\t}\r\n}\r\n\r\n/*static*/ void FontObject::releaseFontSystem() {\r\n\tif (s_init) {\r\n\t\ts_init = false;\r\n\t\twhile (s_list) {\r\n\t\t\t// s_list modified by destroyFont\r\n\t\t\tdestroyFont(s_list, true);\r\n\t\t}\r\n\t\tFT_Done_FreeType( s_library );\r\n\t\tfor (u32 n=0; n < g_fontInstalled; n++) {\r\n\t\t\tdelete g_fonts[n].physicalName;\t\t// Porting layer 'new'\r\n\t\t\tKLBDELETEA(g_fonts[n].logicalName);\t// Used copy utility to do copy, KLBNEWA\r\n\t\t}\r\n\t\tg_fontInstalled = 0;\r\n\t}\r\n}\r\n\r\n/*static*/ bool\tFontObject::registerFont(const char* logicalName, const char* physicalFont, bool asDefault) {\r\n\tif ((g_fontInstalled < 5) && logicalName && physicalFont) {\r\n\t\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\t\tconst char* fullpath = platform.getFullPath(physicalFont);\t// Check also that file exists.\r\n\t\tif (fullpath) {\r\n\t\t\tconst char* logicN\t= CKLBUtility::copyString(logicalName);\r\n\t\t\tif (logicN) {\r\n\t\t\t\tif (asDefault) {\r\n\t\t\t\t\tfor (u32 n=0; n < g_fontInstalled;n++) {\r\n\t\t\t\t\t\tg_fonts[n].isDefault = false;\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tg_fonts[g_fontInstalled\t\t].isDefault\t\t= true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbool hasDefault = false;\r\n\t\t\t\t\tfor (u32 n=0; n < g_fontInstalled;n++) {\r\n\t\t\t\t\t\thasDefault |= g_fonts[n].isDefault;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (!hasDefault) {\r\n\t\t\t\t\t\tg_fonts[g_fontInstalled].isDefault\t\t= true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tg_fonts[g_fontInstalled\t\t].logicalName\t= logicN;\r\n\t\t\t\tg_fonts[g_fontInstalled++\t].physicalName\t= fullpath;\r\n\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tdelete fullpath;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\n/*\r\n\tWe render the same size IN PIXEL\r\n\tWe do not want the font to have the same PHYSICAL size in millimeter on each device !\r\n\tThus using the SAME DPI for any screen.\r\n*/\r\n#define FIXED_DPI\t(60)\r\n\r\n/*static*/ FontObject* FontObject::createFont(const char* fontName, u32 size) {\r\n\t// 0. Init library if not done yet.\r\n\ts32 error;\r\n\tif (!s_init) {\r\n\t\terror = FT_Init_FreeType( &s_library );              /* initialize library */\r\n\t\tif ( !error ) {\r\n\t\t\ts_init = true;\r\n\t\t}\r\n\t}\r\n\r\n\t// 1. Search matching font\r\n\tFontObject* pFont = s_list;\r\n\t\r\n\tu32 lenN = 0;\r\n\tif (fontName) {\r\n\t\tlenN = strlen(fontName);\r\n\t\r\n\t\twhile (pFont) {\r\n\t\t\tif (pFont->m_lenName == lenN) {\r\n\t\t\t\tif (pFont->m_size == size) {\r\n\t\t\t\t\tif (strcmp(pFont->m_name, fontName) == 0) {\r\n\t\t\t\t\t\tpFont->m_refCount++;\r\n\t\t\t\t\t\treturn pFont;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpFont = pFont->m_next;\r\n\t\t}\r\n\t}\r\n\t\r\n\tFT_Face face;\r\n\t\r\n\t// Internal Font\r\n\tchar buff[512];\r\n\r\n\terror = FT_New_Face( s_library, FontObject::getFileFromFontName(fontName, buff), 0, &face );/* create face object */\r\n\tif ( !error ) {\r\n\t\terror = FT_Set_Char_Size( \tface, \t\t/* handle to face object\t\t\t*/ \r\n\t\t\t\t\t\t\t\t\t0,\t\t\t/* char_width same as char_height\t*/\r\n\t\t\t\t\t\t\t\t\tsize<<6,\t/* char_height in 1/64th of points\t*/ \r\n\t\t\t\t\t\t\t\t\tFIXED_DPI,\t/* horizontal device resolution\t\t*/\r\n\t\t\t\t\t\t\t\t\tFIXED_DPI \t/* vertical device resolution\t\t*/\r\n\t\t\t\t\t\t\t\t);\r\n\t\t/* TODO potential API usage instead.\r\n\t\terror = FT_Set_Pixel_Sizes( face,\t// Handle to face object\r\n\t\t\t\t\t\t\t\t\t0, \t\t// Width Same as height (pixel)\r\n\t\t\t\t\t\t\t\t\tsize * ratio);\r\n\t\t */\r\n\t\tif ( !error ) {\r\n\t\t\tpFont = new FontObject();\r\n\t\t\t\r\n\t\t\tif (pFont) {\r\n\t\t\t\tpFont->m_prev = NULL;\r\n\t\t\t\t// 2. If not found, add at the beginning of the list\r\n\t\t\t\tif (s_list) {\r\n\t\t\t\t\ts_list->m_prev = pFont;\r\n\t\t\t\t\tpFont->m_next = s_list;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpFont->m_next = NULL;\r\n\t\t\t\t}\r\n\t\t\t\ts_list = pFont;\r\n\t\t\t\t\r\n\t\t\t\tpFont->m_refCount\t= 1;\r\n\t\t\t\tpFont->m_size\t\t= size;\r\n\t\t\t\tpFont->m_face\t\t= face;\r\n\t\t\t\tpFont->m_lenName\t= lenN;\r\n\t\t\t\tpFont->m_name\t\t= fontName ? CKLBUtility::copyString(fontName) : NULL;\r\n\t\t\t\tpFont->m_hasKerning = FT_HAS_KERNING( face );\r\n\t\t\t\tpFont->m_dicoStart\t= CharDictionnary::createDicoEntry();\r\n\t\t\t\tif (pFont->m_dicoStart != 0xFFFF) {\r\n\t\t\t\t\treturn pFont;\r\n\t\t\t\t}\r\n\t\t\t\tdestroyFont(pFont);\r\n\t\t\t\treturn NULL;\r\n\t\t\t}\r\n\t\t}\r\n\t\tFT_Done_Face ( face );\r\n\t} else {\r\n\t\tif (fontName) {\r\n\t\t\t// Try to create default font.\r\n\t\t\tif (strcmp(fontName, \"\")!=0) {\r\n\t\t\t\treturn createFont(\"\", size);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// Error.\r\n\treturn NULL;\r\n}\r\n\r\n/*static*/ void FontObject::destroyFont(FontObject* pFont, bool force) {\r\n\tif (pFont) {\r\n\t\tif ((--pFont->m_refCount == 0) || force) {\r\n\t\t\t// 1. Remove from list\r\n\t\t\tif (pFont->m_prev != NULL) {\r\n\t\t\t\tpFont->m_prev->m_next\t= pFont->m_next;\r\n\t\t\t} else {\r\n\t\t\t\ts_list = pFont->m_next;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (pFont->m_next != NULL) {\r\n\t\t\t\tpFont->m_next->m_prev = pFont->m_prev;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// 2. Destroy face\r\n\t\t\tFT_Done_Face ( pFont->m_face );\r\n\r\n\t\t\tCharDictionnary::destroyTree(pFont->m_dicoStart, 0);\r\n\r\n\t\t\t// 3. Destroy object\r\n\t\t\tdelete pFont;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nFontObject::FontObject()\r\n{ /* Do nothing, all done inside static functions */ }\r\n\r\nFontObject::~FontObject()\r\n{\r\n\t// Scan all the allocated character and remove any pointer reference to font object.\r\n\tfor (int n=0; n < CharCache::s_allocCounter; n++) {\r\n\t\tif (CharCache::s_cacheArray[n].m_pFontObj == this) {\r\n\t\t\tCharCache::s_cacheArray[n].m_pFontObj = NULL;\r\n\t\t}\r\n\t}\r\n\r\n\tKLBDELETEA(m_name);\r\n\tm_name = NULL;\r\n}\r\n\r\nfloat FontObject::getAscent() {\r\n\tFT_Size_Metrics* met = &this->m_face->size->metrics;\r\n\treturn (float)(met->ascender >> 6);\r\n}\r\n\r\nFT_GlyphSlot FontObject::renderChar(u32 unicode) {\r\n\tFT_GlyphSlot glyphslt = m_face->glyph;\r\n\tu32 glyph_index = FT_Get_Char_Index( m_face, unicode );\r\n\tFT_Error error = FT_Load_Glyph(\tm_face,\t\t\t\t/* handle to face object */\r\n\t\t\t\t\t\t\tglyph_index,\t\t/* glyph index */\r\n\t\t\t\t\t\t\tFT_LOAD_RENDER );\t/* does render with FT_RENDER_MODE_NORMAL as we do not perform any transform */\r\n\tif (!error) {\r\n\t\treturn glyphslt;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\n/*static*/ CharCache* CharCache::createEntry(u32 uniCode, u16* outIdx, FontObject* pFont) {\r\n\tCharCache* pItem = NULL;\r\n\r\n\t// Render Glyph\r\n\tFT_GlyphSlot glyphslt = pFont->renderChar(uniCode);\r\n\t\r\n\t// Add to block\t\r\n\tu16 blockIdx;\r\n\tu16 blockCharIdx;\r\n\tu8* ptrBuff;\r\n\r\n\tif (glyphslt && MemoryBlock::allocBlock(&blockIdx, &blockCharIdx, &ptrBuff)) {\r\n\t\tu16 idx;\r\n\t\tif (s_allocCounter < CHAR_CACHE_SIZE) {\r\n\t\t\tidx = s_allocCounter++;\r\n\t\t} else {\r\n\t\t\tidx = s_cacheEnd;\r\n\t\t\tCharCache* pItem = &s_cacheArray[idx];\r\n\t\t\t// 1.Remove from link list -> maintain head AND queue.\r\n\t\t\tif (pItem->m_prev != 0xFFFF) {\r\n\t\t\t\ts_cacheArray[pItem->m_prev].m_next = 0xFFFF;\r\n\t\t\t\ts_cacheEnd = pItem->m_prev;\r\n\t\t\t} else {\r\n\t\t\t\ts_cacheEnd = s_cacheStart; // Should never arrive\r\n\t\t\t}\r\n\r\n\t\t\t// 2.Remove data from block\r\n\t\t\tMemoryBlock::freeBlock(pItem->m_blockIndex, pItem->m_blockCharIndex);\r\n\r\n\t\t\t// 3.Remove entry from dictionnary\r\n\t\t\tif (pItem->m_pFontObj) {\r\n\t\t\t\tCharDictionnary::removeDicoEntry(pItem->m_pFontObj->m_dicoStart, pItem->m_unicode);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tpItem = &s_cacheArray[idx];\r\n\t\t*outIdx = idx;\r\n\t\tpItem->m_unicode = uniCode;\r\n\r\n\t\t// Add to link list\r\n\t\tpItem->m_next\t = s_cacheStart;\r\n\t\tpItem->m_prev\t = 0xFFFF;\r\n\t\tif (s_cacheStart != 0xFFFF) {\r\n\t\t\ts_cacheArray[s_cacheStart].m_prev = idx;\r\n\t\t}\r\n\t\ts_cacheStart = idx;\t// s_cacheEnd is 0 by default -> always point to first allocated item.\r\n\r\n\t\tFT_Bitmap* bmp\t\t= &glyphslt->bitmap;\r\n\t\tpItem->m_width\t\t= bmp->width;\r\n\t\tpItem->m_height\t\t= bmp->rows;\r\n\t\tpItem->m_offsetX\t= glyphslt->bitmap_left;\r\n\t\tpItem->m_offsetY\t= -glyphslt->bitmap_top;\r\n\t\tpItem->m_advanceX\t= (s8)(glyphslt->advance.x >> 6);\r\n\t\tpItem->m_advanceY\t= (s8)(glyphslt->advance.y >> 6);\r\n\t\tpItem->m_blockIndex\t= blockIdx;\r\n\t\tpItem->m_blockCharIndex = blockCharIdx;\r\n\t\tpItem->m_ptr\t\t= ptrBuff;\r\n\t\tpItem->m_pFontObj\t= pFont;\r\n\r\n\t\tu8* write\t= pItem->m_ptr;\r\n\t\tu8* src\t\t= bmp->buffer;\r\n//#define PRESKIP\r\n\r\n#ifdef PRESKIP\r\n\t\twrite++;\r\n#endif\r\n\t\tfor (int y=0; y < bmp->rows; y++) {\r\n#ifdef PRESKIP\r\n\t\t\tu8 start = 0xFF;\r\n\t\t\tfor (int x=0; x < bmp->width; x++) {\r\n\t\t\t\tif ((*src) && (start==0xFF)) {\r\n\t\t\t\t\tstart = x;\r\n\t\t\t\t}\r\n\t\t\t\t*write++ = *src++;\r\n\t\t\t}\r\n\t\t\twrite[-(bmp->width+1)] = start;\r\n\t\t\twrite++;\r\n#else\r\n\t\t\tmemcpy(write, src, bmp->width);\r\n\t\t\tsrc\t\t+= bmp->pitch;\r\n\t\t\twrite\t+= bmp->width;\r\n#endif\r\n\t\t}\r\n\r\n\t\tpItem->m_tblOffset = ((pItem->m_width * bmp->rows) + 3) & 0xFFFC;\r\n\t\tu32 size = ((bmp->width+31)>>5)*(bmp->rows<<2);\t// number of 32 bit mask for storage. \r\n\t\tif ((pItem->m_tblOffset < MB_BLOCK_ITEM_SIZE) && ((pItem->m_tblOffset+size) <= MB_BLOCK_ITEM_SIZE)) {\r\n\t\t\tu32* p = (u32*)&pItem->m_ptr[pItem->m_tblOffset];\r\n\t\t\tfor (int x=0; x < bmp->width; x += 32) {\r\n\t\t\t\tbool last = (x + 32) >= bmp->width;\r\n\t\t\t\tu32 ex = 32;\r\n\r\n\t\t\t\tif (last) {\r\n\t\t\t\t\tif (bmp->width != 32) {\r\n\t\t\t\t\t\tex = bmp->width & 0x1F;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int y=0; y < bmp->rows; y++) {\r\n\t\t\t\t\tu32 mask = 0;\r\n\r\n\t\t\t\t\tu8* ptr = &pItem->m_ptr[x + (y * bmp->width)]; \r\n\t\t\t\t\tfor (u32 xi=0; xi < ex; xi++) {\r\n\t\t\t\t\t\tif (*ptr++) {\r\n\t\t\t\t\t\t\tmask |= 1 << xi;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t*p++ = mask;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"Font char does not fit into cache size : MB_BLOCK_ITEM_SIZE\");\r\n\t\t}\r\n\t}\r\n\r\n\treturn pItem;\r\n}\r\n\r\nvoid FontObject::renderText\t(s32 x, s32 y, const char* text, u8* Buffer8888, u32 colorARGB8888, u32 buffWidth, u32 buffHeight, s32 strideByte, bool use4444) {\r\n\t// FT_GlyphSlot glyphslt = m_face->glyph;\r\n\ts32 currX = x;\r\n\ts32 currY = y;\r\n\r\n\t// ARGB\r\n\tu32 rgb32 = 0;\r\n\tu8* pCol = (u8*)&rgb32;\r\n\tpCol[0] = colorARGB8888>>16;\r\n\tpCol[1] = colorARGB8888>>8;\r\n\tpCol[2] = colorARGB8888;\r\n\r\n\tu16 rgb16 = ((colorARGB8888 >> 8) & 0xF000)\t\t// Red\r\n\t\t\t  | ((colorARGB8888 >> 4) & 0x0F00)\t\t// Green\r\n\t\t\t  | ((colorARGB8888 >> 0) & 0x00F0)\t\t// Blue\r\n\t\t\t  ;\r\n\r\n\tu32 arrayUnicode[1500];\r\n\tu32 charCount = 1500;\r\n\r\n\tif (wind_utf8ucs4(text, arrayUnicode, &charCount) == 0)\r\n\tfor (u32 n=0; n < charCount; n++) {\r\n\t\tu32 charcode = arrayUnicode[n];\r\n\t\t// DEBUG_PRINT(\"RENDERING; letter: %x(%c)\", charcode, (char)charcode);\r\n\r\n\t\tCharCache* pChar = CharDictionnary::getChar(charcode, this);\r\n\t\t\r\n\t\tif (pChar) {\r\n\t\t\t//========================================\r\n\t\t\t//========================================\r\n\t\t\t// Rendering\r\n\t\t\t//========================================\r\n\t\t\t//========================================\r\n\r\n\r\n\t\t\t//----------------------------------------\r\n\t\t\t//  Clipping\r\n\t\t\t//----------------------------------------\r\n\r\n\t\t\ts32 Wwidth\t\t= pChar->m_width;\r\n\t\t\ts32 Wheight\t\t= pChar->m_height;\t// Number of line to process.\r\n\r\n\t\t\ts32 px\t\t\t= currX + pChar->m_offsetX;\r\n\t\t\ts32 py\t\t\t= currY + pChar->m_offsetY;\r\n\t\t\tu32 startX\t\t= 0;\r\n\t\t\tu32 startY\t\t= 0;\r\n\t\t\t// DEBUG_PRINT(\"RENDERING; -- stepping into rendering path: %x(%c)\", charcode, (char)charcode);\r\n\t\t\t// DEBUG_PRINT(\"RENDERING; px=%d, py=%d, buffWidth=%d, buffHeight=%d\", px, py, buffWidth, buffHeight);\r\n\r\n\t\t\t// Top Left Clipping\r\n\t\t\tif (px < 0)\r\n\t\t\t{\r\n\t\t\t\tWwidth\t+= px;\r\n\t\t\t\tstartX  -= px;\r\n\t\t\t\tpx\t\t= 0;\r\n\t\t\t}\r\n\r\n\t\t\tif (py < 0) {\r\n\t\t\t\tWheight\t+= py;\r\n\t\t\t\tstartY  -= py;\r\n\t\t\t\tpy\t\t= 0;\r\n\t\t\t}\r\n\r\n\t\t\t// Bottom right Clipping\r\n\t\t\ts32 overRight = buffWidth  - (Wwidth + px);\r\n\t\t\ts32 overBottom= buffHeight - (Wheight+ py);\r\n\r\n\t\t\tif (overRight < 0) {\r\n\t\t\t\tWwidth += overRight;\r\n\t\t\t}\r\n\r\n\t\t\tif (overBottom < 0) {\r\n\t\t\t\tWheight += overBottom;\r\n\t\t\t}\r\n\r\n\t\t\tif ((Wwidth<=0) || (Wheight<=0)) {\r\n\t\t\t\tcurrX += pChar->m_advanceX;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t// DEBUG_PRINT(\"RENDERING; survived clipping\");\r\n\r\n\t\t\t// Process by vertical 32 pixel chunks.\r\n\t\t\tu32 slab32\t= 0;\r\n\t\t\tu32 slab\t= 0;\r\n\t\t\twhile (slab < pChar->m_width) {\r\n\r\n\t\t\t\t// Code for continue...\r\n\t\t\t\tslab\t= slab32;\r\n\t\t\t\tslab32 \t= slab+32;\r\n\r\n\t\t\t\tif (startX >= slab32) {\r\n\t\t\t\t\tcontinue;\t// This slab has no drawn pixel.\r\n\t\t\t\t}\r\n\t\t\t\t// DEBUG_PRINT(\"RENDERING; ---- this slab has at least one pixel: %x(%c)\", charcode, (char)charcode);\r\n\r\n\t\t\t\tu32 endX = startX + Wwidth;\r\n\r\n\t\t\t\tif (endX <= slab) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Now endX is INCLUDED in clip area.\r\n\t\t\t\tendX--;\r\n\r\n\t\t\t\tu32 clipMask = (u32)(-1);\r\n\r\n\t\t\t\t\r\n\t\t\t\t// Left side clipping inside slab.\r\n\t\t\t\tif ((startX >= slab) && (startX < slab32)) {\r\n\t\t\t\t\tclipMask -= ((1<<(startX & 0x1F))-1);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Right side clipping inside slab.\r\n\t\t\t\tif ((endX >= slab) && (endX < slab32)) {\r\n\t\t\t\t\tclipMask &= (0xFFFFFFFF)>>(31 - (endX & 0x1F));\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (clipMask == 0) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//----------------------------------------\r\n\t\t\t\t//  Rendering\r\n\t\t\t\t//----------------------------------------\r\n\t\t\t\tu32* pMaskInfo\t= (u32*)&pChar->m_ptr[pChar->m_tblOffset + ((pChar->m_height<<2)*(slab>>5)) + (startY<<2)];\r\n#ifdef PRESKIP\r\n\t\t\t\tu8* buffSrc\t\t= &pChar->m_ptr[1];\r\n\t\t\t\ts32 strideSrc\t= pChar->m_width - 1;\r\n#else\r\n\t\t\t\tu8* buffSrc\t\t= pChar->m_ptr;\r\n\t\t\t\ts32 strideSrc\t= pChar->m_width;\r\n#endif\r\n\t\t\t\tu32 roundX\t\t= (((startX & 0x1F)>>2)<<2);\r\n\t\t\t\tu8* pSrcL\t\t= &buffSrc\t\t[roundX + (startY * strideSrc) + slab];\r\n\r\n\t\t\t\tif (use4444) {\r\n\t\t\t\t\tu16* pDstL\t= (u16*)(&Buffer8888\t[(px<<1) + (py * strideByte) + (slab << 1)]);\r\n\t\t\t\t\tu16* pDstE\t= &pDstL[Wheight * (strideByte >> 1)];\r\n\t\t\t\t\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Could do a fct ptr here if various rendering needed (ie alpha)\r\n\t\t\t\t\t// fct(pDstL, pDstE, pSrcL, pMaskInfo, clipMask, roundX, rgb32)\r\n\t\t\t\t\t//\r\n\t\t\t\t\twhile (pDstL < pDstE) {\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Render the slab\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// 1. recompute roundX with start : roundX += roundX - start>roundX)\r\n\r\n\t#ifdef PRESKIP\r\n\t\t\t\t\t\ts32 delta = pSrcL[-1] - roundX;\r\n\t\t\t\t\t\tdelta\t= (delta < 0) ? 0 : (delta>>2)<<2;\r\n\t\t\t\t\t\troundX\t+= delta;\r\n\t#endif\r\n\t\t\t\t\t\tu32 mask = (*pMaskInfo++) & clipMask;\r\n\t\t\t\t\t\tmask >>= roundX;\r\n\t#ifdef PRESKIP\r\n\t\t\t\t\t\tu8* src = &pSrcL[delta];\r\n\t#else\r\n\t\t\t\t\t\tu8* src = pSrcL;\r\n\t#endif\r\n\t\t\t\t\t\tu16* dst = pDstL;\r\n\r\n\t\t\t\t\t\twhile (mask) {\r\n\t\t\t\t\t\t\t// Write RGBA then overwrite alpha.\r\n\t\t\t\t\t\t\t// #define RGBA(idx,alpha)\tdst[idx]=(rgb16 | ((src[idx] >>1)>>4))\r\n\t\t\t\t\t\t\t#define RGBA(idx)\tdst[idx]=(rgb16 | (src[idx]>>4))\r\n\r\n\t\t\t\t\t\t\tswitch (mask & 0xF) {\r\n\t\t\t\t\t\t\tcase 0x0: break;\r\n\t\t\t\t\t\t\tcase 0x1: RGBA(0); break;\r\n\t\t\t\t\t\t\tcase 0x2: RGBA(1); break;\r\n\t\t\t\t\t\t\tcase 0x3: RGBA(0); RGBA(1); break;\r\n\t\t\t\t\t\t\tcase 0x4: RGBA(2); break;\r\n\t\t\t\t\t\t\tcase 0x5: RGBA(0); RGBA(2); break;\r\n\t\t\t\t\t\t\tcase 0x6: RGBA(1); RGBA(2); break;\r\n\t\t\t\t\t\t\tcase 0x7: RGBA(0); RGBA(1); RGBA(2); break;\r\n\t\t\t\t\t\t\tcase 0x8: RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0x9: RGBA(0); RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0xA: RGBA(1); RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0xB: RGBA(0); RGBA(1); RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0xC: RGBA(2); RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0xD: RGBA(0); RGBA(2); RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0xE: RGBA(1); RGBA(2); RGBA(3); break;\r\n\t\t\t\t\t\t\tcase 0xF: RGBA(0); RGBA(1); RGBA(2); RGBA(3); break;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t#undef RGBA\r\n\t\t\t\t\t\t\tdst += 4;\r\n\t\t\t\t\t\t\tsrc += 4;\r\n\t\t\t\t\t\t\tmask >>= 4;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tpSrcL += strideSrc;\r\n\t\t\t\t\t\tpDstL += strideByte>>1;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tu8* pDstL\t\t= &Buffer8888\t[(px<<2) + (py * strideByte) + (slab << 2)];\r\n\t\t\t\t\tu8* pDstE\t\t= &pDstL\t\t[Wheight * strideByte];\r\n\t\t\t\t\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Could do a fct ptr here if various rendering needed (ie alpha)\r\n\t\t\t\t\t// fct(pDstL, pDstE, pSrcL, pMaskInfo, clipMask, roundX, rgb32)\r\n\t\t\t\t\t//\r\n\t\t\t\t\twhile (pDstL < pDstE) {\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Render the slab\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// 1. recompute roundX with start : roundX += roundX - start>roundX)\r\n\r\n\t#ifdef PRESKIP\r\n\t\t\t\t\t\ts32 delta = pSrcL[-1] - roundX;\r\n\t\t\t\t\t\tdelta\t= (delta < 0) ? 0 : (delta>>2)<<2;\r\n\t\t\t\t\t\troundX\t+= delta;\r\n\t#endif\r\n\t\t\t\t\t\tu32 mask = (*pMaskInfo++) & clipMask;\r\n\t\t\t\t\t\tmask >>= roundX;\r\n\t#ifdef PRESKIP\r\n\t\t\t\t\t\tu8* src = &pSrcL[delta];\r\n\t#else\r\n\t\t\t\t\t\tu8* src = pSrcL;\r\n\t#endif\r\n\t\t\t\t\t\tu8* dst = pDstL;\r\n\r\n\t\t\t\t\t\t#define DBG(idx)\t(*((u32*)(&dst[idx<<2])))=0xFFFF00FF;\r\n\t\t\t\t\t\t// DBG(0);\r\n\r\n\t\t\t\t\t\twhile (mask) {\r\n\t\t\t\t\t\t\t// Write RGBA then overwrite alpha.\r\n\t\t\t\t\t\t\t#define RGB(idx)\t(*((u32*)(&dst[idx<<2])))=rgb32\r\n\r\n\t\t\t\t\t\t\tswitch (mask & 0xF) {\r\n\t\t\t\t\t\t\tcase 0x0: break;\r\n\t\t\t\t\t\t\tcase 0x1: RGB(0); dst[ 3] = src[0]; break;\r\n\t\t\t\t\t\t\tcase 0x2: RGB(1); dst[ 7] = src[1]; break;\r\n\t\t\t\t\t\t\tcase 0x3: RGB(0); dst[ 3] = src[0]; RGB(1); dst[ 7] = src[1]; break;\r\n\t\t\t\t\t\t\tcase 0x4: RGB(2); dst[11] = src[2]; break;\r\n\t\t\t\t\t\t\tcase 0x5: RGB(0); dst[ 3] = src[0]; RGB(2); dst[11] = src[2]; break;\r\n\t\t\t\t\t\t\tcase 0x6: RGB(1); dst[ 7] = src[1]; RGB(2); dst[11] = src[2]; break;\r\n\t\t\t\t\t\t\tcase 0x7: RGB(0); dst[ 3] = src[0]; RGB(1); dst[ 7] = src[1]; RGB(2); dst[11] = src[2]; break;\r\n\t\t\t\t\t\t\tcase 0x8: RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0x9: RGB(0); dst[ 3] = src[0]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0xA: RGB(1); dst[ 7] = src[1]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0xB: RGB(0); dst[ 3] = src[0]; RGB(1); dst[ 7] = src[1]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0xC: RGB(2); dst[11] = src[2]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0xD: RGB(0); dst[ 3] = src[0]; RGB(2); dst[11] = src[2]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0xE: RGB(1); dst[ 7] = src[1]; RGB(2); dst[11] = src[2]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\tcase 0xF: RGB(0); dst[ 3] = src[0]; RGB(1); dst[ 7] = src[1]; RGB(2); dst[11] = src[2]; RGB(3); dst[15] = src[3]; break;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t#undef RGB\r\n\t\t\t\t\t\t\tdst += 4*4;\r\n\t\t\t\t\t\t\tsrc += 4;\r\n\t\t\t\t\t\t\tmask >>= 4;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tpSrcL += strideSrc;\r\n\t\t\t\t\t\tpDstL += strideByte;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcurrX += pChar->m_advanceX;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid FontObject::getTextInfo(const char* text, STextInfo* result) {\r\n\ts32 currX = 0;\r\n\ts32 maxX  = 0;\r\n\tu32 arrayUnicode[1500];\r\n\tu32 charCount = 1500;\r\n\tif (wind_utf8ucs4(text, arrayUnicode, &charCount) == 0) {\r\n\t\tfor (u32 n=0; n < charCount; n++) {\r\n\t\t\tu32 charcode = arrayUnicode[n];\r\n\r\n\t\t\tCharCache* pChar = CharDictionnary::getChar(charcode, this);\r\n\t\t\r\n\t\t\tif (pChar) {\r\n\t\t\t\ts32 Wwidth\t\t= pChar->m_width;\r\n\t\t\t\ts32 px\t\t\t= currX + pChar->m_offsetX;\r\n\t\t\t\ts32 ex\t\t\t= px + Wwidth;\r\n\t\t\t\tif (ex > maxX) {\r\n\t\t\t\t\tmaxX = ex;\r\n\t\t\t\t}\r\n\t\t\t\tcurrX \t\t   += pChar->m_advanceX;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Unit in pixels -> OK.\r\n\t\tresult->width\t= (float)currX;\r\n\r\n\t\tFT_Size_Metrics* met = &this->m_face->size->metrics;\r\n\t\tresult->height\t=(met->height\t+ 63) >> 6;\t// round up 1 pixel.\r\n\t\tresult->ascent  = met->ascender >> 6;\r\n\t\tresult->descent = met->descender>> 6;\r\n\t\tresult->top\t\t= result->ascent + (result->height - (result->ascent - result->descent)) / 3.0f;\r\n\t\tresult->bottom\t= result->top - result->height;\r\n\t} else {\r\n\t\tresult->height\t= 0.0f;\r\n\t\tresult->ascent  = 0.0f;\r\n\t\tresult->descent = 0.0f;\r\n\t\tresult->top\t\t= 0.0f;\r\n\t\tresult->bottom\t= 0.0f;\r\n\t}\r\n\t// DEBUG_PRINT(\"text info: height=%f, ascent=%f, descent=%f, top=%f, bottom=%f\",\r\n\t// \t\tresult->height, result->ascent, result->descent, result->top, result->bottom);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/FontRendering.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef H_FNT_RENDERING_KLB_\r\n#define H_FNT_RENDERING_KLB_\r\n\r\n#include \"CPFInterface.h\"\r\n#include <stdio.h>\r\n#include <string.h>\r\n\r\n// assume POSIX / Linux\r\n#ifndef _WIN32\r\n# include <strings.h>\r\n# define stricmp(s1, s2) strcasecmp(s1, s2)\r\n#endif\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n// ==========================================================================================\r\n//   Definitions\r\n// ==========================================================================================\r\nstruct CharDictionnary;\r\nstruct CharCache;\r\nstruct MemoryBlock;\r\nclass  FntDebug;\r\nnamespace FontSystem {\r\n\tvoid reboot();\r\n};\r\n\r\nstruct FontObject {\r\n\tfriend class FntDebug;\r\n\tfriend struct CharDictionnary;\r\n\tfriend struct CharCache;\r\npublic:\r\n\tstatic bool\tregisterFont(const char* logicalName, const char* physicalFont, bool asDefault);\r\n\tstatic FontObject* createFont(const char* fontName, u32 size);\r\n\tstatic void destroyFont(FontObject* pFont, bool force = false);\r\n\tstatic void releaseFontSystem();\r\n\t\r\n\tFT_GlyphSlot renderChar(u32 unicode);\r\n\tvoid renderText\t(s32 x, s32 y, const char* text, u8* greyBuffer, u32 colorARGB8888, u32 buffWidth, u32 buffHeight, s32 strideByte, bool use4444);\r\n\tvoid getTextInfo(const char* text, STextInfo* result);\r\n\tfloat getAscent();\r\n\r\n\tstatic void test();\r\n\t\r\nprivate:\r\n\tFontObject();\r\n\t~FontObject();\r\n\t\r\n\tstatic FontObject*  s_list;\r\n\tstatic bool\t\t\ts_init;\r\n\tstatic FT_Library\ts_library;\r\n\r\n\tFontObject*\tm_prev;\r\n\tFontObject* m_next;\r\n\t\r\n\tFT_Face\t\tm_face;\r\n\tu32\t\t\tm_lenName;\r\n\tu32 \t\tm_size;\r\n\tu32\t\t\tm_refCount;\r\n\tu16\t\t\tm_dicoStart;\r\n\tFT_Bool\t\tm_hasKerning;\r\n\tconst char*\tm_name;\r\n\r\n\tstruct FONTALIAS {\r\n\t\tconst char * logicalName;\r\n\t\tconst char * physicalName;\r\n\t\tbool\t\t isDefault;\r\n\t};\r\n\r\n\tstatic FONTALIAS\tg_fonts[5];\r\n\tstatic u32\t\t\tg_fontInstalled;\r\n\r\n\tstatic const char* getFileFromFontName(const char* fontName, char* tmpBuffer);\r\n};\r\n\r\n#define CHAR_CACHE_SIZE\t(512)\r\n\r\nstruct CharCache {\r\n\tfriend class FntDebug;\r\n\tfriend struct CharDictionnary;\r\n\tfriend struct FontObject;\r\npublic:\r\n\tstatic CharCache* createEntry(u32 uniCode, u16* outIndex, FontObject* pFont);\r\n\t\r\n\tstatic void test();\r\n\tstatic void reboot() {\r\n\t\ts_cacheStart\t= 0xFFFF;\r\n\t\ts_cacheEnd\t\t= 0;\r\n\t\ts_allocCounter\t= 0;\r\n\t}\r\n\r\n\tu8* m_ptr;\r\n\tFontObject* m_pFontObj;\r\nprivate:\r\n\tu32 m_unicode;\r\npublic:\r\n\ts32 m_offsetX;\r\n\ts32\tm_offsetY;\r\nprivate:\r\n\tu16\tm_next;\r\n\tu16 m_prev;\r\npublic:\r\n\tu16 m_blockIndex;\r\n\tu16\tm_blockCharIndex;\r\n\tu16 m_tblOffset;\r\n\t// ---- Rendering box\r\n\tu8  m_width;\r\n\tu8  m_height;\r\n\ts8  m_advanceX;\r\n\ts8  m_advanceY;\r\n\t// ------------------\r\nprivate:\r\n\tCharCache();\r\n\t~CharCache();\r\n\r\n\tstatic u16 s_cacheStart;\r\n\tstatic u16 s_cacheEnd;\r\n\tstatic CharCache s_cacheArray[CHAR_CACHE_SIZE];\r\n\tstatic u16 s_allocCounter;\r\n};\r\n\r\nstruct CharDictionnary {\r\n\tfriend struct FontObject;\r\n\tfriend class FntDebug;\r\npublic:\r\n\tstatic CharCache* getChar(u32 uniCode, FontObject* pFont);\r\n\tstatic void\tremoveDicoEntry(u16 startEntry, u32 unicode);\r\n\tstatic void destroyTree(u16 entry, u16 depth);\r\n\tstatic void removeEntry(u16 entry);\r\n\r\n\tstatic void reboot() {\r\n\t\ts_freeList = s_usedList = 0xFFFF;\r\n\t}\r\n\tstatic void test();\r\nprivate:\r\n\tCharDictionnary();\r\n\r\n\tstatic const u32 DICO_ELEMENT_COUNT = 1000;\r\n\tstatic CharCache*\tfindEntry(FontObject* pFont,u32 uniCode);\r\n\tstatic CharCache*\tcreateEntry(FontObject* pFont, u32 uniCode);\r\n\tstatic u16\t\t\tcreateDicoEntry();\r\n\tstatic u16\t\t\tremoveDicoEntryRec(u16 entry, u32 depth, u32 unicode, u16 startEntry);\r\n\r\n\tstatic CharDictionnary\ts_dicoArray[DICO_ELEMENT_COUNT];\r\n\tstatic u16\t\t\t\ts_freeList;\r\n\tstatic u16\t\t\t\ts_usedList;\r\n\r\n\tu16\t\t\tm_next;\t\t\t// 2\r\n\tu16\t\t\tm_prev;\t\t\t// 2\r\n\tu16\t\t\tm_idxTbl[16];\t// 8 byte\r\n};\r\n\r\n#define\tMB_BLOCK_ITEM_SIZE\t(64*64)\r\n\r\nstruct MemoryBlock {\r\n\tfriend class FntDebug;\r\n\r\n\tstatic void test();\r\n\tstatic void reboot();\r\n\tstatic void freeBlock(u16 blockID, u16 subID);\r\n\tstatic bool allocBlock(u16* returnBlock, u16* returnSubID, u8** ppData);\r\nprivate:\r\n\tstatic MemoryBlock*\ts_blockList;\r\n\tstatic u16\t\t\ts_blockCounter;\r\n\r\n\tMemoryBlock*\tm_next;\r\n\tu16\t\t\t\tm_id;\r\n\tu32\t\t\t\tm_allocFlag;\r\n\tu32\t\t\t\tpartSize;\r\n\t// Aligned by partSize.\r\n\tu8\t\t\t\tm_mem[32*MB_BLOCK_ITEM_SIZE];\r\n};\r\n\r\n#endif // H_FNT_RENDERING_KLB_\r\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/AppDelegate.mm",
    "content": "#import \"AppDelegate.h\"\n\n#import \"ViewController.h\"\n#include \"CPFInterface.h\"\n#include \"CiOSSysResource.h\"\n#include \"CiOSAudioManager.h\"\n\n@implementation AppDelegate\n\n@synthesize window = _window;\n@synthesize viewController = _viewController;\n\n- (void)dealloc\n{\n    [_window release];\n    [_viewController release];\n    [super dealloc];\n}\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];\n    // Override point for customization after application launch.\n    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {\n        self.viewController = [[[ViewController alloc] initWithNibName:@\"ViewController_iPhone\" bundle:nil] autorelease];\n    } else {\n        self.viewController = [[[ViewController alloc] initWithNibName:@\"ViewController_iPad\" bundle:nil] autorelease];\n    }\n    self.window.rootViewController = self.viewController;\n    [self.window makeKeyAndVisible];\n\n    return YES;\n}\n\n- (void)applicationWillResignActive:(UIApplication *)application\n{\n    /*\n     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.\n     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.\n     */\n    [_viewController stopAnimation];\n    CiOSAudioManager::GetInstance().AudioDidResignActive();\n    if(CPFInterface::getInstance().isClient()) {\n        IClientRequest& client = CPFInterface::getInstance().client();\n        client.controlEvent(IClientRequest::E_PAUSE, 0, 0, 0, 0, 0);\n        client.frameFlip(1);    // 1フレーム分まわす。経過時間は 1[ms] という扱い。\n        CiOSAudioManager::GetInstance().Exec(); // サウンドの毎フレーム処理\n    }\n}\n\n- (void)applicationDidEnterBackground:(UIApplication *)application\n{\n    /*\n     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. \n     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.\n     */\n    /* バックグラウンドにいく */\n    CiOSAudioManager::GetInstance().AudioDidEnterBackground();\n    [_viewController clearUITouches];\n    [_viewController stopAnimation];\n    [_viewController viewRecovery]; // \n}\n\n- (void)applicationWillEnterForeground:(UIApplication *)application\n{\n    /*\n     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.\n     */\n    /* フォアグラウンドに戻ってくる */\n    CiOSAudioManager::GetInstance().AudioDidEnterForeground();\n    [_viewController startAnimation];\n    [_viewController viewRecovery];\n}\n\n- (void)applicationDidBecomeActive:(UIApplication *)application\n{\n    /*\n     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.\n     */\n    CiOSAudioManager::GetInstance().AudioDidBecomeActive();\n    [_viewController startAnimation];\n    if(CPFInterface::getInstance().isClient()) {\n        CPFInterface::getInstance().client().controlEvent(IClientRequest::E_RESUME, 0, 0, 0, 0, 0);\n    }\n}\n\n- (void)applicationWillTerminate:(UIApplication *)application\n{\n    /*\n     Called when the application is about to terminate.\n     Save data if appropriate.\n     See also applicationDidEnterBackground:.\n     */\n    // ゲーム終了処理を呼ぶ\n//    CPFInterface::getInstance().client().finishGame();\n}\n\n- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken\n{\n    NSUInteger len = [devToken length];\n    const void * devTokenBytes = (len > 0) ? [devToken bytes] : 0;\n  \n    CiOSSysResource& sysRes = CiOSSysResource::getInstance();\n        \n    if(devTokenBytes) {\n        sysRes.setDevID(devTokenBytes);\n    } else {\n        sysRes.failedDevID();\n    }\n}\n\n- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)error\n{\n    NSLog(@\"Error in registration. Error: %@\", error);\n    CiOSSysResource& sysRes = CiOSSysResource::getInstance();\n    sysRes.failedDevID();\n}\n@end\n\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CSockReadStream.cpp",
    "content": "#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <arpa/inet.h>\n#include <fcntl.h>\n#include <sys/ioctl.h>\n#include <netdb.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\n#include <iostream>\n#include <unistd.h>\n\n#include \"CPFInterface.h\"\n#include \"CSockReadStream.h\"\n#include \"CSockWriteStream.h\"\n\n\nCSockReadStream::CSockReadStream() : m_writeStream(0), m_eStat(NORMAL), m_fd(0), m_lastPos(0), m_getPos(0) {\n}\n\nCSockReadStream::~CSockReadStream() {\n\t// 生成時に作成した書き込み用ストリームオブジェクトを破棄\n\tif (m_writeStream) delete m_writeStream;\n\t// 破棄時にソケットをクローズする\n\tif (m_fd) close(m_fd);\n}\n\n/*!\n ¥param  hostname   IPアドレス表記またはFQDN表記のホスト指定\n ¥param  port       接続する TCP/IP の port 番号\n \n ¥return 接続成功ならば true, 失敗すれば false\n */\nint CSockReadStream::sock_connect(const char *hostname, int port) {\n\tint dstSocket;\n\tstruct sockaddr_in dstAddr;\n    \n\tm_fd = 0;\n\tmemset(&dstAddr, 0, sizeof(dstAddr));\n\tdstAddr.sin_port = htons(port);\n\tdstAddr.sin_family = AF_INET;\n\tdstAddr.sin_addr.s_addr = inet_addr(hostname);\n    \n\tif (dstAddr.sin_addr.s_addr == 0xffffffff) {\n\t\tstruct hostent *host;\n\t\thost = gethostbyname(hostname);\n\t\tif (!host) return -1;\n\t\tdstAddr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0];\n\t}\n\tdstSocket = socket(AF_INET, SOCK_STREAM, 0);\n    \n\t// SIGPIPEシグナルの設定\n\tint errVal = 1;\n\tif (0 > setsockopt(dstSocket, SOL_SOCKET, SO_NOSIGPIPE, (void *)&errVal, sizeof(errVal))) {\n\t\tCPFInterface::getInstance().platform().logging(\"[socket] err setsockopt errno:%d\", errVal);\n\t\treturn -1;\n\t}\n    \n\t// 接続\n\tif (0 > connect(dstSocket, (struct sockaddr *)&dstAddr, sizeof(dstAddr))) {\n\t\tclose(dstSocket);\n\t\treturn -1;\n\t}\n\t// 取得したディスクリプタは、ノンブロックモードにて運用する。\n\tint flags = fcntl(dstSocket, F_GETFL, 0);\n\tfcntl(dstSocket, F_SETFL, flags | O_NONBLOCK);\n    \n\treturn dstSocket;\n}\n\nbool CSockReadStream::setStatus() {\n\tswitch (errno) {\n\t\tdefault:\n\t\t\tm_eStat = CLOSED;\n\t\t\tif (m_fd > 0) {\n\t\t\t\tclose(m_fd);\n\t\t\t\tm_fd = 0;\n\t\t\t}\n\t\t\tCPFInterface::getInstance().platform().logging(\"errno = %d\", errno);\n\t\t\tbreak;\n            \n\t\tcase EAGAIN:\n\t\t\tm_eStat = NOT_AVAILABLE;\n            //            CPFInterface::getInstance().platform().logging(\"errno = EAGAIN\");\n\t\t\tbreak;\n            \n\t\tcase ETIMEDOUT:\n\t\t\tm_eStat = CLOSED;\n\t\t\tif (m_fd > 0) {\n\t\t\t\tclose(m_fd);\n\t\t\t\tm_fd = 0;\n\t\t\t}\n\t\t\tCPFInterface::getInstance().platform().logging(\"errno = ETIMEDOUT\");\n\t\t\tbreak;\n            \n\t\tcase ENOTCONN:\n\t\t\tm_eStat = NOT_CONNECT;\n\t\t\tif (m_fd > 0) {\n\t\t\t\tclose(m_fd);\n\t\t\t\tm_fd = 0;\n\t\t\t}\n\t\t\tCPFInterface::getInstance().platform().logging(\"errno = ENOTCONN\");\n\t\t\tbreak;\n\t}\n\treturn false;   // 必ず false を返す\n}\n\n/*!\n ¥return  リングバッファ読み込みが正常終了していれば true, 失敗ならば false\n \n 受信データをリングバッファに蓄積します。\n */\nbool CSockReadStream::readRingBuf() {\n\tif ((m_lastPos > m_getPos) && (m_lastPos < READ_BUFSIZ)) {\n\t\tint result = read(m_fd, m_readBuf + m_lastPos, READ_BUFSIZ - m_lastPos);\n\t\tif (result < 0) return false;\n\t\tm_lastPos += result;\n\t}\n\tif ((m_lastPos == READ_BUFSIZ) && (m_getPos > 0)) {\n\t\tint result = read(m_fd, m_readBuf, m_getPos);\n\t\tif (result < 0) return false;\n\t\tif (result > 0) m_lastPos = result;\n\t}\n\telse if (m_lastPos < m_getPos) {\n\t\tint result = read(m_fd, m_readBuf + m_lastPos, m_getPos - m_lastPos);\n\t\tif (result < 0) return false;\n\t\tm_lastPos += result;\n\t}\n\telse if (m_getPos == 0 && m_lastPos == 0) {\n\t\t// バッファが完全に空の状態\n\t\tint result = read(m_fd, m_readBuf, READ_BUFSIZ);\n\t\tif (result < 0) return false;\n\t\tm_lastPos += result;\n\t}\n\t// m_lastPos == m_getPos && m_lastPos > 0 はバッファがいっぱい\n\t// m_lastPos == READ_BUFSIZE && m_getPos == 0 も同様\n\treturn true;\n}\n\n/*!\n ¥param buf     データを受け取るバッファ\n ¥param size    要求サイズ\n \n 読み込みバッファを経由して、指定サイズのデータを取得する。\n ネットワークの読み込みが追いつかない場合、読み込みポインタが更新されない。\n */\nbool CSockReadStream::requestData(unsigned char *buf, size_t reqSize) {\n\t// 最初にステータスを NORMAL にする。途中で問題があれば書きかわる。\n\t// 正常系を通れば問題なくNORMALを維持できる。\n\tm_eStat = NORMAL;\n    \n\t// リングバッファへの読み込みを試みる。\n\tif (!readRingBuf()) {\n\t\tsetStatus();\n\t}\n    \n\t// リングバッファの残りサイズが要求サイズ以上であるか確認し、サイズが足りなければ false を返す。\n\tsize_t leftSize = left_size();\n\tif (!reqSize || leftSize < reqSize) {\n\t\t// m_eStat = NOT_AVAILABLE;\n\t\treturn false;\n\t}\n\t// リングバッファから指定のバッファに指定サイズを転送する\n\tint rdsiz = ((READ_BUFSIZ - m_getPos) >= reqSize) ? reqSize : (READ_BUFSIZ - m_getPos);\n\tmemcpy(buf, m_readBuf + m_getPos, rdsiz);\n\tm_getPos += rdsiz;\n\tif (m_getPos == READ_BUFSIZ) {\n\t\tm_getPos = 0;\n\t\tif (m_lastPos == READ_BUFSIZ) m_lastPos = 0;\n\t}\n\tif (0 < (reqSize - rdsiz)) {\n\t\tmemcpy(buf + rdsiz, m_readBuf, reqSize - rdsiz);\n\t\tm_getPos += reqSize - rdsiz;\n\t}\n    \n\t// 読み込み済みデータに追いついたら、一旦バッファを仕切り直す。\n\tif (m_lastPos == m_getPos) m_lastPos = m_getPos = 0;\n    \n\treturn true;\n}\n\nCSockReadStream *CSockReadStream::openStream(const char *sockName) {\n\tchar *strHost = 0;\n\tchar *strPort = 0;\n\tCSockReadStream *pStream = 0;\n\ttry {\n\t\tpStream = new CSockReadStream();\n\t\tif (!pStream) {\n\t\t\treturn 0;\n\t\t}\n        \n\t\t// 渡されたホスト:portを分解する\n\t\tfor (int i = 0; sockName[i]; i++) {\n\t\t\tif (sockName[i] == ':') {\n\t\t\t\tstrHost = new char[i + 1];\n\t\t\t\tstrncpy(strHost, sockName, i);\n\t\t\t\tstrHost[i] = 0;\n\t\t\t\tint plen = strlen(sockName + i + 1);\n\t\t\t\tstrPort = new char[plen + 1];\n\t\t\t\tstrcpy(strPort, sockName + i + 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!strHost || !strPort) {\n\t\t\t// 与えられた名称の書式が不正\n\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\tif (strPort) delete[] strPort;\n\t\t\tif (strHost) delete[] strHost;\n\t\t\treturn pStream;\n\t\t}\n        \n\t\t// port を数値に変換する。\n\t\t// 数列であることを確認。\n\t\tfor (int i = 0; strPort[i]; i++) {\n\t\t\tif (strPort[i] < '0' || strPort[i] > '9') {\n\t\t\t\t// 数字以外が含まれている場合は接続先指定として不正\n\t\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\t\tif (strPort) delete[] strPort;\n\t\t\t\tif (strHost) delete[] strHost;\n\t\t\t\treturn pStream;\n\t\t\t}\n\t\t}\n\t\t// 特に問題ないので、port を数値に変換する\n\t\tint port = atoi(strPort);\n        \n\t\t// 接続を試みる\n\t\tint fd = pStream->sock_connect(strHost, port);\n\t\tif (fd < 0) {\n\t\t\t// 接続に失敗した場合\n\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\tif (strPort) delete[] strPort;\n\t\t\tif (strHost) delete[] strHost;\n\t\t\treturn pStream;\n\t\t}\n\t\tpStream->m_fd = fd;\n\t\t// 同時に書き込み用クラスを生成\n\t\tpStream->m_writeStream = new CSockWriteStream(*pStream);\n        \n\t\tpStream->m_eStat = NORMAL;\n\t}\n\tcatch (std::bad_alloc& ex)\n\t{\n\t\tif (strPort) delete[] strPort;\n\t\tif (strHost) delete[] strHost;\n\t\tdelete pStream;\n\t\treturn 0;\n\t}\n    \n\tif (strPort) delete[] strPort;\n\tif (strHost) delete[] strHost;\n\treturn pStream;\n}\n\ns32 CSockReadStream::getSize() {\n\tm_eStat = NORMAL;\n\tif (!readRingBuf()) {\n\t\tsetStatus();\n        //      return 0;\n\t}\n\tsize_t leftSize = left_size();\n\treturn (s32)leftSize;\n}\n\ns32 CSockReadStream::getPosition() {\n\t// ネットワークソケットは位置を取得できない\n\treturn 0;\n}\n\n/*\n ネットワークストリームの場合、全ての読み込みメソッドにおいて\n *必ずしも読み込みが成功するわけではない* ことに注意する必要がある。\n 相手ホストがデータを送信していない場合、たとえ8bitのデータでも読み込みに失敗することがある。\n \n readBlock() 以外は読み込みの成否を返すようには出来ていないため、\n 実行後に必ず getStatus() でステータスを確認し、NOT_AVAILABLE である場合は\n 戻り値に意味が無いものとして破棄する必要がある。\n */\n\nu8 CSockReadStream::readU8() {\n\tu8 buf;\n\tif (!requestData(&buf, 1)) return 0xff;\n\treturn buf;\n}\n\nu16 CSockReadStream::readU16() {\n\tu8 buf[2];\n\tif (!requestData(buf, 2)) return 0xffff;\n\treturn (u16)buf[0] << 8 | (u16)buf[1];\n}\n\nu32 CSockReadStream::readU32() {\n\tu8 buf[4];\n\tif (!requestData(buf, 4)) return 0xffff;\n\treturn ((u32)buf[0] << 24) | ((u32)buf[1] << 16) | ((u32)buf[2] << 8) | (u32)buf[3];\n}\n\nfloat CSockReadStream::readFloat() {\n\tfloat buf;\n\tif (!requestData((unsigned char *)&buf, sizeof(float))) return -6e24;\n\treturn buf;\n}\n\n/*!\n 指定サイズ読み込み失敗時に読み込み位置を更新しないリングバッファ方式のため、\n byteSize にはリングバッファのサイズ以上を指定できない。\n */\nbool CSockReadStream::readBlock(void *buffer, u32 byteSize) {\n\tif (!requestData((unsigned char *)buffer, byteSize)) return false;\n\treturn true;\n}\n\nCSockReadStream::ESTATUS CSockReadStream::getStatus() {\n\treturn m_eStat;\n}\n\n// この Stream から書き込み(送出)可能なストリームを生成する\nIWriteStream *CSockReadStream::getWriteStream() {\n\treturn m_writeStream;\n}\n\nint CSockReadStream::readU16arr(u16 *pBufferU16, int items) {\n\t// リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\n\tif (!requestData((unsigned char *)pBufferU16, items * sizeof(u16))) return 0;\n    \n\t// iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\n    \n\treturn items;\n}\n\nint CSockReadStream::readU32arr(u32 *pBufferU32, int items) {\n\t// リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\n\tif (!requestData((unsigned char *)pBufferU32, items * sizeof(u32))) return 0;\n    \n\t// iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\n    \n\treturn items;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CSockWriteStream.cpp",
    "content": "#include <iostream>\n#include \"CSockWriteStream.h\"\n#include \"CSockReadStream.h\"\n#include <unistd.h>\n\n// CSockWriteStream は、CSockReadStream が CSockReadStream::create() によって\n// 生成されたタイミングで作られる、書き込み(送出)用インタフェースとなるクラス。\n// socket は基本的に書き込み可能なストリームなので、必ず生成され、内部的に保持される。\nCSockWriteStream::CSockWriteStream(CSockReadStream& rdStream) : m_fd(rdStream.m_fd), m_eStat(NORMAL) {\n}\n\nCSockWriteStream::~CSockWriteStream() {\n}\n\nbool CSockWriteStream::sendData(unsigned char *buffer, size_t sndSize) {\n\t// ひとまず、送出についてはその場で与えられたブロック全てを送出し終わるまで続ける形で実装する。\n\t// ゲームで使う上で問題が生じたら、それはそれで考える。\n\tsize_t pos = 0;\n\tdo {\n\t\tint result = write(m_fd, buffer + pos, sndSize - pos);\n\t\tif (result < 0) return false;\n\t\tpos += result;\n\t}\n\twhile (pos < sndSize);\n\treturn true;\n}\n\nCSockWriteStream::ESTATUS CSockWriteStream::getStatus() {\n\treturn m_eStat;\n}\n\ns32 CSockWriteStream::getPosition() {\n\treturn 0;   // socket は位置の取得ができない\n}\n\nvoid CSockWriteStream::writeU8(u8 value) {\n\tm_eStat = NORMAL;\n\tif (!sendData(&value, 1)) {\n\t\tm_eStat = CAN_NOT_WRITE;\n\t}\n}\n\nvoid CSockWriteStream::writeU16(u16 value) {\n\tunsigned char buf[2];\n    \n\t// big endian\n\tbuf[0] = (value >> 8) & 0xff;\n\tbuf[1] = value & 0xff;\n    \n\tm_eStat = NORMAL;\n\tif (!sendData(buf, 2)) {\n\t\tm_eStat = CAN_NOT_WRITE;\n\t}\n}\n\nvoid CSockWriteStream::writeU32(u32 value) {\n\tunsigned char buf[4];\n    \n\t// big endian\n\tbuf[0] = (value >> 24) & 0xff;\n\tbuf[1] = (value >> 16) & 0xff;\n\tbuf[2] = (value >> 8) & 0xff;\n\tbuf[3] = value & 0xff;\n    \n\tm_eStat = NORMAL;\n\tif (!sendData(buf, 4)) {\n\t\tm_eStat = CAN_NOT_WRITE;\n\t}\n}\n\nvoid CSockWriteStream::writeFloat(float value) {\n\tm_eStat = NORMAL;\n\tif (!sendData((unsigned char *)&value, sizeof(float))) {\n\t\tm_eStat = CAN_NOT_WRITE;\n\t}\n}\n\nvoid CSockWriteStream::writeBlock(void *buffer, u32 byteSize) {\n\tm_eStat = NORMAL;\n\tif (!sendData((unsigned char *)buffer, byteSize)) {\n\t\tm_eStat = CAN_NOT_WRITE;\n\t}\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSAudio.mm",
    "content": "﻿/*\n iOS の API をたたくので、Objective-C++ で実装される。\n */\n#import <GLKit/GLKit.h>\n\n#include <iostream>\n#import <mach/mach_time.h>\n\n#include \"CPFInterface.h\"\n#include \"iOSFileLocation.h\"\n#include \"CiOSPathConv.h\"\n#include \"CiOSAudio.h\"\n#include \"CiOSReadFileStream.h\"\n#include \"CiOSPlatform.h\"\n\n// #define DEBUG_AUDIO\n\n// 論理トップレベルディレクトリと、物理ディレクトリパスの対応を行うテーブル。\nconst CiOSAudio::LOCLIST CiOSAudio::m_toplevel[3] = {\n\t{ \"external/\",  PATH_EXTERN  },   // インストール後、更新の対象となる可変ファイル\n\t{ \"install/\",   PATH_INSTALL },   // インストール時に配置される固定ファイル\n\t{ 0, 0 }\n};\n\ncAudioFadeParam *cAudioFadeParam::s_fadeParamList = NULL;\nvoid *cAudioFadeParam::s_fadeParamThread = NULL;\n\n// フェードパラメータクラス\ncAudioFadeParam::cAudioFadeParam()\n: m_fadeCnt(0)\n, m_startVol(0.0f)\n, m_endVol(0.0f)\n, m_fadeRatio(1.0f)\n, m_nowFadeInterType(INTER_TYPE_NONE)\n, m_nowFadeType(FADE_TYPE_NONE)\n, m_fadeMiliSec(0)\n, m_bfade(false)\n, m_prevmseq(0)\n, m_pAudio(NULL)\n, m_pSession(NULL)\n, m_prev(NULL)\n, m_next(NULL) {\n\tattach();\n}\n\ncAudioFadeParam::~cAudioFadeParam() {\n\tdetach();\n}\n\nvoid cAudioFadeParam::attach() {\n\tif (s_fadeParamList == NULL) {\n\t\ts_fadeParamList = this;\n\t}\n\telse {\n\t\t// 先頭と入れ替え\n\t\tm_next = s_fadeParamList;\n\t\ts_fadeParamList->m_prev = this;\n\t\ts_fadeParamList = this;\n\t}\n}\n\nvoid cAudioFadeParam::detach() {\n\tif (m_pAudio != NULL || m_pSession != NULL) {\n\t\treturn;\n\t}\n    \n\tif (m_next && m_prev) {\n\t\tm_next->m_prev = m_prev;\n\t\tm_prev->m_next = m_next;\n\t}\n\telse if (m_prev) {\n\t\t// 前方のみがいるつまりは自身は末尾\n\t\tm_prev->m_next = NULL;\n\t}\n\telse if (m_next) {\n\t\t// 後方のみがいるつまりは自身は先頭\n\t\tm_next->m_prev = NULL;\n\t\ts_fadeParamList = m_next;\n\t}\n\telse {\n\t\t// 自身のみ\n\t\ts_fadeParamList = NULL;\n\t}\n    \n\tm_next = NULL;\n\tm_prev = NULL;\n}\n\nvoid cAudioFadeParam::exec() {\n\tif (m_pAudio == NULL && m_pSession == NULL) return;\n    \n\ts64 nowSeq = 0;\n    \n\tif ((m_bfade == false) && (m_nowFadeType != FADE_TYPE_NONE)) {\n\t\tm_bfade = true;\n\t\tif (m_pAudio) {\n\t\t\tm_prevmseq = m_pAudio->tell();\n\t\t}\n\t\telse if (m_pSession) {\n\t\t\tm_prevmseq = m_pSession->tell();\n\t\t}\n#ifdef DEBUG_AUDIO\n\t\tCPFInterface::getInstance().platform().logging(\"[sound] bgm[%p] se[%p]: fade start!\", m_pAudio, m_pSession);\n#endif\n\t}\n\tif (m_bfade) {\n\t\tif (m_pAudio) {\n\t\t\tnowSeq = m_pAudio->tell();\n\t\t}\n\t\telse if (m_pSession) {\n\t\t\tnowSeq = m_pSession->tell();\n\t\t}\n        \n\t\t// フェードカウントインクリメント\n\t\tm_fadeCnt += (nowSeq - m_prevmseq);\n\t\tif (m_fadeCnt >= m_fadeMiliSec) {\n\t\t\tm_fadeCnt = m_fadeMiliSec;\n\t\t}\n\t\telse if (m_fadeCnt < 0) {\n\t\t\tm_fadeCnt = 0;\n\t\t}\n        \n\t\t// 係数計算\n\t\tif (m_fadeCnt >= 0) {\n\t\t\tm_fadeRatio = m_startVol + ((m_endVol - m_startVol) * ((float)m_fadeCnt / (float)m_fadeMiliSec));\n\t\t\tif (m_fadeRatio < 0.0f) {\n\t\t\t\tm_fadeRatio = 0.0f;\n\t\t\t}\n\t\t\telse if (m_fadeRatio > 1.0f) {\n\t\t\t\tm_fadeRatio = 1.0f;\n\t\t\t}\n\t\t}\n        \n\t\t// サウンドに大して設定\n\t\tif (m_pAudio) {\n\t\t\tm_pAudio->setFadeRatio(m_fadeRatio);\n\t\t}\n\t\telse if (m_pSession) {\n\t\t\tm_pSession->setFadeRatio(m_fadeRatio);\n\t\t}\n        \n\t\t// フェード終了の確認\n\t\tif (m_fadeCnt >= m_fadeMiliSec) {\n\t\t\tm_fadeCnt = m_fadeMiliSec;\n\t\t\tm_bfade = false;\n            \n\t\t\tif (m_nowFadeType == FADE_TYPE_STOP) {\n\t\t\t\tif (m_pAudio) {\n\t\t\t\t\tm_pAudio->stop();\n\t\t\t\t}\n\t\t\t\telse if (m_pSession) {\n\t\t\t\t\tm_pSession->stop();\n\t\t\t\t\tm_pSession->checkSessionStoped();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (m_nowFadeType == FADE_TYPE_PAUSE) {\n\t\t\t\tif (m_pAudio) {\n\t\t\t\t\tm_pAudio->pause();\n\t\t\t\t}\n\t\t\t\telse if (m_pSession) {\n\t\t\t\t\t//m_pSession->stop(); // SEは現在ポーズの概念が無い\n\t\t\t\t}\n\t\t\t}\n            \n\t\t\tif (m_pAudio) {\n\t\t\t\tcAudioFadeParam::Remove(m_pAudio);\n\t\t\t}\n\t\t\telse if (m_pSession) {\n\t\t\t\tcAudioFadeParam::Remove(m_pSession);\n\t\t\t}\n\t\t\tm_nowFadeType = FADE_TYPE_NONE;\n\t\t}\n        \n\t\tif (m_pAudio) {\n\t\t\tm_prevmseq = m_pAudio->tell();\n\t\t}\n\t\telse if (m_pSession) {\n\t\t\tm_prevmseq = m_pSession->tell();\n\t\t}\n\t}\n}\n\nbool cAudioFadeParam::setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVolume) {\n\tif (_msec <= 0 || _fadeType >= FADE_TYPE_NUM || _fadeType <= FADE_TYPE_NONE) {\n\t\t// フェードしないため初期化\n\t\tm_nowFadeType = INTER_TYPE_NONE;\n\t\tm_nowFadeType = FADE_TYPE_NONE;\n\t\tm_endVol = 0.0f;\n\t\tm_fadeCnt = 0;\n\t\t//m_fadeRatio = 1.0f;\n\t\tm_fadeMiliSec = 0;\n\t\tm_bfade = false;\n\t\tm_prevmseq = 0;\n\t\treturn true;\n\t}\n    \n\tm_fadeCnt = 0;\n\tm_endVol = _tgtVol;\n\tm_nowFadeType = _fadeType;\n\tm_nowFadeInterType = _interType;\n\tswitch (_fadeType) {\n\t\tcase FADE_TYPE_PLAY:\n\t\tcase FADE_TYPE_RESUME:\n\t\t\tm_startVol = _startVolume;\n\t\t\tm_fadeRatio = _startVolume;\n\t\t\tbreak;\n            \n\t\tcase FADE_TYPE_STOP:\n\t\tcase FADE_TYPE_PAUSE:\n\t\tcase FADE_TYPE_PLAYING:\n\t\t\tif (m_pAudio) {\n\t\t\t\tm_startVol = m_pAudio->getFadeRatio();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tm_startVol = m_pSession->getFadeRatio();\n\t\t\t}\n\t\t\tm_fadeRatio = m_startVol;\n\t\t\tbreak;\n\t}\n\tm_fadeMiliSec = _msec;\n\tm_bfade = false;\n\tm_prevmseq = 0;\n\treturn true;\n}\n\n/*\n @brief  サウンドのフェードパラメータの初期処理(スレッドの作成など)\n */\nvoid cAudioFadeParam::AudioFadeParamInit() {\n\t// フェード管理用のスレッド作成\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\n\tif (s_fadeParamThread == NULL) {\n\t\ts_fadeParamThread = pForm.createThread(ThreadAudioFadeParam, NULL);\n\t}\n}\n\nvoid cAudioFadeParam::AudioFadeParamExit() {\n\t// フェード管理用のスレッド破棄\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\n\tif (s_fadeParamThread != NULL) {\n\t\tpForm.deleteThread(s_fadeParamThread);\n\t\ts_fadeParamThread = NULL;\n\t}\n    \n\tcAudioFadeParam *pfadeParam = s_fadeParamList;\n\twhile (pfadeParam) {\n\t\tcAudioFadeParam *pNext = pfadeParam->m_next;\n\t\tpfadeParam->detach();\n\t\tdelete pfadeParam;\n        \n\t\tpfadeParam = pNext;\n\t}\n}\n\nvoid cAudioFadeParam::SetFadeParam(CiOSAudio *_audio, CiOSAudioSession *_settion, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVolume) {\n\t// 現在の設定がある場合は上書き\n\tbool bFind = false;\n    \n\tcAudioFadeParam *pfadeParam = s_fadeParamList;\n\twhile (pfadeParam) {\n\t\tcAudioFadeParam *pNext = pfadeParam->m_next;\n\t\tif (pfadeParam->m_pAudio == _audio && _audio != NULL) {\n\t\t\tpfadeParam->setFadeParam(_fadeType, _tgtVol, _msec, _interType, _startVolume);\n\t\t\tbFind = true;\n\t\t\tbreak;\n\t\t}\n\t\telse if (pfadeParam->m_pSession == _settion && _settion != NULL) {\n\t\t\tpfadeParam->setFadeParam(_fadeType, _tgtVol, _msec, _interType, _startVolume);\n\t\t\tbFind = true;\n\t\t\tbreak;\n\t\t}\n\t\tpfadeParam = pNext;\n\t}\n    \n\t// 見つからなかった場合は新規で作成\n\tif (bFind == false) {\n\t\tcAudioFadeParam *pNew = new cAudioFadeParam;\n\t\tpNew->m_pAudio = _audio;\n\t\tpNew->m_pSession = _settion;\n\t\tpNew->setFadeParam(_fadeType, _tgtVol, _msec, _interType, _startVolume);\n\t}\n}\n\nvoid cAudioFadeParam::Remove(void *_audio) {\n\tif (_audio == NULL) return;\n    \n\tcAudioFadeParam *pfadeParam = s_fadeParamList;\n\twhile (pfadeParam) {\n\t\t// 先頭で次の要素を保持しておく\n\t\tcAudioFadeParam *pNext = pfadeParam->m_next;\n        \n\t\tif (pfadeParam->m_pAudio == _audio) {\n\t\t\tpfadeParam->m_pAudio = NULL;\n#ifdef DEBUG_AUDIO\n\t\t\tCPFInterface::getInstance().platform().logging(\"[sound] bgm[%p] se[%p]: fade end!\", _audio, NULL);\n#endif\n\t\t}\n\t\tif (pfadeParam->m_pSession == _audio) {\n\t\t\tpfadeParam->m_pSession = NULL;\n#ifdef DEBUG_AUDIO\n\t\t\tCPFInterface::getInstance().platform().logging(\"[sound] bgm[%p] se[%p]: fade end!\", NULL, _audio);\n#endif\n\t\t}\n        \n\t\tpfadeParam = pNext;\n\t}\n}\n\ns32 cAudioFadeParam::ThreadAudioFadeParam(void *hThread, void *data) {\n\twhile (1) {\n\t\tcAudioFadeParam *pfadeParam = s_fadeParamList;\n\t\twhile (pfadeParam) {\n\t\t\tcAudioFadeParam *pNext = pfadeParam->m_next;\n\t\t\tpfadeParam->exec();\n\t\t\tpfadeParam = pNext;\n\t\t}\n        \n\t\tpfadeParam = s_fadeParamList;\n\t\twhile (pfadeParam) {\n\t\t\tcAudioFadeParam *pNext = pfadeParam->m_next;\n            \n\t\t\t// デタッチ\n\t\t\tif (pfadeParam->m_pAudio == NULL && pfadeParam->m_pSession == NULL) {\n\t\t\t\tdelete pfadeParam;\n\t\t\t\tpfadeParam = NULL;\n\t\t\t}\n            \n\t\t\tpfadeParam = pNext;\n\t\t}\n\t\t[NSThread sleepForTimeInterval:0.016]; // sleep\n\t}\n    \n\treturn 0; // 終了\n}\n\n// iOSオーディオクラス\nCiOSAudio::CiOSAudio()\n: m_bActive(false)\n, m_soundPath(0)\n, m_preLoad(false)\n, m_queue(0)\n, m_bInit(false)\n, m_luaPause(false)\n, m_volume(1.0f)\n, m_pan(0.0f)\n, m_step(STEP_WAIT)\n, m_begin(0), m_end(0)\n, m_fadeRatio(1.0f)\n, m_ASPD(NULL)\n, m_interruptionType(CiOSAudioManager::eINTERRUPTION_TYPE_NONE) {\n}\n\nCiOSAudio::~CiOSAudio() {\n\tcloseAudio();\n}\n\nbool CiOSAudio::openAudio(const char *path, CiOSPlatform *platform) {\n\tcloseAudio(); // 既に開いている場合は一旦閉じる\n    \n\tm_platform = platform;\n\tCiOSPathConv& pathconv = CiOSPathConv::getInstance();\n\tm_soundPath = pathconv.fullpath(path, \".mp3\");\n\tm_nowPlayTime = 0;\n\tm_startPackNum = 0;\n\tm_step = STEP_WAIT;\n\tm_buf_level = 1;\n\tm_last_delta = 0;\n\tm_fadeRatio = 1.0f;\n\tm_volume = 1.0f;\n\tm_luaPause = false;\n    \n\t// fullpath が出来ている。\n\tm_bActive = (m_soundPath) ? true : false;\n\tfloat rad = M_PI / 4.0f;\n\tm_panL = sin(rad);\n\tm_panR = cos(rad);\n\tm_bInit = false;\n    \n\tif (m_bActive) {\n\t\t// サウンドデータ解析\n\t\tif (GetSoundAnalysisData(m_soundPath, &m_soundAnalysisData)) {\n\t\t}\n\t}\n    \n\treturn m_bActive;\n}\n\nbool CiOSAudio::loadMem() {\n\tif (!m_bActive) return false;\n\tif (m_preLoad) return true; // 2012.12.06 同じ処理を複数回しないように追加\n\tm_preLoad = true;\n    \n\t// SEとしてメモリ上にロードしておく\n\tinitSE();\n\treturn true;\n}\n\nvoid CiOSAudio::play(s32 _msec, float _tgtVol, float _startVolume) {\n\tif (!m_bActive) return;\n    \n\t// 一時停止中は再生再開\n\tif (m_step == STEP_PAUSE) {\n\t\tresume(_msec, _tgtVol);\n\t\treturn;\n\t}\n    \n\t// SEの場合\n\tif (m_preLoad) {\n\t\tplaySE(_msec, _tgtVol, _startVolume);\n\t\treturn;\n\t}\n    \n\t// ここはなにやってるの？\n\t/*\n     if(m_step == STEP_PAUSE) {\n     m_nowPlayTime = 0;\n     m_startPackNum = 0;\n     resume(_msec, _tgtVol);\n     return true;\n     }\n\t */\n    \n\tif (m_step != STEP_WAIT) return;\n    \n\tif (!m_bInit) {\n\t\t// BGMとして設定されている場合\n\t\tinitBGM();  // ロードして再生準備\n\t\tm_bInit = true;\n\t\tm_last_delta = 0;\n\t}\n\tm_nowPlayTime = 0;\n\tm_startPackNum = 0;\n\tm_pauseTime = 0;\n\tm_fadeRatio = _startVolume;\n\tplayBGM();  // 再生を開始する\n\tif (_msec > 0 && (_tgtVol != _startVolume)) {\n\t\tcAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_PLAY, _tgtVol, _msec, _startVolume);\n\t}\n\tOSStatus err = AudioQueueStart(m_queue, 0);\n\t/*\n     if( err != kAudioSessionNoError )\n     {\n     CiOSAudioManager::GetInstance().AudioSessionInit();\n     while( AudioQueueStart(m_queue, 0) != kAudioSessionNoError ) {\n     CiOSAudioManager::GetInstance().AudioSessionInit();\n     }\n     }\n\t */\n    \n\tm_step = STEP_PLAY;\n\treturn;\n}\n\nvoid CiOSAudio::updateVolume() {\n\tif (m_preLoad) {\n\t\t// SEの場合\n\t\tfloat rad = (1.0f - m_pan) * M_PI / 4.0f;\n\t\tm_panL = sin(rad);\n\t\tm_panR = cos(rad);\n\t\tCiOSAudioSession *pSession = m_begin;\n\t\twhile (pSession) {\n\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\tpSession->m_volume = m_volume;          // seボリューム設定\n\t\t\tpSession->setFadeRatio(m_fadeRatio);    // フェード係数設定\n\t\t\tpSession = next;\n\t\t}\n\t}\n\telse {\n\t\t// BGMの場合\n\t\tOSStatus err = noErr;\n\t\tfloat master = m_platform->getMasterVolume(false);\n\t\tAudioQueueParameterValue vol = (AudioQueueParameterValue)(m_volume * master * m_fadeRatio);\n\t\t// volが1.0より大きい場合にAudioQueueSetParameterで音量を設定したときにアサーションが起きてしまう、\n\t\t// そもそも音量は1.0以上大きくなっても音量が1.0より大きくなる訳ではないので丸めてしまう。\n\t\tif (vol > 1.0f) {\n\t\t\tvol  = 1.0f;\n\t\t}\n\t\tif (m_queue) {\n\t\t\terr = AudioQueueSetParameter(m_queue, kAudioQueueParam_Volume, vol);\n\t\t\tklb_assert(!err, \"Sound volume error.\");\n            \n\t\t\t// BGMの場合\n\t\t\terr = noErr;\n\t\t\tAudioQueueParameterValue vpan = (AudioQueueParameterValue)m_pan;\n\t\t\terr = AudioQueueSetParameter(m_queue, kAudioQueueParam_Pan, vpan);\n\t\t\tklb_assert(!err, \"Sound pan error. err code[%d]\", (int)err);\n\t\t}\n\t}\n}\n\nvoid CiOSAudio::checkSessionStoped() {\n\tCiOSAudioSession *pSession = m_begin;\n\tbool bEnd = true;\n\twhile (pSession) {\n\t\tCiOSAudioSession *next = pSession->m_next;\n\t\tif (pSession->isPlaying() == true) {\n\t\t\tbEnd = false;\n\t\t\tbreak;\n\t\t}\n\t\tpSession = next;\n\t}\n\tif (bEnd) {\n\t\tm_nowPlayTime = 0;\n\t\tm_pauseTime = 0;\n\t\tm_step = STEP_WAIT;\n\t}\n}\n\n/*!\n @brief  再生終了のSEを削除\n */\nvoid CiOSAudio::audioSessionCleanup() {\n\t// SEの終了を監視し終わっている物は削除\n\tcleanup();\n}\n\nvoid CiOSAudio::setVolume(float volume) {\n\tm_volume = volume;\n\tupdateVolume();\n}\n\nvoid CiOSAudio::setPan(float pan) {\n\tm_pan = pan;\n\tupdateVolume();\n}\n\nvoid CiOSAudio::cleanup() {\n\tCiOSAudioSession *pSession = m_begin;\n\twhile (pSession) {\n\t\tCiOSAudioSession *next = pSession->m_next;\n\t\tif (!pSession->isPlaying()) {\n\t\t\tcAudioFadeParam::Remove(pSession);\n\t\t\tdelete pSession;\n\t\t}\n\t\tpSession = next;\n\t}\n}\n\nvoid CiOSAudio::stop(s32 _msec, float _tgtVol) {\n\tif (!m_bActive) return;\n    \n\t// SEの再生が終了してるものに関しては止める必要も無いので削除\n\tcleanup();\n    \n\tif (_msec <= 0) {\n\t\t// 即時停止\n\t\tif (m_preLoad) {\n\t\t\t// SEの停止\n\t\t\tCiOSAudioSession *pSession = m_begin;\n\t\t\twhile (pSession) {\n\t\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\t\tcAudioFadeParam::Remove(pSession);\n\t\t\t\tdelete pSession;\n\t\t\t\tpSession = next;\n\t\t\t}\n\t\t\tm_nowPlayTime = 0;\n\t\t\tm_pauseTime = 0;\n\t\t\tm_step = STEP_WAIT;\n\t\t}\n\t\telse {\n\t\t\t// BGMの停止\n\t\t\tcAudioFadeParam::Remove(this);\n\t\t\tAudioQueueStop(m_queue, true);\n\t\t\tAudioQueueDisposeTimeline(m_queue, m_TlineRef);\n\t\t\tm_nowPlayTime = 0;\n\t\t\tm_startPackNum = 0;\n\t\t\tm_pauseTime = 0;\n\t\t\tm_step = STEP_WAIT;\n\t\t}\n\t}\n\telse {\n\t\t// フェード\n\t\tif (m_preLoad) {\n\t\t\t// SEの停止\n\t\t\tCiOSAudioSession *pSession = m_begin;\n\t\t\twhile (pSession) {\n\t\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\t\tcAudioFadeParam::SetFadeParam(NULL, pSession, cAudioFadeParam::FADE_TYPE_STOP, _tgtVol, _msec, 0.0f);\n\t\t\t\tpSession = next;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// BGMの停止\n\t\t\tcAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_STOP, _tgtVol, _msec, 0.0f);\n\t\t}\n\t}\n}\n\nvoid CiOSAudio::closeAudio() {\n\tif (!m_bActive) return;\n    \n\tif (m_preLoad) {\n\t\t// SEの停止\n\t\t// このSEの全セッションを破棄\n\t\tCiOSAudioSession *pSession = m_begin;\n\t\twhile (pSession) {\n\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\tcAudioFadeParam::Remove(pSession);\n\t\t\tdelete pSession;\n\t\t\tpSession = next;\n\t\t}\n\t\tfor (int i = 0; i < m_ASBD.mChannelsPerFrame; i++) {\n\t\t\tdelete[] m_playBuffer[i];\n\t\t}\n\t\tdelete[] m_playBuffer;\n\t}\n\telse {\n\t\t// BGMの破棄\n\t\tcAudioFadeParam::Remove(this);\n\t\tAudioQueueStop(m_queue, true);\n\t\tAudioQueueDispose(m_queue, true);\n\t\tAudioQueueDisposeTimeline(m_queue, m_TlineRef);\n\t\tAudioFileClose(m_audioID);\n\t\tm_queue = 0;\n\t}\n\t// open前に戻す\n\tm_bActive = false;\n\tm_preLoad = false;\n\tm_bInit = false;\n\tif (m_soundPath) {\n\t\tdelete[] m_soundPath;\n\t\tm_soundPath = 0;\n\t}\n\tif (m_ASPD) {\n\t\tdelete[] m_ASPD;\n\t\tm_ASPD = NULL;\n\t}\n    \n\tm_encFile.release();\n}\n\n// SEは同時に複数再生され、どれを止めればよいかわからないため、BGMに対してのみ有効。\nvoid CiOSAudio::pause(s32 _msec, float _tgtVol) {\n\tif (m_step == STEP_PLAY) {\n\t\tif (m_preLoad) {\n\t\t\t// SEの場合現状何をポーズさせるか不明なのでスルー\n\t\t\tCiOSAudioSession *pSession = m_begin;\n\t\t\twhile (pSession) {\n\t\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\t\tpSession->pause();\n\t\t\t\tpSession = next;\n\t\t\t}\n\t\t\tm_step = STEP_PAUSE;\n\t\t}\n\t\telse {\n\t\t\t// BGMのポーズ\n\t\t\tif (_msec <= 0.0f) {\n\t\t\t\tm_pauseTime = m_startPackNum;\n\t\t\t\tcAudioFadeParam::Remove(this);\n                \n\t\t\t\t//AudioQueuePause(m_queue);\n\t\t\t\t// 停止前に現在の再生時間を取得\n\t\t\t\tm_nowPlayTime = tell();\n\t\t\t\tAudioQueueStop(m_queue, true);\n                \n\t\t\t\tm_bSeeked = false;\n\t\t\t\tm_step = STEP_PAUSE;\n#ifdef DEBUG_AUDIO\n\t\t\t\tCiOSPlatform::getInstance()->logging(\"[Audio] pause Audio!\");\n#endif\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_PAUSE, _tgtVol, _msec, 1.0f /*_startVolume*/);\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid CiOSAudio::resume(s32 _msec, float _tgtVol) {\n\tif (m_step == STEP_PAUSE) {\n\t\tif (m_preLoad) {\n\t\t\t// SEの場合ポーズが現状できないので一時停止解除もスルー\n\t\t\tCiOSAudioSession *pSession = m_begin;\n\t\t\twhile (pSession) {\n\t\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\t\tpSession->resume();\n\t\t\t\tpSession = next;\n\t\t\t}\n\t\t\tm_step = STEP_PLAY;\n\t\t}\n\t\telse {\n\t\t\t// BGMの一時停止解除\n            /*\n             AudioQueueStop(m_queue, false);\n             m_startPackNum = m_pauseTime;\n             m_nowPlayTime = (s32)(m_startPackNum * m_ASBD.mFramesPerPacket * (UInt64)1000 / m_ASBD.mSampleRate);\n             */\n\t\t\tuint64_t tval = mach_absolute_time();\n\t\t\tmach_timebase_info_data_t base;\n\t\t\tmach_timebase_info(&base);\n\t\t\tuint64_t now_time = (s64)((tval * base.numer) / base.denom);\n\t\t\tm_tval = now_time - m_last_delta;\n            \n\t\t\t// 再生再開前に読み出し開始位置を再設定して初期バッファ再度読み込み\n\t\t\tm_startPackNum = m_nowPlayTime * m_ASBD.mSampleRate / (m_ASBD.mFramesPerPacket * 1000);\n\t\t\tfor (int i = 0; i < BUF_COUNT; i++) {\n\t\t\t\tqueueCallback(this, m_queue, m_qBuf[i]);\n\t\t\t}\n\t\t\tAudioQueueStart(m_queue, 0);\n            \n#ifdef DEBUG_AUDIO\n\t\t\tCiOSPlatform::getInstance()->logging(\"[Audio] resume Audio!\");\n#endif\n\t\t\t/*\n             if( err != kAudioSessionNoError )\n             {\n             CiOSAudioManager::GetInstance().AudioSessionInit();\n             while( AudioQueueStart(m_queue, 0) != kAudioSessionNoError ) {\n             CiOSAudioManager::GetInstance().AudioSessionInit();\n             }\n             }\n\t\t\t */\n\t\t\tif (_msec > 0.0f) {\n\t\t\t\tcAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_RESUME, _tgtVol, _msec, 0.0f /*_startVolume*/);\n\t\t\t}\n\t\t\tm_step = STEP_PLAY;\n\t\t}\n\t}\n}\n\nvoid CiOSAudio::seek(s32 millisec) {\n\t// if(!m_bInit) return;\n\tUInt64 milli = millisec;\n\tif (!m_bInit) {\n\t\tplay();\n\t\tpause();\n\t}\n\tif (m_step == STEP_PLAY) {\n\t\tAudioQueuePause(m_queue);\n\t}\n    \n\tAudioQueueFlush(m_queue);\n\tm_startPackNum = milli * m_ASBD.mSampleRate / (m_ASBD.mFramesPerPacket * 1000);\n\tm_nowPlayTime = (s32)(m_startPackNum * m_ASBD.mFramesPerPacket * (UInt64)1000 / m_ASBD.mSampleRate);\n    \n\tif (!m_bSeeked) {\n\t\tAudioQueueStop(m_queue, 0);\n\t\tm_bSeeked = true;\n\t}\n\tif (m_step == STEP_PLAY) {\n\t\tAudioQueueStart(m_queue, 0);\n\t\tm_bSeeked = false;\n\t}\n}\n\ns32 CiOSAudio::tell() {\n\tif (m_step == STEP_WAIT || m_step == STEP_PAUSE) {\n\t\treturn m_nowPlayTime;\n        //        return 0;\n\t}\n\tAudioTimeStamp outTime;\n\tAudioQueueGetCurrentTime(m_queue, m_TlineRef, &outTime, 0);\n\ts32 playtime = outTime.mSampleTime * 1000 / m_ASBD.mSampleRate;\n\tif (playtime < 0) {\n\t\tplaytime = 0;\n\t}\n\treturn m_nowPlayTime + playtime;\n\t/*\n     if(m_step == STEP_PLAY) {\n     uint64_t tval = mach_absolute_time();\n     mach_timebase_info_data_t base;\n     mach_timebase_info(&base);\n     uint64_t delta = (s64)((tval * base.numer) / base.denom) - m_tval;\n     m_last_delta = (delta / 1000000);\n     }\n     return m_nowPlayTime + m_last_delta;\n\t */\n}\n\ns32 CiOSAudio::totalPlayTime() {\n\treturn m_soundAnalysisData.m_totalTime;\n}\n\nvoid CiOSAudio::setFadeParam(float _tgtVol, u32 _msec) {\n\tif (m_preLoad) {\n\t\tcleanup(); // SE再生してない物は破棄\n\t\tCiOSAudioSession *pSession = m_begin;\n\t\twhile (pSession) {\n\t\t\tCiOSAudioSession *next = pSession->m_next;\n\t\t\tcAudioFadeParam::SetFadeParam(NULL, pSession, cAudioFadeParam::FADE_TYPE_PLAYING, _tgtVol, _msec);\n\t\t\tpSession = next;\n\t\t}\n\t}\n\telse {\n\t\tif (m_step == STEP_PLAY) {\n\t\t\tcAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_PLAYING, _tgtVol, _msec);\n\t\t}\n\t}\n}\n\nvoid CiOSAudio::setFadeRatio(float _fadeRatio) {\n\tm_fadeRatio = _fadeRatio;\n\tupdateVolume();\n}\n\ns32 CiOSAudio::getState() {\n\ts32 state = IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\n\tswitch (m_step) {\n\t\tcase STEP_PLAY:\n\t\t\tstate = IClientRequest::E_SOUND_STATE_PLAY;\n\t\t\tbreak;\n            \n\t\tcase STEP_PAUSE:\n\t\t\tstate = IClientRequest::E_SOUND_STATE_PAUSE;\n\t\t\tbreak;\n            \n\t\tcase STEP_WAIT:\n\t\t\tstate = IClientRequest::E_SOUND_STATE_STOP;\n\t\t\tbreak;\n\t}\n\treturn state;\n}\n\nAudioFileMemory::AudioFileMemory()\n: m_decrypter()\n, m_decryptBuffer(NULL)\n, m_dataLength(0) {\n}\n\nbool AudioFileMemory::loadFile(const char *url) {\n\t//\n\t// Open File, Get Size and setup decryption.\n\t//\n\tbool res    = false;\n\tm_decryptBuffer = NULL;\n\tFILE *pFile = fopen(url, \"rb\");\n\tif (pFile) {\n\t\tu8 hdr[4];\n\t\tfread(hdr, 1, 4, pFile);\n        \n\t\tu32 hasHeader = decryptSetup((u8 *)url, hdr);\n        \n\t\t// get Size\n\t\tfseek(pFile, 0, SEEK_END);\n\t\tm_dataLength = ftell(pFile) - (hasHeader * 4);\n\t\tfseek(pFile, (hasHeader * 4), SEEK_SET);\n        \n\t\t// Alloc buffer\n\t\tm_decryptBuffer = new u8[m_dataLength];\n        \n\t\tif (m_decryptBuffer) {\n\t\t\t//\n\t\t\t// Read & Decrypt\n\t\t\t//\n\t\t\tu32 count = fread(m_decryptBuffer, 1, m_dataLength, pFile);\n\t\t\tdecrypt(m_decryptBuffer, count);\n\t\t\tres = true;\n\t\t}\n        \n\t\t// Complete\n\t\tfclose(pFile);\n\t}\n    \n\tif ((res == false) && m_decryptBuffer) {\n\t\trelease();\n\t}\n\treturn res;\n}\n\nvoid AudioFileMemory::release() {\n\tdelete m_decryptBuffer;\n\tm_decryptBuffer = NULL;\n}\n\nOSStatus AudioFileReadProc(void *inClientData, SInt64 inPosition, UInt32 requestCount, void *buffer, UInt32 *actualCount) {\n\t// check parameters\n\tif (!inClientData || !buffer || !actualCount) {\n\t\treturn EINVAL;\n\t}\n    \n\tAudioFileMemory *audioFileMemory = (AudioFileMemory *)inClientData;\n    \n\t// [OPTION] Use FILE* and use fread instead of preload.\n    \n\t// make sure position is within bounds\n\tif (inPosition < 0 || inPosition >= audioFileMemory->m_dataLength) {\n\t\t*actualCount = 0;\n\t\treturn noErr;\n\t}\n    \n\t// see if we need to cap requested length\n\t*actualCount = requestCount;\n\tSInt64 endPosition = inPosition + requestCount;\n\tif (endPosition >= audioFileMemory->m_dataLength) {\n\t\t*actualCount = requestCount - (endPosition - audioFileMemory->m_dataLength);\n\t}\n    \n\tmemcpy(buffer, audioFileMemory->m_decryptBuffer + inPosition, *actualCount);\n\t// [OPTION] Can decrypt here instead of preload.\n\t// --> Need to recompute the decrypt key for given position.\n\treturn noErr;\n}\n\nSInt64 AudioFileGetSizeProc(void *inClientData) {\n\tif (!inClientData) {\n\t\treturn EINVAL;\n\t}\n    \n\tAudioFileMemory *audioFileMemory = (AudioFileMemory *)inClientData;\n\treturn audioFileMemory->m_dataLength;\n}\n\nAudioFileTypeID GetAudioFileTypeId(CFURLRef inFileURL) {\n\treturn kAudioFileMP3Type;\n}\n\nvoid CiOSAudio::initBGM() {\n\tif (m_bActive) {\n\t\tOSStatus err = noErr;\n\t\tm_encFile.loadFile(m_soundPath);\n\t\terr = AudioFileOpenWithCallbacks(&m_encFile,\n\t\t                                 AudioFileReadProc,\n\t\t                                 NULL,  // Write\n\t\t                                 AudioFileGetSizeProc,\n\t\t                                 NULL,  // Set Size\n\t\t                                 kAudioFileMP3Type, &m_audioID\n\t\t                                 );\n        \n\t\tif (!err) {\n\t\t\tUInt32 size = sizeof(m_ASBD);\n\t\t\terr = AudioFileGetProperty(m_audioID, kAudioFilePropertyDataFormat, &size, &m_ASBD);\n\t\t\tklb_assert(!err && m_ASBD.mFormatID == kAudioFormatMPEGLayer3, \"format not support.\");\n\t\t}\n\t}\n}\n\nvoid CiOSAudio::playBGM() {\n\t// BGMとしてロードされている場合\n\t// 実態としてはアクセス用のパスを作ったところで終わっているので、\n\t// そのパスの音声を再生するAVAudioPlayerクラスを作成する。\n\tOSStatus err = noErr;\n\terr = AudioQueueNewOutput(&m_ASBD, CiOSAudio::queueCallback, this, CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &m_queue);\n    \n\tfloat master = m_platform->getMasterVolume(false);\n\tAudioQueueParameterValue vol = (AudioQueueParameterValue)(master * m_volume * m_fadeRatio);\n\terr = AudioQueueSetParameter(m_queue, kAudioQueueParam_Volume, vol);\n    \n\tUInt32 size = sizeof(m_maxPacketSize);\n\terr = AudioFileGetProperty(m_audioID, kAudioFilePropertyPacketSizeUpperBound, &size, &m_maxPacketSize);\n    \n\t// m_numPacketPerTime = m_ASBD.mSampleRate / (m_ASBD.mFramesPerPacket * 12);\n    \n\t// できるだけ高い精度で再生時刻を取得するため、m_numPacketPerTime を強制的に 1 として扱う\n\t// 1パケット中に含まれるPCMフレーム数は m_ASBD.mFramesPerPacket にあり、1パケットあたりの経過時間の累計で\n\t// 現在時刻を算出できる。\n\tswitch (m_buf_level) {\n\t\tcase 0:\n\t\t\tm_numPacketPerTime = 1;\n\t\t\tbreak;\n            \n\t\tcase 1:\n\t\t\tm_numPacketPerTime = m_ASBD.mFramesPerPacket;\n\t\t\tbreak;\n            \n\t\tcase 2:\n\t\t\tm_numPacketPerTime = m_ASBD.mFramesPerPacket * 2;\n\t\t\tbreak;\n            \n\t\tdefault:\n\t\t\tbreak;\n\t}\n\t// m_numPacketPerTime = 1;\n    \n\tAudioQueueCreateTimeline(m_queue, &m_TlineRef);\n    \n\tif (m_ASPD) {\n\t\tdelete[] m_ASPD;\n\t}\n\tm_ASPD = new AudioStreamPacketDescription[(int)m_numPacketPerTime];\n\tUInt32 bufSize = m_numPacketPerTime * m_maxPacketSize;\n    \n\tfor (int i = 0; i < 3; i++) {\n\t\terr = AudioQueueAllocateBuffer(m_queue, bufSize, &(m_qBuf[i]));\n\t\tif (err) {\n\t\t\tklb_assert(!err, \"queue allocation error.\");\n\t\t}\n\t\tqueueCallback(this, m_queue, m_qBuf[i]);\n\t}\n    \n\t// 音量更新\n\tupdateVolume();\n}\n\nvoid CiOSAudio::initSE() {\n\tif (!m_bActive) return;\n    \n\tNSString *nspath = [NSString stringWithUTF8String:m_soundPath];\n\tm_soundURL = [NSURL fileURLWithPath:nspath];\n\tOSStatus err = noErr;\n    \n\t// Old code : err = ExtAudioFileOpenURL((CFURLRef)m_soundURL, &m_extAudioID);\n\tm_encFile.loadFile(m_soundPath);\n\terr = AudioFileOpenWithCallbacks(&m_encFile,\n\t                                 AudioFileReadProc,\n\t                                 NULL,  // Write\n\t                                 AudioFileGetSizeProc,\n\t                                 NULL,  // Set Size\n\t                                 kAudioFileMP3Type, &m_audioID\n\t                                 );\n    \n\tklb_assert(err == noErr, \"could not open SE file.\");\n    \n\terr = ExtAudioFileWrapAudioFileID(\n                                      m_audioID,\n                                      false,\n                                      &m_extAudioID\n                                      );\n    \n\tklb_assert(err == noErr, \"could not open SE file.\");\n    \n\tUInt32 size = sizeof(m_ASBD);\n\terr = ExtAudioFileGetProperty(m_extAudioID, kExtAudioFileProperty_FileDataFormat, &size, &m_ASBD);\n\tklb_assert(err == noErr && m_ASBD.mFormatID == kAudioFormatMPEGLayer3, \"format not support.\");\n\t//m_volume = 1.0f;\n    \n\t//m_clientFormat.mSampleRate        = 44100.0;\n\tm_clientFormat.mSampleRate        = m_ASBD.mSampleRate;     // 2012/12/04 サンプリングレートが固定値で44100で入力されていたのが間違い、これだとサンプリングレートが44100以外の音声が途切れたりしてしまう。\n\tm_clientFormat.mFormatID          = kAudioFormatLinearPCM;\n\tm_clientFormat.mFormatFlags       = kAudioFormatFlagsAudioUnitCanonical;\n\tm_clientFormat.mChannelsPerFrame  = m_ASBD.mChannelsPerFrame;\n\tm_clientFormat.mBytesPerFrame     = sizeof(AudioUnitSampleType);\n\tm_clientFormat.mBytesPerPacket    = sizeof(AudioUnitSampleType);\n\tm_clientFormat.mFramesPerPacket   = 1;\n\tm_clientFormat.mBitsPerChannel    = 8 * sizeof(AudioUnitSampleType);\n\tm_clientFormat.mReserved          = 0;\n    \n\t// フォーマットの取得\n\terr = ExtAudioFileSetProperty(m_extAudioID, kExtAudioFileProperty_ClientDataFormat, sizeof(AudioStreamBasicDescription), &m_clientFormat);\n\tklb_assert(!err, \"could not open SE file.\");\n    \n\t// バッファサイズの取得\n\tsize = sizeof(SInt64);\n\terr = ExtAudioFileGetProperty(m_extAudioID, kExtAudioFileProperty_FileLengthFrames, &size, &m_totalFrames);\n\tklb_assert(!err, \"could not open SE file.\");\n    \n\t// バッファの確保等\n\tm_playBuffer = new AudioUnitSampleType * [m_ASBD.mChannelsPerFrame];\n\tfor (int i = 0; i < m_ASBD.mChannelsPerFrame; i++) {\n\t\tm_playBuffer[i] = new AudioUnitSampleType[m_totalFrames];\n\t}\n    \n\tAudioBufferList *bufList = (AudioBufferList *)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer) * (m_ASBD.mChannelsPerFrame - 1));\n\tbufList->mNumberBuffers = m_ASBD.mChannelsPerFrame;\n\tfor (int i = 0; i < m_ASBD.mChannelsPerFrame; i++) {\n\t\tbufList->mBuffers[i].mNumberChannels = 1;\n\t\tbufList->mBuffers[i].mDataByteSize = sizeof(AudioUnitSampleType) * m_totalFrames;\n\t\tbufList->mBuffers[i].mData = m_playBuffer[i];\n\t}\n    \n\tUInt32 readFrameSize = m_totalFrames;\n\terr = ExtAudioFileRead(m_extAudioID, &readFrameSize, bufList);\n\tklb_assert(!err, \"could not open SE file.\");\n    \n\tExtAudioFileDispose(m_extAudioID);\n\tfree(bufList);\n    \n\t/*\n     m_isDone = false;\n     AudioComponentDescription cd;\n     cd.componentType            = kAudioUnitType_Output;\n     cd.componentSubType         = kAudioUnitSubType_RemoteIO;\n     cd.componentManufacturer    = kAudioUnitManufacturer_Apple;\n     cd.componentFlags           = 0;\n     cd.componentFlagsMask       = 0;\n     AudioComponent component = AudioComponentFindNext(0, &cd);\n     AudioComponentInstanceNew(component, &m_audioUnit);\n     AudioUnitInitialize(m_audioUnit);\n     \n     \n     AURenderCallbackStruct callbackStruct;\n     callbackStruct.inputProc = CiOSAudio::renderCallback;\n     callbackStruct.inputProcRefCon = this;\n     \n     AudioUnitSetProperty(m_audioUnit,\n     kAudioUnitProperty_SetRenderCallback,\n     kAudioUnitScope_Input,\n     0,\n     &callbackStruct,\n     sizeof(AURenderCallbackStruct));\n     \n     AudioUnitSetProperty(m_audioUnit,\n     kAudioUnitProperty_StreamFormat,\n     kAudioUnitScope_Input,\n     0,\n     &m_clientFormat,\n     sizeof(AudioStreamBasicDescription));\n\t */\n}\n\nvoid CiOSAudio::playSE(s32 _msec, float _tgtVol, float _startVolume) {\n\tcleanup();  // 既に再生が終了しているSEセッションを破棄する\n\tCiOSAudioSession *pSession = new CiOSAudioSession(this);\n\tif (_msec > 0 && (_tgtVol != _startVolume)) {\n\t\tcAudioFadeParam::SetFadeParam(NULL, pSession, cAudioFadeParam::FADE_TYPE_PLAY, _tgtVol, _msec, _startVolume);\n\t}\n\tm_step = STEP_PLAY;\n\tm_fadeRatio = _startVolume;\n\tupdateVolume();\n\tpSession->play();\n}\n\nvoid CiOSAudio::sendQueue(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) {\n\tOSStatus err = noErr;\n\tfloat master = m_platform->getMasterVolume(false);\n\tAudioQueueParameterValue vol = (AudioQueueParameterValue)(master * m_volume * m_fadeRatio);\n\terr = AudioQueueSetParameter(inAQ, kAudioQueueParam_Volume, vol);\n    \n\t// NSLog(@\"sendQueue(%d)\", (int)m_startPackNum);\n\tUInt32 numBytes = 0;\n\tUInt32 numPackets = m_numPacketPerTime;\n\terr = AudioFileReadPackets(m_audioID, NO, &numBytes, m_ASPD, m_startPackNum, &numPackets, inBuffer->mAudioData);\n\t// klb_assert(numBytes > 0, \"no audio data.\");\n    \n\tif (numPackets <= 0) {\n\t\t// ループ処理\n\t\tnumBytes = 0;\n\t\tnumPackets = m_numPacketPerTime;\n\t\tm_startPackNum = 0;\n        \n\t\terr = AudioFileReadPackets(m_audioID, NO, &numBytes, m_ASPD, m_startPackNum, &numPackets, inBuffer->mAudioData);\n\t}\n\tinBuffer->mAudioDataByteSize = numBytes;\n\terr = AudioQueueEnqueueBuffer(inAQ, inBuffer, numPackets, m_ASPD);\n\t// klb_assert(err != noErr, \"error: AudioQueueDataByteSize\");\n    \n\t// 現在時刻を算出し、保管しておく。\n    \n\t//m_nowPlayTime = (s32)(m_startPackNum * m_ASBD.mFramesPerPacket * (UInt64)1000 / m_ASBD.mSampleRate);\n\tm_startPackNum += numPackets;\n    \n\t/*\n     uint64_t tval = mach_absolute_time();\n     mach_timebase_info_data_t base;\n     mach_timebase_info(&base);\n     \n     m_tval = (s64)((tval * base.numer) / base.denom);\n     m_last_delta = 0;\n\t */\n}\n\nvoid CiOSAudio::queueCallback(void *inUserData,\n                              AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) {\n\tCiOSAudio *pAudio = (CiOSAudio *)inUserData;\n\tpAudio->sendQueue(inAQ, inBuffer);\n}\n\n// 個々の発音セッションクラス\nCiOSAudioSession::CiOSAudioSession(CiOSAudio *audio)\n: m_audio(audio)\n, m_prev(0)\n, m_next(0)\n, m_isPause(false) {\n\t// 自身を指定されたデータの親クラスに登録する\n\tm_prev = m_audio->m_end;\n\tif (m_prev) {\n\t\tm_prev->m_next = this;\n\t}\n\telse {\n\t\tm_audio->m_begin = this;\n\t}\n\tm_audio->m_end = this;\n    \n\tinit();\n}\n\nCiOSAudioSession::~CiOSAudioSession() {\n\tm_isDone = true;\n\tm_isPlaying = false;\n\tcAudioFadeParam::Remove(this);\n\tAudioOutputUnitStop(m_audioUnit);\n\tAudioUnitUninitialize(m_audioUnit);\n\tAudioComponentInstanceDispose(m_audioUnit);\n    \n\t// 自身を親から削除する\n\tif (m_prev) {\n\t\tm_prev->m_next = m_next;\n\t}\n\telse {\n\t\tm_audio->m_begin = m_next;\n\t}\n\tif (m_next) {\n\t\tm_next->m_prev = m_prev;\n\t}\n\telse {\n\t\tm_audio->m_end = m_prev;\n\t}\n}\n\nvoid CiOSAudioSession::init() {\n\tm_currentFrame = 0;\n\tm_isDone = false;\n\tm_isPlaying = false;\n\tm_isPause = false;\n    \n\tm_volume = m_audio->m_volume;\n\tm_panL = m_audio->m_panL;\n\tm_panR = m_audio->m_panR;\n    \n\tm_fadeRatio = 1.0f;\n    \n\tAudioComponentDescription cd;\n\tcd.componentType            = kAudioUnitType_Output;\n\tcd.componentManufacturer    = kAudioUnitManufacturer_Apple;\n\tcd.componentFlags           = 0;\n\tcd.componentFlagsMask       = 0;\n\tAudioComponent component = AudioComponentFindNext(0, &cd);\n\tAudioComponentInstanceNew(component, &m_audioUnit);\n\tAudioUnitInitialize(m_audioUnit);\n    \n    \n\tAURenderCallbackStruct callbackStruct;\n\tcallbackStruct.inputProc = CiOSAudioSession::renderCallback;\n\tcallbackStruct.inputProcRefCon = this;\n    \n\tAudioUnitSetProperty(m_audioUnit,\n\t                     kAudioUnitProperty_SetRenderCallback,\n\t                     kAudioUnitScope_Input,\n\t                     0,\n\t                     &callbackStruct,\n\t                     sizeof(AURenderCallbackStruct));\n    \n\tAudioUnitSetProperty(m_audioUnit,\n\t                     kAudioUnitProperty_StreamFormat,\n\t                     kAudioUnitScope_Input,\n\t                     0,\n\t                     &m_audio->m_clientFormat,\n\t                     sizeof(AudioStreamBasicDescription));\n    \n\tAudioOutputUnitStart(m_audioUnit);\n}\n\nvoid CiOSAudioSession::play() {\n\tm_isDone = false;\n\tm_currentFrame = 0;\n\tm_isPlaying = true;\n}\n\nvoid CiOSAudioSession::stop() {\n\t//AudioOutputUnitStop(m_audioUnit);\n\tm_isDone = true;\n\tm_isPlaying = false;\n\tcAudioFadeParam::Remove(this);\n}\n\nvoid CiOSAudioSession::pause() {\n\t//m_isDone = true;\n\tm_isPause = true;\n\tcAudioFadeParam::Remove(this);\n\t//m_isPlaying = false;\n}\n\nvoid CiOSAudioSession::resume() {\n\t//m_isPlaying = true;\n\tm_isPause = false;\n}\n\ns64 CiOSAudioSession::tell() {\n\ts64 ret = 0;\n    \n\tif (m_currentFrame != 0) {\n\t\tret = (m_currentFrame * 1000) / m_audio->m_clientFormat.mSampleRate;\n\t}\n\treturn ret;\n}\n\nvoid CiOSAudioSession::checkSessionStoped() {\n\tif (m_audio) {\n\t\tm_audio->checkSessionStoped();\n\t}\n}\n\nvoid CiOSAudioSession::setFadeRatio(float _fadeRatio) {\n\tm_fadeRatio = _fadeRatio;\n}\n\nOSStatus CiOSAudioSession::callbackSE(AudioUnitRenderActionFlags *ioActionFlags,\n                                      const AudioTimeStamp *      inTimeStamp,\n                                      UInt32                      inBusNumber,\n                                      UInt32                      inNumberFrames,\n                                      AudioBufferList *           ioData) {\n\tint indexR = (m_audio->m_ASBD.mChannelsPerFrame == 2) ? 1 : 0;\n\tAudioUnitSampleType *outL = (AudioUnitSampleType *)ioData->mBuffers[0].mData;\n\tAudioUnitSampleType *outR = (AudioUnitSampleType *)ioData->mBuffers[indexR].mData;\n    \n\t// ポーズ中or末尾まで再生終了してる時はバッファに0を書き込み\n\tif (m_isDone || m_isPause) {\n\t\tfor (int i = 0; i < inNumberFrames; i++) {\n\t\t\t*outL++ = *outR++ = 0;\n\t\t}\n\t\treturn noErr;\n\t}\n\t// 左右の音量にかける係数を求める。\n\t// 設定されているボリュームと、パン位置によって決まる。\n\t// 使われるボリューム/パンの値は、セッションの再生開始時の値であり、その後変更されても影響を受けない。\n\tfloat master = m_audio->m_platform->getMasterVolume(true);    // マスターボリュームを取得\n\tfloat nL = master * m_volume * m_panL * m_fadeRatio;\n\tfloat nR = master * m_volume * m_panR * m_fadeRatio;\n    \n\t// 丸め\n\tif (nL > 1.0f) {\n\t\tnL = 1.0f;\n\t}\n\tif (nR > 1.0f) {\n\t\tnR = 1.0f;\n\t}\n    \n\tUInt32 left = (m_isDone) ? 0 : (m_audio->m_totalFrames - m_currentFrame);\n\tUInt32 fnum = (left > inNumberFrames) ? inNumberFrames : left;\n\tUInt32 right = inNumberFrames - fnum;\n    \n\tfor (int i = 0; i < fnum; i++) {\n\t\t*outL++ = nL * m_audio->m_playBuffer[0][m_currentFrame];\n\t\t*outR++ = nR * m_audio->m_playBuffer[indexR][m_currentFrame++];\n\t}\n\tfor (int i = 0; i < right; i++) {\n\t\t*outL++ = *outR++ = 0;\n\t}\n\tif (m_currentFrame == m_audio->m_totalFrames ||\n\t    tell() >= m_audio->m_soundAnalysisData.m_totalTime) {\n\t\tm_isDone = true;\n\t\tm_isPlaying = false;\n\t\tcAudioFadeParam::Remove(this);\n\t\tcheckSessionStoped();\n\t}\n\treturn noErr;\n}\n\nOSStatus CiOSAudioSession::renderCallback(void *                      inRefCon,\n                                          AudioUnitRenderActionFlags *ioActionFlags,\n                                          const AudioTimeStamp *      inTimeStamp,\n                                          UInt32                      inBusNumber,\n                                          UInt32                      inNumberFrames,\n                                          AudioBufferList *           ioData) {\n\tCiOSAudioSession *audio = (CiOSAudioSession *)inRefCon;\n\treturn audio->callbackSE(ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSAudioManager.mm",
    "content": "﻿#include \"CiOSAudioManager.h\"\n\n// #define DEBUG_AUDIO\n\n// インスタンス\nCiOSAudioManager CiOSAudioManager::m_instance;\n\n// 割り込み処理関数\nstatic void AudioInterruptionCallBack(void *_userData, UInt32 _state) {\n\tif (_userData == NULL) return;\n\tCiOSAudioManager *pSndMng = (CiOSAudioManager *)_userData;\n\t// IPlatformRequest *pform = CiOSPlatform::getInstance();\n}\n\n/*!\n @brief  コンストラクタ\n */\nCiOSAudioManager::CiOSAudioManager()\n: m_masterVol_se(1.0f)\n, m_masterVol_bgm(1.0f)\n, m_multiProcessType(IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT)\n, m_bSEOff(false)\n, m_bBGMOff(false)\n, m_bPauseOnInterruption(true) {\n}\n\n/*!\n @brief  デストラクタ\n */\nCiOSAudioManager::~CiOSAudioManager() {\n}\n\n/*!\n @brief  初期化処理\n @param[in]  void\n @return     bool    true:正常, false:異常\n */\nbool CiOSAudioManager::Initialize(void) {\n\t// AudioSessionの初期化\n\tAudioSessionInit();\n    \n\t// フェード管理機構の初期化\n\tcAudioFadeParam::AudioFadeParamInit();\n    \n\t// IOバッファサイズの設定\n\tFloat64 sampleRate;\n\tUInt32 size = sizeof(sampleRate);\n\tOSStatus err;\n    \n\tm_bInit = true;\n\treturn true;\n}\n\n/*!\n @brief  初期化処理\n @param[in]  void\n @return     bool    true:正常, false:異常\n */\nbool CiOSAudioManager::Termination(void) {\n\t// フェード管理機構の終了処理\n\tcAudioFadeParam::AudioFadeParamExit();\n    \n\treturn true;\n}\n\n/*!\n @brief  サウンドハンドル作成\n @param[in]  const char* _url    サウンドファイルパス\n @return     void*               サウンドハンドル\n */\nvoid *CiOSAudioManager::CreateAudioHandle(const char *_url, CiOSPlatform *_platform) {\n\tfor (int i = 0; i < SND_SLOT; ++i) {\n\t\t// 使用中の物はスキップ\n\t\tif (m_audio[i].isActive()) {\n\t\t\tcontinue;\n\t\t}\n        \n\t\tbool bRes = m_audio[i].openAudio(_url, _platform);\n\t\treturn (bRes) ? ((void *)&m_audio[i]) : NULL;\n\t}\n\t// 空のスロットが見つからなかった\n\treturn NULL;\n}\n\n/*!\n @brief  AudioSessionの初期化\n @param[in]  void\n @return     bool    true:正常, false:異常\n */\nbool CiOSAudioManager::AudioSessionInit(void) {\n\treturn true;\n}\n\n//! AudioSessionプロパティの設定\nbool CiOSAudioManager::AudioSessionPropertySetting(void) {\n\treturn true;\n}\n\n/*!\n @brief  割り込み開始処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::AudioBeginInterruption(void) {\n\t/*\n     // ポーズ処理をエンジン側で制御しないのでリターン\n     if( getPauseOnInterruption() == false ) return;\n     \n     for( int i=0; i<SND_SLOT; ++i )\n     {\n     if( m_audio[i].isActive() &&\n     (m_audio[i].getState() == IClientRequest::E_SOUND_STATE_PLAY) &&\n     (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_NONE) )\n     {\n     // サウンドを停止し割り込みフラグをたてる\n     m_audio[i].pause();\n     m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_CALLING);\n     }\n     }\n\t */\n}\n\n/*!\n @brief  割り込み終了処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::AudioEndInterruption(void) {\n\t/*\n     AudioSessionSetActive( true );\n     \n     // 電話などの割り込み復帰後にSessionが無効化されるのでSessionを再設定\n     AudioSessionInit();\n     \n     // マスターボリュームON/OFF設定\n     chackAudioMasterVolume();\n     \n     for( int i=0; i<SND_SLOT; ++i )\n     {\n     if( m_audio[i].isActive() && (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_CALLING) )\n     {\n     // 割り込みフラグがたっている物に限り再生を再開\n     if( !m_audio[i].getLuaPause() ) {\n     m_audio[i].resume();\n     }\n     m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_NONE);\n     }\n     }\n\t */\n}\n\n/*!\n @brief  非アクティブになる瞬間の処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::AudioDidResignActive(void) {\n\t// ポーズ処理をエンジン側で制御しないのでリターン\n\tif (getPauseOnInterruption() == false) return;\n    \n\tfor (int i = 0; i < SND_SLOT; ++i) {\n\t\tif (m_audio[i].isActive() &&\n\t\t    (m_audio[i].getState() == IClientRequest::E_SOUND_STATE_PLAY) &&\n\t\t    (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_NONE)) {\n\t\t\t// サウンドを停止し割り込みフラグをたてる\n\t\t\tm_audio[i].pause();\n\t\t\tm_audio[i].setInterruptionType(eINTERRUPTION_TYPE_RESIGN_ACTIVE);\n\t\t}\n\t}\n}\n\n/*!\n @brief  アクティブに戻る瞬間の処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::AudioDidBecomeActive(void) {\n\t// マスターボリュームON/OFF設定\n\tchackAudioMasterVolume();\n    \n\tfor (int i = 0; i < SND_SLOT; ++i) {\n\t\tif (m_audio[i].isActive() && (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_RESIGN_ACTIVE)) {\n\t\t\t// 割り込みフラグがたっている物に限り再生を再開\n\t\t\tif (!m_audio[i].getLuaPause()) {\n\t\t\t\tm_audio[i].resume();\n\t\t\t}\n\t\t\tm_audio[i].setInterruptionType(eINTERRUPTION_TYPE_NONE);\n\t\t}\n\t}\n}\n\n/*!\n @brief  バックグラウンドに行く瞬間の処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::AudioDidEnterBackground(void) {\n\t/*\n     // ポーズ処理をエンジン側で制御しないのでリターン\n     if( getPauseOnInterruption() == false ) return;\n     \n     for( int i=0; i<SND_SLOT; ++i )\n     {\n     if( m_audio[i].isActive() &&\n     (m_audio[i].getState() == IClientRequest::E_SOUND_STATE_PLAY) &&\n     (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_NONE) )\n     {\n     // サウンドを停止し割り込みフラグをたてる\n     m_audio[i].pause();\n     m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_ENTER_BACKGROUND);\n     }\n     }\n\t */\n}\n\n/*!\n @brief  バックグラウンドから戻る際の処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::AudioDidEnterForeground(void) {\n\t/*\n     AudioSessionSetActive( true );\n     \n     // マスターボリュームON/OFF設定\n     chackAudioMasterVolume();\n     \n     for( int i=0; i<SND_SLOT; ++i )\n     {\n     if( m_audio[i].isActive() && (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_ENTER_BACKGROUND) )\n     {\n     // 割り込みフラグがたっている物に限り再生を再開\n     if( !m_audio[i].getLuaPause() ) {\n     m_audio[i].resume();\n     }\n     m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_NONE);\n     }\n     }\n\t */\n}\n\n/*!\n @brief  サウンドとミュージックの並行処理タイプ\n @param[in]  s32\n @return     void\n */\nvoid CiOSAudioManager::SetAudioMultiProcessType(s32 _type) {\n\tm_multiProcessType = _type;\n    \n\t// AudioSession再設定\n\tAudioSessionInit();\n    \n\t// ボリュームの再設定\n\tfor (int i = 0; i < SND_SLOT; ++i) {\n\t\tif (m_audio[i].isActive()) {\n\t\t\tm_audio[i].updateVolume();\n\t\t}\n\t}\n}\n\n/*!\n @brief  SEのマスターボリューム設定\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::SetSEMasterVolume(float _vol) {\n\tif (_vol < 0.0f) {\n\t\t_vol = 0.0f;\n\t}\n\telse if (_vol > 1.0f) {\n\t\t_vol = 1.0f;\n\t}\n\tm_masterVol_se = _vol;\n}\n\n//! iPodミュージックプレーヤーの再生状態取得\n/*!\n @brief  iPodミュージックの再生状態の取得\n @param[in]  void\n @return     bool   true:再生中, false:未再生\n */\nbool CiOSAudioManager::isMusicPlayerPlaying(void) {\n\treturn false;\n}\n\n/*!\n @brief  BGMのマスターボリューム設定\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::SetBGMMasterVolume(float _vol) {\n\tif (_vol < 0.0f) {\n\t\t_vol = 0.0f;\n\t}\n\telse if (_vol > 1.0f) {\n\t\t_vol = 1.0f;\n\t}\n\tm_masterVol_bgm = _vol;\n}\n\n/*!\n @brief  SEのマスターボリューム取得\n @param[in]  void\n @return     float  SEマスターボリューム(0.0f〜1.0f)\n */\nfloat CiOSAudioManager::GetSEMasterVolume(void) {\n\t// SEオフの状態なのでマスターを常に０でリターン\n\tif (m_bSEOff) {\n\t\treturn 0.0f;\n\t}\n\treturn m_masterVol_se;\n}\n\n/*!\n @brief  BGMのマスターボリューム取得\n @param[in]  void\n @return     float  BGMマスターボリューム(0.0f〜1.0f)\n */\nfloat CiOSAudioManager::GetBGMMasterVolume(void) {\n\t// BGMオフの状態なのでマスターを常に０でリターン\n\tif (m_bBGMOff) {\n\t\treturn 0.0f;\n\t}\n\treturn m_masterVol_bgm;\n}\n\n/*!\n @brief  サウンドの音量更新\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::UpdateVolume(void) {\n\tfor (int i = 0; i < SND_SLOT; ++i) {\n\t\tif (m_audio[i].isActive()) m_audio[i].updateVolume();\n\t}\n}\n\n/*!\n @brief 現在の設定によりマスターボリュームのON/OFF\n @param[in] void\n @return    void\n */\nvoid CiOSAudioManager::chackAudioMasterVolume(void) {\n\tswitch (m_multiProcessType) {\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:    // iPodミュージックを無効\n\t\t\tm_bSEOff = false;\n\t\t\tm_bBGMOff = false;\n\t\t\tbreak;\n            \n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:    // ゲームサウンドを無効\n\t\t\tm_bSEOff = true;\n\t\t\tm_bBGMOff = true;\n\t\t\tif (isMusicPlayerPlaying() == false) {\n\t\t\t\tm_bSEOff = false;\n\t\t\t\tm_bBGMOff = false;\n\t\t\t}\n\t\t\tbreak;\n            \n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT: // ゲームのBGMサウンドのみ無効\n\t\t\tm_bSEOff = false;\n\t\t\tm_bBGMOff = true;\n\t\t\tif (isMusicPlayerPlaying() == false) {\n\t\t\t\tm_bBGMOff = false;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\tUpdateVolume();\n}\n\n/*!\n @brief  毎フレーム行う処理\n @param[in]  void\n @return     void\n */\nvoid CiOSAudioManager::Exec(void) {\n\tfor (int i = 0; i < SND_SLOT; ++i) {\n\t\tif (m_audio[i].isActive()) m_audio[i].audioSessionCleanup();\n\t}\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSMovieView.mm",
    "content": "#import \"CiOSMovieView.h\"\n#include \"CiOSWidget.h\"\n@implementation CiOSMovieView\n\n+ (Class)layerClass {\n\treturn [AVPlayerLayer class];\n}\n\n- (void)playerItemDidReachEnd:(NSNotification *)notification {\n\tAVPlayerItem *p = [notification object];\n\tCiOSMovieWidget *pWidget = NULL;\n    \n\tif (!pWidget) return;\n\tpWidget->setStatus(1);  // 終了ステータスを書き込む\n\t// movie play end\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSPathConv.mm",
    "content": "#include <sys/stat.h>\n#include <errno.h>\n#include \"CiOSPathConv.h\"\n#include \"CPFInterface.h\"\n\n\nCiOSPathConv::CiOSPathConv() : m_build(false), m_external(0), m_install(0) {\n}\n\nCiOSPathConv::~CiOSPathConv() {\n\tdelete[] m_external;\n\tdelete[] m_install;\n}\n\nCiOSPathConv&CiOSPathConv::getInstance() {\n\tstatic CiOSPathConv instance;\n\treturn instance;\n}\n\nconst char *CiOSPathConv::makePath(const char *path, const char *suffix, const char *base) {\n\tint extlen = (suffix) ? strlen(suffix) : 0;\n\tint len = strlen(path) + strlen(base) + extlen + 2;\n\tchar *buf = new char[len];\n\tstrcpy(buf, base);\n\t//strcat(buf, \"/\");\n\tstrcat(buf, path);\n\tif (suffix) strcat(buf, suffix);\n\t//CPFInterface::getInstance().platform().logging(\"fullpath: %s\", buf);\n\treturn (const char *)buf;\n}\n\nbool CiOSPathConv::checkExists(const char *path) {\n\tbool bResult = true;\n\tstruct stat st;\n\tint iRes = stat(path, &st);\n\tif ((iRes != 0) && (errno == ENOENT)) bResult = false;\n\treturn bResult;\n}\n\nconst char *CiOSPathConv::fullpath(const char *url, const char *suffix, bool *isReadOnly) {\n\tbuild();\n\tif (isReadOnly) {\n\t\t*isReadOnly = true;\n\t}\n    \n\t// assets が指定されている場合、まずは external から探し、\n\t// 見つからなければ install から探す。どちらもなければ 0 を返す。\n\tif (!strncmp(url, \"asset://\", 8)) {\n\t\tconst char *path;\n\t\tpath = makePath(url + 8, suffix, m_external);\n\t\tif (checkExists(path)) {\n\t\t\tif (isReadOnly) {\n\t\t\t\t*isReadOnly = false;\n\t\t\t}\n\t\t\treturn path;\n\t\t}\n\t\tdelete[] path;\n        \n\t\tpath = makePath(url + 8, suffix, m_install);\n\t\tif (checkExists(path)) return path;\n\t\tdelete[] path;\n        \n\t\t// ファイルが見つからなかったのでログを出しとく\n\t\tCPFInterface::getInstance().platform().logging(\"[file]: not found '%s%s'\", url, suffix);\n        \n\t\treturn 0;\n\t}\n    \n\tif (!strncmp(url, \"external/\", 9)) {\n\t\tif (isReadOnly) {\n\t\t\t*isReadOnly = false;\n\t\t}\n\t\treturn makePath(url + 9, suffix, m_external);\n\t}\n\tif (!strncmp(url, \"install/\", 8)) return makePath(url + 8, suffix, m_install);\n\treturn 0;\n}\n\nvoid CiOSPathConv::create_external() {\n\t// file://external を作る\n\tNSString *nshome = NSHomeDirectory();\n\tconst char *home = [nshome UTF8String];\n\tint length = strlen(home) + strlen(PATH_EXTERN);\n\tchar *buf = new char[length + 1];\n\tstrcpy(buf, home);\n\tstrcat(buf, PATH_EXTERN);\n\tm_external = (const char *)buf;\n\tif (mkdir(m_external, 0755) == 0) {\n\t\tCPFInterface::getInstance().platform().excludePathFromBackup(m_external);\n\t}\n}\n\nvoid CiOSPathConv::create_install() {\n\t// file://install を作る\n\tNSString *nshome = [[NSBundle mainBundle] bundlePath];\n\tconst char *home = [nshome UTF8String];\n\tint length = strlen(home) + strlen(PATH_INSTALL);\n\tchar *buf = new char[length + 1];\n\tstrcpy(buf, home);\n\tstrcat(buf, PATH_INSTALL);\n\tm_install = (const char *)buf;\n}\n\nvoid CiOSPathConv::build() {\n\tif (m_build) return;\n\tcreate_install();\n\tcreate_external();\n\tm_build = true;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSPlatform.mm",
    "content": "#include <iostream>\n#include <pthread.h>\n#include <time.h>\n#import <mach/mach_time.h>\n#import <CommonCrypto/CommonDigest.h>\n#import <Security/Security.h>\n#import <StoreKit/StoreKit.h>\n#import <sys/mount.h>\n#import <sys/xattr.h>\n#import <sys/types.h>\n#import <sys/sysctl.h>\n#include \"RenderingFramework.h\"\n#include \"CiOSPlatform.h\"\n#include \"CiOSReadFileStream.h\"\n#include \"CSockReadStream.h\"\n#include \"CiOSAudio.h\"\n#include \"CiOSPathConv.h\"\n#include \"CiOSWidget.h\"\n#include \"CiOSSysResource.h\"\n#include \"CiOSTmpFile.h\"\n#include \"CKLBLuaEnv.h\"\n#include \"CKLBJsonItem.h\"\n#include \"CKLBUtility.h\"\n#include \"CiOSAudioManager.h\"\n#include \"FontRendering.h\"\n\n#define IDENTIFIER\n\nCiOSPlatform *CiOSPlatform::m_instance = 0;\n\nCiOSPlatform::CiOSPlatform(EAGLView *pView, float scale)\n: m_pView(pView), m_scale(scale) {\n\t//-----機種取得\n\tsize_t size;\n\tsysctlbyname(\"hw.machine\", NULL, &size, NULL, 0);\n\tchar *machine = static_cast <char *>(malloc(size));\n\tsysctlbyname(\"hw.machine\", machine, &size, NULL, 0);\n\t/*\n     Possible values:\n     \"i386\" = iPhone Simulator\n     \"iPhone1,1\" = iPhone 1G\n     \"iPhone1,2\" = iPhone 3G\n     \"iPhone2,1\" = iPhone 3GS\n     \"iPhone3,1\" = iPhone 4\n     \"iPod1,1\" = iPod touch 1G\n     \"iPod2,1\" = iPod touch 2G\n     \"iPod3,1\" = iPod touch 3G\n     \"iPod4,1\" = iPod touch 4G\n\t */\n\t//NSString *platform = [NSString stringWithCString: machine ];\n\t// ,->_ に整形\n\tNSString *tmpPlatform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];\n\tNSString *platform = [tmpPlatform stringByReplacingOccurrencesOfString:@\",\" withString:@\"_\"];\n\tfree(machine);\n\t//-----\n    \n\t// TODO: fetch actual OS version info\n\tNSString *tzname = [[NSTimeZone systemTimeZone] abbreviation];\n\tsprintf(m_platform, \"iOS;%s %s %d.%d;%s\",\n\t        [platform UTF8String],\n\t        \"OSX\",\n\t        10,\n\t        8,\n\t        [tzname UTF8String]);\n\tm_instance = this;\n}\n\nCiOSPlatform::~CiOSPlatform() {\n\tm_instance = 0;\n}\n\nCiOSPlatform *CiOSPlatform::getInstance() {\n\treturn m_instance;\n}\n\nbool CiOSPlatform::useEncryption() {\n\treturn true;\n}\n\ns64 CiOSPlatform::nanotime() {\n\tuint64_t tval = mach_absolute_time();\n\tmach_timebase_info_data_t base;\n\tmach_timebase_info(&base);\n    \n\treturn (s64)((tval * base.numer) / base.denom);\n}\n\nvoid CiOSPlatform::detailedLogging(const char *basefile, const char *functionName, int lineNo, const char *format, ...) {\n#ifdef DEBUG\n#ifndef DEBUG_PRINT_OFF\n\tNSString *nsformat = [NSString stringWithUTF8String:format];\n    \n\t// format済み文字列を生成\n\tva_list ap;\n\tva_start(ap, format);\n\tif (![nsformat hasSuffix:@\"\\n\"]) {\n\t\tnsformat = [nsformat stringByAppendingString:@\"\\n\"];\n\t}\n\tNSString *body = [[NSString alloc] initWithFormat:nsformat arguments:ap];\n\tNSLog(@\"%s\", [body UTF8String]);\n\t[body release];\n\tva_end(ap);\n    \n#endif // #ifndef DEBUG_PRINT_ON\n#endif // #ifdef DEBUG\n}\n\nvoid CiOSPlatform::logging(const char *format, ...) {\n#ifdef DEBUG\n#ifndef DEBUG_PRINT_OFF\n\tNSString *nsformat = [NSString stringWithUTF8String:format];\n    \n\t// format済み文字列を生成\n\tva_list ap;\n\tva_start(ap, format);\n\tif (![nsformat hasSuffix:@\"\\n\"]) {\n\t\tnsformat = [nsformat stringByAppendingString:@\"\\n\"];\n\t}\n\tNSString *body = [[NSString alloc] initWithFormat:nsformat arguments:ap];\n\tNSLog(@\"%s\", [body UTF8String]);\n\t[body release];\n\tva_end(ap);\n    \n#endif // #ifndef DEBUG_PRINT_ON\n#endif // #ifdef DEBUG\n}\n\nconst char *CiOSPlatform::getBundleVersion() {\n\treturn [[[NSBundle mainBundle] objectForInfoDictionaryKey:@\"CFBundleVersion\"] cStringUsingEncoding:NSUTF8StringEncoding];\n}\n\nITmpFile *CiOSPlatform::openTmpFile(const char *tmpPath) {\n\tconst char *target = \"file://external/\";\n\tint len = strlen(target);\n\tif (!strncmp(tmpPath, target, len)) {\n\t\t// 平成24年11月27日(火)\n\t\t// CiOSTmpFileのファイルパスの解決の仕方が'file://'を抜いた状態で解釈するため、\n\t\t// CiOSTmpFileへ渡すファイルパスのprefixを'file://'分進めて渡しています。\n\t\ttmpPath = tmpPath + 7;\n\t\tCiOSTmpFile *pTmpFile = new CiOSTmpFile(tmpPath);\n\t\tif (!pTmpFile->isReady()) {\n\t\t\tdelete pTmpFile;\n\t\t\tpTmpFile = 0;\n\t\t}\n\t\treturn pTmpFile;\n\t}\n\treturn 0;\n}\n\n#include \"FileDelete.h\"\n\nconst char *getFullNativePath(const char *path) {\n\treturn CiOSPathConv::getInstance().fullpath(path + 7);\n}\n\nbool CiOSPlatform::removeFileOrFolder(const char *filePath) {\n\tconst char *target = \"file://external/\";\n\tint len = strlen(target);\n\tif (!strncmp(filePath, target, len)) {\n\t\treturn deleteFiles(filePath);\n\t}\n\telse {\n\t\treturn false;\n\t}\n}\n\nvoid removeTmpFileNative(const char *filePath) {\n\tremove(filePath);\n}\n\nvoid CiOSPlatform::removeTmpFile(const char *tmpPath) {\n\tconst char *target = \"file://external/\";\n\tint len = strlen(target);\n\tif (!strncmp(tmpPath, target, len)) {\n\t\tconst char *fullpath = CiOSPathConv::getInstance().fullpath(tmpPath + 7);\n\t\tunlink(fullpath);\n\t\tdelete[] fullpath;\n\t}\n}\n\nu32 CiOSPlatform::getFreeSpaceExternalKB() {\n\tstruct statfs diskInfo;\n\tint ret = statfs(CiOSPathConv::getInstance().fullpath(\"external/\"), &diskInfo);\n\tif (ret != 0) {\n\t\t// return 0 for safety in case of fetch error just the same as Android version\n\t\treturn 0;\n\t}\n\t// calculate free space in KB available to non-superusers\n\tunsigned long long freeKB = (diskInfo.f_bavail * diskInfo.f_bsize) >> 10;\n\tif (freeKB & ~0xFFFFFF) {\n\t\treturn 0xFFFFFF;\n\t}\n\treturn (u32)freeKB;\n}\n\nu32 CiOSPlatform::getPhysicalMemKB() {\n\t//\n\t// IOS Physical Memory\n\t//\n\tsize_t length;\n\tint mib[6];\n\tint result;\n    \n\tmib[0] = CTL_HW;\n\tmib[1] = HW_PHYSMEM;\n\tlength = sizeof(result);\n\tif (sysctl(mib, 2, &result, &length, NULL, 0) < 0) {\n\t\t// If reading fails, return 0\n\t\tresult = 0;\n\t}\n\telse {\n\t\tresult >>= 10;\n\t}\n\treturn (u32)result;\n}\n\nvoid CiOSPlatform::excludePathFromBackup(const char *fullpath) {\n}\n\nIReadStream *CiOSPlatform::openReadStream(const char *pathname, bool decrypt) {\n\t// ファイル名の scheme で、どのファイルを開くべきかが決まる。\n\tif (!strncmp(pathname, \"file://\", 7)) {\n\t\t// ファクトリには scheme を除いたパスが渡される。\n\t\tCiOSReadFileStream *pRds = CiOSReadFileStream::openStream(pathname + 7, 0);\n\t\tif (decrypt) {\n\t\t\tpRds->decryptSetup((const u8 *)pathname + 7);\n\t\t}\n\t\treturn pRds;\n\t}\n\t// scheme が asset であれば、作るのは CiOSReadFileStream だが、EXTERN -> INSTALL の順で検索する。\n\tif (!strncmp(pathname, \"asset://\", 8)) {\n\t\tCiOSReadFileStream *pRds = CiOSReadFileStream::openAssets(pathname, 0);\n\t\tif (decrypt) {\n\t\t\tpRds->decryptSetup((const u8 *)pathname + 8);\n\t\t}\n\t\treturn pRds;\n\t}\n    \n\tif (!strncmp(pathname, \"socket://\", 9)) {\n\t\tCSockReadStream *pRds = CSockReadStream::openStream(pathname + 9);\n\t\treturn pRds;\n\t}\n\tif (!strncmp(pathname, \"http:\", 5)) {\n\t\treturn 0;\n\t}\n\tif (!strncmp(pathname, \"https:\", 6)) {\n\t\treturn 0;\n\t}\n\treturn 0;\n}\n\nvoid *CiOSPlatform::loadAudio(const char *url, bool is_se) {\n\treturn CiOSAudioManager::GetInstance().CreateAudioHandle(url, this);\n}\n\nbool CiOSPlatform::preLoad(void *handle) {\n\tif (!handle) return false;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\treturn audio->loadMem();\n}\n\nbool CiOSPlatform::setBufSize(void *handle, int level) {\n\tif (!handle) return false;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\treturn audio->setBufSize(level);\n}\n\nvoid CiOSPlatform::playAudio(void *handle, s32 _msec, float _tgtVol, float _startVol) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->play(_msec, _tgtVol, _startVol);\n}\n\nvoid CiOSPlatform::stopAudio(void *handle, s32 _msec, float _tgtVol) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->stop(_msec, _tgtVol);\n}\n\nvoid CiOSPlatform::setMasterVolume(float volume, bool SEmode) {\n\tif (SEmode) {\n\t\tCiOSAudioManager::GetInstance().SetSEMasterVolume(volume);\n\t}\n\telse {\n\t\tCiOSAudioManager::GetInstance().SetBGMMasterVolume(volume);\n\t}\n\tCiOSAudioManager::GetInstance().UpdateVolume();\n}\n\nvoid CiOSPlatform::setAudioVolume(void *handle, float volume) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->setVolume(volume);\n}\n\nvoid CiOSPlatform::setAudioPan(void *handle, float pan) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->setPan(pan);\n}\n\nvoid CiOSPlatform::releaseAudio(void *handle) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->closeAudio();\n}\n\nvoid CiOSPlatform::pauseAudio(void *handle, s32 _msec, float _tgtVol) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->pause(_msec, _tgtVol);\n\taudio->setLuaPause(true);\n}\n\nvoid CiOSPlatform::resumeAudio(void *handle, s32 _msec, float _tgtVol) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->resume(_msec, _tgtVol);\n\taudio->setLuaPause(false);\n}\n\nvoid CiOSPlatform::seekAudio(void *handle, s32 millisec) {\n\tif (!handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\taudio->seek(millisec);\n}\n\ns32 CiOSPlatform::tellAudio(void *handle) {\n\tif (!handle) return 0;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\treturn audio->tell();\n}\n\ns32 CiOSPlatform::totalTimeAudio(void *handle) {\n\tif (!handle) return 0;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\treturn audio->totalPlayTime();\n}\n\nvoid CiOSPlatform::setFadeParam(void *_handle, float _tgtVol, u32 _msec) {\n\tif (!_handle) return;\n\tCiOSAudio *audio = (CiOSAudio *)_handle;\n\taudio->setFadeParam(_tgtVol, _msec);\n}\n\ns32 CiOSPlatform::getState(void *handle) {\n\tif (!handle) return 0;\n\tCiOSAudio *audio = (CiOSAudio *)handle;\n\treturn audio->getState();\n}\n\n//! サウンドとミュージックの並行処理タイプ設定\nvoid CiOSPlatform::setAudioMultiProcessType(s32 _processType) {\n\tswitch (_processType) {\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT:\n\t\t\tCiOSAudioManager::GetInstance().SetAudioMultiProcessType(_processType);\n\t\t\tbreak;\n\t}\n}\n\n/*!\n @brief  サウンドの割り込み処理をエンジン側で制御するかどうか\n @param[in]  bool _bPauseOnInterruption\n @return     void\n */\nvoid CiOSPlatform::setPauseOnInterruption(bool _bPauseOnInterruption) {\n\tCiOSAudioManager::GetInstance().setPauseOnInterruption(_bPauseOnInterruption);\n}\n\n/*!\n @brief  経過時間を取得(sec)\n @param[in]  void\n @return     s64     経過時間(sec)\n */\ns64 CiOSPlatform::getElapsedTime(void) {\n\tstruct timeval boottime;\n    \n\tint mib[2] = { CTL_KERN, KERN_BOOTTIME };\n\tsize_t size = sizeof(boottime);\n\ttime_t now;\n\ttime_t uptime = 0;\n\t(void)time(&now);\n    \n\tif ((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1) && (boottime.tv_sec != 0)) {\n\t\tuptime = now - boottime.tv_sec;\n\t}\n\treturn uptime;\n}\n\nbool CiOSPlatform::registerFont(const char *logicalName, const char *physFile, bool default_) {\n\treturn true;\n}\n\nvoid *CiOSPlatform::getFont(int size, const char *fontName, float *pAscent) {\n\tFontObject *pFont = NULL;\n\treturn pFont;\n}\n\nvoid *CiOSPlatform::getFontSystem(int size, const char *fontName) {\n\treturn NULL;\n}\n\nvoid CiOSPlatform::deleteFont(void *pFont) {\n}\n\nvoid CiOSPlatform::deleteFontSystem(void *pFont) {\n\tCiOSFont *p_pFont = (CiOSFont *)pFont;\n\tdelete p_pFont;\n}\n\nbool CiOSPlatform::renderText(const char *utf8String, void *pFont, u32 color,\n                              u16 width, u16 height, u8 *pBuffer8888,\n                              s16 stride, s16 base_x, s16 base_y, bool use4444) {\n\tFontObject *pObjFont = (FontObject *)pFont;\n\tif (pObjFont) {\n\t\tpObjFont->renderText(base_x, base_y, utf8String, pBuffer8888, color, width, height, stride, use4444);\n\t}\n\treturn true;\n}\n\nbool CiOSPlatform::getTextInfo(const char *utf8String, void *pFont, STextInfo *pReturnInfo) {\n\treturn true;\n}\n\nvoid *CiOSPlatform::getGLExtension(const char *ext) {\n\treturn 0;\n}\n\nconst char *CiOSPlatform::getFullPath(const char *assetPath, bool *isReadOnly) {\n\tCiOSPathConv& pathconv = CiOSPathConv::getInstance();\n    \n\t// ファイル名の scheme で、どのファイルを開くべきかが決まる。\n\tif (!strncmp(assetPath, \"file://\", 7)) {\n\t\treturn pathconv.fullpath(assetPath + 7, 0, isReadOnly);\n\t}\n\t// scheme が asset であれば、作るのは CiOSReadFileStream だが、EXTERN -> INSTALL の順で検索する。\n\tif (!strncmp(assetPath, \"asset://\", 8)) {\n\t\treturn pathconv.fullpath(assetPath, 0, isReadOnly);\n\t}\n\treturn 0;\n}\n\nconst char *CiOSPlatform::getPlatform() {\n\treturn (const char *)m_platform;\n}\n\n//! OSコントロールの生成と破棄\nIWidget *CiOSPlatform::createControl(IWidget::CONTROL type, int id, const char *caption,\n                                     int x, int y, int width, int height, ...) {\n\tIWidget *pRetWidget = 0;\n\tva_list ap;\n\tva_start(ap, height);\n\tswitch (type) {\n\t\tcase IWidget::TEXTBOX:\n\t\tcase IWidget::PASSWDBOX:\n\t\t{\n\t\t\tpRetWidget = NULL;\n\t\t\tbreak;\n\t\t}\n            \n\t\tcase IWidget::WEBVIEW:\n\t\tcase IWidget::WEBNOJUMP:\n\t\t{\n\t\t\tpRetWidget = NULL;\n\t\t\tbreak;\n\t\t}\n            \n\t\tcase IWidget::MOVIEPLAYER:\n\t\t{\n\t\t\tpRetWidget = NULL;\n\t\t\tbreak;\n\t\t}\n            \n\t\tcase IWidget::BGMOVIEPLAYER:\n\t\t{\n\t\t\tpRetWidget = NULL;\n\t\t\tbreak;\n\t\t}\n            \n\t\tcase IWidget::ACTIVITYINDICATOR:\n\t\t{\n\t\t\tpRetWidget = NULL;\n\t\t\tbreak;\n\t\t}\n            \n\t\tdefault:\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tva_end(ap);\n\treturn pRetWidget;\n}\n\nvoid CiOSPlatform::destroyControl(IWidget *pWidget) {\n\tdelete pWidget;\n}\n\nbool CiOSPlatform::callApplication(IPlatformRequest::APP_TYPE type, ...) {\n\tbool result = true;\n\tva_list ap;\n\tva_start(ap, type);\n    \n\tswitch (type) {\n\t\tcase IPlatformRequest::APP_MAIL:\n\t\t{\n\t\t\t//UTF8に変換しないと日本語で化ける 2013-3-5 inada-s\n\t\t\tNSString *addr    = [NSString stringWithCString:va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\n\t\t\tNSString *subject = [NSString stringWithCString:va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\n\t\t\tNSString *body    = [NSString stringWithCString:va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\n            \n\t\t\tNSString *url = [[NSString alloc]initWithFormat:@\"mailto:%@?subject=%@&body=%@\", addr, subject, body];\n\t\t\turl = [[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]stringByReplacingOccurrencesOfString:@\"+\" withString:@\"%2B%\"];\n\t\t}\n            break;\n            \n\t\tcase IPlatformRequest::APP_BROWSER:\n\t\t{\n\t\t\tNSString *urlString = [NSString stringWithCString:va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\n\t\t\tNSURL *url = [NSURL URLWithString:urlString];\n\t\t}\n            break;\n            \n\t\tcase IPlatformRequest::APP_UPDATE:\n\t\t{\n\t\t\tconst char *search_key = va_arg(ap, const char *);\n\t\t\tNSString *url_str = [NSString stringWithFormat:@\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=%s&mt=8\", search_key];\n\t\t\tNSURL *url = [NSURL URLWithString:url_str];\n\t\t}\n            break;\n            \n\t\tdefault:\n\t\t\tresult = false;\n\t\t\tbreak;\n\t}\n\tva_end(ap);\n\treturn result;\n}\n\nvoid *CiOSPlatform::ThreadProc(void *data) {\n\tPF_THREAD *pThread = (PF_THREAD *)data;\n\tif (!(pThread->result = setjmp(pThread->jmp))) {\n\t\tpThread->result = (pThread->thread_func)(pThread, pThread->data);\n\t}\n\treturn 0;\n}\n\nvoid *CiOSPlatform::createThread(s32 (*thread_func)(void *, void *), void *data) {\n\tPF_THREAD *thread = new PF_THREAD;\n\tif (!thread) return 0;\n\tthread->data = data;\n\tthread->thread_func = thread_func;\n\tthread->result = 0;\n\tpthread_create(&(thread->id), 0, ThreadProc, thread);\n\treturn thread;\n}\n\nvoid CiOSPlatform::exitThread(void *hThread, s32 status) {\n\tPF_THREAD *pThread = (PF_THREAD *)hThread;\n\tlongjmp(pThread->jmp, status);\n}\n\nbool CiOSPlatform::watchThread(void *hThread, s32 *status) {\n\tPF_THREAD *pThread = (PF_THREAD *)hThread;\n\tif (pthread_kill(pThread->id, 0) != ESRCH) {\n\t\t// スレッドが終了していない\n\t\treturn true;\n\t}\n\t// スレッドは終了しているので、終了コードを *status に返す\n\t*status = pThread->result;\n\treturn false;   // 終了している\n}\n\nvoid CiOSPlatform::deleteThread(void *hThread) {\n\tPF_THREAD *pThread = (PF_THREAD *)hThread;\n\tpthread_join(pThread->id, 0);\n\tdelete pThread;\n}\n\nvoid CiOSPlatform::breakThread(void *hThread) {\n\tPF_THREAD *pThread = (PF_THREAD *)hThread;\n\tpthread_kill(pThread->id, SIGKILL);\n}\n\nint CiOSPlatform::genUserID(char *retBuf, int maxlen) {\n\tNSString *uuidString = nil;\n\tCFUUIDRef uuid = CFUUIDCreate(0);\n\tif (uuid) {\n\t\tuuidString = (NSString *)CFUUIDCreateString(0, uuid);\n\t\tCFRelease(uuid);\n\t}\n\tconst char *cstrUUID = [uuidString UTF8String];\n\tint i;\n\tfor (i = 0; i < maxlen - 1 && cstrUUID[i]; i++) {\n\t\tretBuf[i] = cstrUUID[i];\n\t}\n\tretBuf[i] = 0;\n\tif (uuidString) [uuidString release];   // 2012.12.12 解放処理追加\n\treturn i;\n}\n\nint CiOSPlatform::genUserPW(const char *salt, char *retbuf, int maxlen) {\n\tchar buf[1024];\n\ttime_t tm;\n\tint rnd = rand();\n\ttime(&tm);\n    \n\tsprintf(buf, \"%d.%ld.%s\", rnd, tm, salt);\n\treturn sha512(buf, retbuf, maxlen);\n}\n\nbool CiOSPlatform::readyDevID() {\n\tCiOSSysResource& sysRes = CiOSSysResource::getInstance();\n\treturn sysRes.isReceived();\n}\n\nint CiOSPlatform::getDevID(char *retBuf, int maxlen) {\n\tCiOSSysResource& sysRes = CiOSSysResource::getInstance();\n\tif (sysRes.isReceived() && sysRes.isSucceed()) {\n\t\treturn sysRes.getDevID(retBuf, maxlen);\n\t}\n\treturn 0;\n}\n\nbool CiOSPlatform::setKeyChain(const char *service_name, const char *key, const char *value) {\n\tbool result = true;\n\tint len = strlen(value);\n\tNSString *service = [NSString stringWithUTF8String:service_name];\n\tNSString *nskey = [NSString stringWithUTF8String:key];\n    \n\tNSMutableDictionary *attributes = nil;\n\tNSMutableDictionary *query = [NSMutableDictionary dictionary];\n\tNSData *valueData = [NSData dataWithBytes:value length:len];\n    \n\t[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\n\t[query setObject:(id)nskey forKey:(id)kSecAttrAccount];\n\t[query setObject:service forKey:(id)kSecAttrService];\n    \n\tOSStatus err = SecItemCopyMatching((CFDictionaryRef)query, 0);\n\tif (err == noErr) {\n\t\t// update Item\n\t\tattributes = [NSMutableDictionary dictionary];\n\t\t[attributes setObject:valueData forKey:(id)kSecValueData];\n\t\t[attributes setObject:[NSDate date] forKey:(id)kSecAttrModificationDate];\n\t\terr = SecItemUpdate((CFDictionaryRef)query, (CFDictionaryRef)attributes);\n\t\tif (err != noErr) {\n\t\t\tresult = false;\n\t\t}\n\t}\n\telse if (err == errSecItemNotFound) {\n\t\t// new Item\n\t\tattributes = [NSMutableDictionary dictionary];\n\t\t[attributes setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\n\t\t[attributes setObject:(id)nskey forKey:(id)kSecAttrAccount];\n\t\t[attributes setObject:service forKey:(id)kSecAttrService];\n\t\t[attributes setObject:valueData forKey:(id)kSecValueData];\n        \n\t\terr = SecItemAdd((CFDictionaryRef)attributes, 0);\n\t\tif (err != noErr) {\n\t\t\tresult = false;\n\t\t}\n\t}\n\telse {\n\t\tresult = false;\n\t}\n\treturn result;\n}\n\nint CiOSPlatform::getKeyChain(const char *service_name, const char *key, char *retBuf, int maxlen) {\n\tNSString *service = [NSString stringWithUTF8String:service_name];\n\tNSString *nskey = [NSString stringWithUTF8String:key];\n    \n\tNSMutableDictionary *query = [NSMutableDictionary dictionary];\n    \n\t[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\n\t[query setObject:(id)nskey forKey:(id)kSecAttrAccount];\n\t[query setObject:service forKey:(id)kSecAttrService];\n\t[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];\n    \n\tNSData *valueData = nil;\n\tOSStatus err = SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&valueData);\n\tint i = 0;\n\tif (err == noErr) {\n\t\tNSString *ns_value = [[[NSString alloc] initWithData:valueData encoding:NSUTF8StringEncoding] autorelease];\n\t\tconst char *value = [ns_value UTF8String];\n\t\tfor (i = 0; i < maxlen - 1 && value[i]; i++) retBuf[i] = value[i];\n\t\tretBuf[i] = 0;\n\t}\n    \n\t// 2012.12.11 解放追加\n\tif (valueData) [valueData release];\n    \n\treturn i;\n}\n\nbool CiOSPlatform::delKeyChain(const char *service_name, const char *key) {\n\tbool result = true;\n\tNSString *service = [NSString stringWithUTF8String:service_name];\n\tNSString *nskey = [NSString stringWithUTF8String:key];\n    \n\tNSMutableDictionary *attributes = nil;\n\tNSMutableDictionary *query = [NSMutableDictionary dictionary];\n    \n\t[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\n\t[query setObject:(id)nskey forKey:(id)kSecAttrAccount];\n\t[query setObject:service forKey:(id)kSecAttrService];\n    \n\tOSStatus err = SecItemCopyMatching((CFDictionaryRef)query, 0);\n\tif (err == noErr) {\n\t\t// update Item\n\t\tattributes = [NSMutableDictionary dictionary];\n\t\t[attributes setObject:[NSDate date] forKey:(id)kSecAttrModificationDate];\n\t\terr = SecItemDelete((CFDictionaryRef)query);\n\t\tif (err != noErr) {\n\t\t\tresult = false;\n\t\t}\n\t}\n\treturn result;\n}\n\nbool CiOSPlatform::setSecureDataID(const char *service_name, const char *user_id) {\n\treturn setKeyChain(service_name, \"user_id\", user_id);\n}\n\nbool CiOSPlatform::setSecureDataPW(const char *service_name, const char *passwd) {\n\treturn setKeyChain(service_name, \"passwd\", passwd);\n}\n\nint CiOSPlatform::getSecureDataID(const char *service_name, char *retBuf, int maxlen) {\n\treturn getKeyChain(service_name, \"user_id\", retBuf, maxlen);\n}\n\nint CiOSPlatform::getSecureDataPW(const char *service_name, char *retBuf, int maxlen) {\n\treturn getKeyChain(service_name, \"passwd\", retBuf, maxlen);\n}\n\nbool CiOSPlatform::delSecureDataID(const char *service_name) {\n\treturn delKeyChain(service_name, \"user_id\");\n}\n\nbool CiOSPlatform::delSecureDataPW(const char *service_name) {\n\treturn delKeyChain(service_name, \"passwd\");\n}\n\nint CiOSPlatform::sha512(const char *string, char *buf, int maxlen) {\n\tint len = strlen(string);\n\tNSData *data = [NSData dataWithBytes:string length:len];\n\tuint8_t digest[CC_SHA512_DIGEST_LENGTH];\n\tCC_SHA512(data.bytes, data.length, digest);\n\tNSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA512_DIGEST_LENGTH * 2];\n\tfor (int i = 0; i < CC_SHA512_DIGEST_LENGTH; i++) {\n\t\t[output appendFormat:@\"%02x\", digest[i]];\n\t}\n    \n\tconst char *passwd = [output UTF8String];\n\tint i;\n\tfor (i = 0; i < maxlen - 1 && passwd[i]; i++) {\n\t\tbuf[i] = passwd[i];\n\t}\n\tbuf[i] = 0;\n\treturn i;\n}\n\nvoid CiOSPlatform::initStoreTransactionObserver(void) {\n}\n\nvoid CiOSPlatform::releaseStoreTransactionObserver(void) {\n}\n\nvoid CiOSPlatform::buyStoreItems(const char *item_id) {\n}\n\nvoid CiOSPlatform::finishStoreTransaction(const char *receipt) {\n}\n\nvoid CiOSPlatform::getStoreProducts(const char *json, bool currency_mode) {\n}\n\nfloat CiOSPlatform::getMasterVolume(bool SEmode) const {\n\tif (SEmode) {\n\t\treturn CiOSAudioManager::GetInstance().GetSEMasterVolume();\n\t}\n\telse {\n\t\treturn CiOSAudioManager::GetInstance().GetBGMMasterVolume();\n\t}\n\treturn 1.0f;\n}\n\nvoid *CiOSPlatform::allocMutex() {\n\tpthread_mutex_t *pSection = new pthread_mutex_t();\n\tif (pSection) {\n\t\tif (pthread_mutex_init(pSection, NULL)) {\n\t\t\tdelete pSection;\n\t\t\treturn NULL;\n\t\t}\n\t}\n\treturn pSection;\n}\n\nvoid CiOSPlatform::freeMutex(void *mutex) {\n\tif (mutex) {\n\t\tpthread_mutex_t *pSection = (pthread_mutex_t *)mutex;\n\t\tpthread_mutex_destroy(pSection); // Error handling useless here.\n\t\tdelete pSection;\n\t}\n}\n\nvoid CiOSPlatform::mutexLock(void *mutex) {\n\tif (mutex) {\n\t\tpthread_mutex_t *pSection = (pthread_mutex_t *)mutex;\n\t\tpthread_mutex_lock(pSection);\n\t}\n}\n\nvoid CiOSPlatform::mutexUnlock(void *mutex) {\n\tif (mutex) {\n\t\tpthread_mutex_t *pSection = (pthread_mutex_t *)mutex;\n\t\tpthread_mutex_unlock(pSection);\n\t}\n}\n\nstruct EventMutex {\n\tpthread_mutex_t mutex;\n\tpthread_cond_t cond;\n};\n\nvoid *CiOSPlatform::allocEventLock() {\n\tEventMutex *pEvent = new EventMutex();\n\tif (pEvent) {\n\t\tbool err = false;\n\t\tif (pthread_mutex_init(&pEvent->mutex, NULL) == 0) {\n\t\t\tif (pthread_cond_init(&pEvent->cond, NULL) == 0) {\n\t\t\t\t// Do nothing.\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpthread_mutex_destroy(&pEvent->mutex);\n\t\t\t\terr = true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\terr = true;\n\t\t}\n        \n\t\tif (err) {\n\t\t\tdelete pEvent;\n\t\t\tpEvent = NULL;\n\t\t}\n\t}\n\treturn pEvent;\n}\n\nvoid CiOSPlatform::freeEventLock(void *lock) {\n\tEventMutex *pEvent = (EventMutex *)lock;\n\tif (pEvent) {\n\t\tpthread_mutex_destroy(&pEvent->mutex);\n\t\tpthread_cond_destroy(&pEvent->cond);\n\t}\n}\n\nvoid CiOSPlatform::eventSleep(void *lock) {\n\tEventMutex *pEvent = (EventMutex *)lock;\n\tif (pEvent) {\n\t\t// Own mutex [Lock]\n\t\tpthread_mutex_lock(&pEvent->mutex);\n\t\t// [Unlock] and go to [Sleep], atomically.\n\t\tpthread_cond_wait(&pEvent->cond, &pEvent->mutex);\n\t\t// [Lock] on wake up.\n        \n\t\t// [Unlock] again.\n\t\tpthread_mutex_unlock(&pEvent->mutex);\n\t}\n}\n\nvoid CiOSPlatform::eventWakeup(void *lock) {\n\tEventMutex *pEvent = (EventMutex *)lock;\n\tif (pEvent) {\n\t\t// Own mutex [Lock]\n\t\tpthread_mutex_lock(&pEvent->mutex);\n        \n\t\tpthread_cond_broadcast(&pEvent->cond);\n        \n\t\t// [Unlock] again.\n\t\tpthread_mutex_unlock(&pEvent->mutex);\n\t}\n}\n\nvoid CiOSPlatform::forbidSleep(bool is_forbidden) {\n}\n\nvoid *CiOSPlatform::ifopen(const char *name, const char *mode) {\n\treturn fopen(name, mode);\n}\n\nvoid CiOSPlatform::ifclose(void *file) {\n\tif (file) {\n\t\tfclose((FILE *)file);\n\t}\n}\n\nint CiOSPlatform::ifseek(void *file, long int offset, int origin) {\n\treturn fseek((FILE *)file, offset, origin);\n}\n\nu32 CiOSPlatform::ifread(void *ptr, u32 size, u32 count, void *file) {\n\treturn fread(ptr, size, count, (FILE *)file);\n}\n\nu32 CiOSPlatform::ifwrite(const void *ptr, u32 size, u32 count, void *file) {\n\treturn fwrite(ptr, size, count, (FILE *)file);\n}\n\nint CiOSPlatform::ifflush(void *file) {\n\treturn fflush((FILE *)file);\n}\n\nlong int CiOSPlatform::iftell(void *file) {\n\treturn ftell((FILE *)file);\n}\n\nbool CiOSPlatform::icreateEmptyFile(const char *name) {\n\tFILE *f = fopen(name, \"a\");\n\tif (f) {\n\t\tfclose(f);\n\t\treturn true;\n\t}\n\treturn false;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSReadFileStream.cpp",
    "content": "#include <errno.h>\n#include <fcntl.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <unistd.h>\n#include <iostream>\n\n#include \"CPFInterface.h\"\n#include \"iOSFileLocation.h\"\n#include \"CiOSPathConv.h\"\n#include \"CiOSReadFileStream.h\"\n#include \"CiOSWriteFileStream.h\"\n\n#ifdef DEBUG_MEMORY\nCiOSReadFileStream *CiOSReadFileStream::ms_pBegin = 0;\nCiOSReadFileStream *CiOSReadFileStream::ms_pEnd;\n#endif\n\n// 論理トップレベルディレクトリと、物理ディレクトリパスの対応を行うテーブル。\nconst CiOSReadFileStream::LOCLIST CiOSReadFileStream::m_toplevel[3] = {\n\t{ \"external/\",  1, false },   // インストール後、更新の対象となる可変ファイル\n\t{ \"install/\",   0, true },   // インストール時に配置される固定ファイル\n\t{ 0, 0 }\n};\n\nCiOSReadFileStream::CiOSReadFileStream()\n: m_bReadOnly(true)\n, m_fd(-1)\n, m_fp(0)\n, m_eStat(CLOSED)\n, m_fullpath(0)\n, m_writeStream(0)\n, m_decrypter()\n#ifdef DEBUG_MEMORY\n, m_pPrev(0), m_pNext(0)\n#endif\n{\n#ifdef DEBUG_MEMORY\n\tm_pPrev = ms_pEnd;\n\tif (ms_pEnd) ms_pEnd->m_pNext = this;\n\tms_pEnd = this;\n\tif (!ms_pBegin) ms_pBegin = this;\n#endif\n}\n\nCiOSReadFileStream::~CiOSReadFileStream() {\n\tif (m_fp) fclose(m_fp);\n\tif (m_fd > 0) close(m_fd);\n\tm_fd = -1;\n\tm_eStat = CLOSED;\n    \n\tdelete[] m_fullpath;\n#ifdef DEBUG_MEMORY\n\tif (m_pPrev) {\n\t\tm_pPrev->m_pNext = m_pNext;\n\t}\n\telse {\n\t\tms_pBegin = m_pNext;\n\t}\n\tif (m_pNext) {\n\t\tm_pNext->m_pPrev = m_pPrev;\n\t}\n\telse {\n\t\tms_pEnd = m_pPrev;\n\t}\n#endif\n}\n\nCiOSReadFileStream *CiOSReadFileStream::openStream(const char *path, const char *home) {\n\tCiOSReadFileStream *pStream = 0;\n\ttry {\n\t\tpStream = new CiOSReadFileStream();\n\t\tif (!pStream) {\n\t\t\treturn 0;\n\t\t}\n        \n\t\tpStream->m_fullpath = 0;\n        \n\t\tCiOSPathConv& pathconv = CiOSPathConv::getInstance();\n\t\tpStream->m_fullpath = pathconv.fullpath(path);\n        \n\t\tif (!pStream->m_fullpath) {\n\t\t\t// ファイルセグメントが指定されていない\n\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\treturn pStream;\n\t\t}\n        \n\t\t// 物理パスができたので、ファイルをオープンする。\n\t\tpStream->m_fd = open(pStream->m_fullpath, O_RDONLY);\n\t\tif (pStream->m_fd < 0) {\n\t\t\t// オープンに失敗\n\t\t\tpStream->m_eStat = NOT_FOUND;\n#ifdef DEBUG_MEMORY\n\t\t\tCPFInterface& pfif = CPFInterface::getInstance();\n\t\t\tCiOSReadFileStream *p = ms_pBegin;\n\t\t\twhile (p) {\n\t\t\t\tpfif.platform().logging(\"not closed stream: %s\", p->m_fullpath);\n\t\t\t\tp = p->m_pNext;\n\t\t\t}\n\t\t\tpfif.platform().logging(\"errno = %d\", errno);\n#endif\n            //          klb_assertAlways(\"could not open.\");\n\t\t\treturn pStream;\n\t\t}\n\t\t// fopen 系関数を使うために fdopen で m_fp も作っておく\n\t\tpStream->m_fp = fdopen(pStream->m_fd, \"rb\");\n\t\tif (!pStream->m_fp) {\n\t\t\tclose(pStream->m_fd);\n\t\t\tpStream->m_fd = -1;\n\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\treturn pStream;\n\t\t}\n        \n\t\t// オープンに成功したので正常終了ステータスにする。\n\t\tpStream->m_eStat = NORMAL;\n\t\treturn pStream;\n\t}\n\tcatch (std::bad_alloc& ex)\n\t{\n\t\tdelete pStream;\n\t\treturn 0;\n\t}\n}\n\nCiOSReadFileStream *CiOSReadFileStream::openAssets(const char *path, const char *home) {\n\treturn openStream(path, home);\n#if 0\n\tCiOSReadFileStream *pStream = 0;\n\ttry {\n\t\tpStream = new CiOSReadFileStream();\n\t\tif (!pStream) {\n\t\t\treturn 0;\n\t\t}\n\t\tpStream->m_fullpath = 0;\n        \n\t\tCiOSPathConv& pathconv = CiOSPathConv::getInstance();\n\t\tpStream->m_fullpath = pathconv.fullpath(path);\n        \n\t\tif (!pStream->m_fullpath) {\n\t\t\t// ファイルが見つからなかった\n\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\treturn pStream;\n\t\t}\n\t\t// 物理パスができたので、ファイルをオープンする。\n\t\tpStream->m_fd = open(pStream->m_fullpath, O_RDONLY);\n\t\tif (pStream->m_fd < 0) {\n\t\t\t// オープンに失敗\n\t\t\tpStream->m_eStat = NOT_FOUND;\n#ifdef DEBUG_MEMORY\n\t\t\tCPFInterface& pfif = CPFInterface::getInstance();\n\t\t\tCiOSReadFileStream *p = ms_pBegin;\n\t\t\twhile (p) {\n\t\t\t\tpfif.platform().logging(\"not closed stream: %s\", p->m_fullpath);\n\t\t\t\tp = p->m_pNext;\n\t\t\t}\n\t\t\tpfif.platform().logging(\"errno = %d\", errno);\n#endif\n\t\t\treturn pStream;\n\t\t}\n        \n\t\t// fopen 系関数を使うために fdopen で m_fp も作っておく\n\t\tpStream->m_fp = fdopen(pStream->m_fd, \"rb\");\n\t\tif (!pStream->m_fp) {\n\t\t\tclose(pStream->m_fd);\n\t\t\tpStream->m_fd = -1;\n\t\t\tpStream->m_eStat = NOT_FOUND;\n\t\t\treturn pStream;\n\t\t}\n        \n\t\t// オープンに成功したので正常終了ステータスにする。\n\t\tpStream->m_decrypter.decryptSetup((const u8 *)pStream->m_fullpath);\n\t\tpStream->m_eStat = NORMAL;\n\t\treturn pStream;\n\t}\n\tcatch (std::bad_alloc& ex)\n\t{\n\t\tdelete pStream;\n\t\treturn 0;\n\t}\n#endif\n}\n\ns32 CiOSReadFileStream::getSize() {\n\tstruct stat file_stats;\n\tif (fstat(m_fd, &file_stats) < 0) {\n\t\treturn -1;\n\t}\n    \n\treturn file_stats.st_size - (m_decrypter.m_useNew ? 4 : 0);\n}\n\ns32 CiOSReadFileStream::getPosition() {\n\treturn (s32)(ftell(m_fp) - (m_decrypter.m_useNew ? 4 : 0));\n}\n\nu8 CiOSReadFileStream::readU8() {\n\t// とりあえず動かすため、fgetc() で実装する。\n\tu8 val = fgetc(m_fp);\n\tm_decrypter.decryptBlck(&val, 1);\n\treturn (u8)val;\n}\n\nu16 CiOSReadFileStream::readU16() {\n\tu8 buf[2];\n\tif (1 == fread(buf, 2, 1, m_fp)) {\n\t\tm_decrypter.decryptBlck(buf, 2);\n\t\tu16 ret = ((u16)buf[0] << 8) | (u16)buf[1];\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nu32 CiOSReadFileStream::readU32() {\n\tu8 buf[4];\n\tif (1 == fread(buf, 4, 1, m_fp)) {\n\t\tm_decrypter.decryptBlck(buf, 4);\n\t\tu32 ret = ((u32)buf[0] << 24) | ((u16)buf[1] << 16) | ((u16)buf[2] << 8) | (u16)buf[3];\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nfloat CiOSReadFileStream::readFloat() {\n\tfloat f;\n\tif (1 == fread(&f, sizeof(float), 1, m_fp)) {\n\t\tm_decrypter.decryptBlck(&f, sizeof(float));\n\t\treturn f;\n\t}\n\treturn 0.0f;\n}\n\nbool CiOSReadFileStream::readBlock(void *buffer, u32 byteSize) {\n\tu32 cnt;\n    \n\tcnt = fread(buffer, 1, byteSize, m_fp);\n\tm_decrypter.decryptBlck(buffer, cnt);\n\treturn (cnt == byteSize) ? true : false;\n}\n\nIReadStream::ESTATUS CiOSReadFileStream::getStatus() {\n\treturn m_eStat;\n}\n\nIWriteStream *CiOSReadFileStream::getWriteStream() {\n\tif (m_bReadOnly) return 0;  // m_bReadOnly が true の場合は read only 領域へのストリームなので、WriteStreamを返さない。\n\tif (!m_writeStream) m_writeStream = new CiOSWriteFileStream(*this);\n\treturn m_writeStream;\n}\n\nint CiOSReadFileStream::readU16arr(u16 *pBufferU16, int items) {\n\tint cnt = fread(pBufferU16, sizeof(u16), items, m_fp);\n\tm_decrypter.decryptBlck(pBufferU16, sizeof(u16) * cnt);\n    \n\t// iOS と Android/ARM では元々big endian なので、バイトオーダーの入れ替えは特に不要。\n\t// Windows 環境ではこれを使用して読む必要が生じるため、互換のために用意する。\n\treturn cnt;\n}\n\nint CiOSReadFileStream::readU32arr(u32 *pBufferU32, int items) {\n\tint cnt = fread(pBufferU32, sizeof(u32), items, m_fp);\n\tm_decrypter.decryptBlck(pBufferU32, sizeof(u32) * cnt);\n    \n\t// iOS と Android/ARM では元々big endian なので、バイトオーダーの入れ替えは特に不要。\n\t// Windows 環境ではこれを使用して読む必要が生じるため、互換のために用意する。\n\treturn cnt;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSSysResource.mm",
    "content": "#import <SystemConfiguration/SCNetworkReachability.h>\n#include <iostream>\n#include \"CiOSSysResource.h\"\n;\nCiOSSysResource::CiOSSysResource() : m_size_devId(0), m_devId_received(false) {\n}\n\nCiOSSysResource::~CiOSSysResource() {\n}\n\nCiOSSysResource&CiOSSysResource::getInstance() {\n\tstatic CiOSSysResource instance;\n\treturn instance;\n}\n\nvoid CiOSSysResource::requestDevID() {\n}\n\nbool CiOSSysResource::failedDevID() {\n\tm_devId_received = true;\n\tm_devId_succeed = false;\n\treturn false;\n}\n\nbool CiOSSysResource::setDevID(const void *devToken) {\n\tunsigned char *ptr = (unsigned char *)devToken;\n\tfor (int i = 0; i < 32; i++) {\n\t\tm_devId[i] = ptr[i];\n\t}\n\tm_size_devId = 32;\n\tm_devId_received = true;\n\tm_devId_succeed = true;\n\treturn true;\n}\n\nint CiOSSysResource::getDevID(char *retBuf, int maxlen) {\n\tchar *ptr = retBuf;\n\tfor (int i = 0; i < 32 && i * 2 + 2 < maxlen; i++) {\n\t\tsprintf(ptr, \"%02x\", (int)m_devId[i]);\n\t\tptr += strlen(ptr);\n\t}\n\treturn strlen(retBuf);\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSTmpFile.cpp",
    "content": "#include <unistd.h>\n#include <fcntl.h>\n#include \"CiOSPathConv.h\"\n#include \"CiOSTmpFile.h\"\n#include \"CPFInterface.h\"\n\nCiOSTmpFile::CiOSTmpFile(const char *path) : m_fullpath(0) {\n\tm_fullpath = CiOSPathConv::getInstance().fullpath(path);\n\t// 平成24年11月27日(火)\n\t// ファイルが存在しない場合に該当ファイルが生成されない事への対応と\n\t// 権限の付与を行いました。\n\tm_fd = open(m_fullpath, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);\n\tCPFInterface::getInstance().platform().excludePathFromBackup(m_fullpath);\n}\n\nCiOSTmpFile::~CiOSTmpFile() {\n\tif (m_fd > 0) {\n\t\tclose(m_fd);\n\t}\n\tdelete[] m_fullpath;\n}\n\nsize_t CiOSTmpFile::writeTmp(void *ptr, size_t size) {\n\treturn write(m_fd, ptr, size);\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSWebView.mm",
    "content": "#import \"CiOSWebView.h\"\n\nstatic int nonceSeed = 0;\n\n@implementation CiOSWebView\n\n- (void)setCustomHeaders:(const char *)token:(const char *)region:(const char *)client:(const char *)consumerKey:(const char *)applicationId:(const char *)userId:(const char *)env {\n\t[m_token release];\n\t[m_region release];\n\t[m_client release];\n\t[m_cKey release];\n\t[m_appID release];\n\t[m_userID release];\n\t[m_os release];\n\t[m_version release];\n\t[m_timezone release];\n    \n\tif (token) m_token = [[NSString stringWithUTF8String:token] retain];\n\tif (region) m_region = [[NSString stringWithUTF8String:region] retain];\n\tif (client) m_client = [[NSString stringWithUTF8String:client] retain];\n\tif (consumerKey) m_cKey = [[NSString stringWithUTF8String:consumerKey] retain];\n\tif (applicationId) m_appID = [[NSString stringWithUTF8String:applicationId] retain];\n\tif (userId) m_userID = [[NSString stringWithUTF8String:userId] retain];\n    \n\tNSString *nsenv = [NSString stringWithUTF8String:env];\n\tNSArray *arr = [nsenv componentsSeparatedByString:@\";\"];\n\tm_os = [[arr objectAtIndex:0] retain];\n\tm_version = [[arr objectAtIndex:1] retain];\n\tm_timezone = [[arr objectAtIndex:2] retain];\n}\n\n- (void)loadRequest:(NSURLRequest *)request {\n\tNSMutableURLRequest *mutableRequest = (NSMutableURLRequest *)[request mutableCopy];\n    \n\tif (m_client) [mutableRequest setValue:m_client forHTTPHeaderField:@\"Client-Version\"];\n\tif (m_version) [mutableRequest setValue:m_version forHTTPHeaderField:@\"OS-Version\"];\n\tif (m_os) [mutableRequest setValue:m_os forHTTPHeaderField:@\"OS\"];\n\tif (m_timezone) [mutableRequest setValue:m_timezone forHTTPHeaderField:@\"Time-Zone\"];\n\tif (m_region) [mutableRequest setValue:m_region forHTTPHeaderField:@\"Region\"];\n\t[mutableRequest setValue:@\"straightforward\" forHTTPHeaderField:@\"API-Model\"];\n\tif (m_appID) [mutableRequest setValue:m_appID forHTTPHeaderField:@\"Application-ID\"];\n\tif (m_userID) [mutableRequest setValue:m_userID forHTTPHeaderField:@\"User-ID\"];\n\ttime_t now;\n\ttime(&now);\n    \n\tNSString *auth = [NSString stringWithFormat:@\"consumerKey=%@&token=%@&version=1.1&timeStamp=%ld&nonce=WV%d\", m_cKey, m_token, now, nonceSeed];\n\tnonceSeed++;\n\t[mutableRequest setValue:auth forHTTPHeaderField:@\"Authorize\"];\n}\n\n- (void)dealloc {\n\t[m_token release];\n\t[m_region release];\n\t[m_client release];\n\t[m_cKey release];\n\t[m_appID release];\n\t[m_userID release];\n\t[m_os release];\n\t[m_version release];\n\t[m_timezone release];\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSWidget.mm",
    "content": "#include <iostream>\n#include \"CiOSWidget.h\"\n#include \"CiOSPlatform.h\"\n#import \"CiOSWebView.h\"\n#include \"CiOSPathConv.h\"\n#import <CoreMedia/CoreMedia.h>\n\nCiOSWidget::CiOSWidget(CiOSPlatform *pParent)\n: m_x(0)\n, m_y(0)\n, m_width(0)\n, m_height(0)\n, m_pPlatform(pParent) {\n\tm_scale = m_pPlatform->getScale();\n}\n\nCiOSWidget::~CiOSWidget() {\n}\n\nvoid CiOSWidget::cmd(int cmd, ...) {\n}\n\nint CiOSWidget::status() {\n\treturn 0;\n}\n\nbool CiOSWidget::init(int id, int x, int y, int width, int height) {\n\tm_id = id;\n\tm_x = x;\n\tm_y = y;\n\tm_width = width;\n\tm_height = height;\n\tset_move(m_x, m_y, m_width, m_height);\n\treturn true;\n}\n\nvoid CiOSWidget::move(int x, int y) {\n\tm_x = x;\n\tm_y = y;\n\tset_move(m_x, m_y, m_width, m_height);\n}\n\nvoid CiOSWidget::resize(int width, int height) {\n\tm_width = width;\n\tm_height = height;\n\tset_move(m_x, m_y, m_width, m_height);\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/CiOSWriteFileStream.cpp",
    "content": "#include <fcntl.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <unistd.h>\n#include <iostream>\n\n#include \"CiOSWriteFileStream.h\"\n#include \"CiOSReadFileStream.h\"\n\n\nCiOSWriteFileStream::CiOSWriteFileStream(CiOSReadFileStream& rdStream) : m_fd(-1), m_fp(0), m_eStat(CLOSED) {\n\tif (rdStream.m_fp && rdStream.m_eStat == IReadStream::NORMAL) {\n\t\tfclose(rdStream.m_fp);\n\t\trdStream.m_fp = 0;\n\t\trdStream.m_fd = -1;\n\t}\n    \n\tif (0 > (m_fd = open(rdStream.m_fullpath, O_CREAT | O_RDWR))) return;\n\tm_fp = fdopen(m_fd, \"r+b\");\n\tif (!m_fp) {\n\t\tclose(m_fd);\n\t\tm_fd = -1;\n\t\treturn;\n\t}\n\trdStream.m_fd = m_fd;\n\trdStream.m_fp = m_fp;\n\tm_eStat = NORMAL;\n}\n\n// 必ず ReadStream 経由で破棄されるため、こちらではクローズしない\nCiOSWriteFileStream::~CiOSWriteFileStream() {\n}\n\nIWriteStream::ESTATUS CiOSWriteFileStream::getStatus() {\n\treturn m_eStat;\n}\n\ns32 CiOSWriteFileStream::getPosition() {\n\tm_eStat = NORMAL;\n\treturn ftell(m_fp);\n}\n\nvoid CiOSWriteFileStream::writeU8(u8 value) {\n\tm_eStat = NORMAL;\n\tif (EOF == fputc(value, m_fp)) {\n\t\tm_eStat = NOT_AVAILABLE;\n\t}\n}\n\nvoid CiOSWriteFileStream::writeU16(u16 value) {\n\tu8 arr[2];\n\tm_eStat = NORMAL;\n\tarr[0] = (value >> 8) & 0xff;\n\tarr[1] = value & 0xff;\n\tif (1 > fwrite(arr, 2, 1, m_fp)) {\n\t\tm_eStat = NOT_AVAILABLE;\n\t}\n}\n\nvoid CiOSWriteFileStream::writeU32(u32 value) {\n\tu8 arr[4];\n\tm_eStat = NORMAL;\n\tarr[0] = (value >> 24) & 0xff;\n\tarr[1] = (value >> 16) & 0xff;\n\tarr[2] = (value >> 8) & 0xff;\n\tarr[3] = value & 0xff;\n\tif (1 > fwrite(arr, 4, 1, m_fp)) {\n\t\tm_eStat = NOT_AVAILABLE;\n\t}\n}\n\nvoid CiOSWriteFileStream::writeFloat(float fval) {\n\tm_eStat = NORMAL;\n\tif (1 > fwrite(&fval, sizeof(float), 1, m_fp)) {\n\t\tm_eStat = NOT_AVAILABLE;\n\t}\n}\n\nvoid CiOSWriteFileStream::writeBlock(void *buffer, u32 byteSize) {\n\tm_eStat = NORMAL;\n\tif (1 > fwrite(buffer, byteSize, 1, m_fp)) {\n\t\tm_eStat = NOT_AVAILABLE;\n\t}\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/EAGLView.mm",
    "content": "#import <QuartzCore/QuartzCore.h>\n#import <AVFoundation/AVFoundation.h>\n#import \"EAGLView.h\"\n\n#define USE_DEPTH_BUFFER 1\n#import \"BaseType.h\"\n\n#include \"CPFInterface.h\"\n#include \"CiOSPlatform.h\"\n#include <sys/time.h>\n#include \"CiOSSysResource.h\"\n\n// A class extension to declare private methods\n@interface EAGLView ()\n\n@property (nonatomic, assign) NSTimer *animationTimer;\n\n- (BOOL)createFramebuffer;\n- (void)destroyFramebuffer;\n\n@end\n\n\n@implementation EAGLView\n\n@synthesize animationTimer;\n@synthesize animationInterval;\n\n//The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:\n- (id)initWithCoder:(NSCoder *)coder {\n\treturn self;\n}\n\n- (void)destroyFramebuffer {\n\tglDeleteFramebuffers(1, &viewFramebuffer);\n\tviewFramebuffer = 0;\n\tglDeleteRenderbuffers(1, &viewRenderbuffer);\n\tviewRenderbuffer = 0;\n    \n\tif (depthRenderbuffer) {\n\t\tglDeleteRenderbuffers(1, &depthRenderbuffer);\n\t\tdepthRenderbuffer = 0;\n\t}\n}\n\n- (void)startAnimation {\n\tself.animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];\n}\n\n- (void)stopAnimation {\n\tself.animationTimer = nil;\n}\n\n- (void)setAnimationTimer:(NSTimer *)newTimer {\n\t[animationTimer invalidate];\n\tanimationTimer = newTimer;\n}\n\n- (void)setAnimationInterval:(NSTimeInterval)interval {\n\tanimationInterval = interval;\n\tif (animationTimer) {\n\t\t[self stopAnimation];\n\t\t[self startAnimation];\n\t}\n}\n\n- (void)dealloc {\n\t[self stopAnimation];\n    \n\tCPFInterface::getInstance().client().finishGame();\n    \n\t// サウンド関係の終了\n\tCiOSAudioManager::GetInstance().Termination();\n}\n\n- (void)setTimePrev:(CFTimeInterval)value {\n\ttimePrev = value;\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/NSData+Base64.m",
    "content": "//\n//  NSData+Base64.m\n//  base64\n//\n//  Created by Matt Gallagher on 2009/06/03.\n//  Copyright 2009 Matt Gallagher. All rights reserved.\n//\n//  This software is provided 'as-is', without any express or implied\n//  warranty. In no event will the authors be held liable for any damages\n//  arising from the use of this software. Permission is granted to anyone to\n//  use this software for any purpose, including commercial applications, and to\n//  alter it and redistribute it freely, subject to the following restrictions:\n//\n//  1. The origin of this software must not be misrepresented; you must not\n//     claim that you wrote the original software. If you use this software\n//     in a product, an acknowledgment in the product documentation would be\n//     appreciated but is not required.\n//  2. Altered source versions must be plainly marked as such, and must not be\n//     misrepresented as being the original software.\n//  3. This notice may not be removed or altered from any source\n//     distribution.\n//\n\n#import \"NSData+Base64.h\"\n\n//\n// Mapping from 6 bit pattern to ASCII character.\n//\nstatic unsigned char base64EncodeLookup[65] =\n\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n//\n// Definition for \"masked-out\" areas of the base64DecodeLookup mapping\n//\n#define xx 65\n\n//\n// Mapping from ASCII character to 6 bit pattern.\n//\nstatic unsigned char base64DecodeLookup[256] =\n{\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63, \n    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx, \n    xx,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, \n    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx, \n    xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, \n    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \n};\n\n//\n// Fundamental sizes of the binary and base64 encode/decode units in bytes\n//\n#define BINARY_UNIT_SIZE 3\n#define BASE64_UNIT_SIZE 4\n\n//\n// NewBase64Decode\n//\n// Decodes the base64 ASCII string in the inputBuffer to a newly malloced\n// output buffer.\n//\n//  inputBuffer - the source ASCII string for the decode\n//\tlength - the length of the string or -1 (to specify strlen should be used)\n//\toutputLength - if not-NULL, on output will contain the decoded length\n//\n// returns the decoded buffer. Must be free'd by caller. Length is given by\n//\toutputLength.\n//\nvoid *NewBase64Decode(\n\tconst char *inputBuffer,\n\tsize_t length,\n\tsize_t *outputLength)\n{\n\tif (length == -1)\n\t{\n\t\tlength = strlen(inputBuffer);\n\t}\n\t\n\tsize_t outputBufferSize =\n\t\t((length+BASE64_UNIT_SIZE-1) / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE;\n\tunsigned char *outputBuffer = (unsigned char *)malloc(outputBufferSize);\n\t\n\tsize_t i = 0;\n\tsize_t j = 0;\n\twhile (i < length)\n\t{\n\t\t//\n\t\t// Accumulate 4 valid characters (ignore everything else)\n\t\t//\n\t\tunsigned char accumulated[BASE64_UNIT_SIZE];\n\t\tsize_t accumulateIndex = 0;\n\t\twhile (i < length)\n\t\t{\n\t\t\tunsigned char decode = base64DecodeLookup[inputBuffer[i++]];\n\t\t\tif (decode != xx)\n\t\t\t{\n\t\t\t\taccumulated[accumulateIndex] = decode;\n\t\t\t\taccumulateIndex++;\n\t\t\t\t\n\t\t\t\tif (accumulateIndex == BASE64_UNIT_SIZE)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//\n\t\t// Store the 6 bits from each of the 4 characters as 3 bytes\n\t\t//\n\t\t// (Uses improved bounds checking suggested by Alexandre Colucci)\n\t\t//\n\t\tif(accumulateIndex >= 2)  \n\t\t\toutputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4);  \n\t\tif(accumulateIndex >= 3)  \n\t\t\toutputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2);  \n\t\tif(accumulateIndex >= 4)  \n\t\t\toutputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3];\n\t\tj += accumulateIndex - 1;\n\t}\n\t\n\tif (outputLength)\n\t{\n\t\t*outputLength = j;\n\t}\n\treturn outputBuffer;\n}\n\n//\n// NewBase64Encode\n//\n// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced\n// output buffer.\n//\n//  inputBuffer - the source data for the encode\n//\tlength - the length of the input in bytes\n//  separateLines - if zero, no CR/LF characters will be added. Otherwise\n//\t\ta CR/LF pair will be added every 64 encoded chars.\n//\toutputLength - if not-NULL, on output will contain the encoded length\n//\t\t(not including terminating 0 char)\n//\n// returns the encoded buffer. Must be free'd by caller. Length is given by\n//\toutputLength.\n//\nchar *NewBase64Encode(\n\tconst void *buffer,\n\tsize_t length,\n\tbool separateLines,\n\tsize_t *outputLength)\n{\n\tconst unsigned char *inputBuffer = (const unsigned char *)buffer;\n\t\n\t#define MAX_NUM_PADDING_CHARS 2\n\t#define OUTPUT_LINE_LENGTH 64\n\t#define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE)\n\t#define CR_LF_SIZE 2\n\t\n\t//\n\t// Byte accurate calculation of final buffer size\n\t//\n\tsize_t outputBufferSize =\n\t\t\t((length / BINARY_UNIT_SIZE)\n\t\t\t\t+ ((length % BINARY_UNIT_SIZE) ? 1 : 0))\n\t\t\t\t\t* BASE64_UNIT_SIZE;\n\tif (separateLines)\n\t{\n\t\toutputBufferSize +=\n\t\t\t(outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE;\n\t}\n\t\n\t//\n\t// Include space for a terminating zero\n\t//\n\toutputBufferSize += 1;\n\n\t//\n\t// Allocate the output buffer\n\t//\n\tchar *outputBuffer = (char *)malloc(outputBufferSize);\n\tif (!outputBuffer)\n\t{\n\t\treturn NULL;\n\t}\n\n\tsize_t i = 0;\n\tsize_t j = 0;\n\tconst size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length;\n\tsize_t lineEnd = lineLength;\n\t\n\twhile (true)\n\t{\n\t\tif (lineEnd > length)\n\t\t{\n\t\t\tlineEnd = length;\n\t\t}\n\n\t\tfor (; i + BINARY_UNIT_SIZE - 1 < lineEnd; i += BINARY_UNIT_SIZE)\n\t\t{\n\t\t\t//\n\t\t\t// Inner loop: turn 48 bytes into 64 base64 characters\n\t\t\t//\n\t\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];\n\t\t\toutputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4)\n\t\t\t\t| ((inputBuffer[i + 1] & 0xF0) >> 4)];\n\t\t\toutputBuffer[j++] = base64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2)\n\t\t\t\t| ((inputBuffer[i + 2] & 0xC0) >> 6)];\n\t\t\toutputBuffer[j++] = base64EncodeLookup[inputBuffer[i + 2] & 0x3F];\n\t\t}\n\t\t\n\t\tif (lineEnd == length)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\t//\n\t\t// Add the newline\n\t\t//\n\t\toutputBuffer[j++] = '\\r';\n\t\toutputBuffer[j++] = '\\n';\n\t\tlineEnd += lineLength;\n\t}\n\t\n\tif (i + 1 < length)\n\t{\n\t\t//\n\t\t// Handle the single '=' case\n\t\t//\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];\n\t\toutputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4)\n\t\t\t| ((inputBuffer[i + 1] & 0xF0) >> 4)];\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2];\n\t\toutputBuffer[j++] =\t'=';\n\t}\n\telse if (i < length)\n\t{\n\t\t//\n\t\t// Handle the double '=' case\n\t\t//\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0x03) << 4];\n\t\toutputBuffer[j++] = '=';\n\t\toutputBuffer[j++] = '=';\n\t}\n\toutputBuffer[j] = 0;\n\t\n\t//\n\t// Set the output length and return the buffer\n\t//\n\tif (outputLength)\n\t{\n\t\t*outputLength = j;\n\t}\n\treturn outputBuffer;\n}\n\n@implementation NSData (Base64)\n\n//\n// dataFromBase64String:\n//\n// Creates an NSData object containing the base64 decoded representation of\n// the base64 string 'aString'\n//\n// Parameters:\n//    aString - the base64 string to decode\n//\n// returns the autoreleased NSData representation of the base64 string\n//\n+ (NSData *)dataFromBase64String:(NSString *)aString\n{\n\tNSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding];\n\tsize_t outputLength;\n\tvoid *outputBuffer = NewBase64Decode([data bytes], [data length], &outputLength);\n\tNSData *result = [NSData dataWithBytes:outputBuffer length:outputLength];\n\tfree(outputBuffer);\n\treturn result;\n}\n\n//\n// base64EncodedString\n//\n// Creates an NSString object that contains the base 64 encoding of the\n// receiver's data. Lines are broken at 64 characters long.\n//\n// returns an autoreleased NSString being the base 64 representation of the\n//\treceiver.\n//\n- (NSString *)base64EncodedString\n{\n\tsize_t outputLength;\n\tchar *outputBuffer =\n\t\tNewBase64Encode([self bytes], [self length], true, &outputLength);\n\t\n\tNSString *result =\n\t\t[[[NSString alloc]\n\t\t\tinitWithBytes:outputBuffer\n\t\t\tlength:outputLength\n\t\t\tencoding:NSASCIIStringEncoding]\n\t\tautorelease];\n\tfree(outputBuffer);\n\treturn result;\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/NSGLView.h",
    "content": "/*\n File: NSGLView.h\n Abstract:\n The NSGLView class creates an OpenGL context and delegates to the OpenGLRenderer class for creating and drawing the shaders.\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#import <Cocoa/Cocoa.h>\n#import <QuartzCore/CVDisplayLink.h>\n\n#import \"modelUtil.h\"\n#import \"imageUtil.h\"\n\n@interface NSGLView : NSOpenGLView {\n\tCVDisplayLinkRef displayLink;\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/NSGLView.mm",
    "content": "/*\n File: NSGLView.m\n Abstract:\n The NSGLView class creates an OpenGL context and delegates to the OpenGLRenderer class for creating and drawing the shaders.\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#import \"NSGLView.h\"\n#import \"OpenGLRenderer.h\"\n#include \"CiOSPlatform.h\"\n#include \"CiOSPathConv.h\"\n\n@interface NSGLView (PrivateMethods)\n- (void)initGL;\n- (void)drawView;\n\n@end\n\n@implementation NSGLView\n\nOpenGLRenderer *m_renderer;\n\n- (CVReturn)getFrameForTime:(const CVTimeStamp *)outputTime {\n\t// There is no autorelease pool when this method is called\n\t// because it will be called from a background thread\n\t// It's important to create one or you will leak objects\n\tNSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];\n    \n\t[self drawView];\n    \n\t[pool release];\n\treturn kCVReturnSuccess;\n}\n\n// This is the renderer output callback function\nstatic CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *now, const CVTimeStamp *outputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext) {\n\tCVReturn result = [(NSGLView *)displayLinkContext getFrameForTime : outputTime];\n\treturn result;\n}\n\n- (void)awakeFromNib {\n\tNSOpenGLPixelFormatAttribute attrs[] = {\n\t\tNSOpenGLPFADoubleBuffer,\n\t\tNSOpenGLPFADepthSize, 24,\n\t\t// Must specify the 3.2 Core Profile to use OpenGL 3.2\n#if ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n\t\tNSOpenGLPFAOpenGLProfile,\n\t\tNSOpenGLProfileVersion3_2Core,\n#endif\n\t\t0\n\t};\n    \n\tNSOpenGLPixelFormat *pf = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] autorelease];\n    \n\tif (!pf) {\n\t\tNSLog(@\"No OpenGL pixel format\");\n\t}\n    \n\t// TODO: implement path overriding\n    \n\tconst char *g_pathInstall = PATH_INSTALL;\n\tconst char *g_pathExtern = PATH_EXTERN;\n\tCPFInterface& pfif = CPFInterface::getInstance();\n\t// CiOSPathConv& pathconv = CiOSPathConv::getInstance();\n\t// pathconv.setPath(g_pathInstall, g_pathExtern);\n\tCiOSPlatform *pPlatform = new CiOSPlatform(nullptr, 1.0f);\n\tpfif.setPlatformRequest(pPlatform);\n    \n\tGameSetup();\n    \n\tpfif.client().setFilePath(NULL);\n\tNSLog(@\"Playground launched\");\n\tif (!pfif.client().initGame()) {\n\t\tklb_assertAlways(\"Could not initialize game, most likely memory error\");\n\t}\n    \n    \n\tNSOpenGLContext *context = [[[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil] autorelease];\n    \n\t[self setPixelFormat:pf];\n    \n\t[self setOpenGLContext:context];\n}\n\n- (void)prepareOpenGL {\n\t[super prepareOpenGL];\n    \n\t// Make all the OpenGL calls to setup rendering\n\t//  and build the necessary rendering objects\n\t[self initGL];\n    \n\t// Create a display link capable of being used with all active displays\n\tCVDisplayLinkCreateWithActiveCGDisplays(&displayLink);\n    \n\t// Set the renderer output callback function\n\tCVDisplayLinkSetOutputCallback(displayLink, &MyDisplayLinkCallback, self);\n    \n\t// Set the display link for the current renderer\n\tCGLContextObj cglContext = (CGLContextObj)[[self openGLContext] CGLContextObj];\n\tCGLPixelFormatObj cglPixelFormat = (CGLPixelFormatObj)[[self pixelFormat] CGLPixelFormatObj];\n\tCVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(displayLink, cglContext, cglPixelFormat);\n    \n\t// Activate the display link\n\tCVDisplayLinkStart(displayLink);\n}\n\n- (void)initGL {\n\t// Make this openGL context current to the thread\n\t// (i.e. all openGL on this thread calls will go to this context)\n\t[[self openGLContext] makeCurrentContext];\n    \n\t// Synchronize buffer swaps with vertical refresh rate\n\tGLint swapInt = 1;\n\t[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];\n    \n\t// Init our renderer.  Use 0 for the defaultFBO which is appropriate for MacOS (but not iOS)\n\tm_renderer = [[OpenGLRenderer alloc] initWithDefaultFBO:0];\n}\n\n- (void)reshape {\n\t[super reshape];\n    \n\t// We draw on a secondary thread through the display link\n\t// When resizing the view, -reshape is called automatically on the main thread\n\t// Add a mutex around to avoid the threads accessing the context simultaneously when resizing\n\tCGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);\n    \n\tNSRect rect = [self bounds];\n    \n\t[m_renderer resizeWithWidth:rect.size.width AndHeight:rect.size.height];\n    \n\tCGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);\n}\n\n- (void)drawView {\n\t[[self openGLContext] makeCurrentContext];\n    \n\t// We draw on a secondary thread through the display link\n\t// When resizing the view, -reshape is called automatically on the main thread\n\t// Add a mutex around to avoid the threads accessing the context simultaneously\twhen resizing\n\tCGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);\n    \n\t[m_renderer render];\n    \n\tCGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);\n\tCGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);\n}\n\n- (void)dealloc {\n\t// Stop the display link BEFORE releasing anything in the view\n\t// otherwise the display link thread may call into the view and crash\n\t// when it encounters something that has been release\n\tCVDisplayLinkStop(displayLink);\n    \n\tCVDisplayLinkRelease(displayLink);\n    \n\t// Release the display link AFTER display link has been released\n\t[m_renderer release];\n    \n\t[super dealloc];\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/OpenGLRenderer.h",
    "content": "/*\n File: OpenGLRenderer.h\n Abstract:\n The OpenGLRenderer class creates and draws objects.\n Most of the code is OS independent.\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#include \"glUtil.h\"\n\n@interface OpenGLRenderer : NSObject {\n\tGLuint m_defaultFBOName;\n}\n\n- (id)initWithDefaultFBO:(GLuint)defaultFBOName;\n- (void)resizeWithWidth:(GLuint)width AndHeight:(GLuint)height;\n- (void)render;\n- (void)dealloc;\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/OpenGLRenderer.mm",
    "content": "/*\n File: OpenGLRenderer.m\n Abstract:\n The OpenGLRenderer class creates and draws objects.\n Most of the code is OS independent.\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#import \"OpenGLRenderer.h\"\n#import \"matrixUtil.h\"\n#import \"imageUtil.h\"\n#import \"modelUtil.h\"\n#import \"sourceUtil.h\"\n#include \"CiOSPlatform.h\"\n\n\n#define GetGLError()                                    \\\n{                                                       \\\nGLenum err = glGetError();                          \\\nwhile (err != GL_NO_ERROR) {                        \\\nNSLog(@\"GLError %s set in File:%s Line:%d\\n\",   \\\nGetGLErrorString(err),                  \\\n__FILE__,                               \\\n__LINE__);                              \\\nerr = glGetError();                             \\\n}                                                   \\\n}\n\n// Toggle this to disable vertex buffer objects\n// (i.e. use client-side vertex array objects)\n// This must be 1 if using the GL3 Core Profile on the Mac\n#define USE_VERTEX_BUFFER_OBJECTS 1\n\n// Indicies to which we will set vertex array attibutes\n// See buildVAO and buildProgram\nenum {\n\tPOS_ATTRIB_IDX,\n\tNORMAL_ATTRIB_IDX,\n\tTEXCOORD_ATTRIB_IDX\n};\n\n#define BUFFER_OFFSET(i) ((char *)NULL + (i))\n\n@implementation OpenGLRenderer\n\nGLuint m_characterPrgName;\nGLint m_characterMvpUniformIdx;\nGLuint m_characterVAOName;\nGLuint m_characterTexName;\ndemoModel *m_characterModel;\nGLenum m_characterPrimType;\nGLenum m_characterElementType;\nGLuint m_characterNumElements;\nGLfloat m_characterAngle;\n\n\nGLuint m_viewWidth;\nGLuint m_viewHeight;\n\n\nGLboolean m_useVBOs;\n\n- (void)resizeWithWidth:(GLuint)width AndHeight:(GLuint)height {\n\tglViewport(0, 0, width, height);\n    \n\tm_viewWidth = width;\n\tm_viewHeight = height;\n}\n\n- (void)render {\n\tIClientRequest& client = CPFInterface::getInstance().client();\n\ts32 deltaT = client.getFrameTime();\n\tclient.frameFlip(deltaT);\n\t// Set up the modelview and projection matricies\n\tGLfloat modelView[16];\n\tGLfloat projection[16];\n\tGLfloat mvp[16];\n    \n\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n    \n\t// Use the program for rendering our character\n\tglUseProgram(m_characterPrgName);\n    \n\t// Calculate the projection matrix\n\tmtxLoadPerspective(projection, 90, (float)m_viewWidth / (float)m_viewHeight, 5.0, 10000);\n    \n\t// Calculate the modelview matrix to render our character\n\t//  at the proper position and rotation\n\tmtxLoadTranslate(modelView, 0, 150, -450);\n\tmtxRotateXApply(modelView, -90.0f);\n\tmtxRotateApply(modelView, m_characterAngle, 0.7, 0.3, 1);\n    \n\t// Multiply the modelview and projection matrix and set it in the shader\n\tmtxMultiply(mvp, projection, modelView);\n    \n\t// Have our shader use the modelview projection matrix\n\t// that we calculated above\n\tglUniformMatrix4fv(m_characterMvpUniformIdx, 1, GL_FALSE, mvp);\n    \n\t// Bind the texture to be used\n\tglBindTexture(GL_TEXTURE_2D, m_characterTexName);\n    \n\t// Bind our vertex array object\n\tglBindVertexArray(m_characterVAOName);\n    \n\t// Cull back faces now that we no longer render\n\t// with an inverted matrix\n\tglCullFace(GL_BACK);\n    \n\t// Draw our character\n\tif (m_useVBOs) {\n\t\tglDrawElements(GL_TRIANGLES, m_characterNumElements, m_characterElementType, 0);\n\t}\n\telse {\n\t\tglDrawElements(GL_TRIANGLES, m_characterNumElements, m_characterElementType, m_characterModel->elements);\n\t}\n    \n\t// Update the angle so our character keeps spinning\n\tm_characterAngle++;\n}\n\nstatic GLsizei GetGLTypeSize(GLenum type) {\n\tswitch (type) {\n\t\tcase GL_BYTE:\n\t\t\treturn sizeof(GLbyte);\n            \n\t\tcase GL_UNSIGNED_BYTE:\n\t\t\treturn sizeof(GLubyte);\n            \n\t\tcase GL_SHORT:\n\t\t\treturn sizeof(GLshort);\n            \n\t\tcase GL_UNSIGNED_SHORT:\n\t\t\treturn sizeof(GLushort);\n            \n\t\tcase GL_INT:\n\t\t\treturn sizeof(GLint);\n            \n\t\tcase GL_UNSIGNED_INT:\n\t\t\treturn sizeof(GLuint);\n            \n\t\tcase GL_FLOAT:\n\t\t\treturn sizeof(GLfloat);\n\t}\n\treturn 0;\n}\n\n- (GLuint)buildTexture:(demoImage *)image {\n\tGLuint texName;\n    \n\t// Create a texture object to apply to model\n\tglGenTextures(1, &texName);\n\tglBindTexture(GL_TEXTURE_2D, texName);\n    \n\t// Set up filter and wrap modes for this texture object\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n    \n\t// Indicate that pixel rows are tightly packed\n\t//  (defaults to stride of 4 which is kind of only good for\n\t//  RGBA or FLOAT data types)\n\tglPixelStorei(GL_UNPACK_ALIGNMENT, 1);\n    \n\t// Allocate and load image data into texture\n\tglTexImage2D(GL_TEXTURE_2D, 0, image->format, image->width, image->height, 0,\n\t             image->format, image->type, image->data);\n    \n\t// Create mipmaps for this texture for better image quality\n\tglGenerateMipmap(GL_TEXTURE_2D);\n    \n\tGetGLError();\n    \n\treturn texName;\n}\n\n- (id)initWithDefaultFBO:(GLuint)defaultFBOName {\n\tif ((self = [super init])) {\n\t\tNSLog(@\"%s %s\", glGetString(GL_RENDERER), glGetString(GL_VERSION));\n        \n\t\t////////////////////////////////////////////////////\n\t\t// Build all of our and setup initial state here  //\n\t\t// Don't wait until our real time run loop begins //\n\t\t////////////////////////////////////////////////////\n        \n\t\tm_defaultFBOName = defaultFBOName;\n        \n\t\tm_viewWidth = 100;\n\t\tm_viewHeight = 100;\n        \n        \n\t\tm_characterAngle = 0;\n        \n\t\tm_useVBOs = USE_VERTEX_BUFFER_OBJECTS;\n        \n\t\tNSString *filePathName = nil;\n        \n\t\t//////////////////////////////\n\t\t// Load our character model //\n\t\t//////////////////////////////\n        \n\t\tfilePathName = [[NSBundle mainBundle] pathForResource:@\"demon\" ofType:@\"model\"];\n\t\tm_characterModel = mdlLoadModel([filePathName cStringUsingEncoding:NSASCIIStringEncoding]);\n        \n\t\t// Cache the number of element and primType to use later in our glDrawElements calls\n\t\tm_characterNumElements = m_characterModel->numElements;\n\t\tm_characterPrimType = m_characterModel->primType;\n\t\tm_characterElementType = m_characterModel->elementType;\n        \n\t\tif (m_useVBOs) {\n\t\t\t//If we're using VBOs we can destroy all this memory since buffers are\n\t\t\t// loaded into GL and we've saved anything else we need\n\t\t\tmdlDestroyModel(m_characterModel);\n\t\t\tm_characterModel = NULL;\n\t\t}\n        \n        \n\t\t////////////////////////////////////\n\t\t// Load texture for our character //\n\t\t////////////////////////////////////\n        \n\t\tfilePathName = [[NSBundle mainBundle] pathForResource:@\"demon\" ofType:@\"png\"];\n\t\tdemoImage *image = imgLoadImage([filePathName cStringUsingEncoding:NSASCIIStringEncoding], false);\n        \n\t\t// Build a texture object with our image data\n\t\tm_characterTexName = [self buildTexture:image];\n        \n\t\t// We can destroy the image once it's loaded into GL\n\t\timgDestroyImage(image);\n        \n        \n\t\t////////////////////////////////////////////////////\n\t\t// Load and Setup shaders for character rendering //\n\t\t////////////////////////////////////////////////////\n        \n\t\tdemoSource *vtxSource = NULL;\n\t\tdemoSource *frgSource = NULL;\n        \n\t\tfilePathName = [[NSBundle mainBundle] pathForResource:@\"character\" ofType:@\"vsh\"];\n\t\tvtxSource = srcLoadSource([filePathName cStringUsingEncoding:NSASCIIStringEncoding]);\n        \n\t\tfilePathName = [[NSBundle mainBundle] pathForResource:@\"character\" ofType:@\"fsh\"];\n\t\tfrgSource = srcLoadSource([filePathName cStringUsingEncoding:NSASCIIStringEncoding]);\n        \n\t\tsrcDestroySource(vtxSource);\n\t\tsrcDestroySource(frgSource);\n        \n\t\tm_characterMvpUniformIdx = glGetUniformLocation(m_characterPrgName, \"modelViewProjectionMatrix\");\n        \n\t\tif (m_characterMvpUniformIdx < 0) {\n\t\t\tNSLog(@\"No modelViewProjectionMatrix in character shader\");\n\t\t}\n        \n\t\t////////////////////////////////////////////////\n\t\t// Set up OpenGL state that will never change //\n\t\t////////////////////////////////////////////////\n        \n\t\t// Depth test will always be enabled\n\t\tglEnable(GL_DEPTH_TEST);\n        \n\t\t// We will always cull back faces for better performance\n\t\tglEnable(GL_CULL_FACE);\n        \n\t\t// Always use this clear color\n\t\tglClearColor(0.5f, 0.4f, 0.5f, 1.0f);\n        \n\t\t// Draw our scene once without presenting the rendered image.\n\t\t//   This is done in order to pre-warm OpenGL\n\t\t// We don't need to present the buffer since we don't actually want the\n\t\t//   user to see this, we're only drawing as a pre-warm stage\n\t\t[self render];\n        \n\t\t// Reset the m_characterAngle which is incremented in render\n\t\tm_characterAngle = 0;\n        \n\t\t// Check for errors to make sure all of our setup went ok\n\t\tGetGLError();\n\t}\n    \n\treturn self;\n}\n\n- (void)dealloc {\n\t// Cleanup all OpenGL objects and\n\tglDeleteTextures(1, &m_characterTexName);\n    \n\tmdlDestroyModel(m_characterModel);\n    \n\t[super dealloc];\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/Playground-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.klab.${PRODUCT_NAME:rfc1034identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSMinimumSystemVersion</key>\n\t<string>${MACOSX_DEPLOYMENT_TARGET}</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2013年 KLab Inc. All rights reserved.</string>\n\t<key>NSMainNibFile</key>\n\t<string>MainMenu</string>\n\t<key>NSPrincipalClass</key>\n\t<string>NSApplication</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/Playground-Prefix.pch",
    "content": "//\n// Prefix header for all source files of the 'Playground' target in the 'Playground' project\n//\n\n#ifdef __OBJC__\n    #import <Cocoa/Cocoa.h>\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/PlaygroundAppDelegate.h",
    "content": "#import <Cocoa/Cocoa.h>\n#import \"NSGLView.h\"\n\n@class MainWindowController;\n\n@interface PlaygroundAppDelegate : NSObject <NSApplicationDelegate> {\n    NSGLView *glView;\n}\n\n@property (assign) IBOutlet NSWindow *window;\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/PlaygroundAppDelegate.mm",
    "content": "#import \"PlaygroundAppDelegate.h\"\n#import \"NSGLView.h\"\n#include \"CiOSPlatform.h\"\n\n@implementation PlaygroundAppDelegate\n\n- (void)dealloc\n{\n    [super dealloc];\n}\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification\n{\n\tCPFInterface& pfif = CPFInterface::getInstance();\n\tCiOSPlatform * pPlatform = new CiOSPlatform(nullptr, 1.0f);\n    pfif.setPlatformRequest(pPlatform);\n    \n    GameSetup();\n    \n    NSLog(@\"app launched\");\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/ViewController.mm",
    "content": ";\n#import \"ViewController.h\"\n#import \"NSData+Base64.h\"\n#include \"CPFInterface.h\"\n#import \"CiOSPlatform.h\"\n\n#ifdef USE_EXTERNAL_SDK_LOVELIVE\n#import \"SDKWrapper.h\"\n#endif\n\n@implementation ViewController\n\n- (void)didReceiveMemoryWarning\n{\n    [super didReceiveMemoryWarning];\n    // Release any cached data, images, etc that aren't in use.\n}\n\nNSMutableDictionary* transactionDict =[NSMutableDictionary dictionary];\n#pragma mark - View lifecycle\n\n// 回転を検出した際に呼び出される\n- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration\n{\n    CPFInterface& pfif = CPFInterface::getInstance();\n    if(!pfif.isClient()) return;\n    CGRect f = self.view.frame;\n    int width = f.size.width * [UIScreen mainScreen].scale;\n    int height = f.size.height * [UIScreen mainScreen].scale;\n    // 縦位置か横位置かを検出\n    if(UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {\n        // 縦位置\n        pfif.client().changeScreenInfo(IClientRequest::LEFT_TOP, width, height);\n    } else {\n        // 横位置\n        pfif.client().changeScreenInfo(IClientRequest::LEFT_TOP, height, width);        \n    }\n}\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    \n    if(![SKPaymentQueue canMakePayments]) {\n        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@\"課金制限\"\n                                                         message:@\"設定によりアプリ内課金が制限されています。\"\n                                                        delegate:nil\n                                               cancelButtonTitle:nil\n                                               otherButtonTitles:@\"OK\", nil];\n        [alert show];\n        [alert release];\n    }\n        \n    [UIApplication sharedApplication].statusBarHidden = YES;\n    [self.view setFrame:[[UIScreen mainScreen] bounds]];\n    self.view.contentScaleFactor = [UIScreen mainScreen].scale;\n    [viewGL startAnimation];\n    [viewGL setViewController:self];\n\n\t// Do any additional setup after loading the view, typically from a nib.\n#ifdef USE_EXTERNAL_SDK_LOVELIVE\n    [SDKWrapper onLoad];\n#endif\n}\n- (void)viewDidUnload\n{\n    [viewGL stopAnimation];\n//    [self setViewBase:nil];\n    [super viewDidUnload];\n    // Release any retained subviews of the main view.\n    // e.g. self.myOutlet = nil;\n}\n\n- (void)viewWillAppear:(BOOL)animated\n{\n    [super viewWillAppear:animated];\n}\n\n- (void)viewDidAppear:(BOOL)animated\n{\n    [super viewDidAppear:animated];\n}\n\n- (void)viewWillDisappear:(BOOL)animated\n{\n\t[super viewWillDisappear:animated];\n}\n\n- (void)viewDidDisappear:(BOOL)animated\n{\n\t[super viewDidDisappear:animated];\n}\n\n// 実際ローテーションされた場合に呼び出される。\n- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation\n{\n    IClientRequest::SCRMODE mode;\n\n    switch(interfaceOrientation)\n    {\n        case UIInterfaceOrientationPortrait:\n        case UIInterfaceOrientationPortraitUpsideDown:\n            mode = IClientRequest::PORTRAIT;\n            break;\n        case UIInterfaceOrientationLandscapeLeft:\n        case UIInterfaceOrientationLandscapeRight:\n            mode = IClientRequest::LANDSCAPE;\n            break;\n    }\n\n    CPFInterface& pfif = CPFInterface::getInstance();\n    //if(!pfif.isClient()) {\n        return (mode == IClientRequest::LANDSCAPE) ? YES : NO;\n    //}\n    return pfif.client().reportScreenRotation(IClientRequest::LEFT_TOP, mode) ? YES : NO;\n}\n\n- (void)viewRecovery\n{\n    [viewGL setTimePrev:0];\n}\n\n- (void)stopAnimation\n{\n    [viewGL stopAnimation];\n}\n\n- (void)startAnimation\n{\n    [viewGL startAnimation];\n}\n\n-(void)clearUITouches\n{\n    [viewGL clearUITouches];\n}\n\n- (void)dealloc {\n    [viewBase release];\n    [super dealloc];\n}\n\n- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {\n  if([response.invalidProductIdentifiers count] > 0)\n    {\n      // アイテムIDが不正\n      IClientRequest& cli = CPFInterface::getInstance().client();\n      for (NSString* product_id in response.invalidProductIdentifiers)\n        {\n          const char* utf8_id = [product_id UTF8String];\n          if (!utf8_id)\n            {\n              utf8_id = \"\";\n            }\n          size_t len = strlen(utf8_id) + 1;\n          cli.controlEvent(IClientRequest::E_STORE_BAD_ITEMID,\n                           0,\n                           len,\n                           (void*)utf8_id,\n                           0,\n                           0);\n          CPFInterface::getInstance().platform().logging(\"[store] invalid item id: %s.\",\n                                                         utf8_id);\n        }\n    }\n\n  // Platformを取得して処理を振り分ける.\n  CiOSPlatform* Platform(CiOSPlatform::getInstance());\n  if (Platform)\n    {\n      Platform->responseStoreKitProducts(response, self);\n    }\n}\n\n- (void)finishStoreTransaction:(NSString *)receipt\n{\n\tSKPaymentTransaction * transaction = [transactionDict objectForKey:receipt];\n    if (transaction) {\n        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];\n    \n        [transactionDict removeObjectForKey:receipt];\n    \n#ifdef USE_EXTERNAL_SDK_LOVELIVE\n        [SDKWrapper onPayment:transaction];\n#endif\n    } else {\n      /* oh hell.. we are doomed */\n    }\n}\n\n- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions: (NSArray *)transactions {\n  @synchronized(self) {\n    [[NSUserDefaults standardUserDefaults] setBool: NO\n                                             forKey:@\"PaymentTransactionBool\"];\n    [[NSUserDefaults standardUserDefaults] synchronize];\n  }\n}\n\n- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {\n    \n    IClientRequest& cli = CPFInterface::getInstance().client();\n    \n    for(SKPaymentTransaction * transaction in transactions) {\n        NSString * productId = transaction.payment.productIdentifier;\n        const char * utf8_id = [productId UTF8String];\n        size_t len = strlen(utf8_id) + 1;\n\n        switch (transaction.transactionState) {\n            case SKPaymentTransactionStatePurchasing: {\n              // 購入処理中\n              @synchronized(self){\n                [[NSUserDefaults standardUserDefaults] setBool:YES\n                                                        forKey:@\"PaymentTransactionBool\"];\n                [[NSUserDefaults standardUserDefaults] synchronize];\n              }\n                cli.controlEvent(IClientRequest::E_STORE_PURCHASHING, 0, len, (void *)utf8_id, 0, 0);\n                break;\n            }\n            case SKPaymentTransactionStatePurchased: {\n                // 購入処理成功\n                \n                // レシート情報を取得する\n                NSString * receipt = [transaction.transactionReceipt base64EncodedString];\n                const char * utf8_receipt = [receipt UTF8String];\n                size_t len_receipt = strlen(utf8_receipt) + 1;\n                \n                cli.controlEvent(IClientRequest::E_STORE_PURCHASHED, 0,\n                                 len, (void *)utf8_id, len_receipt, (void *)utf8_receipt);\n\n                [transactionDict setObject:transaction forKey:[NSString stringWithFormat:@\"%s\", utf8_receipt]];\n                break;\n            }\n            case SKPaymentTransactionStateFailed: {\n              // 購入処理エラーもしくはキャンセル\n              switch ([transaction.error code])\n                {\n                case SKErrorUnknown:\n                  {\n                  }\n                  break;\n                case SKErrorClientInvalid:\n                  {\n                  }\n                  break;\n                case SKErrorPaymentCancelled:\n                  {\n                  }\n                  break;\n                case SKErrorPaymentInvalid:\n                  {\n                  }\n                  break;\n                case SKErrorPaymentNotAllowed:\n                  {\n                  }\n                  break;\n                case SKErrorStoreProductNotAvailable:\n                  {\n                  }\n                  break;\n                default:\n                  {\n                  }\n                  break;\n                }\n                cli.controlEvent(IClientRequest::E_STORE_FAILED, 0, len, (void *)utf8_id, 0, 0);\n                [queue finishTransaction:transaction];\n                break;\n            }\n            case SKPaymentTransactionStateRestored: {\n                // アイテムのリストア(購入済みアイテムの再付与(再インストール等で最6初から持っている状態にすべき、など)完了\n                // ラブライブでは非消費型アイテムは扱わないのでこの遷移に入る事は無い - yukishita\n                cli.controlEvent(IClientRequest::E_STORE_RESTORE, 0, len, (void *)utf8_id, 0, 0);\n                [queue finishTransaction:transaction];\n                break;\n            }\n            default: break; // unreachable\n        }\n    }\n}\n\n- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {\n    // リストア失敗\n    // ラブライブでは非消費型アイテムは扱わないのでこの遷移に入る事は無い - yukishita\n    IClientRequest& cli = CPFInterface::getInstance().client();\n    cli.controlEvent(IClientRequest::E_STORE_RESTORE_FAILED, 0, 0, 0, 0, 0);\n}\n\n- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {\n    // 全リストア終了\n    // ラブライブでは非消費型アイテムは扱わないのでこの遷移に入る事は無い - yukishita\n    IClientRequest& cli = CPFInterface::getInstance().client();\n    cli.controlEvent(IClientRequest::E_STORE_RESTORE_COMPLETED, 0, 0, 0, 0, 0);\n}\n\n- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {\n    abort();\n}\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/assert.mm",
    "content": "#include \"assert.h\"\r\n#include <stdio.h>\r\n#include <stdarg.h>\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CiOSPlatform.h\"\r\n\r\nextern \"C\" {\r\n    void assertFunction(int line, const char *file, const char *msg, ...) {\r\n        va_list argp;\r\n        char pszBuf[1024];\r\n        \r\n        va_start(argp, msg);\r\n        vsprintf(pszBuf, msg, argp);\r\n        va_end(argp);\r\n        \r\n        char alertBuf[4096];\r\n        sprintf(alertBuf, \"Assert l.%i in %s : %s\", line, file, pszBuf);\r\n        NSString *alert_msg = [NSString stringWithCString:alertBuf encoding:NSUTF8StringEncoding];\r\n        \r\n        NSLog(@\"%s\", alertBuf);\r\n        \r\n        CiOSPlatform *pPlatform = CiOSPlatform::getInstance();\r\n    }\r\n    \r\n    void msgBox(char *log) {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/en.lproj/Credits.rtf",
    "content": "{\\rtf0\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\n{\\colortbl;\\red255\\green255\\blue255;}\n\\paperw9840\\paperh8400\n\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\ql\\qnatural\n\n\\f0\\b\\fs24 \\cf0 Engineering:\n\\b0 \\\n\tSome people\\\n\\\n\n\\b Human Interface Design:\n\\b0 \\\n\tSome other people\\\n\\\n\n\\b Testing:\n\\b0 \\\n\tHopefully not nobody\\\n\\\n\n\\b Documentation:\n\\b0 \\\n\tWhoever\\\n\\\n\n\\b With special thanks to:\n\\b0 \\\n\tMom\\\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/en.lproj/InfoPlist.strings",
    "content": "/* Localized versions of Info.plist keys */\n\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/en.lproj/MainMenu.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<archive type=\"com.apple.InterfaceBuilder3.Cocoa.XIB\" version=\"8.00\">\n\t<data>\n\t\t<int key=\"IBDocument.SystemTarget\">1080</int>\n\t\t<string key=\"IBDocument.SystemVersion\">13A2093</string>\n\t\t<string key=\"IBDocument.InterfaceBuilderVersion\">4514</string>\n\t\t<string key=\"IBDocument.AppKitVersion\">1265</string>\n\t\t<string key=\"IBDocument.HIToolboxVersion\">695.00</string>\n\t\t<object class=\"NSMutableDictionary\" key=\"IBDocument.PluginVersions\">\n\t\t\t<string key=\"NS.key.0\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t<string key=\"NS.object.0\">4514</string>\n\t\t</object>\n\t\t<array key=\"IBDocument.IntegratedClassDependencies\">\n\t\t\t<string>NSCustomObject</string>\n\t\t\t<string>NSMenu</string>\n\t\t\t<string>NSMenuItem</string>\n\t\t\t<string>NSView</string>\n\t\t\t<string>NSWindowTemplate</string>\n\t\t</array>\n\t\t<array key=\"IBDocument.PluginDependencies\">\n\t\t\t<string>com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t</array>\n\t\t<object class=\"NSMutableDictionary\" key=\"IBDocument.Metadata\">\n\t\t\t<string key=\"NS.key.0\">PluginDependencyRecalculationVersion</string>\n\t\t\t<integer value=\"1\" key=\"NS.object.0\"/>\n\t\t</object>\n\t\t<array class=\"NSMutableArray\" key=\"IBDocument.RootObjects\" id=\"1048\">\n\t\t\t<object class=\"NSCustomObject\" id=\"1021\">\n\t\t\t\t<string key=\"NSClassName\">NSApplication</string>\n\t\t\t</object>\n\t\t\t<object class=\"NSCustomObject\" id=\"1014\">\n\t\t\t\t<string key=\"NSClassName\">FirstResponder</string>\n\t\t\t</object>\n\t\t\t<object class=\"NSCustomObject\" id=\"1050\">\n\t\t\t\t<string key=\"NSClassName\">NSApplication</string>\n\t\t\t</object>\n\t\t\t<object class=\"NSMenu\" id=\"649796088\">\n\t\t\t\t<string key=\"NSTitle\">AMainMenu</string>\n\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"694149608\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">Playground</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<object class=\"NSCustomResource\" key=\"NSOnImage\" id=\"35465992\">\n\t\t\t\t\t\t\t<string key=\"NSClassName\">NSImage</string>\n\t\t\t\t\t\t\t<string key=\"NSResourceName\">NSMenuCheckmark</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"NSCustomResource\" key=\"NSMixedImage\" id=\"502551668\">\n\t\t\t\t\t\t\t<string key=\"NSClassName\">NSImage</string>\n\t\t\t\t\t\t\t<string key=\"NSResourceName\">NSMenuMixedState</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"110575045\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"110575045\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">Playground</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"238522557\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">About Playground</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"304266470\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"609285721\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Preferences…</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">,</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"481834944\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1046388886\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Services</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"752062318\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"752062318\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Services</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\"/>\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSName\">_NSServicesMenu</string>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"646227648\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"755159360\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Hide Playground</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">h</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"342932134\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Hide Others</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">h</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1572864</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"908899353\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show All</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1056857174\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"632727374\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"110575045\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Quit Playground</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">q</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t<string key=\"NSName\">_NSAppleMenu</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"379814623\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">File</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"720053764\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"720053764\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">File</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"705341025\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">New</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">n</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"722745758\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Open…</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">o</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1025936716\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Open Recent</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"1065607017\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"1065607017\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Open Recent</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"759406840\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"1065607017\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Clear Menu</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSName\">_NSRecentDocumentsMenu</string>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"425164168\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"776162233\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Close</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">w</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1023925487\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Save…</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">s</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"579971712\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Revert to Saved</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1010469920\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"294629803\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Page Setup...</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">P</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1179648</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSToolTip\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"49223823\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"720053764\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Print…</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">p</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"952259628\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">Edit</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"789758025\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"789758025\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">Edit</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1058277027\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Undo</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">z</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"790794224\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Redo</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">Z</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1179648</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1040322652\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"296257095\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Cut</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">x</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"860595796\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Copy</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">c</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"29853731\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Paste</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">v</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"82994268\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Paste and Match Style</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">V</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1572864</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"437104165\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Delete</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"583158037\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Select All</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">a</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"212016141\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"892235320\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Find</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"963351320\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Find</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"447796847\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Find…</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">f</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">1</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"738670835\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Find and Replace…</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">f</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1572864</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">12</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"326711663\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Find Next</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">g</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">2</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"270902937\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Find Previous</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">G</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1179648</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">3</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"159080638\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use Selection for Find</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">e</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">7</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"88285865\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"963351320\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Jump to Selection</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">j</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"972420730\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Spelling and Grammar</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"769623530\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Spelling and Grammar</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"679648819\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show Spelling and Grammar</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">:</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"96193923\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Check Document Now</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">;</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"859480356\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"948374510\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Check Spelling While Typing</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"967646866\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Check Grammar With Spelling</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"795346622\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"769623530\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Correct Spelling Automatically</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"507821607\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Substitutions</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"698887838\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Substitutions</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"65139061\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show Substitutions</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"19036812\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"605118523\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Smart Copy/Paste</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">f</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">1</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"197661976\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Smart Quotes</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">g</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">2</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"672708820\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Smart Dashes</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"708854459\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Smart Links</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">G</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1179648</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">3</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"537092702\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"698887838\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Text Replacement</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"288088188\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Transformations</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"579392910\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"579392910\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Transformations</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1060694897\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"579392910\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Make Upper Case</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"879586729\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"579392910\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Make Lower Case</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"56570060\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"579392910\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Capitalize</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"676164635\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"789758025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Speech</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"785027613\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"785027613\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Speech</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"731782645\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"785027613\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Start Speaking</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"680220178\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"785027613\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Stop Speaking</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"302598603\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">Format</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"941447902\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"941447902\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">Format</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"792887677\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"941447902\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Font</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"786677654\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Font</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"159677712\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show Fonts</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">t</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"305399458\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Bold</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">b</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">2</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"814362025\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Italic</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">i</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">1</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"330926929\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Underline</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">u</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"533507878\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"158063935\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Bigger</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">+</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">3</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"885547335\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Smaller</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">-</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSTag\">4</int>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"901062459\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"767671776\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Kern</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"175441468\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"175441468\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Kern</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"252969304\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"175441468\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use Default</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"766922938\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"175441468\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use None</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"677519740\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"175441468\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Tighten</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"238351151\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"175441468\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Loosen</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"691570813\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Ligatures</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"1058217995\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"1058217995\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Ligatures</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"706297211\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"1058217995\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use Default</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"568384683\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"1058217995\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use None</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"663508465\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"1058217995\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use All</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"769124883\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Baseline</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"18263474\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"18263474\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Baseline</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"257962622\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"18263474\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Use Default</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"644725453\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"18263474\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Superscript</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1037576581\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"18263474\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Subscript</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"941806246\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"18263474\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Raise</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1045724900\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"18263474\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Lower</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"739652853\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1012600125\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show Colors</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">C</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"214559597\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"596732606\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Copy Style</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">c</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1572864</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"393423671\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"786677654\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Paste Style</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">v</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1572864</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSName\">_NSFontMenu</string>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"215659978\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"941447902\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Text</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"446991534\">\n\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Text</string>\n\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"875092757\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Align Left</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">{</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"630155264\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Center</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">|</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"945678886\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Justify</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"512868991\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Align Right</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">}</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"163117631\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"31516759\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Writing Direction</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"956096989\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Writing Direction</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"257099033\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Paragraph</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"551969625\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string type=\"base64-UTF8\" key=\"NSTitle\">CURlZmF1bHQ</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"249532473\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string type=\"base64-UTF8\" key=\"NSTitle\">CUxlZnQgdG8gUmlnaHQ</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"607364498\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string type=\"base64-UTF8\" key=\"NSTitle\">CVJpZ2h0IHRvIExlZnQ</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"508151438\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"981751889\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Selection</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"380031999\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string type=\"base64-UTF8\" key=\"NSTitle\">CURlZmF1bHQ</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"825984362\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string type=\"base64-UTF8\" key=\"NSTitle\">CUxlZnQgdG8gUmlnaHQ</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"560145579\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"956096989\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string type=\"base64-UTF8\" key=\"NSTitle\">CVJpZ2h0IHRvIExlZnQ</string>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"908105787\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"644046920\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show Ruler</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"231811626\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Copy Ruler</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">c</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1310720</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"883618387\">\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"446991534\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Paste Ruler</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">v</string>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1310720</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"586577488\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">View</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"466310130\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"466310130\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">View</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"102151532\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"466310130\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Show Toolbar</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">t</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1572864</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"237841660\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"466310130\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Customize Toolbar…</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"713487014\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">Window</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"835318025\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"835318025\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">Window</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"1011231497\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"835318025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Minimize</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">m</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"575023229\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"835318025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Zoom</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"299356726\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"835318025\"/>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsDisabled\">YES</bool>\n\t\t\t\t\t\t\t\t\t<bool key=\"NSIsSeparator\">YES</bool>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"625202149\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"835318025\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Bring All to Front</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t<string key=\"NSName\">_NSWindowsMenu</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMenuItem\" id=\"448692316\">\n\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"649796088\"/>\n\t\t\t\t\t\t<string key=\"NSTitle\">Help</string>\n\t\t\t\t\t\t<string key=\"NSKeyEquiv\"/>\n\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t<string key=\"NSAction\">submenuAction:</string>\n\t\t\t\t\t\t<reference key=\"NSTarget\" ref=\"992780483\"/>\n\t\t\t\t\t\t<object class=\"NSMenu\" key=\"NSSubmenu\" id=\"992780483\">\n\t\t\t\t\t\t\t<string key=\"NSTitle\">Help</string>\n\t\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"NSMenuItems\">\n\t\t\t\t\t\t\t\t<object class=\"NSMenuItem\" id=\"105068016\">\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMenu\" ref=\"992780483\"/>\n\t\t\t\t\t\t\t\t\t<string key=\"NSTitle\">Playground Help</string>\n\t\t\t\t\t\t\t\t\t<string key=\"NSKeyEquiv\">?</string>\n\t\t\t\t\t\t\t\t\t<int key=\"NSKeyEquivModMask\">1048576</int>\n\t\t\t\t\t\t\t\t\t<int key=\"NSMnemonicLoc\">2147483647</int>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSOnImage\" ref=\"35465992\"/>\n\t\t\t\t\t\t\t\t\t<reference key=\"NSMixedImage\" ref=\"502551668\"/>\n\t\t\t\t\t\t\t\t</object>\n\t\t\t\t\t\t\t</array>\n\t\t\t\t\t\t\t<string key=\"NSName\">_NSHelpMenu</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t</array>\n\t\t\t\t<string key=\"NSName\">_NSMainMenu</string>\n\t\t\t</object>\n\t\t\t<object class=\"NSWindowTemplate\" id=\"972006081\">\n\t\t\t\t<int key=\"NSWindowStyleMask\">15</int>\n\t\t\t\t<int key=\"NSWindowBacking\">2</int>\n\t\t\t\t<string key=\"NSWindowRect\">{{335, 390}, {480, 360}}</string>\n\t\t\t\t<int key=\"NSWTFlags\">1954021376</int>\n\t\t\t\t<string key=\"NSWindowTitle\">Playground</string>\n\t\t\t\t<string key=\"NSWindowClass\">NSWindow</string>\n\t\t\t\t<nil key=\"NSViewClass\"/>\n\t\t\t\t<nil key=\"NSUserInterfaceItemIdentifier\"/>\n\t\t\t\t<object class=\"NSView\" key=\"NSWindowView\" id=\"439893737\">\n\t\t\t\t\t<nil key=\"NSNextResponder\"/>\n\t\t\t\t\t<int key=\"NSvFlags\">256</int>\n\t\t\t\t\t<string key=\"NSFrameSize\">{480, 360}</string>\n\t\t\t\t</object>\n\t\t\t\t<string key=\"NSScreenRect\">{{0, 0}, {1680, 1028}}</string>\n\t\t\t\t<string key=\"NSMaxSize\">{10000000000000, 10000000000000}</string>\n\t\t\t\t<bool key=\"NSWindowIsRestorable\">YES</bool>\n\t\t\t</object>\n\t\t\t<object class=\"NSCustomObject\" id=\"976324537\">\n\t\t\t\t<string key=\"NSClassName\">PlaygroundAppDelegate</string>\n\t\t\t</object>\n\t\t\t<object class=\"NSCustomObject\" id=\"755631768\">\n\t\t\t\t<string key=\"NSClassName\">NSFontManager</string>\n\t\t\t</object>\n\t\t</array>\n\t\t<object class=\"IBObjectContainer\" key=\"IBDocument.Objects\">\n\t\t\t<array class=\"NSMutableArray\" key=\"connectionRecords\">\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">terminate:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1050\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"632727374\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">449</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">orderFrontStandardAboutPanel:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1021\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"238522557\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">142</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBOutletConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">delegate</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1021\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"976324537\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">495</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performMiniaturize:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1011231497\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">37</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">arrangeInFront:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"625202149\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">39</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">print:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"49223823\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">86</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">runPageLayout:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"294629803\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">87</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">clearRecentDocuments:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"759406840\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">127</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performClose:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"776162233\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">193</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleContinuousSpellChecking:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"948374510\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">222</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">undo:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1058277027\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">223</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">copy:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"860595796\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">224</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">checkSpelling:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"96193923\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">225</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">paste:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"29853731\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">226</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">stopSpeaking:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"680220178\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">227</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">cut:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"296257095\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">228</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">showGuessPanel:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"679648819\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">230</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">redo:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"790794224\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">231</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">selectAll:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"583158037\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">232</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">startSpeaking:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"731782645\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">233</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">delete:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"437104165\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">235</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performZoom:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"575023229\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">240</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performFindPanelAction:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"447796847\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">241</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">centerSelectionInVisibleArea:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"88285865\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">245</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleGrammarChecking:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"967646866\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">347</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleSmartInsertDelete:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"605118523\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">355</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleAutomaticQuoteSubstitution:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"197661976\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">356</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleAutomaticLinkDetection:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"708854459\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">357</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">saveDocument:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1023925487\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">362</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">revertDocumentToSaved:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"579971712\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">364</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">runToolbarCustomizationPalette:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"237841660\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">365</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleToolbarShown:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"102151532\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">366</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">hide:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"755159360\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">367</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">hideOtherApplications:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"342932134\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">368</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">unhideAllApplications:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"908899353\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">370</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">newDocument:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"705341025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">373</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">openDocument:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"722745758\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">374</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">raiseBaseline:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"941806246\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">426</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">lowerBaseline:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1045724900\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">427</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">copyFont:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"596732606\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">428</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">subscript:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1037576581\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">429</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">superscript:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"644725453\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">430</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">tightenKerning:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"677519740\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">431</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">underline:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"330926929\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">432</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">orderFrontColorPanel:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1012600125\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">433</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">useAllLigatures:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"663508465\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">434</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">loosenKerning:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"238351151\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">435</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">pasteFont:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"393423671\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">436</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">unscript:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"257962622\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">437</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">useStandardKerning:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"252969304\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">438</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">useStandardLigatures:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"706297211\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">439</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">turnOffLigatures:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"568384683\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">440</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">turnOffKerning:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"766922938\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">441</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleAutomaticSpellingCorrection:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"795346622\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">456</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">orderFrontSubstitutionsPanel:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"65139061\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">458</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleAutomaticDashSubstitution:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"672708820\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">461</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleAutomaticTextReplacement:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"537092702\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">463</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">uppercaseWord:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"1060694897\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">464</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">capitalizeWord:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"56570060\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">467</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">lowercaseWord:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"879586729\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">468</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">pasteAsPlainText:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"82994268\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">486</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performFindPanelAction:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"326711663\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">487</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performFindPanelAction:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"270902937\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">488</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performFindPanelAction:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"159080638\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">489</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">showHelp:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"105068016\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">493</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">alignCenter:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"630155264\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">518</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">pasteRuler:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"883618387\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">519</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">toggleRuler:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"644046920\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">520</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">alignRight:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"512868991\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">521</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">copyRuler:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"231811626\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">522</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">alignJustified:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"945678886\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">523</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">alignLeft:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"875092757\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">524</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">makeBaseWritingDirectionNatural:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"551969625\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">525</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">makeBaseWritingDirectionLeftToRight:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"249532473\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">526</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">makeBaseWritingDirectionRightToLeft:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"607364498\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">527</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">makeTextWritingDirectionNatural:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"380031999\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">528</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">makeTextWritingDirectionLeftToRight:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"825984362\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">529</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">makeTextWritingDirectionRightToLeft:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"560145579\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">530</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">performFindPanelAction:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"738670835\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">535</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">addFontTrait:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"755631768\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"305399458\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">421</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">addFontTrait:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"755631768\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"814362025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">422</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">modifyFont:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"755631768\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"885547335\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">423</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">orderFrontFontPanel:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"755631768\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"159677712\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">424</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBActionConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">modifyFont:</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"755631768\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"158063935\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">425</int>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBConnectionRecord\">\n\t\t\t\t\t<object class=\"IBOutletConnection\" key=\"connection\">\n\t\t\t\t\t\t<string key=\"label\">window</string>\n\t\t\t\t\t\t<reference key=\"source\" ref=\"976324537\"/>\n\t\t\t\t\t\t<reference key=\"destination\" ref=\"972006081\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<int key=\"connectionID\">532</int>\n\t\t\t\t</object>\n\t\t\t</array>\n\t\t\t<object class=\"IBMutableOrderedSet\" key=\"objectRecords\">\n\t\t\t\t<array key=\"orderedObjects\">\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">0</int>\n\t\t\t\t\t\t<array key=\"object\" id=\"0\"/>\n\t\t\t\t\t\t<reference key=\"children\" ref=\"1048\"/>\n\t\t\t\t\t\t<nil key=\"parent\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">-2</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1021\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t\t<string key=\"objectName\">File's Owner</string>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">-1</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1014\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t\t<string key=\"objectName\">First Responder</string>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">-3</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1050\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t\t<string key=\"objectName\">Application</string>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">29</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"649796088\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"713487014\"/>\n\t\t\t\t\t\t\t<reference ref=\"694149608\"/>\n\t\t\t\t\t\t\t<reference ref=\"952259628\"/>\n\t\t\t\t\t\t\t<reference ref=\"379814623\"/>\n\t\t\t\t\t\t\t<reference ref=\"586577488\"/>\n\t\t\t\t\t\t\t<reference ref=\"302598603\"/>\n\t\t\t\t\t\t\t<reference ref=\"448692316\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">19</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"713487014\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"835318025\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">56</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"694149608\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"110575045\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">217</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"952259628\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"789758025\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">83</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"379814623\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"720053764\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">81</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"720053764\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"1023925487\"/>\n\t\t\t\t\t\t\t<reference ref=\"49223823\"/>\n\t\t\t\t\t\t\t<reference ref=\"722745758\"/>\n\t\t\t\t\t\t\t<reference ref=\"705341025\"/>\n\t\t\t\t\t\t\t<reference ref=\"1025936716\"/>\n\t\t\t\t\t\t\t<reference ref=\"294629803\"/>\n\t\t\t\t\t\t\t<reference ref=\"776162233\"/>\n\t\t\t\t\t\t\t<reference ref=\"425164168\"/>\n\t\t\t\t\t\t\t<reference ref=\"579971712\"/>\n\t\t\t\t\t\t\t<reference ref=\"1010469920\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"379814623\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">75</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1023925487\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">78</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"49223823\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">72</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"722745758\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">82</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"705341025\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">124</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1025936716\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"1065607017\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">77</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"294629803\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">73</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"776162233\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">79</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"425164168\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">112</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"579971712\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">74</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1010469920\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"720053764\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">125</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1065607017\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"759406840\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"1025936716\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">126</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"759406840\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"1065607017\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">205</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"789758025\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"437104165\"/>\n\t\t\t\t\t\t\t<reference ref=\"583158037\"/>\n\t\t\t\t\t\t\t<reference ref=\"1058277027\"/>\n\t\t\t\t\t\t\t<reference ref=\"212016141\"/>\n\t\t\t\t\t\t\t<reference ref=\"296257095\"/>\n\t\t\t\t\t\t\t<reference ref=\"29853731\"/>\n\t\t\t\t\t\t\t<reference ref=\"860595796\"/>\n\t\t\t\t\t\t\t<reference ref=\"1040322652\"/>\n\t\t\t\t\t\t\t<reference ref=\"790794224\"/>\n\t\t\t\t\t\t\t<reference ref=\"892235320\"/>\n\t\t\t\t\t\t\t<reference ref=\"972420730\"/>\n\t\t\t\t\t\t\t<reference ref=\"676164635\"/>\n\t\t\t\t\t\t\t<reference ref=\"507821607\"/>\n\t\t\t\t\t\t\t<reference ref=\"288088188\"/>\n\t\t\t\t\t\t\t<reference ref=\"82994268\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"952259628\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">202</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"437104165\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">198</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"583158037\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">207</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1058277027\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">214</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"212016141\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">199</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"296257095\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">203</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"29853731\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">197</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"860595796\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">206</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1040322652\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">215</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"790794224\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">218</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"892235320\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"963351320\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">216</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"972420730\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"769623530\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">200</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"769623530\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"948374510\"/>\n\t\t\t\t\t\t\t<reference ref=\"96193923\"/>\n\t\t\t\t\t\t\t<reference ref=\"679648819\"/>\n\t\t\t\t\t\t\t<reference ref=\"967646866\"/>\n\t\t\t\t\t\t\t<reference ref=\"859480356\"/>\n\t\t\t\t\t\t\t<reference ref=\"795346622\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"972420730\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">219</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"948374510\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769623530\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">201</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"96193923\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769623530\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">204</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"679648819\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769623530\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">220</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"963351320\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"270902937\"/>\n\t\t\t\t\t\t\t<reference ref=\"88285865\"/>\n\t\t\t\t\t\t\t<reference ref=\"159080638\"/>\n\t\t\t\t\t\t\t<reference ref=\"326711663\"/>\n\t\t\t\t\t\t\t<reference ref=\"447796847\"/>\n\t\t\t\t\t\t\t<reference ref=\"738670835\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"892235320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">213</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"270902937\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"963351320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">210</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"88285865\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"963351320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">221</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"159080638\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"963351320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">208</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"326711663\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"963351320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">209</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"447796847\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"963351320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">57</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"110575045\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"238522557\"/>\n\t\t\t\t\t\t\t<reference ref=\"755159360\"/>\n\t\t\t\t\t\t\t<reference ref=\"908899353\"/>\n\t\t\t\t\t\t\t<reference ref=\"632727374\"/>\n\t\t\t\t\t\t\t<reference ref=\"646227648\"/>\n\t\t\t\t\t\t\t<reference ref=\"609285721\"/>\n\t\t\t\t\t\t\t<reference ref=\"481834944\"/>\n\t\t\t\t\t\t\t<reference ref=\"304266470\"/>\n\t\t\t\t\t\t\t<reference ref=\"1046388886\"/>\n\t\t\t\t\t\t\t<reference ref=\"1056857174\"/>\n\t\t\t\t\t\t\t<reference ref=\"342932134\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"694149608\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">58</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"238522557\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">134</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"755159360\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">150</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"908899353\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">136</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"632727374\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">144</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"646227648\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">129</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"609285721\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">143</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"481834944\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">236</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"304266470\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">131</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1046388886\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"752062318\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">149</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1056857174\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">145</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"342932134\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"110575045\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">130</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"752062318\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"1046388886\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">24</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"835318025\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"299356726\"/>\n\t\t\t\t\t\t\t<reference ref=\"625202149\"/>\n\t\t\t\t\t\t\t<reference ref=\"575023229\"/>\n\t\t\t\t\t\t\t<reference ref=\"1011231497\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"713487014\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">92</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"299356726\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"835318025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">5</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"625202149\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"835318025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">239</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"575023229\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"835318025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">23</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1011231497\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"835318025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">295</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"586577488\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"466310130\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">296</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"466310130\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"102151532\"/>\n\t\t\t\t\t\t\t<reference ref=\"237841660\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"586577488\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">297</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"102151532\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"466310130\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">298</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"237841660\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"466310130\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">211</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"676164635\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"785027613\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">212</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"785027613\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"680220178\"/>\n\t\t\t\t\t\t\t<reference ref=\"731782645\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"676164635\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">195</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"680220178\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"785027613\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">196</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"731782645\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"785027613\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">346</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"967646866\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769623530\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">348</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"507821607\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"698887838\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">349</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"698887838\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"605118523\"/>\n\t\t\t\t\t\t\t<reference ref=\"197661976\"/>\n\t\t\t\t\t\t\t<reference ref=\"708854459\"/>\n\t\t\t\t\t\t\t<reference ref=\"65139061\"/>\n\t\t\t\t\t\t\t<reference ref=\"19036812\"/>\n\t\t\t\t\t\t\t<reference ref=\"672708820\"/>\n\t\t\t\t\t\t\t<reference ref=\"537092702\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"507821607\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">350</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"605118523\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">351</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"197661976\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">354</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"708854459\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">371</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"972006081\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"439893737\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">372</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"439893737\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"972006081\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">375</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"302598603\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"941447902\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">376</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"941447902\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"792887677\"/>\n\t\t\t\t\t\t\t<reference ref=\"215659978\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"302598603\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">377</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"792887677\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"786677654\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"941447902\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">388</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"786677654\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"159677712\"/>\n\t\t\t\t\t\t\t<reference ref=\"305399458\"/>\n\t\t\t\t\t\t\t<reference ref=\"814362025\"/>\n\t\t\t\t\t\t\t<reference ref=\"330926929\"/>\n\t\t\t\t\t\t\t<reference ref=\"533507878\"/>\n\t\t\t\t\t\t\t<reference ref=\"158063935\"/>\n\t\t\t\t\t\t\t<reference ref=\"885547335\"/>\n\t\t\t\t\t\t\t<reference ref=\"901062459\"/>\n\t\t\t\t\t\t\t<reference ref=\"767671776\"/>\n\t\t\t\t\t\t\t<reference ref=\"691570813\"/>\n\t\t\t\t\t\t\t<reference ref=\"769124883\"/>\n\t\t\t\t\t\t\t<reference ref=\"739652853\"/>\n\t\t\t\t\t\t\t<reference ref=\"1012600125\"/>\n\t\t\t\t\t\t\t<reference ref=\"214559597\"/>\n\t\t\t\t\t\t\t<reference ref=\"596732606\"/>\n\t\t\t\t\t\t\t<reference ref=\"393423671\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"792887677\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">389</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"159677712\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">390</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"305399458\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">391</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"814362025\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">392</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"330926929\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">393</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"533507878\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">394</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"158063935\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">395</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"885547335\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">396</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"901062459\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">397</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"767671776\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"175441468\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">398</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"691570813\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"1058217995\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">399</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"769124883\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"18263474\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">400</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"739652853\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">401</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1012600125\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">402</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"214559597\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">403</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"596732606\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">404</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"393423671\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"786677654\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">405</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"18263474\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"257962622\"/>\n\t\t\t\t\t\t\t<reference ref=\"644725453\"/>\n\t\t\t\t\t\t\t<reference ref=\"1037576581\"/>\n\t\t\t\t\t\t\t<reference ref=\"941806246\"/>\n\t\t\t\t\t\t\t<reference ref=\"1045724900\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769124883\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">406</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"257962622\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"18263474\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">407</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"644725453\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"18263474\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">408</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1037576581\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"18263474\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">409</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"941806246\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"18263474\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">410</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1045724900\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"18263474\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">411</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1058217995\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"706297211\"/>\n\t\t\t\t\t\t\t<reference ref=\"568384683\"/>\n\t\t\t\t\t\t\t<reference ref=\"663508465\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"691570813\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">412</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"706297211\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"1058217995\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">413</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"568384683\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"1058217995\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">414</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"663508465\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"1058217995\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">415</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"175441468\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"252969304\"/>\n\t\t\t\t\t\t\t<reference ref=\"766922938\"/>\n\t\t\t\t\t\t\t<reference ref=\"677519740\"/>\n\t\t\t\t\t\t\t<reference ref=\"238351151\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"767671776\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">416</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"252969304\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"175441468\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">417</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"766922938\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"175441468\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">418</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"677519740\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"175441468\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">419</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"238351151\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"175441468\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">420</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"755631768\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">450</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"288088188\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"579392910\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">451</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"579392910\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"1060694897\"/>\n\t\t\t\t\t\t\t<reference ref=\"879586729\"/>\n\t\t\t\t\t\t\t<reference ref=\"56570060\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"288088188\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">452</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"1060694897\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"579392910\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">453</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"859480356\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769623530\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">454</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"795346622\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"769623530\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">457</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"65139061\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">459</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"19036812\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">460</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"672708820\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">462</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"537092702\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"698887838\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">465</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"879586729\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"579392910\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">466</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"56570060\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"579392910\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">485</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"82994268\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"789758025\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">490</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"448692316\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"992780483\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"649796088\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">491</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"992780483\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"105068016\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"448692316\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">492</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"105068016\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"992780483\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">494</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"976324537\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"0\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">496</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"215659978\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"446991534\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"941447902\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">497</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"446991534\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"875092757\"/>\n\t\t\t\t\t\t\t<reference ref=\"630155264\"/>\n\t\t\t\t\t\t\t<reference ref=\"945678886\"/>\n\t\t\t\t\t\t\t<reference ref=\"512868991\"/>\n\t\t\t\t\t\t\t<reference ref=\"163117631\"/>\n\t\t\t\t\t\t\t<reference ref=\"31516759\"/>\n\t\t\t\t\t\t\t<reference ref=\"908105787\"/>\n\t\t\t\t\t\t\t<reference ref=\"644046920\"/>\n\t\t\t\t\t\t\t<reference ref=\"231811626\"/>\n\t\t\t\t\t\t\t<reference ref=\"883618387\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"215659978\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">498</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"875092757\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">499</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"630155264\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">500</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"945678886\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">501</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"512868991\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">502</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"163117631\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">503</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"31516759\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"956096989\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">504</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"908105787\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">505</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"644046920\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">506</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"231811626\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">507</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"883618387\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"446991534\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">508</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"956096989\"/>\n\t\t\t\t\t\t<array class=\"NSMutableArray\" key=\"children\">\n\t\t\t\t\t\t\t<reference ref=\"257099033\"/>\n\t\t\t\t\t\t\t<reference ref=\"551969625\"/>\n\t\t\t\t\t\t\t<reference ref=\"249532473\"/>\n\t\t\t\t\t\t\t<reference ref=\"607364498\"/>\n\t\t\t\t\t\t\t<reference ref=\"508151438\"/>\n\t\t\t\t\t\t\t<reference ref=\"981751889\"/>\n\t\t\t\t\t\t\t<reference ref=\"380031999\"/>\n\t\t\t\t\t\t\t<reference ref=\"825984362\"/>\n\t\t\t\t\t\t\t<reference ref=\"560145579\"/>\n\t\t\t\t\t\t</array>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"31516759\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">509</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"257099033\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">510</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"551969625\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">511</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"249532473\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">512</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"607364498\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">513</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"508151438\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">514</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"981751889\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">515</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"380031999\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">516</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"825984362\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">517</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"560145579\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"956096989\"/>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBObjectRecord\">\n\t\t\t\t\t\t<int key=\"objectID\">534</int>\n\t\t\t\t\t\t<reference key=\"object\" ref=\"738670835\"/>\n\t\t\t\t\t\t<reference key=\"parent\" ref=\"963351320\"/>\n\t\t\t\t\t</object>\n\t\t\t\t</array>\n\t\t\t</object>\n\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"flattenedProperties\">\n\t\t\t\t<string key=\"-1.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"-2.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"-3.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"112.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"124.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"125.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"126.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"129.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"130.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"131.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"134.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"136.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"143.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"144.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"145.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"149.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"150.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"19.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"195.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"196.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"197.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"198.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"199.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"200.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"201.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"202.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"203.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"204.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"205.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"206.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"207.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"208.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"209.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"210.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"211.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"212.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"213.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"214.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"215.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"216.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"217.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"218.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"219.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"220.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"221.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"23.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"236.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"239.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"24.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"29.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"295.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"296.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"297.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"298.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"346.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"348.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"349.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"350.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"351.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"354.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"371.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"371.IBWindowTemplateEditedContentRect\">{{380, 496}, {480, 360}}</string>\n\t\t\t\t<integer value=\"1\" key=\"371.NSWindowTemplate.visibleAtLaunch\"/>\n\t\t\t\t<string key=\"372.CustomClassName\">NSGLView</string>\n\t\t\t\t<string key=\"372.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"375.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"376.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"377.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"388.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"389.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"390.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"391.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"392.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"393.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"394.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"395.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"396.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"397.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"398.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"399.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"400.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"401.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"402.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"403.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"404.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"405.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"406.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"407.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"408.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"409.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"410.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"411.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"412.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"413.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"414.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"415.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"416.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"417.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"418.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"419.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"420.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"450.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"451.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"452.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"453.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"454.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"457.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"459.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"460.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"462.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"465.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"466.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"485.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"490.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"491.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"492.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"494.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"496.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"497.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"498.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"499.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"5.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"500.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"501.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"502.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"503.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"504.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"505.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"506.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"507.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"508.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"509.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"510.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"511.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"512.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"513.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"514.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"515.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"516.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"517.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"534.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"56.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"57.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"58.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"72.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"73.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"74.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"75.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"77.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"78.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"79.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"81.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"82.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"83.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t\t<string key=\"92.IBPluginDependency\">com.apple.InterfaceBuilder.CocoaPlugin</string>\n\t\t\t</dictionary>\n\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"unlocalizedProperties\"/>\n\t\t\t<nil key=\"activeLocalization\"/>\n\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"localizations\"/>\n\t\t\t<nil key=\"sourceID\"/>\n\t\t\t<int key=\"maxID\">535</int>\n\t\t</object>\n\t\t<object class=\"IBClassDescriber\" key=\"IBDocument.Classes\">\n\t\t\t<array class=\"NSMutableArray\" key=\"referencedPartialClassDescriptions\">\n\t\t\t\t<object class=\"IBPartialClassDescription\">\n\t\t\t\t\t<string key=\"className\">NSDocument</string>\n\t\t\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"actions\">\n\t\t\t\t\t\t<string key=\"printDocument:\">id</string>\n\t\t\t\t\t\t<string key=\"revertDocumentToSaved:\">id</string>\n\t\t\t\t\t\t<string key=\"runPageLayout:\">id</string>\n\t\t\t\t\t\t<string key=\"saveDocument:\">id</string>\n\t\t\t\t\t\t<string key=\"saveDocumentAs:\">id</string>\n\t\t\t\t\t\t<string key=\"saveDocumentTo:\">id</string>\n\t\t\t\t\t</dictionary>\n\t\t\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"actionInfosByName\">\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"printDocument:\">\n\t\t\t\t\t\t\t<string key=\"name\">printDocument:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"revertDocumentToSaved:\">\n\t\t\t\t\t\t\t<string key=\"name\">revertDocumentToSaved:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"runPageLayout:\">\n\t\t\t\t\t\t\t<string key=\"name\">runPageLayout:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"saveDocument:\">\n\t\t\t\t\t\t\t<string key=\"name\">saveDocument:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"saveDocumentAs:\">\n\t\t\t\t\t\t\t<string key=\"name\">saveDocumentAs:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"saveDocumentTo:\">\n\t\t\t\t\t\t\t<string key=\"name\">saveDocumentTo:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</dictionary>\n\t\t\t\t\t<object class=\"IBClassDescriptionSource\" key=\"sourceIdentifier\">\n\t\t\t\t\t\t<string key=\"majorKey\">IBProjectSource</string>\n\t\t\t\t\t\t<string key=\"minorKey\">./Classes/NSDocument.h</string>\n\t\t\t\t\t</object>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBPartialClassDescription\">\n\t\t\t\t\t<string key=\"className\">NSGLView</string>\n\t\t\t\t\t<string key=\"superclassName\">NSOpenGLView</string>\n\t\t\t\t\t<object class=\"IBClassDescriptionSource\" key=\"sourceIdentifier\">\n\t\t\t\t\t\t<string key=\"majorKey\">IBProjectSource</string>\n\t\t\t\t\t\t<string key=\"minorKey\">./Classes/NSGLView.h</string>\n\t\t\t\t\t</object>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBPartialClassDescription\">\n\t\t\t\t\t<string key=\"className\">NSTextView</string>\n\t\t\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"actions\">\n\t\t\t\t\t\t<string key=\"orderFrontSharingServicePicker:\">id</string>\n\t\t\t\t\t\t<string key=\"toggleQuickLookPreviewPanel:\">id</string>\n\t\t\t\t\t</dictionary>\n\t\t\t\t\t<dictionary class=\"NSMutableDictionary\" key=\"actionInfosByName\">\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"orderFrontSharingServicePicker:\">\n\t\t\t\t\t\t\t<string key=\"name\">orderFrontSharingServicePicker:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"toggleQuickLookPreviewPanel:\">\n\t\t\t\t\t\t\t<string key=\"name\">toggleQuickLookPreviewPanel:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</dictionary>\n\t\t\t\t\t<object class=\"IBClassDescriptionSource\" key=\"sourceIdentifier\">\n\t\t\t\t\t\t<string key=\"majorKey\">IBProjectSource</string>\n\t\t\t\t\t\t<string key=\"minorKey\">./Classes/NSTextView.h</string>\n\t\t\t\t\t</object>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBPartialClassDescription\">\n\t\t\t\t\t<string key=\"className\">PlaygroundAppDelegate</string>\n\t\t\t\t\t<string key=\"superclassName\">NSObject</string>\n\t\t\t\t\t<object class=\"NSMutableDictionary\" key=\"outlets\">\n\t\t\t\t\t\t<string key=\"NS.key.0\">window</string>\n\t\t\t\t\t\t<string key=\"NS.object.0\">NSWindow</string>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMutableDictionary\" key=\"toOneOutletInfosByName\">\n\t\t\t\t\t\t<string key=\"NS.key.0\">window</string>\n\t\t\t\t\t\t<object class=\"IBToOneOutletInfo\" key=\"NS.object.0\">\n\t\t\t\t\t\t\t<string key=\"name\">window</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">NSWindow</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBClassDescriptionSource\" key=\"sourceIdentifier\">\n\t\t\t\t\t\t<string key=\"majorKey\">IBProjectSource</string>\n\t\t\t\t\t\t<string key=\"minorKey\">./Classes/PlaygroundAppDelegate.h</string>\n\t\t\t\t\t</object>\n\t\t\t\t</object>\n\t\t\t\t<object class=\"IBPartialClassDescription\">\n\t\t\t\t\t<string key=\"className\">WebView</string>\n\t\t\t\t\t<object class=\"NSMutableDictionary\" key=\"actions\">\n\t\t\t\t\t\t<string key=\"NS.key.0\">reloadFromOrigin:</string>\n\t\t\t\t\t\t<string key=\"NS.object.0\">id</string>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"NSMutableDictionary\" key=\"actionInfosByName\">\n\t\t\t\t\t\t<string key=\"NS.key.0\">reloadFromOrigin:</string>\n\t\t\t\t\t\t<object class=\"IBActionInfo\" key=\"NS.object.0\">\n\t\t\t\t\t\t\t<string key=\"name\">reloadFromOrigin:</string>\n\t\t\t\t\t\t\t<string key=\"candidateClassName\">id</string>\n\t\t\t\t\t\t</object>\n\t\t\t\t\t</object>\n\t\t\t\t\t<object class=\"IBClassDescriptionSource\" key=\"sourceIdentifier\">\n\t\t\t\t\t\t<string key=\"majorKey\">IBProjectSource</string>\n\t\t\t\t\t\t<string key=\"minorKey\">./Classes/WebView.h</string>\n\t\t\t\t\t</object>\n\t\t\t\t</object>\n\t\t\t</array>\n\t\t</object>\n\t\t<int key=\"IBDocument.localizationMode\">0</int>\n\t\t<string key=\"IBDocument.TargetRuntimeIdentifier\">IBCocoaFramework</string>\n\t\t<bool key=\"IBDocument.previouslyAttemptedUpgradeToXcode5\">YES</bool>\n\t\t<object class=\"NSMutableDictionary\" key=\"IBDocument.PluginDeclaredDependencyDefaults\">\n\t\t\t<string key=\"NS.key.0\">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>\n\t\t\t<real value=\"1080\" key=\"NS.object.0\"/>\n\t\t</object>\n\t\t<object class=\"NSMutableDictionary\" key=\"IBDocument.PluginDeclaredDevelopmentDependencies\">\n\t\t\t<string key=\"NS.key.0\">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>\n\t\t\t<integer value=\"4600\" key=\"NS.object.0\"/>\n\t\t</object>\n\t\t<bool key=\"IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion\">YES</bool>\n\t\t<int key=\"IBDocument.defaultPropertyAccessControl\">3</int>\n\t\t<dictionary class=\"NSMutableDictionary\" key=\"IBDocument.LastKnownImageSizes\">\n\t\t\t<string key=\"NSMenuCheckmark\">{11, 11}</string>\n\t\t\t<string key=\"NSMenuMixedState\">{10, 3}</string>\n\t\t</dictionary>\n\t\t<bool key=\"IBDocument.UseAutolayout\">YES</bool>\n\t</data>\n</archive>\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/glUtil.h",
    "content": "/*\n File: glUtil.h\n Abstract:\n Includes the appropriate OpenGL headers (depending on whether this\n is built for iOS or OSX) and provides some API utility functions\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __GL_UTIL_H__\n#define __GL_UTIL_H__\n\n#if ESSENTIAL_GL_PRACTICES_IOS\n\n#import <OpenGLES/ES2/gl.h>\n#import <OpenGLES/ES2/glext.h>\n\n#else\n\n#import <OpenGL/OpenGL.h>\n\n// OpenGL 3.2 is only supported on MacOS X Lion and later\n// CGL_VERSION_1_3 is defined as 1 on MacOS X Lion and later\n#if CGL_VERSION_1_3\n// Set to 0 to run on the Legacy OpenGL Profile\n#define ESSENTIAL_GL_PRACTICES_SUPPORT_GL3 1\n#else\n#define ESSENTIAL_GL_PRACTICES_SUPPORT_GL3 0\n#endif //!CGL_VERSION_1_3\n\n#if ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n#import <OpenGL/gl3.h>\n#else\n#import <OpenGL/gl.h>\n#endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n\n#endif // !ESSENTIAL_GL_PRACTICES_IOS\n\n\n//The name of the VertexArrayObject are slightly different in\n// OpenGLES, OpenGL Core Profile, and OpenGL Legacy\n// The arguments are exactly the same across these APIs however\n#if ESSENTIAL_GL_PRACTICES_IOS\n#define glBindVertexArray glBindVertexArrayOES\n#define glGenVertexArrays glGenVertexArraysOES\n#define glDeleteVertexArrays glDeleteVertexArraysOES\n#else\n#if ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n#define glBindVertexArray glBindVertexArray\n#define glGenVertexArrays glGenVertexArrays\n#define glGenerateMipmap glGenerateMipmap\n#define glDeleteVertexArrays glDeleteVertexArrays\n#else\n#define glBindVertexArray glBindVertexArrayAPPLE\n#define glGenVertexArrays glGenVertexArraysAPPLE\n#define glGenerateMipmap glGenerateMipmapEXT\n#define glDeleteVertexArrays glDeleteVertexArraysAPPLE\n#endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n#endif //!ESSENTIAL_GL_PRACTICES_IOS\n\nstatic inline const char *GetGLErrorString(GLenum error) {\n\tconst char *str;\n\tswitch (error) {\n\t\tcase GL_NO_ERROR:\n\t\t\tstr = \"GL_NO_ERROR\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_ENUM:\n\t\t\tstr = \"GL_INVALID_ENUM\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_VALUE:\n\t\t\tstr = \"GL_INVALID_VALUE\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_OPERATION:\n\t\t\tstr = \"GL_INVALID_OPERATION\";\n\t\t\tbreak;\n            \n#if defined __gl_h_ || defined __gl3_h_\n\t\tcase GL_OUT_OF_MEMORY:\n\t\t\tstr = \"GL_OUT_OF_MEMORY\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_FRAMEBUFFER_OPERATION:\n\t\t\tstr = \"GL_INVALID_FRAMEBUFFER_OPERATION\";\n\t\t\tbreak;\n            \n#endif\n#if defined __gl_h_\n\t\tcase GL_STACK_OVERFLOW:\n\t\t\tstr = \"GL_STACK_OVERFLOW\";\n\t\t\tbreak;\n            \n\t\tcase GL_STACK_UNDERFLOW:\n\t\t\tstr = \"GL_STACK_UNDERFLOW\";\n\t\t\tbreak;\n            \n\t\tcase GL_TABLE_TOO_LARGE:\n\t\t\tstr = \"GL_TABLE_TOO_LARGE\";\n\t\t\tbreak;\n            \n#endif\n\t\tdefault:\n\t\t\tstr = \"(ERROR: Unknown Error Enum)\";\n\t\t\tbreak;\n\t}\n\treturn str;\n}\n\n#endif // __GL_UTIL_H__\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/imageUtil.h",
    "content": "/*\n     File: imageUtil.h\n Abstract: \n Functions for loading an image files for textures.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __IMAGE_UTIL_H__\n#define __IMAGE_UTIL_H__\n\n#include \"glUtil.h\"\n\ntypedef struct demoImageRec\n{\n\tGLubyte* data;\n\t\n\tGLsizei size;\n\t\n\tGLuint width;\n\tGLuint height;\n\tGLenum format;\n\tGLenum type;\n\t\n\tGLuint rowByteSize;\n\t\n} demoImage;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n    \ndemoImage* imgLoadImage(const char* filepathname, int flipVertical);\n\nvoid imgDestroyImage(demoImage* image);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif //__IMAGE_UTIL_H__\n\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/imageUtil.m",
    "content": "/*\n     File: imageUtil.m\n Abstract: \n Functions for loading an image files for textures.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#include \"imageUtil.h\"\n\n#if ESSENTIAL_GL_PRACTICES_IOS\n#import <UIKit/UIKit.h>\n#else\n#import <Cocoa/Cocoa.h>\n#endif\n\ndemoImage* imgLoadImage(const char* filepathname, int flipVertical)\n{\n\tNSString *filepathString = [[NSString alloc] initWithUTF8String:filepathname];\n\t\n#if ESSENTIAL_GL_PRACTICES_IOS\n\tUIImage* imageClass = [[UIImage alloc] initWithContentsOfFile:filepathString];\n#else   \n    NSImage *nsimage = [[NSImage alloc] initWithContentsOfFile: filepathString];\n\t\n\tNSBitmapImageRep *imageClass = [[NSBitmapImageRep alloc] initWithData:[nsimage TIFFRepresentation]];\n\t[nsimage release];\n#endif\n\t\n\tCGImageRef cgImage = imageClass.CGImage;\n\tif (!cgImage)\n\t{ \n\t\t[filepathString release];\n\t\t[imageClass release];\n\t\treturn NULL;\n\t}\n\t\n\tdemoImage* image = malloc(sizeof(demoImage));\n\timage->width = CGImageGetWidth(cgImage);\n\timage->height = CGImageGetHeight(cgImage);\n\timage->rowByteSize = image->width * 4;\n\timage->data = malloc(image->height * image->rowByteSize);\n\timage->format = GL_RGBA;\n\timage->type = GL_UNSIGNED_BYTE;\n\t\n\tCGContextRef context = CGBitmapContextCreate(image->data, image->width, image->height, 8, image->rowByteSize, CGImageGetColorSpace(cgImage), kCGImageAlphaNoneSkipLast);\n\tCGContextSetBlendMode(context, kCGBlendModeCopy);\n\tif(flipVertical)\n\t{\n\t\tCGContextTranslateCTM(context, 0.0, image->height);\n\t\tCGContextScaleCTM(context, 1.0, -1.0);\n\t}\n\tCGContextDrawImage(context, CGRectMake(0.0, 0.0, image->width, image->height), cgImage);\n\tCGContextRelease(context);\n\t\n\tif(NULL == image->data)\n\t{\n\t\t[filepathString release];\n\t\t[imageClass release];\n\t\t\n\t\timgDestroyImage(image);\n\t\treturn NULL;\n\t}\n\t\n\t[filepathString release];\n\t[imageClass release];\t\n\t\n\treturn image;\n}\n\nvoid imgDestroyImage(demoImage* image)\n{\n\tfree(image->data);\n\tfree(image);\n}"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/AppDelegate.h",
    "content": "@class ViewController;\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@property (strong, nonatomic) ViewController *viewController;\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CSockReadStream.h",
    "content": "#ifndef CSockReadStream_h\n#define CSockReadStream_h\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n\nclass CSockWriteStream;\n\n// ファイルアクセスクラス実装\nclass CSockReadStream : public IReadStream\n{\n\tfriend class CSockWriteStream;\nprivate:\n\tenum {\n\t\tREAD_BUFSIZ = 4096\n\t};\n\t// ファクトリとなるクラスメソッド以外で勝手に new はできない\n\tCSockReadStream();\n    \npublic:\n\t// delete はできる。\n\tvirtual ~CSockReadStream();\n    \n\t// 指定されたIPアドレスまたはFQDNとPORTで CSockReadStream インスタンスを作り、そのポインタを返す。\n\t// このクラスメソッドはプラットフォーム側のために用意され、ゲーム側では IReadStream のポインタとして\n\t// 扱われるため、このメソッドを扱うことは出来ない(可能ではあるが推奨されない)\n\tstatic CSockReadStream *openStream(const char *path);\n    \n    \n\ts32 getSize();\n\ts32 getPosition();\n\tu8 readU8();\n\tu16 readU16();\n\tu32 readU32();\n\tfloat readFloat();\n\tbool readBlock(void *buffer, u32 byteSize);\n\tESTATUS getStatus();\n    \n\tint readU16arr(u16 *pBufferU16, int items);\n\tint readU32arr(u32 *pBufferU32, int items);\n    \n    \n\tIWriteStream *getWriteStream();\n    \nprivate:\n\tint sock_connect(const char *hostname, int port);\n\tbool readRingBuf();\n\tbool requestData(unsigned char *buf, size_t size);\n\tbool setStatus();\n    \n\tinline size_t left_size() {\n\t\tsize_t leftSize = 0;\n\t\tif (m_lastPos > m_getPos) {\n\t\t\tleftSize = m_lastPos - m_getPos;\n\t\t}\n\t\telse if (m_lastPos < m_getPos) {\n\t\t\tleftSize = m_lastPos + READ_BUFSIZ - m_getPos;\n\t\t}\n\t\telse {\n\t\t\tif (m_lastPos) {\n\t\t\t\tleftSize = READ_BUFSIZ;\n\t\t\t}\n\t\t}\n\t\treturn leftSize;\n\t}\n    \nprivate:\n\tESTATUS m_eStat;\n\tint m_fd;\n    \n\t// 読み込みバッファ: 受信データは一度このバッファを経由する。\n\tu8 m_readBuf[READ_BUFSIZ];\n\tint m_lastPos;          // データ終端\n\tint m_getPos;           // データ始端\n    \n\t// 同じ fd を使用して送出に使用される CSockWriteStream のポインタ\n\tCSockWriteStream *m_writeStream;\n};\n\n\n#endif // CSockReadStream_h\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CSockWriteStream.h",
    "content": "#ifndef CSockWriteStream_h\n#define CSockWriteStream_h\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n\nclass CSockReadStream;\n\n// ファイルアクセスクラス実装\nclass CSockWriteStream : public IWriteStream\n{\n\tfriend class CSockReadStream;\nprivate:\n\tCSockWriteStream(CSockReadStream & rdStream);\n\tvirtual ~CSockWriteStream();\n    \n\tbool sendData(unsigned char *buffer, size_t sndSize);\n    \npublic:\n\tESTATUS getStatus();\n\ts32 getPosition();\n\tvoid writeU8(u8 value);         // Use cast to support s8\n\tvoid writeU16(u16 value);           // Use cast to support s16\n\tvoid writeU32(u32 value);           // Use cast to support s32\n\tvoid writeFloat(float);\n\tvoid writeBlock(void *buffer, u32 byteSize);\n    \nprivate:\n\tint m_fd;\n\tESTATUS m_eStat;\n};\n\n#endif // CSockWriteStream_h\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSAudio.h",
    "content": "#ifndef CiOSAudio_h\n#define CiOSAudio_h\n\n\n#import <GLKit/GLKit.h>\n#import <mach/time_value.h>\n#import <Foundation/Foundation.h>\n#import <AudioToolbox/AudioToolbox.h>\n#import <AudioToolbox/ExtendedAudioFile.h>\n#import <AudioToolbox/AudioFile.h>\n#include \"CSoundAnalysis.h\"\n#include \"encryptFile.h\"\n\nclass CiOSPlatform;\nclass CiOSAudio;\nclass CiOSAudioSession;\n\n\nclass cAudioFadeParam\n{\n\tfriend class CiOSAudio;\n\tfriend class CiOSAudioSession;\npublic:\n\tcAudioFadeParam();\n\tvirtual ~cAudioFadeParam();\n    \n\tvoid attach();\n\tvoid detach();\n\tvoid exec();\n\tbool setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType = INTER_TYPE_LINEAR, float _startVolume = 1.0f);\n    \n\tstatic void AudioFadeParamInit();\n\tstatic void AudioFadeParamExit();\n\tstatic void SetFadeParam(CiOSAudio *_audio, CiOSAudioSession *_settion, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType = INTER_TYPE_LINEAR, float _startVolume = 0.0f);\n\tstatic void Remove(void *_audio);\n\tstatic s32 ThreadAudioFadeParam(void *hThread, void *data);\n    \npublic:\n\t// フェード関係のパラメータ\n\tenum FADE_TYPE {\n\t\tFADE_TYPE_NONE = 0,\n\t\tFADE_TYPE_PLAY,         //!< fade in\n\t\tFADE_TYPE_STOP,         //!< fade out\n\t\tFADE_TYPE_PAUSE,        //!< fade out\n\t\tFADE_TYPE_RESUME,       //!< fade in\n\t\tFADE_TYPE_PLAYING,      //!< fade\n        \n\t\tFADE_TYPE_NUM,\n\t};\n    \n\tenum INTER_TYPE {\n\t\tINTER_TYPE_NONE = 0,\n\t\tINTER_TYPE_LINEAR,         //!< Linear\n        \n\t\tINTER_TYPE_NUM,\n\t};\n    \nprivate:\n\ts32 m_fadeCnt;                          //!< フェードカウント(ミリ秒)\n\tfloat m_startVol;                       //!< フェード開始のボリューム値(0.0f~1.0f)\n\tfloat m_endVol;                         //!< フェード終了のボリューム値(0.0f~1.0f)\n\tfloat m_fadeRatio;                      //!< フェード割合(0.0f〜1.0f)\n\ts32 m_fadeMiliSec;                      //!< フェードに要する時間(ミリ秒)\n\ts16 m_nowFadeInterType;                 //!< 現在のフェード補間タイプ\n\ts16 m_nowFadeType;                      //!< 現在のフェードタイプ\n\tbool m_bfade;                           //!< フェード中？\n\ts64 m_prevmseq;                         //!< 前回の再生時間\n    \n\tCiOSAudio *m_pAudio;                    //!< 対象者\n\tCiOSAudioSession *m_pSession;           //!< 対象者\n    \n\tcAudioFadeParam *m_prev;    //!< 前のフェードパラメータ\n\tcAudioFadeParam *m_next;    //!< 次のフェードパラメータ\n    \n\tstatic cAudioFadeParam *s_fadeParamList;\n\tstatic void *s_fadeParamThread;\n};\n\nclass CiOSAudioSession\n{\n\tfriend class CiOSAudio;\nprivate:\n\tCiOSAudioSession(CiOSAudio * pAudio);\n\tvirtual ~CiOSAudioSession();\n    \n\tvoid init();\n    \npublic:\n\tvoid play();\n\tvoid stop();\n\tvoid pause();\n\tvoid resume();\n\ts64 tell();\n\tvoid checkSessionStoped();\n    \n\tinline bool isPlaying() {\n\t\treturn m_isPlaying;\n\t}\n    \n\tinline bool isPause() {\n\t\treturn m_isPause;\n\t}\n    \n\tinline float getFadeRatio(void) {\n\t\treturn m_fadeRatio;\n\t}\n    \n\tvoid setFadeRatio(float _fadeRatio);\n    \nprivate:\n\tCiOSAudioSession *m_prev;\n\tCiOSAudioSession *m_next;\n    \n\tCiOSAudio *m_audio;\n\tAudioUnit m_audioUnit;\n    \n\tSInt64 m_currentFrame;              //!< 現在の再生フレーム\n\tbool m_isDone;                      //!< 再生終了？\n\tbool m_isPlaying;                   //!< 再生中？\n\tbool m_isPause;                     //!< pause中？\n    \n\tfloat m_volume;                     //!< ボリューム(0.0f~1.0f)\n\tfloat m_panL;                       //!< 左ボリューム\n\tfloat m_panR;                       //!< 右ボリューム\n    \n\tfloat m_fadeRatio;\n    \n\tOSStatus callbackSE(AudioUnitRenderActionFlags *ioActionFlags,\n\t                    const AudioTimeStamp *      inTimeStamp,\n\t                    UInt32                      inBusNumber,\n\t                    UInt32                      inNumberFrames,\n\t                    AudioBufferList *           ioData);\n    \n\tstatic OSStatus renderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,\n\t                               const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData);\n};\n\nclass AudioFileMemory\n{\npublic:\n\tAudioFileMemory();\n\t~AudioFileMemory()\n\t{\n\t}\n    \npublic:\n\tu8 *m_decryptBuffer;\n\tu32 m_dataLength;\n    \npublic:\n\tbool loadFile(const char *url);\n\tvoid release();\n    \nprivate:\n\tCDecryptBaseClass m_decrypter;\n\tinline void decrypt(void *ptr, u32 length) {\n\t\tm_decrypter.decryptBlck(ptr, length);\n\t}\n    \n\tinline u32 decryptSetup(const u8 *ptr, const u8 *hdr) {\n\t\treturn m_decrypter.decryptSetup(ptr, hdr);\n\t}\n};\n\nclass CiOSAudio\n{\n\tfriend class CiOSAudioSession;\nprivate:\n\ttypedef struct {\n\t\tconst char *top;\n\t\tconst char *phisical;\n\t} LOCLIST;\n\tstatic const LOCLIST m_toplevel[];\n    \npublic:\n\tCiOSAudio();\n\tvirtual ~CiOSAudio();\n    \n\tbool openAudio(const char *path, CiOSPlatform *platform);\n\tbool loadMem(); // オンメモリ化\n    \n\tinline void setLuaPause(bool _bLuaPause) {\n\t\tm_luaPause = _bLuaPause;\n\t}\n    \n\tinline bool getLuaPause(void) {\n\t\treturn m_luaPause;\n\t}\n    \n\tvoid play(s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 1.0f);\n\tvoid stop(s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid pause(s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid resume(s32 _msec = 0, float _tgtVol = 1.0f);\n\tvoid seek(s32 millisec);\n\ts32 tell();\n\ts32 totalPlayTime();\n    \n\tvoid setFadeParam(float _tgtVol, u32 _msec);\n    \n\tinline float getFadeRatio(void) {\n\t\treturn m_fadeRatio;\n\t}\n    \n\tvoid setFadeRatio(float _fadeRatio);\n\ts32 getState();\n    \n\tvoid closeAudio();\n    \n\tvoid setVolume(float volume);\n    \n\tinline float getVolume() {\n\t\treturn m_volume;\n\t}\n    \n\tvoid setPan(float pan);\n    \n\tinline float getPan() {\n\t\treturn m_pan;\n\t}\n    \n\tinline bool isActive() {\n\t\treturn m_bActive;\n\t}\n    \n\tinline int getInterruptionType() {\n\t\treturn m_interruptionType;\n\t}\n    \n\tinline void setInterruptionType(int _interruptionType) {\n\t\tm_interruptionType = _interruptionType;\n\t}\n    \n\tinline bool setBufSize(int level) {\n\t\tif (level < 0 || level > 2) return false;\n\t\tm_buf_level = level;\n\t\treturn true;\n\t}\n    \n\tvoid updateVolume();\n\tvoid checkSessionStoped();\n\tvoid audioSessionCleanup();\n    \nprivate:\n\tenum {\n\t\tBUF_COUNT = 3\n\t};\n\tenum {\n\t\tSTEP_WAIT,\n\t\tSTEP_PLAY,\n\t\tSTEP_PAUSE\n\t};\n\tconst char *m_soundPath;\n\t// char                         *   m_soundFullpath;\n\tbool m_bActive;\n\tbool m_preLoad;\n\tbool m_bInit;\n\tbool m_bSeeked;\n\tint m_interruptionType;                                    //!< サウンドの割り込みタイプ\n\tbool m_luaPause;\n    \n\tint m_buf_level;\n\tint m_step;\n    \n\tNSURL *m_soundURL;\n\tAudioFileID m_audioID;\n\tAudioStreamBasicDescription m_ASBD;\n\tAudioStreamPacketDescription *m_ASPD;\n\tAudioQueueRef m_queue;\n\tAudioQueueBufferRef m_qBuf[BUF_COUNT];\n\tAudioQueueTimelineRef m_TlineRef;\n    \n\tint m_bufIndex;\n    \n\tUInt64 m_numPacketPerTime;\n\tUInt32 m_maxPacketSize;\n\tSInt64 m_startPackNum;\n\tSInt64 m_pauseTime;\n\ts32 m_nowPlayTime;                                  // BGMの現在再生時刻\n\tuint64_t m_tval;\n\tuint64_t m_last_delta;\n    \n    \n\tfloat m_volume;\n\tfloat m_pan;\n\tfloat m_panR;\n\tfloat m_panL;\n    \n\tfloat m_fadeRatio;\n\tsSoundAnalysisData m_soundAnalysisData;\n    \n\tExtAudioFileRef m_extAudioID;\n\tAudioStreamBasicDescription m_clientFormat;\n\tSInt64 m_totalFrames;\n    \n\tAudioUnitSampleType **m_playBuffer;\n    \n\tCiOSAudioSession *m_begin;\n\tCiOSAudioSession *m_end;\n    \n\tCiOSPlatform *m_platform;\n\tAudioFileMemory m_encFile;\nprivate:\n\tvoid initBGM();\n\tvoid playBGM();\n\tvoid initSE();\n\tvoid playSE(s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 1.0f);\n    \n\tvoid cleanup();\n    \n\tvoid sendQueue(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer);\n    \n\tstatic void queueCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer);\n};\n\n#endif // CiOSAudio_h\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSAudioManager.h",
    "content": "#ifndef CiOSAudioManager_h\n#define CiOSAudioManager_h\n\n\n#import <GLKit/GLKit.h>\n#import <mach/time_value.h>\n#import <Foundation/Foundation.h>\n#import <AudioToolbox/AudioToolbox.h>\n#import <AudioToolbox/ExtendedAudioFile.h>\n#import <AudioToolbox/AudioFile.h>\n\n#import \"CiOSPlatform.h\"\n#import \"CiOSAudio.h\"\n\n#define IOS_HARDWARE_IO_BUFFER_SIZE     (256)   // IOバッファサイズ(最小128の最大1024くらいまでの2の乗数倍の値推奨)\n\nclass CiOSAudioManager\n{\npublic:\n\t// サウンドの割り込みタイプ\n\tenum eINTERRUPTION_TYPE {\n\t\teINTERRUPTION_TYPE_NONE = -1,\n        \n\t\teINTERRUPTION_TYPE_CALLING = 0,         //!< 電話、Siriなどの割り込み\n\t\teINTERRUPTION_TYPE_RESIGN_ACTIVE,       //!< ホームボタンダブルタップなどによる非アクティブ状態\n\t\teINTERRUPTION_TYPE_ENTER_BACKGROUND,    //!< ホームボタンなどによるアプリがバックグラウンドにある状態\n        \n\t\teINTERRUPTION_TYPE_MAX\n\t};\n    \nprivate:\n\tCiOSAudioManager();\n\tvirtual ~CiOSAudioManager();\n\tconst CiOSAudioManager& operator = (const CiOSAudioManager &_manager) { return *this; }\n    \npublic:\n\t//! インスタンスの取得\n\tstatic CiOSAudioManager& GetInstance(void) {\n\t\treturn m_instance;\n\t}\n    \n\t//! 初期化処理\n\tbool Initialize(void);\n    \n\t//! 終了処理\n\tbool Termination(void);\n    \n\t//! サウンドハンドル作成\n\tvoid *CreateAudioHandle(const char *_url, CiOSPlatform *_platform);\n    \n\t//! AudioSessionの初期化\n\tbool AudioSessionInit(void);\n    \n\t//! AudioSessionプロパティの設定\n\tbool AudioSessionPropertySetting(void);\n    \n\t//! 割り込み開始処理\n\tvoid AudioBeginInterruption(void);\n    \n\t//! 割り込み終了処理\n\tvoid AudioEndInterruption(void);\n    \n\t//! 非アクティブになる瞬間の処理\n\tvoid AudioDidResignActive(void);\n    \n\t//! アクティブに戻る瞬間の処理\n\tvoid AudioDidBecomeActive(void);\n    \n\t//! バックグラウンドに行く瞬間の処理\n\tvoid AudioDidEnterBackground(void);\n    \n\t//! バックグラウンドから戻る際の処理\n\tvoid AudioDidEnterForeground(void);\n    \n\t//! サウンドとミュージックの並行処理タイプ\n\tvoid SetAudioMultiProcessType(s32 _type);\n    \n\tinline s32 GetAudioMultiProcessType(void) {\n\t\treturn m_multiProcessType;\n\t}\n    \n\t//! サウンドの割り込み処理をエンジン側で制御するかどうか\n\tinline void setPauseOnInterruption(bool _bPauseOnInterruption) {\n\t\tm_bPauseOnInterruption = _bPauseOnInterruption;\n\t}\n    \n\tinline bool getPauseOnInterruption(void) {\n\t\treturn m_bPauseOnInterruption;\n\t}\n    \n\t//! iPodミュージックプレーヤーの再生状態取得\n\tbool isMusicPlayerPlaying(void);\n    \n\t//! 音量設定\n\tvoid SetSEMasterVolume(float _vol);\n\tvoid SetBGMMasterVolume(float _vol);\n\tfloat GetSEMasterVolume(void);\n\tfloat GetBGMMasterVolume(void);\n\tvoid UpdateVolume(void);\n    \n\t//! 現在の設定によりマスターボリュームのON/OFF\n\tvoid chackAudioMasterVolume(void);\n    \n\t//! 毎フレーム行う処理\n\tvoid Exec(void);\n    \nprivate:\n\tstatic CiOSAudioManager m_instance;\n    \nprivate:\n\tenum {\n\t\tSND_SLOT = 256     // サウンドスロット数\n\t};\n\tCiOSAudio m_audio[SND_SLOT];\n    \n\t// サウンドとミュージックの並行処理タイプ\n\ts32 m_multiProcessType;\n    \n\t// ボリューム関係\n\tfloat m_masterVol_se;           //!< SEのマスターボリューム\n\tfloat m_masterVol_bgm;          //!< BGMのマスターボリューム\n    \n\t// サウンドのON/OFF\n\tbool m_bSEOff;                  //!< SE\n\tbool m_bBGMOff;                 //!< BGM\n    \n\t//\n\tbool m_bInit;                   //!< 初期化フラグ\n    \n\tbool m_bPauseOnInterruption;        //!< サウンドのPauseをエンジン側で制御するかどうか\n};\n\n#endif // CiOSAudioManager_h\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSMovieView.h",
    "content": "#ifndef CiOSMovieView_h\n#define CiOSMovieView_h\n\n\n#import <AVFoundation/AVFoundation.h>\n\n@interface CiOSMovieView {\n}\n\n@end\n\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSPathConv.h",
    "content": "#ifndef CiOSPathConv_h\n#define CiOSPathConv_h\n\n#include \"iOSFileLocation.h\"\n\nclass CiOSPathConv\n{\nprivate:\n\tCiOSPathConv();\n\tvirtual ~CiOSPathConv();\n    \npublic:\n\tstatic CiOSPathConv& getInstance();\n    \n\tconst char *fullpath(const char *url, const char *suffix = 0, bool *isReadOnly = NULL);\n    \n\tconst char *install() {\n\t\tbuild(); return m_install;\n\t}\n    \n\tconst char *external() {\n\t\tbuild(); return m_external;\n\t}\n    \nprivate:\n\tconst char *makePath(const char *path, const char *suffix, const char *base);\n\tbool checkExists(const char *path);\n    \n\tvoid build();\n\tvoid create_external();\n\tvoid create_install();\n    \nprivate:\n\tbool m_build;\n\tconst char *m_external;\n\tconst char *m_install;\n};\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSPlatform.h",
    "content": "/*!\n ¥brief     iOS 用プラットフォーム側インタフェースクラス\n ¥file      CiOSPlatform.h\n ¥author    Yoshihito Kira\n */\n#ifndef CiOSPlatform_h\n#define CiOSPlatform_h\n\n#import <StoreKit/StoreKit.h>\n#import \"ViewController.h\"\n#include \"CPFInterface.h\"\n#include \"FileSystem.h\"\n#include \"CiOSAudioManager.h\"\n#include \"CiOSWidget.h\"\n#include \"EAGLView.h\"\n\nclass CiOSPlatform : public IPlatformRequest\n{\n\tfriend class CiOSWidget;\n\tfriend class CiOSTextWidget;\n\tfriend class CiOSFont;\n\tfriend void assertFunction(int line, const char *file, const char *msg, ...);\n    \npublic:\n\tCiOSPlatform(EAGLView * pView, float scale);\n\tvirtual ~CiOSPlatform();\n    \n\tvoid detailedLogging(const char *basefile, const char *functionName, int lineNo, const char *format, ...);\n\tvoid logging(const char *format, ...);\n    \n\tconst char *getBundleVersion();\n    \n\t//! Use Encryption for disk I/O\n\tvirtual bool useEncryption();\n    \n\ts64 nanotime();\n    \n\t// ファイルシステム\n\tIReadStream *openReadStream(const char *filename, bool decrypt);\n    \n\tITmpFile *openTmpFile(const char *tmpPath);\n\tvoid removeTmpFile(const char *tmpPath);\n\tvirtual bool removeFileOrFolder(const char *filePath);\n\tvirtual u32 getFreeSpaceExternalKB();\n\tvirtual u32 getPhysicalMemKB();\n\tvoid excludePathFromBackup(const char *fullpath);\n    \n\tvirtual void *ifopen(const char *name, const char *mode);\n\tvirtual void ifclose(void *file);\n\tvirtual int ifseek(void *file, long int offset, int origin);\n\tvirtual u32 ifread(void *ptr, u32 size, u32 count, void *file);\n\tvirtual u32 ifwrite(const void *ptr, u32 size, u32 count, void *file);\n\tvirtual int ifflush(void *file);\n\tvirtual long int iftell(void *file);\n\tvirtual bool icreateEmptyFile(const char *name);\n    \n\t// サウンド系\n\tvoid *loadAudio(const char *url, bool is_se = false);\n\tbool preLoad(void *handle);\n\tbool setBufSize(void *handle, int level);\n\tvoid playAudio(void *handle, s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 0.0f);\n\tvoid stopAudio(void *handle, s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid setMasterVolume(float volume, bool SEmode);\n\tvoid setAudioVolume(void *handle, float volume);\n\tvoid setAudioPan(void *handle, float pan);\n\tvoid releaseAudio(void *handle);\n    \n\tvoid pauseAudio(void *handle, s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid resumeAudio(void *handle, s32 _msec = 0, float _tgtVol = 1.0f);\n\tvoid seekAudio(void *handle, s32 millisec);\n\ts32 tellAudio(void *handle);\n\ts32 totalTimeAudio(void *handle);\n\tvoid setFadeParam(void *_handle, float _tgtVol, u32 _msec);\n    \n\ts32 getState(void *handle);\n    \n\t//! サウンドとミュージックの並行処理タイプ設定\n\tvoid setAudioMultiProcessType(s32 _processType);\n    \n\t//! サウンドの割り込み処理をエンジン側で制御するかどうか\n\tvoid setPauseOnInterruption(bool _bPauseOnInterruption);\n    \n\t//! 経過時間を取得(sec)\n\ts64 getElapsedTime(void);\n    \n\t//! フォント取得\n\tbool registerFont(const char *logicalName, const char *physFile, bool default_);\n\tvoid *getFont(int size, const char *fontName = 0, float *pAscent = NULL);\n\tvoid *getFontSystem(int size, const char *fontName = 0);\n    \n\t//! フォント破棄\n\tvoid deleteFont(void *pFont);\n\tvoid deleteFontSystem(void *pFont);\n    \n\t//! フォントテクスチャ描画\n\tbool renderText(const char *utf8String, void *pFont, u32 color,     //!< 描画する文字列とフォントの指定\n\t                u16 width, u16 height, u8 *pBuffer8888,             //!< 描画対象とするテクスチャバッファとそのピクセルサイズ\n\t                s16 stride, s16 base_x, s16 base_y, bool use4444);                //!< baseline起点とするテクスチャ内の位置\n    \n\t// フォントテクスチャ描画情報\n\tbool getTextInfo(const char *utf8String, void *pFont, STextInfo *pReturnInfo);\n    \n\tvoid *getGLExtension(const char *ext);\n    \n\t// 環境上でのフルパス取得\n\tconst char *getFullPath(const char *assetPath, bool *isReadOnly);\n    \n\t//! 動作環境情報文字列を返す。\n\tconst char *getPlatform();\n    \n\t//! OSコントロールの生成と破棄\n\tIWidget *createControl(IWidget::CONTROL type, int id,\n\t                       const char *caption, int x, int y, int width, int height, ...);\n\tvoid destroyControl(IWidget *pControl);\n    \n\tbool callApplication(APP_TYPE type, ...);\n    \n\tvoid *createThread(s32 (*thread_func)(void *hThread, void *data), void *data);\n\tvoid exitThread(void *hThread, s32 status);\n\tbool watchThread(void *hThread, s32 *status);\n\tvoid deleteThread(void *hThread);\n\tvoid breakThread(void *hThread);\n    \n\tint genUserID(char *retBuf, int maxlen);\n\tint genUserPW(const char *salt, char *retBuf, int maxlen);\n    \n\tbool readyDevID();\n\tint getDevID(char *retBuf, int maxlen);\n    \n\tbool setSecureDataID(const char *service_name, const char *user_id);\n\tbool setSecureDataPW(const char *service_name, const char *pw);\n\tint getSecureDataID(const char *service_name, char *retBuf, int maxlen);\n\tint getSecureDataPW(const char *service_name, char *retBuf, int maxlen);\n    \n\tbool delSecureDataID(const char *service_name);\n\tbool delSecureDataPW(const char *service_name);\n    \n\tvoid initStoreTransactionObserver(void);\n\tvoid releaseStoreTransactionObserver(void);\n\tvoid buyStoreItems(const char *item_id);\n\tvoid getStoreProducts(const char *json, bool currency_mode);\n\tvoid finishStoreTransaction(const char *receipt);\n    \n\tinline EAGLView *getView() const {\n\t\treturn m_pView;\n\t}\n    \n\tinline float getScale() const {\n\t\treturn m_scale;\n\t}\n    \n\tfloat getMasterVolume(bool SEmode) const;\n    \n\tstatic CiOSPlatform *getInstance();\n    \n\tvirtual void *allocMutex();\n\tvirtual void freeMutex(void *mutex);\n\tvirtual void mutexLock(void *mutex);\n\tvirtual void mutexUnlock(void *mutex);\n    \n\tvirtual void *allocEventLock();\n\tvirtual void freeEventLock(void *lock);\n\tvirtual void eventSleep(void *lock);\n\tvirtual void eventWakeup(void *lock);\n    \n\tvoid startAlertDialog(const char *title, const char *message) {\n\t}\n    \n\tvoid forbidSleep(bool is_forbidden);\n    \nprivate:\n\tstruct PF_THREAD {\n\t\tjmp_buf jmp;\n\t\tpthread_t id;\n\t\ts32 (*thread_func)(void *, void *);\n\t\tvoid *data;\n\t\ts32 result;\n\t};\n\tstatic void *ThreadProc(void *data);\n    \n\tbool setKeyChain(const char *service_name, const char *key, const char *value);\n\tint getKeyChain(const char *service_name, const char *key, char *retBuf, int maxlen);\n\tbool delKeyChain(const char *service_name, const char *key);\n    \n\tint sha512(const char *string, char *buf, int maxlen);\n    \n\tEAGLView *m_pView;\n\tfloat m_scale;\n    \n\tenum {\n\t\tSTORE_NONE,\n\t\tSTORE_BUY_PRODUCTS,\n\t\tSTORE_GET_PRODUCTS\n\t};\n\tstruct StoreState\n\t{\n\t\tint m_mode;\n\t\tint m_count;\n\t\tbool m_currency;\n\t\tconst char *m_callback;\n\t} m_storeState;\n    \n\tchar m_platform[256];\n    \n\tstatic CiOSPlatform *m_instance;\n};\n\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSReadFileStream.h",
    "content": "#ifndef CiOSReadFileStream_h\n#define CiOSReadFileStream_h\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n#include \"encryptFile.h\"\n\nclass CiOSWriteFileStream;\n\n// ファイルアクセスクラス実装\nclass CiOSReadFileStream : public IReadStream\n{\n\tfriend class CiOSWriteFileStream;\nprivate:\n\ttypedef struct {\n\t\tconst char *top;\n\t\tint loc;                // 0 で　install, 1 で external\n\t\tbool readonly;          // true の場合、その領域には書き込めない\n\t} LOCLIST;\n\tstatic const LOCLIST m_toplevel[];\n    \n\t// ファクトリとなるクラスメソッド以外で勝手に new はできない\n\tCiOSReadFileStream();\n    \n\tinline void decrypt(void *ptr, u32 length) {\n\t\tm_decrypter.decryptBlck(ptr, length);\n\t}\n    \npublic:\n\t// delete はできる。\n\tvirtual ~CiOSReadFileStream();\n\tinline u32 decryptSetup(const u8 *ptr) {\n\t\tu8 hdr[4];\n\t\thdr[0] = 0;\n\t\thdr[1] = 0;\n\t\thdr[2] = 0;\n\t\thdr[3] = 0;\n        \n\t\tif (m_fp) {\n\t\t\tfread(hdr, 1, 4, m_fp);\n\t\t}\n        \n\t\tu32 res = m_decrypter.decryptSetup(ptr, hdr);\n\t\tif (res == 0) {\n\t\t\tif (m_fp) {\n\t\t\t\tfseek(m_fp, 0, SEEK_SET);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n    \n\t// 指定されたパスで CiOSReadStream インスタンスを作り、そのポインタを返す。\n\tstatic CiOSReadFileStream *openStream(const char *path, const char *home);\n    \n\t// 指定されたパス名称を EXTERN -> INSTALL の順に検索し、先に見つかった方でCiOSReadStreamインスタンスを作る。\n\tstatic CiOSReadFileStream *openAssets(const char *path, const char *home);\n    \n\ts32 getSize();\n\ts32 getPosition();\n\tu8 readU8();\n\tu16 readU16();\n\tu32 readU32();\n\tfloat readFloat();\n\tbool readBlock(void *buffer, u32 byteSize);\n\tESTATUS getStatus();\n    \n\tint readU16arr(u16 *pBufferU16, int items);\n\tint readU32arr(u32 *PBufferU32, int items);\n    \n\tIWriteStream *getWriteStream();\n    \nprivate:\n\tCDecryptBaseClass m_decrypter;\n    \n\tconst char *m_fullpath; //!< オープン後は基本不要だが、ファイルの物理的フルパス文字列\n\tESTATUS m_eStat;\n\tFILE *m_fp;\n\tint m_fd;\n\tbool m_bReadOnly;           // true のときは read only なので、CiOSWriteStreamを返さない。\n\tCiOSWriteFileStream *m_writeStream;\n    \n#ifdef DEBUG_MEMORY\n\tCiOSReadFileStream *m_pPrev;\n\tCiOSReadFileStream *m_pNext;\n    \n\tstatic CiOSReadFileStream *ms_pBegin;\n\tstatic CiOSReadFileStream *ms_pEnd;\n#endif\n};\n\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSSysResource.h",
    "content": "#ifndef CiOSSysResource_h\n#define CiOSSysResource_h\n\nclass CiOSSysResource\n{\nprivate:\n\tCiOSSysResource();\n\tvirtual ~CiOSSysResource();\npublic:\n\tstatic CiOSSysResource& getInstance();\n    \n\tvoid requestDevID();\n\tbool failedDevID();\n\tbool setDevID(const void *devToken);\n\tint getDevID(char *retBuf, int maxlen);\n    \n\tinline bool isReceived() {\n\t\treturn m_devId_received;\n\t}\n    \n\tinline bool isSucceed() {\n\t\treturn m_devId_succeed;\n\t}\n    \nprivate:\n\tunsigned char m_devId[32];\n\tint m_size_devId;\n\tbool m_devId_received;\n\tbool m_devId_succeed;\n};\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSTextView.h",
    "content": "#ifndef CiOSTextView_h\n#define CiOSTextView_h\n\n@interface CiOSTextView\n{\n\tNSString *m_pFontName;              // フォント名\n\tNSString *m_placeHolder;            // プレースホルダ文字列\n}\n\n@property (nonatomic, retain) NSString *m_pFontName;\n@property (nonatomic, retain) NSString *m_placeHolder;\n\n- (id)init;\n- (void)dealloc;\n- (void)awakeFromNib;\n- (id)initWithFrame:(CGRect)frame;\n- (void)setText:(NSString *)text;\n- (void)drawRect:(CGRect)rect;\n\n// 文字の入力数を確認しプレースホルダの機能を仕様\n- (void)changedPlaceHolder:(NSNotification *)_notfication;\n\n// プレースホルダの文字列を設定\n- (void)setPlaceHolderString:(NSString *)_string;\n\n@end\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSTmpFile.h",
    "content": "#ifndef CiOSTmpFile_h\n#define CiOSTmpFile_h\n\n#include <iostream>\n#include \"ITmpFile.h\"\n\nclass CiOSTmpFile : public ITmpFile\n{\npublic:\n\tCiOSTmpFile(const char *tmpPath);\n\tvirtual ~CiOSTmpFile();\n    \n\tsize_t writeTmp(void *ptr, size_t size);\n    \n\tinline bool isReady() {\n\t\treturn (m_fd > 0) ? true : false;\n\t}\n    \nprivate:\n\tconst char *m_fullpath;\n\tint m_fd;\n};\n\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSWebView.h",
    "content": "#ifndef CiOSWebView_h\n#define CiOSWebView_h\n\n@interface CiOSWebView {\n@private\n\tNSString *m_token;\n\tNSString *m_region;\n\tNSString *m_client;\n\tNSString *m_cKey;\n\tNSString *m_appID;\n\tNSString *m_userID;\n    \n\tNSString *m_os;\n\tNSString *m_version;\n\tNSString *m_timezone;\n}\n\n- (void)setCustomHeaders:(const char *)token:(const char *)region:(const char *)client:(const char *)consumerKey:(const char *)applicationId:(const char *)userId:(const char *)env;\n\n@end\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSWidget.h",
    "content": "#ifndef CiOSWidget_h\n#define CiOSWidget_h\n\n#include \"CiOSPlatform.h\"\n#import \"CiOSWebView.h\"\n#import \"CiOSMovieView.h\"\n#import \"CiOSTextView.h\"\n#include \"OSWidget.h\"\n\nclass CiOSFont;\nclass CiOSPlatform;\n\n// iOS用の基本形\nclass CiOSWidget : public IWidget\n{\nprotected:\n\tCiOSWidget(CiOSPlatform * pParent);\n\tvirtual ~CiOSWidget();\n    \npublic:\n\tbool init(int id, int x, int y, int width, int height);\n    \n\tvoid move(int x, int y);\n\tvoid resize(int width, int height);\n\tvirtual void visible(bool bVisible) = 0;\n\tvirtual void enable(bool bEnable) = 0;\n    \n\tvirtual void cmd(int cmd, ...);\n\tvirtual int status();\n    \n\tinline void size_recovery() {\n\t\tset_move(m_x, m_y, m_width, m_height);\n\t}\n    \nprotected:\n\tinline CiOSPlatform& getPlatform() const {\n\t\treturn *m_pPlatform;\n\t}\n    \n\tinline float getScale() const {\n\t\treturn m_scale;\n\t}\n    \n\tvirtual void set_move(int x, int y, int width, int height) = 0;\n    \nprotected:\n\tfloat m_scale;\n\tint m_x;\n\tint m_y;\n\tint m_width;\n\tint m_height;\n    \n\tint m_id;\n\tCiOSPlatform *m_pPlatform;\n};\n\n// iOS WebView\nclass CiOSWebWidget : public CiOSWidget\n{\n\tfriend class CiOSPlatform;\nprivate:\n\tCiOSWebWidget(CiOSPlatform * pParent);\n\tvirtual ~CiOSWebWidget();\npublic:\n\tbool create(CONTROL type, int id,\n\t            const char *caption, int x, int y, int width, int height,\n\t            const char *token, const char *region, const char *client,\n\t            const char *consumerKey, const char *applicationId, const char *userID);\n    \n\tint getTextLength();\n\tbool getText(char *pBuf, int maxlen);\n\tbool setText(const char *string);\n\tvoid visible(bool bVisible);\n\tvoid enable(bool bEnable);\n    \n\tvoid cmd(int cmd, ...);\n    \n\tinline bool getJump() const {\n\t\treturn m_bJump || m_bFirst;\n\t}\n    \n\tinline void setFirst() {\n\t\tm_bFirst = false;\n\t}\n    \nprivate:\n\tvoid set_move(int x, int y, int width, int height);\n\tvoid set_bgcolor();\n    \n\tbool m_bJump;\n\tbool m_bFirst;\n\tconst char *m_pNowURL;\n\tCiOSWebView *m_pWebView;\n    \n\tchar m_bufURL[1024];\n\tunsigned int m_bgalpha;             // 背景色のアルファ値\n\tunsigned int m_bgcolor;             // 背景色\n    \n\tCiOSWebWidget *m_prev;\n\tCiOSWebWidget *m_next;\n    \n\tstatic CiOSWebWidget *ms_begin;\n\tstatic CiOSWebWidget *ms_end;\n};\n\nclass CiOSMovieWidget : public CiOSWidget\n{\n\tfriend class CiOSPlatform;\nprivate:\n\tCiOSMovieWidget(CiOSPlatform * pParent);\n\tvirtual ~CiOSMovieWidget();\npublic:\n\tbool create(CONTROL type, int id,\n\t            const char *caption, int x, int y, int width, int height);\n    \n\tint getTextLength();\n\tbool getText(char *pBuf, int maxlen);\n\tbool setText(const char *string);\n\tvoid visible(bool bVisible);\n\tvoid enable(bool bEnable);\n    \n\tvoid cmd(int cmd, ...);\n\tint status();\n    \n\tinline void setStatus(int stat) {\n\t\tm_status = stat;\n\t}\n    \n\tstatic CiOSMovieWidget *getWidget(void *p);\n    \nprivate:\n\tvoid set_move(int x, int y, int width, int height);\n    \n\tCONTROL m_type;\n    \n\tconst char *m_pNowPATH;\n\tCiOSMovieView *m_pMovieView;\n    \n\tint m_status;\n\tCiOSMovieWidget *m_prev;\n\tCiOSMovieWidget *m_next;\n    \n\tstatic CiOSMovieWidget *ms_begin;\n\tstatic CiOSMovieWidget *ms_end;\n};\n\nclass CiOSActivityIndicator : public CiOSWidget\n{\n\tfriend class CiOSPlatform;\nprivate:\n\tCiOSActivityIndicator(CiOSPlatform * pParent);\n\tvirtual ~CiOSActivityIndicator();\npublic:\n\tbool create(CONTROL type, int id,\n\t            const char *caption, int x, int y, int width, int height);\n    \n\tint getTextLength();\n\tbool getText(char *pBuf, int maxlen);\n\tbool setText(const char *string);\n\tvoid visible(bool bVisible);\n\tvoid enable(bool bEnable);\n    \n\tvoid cmd(int cmd, ...);\n\tint status();\n    \nprivate:\n\tvoid set_move(int x, int y, int width, int height);\n    \n\tbool m_bVisible;\n\tint m_status;\n\tfloat m_size;\n    \n\tCiOSActivityIndicator *m_prev;\n\tCiOSActivityIndicator *m_next;\n    \n\tstatic CiOSActivityIndicator *ms_begin;\n\tstatic CiOSActivityIndicator *ms_end;\n};\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/CiOSWriteFileStream.h",
    "content": "#ifndef CiOSWriteFileStream_h\n#define CiOSWriteFileStream_h\n\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n\nclass CiOSReadFileStream;\n\nclass CiOSWriteFileStream : public IWriteStream\n{\n\tfriend class CiOSReadFileStream;\nprivate:\n\tCiOSWriteFileStream(CiOSReadFileStream & rdStream);\n\tvirtual ~CiOSWriteFileStream();\n    \npublic:\n\tESTATUS getStatus();\n\ts32 getPosition();\n\tvoid writeU8(u8 value); // Use cast to support s8\n\tvoid writeU16(u16 value);   // Use cast to support s16\n\tvoid writeU32(u32 value);   // Use cast to support s32\n\tvoid writeFloat(float);\n\tvoid writeBlock(void *buffer, u32 byteSize);\n    \nprivate:\n\tint m_fd;\n\tFILE *m_fp;\n    \n\tESTATUS m_eStat;\n};\n\n#endif // CiOSWriteFileStream_h\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/EAGLView.h",
    "content": "// #define OPENGL2\n\n#import <GLKit/GLKit.h>\n#import <StoreKit/StoreKit.h>\n#import <AVFoundation/AVFoundation.h>\n\n//#import \"CuttingGame.h\"\n\n#define MAX_TOUCH 20     // 最大タッチ数\n#define FPS_AVERAGE (5)     // FPS計測用\n\n/*\n This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.\n The view content is basically an EAGL surface you render your OpenGL scene into.\n Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.\n */\n@interface EAGLView {\n@private\n\t/* The pixel dimensions of the backbuffer */\n\tGLint backingWidth;\n\tGLint backingHeight;\n    \n\t/* OpenGL names for the renderbuffer and framebuffers used to render to this view */\n\tGLuint viewRenderbuffer, viewFramebuffer;\n    \n\t/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */\n\tGLuint depthRenderbuffer;\n\tGLuint program;\n    \n\tNSTimer *animationTimer;\n\tNSTimeInterval animationInterval;\n\tCFTimeInterval timePrev;\n\tCFTimeInterval timeInt;\n\tint frame;\n    \n#if (DEBUG == 1)\n\tCFTimeInterval fpsArray[FPS_AVERAGE];   // FPS計測時に平均を出すための保存配列\n\tint fpsCnt;                             // FPS値を保存する配列のインデックス\n#endif\n    \n\t// CGame game;\n\tBoolean isInitiated;\n    \n\t// キーボードのサイズ\n\tCGRect keyboardFrameEnd;\n    \n\tBoolean bContinue;\n}\n\n@property NSTimeInterval animationInterval;\n\n- (void)startAnimation;\n- (void)stopAnimation;\n- (void)drawView;\n- (void)setTimePrev:(CFTimeInterval)value;\n- (void)textTouchDown:(id)sender;\n- (void)textTouchUp:(id)sender;\n\n- (void)clearUITouches;\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/GLcommon.h",
    "content": "#ifndef GLcommon_h\n#define GLcommon_h\n\n#include <OpenGLES/ES2/gl.h>\n#include <OpenGLES/ES2/glext.h>\n\n//#include \"ApplicationFramework.h\"\n//#include \"RenderingFramework.h\"\n\n\n#endif // GLcommon_h\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/KLBPlatformMetrics.h",
    "content": "#ifndef KLBPlatformMetrics_h\n#define KLBPlatformMetrics_h\n\n#include \"KLBPlatformMetricsCommon.h\"\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/NSData+Base64.h",
    "content": "//\n//  NSData+Base64.h\n//  base64\n//\n//  Created by Matt Gallagher on 2009/06/03.\n//  Copyright 2009 Matt Gallagher. All rights reserved.\n//\n//  This software is provided 'as-is', without any express or implied\n//  warranty. In no event will the authors be held liable for any damages\n//  arising from the use of this software. Permission is granted to anyone to\n//  use this software for any purpose, including commercial applications, and to\n//  alter it and redistribute it freely, subject to the following restrictions:\n//\n//  1. The origin of this software must not be misrepresented; you must not\n//     claim that you wrote the original software. If you use this software\n//     in a product, an acknowledgment in the product documentation would be\n//     appreciated but is not required.\n//  2. Altered source versions must be plainly marked as such, and must not be\n//     misrepresented as being the original software.\n//  3. This notice may not be removed or altered from any source\n//     distribution.\n//\n\n#import <Foundation/Foundation.h>\n\nvoid *NewBase64Decode(const char *inputBuffer,\n                      size_t      length,\n                      size_t *    outputLength);\n\nchar *NewBase64Encode(const void *inputBuffer,\n                      size_t      length,\n                      bool        separateLines,\n                      size_t *    outputLength);\n\n@interface NSData (Base64)\n\n+ (NSData *)dataFromBase64String:(NSString *)aString;\n- (NSString *)base64EncodedString;\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/ViewController.h",
    "content": "#import <StoreKit/StoreKit.h>\n#import \"EAGLView.h\"\n#import \"CiOSMovieView.h\"\n\n@interface ViewController {\n\tIBOutlet CiOSMovieView *viewBase;\n\tIBOutlet EAGLView *viewGL;\n}\n\n\n\n- (void)viewRecovery;\n- (void)stopAnimation;\n- (void)startAnimation;\n- (void)finishStoreTransaction:(NSString *)receipt;\n- (void)clearUITouches;\n\n\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/include/iOSFileLocation.h",
    "content": "#ifndef iOSFileLocation_h\n#define iOSFileLocation_h\n\n#define PATH_EXTERN     \"/Library/Application Support/\"\n#define PATH_INSTALL    \"/Contents/Resources/\"\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/main.m",
    "content": "#import <Cocoa/Cocoa.h>\n\nint main(int argc, char *argv[])\n{\n    return NSApplicationMain(argc, (const char **)argv);\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/matrixUtil.c",
    "content": "/*\n     File: matrixUtil.c\n Abstract: \n Functions for performing matrix math.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#include \"matrixUtil.h\"\n#include \"vectorUtil.h\"\n#include <math.h>\n#include <memory.h>\n\nvoid mtxMultiply(float* ret, const float* lhs, const float* rhs)\n{\n\t// [ 0 4  8 12 ]   [ 0 4  8 12 ]\n\t// [ 1 5  9 13 ] x [ 1 5  9 13 ]\n\t// [ 2 6 10 14 ]   [ 2 6 10 14 ]\n\t// [ 3 7 11 15 ]   [ 3 7 11 15 ]\n\tret[ 0] = lhs[ 0]*rhs[ 0] + lhs[ 4]*rhs[ 1] + lhs[ 8]*rhs[ 2] + lhs[12]*rhs[ 3];\n\tret[ 1] = lhs[ 1]*rhs[ 0] + lhs[ 5]*rhs[ 1] + lhs[ 9]*rhs[ 2] + lhs[13]*rhs[ 3];\n\tret[ 2] = lhs[ 2]*rhs[ 0] + lhs[ 6]*rhs[ 1] + lhs[10]*rhs[ 2] + lhs[14]*rhs[ 3];\n\tret[ 3] = lhs[ 3]*rhs[ 0] + lhs[ 7]*rhs[ 1] + lhs[11]*rhs[ 2] + lhs[15]*rhs[ 3];\n\n\tret[ 4] = lhs[ 0]*rhs[ 4] + lhs[ 4]*rhs[ 5] + lhs[ 8]*rhs[ 6] + lhs[12]*rhs[ 7];\n\tret[ 5] = lhs[ 1]*rhs[ 4] + lhs[ 5]*rhs[ 5] + lhs[ 9]*rhs[ 6] + lhs[13]*rhs[ 7];\n\tret[ 6] = lhs[ 2]*rhs[ 4] + lhs[ 6]*rhs[ 5] + lhs[10]*rhs[ 6] + lhs[14]*rhs[ 7];\n\tret[ 7] = lhs[ 3]*rhs[ 4] + lhs[ 7]*rhs[ 5] + lhs[11]*rhs[ 6] + lhs[15]*rhs[ 7];\n\n\tret[ 8] = lhs[ 0]*rhs[ 8] + lhs[ 4]*rhs[ 9] + lhs[ 8]*rhs[10] + lhs[12]*rhs[11];\n\tret[ 9] = lhs[ 1]*rhs[ 8] + lhs[ 5]*rhs[ 9] + lhs[ 9]*rhs[10] + lhs[13]*rhs[11];\n\tret[10] = lhs[ 2]*rhs[ 8] + lhs[ 6]*rhs[ 9] + lhs[10]*rhs[10] + lhs[14]*rhs[11];\n\tret[11] = lhs[ 3]*rhs[ 8] + lhs[ 7]*rhs[ 9] + lhs[11]*rhs[10] + lhs[15]*rhs[11];\n\n\tret[12] = lhs[ 0]*rhs[12] + lhs[ 4]*rhs[13] + lhs[ 8]*rhs[14] + lhs[12]*rhs[15];\n\tret[13] = lhs[ 1]*rhs[12] + lhs[ 5]*rhs[13] + lhs[ 9]*rhs[14] + lhs[13]*rhs[15];\n\tret[14] = lhs[ 2]*rhs[12] + lhs[ 6]*rhs[13] + lhs[10]*rhs[14] + lhs[14]*rhs[15];\n\tret[15] = lhs[ 3]*rhs[12] + lhs[ 7]*rhs[13] + lhs[11]*rhs[14] + lhs[15]*rhs[15];}\n\n\nvoid mtxLoadPerspective(float* mtx, float fov, float aspect, float nearZ, float farZ)\n{\n\tfloat f = 1.0f / tanf( (fov * (M_PI/180)) / 2.0f);\n\t\n\tmtx[0] = f / aspect;\n\tmtx[1] = 0.0f;\n\tmtx[2] = 0.0f;\n\tmtx[3] = 0.0f;\n\t\n\tmtx[4] = 0.0f;\n\tmtx[5] = f;\n\tmtx[6] = 0.0f;\n\tmtx[7] = 0.0f;\n\t\n\tmtx[8] = 0.0f;\n\tmtx[9] = 0.0f;\n\tmtx[10] = (farZ+nearZ) / (nearZ-farZ);\n\tmtx[11] = -1.0f;\n\t\n\tmtx[12] = 0.0f;\n\tmtx[13] = 0.0f;\n\tmtx[14] = 2 * farZ * nearZ /  (nearZ-farZ);\n\tmtx[15] = 0.0f;\n}\n\n\nvoid mtxLoadOrthographic(float* mtx,\n\t\t\t\t\t\t\tfloat left, float right, \n\t\t\t\t\t\t\tfloat bottom, float top, \n\t\t\t\t\t\t\tfloat nearZ, float farZ)\n{\n\t//See appendix G of OpenGL Red Book\n\t\n\tmtx[ 0] = 2.0f / (right - left);\n\tmtx[ 1] = 0.0;\n\tmtx[ 2] = 0.0;\n\tmtx[ 3] = 0.0;\n\t\n\tmtx[ 4] = 0.0;\n\tmtx[ 5] = 2.0f / (top - bottom);\n\tmtx[ 6] = 0.0;\n\tmtx[ 7] = 0.0;\n\t\n\tmtx[ 8] = 0.0;\n\tmtx[ 9] = 0.0;\n\tmtx[10] = -2.0f / (farZ - nearZ);\n\tmtx[11] = 0.0;\n\t\n\tmtx[12] = -(right + left) / (right - left);\n\tmtx[13] = -(top + bottom) / (top - bottom);\n\tmtx[14] = -(farZ + nearZ) / (farZ - nearZ);\n\tmtx[15] = 1.0f;\n}\n\nstatic inline float sgn(float val)\n{\n\treturn (val > 0.0f) ? 1.0f : ((val < 0.0f) ? -1.0f : 0.0f);\n}\n\nvoid mtxModifyObliqueProjection(float* mtx, const float* src, const float* plane)\n{\n\tfloat vec[4];\n\t\n\tmemcpy(mtx, src, 16 * sizeof(float));\n\n    vec[0] = (sgn(plane[0]) + mtx[8]) / mtx[0];\n    vec[1] = (sgn(plane[1]) + mtx[9]) / mtx[5];\n    vec[2] = -1.0f;\n    vec[3] = (1.0f + mtx[10]) / mtx[14];\n    \n\tfloat dot = vec4DotProduct(plane, vec);\n\t\n    vec[0] = plane[0] * (2.0f / dot);\n    vec[1] = plane[1] * (2.0f / dot);\n    vec[2] = plane[2] * (2.0f / dot);\n    vec[3] = plane[3] * (2.0f / dot);\n    \n    // Replace the third row of the projection matrix\n    mtx[ 2] = vec[0];\n    mtx[ 6] = vec[1];\n    mtx[10] = vec[2];\n    mtx[14] = vec[3];\n}\n\nvoid mtxTranspose(float* mtx, const float* src)\n{\n\t//Use a temp to swap in case mtx == src\n\t\n\tfloat tmp;\n\tmtx[0]  = src[0];\n\tmtx[5]  = src[5];\n\tmtx[10] = src[10];\n\tmtx[15] = src[15];\n\t\n\ttmp = src[4];\n\tmtx[4]  = src[1];\n\tmtx[1]  = tmp;\n\t\n\ttmp = src[8];\n\tmtx[8]  = src[2];\n\tmtx[2] = tmp;\n\t\n\ttmp = src[12];\n\tmtx[12] = src[3];\n\tmtx[3]  = tmp;\n\t\n\ttmp = src[9];\n\tmtx[9]  = src[6];\n\tmtx[6]  = tmp;\n\t\n\ttmp = src[13];\n\tmtx[13] = src[7];\n\tmtx[ 7] = tmp;\n\t\n\ttmp = src[14];\n\tmtx[14] = src[11];\n\tmtx[11] = tmp;\n\t\n}\n\nvoid mtxInvert(float* mtx, const float* src)\n{\n\tfloat tmp[16];\n\tfloat val, val2, val_inv;\n\tint i, j, i4, i8, i12, ind;\n\t\n\tmtxTranspose(tmp, src);\n\t\n\tmtxLoadIdentity(mtx);\n\t\n\t\n\tfor(i = 0; i != 4; i++)\n\t{\n\t\tval = tmp[(i << 2) + i];\n\t\tind = i;\n\t\t\n\t\ti4  = i + 4;\n\t\ti8  = i + 8;\n\t\ti12 = i + 12;\n\t\t\n\t\tfor (j = i + 1; j != 4; j++)\n\t\t{\n\t\t\tif(fabsf(tmp[(i << 2) + j]) > fabsf(val))\n\t\t\t{\n\t\t\t\tind = j;\n\t\t\t\tval = tmp[(i << 2) + j];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(ind != i)\n\t\t{\n\t\t\tval2      = mtx[i];\n\t\t\tmtx[i]    = mtx[ind];\n\t\t\tmtx[ind]  = val2;\n\t\t\t\n\t\t\tval2      = tmp[i];\n\t\t\ttmp[i]    = tmp[ind];\n\t\t\ttmp[ind]  = val2;\n\t\t\t\n\t\t\tind += 4;\n\t\t\t\n\t\t\tval2      = mtx[i4];\n\t\t\tmtx[i4]   = mtx[ind];\n\t\t\tmtx[ind]  = val2;\n\t\t\t\n\t\t\tval2      = tmp[i4];\n\t\t\ttmp[i4]   = tmp[ind];\n\t\t\ttmp[ind]  = val2;\n\t\t\t\n\t\t\tind += 4;\n\t\t\t\n\t\t\tval2      = mtx[i8];\n\t\t\tmtx[i8]   = mtx[ind];\n\t\t\tmtx[ind]  = val2;\n\t\t\t\n\t\t\tval2      = tmp[i8];\n\t\t\ttmp[i8]   = tmp[ind];\n\t\t\ttmp[ind]  = val2;\n\t\t\t\n\t\t\tind += 4;\n\t\t\t\n\t\t\tval2      = mtx[i12];\n\t\t\tmtx[i12]  = mtx[ind];\n\t\t\tmtx[ind]  = val2;\n\t\t\t\n\t\t\tval2      = tmp[i12];\n\t\t\ttmp[i12]  = tmp[ind];\n\t\t\ttmp[ind]  = val2;\n\t\t}\n\t\t\n\t\tif(val == 0)\n\t\t{\n\t\t\tmtxLoadIdentity(mtx);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tval_inv = 1.0f / val;\n\t\t\n\t\ttmp[i]   *= val_inv;\n\t\tmtx[i]   *= val_inv;\n\t\t\n\t\ttmp[i4]  *= val_inv;\n\t\tmtx[i4]  *= val_inv;\n\t\t\n\t\ttmp[i8]  *= val_inv;\n\t\tmtx[i8]  *= val_inv;\n\t\t\n\t\ttmp[i12] *= val_inv;\n\t\tmtx[i12] *= val_inv;\n\t\t\n\t\tif(i != 0)\n\t\t{\n\t\t\tval = tmp[i << 2];\n\t\t\t\n\t\t\ttmp[0]  -= tmp[i]   * val;\n\t\t\tmtx[0]  -= mtx[i]   * val;\n\t\t\t\n\t\t\ttmp[4]  -= tmp[i4]  * val;\n\t\t\tmtx[4]  -= mtx[i4]  * val;\n\t\t\t\n\t\t\ttmp[8]  -= tmp[i8]  * val;\n\t\t\tmtx[8]  -= mtx[i8]  * val;\n\t\t\t\n\t\t\ttmp[12] -= tmp[i12] * val;\n\t\t\tmtx[12] -= mtx[i12] * val;\n\t\t}\n\t\t\n\t\tif(i != 1)\n\t\t{\n\t\t\tval = tmp[(i << 2) + 1];\n\t\t\t\n\t\t\ttmp[1]  -= tmp[i]   * val;\n\t\t\tmtx[1]  -= mtx[i]   * val;\n\t\t\t\n\t\t\ttmp[5]  -= tmp[i4]  * val;\n\t\t\tmtx[5]  -= mtx[i4]  * val;\n\t\t\t\n\t\t\ttmp[9]  -= tmp[i8]  * val;\n\t\t\tmtx[9]  -= mtx[i8]  * val;\n\t\t\t\n\t\t\ttmp[13] -= tmp[i12] * val;\n\t\t\tmtx[13] -= mtx[i12] * val;\n\t\t}\n\t\t\n\t\tif(i != 2)\n\t\t{\n\t\t\tval = tmp[(i << 2) + 2];\n\t\t\t\n\t\t\ttmp[2]  -= tmp[i]   * val;\n\t\t\tmtx[2]  -= mtx[i]   * val;\n\t\t\t\n\t\t\ttmp[6]  -= tmp[i4]  * val;\n\t\t\tmtx[6]  -= mtx[i4]  * val;\n\t\t\t\n\t\t\ttmp[10] -= tmp[i8]  * val;\n\t\t\tmtx[10] -= mtx[i8]  * val;\n\t\t\t\n\t\t\ttmp[14] -= tmp[i12] * val;\n\t\t\tmtx[14] -= mtx[i12] * val;\n\t\t}\n\t\t\n\t\tif(i != 3)\n\t\t{\n\t\t\tval = tmp[(i << 2) + 3];\n\t\t\t\n\t\t\ttmp[3]  -= tmp[i]   * val;\n\t\t\tmtx[3]  -= mtx[i]   * val;\n\t\t\t\n\t\t\ttmp[7]  -= tmp[i4]  * val;\n\t\t\tmtx[7]  -= mtx[i4]  * val;\n\t\t\t\n\t\t\ttmp[11] -= tmp[i8]  * val;\n\t\t\tmtx[11] -= mtx[i8]  * val;\n\t\t\t\n\t\t\ttmp[15] -= tmp[i12] * val;\n\t\t\tmtx[15] -= mtx[i12] * val;\n\t\t}\n\t}\n}\n\nvoid mtxLoadIdentity(float* mtx)\n{\n\t// [ 0 4  8 12 ]\n\t// [ 1 5  9 13 ]\n\t// [ 2 6 10 14 ]\n    // [ 3 7 11 15 ]\n\tmtx[ 0] = mtx[ 5] = mtx[10] = mtx[15] = 1.0f;\n\t\n\tmtx[ 1] = mtx[ 2] = mtx[ 3] = mtx[ 4] =    \n\tmtx[ 6] = mtx[ 7] = mtx[ 8] = mtx[ 9] =    \n\tmtx[11] = mtx[12] = mtx[13] = mtx[14] = 0.0;\n}\n\n\nvoid mtxLoadTranslate(float* mtx, float xTrans, float yTrans, float zTrans)\n{\n\t\n\t// [ 0 4  8  x ]\n\t// [ 1 5  9  y ]\n\t// [ 2 6 10  z ]\n\t// [ 3 7 11 15 ]\n\tmtx[ 0] = mtx[ 5] = mtx[10] = mtx[15] = 1.0f;\n\t\n\tmtx[ 1] = mtx[ 2] = mtx[ 3] = mtx[ 4] =    \n\tmtx[ 6] = mtx[ 7] = mtx[ 8] = mtx[ 9] =    \n\tmtx[11] = 0.0;\n\t\n\tmtx[12] = xTrans;\n\tmtx[13] = yTrans;\n\tmtx[14] = zTrans;   \n}\n\n\nvoid mtxLoadScale(float* mtx, float xScale, float yScale, float zScale)\n{\n\t// [ x 4  8 12 ]\n\t// [ 1 y  9 13 ]\n\t// [ 2 6  z 14 ]\n\t// [ 3 7 11 15 ]\n\tmtx[ 0] = xScale;\n\tmtx[ 5] = yScale;\n\tmtx[10] = zScale;\n\tmtx[15] = 1.0f;\n\t\n\tmtx[ 1] = mtx[ 2] = mtx[ 3] = mtx[ 4] =    \n\tmtx[ 6] = mtx[ 7] = mtx[ 8] = mtx[ 9] =    \n\tmtx[11] = mtx[12] = mtx[13] = mtx[14] = 0.0;\t\t\n}\n\n\nvoid mtxLoadRotateX(float* mtx, float rad)\n{\n\t// [ 0 4      8 12 ]\n\t// [ 1 cos -sin 13 ]\n\t// [ 2 sin cos  14 ]\n\t// [ 3 7     11 15 ]\n\t\n\tmtx[10] = mtx[ 5] = cosf(rad);\n\tmtx[ 6] = sinf(rad);\n\tmtx[ 9] = -mtx[ 6];\n\t\n\tmtx[ 0] = mtx[15] = 1.0f;\n\t\n\tmtx[ 1] = mtx[ 2] = mtx[ 3] = mtx[ 4] =    \n\tmtx[ 7] = mtx[ 8] = mtx[11] = mtx[12] =\n\tmtx[13] = mtx[14] = 0.0;\t\t\n}\n\n\nvoid mtxLoadRotateY(float* mtx, float rad)\n{\n\t// [ cos 4  -sin 12 ]\n\t// [ 1   5   9   13 ]\n\t// [ sin 6  cos  14 ]\n\t// [ 3   7  11   15 ]\n\t\n\tmtx[ 0] = mtx[10] = cosf(rad); \n\tmtx[ 2] = sinf(rad);\n\tmtx[ 8] = -mtx[2];\n\t\n\tmtx[ 5] = mtx[15] = 1.0;\n\t\n\tmtx[ 1] = mtx[ 3] = mtx[ 4] = mtx[ 6] =    \n\tmtx[ 7] = mtx[ 9] = mtx[11] = mtx[12] =\n\tmtx[13] = mtx[14] = 0.0;\n}\n\n\nvoid mtxLoadRotateZ(float* mtx, float rad)\n{\n\t// [ cos -sin 8 12 ]\n\t// [ sin cos  9 13 ]\n\t// [ 2   6   10 14 ]\n\t// [ 3   7   11 15 ]\n\t\n\tmtx[ 0] = mtx[ 5] = cosf(rad); \n\tmtx[ 1] = sinf(rad);\n\tmtx[ 4] = -mtx[1];\n\t\n\tmtx[10] = mtx[15] = 1.0;\n\t\n\tmtx[ 2] = mtx[ 3] = mtx[ 6] = mtx[ 7] =    \n\tmtx[ 8] = mtx[ 9] = mtx[11] = mtx[12] =\n\tmtx[13] = mtx[14] = 0.0;\n}\n\n\nvoid mtxLoadRotate(float* mtx, float deg, float xAxis, float yAxis, float zAxis)\n{\n\tfloat rad = deg * M_PI/180.0f;\n\t\n\tfloat sin_a = sinf(rad);\n\tfloat cos_a = cosf(rad);\n\t\n\t// Calculate coeffs.  No need to check for zero magnitude because we wouldn't be here.\n\tfloat magnitude = sqrtf(xAxis * xAxis + yAxis * yAxis + zAxis * zAxis);\n\t\n\tfloat p = 1.0f / magnitude;\n\tfloat cos_am = 1.0f - cos_a;\n\t\n\tfloat xp = xAxis * p;\n\tfloat yp = yAxis * p;\n\tfloat zp = zAxis * p;\n\t\n\tfloat xx = xp * xp;\n\tfloat yy = yp * yp;\n\tfloat zz = zp * zp;\n\t\n\tfloat xy = xp * yp * cos_am;\n\tfloat yz = yp * zp * cos_am;\n\tfloat zx = zp * xp * cos_am;\n\t\n\txp *= sin_a;\n\typ *= sin_a;\n\tzp *= sin_a;\n\t\n\t// Load coefs\n\tfloat m0  = xx + cos_a * (1.0f - xx);\n\tfloat m1  = xy + zp;\n\tfloat m2  = zx - yp;\n\tfloat m4  = xy - zp;\n\tfloat m5  = yy + cos_a * (1.0f - yy);\n\tfloat m6  = yz + xp;\n\tfloat m8  = zx + yp;\n\tfloat m9  = yz - xp;\n\tfloat m10 = zz + cos_a * (1.0f - zz);\n\t\n\t// Apply rotation \n\tfloat c1 = mtx[0];\n\tfloat c2 = mtx[4];\n\tfloat c3 = mtx[8];\n\tmtx[0]  = c1 * m0 + c2 * m1 + c3 * m2;\n\tmtx[4]  = c1 * m4 + c2 * m5 + c3 * m6;\n\tmtx[8]  = c1 * m8 + c2 * m9 + c3 * m10;\n\t\n\tc1 = mtx[1];\n\tc2 = mtx[5];\n\tc3 = mtx[9];\n\tmtx[1]  = c1 * m0 + c2 * m1 + c3 * m2;\n\tmtx[5]  = c1 * m4 + c2 * m5 + c3 * m6;\n\tmtx[9]  = c1 * m8 + c2 * m9 + c3 * m10;\n\t\n\tc1 = mtx[2];\n\tc2 = mtx[6];\n\tc3 = mtx[10];\n\tmtx[2]  = c1 * m0 + c2 * m1 + c3 * m2;\n\tmtx[6]  = c1 * m4 + c2 * m5 + c3 * m6;\n\tmtx[10] = c1 * m8 + c2 * m9 + c3 * m10;\n\t\n\tc1 = mtx[3];\n\tc2 = mtx[7];\n\tc3 = mtx[11];\n\tmtx[3]  = c1 * m0 + c2 * m1 + c3 * m2;\n\tmtx[7]  = c1 * m4 + c2 * m5 + c3 * m6;\n\tmtx[11] = c1 * m8 + c2 * m9 + c3 * m10;\n\t\n\tmtx[12] = mtx[13] = mtx[14] = 0.0;\n\tmtx[15] = 1.0f;\n}\n\n\nvoid mtxTranslateApply(float* mtx, float xTrans, float yTrans, float zTrans)\n{\n\t// [ 0 4  8 12 ]   [ 1 0 0 x ]\n\t// [ 1 5  9 13 ] x [ 0 1 0 y ]\n\t// [ 2 6 10 14 ]   [ 0 0 1 z ]\n\t// [ 3 7 11 15 ]   [ 0 0 0 1 ]\n\t\n\tmtx[12] += mtx[0]*xTrans + mtx[4]*yTrans + mtx[ 8]*zTrans;\n\tmtx[13] += mtx[1]*xTrans + mtx[5]*yTrans + mtx[ 9]*zTrans;\n\tmtx[14] += mtx[2]*xTrans + mtx[6]*yTrans + mtx[10]*zTrans;\t\n}\n\n\nvoid mtxScaleApply(float* mtx, float xScale, float yScale, float zScale)\n{ \n    // [ 0 4  8 12 ]   [ x 0 0 0 ]\n    // [ 1 5  9 13 ] x [ 0 y 0 0 ] \n    // [ 2 6 10 14 ]   [ 0 0 z 0 ]\n    // [ 3 7 11 15 ]   [ 0 0 0 1 ]   \n\t\n\tmtx[ 0] *= xScale;\n\tmtx[ 4] *= yScale;\n\tmtx[ 8] *= zScale;\n\t\n\tmtx[ 1] *= xScale;\n\tmtx[ 5] *= yScale;\n\tmtx[ 9] *= zScale;\n\t\n\tmtx[ 2] *= xScale;\n\tmtx[ 6] *= yScale;\n\tmtx[10] *= zScale;\n\t\n\tmtx[ 3] *= xScale;\n\tmtx[ 7] *= yScale;\n\tmtx[11] *= xScale;\n}\n\n\nvoid mtxTranslateMatrix(float* mtx, float xTrans, float yTrans, float zTrans)\n{\n\t// [ 1 0 0 x ]   [ 0 4  8 12 ]\n\t// [ 0 1 0 y ] x [ 1 5  9 13 ]\n\t// [ 0 0 1 z ]   [ 2 6 10 14 ]\n\t// [ 0 0 0 1 ]   [ 3 7 11 15 ]\n\t\n\tmtx[ 0] += xTrans * mtx[ 3];\n\tmtx[ 1] += yTrans * mtx[ 3];\n\tmtx[ 2] += zTrans * mtx[ 3];\n\t\n\tmtx[ 4] += xTrans * mtx[ 7];\n\tmtx[ 5] += yTrans * mtx[ 7];\n\tmtx[ 6] += zTrans * mtx[ 7];\n\t\n\tmtx[ 8] += xTrans * mtx[11];\n\tmtx[ 9] += yTrans * mtx[11];\n\tmtx[10] += zTrans * mtx[11];\n\t\n\tmtx[12] += xTrans * mtx[15];\n\tmtx[13] += yTrans * mtx[15];\n\tmtx[14] += zTrans * mtx[15];\n}\n\n\nvoid mtxRotateXApply(float* mtx, float deg)\n{\n\t// [ 0 4  8 12 ]   [ 1  0    0  0 ]\n\t// [ 1 5  9 13 ] x [ 0 cos -sin 0 ]\n\t// [ 2 6 10 14 ]   [ 0 sin  cos 0 ]\n\t// [ 3 7 11 15 ]   [ 0  0    0  1 ]\n\t\n\tfloat rad = deg * (M_PI/180.0f);\n\t\n\tfloat cosrad = cosf(rad);\n\tfloat sinrad = sinf(rad);\n\t\n\tfloat mtx04 = mtx[4];\n\tfloat mtx05 = mtx[5];\n\tfloat mtx06 = mtx[6];\n\tfloat mtx07 = mtx[7];\n\t\n\tmtx[ 4] = mtx[ 8]*sinrad + mtx04*cosrad;\n\tmtx[ 8] = mtx[ 8]*cosrad - mtx04*sinrad;\n\t\n\tmtx[ 5] = mtx[ 9]*sinrad + mtx05*cosrad;\n\tmtx[ 9] = mtx[ 9]*cosrad - mtx05*sinrad;\n\t\n\tmtx[ 6] = mtx[10]*sinrad + mtx06*cosrad;\n\tmtx[10] = mtx[10]*cosrad - mtx06*sinrad;\n\t\n\tmtx[ 7] = mtx[11]*sinrad + mtx07*cosrad;\n\tmtx[11] = mtx[11]*cosrad - mtx07*sinrad;\n}\n\n\nvoid mtxRotateYApply(float* mtx, float deg)\n{\n\t// [ 0 4  8 12 ]   [ cos 0  -sin 0 ]\n\t// [ 1 5  9 13 ] x [ 0   1  0    0 ]\n\t// [ 2 6 10 14 ]   [ sin 0  cos  0 ]\n\t// [ 3 7 11 15 ]   [ 0   0  0    1 ]\n\t\n\tfloat rad = deg * (M_PI/180.0f);\n\t\n\tfloat cosrad = cosf(rad);\n\tfloat sinrad = sinf(rad);\n\t\n\tfloat mtx00 = mtx[0];\n\tfloat mtx01 = mtx[1];\n\tfloat mtx02 = mtx[2];\n\tfloat mtx03 = mtx[3];\n\t\n\tmtx[ 0] = mtx[ 8]*sinrad + mtx00*cosrad;\n\tmtx[ 8] = mtx[ 8]*cosrad - mtx00*sinrad;\n\t\n\tmtx[ 1] = mtx[ 9]*sinrad + mtx01*cosrad;\n\tmtx[ 9] = mtx[ 9]*cosrad - mtx01*sinrad;\n\t\n\tmtx[ 2] = mtx[10]*sinrad + mtx02*cosrad;\n\tmtx[10] = mtx[10]*cosrad - mtx02*sinrad;\n\t\n\tmtx[ 3] = mtx[11]*sinrad + mtx03*cosrad;\n\tmtx[11] = mtx[11]*cosrad - mtx03*sinrad;\n}\n\n\nvoid mtxRotateZApply(float* mtx, float deg)\n{\n\t// [ 0 4  8 12 ]   [ cos -sin 0  0 ]\n\t// [ 1 5  9 13 ] x [ sin cos  0  0 ]\n\t// [ 2 6 10 14 ]   [ 0   0    1  0 ]\n\t// [ 3 7 11 15 ]   [ 0   0    0  1 ]\n\t\n\tfloat rad = deg * (M_PI/180.0f);\n\t\n\tfloat cosrad = cosf(rad);\n\tfloat sinrad = sinf(rad);\n\t\n\tfloat mtx00 = mtx[0];\n\tfloat mtx01 = mtx[1];\n\tfloat mtx02 = mtx[2];\n\tfloat mtx03 = mtx[3];\n\t\n\tmtx[ 0] = mtx[ 4]*sinrad + mtx00*cosrad;\n\tmtx[ 4] = mtx[ 4]*cosrad - mtx00*sinrad;\n\t\n\tmtx[ 1] = mtx[ 5]*sinrad + mtx01*cosrad;\n\tmtx[ 5] = mtx[ 5]*cosrad - mtx01*sinrad;\n\t\n\tmtx[ 2] = mtx[ 6]*sinrad + mtx02*cosrad;\n\tmtx[ 6] = mtx[ 6]*cosrad - mtx02*sinrad;\n\t\n\tmtx[ 3] = mtx[ 7]*sinrad + mtx03*cosrad;\n\tmtx[ 7] = mtx[ 7]*cosrad - mtx03*sinrad;\n}\n\nvoid mtxRotateApply(float* mtx, float deg, float xAxis, float yAxis, float zAxis)\n{\t\n\tif(yAxis == 0.0f && zAxis == 0.0f)\n\t{\n\t\tmtxRotateXApply(mtx, deg);\n\t}\n\telse if(xAxis == 0.0f && zAxis == 0.0f)\n\t{\n\t\tmtxRotateYApply(mtx, deg);\n\t}\n\telse if(xAxis == 0.0f && yAxis == 0.0f)\n\t{\n\t\tmtxRotateZApply(mtx, deg);\n\t}\n\telse\n\t{\n\t\tfloat rad = deg * M_PI/180.0f;\n\t\t\n\t\tfloat sin_a = sinf(rad);\n\t\tfloat cos_a = cosf(rad);\n\t\t\n\t\t// Calculate coeffs.  No need to check for zero magnitude because we wouldn't be here.\n\t\tfloat magnitude = sqrtf(xAxis * xAxis + yAxis * yAxis + zAxis * zAxis);\n\t\t\n\t\tfloat p = 1.0f / magnitude;\n\t\tfloat cos_am = 1.0f - cos_a;\n\t\t\n\t\tfloat xp = xAxis * p;\n\t\tfloat yp = yAxis * p;\n\t\tfloat zp = zAxis * p;\n\t\t\n\t\tfloat xx = xp * xp;\n\t\tfloat yy = yp * yp;\n\t\tfloat zz = zp * zp;\n\t\t\n\t\tfloat xy = xp * yp * cos_am;\n\t\tfloat yz = yp * zp * cos_am;\n\t\tfloat zx = zp * xp * cos_am;\n\t\t\n\t\txp *= sin_a;\n\t\typ *= sin_a;\n\t\tzp *= sin_a;\n\t\t\n\t\t// Load coefs\n\t\tfloat m0  = xx + cos_a * (1.0f - xx);\n\t\tfloat m1  = xy + zp;\n\t\tfloat m2  = zx - yp;\n\t\tfloat m4  = xy - zp;\n\t\tfloat m5  = yy + cos_a * (1.0f - yy);\n\t\tfloat m6  = yz + xp;\n\t\tfloat m8  = zx + yp;\n\t\tfloat m9  = yz - xp;\n\t\tfloat m10 = zz + cos_a * (1.0f - zz);\n\t\t\n\t\t// Apply rotation \n\t\tfloat c1 = mtx[0];\n\t\tfloat c2 = mtx[4];\n\t\tfloat c3 = mtx[8];\n\t\tmtx[0]  = c1 * m0 + c2 * m1 + c3 * m2;\n\t\tmtx[4]  = c1 * m4 + c2 * m5 + c3 * m6;\n\t\tmtx[8]  = c1 * m8 + c2 * m9 + c3 * m10;\n\t\t\n\t\tc1 = mtx[1];\n\t\tc2 = mtx[5];\n\t\tc3 = mtx[9];\n\t\tmtx[1]  = c1 * m0 + c2 * m1 + c3 * m2;\n\t\tmtx[5]  = c1 * m4 + c2 * m5 + c3 * m6;\n\t\tmtx[9]  = c1 * m8 + c2 * m9 + c3 * m10;\n\t\t\n\t\tc1 = mtx[2];\n\t\tc2 = mtx[6];\n\t\tc3 = mtx[10];\n\t\tmtx[2]  = c1 * m0 + c2 * m1 + c3 * m2;\n\t\tmtx[6]  = c1 * m4 + c2 * m5 + c3 * m6;\n\t\tmtx[10] = c1 * m8 + c2 * m9 + c3 * m10;\n\t\t\n\t\tc1 = mtx[3];\n\t\tc2 = mtx[7];\n\t\tc3 = mtx[11];\n\t\tmtx[3]  = c1 * m0 + c2 * m1 + c3 * m2;\n\t\tmtx[7]  = c1 * m4 + c2 * m5 + c3 * m6;\n\t\tmtx[11] = c1 * m8 + c2 * m9 + c3 * m10;\n\t}\t\n}\n\nvoid mtxScaleMatrix(float* mtx, float xScale, float yScale, float zScale)\n{ \n    // [ x 0 0 0 ]   [ 0 4  8 12 ]\n    // [ 0 y 0 0 ] x [ 1 5  9 13 ]\n    // [ 0 0 z 0 ]   [ 2 6 10 14 ]\n    // [ 0 0 0 1 ]   [ 3 7 11 15 ]\n\t\n\tmtx[ 0] *= xScale;\n\tmtx[ 4] *= xScale;\n\tmtx[ 8] *= xScale;\n\tmtx[12] *= xScale;\n\t\n\tmtx[ 1] *= yScale;\n\tmtx[ 5] *= yScale;\n\tmtx[ 9] *= yScale;\t\t\n\tmtx[13] *= yScale;\n\t\n\tmtx[ 2] *= zScale;\n\tmtx[ 6] *= zScale;\n\tmtx[10] *= zScale;\n\tmtx[14] *= zScale;\n}\n\n\nvoid mtxRotateXMatrix(float* mtx, float rad)\n{\n\t// [ 1  0    0  0 ]   [ 0 4  8 12 ]\n\t// [ 0 cos -sin 0 ] x [ 1 5  9 13 ]\n\t// [ 0 sin  cos 0 ]   [ 2 6 10 14 ]\n\t// [ 0  0    0  1 ]   [ 3 7 11 15 ]\n\t\n\tfloat cosrad = cosf(rad);\n\tfloat sinrad = sinf(rad);\n\t\n\tfloat mtx01 = mtx[ 1];\n\tfloat mtx05 = mtx[ 5];\n\tfloat mtx09 = mtx[ 9];\n\tfloat mtx13 = mtx[13];\n\t\n\tmtx[ 1] = cosrad*mtx01 - sinrad*mtx[ 2];\n\tmtx[ 2] = sinrad*mtx01 + cosrad*mtx[ 2];\n\t\n\tmtx[ 5] = cosrad*mtx05 - sinrad*mtx[ 6];\n\tmtx[ 6] = sinrad*mtx05 + cosrad*mtx[ 6];\n\t\n\tmtx[ 9] = cosrad*mtx09 - sinrad*mtx[10];\n\tmtx[10] = sinrad*mtx09 + cosrad*mtx[10];\n\t\n\tmtx[13] = cosrad*mtx13 - sinrad*mtx[14];\n\tmtx[14] = sinrad*mtx13 + cosrad*mtx[14];\n}\n\n\nvoid mtxRotateYMatrix(float* mtx, float rad)\n{\n\t// [ cos 0  -sin 0 ]   [ 0 4  8 12 ]\n\t// [ 0   1  0    0 ] x [ 1 5  9 13 ]\n\t// [ sin 0  cos  0 ]   [ 2 6 10 14 ]\n\t// [ 0   0  0    1 ]   [ 3 7 11 15 ]\n\t\n\tfloat cosrad = cosf(rad);\n\tfloat sinrad = sinf(rad);\n\t\n\tfloat mtx00 = mtx[ 0];\n\tfloat mtx04 = mtx[ 4];\n\tfloat mtx08 = mtx[ 8];\n\tfloat mtx12 = mtx[12];\n\t\n\tmtx[ 0] = cosrad*mtx00 - sinrad*mtx[ 2];\n\tmtx[ 2] = sinrad*mtx00 + cosrad*mtx[ 2];\n\t\n\tmtx[ 4] = cosrad*mtx04 - sinrad*mtx[ 6];\n\tmtx[ 6] = sinrad*mtx04 + cosrad*mtx[ 6];\n\t\n\tmtx[ 8] = cosrad*mtx08 - sinrad*mtx[10];\n\tmtx[10] = sinrad*mtx08 + cosrad*mtx[10];\n\t\n\tmtx[12] = cosrad*mtx12 - sinrad*mtx[14];\n\tmtx[14] = sinrad*mtx12 + cosrad*mtx[14];\n}\n\n\nvoid mtxRotateZMatrix(float* mtx, float rad)\n{\n\t// [ cos -sin 0  0 ]   [ 0 4  8 12 ]\n\t// [ sin cos  0  0 ] x [ 1 5  9 13 ]\n\t// [ 0   0    1  0 ]   [ 2 6 10 14 ]\n\t// [ 0   0    0  1 ]   [ 3 7 11 15 ]\n\t\n\tfloat cosrad = cosf(rad);\n\tfloat sinrad = sinf(rad);\n\t\n\tfloat mtx00 = mtx[ 0];\n\tfloat mtx04 = mtx[ 4];\n\tfloat mtx08 = mtx[ 8];\n\tfloat mtx12 = mtx[12];\n\t\n\tmtx[ 0] = cosrad*mtx00 - sinrad*mtx[ 1];\n\tmtx[ 1] = sinrad*mtx00 + cosrad*mtx[ 1];\n\t\n\tmtx[ 4] = cosrad*mtx04 - sinrad*mtx[ 5];\n\tmtx[ 5] = sinrad*mtx04 + cosrad*mtx[ 5];\n\t\n\tmtx[ 8] = cosrad*mtx08 - sinrad*mtx[ 9];\n\tmtx[ 9] = sinrad*mtx08 + cosrad*mtx[ 9];\n\t\n\tmtx[12] = cosrad*mtx12 - sinrad*mtx[13];\n\tmtx[13] = sinrad*mtx12 + cosrad*mtx[13];\n}\n\nvoid mtxRotateMatrix(float* mtx, float rad, float xAxis, float yAxis, float zAxis)\n{\n\tfloat rotMtx[16];\n\t\n\tmtxLoadRotate(rotMtx, rad, xAxis, yAxis, zAxis);\n\t\n\tmtxMultiply(mtx, rotMtx, mtx);\n}\n\n\n\nvoid mtx3x3LoadIdentity(float* mtx)\n{\n\tmtx[0] = mtx[4] = mtx[8] = 1.0f;\n\t\n\tmtx[1] = mtx[2] = mtx[3] = \n\tmtx[5] = mtx[6] = mtx[7] = 0.0f;\n\t\n}\n\nvoid mtx3x3FromTopLeftOf4x4(float* mtx, const float* src)\n{    \n\tmtx[0] = src[0];\n\tmtx[1] = src[1];\n\tmtx[2] = src[2];\n\tmtx[3] = src[4];\n\tmtx[4] = src[5];\n\tmtx[5] = src[6];\n\tmtx[6] = src[8];\n\tmtx[7] = src[9];\n\tmtx[8] = src[10];\n}\n\nvoid mtx3x3Transpose(float* mtx, const float* src)\n{  \n\tfloat tmp;  \n\tmtx[0] = src[0];\n\tmtx[4] = src[4];\n\tmtx[8] = src[8];\n\t\n\ttmp = src[1];\n\tmtx[1] = src[3];\n\tmtx[3] = tmp;\n\t\n\ttmp = src[2];\n\tmtx[2] = src[6];\n\tmtx[6] = tmp;\n\t\n\ttmp = src[5];\n\tmtx[5] = src[7];\n\tmtx[7] = tmp;\n}\n\n\nvoid mtx3x3Invert(float* mtx, const float* src)\n{    \n\tfloat cpy[9];\n\tfloat det =\n\tsrc[0] * (src[4]*src[8] - src[7]*src[5]) -\n\tsrc[1] * (src[3]*src[8] - src[6]*src[5]) +\n\tsrc[2] * (src[3]*src[7] - src[6]*src[4]);\n\t\n\tif ( fabs( det ) < 0.0005 )\n\t{\n\t\tmtx3x3LoadIdentity(mtx);\n\t\treturn;\n\t}\n\t\n\tmemcpy(cpy, src, 9 * sizeof(float));\n\t\n\tmtx[0] =   cpy[4]*cpy[8] - cpy[5]*cpy[7]  / det;\n\tmtx[1] = -(cpy[1]*cpy[8] - cpy[7]*cpy[2]) / det;\n\tmtx[2] =   cpy[1]*cpy[5] - cpy[4]*cpy[2]  / det;\n\t\n\tmtx[3] = -(cpy[3]*cpy[8] - cpy[5]*cpy[6]) / det;\n\tmtx[4] =   cpy[0]*cpy[8] - cpy[6]*cpy[2]  / det;\n\tmtx[5] = -(cpy[0]*cpy[5] - cpy[3]*cpy[2]) / det;\n\t\n\tmtx[6] =   cpy[3]*cpy[7] - cpy[6]*cpy[4]  / det;\n\tmtx[7] = -(cpy[0]*cpy[7] - cpy[6]*cpy[1]) / det;\n\tmtx[8] =   cpy[0]*cpy[4] - cpy[1]*cpy[3]  / det;\n}\n\nvoid mtx3x3Multiply(float* mtx, const float* lhs, const float* rhs)\n{\n\tmtx[0] = lhs[0]*rhs[0] + lhs[3] * rhs[1] + lhs[6] * rhs[2];\n\tmtx[1] = lhs[1]*rhs[0] + lhs[4] * rhs[1] + lhs[7] * rhs[2];\n\tmtx[2] = lhs[2]*rhs[0] + lhs[5] * rhs[1] + lhs[8] * rhs[2];\n\t\n\tmtx[3] = lhs[0]*rhs[3] + lhs[3] * rhs[4] + lhs[6] * rhs[5];\n\tmtx[4] = lhs[1]*rhs[3] + lhs[4] * rhs[4] + lhs[7] * rhs[5];\n\tmtx[5] = lhs[2]*rhs[3] + lhs[5] * rhs[4] + lhs[8] * rhs[5];\n\t\n\tmtx[6] = lhs[0]*rhs[6] + lhs[3] * rhs[7] + lhs[6] * rhs[8];\n\tmtx[7] = lhs[1]*rhs[6] + lhs[4] * rhs[7] + lhs[7] * rhs[8];\n\tmtx[8] = lhs[2]*rhs[6] + lhs[5] * rhs[7] + lhs[8] * rhs[8];\n}\n\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/matrixUtil.h",
    "content": "/*\n     File: matrixUtil.h\n Abstract: \n Functions for performing matrix math.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __MATRIX_UTIL_H__\n#define __MATRIX_UTIL_H__\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// Matrix is a column major floating point array\n\n// All matrices are 4x4 by unless the mtx3x3 prefix is specified in the function name\n\n// [ 0 4  8 12 ]\n// [ 1 5  9 13 ]\n// [ 2 6 10 14 ]\n// [ 3 7 11 15 ]\n\n// MTX = LeftHandSideMatrix * RightHandSideMatrix\nvoid mtxMultiply(float* ret, const float* lhs, const float* rhs);\n\n// MTX = IdentityMatrix\nvoid mtxLoadIdentity(float* mtx);\n\n// MTX = Transpos(SRC)\nvoid mtxTranspose(float* mtx, const float* src);\n\n// MTX = src^-1\nvoid mtxInvert(float* mtx, const float* src);\n\n// MTX = PerspectiveProjectionMatrix\nvoid mtxLoadPerspective(float* mtx, float fov, float aspect, float nearZ, float farZ);\n\n// MTX = OrthographicProjectionMatrix\nvoid mtxLoadOrthographic(float* mtx,\n\t\t\t\t\t\t\t\tfloat left, float right, \n\t\t\t\t\t\t\t\tfloat bottom, float top, \n\t\t\t\t\t\t\t\tfloat nearZ, float farZ);\n\n// MTX = ObliqueProjectionMatrix(src, clipPlane)\nvoid mtxModifyObliqueProjection(float* mtx, const float* src, const float* plane);\n\n// MTX = TranlationMatrix\nvoid mtxLoadTranslate(float* mtx, float xTrans, float yTrans, float zTrans);\n\n// MTX = ScaleMatrix\nvoid mtxLoadScale(float* mtx, float xScale, float yScale, float zScale);\n\n// MTX = RotateXYZMatrix\nvoid mtxLoadRotate(float*mtx, float deg, float xAxis, float , float zAxis);\n\n// MTX = RotateXMatrix\nvoid mtxLoadRotateX(float* mtx, float deg);\n\n// MTX = RotateYMatrix\nvoid mtxLoadRotateY(float* mtx, float deg);\n\n// MTX = RotateZMatrix\nvoid mtxLoadRotateZ(float* mtx, float deg);\n\n// MTX = MTX * TranslationMatrix - Similar to glTranslate\nvoid mtxTranslateApply(float* mtx, float xTrans, float yTrans, float zTrans);\n\n// MTX = MTX * ScaleMatrix - Similar to glScale\nvoid mtxScaleApply(float* mtx, float xScale, float yScale, float zScale);\n\n// MTX = MTX * RotateXYZMatrix - Similar to glRotate\nvoid mtxRotateApply(float* mtx, float deg, float xAxis, float yAxis, float zAxis);\n\n// MTX = MTX * RotateXMatrix\nvoid mtxRotateXApply(float* mtx, float rad);\n\n// MTX = MTX * RotateYMatrix\nvoid mtxRotateYApply(float* mtx, float rad);\n\n// MTX = MTX * RotateZMatrix\nvoid mtxRotateZApply(float* mtx, float rad);\n\n// MTX = TranslationMatrix * MTX\nvoid mtxTranslateMatrix(float* mtx, float xTrans, float yTrans, float zTrans);\n\n// MTX = ScaleMatrix * MTX\nvoid mtxScaleMatrix(float* mtx, float xScale, float yScale, float zScale);\n\n// MTX = RotateXYZMatrix * MTX\nvoid mtxRotateMatrix(float* mtx, float rad, float xAxis, float yAxis, float zAxis);\n\n// MTX = RotateXMatrix * MTX\nvoid mtxRotateXMatrix(float* mtx, float rad);\n\n// MTX = RotateYMatrix * MTX\nvoid mtxRotateYMatrix(float* mtx, float rad);\n\n// MTX = RotateZMatrix * MTX\nvoid mtxRotateZMatrix(float* mtx, float rad);\n\n// 3x3 MTX = 3x3 IdendityMatrix\nvoid mtx3x3LoadIdentity(float* mtx);\n\n\n// 3x3 MTX = 3x3 LHS x 3x3 RHS\nvoid mtx3x3Multiply(float* mtx, const float* lhs, const float* rhs);\n\n\n// 3x3 MTX = TopLeft of MTX \nvoid mtx3x3FromTopLeftOf4x4(float* mtx, const float* src);\n\n// 3x3 MTX = Transpose(3x3 SRC)\nvoid mtx3x3Transpose(float* mtx, const float* src);\n\n// 3x3 MTX = 3x3 SRC^-1\nvoid mtx3x3Invert(float* mtx, const float* src);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif //__MATRIX_UTIL_H__\n\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/modelUtil.c",
    "content": "/*\n     File: modelUtil.c\n Abstract: \n Functions for loading a model file for vertex arrays.  The model file \n format used is a simple \"binary blob\" invented for the purpose of \n this sample code.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#include \"modelUtil.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef struct modelHeaderRec\n{\n\tchar fileIdentifier[30];\n\tunsigned int majorVersion;\n\tunsigned int minorVersion;\n} modelHeader;\n\ntypedef struct modelTOCRec\n{\n\tunsigned int attribHeaderSize;\n\tunsigned int byteElementOffset;\n\tunsigned int bytePositionOffset;\n\tunsigned int byteTexcoordOffset;\n\tunsigned int byteNormalOffset;\n} modelTOC;\n\ntypedef struct modelAttribRec\n{\n\tunsigned int byteSize;\n\tGLenum datatype;\n\tGLenum primType; //If index data\n\tunsigned int sizePerElement;\n\tunsigned int numElements;\n} modelAttrib;\n\ndemoModel* mdlLoadModel(const char* filepathname)\n{\n\tif(NULL == filepathname)\n\t{\n\t\treturn NULL;\n\t}\n\t\n\tdemoModel* model = (demoModel*) calloc(sizeof(demoModel), 1);\n\t\n\tif(NULL == model)\n\t{\n\t\treturn NULL;\n\t}\n\t\t\t\t\t\t\n\t\n\tsize_t sizeRead;\n\tint error;\n\tFILE* curFile = fopen(filepathname, \"r\");\n\t\n\tif(!curFile)\n\t{\t\n\t\tmdlDestroyModel(model);\t\n\t\treturn NULL;\n\t}\n\t\n\tmodelHeader header;\n\t\n\tsizeRead = fread(&header, 1, sizeof(modelHeader), curFile);\n\t\n\tif(sizeRead != sizeof(modelHeader))\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tif(strncmp(header.fileIdentifier, \"AppleOpenGLDemoModelWWDC2010\", sizeof(header.fileIdentifier)))\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tif(header.majorVersion != 0 && header.minorVersion != 1)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodelTOC toc;\n\t\n\tsizeRead = fread(&toc, 1, sizeof(modelTOC), curFile);\n\t\n\tif(sizeRead != sizeof(modelTOC))\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tif(toc.attribHeaderSize > sizeof(modelAttrib))\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodelAttrib attrib;\n\t\n\terror = fseek(curFile, toc.byteElementOffset, SEEK_SET);\n\t\n\tif(error < 0)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tsizeRead = fread(&attrib, 1, toc.attribHeaderSize, curFile);\n\t\n\tif(sizeRead != toc.attribHeaderSize)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodel->elementArraySize = attrib.byteSize;\n\tmodel->elementType = attrib.datatype;\n\tmodel->numElements = attrib.numElements;\n\t\n\t// OpenGL ES cannot use UNSIGNED_INT elements\n\t// So if the model has UI element...\n\tif(GL_UNSIGNED_INT == model->elementType)\n\t{\n\t\t//...Load the UI elements and convert to UNSIGNED_SHORT\n\t\t\n\t\tGLubyte* uiElements = (GLubyte*) malloc(model->elementArraySize);\n\t\tsize_t ushortElementArraySize = model->numElements * sizeof(GLushort);\n\t\tmodel->elements = (GLubyte*)malloc(ushortElementArraySize); \n\t\t\n\t\tsizeRead = fread(uiElements, 1, model->elementArraySize, curFile);\n\t\t\n\t\tif(sizeRead != model->elementArraySize)\n\t\t{\n\t\t\tfclose(curFile);\n\t\t\tmdlDestroyModel(model);\t\t\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\tGLuint elemNum = 0;\n\t\tfor(elemNum = 0; elemNum < model->numElements; elemNum++)\n\t\t{\n\t\t\t//We can't handle this model if an element is out of the UNSIGNED_INT range\n\t\t\tif(((GLuint*)uiElements)[elemNum] >= 0xFFFF)\n\t\t\t{\n\t\t\t\tfclose(curFile);\n\t\t\t\tmdlDestroyModel(model);\t\t\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\t\n\t\t\t((GLushort*)model->elements)[elemNum] = ((GLuint*)uiElements)[elemNum];\n\t\t}\n\t\t\n\t\tfree(uiElements);\n\t\n\t\t\n\t\tmodel->elementType = GL_UNSIGNED_SHORT;\n\t\tmodel->elementArraySize = model->numElements * sizeof(GLushort);\n\t}\n\telse \n\t{\t\n\t\tmodel->elements = (GLubyte*)malloc(model->elementArraySize);\n\t\t\n\t\tsizeRead = fread(model->elements, 1, model->elementArraySize, curFile);\n\t\t\n\t\tif(sizeRead != model->elementArraySize)\n\t\t{\n\t\t\tfclose(curFile);\n\t\t\tmdlDestroyModel(model);\t\t\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tfseek(curFile, toc.bytePositionOffset, SEEK_SET);\n\t\n\tsizeRead = fread(&attrib, 1, toc.attribHeaderSize, curFile);\n\t\n\tif(sizeRead != toc.attribHeaderSize)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodel->positionArraySize = attrib.byteSize;\n\tmodel->positionType = attrib.datatype;\n\tmodel->positionSize = attrib.sizePerElement;\n\tmodel->numVertcies = attrib.numElements;\n\tmodel->positions = (GLubyte*) malloc(model->positionArraySize);\n\t\n\tsizeRead = fread(model->positions, 1, model->positionArraySize, curFile);\n\t\n\tif(sizeRead != model->positionArraySize)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\terror = fseek(curFile, toc.byteTexcoordOffset, SEEK_SET);\n\t\n\tif(error < 0)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tsizeRead = fread(&attrib, 1, toc.attribHeaderSize, curFile);\n\t\n\tif(sizeRead != toc.attribHeaderSize)\n\t{\t\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodel->texcoordArraySize = attrib.byteSize;\n\tmodel->texcoordType = attrib.datatype;\n\tmodel->texcoordSize = attrib.sizePerElement;\n\t\n\t//Must have the same number of texcoords as positions\n\tif(model->numVertcies != attrib.numElements)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodel->texcoords = (GLubyte*) malloc(model->texcoordArraySize);\n\t\n\tsizeRead = fread(model->texcoords, 1, model->texcoordArraySize, curFile);\n\t\n\tif(sizeRead != model->texcoordArraySize)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\terror = fseek(curFile, toc.byteNormalOffset, SEEK_SET);\n\t\n\tif(error < 0)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tsizeRead = fread(&attrib, 1, toc.attribHeaderSize, curFile);\n\t\n\tif(sizeRead !=  toc.attribHeaderSize)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\tmodel->normalArraySize = attrib.byteSize;\n\tmodel->normalType = attrib.datatype;\n\tmodel->normalSize = attrib.sizePerElement;\n\n\t//Must have the same number of normals as positions\n\tif(model->numVertcies != attrib.numElements)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\t\n\tmodel->normals = (GLubyte*) malloc(model->normalArraySize );\n\t\n\tsizeRead =  fread(model->normals, 1, model->normalArraySize , curFile);\n\t\n\tif(sizeRead != model->normalArraySize)\n\t{\n\t\tfclose(curFile);\n\t\tmdlDestroyModel(model);\t\t\n\t\treturn NULL;\n\t}\n\t\n\t\n\tfclose(curFile);\n\t\n\treturn model;\n\t\n}\n\ndemoModel* mdlLoadQuadModel()\n{\n\tGLfloat posArray[] = {\n\t\t-200.0f, 0.0f, -200.0f,\n\t\t 200.0f, 0.0f, -200.0f,\n\t\t 200.0f, 0.0f,  200.0f,\n\t\t-200.0f, 0.0f,  200.0f\n\t};\n\t\t\n\tGLfloat texcoordArray[] = { \n\t\t0.0f,  1.0f,\n\t\t1.0f,  1.0f,\n\t\t1.0f,  0.0f,\n\t\t0.0f,  0.0f\n\t};\n\t\n\tGLfloat normalArray[] = {\n\t\t0.0f, 0.0f, 1.0,\n\t\t0.0f, 0.0f, 1.0f,\n\t\t0.0f, 0.0f, 1.0f,\n\t\t0.0f, 0.0f, 1.0f,\n\t};\n\t\n\tGLushort elementArray[] =\n\t{\n\t\t0, 2, 1,\n\t\t0, 3, 2\n\t};\n\t\n\tdemoModel* model = (demoModel*) calloc(sizeof(demoModel), 1);\n\t\n\tif(NULL == model)\n\t{\n\t\treturn NULL;\n\t}\n\t\n\tmodel->positionType = GL_FLOAT;\n\tmodel->positionSize = 3;\n\tmodel->positionArraySize = sizeof(posArray);\n\tmodel->positions = (GLubyte*)malloc(model->positionArraySize);\n\tmemcpy(model->positions, posArray, model->positionArraySize);\n\t\n\tmodel->texcoordType = GL_FLOAT;\n\tmodel->texcoordSize = 2;\n\tmodel->texcoordArraySize = sizeof(texcoordArray);\n\tmodel->texcoords = (GLubyte*)malloc(model->texcoordArraySize);\n\tmemcpy(model->texcoords, texcoordArray, model->texcoordArraySize );\n\n\tmodel->normalType = GL_FLOAT;\n\tmodel->normalSize = 3;\n\tmodel->normalArraySize = sizeof(normalArray);\n\tmodel->normals = (GLubyte*)malloc(model->normalArraySize);\n\tmemcpy(model->normals, normalArray, model->normalArraySize);\n\t\n\tmodel->elementArraySize = sizeof(elementArray);\n\tmodel->elements\t= (GLubyte*)malloc(model->elementArraySize);\n\tmemcpy(model->elements, elementArray, model->elementArraySize);\n\t\n\tmodel->primType = GL_TRIANGLES;\n\t\n\t\n\tmodel->numElements = sizeof(elementArray) / sizeof(GLushort);\n\tmodel->elementType = GL_UNSIGNED_SHORT;\n\tmodel->numVertcies = model->positionArraySize / (model->positionSize * sizeof(GLfloat));\n\t\n\treturn model;\n}\n\nvoid mdlDestroyModel(demoModel* model)\n{\n\tif(NULL == model)\n\t{\n\t\treturn;\n\t}\n\t\n\tfree(model->elements);\n\tfree(model->positions);\n\tfree(model->normals);\n\tfree(model->texcoords);\n\t\n\tfree(model);\n}\n\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/modelUtil.h",
    "content": "/*\n     File: modelUtil.h\n Abstract: \n Functions for loading a model file for vertex arrays.  The model file \n format used is a simple \"binary blob\" invented for the purpose of \n this sample code.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __MODEL_UTIL_H__\n#define __MODEL_UTIL_H__\n\n#include \"glUtil.h\"\n\ntypedef struct demoModelRec\n{\n\tGLuint numVertcies;\n\t\n\tGLubyte *positions;\n\tGLenum positionType;\n\tGLuint positionSize;\n\tGLsizei positionArraySize;\n\t\n\tGLubyte *texcoords;\n\tGLenum texcoordType;\n\tGLuint texcoordSize;\n\tGLsizei texcoordArraySize;\n\t\n\tGLubyte *normals;\n\tGLenum normalType;\n\tGLuint normalSize;\n\tGLsizei normalArraySize;\n\t\t\n\tGLubyte *elements;\n\tGLenum elementType;\n\tGLuint numElements;\n\tGLsizei elementArraySize;\n\t\t\n\tGLenum primType;\n\t\n} demoModel;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ndemoModel* mdlLoadModel(const char* filepathname);\n\ndemoModel* mdlLoadQuadModel();\n\nvoid mdlDestroyModel(demoModel* model);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif //__MODEL_UTIL_H__\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/porting/include/KLBPlatformMetrics.h",
    "content": "#ifndef KLBPlatformMetrics_h\n#define KLBPlatformMetrics_h\n\n#include \"KLBPlatformMetricsCommon.h\"\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/sourceUtil.c",
    "content": "/*\n     File: sourceUtil.c\n Abstract: \n Functions for loading source files for shaders.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#include \"sourceUtil.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ndemoSource* srcLoadSource(const char* filepathname)\n{\n\tdemoSource* source = (demoSource*) calloc(sizeof(demoSource), 1);\n\t\n\t// Check the file name suffix to determine what type of shader this is\n\tconst char* suffixBegin = filepathname + strlen(filepathname) - 4;\n\t\n\tif(0 == strncmp(suffixBegin, \".fsh\", 4))\n\t{\n\t\tsource->shaderType = GL_FRAGMENT_SHADER;\n\t}\n\telse if(0 == strncmp(suffixBegin, \".vsh\", 4))\n\t{\n\t\tsource->shaderType = GL_VERTEX_SHADER;\n\t}\n\telse\n\t{\n\t\t// Unknown suffix\n\t\tsource->shaderType = 0;\n\t}\n\t\n\tFILE* curFile = fopen(filepathname, \"r\");\n\t\n\t// Get the size of the source\n\tfseek(curFile, 0, SEEK_END);\n\tGLsizei fileSize = ftell (curFile);\n\t\n\t// Add 1 to the file size to include the null terminator for the string\n\tsource->byteSize = fileSize + 1;\n\t\n\t// Alloc memory for the string\n\tsource->string = malloc(source->byteSize);\n\t\n\t// Read entire file into the string from beginning of the file\n\tfseek(curFile, 0, SEEK_SET);\n\tfread(source->string, 1, fileSize, curFile);\n\t\n\tfclose(curFile);\n\t\n\t// Insert null terminator\n\tsource->string[fileSize] = 0;\n\t\n\treturn source;\n}\n\nvoid srcDestroySource(demoSource* source)\n{\n\tfree(source->string);\n\tfree(source);\n}"
  },
  {
    "path": "Engine/porting/OSX/Playground/sourceUtil.h",
    "content": "/*\n     File: sourceUtil.h\n Abstract: \n Functions for loading source files for shaders.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __SOURCE_UTIL_H__\n#define __SOURCE_UTIL_H__\n\n#include \"glUtil.h\"\n\ntypedef struct demoSourceRec\n{\n\tGLchar* string;\n\t\n\tGLsizei byteSize;\n\t\n\tGLenum shaderType; // Vertex or Fragment\n\t\n} demoSource;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ndemoSource* srcLoadSource(const char* filepathname);\n\nvoid srcDestroySource(demoSource* source);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // __SOURCE_UTIL_H__\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/vectorUtil.c",
    "content": "/*\r\n     File: vectorUtil.c\r\n Abstract: \n Functions for performing vector math.\n \r\n  Version: 1.6\r\n \r\n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\r\n Inc. (\"Apple\") in consideration of your agreement to the following\r\n terms, and your use, installation, modification or redistribution of\r\n this Apple software constitutes acceptance of these terms.  If you do\r\n not agree with these terms, please do not use, install, modify or\r\n redistribute this Apple software.\r\n \r\n In consideration of your agreement to abide by the following terms, and\r\n subject to these terms, Apple grants you a personal, non-exclusive\r\n license, under Apple's copyrights in this original Apple software (the\r\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\r\n Software, with or without modifications, in source and/or binary forms;\r\n provided that if you redistribute the Apple Software in its entirety and\r\n without modifications, you must retain this notice and the following\r\n text and disclaimers in all such redistributions of the Apple Software.\r\n Neither the name, trademarks, service marks or logos of Apple Inc. may\r\n be used to endorse or promote products derived from the Apple Software\r\n without specific prior written permission from Apple.  Except as\r\n expressly stated in this notice, no other rights or licenses, express or\r\n implied, are granted by Apple herein, including but not limited to any\r\n patent rights that may be infringed by your derivative works or by other\r\n works in which the Apple Software may be incorporated.\r\n \r\n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\r\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\r\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\r\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\r\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\r\n \r\n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\r\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\r\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\r\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\r\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\r\n POSSIBILITY OF SUCH DAMAGE.\r\n \r\n Copyright (C) 2012 Apple Inc. All Rights Reserved.\r\n \r\n */\r\n\r\n#include \"vectorUtil.h\"\r\n\r\n#include <math.h>\r\n#include <memory.h>\r\n\r\nvoid vec4Add(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] + rhs[0];\r\n\tvec[1] = lhs[1] + rhs[1];\r\n\tvec[2] = lhs[2] + rhs[2];\r\n\tvec[3] = lhs[3] + rhs[3];\r\n}\r\n\r\nvoid vec4Subtract(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] - rhs[0];\r\n\tvec[1] = lhs[1] - rhs[1];\r\n\tvec[2] = lhs[2] - rhs[2];\r\n\tvec[3] = lhs[3] - rhs[3];\r\n}\r\n\r\n\r\nvoid vec4Multiply(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] * rhs[0];\r\n\tvec[1] = lhs[1] * rhs[1];\r\n\tvec[2] = lhs[2] * rhs[2];\r\n\tvec[3] = lhs[3] * rhs[3];\r\n}\r\n\r\nvoid vec4Divide(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] / rhs[0];\r\n\tvec[1] = lhs[1] / rhs[1];\r\n\tvec[2] = lhs[2] / rhs[2];\r\n\tvec[3] = lhs[3] / rhs[3];\r\n}\r\n\r\n\r\nvoid vec3Add(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] + rhs[0];\r\n\tvec[1] = lhs[1] + rhs[1];\r\n\tvec[2] = lhs[2] + rhs[2];\r\n}\r\n\r\nvoid vec3Subtract(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] - rhs[0];\r\n\tvec[1] = lhs[1] - rhs[1];\r\n\tvec[2] = lhs[2] - rhs[2];\r\n}\r\n\r\n\r\nvoid vec3Multiply(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] * rhs[0];\r\n\tvec[1] = lhs[1] * rhs[1];\r\n\tvec[2] = lhs[2] * rhs[2];\r\n}\r\n\r\nvoid vec3Divide(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[0] / rhs[0];\r\n\tvec[1] = lhs[1] / rhs[1];\r\n\tvec[2] = lhs[2] / rhs[2];\r\n}\r\n\r\nfloat vec3DotProduct(const float* lhs, const float* rhs)\r\n{\r\n\treturn lhs[0]*rhs[0] + lhs[1]*rhs[1] + lhs[2]*rhs[2];\t\r\n}\r\n\r\nfloat vec4DotProduct(const float* lhs, const float* rhs)\r\n{\r\n\treturn lhs[0]*rhs[0] + lhs[1]*rhs[1] + lhs[2]*rhs[2] + lhs[3]*rhs[3];\t\r\n}\r\n\r\nvoid vec3CrossProduct(float* vec, const float* lhs, const float* rhs)\r\n{\r\n\tvec[0] = lhs[1] * rhs[2] - lhs[2] * rhs[1];\r\n\tvec[1] = lhs[2] * rhs[0] - lhs[0] * rhs[2];\r\n\tvec[2] = lhs[0] * rhs[1] - lhs[1] * rhs[0];\r\n}\r\n\r\nfloat vec3Length(const float* vec)\r\n{\r\n\treturn sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);\r\n}\r\n\r\nfloat vec3Distance(const float* pointA, const float* pointB)\r\n{\r\n\tfloat diffx = pointA[0]-pointB[0];\r\n\tfloat diffy = pointA[1]-pointB[1];\r\n\tfloat diffz = pointA[2]-pointB[2];\r\n\treturn sqrtf(diffx*diffx + diffy*diffy + diffz*diffz);\r\n}\r\n\r\nvoid vec3Normalize(float* vec, const float* src)\r\n{\r\n\tfloat length = vec3Length(src);\r\n\t\r\n\tvec[0] = src[0]/length;\r\n\tvec[1] = src[1]/length;\r\n\tvec[2] = src[2]/length;\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Engine/porting/OSX/Playground/vectorUtil.h",
    "content": "/*\r\n     File: vectorUtil.h\r\n Abstract: \r\n Functions for performing vector math.\r\n \r\n  Version: 1.6\r\n \r\n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\r\n Inc. (\"Apple\") in consideration of your agreement to the following\r\n terms, and your use, installation, modification or redistribution of\r\n this Apple software constitutes acceptance of these terms.  If you do\r\n not agree with these terms, please do not use, install, modify or\r\n redistribute this Apple software.\r\n \r\n In consideration of your agreement to abide by the following terms, and\r\n subject to these terms, Apple grants you a personal, non-exclusive\r\n license, under Apple's copyrights in this original Apple software (the\r\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\r\n Software, with or without modifications, in source and/or binary forms;\r\n provided that if you redistribute the Apple Software in its entirety and\r\n without modifications, you must retain this notice and the following\r\n text and disclaimers in all such redistributions of the Apple Software.\r\n Neither the name, trademarks, service marks or logos of Apple Inc. may\r\n be used to endorse or promote products derived from the Apple Software\r\n without specific prior written permission from Apple.  Except as\r\n expressly stated in this notice, no other rights or licenses, express or\r\n implied, are granted by Apple herein, including but not limited to any\r\n patent rights that may be infringed by your derivative works or by other\r\n works in which the Apple Software may be incorporated.\r\n \r\n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\r\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\r\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\r\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\r\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\r\n \r\n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\r\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\r\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\r\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\r\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\r\n POSSIBILITY OF SUCH DAMAGE.\r\n \r\n Copyright (C) 2012 Apple Inc. All Rights Reserved.\r\n \r\n */\r\n\r\n#ifndef __VECTOR_UTIL_H__\r\n#define __VECTOR_UTIL_H__\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n// A Vector is floating point array with either 3 or 4 components\r\n// functions with the vec4 prefix require 4 elements in the array\r\n// functions with vec3 prefix require only 3 elements in the array\r\n\r\n// Subtracts one 4D vector to another\r\nvoid vec4Add(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Subtracts one 4D vector from another\r\nvoid vec4Subtract(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Multiplys one 4D vector by another\r\nvoid vec4Multiply(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Divides one 4D vector by another\r\nvoid vec4Divide(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Subtracts one 4D vector to another\r\nvoid vec3Add(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Subtracts one 4D vector from another\r\nvoid vec3Subtract(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Multiplys one 4D vector by another\r\nvoid vec3Multiply(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Divides one 4D vector by another\r\nvoid vec3Divide(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Calculates the Cross Product of a 3D vector\r\nvoid vec3CrossProduct(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Normalizes a 3D vector\r\nvoid vec3Normalize(float* vec, const float* src);\r\n\r\n// Returns the Dot Product of 2 3D vectors\r\nfloat vec3DotProduct(const float* lhs, const float* rhs);\r\n\r\n// Returns the Dot Product of 2 4D vectors\r\nfloat vec4DotProduct(const float* lhs, const float* rhs);\r\n\r\n// Returns the length of a 3D vector \r\n// (i.e the distance of a point from the origin)\r\nfloat vec3Length(const float* vec);\r\n\r\n// Returns the distance between two 3D points\r\nfloat vec3Distance(const float* pointA, const float* pointB);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif //__VECTOR_UTIL_H__\r\n"
  },
  {
    "path": "Engine/porting/OSX/Playground.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t32127067182530650027C57E /* CSampleProjectEntrance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32127065182530650027C57E /* CSampleProjectEntrance.cpp */; };\n\t\t3212706A182532090027C57E /* CKLBDeviceKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32127068182532090027C57E /* CKLBDeviceKeyEvent.cpp */; };\n\t\t3212706E18253C800027C57E /* FileDelete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3212706C18253C800027C57E /* FileDelete.cpp */; };\n\t\t3212706F18253C800027C57E /* FontRendering.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3212706D18253C800027C57E /* FontRendering.cpp */; };\n\t\t3212707418253D2A0027C57E /* itemimage.png.imag in Resources */ = {isa = PBXBuildFile; fileRef = 3212707018253D2A0027C57E /* itemimage.png.imag */; };\n\t\t3212707518253D2A0027C57E /* SimpleItem.lua in Resources */ = {isa = PBXBuildFile; fileRef = 3212707118253D2A0027C57E /* SimpleItem.lua */; };\n\t\t3212707618253D2A0027C57E /* start.lua in Resources */ = {isa = PBXBuildFile; fileRef = 3212707218253D2A0027C57E /* start.lua */; };\n\t\t3212707718253D2A0027C57E /* textureBoat.texb in Resources */ = {isa = PBXBuildFile; fileRef = 3212707318253D2A0027C57E /* textureBoat.texb */; };\n\t\t327C0B8A179A3944007B7F42 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0B89179A3944007B7F42 /* Cocoa.framework */; };\n\t\t327C0B94179A3944007B7F42 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 327C0B92179A3944007B7F42 /* InfoPlist.strings */; };\n\t\t327C0B96179A3945007B7F42 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 327C0B95179A3945007B7F42 /* main.m */; };\n\t\t327C0B9A179A3945007B7F42 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 327C0B98179A3945007B7F42 /* Credits.rtf */; };\n\t\t327C0B9D179A3945007B7F42 /* PlaygroundAppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 327C0B9C179A3945007B7F42 /* PlaygroundAppDelegate.mm */; };\n\t\t327C0BA0179A3945007B7F42 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 327C0B9E179A3945007B7F42 /* MainMenu.xib */; };\n\t\t327C0BE9179A3E4A007B7F42 /* CKLBNodeVirtualDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BDD179A3E4A007B7F42 /* CKLBNodeVirtualDocument.cpp */; };\n\t\t327C0BEA179A3E4A007B7F42 /* CKLBSplineNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BDF179A3E4A007B7F42 /* CKLBSplineNode.cpp */; };\n\t\t327C0BEB179A3E4A007B7F42 /* CKLBSWFPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BE0179A3E4A007B7F42 /* CKLBSWFPlayer.cpp */; };\n\t\t327C0BED179A3E4A007B7F42 /* CKLBScoreNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BE4179A3E4A007B7F42 /* CKLBScoreNode.cpp */; };\n\t\t327C0BEE179A3E4A007B7F42 /* CKLBSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BE7179A3E4A007B7F42 /* CKLBSystem.cpp */; };\n\t\t327C0C04179A3E63007B7F42 /* CKLBTexturePacker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF0179A3E63007B7F42 /* CKLBTexturePacker.cpp */; };\n\t\t327C0C05179A3E63007B7F42 /* CompositeManagement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF2179A3E63007B7F42 /* CompositeManagement.cpp */; };\n\t\t327C0C06179A3E63007B7F42 /* TextureManagement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF3179A3E63007B7F42 /* TextureManagement.cpp */; };\n\t\t327C0C07179A3E63007B7F42 /* CKLBAssetManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF4179A3E63007B7F42 /* CKLBAssetManager.cpp */; };\n\t\t327C0C08179A3E63007B7F42 /* AudioAsset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF5179A3E63007B7F42 /* AudioAsset.cpp */; };\n\t\t327C0C0B179A3E63007B7F42 /* CKLBPropertyBag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BFD179A3E63007B7F42 /* CKLBPropertyBag.cpp */; };\n\t\t327C0C0D179A3E63007B7F42 /* NodeAnimationAsset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C01179A3E63007B7F42 /* NodeAnimationAsset.cpp */; };\n\t\t327C0C4C179A3E7A007B7F42 /* CKLBTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C0E179A3E7A007B7F42 /* CKLBTask.cpp */; };\n\t\t327C0C4D179A3E7A007B7F42 /* CKLBAsyncFilecopy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C11179A3E7A007B7F42 /* CKLBAsyncFilecopy.cpp */; };\n\t\t327C0C4E179A3E7A007B7F42 /* CKLBGameApplication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C12179A3E7A007B7F42 /* CKLBGameApplication.cpp */; };\n\t\t327C0C4F179A3E7A007B7F42 /* CKLBLuaEnv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C14179A3E7A007B7F42 /* CKLBLuaEnv.cpp */; };\n\t\t327C0C50179A3E7A007B7F42 /* CKLBUITask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C15179A3E7A007B7F42 /* CKLBUITask.cpp */; };\n\t\t327C0C51179A3E7A007B7F42 /* encryptFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C16179A3E7A007B7F42 /* encryptFile.cpp */; };\n\t\t327C0C52179A3E7A007B7F42 /* CKLBDebugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1A179A3E7A007B7F42 /* CKLBDebugger.cpp */; };\n\t\t327C0C53179A3E7A007B7F42 /* CKLBGameApplicationDebugModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1B179A3E7A007B7F42 /* CKLBGameApplicationDebugModule.cpp */; };\n\t\t327C0C54179A3E7A007B7F42 /* CKLBIntervalTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1C179A3E7A007B7F42 /* CKLBIntervalTimer.cpp */; };\n\t\t327C0C55179A3E7A007B7F42 /* CKLBLuaPropTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1D179A3E7A007B7F42 /* CKLBLuaPropTask.cpp */; };\n\t\t327C0C56179A3E7A007B7F42 /* CKLBUtility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1E179A3E7A007B7F42 /* CKLBUtility.cpp */; };\n\t\t327C0C57179A3E7A007B7F42 /* CKLBDataHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1F179A3E7A007B7F42 /* CKLBDataHandler.cpp */; };\n\t\t327C0C58179A3E7A007B7F42 /* Dictionnary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C20179A3E7A007B7F42 /* Dictionnary.cpp */; };\n\t\t327C0C59179A3E7A007B7F42 /* CKLBBinArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C21179A3E7A007B7F42 /* CKLBBinArray.cpp */; };\n\t\t327C0C5A179A3E7A007B7F42 /* CKLBContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C22179A3E7A007B7F42 /* CKLBContext.cpp */; };\n\t\t327C0C5B179A3E7A007B7F42 /* DebugAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C25179A3E7A007B7F42 /* DebugAlloc.cpp */; };\n\t\t327C0C5C179A3E7A007B7F42 /* DebugTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C26179A3E7A007B7F42 /* DebugTracker.cpp */; };\n\t\t327C0C5D179A3E7A007B7F42 /* CKLBAppProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C29179A3E7A007B7F42 /* CKLBAppProperty.cpp */; };\n\t\t327C0C5E179A3E7A007B7F42 /* CKLBAsyncLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C2B179A3E7A007B7F42 /* CKLBAsyncLoader.cpp */; };\n\t\t327C0C61179A3E7A007B7F42 /* CKLBGenericTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C33179A3E7A007B7F42 /* CKLBGenericTask.cpp */; };\n\t\t327C0C62179A3E7A007B7F42 /* CKLBLibRegistrator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C36179A3E7A007B7F42 /* CKLBLibRegistrator.cpp */; };\n\t\t327C0C63179A3E7A007B7F42 /* CKLBLifeCtrlTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C38179A3E7A007B7F42 /* CKLBLifeCtrlTask.cpp */; };\n\t\t327C0C64179A3E7A007B7F42 /* CKLBLuaTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C3C179A3E7A007B7F42 /* CKLBLuaTask.cpp */; };\n\t\t327C0C65179A3E7A007B7F42 /* CKLBObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C3D179A3E7A007B7F42 /* CKLBObject.cpp */; };\n\t\t327C0C66179A3E7A007B7F42 /* CKLBPauseCtrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C3F179A3E7A007B7F42 /* CKLBPauseCtrl.cpp */; };\n\t\t327C0C68179A3E7A007B7F42 /* CKLBTextTempBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C42179A3E7A007B7F42 /* CKLBTextTempBuffer.cpp */; };\n\t\t327C0C69179A3E7A007B7F42 /* CLuaState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C45179A3E7A007B7F42 /* CLuaState.cpp */; };\n\t\t327C0C6A179A3E7A007B7F42 /* CPFInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C46179A3E7A007B7F42 /* CPFInterface.cpp */; };\n\t\t327C0C6B179A3E7A007B7F42 /* ITmpFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C49179A3E7A007B7F42 /* ITmpFile.cpp */; };\n\t\t327C0C76179A3E98007B7F42 /* CKLBDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C6D179A3E98007B7F42 /* CKLBDatabase.cpp */; };\n\t\t327C0C77179A3E98007B7F42 /* CKLBLuaDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C6F179A3E98007B7F42 /* CKLBLuaDB.cpp */; };\n\t\t327C0C78179A3E98007B7F42 /* CKLBLanguageDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C72179A3E98007B7F42 /* CKLBLanguageDatabase.cpp */; };\n\t\t327C0C79179A3E98007B7F42 /* DataSet_JSonDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C74179A3E98007B7F42 /* DataSet_JSonDB.cpp */; };\n\t\t327C0C8A179A3EAF007B7F42 /* CKLBStoreService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C7A179A3EAF007B7F42 /* CKLBStoreService.cpp */; };\n\t\t327C0C8B179A3EAF007B7F42 /* CKLBNetAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C7C179A3EAF007B7F42 /* CKLBNetAPI.cpp */; };\n\t\t327C0C8C179A3EAF007B7F42 /* CKLBHTTPInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C7F179A3EAF007B7F42 /* CKLBHTTPInterface.cpp */; };\n\t\t327C0C8D179A3EAF007B7F42 /* CKLBUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C81179A3EAF007B7F42 /* CKLBUpdate.cpp */; };\n\t\t327C0C8E179A3EAF007B7F42 /* CUnZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C82179A3EAF007B7F42 /* CUnZip.cpp */; };\n\t\t327C0C8F179A3EAF007B7F42 /* CKLBJsonItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C83179A3EAF007B7F42 /* CKLBJsonItem.cpp */; };\n\t\t327C0C90179A3EAF007B7F42 /* MultithreadedNetwork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C84179A3EAF007B7F42 /* MultithreadedNetwork.cpp */; };\n\t\t327C0C91179A3EAF007B7F42 /* CKLBNetAPIKeyChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C88179A3EAF007B7F42 /* CKLBNetAPIKeyChain.cpp */; };\n\t\t327C0CBC179A3ECB007B7F42 /* CKLBLuaLibAPP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C92179A3ECB007B7F42 /* CKLBLuaLibAPP.cpp */; };\n\t\t327C0CBD179A3ECB007B7F42 /* CKLBLuaLibENG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C93179A3ECB007B7F42 /* CKLBLuaLibENG.cpp */; };\n\t\t327C0CBE179A3ECB007B7F42 /* CKLBLuaLibFONT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C95179A3ECB007B7F42 /* CKLBLuaLibFONT.cpp */; };\n\t\t327C0CBF179A3ECB007B7F42 /* CKLBLuaLibHASH.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C97179A3ECB007B7F42 /* CKLBLuaLibHASH.cpp */; };\n\t\t327C0CC0179A3ECB007B7F42 /* CKLBLuaLibSOUND.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C99179A3ECB007B7F42 /* CKLBLuaLibSOUND.cpp */; };\n\t\t327C0CC1179A3ECB007B7F42 /* CKLBLuaLibGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9B179A3ECB007B7F42 /* CKLBLuaLibGL.cpp */; };\n\t\t327C0CC2179A3ECB007B7F42 /* CKLBLuaLibDATA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9C179A3ECB007B7F42 /* CKLBLuaLibDATA.cpp */; };\n\t\t327C0CC3179A3ECB007B7F42 /* CKLBLuaLibMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9D179A3ECB007B7F42 /* CKLBLuaLibMatrix.cpp */; };\n\t\t327C0CC5179A3ECB007B7F42 /* ILuaFuncLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9F179A3ECB007B7F42 /* ILuaFuncLib.cpp */; };\n\t\t327C0CC6179A3ECB007B7F42 /* CKLBLuaLibCONV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA0179A3ECB007B7F42 /* CKLBLuaLibCONV.cpp */; };\n\t\t327C0CC7179A3ECB007B7F42 /* CKLBLuaLibKEY.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA2179A3ECB007B7F42 /* CKLBLuaLibKEY.cpp */; };\n\t\t327C0CC8179A3ECB007B7F42 /* CKLBLuaLibTASK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA3179A3ECB007B7F42 /* CKLBLuaLibTASK.cpp */; };\n\t\t327C0CC9179A3ECB007B7F42 /* CKLBLuaLibASSET.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA4179A3ECB007B7F42 /* CKLBLuaLibASSET.cpp */; };\n\t\t327C0CCA179A3ECB007B7F42 /* CKLBLuaConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA6179A3ECB007B7F42 /* CKLBLuaConst.cpp */; };\n\t\t327C0CCB179A3ECB007B7F42 /* CKLBLuaLibBIN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CAA179A3ECB007B7F42 /* CKLBLuaLibBIN.cpp */; };\n\t\t327C0CCC179A3ECB007B7F42 /* CKLBLuaLibDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CAE179A3ECB007B7F42 /* CKLBLuaLibDB.cpp */; };\n\t\t327C0CCD179A3ECB007B7F42 /* CKLBLuaLibDEBUG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB0179A3ECB007B7F42 /* CKLBLuaLibDEBUG.cpp */; };\n\t\t327C0CCE179A3ECB007B7F42 /* CKLBLuaLibLANG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB3179A3ECB007B7F42 /* CKLBLuaLibLANG.cpp */; };\n\t\t327C0CCF179A3ECB007B7F42 /* CKLBLuaLibRES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB6179A3ECB007B7F42 /* CKLBLuaLibRES.cpp */; };\n\t\t327C0CD0179A3ECB007B7F42 /* CKLBLuaLibUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB9179A3ECB007B7F42 /* CKLBLuaLibUI.cpp */; };\n\t\t327C0CE7179A3F34007B7F42 /* CKLBRenderingManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD1179A3F34007B7F42 /* CKLBRenderingManager.cpp */; };\n\t\t327C0CE8179A3F34007B7F42 /* CRenderingManager_GL1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD2179A3F34007B7F42 /* CRenderingManager_GL1.cpp */; };\n\t\t327C0CE9179A3F34007B7F42 /* CRenderingManager_GL2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD3179A3F34007B7F42 /* CRenderingManager_GL2.cpp */; };\n\t\t327C0CEA179A3F34007B7F42 /* CRenderingManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD4179A3F34007B7F42 /* CRenderingManager.cpp */; };\n\t\t327C0CEB179A3F34007B7F42 /* CTextureUsage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD5179A3F34007B7F42 /* CTextureUsage.cpp */; };\n\t\t327C0CEC179A3F34007B7F42 /* CBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD6179A3F34007B7F42 /* CBuffer.cpp */; };\n\t\t327C0CED179A3F34007B7F42 /* CIndexBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD7179A3F34007B7F42 /* CIndexBuffer.cpp */; };\n\t\t327C0CEE179A3F34007B7F42 /* CTextureBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD9179A3F34007B7F42 /* CTextureBase.cpp */; };\n\t\t327C0CEF179A3F34007B7F42 /* glWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDB179A3F34007B7F42 /* glWrapper.cpp */; };\n\t\t327C0CF0179A3F34007B7F42 /* CFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDC179A3F34007B7F42 /* CFrame.cpp */; };\n\t\t327C0CF1179A3F34007B7F42 /* CImageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDD179A3F34007B7F42 /* CImageBuffer.cpp */; };\n\t\t327C0CF2179A3F34007B7F42 /* CKLBCanvasSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDE179A3F34007B7F42 /* CKLBCanvasSprite.cpp */; };\n\t\t327C0CF3179A3F34007B7F42 /* CKLBSprite3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE0179A3F34007B7F42 /* CKLBSprite3D.cpp */; };\n\t\t327C0CF4179A3F34007B7F42 /* CShaderSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE2179A3F34007B7F42 /* CShaderSet.cpp */; };\n\t\t327C0CF5179A3F34007B7F42 /* CShaderSetInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE3179A3F34007B7F42 /* CShaderSetInstance.cpp */; };\n\t\t327C0CF6179A3F34007B7F42 /* CTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE4179A3F34007B7F42 /* CTexture.cpp */; };\n\t\t327C0CF8179A3F34007B7F42 /* shaderSource.inl in Resources */ = {isa = PBXBuildFile; fileRef = 327C0CE6179A3F34007B7F42 /* shaderSource.inl */; };\n\t\t327C0CFB179A3F4D007B7F42 /* CKLBNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CF9179A3F4D007B7F42 /* CKLBNode.cpp */; };\n\t\t327C0CFF179A3F76007B7F42 /* CSoundAnalysisMP3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CFC179A3F76007B7F42 /* CSoundAnalysisMP3.cpp */; };\n\t\t327C0D00179A3F76007B7F42 /* CSoundAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CFD179A3F76007B7F42 /* CSoundAnalysis.cpp */; };\n\t\t327C0D03179A408E007B7F42 /* CKLBScriptEnv_forLUA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D02179A408E007B7F42 /* CKLBScriptEnv_forLUA.cpp */; };\n\t\t327C0D10179A41AE007B7F42 /* CKLBDrawTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D04179A41AE007B7F42 /* CKLBDrawTask.cpp */; };\n\t\t327C0D11179A41AE007B7F42 /* CKLBDebugMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D05179A41AE007B7F42 /* CKLBDebugMenu.cpp */; };\n\t\t327C0D12179A41AE007B7F42 /* CKLBTouchPad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D07179A41AE007B7F42 /* CKLBTouchPad.cpp */; };\n\t\t327C0D13179A41AE007B7F42 /* CKLBTouchEventUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D09179A41AE007B7F42 /* CKLBTouchEventUI.cpp */; };\n\t\t327C0D14179A41AE007B7F42 /* CKLBOSCtrlEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D0B179A41AE007B7F42 /* CKLBOSCtrlEvent.cpp */; };\n\t\t327C0D15179A41AE007B7F42 /* CKLBLuaScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D0D179A41AE007B7F42 /* CKLBLuaScript.cpp */; };\n\t\t327C0D6E179A41BF007B7F42 /* CKLBUIVirtualDoc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D16179A41BE007B7F42 /* CKLBUIVirtualDoc.cpp */; };\n\t\t327C0D6F179A41BF007B7F42 /* CKLBUIList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D17179A41BE007B7F42 /* CKLBUIList.cpp */; };\n\t\t327C0D70179A41BF007B7F42 /* CKLBScrMgrDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D18179A41BE007B7F42 /* CKLBScrMgrDefault.cpp */; };\n\t\t327C0D71179A41BF007B7F42 /* CKLBScrMgrPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1A179A41BE007B7F42 /* CKLBScrMgrPage.cpp */; };\n\t\t327C0D72179A41BF007B7F42 /* CKLBUICanvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1C179A41BE007B7F42 /* CKLBUICanvas.cpp */; };\n\t\t327C0D73179A41BF007B7F42 /* CKLBUIDragIcon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1D179A41BE007B7F42 /* CKLBUIDragIcon.cpp */; };\n\t\t327C0D74179A41BF007B7F42 /* CKLBUIFreeVertItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1E179A41BE007B7F42 /* CKLBUIFreeVertItem.cpp */; };\n\t\t327C0D75179A41BF007B7F42 /* CKLBUIProgressBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D21179A41BE007B7F42 /* CKLBUIProgressBar.cpp */; };\n\t\t327C0D76179A41BF007B7F42 /* CKLBUIVariableItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D22179A41BE007B7F42 /* CKLBUIVariableItem.cpp */; };\n\t\t327C0D77179A41BF007B7F42 /* CKLBScrMgrSolid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D23179A41BE007B7F42 /* CKLBScrMgrSolid.cpp */; };\n\t\t327C0D78179A41BF007B7F42 /* CKLBScrollBarIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D25179A41BE007B7F42 /* CKLBScrollBarIF.cpp */; };\n\t\t327C0D79179A41BF007B7F42 /* CKLBLabelNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D27179A41BE007B7F42 /* CKLBLabelNode.cpp */; };\n\t\t327C0D7A179A41BF007B7F42 /* CKLBMovieNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D28179A41BE007B7F42 /* CKLBMovieNode.cpp */; };\n\t\t327C0D7B179A41BF007B7F42 /* CKLBTextInputNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D29179A41BE007B7F42 /* CKLBTextInputNode.cpp */; };\n\t\t327C0D7C179A41BF007B7F42 /* CKLBUIDebugItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2A179A41BE007B7F42 /* CKLBUIDebugItem.cpp */; };\n\t\t327C0D7D179A41BF007B7F42 /* CKLBUIWebArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2C179A41BE007B7F42 /* CKLBUIWebArea.cpp */; };\n\t\t327C0D7E179A41BF007B7F42 /* CKLBWebViewNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2D179A41BE007B7F42 /* CKLBWebViewNode.cpp */; };\n\t\t327C0D7F179A41BF007B7F42 /* CKLBUIClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2E179A41BE007B7F42 /* CKLBUIClip.cpp */; };\n\t\t327C0D80179A41BF007B7F42 /* CKLBUIMultiImgItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2F179A41BE007B7F42 /* CKLBUIMultiImgItem.cpp */; };\n\t\t327C0D81179A41BF007B7F42 /* CKLBUISWFPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D30179A41BE007B7F42 /* CKLBUISWFPlayer.cpp */; };\n\t\t327C0D82179A41BF007B7F42 /* CKLBUISystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D31179A41BE007B7F42 /* CKLBUISystem.cpp */; };\n\t\t327C0D83179A41BF007B7F42 /* CKLBUITouchPad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D32179A41BE007B7F42 /* CKLBUITouchPad.cpp */; };\n\t\t327C0D84179A41BF007B7F42 /* CKLBUIForm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D33179A41BE007B7F42 /* CKLBUIForm.cpp */; };\n\t\t327C0D85179A41BF007B7F42 /* CKLBUILabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D34179A41BE007B7F42 /* CKLBUILabel.cpp */; };\n\t\t327C0D86179A41BF007B7F42 /* CKLBUIControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D39179A41BE007B7F42 /* CKLBUIControl.cpp */; };\n\t\t327C0D87179A41BF007B7F42 /* CKLBUIScale9.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D3C179A41BE007B7F42 /* CKLBUIScale9.cpp */; };\n\t\t327C0D88179A41BF007B7F42 /* CKLBUITextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D3D179A41BE007B7F42 /* CKLBUITextInput.cpp */; };\n\t\t327C0D89179A41BF007B7F42 /* CKLBActivityIndicatorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D3E179A41BE007B7F42 /* CKLBActivityIndicatorNode.cpp */; };\n\t\t327C0D8A179A41BF007B7F42 /* CKLBDragCallbackIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D40179A41BE007B7F42 /* CKLBDragCallbackIF.cpp */; };\n\t\t327C0D8B179A41BF007B7F42 /* CKLBFormGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D42179A41BE007B7F42 /* CKLBFormGroup.cpp */; };\n\t\t327C0D8C179A41BF007B7F42 /* CKLBFormIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D44179A41BE007B7F42 /* CKLBFormIF.cpp */; };\n\t\t327C0D8D179A41BF007B7F42 /* CKLBModalStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D46179A41BE007B7F42 /* CKLBModalStack.cpp */; };\n\t\t327C0D8E179A41BF007B7F42 /* CKLBNodeAnimPack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D49179A41BE007B7F42 /* CKLBNodeAnimPack.cpp */; };\n\t\t327C0D8F179A41BF007B7F42 /* CKLBUIActivityIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D4B179A41BE007B7F42 /* CKLBUIActivityIndicator.cpp */; };\n\t\t327C0D91179A41BF007B7F42 /* CKLBUIGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D55179A41BE007B7F42 /* CKLBUIGroup.cpp */; };\n\t\t327C0D92179A41BF007B7F42 /* CKLBUIMoviePlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D58179A41BE007B7F42 /* CKLBUIMoviePlayer.cpp */; };\n\t\t327C0D93179A41BF007B7F42 /* CKLBUIPieChart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D5B179A41BE007B7F42 /* CKLBUIPieChart.cpp */; };\n\t\t327C0D94179A41BF007B7F42 /* CKLBUIPolyline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D5D179A41BE007B7F42 /* CKLBUIPolyline.cpp */; };\n\t\t327C0D95179A41BF007B7F42 /* CKLBUIRubberBand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D60179A41BE007B7F42 /* CKLBUIRubberBand.cpp */; };\n\t\t327C0D96179A41BF007B7F42 /* CKLBUIScore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D63179A41BE007B7F42 /* CKLBUIScore.cpp */; };\n\t\t327C0D97179A41BF007B7F42 /* CKLBUIScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D65179A41BE007B7F42 /* CKLBUIScrollBar.cpp */; };\n\t\t327C0D98179A41BF007B7F42 /* CKLBUISimpleItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D67179A41BE007B7F42 /* CKLBUISimpleItem.cpp */; };\n\t\t327C0D99179A41BF007B7F42 /* IMgrEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D6C179A41BE007B7F42 /* IMgrEntry.cpp */; };\n\t\t327C0DBE179A423F007B7F42 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DBD179A423F007B7F42 /* CoreAudio.framework */; };\n\t\t327C0DC0179A424C007B7F42 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DBF179A424C007B7F42 /* CoreFoundation.framework */; };\n\t\t327C0DC2179A4252007B7F42 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DC1179A4252007B7F42 /* QuartzCore.framework */; };\n\t\t327C0DC4179A425B007B7F42 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DC3179A425A007B7F42 /* AVFoundation.framework */; };\n\t\t327C0DC7179A426D007B7F42 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0B8E179A3944007B7F42 /* Foundation.framework */; };\n\t\t327C0DC9179A427E007B7F42 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DC8179A427E007B7F42 /* Security.framework */; };\n\t\t327C0DCB179A428A007B7F42 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DCA179A428A007B7F42 /* AudioToolbox.framework */; };\n\t\t32840062179A4FB300B0CA20 /* autofit.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEB8179A4FB200B0CA20 /* autofit.c */; };\n\t\t32840069179A4FB300B0CA20 /* ftbase.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEC1179A4FB200B0CA20 /* ftbase.c */; };\n\t\t3284006A179A4FB300B0CA20 /* ftbbox.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEC3179A4FB200B0CA20 /* ftbbox.c */; };\n\t\t3284006C179A4FB300B0CA20 /* ftbitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEC5179A4FB200B0CA20 /* ftbitmap.c */; };\n\t\t32840071179A4FB300B0CA20 /* ftfstype.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECA179A4FB200B0CA20 /* ftfstype.c */; };\n\t\t32840072179A4FB300B0CA20 /* ftgasp.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECB179A4FB200B0CA20 /* ftgasp.c */; };\n\t\t32840074179A4FB300B0CA20 /* ftglyph.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECD179A4FB200B0CA20 /* ftglyph.c */; };\n\t\t32840075179A4FB300B0CA20 /* ftgxval.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECE179A4FB200B0CA20 /* ftgxval.c */; };\n\t\t32840076179A4FB300B0CA20 /* ftinit.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECF179A4FB200B0CA20 /* ftinit.c */; };\n\t\t32840077179A4FB300B0CA20 /* ftlcdfil.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED0179A4FB200B0CA20 /* ftlcdfil.c */; };\n\t\t32840079179A4FB300B0CA20 /* ftmm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED2179A4FB200B0CA20 /* ftmm.c */; };\n\t\t3284007B179A4FB300B0CA20 /* ftotval.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED4179A4FB200B0CA20 /* ftotval.c */; };\n\t\t3284007D179A4FB300B0CA20 /* ftpatent.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED6179A4FB200B0CA20 /* ftpatent.c */; };\n\t\t3284007E179A4FB300B0CA20 /* ftpfr.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED7179A4FB200B0CA20 /* ftpfr.c */; };\n\t\t32840083179A4FB300B0CA20 /* ftstroke.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEDC179A4FB200B0CA20 /* ftstroke.c */; };\n\t\t32840084179A4FB300B0CA20 /* ftsynth.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEDD179A4FB200B0CA20 /* ftsynth.c */; };\n\t\t32840085179A4FB300B0CA20 /* ftsystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEDE179A4FB200B0CA20 /* ftsystem.c */; };\n\t\t32840087179A4FB300B0CA20 /* fttype1.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE0179A4FB200B0CA20 /* fttype1.c */; };\n\t\t32840089179A4FB300B0CA20 /* ftwinfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE2179A4FB200B0CA20 /* ftwinfnt.c */; };\n\t\t3284008A179A4FB300B0CA20 /* ftxf86.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE3179A4FB200B0CA20 /* ftxf86.c */; };\n\t\t3284008D179A4FB300B0CA20 /* bdf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE7179A4FB200B0CA20 /* bdf.c */; };\n\t\t32840097179A4FB300B0CA20 /* ftcache.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEF6179A4FB200B0CA20 /* ftcache.c */; };\n\t\t328400A2179A4FB300B0CA20 /* cff.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF0A179A4FB200B0CA20 /* cff.c */; };\n\t\t328400B5179A4FB300B0CA20 /* type1cid.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF2F179A4FB300B0CA20 /* type1cid.c */; };\n\t\t328400B6179A4FB300B0CA20 /* ftdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF30179A4FB300B0CA20 /* ftdebug.c */; };\n\t\t328400F0179A4FB300B0CA20 /* pcf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF84179A4FB300B0CA20 /* pcf.c */; };\n\t\t328400F8179A4FB300B0CA20 /* pfr.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF92179A4FB300B0CA20 /* pfr.c */; };\n\t\t32840103179A4FB300B0CA20 /* psaux.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFA7179A4FB300B0CA20 /* psaux.c */; };\n\t\t3284010E179A4FB300B0CA20 /* pshinter.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFBB179A4FB300B0CA20 /* pshinter.c */; };\n\t\t32840115179A4FB300B0CA20 /* psmodule.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFC7179A4FB300B0CA20 /* psmodule.c */; };\n\t\t3284011D179A4FB300B0CA20 /* raster.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFD7179A4FB300B0CA20 /* raster.c */; };\n\t\t32840124179A4FB300B0CA20 /* sfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFE3179A4FB300B0CA20 /* sfnt.c */; };\n\t\t32840135179A4FB300B0CA20 /* smooth.c in Sources */ = {isa = PBXBuildFile; fileRef = 32840003179A4FB300B0CA20 /* smooth.c */; };\n\t\t3284014B179A4FB300B0CA20 /* truetype.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284001D179A4FB300B0CA20 /* truetype.c */; };\n\t\t3284015D179A4FB300B0CA20 /* type1.c in Sources */ = {isa = PBXBuildFile; fileRef = 32840041179A4FB300B0CA20 /* type1.c */; };\n\t\t32840164179A4FB300B0CA20 /* type42.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284004E179A4FB300B0CA20 /* type42.c */; };\n\t\t32840168179A4FB300B0CA20 /* winfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 32840054179A4FB300B0CA20 /* winfnt.c */; };\n\t\t328401D8179A576300B0CA20 /* CiOSPlatform.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C5179A576300B0CA20 /* CiOSPlatform.mm */; };\n\t\t328401D9179A576300B0CA20 /* CiOSAudioManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C6179A576300B0CA20 /* CiOSAudioManager.mm */; };\n\t\t328401DB179A576300B0CA20 /* assert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C8179A576300B0CA20 /* assert.mm */; };\n\t\t328401DC179A576300B0CA20 /* CiOSAudio.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C9179A576300B0CA20 /* CiOSAudio.mm */; };\n\t\t328401DD179A576300B0CA20 /* CiOSWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401CA179A576300B0CA20 /* CiOSWidget.mm */; };\n\t\t328401DE179A576300B0CA20 /* EAGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401CB179A576300B0CA20 /* EAGLView.mm */; };\n\t\t328401E1179A576300B0CA20 /* CiOSReadFileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401CE179A576300B0CA20 /* CiOSReadFileStream.cpp */; };\n\t\t328401E2179A576300B0CA20 /* CiOSPathConv.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401CF179A576300B0CA20 /* CiOSPathConv.mm */; };\n\t\t328401E3179A576300B0CA20 /* CiOSTmpFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D0179A576300B0CA20 /* CiOSTmpFile.cpp */; };\n\t\t328401E4179A576300B0CA20 /* CSockReadStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D1179A576300B0CA20 /* CSockReadStream.cpp */; };\n\t\t328401E6179A576300B0CA20 /* CiOSMovieView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401D4179A576300B0CA20 /* CiOSMovieView.mm */; };\n\t\t328401E7179A576300B0CA20 /* CiOSSysResource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401D5179A576300B0CA20 /* CiOSSysResource.mm */; };\n\t\t328401E8179A576300B0CA20 /* CiOSWriteFileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D6179A576300B0CA20 /* CiOSWriteFileStream.cpp */; };\n\t\t328401E9179A576300B0CA20 /* CSockWriteStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D7179A576300B0CA20 /* CSockWriteStream.cpp */; };\n\t\t3284FE3E179A4B2B00B0CA20 /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE07179A4B2B00B0CA20 /* lapi.c */; };\n\t\t3284FE3F179A4B2B00B0CA20 /* lauxlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE09179A4B2B00B0CA20 /* lauxlib.c */; };\n\t\t3284FE40179A4B2B00B0CA20 /* lbaselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0A179A4B2B00B0CA20 /* lbaselib.c */; };\n\t\t3284FE41179A4B2B00B0CA20 /* lbitlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0B179A4B2B00B0CA20 /* lbitlib.c */; };\n\t\t3284FE42179A4B2B00B0CA20 /* lcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0C179A4B2B00B0CA20 /* lcode.c */; };\n\t\t3284FE43179A4B2B00B0CA20 /* lcorolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0E179A4B2B00B0CA20 /* lcorolib.c */; };\n\t\t3284FE44179A4B2B00B0CA20 /* lctype.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0F179A4B2B00B0CA20 /* lctype.c */; };\n\t\t3284FE45179A4B2B00B0CA20 /* ldblib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE11179A4B2B00B0CA20 /* ldblib.c */; };\n\t\t3284FE46179A4B2B00B0CA20 /* ldebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE12179A4B2B00B0CA20 /* ldebug.c */; };\n\t\t3284FE47179A4B2B00B0CA20 /* ldo.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE14179A4B2B00B0CA20 /* ldo.c */; };\n\t\t3284FE48179A4B2B00B0CA20 /* ldump.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE16179A4B2B00B0CA20 /* ldump.c */; };\n\t\t3284FE49179A4B2B00B0CA20 /* lfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE17179A4B2B00B0CA20 /* lfunc.c */; };\n\t\t3284FE4A179A4B2B00B0CA20 /* lgc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE19179A4B2B00B0CA20 /* lgc.c */; };\n\t\t3284FE4B179A4B2B00B0CA20 /* linit.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE1B179A4B2B00B0CA20 /* linit.c */; };\n\t\t3284FE4C179A4B2B00B0CA20 /* liolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE1C179A4B2B00B0CA20 /* liolib.c */; };\n\t\t3284FE4D179A4B2B00B0CA20 /* llex.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE1D179A4B2B00B0CA20 /* llex.c */; };\n\t\t3284FE4E179A4B2B00B0CA20 /* lmathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE20179A4B2B00B0CA20 /* lmathlib.c */; };\n\t\t3284FE4F179A4B2B00B0CA20 /* lmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE21179A4B2B00B0CA20 /* lmem.c */; };\n\t\t3284FE50179A4B2B00B0CA20 /* loadlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE23179A4B2B00B0CA20 /* loadlib.c */; };\n\t\t3284FE51179A4B2B00B0CA20 /* lobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE24179A4B2B00B0CA20 /* lobject.c */; };\n\t\t3284FE52179A4B2B00B0CA20 /* lopcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE26179A4B2B00B0CA20 /* lopcodes.c */; };\n\t\t3284FE53179A4B2B00B0CA20 /* loslib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE28179A4B2B00B0CA20 /* loslib.c */; };\n\t\t3284FE54179A4B2B00B0CA20 /* lparser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE29179A4B2B00B0CA20 /* lparser.c */; };\n\t\t3284FE55179A4B2B00B0CA20 /* lstate.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE2B179A4B2B00B0CA20 /* lstate.c */; };\n\t\t3284FE56179A4B2B00B0CA20 /* lstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE2D179A4B2B00B0CA20 /* lstring.c */; };\n\t\t3284FE57179A4B2B00B0CA20 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE2F179A4B2B00B0CA20 /* lstrlib.c */; };\n\t\t3284FE58179A4B2B00B0CA20 /* ltable.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE30179A4B2B00B0CA20 /* ltable.c */; };\n\t\t3284FE59179A4B2B00B0CA20 /* ltablib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE32179A4B2B00B0CA20 /* ltablib.c */; };\n\t\t3284FE5A179A4B2B00B0CA20 /* ltm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE33179A4B2B00B0CA20 /* ltm.c */; };\n\t\t3284FE5B179A4B2B00B0CA20 /* lundump.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE38179A4B2B00B0CA20 /* lundump.c */; };\n\t\t3284FE5C179A4B2B00B0CA20 /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE3A179A4B2B00B0CA20 /* lvm.c */; };\n\t\t3284FE5D179A4B2B00B0CA20 /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE3C179A4B2B00B0CA20 /* lzio.c */; };\n\t\t3284FE61179A4EF900B0CA20 /* hash_sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE5F179A4EF900B0CA20 /* hash_sha1.c */; };\n\t\t3284FE66179A4F0900B0CA20 /* sqlite3.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE63179A4F0900B0CA20 /* sqlite3.c */; };\n\t\t3284FE6A179A4F1B00B0CA20 /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE68179A4F1B00B0CA20 /* utf8.c */; };\n\t\t3284FE73179A4F4900B0CA20 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE6D179A4F4900B0CA20 /* ioapi.c */; };\n\t\t3284FE74179A4F4900B0CA20 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE6F179A4F4900B0CA20 /* mztools.c */; };\n\t\t3284FE75179A4F4900B0CA20 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE71179A4F4900B0CA20 /* unzip.c */; };\n\t\t3284FE8A179A4F6600B0CA20 /* yajl_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE77179A4F6600B0CA20 /* yajl_buf.c */; };\n\t\t3284FE8B179A4F6600B0CA20 /* yajl_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE79179A4F6600B0CA20 /* yajl_encode.c */; };\n\t\t3284FE8C179A4F6600B0CA20 /* yajl_lex.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7A179A4F6600B0CA20 /* yajl_lex.c */; };\n\t\t3284FE8D179A4F6600B0CA20 /* yajl_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7B179A4F6600B0CA20 /* yajl_parser.c */; };\n\t\t3284FE8E179A4F6600B0CA20 /* yajl_tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7C179A4F6600B0CA20 /* yajl_tree.c */; };\n\t\t3284FE8F179A4F6600B0CA20 /* yajl.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7D179A4F6600B0CA20 /* yajl.c */; };\n\t\t3284FE90179A4F6600B0CA20 /* json_binary_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7E179A4F6600B0CA20 /* json_binary_parser.c */; };\n\t\t3284FE91179A4F6600B0CA20 /* important.txt in Resources */ = {isa = PBXBuildFile; fileRef = 3284FE7F179A4F6600B0CA20 /* important.txt */; };\n\t\t3284FE92179A4F6600B0CA20 /* msg_pack_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE80179A4F6600B0CA20 /* msg_pack_parser.c */; };\n\t\t3284FE93179A4F6600B0CA20 /* yajl_alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE81179A4F6600B0CA20 /* yajl_alloc.c */; };\n\t\t3284FE94179A4F6600B0CA20 /* yajl_gen.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE86179A4F6600B0CA20 /* yajl_gen.c */; };\n\t\t3284FE95179A4F6600B0CA20 /* yajl_version.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE89179A4F6600B0CA20 /* yajl_version.c */; };\n\t\t32D86B06182F73E700210C28 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0B89179A3944007B7F42 /* Cocoa.framework */; };\n\t\t32D86B1C182F73E800210C28 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0B89179A3944007B7F42 /* Cocoa.framework */; };\n\t\t32D86B1F182F73E800210C28 /* PlaygroundOSS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86B05182F73E700210C28 /* PlaygroundOSS.framework */; };\n\t\t32D86B25182F73E800210C28 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 32D86B23182F73E800210C28 /* InfoPlist.strings */; };\n\t\t32D86B27182F73E800210C28 /* PlaygroundOSSTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D86B26182F73E800210C28 /* PlaygroundOSSTests.m */; };\n\t\t32D86B51182F74A500210C28 /* yajl_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE77179A4F6600B0CA20 /* yajl_buf.c */; };\n\t\t32D86B52182F74A500210C28 /* yajl_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE79179A4F6600B0CA20 /* yajl_encode.c */; };\n\t\t32D86B53182F74A500210C28 /* yajl_lex.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7A179A4F6600B0CA20 /* yajl_lex.c */; };\n\t\t32D86B54182F74A500210C28 /* yajl_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7B179A4F6600B0CA20 /* yajl_parser.c */; };\n\t\t32D86B55182F74A500210C28 /* yajl_tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7C179A4F6600B0CA20 /* yajl_tree.c */; };\n\t\t32D86B56182F74A500210C28 /* yajl.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7D179A4F6600B0CA20 /* yajl.c */; };\n\t\t32D86B57182F74A500210C28 /* json_binary_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE7E179A4F6600B0CA20 /* json_binary_parser.c */; };\n\t\t32D86B58182F74A500210C28 /* msg_pack_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE80179A4F6600B0CA20 /* msg_pack_parser.c */; };\n\t\t32D86B59182F74A500210C28 /* yajl_alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE81179A4F6600B0CA20 /* yajl_alloc.c */; };\n\t\t32D86B5A182F74A500210C28 /* yajl_gen.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE86179A4F6600B0CA20 /* yajl_gen.c */; };\n\t\t32D86B5B182F74A500210C28 /* yajl_version.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE89179A4F6600B0CA20 /* yajl_version.c */; };\n\t\t32D86B5C182F74A500210C28 /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE07179A4B2B00B0CA20 /* lapi.c */; };\n\t\t32D86B5D182F74A500210C28 /* lauxlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE09179A4B2B00B0CA20 /* lauxlib.c */; };\n\t\t32D86B5E182F74A500210C28 /* lbaselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0A179A4B2B00B0CA20 /* lbaselib.c */; };\n\t\t32D86B5F182F74A500210C28 /* lbitlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0B179A4B2B00B0CA20 /* lbitlib.c */; };\n\t\t32D86B60182F74A500210C28 /* lcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0C179A4B2B00B0CA20 /* lcode.c */; };\n\t\t32D86B61182F74A500210C28 /* lcorolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0E179A4B2B00B0CA20 /* lcorolib.c */; };\n\t\t32D86B62182F74A500210C28 /* lctype.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE0F179A4B2B00B0CA20 /* lctype.c */; };\n\t\t32D86B63182F74A500210C28 /* ldblib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE11179A4B2B00B0CA20 /* ldblib.c */; };\n\t\t32D86B64182F74A500210C28 /* ldebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE12179A4B2B00B0CA20 /* ldebug.c */; };\n\t\t32D86B65182F74A500210C28 /* ldo.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE14179A4B2B00B0CA20 /* ldo.c */; };\n\t\t32D86B66182F74A500210C28 /* ldump.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE16179A4B2B00B0CA20 /* ldump.c */; };\n\t\t32D86B67182F74A500210C28 /* lfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE17179A4B2B00B0CA20 /* lfunc.c */; };\n\t\t32D86B68182F74A500210C28 /* lgc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE19179A4B2B00B0CA20 /* lgc.c */; };\n\t\t32D86B69182F74A500210C28 /* linit.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE1B179A4B2B00B0CA20 /* linit.c */; };\n\t\t32D86B6A182F74A500210C28 /* liolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE1C179A4B2B00B0CA20 /* liolib.c */; };\n\t\t32D86B6B182F74A500210C28 /* llex.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE1D179A4B2B00B0CA20 /* llex.c */; };\n\t\t32D86B6C182F74A500210C28 /* lmathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE20179A4B2B00B0CA20 /* lmathlib.c */; };\n\t\t32D86B6D182F74A500210C28 /* lmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE21179A4B2B00B0CA20 /* lmem.c */; };\n\t\t32D86B6E182F74A500210C28 /* loadlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE23179A4B2B00B0CA20 /* loadlib.c */; };\n\t\t32D86B6F182F74A500210C28 /* lobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE24179A4B2B00B0CA20 /* lobject.c */; };\n\t\t32D86B70182F74A500210C28 /* lopcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE26179A4B2B00B0CA20 /* lopcodes.c */; };\n\t\t32D86B71182F74A500210C28 /* loslib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE28179A4B2B00B0CA20 /* loslib.c */; };\n\t\t32D86B72182F74A500210C28 /* lparser.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE29179A4B2B00B0CA20 /* lparser.c */; };\n\t\t32D86B73182F74A500210C28 /* lstate.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE2B179A4B2B00B0CA20 /* lstate.c */; };\n\t\t32D86B74182F74A500210C28 /* lstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE2D179A4B2B00B0CA20 /* lstring.c */; };\n\t\t32D86B75182F74A500210C28 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE2F179A4B2B00B0CA20 /* lstrlib.c */; };\n\t\t32D86B76182F74A500210C28 /* ltable.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE30179A4B2B00B0CA20 /* ltable.c */; };\n\t\t32D86B77182F74A500210C28 /* ltablib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE32179A4B2B00B0CA20 /* ltablib.c */; };\n\t\t32D86B78182F74A500210C28 /* ltm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE33179A4B2B00B0CA20 /* ltm.c */; };\n\t\t32D86B79182F74A500210C28 /* lundump.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE38179A4B2B00B0CA20 /* lundump.c */; };\n\t\t32D86B7A182F74A500210C28 /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE3A179A4B2B00B0CA20 /* lvm.c */; };\n\t\t32D86B7B182F74A500210C28 /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE3C179A4B2B00B0CA20 /* lzio.c */; };\n\t\t32D86B7C182F74A500210C28 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE6D179A4F4900B0CA20 /* ioapi.c */; };\n\t\t32D86B7D182F74A500210C28 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE6F179A4F4900B0CA20 /* mztools.c */; };\n\t\t32D86B7E182F74A500210C28 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE71179A4F4900B0CA20 /* unzip.c */; };\n\t\t32D86B7F182F74A500210C28 /* hash_sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE5F179A4EF900B0CA20 /* hash_sha1.c */; };\n\t\t32D86B80182F74A500210C28 /* sqlite3.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE63179A4F0900B0CA20 /* sqlite3.c */; };\n\t\t32D86B81182F74A500210C28 /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FE68179A4F1B00B0CA20 /* utf8.c */; };\n\t\t32D86B82182F74A500210C28 /* CiOSReadFileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401CE179A576300B0CA20 /* CiOSReadFileStream.cpp */; };\n\t\t32D86B83182F74A500210C28 /* CiOSTmpFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D0179A576300B0CA20 /* CiOSTmpFile.cpp */; };\n\t\t32D86B84182F74A500210C28 /* CiOSWriteFileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D6179A576300B0CA20 /* CiOSWriteFileStream.cpp */; };\n\t\t32D86B85182F74A500210C28 /* CSockReadStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D1179A576300B0CA20 /* CSockReadStream.cpp */; };\n\t\t32D86B86182F74A500210C28 /* CSockWriteStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328401D7179A576300B0CA20 /* CSockWriteStream.cpp */; };\n\t\t32D86B87182F74A500210C28 /* FileDelete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3212706C18253C800027C57E /* FileDelete.cpp */; };\n\t\t32D86B88182F74A500210C28 /* FontRendering.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3212706D18253C800027C57E /* FontRendering.cpp */; };\n\t\t32D86B89182F74A500210C28 /* CKLBNodeVirtualDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BDD179A3E4A007B7F42 /* CKLBNodeVirtualDocument.cpp */; };\n\t\t32D86B8A182F74A500210C28 /* CKLBSplineNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BDF179A3E4A007B7F42 /* CKLBSplineNode.cpp */; };\n\t\t32D86B8B182F74A500210C28 /* CKLBSWFPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BE0179A3E4A007B7F42 /* CKLBSWFPlayer.cpp */; };\n\t\t32D86B8C182F74A500210C28 /* CKLBScoreNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BE4179A3E4A007B7F42 /* CKLBScoreNode.cpp */; };\n\t\t32D86B8D182F74A500210C28 /* CKLBSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BE7179A3E4A007B7F42 /* CKLBSystem.cpp */; };\n\t\t32D86B8E182F74A500210C28 /* CKLBTexturePacker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF0179A3E63007B7F42 /* CKLBTexturePacker.cpp */; };\n\t\t32D86B8F182F74A500210C28 /* CompositeManagement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF2179A3E63007B7F42 /* CompositeManagement.cpp */; };\n\t\t32D86B90182F74A500210C28 /* TextureManagement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF3179A3E63007B7F42 /* TextureManagement.cpp */; };\n\t\t32D86B91182F74A500210C28 /* CKLBAssetManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF4179A3E63007B7F42 /* CKLBAssetManager.cpp */; };\n\t\t32D86B92182F74A500210C28 /* AudioAsset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BF5179A3E63007B7F42 /* AudioAsset.cpp */; };\n\t\t32D86B93182F74A500210C28 /* CKLBPropertyBag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0BFD179A3E63007B7F42 /* CKLBPropertyBag.cpp */; };\n\t\t32D86B94182F74A500210C28 /* NodeAnimationAsset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C01179A3E63007B7F42 /* NodeAnimationAsset.cpp */; };\n\t\t32D86B95182F74A500210C28 /* CKLBScriptEnv_forLUA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D02179A408E007B7F42 /* CKLBScriptEnv_forLUA.cpp */; };\n\t\t32D86B96182F74A500210C28 /* CKLBTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C0E179A3E7A007B7F42 /* CKLBTask.cpp */; };\n\t\t32D86B97182F74A500210C28 /* CKLBAsyncFilecopy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C11179A3E7A007B7F42 /* CKLBAsyncFilecopy.cpp */; };\n\t\t32D86B98182F74A500210C28 /* CKLBGameApplication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C12179A3E7A007B7F42 /* CKLBGameApplication.cpp */; };\n\t\t32D86B99182F74A500210C28 /* CKLBLuaEnv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C14179A3E7A007B7F42 /* CKLBLuaEnv.cpp */; };\n\t\t32D86B9A182F74A500210C28 /* CKLBUITask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C15179A3E7A007B7F42 /* CKLBUITask.cpp */; };\n\t\t32D86B9B182F74A500210C28 /* encryptFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C16179A3E7A007B7F42 /* encryptFile.cpp */; };\n\t\t32D86B9C182F74A500210C28 /* CKLBDebugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1A179A3E7A007B7F42 /* CKLBDebugger.cpp */; };\n\t\t32D86B9D182F74A500210C28 /* CKLBGameApplicationDebugModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1B179A3E7A007B7F42 /* CKLBGameApplicationDebugModule.cpp */; };\n\t\t32D86B9E182F74A500210C28 /* CKLBIntervalTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1C179A3E7A007B7F42 /* CKLBIntervalTimer.cpp */; };\n\t\t32D86B9F182F74A500210C28 /* CKLBLuaPropTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1D179A3E7A007B7F42 /* CKLBLuaPropTask.cpp */; };\n\t\t32D86BA0182F74A500210C28 /* CKLBUtility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1E179A3E7A007B7F42 /* CKLBUtility.cpp */; };\n\t\t32D86BA1182F74A500210C28 /* CKLBDataHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C1F179A3E7A007B7F42 /* CKLBDataHandler.cpp */; };\n\t\t32D86BA2182F74A500210C28 /* Dictionnary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C20179A3E7A007B7F42 /* Dictionnary.cpp */; };\n\t\t32D86BA3182F74A500210C28 /* CKLBBinArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C21179A3E7A007B7F42 /* CKLBBinArray.cpp */; };\n\t\t32D86BA4182F74A500210C28 /* CKLBContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C22179A3E7A007B7F42 /* CKLBContext.cpp */; };\n\t\t32D86BA5182F74A500210C28 /* DebugAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C25179A3E7A007B7F42 /* DebugAlloc.cpp */; };\n\t\t32D86BA6182F74A500210C28 /* DebugTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C26179A3E7A007B7F42 /* DebugTracker.cpp */; };\n\t\t32D86BA7182F74A500210C28 /* CKLBAppProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C29179A3E7A007B7F42 /* CKLBAppProperty.cpp */; };\n\t\t32D86BA8182F74A500210C28 /* CKLBAsyncLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C2B179A3E7A007B7F42 /* CKLBAsyncLoader.cpp */; };\n\t\t32D86BA9182F74A500210C28 /* CKLBGenericTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C33179A3E7A007B7F42 /* CKLBGenericTask.cpp */; };\n\t\t32D86BAA182F74A500210C28 /* CKLBLibRegistrator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C36179A3E7A007B7F42 /* CKLBLibRegistrator.cpp */; };\n\t\t32D86BAB182F74A500210C28 /* CKLBLifeCtrlTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C38179A3E7A007B7F42 /* CKLBLifeCtrlTask.cpp */; };\n\t\t32D86BAC182F74A500210C28 /* CKLBLuaTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C3C179A3E7A007B7F42 /* CKLBLuaTask.cpp */; };\n\t\t32D86BAD182F74A500210C28 /* CKLBObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C3D179A3E7A007B7F42 /* CKLBObject.cpp */; };\n\t\t32D86BAE182F74A500210C28 /* CKLBPauseCtrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C3F179A3E7A007B7F42 /* CKLBPauseCtrl.cpp */; };\n\t\t32D86BAF182F74A500210C28 /* CKLBTextTempBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C42179A3E7A007B7F42 /* CKLBTextTempBuffer.cpp */; };\n\t\t32D86BB0182F74A500210C28 /* CLuaState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C45179A3E7A007B7F42 /* CLuaState.cpp */; };\n\t\t32D86BB1182F74A500210C28 /* CPFInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C46179A3E7A007B7F42 /* CPFInterface.cpp */; };\n\t\t32D86BB2182F74A500210C28 /* ITmpFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C49179A3E7A007B7F42 /* ITmpFile.cpp */; };\n\t\t32D86BB3182F74A500210C28 /* CKLBStoreService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C7A179A3EAF007B7F42 /* CKLBStoreService.cpp */; };\n\t\t32D86BB4182F74A500210C28 /* CKLBNetAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C7C179A3EAF007B7F42 /* CKLBNetAPI.cpp */; };\n\t\t32D86BB5182F74A500210C28 /* CKLBHTTPInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C7F179A3EAF007B7F42 /* CKLBHTTPInterface.cpp */; };\n\t\t32D86BB6182F74A500210C28 /* CKLBUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C81179A3EAF007B7F42 /* CKLBUpdate.cpp */; };\n\t\t32D86BB7182F74A500210C28 /* CUnZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C82179A3EAF007B7F42 /* CUnZip.cpp */; };\n\t\t32D86BB8182F74A500210C28 /* CKLBJsonItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C83179A3EAF007B7F42 /* CKLBJsonItem.cpp */; };\n\t\t32D86BB9182F74A500210C28 /* MultithreadedNetwork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C84179A3EAF007B7F42 /* MultithreadedNetwork.cpp */; };\n\t\t32D86BBA182F74A500210C28 /* CKLBNetAPIKeyChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C88179A3EAF007B7F42 /* CKLBNetAPIKeyChain.cpp */; };\n\t\t32D86BBB182F74A500210C28 /* CKLBLuaLibAPP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C92179A3ECB007B7F42 /* CKLBLuaLibAPP.cpp */; };\n\t\t32D86BBC182F74A500210C28 /* CKLBLuaLibENG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C93179A3ECB007B7F42 /* CKLBLuaLibENG.cpp */; };\n\t\t32D86BBD182F74A500210C28 /* CKLBLuaLibFONT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C95179A3ECB007B7F42 /* CKLBLuaLibFONT.cpp */; };\n\t\t32D86BBE182F74A500210C28 /* CKLBLuaLibHASH.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C97179A3ECB007B7F42 /* CKLBLuaLibHASH.cpp */; };\n\t\t32D86BBF182F74A500210C28 /* CKLBLuaLibSOUND.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C99179A3ECB007B7F42 /* CKLBLuaLibSOUND.cpp */; };\n\t\t32D86BC0182F74A500210C28 /* CKLBLuaLibGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9B179A3ECB007B7F42 /* CKLBLuaLibGL.cpp */; };\n\t\t32D86BC1182F74A500210C28 /* CKLBLuaLibDATA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9C179A3ECB007B7F42 /* CKLBLuaLibDATA.cpp */; };\n\t\t32D86BC2182F74A500210C28 /* CKLBLuaLibMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9D179A3ECB007B7F42 /* CKLBLuaLibMatrix.cpp */; };\n\t\t32D86BC3182F74A500210C28 /* ILuaFuncLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C9F179A3ECB007B7F42 /* ILuaFuncLib.cpp */; };\n\t\t32D86BC4182F74A500210C28 /* CKLBLuaLibCONV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA0179A3ECB007B7F42 /* CKLBLuaLibCONV.cpp */; };\n\t\t32D86BC5182F74A500210C28 /* CKLBLuaLibKEY.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA2179A3ECB007B7F42 /* CKLBLuaLibKEY.cpp */; };\n\t\t32D86BC6182F74A500210C28 /* CKLBLuaLibTASK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA3179A3ECB007B7F42 /* CKLBLuaLibTASK.cpp */; };\n\t\t32D86BC7182F74A500210C28 /* CKLBLuaLibASSET.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA4179A3ECB007B7F42 /* CKLBLuaLibASSET.cpp */; };\n\t\t32D86BC8182F74A500210C28 /* CKLBLuaConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CA6179A3ECB007B7F42 /* CKLBLuaConst.cpp */; };\n\t\t32D86BC9182F74A500210C28 /* CKLBLuaLibBIN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CAA179A3ECB007B7F42 /* CKLBLuaLibBIN.cpp */; };\n\t\t32D86BCA182F74A500210C28 /* CKLBLuaLibDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CAE179A3ECB007B7F42 /* CKLBLuaLibDB.cpp */; };\n\t\t32D86BCB182F74A500210C28 /* CKLBLuaLibDEBUG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB0179A3ECB007B7F42 /* CKLBLuaLibDEBUG.cpp */; };\n\t\t32D86BCC182F74A500210C28 /* CKLBLuaLibLANG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB3179A3ECB007B7F42 /* CKLBLuaLibLANG.cpp */; };\n\t\t32D86BCD182F74A500210C28 /* CKLBLuaLibRES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB6179A3ECB007B7F42 /* CKLBLuaLibRES.cpp */; };\n\t\t32D86BCE182F74A500210C28 /* CKLBLuaLibUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CB9179A3ECB007B7F42 /* CKLBLuaLibUI.cpp */; };\n\t\t32D86BCF182F74A500210C28 /* CKLBRenderingManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD1179A3F34007B7F42 /* CKLBRenderingManager.cpp */; };\n\t\t32D86BD0182F74A500210C28 /* CRenderingManager_GL1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD2179A3F34007B7F42 /* CRenderingManager_GL1.cpp */; };\n\t\t32D86BD1182F74A500210C28 /* CRenderingManager_GL2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD3179A3F34007B7F42 /* CRenderingManager_GL2.cpp */; };\n\t\t32D86BD2182F74A500210C28 /* CRenderingManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD4179A3F34007B7F42 /* CRenderingManager.cpp */; };\n\t\t32D86BD3182F74A500210C28 /* CTextureUsage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD5179A3F34007B7F42 /* CTextureUsage.cpp */; };\n\t\t32D86BD4182F74A500210C28 /* CBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD6179A3F34007B7F42 /* CBuffer.cpp */; };\n\t\t32D86BD5182F74A500210C28 /* CIndexBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD7179A3F34007B7F42 /* CIndexBuffer.cpp */; };\n\t\t32D86BD6182F74A500210C28 /* CTextureBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CD9179A3F34007B7F42 /* CTextureBase.cpp */; };\n\t\t32D86BD7182F74A500210C28 /* glWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDB179A3F34007B7F42 /* glWrapper.cpp */; };\n\t\t32D86BD8182F74A500210C28 /* CFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDC179A3F34007B7F42 /* CFrame.cpp */; };\n\t\t32D86BD9182F74A500210C28 /* CImageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDD179A3F34007B7F42 /* CImageBuffer.cpp */; };\n\t\t32D86BDA182F74A500210C28 /* CKLBCanvasSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CDE179A3F34007B7F42 /* CKLBCanvasSprite.cpp */; };\n\t\t32D86BDB182F74A500210C28 /* CKLBSprite3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE0179A3F34007B7F42 /* CKLBSprite3D.cpp */; };\n\t\t32D86BDC182F74A500210C28 /* CShaderSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE2179A3F34007B7F42 /* CShaderSet.cpp */; };\n\t\t32D86BDD182F74A500210C28 /* CShaderSetInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE3179A3F34007B7F42 /* CShaderSetInstance.cpp */; };\n\t\t32D86BDE182F74A500210C28 /* CTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CE4179A3F34007B7F42 /* CTexture.cpp */; };\n\t\t32D86BDF182F74A500210C28 /* CKLBNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CF9179A3F4D007B7F42 /* CKLBNode.cpp */; };\n\t\t32D86BE0182F74A500210C28 /* CSoundAnalysisMP3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CFC179A3F76007B7F42 /* CSoundAnalysisMP3.cpp */; };\n\t\t32D86BE1182F74A500210C28 /* CSoundAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0CFD179A3F76007B7F42 /* CSoundAnalysis.cpp */; };\n\t\t32D86BE2182F74A500210C28 /* CKLBDeviceKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32127068182532090027C57E /* CKLBDeviceKeyEvent.cpp */; };\n\t\t32D86BE3182F74A500210C28 /* CKLBDrawTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D04179A41AE007B7F42 /* CKLBDrawTask.cpp */; };\n\t\t32D86BE4182F74A500210C28 /* CKLBDebugMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D05179A41AE007B7F42 /* CKLBDebugMenu.cpp */; };\n\t\t32D86BE5182F74A500210C28 /* CKLBTouchPad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D07179A41AE007B7F42 /* CKLBTouchPad.cpp */; };\n\t\t32D86BE6182F74A500210C28 /* CKLBTouchEventUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D09179A41AE007B7F42 /* CKLBTouchEventUI.cpp */; };\n\t\t32D86BE7182F74A500210C28 /* CKLBOSCtrlEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D0B179A41AE007B7F42 /* CKLBOSCtrlEvent.cpp */; };\n\t\t32D86BE8182F74A500210C28 /* CKLBLuaScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D0D179A41AE007B7F42 /* CKLBLuaScript.cpp */; };\n\t\t32D86BE9182F74A500210C28 /* CKLBUIVirtualDoc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D16179A41BE007B7F42 /* CKLBUIVirtualDoc.cpp */; };\n\t\t32D86BEA182F74A500210C28 /* CKLBUIList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D17179A41BE007B7F42 /* CKLBUIList.cpp */; };\n\t\t32D86BEB182F74A500210C28 /* CKLBScrMgrDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D18179A41BE007B7F42 /* CKLBScrMgrDefault.cpp */; };\n\t\t32D86BEC182F74A500210C28 /* CKLBScrMgrPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1A179A41BE007B7F42 /* CKLBScrMgrPage.cpp */; };\n\t\t32D86BED182F74A500210C28 /* CKLBUICanvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1C179A41BE007B7F42 /* CKLBUICanvas.cpp */; };\n\t\t32D86BEE182F74A500210C28 /* CKLBUIDragIcon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1D179A41BE007B7F42 /* CKLBUIDragIcon.cpp */; };\n\t\t32D86BEF182F74A500210C28 /* CKLBUIFreeVertItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D1E179A41BE007B7F42 /* CKLBUIFreeVertItem.cpp */; };\n\t\t32D86BF0182F74A500210C28 /* CKLBUIProgressBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D21179A41BE007B7F42 /* CKLBUIProgressBar.cpp */; };\n\t\t32D86BF1182F74A600210C28 /* CKLBUIVariableItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D22179A41BE007B7F42 /* CKLBUIVariableItem.cpp */; };\n\t\t32D86BF2182F74A600210C28 /* CKLBScrMgrSolid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D23179A41BE007B7F42 /* CKLBScrMgrSolid.cpp */; };\n\t\t32D86BF3182F74A600210C28 /* CKLBScrollBarIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D25179A41BE007B7F42 /* CKLBScrollBarIF.cpp */; };\n\t\t32D86BF4182F74A600210C28 /* CKLBLabelNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D27179A41BE007B7F42 /* CKLBLabelNode.cpp */; };\n\t\t32D86BF5182F74A600210C28 /* CKLBMovieNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D28179A41BE007B7F42 /* CKLBMovieNode.cpp */; };\n\t\t32D86BF6182F74A600210C28 /* CKLBTextInputNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D29179A41BE007B7F42 /* CKLBTextInputNode.cpp */; };\n\t\t32D86BF7182F74A600210C28 /* CKLBUIDebugItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2A179A41BE007B7F42 /* CKLBUIDebugItem.cpp */; };\n\t\t32D86BF8182F74A600210C28 /* CKLBUIWebArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2C179A41BE007B7F42 /* CKLBUIWebArea.cpp */; };\n\t\t32D86BF9182F74A600210C28 /* CKLBWebViewNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2D179A41BE007B7F42 /* CKLBWebViewNode.cpp */; };\n\t\t32D86BFA182F74A600210C28 /* CKLBUIClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2E179A41BE007B7F42 /* CKLBUIClip.cpp */; };\n\t\t32D86BFB182F74A600210C28 /* CKLBUIMultiImgItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D2F179A41BE007B7F42 /* CKLBUIMultiImgItem.cpp */; };\n\t\t32D86BFC182F74A600210C28 /* CKLBUISWFPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D30179A41BE007B7F42 /* CKLBUISWFPlayer.cpp */; };\n\t\t32D86BFD182F74A600210C28 /* CKLBUISystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D31179A41BE007B7F42 /* CKLBUISystem.cpp */; };\n\t\t32D86BFE182F74A600210C28 /* CKLBUITouchPad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D32179A41BE007B7F42 /* CKLBUITouchPad.cpp */; };\n\t\t32D86BFF182F74A600210C28 /* CKLBUIForm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D33179A41BE007B7F42 /* CKLBUIForm.cpp */; };\n\t\t32D86C00182F74A600210C28 /* CKLBUILabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D34179A41BE007B7F42 /* CKLBUILabel.cpp */; };\n\t\t32D86C01182F74A600210C28 /* CKLBUIControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D39179A41BE007B7F42 /* CKLBUIControl.cpp */; };\n\t\t32D86C02182F74A600210C28 /* CKLBUIScale9.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D3C179A41BE007B7F42 /* CKLBUIScale9.cpp */; };\n\t\t32D86C03182F74A600210C28 /* CKLBUITextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D3D179A41BE007B7F42 /* CKLBUITextInput.cpp */; };\n\t\t32D86C04182F74A600210C28 /* CKLBActivityIndicatorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D3E179A41BE007B7F42 /* CKLBActivityIndicatorNode.cpp */; };\n\t\t32D86C05182F74A600210C28 /* CKLBDragCallbackIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D40179A41BE007B7F42 /* CKLBDragCallbackIF.cpp */; };\n\t\t32D86C06182F74A600210C28 /* CKLBFormGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D42179A41BE007B7F42 /* CKLBFormGroup.cpp */; };\n\t\t32D86C07182F74A600210C28 /* CKLBFormIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D44179A41BE007B7F42 /* CKLBFormIF.cpp */; };\n\t\t32D86C08182F74A600210C28 /* CKLBModalStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D46179A41BE007B7F42 /* CKLBModalStack.cpp */; };\n\t\t32D86C09182F74A600210C28 /* CKLBNodeAnimPack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D49179A41BE007B7F42 /* CKLBNodeAnimPack.cpp */; };\n\t\t32D86C0A182F74A600210C28 /* CKLBUIActivityIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D4B179A41BE007B7F42 /* CKLBUIActivityIndicator.cpp */; };\n\t\t32D86C0B182F74A600210C28 /* CKLBUIGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D55179A41BE007B7F42 /* CKLBUIGroup.cpp */; };\n\t\t32D86C0C182F74A600210C28 /* CKLBUIMoviePlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D58179A41BE007B7F42 /* CKLBUIMoviePlayer.cpp */; };\n\t\t32D86C0D182F74A600210C28 /* CKLBUIPieChart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D5B179A41BE007B7F42 /* CKLBUIPieChart.cpp */; };\n\t\t32D86C0E182F74A600210C28 /* CKLBUIPolyline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D5D179A41BE007B7F42 /* CKLBUIPolyline.cpp */; };\n\t\t32D86C0F182F74A600210C28 /* CKLBUIRubberBand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D60179A41BE007B7F42 /* CKLBUIRubberBand.cpp */; };\n\t\t32D86C10182F74A600210C28 /* CKLBUIScore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D63179A41BE007B7F42 /* CKLBUIScore.cpp */; };\n\t\t32D86C11182F74A600210C28 /* CKLBUIScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D65179A41BE007B7F42 /* CKLBUIScrollBar.cpp */; };\n\t\t32D86C12182F74A600210C28 /* CKLBUISimpleItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D67179A41BE007B7F42 /* CKLBUISimpleItem.cpp */; };\n\t\t32D86C13182F74A600210C28 /* IMgrEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0D6C179A41BE007B7F42 /* IMgrEntry.cpp */; };\n\t\t32D86C14182F74A600210C28 /* CSampleProjectEntrance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32127065182530650027C57E /* CSampleProjectEntrance.cpp */; };\n\t\t32D86C15182F74E900210C28 /* PlaygroundAppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 327C0B9C179A3945007B7F42 /* PlaygroundAppDelegate.mm */; };\n\t\t32D86C17182F74E900210C28 /* imageUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D0179CE0D200E9F3CE /* imageUtil.m */; };\n\t\t32D86C18182F74E900210C28 /* OpenGLRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8CB179CE01300E9F3CE /* OpenGLRenderer.mm */; };\n\t\t32D86C19182F74E900210C28 /* NSGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8C8179CDDD900E9F3CE /* NSGLView.mm */; };\n\t\t32D86C1A182F74E900210C28 /* assert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C8179A576300B0CA20 /* assert.mm */; };\n\t\t32D86C1B182F74E900210C28 /* CiOSAudio.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C9179A576300B0CA20 /* CiOSAudio.mm */; };\n\t\t32D86C1C182F74E900210C28 /* CiOSAudioManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C6179A576300B0CA20 /* CiOSAudioManager.mm */; };\n\t\t32D86C1D182F74E900210C28 /* CiOSMovieView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401D4179A576300B0CA20 /* CiOSMovieView.mm */; };\n\t\t32D86C1E182F74E900210C28 /* CiOSPathConv.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401CF179A576300B0CA20 /* CiOSPathConv.mm */; };\n\t\t32D86C1F182F74E900210C28 /* CiOSPlatform.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401C5179A576300B0CA20 /* CiOSPlatform.mm */; };\n\t\t32D86C20182F74E900210C28 /* CiOSSysResource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401D5179A576300B0CA20 /* CiOSSysResource.mm */; };\n\t\t32D86C21182F74E900210C28 /* CiOSWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 32F55E8E179B0796003807CE /* CiOSWebView.mm */; };\n\t\t32D86C22182F74E900210C28 /* CiOSWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401CA179A576300B0CA20 /* CiOSWidget.mm */; };\n\t\t32D86C23182F74E900210C28 /* EAGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 328401CB179A576300B0CA20 /* EAGLView.mm */; };\n\t\t32D86C24182F751B00210C28 /* autofit.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEB8179A4FB200B0CA20 /* autofit.c */; };\n\t\t32D86C25182F751B00210C28 /* ftbase.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEC1179A4FB200B0CA20 /* ftbase.c */; };\n\t\t32D86C26182F751B00210C28 /* ftbbox.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEC3179A4FB200B0CA20 /* ftbbox.c */; };\n\t\t32D86C27182F751B00210C28 /* ftbitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEC5179A4FB200B0CA20 /* ftbitmap.c */; };\n\t\t32D86C28182F751B00210C28 /* ftfstype.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECA179A4FB200B0CA20 /* ftfstype.c */; };\n\t\t32D86C29182F751B00210C28 /* ftgasp.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECB179A4FB200B0CA20 /* ftgasp.c */; };\n\t\t32D86C2A182F751B00210C28 /* ftglyph.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECD179A4FB200B0CA20 /* ftglyph.c */; };\n\t\t32D86C2B182F751B00210C28 /* ftgxval.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECE179A4FB200B0CA20 /* ftgxval.c */; };\n\t\t32D86C2C182F751B00210C28 /* ftinit.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FECF179A4FB200B0CA20 /* ftinit.c */; };\n\t\t32D86C2D182F751B00210C28 /* ftlcdfil.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED0179A4FB200B0CA20 /* ftlcdfil.c */; };\n\t\t32D86C2E182F751B00210C28 /* ftmm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED2179A4FB200B0CA20 /* ftmm.c */; };\n\t\t32D86C2F182F751B00210C28 /* ftotval.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED4179A4FB200B0CA20 /* ftotval.c */; };\n\t\t32D86C30182F751B00210C28 /* ftpatent.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED6179A4FB200B0CA20 /* ftpatent.c */; };\n\t\t32D86C31182F751B00210C28 /* ftpfr.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FED7179A4FB200B0CA20 /* ftpfr.c */; };\n\t\t32D86C32182F751B00210C28 /* ftstroke.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEDC179A4FB200B0CA20 /* ftstroke.c */; };\n\t\t32D86C33182F751B00210C28 /* ftsynth.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEDD179A4FB200B0CA20 /* ftsynth.c */; };\n\t\t32D86C34182F751B00210C28 /* ftsystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEDE179A4FB200B0CA20 /* ftsystem.c */; };\n\t\t32D86C35182F751B00210C28 /* fttype1.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE0179A4FB200B0CA20 /* fttype1.c */; };\n\t\t32D86C36182F751B00210C28 /* ftwinfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE2179A4FB200B0CA20 /* ftwinfnt.c */; };\n\t\t32D86C37182F751B00210C28 /* ftxf86.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE3179A4FB200B0CA20 /* ftxf86.c */; };\n\t\t32D86C38182F751B00210C28 /* bdf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEE7179A4FB200B0CA20 /* bdf.c */; };\n\t\t32D86C39182F751B00210C28 /* ftcache.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FEF6179A4FB200B0CA20 /* ftcache.c */; };\n\t\t32D86C3A182F751B00210C28 /* ftdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF30179A4FB300B0CA20 /* ftdebug.c */; };\n\t\t32D86C3B182F751B00210C28 /* pfr.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF92179A4FB300B0CA20 /* pfr.c */; };\n\t\t32D86C3C182F751B00210C28 /* psaux.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFA7179A4FB300B0CA20 /* psaux.c */; };\n\t\t32D86C3D182F751B00210C28 /* pshinter.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFBB179A4FB300B0CA20 /* pshinter.c */; };\n\t\t32D86C3E182F751B00210C28 /* raster.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFD7179A4FB300B0CA20 /* raster.c */; };\n\t\t32D86C3F182F751B00210C28 /* sfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFE3179A4FB300B0CA20 /* sfnt.c */; };\n\t\t32D86C40182F751B00210C28 /* smooth.c in Sources */ = {isa = PBXBuildFile; fileRef = 32840003179A4FB300B0CA20 /* smooth.c */; };\n\t\t32D86C41182F751B00210C28 /* truetype.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284001D179A4FB300B0CA20 /* truetype.c */; };\n\t\t32D86C42182F751B00210C28 /* type1.c in Sources */ = {isa = PBXBuildFile; fileRef = 32840041179A4FB300B0CA20 /* type1.c */; };\n\t\t32D86C43182F751B00210C28 /* type42.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284004E179A4FB300B0CA20 /* type42.c */; };\n\t\t32D86C44182F751B00210C28 /* winfnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 32840054179A4FB300B0CA20 /* winfnt.c */; };\n\t\t32D86C45182F751B00210C28 /* matrixUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D1179CE0D200E9F3CE /* matrixUtil.c */; };\n\t\t32D86C46182F751B00210C28 /* modelUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D3179CE0D200E9F3CE /* modelUtil.c */; };\n\t\t32D86C47182F751B00210C28 /* sourceUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D5179CE0D200E9F3CE /* sourceUtil.c */; };\n\t\t32D86C48182F751B00210C28 /* vectorUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D7179CE0D200E9F3CE /* vectorUtil.c */; };\n\t\t32D86C49182F751B00210C28 /* CKLBDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C6D179A3E98007B7F42 /* CKLBDatabase.cpp */; };\n\t\t32D86C4A182F751B00210C28 /* CKLBLuaDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C6F179A3E98007B7F42 /* CKLBLuaDB.cpp */; };\n\t\t32D86C4B182F751B00210C28 /* CKLBLanguageDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C72179A3E98007B7F42 /* CKLBLanguageDatabase.cpp */; };\n\t\t32D86C4C182F751B00210C28 /* DataSet_JSonDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 327C0C74179A3E98007B7F42 /* DataSet_JSonDB.cpp */; };\n\t\t32D86C4D182F753100210C28 /* cff.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF0A179A4FB200B0CA20 /* cff.c */; };\n\t\t32D86C4E182F753100210C28 /* type1cid.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF2F179A4FB300B0CA20 /* type1cid.c */; };\n\t\t32D86C4F182F753100210C28 /* pcf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FF84179A4FB300B0CA20 /* pcf.c */; };\n\t\t32D86C50182F753100210C28 /* psmodule.c in Sources */ = {isa = PBXBuildFile; fileRef = 3284FFC7179A4FB300B0CA20 /* psmodule.c */; };\n\t\t32D86C51182F757A00210C28 /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55EA2179B2147003807CE /* libcurl.dylib */; };\n\t\t32D86C52182F758100210C28 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E95179B1CA2003807CE /* libz.dylib */; };\n\t\t32D86C53182F758800210C28 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E93179B17F4003807CE /* AudioUnit.framework */; };\n\t\t32D86C54182F758F00210C28 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E90179B0D55003807CE /* OpenGL.framework */; };\n\t\t32D86C55182F759600210C28 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E8C179AFDFC003807CE /* WebKit.framework */; };\n\t\t32D86C56182F75A000210C28 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DCA179A428A007B7F42 /* AudioToolbox.framework */; };\n\t\t32D86C57182F75A700210C28 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DC8179A427E007B7F42 /* Security.framework */; };\n\t\t32D86C58182F75AC00210C28 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86B08182F73E700210C28 /* Foundation.framework */; };\n\t\t32D86C59182F75BC00210C28 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DC3179A425A007B7F42 /* AVFoundation.framework */; };\n\t\t32D86C5A182F75C700210C28 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DC1179A4252007B7F42 /* QuartzCore.framework */; };\n\t\t32D86C5B182F75CE00210C28 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DBF179A424C007B7F42 /* CoreFoundation.framework */; };\n\t\t32D86C5C182F75D600210C28 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327C0DBD179A423F007B7F42 /* CoreAudio.framework */; };\n\t\t32D86C5D182F75FE00210C28 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 327C0B9E179A3945007B7F42 /* MainMenu.xib */; };\n\t\t32D86C5E182F7FDF00210C28 /* CPFInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BB8179A3B52007B7F42 /* CPFInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C5F182F7FDF00210C28 /* RenderingFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BB9179A3B52007B7F42 /* RenderingFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C60182F7FDF00210C28 /* encryptFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BBA179A3B52007B7F42 /* encryptFile.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C61182F7FDF00210C28 /* KLBPlatformMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401C4179A50F700B0CA20 /* KLBPlatformMetrics.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C62182F7FDF00210C28 /* KLBPlatformMetricsCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BBB179A3B52007B7F42 /* KLBPlatformMetricsCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C63182F7FDF00210C28 /* CSoundAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BBC179A3B52007B7F42 /* CSoundAnalysis.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C64182F7FDF00210C28 /* mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BBD179A3B52007B7F42 /* mem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C66182F7FDF00210C28 /* BaseType.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BBF179A3B52007B7F42 /* BaseType.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C67182F7FDF00210C28 /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BC0179A3B52007B7F42 /* FileSystem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C68182F7FDF00210C28 /* OSWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BC1179A3B52007B7F42 /* OSWidget.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C69182F7FDF00210C28 /* assert_klb.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BC2179A3B52007B7F42 /* assert_klb.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C6A182F7FDF00210C28 /* ITmpFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BC3179A3B52007B7F42 /* ITmpFile.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C6B182F7FDF00210C28 /* klb_vararg.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BC4179A3B52007B7F42 /* klb_vararg.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C6C182F801600210C28 /* imageUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8CF179CE0D200E9F3CE /* imageUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C6D182F801600210C28 /* matrixUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8D2179CE0D200E9F3CE /* matrixUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C6E182F801600210C28 /* modelUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8D4179CE0D200E9F3CE /* modelUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C6F182F801600210C28 /* sourceUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8D6179CE0D200E9F3CE /* sourceUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C70182F801600210C28 /* vectorUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8D8179CE0D200E9F3CE /* vectorUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C71182F801600210C28 /* AppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401ED179A577900B0CA20 /* AppDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C72182F801600210C28 /* CiOSAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401EE179A577900B0CA20 /* CiOSAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C73182F801600210C28 /* CiOSAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401EC179A577900B0CA20 /* CiOSAudioManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C74182F801600210C28 /* CiOSMovieView.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F7179A577900B0CA20 /* CiOSMovieView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C75182F801600210C28 /* CiOSPathConv.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F8179A577900B0CA20 /* CiOSPathConv.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C76182F801600210C28 /* CiOSPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401EB179A577900B0CA20 /* CiOSPlatform.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C77182F801600210C28 /* CiOSReadFileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F2179A577900B0CA20 /* CiOSReadFileStream.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C78182F801600210C28 /* CiOSSysResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F9179A577900B0CA20 /* CiOSSysResource.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C79182F801600210C28 /* CiOSTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401FA179A577900B0CA20 /* CiOSTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C7A182F801600210C28 /* CiOSTmpFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401FB179A577900B0CA20 /* CiOSTmpFile.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C7B182F801600210C28 /* CiOSWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F0179A577900B0CA20 /* CiOSWebView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C7C182F801600210C28 /* CiOSWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F4179A577900B0CA20 /* CiOSWidget.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C7D182F801600210C28 /* CiOSWriteFileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401FC179A577900B0CA20 /* CiOSWriteFileStream.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C7E182F801600210C28 /* CSockReadStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401FD179A577900B0CA20 /* CSockReadStream.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C7F182F801600210C28 /* CSockWriteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401FE179A577900B0CA20 /* CSockWriteStream.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C80182F801600210C28 /* EAGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401EF179A577900B0CA20 /* EAGLView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C81182F801600210C28 /* FontRendering.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F55E92179B1493003807CE /* FontRendering.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C82182F801600210C28 /* FileDelete.h in Headers */ = {isa = PBXBuildFile; fileRef = 3212706B18253C630027C57E /* FileDelete.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C83182F801600210C28 /* GLcommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401FF179A577900B0CA20 /* GLcommon.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C84182F801600210C28 /* iOSFileLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F5179A577900B0CA20 /* iOSFileLocation.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C85182F801600210C28 /* KLBPlatformMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F3179A577900B0CA20 /* KLBPlatformMetrics.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C86182F801600210C28 /* NSData+Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 32840200179A577900B0CA20 /* NSData+Base64.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C87182F801600210C28 /* ViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 328401F6179A577900B0CA20 /* ViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C88182F801600210C28 /* glUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8CD179CE05900E9F3CE /* glUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C89182F801600210C28 /* OpenGLRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8CA179CE01300E9F3CE /* OpenGLRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C8A182F801600210C28 /* NSGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F65D8C7179CDDD900E9F3CE /* NSGLView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C8B182F801600210C28 /* CKLBSplineNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BDE179A3E4A007B7F42 /* CKLBSplineNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C8C182F801600210C28 /* CKLBNodeVirtualDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BE1179A3E4A007B7F42 /* CKLBNodeVirtualDocument.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C8D182F801600210C28 /* CKLBScoreNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BE5179A3E4A007B7F42 /* CKLBScoreNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C8E182F801600210C28 /* CKLBSWFPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BE6179A3E4A007B7F42 /* CKLBSWFPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C8F182F801600210C28 /* CKLBTexturePacker.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BF1179A3E63007B7F42 /* CKLBTexturePacker.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C90182F801600210C28 /* CKLBAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BF6179A3E63007B7F42 /* CKLBAsset.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C91182F801700210C28 /* CompositeManagement.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BF7179A3E63007B7F42 /* CompositeManagement.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C92182F801700210C28 /* AudioAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BFA179A3E63007B7F42 /* AudioAsset.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C93182F801700210C28 /* CKLBPropertyBag.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0BFE179A3E63007B7F42 /* CKLBPropertyBag.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C94182F801700210C28 /* NodeAnimationAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C02179A3E63007B7F42 /* NodeAnimationAsset.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C95182F801700210C28 /* TextureManagement.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C03179A3E63007B7F42 /* TextureManagement.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C96182F801700210C28 /* CKLBTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C0F179A3E7A007B7F42 /* CKLBTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C97182F801700210C28 /* ArrayAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C10179A3E7A007B7F42 /* ArrayAllocator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C98182F801700210C28 /* CKLBGameApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C13179A3E7A007B7F42 /* CKLBGameApplication.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C99182F801700210C28 /* CKLBAsyncFilecopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C17179A3E7A007B7F42 /* CKLBAsyncFilecopy.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C9A182F801700210C28 /* CKLBScriptEnv.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C18179A3E7A007B7F42 /* CKLBScriptEnv.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C9B182F801700210C28 /* CLuaState.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C19179A3E7A007B7F42 /* CLuaState.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C9C182F801700210C28 /* CKLBLuaTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C23179A3E7A007B7F42 /* CKLBLuaTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C9D182F801700210C28 /* CKLBUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C24179A3E7A007B7F42 /* CKLBUtility.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C9E182F801700210C28 /* DebugTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C27179A3E7A007B7F42 /* DebugTracker.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86C9F182F801700210C28 /* CKLBAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C28179A3E7A007B7F42 /* CKLBAction.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA0182F801700210C28 /* CKLBAppProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C2A179A3E7A007B7F42 /* CKLBAppProperty.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA1182F801700210C28 /* CKLBAsyncLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C2C179A3E7A007B7F42 /* CKLBAsyncLoader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA2182F801700210C28 /* CKLBBinArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C2D179A3E7A007B7F42 /* CKLBBinArray.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA3182F801700210C28 /* CKLBDataHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C2F179A3E7A007B7F42 /* CKLBDataHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA4182F801700210C28 /* CKLBDebugger.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C30179A3E7A007B7F42 /* CKLBDebugger.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA5182F801700210C28 /* CKLBGenericTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C34179A3E7A007B7F42 /* CKLBGenericTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA6182F801700210C28 /* CKLBIntervalTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C35179A3E7A007B7F42 /* CKLBIntervalTimer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA7182F801700210C28 /* CKLBLibRegistrator.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C37179A3E7A007B7F42 /* CKLBLibRegistrator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA8182F801700210C28 /* CKLBLifeCtrlTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C39179A3E7A007B7F42 /* CKLBLifeCtrlTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CA9182F801700210C28 /* CKLBLuaEnv.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C3A179A3E7A007B7F42 /* CKLBLuaEnv.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CAA182F801700210C28 /* CKLBLuaPropTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C3B179A3E7A007B7F42 /* CKLBLuaPropTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CAB182F801700210C28 /* CKLBObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C3E179A3E7A007B7F42 /* CKLBObject.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CAC182F801700210C28 /* CKLBPauseCtrl.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C40179A3E7A007B7F42 /* CKLBPauseCtrl.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CAD182F801700210C28 /* CKLBTextTempBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C43179A3E7A007B7F42 /* CKLBTextTempBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CAE182F801700210C28 /* CKLBUITask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C44179A3E7A007B7F42 /* CKLBUITask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CAF182F801700210C28 /* DebugAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C47179A3E7A007B7F42 /* DebugAlloc.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB0182F801700210C28 /* Dictionnary.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C48179A3E7A007B7F42 /* Dictionnary.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB1182F801700210C28 /* Message.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C4A179A3E7A007B7F42 /* Message.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB2182F801700210C28 /* DataSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C6E179A3E98007B7F42 /* DataSet.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB3182F801700210C28 /* CKLBDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C70179A3E98007B7F42 /* CKLBDatabase.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB4182F801700210C28 /* CKLBLuaDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C71179A3E98007B7F42 /* CKLBLuaDB.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB5182F801700210C28 /* CKLBLanguageDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C73179A3E98007B7F42 /* CKLBLanguageDatabase.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB6182F801700210C28 /* DataSet_JSonDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C75179A3E98007B7F42 /* DataSet_JSonDB.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB7182F801700210C28 /* CKLBStoreService.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C7B179A3EAF007B7F42 /* CKLBStoreService.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB8182F801700210C28 /* CKLBNetAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C7D179A3EAF007B7F42 /* CKLBNetAPI.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CB9182F801700210C28 /* MultithreadedNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C7E179A3EAF007B7F42 /* MultithreadedNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CBA182F801700210C28 /* CKLBHTTPInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C80179A3EAF007B7F42 /* CKLBHTTPInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CBB182F801700210C28 /* CKLBNetAPIKeyChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C85179A3EAF007B7F42 /* CKLBNetAPIKeyChain.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CBC182F801700210C28 /* CKLBUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C86179A3EAF007B7F42 /* CKLBUpdate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CBD182F801700210C28 /* CKLBJsonItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C87179A3EAF007B7F42 /* CKLBJsonItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CBE182F801700210C28 /* CUnZip.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C89179A3EAF007B7F42 /* CUnZip.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CBF182F801700210C28 /* CKLBLuaLibENG.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C94179A3ECB007B7F42 /* CKLBLuaLibENG.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC0182F801700210C28 /* CKLBLuaLibFONT.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C96179A3ECB007B7F42 /* CKLBLuaLibFONT.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC1182F801700210C28 /* CKLBLuaLibHASH.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C98179A3ECB007B7F42 /* CKLBLuaLibHASH.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC2182F801700210C28 /* CKLBLuaLibSOUND.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0C9A179A3ECB007B7F42 /* CKLBLuaLibSOUND.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC3182F801700210C28 /* CKLBLuaLibGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CA1179A3ECB007B7F42 /* CKLBLuaLibGL.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC4182F801700210C28 /* CKLBLuaLibASSET.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CA5179A3ECB007B7F42 /* CKLBLuaLibASSET.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC5182F801700210C28 /* CKLBLuaConst.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CA7179A3ECB007B7F42 /* CKLBLuaConst.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC6182F801700210C28 /* CKLBLuaLibAPP.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CA9179A3ECB007B7F42 /* CKLBLuaLibAPP.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC7182F801700210C28 /* CKLBLuaLibBIN.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CAB179A3ECB007B7F42 /* CKLBLuaLibBIN.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC8182F801700210C28 /* CKLBLuaLibCONV.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CAC179A3ECB007B7F42 /* CKLBLuaLibCONV.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CC9182F801700210C28 /* CKLBLuaLibDATA.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CAD179A3ECB007B7F42 /* CKLBLuaLibDATA.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CCA182F801700210C28 /* CKLBLuaLibDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CAF179A3ECB007B7F42 /* CKLBLuaLibDB.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CCB182F801700210C28 /* CKLBLuaLibDEBUG.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CB1179A3ECB007B7F42 /* CKLBLuaLibDEBUG.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CCC182F801700210C28 /* CKLBLuaLibKEY.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CB2179A3ECB007B7F42 /* CKLBLuaLibKEY.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CCD182F801700210C28 /* CKLBLuaLibLANG.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CB4179A3ECB007B7F42 /* CKLBLuaLibLANG.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CCE182F801700210C28 /* CKLBLuaLibMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CB5179A3ECB007B7F42 /* CKLBLuaLibMatrix.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CCF182F801700210C28 /* CKLBLuaLibRES.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CB7179A3ECB007B7F42 /* CKLBLuaLibRES.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD0182F801700210C28 /* CKLBLuaLibTASK.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CB8179A3ECB007B7F42 /* CKLBLuaLibTASK.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD1182F801700210C28 /* CKLBLuaLibUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CBA179A3ECB007B7F42 /* CKLBLuaLibUI.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD2182F801700210C28 /* ILuaFuncLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CBB179A3ECB007B7F42 /* ILuaFuncLib.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD3182F801700210C28 /* CKLBRendering.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CD8179A3F34007B7F42 /* CKLBRendering.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD4182F801700210C28 /* glWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CDA179A3F34007B7F42 /* glWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD5182F801700210C28 /* CKLBCanvasSprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CDF179A3F34007B7F42 /* CKLBCanvasSprite.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD6182F801700210C28 /* CKLBSprite3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CE1179A3F34007B7F42 /* CKLBSprite3D.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD7182F801700210C28 /* CKLBNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CFA179A3F4D007B7F42 /* CKLBNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD8182F801700210C28 /* CSoundAnalysisMP3.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0CFE179A3F76007B7F42 /* CSoundAnalysisMP3.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CD9182F801700210C28 /* CKLBDeviceKeyEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 32127069182532090027C57E /* CKLBDeviceKeyEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CDA182F801700210C28 /* CKLBDebugMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D06179A41AE007B7F42 /* CKLBDebugMenu.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CDB182F801700210C28 /* CKLBTouchPad.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D08179A41AE007B7F42 /* CKLBTouchPad.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CDC182F801700210C28 /* CKLBDrawTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D0A179A41AE007B7F42 /* CKLBDrawTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CDD182F801700210C28 /* CKLBOSCtrlEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D0C179A41AE007B7F42 /* CKLBOSCtrlEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CDE182F801700210C28 /* CKLBLuaScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D0E179A41AE007B7F42 /* CKLBLuaScript.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CDF182F801700210C28 /* CKLBTouchEventUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D0F179A41AE007B7F42 /* CKLBTouchEventUI.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE0182F801700210C28 /* CKLBScrMgrDefault.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D19179A41BE007B7F42 /* CKLBScrMgrDefault.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE1182F801700210C28 /* CKLBScrMgrPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D1B179A41BE007B7F42 /* CKLBScrMgrPage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE2182F801700210C28 /* CKLBUIFreeVertItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D1F179A41BE007B7F42 /* CKLBUIFreeVertItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE3182F801700210C28 /* CKLBUIList.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D20179A41BE007B7F42 /* CKLBUIList.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE4182F801700210C28 /* CKLBScrMgrSolid.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D24179A41BE007B7F42 /* CKLBScrMgrSolid.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE5182F801700210C28 /* CKLBScrollBarIF.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D26179A41BE007B7F42 /* CKLBScrollBarIF.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE6182F801700210C28 /* CKLBUISystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D2B179A41BE007B7F42 /* CKLBUISystem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE7182F801700210C28 /* CKLBUISWFPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D35179A41BE007B7F42 /* CKLBUISWFPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE8182F801700210C28 /* CKLBUIVariableItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D36179A41BE007B7F42 /* CKLBUIVariableItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CE9182F801700210C28 /* CKLBLabelNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D37179A41BE007B7F42 /* CKLBLabelNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CEA182F801700210C28 /* CKLBUIVirtualDoc.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D38179A41BE007B7F42 /* CKLBUIVirtualDoc.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CEB182F801700210C28 /* CKLBUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D3A179A41BE007B7F42 /* CKLBUITextInput.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CEC182F801700210C28 /* CKLBTextInputNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D3B179A41BE007B7F42 /* CKLBTextInputNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CED182F801700210C28 /* CKLBActivityIndicatorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D3F179A41BE007B7F42 /* CKLBActivityIndicatorNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CEE182F801700210C28 /* CKLBDragCallbackIF.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D41179A41BE007B7F42 /* CKLBDragCallbackIF.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CEF182F801700210C28 /* CKLBFormGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D43179A41BE007B7F42 /* CKLBFormGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF0182F801700210C28 /* CKLBFormIF.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D45179A41BE007B7F42 /* CKLBFormIF.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF1182F801700210C28 /* CKLBModalStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D47179A41BE007B7F42 /* CKLBModalStack.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF2182F801700210C28 /* CKLBMovieNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D48179A41BE007B7F42 /* CKLBMovieNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF3182F801700210C28 /* CKLBNodeAnimPack.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D4A179A41BE007B7F42 /* CKLBNodeAnimPack.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF4182F801700210C28 /* CKLBUIActivityIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D4C179A41BE007B7F42 /* CKLBUIActivityIndicator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF5182F801700210C28 /* CKLBUICanvas.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D4D179A41BE007B7F42 /* CKLBUICanvas.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF6182F801700210C28 /* CKLBUIClip.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D50179A41BE007B7F42 /* CKLBUIClip.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF7182F801700210C28 /* CKLBUIControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D51179A41BE007B7F42 /* CKLBUIControl.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF8182F801700210C28 /* CKLBUIDebugItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D52179A41BE007B7F42 /* CKLBUIDebugItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CF9182F801700210C28 /* CKLBUIDragIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D53179A41BE007B7F42 /* CKLBUIDragIcon.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CFA182F801700210C28 /* CKLBUIForm.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D54179A41BE007B7F42 /* CKLBUIForm.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CFB182F801700210C28 /* CKLBUIGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D56179A41BE007B7F42 /* CKLBUIGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CFC182F801700210C28 /* CKLBUILabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D57179A41BE007B7F42 /* CKLBUILabel.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CFD182F801700210C28 /* CKLBUIMoviePlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D59179A41BE007B7F42 /* CKLBUIMoviePlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CFE182F801700210C28 /* CKLBUIMultiImgItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D5A179A41BE007B7F42 /* CKLBUIMultiImgItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86CFF182F801700210C28 /* CKLBUIPieChart.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D5C179A41BE007B7F42 /* CKLBUIPieChart.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D00182F801700210C28 /* CKLBUIPolyline.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D5E179A41BE007B7F42 /* CKLBUIPolyline.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D01182F801700210C28 /* CKLBUIProgressBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D5F179A41BE007B7F42 /* CKLBUIProgressBar.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D02182F801700210C28 /* CKLBUIRubberBand.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D61179A41BE007B7F42 /* CKLBUIRubberBand.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D03182F801700210C28 /* CKLBUIScale9.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D62179A41BE007B7F42 /* CKLBUIScale9.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D04182F801700210C28 /* CKLBUIScore.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D64179A41BE007B7F42 /* CKLBUIScore.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D05182F801700210C28 /* CKLBUIScrollBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D66179A41BE007B7F42 /* CKLBUIScrollBar.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D06182F801700210C28 /* CKLBUISimpleItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D68179A41BE007B7F42 /* CKLBUISimpleItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D07182F801700210C28 /* CKLBUITouchPad.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D69179A41BE007B7F42 /* CKLBUITouchPad.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D08182F801700210C28 /* CKLBUIWebArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D6A179A41BE007B7F42 /* CKLBUIWebArea.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D09182F801700210C28 /* CKLBWebViewNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D6B179A41BE007B7F42 /* CKLBWebViewNode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D0A182F801700210C28 /* IMgrEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 327C0D6D179A41BF007B7F42 /* IMgrEntry.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86D0B182F801700210C28 /* CSampleProjectEntrance.h in Headers */ = {isa = PBXBuildFile; fileRef = 32127066182530650027C57E /* CSampleProjectEntrance.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86DF5182FDAE300210C28 /* Playground-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 327C0B91179A3944007B7F42 /* Playground-Info.plist */; };\n\t\t32F55E8D179AFDFC003807CE /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E8C179AFDFC003807CE /* WebKit.framework */; };\n\t\t32F55E8F179B0796003807CE /* CiOSWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 32F55E8E179B0796003807CE /* CiOSWebView.mm */; };\n\t\t32F55E91179B0D55003807CE /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E90179B0D55003807CE /* OpenGL.framework */; };\n\t\t32F55E94179B17F5003807CE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E93179B17F4003807CE /* AudioUnit.framework */; };\n\t\t32F55E96179B1CA3003807CE /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55E95179B1CA2003807CE /* libz.dylib */; };\n\t\t32F55EA3179B2147003807CE /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F55EA2179B2147003807CE /* libcurl.dylib */; };\n\t\t32F55EA6179CF9DB003807CE /* demon.model in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EA4179CF9C8003807CE /* demon.model */; };\n\t\t32F55EA7179CF9DB003807CE /* demon.png in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EA5179CF9C8003807CE /* demon.png */; };\n\t\t32F55EAD179CFA29003807CE /* character.fsh in Sources */ = {isa = PBXBuildFile; fileRef = 32F55EA9179CFA29003807CE /* character.fsh */; };\n\t\t32F55EAE179CFA29003807CE /* character.vsh in Sources */ = {isa = PBXBuildFile; fileRef = 32F55EAA179CFA29003807CE /* character.vsh */; };\n\t\t32F55EAF179CFA29003807CE /* reflect.fsh in Sources */ = {isa = PBXBuildFile; fileRef = 32F55EAB179CFA29003807CE /* reflect.fsh */; };\n\t\t32F55EB0179CFA29003807CE /* reflect.vsh in Sources */ = {isa = PBXBuildFile; fileRef = 32F55EAC179CFA29003807CE /* reflect.vsh */; };\n\t\t32F55EB1179CFA32003807CE /* character.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EA9179CFA29003807CE /* character.fsh */; };\n\t\t32F55EB2179CFA32003807CE /* character.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EAA179CFA29003807CE /* character.vsh */; };\n\t\t32F55EB3179CFA32003807CE /* reflect.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EAB179CFA29003807CE /* reflect.fsh */; };\n\t\t32F55EB4179CFA32003807CE /* reflect.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EAC179CFA29003807CE /* reflect.vsh */; };\n\t\t32F55EBE179D0B07003807CE /* MTLmr3m.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 32F55EBD179D0B07003807CE /* MTLmr3m.ttf */; };\n\t\t6F65D8C9179CDDD900E9F3CE /* NSGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8C8179CDDD900E9F3CE /* NSGLView.mm */; };\n\t\t6F65D8CC179CE01300E9F3CE /* OpenGLRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8CB179CE01300E9F3CE /* OpenGLRenderer.mm */; };\n\t\t6F65D8D9179CE18500E9F3CE /* imageUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D0179CE0D200E9F3CE /* imageUtil.m */; };\n\t\t6F65D8DA179CE18500E9F3CE /* matrixUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D1179CE0D200E9F3CE /* matrixUtil.c */; };\n\t\t6F65D8DB179CE18500E9F3CE /* modelUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D3179CE0D200E9F3CE /* modelUtil.c */; };\n\t\t6F65D8DC179CE18500E9F3CE /* sourceUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D5179CE0D200E9F3CE /* sourceUtil.c */; };\n\t\t6F65D8DD179CE18500E9F3CE /* vectorUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F65D8D7179CE0D200E9F3CE /* vectorUtil.c */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t32D86B1D182F73E800210C28 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 327C0B7E179A3944007B7F42 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 32D86B04182F73E700210C28;\n\t\t\tremoteInfo = PlaygroundOSS;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t32127065182530650027C57E /* CSampleProjectEntrance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSampleProjectEntrance.cpp; path = ../../../../SampleProject/game/CSampleProjectEntrance.cpp; sourceTree = \"<group>\"; };\n\t\t32127066182530650027C57E /* CSampleProjectEntrance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSampleProjectEntrance.h; path = ../../../../SampleProject/game/CSampleProjectEntrance.h; sourceTree = \"<group>\"; };\n\t\t32127068182532090027C57E /* CKLBDeviceKeyEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDeviceKeyEvent.cpp; path = ../../../source/SystemTask/CKLBDeviceKeyEvent.cpp; sourceTree = \"<group>\"; };\n\t\t32127069182532090027C57E /* CKLBDeviceKeyEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDeviceKeyEvent.h; path = ../../../source/SystemTask/CKLBDeviceKeyEvent.h; sourceTree = \"<group>\"; };\n\t\t3212706B18253C630027C57E /* FileDelete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDelete.h; path = ../../FileDelete.h; sourceTree = \"<group>\"; };\n\t\t3212706C18253C800027C57E /* FileDelete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDelete.cpp; path = ../../FileDelete.cpp; sourceTree = \"<group>\"; };\n\t\t3212706D18253C800027C57E /* FontRendering.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontRendering.cpp; path = ../../FontRendering.cpp; sourceTree = \"<group>\"; };\n\t\t3212707018253D2A0027C57E /* itemimage.png.imag */ = {isa = PBXFileReference; lastKnownFileType = file; name = itemimage.png.imag; path = ../../../Tutorial/01.SimpleItem/.publish/iphone/itemimage.png.imag; sourceTree = \"<group>\"; };\n\t\t3212707118253D2A0027C57E /* SimpleItem.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SimpleItem.lua; path = ../../../Tutorial/01.SimpleItem/.publish/iphone/SimpleItem.lua; sourceTree = \"<group>\"; };\n\t\t3212707218253D2A0027C57E /* start.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = start.lua; path = ../../../Tutorial/01.SimpleItem/.publish/iphone/start.lua; sourceTree = \"<group>\"; };\n\t\t3212707318253D2A0027C57E /* textureBoat.texb */ = {isa = PBXFileReference; lastKnownFileType = file; name = textureBoat.texb; path = ../../../Tutorial/01.SimpleItem/.publish/iphone/textureBoat.texb; sourceTree = \"<group>\"; };\n\t\t327C0B86179A3944007B7F42 /* Playground.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Playground.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t327C0B89179A3944007B7F42 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };\n\t\t327C0B8C179A3944007B7F42 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };\n\t\t327C0B8D179A3944007B7F42 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };\n\t\t327C0B8E179A3944007B7F42 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };\n\t\t327C0B91179A3944007B7F42 /* Playground-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = \"Playground-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t327C0B93179A3944007B7F42 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = \"<group>\"; };\n\t\t327C0B95179A3945007B7F42 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\t327C0B97179A3945007B7F42 /* Playground-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"Playground-Prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t327C0B99179A3945007B7F42 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = \"<group>\"; };\n\t\t327C0B9B179A3945007B7F42 /* PlaygroundAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlaygroundAppDelegate.h; sourceTree = \"<group>\"; };\n\t\t327C0B9C179A3945007B7F42 /* PlaygroundAppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlaygroundAppDelegate.mm; sourceTree = \"<group>\"; };\n\t\t327C0B9F179A3945007B7F42 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = \"<group>\"; };\n\t\t327C0BB8179A3B52007B7F42 /* CPFInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPFInterface.h; path = ../../../source/include/CPFInterface.h; sourceTree = \"<group>\"; };\n\t\t327C0BB9179A3B52007B7F42 /* RenderingFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderingFramework.h; path = ../../../source/include/RenderingFramework.h; sourceTree = \"<group>\"; };\n\t\t327C0BBA179A3B52007B7F42 /* encryptFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = encryptFile.h; path = ../../../source/include/encryptFile.h; sourceTree = \"<group>\"; };\n\t\t327C0BBB179A3B52007B7F42 /* KLBPlatformMetricsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KLBPlatformMetricsCommon.h; path = ../../../source/include/KLBPlatformMetricsCommon.h; sourceTree = \"<group>\"; };\n\t\t327C0BBC179A3B52007B7F42 /* CSoundAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSoundAnalysis.h; path = ../../../source/include/CSoundAnalysis.h; sourceTree = \"<group>\"; };\n\t\t327C0BBD179A3B52007B7F42 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mem.h; path = ../../../source/include/mem.h; sourceTree = \"<group>\"; };\n\t\t327C0BBF179A3B52007B7F42 /* BaseType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BaseType.h; path = ../../../include/BaseType.h; sourceTree = \"<group>\"; };\n\t\t327C0BC0179A3B52007B7F42 /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileSystem.h; path = ../../../include/FileSystem.h; sourceTree = \"<group>\"; };\n\t\t327C0BC1179A3B52007B7F42 /* OSWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OSWidget.h; path = ../../../include/OSWidget.h; sourceTree = \"<group>\"; };\n\t\t327C0BC2179A3B52007B7F42 /* assert_klb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = assert_klb.h; path = ../../../include/assert_klb.h; sourceTree = \"<group>\"; };\n\t\t327C0BC3179A3B52007B7F42 /* ITmpFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ITmpFile.h; path = ../../../include/ITmpFile.h; sourceTree = \"<group>\"; };\n\t\t327C0BC4179A3B52007B7F42 /* klb_vararg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = klb_vararg.h; path = ../../../include/klb_vararg.h; sourceTree = \"<group>\"; };\n\t\t327C0BDD179A3E4A007B7F42 /* CKLBNodeVirtualDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBNodeVirtualDocument.cpp; path = ../../../source/Animation/CKLBNodeVirtualDocument.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BDE179A3E4A007B7F42 /* CKLBSplineNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBSplineNode.h; path = ../../../source/Animation/CKLBSplineNode.h; sourceTree = \"<group>\"; };\n\t\t327C0BDF179A3E4A007B7F42 /* CKLBSplineNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBSplineNode.cpp; path = ../../../source/Animation/CKLBSplineNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BE0179A3E4A007B7F42 /* CKLBSWFPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBSWFPlayer.cpp; path = ../../../source/Animation/CKLBSWFPlayer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BE1179A3E4A007B7F42 /* CKLBNodeVirtualDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBNodeVirtualDocument.h; path = ../../../source/Animation/CKLBNodeVirtualDocument.h; sourceTree = \"<group>\"; };\n\t\t327C0BE4179A3E4A007B7F42 /* CKLBScoreNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBScoreNode.cpp; path = ../../../source/Animation/CKLBScoreNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BE5179A3E4A007B7F42 /* CKLBScoreNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBScoreNode.h; path = ../../../source/Animation/CKLBScoreNode.h; sourceTree = \"<group>\"; };\n\t\t327C0BE6179A3E4A007B7F42 /* CKLBSWFPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBSWFPlayer.h; path = ../../../source/Animation/CKLBSWFPlayer.h; sourceTree = \"<group>\"; };\n\t\t327C0BE7179A3E4A007B7F42 /* CKLBSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBSystem.cpp; path = ../../../source/Animation/CKLBSystem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BF0179A3E63007B7F42 /* CKLBTexturePacker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBTexturePacker.cpp; path = ../../../source/Assets/CKLBTexturePacker.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BF1179A3E63007B7F42 /* CKLBTexturePacker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBTexturePacker.h; path = ../../../source/Assets/CKLBTexturePacker.h; sourceTree = \"<group>\"; };\n\t\t327C0BF2179A3E63007B7F42 /* CompositeManagement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompositeManagement.cpp; path = ../../../source/Assets/CompositeManagement.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BF3179A3E63007B7F42 /* TextureManagement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextureManagement.cpp; path = ../../../source/Assets/TextureManagement.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BF4179A3E63007B7F42 /* CKLBAssetManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBAssetManager.cpp; path = ../../../source/Assets/CKLBAssetManager.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BF5179A3E63007B7F42 /* AudioAsset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AudioAsset.cpp; path = ../../../source/Assets/AudioAsset.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BF6179A3E63007B7F42 /* CKLBAsset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBAsset.h; path = ../../../source/Assets/CKLBAsset.h; sourceTree = \"<group>\"; };\n\t\t327C0BF7179A3E63007B7F42 /* CompositeManagement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompositeManagement.h; path = ../../../source/Assets/CompositeManagement.h; sourceTree = \"<group>\"; };\n\t\t327C0BFA179A3E63007B7F42 /* AudioAsset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioAsset.h; path = ../../../source/Assets/AudioAsset.h; sourceTree = \"<group>\"; };\n\t\t327C0BFD179A3E63007B7F42 /* CKLBPropertyBag.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBPropertyBag.cpp; path = ../../../source/Assets/CKLBPropertyBag.cpp; sourceTree = \"<group>\"; };\n\t\t327C0BFE179A3E63007B7F42 /* CKLBPropertyBag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBPropertyBag.h; path = ../../../source/Assets/CKLBPropertyBag.h; sourceTree = \"<group>\"; };\n\t\t327C0C01179A3E63007B7F42 /* NodeAnimationAsset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NodeAnimationAsset.cpp; path = ../../../source/Assets/NodeAnimationAsset.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C02179A3E63007B7F42 /* NodeAnimationAsset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NodeAnimationAsset.h; path = ../../../source/Assets/NodeAnimationAsset.h; sourceTree = \"<group>\"; };\n\t\t327C0C03179A3E63007B7F42 /* TextureManagement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextureManagement.h; path = ../../../source/Assets/TextureManagement.h; sourceTree = \"<group>\"; };\n\t\t327C0C0E179A3E7A007B7F42 /* CKLBTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBTask.cpp; path = ../../../source/Core/CKLBTask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C0F179A3E7A007B7F42 /* CKLBTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBTask.h; path = ../../../source/Core/CKLBTask.h; sourceTree = \"<group>\"; };\n\t\t327C0C10179A3E7A007B7F42 /* ArrayAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArrayAllocator.h; path = ../../../source/Core/ArrayAllocator.h; sourceTree = \"<group>\"; };\n\t\t327C0C11179A3E7A007B7F42 /* CKLBAsyncFilecopy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBAsyncFilecopy.cpp; path = ../../../source/Core/CKLBAsyncFilecopy.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C12179A3E7A007B7F42 /* CKLBGameApplication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBGameApplication.cpp; path = ../../../source/Core/CKLBGameApplication.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C13179A3E7A007B7F42 /* CKLBGameApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBGameApplication.h; path = ../../../source/Core/CKLBGameApplication.h; sourceTree = \"<group>\"; };\n\t\t327C0C14179A3E7A007B7F42 /* CKLBLuaEnv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaEnv.cpp; path = ../../../source/Core/CKLBLuaEnv.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C15179A3E7A007B7F42 /* CKLBUITask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUITask.cpp; path = ../../../source/Core/CKLBUITask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C16179A3E7A007B7F42 /* encryptFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = encryptFile.cpp; path = ../../../source/Core/encryptFile.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C17179A3E7A007B7F42 /* CKLBAsyncFilecopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBAsyncFilecopy.h; path = ../../../source/Core/CKLBAsyncFilecopy.h; sourceTree = \"<group>\"; };\n\t\t327C0C18179A3E7A007B7F42 /* CKLBScriptEnv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBScriptEnv.h; path = ../../../source/Core/CKLBScriptEnv.h; sourceTree = \"<group>\"; };\n\t\t327C0C19179A3E7A007B7F42 /* CLuaState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CLuaState.h; path = ../../../source/Core/CLuaState.h; sourceTree = \"<group>\"; };\n\t\t327C0C1A179A3E7A007B7F42 /* CKLBDebugger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDebugger.cpp; path = ../../../source/Core/CKLBDebugger.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C1B179A3E7A007B7F42 /* CKLBGameApplicationDebugModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBGameApplicationDebugModule.cpp; path = ../../../source/Core/CKLBGameApplicationDebugModule.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C1C179A3E7A007B7F42 /* CKLBIntervalTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBIntervalTimer.cpp; path = ../../../source/Core/CKLBIntervalTimer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C1D179A3E7A007B7F42 /* CKLBLuaPropTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaPropTask.cpp; path = ../../../source/Core/CKLBLuaPropTask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C1E179A3E7A007B7F42 /* CKLBUtility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUtility.cpp; path = ../../../source/Core/CKLBUtility.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C1F179A3E7A007B7F42 /* CKLBDataHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDataHandler.cpp; path = ../../../source/Core/CKLBDataHandler.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C20179A3E7A007B7F42 /* Dictionnary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Dictionnary.cpp; path = ../../../source/Core/Dictionnary.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C21179A3E7A007B7F42 /* CKLBBinArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBBinArray.cpp; path = ../../../source/Core/CKLBBinArray.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C22179A3E7A007B7F42 /* CKLBContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBContext.cpp; path = ../../../source/Core/CKLBContext.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C23179A3E7A007B7F42 /* CKLBLuaTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaTask.h; path = ../../../source/Core/CKLBLuaTask.h; sourceTree = \"<group>\"; };\n\t\t327C0C24179A3E7A007B7F42 /* CKLBUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUtility.h; path = ../../../source/Core/CKLBUtility.h; sourceTree = \"<group>\"; };\n\t\t327C0C25179A3E7A007B7F42 /* DebugAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DebugAlloc.cpp; path = ../../../source/Core/DebugAlloc.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C26179A3E7A007B7F42 /* DebugTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DebugTracker.cpp; path = ../../../source/Core/DebugTracker.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C27179A3E7A007B7F42 /* DebugTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugTracker.h; path = ../../../source/Core/DebugTracker.h; sourceTree = \"<group>\"; };\n\t\t327C0C28179A3E7A007B7F42 /* CKLBAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBAction.h; path = ../../../source/Core/CKLBAction.h; sourceTree = \"<group>\"; };\n\t\t327C0C29179A3E7A007B7F42 /* CKLBAppProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBAppProperty.cpp; path = ../../../source/Core/CKLBAppProperty.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C2A179A3E7A007B7F42 /* CKLBAppProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBAppProperty.h; path = ../../../source/Core/CKLBAppProperty.h; sourceTree = \"<group>\"; };\n\t\t327C0C2B179A3E7A007B7F42 /* CKLBAsyncLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBAsyncLoader.cpp; path = ../../../source/Core/CKLBAsyncLoader.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C2C179A3E7A007B7F42 /* CKLBAsyncLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBAsyncLoader.h; path = ../../../source/Core/CKLBAsyncLoader.h; sourceTree = \"<group>\"; };\n\t\t327C0C2D179A3E7A007B7F42 /* CKLBBinArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBBinArray.h; path = ../../../source/Core/CKLBBinArray.h; sourceTree = \"<group>\"; };\n\t\t327C0C2F179A3E7A007B7F42 /* CKLBDataHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDataHandler.h; path = ../../../source/Core/CKLBDataHandler.h; sourceTree = \"<group>\"; };\n\t\t327C0C30179A3E7A007B7F42 /* CKLBDebugger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDebugger.h; path = ../../../source/Core/CKLBDebugger.h; sourceTree = \"<group>\"; };\n\t\t327C0C33179A3E7A007B7F42 /* CKLBGenericTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBGenericTask.cpp; path = ../../../source/Core/CKLBGenericTask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C34179A3E7A007B7F42 /* CKLBGenericTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBGenericTask.h; path = ../../../source/Core/CKLBGenericTask.h; sourceTree = \"<group>\"; };\n\t\t327C0C35179A3E7A007B7F42 /* CKLBIntervalTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBIntervalTimer.h; path = ../../../source/Core/CKLBIntervalTimer.h; sourceTree = \"<group>\"; };\n\t\t327C0C36179A3E7A007B7F42 /* CKLBLibRegistrator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLibRegistrator.cpp; path = ../../../source/Core/CKLBLibRegistrator.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C37179A3E7A007B7F42 /* CKLBLibRegistrator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLibRegistrator.h; path = ../../../source/Core/CKLBLibRegistrator.h; sourceTree = \"<group>\"; };\n\t\t327C0C38179A3E7A007B7F42 /* CKLBLifeCtrlTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLifeCtrlTask.cpp; path = ../../../source/Core/CKLBLifeCtrlTask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C39179A3E7A007B7F42 /* CKLBLifeCtrlTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLifeCtrlTask.h; path = ../../../source/Core/CKLBLifeCtrlTask.h; sourceTree = \"<group>\"; };\n\t\t327C0C3A179A3E7A007B7F42 /* CKLBLuaEnv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaEnv.h; path = ../../../source/Core/CKLBLuaEnv.h; sourceTree = \"<group>\"; };\n\t\t327C0C3B179A3E7A007B7F42 /* CKLBLuaPropTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaPropTask.h; path = ../../../source/Core/CKLBLuaPropTask.h; sourceTree = \"<group>\"; };\n\t\t327C0C3C179A3E7A007B7F42 /* CKLBLuaTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaTask.cpp; path = ../../../source/Core/CKLBLuaTask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C3D179A3E7A007B7F42 /* CKLBObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBObject.cpp; path = ../../../source/Core/CKLBObject.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C3E179A3E7A007B7F42 /* CKLBObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBObject.h; path = ../../../source/Core/CKLBObject.h; sourceTree = \"<group>\"; };\n\t\t327C0C3F179A3E7A007B7F42 /* CKLBPauseCtrl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBPauseCtrl.cpp; path = ../../../source/Core/CKLBPauseCtrl.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C40179A3E7A007B7F42 /* CKLBPauseCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBPauseCtrl.h; path = ../../../source/Core/CKLBPauseCtrl.h; sourceTree = \"<group>\"; };\n\t\t327C0C42179A3E7A007B7F42 /* CKLBTextTempBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBTextTempBuffer.cpp; path = ../../../source/Core/CKLBTextTempBuffer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C43179A3E7A007B7F42 /* CKLBTextTempBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBTextTempBuffer.h; path = ../../../source/Core/CKLBTextTempBuffer.h; sourceTree = \"<group>\"; };\n\t\t327C0C44179A3E7A007B7F42 /* CKLBUITask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUITask.h; path = ../../../source/Core/CKLBUITask.h; sourceTree = \"<group>\"; };\n\t\t327C0C45179A3E7A007B7F42 /* CLuaState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CLuaState.cpp; path = ../../../source/Core/CLuaState.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C46179A3E7A007B7F42 /* CPFInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CPFInterface.cpp; path = ../../../source/Core/CPFInterface.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C47179A3E7A007B7F42 /* DebugAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugAlloc.h; path = ../../../source/Core/DebugAlloc.h; sourceTree = \"<group>\"; };\n\t\t327C0C48179A3E7A007B7F42 /* Dictionnary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Dictionnary.h; path = ../../../source/Core/Dictionnary.h; sourceTree = \"<group>\"; };\n\t\t327C0C49179A3E7A007B7F42 /* ITmpFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ITmpFile.cpp; path = ../../../source/Core/ITmpFile.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C4A179A3E7A007B7F42 /* Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Message.h; path = ../../../source/Core/Message.h; sourceTree = \"<group>\"; };\n\t\t327C0C6D179A3E98007B7F42 /* CKLBDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDatabase.cpp; path = ../../../source/Database/CKLBDatabase.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C6E179A3E98007B7F42 /* DataSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataSet.h; path = ../../../source/Database/DataSet.h; sourceTree = \"<group>\"; };\n\t\t327C0C6F179A3E98007B7F42 /* CKLBLuaDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaDB.cpp; path = ../../../source/Database/CKLBLuaDB.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C70179A3E98007B7F42 /* CKLBDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDatabase.h; path = ../../../source/Database/CKLBDatabase.h; sourceTree = \"<group>\"; };\n\t\t327C0C71179A3E98007B7F42 /* CKLBLuaDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaDB.h; path = ../../../source/Database/CKLBLuaDB.h; sourceTree = \"<group>\"; };\n\t\t327C0C72179A3E98007B7F42 /* CKLBLanguageDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLanguageDatabase.cpp; path = ../../../source/Database/CKLBLanguageDatabase.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C73179A3E98007B7F42 /* CKLBLanguageDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLanguageDatabase.h; path = ../../../source/Database/CKLBLanguageDatabase.h; sourceTree = \"<group>\"; };\n\t\t327C0C74179A3E98007B7F42 /* DataSet_JSonDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataSet_JSonDB.cpp; path = ../../../source/Database/DataSet_JSonDB.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C75179A3E98007B7F42 /* DataSet_JSonDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataSet_JSonDB.h; path = ../../../source/Database/DataSet_JSonDB.h; sourceTree = \"<group>\"; };\n\t\t327C0C7A179A3EAF007B7F42 /* CKLBStoreService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBStoreService.cpp; path = ../../../source/HTTP/CKLBStoreService.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C7B179A3EAF007B7F42 /* CKLBStoreService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBStoreService.h; path = ../../../source/HTTP/CKLBStoreService.h; sourceTree = \"<group>\"; };\n\t\t327C0C7C179A3EAF007B7F42 /* CKLBNetAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBNetAPI.cpp; path = ../../../source/HTTP/CKLBNetAPI.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C7D179A3EAF007B7F42 /* CKLBNetAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBNetAPI.h; path = ../../../source/HTTP/CKLBNetAPI.h; sourceTree = \"<group>\"; };\n\t\t327C0C7E179A3EAF007B7F42 /* MultithreadedNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MultithreadedNetwork.h; path = ../../../source/HTTP/MultithreadedNetwork.h; sourceTree = \"<group>\"; };\n\t\t327C0C7F179A3EAF007B7F42 /* CKLBHTTPInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBHTTPInterface.cpp; path = ../../../source/HTTP/CKLBHTTPInterface.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C80179A3EAF007B7F42 /* CKLBHTTPInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBHTTPInterface.h; path = ../../../source/HTTP/CKLBHTTPInterface.h; sourceTree = \"<group>\"; };\n\t\t327C0C81179A3EAF007B7F42 /* CKLBUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUpdate.cpp; path = ../../../source/HTTP/CKLBUpdate.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C82179A3EAF007B7F42 /* CUnZip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CUnZip.cpp; path = ../../../source/HTTP/CUnZip.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C83179A3EAF007B7F42 /* CKLBJsonItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBJsonItem.cpp; path = ../../../source/HTTP/CKLBJsonItem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C84179A3EAF007B7F42 /* MultithreadedNetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MultithreadedNetwork.cpp; path = ../../../source/HTTP/MultithreadedNetwork.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C85179A3EAF007B7F42 /* CKLBNetAPIKeyChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBNetAPIKeyChain.h; path = ../../../source/HTTP/CKLBNetAPIKeyChain.h; sourceTree = \"<group>\"; };\n\t\t327C0C86179A3EAF007B7F42 /* CKLBUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUpdate.h; path = ../../../source/HTTP/CKLBUpdate.h; sourceTree = \"<group>\"; };\n\t\t327C0C87179A3EAF007B7F42 /* CKLBJsonItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBJsonItem.h; path = ../../../source/HTTP/CKLBJsonItem.h; sourceTree = \"<group>\"; };\n\t\t327C0C88179A3EAF007B7F42 /* CKLBNetAPIKeyChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBNetAPIKeyChain.cpp; path = ../../../source/HTTP/CKLBNetAPIKeyChain.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C89179A3EAF007B7F42 /* CUnZip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CUnZip.h; path = ../../../source/HTTP/CUnZip.h; sourceTree = \"<group>\"; };\n\t\t327C0C92179A3ECB007B7F42 /* CKLBLuaLibAPP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibAPP.cpp; path = ../../../source/LuaLib/CKLBLuaLibAPP.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C93179A3ECB007B7F42 /* CKLBLuaLibENG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibENG.cpp; path = ../../../source/LuaLib/CKLBLuaLibENG.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C94179A3ECB007B7F42 /* CKLBLuaLibENG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibENG.h; path = ../../../source/LuaLib/CKLBLuaLibENG.h; sourceTree = \"<group>\"; };\n\t\t327C0C95179A3ECB007B7F42 /* CKLBLuaLibFONT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibFONT.cpp; path = ../../../source/LuaLib/CKLBLuaLibFONT.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C96179A3ECB007B7F42 /* CKLBLuaLibFONT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibFONT.h; path = ../../../source/LuaLib/CKLBLuaLibFONT.h; sourceTree = \"<group>\"; };\n\t\t327C0C97179A3ECB007B7F42 /* CKLBLuaLibHASH.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibHASH.cpp; path = ../../../source/LuaLib/CKLBLuaLibHASH.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C98179A3ECB007B7F42 /* CKLBLuaLibHASH.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibHASH.h; path = ../../../source/LuaLib/CKLBLuaLibHASH.h; sourceTree = \"<group>\"; };\n\t\t327C0C99179A3ECB007B7F42 /* CKLBLuaLibSOUND.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibSOUND.cpp; path = ../../../source/LuaLib/CKLBLuaLibSOUND.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C9A179A3ECB007B7F42 /* CKLBLuaLibSOUND.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibSOUND.h; path = ../../../source/LuaLib/CKLBLuaLibSOUND.h; sourceTree = \"<group>\"; };\n\t\t327C0C9B179A3ECB007B7F42 /* CKLBLuaLibGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibGL.cpp; path = ../../../source/LuaLib/CKLBLuaLibGL.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C9C179A3ECB007B7F42 /* CKLBLuaLibDATA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibDATA.cpp; path = ../../../source/LuaLib/CKLBLuaLibDATA.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C9D179A3ECB007B7F42 /* CKLBLuaLibMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibMatrix.cpp; path = ../../../source/LuaLib/CKLBLuaLibMatrix.cpp; sourceTree = \"<group>\"; };\n\t\t327C0C9F179A3ECB007B7F42 /* ILuaFuncLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ILuaFuncLib.cpp; path = ../../../source/LuaLib/ILuaFuncLib.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CA0179A3ECB007B7F42 /* CKLBLuaLibCONV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibCONV.cpp; path = ../../../source/LuaLib/CKLBLuaLibCONV.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CA1179A3ECB007B7F42 /* CKLBLuaLibGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibGL.h; path = ../../../source/LuaLib/CKLBLuaLibGL.h; sourceTree = \"<group>\"; };\n\t\t327C0CA2179A3ECB007B7F42 /* CKLBLuaLibKEY.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibKEY.cpp; path = ../../../source/LuaLib/CKLBLuaLibKEY.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CA3179A3ECB007B7F42 /* CKLBLuaLibTASK.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibTASK.cpp; path = ../../../source/LuaLib/CKLBLuaLibTASK.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CA4179A3ECB007B7F42 /* CKLBLuaLibASSET.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibASSET.cpp; path = ../../../source/LuaLib/CKLBLuaLibASSET.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CA5179A3ECB007B7F42 /* CKLBLuaLibASSET.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibASSET.h; path = ../../../source/LuaLib/CKLBLuaLibASSET.h; sourceTree = \"<group>\"; };\n\t\t327C0CA6179A3ECB007B7F42 /* CKLBLuaConst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaConst.cpp; path = ../../../source/LuaLib/CKLBLuaConst.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CA7179A3ECB007B7F42 /* CKLBLuaConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaConst.h; path = ../../../source/LuaLib/CKLBLuaConst.h; sourceTree = \"<group>\"; };\n\t\t327C0CA9179A3ECB007B7F42 /* CKLBLuaLibAPP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibAPP.h; path = ../../../source/LuaLib/CKLBLuaLibAPP.h; sourceTree = \"<group>\"; };\n\t\t327C0CAA179A3ECB007B7F42 /* CKLBLuaLibBIN.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibBIN.cpp; path = ../../../source/LuaLib/CKLBLuaLibBIN.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CAB179A3ECB007B7F42 /* CKLBLuaLibBIN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibBIN.h; path = ../../../source/LuaLib/CKLBLuaLibBIN.h; sourceTree = \"<group>\"; };\n\t\t327C0CAC179A3ECB007B7F42 /* CKLBLuaLibCONV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibCONV.h; path = ../../../source/LuaLib/CKLBLuaLibCONV.h; sourceTree = \"<group>\"; };\n\t\t327C0CAD179A3ECB007B7F42 /* CKLBLuaLibDATA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibDATA.h; path = ../../../source/LuaLib/CKLBLuaLibDATA.h; sourceTree = \"<group>\"; };\n\t\t327C0CAE179A3ECB007B7F42 /* CKLBLuaLibDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibDB.cpp; path = ../../../source/LuaLib/CKLBLuaLibDB.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CAF179A3ECB007B7F42 /* CKLBLuaLibDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibDB.h; path = ../../../source/LuaLib/CKLBLuaLibDB.h; sourceTree = \"<group>\"; };\n\t\t327C0CB0179A3ECB007B7F42 /* CKLBLuaLibDEBUG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibDEBUG.cpp; path = ../../../source/LuaLib/CKLBLuaLibDEBUG.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CB1179A3ECB007B7F42 /* CKLBLuaLibDEBUG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibDEBUG.h; path = ../../../source/LuaLib/CKLBLuaLibDEBUG.h; sourceTree = \"<group>\"; };\n\t\t327C0CB2179A3ECB007B7F42 /* CKLBLuaLibKEY.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibKEY.h; path = ../../../source/LuaLib/CKLBLuaLibKEY.h; sourceTree = \"<group>\"; };\n\t\t327C0CB3179A3ECB007B7F42 /* CKLBLuaLibLANG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibLANG.cpp; path = ../../../source/LuaLib/CKLBLuaLibLANG.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CB4179A3ECB007B7F42 /* CKLBLuaLibLANG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibLANG.h; path = ../../../source/LuaLib/CKLBLuaLibLANG.h; sourceTree = \"<group>\"; };\n\t\t327C0CB5179A3ECB007B7F42 /* CKLBLuaLibMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibMatrix.h; path = ../../../source/LuaLib/CKLBLuaLibMatrix.h; sourceTree = \"<group>\"; };\n\t\t327C0CB6179A3ECB007B7F42 /* CKLBLuaLibRES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibRES.cpp; path = ../../../source/LuaLib/CKLBLuaLibRES.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CB7179A3ECB007B7F42 /* CKLBLuaLibRES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibRES.h; path = ../../../source/LuaLib/CKLBLuaLibRES.h; sourceTree = \"<group>\"; };\n\t\t327C0CB8179A3ECB007B7F42 /* CKLBLuaLibTASK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibTASK.h; path = ../../../source/LuaLib/CKLBLuaLibTASK.h; sourceTree = \"<group>\"; };\n\t\t327C0CB9179A3ECB007B7F42 /* CKLBLuaLibUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaLibUI.cpp; path = ../../../source/LuaLib/CKLBLuaLibUI.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CBA179A3ECB007B7F42 /* CKLBLuaLibUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaLibUI.h; path = ../../../source/LuaLib/CKLBLuaLibUI.h; sourceTree = \"<group>\"; };\n\t\t327C0CBB179A3ECB007B7F42 /* ILuaFuncLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILuaFuncLib.h; path = ../../../source/LuaLib/ILuaFuncLib.h; sourceTree = \"<group>\"; };\n\t\t327C0CD1179A3F34007B7F42 /* CKLBRenderingManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBRenderingManager.cpp; path = ../../../source/Rendering/CKLBRenderingManager.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD2179A3F34007B7F42 /* CRenderingManager_GL1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CRenderingManager_GL1.cpp; path = ../../../source/Rendering/CRenderingManager_GL1.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD3179A3F34007B7F42 /* CRenderingManager_GL2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CRenderingManager_GL2.cpp; path = ../../../source/Rendering/CRenderingManager_GL2.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD4179A3F34007B7F42 /* CRenderingManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CRenderingManager.cpp; path = ../../../source/Rendering/CRenderingManager.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD5179A3F34007B7F42 /* CTextureUsage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CTextureUsage.cpp; path = ../../../source/Rendering/CTextureUsage.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD6179A3F34007B7F42 /* CBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CBuffer.cpp; path = ../../../source/Rendering/CBuffer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD7179A3F34007B7F42 /* CIndexBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CIndexBuffer.cpp; path = ../../../source/Rendering/CIndexBuffer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CD8179A3F34007B7F42 /* CKLBRendering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBRendering.h; path = ../../../source/Rendering/CKLBRendering.h; sourceTree = \"<group>\"; };\n\t\t327C0CD9179A3F34007B7F42 /* CTextureBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CTextureBase.cpp; path = ../../../source/Rendering/CTextureBase.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CDA179A3F34007B7F42 /* glWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glWrapper.h; path = ../../../source/Rendering/glWrapper.h; sourceTree = \"<group>\"; };\n\t\t327C0CDB179A3F34007B7F42 /* glWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glWrapper.cpp; path = ../../../source/Rendering/glWrapper.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CDC179A3F34007B7F42 /* CFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CFrame.cpp; path = ../../../source/Rendering/CFrame.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CDD179A3F34007B7F42 /* CImageBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CImageBuffer.cpp; path = ../../../source/Rendering/CImageBuffer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CDE179A3F34007B7F42 /* CKLBCanvasSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBCanvasSprite.cpp; path = ../../../source/Rendering/CKLBCanvasSprite.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CDF179A3F34007B7F42 /* CKLBCanvasSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBCanvasSprite.h; path = ../../../source/Rendering/CKLBCanvasSprite.h; sourceTree = \"<group>\"; };\n\t\t327C0CE0179A3F34007B7F42 /* CKLBSprite3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBSprite3D.cpp; path = ../../../source/Rendering/CKLBSprite3D.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CE1179A3F34007B7F42 /* CKLBSprite3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBSprite3D.h; path = ../../../source/Rendering/CKLBSprite3D.h; sourceTree = \"<group>\"; };\n\t\t327C0CE2179A3F34007B7F42 /* CShaderSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CShaderSet.cpp; path = ../../../source/Rendering/CShaderSet.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CE3179A3F34007B7F42 /* CShaderSetInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CShaderSetInstance.cpp; path = ../../../source/Rendering/CShaderSetInstance.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CE4179A3F34007B7F42 /* CTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CTexture.cpp; path = ../../../source/Rendering/CTexture.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CE6179A3F34007B7F42 /* shaderSource.inl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = shaderSource.inl; path = ../../../source/Rendering/shaderSource.inl; sourceTree = \"<group>\"; };\n\t\t327C0CF9179A3F4D007B7F42 /* CKLBNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBNode.cpp; path = ../../../source/SceneGraph/CKLBNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CFA179A3F4D007B7F42 /* CKLBNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBNode.h; path = ../../../source/SceneGraph/CKLBNode.h; sourceTree = \"<group>\"; };\n\t\t327C0CFC179A3F76007B7F42 /* CSoundAnalysisMP3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSoundAnalysisMP3.cpp; path = ../../../source/Sound/CSoundAnalysisMP3.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CFD179A3F76007B7F42 /* CSoundAnalysis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSoundAnalysis.cpp; path = ../../../source/Sound/CSoundAnalysis.cpp; sourceTree = \"<group>\"; };\n\t\t327C0CFE179A3F76007B7F42 /* CSoundAnalysisMP3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSoundAnalysisMP3.h; path = ../../../source/Sound/CSoundAnalysisMP3.h; sourceTree = \"<group>\"; };\n\t\t327C0D02179A408E007B7F42 /* CKLBScriptEnv_forLUA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBScriptEnv_forLUA.cpp; path = ../../../source/Scripting/CKLBScriptEnv_forLUA.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D04179A41AE007B7F42 /* CKLBDrawTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDrawTask.cpp; path = ../../../source/SystemTask/CKLBDrawTask.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D05179A41AE007B7F42 /* CKLBDebugMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDebugMenu.cpp; path = ../../../source/SystemTask/CKLBDebugMenu.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D06179A41AE007B7F42 /* CKLBDebugMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDebugMenu.h; path = ../../../source/SystemTask/CKLBDebugMenu.h; sourceTree = \"<group>\"; };\n\t\t327C0D07179A41AE007B7F42 /* CKLBTouchPad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBTouchPad.cpp; path = ../../../source/SystemTask/CKLBTouchPad.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D08179A41AE007B7F42 /* CKLBTouchPad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBTouchPad.h; path = ../../../source/SystemTask/CKLBTouchPad.h; sourceTree = \"<group>\"; };\n\t\t327C0D09179A41AE007B7F42 /* CKLBTouchEventUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBTouchEventUI.cpp; path = ../../../source/SystemTask/CKLBTouchEventUI.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D0A179A41AE007B7F42 /* CKLBDrawTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDrawTask.h; path = ../../../source/SystemTask/CKLBDrawTask.h; sourceTree = \"<group>\"; };\n\t\t327C0D0B179A41AE007B7F42 /* CKLBOSCtrlEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBOSCtrlEvent.cpp; path = ../../../source/SystemTask/CKLBOSCtrlEvent.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D0C179A41AE007B7F42 /* CKLBOSCtrlEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBOSCtrlEvent.h; path = ../../../source/SystemTask/CKLBOSCtrlEvent.h; sourceTree = \"<group>\"; };\n\t\t327C0D0D179A41AE007B7F42 /* CKLBLuaScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLuaScript.cpp; path = ../../../source/SystemTask/CKLBLuaScript.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D0E179A41AE007B7F42 /* CKLBLuaScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLuaScript.h; path = ../../../source/SystemTask/CKLBLuaScript.h; sourceTree = \"<group>\"; };\n\t\t327C0D0F179A41AE007B7F42 /* CKLBTouchEventUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBTouchEventUI.h; path = ../../../source/SystemTask/CKLBTouchEventUI.h; sourceTree = \"<group>\"; };\n\t\t327C0D16179A41BE007B7F42 /* CKLBUIVirtualDoc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIVirtualDoc.cpp; path = ../../../source/UISystem/CKLBUIVirtualDoc.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D17179A41BE007B7F42 /* CKLBUIList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIList.cpp; path = ../../../source/UISystem/CKLBUIList.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D18179A41BE007B7F42 /* CKLBScrMgrDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBScrMgrDefault.cpp; path = ../../../source/UISystem/CKLBScrMgrDefault.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D19179A41BE007B7F42 /* CKLBScrMgrDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBScrMgrDefault.h; path = ../../../source/UISystem/CKLBScrMgrDefault.h; sourceTree = \"<group>\"; };\n\t\t327C0D1A179A41BE007B7F42 /* CKLBScrMgrPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBScrMgrPage.cpp; path = ../../../source/UISystem/CKLBScrMgrPage.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D1B179A41BE007B7F42 /* CKLBScrMgrPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBScrMgrPage.h; path = ../../../source/UISystem/CKLBScrMgrPage.h; sourceTree = \"<group>\"; };\n\t\t327C0D1C179A41BE007B7F42 /* CKLBUICanvas.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUICanvas.cpp; path = ../../../source/UISystem/CKLBUICanvas.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D1D179A41BE007B7F42 /* CKLBUIDragIcon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIDragIcon.cpp; path = ../../../source/UISystem/CKLBUIDragIcon.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D1E179A41BE007B7F42 /* CKLBUIFreeVertItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIFreeVertItem.cpp; path = ../../../source/UISystem/CKLBUIFreeVertItem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D1F179A41BE007B7F42 /* CKLBUIFreeVertItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIFreeVertItem.h; path = ../../../source/UISystem/CKLBUIFreeVertItem.h; sourceTree = \"<group>\"; };\n\t\t327C0D20179A41BE007B7F42 /* CKLBUIList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIList.h; path = ../../../source/UISystem/CKLBUIList.h; sourceTree = \"<group>\"; };\n\t\t327C0D21179A41BE007B7F42 /* CKLBUIProgressBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIProgressBar.cpp; path = ../../../source/UISystem/CKLBUIProgressBar.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D22179A41BE007B7F42 /* CKLBUIVariableItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIVariableItem.cpp; path = ../../../source/UISystem/CKLBUIVariableItem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D23179A41BE007B7F42 /* CKLBScrMgrSolid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBScrMgrSolid.cpp; path = ../../../source/UISystem/CKLBScrMgrSolid.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D24179A41BE007B7F42 /* CKLBScrMgrSolid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBScrMgrSolid.h; path = ../../../source/UISystem/CKLBScrMgrSolid.h; sourceTree = \"<group>\"; };\n\t\t327C0D25179A41BE007B7F42 /* CKLBScrollBarIF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBScrollBarIF.cpp; path = ../../../source/UISystem/CKLBScrollBarIF.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D26179A41BE007B7F42 /* CKLBScrollBarIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBScrollBarIF.h; path = ../../../source/UISystem/CKLBScrollBarIF.h; sourceTree = \"<group>\"; };\n\t\t327C0D27179A41BE007B7F42 /* CKLBLabelNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBLabelNode.cpp; path = ../../../source/UISystem/CKLBLabelNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D28179A41BE007B7F42 /* CKLBMovieNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBMovieNode.cpp; path = ../../../source/UISystem/CKLBMovieNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D29179A41BE007B7F42 /* CKLBTextInputNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBTextInputNode.cpp; path = ../../../source/UISystem/CKLBTextInputNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D2A179A41BE007B7F42 /* CKLBUIDebugItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIDebugItem.cpp; path = ../../../source/UISystem/CKLBUIDebugItem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D2B179A41BE007B7F42 /* CKLBUISystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUISystem.h; path = ../../../source/UISystem/CKLBUISystem.h; sourceTree = \"<group>\"; };\n\t\t327C0D2C179A41BE007B7F42 /* CKLBUIWebArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIWebArea.cpp; path = ../../../source/UISystem/CKLBUIWebArea.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D2D179A41BE007B7F42 /* CKLBWebViewNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBWebViewNode.cpp; path = ../../../source/UISystem/CKLBWebViewNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D2E179A41BE007B7F42 /* CKLBUIClip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIClip.cpp; path = ../../../source/UISystem/CKLBUIClip.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D2F179A41BE007B7F42 /* CKLBUIMultiImgItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIMultiImgItem.cpp; path = ../../../source/UISystem/CKLBUIMultiImgItem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D30179A41BE007B7F42 /* CKLBUISWFPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUISWFPlayer.cpp; path = ../../../source/UISystem/CKLBUISWFPlayer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D31179A41BE007B7F42 /* CKLBUISystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUISystem.cpp; path = ../../../source/UISystem/CKLBUISystem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D32179A41BE007B7F42 /* CKLBUITouchPad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUITouchPad.cpp; path = ../../../source/UISystem/CKLBUITouchPad.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D33179A41BE007B7F42 /* CKLBUIForm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIForm.cpp; path = ../../../source/UISystem/CKLBUIForm.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D34179A41BE007B7F42 /* CKLBUILabel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUILabel.cpp; path = ../../../source/UISystem/CKLBUILabel.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D35179A41BE007B7F42 /* CKLBUISWFPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUISWFPlayer.h; path = ../../../source/UISystem/CKLBUISWFPlayer.h; sourceTree = \"<group>\"; };\n\t\t327C0D36179A41BE007B7F42 /* CKLBUIVariableItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIVariableItem.h; path = ../../../source/UISystem/CKLBUIVariableItem.h; sourceTree = \"<group>\"; };\n\t\t327C0D37179A41BE007B7F42 /* CKLBLabelNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBLabelNode.h; path = ../../../source/UISystem/CKLBLabelNode.h; sourceTree = \"<group>\"; };\n\t\t327C0D38179A41BE007B7F42 /* CKLBUIVirtualDoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIVirtualDoc.h; path = ../../../source/UISystem/CKLBUIVirtualDoc.h; sourceTree = \"<group>\"; };\n\t\t327C0D39179A41BE007B7F42 /* CKLBUIControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIControl.cpp; path = ../../../source/UISystem/CKLBUIControl.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D3A179A41BE007B7F42 /* CKLBUITextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUITextInput.h; path = ../../../source/UISystem/CKLBUITextInput.h; sourceTree = \"<group>\"; };\n\t\t327C0D3B179A41BE007B7F42 /* CKLBTextInputNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBTextInputNode.h; path = ../../../source/UISystem/CKLBTextInputNode.h; sourceTree = \"<group>\"; };\n\t\t327C0D3C179A41BE007B7F42 /* CKLBUIScale9.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIScale9.cpp; path = ../../../source/UISystem/CKLBUIScale9.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D3D179A41BE007B7F42 /* CKLBUITextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUITextInput.cpp; path = ../../../source/UISystem/CKLBUITextInput.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D3E179A41BE007B7F42 /* CKLBActivityIndicatorNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBActivityIndicatorNode.cpp; path = ../../../source/UISystem/CKLBActivityIndicatorNode.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D3F179A41BE007B7F42 /* CKLBActivityIndicatorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBActivityIndicatorNode.h; path = ../../../source/UISystem/CKLBActivityIndicatorNode.h; sourceTree = \"<group>\"; };\n\t\t327C0D40179A41BE007B7F42 /* CKLBDragCallbackIF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBDragCallbackIF.cpp; path = ../../../source/UISystem/CKLBDragCallbackIF.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D41179A41BE007B7F42 /* CKLBDragCallbackIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBDragCallbackIF.h; path = ../../../source/UISystem/CKLBDragCallbackIF.h; sourceTree = \"<group>\"; };\n\t\t327C0D42179A41BE007B7F42 /* CKLBFormGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBFormGroup.cpp; path = ../../../source/UISystem/CKLBFormGroup.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D43179A41BE007B7F42 /* CKLBFormGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBFormGroup.h; path = ../../../source/UISystem/CKLBFormGroup.h; sourceTree = \"<group>\"; };\n\t\t327C0D44179A41BE007B7F42 /* CKLBFormIF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBFormIF.cpp; path = ../../../source/UISystem/CKLBFormIF.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D45179A41BE007B7F42 /* CKLBFormIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBFormIF.h; path = ../../../source/UISystem/CKLBFormIF.h; sourceTree = \"<group>\"; };\n\t\t327C0D46179A41BE007B7F42 /* CKLBModalStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBModalStack.cpp; path = ../../../source/UISystem/CKLBModalStack.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D47179A41BE007B7F42 /* CKLBModalStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBModalStack.h; path = ../../../source/UISystem/CKLBModalStack.h; sourceTree = \"<group>\"; };\n\t\t327C0D48179A41BE007B7F42 /* CKLBMovieNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBMovieNode.h; path = ../../../source/UISystem/CKLBMovieNode.h; sourceTree = \"<group>\"; };\n\t\t327C0D49179A41BE007B7F42 /* CKLBNodeAnimPack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBNodeAnimPack.cpp; path = ../../../source/UISystem/CKLBNodeAnimPack.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D4A179A41BE007B7F42 /* CKLBNodeAnimPack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBNodeAnimPack.h; path = ../../../source/UISystem/CKLBNodeAnimPack.h; sourceTree = \"<group>\"; };\n\t\t327C0D4B179A41BE007B7F42 /* CKLBUIActivityIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIActivityIndicator.cpp; path = ../../../source/UISystem/CKLBUIActivityIndicator.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D4C179A41BE007B7F42 /* CKLBUIActivityIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIActivityIndicator.h; path = ../../../source/UISystem/CKLBUIActivityIndicator.h; sourceTree = \"<group>\"; };\n\t\t327C0D4D179A41BE007B7F42 /* CKLBUICanvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUICanvas.h; path = ../../../source/UISystem/CKLBUICanvas.h; sourceTree = \"<group>\"; };\n\t\t327C0D50179A41BE007B7F42 /* CKLBUIClip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIClip.h; path = ../../../source/UISystem/CKLBUIClip.h; sourceTree = \"<group>\"; };\n\t\t327C0D51179A41BE007B7F42 /* CKLBUIControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIControl.h; path = ../../../source/UISystem/CKLBUIControl.h; sourceTree = \"<group>\"; };\n\t\t327C0D52179A41BE007B7F42 /* CKLBUIDebugItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIDebugItem.h; path = ../../../source/UISystem/CKLBUIDebugItem.h; sourceTree = \"<group>\"; };\n\t\t327C0D53179A41BE007B7F42 /* CKLBUIDragIcon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIDragIcon.h; path = ../../../source/UISystem/CKLBUIDragIcon.h; sourceTree = \"<group>\"; };\n\t\t327C0D54179A41BE007B7F42 /* CKLBUIForm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIForm.h; path = ../../../source/UISystem/CKLBUIForm.h; sourceTree = \"<group>\"; };\n\t\t327C0D55179A41BE007B7F42 /* CKLBUIGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIGroup.cpp; path = ../../../source/UISystem/CKLBUIGroup.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D56179A41BE007B7F42 /* CKLBUIGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIGroup.h; path = ../../../source/UISystem/CKLBUIGroup.h; sourceTree = \"<group>\"; };\n\t\t327C0D57179A41BE007B7F42 /* CKLBUILabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUILabel.h; path = ../../../source/UISystem/CKLBUILabel.h; sourceTree = \"<group>\"; };\n\t\t327C0D58179A41BE007B7F42 /* CKLBUIMoviePlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIMoviePlayer.cpp; path = ../../../source/UISystem/CKLBUIMoviePlayer.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D59179A41BE007B7F42 /* CKLBUIMoviePlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIMoviePlayer.h; path = ../../../source/UISystem/CKLBUIMoviePlayer.h; sourceTree = \"<group>\"; };\n\t\t327C0D5A179A41BE007B7F42 /* CKLBUIMultiImgItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIMultiImgItem.h; path = ../../../source/UISystem/CKLBUIMultiImgItem.h; sourceTree = \"<group>\"; };\n\t\t327C0D5B179A41BE007B7F42 /* CKLBUIPieChart.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIPieChart.cpp; path = ../../../source/UISystem/CKLBUIPieChart.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D5C179A41BE007B7F42 /* CKLBUIPieChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIPieChart.h; path = ../../../source/UISystem/CKLBUIPieChart.h; sourceTree = \"<group>\"; };\n\t\t327C0D5D179A41BE007B7F42 /* CKLBUIPolyline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIPolyline.cpp; path = ../../../source/UISystem/CKLBUIPolyline.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D5E179A41BE007B7F42 /* CKLBUIPolyline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIPolyline.h; path = ../../../source/UISystem/CKLBUIPolyline.h; sourceTree = \"<group>\"; };\n\t\t327C0D5F179A41BE007B7F42 /* CKLBUIProgressBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIProgressBar.h; path = ../../../source/UISystem/CKLBUIProgressBar.h; sourceTree = \"<group>\"; };\n\t\t327C0D60179A41BE007B7F42 /* CKLBUIRubberBand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIRubberBand.cpp; path = ../../../source/UISystem/CKLBUIRubberBand.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D61179A41BE007B7F42 /* CKLBUIRubberBand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIRubberBand.h; path = ../../../source/UISystem/CKLBUIRubberBand.h; sourceTree = \"<group>\"; };\n\t\t327C0D62179A41BE007B7F42 /* CKLBUIScale9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIScale9.h; path = ../../../source/UISystem/CKLBUIScale9.h; sourceTree = \"<group>\"; };\n\t\t327C0D63179A41BE007B7F42 /* CKLBUIScore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIScore.cpp; path = ../../../source/UISystem/CKLBUIScore.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D64179A41BE007B7F42 /* CKLBUIScore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIScore.h; path = ../../../source/UISystem/CKLBUIScore.h; sourceTree = \"<group>\"; };\n\t\t327C0D65179A41BE007B7F42 /* CKLBUIScrollBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUIScrollBar.cpp; path = ../../../source/UISystem/CKLBUIScrollBar.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D66179A41BE007B7F42 /* CKLBUIScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIScrollBar.h; path = ../../../source/UISystem/CKLBUIScrollBar.h; sourceTree = \"<group>\"; };\n\t\t327C0D67179A41BE007B7F42 /* CKLBUISimpleItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CKLBUISimpleItem.cpp; path = ../../../source/UISystem/CKLBUISimpleItem.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D68179A41BE007B7F42 /* CKLBUISimpleItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUISimpleItem.h; path = ../../../source/UISystem/CKLBUISimpleItem.h; sourceTree = \"<group>\"; };\n\t\t327C0D69179A41BE007B7F42 /* CKLBUITouchPad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUITouchPad.h; path = ../../../source/UISystem/CKLBUITouchPad.h; sourceTree = \"<group>\"; };\n\t\t327C0D6A179A41BE007B7F42 /* CKLBUIWebArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBUIWebArea.h; path = ../../../source/UISystem/CKLBUIWebArea.h; sourceTree = \"<group>\"; };\n\t\t327C0D6B179A41BE007B7F42 /* CKLBWebViewNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CKLBWebViewNode.h; path = ../../../source/UISystem/CKLBWebViewNode.h; sourceTree = \"<group>\"; };\n\t\t327C0D6C179A41BE007B7F42 /* IMgrEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IMgrEntry.cpp; path = ../../../source/UISystem/IMgrEntry.cpp; sourceTree = \"<group>\"; };\n\t\t327C0D6D179A41BF007B7F42 /* IMgrEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMgrEntry.h; path = ../../../source/UISystem/IMgrEntry.h; sourceTree = \"<group>\"; };\n\t\t327C0DBD179A423F007B7F42 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };\n\t\t327C0DBF179A424C007B7F42 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };\n\t\t327C0DC1179A4252007B7F42 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };\n\t\t327C0DC3179A425A007B7F42 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };\n\t\t327C0DC8179A427E007B7F42 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };\n\t\t327C0DCA179A428A007B7F42 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };\n\t\t32840003179A4FB300B0CA20 /* smooth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smooth.c; sourceTree = \"<group>\"; };\n\t\t3284001D179A4FB300B0CA20 /* truetype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = truetype.c; sourceTree = \"<group>\"; };\n\t\t32840041179A4FB300B0CA20 /* type1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = type1.c; sourceTree = \"<group>\"; };\n\t\t3284004E179A4FB300B0CA20 /* type42.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = type42.c; sourceTree = \"<group>\"; };\n\t\t32840054179A4FB300B0CA20 /* winfnt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = winfnt.c; sourceTree = \"<group>\"; };\n\t\t3284016C179A4FC700B0CA20 /* ftconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftconfig.h; sourceTree = \"<group>\"; };\n\t\t3284016D179A4FC700B0CA20 /* ftheader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftheader.h; sourceTree = \"<group>\"; };\n\t\t3284016E179A4FC700B0CA20 /* ftmodule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftmodule.h; sourceTree = \"<group>\"; };\n\t\t3284016F179A4FC700B0CA20 /* ftoption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftoption.h; sourceTree = \"<group>\"; };\n\t\t32840170179A4FC700B0CA20 /* ftstdlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftstdlib.h; sourceTree = \"<group>\"; };\n\t\t32840171179A4FC700B0CA20 /* freetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = freetype.h; sourceTree = \"<group>\"; };\n\t\t32840172179A4FC700B0CA20 /* ftadvanc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftadvanc.h; sourceTree = \"<group>\"; };\n\t\t32840173179A4FC700B0CA20 /* ftautoh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftautoh.h; sourceTree = \"<group>\"; };\n\t\t32840174179A4FC700B0CA20 /* ftbbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftbbox.h; sourceTree = \"<group>\"; };\n\t\t32840175179A4FC700B0CA20 /* ftbdf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftbdf.h; sourceTree = \"<group>\"; };\n\t\t32840176179A4FC700B0CA20 /* ftbitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftbitmap.h; sourceTree = \"<group>\"; };\n\t\t32840177179A4FC700B0CA20 /* ftbzip2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftbzip2.h; sourceTree = \"<group>\"; };\n\t\t32840178179A4FC700B0CA20 /* ftcache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftcache.h; sourceTree = \"<group>\"; };\n\t\t32840179179A4FC700B0CA20 /* ftchapters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftchapters.h; sourceTree = \"<group>\"; };\n\t\t3284017A179A4FC700B0CA20 /* ftcid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftcid.h; sourceTree = \"<group>\"; };\n\t\t3284017B179A4FC700B0CA20 /* fterrdef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fterrdef.h; sourceTree = \"<group>\"; };\n\t\t3284017C179A4FC700B0CA20 /* fterrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fterrors.h; sourceTree = \"<group>\"; };\n\t\t3284017D179A4FC700B0CA20 /* ftgasp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftgasp.h; sourceTree = \"<group>\"; };\n\t\t3284017E179A4FC700B0CA20 /* ftglyph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftglyph.h; sourceTree = \"<group>\"; };\n\t\t3284017F179A4FC700B0CA20 /* ftgxval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftgxval.h; sourceTree = \"<group>\"; };\n\t\t32840180179A4FC700B0CA20 /* ftgzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftgzip.h; sourceTree = \"<group>\"; };\n\t\t32840181179A4FC700B0CA20 /* ftimage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftimage.h; sourceTree = \"<group>\"; };\n\t\t32840182179A4FC700B0CA20 /* ftincrem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftincrem.h; sourceTree = \"<group>\"; };\n\t\t32840183179A4FC700B0CA20 /* ftlcdfil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftlcdfil.h; sourceTree = \"<group>\"; };\n\t\t32840184179A4FC700B0CA20 /* ftlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftlist.h; sourceTree = \"<group>\"; };\n\t\t32840185179A4FC700B0CA20 /* ftlzw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftlzw.h; sourceTree = \"<group>\"; };\n\t\t32840186179A4FC700B0CA20 /* ftmac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftmac.h; sourceTree = \"<group>\"; };\n\t\t32840187179A4FC700B0CA20 /* ftmm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftmm.h; sourceTree = \"<group>\"; };\n\t\t32840188179A4FC700B0CA20 /* ftmodapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftmodapi.h; sourceTree = \"<group>\"; };\n\t\t32840189179A4FC700B0CA20 /* ftmoderr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftmoderr.h; sourceTree = \"<group>\"; };\n\t\t3284018A179A4FC700B0CA20 /* ftotval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftotval.h; sourceTree = \"<group>\"; };\n\t\t3284018B179A4FC700B0CA20 /* ftoutln.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftoutln.h; sourceTree = \"<group>\"; };\n\t\t3284018C179A4FC700B0CA20 /* ftpfr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftpfr.h; sourceTree = \"<group>\"; };\n\t\t3284018D179A4FC700B0CA20 /* ftrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftrender.h; sourceTree = \"<group>\"; };\n\t\t3284018E179A4FC700B0CA20 /* ftsizes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftsizes.h; sourceTree = \"<group>\"; };\n\t\t3284018F179A4FC700B0CA20 /* ftsnames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftsnames.h; sourceTree = \"<group>\"; };\n\t\t32840190179A4FC700B0CA20 /* ftstroke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftstroke.h; sourceTree = \"<group>\"; };\n\t\t32840191179A4FC700B0CA20 /* ftsynth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftsynth.h; sourceTree = \"<group>\"; };\n\t\t32840192179A4FC700B0CA20 /* ftsystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftsystem.h; sourceTree = \"<group>\"; };\n\t\t32840193179A4FC700B0CA20 /* fttrigon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fttrigon.h; sourceTree = \"<group>\"; };\n\t\t32840194179A4FC700B0CA20 /* fttypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fttypes.h; sourceTree = \"<group>\"; };\n\t\t32840195179A4FC700B0CA20 /* ftwinfnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftwinfnt.h; sourceTree = \"<group>\"; };\n\t\t32840196179A4FC700B0CA20 /* ftxf86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftxf86.h; sourceTree = \"<group>\"; };\n\t\t32840198179A4FC700B0CA20 /* autohint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = autohint.h; sourceTree = \"<group>\"; };\n\t\t32840199179A4FC700B0CA20 /* ftcalc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftcalc.h; sourceTree = \"<group>\"; };\n\t\t3284019A179A4FC700B0CA20 /* ftdebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftdebug.h; sourceTree = \"<group>\"; };\n\t\t3284019B179A4FC700B0CA20 /* ftdriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftdriver.h; sourceTree = \"<group>\"; };\n\t\t3284019C179A4FC700B0CA20 /* ftgloadr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftgloadr.h; sourceTree = \"<group>\"; };\n\t\t3284019D179A4FC700B0CA20 /* ftmemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftmemory.h; sourceTree = \"<group>\"; };\n\t\t3284019E179A4FC700B0CA20 /* ftobjs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftobjs.h; sourceTree = \"<group>\"; };\n\t\t3284019F179A4FC700B0CA20 /* ftpic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftpic.h; sourceTree = \"<group>\"; };\n\t\t328401A0179A4FC700B0CA20 /* ftrfork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftrfork.h; sourceTree = \"<group>\"; };\n\t\t328401A1179A4FC700B0CA20 /* ftserv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftserv.h; sourceTree = \"<group>\"; };\n\t\t328401A2179A4FC700B0CA20 /* ftstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftstream.h; sourceTree = \"<group>\"; };\n\t\t328401A3179A4FC700B0CA20 /* fttrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fttrace.h; sourceTree = \"<group>\"; };\n\t\t328401A4179A4FC700B0CA20 /* ftvalid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ftvalid.h; sourceTree = \"<group>\"; };\n\t\t328401A5179A4FC700B0CA20 /* internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = \"<group>\"; };\n\t\t328401A6179A4FC700B0CA20 /* psaux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psaux.h; sourceTree = \"<group>\"; };\n\t\t328401A7179A4FC700B0CA20 /* pshints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pshints.h; sourceTree = \"<group>\"; };\n\t\t328401A9179A4FC700B0CA20 /* svbdf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svbdf.h; sourceTree = \"<group>\"; };\n\t\t328401AA179A4FC700B0CA20 /* svcid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svcid.h; sourceTree = \"<group>\"; };\n\t\t328401AB179A4FC700B0CA20 /* svgldict.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svgldict.h; sourceTree = \"<group>\"; };\n\t\t328401AC179A4FC700B0CA20 /* svgxval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svgxval.h; sourceTree = \"<group>\"; };\n\t\t328401AD179A4FC700B0CA20 /* svkern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svkern.h; sourceTree = \"<group>\"; };\n\t\t328401AE179A4FC700B0CA20 /* svmm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svmm.h; sourceTree = \"<group>\"; };\n\t\t328401AF179A4FC700B0CA20 /* svotval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svotval.h; sourceTree = \"<group>\"; };\n\t\t328401B0179A4FC700B0CA20 /* svpfr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svpfr.h; sourceTree = \"<group>\"; };\n\t\t328401B1179A4FC700B0CA20 /* svpostnm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svpostnm.h; sourceTree = \"<group>\"; };\n\t\t328401B2179A4FC700B0CA20 /* svprop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svprop.h; sourceTree = \"<group>\"; };\n\t\t328401B3179A4FC700B0CA20 /* svpscmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svpscmap.h; sourceTree = \"<group>\"; };\n\t\t328401B4179A4FC700B0CA20 /* svpsinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svpsinfo.h; sourceTree = \"<group>\"; };\n\t\t328401B5179A4FC700B0CA20 /* svsfnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svsfnt.h; sourceTree = \"<group>\"; };\n\t\t328401B6179A4FC700B0CA20 /* svttcmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svttcmap.h; sourceTree = \"<group>\"; };\n\t\t328401B7179A4FC700B0CA20 /* svtteng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svtteng.h; sourceTree = \"<group>\"; };\n\t\t328401B8179A4FC700B0CA20 /* svttglyf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svttglyf.h; sourceTree = \"<group>\"; };\n\t\t328401B9179A4FC700B0CA20 /* svwinfnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svwinfnt.h; sourceTree = \"<group>\"; };\n\t\t328401BA179A4FC700B0CA20 /* svxf86nm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svxf86nm.h; sourceTree = \"<group>\"; };\n\t\t328401BB179A4FC700B0CA20 /* sfnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sfnt.h; sourceTree = \"<group>\"; };\n\t\t328401BC179A4FC700B0CA20 /* t1types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = t1types.h; sourceTree = \"<group>\"; };\n\t\t328401BD179A4FC700B0CA20 /* tttypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tttypes.h; sourceTree = \"<group>\"; };\n\t\t328401BE179A4FC700B0CA20 /* t1tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = t1tables.h; sourceTree = \"<group>\"; };\n\t\t328401BF179A4FC700B0CA20 /* ttnameid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttnameid.h; sourceTree = \"<group>\"; };\n\t\t328401C0179A4FC700B0CA20 /* tttables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tttables.h; sourceTree = \"<group>\"; };\n\t\t328401C1179A4FC700B0CA20 /* tttags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tttags.h; sourceTree = \"<group>\"; };\n\t\t328401C2179A4FC700B0CA20 /* ttunpat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttunpat.h; sourceTree = \"<group>\"; };\n\t\t328401C3179A4FC700B0CA20 /* ft2build.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ft2build.h; sourceTree = \"<group>\"; };\n\t\t328401C4179A50F700B0CA20 /* KLBPlatformMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KLBPlatformMetrics.h; path = porting/include/KLBPlatformMetrics.h; sourceTree = \"<group>\"; };\n\t\t328401C5179A576300B0CA20 /* CiOSPlatform.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSPlatform.mm; sourceTree = \"<group>\"; };\n\t\t328401C6179A576300B0CA20 /* CiOSAudioManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSAudioManager.mm; sourceTree = \"<group>\"; };\n\t\t328401C8179A576300B0CA20 /* assert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = assert.mm; sourceTree = \"<group>\"; };\n\t\t328401C9179A576300B0CA20 /* CiOSAudio.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSAudio.mm; sourceTree = \"<group>\"; };\n\t\t328401CA179A576300B0CA20 /* CiOSWidget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSWidget.mm; sourceTree = \"<group>\"; };\n\t\t328401CB179A576300B0CA20 /* EAGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EAGLView.mm; sourceTree = \"<group>\"; };\n\t\t328401CE179A576300B0CA20 /* CiOSReadFileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CiOSReadFileStream.cpp; sourceTree = \"<group>\"; };\n\t\t328401CF179A576300B0CA20 /* CiOSPathConv.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSPathConv.mm; sourceTree = \"<group>\"; };\n\t\t328401D0179A576300B0CA20 /* CiOSTmpFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CiOSTmpFile.cpp; sourceTree = \"<group>\"; };\n\t\t328401D1179A576300B0CA20 /* CSockReadStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSockReadStream.cpp; sourceTree = \"<group>\"; };\n\t\t328401D4179A576300B0CA20 /* CiOSMovieView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSMovieView.mm; sourceTree = \"<group>\"; };\n\t\t328401D5179A576300B0CA20 /* CiOSSysResource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSSysResource.mm; sourceTree = \"<group>\"; };\n\t\t328401D6179A576300B0CA20 /* CiOSWriteFileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CiOSWriteFileStream.cpp; sourceTree = \"<group>\"; };\n\t\t328401D7179A576300B0CA20 /* CSockWriteStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSockWriteStream.cpp; sourceTree = \"<group>\"; };\n\t\t328401EB179A577900B0CA20 /* CiOSPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSPlatform.h; path = include/CiOSPlatform.h; sourceTree = \"<group>\"; };\n\t\t328401EC179A577900B0CA20 /* CiOSAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSAudioManager.h; path = include/CiOSAudioManager.h; sourceTree = \"<group>\"; };\n\t\t328401ED179A577900B0CA20 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = include/AppDelegate.h; sourceTree = \"<group>\"; };\n\t\t328401EE179A577900B0CA20 /* CiOSAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSAudio.h; path = include/CiOSAudio.h; sourceTree = \"<group>\"; };\n\t\t328401EF179A577900B0CA20 /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EAGLView.h; path = include/EAGLView.h; sourceTree = \"<group>\"; };\n\t\t328401F0179A577900B0CA20 /* CiOSWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSWebView.h; path = include/CiOSWebView.h; sourceTree = \"<group>\"; };\n\t\t328401F2179A577900B0CA20 /* CiOSReadFileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSReadFileStream.h; path = include/CiOSReadFileStream.h; sourceTree = \"<group>\"; };\n\t\t328401F3179A577900B0CA20 /* KLBPlatformMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KLBPlatformMetrics.h; path = include/KLBPlatformMetrics.h; sourceTree = \"<group>\"; };\n\t\t328401F4179A577900B0CA20 /* CiOSWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSWidget.h; path = include/CiOSWidget.h; sourceTree = \"<group>\"; };\n\t\t328401F5179A577900B0CA20 /* iOSFileLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iOSFileLocation.h; path = include/iOSFileLocation.h; sourceTree = \"<group>\"; };\n\t\t328401F6179A577900B0CA20 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = include/ViewController.h; sourceTree = \"<group>\"; };\n\t\t328401F7179A577900B0CA20 /* CiOSMovieView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSMovieView.h; path = include/CiOSMovieView.h; sourceTree = \"<group>\"; };\n\t\t328401F8179A577900B0CA20 /* CiOSPathConv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSPathConv.h; path = include/CiOSPathConv.h; sourceTree = \"<group>\"; };\n\t\t328401F9179A577900B0CA20 /* CiOSSysResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSSysResource.h; path = include/CiOSSysResource.h; sourceTree = \"<group>\"; };\n\t\t328401FA179A577900B0CA20 /* CiOSTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSTextView.h; path = include/CiOSTextView.h; sourceTree = \"<group>\"; };\n\t\t328401FB179A577900B0CA20 /* CiOSTmpFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSTmpFile.h; path = include/CiOSTmpFile.h; sourceTree = \"<group>\"; };\n\t\t328401FC179A577900B0CA20 /* CiOSWriteFileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CiOSWriteFileStream.h; path = include/CiOSWriteFileStream.h; sourceTree = \"<group>\"; };\n\t\t328401FD179A577900B0CA20 /* CSockReadStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSockReadStream.h; path = include/CSockReadStream.h; sourceTree = \"<group>\"; };\n\t\t328401FE179A577900B0CA20 /* CSockWriteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSockWriteStream.h; path = include/CSockWriteStream.h; sourceTree = \"<group>\"; };\n\t\t328401FF179A577900B0CA20 /* GLcommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GLcommon.h; path = include/GLcommon.h; sourceTree = \"<group>\"; };\n\t\t32840200179A577900B0CA20 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = \"NSData+Base64.h\"; path = \"include/NSData+Base64.h\"; sourceTree = \"<group>\"; };\n\t\t3284FDEE179A457100B0CA20 /* curl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = curl.h; path = curl/include/curl/curl.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDEF179A457100B0CA20 /* curlbuild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = curlbuild.h; path = curl/include/curl/curlbuild.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF0179A457100B0CA20 /* curlrules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = curlrules.h; path = curl/include/curl/curlrules.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF1179A457100B0CA20 /* curlver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = curlver.h; path = curl/include/curl/curlver.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF2179A457100B0CA20 /* easy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = easy.h; path = curl/include/curl/easy.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF3179A457100B0CA20 /* mprintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mprintf.h; path = curl/include/curl/mprintf.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF4179A457100B0CA20 /* multi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = multi.h; path = curl/include/curl/multi.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF5179A457100B0CA20 /* stdcheaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stdcheaders.h; path = curl/include/curl/stdcheaders.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FDF6179A457100B0CA20 /* typecheck-gcc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = \"typecheck-gcc.h\"; path = \"curl/include/curl/typecheck-gcc.h\"; sourceTree = SOURCE_ROOT; };\n\t\t3284FE01179A4ADB00B0CA20 /* glew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glew.h; path = glew/include/GL/glew.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FE02179A4ADB00B0CA20 /* glxew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glxew.h; path = glew/include/GL/glxew.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FE03179A4ADB00B0CA20 /* wglew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wglew.h; path = glew/include/GL/wglew.h; sourceTree = SOURCE_ROOT; };\n\t\t3284FE05179A4B2B00B0CA20 /* lauxlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lauxlib.h; path = ../../../libs/lua/lauxlib.h; sourceTree = \"<group>\"; };\n\t\t3284FE06179A4B2B00B0CA20 /* luaconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = luaconf.h; path = ../../../libs/lua/luaconf.h; sourceTree = \"<group>\"; };\n\t\t3284FE07179A4B2B00B0CA20 /* lapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = ../../../libs/lua/lapi.c; sourceTree = \"<group>\"; };\n\t\t3284FE08179A4B2B00B0CA20 /* lapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lapi.h; path = ../../../libs/lua/lapi.h; sourceTree = \"<group>\"; };\n\t\t3284FE09179A4B2B00B0CA20 /* lauxlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = ../../../libs/lua/lauxlib.c; sourceTree = \"<group>\"; };\n\t\t3284FE0A179A4B2B00B0CA20 /* lbaselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = ../../../libs/lua/lbaselib.c; sourceTree = \"<group>\"; };\n\t\t3284FE0B179A4B2B00B0CA20 /* lbitlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbitlib.c; path = ../../../libs/lua/lbitlib.c; sourceTree = \"<group>\"; };\n\t\t3284FE0C179A4B2B00B0CA20 /* lcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = ../../../libs/lua/lcode.c; sourceTree = \"<group>\"; };\n\t\t3284FE0D179A4B2B00B0CA20 /* lcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcode.h; path = ../../../libs/lua/lcode.h; sourceTree = \"<group>\"; };\n\t\t3284FE0E179A4B2B00B0CA20 /* lcorolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcorolib.c; path = ../../../libs/lua/lcorolib.c; sourceTree = \"<group>\"; };\n\t\t3284FE0F179A4B2B00B0CA20 /* lctype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lctype.c; path = ../../../libs/lua/lctype.c; sourceTree = \"<group>\"; };\n\t\t3284FE10179A4B2B00B0CA20 /* lctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lctype.h; path = ../../../libs/lua/lctype.h; sourceTree = \"<group>\"; };\n\t\t3284FE11179A4B2B00B0CA20 /* ldblib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldblib.c; path = ../../../libs/lua/ldblib.c; sourceTree = \"<group>\"; };\n\t\t3284FE12179A4B2B00B0CA20 /* ldebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = ../../../libs/lua/ldebug.c; sourceTree = \"<group>\"; };\n\t\t3284FE13179A4B2B00B0CA20 /* ldebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldebug.h; path = ../../../libs/lua/ldebug.h; sourceTree = \"<group>\"; };\n\t\t3284FE14179A4B2B00B0CA20 /* ldo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = ../../../libs/lua/ldo.c; sourceTree = \"<group>\"; };\n\t\t3284FE15179A4B2B00B0CA20 /* ldo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldo.h; path = ../../../libs/lua/ldo.h; sourceTree = \"<group>\"; };\n\t\t3284FE16179A4B2B00B0CA20 /* ldump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = ../../../libs/lua/ldump.c; sourceTree = \"<group>\"; };\n\t\t3284FE17179A4B2B00B0CA20 /* lfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = ../../../libs/lua/lfunc.c; sourceTree = \"<group>\"; };\n\t\t3284FE18179A4B2B00B0CA20 /* lfunc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lfunc.h; path = ../../../libs/lua/lfunc.h; sourceTree = \"<group>\"; };\n\t\t3284FE19179A4B2B00B0CA20 /* lgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = ../../../libs/lua/lgc.c; sourceTree = \"<group>\"; };\n\t\t3284FE1A179A4B2B00B0CA20 /* lgc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lgc.h; path = ../../../libs/lua/lgc.h; sourceTree = \"<group>\"; };\n\t\t3284FE1B179A4B2B00B0CA20 /* linit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linit.c; path = ../../../libs/lua/linit.c; sourceTree = \"<group>\"; };\n\t\t3284FE1C179A4B2B00B0CA20 /* liolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = liolib.c; path = ../../../libs/lua/liolib.c; sourceTree = \"<group>\"; };\n\t\t3284FE1D179A4B2B00B0CA20 /* llex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = llex.c; path = ../../../libs/lua/llex.c; sourceTree = \"<group>\"; };\n\t\t3284FE1E179A4B2B00B0CA20 /* llex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llex.h; path = ../../../libs/lua/llex.h; sourceTree = \"<group>\"; };\n\t\t3284FE1F179A4B2B00B0CA20 /* llimits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llimits.h; path = ../../../libs/lua/llimits.h; sourceTree = \"<group>\"; };\n\t\t3284FE20179A4B2B00B0CA20 /* lmathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmathlib.c; path = ../../../libs/lua/lmathlib.c; sourceTree = \"<group>\"; };\n\t\t3284FE21179A4B2B00B0CA20 /* lmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = ../../../libs/lua/lmem.c; sourceTree = \"<group>\"; };\n\t\t3284FE22179A4B2B00B0CA20 /* lmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lmem.h; path = ../../../libs/lua/lmem.h; sourceTree = \"<group>\"; };\n\t\t3284FE23179A4B2B00B0CA20 /* loadlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loadlib.c; path = ../../../libs/lua/loadlib.c; sourceTree = \"<group>\"; };\n\t\t3284FE24179A4B2B00B0CA20 /* lobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = ../../../libs/lua/lobject.c; sourceTree = \"<group>\"; };\n\t\t3284FE25179A4B2B00B0CA20 /* lobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lobject.h; path = ../../../libs/lua/lobject.h; sourceTree = \"<group>\"; };\n\t\t3284FE26179A4B2B00B0CA20 /* lopcodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = ../../../libs/lua/lopcodes.c; sourceTree = \"<group>\"; };\n\t\t3284FE27179A4B2B00B0CA20 /* lopcodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lopcodes.h; path = ../../../libs/lua/lopcodes.h; sourceTree = \"<group>\"; };\n\t\t3284FE28179A4B2B00B0CA20 /* loslib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loslib.c; path = ../../../libs/lua/loslib.c; sourceTree = \"<group>\"; };\n\t\t3284FE29179A4B2B00B0CA20 /* lparser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = ../../../libs/lua/lparser.c; sourceTree = \"<group>\"; };\n\t\t3284FE2A179A4B2B00B0CA20 /* lparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lparser.h; path = ../../../libs/lua/lparser.h; sourceTree = \"<group>\"; };\n\t\t3284FE2B179A4B2B00B0CA20 /* lstate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = ../../../libs/lua/lstate.c; sourceTree = \"<group>\"; };\n\t\t3284FE2C179A4B2B00B0CA20 /* lstate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstate.h; path = ../../../libs/lua/lstate.h; sourceTree = \"<group>\"; };\n\t\t3284FE2D179A4B2B00B0CA20 /* lstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = ../../../libs/lua/lstring.c; sourceTree = \"<group>\"; };\n\t\t3284FE2E179A4B2B00B0CA20 /* lstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstring.h; path = ../../../libs/lua/lstring.h; sourceTree = \"<group>\"; };\n\t\t3284FE2F179A4B2B00B0CA20 /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = ../../../libs/lua/lstrlib.c; sourceTree = \"<group>\"; };\n\t\t3284FE30179A4B2B00B0CA20 /* ltable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = ../../../libs/lua/ltable.c; sourceTree = \"<group>\"; };\n\t\t3284FE31179A4B2B00B0CA20 /* ltable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltable.h; path = ../../../libs/lua/ltable.h; sourceTree = \"<group>\"; };\n\t\t3284FE32179A4B2B00B0CA20 /* ltablib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = ../../../libs/lua/ltablib.c; sourceTree = \"<group>\"; };\n\t\t3284FE33179A4B2B00B0CA20 /* ltm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = ../../../libs/lua/ltm.c; sourceTree = \"<group>\"; };\n\t\t3284FE34179A4B2B00B0CA20 /* ltm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltm.h; path = ../../../libs/lua/ltm.h; sourceTree = \"<group>\"; };\n\t\t3284FE35179A4B2B00B0CA20 /* lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua.h; path = ../../../libs/lua/lua.h; sourceTree = \"<group>\"; };\n\t\t3284FE36179A4B2B00B0CA20 /* lua.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = lua.hpp; path = ../../../libs/lua/lua.hpp; sourceTree = \"<group>\"; };\n\t\t3284FE37179A4B2B00B0CA20 /* lualib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lualib.h; path = ../../../libs/lua/lualib.h; sourceTree = \"<group>\"; };\n\t\t3284FE38179A4B2B00B0CA20 /* lundump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = ../../../libs/lua/lundump.c; sourceTree = \"<group>\"; };\n\t\t3284FE39179A4B2B00B0CA20 /* lundump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lundump.h; path = ../../../libs/lua/lundump.h; sourceTree = \"<group>\"; };\n\t\t3284FE3A179A4B2B00B0CA20 /* lvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = ../../../libs/lua/lvm.c; sourceTree = \"<group>\"; };\n\t\t3284FE3B179A4B2B00B0CA20 /* lvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lvm.h; path = ../../../libs/lua/lvm.h; sourceTree = \"<group>\"; };\n\t\t3284FE3C179A4B2B00B0CA20 /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = ../../../libs/lua/lzio.c; sourceTree = \"<group>\"; };\n\t\t3284FE3D179A4B2B00B0CA20 /* lzio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lzio.h; path = ../../../libs/lua/lzio.h; sourceTree = \"<group>\"; };\n\t\t3284FE5F179A4EF900B0CA20 /* hash_sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash_sha1.c; path = ../../../libs/sha1/hash_sha1.c; sourceTree = \"<group>\"; };\n\t\t3284FE60179A4EF900B0CA20 /* hash_sha1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash_sha1.h; path = ../../../libs/sha1/hash_sha1.h; sourceTree = \"<group>\"; };\n\t\t3284FE63179A4F0900B0CA20 /* sqlite3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sqlite3.c; path = ../../../libs/SQLite/sqlite3.c; sourceTree = \"<group>\"; };\n\t\t3284FE64179A4F0900B0CA20 /* sqlite3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqlite3.h; path = ../../../libs/SQLite/sqlite3.h; sourceTree = \"<group>\"; };\n\t\t3284FE65179A4F0900B0CA20 /* sqlite3ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqlite3ext.h; path = ../../../libs/SQLite/sqlite3ext.h; sourceTree = \"<group>\"; };\n\t\t3284FE68179A4F1B00B0CA20 /* utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utf8.c; path = ../../../libs/utf8_converter/utf8.c; sourceTree = \"<group>\"; };\n\t\t3284FE69179A4F1B00B0CA20 /* utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utf8.h; path = ../../../libs/utf8_converter/utf8.h; sourceTree = \"<group>\"; };\n\t\t3284FE6C179A4F4900B0CA20 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = ../../../libs/minizip/crypt.h; sourceTree = \"<group>\"; };\n\t\t3284FE6D179A4F4900B0CA20 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ioapi.c; path = ../../../libs/minizip/ioapi.c; sourceTree = \"<group>\"; };\n\t\t3284FE6E179A4F4900B0CA20 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ioapi.h; path = ../../../libs/minizip/ioapi.h; sourceTree = \"<group>\"; };\n\t\t3284FE6F179A4F4900B0CA20 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mztools.c; path = ../../../libs/minizip/mztools.c; sourceTree = \"<group>\"; };\n\t\t3284FE70179A4F4900B0CA20 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mztools.h; path = ../../../libs/minizip/mztools.h; sourceTree = \"<group>\"; };\n\t\t3284FE71179A4F4900B0CA20 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = unzip.c; path = ../../../libs/minizip/unzip.c; sourceTree = \"<group>\"; };\n\t\t3284FE72179A4F4900B0CA20 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unzip.h; path = ../../../libs/minizip/unzip.h; sourceTree = \"<group>\"; };\n\t\t3284FE77179A4F6600B0CA20 /* yajl_buf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_buf.c; path = ../../../libs/JSonParser/yajl_buf.c; sourceTree = \"<group>\"; };\n\t\t3284FE78179A4F6600B0CA20 /* yajl_bytestack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_bytestack.h; path = ../../../libs/JSonParser/yajl_bytestack.h; sourceTree = \"<group>\"; };\n\t\t3284FE79179A4F6600B0CA20 /* yajl_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_encode.c; path = ../../../libs/JSonParser/yajl_encode.c; sourceTree = \"<group>\"; };\n\t\t3284FE7A179A4F6600B0CA20 /* yajl_lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_lex.c; path = ../../../libs/JSonParser/yajl_lex.c; sourceTree = \"<group>\"; };\n\t\t3284FE7B179A4F6600B0CA20 /* yajl_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_parser.c; path = ../../../libs/JSonParser/yajl_parser.c; sourceTree = \"<group>\"; };\n\t\t3284FE7C179A4F6600B0CA20 /* yajl_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_tree.c; path = ../../../libs/JSonParser/yajl_tree.c; sourceTree = \"<group>\"; };\n\t\t3284FE7D179A4F6600B0CA20 /* yajl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl.c; path = ../../../libs/JSonParser/yajl.c; sourceTree = \"<group>\"; };\n\t\t3284FE7E179A4F6600B0CA20 /* json_binary_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = json_binary_parser.c; path = ../../../libs/JSonParser/json_binary_parser.c; sourceTree = \"<group>\"; };\n\t\t3284FE7F179A4F6600B0CA20 /* important.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = important.txt; path = ../../../libs/JSonParser/important.txt; sourceTree = \"<group>\"; };\n\t\t3284FE80179A4F6600B0CA20 /* msg_pack_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = msg_pack_parser.c; path = ../../../libs/JSonParser/msg_pack_parser.c; sourceTree = \"<group>\"; };\n\t\t3284FE81179A4F6600B0CA20 /* yajl_alloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_alloc.c; path = ../../../libs/JSonParser/yajl_alloc.c; sourceTree = \"<group>\"; };\n\t\t3284FE82179A4F6600B0CA20 /* yajl_alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_alloc.h; path = ../../../libs/JSonParser/yajl_alloc.h; sourceTree = \"<group>\"; };\n\t\t3284FE83179A4F6600B0CA20 /* yajl_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_assert.h; path = ../../../libs/JSonParser/yajl_assert.h; sourceTree = \"<group>\"; };\n\t\t3284FE84179A4F6600B0CA20 /* yajl_buf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_buf.h; path = ../../../libs/JSonParser/yajl_buf.h; sourceTree = \"<group>\"; };\n\t\t3284FE85179A4F6600B0CA20 /* yajl_encode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_encode.h; path = ../../../libs/JSonParser/yajl_encode.h; sourceTree = \"<group>\"; };\n\t\t3284FE86179A4F6600B0CA20 /* yajl_gen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_gen.c; path = ../../../libs/JSonParser/yajl_gen.c; sourceTree = \"<group>\"; };\n\t\t3284FE87179A4F6600B0CA20 /* yajl_lex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_lex.h; path = ../../../libs/JSonParser/yajl_lex.h; sourceTree = \"<group>\"; };\n\t\t3284FE88179A4F6600B0CA20 /* yajl_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_parser.h; path = ../../../libs/JSonParser/yajl_parser.h; sourceTree = \"<group>\"; };\n\t\t3284FE89179A4F6600B0CA20 /* yajl_version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yajl_version.c; path = ../../../libs/JSonParser/yajl_version.c; sourceTree = \"<group>\"; };\n\t\t3284FE97179A4F7600B0CA20 /* yajl_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_common.h; path = ../../../libs/JSonParser/api/yajl_common.h; sourceTree = \"<group>\"; };\n\t\t3284FE98179A4F7600B0CA20 /* yajl_gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_gen.h; path = ../../../libs/JSonParser/api/yajl_gen.h; sourceTree = \"<group>\"; };\n\t\t3284FE99179A4F7600B0CA20 /* yajl_parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_parse.h; path = ../../../libs/JSonParser/api/yajl_parse.h; sourceTree = \"<group>\"; };\n\t\t3284FE9A179A4F7600B0CA20 /* yajl_tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yajl_tree.h; path = ../../../libs/JSonParser/api/yajl_tree.h; sourceTree = \"<group>\"; };\n\t\t3284FEB8179A4FB200B0CA20 /* autofit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = autofit.c; sourceTree = \"<group>\"; };\n\t\t3284FEC1179A4FB200B0CA20 /* ftbase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftbase.c; sourceTree = \"<group>\"; };\n\t\t3284FEC3179A4FB200B0CA20 /* ftbbox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftbbox.c; sourceTree = \"<group>\"; };\n\t\t3284FEC5179A4FB200B0CA20 /* ftbitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftbitmap.c; sourceTree = \"<group>\"; };\n\t\t3284FECA179A4FB200B0CA20 /* ftfstype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftfstype.c; sourceTree = \"<group>\"; };\n\t\t3284FECB179A4FB200B0CA20 /* ftgasp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftgasp.c; sourceTree = \"<group>\"; };\n\t\t3284FECD179A4FB200B0CA20 /* ftglyph.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftglyph.c; sourceTree = \"<group>\"; };\n\t\t3284FECE179A4FB200B0CA20 /* ftgxval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftgxval.c; sourceTree = \"<group>\"; };\n\t\t3284FECF179A4FB200B0CA20 /* ftinit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftinit.c; sourceTree = \"<group>\"; };\n\t\t3284FED0179A4FB200B0CA20 /* ftlcdfil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftlcdfil.c; sourceTree = \"<group>\"; };\n\t\t3284FED2179A4FB200B0CA20 /* ftmm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftmm.c; sourceTree = \"<group>\"; };\n\t\t3284FED4179A4FB200B0CA20 /* ftotval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftotval.c; sourceTree = \"<group>\"; };\n\t\t3284FED6179A4FB200B0CA20 /* ftpatent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftpatent.c; sourceTree = \"<group>\"; };\n\t\t3284FED7179A4FB200B0CA20 /* ftpfr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftpfr.c; sourceTree = \"<group>\"; };\n\t\t3284FEDC179A4FB200B0CA20 /* ftstroke.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftstroke.c; sourceTree = \"<group>\"; };\n\t\t3284FEDD179A4FB200B0CA20 /* ftsynth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftsynth.c; sourceTree = \"<group>\"; };\n\t\t3284FEDE179A4FB200B0CA20 /* ftsystem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftsystem.c; sourceTree = \"<group>\"; };\n\t\t3284FEE0179A4FB200B0CA20 /* fttype1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fttype1.c; sourceTree = \"<group>\"; };\n\t\t3284FEE2179A4FB200B0CA20 /* ftwinfnt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftwinfnt.c; sourceTree = \"<group>\"; };\n\t\t3284FEE3179A4FB200B0CA20 /* ftxf86.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftxf86.c; sourceTree = \"<group>\"; };\n\t\t3284FEE7179A4FB200B0CA20 /* bdf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bdf.c; sourceTree = \"<group>\"; };\n\t\t3284FEF6179A4FB200B0CA20 /* ftcache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftcache.c; sourceTree = \"<group>\"; };\n\t\t3284FF0A179A4FB200B0CA20 /* cff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cff.c; sourceTree = \"<group>\"; };\n\t\t3284FF2F179A4FB300B0CA20 /* type1cid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = type1cid.c; sourceTree = \"<group>\"; };\n\t\t3284FF30179A4FB300B0CA20 /* ftdebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftdebug.c; sourceTree = \"<group>\"; };\n\t\t3284FF84179A4FB300B0CA20 /* pcf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pcf.c; sourceTree = \"<group>\"; };\n\t\t3284FF92179A4FB300B0CA20 /* pfr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pfr.c; sourceTree = \"<group>\"; };\n\t\t3284FFA7179A4FB300B0CA20 /* psaux.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psaux.c; sourceTree = \"<group>\"; };\n\t\t3284FFBB179A4FB300B0CA20 /* pshinter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pshinter.c; sourceTree = \"<group>\"; };\n\t\t3284FFC7179A4FB300B0CA20 /* psmodule.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psmodule.c; sourceTree = \"<group>\"; };\n\t\t3284FFD7179A4FB300B0CA20 /* raster.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raster.c; sourceTree = \"<group>\"; };\n\t\t3284FFE3179A4FB300B0CA20 /* sfnt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sfnt.c; sourceTree = \"<group>\"; };\n\t\t32D86B05182F73E700210C28 /* PlaygroundOSS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PlaygroundOSS.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t32D86B08182F73E700210C28 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };\n\t\t32D86B09182F73E700210C28 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };\n\t\t32D86B0A182F73E700210C28 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };\n\t\t32D86B19182F73E700210C28 /* PlaygroundOSSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PlaygroundOSSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t32D86B22182F73E800210C28 /* PlaygroundOSSTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = \"PlaygroundOSSTests-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t32D86B24182F73E800210C28 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = \"<group>\"; };\n\t\t32D86B26182F73E800210C28 /* PlaygroundOSSTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PlaygroundOSSTests.m; sourceTree = \"<group>\"; };\n\t\t32F55E8C179AFDFC003807CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };\n\t\t32F55E8E179B0796003807CE /* CiOSWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CiOSWebView.mm; sourceTree = \"<group>\"; };\n\t\t32F55E90179B0D55003807CE /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };\n\t\t32F55E92179B1493003807CE /* FontRendering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontRendering.h; path = ../../FontRendering.h; sourceTree = \"<group>\"; };\n\t\t32F55E93179B17F4003807CE /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };\n\t\t32F55E95179B1CA2003807CE /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };\n\t\t32F55EA2179B2147003807CE /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; };\n\t\t32F55EA4179CF9C8003807CE /* demon.model */ = {isa = PBXFileReference; lastKnownFileType = file; path = demon.model; sourceTree = \"<group>\"; };\n\t\t32F55EA5179CF9C8003807CE /* demon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = demon.png; sourceTree = \"<group>\"; };\n\t\t32F55EA9179CFA29003807CE /* character.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = character.fsh; sourceTree = \"<group>\"; };\n\t\t32F55EAA179CFA29003807CE /* character.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = character.vsh; sourceTree = \"<group>\"; };\n\t\t32F55EAB179CFA29003807CE /* reflect.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = reflect.fsh; sourceTree = \"<group>\"; };\n\t\t32F55EAC179CFA29003807CE /* reflect.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = reflect.vsh; sourceTree = \"<group>\"; };\n\t\t32F55EBD179D0B07003807CE /* MTLmr3m.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = MTLmr3m.ttf; path = ../../fonts/MTLmr3m.ttf; sourceTree = \"<group>\"; };\n\t\t6F65D8C7179CDDD900E9F3CE /* NSGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSGLView.h; sourceTree = \"<group>\"; };\n\t\t6F65D8C8179CDDD900E9F3CE /* NSGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSGLView.mm; sourceTree = \"<group>\"; };\n\t\t6F65D8CA179CE01300E9F3CE /* OpenGLRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenGLRenderer.h; sourceTree = \"<group>\"; };\n\t\t6F65D8CB179CE01300E9F3CE /* OpenGLRenderer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenGLRenderer.mm; sourceTree = \"<group>\"; };\n\t\t6F65D8CD179CE05900E9F3CE /* glUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glUtil.h; sourceTree = \"<group>\"; };\n\t\t6F65D8CF179CE0D200E9F3CE /* imageUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = imageUtil.h; sourceTree = \"<group>\"; };\n\t\t6F65D8D0179CE0D200E9F3CE /* imageUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = imageUtil.m; sourceTree = \"<group>\"; };\n\t\t6F65D8D1179CE0D200E9F3CE /* matrixUtil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = matrixUtil.c; sourceTree = \"<group>\"; };\n\t\t6F65D8D2179CE0D200E9F3CE /* matrixUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = matrixUtil.h; sourceTree = \"<group>\"; };\n\t\t6F65D8D3179CE0D200E9F3CE /* modelUtil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = modelUtil.c; sourceTree = \"<group>\"; };\n\t\t6F65D8D4179CE0D200E9F3CE /* modelUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = modelUtil.h; sourceTree = \"<group>\"; };\n\t\t6F65D8D5179CE0D200E9F3CE /* sourceUtil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sourceUtil.c; sourceTree = \"<group>\"; };\n\t\t6F65D8D6179CE0D200E9F3CE /* sourceUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sourceUtil.h; sourceTree = \"<group>\"; };\n\t\t6F65D8D7179CE0D200E9F3CE /* vectorUtil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vectorUtil.c; sourceTree = \"<group>\"; };\n\t\t6F65D8D8179CE0D200E9F3CE /* vectorUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vectorUtil.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t327C0B83179A3944007B7F42 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32F55EA3179B2147003807CE /* libcurl.dylib in Frameworks */,\n\t\t\t\t32F55E96179B1CA3003807CE /* libz.dylib in Frameworks */,\n\t\t\t\t32F55E94179B17F5003807CE /* AudioUnit.framework in Frameworks */,\n\t\t\t\t32F55E91179B0D55003807CE /* OpenGL.framework in Frameworks */,\n\t\t\t\t32F55E8D179AFDFC003807CE /* WebKit.framework in Frameworks */,\n\t\t\t\t327C0DCB179A428A007B7F42 /* AudioToolbox.framework in Frameworks */,\n\t\t\t\t327C0DC9179A427E007B7F42 /* Security.framework in Frameworks */,\n\t\t\t\t327C0DC7179A426D007B7F42 /* Foundation.framework in Frameworks */,\n\t\t\t\t327C0DC4179A425B007B7F42 /* AVFoundation.framework in Frameworks */,\n\t\t\t\t327C0DC2179A4252007B7F42 /* QuartzCore.framework in Frameworks */,\n\t\t\t\t327C0DC0179A424C007B7F42 /* CoreFoundation.framework in Frameworks */,\n\t\t\t\t327C0DBE179A423F007B7F42 /* CoreAudio.framework in Frameworks */,\n\t\t\t\t327C0B8A179A3944007B7F42 /* Cocoa.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t32D86B01182F73E700210C28 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86C51182F757A00210C28 /* libcurl.dylib in Frameworks */,\n\t\t\t\t32D86C52182F758100210C28 /* libz.dylib in Frameworks */,\n\t\t\t\t32D86C5C182F75D600210C28 /* CoreAudio.framework in Frameworks */,\n\t\t\t\t32D86C5B182F75CE00210C28 /* CoreFoundation.framework in Frameworks */,\n\t\t\t\t32D86C5A182F75C700210C28 /* QuartzCore.framework in Frameworks */,\n\t\t\t\t32D86C59182F75BC00210C28 /* AVFoundation.framework in Frameworks */,\n\t\t\t\t32D86C58182F75AC00210C28 /* Foundation.framework in Frameworks */,\n\t\t\t\t32D86C57182F75A700210C28 /* Security.framework in Frameworks */,\n\t\t\t\t32D86C56182F75A000210C28 /* AudioToolbox.framework in Frameworks */,\n\t\t\t\t32D86C55182F759600210C28 /* WebKit.framework in Frameworks */,\n\t\t\t\t32D86C54182F758F00210C28 /* OpenGL.framework in Frameworks */,\n\t\t\t\t32D86C53182F758800210C28 /* AudioUnit.framework in Frameworks */,\n\t\t\t\t32D86B06182F73E700210C28 /* Cocoa.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t32D86B16182F73E700210C28 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86B1C182F73E800210C28 /* Cocoa.framework in Frameworks */,\n\t\t\t\t32D86B1F182F73E800210C28 /* PlaygroundOSS.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t327C0B7D179A3944007B7F42 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0BA6179A39A9007B7F42 /* ProjectResources */,\n\t\t\t\t327C0B8F179A3944007B7F42 /* Playground */,\n\t\t\t\t32D86B20182F73E800210C28 /* PlaygroundOSSTests */,\n\t\t\t\t327C0B88179A3944007B7F42 /* Frameworks */,\n\t\t\t\t327C0B87179A3944007B7F42 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0B87179A3944007B7F42 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0B86179A3944007B7F42 /* Playground.app */,\n\t\t\t\t32D86B05182F73E700210C28 /* PlaygroundOSS.framework */,\n\t\t\t\t32D86B19182F73E700210C28 /* PlaygroundOSSTests.xctest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0B88179A3944007B7F42 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32F55EA2179B2147003807CE /* libcurl.dylib */,\n\t\t\t\t32F55E95179B1CA2003807CE /* libz.dylib */,\n\t\t\t\t32F55E93179B17F4003807CE /* AudioUnit.framework */,\n\t\t\t\t32F55E90179B0D55003807CE /* OpenGL.framework */,\n\t\t\t\t327C0B8C179A3944007B7F42 /* AppKit.framework */,\n\t\t\t\t327C0B8D179A3944007B7F42 /* CoreData.framework */,\n\t\t\t\t327C0B8E179A3944007B7F42 /* Foundation.framework */,\n\t\t\t\t327C0B89179A3944007B7F42 /* Cocoa.framework */,\n\t\t\t\t327C0DCA179A428A007B7F42 /* AudioToolbox.framework */,\n\t\t\t\t327C0DC8179A427E007B7F42 /* Security.framework */,\n\t\t\t\t327C0DC3179A425A007B7F42 /* AVFoundation.framework */,\n\t\t\t\t327C0DC1179A4252007B7F42 /* QuartzCore.framework */,\n\t\t\t\t327C0DBF179A424C007B7F42 /* CoreFoundation.framework */,\n\t\t\t\t327C0DBD179A423F007B7F42 /* CoreAudio.framework */,\n\t\t\t\t32F55E8C179AFDFC003807CE /* WebKit.framework */,\n\t\t\t\t32D86B07182F73E700210C28 /* Other Frameworks */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0B8F179A3944007B7F42 /* Playground */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0BAE179A3A32007B7F42 /* include */,\n\t\t\t\t327C0BB5179A3A5A007B7F42 /* libs */,\n\t\t\t\t327C0B9B179A3945007B7F42 /* PlaygroundAppDelegate.h */,\n\t\t\t\t327C0B9C179A3945007B7F42 /* PlaygroundAppDelegate.mm */,\n\t\t\t\t327C0B9E179A3945007B7F42 /* MainMenu.xib */,\n\t\t\t\t327C0B90179A3944007B7F42 /* Supporting Files */,\n\t\t\t\t327C0BAD179A3A2A007B7F42 /* porting */,\n\t\t\t\t327C0BB3179A3A46007B7F42 /* Animation */,\n\t\t\t\t327C0BB2179A3A44007B7F42 /* Assets */,\n\t\t\t\t327C0BB1179A3A42007B7F42 /* Core */,\n\t\t\t\t327C0BAC179A3A1C007B7F42 /* Database */,\n\t\t\t\t327C0BAB179A3A16007B7F42 /* HTTP */,\n\t\t\t\t327C0BAA179A3A10007B7F42 /* LuaLib */,\n\t\t\t\t327C0BB0179A3A3B007B7F42 /* Rendering */,\n\t\t\t\t327C0BAF179A3A36007B7F42 /* SceneGraph */,\n\t\t\t\t327C0BA7179A39ED007B7F42 /* Sound */,\n\t\t\t\t327C0BB4179A3A49007B7F42 /* SystemTask */,\n\t\t\t\t327C0BB6179A3A5C007B7F42 /* UISystem */,\n\t\t\t\t327C0BA9179A3A09007B7F42 /* UserTask */,\n\t\t\t);\n\t\t\tpath = Playground;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0B90179A3944007B7F42 /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0B91179A3944007B7F42 /* Playground-Info.plist */,\n\t\t\t\t327C0B92179A3944007B7F42 /* InfoPlist.strings */,\n\t\t\t\t327C0B95179A3945007B7F42 /* main.m */,\n\t\t\t\t327C0B97179A3945007B7F42 /* Playground-Prefix.pch */,\n\t\t\t\t327C0B98179A3945007B7F42 /* Credits.rtf */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BA6179A39A9007B7F42 /* ProjectResources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3212707018253D2A0027C57E /* itemimage.png.imag */,\n\t\t\t\t3212707118253D2A0027C57E /* SimpleItem.lua */,\n\t\t\t\t3212707218253D2A0027C57E /* start.lua */,\n\t\t\t\t3212707318253D2A0027C57E /* textureBoat.texb */,\n\t\t\t\t32F55EBD179D0B07003807CE /* MTLmr3m.ttf */,\n\t\t\t\t32F55EA8179CFA29003807CE /* Shaders */,\n\t\t\t\t32F55EA4179CF9C8003807CE /* demon.model */,\n\t\t\t\t32F55EA5179CF9C8003807CE /* demon.png */,\n\t\t\t);\n\t\t\tname = ProjectResources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BA7179A39ED007B7F42 /* Sound */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0CFC179A3F76007B7F42 /* CSoundAnalysisMP3.cpp */,\n\t\t\t\t327C0CFD179A3F76007B7F42 /* CSoundAnalysis.cpp */,\n\t\t\t\t327C0CFE179A3F76007B7F42 /* CSoundAnalysisMP3.h */,\n\t\t\t);\n\t\t\tname = Sound;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BA9179A3A09007B7F42 /* UserTask */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32127065182530650027C57E /* CSampleProjectEntrance.cpp */,\n\t\t\t\t32127066182530650027C57E /* CSampleProjectEntrance.h */,\n\t\t\t);\n\t\t\tname = UserTask;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BAA179A3A10007B7F42 /* LuaLib */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0C92179A3ECB007B7F42 /* CKLBLuaLibAPP.cpp */,\n\t\t\t\t327C0C93179A3ECB007B7F42 /* CKLBLuaLibENG.cpp */,\n\t\t\t\t327C0C94179A3ECB007B7F42 /* CKLBLuaLibENG.h */,\n\t\t\t\t327C0C95179A3ECB007B7F42 /* CKLBLuaLibFONT.cpp */,\n\t\t\t\t327C0C96179A3ECB007B7F42 /* CKLBLuaLibFONT.h */,\n\t\t\t\t327C0C97179A3ECB007B7F42 /* CKLBLuaLibHASH.cpp */,\n\t\t\t\t327C0C98179A3ECB007B7F42 /* CKLBLuaLibHASH.h */,\n\t\t\t\t327C0C99179A3ECB007B7F42 /* CKLBLuaLibSOUND.cpp */,\n\t\t\t\t327C0C9A179A3ECB007B7F42 /* CKLBLuaLibSOUND.h */,\n\t\t\t\t327C0C9B179A3ECB007B7F42 /* CKLBLuaLibGL.cpp */,\n\t\t\t\t327C0C9C179A3ECB007B7F42 /* CKLBLuaLibDATA.cpp */,\n\t\t\t\t327C0C9D179A3ECB007B7F42 /* CKLBLuaLibMatrix.cpp */,\n\t\t\t\t327C0C9F179A3ECB007B7F42 /* ILuaFuncLib.cpp */,\n\t\t\t\t327C0CA0179A3ECB007B7F42 /* CKLBLuaLibCONV.cpp */,\n\t\t\t\t327C0CA1179A3ECB007B7F42 /* CKLBLuaLibGL.h */,\n\t\t\t\t327C0CA2179A3ECB007B7F42 /* CKLBLuaLibKEY.cpp */,\n\t\t\t\t327C0CA3179A3ECB007B7F42 /* CKLBLuaLibTASK.cpp */,\n\t\t\t\t327C0CA4179A3ECB007B7F42 /* CKLBLuaLibASSET.cpp */,\n\t\t\t\t327C0CA5179A3ECB007B7F42 /* CKLBLuaLibASSET.h */,\n\t\t\t\t327C0CA6179A3ECB007B7F42 /* CKLBLuaConst.cpp */,\n\t\t\t\t327C0CA7179A3ECB007B7F42 /* CKLBLuaConst.h */,\n\t\t\t\t327C0CA9179A3ECB007B7F42 /* CKLBLuaLibAPP.h */,\n\t\t\t\t327C0CAA179A3ECB007B7F42 /* CKLBLuaLibBIN.cpp */,\n\t\t\t\t327C0CAB179A3ECB007B7F42 /* CKLBLuaLibBIN.h */,\n\t\t\t\t327C0CAC179A3ECB007B7F42 /* CKLBLuaLibCONV.h */,\n\t\t\t\t327C0CAD179A3ECB007B7F42 /* CKLBLuaLibDATA.h */,\n\t\t\t\t327C0CAE179A3ECB007B7F42 /* CKLBLuaLibDB.cpp */,\n\t\t\t\t327C0CAF179A3ECB007B7F42 /* CKLBLuaLibDB.h */,\n\t\t\t\t327C0CB0179A3ECB007B7F42 /* CKLBLuaLibDEBUG.cpp */,\n\t\t\t\t327C0CB1179A3ECB007B7F42 /* CKLBLuaLibDEBUG.h */,\n\t\t\t\t327C0CB2179A3ECB007B7F42 /* CKLBLuaLibKEY.h */,\n\t\t\t\t327C0CB3179A3ECB007B7F42 /* CKLBLuaLibLANG.cpp */,\n\t\t\t\t327C0CB4179A3ECB007B7F42 /* CKLBLuaLibLANG.h */,\n\t\t\t\t327C0CB5179A3ECB007B7F42 /* CKLBLuaLibMatrix.h */,\n\t\t\t\t327C0CB6179A3ECB007B7F42 /* CKLBLuaLibRES.cpp */,\n\t\t\t\t327C0CB7179A3ECB007B7F42 /* CKLBLuaLibRES.h */,\n\t\t\t\t327C0CB8179A3ECB007B7F42 /* CKLBLuaLibTASK.h */,\n\t\t\t\t327C0CB9179A3ECB007B7F42 /* CKLBLuaLibUI.cpp */,\n\t\t\t\t327C0CBA179A3ECB007B7F42 /* CKLBLuaLibUI.h */,\n\t\t\t\t327C0CBB179A3ECB007B7F42 /* ILuaFuncLib.h */,\n\t\t\t);\n\t\t\tname = LuaLib;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BAB179A3A16007B7F42 /* HTTP */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0C7A179A3EAF007B7F42 /* CKLBStoreService.cpp */,\n\t\t\t\t327C0C7B179A3EAF007B7F42 /* CKLBStoreService.h */,\n\t\t\t\t327C0C7C179A3EAF007B7F42 /* CKLBNetAPI.cpp */,\n\t\t\t\t327C0C7D179A3EAF007B7F42 /* CKLBNetAPI.h */,\n\t\t\t\t327C0C7E179A3EAF007B7F42 /* MultithreadedNetwork.h */,\n\t\t\t\t327C0C7F179A3EAF007B7F42 /* CKLBHTTPInterface.cpp */,\n\t\t\t\t327C0C80179A3EAF007B7F42 /* CKLBHTTPInterface.h */,\n\t\t\t\t327C0C81179A3EAF007B7F42 /* CKLBUpdate.cpp */,\n\t\t\t\t327C0C82179A3EAF007B7F42 /* CUnZip.cpp */,\n\t\t\t\t327C0C83179A3EAF007B7F42 /* CKLBJsonItem.cpp */,\n\t\t\t\t327C0C84179A3EAF007B7F42 /* MultithreadedNetwork.cpp */,\n\t\t\t\t327C0C85179A3EAF007B7F42 /* CKLBNetAPIKeyChain.h */,\n\t\t\t\t327C0C86179A3EAF007B7F42 /* CKLBUpdate.h */,\n\t\t\t\t327C0C87179A3EAF007B7F42 /* CKLBJsonItem.h */,\n\t\t\t\t327C0C88179A3EAF007B7F42 /* CKLBNetAPIKeyChain.cpp */,\n\t\t\t\t327C0C89179A3EAF007B7F42 /* CUnZip.h */,\n\t\t\t);\n\t\t\tname = HTTP;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BAC179A3A1C007B7F42 /* Database */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0C6D179A3E98007B7F42 /* CKLBDatabase.cpp */,\n\t\t\t\t327C0C6E179A3E98007B7F42 /* DataSet.h */,\n\t\t\t\t327C0C6F179A3E98007B7F42 /* CKLBLuaDB.cpp */,\n\t\t\t\t327C0C70179A3E98007B7F42 /* CKLBDatabase.h */,\n\t\t\t\t327C0C71179A3E98007B7F42 /* CKLBLuaDB.h */,\n\t\t\t\t327C0C72179A3E98007B7F42 /* CKLBLanguageDatabase.cpp */,\n\t\t\t\t327C0C73179A3E98007B7F42 /* CKLBLanguageDatabase.h */,\n\t\t\t\t327C0C74179A3E98007B7F42 /* DataSet_JSonDB.cpp */,\n\t\t\t\t327C0C75179A3E98007B7F42 /* DataSet_JSonDB.h */,\n\t\t\t);\n\t\t\tname = Database;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BAD179A3A2A007B7F42 /* porting */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6F65D8CE179CE0C300E9F3CE /* glUtil */,\n\t\t\t\t328401EA179A577000B0CA20 /* include */,\n\t\t\t\t6F65D8CA179CE01300E9F3CE /* OpenGLRenderer.h */,\n\t\t\t\t6F65D8CB179CE01300E9F3CE /* OpenGLRenderer.mm */,\n\t\t\t\t6F65D8C7179CDDD900E9F3CE /* NSGLView.h */,\n\t\t\t\t6F65D8C8179CDDD900E9F3CE /* NSGLView.mm */,\n\t\t\t\t328401C8179A576300B0CA20 /* assert.mm */,\n\t\t\t\t328401C9179A576300B0CA20 /* CiOSAudio.mm */,\n\t\t\t\t328401C6179A576300B0CA20 /* CiOSAudioManager.mm */,\n\t\t\t\t328401D4179A576300B0CA20 /* CiOSMovieView.mm */,\n\t\t\t\t328401CF179A576300B0CA20 /* CiOSPathConv.mm */,\n\t\t\t\t328401C5179A576300B0CA20 /* CiOSPlatform.mm */,\n\t\t\t\t328401CE179A576300B0CA20 /* CiOSReadFileStream.cpp */,\n\t\t\t\t328401D5179A576300B0CA20 /* CiOSSysResource.mm */,\n\t\t\t\t328401D0179A576300B0CA20 /* CiOSTmpFile.cpp */,\n\t\t\t\t32F55E8E179B0796003807CE /* CiOSWebView.mm */,\n\t\t\t\t328401CA179A576300B0CA20 /* CiOSWidget.mm */,\n\t\t\t\t328401D6179A576300B0CA20 /* CiOSWriteFileStream.cpp */,\n\t\t\t\t328401D1179A576300B0CA20 /* CSockReadStream.cpp */,\n\t\t\t\t328401D7179A576300B0CA20 /* CSockWriteStream.cpp */,\n\t\t\t\t328401CB179A576300B0CA20 /* EAGLView.mm */,\n\t\t\t\t3212706C18253C800027C57E /* FileDelete.cpp */,\n\t\t\t\t3212706D18253C800027C57E /* FontRendering.cpp */,\n\t\t\t);\n\t\t\tname = porting;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BAE179A3A32007B7F42 /* include */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0BB8179A3B52007B7F42 /* CPFInterface.h */,\n\t\t\t\t327C0BB9179A3B52007B7F42 /* RenderingFramework.h */,\n\t\t\t\t327C0BBA179A3B52007B7F42 /* encryptFile.h */,\n\t\t\t\t328401C4179A50F700B0CA20 /* KLBPlatformMetrics.h */,\n\t\t\t\t327C0BBB179A3B52007B7F42 /* KLBPlatformMetricsCommon.h */,\n\t\t\t\t327C0BBC179A3B52007B7F42 /* CSoundAnalysis.h */,\n\t\t\t\t327C0BBD179A3B52007B7F42 /* mem.h */,\n\t\t\t\t327C0BBF179A3B52007B7F42 /* BaseType.h */,\n\t\t\t\t327C0BC0179A3B52007B7F42 /* FileSystem.h */,\n\t\t\t\t327C0BC1179A3B52007B7F42 /* OSWidget.h */,\n\t\t\t\t327C0BC2179A3B52007B7F42 /* assert_klb.h */,\n\t\t\t\t327C0BC3179A3B52007B7F42 /* ITmpFile.h */,\n\t\t\t\t327C0BC4179A3B52007B7F42 /* klb_vararg.h */,\n\t\t\t);\n\t\t\tname = include;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BAF179A3A36007B7F42 /* SceneGraph */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0CF9179A3F4D007B7F42 /* CKLBNode.cpp */,\n\t\t\t\t327C0CFA179A3F4D007B7F42 /* CKLBNode.h */,\n\t\t\t);\n\t\t\tname = SceneGraph;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB0179A3A3B007B7F42 /* Rendering */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0CD1179A3F34007B7F42 /* CKLBRenderingManager.cpp */,\n\t\t\t\t327C0CD2179A3F34007B7F42 /* CRenderingManager_GL1.cpp */,\n\t\t\t\t327C0CD3179A3F34007B7F42 /* CRenderingManager_GL2.cpp */,\n\t\t\t\t327C0CD4179A3F34007B7F42 /* CRenderingManager.cpp */,\n\t\t\t\t327C0CD5179A3F34007B7F42 /* CTextureUsage.cpp */,\n\t\t\t\t327C0CD6179A3F34007B7F42 /* CBuffer.cpp */,\n\t\t\t\t327C0CD7179A3F34007B7F42 /* CIndexBuffer.cpp */,\n\t\t\t\t327C0CD8179A3F34007B7F42 /* CKLBRendering.h */,\n\t\t\t\t327C0CD9179A3F34007B7F42 /* CTextureBase.cpp */,\n\t\t\t\t327C0CDA179A3F34007B7F42 /* glWrapper.h */,\n\t\t\t\t327C0CDB179A3F34007B7F42 /* glWrapper.cpp */,\n\t\t\t\t327C0CDC179A3F34007B7F42 /* CFrame.cpp */,\n\t\t\t\t327C0CDD179A3F34007B7F42 /* CImageBuffer.cpp */,\n\t\t\t\t327C0CDE179A3F34007B7F42 /* CKLBCanvasSprite.cpp */,\n\t\t\t\t327C0CDF179A3F34007B7F42 /* CKLBCanvasSprite.h */,\n\t\t\t\t327C0CE0179A3F34007B7F42 /* CKLBSprite3D.cpp */,\n\t\t\t\t327C0CE1179A3F34007B7F42 /* CKLBSprite3D.h */,\n\t\t\t\t327C0CE2179A3F34007B7F42 /* CShaderSet.cpp */,\n\t\t\t\t327C0CE3179A3F34007B7F42 /* CShaderSetInstance.cpp */,\n\t\t\t\t327C0CE4179A3F34007B7F42 /* CTexture.cpp */,\n\t\t\t\t327C0CE6179A3F34007B7F42 /* shaderSource.inl */,\n\t\t\t);\n\t\t\tname = Rendering;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB1179A3A42007B7F42 /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0D01179A4052007B7F42 /* Scripting */,\n\t\t\t\t327C0C0E179A3E7A007B7F42 /* CKLBTask.cpp */,\n\t\t\t\t327C0C0F179A3E7A007B7F42 /* CKLBTask.h */,\n\t\t\t\t327C0C10179A3E7A007B7F42 /* ArrayAllocator.h */,\n\t\t\t\t327C0C11179A3E7A007B7F42 /* CKLBAsyncFilecopy.cpp */,\n\t\t\t\t327C0C12179A3E7A007B7F42 /* CKLBGameApplication.cpp */,\n\t\t\t\t327C0C13179A3E7A007B7F42 /* CKLBGameApplication.h */,\n\t\t\t\t327C0C14179A3E7A007B7F42 /* CKLBLuaEnv.cpp */,\n\t\t\t\t327C0C15179A3E7A007B7F42 /* CKLBUITask.cpp */,\n\t\t\t\t327C0C16179A3E7A007B7F42 /* encryptFile.cpp */,\n\t\t\t\t327C0C17179A3E7A007B7F42 /* CKLBAsyncFilecopy.h */,\n\t\t\t\t327C0C18179A3E7A007B7F42 /* CKLBScriptEnv.h */,\n\t\t\t\t327C0C19179A3E7A007B7F42 /* CLuaState.h */,\n\t\t\t\t327C0C1A179A3E7A007B7F42 /* CKLBDebugger.cpp */,\n\t\t\t\t327C0C1B179A3E7A007B7F42 /* CKLBGameApplicationDebugModule.cpp */,\n\t\t\t\t327C0C1C179A3E7A007B7F42 /* CKLBIntervalTimer.cpp */,\n\t\t\t\t327C0C1D179A3E7A007B7F42 /* CKLBLuaPropTask.cpp */,\n\t\t\t\t327C0C1E179A3E7A007B7F42 /* CKLBUtility.cpp */,\n\t\t\t\t327C0C1F179A3E7A007B7F42 /* CKLBDataHandler.cpp */,\n\t\t\t\t327C0C20179A3E7A007B7F42 /* Dictionnary.cpp */,\n\t\t\t\t327C0C21179A3E7A007B7F42 /* CKLBBinArray.cpp */,\n\t\t\t\t327C0C22179A3E7A007B7F42 /* CKLBContext.cpp */,\n\t\t\t\t327C0C23179A3E7A007B7F42 /* CKLBLuaTask.h */,\n\t\t\t\t327C0C24179A3E7A007B7F42 /* CKLBUtility.h */,\n\t\t\t\t327C0C25179A3E7A007B7F42 /* DebugAlloc.cpp */,\n\t\t\t\t327C0C26179A3E7A007B7F42 /* DebugTracker.cpp */,\n\t\t\t\t327C0C27179A3E7A007B7F42 /* DebugTracker.h */,\n\t\t\t\t327C0C28179A3E7A007B7F42 /* CKLBAction.h */,\n\t\t\t\t327C0C29179A3E7A007B7F42 /* CKLBAppProperty.cpp */,\n\t\t\t\t327C0C2A179A3E7A007B7F42 /* CKLBAppProperty.h */,\n\t\t\t\t327C0C2B179A3E7A007B7F42 /* CKLBAsyncLoader.cpp */,\n\t\t\t\t327C0C2C179A3E7A007B7F42 /* CKLBAsyncLoader.h */,\n\t\t\t\t327C0C2D179A3E7A007B7F42 /* CKLBBinArray.h */,\n\t\t\t\t327C0C2F179A3E7A007B7F42 /* CKLBDataHandler.h */,\n\t\t\t\t327C0C30179A3E7A007B7F42 /* CKLBDebugger.h */,\n\t\t\t\t327C0C33179A3E7A007B7F42 /* CKLBGenericTask.cpp */,\n\t\t\t\t327C0C34179A3E7A007B7F42 /* CKLBGenericTask.h */,\n\t\t\t\t327C0C35179A3E7A007B7F42 /* CKLBIntervalTimer.h */,\n\t\t\t\t327C0C36179A3E7A007B7F42 /* CKLBLibRegistrator.cpp */,\n\t\t\t\t327C0C37179A3E7A007B7F42 /* CKLBLibRegistrator.h */,\n\t\t\t\t327C0C38179A3E7A007B7F42 /* CKLBLifeCtrlTask.cpp */,\n\t\t\t\t327C0C39179A3E7A007B7F42 /* CKLBLifeCtrlTask.h */,\n\t\t\t\t327C0C3A179A3E7A007B7F42 /* CKLBLuaEnv.h */,\n\t\t\t\t327C0C3B179A3E7A007B7F42 /* CKLBLuaPropTask.h */,\n\t\t\t\t327C0C3C179A3E7A007B7F42 /* CKLBLuaTask.cpp */,\n\t\t\t\t327C0C3D179A3E7A007B7F42 /* CKLBObject.cpp */,\n\t\t\t\t327C0C3E179A3E7A007B7F42 /* CKLBObject.h */,\n\t\t\t\t327C0C3F179A3E7A007B7F42 /* CKLBPauseCtrl.cpp */,\n\t\t\t\t327C0C40179A3E7A007B7F42 /* CKLBPauseCtrl.h */,\n\t\t\t\t327C0C42179A3E7A007B7F42 /* CKLBTextTempBuffer.cpp */,\n\t\t\t\t327C0C43179A3E7A007B7F42 /* CKLBTextTempBuffer.h */,\n\t\t\t\t327C0C44179A3E7A007B7F42 /* CKLBUITask.h */,\n\t\t\t\t327C0C45179A3E7A007B7F42 /* CLuaState.cpp */,\n\t\t\t\t327C0C46179A3E7A007B7F42 /* CPFInterface.cpp */,\n\t\t\t\t327C0C47179A3E7A007B7F42 /* DebugAlloc.h */,\n\t\t\t\t327C0C48179A3E7A007B7F42 /* Dictionnary.h */,\n\t\t\t\t327C0C49179A3E7A007B7F42 /* ITmpFile.cpp */,\n\t\t\t\t327C0C4A179A3E7A007B7F42 /* Message.h */,\n\t\t\t);\n\t\t\tname = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB2179A3A44007B7F42 /* Assets */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0BF0179A3E63007B7F42 /* CKLBTexturePacker.cpp */,\n\t\t\t\t327C0BF1179A3E63007B7F42 /* CKLBTexturePacker.h */,\n\t\t\t\t327C0BF2179A3E63007B7F42 /* CompositeManagement.cpp */,\n\t\t\t\t327C0BF3179A3E63007B7F42 /* TextureManagement.cpp */,\n\t\t\t\t327C0BF4179A3E63007B7F42 /* CKLBAssetManager.cpp */,\n\t\t\t\t327C0BF5179A3E63007B7F42 /* AudioAsset.cpp */,\n\t\t\t\t327C0BF6179A3E63007B7F42 /* CKLBAsset.h */,\n\t\t\t\t327C0BF7179A3E63007B7F42 /* CompositeManagement.h */,\n\t\t\t\t327C0BFA179A3E63007B7F42 /* AudioAsset.h */,\n\t\t\t\t327C0BFD179A3E63007B7F42 /* CKLBPropertyBag.cpp */,\n\t\t\t\t327C0BFE179A3E63007B7F42 /* CKLBPropertyBag.h */,\n\t\t\t\t327C0C01179A3E63007B7F42 /* NodeAnimationAsset.cpp */,\n\t\t\t\t327C0C02179A3E63007B7F42 /* NodeAnimationAsset.h */,\n\t\t\t\t327C0C03179A3E63007B7F42 /* TextureManagement.h */,\n\t\t\t);\n\t\t\tname = Assets;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB3179A3A46007B7F42 /* Animation */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0BDD179A3E4A007B7F42 /* CKLBNodeVirtualDocument.cpp */,\n\t\t\t\t327C0BDE179A3E4A007B7F42 /* CKLBSplineNode.h */,\n\t\t\t\t327C0BDF179A3E4A007B7F42 /* CKLBSplineNode.cpp */,\n\t\t\t\t327C0BE0179A3E4A007B7F42 /* CKLBSWFPlayer.cpp */,\n\t\t\t\t327C0BE1179A3E4A007B7F42 /* CKLBNodeVirtualDocument.h */,\n\t\t\t\t327C0BE4179A3E4A007B7F42 /* CKLBScoreNode.cpp */,\n\t\t\t\t327C0BE5179A3E4A007B7F42 /* CKLBScoreNode.h */,\n\t\t\t\t327C0BE6179A3E4A007B7F42 /* CKLBSWFPlayer.h */,\n\t\t\t\t327C0BE7179A3E4A007B7F42 /* CKLBSystem.cpp */,\n\t\t\t);\n\t\t\tname = Animation;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB4179A3A49007B7F42 /* SystemTask */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32127068182532090027C57E /* CKLBDeviceKeyEvent.cpp */,\n\t\t\t\t32127069182532090027C57E /* CKLBDeviceKeyEvent.h */,\n\t\t\t\t327C0D04179A41AE007B7F42 /* CKLBDrawTask.cpp */,\n\t\t\t\t327C0D05179A41AE007B7F42 /* CKLBDebugMenu.cpp */,\n\t\t\t\t327C0D06179A41AE007B7F42 /* CKLBDebugMenu.h */,\n\t\t\t\t327C0D07179A41AE007B7F42 /* CKLBTouchPad.cpp */,\n\t\t\t\t327C0D08179A41AE007B7F42 /* CKLBTouchPad.h */,\n\t\t\t\t327C0D09179A41AE007B7F42 /* CKLBTouchEventUI.cpp */,\n\t\t\t\t327C0D0A179A41AE007B7F42 /* CKLBDrawTask.h */,\n\t\t\t\t327C0D0B179A41AE007B7F42 /* CKLBOSCtrlEvent.cpp */,\n\t\t\t\t327C0D0C179A41AE007B7F42 /* CKLBOSCtrlEvent.h */,\n\t\t\t\t327C0D0D179A41AE007B7F42 /* CKLBLuaScript.cpp */,\n\t\t\t\t327C0D0E179A41AE007B7F42 /* CKLBLuaScript.h */,\n\t\t\t\t327C0D0F179A41AE007B7F42 /* CKLBTouchEventUI.h */,\n\t\t\t);\n\t\t\tname = SystemTask;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB5179A3A5A007B7F42 /* libs */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE9B179A4F8900B0CA20 /* freeType */,\n\t\t\t\t3284FE00179A4AD000B0CA20 /* GL */,\n\t\t\t\t3284FE76179A4F5900B0CA20 /* JSonParser */,\n\t\t\t\t327C0BC9179A3C34007B7F42 /* libCurl */,\n\t\t\t\t3284FE04179A4B1600B0CA20 /* lua */,\n\t\t\t\t3284FE6B179A4F3B00B0CA20 /* minizip */,\n\t\t\t\t3284FE5E179A4EDC00B0CA20 /* sha1 */,\n\t\t\t\t3284FE62179A4EFF00B0CA20 /* SQLite */,\n\t\t\t\t3284FE67179A4F0F00B0CA20 /* utf8_converter */,\n\t\t\t);\n\t\t\tname = libs;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BB6179A3A5C007B7F42 /* UISystem */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0D16179A41BE007B7F42 /* CKLBUIVirtualDoc.cpp */,\n\t\t\t\t327C0D17179A41BE007B7F42 /* CKLBUIList.cpp */,\n\t\t\t\t327C0D18179A41BE007B7F42 /* CKLBScrMgrDefault.cpp */,\n\t\t\t\t327C0D19179A41BE007B7F42 /* CKLBScrMgrDefault.h */,\n\t\t\t\t327C0D1A179A41BE007B7F42 /* CKLBScrMgrPage.cpp */,\n\t\t\t\t327C0D1B179A41BE007B7F42 /* CKLBScrMgrPage.h */,\n\t\t\t\t327C0D1C179A41BE007B7F42 /* CKLBUICanvas.cpp */,\n\t\t\t\t327C0D1D179A41BE007B7F42 /* CKLBUIDragIcon.cpp */,\n\t\t\t\t327C0D1E179A41BE007B7F42 /* CKLBUIFreeVertItem.cpp */,\n\t\t\t\t327C0D1F179A41BE007B7F42 /* CKLBUIFreeVertItem.h */,\n\t\t\t\t327C0D20179A41BE007B7F42 /* CKLBUIList.h */,\n\t\t\t\t327C0D21179A41BE007B7F42 /* CKLBUIProgressBar.cpp */,\n\t\t\t\t327C0D22179A41BE007B7F42 /* CKLBUIVariableItem.cpp */,\n\t\t\t\t327C0D23179A41BE007B7F42 /* CKLBScrMgrSolid.cpp */,\n\t\t\t\t327C0D24179A41BE007B7F42 /* CKLBScrMgrSolid.h */,\n\t\t\t\t327C0D25179A41BE007B7F42 /* CKLBScrollBarIF.cpp */,\n\t\t\t\t327C0D26179A41BE007B7F42 /* CKLBScrollBarIF.h */,\n\t\t\t\t327C0D27179A41BE007B7F42 /* CKLBLabelNode.cpp */,\n\t\t\t\t327C0D28179A41BE007B7F42 /* CKLBMovieNode.cpp */,\n\t\t\t\t327C0D29179A41BE007B7F42 /* CKLBTextInputNode.cpp */,\n\t\t\t\t327C0D2A179A41BE007B7F42 /* CKLBUIDebugItem.cpp */,\n\t\t\t\t327C0D2B179A41BE007B7F42 /* CKLBUISystem.h */,\n\t\t\t\t327C0D2C179A41BE007B7F42 /* CKLBUIWebArea.cpp */,\n\t\t\t\t327C0D2D179A41BE007B7F42 /* CKLBWebViewNode.cpp */,\n\t\t\t\t327C0D2E179A41BE007B7F42 /* CKLBUIClip.cpp */,\n\t\t\t\t327C0D2F179A41BE007B7F42 /* CKLBUIMultiImgItem.cpp */,\n\t\t\t\t327C0D30179A41BE007B7F42 /* CKLBUISWFPlayer.cpp */,\n\t\t\t\t327C0D31179A41BE007B7F42 /* CKLBUISystem.cpp */,\n\t\t\t\t327C0D32179A41BE007B7F42 /* CKLBUITouchPad.cpp */,\n\t\t\t\t327C0D33179A41BE007B7F42 /* CKLBUIForm.cpp */,\n\t\t\t\t327C0D34179A41BE007B7F42 /* CKLBUILabel.cpp */,\n\t\t\t\t327C0D35179A41BE007B7F42 /* CKLBUISWFPlayer.h */,\n\t\t\t\t327C0D36179A41BE007B7F42 /* CKLBUIVariableItem.h */,\n\t\t\t\t327C0D37179A41BE007B7F42 /* CKLBLabelNode.h */,\n\t\t\t\t327C0D38179A41BE007B7F42 /* CKLBUIVirtualDoc.h */,\n\t\t\t\t327C0D39179A41BE007B7F42 /* CKLBUIControl.cpp */,\n\t\t\t\t327C0D3A179A41BE007B7F42 /* CKLBUITextInput.h */,\n\t\t\t\t327C0D3B179A41BE007B7F42 /* CKLBTextInputNode.h */,\n\t\t\t\t327C0D3C179A41BE007B7F42 /* CKLBUIScale9.cpp */,\n\t\t\t\t327C0D3D179A41BE007B7F42 /* CKLBUITextInput.cpp */,\n\t\t\t\t327C0D3E179A41BE007B7F42 /* CKLBActivityIndicatorNode.cpp */,\n\t\t\t\t327C0D3F179A41BE007B7F42 /* CKLBActivityIndicatorNode.h */,\n\t\t\t\t327C0D40179A41BE007B7F42 /* CKLBDragCallbackIF.cpp */,\n\t\t\t\t327C0D41179A41BE007B7F42 /* CKLBDragCallbackIF.h */,\n\t\t\t\t327C0D42179A41BE007B7F42 /* CKLBFormGroup.cpp */,\n\t\t\t\t327C0D43179A41BE007B7F42 /* CKLBFormGroup.h */,\n\t\t\t\t327C0D44179A41BE007B7F42 /* CKLBFormIF.cpp */,\n\t\t\t\t327C0D45179A41BE007B7F42 /* CKLBFormIF.h */,\n\t\t\t\t327C0D46179A41BE007B7F42 /* CKLBModalStack.cpp */,\n\t\t\t\t327C0D47179A41BE007B7F42 /* CKLBModalStack.h */,\n\t\t\t\t327C0D48179A41BE007B7F42 /* CKLBMovieNode.h */,\n\t\t\t\t327C0D49179A41BE007B7F42 /* CKLBNodeAnimPack.cpp */,\n\t\t\t\t327C0D4A179A41BE007B7F42 /* CKLBNodeAnimPack.h */,\n\t\t\t\t327C0D4B179A41BE007B7F42 /* CKLBUIActivityIndicator.cpp */,\n\t\t\t\t327C0D4C179A41BE007B7F42 /* CKLBUIActivityIndicator.h */,\n\t\t\t\t327C0D4D179A41BE007B7F42 /* CKLBUICanvas.h */,\n\t\t\t\t327C0D50179A41BE007B7F42 /* CKLBUIClip.h */,\n\t\t\t\t327C0D51179A41BE007B7F42 /* CKLBUIControl.h */,\n\t\t\t\t327C0D52179A41BE007B7F42 /* CKLBUIDebugItem.h */,\n\t\t\t\t327C0D53179A41BE007B7F42 /* CKLBUIDragIcon.h */,\n\t\t\t\t327C0D54179A41BE007B7F42 /* CKLBUIForm.h */,\n\t\t\t\t327C0D55179A41BE007B7F42 /* CKLBUIGroup.cpp */,\n\t\t\t\t327C0D56179A41BE007B7F42 /* CKLBUIGroup.h */,\n\t\t\t\t327C0D57179A41BE007B7F42 /* CKLBUILabel.h */,\n\t\t\t\t327C0D58179A41BE007B7F42 /* CKLBUIMoviePlayer.cpp */,\n\t\t\t\t327C0D59179A41BE007B7F42 /* CKLBUIMoviePlayer.h */,\n\t\t\t\t327C0D5A179A41BE007B7F42 /* CKLBUIMultiImgItem.h */,\n\t\t\t\t327C0D5B179A41BE007B7F42 /* CKLBUIPieChart.cpp */,\n\t\t\t\t327C0D5C179A41BE007B7F42 /* CKLBUIPieChart.h */,\n\t\t\t\t327C0D5D179A41BE007B7F42 /* CKLBUIPolyline.cpp */,\n\t\t\t\t327C0D5E179A41BE007B7F42 /* CKLBUIPolyline.h */,\n\t\t\t\t327C0D5F179A41BE007B7F42 /* CKLBUIProgressBar.h */,\n\t\t\t\t327C0D60179A41BE007B7F42 /* CKLBUIRubberBand.cpp */,\n\t\t\t\t327C0D61179A41BE007B7F42 /* CKLBUIRubberBand.h */,\n\t\t\t\t327C0D62179A41BE007B7F42 /* CKLBUIScale9.h */,\n\t\t\t\t327C0D63179A41BE007B7F42 /* CKLBUIScore.cpp */,\n\t\t\t\t327C0D64179A41BE007B7F42 /* CKLBUIScore.h */,\n\t\t\t\t327C0D65179A41BE007B7F42 /* CKLBUIScrollBar.cpp */,\n\t\t\t\t327C0D66179A41BE007B7F42 /* CKLBUIScrollBar.h */,\n\t\t\t\t327C0D67179A41BE007B7F42 /* CKLBUISimpleItem.cpp */,\n\t\t\t\t327C0D68179A41BE007B7F42 /* CKLBUISimpleItem.h */,\n\t\t\t\t327C0D69179A41BE007B7F42 /* CKLBUITouchPad.h */,\n\t\t\t\t327C0D6A179A41BE007B7F42 /* CKLBUIWebArea.h */,\n\t\t\t\t327C0D6B179A41BE007B7F42 /* CKLBWebViewNode.h */,\n\t\t\t\t327C0D6C179A41BE007B7F42 /* IMgrEntry.cpp */,\n\t\t\t\t327C0D6D179A41BF007B7F42 /* IMgrEntry.h */,\n\t\t\t);\n\t\t\tname = UISystem;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0BC9179A3C34007B7F42 /* libCurl */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FDEE179A457100B0CA20 /* curl.h */,\n\t\t\t\t3284FDEF179A457100B0CA20 /* curlbuild.h */,\n\t\t\t\t3284FDF0179A457100B0CA20 /* curlrules.h */,\n\t\t\t\t3284FDF1179A457100B0CA20 /* curlver.h */,\n\t\t\t\t3284FDF2179A457100B0CA20 /* easy.h */,\n\t\t\t\t3284FDF3179A457100B0CA20 /* mprintf.h */,\n\t\t\t\t3284FDF4179A457100B0CA20 /* multi.h */,\n\t\t\t\t3284FDF5179A457100B0CA20 /* stdcheaders.h */,\n\t\t\t\t3284FDF6179A457100B0CA20 /* typecheck-gcc.h */,\n\t\t\t);\n\t\t\tname = libCurl;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0D01179A4052007B7F42 /* Scripting */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0D02179A408E007B7F42 /* CKLBScriptEnv_forLUA.cpp */,\n\t\t\t);\n\t\t\tname = Scripting;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32840019179A4FB300B0CA20 /* truetype */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284001D179A4FB300B0CA20 /* truetype.c */,\n\t\t\t);\n\t\t\tpath = truetype;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284002F179A4FB300B0CA20 /* type1 */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32840041179A4FB300B0CA20 /* type1.c */,\n\t\t\t);\n\t\t\tpath = type1;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32840042179A4FB300B0CA20 /* type42 */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284004E179A4FB300B0CA20 /* type42.c */,\n\t\t\t);\n\t\t\tpath = type42;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284004F179A4FB300B0CA20 /* winfonts */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32840054179A4FB300B0CA20 /* winfnt.c */,\n\t\t\t);\n\t\t\tpath = winfonts;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32840169179A4FC700B0CA20 /* include */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284016A179A4FC700B0CA20 /* freetype */,\n\t\t\t\t328401C3179A4FC700B0CA20 /* ft2build.h */,\n\t\t\t);\n\t\t\tname = include;\n\t\t\tpath = ../../../libs/freeType/include;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284016A179A4FC700B0CA20 /* freetype */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284016B179A4FC700B0CA20 /* config */,\n\t\t\t\t32840171179A4FC700B0CA20 /* freetype.h */,\n\t\t\t\t32840172179A4FC700B0CA20 /* ftadvanc.h */,\n\t\t\t\t32840173179A4FC700B0CA20 /* ftautoh.h */,\n\t\t\t\t32840174179A4FC700B0CA20 /* ftbbox.h */,\n\t\t\t\t32840175179A4FC700B0CA20 /* ftbdf.h */,\n\t\t\t\t32840176179A4FC700B0CA20 /* ftbitmap.h */,\n\t\t\t\t32840177179A4FC700B0CA20 /* ftbzip2.h */,\n\t\t\t\t32840178179A4FC700B0CA20 /* ftcache.h */,\n\t\t\t\t32840179179A4FC700B0CA20 /* ftchapters.h */,\n\t\t\t\t3284017A179A4FC700B0CA20 /* ftcid.h */,\n\t\t\t\t3284017B179A4FC700B0CA20 /* fterrdef.h */,\n\t\t\t\t3284017C179A4FC700B0CA20 /* fterrors.h */,\n\t\t\t\t3284017D179A4FC700B0CA20 /* ftgasp.h */,\n\t\t\t\t3284017E179A4FC700B0CA20 /* ftglyph.h */,\n\t\t\t\t3284017F179A4FC700B0CA20 /* ftgxval.h */,\n\t\t\t\t32840180179A4FC700B0CA20 /* ftgzip.h */,\n\t\t\t\t32840181179A4FC700B0CA20 /* ftimage.h */,\n\t\t\t\t32840182179A4FC700B0CA20 /* ftincrem.h */,\n\t\t\t\t32840183179A4FC700B0CA20 /* ftlcdfil.h */,\n\t\t\t\t32840184179A4FC700B0CA20 /* ftlist.h */,\n\t\t\t\t32840185179A4FC700B0CA20 /* ftlzw.h */,\n\t\t\t\t32840186179A4FC700B0CA20 /* ftmac.h */,\n\t\t\t\t32840187179A4FC700B0CA20 /* ftmm.h */,\n\t\t\t\t32840188179A4FC700B0CA20 /* ftmodapi.h */,\n\t\t\t\t32840189179A4FC700B0CA20 /* ftmoderr.h */,\n\t\t\t\t3284018A179A4FC700B0CA20 /* ftotval.h */,\n\t\t\t\t3284018B179A4FC700B0CA20 /* ftoutln.h */,\n\t\t\t\t3284018C179A4FC700B0CA20 /* ftpfr.h */,\n\t\t\t\t3284018D179A4FC700B0CA20 /* ftrender.h */,\n\t\t\t\t3284018E179A4FC700B0CA20 /* ftsizes.h */,\n\t\t\t\t3284018F179A4FC700B0CA20 /* ftsnames.h */,\n\t\t\t\t32840190179A4FC700B0CA20 /* ftstroke.h */,\n\t\t\t\t32840191179A4FC700B0CA20 /* ftsynth.h */,\n\t\t\t\t32840192179A4FC700B0CA20 /* ftsystem.h */,\n\t\t\t\t32840193179A4FC700B0CA20 /* fttrigon.h */,\n\t\t\t\t32840194179A4FC700B0CA20 /* fttypes.h */,\n\t\t\t\t32840195179A4FC700B0CA20 /* ftwinfnt.h */,\n\t\t\t\t32840196179A4FC700B0CA20 /* ftxf86.h */,\n\t\t\t\t32840197179A4FC700B0CA20 /* internal */,\n\t\t\t\t328401BE179A4FC700B0CA20 /* t1tables.h */,\n\t\t\t\t328401BF179A4FC700B0CA20 /* ttnameid.h */,\n\t\t\t\t328401C0179A4FC700B0CA20 /* tttables.h */,\n\t\t\t\t328401C1179A4FC700B0CA20 /* tttags.h */,\n\t\t\t\t328401C2179A4FC700B0CA20 /* ttunpat.h */,\n\t\t\t);\n\t\t\tpath = freetype;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284016B179A4FC700B0CA20 /* config */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284016C179A4FC700B0CA20 /* ftconfig.h */,\n\t\t\t\t3284016D179A4FC700B0CA20 /* ftheader.h */,\n\t\t\t\t3284016E179A4FC700B0CA20 /* ftmodule.h */,\n\t\t\t\t3284016F179A4FC700B0CA20 /* ftoption.h */,\n\t\t\t\t32840170179A4FC700B0CA20 /* ftstdlib.h */,\n\t\t\t);\n\t\t\tpath = config;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32840197179A4FC700B0CA20 /* internal */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32840198179A4FC700B0CA20 /* autohint.h */,\n\t\t\t\t32840199179A4FC700B0CA20 /* ftcalc.h */,\n\t\t\t\t3284019A179A4FC700B0CA20 /* ftdebug.h */,\n\t\t\t\t3284019B179A4FC700B0CA20 /* ftdriver.h */,\n\t\t\t\t3284019C179A4FC700B0CA20 /* ftgloadr.h */,\n\t\t\t\t3284019D179A4FC700B0CA20 /* ftmemory.h */,\n\t\t\t\t3284019E179A4FC700B0CA20 /* ftobjs.h */,\n\t\t\t\t3284019F179A4FC700B0CA20 /* ftpic.h */,\n\t\t\t\t328401A0179A4FC700B0CA20 /* ftrfork.h */,\n\t\t\t\t328401A1179A4FC700B0CA20 /* ftserv.h */,\n\t\t\t\t328401A2179A4FC700B0CA20 /* ftstream.h */,\n\t\t\t\t328401A3179A4FC700B0CA20 /* fttrace.h */,\n\t\t\t\t328401A4179A4FC700B0CA20 /* ftvalid.h */,\n\t\t\t\t328401A5179A4FC700B0CA20 /* internal.h */,\n\t\t\t\t328401A6179A4FC700B0CA20 /* psaux.h */,\n\t\t\t\t328401A7179A4FC700B0CA20 /* pshints.h */,\n\t\t\t\t328401A8179A4FC700B0CA20 /* services */,\n\t\t\t\t328401BB179A4FC700B0CA20 /* sfnt.h */,\n\t\t\t\t328401BC179A4FC700B0CA20 /* t1types.h */,\n\t\t\t\t328401BD179A4FC700B0CA20 /* tttypes.h */,\n\t\t\t);\n\t\t\tpath = internal;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t328401A8179A4FC700B0CA20 /* services */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t328401A9179A4FC700B0CA20 /* svbdf.h */,\n\t\t\t\t328401AA179A4FC700B0CA20 /* svcid.h */,\n\t\t\t\t328401AB179A4FC700B0CA20 /* svgldict.h */,\n\t\t\t\t328401AC179A4FC700B0CA20 /* svgxval.h */,\n\t\t\t\t328401AD179A4FC700B0CA20 /* svkern.h */,\n\t\t\t\t328401AE179A4FC700B0CA20 /* svmm.h */,\n\t\t\t\t328401AF179A4FC700B0CA20 /* svotval.h */,\n\t\t\t\t328401B0179A4FC700B0CA20 /* svpfr.h */,\n\t\t\t\t328401B1179A4FC700B0CA20 /* svpostnm.h */,\n\t\t\t\t328401B2179A4FC700B0CA20 /* svprop.h */,\n\t\t\t\t328401B3179A4FC700B0CA20 /* svpscmap.h */,\n\t\t\t\t328401B4179A4FC700B0CA20 /* svpsinfo.h */,\n\t\t\t\t328401B5179A4FC700B0CA20 /* svsfnt.h */,\n\t\t\t\t328401B6179A4FC700B0CA20 /* svttcmap.h */,\n\t\t\t\t328401B7179A4FC700B0CA20 /* svtteng.h */,\n\t\t\t\t328401B8179A4FC700B0CA20 /* svttglyf.h */,\n\t\t\t\t328401B9179A4FC700B0CA20 /* svwinfnt.h */,\n\t\t\t\t328401BA179A4FC700B0CA20 /* svxf86nm.h */,\n\t\t\t);\n\t\t\tpath = services;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t328401EA179A577000B0CA20 /* include */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t328401ED179A577900B0CA20 /* AppDelegate.h */,\n\t\t\t\t328401EE179A577900B0CA20 /* CiOSAudio.h */,\n\t\t\t\t328401EC179A577900B0CA20 /* CiOSAudioManager.h */,\n\t\t\t\t328401F7179A577900B0CA20 /* CiOSMovieView.h */,\n\t\t\t\t328401F8179A577900B0CA20 /* CiOSPathConv.h */,\n\t\t\t\t328401EB179A577900B0CA20 /* CiOSPlatform.h */,\n\t\t\t\t328401F2179A577900B0CA20 /* CiOSReadFileStream.h */,\n\t\t\t\t328401F9179A577900B0CA20 /* CiOSSysResource.h */,\n\t\t\t\t328401FA179A577900B0CA20 /* CiOSTextView.h */,\n\t\t\t\t328401FB179A577900B0CA20 /* CiOSTmpFile.h */,\n\t\t\t\t328401F0179A577900B0CA20 /* CiOSWebView.h */,\n\t\t\t\t328401F4179A577900B0CA20 /* CiOSWidget.h */,\n\t\t\t\t328401FC179A577900B0CA20 /* CiOSWriteFileStream.h */,\n\t\t\t\t328401FD179A577900B0CA20 /* CSockReadStream.h */,\n\t\t\t\t328401FE179A577900B0CA20 /* CSockWriteStream.h */,\n\t\t\t\t328401EF179A577900B0CA20 /* EAGLView.h */,\n\t\t\t\t32F55E92179B1493003807CE /* FontRendering.h */,\n\t\t\t\t3212706B18253C630027C57E /* FileDelete.h */,\n\t\t\t\t328401FF179A577900B0CA20 /* GLcommon.h */,\n\t\t\t\t328401F5179A577900B0CA20 /* iOSFileLocation.h */,\n\t\t\t\t328401F3179A577900B0CA20 /* KLBPlatformMetrics.h */,\n\t\t\t\t32840200179A577900B0CA20 /* NSData+Base64.h */,\n\t\t\t\t328401F6179A577900B0CA20 /* ViewController.h */,\n\t\t\t\t6F65D8CD179CE05900E9F3CE /* glUtil.h */,\n\t\t\t);\n\t\t\tname = include;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE00179A4AD000B0CA20 /* GL */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE01179A4ADB00B0CA20 /* glew.h */,\n\t\t\t\t3284FE02179A4ADB00B0CA20 /* glxew.h */,\n\t\t\t\t3284FE03179A4ADB00B0CA20 /* wglew.h */,\n\t\t\t);\n\t\t\tname = GL;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE04179A4B1600B0CA20 /* lua */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE05179A4B2B00B0CA20 /* lauxlib.h */,\n\t\t\t\t3284FE06179A4B2B00B0CA20 /* luaconf.h */,\n\t\t\t\t3284FE07179A4B2B00B0CA20 /* lapi.c */,\n\t\t\t\t3284FE08179A4B2B00B0CA20 /* lapi.h */,\n\t\t\t\t3284FE09179A4B2B00B0CA20 /* lauxlib.c */,\n\t\t\t\t3284FE0A179A4B2B00B0CA20 /* lbaselib.c */,\n\t\t\t\t3284FE0B179A4B2B00B0CA20 /* lbitlib.c */,\n\t\t\t\t3284FE0C179A4B2B00B0CA20 /* lcode.c */,\n\t\t\t\t3284FE0D179A4B2B00B0CA20 /* lcode.h */,\n\t\t\t\t3284FE0E179A4B2B00B0CA20 /* lcorolib.c */,\n\t\t\t\t3284FE0F179A4B2B00B0CA20 /* lctype.c */,\n\t\t\t\t3284FE10179A4B2B00B0CA20 /* lctype.h */,\n\t\t\t\t3284FE11179A4B2B00B0CA20 /* ldblib.c */,\n\t\t\t\t3284FE12179A4B2B00B0CA20 /* ldebug.c */,\n\t\t\t\t3284FE13179A4B2B00B0CA20 /* ldebug.h */,\n\t\t\t\t3284FE14179A4B2B00B0CA20 /* ldo.c */,\n\t\t\t\t3284FE15179A4B2B00B0CA20 /* ldo.h */,\n\t\t\t\t3284FE16179A4B2B00B0CA20 /* ldump.c */,\n\t\t\t\t3284FE17179A4B2B00B0CA20 /* lfunc.c */,\n\t\t\t\t3284FE18179A4B2B00B0CA20 /* lfunc.h */,\n\t\t\t\t3284FE19179A4B2B00B0CA20 /* lgc.c */,\n\t\t\t\t3284FE1A179A4B2B00B0CA20 /* lgc.h */,\n\t\t\t\t3284FE1B179A4B2B00B0CA20 /* linit.c */,\n\t\t\t\t3284FE1C179A4B2B00B0CA20 /* liolib.c */,\n\t\t\t\t3284FE1D179A4B2B00B0CA20 /* llex.c */,\n\t\t\t\t3284FE1E179A4B2B00B0CA20 /* llex.h */,\n\t\t\t\t3284FE1F179A4B2B00B0CA20 /* llimits.h */,\n\t\t\t\t3284FE20179A4B2B00B0CA20 /* lmathlib.c */,\n\t\t\t\t3284FE21179A4B2B00B0CA20 /* lmem.c */,\n\t\t\t\t3284FE22179A4B2B00B0CA20 /* lmem.h */,\n\t\t\t\t3284FE23179A4B2B00B0CA20 /* loadlib.c */,\n\t\t\t\t3284FE24179A4B2B00B0CA20 /* lobject.c */,\n\t\t\t\t3284FE25179A4B2B00B0CA20 /* lobject.h */,\n\t\t\t\t3284FE26179A4B2B00B0CA20 /* lopcodes.c */,\n\t\t\t\t3284FE27179A4B2B00B0CA20 /* lopcodes.h */,\n\t\t\t\t3284FE28179A4B2B00B0CA20 /* loslib.c */,\n\t\t\t\t3284FE29179A4B2B00B0CA20 /* lparser.c */,\n\t\t\t\t3284FE2A179A4B2B00B0CA20 /* lparser.h */,\n\t\t\t\t3284FE2B179A4B2B00B0CA20 /* lstate.c */,\n\t\t\t\t3284FE2C179A4B2B00B0CA20 /* lstate.h */,\n\t\t\t\t3284FE2D179A4B2B00B0CA20 /* lstring.c */,\n\t\t\t\t3284FE2E179A4B2B00B0CA20 /* lstring.h */,\n\t\t\t\t3284FE2F179A4B2B00B0CA20 /* lstrlib.c */,\n\t\t\t\t3284FE30179A4B2B00B0CA20 /* ltable.c */,\n\t\t\t\t3284FE31179A4B2B00B0CA20 /* ltable.h */,\n\t\t\t\t3284FE32179A4B2B00B0CA20 /* ltablib.c */,\n\t\t\t\t3284FE33179A4B2B00B0CA20 /* ltm.c */,\n\t\t\t\t3284FE34179A4B2B00B0CA20 /* ltm.h */,\n\t\t\t\t3284FE35179A4B2B00B0CA20 /* lua.h */,\n\t\t\t\t3284FE36179A4B2B00B0CA20 /* lua.hpp */,\n\t\t\t\t3284FE37179A4B2B00B0CA20 /* lualib.h */,\n\t\t\t\t3284FE38179A4B2B00B0CA20 /* lundump.c */,\n\t\t\t\t3284FE39179A4B2B00B0CA20 /* lundump.h */,\n\t\t\t\t3284FE3A179A4B2B00B0CA20 /* lvm.c */,\n\t\t\t\t3284FE3B179A4B2B00B0CA20 /* lvm.h */,\n\t\t\t\t3284FE3C179A4B2B00B0CA20 /* lzio.c */,\n\t\t\t\t3284FE3D179A4B2B00B0CA20 /* lzio.h */,\n\t\t\t);\n\t\t\tname = lua;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE5E179A4EDC00B0CA20 /* sha1 */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE5F179A4EF900B0CA20 /* hash_sha1.c */,\n\t\t\t\t3284FE60179A4EF900B0CA20 /* hash_sha1.h */,\n\t\t\t);\n\t\t\tname = sha1;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE62179A4EFF00B0CA20 /* SQLite */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE63179A4F0900B0CA20 /* sqlite3.c */,\n\t\t\t\t3284FE64179A4F0900B0CA20 /* sqlite3.h */,\n\t\t\t\t3284FE65179A4F0900B0CA20 /* sqlite3ext.h */,\n\t\t\t);\n\t\t\tname = SQLite;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE67179A4F0F00B0CA20 /* utf8_converter */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE68179A4F1B00B0CA20 /* utf8.c */,\n\t\t\t\t3284FE69179A4F1B00B0CA20 /* utf8.h */,\n\t\t\t);\n\t\t\tname = utf8_converter;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE6B179A4F3B00B0CA20 /* minizip */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE6C179A4F4900B0CA20 /* crypt.h */,\n\t\t\t\t3284FE6D179A4F4900B0CA20 /* ioapi.c */,\n\t\t\t\t3284FE6E179A4F4900B0CA20 /* ioapi.h */,\n\t\t\t\t3284FE6F179A4F4900B0CA20 /* mztools.c */,\n\t\t\t\t3284FE70179A4F4900B0CA20 /* mztools.h */,\n\t\t\t\t3284FE71179A4F4900B0CA20 /* unzip.c */,\n\t\t\t\t3284FE72179A4F4900B0CA20 /* unzip.h */,\n\t\t\t);\n\t\t\tname = minizip;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE76179A4F5900B0CA20 /* JSonParser */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE96179A4F6C00B0CA20 /* api */,\n\t\t\t\t3284FE77179A4F6600B0CA20 /* yajl_buf.c */,\n\t\t\t\t3284FE78179A4F6600B0CA20 /* yajl_bytestack.h */,\n\t\t\t\t3284FE79179A4F6600B0CA20 /* yajl_encode.c */,\n\t\t\t\t3284FE7A179A4F6600B0CA20 /* yajl_lex.c */,\n\t\t\t\t3284FE7B179A4F6600B0CA20 /* yajl_parser.c */,\n\t\t\t\t3284FE7C179A4F6600B0CA20 /* yajl_tree.c */,\n\t\t\t\t3284FE7D179A4F6600B0CA20 /* yajl.c */,\n\t\t\t\t3284FE7E179A4F6600B0CA20 /* json_binary_parser.c */,\n\t\t\t\t3284FE7F179A4F6600B0CA20 /* important.txt */,\n\t\t\t\t3284FE80179A4F6600B0CA20 /* msg_pack_parser.c */,\n\t\t\t\t3284FE81179A4F6600B0CA20 /* yajl_alloc.c */,\n\t\t\t\t3284FE82179A4F6600B0CA20 /* yajl_alloc.h */,\n\t\t\t\t3284FE83179A4F6600B0CA20 /* yajl_assert.h */,\n\t\t\t\t3284FE84179A4F6600B0CA20 /* yajl_buf.h */,\n\t\t\t\t3284FE85179A4F6600B0CA20 /* yajl_encode.h */,\n\t\t\t\t3284FE86179A4F6600B0CA20 /* yajl_gen.c */,\n\t\t\t\t3284FE87179A4F6600B0CA20 /* yajl_lex.h */,\n\t\t\t\t3284FE88179A4F6600B0CA20 /* yajl_parser.h */,\n\t\t\t\t3284FE89179A4F6600B0CA20 /* yajl_version.c */,\n\t\t\t);\n\t\t\tname = JSonParser;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE96179A4F6C00B0CA20 /* api */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE97179A4F7600B0CA20 /* yajl_common.h */,\n\t\t\t\t3284FE98179A4F7600B0CA20 /* yajl_gen.h */,\n\t\t\t\t3284FE99179A4F7600B0CA20 /* yajl_parse.h */,\n\t\t\t\t3284FE9A179A4F7600B0CA20 /* yajl_tree.h */,\n\t\t\t);\n\t\t\tname = api;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE9B179A4F8900B0CA20 /* freeType */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32840169179A4FC700B0CA20 /* include */,\n\t\t\t\t3284FE9C179A4FB200B0CA20 /* src */,\n\t\t\t);\n\t\t\tname = freeType;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE9C179A4FB200B0CA20 /* src */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FE9D179A4FB200B0CA20 /* autofit */,\n\t\t\t\t3284FEBC179A4FB200B0CA20 /* base */,\n\t\t\t\t3284FEE6179A4FB200B0CA20 /* bdf */,\n\t\t\t\t3284FEF5179A4FB200B0CA20 /* cache */,\n\t\t\t\t3284FF09179A4FB200B0CA20 /* cff */,\n\t\t\t\t3284FF1F179A4FB300B0CA20 /* cid */,\n\t\t\t\t3284FF30179A4FB300B0CA20 /* ftdebug.c */,\n\t\t\t\t3284FF81179A4FB300B0CA20 /* pcf */,\n\t\t\t\t3284FF8F179A4FB300B0CA20 /* pfr */,\n\t\t\t\t3284FFA2179A4FB300B0CA20 /* psaux */,\n\t\t\t\t3284FFB4179A4FB300B0CA20 /* pshinter */,\n\t\t\t\t3284FFC4179A4FB300B0CA20 /* psnames */,\n\t\t\t\t3284FFCF179A4FB300B0CA20 /* raster */,\n\t\t\t\t3284FFDC179A4FB300B0CA20 /* sfnt */,\n\t\t\t\t3284FFF8179A4FB300B0CA20 /* smooth */,\n\t\t\t\t32840019179A4FB300B0CA20 /* truetype */,\n\t\t\t\t3284002F179A4FB300B0CA20 /* type1 */,\n\t\t\t\t32840042179A4FB300B0CA20 /* type42 */,\n\t\t\t\t3284004F179A4FB300B0CA20 /* winfonts */,\n\t\t\t);\n\t\t\tname = src;\n\t\t\tpath = ../../../libs/freeType/src;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FE9D179A4FB200B0CA20 /* autofit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FEB8179A4FB200B0CA20 /* autofit.c */,\n\t\t\t);\n\t\t\tpath = autofit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FEBC179A4FB200B0CA20 /* base */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FEC1179A4FB200B0CA20 /* ftbase.c */,\n\t\t\t\t3284FEC3179A4FB200B0CA20 /* ftbbox.c */,\n\t\t\t\t3284FEC5179A4FB200B0CA20 /* ftbitmap.c */,\n\t\t\t\t3284FECA179A4FB200B0CA20 /* ftfstype.c */,\n\t\t\t\t3284FECB179A4FB200B0CA20 /* ftgasp.c */,\n\t\t\t\t3284FECD179A4FB200B0CA20 /* ftglyph.c */,\n\t\t\t\t3284FECE179A4FB200B0CA20 /* ftgxval.c */,\n\t\t\t\t3284FECF179A4FB200B0CA20 /* ftinit.c */,\n\t\t\t\t3284FED0179A4FB200B0CA20 /* ftlcdfil.c */,\n\t\t\t\t3284FED2179A4FB200B0CA20 /* ftmm.c */,\n\t\t\t\t3284FED4179A4FB200B0CA20 /* ftotval.c */,\n\t\t\t\t3284FED6179A4FB200B0CA20 /* ftpatent.c */,\n\t\t\t\t3284FED7179A4FB200B0CA20 /* ftpfr.c */,\n\t\t\t\t3284FEDC179A4FB200B0CA20 /* ftstroke.c */,\n\t\t\t\t3284FEDD179A4FB200B0CA20 /* ftsynth.c */,\n\t\t\t\t3284FEDE179A4FB200B0CA20 /* ftsystem.c */,\n\t\t\t\t3284FEE0179A4FB200B0CA20 /* fttype1.c */,\n\t\t\t\t3284FEE2179A4FB200B0CA20 /* ftwinfnt.c */,\n\t\t\t\t3284FEE3179A4FB200B0CA20 /* ftxf86.c */,\n\t\t\t);\n\t\t\tpath = base;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FEE6179A4FB200B0CA20 /* bdf */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FEE7179A4FB200B0CA20 /* bdf.c */,\n\t\t\t);\n\t\t\tpath = bdf;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FEF5179A4FB200B0CA20 /* cache */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FEF6179A4FB200B0CA20 /* ftcache.c */,\n\t\t\t);\n\t\t\tpath = cache;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FF09179A4FB200B0CA20 /* cff */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FF0A179A4FB200B0CA20 /* cff.c */,\n\t\t\t);\n\t\t\tpath = cff;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FF1F179A4FB300B0CA20 /* cid */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FF2F179A4FB300B0CA20 /* type1cid.c */,\n\t\t\t);\n\t\t\tpath = cid;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FF81179A4FB300B0CA20 /* pcf */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FF84179A4FB300B0CA20 /* pcf.c */,\n\t\t\t);\n\t\t\tpath = pcf;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FF8F179A4FB300B0CA20 /* pfr */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FF92179A4FB300B0CA20 /* pfr.c */,\n\t\t\t);\n\t\t\tpath = pfr;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FFA2179A4FB300B0CA20 /* psaux */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FFA7179A4FB300B0CA20 /* psaux.c */,\n\t\t\t);\n\t\t\tpath = psaux;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FFB4179A4FB300B0CA20 /* pshinter */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FFBB179A4FB300B0CA20 /* pshinter.c */,\n\t\t\t);\n\t\t\tpath = pshinter;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FFC4179A4FB300B0CA20 /* psnames */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FFC7179A4FB300B0CA20 /* psmodule.c */,\n\t\t\t);\n\t\t\tpath = psnames;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FFCF179A4FB300B0CA20 /* raster */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FFD7179A4FB300B0CA20 /* raster.c */,\n\t\t\t);\n\t\t\tpath = raster;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FFDC179A4FB300B0CA20 /* sfnt */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3284FFE3179A4FB300B0CA20 /* sfnt.c */,\n\t\t\t);\n\t\t\tpath = sfnt;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3284FFF8179A4FB300B0CA20 /* smooth */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32840003179A4FB300B0CA20 /* smooth.c */,\n\t\t\t);\n\t\t\tpath = smooth;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32D86B07182F73E700210C28 /* Other Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86B08182F73E700210C28 /* Foundation.framework */,\n\t\t\t\t32D86B09182F73E700210C28 /* CoreData.framework */,\n\t\t\t\t32D86B0A182F73E700210C28 /* AppKit.framework */,\n\t\t\t);\n\t\t\tname = \"Other Frameworks\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32D86B20182F73E800210C28 /* PlaygroundOSSTests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86B26182F73E800210C28 /* PlaygroundOSSTests.m */,\n\t\t\t\t32D86B21182F73E800210C28 /* Supporting Files */,\n\t\t\t);\n\t\t\tpath = PlaygroundOSSTests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32D86B21182F73E800210C28 /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86B22182F73E800210C28 /* PlaygroundOSSTests-Info.plist */,\n\t\t\t\t32D86B23182F73E800210C28 /* InfoPlist.strings */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32F55EA8179CFA29003807CE /* Shaders */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32F55EA9179CFA29003807CE /* character.fsh */,\n\t\t\t\t32F55EAA179CFA29003807CE /* character.vsh */,\n\t\t\t\t32F55EAB179CFA29003807CE /* reflect.fsh */,\n\t\t\t\t32F55EAC179CFA29003807CE /* reflect.vsh */,\n\t\t\t);\n\t\t\tpath = Shaders;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6F65D8CE179CE0C300E9F3CE /* glUtil */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6F65D8CF179CE0D200E9F3CE /* imageUtil.h */,\n\t\t\t\t6F65D8D0179CE0D200E9F3CE /* imageUtil.m */,\n\t\t\t\t6F65D8D1179CE0D200E9F3CE /* matrixUtil.c */,\n\t\t\t\t6F65D8D2179CE0D200E9F3CE /* matrixUtil.h */,\n\t\t\t\t6F65D8D3179CE0D200E9F3CE /* modelUtil.c */,\n\t\t\t\t6F65D8D4179CE0D200E9F3CE /* modelUtil.h */,\n\t\t\t\t6F65D8D5179CE0D200E9F3CE /* sourceUtil.c */,\n\t\t\t\t6F65D8D6179CE0D200E9F3CE /* sourceUtil.h */,\n\t\t\t\t6F65D8D7179CE0D200E9F3CE /* vectorUtil.c */,\n\t\t\t\t6F65D8D8179CE0D200E9F3CE /* vectorUtil.h */,\n\t\t\t);\n\t\t\tname = glUtil;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t32D86B02182F73E700210C28 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86C5E182F7FDF00210C28 /* CPFInterface.h in Headers */,\n\t\t\t\t32D86C5F182F7FDF00210C28 /* RenderingFramework.h in Headers */,\n\t\t\t\t32D86C60182F7FDF00210C28 /* encryptFile.h in Headers */,\n\t\t\t\t32D86C61182F7FDF00210C28 /* KLBPlatformMetrics.h in Headers */,\n\t\t\t\t32D86C62182F7FDF00210C28 /* KLBPlatformMetricsCommon.h in Headers */,\n\t\t\t\t32D86C63182F7FDF00210C28 /* CSoundAnalysis.h in Headers */,\n\t\t\t\t32D86C64182F7FDF00210C28 /* mem.h in Headers */,\n\t\t\t\t32D86C66182F7FDF00210C28 /* BaseType.h in Headers */,\n\t\t\t\t32D86C67182F7FDF00210C28 /* FileSystem.h in Headers */,\n\t\t\t\t32D86C68182F7FDF00210C28 /* OSWidget.h in Headers */,\n\t\t\t\t32D86C69182F7FDF00210C28 /* assert_klb.h in Headers */,\n\t\t\t\t32D86C6A182F7FDF00210C28 /* ITmpFile.h in Headers */,\n\t\t\t\t32D86C6B182F7FDF00210C28 /* klb_vararg.h in Headers */,\n\t\t\t\t32D86C6C182F801600210C28 /* imageUtil.h in Headers */,\n\t\t\t\t32D86C6D182F801600210C28 /* matrixUtil.h in Headers */,\n\t\t\t\t32D86C6E182F801600210C28 /* modelUtil.h in Headers */,\n\t\t\t\t32D86C6F182F801600210C28 /* sourceUtil.h in Headers */,\n\t\t\t\t32D86C70182F801600210C28 /* vectorUtil.h in Headers */,\n\t\t\t\t32D86C71182F801600210C28 /* AppDelegate.h in Headers */,\n\t\t\t\t32D86C72182F801600210C28 /* CiOSAudio.h in Headers */,\n\t\t\t\t32D86C73182F801600210C28 /* CiOSAudioManager.h in Headers */,\n\t\t\t\t32D86C74182F801600210C28 /* CiOSMovieView.h in Headers */,\n\t\t\t\t32D86C75182F801600210C28 /* CiOSPathConv.h in Headers */,\n\t\t\t\t32D86C76182F801600210C28 /* CiOSPlatform.h in Headers */,\n\t\t\t\t32D86C77182F801600210C28 /* CiOSReadFileStream.h in Headers */,\n\t\t\t\t32D86C78182F801600210C28 /* CiOSSysResource.h in Headers */,\n\t\t\t\t32D86C79182F801600210C28 /* CiOSTextView.h in Headers */,\n\t\t\t\t32D86C7A182F801600210C28 /* CiOSTmpFile.h in Headers */,\n\t\t\t\t32D86C7B182F801600210C28 /* CiOSWebView.h in Headers */,\n\t\t\t\t32D86C7C182F801600210C28 /* CiOSWidget.h in Headers */,\n\t\t\t\t32D86C7D182F801600210C28 /* CiOSWriteFileStream.h in Headers */,\n\t\t\t\t32D86C7E182F801600210C28 /* CSockReadStream.h in Headers */,\n\t\t\t\t32D86C7F182F801600210C28 /* CSockWriteStream.h in Headers */,\n\t\t\t\t32D86C80182F801600210C28 /* EAGLView.h in Headers */,\n\t\t\t\t32D86C81182F801600210C28 /* FontRendering.h in Headers */,\n\t\t\t\t32D86C82182F801600210C28 /* FileDelete.h in Headers */,\n\t\t\t\t32D86C83182F801600210C28 /* GLcommon.h in Headers */,\n\t\t\t\t32D86C84182F801600210C28 /* iOSFileLocation.h in Headers */,\n\t\t\t\t32D86C85182F801600210C28 /* KLBPlatformMetrics.h in Headers */,\n\t\t\t\t32D86C86182F801600210C28 /* NSData+Base64.h in Headers */,\n\t\t\t\t32D86C87182F801600210C28 /* ViewController.h in Headers */,\n\t\t\t\t32D86C88182F801600210C28 /* glUtil.h in Headers */,\n\t\t\t\t32D86C89182F801600210C28 /* OpenGLRenderer.h in Headers */,\n\t\t\t\t32D86C8A182F801600210C28 /* NSGLView.h in Headers */,\n\t\t\t\t32D86C8B182F801600210C28 /* CKLBSplineNode.h in Headers */,\n\t\t\t\t32D86C8C182F801600210C28 /* CKLBNodeVirtualDocument.h in Headers */,\n\t\t\t\t32D86C8D182F801600210C28 /* CKLBScoreNode.h in Headers */,\n\t\t\t\t32D86C8E182F801600210C28 /* CKLBSWFPlayer.h in Headers */,\n\t\t\t\t32D86C8F182F801600210C28 /* CKLBTexturePacker.h in Headers */,\n\t\t\t\t32D86C90182F801600210C28 /* CKLBAsset.h in Headers */,\n\t\t\t\t32D86C91182F801700210C28 /* CompositeManagement.h in Headers */,\n\t\t\t\t32D86C92182F801700210C28 /* AudioAsset.h in Headers */,\n\t\t\t\t32D86C93182F801700210C28 /* CKLBPropertyBag.h in Headers */,\n\t\t\t\t32D86C94182F801700210C28 /* NodeAnimationAsset.h in Headers */,\n\t\t\t\t32D86C95182F801700210C28 /* TextureManagement.h in Headers */,\n\t\t\t\t32D86C96182F801700210C28 /* CKLBTask.h in Headers */,\n\t\t\t\t32D86C97182F801700210C28 /* ArrayAllocator.h in Headers */,\n\t\t\t\t32D86C98182F801700210C28 /* CKLBGameApplication.h in Headers */,\n\t\t\t\t32D86C99182F801700210C28 /* CKLBAsyncFilecopy.h in Headers */,\n\t\t\t\t32D86C9A182F801700210C28 /* CKLBScriptEnv.h in Headers */,\n\t\t\t\t32D86C9B182F801700210C28 /* CLuaState.h in Headers */,\n\t\t\t\t32D86C9C182F801700210C28 /* CKLBLuaTask.h in Headers */,\n\t\t\t\t32D86C9D182F801700210C28 /* CKLBUtility.h in Headers */,\n\t\t\t\t32D86C9E182F801700210C28 /* DebugTracker.h in Headers */,\n\t\t\t\t32D86C9F182F801700210C28 /* CKLBAction.h in Headers */,\n\t\t\t\t32D86CA0182F801700210C28 /* CKLBAppProperty.h in Headers */,\n\t\t\t\t32D86CA1182F801700210C28 /* CKLBAsyncLoader.h in Headers */,\n\t\t\t\t32D86CA2182F801700210C28 /* CKLBBinArray.h in Headers */,\n\t\t\t\t32D86CA3182F801700210C28 /* CKLBDataHandler.h in Headers */,\n\t\t\t\t32D86CA4182F801700210C28 /* CKLBDebugger.h in Headers */,\n\t\t\t\t32D86CA5182F801700210C28 /* CKLBGenericTask.h in Headers */,\n\t\t\t\t32D86CA6182F801700210C28 /* CKLBIntervalTimer.h in Headers */,\n\t\t\t\t32D86CA7182F801700210C28 /* CKLBLibRegistrator.h in Headers */,\n\t\t\t\t32D86CA8182F801700210C28 /* CKLBLifeCtrlTask.h in Headers */,\n\t\t\t\t32D86CA9182F801700210C28 /* CKLBLuaEnv.h in Headers */,\n\t\t\t\t32D86CAA182F801700210C28 /* CKLBLuaPropTask.h in Headers */,\n\t\t\t\t32D86CAB182F801700210C28 /* CKLBObject.h in Headers */,\n\t\t\t\t32D86CAC182F801700210C28 /* CKLBPauseCtrl.h in Headers */,\n\t\t\t\t32D86CAD182F801700210C28 /* CKLBTextTempBuffer.h in Headers */,\n\t\t\t\t32D86CAE182F801700210C28 /* CKLBUITask.h in Headers */,\n\t\t\t\t32D86CAF182F801700210C28 /* DebugAlloc.h in Headers */,\n\t\t\t\t32D86CB0182F801700210C28 /* Dictionnary.h in Headers */,\n\t\t\t\t32D86CB1182F801700210C28 /* Message.h in Headers */,\n\t\t\t\t32D86CB2182F801700210C28 /* DataSet.h in Headers */,\n\t\t\t\t32D86CB3182F801700210C28 /* CKLBDatabase.h in Headers */,\n\t\t\t\t32D86CB4182F801700210C28 /* CKLBLuaDB.h in Headers */,\n\t\t\t\t32D86CB5182F801700210C28 /* CKLBLanguageDatabase.h in Headers */,\n\t\t\t\t32D86CB6182F801700210C28 /* DataSet_JSonDB.h in Headers */,\n\t\t\t\t32D86CB7182F801700210C28 /* CKLBStoreService.h in Headers */,\n\t\t\t\t32D86CB8182F801700210C28 /* CKLBNetAPI.h in Headers */,\n\t\t\t\t32D86CB9182F801700210C28 /* MultithreadedNetwork.h in Headers */,\n\t\t\t\t32D86CBA182F801700210C28 /* CKLBHTTPInterface.h in Headers */,\n\t\t\t\t32D86CBB182F801700210C28 /* CKLBNetAPIKeyChain.h in Headers */,\n\t\t\t\t32D86CBC182F801700210C28 /* CKLBUpdate.h in Headers */,\n\t\t\t\t32D86CBD182F801700210C28 /* CKLBJsonItem.h in Headers */,\n\t\t\t\t32D86CBE182F801700210C28 /* CUnZip.h in Headers */,\n\t\t\t\t32D86CBF182F801700210C28 /* CKLBLuaLibENG.h in Headers */,\n\t\t\t\t32D86CC0182F801700210C28 /* CKLBLuaLibFONT.h in Headers */,\n\t\t\t\t32D86CC1182F801700210C28 /* CKLBLuaLibHASH.h in Headers */,\n\t\t\t\t32D86CC2182F801700210C28 /* CKLBLuaLibSOUND.h in Headers */,\n\t\t\t\t32D86CC3182F801700210C28 /* CKLBLuaLibGL.h in Headers */,\n\t\t\t\t32D86CC4182F801700210C28 /* CKLBLuaLibASSET.h in Headers */,\n\t\t\t\t32D86CC5182F801700210C28 /* CKLBLuaConst.h in Headers */,\n\t\t\t\t32D86CC6182F801700210C28 /* CKLBLuaLibAPP.h in Headers */,\n\t\t\t\t32D86CC7182F801700210C28 /* CKLBLuaLibBIN.h in Headers */,\n\t\t\t\t32D86CC8182F801700210C28 /* CKLBLuaLibCONV.h in Headers */,\n\t\t\t\t32D86CC9182F801700210C28 /* CKLBLuaLibDATA.h in Headers */,\n\t\t\t\t32D86CCA182F801700210C28 /* CKLBLuaLibDB.h in Headers */,\n\t\t\t\t32D86CCB182F801700210C28 /* CKLBLuaLibDEBUG.h in Headers */,\n\t\t\t\t32D86CCC182F801700210C28 /* CKLBLuaLibKEY.h in Headers */,\n\t\t\t\t32D86CCD182F801700210C28 /* CKLBLuaLibLANG.h in Headers */,\n\t\t\t\t32D86CCE182F801700210C28 /* CKLBLuaLibMatrix.h in Headers */,\n\t\t\t\t32D86CCF182F801700210C28 /* CKLBLuaLibRES.h in Headers */,\n\t\t\t\t32D86CD0182F801700210C28 /* CKLBLuaLibTASK.h in Headers */,\n\t\t\t\t32D86CD1182F801700210C28 /* CKLBLuaLibUI.h in Headers */,\n\t\t\t\t32D86CD2182F801700210C28 /* ILuaFuncLib.h in Headers */,\n\t\t\t\t32D86CD3182F801700210C28 /* CKLBRendering.h in Headers */,\n\t\t\t\t32D86CD4182F801700210C28 /* glWrapper.h in Headers */,\n\t\t\t\t32D86CD5182F801700210C28 /* CKLBCanvasSprite.h in Headers */,\n\t\t\t\t32D86CD6182F801700210C28 /* CKLBSprite3D.h in Headers */,\n\t\t\t\t32D86CD7182F801700210C28 /* CKLBNode.h in Headers */,\n\t\t\t\t32D86CD8182F801700210C28 /* CSoundAnalysisMP3.h in Headers */,\n\t\t\t\t32D86CD9182F801700210C28 /* CKLBDeviceKeyEvent.h in Headers */,\n\t\t\t\t32D86CDA182F801700210C28 /* CKLBDebugMenu.h in Headers */,\n\t\t\t\t32D86CDB182F801700210C28 /* CKLBTouchPad.h in Headers */,\n\t\t\t\t32D86CDC182F801700210C28 /* CKLBDrawTask.h in Headers */,\n\t\t\t\t32D86CDD182F801700210C28 /* CKLBOSCtrlEvent.h in Headers */,\n\t\t\t\t32D86CDE182F801700210C28 /* CKLBLuaScript.h in Headers */,\n\t\t\t\t32D86CDF182F801700210C28 /* CKLBTouchEventUI.h in Headers */,\n\t\t\t\t32D86CE0182F801700210C28 /* CKLBScrMgrDefault.h in Headers */,\n\t\t\t\t32D86CE1182F801700210C28 /* CKLBScrMgrPage.h in Headers */,\n\t\t\t\t32D86CE2182F801700210C28 /* CKLBUIFreeVertItem.h in Headers */,\n\t\t\t\t32D86CE3182F801700210C28 /* CKLBUIList.h in Headers */,\n\t\t\t\t32D86CE4182F801700210C28 /* CKLBScrMgrSolid.h in Headers */,\n\t\t\t\t32D86CE5182F801700210C28 /* CKLBScrollBarIF.h in Headers */,\n\t\t\t\t32D86CE6182F801700210C28 /* CKLBUISystem.h in Headers */,\n\t\t\t\t32D86CE7182F801700210C28 /* CKLBUISWFPlayer.h in Headers */,\n\t\t\t\t32D86CE8182F801700210C28 /* CKLBUIVariableItem.h in Headers */,\n\t\t\t\t32D86CE9182F801700210C28 /* CKLBLabelNode.h in Headers */,\n\t\t\t\t32D86CEA182F801700210C28 /* CKLBUIVirtualDoc.h in Headers */,\n\t\t\t\t32D86CEB182F801700210C28 /* CKLBUITextInput.h in Headers */,\n\t\t\t\t32D86CEC182F801700210C28 /* CKLBTextInputNode.h in Headers */,\n\t\t\t\t32D86CED182F801700210C28 /* CKLBActivityIndicatorNode.h in Headers */,\n\t\t\t\t32D86CEE182F801700210C28 /* CKLBDragCallbackIF.h in Headers */,\n\t\t\t\t32D86CEF182F801700210C28 /* CKLBFormGroup.h in Headers */,\n\t\t\t\t32D86CF0182F801700210C28 /* CKLBFormIF.h in Headers */,\n\t\t\t\t32D86CF1182F801700210C28 /* CKLBModalStack.h in Headers */,\n\t\t\t\t32D86CF2182F801700210C28 /* CKLBMovieNode.h in Headers */,\n\t\t\t\t32D86CF3182F801700210C28 /* CKLBNodeAnimPack.h in Headers */,\n\t\t\t\t32D86CF4182F801700210C28 /* CKLBUIActivityIndicator.h in Headers */,\n\t\t\t\t32D86CF5182F801700210C28 /* CKLBUICanvas.h in Headers */,\n\t\t\t\t32D86CF6182F801700210C28 /* CKLBUIClip.h in Headers */,\n\t\t\t\t32D86CF7182F801700210C28 /* CKLBUIControl.h in Headers */,\n\t\t\t\t32D86CF8182F801700210C28 /* CKLBUIDebugItem.h in Headers */,\n\t\t\t\t32D86CF9182F801700210C28 /* CKLBUIDragIcon.h in Headers */,\n\t\t\t\t32D86CFA182F801700210C28 /* CKLBUIForm.h in Headers */,\n\t\t\t\t32D86CFB182F801700210C28 /* CKLBUIGroup.h in Headers */,\n\t\t\t\t32D86CFC182F801700210C28 /* CKLBUILabel.h in Headers */,\n\t\t\t\t32D86CFD182F801700210C28 /* CKLBUIMoviePlayer.h in Headers */,\n\t\t\t\t32D86CFE182F801700210C28 /* CKLBUIMultiImgItem.h in Headers */,\n\t\t\t\t32D86CFF182F801700210C28 /* CKLBUIPieChart.h in Headers */,\n\t\t\t\t32D86D00182F801700210C28 /* CKLBUIPolyline.h in Headers */,\n\t\t\t\t32D86D01182F801700210C28 /* CKLBUIProgressBar.h in Headers */,\n\t\t\t\t32D86D02182F801700210C28 /* CKLBUIRubberBand.h in Headers */,\n\t\t\t\t32D86D03182F801700210C28 /* CKLBUIScale9.h in Headers */,\n\t\t\t\t32D86D04182F801700210C28 /* CKLBUIScore.h in Headers */,\n\t\t\t\t32D86D05182F801700210C28 /* CKLBUIScrollBar.h in Headers */,\n\t\t\t\t32D86D06182F801700210C28 /* CKLBUISimpleItem.h in Headers */,\n\t\t\t\t32D86D07182F801700210C28 /* CKLBUITouchPad.h in Headers */,\n\t\t\t\t32D86D08182F801700210C28 /* CKLBUIWebArea.h in Headers */,\n\t\t\t\t32D86D09182F801700210C28 /* CKLBWebViewNode.h in Headers */,\n\t\t\t\t32D86D0A182F801700210C28 /* IMgrEntry.h in Headers */,\n\t\t\t\t32D86D0B182F801700210C28 /* CSampleProjectEntrance.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t327C0B85179A3944007B7F42 /* Playground */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 327C0BA3179A3945007B7F42 /* Build configuration list for PBXNativeTarget \"Playground\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t327C0B82179A3944007B7F42 /* Sources */,\n\t\t\t\t327C0B83179A3944007B7F42 /* Frameworks */,\n\t\t\t\t327C0B84179A3944007B7F42 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Playground;\n\t\t\tproductName = Playground;\n\t\t\tproductReference = 327C0B86179A3944007B7F42 /* Playground.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t32D86B04182F73E700210C28 /* PlaygroundOSS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 32D86B2C182F73E800210C28 /* Build configuration list for PBXNativeTarget \"PlaygroundOSS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t32D86B00182F73E700210C28 /* Sources */,\n\t\t\t\t32D86B01182F73E700210C28 /* Frameworks */,\n\t\t\t\t32D86B02182F73E700210C28 /* Headers */,\n\t\t\t\t32D86B03182F73E700210C28 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = PlaygroundOSS;\n\t\t\tproductName = PlaygroundOSS;\n\t\t\tproductReference = 32D86B05182F73E700210C28 /* PlaygroundOSS.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t32D86B18182F73E700210C28 /* PlaygroundOSSTests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 32D86B2D182F73E800210C28 /* Build configuration list for PBXNativeTarget \"PlaygroundOSSTests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t32D86B15182F73E700210C28 /* Sources */,\n\t\t\t\t32D86B16182F73E700210C28 /* Frameworks */,\n\t\t\t\t32D86B17182F73E700210C28 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t32D86B1E182F73E800210C28 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = PlaygroundOSSTests;\n\t\t\tproductName = PlaygroundOSSTests;\n\t\t\tproductReference = 32D86B19182F73E700210C28 /* PlaygroundOSSTests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t327C0B7E179A3944007B7F42 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tCLASSPREFIX = Playground;\n\t\t\t\tLastUpgradeCheck = 0460;\n\t\t\t\tORGANIZATIONNAME = \"KLab Inc.\";\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t32D86B18182F73E700210C28 = {\n\t\t\t\t\t\tTestTargetID = 32D86B04182F73E700210C28;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 327C0B81179A3944007B7F42 /* Build configuration list for PBXProject \"Playground\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 327C0B7D179A3944007B7F42;\n\t\t\tproductRefGroup = 327C0B87179A3944007B7F42 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t327C0B85179A3944007B7F42 /* Playground */,\n\t\t\t\t32D86B04182F73E700210C28 /* PlaygroundOSS */,\n\t\t\t\t32D86B18182F73E700210C28 /* PlaygroundOSSTests */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t327C0B84179A3944007B7F42 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32F55EB1179CFA32003807CE /* character.fsh in Resources */,\n\t\t\t\t32F55EB2179CFA32003807CE /* character.vsh in Resources */,\n\t\t\t\t32F55EB3179CFA32003807CE /* reflect.fsh in Resources */,\n\t\t\t\t3212707518253D2A0027C57E /* SimpleItem.lua in Resources */,\n\t\t\t\t32F55EB4179CFA32003807CE /* reflect.vsh in Resources */,\n\t\t\t\t32F55EA6179CF9DB003807CE /* demon.model in Resources */,\n\t\t\t\t32F55EA7179CF9DB003807CE /* demon.png in Resources */,\n\t\t\t\t3212707418253D2A0027C57E /* itemimage.png.imag in Resources */,\n\t\t\t\t3212707718253D2A0027C57E /* textureBoat.texb in Resources */,\n\t\t\t\t327C0B94179A3944007B7F42 /* InfoPlist.strings in Resources */,\n\t\t\t\t327C0B9A179A3945007B7F42 /* Credits.rtf in Resources */,\n\t\t\t\t327C0BA0179A3945007B7F42 /* MainMenu.xib in Resources */,\n\t\t\t\t327C0CF8179A3F34007B7F42 /* shaderSource.inl in Resources */,\n\t\t\t\t3284FE91179A4F6600B0CA20 /* important.txt in Resources */,\n\t\t\t\t3212707618253D2A0027C57E /* start.lua in Resources */,\n\t\t\t\t32F55EBE179D0B07003807CE /* MTLmr3m.ttf in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t32D86B03182F73E700210C28 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86DF5182FDAE300210C28 /* Playground-Info.plist in Resources */,\n\t\t\t\t32D86C5D182F75FE00210C28 /* MainMenu.xib in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t32D86B17182F73E700210C28 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86B25182F73E800210C28 /* InfoPlist.strings in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t327C0B82179A3944007B7F42 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t6F65D8D9179CE18500E9F3CE /* imageUtil.m in Sources */,\n\t\t\t\t6F65D8DA179CE18500E9F3CE /* matrixUtil.c in Sources */,\n\t\t\t\t6F65D8DB179CE18500E9F3CE /* modelUtil.c in Sources */,\n\t\t\t\t6F65D8DC179CE18500E9F3CE /* sourceUtil.c in Sources */,\n\t\t\t\t6F65D8DD179CE18500E9F3CE /* vectorUtil.c in Sources */,\n\t\t\t\t327C0B96179A3945007B7F42 /* main.m in Sources */,\n\t\t\t\t327C0B9D179A3945007B7F42 /* PlaygroundAppDelegate.mm in Sources */,\n\t\t\t\t327C0BE9179A3E4A007B7F42 /* CKLBNodeVirtualDocument.cpp in Sources */,\n\t\t\t\t327C0BEA179A3E4A007B7F42 /* CKLBSplineNode.cpp in Sources */,\n\t\t\t\t327C0BEB179A3E4A007B7F42 /* CKLBSWFPlayer.cpp in Sources */,\n\t\t\t\t327C0BED179A3E4A007B7F42 /* CKLBScoreNode.cpp in Sources */,\n\t\t\t\t327C0BEE179A3E4A007B7F42 /* CKLBSystem.cpp in Sources */,\n\t\t\t\t327C0C04179A3E63007B7F42 /* CKLBTexturePacker.cpp in Sources */,\n\t\t\t\t327C0C05179A3E63007B7F42 /* CompositeManagement.cpp in Sources */,\n\t\t\t\t327C0C06179A3E63007B7F42 /* TextureManagement.cpp in Sources */,\n\t\t\t\t327C0C07179A3E63007B7F42 /* CKLBAssetManager.cpp in Sources */,\n\t\t\t\t327C0C08179A3E63007B7F42 /* AudioAsset.cpp in Sources */,\n\t\t\t\t327C0C0B179A3E63007B7F42 /* CKLBPropertyBag.cpp in Sources */,\n\t\t\t\t327C0C0D179A3E63007B7F42 /* NodeAnimationAsset.cpp in Sources */,\n\t\t\t\t327C0C4C179A3E7A007B7F42 /* CKLBTask.cpp in Sources */,\n\t\t\t\t32127067182530650027C57E /* CSampleProjectEntrance.cpp in Sources */,\n\t\t\t\t327C0C4D179A3E7A007B7F42 /* CKLBAsyncFilecopy.cpp in Sources */,\n\t\t\t\t327C0C4E179A3E7A007B7F42 /* CKLBGameApplication.cpp in Sources */,\n\t\t\t\t327C0C4F179A3E7A007B7F42 /* CKLBLuaEnv.cpp in Sources */,\n\t\t\t\t327C0C50179A3E7A007B7F42 /* CKLBUITask.cpp in Sources */,\n\t\t\t\t327C0C51179A3E7A007B7F42 /* encryptFile.cpp in Sources */,\n\t\t\t\t327C0C52179A3E7A007B7F42 /* CKLBDebugger.cpp in Sources */,\n\t\t\t\t327C0C53179A3E7A007B7F42 /* CKLBGameApplicationDebugModule.cpp in Sources */,\n\t\t\t\t327C0C54179A3E7A007B7F42 /* CKLBIntervalTimer.cpp in Sources */,\n\t\t\t\t327C0C55179A3E7A007B7F42 /* CKLBLuaPropTask.cpp in Sources */,\n\t\t\t\t327C0C56179A3E7A007B7F42 /* CKLBUtility.cpp in Sources */,\n\t\t\t\t327C0C57179A3E7A007B7F42 /* CKLBDataHandler.cpp in Sources */,\n\t\t\t\t327C0C58179A3E7A007B7F42 /* Dictionnary.cpp in Sources */,\n\t\t\t\t327C0C59179A3E7A007B7F42 /* CKLBBinArray.cpp in Sources */,\n\t\t\t\t327C0C5A179A3E7A007B7F42 /* CKLBContext.cpp in Sources */,\n\t\t\t\t327C0C5B179A3E7A007B7F42 /* DebugAlloc.cpp in Sources */,\n\t\t\t\t327C0C5C179A3E7A007B7F42 /* DebugTracker.cpp in Sources */,\n\t\t\t\t327C0C5D179A3E7A007B7F42 /* CKLBAppProperty.cpp in Sources */,\n\t\t\t\t327C0C5E179A3E7A007B7F42 /* CKLBAsyncLoader.cpp in Sources */,\n\t\t\t\t327C0C61179A3E7A007B7F42 /* CKLBGenericTask.cpp in Sources */,\n\t\t\t\t327C0C62179A3E7A007B7F42 /* CKLBLibRegistrator.cpp in Sources */,\n\t\t\t\t327C0C63179A3E7A007B7F42 /* CKLBLifeCtrlTask.cpp in Sources */,\n\t\t\t\t327C0C64179A3E7A007B7F42 /* CKLBLuaTask.cpp in Sources */,\n\t\t\t\t327C0C65179A3E7A007B7F42 /* CKLBObject.cpp in Sources */,\n\t\t\t\t327C0C66179A3E7A007B7F42 /* CKLBPauseCtrl.cpp in Sources */,\n\t\t\t\t327C0C68179A3E7A007B7F42 /* CKLBTextTempBuffer.cpp in Sources */,\n\t\t\t\t327C0C69179A3E7A007B7F42 /* CLuaState.cpp in Sources */,\n\t\t\t\t327C0C6A179A3E7A007B7F42 /* CPFInterface.cpp in Sources */,\n\t\t\t\t327C0C6B179A3E7A007B7F42 /* ITmpFile.cpp in Sources */,\n\t\t\t\t327C0C76179A3E98007B7F42 /* CKLBDatabase.cpp in Sources */,\n\t\t\t\t327C0C77179A3E98007B7F42 /* CKLBLuaDB.cpp in Sources */,\n\t\t\t\t327C0C78179A3E98007B7F42 /* CKLBLanguageDatabase.cpp in Sources */,\n\t\t\t\t327C0C79179A3E98007B7F42 /* DataSet_JSonDB.cpp in Sources */,\n\t\t\t\t327C0C8A179A3EAF007B7F42 /* CKLBStoreService.cpp in Sources */,\n\t\t\t\t327C0C8B179A3EAF007B7F42 /* CKLBNetAPI.cpp in Sources */,\n\t\t\t\t327C0C8C179A3EAF007B7F42 /* CKLBHTTPInterface.cpp in Sources */,\n\t\t\t\t327C0C8D179A3EAF007B7F42 /* CKLBUpdate.cpp in Sources */,\n\t\t\t\t327C0C8E179A3EAF007B7F42 /* CUnZip.cpp in Sources */,\n\t\t\t\t327C0C8F179A3EAF007B7F42 /* CKLBJsonItem.cpp in Sources */,\n\t\t\t\t327C0C90179A3EAF007B7F42 /* MultithreadedNetwork.cpp in Sources */,\n\t\t\t\t327C0C91179A3EAF007B7F42 /* CKLBNetAPIKeyChain.cpp in Sources */,\n\t\t\t\t327C0CBC179A3ECB007B7F42 /* CKLBLuaLibAPP.cpp in Sources */,\n\t\t\t\t327C0CBD179A3ECB007B7F42 /* CKLBLuaLibENG.cpp in Sources */,\n\t\t\t\t327C0CBE179A3ECB007B7F42 /* CKLBLuaLibFONT.cpp in Sources */,\n\t\t\t\t327C0CBF179A3ECB007B7F42 /* CKLBLuaLibHASH.cpp in Sources */,\n\t\t\t\t327C0CC0179A3ECB007B7F42 /* CKLBLuaLibSOUND.cpp in Sources */,\n\t\t\t\t327C0CC1179A3ECB007B7F42 /* CKLBLuaLibGL.cpp in Sources */,\n\t\t\t\t327C0CC2179A3ECB007B7F42 /* CKLBLuaLibDATA.cpp in Sources */,\n\t\t\t\t327C0CC3179A3ECB007B7F42 /* CKLBLuaLibMatrix.cpp in Sources */,\n\t\t\t\t327C0CC5179A3ECB007B7F42 /* ILuaFuncLib.cpp in Sources */,\n\t\t\t\t327C0CC6179A3ECB007B7F42 /* CKLBLuaLibCONV.cpp in Sources */,\n\t\t\t\t327C0CC7179A3ECB007B7F42 /* CKLBLuaLibKEY.cpp in Sources */,\n\t\t\t\t327C0CC8179A3ECB007B7F42 /* CKLBLuaLibTASK.cpp in Sources */,\n\t\t\t\t327C0CC9179A3ECB007B7F42 /* CKLBLuaLibASSET.cpp in Sources */,\n\t\t\t\t327C0CCA179A3ECB007B7F42 /* CKLBLuaConst.cpp in Sources */,\n\t\t\t\t327C0CCB179A3ECB007B7F42 /* CKLBLuaLibBIN.cpp in Sources */,\n\t\t\t\t327C0CCC179A3ECB007B7F42 /* CKLBLuaLibDB.cpp in Sources */,\n\t\t\t\t327C0CCD179A3ECB007B7F42 /* CKLBLuaLibDEBUG.cpp in Sources */,\n\t\t\t\t327C0CCE179A3ECB007B7F42 /* CKLBLuaLibLANG.cpp in Sources */,\n\t\t\t\t3212706F18253C800027C57E /* FontRendering.cpp in Sources */,\n\t\t\t\t327C0CCF179A3ECB007B7F42 /* CKLBLuaLibRES.cpp in Sources */,\n\t\t\t\t327C0CD0179A3ECB007B7F42 /* CKLBLuaLibUI.cpp in Sources */,\n\t\t\t\t327C0CE7179A3F34007B7F42 /* CKLBRenderingManager.cpp in Sources */,\n\t\t\t\t327C0CE8179A3F34007B7F42 /* CRenderingManager_GL1.cpp in Sources */,\n\t\t\t\t327C0CE9179A3F34007B7F42 /* CRenderingManager_GL2.cpp in Sources */,\n\t\t\t\t327C0CEA179A3F34007B7F42 /* CRenderingManager.cpp in Sources */,\n\t\t\t\t327C0CEB179A3F34007B7F42 /* CTextureUsage.cpp in Sources */,\n\t\t\t\t327C0CEC179A3F34007B7F42 /* CBuffer.cpp in Sources */,\n\t\t\t\t327C0CED179A3F34007B7F42 /* CIndexBuffer.cpp in Sources */,\n\t\t\t\t327C0CEE179A3F34007B7F42 /* CTextureBase.cpp in Sources */,\n\t\t\t\t327C0CEF179A3F34007B7F42 /* glWrapper.cpp in Sources */,\n\t\t\t\t327C0CF0179A3F34007B7F42 /* CFrame.cpp in Sources */,\n\t\t\t\t327C0CF1179A3F34007B7F42 /* CImageBuffer.cpp in Sources */,\n\t\t\t\t327C0CF2179A3F34007B7F42 /* CKLBCanvasSprite.cpp in Sources */,\n\t\t\t\t327C0CF3179A3F34007B7F42 /* CKLBSprite3D.cpp in Sources */,\n\t\t\t\t327C0CF4179A3F34007B7F42 /* CShaderSet.cpp in Sources */,\n\t\t\t\t327C0CF5179A3F34007B7F42 /* CShaderSetInstance.cpp in Sources */,\n\t\t\t\t327C0CF6179A3F34007B7F42 /* CTexture.cpp in Sources */,\n\t\t\t\t327C0CFB179A3F4D007B7F42 /* CKLBNode.cpp in Sources */,\n\t\t\t\t327C0CFF179A3F76007B7F42 /* CSoundAnalysisMP3.cpp in Sources */,\n\t\t\t\t327C0D00179A3F76007B7F42 /* CSoundAnalysis.cpp in Sources */,\n\t\t\t\t327C0D03179A408E007B7F42 /* CKLBScriptEnv_forLUA.cpp in Sources */,\n\t\t\t\t327C0D10179A41AE007B7F42 /* CKLBDrawTask.cpp in Sources */,\n\t\t\t\t327C0D11179A41AE007B7F42 /* CKLBDebugMenu.cpp in Sources */,\n\t\t\t\t327C0D12179A41AE007B7F42 /* CKLBTouchPad.cpp in Sources */,\n\t\t\t\t327C0D13179A41AE007B7F42 /* CKLBTouchEventUI.cpp in Sources */,\n\t\t\t\t327C0D14179A41AE007B7F42 /* CKLBOSCtrlEvent.cpp in Sources */,\n\t\t\t\t327C0D15179A41AE007B7F42 /* CKLBLuaScript.cpp in Sources */,\n\t\t\t\t327C0D6E179A41BF007B7F42 /* CKLBUIVirtualDoc.cpp in Sources */,\n\t\t\t\t327C0D6F179A41BF007B7F42 /* CKLBUIList.cpp in Sources */,\n\t\t\t\t327C0D70179A41BF007B7F42 /* CKLBScrMgrDefault.cpp in Sources */,\n\t\t\t\t327C0D71179A41BF007B7F42 /* CKLBScrMgrPage.cpp in Sources */,\n\t\t\t\t327C0D72179A41BF007B7F42 /* CKLBUICanvas.cpp in Sources */,\n\t\t\t\t327C0D73179A41BF007B7F42 /* CKLBUIDragIcon.cpp in Sources */,\n\t\t\t\t327C0D74179A41BF007B7F42 /* CKLBUIFreeVertItem.cpp in Sources */,\n\t\t\t\t327C0D75179A41BF007B7F42 /* CKLBUIProgressBar.cpp in Sources */,\n\t\t\t\t327C0D76179A41BF007B7F42 /* CKLBUIVariableItem.cpp in Sources */,\n\t\t\t\t327C0D77179A41BF007B7F42 /* CKLBScrMgrSolid.cpp in Sources */,\n\t\t\t\t327C0D78179A41BF007B7F42 /* CKLBScrollBarIF.cpp in Sources */,\n\t\t\t\t327C0D79179A41BF007B7F42 /* CKLBLabelNode.cpp in Sources */,\n\t\t\t\t327C0D7A179A41BF007B7F42 /* CKLBMovieNode.cpp in Sources */,\n\t\t\t\t327C0D7B179A41BF007B7F42 /* CKLBTextInputNode.cpp in Sources */,\n\t\t\t\t327C0D7C179A41BF007B7F42 /* CKLBUIDebugItem.cpp in Sources */,\n\t\t\t\t327C0D7D179A41BF007B7F42 /* CKLBUIWebArea.cpp in Sources */,\n\t\t\t\t327C0D7E179A41BF007B7F42 /* CKLBWebViewNode.cpp in Sources */,\n\t\t\t\t327C0D7F179A41BF007B7F42 /* CKLBUIClip.cpp in Sources */,\n\t\t\t\t327C0D80179A41BF007B7F42 /* CKLBUIMultiImgItem.cpp in Sources */,\n\t\t\t\t327C0D81179A41BF007B7F42 /* CKLBUISWFPlayer.cpp in Sources */,\n\t\t\t\t327C0D82179A41BF007B7F42 /* CKLBUISystem.cpp in Sources */,\n\t\t\t\t327C0D83179A41BF007B7F42 /* CKLBUITouchPad.cpp in Sources */,\n\t\t\t\t327C0D84179A41BF007B7F42 /* CKLBUIForm.cpp in Sources */,\n\t\t\t\t327C0D85179A41BF007B7F42 /* CKLBUILabel.cpp in Sources */,\n\t\t\t\t327C0D86179A41BF007B7F42 /* CKLBUIControl.cpp in Sources */,\n\t\t\t\t327C0D87179A41BF007B7F42 /* CKLBUIScale9.cpp in Sources */,\n\t\t\t\t327C0D88179A41BF007B7F42 /* CKLBUITextInput.cpp in Sources */,\n\t\t\t\t327C0D89179A41BF007B7F42 /* CKLBActivityIndicatorNode.cpp in Sources */,\n\t\t\t\t327C0D8A179A41BF007B7F42 /* CKLBDragCallbackIF.cpp in Sources */,\n\t\t\t\t327C0D8B179A41BF007B7F42 /* CKLBFormGroup.cpp in Sources */,\n\t\t\t\t327C0D8C179A41BF007B7F42 /* CKLBFormIF.cpp in Sources */,\n\t\t\t\t3212706A182532090027C57E /* CKLBDeviceKeyEvent.cpp in Sources */,\n\t\t\t\t327C0D8D179A41BF007B7F42 /* CKLBModalStack.cpp in Sources */,\n\t\t\t\t327C0D8E179A41BF007B7F42 /* CKLBNodeAnimPack.cpp in Sources */,\n\t\t\t\t327C0D8F179A41BF007B7F42 /* CKLBUIActivityIndicator.cpp in Sources */,\n\t\t\t\t327C0D91179A41BF007B7F42 /* CKLBUIGroup.cpp in Sources */,\n\t\t\t\t327C0D92179A41BF007B7F42 /* CKLBUIMoviePlayer.cpp in Sources */,\n\t\t\t\t327C0D93179A41BF007B7F42 /* CKLBUIPieChart.cpp in Sources */,\n\t\t\t\t327C0D94179A41BF007B7F42 /* CKLBUIPolyline.cpp in Sources */,\n\t\t\t\t327C0D95179A41BF007B7F42 /* CKLBUIRubberBand.cpp in Sources */,\n\t\t\t\t327C0D96179A41BF007B7F42 /* CKLBUIScore.cpp in Sources */,\n\t\t\t\t327C0D97179A41BF007B7F42 /* CKLBUIScrollBar.cpp in Sources */,\n\t\t\t\t327C0D98179A41BF007B7F42 /* CKLBUISimpleItem.cpp in Sources */,\n\t\t\t\t327C0D99179A41BF007B7F42 /* IMgrEntry.cpp in Sources */,\n\t\t\t\t3284FE3E179A4B2B00B0CA20 /* lapi.c in Sources */,\n\t\t\t\t3284FE3F179A4B2B00B0CA20 /* lauxlib.c in Sources */,\n\t\t\t\t3284FE40179A4B2B00B0CA20 /* lbaselib.c in Sources */,\n\t\t\t\t3284FE41179A4B2B00B0CA20 /* lbitlib.c in Sources */,\n\t\t\t\t3284FE42179A4B2B00B0CA20 /* lcode.c in Sources */,\n\t\t\t\t3284FE43179A4B2B00B0CA20 /* lcorolib.c in Sources */,\n\t\t\t\t3284FE44179A4B2B00B0CA20 /* lctype.c in Sources */,\n\t\t\t\t3284FE45179A4B2B00B0CA20 /* ldblib.c in Sources */,\n\t\t\t\t3284FE46179A4B2B00B0CA20 /* ldebug.c in Sources */,\n\t\t\t\t3284FE47179A4B2B00B0CA20 /* ldo.c in Sources */,\n\t\t\t\t3284FE48179A4B2B00B0CA20 /* ldump.c in Sources */,\n\t\t\t\t3284FE49179A4B2B00B0CA20 /* lfunc.c in Sources */,\n\t\t\t\t3284FE4A179A4B2B00B0CA20 /* lgc.c in Sources */,\n\t\t\t\t3284FE4B179A4B2B00B0CA20 /* linit.c in Sources */,\n\t\t\t\t3284FE4C179A4B2B00B0CA20 /* liolib.c in Sources */,\n\t\t\t\t3284FE4D179A4B2B00B0CA20 /* llex.c in Sources */,\n\t\t\t\t3284FE4E179A4B2B00B0CA20 /* lmathlib.c in Sources */,\n\t\t\t\t3284FE4F179A4B2B00B0CA20 /* lmem.c in Sources */,\n\t\t\t\t3284FE50179A4B2B00B0CA20 /* loadlib.c in Sources */,\n\t\t\t\t3284FE51179A4B2B00B0CA20 /* lobject.c in Sources */,\n\t\t\t\t3284FE52179A4B2B00B0CA20 /* lopcodes.c in Sources */,\n\t\t\t\t3284FE53179A4B2B00B0CA20 /* loslib.c in Sources */,\n\t\t\t\t3284FE54179A4B2B00B0CA20 /* lparser.c in Sources */,\n\t\t\t\t3284FE55179A4B2B00B0CA20 /* lstate.c in Sources */,\n\t\t\t\t3284FE56179A4B2B00B0CA20 /* lstring.c in Sources */,\n\t\t\t\t3284FE57179A4B2B00B0CA20 /* lstrlib.c in Sources */,\n\t\t\t\t3284FE58179A4B2B00B0CA20 /* ltable.c in Sources */,\n\t\t\t\t3284FE59179A4B2B00B0CA20 /* ltablib.c in Sources */,\n\t\t\t\t3284FE5A179A4B2B00B0CA20 /* ltm.c in Sources */,\n\t\t\t\t3284FE5B179A4B2B00B0CA20 /* lundump.c in Sources */,\n\t\t\t\t3284FE5C179A4B2B00B0CA20 /* lvm.c in Sources */,\n\t\t\t\t3284FE5D179A4B2B00B0CA20 /* lzio.c in Sources */,\n\t\t\t\t3284FE61179A4EF900B0CA20 /* hash_sha1.c in Sources */,\n\t\t\t\t3284FE66179A4F0900B0CA20 /* sqlite3.c in Sources */,\n\t\t\t\t3284FE6A179A4F1B00B0CA20 /* utf8.c in Sources */,\n\t\t\t\t3284FE73179A4F4900B0CA20 /* ioapi.c in Sources */,\n\t\t\t\t3284FE74179A4F4900B0CA20 /* mztools.c in Sources */,\n\t\t\t\t3284FE75179A4F4900B0CA20 /* unzip.c in Sources */,\n\t\t\t\t3284FE8A179A4F6600B0CA20 /* yajl_buf.c in Sources */,\n\t\t\t\t3284FE8B179A4F6600B0CA20 /* yajl_encode.c in Sources */,\n\t\t\t\t3284FE8C179A4F6600B0CA20 /* yajl_lex.c in Sources */,\n\t\t\t\t3284FE8D179A4F6600B0CA20 /* yajl_parser.c in Sources */,\n\t\t\t\t3284FE8E179A4F6600B0CA20 /* yajl_tree.c in Sources */,\n\t\t\t\t3284FE8F179A4F6600B0CA20 /* yajl.c in Sources */,\n\t\t\t\t3284FE90179A4F6600B0CA20 /* json_binary_parser.c in Sources */,\n\t\t\t\t3284FE92179A4F6600B0CA20 /* msg_pack_parser.c in Sources */,\n\t\t\t\t3284FE93179A4F6600B0CA20 /* yajl_alloc.c in Sources */,\n\t\t\t\t3284FE94179A4F6600B0CA20 /* yajl_gen.c in Sources */,\n\t\t\t\t3284FE95179A4F6600B0CA20 /* yajl_version.c in Sources */,\n\t\t\t\t3212706E18253C800027C57E /* FileDelete.cpp in Sources */,\n\t\t\t\t32840062179A4FB300B0CA20 /* autofit.c in Sources */,\n\t\t\t\t32840069179A4FB300B0CA20 /* ftbase.c in Sources */,\n\t\t\t\t3284006A179A4FB300B0CA20 /* ftbbox.c in Sources */,\n\t\t\t\t3284006C179A4FB300B0CA20 /* ftbitmap.c in Sources */,\n\t\t\t\t32840071179A4FB300B0CA20 /* ftfstype.c in Sources */,\n\t\t\t\t32840072179A4FB300B0CA20 /* ftgasp.c in Sources */,\n\t\t\t\t32840074179A4FB300B0CA20 /* ftglyph.c in Sources */,\n\t\t\t\t32840075179A4FB300B0CA20 /* ftgxval.c in Sources */,\n\t\t\t\t32840076179A4FB300B0CA20 /* ftinit.c in Sources */,\n\t\t\t\t32840077179A4FB300B0CA20 /* ftlcdfil.c in Sources */,\n\t\t\t\t32840079179A4FB300B0CA20 /* ftmm.c in Sources */,\n\t\t\t\t3284007B179A4FB300B0CA20 /* ftotval.c in Sources */,\n\t\t\t\t3284007D179A4FB300B0CA20 /* ftpatent.c in Sources */,\n\t\t\t\t3284007E179A4FB300B0CA20 /* ftpfr.c in Sources */,\n\t\t\t\t32840083179A4FB300B0CA20 /* ftstroke.c in Sources */,\n\t\t\t\t32840084179A4FB300B0CA20 /* ftsynth.c in Sources */,\n\t\t\t\t32840085179A4FB300B0CA20 /* ftsystem.c in Sources */,\n\t\t\t\t32840087179A4FB300B0CA20 /* fttype1.c in Sources */,\n\t\t\t\t32840089179A4FB300B0CA20 /* ftwinfnt.c in Sources */,\n\t\t\t\t3284008A179A4FB300B0CA20 /* ftxf86.c in Sources */,\n\t\t\t\t3284008D179A4FB300B0CA20 /* bdf.c in Sources */,\n\t\t\t\t32840097179A4FB300B0CA20 /* ftcache.c in Sources */,\n\t\t\t\t328400A2179A4FB300B0CA20 /* cff.c in Sources */,\n\t\t\t\t328400B5179A4FB300B0CA20 /* type1cid.c in Sources */,\n\t\t\t\t328400B6179A4FB300B0CA20 /* ftdebug.c in Sources */,\n\t\t\t\t328400F0179A4FB300B0CA20 /* pcf.c in Sources */,\n\t\t\t\t328400F8179A4FB300B0CA20 /* pfr.c in Sources */,\n\t\t\t\t32840103179A4FB300B0CA20 /* psaux.c in Sources */,\n\t\t\t\t3284010E179A4FB300B0CA20 /* pshinter.c in Sources */,\n\t\t\t\t32840115179A4FB300B0CA20 /* psmodule.c in Sources */,\n\t\t\t\t3284011D179A4FB300B0CA20 /* raster.c in Sources */,\n\t\t\t\t32840124179A4FB300B0CA20 /* sfnt.c in Sources */,\n\t\t\t\t32840135179A4FB300B0CA20 /* smooth.c in Sources */,\n\t\t\t\t3284014B179A4FB300B0CA20 /* truetype.c in Sources */,\n\t\t\t\t3284015D179A4FB300B0CA20 /* type1.c in Sources */,\n\t\t\t\t32840164179A4FB300B0CA20 /* type42.c in Sources */,\n\t\t\t\t32840168179A4FB300B0CA20 /* winfnt.c in Sources */,\n\t\t\t\t328401D8179A576300B0CA20 /* CiOSPlatform.mm in Sources */,\n\t\t\t\t328401D9179A576300B0CA20 /* CiOSAudioManager.mm in Sources */,\n\t\t\t\t328401DB179A576300B0CA20 /* assert.mm in Sources */,\n\t\t\t\t328401DC179A576300B0CA20 /* CiOSAudio.mm in Sources */,\n\t\t\t\t328401DD179A576300B0CA20 /* CiOSWidget.mm in Sources */,\n\t\t\t\t328401DE179A576300B0CA20 /* EAGLView.mm in Sources */,\n\t\t\t\t328401E1179A576300B0CA20 /* CiOSReadFileStream.cpp in Sources */,\n\t\t\t\t328401E2179A576300B0CA20 /* CiOSPathConv.mm in Sources */,\n\t\t\t\t328401E3179A576300B0CA20 /* CiOSTmpFile.cpp in Sources */,\n\t\t\t\t328401E4179A576300B0CA20 /* CSockReadStream.cpp in Sources */,\n\t\t\t\t328401E6179A576300B0CA20 /* CiOSMovieView.mm in Sources */,\n\t\t\t\t328401E7179A576300B0CA20 /* CiOSSysResource.mm in Sources */,\n\t\t\t\t328401E8179A576300B0CA20 /* CiOSWriteFileStream.cpp in Sources */,\n\t\t\t\t328401E9179A576300B0CA20 /* CSockWriteStream.cpp in Sources */,\n\t\t\t\t32F55E8F179B0796003807CE /* CiOSWebView.mm in Sources */,\n\t\t\t\t6F65D8C9179CDDD900E9F3CE /* NSGLView.mm in Sources */,\n\t\t\t\t6F65D8CC179CE01300E9F3CE /* OpenGLRenderer.mm in Sources */,\n\t\t\t\t32F55EAD179CFA29003807CE /* character.fsh in Sources */,\n\t\t\t\t32F55EAE179CFA29003807CE /* character.vsh in Sources */,\n\t\t\t\t32F55EAF179CFA29003807CE /* reflect.fsh in Sources */,\n\t\t\t\t32F55EB0179CFA29003807CE /* reflect.vsh in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t32D86B00182F73E700210C28 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86C4D182F753100210C28 /* cff.c in Sources */,\n\t\t\t\t32D86C4E182F753100210C28 /* type1cid.c in Sources */,\n\t\t\t\t32D86C4F182F753100210C28 /* pcf.c in Sources */,\n\t\t\t\t32D86C50182F753100210C28 /* psmodule.c in Sources */,\n\t\t\t\t32D86C24182F751B00210C28 /* autofit.c in Sources */,\n\t\t\t\t32D86C25182F751B00210C28 /* ftbase.c in Sources */,\n\t\t\t\t32D86C26182F751B00210C28 /* ftbbox.c in Sources */,\n\t\t\t\t32D86C27182F751B00210C28 /* ftbitmap.c in Sources */,\n\t\t\t\t32D86C28182F751B00210C28 /* ftfstype.c in Sources */,\n\t\t\t\t32D86C29182F751B00210C28 /* ftgasp.c in Sources */,\n\t\t\t\t32D86C2A182F751B00210C28 /* ftglyph.c in Sources */,\n\t\t\t\t32D86C2B182F751B00210C28 /* ftgxval.c in Sources */,\n\t\t\t\t32D86C2C182F751B00210C28 /* ftinit.c in Sources */,\n\t\t\t\t32D86C2D182F751B00210C28 /* ftlcdfil.c in Sources */,\n\t\t\t\t32D86C2E182F751B00210C28 /* ftmm.c in Sources */,\n\t\t\t\t32D86C2F182F751B00210C28 /* ftotval.c in Sources */,\n\t\t\t\t32D86C30182F751B00210C28 /* ftpatent.c in Sources */,\n\t\t\t\t32D86C31182F751B00210C28 /* ftpfr.c in Sources */,\n\t\t\t\t32D86C32182F751B00210C28 /* ftstroke.c in Sources */,\n\t\t\t\t32D86C33182F751B00210C28 /* ftsynth.c in Sources */,\n\t\t\t\t32D86C34182F751B00210C28 /* ftsystem.c in Sources */,\n\t\t\t\t32D86C35182F751B00210C28 /* fttype1.c in Sources */,\n\t\t\t\t32D86C36182F751B00210C28 /* ftwinfnt.c in Sources */,\n\t\t\t\t32D86C37182F751B00210C28 /* ftxf86.c in Sources */,\n\t\t\t\t32D86C38182F751B00210C28 /* bdf.c in Sources */,\n\t\t\t\t32D86C39182F751B00210C28 /* ftcache.c in Sources */,\n\t\t\t\t32D86C3A182F751B00210C28 /* ftdebug.c in Sources */,\n\t\t\t\t32D86C3B182F751B00210C28 /* pfr.c in Sources */,\n\t\t\t\t32D86C3C182F751B00210C28 /* psaux.c in Sources */,\n\t\t\t\t32D86C3D182F751B00210C28 /* pshinter.c in Sources */,\n\t\t\t\t32D86C3E182F751B00210C28 /* raster.c in Sources */,\n\t\t\t\t32D86C3F182F751B00210C28 /* sfnt.c in Sources */,\n\t\t\t\t32D86C40182F751B00210C28 /* smooth.c in Sources */,\n\t\t\t\t32D86C41182F751B00210C28 /* truetype.c in Sources */,\n\t\t\t\t32D86C42182F751B00210C28 /* type1.c in Sources */,\n\t\t\t\t32D86C43182F751B00210C28 /* type42.c in Sources */,\n\t\t\t\t32D86C44182F751B00210C28 /* winfnt.c in Sources */,\n\t\t\t\t32D86C45182F751B00210C28 /* matrixUtil.c in Sources */,\n\t\t\t\t32D86C46182F751B00210C28 /* modelUtil.c in Sources */,\n\t\t\t\t32D86C47182F751B00210C28 /* sourceUtil.c in Sources */,\n\t\t\t\t32D86C48182F751B00210C28 /* vectorUtil.c in Sources */,\n\t\t\t\t32D86C49182F751B00210C28 /* CKLBDatabase.cpp in Sources */,\n\t\t\t\t32D86C4A182F751B00210C28 /* CKLBLuaDB.cpp in Sources */,\n\t\t\t\t32D86C4B182F751B00210C28 /* CKLBLanguageDatabase.cpp in Sources */,\n\t\t\t\t32D86C4C182F751B00210C28 /* DataSet_JSonDB.cpp in Sources */,\n\t\t\t\t32D86C15182F74E900210C28 /* PlaygroundAppDelegate.mm in Sources */,\n\t\t\t\t32D86C17182F74E900210C28 /* imageUtil.m in Sources */,\n\t\t\t\t32D86C18182F74E900210C28 /* OpenGLRenderer.mm in Sources */,\n\t\t\t\t32D86C19182F74E900210C28 /* NSGLView.mm in Sources */,\n\t\t\t\t32D86C1A182F74E900210C28 /* assert.mm in Sources */,\n\t\t\t\t32D86C1B182F74E900210C28 /* CiOSAudio.mm in Sources */,\n\t\t\t\t32D86C1C182F74E900210C28 /* CiOSAudioManager.mm in Sources */,\n\t\t\t\t32D86C1D182F74E900210C28 /* CiOSMovieView.mm in Sources */,\n\t\t\t\t32D86C1E182F74E900210C28 /* CiOSPathConv.mm in Sources */,\n\t\t\t\t32D86C1F182F74E900210C28 /* CiOSPlatform.mm in Sources */,\n\t\t\t\t32D86C20182F74E900210C28 /* CiOSSysResource.mm in Sources */,\n\t\t\t\t32D86C21182F74E900210C28 /* CiOSWebView.mm in Sources */,\n\t\t\t\t32D86C22182F74E900210C28 /* CiOSWidget.mm in Sources */,\n\t\t\t\t32D86C23182F74E900210C28 /* EAGLView.mm in Sources */,\n\t\t\t\t32D86B51182F74A500210C28 /* yajl_buf.c in Sources */,\n\t\t\t\t32D86B52182F74A500210C28 /* yajl_encode.c in Sources */,\n\t\t\t\t32D86B53182F74A500210C28 /* yajl_lex.c in Sources */,\n\t\t\t\t32D86B54182F74A500210C28 /* yajl_parser.c in Sources */,\n\t\t\t\t32D86B55182F74A500210C28 /* yajl_tree.c in Sources */,\n\t\t\t\t32D86B56182F74A500210C28 /* yajl.c in Sources */,\n\t\t\t\t32D86B57182F74A500210C28 /* json_binary_parser.c in Sources */,\n\t\t\t\t32D86B58182F74A500210C28 /* msg_pack_parser.c in Sources */,\n\t\t\t\t32D86B59182F74A500210C28 /* yajl_alloc.c in Sources */,\n\t\t\t\t32D86B5A182F74A500210C28 /* yajl_gen.c in Sources */,\n\t\t\t\t32D86B5B182F74A500210C28 /* yajl_version.c in Sources */,\n\t\t\t\t32D86B5C182F74A500210C28 /* lapi.c in Sources */,\n\t\t\t\t32D86B5D182F74A500210C28 /* lauxlib.c in Sources */,\n\t\t\t\t32D86B5E182F74A500210C28 /* lbaselib.c in Sources */,\n\t\t\t\t32D86B5F182F74A500210C28 /* lbitlib.c in Sources */,\n\t\t\t\t32D86B60182F74A500210C28 /* lcode.c in Sources */,\n\t\t\t\t32D86B61182F74A500210C28 /* lcorolib.c in Sources */,\n\t\t\t\t32D86B62182F74A500210C28 /* lctype.c in Sources */,\n\t\t\t\t32D86B63182F74A500210C28 /* ldblib.c in Sources */,\n\t\t\t\t32D86B64182F74A500210C28 /* ldebug.c in Sources */,\n\t\t\t\t32D86B65182F74A500210C28 /* ldo.c in Sources */,\n\t\t\t\t32D86B66182F74A500210C28 /* ldump.c in Sources */,\n\t\t\t\t32D86B67182F74A500210C28 /* lfunc.c in Sources */,\n\t\t\t\t32D86B68182F74A500210C28 /* lgc.c in Sources */,\n\t\t\t\t32D86B69182F74A500210C28 /* linit.c in Sources */,\n\t\t\t\t32D86B6A182F74A500210C28 /* liolib.c in Sources */,\n\t\t\t\t32D86B6B182F74A500210C28 /* llex.c in Sources */,\n\t\t\t\t32D86B6C182F74A500210C28 /* lmathlib.c in Sources */,\n\t\t\t\t32D86B6D182F74A500210C28 /* lmem.c in Sources */,\n\t\t\t\t32D86B6E182F74A500210C28 /* loadlib.c in Sources */,\n\t\t\t\t32D86B6F182F74A500210C28 /* lobject.c in Sources */,\n\t\t\t\t32D86B70182F74A500210C28 /* lopcodes.c in Sources */,\n\t\t\t\t32D86B71182F74A500210C28 /* loslib.c in Sources */,\n\t\t\t\t32D86B72182F74A500210C28 /* lparser.c in Sources */,\n\t\t\t\t32D86B73182F74A500210C28 /* lstate.c in Sources */,\n\t\t\t\t32D86B74182F74A500210C28 /* lstring.c in Sources */,\n\t\t\t\t32D86B75182F74A500210C28 /* lstrlib.c in Sources */,\n\t\t\t\t32D86B76182F74A500210C28 /* ltable.c in Sources */,\n\t\t\t\t32D86B77182F74A500210C28 /* ltablib.c in Sources */,\n\t\t\t\t32D86B78182F74A500210C28 /* ltm.c in Sources */,\n\t\t\t\t32D86B79182F74A500210C28 /* lundump.c in Sources */,\n\t\t\t\t32D86B7A182F74A500210C28 /* lvm.c in Sources */,\n\t\t\t\t32D86B7B182F74A500210C28 /* lzio.c in Sources */,\n\t\t\t\t32D86B7C182F74A500210C28 /* ioapi.c in Sources */,\n\t\t\t\t32D86B7D182F74A500210C28 /* mztools.c in Sources */,\n\t\t\t\t32D86B7E182F74A500210C28 /* unzip.c in Sources */,\n\t\t\t\t32D86B7F182F74A500210C28 /* hash_sha1.c in Sources */,\n\t\t\t\t32D86B80182F74A500210C28 /* sqlite3.c in Sources */,\n\t\t\t\t32D86B81182F74A500210C28 /* utf8.c in Sources */,\n\t\t\t\t32D86B82182F74A500210C28 /* CiOSReadFileStream.cpp in Sources */,\n\t\t\t\t32D86B83182F74A500210C28 /* CiOSTmpFile.cpp in Sources */,\n\t\t\t\t32D86B84182F74A500210C28 /* CiOSWriteFileStream.cpp in Sources */,\n\t\t\t\t32D86B85182F74A500210C28 /* CSockReadStream.cpp in Sources */,\n\t\t\t\t32D86B86182F74A500210C28 /* CSockWriteStream.cpp in Sources */,\n\t\t\t\t32D86B87182F74A500210C28 /* FileDelete.cpp in Sources */,\n\t\t\t\t32D86B88182F74A500210C28 /* FontRendering.cpp in Sources */,\n\t\t\t\t32D86B89182F74A500210C28 /* CKLBNodeVirtualDocument.cpp in Sources */,\n\t\t\t\t32D86B8A182F74A500210C28 /* CKLBSplineNode.cpp in Sources */,\n\t\t\t\t32D86B8B182F74A500210C28 /* CKLBSWFPlayer.cpp in Sources */,\n\t\t\t\t32D86B8C182F74A500210C28 /* CKLBScoreNode.cpp in Sources */,\n\t\t\t\t32D86B8D182F74A500210C28 /* CKLBSystem.cpp in Sources */,\n\t\t\t\t32D86B8E182F74A500210C28 /* CKLBTexturePacker.cpp in Sources */,\n\t\t\t\t32D86B8F182F74A500210C28 /* CompositeManagement.cpp in Sources */,\n\t\t\t\t32D86B90182F74A500210C28 /* TextureManagement.cpp in Sources */,\n\t\t\t\t32D86B91182F74A500210C28 /* CKLBAssetManager.cpp in Sources */,\n\t\t\t\t32D86B92182F74A500210C28 /* AudioAsset.cpp in Sources */,\n\t\t\t\t32D86B93182F74A500210C28 /* CKLBPropertyBag.cpp in Sources */,\n\t\t\t\t32D86B94182F74A500210C28 /* NodeAnimationAsset.cpp in Sources */,\n\t\t\t\t32D86B95182F74A500210C28 /* CKLBScriptEnv_forLUA.cpp in Sources */,\n\t\t\t\t32D86B96182F74A500210C28 /* CKLBTask.cpp in Sources */,\n\t\t\t\t32D86B97182F74A500210C28 /* CKLBAsyncFilecopy.cpp in Sources */,\n\t\t\t\t32D86B98182F74A500210C28 /* CKLBGameApplication.cpp in Sources */,\n\t\t\t\t32D86B99182F74A500210C28 /* CKLBLuaEnv.cpp in Sources */,\n\t\t\t\t32D86B9A182F74A500210C28 /* CKLBUITask.cpp in Sources */,\n\t\t\t\t32D86B9B182F74A500210C28 /* encryptFile.cpp in Sources */,\n\t\t\t\t32D86B9C182F74A500210C28 /* CKLBDebugger.cpp in Sources */,\n\t\t\t\t32D86B9D182F74A500210C28 /* CKLBGameApplicationDebugModule.cpp in Sources */,\n\t\t\t\t32D86B9E182F74A500210C28 /* CKLBIntervalTimer.cpp in Sources */,\n\t\t\t\t32D86B9F182F74A500210C28 /* CKLBLuaPropTask.cpp in Sources */,\n\t\t\t\t32D86BA0182F74A500210C28 /* CKLBUtility.cpp in Sources */,\n\t\t\t\t32D86BA1182F74A500210C28 /* CKLBDataHandler.cpp in Sources */,\n\t\t\t\t32D86BA2182F74A500210C28 /* Dictionnary.cpp in Sources */,\n\t\t\t\t32D86BA3182F74A500210C28 /* CKLBBinArray.cpp in Sources */,\n\t\t\t\t32D86BA4182F74A500210C28 /* CKLBContext.cpp in Sources */,\n\t\t\t\t32D86BA5182F74A500210C28 /* DebugAlloc.cpp in Sources */,\n\t\t\t\t32D86BA6182F74A500210C28 /* DebugTracker.cpp in Sources */,\n\t\t\t\t32D86BA7182F74A500210C28 /* CKLBAppProperty.cpp in Sources */,\n\t\t\t\t32D86BA8182F74A500210C28 /* CKLBAsyncLoader.cpp in Sources */,\n\t\t\t\t32D86BA9182F74A500210C28 /* CKLBGenericTask.cpp in Sources */,\n\t\t\t\t32D86BAA182F74A500210C28 /* CKLBLibRegistrator.cpp in Sources */,\n\t\t\t\t32D86BAB182F74A500210C28 /* CKLBLifeCtrlTask.cpp in Sources */,\n\t\t\t\t32D86BAC182F74A500210C28 /* CKLBLuaTask.cpp in Sources */,\n\t\t\t\t32D86BAD182F74A500210C28 /* CKLBObject.cpp in Sources */,\n\t\t\t\t32D86BAE182F74A500210C28 /* CKLBPauseCtrl.cpp in Sources */,\n\t\t\t\t32D86BAF182F74A500210C28 /* CKLBTextTempBuffer.cpp in Sources */,\n\t\t\t\t32D86BB0182F74A500210C28 /* CLuaState.cpp in Sources */,\n\t\t\t\t32D86BB1182F74A500210C28 /* CPFInterface.cpp in Sources */,\n\t\t\t\t32D86BB2182F74A500210C28 /* ITmpFile.cpp in Sources */,\n\t\t\t\t32D86BB3182F74A500210C28 /* CKLBStoreService.cpp in Sources */,\n\t\t\t\t32D86BB4182F74A500210C28 /* CKLBNetAPI.cpp in Sources */,\n\t\t\t\t32D86BB5182F74A500210C28 /* CKLBHTTPInterface.cpp in Sources */,\n\t\t\t\t32D86BB6182F74A500210C28 /* CKLBUpdate.cpp in Sources */,\n\t\t\t\t32D86BB7182F74A500210C28 /* CUnZip.cpp in Sources */,\n\t\t\t\t32D86BB8182F74A500210C28 /* CKLBJsonItem.cpp in Sources */,\n\t\t\t\t32D86BB9182F74A500210C28 /* MultithreadedNetwork.cpp in Sources */,\n\t\t\t\t32D86BBA182F74A500210C28 /* CKLBNetAPIKeyChain.cpp in Sources */,\n\t\t\t\t32D86BBB182F74A500210C28 /* CKLBLuaLibAPP.cpp in Sources */,\n\t\t\t\t32D86BBC182F74A500210C28 /* CKLBLuaLibENG.cpp in Sources */,\n\t\t\t\t32D86BBD182F74A500210C28 /* CKLBLuaLibFONT.cpp in Sources */,\n\t\t\t\t32D86BBE182F74A500210C28 /* CKLBLuaLibHASH.cpp in Sources */,\n\t\t\t\t32D86BBF182F74A500210C28 /* CKLBLuaLibSOUND.cpp in Sources */,\n\t\t\t\t32D86BC0182F74A500210C28 /* CKLBLuaLibGL.cpp in Sources */,\n\t\t\t\t32D86BC1182F74A500210C28 /* CKLBLuaLibDATA.cpp in Sources */,\n\t\t\t\t32D86BC2182F74A500210C28 /* CKLBLuaLibMatrix.cpp in Sources */,\n\t\t\t\t32D86BC3182F74A500210C28 /* ILuaFuncLib.cpp in Sources */,\n\t\t\t\t32D86BC4182F74A500210C28 /* CKLBLuaLibCONV.cpp in Sources */,\n\t\t\t\t32D86BC5182F74A500210C28 /* CKLBLuaLibKEY.cpp in Sources */,\n\t\t\t\t32D86BC6182F74A500210C28 /* CKLBLuaLibTASK.cpp in Sources */,\n\t\t\t\t32D86BC7182F74A500210C28 /* CKLBLuaLibASSET.cpp in Sources */,\n\t\t\t\t32D86BC8182F74A500210C28 /* CKLBLuaConst.cpp in Sources */,\n\t\t\t\t32D86BC9182F74A500210C28 /* CKLBLuaLibBIN.cpp in Sources */,\n\t\t\t\t32D86BCA182F74A500210C28 /* CKLBLuaLibDB.cpp in Sources */,\n\t\t\t\t32D86BCB182F74A500210C28 /* CKLBLuaLibDEBUG.cpp in Sources */,\n\t\t\t\t32D86BCC182F74A500210C28 /* CKLBLuaLibLANG.cpp in Sources */,\n\t\t\t\t32D86BCD182F74A500210C28 /* CKLBLuaLibRES.cpp in Sources */,\n\t\t\t\t32D86BCE182F74A500210C28 /* CKLBLuaLibUI.cpp in Sources */,\n\t\t\t\t32D86BCF182F74A500210C28 /* CKLBRenderingManager.cpp in Sources */,\n\t\t\t\t32D86BD0182F74A500210C28 /* CRenderingManager_GL1.cpp in Sources */,\n\t\t\t\t32D86BD1182F74A500210C28 /* CRenderingManager_GL2.cpp in Sources */,\n\t\t\t\t32D86BD2182F74A500210C28 /* CRenderingManager.cpp in Sources */,\n\t\t\t\t32D86BD3182F74A500210C28 /* CTextureUsage.cpp in Sources */,\n\t\t\t\t32D86BD4182F74A500210C28 /* CBuffer.cpp in Sources */,\n\t\t\t\t32D86BD5182F74A500210C28 /* CIndexBuffer.cpp in Sources */,\n\t\t\t\t32D86BD6182F74A500210C28 /* CTextureBase.cpp in Sources */,\n\t\t\t\t32D86BD7182F74A500210C28 /* glWrapper.cpp in Sources */,\n\t\t\t\t32D86BD8182F74A500210C28 /* CFrame.cpp in Sources */,\n\t\t\t\t32D86BD9182F74A500210C28 /* CImageBuffer.cpp in Sources */,\n\t\t\t\t32D86BDA182F74A500210C28 /* CKLBCanvasSprite.cpp in Sources */,\n\t\t\t\t32D86BDB182F74A500210C28 /* CKLBSprite3D.cpp in Sources */,\n\t\t\t\t32D86BDC182F74A500210C28 /* CShaderSet.cpp in Sources */,\n\t\t\t\t32D86BDD182F74A500210C28 /* CShaderSetInstance.cpp in Sources */,\n\t\t\t\t32D86BDE182F74A500210C28 /* CTexture.cpp in Sources */,\n\t\t\t\t32D86BDF182F74A500210C28 /* CKLBNode.cpp in Sources */,\n\t\t\t\t32D86BE0182F74A500210C28 /* CSoundAnalysisMP3.cpp in Sources */,\n\t\t\t\t32D86BE1182F74A500210C28 /* CSoundAnalysis.cpp in Sources */,\n\t\t\t\t32D86BE2182F74A500210C28 /* CKLBDeviceKeyEvent.cpp in Sources */,\n\t\t\t\t32D86BE3182F74A500210C28 /* CKLBDrawTask.cpp in Sources */,\n\t\t\t\t32D86BE4182F74A500210C28 /* CKLBDebugMenu.cpp in Sources */,\n\t\t\t\t32D86BE5182F74A500210C28 /* CKLBTouchPad.cpp in Sources */,\n\t\t\t\t32D86BE6182F74A500210C28 /* CKLBTouchEventUI.cpp in Sources */,\n\t\t\t\t32D86BE7182F74A500210C28 /* CKLBOSCtrlEvent.cpp in Sources */,\n\t\t\t\t32D86BE8182F74A500210C28 /* CKLBLuaScript.cpp in Sources */,\n\t\t\t\t32D86BE9182F74A500210C28 /* CKLBUIVirtualDoc.cpp in Sources */,\n\t\t\t\t32D86BEA182F74A500210C28 /* CKLBUIList.cpp in Sources */,\n\t\t\t\t32D86BEB182F74A500210C28 /* CKLBScrMgrDefault.cpp in Sources */,\n\t\t\t\t32D86BEC182F74A500210C28 /* CKLBScrMgrPage.cpp in Sources */,\n\t\t\t\t32D86BED182F74A500210C28 /* CKLBUICanvas.cpp in Sources */,\n\t\t\t\t32D86BEE182F74A500210C28 /* CKLBUIDragIcon.cpp in Sources */,\n\t\t\t\t32D86BEF182F74A500210C28 /* CKLBUIFreeVertItem.cpp in Sources */,\n\t\t\t\t32D86BF0182F74A500210C28 /* CKLBUIProgressBar.cpp in Sources */,\n\t\t\t\t32D86BF1182F74A600210C28 /* CKLBUIVariableItem.cpp in Sources */,\n\t\t\t\t32D86BF2182F74A600210C28 /* CKLBScrMgrSolid.cpp in Sources */,\n\t\t\t\t32D86BF3182F74A600210C28 /* CKLBScrollBarIF.cpp in Sources */,\n\t\t\t\t32D86BF4182F74A600210C28 /* CKLBLabelNode.cpp in Sources */,\n\t\t\t\t32D86BF5182F74A600210C28 /* CKLBMovieNode.cpp in Sources */,\n\t\t\t\t32D86BF6182F74A600210C28 /* CKLBTextInputNode.cpp in Sources */,\n\t\t\t\t32D86BF7182F74A600210C28 /* CKLBUIDebugItem.cpp in Sources */,\n\t\t\t\t32D86BF8182F74A600210C28 /* CKLBUIWebArea.cpp in Sources */,\n\t\t\t\t32D86BF9182F74A600210C28 /* CKLBWebViewNode.cpp in Sources */,\n\t\t\t\t32D86BFA182F74A600210C28 /* CKLBUIClip.cpp in Sources */,\n\t\t\t\t32D86BFB182F74A600210C28 /* CKLBUIMultiImgItem.cpp in Sources */,\n\t\t\t\t32D86BFC182F74A600210C28 /* CKLBUISWFPlayer.cpp in Sources */,\n\t\t\t\t32D86BFD182F74A600210C28 /* CKLBUISystem.cpp in Sources */,\n\t\t\t\t32D86BFE182F74A600210C28 /* CKLBUITouchPad.cpp in Sources */,\n\t\t\t\t32D86BFF182F74A600210C28 /* CKLBUIForm.cpp in Sources */,\n\t\t\t\t32D86C00182F74A600210C28 /* CKLBUILabel.cpp in Sources */,\n\t\t\t\t32D86C01182F74A600210C28 /* CKLBUIControl.cpp in Sources */,\n\t\t\t\t32D86C02182F74A600210C28 /* CKLBUIScale9.cpp in Sources */,\n\t\t\t\t32D86C03182F74A600210C28 /* CKLBUITextInput.cpp in Sources */,\n\t\t\t\t32D86C04182F74A600210C28 /* CKLBActivityIndicatorNode.cpp in Sources */,\n\t\t\t\t32D86C05182F74A600210C28 /* CKLBDragCallbackIF.cpp in Sources */,\n\t\t\t\t32D86C06182F74A600210C28 /* CKLBFormGroup.cpp in Sources */,\n\t\t\t\t32D86C07182F74A600210C28 /* CKLBFormIF.cpp in Sources */,\n\t\t\t\t32D86C08182F74A600210C28 /* CKLBModalStack.cpp in Sources */,\n\t\t\t\t32D86C09182F74A600210C28 /* CKLBNodeAnimPack.cpp in Sources */,\n\t\t\t\t32D86C0A182F74A600210C28 /* CKLBUIActivityIndicator.cpp in Sources */,\n\t\t\t\t32D86C0B182F74A600210C28 /* CKLBUIGroup.cpp in Sources */,\n\t\t\t\t32D86C0C182F74A600210C28 /* CKLBUIMoviePlayer.cpp in Sources */,\n\t\t\t\t32D86C0D182F74A600210C28 /* CKLBUIPieChart.cpp in Sources */,\n\t\t\t\t32D86C0E182F74A600210C28 /* CKLBUIPolyline.cpp in Sources */,\n\t\t\t\t32D86C0F182F74A600210C28 /* CKLBUIRubberBand.cpp in Sources */,\n\t\t\t\t32D86C10182F74A600210C28 /* CKLBUIScore.cpp in Sources */,\n\t\t\t\t32D86C11182F74A600210C28 /* CKLBUIScrollBar.cpp in Sources */,\n\t\t\t\t32D86C12182F74A600210C28 /* CKLBUISimpleItem.cpp in Sources */,\n\t\t\t\t32D86C13182F74A600210C28 /* IMgrEntry.cpp in Sources */,\n\t\t\t\t32D86C14182F74A600210C28 /* CSampleProjectEntrance.cpp in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t32D86B15182F73E700210C28 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86B27182F73E800210C28 /* PlaygroundOSSTests.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t32D86B1E182F73E800210C28 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 32D86B04182F73E700210C28 /* PlaygroundOSS */;\n\t\t\ttargetProxy = 32D86B1D182F73E800210C28 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin PBXVariantGroup section */\n\t\t327C0B92179A3944007B7F42 /* InfoPlist.strings */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0B93179A3944007B7F42 /* en */,\n\t\t\t);\n\t\t\tname = InfoPlist.strings;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0B98179A3945007B7F42 /* Credits.rtf */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0B99179A3945007B7F42 /* en */,\n\t\t\t);\n\t\t\tname = Credits.rtf;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t327C0B9E179A3945007B7F42 /* MainMenu.xib */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t327C0B9F179A3945007B7F42 /* en */,\n\t\t\t);\n\t\t\tname = MainMenu.xib;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32D86B23182F73E800210C28 /* InfoPlist.strings */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86B24182F73E800210C28 /* en */,\n\t\t\t);\n\t\t\tname = InfoPlist.strings;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t327C0BA1179A3945007B7F42 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD_64_BIT)\";\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.8;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t327C0BA2179A3945007B7F42 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD_64_BIT)\";\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.8;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t327C0BA4179A3945007B7F42 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"\\\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\\\"\",\n\t\t\t\t);\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = NO;\n\t\t\t\tGCC_PREFIX_HEADER = \"Playground/Playground-Prefix.pch\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\tDEBUG_MENU,\n\t\t\t\t\tFT2_BUILD_LIBRARY,\n\t\t\t\t);\n\t\t\t\tHEADER_SEARCH_PATHS = \"\\\"$(SRCROOT)/../../libs/freeType/include\\\"\";\n\t\t\t\tINFOPLIST_FILE = \"Playground/Playground-Info.plist\";\n\t\t\t\tLIBRARY_SEARCH_PATHS = \"\";\n\t\t\t\tPRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t327C0BA5179A3945007B7F42 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"\\\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\\\"\",\n\t\t\t\t);\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = NO;\n\t\t\t\tGCC_PREFIX_HEADER = \"Playground/Playground-Prefix.pch\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\tDEBUG_MENU,\n\t\t\t\t\tFT2_BUILD_LIBRARY,\n\t\t\t\t);\n\t\t\t\tHEADER_SEARCH_PATHS = \"\\\"$(SRCROOT)/../../libs/freeType/include\\\"\";\n\t\t\t\tINFOPLIST_FILE = \"Playground/Playground-Info.plist\";\n\t\t\t\tLIBRARY_SEARCH_PATHS = \"\";\n\t\t\t\tPRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = app;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t32D86B28182F73E800210C28 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = NO;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES;\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = NO;\n\t\t\t\tGCC_PREFIX_HEADER = \"PlaygroundOSS/PlaygroundOSS-Prefix.pch\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\tFT2_BUILD_LIBRARY,\n\t\t\t\t);\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = NO;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = NO;\n\t\t\t\tGENERATE_MASTER_OBJECT_FILE = YES;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../libs/freeType/include\\\"\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"PlaygroundOSS/PlaygroundOSS-Info.plist\";\n\t\t\t\tLINK_WITH_STANDARD_LIBRARIES = YES;\n\t\t\t\tMACH_O_TYPE = staticlib;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.9;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = framework;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t32D86B29182F73E800210C28 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = NO;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES;\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = NO;\n\t\t\t\tGCC_PREFIX_HEADER = \"PlaygroundOSS/PlaygroundOSS-Prefix.pch\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = FT2_BUILD_LIBRARY;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = NO;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = NO;\n\t\t\t\tGENERATE_MASTER_OBJECT_FILE = YES;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../libs/freeType/include\\\"\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = \"PlaygroundOSS/PlaygroundOSS-Info.plist\";\n\t\t\t\tLINK_WITH_STANDARD_LIBRARIES = YES;\n\t\t\t\tMACH_O_TYPE = staticlib;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.9;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = framework;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t32D86B2A182F73E800210C28 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(DEVELOPER_FRAMEWORKS_DIR)\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"PlaygroundOSS/PlaygroundOSS-Prefix.pch\";\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tINFOPLIST_FILE = \"PlaygroundOSSTests/PlaygroundOSSTests-Info.plist\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.9;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = xctest;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t32D86B2B182F73E800210C28 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(DEVELOPER_FRAMEWORKS_DIR)\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"PlaygroundOSS/PlaygroundOSS-Prefix.pch\";\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tINFOPLIST_FILE = \"PlaygroundOSSTests/PlaygroundOSSTests-Info.plist\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.9;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tWRAPPER_EXTENSION = xctest;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t327C0B81179A3944007B7F42 /* Build configuration list for PBXProject \"Playground\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t327C0BA1179A3945007B7F42 /* Debug */,\n\t\t\t\t327C0BA2179A3945007B7F42 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t327C0BA3179A3945007B7F42 /* Build configuration list for PBXNativeTarget \"Playground\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t327C0BA4179A3945007B7F42 /* Debug */,\n\t\t\t\t327C0BA5179A3945007B7F42 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t32D86B2C182F73E800210C28 /* Build configuration list for PBXNativeTarget \"PlaygroundOSS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t32D86B28182F73E800210C28 /* Debug */,\n\t\t\t\t32D86B29182F73E800210C28 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t};\n\t\t32D86B2D182F73E800210C28 /* Build configuration list for PBXNativeTarget \"PlaygroundOSSTests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t32D86B2A182F73E800210C28 /* Debug */,\n\t\t\t\t32D86B2B182F73E800210C28 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 327C0B7E179A3944007B7F42 /* Project object */;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/PlaygroundOSS/PlaygroundOSS-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.klab.${PRODUCT_NAME:rfc1034identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2013 KLab Inc. All rights reserved.</string>\n\t<key>NSPrincipalClass</key>\n\t<string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Engine/porting/OSX/PlaygroundOSS/PlaygroundOSS-Prefix.pch",
    "content": "//\n//  Prefix header\n//\n//  The contents of this file are implicitly included at the beginning of every source file.\n//\n\n#ifdef __OBJC__\n    #import <Cocoa/Cocoa.h>\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/PlaygroundOSS/en.lproj/InfoPlist.strings",
    "content": "/* Localized versions of Info.plist keys */\n\n"
  },
  {
    "path": "Engine/porting/OSX/PlaygroundOSSTests/PlaygroundOSSTests-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.klab.${PRODUCT_NAME:rfc1034identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Engine/porting/OSX/PlaygroundOSSTests/PlaygroundOSSTests.m",
    "content": "//\n//  PlaygroundOSSTests.m\n//  PlaygroundOSSTests\n//\n//  Created by Kei Nakazawa on 11/10/13.\n//  Copyright (c) 2013 KLab Inc. All rights reserved.\n//\n\n#import <XCTest/XCTest.h>\n\n@interface PlaygroundOSSTests : XCTestCase\n\n@end\n\n@implementation PlaygroundOSSTests\n\n- (void)setUp\n{\n    [super setUp];\n    // Put setup code here. This method is called before the invocation of each test method in the class.\n}\n\n- (void)tearDown\n{\n    // Put teardown code here. This method is called after the invocation of each test method in the class.\n    [super tearDown];\n}\n\n- (void)testExample\n{\n    XCTFail(@\"No implementation for \\\"%s\\\"\", __PRETTY_FUNCTION__);\n}\n\n@end\n"
  },
  {
    "path": "Engine/porting/OSX/PlaygroundOSSTests/en.lproj/InfoPlist.strings",
    "content": "/* Localized versions of Info.plist keys */\n\n"
  },
  {
    "path": "Engine/porting/OSX/Shaders/character.fsh",
    "content": "/*\n     File: character.fsh\n Abstract: The fragment shader for character rendering.\n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\n// Declare inputs and outputs\n// varTexcoord : TexCoord for the fragment computed by the rasterizer based on\n//               the varTexcoord values output in the vertex shader.\n// gl_FragColor : Implicitly declare in fragments shaders less than 1.40.\n//                Output color of our fragment.\n// fragColor : Output color of our fragment.  Basically the same as gl_FragColor,\n//             but we must explicitly declared this in shaders version 1.40 and\n//             above.\n\n#if __VERSION__ >= 140\nin vec2      varTexcoord;\nout vec4     fragColor;\n#else\nvarying vec2 varTexcoord;\n#endif\n\nuniform sampler2D diffuseTexture;\n\n\nvoid main (void)\n{\n\t#if __VERSION__ >= 140\n\tfragColor = texture(diffuseTexture, varTexcoord.st, 0.0);\n\t#else\n    gl_FragColor = texture2D(diffuseTexture, varTexcoord.st, 0.0);\n\t#endif\n}"
  },
  {
    "path": "Engine/porting/OSX/Shaders/character.vsh",
    "content": "/*\n     File: character.vsh\n Abstract: The vertex shader for character rendering.\n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\n// Declare our modelViewProjection matrix that we'll compute\n//  outside the shader and set each frame\nuniform mat4 modelViewProjectionMatrix;\n\n// Declare inputs and outputs\n// inPosition : Position attributes from the VAO/VBOs\n// inTexcoord : Texcoord attributes from the VAO/VBOs\n// varTexcoord : TexCoord we'll pass to the rasterizer\n// gl_Position : implicitly declared in all vertex shaders. Clip space position\n//               passed to rasterizer used to build the triangles\n\n#if __VERSION__ >= 140\nin vec4  inPosition;  \nin vec2  inTexcoord;\nout vec2 varTexcoord;\n#else\nattribute vec4 inPosition;  \nattribute vec2 inTexcoord;\nvarying vec2 varTexcoord;\n#endif\n\nvoid main (void) \n{\n\t// Transform the vertex by the model view projection matrix so\n\t// the polygon shows up in the right place\n\tgl_Position\t= modelViewProjectionMatrix * inPosition;\n\t\n\t// Pass the unmodified texture coordinate from the vertex buffer\n\t// directly down to the rasterizer.\n    varTexcoord = inTexcoord;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/Shaders/reflect.fsh",
    "content": "/*\n     File: reflect.fsh\n Abstract: The fragment shader for reflection rendering.\n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\n\nconst vec3 Xunitvec = vec3(1.0, 0.0, 0.0);\nconst vec3 Yunitvec = vec3(0.0, 1.0, 0.0);\n\n// Color of tint to apply (blue)\nconst vec4 tintColor = vec4(0.0, 0.0, 1.0, 1.0);\n\n// Amount of tint to apply\nconst float tintFactor = 0.2;\n\n// Declare inputs and outputs\n// varNormal : Normal for the fragment computed by the rasterizer based on the\n//             varNormal value output in the vertex shader\n// varEyeDir : EyeDir for the fragment computed by the rasterizer based on the\n//             varEyeDir value output in the vertex shader\n// gl_FragColor : Implicitly declare in fragments shaders less than 1.40.\n//                The output color of our fragment.\n// fragColor : Output color of our fragment.  Basically the same as gl_FragColor,\n//             but we must explicitly declared this in shaders version 1.40 and\n//             above.\n\n#if __VERSION__ >= 140\nin vec3       varNormal;\nin vec3       varEyeDir;\nout vec4      fragColor;\n#else\nvarying vec3  varNormal;\nvarying vec3  varEyeDir;\n#endif\n\nuniform sampler2D diffuseTexture;\n\nvoid main (void)\n{\n\t// Compute reflection vector\n    \n    vec3 reflectDir = reflect(varEyeDir, varNormal);\n\n    // Compute altitude and azimuth angles\n\n    vec2 texcoord;\n\n    texcoord.y = dot(normalize(reflectDir), Yunitvec);\n    reflectDir.y = 0.0;\n    texcoord.x = dot(normalize(reflectDir), Xunitvec) * 0.5;\n\n    // Translate index values into proper range\n\n    if (reflectDir.z >= 0.0)\n        texcoord = (texcoord + 1.0) * 0.5;\n    else\n    {\n        texcoord.t = (texcoord.t + 1.0) * 0.5;\n        texcoord.s = (-texcoord.s) * 0.5 + 1.0;\n    }\n    \n    // Do a lookup into the environment map.\n  \n\t#if __VERSION__ >= 140\n\tvec4 texColor = texture(diffuseTexture, texcoord);\n\t#else\n\tvec4 texColor = texture2D(diffuseTexture, texcoord);\n\t#endif\n\n    // Add some blue tint to the image so it looks more like a mirror or glass\n\n\t#if __VERSION__ >= 140\n\tfragColor    = mix(texColor, tintColor, tintFactor);\n\t#else\n    gl_FragColor = mix(texColor, tintColor, tintFactor);\n\t#endif\n}"
  },
  {
    "path": "Engine/porting/OSX/Shaders/reflect.vsh",
    "content": "/*\n     File: reflect.vsh\n Abstract: The vertex shader for reflection rendering.\n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat3 normalMatrix;\n\n// Declare inputs and outputs\n// inPosition : Position attribute from the VAO/VBOs\n// inNormal : Normal attribute from the VAO/VBOs\n// varNormal : Normalized normal value passed to the rasterizer and used\n//             to compute the reflection texture coordinates the fragment shader\n// verEyeDir : Direction of the eye is facing which we derive from the modelview\n//              matrix.  This is passed to the rasterizer and used to compute\n//              the reflection texture coordinate in the fragment shader\n// gl_Position : Implicitly declared in all vertex shaders.  The clip space\n//               position passed to rasterizer used to build the triangles\n\n#if __VERSION__ >= 140\nin vec3  inNormal;\nin vec4  inPosition;\nout vec3 varNormal;\nout vec3 varEyeDir;\n#else\nattribute vec3 inNormal;\nattribute vec4 inPosition;\nvarying vec3  varNormal;\nvarying vec3  varEyeDir;\n#endif\n\nvoid main (void)\n{\t\n\tgl_Position\t= modelViewProjectionMatrix * inPosition;\n\tvec4 eyePos = modelViewMatrix * inPosition;\n\t\n\tvarNormal = normalize(normalMatrix * inNormal);\n\tvarEyeDir = eyePos.xyz;\n}\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/curl.h",
    "content": "#ifndef __CURL_CURL_H\n#define __CURL_CURL_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n/*\n * If you have libcurl problems, all docs and details are found here:\n *   http://curl.haxx.se/libcurl/\n *\n * curl-library mailing list subscription and unsubscription web interface:\n *   http://cool.haxx.se/mailman/listinfo/curl-library/\n */\n\n#include \"curlver.h\"         /* libcurl version defines   */\n#include \"curlbuild.h\"       /* libcurl build definitions */\n#include \"curlrules.h\"       /* libcurl rules enforcement */\n\n/*\n * Define WIN32 when build target is Win32 API\n */\n\n#if (defined(_WIN32) || defined(__WIN32__)) && \\\n     !defined(WIN32) && !defined(__SYMBIAN32__)\n#define WIN32\n#endif\n\n#include <stdio.h>\n#include <limits.h>\n\n#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)\n/* Needed for __FreeBSD_version symbol definition */\n#include <osreldate.h>\n#endif\n\n/* The include stuff here below is mainly for time_t! */\n#include <sys/types.h>\n#include <time.h>\n\n#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)\n#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))\n/* The check above prevents the winsock2 inclusion if winsock.h already was\n   included, since they can't co-exist without problems */\n#include <winsock2.h>\n#include <ws2tcpip.h>\n#endif\n#endif\n\n/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish\n   libc5-based Linux systems. Only include it on systems that are known to\n   require it! */\n#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \\\n    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \\\n    defined(ANDROID) || defined(__ANDROID__) || \\\n   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))\n#include <sys/select.h>\n#endif\n\n#if !defined(WIN32) && !defined(_WIN32_WCE)\n#include <sys/socket.h>\n#endif\n\n#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)\n#include <sys/time.h>\n#endif\n\n#ifdef __BEOS__\n#include <support/SupportDefs.h>\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef void CURL;\n\n/*\n * Decorate exportable functions for Win32 and Symbian OS DLL linking.\n * This avoids using a .def file for building libcurl.dll.\n */\n#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \\\n     !defined(CURL_STATICLIB)\n#if defined(BUILDING_LIBCURL)\n#define CURL_EXTERN  __declspec(dllexport)\n#else\n#define CURL_EXTERN  __declspec(dllimport)\n#endif\n#else\n\n#ifdef CURL_HIDDEN_SYMBOLS\n/*\n * This definition is used to make external definitions visible in the\n * shared library when symbols are hidden by default.  It makes no\n * difference when compiling applications whether this is set or not,\n * only when compiling the library.\n */\n#define CURL_EXTERN CURL_EXTERN_SYMBOL\n#else\n#define CURL_EXTERN\n#endif\n#endif\n\n#ifndef curl_socket_typedef\n/* socket typedef */\n#if defined(WIN32) && !defined(__LWIP_OPT_H__)\ntypedef SOCKET curl_socket_t;\n#define CURL_SOCKET_BAD INVALID_SOCKET\n#else\ntypedef int curl_socket_t;\n#define CURL_SOCKET_BAD -1\n#endif\n#define curl_socket_typedef\n#endif /* curl_socket_typedef */\n\nstruct curl_httppost {\n  struct curl_httppost *next;       /* next entry in the list */\n  char *name;                       /* pointer to allocated name */\n  long namelength;                  /* length of name length */\n  char *contents;                   /* pointer to allocated data contents */\n  long contentslength;              /* length of contents field */\n  char *buffer;                     /* pointer to allocated buffer contents */\n  long bufferlength;                /* length of buffer field */\n  char *contenttype;                /* Content-Type */\n  struct curl_slist* contentheader; /* list of extra headers for this form */\n  struct curl_httppost *more;       /* if one field name has more than one\n                                       file, this link should link to following\n                                       files */\n  long flags;                       /* as defined below */\n#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */\n#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */\n#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer\n                                       do not free in formfree */\n#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer\n                                       do not free in formfree */\n#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */\n#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */\n#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the\n                                       regular read callback to get the data\n                                       and pass the given pointer as custom\n                                       pointer */\n\n  char *showfilename;               /* The file name to show. If not set, the\n                                       actual file name will be used (if this\n                                       is a file part) */\n  void *userp;                      /* custom pointer used for\n                                       HTTPPOST_CALLBACK posts */\n};\n\ntypedef int (*curl_progress_callback)(void *clientp,\n                                      double dltotal,\n                                      double dlnow,\n                                      double ultotal,\n                                      double ulnow);\n\n#ifndef CURL_MAX_WRITE_SIZE\n  /* Tests have proven that 20K is a very bad buffer size for uploads on\n     Windows, while 16K for some odd reason performed a lot better.\n     We do the ifndef check to allow this value to easier be changed at build\n     time for those who feel adventurous. The practical minimum is about\n     400 bytes since libcurl uses a buffer of this size as a scratch area\n     (unrelated to network send operations). */\n#define CURL_MAX_WRITE_SIZE 16384\n#endif\n\n#ifndef CURL_MAX_HTTP_HEADER\n/* The only reason to have a max limit for this is to avoid the risk of a bad\n   server feeding libcurl with a never-ending header that will cause reallocs\n   infinitely */\n#define CURL_MAX_HTTP_HEADER (100*1024)\n#endif\n\n/* This is a magic return code for the write callback that, when returned,\n   will signal libcurl to pause receiving on the current transfer. */\n#define CURL_WRITEFUNC_PAUSE 0x10000001\n\ntypedef size_t (*curl_write_callback)(char *buffer,\n                                      size_t size,\n                                      size_t nitems,\n                                      void *outstream);\n\n\n\n/* enumeration of file types */\ntypedef enum {\n  CURLFILETYPE_FILE = 0,\n  CURLFILETYPE_DIRECTORY,\n  CURLFILETYPE_SYMLINK,\n  CURLFILETYPE_DEVICE_BLOCK,\n  CURLFILETYPE_DEVICE_CHAR,\n  CURLFILETYPE_NAMEDPIPE,\n  CURLFILETYPE_SOCKET,\n  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */\n\n  CURLFILETYPE_UNKNOWN /* should never occur */\n} curlfiletype;\n\n#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)\n#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)\n#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)\n#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)\n#define CURLFINFOFLAG_KNOWN_UID         (1<<4)\n#define CURLFINFOFLAG_KNOWN_GID         (1<<5)\n#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)\n#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)\n\n/* Content of this structure depends on information which is known and is\n   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man\n   page for callbacks returning this structure -- some fields are mandatory,\n   some others are optional. The FLAG field has special meaning. */\nstruct curl_fileinfo {\n  char *filename;\n  curlfiletype filetype;\n  time_t time;\n  unsigned int perm;\n  int uid;\n  int gid;\n  curl_off_t size;\n  long int hardlinks;\n\n  struct {\n    /* If some of these fields is not NULL, it is a pointer to b_data. */\n    char *time;\n    char *perm;\n    char *user;\n    char *group;\n    char *target; /* pointer to the target filename of a symlink */\n  } strings;\n\n  unsigned int flags;\n\n  /* used internally */\n  char * b_data;\n  size_t b_size;\n  size_t b_used;\n};\n\n/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */\n#define CURL_CHUNK_BGN_FUNC_OK      0\n#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */\n#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */\n\n/* if splitting of data transfer is enabled, this callback is called before\n   download of an individual chunk started. Note that parameter \"remains\" works\n   only for FTP wildcard downloading (for now), otherwise is not used */\ntypedef long (*curl_chunk_bgn_callback)(const void *transfer_info,\n                                        void *ptr,\n                                        int remains);\n\n/* return codes for CURLOPT_CHUNK_END_FUNCTION */\n#define CURL_CHUNK_END_FUNC_OK      0\n#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */\n\n/* If splitting of data transfer is enabled this callback is called after\n   download of an individual chunk finished.\n   Note! After this callback was set then it have to be called FOR ALL chunks.\n   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.\n   This is the reason why we don't need \"transfer_info\" parameter in this\n   callback and we are not interested in \"remains\" parameter too. */\ntypedef long (*curl_chunk_end_callback)(void *ptr);\n\n/* return codes for FNMATCHFUNCTION */\n#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */\n#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */\n#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */\n\n/* callback type for wildcard downloading pattern matching. If the\n   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */\ntypedef int (*curl_fnmatch_callback)(void *ptr,\n                                     const char *pattern,\n                                     const char *string);\n\n/* These are the return codes for the seek callbacks */\n#define CURL_SEEKFUNC_OK       0\n#define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */\n#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so\n                                    libcurl might try other means instead */\ntypedef int (*curl_seek_callback)(void *instream,\n                                  curl_off_t offset,\n                                  int origin); /* 'whence' */\n\n/* This is a return code for the read callback that, when returned, will\n   signal libcurl to immediately abort the current transfer. */\n#define CURL_READFUNC_ABORT 0x10000000\n/* This is a return code for the read callback that, when returned, will\n   signal libcurl to pause sending data on the current transfer. */\n#define CURL_READFUNC_PAUSE 0x10000001\n\ntypedef size_t (*curl_read_callback)(char *buffer,\n                                      size_t size,\n                                      size_t nitems,\n                                      void *instream);\n\ntypedef enum  {\n  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */\n  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */\n  CURLSOCKTYPE_LAST    /* never use */\n} curlsocktype;\n\n/* The return code from the sockopt_callback can signal information back\n   to libcurl: */\n#define CURL_SOCKOPT_OK 0\n#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return\n                                CURLE_ABORTED_BY_CALLBACK */\n#define CURL_SOCKOPT_ALREADY_CONNECTED 2\n\ntypedef int (*curl_sockopt_callback)(void *clientp,\n                                     curl_socket_t curlfd,\n                                     curlsocktype purpose);\n\nstruct curl_sockaddr {\n  int family;\n  int socktype;\n  int protocol;\n  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it\n                           turned really ugly and painful on the systems that\n                           lack this type */\n  struct sockaddr addr;\n};\n\ntypedef curl_socket_t\n(*curl_opensocket_callback)(void *clientp,\n                            curlsocktype purpose,\n                            struct curl_sockaddr *address);\n\ntypedef int\n(*curl_closesocket_callback)(void *clientp, curl_socket_t item);\n\ntypedef enum {\n  CURLIOE_OK,            /* I/O operation successful */\n  CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */\n  CURLIOE_FAILRESTART,   /* failed to restart the read */\n  CURLIOE_LAST           /* never use */\n} curlioerr;\n\ntypedef enum  {\n  CURLIOCMD_NOP,         /* no operation */\n  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */\n  CURLIOCMD_LAST         /* never use */\n} curliocmd;\n\ntypedef curlioerr (*curl_ioctl_callback)(CURL *handle,\n                                         int cmd,\n                                         void *clientp);\n\n/*\n * The following typedef's are signatures of malloc, free, realloc, strdup and\n * calloc respectively.  Function pointers of these types can be passed to the\n * curl_global_init_mem() function to set user defined memory management\n * callback routines.\n */\ntypedef void *(*curl_malloc_callback)(size_t size);\ntypedef void (*curl_free_callback)(void *ptr);\ntypedef void *(*curl_realloc_callback)(void *ptr, size_t size);\ntypedef char *(*curl_strdup_callback)(const char *str);\ntypedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);\n\n/* the kind of data that is passed to information_callback*/\ntypedef enum {\n  CURLINFO_TEXT = 0,\n  CURLINFO_HEADER_IN,    /* 1 */\n  CURLINFO_HEADER_OUT,   /* 2 */\n  CURLINFO_DATA_IN,      /* 3 */\n  CURLINFO_DATA_OUT,     /* 4 */\n  CURLINFO_SSL_DATA_IN,  /* 5 */\n  CURLINFO_SSL_DATA_OUT, /* 6 */\n  CURLINFO_END\n} curl_infotype;\n\ntypedef int (*curl_debug_callback)\n       (CURL *handle,      /* the handle/transfer this concerns */\n        curl_infotype type, /* what kind of data */\n        char *data,        /* points to the data */\n        size_t size,       /* size of the data pointed to */\n        void *userptr);    /* whatever the user please */\n\n/* All possible error codes from all sorts of curl functions. Future versions\n   may return other values, stay prepared.\n\n   Always add new return codes last. Never *EVER* remove any. The return\n   codes must remain the same!\n */\n\ntypedef enum {\n  CURLE_OK = 0,\n  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */\n  CURLE_FAILED_INIT,             /* 2 */\n  CURLE_URL_MALFORMAT,           /* 3 */\n  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for\n                                    7.17.0, reused in April 2011 for 7.21.5] */\n  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */\n  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */\n  CURLE_COULDNT_CONNECT,         /* 7 */\n  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */\n  CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server\n                                    due to lack of access - when login fails\n                                    this is not returned. */\n  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for\n                                    7.15.4, reused in Dec 2011 for 7.24.0]*/\n  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */\n  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server\n                                    [was obsoleted in August 2007 for 7.17.0,\n                                    reused in Dec 2011 for 7.24.0]*/\n  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */\n  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */\n  CURLE_FTP_CANT_GET_HOST,       /* 15 */\n  CURLE_OBSOLETE16,              /* 16 - NOT USED */\n  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */\n  CURLE_PARTIAL_FILE,            /* 18 */\n  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */\n  CURLE_OBSOLETE20,              /* 20 - NOT USED */\n  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */\n  CURLE_HTTP_RETURNED_ERROR,     /* 22 */\n  CURLE_WRITE_ERROR,             /* 23 */\n  CURLE_OBSOLETE24,              /* 24 - NOT USED */\n  CURLE_UPLOAD_FAILED,           /* 25 - failed upload \"command\" */\n  CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */\n  CURLE_OUT_OF_MEMORY,           /* 27 */\n  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error\n           instead of a memory allocation error if CURL_DOES_CONVERSIONS\n           is defined\n  */\n  CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */\n  CURLE_OBSOLETE29,              /* 29 - NOT USED */\n  CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */\n  CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */\n  CURLE_OBSOLETE32,              /* 32 - NOT USED */\n  CURLE_RANGE_ERROR,             /* 33 - RANGE \"command\" didn't work */\n  CURLE_HTTP_POST_ERROR,         /* 34 */\n  CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */\n  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */\n  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */\n  CURLE_LDAP_CANNOT_BIND,        /* 38 */\n  CURLE_LDAP_SEARCH_FAILED,      /* 39 */\n  CURLE_OBSOLETE40,              /* 40 - NOT USED */\n  CURLE_FUNCTION_NOT_FOUND,      /* 41 */\n  CURLE_ABORTED_BY_CALLBACK,     /* 42 */\n  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */\n  CURLE_OBSOLETE44,              /* 44 - NOT USED */\n  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */\n  CURLE_OBSOLETE46,              /* 46 - NOT USED */\n  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */\n  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */\n  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */\n  CURLE_OBSOLETE50,              /* 50 - NOT USED */\n  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint\n                                     wasn't verified fine */\n  CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */\n  CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */\n  CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as\n                                    default */\n  CURLE_SEND_ERROR,              /* 55 - failed sending network data */\n  CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */\n  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */\n  CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */\n  CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */\n  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */\n  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */\n  CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */\n  CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */\n  CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */\n  CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind\n                                    that failed */\n  CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */\n  CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not\n                                    accepted and we failed to login */\n  CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */\n  CURLE_TFTP_PERM,               /* 69 - permission problem on server */\n  CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */\n  CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */\n  CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */\n  CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */\n  CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */\n  CURLE_CONV_FAILED,             /* 75 - conversion failed */\n  CURLE_CONV_REQD,               /* 76 - caller must register conversion\n                                    callbacks using curl_easy_setopt options\n                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,\n                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and\n                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */\n  CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing\n                                    or wrong format */\n  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */\n  CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat\n                                    generic so the error message will be of\n                                    interest when this has happened */\n\n  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL\n                                    connection */\n  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,\n                                    wait till it's ready and try again (Added\n                                    in 7.18.2) */\n  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or\n                                    wrong format (Added in 7.19.0) */\n  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in\n                                    7.19.0) */\n  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */\n  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */\n  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */\n  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */\n  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */\n  CURL_LAST /* never use! */\n} CURLcode;\n\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\n                          the obsolete stuff removed! */\n\n/* Previously obsoletes error codes re-used in 7.24.0 */\n#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED\n#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT\n\n/*  compatibility with older names */\n#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING\n\n/* The following were added in 7.21.5, April 2011 */\n#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION\n\n/* The following were added in 7.17.1 */\n/* These are scheduled to disappear by 2009 */\n#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION\n\n/* The following were added in 7.17.0 */\n/* These are scheduled to disappear by 2009 */\n#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */\n#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46\n#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44\n#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10\n#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16\n#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32\n#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29\n#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12\n#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20\n#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40\n#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24\n#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57\n#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN\n\n#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED\n#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE\n#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR\n#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL\n#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS\n#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR\n#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED\n\n/* The following were added earlier */\n\n#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT\n\n#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR\n#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED\n#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED\n\n#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE\n#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME\n\n/* This was the error code 50 in 7.7.3 and a few earlier versions, this\n   is no longer used by libcurl but is instead #defined here only to not\n   make programs break */\n#define CURLE_ALREADY_COMPLETE 99999\n\n#endif /*!CURL_NO_OLDIES*/\n\n/* This prototype applies to all conversion callbacks */\ntypedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);\n\ntypedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */\n                                          void *ssl_ctx, /* actually an\n                                                            OpenSSL SSL_CTX */\n                                          void *userptr);\n\ntypedef enum {\n  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use\n                           CONNECT HTTP/1.1 */\n  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT\n                               HTTP/1.0  */\n  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already\n                           in 7.10 */\n  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */\n  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */\n  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the\n                                   host name rather than the IP address. added\n                                   in 7.18.0 */\n} curl_proxytype;  /* this enum was added in 7.10 */\n\n/*\n * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:\n *\n * CURLAUTH_NONE         - No HTTP authentication\n * CURLAUTH_BASIC        - HTTP Basic authentication (default)\n * CURLAUTH_DIGEST       - HTTP Digest authentication\n * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication\n * CURLAUTH_NTLM         - HTTP NTLM authentication\n * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour\n * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper\n * CURLAUTH_ONLY         - Use together with a single other type to force no\n *                         authentication or just that single type\n * CURLAUTH_ANY          - All fine types set\n * CURLAUTH_ANYSAFE      - All fine types except Basic\n */\n\n#define CURLAUTH_NONE         ((unsigned long)0)\n#define CURLAUTH_BASIC        (((unsigned long)1)<<0)\n#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)\n#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)\n#define CURLAUTH_NTLM         (((unsigned long)1)<<3)\n#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)\n#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)\n#define CURLAUTH_ONLY         (((unsigned long)1)<<31)\n#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)\n#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))\n\n#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */\n#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */\n#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */\n#define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */\n#define CURLSSH_AUTH_HOST      (1<<2) /* host key files */\n#define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */\n#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */\n#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY\n\n#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */\n#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */\n#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */\n\n#define CURL_ERROR_SIZE 256\n\nstruct curl_khkey {\n  const char *key; /* points to a zero-terminated string encoded with base64\n                      if len is zero, otherwise to the \"raw\" data */\n  size_t len;\n  enum type {\n    CURLKHTYPE_UNKNOWN,\n    CURLKHTYPE_RSA1,\n    CURLKHTYPE_RSA,\n    CURLKHTYPE_DSS\n  } keytype;\n};\n\n/* this is the set of return values expected from the curl_sshkeycallback\n   callback */\nenum curl_khstat {\n  CURLKHSTAT_FINE_ADD_TO_FILE,\n  CURLKHSTAT_FINE,\n  CURLKHSTAT_REJECT, /* reject the connection, return an error */\n  CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so\n                        this causes a CURLE_DEFER error but otherwise the\n                        connection will be left intact etc */\n  CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */\n};\n\n/* this is the set of status codes pass in to the callback */\nenum curl_khmatch {\n  CURLKHMATCH_OK,       /* match */\n  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */\n  CURLKHMATCH_MISSING,  /* no matching host/key found */\n  CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */\n};\n\ntypedef int\n  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */\n                          const struct curl_khkey *knownkey, /* known */\n                          const struct curl_khkey *foundkey, /* found */\n                          enum curl_khmatch, /* libcurl's view on the keys */\n                          void *clientp); /* custom pointer passed from app */\n\n/* parameter for the CURLOPT_USE_SSL option */\ntypedef enum {\n  CURLUSESSL_NONE,    /* do not attempt to use SSL */\n  CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */\n  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */\n  CURLUSESSL_ALL,     /* SSL for all communication or fail */\n  CURLUSESSL_LAST     /* not an option, never use */\n} curl_usessl;\n\n/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */\n\n/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the\n   name of improving interoperability with older servers. Some SSL libraries\n   have introduced work-arounds for this flaw but those work-arounds sometimes\n   make the SSL communication fail. To regain functionality with those broken\n   servers, a user can this way allow the vulnerability back. */\n#define CURLSSLOPT_ALLOW_BEAST (1<<0)\n\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\n                          the obsolete stuff removed! */\n\n/* Backwards compatibility with older names */\n/* These are scheduled to disappear by 2009 */\n\n#define CURLFTPSSL_NONE CURLUSESSL_NONE\n#define CURLFTPSSL_TRY CURLUSESSL_TRY\n#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL\n#define CURLFTPSSL_ALL CURLUSESSL_ALL\n#define CURLFTPSSL_LAST CURLUSESSL_LAST\n#define curl_ftpssl curl_usessl\n#endif /*!CURL_NO_OLDIES*/\n\n/* parameter for the CURLOPT_FTP_SSL_CCC option */\ntypedef enum {\n  CURLFTPSSL_CCC_NONE,    /* do not send CCC */\n  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */\n  CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */\n  CURLFTPSSL_CCC_LAST     /* not an option, never use */\n} curl_ftpccc;\n\n/* parameter for the CURLOPT_FTPSSLAUTH option */\ntypedef enum {\n  CURLFTPAUTH_DEFAULT, /* let libcurl decide */\n  CURLFTPAUTH_SSL,     /* use \"AUTH SSL\" */\n  CURLFTPAUTH_TLS,     /* use \"AUTH TLS\" */\n  CURLFTPAUTH_LAST /* not an option, never use */\n} curl_ftpauth;\n\n/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */\ntypedef enum {\n  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */\n  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD\n                               again if MKD succeeded, for SFTP this does\n                               similar magic */\n  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD\n                               again even if MKD failed! */\n  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */\n} curl_ftpcreatedir;\n\n/* parameter for the CURLOPT_FTP_FILEMETHOD option */\ntypedef enum {\n  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */\n  CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */\n  CURLFTPMETHOD_NOCWD,     /* no CWD at all */\n  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */\n  CURLFTPMETHOD_LAST       /* not an option, never use */\n} curl_ftpmethod;\n\n/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */\n#define CURLPROTO_HTTP   (1<<0)\n#define CURLPROTO_HTTPS  (1<<1)\n#define CURLPROTO_FTP    (1<<2)\n#define CURLPROTO_FTPS   (1<<3)\n#define CURLPROTO_SCP    (1<<4)\n#define CURLPROTO_SFTP   (1<<5)\n#define CURLPROTO_TELNET (1<<6)\n#define CURLPROTO_LDAP   (1<<7)\n#define CURLPROTO_LDAPS  (1<<8)\n#define CURLPROTO_DICT   (1<<9)\n#define CURLPROTO_FILE   (1<<10)\n#define CURLPROTO_TFTP   (1<<11)\n#define CURLPROTO_IMAP   (1<<12)\n#define CURLPROTO_IMAPS  (1<<13)\n#define CURLPROTO_POP3   (1<<14)\n#define CURLPROTO_POP3S  (1<<15)\n#define CURLPROTO_SMTP   (1<<16)\n#define CURLPROTO_SMTPS  (1<<17)\n#define CURLPROTO_RTSP   (1<<18)\n#define CURLPROTO_RTMP   (1<<19)\n#define CURLPROTO_RTMPT  (1<<20)\n#define CURLPROTO_RTMPE  (1<<21)\n#define CURLPROTO_RTMPTE (1<<22)\n#define CURLPROTO_RTMPS  (1<<23)\n#define CURLPROTO_RTMPTS (1<<24)\n#define CURLPROTO_GOPHER (1<<25)\n#define CURLPROTO_ALL    (~0) /* enable everything */\n\n/* long may be 32 or 64 bits, but we should never depend on anything else\n   but 32 */\n#define CURLOPTTYPE_LONG          0\n#define CURLOPTTYPE_OBJECTPOINT   10000\n#define CURLOPTTYPE_FUNCTIONPOINT 20000\n#define CURLOPTTYPE_OFF_T         30000\n\n/* name is uppercase CURLOPT_<name>,\n   type is one of the defined CURLOPTTYPE_<type>\n   number is unique identifier */\n#ifdef CINIT\n#undef CINIT\n#endif\n\n#ifdef CURL_ISOCPP\n#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu\n#else\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\n#define LONG          CURLOPTTYPE_LONG\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\n#define OFF_T         CURLOPTTYPE_OFF_T\n#define CINIT(name,type,number) CURLOPT_/**/name = type + number\n#endif\n\n/*\n * This macro-mania below setups the CURLOPT_[what] enum, to be used with\n * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]\n * word.\n */\n\ntypedef enum {\n  /* This is the FILE * or void * the regular output should be written to. */\n  CINIT(FILE, OBJECTPOINT, 1),\n\n  /* The full URL to get/put */\n  CINIT(URL,  OBJECTPOINT, 2),\n\n  /* Port number to connect to, if other than default. */\n  CINIT(PORT, LONG, 3),\n\n  /* Name of proxy to use. */\n  CINIT(PROXY, OBJECTPOINT, 4),\n\n  /* \"name:password\" to use when fetching. */\n  CINIT(USERPWD, OBJECTPOINT, 5),\n\n  /* \"name:password\" to use with proxy. */\n  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),\n\n  /* Range to get, specified as an ASCII string. */\n  CINIT(RANGE, OBJECTPOINT, 7),\n\n  /* not used */\n\n  /* Specified file stream to upload from (use as input): */\n  CINIT(INFILE, OBJECTPOINT, 9),\n\n  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE\n   * bytes big. If this is not used, error messages go to stderr instead: */\n  CINIT(ERRORBUFFER, OBJECTPOINT, 10),\n\n  /* Function that will be called to store the output (instead of fwrite). The\n   * parameters will use fwrite() syntax, make sure to follow them. */\n  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),\n\n  /* Function that will be called to read the input (instead of fread). The\n   * parameters will use fread() syntax, make sure to follow them. */\n  CINIT(READFUNCTION, FUNCTIONPOINT, 12),\n\n  /* Time-out the read operation after this amount of seconds */\n  CINIT(TIMEOUT, LONG, 13),\n\n  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about\n   * how large the file being sent really is. That allows better error\n   * checking and better verifies that the upload was successful. -1 means\n   * unknown size.\n   *\n   * For large file support, there is also a _LARGE version of the key\n   * which takes an off_t type, allowing platforms with larger off_t\n   * sizes to handle larger files.  See below for INFILESIZE_LARGE.\n   */\n  CINIT(INFILESIZE, LONG, 14),\n\n  /* POST static input fields. */\n  CINIT(POSTFIELDS, OBJECTPOINT, 15),\n\n  /* Set the referrer page (needed by some CGIs) */\n  CINIT(REFERER, OBJECTPOINT, 16),\n\n  /* Set the FTP PORT string (interface name, named or numerical IP address)\n     Use i.e '-' to use default address. */\n  CINIT(FTPPORT, OBJECTPOINT, 17),\n\n  /* Set the User-Agent string (examined by some CGIs) */\n  CINIT(USERAGENT, OBJECTPOINT, 18),\n\n  /* If the download receives less than \"low speed limit\" bytes/second\n   * during \"low speed time\" seconds, the operations is aborted.\n   * You could i.e if you have a pretty high speed connection, abort if\n   * it is less than 2000 bytes/sec during 20 seconds.\n   */\n\n  /* Set the \"low speed limit\" */\n  CINIT(LOW_SPEED_LIMIT, LONG, 19),\n\n  /* Set the \"low speed time\" */\n  CINIT(LOW_SPEED_TIME, LONG, 20),\n\n  /* Set the continuation offset.\n   *\n   * Note there is also a _LARGE version of this key which uses\n   * off_t types, allowing for large file offsets on platforms which\n   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.\n   */\n  CINIT(RESUME_FROM, LONG, 21),\n\n  /* Set cookie in request: */\n  CINIT(COOKIE, OBJECTPOINT, 22),\n\n  /* This points to a linked list of headers, struct curl_slist kind */\n  CINIT(HTTPHEADER, OBJECTPOINT, 23),\n\n  /* This points to a linked list of post entries, struct curl_httppost */\n  CINIT(HTTPPOST, OBJECTPOINT, 24),\n\n  /* name of the file keeping your private SSL-certificate */\n  CINIT(SSLCERT, OBJECTPOINT, 25),\n\n  /* password for the SSL or SSH private key */\n  CINIT(KEYPASSWD, OBJECTPOINT, 26),\n\n  /* send TYPE parameter? */\n  CINIT(CRLF, LONG, 27),\n\n  /* send linked-list of QUOTE commands */\n  CINIT(QUOTE, OBJECTPOINT, 28),\n\n  /* send FILE * or void * to store headers to, if you use a callback it\n     is simply passed to the callback unmodified */\n  CINIT(WRITEHEADER, OBJECTPOINT, 29),\n\n  /* point to a file to read the initial cookies from, also enables\n     \"cookie awareness\" */\n  CINIT(COOKIEFILE, OBJECTPOINT, 31),\n\n  /* What version to specifically try to use.\n     See CURL_SSLVERSION defines below. */\n  CINIT(SSLVERSION, LONG, 32),\n\n  /* What kind of HTTP time condition to use, see defines */\n  CINIT(TIMECONDITION, LONG, 33),\n\n  /* Time to use with the above condition. Specified in number of seconds\n     since 1 Jan 1970 */\n  CINIT(TIMEVALUE, LONG, 34),\n\n  /* 35 = OBSOLETE */\n\n  /* Custom request, for customizing the get command like\n     HTTP: DELETE, TRACE and others\n     FTP: to use a different list command\n     */\n  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),\n\n  /* HTTP request, for odd commands like DELETE, TRACE and others */\n  CINIT(STDERR, OBJECTPOINT, 37),\n\n  /* 38 is not used */\n\n  /* send linked-list of post-transfer QUOTE commands */\n  CINIT(POSTQUOTE, OBJECTPOINT, 39),\n\n  CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */\n\n  CINIT(VERBOSE, LONG, 41),      /* talk a lot */\n  CINIT(HEADER, LONG, 42),       /* throw the header out too */\n  CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */\n  CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */\n  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */\n  CINIT(UPLOAD, LONG, 46),       /* this is an upload */\n  CINIT(POST, LONG, 47),         /* HTTP POST method */\n  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */\n\n  CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */\n\n  /* Specify whether to read the user+password from the .netrc or the URL.\n   * This must be one of the CURL_NETRC_* enums below. */\n  CINIT(NETRC, LONG, 51),\n\n  CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */\n\n  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */\n  CINIT(PUT, LONG, 54),          /* HTTP PUT */\n\n  /* 55 = OBSOLETE */\n\n  /* Function that will be called instead of the internal progress display\n   * function. This function should be defined as the curl_progress_callback\n   * prototype defines. */\n  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),\n\n  /* Data passed to the progress callback */\n  CINIT(PROGRESSDATA, OBJECTPOINT, 57),\n\n  /* We want the referrer field set automatically when following locations */\n  CINIT(AUTOREFERER, LONG, 58),\n\n  /* Port of the proxy, can be set in the proxy string as well with:\n     \"[host]:[port]\" */\n  CINIT(PROXYPORT, LONG, 59),\n\n  /* size of the POST input data, if strlen() is not good to use */\n  CINIT(POSTFIELDSIZE, LONG, 60),\n\n  /* tunnel non-http operations through a HTTP proxy */\n  CINIT(HTTPPROXYTUNNEL, LONG, 61),\n\n  /* Set the interface string to use as outgoing network interface */\n  CINIT(INTERFACE, OBJECTPOINT, 62),\n\n  /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This\n   * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string\n   * is set but doesn't match one of these, 'private' will be used.  */\n  CINIT(KRBLEVEL, OBJECTPOINT, 63),\n\n  /* Set if we should verify the peer in ssl handshake, set 1 to verify. */\n  CINIT(SSL_VERIFYPEER, LONG, 64),\n\n  /* The CApath or CAfile used to validate the peer certificate\n     this option is used only if SSL_VERIFYPEER is true */\n  CINIT(CAINFO, OBJECTPOINT, 65),\n\n  /* 66 = OBSOLETE */\n  /* 67 = OBSOLETE */\n\n  /* Maximum number of http redirects to follow */\n  CINIT(MAXREDIRS, LONG, 68),\n\n  /* Pass a long set to 1 to get the date of the requested document (if\n     possible)! Pass a zero to shut it off. */\n  CINIT(FILETIME, LONG, 69),\n\n  /* This points to a linked list of telnet options */\n  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),\n\n  /* Max amount of cached alive connections */\n  CINIT(MAXCONNECTS, LONG, 71),\n\n  CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */\n\n  /* 73 = OBSOLETE */\n\n  /* Set to explicitly use a new connection for the upcoming transfer.\n     Do not use this unless you're absolutely sure of this, as it makes the\n     operation slower and is less friendly for the network. */\n  CINIT(FRESH_CONNECT, LONG, 74),\n\n  /* Set to explicitly forbid the upcoming transfer's connection to be re-used\n     when done. Do not use this unless you're absolutely sure of this, as it\n     makes the operation slower and is less friendly for the network. */\n  CINIT(FORBID_REUSE, LONG, 75),\n\n  /* Set to a file name that contains random data for libcurl to use to\n     seed the random engine when doing SSL connects. */\n  CINIT(RANDOM_FILE, OBJECTPOINT, 76),\n\n  /* Set to the Entropy Gathering Daemon socket pathname */\n  CINIT(EGDSOCKET, OBJECTPOINT, 77),\n\n  /* Time-out connect operations after this amount of seconds, if connects are\n     OK within this time, then fine... This only aborts the connect phase. */\n  CINIT(CONNECTTIMEOUT, LONG, 78),\n\n  /* Function that will be called to store headers (instead of fwrite). The\n   * parameters will use fwrite() syntax, make sure to follow them. */\n  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),\n\n  /* Set this to force the HTTP request to get back to GET. Only really usable\n     if POST, PUT or a custom request have been used first.\n   */\n  CINIT(HTTPGET, LONG, 80),\n\n  /* Set if we should verify the Common name from the peer certificate in ssl\n   * handshake, set 1 to check existence, 2 to ensure that it matches the\n   * provided hostname. */\n  CINIT(SSL_VERIFYHOST, LONG, 81),\n\n  /* Specify which file name to write all known cookies in after completed\n     operation. Set file name to \"-\" (dash) to make it go to stdout. */\n  CINIT(COOKIEJAR, OBJECTPOINT, 82),\n\n  /* Specify which SSL ciphers to use */\n  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),\n\n  /* Specify which HTTP version to use! This must be set to one of the\n     CURL_HTTP_VERSION* enums set below. */\n  CINIT(HTTP_VERSION, LONG, 84),\n\n  /* Specifically switch on or off the FTP engine's use of the EPSV command. By\n     default, that one will always be attempted before the more traditional\n     PASV command. */\n  CINIT(FTP_USE_EPSV, LONG, 85),\n\n  /* type of the file keeping your SSL-certificate (\"DER\", \"PEM\", \"ENG\") */\n  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),\n\n  /* name of the file keeping your private SSL-key */\n  CINIT(SSLKEY, OBJECTPOINT, 87),\n\n  /* type of the file keeping your private SSL-key (\"DER\", \"PEM\", \"ENG\") */\n  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),\n\n  /* crypto engine for the SSL-sub system */\n  CINIT(SSLENGINE, OBJECTPOINT, 89),\n\n  /* set the crypto engine for the SSL-sub system as default\n     the param has no meaning...\n   */\n  CINIT(SSLENGINE_DEFAULT, LONG, 90),\n\n  /* Non-zero value means to use the global dns cache */\n  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */\n\n  /* DNS cache timeout */\n  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),\n\n  /* send linked-list of pre-transfer QUOTE commands */\n  CINIT(PREQUOTE, OBJECTPOINT, 93),\n\n  /* set the debug function */\n  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),\n\n  /* set the data for the debug function */\n  CINIT(DEBUGDATA, OBJECTPOINT, 95),\n\n  /* mark this as start of a cookie session */\n  CINIT(COOKIESESSION, LONG, 96),\n\n  /* The CApath directory used to validate the peer certificate\n     this option is used only if SSL_VERIFYPEER is true */\n  CINIT(CAPATH, OBJECTPOINT, 97),\n\n  /* Instruct libcurl to use a smaller receive buffer */\n  CINIT(BUFFERSIZE, LONG, 98),\n\n  /* Instruct libcurl to not use any signal/alarm handlers, even when using\n     timeouts. This option is useful for multi-threaded applications.\n     See libcurl-the-guide for more background information. */\n  CINIT(NOSIGNAL, LONG, 99),\n\n  /* Provide a CURLShare for mutexing non-ts data */\n  CINIT(SHARE, OBJECTPOINT, 100),\n\n  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),\n     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */\n  CINIT(PROXYTYPE, LONG, 101),\n\n  /* Set the Accept-Encoding string. Use this to tell a server you would like\n     the response to be compressed. Before 7.21.6, this was known as\n     CURLOPT_ENCODING */\n  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),\n\n  /* Set pointer to private data */\n  CINIT(PRIVATE, OBJECTPOINT, 103),\n\n  /* Set aliases for HTTP 200 in the HTTP Response header */\n  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),\n\n  /* Continue to send authentication (user+password) when following locations,\n     even when hostname changed. This can potentially send off the name\n     and password to whatever host the server decides. */\n  CINIT(UNRESTRICTED_AUTH, LONG, 105),\n\n  /* Specifically switch on or off the FTP engine's use of the EPRT command (\n     it also disables the LPRT attempt). By default, those ones will always be\n     attempted before the good old traditional PORT command. */\n  CINIT(FTP_USE_EPRT, LONG, 106),\n\n  /* Set this to a bitmask value to enable the particular authentications\n     methods you like. Use this in combination with CURLOPT_USERPWD.\n     Note that setting multiple bits may cause extra network round-trips. */\n  CINIT(HTTPAUTH, LONG, 107),\n\n  /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx\n     in second argument. The function must be matching the\n     curl_ssl_ctx_callback proto. */\n  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),\n\n  /* Set the userdata for the ssl context callback function's third\n     argument */\n  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),\n\n  /* FTP Option that causes missing dirs to be created on the remote server.\n     In 7.19.4 we introduced the convenience enums for this option using the\n     CURLFTP_CREATE_DIR prefix.\n  */\n  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),\n\n  /* Set this to a bitmask value to enable the particular authentications\n     methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.\n     Note that setting multiple bits may cause extra network round-trips. */\n  CINIT(PROXYAUTH, LONG, 111),\n\n  /* FTP option that changes the timeout, in seconds, associated with\n     getting a response.  This is different from transfer timeout time and\n     essentially places a demand on the FTP server to acknowledge commands\n     in a timely manner. */\n  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),\n#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT\n\n  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to\n     tell libcurl to resolve names to those IP versions only. This only has\n     affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */\n  CINIT(IPRESOLVE, LONG, 113),\n\n  /* Set this option to limit the size of a file that will be downloaded from\n     an HTTP or FTP server.\n\n     Note there is also _LARGE version which adds large file support for\n     platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */\n  CINIT(MAXFILESIZE, LONG, 114),\n\n  /* See the comment for INFILESIZE above, but in short, specifies\n   * the size of the file being uploaded.  -1 means unknown.\n   */\n  CINIT(INFILESIZE_LARGE, OFF_T, 115),\n\n  /* Sets the continuation offset.  There is also a LONG version of this;\n   * look above for RESUME_FROM.\n   */\n  CINIT(RESUME_FROM_LARGE, OFF_T, 116),\n\n  /* Sets the maximum size of data that will be downloaded from\n   * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.\n   */\n  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),\n\n  /* Set this option to the file name of your .netrc file you want libcurl\n     to parse (using the CURLOPT_NETRC option). If not set, libcurl will do\n     a poor attempt to find the user's home directory and check for a .netrc\n     file in there. */\n  CINIT(NETRC_FILE, OBJECTPOINT, 118),\n\n  /* Enable SSL/TLS for FTP, pick one of:\n     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise\n     CURLUSESSL_CONTROL - SSL for the control connection or fail\n     CURLUSESSL_ALL     - SSL for all communication or fail\n  */\n  CINIT(USE_SSL, LONG, 119),\n\n  /* The _LARGE version of the standard POSTFIELDSIZE option */\n  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),\n\n  /* Enable/disable the TCP Nagle algorithm */\n  CINIT(TCP_NODELAY, LONG, 121),\n\n  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\n  /* 123 OBSOLETE. Gone in 7.16.0 */\n  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\n  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\n  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\n  /* 127 OBSOLETE. Gone in 7.16.0 */\n  /* 128 OBSOLETE. Gone in 7.16.0 */\n\n  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option\n     can be used to change libcurl's default action which is to first try\n     \"AUTH SSL\" and then \"AUTH TLS\" in this order, and proceed when a OK\n     response has been received.\n\n     Available parameters are:\n     CURLFTPAUTH_DEFAULT - let libcurl decide\n     CURLFTPAUTH_SSL     - try \"AUTH SSL\" first, then TLS\n     CURLFTPAUTH_TLS     - try \"AUTH TLS\" first, then SSL\n  */\n  CINIT(FTPSSLAUTH, LONG, 129),\n\n  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),\n  CINIT(IOCTLDATA, OBJECTPOINT, 131),\n\n  /* 132 OBSOLETE. Gone in 7.16.0 */\n  /* 133 OBSOLETE. Gone in 7.16.0 */\n\n  /* zero terminated string for pass on to the FTP server when asked for\n     \"account\" info */\n  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),\n\n  /* feed cookies into cookie engine */\n  CINIT(COOKIELIST, OBJECTPOINT, 135),\n\n  /* ignore Content-Length */\n  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),\n\n  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server\n     response. Typically used for FTP-SSL purposes but is not restricted to\n     that. libcurl will then instead use the same IP address it used for the\n     control connection. */\n  CINIT(FTP_SKIP_PASV_IP, LONG, 137),\n\n  /* Select \"file method\" to use when doing FTP, see the curl_ftpmethod\n     above. */\n  CINIT(FTP_FILEMETHOD, LONG, 138),\n\n  /* Local port number to bind the socket to */\n  CINIT(LOCALPORT, LONG, 139),\n\n  /* Number of ports to try, including the first one set with LOCALPORT.\n     Thus, setting it to 1 will make no additional attempts but the first.\n  */\n  CINIT(LOCALPORTRANGE, LONG, 140),\n\n  /* no transfer, set up connection and let application use the socket by\n     extracting it with CURLINFO_LASTSOCKET */\n  CINIT(CONNECT_ONLY, LONG, 141),\n\n  /* Function that will be called to convert from the\n     network encoding (instead of using the iconv calls in libcurl) */\n  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),\n\n  /* Function that will be called to convert to the\n     network encoding (instead of using the iconv calls in libcurl) */\n  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),\n\n  /* Function that will be called to convert from UTF8\n     (instead of using the iconv calls in libcurl)\n     Note that this is used only for SSL certificate processing */\n  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),\n\n  /* if the connection proceeds too quickly then need to slow it down */\n  /* limit-rate: maximum number of bytes per second to send or receive */\n  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),\n  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),\n\n  /* Pointer to command string to send if USER/PASS fails. */\n  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),\n\n  /* callback function for setting socket options */\n  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),\n  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),\n\n  /* set to 0 to disable session ID re-use for this transfer, default is\n     enabled (== 1) */\n  CINIT(SSL_SESSIONID_CACHE, LONG, 150),\n\n  /* allowed SSH authentication methods */\n  CINIT(SSH_AUTH_TYPES, LONG, 151),\n\n  /* Used by scp/sftp to do public/private key authentication */\n  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),\n  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),\n\n  /* Send CCC (Clear Command Channel) after authentication */\n  CINIT(FTP_SSL_CCC, LONG, 154),\n\n  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */\n  CINIT(TIMEOUT_MS, LONG, 155),\n  CINIT(CONNECTTIMEOUT_MS, LONG, 156),\n\n  /* set to zero to disable the libcurl's decoding and thus pass the raw body\n     data to the application even when it is encoded/compressed */\n  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),\n  CINIT(HTTP_CONTENT_DECODING, LONG, 158),\n\n  /* Permission used when creating new files and directories on the remote\n     server for protocols that support it, SFTP/SCP/FILE */\n  CINIT(NEW_FILE_PERMS, LONG, 159),\n  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),\n\n  /* Set the behaviour of POST when redirecting. Values must be set to one\n     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */\n  CINIT(POSTREDIR, LONG, 161),\n\n  /* used by scp/sftp to verify the host's public key */\n  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),\n\n  /* Callback function for opening socket (instead of socket(2)). Optionally,\n     callback is able change the address or refuse to connect returning\n     CURL_SOCKET_BAD.  The callback should have type\n     curl_opensocket_callback */\n  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),\n  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),\n\n  /* POST volatile input fields. */\n  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),\n\n  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */\n  CINIT(PROXY_TRANSFER_MODE, LONG, 166),\n\n  /* Callback function for seeking in the input stream */\n  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),\n  CINIT(SEEKDATA, OBJECTPOINT, 168),\n\n  /* CRL file */\n  CINIT(CRLFILE, OBJECTPOINT, 169),\n\n  /* Issuer certificate */\n  CINIT(ISSUERCERT, OBJECTPOINT, 170),\n\n  /* (IPv6) Address scope */\n  CINIT(ADDRESS_SCOPE, LONG, 171),\n\n  /* Collect certificate chain info and allow it to get retrievable with\n     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only\n     working with OpenSSL-powered builds. */\n  CINIT(CERTINFO, LONG, 172),\n\n  /* \"name\" and \"pwd\" to use when fetching. */\n  CINIT(USERNAME, OBJECTPOINT, 173),\n  CINIT(PASSWORD, OBJECTPOINT, 174),\n\n    /* \"name\" and \"pwd\" to use with Proxy when fetching. */\n  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),\n  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),\n\n  /* Comma separated list of hostnames defining no-proxy zones. These should\n     match both hostnames directly, and hostnames within a domain. For\n     example, local.com will match local.com and www.local.com, but NOT\n     notlocal.com or www.notlocal.com. For compatibility with other\n     implementations of this, .local.com will be considered to be the same as\n     local.com. A single * is the only valid wildcard, and effectively\n     disables the use of proxy. */\n  CINIT(NOPROXY, OBJECTPOINT, 177),\n\n  /* block size for TFTP transfers */\n  CINIT(TFTP_BLKSIZE, LONG, 178),\n\n  /* Socks Service */\n  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),\n\n  /* Socks Service */\n  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),\n\n  /* set the bitmask for the protocols that are allowed to be used for the\n     transfer, which thus helps the app which takes URLs from users or other\n     external inputs and want to restrict what protocol(s) to deal\n     with. Defaults to CURLPROTO_ALL. */\n  CINIT(PROTOCOLS, LONG, 181),\n\n  /* set the bitmask for the protocols that libcurl is allowed to follow to,\n     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs\n     to be set in both bitmasks to be allowed to get redirected to. Defaults\n     to all protocols except FILE and SCP. */\n  CINIT(REDIR_PROTOCOLS, LONG, 182),\n\n  /* set the SSH knownhost file name to use */\n  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),\n\n  /* set the SSH host key callback, must point to a curl_sshkeycallback\n     function */\n  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),\n\n  /* set the SSH host key callback custom pointer */\n  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),\n\n  /* set the SMTP mail originator */\n  CINIT(MAIL_FROM, OBJECTPOINT, 186),\n\n  /* set the SMTP mail receiver(s) */\n  CINIT(MAIL_RCPT, OBJECTPOINT, 187),\n\n  /* FTP: send PRET before PASV */\n  CINIT(FTP_USE_PRET, LONG, 188),\n\n  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */\n  CINIT(RTSP_REQUEST, LONG, 189),\n\n  /* The RTSP session identifier */\n  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),\n\n  /* The RTSP stream URI */\n  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),\n\n  /* The Transport: header to use in RTSP requests */\n  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),\n\n  /* Manually initialize the client RTSP CSeq for this handle */\n  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),\n\n  /* Manually initialize the server RTSP CSeq for this handle */\n  CINIT(RTSP_SERVER_CSEQ, LONG, 194),\n\n  /* The stream to pass to INTERLEAVEFUNCTION. */\n  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),\n\n  /* Let the application define a custom write method for RTP data */\n  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),\n\n  /* Turn on wildcard matching */\n  CINIT(WILDCARDMATCH, LONG, 197),\n\n  /* Directory matching callback called before downloading of an\n     individual file (chunk) started */\n  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),\n\n  /* Directory matching callback called after the file (chunk)\n     was downloaded, or skipped */\n  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),\n\n  /* Change match (fnmatch-like) callback for wildcard matching */\n  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),\n\n  /* Let the application define custom chunk data pointer */\n  CINIT(CHUNK_DATA, OBJECTPOINT, 201),\n\n  /* FNMATCH_FUNCTION user pointer */\n  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),\n\n  /* send linked-list of name:port:address sets */\n  CINIT(RESOLVE, OBJECTPOINT, 203),\n\n  /* Set a username for authenticated TLS */\n  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),\n\n  /* Set a password for authenticated TLS */\n  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),\n\n  /* Set authentication type for authenticated TLS */\n  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),\n\n  /* Set to 1 to enable the \"TE:\" header in HTTP requests to ask for\n     compressed transfer-encoded responses. Set to 0 to disable the use of TE:\n     in outgoing requests. The current default is 0, but it might change in a\n     future libcurl release.\n\n     libcurl will ask for the compressed methods it knows of, and if that\n     isn't any, it will not ask for transfer-encoding at all even if this\n     option is set to 1.\n\n  */\n  CINIT(TRANSFER_ENCODING, LONG, 207),\n\n  /* Callback function for closing socket (instead of close(2)). The callback\n     should have type curl_closesocket_callback */\n  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),\n  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),\n\n  /* allow GSSAPI credential delegation */\n  CINIT(GSSAPI_DELEGATION, LONG, 210),\n\n  /* Set the name servers to use for DNS resolution */\n  CINIT(DNS_SERVERS, OBJECTPOINT, 211),\n\n  /* Time-out accept operations (currently for FTP only) after this amount\n     of miliseconds. */\n  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),\n\n  /* Set TCP keepalive */\n  CINIT(TCP_KEEPALIVE, LONG, 213),\n\n  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */\n  CINIT(TCP_KEEPIDLE, LONG, 214),\n  CINIT(TCP_KEEPINTVL, LONG, 215),\n\n  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */\n  CINIT(SSL_OPTIONS, LONG, 216),\n\n  /* set the SMTP auth originator */\n  CINIT(MAIL_AUTH, OBJECTPOINT, 217),\n\n  CURLOPT_LASTENTRY /* the last unused */\n} CURLoption;\n\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\n                          the obsolete stuff removed! */\n\n/* Backwards compatibility with older names */\n/* These are scheduled to disappear by 2011 */\n\n/* This was added in version 7.19.1 */\n#define CURLOPT_POST301 CURLOPT_POSTREDIR\n\n/* These are scheduled to disappear by 2009 */\n\n/* The following were added in 7.17.0 */\n#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD\n#define CURLOPT_FTPAPPEND CURLOPT_APPEND\n#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY\n#define CURLOPT_FTP_SSL CURLOPT_USE_SSL\n\n/* The following were added earlier */\n\n#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD\n#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL\n\n#else\n/* This is set if CURL_NO_OLDIES is defined at compile-time */\n#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */\n#endif\n\n\n  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host\n     name resolves addresses using more than one IP protocol version, this\n     option might be handy to force libcurl to use a specific IP version. */\n#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP\n                                     versions that your system allows */\n#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */\n#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */\n\n  /* three convenient \"aliases\" that follow the name scheme better */\n#define CURLOPT_WRITEDATA CURLOPT_FILE\n#define CURLOPT_READDATA  CURLOPT_INFILE\n#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER\n#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER\n\n  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */\nenum {\n  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd\n                             like the library to choose the best possible\n                             for us! */\n  CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */\n  CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */\n\n  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */\n};\n\n/*\n * Public API enums for RTSP requests\n */\nenum {\n    CURL_RTSPREQ_NONE, /* first in list */\n    CURL_RTSPREQ_OPTIONS,\n    CURL_RTSPREQ_DESCRIBE,\n    CURL_RTSPREQ_ANNOUNCE,\n    CURL_RTSPREQ_SETUP,\n    CURL_RTSPREQ_PLAY,\n    CURL_RTSPREQ_PAUSE,\n    CURL_RTSPREQ_TEARDOWN,\n    CURL_RTSPREQ_GET_PARAMETER,\n    CURL_RTSPREQ_SET_PARAMETER,\n    CURL_RTSPREQ_RECORD,\n    CURL_RTSPREQ_RECEIVE,\n    CURL_RTSPREQ_LAST /* last in list */\n};\n\n  /* These enums are for use with the CURLOPT_NETRC option. */\nenum CURL_NETRC_OPTION {\n  CURL_NETRC_IGNORED,     /* The .netrc will never be read.\n                           * This is the default. */\n  CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred\n                           * to one in the .netrc. */\n  CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.\n                           * Unless one is set programmatically, the .netrc\n                           * will be queried. */\n  CURL_NETRC_LAST\n};\n\nenum {\n  CURL_SSLVERSION_DEFAULT,\n  CURL_SSLVERSION_TLSv1,\n  CURL_SSLVERSION_SSLv2,\n  CURL_SSLVERSION_SSLv3,\n\n  CURL_SSLVERSION_LAST /* never use, keep last */\n};\n\nenum CURL_TLSAUTH {\n  CURL_TLSAUTH_NONE,\n  CURL_TLSAUTH_SRP,\n  CURL_TLSAUTH_LAST /* never use, keep last */\n};\n\n/* symbols to use with CURLOPT_POSTREDIR.\n   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303\n   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302\n   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */\n\n#define CURL_REDIR_GET_ALL  0\n#define CURL_REDIR_POST_301 1\n#define CURL_REDIR_POST_302 2\n#define CURL_REDIR_POST_303 4\n#define CURL_REDIR_POST_ALL \\\n    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)\n\ntypedef enum {\n  CURL_TIMECOND_NONE,\n\n  CURL_TIMECOND_IFMODSINCE,\n  CURL_TIMECOND_IFUNMODSINCE,\n  CURL_TIMECOND_LASTMOD,\n\n  CURL_TIMECOND_LAST\n} curl_TimeCond;\n\n\n/* curl_strequal() and curl_strnequal() are subject for removal in a future\n   libcurl, see lib/README.curlx for details */\nCURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);\nCURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);\n\n/* name is uppercase CURLFORM_<name> */\n#ifdef CFINIT\n#undef CFINIT\n#endif\n\n#ifdef CURL_ISOCPP\n#define CFINIT(name) CURLFORM_ ## name\n#else\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\n#define CFINIT(name) CURLFORM_/**/name\n#endif\n\ntypedef enum {\n  CFINIT(NOTHING),        /********* the first one is unused ************/\n\n  /*  */\n  CFINIT(COPYNAME),\n  CFINIT(PTRNAME),\n  CFINIT(NAMELENGTH),\n  CFINIT(COPYCONTENTS),\n  CFINIT(PTRCONTENTS),\n  CFINIT(CONTENTSLENGTH),\n  CFINIT(FILECONTENT),\n  CFINIT(ARRAY),\n  CFINIT(OBSOLETE),\n  CFINIT(FILE),\n\n  CFINIT(BUFFER),\n  CFINIT(BUFFERPTR),\n  CFINIT(BUFFERLENGTH),\n\n  CFINIT(CONTENTTYPE),\n  CFINIT(CONTENTHEADER),\n  CFINIT(FILENAME),\n  CFINIT(END),\n  CFINIT(OBSOLETE2),\n\n  CFINIT(STREAM),\n\n  CURLFORM_LASTENTRY /* the last unused */\n} CURLformoption;\n\n#undef CFINIT /* done */\n\n/* structure to be used as parameter for CURLFORM_ARRAY */\nstruct curl_forms {\n  CURLformoption option;\n  const char     *value;\n};\n\n/* use this for multipart formpost building */\n/* Returns code for curl_formadd()\n *\n * Returns:\n * CURL_FORMADD_OK             on success\n * CURL_FORMADD_MEMORY         if the FormInfo allocation fails\n * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form\n * CURL_FORMADD_NULL           if a null pointer was given for a char\n * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed\n * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used\n * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)\n * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated\n * CURL_FORMADD_MEMORY         if some allocation for string copying failed.\n * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array\n *\n ***************************************************************************/\ntypedef enum {\n  CURL_FORMADD_OK, /* first, no error */\n\n  CURL_FORMADD_MEMORY,\n  CURL_FORMADD_OPTION_TWICE,\n  CURL_FORMADD_NULL,\n  CURL_FORMADD_UNKNOWN_OPTION,\n  CURL_FORMADD_INCOMPLETE,\n  CURL_FORMADD_ILLEGAL_ARRAY,\n  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */\n\n  CURL_FORMADD_LAST /* last */\n} CURLFORMcode;\n\n/*\n * NAME curl_formadd()\n *\n * DESCRIPTION\n *\n * Pretty advanced function for building multi-part formposts. Each invoke\n * adds one part that together construct a full post. Then use\n * CURLOPT_HTTPPOST to send it off to libcurl.\n */\nCURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,\n                                      struct curl_httppost **last_post,\n                                      ...);\n\n/*\n * callback function for curl_formget()\n * The void *arg pointer will be the one passed as second argument to\n *   curl_formget().\n * The character buffer passed to it must not be freed.\n * Should return the buffer length passed to it as the argument \"len\" on\n *   success.\n */\ntypedef size_t (*curl_formget_callback)(void *arg, const char *buf,\n                                        size_t len);\n\n/*\n * NAME curl_formget()\n *\n * DESCRIPTION\n *\n * Serialize a curl_httppost struct built with curl_formadd().\n * Accepts a void pointer as second argument which will be passed to\n * the curl_formget_callback function.\n * Returns 0 on success.\n */\nCURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,\n                             curl_formget_callback append);\n/*\n * NAME curl_formfree()\n *\n * DESCRIPTION\n *\n * Free a multipart formpost previously built with curl_formadd().\n */\nCURL_EXTERN void curl_formfree(struct curl_httppost *form);\n\n/*\n * NAME curl_getenv()\n *\n * DESCRIPTION\n *\n * Returns a malloc()'ed string that MUST be curl_free()ed after usage is\n * complete. DEPRECATED - see lib/README.curlx\n */\nCURL_EXTERN char *curl_getenv(const char *variable);\n\n/*\n * NAME curl_version()\n *\n * DESCRIPTION\n *\n * Returns a static ascii string of the libcurl version.\n */\nCURL_EXTERN char *curl_version(void);\n\n/*\n * NAME curl_easy_escape()\n *\n * DESCRIPTION\n *\n * Escapes URL strings (converts all letters consider illegal in URLs to their\n * %XX versions). This function returns a new allocated string or NULL if an\n * error occurred.\n */\nCURL_EXTERN char *curl_easy_escape(CURL *handle,\n                                   const char *string,\n                                   int length);\n\n/* the previous version: */\nCURL_EXTERN char *curl_escape(const char *string,\n                              int length);\n\n\n/*\n * NAME curl_easy_unescape()\n *\n * DESCRIPTION\n *\n * Unescapes URL encoding in strings (converts all %XX codes to their 8bit\n * versions). This function returns a new allocated string or NULL if an error\n * occurred.\n * Conversion Note: On non-ASCII platforms the ASCII %XX codes are\n * converted into the host encoding.\n */\nCURL_EXTERN char *curl_easy_unescape(CURL *handle,\n                                     const char *string,\n                                     int length,\n                                     int *outlength);\n\n/* the previous version */\nCURL_EXTERN char *curl_unescape(const char *string,\n                                int length);\n\n/*\n * NAME curl_free()\n *\n * DESCRIPTION\n *\n * Provided for de-allocation in the same translation unit that did the\n * allocation. Added in libcurl 7.10\n */\nCURL_EXTERN void curl_free(void *p);\n\n/*\n * NAME curl_global_init()\n *\n * DESCRIPTION\n *\n * curl_global_init() should be invoked exactly once for each application that\n * uses libcurl and before any call of other libcurl functions.\n *\n * This function is not thread-safe!\n */\nCURL_EXTERN CURLcode curl_global_init(long flags);\n\n/*\n * NAME curl_global_init_mem()\n *\n * DESCRIPTION\n *\n * curl_global_init() or curl_global_init_mem() should be invoked exactly once\n * for each application that uses libcurl.  This function can be used to\n * initialize libcurl and set user defined memory management callback\n * functions.  Users can implement memory management routines to check for\n * memory leaks, check for mis-use of the curl library etc.  User registered\n * callback routines with be invoked by this library instead of the system\n * memory management routines like malloc, free etc.\n */\nCURL_EXTERN CURLcode curl_global_init_mem(long flags,\n                                          curl_malloc_callback m,\n                                          curl_free_callback f,\n                                          curl_realloc_callback r,\n                                          curl_strdup_callback s,\n                                          curl_calloc_callback c);\n\n/*\n * NAME curl_global_cleanup()\n *\n * DESCRIPTION\n *\n * curl_global_cleanup() should be invoked exactly once for each application\n * that uses libcurl\n */\nCURL_EXTERN void curl_global_cleanup(void);\n\n/* linked-list structure for the CURLOPT_QUOTE option (and other) */\nstruct curl_slist {\n  char *data;\n  struct curl_slist *next;\n};\n\n/*\n * NAME curl_slist_append()\n *\n * DESCRIPTION\n *\n * Appends a string to a linked list. If no list exists, it will be created\n * first. Returns the new list, after appending.\n */\nCURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,\n                                                 const char *);\n\n/*\n * NAME curl_slist_free_all()\n *\n * DESCRIPTION\n *\n * free a previously built curl_slist.\n */\nCURL_EXTERN void curl_slist_free_all(struct curl_slist *);\n\n/*\n * NAME curl_getdate()\n *\n * DESCRIPTION\n *\n * Returns the time, in seconds since 1 Jan 1970 of the time string given in\n * the first argument. The time argument in the second parameter is unused\n * and should be set to NULL.\n */\nCURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);\n\n/* info about the certificate chain, only for OpenSSL builds. Asked\n   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */\nstruct curl_certinfo {\n  int num_of_certs;             /* number of certificates with information */\n  struct curl_slist **certinfo; /* for each index in this array, there's a\n                                   linked list with textual information in the\n                                   format \"name: value\" */\n};\n\n#define CURLINFO_STRING   0x100000\n#define CURLINFO_LONG     0x200000\n#define CURLINFO_DOUBLE   0x300000\n#define CURLINFO_SLIST    0x400000\n#define CURLINFO_MASK     0x0fffff\n#define CURLINFO_TYPEMASK 0xf00000\n\ntypedef enum {\n  CURLINFO_NONE, /* first, never use this */\n  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,\n  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,\n  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,\n  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,\n  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,\n  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,\n  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,\n  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,\n  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,\n  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,\n  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,\n  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,\n  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,\n  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,\n  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,\n  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,\n  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,\n  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,\n  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,\n  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,\n  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,\n  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,\n  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,\n  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,\n  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,\n  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,\n  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,\n  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,\n  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,\n  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,\n  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,\n  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,\n  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,\n  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,\n  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,\n  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,\n  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,\n  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,\n  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,\n  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,\n  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,\n  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,\n  /* Fill in new entries below here! */\n\n  CURLINFO_LASTONE          = 42\n} CURLINFO;\n\n/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as\n   CURLINFO_HTTP_CODE */\n#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE\n\ntypedef enum {\n  CURLCLOSEPOLICY_NONE, /* first, never use this */\n\n  CURLCLOSEPOLICY_OLDEST,\n  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,\n  CURLCLOSEPOLICY_LEAST_TRAFFIC,\n  CURLCLOSEPOLICY_SLOWEST,\n  CURLCLOSEPOLICY_CALLBACK,\n\n  CURLCLOSEPOLICY_LAST /* last, never use this */\n} curl_closepolicy;\n\n#define CURL_GLOBAL_SSL (1<<0)\n#define CURL_GLOBAL_WIN32 (1<<1)\n#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)\n#define CURL_GLOBAL_NOTHING 0\n#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL\n\n\n/*****************************************************************************\n * Setup defines, protos etc for the sharing stuff.\n */\n\n/* Different data locks for a single share */\ntypedef enum {\n  CURL_LOCK_DATA_NONE = 0,\n  /*  CURL_LOCK_DATA_SHARE is used internally to say that\n   *  the locking is just made to change the internal state of the share\n   *  itself.\n   */\n  CURL_LOCK_DATA_SHARE,\n  CURL_LOCK_DATA_COOKIE,\n  CURL_LOCK_DATA_DNS,\n  CURL_LOCK_DATA_SSL_SESSION,\n  CURL_LOCK_DATA_CONNECT,\n  CURL_LOCK_DATA_LAST\n} curl_lock_data;\n\n/* Different lock access types */\ntypedef enum {\n  CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */\n  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */\n  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */\n  CURL_LOCK_ACCESS_LAST        /* never use */\n} curl_lock_access;\n\ntypedef void (*curl_lock_function)(CURL *handle,\n                                   curl_lock_data data,\n                                   curl_lock_access locktype,\n                                   void *userptr);\ntypedef void (*curl_unlock_function)(CURL *handle,\n                                     curl_lock_data data,\n                                     void *userptr);\n\ntypedef void CURLSH;\n\ntypedef enum {\n  CURLSHE_OK,  /* all is fine */\n  CURLSHE_BAD_OPTION, /* 1 */\n  CURLSHE_IN_USE,     /* 2 */\n  CURLSHE_INVALID,    /* 3 */\n  CURLSHE_NOMEM,      /* 4 out of memory */\n  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */\n  CURLSHE_LAST        /* never use */\n} CURLSHcode;\n\ntypedef enum {\n  CURLSHOPT_NONE,  /* don't use */\n  CURLSHOPT_SHARE,   /* specify a data type to share */\n  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */\n  CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */\n  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */\n  CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock\n                           callback functions */\n  CURLSHOPT_LAST  /* never use */\n} CURLSHoption;\n\nCURL_EXTERN CURLSH *curl_share_init(void);\nCURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);\nCURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);\n\n/****************************************************************************\n * Structures for querying information about the curl library at runtime.\n */\n\ntypedef enum {\n  CURLVERSION_FIRST,\n  CURLVERSION_SECOND,\n  CURLVERSION_THIRD,\n  CURLVERSION_FOURTH,\n  CURLVERSION_LAST /* never actually use this */\n} CURLversion;\n\n/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by\n   basically all programs ever that want to get version information. It is\n   meant to be a built-in version number for what kind of struct the caller\n   expects. If the struct ever changes, we redefine the NOW to another enum\n   from above. */\n#define CURLVERSION_NOW CURLVERSION_FOURTH\n\ntypedef struct {\n  CURLversion age;          /* age of the returned struct */\n  const char *version;      /* LIBCURL_VERSION */\n  unsigned int version_num; /* LIBCURL_VERSION_NUM */\n  const char *host;         /* OS/host/cpu/machine when configured */\n  int features;             /* bitmask, see defines below */\n  const char *ssl_version;  /* human readable string */\n  long ssl_version_num;     /* not used anymore, always 0 */\n  const char *libz_version; /* human readable string */\n  /* protocols is terminated by an entry with a NULL protoname */\n  const char * const *protocols;\n\n  /* The fields below this were added in CURLVERSION_SECOND */\n  const char *ares;\n  int ares_num;\n\n  /* This field was added in CURLVERSION_THIRD */\n  const char *libidn;\n\n  /* These field were added in CURLVERSION_FOURTH */\n\n  /* Same as '_libiconv_version' if built with HAVE_ICONV */\n  int iconv_ver_num;\n\n  const char *libssh_version; /* human readable string */\n\n} curl_version_info_data;\n\n#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */\n#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */\n#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */\n#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */\n#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */\n#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */\n#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */\n#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */\n#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */\n#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */\n#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */\n#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */\n#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */\n#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */\n#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */\n#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM delegating to winbind helper */\n\n /*\n * NAME curl_version_info()\n *\n * DESCRIPTION\n *\n * This function returns a pointer to a static copy of the version info\n * struct. See above.\n */\nCURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);\n\n/*\n * NAME curl_easy_strerror()\n *\n * DESCRIPTION\n *\n * The curl_easy_strerror function may be used to turn a CURLcode value\n * into the equivalent human readable error string.  This is useful\n * for printing meaningful error messages.\n */\nCURL_EXTERN const char *curl_easy_strerror(CURLcode);\n\n/*\n * NAME curl_share_strerror()\n *\n * DESCRIPTION\n *\n * The curl_share_strerror function may be used to turn a CURLSHcode value\n * into the equivalent human readable error string.  This is useful\n * for printing meaningful error messages.\n */\nCURL_EXTERN const char *curl_share_strerror(CURLSHcode);\n\n/*\n * NAME curl_easy_pause()\n *\n * DESCRIPTION\n *\n * The curl_easy_pause function pauses or unpauses transfers. Select the new\n * state by setting the bitmask, use the convenience defines below.\n *\n */\nCURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);\n\n#define CURLPAUSE_RECV      (1<<0)\n#define CURLPAUSE_RECV_CONT (0)\n\n#define CURLPAUSE_SEND      (1<<2)\n#define CURLPAUSE_SEND_CONT (0)\n\n#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)\n#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)\n\n#ifdef  __cplusplus\n}\n#endif\n\n/* unfortunately, the easy.h and multi.h include files need options and info\n  stuff before they can be included! */\n#include \"easy.h\" /* nothing in curl is fun without the easy stuff */\n#include \"multi.h\"\n\n/* the typechecker doesn't work in C++ (yet) */\n#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \\\n    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \\\n    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)\n#include \"typecheck-gcc.h\"\n#else\n#if defined(__STDC__) && (__STDC__ >= 1)\n/* This preprocessor magic that replaces a call with the exact same call is\n   only done to make sure application authors pass exactly three arguments\n   to these functions. */\n#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)\n#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\n#endif /* __STDC__ >= 1 */\n#endif /* gcc >= 4.3 && !__cplusplus */\n\n#endif /* __CURL_CURL_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/curlbuild.h",
    "content": "/* include/curl/curlbuild.h.  Generated from curlbuild.h.in by configure.  */\n#ifndef __CURL_CURLBUILD_H\n#define __CURL_CURLBUILD_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n/* ================================================================ */\n/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */\n/* ================================================================ */\n\n/*\n * NOTE 1:\n * -------\n *\n * Nothing in this file is intended to be modified or adjusted by the\n * curl library user nor by the curl library builder.\n *\n * If you think that something actually needs to be changed, adjusted\n * or fixed in this file, then, report it on the libcurl development\n * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/\n *\n * This header file shall only export symbols which are 'curl' or 'CURL'\n * prefixed, otherwise public name space would be polluted.\n *\n * NOTE 2:\n * -------\n *\n * Right now you might be staring at file include/curl/curlbuild.h.in or\n * at file include/curl/curlbuild.h, this is due to the following reason:\n *\n * On systems capable of running the configure script, the configure process\n * will overwrite the distributed include/curl/curlbuild.h file with one that\n * is suitable and specific to the library being configured and built, which\n * is generated from the include/curl/curlbuild.h.in template file.\n *\n */\n\n/* ================================================================ */\n/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */\n/* ================================================================ */\n\n#ifdef CURL_SIZEOF_LONG\n#error \"CURL_SIZEOF_LONG shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined\n#endif\n\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\n#error \"CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined\n#endif\n\n#ifdef CURL_SIZEOF_CURL_SOCKLEN_T\n#error \"CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined\n#endif\n\n#ifdef CURL_TYPEOF_CURL_OFF_T\n#error \"CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined\n#endif\n\n#ifdef CURL_FORMAT_CURL_OFF_T\n#error \"CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined\n#endif\n\n#ifdef CURL_FORMAT_CURL_OFF_TU\n#error \"CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined\n#endif\n\n#ifdef CURL_FORMAT_OFF_T\n#error \"CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined\n#endif\n\n#ifdef CURL_SIZEOF_CURL_OFF_T\n#error \"CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined\n#endif\n\n#ifdef CURL_SUFFIX_CURL_OFF_T\n#error \"CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined\n#endif\n\n#ifdef CURL_SUFFIX_CURL_OFF_TU\n#error \"CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h\"\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined\n#endif\n\n/* ================================================================ */\n/*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */\n/* ================================================================ */\n\n/* Configure process defines this to 1 when it finds out that system  */\n/* header file ws2tcpip.h must be included by the external interface. */\n/* #undef CURL_PULL_WS2TCPIP_H */\n#ifdef CURL_PULL_WS2TCPIP_H\n#  ifndef WIN32_LEAN_AND_MEAN\n#    define WIN32_LEAN_AND_MEAN\n#  endif\n#  include <windows.h>\n#  include <winsock2.h>\n#  include <ws2tcpip.h>\n#endif\n\n/* Configure process defines this to 1 when it finds out that system   */\n/* header file sys/types.h must be included by the external interface. */\n#define CURL_PULL_SYS_TYPES_H 1\n#ifdef CURL_PULL_SYS_TYPES_H\n#  include <sys/types.h>\n#endif\n\n/* Configure process defines this to 1 when it finds out that system */\n/* header file stdint.h must be included by the external interface.  */\n/* #undef CURL_PULL_STDINT_H */\n#ifdef CURL_PULL_STDINT_H\n#  include <stdint.h>\n#endif\n\n/* Configure process defines this to 1 when it finds out that system  */\n/* header file inttypes.h must be included by the external interface. */\n/* #undef CURL_PULL_INTTYPES_H */\n#ifdef CURL_PULL_INTTYPES_H\n#  include <inttypes.h>\n#endif\n\n/* Configure process defines this to 1 when it finds out that system    */\n/* header file sys/socket.h must be included by the external interface. */\n#define CURL_PULL_SYS_SOCKET_H 1\n#ifdef CURL_PULL_SYS_SOCKET_H\n#  include <sys/socket.h>\n#endif\n\n/* Configure process defines this to 1 when it finds out that system  */\n/* header file sys/poll.h must be included by the external interface. */\n/* #undef CURL_PULL_SYS_POLL_H */\n#ifdef CURL_PULL_SYS_POLL_H\n#  include <sys/poll.h>\n#endif\n\n/* The size of `long', as computed by sizeof. */\n#define CURL_SIZEOF_LONG 8\n\n/* Integral data type used for curl_socklen_t. */\n#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\n\n/* The size of `curl_socklen_t', as computed by sizeof. */\n#define CURL_SIZEOF_CURL_SOCKLEN_T 4\n\n/* Data type definition of curl_socklen_t. */\ntypedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;\n\n/* Signed integral data type used for curl_off_t. */\n#define CURL_TYPEOF_CURL_OFF_T long\n\n/* Data type definition of curl_off_t. */\ntypedef CURL_TYPEOF_CURL_OFF_T curl_off_t;\n\n/* curl_off_t formatting string directive without \"%\" conversion specifier. */\n#define CURL_FORMAT_CURL_OFF_T \"ld\"\n\n/* unsigned curl_off_t formatting string without \"%\" conversion specifier. */\n#define CURL_FORMAT_CURL_OFF_TU \"lu\"\n\n/* curl_off_t formatting string directive with \"%\" conversion specifier. */\n#define CURL_FORMAT_OFF_T \"%ld\"\n\n/* The size of `curl_off_t', as computed by sizeof. */\n#define CURL_SIZEOF_CURL_OFF_T 8\n\n/* curl_off_t constant suffix. */\n#define CURL_SUFFIX_CURL_OFF_T L\n\n/* unsigned curl_off_t constant suffix. */\n#define CURL_SUFFIX_CURL_OFF_TU UL\n\n#endif /* __CURL_CURLBUILD_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/curlrules.h",
    "content": "#ifndef __CURL_CURLRULES_H\n#define __CURL_CURLRULES_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n/* ================================================================ */\n/*                    COMPILE TIME SANITY CHECKS                    */\n/* ================================================================ */\n\n/*\n * NOTE 1:\n * -------\n *\n * All checks done in this file are intentionally placed in a public\n * header file which is pulled by curl/curl.h when an application is\n * being built using an already built libcurl library. Additionally\n * this file is also included and used when building the library.\n *\n * If compilation fails on this file it is certainly sure that the\n * problem is elsewhere. It could be a problem in the curlbuild.h\n * header file, or simply that you are using different compilation\n * settings than those used to build the library.\n *\n * Nothing in this file is intended to be modified or adjusted by the\n * curl library user nor by the curl library builder.\n *\n * Do not deactivate any check, these are done to make sure that the\n * library is properly built and used.\n *\n * You can find further help on the libcurl development mailing list:\n * http://cool.haxx.se/mailman/listinfo/curl-library/\n *\n * NOTE 2\n * ------\n *\n * Some of the following compile time checks are based on the fact\n * that the dimension of a constant array can not be a negative one.\n * In this way if the compile time verification fails, the compilation\n * will fail issuing an error. The error description wording is compiler\n * dependent but it will be quite similar to one of the following:\n *\n *   \"negative subscript or subscript is too large\"\n *   \"array must have at least one element\"\n *   \"-1 is an illegal array size\"\n *   \"size of array is negative\"\n *\n * If you are building an application which tries to use an already\n * built libcurl library and you are getting this kind of errors on\n * this file, it is a clear indication that there is a mismatch between\n * how the library was built and how you are trying to use it for your\n * application. Your already compiled or binary library provider is the\n * only one who can give you the details you need to properly use it.\n */\n\n/*\n * Verify that some macros are actually defined.\n */\n\n#ifndef CURL_SIZEOF_LONG\n#  error \"CURL_SIZEOF_LONG definition is missing!\"\n   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing\n#endif\n\n#ifndef CURL_TYPEOF_CURL_SOCKLEN_T\n#  error \"CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!\"\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing\n#endif\n\n#ifndef CURL_SIZEOF_CURL_SOCKLEN_T\n#  error \"CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!\"\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing\n#endif\n\n#ifndef CURL_TYPEOF_CURL_OFF_T\n#  error \"CURL_TYPEOF_CURL_OFF_T definition is missing!\"\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing\n#endif\n\n#ifndef CURL_FORMAT_CURL_OFF_T\n#  error \"CURL_FORMAT_CURL_OFF_T definition is missing!\"\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing\n#endif\n\n#ifndef CURL_FORMAT_CURL_OFF_TU\n#  error \"CURL_FORMAT_CURL_OFF_TU definition is missing!\"\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing\n#endif\n\n#ifndef CURL_FORMAT_OFF_T\n#  error \"CURL_FORMAT_OFF_T definition is missing!\"\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing\n#endif\n\n#ifndef CURL_SIZEOF_CURL_OFF_T\n#  error \"CURL_SIZEOF_CURL_OFF_T definition is missing!\"\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing\n#endif\n\n#ifndef CURL_SUFFIX_CURL_OFF_T\n#  error \"CURL_SUFFIX_CURL_OFF_T definition is missing!\"\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing\n#endif\n\n#ifndef CURL_SUFFIX_CURL_OFF_TU\n#  error \"CURL_SUFFIX_CURL_OFF_TU definition is missing!\"\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing\n#endif\n\n/*\n * Macros private to this header file.\n */\n\n#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1\n\n#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1\n\n/*\n * Verify that the size previously defined and expected for long\n * is the same as the one reported by sizeof() at compile time.\n */\n\ntypedef char\n  __curl_rule_01__\n    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];\n\n/*\n * Verify that the size previously defined and expected for\n * curl_off_t is actually the the same as the one reported\n * by sizeof() at compile time.\n */\n\ntypedef char\n  __curl_rule_02__\n    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];\n\n/*\n * Verify at compile time that the size of curl_off_t as reported\n * by sizeof() is greater or equal than the one reported for long\n * for the current compilation.\n */\n\ntypedef char\n  __curl_rule_03__\n    [CurlchkszGE(curl_off_t, long)];\n\n/*\n * Verify that the size previously defined and expected for\n * curl_socklen_t is actually the the same as the one reported\n * by sizeof() at compile time.\n */\n\ntypedef char\n  __curl_rule_04__\n    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];\n\n/*\n * Verify at compile time that the size of curl_socklen_t as reported\n * by sizeof() is greater or equal than the one reported for int for\n * the current compilation.\n */\n\ntypedef char\n  __curl_rule_05__\n    [CurlchkszGE(curl_socklen_t, int)];\n\n/* ================================================================ */\n/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */\n/* ================================================================ */\n\n/*\n * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow\n * these to be visible and exported by the external libcurl interface API,\n * while also making them visible to the library internals, simply including\n * curl_setup.h, without actually needing to include curl.h internally.\n * If some day this section would grow big enough, all this should be moved\n * to its own header file.\n */\n\n/*\n * Figure out if we can use the ## preprocessor operator, which is supported\n * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__\n * or  __cplusplus so we need to carefully check for them too.\n */\n\n#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \\\n  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \\\n  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \\\n  defined(__ILEC400__)\n  /* This compiler is believed to have an ISO compatible preprocessor */\n#define CURL_ISOCPP\n#else\n  /* This compiler is believed NOT to have an ISO compatible preprocessor */\n#undef CURL_ISOCPP\n#endif\n\n/*\n * Macros for minimum-width signed and unsigned curl_off_t integer constants.\n */\n\n#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)\n#  define __CURL_OFF_T_C_HLPR2(x) x\n#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \\\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \\\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)\n#else\n#  ifdef CURL_ISOCPP\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix\n#  else\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix\n#  endif\n#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)\n#endif\n\n/*\n * Get rid of macros private to this header file.\n */\n\n#undef CurlchkszEQ\n#undef CurlchkszGE\n\n/*\n * Get rid of macros not intended to exist beyond this point.\n */\n\n#undef CURL_PULL_WS2TCPIP_H\n#undef CURL_PULL_SYS_TYPES_H\n#undef CURL_PULL_SYS_SOCKET_H\n#undef CURL_PULL_SYS_POLL_H\n#undef CURL_PULL_STDINT_H\n#undef CURL_PULL_INTTYPES_H\n\n#undef CURL_TYPEOF_CURL_SOCKLEN_T\n#undef CURL_TYPEOF_CURL_OFF_T\n\n#ifdef CURL_NO_OLDIES\n#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */\n#endif\n\n#endif /* __CURL_CURLRULES_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/curlver.h",
    "content": "#ifndef __CURL_CURLVER_H\n#define __CURL_CURLVER_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n/* This header file contains nothing but libcurl version info, generated by\n   a script at release-time. This was made its own header file in 7.11.2 */\n\n/* This is the global package copyright */\n#define LIBCURL_COPYRIGHT \"1996 - 2013 Daniel Stenberg, <daniel@haxx.se>.\"\n\n/* This is the version number of the libcurl package from which this header\n   file origins: */\n#define LIBCURL_VERSION \"7.29.0\"\n\n/* The numeric version number is also available \"in parts\" by using these\n   defines: */\n#define LIBCURL_VERSION_MAJOR 7\n#define LIBCURL_VERSION_MINOR 29\n#define LIBCURL_VERSION_PATCH 0\n\n/* This is the numeric version of the libcurl version number, meant for easier\n   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will\n   always follow this syntax:\n\n         0xXXYYZZ\n\n   Where XX, YY and ZZ are the main version, release and patch numbers in\n   hexadecimal (using 8 bits each). All three numbers are always represented\n   using two digits.  1.2 would appear as \"0x010200\" while version 9.11.7\n   appears as \"0x090b07\".\n\n   This 6-digit (24 bits) hexadecimal number does not show pre-release number,\n   and it is always a greater number in a more recent release. It makes\n   comparisons with greater than and less than work.\n*/\n#define LIBCURL_VERSION_NUM 0x071d00\n\n/*\n * This is the date and time when the full source package was created. The\n * timestamp is not stored in git, as the timestamp is properly set in the\n * tarballs by the maketgz script.\n *\n * The format of the date should follow this template:\n *\n * \"Mon Feb 12 11:35:33 UTC 2007\"\n */\n#define LIBCURL_TIMESTAMP \"Wed Feb  6 10:13:08 UTC 2013\"\n\n#endif /* __CURL_CURLVER_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/easy.h",
    "content": "#ifndef __CURL_EASY_H\n#define __CURL_EASY_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\nCURL_EXTERN CURL *curl_easy_init(void);\nCURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);\nCURL_EXTERN CURLcode curl_easy_perform(CURL *curl);\nCURL_EXTERN void curl_easy_cleanup(CURL *curl);\n\n/*\n * NAME curl_easy_getinfo()\n *\n * DESCRIPTION\n *\n * Request internal information from the curl session with this function.  The\n * third argument MUST be a pointer to a long, a pointer to a char * or a\n * pointer to a double (as the documentation describes elsewhere).  The data\n * pointed to will be filled in accordingly and can be relied upon only if the\n * function returns CURLE_OK.  This function is intended to get used *AFTER* a\n * performed transfer, all results from this function are undefined until the\n * transfer is completed.\n */\nCURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);\n\n\n/*\n * NAME curl_easy_duphandle()\n *\n * DESCRIPTION\n *\n * Creates a new curl session handle with the same options set for the handle\n * passed in. Duplicating a handle could only be a matter of cloning data and\n * options, internal state info and things like persistent connections cannot\n * be transferred. It is useful in multithreaded applications when you can run\n * curl_easy_duphandle() for each new thread to avoid a series of identical\n * curl_easy_setopt() invokes in every thread.\n */\nCURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);\n\n/*\n * NAME curl_easy_reset()\n *\n * DESCRIPTION\n *\n * Re-initializes a CURL handle to the default values. This puts back the\n * handle to the same state as it was in when it was just created.\n *\n * It does keep: live connections, the Session ID cache, the DNS cache and the\n * cookies.\n */\nCURL_EXTERN void curl_easy_reset(CURL *curl);\n\n/*\n * NAME curl_easy_recv()\n *\n * DESCRIPTION\n *\n * Receives data from the connected socket. Use after successful\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\n */\nCURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,\n                                    size_t *n);\n\n/*\n * NAME curl_easy_send()\n *\n * DESCRIPTION\n *\n * Sends data over the connected socket. Use after successful\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\n */\nCURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,\n                                    size_t buflen, size_t *n);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/mprintf.h",
    "content": "#ifndef __CURL_MPRINTF_H\n#define __CURL_MPRINTF_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n#include <stdarg.h>\n#include <stdio.h> /* needed for FILE */\n\n#include \"curl.h\"\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\nCURL_EXTERN int curl_mprintf(const char *format, ...);\nCURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);\nCURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);\nCURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,\n                               const char *format, ...);\nCURL_EXTERN int curl_mvprintf(const char *format, va_list args);\nCURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);\nCURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);\nCURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,\n                                const char *format, va_list args);\nCURL_EXTERN char *curl_maprintf(const char *format, ...);\nCURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);\n\n#ifdef _MPRINTF_REPLACE\n# undef printf\n# undef fprintf\n# undef sprintf\n# undef vsprintf\n# undef snprintf\n# undef vprintf\n# undef vfprintf\n# undef vsnprintf\n# undef aprintf\n# undef vaprintf\n# define printf curl_mprintf\n# define fprintf curl_mfprintf\n#ifdef CURLDEBUG\n/* When built with CURLDEBUG we define away the sprintf() functions since we\n   don't want internal code to be using them */\n# define sprintf sprintf_was_used\n# define vsprintf vsprintf_was_used\n#else\n# define sprintf curl_msprintf\n# define vsprintf curl_mvsprintf\n#endif\n# define snprintf curl_msnprintf\n# define vprintf curl_mvprintf\n# define vfprintf curl_mvfprintf\n# define vsnprintf curl_mvsnprintf\n# define aprintf curl_maprintf\n# define vaprintf curl_mvaprintf\n#endif\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif /* __CURL_MPRINTF_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/multi.h",
    "content": "#ifndef __CURL_MULTI_H\n#define __CURL_MULTI_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n/*\n  This is an \"external\" header file. Don't give away any internals here!\n\n  GOALS\n\n  o Enable a \"pull\" interface. The application that uses libcurl decides where\n    and when to ask libcurl to get/send data.\n\n  o Enable multiple simultaneous transfers in the same thread without making it\n    complicated for the application.\n\n  o Enable the application to select() on its own file descriptors and curl's\n    file descriptors simultaneous easily.\n\n*/\n\n/*\n * This header file should not really need to include \"curl.h\" since curl.h\n * itself includes this file and we expect user applications to do #include\n * <curl/curl.h> without the need for especially including multi.h.\n *\n * For some reason we added this include here at one point, and rather than to\n * break existing (wrongly written) libcurl applications, we leave it as-is\n * but with this warning attached.\n */\n#include \"curl.h\"\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef void CURLM;\n\ntypedef enum {\n  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or\n                                    curl_multi_socket*() soon */\n  CURLM_OK,\n  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */\n  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */\n  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */\n  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */\n  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */\n  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */\n  CURLM_LAST\n} CURLMcode;\n\n/* just to make code nicer when using curl_multi_socket() you can now check\n   for CURLM_CALL_MULTI_SOCKET too in the same style it works for\n   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */\n#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM\n\ntypedef enum {\n  CURLMSG_NONE, /* first, not used */\n  CURLMSG_DONE, /* This easy handle has completed. 'result' contains\n                   the CURLcode of the transfer */\n  CURLMSG_LAST /* last, not used */\n} CURLMSG;\n\nstruct CURLMsg {\n  CURLMSG msg;       /* what this message means */\n  CURL *easy_handle; /* the handle it concerns */\n  union {\n    void *whatever;    /* message-specific data */\n    CURLcode result;   /* return code for transfer */\n  } data;\n};\ntypedef struct CURLMsg CURLMsg;\n\n/* Based on poll(2) structure and values.\n * We don't use pollfd and POLL* constants explicitly\n * to cover platforms without poll(). */\n#define CURL_WAIT_POLLIN    0x0001\n#define CURL_WAIT_POLLPRI   0x0002\n#define CURL_WAIT_POLLOUT   0x0004\n\nstruct curl_waitfd {\n  curl_socket_t fd;\n  short events;\n  short revents; /* not supported yet */\n};\n\n/*\n * Name:    curl_multi_init()\n *\n * Desc:    inititalize multi-style curl usage\n *\n * Returns: a new CURLM handle to use in all 'curl_multi' functions.\n */\nCURL_EXTERN CURLM *curl_multi_init(void);\n\n/*\n * Name:    curl_multi_add_handle()\n *\n * Desc:    add a standard curl handle to the multi stack\n *\n * Returns: CURLMcode type, general multi error code.\n */\nCURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,\n                                            CURL *curl_handle);\n\n /*\n  * Name:    curl_multi_remove_handle()\n  *\n  * Desc:    removes a curl handle from the multi stack again\n  *\n  * Returns: CURLMcode type, general multi error code.\n  */\nCURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,\n                                               CURL *curl_handle);\n\n /*\n  * Name:    curl_multi_fdset()\n  *\n  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or\n  *          poll() on. We want curl_multi_perform() called as soon as one of\n  *          them are ready.\n  *\n  * Returns: CURLMcode type, general multi error code.\n  */\nCURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,\n                                       fd_set *read_fd_set,\n                                       fd_set *write_fd_set,\n                                       fd_set *exc_fd_set,\n                                       int *max_fd);\n\n/*\n * Name:     curl_multi_wait()\n *\n * Desc:     Poll on all fds within a CURLM set as well as any\n *           additional fds passed to the function.\n *\n * Returns:  CURLMcode type, general multi error code.\n */\nCURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,\n                                      struct curl_waitfd extra_fds[],\n                                      unsigned int extra_nfds,\n                                      int timeout_ms,\n                                      int *ret);\n\n /*\n  * Name:    curl_multi_perform()\n  *\n  * Desc:    When the app thinks there's data available for curl it calls this\n  *          function to read/write whatever there is right now. This returns\n  *          as soon as the reads and writes are done. This function does not\n  *          require that there actually is data available for reading or that\n  *          data can be written, it can be called just in case. It returns\n  *          the number of handles that still transfer data in the second\n  *          argument's integer-pointer.\n  *\n  * Returns: CURLMcode type, general multi error code. *NOTE* that this only\n  *          returns errors etc regarding the whole multi stack. There might\n  *          still have occurred problems on invidual transfers even when this\n  *          returns OK.\n  */\nCURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,\n                                         int *running_handles);\n\n /*\n  * Name:    curl_multi_cleanup()\n  *\n  * Desc:    Cleans up and removes a whole multi stack. It does not free or\n  *          touch any individual easy handles in any way. We need to define\n  *          in what state those handles will be if this function is called\n  *          in the middle of a transfer.\n  *\n  * Returns: CURLMcode type, general multi error code.\n  */\nCURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);\n\n/*\n * Name:    curl_multi_info_read()\n *\n * Desc:    Ask the multi handle if there's any messages/informationals from\n *          the individual transfers. Messages include informationals such as\n *          error code from the transfer or just the fact that a transfer is\n *          completed. More details on these should be written down as well.\n *\n *          Repeated calls to this function will return a new struct each\n *          time, until a special \"end of msgs\" struct is returned as a signal\n *          that there is no more to get at this point.\n *\n *          The data the returned pointer points to will not survive calling\n *          curl_multi_cleanup().\n *\n *          The 'CURLMsg' struct is meant to be very simple and only contain\n *          very basic informations. If more involved information is wanted,\n *          we will provide the particular \"transfer handle\" in that struct\n *          and that should/could/would be used in subsequent\n *          curl_easy_getinfo() calls (or similar). The point being that we\n *          must never expose complex structs to applications, as then we'll\n *          undoubtably get backwards compatibility problems in the future.\n *\n * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out\n *          of structs. It also writes the number of messages left in the\n *          queue (after this read) in the integer the second argument points\n *          to.\n */\nCURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,\n                                          int *msgs_in_queue);\n\n/*\n * Name:    curl_multi_strerror()\n *\n * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode\n *          value into the equivalent human readable error string.  This is\n *          useful for printing meaningful error messages.\n *\n * Returns: A pointer to a zero-terminated error message.\n */\nCURL_EXTERN const char *curl_multi_strerror(CURLMcode);\n\n/*\n * Name:    curl_multi_socket() and\n *          curl_multi_socket_all()\n *\n * Desc:    An alternative version of curl_multi_perform() that allows the\n *          application to pass in one of the file descriptors that have been\n *          detected to have \"action\" on them and let libcurl perform.\n *          See man page for details.\n */\n#define CURL_POLL_NONE   0\n#define CURL_POLL_IN     1\n#define CURL_POLL_OUT    2\n#define CURL_POLL_INOUT  3\n#define CURL_POLL_REMOVE 4\n\n#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD\n\n#define CURL_CSELECT_IN   0x01\n#define CURL_CSELECT_OUT  0x02\n#define CURL_CSELECT_ERR  0x04\n\ntypedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */\n                                    curl_socket_t s, /* socket */\n                                    int what,        /* see above */\n                                    void *userp,     /* private callback\n                                                        pointer */\n                                    void *socketp);  /* private socket\n                                                        pointer */\n/*\n * Name:    curl_multi_timer_callback\n *\n * Desc:    Called by libcurl whenever the library detects a change in the\n *          maximum number of milliseconds the app is allowed to wait before\n *          curl_multi_socket() or curl_multi_perform() must be called\n *          (to allow libcurl's timed events to take place).\n *\n * Returns: The callback should return zero.\n */\ntypedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */\n                                         long timeout_ms, /* see above */\n                                         void *userp);    /* private callback\n                                                             pointer */\n\nCURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,\n                                        int *running_handles);\n\nCURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,\n                                               curl_socket_t s,\n                                               int ev_bitmask,\n                                               int *running_handles);\n\nCURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,\n                                            int *running_handles);\n\n#ifndef CURL_ALLOW_OLD_MULTI_SOCKET\n/* This macro below was added in 7.16.3 to push users who recompile to use\n   the new curl_multi_socket_action() instead of the old curl_multi_socket()\n*/\n#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)\n#endif\n\n/*\n * Name:    curl_multi_timeout()\n *\n * Desc:    Returns the maximum number of milliseconds the app is allowed to\n *          wait before curl_multi_socket() or curl_multi_perform() must be\n *          called (to allow libcurl's timed events to take place).\n *\n * Returns: CURLM error code.\n */\nCURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,\n                                         long *milliseconds);\n\n#undef CINIT /* re-using the same name as in curl.h */\n\n#ifdef CURL_ISOCPP\n#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num\n#else\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\n#define LONG          CURLOPTTYPE_LONG\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\n#define OFF_T         CURLOPTTYPE_OFF_T\n#define CINIT(name,type,number) CURLMOPT_/**/name = type + number\n#endif\n\ntypedef enum {\n  /* This is the socket callback function pointer */\n  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),\n\n  /* This is the argument passed to the socket callback */\n  CINIT(SOCKETDATA, OBJECTPOINT, 2),\n\n    /* set to 1 to enable pipelining for this multi handle */\n  CINIT(PIPELINING, LONG, 3),\n\n   /* This is the timer callback function pointer */\n  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),\n\n  /* This is the argument passed to the timer callback */\n  CINIT(TIMERDATA, OBJECTPOINT, 5),\n\n  /* maximum number of entries in the connection cache */\n  CINIT(MAXCONNECTS, LONG, 6),\n\n  CURLMOPT_LASTENTRY /* the last unused */\n} CURLMoption;\n\n\n/*\n * Name:    curl_multi_setopt()\n *\n * Desc:    Sets options for the multi handle.\n *\n * Returns: CURLM error code.\n */\nCURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,\n                                        CURLMoption option, ...);\n\n\n/*\n * Name:    curl_multi_assign()\n *\n * Desc:    This function sets an association in the multi handle between the\n *          given socket and a private pointer of the application. This is\n *          (only) useful for curl_multi_socket uses.\n *\n * Returns: CURLM error code.\n */\nCURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,\n                                        curl_socket_t sockfd, void *sockp);\n\n#ifdef __cplusplus\n} /* end of extern \"C\" */\n#endif\n\n#endif\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/stdcheaders.h",
    "content": "#ifndef __STDC_HEADERS_H\n#define __STDC_HEADERS_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n#include <sys/types.h>\n\nsize_t fread (void *, size_t, size_t, FILE *);\nsize_t fwrite (const void *, size_t, size_t, FILE *);\n\nint strcasecmp(const char *, const char *);\nint strncasecmp(const char *, const char *, size_t);\n\n#endif /* __STDC_HEADERS_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/include/curl/typecheck-gcc.h",
    "content": "#ifndef __CURL_TYPECHECK_GCC_H\n#define __CURL_TYPECHECK_GCC_H\n/***************************************************************************\n *                                  _   _ ____  _\n *  Project                     ___| | | |  _ \\| |\n *                             / __| | | | |_) | |\n *                            | (__| |_| |  _ <| |___\n *                             \\___|\\___/|_| \\_\\_____|\n *\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\n *\n * This software is licensed as described in the file COPYING, which\n * you should have received as part of this distribution. The terms\n * are also available at http://curl.haxx.se/docs/copyright.html.\n *\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\n * copies of the Software, and permit persons to whom the Software is\n * furnished to do so, under the terms of the COPYING file.\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n * KIND, either express or implied.\n *\n ***************************************************************************/\n\n/* wraps curl_easy_setopt() with typechecking */\n\n/* To add a new kind of warning, add an\n *   if(_curl_is_sometype_option(_curl_opt))\n *     if(!_curl_is_sometype(value))\n *       _curl_easy_setopt_err_sometype();\n * block and define _curl_is_sometype_option, _curl_is_sometype and\n * _curl_easy_setopt_err_sometype below\n *\n * NOTE: We use two nested 'if' statements here instead of the && operator, in\n *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x\n *       when compiling with -Wlogical-op.\n *\n * To add an option that uses the same type as an existing option, you'll just\n * need to extend the appropriate _curl_*_option macro\n */\n#define curl_easy_setopt(handle, option, value)                               \\\n__extension__ ({                                                              \\\n  __typeof__ (option) _curl_opt = option;                                     \\\n  if(__builtin_constant_p(_curl_opt)) {                                       \\\n    if(_curl_is_long_option(_curl_opt))                                       \\\n      if(!_curl_is_long(value))                                               \\\n        _curl_easy_setopt_err_long();                                         \\\n    if(_curl_is_off_t_option(_curl_opt))                                      \\\n      if(!_curl_is_off_t(value))                                              \\\n        _curl_easy_setopt_err_curl_off_t();                                   \\\n    if(_curl_is_string_option(_curl_opt))                                     \\\n      if(!_curl_is_string(value))                                             \\\n        _curl_easy_setopt_err_string();                                       \\\n    if(_curl_is_write_cb_option(_curl_opt))                                   \\\n      if(!_curl_is_write_cb(value))                                           \\\n        _curl_easy_setopt_err_write_callback();                               \\\n    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \\\n      if(!_curl_is_read_cb(value))                                            \\\n        _curl_easy_setopt_err_read_cb();                                      \\\n    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \\\n      if(!_curl_is_ioctl_cb(value))                                           \\\n        _curl_easy_setopt_err_ioctl_cb();                                     \\\n    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \\\n      if(!_curl_is_sockopt_cb(value))                                         \\\n        _curl_easy_setopt_err_sockopt_cb();                                   \\\n    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \\\n      if(!_curl_is_opensocket_cb(value))                                      \\\n        _curl_easy_setopt_err_opensocket_cb();                                \\\n    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \\\n      if(!_curl_is_progress_cb(value))                                        \\\n        _curl_easy_setopt_err_progress_cb();                                  \\\n    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \\\n      if(!_curl_is_debug_cb(value))                                           \\\n        _curl_easy_setopt_err_debug_cb();                                     \\\n    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \\\n      if(!_curl_is_ssl_ctx_cb(value))                                         \\\n        _curl_easy_setopt_err_ssl_ctx_cb();                                   \\\n    if(_curl_is_conv_cb_option(_curl_opt))                                    \\\n      if(!_curl_is_conv_cb(value))                                            \\\n        _curl_easy_setopt_err_conv_cb();                                      \\\n    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \\\n      if(!_curl_is_seek_cb(value))                                            \\\n        _curl_easy_setopt_err_seek_cb();                                      \\\n    if(_curl_is_cb_data_option(_curl_opt))                                    \\\n      if(!_curl_is_cb_data(value))                                            \\\n        _curl_easy_setopt_err_cb_data();                                      \\\n    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \\\n      if(!_curl_is_error_buffer(value))                                       \\\n        _curl_easy_setopt_err_error_buffer();                                 \\\n    if((_curl_opt) == CURLOPT_STDERR)                                         \\\n      if(!_curl_is_FILE(value))                                               \\\n        _curl_easy_setopt_err_FILE();                                         \\\n    if(_curl_is_postfields_option(_curl_opt))                                 \\\n      if(!_curl_is_postfields(value))                                         \\\n        _curl_easy_setopt_err_postfields();                                   \\\n    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \\\n      if(!_curl_is_arr((value), struct curl_httppost))                        \\\n        _curl_easy_setopt_err_curl_httpost();                                 \\\n    if(_curl_is_slist_option(_curl_opt))                                      \\\n      if(!_curl_is_arr((value), struct curl_slist))                           \\\n        _curl_easy_setopt_err_curl_slist();                                   \\\n    if((_curl_opt) == CURLOPT_SHARE)                                          \\\n      if(!_curl_is_ptr((value), CURLSH))                                      \\\n        _curl_easy_setopt_err_CURLSH();                                       \\\n  }                                                                           \\\n  curl_easy_setopt(handle, _curl_opt, value);                                 \\\n})\n\n/* wraps curl_easy_getinfo() with typechecking */\n/* FIXME: don't allow const pointers */\n#define curl_easy_getinfo(handle, info, arg)                                  \\\n__extension__ ({                                                              \\\n  __typeof__ (info) _curl_info = info;                                        \\\n  if(__builtin_constant_p(_curl_info)) {                                      \\\n    if(_curl_is_string_info(_curl_info))                                      \\\n      if(!_curl_is_arr((arg), char *))                                        \\\n        _curl_easy_getinfo_err_string();                                      \\\n    if(_curl_is_long_info(_curl_info))                                        \\\n      if(!_curl_is_arr((arg), long))                                          \\\n        _curl_easy_getinfo_err_long();                                        \\\n    if(_curl_is_double_info(_curl_info))                                      \\\n      if(!_curl_is_arr((arg), double))                                        \\\n        _curl_easy_getinfo_err_double();                                      \\\n    if(_curl_is_slist_info(_curl_info))                                       \\\n      if(!_curl_is_arr((arg), struct curl_slist *))                           \\\n        _curl_easy_getinfo_err_curl_slist();                                  \\\n  }                                                                           \\\n  curl_easy_getinfo(handle, _curl_info, arg);                                 \\\n})\n\n/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),\n * for now just make sure that the functions are called with three\n * arguments\n */\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\n\n\n/* the actual warnings, triggered by calling the _curl_easy_setopt_err*\n * functions */\n\n/* To define a new warning, use _CURL_WARNING(identifier, \"message\") */\n#define _CURL_WARNING(id, message)                                            \\\n  static void __attribute__((__warning__(message)))                           \\\n  __attribute__((__unused__)) __attribute__((__noinline__))                   \\\n  id(void) { __asm__(\"\"); }\n\n_CURL_WARNING(_curl_easy_setopt_err_long,\n  \"curl_easy_setopt expects a long argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,\n  \"curl_easy_setopt expects a curl_off_t argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_string,\n              \"curl_easy_setopt expects a \"\n              \"string (char* or char[]) argument for this option\"\n  )\n_CURL_WARNING(_curl_easy_setopt_err_write_callback,\n  \"curl_easy_setopt expects a curl_write_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_read_cb,\n  \"curl_easy_setopt expects a curl_read_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,\n  \"curl_easy_setopt expects a curl_ioctl_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,\n  \"curl_easy_setopt expects a curl_sockopt_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,\n              \"curl_easy_setopt expects a \"\n              \"curl_opensocket_callback argument for this option\"\n  )\n_CURL_WARNING(_curl_easy_setopt_err_progress_cb,\n  \"curl_easy_setopt expects a curl_progress_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_debug_cb,\n  \"curl_easy_setopt expects a curl_debug_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,\n  \"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_conv_cb,\n  \"curl_easy_setopt expects a curl_conv_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_seek_cb,\n  \"curl_easy_setopt expects a curl_seek_callback argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_cb_data,\n              \"curl_easy_setopt expects a \"\n              \"private data pointer as argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_error_buffer,\n              \"curl_easy_setopt expects a \"\n              \"char buffer of CURL_ERROR_SIZE as argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_FILE,\n  \"curl_easy_setopt expects a FILE* argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_postfields,\n  \"curl_easy_setopt expects a void* or char* argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,\n  \"curl_easy_setopt expects a struct curl_httppost* argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_curl_slist,\n  \"curl_easy_setopt expects a struct curl_slist* argument for this option\")\n_CURL_WARNING(_curl_easy_setopt_err_CURLSH,\n  \"curl_easy_setopt expects a CURLSH* argument for this option\")\n\n_CURL_WARNING(_curl_easy_getinfo_err_string,\n  \"curl_easy_getinfo expects a pointer to char * for this info\")\n_CURL_WARNING(_curl_easy_getinfo_err_long,\n  \"curl_easy_getinfo expects a pointer to long for this info\")\n_CURL_WARNING(_curl_easy_getinfo_err_double,\n  \"curl_easy_getinfo expects a pointer to double for this info\")\n_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,\n  \"curl_easy_getinfo expects a pointer to struct curl_slist * for this info\")\n\n/* groups of curl_easy_setops options that take the same type of argument */\n\n/* To add a new option to one of the groups, just add\n *   (option) == CURLOPT_SOMETHING\n * to the or-expression. If the option takes a long or curl_off_t, you don't\n * have to do anything\n */\n\n/* evaluates to true if option takes a long argument */\n#define _curl_is_long_option(option)                                          \\\n  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)\n\n#define _curl_is_off_t_option(option)                                         \\\n  ((option) > CURLOPTTYPE_OFF_T)\n\n/* evaluates to true if option takes a char* argument */\n#define _curl_is_string_option(option)                                        \\\n  ((option) == CURLOPT_URL ||                                                 \\\n   (option) == CURLOPT_PROXY ||                                               \\\n   (option) == CURLOPT_INTERFACE ||                                           \\\n   (option) == CURLOPT_NETRC_FILE ||                                          \\\n   (option) == CURLOPT_USERPWD ||                                             \\\n   (option) == CURLOPT_USERNAME ||                                            \\\n   (option) == CURLOPT_PASSWORD ||                                            \\\n   (option) == CURLOPT_PROXYUSERPWD ||                                        \\\n   (option) == CURLOPT_PROXYUSERNAME ||                                       \\\n   (option) == CURLOPT_PROXYPASSWORD ||                                       \\\n   (option) == CURLOPT_NOPROXY ||                                             \\\n   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \\\n   (option) == CURLOPT_REFERER ||                                             \\\n   (option) == CURLOPT_USERAGENT ||                                           \\\n   (option) == CURLOPT_COOKIE ||                                              \\\n   (option) == CURLOPT_COOKIEFILE ||                                          \\\n   (option) == CURLOPT_COOKIEJAR ||                                           \\\n   (option) == CURLOPT_COOKIELIST ||                                          \\\n   (option) == CURLOPT_FTPPORT ||                                             \\\n   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \\\n   (option) == CURLOPT_FTP_ACCOUNT ||                                         \\\n   (option) == CURLOPT_RANGE ||                                               \\\n   (option) == CURLOPT_CUSTOMREQUEST ||                                       \\\n   (option) == CURLOPT_SSLCERT ||                                             \\\n   (option) == CURLOPT_SSLCERTTYPE ||                                         \\\n   (option) == CURLOPT_SSLKEY ||                                              \\\n   (option) == CURLOPT_SSLKEYTYPE ||                                          \\\n   (option) == CURLOPT_KEYPASSWD ||                                           \\\n   (option) == CURLOPT_SSLENGINE ||                                           \\\n   (option) == CURLOPT_CAINFO ||                                              \\\n   (option) == CURLOPT_CAPATH ||                                              \\\n   (option) == CURLOPT_RANDOM_FILE ||                                         \\\n   (option) == CURLOPT_EGDSOCKET ||                                           \\\n   (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \\\n   (option) == CURLOPT_KRBLEVEL ||                                            \\\n   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \\\n   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \\\n   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \\\n   (option) == CURLOPT_CRLFILE ||                                             \\\n   (option) == CURLOPT_ISSUERCERT ||                                          \\\n   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \\\n   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \\\n   (option) == CURLOPT_MAIL_FROM ||                                           \\\n   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \\\n   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \\\n   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \\\n   0)\n\n/* evaluates to true if option takes a curl_write_callback argument */\n#define _curl_is_write_cb_option(option)                                      \\\n  ((option) == CURLOPT_HEADERFUNCTION ||                                      \\\n   (option) == CURLOPT_WRITEFUNCTION)\n\n/* evaluates to true if option takes a curl_conv_callback argument */\n#define _curl_is_conv_cb_option(option)                                       \\\n  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \\\n   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \\\n   (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)\n\n/* evaluates to true if option takes a data argument to pass to a callback */\n#define _curl_is_cb_data_option(option)                                       \\\n  ((option) == CURLOPT_WRITEDATA ||                                           \\\n   (option) == CURLOPT_READDATA ||                                            \\\n   (option) == CURLOPT_IOCTLDATA ||                                           \\\n   (option) == CURLOPT_SOCKOPTDATA ||                                         \\\n   (option) == CURLOPT_OPENSOCKETDATA ||                                      \\\n   (option) == CURLOPT_PROGRESSDATA ||                                        \\\n   (option) == CURLOPT_WRITEHEADER ||                                         \\\n   (option) == CURLOPT_DEBUGDATA ||                                           \\\n   (option) == CURLOPT_SSL_CTX_DATA ||                                        \\\n   (option) == CURLOPT_SEEKDATA ||                                            \\\n   (option) == CURLOPT_PRIVATE ||                                             \\\n   (option) == CURLOPT_SSH_KEYDATA ||                                         \\\n   (option) == CURLOPT_INTERLEAVEDATA ||                                      \\\n   (option) == CURLOPT_CHUNK_DATA ||                                          \\\n   (option) == CURLOPT_FNMATCH_DATA ||                                        \\\n   0)\n\n/* evaluates to true if option takes a POST data argument (void* or char*) */\n#define _curl_is_postfields_option(option)                                    \\\n  ((option) == CURLOPT_POSTFIELDS ||                                          \\\n   (option) == CURLOPT_COPYPOSTFIELDS ||                                      \\\n   0)\n\n/* evaluates to true if option takes a struct curl_slist * argument */\n#define _curl_is_slist_option(option)                                         \\\n  ((option) == CURLOPT_HTTPHEADER ||                                          \\\n   (option) == CURLOPT_HTTP200ALIASES ||                                      \\\n   (option) == CURLOPT_QUOTE ||                                               \\\n   (option) == CURLOPT_POSTQUOTE ||                                           \\\n   (option) == CURLOPT_PREQUOTE ||                                            \\\n   (option) == CURLOPT_TELNETOPTIONS ||                                       \\\n   (option) == CURLOPT_MAIL_RCPT ||                                           \\\n   0)\n\n/* groups of curl_easy_getinfo infos that take the same type of argument */\n\n/* evaluates to true if info expects a pointer to char * argument */\n#define _curl_is_string_info(info)                                            \\\n  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)\n\n/* evaluates to true if info expects a pointer to long argument */\n#define _curl_is_long_info(info)                                              \\\n  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)\n\n/* evaluates to true if info expects a pointer to double argument */\n#define _curl_is_double_info(info)                                            \\\n  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)\n\n/* true if info expects a pointer to struct curl_slist * argument */\n#define _curl_is_slist_info(info)                                             \\\n  (CURLINFO_SLIST < (info))\n\n\n/* typecheck helpers -- check whether given expression has requested type*/\n\n/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,\n * otherwise define a new macro. Search for __builtin_types_compatible_p\n * in the GCC manual.\n * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is\n * the actual expression passed to the curl_easy_setopt macro. This\n * means that you can only apply the sizeof and __typeof__ operators, no\n * == or whatsoever.\n */\n\n/* XXX: should evaluate to true iff expr is a pointer */\n#define _curl_is_any_ptr(expr)                                                \\\n  (sizeof(expr) == sizeof(void*))\n\n/* evaluates to true if expr is NULL */\n/* XXX: must not evaluate expr, so this check is not accurate */\n#define _curl_is_NULL(expr)                                                   \\\n  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))\n\n/* evaluates to true if expr is type*, const type* or NULL */\n#define _curl_is_ptr(expr, type)                                              \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \\\n   __builtin_types_compatible_p(__typeof__(expr), const type *))\n\n/* evaluates to true if expr is one of type[], type*, NULL or const type* */\n#define _curl_is_arr(expr, type)                                              \\\n  (_curl_is_ptr((expr), type) ||                                              \\\n   __builtin_types_compatible_p(__typeof__(expr), type []))\n\n/* evaluates to true if expr is a string */\n#define _curl_is_string(expr)                                                 \\\n  (_curl_is_arr((expr), char) ||                                              \\\n   _curl_is_arr((expr), signed char) ||                                       \\\n   _curl_is_arr((expr), unsigned char))\n\n/* evaluates to true if expr is a long (no matter the signedness)\n * XXX: for now, int is also accepted (and therefore short and char, which\n * are promoted to int when passed to a variadic function) */\n#define _curl_is_long(expr)                                                   \\\n  (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \\\n   __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \\\n   __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \\\n   __builtin_types_compatible_p(__typeof__(expr), int) ||                     \\\n   __builtin_types_compatible_p(__typeof__(expr), signed int) ||              \\\n   __builtin_types_compatible_p(__typeof__(expr), unsigned int) ||            \\\n   __builtin_types_compatible_p(__typeof__(expr), short) ||                   \\\n   __builtin_types_compatible_p(__typeof__(expr), signed short) ||            \\\n   __builtin_types_compatible_p(__typeof__(expr), unsigned short) ||          \\\n   __builtin_types_compatible_p(__typeof__(expr), char) ||                    \\\n   __builtin_types_compatible_p(__typeof__(expr), signed char) ||             \\\n   __builtin_types_compatible_p(__typeof__(expr), unsigned char))\n\n/* evaluates to true if expr is of type curl_off_t */\n#define _curl_is_off_t(expr)                                                  \\\n  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))\n\n/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */\n/* XXX: also check size of an char[] array? */\n#define _curl_is_error_buffer(expr)                                           \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \\\n   __builtin_types_compatible_p(__typeof__(expr), char[]))\n\n/* evaluates to true if expr is of type (const) void* or (const) FILE* */\n#if 0\n#define _curl_is_cb_data(expr)                                                \\\n  (_curl_is_ptr((expr), void) ||                                              \\\n   _curl_is_ptr((expr), FILE))\n#else /* be less strict */\n#define _curl_is_cb_data(expr)                                                \\\n  _curl_is_any_ptr(expr)\n#endif\n\n/* evaluates to true if expr is of type FILE* */\n#define _curl_is_FILE(expr)                                                   \\\n  (__builtin_types_compatible_p(__typeof__(expr), FILE *))\n\n/* evaluates to true if expr can be passed as POST data (void* or char*) */\n#define _curl_is_postfields(expr)                                             \\\n  (_curl_is_ptr((expr), void) ||                                              \\\n   _curl_is_arr((expr), char))\n\n/* FIXME: the whole callback checking is messy...\n * The idea is to tolerate char vs. void and const vs. not const\n * pointers in arguments at least\n */\n/* helper: __builtin_types_compatible_p distinguishes between functions and\n * function pointers, hide it */\n#define _curl_callback_compatible(func, type)                                 \\\n  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \\\n   __builtin_types_compatible_p(__typeof__(func), type*))\n\n/* evaluates to true if expr is of type curl_read_callback or \"similar\" */\n#define _curl_is_read_cb(expr)                                          \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \\\n   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \\\n   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \\\n   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \\\n   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \\\n   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \\\n   _curl_callback_compatible((expr), _curl_read_callback6))\ntypedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);\ntypedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);\ntypedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);\ntypedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);\ntypedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);\ntypedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);\n\n/* evaluates to true if expr is of type curl_write_callback or \"similar\" */\n#define _curl_is_write_cb(expr)                                               \\\n  (_curl_is_read_cb(expr) ||                                            \\\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \\\n   _curl_callback_compatible((expr), _curl_write_callback1) ||                \\\n   _curl_callback_compatible((expr), _curl_write_callback2) ||                \\\n   _curl_callback_compatible((expr), _curl_write_callback3) ||                \\\n   _curl_callback_compatible((expr), _curl_write_callback4) ||                \\\n   _curl_callback_compatible((expr), _curl_write_callback5) ||                \\\n   _curl_callback_compatible((expr), _curl_write_callback6))\ntypedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);\ntypedef size_t (_curl_write_callback2)(const char *, size_t, size_t,\n                                       const void*);\ntypedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);\ntypedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);\ntypedef size_t (_curl_write_callback5)(const void *, size_t, size_t,\n                                       const void*);\ntypedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);\n\n/* evaluates to true if expr is of type curl_ioctl_callback or \"similar\" */\n#define _curl_is_ioctl_cb(expr)                                         \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \\\n   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \\\n   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \\\n   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \\\n   _curl_callback_compatible((expr), _curl_ioctl_callback4))\ntypedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);\ntypedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);\ntypedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);\ntypedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);\n\n/* evaluates to true if expr is of type curl_sockopt_callback or \"similar\" */\n#define _curl_is_sockopt_cb(expr)                                       \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \\\n   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \\\n   _curl_callback_compatible((expr), _curl_sockopt_callback2))\ntypedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);\ntypedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,\n                                      curlsocktype);\n\n/* evaluates to true if expr is of type curl_opensocket_callback or\n   \"similar\" */\n#define _curl_is_opensocket_cb(expr)                                    \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\\\n   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \\\n   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \\\n   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \\\n   _curl_callback_compatible((expr), _curl_opensocket_callback4))\ntypedef curl_socket_t (_curl_opensocket_callback1)\n  (void *, curlsocktype, struct curl_sockaddr *);\ntypedef curl_socket_t (_curl_opensocket_callback2)\n  (void *, curlsocktype, const struct curl_sockaddr *);\ntypedef curl_socket_t (_curl_opensocket_callback3)\n  (const void *, curlsocktype, struct curl_sockaddr *);\ntypedef curl_socket_t (_curl_opensocket_callback4)\n  (const void *, curlsocktype, const struct curl_sockaddr *);\n\n/* evaluates to true if expr is of type curl_progress_callback or \"similar\" */\n#define _curl_is_progress_cb(expr)                                      \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \\\n   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \\\n   _curl_callback_compatible((expr), _curl_progress_callback2))\ntypedef int (_curl_progress_callback1)(void *,\n    double, double, double, double);\ntypedef int (_curl_progress_callback2)(const void *,\n    double, double, double, double);\n\n/* evaluates to true if expr is of type curl_debug_callback or \"similar\" */\n#define _curl_is_debug_cb(expr)                                         \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \\\n   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \\\n   _curl_callback_compatible((expr), _curl_debug_callback8))\ntypedef int (_curl_debug_callback1) (CURL *,\n    curl_infotype, char *, size_t, void *);\ntypedef int (_curl_debug_callback2) (CURL *,\n    curl_infotype, char *, size_t, const void *);\ntypedef int (_curl_debug_callback3) (CURL *,\n    curl_infotype, const char *, size_t, void *);\ntypedef int (_curl_debug_callback4) (CURL *,\n    curl_infotype, const char *, size_t, const void *);\ntypedef int (_curl_debug_callback5) (CURL *,\n    curl_infotype, unsigned char *, size_t, void *);\ntypedef int (_curl_debug_callback6) (CURL *,\n    curl_infotype, unsigned char *, size_t, const void *);\ntypedef int (_curl_debug_callback7) (CURL *,\n    curl_infotype, const unsigned char *, size_t, void *);\ntypedef int (_curl_debug_callback8) (CURL *,\n    curl_infotype, const unsigned char *, size_t, const void *);\n\n/* evaluates to true if expr is of type curl_ssl_ctx_callback or \"similar\" */\n/* this is getting even messier... */\n#define _curl_is_ssl_ctx_cb(expr)                                       \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \\\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))\ntypedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);\ntypedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);\ntypedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);\ntypedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);\n#ifdef HEADER_SSL_H\n/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX\n * this will of course break if we're included before OpenSSL headers...\n */\ntypedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);\ntypedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);\ntypedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);\ntypedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,\n                                           const void *);\n#else\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;\n#endif\n\n/* evaluates to true if expr is of type curl_conv_callback or \"similar\" */\n#define _curl_is_conv_cb(expr)                                          \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \\\n   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \\\n   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \\\n   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \\\n   _curl_callback_compatible((expr), _curl_conv_callback4))\ntypedef CURLcode (*_curl_conv_callback1)(char *, size_t length);\ntypedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);\ntypedef CURLcode (*_curl_conv_callback3)(void *, size_t length);\ntypedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);\n\n/* evaluates to true if expr is of type curl_seek_callback or \"similar\" */\n#define _curl_is_seek_cb(expr)                                          \\\n  (_curl_is_NULL(expr) ||                                                     \\\n   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \\\n   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \\\n   _curl_callback_compatible((expr), _curl_seek_callback2))\ntypedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);\ntypedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);\n\n\n#endif /* __CURL_TYPECHECK_GCC_H */\n"
  },
  {
    "path": "Engine/porting/OSX/curl/lib/libcurl.la",
    "content": "# libcurl.la - a libtool library file\n# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.2\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# The name that we can dlopen(3).\ndlname=''\n\n# Names of this library.\nlibrary_names=''\n\n# The name of the static archive.\nold_library='libcurl.a'\n\n# Linker flags that can not go in dependency_libs.\ninherited_linker_flags='  -framework CoreFoundation -framework Security'\n\n# Libraries that this one depends upon.\ndependency_libs=' -lz'\n\n# Names of additional weak libraries provided by this library\nweak_library_names=''\n\n# Version information for libcurl.\ncurrent=7\nage=3\nrevision=0\n\n# Is this an already installed library?\ninstalled=yes\n\n# Should we warn about portability when linking against -modules?\nshouldnotlink=no\n\n# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n\n# Directory that this library needs to be installed in:\nlibdir='/Users/KeiNakazawa/Documents/workspace/playground/Tools/build_curl/build/out/x86_64/lib'\n"
  },
  {
    "path": "Engine/porting/OSX/curl/lib/pkgconfig/libcurl.pc",
    "content": "#***************************************************************************\n#                                  _   _ ____  _\n#  Project                     ___| | | |  _ \\| |\n#                             / __| | | | |_) | |\n#                            | (__| |_| |  _ <| |___\n#                             \\___|\\___/|_| \\_\\_____|\n#\n# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as part of this distribution. The terms\n# are also available at http://curl.haxx.se/docs/copyright.html.\n#\n# You may opt to use, copy, modify, merge, publish, distribute and/or sell\n# copies of the Software, and permit persons to whom the Software is\n# furnished to do so, under the terms of the COPYING file.\n#\n# This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n# KIND, either express or implied.\n#\n###########################################################################\n\n# This should most probably benefit from getting a \"Requires:\" field added\n# dynamically by configure.\n#\nprefix=/Users/KeiNakazawa/Documents/workspace/playground/Tools/build_curl/build/out/x86_64\nexec_prefix=${prefix}\nlibdir=${exec_prefix}/lib\nincludedir=${prefix}/include\nsupported_protocols=\"HTTP HTTPS\"\nsupported_features=\"SSL IPv6 libz NTLM NTLM_WB\"\n\nName: libcurl\nURL: http://curl.haxx.se/\nDescription: Library to transfer files with ftp, http, etc.\nVersion: 7.29.0\nLibs: -L${libdir} -lcurl\nLibs.private: -lz\nCflags: -I${includedir} \n"
  },
  {
    "path": "Engine/porting/OSX/glew/include/GL/glew.h",
    "content": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>\n** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>\n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n**   this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n**   this list of conditions and the following disclaimer in the documentation \n**   and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n**   derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n * Mesa 3-D graphics library\n * Version:  7.0\n *\n * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __glew_h__\n#define __glew_h__\n#define __GLEW_H__\n\n#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)\n#error gl.h included before glew.h\n#endif\n#if defined(__REGAL_H__)\n#error Regal.h included before glew.h\n#endif\n#if defined(__glext_h_) || defined(__GLEXT_H_)\n#error glext.h included before glew.h\n#endif\n#if defined(__gl_ATI_h_)\n#error glATI.h included before glew.h\n#endif\n\n#define __gl_h_\n#define __GL_H__\n#define __REGAL_H__\n#define __X_GL_H\n#define __glext_h_\n#define __GLEXT_H_\n#define __gl_ATI_h_\n\n#if defined(_WIN32)\n\n/*\n * GLEW does not include <windows.h> to avoid name space pollution.\n * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t\n * defined properly.\n */\n/* <windef.h> */\n#ifndef APIENTRY\n#define GLEW_APIENTRY_DEFINED\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\n#    define APIENTRY __stdcall\n#  elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)\n#    define APIENTRY __stdcall\n#  else\n#    define APIENTRY\n#  endif\n#endif\n#ifndef GLAPI\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\n#    define GLAPI extern\n#  endif\n#endif\n/* <winnt.h> */\n#ifndef CALLBACK\n#define GLEW_CALLBACK_DEFINED\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\n#    define CALLBACK __attribute__ ((__stdcall__))\n#  elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\n#    define CALLBACK __stdcall\n#  else\n#    define CALLBACK\n#  endif\n#endif\n/* <wingdi.h> and <winnt.h> */\n#ifndef WINGDIAPI\n#define GLEW_WINGDIAPI_DEFINED\n#define WINGDIAPI __declspec(dllimport)\n#endif\n/* <ctype.h> */\n#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED)\ntypedef unsigned short wchar_t;\n#  define _WCHAR_T_DEFINED\n#endif\n/* <stddef.h> */\n#if !defined(_W64)\n#  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300\n#    define _W64 __w64\n#  else\n#    define _W64\n#  endif\n#endif\n#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__)\n#  ifdef _WIN64\ntypedef __int64 ptrdiff_t;\n#  else\ntypedef _W64 int ptrdiff_t;\n#  endif\n#  define _PTRDIFF_T_DEFINED\n#  define _PTRDIFF_T_\n#endif\n\n#ifndef GLAPI\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\n#    define GLAPI extern\n#  else\n#    define GLAPI WINGDIAPI\n#  endif\n#endif\n\n#ifndef GLAPIENTRY\n#define GLAPIENTRY APIENTRY\n#endif\n\n#ifndef GLEWAPIENTRY\n#define GLEWAPIENTRY APIENTRY\n#endif\n\n/*\n * GLEW_STATIC is defined for static library.\n * GLEW_BUILD  is defined for building the DLL library.\n */\n\n#ifdef GLEW_STATIC\n#  define GLEWAPI extern\n#else\n#  ifdef GLEW_BUILD\n#    define GLEWAPI extern __declspec(dllexport)\n#  else\n#    define GLEWAPI extern __declspec(dllimport)\n#  endif\n#endif\n\n#else /* _UNIX */\n\n/*\n * Needed for ptrdiff_t in turn needed by VBO.  This is defined by ISO\n * C.  On my system, this amounts to _3 lines_ of included code, all of\n * them pretty much harmless.  If you know of a way of detecting 32 vs\n * 64 _targets_ at compile time you are free to replace this with\n * something that's portable.  For now, _this_ is the portable solution.\n * (mem, 2004-01-04)\n */\n\n#include <stddef.h>\n\n/* SGI MIPSPro doesn't like stdint.h in C++ mode          */\n/* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */\n\n#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__)\n#include <inttypes.h>\n#else\n#include <stdint.h>\n#endif\n\n#define GLEW_APIENTRY_DEFINED\n#define APIENTRY\n\n/*\n * GLEW_STATIC is defined for static library.\n */\n\n#ifdef GLEW_STATIC\n#  define GLEWAPI extern\n#else\n#  if defined(__GNUC__) && __GNUC__>=4\n#   define GLEWAPI extern __attribute__ ((visibility(\"default\")))\n#  elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)\n#   define GLEWAPI extern __global\n#  else\n#   define GLEWAPI extern\n#  endif\n#endif\n\n/* <glu.h> */\n#ifndef GLAPI\n#define GLAPI extern\n#endif\n\n#ifndef GLAPIENTRY\n#define GLAPIENTRY\n#endif\n\n#ifndef GLEWAPIENTRY\n#define GLEWAPIENTRY\n#endif\n\n#endif /* _WIN32 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* ----------------------------- GL_VERSION_1_1 ---------------------------- */\n\n#ifndef GL_VERSION_1_1\n#define GL_VERSION_1_1 1\n\ntypedef unsigned int GLenum;\ntypedef unsigned int GLbitfield;\ntypedef unsigned int GLuint;\ntypedef int GLint;\ntypedef int GLsizei;\ntypedef unsigned char GLboolean;\ntypedef signed char GLbyte;\ntypedef short GLshort;\ntypedef unsigned char GLubyte;\ntypedef unsigned short GLushort;\ntypedef unsigned long GLulong;\ntypedef float GLfloat;\ntypedef float GLclampf;\ntypedef double GLdouble;\ntypedef double GLclampd;\ntypedef void GLvoid;\n#if defined(_MSC_VER) && _MSC_VER < 1400\ntypedef __int64 GLint64EXT;\ntypedef unsigned __int64 GLuint64EXT;\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\ntypedef signed long long GLint64EXT;\ntypedef unsigned long long GLuint64EXT;\n#else\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\n#include <inttypes.h>\n#  endif\ntypedef int64_t GLint64EXT;\ntypedef uint64_t GLuint64EXT;\n#endif\ntypedef GLint64EXT  GLint64;\ntypedef GLuint64EXT GLuint64;\ntypedef struct __GLsync *GLsync;\n\ntypedef char GLchar;\n\n#define GL_ZERO 0\n#define GL_FALSE 0\n#define GL_LOGIC_OP 0x0BF1\n#define GL_NONE 0\n#define GL_TEXTURE_COMPONENTS 0x1003\n#define GL_NO_ERROR 0\n#define GL_POINTS 0x0000\n#define GL_CURRENT_BIT 0x00000001\n#define GL_TRUE 1\n#define GL_ONE 1\n#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001\n#define GL_LINES 0x0001\n#define GL_LINE_LOOP 0x0002\n#define GL_POINT_BIT 0x00000002\n#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002\n#define GL_LINE_STRIP 0x0003\n#define GL_LINE_BIT 0x00000004\n#define GL_TRIANGLES 0x0004\n#define GL_TRIANGLE_STRIP 0x0005\n#define GL_TRIANGLE_FAN 0x0006\n#define GL_QUADS 0x0007\n#define GL_QUAD_STRIP 0x0008\n#define GL_POLYGON_BIT 0x00000008\n#define GL_POLYGON 0x0009\n#define GL_POLYGON_STIPPLE_BIT 0x00000010\n#define GL_PIXEL_MODE_BIT 0x00000020\n#define GL_LIGHTING_BIT 0x00000040\n#define GL_FOG_BIT 0x00000080\n#define GL_DEPTH_BUFFER_BIT 0x00000100\n#define GL_ACCUM 0x0100\n#define GL_LOAD 0x0101\n#define GL_RETURN 0x0102\n#define GL_MULT 0x0103\n#define GL_ADD 0x0104\n#define GL_NEVER 0x0200\n#define GL_ACCUM_BUFFER_BIT 0x00000200\n#define GL_LESS 0x0201\n#define GL_EQUAL 0x0202\n#define GL_LEQUAL 0x0203\n#define GL_GREATER 0x0204\n#define GL_NOTEQUAL 0x0205\n#define GL_GEQUAL 0x0206\n#define GL_ALWAYS 0x0207\n#define GL_SRC_COLOR 0x0300\n#define GL_ONE_MINUS_SRC_COLOR 0x0301\n#define GL_SRC_ALPHA 0x0302\n#define GL_ONE_MINUS_SRC_ALPHA 0x0303\n#define GL_DST_ALPHA 0x0304\n#define GL_ONE_MINUS_DST_ALPHA 0x0305\n#define GL_DST_COLOR 0x0306\n#define GL_ONE_MINUS_DST_COLOR 0x0307\n#define GL_SRC_ALPHA_SATURATE 0x0308\n#define GL_STENCIL_BUFFER_BIT 0x00000400\n#define GL_FRONT_LEFT 0x0400\n#define GL_FRONT_RIGHT 0x0401\n#define GL_BACK_LEFT 0x0402\n#define GL_BACK_RIGHT 0x0403\n#define GL_FRONT 0x0404\n#define GL_BACK 0x0405\n#define GL_LEFT 0x0406\n#define GL_RIGHT 0x0407\n#define GL_FRONT_AND_BACK 0x0408\n#define GL_AUX0 0x0409\n#define GL_AUX1 0x040A\n#define GL_AUX2 0x040B\n#define GL_AUX3 0x040C\n#define GL_INVALID_ENUM 0x0500\n#define GL_INVALID_VALUE 0x0501\n#define GL_INVALID_OPERATION 0x0502\n#define GL_STACK_OVERFLOW 0x0503\n#define GL_STACK_UNDERFLOW 0x0504\n#define GL_OUT_OF_MEMORY 0x0505\n#define GL_2D 0x0600\n#define GL_3D 0x0601\n#define GL_3D_COLOR 0x0602\n#define GL_3D_COLOR_TEXTURE 0x0603\n#define GL_4D_COLOR_TEXTURE 0x0604\n#define GL_PASS_THROUGH_TOKEN 0x0700\n#define GL_POINT_TOKEN 0x0701\n#define GL_LINE_TOKEN 0x0702\n#define GL_POLYGON_TOKEN 0x0703\n#define GL_BITMAP_TOKEN 0x0704\n#define GL_DRAW_PIXEL_TOKEN 0x0705\n#define GL_COPY_PIXEL_TOKEN 0x0706\n#define GL_LINE_RESET_TOKEN 0x0707\n#define GL_EXP 0x0800\n#define GL_VIEWPORT_BIT 0x00000800\n#define GL_EXP2 0x0801\n#define GL_CW 0x0900\n#define GL_CCW 0x0901\n#define GL_COEFF 0x0A00\n#define GL_ORDER 0x0A01\n#define GL_DOMAIN 0x0A02\n#define GL_CURRENT_COLOR 0x0B00\n#define GL_CURRENT_INDEX 0x0B01\n#define GL_CURRENT_NORMAL 0x0B02\n#define GL_CURRENT_TEXTURE_COORDS 0x0B03\n#define GL_CURRENT_RASTER_COLOR 0x0B04\n#define GL_CURRENT_RASTER_INDEX 0x0B05\n#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06\n#define GL_CURRENT_RASTER_POSITION 0x0B07\n#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08\n#define GL_CURRENT_RASTER_DISTANCE 0x0B09\n#define GL_POINT_SMOOTH 0x0B10\n#define GL_POINT_SIZE 0x0B11\n#define GL_POINT_SIZE_RANGE 0x0B12\n#define GL_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_LINE_SMOOTH 0x0B20\n#define GL_LINE_WIDTH 0x0B21\n#define GL_LINE_WIDTH_RANGE 0x0B22\n#define GL_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_LINE_STIPPLE 0x0B24\n#define GL_LINE_STIPPLE_PATTERN 0x0B25\n#define GL_LINE_STIPPLE_REPEAT 0x0B26\n#define GL_LIST_MODE 0x0B30\n#define GL_MAX_LIST_NESTING 0x0B31\n#define GL_LIST_BASE 0x0B32\n#define GL_LIST_INDEX 0x0B33\n#define GL_POLYGON_MODE 0x0B40\n#define GL_POLYGON_SMOOTH 0x0B41\n#define GL_POLYGON_STIPPLE 0x0B42\n#define GL_EDGE_FLAG 0x0B43\n#define GL_CULL_FACE 0x0B44\n#define GL_CULL_FACE_MODE 0x0B45\n#define GL_FRONT_FACE 0x0B46\n#define GL_LIGHTING 0x0B50\n#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51\n#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52\n#define GL_LIGHT_MODEL_AMBIENT 0x0B53\n#define GL_SHADE_MODEL 0x0B54\n#define GL_COLOR_MATERIAL_FACE 0x0B55\n#define GL_COLOR_MATERIAL_PARAMETER 0x0B56\n#define GL_COLOR_MATERIAL 0x0B57\n#define GL_FOG 0x0B60\n#define GL_FOG_INDEX 0x0B61\n#define GL_FOG_DENSITY 0x0B62\n#define GL_FOG_START 0x0B63\n#define GL_FOG_END 0x0B64\n#define GL_FOG_MODE 0x0B65\n#define GL_FOG_COLOR 0x0B66\n#define GL_DEPTH_RANGE 0x0B70\n#define GL_DEPTH_TEST 0x0B71\n#define GL_DEPTH_WRITEMASK 0x0B72\n#define GL_DEPTH_CLEAR_VALUE 0x0B73\n#define GL_DEPTH_FUNC 0x0B74\n#define GL_ACCUM_CLEAR_VALUE 0x0B80\n#define GL_STENCIL_TEST 0x0B90\n#define GL_STENCIL_CLEAR_VALUE 0x0B91\n#define GL_STENCIL_FUNC 0x0B92\n#define GL_STENCIL_VALUE_MASK 0x0B93\n#define GL_STENCIL_FAIL 0x0B94\n#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95\n#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96\n#define GL_STENCIL_REF 0x0B97\n#define GL_STENCIL_WRITEMASK 0x0B98\n#define GL_MATRIX_MODE 0x0BA0\n#define GL_NORMALIZE 0x0BA1\n#define GL_VIEWPORT 0x0BA2\n#define GL_MODELVIEW_STACK_DEPTH 0x0BA3\n#define GL_PROJECTION_STACK_DEPTH 0x0BA4\n#define GL_TEXTURE_STACK_DEPTH 0x0BA5\n#define GL_MODELVIEW_MATRIX 0x0BA6\n#define GL_PROJECTION_MATRIX 0x0BA7\n#define GL_TEXTURE_MATRIX 0x0BA8\n#define GL_ATTRIB_STACK_DEPTH 0x0BB0\n#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1\n#define GL_ALPHA_TEST 0x0BC0\n#define GL_ALPHA_TEST_FUNC 0x0BC1\n#define GL_ALPHA_TEST_REF 0x0BC2\n#define GL_DITHER 0x0BD0\n#define GL_BLEND_DST 0x0BE0\n#define GL_BLEND_SRC 0x0BE1\n#define GL_BLEND 0x0BE2\n#define GL_LOGIC_OP_MODE 0x0BF0\n#define GL_INDEX_LOGIC_OP 0x0BF1\n#define GL_COLOR_LOGIC_OP 0x0BF2\n#define GL_AUX_BUFFERS 0x0C00\n#define GL_DRAW_BUFFER 0x0C01\n#define GL_READ_BUFFER 0x0C02\n#define GL_SCISSOR_BOX 0x0C10\n#define GL_SCISSOR_TEST 0x0C11\n#define GL_INDEX_CLEAR_VALUE 0x0C20\n#define GL_INDEX_WRITEMASK 0x0C21\n#define GL_COLOR_CLEAR_VALUE 0x0C22\n#define GL_COLOR_WRITEMASK 0x0C23\n#define GL_INDEX_MODE 0x0C30\n#define GL_RGBA_MODE 0x0C31\n#define GL_DOUBLEBUFFER 0x0C32\n#define GL_STEREO 0x0C33\n#define GL_RENDER_MODE 0x0C40\n#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50\n#define GL_POINT_SMOOTH_HINT 0x0C51\n#define GL_LINE_SMOOTH_HINT 0x0C52\n#define GL_POLYGON_SMOOTH_HINT 0x0C53\n#define GL_FOG_HINT 0x0C54\n#define GL_TEXTURE_GEN_S 0x0C60\n#define GL_TEXTURE_GEN_T 0x0C61\n#define GL_TEXTURE_GEN_R 0x0C62\n#define GL_TEXTURE_GEN_Q 0x0C63\n#define GL_PIXEL_MAP_I_TO_I 0x0C70\n#define GL_PIXEL_MAP_S_TO_S 0x0C71\n#define GL_PIXEL_MAP_I_TO_R 0x0C72\n#define GL_PIXEL_MAP_I_TO_G 0x0C73\n#define GL_PIXEL_MAP_I_TO_B 0x0C74\n#define GL_PIXEL_MAP_I_TO_A 0x0C75\n#define GL_PIXEL_MAP_R_TO_R 0x0C76\n#define GL_PIXEL_MAP_G_TO_G 0x0C77\n#define GL_PIXEL_MAP_B_TO_B 0x0C78\n#define GL_PIXEL_MAP_A_TO_A 0x0C79\n#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0\n#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1\n#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2\n#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3\n#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4\n#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5\n#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6\n#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7\n#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8\n#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9\n#define GL_UNPACK_SWAP_BYTES 0x0CF0\n#define GL_UNPACK_LSB_FIRST 0x0CF1\n#define GL_UNPACK_ROW_LENGTH 0x0CF2\n#define GL_UNPACK_SKIP_ROWS 0x0CF3\n#define GL_UNPACK_SKIP_PIXELS 0x0CF4\n#define GL_UNPACK_ALIGNMENT 0x0CF5\n#define GL_PACK_SWAP_BYTES 0x0D00\n#define GL_PACK_LSB_FIRST 0x0D01\n#define GL_PACK_ROW_LENGTH 0x0D02\n#define GL_PACK_SKIP_ROWS 0x0D03\n#define GL_PACK_SKIP_PIXELS 0x0D04\n#define GL_PACK_ALIGNMENT 0x0D05\n#define GL_MAP_COLOR 0x0D10\n#define GL_MAP_STENCIL 0x0D11\n#define GL_INDEX_SHIFT 0x0D12\n#define GL_INDEX_OFFSET 0x0D13\n#define GL_RED_SCALE 0x0D14\n#define GL_RED_BIAS 0x0D15\n#define GL_ZOOM_X 0x0D16\n#define GL_ZOOM_Y 0x0D17\n#define GL_GREEN_SCALE 0x0D18\n#define GL_GREEN_BIAS 0x0D19\n#define GL_BLUE_SCALE 0x0D1A\n#define GL_BLUE_BIAS 0x0D1B\n#define GL_ALPHA_SCALE 0x0D1C\n#define GL_ALPHA_BIAS 0x0D1D\n#define GL_DEPTH_SCALE 0x0D1E\n#define GL_DEPTH_BIAS 0x0D1F\n#define GL_MAX_EVAL_ORDER 0x0D30\n#define GL_MAX_LIGHTS 0x0D31\n#define GL_MAX_CLIP_PLANES 0x0D32\n#define GL_MAX_TEXTURE_SIZE 0x0D33\n#define GL_MAX_PIXEL_MAP_TABLE 0x0D34\n#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35\n#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36\n#define GL_MAX_NAME_STACK_DEPTH 0x0D37\n#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38\n#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39\n#define GL_MAX_VIEWPORT_DIMS 0x0D3A\n#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B\n#define GL_SUBPIXEL_BITS 0x0D50\n#define GL_INDEX_BITS 0x0D51\n#define GL_RED_BITS 0x0D52\n#define GL_GREEN_BITS 0x0D53\n#define GL_BLUE_BITS 0x0D54\n#define GL_ALPHA_BITS 0x0D55\n#define GL_DEPTH_BITS 0x0D56\n#define GL_STENCIL_BITS 0x0D57\n#define GL_ACCUM_RED_BITS 0x0D58\n#define GL_ACCUM_GREEN_BITS 0x0D59\n#define GL_ACCUM_BLUE_BITS 0x0D5A\n#define GL_ACCUM_ALPHA_BITS 0x0D5B\n#define GL_NAME_STACK_DEPTH 0x0D70\n#define GL_AUTO_NORMAL 0x0D80\n#define GL_MAP1_COLOR_4 0x0D90\n#define GL_MAP1_INDEX 0x0D91\n#define GL_MAP1_NORMAL 0x0D92\n#define GL_MAP1_TEXTURE_COORD_1 0x0D93\n#define GL_MAP1_TEXTURE_COORD_2 0x0D94\n#define GL_MAP1_TEXTURE_COORD_3 0x0D95\n#define GL_MAP1_TEXTURE_COORD_4 0x0D96\n#define GL_MAP1_VERTEX_3 0x0D97\n#define GL_MAP1_VERTEX_4 0x0D98\n#define GL_MAP2_COLOR_4 0x0DB0\n#define GL_MAP2_INDEX 0x0DB1\n#define GL_MAP2_NORMAL 0x0DB2\n#define GL_MAP2_TEXTURE_COORD_1 0x0DB3\n#define GL_MAP2_TEXTURE_COORD_2 0x0DB4\n#define GL_MAP2_TEXTURE_COORD_3 0x0DB5\n#define GL_MAP2_TEXTURE_COORD_4 0x0DB6\n#define GL_MAP2_VERTEX_3 0x0DB7\n#define GL_MAP2_VERTEX_4 0x0DB8\n#define GL_MAP1_GRID_DOMAIN 0x0DD0\n#define GL_MAP1_GRID_SEGMENTS 0x0DD1\n#define GL_MAP2_GRID_DOMAIN 0x0DD2\n#define GL_MAP2_GRID_SEGMENTS 0x0DD3\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0\n#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1\n#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2\n#define GL_SELECTION_BUFFER_POINTER 0x0DF3\n#define GL_SELECTION_BUFFER_SIZE 0x0DF4\n#define GL_TEXTURE_WIDTH 0x1000\n#define GL_TRANSFORM_BIT 0x00001000\n#define GL_TEXTURE_HEIGHT 0x1001\n#define GL_TEXTURE_INTERNAL_FORMAT 0x1003\n#define GL_TEXTURE_BORDER_COLOR 0x1004\n#define GL_TEXTURE_BORDER 0x1005\n#define GL_DONT_CARE 0x1100\n#define GL_FASTEST 0x1101\n#define GL_NICEST 0x1102\n#define GL_AMBIENT 0x1200\n#define GL_DIFFUSE 0x1201\n#define GL_SPECULAR 0x1202\n#define GL_POSITION 0x1203\n#define GL_SPOT_DIRECTION 0x1204\n#define GL_SPOT_EXPONENT 0x1205\n#define GL_SPOT_CUTOFF 0x1206\n#define GL_CONSTANT_ATTENUATION 0x1207\n#define GL_LINEAR_ATTENUATION 0x1208\n#define GL_QUADRATIC_ATTENUATION 0x1209\n#define GL_COMPILE 0x1300\n#define GL_COMPILE_AND_EXECUTE 0x1301\n#define GL_BYTE 0x1400\n#define GL_UNSIGNED_BYTE 0x1401\n#define GL_SHORT 0x1402\n#define GL_UNSIGNED_SHORT 0x1403\n#define GL_INT 0x1404\n#define GL_UNSIGNED_INT 0x1405\n#define GL_FLOAT 0x1406\n#define GL_2_BYTES 0x1407\n#define GL_3_BYTES 0x1408\n#define GL_4_BYTES 0x1409\n#define GL_DOUBLE 0x140A\n#define GL_CLEAR 0x1500\n#define GL_AND 0x1501\n#define GL_AND_REVERSE 0x1502\n#define GL_COPY 0x1503\n#define GL_AND_INVERTED 0x1504\n#define GL_NOOP 0x1505\n#define GL_XOR 0x1506\n#define GL_OR 0x1507\n#define GL_NOR 0x1508\n#define GL_EQUIV 0x1509\n#define GL_INVERT 0x150A\n#define GL_OR_REVERSE 0x150B\n#define GL_COPY_INVERTED 0x150C\n#define GL_OR_INVERTED 0x150D\n#define GL_NAND 0x150E\n#define GL_SET 0x150F\n#define GL_EMISSION 0x1600\n#define GL_SHININESS 0x1601\n#define GL_AMBIENT_AND_DIFFUSE 0x1602\n#define GL_COLOR_INDEXES 0x1603\n#define GL_MODELVIEW 0x1700\n#define GL_PROJECTION 0x1701\n#define GL_TEXTURE 0x1702\n#define GL_COLOR 0x1800\n#define GL_DEPTH 0x1801\n#define GL_STENCIL 0x1802\n#define GL_COLOR_INDEX 0x1900\n#define GL_STENCIL_INDEX 0x1901\n#define GL_DEPTH_COMPONENT 0x1902\n#define GL_RED 0x1903\n#define GL_GREEN 0x1904\n#define GL_BLUE 0x1905\n#define GL_ALPHA 0x1906\n#define GL_RGB 0x1907\n#define GL_RGBA 0x1908\n#define GL_LUMINANCE 0x1909\n#define GL_LUMINANCE_ALPHA 0x190A\n#define GL_BITMAP 0x1A00\n#define GL_POINT 0x1B00\n#define GL_LINE 0x1B01\n#define GL_FILL 0x1B02\n#define GL_RENDER 0x1C00\n#define GL_FEEDBACK 0x1C01\n#define GL_SELECT 0x1C02\n#define GL_FLAT 0x1D00\n#define GL_SMOOTH 0x1D01\n#define GL_KEEP 0x1E00\n#define GL_REPLACE 0x1E01\n#define GL_INCR 0x1E02\n#define GL_DECR 0x1E03\n#define GL_VENDOR 0x1F00\n#define GL_RENDERER 0x1F01\n#define GL_VERSION 0x1F02\n#define GL_EXTENSIONS 0x1F03\n#define GL_S 0x2000\n#define GL_ENABLE_BIT 0x00002000\n#define GL_T 0x2001\n#define GL_R 0x2002\n#define GL_Q 0x2003\n#define GL_MODULATE 0x2100\n#define GL_DECAL 0x2101\n#define GL_TEXTURE_ENV_MODE 0x2200\n#define GL_TEXTURE_ENV_COLOR 0x2201\n#define GL_TEXTURE_ENV 0x2300\n#define GL_EYE_LINEAR 0x2400\n#define GL_OBJECT_LINEAR 0x2401\n#define GL_SPHERE_MAP 0x2402\n#define GL_TEXTURE_GEN_MODE 0x2500\n#define GL_OBJECT_PLANE 0x2501\n#define GL_EYE_PLANE 0x2502\n#define GL_NEAREST 0x2600\n#define GL_LINEAR 0x2601\n#define GL_NEAREST_MIPMAP_NEAREST 0x2700\n#define GL_LINEAR_MIPMAP_NEAREST 0x2701\n#define GL_NEAREST_MIPMAP_LINEAR 0x2702\n#define GL_LINEAR_MIPMAP_LINEAR 0x2703\n#define GL_TEXTURE_MAG_FILTER 0x2800\n#define GL_TEXTURE_MIN_FILTER 0x2801\n#define GL_TEXTURE_WRAP_S 0x2802\n#define GL_TEXTURE_WRAP_T 0x2803\n#define GL_CLAMP 0x2900\n#define GL_REPEAT 0x2901\n#define GL_POLYGON_OFFSET_UNITS 0x2A00\n#define GL_POLYGON_OFFSET_POINT 0x2A01\n#define GL_POLYGON_OFFSET_LINE 0x2A02\n#define GL_R3_G3_B2 0x2A10\n#define GL_V2F 0x2A20\n#define GL_V3F 0x2A21\n#define GL_C4UB_V2F 0x2A22\n#define GL_C4UB_V3F 0x2A23\n#define GL_C3F_V3F 0x2A24\n#define GL_N3F_V3F 0x2A25\n#define GL_C4F_N3F_V3F 0x2A26\n#define GL_T2F_V3F 0x2A27\n#define GL_T4F_V4F 0x2A28\n#define GL_T2F_C4UB_V3F 0x2A29\n#define GL_T2F_C3F_V3F 0x2A2A\n#define GL_T2F_N3F_V3F 0x2A2B\n#define GL_T2F_C4F_N3F_V3F 0x2A2C\n#define GL_T4F_C4F_N3F_V4F 0x2A2D\n#define GL_CLIP_PLANE0 0x3000\n#define GL_CLIP_PLANE1 0x3001\n#define GL_CLIP_PLANE2 0x3002\n#define GL_CLIP_PLANE3 0x3003\n#define GL_CLIP_PLANE4 0x3004\n#define GL_CLIP_PLANE5 0x3005\n#define GL_LIGHT0 0x4000\n#define GL_COLOR_BUFFER_BIT 0x00004000\n#define GL_LIGHT1 0x4001\n#define GL_LIGHT2 0x4002\n#define GL_LIGHT3 0x4003\n#define GL_LIGHT4 0x4004\n#define GL_LIGHT5 0x4005\n#define GL_LIGHT6 0x4006\n#define GL_LIGHT7 0x4007\n#define GL_HINT_BIT 0x00008000\n#define GL_POLYGON_OFFSET_FILL 0x8037\n#define GL_POLYGON_OFFSET_FACTOR 0x8038\n#define GL_ALPHA4 0x803B\n#define GL_ALPHA8 0x803C\n#define GL_ALPHA12 0x803D\n#define GL_ALPHA16 0x803E\n#define GL_LUMINANCE4 0x803F\n#define GL_LUMINANCE8 0x8040\n#define GL_LUMINANCE12 0x8041\n#define GL_LUMINANCE16 0x8042\n#define GL_LUMINANCE4_ALPHA4 0x8043\n#define GL_LUMINANCE6_ALPHA2 0x8044\n#define GL_LUMINANCE8_ALPHA8 0x8045\n#define GL_LUMINANCE12_ALPHA4 0x8046\n#define GL_LUMINANCE12_ALPHA12 0x8047\n#define GL_LUMINANCE16_ALPHA16 0x8048\n#define GL_INTENSITY 0x8049\n#define GL_INTENSITY4 0x804A\n#define GL_INTENSITY8 0x804B\n#define GL_INTENSITY12 0x804C\n#define GL_INTENSITY16 0x804D\n#define GL_RGB4 0x804F\n#define GL_RGB5 0x8050\n#define GL_RGB8 0x8051\n#define GL_RGB10 0x8052\n#define GL_RGB12 0x8053\n#define GL_RGB16 0x8054\n#define GL_RGBA2 0x8055\n#define GL_RGBA4 0x8056\n#define GL_RGB5_A1 0x8057\n#define GL_RGBA8 0x8058\n#define GL_RGB10_A2 0x8059\n#define GL_RGBA12 0x805A\n#define GL_RGBA16 0x805B\n#define GL_TEXTURE_RED_SIZE 0x805C\n#define GL_TEXTURE_GREEN_SIZE 0x805D\n#define GL_TEXTURE_BLUE_SIZE 0x805E\n#define GL_TEXTURE_ALPHA_SIZE 0x805F\n#define GL_TEXTURE_LUMINANCE_SIZE 0x8060\n#define GL_TEXTURE_INTENSITY_SIZE 0x8061\n#define GL_PROXY_TEXTURE_1D 0x8063\n#define GL_PROXY_TEXTURE_2D 0x8064\n#define GL_TEXTURE_PRIORITY 0x8066\n#define GL_TEXTURE_RESIDENT 0x8067\n#define GL_TEXTURE_BINDING_1D 0x8068\n#define GL_TEXTURE_BINDING_2D 0x8069\n#define GL_VERTEX_ARRAY 0x8074\n#define GL_NORMAL_ARRAY 0x8075\n#define GL_COLOR_ARRAY 0x8076\n#define GL_INDEX_ARRAY 0x8077\n#define GL_TEXTURE_COORD_ARRAY 0x8078\n#define GL_EDGE_FLAG_ARRAY 0x8079\n#define GL_VERTEX_ARRAY_SIZE 0x807A\n#define GL_VERTEX_ARRAY_TYPE 0x807B\n#define GL_VERTEX_ARRAY_STRIDE 0x807C\n#define GL_NORMAL_ARRAY_TYPE 0x807E\n#define GL_NORMAL_ARRAY_STRIDE 0x807F\n#define GL_COLOR_ARRAY_SIZE 0x8081\n#define GL_COLOR_ARRAY_TYPE 0x8082\n#define GL_COLOR_ARRAY_STRIDE 0x8083\n#define GL_INDEX_ARRAY_TYPE 0x8085\n#define GL_INDEX_ARRAY_STRIDE 0x8086\n#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088\n#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089\n#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A\n#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C\n#define GL_VERTEX_ARRAY_POINTER 0x808E\n#define GL_NORMAL_ARRAY_POINTER 0x808F\n#define GL_COLOR_ARRAY_POINTER 0x8090\n#define GL_INDEX_ARRAY_POINTER 0x8091\n#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092\n#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093\n#define GL_COLOR_INDEX1_EXT 0x80E2\n#define GL_COLOR_INDEX2_EXT 0x80E3\n#define GL_COLOR_INDEX4_EXT 0x80E4\n#define GL_COLOR_INDEX8_EXT 0x80E5\n#define GL_COLOR_INDEX12_EXT 0x80E6\n#define GL_COLOR_INDEX16_EXT 0x80E7\n#define GL_EVAL_BIT 0x00010000\n#define GL_LIST_BIT 0x00020000\n#define GL_TEXTURE_BIT 0x00040000\n#define GL_SCISSOR_BIT 0x00080000\n#define GL_ALL_ATTRIB_BITS 0x000fffff\n#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff\n\nGLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value);\nGLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref);\nGLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);\nGLAPI void GLAPIENTRY glArrayElement (GLint i);\nGLAPI void GLAPIENTRY glBegin (GLenum mode);\nGLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture);\nGLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);\nGLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);\nGLAPI void GLAPIENTRY glCallList (GLuint list);\nGLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists);\nGLAPI void GLAPIENTRY glClear (GLbitfield mask);\nGLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\nGLAPI void GLAPIENTRY glClearDepth (GLclampd depth);\nGLAPI void GLAPIENTRY glClearIndex (GLfloat c);\nGLAPI void GLAPIENTRY glClearStencil (GLint s);\nGLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation);\nGLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue);\nGLAPI void GLAPIENTRY glColor3bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue);\nGLAPI void GLAPIENTRY glColor3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue);\nGLAPI void GLAPIENTRY glColor3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue);\nGLAPI void GLAPIENTRY glColor3iv (const GLint *v);\nGLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue);\nGLAPI void GLAPIENTRY glColor3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue);\nGLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v);\nGLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue);\nGLAPI void GLAPIENTRY glColor3uiv (const GLuint *v);\nGLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue);\nGLAPI void GLAPIENTRY glColor3usv (const GLushort *v);\nGLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);\nGLAPI void GLAPIENTRY glColor4bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);\nGLAPI void GLAPIENTRY glColor4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI void GLAPIENTRY glColor4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha);\nGLAPI void GLAPIENTRY glColor4iv (const GLint *v);\nGLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);\nGLAPI void GLAPIENTRY glColor4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\nGLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v);\nGLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);\nGLAPI void GLAPIENTRY glColor4uiv (const GLuint *v);\nGLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);\nGLAPI void GLAPIENTRY glColor4usv (const GLushort *v);\nGLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\nGLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode);\nGLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);\nGLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);\nGLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\nGLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\nGLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI void GLAPIENTRY glCullFace (GLenum mode);\nGLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range);\nGLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);\nGLAPI void GLAPIENTRY glDepthFunc (GLenum func);\nGLAPI void GLAPIENTRY glDepthMask (GLboolean flag);\nGLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar);\nGLAPI void GLAPIENTRY glDisable (GLenum cap);\nGLAPI void GLAPIENTRY glDisableClientState (GLenum array);\nGLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);\nGLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);\nGLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);\nGLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag);\nGLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag);\nGLAPI void GLAPIENTRY glEnable (GLenum cap);\nGLAPI void GLAPIENTRY glEnableClientState (GLenum array);\nGLAPI void GLAPIENTRY glEnd (void);\nGLAPI void GLAPIENTRY glEndList (void);\nGLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u);\nGLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u);\nGLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u);\nGLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u);\nGLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v);\nGLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u);\nGLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v);\nGLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u);\nGLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2);\nGLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);\nGLAPI void GLAPIENTRY glEvalPoint1 (GLint i);\nGLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j);\nGLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);\nGLAPI void GLAPIENTRY glFinish (void);\nGLAPI void GLAPIENTRY glFlush (void);\nGLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glFrontFace (GLenum mode);\nGLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\nGLAPI GLuint GLAPIENTRY glGenLists (GLsizei range);\nGLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures);\nGLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params);\nGLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation);\nGLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params);\nGLAPI GLenum GLAPIENTRY glGetError (void);\nGLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v);\nGLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v);\nGLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v);\nGLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values);\nGLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values);\nGLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values);\nGLAPI void GLAPIENTRY glGetPointerv (GLenum pname, GLvoid* *params);\nGLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask);\nGLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name);\nGLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);\nGLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\nGLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode);\nGLAPI void GLAPIENTRY glIndexMask (GLuint mask);\nGLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glIndexd (GLdouble c);\nGLAPI void GLAPIENTRY glIndexdv (const GLdouble *c);\nGLAPI void GLAPIENTRY glIndexf (GLfloat c);\nGLAPI void GLAPIENTRY glIndexfv (const GLfloat *c);\nGLAPI void GLAPIENTRY glIndexi (GLint c);\nGLAPI void GLAPIENTRY glIndexiv (const GLint *c);\nGLAPI void GLAPIENTRY glIndexs (GLshort c);\nGLAPI void GLAPIENTRY glIndexsv (const GLshort *c);\nGLAPI void GLAPIENTRY glIndexub (GLubyte c);\nGLAPI void GLAPIENTRY glIndexubv (const GLubyte *c);\nGLAPI void GLAPIENTRY glInitNames (void);\nGLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer);\nGLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap);\nGLAPI GLboolean GLAPIENTRY glIsList (GLuint list);\nGLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture);\nGLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern);\nGLAPI void GLAPIENTRY glLineWidth (GLfloat width);\nGLAPI void GLAPIENTRY glListBase (GLuint base);\nGLAPI void GLAPIENTRY glLoadIdentity (void);\nGLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m);\nGLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m);\nGLAPI void GLAPIENTRY glLoadName (GLuint name);\nGLAPI void GLAPIENTRY glLogicOp (GLenum opcode);\nGLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);\nGLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);\nGLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);\nGLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);\nGLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);\nGLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);\nGLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);\nGLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);\nGLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glMatrixMode (GLenum mode);\nGLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m);\nGLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m);\nGLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode);\nGLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);\nGLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);\nGLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);\nGLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz);\nGLAPI void GLAPIENTRY glNormal3iv (const GLint *v);\nGLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz);\nGLAPI void GLAPIENTRY glNormal3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\nGLAPI void GLAPIENTRY glPassThrough (GLfloat token);\nGLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values);\nGLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values);\nGLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values);\nGLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor);\nGLAPI void GLAPIENTRY glPointSize (GLfloat size);\nGLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode);\nGLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units);\nGLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask);\nGLAPI void GLAPIENTRY glPopAttrib (void);\nGLAPI void GLAPIENTRY glPopClientAttrib (void);\nGLAPI void GLAPIENTRY glPopMatrix (void);\nGLAPI void GLAPIENTRY glPopName (void);\nGLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities);\nGLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask);\nGLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask);\nGLAPI void GLAPIENTRY glPushMatrix (void);\nGLAPI void GLAPIENTRY glPushName (GLuint name);\nGLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y);\nGLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y);\nGLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y);\nGLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y);\nGLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z);\nGLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z);\nGLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w);\nGLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glReadBuffer (GLenum mode);\nGLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);\nGLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);\nGLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2);\nGLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);\nGLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2);\nGLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2);\nGLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2);\nGLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);\nGLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2);\nGLAPI GLint GLAPIENTRY glRenderMode (GLenum mode);\nGLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer);\nGLAPI void GLAPIENTRY glShadeModel (GLenum mode);\nGLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);\nGLAPI void GLAPIENTRY glStencilMask (GLuint mask);\nGLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\nGLAPI void GLAPIENTRY glTexCoord1d (GLdouble s);\nGLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord1f (GLfloat s);\nGLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord1i (GLint s);\nGLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord1s (GLshort s);\nGLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t);\nGLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t);\nGLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t);\nGLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t);\nGLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);\nGLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);\nGLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r);\nGLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r);\nGLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);\nGLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);\nGLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q);\nGLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);\nGLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param);\nGLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params);\nGLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y);\nGLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y);\nGLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y);\nGLAPI void GLAPIENTRY glVertex2iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y);\nGLAPI void GLAPIENTRY glVertex2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z);\nGLAPI void GLAPIENTRY glVertex3iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z);\nGLAPI void GLAPIENTRY glVertex3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w);\nGLAPI void GLAPIENTRY glVertex4iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI void GLAPIENTRY glVertex4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);\n\n#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1)\n\n#endif /* GL_VERSION_1_1 */\n\n/* ---------------------------------- GLU ---------------------------------- */\n\n#ifndef GLEW_NO_GLU\n/* this is where we can safely include GLU */\n#  if defined(__APPLE__) && defined(__MACH__)\n#    include <OpenGL/glu.h>\n#  else\n#    include <GL/glu.h>\n#  endif\n#endif\n\n/* ----------------------------- GL_VERSION_1_2 ---------------------------- */\n\n#ifndef GL_VERSION_1_2\n#define GL_VERSION_1_2 1\n\n#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_UNSIGNED_BYTE_3_3_2 0x8032\n#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033\n#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034\n#define GL_UNSIGNED_INT_8_8_8_8 0x8035\n#define GL_UNSIGNED_INT_10_10_10_2 0x8036\n#define GL_RESCALE_NORMAL 0x803A\n#define GL_TEXTURE_BINDING_3D 0x806A\n#define GL_PACK_SKIP_IMAGES 0x806B\n#define GL_PACK_IMAGE_HEIGHT 0x806C\n#define GL_UNPACK_SKIP_IMAGES 0x806D\n#define GL_UNPACK_IMAGE_HEIGHT 0x806E\n#define GL_TEXTURE_3D 0x806F\n#define GL_PROXY_TEXTURE_3D 0x8070\n#define GL_TEXTURE_DEPTH 0x8071\n#define GL_TEXTURE_WRAP_R 0x8072\n#define GL_MAX_3D_TEXTURE_SIZE 0x8073\n#define GL_BGR 0x80E0\n#define GL_BGRA 0x80E1\n#define GL_MAX_ELEMENTS_VERTICES 0x80E8\n#define GL_MAX_ELEMENTS_INDICES 0x80E9\n#define GL_CLAMP_TO_EDGE 0x812F\n#define GL_TEXTURE_MIN_LOD 0x813A\n#define GL_TEXTURE_MAX_LOD 0x813B\n#define GL_TEXTURE_BASE_LEVEL 0x813C\n#define GL_TEXTURE_MAX_LEVEL 0x813D\n#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8\n#define GL_SINGLE_COLOR 0x81F9\n#define GL_SEPARATE_SPECULAR_COLOR 0x81FA\n#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362\n#define GL_UNSIGNED_SHORT_5_6_5 0x8363\n#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366\n#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\n#define GL_ALIASED_POINT_SIZE_RANGE 0x846D\n#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E\n\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\n\n#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D)\n#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements)\n#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D)\n#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D)\n\n#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2)\n\n#endif /* GL_VERSION_1_2 */\n\n/* ---------------------------- GL_VERSION_1_2_1 --------------------------- */\n\n#ifndef GL_VERSION_1_2_1\n#define GL_VERSION_1_2_1 1\n\n#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1)\n\n#endif /* GL_VERSION_1_2_1 */\n\n/* ----------------------------- GL_VERSION_1_3 ---------------------------- */\n\n#ifndef GL_VERSION_1_3\n#define GL_VERSION_1_3 1\n\n#define GL_MULTISAMPLE 0x809D\n#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE 0x809F\n#define GL_SAMPLE_COVERAGE 0x80A0\n#define GL_SAMPLE_BUFFERS 0x80A8\n#define GL_SAMPLES 0x80A9\n#define GL_SAMPLE_COVERAGE_VALUE 0x80AA\n#define GL_SAMPLE_COVERAGE_INVERT 0x80AB\n#define GL_CLAMP_TO_BORDER 0x812D\n#define GL_TEXTURE0 0x84C0\n#define GL_TEXTURE1 0x84C1\n#define GL_TEXTURE2 0x84C2\n#define GL_TEXTURE3 0x84C3\n#define GL_TEXTURE4 0x84C4\n#define GL_TEXTURE5 0x84C5\n#define GL_TEXTURE6 0x84C6\n#define GL_TEXTURE7 0x84C7\n#define GL_TEXTURE8 0x84C8\n#define GL_TEXTURE9 0x84C9\n#define GL_TEXTURE10 0x84CA\n#define GL_TEXTURE11 0x84CB\n#define GL_TEXTURE12 0x84CC\n#define GL_TEXTURE13 0x84CD\n#define GL_TEXTURE14 0x84CE\n#define GL_TEXTURE15 0x84CF\n#define GL_TEXTURE16 0x84D0\n#define GL_TEXTURE17 0x84D1\n#define GL_TEXTURE18 0x84D2\n#define GL_TEXTURE19 0x84D3\n#define GL_TEXTURE20 0x84D4\n#define GL_TEXTURE21 0x84D5\n#define GL_TEXTURE22 0x84D6\n#define GL_TEXTURE23 0x84D7\n#define GL_TEXTURE24 0x84D8\n#define GL_TEXTURE25 0x84D9\n#define GL_TEXTURE26 0x84DA\n#define GL_TEXTURE27 0x84DB\n#define GL_TEXTURE28 0x84DC\n#define GL_TEXTURE29 0x84DD\n#define GL_TEXTURE30 0x84DE\n#define GL_TEXTURE31 0x84DF\n#define GL_ACTIVE_TEXTURE 0x84E0\n#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1\n#define GL_MAX_TEXTURE_UNITS 0x84E2\n#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3\n#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4\n#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5\n#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6\n#define GL_SUBTRACT 0x84E7\n#define GL_COMPRESSED_ALPHA 0x84E9\n#define GL_COMPRESSED_LUMINANCE 0x84EA\n#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB\n#define GL_COMPRESSED_INTENSITY 0x84EC\n#define GL_COMPRESSED_RGB 0x84ED\n#define GL_COMPRESSED_RGBA 0x84EE\n#define GL_TEXTURE_COMPRESSION_HINT 0x84EF\n#define GL_NORMAL_MAP 0x8511\n#define GL_REFLECTION_MAP 0x8512\n#define GL_TEXTURE_CUBE_MAP 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C\n#define GL_COMBINE 0x8570\n#define GL_COMBINE_RGB 0x8571\n#define GL_COMBINE_ALPHA 0x8572\n#define GL_RGB_SCALE 0x8573\n#define GL_ADD_SIGNED 0x8574\n#define GL_INTERPOLATE 0x8575\n#define GL_CONSTANT 0x8576\n#define GL_PRIMARY_COLOR 0x8577\n#define GL_PREVIOUS 0x8578\n#define GL_SOURCE0_RGB 0x8580\n#define GL_SOURCE1_RGB 0x8581\n#define GL_SOURCE2_RGB 0x8582\n#define GL_SOURCE0_ALPHA 0x8588\n#define GL_SOURCE1_ALPHA 0x8589\n#define GL_SOURCE2_ALPHA 0x858A\n#define GL_OPERAND0_RGB 0x8590\n#define GL_OPERAND1_RGB 0x8591\n#define GL_OPERAND2_RGB 0x8592\n#define GL_OPERAND0_ALPHA 0x8598\n#define GL_OPERAND1_ALPHA 0x8599\n#define GL_OPERAND2_ALPHA 0x859A\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0\n#define GL_TEXTURE_COMPRESSED 0x86A1\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\n#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3\n#define GL_DOT3_RGB 0x86AE\n#define GL_DOT3_RGBA 0x86AF\n#define GL_MULTISAMPLE_BIT 0x20000000\n\ntypedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLvoid *img);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);\n\n#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture)\n#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture)\n#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D)\n#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D)\n#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D)\n#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D)\n#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D)\n#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D)\n#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage)\n#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd)\n#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf)\n#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd)\n#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf)\n#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d)\n#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv)\n#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f)\n#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv)\n#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i)\n#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv)\n#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s)\n#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv)\n#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d)\n#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv)\n#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f)\n#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv)\n#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i)\n#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv)\n#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s)\n#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv)\n#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d)\n#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv)\n#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f)\n#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv)\n#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i)\n#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv)\n#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s)\n#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv)\n#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d)\n#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv)\n#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f)\n#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv)\n#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i)\n#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv)\n#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s)\n#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv)\n#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage)\n\n#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3)\n\n#endif /* GL_VERSION_1_3 */\n\n/* ----------------------------- GL_VERSION_1_4 ---------------------------- */\n\n#ifndef GL_VERSION_1_4\n#define GL_VERSION_1_4 1\n\n#define GL_BLEND_DST_RGB 0x80C8\n#define GL_BLEND_SRC_RGB 0x80C9\n#define GL_BLEND_DST_ALPHA 0x80CA\n#define GL_BLEND_SRC_ALPHA 0x80CB\n#define GL_POINT_SIZE_MIN 0x8126\n#define GL_POINT_SIZE_MAX 0x8127\n#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128\n#define GL_POINT_DISTANCE_ATTENUATION 0x8129\n#define GL_GENERATE_MIPMAP 0x8191\n#define GL_GENERATE_MIPMAP_HINT 0x8192\n#define GL_DEPTH_COMPONENT16 0x81A5\n#define GL_DEPTH_COMPONENT24 0x81A6\n#define GL_DEPTH_COMPONENT32 0x81A7\n#define GL_MIRRORED_REPEAT 0x8370\n#define GL_FOG_COORDINATE_SOURCE 0x8450\n#define GL_FOG_COORDINATE 0x8451\n#define GL_FRAGMENT_DEPTH 0x8452\n#define GL_CURRENT_FOG_COORDINATE 0x8453\n#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454\n#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456\n#define GL_FOG_COORDINATE_ARRAY 0x8457\n#define GL_COLOR_SUM 0x8458\n#define GL_CURRENT_SECONDARY_COLOR 0x8459\n#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A\n#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C\n#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D\n#define GL_SECONDARY_COLOR_ARRAY 0x845E\n#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD\n#define GL_TEXTURE_FILTER_CONTROL 0x8500\n#define GL_TEXTURE_LOD_BIAS 0x8501\n#define GL_INCR_WRAP 0x8507\n#define GL_DECR_WRAP 0x8508\n#define GL_TEXTURE_DEPTH_SIZE 0x884A\n#define GL_DEPTH_TEXTURE_MODE 0x884B\n#define GL_TEXTURE_COMPARE_MODE 0x884C\n#define GL_TEXTURE_COMPARE_FUNC 0x884D\n#define GL_COMPARE_R_TO_TEXTURE 0x884E\n\ntypedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei drawcount);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p);\n\n#define glBlendColor GLEW_GET_FUN(__glewBlendColor)\n#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation)\n#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate)\n#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer)\n#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd)\n#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv)\n#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf)\n#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv)\n#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays)\n#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements)\n#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf)\n#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv)\n#define glPointParameteri GLEW_GET_FUN(__glewPointParameteri)\n#define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv)\n#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b)\n#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv)\n#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d)\n#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv)\n#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f)\n#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv)\n#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i)\n#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv)\n#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s)\n#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv)\n#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub)\n#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv)\n#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui)\n#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv)\n#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us)\n#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv)\n#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer)\n#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d)\n#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv)\n#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f)\n#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv)\n#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i)\n#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv)\n#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s)\n#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv)\n#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d)\n#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv)\n#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f)\n#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv)\n#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i)\n#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv)\n#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s)\n#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv)\n\n#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4)\n\n#endif /* GL_VERSION_1_4 */\n\n/* ----------------------------- GL_VERSION_1_5 ---------------------------- */\n\n#ifndef GL_VERSION_1_5\n#define GL_VERSION_1_5 1\n\n#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE\n#define GL_FOG_COORD GL_FOG_COORDINATE\n#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY\n#define GL_SRC0_RGB GL_SOURCE0_RGB\n#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER\n#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE\n#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA\n#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE\n#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE\n#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA\n#define GL_SRC1_RGB GL_SOURCE1_RGB\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\n#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA\n#define GL_SRC2_RGB GL_SOURCE2_RGB\n#define GL_BUFFER_SIZE 0x8764\n#define GL_BUFFER_USAGE 0x8765\n#define GL_QUERY_COUNTER_BITS 0x8864\n#define GL_CURRENT_QUERY 0x8865\n#define GL_QUERY_RESULT 0x8866\n#define GL_QUERY_RESULT_AVAILABLE 0x8867\n#define GL_ARRAY_BUFFER 0x8892\n#define GL_ELEMENT_ARRAY_BUFFER 0x8893\n#define GL_ARRAY_BUFFER_BINDING 0x8894\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895\n#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896\n#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897\n#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898\n#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\n#define GL_READ_ONLY 0x88B8\n#define GL_WRITE_ONLY 0x88B9\n#define GL_READ_WRITE 0x88BA\n#define GL_BUFFER_ACCESS 0x88BB\n#define GL_BUFFER_MAPPED 0x88BC\n#define GL_BUFFER_MAP_POINTER 0x88BD\n#define GL_STREAM_DRAW 0x88E0\n#define GL_STREAM_READ 0x88E1\n#define GL_STREAM_COPY 0x88E2\n#define GL_STATIC_DRAW 0x88E4\n#define GL_STATIC_READ 0x88E5\n#define GL_STATIC_COPY 0x88E6\n#define GL_DYNAMIC_DRAW 0x88E8\n#define GL_DYNAMIC_READ 0x88E9\n#define GL_DYNAMIC_COPY 0x88EA\n#define GL_SAMPLES_PASSED 0x8914\n\ntypedef ptrdiff_t GLintptr;\ntypedef ptrdiff_t GLsizeiptr;\n\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);\ntypedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid** params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer);\ntypedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id);\ntypedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target);\n\n#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery)\n#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer)\n#define glBufferData GLEW_GET_FUN(__glewBufferData)\n#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData)\n#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers)\n#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries)\n#define glEndQuery GLEW_GET_FUN(__glewEndQuery)\n#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers)\n#define glGenQueries GLEW_GET_FUN(__glewGenQueries)\n#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv)\n#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv)\n#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData)\n#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv)\n#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv)\n#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv)\n#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer)\n#define glIsQuery GLEW_GET_FUN(__glewIsQuery)\n#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer)\n#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer)\n\n#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5)\n\n#endif /* GL_VERSION_1_5 */\n\n/* ----------------------------- GL_VERSION_2_0 ---------------------------- */\n\n#ifndef GL_VERSION_2_0\n#define GL_VERSION_2_0 1\n\n#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625\n#define GL_CURRENT_VERTEX_ATTRIB 0x8626\n#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642\n#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645\n#define GL_STENCIL_BACK_FUNC 0x8800\n#define GL_STENCIL_BACK_FAIL 0x8801\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803\n#define GL_MAX_DRAW_BUFFERS 0x8824\n#define GL_DRAW_BUFFER0 0x8825\n#define GL_DRAW_BUFFER1 0x8826\n#define GL_DRAW_BUFFER2 0x8827\n#define GL_DRAW_BUFFER3 0x8828\n#define GL_DRAW_BUFFER4 0x8829\n#define GL_DRAW_BUFFER5 0x882A\n#define GL_DRAW_BUFFER6 0x882B\n#define GL_DRAW_BUFFER7 0x882C\n#define GL_DRAW_BUFFER8 0x882D\n#define GL_DRAW_BUFFER9 0x882E\n#define GL_DRAW_BUFFER10 0x882F\n#define GL_DRAW_BUFFER11 0x8830\n#define GL_DRAW_BUFFER12 0x8831\n#define GL_DRAW_BUFFER13 0x8832\n#define GL_DRAW_BUFFER14 0x8833\n#define GL_DRAW_BUFFER15 0x8834\n#define GL_BLEND_EQUATION_ALPHA 0x883D\n#define GL_POINT_SPRITE 0x8861\n#define GL_COORD_REPLACE 0x8862\n#define GL_MAX_VERTEX_ATTRIBS 0x8869\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\n#define GL_MAX_TEXTURE_COORDS 0x8871\n#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872\n#define GL_FRAGMENT_SHADER 0x8B30\n#define GL_VERTEX_SHADER 0x8B31\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A\n#define GL_MAX_VARYING_FLOATS 0x8B4B\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\n#define GL_SHADER_TYPE 0x8B4F\n#define GL_FLOAT_VEC2 0x8B50\n#define GL_FLOAT_VEC3 0x8B51\n#define GL_FLOAT_VEC4 0x8B52\n#define GL_INT_VEC2 0x8B53\n#define GL_INT_VEC3 0x8B54\n#define GL_INT_VEC4 0x8B55\n#define GL_BOOL 0x8B56\n#define GL_BOOL_VEC2 0x8B57\n#define GL_BOOL_VEC3 0x8B58\n#define GL_BOOL_VEC4 0x8B59\n#define GL_FLOAT_MAT2 0x8B5A\n#define GL_FLOAT_MAT3 0x8B5B\n#define GL_FLOAT_MAT4 0x8B5C\n#define GL_SAMPLER_1D 0x8B5D\n#define GL_SAMPLER_2D 0x8B5E\n#define GL_SAMPLER_3D 0x8B5F\n#define GL_SAMPLER_CUBE 0x8B60\n#define GL_SAMPLER_1D_SHADOW 0x8B61\n#define GL_SAMPLER_2D_SHADOW 0x8B62\n#define GL_DELETE_STATUS 0x8B80\n#define GL_COMPILE_STATUS 0x8B81\n#define GL_LINK_STATUS 0x8B82\n#define GL_VALIDATE_STATUS 0x8B83\n#define GL_INFO_LOG_LENGTH 0x8B84\n#define GL_ATTACHED_SHADERS 0x8B85\n#define GL_ACTIVE_UNIFORMS 0x8B86\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87\n#define GL_SHADER_SOURCE_LENGTH 0x8B88\n#define GL_ACTIVE_ATTRIBUTES 0x8B89\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\n#define GL_SHADING_LANGUAGE_VERSION 0x8B8C\n#define GL_CURRENT_PROGRAM 0x8B8D\n#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0\n#define GL_LOWER_LEFT 0x8CA1\n#define GL_UPPER_LEFT 0x8CA2\n#define GL_STENCIL_BACK_REF 0x8CA3\n#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4\n#define GL_STENCIL_BACK_WRITEMASK 0x8CA5\n\ntypedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum, GLenum);\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type);\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders);\ntypedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param);\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint, GLenum, GLvoid**);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint, GLenum, GLdouble*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint, GLenum, GLint*);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program);\ntypedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths);\ntypedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);\n\n#define glAttachShader GLEW_GET_FUN(__glewAttachShader)\n#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)\n#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)\n#define glCompileShader GLEW_GET_FUN(__glewCompileShader)\n#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram)\n#define glCreateShader GLEW_GET_FUN(__glewCreateShader)\n#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram)\n#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader)\n#define glDetachShader GLEW_GET_FUN(__glewDetachShader)\n#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray)\n#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers)\n#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray)\n#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib)\n#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform)\n#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders)\n#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation)\n#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog)\n#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv)\n#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog)\n#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource)\n#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv)\n#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation)\n#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv)\n#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv)\n#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv)\n#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv)\n#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv)\n#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv)\n#define glIsProgram GLEW_GET_FUN(__glewIsProgram)\n#define glIsShader GLEW_GET_FUN(__glewIsShader)\n#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram)\n#define glShaderSource GLEW_GET_FUN(__glewShaderSource)\n#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate)\n#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate)\n#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate)\n#define glUniform1f GLEW_GET_FUN(__glewUniform1f)\n#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv)\n#define glUniform1i GLEW_GET_FUN(__glewUniform1i)\n#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv)\n#define glUniform2f GLEW_GET_FUN(__glewUniform2f)\n#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv)\n#define glUniform2i GLEW_GET_FUN(__glewUniform2i)\n#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv)\n#define glUniform3f GLEW_GET_FUN(__glewUniform3f)\n#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv)\n#define glUniform3i GLEW_GET_FUN(__glewUniform3i)\n#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv)\n#define glUniform4f GLEW_GET_FUN(__glewUniform4f)\n#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv)\n#define glUniform4i GLEW_GET_FUN(__glewUniform4i)\n#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv)\n#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv)\n#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv)\n#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv)\n#define glUseProgram GLEW_GET_FUN(__glewUseProgram)\n#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram)\n#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d)\n#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv)\n#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f)\n#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv)\n#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s)\n#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv)\n#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d)\n#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv)\n#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f)\n#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv)\n#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s)\n#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv)\n#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d)\n#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv)\n#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f)\n#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv)\n#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s)\n#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv)\n#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv)\n#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv)\n#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv)\n#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub)\n#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv)\n#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv)\n#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv)\n#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv)\n#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d)\n#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv)\n#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f)\n#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv)\n#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv)\n#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s)\n#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv)\n#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv)\n#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)\n#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)\n#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)\n\n#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)\n\n#endif /* GL_VERSION_2_0 */\n\n/* ----------------------------- GL_VERSION_2_1 ---------------------------- */\n\n#ifndef GL_VERSION_2_1\n#define GL_VERSION_2_1 1\n\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\n#define GL_PIXEL_PACK_BUFFER 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF\n#define GL_FLOAT_MAT2x3 0x8B65\n#define GL_FLOAT_MAT2x4 0x8B66\n#define GL_FLOAT_MAT3x2 0x8B67\n#define GL_FLOAT_MAT3x4 0x8B68\n#define GL_FLOAT_MAT4x2 0x8B69\n#define GL_FLOAT_MAT4x3 0x8B6A\n#define GL_SRGB 0x8C40\n#define GL_SRGB8 0x8C41\n#define GL_SRGB_ALPHA 0x8C42\n#define GL_SRGB8_ALPHA8 0x8C43\n#define GL_SLUMINANCE_ALPHA 0x8C44\n#define GL_SLUMINANCE8_ALPHA8 0x8C45\n#define GL_SLUMINANCE 0x8C46\n#define GL_SLUMINANCE8 0x8C47\n#define GL_COMPRESSED_SRGB 0x8C48\n#define GL_COMPRESSED_SRGB_ALPHA 0x8C49\n#define GL_COMPRESSED_SLUMINANCE 0x8C4A\n#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B\n\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\n\n#define glUniformMatrix2x3fv GLEW_GET_FUN(__glewUniformMatrix2x3fv)\n#define glUniformMatrix2x4fv GLEW_GET_FUN(__glewUniformMatrix2x4fv)\n#define glUniformMatrix3x2fv GLEW_GET_FUN(__glewUniformMatrix3x2fv)\n#define glUniformMatrix3x4fv GLEW_GET_FUN(__glewUniformMatrix3x4fv)\n#define glUniformMatrix4x2fv GLEW_GET_FUN(__glewUniformMatrix4x2fv)\n#define glUniformMatrix4x3fv GLEW_GET_FUN(__glewUniformMatrix4x3fv)\n\n#define GLEW_VERSION_2_1 GLEW_GET_VAR(__GLEW_VERSION_2_1)\n\n#endif /* GL_VERSION_2_1 */\n\n/* ----------------------------- GL_VERSION_3_0 ---------------------------- */\n\n#ifndef GL_VERSION_3_0\n#define GL_VERSION_3_0 1\n\n#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES\n#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5\n#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1\n#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3\n#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB\n#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0\n#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4\n#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2\n#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS\n#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001\n#define GL_MAJOR_VERSION 0x821B\n#define GL_MINOR_VERSION 0x821C\n#define GL_NUM_EXTENSIONS 0x821D\n#define GL_CONTEXT_FLAGS 0x821E\n#define GL_DEPTH_BUFFER 0x8223\n#define GL_STENCIL_BUFFER 0x8224\n#define GL_COMPRESSED_RED 0x8225\n#define GL_COMPRESSED_RG 0x8226\n#define GL_RGBA32F 0x8814\n#define GL_RGB32F 0x8815\n#define GL_RGBA16F 0x881A\n#define GL_RGB16F 0x881B\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD\n#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF\n#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904\n#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905\n#define GL_CLAMP_VERTEX_COLOR 0x891A\n#define GL_CLAMP_FRAGMENT_COLOR 0x891B\n#define GL_CLAMP_READ_COLOR 0x891C\n#define GL_FIXED_ONLY 0x891D\n#define GL_TEXTURE_RED_TYPE 0x8C10\n#define GL_TEXTURE_GREEN_TYPE 0x8C11\n#define GL_TEXTURE_BLUE_TYPE 0x8C12\n#define GL_TEXTURE_ALPHA_TYPE 0x8C13\n#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14\n#define GL_TEXTURE_INTENSITY_TYPE 0x8C15\n#define GL_TEXTURE_DEPTH_TYPE 0x8C16\n#define GL_TEXTURE_1D_ARRAY 0x8C18\n#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19\n#define GL_TEXTURE_2D_ARRAY 0x8C1A\n#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B\n#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C\n#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D\n#define GL_R11F_G11F_B10F 0x8C3A\n#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B\n#define GL_RGB9_E5 0x8C3D\n#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E\n#define GL_TEXTURE_SHARED_SIZE 0x8C3F\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80\n#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85\n#define GL_PRIMITIVES_GENERATED 0x8C87\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88\n#define GL_RASTERIZER_DISCARD 0x8C89\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B\n#define GL_INTERLEAVED_ATTRIBS 0x8C8C\n#define GL_SEPARATE_ATTRIBS 0x8C8D\n#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F\n#define GL_RGBA32UI 0x8D70\n#define GL_RGB32UI 0x8D71\n#define GL_RGBA16UI 0x8D76\n#define GL_RGB16UI 0x8D77\n#define GL_RGBA8UI 0x8D7C\n#define GL_RGB8UI 0x8D7D\n#define GL_RGBA32I 0x8D82\n#define GL_RGB32I 0x8D83\n#define GL_RGBA16I 0x8D88\n#define GL_RGB16I 0x8D89\n#define GL_RGBA8I 0x8D8E\n#define GL_RGB8I 0x8D8F\n#define GL_RED_INTEGER 0x8D94\n#define GL_GREEN_INTEGER 0x8D95\n#define GL_BLUE_INTEGER 0x8D96\n#define GL_ALPHA_INTEGER 0x8D97\n#define GL_RGB_INTEGER 0x8D98\n#define GL_RGBA_INTEGER 0x8D99\n#define GL_BGR_INTEGER 0x8D9A\n#define GL_BGRA_INTEGER 0x8D9B\n#define GL_SAMPLER_1D_ARRAY 0x8DC0\n#define GL_SAMPLER_2D_ARRAY 0x8DC1\n#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3\n#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4\n#define GL_SAMPLER_CUBE_SHADOW 0x8DC5\n#define GL_UNSIGNED_INT_VEC2 0x8DC6\n#define GL_UNSIGNED_INT_VEC3 0x8DC7\n#define GL_UNSIGNED_INT_VEC4 0x8DC8\n#define GL_INT_SAMPLER_1D 0x8DC9\n#define GL_INT_SAMPLER_2D 0x8DCA\n#define GL_INT_SAMPLER_3D 0x8DCB\n#define GL_INT_SAMPLER_CUBE 0x8DCC\n#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE\n#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF\n#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1\n#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2\n#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3\n#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7\n#define GL_QUERY_WAIT 0x8E13\n#define GL_QUERY_NO_WAIT 0x8E14\n#define GL_QUERY_BY_REGION_WAIT 0x8E15\n#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16\n\ntypedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERPROC) (GLuint, GLenum);\ntypedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum);\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONPROC) (GLuint, GLuint, const GLchar*);\ntypedef void (GLAPIENTRY * PFNGLCLAMPCOLORPROC) (GLenum, GLenum);\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERFIPROC) (GLenum, GLint, GLfloat, GLint);\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERFVPROC) (GLenum, GLint, const GLfloat*);\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERIVPROC) (GLenum, GLint, const GLint*);\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum, GLint, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLCOLORMASKIPROC) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);\ntypedef void (GLAPIENTRY * PFNGLDISABLEIPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLENABLEIPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLGETBOOLEANI_VPROC) (GLenum, GLuint, GLboolean*);\ntypedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONPROC) (GLuint, const GLchar*);\ntypedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVPROC) (GLenum, GLenum, GLint*);\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVPROC) (GLenum, GLenum, GLuint*);\ntypedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint, GLint, GLuint*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVPROC) (GLuint, GLenum, GLint*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint, GLenum, GLuint*);\ntypedef GLboolean (GLAPIENTRY * PFNGLISENABLEDIPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVPROC) (GLenum, GLenum, const GLint*);\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVPROC) (GLenum, GLenum, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint, GLsizei, const GLchar **, GLenum);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIPROC) (GLint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIVPROC) (GLint, GLsizei, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIPROC) (GLint, GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIVPROC) (GLint, GLsizei, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIPROC) (GLint, GLuint, GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIVPROC) (GLint, GLsizei, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIPROC) (GLint, GLuint, GLuint, GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIVPROC) (GLint, GLsizei, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IPROC) (GLuint, GLint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVPROC) (GLuint, const GLint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIPROC) (GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVPROC) (GLuint, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IPROC) (GLuint, GLint, GLint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVPROC) (GLuint, const GLint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIPROC) (GLuint, GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVPROC) (GLuint, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IPROC) (GLuint, GLint, GLint, GLint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVPROC) (GLuint, const GLint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIPROC) (GLuint, GLuint, GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVPROC) (GLuint, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVPROC) (GLuint, const GLbyte*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IPROC) (GLuint, GLint, GLint, GLint, GLint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVPROC) (GLuint, const GLint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVPROC) (GLuint, const GLshort*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVPROC) (GLuint, const GLubyte*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIPROC) (GLuint, GLuint, GLuint, GLuint, GLuint);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVPROC) (GLuint, const GLuint*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVPROC) (GLuint, const GLushort*);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint, GLint, GLenum, GLsizei, const GLvoid*);\n\n#define glBeginConditionalRender GLEW_GET_FUN(__glewBeginConditionalRender)\n#define glBeginTransformFeedback GLEW_GET_FUN(__glewBeginTransformFeedback)\n#define glBindFragDataLocation GLEW_GET_FUN(__glewBindFragDataLocation)\n#define glClampColor GLEW_GET_FUN(__glewClampColor)\n#define glClearBufferfi GLEW_GET_FUN(__glewClearBufferfi)\n#define glClearBufferfv GLEW_GET_FUN(__glewClearBufferfv)\n#define glClearBufferiv GLEW_GET_FUN(__glewClearBufferiv)\n#define glClearBufferuiv GLEW_GET_FUN(__glewClearBufferuiv)\n#define glColorMaski GLEW_GET_FUN(__glewColorMaski)\n#define glDisablei GLEW_GET_FUN(__glewDisablei)\n#define glEnablei GLEW_GET_FUN(__glewEnablei)\n#define glEndConditionalRender GLEW_GET_FUN(__glewEndConditionalRender)\n#define glEndTransformFeedback GLEW_GET_FUN(__glewEndTransformFeedback)\n#define glGetBooleani_v GLEW_GET_FUN(__glewGetBooleani_v)\n#define glGetFragDataLocation GLEW_GET_FUN(__glewGetFragDataLocation)\n#define glGetStringi GLEW_GET_FUN(__glewGetStringi)\n#define glGetTexParameterIiv GLEW_GET_FUN(__glewGetTexParameterIiv)\n#define glGetTexParameterIuiv GLEW_GET_FUN(__glewGetTexParameterIuiv)\n#define glGetTransformFeedbackVarying GLEW_GET_FUN(__glewGetTransformFeedbackVarying)\n#define glGetUniformuiv GLEW_GET_FUN(__glewGetUniformuiv)\n#define glGetVertexAttribIiv GLEW_GET_FUN(__glewGetVertexAttribIiv)\n#define glGetVertexAttribIuiv GLEW_GET_FUN(__glewGetVertexAttribIuiv)\n#define glIsEnabledi GLEW_GET_FUN(__glewIsEnabledi)\n#define glTexParameterIiv GLEW_GET_FUN(__glewTexParameterIiv)\n#define glTexParameterIuiv GLEW_GET_FUN(__glewTexParameterIuiv)\n#define glTransformFeedbackVaryings GLEW_GET_FUN(__glewTransformFeedbackVaryings)\n#define glUniform1ui GLEW_GET_FUN(__glewUniform1ui)\n#define glUniform1uiv GLEW_GET_FUN(__glewUniform1uiv)\n#define glUniform2ui GLEW_GET_FUN(__glewUniform2ui)\n#define glUniform2uiv GLEW_GET_FUN(__glewUniform2uiv)\n#define glUniform3ui GLEW_GET_FUN(__glewUniform3ui)\n#define glUniform3uiv GLEW_GET_FUN(__glewUniform3uiv)\n#define glUniform4ui GLEW_GET_FUN(__glewUniform4ui)\n#define glUniform4uiv GLEW_GET_FUN(__glewUniform4uiv)\n#define glVertexAttribI1i GLEW_GET_FUN(__glewVertexAttribI1i)\n#define glVertexAttribI1iv GLEW_GET_FUN(__glewVertexAttribI1iv)\n#define glVertexAttribI1ui GLEW_GET_FUN(__glewVertexAttribI1ui)\n#define glVertexAttribI1uiv GLEW_GET_FUN(__glewVertexAttribI1uiv)\n#define glVertexAttribI2i GLEW_GET_FUN(__glewVertexAttribI2i)\n#define glVertexAttribI2iv GLEW_GET_FUN(__glewVertexAttribI2iv)\n#define glVertexAttribI2ui GLEW_GET_FUN(__glewVertexAttribI2ui)\n#define glVertexAttribI2uiv GLEW_GET_FUN(__glewVertexAttribI2uiv)\n#define glVertexAttribI3i GLEW_GET_FUN(__glewVertexAttribI3i)\n#define glVertexAttribI3iv GLEW_GET_FUN(__glewVertexAttribI3iv)\n#define glVertexAttribI3ui GLEW_GET_FUN(__glewVertexAttribI3ui)\n#define glVertexAttribI3uiv GLEW_GET_FUN(__glewVertexAttribI3uiv)\n#define glVertexAttribI4bv GLEW_GET_FUN(__glewVertexAttribI4bv)\n#define glVertexAttribI4i GLEW_GET_FUN(__glewVertexAttribI4i)\n#define glVertexAttribI4iv GLEW_GET_FUN(__glewVertexAttribI4iv)\n#define glVertexAttribI4sv GLEW_GET_FUN(__glewVertexAttribI4sv)\n#define glVertexAttribI4ubv GLEW_GET_FUN(__glewVertexAttribI4ubv)\n#define glVertexAttribI4ui GLEW_GET_FUN(__glewVertexAttribI4ui)\n#define glVertexAttribI4uiv GLEW_GET_FUN(__glewVertexAttribI4uiv)\n#define glVertexAttribI4usv GLEW_GET_FUN(__glewVertexAttribI4usv)\n#define glVertexAttribIPointer GLEW_GET_FUN(__glewVertexAttribIPointer)\n\n#define GLEW_VERSION_3_0 GLEW_GET_VAR(__GLEW_VERSION_3_0)\n\n#endif /* GL_VERSION_3_0 */\n\n/* ----------------------------- GL_VERSION_3_1 ---------------------------- */\n\n#ifndef GL_VERSION_3_1\n#define GL_VERSION_3_1 1\n\n#define GL_TEXTURE_RECTANGLE 0x84F5\n#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6\n#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8\n#define GL_SAMPLER_2D_RECT 0x8B63\n#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64\n#define GL_TEXTURE_BUFFER 0x8C2A\n#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B\n#define GL_TEXTURE_BINDING_BUFFER 0x8C2C\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D\n#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E\n#define GL_SAMPLER_BUFFER 0x8DC2\n#define GL_INT_SAMPLER_2D_RECT 0x8DCD\n#define GL_INT_SAMPLER_BUFFER 0x8DD0\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8\n#define GL_RED_SNORM 0x8F90\n#define GL_RG_SNORM 0x8F91\n#define GL_RGB_SNORM 0x8F92\n#define GL_RGBA_SNORM 0x8F93\n#define GL_R8_SNORM 0x8F94\n#define GL_RG8_SNORM 0x8F95\n#define GL_RGB8_SNORM 0x8F96\n#define GL_RGBA8_SNORM 0x8F97\n#define GL_R16_SNORM 0x8F98\n#define GL_RG16_SNORM 0x8F99\n#define GL_RGB16_SNORM 0x8F9A\n#define GL_RGBA16_SNORM 0x8F9B\n#define GL_SIGNED_NORMALIZED 0x8F9C\n#define GL_PRIMITIVE_RESTART 0x8F9D\n#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E\n#define GL_BUFFER_ACCESS_FLAGS 0x911F\n#define GL_BUFFER_MAP_LENGTH 0x9120\n#define GL_BUFFER_MAP_OFFSET 0x9121\n\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum, GLint, GLsizei, GLsizei);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum, GLsizei, GLenum, const GLvoid*, GLsizei);\ntypedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFERPROC) (GLenum, GLenum, GLuint);\n\n#define glDrawArraysInstanced GLEW_GET_FUN(__glewDrawArraysInstanced)\n#define glDrawElementsInstanced GLEW_GET_FUN(__glewDrawElementsInstanced)\n#define glPrimitiveRestartIndex GLEW_GET_FUN(__glewPrimitiveRestartIndex)\n#define glTexBuffer GLEW_GET_FUN(__glewTexBuffer)\n\n#define GLEW_VERSION_3_1 GLEW_GET_VAR(__GLEW_VERSION_3_1)\n\n#endif /* GL_VERSION_3_1 */\n\n/* ----------------------------- GL_VERSION_3_2 ---------------------------- */\n\n#ifndef GL_VERSION_3_2\n#define GL_VERSION_3_2 1\n\n#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001\n#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002\n#define GL_LINES_ADJACENCY 0x000A\n#define GL_LINE_STRIP_ADJACENCY 0x000B\n#define GL_TRIANGLES_ADJACENCY 0x000C\n#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D\n#define GL_PROGRAM_POINT_SIZE 0x8642\n#define GL_GEOMETRY_VERTICES_OUT 0x8916\n#define GL_GEOMETRY_INPUT_TYPE 0x8917\n#define GL_GEOMETRY_OUTPUT_TYPE 0x8918\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8\n#define GL_GEOMETRY_SHADER 0x8DD9\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1\n#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122\n#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123\n#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124\n#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125\n#define GL_CONTEXT_PROFILE_MASK 0x9126\n\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum, GLenum, GLuint, GLint);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum, GLenum, GLint64 *);\ntypedef void (GLAPIENTRY * PFNGLGETINTEGER64I_VPROC) (GLenum, GLuint, GLint64 *);\n\n#define glFramebufferTexture GLEW_GET_FUN(__glewFramebufferTexture)\n#define glGetBufferParameteri64v GLEW_GET_FUN(__glewGetBufferParameteri64v)\n#define glGetInteger64i_v GLEW_GET_FUN(__glewGetInteger64i_v)\n\n#define GLEW_VERSION_3_2 GLEW_GET_VAR(__GLEW_VERSION_3_2)\n\n#endif /* GL_VERSION_3_2 */\n\n/* ----------------------------- GL_VERSION_3_3 ---------------------------- */\n\n#ifndef GL_VERSION_3_3\n#define GL_VERSION_3_3 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE\n#define GL_TEXTURE_SWIZZLE_R 0x8E42\n#define GL_TEXTURE_SWIZZLE_G 0x8E43\n#define GL_TEXTURE_SWIZZLE_B 0x8E44\n#define GL_TEXTURE_SWIZZLE_A 0x8E45\n#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46\n#define GL_RGB10_A2UI 0x906F\n\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);\n\n#define glVertexAttribDivisor GLEW_GET_FUN(__glewVertexAttribDivisor)\n\n#define GLEW_VERSION_3_3 GLEW_GET_VAR(__GLEW_VERSION_3_3)\n\n#endif /* GL_VERSION_3_3 */\n\n/* ----------------------------- GL_VERSION_4_0 ---------------------------- */\n\n#ifndef GL_VERSION_4_0\n#define GL_VERSION_4_0 1\n\n#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F\n#define GL_SAMPLE_SHADING 0x8C36\n#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F\n#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B\n#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F\n\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);\ntypedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGPROC) (GLclampf value);\n\n#define glBlendEquationSeparatei GLEW_GET_FUN(__glewBlendEquationSeparatei)\n#define glBlendEquationi GLEW_GET_FUN(__glewBlendEquationi)\n#define glBlendFuncSeparatei GLEW_GET_FUN(__glewBlendFuncSeparatei)\n#define glBlendFunci GLEW_GET_FUN(__glewBlendFunci)\n#define glMinSampleShading GLEW_GET_FUN(__glewMinSampleShading)\n\n#define GLEW_VERSION_4_0 GLEW_GET_VAR(__GLEW_VERSION_4_0)\n\n#endif /* GL_VERSION_4_0 */\n\n/* ----------------------------- GL_VERSION_4_1 ---------------------------- */\n\n#ifndef GL_VERSION_4_1\n#define GL_VERSION_4_1 1\n\n#define GLEW_VERSION_4_1 GLEW_GET_VAR(__GLEW_VERSION_4_1)\n\n#endif /* GL_VERSION_4_1 */\n\n/* ----------------------------- GL_VERSION_4_2 ---------------------------- */\n\n#ifndef GL_VERSION_4_2\n#define GL_VERSION_4_2 1\n\n#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F\n\n#define GLEW_VERSION_4_2 GLEW_GET_VAR(__GLEW_VERSION_4_2)\n\n#endif /* GL_VERSION_4_2 */\n\n/* ----------------------------- GL_VERSION_4_3 ---------------------------- */\n\n#ifndef GL_VERSION_4_3\n#define GL_VERSION_4_3 1\n\n#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9\n#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E\n\n#define GLEW_VERSION_4_3 GLEW_GET_VAR(__GLEW_VERSION_4_3)\n\n#endif /* GL_VERSION_4_3 */\n\n/* -------------------------- GL_3DFX_multisample -------------------------- */\n\n#ifndef GL_3DFX_multisample\n#define GL_3DFX_multisample 1\n\n#define GL_MULTISAMPLE_3DFX 0x86B2\n#define GL_SAMPLE_BUFFERS_3DFX 0x86B3\n#define GL_SAMPLES_3DFX 0x86B4\n#define GL_MULTISAMPLE_BIT_3DFX 0x20000000\n\n#define GLEW_3DFX_multisample GLEW_GET_VAR(__GLEW_3DFX_multisample)\n\n#endif /* GL_3DFX_multisample */\n\n/* ---------------------------- GL_3DFX_tbuffer ---------------------------- */\n\n#ifndef GL_3DFX_tbuffer\n#define GL_3DFX_tbuffer 1\n\ntypedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);\n\n#define glTbufferMask3DFX GLEW_GET_FUN(__glewTbufferMask3DFX)\n\n#define GLEW_3DFX_tbuffer GLEW_GET_VAR(__GLEW_3DFX_tbuffer)\n\n#endif /* GL_3DFX_tbuffer */\n\n/* -------------------- GL_3DFX_texture_compression_FXT1 ------------------- */\n\n#ifndef GL_3DFX_texture_compression_FXT1\n#define GL_3DFX_texture_compression_FXT1 1\n\n#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0\n#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1\n\n#define GLEW_3DFX_texture_compression_FXT1 GLEW_GET_VAR(__GLEW_3DFX_texture_compression_FXT1)\n\n#endif /* GL_3DFX_texture_compression_FXT1 */\n\n/* ----------------------- GL_AMD_blend_minmax_factor ---------------------- */\n\n#ifndef GL_AMD_blend_minmax_factor\n#define GL_AMD_blend_minmax_factor 1\n\n#define GL_FACTOR_MIN_AMD 0x901C\n#define GL_FACTOR_MAX_AMD 0x901D\n\n#define GLEW_AMD_blend_minmax_factor GLEW_GET_VAR(__GLEW_AMD_blend_minmax_factor)\n\n#endif /* GL_AMD_blend_minmax_factor */\n\n/* ----------------------- GL_AMD_conservative_depth ----------------------- */\n\n#ifndef GL_AMD_conservative_depth\n#define GL_AMD_conservative_depth 1\n\n#define GLEW_AMD_conservative_depth GLEW_GET_VAR(__GLEW_AMD_conservative_depth)\n\n#endif /* GL_AMD_conservative_depth */\n\n/* -------------------------- GL_AMD_debug_output -------------------------- */\n\n#ifndef GL_AMD_debug_output\n#define GL_AMD_debug_output 1\n\n#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143\n#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144\n#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145\n#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146\n#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147\n#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148\n#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149\n#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A\n#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B\n#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C\n#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D\n#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E\n#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F\n#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150\n\ntypedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);\n\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void* userParam);\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar* buf);\ntypedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum* categories, GLuint* severities, GLuint* ids, GLsizei* lengths, GLchar* message);\n\n#define glDebugMessageCallbackAMD GLEW_GET_FUN(__glewDebugMessageCallbackAMD)\n#define glDebugMessageEnableAMD GLEW_GET_FUN(__glewDebugMessageEnableAMD)\n#define glDebugMessageInsertAMD GLEW_GET_FUN(__glewDebugMessageInsertAMD)\n#define glGetDebugMessageLogAMD GLEW_GET_FUN(__glewGetDebugMessageLogAMD)\n\n#define GLEW_AMD_debug_output GLEW_GET_VAR(__GLEW_AMD_debug_output)\n\n#endif /* GL_AMD_debug_output */\n\n/* ---------------------- GL_AMD_depth_clamp_separate ---------------------- */\n\n#ifndef GL_AMD_depth_clamp_separate\n#define GL_AMD_depth_clamp_separate 1\n\n#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E\n#define GL_DEPTH_CLAMP_FAR_AMD 0x901F\n\n#define GLEW_AMD_depth_clamp_separate GLEW_GET_VAR(__GLEW_AMD_depth_clamp_separate)\n\n#endif /* GL_AMD_depth_clamp_separate */\n\n/* ----------------------- GL_AMD_draw_buffers_blend ----------------------- */\n\n#ifndef GL_AMD_draw_buffers_blend\n#define GL_AMD_draw_buffers_blend 1\n\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\n\n#define glBlendEquationIndexedAMD GLEW_GET_FUN(__glewBlendEquationIndexedAMD)\n#define glBlendEquationSeparateIndexedAMD GLEW_GET_FUN(__glewBlendEquationSeparateIndexedAMD)\n#define glBlendFuncIndexedAMD GLEW_GET_FUN(__glewBlendFuncIndexedAMD)\n#define glBlendFuncSeparateIndexedAMD GLEW_GET_FUN(__glewBlendFuncSeparateIndexedAMD)\n\n#define GLEW_AMD_draw_buffers_blend GLEW_GET_VAR(__GLEW_AMD_draw_buffers_blend)\n\n#endif /* GL_AMD_draw_buffers_blend */\n\n/* ----------------------- GL_AMD_multi_draw_indirect ---------------------- */\n\n#ifndef GL_AMD_multi_draw_indirect\n#define GL_AMD_multi_draw_indirect 1\n\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride);\n\n#define glMultiDrawArraysIndirectAMD GLEW_GET_FUN(__glewMultiDrawArraysIndirectAMD)\n#define glMultiDrawElementsIndirectAMD GLEW_GET_FUN(__glewMultiDrawElementsIndirectAMD)\n\n#define GLEW_AMD_multi_draw_indirect GLEW_GET_VAR(__GLEW_AMD_multi_draw_indirect)\n\n#endif /* GL_AMD_multi_draw_indirect */\n\n/* ------------------------- GL_AMD_name_gen_delete ------------------------ */\n\n#ifndef GL_AMD_name_gen_delete\n#define GL_AMD_name_gen_delete 1\n\n#define GL_DATA_BUFFER_AMD 0x9151\n#define GL_PERFORMANCE_MONITOR_AMD 0x9152\n#define GL_QUERY_OBJECT_AMD 0x9153\n#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154\n#define GL_SAMPLER_OBJECT_AMD 0x9155\n\ntypedef void (GLAPIENTRY * PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint* names);\ntypedef void (GLAPIENTRY * PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint* names);\ntypedef GLboolean (GLAPIENTRY * PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);\n\n#define glDeleteNamesAMD GLEW_GET_FUN(__glewDeleteNamesAMD)\n#define glGenNamesAMD GLEW_GET_FUN(__glewGenNamesAMD)\n#define glIsNameAMD GLEW_GET_FUN(__glewIsNameAMD)\n\n#define GLEW_AMD_name_gen_delete GLEW_GET_VAR(__GLEW_AMD_name_gen_delete)\n\n#endif /* GL_AMD_name_gen_delete */\n\n/* ----------------------- GL_AMD_performance_monitor ---------------------- */\n\n#ifndef GL_AMD_performance_monitor\n#define GL_AMD_performance_monitor 1\n\n#define GL_COUNTER_TYPE_AMD 0x8BC0\n#define GL_COUNTER_RANGE_AMD 0x8BC1\n#define GL_UNSIGNED_INT64_AMD 0x8BC2\n#define GL_PERCENTAGE_AMD 0x8BC3\n#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4\n#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5\n#define GL_PERFMON_RESULT_AMD 0x8BC6\n\ntypedef void (GLAPIENTRY * PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);\ntypedef void (GLAPIENTRY * PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors);\ntypedef void (GLAPIENTRY * PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);\ntypedef void (GLAPIENTRY * PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors);\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint *bytesWritten);\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void* data);\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar *counterString);\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint* numCounters, GLint *maxActiveCounters, GLsizei countersSize, GLuint *counters);\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei* length, GLchar *groupString);\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint* numGroups, GLsizei groupsSize, GLuint *groups);\ntypedef void (GLAPIENTRY * PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* counterList);\n\n#define glBeginPerfMonitorAMD GLEW_GET_FUN(__glewBeginPerfMonitorAMD)\n#define glDeletePerfMonitorsAMD GLEW_GET_FUN(__glewDeletePerfMonitorsAMD)\n#define glEndPerfMonitorAMD GLEW_GET_FUN(__glewEndPerfMonitorAMD)\n#define glGenPerfMonitorsAMD GLEW_GET_FUN(__glewGenPerfMonitorsAMD)\n#define glGetPerfMonitorCounterDataAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterDataAMD)\n#define glGetPerfMonitorCounterInfoAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterInfoAMD)\n#define glGetPerfMonitorCounterStringAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterStringAMD)\n#define glGetPerfMonitorCountersAMD GLEW_GET_FUN(__glewGetPerfMonitorCountersAMD)\n#define glGetPerfMonitorGroupStringAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupStringAMD)\n#define glGetPerfMonitorGroupsAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupsAMD)\n#define glSelectPerfMonitorCountersAMD GLEW_GET_FUN(__glewSelectPerfMonitorCountersAMD)\n\n#define GLEW_AMD_performance_monitor GLEW_GET_VAR(__GLEW_AMD_performance_monitor)\n\n#endif /* GL_AMD_performance_monitor */\n\n/* -------------------------- GL_AMD_pinned_memory ------------------------- */\n\n#ifndef GL_AMD_pinned_memory\n#define GL_AMD_pinned_memory 1\n\n#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160\n\n#define GLEW_AMD_pinned_memory GLEW_GET_VAR(__GLEW_AMD_pinned_memory)\n\n#endif /* GL_AMD_pinned_memory */\n\n/* ----------------------- GL_AMD_query_buffer_object ---------------------- */\n\n#ifndef GL_AMD_query_buffer_object\n#define GL_AMD_query_buffer_object 1\n\n#define GL_QUERY_BUFFER_AMD 0x9192\n#define GL_QUERY_BUFFER_BINDING_AMD 0x9193\n#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194\n\n#define GLEW_AMD_query_buffer_object GLEW_GET_VAR(__GLEW_AMD_query_buffer_object)\n\n#endif /* GL_AMD_query_buffer_object */\n\n/* ------------------------ GL_AMD_sample_positions ------------------------ */\n\n#ifndef GL_AMD_sample_positions\n#define GL_AMD_sample_positions 1\n\n#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F\n\ntypedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat* val);\n\n#define glSetMultisamplefvAMD GLEW_GET_FUN(__glewSetMultisamplefvAMD)\n\n#define GLEW_AMD_sample_positions GLEW_GET_VAR(__GLEW_AMD_sample_positions)\n\n#endif /* GL_AMD_sample_positions */\n\n/* ------------------ GL_AMD_seamless_cubemap_per_texture ------------------ */\n\n#ifndef GL_AMD_seamless_cubemap_per_texture\n#define GL_AMD_seamless_cubemap_per_texture 1\n\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB 0x884F\n\n#define GLEW_AMD_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_AMD_seamless_cubemap_per_texture)\n\n#endif /* GL_AMD_seamless_cubemap_per_texture */\n\n/* ---------------------- GL_AMD_shader_stencil_export --------------------- */\n\n#ifndef GL_AMD_shader_stencil_export\n#define GL_AMD_shader_stencil_export 1\n\n#define GLEW_AMD_shader_stencil_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_export)\n\n#endif /* GL_AMD_shader_stencil_export */\n\n/* ------------------- GL_AMD_stencil_operation_extended ------------------- */\n\n#ifndef GL_AMD_stencil_operation_extended\n#define GL_AMD_stencil_operation_extended 1\n\n#define GL_SET_AMD 0x874A\n#define GL_REPLACE_VALUE_AMD 0x874B\n#define GL_STENCIL_OP_VALUE_AMD 0x874C\n#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D\n\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);\n\n#define glStencilOpValueAMD GLEW_GET_FUN(__glewStencilOpValueAMD)\n\n#define GLEW_AMD_stencil_operation_extended GLEW_GET_VAR(__GLEW_AMD_stencil_operation_extended)\n\n#endif /* GL_AMD_stencil_operation_extended */\n\n/* ------------------------ GL_AMD_texture_texture4 ------------------------ */\n\n#ifndef GL_AMD_texture_texture4\n#define GL_AMD_texture_texture4 1\n\n#define GLEW_AMD_texture_texture4 GLEW_GET_VAR(__GLEW_AMD_texture_texture4)\n\n#endif /* GL_AMD_texture_texture4 */\n\n/* --------------- GL_AMD_transform_feedback3_lines_triangles -------------- */\n\n#ifndef GL_AMD_transform_feedback3_lines_triangles\n#define GL_AMD_transform_feedback3_lines_triangles 1\n\n#define GLEW_AMD_transform_feedback3_lines_triangles GLEW_GET_VAR(__GLEW_AMD_transform_feedback3_lines_triangles)\n\n#endif /* GL_AMD_transform_feedback3_lines_triangles */\n\n/* ----------------------- GL_AMD_vertex_shader_layer ---------------------- */\n\n#ifndef GL_AMD_vertex_shader_layer\n#define GL_AMD_vertex_shader_layer 1\n\n#define GLEW_AMD_vertex_shader_layer GLEW_GET_VAR(__GLEW_AMD_vertex_shader_layer)\n\n#endif /* GL_AMD_vertex_shader_layer */\n\n/* -------------------- GL_AMD_vertex_shader_tessellator ------------------- */\n\n#ifndef GL_AMD_vertex_shader_tessellator\n#define GL_AMD_vertex_shader_tessellator 1\n\n#define GL_SAMPLER_BUFFER_AMD 0x9001\n#define GL_INT_SAMPLER_BUFFER_AMD 0x9002\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003\n#define GL_TESSELLATION_MODE_AMD 0x9004\n#define GL_TESSELLATION_FACTOR_AMD 0x9005\n#define GL_DISCRETE_AMD 0x9006\n#define GL_CONTINUOUS_AMD 0x9007\n\ntypedef void (GLAPIENTRY * PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);\ntypedef void (GLAPIENTRY * PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);\n\n#define glTessellationFactorAMD GLEW_GET_FUN(__glewTessellationFactorAMD)\n#define glTessellationModeAMD GLEW_GET_FUN(__glewTessellationModeAMD)\n\n#define GLEW_AMD_vertex_shader_tessellator GLEW_GET_VAR(__GLEW_AMD_vertex_shader_tessellator)\n\n#endif /* GL_AMD_vertex_shader_tessellator */\n\n/* ------------------ GL_AMD_vertex_shader_viewport_index ------------------ */\n\n#ifndef GL_AMD_vertex_shader_viewport_index\n#define GL_AMD_vertex_shader_viewport_index 1\n\n#define GLEW_AMD_vertex_shader_viewport_index GLEW_GET_VAR(__GLEW_AMD_vertex_shader_viewport_index)\n\n#endif /* GL_AMD_vertex_shader_viewport_index */\n\n/* ----------------------- GL_APPLE_aux_depth_stencil ---------------------- */\n\n#ifndef GL_APPLE_aux_depth_stencil\n#define GL_APPLE_aux_depth_stencil 1\n\n#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14\n\n#define GLEW_APPLE_aux_depth_stencil GLEW_GET_VAR(__GLEW_APPLE_aux_depth_stencil)\n\n#endif /* GL_APPLE_aux_depth_stencil */\n\n/* ------------------------ GL_APPLE_client_storage ------------------------ */\n\n#ifndef GL_APPLE_client_storage\n#define GL_APPLE_client_storage 1\n\n#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2\n\n#define GLEW_APPLE_client_storage GLEW_GET_VAR(__GLEW_APPLE_client_storage)\n\n#endif /* GL_APPLE_client_storage */\n\n/* ------------------------- GL_APPLE_element_array ------------------------ */\n\n#ifndef GL_APPLE_element_array\n#define GL_APPLE_element_array 1\n\n#define GL_ELEMENT_ARRAY_APPLE 0x8A0C\n#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D\n#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E\n\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);\ntypedef void (GLAPIENTRY * PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei *count, GLsizei primcount);\n\n#define glDrawElementArrayAPPLE GLEW_GET_FUN(__glewDrawElementArrayAPPLE)\n#define glDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewDrawRangeElementArrayAPPLE)\n#define glElementPointerAPPLE GLEW_GET_FUN(__glewElementPointerAPPLE)\n#define glMultiDrawElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawElementArrayAPPLE)\n#define glMultiDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawRangeElementArrayAPPLE)\n\n#define GLEW_APPLE_element_array GLEW_GET_VAR(__GLEW_APPLE_element_array)\n\n#endif /* GL_APPLE_element_array */\n\n/* ----------------------------- GL_APPLE_fence ---------------------------- */\n\n#ifndef GL_APPLE_fence\n#define GL_APPLE_fence 1\n\n#define GL_DRAW_PIXELS_APPLE 0x8A0A\n#define GL_FENCE_APPLE 0x8A0B\n\ntypedef void (GLAPIENTRY * PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint* fences);\ntypedef void (GLAPIENTRY * PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);\ntypedef void (GLAPIENTRY * PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);\ntypedef void (GLAPIENTRY * PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint* fences);\ntypedef GLboolean (GLAPIENTRY * PFNGLISFENCEAPPLEPROC) (GLuint fence);\ntypedef void (GLAPIENTRY * PFNGLSETFENCEAPPLEPROC) (GLuint fence);\ntypedef GLboolean (GLAPIENTRY * PFNGLTESTFENCEAPPLEPROC) (GLuint fence);\ntypedef GLboolean (GLAPIENTRY * PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);\n\n#define glDeleteFencesAPPLE GLEW_GET_FUN(__glewDeleteFencesAPPLE)\n#define glFinishFenceAPPLE GLEW_GET_FUN(__glewFinishFenceAPPLE)\n#define glFinishObjectAPPLE GLEW_GET_FUN(__glewFinishObjectAPPLE)\n#define glGenFencesAPPLE GLEW_GET_FUN(__glewGenFencesAPPLE)\n#define glIsFenceAPPLE GLEW_GET_FUN(__glewIsFenceAPPLE)\n#define glSetFenceAPPLE GLEW_GET_FUN(__glewSetFenceAPPLE)\n#define glTestFenceAPPLE GLEW_GET_FUN(__glewTestFenceAPPLE)\n#define glTestObjectAPPLE GLEW_GET_FUN(__glewTestObjectAPPLE)\n\n#define GLEW_APPLE_fence GLEW_GET_VAR(__GLEW_APPLE_fence)\n\n#endif /* GL_APPLE_fence */\n\n/* ------------------------- GL_APPLE_float_pixels ------------------------- */\n\n#ifndef GL_APPLE_float_pixels\n#define GL_APPLE_float_pixels 1\n\n#define GL_HALF_APPLE 0x140B\n#define GL_RGBA_FLOAT32_APPLE 0x8814\n#define GL_RGB_FLOAT32_APPLE 0x8815\n#define GL_ALPHA_FLOAT32_APPLE 0x8816\n#define GL_INTENSITY_FLOAT32_APPLE 0x8817\n#define GL_LUMINANCE_FLOAT32_APPLE 0x8818\n#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819\n#define GL_RGBA_FLOAT16_APPLE 0x881A\n#define GL_RGB_FLOAT16_APPLE 0x881B\n#define GL_ALPHA_FLOAT16_APPLE 0x881C\n#define GL_INTENSITY_FLOAT16_APPLE 0x881D\n#define GL_LUMINANCE_FLOAT16_APPLE 0x881E\n#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F\n#define GL_COLOR_FLOAT_APPLE 0x8A0F\n\n#define GLEW_APPLE_float_pixels GLEW_GET_VAR(__GLEW_APPLE_float_pixels)\n\n#endif /* GL_APPLE_float_pixels */\n\n/* ---------------------- GL_APPLE_flush_buffer_range ---------------------- */\n\n#ifndef GL_APPLE_flush_buffer_range\n#define GL_APPLE_flush_buffer_range 1\n\n#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12\n#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13\n\ntypedef void (GLAPIENTRY * PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);\n\n#define glBufferParameteriAPPLE GLEW_GET_FUN(__glewBufferParameteriAPPLE)\n#define glFlushMappedBufferRangeAPPLE GLEW_GET_FUN(__glewFlushMappedBufferRangeAPPLE)\n\n#define GLEW_APPLE_flush_buffer_range GLEW_GET_VAR(__GLEW_APPLE_flush_buffer_range)\n\n#endif /* GL_APPLE_flush_buffer_range */\n\n/* ----------------------- GL_APPLE_object_purgeable ----------------------- */\n\n#ifndef GL_APPLE_object_purgeable\n#define GL_APPLE_object_purgeable 1\n\n#define GL_BUFFER_OBJECT_APPLE 0x85B3\n#define GL_RELEASED_APPLE 0x8A19\n#define GL_VOLATILE_APPLE 0x8A1A\n#define GL_RETAINED_APPLE 0x8A1B\n#define GL_UNDEFINED_APPLE 0x8A1C\n#define GL_PURGEABLE_APPLE 0x8A1D\n\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint* params);\ntypedef GLenum (GLAPIENTRY * PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);\ntypedef GLenum (GLAPIENTRY * PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);\n\n#define glGetObjectParameterivAPPLE GLEW_GET_FUN(__glewGetObjectParameterivAPPLE)\n#define glObjectPurgeableAPPLE GLEW_GET_FUN(__glewObjectPurgeableAPPLE)\n#define glObjectUnpurgeableAPPLE GLEW_GET_FUN(__glewObjectUnpurgeableAPPLE)\n\n#define GLEW_APPLE_object_purgeable GLEW_GET_VAR(__GLEW_APPLE_object_purgeable)\n\n#endif /* GL_APPLE_object_purgeable */\n\n/* ------------------------- GL_APPLE_pixel_buffer ------------------------- */\n\n#ifndef GL_APPLE_pixel_buffer\n#define GL_APPLE_pixel_buffer 1\n\n#define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10\n\n#define GLEW_APPLE_pixel_buffer GLEW_GET_VAR(__GLEW_APPLE_pixel_buffer)\n\n#endif /* GL_APPLE_pixel_buffer */\n\n/* ---------------------------- GL_APPLE_rgb_422 --------------------------- */\n\n#ifndef GL_APPLE_rgb_422\n#define GL_APPLE_rgb_422 1\n\n#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA\n#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB\n#define GL_RGB_422_APPLE 0x8A1F\n\n#define GLEW_APPLE_rgb_422 GLEW_GET_VAR(__GLEW_APPLE_rgb_422)\n\n#endif /* GL_APPLE_rgb_422 */\n\n/* --------------------------- GL_APPLE_row_bytes -------------------------- */\n\n#ifndef GL_APPLE_row_bytes\n#define GL_APPLE_row_bytes 1\n\n#define GL_PACK_ROW_BYTES_APPLE 0x8A15\n#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16\n\n#define GLEW_APPLE_row_bytes GLEW_GET_VAR(__GLEW_APPLE_row_bytes)\n\n#endif /* GL_APPLE_row_bytes */\n\n/* ------------------------ GL_APPLE_specular_vector ----------------------- */\n\n#ifndef GL_APPLE_specular_vector\n#define GL_APPLE_specular_vector 1\n\n#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0\n\n#define GLEW_APPLE_specular_vector GLEW_GET_VAR(__GLEW_APPLE_specular_vector)\n\n#endif /* GL_APPLE_specular_vector */\n\n/* ------------------------- GL_APPLE_texture_range ------------------------ */\n\n#ifndef GL_APPLE_texture_range\n#define GL_APPLE_texture_range 1\n\n#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7\n#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8\n#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC\n#define GL_STORAGE_PRIVATE_APPLE 0x85BD\n#define GL_STORAGE_CACHED_APPLE 0x85BE\n#define GL_STORAGE_SHARED_APPLE 0x85BF\n\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid **params);\ntypedef void (GLAPIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, GLvoid *pointer);\n\n#define glGetTexParameterPointervAPPLE GLEW_GET_FUN(__glewGetTexParameterPointervAPPLE)\n#define glTextureRangeAPPLE GLEW_GET_FUN(__glewTextureRangeAPPLE)\n\n#define GLEW_APPLE_texture_range GLEW_GET_VAR(__GLEW_APPLE_texture_range)\n\n#endif /* GL_APPLE_texture_range */\n\n/* ------------------------ GL_APPLE_transform_hint ------------------------ */\n\n#ifndef GL_APPLE_transform_hint\n#define GL_APPLE_transform_hint 1\n\n#define GL_TRANSFORM_HINT_APPLE 0x85B1\n\n#define GLEW_APPLE_transform_hint GLEW_GET_VAR(__GLEW_APPLE_transform_hint)\n\n#endif /* GL_APPLE_transform_hint */\n\n/* ---------------------- GL_APPLE_vertex_array_object --------------------- */\n\n#ifndef GL_APPLE_vertex_array_object\n#define GL_APPLE_vertex_array_object 1\n\n#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5\n\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);\ntypedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays);\ntypedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays);\ntypedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);\n\n#define glBindVertexArrayAPPLE GLEW_GET_FUN(__glewBindVertexArrayAPPLE)\n#define glDeleteVertexArraysAPPLE GLEW_GET_FUN(__glewDeleteVertexArraysAPPLE)\n#define glGenVertexArraysAPPLE GLEW_GET_FUN(__glewGenVertexArraysAPPLE)\n#define glIsVertexArrayAPPLE GLEW_GET_FUN(__glewIsVertexArrayAPPLE)\n\n#define GLEW_APPLE_vertex_array_object GLEW_GET_VAR(__GLEW_APPLE_vertex_array_object)\n\n#endif /* GL_APPLE_vertex_array_object */\n\n/* ---------------------- GL_APPLE_vertex_array_range ---------------------- */\n\n#ifndef GL_APPLE_vertex_array_range\n#define GL_APPLE_vertex_array_range 1\n\n#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D\n#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E\n#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F\n#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE 0x8520\n#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521\n#define GL_STORAGE_CLIENT_APPLE 0x85B4\n#define GL_STORAGE_CACHED_APPLE 0x85BE\n#define GL_STORAGE_SHARED_APPLE 0x85BF\n\ntypedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer);\n\n#define glFlushVertexArrayRangeAPPLE GLEW_GET_FUN(__glewFlushVertexArrayRangeAPPLE)\n#define glVertexArrayParameteriAPPLE GLEW_GET_FUN(__glewVertexArrayParameteriAPPLE)\n#define glVertexArrayRangeAPPLE GLEW_GET_FUN(__glewVertexArrayRangeAPPLE)\n\n#define GLEW_APPLE_vertex_array_range GLEW_GET_VAR(__GLEW_APPLE_vertex_array_range)\n\n#endif /* GL_APPLE_vertex_array_range */\n\n/* ------------------- GL_APPLE_vertex_program_evaluators ------------------ */\n\n#ifndef GL_APPLE_vertex_program_evaluators\n#define GL_APPLE_vertex_program_evaluators 1\n\n#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00\n#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01\n#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02\n#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03\n#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04\n#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05\n#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06\n#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07\n#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08\n#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09\n\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);\ntypedef GLboolean (GLAPIENTRY * PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points);\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points);\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points);\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points);\n\n#define glDisableVertexAttribAPPLE GLEW_GET_FUN(__glewDisableVertexAttribAPPLE)\n#define glEnableVertexAttribAPPLE GLEW_GET_FUN(__glewEnableVertexAttribAPPLE)\n#define glIsVertexAttribEnabledAPPLE GLEW_GET_FUN(__glewIsVertexAttribEnabledAPPLE)\n#define glMapVertexAttrib1dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1dAPPLE)\n#define glMapVertexAttrib1fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1fAPPLE)\n#define glMapVertexAttrib2dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2dAPPLE)\n#define glMapVertexAttrib2fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2fAPPLE)\n\n#define GLEW_APPLE_vertex_program_evaluators GLEW_GET_VAR(__GLEW_APPLE_vertex_program_evaluators)\n\n#endif /* GL_APPLE_vertex_program_evaluators */\n\n/* --------------------------- GL_APPLE_ycbcr_422 -------------------------- */\n\n#ifndef GL_APPLE_ycbcr_422\n#define GL_APPLE_ycbcr_422 1\n\n#define GL_YCBCR_422_APPLE 0x85B9\n\n#define GLEW_APPLE_ycbcr_422 GLEW_GET_VAR(__GLEW_APPLE_ycbcr_422)\n\n#endif /* GL_APPLE_ycbcr_422 */\n\n/* ------------------------ GL_ARB_ES2_compatibility ----------------------- */\n\n#ifndef GL_ARB_ES2_compatibility\n#define GL_ARB_ES2_compatibility 1\n\n#define GL_FIXED 0x140C\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B\n#define GL_RGB565 0x8D62\n#define GL_LOW_FLOAT 0x8DF0\n#define GL_MEDIUM_FLOAT 0x8DF1\n#define GL_HIGH_FLOAT 0x8DF2\n#define GL_LOW_INT 0x8DF3\n#define GL_MEDIUM_INT 0x8DF4\n#define GL_HIGH_INT 0x8DF5\n#define GL_SHADER_BINARY_FORMATS 0x8DF8\n#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9\n#define GL_SHADER_COMPILER 0x8DFA\n#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB\n#define GL_MAX_VARYING_VECTORS 0x8DFC\n#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD\n\ntypedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf d);\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint *precision);\ntypedef void (GLAPIENTRY * PFNGLRELEASESHADERCOMPILERPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint* shaders, GLenum binaryformat, const GLvoid*binary, GLsizei length);\n\n#define glClearDepthf GLEW_GET_FUN(__glewClearDepthf)\n#define glDepthRangef GLEW_GET_FUN(__glewDepthRangef)\n#define glGetShaderPrecisionFormat GLEW_GET_FUN(__glewGetShaderPrecisionFormat)\n#define glReleaseShaderCompiler GLEW_GET_FUN(__glewReleaseShaderCompiler)\n#define glShaderBinary GLEW_GET_FUN(__glewShaderBinary)\n\n#define GLEW_ARB_ES2_compatibility GLEW_GET_VAR(__GLEW_ARB_ES2_compatibility)\n\n#endif /* GL_ARB_ES2_compatibility */\n\n/* ------------------------ GL_ARB_ES3_compatibility ----------------------- */\n\n#ifndef GL_ARB_ES3_compatibility\n#define GL_ARB_ES3_compatibility 1\n\n#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69\n#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A\n#define GL_MAX_ELEMENT_INDEX 0x8D6B\n#define GL_COMPRESSED_R11_EAC 0x9270\n#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271\n#define GL_COMPRESSED_RG11_EAC 0x9272\n#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273\n#define GL_COMPRESSED_RGB8_ETC2 0x9274\n#define GL_COMPRESSED_SRGB8_ETC2 0x9275\n#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276\n#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277\n#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278\n#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279\n\n#define GLEW_ARB_ES3_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_compatibility)\n\n#endif /* GL_ARB_ES3_compatibility */\n\n/* ------------------------ GL_ARB_arrays_of_arrays ------------------------ */\n\n#ifndef GL_ARB_arrays_of_arrays\n#define GL_ARB_arrays_of_arrays 1\n\n#define GLEW_ARB_arrays_of_arrays GLEW_GET_VAR(__GLEW_ARB_arrays_of_arrays)\n\n#endif /* GL_ARB_arrays_of_arrays */\n\n/* -------------------------- GL_ARB_base_instance ------------------------- */\n\n#ifndef GL_ARB_base_instance\n#define GL_ARB_base_instance 1\n\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLuint baseinstance);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);\n\n#define glDrawArraysInstancedBaseInstance GLEW_GET_FUN(__glewDrawArraysInstancedBaseInstance)\n#define glDrawElementsInstancedBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseInstance)\n#define glDrawElementsInstancedBaseVertexBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertexBaseInstance)\n\n#define GLEW_ARB_base_instance GLEW_GET_VAR(__GLEW_ARB_base_instance)\n\n#endif /* GL_ARB_base_instance */\n\n/* ----------------------- GL_ARB_blend_func_extended ---------------------- */\n\n#ifndef GL_ARB_blend_func_extended\n#define GL_ARB_blend_func_extended 1\n\n#define GL_SRC1_COLOR 0x88F9\n#define GL_ONE_MINUS_SRC1_COLOR 0x88FA\n#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB\n#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC\n\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar * name);\ntypedef GLint (GLAPIENTRY * PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar * name);\n\n#define glBindFragDataLocationIndexed GLEW_GET_FUN(__glewBindFragDataLocationIndexed)\n#define glGetFragDataIndex GLEW_GET_FUN(__glewGetFragDataIndex)\n\n#define GLEW_ARB_blend_func_extended GLEW_GET_VAR(__GLEW_ARB_blend_func_extended)\n\n#endif /* GL_ARB_blend_func_extended */\n\n/* ---------------------------- GL_ARB_cl_event ---------------------------- */\n\n#ifndef GL_ARB_cl_event\n#define GL_ARB_cl_event 1\n\n#define GL_SYNC_CL_EVENT_ARB 0x8240\n#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241\n\ntypedef struct _cl_context *cl_context;\ntypedef struct _cl_event *cl_event;\n\ntypedef GLsync (GLAPIENTRY * PFNGLCREATESYNCFROMCLEVENTARBPROC) (cl_context context, cl_event event, GLbitfield flags);\n\n#define glCreateSyncFromCLeventARB GLEW_GET_FUN(__glewCreateSyncFromCLeventARB)\n\n#define GLEW_ARB_cl_event GLEW_GET_VAR(__GLEW_ARB_cl_event)\n\n#endif /* GL_ARB_cl_event */\n\n/* ----------------------- GL_ARB_clear_buffer_object ---------------------- */\n\n#ifndef GL_ARB_clear_buffer_object\n#define GL_ARB_clear_buffer_object 1\n\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid* data);\n\n#define glClearBufferData GLEW_GET_FUN(__glewClearBufferData)\n#define glClearBufferSubData GLEW_GET_FUN(__glewClearBufferSubData)\n#define glClearNamedBufferDataEXT GLEW_GET_FUN(__glewClearNamedBufferDataEXT)\n#define glClearNamedBufferSubDataEXT GLEW_GET_FUN(__glewClearNamedBufferSubDataEXT)\n\n#define GLEW_ARB_clear_buffer_object GLEW_GET_VAR(__GLEW_ARB_clear_buffer_object)\n\n#endif /* GL_ARB_clear_buffer_object */\n\n/* ----------------------- GL_ARB_color_buffer_float ----------------------- */\n\n#ifndef GL_ARB_color_buffer_float\n#define GL_ARB_color_buffer_float 1\n\n#define GL_RGBA_FLOAT_MODE_ARB 0x8820\n#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A\n#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B\n#define GL_CLAMP_READ_COLOR_ARB 0x891C\n#define GL_FIXED_ONLY_ARB 0x891D\n\ntypedef void (GLAPIENTRY * PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);\n\n#define glClampColorARB GLEW_GET_FUN(__glewClampColorARB)\n\n#define GLEW_ARB_color_buffer_float GLEW_GET_VAR(__GLEW_ARB_color_buffer_float)\n\n#endif /* GL_ARB_color_buffer_float */\n\n/* -------------------------- GL_ARB_compatibility ------------------------- */\n\n#ifndef GL_ARB_compatibility\n#define GL_ARB_compatibility 1\n\n#define GLEW_ARB_compatibility GLEW_GET_VAR(__GLEW_ARB_compatibility)\n\n#endif /* GL_ARB_compatibility */\n\n/* ---------------- GL_ARB_compressed_texture_pixel_storage ---------------- */\n\n#ifndef GL_ARB_compressed_texture_pixel_storage\n#define GL_ARB_compressed_texture_pixel_storage 1\n\n#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127\n#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128\n#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129\n#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A\n#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B\n#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C\n#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D\n#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E\n\n#define GLEW_ARB_compressed_texture_pixel_storage GLEW_GET_VAR(__GLEW_ARB_compressed_texture_pixel_storage)\n\n#endif /* GL_ARB_compressed_texture_pixel_storage */\n\n/* ------------------------- GL_ARB_compute_shader ------------------------- */\n\n#ifndef GL_ARB_compute_shader\n#define GL_ARB_compute_shader 1\n\n#define GL_COMPUTE_SHADER_BIT 0x00000020\n#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262\n#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263\n#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264\n#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265\n#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266\n#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267\n#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED\n#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE\n#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF\n#define GL_COMPUTE_SHADER 0x91B9\n#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB\n#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC\n#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD\n#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE\n#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF\n\ntypedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\ntypedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);\n\n#define glDispatchCompute GLEW_GET_FUN(__glewDispatchCompute)\n#define glDispatchComputeIndirect GLEW_GET_FUN(__glewDispatchComputeIndirect)\n\n#define GLEW_ARB_compute_shader GLEW_GET_VAR(__GLEW_ARB_compute_shader)\n\n#endif /* GL_ARB_compute_shader */\n\n/* ----------------------- GL_ARB_conservative_depth ----------------------- */\n\n#ifndef GL_ARB_conservative_depth\n#define GL_ARB_conservative_depth 1\n\n#define GLEW_ARB_conservative_depth GLEW_GET_VAR(__GLEW_ARB_conservative_depth)\n\n#endif /* GL_ARB_conservative_depth */\n\n/* --------------------------- GL_ARB_copy_buffer -------------------------- */\n\n#ifndef GL_ARB_copy_buffer\n#define GL_ARB_copy_buffer 1\n\n#define GL_COPY_READ_BUFFER 0x8F36\n#define GL_COPY_WRITE_BUFFER 0x8F37\n\ntypedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size);\n\n#define glCopyBufferSubData GLEW_GET_FUN(__glewCopyBufferSubData)\n\n#define GLEW_ARB_copy_buffer GLEW_GET_VAR(__GLEW_ARB_copy_buffer)\n\n#endif /* GL_ARB_copy_buffer */\n\n/* --------------------------- GL_ARB_copy_image --------------------------- */\n\n#ifndef GL_ARB_copy_image\n#define GL_ARB_copy_image 1\n\ntypedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\n\n#define glCopyImageSubData GLEW_GET_FUN(__glewCopyImageSubData)\n\n#define GLEW_ARB_copy_image GLEW_GET_VAR(__GLEW_ARB_copy_image)\n\n#endif /* GL_ARB_copy_image */\n\n/* -------------------------- GL_ARB_debug_output -------------------------- */\n\n#ifndef GL_ARB_debug_output\n#define GL_ARB_debug_output 1\n\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243\n#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244\n#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245\n#define GL_DEBUG_SOURCE_API_ARB 0x8246\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247\n#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248\n#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249\n#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A\n#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B\n#define GL_DEBUG_TYPE_ERROR_ARB 0x824C\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E\n#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F\n#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250\n#define GL_DEBUG_TYPE_OTHER_ARB 0x8251\n#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143\n#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144\n#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145\n#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146\n#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147\n#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148\n\ntypedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);\n\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, void* userParam);\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);\ntypedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);\n\n#define glDebugMessageCallbackARB GLEW_GET_FUN(__glewDebugMessageCallbackARB)\n#define glDebugMessageControlARB GLEW_GET_FUN(__glewDebugMessageControlARB)\n#define glDebugMessageInsertARB GLEW_GET_FUN(__glewDebugMessageInsertARB)\n#define glGetDebugMessageLogARB GLEW_GET_FUN(__glewGetDebugMessageLogARB)\n\n#define GLEW_ARB_debug_output GLEW_GET_VAR(__GLEW_ARB_debug_output)\n\n#endif /* GL_ARB_debug_output */\n\n/* ----------------------- GL_ARB_depth_buffer_float ----------------------- */\n\n#ifndef GL_ARB_depth_buffer_float\n#define GL_ARB_depth_buffer_float 1\n\n#define GL_DEPTH_COMPONENT32F 0x8CAC\n#define GL_DEPTH32F_STENCIL8 0x8CAD\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD\n\n#define GLEW_ARB_depth_buffer_float GLEW_GET_VAR(__GLEW_ARB_depth_buffer_float)\n\n#endif /* GL_ARB_depth_buffer_float */\n\n/* --------------------------- GL_ARB_depth_clamp -------------------------- */\n\n#ifndef GL_ARB_depth_clamp\n#define GL_ARB_depth_clamp 1\n\n#define GL_DEPTH_CLAMP 0x864F\n\n#define GLEW_ARB_depth_clamp GLEW_GET_VAR(__GLEW_ARB_depth_clamp)\n\n#endif /* GL_ARB_depth_clamp */\n\n/* -------------------------- GL_ARB_depth_texture ------------------------- */\n\n#ifndef GL_ARB_depth_texture\n#define GL_ARB_depth_texture 1\n\n#define GL_DEPTH_COMPONENT16_ARB 0x81A5\n#define GL_DEPTH_COMPONENT24_ARB 0x81A6\n#define GL_DEPTH_COMPONENT32_ARB 0x81A7\n#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A\n#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B\n\n#define GLEW_ARB_depth_texture GLEW_GET_VAR(__GLEW_ARB_depth_texture)\n\n#endif /* GL_ARB_depth_texture */\n\n/* -------------------------- GL_ARB_draw_buffers -------------------------- */\n\n#ifndef GL_ARB_draw_buffers\n#define GL_ARB_draw_buffers 1\n\n#define GL_MAX_DRAW_BUFFERS_ARB 0x8824\n#define GL_DRAW_BUFFER0_ARB 0x8825\n#define GL_DRAW_BUFFER1_ARB 0x8826\n#define GL_DRAW_BUFFER2_ARB 0x8827\n#define GL_DRAW_BUFFER3_ARB 0x8828\n#define GL_DRAW_BUFFER4_ARB 0x8829\n#define GL_DRAW_BUFFER5_ARB 0x882A\n#define GL_DRAW_BUFFER6_ARB 0x882B\n#define GL_DRAW_BUFFER7_ARB 0x882C\n#define GL_DRAW_BUFFER8_ARB 0x882D\n#define GL_DRAW_BUFFER9_ARB 0x882E\n#define GL_DRAW_BUFFER10_ARB 0x882F\n#define GL_DRAW_BUFFER11_ARB 0x8830\n#define GL_DRAW_BUFFER12_ARB 0x8831\n#define GL_DRAW_BUFFER13_ARB 0x8832\n#define GL_DRAW_BUFFER14_ARB 0x8833\n#define GL_DRAW_BUFFER15_ARB 0x8834\n\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum* bufs);\n\n#define glDrawBuffersARB GLEW_GET_FUN(__glewDrawBuffersARB)\n\n#define GLEW_ARB_draw_buffers GLEW_GET_VAR(__GLEW_ARB_draw_buffers)\n\n#endif /* GL_ARB_draw_buffers */\n\n/* ----------------------- GL_ARB_draw_buffers_blend ----------------------- */\n\n#ifndef GL_ARB_draw_buffers_blend\n#define GL_ARB_draw_buffers_blend 1\n\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);\n\n#define glBlendEquationSeparateiARB GLEW_GET_FUN(__glewBlendEquationSeparateiARB)\n#define glBlendEquationiARB GLEW_GET_FUN(__glewBlendEquationiARB)\n#define glBlendFuncSeparateiARB GLEW_GET_FUN(__glewBlendFuncSeparateiARB)\n#define glBlendFunciARB GLEW_GET_FUN(__glewBlendFunciARB)\n\n#define GLEW_ARB_draw_buffers_blend GLEW_GET_VAR(__GLEW_ARB_draw_buffers_blend)\n\n#endif /* GL_ARB_draw_buffers_blend */\n\n/* -------------------- GL_ARB_draw_elements_base_vertex ------------------- */\n\n#ifndef GL_ARB_draw_elements_base_vertex\n#define GL_ARB_draw_elements_base_vertex 1\n\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, void* indices, GLint basevertex);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLint basevertex);\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, void* indices, GLint basevertex);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei* count, GLenum type, GLvoid**indices, GLsizei primcount, GLint *basevertex);\n\n#define glDrawElementsBaseVertex GLEW_GET_FUN(__glewDrawElementsBaseVertex)\n#define glDrawElementsInstancedBaseVertex GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertex)\n#define glDrawRangeElementsBaseVertex GLEW_GET_FUN(__glewDrawRangeElementsBaseVertex)\n#define glMultiDrawElementsBaseVertex GLEW_GET_FUN(__glewMultiDrawElementsBaseVertex)\n\n#define GLEW_ARB_draw_elements_base_vertex GLEW_GET_VAR(__GLEW_ARB_draw_elements_base_vertex)\n\n#endif /* GL_ARB_draw_elements_base_vertex */\n\n/* -------------------------- GL_ARB_draw_indirect ------------------------- */\n\n#ifndef GL_ARB_draw_indirect\n#define GL_ARB_draw_indirect 1\n\n#define GL_DRAW_INDIRECT_BUFFER 0x8F3F\n#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43\n\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void* indirect);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void* indirect);\n\n#define glDrawArraysIndirect GLEW_GET_FUN(__glewDrawArraysIndirect)\n#define glDrawElementsIndirect GLEW_GET_FUN(__glewDrawElementsIndirect)\n\n#define GLEW_ARB_draw_indirect GLEW_GET_VAR(__GLEW_ARB_draw_indirect)\n\n#endif /* GL_ARB_draw_indirect */\n\n/* ------------------------- GL_ARB_draw_instanced ------------------------- */\n\n#ifndef GL_ARB_draw_instanced\n#define GL_ARB_draw_instanced 1\n\n#define GLEW_ARB_draw_instanced GLEW_GET_VAR(__GLEW_ARB_draw_instanced)\n\n#endif /* GL_ARB_draw_instanced */\n\n/* -------------------- GL_ARB_explicit_attrib_location -------------------- */\n\n#ifndef GL_ARB_explicit_attrib_location\n#define GL_ARB_explicit_attrib_location 1\n\n#define GLEW_ARB_explicit_attrib_location GLEW_GET_VAR(__GLEW_ARB_explicit_attrib_location)\n\n#endif /* GL_ARB_explicit_attrib_location */\n\n/* -------------------- GL_ARB_explicit_uniform_location ------------------- */\n\n#ifndef GL_ARB_explicit_uniform_location\n#define GL_ARB_explicit_uniform_location 1\n\n#define GL_MAX_UNIFORM_LOCATIONS 0x826E\n\n#define GLEW_ARB_explicit_uniform_location GLEW_GET_VAR(__GLEW_ARB_explicit_uniform_location)\n\n#endif /* GL_ARB_explicit_uniform_location */\n\n/* ------------------- GL_ARB_fragment_coord_conventions ------------------- */\n\n#ifndef GL_ARB_fragment_coord_conventions\n#define GL_ARB_fragment_coord_conventions 1\n\n#define GLEW_ARB_fragment_coord_conventions GLEW_GET_VAR(__GLEW_ARB_fragment_coord_conventions)\n\n#endif /* GL_ARB_fragment_coord_conventions */\n\n/* --------------------- GL_ARB_fragment_layer_viewport -------------------- */\n\n#ifndef GL_ARB_fragment_layer_viewport\n#define GL_ARB_fragment_layer_viewport 1\n\n#define GLEW_ARB_fragment_layer_viewport GLEW_GET_VAR(__GLEW_ARB_fragment_layer_viewport)\n\n#endif /* GL_ARB_fragment_layer_viewport */\n\n/* ------------------------ GL_ARB_fragment_program ------------------------ */\n\n#ifndef GL_ARB_fragment_program\n#define GL_ARB_fragment_program 1\n\n#define GL_FRAGMENT_PROGRAM_ARB 0x8804\n#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805\n#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806\n#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807\n#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808\n#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809\n#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A\n#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B\n#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C\n#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D\n#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E\n#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F\n#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810\n#define GL_MAX_TEXTURE_COORDS_ARB 0x8871\n#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872\n\n#define GLEW_ARB_fragment_program GLEW_GET_VAR(__GLEW_ARB_fragment_program)\n\n#endif /* GL_ARB_fragment_program */\n\n/* --------------------- GL_ARB_fragment_program_shadow -------------------- */\n\n#ifndef GL_ARB_fragment_program_shadow\n#define GL_ARB_fragment_program_shadow 1\n\n#define GLEW_ARB_fragment_program_shadow GLEW_GET_VAR(__GLEW_ARB_fragment_program_shadow)\n\n#endif /* GL_ARB_fragment_program_shadow */\n\n/* ------------------------- GL_ARB_fragment_shader ------------------------ */\n\n#ifndef GL_ARB_fragment_shader\n#define GL_ARB_fragment_shader 1\n\n#define GL_FRAGMENT_SHADER_ARB 0x8B30\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B\n\n#define GLEW_ARB_fragment_shader GLEW_GET_VAR(__GLEW_ARB_fragment_shader)\n\n#endif /* GL_ARB_fragment_shader */\n\n/* ------------------- GL_ARB_framebuffer_no_attachments ------------------- */\n\n#ifndef GL_ARB_framebuffer_no_attachments\n#define GL_ARB_framebuffer_no_attachments 1\n\n#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310\n#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311\n#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312\n#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313\n#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314\n#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315\n#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316\n#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317\n#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318\n\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);\n\n#define glFramebufferParameteri GLEW_GET_FUN(__glewFramebufferParameteri)\n#define glGetFramebufferParameteriv GLEW_GET_FUN(__glewGetFramebufferParameteriv)\n#define glGetNamedFramebufferParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferParameterivEXT)\n#define glNamedFramebufferParameteriEXT GLEW_GET_FUN(__glewNamedFramebufferParameteriEXT)\n\n#define GLEW_ARB_framebuffer_no_attachments GLEW_GET_VAR(__GLEW_ARB_framebuffer_no_attachments)\n\n#endif /* GL_ARB_framebuffer_no_attachments */\n\n/* ----------------------- GL_ARB_framebuffer_object ----------------------- */\n\n#ifndef GL_ARB_framebuffer_object\n#define GL_ARB_framebuffer_object 1\n\n#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506\n#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210\n#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211\n#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212\n#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213\n#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214\n#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215\n#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216\n#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217\n#define GL_FRAMEBUFFER_DEFAULT 0x8218\n#define GL_FRAMEBUFFER_UNDEFINED 0x8219\n#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A\n#define GL_INDEX 0x8222\n#define GL_MAX_RENDERBUFFER_SIZE 0x84E8\n#define GL_DEPTH_STENCIL 0x84F9\n#define GL_UNSIGNED_INT_24_8 0x84FA\n#define GL_DEPTH24_STENCIL8 0x88F0\n#define GL_TEXTURE_STENCIL_SIZE 0x88F1\n#define GL_UNSIGNED_NORMALIZED 0x8C17\n#define GL_SRGB 0x8C40\n#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6\n#define GL_FRAMEBUFFER_BINDING 0x8CA6\n#define GL_RENDERBUFFER_BINDING 0x8CA7\n#define GL_READ_FRAMEBUFFER 0x8CA8\n#define GL_DRAW_FRAMEBUFFER 0x8CA9\n#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA\n#define GL_RENDERBUFFER_SAMPLES 0x8CAB\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\n#define GL_FRAMEBUFFER_COMPLETE 0x8CD5\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC\n#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD\n#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF\n#define GL_COLOR_ATTACHMENT0 0x8CE0\n#define GL_COLOR_ATTACHMENT1 0x8CE1\n#define GL_COLOR_ATTACHMENT2 0x8CE2\n#define GL_COLOR_ATTACHMENT3 0x8CE3\n#define GL_COLOR_ATTACHMENT4 0x8CE4\n#define GL_COLOR_ATTACHMENT5 0x8CE5\n#define GL_COLOR_ATTACHMENT6 0x8CE6\n#define GL_COLOR_ATTACHMENT7 0x8CE7\n#define GL_COLOR_ATTACHMENT8 0x8CE8\n#define GL_COLOR_ATTACHMENT9 0x8CE9\n#define GL_COLOR_ATTACHMENT10 0x8CEA\n#define GL_COLOR_ATTACHMENT11 0x8CEB\n#define GL_COLOR_ATTACHMENT12 0x8CEC\n#define GL_COLOR_ATTACHMENT13 0x8CED\n#define GL_COLOR_ATTACHMENT14 0x8CEE\n#define GL_COLOR_ATTACHMENT15 0x8CEF\n#define GL_DEPTH_ATTACHMENT 0x8D00\n#define GL_STENCIL_ATTACHMENT 0x8D20\n#define GL_FRAMEBUFFER 0x8D40\n#define GL_RENDERBUFFER 0x8D41\n#define GL_RENDERBUFFER_WIDTH 0x8D42\n#define GL_RENDERBUFFER_HEIGHT 0x8D43\n#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44\n#define GL_STENCIL_INDEX1 0x8D46\n#define GL_STENCIL_INDEX4 0x8D47\n#define GL_STENCIL_INDEX8 0x8D48\n#define GL_STENCIL_INDEX16 0x8D49\n#define GL_RENDERBUFFER_RED_SIZE 0x8D50\n#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51\n#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52\n#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53\n#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54\n#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56\n#define GL_MAX_SAMPLES 0x8D57\n\ntypedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);\ntypedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\ntypedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);\ntypedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);\ntypedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers);\ntypedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers);\ntypedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);\ntypedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\n\n#define glBindFramebuffer GLEW_GET_FUN(__glewBindFramebuffer)\n#define glBindRenderbuffer GLEW_GET_FUN(__glewBindRenderbuffer)\n#define glBlitFramebuffer GLEW_GET_FUN(__glewBlitFramebuffer)\n#define glCheckFramebufferStatus GLEW_GET_FUN(__glewCheckFramebufferStatus)\n#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)\n#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)\n#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)\n#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)\n#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)\n#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)\n#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)\n#define glGenFramebuffers GLEW_GET_FUN(__glewGenFramebuffers)\n#define glGenRenderbuffers GLEW_GET_FUN(__glewGenRenderbuffers)\n#define glGenerateMipmap GLEW_GET_FUN(__glewGenerateMipmap)\n#define glGetFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetFramebufferAttachmentParameteriv)\n#define glGetRenderbufferParameteriv GLEW_GET_FUN(__glewGetRenderbufferParameteriv)\n#define glIsFramebuffer GLEW_GET_FUN(__glewIsFramebuffer)\n#define glIsRenderbuffer GLEW_GET_FUN(__glewIsRenderbuffer)\n#define glRenderbufferStorage GLEW_GET_FUN(__glewRenderbufferStorage)\n#define glRenderbufferStorageMultisample GLEW_GET_FUN(__glewRenderbufferStorageMultisample)\n\n#define GLEW_ARB_framebuffer_object GLEW_GET_VAR(__GLEW_ARB_framebuffer_object)\n\n#endif /* GL_ARB_framebuffer_object */\n\n/* ------------------------ GL_ARB_framebuffer_sRGB ------------------------ */\n\n#ifndef GL_ARB_framebuffer_sRGB\n#define GL_ARB_framebuffer_sRGB 1\n\n#define GL_FRAMEBUFFER_SRGB 0x8DB9\n\n#define GLEW_ARB_framebuffer_sRGB GLEW_GET_VAR(__GLEW_ARB_framebuffer_sRGB)\n\n#endif /* GL_ARB_framebuffer_sRGB */\n\n/* ------------------------ GL_ARB_geometry_shader4 ------------------------ */\n\n#ifndef GL_ARB_geometry_shader4\n#define GL_ARB_geometry_shader4 1\n\n#define GL_LINES_ADJACENCY_ARB 0xA\n#define GL_LINE_STRIP_ADJACENCY_ARB 0xB\n#define GL_TRIANGLES_ADJACENCY_ARB 0xC\n#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0xD\n#define GL_PROGRAM_POINT_SIZE_ARB 0x8642\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9\n#define GL_GEOMETRY_SHADER_ARB 0x8DD9\n#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA\n#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB\n#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC\n#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD\n#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1\n\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);\n\n#define glFramebufferTextureARB GLEW_GET_FUN(__glewFramebufferTextureARB)\n#define glFramebufferTextureFaceARB GLEW_GET_FUN(__glewFramebufferTextureFaceARB)\n#define glFramebufferTextureLayerARB GLEW_GET_FUN(__glewFramebufferTextureLayerARB)\n#define glProgramParameteriARB GLEW_GET_FUN(__glewProgramParameteriARB)\n\n#define GLEW_ARB_geometry_shader4 GLEW_GET_VAR(__GLEW_ARB_geometry_shader4)\n\n#endif /* GL_ARB_geometry_shader4 */\n\n/* ----------------------- GL_ARB_get_program_binary ----------------------- */\n\n#ifndef GL_ARB_get_program_binary\n#define GL_ARB_get_program_binary 1\n\n#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257\n#define GL_PROGRAM_BINARY_LENGTH 0x8741\n#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE\n#define GL_PROGRAM_BINARY_FORMATS 0x87FF\n\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, GLvoid*binary);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void* binary, GLsizei length);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);\n\n#define glGetProgramBinary GLEW_GET_FUN(__glewGetProgramBinary)\n#define glProgramBinary GLEW_GET_FUN(__glewProgramBinary)\n#define glProgramParameteri GLEW_GET_FUN(__glewProgramParameteri)\n\n#define GLEW_ARB_get_program_binary GLEW_GET_VAR(__GLEW_ARB_get_program_binary)\n\n#endif /* GL_ARB_get_program_binary */\n\n/* --------------------------- GL_ARB_gpu_shader5 -------------------------- */\n\n#ifndef GL_ARB_gpu_shader5\n#define GL_ARB_gpu_shader5 1\n\n#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\n#define GL_MAX_VERTEX_STREAMS 0x8E71\n\n#define GLEW_ARB_gpu_shader5 GLEW_GET_VAR(__GLEW_ARB_gpu_shader5)\n\n#endif /* GL_ARB_gpu_shader5 */\n\n/* ------------------------- GL_ARB_gpu_shader_fp64 ------------------------ */\n\n#ifndef GL_ARB_gpu_shader_fp64\n#define GL_ARB_gpu_shader_fp64 1\n\n#define GL_DOUBLE_MAT2 0x8F46\n#define GL_DOUBLE_MAT3 0x8F47\n#define GL_DOUBLE_MAT4 0x8F48\n#define GL_DOUBLE_MAT2x3 0x8F49\n#define GL_DOUBLE_MAT2x4 0x8F4A\n#define GL_DOUBLE_MAT3x2 0x8F4B\n#define GL_DOUBLE_MAT3x4 0x8F4C\n#define GL_DOUBLE_MAT4x2 0x8F4D\n#define GL_DOUBLE_MAT4x3 0x8F4E\n#define GL_DOUBLE_VEC2 0x8FFC\n#define GL_DOUBLE_VEC3 0x8FFD\n#define GL_DOUBLE_VEC4 0x8FFE\n\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\n\n#define glGetUniformdv GLEW_GET_FUN(__glewGetUniformdv)\n#define glUniform1d GLEW_GET_FUN(__glewUniform1d)\n#define glUniform1dv GLEW_GET_FUN(__glewUniform1dv)\n#define glUniform2d GLEW_GET_FUN(__glewUniform2d)\n#define glUniform2dv GLEW_GET_FUN(__glewUniform2dv)\n#define glUniform3d GLEW_GET_FUN(__glewUniform3d)\n#define glUniform3dv GLEW_GET_FUN(__glewUniform3dv)\n#define glUniform4d GLEW_GET_FUN(__glewUniform4d)\n#define glUniform4dv GLEW_GET_FUN(__glewUniform4dv)\n#define glUniformMatrix2dv GLEW_GET_FUN(__glewUniformMatrix2dv)\n#define glUniformMatrix2x3dv GLEW_GET_FUN(__glewUniformMatrix2x3dv)\n#define glUniformMatrix2x4dv GLEW_GET_FUN(__glewUniformMatrix2x4dv)\n#define glUniformMatrix3dv GLEW_GET_FUN(__glewUniformMatrix3dv)\n#define glUniformMatrix3x2dv GLEW_GET_FUN(__glewUniformMatrix3x2dv)\n#define glUniformMatrix3x4dv GLEW_GET_FUN(__glewUniformMatrix3x4dv)\n#define glUniformMatrix4dv GLEW_GET_FUN(__glewUniformMatrix4dv)\n#define glUniformMatrix4x2dv GLEW_GET_FUN(__glewUniformMatrix4x2dv)\n#define glUniformMatrix4x3dv GLEW_GET_FUN(__glewUniformMatrix4x3dv)\n\n#define GLEW_ARB_gpu_shader_fp64 GLEW_GET_VAR(__GLEW_ARB_gpu_shader_fp64)\n\n#endif /* GL_ARB_gpu_shader_fp64 */\n\n/* ------------------------ GL_ARB_half_float_pixel ------------------------ */\n\n#ifndef GL_ARB_half_float_pixel\n#define GL_ARB_half_float_pixel 1\n\n#define GL_HALF_FLOAT_ARB 0x140B\n\n#define GLEW_ARB_half_float_pixel GLEW_GET_VAR(__GLEW_ARB_half_float_pixel)\n\n#endif /* GL_ARB_half_float_pixel */\n\n/* ------------------------ GL_ARB_half_float_vertex ----------------------- */\n\n#ifndef GL_ARB_half_float_vertex\n#define GL_ARB_half_float_vertex 1\n\n#define GL_HALF_FLOAT 0x140B\n\n#define GLEW_ARB_half_float_vertex GLEW_GET_VAR(__GLEW_ARB_half_float_vertex)\n\n#endif /* GL_ARB_half_float_vertex */\n\n/* ----------------------------- GL_ARB_imaging ---------------------------- */\n\n#ifndef GL_ARB_imaging\n#define GL_ARB_imaging 1\n\n#define GL_CONSTANT_COLOR 0x8001\n#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002\n#define GL_CONSTANT_ALPHA 0x8003\n#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004\n#define GL_BLEND_COLOR 0x8005\n#define GL_FUNC_ADD 0x8006\n#define GL_MIN 0x8007\n#define GL_MAX 0x8008\n#define GL_BLEND_EQUATION 0x8009\n#define GL_FUNC_SUBTRACT 0x800A\n#define GL_FUNC_REVERSE_SUBTRACT 0x800B\n#define GL_CONVOLUTION_1D 0x8010\n#define GL_CONVOLUTION_2D 0x8011\n#define GL_SEPARABLE_2D 0x8012\n#define GL_CONVOLUTION_BORDER_MODE 0x8013\n#define GL_CONVOLUTION_FILTER_SCALE 0x8014\n#define GL_CONVOLUTION_FILTER_BIAS 0x8015\n#define GL_REDUCE 0x8016\n#define GL_CONVOLUTION_FORMAT 0x8017\n#define GL_CONVOLUTION_WIDTH 0x8018\n#define GL_CONVOLUTION_HEIGHT 0x8019\n#define GL_MAX_CONVOLUTION_WIDTH 0x801A\n#define GL_MAX_CONVOLUTION_HEIGHT 0x801B\n#define GL_POST_CONVOLUTION_RED_SCALE 0x801C\n#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D\n#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E\n#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F\n#define GL_POST_CONVOLUTION_RED_BIAS 0x8020\n#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021\n#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022\n#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023\n#define GL_HISTOGRAM 0x8024\n#define GL_PROXY_HISTOGRAM 0x8025\n#define GL_HISTOGRAM_WIDTH 0x8026\n#define GL_HISTOGRAM_FORMAT 0x8027\n#define GL_HISTOGRAM_RED_SIZE 0x8028\n#define GL_HISTOGRAM_GREEN_SIZE 0x8029\n#define GL_HISTOGRAM_BLUE_SIZE 0x802A\n#define GL_HISTOGRAM_ALPHA_SIZE 0x802B\n#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C\n#define GL_HISTOGRAM_SINK 0x802D\n#define GL_MINMAX 0x802E\n#define GL_MINMAX_FORMAT 0x802F\n#define GL_MINMAX_SINK 0x8030\n#define GL_TABLE_TOO_LARGE 0x8031\n#define GL_COLOR_MATRIX 0x80B1\n#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2\n#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3\n#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4\n#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5\n#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6\n#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7\n#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8\n#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9\n#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA\n#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB\n#define GL_COLOR_TABLE 0x80D0\n#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1\n#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2\n#define GL_PROXY_COLOR_TABLE 0x80D3\n#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4\n#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5\n#define GL_COLOR_TABLE_SCALE 0x80D6\n#define GL_COLOR_TABLE_BIAS 0x80D7\n#define GL_COLOR_TABLE_FORMAT 0x80D8\n#define GL_COLOR_TABLE_WIDTH 0x80D9\n#define GL_COLOR_TABLE_RED_SIZE 0x80DA\n#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB\n#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC\n#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD\n#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE\n#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF\n#define GL_IGNORE_BORDER 0x8150\n#define GL_CONSTANT_BORDER 0x8151\n#define GL_WRAP_BORDER 0x8152\n#define GL_REPLICATE_BORDER 0x8153\n#define GL_CONVOLUTION_BORDER_COLOR 0x8154\n\ntypedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values);\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\ntypedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);\ntypedef void (GLAPIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\ntypedef void (GLAPIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);\ntypedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLRESETMINMAXPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);\n\n#define glColorSubTable GLEW_GET_FUN(__glewColorSubTable)\n#define glColorTable GLEW_GET_FUN(__glewColorTable)\n#define glColorTableParameterfv GLEW_GET_FUN(__glewColorTableParameterfv)\n#define glColorTableParameteriv GLEW_GET_FUN(__glewColorTableParameteriv)\n#define glConvolutionFilter1D GLEW_GET_FUN(__glewConvolutionFilter1D)\n#define glConvolutionFilter2D GLEW_GET_FUN(__glewConvolutionFilter2D)\n#define glConvolutionParameterf GLEW_GET_FUN(__glewConvolutionParameterf)\n#define glConvolutionParameterfv GLEW_GET_FUN(__glewConvolutionParameterfv)\n#define glConvolutionParameteri GLEW_GET_FUN(__glewConvolutionParameteri)\n#define glConvolutionParameteriv GLEW_GET_FUN(__glewConvolutionParameteriv)\n#define glCopyColorSubTable GLEW_GET_FUN(__glewCopyColorSubTable)\n#define glCopyColorTable GLEW_GET_FUN(__glewCopyColorTable)\n#define glCopyConvolutionFilter1D GLEW_GET_FUN(__glewCopyConvolutionFilter1D)\n#define glCopyConvolutionFilter2D GLEW_GET_FUN(__glewCopyConvolutionFilter2D)\n#define glGetColorTable GLEW_GET_FUN(__glewGetColorTable)\n#define glGetColorTableParameterfv GLEW_GET_FUN(__glewGetColorTableParameterfv)\n#define glGetColorTableParameteriv GLEW_GET_FUN(__glewGetColorTableParameteriv)\n#define glGetConvolutionFilter GLEW_GET_FUN(__glewGetConvolutionFilter)\n#define glGetConvolutionParameterfv GLEW_GET_FUN(__glewGetConvolutionParameterfv)\n#define glGetConvolutionParameteriv GLEW_GET_FUN(__glewGetConvolutionParameteriv)\n#define glGetHistogram GLEW_GET_FUN(__glewGetHistogram)\n#define glGetHistogramParameterfv GLEW_GET_FUN(__glewGetHistogramParameterfv)\n#define glGetHistogramParameteriv GLEW_GET_FUN(__glewGetHistogramParameteriv)\n#define glGetMinmax GLEW_GET_FUN(__glewGetMinmax)\n#define glGetMinmaxParameterfv GLEW_GET_FUN(__glewGetMinmaxParameterfv)\n#define glGetMinmaxParameteriv GLEW_GET_FUN(__glewGetMinmaxParameteriv)\n#define glGetSeparableFilter GLEW_GET_FUN(__glewGetSeparableFilter)\n#define glHistogram GLEW_GET_FUN(__glewHistogram)\n#define glMinmax GLEW_GET_FUN(__glewMinmax)\n#define glResetHistogram GLEW_GET_FUN(__glewResetHistogram)\n#define glResetMinmax GLEW_GET_FUN(__glewResetMinmax)\n#define glSeparableFilter2D GLEW_GET_FUN(__glewSeparableFilter2D)\n\n#define GLEW_ARB_imaging GLEW_GET_VAR(__GLEW_ARB_imaging)\n\n#endif /* GL_ARB_imaging */\n\n/* ------------------------ GL_ARB_instanced_arrays ------------------------ */\n\n#ifndef GL_ARB_instanced_arrays\n#define GL_ARB_instanced_arrays 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE\n\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);\n\n#define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB)\n#define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB)\n#define glVertexAttribDivisorARB GLEW_GET_FUN(__glewVertexAttribDivisorARB)\n\n#define GLEW_ARB_instanced_arrays GLEW_GET_VAR(__GLEW_ARB_instanced_arrays)\n\n#endif /* GL_ARB_instanced_arrays */\n\n/* ---------------------- GL_ARB_internalformat_query ---------------------- */\n\n#ifndef GL_ARB_internalformat_query\n#define GL_ARB_internalformat_query 1\n\n#define GL_NUM_SAMPLE_COUNTS 0x9380\n\ntypedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);\n\n#define glGetInternalformativ GLEW_GET_FUN(__glewGetInternalformativ)\n\n#define GLEW_ARB_internalformat_query GLEW_GET_VAR(__GLEW_ARB_internalformat_query)\n\n#endif /* GL_ARB_internalformat_query */\n\n/* ---------------------- GL_ARB_internalformat_query2 --------------------- */\n\n#ifndef GL_ARB_internalformat_query2\n#define GL_ARB_internalformat_query2 1\n\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_TEXTURE_3D 0x806F\n#define GL_SAMPLES 0x80A9\n#define GL_INTERNALFORMAT_SUPPORTED 0x826F\n#define GL_INTERNALFORMAT_PREFERRED 0x8270\n#define GL_INTERNALFORMAT_RED_SIZE 0x8271\n#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272\n#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273\n#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274\n#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275\n#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276\n#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277\n#define GL_INTERNALFORMAT_RED_TYPE 0x8278\n#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279\n#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A\n#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B\n#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C\n#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D\n#define GL_MAX_WIDTH 0x827E\n#define GL_MAX_HEIGHT 0x827F\n#define GL_MAX_DEPTH 0x8280\n#define GL_MAX_LAYERS 0x8281\n#define GL_MAX_COMBINED_DIMENSIONS 0x8282\n#define GL_COLOR_COMPONENTS 0x8283\n#define GL_DEPTH_COMPONENTS 0x8284\n#define GL_STENCIL_COMPONENTS 0x8285\n#define GL_COLOR_RENDERABLE 0x8286\n#define GL_DEPTH_RENDERABLE 0x8287\n#define GL_STENCIL_RENDERABLE 0x8288\n#define GL_FRAMEBUFFER_RENDERABLE 0x8289\n#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A\n#define GL_FRAMEBUFFER_BLEND 0x828B\n#define GL_READ_PIXELS 0x828C\n#define GL_READ_PIXELS_FORMAT 0x828D\n#define GL_READ_PIXELS_TYPE 0x828E\n#define GL_TEXTURE_IMAGE_FORMAT 0x828F\n#define GL_TEXTURE_IMAGE_TYPE 0x8290\n#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291\n#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292\n#define GL_MIPMAP 0x8293\n#define GL_MANUAL_GENERATE_MIPMAP 0x8294\n#define GL_AUTO_GENERATE_MIPMAP 0x8295\n#define GL_COLOR_ENCODING 0x8296\n#define GL_SRGB_READ 0x8297\n#define GL_SRGB_WRITE 0x8298\n#define GL_SRGB_DECODE_ARB 0x8299\n#define GL_FILTER 0x829A\n#define GL_VERTEX_TEXTURE 0x829B\n#define GL_TESS_CONTROL_TEXTURE 0x829C\n#define GL_TESS_EVALUATION_TEXTURE 0x829D\n#define GL_GEOMETRY_TEXTURE 0x829E\n#define GL_FRAGMENT_TEXTURE 0x829F\n#define GL_COMPUTE_TEXTURE 0x82A0\n#define GL_TEXTURE_SHADOW 0x82A1\n#define GL_TEXTURE_GATHER 0x82A2\n#define GL_TEXTURE_GATHER_SHADOW 0x82A3\n#define GL_SHADER_IMAGE_LOAD 0x82A4\n#define GL_SHADER_IMAGE_STORE 0x82A5\n#define GL_SHADER_IMAGE_ATOMIC 0x82A6\n#define GL_IMAGE_TEXEL_SIZE 0x82A7\n#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8\n#define GL_IMAGE_PIXEL_FORMAT 0x82A9\n#define GL_IMAGE_PIXEL_TYPE 0x82AA\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF\n#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1\n#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2\n#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3\n#define GL_CLEAR_BUFFER 0x82B4\n#define GL_TEXTURE_VIEW 0x82B5\n#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6\n#define GL_FULL_SUPPORT 0x82B7\n#define GL_CAVEAT_SUPPORT 0x82B8\n#define GL_IMAGE_CLASS_4_X_32 0x82B9\n#define GL_IMAGE_CLASS_2_X_32 0x82BA\n#define GL_IMAGE_CLASS_1_X_32 0x82BB\n#define GL_IMAGE_CLASS_4_X_16 0x82BC\n#define GL_IMAGE_CLASS_2_X_16 0x82BD\n#define GL_IMAGE_CLASS_1_X_16 0x82BE\n#define GL_IMAGE_CLASS_4_X_8 0x82BF\n#define GL_IMAGE_CLASS_2_X_8 0x82C0\n#define GL_IMAGE_CLASS_1_X_8 0x82C1\n#define GL_IMAGE_CLASS_11_11_10 0x82C2\n#define GL_IMAGE_CLASS_10_10_10_2 0x82C3\n#define GL_VIEW_CLASS_128_BITS 0x82C4\n#define GL_VIEW_CLASS_96_BITS 0x82C5\n#define GL_VIEW_CLASS_64_BITS 0x82C6\n#define GL_VIEW_CLASS_48_BITS 0x82C7\n#define GL_VIEW_CLASS_32_BITS 0x82C8\n#define GL_VIEW_CLASS_24_BITS 0x82C9\n#define GL_VIEW_CLASS_16_BITS 0x82CA\n#define GL_VIEW_CLASS_8_BITS 0x82CB\n#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC\n#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD\n#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE\n#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF\n#define GL_VIEW_CLASS_RGTC1_RED 0x82D0\n#define GL_VIEW_CLASS_RGTC2_RG 0x82D1\n#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2\n#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3\n#define GL_TEXTURE_RECTANGLE 0x84F5\n#define GL_TEXTURE_1D_ARRAY 0x8C18\n#define GL_TEXTURE_2D_ARRAY 0x8C1A\n#define GL_TEXTURE_BUFFER 0x8C2A\n#define GL_RENDERBUFFER 0x8D41\n#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009\n#define GL_TEXTURE_2D_MULTISAMPLE 0x9100\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102\n#define GL_NUM_SAMPLE_COUNTS 0x9380\n\ntypedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params);\n\n#define glGetInternalformati64v GLEW_GET_FUN(__glewGetInternalformati64v)\n\n#define GLEW_ARB_internalformat_query2 GLEW_GET_VAR(__GLEW_ARB_internalformat_query2)\n\n#endif /* GL_ARB_internalformat_query2 */\n\n/* ----------------------- GL_ARB_invalidate_subdata ----------------------- */\n\n#ifndef GL_ARB_invalidate_subdata\n#define GL_ARB_invalidate_subdata 1\n\ntypedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);\ntypedef void (GLAPIENTRY * PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments);\ntypedef void (GLAPIENTRY * PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\n\n#define glInvalidateBufferData GLEW_GET_FUN(__glewInvalidateBufferData)\n#define glInvalidateBufferSubData GLEW_GET_FUN(__glewInvalidateBufferSubData)\n#define glInvalidateFramebuffer GLEW_GET_FUN(__glewInvalidateFramebuffer)\n#define glInvalidateSubFramebuffer GLEW_GET_FUN(__glewInvalidateSubFramebuffer)\n#define glInvalidateTexImage GLEW_GET_FUN(__glewInvalidateTexImage)\n#define glInvalidateTexSubImage GLEW_GET_FUN(__glewInvalidateTexSubImage)\n\n#define GLEW_ARB_invalidate_subdata GLEW_GET_VAR(__GLEW_ARB_invalidate_subdata)\n\n#endif /* GL_ARB_invalidate_subdata */\n\n/* ---------------------- GL_ARB_map_buffer_alignment ---------------------- */\n\n#ifndef GL_ARB_map_buffer_alignment\n#define GL_ARB_map_buffer_alignment 1\n\n#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC\n\n#define GLEW_ARB_map_buffer_alignment GLEW_GET_VAR(__GLEW_ARB_map_buffer_alignment)\n\n#endif /* GL_ARB_map_buffer_alignment */\n\n/* ------------------------ GL_ARB_map_buffer_range ------------------------ */\n\n#ifndef GL_ARB_map_buffer_range\n#define GL_ARB_map_buffer_range 1\n\n#define GL_MAP_READ_BIT 0x0001\n#define GL_MAP_WRITE_BIT 0x0002\n#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004\n#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008\n#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010\n#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020\n\ntypedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\n\n#define glFlushMappedBufferRange GLEW_GET_FUN(__glewFlushMappedBufferRange)\n#define glMapBufferRange GLEW_GET_FUN(__glewMapBufferRange)\n\n#define GLEW_ARB_map_buffer_range GLEW_GET_VAR(__GLEW_ARB_map_buffer_range)\n\n#endif /* GL_ARB_map_buffer_range */\n\n/* ------------------------- GL_ARB_matrix_palette ------------------------- */\n\n#ifndef GL_ARB_matrix_palette\n#define GL_ARB_matrix_palette 1\n\n#define GL_MATRIX_PALETTE_ARB 0x8840\n#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841\n#define GL_MAX_PALETTE_MATRICES_ARB 0x8842\n#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843\n#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844\n#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845\n#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846\n#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847\n#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848\n#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849\n\ntypedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, GLubyte *indices);\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, GLuint *indices);\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, GLushort *indices);\n\n#define glCurrentPaletteMatrixARB GLEW_GET_FUN(__glewCurrentPaletteMatrixARB)\n#define glMatrixIndexPointerARB GLEW_GET_FUN(__glewMatrixIndexPointerARB)\n#define glMatrixIndexubvARB GLEW_GET_FUN(__glewMatrixIndexubvARB)\n#define glMatrixIndexuivARB GLEW_GET_FUN(__glewMatrixIndexuivARB)\n#define glMatrixIndexusvARB GLEW_GET_FUN(__glewMatrixIndexusvARB)\n\n#define GLEW_ARB_matrix_palette GLEW_GET_VAR(__GLEW_ARB_matrix_palette)\n\n#endif /* GL_ARB_matrix_palette */\n\n/* ----------------------- GL_ARB_multi_draw_indirect ---------------------- */\n\n#ifndef GL_ARB_multi_draw_indirect\n#define GL_ARB_multi_draw_indirect 1\n\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride);\n\n#define glMultiDrawArraysIndirect GLEW_GET_FUN(__glewMultiDrawArraysIndirect)\n#define glMultiDrawElementsIndirect GLEW_GET_FUN(__glewMultiDrawElementsIndirect)\n\n#define GLEW_ARB_multi_draw_indirect GLEW_GET_VAR(__GLEW_ARB_multi_draw_indirect)\n\n#endif /* GL_ARB_multi_draw_indirect */\n\n/* --------------------------- GL_ARB_multisample -------------------------- */\n\n#ifndef GL_ARB_multisample\n#define GL_ARB_multisample 1\n\n#define GL_MULTISAMPLE_ARB 0x809D\n#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F\n#define GL_SAMPLE_COVERAGE_ARB 0x80A0\n#define GL_SAMPLE_BUFFERS_ARB 0x80A8\n#define GL_SAMPLES_ARB 0x80A9\n#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA\n#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB\n#define GL_MULTISAMPLE_BIT_ARB 0x20000000\n\ntypedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);\n\n#define glSampleCoverageARB GLEW_GET_FUN(__glewSampleCoverageARB)\n\n#define GLEW_ARB_multisample GLEW_GET_VAR(__GLEW_ARB_multisample)\n\n#endif /* GL_ARB_multisample */\n\n/* -------------------------- GL_ARB_multitexture -------------------------- */\n\n#ifndef GL_ARB_multitexture\n#define GL_ARB_multitexture 1\n\n#define GL_TEXTURE0_ARB 0x84C0\n#define GL_TEXTURE1_ARB 0x84C1\n#define GL_TEXTURE2_ARB 0x84C2\n#define GL_TEXTURE3_ARB 0x84C3\n#define GL_TEXTURE4_ARB 0x84C4\n#define GL_TEXTURE5_ARB 0x84C5\n#define GL_TEXTURE6_ARB 0x84C6\n#define GL_TEXTURE7_ARB 0x84C7\n#define GL_TEXTURE8_ARB 0x84C8\n#define GL_TEXTURE9_ARB 0x84C9\n#define GL_TEXTURE10_ARB 0x84CA\n#define GL_TEXTURE11_ARB 0x84CB\n#define GL_TEXTURE12_ARB 0x84CC\n#define GL_TEXTURE13_ARB 0x84CD\n#define GL_TEXTURE14_ARB 0x84CE\n#define GL_TEXTURE15_ARB 0x84CF\n#define GL_TEXTURE16_ARB 0x84D0\n#define GL_TEXTURE17_ARB 0x84D1\n#define GL_TEXTURE18_ARB 0x84D2\n#define GL_TEXTURE19_ARB 0x84D3\n#define GL_TEXTURE20_ARB 0x84D4\n#define GL_TEXTURE21_ARB 0x84D5\n#define GL_TEXTURE22_ARB 0x84D6\n#define GL_TEXTURE23_ARB 0x84D7\n#define GL_TEXTURE24_ARB 0x84D8\n#define GL_TEXTURE25_ARB 0x84D9\n#define GL_TEXTURE26_ARB 0x84DA\n#define GL_TEXTURE27_ARB 0x84DB\n#define GL_TEXTURE28_ARB 0x84DC\n#define GL_TEXTURE29_ARB 0x84DD\n#define GL_TEXTURE30_ARB 0x84DE\n#define GL_TEXTURE31_ARB 0x84DF\n#define GL_ACTIVE_TEXTURE_ARB 0x84E0\n#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1\n#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2\n\ntypedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);\n\n#define glActiveTextureARB GLEW_GET_FUN(__glewActiveTextureARB)\n#define glClientActiveTextureARB GLEW_GET_FUN(__glewClientActiveTextureARB)\n#define glMultiTexCoord1dARB GLEW_GET_FUN(__glewMultiTexCoord1dARB)\n#define glMultiTexCoord1dvARB GLEW_GET_FUN(__glewMultiTexCoord1dvARB)\n#define glMultiTexCoord1fARB GLEW_GET_FUN(__glewMultiTexCoord1fARB)\n#define glMultiTexCoord1fvARB GLEW_GET_FUN(__glewMultiTexCoord1fvARB)\n#define glMultiTexCoord1iARB GLEW_GET_FUN(__glewMultiTexCoord1iARB)\n#define glMultiTexCoord1ivARB GLEW_GET_FUN(__glewMultiTexCoord1ivARB)\n#define glMultiTexCoord1sARB GLEW_GET_FUN(__glewMultiTexCoord1sARB)\n#define glMultiTexCoord1svARB GLEW_GET_FUN(__glewMultiTexCoord1svARB)\n#define glMultiTexCoord2dARB GLEW_GET_FUN(__glewMultiTexCoord2dARB)\n#define glMultiTexCoord2dvARB GLEW_GET_FUN(__glewMultiTexCoord2dvARB)\n#define glMultiTexCoord2fARB GLEW_GET_FUN(__glewMultiTexCoord2fARB)\n#define glMultiTexCoord2fvARB GLEW_GET_FUN(__glewMultiTexCoord2fvARB)\n#define glMultiTexCoord2iARB GLEW_GET_FUN(__glewMultiTexCoord2iARB)\n#define glMultiTexCoord2ivARB GLEW_GET_FUN(__glewMultiTexCoord2ivARB)\n#define glMultiTexCoord2sARB GLEW_GET_FUN(__glewMultiTexCoord2sARB)\n#define glMultiTexCoord2svARB GLEW_GET_FUN(__glewMultiTexCoord2svARB)\n#define glMultiTexCoord3dARB GLEW_GET_FUN(__glewMultiTexCoord3dARB)\n#define glMultiTexCoord3dvARB GLEW_GET_FUN(__glewMultiTexCoord3dvARB)\n#define glMultiTexCoord3fARB GLEW_GET_FUN(__glewMultiTexCoord3fARB)\n#define glMultiTexCoord3fvARB GLEW_GET_FUN(__glewMultiTexCoord3fvARB)\n#define glMultiTexCoord3iARB GLEW_GET_FUN(__glewMultiTexCoord3iARB)\n#define glMultiTexCoord3ivARB GLEW_GET_FUN(__glewMultiTexCoord3ivARB)\n#define glMultiTexCoord3sARB GLEW_GET_FUN(__glewMultiTexCoord3sARB)\n#define glMultiTexCoord3svARB GLEW_GET_FUN(__glewMultiTexCoord3svARB)\n#define glMultiTexCoord4dARB GLEW_GET_FUN(__glewMultiTexCoord4dARB)\n#define glMultiTexCoord4dvARB GLEW_GET_FUN(__glewMultiTexCoord4dvARB)\n#define glMultiTexCoord4fARB GLEW_GET_FUN(__glewMultiTexCoord4fARB)\n#define glMultiTexCoord4fvARB GLEW_GET_FUN(__glewMultiTexCoord4fvARB)\n#define glMultiTexCoord4iARB GLEW_GET_FUN(__glewMultiTexCoord4iARB)\n#define glMultiTexCoord4ivARB GLEW_GET_FUN(__glewMultiTexCoord4ivARB)\n#define glMultiTexCoord4sARB GLEW_GET_FUN(__glewMultiTexCoord4sARB)\n#define glMultiTexCoord4svARB GLEW_GET_FUN(__glewMultiTexCoord4svARB)\n\n#define GLEW_ARB_multitexture GLEW_GET_VAR(__GLEW_ARB_multitexture)\n\n#endif /* GL_ARB_multitexture */\n\n/* ------------------------- GL_ARB_occlusion_query ------------------------ */\n\n#ifndef GL_ARB_occlusion_query\n#define GL_ARB_occlusion_query 1\n\n#define GL_QUERY_COUNTER_BITS_ARB 0x8864\n#define GL_CURRENT_QUERY_ARB 0x8865\n#define GL_QUERY_RESULT_ARB 0x8866\n#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867\n#define GL_SAMPLES_PASSED_ARB 0x8914\n\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id);\n\n#define glBeginQueryARB GLEW_GET_FUN(__glewBeginQueryARB)\n#define glDeleteQueriesARB GLEW_GET_FUN(__glewDeleteQueriesARB)\n#define glEndQueryARB GLEW_GET_FUN(__glewEndQueryARB)\n#define glGenQueriesARB GLEW_GET_FUN(__glewGenQueriesARB)\n#define glGetQueryObjectivARB GLEW_GET_FUN(__glewGetQueryObjectivARB)\n#define glGetQueryObjectuivARB GLEW_GET_FUN(__glewGetQueryObjectuivARB)\n#define glGetQueryivARB GLEW_GET_FUN(__glewGetQueryivARB)\n#define glIsQueryARB GLEW_GET_FUN(__glewIsQueryARB)\n\n#define GLEW_ARB_occlusion_query GLEW_GET_VAR(__GLEW_ARB_occlusion_query)\n\n#endif /* GL_ARB_occlusion_query */\n\n/* ------------------------ GL_ARB_occlusion_query2 ------------------------ */\n\n#ifndef GL_ARB_occlusion_query2\n#define GL_ARB_occlusion_query2 1\n\n#define GL_ANY_SAMPLES_PASSED 0x8C2F\n\n#define GLEW_ARB_occlusion_query2 GLEW_GET_VAR(__GLEW_ARB_occlusion_query2)\n\n#endif /* GL_ARB_occlusion_query2 */\n\n/* ----------------------- GL_ARB_pixel_buffer_object ---------------------- */\n\n#ifndef GL_ARB_pixel_buffer_object\n#define GL_ARB_pixel_buffer_object 1\n\n#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF\n\n#define GLEW_ARB_pixel_buffer_object GLEW_GET_VAR(__GLEW_ARB_pixel_buffer_object)\n\n#endif /* GL_ARB_pixel_buffer_object */\n\n/* ------------------------ GL_ARB_point_parameters ------------------------ */\n\n#ifndef GL_ARB_point_parameters\n#define GL_ARB_point_parameters 1\n\n#define GL_POINT_SIZE_MIN_ARB 0x8126\n#define GL_POINT_SIZE_MAX_ARB 0x8127\n#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128\n#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129\n\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat* params);\n\n#define glPointParameterfARB GLEW_GET_FUN(__glewPointParameterfARB)\n#define glPointParameterfvARB GLEW_GET_FUN(__glewPointParameterfvARB)\n\n#define GLEW_ARB_point_parameters GLEW_GET_VAR(__GLEW_ARB_point_parameters)\n\n#endif /* GL_ARB_point_parameters */\n\n/* -------------------------- GL_ARB_point_sprite -------------------------- */\n\n#ifndef GL_ARB_point_sprite\n#define GL_ARB_point_sprite 1\n\n#define GL_POINT_SPRITE_ARB 0x8861\n#define GL_COORD_REPLACE_ARB 0x8862\n\n#define GLEW_ARB_point_sprite GLEW_GET_VAR(__GLEW_ARB_point_sprite)\n\n#endif /* GL_ARB_point_sprite */\n\n/* --------------------- GL_ARB_program_interface_query -------------------- */\n\n#ifndef GL_ARB_program_interface_query\n#define GL_ARB_program_interface_query 1\n\n#define GL_UNIFORM 0x92E1\n#define GL_UNIFORM_BLOCK 0x92E2\n#define GL_PROGRAM_INPUT 0x92E3\n#define GL_PROGRAM_OUTPUT 0x92E4\n#define GL_BUFFER_VARIABLE 0x92E5\n#define GL_SHADER_STORAGE_BLOCK 0x92E6\n#define GL_IS_PER_PATCH 0x92E7\n#define GL_VERTEX_SUBROUTINE 0x92E8\n#define GL_TESS_CONTROL_SUBROUTINE 0x92E9\n#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA\n#define GL_GEOMETRY_SUBROUTINE 0x92EB\n#define GL_FRAGMENT_SUBROUTINE 0x92EC\n#define GL_COMPUTE_SUBROUTINE 0x92ED\n#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE\n#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF\n#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0\n#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1\n#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2\n#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3\n#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4\n#define GL_ACTIVE_RESOURCES 0x92F5\n#define GL_MAX_NAME_LENGTH 0x92F6\n#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7\n#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8\n#define GL_NAME_LENGTH 0x92F9\n#define GL_TYPE 0x92FA\n#define GL_ARRAY_SIZE 0x92FB\n#define GL_OFFSET 0x92FC\n#define GL_BLOCK_INDEX 0x92FD\n#define GL_ARRAY_STRIDE 0x92FE\n#define GL_MATRIX_STRIDE 0x92FF\n#define GL_IS_ROW_MAJOR 0x9300\n#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301\n#define GL_BUFFER_BINDING 0x9302\n#define GL_BUFFER_DATA_SIZE 0x9303\n#define GL_NUM_ACTIVE_VARIABLES 0x9304\n#define GL_ACTIVE_VARIABLES 0x9305\n#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306\n#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307\n#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308\n#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309\n#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A\n#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B\n#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C\n#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D\n#define GL_LOCATION 0x930E\n#define GL_LOCATION_INDEX 0x930F\n\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint* params);\ntypedef GLuint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name);\ntypedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar* name);\ntypedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLint *params);\n\n#define glGetProgramInterfaceiv GLEW_GET_FUN(__glewGetProgramInterfaceiv)\n#define glGetProgramResourceIndex GLEW_GET_FUN(__glewGetProgramResourceIndex)\n#define glGetProgramResourceLocation GLEW_GET_FUN(__glewGetProgramResourceLocation)\n#define glGetProgramResourceLocationIndex GLEW_GET_FUN(__glewGetProgramResourceLocationIndex)\n#define glGetProgramResourceName GLEW_GET_FUN(__glewGetProgramResourceName)\n#define glGetProgramResourceiv GLEW_GET_FUN(__glewGetProgramResourceiv)\n\n#define GLEW_ARB_program_interface_query GLEW_GET_VAR(__GLEW_ARB_program_interface_query)\n\n#endif /* GL_ARB_program_interface_query */\n\n/* ------------------------ GL_ARB_provoking_vertex ------------------------ */\n\n#ifndef GL_ARB_provoking_vertex\n#define GL_ARB_provoking_vertex 1\n\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C\n#define GL_FIRST_VERTEX_CONVENTION 0x8E4D\n#define GL_LAST_VERTEX_CONVENTION 0x8E4E\n#define GL_PROVOKING_VERTEX 0x8E4F\n\ntypedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXPROC) (GLenum mode);\n\n#define glProvokingVertex GLEW_GET_FUN(__glewProvokingVertex)\n\n#define GLEW_ARB_provoking_vertex GLEW_GET_VAR(__GLEW_ARB_provoking_vertex)\n\n#endif /* GL_ARB_provoking_vertex */\n\n/* ------------------ GL_ARB_robust_buffer_access_behavior ----------------- */\n\n#ifndef GL_ARB_robust_buffer_access_behavior\n#define GL_ARB_robust_buffer_access_behavior 1\n\n#define GLEW_ARB_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_ARB_robust_buffer_access_behavior)\n\n#endif /* GL_ARB_robust_buffer_access_behavior */\n\n/* --------------------------- GL_ARB_robustness --------------------------- */\n\n#ifndef GL_ARB_robustness\n#define GL_ARB_robustness 1\n\n#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253\n#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254\n#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255\n#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define GL_NO_RESET_NOTIFICATION_ARB 0x8261\n\ntypedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table);\ntypedef void (GLAPIENTRY * PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void* img);\ntypedef void (GLAPIENTRY * PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image);\ntypedef void (GLAPIENTRY * PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values);\ntypedef void (GLAPIENTRY * PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint* v);\ntypedef void (GLAPIENTRY * PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values);\ntypedef void (GLAPIENTRY * PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat* values);\ntypedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint* values);\ntypedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort* values);\ntypedef void (GLAPIENTRY * PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte* pattern);\ntypedef void (GLAPIENTRY * PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, GLvoid*column, GLvoid*span);\ntypedef void (GLAPIENTRY * PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* img);\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data);\n\n#define glGetGraphicsResetStatusARB GLEW_GET_FUN(__glewGetGraphicsResetStatusARB)\n#define glGetnColorTableARB GLEW_GET_FUN(__glewGetnColorTableARB)\n#define glGetnCompressedTexImageARB GLEW_GET_FUN(__glewGetnCompressedTexImageARB)\n#define glGetnConvolutionFilterARB GLEW_GET_FUN(__glewGetnConvolutionFilterARB)\n#define glGetnHistogramARB GLEW_GET_FUN(__glewGetnHistogramARB)\n#define glGetnMapdvARB GLEW_GET_FUN(__glewGetnMapdvARB)\n#define glGetnMapfvARB GLEW_GET_FUN(__glewGetnMapfvARB)\n#define glGetnMapivARB GLEW_GET_FUN(__glewGetnMapivARB)\n#define glGetnMinmaxARB GLEW_GET_FUN(__glewGetnMinmaxARB)\n#define glGetnPixelMapfvARB GLEW_GET_FUN(__glewGetnPixelMapfvARB)\n#define glGetnPixelMapuivARB GLEW_GET_FUN(__glewGetnPixelMapuivARB)\n#define glGetnPixelMapusvARB GLEW_GET_FUN(__glewGetnPixelMapusvARB)\n#define glGetnPolygonStippleARB GLEW_GET_FUN(__glewGetnPolygonStippleARB)\n#define glGetnSeparableFilterARB GLEW_GET_FUN(__glewGetnSeparableFilterARB)\n#define glGetnTexImageARB GLEW_GET_FUN(__glewGetnTexImageARB)\n#define glGetnUniformdvARB GLEW_GET_FUN(__glewGetnUniformdvARB)\n#define glGetnUniformfvARB GLEW_GET_FUN(__glewGetnUniformfvARB)\n#define glGetnUniformivARB GLEW_GET_FUN(__glewGetnUniformivARB)\n#define glGetnUniformuivARB GLEW_GET_FUN(__glewGetnUniformuivARB)\n#define glReadnPixelsARB GLEW_GET_FUN(__glewReadnPixelsARB)\n\n#define GLEW_ARB_robustness GLEW_GET_VAR(__GLEW_ARB_robustness)\n\n#endif /* GL_ARB_robustness */\n\n/* ---------------- GL_ARB_robustness_application_isolation ---------------- */\n\n#ifndef GL_ARB_robustness_application_isolation\n#define GL_ARB_robustness_application_isolation 1\n\n#define GLEW_ARB_robustness_application_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_application_isolation)\n\n#endif /* GL_ARB_robustness_application_isolation */\n\n/* ---------------- GL_ARB_robustness_share_group_isolation ---------------- */\n\n#ifndef GL_ARB_robustness_share_group_isolation\n#define GL_ARB_robustness_share_group_isolation 1\n\n#define GLEW_ARB_robustness_share_group_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_share_group_isolation)\n\n#endif /* GL_ARB_robustness_share_group_isolation */\n\n/* ------------------------- GL_ARB_sample_shading ------------------------- */\n\n#ifndef GL_ARB_sample_shading\n#define GL_ARB_sample_shading 1\n\n#define GL_SAMPLE_SHADING_ARB 0x8C36\n#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37\n\ntypedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value);\n\n#define glMinSampleShadingARB GLEW_GET_FUN(__glewMinSampleShadingARB)\n\n#define GLEW_ARB_sample_shading GLEW_GET_VAR(__GLEW_ARB_sample_shading)\n\n#endif /* GL_ARB_sample_shading */\n\n/* ------------------------- GL_ARB_sampler_objects ------------------------ */\n\n#ifndef GL_ARB_sampler_objects\n#define GL_ARB_sampler_objects 1\n\n#define GL_SAMPLER_BINDING 0x8919\n\ntypedef void (GLAPIENTRY * PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);\ntypedef void (GLAPIENTRY * PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint * samplers);\ntypedef void (GLAPIENTRY * PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint* samplers);\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISSAMPLERPROC) (GLuint sampler);\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint* params);\n\n#define glBindSampler GLEW_GET_FUN(__glewBindSampler)\n#define glDeleteSamplers GLEW_GET_FUN(__glewDeleteSamplers)\n#define glGenSamplers GLEW_GET_FUN(__glewGenSamplers)\n#define glGetSamplerParameterIiv GLEW_GET_FUN(__glewGetSamplerParameterIiv)\n#define glGetSamplerParameterIuiv GLEW_GET_FUN(__glewGetSamplerParameterIuiv)\n#define glGetSamplerParameterfv GLEW_GET_FUN(__glewGetSamplerParameterfv)\n#define glGetSamplerParameteriv GLEW_GET_FUN(__glewGetSamplerParameteriv)\n#define glIsSampler GLEW_GET_FUN(__glewIsSampler)\n#define glSamplerParameterIiv GLEW_GET_FUN(__glewSamplerParameterIiv)\n#define glSamplerParameterIuiv GLEW_GET_FUN(__glewSamplerParameterIuiv)\n#define glSamplerParameterf GLEW_GET_FUN(__glewSamplerParameterf)\n#define glSamplerParameterfv GLEW_GET_FUN(__glewSamplerParameterfv)\n#define glSamplerParameteri GLEW_GET_FUN(__glewSamplerParameteri)\n#define glSamplerParameteriv GLEW_GET_FUN(__glewSamplerParameteriv)\n\n#define GLEW_ARB_sampler_objects GLEW_GET_VAR(__GLEW_ARB_sampler_objects)\n\n#endif /* GL_ARB_sampler_objects */\n\n/* ------------------------ GL_ARB_seamless_cube_map ----------------------- */\n\n#ifndef GL_ARB_seamless_cube_map\n#define GL_ARB_seamless_cube_map 1\n\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F\n\n#define GLEW_ARB_seamless_cube_map GLEW_GET_VAR(__GLEW_ARB_seamless_cube_map)\n\n#endif /* GL_ARB_seamless_cube_map */\n\n/* --------------------- GL_ARB_separate_shader_objects -------------------- */\n\n#ifndef GL_ARB_separate_shader_objects\n#define GL_ARB_separate_shader_objects 1\n\n#define GL_VERTEX_SHADER_BIT 0x00000001\n#define GL_FRAGMENT_SHADER_BIT 0x00000002\n#define GL_GEOMETRY_SHADER_BIT 0x00000004\n#define GL_TESS_CONTROL_SHADER_BIT 0x00000008\n#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010\n#define GL_PROGRAM_SEPARABLE 0x8258\n#define GL_ACTIVE_PROGRAM 0x8259\n#define GL_PROGRAM_PIPELINE_BINDING 0x825A\n#define GL_ALL_SHADER_BITS 0xFFFFFFFF\n\ntypedef void (GLAPIENTRY * PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);\ntypedef void (GLAPIENTRY * PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar ** strings);\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint* pipelines);\ntypedef void (GLAPIENTRY * PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar *infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint x, GLuint y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);\n\n#define glActiveShaderProgram GLEW_GET_FUN(__glewActiveShaderProgram)\n#define glBindProgramPipeline GLEW_GET_FUN(__glewBindProgramPipeline)\n#define glCreateShaderProgramv GLEW_GET_FUN(__glewCreateShaderProgramv)\n#define glDeleteProgramPipelines GLEW_GET_FUN(__glewDeleteProgramPipelines)\n#define glGenProgramPipelines GLEW_GET_FUN(__glewGenProgramPipelines)\n#define glGetProgramPipelineInfoLog GLEW_GET_FUN(__glewGetProgramPipelineInfoLog)\n#define glGetProgramPipelineiv GLEW_GET_FUN(__glewGetProgramPipelineiv)\n#define glIsProgramPipeline GLEW_GET_FUN(__glewIsProgramPipeline)\n#define glProgramUniform1d GLEW_GET_FUN(__glewProgramUniform1d)\n#define glProgramUniform1dv GLEW_GET_FUN(__glewProgramUniform1dv)\n#define glProgramUniform1f GLEW_GET_FUN(__glewProgramUniform1f)\n#define glProgramUniform1fv GLEW_GET_FUN(__glewProgramUniform1fv)\n#define glProgramUniform1i GLEW_GET_FUN(__glewProgramUniform1i)\n#define glProgramUniform1iv GLEW_GET_FUN(__glewProgramUniform1iv)\n#define glProgramUniform1ui GLEW_GET_FUN(__glewProgramUniform1ui)\n#define glProgramUniform1uiv GLEW_GET_FUN(__glewProgramUniform1uiv)\n#define glProgramUniform2d GLEW_GET_FUN(__glewProgramUniform2d)\n#define glProgramUniform2dv GLEW_GET_FUN(__glewProgramUniform2dv)\n#define glProgramUniform2f GLEW_GET_FUN(__glewProgramUniform2f)\n#define glProgramUniform2fv GLEW_GET_FUN(__glewProgramUniform2fv)\n#define glProgramUniform2i GLEW_GET_FUN(__glewProgramUniform2i)\n#define glProgramUniform2iv GLEW_GET_FUN(__glewProgramUniform2iv)\n#define glProgramUniform2ui GLEW_GET_FUN(__glewProgramUniform2ui)\n#define glProgramUniform2uiv GLEW_GET_FUN(__glewProgramUniform2uiv)\n#define glProgramUniform3d GLEW_GET_FUN(__glewProgramUniform3d)\n#define glProgramUniform3dv GLEW_GET_FUN(__glewProgramUniform3dv)\n#define glProgramUniform3f GLEW_GET_FUN(__glewProgramUniform3f)\n#define glProgramUniform3fv GLEW_GET_FUN(__glewProgramUniform3fv)\n#define glProgramUniform3i GLEW_GET_FUN(__glewProgramUniform3i)\n#define glProgramUniform3iv GLEW_GET_FUN(__glewProgramUniform3iv)\n#define glProgramUniform3ui GLEW_GET_FUN(__glewProgramUniform3ui)\n#define glProgramUniform3uiv GLEW_GET_FUN(__glewProgramUniform3uiv)\n#define glProgramUniform4d GLEW_GET_FUN(__glewProgramUniform4d)\n#define glProgramUniform4dv GLEW_GET_FUN(__glewProgramUniform4dv)\n#define glProgramUniform4f GLEW_GET_FUN(__glewProgramUniform4f)\n#define glProgramUniform4fv GLEW_GET_FUN(__glewProgramUniform4fv)\n#define glProgramUniform4i GLEW_GET_FUN(__glewProgramUniform4i)\n#define glProgramUniform4iv GLEW_GET_FUN(__glewProgramUniform4iv)\n#define glProgramUniform4ui GLEW_GET_FUN(__glewProgramUniform4ui)\n#define glProgramUniform4uiv GLEW_GET_FUN(__glewProgramUniform4uiv)\n#define glProgramUniformMatrix2dv GLEW_GET_FUN(__glewProgramUniformMatrix2dv)\n#define glProgramUniformMatrix2fv GLEW_GET_FUN(__glewProgramUniformMatrix2fv)\n#define glProgramUniformMatrix2x3dv GLEW_GET_FUN(__glewProgramUniformMatrix2x3dv)\n#define glProgramUniformMatrix2x3fv GLEW_GET_FUN(__glewProgramUniformMatrix2x3fv)\n#define glProgramUniformMatrix2x4dv GLEW_GET_FUN(__glewProgramUniformMatrix2x4dv)\n#define glProgramUniformMatrix2x4fv GLEW_GET_FUN(__glewProgramUniformMatrix2x4fv)\n#define glProgramUniformMatrix3dv GLEW_GET_FUN(__glewProgramUniformMatrix3dv)\n#define glProgramUniformMatrix3fv GLEW_GET_FUN(__glewProgramUniformMatrix3fv)\n#define glProgramUniformMatrix3x2dv GLEW_GET_FUN(__glewProgramUniformMatrix3x2dv)\n#define glProgramUniformMatrix3x2fv GLEW_GET_FUN(__glewProgramUniformMatrix3x2fv)\n#define glProgramUniformMatrix3x4dv GLEW_GET_FUN(__glewProgramUniformMatrix3x4dv)\n#define glProgramUniformMatrix3x4fv GLEW_GET_FUN(__glewProgramUniformMatrix3x4fv)\n#define glProgramUniformMatrix4dv GLEW_GET_FUN(__glewProgramUniformMatrix4dv)\n#define glProgramUniformMatrix4fv GLEW_GET_FUN(__glewProgramUniformMatrix4fv)\n#define glProgramUniformMatrix4x2dv GLEW_GET_FUN(__glewProgramUniformMatrix4x2dv)\n#define glProgramUniformMatrix4x2fv GLEW_GET_FUN(__glewProgramUniformMatrix4x2fv)\n#define glProgramUniformMatrix4x3dv GLEW_GET_FUN(__glewProgramUniformMatrix4x3dv)\n#define glProgramUniformMatrix4x3fv GLEW_GET_FUN(__glewProgramUniformMatrix4x3fv)\n#define glUseProgramStages GLEW_GET_FUN(__glewUseProgramStages)\n#define glValidateProgramPipeline GLEW_GET_FUN(__glewValidateProgramPipeline)\n\n#define GLEW_ARB_separate_shader_objects GLEW_GET_VAR(__GLEW_ARB_separate_shader_objects)\n\n#endif /* GL_ARB_separate_shader_objects */\n\n/* --------------------- GL_ARB_shader_atomic_counters --------------------- */\n\n#ifndef GL_ARB_shader_atomic_counters\n#define GL_ARB_shader_atomic_counters 1\n\n#define GL_ATOMIC_COUNTER_BUFFER 0x92C0\n#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1\n#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2\n#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3\n#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB\n#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0\n#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1\n#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6\n#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8\n#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9\n#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA\n#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC\n\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint* params);\n\n#define glGetActiveAtomicCounterBufferiv GLEW_GET_FUN(__glewGetActiveAtomicCounterBufferiv)\n\n#define GLEW_ARB_shader_atomic_counters GLEW_GET_VAR(__GLEW_ARB_shader_atomic_counters)\n\n#endif /* GL_ARB_shader_atomic_counters */\n\n/* ----------------------- GL_ARB_shader_bit_encoding ---------------------- */\n\n#ifndef GL_ARB_shader_bit_encoding\n#define GL_ARB_shader_bit_encoding 1\n\n#define GLEW_ARB_shader_bit_encoding GLEW_GET_VAR(__GLEW_ARB_shader_bit_encoding)\n\n#endif /* GL_ARB_shader_bit_encoding */\n\n/* --------------------- GL_ARB_shader_image_load_store -------------------- */\n\n#ifndef GL_ARB_shader_image_load_store\n#define GL_ARB_shader_image_load_store 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001\n#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002\n#define GL_UNIFORM_BARRIER_BIT 0x00000004\n#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020\n#define GL_COMMAND_BARRIER_BIT 0x00000040\n#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080\n#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100\n#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200\n#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800\n#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000\n#define GL_MAX_IMAGE_UNITS 0x8F38\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39\n#define GL_IMAGE_BINDING_NAME 0x8F3A\n#define GL_IMAGE_BINDING_LEVEL 0x8F3B\n#define GL_IMAGE_BINDING_LAYERED 0x8F3C\n#define GL_IMAGE_BINDING_LAYER 0x8F3D\n#define GL_IMAGE_BINDING_ACCESS 0x8F3E\n#define GL_IMAGE_1D 0x904C\n#define GL_IMAGE_2D 0x904D\n#define GL_IMAGE_3D 0x904E\n#define GL_IMAGE_2D_RECT 0x904F\n#define GL_IMAGE_CUBE 0x9050\n#define GL_IMAGE_BUFFER 0x9051\n#define GL_IMAGE_1D_ARRAY 0x9052\n#define GL_IMAGE_2D_ARRAY 0x9053\n#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054\n#define GL_IMAGE_2D_MULTISAMPLE 0x9055\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056\n#define GL_INT_IMAGE_1D 0x9057\n#define GL_INT_IMAGE_2D 0x9058\n#define GL_INT_IMAGE_3D 0x9059\n#define GL_INT_IMAGE_2D_RECT 0x905A\n#define GL_INT_IMAGE_CUBE 0x905B\n#define GL_INT_IMAGE_BUFFER 0x905C\n#define GL_INT_IMAGE_1D_ARRAY 0x905D\n#define GL_INT_IMAGE_2D_ARRAY 0x905E\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F\n#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061\n#define GL_UNSIGNED_INT_IMAGE_1D 0x9062\n#define GL_UNSIGNED_INT_IMAGE_2D 0x9063\n#define GL_UNSIGNED_INT_IMAGE_3D 0x9064\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065\n#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066\n#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C\n#define GL_MAX_IMAGE_SAMPLES 0x906D\n#define GL_IMAGE_BINDING_FORMAT 0x906E\n#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9\n#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA\n#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB\n#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC\n#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD\n#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE\n#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF\n#define GL_ALL_BARRIER_BITS 0xFFFFFFFF\n\ntypedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\ntypedef void (GLAPIENTRY * PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);\n\n#define glBindImageTexture GLEW_GET_FUN(__glewBindImageTexture)\n#define glMemoryBarrier GLEW_GET_FUN(__glewMemoryBarrier)\n\n#define GLEW_ARB_shader_image_load_store GLEW_GET_VAR(__GLEW_ARB_shader_image_load_store)\n\n#endif /* GL_ARB_shader_image_load_store */\n\n/* ------------------------ GL_ARB_shader_image_size ----------------------- */\n\n#ifndef GL_ARB_shader_image_size\n#define GL_ARB_shader_image_size 1\n\n#define GLEW_ARB_shader_image_size GLEW_GET_VAR(__GLEW_ARB_shader_image_size)\n\n#endif /* GL_ARB_shader_image_size */\n\n/* ------------------------- GL_ARB_shader_objects ------------------------- */\n\n#ifndef GL_ARB_shader_objects\n#define GL_ARB_shader_objects 1\n\n#define GL_PROGRAM_OBJECT_ARB 0x8B40\n#define GL_SHADER_OBJECT_ARB 0x8B48\n#define GL_OBJECT_TYPE_ARB 0x8B4E\n#define GL_OBJECT_SUBTYPE_ARB 0x8B4F\n#define GL_FLOAT_VEC2_ARB 0x8B50\n#define GL_FLOAT_VEC3_ARB 0x8B51\n#define GL_FLOAT_VEC4_ARB 0x8B52\n#define GL_INT_VEC2_ARB 0x8B53\n#define GL_INT_VEC3_ARB 0x8B54\n#define GL_INT_VEC4_ARB 0x8B55\n#define GL_BOOL_ARB 0x8B56\n#define GL_BOOL_VEC2_ARB 0x8B57\n#define GL_BOOL_VEC3_ARB 0x8B58\n#define GL_BOOL_VEC4_ARB 0x8B59\n#define GL_FLOAT_MAT2_ARB 0x8B5A\n#define GL_FLOAT_MAT3_ARB 0x8B5B\n#define GL_FLOAT_MAT4_ARB 0x8B5C\n#define GL_SAMPLER_1D_ARB 0x8B5D\n#define GL_SAMPLER_2D_ARB 0x8B5E\n#define GL_SAMPLER_3D_ARB 0x8B5F\n#define GL_SAMPLER_CUBE_ARB 0x8B60\n#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61\n#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62\n#define GL_SAMPLER_2D_RECT_ARB 0x8B63\n#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64\n#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80\n#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81\n#define GL_OBJECT_LINK_STATUS_ARB 0x8B82\n#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83\n#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84\n#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85\n#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86\n#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87\n#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88\n\ntypedef char GLcharARB;\ntypedef unsigned int GLhandleARB;\n\ntypedef void (GLAPIENTRY * PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);\ntypedef GLhandleARB (GLAPIENTRY * PFNGLCREATEPROGRAMOBJECTARBPROC) (void);\ntypedef GLhandleARB (GLAPIENTRY * PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);\ntypedef void (GLAPIENTRY * PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);\ntypedef void (GLAPIENTRY * PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name);\ntypedef void (GLAPIENTRY * PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei* count, GLhandleARB *obj);\ntypedef GLhandleARB (GLAPIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname);\ntypedef void (GLAPIENTRY * PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *source);\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);\ntypedef void (GLAPIENTRY * PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint *length);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);\n\n#define glAttachObjectARB GLEW_GET_FUN(__glewAttachObjectARB)\n#define glCompileShaderARB GLEW_GET_FUN(__glewCompileShaderARB)\n#define glCreateProgramObjectARB GLEW_GET_FUN(__glewCreateProgramObjectARB)\n#define glCreateShaderObjectARB GLEW_GET_FUN(__glewCreateShaderObjectARB)\n#define glDeleteObjectARB GLEW_GET_FUN(__glewDeleteObjectARB)\n#define glDetachObjectARB GLEW_GET_FUN(__glewDetachObjectARB)\n#define glGetActiveUniformARB GLEW_GET_FUN(__glewGetActiveUniformARB)\n#define glGetAttachedObjectsARB GLEW_GET_FUN(__glewGetAttachedObjectsARB)\n#define glGetHandleARB GLEW_GET_FUN(__glewGetHandleARB)\n#define glGetInfoLogARB GLEW_GET_FUN(__glewGetInfoLogARB)\n#define glGetObjectParameterfvARB GLEW_GET_FUN(__glewGetObjectParameterfvARB)\n#define glGetObjectParameterivARB GLEW_GET_FUN(__glewGetObjectParameterivARB)\n#define glGetShaderSourceARB GLEW_GET_FUN(__glewGetShaderSourceARB)\n#define glGetUniformLocationARB GLEW_GET_FUN(__glewGetUniformLocationARB)\n#define glGetUniformfvARB GLEW_GET_FUN(__glewGetUniformfvARB)\n#define glGetUniformivARB GLEW_GET_FUN(__glewGetUniformivARB)\n#define glLinkProgramARB GLEW_GET_FUN(__glewLinkProgramARB)\n#define glShaderSourceARB GLEW_GET_FUN(__glewShaderSourceARB)\n#define glUniform1fARB GLEW_GET_FUN(__glewUniform1fARB)\n#define glUniform1fvARB GLEW_GET_FUN(__glewUniform1fvARB)\n#define glUniform1iARB GLEW_GET_FUN(__glewUniform1iARB)\n#define glUniform1ivARB GLEW_GET_FUN(__glewUniform1ivARB)\n#define glUniform2fARB GLEW_GET_FUN(__glewUniform2fARB)\n#define glUniform2fvARB GLEW_GET_FUN(__glewUniform2fvARB)\n#define glUniform2iARB GLEW_GET_FUN(__glewUniform2iARB)\n#define glUniform2ivARB GLEW_GET_FUN(__glewUniform2ivARB)\n#define glUniform3fARB GLEW_GET_FUN(__glewUniform3fARB)\n#define glUniform3fvARB GLEW_GET_FUN(__glewUniform3fvARB)\n#define glUniform3iARB GLEW_GET_FUN(__glewUniform3iARB)\n#define glUniform3ivARB GLEW_GET_FUN(__glewUniform3ivARB)\n#define glUniform4fARB GLEW_GET_FUN(__glewUniform4fARB)\n#define glUniform4fvARB GLEW_GET_FUN(__glewUniform4fvARB)\n#define glUniform4iARB GLEW_GET_FUN(__glewUniform4iARB)\n#define glUniform4ivARB GLEW_GET_FUN(__glewUniform4ivARB)\n#define glUniformMatrix2fvARB GLEW_GET_FUN(__glewUniformMatrix2fvARB)\n#define glUniformMatrix3fvARB GLEW_GET_FUN(__glewUniformMatrix3fvARB)\n#define glUniformMatrix4fvARB GLEW_GET_FUN(__glewUniformMatrix4fvARB)\n#define glUseProgramObjectARB GLEW_GET_FUN(__glewUseProgramObjectARB)\n#define glValidateProgramARB GLEW_GET_FUN(__glewValidateProgramARB)\n\n#define GLEW_ARB_shader_objects GLEW_GET_VAR(__GLEW_ARB_shader_objects)\n\n#endif /* GL_ARB_shader_objects */\n\n/* ------------------------ GL_ARB_shader_precision ------------------------ */\n\n#ifndef GL_ARB_shader_precision\n#define GL_ARB_shader_precision 1\n\n#define GLEW_ARB_shader_precision GLEW_GET_VAR(__GLEW_ARB_shader_precision)\n\n#endif /* GL_ARB_shader_precision */\n\n/* ---------------------- GL_ARB_shader_stencil_export --------------------- */\n\n#ifndef GL_ARB_shader_stencil_export\n#define GL_ARB_shader_stencil_export 1\n\n#define GLEW_ARB_shader_stencil_export GLEW_GET_VAR(__GLEW_ARB_shader_stencil_export)\n\n#endif /* GL_ARB_shader_stencil_export */\n\n/* ------------------ GL_ARB_shader_storage_buffer_object ------------------ */\n\n#ifndef GL_ARB_shader_storage_buffer_object\n#define GL_ARB_shader_storage_buffer_object 1\n\n#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000\n#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39\n#define GL_SHADER_STORAGE_BUFFER 0x90D2\n#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3\n#define GL_SHADER_STORAGE_BUFFER_START 0x90D4\n#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5\n#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6\n#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7\n#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8\n#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9\n#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA\n#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB\n#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC\n#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD\n#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE\n#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF\n\ntypedef void (GLAPIENTRY * PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\n\n#define glShaderStorageBlockBinding GLEW_GET_FUN(__glewShaderStorageBlockBinding)\n\n#define GLEW_ARB_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_ARB_shader_storage_buffer_object)\n\n#endif /* GL_ARB_shader_storage_buffer_object */\n\n/* ------------------------ GL_ARB_shader_subroutine ----------------------- */\n\n#ifndef GL_ARB_shader_subroutine\n#define GL_ARB_shader_subroutine 1\n\n#define GL_ACTIVE_SUBROUTINES 0x8DE5\n#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6\n#define GL_MAX_SUBROUTINES 0x8DE7\n#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47\n#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49\n#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A\n#define GL_COMPATIBLE_SUBROUTINES 0x8E4B\n\ntypedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint* values);\ntypedef GLuint (GLAPIENTRY * PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar* name);\ntypedef GLint (GLAPIENTRY * PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint* indices);\n\n#define glGetActiveSubroutineName GLEW_GET_FUN(__glewGetActiveSubroutineName)\n#define glGetActiveSubroutineUniformName GLEW_GET_FUN(__glewGetActiveSubroutineUniformName)\n#define glGetActiveSubroutineUniformiv GLEW_GET_FUN(__glewGetActiveSubroutineUniformiv)\n#define glGetProgramStageiv GLEW_GET_FUN(__glewGetProgramStageiv)\n#define glGetSubroutineIndex GLEW_GET_FUN(__glewGetSubroutineIndex)\n#define glGetSubroutineUniformLocation GLEW_GET_FUN(__glewGetSubroutineUniformLocation)\n#define glGetUniformSubroutineuiv GLEW_GET_FUN(__glewGetUniformSubroutineuiv)\n#define glUniformSubroutinesuiv GLEW_GET_FUN(__glewUniformSubroutinesuiv)\n\n#define GLEW_ARB_shader_subroutine GLEW_GET_VAR(__GLEW_ARB_shader_subroutine)\n\n#endif /* GL_ARB_shader_subroutine */\n\n/* ----------------------- GL_ARB_shader_texture_lod ----------------------- */\n\n#ifndef GL_ARB_shader_texture_lod\n#define GL_ARB_shader_texture_lod 1\n\n#define GLEW_ARB_shader_texture_lod GLEW_GET_VAR(__GLEW_ARB_shader_texture_lod)\n\n#endif /* GL_ARB_shader_texture_lod */\n\n/* ---------------------- GL_ARB_shading_language_100 ---------------------- */\n\n#ifndef GL_ARB_shading_language_100\n#define GL_ARB_shading_language_100 1\n\n#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C\n\n#define GLEW_ARB_shading_language_100 GLEW_GET_VAR(__GLEW_ARB_shading_language_100)\n\n#endif /* GL_ARB_shading_language_100 */\n\n/* -------------------- GL_ARB_shading_language_420pack -------------------- */\n\n#ifndef GL_ARB_shading_language_420pack\n#define GL_ARB_shading_language_420pack 1\n\n#define GLEW_ARB_shading_language_420pack GLEW_GET_VAR(__GLEW_ARB_shading_language_420pack)\n\n#endif /* GL_ARB_shading_language_420pack */\n\n/* -------------------- GL_ARB_shading_language_include -------------------- */\n\n#ifndef GL_ARB_shading_language_include\n#define GL_ARB_shading_language_include 1\n\n#define GL_SHADER_INCLUDE_ARB 0x8DAE\n#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9\n#define GL_NAMED_STRING_TYPE_ARB 0x8DEA\n\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar ** path, const GLint *length);\ntypedef void (GLAPIENTRY * PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name, GLsizei bufSize, GLint *stringlen, GLchar *string);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar* name, GLenum pname, GLint *params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar* name, GLint stringlen, const GLchar *string);\n\n#define glCompileShaderIncludeARB GLEW_GET_FUN(__glewCompileShaderIncludeARB)\n#define glDeleteNamedStringARB GLEW_GET_FUN(__glewDeleteNamedStringARB)\n#define glGetNamedStringARB GLEW_GET_FUN(__glewGetNamedStringARB)\n#define glGetNamedStringivARB GLEW_GET_FUN(__glewGetNamedStringivARB)\n#define glIsNamedStringARB GLEW_GET_FUN(__glewIsNamedStringARB)\n#define glNamedStringARB GLEW_GET_FUN(__glewNamedStringARB)\n\n#define GLEW_ARB_shading_language_include GLEW_GET_VAR(__GLEW_ARB_shading_language_include)\n\n#endif /* GL_ARB_shading_language_include */\n\n/* -------------------- GL_ARB_shading_language_packing -------------------- */\n\n#ifndef GL_ARB_shading_language_packing\n#define GL_ARB_shading_language_packing 1\n\n#define GLEW_ARB_shading_language_packing GLEW_GET_VAR(__GLEW_ARB_shading_language_packing)\n\n#endif /* GL_ARB_shading_language_packing */\n\n/* ----------------------------- GL_ARB_shadow ----------------------------- */\n\n#ifndef GL_ARB_shadow\n#define GL_ARB_shadow 1\n\n#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C\n#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D\n#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E\n\n#define GLEW_ARB_shadow GLEW_GET_VAR(__GLEW_ARB_shadow)\n\n#endif /* GL_ARB_shadow */\n\n/* ------------------------- GL_ARB_shadow_ambient ------------------------- */\n\n#ifndef GL_ARB_shadow_ambient\n#define GL_ARB_shadow_ambient 1\n\n#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF\n\n#define GLEW_ARB_shadow_ambient GLEW_GET_VAR(__GLEW_ARB_shadow_ambient)\n\n#endif /* GL_ARB_shadow_ambient */\n\n/* ------------------------ GL_ARB_stencil_texturing ----------------------- */\n\n#ifndef GL_ARB_stencil_texturing\n#define GL_ARB_stencil_texturing 1\n\n#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA\n\n#define GLEW_ARB_stencil_texturing GLEW_GET_VAR(__GLEW_ARB_stencil_texturing)\n\n#endif /* GL_ARB_stencil_texturing */\n\n/* ------------------------------ GL_ARB_sync ------------------------------ */\n\n#ifndef GL_ARB_sync\n#define GL_ARB_sync 1\n\n#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001\n#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111\n#define GL_OBJECT_TYPE 0x9112\n#define GL_SYNC_CONDITION 0x9113\n#define GL_SYNC_STATUS 0x9114\n#define GL_SYNC_FLAGS 0x9115\n#define GL_SYNC_FENCE 0x9116\n#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117\n#define GL_UNSIGNALED 0x9118\n#define GL_SIGNALED 0x9119\n#define GL_ALREADY_SIGNALED 0x911A\n#define GL_TIMEOUT_EXPIRED 0x911B\n#define GL_CONDITION_SATISFIED 0x911C\n#define GL_WAIT_FAILED 0x911D\n#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF\n\ntypedef GLenum (GLAPIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout);\ntypedef void (GLAPIENTRY * PFNGLDELETESYNCPROC) (GLsync GLsync);\ntypedef GLsync (GLAPIENTRY * PFNGLFENCESYNCPROC) (GLenum condition,GLbitfield flags);\ntypedef void (GLAPIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64* params);\ntypedef void (GLAPIENTRY * PFNGLGETSYNCIVPROC) (GLsync GLsync,GLenum pname,GLsizei bufSize,GLsizei* length, GLint *values);\ntypedef GLboolean (GLAPIENTRY * PFNGLISSYNCPROC) (GLsync GLsync);\ntypedef void (GLAPIENTRY * PFNGLWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout);\n\n#define glClientWaitSync GLEW_GET_FUN(__glewClientWaitSync)\n#define glDeleteSync GLEW_GET_FUN(__glewDeleteSync)\n#define glFenceSync GLEW_GET_FUN(__glewFenceSync)\n#define glGetInteger64v GLEW_GET_FUN(__glewGetInteger64v)\n#define glGetSynciv GLEW_GET_FUN(__glewGetSynciv)\n#define glIsSync GLEW_GET_FUN(__glewIsSync)\n#define glWaitSync GLEW_GET_FUN(__glewWaitSync)\n\n#define GLEW_ARB_sync GLEW_GET_VAR(__GLEW_ARB_sync)\n\n#endif /* GL_ARB_sync */\n\n/* ----------------------- GL_ARB_tessellation_shader ---------------------- */\n\n#ifndef GL_ARB_tessellation_shader\n#define GL_ARB_tessellation_shader 1\n\n#define GL_PATCHES 0xE\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1\n#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C\n#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D\n#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E\n#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F\n#define GL_PATCH_VERTICES 0x8E72\n#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73\n#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74\n#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75\n#define GL_TESS_GEN_MODE 0x8E76\n#define GL_TESS_GEN_SPACING 0x8E77\n#define GL_TESS_GEN_VERTEX_ORDER 0x8E78\n#define GL_TESS_GEN_POINT_MODE 0x8E79\n#define GL_ISOLINES 0x8E7A\n#define GL_FRACTIONAL_ODD 0x8E7B\n#define GL_FRACTIONAL_EVEN 0x8E7C\n#define GL_MAX_PATCH_VERTICES 0x8E7D\n#define GL_MAX_TESS_GEN_LEVEL 0x8E7E\n#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F\n#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80\n#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81\n#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82\n#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83\n#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84\n#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85\n#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86\n#define GL_TESS_EVALUATION_SHADER 0x8E87\n#define GL_TESS_CONTROL_SHADER 0x8E88\n#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89\n#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A\n\ntypedef void (GLAPIENTRY * PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat* values);\ntypedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);\n\n#define glPatchParameterfv GLEW_GET_FUN(__glewPatchParameterfv)\n#define glPatchParameteri GLEW_GET_FUN(__glewPatchParameteri)\n\n#define GLEW_ARB_tessellation_shader GLEW_GET_VAR(__GLEW_ARB_tessellation_shader)\n\n#endif /* GL_ARB_tessellation_shader */\n\n/* ---------------------- GL_ARB_texture_border_clamp ---------------------- */\n\n#ifndef GL_ARB_texture_border_clamp\n#define GL_ARB_texture_border_clamp 1\n\n#define GL_CLAMP_TO_BORDER_ARB 0x812D\n\n#define GLEW_ARB_texture_border_clamp GLEW_GET_VAR(__GLEW_ARB_texture_border_clamp)\n\n#endif /* GL_ARB_texture_border_clamp */\n\n/* ---------------------- GL_ARB_texture_buffer_object --------------------- */\n\n#ifndef GL_ARB_texture_buffer_object\n#define GL_ARB_texture_buffer_object 1\n\n#define GL_TEXTURE_BUFFER_ARB 0x8C2A\n#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B\n#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D\n#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E\n\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);\n\n#define glTexBufferARB GLEW_GET_FUN(__glewTexBufferARB)\n\n#define GLEW_ARB_texture_buffer_object GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object)\n\n#endif /* GL_ARB_texture_buffer_object */\n\n/* ------------------- GL_ARB_texture_buffer_object_rgb32 ------------------ */\n\n#ifndef GL_ARB_texture_buffer_object_rgb32\n#define GL_ARB_texture_buffer_object_rgb32 1\n\n#define GLEW_ARB_texture_buffer_object_rgb32 GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object_rgb32)\n\n#endif /* GL_ARB_texture_buffer_object_rgb32 */\n\n/* ---------------------- GL_ARB_texture_buffer_range ---------------------- */\n\n#ifndef GL_ARB_texture_buffer_range\n#define GL_ARB_texture_buffer_range 1\n\n#define GL_TEXTURE_BUFFER_OFFSET 0x919D\n#define GL_TEXTURE_BUFFER_SIZE 0x919E\n#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F\n\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\n\n#define glTexBufferRange GLEW_GET_FUN(__glewTexBufferRange)\n#define glTextureBufferRangeEXT GLEW_GET_FUN(__glewTextureBufferRangeEXT)\n\n#define GLEW_ARB_texture_buffer_range GLEW_GET_VAR(__GLEW_ARB_texture_buffer_range)\n\n#endif /* GL_ARB_texture_buffer_range */\n\n/* ----------------------- GL_ARB_texture_compression ---------------------- */\n\n#ifndef GL_ARB_texture_compression\n#define GL_ARB_texture_compression 1\n\n#define GL_COMPRESSED_ALPHA_ARB 0x84E9\n#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA\n#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB\n#define GL_COMPRESSED_INTENSITY_ARB 0x84EC\n#define GL_COMPRESSED_RGB_ARB 0x84ED\n#define GL_COMPRESSED_RGBA_ARB 0x84EE\n#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0\n#define GL_TEXTURE_COMPRESSED_ARB 0x86A1\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2\n#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3\n\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, void* img);\n\n#define glCompressedTexImage1DARB GLEW_GET_FUN(__glewCompressedTexImage1DARB)\n#define glCompressedTexImage2DARB GLEW_GET_FUN(__glewCompressedTexImage2DARB)\n#define glCompressedTexImage3DARB GLEW_GET_FUN(__glewCompressedTexImage3DARB)\n#define glCompressedTexSubImage1DARB GLEW_GET_FUN(__glewCompressedTexSubImage1DARB)\n#define glCompressedTexSubImage2DARB GLEW_GET_FUN(__glewCompressedTexSubImage2DARB)\n#define glCompressedTexSubImage3DARB GLEW_GET_FUN(__glewCompressedTexSubImage3DARB)\n#define glGetCompressedTexImageARB GLEW_GET_FUN(__glewGetCompressedTexImageARB)\n\n#define GLEW_ARB_texture_compression GLEW_GET_VAR(__GLEW_ARB_texture_compression)\n\n#endif /* GL_ARB_texture_compression */\n\n/* -------------------- GL_ARB_texture_compression_bptc -------------------- */\n\n#ifndef GL_ARB_texture_compression_bptc\n#define GL_ARB_texture_compression_bptc 1\n\n#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F\n\n#define GLEW_ARB_texture_compression_bptc GLEW_GET_VAR(__GLEW_ARB_texture_compression_bptc)\n\n#endif /* GL_ARB_texture_compression_bptc */\n\n/* -------------------- GL_ARB_texture_compression_rgtc -------------------- */\n\n#ifndef GL_ARB_texture_compression_rgtc\n#define GL_ARB_texture_compression_rgtc 1\n\n#define GL_COMPRESSED_RED_RGTC1 0x8DBB\n#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC\n#define GL_COMPRESSED_RG_RGTC2 0x8DBD\n#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE\n\n#define GLEW_ARB_texture_compression_rgtc GLEW_GET_VAR(__GLEW_ARB_texture_compression_rgtc)\n\n#endif /* GL_ARB_texture_compression_rgtc */\n\n/* ------------------------ GL_ARB_texture_cube_map ------------------------ */\n\n#ifndef GL_ARB_texture_cube_map\n#define GL_ARB_texture_cube_map 1\n\n#define GL_NORMAL_MAP_ARB 0x8511\n#define GL_REFLECTION_MAP_ARB 0x8512\n#define GL_TEXTURE_CUBE_MAP_ARB 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C\n\n#define GLEW_ARB_texture_cube_map GLEW_GET_VAR(__GLEW_ARB_texture_cube_map)\n\n#endif /* GL_ARB_texture_cube_map */\n\n/* --------------------- GL_ARB_texture_cube_map_array --------------------- */\n\n#ifndef GL_ARB_texture_cube_map_array\n#define GL_ARB_texture_cube_map_array 1\n\n#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B\n#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F\n\n#define GLEW_ARB_texture_cube_map_array GLEW_GET_VAR(__GLEW_ARB_texture_cube_map_array)\n\n#endif /* GL_ARB_texture_cube_map_array */\n\n/* ------------------------- GL_ARB_texture_env_add ------------------------ */\n\n#ifndef GL_ARB_texture_env_add\n#define GL_ARB_texture_env_add 1\n\n#define GLEW_ARB_texture_env_add GLEW_GET_VAR(__GLEW_ARB_texture_env_add)\n\n#endif /* GL_ARB_texture_env_add */\n\n/* ----------------------- GL_ARB_texture_env_combine ---------------------- */\n\n#ifndef GL_ARB_texture_env_combine\n#define GL_ARB_texture_env_combine 1\n\n#define GL_SUBTRACT_ARB 0x84E7\n#define GL_COMBINE_ARB 0x8570\n#define GL_COMBINE_RGB_ARB 0x8571\n#define GL_COMBINE_ALPHA_ARB 0x8572\n#define GL_RGB_SCALE_ARB 0x8573\n#define GL_ADD_SIGNED_ARB 0x8574\n#define GL_INTERPOLATE_ARB 0x8575\n#define GL_CONSTANT_ARB 0x8576\n#define GL_PRIMARY_COLOR_ARB 0x8577\n#define GL_PREVIOUS_ARB 0x8578\n#define GL_SOURCE0_RGB_ARB 0x8580\n#define GL_SOURCE1_RGB_ARB 0x8581\n#define GL_SOURCE2_RGB_ARB 0x8582\n#define GL_SOURCE0_ALPHA_ARB 0x8588\n#define GL_SOURCE1_ALPHA_ARB 0x8589\n#define GL_SOURCE2_ALPHA_ARB 0x858A\n#define GL_OPERAND0_RGB_ARB 0x8590\n#define GL_OPERAND1_RGB_ARB 0x8591\n#define GL_OPERAND2_RGB_ARB 0x8592\n#define GL_OPERAND0_ALPHA_ARB 0x8598\n#define GL_OPERAND1_ALPHA_ARB 0x8599\n#define GL_OPERAND2_ALPHA_ARB 0x859A\n\n#define GLEW_ARB_texture_env_combine GLEW_GET_VAR(__GLEW_ARB_texture_env_combine)\n\n#endif /* GL_ARB_texture_env_combine */\n\n/* ---------------------- GL_ARB_texture_env_crossbar ---------------------- */\n\n#ifndef GL_ARB_texture_env_crossbar\n#define GL_ARB_texture_env_crossbar 1\n\n#define GLEW_ARB_texture_env_crossbar GLEW_GET_VAR(__GLEW_ARB_texture_env_crossbar)\n\n#endif /* GL_ARB_texture_env_crossbar */\n\n/* ------------------------ GL_ARB_texture_env_dot3 ------------------------ */\n\n#ifndef GL_ARB_texture_env_dot3\n#define GL_ARB_texture_env_dot3 1\n\n#define GL_DOT3_RGB_ARB 0x86AE\n#define GL_DOT3_RGBA_ARB 0x86AF\n\n#define GLEW_ARB_texture_env_dot3 GLEW_GET_VAR(__GLEW_ARB_texture_env_dot3)\n\n#endif /* GL_ARB_texture_env_dot3 */\n\n/* -------------------------- GL_ARB_texture_float ------------------------- */\n\n#ifndef GL_ARB_texture_float\n#define GL_ARB_texture_float 1\n\n#define GL_RGBA32F_ARB 0x8814\n#define GL_RGB32F_ARB 0x8815\n#define GL_ALPHA32F_ARB 0x8816\n#define GL_INTENSITY32F_ARB 0x8817\n#define GL_LUMINANCE32F_ARB 0x8818\n#define GL_LUMINANCE_ALPHA32F_ARB 0x8819\n#define GL_RGBA16F_ARB 0x881A\n#define GL_RGB16F_ARB 0x881B\n#define GL_ALPHA16F_ARB 0x881C\n#define GL_INTENSITY16F_ARB 0x881D\n#define GL_LUMINANCE16F_ARB 0x881E\n#define GL_LUMINANCE_ALPHA16F_ARB 0x881F\n#define GL_TEXTURE_RED_TYPE_ARB 0x8C10\n#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11\n#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12\n#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13\n#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14\n#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15\n#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16\n#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17\n\n#define GLEW_ARB_texture_float GLEW_GET_VAR(__GLEW_ARB_texture_float)\n\n#endif /* GL_ARB_texture_float */\n\n/* ------------------------- GL_ARB_texture_gather ------------------------- */\n\n#ifndef GL_ARB_texture_gather\n#define GL_ARB_texture_gather 1\n\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F\n\n#define GLEW_ARB_texture_gather GLEW_GET_VAR(__GLEW_ARB_texture_gather)\n\n#endif /* GL_ARB_texture_gather */\n\n/* --------------------- GL_ARB_texture_mirrored_repeat -------------------- */\n\n#ifndef GL_ARB_texture_mirrored_repeat\n#define GL_ARB_texture_mirrored_repeat 1\n\n#define GL_MIRRORED_REPEAT_ARB 0x8370\n\n#define GLEW_ARB_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_ARB_texture_mirrored_repeat)\n\n#endif /* GL_ARB_texture_mirrored_repeat */\n\n/* ----------------------- GL_ARB_texture_multisample ---------------------- */\n\n#ifndef GL_ARB_texture_multisample\n#define GL_ARB_texture_multisample 1\n\n#define GL_SAMPLE_POSITION 0x8E50\n#define GL_SAMPLE_MASK 0x8E51\n#define GL_SAMPLE_MASK_VALUE 0x8E52\n#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59\n#define GL_TEXTURE_2D_MULTISAMPLE 0x9100\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105\n#define GL_TEXTURE_SAMPLES 0x9106\n#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107\n#define GL_SAMPLER_2D_MULTISAMPLE 0x9108\n#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A\n#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B\n#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D\n#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E\n#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F\n#define GL_MAX_INTEGER_SAMPLES 0x9110\n\ntypedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat* val);\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\n\n#define glGetMultisamplefv GLEW_GET_FUN(__glewGetMultisamplefv)\n#define glSampleMaski GLEW_GET_FUN(__glewSampleMaski)\n#define glTexImage2DMultisample GLEW_GET_FUN(__glewTexImage2DMultisample)\n#define glTexImage3DMultisample GLEW_GET_FUN(__glewTexImage3DMultisample)\n\n#define GLEW_ARB_texture_multisample GLEW_GET_VAR(__GLEW_ARB_texture_multisample)\n\n#endif /* GL_ARB_texture_multisample */\n\n/* -------------------- GL_ARB_texture_non_power_of_two -------------------- */\n\n#ifndef GL_ARB_texture_non_power_of_two\n#define GL_ARB_texture_non_power_of_two 1\n\n#define GLEW_ARB_texture_non_power_of_two GLEW_GET_VAR(__GLEW_ARB_texture_non_power_of_two)\n\n#endif /* GL_ARB_texture_non_power_of_two */\n\n/* ---------------------- GL_ARB_texture_query_levels ---------------------- */\n\n#ifndef GL_ARB_texture_query_levels\n#define GL_ARB_texture_query_levels 1\n\n#define GLEW_ARB_texture_query_levels GLEW_GET_VAR(__GLEW_ARB_texture_query_levels)\n\n#endif /* GL_ARB_texture_query_levels */\n\n/* ------------------------ GL_ARB_texture_query_lod ----------------------- */\n\n#ifndef GL_ARB_texture_query_lod\n#define GL_ARB_texture_query_lod 1\n\n#define GLEW_ARB_texture_query_lod GLEW_GET_VAR(__GLEW_ARB_texture_query_lod)\n\n#endif /* GL_ARB_texture_query_lod */\n\n/* ------------------------ GL_ARB_texture_rectangle ----------------------- */\n\n#ifndef GL_ARB_texture_rectangle\n#define GL_ARB_texture_rectangle 1\n\n#define GL_TEXTURE_RECTANGLE_ARB 0x84F5\n#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6\n#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8\n#define GL_SAMPLER_2D_RECT_ARB 0x8B63\n#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64\n\n#define GLEW_ARB_texture_rectangle GLEW_GET_VAR(__GLEW_ARB_texture_rectangle)\n\n#endif /* GL_ARB_texture_rectangle */\n\n/* --------------------------- GL_ARB_texture_rg --------------------------- */\n\n#ifndef GL_ARB_texture_rg\n#define GL_ARB_texture_rg 1\n\n#define GL_COMPRESSED_RED 0x8225\n#define GL_COMPRESSED_RG 0x8226\n#define GL_RG 0x8227\n#define GL_RG_INTEGER 0x8228\n#define GL_R8 0x8229\n#define GL_R16 0x822A\n#define GL_RG8 0x822B\n#define GL_RG16 0x822C\n#define GL_R16F 0x822D\n#define GL_R32F 0x822E\n#define GL_RG16F 0x822F\n#define GL_RG32F 0x8230\n#define GL_R8I 0x8231\n#define GL_R8UI 0x8232\n#define GL_R16I 0x8233\n#define GL_R16UI 0x8234\n#define GL_R32I 0x8235\n#define GL_R32UI 0x8236\n#define GL_RG8I 0x8237\n#define GL_RG8UI 0x8238\n#define GL_RG16I 0x8239\n#define GL_RG16UI 0x823A\n#define GL_RG32I 0x823B\n#define GL_RG32UI 0x823C\n\n#define GLEW_ARB_texture_rg GLEW_GET_VAR(__GLEW_ARB_texture_rg)\n\n#endif /* GL_ARB_texture_rg */\n\n/* ----------------------- GL_ARB_texture_rgb10_a2ui ----------------------- */\n\n#ifndef GL_ARB_texture_rgb10_a2ui\n#define GL_ARB_texture_rgb10_a2ui 1\n\n#define GL_RGB10_A2UI 0x906F\n\n#define GLEW_ARB_texture_rgb10_a2ui GLEW_GET_VAR(__GLEW_ARB_texture_rgb10_a2ui)\n\n#endif /* GL_ARB_texture_rgb10_a2ui */\n\n/* ------------------------- GL_ARB_texture_storage ------------------------ */\n\n#ifndef GL_ARB_texture_storage\n#define GL_ARB_texture_storage 1\n\n#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F\n\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\n\n#define glTexStorage1D GLEW_GET_FUN(__glewTexStorage1D)\n#define glTexStorage2D GLEW_GET_FUN(__glewTexStorage2D)\n#define glTexStorage3D GLEW_GET_FUN(__glewTexStorage3D)\n#define glTextureStorage1DEXT GLEW_GET_FUN(__glewTextureStorage1DEXT)\n#define glTextureStorage2DEXT GLEW_GET_FUN(__glewTextureStorage2DEXT)\n#define glTextureStorage3DEXT GLEW_GET_FUN(__glewTextureStorage3DEXT)\n\n#define GLEW_ARB_texture_storage GLEW_GET_VAR(__GLEW_ARB_texture_storage)\n\n#endif /* GL_ARB_texture_storage */\n\n/* ------------------- GL_ARB_texture_storage_multisample ------------------ */\n\n#ifndef GL_ARB_texture_storage_multisample\n#define GL_ARB_texture_storage_multisample 1\n\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\n\n#define glTexStorage2DMultisample GLEW_GET_FUN(__glewTexStorage2DMultisample)\n#define glTexStorage3DMultisample GLEW_GET_FUN(__glewTexStorage3DMultisample)\n#define glTextureStorage2DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage2DMultisampleEXT)\n#define glTextureStorage3DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage3DMultisampleEXT)\n\n#define GLEW_ARB_texture_storage_multisample GLEW_GET_VAR(__GLEW_ARB_texture_storage_multisample)\n\n#endif /* GL_ARB_texture_storage_multisample */\n\n/* ------------------------- GL_ARB_texture_swizzle ------------------------ */\n\n#ifndef GL_ARB_texture_swizzle\n#define GL_ARB_texture_swizzle 1\n\n#define GL_TEXTURE_SWIZZLE_R 0x8E42\n#define GL_TEXTURE_SWIZZLE_G 0x8E43\n#define GL_TEXTURE_SWIZZLE_B 0x8E44\n#define GL_TEXTURE_SWIZZLE_A 0x8E45\n#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46\n\n#define GLEW_ARB_texture_swizzle GLEW_GET_VAR(__GLEW_ARB_texture_swizzle)\n\n#endif /* GL_ARB_texture_swizzle */\n\n/* -------------------------- GL_ARB_texture_view -------------------------- */\n\n#ifndef GL_ARB_texture_view\n#define GL_ARB_texture_view 1\n\n#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB\n#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC\n#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD\n#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE\n#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF\n\ntypedef void (GLAPIENTRY * PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\n\n#define glTextureView GLEW_GET_FUN(__glewTextureView)\n\n#define GLEW_ARB_texture_view GLEW_GET_VAR(__GLEW_ARB_texture_view)\n\n#endif /* GL_ARB_texture_view */\n\n/* --------------------------- GL_ARB_timer_query -------------------------- */\n\n#ifndef GL_ARB_timer_query\n#define GL_ARB_timer_query 1\n\n#define GL_TIME_ELAPSED 0x88BF\n#define GL_TIMESTAMP 0x8E28\n\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64* params);\ntypedef void (GLAPIENTRY * PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);\n\n#define glGetQueryObjecti64v GLEW_GET_FUN(__glewGetQueryObjecti64v)\n#define glGetQueryObjectui64v GLEW_GET_FUN(__glewGetQueryObjectui64v)\n#define glQueryCounter GLEW_GET_FUN(__glewQueryCounter)\n\n#define GLEW_ARB_timer_query GLEW_GET_VAR(__GLEW_ARB_timer_query)\n\n#endif /* GL_ARB_timer_query */\n\n/* ----------------------- GL_ARB_transform_feedback2 ---------------------- */\n\n#ifndef GL_ARB_transform_feedback2\n#define GL_ARB_transform_feedback2 1\n\n#define GL_TRANSFORM_FEEDBACK 0x8E22\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24\n#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25\n\ntypedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids);\ntypedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);\n\n#define glBindTransformFeedback GLEW_GET_FUN(__glewBindTransformFeedback)\n#define glDeleteTransformFeedbacks GLEW_GET_FUN(__glewDeleteTransformFeedbacks)\n#define glDrawTransformFeedback GLEW_GET_FUN(__glewDrawTransformFeedback)\n#define glGenTransformFeedbacks GLEW_GET_FUN(__glewGenTransformFeedbacks)\n#define glIsTransformFeedback GLEW_GET_FUN(__glewIsTransformFeedback)\n#define glPauseTransformFeedback GLEW_GET_FUN(__glewPauseTransformFeedback)\n#define glResumeTransformFeedback GLEW_GET_FUN(__glewResumeTransformFeedback)\n\n#define GLEW_ARB_transform_feedback2 GLEW_GET_VAR(__GLEW_ARB_transform_feedback2)\n\n#endif /* GL_ARB_transform_feedback2 */\n\n/* ----------------------- GL_ARB_transform_feedback3 ---------------------- */\n\n#ifndef GL_ARB_transform_feedback3\n#define GL_ARB_transform_feedback3 1\n\n#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70\n#define GL_MAX_VERTEX_STREAMS 0x8E71\n\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);\ntypedef void (GLAPIENTRY * PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params);\n\n#define glBeginQueryIndexed GLEW_GET_FUN(__glewBeginQueryIndexed)\n#define glDrawTransformFeedbackStream GLEW_GET_FUN(__glewDrawTransformFeedbackStream)\n#define glEndQueryIndexed GLEW_GET_FUN(__glewEndQueryIndexed)\n#define glGetQueryIndexediv GLEW_GET_FUN(__glewGetQueryIndexediv)\n\n#define GLEW_ARB_transform_feedback3 GLEW_GET_VAR(__GLEW_ARB_transform_feedback3)\n\n#endif /* GL_ARB_transform_feedback3 */\n\n/* ------------------ GL_ARB_transform_feedback_instanced ------------------ */\n\n#ifndef GL_ARB_transform_feedback_instanced\n#define GL_ARB_transform_feedback_instanced 1\n\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount);\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);\n\n#define glDrawTransformFeedbackInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackInstanced)\n#define glDrawTransformFeedbackStreamInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackStreamInstanced)\n\n#define GLEW_ARB_transform_feedback_instanced GLEW_GET_VAR(__GLEW_ARB_transform_feedback_instanced)\n\n#endif /* GL_ARB_transform_feedback_instanced */\n\n/* ------------------------ GL_ARB_transpose_matrix ------------------------ */\n\n#ifndef GL_ARB_transpose_matrix\n#define GL_ARB_transpose_matrix 1\n\n#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3\n#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4\n#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5\n#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6\n\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]);\n\n#define glLoadTransposeMatrixdARB GLEW_GET_FUN(__glewLoadTransposeMatrixdARB)\n#define glLoadTransposeMatrixfARB GLEW_GET_FUN(__glewLoadTransposeMatrixfARB)\n#define glMultTransposeMatrixdARB GLEW_GET_FUN(__glewMultTransposeMatrixdARB)\n#define glMultTransposeMatrixfARB GLEW_GET_FUN(__glewMultTransposeMatrixfARB)\n\n#define GLEW_ARB_transpose_matrix GLEW_GET_VAR(__GLEW_ARB_transpose_matrix)\n\n#endif /* GL_ARB_transpose_matrix */\n\n/* ---------------------- GL_ARB_uniform_buffer_object --------------------- */\n\n#ifndef GL_ARB_uniform_buffer_object\n#define GL_ARB_uniform_buffer_object 1\n\n#define GL_UNIFORM_BUFFER 0x8A11\n#define GL_UNIFORM_BUFFER_BINDING 0x8A28\n#define GL_UNIFORM_BUFFER_START 0x8A29\n#define GL_UNIFORM_BUFFER_SIZE 0x8A2A\n#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B\n#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C\n#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D\n#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E\n#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F\n#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30\n#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31\n#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32\n#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33\n#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34\n#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35\n#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36\n#define GL_UNIFORM_TYPE 0x8A37\n#define GL_UNIFORM_SIZE 0x8A38\n#define GL_UNIFORM_NAME_LENGTH 0x8A39\n#define GL_UNIFORM_BLOCK_INDEX 0x8A3A\n#define GL_UNIFORM_OFFSET 0x8A3B\n#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C\n#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D\n#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E\n#define GL_UNIFORM_BLOCK_BINDING 0x8A3F\n#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40\n#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46\n#define GL_INVALID_INDEX 0xFFFFFFFF\n\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint* data);\ntypedef GLuint (GLAPIENTRY * PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar** uniformNames, GLuint* uniformIndices);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\n\n#define glBindBufferBase GLEW_GET_FUN(__glewBindBufferBase)\n#define glBindBufferRange GLEW_GET_FUN(__glewBindBufferRange)\n#define glGetActiveUniformBlockName GLEW_GET_FUN(__glewGetActiveUniformBlockName)\n#define glGetActiveUniformBlockiv GLEW_GET_FUN(__glewGetActiveUniformBlockiv)\n#define glGetActiveUniformName GLEW_GET_FUN(__glewGetActiveUniformName)\n#define glGetActiveUniformsiv GLEW_GET_FUN(__glewGetActiveUniformsiv)\n#define glGetIntegeri_v GLEW_GET_FUN(__glewGetIntegeri_v)\n#define glGetUniformBlockIndex GLEW_GET_FUN(__glewGetUniformBlockIndex)\n#define glGetUniformIndices GLEW_GET_FUN(__glewGetUniformIndices)\n#define glUniformBlockBinding GLEW_GET_FUN(__glewUniformBlockBinding)\n\n#define GLEW_ARB_uniform_buffer_object GLEW_GET_VAR(__GLEW_ARB_uniform_buffer_object)\n\n#endif /* GL_ARB_uniform_buffer_object */\n\n/* ------------------------ GL_ARB_vertex_array_bgra ----------------------- */\n\n#ifndef GL_ARB_vertex_array_bgra\n#define GL_ARB_vertex_array_bgra 1\n\n#define GL_BGRA 0x80E1\n\n#define GLEW_ARB_vertex_array_bgra GLEW_GET_VAR(__GLEW_ARB_vertex_array_bgra)\n\n#endif /* GL_ARB_vertex_array_bgra */\n\n/* ----------------------- GL_ARB_vertex_array_object ---------------------- */\n\n#ifndef GL_ARB_vertex_array_object\n#define GL_ARB_vertex_array_object 1\n\n#define GL_VERTEX_ARRAY_BINDING 0x85B5\n\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array);\ntypedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays);\ntypedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);\ntypedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYPROC) (GLuint array);\n\n#define glBindVertexArray GLEW_GET_FUN(__glewBindVertexArray)\n#define glDeleteVertexArrays GLEW_GET_FUN(__glewDeleteVertexArrays)\n#define glGenVertexArrays GLEW_GET_FUN(__glewGenVertexArrays)\n#define glIsVertexArray GLEW_GET_FUN(__glewIsVertexArray)\n\n#define GLEW_ARB_vertex_array_object GLEW_GET_VAR(__GLEW_ARB_vertex_array_object)\n\n#endif /* GL_ARB_vertex_array_object */\n\n/* ----------------------- GL_ARB_vertex_attrib_64bit ---------------------- */\n\n#ifndef GL_ARB_vertex_attrib_64bit\n#define GL_ARB_vertex_attrib_64bit 1\n\n#define GL_DOUBLE_MAT2 0x8F46\n#define GL_DOUBLE_MAT3 0x8F47\n#define GL_DOUBLE_MAT4 0x8F48\n#define GL_DOUBLE_VEC2 0x8FFC\n#define GL_DOUBLE_VEC3 0x8FFD\n#define GL_DOUBLE_VEC4 0x8FFE\n\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);\n\n#define glGetVertexAttribLdv GLEW_GET_FUN(__glewGetVertexAttribLdv)\n#define glVertexAttribL1d GLEW_GET_FUN(__glewVertexAttribL1d)\n#define glVertexAttribL1dv GLEW_GET_FUN(__glewVertexAttribL1dv)\n#define glVertexAttribL2d GLEW_GET_FUN(__glewVertexAttribL2d)\n#define glVertexAttribL2dv GLEW_GET_FUN(__glewVertexAttribL2dv)\n#define glVertexAttribL3d GLEW_GET_FUN(__glewVertexAttribL3d)\n#define glVertexAttribL3dv GLEW_GET_FUN(__glewVertexAttribL3dv)\n#define glVertexAttribL4d GLEW_GET_FUN(__glewVertexAttribL4d)\n#define glVertexAttribL4dv GLEW_GET_FUN(__glewVertexAttribL4dv)\n#define glVertexAttribLPointer GLEW_GET_FUN(__glewVertexAttribLPointer)\n\n#define GLEW_ARB_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_64bit)\n\n#endif /* GL_ARB_vertex_attrib_64bit */\n\n/* ---------------------- GL_ARB_vertex_attrib_binding --------------------- */\n\n#ifndef GL_ARB_vertex_attrib_binding\n#define GL_ARB_vertex_attrib_binding 1\n\n#define GL_VERTEX_ATTRIB_BINDING 0x82D4\n#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5\n#define GL_VERTEX_BINDING_DIVISOR 0x82D6\n#define GL_VERTEX_BINDING_OFFSET 0x82D7\n#define GL_VERTEX_BINDING_STRIDE 0x82D8\n#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9\n#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA\n\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);\n\n#define glBindVertexBuffer GLEW_GET_FUN(__glewBindVertexBuffer)\n#define glVertexAttribBinding GLEW_GET_FUN(__glewVertexAttribBinding)\n#define glVertexAttribFormat GLEW_GET_FUN(__glewVertexAttribFormat)\n#define glVertexAttribIFormat GLEW_GET_FUN(__glewVertexAttribIFormat)\n#define glVertexAttribLFormat GLEW_GET_FUN(__glewVertexAttribLFormat)\n#define glVertexBindingDivisor GLEW_GET_FUN(__glewVertexBindingDivisor)\n\n#define GLEW_ARB_vertex_attrib_binding GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_binding)\n\n#endif /* GL_ARB_vertex_attrib_binding */\n\n/* -------------------------- GL_ARB_vertex_blend -------------------------- */\n\n#ifndef GL_ARB_vertex_blend\n#define GL_ARB_vertex_blend 1\n\n#define GL_MODELVIEW0_ARB 0x1700\n#define GL_MODELVIEW1_ARB 0x850A\n#define GL_MAX_VERTEX_UNITS_ARB 0x86A4\n#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5\n#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6\n#define GL_VERTEX_BLEND_ARB 0x86A7\n#define GL_CURRENT_WEIGHT_ARB 0x86A8\n#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9\n#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA\n#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB\n#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC\n#define GL_WEIGHT_ARRAY_ARB 0x86AD\n#define GL_MODELVIEW2_ARB 0x8722\n#define GL_MODELVIEW3_ARB 0x8723\n#define GL_MODELVIEW4_ARB 0x8724\n#define GL_MODELVIEW5_ARB 0x8725\n#define GL_MODELVIEW6_ARB 0x8726\n#define GL_MODELVIEW7_ARB 0x8727\n#define GL_MODELVIEW8_ARB 0x8728\n#define GL_MODELVIEW9_ARB 0x8729\n#define GL_MODELVIEW10_ARB 0x872A\n#define GL_MODELVIEW11_ARB 0x872B\n#define GL_MODELVIEW12_ARB 0x872C\n#define GL_MODELVIEW13_ARB 0x872D\n#define GL_MODELVIEW14_ARB 0x872E\n#define GL_MODELVIEW15_ARB 0x872F\n#define GL_MODELVIEW16_ARB 0x8730\n#define GL_MODELVIEW17_ARB 0x8731\n#define GL_MODELVIEW18_ARB 0x8732\n#define GL_MODELVIEW19_ARB 0x8733\n#define GL_MODELVIEW20_ARB 0x8734\n#define GL_MODELVIEW21_ARB 0x8735\n#define GL_MODELVIEW22_ARB 0x8736\n#define GL_MODELVIEW23_ARB 0x8737\n#define GL_MODELVIEW24_ARB 0x8738\n#define GL_MODELVIEW25_ARB 0x8739\n#define GL_MODELVIEW26_ARB 0x873A\n#define GL_MODELVIEW27_ARB 0x873B\n#define GL_MODELVIEW28_ARB 0x873C\n#define GL_MODELVIEW29_ARB 0x873D\n#define GL_MODELVIEW30_ARB 0x873E\n#define GL_MODELVIEW31_ARB 0x873F\n\ntypedef void (GLAPIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, GLbyte *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, GLdouble *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, GLfloat *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, GLint *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, GLshort *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, GLubyte *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, GLuint *weights);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, GLushort *weights);\n\n#define glVertexBlendARB GLEW_GET_FUN(__glewVertexBlendARB)\n#define glWeightPointerARB GLEW_GET_FUN(__glewWeightPointerARB)\n#define glWeightbvARB GLEW_GET_FUN(__glewWeightbvARB)\n#define glWeightdvARB GLEW_GET_FUN(__glewWeightdvARB)\n#define glWeightfvARB GLEW_GET_FUN(__glewWeightfvARB)\n#define glWeightivARB GLEW_GET_FUN(__glewWeightivARB)\n#define glWeightsvARB GLEW_GET_FUN(__glewWeightsvARB)\n#define glWeightubvARB GLEW_GET_FUN(__glewWeightubvARB)\n#define glWeightuivARB GLEW_GET_FUN(__glewWeightuivARB)\n#define glWeightusvARB GLEW_GET_FUN(__glewWeightusvARB)\n\n#define GLEW_ARB_vertex_blend GLEW_GET_VAR(__GLEW_ARB_vertex_blend)\n\n#endif /* GL_ARB_vertex_blend */\n\n/* ---------------------- GL_ARB_vertex_buffer_object ---------------------- */\n\n#ifndef GL_ARB_vertex_buffer_object\n#define GL_ARB_vertex_buffer_object 1\n\n#define GL_BUFFER_SIZE_ARB 0x8764\n#define GL_BUFFER_USAGE_ARB 0x8765\n#define GL_ARRAY_BUFFER_ARB 0x8892\n#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893\n#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895\n#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896\n#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897\n#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898\n#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F\n#define GL_READ_ONLY_ARB 0x88B8\n#define GL_WRITE_ONLY_ARB 0x88B9\n#define GL_READ_WRITE_ARB 0x88BA\n#define GL_BUFFER_ACCESS_ARB 0x88BB\n#define GL_BUFFER_MAPPED_ARB 0x88BC\n#define GL_BUFFER_MAP_POINTER_ARB 0x88BD\n#define GL_STREAM_DRAW_ARB 0x88E0\n#define GL_STREAM_READ_ARB 0x88E1\n#define GL_STREAM_COPY_ARB 0x88E2\n#define GL_STATIC_DRAW_ARB 0x88E4\n#define GL_STATIC_READ_ARB 0x88E5\n#define GL_STATIC_COPY_ARB 0x88E6\n#define GL_DYNAMIC_DRAW_ARB 0x88E8\n#define GL_DYNAMIC_READ_ARB 0x88E9\n#define GL_DYNAMIC_COPY_ARB 0x88EA\n\ntypedef ptrdiff_t GLintptrARB;\ntypedef ptrdiff_t GLsizeiptrARB;\n\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid* data, GLenum usage);\ntypedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid** params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid* data);\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer);\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target);\n\n#define glBindBufferARB GLEW_GET_FUN(__glewBindBufferARB)\n#define glBufferDataARB GLEW_GET_FUN(__glewBufferDataARB)\n#define glBufferSubDataARB GLEW_GET_FUN(__glewBufferSubDataARB)\n#define glDeleteBuffersARB GLEW_GET_FUN(__glewDeleteBuffersARB)\n#define glGenBuffersARB GLEW_GET_FUN(__glewGenBuffersARB)\n#define glGetBufferParameterivARB GLEW_GET_FUN(__glewGetBufferParameterivARB)\n#define glGetBufferPointervARB GLEW_GET_FUN(__glewGetBufferPointervARB)\n#define glGetBufferSubDataARB GLEW_GET_FUN(__glewGetBufferSubDataARB)\n#define glIsBufferARB GLEW_GET_FUN(__glewIsBufferARB)\n#define glMapBufferARB GLEW_GET_FUN(__glewMapBufferARB)\n#define glUnmapBufferARB GLEW_GET_FUN(__glewUnmapBufferARB)\n\n#define GLEW_ARB_vertex_buffer_object GLEW_GET_VAR(__GLEW_ARB_vertex_buffer_object)\n\n#endif /* GL_ARB_vertex_buffer_object */\n\n/* ------------------------- GL_ARB_vertex_program ------------------------- */\n\n#ifndef GL_ARB_vertex_program\n#define GL_ARB_vertex_program 1\n\n#define GL_COLOR_SUM_ARB 0x8458\n#define GL_VERTEX_PROGRAM_ARB 0x8620\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625\n#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626\n#define GL_PROGRAM_LENGTH_ARB 0x8627\n#define GL_PROGRAM_STRING_ARB 0x8628\n#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E\n#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F\n#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640\n#define GL_CURRENT_MATRIX_ARB 0x8641\n#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642\n#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645\n#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B\n#define GL_PROGRAM_BINDING_ARB 0x8677\n#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A\n#define GL_PROGRAM_ERROR_STRING_ARB 0x8874\n#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875\n#define GL_PROGRAM_FORMAT_ARB 0x8876\n#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0\n#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1\n#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2\n#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3\n#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4\n#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5\n#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6\n#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7\n#define GL_PROGRAM_PARAMETERS_ARB 0x88A8\n#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9\n#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA\n#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB\n#define GL_PROGRAM_ATTRIBS_ARB 0x88AC\n#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD\n#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE\n#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF\n#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0\n#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1\n#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2\n#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3\n#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4\n#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5\n#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6\n#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7\n#define GL_MATRIX0_ARB 0x88C0\n#define GL_MATRIX1_ARB 0x88C1\n#define GL_MATRIX2_ARB 0x88C2\n#define GL_MATRIX3_ARB 0x88C3\n#define GL_MATRIX4_ARB 0x88C4\n#define GL_MATRIX5_ARB 0x88C5\n#define GL_MATRIX6_ARB 0x88C6\n#define GL_MATRIX7_ARB 0x88C7\n#define GL_MATRIX8_ARB 0x88C8\n#define GL_MATRIX9_ARB 0x88C9\n#define GL_MATRIX10_ARB 0x88CA\n#define GL_MATRIX11_ARB 0x88CB\n#define GL_MATRIX12_ARB 0x88CC\n#define GL_MATRIX13_ARB 0x88CD\n#define GL_MATRIX14_ARB 0x88CE\n#define GL_MATRIX15_ARB 0x88CF\n#define GL_MATRIX16_ARB 0x88D0\n#define GL_MATRIX17_ARB 0x88D1\n#define GL_MATRIX18_ARB 0x88D2\n#define GL_MATRIX19_ARB 0x88D3\n#define GL_MATRIX20_ARB 0x88D4\n#define GL_MATRIX21_ARB 0x88D5\n#define GL_MATRIX22_ARB 0x88D6\n#define GL_MATRIX23_ARB 0x88D7\n#define GL_MATRIX24_ARB 0x88D8\n#define GL_MATRIX25_ARB 0x88D9\n#define GL_MATRIX26_ARB 0x88DA\n#define GL_MATRIX27_ARB 0x88DB\n#define GL_MATRIX28_ARB 0x88DC\n#define GL_MATRIX29_ARB 0x88DD\n#define GL_MATRIX30_ARB 0x88DE\n#define GL_MATRIX31_ARB 0x88DF\n\ntypedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint* programs);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);\ntypedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint* programs);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void* string);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid** pointer);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void* string);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer);\n\n#define glBindProgramARB GLEW_GET_FUN(__glewBindProgramARB)\n#define glDeleteProgramsARB GLEW_GET_FUN(__glewDeleteProgramsARB)\n#define glDisableVertexAttribArrayARB GLEW_GET_FUN(__glewDisableVertexAttribArrayARB)\n#define glEnableVertexAttribArrayARB GLEW_GET_FUN(__glewEnableVertexAttribArrayARB)\n#define glGenProgramsARB GLEW_GET_FUN(__glewGenProgramsARB)\n#define glGetProgramEnvParameterdvARB GLEW_GET_FUN(__glewGetProgramEnvParameterdvARB)\n#define glGetProgramEnvParameterfvARB GLEW_GET_FUN(__glewGetProgramEnvParameterfvARB)\n#define glGetProgramLocalParameterdvARB GLEW_GET_FUN(__glewGetProgramLocalParameterdvARB)\n#define glGetProgramLocalParameterfvARB GLEW_GET_FUN(__glewGetProgramLocalParameterfvARB)\n#define glGetProgramStringARB GLEW_GET_FUN(__glewGetProgramStringARB)\n#define glGetProgramivARB GLEW_GET_FUN(__glewGetProgramivARB)\n#define glGetVertexAttribPointervARB GLEW_GET_FUN(__glewGetVertexAttribPointervARB)\n#define glGetVertexAttribdvARB GLEW_GET_FUN(__glewGetVertexAttribdvARB)\n#define glGetVertexAttribfvARB GLEW_GET_FUN(__glewGetVertexAttribfvARB)\n#define glGetVertexAttribivARB GLEW_GET_FUN(__glewGetVertexAttribivARB)\n#define glIsProgramARB GLEW_GET_FUN(__glewIsProgramARB)\n#define glProgramEnvParameter4dARB GLEW_GET_FUN(__glewProgramEnvParameter4dARB)\n#define glProgramEnvParameter4dvARB GLEW_GET_FUN(__glewProgramEnvParameter4dvARB)\n#define glProgramEnvParameter4fARB GLEW_GET_FUN(__glewProgramEnvParameter4fARB)\n#define glProgramEnvParameter4fvARB GLEW_GET_FUN(__glewProgramEnvParameter4fvARB)\n#define glProgramLocalParameter4dARB GLEW_GET_FUN(__glewProgramLocalParameter4dARB)\n#define glProgramLocalParameter4dvARB GLEW_GET_FUN(__glewProgramLocalParameter4dvARB)\n#define glProgramLocalParameter4fARB GLEW_GET_FUN(__glewProgramLocalParameter4fARB)\n#define glProgramLocalParameter4fvARB GLEW_GET_FUN(__glewProgramLocalParameter4fvARB)\n#define glProgramStringARB GLEW_GET_FUN(__glewProgramStringARB)\n#define glVertexAttrib1dARB GLEW_GET_FUN(__glewVertexAttrib1dARB)\n#define glVertexAttrib1dvARB GLEW_GET_FUN(__glewVertexAttrib1dvARB)\n#define glVertexAttrib1fARB GLEW_GET_FUN(__glewVertexAttrib1fARB)\n#define glVertexAttrib1fvARB GLEW_GET_FUN(__glewVertexAttrib1fvARB)\n#define glVertexAttrib1sARB GLEW_GET_FUN(__glewVertexAttrib1sARB)\n#define glVertexAttrib1svARB GLEW_GET_FUN(__glewVertexAttrib1svARB)\n#define glVertexAttrib2dARB GLEW_GET_FUN(__glewVertexAttrib2dARB)\n#define glVertexAttrib2dvARB GLEW_GET_FUN(__glewVertexAttrib2dvARB)\n#define glVertexAttrib2fARB GLEW_GET_FUN(__glewVertexAttrib2fARB)\n#define glVertexAttrib2fvARB GLEW_GET_FUN(__glewVertexAttrib2fvARB)\n#define glVertexAttrib2sARB GLEW_GET_FUN(__glewVertexAttrib2sARB)\n#define glVertexAttrib2svARB GLEW_GET_FUN(__glewVertexAttrib2svARB)\n#define glVertexAttrib3dARB GLEW_GET_FUN(__glewVertexAttrib3dARB)\n#define glVertexAttrib3dvARB GLEW_GET_FUN(__glewVertexAttrib3dvARB)\n#define glVertexAttrib3fARB GLEW_GET_FUN(__glewVertexAttrib3fARB)\n#define glVertexAttrib3fvARB GLEW_GET_FUN(__glewVertexAttrib3fvARB)\n#define glVertexAttrib3sARB GLEW_GET_FUN(__glewVertexAttrib3sARB)\n#define glVertexAttrib3svARB GLEW_GET_FUN(__glewVertexAttrib3svARB)\n#define glVertexAttrib4NbvARB GLEW_GET_FUN(__glewVertexAttrib4NbvARB)\n#define glVertexAttrib4NivARB GLEW_GET_FUN(__glewVertexAttrib4NivARB)\n#define glVertexAttrib4NsvARB GLEW_GET_FUN(__glewVertexAttrib4NsvARB)\n#define glVertexAttrib4NubARB GLEW_GET_FUN(__glewVertexAttrib4NubARB)\n#define glVertexAttrib4NubvARB GLEW_GET_FUN(__glewVertexAttrib4NubvARB)\n#define glVertexAttrib4NuivARB GLEW_GET_FUN(__glewVertexAttrib4NuivARB)\n#define glVertexAttrib4NusvARB GLEW_GET_FUN(__glewVertexAttrib4NusvARB)\n#define glVertexAttrib4bvARB GLEW_GET_FUN(__glewVertexAttrib4bvARB)\n#define glVertexAttrib4dARB GLEW_GET_FUN(__glewVertexAttrib4dARB)\n#define glVertexAttrib4dvARB GLEW_GET_FUN(__glewVertexAttrib4dvARB)\n#define glVertexAttrib4fARB GLEW_GET_FUN(__glewVertexAttrib4fARB)\n#define glVertexAttrib4fvARB GLEW_GET_FUN(__glewVertexAttrib4fvARB)\n#define glVertexAttrib4ivARB GLEW_GET_FUN(__glewVertexAttrib4ivARB)\n#define glVertexAttrib4sARB GLEW_GET_FUN(__glewVertexAttrib4sARB)\n#define glVertexAttrib4svARB GLEW_GET_FUN(__glewVertexAttrib4svARB)\n#define glVertexAttrib4ubvARB GLEW_GET_FUN(__glewVertexAttrib4ubvARB)\n#define glVertexAttrib4uivARB GLEW_GET_FUN(__glewVertexAttrib4uivARB)\n#define glVertexAttrib4usvARB GLEW_GET_FUN(__glewVertexAttrib4usvARB)\n#define glVertexAttribPointerARB GLEW_GET_FUN(__glewVertexAttribPointerARB)\n\n#define GLEW_ARB_vertex_program GLEW_GET_VAR(__GLEW_ARB_vertex_program)\n\n#endif /* GL_ARB_vertex_program */\n\n/* -------------------------- GL_ARB_vertex_shader ------------------------- */\n\n#ifndef GL_ARB_vertex_shader\n#define GL_ARB_vertex_shader 1\n\n#define GL_VERTEX_SHADER_ARB 0x8B31\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A\n#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D\n#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89\n#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A\n\ntypedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB* name);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name);\ntypedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name);\n\n#define glBindAttribLocationARB GLEW_GET_FUN(__glewBindAttribLocationARB)\n#define glGetActiveAttribARB GLEW_GET_FUN(__glewGetActiveAttribARB)\n#define glGetAttribLocationARB GLEW_GET_FUN(__glewGetAttribLocationARB)\n\n#define GLEW_ARB_vertex_shader GLEW_GET_VAR(__GLEW_ARB_vertex_shader)\n\n#endif /* GL_ARB_vertex_shader */\n\n/* ------------------- GL_ARB_vertex_type_2_10_10_10_rev ------------------- */\n\n#ifndef GL_ARB_vertex_type_2_10_10_10_rev\n#define GL_ARB_vertex_type_2_10_10_10_rev 1\n\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\n#define GL_INT_2_10_10_10_REV 0x8D9F\n\ntypedef void (GLAPIENTRY * PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);\ntypedef void (GLAPIENTRY * PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint* color);\ntypedef void (GLAPIENTRY * PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);\ntypedef void (GLAPIENTRY * PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint* color);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint* color);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint* coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint* value);\n\n#define glColorP3ui GLEW_GET_FUN(__glewColorP3ui)\n#define glColorP3uiv GLEW_GET_FUN(__glewColorP3uiv)\n#define glColorP4ui GLEW_GET_FUN(__glewColorP4ui)\n#define glColorP4uiv GLEW_GET_FUN(__glewColorP4uiv)\n#define glMultiTexCoordP1ui GLEW_GET_FUN(__glewMultiTexCoordP1ui)\n#define glMultiTexCoordP1uiv GLEW_GET_FUN(__glewMultiTexCoordP1uiv)\n#define glMultiTexCoordP2ui GLEW_GET_FUN(__glewMultiTexCoordP2ui)\n#define glMultiTexCoordP2uiv GLEW_GET_FUN(__glewMultiTexCoordP2uiv)\n#define glMultiTexCoordP3ui GLEW_GET_FUN(__glewMultiTexCoordP3ui)\n#define glMultiTexCoordP3uiv GLEW_GET_FUN(__glewMultiTexCoordP3uiv)\n#define glMultiTexCoordP4ui GLEW_GET_FUN(__glewMultiTexCoordP4ui)\n#define glMultiTexCoordP4uiv GLEW_GET_FUN(__glewMultiTexCoordP4uiv)\n#define glNormalP3ui GLEW_GET_FUN(__glewNormalP3ui)\n#define glNormalP3uiv GLEW_GET_FUN(__glewNormalP3uiv)\n#define glSecondaryColorP3ui GLEW_GET_FUN(__glewSecondaryColorP3ui)\n#define glSecondaryColorP3uiv GLEW_GET_FUN(__glewSecondaryColorP3uiv)\n#define glTexCoordP1ui GLEW_GET_FUN(__glewTexCoordP1ui)\n#define glTexCoordP1uiv GLEW_GET_FUN(__glewTexCoordP1uiv)\n#define glTexCoordP2ui GLEW_GET_FUN(__glewTexCoordP2ui)\n#define glTexCoordP2uiv GLEW_GET_FUN(__glewTexCoordP2uiv)\n#define glTexCoordP3ui GLEW_GET_FUN(__glewTexCoordP3ui)\n#define glTexCoordP3uiv GLEW_GET_FUN(__glewTexCoordP3uiv)\n#define glTexCoordP4ui GLEW_GET_FUN(__glewTexCoordP4ui)\n#define glTexCoordP4uiv GLEW_GET_FUN(__glewTexCoordP4uiv)\n#define glVertexAttribP1ui GLEW_GET_FUN(__glewVertexAttribP1ui)\n#define glVertexAttribP1uiv GLEW_GET_FUN(__glewVertexAttribP1uiv)\n#define glVertexAttribP2ui GLEW_GET_FUN(__glewVertexAttribP2ui)\n#define glVertexAttribP2uiv GLEW_GET_FUN(__glewVertexAttribP2uiv)\n#define glVertexAttribP3ui GLEW_GET_FUN(__glewVertexAttribP3ui)\n#define glVertexAttribP3uiv GLEW_GET_FUN(__glewVertexAttribP3uiv)\n#define glVertexAttribP4ui GLEW_GET_FUN(__glewVertexAttribP4ui)\n#define glVertexAttribP4uiv GLEW_GET_FUN(__glewVertexAttribP4uiv)\n#define glVertexP2ui GLEW_GET_FUN(__glewVertexP2ui)\n#define glVertexP2uiv GLEW_GET_FUN(__glewVertexP2uiv)\n#define glVertexP3ui GLEW_GET_FUN(__glewVertexP3ui)\n#define glVertexP3uiv GLEW_GET_FUN(__glewVertexP3uiv)\n#define glVertexP4ui GLEW_GET_FUN(__glewVertexP4ui)\n#define glVertexP4uiv GLEW_GET_FUN(__glewVertexP4uiv)\n\n#define GLEW_ARB_vertex_type_2_10_10_10_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_2_10_10_10_rev)\n\n#endif /* GL_ARB_vertex_type_2_10_10_10_rev */\n\n/* ------------------------- GL_ARB_viewport_array ------------------------- */\n\n#ifndef GL_ARB_viewport_array\n#define GL_ARB_viewport_array 1\n\n#define GL_DEPTH_RANGE 0x0B70\n#define GL_VIEWPORT 0x0BA2\n#define GL_SCISSOR_BOX 0x0C10\n#define GL_SCISSOR_TEST 0x0C11\n#define GL_MAX_VIEWPORTS 0x825B\n#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C\n#define GL_VIEWPORT_BOUNDS_RANGE 0x825D\n#define GL_LAYER_PROVOKING_VERTEX 0x825E\n#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F\n#define GL_UNDEFINED_VERTEX 0x8260\n#define GL_FIRST_VERTEX_CONVENTION 0x8E4D\n#define GL_LAST_VERTEX_CONVENTION 0x8E4E\n#define GL_PROVOKING_VERTEX 0x8E4F\n\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd * v);\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f);\ntypedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble* data);\ntypedef void (GLAPIENTRY * PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat* data);\ntypedef void (GLAPIENTRY * PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint * v);\ntypedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint * v);\ntypedef void (GLAPIENTRY * PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat * v);\ntypedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\ntypedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat * v);\n\n#define glDepthRangeArrayv GLEW_GET_FUN(__glewDepthRangeArrayv)\n#define glDepthRangeIndexed GLEW_GET_FUN(__glewDepthRangeIndexed)\n#define glGetDoublei_v GLEW_GET_FUN(__glewGetDoublei_v)\n#define glGetFloati_v GLEW_GET_FUN(__glewGetFloati_v)\n#define glScissorArrayv GLEW_GET_FUN(__glewScissorArrayv)\n#define glScissorIndexed GLEW_GET_FUN(__glewScissorIndexed)\n#define glScissorIndexedv GLEW_GET_FUN(__glewScissorIndexedv)\n#define glViewportArrayv GLEW_GET_FUN(__glewViewportArrayv)\n#define glViewportIndexedf GLEW_GET_FUN(__glewViewportIndexedf)\n#define glViewportIndexedfv GLEW_GET_FUN(__glewViewportIndexedfv)\n\n#define GLEW_ARB_viewport_array GLEW_GET_VAR(__GLEW_ARB_viewport_array)\n\n#endif /* GL_ARB_viewport_array */\n\n/* --------------------------- GL_ARB_window_pos --------------------------- */\n\n#ifndef GL_ARB_window_pos\n#define GL_ARB_window_pos 1\n\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p);\n\n#define glWindowPos2dARB GLEW_GET_FUN(__glewWindowPos2dARB)\n#define glWindowPos2dvARB GLEW_GET_FUN(__glewWindowPos2dvARB)\n#define glWindowPos2fARB GLEW_GET_FUN(__glewWindowPos2fARB)\n#define glWindowPos2fvARB GLEW_GET_FUN(__glewWindowPos2fvARB)\n#define glWindowPos2iARB GLEW_GET_FUN(__glewWindowPos2iARB)\n#define glWindowPos2ivARB GLEW_GET_FUN(__glewWindowPos2ivARB)\n#define glWindowPos2sARB GLEW_GET_FUN(__glewWindowPos2sARB)\n#define glWindowPos2svARB GLEW_GET_FUN(__glewWindowPos2svARB)\n#define glWindowPos3dARB GLEW_GET_FUN(__glewWindowPos3dARB)\n#define glWindowPos3dvARB GLEW_GET_FUN(__glewWindowPos3dvARB)\n#define glWindowPos3fARB GLEW_GET_FUN(__glewWindowPos3fARB)\n#define glWindowPos3fvARB GLEW_GET_FUN(__glewWindowPos3fvARB)\n#define glWindowPos3iARB GLEW_GET_FUN(__glewWindowPos3iARB)\n#define glWindowPos3ivARB GLEW_GET_FUN(__glewWindowPos3ivARB)\n#define glWindowPos3sARB GLEW_GET_FUN(__glewWindowPos3sARB)\n#define glWindowPos3svARB GLEW_GET_FUN(__glewWindowPos3svARB)\n\n#define GLEW_ARB_window_pos GLEW_GET_VAR(__GLEW_ARB_window_pos)\n\n#endif /* GL_ARB_window_pos */\n\n/* ------------------------- GL_ATIX_point_sprites ------------------------- */\n\n#ifndef GL_ATIX_point_sprites\n#define GL_ATIX_point_sprites 1\n\n#define GL_TEXTURE_POINT_MODE_ATIX 0x60B0\n#define GL_TEXTURE_POINT_ONE_COORD_ATIX 0x60B1\n#define GL_TEXTURE_POINT_SPRITE_ATIX 0x60B2\n#define GL_POINT_SPRITE_CULL_MODE_ATIX 0x60B3\n#define GL_POINT_SPRITE_CULL_CENTER_ATIX 0x60B4\n#define GL_POINT_SPRITE_CULL_CLIP_ATIX 0x60B5\n\n#define GLEW_ATIX_point_sprites GLEW_GET_VAR(__GLEW_ATIX_point_sprites)\n\n#endif /* GL_ATIX_point_sprites */\n\n/* ---------------------- GL_ATIX_texture_env_combine3 --------------------- */\n\n#ifndef GL_ATIX_texture_env_combine3\n#define GL_ATIX_texture_env_combine3 1\n\n#define GL_MODULATE_ADD_ATIX 0x8744\n#define GL_MODULATE_SIGNED_ADD_ATIX 0x8745\n#define GL_MODULATE_SUBTRACT_ATIX 0x8746\n\n#define GLEW_ATIX_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATIX_texture_env_combine3)\n\n#endif /* GL_ATIX_texture_env_combine3 */\n\n/* ----------------------- GL_ATIX_texture_env_route ----------------------- */\n\n#ifndef GL_ATIX_texture_env_route\n#define GL_ATIX_texture_env_route 1\n\n#define GL_SECONDARY_COLOR_ATIX 0x8747\n#define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748\n#define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749\n\n#define GLEW_ATIX_texture_env_route GLEW_GET_VAR(__GLEW_ATIX_texture_env_route)\n\n#endif /* GL_ATIX_texture_env_route */\n\n/* ---------------- GL_ATIX_vertex_shader_output_point_size ---------------- */\n\n#ifndef GL_ATIX_vertex_shader_output_point_size\n#define GL_ATIX_vertex_shader_output_point_size 1\n\n#define GL_OUTPUT_POINT_SIZE_ATIX 0x610E\n\n#define GLEW_ATIX_vertex_shader_output_point_size GLEW_GET_VAR(__GLEW_ATIX_vertex_shader_output_point_size)\n\n#endif /* GL_ATIX_vertex_shader_output_point_size */\n\n/* -------------------------- GL_ATI_draw_buffers -------------------------- */\n\n#ifndef GL_ATI_draw_buffers\n#define GL_ATI_draw_buffers 1\n\n#define GL_MAX_DRAW_BUFFERS_ATI 0x8824\n#define GL_DRAW_BUFFER0_ATI 0x8825\n#define GL_DRAW_BUFFER1_ATI 0x8826\n#define GL_DRAW_BUFFER2_ATI 0x8827\n#define GL_DRAW_BUFFER3_ATI 0x8828\n#define GL_DRAW_BUFFER4_ATI 0x8829\n#define GL_DRAW_BUFFER5_ATI 0x882A\n#define GL_DRAW_BUFFER6_ATI 0x882B\n#define GL_DRAW_BUFFER7_ATI 0x882C\n#define GL_DRAW_BUFFER8_ATI 0x882D\n#define GL_DRAW_BUFFER9_ATI 0x882E\n#define GL_DRAW_BUFFER10_ATI 0x882F\n#define GL_DRAW_BUFFER11_ATI 0x8830\n#define GL_DRAW_BUFFER12_ATI 0x8831\n#define GL_DRAW_BUFFER13_ATI 0x8832\n#define GL_DRAW_BUFFER14_ATI 0x8833\n#define GL_DRAW_BUFFER15_ATI 0x8834\n\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum* bufs);\n\n#define glDrawBuffersATI GLEW_GET_FUN(__glewDrawBuffersATI)\n\n#define GLEW_ATI_draw_buffers GLEW_GET_VAR(__GLEW_ATI_draw_buffers)\n\n#endif /* GL_ATI_draw_buffers */\n\n/* -------------------------- GL_ATI_element_array ------------------------- */\n\n#ifndef GL_ATI_element_array\n#define GL_ATI_element_array 1\n\n#define GL_ELEMENT_ARRAY_ATI 0x8768\n#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769\n#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A\n\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);\ntypedef void (GLAPIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void* pointer);\n\n#define glDrawElementArrayATI GLEW_GET_FUN(__glewDrawElementArrayATI)\n#define glDrawRangeElementArrayATI GLEW_GET_FUN(__glewDrawRangeElementArrayATI)\n#define glElementPointerATI GLEW_GET_FUN(__glewElementPointerATI)\n\n#define GLEW_ATI_element_array GLEW_GET_VAR(__GLEW_ATI_element_array)\n\n#endif /* GL_ATI_element_array */\n\n/* ------------------------- GL_ATI_envmap_bumpmap ------------------------- */\n\n#ifndef GL_ATI_envmap_bumpmap\n#define GL_ATI_envmap_bumpmap 1\n\n#define GL_BUMP_ROT_MATRIX_ATI 0x8775\n#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776\n#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777\n#define GL_BUMP_TEX_UNITS_ATI 0x8778\n#define GL_DUDV_ATI 0x8779\n#define GL_DU8DV8_ATI 0x877A\n#define GL_BUMP_ENVMAP_ATI 0x877B\n#define GL_BUMP_TARGET_ATI 0x877C\n\ntypedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);\ntypedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);\ntypedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);\ntypedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);\n\n#define glGetTexBumpParameterfvATI GLEW_GET_FUN(__glewGetTexBumpParameterfvATI)\n#define glGetTexBumpParameterivATI GLEW_GET_FUN(__glewGetTexBumpParameterivATI)\n#define glTexBumpParameterfvATI GLEW_GET_FUN(__glewTexBumpParameterfvATI)\n#define glTexBumpParameterivATI GLEW_GET_FUN(__glewTexBumpParameterivATI)\n\n#define GLEW_ATI_envmap_bumpmap GLEW_GET_VAR(__GLEW_ATI_envmap_bumpmap)\n\n#endif /* GL_ATI_envmap_bumpmap */\n\n/* ------------------------- GL_ATI_fragment_shader ------------------------ */\n\n#ifndef GL_ATI_fragment_shader\n#define GL_ATI_fragment_shader 1\n\n#define GL_RED_BIT_ATI 0x00000001\n#define GL_2X_BIT_ATI 0x00000001\n#define GL_4X_BIT_ATI 0x00000002\n#define GL_GREEN_BIT_ATI 0x00000002\n#define GL_COMP_BIT_ATI 0x00000002\n#define GL_BLUE_BIT_ATI 0x00000004\n#define GL_8X_BIT_ATI 0x00000004\n#define GL_NEGATE_BIT_ATI 0x00000004\n#define GL_BIAS_BIT_ATI 0x00000008\n#define GL_HALF_BIT_ATI 0x00000008\n#define GL_QUARTER_BIT_ATI 0x00000010\n#define GL_EIGHTH_BIT_ATI 0x00000020\n#define GL_SATURATE_BIT_ATI 0x00000040\n#define GL_FRAGMENT_SHADER_ATI 0x8920\n#define GL_REG_0_ATI 0x8921\n#define GL_REG_1_ATI 0x8922\n#define GL_REG_2_ATI 0x8923\n#define GL_REG_3_ATI 0x8924\n#define GL_REG_4_ATI 0x8925\n#define GL_REG_5_ATI 0x8926\n#define GL_CON_0_ATI 0x8941\n#define GL_CON_1_ATI 0x8942\n#define GL_CON_2_ATI 0x8943\n#define GL_CON_3_ATI 0x8944\n#define GL_CON_4_ATI 0x8945\n#define GL_CON_5_ATI 0x8946\n#define GL_CON_6_ATI 0x8947\n#define GL_CON_7_ATI 0x8948\n#define GL_MOV_ATI 0x8961\n#define GL_ADD_ATI 0x8963\n#define GL_MUL_ATI 0x8964\n#define GL_SUB_ATI 0x8965\n#define GL_DOT3_ATI 0x8966\n#define GL_DOT4_ATI 0x8967\n#define GL_MAD_ATI 0x8968\n#define GL_LERP_ATI 0x8969\n#define GL_CND_ATI 0x896A\n#define GL_CND0_ATI 0x896B\n#define GL_DOT2_ADD_ATI 0x896C\n#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D\n#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E\n#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F\n#define GL_NUM_PASSES_ATI 0x8970\n#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971\n#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972\n#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973\n#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974\n#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975\n#define GL_SWIZZLE_STR_ATI 0x8976\n#define GL_SWIZZLE_STQ_ATI 0x8977\n#define GL_SWIZZLE_STR_DR_ATI 0x8978\n#define GL_SWIZZLE_STQ_DQ_ATI 0x8979\n#define GL_SWIZZLE_STRQ_ATI 0x897A\n#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B\n\ntypedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\ntypedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\ntypedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\ntypedef void (GLAPIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\ntypedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\ntypedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\ntypedef void (GLAPIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void);\ntypedef GLuint (GLAPIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);\ntypedef void (GLAPIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);\ntypedef void (GLAPIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat* value);\n\n#define glAlphaFragmentOp1ATI GLEW_GET_FUN(__glewAlphaFragmentOp1ATI)\n#define glAlphaFragmentOp2ATI GLEW_GET_FUN(__glewAlphaFragmentOp2ATI)\n#define glAlphaFragmentOp3ATI GLEW_GET_FUN(__glewAlphaFragmentOp3ATI)\n#define glBeginFragmentShaderATI GLEW_GET_FUN(__glewBeginFragmentShaderATI)\n#define glBindFragmentShaderATI GLEW_GET_FUN(__glewBindFragmentShaderATI)\n#define glColorFragmentOp1ATI GLEW_GET_FUN(__glewColorFragmentOp1ATI)\n#define glColorFragmentOp2ATI GLEW_GET_FUN(__glewColorFragmentOp2ATI)\n#define glColorFragmentOp3ATI GLEW_GET_FUN(__glewColorFragmentOp3ATI)\n#define glDeleteFragmentShaderATI GLEW_GET_FUN(__glewDeleteFragmentShaderATI)\n#define glEndFragmentShaderATI GLEW_GET_FUN(__glewEndFragmentShaderATI)\n#define glGenFragmentShadersATI GLEW_GET_FUN(__glewGenFragmentShadersATI)\n#define glPassTexCoordATI GLEW_GET_FUN(__glewPassTexCoordATI)\n#define glSampleMapATI GLEW_GET_FUN(__glewSampleMapATI)\n#define glSetFragmentShaderConstantATI GLEW_GET_FUN(__glewSetFragmentShaderConstantATI)\n\n#define GLEW_ATI_fragment_shader GLEW_GET_VAR(__GLEW_ATI_fragment_shader)\n\n#endif /* GL_ATI_fragment_shader */\n\n/* ------------------------ GL_ATI_map_object_buffer ----------------------- */\n\n#ifndef GL_ATI_map_object_buffer\n#define GL_ATI_map_object_buffer 1\n\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);\n\n#define glMapObjectBufferATI GLEW_GET_FUN(__glewMapObjectBufferATI)\n#define glUnmapObjectBufferATI GLEW_GET_FUN(__glewUnmapObjectBufferATI)\n\n#define GLEW_ATI_map_object_buffer GLEW_GET_VAR(__GLEW_ATI_map_object_buffer)\n\n#endif /* GL_ATI_map_object_buffer */\n\n/* ----------------------------- GL_ATI_meminfo ---------------------------- */\n\n#ifndef GL_ATI_meminfo\n#define GL_ATI_meminfo 1\n\n#define GL_VBO_FREE_MEMORY_ATI 0x87FB\n#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC\n#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD\n\n#define GLEW_ATI_meminfo GLEW_GET_VAR(__GLEW_ATI_meminfo)\n\n#endif /* GL_ATI_meminfo */\n\n/* -------------------------- GL_ATI_pn_triangles -------------------------- */\n\n#ifndef GL_ATI_pn_triangles\n#define GL_ATI_pn_triangles 1\n\n#define GL_PN_TRIANGLES_ATI 0x87F0\n#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1\n#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2\n#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3\n#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4\n#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5\n#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6\n#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7\n#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8\n\ntypedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);\n\n#define glPNTrianglesfATI GLEW_GET_FUN(__glewPNTrianglesfATI)\n#define glPNTrianglesiATI GLEW_GET_FUN(__glewPNTrianglesiATI)\n\n#define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles)\n\n#endif /* GL_ATI_pn_triangles */\n\n/* ------------------------ GL_ATI_separate_stencil ------------------------ */\n\n#ifndef GL_ATI_separate_stencil\n#define GL_ATI_separate_stencil 1\n\n#define GL_STENCIL_BACK_FUNC_ATI 0x8800\n#define GL_STENCIL_BACK_FAIL_ATI 0x8801\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803\n\ntypedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\n\n#define glStencilFuncSeparateATI GLEW_GET_FUN(__glewStencilFuncSeparateATI)\n#define glStencilOpSeparateATI GLEW_GET_FUN(__glewStencilOpSeparateATI)\n\n#define GLEW_ATI_separate_stencil GLEW_GET_VAR(__GLEW_ATI_separate_stencil)\n\n#endif /* GL_ATI_separate_stencil */\n\n/* ----------------------- GL_ATI_shader_texture_lod ----------------------- */\n\n#ifndef GL_ATI_shader_texture_lod\n#define GL_ATI_shader_texture_lod 1\n\n#define GLEW_ATI_shader_texture_lod GLEW_GET_VAR(__GLEW_ATI_shader_texture_lod)\n\n#endif /* GL_ATI_shader_texture_lod */\n\n/* ---------------------- GL_ATI_text_fragment_shader ---------------------- */\n\n#ifndef GL_ATI_text_fragment_shader\n#define GL_ATI_text_fragment_shader 1\n\n#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200\n\n#define GLEW_ATI_text_fragment_shader GLEW_GET_VAR(__GLEW_ATI_text_fragment_shader)\n\n#endif /* GL_ATI_text_fragment_shader */\n\n/* --------------------- GL_ATI_texture_compression_3dc -------------------- */\n\n#ifndef GL_ATI_texture_compression_3dc\n#define GL_ATI_texture_compression_3dc 1\n\n#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837\n\n#define GLEW_ATI_texture_compression_3dc GLEW_GET_VAR(__GLEW_ATI_texture_compression_3dc)\n\n#endif /* GL_ATI_texture_compression_3dc */\n\n/* ---------------------- GL_ATI_texture_env_combine3 ---------------------- */\n\n#ifndef GL_ATI_texture_env_combine3\n#define GL_ATI_texture_env_combine3 1\n\n#define GL_MODULATE_ADD_ATI 0x8744\n#define GL_MODULATE_SIGNED_ADD_ATI 0x8745\n#define GL_MODULATE_SUBTRACT_ATI 0x8746\n\n#define GLEW_ATI_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATI_texture_env_combine3)\n\n#endif /* GL_ATI_texture_env_combine3 */\n\n/* -------------------------- GL_ATI_texture_float ------------------------- */\n\n#ifndef GL_ATI_texture_float\n#define GL_ATI_texture_float 1\n\n#define GL_RGBA_FLOAT32_ATI 0x8814\n#define GL_RGB_FLOAT32_ATI 0x8815\n#define GL_ALPHA_FLOAT32_ATI 0x8816\n#define GL_INTENSITY_FLOAT32_ATI 0x8817\n#define GL_LUMINANCE_FLOAT32_ATI 0x8818\n#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819\n#define GL_RGBA_FLOAT16_ATI 0x881A\n#define GL_RGB_FLOAT16_ATI 0x881B\n#define GL_ALPHA_FLOAT16_ATI 0x881C\n#define GL_INTENSITY_FLOAT16_ATI 0x881D\n#define GL_LUMINANCE_FLOAT16_ATI 0x881E\n#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F\n\n#define GLEW_ATI_texture_float GLEW_GET_VAR(__GLEW_ATI_texture_float)\n\n#endif /* GL_ATI_texture_float */\n\n/* ----------------------- GL_ATI_texture_mirror_once ---------------------- */\n\n#ifndef GL_ATI_texture_mirror_once\n#define GL_ATI_texture_mirror_once 1\n\n#define GL_MIRROR_CLAMP_ATI 0x8742\n#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743\n\n#define GLEW_ATI_texture_mirror_once GLEW_GET_VAR(__GLEW_ATI_texture_mirror_once)\n\n#endif /* GL_ATI_texture_mirror_once */\n\n/* ----------------------- GL_ATI_vertex_array_object ---------------------- */\n\n#ifndef GL_ATI_vertex_array_object\n#define GL_ATI_vertex_array_object 1\n\n#define GL_STATIC_ATI 0x8760\n#define GL_DYNAMIC_ATI 0x8761\n#define GL_PRESERVE_ATI 0x8762\n#define GL_DISCARD_ATI 0x8763\n#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764\n#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765\n#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766\n#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767\n\ntypedef void (GLAPIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\ntypedef void (GLAPIENTRY * PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);\ntypedef GLuint (GLAPIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void* pointer, GLenum usage);\ntypedef void (GLAPIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void* pointer, GLenum preserve);\ntypedef void (GLAPIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\n\n#define glArrayObjectATI GLEW_GET_FUN(__glewArrayObjectATI)\n#define glFreeObjectBufferATI GLEW_GET_FUN(__glewFreeObjectBufferATI)\n#define glGetArrayObjectfvATI GLEW_GET_FUN(__glewGetArrayObjectfvATI)\n#define glGetArrayObjectivATI GLEW_GET_FUN(__glewGetArrayObjectivATI)\n#define glGetObjectBufferfvATI GLEW_GET_FUN(__glewGetObjectBufferfvATI)\n#define glGetObjectBufferivATI GLEW_GET_FUN(__glewGetObjectBufferivATI)\n#define glGetVariantArrayObjectfvATI GLEW_GET_FUN(__glewGetVariantArrayObjectfvATI)\n#define glGetVariantArrayObjectivATI GLEW_GET_FUN(__glewGetVariantArrayObjectivATI)\n#define glIsObjectBufferATI GLEW_GET_FUN(__glewIsObjectBufferATI)\n#define glNewObjectBufferATI GLEW_GET_FUN(__glewNewObjectBufferATI)\n#define glUpdateObjectBufferATI GLEW_GET_FUN(__glewUpdateObjectBufferATI)\n#define glVariantArrayObjectATI GLEW_GET_FUN(__glewVariantArrayObjectATI)\n\n#define GLEW_ATI_vertex_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_array_object)\n\n#endif /* GL_ATI_vertex_array_object */\n\n/* ------------------- GL_ATI_vertex_attrib_array_object ------------------- */\n\n#ifndef GL_ATI_vertex_attrib_array_object\n#define GL_ATI_vertex_attrib_array_object 1\n\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);\n\n#define glGetVertexAttribArrayObjectfvATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectfvATI)\n#define glGetVertexAttribArrayObjectivATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectivATI)\n#define glVertexAttribArrayObjectATI GLEW_GET_FUN(__glewVertexAttribArrayObjectATI)\n\n#define GLEW_ATI_vertex_attrib_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_attrib_array_object)\n\n#endif /* GL_ATI_vertex_attrib_array_object */\n\n/* ------------------------- GL_ATI_vertex_streams ------------------------- */\n\n#ifndef GL_ATI_vertex_streams\n#define GL_ATI_vertex_streams 1\n\n#define GL_MAX_VERTEX_STREAMS_ATI 0x876B\n#define GL_VERTEX_SOURCE_ATI 0x876C\n#define GL_VERTEX_STREAM0_ATI 0x876D\n#define GL_VERTEX_STREAM1_ATI 0x876E\n#define GL_VERTEX_STREAM2_ATI 0x876F\n#define GL_VERTEX_STREAM3_ATI 0x8770\n#define GL_VERTEX_STREAM4_ATI 0x8771\n#define GL_VERTEX_STREAM5_ATI 0x8772\n#define GL_VERTEX_STREAM6_ATI 0x8773\n#define GL_VERTEX_STREAM7_ATI 0x8774\n\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);\n\n#define glClientActiveVertexStreamATI GLEW_GET_FUN(__glewClientActiveVertexStreamATI)\n#define glNormalStream3bATI GLEW_GET_FUN(__glewNormalStream3bATI)\n#define glNormalStream3bvATI GLEW_GET_FUN(__glewNormalStream3bvATI)\n#define glNormalStream3dATI GLEW_GET_FUN(__glewNormalStream3dATI)\n#define glNormalStream3dvATI GLEW_GET_FUN(__glewNormalStream3dvATI)\n#define glNormalStream3fATI GLEW_GET_FUN(__glewNormalStream3fATI)\n#define glNormalStream3fvATI GLEW_GET_FUN(__glewNormalStream3fvATI)\n#define glNormalStream3iATI GLEW_GET_FUN(__glewNormalStream3iATI)\n#define glNormalStream3ivATI GLEW_GET_FUN(__glewNormalStream3ivATI)\n#define glNormalStream3sATI GLEW_GET_FUN(__glewNormalStream3sATI)\n#define glNormalStream3svATI GLEW_GET_FUN(__glewNormalStream3svATI)\n#define glVertexBlendEnvfATI GLEW_GET_FUN(__glewVertexBlendEnvfATI)\n#define glVertexBlendEnviATI GLEW_GET_FUN(__glewVertexBlendEnviATI)\n#define glVertexStream1dATI GLEW_GET_FUN(__glewVertexStream1dATI)\n#define glVertexStream1dvATI GLEW_GET_FUN(__glewVertexStream1dvATI)\n#define glVertexStream1fATI GLEW_GET_FUN(__glewVertexStream1fATI)\n#define glVertexStream1fvATI GLEW_GET_FUN(__glewVertexStream1fvATI)\n#define glVertexStream1iATI GLEW_GET_FUN(__glewVertexStream1iATI)\n#define glVertexStream1ivATI GLEW_GET_FUN(__glewVertexStream1ivATI)\n#define glVertexStream1sATI GLEW_GET_FUN(__glewVertexStream1sATI)\n#define glVertexStream1svATI GLEW_GET_FUN(__glewVertexStream1svATI)\n#define glVertexStream2dATI GLEW_GET_FUN(__glewVertexStream2dATI)\n#define glVertexStream2dvATI GLEW_GET_FUN(__glewVertexStream2dvATI)\n#define glVertexStream2fATI GLEW_GET_FUN(__glewVertexStream2fATI)\n#define glVertexStream2fvATI GLEW_GET_FUN(__glewVertexStream2fvATI)\n#define glVertexStream2iATI GLEW_GET_FUN(__glewVertexStream2iATI)\n#define glVertexStream2ivATI GLEW_GET_FUN(__glewVertexStream2ivATI)\n#define glVertexStream2sATI GLEW_GET_FUN(__glewVertexStream2sATI)\n#define glVertexStream2svATI GLEW_GET_FUN(__glewVertexStream2svATI)\n#define glVertexStream3dATI GLEW_GET_FUN(__glewVertexStream3dATI)\n#define glVertexStream3dvATI GLEW_GET_FUN(__glewVertexStream3dvATI)\n#define glVertexStream3fATI GLEW_GET_FUN(__glewVertexStream3fATI)\n#define glVertexStream3fvATI GLEW_GET_FUN(__glewVertexStream3fvATI)\n#define glVertexStream3iATI GLEW_GET_FUN(__glewVertexStream3iATI)\n#define glVertexStream3ivATI GLEW_GET_FUN(__glewVertexStream3ivATI)\n#define glVertexStream3sATI GLEW_GET_FUN(__glewVertexStream3sATI)\n#define glVertexStream3svATI GLEW_GET_FUN(__glewVertexStream3svATI)\n#define glVertexStream4dATI GLEW_GET_FUN(__glewVertexStream4dATI)\n#define glVertexStream4dvATI GLEW_GET_FUN(__glewVertexStream4dvATI)\n#define glVertexStream4fATI GLEW_GET_FUN(__glewVertexStream4fATI)\n#define glVertexStream4fvATI GLEW_GET_FUN(__glewVertexStream4fvATI)\n#define glVertexStream4iATI GLEW_GET_FUN(__glewVertexStream4iATI)\n#define glVertexStream4ivATI GLEW_GET_FUN(__glewVertexStream4ivATI)\n#define glVertexStream4sATI GLEW_GET_FUN(__glewVertexStream4sATI)\n#define glVertexStream4svATI GLEW_GET_FUN(__glewVertexStream4svATI)\n\n#define GLEW_ATI_vertex_streams GLEW_GET_VAR(__GLEW_ATI_vertex_streams)\n\n#endif /* GL_ATI_vertex_streams */\n\n/* --------------------------- GL_EXT_422_pixels --------------------------- */\n\n#ifndef GL_EXT_422_pixels\n#define GL_EXT_422_pixels 1\n\n#define GL_422_EXT 0x80CC\n#define GL_422_REV_EXT 0x80CD\n#define GL_422_AVERAGE_EXT 0x80CE\n#define GL_422_REV_AVERAGE_EXT 0x80CF\n\n#define GLEW_EXT_422_pixels GLEW_GET_VAR(__GLEW_EXT_422_pixels)\n\n#endif /* GL_EXT_422_pixels */\n\n/* ---------------------------- GL_EXT_Cg_shader --------------------------- */\n\n#ifndef GL_EXT_Cg_shader\n#define GL_EXT_Cg_shader 1\n\n#define GL_CG_VERTEX_SHADER_EXT 0x890E\n#define GL_CG_FRAGMENT_SHADER_EXT 0x890F\n\n#define GLEW_EXT_Cg_shader GLEW_GET_VAR(__GLEW_EXT_Cg_shader)\n\n#endif /* GL_EXT_Cg_shader */\n\n/* ------------------------------ GL_EXT_abgr ------------------------------ */\n\n#ifndef GL_EXT_abgr\n#define GL_EXT_abgr 1\n\n#define GL_ABGR_EXT 0x8000\n\n#define GLEW_EXT_abgr GLEW_GET_VAR(__GLEW_EXT_abgr)\n\n#endif /* GL_EXT_abgr */\n\n/* ------------------------------ GL_EXT_bgra ------------------------------ */\n\n#ifndef GL_EXT_bgra\n#define GL_EXT_bgra 1\n\n#define GL_BGR_EXT 0x80E0\n#define GL_BGRA_EXT 0x80E1\n\n#define GLEW_EXT_bgra GLEW_GET_VAR(__GLEW_EXT_bgra)\n\n#endif /* GL_EXT_bgra */\n\n/* ------------------------ GL_EXT_bindable_uniform ------------------------ */\n\n#ifndef GL_EXT_bindable_uniform\n#define GL_EXT_bindable_uniform 1\n\n#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2\n#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3\n#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4\n#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED\n#define GL_UNIFORM_BUFFER_EXT 0x8DEE\n#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF\n\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);\ntypedef GLintptr (GLAPIENTRY * PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);\n\n#define glGetUniformBufferSizeEXT GLEW_GET_FUN(__glewGetUniformBufferSizeEXT)\n#define glGetUniformOffsetEXT GLEW_GET_FUN(__glewGetUniformOffsetEXT)\n#define glUniformBufferEXT GLEW_GET_FUN(__glewUniformBufferEXT)\n\n#define GLEW_EXT_bindable_uniform GLEW_GET_VAR(__GLEW_EXT_bindable_uniform)\n\n#endif /* GL_EXT_bindable_uniform */\n\n/* --------------------------- GL_EXT_blend_color -------------------------- */\n\n#ifndef GL_EXT_blend_color\n#define GL_EXT_blend_color 1\n\n#define GL_CONSTANT_COLOR_EXT 0x8001\n#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002\n#define GL_CONSTANT_ALPHA_EXT 0x8003\n#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004\n#define GL_BLEND_COLOR_EXT 0x8005\n\ntypedef void (GLAPIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\n\n#define glBlendColorEXT GLEW_GET_FUN(__glewBlendColorEXT)\n\n#define GLEW_EXT_blend_color GLEW_GET_VAR(__GLEW_EXT_blend_color)\n\n#endif /* GL_EXT_blend_color */\n\n/* --------------------- GL_EXT_blend_equation_separate -------------------- */\n\n#ifndef GL_EXT_blend_equation_separate\n#define GL_EXT_blend_equation_separate 1\n\n#define GL_BLEND_EQUATION_RGB_EXT 0x8009\n#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D\n\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);\n\n#define glBlendEquationSeparateEXT GLEW_GET_FUN(__glewBlendEquationSeparateEXT)\n\n#define GLEW_EXT_blend_equation_separate GLEW_GET_VAR(__GLEW_EXT_blend_equation_separate)\n\n#endif /* GL_EXT_blend_equation_separate */\n\n/* ----------------------- GL_EXT_blend_func_separate ---------------------- */\n\n#ifndef GL_EXT_blend_func_separate\n#define GL_EXT_blend_func_separate 1\n\n#define GL_BLEND_DST_RGB_EXT 0x80C8\n#define GL_BLEND_SRC_RGB_EXT 0x80C9\n#define GL_BLEND_DST_ALPHA_EXT 0x80CA\n#define GL_BLEND_SRC_ALPHA_EXT 0x80CB\n\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\n\n#define glBlendFuncSeparateEXT GLEW_GET_FUN(__glewBlendFuncSeparateEXT)\n\n#define GLEW_EXT_blend_func_separate GLEW_GET_VAR(__GLEW_EXT_blend_func_separate)\n\n#endif /* GL_EXT_blend_func_separate */\n\n/* ------------------------- GL_EXT_blend_logic_op ------------------------- */\n\n#ifndef GL_EXT_blend_logic_op\n#define GL_EXT_blend_logic_op 1\n\n#define GLEW_EXT_blend_logic_op GLEW_GET_VAR(__GLEW_EXT_blend_logic_op)\n\n#endif /* GL_EXT_blend_logic_op */\n\n/* -------------------------- GL_EXT_blend_minmax -------------------------- */\n\n#ifndef GL_EXT_blend_minmax\n#define GL_EXT_blend_minmax 1\n\n#define GL_FUNC_ADD_EXT 0x8006\n#define GL_MIN_EXT 0x8007\n#define GL_MAX_EXT 0x8008\n#define GL_BLEND_EQUATION_EXT 0x8009\n\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);\n\n#define glBlendEquationEXT GLEW_GET_FUN(__glewBlendEquationEXT)\n\n#define GLEW_EXT_blend_minmax GLEW_GET_VAR(__GLEW_EXT_blend_minmax)\n\n#endif /* GL_EXT_blend_minmax */\n\n/* ------------------------- GL_EXT_blend_subtract ------------------------- */\n\n#ifndef GL_EXT_blend_subtract\n#define GL_EXT_blend_subtract 1\n\n#define GL_FUNC_SUBTRACT_EXT 0x800A\n#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B\n\n#define GLEW_EXT_blend_subtract GLEW_GET_VAR(__GLEW_EXT_blend_subtract)\n\n#endif /* GL_EXT_blend_subtract */\n\n/* ------------------------ GL_EXT_clip_volume_hint ------------------------ */\n\n#ifndef GL_EXT_clip_volume_hint\n#define GL_EXT_clip_volume_hint 1\n\n#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0\n\n#define GLEW_EXT_clip_volume_hint GLEW_GET_VAR(__GLEW_EXT_clip_volume_hint)\n\n#endif /* GL_EXT_clip_volume_hint */\n\n/* ------------------------------ GL_EXT_cmyka ----------------------------- */\n\n#ifndef GL_EXT_cmyka\n#define GL_EXT_cmyka 1\n\n#define GL_CMYK_EXT 0x800C\n#define GL_CMYKA_EXT 0x800D\n#define GL_PACK_CMYK_HINT_EXT 0x800E\n#define GL_UNPACK_CMYK_HINT_EXT 0x800F\n\n#define GLEW_EXT_cmyka GLEW_GET_VAR(__GLEW_EXT_cmyka)\n\n#endif /* GL_EXT_cmyka */\n\n/* ------------------------- GL_EXT_color_subtable ------------------------- */\n\n#ifndef GL_EXT_color_subtable\n#define GL_EXT_color_subtable 1\n\ntypedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\n\n#define glColorSubTableEXT GLEW_GET_FUN(__glewColorSubTableEXT)\n#define glCopyColorSubTableEXT GLEW_GET_FUN(__glewCopyColorSubTableEXT)\n\n#define GLEW_EXT_color_subtable GLEW_GET_VAR(__GLEW_EXT_color_subtable)\n\n#endif /* GL_EXT_color_subtable */\n\n/* ---------------------- GL_EXT_compiled_vertex_array --------------------- */\n\n#ifndef GL_EXT_compiled_vertex_array\n#define GL_EXT_compiled_vertex_array 1\n\n#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8\n#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9\n\ntypedef void (GLAPIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);\ntypedef void (GLAPIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);\n\n#define glLockArraysEXT GLEW_GET_FUN(__glewLockArraysEXT)\n#define glUnlockArraysEXT GLEW_GET_FUN(__glewUnlockArraysEXT)\n\n#define GLEW_EXT_compiled_vertex_array GLEW_GET_VAR(__GLEW_EXT_compiled_vertex_array)\n\n#endif /* GL_EXT_compiled_vertex_array */\n\n/* --------------------------- GL_EXT_convolution -------------------------- */\n\n#ifndef GL_EXT_convolution\n#define GL_EXT_convolution 1\n\n#define GL_CONVOLUTION_1D_EXT 0x8010\n#define GL_CONVOLUTION_2D_EXT 0x8011\n#define GL_SEPARABLE_2D_EXT 0x8012\n#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013\n#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014\n#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015\n#define GL_REDUCE_EXT 0x8016\n#define GL_CONVOLUTION_FORMAT_EXT 0x8017\n#define GL_CONVOLUTION_WIDTH_EXT 0x8018\n#define GL_CONVOLUTION_HEIGHT_EXT 0x8019\n#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A\n#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B\n#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C\n#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D\n#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E\n#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F\n#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020\n#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021\n#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022\n#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023\n\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* image);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* image);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* image);\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* row, void* column, void* span);\ntypedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* row, const void* column);\n\n#define glConvolutionFilter1DEXT GLEW_GET_FUN(__glewConvolutionFilter1DEXT)\n#define glConvolutionFilter2DEXT GLEW_GET_FUN(__glewConvolutionFilter2DEXT)\n#define glConvolutionParameterfEXT GLEW_GET_FUN(__glewConvolutionParameterfEXT)\n#define glConvolutionParameterfvEXT GLEW_GET_FUN(__glewConvolutionParameterfvEXT)\n#define glConvolutionParameteriEXT GLEW_GET_FUN(__glewConvolutionParameteriEXT)\n#define glConvolutionParameterivEXT GLEW_GET_FUN(__glewConvolutionParameterivEXT)\n#define glCopyConvolutionFilter1DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter1DEXT)\n#define glCopyConvolutionFilter2DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter2DEXT)\n#define glGetConvolutionFilterEXT GLEW_GET_FUN(__glewGetConvolutionFilterEXT)\n#define glGetConvolutionParameterfvEXT GLEW_GET_FUN(__glewGetConvolutionParameterfvEXT)\n#define glGetConvolutionParameterivEXT GLEW_GET_FUN(__glewGetConvolutionParameterivEXT)\n#define glGetSeparableFilterEXT GLEW_GET_FUN(__glewGetSeparableFilterEXT)\n#define glSeparableFilter2DEXT GLEW_GET_FUN(__glewSeparableFilter2DEXT)\n\n#define GLEW_EXT_convolution GLEW_GET_VAR(__GLEW_EXT_convolution)\n\n#endif /* GL_EXT_convolution */\n\n/* ------------------------ GL_EXT_coordinate_frame ------------------------ */\n\n#ifndef GL_EXT_coordinate_frame\n#define GL_EXT_coordinate_frame 1\n\n#define GL_TANGENT_ARRAY_EXT 0x8439\n#define GL_BINORMAL_ARRAY_EXT 0x843A\n#define GL_CURRENT_TANGENT_EXT 0x843B\n#define GL_CURRENT_BINORMAL_EXT 0x843C\n#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E\n#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F\n#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440\n#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441\n#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442\n#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443\n#define GL_MAP1_TANGENT_EXT 0x8444\n#define GL_MAP2_TANGENT_EXT 0x8445\n#define GL_MAP1_BINORMAL_EXT 0x8446\n#define GL_MAP2_BINORMAL_EXT 0x8447\n\ntypedef void (GLAPIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer);\ntypedef void (GLAPIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer);\n\n#define glBinormalPointerEXT GLEW_GET_FUN(__glewBinormalPointerEXT)\n#define glTangentPointerEXT GLEW_GET_FUN(__glewTangentPointerEXT)\n\n#define GLEW_EXT_coordinate_frame GLEW_GET_VAR(__GLEW_EXT_coordinate_frame)\n\n#endif /* GL_EXT_coordinate_frame */\n\n/* -------------------------- GL_EXT_copy_texture -------------------------- */\n\n#ifndef GL_EXT_copy_texture\n#define GL_EXT_copy_texture 1\n\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\n\n#define glCopyTexImage1DEXT GLEW_GET_FUN(__glewCopyTexImage1DEXT)\n#define glCopyTexImage2DEXT GLEW_GET_FUN(__glewCopyTexImage2DEXT)\n#define glCopyTexSubImage1DEXT GLEW_GET_FUN(__glewCopyTexSubImage1DEXT)\n#define glCopyTexSubImage2DEXT GLEW_GET_FUN(__glewCopyTexSubImage2DEXT)\n#define glCopyTexSubImage3DEXT GLEW_GET_FUN(__glewCopyTexSubImage3DEXT)\n\n#define GLEW_EXT_copy_texture GLEW_GET_VAR(__GLEW_EXT_copy_texture)\n\n#endif /* GL_EXT_copy_texture */\n\n/* --------------------------- GL_EXT_cull_vertex -------------------------- */\n\n#ifndef GL_EXT_cull_vertex\n#define GL_EXT_cull_vertex 1\n\n#define GL_CULL_VERTEX_EXT 0x81AA\n#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB\n#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC\n\ntypedef void (GLAPIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params);\n\n#define glCullParameterdvEXT GLEW_GET_FUN(__glewCullParameterdvEXT)\n#define glCullParameterfvEXT GLEW_GET_FUN(__glewCullParameterfvEXT)\n\n#define GLEW_EXT_cull_vertex GLEW_GET_VAR(__GLEW_EXT_cull_vertex)\n\n#endif /* GL_EXT_cull_vertex */\n\n/* -------------------------- GL_EXT_debug_marker -------------------------- */\n\n#ifndef GL_EXT_debug_marker\n#define GL_EXT_debug_marker 1\n\ntypedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker);\ntypedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker);\n\n#define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT)\n#define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT)\n#define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT)\n\n#define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker)\n\n#endif /* GL_EXT_debug_marker */\n\n/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */\n\n#ifndef GL_EXT_depth_bounds_test\n#define GL_EXT_depth_bounds_test 1\n\n#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890\n#define GL_DEPTH_BOUNDS_EXT 0x8891\n\ntypedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);\n\n#define glDepthBoundsEXT GLEW_GET_FUN(__glewDepthBoundsEXT)\n\n#define GLEW_EXT_depth_bounds_test GLEW_GET_VAR(__GLEW_EXT_depth_bounds_test)\n\n#endif /* GL_EXT_depth_bounds_test */\n\n/* ----------------------- GL_EXT_direct_state_access ---------------------- */\n\n#ifndef GL_EXT_direct_state_access\n#define GL_EXT_direct_state_access 1\n\n#define GL_PROGRAM_MATRIX_EXT 0x8E2D\n#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E\n#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F\n\ntypedef void (GLAPIENTRY * PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);\ntypedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);\ntypedef void (GLAPIENTRY * PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);\ntypedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);\ntypedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, void* img);\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, void* img);\ntypedef void (GLAPIENTRY * PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* param);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void* pixels);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void** params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void* data);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void* string);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid** params);\ntypedef void (GLAPIENTRY * PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, GLvoid** params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void* pixels);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint* param);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLvoid** param);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, GLvoid** param);\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\ntypedef void (GLAPIENTRY * PFNGLMATRIXFRUSTUMEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f);\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum matrixMode);\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADDEXTPROC) (GLenum matrixMode, const GLdouble* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADFEXTPROC) (GLenum matrixMode, const GLfloat* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTDEXTPROC) (GLenum matrixMode, const GLdouble* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTFEXTPROC) (GLenum matrixMode, const GLfloat* m);\ntypedef void (GLAPIENTRY * PFNGLMATRIXORTHOEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f);\ntypedef void (GLAPIENTRY * PFNGLMATRIXPOPEXTPROC) (GLenum matrixMode);\ntypedef void (GLAPIENTRY * PFNGLMATRIXPUSHEXTPROC) (GLenum matrixMode);\ntypedef void (GLAPIENTRY * PFNGLMATRIXROTATEDEXTPROC) (GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLMATRIXROTATEFEXTPROC) (GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLMATRIXSCALEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLMATRIXSCALEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* param);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void* data, GLenum usage);\ntypedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void* data);\ntypedef void (GLAPIENTRY * PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void* string);\ntypedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat* param);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* param);\ntypedef void (GLAPIENTRY * PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\n\n#define glBindMultiTextureEXT GLEW_GET_FUN(__glewBindMultiTextureEXT)\n#define glCheckNamedFramebufferStatusEXT GLEW_GET_FUN(__glewCheckNamedFramebufferStatusEXT)\n#define glClientAttribDefaultEXT GLEW_GET_FUN(__glewClientAttribDefaultEXT)\n#define glCompressedMultiTexImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage1DEXT)\n#define glCompressedMultiTexImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage2DEXT)\n#define glCompressedMultiTexImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage3DEXT)\n#define glCompressedMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage1DEXT)\n#define glCompressedMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage2DEXT)\n#define glCompressedMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage3DEXT)\n#define glCompressedTextureImage1DEXT GLEW_GET_FUN(__glewCompressedTextureImage1DEXT)\n#define glCompressedTextureImage2DEXT GLEW_GET_FUN(__glewCompressedTextureImage2DEXT)\n#define glCompressedTextureImage3DEXT GLEW_GET_FUN(__glewCompressedTextureImage3DEXT)\n#define glCompressedTextureSubImage1DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage1DEXT)\n#define glCompressedTextureSubImage2DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage2DEXT)\n#define glCompressedTextureSubImage3DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage3DEXT)\n#define glCopyMultiTexImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexImage1DEXT)\n#define glCopyMultiTexImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexImage2DEXT)\n#define glCopyMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage1DEXT)\n#define glCopyMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage2DEXT)\n#define glCopyMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage3DEXT)\n#define glCopyTextureImage1DEXT GLEW_GET_FUN(__glewCopyTextureImage1DEXT)\n#define glCopyTextureImage2DEXT GLEW_GET_FUN(__glewCopyTextureImage2DEXT)\n#define glCopyTextureSubImage1DEXT GLEW_GET_FUN(__glewCopyTextureSubImage1DEXT)\n#define glCopyTextureSubImage2DEXT GLEW_GET_FUN(__glewCopyTextureSubImage2DEXT)\n#define glCopyTextureSubImage3DEXT GLEW_GET_FUN(__glewCopyTextureSubImage3DEXT)\n#define glDisableClientStateIndexedEXT GLEW_GET_FUN(__glewDisableClientStateIndexedEXT)\n#define glDisableClientStateiEXT GLEW_GET_FUN(__glewDisableClientStateiEXT)\n#define glDisableVertexArrayAttribEXT GLEW_GET_FUN(__glewDisableVertexArrayAttribEXT)\n#define glDisableVertexArrayEXT GLEW_GET_FUN(__glewDisableVertexArrayEXT)\n#define glEnableClientStateIndexedEXT GLEW_GET_FUN(__glewEnableClientStateIndexedEXT)\n#define glEnableClientStateiEXT GLEW_GET_FUN(__glewEnableClientStateiEXT)\n#define glEnableVertexArrayAttribEXT GLEW_GET_FUN(__glewEnableVertexArrayAttribEXT)\n#define glEnableVertexArrayEXT GLEW_GET_FUN(__glewEnableVertexArrayEXT)\n#define glFlushMappedNamedBufferRangeEXT GLEW_GET_FUN(__glewFlushMappedNamedBufferRangeEXT)\n#define glFramebufferDrawBufferEXT GLEW_GET_FUN(__glewFramebufferDrawBufferEXT)\n#define glFramebufferDrawBuffersEXT GLEW_GET_FUN(__glewFramebufferDrawBuffersEXT)\n#define glFramebufferReadBufferEXT GLEW_GET_FUN(__glewFramebufferReadBufferEXT)\n#define glGenerateMultiTexMipmapEXT GLEW_GET_FUN(__glewGenerateMultiTexMipmapEXT)\n#define glGenerateTextureMipmapEXT GLEW_GET_FUN(__glewGenerateTextureMipmapEXT)\n#define glGetCompressedMultiTexImageEXT GLEW_GET_FUN(__glewGetCompressedMultiTexImageEXT)\n#define glGetCompressedTextureImageEXT GLEW_GET_FUN(__glewGetCompressedTextureImageEXT)\n#define glGetDoubleIndexedvEXT GLEW_GET_FUN(__glewGetDoubleIndexedvEXT)\n#define glGetDoublei_vEXT GLEW_GET_FUN(__glewGetDoublei_vEXT)\n#define glGetFloatIndexedvEXT GLEW_GET_FUN(__glewGetFloatIndexedvEXT)\n#define glGetFloati_vEXT GLEW_GET_FUN(__glewGetFloati_vEXT)\n#define glGetFramebufferParameterivEXT GLEW_GET_FUN(__glewGetFramebufferParameterivEXT)\n#define glGetMultiTexEnvfvEXT GLEW_GET_FUN(__glewGetMultiTexEnvfvEXT)\n#define glGetMultiTexEnvivEXT GLEW_GET_FUN(__glewGetMultiTexEnvivEXT)\n#define glGetMultiTexGendvEXT GLEW_GET_FUN(__glewGetMultiTexGendvEXT)\n#define glGetMultiTexGenfvEXT GLEW_GET_FUN(__glewGetMultiTexGenfvEXT)\n#define glGetMultiTexGenivEXT GLEW_GET_FUN(__glewGetMultiTexGenivEXT)\n#define glGetMultiTexImageEXT GLEW_GET_FUN(__glewGetMultiTexImageEXT)\n#define glGetMultiTexLevelParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterfvEXT)\n#define glGetMultiTexLevelParameterivEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterivEXT)\n#define glGetMultiTexParameterIivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIivEXT)\n#define glGetMultiTexParameterIuivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIuivEXT)\n#define glGetMultiTexParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexParameterfvEXT)\n#define glGetMultiTexParameterivEXT GLEW_GET_FUN(__glewGetMultiTexParameterivEXT)\n#define glGetNamedBufferParameterivEXT GLEW_GET_FUN(__glewGetNamedBufferParameterivEXT)\n#define glGetNamedBufferPointervEXT GLEW_GET_FUN(__glewGetNamedBufferPointervEXT)\n#define glGetNamedBufferSubDataEXT GLEW_GET_FUN(__glewGetNamedBufferSubDataEXT)\n#define glGetNamedFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameterivEXT)\n#define glGetNamedProgramLocalParameterIivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIivEXT)\n#define glGetNamedProgramLocalParameterIuivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIuivEXT)\n#define glGetNamedProgramLocalParameterdvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterdvEXT)\n#define glGetNamedProgramLocalParameterfvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterfvEXT)\n#define glGetNamedProgramStringEXT GLEW_GET_FUN(__glewGetNamedProgramStringEXT)\n#define glGetNamedProgramivEXT GLEW_GET_FUN(__glewGetNamedProgramivEXT)\n#define glGetNamedRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetNamedRenderbufferParameterivEXT)\n#define glGetPointerIndexedvEXT GLEW_GET_FUN(__glewGetPointerIndexedvEXT)\n#define glGetPointeri_vEXT GLEW_GET_FUN(__glewGetPointeri_vEXT)\n#define glGetTextureImageEXT GLEW_GET_FUN(__glewGetTextureImageEXT)\n#define glGetTextureLevelParameterfvEXT GLEW_GET_FUN(__glewGetTextureLevelParameterfvEXT)\n#define glGetTextureLevelParameterivEXT GLEW_GET_FUN(__glewGetTextureLevelParameterivEXT)\n#define glGetTextureParameterIivEXT GLEW_GET_FUN(__glewGetTextureParameterIivEXT)\n#define glGetTextureParameterIuivEXT GLEW_GET_FUN(__glewGetTextureParameterIuivEXT)\n#define glGetTextureParameterfvEXT GLEW_GET_FUN(__glewGetTextureParameterfvEXT)\n#define glGetTextureParameterivEXT GLEW_GET_FUN(__glewGetTextureParameterivEXT)\n#define glGetVertexArrayIntegeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayIntegeri_vEXT)\n#define glGetVertexArrayIntegervEXT GLEW_GET_FUN(__glewGetVertexArrayIntegervEXT)\n#define glGetVertexArrayPointeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayPointeri_vEXT)\n#define glGetVertexArrayPointervEXT GLEW_GET_FUN(__glewGetVertexArrayPointervEXT)\n#define glMapNamedBufferEXT GLEW_GET_FUN(__glewMapNamedBufferEXT)\n#define glMapNamedBufferRangeEXT GLEW_GET_FUN(__glewMapNamedBufferRangeEXT)\n#define glMatrixFrustumEXT GLEW_GET_FUN(__glewMatrixFrustumEXT)\n#define glMatrixLoadIdentityEXT GLEW_GET_FUN(__glewMatrixLoadIdentityEXT)\n#define glMatrixLoadTransposedEXT GLEW_GET_FUN(__glewMatrixLoadTransposedEXT)\n#define glMatrixLoadTransposefEXT GLEW_GET_FUN(__glewMatrixLoadTransposefEXT)\n#define glMatrixLoaddEXT GLEW_GET_FUN(__glewMatrixLoaddEXT)\n#define glMatrixLoadfEXT GLEW_GET_FUN(__glewMatrixLoadfEXT)\n#define glMatrixMultTransposedEXT GLEW_GET_FUN(__glewMatrixMultTransposedEXT)\n#define glMatrixMultTransposefEXT GLEW_GET_FUN(__glewMatrixMultTransposefEXT)\n#define glMatrixMultdEXT GLEW_GET_FUN(__glewMatrixMultdEXT)\n#define glMatrixMultfEXT GLEW_GET_FUN(__glewMatrixMultfEXT)\n#define glMatrixOrthoEXT GLEW_GET_FUN(__glewMatrixOrthoEXT)\n#define glMatrixPopEXT GLEW_GET_FUN(__glewMatrixPopEXT)\n#define glMatrixPushEXT GLEW_GET_FUN(__glewMatrixPushEXT)\n#define glMatrixRotatedEXT GLEW_GET_FUN(__glewMatrixRotatedEXT)\n#define glMatrixRotatefEXT GLEW_GET_FUN(__glewMatrixRotatefEXT)\n#define glMatrixScaledEXT GLEW_GET_FUN(__glewMatrixScaledEXT)\n#define glMatrixScalefEXT GLEW_GET_FUN(__glewMatrixScalefEXT)\n#define glMatrixTranslatedEXT GLEW_GET_FUN(__glewMatrixTranslatedEXT)\n#define glMatrixTranslatefEXT GLEW_GET_FUN(__glewMatrixTranslatefEXT)\n#define glMultiTexBufferEXT GLEW_GET_FUN(__glewMultiTexBufferEXT)\n#define glMultiTexCoordPointerEXT GLEW_GET_FUN(__glewMultiTexCoordPointerEXT)\n#define glMultiTexEnvfEXT GLEW_GET_FUN(__glewMultiTexEnvfEXT)\n#define glMultiTexEnvfvEXT GLEW_GET_FUN(__glewMultiTexEnvfvEXT)\n#define glMultiTexEnviEXT GLEW_GET_FUN(__glewMultiTexEnviEXT)\n#define glMultiTexEnvivEXT GLEW_GET_FUN(__glewMultiTexEnvivEXT)\n#define glMultiTexGendEXT GLEW_GET_FUN(__glewMultiTexGendEXT)\n#define glMultiTexGendvEXT GLEW_GET_FUN(__glewMultiTexGendvEXT)\n#define glMultiTexGenfEXT GLEW_GET_FUN(__glewMultiTexGenfEXT)\n#define glMultiTexGenfvEXT GLEW_GET_FUN(__glewMultiTexGenfvEXT)\n#define glMultiTexGeniEXT GLEW_GET_FUN(__glewMultiTexGeniEXT)\n#define glMultiTexGenivEXT GLEW_GET_FUN(__glewMultiTexGenivEXT)\n#define glMultiTexImage1DEXT GLEW_GET_FUN(__glewMultiTexImage1DEXT)\n#define glMultiTexImage2DEXT GLEW_GET_FUN(__glewMultiTexImage2DEXT)\n#define glMultiTexImage3DEXT GLEW_GET_FUN(__glewMultiTexImage3DEXT)\n#define glMultiTexParameterIivEXT GLEW_GET_FUN(__glewMultiTexParameterIivEXT)\n#define glMultiTexParameterIuivEXT GLEW_GET_FUN(__glewMultiTexParameterIuivEXT)\n#define glMultiTexParameterfEXT GLEW_GET_FUN(__glewMultiTexParameterfEXT)\n#define glMultiTexParameterfvEXT GLEW_GET_FUN(__glewMultiTexParameterfvEXT)\n#define glMultiTexParameteriEXT GLEW_GET_FUN(__glewMultiTexParameteriEXT)\n#define glMultiTexParameterivEXT GLEW_GET_FUN(__glewMultiTexParameterivEXT)\n#define glMultiTexRenderbufferEXT GLEW_GET_FUN(__glewMultiTexRenderbufferEXT)\n#define glMultiTexSubImage1DEXT GLEW_GET_FUN(__glewMultiTexSubImage1DEXT)\n#define glMultiTexSubImage2DEXT GLEW_GET_FUN(__glewMultiTexSubImage2DEXT)\n#define glMultiTexSubImage3DEXT GLEW_GET_FUN(__glewMultiTexSubImage3DEXT)\n#define glNamedBufferDataEXT GLEW_GET_FUN(__glewNamedBufferDataEXT)\n#define glNamedBufferSubDataEXT GLEW_GET_FUN(__glewNamedBufferSubDataEXT)\n#define glNamedCopyBufferSubDataEXT GLEW_GET_FUN(__glewNamedCopyBufferSubDataEXT)\n#define glNamedFramebufferRenderbufferEXT GLEW_GET_FUN(__glewNamedFramebufferRenderbufferEXT)\n#define glNamedFramebufferTexture1DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture1DEXT)\n#define glNamedFramebufferTexture2DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture2DEXT)\n#define glNamedFramebufferTexture3DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture3DEXT)\n#define glNamedFramebufferTextureEXT GLEW_GET_FUN(__glewNamedFramebufferTextureEXT)\n#define glNamedFramebufferTextureFaceEXT GLEW_GET_FUN(__glewNamedFramebufferTextureFaceEXT)\n#define glNamedFramebufferTextureLayerEXT GLEW_GET_FUN(__glewNamedFramebufferTextureLayerEXT)\n#define glNamedProgramLocalParameter4dEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dEXT)\n#define glNamedProgramLocalParameter4dvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dvEXT)\n#define glNamedProgramLocalParameter4fEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fEXT)\n#define glNamedProgramLocalParameter4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fvEXT)\n#define glNamedProgramLocalParameterI4iEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4iEXT)\n#define glNamedProgramLocalParameterI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4ivEXT)\n#define glNamedProgramLocalParameterI4uiEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uiEXT)\n#define glNamedProgramLocalParameterI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uivEXT)\n#define glNamedProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameters4fvEXT)\n#define glNamedProgramLocalParametersI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4ivEXT)\n#define glNamedProgramLocalParametersI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4uivEXT)\n#define glNamedProgramStringEXT GLEW_GET_FUN(__glewNamedProgramStringEXT)\n#define glNamedRenderbufferStorageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageEXT)\n#define glNamedRenderbufferStorageMultisampleCoverageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleCoverageEXT)\n#define glNamedRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleEXT)\n#define glProgramUniform1dEXT GLEW_GET_FUN(__glewProgramUniform1dEXT)\n#define glProgramUniform1dvEXT GLEW_GET_FUN(__glewProgramUniform1dvEXT)\n#define glProgramUniform1fEXT GLEW_GET_FUN(__glewProgramUniform1fEXT)\n#define glProgramUniform1fvEXT GLEW_GET_FUN(__glewProgramUniform1fvEXT)\n#define glProgramUniform1iEXT GLEW_GET_FUN(__glewProgramUniform1iEXT)\n#define glProgramUniform1ivEXT GLEW_GET_FUN(__glewProgramUniform1ivEXT)\n#define glProgramUniform1uiEXT GLEW_GET_FUN(__glewProgramUniform1uiEXT)\n#define glProgramUniform1uivEXT GLEW_GET_FUN(__glewProgramUniform1uivEXT)\n#define glProgramUniform2dEXT GLEW_GET_FUN(__glewProgramUniform2dEXT)\n#define glProgramUniform2dvEXT GLEW_GET_FUN(__glewProgramUniform2dvEXT)\n#define glProgramUniform2fEXT GLEW_GET_FUN(__glewProgramUniform2fEXT)\n#define glProgramUniform2fvEXT GLEW_GET_FUN(__glewProgramUniform2fvEXT)\n#define glProgramUniform2iEXT GLEW_GET_FUN(__glewProgramUniform2iEXT)\n#define glProgramUniform2ivEXT GLEW_GET_FUN(__glewProgramUniform2ivEXT)\n#define glProgramUniform2uiEXT GLEW_GET_FUN(__glewProgramUniform2uiEXT)\n#define glProgramUniform2uivEXT GLEW_GET_FUN(__glewProgramUniform2uivEXT)\n#define glProgramUniform3dEXT GLEW_GET_FUN(__glewProgramUniform3dEXT)\n#define glProgramUniform3dvEXT GLEW_GET_FUN(__glewProgramUniform3dvEXT)\n#define glProgramUniform3fEXT GLEW_GET_FUN(__glewProgramUniform3fEXT)\n#define glProgramUniform3fvEXT GLEW_GET_FUN(__glewProgramUniform3fvEXT)\n#define glProgramUniform3iEXT GLEW_GET_FUN(__glewProgramUniform3iEXT)\n#define glProgramUniform3ivEXT GLEW_GET_FUN(__glewProgramUniform3ivEXT)\n#define glProgramUniform3uiEXT GLEW_GET_FUN(__glewProgramUniform3uiEXT)\n#define glProgramUniform3uivEXT GLEW_GET_FUN(__glewProgramUniform3uivEXT)\n#define glProgramUniform4dEXT GLEW_GET_FUN(__glewProgramUniform4dEXT)\n#define glProgramUniform4dvEXT GLEW_GET_FUN(__glewProgramUniform4dvEXT)\n#define glProgramUniform4fEXT GLEW_GET_FUN(__glewProgramUniform4fEXT)\n#define glProgramUniform4fvEXT GLEW_GET_FUN(__glewProgramUniform4fvEXT)\n#define glProgramUniform4iEXT GLEW_GET_FUN(__glewProgramUniform4iEXT)\n#define glProgramUniform4ivEXT GLEW_GET_FUN(__glewProgramUniform4ivEXT)\n#define glProgramUniform4uiEXT GLEW_GET_FUN(__glewProgramUniform4uiEXT)\n#define glProgramUniform4uivEXT GLEW_GET_FUN(__glewProgramUniform4uivEXT)\n#define glProgramUniformMatrix2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2dvEXT)\n#define glProgramUniformMatrix2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2fvEXT)\n#define glProgramUniformMatrix2x3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3dvEXT)\n#define glProgramUniformMatrix2x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3fvEXT)\n#define glProgramUniformMatrix2x4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4dvEXT)\n#define glProgramUniformMatrix2x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4fvEXT)\n#define glProgramUniformMatrix3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3dvEXT)\n#define glProgramUniformMatrix3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3fvEXT)\n#define glProgramUniformMatrix3x2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2dvEXT)\n#define glProgramUniformMatrix3x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2fvEXT)\n#define glProgramUniformMatrix3x4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4dvEXT)\n#define glProgramUniformMatrix3x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4fvEXT)\n#define glProgramUniformMatrix4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4dvEXT)\n#define glProgramUniformMatrix4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4fvEXT)\n#define glProgramUniformMatrix4x2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2dvEXT)\n#define glProgramUniformMatrix4x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2fvEXT)\n#define glProgramUniformMatrix4x3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3dvEXT)\n#define glProgramUniformMatrix4x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3fvEXT)\n#define glPushClientAttribDefaultEXT GLEW_GET_FUN(__glewPushClientAttribDefaultEXT)\n#define glTextureBufferEXT GLEW_GET_FUN(__glewTextureBufferEXT)\n#define glTextureImage1DEXT GLEW_GET_FUN(__glewTextureImage1DEXT)\n#define glTextureImage2DEXT GLEW_GET_FUN(__glewTextureImage2DEXT)\n#define glTextureImage3DEXT GLEW_GET_FUN(__glewTextureImage3DEXT)\n#define glTextureParameterIivEXT GLEW_GET_FUN(__glewTextureParameterIivEXT)\n#define glTextureParameterIuivEXT GLEW_GET_FUN(__glewTextureParameterIuivEXT)\n#define glTextureParameterfEXT GLEW_GET_FUN(__glewTextureParameterfEXT)\n#define glTextureParameterfvEXT GLEW_GET_FUN(__glewTextureParameterfvEXT)\n#define glTextureParameteriEXT GLEW_GET_FUN(__glewTextureParameteriEXT)\n#define glTextureParameterivEXT GLEW_GET_FUN(__glewTextureParameterivEXT)\n#define glTextureRenderbufferEXT GLEW_GET_FUN(__glewTextureRenderbufferEXT)\n#define glTextureSubImage1DEXT GLEW_GET_FUN(__glewTextureSubImage1DEXT)\n#define glTextureSubImage2DEXT GLEW_GET_FUN(__glewTextureSubImage2DEXT)\n#define glTextureSubImage3DEXT GLEW_GET_FUN(__glewTextureSubImage3DEXT)\n#define glUnmapNamedBufferEXT GLEW_GET_FUN(__glewUnmapNamedBufferEXT)\n#define glVertexArrayColorOffsetEXT GLEW_GET_FUN(__glewVertexArrayColorOffsetEXT)\n#define glVertexArrayEdgeFlagOffsetEXT GLEW_GET_FUN(__glewVertexArrayEdgeFlagOffsetEXT)\n#define glVertexArrayFogCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayFogCoordOffsetEXT)\n#define glVertexArrayIndexOffsetEXT GLEW_GET_FUN(__glewVertexArrayIndexOffsetEXT)\n#define glVertexArrayMultiTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayMultiTexCoordOffsetEXT)\n#define glVertexArrayNormalOffsetEXT GLEW_GET_FUN(__glewVertexArrayNormalOffsetEXT)\n#define glVertexArraySecondaryColorOffsetEXT GLEW_GET_FUN(__glewVertexArraySecondaryColorOffsetEXT)\n#define glVertexArrayTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayTexCoordOffsetEXT)\n#define glVertexArrayVertexAttribIOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIOffsetEXT)\n#define glVertexArrayVertexAttribOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribOffsetEXT)\n#define glVertexArrayVertexOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexOffsetEXT)\n\n#define GLEW_EXT_direct_state_access GLEW_GET_VAR(__GLEW_EXT_direct_state_access)\n\n#endif /* GL_EXT_direct_state_access */\n\n/* -------------------------- GL_EXT_draw_buffers2 ------------------------- */\n\n#ifndef GL_EXT_draw_buffers2\n#define GL_EXT_draw_buffers2 1\n\ntypedef void (GLAPIENTRY * PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\ntypedef void (GLAPIENTRY * PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);\ntypedef void (GLAPIENTRY * PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum value, GLuint index, GLboolean* data);\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum value, GLuint index, GLint* data);\ntypedef GLboolean (GLAPIENTRY * PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);\n\n#define glColorMaskIndexedEXT GLEW_GET_FUN(__glewColorMaskIndexedEXT)\n#define glDisableIndexedEXT GLEW_GET_FUN(__glewDisableIndexedEXT)\n#define glEnableIndexedEXT GLEW_GET_FUN(__glewEnableIndexedEXT)\n#define glGetBooleanIndexedvEXT GLEW_GET_FUN(__glewGetBooleanIndexedvEXT)\n#define glGetIntegerIndexedvEXT GLEW_GET_FUN(__glewGetIntegerIndexedvEXT)\n#define glIsEnabledIndexedEXT GLEW_GET_FUN(__glewIsEnabledIndexedEXT)\n\n#define GLEW_EXT_draw_buffers2 GLEW_GET_VAR(__GLEW_EXT_draw_buffers2)\n\n#endif /* GL_EXT_draw_buffers2 */\n\n/* ------------------------- GL_EXT_draw_instanced ------------------------- */\n\n#ifndef GL_EXT_draw_instanced\n#define GL_EXT_draw_instanced 1\n\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);\n\n#define glDrawArraysInstancedEXT GLEW_GET_FUN(__glewDrawArraysInstancedEXT)\n#define glDrawElementsInstancedEXT GLEW_GET_FUN(__glewDrawElementsInstancedEXT)\n\n#define GLEW_EXT_draw_instanced GLEW_GET_VAR(__GLEW_EXT_draw_instanced)\n\n#endif /* GL_EXT_draw_instanced */\n\n/* ----------------------- GL_EXT_draw_range_elements ---------------------- */\n\n#ifndef GL_EXT_draw_range_elements\n#define GL_EXT_draw_range_elements 1\n\n#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8\n#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9\n\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\n\n#define glDrawRangeElementsEXT GLEW_GET_FUN(__glewDrawRangeElementsEXT)\n\n#define GLEW_EXT_draw_range_elements GLEW_GET_VAR(__GLEW_EXT_draw_range_elements)\n\n#endif /* GL_EXT_draw_range_elements */\n\n/* ---------------------------- GL_EXT_fog_coord --------------------------- */\n\n#ifndef GL_EXT_fog_coord\n#define GL_EXT_fog_coord 1\n\n#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450\n#define GL_FOG_COORDINATE_EXT 0x8451\n#define GL_FRAGMENT_DEPTH_EXT 0x8452\n#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453\n#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454\n#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455\n#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456\n#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457\n\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);\n\n#define glFogCoordPointerEXT GLEW_GET_FUN(__glewFogCoordPointerEXT)\n#define glFogCoorddEXT GLEW_GET_FUN(__glewFogCoorddEXT)\n#define glFogCoorddvEXT GLEW_GET_FUN(__glewFogCoorddvEXT)\n#define glFogCoordfEXT GLEW_GET_FUN(__glewFogCoordfEXT)\n#define glFogCoordfvEXT GLEW_GET_FUN(__glewFogCoordfvEXT)\n\n#define GLEW_EXT_fog_coord GLEW_GET_VAR(__GLEW_EXT_fog_coord)\n\n#endif /* GL_EXT_fog_coord */\n\n/* ------------------------ GL_EXT_fragment_lighting ----------------------- */\n\n#ifndef GL_EXT_fragment_lighting\n#define GL_EXT_fragment_lighting 1\n\n#define GL_FRAGMENT_LIGHTING_EXT 0x8400\n#define GL_FRAGMENT_COLOR_MATERIAL_EXT 0x8401\n#define GL_FRAGMENT_COLOR_MATERIAL_FACE_EXT 0x8402\n#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_EXT 0x8403\n#define GL_MAX_FRAGMENT_LIGHTS_EXT 0x8404\n#define GL_MAX_ACTIVE_LIGHTS_EXT 0x8405\n#define GL_CURRENT_RASTER_NORMAL_EXT 0x8406\n#define GL_LIGHT_ENV_MODE_EXT 0x8407\n#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_EXT 0x8408\n#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_EXT 0x8409\n#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_EXT 0x840A\n#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_EXT 0x840B\n#define GL_FRAGMENT_LIGHT0_EXT 0x840C\n#define GL_FRAGMENT_LIGHT7_EXT 0x8413\n\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALEXTPROC) (GLenum face, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFEXTPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVEXTPROC) (GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIEXTPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVEXTPROC) (GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFEXTPROC) (GLenum light, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIEXTPROC) (GLenum light, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFEXTPROC) (GLenum face, GLenum pname, const GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIEXTPROC) (GLenum face, GLenum pname, const GLint param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLLIGHTENVIEXTPROC) (GLenum pname, GLint param);\n\n#define glFragmentColorMaterialEXT GLEW_GET_FUN(__glewFragmentColorMaterialEXT)\n#define glFragmentLightModelfEXT GLEW_GET_FUN(__glewFragmentLightModelfEXT)\n#define glFragmentLightModelfvEXT GLEW_GET_FUN(__glewFragmentLightModelfvEXT)\n#define glFragmentLightModeliEXT GLEW_GET_FUN(__glewFragmentLightModeliEXT)\n#define glFragmentLightModelivEXT GLEW_GET_FUN(__glewFragmentLightModelivEXT)\n#define glFragmentLightfEXT GLEW_GET_FUN(__glewFragmentLightfEXT)\n#define glFragmentLightfvEXT GLEW_GET_FUN(__glewFragmentLightfvEXT)\n#define glFragmentLightiEXT GLEW_GET_FUN(__glewFragmentLightiEXT)\n#define glFragmentLightivEXT GLEW_GET_FUN(__glewFragmentLightivEXT)\n#define glFragmentMaterialfEXT GLEW_GET_FUN(__glewFragmentMaterialfEXT)\n#define glFragmentMaterialfvEXT GLEW_GET_FUN(__glewFragmentMaterialfvEXT)\n#define glFragmentMaterialiEXT GLEW_GET_FUN(__glewFragmentMaterialiEXT)\n#define glFragmentMaterialivEXT GLEW_GET_FUN(__glewFragmentMaterialivEXT)\n#define glGetFragmentLightfvEXT GLEW_GET_FUN(__glewGetFragmentLightfvEXT)\n#define glGetFragmentLightivEXT GLEW_GET_FUN(__glewGetFragmentLightivEXT)\n#define glGetFragmentMaterialfvEXT GLEW_GET_FUN(__glewGetFragmentMaterialfvEXT)\n#define glGetFragmentMaterialivEXT GLEW_GET_FUN(__glewGetFragmentMaterialivEXT)\n#define glLightEnviEXT GLEW_GET_FUN(__glewLightEnviEXT)\n\n#define GLEW_EXT_fragment_lighting GLEW_GET_VAR(__GLEW_EXT_fragment_lighting)\n\n#endif /* GL_EXT_fragment_lighting */\n\n/* ------------------------ GL_EXT_framebuffer_blit ------------------------ */\n\n#ifndef GL_EXT_framebuffer_blit\n#define GL_EXT_framebuffer_blit 1\n\n#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6\n#define GL_READ_FRAMEBUFFER_EXT 0x8CA8\n#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9\n#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA\n\ntypedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n\n#define glBlitFramebufferEXT GLEW_GET_FUN(__glewBlitFramebufferEXT)\n\n#define GLEW_EXT_framebuffer_blit GLEW_GET_VAR(__GLEW_EXT_framebuffer_blit)\n\n#endif /* GL_EXT_framebuffer_blit */\n\n/* --------------------- GL_EXT_framebuffer_multisample -------------------- */\n\n#ifndef GL_EXT_framebuffer_multisample\n#define GL_EXT_framebuffer_multisample 1\n\n#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56\n#define GL_MAX_SAMPLES_EXT 0x8D57\n\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\n\n#define glRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewRenderbufferStorageMultisampleEXT)\n\n#define GLEW_EXT_framebuffer_multisample GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample)\n\n#endif /* GL_EXT_framebuffer_multisample */\n\n/* --------------- GL_EXT_framebuffer_multisample_blit_scaled -------------- */\n\n#ifndef GL_EXT_framebuffer_multisample_blit_scaled\n#define GL_EXT_framebuffer_multisample_blit_scaled 1\n\n#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA\n#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB\n\n#define GLEW_EXT_framebuffer_multisample_blit_scaled GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample_blit_scaled)\n\n#endif /* GL_EXT_framebuffer_multisample_blit_scaled */\n\n/* ----------------------- GL_EXT_framebuffer_object ----------------------- */\n\n#ifndef GL_EXT_framebuffer_object\n#define GL_EXT_framebuffer_object 1\n\n#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506\n#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8\n#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6\n#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4\n#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7\n#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9\n#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC\n#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD\n#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF\n#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0\n#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1\n#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2\n#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3\n#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4\n#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5\n#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6\n#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7\n#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8\n#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9\n#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA\n#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB\n#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC\n#define GL_COLOR_ATTACHMENT13_EXT 0x8CED\n#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE\n#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF\n#define GL_DEPTH_ATTACHMENT_EXT 0x8D00\n#define GL_STENCIL_ATTACHMENT_EXT 0x8D20\n#define GL_FRAMEBUFFER_EXT 0x8D40\n#define GL_RENDERBUFFER_EXT 0x8D41\n#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42\n#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43\n#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44\n#define GL_STENCIL_INDEX1_EXT 0x8D46\n#define GL_STENCIL_INDEX4_EXT 0x8D47\n#define GL_STENCIL_INDEX8_EXT 0x8D48\n#define GL_STENCIL_INDEX16_EXT 0x8D49\n#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50\n#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51\n#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52\n#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53\n#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54\n#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55\n\ntypedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);\ntypedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);\ntypedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint* framebuffers);\ntypedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint* renderbuffers);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\ntypedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint* framebuffers);\ntypedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint* renderbuffers);\ntypedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);\ntypedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\n\n#define glBindFramebufferEXT GLEW_GET_FUN(__glewBindFramebufferEXT)\n#define glBindRenderbufferEXT GLEW_GET_FUN(__glewBindRenderbufferEXT)\n#define glCheckFramebufferStatusEXT GLEW_GET_FUN(__glewCheckFramebufferStatusEXT)\n#define glDeleteFramebuffersEXT GLEW_GET_FUN(__glewDeleteFramebuffersEXT)\n#define glDeleteRenderbuffersEXT GLEW_GET_FUN(__glewDeleteRenderbuffersEXT)\n#define glFramebufferRenderbufferEXT GLEW_GET_FUN(__glewFramebufferRenderbufferEXT)\n#define glFramebufferTexture1DEXT GLEW_GET_FUN(__glewFramebufferTexture1DEXT)\n#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT)\n#define glFramebufferTexture3DEXT GLEW_GET_FUN(__glewFramebufferTexture3DEXT)\n#define glGenFramebuffersEXT GLEW_GET_FUN(__glewGenFramebuffersEXT)\n#define glGenRenderbuffersEXT GLEW_GET_FUN(__glewGenRenderbuffersEXT)\n#define glGenerateMipmapEXT GLEW_GET_FUN(__glewGenerateMipmapEXT)\n#define glGetFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivEXT)\n#define glGetRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetRenderbufferParameterivEXT)\n#define glIsFramebufferEXT GLEW_GET_FUN(__glewIsFramebufferEXT)\n#define glIsRenderbufferEXT GLEW_GET_FUN(__glewIsRenderbufferEXT)\n#define glRenderbufferStorageEXT GLEW_GET_FUN(__glewRenderbufferStorageEXT)\n\n#define GLEW_EXT_framebuffer_object GLEW_GET_VAR(__GLEW_EXT_framebuffer_object)\n\n#endif /* GL_EXT_framebuffer_object */\n\n/* ------------------------ GL_EXT_framebuffer_sRGB ------------------------ */\n\n#ifndef GL_EXT_framebuffer_sRGB\n#define GL_EXT_framebuffer_sRGB 1\n\n#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9\n#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA\n\n#define GLEW_EXT_framebuffer_sRGB GLEW_GET_VAR(__GLEW_EXT_framebuffer_sRGB)\n\n#endif /* GL_EXT_framebuffer_sRGB */\n\n/* ------------------------ GL_EXT_geometry_shader4 ------------------------ */\n\n#ifndef GL_EXT_geometry_shader4\n#define GL_EXT_geometry_shader4 1\n\n#define GL_LINES_ADJACENCY_EXT 0xA\n#define GL_LINE_STRIP_ADJACENCY_EXT 0xB\n#define GL_TRIANGLES_ADJACENCY_EXT 0xC\n#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD\n#define GL_PROGRAM_POINT_SIZE_EXT 0x8642\n#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9\n#define GL_GEOMETRY_SHADER_EXT 0x8DD9\n#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA\n#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB\n#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC\n#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD\n#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1\n\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);\n\n#define glFramebufferTextureEXT GLEW_GET_FUN(__glewFramebufferTextureEXT)\n#define glFramebufferTextureFaceEXT GLEW_GET_FUN(__glewFramebufferTextureFaceEXT)\n#define glProgramParameteriEXT GLEW_GET_FUN(__glewProgramParameteriEXT)\n\n#define GLEW_EXT_geometry_shader4 GLEW_GET_VAR(__GLEW_EXT_geometry_shader4)\n\n#endif /* GL_EXT_geometry_shader4 */\n\n/* --------------------- GL_EXT_gpu_program_parameters --------------------- */\n\n#ifndef GL_EXT_gpu_program_parameters\n#define GL_EXT_gpu_program_parameters 1\n\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params);\n\n#define glProgramEnvParameters4fvEXT GLEW_GET_FUN(__glewProgramEnvParameters4fvEXT)\n#define glProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewProgramLocalParameters4fvEXT)\n\n#define GLEW_EXT_gpu_program_parameters GLEW_GET_VAR(__GLEW_EXT_gpu_program_parameters)\n\n#endif /* GL_EXT_gpu_program_parameters */\n\n/* --------------------------- GL_EXT_gpu_shader4 -------------------------- */\n\n#ifndef GL_EXT_gpu_shader4\n#define GL_EXT_gpu_shader4 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD\n#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0\n#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1\n#define GL_SAMPLER_BUFFER_EXT 0x8DC2\n#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3\n#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4\n#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5\n#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6\n#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7\n#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8\n#define GL_INT_SAMPLER_1D_EXT 0x8DC9\n#define GL_INT_SAMPLER_2D_EXT 0x8DCA\n#define GL_INT_SAMPLER_3D_EXT 0x8DCB\n#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC\n#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD\n#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE\n#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF\n#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0\n#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1\n#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2\n#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8\n\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);\ntypedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\n\n#define glBindFragDataLocationEXT GLEW_GET_FUN(__glewBindFragDataLocationEXT)\n#define glGetFragDataLocationEXT GLEW_GET_FUN(__glewGetFragDataLocationEXT)\n#define glGetUniformuivEXT GLEW_GET_FUN(__glewGetUniformuivEXT)\n#define glGetVertexAttribIivEXT GLEW_GET_FUN(__glewGetVertexAttribIivEXT)\n#define glGetVertexAttribIuivEXT GLEW_GET_FUN(__glewGetVertexAttribIuivEXT)\n#define glUniform1uiEXT GLEW_GET_FUN(__glewUniform1uiEXT)\n#define glUniform1uivEXT GLEW_GET_FUN(__glewUniform1uivEXT)\n#define glUniform2uiEXT GLEW_GET_FUN(__glewUniform2uiEXT)\n#define glUniform2uivEXT GLEW_GET_FUN(__glewUniform2uivEXT)\n#define glUniform3uiEXT GLEW_GET_FUN(__glewUniform3uiEXT)\n#define glUniform3uivEXT GLEW_GET_FUN(__glewUniform3uivEXT)\n#define glUniform4uiEXT GLEW_GET_FUN(__glewUniform4uiEXT)\n#define glUniform4uivEXT GLEW_GET_FUN(__glewUniform4uivEXT)\n#define glVertexAttribI1iEXT GLEW_GET_FUN(__glewVertexAttribI1iEXT)\n#define glVertexAttribI1ivEXT GLEW_GET_FUN(__glewVertexAttribI1ivEXT)\n#define glVertexAttribI1uiEXT GLEW_GET_FUN(__glewVertexAttribI1uiEXT)\n#define glVertexAttribI1uivEXT GLEW_GET_FUN(__glewVertexAttribI1uivEXT)\n#define glVertexAttribI2iEXT GLEW_GET_FUN(__glewVertexAttribI2iEXT)\n#define glVertexAttribI2ivEXT GLEW_GET_FUN(__glewVertexAttribI2ivEXT)\n#define glVertexAttribI2uiEXT GLEW_GET_FUN(__glewVertexAttribI2uiEXT)\n#define glVertexAttribI2uivEXT GLEW_GET_FUN(__glewVertexAttribI2uivEXT)\n#define glVertexAttribI3iEXT GLEW_GET_FUN(__glewVertexAttribI3iEXT)\n#define glVertexAttribI3ivEXT GLEW_GET_FUN(__glewVertexAttribI3ivEXT)\n#define glVertexAttribI3uiEXT GLEW_GET_FUN(__glewVertexAttribI3uiEXT)\n#define glVertexAttribI3uivEXT GLEW_GET_FUN(__glewVertexAttribI3uivEXT)\n#define glVertexAttribI4bvEXT GLEW_GET_FUN(__glewVertexAttribI4bvEXT)\n#define glVertexAttribI4iEXT GLEW_GET_FUN(__glewVertexAttribI4iEXT)\n#define glVertexAttribI4ivEXT GLEW_GET_FUN(__glewVertexAttribI4ivEXT)\n#define glVertexAttribI4svEXT GLEW_GET_FUN(__glewVertexAttribI4svEXT)\n#define glVertexAttribI4ubvEXT GLEW_GET_FUN(__glewVertexAttribI4ubvEXT)\n#define glVertexAttribI4uiEXT GLEW_GET_FUN(__glewVertexAttribI4uiEXT)\n#define glVertexAttribI4uivEXT GLEW_GET_FUN(__glewVertexAttribI4uivEXT)\n#define glVertexAttribI4usvEXT GLEW_GET_FUN(__glewVertexAttribI4usvEXT)\n#define glVertexAttribIPointerEXT GLEW_GET_FUN(__glewVertexAttribIPointerEXT)\n\n#define GLEW_EXT_gpu_shader4 GLEW_GET_VAR(__GLEW_EXT_gpu_shader4)\n\n#endif /* GL_EXT_gpu_shader4 */\n\n/* ---------------------------- GL_EXT_histogram --------------------------- */\n\n#ifndef GL_EXT_histogram\n#define GL_EXT_histogram 1\n\n#define GL_HISTOGRAM_EXT 0x8024\n#define GL_PROXY_HISTOGRAM_EXT 0x8025\n#define GL_HISTOGRAM_WIDTH_EXT 0x8026\n#define GL_HISTOGRAM_FORMAT_EXT 0x8027\n#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028\n#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029\n#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A\n#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B\n#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C\n#define GL_HISTOGRAM_SINK_EXT 0x802D\n#define GL_MINMAX_EXT 0x802E\n#define GL_MINMAX_FORMAT_EXT 0x802F\n#define GL_MINMAX_SINK_EXT 0x8030\n\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values);\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values);\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\ntypedef void (GLAPIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);\ntypedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target);\n\n#define glGetHistogramEXT GLEW_GET_FUN(__glewGetHistogramEXT)\n#define glGetHistogramParameterfvEXT GLEW_GET_FUN(__glewGetHistogramParameterfvEXT)\n#define glGetHistogramParameterivEXT GLEW_GET_FUN(__glewGetHistogramParameterivEXT)\n#define glGetMinmaxEXT GLEW_GET_FUN(__glewGetMinmaxEXT)\n#define glGetMinmaxParameterfvEXT GLEW_GET_FUN(__glewGetMinmaxParameterfvEXT)\n#define glGetMinmaxParameterivEXT GLEW_GET_FUN(__glewGetMinmaxParameterivEXT)\n#define glHistogramEXT GLEW_GET_FUN(__glewHistogramEXT)\n#define glMinmaxEXT GLEW_GET_FUN(__glewMinmaxEXT)\n#define glResetHistogramEXT GLEW_GET_FUN(__glewResetHistogramEXT)\n#define glResetMinmaxEXT GLEW_GET_FUN(__glewResetMinmaxEXT)\n\n#define GLEW_EXT_histogram GLEW_GET_VAR(__GLEW_EXT_histogram)\n\n#endif /* GL_EXT_histogram */\n\n/* ----------------------- GL_EXT_index_array_formats ---------------------- */\n\n#ifndef GL_EXT_index_array_formats\n#define GL_EXT_index_array_formats 1\n\n#define GLEW_EXT_index_array_formats GLEW_GET_VAR(__GLEW_EXT_index_array_formats)\n\n#endif /* GL_EXT_index_array_formats */\n\n/* --------------------------- GL_EXT_index_func --------------------------- */\n\n#ifndef GL_EXT_index_func\n#define GL_EXT_index_func 1\n\ntypedef void (GLAPIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref);\n\n#define glIndexFuncEXT GLEW_GET_FUN(__glewIndexFuncEXT)\n\n#define GLEW_EXT_index_func GLEW_GET_VAR(__GLEW_EXT_index_func)\n\n#endif /* GL_EXT_index_func */\n\n/* ------------------------- GL_EXT_index_material ------------------------- */\n\n#ifndef GL_EXT_index_material\n#define GL_EXT_index_material 1\n\ntypedef void (GLAPIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);\n\n#define glIndexMaterialEXT GLEW_GET_FUN(__glewIndexMaterialEXT)\n\n#define GLEW_EXT_index_material GLEW_GET_VAR(__GLEW_EXT_index_material)\n\n#endif /* GL_EXT_index_material */\n\n/* -------------------------- GL_EXT_index_texture ------------------------- */\n\n#ifndef GL_EXT_index_texture\n#define GL_EXT_index_texture 1\n\n#define GLEW_EXT_index_texture GLEW_GET_VAR(__GLEW_EXT_index_texture)\n\n#endif /* GL_EXT_index_texture */\n\n/* -------------------------- GL_EXT_light_texture ------------------------- */\n\n#ifndef GL_EXT_light_texture\n#define GL_EXT_light_texture 1\n\n#define GL_FRAGMENT_MATERIAL_EXT 0x8349\n#define GL_FRAGMENT_NORMAL_EXT 0x834A\n#define GL_FRAGMENT_COLOR_EXT 0x834C\n#define GL_ATTENUATION_EXT 0x834D\n#define GL_SHADOW_ATTENUATION_EXT 0x834E\n#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F\n#define GL_TEXTURE_LIGHT_EXT 0x8350\n#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351\n#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352\n\ntypedef void (GLAPIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);\n\n#define glApplyTextureEXT GLEW_GET_FUN(__glewApplyTextureEXT)\n#define glTextureLightEXT GLEW_GET_FUN(__glewTextureLightEXT)\n#define glTextureMaterialEXT GLEW_GET_FUN(__glewTextureMaterialEXT)\n\n#define GLEW_EXT_light_texture GLEW_GET_VAR(__GLEW_EXT_light_texture)\n\n#endif /* GL_EXT_light_texture */\n\n/* ------------------------- GL_EXT_misc_attribute ------------------------- */\n\n#ifndef GL_EXT_misc_attribute\n#define GL_EXT_misc_attribute 1\n\n#define GLEW_EXT_misc_attribute GLEW_GET_VAR(__GLEW_EXT_misc_attribute)\n\n#endif /* GL_EXT_misc_attribute */\n\n/* ------------------------ GL_EXT_multi_draw_arrays ----------------------- */\n\n#ifndef GL_EXT_multi_draw_arrays\n#define GL_EXT_multi_draw_arrays 1\n\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, GLsizei* count, GLenum type, const GLvoid **indices, GLsizei primcount);\n\n#define glMultiDrawArraysEXT GLEW_GET_FUN(__glewMultiDrawArraysEXT)\n#define glMultiDrawElementsEXT GLEW_GET_FUN(__glewMultiDrawElementsEXT)\n\n#define GLEW_EXT_multi_draw_arrays GLEW_GET_VAR(__GLEW_EXT_multi_draw_arrays)\n\n#endif /* GL_EXT_multi_draw_arrays */\n\n/* --------------------------- GL_EXT_multisample -------------------------- */\n\n#ifndef GL_EXT_multisample\n#define GL_EXT_multisample 1\n\n#define GL_MULTISAMPLE_EXT 0x809D\n#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F\n#define GL_SAMPLE_MASK_EXT 0x80A0\n#define GL_1PASS_EXT 0x80A1\n#define GL_2PASS_0_EXT 0x80A2\n#define GL_2PASS_1_EXT 0x80A3\n#define GL_4PASS_0_EXT 0x80A4\n#define GL_4PASS_1_EXT 0x80A5\n#define GL_4PASS_2_EXT 0x80A6\n#define GL_4PASS_3_EXT 0x80A7\n#define GL_SAMPLE_BUFFERS_EXT 0x80A8\n#define GL_SAMPLES_EXT 0x80A9\n#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA\n#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB\n#define GL_SAMPLE_PATTERN_EXT 0x80AC\n#define GL_MULTISAMPLE_BIT_EXT 0x20000000\n\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);\ntypedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);\n\n#define glSampleMaskEXT GLEW_GET_FUN(__glewSampleMaskEXT)\n#define glSamplePatternEXT GLEW_GET_FUN(__glewSamplePatternEXT)\n\n#define GLEW_EXT_multisample GLEW_GET_VAR(__GLEW_EXT_multisample)\n\n#endif /* GL_EXT_multisample */\n\n/* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */\n\n#ifndef GL_EXT_packed_depth_stencil\n#define GL_EXT_packed_depth_stencil 1\n\n#define GL_DEPTH_STENCIL_EXT 0x84F9\n#define GL_UNSIGNED_INT_24_8_EXT 0x84FA\n#define GL_DEPTH24_STENCIL8_EXT 0x88F0\n#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1\n\n#define GLEW_EXT_packed_depth_stencil GLEW_GET_VAR(__GLEW_EXT_packed_depth_stencil)\n\n#endif /* GL_EXT_packed_depth_stencil */\n\n/* -------------------------- GL_EXT_packed_float -------------------------- */\n\n#ifndef GL_EXT_packed_float\n#define GL_EXT_packed_float 1\n\n#define GL_R11F_G11F_B10F_EXT 0x8C3A\n#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B\n#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C\n\n#define GLEW_EXT_packed_float GLEW_GET_VAR(__GLEW_EXT_packed_float)\n\n#endif /* GL_EXT_packed_float */\n\n/* -------------------------- GL_EXT_packed_pixels ------------------------- */\n\n#ifndef GL_EXT_packed_pixels\n#define GL_EXT_packed_pixels 1\n\n#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032\n#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033\n#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034\n#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035\n#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036\n\n#define GLEW_EXT_packed_pixels GLEW_GET_VAR(__GLEW_EXT_packed_pixels)\n\n#endif /* GL_EXT_packed_pixels */\n\n/* ------------------------ GL_EXT_paletted_texture ------------------------ */\n\n#ifndef GL_EXT_paletted_texture\n#define GL_EXT_paletted_texture 1\n\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_PROXY_TEXTURE_1D 0x8063\n#define GL_PROXY_TEXTURE_2D 0x8064\n#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8\n#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9\n#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA\n#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB\n#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC\n#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD\n#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE\n#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF\n#define GL_COLOR_INDEX1_EXT 0x80E2\n#define GL_COLOR_INDEX2_EXT 0x80E3\n#define GL_COLOR_INDEX4_EXT 0x80E4\n#define GL_COLOR_INDEX8_EXT 0x80E5\n#define GL_COLOR_INDEX12_EXT 0x80E6\n#define GL_COLOR_INDEX16_EXT 0x80E7\n#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED\n#define GL_TEXTURE_CUBE_MAP_ARB 0x8513\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B\n\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void* data);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void* data);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\n\n#define glColorTableEXT GLEW_GET_FUN(__glewColorTableEXT)\n#define glGetColorTableEXT GLEW_GET_FUN(__glewGetColorTableEXT)\n#define glGetColorTableParameterfvEXT GLEW_GET_FUN(__glewGetColorTableParameterfvEXT)\n#define glGetColorTableParameterivEXT GLEW_GET_FUN(__glewGetColorTableParameterivEXT)\n\n#define GLEW_EXT_paletted_texture GLEW_GET_VAR(__GLEW_EXT_paletted_texture)\n\n#endif /* GL_EXT_paletted_texture */\n\n/* ----------------------- GL_EXT_pixel_buffer_object ---------------------- */\n\n#ifndef GL_EXT_pixel_buffer_object\n#define GL_EXT_pixel_buffer_object 1\n\n#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF\n\n#define GLEW_EXT_pixel_buffer_object GLEW_GET_VAR(__GLEW_EXT_pixel_buffer_object)\n\n#endif /* GL_EXT_pixel_buffer_object */\n\n/* ------------------------- GL_EXT_pixel_transform ------------------------ */\n\n#ifndef GL_EXT_pixel_transform\n#define GL_EXT_pixel_transform 1\n\n#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330\n#define GL_PIXEL_MAG_FILTER_EXT 0x8331\n#define GL_PIXEL_MIN_FILTER_EXT 0x8332\n#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333\n#define GL_CUBIC_EXT 0x8334\n#define GL_AVERAGE_EXT 0x8335\n#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336\n#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337\n#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338\n\ntypedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, const GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, const GLint param);\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);\n\n#define glGetPixelTransformParameterfvEXT GLEW_GET_FUN(__glewGetPixelTransformParameterfvEXT)\n#define glGetPixelTransformParameterivEXT GLEW_GET_FUN(__glewGetPixelTransformParameterivEXT)\n#define glPixelTransformParameterfEXT GLEW_GET_FUN(__glewPixelTransformParameterfEXT)\n#define glPixelTransformParameterfvEXT GLEW_GET_FUN(__glewPixelTransformParameterfvEXT)\n#define glPixelTransformParameteriEXT GLEW_GET_FUN(__glewPixelTransformParameteriEXT)\n#define glPixelTransformParameterivEXT GLEW_GET_FUN(__glewPixelTransformParameterivEXT)\n\n#define GLEW_EXT_pixel_transform GLEW_GET_VAR(__GLEW_EXT_pixel_transform)\n\n#endif /* GL_EXT_pixel_transform */\n\n/* ------------------- GL_EXT_pixel_transform_color_table ------------------ */\n\n#ifndef GL_EXT_pixel_transform_color_table\n#define GL_EXT_pixel_transform_color_table 1\n\n#define GLEW_EXT_pixel_transform_color_table GLEW_GET_VAR(__GLEW_EXT_pixel_transform_color_table)\n\n#endif /* GL_EXT_pixel_transform_color_table */\n\n/* ------------------------ GL_EXT_point_parameters ------------------------ */\n\n#ifndef GL_EXT_point_parameters\n#define GL_EXT_point_parameters 1\n\n#define GL_POINT_SIZE_MIN_EXT 0x8126\n#define GL_POINT_SIZE_MAX_EXT 0x8127\n#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128\n#define GL_DISTANCE_ATTENUATION_EXT 0x8129\n\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat* params);\n\n#define glPointParameterfEXT GLEW_GET_FUN(__glewPointParameterfEXT)\n#define glPointParameterfvEXT GLEW_GET_FUN(__glewPointParameterfvEXT)\n\n#define GLEW_EXT_point_parameters GLEW_GET_VAR(__GLEW_EXT_point_parameters)\n\n#endif /* GL_EXT_point_parameters */\n\n/* ------------------------- GL_EXT_polygon_offset ------------------------- */\n\n#ifndef GL_EXT_polygon_offset\n#define GL_EXT_polygon_offset 1\n\n#define GL_POLYGON_OFFSET_EXT 0x8037\n#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038\n#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039\n\ntypedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);\n\n#define glPolygonOffsetEXT GLEW_GET_FUN(__glewPolygonOffsetEXT)\n\n#define GLEW_EXT_polygon_offset GLEW_GET_VAR(__GLEW_EXT_polygon_offset)\n\n#endif /* GL_EXT_polygon_offset */\n\n/* ------------------------ GL_EXT_provoking_vertex ------------------------ */\n\n#ifndef GL_EXT_provoking_vertex\n#define GL_EXT_provoking_vertex 1\n\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C\n#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D\n#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E\n#define GL_PROVOKING_VERTEX_EXT 0x8E4F\n\ntypedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);\n\n#define glProvokingVertexEXT GLEW_GET_FUN(__glewProvokingVertexEXT)\n\n#define GLEW_EXT_provoking_vertex GLEW_GET_VAR(__GLEW_EXT_provoking_vertex)\n\n#endif /* GL_EXT_provoking_vertex */\n\n/* ------------------------- GL_EXT_rescale_normal ------------------------- */\n\n#ifndef GL_EXT_rescale_normal\n#define GL_EXT_rescale_normal 1\n\n#define GL_RESCALE_NORMAL_EXT 0x803A\n\n#define GLEW_EXT_rescale_normal GLEW_GET_VAR(__GLEW_EXT_rescale_normal)\n\n#endif /* GL_EXT_rescale_normal */\n\n/* -------------------------- GL_EXT_scene_marker -------------------------- */\n\n#ifndef GL_EXT_scene_marker\n#define GL_EXT_scene_marker 1\n\ntypedef void (GLAPIENTRY * PFNGLBEGINSCENEEXTPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLENDSCENEEXTPROC) (void);\n\n#define glBeginSceneEXT GLEW_GET_FUN(__glewBeginSceneEXT)\n#define glEndSceneEXT GLEW_GET_FUN(__glewEndSceneEXT)\n\n#define GLEW_EXT_scene_marker GLEW_GET_VAR(__GLEW_EXT_scene_marker)\n\n#endif /* GL_EXT_scene_marker */\n\n/* ------------------------- GL_EXT_secondary_color ------------------------ */\n\n#ifndef GL_EXT_secondary_color\n#define GL_EXT_secondary_color 1\n\n#define GL_COLOR_SUM_EXT 0x8458\n#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459\n#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A\n#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C\n#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D\n#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E\n\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\n\n#define glSecondaryColor3bEXT GLEW_GET_FUN(__glewSecondaryColor3bEXT)\n#define glSecondaryColor3bvEXT GLEW_GET_FUN(__glewSecondaryColor3bvEXT)\n#define glSecondaryColor3dEXT GLEW_GET_FUN(__glewSecondaryColor3dEXT)\n#define glSecondaryColor3dvEXT GLEW_GET_FUN(__glewSecondaryColor3dvEXT)\n#define glSecondaryColor3fEXT GLEW_GET_FUN(__glewSecondaryColor3fEXT)\n#define glSecondaryColor3fvEXT GLEW_GET_FUN(__glewSecondaryColor3fvEXT)\n#define glSecondaryColor3iEXT GLEW_GET_FUN(__glewSecondaryColor3iEXT)\n#define glSecondaryColor3ivEXT GLEW_GET_FUN(__glewSecondaryColor3ivEXT)\n#define glSecondaryColor3sEXT GLEW_GET_FUN(__glewSecondaryColor3sEXT)\n#define glSecondaryColor3svEXT GLEW_GET_FUN(__glewSecondaryColor3svEXT)\n#define glSecondaryColor3ubEXT GLEW_GET_FUN(__glewSecondaryColor3ubEXT)\n#define glSecondaryColor3ubvEXT GLEW_GET_FUN(__glewSecondaryColor3ubvEXT)\n#define glSecondaryColor3uiEXT GLEW_GET_FUN(__glewSecondaryColor3uiEXT)\n#define glSecondaryColor3uivEXT GLEW_GET_FUN(__glewSecondaryColor3uivEXT)\n#define glSecondaryColor3usEXT GLEW_GET_FUN(__glewSecondaryColor3usEXT)\n#define glSecondaryColor3usvEXT GLEW_GET_FUN(__glewSecondaryColor3usvEXT)\n#define glSecondaryColorPointerEXT GLEW_GET_FUN(__glewSecondaryColorPointerEXT)\n\n#define GLEW_EXT_secondary_color GLEW_GET_VAR(__GLEW_EXT_secondary_color)\n\n#endif /* GL_EXT_secondary_color */\n\n/* --------------------- GL_EXT_separate_shader_objects -------------------- */\n\n#ifndef GL_EXT_separate_shader_objects\n#define GL_EXT_separate_shader_objects 1\n\n#define GL_ACTIVE_PROGRAM_EXT 0x8B8D\n\ntypedef void (GLAPIENTRY * PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar* string);\ntypedef void (GLAPIENTRY * PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);\n\n#define glActiveProgramEXT GLEW_GET_FUN(__glewActiveProgramEXT)\n#define glCreateShaderProgramEXT GLEW_GET_FUN(__glewCreateShaderProgramEXT)\n#define glUseShaderProgramEXT GLEW_GET_FUN(__glewUseShaderProgramEXT)\n\n#define GLEW_EXT_separate_shader_objects GLEW_GET_VAR(__GLEW_EXT_separate_shader_objects)\n\n#endif /* GL_EXT_separate_shader_objects */\n\n/* --------------------- GL_EXT_separate_specular_color -------------------- */\n\n#ifndef GL_EXT_separate_specular_color\n#define GL_EXT_separate_specular_color 1\n\n#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8\n#define GL_SINGLE_COLOR_EXT 0x81F9\n#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA\n\n#define GLEW_EXT_separate_specular_color GLEW_GET_VAR(__GLEW_EXT_separate_specular_color)\n\n#endif /* GL_EXT_separate_specular_color */\n\n/* --------------------- GL_EXT_shader_image_load_store -------------------- */\n\n#ifndef GL_EXT_shader_image_load_store\n#define GL_EXT_shader_image_load_store 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001\n#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002\n#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004\n#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020\n#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040\n#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080\n#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100\n#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200\n#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800\n#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000\n#define GL_MAX_IMAGE_UNITS_EXT 0x8F38\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39\n#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A\n#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B\n#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C\n#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D\n#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E\n#define GL_IMAGE_1D_EXT 0x904C\n#define GL_IMAGE_2D_EXT 0x904D\n#define GL_IMAGE_3D_EXT 0x904E\n#define GL_IMAGE_2D_RECT_EXT 0x904F\n#define GL_IMAGE_CUBE_EXT 0x9050\n#define GL_IMAGE_BUFFER_EXT 0x9051\n#define GL_IMAGE_1D_ARRAY_EXT 0x9052\n#define GL_IMAGE_2D_ARRAY_EXT 0x9053\n#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054\n#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056\n#define GL_INT_IMAGE_1D_EXT 0x9057\n#define GL_INT_IMAGE_2D_EXT 0x9058\n#define GL_INT_IMAGE_3D_EXT 0x9059\n#define GL_INT_IMAGE_2D_RECT_EXT 0x905A\n#define GL_INT_IMAGE_CUBE_EXT 0x905B\n#define GL_INT_IMAGE_BUFFER_EXT 0x905C\n#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D\n#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F\n#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061\n#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062\n#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063\n#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065\n#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066\n#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C\n#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D\n#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E\n#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF\n\ntypedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);\ntypedef void (GLAPIENTRY * PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);\n\n#define glBindImageTextureEXT GLEW_GET_FUN(__glewBindImageTextureEXT)\n#define glMemoryBarrierEXT GLEW_GET_FUN(__glewMemoryBarrierEXT)\n\n#define GLEW_EXT_shader_image_load_store GLEW_GET_VAR(__GLEW_EXT_shader_image_load_store)\n\n#endif /* GL_EXT_shader_image_load_store */\n\n/* -------------------------- GL_EXT_shadow_funcs -------------------------- */\n\n#ifndef GL_EXT_shadow_funcs\n#define GL_EXT_shadow_funcs 1\n\n#define GLEW_EXT_shadow_funcs GLEW_GET_VAR(__GLEW_EXT_shadow_funcs)\n\n#endif /* GL_EXT_shadow_funcs */\n\n/* --------------------- GL_EXT_shared_texture_palette --------------------- */\n\n#ifndef GL_EXT_shared_texture_palette\n#define GL_EXT_shared_texture_palette 1\n\n#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB\n\n#define GLEW_EXT_shared_texture_palette GLEW_GET_VAR(__GLEW_EXT_shared_texture_palette)\n\n#endif /* GL_EXT_shared_texture_palette */\n\n/* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */\n\n#ifndef GL_EXT_stencil_clear_tag\n#define GL_EXT_stencil_clear_tag 1\n\n#define GL_STENCIL_TAG_BITS_EXT 0x88F2\n#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3\n\n#define GLEW_EXT_stencil_clear_tag GLEW_GET_VAR(__GLEW_EXT_stencil_clear_tag)\n\n#endif /* GL_EXT_stencil_clear_tag */\n\n/* ------------------------ GL_EXT_stencil_two_side ------------------------ */\n\n#ifndef GL_EXT_stencil_two_side\n#define GL_EXT_stencil_two_side 1\n\n#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910\n#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911\n\ntypedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);\n\n#define glActiveStencilFaceEXT GLEW_GET_FUN(__glewActiveStencilFaceEXT)\n\n#define GLEW_EXT_stencil_two_side GLEW_GET_VAR(__GLEW_EXT_stencil_two_side)\n\n#endif /* GL_EXT_stencil_two_side */\n\n/* -------------------------- GL_EXT_stencil_wrap -------------------------- */\n\n#ifndef GL_EXT_stencil_wrap\n#define GL_EXT_stencil_wrap 1\n\n#define GL_INCR_WRAP_EXT 0x8507\n#define GL_DECR_WRAP_EXT 0x8508\n\n#define GLEW_EXT_stencil_wrap GLEW_GET_VAR(__GLEW_EXT_stencil_wrap)\n\n#endif /* GL_EXT_stencil_wrap */\n\n/* --------------------------- GL_EXT_subtexture --------------------------- */\n\n#ifndef GL_EXT_subtexture\n#define GL_EXT_subtexture 1\n\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);\n\n#define glTexSubImage1DEXT GLEW_GET_FUN(__glewTexSubImage1DEXT)\n#define glTexSubImage2DEXT GLEW_GET_FUN(__glewTexSubImage2DEXT)\n#define glTexSubImage3DEXT GLEW_GET_FUN(__glewTexSubImage3DEXT)\n\n#define GLEW_EXT_subtexture GLEW_GET_VAR(__GLEW_EXT_subtexture)\n\n#endif /* GL_EXT_subtexture */\n\n/* ----------------------------- GL_EXT_texture ---------------------------- */\n\n#ifndef GL_EXT_texture\n#define GL_EXT_texture 1\n\n#define GL_ALPHA4_EXT 0x803B\n#define GL_ALPHA8_EXT 0x803C\n#define GL_ALPHA12_EXT 0x803D\n#define GL_ALPHA16_EXT 0x803E\n#define GL_LUMINANCE4_EXT 0x803F\n#define GL_LUMINANCE8_EXT 0x8040\n#define GL_LUMINANCE12_EXT 0x8041\n#define GL_LUMINANCE16_EXT 0x8042\n#define GL_LUMINANCE4_ALPHA4_EXT 0x8043\n#define GL_LUMINANCE6_ALPHA2_EXT 0x8044\n#define GL_LUMINANCE8_ALPHA8_EXT 0x8045\n#define GL_LUMINANCE12_ALPHA4_EXT 0x8046\n#define GL_LUMINANCE12_ALPHA12_EXT 0x8047\n#define GL_LUMINANCE16_ALPHA16_EXT 0x8048\n#define GL_INTENSITY_EXT 0x8049\n#define GL_INTENSITY4_EXT 0x804A\n#define GL_INTENSITY8_EXT 0x804B\n#define GL_INTENSITY12_EXT 0x804C\n#define GL_INTENSITY16_EXT 0x804D\n#define GL_RGB2_EXT 0x804E\n#define GL_RGB4_EXT 0x804F\n#define GL_RGB5_EXT 0x8050\n#define GL_RGB8_EXT 0x8051\n#define GL_RGB10_EXT 0x8052\n#define GL_RGB12_EXT 0x8053\n#define GL_RGB16_EXT 0x8054\n#define GL_RGBA2_EXT 0x8055\n#define GL_RGBA4_EXT 0x8056\n#define GL_RGB5_A1_EXT 0x8057\n#define GL_RGBA8_EXT 0x8058\n#define GL_RGB10_A2_EXT 0x8059\n#define GL_RGBA12_EXT 0x805A\n#define GL_RGBA16_EXT 0x805B\n#define GL_TEXTURE_RED_SIZE_EXT 0x805C\n#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D\n#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E\n#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F\n#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060\n#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061\n#define GL_REPLACE_EXT 0x8062\n#define GL_PROXY_TEXTURE_1D_EXT 0x8063\n#define GL_PROXY_TEXTURE_2D_EXT 0x8064\n\n#define GLEW_EXT_texture GLEW_GET_VAR(__GLEW_EXT_texture)\n\n#endif /* GL_EXT_texture */\n\n/* ---------------------------- GL_EXT_texture3D --------------------------- */\n\n#ifndef GL_EXT_texture3D\n#define GL_EXT_texture3D 1\n\n#define GL_PACK_SKIP_IMAGES_EXT 0x806B\n#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C\n#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D\n#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E\n#define GL_TEXTURE_3D_EXT 0x806F\n#define GL_PROXY_TEXTURE_3D_EXT 0x8070\n#define GL_TEXTURE_DEPTH_EXT 0x8071\n#define GL_TEXTURE_WRAP_R_EXT 0x8072\n#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073\n\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);\n\n#define glTexImage3DEXT GLEW_GET_FUN(__glewTexImage3DEXT)\n\n#define GLEW_EXT_texture3D GLEW_GET_VAR(__GLEW_EXT_texture3D)\n\n#endif /* GL_EXT_texture3D */\n\n/* -------------------------- GL_EXT_texture_array ------------------------- */\n\n#ifndef GL_EXT_texture_array\n#define GL_EXT_texture_array 1\n\n#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E\n#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF\n#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18\n#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19\n#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A\n#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B\n#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C\n#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D\n\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\n\n#define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT)\n\n#define GLEW_EXT_texture_array GLEW_GET_VAR(__GLEW_EXT_texture_array)\n\n#endif /* GL_EXT_texture_array */\n\n/* ---------------------- GL_EXT_texture_buffer_object --------------------- */\n\n#ifndef GL_EXT_texture_buffer_object\n#define GL_EXT_texture_buffer_object 1\n\n#define GL_TEXTURE_BUFFER_EXT 0x8C2A\n#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B\n#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D\n#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E\n\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);\n\n#define glTexBufferEXT GLEW_GET_FUN(__glewTexBufferEXT)\n\n#define GLEW_EXT_texture_buffer_object GLEW_GET_VAR(__GLEW_EXT_texture_buffer_object)\n\n#endif /* GL_EXT_texture_buffer_object */\n\n/* -------------------- GL_EXT_texture_compression_dxt1 -------------------- */\n\n#ifndef GL_EXT_texture_compression_dxt1\n#define GL_EXT_texture_compression_dxt1 1\n\n#define GLEW_EXT_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_EXT_texture_compression_dxt1)\n\n#endif /* GL_EXT_texture_compression_dxt1 */\n\n/* -------------------- GL_EXT_texture_compression_latc -------------------- */\n\n#ifndef GL_EXT_texture_compression_latc\n#define GL_EXT_texture_compression_latc 1\n\n#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70\n#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71\n#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72\n#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73\n\n#define GLEW_EXT_texture_compression_latc GLEW_GET_VAR(__GLEW_EXT_texture_compression_latc)\n\n#endif /* GL_EXT_texture_compression_latc */\n\n/* -------------------- GL_EXT_texture_compression_rgtc -------------------- */\n\n#ifndef GL_EXT_texture_compression_rgtc\n#define GL_EXT_texture_compression_rgtc 1\n\n#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB\n#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC\n#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD\n#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE\n\n#define GLEW_EXT_texture_compression_rgtc GLEW_GET_VAR(__GLEW_EXT_texture_compression_rgtc)\n\n#endif /* GL_EXT_texture_compression_rgtc */\n\n/* -------------------- GL_EXT_texture_compression_s3tc -------------------- */\n\n#ifndef GL_EXT_texture_compression_s3tc\n#define GL_EXT_texture_compression_s3tc 1\n\n#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0\n#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1\n#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2\n#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3\n\n#define GLEW_EXT_texture_compression_s3tc GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc)\n\n#endif /* GL_EXT_texture_compression_s3tc */\n\n/* ------------------------ GL_EXT_texture_cube_map ------------------------ */\n\n#ifndef GL_EXT_texture_cube_map\n#define GL_EXT_texture_cube_map 1\n\n#define GL_NORMAL_MAP_EXT 0x8511\n#define GL_REFLECTION_MAP_EXT 0x8512\n#define GL_TEXTURE_CUBE_MAP_EXT 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C\n\n#define GLEW_EXT_texture_cube_map GLEW_GET_VAR(__GLEW_EXT_texture_cube_map)\n\n#endif /* GL_EXT_texture_cube_map */\n\n/* ----------------------- GL_EXT_texture_edge_clamp ----------------------- */\n\n#ifndef GL_EXT_texture_edge_clamp\n#define GL_EXT_texture_edge_clamp 1\n\n#define GL_CLAMP_TO_EDGE_EXT 0x812F\n\n#define GLEW_EXT_texture_edge_clamp GLEW_GET_VAR(__GLEW_EXT_texture_edge_clamp)\n\n#endif /* GL_EXT_texture_edge_clamp */\n\n/* --------------------------- GL_EXT_texture_env -------------------------- */\n\n#ifndef GL_EXT_texture_env\n#define GL_EXT_texture_env 1\n\n#define GL_TEXTURE_ENV0_EXT 0\n#define GL_ENV_BLEND_EXT 0\n#define GL_TEXTURE_ENV_SHIFT_EXT 0\n#define GL_ENV_REPLACE_EXT 0\n#define GL_ENV_ADD_EXT 0\n#define GL_ENV_SUBTRACT_EXT 0\n#define GL_TEXTURE_ENV_MODE_ALPHA_EXT 0\n#define GL_ENV_REVERSE_SUBTRACT_EXT 0\n#define GL_ENV_REVERSE_BLEND_EXT 0\n#define GL_ENV_COPY_EXT 0\n#define GL_ENV_MODULATE_EXT 0\n\n#define GLEW_EXT_texture_env GLEW_GET_VAR(__GLEW_EXT_texture_env)\n\n#endif /* GL_EXT_texture_env */\n\n/* ------------------------- GL_EXT_texture_env_add ------------------------ */\n\n#ifndef GL_EXT_texture_env_add\n#define GL_EXT_texture_env_add 1\n\n#define GLEW_EXT_texture_env_add GLEW_GET_VAR(__GLEW_EXT_texture_env_add)\n\n#endif /* GL_EXT_texture_env_add */\n\n/* ----------------------- GL_EXT_texture_env_combine ---------------------- */\n\n#ifndef GL_EXT_texture_env_combine\n#define GL_EXT_texture_env_combine 1\n\n#define GL_COMBINE_EXT 0x8570\n#define GL_COMBINE_RGB_EXT 0x8571\n#define GL_COMBINE_ALPHA_EXT 0x8572\n#define GL_RGB_SCALE_EXT 0x8573\n#define GL_ADD_SIGNED_EXT 0x8574\n#define GL_INTERPOLATE_EXT 0x8575\n#define GL_CONSTANT_EXT 0x8576\n#define GL_PRIMARY_COLOR_EXT 0x8577\n#define GL_PREVIOUS_EXT 0x8578\n#define GL_SOURCE0_RGB_EXT 0x8580\n#define GL_SOURCE1_RGB_EXT 0x8581\n#define GL_SOURCE2_RGB_EXT 0x8582\n#define GL_SOURCE0_ALPHA_EXT 0x8588\n#define GL_SOURCE1_ALPHA_EXT 0x8589\n#define GL_SOURCE2_ALPHA_EXT 0x858A\n#define GL_OPERAND0_RGB_EXT 0x8590\n#define GL_OPERAND1_RGB_EXT 0x8591\n#define GL_OPERAND2_RGB_EXT 0x8592\n#define GL_OPERAND0_ALPHA_EXT 0x8598\n#define GL_OPERAND1_ALPHA_EXT 0x8599\n#define GL_OPERAND2_ALPHA_EXT 0x859A\n\n#define GLEW_EXT_texture_env_combine GLEW_GET_VAR(__GLEW_EXT_texture_env_combine)\n\n#endif /* GL_EXT_texture_env_combine */\n\n/* ------------------------ GL_EXT_texture_env_dot3 ------------------------ */\n\n#ifndef GL_EXT_texture_env_dot3\n#define GL_EXT_texture_env_dot3 1\n\n#define GL_DOT3_RGB_EXT 0x8740\n#define GL_DOT3_RGBA_EXT 0x8741\n\n#define GLEW_EXT_texture_env_dot3 GLEW_GET_VAR(__GLEW_EXT_texture_env_dot3)\n\n#endif /* GL_EXT_texture_env_dot3 */\n\n/* ------------------- GL_EXT_texture_filter_anisotropic ------------------- */\n\n#ifndef GL_EXT_texture_filter_anisotropic\n#define GL_EXT_texture_filter_anisotropic 1\n\n#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE\n#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF\n\n#define GLEW_EXT_texture_filter_anisotropic GLEW_GET_VAR(__GLEW_EXT_texture_filter_anisotropic)\n\n#endif /* GL_EXT_texture_filter_anisotropic */\n\n/* ------------------------- GL_EXT_texture_integer ------------------------ */\n\n#ifndef GL_EXT_texture_integer\n#define GL_EXT_texture_integer 1\n\n#define GL_RGBA32UI_EXT 0x8D70\n#define GL_RGB32UI_EXT 0x8D71\n#define GL_ALPHA32UI_EXT 0x8D72\n#define GL_INTENSITY32UI_EXT 0x8D73\n#define GL_LUMINANCE32UI_EXT 0x8D74\n#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75\n#define GL_RGBA16UI_EXT 0x8D76\n#define GL_RGB16UI_EXT 0x8D77\n#define GL_ALPHA16UI_EXT 0x8D78\n#define GL_INTENSITY16UI_EXT 0x8D79\n#define GL_LUMINANCE16UI_EXT 0x8D7A\n#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B\n#define GL_RGBA8UI_EXT 0x8D7C\n#define GL_RGB8UI_EXT 0x8D7D\n#define GL_ALPHA8UI_EXT 0x8D7E\n#define GL_INTENSITY8UI_EXT 0x8D7F\n#define GL_LUMINANCE8UI_EXT 0x8D80\n#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81\n#define GL_RGBA32I_EXT 0x8D82\n#define GL_RGB32I_EXT 0x8D83\n#define GL_ALPHA32I_EXT 0x8D84\n#define GL_INTENSITY32I_EXT 0x8D85\n#define GL_LUMINANCE32I_EXT 0x8D86\n#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87\n#define GL_RGBA16I_EXT 0x8D88\n#define GL_RGB16I_EXT 0x8D89\n#define GL_ALPHA16I_EXT 0x8D8A\n#define GL_INTENSITY16I_EXT 0x8D8B\n#define GL_LUMINANCE16I_EXT 0x8D8C\n#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D\n#define GL_RGBA8I_EXT 0x8D8E\n#define GL_RGB8I_EXT 0x8D8F\n#define GL_ALPHA8I_EXT 0x8D90\n#define GL_INTENSITY8I_EXT 0x8D91\n#define GL_LUMINANCE8I_EXT 0x8D92\n#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93\n#define GL_RED_INTEGER_EXT 0x8D94\n#define GL_GREEN_INTEGER_EXT 0x8D95\n#define GL_BLUE_INTEGER_EXT 0x8D96\n#define GL_ALPHA_INTEGER_EXT 0x8D97\n#define GL_RGB_INTEGER_EXT 0x8D98\n#define GL_RGBA_INTEGER_EXT 0x8D99\n#define GL_BGR_INTEGER_EXT 0x8D9A\n#define GL_BGRA_INTEGER_EXT 0x8D9B\n#define GL_LUMINANCE_INTEGER_EXT 0x8D9C\n#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D\n#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E\n\ntypedef void (GLAPIENTRY * PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);\ntypedef void (GLAPIENTRY * PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);\n\n#define glClearColorIiEXT GLEW_GET_FUN(__glewClearColorIiEXT)\n#define glClearColorIuiEXT GLEW_GET_FUN(__glewClearColorIuiEXT)\n#define glGetTexParameterIivEXT GLEW_GET_FUN(__glewGetTexParameterIivEXT)\n#define glGetTexParameterIuivEXT GLEW_GET_FUN(__glewGetTexParameterIuivEXT)\n#define glTexParameterIivEXT GLEW_GET_FUN(__glewTexParameterIivEXT)\n#define glTexParameterIuivEXT GLEW_GET_FUN(__glewTexParameterIuivEXT)\n\n#define GLEW_EXT_texture_integer GLEW_GET_VAR(__GLEW_EXT_texture_integer)\n\n#endif /* GL_EXT_texture_integer */\n\n/* ------------------------ GL_EXT_texture_lod_bias ------------------------ */\n\n#ifndef GL_EXT_texture_lod_bias\n#define GL_EXT_texture_lod_bias 1\n\n#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD\n#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500\n#define GL_TEXTURE_LOD_BIAS_EXT 0x8501\n\n#define GLEW_EXT_texture_lod_bias GLEW_GET_VAR(__GLEW_EXT_texture_lod_bias)\n\n#endif /* GL_EXT_texture_lod_bias */\n\n/* ---------------------- GL_EXT_texture_mirror_clamp ---------------------- */\n\n#ifndef GL_EXT_texture_mirror_clamp\n#define GL_EXT_texture_mirror_clamp 1\n\n#define GL_MIRROR_CLAMP_EXT 0x8742\n#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743\n#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912\n\n#define GLEW_EXT_texture_mirror_clamp GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp)\n\n#endif /* GL_EXT_texture_mirror_clamp */\n\n/* ------------------------- GL_EXT_texture_object ------------------------- */\n\n#ifndef GL_EXT_texture_object\n#define GL_EXT_texture_object 1\n\n#define GL_TEXTURE_PRIORITY_EXT 0x8066\n#define GL_TEXTURE_RESIDENT_EXT 0x8067\n#define GL_TEXTURE_1D_BINDING_EXT 0x8068\n#define GL_TEXTURE_2D_BINDING_EXT 0x8069\n#define GL_TEXTURE_3D_BINDING_EXT 0x806A\n\ntypedef GLboolean (GLAPIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint* textures, GLboolean* residences);\ntypedef void (GLAPIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);\ntypedef void (GLAPIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint* textures);\ntypedef void (GLAPIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint* textures);\ntypedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture);\ntypedef void (GLAPIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint* textures, const GLclampf* priorities);\n\n#define glAreTexturesResidentEXT GLEW_GET_FUN(__glewAreTexturesResidentEXT)\n#define glBindTextureEXT GLEW_GET_FUN(__glewBindTextureEXT)\n#define glDeleteTexturesEXT GLEW_GET_FUN(__glewDeleteTexturesEXT)\n#define glGenTexturesEXT GLEW_GET_FUN(__glewGenTexturesEXT)\n#define glIsTextureEXT GLEW_GET_FUN(__glewIsTextureEXT)\n#define glPrioritizeTexturesEXT GLEW_GET_FUN(__glewPrioritizeTexturesEXT)\n\n#define GLEW_EXT_texture_object GLEW_GET_VAR(__GLEW_EXT_texture_object)\n\n#endif /* GL_EXT_texture_object */\n\n/* --------------------- GL_EXT_texture_perturb_normal --------------------- */\n\n#ifndef GL_EXT_texture_perturb_normal\n#define GL_EXT_texture_perturb_normal 1\n\n#define GL_PERTURB_EXT 0x85AE\n#define GL_TEXTURE_NORMAL_EXT 0x85AF\n\ntypedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode);\n\n#define glTextureNormalEXT GLEW_GET_FUN(__glewTextureNormalEXT)\n\n#define GLEW_EXT_texture_perturb_normal GLEW_GET_VAR(__GLEW_EXT_texture_perturb_normal)\n\n#endif /* GL_EXT_texture_perturb_normal */\n\n/* ------------------------ GL_EXT_texture_rectangle ----------------------- */\n\n#ifndef GL_EXT_texture_rectangle\n#define GL_EXT_texture_rectangle 1\n\n#define GL_TEXTURE_RECTANGLE_EXT 0x84F5\n#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6\n#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8\n\n#define GLEW_EXT_texture_rectangle GLEW_GET_VAR(__GLEW_EXT_texture_rectangle)\n\n#endif /* GL_EXT_texture_rectangle */\n\n/* -------------------------- GL_EXT_texture_sRGB -------------------------- */\n\n#ifndef GL_EXT_texture_sRGB\n#define GL_EXT_texture_sRGB 1\n\n#define GL_SRGB_EXT 0x8C40\n#define GL_SRGB8_EXT 0x8C41\n#define GL_SRGB_ALPHA_EXT 0x8C42\n#define GL_SRGB8_ALPHA8_EXT 0x8C43\n#define GL_SLUMINANCE_ALPHA_EXT 0x8C44\n#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45\n#define GL_SLUMINANCE_EXT 0x8C46\n#define GL_SLUMINANCE8_EXT 0x8C47\n#define GL_COMPRESSED_SRGB_EXT 0x8C48\n#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49\n#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A\n#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B\n#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F\n\n#define GLEW_EXT_texture_sRGB GLEW_GET_VAR(__GLEW_EXT_texture_sRGB)\n\n#endif /* GL_EXT_texture_sRGB */\n\n/* ----------------------- GL_EXT_texture_sRGB_decode ---------------------- */\n\n#ifndef GL_EXT_texture_sRGB_decode\n#define GL_EXT_texture_sRGB_decode 1\n\n#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48\n#define GL_DECODE_EXT 0x8A49\n#define GL_SKIP_DECODE_EXT 0x8A4A\n\n#define GLEW_EXT_texture_sRGB_decode GLEW_GET_VAR(__GLEW_EXT_texture_sRGB_decode)\n\n#endif /* GL_EXT_texture_sRGB_decode */\n\n/* --------------------- GL_EXT_texture_shared_exponent -------------------- */\n\n#ifndef GL_EXT_texture_shared_exponent\n#define GL_EXT_texture_shared_exponent 1\n\n#define GL_RGB9_E5_EXT 0x8C3D\n#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E\n#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F\n\n#define GLEW_EXT_texture_shared_exponent GLEW_GET_VAR(__GLEW_EXT_texture_shared_exponent)\n\n#endif /* GL_EXT_texture_shared_exponent */\n\n/* -------------------------- GL_EXT_texture_snorm ------------------------- */\n\n#ifndef GL_EXT_texture_snorm\n#define GL_EXT_texture_snorm 1\n\n#define GL_RED_SNORM 0x8F90\n#define GL_RG_SNORM 0x8F91\n#define GL_RGB_SNORM 0x8F92\n#define GL_RGBA_SNORM 0x8F93\n#define GL_R8_SNORM 0x8F94\n#define GL_RG8_SNORM 0x8F95\n#define GL_RGB8_SNORM 0x8F96\n#define GL_RGBA8_SNORM 0x8F97\n#define GL_R16_SNORM 0x8F98\n#define GL_RG16_SNORM 0x8F99\n#define GL_RGB16_SNORM 0x8F9A\n#define GL_RGBA16_SNORM 0x8F9B\n#define GL_SIGNED_NORMALIZED 0x8F9C\n#define GL_ALPHA_SNORM 0x9010\n#define GL_LUMINANCE_SNORM 0x9011\n#define GL_LUMINANCE_ALPHA_SNORM 0x9012\n#define GL_INTENSITY_SNORM 0x9013\n#define GL_ALPHA8_SNORM 0x9014\n#define GL_LUMINANCE8_SNORM 0x9015\n#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016\n#define GL_INTENSITY8_SNORM 0x9017\n#define GL_ALPHA16_SNORM 0x9018\n#define GL_LUMINANCE16_SNORM 0x9019\n#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A\n#define GL_INTENSITY16_SNORM 0x901B\n\n#define GLEW_EXT_texture_snorm GLEW_GET_VAR(__GLEW_EXT_texture_snorm)\n\n#endif /* GL_EXT_texture_snorm */\n\n/* ------------------------- GL_EXT_texture_swizzle ------------------------ */\n\n#ifndef GL_EXT_texture_swizzle\n#define GL_EXT_texture_swizzle 1\n\n#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42\n#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43\n#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44\n#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45\n#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46\n\n#define GLEW_EXT_texture_swizzle GLEW_GET_VAR(__GLEW_EXT_texture_swizzle)\n\n#endif /* GL_EXT_texture_swizzle */\n\n/* --------------------------- GL_EXT_timer_query -------------------------- */\n\n#ifndef GL_EXT_timer_query\n#define GL_EXT_timer_query 1\n\n#define GL_TIME_ELAPSED_EXT 0x88BF\n\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);\n\n#define glGetQueryObjecti64vEXT GLEW_GET_FUN(__glewGetQueryObjecti64vEXT)\n#define glGetQueryObjectui64vEXT GLEW_GET_FUN(__glewGetQueryObjectui64vEXT)\n\n#define GLEW_EXT_timer_query GLEW_GET_VAR(__GLEW_EXT_timer_query)\n\n#endif /* GL_EXT_timer_query */\n\n/* ----------------------- GL_EXT_transform_feedback ----------------------- */\n\n#ifndef GL_EXT_transform_feedback\n#define GL_EXT_transform_feedback 1\n\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80\n#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85\n#define GL_PRIMITIVES_GENERATED_EXT 0x8C87\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88\n#define GL_RASTERIZER_DISCARD_EXT 0x8C89\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B\n#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C\n#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D\n#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F\n\ntypedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\ntypedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei *size, GLenum *type, GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar ** varyings, GLenum bufferMode);\n\n#define glBeginTransformFeedbackEXT GLEW_GET_FUN(__glewBeginTransformFeedbackEXT)\n#define glBindBufferBaseEXT GLEW_GET_FUN(__glewBindBufferBaseEXT)\n#define glBindBufferOffsetEXT GLEW_GET_FUN(__glewBindBufferOffsetEXT)\n#define glBindBufferRangeEXT GLEW_GET_FUN(__glewBindBufferRangeEXT)\n#define glEndTransformFeedbackEXT GLEW_GET_FUN(__glewEndTransformFeedbackEXT)\n#define glGetTransformFeedbackVaryingEXT GLEW_GET_FUN(__glewGetTransformFeedbackVaryingEXT)\n#define glTransformFeedbackVaryingsEXT GLEW_GET_FUN(__glewTransformFeedbackVaryingsEXT)\n\n#define GLEW_EXT_transform_feedback GLEW_GET_VAR(__GLEW_EXT_transform_feedback)\n\n#endif /* GL_EXT_transform_feedback */\n\n/* -------------------------- GL_EXT_vertex_array -------------------------- */\n\n#ifndef GL_EXT_vertex_array\n#define GL_EXT_vertex_array 1\n\n#define GL_DOUBLE_EXT 0x140A\n#define GL_VERTEX_ARRAY_EXT 0x8074\n#define GL_NORMAL_ARRAY_EXT 0x8075\n#define GL_COLOR_ARRAY_EXT 0x8076\n#define GL_INDEX_ARRAY_EXT 0x8077\n#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078\n#define GL_EDGE_FLAG_ARRAY_EXT 0x8079\n#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A\n#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B\n#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C\n#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D\n#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E\n#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F\n#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080\n#define GL_COLOR_ARRAY_SIZE_EXT 0x8081\n#define GL_COLOR_ARRAY_TYPE_EXT 0x8082\n#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083\n#define GL_COLOR_ARRAY_COUNT_EXT 0x8084\n#define GL_INDEX_ARRAY_TYPE_EXT 0x8085\n#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086\n#define GL_INDEX_ARRAY_COUNT_EXT 0x8087\n#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088\n#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089\n#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A\n#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B\n#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C\n#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D\n#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E\n#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F\n#define GL_COLOR_ARRAY_POINTER_EXT 0x8090\n#define GL_INDEX_ARRAY_POINTER_EXT 0x8091\n#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092\n#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093\n\ntypedef void (GLAPIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i);\ntypedef void (GLAPIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);\ntypedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean* pointer);\ntypedef void (GLAPIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer);\n\n#define glArrayElementEXT GLEW_GET_FUN(__glewArrayElementEXT)\n#define glColorPointerEXT GLEW_GET_FUN(__glewColorPointerEXT)\n#define glDrawArraysEXT GLEW_GET_FUN(__glewDrawArraysEXT)\n#define glEdgeFlagPointerEXT GLEW_GET_FUN(__glewEdgeFlagPointerEXT)\n#define glIndexPointerEXT GLEW_GET_FUN(__glewIndexPointerEXT)\n#define glNormalPointerEXT GLEW_GET_FUN(__glewNormalPointerEXT)\n#define glTexCoordPointerEXT GLEW_GET_FUN(__glewTexCoordPointerEXT)\n#define glVertexPointerEXT GLEW_GET_FUN(__glewVertexPointerEXT)\n\n#define GLEW_EXT_vertex_array GLEW_GET_VAR(__GLEW_EXT_vertex_array)\n\n#endif /* GL_EXT_vertex_array */\n\n/* ------------------------ GL_EXT_vertex_array_bgra ----------------------- */\n\n#ifndef GL_EXT_vertex_array_bgra\n#define GL_EXT_vertex_array_bgra 1\n\n#define GL_BGRA 0x80E1\n\n#define GLEW_EXT_vertex_array_bgra GLEW_GET_VAR(__GLEW_EXT_vertex_array_bgra)\n\n#endif /* GL_EXT_vertex_array_bgra */\n\n/* ----------------------- GL_EXT_vertex_attrib_64bit ---------------------- */\n\n#ifndef GL_EXT_vertex_attrib_64bit\n#define GL_EXT_vertex_attrib_64bit 1\n\n#define GL_DOUBLE_MAT2_EXT 0x8F46\n#define GL_DOUBLE_MAT3_EXT 0x8F47\n#define GL_DOUBLE_MAT4_EXT 0x8F48\n#define GL_DOUBLE_MAT2x3_EXT 0x8F49\n#define GL_DOUBLE_MAT2x4_EXT 0x8F4A\n#define GL_DOUBLE_MAT3x2_EXT 0x8F4B\n#define GL_DOUBLE_MAT3x4_EXT 0x8F4C\n#define GL_DOUBLE_MAT4x2_EXT 0x8F4D\n#define GL_DOUBLE_MAT4x3_EXT 0x8F4E\n#define GL_DOUBLE_VEC2_EXT 0x8FFC\n#define GL_DOUBLE_VEC3_EXT 0x8FFD\n#define GL_DOUBLE_VEC4_EXT 0x8FFE\n\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);\n\n#define glGetVertexAttribLdvEXT GLEW_GET_FUN(__glewGetVertexAttribLdvEXT)\n#define glVertexArrayVertexAttribLOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLOffsetEXT)\n#define glVertexAttribL1dEXT GLEW_GET_FUN(__glewVertexAttribL1dEXT)\n#define glVertexAttribL1dvEXT GLEW_GET_FUN(__glewVertexAttribL1dvEXT)\n#define glVertexAttribL2dEXT GLEW_GET_FUN(__glewVertexAttribL2dEXT)\n#define glVertexAttribL2dvEXT GLEW_GET_FUN(__glewVertexAttribL2dvEXT)\n#define glVertexAttribL3dEXT GLEW_GET_FUN(__glewVertexAttribL3dEXT)\n#define glVertexAttribL3dvEXT GLEW_GET_FUN(__glewVertexAttribL3dvEXT)\n#define glVertexAttribL4dEXT GLEW_GET_FUN(__glewVertexAttribL4dEXT)\n#define glVertexAttribL4dvEXT GLEW_GET_FUN(__glewVertexAttribL4dvEXT)\n#define glVertexAttribLPointerEXT GLEW_GET_FUN(__glewVertexAttribLPointerEXT)\n\n#define GLEW_EXT_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_EXT_vertex_attrib_64bit)\n\n#endif /* GL_EXT_vertex_attrib_64bit */\n\n/* -------------------------- GL_EXT_vertex_shader ------------------------- */\n\n#ifndef GL_EXT_vertex_shader\n#define GL_EXT_vertex_shader 1\n\n#define GL_VERTEX_SHADER_EXT 0x8780\n#define GL_VERTEX_SHADER_BINDING_EXT 0x8781\n#define GL_OP_INDEX_EXT 0x8782\n#define GL_OP_NEGATE_EXT 0x8783\n#define GL_OP_DOT3_EXT 0x8784\n#define GL_OP_DOT4_EXT 0x8785\n#define GL_OP_MUL_EXT 0x8786\n#define GL_OP_ADD_EXT 0x8787\n#define GL_OP_MADD_EXT 0x8788\n#define GL_OP_FRAC_EXT 0x8789\n#define GL_OP_MAX_EXT 0x878A\n#define GL_OP_MIN_EXT 0x878B\n#define GL_OP_SET_GE_EXT 0x878C\n#define GL_OP_SET_LT_EXT 0x878D\n#define GL_OP_CLAMP_EXT 0x878E\n#define GL_OP_FLOOR_EXT 0x878F\n#define GL_OP_ROUND_EXT 0x8790\n#define GL_OP_EXP_BASE_2_EXT 0x8791\n#define GL_OP_LOG_BASE_2_EXT 0x8792\n#define GL_OP_POWER_EXT 0x8793\n#define GL_OP_RECIP_EXT 0x8794\n#define GL_OP_RECIP_SQRT_EXT 0x8795\n#define GL_OP_SUB_EXT 0x8796\n#define GL_OP_CROSS_PRODUCT_EXT 0x8797\n#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798\n#define GL_OP_MOV_EXT 0x8799\n#define GL_OUTPUT_VERTEX_EXT 0x879A\n#define GL_OUTPUT_COLOR0_EXT 0x879B\n#define GL_OUTPUT_COLOR1_EXT 0x879C\n#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D\n#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E\n#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F\n#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0\n#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1\n#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2\n#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3\n#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4\n#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5\n#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6\n#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7\n#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8\n#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9\n#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA\n#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB\n#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC\n#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD\n#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE\n#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF\n#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0\n#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1\n#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2\n#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3\n#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4\n#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5\n#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6\n#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7\n#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8\n#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9\n#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA\n#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB\n#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC\n#define GL_OUTPUT_FOG_EXT 0x87BD\n#define GL_SCALAR_EXT 0x87BE\n#define GL_VECTOR_EXT 0x87BF\n#define GL_MATRIX_EXT 0x87C0\n#define GL_VARIANT_EXT 0x87C1\n#define GL_INVARIANT_EXT 0x87C2\n#define GL_LOCAL_CONSTANT_EXT 0x87C3\n#define GL_LOCAL_EXT 0x87C4\n#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5\n#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6\n#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7\n#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8\n#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE\n#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF\n#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0\n#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1\n#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2\n#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3\n#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4\n#define GL_X_EXT 0x87D5\n#define GL_Y_EXT 0x87D6\n#define GL_Z_EXT 0x87D7\n#define GL_W_EXT 0x87D8\n#define GL_NEGATIVE_X_EXT 0x87D9\n#define GL_NEGATIVE_Y_EXT 0x87DA\n#define GL_NEGATIVE_Z_EXT 0x87DB\n#define GL_NEGATIVE_W_EXT 0x87DC\n#define GL_ZERO_EXT 0x87DD\n#define GL_ONE_EXT 0x87DE\n#define GL_NEGATIVE_ONE_EXT 0x87DF\n#define GL_NORMALIZED_RANGE_EXT 0x87E0\n#define GL_FULL_RANGE_EXT 0x87E1\n#define GL_CURRENT_VERTEX_EXT 0x87E2\n#define GL_MVP_MATRIX_EXT 0x87E3\n#define GL_VARIANT_VALUE_EXT 0x87E4\n#define GL_VARIANT_DATATYPE_EXT 0x87E5\n#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6\n#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7\n#define GL_VARIANT_ARRAY_EXT 0x87E8\n#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9\n#define GL_INVARIANT_VALUE_EXT 0x87EA\n#define GL_INVARIANT_DATATYPE_EXT 0x87EB\n#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC\n#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED\n\ntypedef void (GLAPIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void);\ntypedef GLuint (GLAPIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);\ntypedef GLuint (GLAPIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);\ntypedef GLuint (GLAPIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value);\ntypedef GLuint (GLAPIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);\ntypedef GLuint (GLAPIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);\ntypedef GLuint (GLAPIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components);\ntypedef GLuint (GLAPIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);\ntypedef void (GLAPIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\ntypedef void (GLAPIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\ntypedef void (GLAPIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\ntypedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\ntypedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\ntypedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid **data);\ntypedef void (GLAPIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);\ntypedef GLboolean (GLAPIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);\ntypedef void (GLAPIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr);\ntypedef void (GLAPIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr);\ntypedef void (GLAPIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);\ntypedef void (GLAPIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);\ntypedef void (GLAPIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);\ntypedef void (GLAPIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\ntypedef void (GLAPIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, GLvoid *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, GLbyte *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, GLdouble *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, GLfloat *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, GLint *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, GLshort *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, GLubyte *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, GLuint *addr);\ntypedef void (GLAPIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, GLushort *addr);\ntypedef void (GLAPIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\n\n#define glBeginVertexShaderEXT GLEW_GET_FUN(__glewBeginVertexShaderEXT)\n#define glBindLightParameterEXT GLEW_GET_FUN(__glewBindLightParameterEXT)\n#define glBindMaterialParameterEXT GLEW_GET_FUN(__glewBindMaterialParameterEXT)\n#define glBindParameterEXT GLEW_GET_FUN(__glewBindParameterEXT)\n#define glBindTexGenParameterEXT GLEW_GET_FUN(__glewBindTexGenParameterEXT)\n#define glBindTextureUnitParameterEXT GLEW_GET_FUN(__glewBindTextureUnitParameterEXT)\n#define glBindVertexShaderEXT GLEW_GET_FUN(__glewBindVertexShaderEXT)\n#define glDeleteVertexShaderEXT GLEW_GET_FUN(__glewDeleteVertexShaderEXT)\n#define glDisableVariantClientStateEXT GLEW_GET_FUN(__glewDisableVariantClientStateEXT)\n#define glEnableVariantClientStateEXT GLEW_GET_FUN(__glewEnableVariantClientStateEXT)\n#define glEndVertexShaderEXT GLEW_GET_FUN(__glewEndVertexShaderEXT)\n#define glExtractComponentEXT GLEW_GET_FUN(__glewExtractComponentEXT)\n#define glGenSymbolsEXT GLEW_GET_FUN(__glewGenSymbolsEXT)\n#define glGenVertexShadersEXT GLEW_GET_FUN(__glewGenVertexShadersEXT)\n#define glGetInvariantBooleanvEXT GLEW_GET_FUN(__glewGetInvariantBooleanvEXT)\n#define glGetInvariantFloatvEXT GLEW_GET_FUN(__glewGetInvariantFloatvEXT)\n#define glGetInvariantIntegervEXT GLEW_GET_FUN(__glewGetInvariantIntegervEXT)\n#define glGetLocalConstantBooleanvEXT GLEW_GET_FUN(__glewGetLocalConstantBooleanvEXT)\n#define glGetLocalConstantFloatvEXT GLEW_GET_FUN(__glewGetLocalConstantFloatvEXT)\n#define glGetLocalConstantIntegervEXT GLEW_GET_FUN(__glewGetLocalConstantIntegervEXT)\n#define glGetVariantBooleanvEXT GLEW_GET_FUN(__glewGetVariantBooleanvEXT)\n#define glGetVariantFloatvEXT GLEW_GET_FUN(__glewGetVariantFloatvEXT)\n#define glGetVariantIntegervEXT GLEW_GET_FUN(__glewGetVariantIntegervEXT)\n#define glGetVariantPointervEXT GLEW_GET_FUN(__glewGetVariantPointervEXT)\n#define glInsertComponentEXT GLEW_GET_FUN(__glewInsertComponentEXT)\n#define glIsVariantEnabledEXT GLEW_GET_FUN(__glewIsVariantEnabledEXT)\n#define glSetInvariantEXT GLEW_GET_FUN(__glewSetInvariantEXT)\n#define glSetLocalConstantEXT GLEW_GET_FUN(__glewSetLocalConstantEXT)\n#define glShaderOp1EXT GLEW_GET_FUN(__glewShaderOp1EXT)\n#define glShaderOp2EXT GLEW_GET_FUN(__glewShaderOp2EXT)\n#define glShaderOp3EXT GLEW_GET_FUN(__glewShaderOp3EXT)\n#define glSwizzleEXT GLEW_GET_FUN(__glewSwizzleEXT)\n#define glVariantPointerEXT GLEW_GET_FUN(__glewVariantPointerEXT)\n#define glVariantbvEXT GLEW_GET_FUN(__glewVariantbvEXT)\n#define glVariantdvEXT GLEW_GET_FUN(__glewVariantdvEXT)\n#define glVariantfvEXT GLEW_GET_FUN(__glewVariantfvEXT)\n#define glVariantivEXT GLEW_GET_FUN(__glewVariantivEXT)\n#define glVariantsvEXT GLEW_GET_FUN(__glewVariantsvEXT)\n#define glVariantubvEXT GLEW_GET_FUN(__glewVariantubvEXT)\n#define glVariantuivEXT GLEW_GET_FUN(__glewVariantuivEXT)\n#define glVariantusvEXT GLEW_GET_FUN(__glewVariantusvEXT)\n#define glWriteMaskEXT GLEW_GET_FUN(__glewWriteMaskEXT)\n\n#define GLEW_EXT_vertex_shader GLEW_GET_VAR(__GLEW_EXT_vertex_shader)\n\n#endif /* GL_EXT_vertex_shader */\n\n/* ------------------------ GL_EXT_vertex_weighting ------------------------ */\n\n#ifndef GL_EXT_vertex_weighting\n#define GL_EXT_vertex_weighting 1\n\n#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3\n#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6\n#define GL_MODELVIEW0_EXT 0x1700\n#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502\n#define GL_MODELVIEW1_MATRIX_EXT 0x8506\n#define GL_VERTEX_WEIGHTING_EXT 0x8509\n#define GL_MODELVIEW1_EXT 0x850A\n#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B\n#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C\n#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D\n#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E\n#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F\n#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510\n\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, void* pointer);\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight);\n\n#define glVertexWeightPointerEXT GLEW_GET_FUN(__glewVertexWeightPointerEXT)\n#define glVertexWeightfEXT GLEW_GET_FUN(__glewVertexWeightfEXT)\n#define glVertexWeightfvEXT GLEW_GET_FUN(__glewVertexWeightfvEXT)\n\n#define GLEW_EXT_vertex_weighting GLEW_GET_VAR(__GLEW_EXT_vertex_weighting)\n\n#endif /* GL_EXT_vertex_weighting */\n\n/* ------------------------- GL_EXT_x11_sync_object ------------------------ */\n\n#ifndef GL_EXT_x11_sync_object\n#define GL_EXT_x11_sync_object 1\n\n#define GL_SYNC_X11_FENCE_EXT 0x90E1\n\ntypedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);\n\n#define glImportSyncEXT GLEW_GET_FUN(__glewImportSyncEXT)\n\n#define GLEW_EXT_x11_sync_object GLEW_GET_VAR(__GLEW_EXT_x11_sync_object)\n\n#endif /* GL_EXT_x11_sync_object */\n\n/* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */\n\n#ifndef GL_GREMEDY_frame_terminator\n#define GL_GREMEDY_frame_terminator 1\n\ntypedef void (GLAPIENTRY * PFNGLFRAMETERMINATORGREMEDYPROC) (void);\n\n#define glFrameTerminatorGREMEDY GLEW_GET_FUN(__glewFrameTerminatorGREMEDY)\n\n#define GLEW_GREMEDY_frame_terminator GLEW_GET_VAR(__GLEW_GREMEDY_frame_terminator)\n\n#endif /* GL_GREMEDY_frame_terminator */\n\n/* ------------------------ GL_GREMEDY_string_marker ----------------------- */\n\n#ifndef GL_GREMEDY_string_marker\n#define GL_GREMEDY_string_marker 1\n\ntypedef void (GLAPIENTRY * PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void* string);\n\n#define glStringMarkerGREMEDY GLEW_GET_FUN(__glewStringMarkerGREMEDY)\n\n#define GLEW_GREMEDY_string_marker GLEW_GET_VAR(__GLEW_GREMEDY_string_marker)\n\n#endif /* GL_GREMEDY_string_marker */\n\n/* --------------------- GL_HP_convolution_border_modes -------------------- */\n\n#ifndef GL_HP_convolution_border_modes\n#define GL_HP_convolution_border_modes 1\n\n#define GLEW_HP_convolution_border_modes GLEW_GET_VAR(__GLEW_HP_convolution_border_modes)\n\n#endif /* GL_HP_convolution_border_modes */\n\n/* ------------------------- GL_HP_image_transform ------------------------- */\n\n#ifndef GL_HP_image_transform\n#define GL_HP_image_transform 1\n\ntypedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param);\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params);\n\n#define glGetImageTransformParameterfvHP GLEW_GET_FUN(__glewGetImageTransformParameterfvHP)\n#define glGetImageTransformParameterivHP GLEW_GET_FUN(__glewGetImageTransformParameterivHP)\n#define glImageTransformParameterfHP GLEW_GET_FUN(__glewImageTransformParameterfHP)\n#define glImageTransformParameterfvHP GLEW_GET_FUN(__glewImageTransformParameterfvHP)\n#define glImageTransformParameteriHP GLEW_GET_FUN(__glewImageTransformParameteriHP)\n#define glImageTransformParameterivHP GLEW_GET_FUN(__glewImageTransformParameterivHP)\n\n#define GLEW_HP_image_transform GLEW_GET_VAR(__GLEW_HP_image_transform)\n\n#endif /* GL_HP_image_transform */\n\n/* -------------------------- GL_HP_occlusion_test ------------------------- */\n\n#ifndef GL_HP_occlusion_test\n#define GL_HP_occlusion_test 1\n\n#define GL_OCCLUSION_TEST_HP 0x8165\n#define GL_OCCLUSION_TEST_RESULT_HP 0x8166\n\n#define GLEW_HP_occlusion_test GLEW_GET_VAR(__GLEW_HP_occlusion_test)\n\n#endif /* GL_HP_occlusion_test */\n\n/* ------------------------- GL_HP_texture_lighting ------------------------ */\n\n#ifndef GL_HP_texture_lighting\n#define GL_HP_texture_lighting 1\n\n#define GLEW_HP_texture_lighting GLEW_GET_VAR(__GLEW_HP_texture_lighting)\n\n#endif /* GL_HP_texture_lighting */\n\n/* --------------------------- GL_IBM_cull_vertex -------------------------- */\n\n#ifndef GL_IBM_cull_vertex\n#define GL_IBM_cull_vertex 1\n\n#define GL_CULL_VERTEX_IBM 103050\n\n#define GLEW_IBM_cull_vertex GLEW_GET_VAR(__GLEW_IBM_cull_vertex)\n\n#endif /* GL_IBM_cull_vertex */\n\n/* ---------------------- GL_IBM_multimode_draw_arrays --------------------- */\n\n#ifndef GL_IBM_multimode_draw_arrays\n#define GL_IBM_multimode_draw_arrays 1\n\ntypedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum* mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);\ntypedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum* mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride);\n\n#define glMultiModeDrawArraysIBM GLEW_GET_FUN(__glewMultiModeDrawArraysIBM)\n#define glMultiModeDrawElementsIBM GLEW_GET_FUN(__glewMultiModeDrawElementsIBM)\n\n#define GLEW_IBM_multimode_draw_arrays GLEW_GET_VAR(__GLEW_IBM_multimode_draw_arrays)\n\n#endif /* GL_IBM_multimode_draw_arrays */\n\n/* ------------------------- GL_IBM_rasterpos_clip ------------------------- */\n\n#ifndef GL_IBM_rasterpos_clip\n#define GL_IBM_rasterpos_clip 1\n\n#define GL_RASTER_POSITION_UNCLIPPED_IBM 103010\n\n#define GLEW_IBM_rasterpos_clip GLEW_GET_VAR(__GLEW_IBM_rasterpos_clip)\n\n#endif /* GL_IBM_rasterpos_clip */\n\n/* --------------------------- GL_IBM_static_data -------------------------- */\n\n#ifndef GL_IBM_static_data\n#define GL_IBM_static_data 1\n\n#define GL_ALL_STATIC_DATA_IBM 103060\n#define GL_STATIC_VERTEX_ARRAY_IBM 103061\n\n#define GLEW_IBM_static_data GLEW_GET_VAR(__GLEW_IBM_static_data)\n\n#endif /* GL_IBM_static_data */\n\n/* --------------------- GL_IBM_texture_mirrored_repeat -------------------- */\n\n#ifndef GL_IBM_texture_mirrored_repeat\n#define GL_IBM_texture_mirrored_repeat 1\n\n#define GL_MIRRORED_REPEAT_IBM 0x8370\n\n#define GLEW_IBM_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_IBM_texture_mirrored_repeat)\n\n#endif /* GL_IBM_texture_mirrored_repeat */\n\n/* ----------------------- GL_IBM_vertex_array_lists ----------------------- */\n\n#ifndef GL_IBM_vertex_array_lists\n#define GL_IBM_vertex_array_lists 1\n\n#define GL_VERTEX_ARRAY_LIST_IBM 103070\n#define GL_NORMAL_ARRAY_LIST_IBM 103071\n#define GL_COLOR_ARRAY_LIST_IBM 103072\n#define GL_INDEX_ARRAY_LIST_IBM 103073\n#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074\n#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075\n#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076\n#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077\n#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080\n#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081\n#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082\n#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083\n#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084\n#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085\n#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086\n#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087\n\ntypedef void (GLAPIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\ntypedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\n\n#define glColorPointerListIBM GLEW_GET_FUN(__glewColorPointerListIBM)\n#define glEdgeFlagPointerListIBM GLEW_GET_FUN(__glewEdgeFlagPointerListIBM)\n#define glFogCoordPointerListIBM GLEW_GET_FUN(__glewFogCoordPointerListIBM)\n#define glIndexPointerListIBM GLEW_GET_FUN(__glewIndexPointerListIBM)\n#define glNormalPointerListIBM GLEW_GET_FUN(__glewNormalPointerListIBM)\n#define glSecondaryColorPointerListIBM GLEW_GET_FUN(__glewSecondaryColorPointerListIBM)\n#define glTexCoordPointerListIBM GLEW_GET_FUN(__glewTexCoordPointerListIBM)\n#define glVertexPointerListIBM GLEW_GET_FUN(__glewVertexPointerListIBM)\n\n#define GLEW_IBM_vertex_array_lists GLEW_GET_VAR(__GLEW_IBM_vertex_array_lists)\n\n#endif /* GL_IBM_vertex_array_lists */\n\n/* -------------------------- GL_INGR_color_clamp -------------------------- */\n\n#ifndef GL_INGR_color_clamp\n#define GL_INGR_color_clamp 1\n\n#define GL_RED_MIN_CLAMP_INGR 0x8560\n#define GL_GREEN_MIN_CLAMP_INGR 0x8561\n#define GL_BLUE_MIN_CLAMP_INGR 0x8562\n#define GL_ALPHA_MIN_CLAMP_INGR 0x8563\n#define GL_RED_MAX_CLAMP_INGR 0x8564\n#define GL_GREEN_MAX_CLAMP_INGR 0x8565\n#define GL_BLUE_MAX_CLAMP_INGR 0x8566\n#define GL_ALPHA_MAX_CLAMP_INGR 0x8567\n\n#define GLEW_INGR_color_clamp GLEW_GET_VAR(__GLEW_INGR_color_clamp)\n\n#endif /* GL_INGR_color_clamp */\n\n/* ------------------------- GL_INGR_interlace_read ------------------------ */\n\n#ifndef GL_INGR_interlace_read\n#define GL_INGR_interlace_read 1\n\n#define GL_INTERLACE_READ_INGR 0x8568\n\n#define GLEW_INGR_interlace_read GLEW_GET_VAR(__GLEW_INGR_interlace_read)\n\n#endif /* GL_INGR_interlace_read */\n\n/* ------------------------ GL_INTEL_parallel_arrays ----------------------- */\n\n#ifndef GL_INTEL_parallel_arrays\n#define GL_INTEL_parallel_arrays 1\n\n#define GL_PARALLEL_ARRAYS_INTEL 0x83F4\n#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5\n#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6\n#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7\n#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8\n\ntypedef void (GLAPIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);\ntypedef void (GLAPIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);\ntypedef void (GLAPIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);\n\n#define glColorPointervINTEL GLEW_GET_FUN(__glewColorPointervINTEL)\n#define glNormalPointervINTEL GLEW_GET_FUN(__glewNormalPointervINTEL)\n#define glTexCoordPointervINTEL GLEW_GET_FUN(__glewTexCoordPointervINTEL)\n#define glVertexPointervINTEL GLEW_GET_FUN(__glewVertexPointervINTEL)\n\n#define GLEW_INTEL_parallel_arrays GLEW_GET_VAR(__GLEW_INTEL_parallel_arrays)\n\n#endif /* GL_INTEL_parallel_arrays */\n\n/* ------------------------ GL_INTEL_texture_scissor ----------------------- */\n\n#ifndef GL_INTEL_texture_scissor\n#define GL_INTEL_texture_scissor 1\n\ntypedef void (GLAPIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc);\ntypedef void (GLAPIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh);\n\n#define glTexScissorFuncINTEL GLEW_GET_FUN(__glewTexScissorFuncINTEL)\n#define glTexScissorINTEL GLEW_GET_FUN(__glewTexScissorINTEL)\n\n#define GLEW_INTEL_texture_scissor GLEW_GET_VAR(__GLEW_INTEL_texture_scissor)\n\n#endif /* GL_INTEL_texture_scissor */\n\n/* ------------------------------ GL_KHR_debug ----------------------------- */\n\n#ifndef GL_KHR_debug\n#define GL_KHR_debug 1\n\n#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002\n#define GL_STACK_OVERFLOW 0x0503\n#define GL_STACK_UNDERFLOW 0x0504\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243\n#define GL_DEBUG_CALLBACK_FUNCTION 0x8244\n#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245\n#define GL_DEBUG_SOURCE_API 0x8246\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247\n#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248\n#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249\n#define GL_DEBUG_SOURCE_APPLICATION 0x824A\n#define GL_DEBUG_SOURCE_OTHER 0x824B\n#define GL_DEBUG_TYPE_ERROR 0x824C\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E\n#define GL_DEBUG_TYPE_PORTABILITY 0x824F\n#define GL_DEBUG_TYPE_PERFORMANCE 0x8250\n#define GL_DEBUG_TYPE_OTHER 0x8251\n#define GL_DEBUG_TYPE_MARKER 0x8268\n#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269\n#define GL_DEBUG_TYPE_POP_GROUP 0x826A\n#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B\n#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C\n#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D\n#define GL_BUFFER 0x82E0\n#define GL_SHADER 0x82E1\n#define GL_PROGRAM 0x82E2\n#define GL_QUERY 0x82E3\n#define GL_PROGRAM_PIPELINE 0x82E4\n#define GL_SAMPLER 0x82E6\n#define GL_DISPLAY_LIST 0x82E7\n#define GL_MAX_LABEL_LENGTH 0x82E8\n#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143\n#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144\n#define GL_DEBUG_LOGGED_MESSAGES 0x9145\n#define GL_DEBUG_SEVERITY_HIGH 0x9146\n#define GL_DEBUG_SEVERITY_MEDIUM 0x9147\n#define GL_DEBUG_SEVERITY_LOW 0x9148\n#define GL_DEBUG_OUTPUT 0x92E0\n\ntypedef void (APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);\n\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, void* userParam);\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);\ntypedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar *label);\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABELPROC) (void* ptr, GLsizei bufSize, GLsizei* length, GLchar *label);\ntypedef void (GLAPIENTRY * PFNGLGETPOINTERVPROC) (GLenum pname, void** params);\ntypedef void (GLAPIENTRY * PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label);\ntypedef void (GLAPIENTRY * PFNGLOBJECTPTRLABELPROC) (void* ptr, GLsizei length, const GLchar* label);\ntypedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar * message);\n\n#define glDebugMessageCallback GLEW_GET_FUN(__glewDebugMessageCallback)\n#define glDebugMessageControl GLEW_GET_FUN(__glewDebugMessageControl)\n#define glDebugMessageInsert GLEW_GET_FUN(__glewDebugMessageInsert)\n#define glGetDebugMessageLog GLEW_GET_FUN(__glewGetDebugMessageLog)\n#define glGetObjectLabel GLEW_GET_FUN(__glewGetObjectLabel)\n#define glGetObjectPtrLabel GLEW_GET_FUN(__glewGetObjectPtrLabel)\n#define glGetPointerv GLEW_GET_FUN(__glewGetPointerv)\n#define glObjectLabel GLEW_GET_FUN(__glewObjectLabel)\n#define glObjectPtrLabel GLEW_GET_FUN(__glewObjectPtrLabel)\n#define glPushDebugGroup GLEW_GET_FUN(__glewPushDebugGroup)\n\n#define GLEW_KHR_debug GLEW_GET_VAR(__GLEW_KHR_debug)\n\n#endif /* GL_KHR_debug */\n\n/* ------------------ GL_KHR_texture_compression_astc_ldr ------------------ */\n\n#ifndef GL_KHR_texture_compression_astc_ldr\n#define GL_KHR_texture_compression_astc_ldr 1\n\n#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0\n#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1\n#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2\n#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3\n#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4\n#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5\n#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6\n#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7\n#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8\n#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9\n#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA\n#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB\n#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC\n#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD\n\n#define GLEW_KHR_texture_compression_astc_ldr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_ldr)\n\n#endif /* GL_KHR_texture_compression_astc_ldr */\n\n/* -------------------------- GL_KTX_buffer_region ------------------------- */\n\n#ifndef GL_KTX_buffer_region\n#define GL_KTX_buffer_region 1\n\n#define GL_KTX_FRONT_REGION 0x0\n#define GL_KTX_BACK_REGION 0x1\n#define GL_KTX_Z_REGION 0x2\n#define GL_KTX_STENCIL_REGION 0x3\n\ntypedef GLuint (GLAPIENTRY * PFNGLBUFFERREGIONENABLEDPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERREGIONPROC) (GLenum region);\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height, GLint xDest, GLint yDest);\ntypedef GLuint (GLAPIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum region);\ntypedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height);\n\n#define glBufferRegionEnabled GLEW_GET_FUN(__glewBufferRegionEnabled)\n#define glDeleteBufferRegion GLEW_GET_FUN(__glewDeleteBufferRegion)\n#define glDrawBufferRegion GLEW_GET_FUN(__glewDrawBufferRegion)\n#define glNewBufferRegion GLEW_GET_FUN(__glewNewBufferRegion)\n#define glReadBufferRegion GLEW_GET_FUN(__glewReadBufferRegion)\n\n#define GLEW_KTX_buffer_region GLEW_GET_VAR(__GLEW_KTX_buffer_region)\n\n#endif /* GL_KTX_buffer_region */\n\n/* ------------------------- GL_MESAX_texture_stack ------------------------ */\n\n#ifndef GL_MESAX_texture_stack\n#define GL_MESAX_texture_stack 1\n\n#define GL_TEXTURE_1D_STACK_MESAX 0x8759\n#define GL_TEXTURE_2D_STACK_MESAX 0x875A\n#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B\n#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C\n#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D\n#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E\n\n#define GLEW_MESAX_texture_stack GLEW_GET_VAR(__GLEW_MESAX_texture_stack)\n\n#endif /* GL_MESAX_texture_stack */\n\n/* -------------------------- GL_MESA_pack_invert -------------------------- */\n\n#ifndef GL_MESA_pack_invert\n#define GL_MESA_pack_invert 1\n\n#define GL_PACK_INVERT_MESA 0x8758\n\n#define GLEW_MESA_pack_invert GLEW_GET_VAR(__GLEW_MESA_pack_invert)\n\n#endif /* GL_MESA_pack_invert */\n\n/* ------------------------- GL_MESA_resize_buffers ------------------------ */\n\n#ifndef GL_MESA_resize_buffers\n#define GL_MESA_resize_buffers 1\n\ntypedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void);\n\n#define glResizeBuffersMESA GLEW_GET_FUN(__glewResizeBuffersMESA)\n\n#define GLEW_MESA_resize_buffers GLEW_GET_VAR(__GLEW_MESA_resize_buffers)\n\n#endif /* GL_MESA_resize_buffers */\n\n/* --------------------------- GL_MESA_window_pos -------------------------- */\n\n#ifndef GL_MESA_window_pos\n#define GL_MESA_window_pos 1\n\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint* p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p);\n\n#define glWindowPos2dMESA GLEW_GET_FUN(__glewWindowPos2dMESA)\n#define glWindowPos2dvMESA GLEW_GET_FUN(__glewWindowPos2dvMESA)\n#define glWindowPos2fMESA GLEW_GET_FUN(__glewWindowPos2fMESA)\n#define glWindowPos2fvMESA GLEW_GET_FUN(__glewWindowPos2fvMESA)\n#define glWindowPos2iMESA GLEW_GET_FUN(__glewWindowPos2iMESA)\n#define glWindowPos2ivMESA GLEW_GET_FUN(__glewWindowPos2ivMESA)\n#define glWindowPos2sMESA GLEW_GET_FUN(__glewWindowPos2sMESA)\n#define glWindowPos2svMESA GLEW_GET_FUN(__glewWindowPos2svMESA)\n#define glWindowPos3dMESA GLEW_GET_FUN(__glewWindowPos3dMESA)\n#define glWindowPos3dvMESA GLEW_GET_FUN(__glewWindowPos3dvMESA)\n#define glWindowPos3fMESA GLEW_GET_FUN(__glewWindowPos3fMESA)\n#define glWindowPos3fvMESA GLEW_GET_FUN(__glewWindowPos3fvMESA)\n#define glWindowPos3iMESA GLEW_GET_FUN(__glewWindowPos3iMESA)\n#define glWindowPos3ivMESA GLEW_GET_FUN(__glewWindowPos3ivMESA)\n#define glWindowPos3sMESA GLEW_GET_FUN(__glewWindowPos3sMESA)\n#define glWindowPos3svMESA GLEW_GET_FUN(__glewWindowPos3svMESA)\n#define glWindowPos4dMESA GLEW_GET_FUN(__glewWindowPos4dMESA)\n#define glWindowPos4dvMESA GLEW_GET_FUN(__glewWindowPos4dvMESA)\n#define glWindowPos4fMESA GLEW_GET_FUN(__glewWindowPos4fMESA)\n#define glWindowPos4fvMESA GLEW_GET_FUN(__glewWindowPos4fvMESA)\n#define glWindowPos4iMESA GLEW_GET_FUN(__glewWindowPos4iMESA)\n#define glWindowPos4ivMESA GLEW_GET_FUN(__glewWindowPos4ivMESA)\n#define glWindowPos4sMESA GLEW_GET_FUN(__glewWindowPos4sMESA)\n#define glWindowPos4svMESA GLEW_GET_FUN(__glewWindowPos4svMESA)\n\n#define GLEW_MESA_window_pos GLEW_GET_VAR(__GLEW_MESA_window_pos)\n\n#endif /* GL_MESA_window_pos */\n\n/* ------------------------- GL_MESA_ycbcr_texture ------------------------- */\n\n#ifndef GL_MESA_ycbcr_texture\n#define GL_MESA_ycbcr_texture 1\n\n#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA\n#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB\n#define GL_YCBCR_MESA 0x8757\n\n#define GLEW_MESA_ycbcr_texture GLEW_GET_VAR(__GLEW_MESA_ycbcr_texture)\n\n#endif /* GL_MESA_ycbcr_texture */\n\n/* ------------------------- GL_NVX_gpu_memory_info ------------------------ */\n\n#ifndef GL_NVX_gpu_memory_info\n#define GL_NVX_gpu_memory_info 1\n\n#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047\n#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048\n#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049\n#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A\n#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B\n\n#define GLEW_NVX_gpu_memory_info GLEW_GET_VAR(__GLEW_NVX_gpu_memory_info)\n\n#endif /* GL_NVX_gpu_memory_info */\n\n/* ------------------------- GL_NV_bindless_texture ------------------------ */\n\n#ifndef GL_NV_bindless_texture\n#define GL_NV_bindless_texture 1\n\ntypedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\ntypedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);\ntypedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);\ntypedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);\ntypedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);\ntypedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);\ntypedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);\ntypedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);\ntypedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64* value);\n\n#define glGetImageHandleNV GLEW_GET_FUN(__glewGetImageHandleNV)\n#define glGetTextureHandleNV GLEW_GET_FUN(__glewGetTextureHandleNV)\n#define glGetTextureSamplerHandleNV GLEW_GET_FUN(__glewGetTextureSamplerHandleNV)\n#define glIsImageHandleResidentNV GLEW_GET_FUN(__glewIsImageHandleResidentNV)\n#define glIsTextureHandleResidentNV GLEW_GET_FUN(__glewIsTextureHandleResidentNV)\n#define glMakeImageHandleNonResidentNV GLEW_GET_FUN(__glewMakeImageHandleNonResidentNV)\n#define glMakeImageHandleResidentNV GLEW_GET_FUN(__glewMakeImageHandleResidentNV)\n#define glMakeTextureHandleNonResidentNV GLEW_GET_FUN(__glewMakeTextureHandleNonResidentNV)\n#define glMakeTextureHandleResidentNV GLEW_GET_FUN(__glewMakeTextureHandleResidentNV)\n#define glProgramUniformHandleui64NV GLEW_GET_FUN(__glewProgramUniformHandleui64NV)\n#define glProgramUniformHandleui64vNV GLEW_GET_FUN(__glewProgramUniformHandleui64vNV)\n#define glUniformHandleui64NV GLEW_GET_FUN(__glewUniformHandleui64NV)\n#define glUniformHandleui64vNV GLEW_GET_FUN(__glewUniformHandleui64vNV)\n\n#define GLEW_NV_bindless_texture GLEW_GET_VAR(__GLEW_NV_bindless_texture)\n\n#endif /* GL_NV_bindless_texture */\n\n/* --------------------------- GL_NV_blend_square -------------------------- */\n\n#ifndef GL_NV_blend_square\n#define GL_NV_blend_square 1\n\n#define GLEW_NV_blend_square GLEW_GET_VAR(__GLEW_NV_blend_square)\n\n#endif /* GL_NV_blend_square */\n\n/* ------------------------ GL_NV_conditional_render ----------------------- */\n\n#ifndef GL_NV_conditional_render\n#define GL_NV_conditional_render 1\n\n#define GL_QUERY_WAIT_NV 0x8E13\n#define GL_QUERY_NO_WAIT_NV 0x8E14\n#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15\n#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16\n\ntypedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVPROC) (void);\n\n#define glBeginConditionalRenderNV GLEW_GET_FUN(__glewBeginConditionalRenderNV)\n#define glEndConditionalRenderNV GLEW_GET_FUN(__glewEndConditionalRenderNV)\n\n#define GLEW_NV_conditional_render GLEW_GET_VAR(__GLEW_NV_conditional_render)\n\n#endif /* GL_NV_conditional_render */\n\n/* ----------------------- GL_NV_copy_depth_to_color ----------------------- */\n\n#ifndef GL_NV_copy_depth_to_color\n#define GL_NV_copy_depth_to_color 1\n\n#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E\n#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F\n\n#define GLEW_NV_copy_depth_to_color GLEW_GET_VAR(__GLEW_NV_copy_depth_to_color)\n\n#endif /* GL_NV_copy_depth_to_color */\n\n/* ---------------------------- GL_NV_copy_image --------------------------- */\n\n#ifndef GL_NV_copy_image\n#define GL_NV_copy_image 1\n\ntypedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define glCopyImageSubDataNV GLEW_GET_FUN(__glewCopyImageSubDataNV)\n\n#define GLEW_NV_copy_image GLEW_GET_VAR(__GLEW_NV_copy_image)\n\n#endif /* GL_NV_copy_image */\n\n/* ------------------------ GL_NV_depth_buffer_float ----------------------- */\n\n#ifndef GL_NV_depth_buffer_float\n#define GL_NV_depth_buffer_float 1\n\n#define GL_DEPTH_COMPONENT32F_NV 0x8DAB\n#define GL_DEPTH32F_STENCIL8_NV 0x8DAC\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD\n#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF\n\ntypedef void (GLAPIENTRY * PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);\ntypedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);\n\n#define glClearDepthdNV GLEW_GET_FUN(__glewClearDepthdNV)\n#define glDepthBoundsdNV GLEW_GET_FUN(__glewDepthBoundsdNV)\n#define glDepthRangedNV GLEW_GET_FUN(__glewDepthRangedNV)\n\n#define GLEW_NV_depth_buffer_float GLEW_GET_VAR(__GLEW_NV_depth_buffer_float)\n\n#endif /* GL_NV_depth_buffer_float */\n\n/* --------------------------- GL_NV_depth_clamp --------------------------- */\n\n#ifndef GL_NV_depth_clamp\n#define GL_NV_depth_clamp 1\n\n#define GL_DEPTH_CLAMP_NV 0x864F\n\n#define GLEW_NV_depth_clamp GLEW_GET_VAR(__GLEW_NV_depth_clamp)\n\n#endif /* GL_NV_depth_clamp */\n\n/* ---------------------- GL_NV_depth_range_unclamped ---------------------- */\n\n#ifndef GL_NV_depth_range_unclamped\n#define GL_NV_depth_range_unclamped 1\n\n#define GL_SAMPLE_COUNT_BITS_NV 0x8864\n#define GL_CURRENT_SAMPLE_COUNT_QUERY_NV 0x8865\n#define GL_QUERY_RESULT_NV 0x8866\n#define GL_QUERY_RESULT_AVAILABLE_NV 0x8867\n#define GL_SAMPLE_COUNT_NV 0x8914\n\n#define GLEW_NV_depth_range_unclamped GLEW_GET_VAR(__GLEW_NV_depth_range_unclamped)\n\n#endif /* GL_NV_depth_range_unclamped */\n\n/* ---------------------------- GL_NV_evaluators --------------------------- */\n\n#ifndef GL_NV_evaluators\n#define GL_NV_evaluators 1\n\n#define GL_EVAL_2D_NV 0x86C0\n#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1\n#define GL_MAP_TESSELLATION_NV 0x86C2\n#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3\n#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4\n#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5\n#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6\n#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7\n#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8\n#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9\n#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA\n#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB\n#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC\n#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD\n#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE\n#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF\n#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0\n#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1\n#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2\n#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3\n#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4\n#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5\n#define GL_MAX_MAP_TESSELLATION_NV 0x86D6\n#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7\n\ntypedef void (GLAPIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void* points);\ntypedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void* points);\ntypedef void (GLAPIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint* params);\n\n#define glEvalMapsNV GLEW_GET_FUN(__glewEvalMapsNV)\n#define glGetMapAttribParameterfvNV GLEW_GET_FUN(__glewGetMapAttribParameterfvNV)\n#define glGetMapAttribParameterivNV GLEW_GET_FUN(__glewGetMapAttribParameterivNV)\n#define glGetMapControlPointsNV GLEW_GET_FUN(__glewGetMapControlPointsNV)\n#define glGetMapParameterfvNV GLEW_GET_FUN(__glewGetMapParameterfvNV)\n#define glGetMapParameterivNV GLEW_GET_FUN(__glewGetMapParameterivNV)\n#define glMapControlPointsNV GLEW_GET_FUN(__glewMapControlPointsNV)\n#define glMapParameterfvNV GLEW_GET_FUN(__glewMapParameterfvNV)\n#define glMapParameterivNV GLEW_GET_FUN(__glewMapParameterivNV)\n\n#define GLEW_NV_evaluators GLEW_GET_VAR(__GLEW_NV_evaluators)\n\n#endif /* GL_NV_evaluators */\n\n/* ----------------------- GL_NV_explicit_multisample ---------------------- */\n\n#ifndef GL_NV_explicit_multisample\n#define GL_NV_explicit_multisample 1\n\n#define GL_SAMPLE_POSITION_NV 0x8E50\n#define GL_SAMPLE_MASK_NV 0x8E51\n#define GL_SAMPLE_MASK_VALUE_NV 0x8E52\n#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53\n#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54\n#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55\n#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56\n#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57\n#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58\n#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59\n\ntypedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat* val);\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);\ntypedef void (GLAPIENTRY * PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);\n\n#define glGetMultisamplefvNV GLEW_GET_FUN(__glewGetMultisamplefvNV)\n#define glSampleMaskIndexedNV GLEW_GET_FUN(__glewSampleMaskIndexedNV)\n#define glTexRenderbufferNV GLEW_GET_FUN(__glewTexRenderbufferNV)\n\n#define GLEW_NV_explicit_multisample GLEW_GET_VAR(__GLEW_NV_explicit_multisample)\n\n#endif /* GL_NV_explicit_multisample */\n\n/* ------------------------------ GL_NV_fence ------------------------------ */\n\n#ifndef GL_NV_fence\n#define GL_NV_fence 1\n\n#define GL_ALL_COMPLETED_NV 0x84F2\n#define GL_FENCE_STATUS_NV 0x84F3\n#define GL_FENCE_CONDITION_NV 0x84F4\n\ntypedef void (GLAPIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint* fences);\ntypedef void (GLAPIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence);\ntypedef void (GLAPIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint* fences);\ntypedef void (GLAPIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISFENCENVPROC) (GLuint fence);\ntypedef void (GLAPIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);\ntypedef GLboolean (GLAPIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence);\n\n#define glDeleteFencesNV GLEW_GET_FUN(__glewDeleteFencesNV)\n#define glFinishFenceNV GLEW_GET_FUN(__glewFinishFenceNV)\n#define glGenFencesNV GLEW_GET_FUN(__glewGenFencesNV)\n#define glGetFenceivNV GLEW_GET_FUN(__glewGetFenceivNV)\n#define glIsFenceNV GLEW_GET_FUN(__glewIsFenceNV)\n#define glSetFenceNV GLEW_GET_FUN(__glewSetFenceNV)\n#define glTestFenceNV GLEW_GET_FUN(__glewTestFenceNV)\n\n#define GLEW_NV_fence GLEW_GET_VAR(__GLEW_NV_fence)\n\n#endif /* GL_NV_fence */\n\n/* --------------------------- GL_NV_float_buffer -------------------------- */\n\n#ifndef GL_NV_float_buffer\n#define GL_NV_float_buffer 1\n\n#define GL_FLOAT_R_NV 0x8880\n#define GL_FLOAT_RG_NV 0x8881\n#define GL_FLOAT_RGB_NV 0x8882\n#define GL_FLOAT_RGBA_NV 0x8883\n#define GL_FLOAT_R16_NV 0x8884\n#define GL_FLOAT_R32_NV 0x8885\n#define GL_FLOAT_RG16_NV 0x8886\n#define GL_FLOAT_RG32_NV 0x8887\n#define GL_FLOAT_RGB16_NV 0x8888\n#define GL_FLOAT_RGB32_NV 0x8889\n#define GL_FLOAT_RGBA16_NV 0x888A\n#define GL_FLOAT_RGBA32_NV 0x888B\n#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C\n#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D\n#define GL_FLOAT_RGBA_MODE_NV 0x888E\n\n#define GLEW_NV_float_buffer GLEW_GET_VAR(__GLEW_NV_float_buffer)\n\n#endif /* GL_NV_float_buffer */\n\n/* --------------------------- GL_NV_fog_distance -------------------------- */\n\n#ifndef GL_NV_fog_distance\n#define GL_NV_fog_distance 1\n\n#define GL_FOG_DISTANCE_MODE_NV 0x855A\n#define GL_EYE_RADIAL_NV 0x855B\n#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C\n\n#define GLEW_NV_fog_distance GLEW_GET_VAR(__GLEW_NV_fog_distance)\n\n#endif /* GL_NV_fog_distance */\n\n/* ------------------------- GL_NV_fragment_program ------------------------ */\n\n#ifndef GL_NV_fragment_program\n#define GL_NV_fragment_program 1\n\n#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868\n#define GL_FRAGMENT_PROGRAM_NV 0x8870\n#define GL_MAX_TEXTURE_COORDS_NV 0x8871\n#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872\n#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873\n#define GL_PROGRAM_ERROR_STRING_NV 0x8874\n\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble *params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLdouble v[]);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLfloat v[]);\n\n#define glGetProgramNamedParameterdvNV GLEW_GET_FUN(__glewGetProgramNamedParameterdvNV)\n#define glGetProgramNamedParameterfvNV GLEW_GET_FUN(__glewGetProgramNamedParameterfvNV)\n#define glProgramNamedParameter4dNV GLEW_GET_FUN(__glewProgramNamedParameter4dNV)\n#define glProgramNamedParameter4dvNV GLEW_GET_FUN(__glewProgramNamedParameter4dvNV)\n#define glProgramNamedParameter4fNV GLEW_GET_FUN(__glewProgramNamedParameter4fNV)\n#define glProgramNamedParameter4fvNV GLEW_GET_FUN(__glewProgramNamedParameter4fvNV)\n\n#define GLEW_NV_fragment_program GLEW_GET_VAR(__GLEW_NV_fragment_program)\n\n#endif /* GL_NV_fragment_program */\n\n/* ------------------------ GL_NV_fragment_program2 ------------------------ */\n\n#ifndef GL_NV_fragment_program2\n#define GL_NV_fragment_program2 1\n\n#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4\n#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5\n#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6\n#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7\n#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8\n\n#define GLEW_NV_fragment_program2 GLEW_GET_VAR(__GLEW_NV_fragment_program2)\n\n#endif /* GL_NV_fragment_program2 */\n\n/* ------------------------ GL_NV_fragment_program4 ------------------------ */\n\n#ifndef GL_NV_fragment_program4\n#define GL_NV_fragment_program4 1\n\n#define GLEW_NV_fragment_program4 GLEW_GET_VAR(__GLEW_NV_fragment_program4)\n\n#endif /* GL_NV_fragment_program4 */\n\n/* --------------------- GL_NV_fragment_program_option --------------------- */\n\n#ifndef GL_NV_fragment_program_option\n#define GL_NV_fragment_program_option 1\n\n#define GLEW_NV_fragment_program_option GLEW_GET_VAR(__GLEW_NV_fragment_program_option)\n\n#endif /* GL_NV_fragment_program_option */\n\n/* ----------------- GL_NV_framebuffer_multisample_coverage ---------------- */\n\n#ifndef GL_NV_framebuffer_multisample_coverage\n#define GL_NV_framebuffer_multisample_coverage 1\n\n#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB\n#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10\n#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11\n#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12\n\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\n\n#define glRenderbufferStorageMultisampleCoverageNV GLEW_GET_FUN(__glewRenderbufferStorageMultisampleCoverageNV)\n\n#define GLEW_NV_framebuffer_multisample_coverage GLEW_GET_VAR(__GLEW_NV_framebuffer_multisample_coverage)\n\n#endif /* GL_NV_framebuffer_multisample_coverage */\n\n/* ------------------------ GL_NV_geometry_program4 ------------------------ */\n\n#ifndef GL_NV_geometry_program4\n#define GL_NV_geometry_program4 1\n\n#define GL_GEOMETRY_PROGRAM_NV 0x8C26\n#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27\n#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28\n\ntypedef void (GLAPIENTRY * PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);\n\n#define glProgramVertexLimitNV GLEW_GET_FUN(__glewProgramVertexLimitNV)\n\n#define GLEW_NV_geometry_program4 GLEW_GET_VAR(__GLEW_NV_geometry_program4)\n\n#endif /* GL_NV_geometry_program4 */\n\n/* ------------------------- GL_NV_geometry_shader4 ------------------------ */\n\n#ifndef GL_NV_geometry_shader4\n#define GL_NV_geometry_shader4 1\n\n#define GLEW_NV_geometry_shader4 GLEW_GET_VAR(__GLEW_NV_geometry_shader4)\n\n#endif /* GL_NV_geometry_shader4 */\n\n/* --------------------------- GL_NV_gpu_program4 -------------------------- */\n\n#ifndef GL_NV_gpu_program4\n#define GL_NV_gpu_program4 1\n\n#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904\n#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905\n#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906\n#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907\n#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908\n#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909\n#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5\n#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6\n\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);\n\n#define glProgramEnvParameterI4iNV GLEW_GET_FUN(__glewProgramEnvParameterI4iNV)\n#define glProgramEnvParameterI4ivNV GLEW_GET_FUN(__glewProgramEnvParameterI4ivNV)\n#define glProgramEnvParameterI4uiNV GLEW_GET_FUN(__glewProgramEnvParameterI4uiNV)\n#define glProgramEnvParameterI4uivNV GLEW_GET_FUN(__glewProgramEnvParameterI4uivNV)\n#define glProgramEnvParametersI4ivNV GLEW_GET_FUN(__glewProgramEnvParametersI4ivNV)\n#define glProgramEnvParametersI4uivNV GLEW_GET_FUN(__glewProgramEnvParametersI4uivNV)\n#define glProgramLocalParameterI4iNV GLEW_GET_FUN(__glewProgramLocalParameterI4iNV)\n#define glProgramLocalParameterI4ivNV GLEW_GET_FUN(__glewProgramLocalParameterI4ivNV)\n#define glProgramLocalParameterI4uiNV GLEW_GET_FUN(__glewProgramLocalParameterI4uiNV)\n#define glProgramLocalParameterI4uivNV GLEW_GET_FUN(__glewProgramLocalParameterI4uivNV)\n#define glProgramLocalParametersI4ivNV GLEW_GET_FUN(__glewProgramLocalParametersI4ivNV)\n#define glProgramLocalParametersI4uivNV GLEW_GET_FUN(__glewProgramLocalParametersI4uivNV)\n\n#define GLEW_NV_gpu_program4 GLEW_GET_VAR(__GLEW_NV_gpu_program4)\n\n#endif /* GL_NV_gpu_program4 */\n\n/* --------------------------- GL_NV_gpu_program5 -------------------------- */\n\n#ifndef GL_NV_gpu_program5\n#define GL_NV_gpu_program5 1\n\n#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C\n#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F\n\n#define GLEW_NV_gpu_program5 GLEW_GET_VAR(__GLEW_NV_gpu_program5)\n\n#endif /* GL_NV_gpu_program5 */\n\n/* ------------------------- GL_NV_gpu_program_fp64 ------------------------ */\n\n#ifndef GL_NV_gpu_program_fp64\n#define GL_NV_gpu_program_fp64 1\n\n#define GLEW_NV_gpu_program_fp64 GLEW_GET_VAR(__GLEW_NV_gpu_program_fp64)\n\n#endif /* GL_NV_gpu_program_fp64 */\n\n/* --------------------------- GL_NV_gpu_shader5 --------------------------- */\n\n#ifndef GL_NV_gpu_shader5\n#define GL_NV_gpu_shader5 1\n\n#define GL_INT64_NV 0x140E\n#define GL_UNSIGNED_INT64_NV 0x140F\n#define GL_INT8_NV 0x8FE0\n#define GL_INT8_VEC2_NV 0x8FE1\n#define GL_INT8_VEC3_NV 0x8FE2\n#define GL_INT8_VEC4_NV 0x8FE3\n#define GL_INT16_NV 0x8FE4\n#define GL_INT16_VEC2_NV 0x8FE5\n#define GL_INT16_VEC3_NV 0x8FE6\n#define GL_INT16_VEC4_NV 0x8FE7\n#define GL_INT64_VEC2_NV 0x8FE9\n#define GL_INT64_VEC3_NV 0x8FEA\n#define GL_INT64_VEC4_NV 0x8FEB\n#define GL_UNSIGNED_INT8_NV 0x8FEC\n#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED\n#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE\n#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF\n#define GL_UNSIGNED_INT16_NV 0x8FF0\n#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1\n#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2\n#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3\n#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5\n#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6\n#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7\n#define GL_FLOAT16_NV 0x8FF8\n#define GL_FLOAT16_VEC2_NV 0x8FF9\n#define GL_FLOAT16_VEC3_NV 0x8FFA\n#define GL_FLOAT16_VEC4_NV 0x8FFB\n\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\n\n#define glGetUniformi64vNV GLEW_GET_FUN(__glewGetUniformi64vNV)\n#define glGetUniformui64vNV GLEW_GET_FUN(__glewGetUniformui64vNV)\n#define glProgramUniform1i64NV GLEW_GET_FUN(__glewProgramUniform1i64NV)\n#define glProgramUniform1i64vNV GLEW_GET_FUN(__glewProgramUniform1i64vNV)\n#define glProgramUniform1ui64NV GLEW_GET_FUN(__glewProgramUniform1ui64NV)\n#define glProgramUniform1ui64vNV GLEW_GET_FUN(__glewProgramUniform1ui64vNV)\n#define glProgramUniform2i64NV GLEW_GET_FUN(__glewProgramUniform2i64NV)\n#define glProgramUniform2i64vNV GLEW_GET_FUN(__glewProgramUniform2i64vNV)\n#define glProgramUniform2ui64NV GLEW_GET_FUN(__glewProgramUniform2ui64NV)\n#define glProgramUniform2ui64vNV GLEW_GET_FUN(__glewProgramUniform2ui64vNV)\n#define glProgramUniform3i64NV GLEW_GET_FUN(__glewProgramUniform3i64NV)\n#define glProgramUniform3i64vNV GLEW_GET_FUN(__glewProgramUniform3i64vNV)\n#define glProgramUniform3ui64NV GLEW_GET_FUN(__glewProgramUniform3ui64NV)\n#define glProgramUniform3ui64vNV GLEW_GET_FUN(__glewProgramUniform3ui64vNV)\n#define glProgramUniform4i64NV GLEW_GET_FUN(__glewProgramUniform4i64NV)\n#define glProgramUniform4i64vNV GLEW_GET_FUN(__glewProgramUniform4i64vNV)\n#define glProgramUniform4ui64NV GLEW_GET_FUN(__glewProgramUniform4ui64NV)\n#define glProgramUniform4ui64vNV GLEW_GET_FUN(__glewProgramUniform4ui64vNV)\n#define glUniform1i64NV GLEW_GET_FUN(__glewUniform1i64NV)\n#define glUniform1i64vNV GLEW_GET_FUN(__glewUniform1i64vNV)\n#define glUniform1ui64NV GLEW_GET_FUN(__glewUniform1ui64NV)\n#define glUniform1ui64vNV GLEW_GET_FUN(__glewUniform1ui64vNV)\n#define glUniform2i64NV GLEW_GET_FUN(__glewUniform2i64NV)\n#define glUniform2i64vNV GLEW_GET_FUN(__glewUniform2i64vNV)\n#define glUniform2ui64NV GLEW_GET_FUN(__glewUniform2ui64NV)\n#define glUniform2ui64vNV GLEW_GET_FUN(__glewUniform2ui64vNV)\n#define glUniform3i64NV GLEW_GET_FUN(__glewUniform3i64NV)\n#define glUniform3i64vNV GLEW_GET_FUN(__glewUniform3i64vNV)\n#define glUniform3ui64NV GLEW_GET_FUN(__glewUniform3ui64NV)\n#define glUniform3ui64vNV GLEW_GET_FUN(__glewUniform3ui64vNV)\n#define glUniform4i64NV GLEW_GET_FUN(__glewUniform4i64NV)\n#define glUniform4i64vNV GLEW_GET_FUN(__glewUniform4i64vNV)\n#define glUniform4ui64NV GLEW_GET_FUN(__glewUniform4ui64NV)\n#define glUniform4ui64vNV GLEW_GET_FUN(__glewUniform4ui64vNV)\n\n#define GLEW_NV_gpu_shader5 GLEW_GET_VAR(__GLEW_NV_gpu_shader5)\n\n#endif /* GL_NV_gpu_shader5 */\n\n/* ---------------------------- GL_NV_half_float --------------------------- */\n\n#ifndef GL_NV_half_float\n#define GL_NV_half_float 1\n\n#define GL_HALF_FLOAT_NV 0x140B\n\ntypedef unsigned short GLhalf;\n\ntypedef void (GLAPIENTRY * PFNGLCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue);\ntypedef void (GLAPIENTRY * PFNGLCOLOR3HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4HNVPROC) (GLhalf red, GLhalf green, GLhalf blue, GLhalf alpha);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDHNVPROC) (GLhalf fog);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDHVNVPROC) (const GLhalf* fog);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r, GLhalf q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLNORMAL3HNVPROC) (GLhalf nx, GLhalf ny, GLhalf nz);\ntypedef void (GLAPIENTRY * PFNGLNORMAL3HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD1HNVPROC) (GLhalf s);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD1HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2HNVPROC) (GLhalf s, GLhalf t);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD3HNVPROC) (GLhalf s, GLhalf t, GLhalf r);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD3HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4HNVPROC) (GLhalf s, GLhalf t, GLhalf r, GLhalf q);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEX2HNVPROC) (GLhalf x, GLhalf y);\ntypedef void (GLAPIENTRY * PFNGLVERTEX2HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEX3HNVPROC) (GLhalf x, GLhalf y, GLhalf z);\ntypedef void (GLAPIENTRY * PFNGLVERTEX3HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEX4HNVPROC) (GLhalf x, GLhalf y, GLhalf z, GLhalf w);\ntypedef void (GLAPIENTRY * PFNGLVERTEX4HVNVPROC) (const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalf x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalf x, GLhalf y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z, GLhalf w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHNVPROC) (GLhalf weight);\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalf* weight);\n\n#define glColor3hNV GLEW_GET_FUN(__glewColor3hNV)\n#define glColor3hvNV GLEW_GET_FUN(__glewColor3hvNV)\n#define glColor4hNV GLEW_GET_FUN(__glewColor4hNV)\n#define glColor4hvNV GLEW_GET_FUN(__glewColor4hvNV)\n#define glFogCoordhNV GLEW_GET_FUN(__glewFogCoordhNV)\n#define glFogCoordhvNV GLEW_GET_FUN(__glewFogCoordhvNV)\n#define glMultiTexCoord1hNV GLEW_GET_FUN(__glewMultiTexCoord1hNV)\n#define glMultiTexCoord1hvNV GLEW_GET_FUN(__glewMultiTexCoord1hvNV)\n#define glMultiTexCoord2hNV GLEW_GET_FUN(__glewMultiTexCoord2hNV)\n#define glMultiTexCoord2hvNV GLEW_GET_FUN(__glewMultiTexCoord2hvNV)\n#define glMultiTexCoord3hNV GLEW_GET_FUN(__glewMultiTexCoord3hNV)\n#define glMultiTexCoord3hvNV GLEW_GET_FUN(__glewMultiTexCoord3hvNV)\n#define glMultiTexCoord4hNV GLEW_GET_FUN(__glewMultiTexCoord4hNV)\n#define glMultiTexCoord4hvNV GLEW_GET_FUN(__glewMultiTexCoord4hvNV)\n#define glNormal3hNV GLEW_GET_FUN(__glewNormal3hNV)\n#define glNormal3hvNV GLEW_GET_FUN(__glewNormal3hvNV)\n#define glSecondaryColor3hNV GLEW_GET_FUN(__glewSecondaryColor3hNV)\n#define glSecondaryColor3hvNV GLEW_GET_FUN(__glewSecondaryColor3hvNV)\n#define glTexCoord1hNV GLEW_GET_FUN(__glewTexCoord1hNV)\n#define glTexCoord1hvNV GLEW_GET_FUN(__glewTexCoord1hvNV)\n#define glTexCoord2hNV GLEW_GET_FUN(__glewTexCoord2hNV)\n#define glTexCoord2hvNV GLEW_GET_FUN(__glewTexCoord2hvNV)\n#define glTexCoord3hNV GLEW_GET_FUN(__glewTexCoord3hNV)\n#define glTexCoord3hvNV GLEW_GET_FUN(__glewTexCoord3hvNV)\n#define glTexCoord4hNV GLEW_GET_FUN(__glewTexCoord4hNV)\n#define glTexCoord4hvNV GLEW_GET_FUN(__glewTexCoord4hvNV)\n#define glVertex2hNV GLEW_GET_FUN(__glewVertex2hNV)\n#define glVertex2hvNV GLEW_GET_FUN(__glewVertex2hvNV)\n#define glVertex3hNV GLEW_GET_FUN(__glewVertex3hNV)\n#define glVertex3hvNV GLEW_GET_FUN(__glewVertex3hvNV)\n#define glVertex4hNV GLEW_GET_FUN(__glewVertex4hNV)\n#define glVertex4hvNV GLEW_GET_FUN(__glewVertex4hvNV)\n#define glVertexAttrib1hNV GLEW_GET_FUN(__glewVertexAttrib1hNV)\n#define glVertexAttrib1hvNV GLEW_GET_FUN(__glewVertexAttrib1hvNV)\n#define glVertexAttrib2hNV GLEW_GET_FUN(__glewVertexAttrib2hNV)\n#define glVertexAttrib2hvNV GLEW_GET_FUN(__glewVertexAttrib2hvNV)\n#define glVertexAttrib3hNV GLEW_GET_FUN(__glewVertexAttrib3hNV)\n#define glVertexAttrib3hvNV GLEW_GET_FUN(__glewVertexAttrib3hvNV)\n#define glVertexAttrib4hNV GLEW_GET_FUN(__glewVertexAttrib4hNV)\n#define glVertexAttrib4hvNV GLEW_GET_FUN(__glewVertexAttrib4hvNV)\n#define glVertexAttribs1hvNV GLEW_GET_FUN(__glewVertexAttribs1hvNV)\n#define glVertexAttribs2hvNV GLEW_GET_FUN(__glewVertexAttribs2hvNV)\n#define glVertexAttribs3hvNV GLEW_GET_FUN(__glewVertexAttribs3hvNV)\n#define glVertexAttribs4hvNV GLEW_GET_FUN(__glewVertexAttribs4hvNV)\n#define glVertexWeighthNV GLEW_GET_FUN(__glewVertexWeighthNV)\n#define glVertexWeighthvNV GLEW_GET_FUN(__glewVertexWeighthvNV)\n\n#define GLEW_NV_half_float GLEW_GET_VAR(__GLEW_NV_half_float)\n\n#endif /* GL_NV_half_float */\n\n/* ------------------------ GL_NV_light_max_exponent ----------------------- */\n\n#ifndef GL_NV_light_max_exponent\n#define GL_NV_light_max_exponent 1\n\n#define GL_MAX_SHININESS_NV 0x8504\n#define GL_MAX_SPOT_EXPONENT_NV 0x8505\n\n#define GLEW_NV_light_max_exponent GLEW_GET_VAR(__GLEW_NV_light_max_exponent)\n\n#endif /* GL_NV_light_max_exponent */\n\n/* ----------------------- GL_NV_multisample_coverage ---------------------- */\n\n#ifndef GL_NV_multisample_coverage\n#define GL_NV_multisample_coverage 1\n\n#define GL_COVERAGE_SAMPLES_NV 0x80A9\n#define GL_COLOR_SAMPLES_NV 0x8E20\n\n#define GLEW_NV_multisample_coverage GLEW_GET_VAR(__GLEW_NV_multisample_coverage)\n\n#endif /* GL_NV_multisample_coverage */\n\n/* --------------------- GL_NV_multisample_filter_hint --------------------- */\n\n#ifndef GL_NV_multisample_filter_hint\n#define GL_NV_multisample_filter_hint 1\n\n#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534\n\n#define GLEW_NV_multisample_filter_hint GLEW_GET_VAR(__GLEW_NV_multisample_filter_hint)\n\n#endif /* GL_NV_multisample_filter_hint */\n\n/* ------------------------- GL_NV_occlusion_query ------------------------- */\n\n#ifndef GL_NV_occlusion_query\n#define GL_NV_occlusion_query 1\n\n#define GL_PIXEL_COUNTER_BITS_NV 0x8864\n#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865\n#define GL_PIXEL_COUNT_NV 0x8866\n#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867\n\ntypedef void (GLAPIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);\n\n#define glBeginOcclusionQueryNV GLEW_GET_FUN(__glewBeginOcclusionQueryNV)\n#define glDeleteOcclusionQueriesNV GLEW_GET_FUN(__glewDeleteOcclusionQueriesNV)\n#define glEndOcclusionQueryNV GLEW_GET_FUN(__glewEndOcclusionQueryNV)\n#define glGenOcclusionQueriesNV GLEW_GET_FUN(__glewGenOcclusionQueriesNV)\n#define glGetOcclusionQueryivNV GLEW_GET_FUN(__glewGetOcclusionQueryivNV)\n#define glGetOcclusionQueryuivNV GLEW_GET_FUN(__glewGetOcclusionQueryuivNV)\n#define glIsOcclusionQueryNV GLEW_GET_FUN(__glewIsOcclusionQueryNV)\n\n#define GLEW_NV_occlusion_query GLEW_GET_VAR(__GLEW_NV_occlusion_query)\n\n#endif /* GL_NV_occlusion_query */\n\n/* ----------------------- GL_NV_packed_depth_stencil ---------------------- */\n\n#ifndef GL_NV_packed_depth_stencil\n#define GL_NV_packed_depth_stencil 1\n\n#define GL_DEPTH_STENCIL_NV 0x84F9\n#define GL_UNSIGNED_INT_24_8_NV 0x84FA\n\n#define GLEW_NV_packed_depth_stencil GLEW_GET_VAR(__GLEW_NV_packed_depth_stencil)\n\n#endif /* GL_NV_packed_depth_stencil */\n\n/* --------------------- GL_NV_parameter_buffer_object --------------------- */\n\n#ifndef GL_NV_parameter_buffer_object\n#define GL_NV_parameter_buffer_object 1\n\n#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0\n#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1\n#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2\n#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3\n#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4\n\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);\n\n#define glProgramBufferParametersIivNV GLEW_GET_FUN(__glewProgramBufferParametersIivNV)\n#define glProgramBufferParametersIuivNV GLEW_GET_FUN(__glewProgramBufferParametersIuivNV)\n#define glProgramBufferParametersfvNV GLEW_GET_FUN(__glewProgramBufferParametersfvNV)\n\n#define GLEW_NV_parameter_buffer_object GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object)\n\n#endif /* GL_NV_parameter_buffer_object */\n\n/* --------------------- GL_NV_parameter_buffer_object2 -------------------- */\n\n#ifndef GL_NV_parameter_buffer_object2\n#define GL_NV_parameter_buffer_object2 1\n\n#define GLEW_NV_parameter_buffer_object2 GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object2)\n\n#endif /* GL_NV_parameter_buffer_object2 */\n\n/* -------------------------- GL_NV_path_rendering ------------------------- */\n\n#ifndef GL_NV_path_rendering\n#define GL_NV_path_rendering 1\n\n#define GL_CLOSE_PATH_NV 0x00\n#define GL_BOLD_BIT_NV 0x01\n#define GL_GLYPH_WIDTH_BIT_NV 0x01\n#define GL_GLYPH_HEIGHT_BIT_NV 0x02\n#define GL_ITALIC_BIT_NV 0x02\n#define GL_MOVE_TO_NV 0x02\n#define GL_RELATIVE_MOVE_TO_NV 0x03\n#define GL_LINE_TO_NV 0x04\n#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04\n#define GL_RELATIVE_LINE_TO_NV 0x05\n#define GL_HORIZONTAL_LINE_TO_NV 0x06\n#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07\n#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08\n#define GL_VERTICAL_LINE_TO_NV 0x08\n#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09\n#define GL_QUADRATIC_CURVE_TO_NV 0x0A\n#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B\n#define GL_CUBIC_CURVE_TO_NV 0x0C\n#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D\n#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E\n#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F\n#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10\n#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10\n#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11\n#define GL_SMALL_CCW_ARC_TO_NV 0x12\n#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13\n#define GL_SMALL_CW_ARC_TO_NV 0x14\n#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15\n#define GL_LARGE_CCW_ARC_TO_NV 0x16\n#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17\n#define GL_LARGE_CW_ARC_TO_NV 0x18\n#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19\n#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20\n#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40\n#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80\n#define GL_RESTART_PATH_NV 0xF0\n#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2\n#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4\n#define GL_RECT_NV 0xF6\n#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8\n#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA\n#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC\n#define GL_ARC_TO_NV 0xFE\n#define GL_RELATIVE_ARC_TO_NV 0xFF\n#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100\n#define GL_PRIMARY_COLOR_NV 0x852C\n#define GL_SECONDARY_COLOR_NV 0x852D\n#define GL_PRIMARY_COLOR 0x8577\n#define GL_PATH_FORMAT_SVG_NV 0x9070\n#define GL_PATH_FORMAT_PS_NV 0x9071\n#define GL_STANDARD_FONT_NAME_NV 0x9072\n#define GL_SYSTEM_FONT_NAME_NV 0x9073\n#define GL_FILE_NAME_NV 0x9074\n#define GL_PATH_STROKE_WIDTH_NV 0x9075\n#define GL_PATH_END_CAPS_NV 0x9076\n#define GL_PATH_INITIAL_END_CAP_NV 0x9077\n#define GL_PATH_TERMINAL_END_CAP_NV 0x9078\n#define GL_PATH_JOIN_STYLE_NV 0x9079\n#define GL_PATH_MITER_LIMIT_NV 0x907A\n#define GL_PATH_DASH_CAPS_NV 0x907B\n#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C\n#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D\n#define GL_PATH_DASH_OFFSET_NV 0x907E\n#define GL_PATH_CLIENT_LENGTH_NV 0x907F\n#define GL_PATH_FILL_MODE_NV 0x9080\n#define GL_PATH_FILL_MASK_NV 0x9081\n#define GL_PATH_FILL_COVER_MODE_NV 0x9082\n#define GL_PATH_STROKE_COVER_MODE_NV 0x9083\n#define GL_PATH_STROKE_MASK_NV 0x9084\n#define GL_COUNT_UP_NV 0x9088\n#define GL_COUNT_DOWN_NV 0x9089\n#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A\n#define GL_CONVEX_HULL_NV 0x908B\n#define GL_BOUNDING_BOX_NV 0x908D\n#define GL_TRANSLATE_X_NV 0x908E\n#define GL_TRANSLATE_Y_NV 0x908F\n#define GL_TRANSLATE_2D_NV 0x9090\n#define GL_TRANSLATE_3D_NV 0x9091\n#define GL_AFFINE_2D_NV 0x9092\n#define GL_AFFINE_3D_NV 0x9094\n#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096\n#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098\n#define GL_UTF8_NV 0x909A\n#define GL_UTF16_NV 0x909B\n#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C\n#define GL_PATH_COMMAND_COUNT_NV 0x909D\n#define GL_PATH_COORD_COUNT_NV 0x909E\n#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F\n#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0\n#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1\n#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2\n#define GL_SQUARE_NV 0x90A3\n#define GL_ROUND_NV 0x90A4\n#define GL_TRIANGULAR_NV 0x90A5\n#define GL_BEVEL_NV 0x90A6\n#define GL_MITER_REVERT_NV 0x90A7\n#define GL_MITER_TRUNCATE_NV 0x90A8\n#define GL_SKIP_MISSING_GLYPH_NV 0x90A9\n#define GL_USE_MISSING_GLYPH_NV 0x90AA\n#define GL_PATH_ERROR_POSITION_NV 0x90AB\n#define GL_PATH_FOG_GEN_MODE_NV 0x90AC\n#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD\n#define GL_ADJACENT_PAIRS_NV 0x90AE\n#define GL_FIRST_TO_REST_NV 0x90AF\n#define GL_PATH_GEN_MODE_NV 0x90B0\n#define GL_PATH_GEN_COEFF_NV 0x90B1\n#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2\n#define GL_PATH_GEN_COMPONENTS_NV 0x90B3\n#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4\n#define GL_MOVE_TO_RESETS_NV 0x90B5\n#define GL_MOVE_TO_CONTINUES_NV 0x90B6\n#define GL_PATH_STENCIL_FUNC_NV 0x90B7\n#define GL_PATH_STENCIL_REF_NV 0x90B8\n#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9\n#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD\n#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE\n#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF\n#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000\n#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000\n#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000\n#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000\n#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000\n#define GL_FONT_ASCENDER_BIT_NV 0x00200000\n#define GL_FONT_DESCENDER_BIT_NV 0x00400000\n#define GL_FONT_HEIGHT_BIT_NV 0x00800000\n#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000\n#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000\n#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000\n#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000\n#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000\n\ntypedef void (GLAPIENTRY * PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);\ntypedef void (GLAPIENTRY * PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\ntypedef void (GLAPIENTRY * PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);\ntypedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\ntypedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHNVPROC) (GLuint name, GLenum coverMode);\ntypedef void (GLAPIENTRY * PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);\ntypedef GLuint (GLAPIENTRY * PFNGLGENPATHSNVPROC) (GLsizei range);\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint* value);\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOMMANDSNVPROC) (GLuint name, GLubyte* commands);\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOORDSNVPROC) (GLuint name, GLfloat* coords);\ntypedef void (GLAPIENTRY * PFNGLGETPATHDASHARRAYNVPROC) (GLuint name, GLfloat* dashArray);\ntypedef GLfloat (GLAPIENTRY * PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);\ntypedef void (GLAPIENTRY * PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint fistPathName, GLsizei numPaths, GLsizei stride, GLfloat* metrics);\ntypedef void (GLAPIENTRY * PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);\ntypedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERFVNVPROC) (GLuint name, GLenum param, GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERIVNVPROC) (GLuint name, GLenum param, GLint* value);\ntypedef void (GLAPIENTRY * PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);\ntypedef void (GLAPIENTRY * PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint* value);\ntypedef void (GLAPIENTRY * PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPATHNVPROC) (GLuint path);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat* coeffs);\ntypedef void (GLAPIENTRY * PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const GLvoid*coords);\ntypedef void (GLAPIENTRY * PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void* coords);\ntypedef void (GLAPIENTRY * PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum zfunc);\ntypedef void (GLAPIENTRY * PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat* dashArray);\ntypedef void (GLAPIENTRY * PFNGLPATHFOGGENNVPROC) (GLenum genMode);\ntypedef void (GLAPIENTRY * PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\ntypedef void (GLAPIENTRY * PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid*charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);\ntypedef void (GLAPIENTRY * PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void* pathString);\ntypedef void (GLAPIENTRY * PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const GLvoid*coords);\ntypedef void (GLAPIENTRY * PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void* coords);\ntypedef void (GLAPIENTRY * PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat* coeffs);\ntypedef GLboolean (GLAPIENTRY * PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat* x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);\ntypedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);\ntypedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);\ntypedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat* transformValues);\ntypedef void (GLAPIENTRY * PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint paths[], const GLfloat weights[]);\n\n#define glCopyPathNV GLEW_GET_FUN(__glewCopyPathNV)\n#define glCoverFillPathInstancedNV GLEW_GET_FUN(__glewCoverFillPathInstancedNV)\n#define glCoverFillPathNV GLEW_GET_FUN(__glewCoverFillPathNV)\n#define glCoverStrokePathInstancedNV GLEW_GET_FUN(__glewCoverStrokePathInstancedNV)\n#define glCoverStrokePathNV GLEW_GET_FUN(__glewCoverStrokePathNV)\n#define glDeletePathsNV GLEW_GET_FUN(__glewDeletePathsNV)\n#define glGenPathsNV GLEW_GET_FUN(__glewGenPathsNV)\n#define glGetPathColorGenfvNV GLEW_GET_FUN(__glewGetPathColorGenfvNV)\n#define glGetPathColorGenivNV GLEW_GET_FUN(__glewGetPathColorGenivNV)\n#define glGetPathCommandsNV GLEW_GET_FUN(__glewGetPathCommandsNV)\n#define glGetPathCoordsNV GLEW_GET_FUN(__glewGetPathCoordsNV)\n#define glGetPathDashArrayNV GLEW_GET_FUN(__glewGetPathDashArrayNV)\n#define glGetPathLengthNV GLEW_GET_FUN(__glewGetPathLengthNV)\n#define glGetPathMetricRangeNV GLEW_GET_FUN(__glewGetPathMetricRangeNV)\n#define glGetPathMetricsNV GLEW_GET_FUN(__glewGetPathMetricsNV)\n#define glGetPathParameterfvNV GLEW_GET_FUN(__glewGetPathParameterfvNV)\n#define glGetPathParameterivNV GLEW_GET_FUN(__glewGetPathParameterivNV)\n#define glGetPathSpacingNV GLEW_GET_FUN(__glewGetPathSpacingNV)\n#define glGetPathTexGenfvNV GLEW_GET_FUN(__glewGetPathTexGenfvNV)\n#define glGetPathTexGenivNV GLEW_GET_FUN(__glewGetPathTexGenivNV)\n#define glInterpolatePathsNV GLEW_GET_FUN(__glewInterpolatePathsNV)\n#define glIsPathNV GLEW_GET_FUN(__glewIsPathNV)\n#define glIsPointInFillPathNV GLEW_GET_FUN(__glewIsPointInFillPathNV)\n#define glIsPointInStrokePathNV GLEW_GET_FUN(__glewIsPointInStrokePathNV)\n#define glPathColorGenNV GLEW_GET_FUN(__glewPathColorGenNV)\n#define glPathCommandsNV GLEW_GET_FUN(__glewPathCommandsNV)\n#define glPathCoordsNV GLEW_GET_FUN(__glewPathCoordsNV)\n#define glPathCoverDepthFuncNV GLEW_GET_FUN(__glewPathCoverDepthFuncNV)\n#define glPathDashArrayNV GLEW_GET_FUN(__glewPathDashArrayNV)\n#define glPathFogGenNV GLEW_GET_FUN(__glewPathFogGenNV)\n#define glPathGlyphRangeNV GLEW_GET_FUN(__glewPathGlyphRangeNV)\n#define glPathGlyphsNV GLEW_GET_FUN(__glewPathGlyphsNV)\n#define glPathParameterfNV GLEW_GET_FUN(__glewPathParameterfNV)\n#define glPathParameterfvNV GLEW_GET_FUN(__glewPathParameterfvNV)\n#define glPathParameteriNV GLEW_GET_FUN(__glewPathParameteriNV)\n#define glPathParameterivNV GLEW_GET_FUN(__glewPathParameterivNV)\n#define glPathStencilDepthOffsetNV GLEW_GET_FUN(__glewPathStencilDepthOffsetNV)\n#define glPathStencilFuncNV GLEW_GET_FUN(__glewPathStencilFuncNV)\n#define glPathStringNV GLEW_GET_FUN(__glewPathStringNV)\n#define glPathSubCommandsNV GLEW_GET_FUN(__glewPathSubCommandsNV)\n#define glPathSubCoordsNV GLEW_GET_FUN(__glewPathSubCoordsNV)\n#define glPathTexGenNV GLEW_GET_FUN(__glewPathTexGenNV)\n#define glPointAlongPathNV GLEW_GET_FUN(__glewPointAlongPathNV)\n#define glStencilFillPathInstancedNV GLEW_GET_FUN(__glewStencilFillPathInstancedNV)\n#define glStencilFillPathNV GLEW_GET_FUN(__glewStencilFillPathNV)\n#define glStencilStrokePathInstancedNV GLEW_GET_FUN(__glewStencilStrokePathInstancedNV)\n#define glStencilStrokePathNV GLEW_GET_FUN(__glewStencilStrokePathNV)\n#define glTransformPathNV GLEW_GET_FUN(__glewTransformPathNV)\n#define glWeightPathsNV GLEW_GET_FUN(__glewWeightPathsNV)\n\n#define GLEW_NV_path_rendering GLEW_GET_VAR(__GLEW_NV_path_rendering)\n\n#endif /* GL_NV_path_rendering */\n\n/* ------------------------- GL_NV_pixel_data_range ------------------------ */\n\n#ifndef GL_NV_pixel_data_range\n#define GL_NV_pixel_data_range 1\n\n#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878\n#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879\n#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A\n#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B\n#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C\n#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D\n\ntypedef void (GLAPIENTRY * PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, void* pointer);\n\n#define glFlushPixelDataRangeNV GLEW_GET_FUN(__glewFlushPixelDataRangeNV)\n#define glPixelDataRangeNV GLEW_GET_FUN(__glewPixelDataRangeNV)\n\n#define GLEW_NV_pixel_data_range GLEW_GET_VAR(__GLEW_NV_pixel_data_range)\n\n#endif /* GL_NV_pixel_data_range */\n\n/* --------------------------- GL_NV_point_sprite -------------------------- */\n\n#ifndef GL_NV_point_sprite\n#define GL_NV_point_sprite 1\n\n#define GL_POINT_SPRITE_NV 0x8861\n#define GL_COORD_REPLACE_NV 0x8862\n#define GL_POINT_SPRITE_R_MODE_NV 0x8863\n\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint* params);\n\n#define glPointParameteriNV GLEW_GET_FUN(__glewPointParameteriNV)\n#define glPointParameterivNV GLEW_GET_FUN(__glewPointParameterivNV)\n\n#define GLEW_NV_point_sprite GLEW_GET_VAR(__GLEW_NV_point_sprite)\n\n#endif /* GL_NV_point_sprite */\n\n/* -------------------------- GL_NV_present_video -------------------------- */\n\n#ifndef GL_NV_present_video\n#define GL_NV_present_video 1\n\n#define GL_FRAME_NV 0x8E26\n#define GL_FIELDS_NV 0x8E27\n#define GL_CURRENT_TIME_NV 0x8E28\n#define GL_NUM_FILL_STREAMS_NV 0x8E29\n#define GL_PRESENT_TIME_NV 0x8E2A\n#define GL_PRESENT_DURATION_NV 0x8E2B\n\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);\ntypedef void (GLAPIENTRY * PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);\n\n#define glGetVideoi64vNV GLEW_GET_FUN(__glewGetVideoi64vNV)\n#define glGetVideoivNV GLEW_GET_FUN(__glewGetVideoivNV)\n#define glGetVideoui64vNV GLEW_GET_FUN(__glewGetVideoui64vNV)\n#define glGetVideouivNV GLEW_GET_FUN(__glewGetVideouivNV)\n#define glPresentFrameDualFillNV GLEW_GET_FUN(__glewPresentFrameDualFillNV)\n#define glPresentFrameKeyedNV GLEW_GET_FUN(__glewPresentFrameKeyedNV)\n\n#define GLEW_NV_present_video GLEW_GET_VAR(__GLEW_NV_present_video)\n\n#endif /* GL_NV_present_video */\n\n/* ------------------------ GL_NV_primitive_restart ------------------------ */\n\n#ifndef GL_NV_primitive_restart\n#define GL_NV_primitive_restart 1\n\n#define GL_PRIMITIVE_RESTART_NV 0x8558\n#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559\n\ntypedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);\ntypedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void);\n\n#define glPrimitiveRestartIndexNV GLEW_GET_FUN(__glewPrimitiveRestartIndexNV)\n#define glPrimitiveRestartNV GLEW_GET_FUN(__glewPrimitiveRestartNV)\n\n#define GLEW_NV_primitive_restart GLEW_GET_VAR(__GLEW_NV_primitive_restart)\n\n#endif /* GL_NV_primitive_restart */\n\n/* ------------------------ GL_NV_register_combiners ----------------------- */\n\n#ifndef GL_NV_register_combiners\n#define GL_NV_register_combiners 1\n\n#define GL_REGISTER_COMBINERS_NV 0x8522\n#define GL_VARIABLE_A_NV 0x8523\n#define GL_VARIABLE_B_NV 0x8524\n#define GL_VARIABLE_C_NV 0x8525\n#define GL_VARIABLE_D_NV 0x8526\n#define GL_VARIABLE_E_NV 0x8527\n#define GL_VARIABLE_F_NV 0x8528\n#define GL_VARIABLE_G_NV 0x8529\n#define GL_CONSTANT_COLOR0_NV 0x852A\n#define GL_CONSTANT_COLOR1_NV 0x852B\n#define GL_PRIMARY_COLOR_NV 0x852C\n#define GL_SECONDARY_COLOR_NV 0x852D\n#define GL_SPARE0_NV 0x852E\n#define GL_SPARE1_NV 0x852F\n#define GL_DISCARD_NV 0x8530\n#define GL_E_TIMES_F_NV 0x8531\n#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532\n#define GL_UNSIGNED_IDENTITY_NV 0x8536\n#define GL_UNSIGNED_INVERT_NV 0x8537\n#define GL_EXPAND_NORMAL_NV 0x8538\n#define GL_EXPAND_NEGATE_NV 0x8539\n#define GL_HALF_BIAS_NORMAL_NV 0x853A\n#define GL_HALF_BIAS_NEGATE_NV 0x853B\n#define GL_SIGNED_IDENTITY_NV 0x853C\n#define GL_SIGNED_NEGATE_NV 0x853D\n#define GL_SCALE_BY_TWO_NV 0x853E\n#define GL_SCALE_BY_FOUR_NV 0x853F\n#define GL_SCALE_BY_ONE_HALF_NV 0x8540\n#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541\n#define GL_COMBINER_INPUT_NV 0x8542\n#define GL_COMBINER_MAPPING_NV 0x8543\n#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544\n#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545\n#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546\n#define GL_COMBINER_MUX_SUM_NV 0x8547\n#define GL_COMBINER_SCALE_NV 0x8548\n#define GL_COMBINER_BIAS_NV 0x8549\n#define GL_COMBINER_AB_OUTPUT_NV 0x854A\n#define GL_COMBINER_CD_OUTPUT_NV 0x854B\n#define GL_COMBINER_SUM_OUTPUT_NV 0x854C\n#define GL_MAX_GENERAL_COMBINERS_NV 0x854D\n#define GL_NUM_GENERAL_COMBINERS_NV 0x854E\n#define GL_COLOR_SUM_CLAMP_NV 0x854F\n#define GL_COMBINER0_NV 0x8550\n#define GL_COMBINER1_NV 0x8551\n#define GL_COMBINER2_NV 0x8552\n#define GL_COMBINER3_NV 0x8553\n#define GL_COMBINER4_NV 0x8554\n#define GL_COMBINER5_NV 0x8555\n#define GL_COMBINER6_NV 0x8556\n#define GL_COMBINER7_NV 0x8557\n\ntypedef void (GLAPIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\ntypedef void (GLAPIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint* params);\n\n#define glCombinerInputNV GLEW_GET_FUN(__glewCombinerInputNV)\n#define glCombinerOutputNV GLEW_GET_FUN(__glewCombinerOutputNV)\n#define glCombinerParameterfNV GLEW_GET_FUN(__glewCombinerParameterfNV)\n#define glCombinerParameterfvNV GLEW_GET_FUN(__glewCombinerParameterfvNV)\n#define glCombinerParameteriNV GLEW_GET_FUN(__glewCombinerParameteriNV)\n#define glCombinerParameterivNV GLEW_GET_FUN(__glewCombinerParameterivNV)\n#define glFinalCombinerInputNV GLEW_GET_FUN(__glewFinalCombinerInputNV)\n#define glGetCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetCombinerInputParameterfvNV)\n#define glGetCombinerInputParameterivNV GLEW_GET_FUN(__glewGetCombinerInputParameterivNV)\n#define glGetCombinerOutputParameterfvNV GLEW_GET_FUN(__glewGetCombinerOutputParameterfvNV)\n#define glGetCombinerOutputParameterivNV GLEW_GET_FUN(__glewGetCombinerOutputParameterivNV)\n#define glGetFinalCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterfvNV)\n#define glGetFinalCombinerInputParameterivNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterivNV)\n\n#define GLEW_NV_register_combiners GLEW_GET_VAR(__GLEW_NV_register_combiners)\n\n#endif /* GL_NV_register_combiners */\n\n/* ----------------------- GL_NV_register_combiners2 ----------------------- */\n\n#ifndef GL_NV_register_combiners2\n#define GL_NV_register_combiners2 1\n\n#define GL_PER_STAGE_CONSTANTS_NV 0x8535\n\ntypedef void (GLAPIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat* params);\n\n#define glCombinerStageParameterfvNV GLEW_GET_FUN(__glewCombinerStageParameterfvNV)\n#define glGetCombinerStageParameterfvNV GLEW_GET_FUN(__glewGetCombinerStageParameterfvNV)\n\n#define GLEW_NV_register_combiners2 GLEW_GET_VAR(__GLEW_NV_register_combiners2)\n\n#endif /* GL_NV_register_combiners2 */\n\n/* ----------------------- GL_NV_shader_atomic_float ----------------------- */\n\n#ifndef GL_NV_shader_atomic_float\n#define GL_NV_shader_atomic_float 1\n\n#define GLEW_NV_shader_atomic_float GLEW_GET_VAR(__GLEW_NV_shader_atomic_float)\n\n#endif /* GL_NV_shader_atomic_float */\n\n/* ------------------------ GL_NV_shader_buffer_load ----------------------- */\n\n#ifndef GL_NV_shader_buffer_load\n#define GL_NV_shader_buffer_load 1\n\n#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D\n#define GL_GPU_ADDRESS_NV 0x8F34\n#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35\n\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT* result);\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);\ntypedef GLboolean (GLAPIENTRY * PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);\ntypedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\n\n#define glGetBufferParameterui64vNV GLEW_GET_FUN(__glewGetBufferParameterui64vNV)\n#define glGetIntegerui64vNV GLEW_GET_FUN(__glewGetIntegerui64vNV)\n#define glGetNamedBufferParameterui64vNV GLEW_GET_FUN(__glewGetNamedBufferParameterui64vNV)\n#define glIsBufferResidentNV GLEW_GET_FUN(__glewIsBufferResidentNV)\n#define glIsNamedBufferResidentNV GLEW_GET_FUN(__glewIsNamedBufferResidentNV)\n#define glMakeBufferNonResidentNV GLEW_GET_FUN(__glewMakeBufferNonResidentNV)\n#define glMakeBufferResidentNV GLEW_GET_FUN(__glewMakeBufferResidentNV)\n#define glMakeNamedBufferNonResidentNV GLEW_GET_FUN(__glewMakeNamedBufferNonResidentNV)\n#define glMakeNamedBufferResidentNV GLEW_GET_FUN(__glewMakeNamedBufferResidentNV)\n#define glProgramUniformui64NV GLEW_GET_FUN(__glewProgramUniformui64NV)\n#define glProgramUniformui64vNV GLEW_GET_FUN(__glewProgramUniformui64vNV)\n#define glUniformui64NV GLEW_GET_FUN(__glewUniformui64NV)\n#define glUniformui64vNV GLEW_GET_FUN(__glewUniformui64vNV)\n\n#define GLEW_NV_shader_buffer_load GLEW_GET_VAR(__GLEW_NV_shader_buffer_load)\n\n#endif /* GL_NV_shader_buffer_load */\n\n/* ---------------------- GL_NV_tessellation_program5 ---------------------- */\n\n#ifndef GL_NV_tessellation_program5\n#define GL_NV_tessellation_program5 1\n\n#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8\n#define GL_TESS_CONTROL_PROGRAM_NV 0x891E\n#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F\n#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74\n#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75\n\n#define GLEW_NV_tessellation_program5 GLEW_GET_VAR(__GLEW_NV_tessellation_program5)\n\n#endif /* GL_NV_tessellation_program5 */\n\n/* -------------------------- GL_NV_texgen_emboss -------------------------- */\n\n#ifndef GL_NV_texgen_emboss\n#define GL_NV_texgen_emboss 1\n\n#define GL_EMBOSS_LIGHT_NV 0x855D\n#define GL_EMBOSS_CONSTANT_NV 0x855E\n#define GL_EMBOSS_MAP_NV 0x855F\n\n#define GLEW_NV_texgen_emboss GLEW_GET_VAR(__GLEW_NV_texgen_emboss)\n\n#endif /* GL_NV_texgen_emboss */\n\n/* ------------------------ GL_NV_texgen_reflection ------------------------ */\n\n#ifndef GL_NV_texgen_reflection\n#define GL_NV_texgen_reflection 1\n\n#define GL_NORMAL_MAP_NV 0x8511\n#define GL_REFLECTION_MAP_NV 0x8512\n\n#define GLEW_NV_texgen_reflection GLEW_GET_VAR(__GLEW_NV_texgen_reflection)\n\n#endif /* GL_NV_texgen_reflection */\n\n/* ------------------------- GL_NV_texture_barrier ------------------------- */\n\n#ifndef GL_NV_texture_barrier\n#define GL_NV_texture_barrier 1\n\ntypedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERNVPROC) (void);\n\n#define glTextureBarrierNV GLEW_GET_FUN(__glewTextureBarrierNV)\n\n#define GLEW_NV_texture_barrier GLEW_GET_VAR(__GLEW_NV_texture_barrier)\n\n#endif /* GL_NV_texture_barrier */\n\n/* --------------------- GL_NV_texture_compression_vtc --------------------- */\n\n#ifndef GL_NV_texture_compression_vtc\n#define GL_NV_texture_compression_vtc 1\n\n#define GLEW_NV_texture_compression_vtc GLEW_GET_VAR(__GLEW_NV_texture_compression_vtc)\n\n#endif /* GL_NV_texture_compression_vtc */\n\n/* ----------------------- GL_NV_texture_env_combine4 ---------------------- */\n\n#ifndef GL_NV_texture_env_combine4\n#define GL_NV_texture_env_combine4 1\n\n#define GL_COMBINE4_NV 0x8503\n#define GL_SOURCE3_RGB_NV 0x8583\n#define GL_SOURCE3_ALPHA_NV 0x858B\n#define GL_OPERAND3_RGB_NV 0x8593\n#define GL_OPERAND3_ALPHA_NV 0x859B\n\n#define GLEW_NV_texture_env_combine4 GLEW_GET_VAR(__GLEW_NV_texture_env_combine4)\n\n#endif /* GL_NV_texture_env_combine4 */\n\n/* ---------------------- GL_NV_texture_expand_normal ---------------------- */\n\n#ifndef GL_NV_texture_expand_normal\n#define GL_NV_texture_expand_normal 1\n\n#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F\n\n#define GLEW_NV_texture_expand_normal GLEW_GET_VAR(__GLEW_NV_texture_expand_normal)\n\n#endif /* GL_NV_texture_expand_normal */\n\n/* ----------------------- GL_NV_texture_multisample ----------------------- */\n\n#ifndef GL_NV_texture_multisample\n#define GL_NV_texture_multisample 1\n\n#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045\n#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046\n\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\n\n#define glTexImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage2DMultisampleCoverageNV)\n#define glTexImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage3DMultisampleCoverageNV)\n#define glTextureImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage2DMultisampleCoverageNV)\n#define glTextureImage2DMultisampleNV GLEW_GET_FUN(__glewTextureImage2DMultisampleNV)\n#define glTextureImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage3DMultisampleCoverageNV)\n#define glTextureImage3DMultisampleNV GLEW_GET_FUN(__glewTextureImage3DMultisampleNV)\n\n#define GLEW_NV_texture_multisample GLEW_GET_VAR(__GLEW_NV_texture_multisample)\n\n#endif /* GL_NV_texture_multisample */\n\n/* ------------------------ GL_NV_texture_rectangle ------------------------ */\n\n#ifndef GL_NV_texture_rectangle\n#define GL_NV_texture_rectangle 1\n\n#define GL_TEXTURE_RECTANGLE_NV 0x84F5\n#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6\n#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8\n\n#define GLEW_NV_texture_rectangle GLEW_GET_VAR(__GLEW_NV_texture_rectangle)\n\n#endif /* GL_NV_texture_rectangle */\n\n/* -------------------------- GL_NV_texture_shader ------------------------- */\n\n#ifndef GL_NV_texture_shader\n#define GL_NV_texture_shader 1\n\n#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C\n#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D\n#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E\n#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9\n#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA\n#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB\n#define GL_DSDT_MAG_INTENSITY_NV 0x86DC\n#define GL_SHADER_CONSISTENT_NV 0x86DD\n#define GL_TEXTURE_SHADER_NV 0x86DE\n#define GL_SHADER_OPERATION_NV 0x86DF\n#define GL_CULL_MODES_NV 0x86E0\n#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1\n#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1\n#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2\n#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2\n#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3\n#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3\n#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4\n#define GL_CONST_EYE_NV 0x86E5\n#define GL_PASS_THROUGH_NV 0x86E6\n#define GL_CULL_FRAGMENT_NV 0x86E7\n#define GL_OFFSET_TEXTURE_2D_NV 0x86E8\n#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9\n#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA\n#define GL_DOT_PRODUCT_NV 0x86EC\n#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED\n#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE\n#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0\n#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1\n#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2\n#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3\n#define GL_HILO_NV 0x86F4\n#define GL_DSDT_NV 0x86F5\n#define GL_DSDT_MAG_NV 0x86F6\n#define GL_DSDT_MAG_VIB_NV 0x86F7\n#define GL_HILO16_NV 0x86F8\n#define GL_SIGNED_HILO_NV 0x86F9\n#define GL_SIGNED_HILO16_NV 0x86FA\n#define GL_SIGNED_RGBA_NV 0x86FB\n#define GL_SIGNED_RGBA8_NV 0x86FC\n#define GL_SIGNED_RGB_NV 0x86FE\n#define GL_SIGNED_RGB8_NV 0x86FF\n#define GL_SIGNED_LUMINANCE_NV 0x8701\n#define GL_SIGNED_LUMINANCE8_NV 0x8702\n#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703\n#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704\n#define GL_SIGNED_ALPHA_NV 0x8705\n#define GL_SIGNED_ALPHA8_NV 0x8706\n#define GL_SIGNED_INTENSITY_NV 0x8707\n#define GL_SIGNED_INTENSITY8_NV 0x8708\n#define GL_DSDT8_NV 0x8709\n#define GL_DSDT8_MAG8_NV 0x870A\n#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B\n#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C\n#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D\n#define GL_HI_SCALE_NV 0x870E\n#define GL_LO_SCALE_NV 0x870F\n#define GL_DS_SCALE_NV 0x8710\n#define GL_DT_SCALE_NV 0x8711\n#define GL_MAGNITUDE_SCALE_NV 0x8712\n#define GL_VIBRANCE_SCALE_NV 0x8713\n#define GL_HI_BIAS_NV 0x8714\n#define GL_LO_BIAS_NV 0x8715\n#define GL_DS_BIAS_NV 0x8716\n#define GL_DT_BIAS_NV 0x8717\n#define GL_MAGNITUDE_BIAS_NV 0x8718\n#define GL_VIBRANCE_BIAS_NV 0x8719\n#define GL_TEXTURE_BORDER_VALUES_NV 0x871A\n#define GL_TEXTURE_HI_SIZE_NV 0x871B\n#define GL_TEXTURE_LO_SIZE_NV 0x871C\n#define GL_TEXTURE_DS_SIZE_NV 0x871D\n#define GL_TEXTURE_DT_SIZE_NV 0x871E\n#define GL_TEXTURE_MAG_SIZE_NV 0x871F\n\n#define GLEW_NV_texture_shader GLEW_GET_VAR(__GLEW_NV_texture_shader)\n\n#endif /* GL_NV_texture_shader */\n\n/* ------------------------- GL_NV_texture_shader2 ------------------------- */\n\n#ifndef GL_NV_texture_shader2\n#define GL_NV_texture_shader2 1\n\n#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA\n#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB\n#define GL_DSDT_MAG_INTENSITY_NV 0x86DC\n#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF\n#define GL_HILO_NV 0x86F4\n#define GL_DSDT_NV 0x86F5\n#define GL_DSDT_MAG_NV 0x86F6\n#define GL_DSDT_MAG_VIB_NV 0x86F7\n#define GL_HILO16_NV 0x86F8\n#define GL_SIGNED_HILO_NV 0x86F9\n#define GL_SIGNED_HILO16_NV 0x86FA\n#define GL_SIGNED_RGBA_NV 0x86FB\n#define GL_SIGNED_RGBA8_NV 0x86FC\n#define GL_SIGNED_RGB_NV 0x86FE\n#define GL_SIGNED_RGB8_NV 0x86FF\n#define GL_SIGNED_LUMINANCE_NV 0x8701\n#define GL_SIGNED_LUMINANCE8_NV 0x8702\n#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703\n#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704\n#define GL_SIGNED_ALPHA_NV 0x8705\n#define GL_SIGNED_ALPHA8_NV 0x8706\n#define GL_SIGNED_INTENSITY_NV 0x8707\n#define GL_SIGNED_INTENSITY8_NV 0x8708\n#define GL_DSDT8_NV 0x8709\n#define GL_DSDT8_MAG8_NV 0x870A\n#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B\n#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C\n#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D\n\n#define GLEW_NV_texture_shader2 GLEW_GET_VAR(__GLEW_NV_texture_shader2)\n\n#endif /* GL_NV_texture_shader2 */\n\n/* ------------------------- GL_NV_texture_shader3 ------------------------- */\n\n#ifndef GL_NV_texture_shader3\n#define GL_NV_texture_shader3 1\n\n#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850\n#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851\n#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852\n#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853\n#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854\n#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855\n#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856\n#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857\n#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858\n#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859\n#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A\n#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B\n#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C\n#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D\n#define GL_HILO8_NV 0x885E\n#define GL_SIGNED_HILO8_NV 0x885F\n#define GL_FORCE_BLUE_TO_ONE_NV 0x8860\n\n#define GLEW_NV_texture_shader3 GLEW_GET_VAR(__GLEW_NV_texture_shader3)\n\n#endif /* GL_NV_texture_shader3 */\n\n/* ------------------------ GL_NV_transform_feedback ----------------------- */\n\n#ifndef GL_NV_transform_feedback\n#define GL_NV_transform_feedback 1\n\n#define GL_BACK_PRIMARY_COLOR_NV 0x8C77\n#define GL_BACK_SECONDARY_COLOR_NV 0x8C78\n#define GL_TEXTURE_COORD_NV 0x8C79\n#define GL_CLIP_DISTANCE_NV 0x8C7A\n#define GL_VERTEX_ID_NV 0x8C7B\n#define GL_PRIMITIVE_ID_NV 0x8C7C\n#define GL_GENERIC_ATTRIB_NV 0x8C7D\n#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80\n#define GL_ACTIVE_VARYINGS_NV 0x8C81\n#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82\n#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85\n#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86\n#define GL_PRIMITIVES_GENERATED_NV 0x8C87\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88\n#define GL_RASTERIZER_DISCARD_NV 0x8C89\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B\n#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C\n#define GL_SEPARATE_ATTRIBS_NV 0x8C8D\n#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F\n\ntypedef void (GLAPIENTRY * PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\ntypedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);\ntypedef GLint (GLAPIENTRY * PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);\n\n#define glActiveVaryingNV GLEW_GET_FUN(__glewActiveVaryingNV)\n#define glBeginTransformFeedbackNV GLEW_GET_FUN(__glewBeginTransformFeedbackNV)\n#define glBindBufferBaseNV GLEW_GET_FUN(__glewBindBufferBaseNV)\n#define glBindBufferOffsetNV GLEW_GET_FUN(__glewBindBufferOffsetNV)\n#define glBindBufferRangeNV GLEW_GET_FUN(__glewBindBufferRangeNV)\n#define glEndTransformFeedbackNV GLEW_GET_FUN(__glewEndTransformFeedbackNV)\n#define glGetActiveVaryingNV GLEW_GET_FUN(__glewGetActiveVaryingNV)\n#define glGetTransformFeedbackVaryingNV GLEW_GET_FUN(__glewGetTransformFeedbackVaryingNV)\n#define glGetVaryingLocationNV GLEW_GET_FUN(__glewGetVaryingLocationNV)\n#define glTransformFeedbackAttribsNV GLEW_GET_FUN(__glewTransformFeedbackAttribsNV)\n#define glTransformFeedbackVaryingsNV GLEW_GET_FUN(__glewTransformFeedbackVaryingsNV)\n\n#define GLEW_NV_transform_feedback GLEW_GET_VAR(__GLEW_NV_transform_feedback)\n\n#endif /* GL_NV_transform_feedback */\n\n/* ----------------------- GL_NV_transform_feedback2 ----------------------- */\n\n#ifndef GL_NV_transform_feedback2\n#define GL_NV_transform_feedback2 1\n\n#define GL_TRANSFORM_FEEDBACK_NV 0x8E22\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24\n#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25\n\ntypedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint* ids);\ntypedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);\n\n#define glBindTransformFeedbackNV GLEW_GET_FUN(__glewBindTransformFeedbackNV)\n#define glDeleteTransformFeedbacksNV GLEW_GET_FUN(__glewDeleteTransformFeedbacksNV)\n#define glDrawTransformFeedbackNV GLEW_GET_FUN(__glewDrawTransformFeedbackNV)\n#define glGenTransformFeedbacksNV GLEW_GET_FUN(__glewGenTransformFeedbacksNV)\n#define glIsTransformFeedbackNV GLEW_GET_FUN(__glewIsTransformFeedbackNV)\n#define glPauseTransformFeedbackNV GLEW_GET_FUN(__glewPauseTransformFeedbackNV)\n#define glResumeTransformFeedbackNV GLEW_GET_FUN(__glewResumeTransformFeedbackNV)\n\n#define GLEW_NV_transform_feedback2 GLEW_GET_VAR(__GLEW_NV_transform_feedback2)\n\n#endif /* GL_NV_transform_feedback2 */\n\n/* -------------------------- GL_NV_vdpau_interop -------------------------- */\n\n#ifndef GL_NV_vdpau_interop\n#define GL_NV_vdpau_interop 1\n\n#define GL_SURFACE_STATE_NV 0x86EB\n#define GL_SURFACE_REGISTERED_NV 0x86FD\n#define GL_SURFACE_MAPPED_NV 0x8700\n#define GL_WRITE_DISCARD_NV 0x88BE\n\ntypedef GLintptr GLvdpauSurfaceNV;\n\ntypedef void (GLAPIENTRY * PFNGLVDPAUFININVPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei* length, GLint *values);\ntypedef void (GLAPIENTRY * PFNGLVDPAUINITNVPROC) (const void* vdpDevice, const GLvoid*getProcAddress);\ntypedef void (GLAPIENTRY * PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);\ntypedef void (GLAPIENTRY * PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV* surfaces);\ntypedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\ntypedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\ntypedef void (GLAPIENTRY * PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);\ntypedef void (GLAPIENTRY * PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV* surfaces);\ntypedef void (GLAPIENTRY * PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);\n\n#define glVDPAUFiniNV GLEW_GET_FUN(__glewVDPAUFiniNV)\n#define glVDPAUGetSurfaceivNV GLEW_GET_FUN(__glewVDPAUGetSurfaceivNV)\n#define glVDPAUInitNV GLEW_GET_FUN(__glewVDPAUInitNV)\n#define glVDPAUIsSurfaceNV GLEW_GET_FUN(__glewVDPAUIsSurfaceNV)\n#define glVDPAUMapSurfacesNV GLEW_GET_FUN(__glewVDPAUMapSurfacesNV)\n#define glVDPAURegisterOutputSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterOutputSurfaceNV)\n#define glVDPAURegisterVideoSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterVideoSurfaceNV)\n#define glVDPAUSurfaceAccessNV GLEW_GET_FUN(__glewVDPAUSurfaceAccessNV)\n#define glVDPAUUnmapSurfacesNV GLEW_GET_FUN(__glewVDPAUUnmapSurfacesNV)\n#define glVDPAUUnregisterSurfaceNV GLEW_GET_FUN(__glewVDPAUUnregisterSurfaceNV)\n\n#define GLEW_NV_vdpau_interop GLEW_GET_VAR(__GLEW_NV_vdpau_interop)\n\n#endif /* GL_NV_vdpau_interop */\n\n/* ------------------------ GL_NV_vertex_array_range ----------------------- */\n\n#ifndef GL_NV_vertex_array_range\n#define GL_NV_vertex_array_range 1\n\n#define GL_VERTEX_ARRAY_RANGE_NV 0x851D\n#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E\n#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F\n#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520\n#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521\n\ntypedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, void* pointer);\n\n#define glFlushVertexArrayRangeNV GLEW_GET_FUN(__glewFlushVertexArrayRangeNV)\n#define glVertexArrayRangeNV GLEW_GET_FUN(__glewVertexArrayRangeNV)\n\n#define GLEW_NV_vertex_array_range GLEW_GET_VAR(__GLEW_NV_vertex_array_range)\n\n#endif /* GL_NV_vertex_array_range */\n\n/* ----------------------- GL_NV_vertex_array_range2 ----------------------- */\n\n#ifndef GL_NV_vertex_array_range2\n#define GL_NV_vertex_array_range2 1\n\n#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533\n\n#define GLEW_NV_vertex_array_range2 GLEW_GET_VAR(__GLEW_NV_vertex_array_range2)\n\n#endif /* GL_NV_vertex_array_range2 */\n\n/* ------------------- GL_NV_vertex_attrib_integer_64bit ------------------- */\n\n#ifndef GL_NV_vertex_attrib_integer_64bit\n#define GL_NV_vertex_attrib_integer_64bit 1\n\n#define GL_INT64_NV 0x140E\n#define GL_UNSIGNED_INT64_NV 0x140F\n\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT* params);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);\n\n#define glGetVertexAttribLi64vNV GLEW_GET_FUN(__glewGetVertexAttribLi64vNV)\n#define glGetVertexAttribLui64vNV GLEW_GET_FUN(__glewGetVertexAttribLui64vNV)\n#define glVertexAttribL1i64NV GLEW_GET_FUN(__glewVertexAttribL1i64NV)\n#define glVertexAttribL1i64vNV GLEW_GET_FUN(__glewVertexAttribL1i64vNV)\n#define glVertexAttribL1ui64NV GLEW_GET_FUN(__glewVertexAttribL1ui64NV)\n#define glVertexAttribL1ui64vNV GLEW_GET_FUN(__glewVertexAttribL1ui64vNV)\n#define glVertexAttribL2i64NV GLEW_GET_FUN(__glewVertexAttribL2i64NV)\n#define glVertexAttribL2i64vNV GLEW_GET_FUN(__glewVertexAttribL2i64vNV)\n#define glVertexAttribL2ui64NV GLEW_GET_FUN(__glewVertexAttribL2ui64NV)\n#define glVertexAttribL2ui64vNV GLEW_GET_FUN(__glewVertexAttribL2ui64vNV)\n#define glVertexAttribL3i64NV GLEW_GET_FUN(__glewVertexAttribL3i64NV)\n#define glVertexAttribL3i64vNV GLEW_GET_FUN(__glewVertexAttribL3i64vNV)\n#define glVertexAttribL3ui64NV GLEW_GET_FUN(__glewVertexAttribL3ui64NV)\n#define glVertexAttribL3ui64vNV GLEW_GET_FUN(__glewVertexAttribL3ui64vNV)\n#define glVertexAttribL4i64NV GLEW_GET_FUN(__glewVertexAttribL4i64NV)\n#define glVertexAttribL4i64vNV GLEW_GET_FUN(__glewVertexAttribL4i64vNV)\n#define glVertexAttribL4ui64NV GLEW_GET_FUN(__glewVertexAttribL4ui64NV)\n#define glVertexAttribL4ui64vNV GLEW_GET_FUN(__glewVertexAttribL4ui64vNV)\n#define glVertexAttribLFormatNV GLEW_GET_FUN(__glewVertexAttribLFormatNV)\n\n#define GLEW_NV_vertex_attrib_integer_64bit GLEW_GET_VAR(__GLEW_NV_vertex_attrib_integer_64bit)\n\n#endif /* GL_NV_vertex_attrib_integer_64bit */\n\n/* ------------------- GL_NV_vertex_buffer_unified_memory ------------------ */\n\n#ifndef GL_NV_vertex_buffer_unified_memory\n#define GL_NV_vertex_buffer_unified_memory 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E\n#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F\n#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20\n#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21\n#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22\n#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23\n#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24\n#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25\n#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26\n#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27\n#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28\n#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29\n#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A\n#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B\n#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C\n#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D\n#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E\n#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F\n#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30\n#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31\n#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32\n#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33\n#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40\n#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41\n#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42\n\ntypedef void (GLAPIENTRY * PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);\ntypedef void (GLAPIENTRY * PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT result[]);\ntypedef void (GLAPIENTRY * PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);\ntypedef void (GLAPIENTRY * PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\n\n#define glBufferAddressRangeNV GLEW_GET_FUN(__glewBufferAddressRangeNV)\n#define glColorFormatNV GLEW_GET_FUN(__glewColorFormatNV)\n#define glEdgeFlagFormatNV GLEW_GET_FUN(__glewEdgeFlagFormatNV)\n#define glFogCoordFormatNV GLEW_GET_FUN(__glewFogCoordFormatNV)\n#define glGetIntegerui64i_vNV GLEW_GET_FUN(__glewGetIntegerui64i_vNV)\n#define glIndexFormatNV GLEW_GET_FUN(__glewIndexFormatNV)\n#define glNormalFormatNV GLEW_GET_FUN(__glewNormalFormatNV)\n#define glSecondaryColorFormatNV GLEW_GET_FUN(__glewSecondaryColorFormatNV)\n#define glTexCoordFormatNV GLEW_GET_FUN(__glewTexCoordFormatNV)\n#define glVertexAttribFormatNV GLEW_GET_FUN(__glewVertexAttribFormatNV)\n#define glVertexAttribIFormatNV GLEW_GET_FUN(__glewVertexAttribIFormatNV)\n#define glVertexFormatNV GLEW_GET_FUN(__glewVertexFormatNV)\n\n#define GLEW_NV_vertex_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_vertex_buffer_unified_memory)\n\n#endif /* GL_NV_vertex_buffer_unified_memory */\n\n/* -------------------------- GL_NV_vertex_program ------------------------- */\n\n#ifndef GL_NV_vertex_program\n#define GL_NV_vertex_program 1\n\n#define GL_VERTEX_PROGRAM_NV 0x8620\n#define GL_VERTEX_STATE_PROGRAM_NV 0x8621\n#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623\n#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624\n#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625\n#define GL_CURRENT_ATTRIB_NV 0x8626\n#define GL_PROGRAM_LENGTH_NV 0x8627\n#define GL_PROGRAM_STRING_NV 0x8628\n#define GL_MODELVIEW_PROJECTION_NV 0x8629\n#define GL_IDENTITY_NV 0x862A\n#define GL_INVERSE_NV 0x862B\n#define GL_TRANSPOSE_NV 0x862C\n#define GL_INVERSE_TRANSPOSE_NV 0x862D\n#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E\n#define GL_MAX_TRACK_MATRICES_NV 0x862F\n#define GL_MATRIX0_NV 0x8630\n#define GL_MATRIX1_NV 0x8631\n#define GL_MATRIX2_NV 0x8632\n#define GL_MATRIX3_NV 0x8633\n#define GL_MATRIX4_NV 0x8634\n#define GL_MATRIX5_NV 0x8635\n#define GL_MATRIX6_NV 0x8636\n#define GL_MATRIX7_NV 0x8637\n#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640\n#define GL_CURRENT_MATRIX_NV 0x8641\n#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642\n#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643\n#define GL_PROGRAM_PARAMETER_NV 0x8644\n#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645\n#define GL_PROGRAM_TARGET_NV 0x8646\n#define GL_PROGRAM_RESIDENT_NV 0x8647\n#define GL_TRACK_MATRIX_NV 0x8648\n#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649\n#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A\n#define GL_PROGRAM_ERROR_POSITION_NV 0x864B\n#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650\n#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651\n#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652\n#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653\n#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654\n#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655\n#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656\n#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657\n#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658\n#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659\n#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A\n#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B\n#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C\n#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D\n#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E\n#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F\n#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660\n#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661\n#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662\n#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663\n#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664\n#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665\n#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666\n#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667\n#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668\n#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669\n#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A\n#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B\n#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C\n#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D\n#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E\n#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F\n#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670\n#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671\n#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672\n#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673\n#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674\n#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675\n#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676\n#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677\n#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678\n#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679\n#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A\n#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B\n#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C\n#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D\n#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E\n#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F\n\ntypedef GLboolean (GLAPIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint* ids, GLboolean *residences);\ntypedef void (GLAPIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte* program);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid** pointer);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id);\ntypedef void (GLAPIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte* program);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei n, const GLubyte* v);\n\n#define glAreProgramsResidentNV GLEW_GET_FUN(__glewAreProgramsResidentNV)\n#define glBindProgramNV GLEW_GET_FUN(__glewBindProgramNV)\n#define glDeleteProgramsNV GLEW_GET_FUN(__glewDeleteProgramsNV)\n#define glExecuteProgramNV GLEW_GET_FUN(__glewExecuteProgramNV)\n#define glGenProgramsNV GLEW_GET_FUN(__glewGenProgramsNV)\n#define glGetProgramParameterdvNV GLEW_GET_FUN(__glewGetProgramParameterdvNV)\n#define glGetProgramParameterfvNV GLEW_GET_FUN(__glewGetProgramParameterfvNV)\n#define glGetProgramStringNV GLEW_GET_FUN(__glewGetProgramStringNV)\n#define glGetProgramivNV GLEW_GET_FUN(__glewGetProgramivNV)\n#define glGetTrackMatrixivNV GLEW_GET_FUN(__glewGetTrackMatrixivNV)\n#define glGetVertexAttribPointervNV GLEW_GET_FUN(__glewGetVertexAttribPointervNV)\n#define glGetVertexAttribdvNV GLEW_GET_FUN(__glewGetVertexAttribdvNV)\n#define glGetVertexAttribfvNV GLEW_GET_FUN(__glewGetVertexAttribfvNV)\n#define glGetVertexAttribivNV GLEW_GET_FUN(__glewGetVertexAttribivNV)\n#define glIsProgramNV GLEW_GET_FUN(__glewIsProgramNV)\n#define glLoadProgramNV GLEW_GET_FUN(__glewLoadProgramNV)\n#define glProgramParameter4dNV GLEW_GET_FUN(__glewProgramParameter4dNV)\n#define glProgramParameter4dvNV GLEW_GET_FUN(__glewProgramParameter4dvNV)\n#define glProgramParameter4fNV GLEW_GET_FUN(__glewProgramParameter4fNV)\n#define glProgramParameter4fvNV GLEW_GET_FUN(__glewProgramParameter4fvNV)\n#define glProgramParameters4dvNV GLEW_GET_FUN(__glewProgramParameters4dvNV)\n#define glProgramParameters4fvNV GLEW_GET_FUN(__glewProgramParameters4fvNV)\n#define glRequestResidentProgramsNV GLEW_GET_FUN(__glewRequestResidentProgramsNV)\n#define glTrackMatrixNV GLEW_GET_FUN(__glewTrackMatrixNV)\n#define glVertexAttrib1dNV GLEW_GET_FUN(__glewVertexAttrib1dNV)\n#define glVertexAttrib1dvNV GLEW_GET_FUN(__glewVertexAttrib1dvNV)\n#define glVertexAttrib1fNV GLEW_GET_FUN(__glewVertexAttrib1fNV)\n#define glVertexAttrib1fvNV GLEW_GET_FUN(__glewVertexAttrib1fvNV)\n#define glVertexAttrib1sNV GLEW_GET_FUN(__glewVertexAttrib1sNV)\n#define glVertexAttrib1svNV GLEW_GET_FUN(__glewVertexAttrib1svNV)\n#define glVertexAttrib2dNV GLEW_GET_FUN(__glewVertexAttrib2dNV)\n#define glVertexAttrib2dvNV GLEW_GET_FUN(__glewVertexAttrib2dvNV)\n#define glVertexAttrib2fNV GLEW_GET_FUN(__glewVertexAttrib2fNV)\n#define glVertexAttrib2fvNV GLEW_GET_FUN(__glewVertexAttrib2fvNV)\n#define glVertexAttrib2sNV GLEW_GET_FUN(__glewVertexAttrib2sNV)\n#define glVertexAttrib2svNV GLEW_GET_FUN(__glewVertexAttrib2svNV)\n#define glVertexAttrib3dNV GLEW_GET_FUN(__glewVertexAttrib3dNV)\n#define glVertexAttrib3dvNV GLEW_GET_FUN(__glewVertexAttrib3dvNV)\n#define glVertexAttrib3fNV GLEW_GET_FUN(__glewVertexAttrib3fNV)\n#define glVertexAttrib3fvNV GLEW_GET_FUN(__glewVertexAttrib3fvNV)\n#define glVertexAttrib3sNV GLEW_GET_FUN(__glewVertexAttrib3sNV)\n#define glVertexAttrib3svNV GLEW_GET_FUN(__glewVertexAttrib3svNV)\n#define glVertexAttrib4dNV GLEW_GET_FUN(__glewVertexAttrib4dNV)\n#define glVertexAttrib4dvNV GLEW_GET_FUN(__glewVertexAttrib4dvNV)\n#define glVertexAttrib4fNV GLEW_GET_FUN(__glewVertexAttrib4fNV)\n#define glVertexAttrib4fvNV GLEW_GET_FUN(__glewVertexAttrib4fvNV)\n#define glVertexAttrib4sNV GLEW_GET_FUN(__glewVertexAttrib4sNV)\n#define glVertexAttrib4svNV GLEW_GET_FUN(__glewVertexAttrib4svNV)\n#define glVertexAttrib4ubNV GLEW_GET_FUN(__glewVertexAttrib4ubNV)\n#define glVertexAttrib4ubvNV GLEW_GET_FUN(__glewVertexAttrib4ubvNV)\n#define glVertexAttribPointerNV GLEW_GET_FUN(__glewVertexAttribPointerNV)\n#define glVertexAttribs1dvNV GLEW_GET_FUN(__glewVertexAttribs1dvNV)\n#define glVertexAttribs1fvNV GLEW_GET_FUN(__glewVertexAttribs1fvNV)\n#define glVertexAttribs1svNV GLEW_GET_FUN(__glewVertexAttribs1svNV)\n#define glVertexAttribs2dvNV GLEW_GET_FUN(__glewVertexAttribs2dvNV)\n#define glVertexAttribs2fvNV GLEW_GET_FUN(__glewVertexAttribs2fvNV)\n#define glVertexAttribs2svNV GLEW_GET_FUN(__glewVertexAttribs2svNV)\n#define glVertexAttribs3dvNV GLEW_GET_FUN(__glewVertexAttribs3dvNV)\n#define glVertexAttribs3fvNV GLEW_GET_FUN(__glewVertexAttribs3fvNV)\n#define glVertexAttribs3svNV GLEW_GET_FUN(__glewVertexAttribs3svNV)\n#define glVertexAttribs4dvNV GLEW_GET_FUN(__glewVertexAttribs4dvNV)\n#define glVertexAttribs4fvNV GLEW_GET_FUN(__glewVertexAttribs4fvNV)\n#define glVertexAttribs4svNV GLEW_GET_FUN(__glewVertexAttribs4svNV)\n#define glVertexAttribs4ubvNV GLEW_GET_FUN(__glewVertexAttribs4ubvNV)\n\n#define GLEW_NV_vertex_program GLEW_GET_VAR(__GLEW_NV_vertex_program)\n\n#endif /* GL_NV_vertex_program */\n\n/* ------------------------ GL_NV_vertex_program1_1 ------------------------ */\n\n#ifndef GL_NV_vertex_program1_1\n#define GL_NV_vertex_program1_1 1\n\n#define GLEW_NV_vertex_program1_1 GLEW_GET_VAR(__GLEW_NV_vertex_program1_1)\n\n#endif /* GL_NV_vertex_program1_1 */\n\n/* ------------------------- GL_NV_vertex_program2 ------------------------- */\n\n#ifndef GL_NV_vertex_program2\n#define GL_NV_vertex_program2 1\n\n#define GLEW_NV_vertex_program2 GLEW_GET_VAR(__GLEW_NV_vertex_program2)\n\n#endif /* GL_NV_vertex_program2 */\n\n/* ---------------------- GL_NV_vertex_program2_option --------------------- */\n\n#ifndef GL_NV_vertex_program2_option\n#define GL_NV_vertex_program2_option 1\n\n#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4\n#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5\n\n#define GLEW_NV_vertex_program2_option GLEW_GET_VAR(__GLEW_NV_vertex_program2_option)\n\n#endif /* GL_NV_vertex_program2_option */\n\n/* ------------------------- GL_NV_vertex_program3 ------------------------- */\n\n#ifndef GL_NV_vertex_program3\n#define GL_NV_vertex_program3 1\n\n#define MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C\n\n#define GLEW_NV_vertex_program3 GLEW_GET_VAR(__GLEW_NV_vertex_program3)\n\n#endif /* GL_NV_vertex_program3 */\n\n/* ------------------------- GL_NV_vertex_program4 ------------------------- */\n\n#ifndef GL_NV_vertex_program4\n#define GL_NV_vertex_program4 1\n\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD\n\n#define GLEW_NV_vertex_program4 GLEW_GET_VAR(__GLEW_NV_vertex_program4)\n\n#endif /* GL_NV_vertex_program4 */\n\n/* -------------------------- GL_NV_video_capture -------------------------- */\n\n#ifndef GL_NV_video_capture\n#define GL_NV_video_capture 1\n\n#define GL_VIDEO_BUFFER_NV 0x9020\n#define GL_VIDEO_BUFFER_BINDING_NV 0x9021\n#define GL_FIELD_UPPER_NV 0x9022\n#define GL_FIELD_LOWER_NV 0x9023\n#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024\n#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025\n#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026\n#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027\n#define GL_VIDEO_BUFFER_PITCH_NV 0x9028\n#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029\n#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A\n#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B\n#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C\n#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D\n#define GL_PARTIAL_SUCCESS_NV 0x902E\n#define GL_SUCCESS_NV 0x902F\n#define GL_FAILURE_NV 0x9030\n#define GL_YCBYCR8_422_NV 0x9031\n#define GL_YCBAYCR8A_4224_NV 0x9032\n#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033\n#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034\n#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035\n#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036\n#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037\n#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038\n#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039\n#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A\n#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B\n#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C\n\ntypedef void (GLAPIENTRY * PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);\ntypedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);\ntypedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);\ntypedef void (GLAPIENTRY * PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint* params);\ntypedef GLenum (GLAPIENTRY * PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT *capture_time);\ntypedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params);\ntypedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params);\n\n#define glBeginVideoCaptureNV GLEW_GET_FUN(__glewBeginVideoCaptureNV)\n#define glBindVideoCaptureStreamBufferNV GLEW_GET_FUN(__glewBindVideoCaptureStreamBufferNV)\n#define glBindVideoCaptureStreamTextureNV GLEW_GET_FUN(__glewBindVideoCaptureStreamTextureNV)\n#define glEndVideoCaptureNV GLEW_GET_FUN(__glewEndVideoCaptureNV)\n#define glGetVideoCaptureStreamdvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamdvNV)\n#define glGetVideoCaptureStreamfvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamfvNV)\n#define glGetVideoCaptureStreamivNV GLEW_GET_FUN(__glewGetVideoCaptureStreamivNV)\n#define glGetVideoCaptureivNV GLEW_GET_FUN(__glewGetVideoCaptureivNV)\n#define glVideoCaptureNV GLEW_GET_FUN(__glewVideoCaptureNV)\n#define glVideoCaptureStreamParameterdvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterdvNV)\n#define glVideoCaptureStreamParameterfvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterfvNV)\n#define glVideoCaptureStreamParameterivNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterivNV)\n\n#define GLEW_NV_video_capture GLEW_GET_VAR(__GLEW_NV_video_capture)\n\n#endif /* GL_NV_video_capture */\n\n/* ------------------------ GL_OES_byte_coordinates ------------------------ */\n\n#ifndef GL_OES_byte_coordinates\n#define GL_OES_byte_coordinates 1\n\n#define GL_BYTE 0x1400\n\n#define GLEW_OES_byte_coordinates GLEW_GET_VAR(__GLEW_OES_byte_coordinates)\n\n#endif /* GL_OES_byte_coordinates */\n\n/* ------------------- GL_OES_compressed_paletted_texture ------------------ */\n\n#ifndef GL_OES_compressed_paletted_texture\n#define GL_OES_compressed_paletted_texture 1\n\n#define GL_PALETTE4_RGB8_OES 0x8B90\n#define GL_PALETTE4_RGBA8_OES 0x8B91\n#define GL_PALETTE4_R5_G6_B5_OES 0x8B92\n#define GL_PALETTE4_RGBA4_OES 0x8B93\n#define GL_PALETTE4_RGB5_A1_OES 0x8B94\n#define GL_PALETTE8_RGB8_OES 0x8B95\n#define GL_PALETTE8_RGBA8_OES 0x8B96\n#define GL_PALETTE8_R5_G6_B5_OES 0x8B97\n#define GL_PALETTE8_RGBA4_OES 0x8B98\n#define GL_PALETTE8_RGB5_A1_OES 0x8B99\n\n#define GLEW_OES_compressed_paletted_texture GLEW_GET_VAR(__GLEW_OES_compressed_paletted_texture)\n\n#endif /* GL_OES_compressed_paletted_texture */\n\n/* --------------------------- GL_OES_read_format -------------------------- */\n\n#ifndef GL_OES_read_format\n#define GL_OES_read_format 1\n\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B\n\n#define GLEW_OES_read_format GLEW_GET_VAR(__GLEW_OES_read_format)\n\n#endif /* GL_OES_read_format */\n\n/* ------------------------ GL_OES_single_precision ------------------------ */\n\n#ifndef GL_OES_single_precision\n#define GL_OES_single_precision 1\n\ntypedef void (GLAPIENTRY * PFNGLCLEARDEPTHFOESPROC) (GLclampd depth);\ntypedef void (GLAPIENTRY * PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat* equation);\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);\ntypedef void (GLAPIENTRY * PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\ntypedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat* equation);\ntypedef void (GLAPIENTRY * PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\n\n#define glClearDepthfOES GLEW_GET_FUN(__glewClearDepthfOES)\n#define glClipPlanefOES GLEW_GET_FUN(__glewClipPlanefOES)\n#define glDepthRangefOES GLEW_GET_FUN(__glewDepthRangefOES)\n#define glFrustumfOES GLEW_GET_FUN(__glewFrustumfOES)\n#define glGetClipPlanefOES GLEW_GET_FUN(__glewGetClipPlanefOES)\n#define glOrthofOES GLEW_GET_FUN(__glewOrthofOES)\n\n#define GLEW_OES_single_precision GLEW_GET_VAR(__GLEW_OES_single_precision)\n\n#endif /* GL_OES_single_precision */\n\n/* ---------------------------- GL_OML_interlace --------------------------- */\n\n#ifndef GL_OML_interlace\n#define GL_OML_interlace 1\n\n#define GL_INTERLACE_OML 0x8980\n#define GL_INTERLACE_READ_OML 0x8981\n\n#define GLEW_OML_interlace GLEW_GET_VAR(__GLEW_OML_interlace)\n\n#endif /* GL_OML_interlace */\n\n/* ---------------------------- GL_OML_resample ---------------------------- */\n\n#ifndef GL_OML_resample\n#define GL_OML_resample 1\n\n#define GL_PACK_RESAMPLE_OML 0x8984\n#define GL_UNPACK_RESAMPLE_OML 0x8985\n#define GL_RESAMPLE_REPLICATE_OML 0x8986\n#define GL_RESAMPLE_ZERO_FILL_OML 0x8987\n#define GL_RESAMPLE_AVERAGE_OML 0x8988\n#define GL_RESAMPLE_DECIMATE_OML 0x8989\n\n#define GLEW_OML_resample GLEW_GET_VAR(__GLEW_OML_resample)\n\n#endif /* GL_OML_resample */\n\n/* ---------------------------- GL_OML_subsample --------------------------- */\n\n#ifndef GL_OML_subsample\n#define GL_OML_subsample 1\n\n#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982\n#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983\n\n#define GLEW_OML_subsample GLEW_GET_VAR(__GLEW_OML_subsample)\n\n#endif /* GL_OML_subsample */\n\n/* --------------------------- GL_PGI_misc_hints --------------------------- */\n\n#ifndef GL_PGI_misc_hints\n#define GL_PGI_misc_hints 1\n\n#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000\n#define GL_CONSERVE_MEMORY_HINT_PGI 107005\n#define GL_RECLAIM_MEMORY_HINT_PGI 107006\n#define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010\n#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011\n#define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012\n#define GL_ALWAYS_FAST_HINT_PGI 107020\n#define GL_ALWAYS_SOFT_HINT_PGI 107021\n#define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022\n#define GL_ALLOW_DRAW_WIN_HINT_PGI 107023\n#define GL_ALLOW_DRAW_FRG_HINT_PGI 107024\n#define GL_ALLOW_DRAW_MEM_HINT_PGI 107025\n#define GL_STRICT_DEPTHFUNC_HINT_PGI 107030\n#define GL_STRICT_LIGHTING_HINT_PGI 107031\n#define GL_STRICT_SCISSOR_HINT_PGI 107032\n#define GL_FULL_STIPPLE_HINT_PGI 107033\n#define GL_CLIP_NEAR_HINT_PGI 107040\n#define GL_CLIP_FAR_HINT_PGI 107041\n#define GL_WIDE_LINE_HINT_PGI 107042\n#define GL_BACK_NORMALS_HINT_PGI 107043\n\n#define GLEW_PGI_misc_hints GLEW_GET_VAR(__GLEW_PGI_misc_hints)\n\n#endif /* GL_PGI_misc_hints */\n\n/* -------------------------- GL_PGI_vertex_hints -------------------------- */\n\n#ifndef GL_PGI_vertex_hints\n#define GL_PGI_vertex_hints 1\n\n#define GL_VERTEX23_BIT_PGI 0x00000004\n#define GL_VERTEX4_BIT_PGI 0x00000008\n#define GL_COLOR3_BIT_PGI 0x00010000\n#define GL_COLOR4_BIT_PGI 0x00020000\n#define GL_EDGEFLAG_BIT_PGI 0x00040000\n#define GL_INDEX_BIT_PGI 0x00080000\n#define GL_MAT_AMBIENT_BIT_PGI 0x00100000\n#define GL_VERTEX_DATA_HINT_PGI 107050\n#define GL_VERTEX_CONSISTENT_HINT_PGI 107051\n#define GL_MATERIAL_SIDE_HINT_PGI 107052\n#define GL_MAX_VERTEX_HINT_PGI 107053\n#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000\n#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000\n#define GL_MAT_EMISSION_BIT_PGI 0x00800000\n#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000\n#define GL_MAT_SHININESS_BIT_PGI 0x02000000\n#define GL_MAT_SPECULAR_BIT_PGI 0x04000000\n#define GL_NORMAL_BIT_PGI 0x08000000\n#define GL_TEXCOORD1_BIT_PGI 0x10000000\n#define GL_TEXCOORD2_BIT_PGI 0x20000000\n#define GL_TEXCOORD3_BIT_PGI 0x40000000\n#define GL_TEXCOORD4_BIT_PGI 0x80000000\n\n#define GLEW_PGI_vertex_hints GLEW_GET_VAR(__GLEW_PGI_vertex_hints)\n\n#endif /* GL_PGI_vertex_hints */\n\n/* ------------------------- GL_REGAL_error_string ------------------------- */\n\n#ifndef GL_REGAL_error_string\n#define GL_REGAL_error_string 1\n\ntypedef const GLchar* (GLAPIENTRY * PFNGLERRORSTRINGREGALPROC) (GLenum error);\n\n#define glErrorStringREGAL GLEW_GET_FUN(__glewErrorStringREGAL)\n\n#define GLEW_REGAL_error_string GLEW_GET_VAR(__GLEW_REGAL_error_string)\n\n#endif /* GL_REGAL_error_string */\n\n/* ------------------------ GL_REGAL_extension_query ----------------------- */\n\n#ifndef GL_REGAL_extension_query\n#define GL_REGAL_extension_query 1\n\ntypedef GLboolean (GLAPIENTRY * PFNGLGETEXTENSIONREGALPROC) (const GLchar* ext);\ntypedef GLboolean (GLAPIENTRY * PFNGLISSUPPORTEDREGALPROC) (const GLchar* ext);\n\n#define glGetExtensionREGAL GLEW_GET_FUN(__glewGetExtensionREGAL)\n#define glIsSupportedREGAL GLEW_GET_FUN(__glewIsSupportedREGAL)\n\n#define GLEW_REGAL_extension_query GLEW_GET_VAR(__GLEW_REGAL_extension_query)\n\n#endif /* GL_REGAL_extension_query */\n\n/* ------------------------------ GL_REGAL_log ----------------------------- */\n\n#ifndef GL_REGAL_log\n#define GL_REGAL_log 1\n\n#define GL_LOG_ERROR_REGAL 0x9319\n#define GL_LOG_WARNING_REGAL 0x931A\n#define GL_LOG_INFO_REGAL 0x931B\n#define GL_LOG_APP_REGAL 0x931C\n#define GL_LOG_DRIVER_REGAL 0x931D\n#define GL_LOG_INTERNAL_REGAL 0x931E\n#define GL_LOG_DEBUG_REGAL 0x931F\n#define GL_LOG_STATUS_REGAL 0x9320\n#define GL_LOG_HTTP_REGAL 0x9321\n\n#define GLEW_REGAL_log GLEW_GET_VAR(__GLEW_REGAL_log)\n\n#endif /* GL_REGAL_log */\n\n/* ----------------------- GL_REND_screen_coordinates ---------------------- */\n\n#ifndef GL_REND_screen_coordinates\n#define GL_REND_screen_coordinates 1\n\n#define GL_SCREEN_COORDINATES_REND 0x8490\n#define GL_INVERTED_SCREEN_W_REND 0x8491\n\n#define GLEW_REND_screen_coordinates GLEW_GET_VAR(__GLEW_REND_screen_coordinates)\n\n#endif /* GL_REND_screen_coordinates */\n\n/* ------------------------------- GL_S3_s3tc ------------------------------ */\n\n#ifndef GL_S3_s3tc\n#define GL_S3_s3tc 1\n\n#define GL_RGB_S3TC 0x83A0\n#define GL_RGB4_S3TC 0x83A1\n#define GL_RGBA_S3TC 0x83A2\n#define GL_RGBA4_S3TC 0x83A3\n#define GL_RGBA_DXT5_S3TC 0x83A4\n#define GL_RGBA4_DXT5_S3TC 0x83A5\n\n#define GLEW_S3_s3tc GLEW_GET_VAR(__GLEW_S3_s3tc)\n\n#endif /* GL_S3_s3tc */\n\n/* -------------------------- GL_SGIS_color_range -------------------------- */\n\n#ifndef GL_SGIS_color_range\n#define GL_SGIS_color_range 1\n\n#define GL_EXTENDED_RANGE_SGIS 0x85A5\n#define GL_MIN_RED_SGIS 0x85A6\n#define GL_MAX_RED_SGIS 0x85A7\n#define GL_MIN_GREEN_SGIS 0x85A8\n#define GL_MAX_GREEN_SGIS 0x85A9\n#define GL_MIN_BLUE_SGIS 0x85AA\n#define GL_MAX_BLUE_SGIS 0x85AB\n#define GL_MIN_ALPHA_SGIS 0x85AC\n#define GL_MAX_ALPHA_SGIS 0x85AD\n\n#define GLEW_SGIS_color_range GLEW_GET_VAR(__GLEW_SGIS_color_range)\n\n#endif /* GL_SGIS_color_range */\n\n/* ------------------------- GL_SGIS_detail_texture ------------------------ */\n\n#ifndef GL_SGIS_detail_texture\n#define GL_SGIS_detail_texture 1\n\ntypedef void (GLAPIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points);\ntypedef void (GLAPIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat* points);\n\n#define glDetailTexFuncSGIS GLEW_GET_FUN(__glewDetailTexFuncSGIS)\n#define glGetDetailTexFuncSGIS GLEW_GET_FUN(__glewGetDetailTexFuncSGIS)\n\n#define GLEW_SGIS_detail_texture GLEW_GET_VAR(__GLEW_SGIS_detail_texture)\n\n#endif /* GL_SGIS_detail_texture */\n\n/* -------------------------- GL_SGIS_fog_function ------------------------- */\n\n#ifndef GL_SGIS_fog_function\n#define GL_SGIS_fog_function 1\n\ntypedef void (GLAPIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat* points);\ntypedef void (GLAPIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat* points);\n\n#define glFogFuncSGIS GLEW_GET_FUN(__glewFogFuncSGIS)\n#define glGetFogFuncSGIS GLEW_GET_FUN(__glewGetFogFuncSGIS)\n\n#define GLEW_SGIS_fog_function GLEW_GET_VAR(__GLEW_SGIS_fog_function)\n\n#endif /* GL_SGIS_fog_function */\n\n/* ------------------------ GL_SGIS_generate_mipmap ------------------------ */\n\n#ifndef GL_SGIS_generate_mipmap\n#define GL_SGIS_generate_mipmap 1\n\n#define GL_GENERATE_MIPMAP_SGIS 0x8191\n#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192\n\n#define GLEW_SGIS_generate_mipmap GLEW_GET_VAR(__GLEW_SGIS_generate_mipmap)\n\n#endif /* GL_SGIS_generate_mipmap */\n\n/* -------------------------- GL_SGIS_multisample -------------------------- */\n\n#ifndef GL_SGIS_multisample\n#define GL_SGIS_multisample 1\n\n#define GL_MULTISAMPLE_SGIS 0x809D\n#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F\n#define GL_SAMPLE_MASK_SGIS 0x80A0\n#define GL_1PASS_SGIS 0x80A1\n#define GL_2PASS_0_SGIS 0x80A2\n#define GL_2PASS_1_SGIS 0x80A3\n#define GL_4PASS_0_SGIS 0x80A4\n#define GL_4PASS_1_SGIS 0x80A5\n#define GL_4PASS_2_SGIS 0x80A6\n#define GL_4PASS_3_SGIS 0x80A7\n#define GL_SAMPLE_BUFFERS_SGIS 0x80A8\n#define GL_SAMPLES_SGIS 0x80A9\n#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA\n#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB\n#define GL_SAMPLE_PATTERN_SGIS 0x80AC\n\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);\ntypedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);\n\n#define glSampleMaskSGIS GLEW_GET_FUN(__glewSampleMaskSGIS)\n#define glSamplePatternSGIS GLEW_GET_FUN(__glewSamplePatternSGIS)\n\n#define GLEW_SGIS_multisample GLEW_GET_VAR(__GLEW_SGIS_multisample)\n\n#endif /* GL_SGIS_multisample */\n\n/* ------------------------- GL_SGIS_pixel_texture ------------------------- */\n\n#ifndef GL_SGIS_pixel_texture\n#define GL_SGIS_pixel_texture 1\n\n#define GLEW_SGIS_pixel_texture GLEW_GET_VAR(__GLEW_SGIS_pixel_texture)\n\n#endif /* GL_SGIS_pixel_texture */\n\n/* ----------------------- GL_SGIS_point_line_texgen ----------------------- */\n\n#ifndef GL_SGIS_point_line_texgen\n#define GL_SGIS_point_line_texgen 1\n\n#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0\n#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1\n#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2\n#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3\n#define GL_EYE_POINT_SGIS 0x81F4\n#define GL_OBJECT_POINT_SGIS 0x81F5\n#define GL_EYE_LINE_SGIS 0x81F6\n#define GL_OBJECT_LINE_SGIS 0x81F7\n\n#define GLEW_SGIS_point_line_texgen GLEW_GET_VAR(__GLEW_SGIS_point_line_texgen)\n\n#endif /* GL_SGIS_point_line_texgen */\n\n/* ------------------------ GL_SGIS_sharpen_texture ------------------------ */\n\n#ifndef GL_SGIS_sharpen_texture\n#define GL_SGIS_sharpen_texture 1\n\ntypedef void (GLAPIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat* points);\ntypedef void (GLAPIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points);\n\n#define glGetSharpenTexFuncSGIS GLEW_GET_FUN(__glewGetSharpenTexFuncSGIS)\n#define glSharpenTexFuncSGIS GLEW_GET_FUN(__glewSharpenTexFuncSGIS)\n\n#define GLEW_SGIS_sharpen_texture GLEW_GET_VAR(__GLEW_SGIS_sharpen_texture)\n\n#endif /* GL_SGIS_sharpen_texture */\n\n/* --------------------------- GL_SGIS_texture4D --------------------------- */\n\n#ifndef GL_SGIS_texture4D\n#define GL_SGIS_texture4D 1\n\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void* pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void* pixels);\n\n#define glTexImage4DSGIS GLEW_GET_FUN(__glewTexImage4DSGIS)\n#define glTexSubImage4DSGIS GLEW_GET_FUN(__glewTexSubImage4DSGIS)\n\n#define GLEW_SGIS_texture4D GLEW_GET_VAR(__GLEW_SGIS_texture4D)\n\n#endif /* GL_SGIS_texture4D */\n\n/* ---------------------- GL_SGIS_texture_border_clamp --------------------- */\n\n#ifndef GL_SGIS_texture_border_clamp\n#define GL_SGIS_texture_border_clamp 1\n\n#define GL_CLAMP_TO_BORDER_SGIS 0x812D\n\n#define GLEW_SGIS_texture_border_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_border_clamp)\n\n#endif /* GL_SGIS_texture_border_clamp */\n\n/* ----------------------- GL_SGIS_texture_edge_clamp ---------------------- */\n\n#ifndef GL_SGIS_texture_edge_clamp\n#define GL_SGIS_texture_edge_clamp 1\n\n#define GL_CLAMP_TO_EDGE_SGIS 0x812F\n\n#define GLEW_SGIS_texture_edge_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_edge_clamp)\n\n#endif /* GL_SGIS_texture_edge_clamp */\n\n/* ------------------------ GL_SGIS_texture_filter4 ------------------------ */\n\n#ifndef GL_SGIS_texture_filter4\n#define GL_SGIS_texture_filter4 1\n\ntypedef void (GLAPIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat* weights);\ntypedef void (GLAPIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat* weights);\n\n#define glGetTexFilterFuncSGIS GLEW_GET_FUN(__glewGetTexFilterFuncSGIS)\n#define glTexFilterFuncSGIS GLEW_GET_FUN(__glewTexFilterFuncSGIS)\n\n#define GLEW_SGIS_texture_filter4 GLEW_GET_VAR(__GLEW_SGIS_texture_filter4)\n\n#endif /* GL_SGIS_texture_filter4 */\n\n/* -------------------------- GL_SGIS_texture_lod -------------------------- */\n\n#ifndef GL_SGIS_texture_lod\n#define GL_SGIS_texture_lod 1\n\n#define GL_TEXTURE_MIN_LOD_SGIS 0x813A\n#define GL_TEXTURE_MAX_LOD_SGIS 0x813B\n#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C\n#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D\n\n#define GLEW_SGIS_texture_lod GLEW_GET_VAR(__GLEW_SGIS_texture_lod)\n\n#endif /* GL_SGIS_texture_lod */\n\n/* ------------------------- GL_SGIS_texture_select ------------------------ */\n\n#ifndef GL_SGIS_texture_select\n#define GL_SGIS_texture_select 1\n\n#define GLEW_SGIS_texture_select GLEW_GET_VAR(__GLEW_SGIS_texture_select)\n\n#endif /* GL_SGIS_texture_select */\n\n/* ----------------------------- GL_SGIX_async ----------------------------- */\n\n#ifndef GL_SGIX_async\n#define GL_SGIX_async 1\n\n#define GL_ASYNC_MARKER_SGIX 0x8329\n\ntypedef void (GLAPIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker);\ntypedef void (GLAPIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);\ntypedef GLint (GLAPIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint* markerp);\ntypedef GLuint (GLAPIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);\ntypedef GLboolean (GLAPIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);\ntypedef GLint (GLAPIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint* markerp);\n\n#define glAsyncMarkerSGIX GLEW_GET_FUN(__glewAsyncMarkerSGIX)\n#define glDeleteAsyncMarkersSGIX GLEW_GET_FUN(__glewDeleteAsyncMarkersSGIX)\n#define glFinishAsyncSGIX GLEW_GET_FUN(__glewFinishAsyncSGIX)\n#define glGenAsyncMarkersSGIX GLEW_GET_FUN(__glewGenAsyncMarkersSGIX)\n#define glIsAsyncMarkerSGIX GLEW_GET_FUN(__glewIsAsyncMarkerSGIX)\n#define glPollAsyncSGIX GLEW_GET_FUN(__glewPollAsyncSGIX)\n\n#define GLEW_SGIX_async GLEW_GET_VAR(__GLEW_SGIX_async)\n\n#endif /* GL_SGIX_async */\n\n/* ------------------------ GL_SGIX_async_histogram ------------------------ */\n\n#ifndef GL_SGIX_async_histogram\n#define GL_SGIX_async_histogram 1\n\n#define GL_ASYNC_HISTOGRAM_SGIX 0x832C\n#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D\n\n#define GLEW_SGIX_async_histogram GLEW_GET_VAR(__GLEW_SGIX_async_histogram)\n\n#endif /* GL_SGIX_async_histogram */\n\n/* -------------------------- GL_SGIX_async_pixel -------------------------- */\n\n#ifndef GL_SGIX_async_pixel\n#define GL_SGIX_async_pixel 1\n\n#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C\n#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D\n#define GL_ASYNC_READ_PIXELS_SGIX 0x835E\n#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F\n#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360\n#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361\n\n#define GLEW_SGIX_async_pixel GLEW_GET_VAR(__GLEW_SGIX_async_pixel)\n\n#endif /* GL_SGIX_async_pixel */\n\n/* ----------------------- GL_SGIX_blend_alpha_minmax ---------------------- */\n\n#ifndef GL_SGIX_blend_alpha_minmax\n#define GL_SGIX_blend_alpha_minmax 1\n\n#define GL_ALPHA_MIN_SGIX 0x8320\n#define GL_ALPHA_MAX_SGIX 0x8321\n\n#define GLEW_SGIX_blend_alpha_minmax GLEW_GET_VAR(__GLEW_SGIX_blend_alpha_minmax)\n\n#endif /* GL_SGIX_blend_alpha_minmax */\n\n/* ---------------------------- GL_SGIX_clipmap ---------------------------- */\n\n#ifndef GL_SGIX_clipmap\n#define GL_SGIX_clipmap 1\n\n#define GLEW_SGIX_clipmap GLEW_GET_VAR(__GLEW_SGIX_clipmap)\n\n#endif /* GL_SGIX_clipmap */\n\n/* ---------------------- GL_SGIX_convolution_accuracy --------------------- */\n\n#ifndef GL_SGIX_convolution_accuracy\n#define GL_SGIX_convolution_accuracy 1\n\n#define GL_CONVOLUTION_HINT_SGIX 0x8316\n\n#define GLEW_SGIX_convolution_accuracy GLEW_GET_VAR(__GLEW_SGIX_convolution_accuracy)\n\n#endif /* GL_SGIX_convolution_accuracy */\n\n/* ------------------------- GL_SGIX_depth_texture ------------------------- */\n\n#ifndef GL_SGIX_depth_texture\n#define GL_SGIX_depth_texture 1\n\n#define GL_DEPTH_COMPONENT16_SGIX 0x81A5\n#define GL_DEPTH_COMPONENT24_SGIX 0x81A6\n#define GL_DEPTH_COMPONENT32_SGIX 0x81A7\n\n#define GLEW_SGIX_depth_texture GLEW_GET_VAR(__GLEW_SGIX_depth_texture)\n\n#endif /* GL_SGIX_depth_texture */\n\n/* -------------------------- GL_SGIX_flush_raster ------------------------- */\n\n#ifndef GL_SGIX_flush_raster\n#define GL_SGIX_flush_raster 1\n\ntypedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void);\n\n#define glFlushRasterSGIX GLEW_GET_FUN(__glewFlushRasterSGIX)\n\n#define GLEW_SGIX_flush_raster GLEW_GET_VAR(__GLEW_SGIX_flush_raster)\n\n#endif /* GL_SGIX_flush_raster */\n\n/* --------------------------- GL_SGIX_fog_offset -------------------------- */\n\n#ifndef GL_SGIX_fog_offset\n#define GL_SGIX_fog_offset 1\n\n#define GL_FOG_OFFSET_SGIX 0x8198\n#define GL_FOG_OFFSET_VALUE_SGIX 0x8199\n\n#define GLEW_SGIX_fog_offset GLEW_GET_VAR(__GLEW_SGIX_fog_offset)\n\n#endif /* GL_SGIX_fog_offset */\n\n/* -------------------------- GL_SGIX_fog_texture -------------------------- */\n\n#ifndef GL_SGIX_fog_texture\n#define GL_SGIX_fog_texture 1\n\n#define GL_TEXTURE_FOG_SGIX 0\n#define GL_FOG_PATCHY_FACTOR_SGIX 0\n#define GL_FRAGMENT_FOG_SGIX 0\n\ntypedef void (GLAPIENTRY * PFNGLTEXTUREFOGSGIXPROC) (GLenum pname);\n\n#define glTextureFogSGIX GLEW_GET_FUN(__glewTextureFogSGIX)\n\n#define GLEW_SGIX_fog_texture GLEW_GET_VAR(__GLEW_SGIX_fog_texture)\n\n#endif /* GL_SGIX_fog_texture */\n\n/* ------------------- GL_SGIX_fragment_specular_lighting ------------------ */\n\n#ifndef GL_SGIX_fragment_specular_lighting\n#define GL_SGIX_fragment_specular_lighting 1\n\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, const GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, const GLint param);\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data);\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data);\n\n#define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX)\n#define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX)\n#define glFragmentLightModelfvSGIX GLEW_GET_FUN(__glewFragmentLightModelfvSGIX)\n#define glFragmentLightModeliSGIX GLEW_GET_FUN(__glewFragmentLightModeliSGIX)\n#define glFragmentLightModelivSGIX GLEW_GET_FUN(__glewFragmentLightModelivSGIX)\n#define glFragmentLightfSGIX GLEW_GET_FUN(__glewFragmentLightfSGIX)\n#define glFragmentLightfvSGIX GLEW_GET_FUN(__glewFragmentLightfvSGIX)\n#define glFragmentLightiSGIX GLEW_GET_FUN(__glewFragmentLightiSGIX)\n#define glFragmentLightivSGIX GLEW_GET_FUN(__glewFragmentLightivSGIX)\n#define glFragmentMaterialfSGIX GLEW_GET_FUN(__glewFragmentMaterialfSGIX)\n#define glFragmentMaterialfvSGIX GLEW_GET_FUN(__glewFragmentMaterialfvSGIX)\n#define glFragmentMaterialiSGIX GLEW_GET_FUN(__glewFragmentMaterialiSGIX)\n#define glFragmentMaterialivSGIX GLEW_GET_FUN(__glewFragmentMaterialivSGIX)\n#define glGetFragmentLightfvSGIX GLEW_GET_FUN(__glewGetFragmentLightfvSGIX)\n#define glGetFragmentLightivSGIX GLEW_GET_FUN(__glewGetFragmentLightivSGIX)\n#define glGetFragmentMaterialfvSGIX GLEW_GET_FUN(__glewGetFragmentMaterialfvSGIX)\n#define glGetFragmentMaterialivSGIX GLEW_GET_FUN(__glewGetFragmentMaterialivSGIX)\n\n#define GLEW_SGIX_fragment_specular_lighting GLEW_GET_VAR(__GLEW_SGIX_fragment_specular_lighting)\n\n#endif /* GL_SGIX_fragment_specular_lighting */\n\n/* --------------------------- GL_SGIX_framezoom --------------------------- */\n\n#ifndef GL_SGIX_framezoom\n#define GL_SGIX_framezoom 1\n\ntypedef void (GLAPIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor);\n\n#define glFrameZoomSGIX GLEW_GET_FUN(__glewFrameZoomSGIX)\n\n#define GLEW_SGIX_framezoom GLEW_GET_VAR(__GLEW_SGIX_framezoom)\n\n#endif /* GL_SGIX_framezoom */\n\n/* --------------------------- GL_SGIX_interlace --------------------------- */\n\n#ifndef GL_SGIX_interlace\n#define GL_SGIX_interlace 1\n\n#define GL_INTERLACE_SGIX 0x8094\n\n#define GLEW_SGIX_interlace GLEW_GET_VAR(__GLEW_SGIX_interlace)\n\n#endif /* GL_SGIX_interlace */\n\n/* ------------------------- GL_SGIX_ir_instrument1 ------------------------ */\n\n#ifndef GL_SGIX_ir_instrument1\n#define GL_SGIX_ir_instrument1 1\n\n#define GLEW_SGIX_ir_instrument1 GLEW_GET_VAR(__GLEW_SGIX_ir_instrument1)\n\n#endif /* GL_SGIX_ir_instrument1 */\n\n/* ------------------------- GL_SGIX_list_priority ------------------------- */\n\n#ifndef GL_SGIX_list_priority\n#define GL_SGIX_list_priority 1\n\n#define GLEW_SGIX_list_priority GLEW_GET_VAR(__GLEW_SGIX_list_priority)\n\n#endif /* GL_SGIX_list_priority */\n\n/* ------------------------- GL_SGIX_pixel_texture ------------------------- */\n\n#ifndef GL_SGIX_pixel_texture\n#define GL_SGIX_pixel_texture 1\n\ntypedef void (GLAPIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);\n\n#define glPixelTexGenSGIX GLEW_GET_FUN(__glewPixelTexGenSGIX)\n\n#define GLEW_SGIX_pixel_texture GLEW_GET_VAR(__GLEW_SGIX_pixel_texture)\n\n#endif /* GL_SGIX_pixel_texture */\n\n/* ----------------------- GL_SGIX_pixel_texture_bits ---------------------- */\n\n#ifndef GL_SGIX_pixel_texture_bits\n#define GL_SGIX_pixel_texture_bits 1\n\n#define GLEW_SGIX_pixel_texture_bits GLEW_GET_VAR(__GLEW_SGIX_pixel_texture_bits)\n\n#endif /* GL_SGIX_pixel_texture_bits */\n\n/* ------------------------ GL_SGIX_reference_plane ------------------------ */\n\n#ifndef GL_SGIX_reference_plane\n#define GL_SGIX_reference_plane 1\n\ntypedef void (GLAPIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble* equation);\n\n#define glReferencePlaneSGIX GLEW_GET_FUN(__glewReferencePlaneSGIX)\n\n#define GLEW_SGIX_reference_plane GLEW_GET_VAR(__GLEW_SGIX_reference_plane)\n\n#endif /* GL_SGIX_reference_plane */\n\n/* ---------------------------- GL_SGIX_resample --------------------------- */\n\n#ifndef GL_SGIX_resample\n#define GL_SGIX_resample 1\n\n#define GL_PACK_RESAMPLE_SGIX 0x842E\n#define GL_UNPACK_RESAMPLE_SGIX 0x842F\n#define GL_RESAMPLE_DECIMATE_SGIX 0x8430\n#define GL_RESAMPLE_REPLICATE_SGIX 0x8433\n#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434\n\n#define GLEW_SGIX_resample GLEW_GET_VAR(__GLEW_SGIX_resample)\n\n#endif /* GL_SGIX_resample */\n\n/* ----------------------------- GL_SGIX_shadow ---------------------------- */\n\n#ifndef GL_SGIX_shadow\n#define GL_SGIX_shadow 1\n\n#define GL_TEXTURE_COMPARE_SGIX 0x819A\n#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B\n#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C\n#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D\n\n#define GLEW_SGIX_shadow GLEW_GET_VAR(__GLEW_SGIX_shadow)\n\n#endif /* GL_SGIX_shadow */\n\n/* ------------------------- GL_SGIX_shadow_ambient ------------------------ */\n\n#ifndef GL_SGIX_shadow_ambient\n#define GL_SGIX_shadow_ambient 1\n\n#define GL_SHADOW_AMBIENT_SGIX 0x80BF\n\n#define GLEW_SGIX_shadow_ambient GLEW_GET_VAR(__GLEW_SGIX_shadow_ambient)\n\n#endif /* GL_SGIX_shadow_ambient */\n\n/* ----------------------------- GL_SGIX_sprite ---------------------------- */\n\n#ifndef GL_SGIX_sprite\n#define GL_SGIX_sprite 1\n\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, GLint* params);\n\n#define glSpriteParameterfSGIX GLEW_GET_FUN(__glewSpriteParameterfSGIX)\n#define glSpriteParameterfvSGIX GLEW_GET_FUN(__glewSpriteParameterfvSGIX)\n#define glSpriteParameteriSGIX GLEW_GET_FUN(__glewSpriteParameteriSGIX)\n#define glSpriteParameterivSGIX GLEW_GET_FUN(__glewSpriteParameterivSGIX)\n\n#define GLEW_SGIX_sprite GLEW_GET_VAR(__GLEW_SGIX_sprite)\n\n#endif /* GL_SGIX_sprite */\n\n/* ----------------------- GL_SGIX_tag_sample_buffer ----------------------- */\n\n#ifndef GL_SGIX_tag_sample_buffer\n#define GL_SGIX_tag_sample_buffer 1\n\ntypedef void (GLAPIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);\n\n#define glTagSampleBufferSGIX GLEW_GET_FUN(__glewTagSampleBufferSGIX)\n\n#define GLEW_SGIX_tag_sample_buffer GLEW_GET_VAR(__GLEW_SGIX_tag_sample_buffer)\n\n#endif /* GL_SGIX_tag_sample_buffer */\n\n/* ------------------------ GL_SGIX_texture_add_env ------------------------ */\n\n#ifndef GL_SGIX_texture_add_env\n#define GL_SGIX_texture_add_env 1\n\n#define GLEW_SGIX_texture_add_env GLEW_GET_VAR(__GLEW_SGIX_texture_add_env)\n\n#endif /* GL_SGIX_texture_add_env */\n\n/* -------------------- GL_SGIX_texture_coordinate_clamp ------------------- */\n\n#ifndef GL_SGIX_texture_coordinate_clamp\n#define GL_SGIX_texture_coordinate_clamp 1\n\n#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369\n#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A\n#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B\n\n#define GLEW_SGIX_texture_coordinate_clamp GLEW_GET_VAR(__GLEW_SGIX_texture_coordinate_clamp)\n\n#endif /* GL_SGIX_texture_coordinate_clamp */\n\n/* ------------------------ GL_SGIX_texture_lod_bias ----------------------- */\n\n#ifndef GL_SGIX_texture_lod_bias\n#define GL_SGIX_texture_lod_bias 1\n\n#define GLEW_SGIX_texture_lod_bias GLEW_GET_VAR(__GLEW_SGIX_texture_lod_bias)\n\n#endif /* GL_SGIX_texture_lod_bias */\n\n/* ---------------------- GL_SGIX_texture_multi_buffer --------------------- */\n\n#ifndef GL_SGIX_texture_multi_buffer\n#define GL_SGIX_texture_multi_buffer 1\n\n#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E\n\n#define GLEW_SGIX_texture_multi_buffer GLEW_GET_VAR(__GLEW_SGIX_texture_multi_buffer)\n\n#endif /* GL_SGIX_texture_multi_buffer */\n\n/* ------------------------- GL_SGIX_texture_range ------------------------- */\n\n#ifndef GL_SGIX_texture_range\n#define GL_SGIX_texture_range 1\n\n#define GL_RGB_SIGNED_SGIX 0x85E0\n#define GL_RGBA_SIGNED_SGIX 0x85E1\n#define GL_ALPHA_SIGNED_SGIX 0x85E2\n#define GL_LUMINANCE_SIGNED_SGIX 0x85E3\n#define GL_INTENSITY_SIGNED_SGIX 0x85E4\n#define GL_LUMINANCE_ALPHA_SIGNED_SGIX 0x85E5\n#define GL_RGB16_SIGNED_SGIX 0x85E6\n#define GL_RGBA16_SIGNED_SGIX 0x85E7\n#define GL_ALPHA16_SIGNED_SGIX 0x85E8\n#define GL_LUMINANCE16_SIGNED_SGIX 0x85E9\n#define GL_INTENSITY16_SIGNED_SGIX 0x85EA\n#define GL_LUMINANCE16_ALPHA16_SIGNED_SGIX 0x85EB\n#define GL_RGB_EXTENDED_RANGE_SGIX 0x85EC\n#define GL_RGBA_EXTENDED_RANGE_SGIX 0x85ED\n#define GL_ALPHA_EXTENDED_RANGE_SGIX 0x85EE\n#define GL_LUMINANCE_EXTENDED_RANGE_SGIX 0x85EF\n#define GL_INTENSITY_EXTENDED_RANGE_SGIX 0x85F0\n#define GL_LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX 0x85F1\n#define GL_RGB16_EXTENDED_RANGE_SGIX 0x85F2\n#define GL_RGBA16_EXTENDED_RANGE_SGIX 0x85F3\n#define GL_ALPHA16_EXTENDED_RANGE_SGIX 0x85F4\n#define GL_LUMINANCE16_EXTENDED_RANGE_SGIX 0x85F5\n#define GL_INTENSITY16_EXTENDED_RANGE_SGIX 0x85F6\n#define GL_LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX 0x85F7\n#define GL_MIN_LUMINANCE_SGIS 0x85F8\n#define GL_MAX_LUMINANCE_SGIS 0x85F9\n#define GL_MIN_INTENSITY_SGIS 0x85FA\n#define GL_MAX_INTENSITY_SGIS 0x85FB\n\n#define GLEW_SGIX_texture_range GLEW_GET_VAR(__GLEW_SGIX_texture_range)\n\n#endif /* GL_SGIX_texture_range */\n\n/* ----------------------- GL_SGIX_texture_scale_bias ---------------------- */\n\n#ifndef GL_SGIX_texture_scale_bias\n#define GL_SGIX_texture_scale_bias 1\n\n#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179\n#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A\n#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B\n#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C\n\n#define GLEW_SGIX_texture_scale_bias GLEW_GET_VAR(__GLEW_SGIX_texture_scale_bias)\n\n#endif /* GL_SGIX_texture_scale_bias */\n\n/* ------------------------- GL_SGIX_vertex_preclip ------------------------ */\n\n#ifndef GL_SGIX_vertex_preclip\n#define GL_SGIX_vertex_preclip 1\n\n#define GL_VERTEX_PRECLIP_SGIX 0x83EE\n#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF\n\n#define GLEW_SGIX_vertex_preclip GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip)\n\n#endif /* GL_SGIX_vertex_preclip */\n\n/* ---------------------- GL_SGIX_vertex_preclip_hint ---------------------- */\n\n#ifndef GL_SGIX_vertex_preclip_hint\n#define GL_SGIX_vertex_preclip_hint 1\n\n#define GL_VERTEX_PRECLIP_SGIX 0x83EE\n#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF\n\n#define GLEW_SGIX_vertex_preclip_hint GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip_hint)\n\n#endif /* GL_SGIX_vertex_preclip_hint */\n\n/* ----------------------------- GL_SGIX_ycrcb ----------------------------- */\n\n#ifndef GL_SGIX_ycrcb\n#define GL_SGIX_ycrcb 1\n\n#define GLEW_SGIX_ycrcb GLEW_GET_VAR(__GLEW_SGIX_ycrcb)\n\n#endif /* GL_SGIX_ycrcb */\n\n/* -------------------------- GL_SGI_color_matrix -------------------------- */\n\n#ifndef GL_SGI_color_matrix\n#define GL_SGI_color_matrix 1\n\n#define GL_COLOR_MATRIX_SGI 0x80B1\n#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2\n#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3\n#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4\n#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5\n#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6\n#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7\n#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8\n#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9\n#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA\n#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB\n\n#define GLEW_SGI_color_matrix GLEW_GET_VAR(__GLEW_SGI_color_matrix)\n\n#endif /* GL_SGI_color_matrix */\n\n/* --------------------------- GL_SGI_color_table -------------------------- */\n\n#ifndef GL_SGI_color_table\n#define GL_SGI_color_table 1\n\n#define GL_COLOR_TABLE_SGI 0x80D0\n#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1\n#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2\n#define GL_PROXY_COLOR_TABLE_SGI 0x80D3\n#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4\n#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5\n#define GL_COLOR_TABLE_SCALE_SGI 0x80D6\n#define GL_COLOR_TABLE_BIAS_SGI 0x80D7\n#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8\n#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9\n#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA\n#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB\n#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC\n#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD\n#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE\n#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF\n\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint* params);\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* table);\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void* table);\n\n#define glColorTableParameterfvSGI GLEW_GET_FUN(__glewColorTableParameterfvSGI)\n#define glColorTableParameterivSGI GLEW_GET_FUN(__glewColorTableParameterivSGI)\n#define glColorTableSGI GLEW_GET_FUN(__glewColorTableSGI)\n#define glCopyColorTableSGI GLEW_GET_FUN(__glewCopyColorTableSGI)\n#define glGetColorTableParameterfvSGI GLEW_GET_FUN(__glewGetColorTableParameterfvSGI)\n#define glGetColorTableParameterivSGI GLEW_GET_FUN(__glewGetColorTableParameterivSGI)\n#define glGetColorTableSGI GLEW_GET_FUN(__glewGetColorTableSGI)\n\n#define GLEW_SGI_color_table GLEW_GET_VAR(__GLEW_SGI_color_table)\n\n#endif /* GL_SGI_color_table */\n\n/* ----------------------- GL_SGI_texture_color_table ---------------------- */\n\n#ifndef GL_SGI_texture_color_table\n#define GL_SGI_texture_color_table 1\n\n#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC\n#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD\n\n#define GLEW_SGI_texture_color_table GLEW_GET_VAR(__GLEW_SGI_texture_color_table)\n\n#endif /* GL_SGI_texture_color_table */\n\n/* ------------------------- GL_SUNX_constant_data ------------------------- */\n\n#ifndef GL_SUNX_constant_data\n#define GL_SUNX_constant_data 1\n\n#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5\n#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6\n\ntypedef void (GLAPIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void);\n\n#define glFinishTextureSUNX GLEW_GET_FUN(__glewFinishTextureSUNX)\n\n#define GLEW_SUNX_constant_data GLEW_GET_VAR(__GLEW_SUNX_constant_data)\n\n#endif /* GL_SUNX_constant_data */\n\n/* -------------------- GL_SUN_convolution_border_modes -------------------- */\n\n#ifndef GL_SUN_convolution_border_modes\n#define GL_SUN_convolution_border_modes 1\n\n#define GL_WRAP_BORDER_SUN 0x81D4\n\n#define GLEW_SUN_convolution_border_modes GLEW_GET_VAR(__GLEW_SUN_convolution_border_modes)\n\n#endif /* GL_SUN_convolution_border_modes */\n\n/* -------------------------- GL_SUN_global_alpha -------------------------- */\n\n#ifndef GL_SUN_global_alpha\n#define GL_SUN_global_alpha 1\n\n#define GL_GLOBAL_ALPHA_SUN 0x81D9\n#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA\n\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);\n\n#define glGlobalAlphaFactorbSUN GLEW_GET_FUN(__glewGlobalAlphaFactorbSUN)\n#define glGlobalAlphaFactordSUN GLEW_GET_FUN(__glewGlobalAlphaFactordSUN)\n#define glGlobalAlphaFactorfSUN GLEW_GET_FUN(__glewGlobalAlphaFactorfSUN)\n#define glGlobalAlphaFactoriSUN GLEW_GET_FUN(__glewGlobalAlphaFactoriSUN)\n#define glGlobalAlphaFactorsSUN GLEW_GET_FUN(__glewGlobalAlphaFactorsSUN)\n#define glGlobalAlphaFactorubSUN GLEW_GET_FUN(__glewGlobalAlphaFactorubSUN)\n#define glGlobalAlphaFactoruiSUN GLEW_GET_FUN(__glewGlobalAlphaFactoruiSUN)\n#define glGlobalAlphaFactorusSUN GLEW_GET_FUN(__glewGlobalAlphaFactorusSUN)\n\n#define GLEW_SUN_global_alpha GLEW_GET_VAR(__GLEW_SUN_global_alpha)\n\n#endif /* GL_SUN_global_alpha */\n\n/* --------------------------- GL_SUN_mesh_array --------------------------- */\n\n#ifndef GL_SUN_mesh_array\n#define GL_SUN_mesh_array 1\n\n#define GL_QUAD_MESH_SUN 0x8614\n#define GL_TRIANGLE_MESH_SUN 0x8615\n\n#define GLEW_SUN_mesh_array GLEW_GET_VAR(__GLEW_SUN_mesh_array)\n\n#endif /* GL_SUN_mesh_array */\n\n/* ------------------------ GL_SUN_read_video_pixels ----------------------- */\n\n#ifndef GL_SUN_read_video_pixels\n#define GL_SUN_read_video_pixels 1\n\ntypedef void (GLAPIENTRY * PFNGLREADVIDEOPIXELSSUNPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);\n\n#define glReadVideoPixelsSUN GLEW_GET_FUN(__glewReadVideoPixelsSUN)\n\n#define GLEW_SUN_read_video_pixels GLEW_GET_VAR(__GLEW_SUN_read_video_pixels)\n\n#endif /* GL_SUN_read_video_pixels */\n\n/* --------------------------- GL_SUN_slice_accum -------------------------- */\n\n#ifndef GL_SUN_slice_accum\n#define GL_SUN_slice_accum 1\n\n#define GL_SLICE_ACCUM_SUN 0x85CC\n\n#define GLEW_SUN_slice_accum GLEW_GET_VAR(__GLEW_SUN_slice_accum)\n\n#endif /* GL_SUN_slice_accum */\n\n/* -------------------------- GL_SUN_triangle_list ------------------------- */\n\n#ifndef GL_SUN_triangle_list\n#define GL_SUN_triangle_list 1\n\n#define GL_RESTART_SUN 0x01\n#define GL_REPLACE_MIDDLE_SUN 0x02\n#define GL_REPLACE_OLDEST_SUN 0x03\n#define GL_TRIANGLE_LIST_SUN 0x81D7\n#define GL_REPLACEMENT_CODE_SUN 0x81D8\n#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0\n#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1\n#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2\n#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3\n#define GL_R1UI_V3F_SUN 0x85C4\n#define GL_R1UI_C4UB_V3F_SUN 0x85C5\n#define GL_R1UI_C3F_V3F_SUN 0x85C6\n#define GL_R1UI_N3F_V3F_SUN 0x85C7\n#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8\n#define GL_R1UI_T2F_V3F_SUN 0x85C9\n#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA\n#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB\n\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void* pointer);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte* code);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint* code);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort* code);\n\n#define glReplacementCodePointerSUN GLEW_GET_FUN(__glewReplacementCodePointerSUN)\n#define glReplacementCodeubSUN GLEW_GET_FUN(__glewReplacementCodeubSUN)\n#define glReplacementCodeubvSUN GLEW_GET_FUN(__glewReplacementCodeubvSUN)\n#define glReplacementCodeuiSUN GLEW_GET_FUN(__glewReplacementCodeuiSUN)\n#define glReplacementCodeuivSUN GLEW_GET_FUN(__glewReplacementCodeuivSUN)\n#define glReplacementCodeusSUN GLEW_GET_FUN(__glewReplacementCodeusSUN)\n#define glReplacementCodeusvSUN GLEW_GET_FUN(__glewReplacementCodeusvSUN)\n\n#define GLEW_SUN_triangle_list GLEW_GET_VAR(__GLEW_SUN_triangle_list)\n\n#endif /* GL_SUN_triangle_list */\n\n/* ----------------------------- GL_SUN_vertex ----------------------------- */\n\n#ifndef GL_SUN_vertex\n#define GL_SUN_vertex 1\n\ntypedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte* c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte* c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint* rc, const GLubyte *c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat* tc, const GLubyte *c, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *v);\n\n#define glColor3fVertex3fSUN GLEW_GET_FUN(__glewColor3fVertex3fSUN)\n#define glColor3fVertex3fvSUN GLEW_GET_FUN(__glewColor3fVertex3fvSUN)\n#define glColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fSUN)\n#define glColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fvSUN)\n#define glColor4ubVertex2fSUN GLEW_GET_FUN(__glewColor4ubVertex2fSUN)\n#define glColor4ubVertex2fvSUN GLEW_GET_FUN(__glewColor4ubVertex2fvSUN)\n#define glColor4ubVertex3fSUN GLEW_GET_FUN(__glewColor4ubVertex3fSUN)\n#define glColor4ubVertex3fvSUN GLEW_GET_FUN(__glewColor4ubVertex3fvSUN)\n#define glNormal3fVertex3fSUN GLEW_GET_FUN(__glewNormal3fVertex3fSUN)\n#define glNormal3fVertex3fvSUN GLEW_GET_FUN(__glewNormal3fVertex3fvSUN)\n#define glReplacementCodeuiColor3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fSUN)\n#define glReplacementCodeuiColor3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fvSUN)\n#define glReplacementCodeuiColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fSUN)\n#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fvSUN)\n#define glReplacementCodeuiColor4ubVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fSUN)\n#define glReplacementCodeuiColor4ubVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fvSUN)\n#define glReplacementCodeuiNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fSUN)\n#define glReplacementCodeuiNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fvSUN)\n#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN)\n#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN)\n#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN)\n#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN)\n#define glReplacementCodeuiTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fSUN)\n#define glReplacementCodeuiTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fvSUN)\n#define glReplacementCodeuiVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fSUN)\n#define glReplacementCodeuiVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fvSUN)\n#define glTexCoord2fColor3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fSUN)\n#define glTexCoord2fColor3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fvSUN)\n#define glTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fSUN)\n#define glTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fvSUN)\n#define glTexCoord2fColor4ubVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fSUN)\n#define glTexCoord2fColor4ubVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fvSUN)\n#define glTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fSUN)\n#define glTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fvSUN)\n#define glTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fSUN)\n#define glTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fvSUN)\n#define glTexCoord4fColor4fNormal3fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fSUN)\n#define glTexCoord4fColor4fNormal3fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fvSUN)\n#define glTexCoord4fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fSUN)\n#define glTexCoord4fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fvSUN)\n\n#define GLEW_SUN_vertex GLEW_GET_VAR(__GLEW_SUN_vertex)\n\n#endif /* GL_SUN_vertex */\n\n/* -------------------------- GL_WIN_phong_shading ------------------------- */\n\n#ifndef GL_WIN_phong_shading\n#define GL_WIN_phong_shading 1\n\n#define GL_PHONG_WIN 0x80EA\n#define GL_PHONG_HINT_WIN 0x80EB\n\n#define GLEW_WIN_phong_shading GLEW_GET_VAR(__GLEW_WIN_phong_shading)\n\n#endif /* GL_WIN_phong_shading */\n\n/* -------------------------- GL_WIN_specular_fog -------------------------- */\n\n#ifndef GL_WIN_specular_fog\n#define GL_WIN_specular_fog 1\n\n#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC\n\n#define GLEW_WIN_specular_fog GLEW_GET_VAR(__GLEW_WIN_specular_fog)\n\n#endif /* GL_WIN_specular_fog */\n\n/* ---------------------------- GL_WIN_swap_hint --------------------------- */\n\n#ifndef GL_WIN_swap_hint\n#define GL_WIN_swap_hint 1\n\ntypedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height);\n\n#define glAddSwapHintRectWIN GLEW_GET_FUN(__glewAddSwapHintRectWIN)\n\n#define GLEW_WIN_swap_hint GLEW_GET_VAR(__GLEW_WIN_swap_hint)\n\n#endif /* GL_WIN_swap_hint */\n\n/* ------------------------------------------------------------------------- */\n\n#if defined(GLEW_MX) && defined(_WIN32)\n#define GLEW_FUN_EXPORT\n#else\n#define GLEW_FUN_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n\n#if defined(GLEW_MX)\n#define GLEW_VAR_EXPORT\n#else\n#define GLEW_VAR_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n\n#if defined(GLEW_MX) && defined(_WIN32)\nstruct GLEWContextStruct\n{\n#endif /* GLEW_MX */\n\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D;\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements;\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DPROC __glewTexImage3D;\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D;\n\nGLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture;\nGLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D;\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage;\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd;\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf;\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd;\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv;\nGLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage;\n\nGLEW_FUN_EXPORT PFNGLBLENDCOLORPROC __glewBlendColor;\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONPROC __glewBlendEquation;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate;\nGLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer;\nGLEW_FUN_EXPORT PFNGLFOGCOORDDPROC __glewFogCoordd;\nGLEW_FUN_EXPORT PFNGLFOGCOORDDVPROC __glewFogCoorddv;\nGLEW_FUN_EXPORT PFNGLFOGCOORDFPROC __glewFogCoordf;\nGLEW_FUN_EXPORT PFNGLFOGCOORDFVPROC __glewFogCoordfv;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFPROC __glewPointParameterf;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERIPROC __glewPointParameteri;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DPROC __glewWindowPos2d;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FPROC __glewWindowPos2f;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IPROC __glewWindowPos2i;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SPROC __glewWindowPos2s;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DPROC __glewWindowPos3d;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FPROC __glewWindowPos3f;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IPROC __glewWindowPos3i;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SPROC __glewWindowPos3s;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv;\n\nGLEW_FUN_EXPORT PFNGLBEGINQUERYPROC __glewBeginQuery;\nGLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer;\nGLEW_FUN_EXPORT PFNGLBUFFERDATAPROC __glewBufferData;\nGLEW_FUN_EXPORT PFNGLBUFFERSUBDATAPROC __glewBufferSubData;\nGLEW_FUN_EXPORT PFNGLDELETEBUFFERSPROC __glewDeleteBuffers;\nGLEW_FUN_EXPORT PFNGLDELETEQUERIESPROC __glewDeleteQueries;\nGLEW_FUN_EXPORT PFNGLENDQUERYPROC __glewEndQuery;\nGLEW_FUN_EXPORT PFNGLGENBUFFERSPROC __glewGenBuffers;\nGLEW_FUN_EXPORT PFNGLGENQUERIESPROC __glewGenQueries;\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv;\nGLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv;\nGLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData;\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv;\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv;\nGLEW_FUN_EXPORT PFNGLGETQUERYIVPROC __glewGetQueryiv;\nGLEW_FUN_EXPORT PFNGLISBUFFERPROC __glewIsBuffer;\nGLEW_FUN_EXPORT PFNGLISQUERYPROC __glewIsQuery;\nGLEW_FUN_EXPORT PFNGLMAPBUFFERPROC __glewMapBuffer;\nGLEW_FUN_EXPORT PFNGLUNMAPBUFFERPROC __glewUnmapBuffer;\n\nGLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader;\nGLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation;\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate;\nGLEW_FUN_EXPORT PFNGLCOMPILESHADERPROC __glewCompileShader;\nGLEW_FUN_EXPORT PFNGLCREATEPROGRAMPROC __glewCreateProgram;\nGLEW_FUN_EXPORT PFNGLCREATESHADERPROC __glewCreateShader;\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMPROC __glewDeleteProgram;\nGLEW_FUN_EXPORT PFNGLDELETESHADERPROC __glewDeleteShader;\nGLEW_FUN_EXPORT PFNGLDETACHSHADERPROC __glewDetachShader;\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray;\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERSPROC __glewDrawBuffers;\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray;\nGLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib;\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform;\nGLEW_FUN_EXPORT PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders;\nGLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMIVPROC __glewGetProgramiv;\nGLEW_FUN_EXPORT PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog;\nGLEW_FUN_EXPORT PFNGLGETSHADERSOURCEPROC __glewGetShaderSource;\nGLEW_FUN_EXPORT PFNGLGETSHADERIVPROC __glewGetShaderiv;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMFVPROC __glewGetUniformfv;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMIVPROC __glewGetUniformiv;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv;\nGLEW_FUN_EXPORT PFNGLISPROGRAMPROC __glewIsProgram;\nGLEW_FUN_EXPORT PFNGLISSHADERPROC __glewIsShader;\nGLEW_FUN_EXPORT PFNGLLINKPROGRAMPROC __glewLinkProgram;\nGLEW_FUN_EXPORT PFNGLSHADERSOURCEPROC __glewShaderSource;\nGLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate;\nGLEW_FUN_EXPORT PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate;\nGLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate;\nGLEW_FUN_EXPORT PFNGLUNIFORM1FPROC __glewUniform1f;\nGLEW_FUN_EXPORT PFNGLUNIFORM1FVPROC __glewUniform1fv;\nGLEW_FUN_EXPORT PFNGLUNIFORM1IPROC __glewUniform1i;\nGLEW_FUN_EXPORT PFNGLUNIFORM1IVPROC __glewUniform1iv;\nGLEW_FUN_EXPORT PFNGLUNIFORM2FPROC __glewUniform2f;\nGLEW_FUN_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv;\nGLEW_FUN_EXPORT PFNGLUNIFORM2IPROC __glewUniform2i;\nGLEW_FUN_EXPORT PFNGLUNIFORM2IVPROC __glewUniform2iv;\nGLEW_FUN_EXPORT PFNGLUNIFORM3FPROC __glewUniform3f;\nGLEW_FUN_EXPORT PFNGLUNIFORM3FVPROC __glewUniform3fv;\nGLEW_FUN_EXPORT PFNGLUNIFORM3IPROC __glewUniform3i;\nGLEW_FUN_EXPORT PFNGLUNIFORM3IVPROC __glewUniform3iv;\nGLEW_FUN_EXPORT PFNGLUNIFORM4FPROC __glewUniform4f;\nGLEW_FUN_EXPORT PFNGLUNIFORM4FVPROC __glewUniform4fv;\nGLEW_FUN_EXPORT PFNGLUNIFORM4IPROC __glewUniform4i;\nGLEW_FUN_EXPORT PFNGLUNIFORM4IVPROC __glewUniform4iv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv;\nGLEW_FUN_EXPORT PFNGLUSEPROGRAMPROC __glewUseProgram;\nGLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPROC __glewValidateProgram;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer;\n\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv;\n\nGLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender;\nGLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback;\nGLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation;\nGLEW_FUN_EXPORT PFNGLCLAMPCOLORPROC __glewClampColor;\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERFIPROC __glewClearBufferfi;\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERFVPROC __glewClearBufferfv;\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERIVPROC __glewClearBufferiv;\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv;\nGLEW_FUN_EXPORT PFNGLCOLORMASKIPROC __glewColorMaski;\nGLEW_FUN_EXPORT PFNGLDISABLEIPROC __glewDisablei;\nGLEW_FUN_EXPORT PFNGLENABLEIPROC __glewEnablei;\nGLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender;\nGLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback;\nGLEW_FUN_EXPORT PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v;\nGLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation;\nGLEW_FUN_EXPORT PFNGLGETSTRINGIPROC __glewGetStringi;\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv;\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv;\nGLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv;\nGLEW_FUN_EXPORT PFNGLISENABLEDIPROC __glewIsEnabledi;\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv;\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv;\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings;\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIPROC __glewUniform1ui;\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIVPROC __glewUniform1uiv;\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIPROC __glewUniform2ui;\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIVPROC __glewUniform2uiv;\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIPROC __glewUniform3ui;\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIVPROC __glewUniform3uiv;\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIPROC __glewUniform4ui;\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIVPROC __glewUniform4uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer;\n\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced;\nGLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex;\nGLEW_FUN_EXPORT PFNGLTEXBUFFERPROC __glewTexBuffer;\n\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture;\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v;\nGLEW_FUN_EXPORT PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v;\n\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor;\n\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei;\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONIPROC __glewBlendEquationi;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCIPROC __glewBlendFunci;\nGLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading;\n\nGLEW_FUN_EXPORT PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX;\n\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD;\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD;\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD;\nGLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD;\n\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD;\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD;\n\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD;\n\nGLEW_FUN_EXPORT PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD;\nGLEW_FUN_EXPORT PFNGLGENNAMESAMDPROC __glewGenNamesAMD;\nGLEW_FUN_EXPORT PFNGLISNAMEAMDPROC __glewIsNameAMD;\n\nGLEW_FUN_EXPORT PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD;\nGLEW_FUN_EXPORT PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD;\nGLEW_FUN_EXPORT PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD;\nGLEW_FUN_EXPORT PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD;\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD;\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD;\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD;\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD;\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD;\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD;\nGLEW_FUN_EXPORT PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD;\n\nGLEW_FUN_EXPORT PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD;\n\nGLEW_FUN_EXPORT PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD;\n\nGLEW_FUN_EXPORT PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD;\nGLEW_FUN_EXPORT PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD;\n\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE;\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE;\nGLEW_FUN_EXPORT PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE;\n\nGLEW_FUN_EXPORT PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE;\nGLEW_FUN_EXPORT PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE;\nGLEW_FUN_EXPORT PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE;\nGLEW_FUN_EXPORT PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE;\nGLEW_FUN_EXPORT PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE;\nGLEW_FUN_EXPORT PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE;\nGLEW_FUN_EXPORT PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE;\nGLEW_FUN_EXPORT PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE;\n\nGLEW_FUN_EXPORT PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE;\nGLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE;\n\nGLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE;\nGLEW_FUN_EXPORT PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE;\nGLEW_FUN_EXPORT PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE;\n\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE;\nGLEW_FUN_EXPORT PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE;\n\nGLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE;\nGLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE;\nGLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE;\nGLEW_FUN_EXPORT PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE;\n\nGLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE;\n\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE;\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE;\nGLEW_FUN_EXPORT PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE;\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE;\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE;\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE;\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE;\n\nGLEW_FUN_EXPORT PFNGLCLEARDEPTHFPROC __glewClearDepthf;\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEFPROC __glewDepthRangef;\nGLEW_FUN_EXPORT PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat;\nGLEW_FUN_EXPORT PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler;\nGLEW_FUN_EXPORT PFNGLSHADERBINARYPROC __glewShaderBinary;\n\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance;\n\nGLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed;\nGLEW_FUN_EXPORT PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex;\n\nGLEW_FUN_EXPORT PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB;\n\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERDATAPROC __glewClearBufferData;\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData;\nGLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT;\nGLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT;\n\nGLEW_FUN_EXPORT PFNGLCLAMPCOLORARBPROC __glewClampColorARB;\n\nGLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute;\nGLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect;\n\nGLEW_FUN_EXPORT PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData;\n\nGLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData;\n\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB;\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB;\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB;\nGLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB;\n\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB;\n\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB;\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB;\nGLEW_FUN_EXPORT PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB;\n\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex;\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex;\n\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect;\n\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri;\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv;\nGLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT;\n\nGLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer;\nGLEW_FUN_EXPORT PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer;\nGLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer;\nGLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;\nGLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;\nGLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;\nGLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers;\nGLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers;\nGLEW_FUN_EXPORT PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap;\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv;\nGLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv;\nGLEW_FUN_EXPORT PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer;\nGLEW_FUN_EXPORT PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer;\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage;\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample;\n\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB;\n\nGLEW_FUN_EXPORT PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary;\nGLEW_FUN_EXPORT PFNGLPROGRAMBINARYPROC __glewProgramBinary;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri;\n\nGLEW_FUN_EXPORT PFNGLGETUNIFORMDVPROC __glewGetUniformdv;\nGLEW_FUN_EXPORT PFNGLUNIFORM1DPROC __glewUniform1d;\nGLEW_FUN_EXPORT PFNGLUNIFORM1DVPROC __glewUniform1dv;\nGLEW_FUN_EXPORT PFNGLUNIFORM2DPROC __glewUniform2d;\nGLEW_FUN_EXPORT PFNGLUNIFORM2DVPROC __glewUniform2dv;\nGLEW_FUN_EXPORT PFNGLUNIFORM3DPROC __glewUniform3d;\nGLEW_FUN_EXPORT PFNGLUNIFORM3DVPROC __glewUniform3dv;\nGLEW_FUN_EXPORT PFNGLUNIFORM4DPROC __glewUniform4d;\nGLEW_FUN_EXPORT PFNGLUNIFORM4DVPROC __glewUniform4dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv;\n\nGLEW_FUN_EXPORT PFNGLCOLORSUBTABLEPROC __glewColorSubTable;\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPROC __glewColorTable;\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv;\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv;\nGLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable;\nGLEW_FUN_EXPORT PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable;\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D;\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPROC __glewGetColorTable;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv;\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter;\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv;\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv;\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPROC __glewGetHistogram;\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv;\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv;\nGLEW_FUN_EXPORT PFNGLGETMINMAXPROC __glewGetMinmax;\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv;\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv;\nGLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter;\nGLEW_FUN_EXPORT PFNGLHISTOGRAMPROC __glewHistogram;\nGLEW_FUN_EXPORT PFNGLMINMAXPROC __glewMinmax;\nGLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram;\nGLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax;\nGLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D;\n\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB;\n\nGLEW_FUN_EXPORT PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ;\n\nGLEW_FUN_EXPORT PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v;\n\nGLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData;\nGLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData;\nGLEW_FUN_EXPORT PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer;\nGLEW_FUN_EXPORT PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer;\nGLEW_FUN_EXPORT PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage;\nGLEW_FUN_EXPORT PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage;\n\nGLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange;\nGLEW_FUN_EXPORT PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange;\n\nGLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB;\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB;\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB;\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB;\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB;\n\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect;\n\nGLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB;\n\nGLEW_FUN_EXPORT PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB;\nGLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB;\n\nGLEW_FUN_EXPORT PFNGLBEGINQUERYARBPROC __glewBeginQueryARB;\nGLEW_FUN_EXPORT PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB;\nGLEW_FUN_EXPORT PFNGLENDQUERYARBPROC __glewEndQueryARB;\nGLEW_FUN_EXPORT PFNGLGENQUERIESARBPROC __glewGenQueriesARB;\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB;\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB;\nGLEW_FUN_EXPORT PFNGLGETQUERYIVARBPROC __glewGetQueryivARB;\nGLEW_FUN_EXPORT PFNGLISQUERYARBPROC __glewIsQueryARB;\n\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB;\n\nGLEW_FUN_EXPORT PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv;\n\nGLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex;\n\nGLEW_FUN_EXPORT PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB;\nGLEW_FUN_EXPORT PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB;\nGLEW_FUN_EXPORT PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB;\nGLEW_FUN_EXPORT PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB;\nGLEW_FUN_EXPORT PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB;\nGLEW_FUN_EXPORT PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB;\nGLEW_FUN_EXPORT PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB;\nGLEW_FUN_EXPORT PFNGLGETNMAPIVARBPROC __glewGetnMapivARB;\nGLEW_FUN_EXPORT PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB;\nGLEW_FUN_EXPORT PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB;\nGLEW_FUN_EXPORT PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB;\nGLEW_FUN_EXPORT PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB;\nGLEW_FUN_EXPORT PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB;\nGLEW_FUN_EXPORT PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB;\nGLEW_FUN_EXPORT PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB;\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB;\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB;\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB;\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB;\nGLEW_FUN_EXPORT PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB;\n\nGLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB;\n\nGLEW_FUN_EXPORT PFNGLBINDSAMPLERPROC __glewBindSampler;\nGLEW_FUN_EXPORT PFNGLDELETESAMPLERSPROC __glewDeleteSamplers;\nGLEW_FUN_EXPORT PFNGLGENSAMPLERSPROC __glewGenSamplers;\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv;\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv;\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv;\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv;\nGLEW_FUN_EXPORT PFNGLISSAMPLERPROC __glewIsSampler;\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv;\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv;\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf;\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv;\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri;\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv;\n\nGLEW_FUN_EXPORT PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram;\nGLEW_FUN_EXPORT PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline;\nGLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv;\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines;\nGLEW_FUN_EXPORT PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv;\nGLEW_FUN_EXPORT PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv;\nGLEW_FUN_EXPORT PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages;\nGLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline;\n\nGLEW_FUN_EXPORT PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv;\n\nGLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture;\nGLEW_FUN_EXPORT PFNGLMEMORYBARRIERPROC __glewMemoryBarrier;\n\nGLEW_FUN_EXPORT PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB;\nGLEW_FUN_EXPORT PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB;\nGLEW_FUN_EXPORT PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB;\nGLEW_FUN_EXPORT PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB;\nGLEW_FUN_EXPORT PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB;\nGLEW_FUN_EXPORT PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB;\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB;\nGLEW_FUN_EXPORT PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB;\nGLEW_FUN_EXPORT PFNGLGETHANDLEARBPROC __glewGetHandleARB;\nGLEW_FUN_EXPORT PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB;\nGLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB;\nGLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB;\nGLEW_FUN_EXPORT PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB;\nGLEW_FUN_EXPORT PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB;\nGLEW_FUN_EXPORT PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM1FARBPROC __glewUniform1fARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM1IARBPROC __glewUniform1iARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM2FARBPROC __glewUniform2fARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM2IARBPROC __glewUniform2iARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM3FARBPROC __glewUniform3fARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM3IARBPROC __glewUniform3iARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM4FARBPROC __glewUniform4fARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM4IARBPROC __glewUniform4iARB;\nGLEW_FUN_EXPORT PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB;\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB;\nGLEW_FUN_EXPORT PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB;\nGLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB;\n\nGLEW_FUN_EXPORT PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding;\n\nGLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName;\nGLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName;\nGLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv;\nGLEW_FUN_EXPORT PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex;\nGLEW_FUN_EXPORT PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv;\nGLEW_FUN_EXPORT PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv;\n\nGLEW_FUN_EXPORT PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB;\nGLEW_FUN_EXPORT PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB;\nGLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB;\nGLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB;\nGLEW_FUN_EXPORT PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB;\nGLEW_FUN_EXPORT PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB;\n\nGLEW_FUN_EXPORT PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync;\nGLEW_FUN_EXPORT PFNGLDELETESYNCPROC __glewDeleteSync;\nGLEW_FUN_EXPORT PFNGLFENCESYNCPROC __glewFenceSync;\nGLEW_FUN_EXPORT PFNGLGETINTEGER64VPROC __glewGetInteger64v;\nGLEW_FUN_EXPORT PFNGLGETSYNCIVPROC __glewGetSynciv;\nGLEW_FUN_EXPORT PFNGLISSYNCPROC __glewIsSync;\nGLEW_FUN_EXPORT PFNGLWAITSYNCPROC __glewWaitSync;\n\nGLEW_FUN_EXPORT PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv;\nGLEW_FUN_EXPORT PFNGLPATCHPARAMETERIPROC __glewPatchParameteri;\n\nGLEW_FUN_EXPORT PFNGLTEXBUFFERARBPROC __glewTexBufferARB;\n\nGLEW_FUN_EXPORT PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange;\nGLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT;\n\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB;\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB;\n\nGLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv;\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKIPROC __glewSampleMaski;\nGLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample;\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample;\n\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE1DPROC __glewTexStorage1D;\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE2DPROC __glewTexStorage2D;\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE3DPROC __glewTexStorage3D;\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT;\n\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample;\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample;\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT;\n\nGLEW_FUN_EXPORT PFNGLTEXTUREVIEWPROC __glewTextureView;\n\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v;\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v;\nGLEW_FUN_EXPORT PFNGLQUERYCOUNTERPROC __glewQueryCounter;\n\nGLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback;\nGLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks;\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback;\nGLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks;\nGLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback;\nGLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback;\nGLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback;\n\nGLEW_FUN_EXPORT PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed;\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream;\nGLEW_FUN_EXPORT PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed;\nGLEW_FUN_EXPORT PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv;\n\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced;\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced;\n\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB;\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB;\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB;\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB;\n\nGLEW_FUN_EXPORT PFNGLBINDBUFFERBASEPROC __glewBindBufferBase;\nGLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange;\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName;\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv;\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName;\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv;\nGLEW_FUN_EXPORT PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices;\nGLEW_FUN_EXPORT PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding;\n\nGLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray;\nGLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays;\nGLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays;\nGLEW_FUN_EXPORT PFNGLISVERTEXARRAYPROC __glewIsVertexArray;\n\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer;\n\nGLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat;\nGLEW_FUN_EXPORT PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor;\n\nGLEW_FUN_EXPORT PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTBVARBPROC __glewWeightbvARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTDVARBPROC __glewWeightdvARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTFVARBPROC __glewWeightfvARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTIVARBPROC __glewWeightivARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTSVARBPROC __glewWeightsvARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTUBVARBPROC __glewWeightubvARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTUIVARBPROC __glewWeightuivARB;\nGLEW_FUN_EXPORT PFNGLWEIGHTUSVARBPROC __glewWeightusvARB;\n\nGLEW_FUN_EXPORT PFNGLBINDBUFFERARBPROC __glewBindBufferARB;\nGLEW_FUN_EXPORT PFNGLBUFFERDATAARBPROC __glewBufferDataARB;\nGLEW_FUN_EXPORT PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB;\nGLEW_FUN_EXPORT PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB;\nGLEW_FUN_EXPORT PFNGLGENBUFFERSARBPROC __glewGenBuffersARB;\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB;\nGLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB;\nGLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB;\nGLEW_FUN_EXPORT PFNGLISBUFFERARBPROC __glewIsBufferARB;\nGLEW_FUN_EXPORT PFNGLMAPBUFFERARBPROC __glewMapBufferARB;\nGLEW_FUN_EXPORT PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB;\n\nGLEW_FUN_EXPORT PFNGLBINDPROGRAMARBPROC __glewBindProgramARB;\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB;\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB;\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB;\nGLEW_FUN_EXPORT PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB;\nGLEW_FUN_EXPORT PFNGLISPROGRAMARBPROC __glewIsProgramARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB;\nGLEW_FUN_EXPORT PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB;\n\nGLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB;\nGLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB;\nGLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB;\n\nGLEW_FUN_EXPORT PFNGLCOLORP3UIPROC __glewColorP3ui;\nGLEW_FUN_EXPORT PFNGLCOLORP3UIVPROC __glewColorP3uiv;\nGLEW_FUN_EXPORT PFNGLCOLORP4UIPROC __glewColorP4ui;\nGLEW_FUN_EXPORT PFNGLCOLORP4UIVPROC __glewColorP4uiv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv;\nGLEW_FUN_EXPORT PFNGLNORMALP3UIPROC __glewNormalP3ui;\nGLEW_FUN_EXPORT PFNGLNORMALP3UIVPROC __glewNormalP3uiv;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui;\nGLEW_FUN_EXPORT PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXP2UIPROC __glewVertexP2ui;\nGLEW_FUN_EXPORT PFNGLVERTEXP2UIVPROC __glewVertexP2uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXP3UIPROC __glewVertexP3ui;\nGLEW_FUN_EXPORT PFNGLVERTEXP3UIVPROC __glewVertexP3uiv;\nGLEW_FUN_EXPORT PFNGLVERTEXP4UIPROC __glewVertexP4ui;\nGLEW_FUN_EXPORT PFNGLVERTEXP4UIVPROC __glewVertexP4uiv;\n\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv;\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed;\nGLEW_FUN_EXPORT PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v;\nGLEW_FUN_EXPORT PFNGLGETFLOATI_VPROC __glewGetFloati_v;\nGLEW_FUN_EXPORT PFNGLSCISSORARRAYVPROC __glewScissorArrayv;\nGLEW_FUN_EXPORT PFNGLSCISSORINDEXEDPROC __glewScissorIndexed;\nGLEW_FUN_EXPORT PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv;\nGLEW_FUN_EXPORT PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv;\nGLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf;\nGLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv;\n\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB;\n\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI;\n\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI;\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI;\nGLEW_FUN_EXPORT PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI;\n\nGLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI;\nGLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI;\nGLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI;\nGLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI;\n\nGLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI;\nGLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI;\nGLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI;\nGLEW_FUN_EXPORT PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI;\nGLEW_FUN_EXPORT PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI;\nGLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI;\nGLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI;\nGLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI;\nGLEW_FUN_EXPORT PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI;\nGLEW_FUN_EXPORT PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI;\nGLEW_FUN_EXPORT PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI;\nGLEW_FUN_EXPORT PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI;\nGLEW_FUN_EXPORT PFNGLSAMPLEMAPATIPROC __glewSampleMapATI;\nGLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI;\n\nGLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI;\nGLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI;\n\nGLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI;\nGLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI;\n\nGLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI;\nGLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI;\n\nGLEW_FUN_EXPORT PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI;\nGLEW_FUN_EXPORT PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI;\nGLEW_FUN_EXPORT PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI;\nGLEW_FUN_EXPORT PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI;\nGLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI;\nGLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI;\nGLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI;\nGLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI;\nGLEW_FUN_EXPORT PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI;\nGLEW_FUN_EXPORT PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI;\nGLEW_FUN_EXPORT PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI;\nGLEW_FUN_EXPORT PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI;\n\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI;\n\nGLEW_FUN_EXPORT PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI;\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI;\nGLEW_FUN_EXPORT PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI;\nGLEW_FUN_EXPORT PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI;\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI;\n\nGLEW_FUN_EXPORT PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT;\n\nGLEW_FUN_EXPORT PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT;\n\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT;\n\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT;\n\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT;\n\nGLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT;\nGLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT;\n\nGLEW_FUN_EXPORT PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT;\nGLEW_FUN_EXPORT PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT;\n\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT;\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT;\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT;\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT;\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT;\nGLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT;\n\nGLEW_FUN_EXPORT PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT;\nGLEW_FUN_EXPORT PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT;\n\nGLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT;\n\nGLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT;\nGLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT;\n\nGLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT;\nGLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT;\nGLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT;\n\nGLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT;\n\nGLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT;\nGLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT;\nGLEW_FUN_EXPORT PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT;\nGLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT;\nGLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT;\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT;\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT;\nGLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT;\nGLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT;\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT;\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT;\nGLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT;\nGLEW_FUN_EXPORT PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT;\nGLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT;\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT;\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT;\nGLEW_FUN_EXPORT PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT;\nGLEW_FUN_EXPORT PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT;\nGLEW_FUN_EXPORT PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT;\nGLEW_FUN_EXPORT PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT;\nGLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT;\nGLEW_FUN_EXPORT PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT;\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT;\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT;\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT;\nGLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT;\nGLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT;\nGLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT;\nGLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DEXTPROC __glewProgramUniform1dEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVEXTPROC __glewProgramUniform1dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DEXTPROC __glewProgramUniform2dEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVEXTPROC __glewProgramUniform2dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DEXTPROC __glewProgramUniform3dEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVEXTPROC __glewProgramUniform3dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DEXTPROC __glewProgramUniform4dEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVEXTPROC __glewProgramUniform4dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC __glewProgramUniformMatrix2dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC __glewProgramUniformMatrix2x3dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC __glewProgramUniformMatrix2x4dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC __glewProgramUniformMatrix3dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC __glewProgramUniformMatrix3x2dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC __glewProgramUniformMatrix3x4dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC __glewProgramUniformMatrix4dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC __glewProgramUniformMatrix4x2dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC __glewProgramUniformMatrix4x3dvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT;\nGLEW_FUN_EXPORT PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT;\nGLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT;\n\nGLEW_FUN_EXPORT PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT;\nGLEW_FUN_EXPORT PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT;\nGLEW_FUN_EXPORT PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT;\nGLEW_FUN_EXPORT PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT;\nGLEW_FUN_EXPORT PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT;\nGLEW_FUN_EXPORT PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT;\n\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT;\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT;\n\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT;\n\nGLEW_FUN_EXPORT PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT;\nGLEW_FUN_EXPORT PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT;\nGLEW_FUN_EXPORT PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT;\nGLEW_FUN_EXPORT PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT;\nGLEW_FUN_EXPORT PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT;\n\nGLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT;\nGLEW_FUN_EXPORT PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT;\n\nGLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT;\n\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT;\n\nGLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT;\nGLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT;\nGLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT;\nGLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT;\nGLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT;\nGLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT;\nGLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT;\nGLEW_FUN_EXPORT PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT;\nGLEW_FUN_EXPORT PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT;\nGLEW_FUN_EXPORT PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT;\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT;\n\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT;\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT;\n\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT;\n\nGLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT;\nGLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT;\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT;\n\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT;\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT;\nGLEW_FUN_EXPORT PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT;\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT;\nGLEW_FUN_EXPORT PFNGLHISTOGRAMEXTPROC __glewHistogramEXT;\nGLEW_FUN_EXPORT PFNGLMINMAXEXTPROC __glewMinmaxEXT;\nGLEW_FUN_EXPORT PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT;\nGLEW_FUN_EXPORT PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT;\n\nGLEW_FUN_EXPORT PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT;\n\nGLEW_FUN_EXPORT PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT;\n\nGLEW_FUN_EXPORT PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT;\nGLEW_FUN_EXPORT PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT;\nGLEW_FUN_EXPORT PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT;\n\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT;\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT;\n\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT;\nGLEW_FUN_EXPORT PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT;\n\nGLEW_FUN_EXPORT PFNGLCOLORTABLEEXTPROC __glewColorTableEXT;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT;\n\nGLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT;\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT;\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT;\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT;\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT;\n\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT;\n\nGLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT;\n\nGLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT;\n\nGLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT;\nGLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT;\n\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT;\n\nGLEW_FUN_EXPORT PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT;\nGLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT;\nGLEW_FUN_EXPORT PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT;\n\nGLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT;\nGLEW_FUN_EXPORT PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT;\n\nGLEW_FUN_EXPORT PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT;\n\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT;\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT;\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT;\n\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT;\n\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT;\n\nGLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT;\n\nGLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT;\nGLEW_FUN_EXPORT PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT;\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT;\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT;\n\nGLEW_FUN_EXPORT PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT;\nGLEW_FUN_EXPORT PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT;\nGLEW_FUN_EXPORT PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT;\nGLEW_FUN_EXPORT PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT;\nGLEW_FUN_EXPORT PFNGLISTEXTUREEXTPROC __glewIsTextureEXT;\nGLEW_FUN_EXPORT PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT;\n\nGLEW_FUN_EXPORT PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT;\n\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT;\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT;\n\nGLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT;\nGLEW_FUN_EXPORT PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT;\nGLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT;\nGLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT;\nGLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT;\nGLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT;\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT;\n\nGLEW_FUN_EXPORT PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT;\nGLEW_FUN_EXPORT PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT;\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT;\nGLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT;\nGLEW_FUN_EXPORT PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT;\nGLEW_FUN_EXPORT PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT;\nGLEW_FUN_EXPORT PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT;\n\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT;\n\nGLEW_FUN_EXPORT PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT;\nGLEW_FUN_EXPORT PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT;\nGLEW_FUN_EXPORT PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT;\nGLEW_FUN_EXPORT PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT;\nGLEW_FUN_EXPORT PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT;\nGLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT;\nGLEW_FUN_EXPORT PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT;\nGLEW_FUN_EXPORT PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT;\nGLEW_FUN_EXPORT PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT;\nGLEW_FUN_EXPORT PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT;\nGLEW_FUN_EXPORT PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT;\nGLEW_FUN_EXPORT PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT;\nGLEW_FUN_EXPORT PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT;\nGLEW_FUN_EXPORT PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT;\nGLEW_FUN_EXPORT PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT;\nGLEW_FUN_EXPORT PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT;\nGLEW_FUN_EXPORT PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT;\nGLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT;\nGLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT;\nGLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT;\nGLEW_FUN_EXPORT PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT;\nGLEW_FUN_EXPORT PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT;\nGLEW_FUN_EXPORT PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT;\nGLEW_FUN_EXPORT PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT;\nGLEW_FUN_EXPORT PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT;\nGLEW_FUN_EXPORT PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT;\nGLEW_FUN_EXPORT PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT;\nGLEW_FUN_EXPORT PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT;\nGLEW_FUN_EXPORT PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT;\nGLEW_FUN_EXPORT PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT;\nGLEW_FUN_EXPORT PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT;\nGLEW_FUN_EXPORT PFNGLSWIZZLEEXTPROC __glewSwizzleEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTBVEXTPROC __glewVariantbvEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTDVEXTPROC __glewVariantdvEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTFVEXTPROC __glewVariantfvEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTIVEXTPROC __glewVariantivEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTSVEXTPROC __glewVariantsvEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT;\nGLEW_FUN_EXPORT PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT;\nGLEW_FUN_EXPORT PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT;\n\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT;\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT;\n\nGLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT;\n\nGLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY;\n\nGLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY;\n\nGLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP;\nGLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP;\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP;\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP;\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP;\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP;\n\nGLEW_FUN_EXPORT PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM;\nGLEW_FUN_EXPORT PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM;\n\nGLEW_FUN_EXPORT PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM;\nGLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM;\nGLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM;\nGLEW_FUN_EXPORT PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM;\nGLEW_FUN_EXPORT PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM;\nGLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM;\nGLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM;\n\nGLEW_FUN_EXPORT PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL;\nGLEW_FUN_EXPORT PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL;\nGLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL;\nGLEW_FUN_EXPORT PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL;\n\nGLEW_FUN_EXPORT PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL;\nGLEW_FUN_EXPORT PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL;\n\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback;\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl;\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert;\nGLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog;\nGLEW_FUN_EXPORT PFNGLGETOBJECTLABELPROC __glewGetObjectLabel;\nGLEW_FUN_EXPORT PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel;\nGLEW_FUN_EXPORT PFNGLGETPOINTERVPROC __glewGetPointerv;\nGLEW_FUN_EXPORT PFNGLOBJECTLABELPROC __glewObjectLabel;\nGLEW_FUN_EXPORT PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel;\nGLEW_FUN_EXPORT PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup;\n\nGLEW_FUN_EXPORT PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled;\nGLEW_FUN_EXPORT PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion;\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion;\nGLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion;\nGLEW_FUN_EXPORT PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion;\n\nGLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA;\n\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA;\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA;\n\nGLEW_FUN_EXPORT PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV;\nGLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV;\nGLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV;\nGLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV;\nGLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV;\n\nGLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV;\nGLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV;\n\nGLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV;\n\nGLEW_FUN_EXPORT PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV;\nGLEW_FUN_EXPORT PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV;\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV;\n\nGLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV;\nGLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV;\nGLEW_FUN_EXPORT PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV;\nGLEW_FUN_EXPORT PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV;\nGLEW_FUN_EXPORT PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV;\nGLEW_FUN_EXPORT PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV;\nGLEW_FUN_EXPORT PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV;\n\nGLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV;\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV;\nGLEW_FUN_EXPORT PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV;\n\nGLEW_FUN_EXPORT PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV;\nGLEW_FUN_EXPORT PFNGLFINISHFENCENVPROC __glewFinishFenceNV;\nGLEW_FUN_EXPORT PFNGLGENFENCESNVPROC __glewGenFencesNV;\nGLEW_FUN_EXPORT PFNGLGETFENCEIVNVPROC __glewGetFenceivNV;\nGLEW_FUN_EXPORT PFNGLISFENCENVPROC __glewIsFenceNV;\nGLEW_FUN_EXPORT PFNGLSETFENCENVPROC __glewSetFenceNV;\nGLEW_FUN_EXPORT PFNGLTESTFENCENVPROC __glewTestFenceNV;\n\nGLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV;\n\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV;\n\nGLEW_FUN_EXPORT PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV;\n\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV;\n\nGLEW_FUN_EXPORT PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV;\nGLEW_FUN_EXPORT PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV;\n\nGLEW_FUN_EXPORT PFNGLCOLOR3HNVPROC __glewColor3hNV;\nGLEW_FUN_EXPORT PFNGLCOLOR3HVNVPROC __glewColor3hvNV;\nGLEW_FUN_EXPORT PFNGLCOLOR4HNVPROC __glewColor4hNV;\nGLEW_FUN_EXPORT PFNGLCOLOR4HVNVPROC __glewColor4hvNV;\nGLEW_FUN_EXPORT PFNGLFOGCOORDHNVPROC __glewFogCoordhNV;\nGLEW_FUN_EXPORT PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV;\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV;\nGLEW_FUN_EXPORT PFNGLNORMAL3HNVPROC __glewNormal3hNV;\nGLEW_FUN_EXPORT PFNGLNORMAL3HVNVPROC __glewNormal3hvNV;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEX2HNVPROC __glewVertex2hNV;\nGLEW_FUN_EXPORT PFNGLVERTEX2HVNVPROC __glewVertex2hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEX3HNVPROC __glewVertex3hNV;\nGLEW_FUN_EXPORT PFNGLVERTEX3HVNVPROC __glewVertex3hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEX4HNVPROC __glewVertex4hNV;\nGLEW_FUN_EXPORT PFNGLVERTEX4HVNVPROC __glewVertex4hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV;\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV;\n\nGLEW_FUN_EXPORT PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV;\nGLEW_FUN_EXPORT PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV;\nGLEW_FUN_EXPORT PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV;\nGLEW_FUN_EXPORT PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV;\nGLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV;\nGLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV;\nGLEW_FUN_EXPORT PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV;\n\nGLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV;\n\nGLEW_FUN_EXPORT PFNGLCOPYPATHNVPROC __glewCopyPathNV;\nGLEW_FUN_EXPORT PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV;\nGLEW_FUN_EXPORT PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV;\nGLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV;\nGLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV;\nGLEW_FUN_EXPORT PFNGLDELETEPATHSNVPROC __glewDeletePathsNV;\nGLEW_FUN_EXPORT PFNGLGENPATHSNVPROC __glewGenPathsNV;\nGLEW_FUN_EXPORT PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV;\nGLEW_FUN_EXPORT PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV;\nGLEW_FUN_EXPORT PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV;\nGLEW_FUN_EXPORT PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV;\nGLEW_FUN_EXPORT PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV;\nGLEW_FUN_EXPORT PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV;\nGLEW_FUN_EXPORT PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV;\nGLEW_FUN_EXPORT PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV;\nGLEW_FUN_EXPORT PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV;\nGLEW_FUN_EXPORT PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV;\nGLEW_FUN_EXPORT PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV;\nGLEW_FUN_EXPORT PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV;\nGLEW_FUN_EXPORT PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV;\nGLEW_FUN_EXPORT PFNGLISPATHNVPROC __glewIsPathNV;\nGLEW_FUN_EXPORT PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV;\nGLEW_FUN_EXPORT PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV;\nGLEW_FUN_EXPORT PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV;\nGLEW_FUN_EXPORT PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV;\nGLEW_FUN_EXPORT PFNGLPATHCOORDSNVPROC __glewPathCoordsNV;\nGLEW_FUN_EXPORT PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV;\nGLEW_FUN_EXPORT PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV;\nGLEW_FUN_EXPORT PFNGLPATHFOGGENNVPROC __glewPathFogGenNV;\nGLEW_FUN_EXPORT PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV;\nGLEW_FUN_EXPORT PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV;\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV;\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV;\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV;\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV;\nGLEW_FUN_EXPORT PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV;\nGLEW_FUN_EXPORT PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV;\nGLEW_FUN_EXPORT PFNGLPATHSTRINGNVPROC __glewPathStringNV;\nGLEW_FUN_EXPORT PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV;\nGLEW_FUN_EXPORT PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV;\nGLEW_FUN_EXPORT PFNGLPATHTEXGENNVPROC __glewPathTexGenNV;\nGLEW_FUN_EXPORT PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV;\nGLEW_FUN_EXPORT PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV;\nGLEW_FUN_EXPORT PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV;\nGLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV;\nGLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV;\nGLEW_FUN_EXPORT PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV;\nGLEW_FUN_EXPORT PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV;\n\nGLEW_FUN_EXPORT PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV;\nGLEW_FUN_EXPORT PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV;\n\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV;\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV;\n\nGLEW_FUN_EXPORT PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV;\nGLEW_FUN_EXPORT PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV;\nGLEW_FUN_EXPORT PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV;\n\nGLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV;\nGLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV;\n\nGLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV;\nGLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV;\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV;\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV;\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV;\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV;\nGLEW_FUN_EXPORT PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV;\nGLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV;\nGLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV;\nGLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV;\n\nGLEW_FUN_EXPORT PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV;\n\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV;\nGLEW_FUN_EXPORT PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV;\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV;\nGLEW_FUN_EXPORT PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV;\nGLEW_FUN_EXPORT PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV;\nGLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV;\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV;\nGLEW_FUN_EXPORT PFNGLUNIFORMUI64NVPROC __glewUniformui64NV;\nGLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV;\n\nGLEW_FUN_EXPORT PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV;\n\nGLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV;\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV;\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV;\n\nGLEW_FUN_EXPORT PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV;\nGLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV;\nGLEW_FUN_EXPORT PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV;\nGLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV;\nGLEW_FUN_EXPORT PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV;\nGLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV;\nGLEW_FUN_EXPORT PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV;\nGLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV;\nGLEW_FUN_EXPORT PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV;\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV;\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV;\n\nGLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV;\nGLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV;\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV;\nGLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV;\nGLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV;\nGLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV;\nGLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV;\n\nGLEW_FUN_EXPORT PFNGLVDPAUFININVPROC __glewVDPAUFiniNV;\nGLEW_FUN_EXPORT PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV;\nGLEW_FUN_EXPORT PFNGLVDPAUINITNVPROC __glewVDPAUInitNV;\nGLEW_FUN_EXPORT PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV;\nGLEW_FUN_EXPORT PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV;\nGLEW_FUN_EXPORT PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV;\nGLEW_FUN_EXPORT PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV;\nGLEW_FUN_EXPORT PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV;\nGLEW_FUN_EXPORT PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV;\nGLEW_FUN_EXPORT PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV;\n\nGLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV;\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV;\n\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV;\n\nGLEW_FUN_EXPORT PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV;\nGLEW_FUN_EXPORT PFNGLCOLORFORMATNVPROC __glewColorFormatNV;\nGLEW_FUN_EXPORT PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV;\nGLEW_FUN_EXPORT PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV;\nGLEW_FUN_EXPORT PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV;\nGLEW_FUN_EXPORT PFNGLINDEXFORMATNVPROC __glewIndexFormatNV;\nGLEW_FUN_EXPORT PFNGLNORMALFORMATNVPROC __glewNormalFormatNV;\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV;\nGLEW_FUN_EXPORT PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV;\nGLEW_FUN_EXPORT PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV;\n\nGLEW_FUN_EXPORT PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV;\nGLEW_FUN_EXPORT PFNGLBINDPROGRAMNVPROC __glewBindProgramNV;\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV;\nGLEW_FUN_EXPORT PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV;\nGLEW_FUN_EXPORT PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV;\nGLEW_FUN_EXPORT PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV;\nGLEW_FUN_EXPORT PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV;\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV;\nGLEW_FUN_EXPORT PFNGLISPROGRAMNVPROC __glewIsProgramNV;\nGLEW_FUN_EXPORT PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV;\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV;\nGLEW_FUN_EXPORT PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV;\nGLEW_FUN_EXPORT PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV;\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV;\n\nGLEW_FUN_EXPORT PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV;\nGLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV;\nGLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV;\nGLEW_FUN_EXPORT PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV;\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV;\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV;\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV;\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV;\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV;\n\nGLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES;\nGLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES;\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES;\nGLEW_FUN_EXPORT PFNGLFRUSTUMFOESPROC __glewFrustumfOES;\nGLEW_FUN_EXPORT PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES;\nGLEW_FUN_EXPORT PFNGLORTHOFOESPROC __glewOrthofOES;\n\nGLEW_FUN_EXPORT PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL;\n\nGLEW_FUN_EXPORT PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL;\nGLEW_FUN_EXPORT PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL;\n\nGLEW_FUN_EXPORT PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS;\nGLEW_FUN_EXPORT PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS;\n\nGLEW_FUN_EXPORT PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS;\nGLEW_FUN_EXPORT PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS;\n\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS;\nGLEW_FUN_EXPORT PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS;\n\nGLEW_FUN_EXPORT PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS;\nGLEW_FUN_EXPORT PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS;\n\nGLEW_FUN_EXPORT PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS;\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS;\n\nGLEW_FUN_EXPORT PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS;\nGLEW_FUN_EXPORT PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS;\n\nGLEW_FUN_EXPORT PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX;\nGLEW_FUN_EXPORT PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX;\nGLEW_FUN_EXPORT PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX;\nGLEW_FUN_EXPORT PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX;\nGLEW_FUN_EXPORT PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX;\nGLEW_FUN_EXPORT PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX;\n\nGLEW_FUN_EXPORT PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX;\n\nGLEW_FUN_EXPORT PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX;\n\nGLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX;\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX;\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX;\n\nGLEW_FUN_EXPORT PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX;\n\nGLEW_FUN_EXPORT PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX;\n\nGLEW_FUN_EXPORT PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX;\n\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX;\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX;\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX;\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX;\n\nGLEW_FUN_EXPORT PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX;\n\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI;\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI;\nGLEW_FUN_EXPORT PFNGLCOLORTABLESGIPROC __glewColorTableSGI;\nGLEW_FUN_EXPORT PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI;\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI;\n\nGLEW_FUN_EXPORT PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX;\n\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN;\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN;\n\nGLEW_FUN_EXPORT PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN;\n\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN;\n\nGLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN;\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN;\n\nGLEW_FUN_EXPORT PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN;\n\n#if defined(GLEW_MX) && !defined(_WIN32)\nstruct GLEWContextStruct\n{\n#endif /* GLEW_MX */\n\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_0;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_2;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_3;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_0;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_2;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_3;\nGLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_blend_minmax_factor;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_multi_draw_indirect;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_name_gen_delete;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_performance_monitor;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_pinned_memory;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_query_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_sample_positions;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_stencil_operation_extended;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_texture_texture4;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback3_lines_triangles;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_layer;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_tessellator;\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_viewport_index;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_aux_depth_stencil;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_client_storage;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_element_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_fence;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_float_pixels;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_flush_buffer_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_object_purgeable;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_pixel_buffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_rgb_422;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_row_bytes;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_specular_vector;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_texture_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_transform_hint;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_program_evaluators;\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_ycbcr_422;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES2_compatibility;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_compatibility;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_arrays_of_arrays;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_base_instance;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_blend_func_extended;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_cl_event;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_color_buffer_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_compatibility;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_compressed_texture_pixel_storage;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_conservative_depth;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_buffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_image;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_debug_output;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_buffer_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers_blend;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_elements_base_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_indirect;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_instanced;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_attrib_location;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_uniform_location;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_coord_conventions;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_layer_viewport;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program_shadow;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_no_attachments;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_sRGB;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_geometry_shader4;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_program_binary;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader5;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_fp64;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_pixel;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_imaging;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_instanced_arrays;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query2;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_invalidate_subdata;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_alignment;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_matrix_palette;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_draw_indirect;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_multitexture;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query2;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_pixel_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_parameters;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_sprite;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_program_interface_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_provoking_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robust_buffer_access_behavior;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_application_isolation;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_share_group_isolation;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_sample_shading;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_sampler_objects;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cube_map;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_separate_shader_objects;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_atomic_counters;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_bit_encoding;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_load_store;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_size;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_objects;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_precision;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_stencil_export;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_storage_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_subroutine;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_lod;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_100;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_420pack;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_include;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_packing;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow_ambient;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_stencil_texturing;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_sync;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_tessellation_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_border_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object_rgb32;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_bptc;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_rgtc;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_add;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_combine;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_crossbar;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_dot3;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_gather;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirrored_repeat;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_non_power_of_two;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_levels;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_lod;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rectangle;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rg;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rgb10_a2ui;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_swizzle;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_view;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_timer_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback2;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback3;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_instanced;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transpose_matrix;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_uniform_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_bgra;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_64bit;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_binding;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_blend;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_program;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_viewport_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_window_pos;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_vertex_shader_output_point_size;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_draw_buffers;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_element_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_envmap_bumpmap;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_fragment_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_map_object_buffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_meminfo;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_pn_triangles;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_separate_stencil;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_shader_texture_lod;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_text_fragment_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_compression_3dc;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_env_combine3;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_bgra;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_bindable_uniform;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_color;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_equation_separate;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_func_separate;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_logic_op;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_color_subtable;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_compiled_vertex_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_instanced;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_fragment_lighting;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_blit;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_sRGB;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_geometry_shader4;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_program_parameters;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_shader4;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_histogram;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_array_formats;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_func;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_material;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_light_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_misc_attribute;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_multi_draw_arrays;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_paletted_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform_color_table;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_provoking_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_secondary_color;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_shader_objects;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_store;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_funcs;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_latc;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_rgtc;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_add;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_combine;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_integer;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_decode;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shared_exponent;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_snorm;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_swizzle;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_timer_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_transform_feedback;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array_bgra;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_attrib_64bit;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting;\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator;\nGLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker;\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes;\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_image_transform;\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_occlusion_test;\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_texture_lighting;\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_cull_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_multimode_draw_arrays;\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip;\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data;\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat;\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists;\nGLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read;\nGLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays;\nGLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor;\nGLEW_VAR_EXPORT GLboolean __GLEW_KHR_debug;\nGLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_ldr;\nGLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region;\nGLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack;\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert;\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers;\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos;\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_conditional_render;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_image;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_buffer_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_range_unclamped;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_explicit_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fence;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_float_buffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fog_distance;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program4;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_multisample_coverage;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_program4;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader4;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program4;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program_fp64;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_shader5;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_half_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_coverage;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_occlusion_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_packed_depth_stencil;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_pixel_data_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_present_video;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_buffer_load;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_tessellation_program5;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_barrier;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader3;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_attrib_integer_64bit;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_buffer_unified_memory;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program4;\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture;\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates;\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format;\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_single_precision;\nGLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace;\nGLEW_VAR_EXPORT GLboolean __GLEW_OML_resample;\nGLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample;\nGLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints;\nGLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints;\nGLEW_VAR_EXPORT GLboolean __GLEW_REGAL_error_string;\nGLEW_VAR_EXPORT GLboolean __GLEW_REGAL_extension_query;\nGLEW_VAR_EXPORT GLboolean __GLEW_REGAL_log;\nGLEW_VAR_EXPORT GLboolean __GLEW_REND_screen_coordinates;\nGLEW_VAR_EXPORT GLboolean __GLEW_S3_s3tc;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_color_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_detail_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_fog_function;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_generate_mipmap;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_multisample;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_pixel_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_point_line_texgen;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_sharpen_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture4D;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_border_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_edge_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_filter4;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_lod;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_select;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_histogram;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_pixel;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_blend_alpha_minmax;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_clipmap;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_convolution_accuracy;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_depth_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_flush_raster;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_offset;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fragment_specular_lighting;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_framezoom;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_interlace;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ir_instrument1;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_list_priority;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture_bits;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_reference_plane;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_resample;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow_ambient;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_sprite;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_tag_sample_buffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_add_env;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_coordinate_clamp;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_lod_bias;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_multi_buffer;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_range;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_scale_bias;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip_hint;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ycrcb;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_matrix;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_table;\nGLEW_VAR_EXPORT GLboolean __GLEW_SGI_texture_color_table;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUNX_constant_data;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_convolution_border_modes;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_global_alpha;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_mesh_array;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list;\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex;\nGLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading;\nGLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog;\nGLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint;\n\n#ifdef GLEW_MX\n}; /* GLEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------- */\n\n/* error codes */\n#define GLEW_OK 0\n#define GLEW_NO_ERROR 0\n#define GLEW_ERROR_NO_GL_VERSION 1  /* missing GL version */\n#define GLEW_ERROR_GL_VERSION_10_ONLY 2  /* Need at least OpenGL 1.1 */\n#define GLEW_ERROR_GLX_VERSION_11_ONLY 3  /* Need at least GLX 1.2 */\n\n/* string codes */\n#define GLEW_VERSION 1\n#define GLEW_VERSION_MAJOR 2\n#define GLEW_VERSION_MINOR 3\n#define GLEW_VERSION_MICRO 4\n\n/* API */\n#ifdef GLEW_MX\n\ntypedef struct GLEWContextStruct GLEWContext;\nGLEWAPI GLenum GLEWAPIENTRY glewContextInit (GLEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext *ctx, const char *name);\n\n#define glewInit() glewContextInit(glewGetContext())\n#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)\n#define glewIsExtensionSupported(x) glewIsSupported(x)\n\n#define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x))\n#ifdef _WIN32\n#  define GLEW_GET_FUN(x) glewGetContext()->x\n#else\n#  define GLEW_GET_FUN(x) x\n#endif\n\n#else /* GLEW_MX */\n\nGLEWAPI GLenum GLEWAPIENTRY glewInit (void);\nGLEWAPI GLboolean GLEWAPIENTRY glewIsSupported (const char *name);\n#define glewIsExtensionSupported(x) glewIsSupported(x)\n\n#define GLEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define GLEW_GET_FUN(x) x\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean glewExperimental;\nGLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name);\nGLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error);\nGLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#ifdef GLEW_APIENTRY_DEFINED\n#undef GLEW_APIENTRY_DEFINED\n#undef APIENTRY\n#undef GLAPIENTRY\n#define GLAPIENTRY\n#endif\n\n#ifdef GLEW_CALLBACK_DEFINED\n#undef GLEW_CALLBACK_DEFINED\n#undef CALLBACK\n#endif\n\n#ifdef GLEW_WINGDIAPI_DEFINED\n#undef GLEW_WINGDIAPI_DEFINED\n#undef WINGDIAPI\n#endif\n\n#undef GLAPI\n/* #undef GLEWAPI */\n\n#endif /* __glew_h__ */\n"
  },
  {
    "path": "Engine/porting/OSX/glew/include/GL/glxew.h",
    "content": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>\n** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>\n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n**   this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n**   this list of conditions and the following disclaimer in the documentation \n**   and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n**   derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n * Mesa 3-D graphics library\n * Version:  7.0\n *\n * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __glxew_h__\n#define __glxew_h__\n#define __GLXEW_H__\n\n#ifdef __glxext_h_\n#error glxext.h included before glxew.h\n#endif\n\n#if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__)\n#error glx.h included before glxew.h\n#endif\n\n#define __glxext_h_\n\n#define GLX_H\n#define __GLX_glx_h__\n#define __glx_h__\n\n#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n#include <X11/Xmd.h>\n#include <GL/glew.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* ---------------------------- GLX_VERSION_1_0 --------------------------- */\n\n#ifndef GLX_VERSION_1_0\n#define GLX_VERSION_1_0 1\n\n#define GLX_USE_GL 1\n#define GLX_BUFFER_SIZE 2\n#define GLX_LEVEL 3\n#define GLX_RGBA 4\n#define GLX_DOUBLEBUFFER 5\n#define GLX_STEREO 6\n#define GLX_AUX_BUFFERS 7\n#define GLX_RED_SIZE 8\n#define GLX_GREEN_SIZE 9\n#define GLX_BLUE_SIZE 10\n#define GLX_ALPHA_SIZE 11\n#define GLX_DEPTH_SIZE 12\n#define GLX_STENCIL_SIZE 13\n#define GLX_ACCUM_RED_SIZE 14\n#define GLX_ACCUM_GREEN_SIZE 15\n#define GLX_ACCUM_BLUE_SIZE 16\n#define GLX_ACCUM_ALPHA_SIZE 17\n#define GLX_BAD_SCREEN 1\n#define GLX_BAD_ATTRIBUTE 2\n#define GLX_NO_EXTENSION 3\n#define GLX_BAD_VISUAL 4\n#define GLX_BAD_CONTEXT 5\n#define GLX_BAD_VALUE 6\n#define GLX_BAD_ENUM 7\n\ntypedef XID GLXDrawable;\ntypedef XID GLXPixmap;\n#ifdef __sun\ntypedef struct __glXContextRec *GLXContext;\n#else\ntypedef struct __GLXcontextRec *GLXContext;\n#endif\n\ntypedef unsigned int GLXVideoDeviceNV; \n\nextern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);\nextern Bool glXQueryVersion (Display *dpy, int *major, int *minor);\nextern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);\nextern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);\nextern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);\nextern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);\nextern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);\nextern void glXDestroyContext (Display *dpy, GLXContext ctx);\nextern Bool glXIsDirect (Display *dpy, GLXContext ctx);\nextern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask);\nextern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);\nextern GLXContext glXGetCurrentContext (void);\nextern GLXDrawable glXGetCurrentDrawable (void);\nextern void glXWaitGL (void);\nextern void glXWaitX (void);\nextern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);\nextern void glXUseXFont (Font font, int first, int count, int listBase);\n\n#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0)\n\n#endif /* GLX_VERSION_1_0 */\n\n/* ---------------------------- GLX_VERSION_1_1 --------------------------- */\n\n#ifndef GLX_VERSION_1_1\n#define GLX_VERSION_1_1\n\n#define GLX_VENDOR 0x1\n#define GLX_VERSION 0x2\n#define GLX_EXTENSIONS 0x3\n\nextern const char* glXQueryExtensionsString (Display *dpy, int screen);\nextern const char* glXGetClientString (Display *dpy, int name);\nextern const char* glXQueryServerString (Display *dpy, int screen, int name);\n\n#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1)\n\n#endif /* GLX_VERSION_1_1 */\n\n/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */\n\n#ifndef GLX_VERSION_1_2\n#define GLX_VERSION_1_2 1\n\ntypedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void);\n\n#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay)\n\n#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2)\n\n#endif /* GLX_VERSION_1_2 */\n\n/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */\n\n#ifndef GLX_VERSION_1_3\n#define GLX_VERSION_1_3 1\n\n#define GLX_RGBA_BIT 0x00000001\n#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001\n#define GLX_WINDOW_BIT 0x00000001\n#define GLX_COLOR_INDEX_BIT 0x00000002\n#define GLX_PIXMAP_BIT 0x00000002\n#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002\n#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004\n#define GLX_PBUFFER_BIT 0x00000004\n#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008\n#define GLX_AUX_BUFFERS_BIT 0x00000010\n#define GLX_CONFIG_CAVEAT 0x20\n#define GLX_DEPTH_BUFFER_BIT 0x00000020\n#define GLX_X_VISUAL_TYPE 0x22\n#define GLX_TRANSPARENT_TYPE 0x23\n#define GLX_TRANSPARENT_INDEX_VALUE 0x24\n#define GLX_TRANSPARENT_RED_VALUE 0x25\n#define GLX_TRANSPARENT_GREEN_VALUE 0x26\n#define GLX_TRANSPARENT_BLUE_VALUE 0x27\n#define GLX_TRANSPARENT_ALPHA_VALUE 0x28\n#define GLX_STENCIL_BUFFER_BIT 0x00000040\n#define GLX_ACCUM_BUFFER_BIT 0x00000080\n#define GLX_NONE 0x8000\n#define GLX_SLOW_CONFIG 0x8001\n#define GLX_TRUE_COLOR 0x8002\n#define GLX_DIRECT_COLOR 0x8003\n#define GLX_PSEUDO_COLOR 0x8004\n#define GLX_STATIC_COLOR 0x8005\n#define GLX_GRAY_SCALE 0x8006\n#define GLX_STATIC_GRAY 0x8007\n#define GLX_TRANSPARENT_RGB 0x8008\n#define GLX_TRANSPARENT_INDEX 0x8009\n#define GLX_VISUAL_ID 0x800B\n#define GLX_SCREEN 0x800C\n#define GLX_NON_CONFORMANT_CONFIG 0x800D\n#define GLX_DRAWABLE_TYPE 0x8010\n#define GLX_RENDER_TYPE 0x8011\n#define GLX_X_RENDERABLE 0x8012\n#define GLX_FBCONFIG_ID 0x8013\n#define GLX_RGBA_TYPE 0x8014\n#define GLX_COLOR_INDEX_TYPE 0x8015\n#define GLX_MAX_PBUFFER_WIDTH 0x8016\n#define GLX_MAX_PBUFFER_HEIGHT 0x8017\n#define GLX_MAX_PBUFFER_PIXELS 0x8018\n#define GLX_PRESERVED_CONTENTS 0x801B\n#define GLX_LARGEST_PBUFFER 0x801C\n#define GLX_WIDTH 0x801D\n#define GLX_HEIGHT 0x801E\n#define GLX_EVENT_MASK 0x801F\n#define GLX_DAMAGED 0x8020\n#define GLX_SAVED 0x8021\n#define GLX_WINDOW 0x8022\n#define GLX_PBUFFER 0x8023\n#define GLX_PBUFFER_HEIGHT 0x8040\n#define GLX_PBUFFER_WIDTH 0x8041\n#define GLX_PBUFFER_CLOBBER_MASK 0x08000000\n#define GLX_DONT_CARE 0xFFFFFFFF\n\ntypedef XID GLXFBConfigID;\ntypedef XID GLXPbuffer;\ntypedef XID GLXWindow;\ntypedef struct __GLXFBConfigRec *GLXFBConfig;\n\ntypedef struct {\n  int event_type; \n  int draw_type; \n  unsigned long serial; \n  Bool send_event; \n  Display *display; \n  GLXDrawable drawable; \n  unsigned int buffer_mask; \n  unsigned int aux_buffer; \n  int x, y; \n  int width, height; \n  int count; \n} GLXPbufferClobberEvent;\ntypedef union __GLXEvent {\n  GLXPbufferClobberEvent glxpbufferclobber; \n  long pad[24]; \n} GLXEvent;\n\ntypedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\ntypedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\ntypedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);\ntypedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);\ntypedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);\ntypedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);\ntypedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);\ntypedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);\ntypedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);\ntypedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);\ntypedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\ntypedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);\ntypedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);\ntypedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);\n\n#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig)\n#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext)\n#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer)\n#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap)\n#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow)\n#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer)\n#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap)\n#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow)\n#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable)\n#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib)\n#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs)\n#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent)\n#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig)\n#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent)\n#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext)\n#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable)\n#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent)\n\n#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3)\n\n#endif /* GLX_VERSION_1_3 */\n\n/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */\n\n#ifndef GLX_VERSION_1_4\n#define GLX_VERSION_1_4 1\n\n#define GLX_SAMPLE_BUFFERS 100000\n#define GLX_SAMPLES 100001\n\nextern void ( * glXGetProcAddress (const GLubyte *procName)) (void);\n\n#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4)\n\n#endif /* GLX_VERSION_1_4 */\n\n/* -------------------------- GLX_3DFX_multisample ------------------------- */\n\n#ifndef GLX_3DFX_multisample\n#define GLX_3DFX_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_3DFX 0x8050\n#define GLX_SAMPLES_3DFX 0x8051\n\n#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample)\n\n#endif /* GLX_3DFX_multisample */\n\n/* ------------------------ GLX_AMD_gpu_association ------------------------ */\n\n#ifndef GLX_AMD_gpu_association\n#define GLX_AMD_gpu_association 1\n\n#define GLX_GPU_VENDOR_AMD 0x1F00\n#define GLX_GPU_RENDERER_STRING_AMD 0x1F01\n#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define GLX_GPU_RAM_AMD 0x21A3\n#define GLX_GPU_CLOCK_AMD 0x21A4\n#define GLX_GPU_NUM_PIPES_AMD 0x21A5\n#define GLX_GPU_NUM_SIMD_AMD 0x21A6\n#define GLX_GPU_NUM_RB_AMD 0x21A7\n#define GLX_GPU_NUM_SPI_AMD 0x21A8\n\n#define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association)\n\n#endif /* GLX_AMD_gpu_association */\n\n/* ------------------------- GLX_ARB_create_context ------------------------ */\n\n#ifndef GLX_ARB_create_context\n#define GLX_ARB_create_context 1\n\n#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001\n#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\n#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define GLX_CONTEXT_FLAGS_ARB 0x2094\n\ntypedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);\n\n#define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB)\n\n#define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context)\n\n#endif /* GLX_ARB_create_context */\n\n/* --------------------- GLX_ARB_create_context_profile -------------------- */\n\n#ifndef GLX_ARB_create_context_profile\n#define GLX_ARB_create_context_profile 1\n\n#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126\n\n#define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile)\n\n#endif /* GLX_ARB_create_context_profile */\n\n/* ------------------- GLX_ARB_create_context_robustness ------------------- */\n\n#ifndef GLX_ARB_create_context_robustness\n#define GLX_ARB_create_context_robustness 1\n\n#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261\n\n#define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness)\n\n#endif /* GLX_ARB_create_context_robustness */\n\n/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */\n\n#ifndef GLX_ARB_fbconfig_float\n#define GLX_ARB_fbconfig_float 1\n\n#define GLX_RGBA_FLOAT_BIT 0x00000004\n#define GLX_RGBA_FLOAT_TYPE 0x20B9\n\n#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float)\n\n#endif /* GLX_ARB_fbconfig_float */\n\n/* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */\n\n#ifndef GLX_ARB_framebuffer_sRGB\n#define GLX_ARB_framebuffer_sRGB 1\n\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2\n\n#define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB)\n\n#endif /* GLX_ARB_framebuffer_sRGB */\n\n/* ------------------------ GLX_ARB_get_proc_address ----------------------- */\n\n#ifndef GLX_ARB_get_proc_address\n#define GLX_ARB_get_proc_address 1\n\nextern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);\n\n#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address)\n\n#endif /* GLX_ARB_get_proc_address */\n\n/* -------------------------- GLX_ARB_multisample -------------------------- */\n\n#ifndef GLX_ARB_multisample\n#define GLX_ARB_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_ARB 100000\n#define GLX_SAMPLES_ARB 100001\n\n#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample)\n\n#endif /* GLX_ARB_multisample */\n\n/* ---------------- GLX_ARB_robustness_application_isolation --------------- */\n\n#ifndef GLX_ARB_robustness_application_isolation\n#define GLX_ARB_robustness_application_isolation 1\n\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n\n#define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation)\n\n#endif /* GLX_ARB_robustness_application_isolation */\n\n/* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */\n\n#ifndef GLX_ARB_robustness_share_group_isolation\n#define GLX_ARB_robustness_share_group_isolation 1\n\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n\n#define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation)\n\n#endif /* GLX_ARB_robustness_share_group_isolation */\n\n/* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */\n\n#ifndef GLX_ARB_vertex_buffer_object\n#define GLX_ARB_vertex_buffer_object 1\n\n#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095\n\n#define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object)\n\n#endif /* GLX_ARB_vertex_buffer_object */\n\n/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */\n\n#ifndef GLX_ATI_pixel_format_float\n#define GLX_ATI_pixel_format_float 1\n\n#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100\n\n#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float)\n\n#endif /* GLX_ATI_pixel_format_float */\n\n/* ------------------------- GLX_ATI_render_texture ------------------------ */\n\n#ifndef GLX_ATI_render_texture\n#define GLX_ATI_render_texture 1\n\n#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800\n#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801\n#define GLX_TEXTURE_FORMAT_ATI 0x9802\n#define GLX_TEXTURE_TARGET_ATI 0x9803\n#define GLX_MIPMAP_TEXTURE_ATI 0x9804\n#define GLX_TEXTURE_RGB_ATI 0x9805\n#define GLX_TEXTURE_RGBA_ATI 0x9806\n#define GLX_NO_TEXTURE_ATI 0x9807\n#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808\n#define GLX_TEXTURE_1D_ATI 0x9809\n#define GLX_TEXTURE_2D_ATI 0x980A\n#define GLX_MIPMAP_LEVEL_ATI 0x980B\n#define GLX_CUBE_MAP_FACE_ATI 0x980C\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812\n#define GLX_FRONT_LEFT_ATI 0x9813\n#define GLX_FRONT_RIGHT_ATI 0x9814\n#define GLX_BACK_LEFT_ATI 0x9815\n#define GLX_BACK_RIGHT_ATI 0x9816\n#define GLX_AUX0_ATI 0x9817\n#define GLX_AUX1_ATI 0x9818\n#define GLX_AUX2_ATI 0x9819\n#define GLX_AUX3_ATI 0x981A\n#define GLX_AUX4_ATI 0x981B\n#define GLX_AUX5_ATI 0x981C\n#define GLX_AUX6_ATI 0x981D\n#define GLX_AUX7_ATI 0x981E\n#define GLX_AUX8_ATI 0x981F\n#define GLX_AUX9_ATI 0x9820\n#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821\n#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822\n\ntypedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\ntypedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list);\ntypedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\n\n#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI)\n#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI)\n#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI)\n\n#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture)\n\n#endif /* GLX_ATI_render_texture */\n\n/* ------------------- GLX_EXT_create_context_es2_profile ------------------ */\n\n#ifndef GLX_EXT_create_context_es2_profile\n#define GLX_EXT_create_context_es2_profile 1\n\n#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n\n#define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile)\n\n#endif /* GLX_EXT_create_context_es2_profile */\n\n/* ------------------- GLX_EXT_create_context_es_profile ------------------- */\n\n#ifndef GLX_EXT_create_context_es_profile\n#define GLX_EXT_create_context_es_profile 1\n\n#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n\n#define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile)\n\n#endif /* GLX_EXT_create_context_es_profile */\n\n/* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */\n\n#ifndef GLX_EXT_fbconfig_packed_float\n#define GLX_EXT_fbconfig_packed_float 1\n\n#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008\n#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1\n\n#define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float)\n\n#endif /* GLX_EXT_fbconfig_packed_float */\n\n/* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */\n\n#ifndef GLX_EXT_framebuffer_sRGB\n#define GLX_EXT_framebuffer_sRGB 1\n\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2\n\n#define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB)\n\n#endif /* GLX_EXT_framebuffer_sRGB */\n\n/* ------------------------- GLX_EXT_import_context ------------------------ */\n\n#ifndef GLX_EXT_import_context\n#define GLX_EXT_import_context 1\n\n#define GLX_SHARE_CONTEXT_EXT 0x800A\n#define GLX_VISUAL_ID_EXT 0x800B\n#define GLX_SCREEN_EXT 0x800C\n\ntypedef XID GLXContextID;\n\ntypedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context);\ntypedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);\ntypedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID);\ntypedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value);\n\n#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT)\n#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT)\n#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT)\n#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT)\n\n#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context)\n\n#endif /* GLX_EXT_import_context */\n\n/* -------------------------- GLX_EXT_scene_marker ------------------------- */\n\n#ifndef GLX_EXT_scene_marker\n#define GLX_EXT_scene_marker 1\n\n#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker)\n\n#endif /* GLX_EXT_scene_marker */\n\n/* -------------------------- GLX_EXT_swap_control ------------------------- */\n\n#ifndef GLX_EXT_swap_control\n#define GLX_EXT_swap_control 1\n\n#define GLX_SWAP_INTERVAL_EXT 0x20F1\n#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2\n\ntypedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval);\n\n#define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT)\n\n#define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control)\n\n#endif /* GLX_EXT_swap_control */\n\n/* ----------------------- GLX_EXT_swap_control_tear ----------------------- */\n\n#ifndef GLX_EXT_swap_control_tear\n#define GLX_EXT_swap_control_tear 1\n\n#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3\n\n#define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear)\n\n#endif /* GLX_EXT_swap_control_tear */\n\n/* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */\n\n#ifndef GLX_EXT_texture_from_pixmap\n#define GLX_EXT_texture_from_pixmap 1\n\n#define GLX_TEXTURE_1D_BIT_EXT 0x00000001\n#define GLX_TEXTURE_2D_BIT_EXT 0x00000002\n#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004\n#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0\n#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1\n#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2\n#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3\n#define GLX_Y_INVERTED_EXT 0x20D4\n#define GLX_TEXTURE_FORMAT_EXT 0x20D5\n#define GLX_TEXTURE_TARGET_EXT 0x20D6\n#define GLX_MIPMAP_TEXTURE_EXT 0x20D7\n#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8\n#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9\n#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA\n#define GLX_TEXTURE_1D_EXT 0x20DB\n#define GLX_TEXTURE_2D_EXT 0x20DC\n#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD\n#define GLX_FRONT_LEFT_EXT 0x20DE\n#define GLX_FRONT_RIGHT_EXT 0x20DF\n#define GLX_BACK_LEFT_EXT 0x20E0\n#define GLX_BACK_RIGHT_EXT 0x20E1\n#define GLX_AUX0_EXT 0x20E2\n#define GLX_AUX1_EXT 0x20E3\n#define GLX_AUX2_EXT 0x20E4\n#define GLX_AUX3_EXT 0x20E5\n#define GLX_AUX4_EXT 0x20E6\n#define GLX_AUX5_EXT 0x20E7\n#define GLX_AUX6_EXT 0x20E8\n#define GLX_AUX7_EXT 0x20E9\n#define GLX_AUX8_EXT 0x20EA\n#define GLX_AUX9_EXT 0x20EB\n\ntypedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list);\ntypedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer);\n\n#define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT)\n#define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT)\n\n#define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap)\n\n#endif /* GLX_EXT_texture_from_pixmap */\n\n/* -------------------------- GLX_EXT_visual_info -------------------------- */\n\n#ifndef GLX_EXT_visual_info\n#define GLX_EXT_visual_info 1\n\n#define GLX_X_VISUAL_TYPE_EXT 0x22\n#define GLX_TRANSPARENT_TYPE_EXT 0x23\n#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24\n#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25\n#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26\n#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27\n#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28\n#define GLX_NONE_EXT 0x8000\n#define GLX_TRUE_COLOR_EXT 0x8002\n#define GLX_DIRECT_COLOR_EXT 0x8003\n#define GLX_PSEUDO_COLOR_EXT 0x8004\n#define GLX_STATIC_COLOR_EXT 0x8005\n#define GLX_GRAY_SCALE_EXT 0x8006\n#define GLX_STATIC_GRAY_EXT 0x8007\n#define GLX_TRANSPARENT_RGB_EXT 0x8008\n#define GLX_TRANSPARENT_INDEX_EXT 0x8009\n\n#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info)\n\n#endif /* GLX_EXT_visual_info */\n\n/* ------------------------- GLX_EXT_visual_rating ------------------------- */\n\n#ifndef GLX_EXT_visual_rating\n#define GLX_EXT_visual_rating 1\n\n#define GLX_VISUAL_CAVEAT_EXT 0x20\n#define GLX_SLOW_VISUAL_EXT 0x8001\n#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D\n\n#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating)\n\n#endif /* GLX_EXT_visual_rating */\n\n/* -------------------------- GLX_INTEL_swap_event ------------------------- */\n\n#ifndef GLX_INTEL_swap_event\n#define GLX_INTEL_swap_event 1\n\n#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180\n#define GLX_COPY_COMPLETE_INTEL 0x8181\n#define GLX_FLIP_COMPLETE_INTEL 0x8182\n#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000\n\n#define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event)\n\n#endif /* GLX_INTEL_swap_event */\n\n/* -------------------------- GLX_MESA_agp_offset -------------------------- */\n\n#ifndef GLX_MESA_agp_offset\n#define GLX_MESA_agp_offset 1\n\ntypedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer);\n\n#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA)\n\n#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset)\n\n#endif /* GLX_MESA_agp_offset */\n\n/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */\n\n#ifndef GLX_MESA_copy_sub_buffer\n#define GLX_MESA_copy_sub_buffer 1\n\ntypedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height);\n\n#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA)\n\n#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer)\n\n#endif /* GLX_MESA_copy_sub_buffer */\n\n/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */\n\n#ifndef GLX_MESA_pixmap_colormap\n#define GLX_MESA_pixmap_colormap 1\n\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);\n\n#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA)\n\n#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap)\n\n#endif /* GLX_MESA_pixmap_colormap */\n\n/* ------------------------ GLX_MESA_release_buffers ----------------------- */\n\n#ifndef GLX_MESA_release_buffers\n#define GLX_MESA_release_buffers 1\n\ntypedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d);\n\n#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA)\n\n#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers)\n\n#endif /* GLX_MESA_release_buffers */\n\n/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */\n\n#ifndef GLX_MESA_set_3dfx_mode\n#define GLX_MESA_set_3dfx_mode 1\n\n#define GLX_3DFX_WINDOW_MODE_MESA 0x1\n#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2\n\ntypedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode);\n\n#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA)\n\n#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode)\n\n#endif /* GLX_MESA_set_3dfx_mode */\n\n/* ------------------------- GLX_MESA_swap_control ------------------------- */\n\n#ifndef GLX_MESA_swap_control\n#define GLX_MESA_swap_control 1\n\ntypedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void);\ntypedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);\n\n#define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA)\n#define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA)\n\n#define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control)\n\n#endif /* GLX_MESA_swap_control */\n\n/* --------------------------- GLX_NV_copy_image --------------------------- */\n\n#ifndef GLX_NV_copy_image\n#define GLX_NV_copy_image 1\n\ntypedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV)\n\n#define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image)\n\n#endif /* GLX_NV_copy_image */\n\n/* -------------------------- GLX_NV_float_buffer -------------------------- */\n\n#ifndef GLX_NV_float_buffer\n#define GLX_NV_float_buffer 1\n\n#define GLX_FLOAT_COMPONENTS_NV 0x20B0\n\n#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer)\n\n#endif /* GLX_NV_float_buffer */\n\n/* ---------------------- GLX_NV_multisample_coverage ---------------------- */\n\n#ifndef GLX_NV_multisample_coverage\n#define GLX_NV_multisample_coverage 1\n\n#define GLX_COLOR_SAMPLES_NV 0x20B3\n#define GLX_COVERAGE_SAMPLES_NV 100001\n\n#define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage)\n\n#endif /* GLX_NV_multisample_coverage */\n\n/* -------------------------- GLX_NV_present_video ------------------------- */\n\n#ifndef GLX_NV_present_video\n#define GLX_NV_present_video 1\n\n#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0\n\ntypedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);\ntypedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);\n\n#define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV)\n#define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV)\n\n#define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video)\n\n#endif /* GLX_NV_present_video */\n\n/* --------------------------- GLX_NV_swap_group --------------------------- */\n\n#ifndef GLX_NV_swap_group\n#define GLX_NV_swap_group 1\n\ntypedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier);\ntypedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group);\ntypedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count);\ntypedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);\ntypedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);\ntypedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen);\n\n#define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV)\n#define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV)\n#define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV)\n#define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV)\n#define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV)\n#define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV)\n\n#define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group)\n\n#endif /* GLX_NV_swap_group */\n\n/* ----------------------- GLX_NV_vertex_array_range ----------------------- */\n\n#ifndef GLX_NV_vertex_array_range\n#define GLX_NV_vertex_array_range 1\n\ntypedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\ntypedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer);\n\n#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV)\n#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV)\n\n#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range)\n\n#endif /* GLX_NV_vertex_array_range */\n\n/* -------------------------- GLX_NV_video_capture ------------------------- */\n\n#ifndef GLX_NV_video_capture\n#define GLX_NV_video_capture 1\n\n#define GLX_DEVICE_ID_NV 0x20CD\n#define GLX_UNIQUE_ID_NV 0x20CE\n#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\ntypedef XID GLXVideoCaptureDeviceNV;\n\ntypedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);\ntypedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements);\ntypedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\ntypedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);\ntypedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\n\n#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV)\n#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV)\n#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV)\n#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV)\n#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV)\n\n#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture)\n\n#endif /* GLX_NV_video_capture */\n\n/* ---------------------------- GLX_NV_video_out --------------------------- */\n\n#ifndef GLX_NV_video_out\n#define GLX_NV_video_out 1\n\n#define GLX_VIDEO_OUT_COLOR_NV 0x20C3\n#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4\n#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5\n#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define GLX_VIDEO_OUT_FRAME_NV 0x20C8\n#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9\n#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA\n#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB\n#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC\n\ntypedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);\ntypedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);\ntypedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\ntypedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice);\ntypedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf);\ntypedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);\n\n#define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV)\n#define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV)\n#define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV)\n#define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV)\n#define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV)\n#define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV)\n\n#define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out)\n\n#endif /* GLX_NV_video_out */\n\n/* -------------------------- GLX_OML_swap_method -------------------------- */\n\n#ifndef GLX_OML_swap_method\n#define GLX_OML_swap_method 1\n\n#define GLX_SWAP_METHOD_OML 0x8060\n#define GLX_SWAP_EXCHANGE_OML 0x8061\n#define GLX_SWAP_COPY_OML 0x8062\n#define GLX_SWAP_UNDEFINED_OML 0x8063\n\n#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method)\n\n#endif /* GLX_OML_swap_method */\n\n/* -------------------------- GLX_OML_sync_control ------------------------- */\n\n#ifndef GLX_OML_sync_control\n#define GLX_OML_sync_control 1\n\ntypedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator);\ntypedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);\ntypedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);\ntypedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc);\ntypedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc);\n\n#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML)\n#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML)\n#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML)\n#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML)\n#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML)\n\n#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control)\n\n#endif /* GLX_OML_sync_control */\n\n/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */\n\n#ifndef GLX_SGIS_blended_overlay\n#define GLX_SGIS_blended_overlay 1\n\n#define GLX_BLENDED_RGBA_SGIS 0x8025\n\n#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay)\n\n#endif /* GLX_SGIS_blended_overlay */\n\n/* -------------------------- GLX_SGIS_color_range ------------------------- */\n\n#ifndef GLX_SGIS_color_range\n#define GLX_SGIS_color_range 1\n\n#define GLX_MIN_RED_SGIS 0\n#define GLX_MAX_GREEN_SGIS 0\n#define GLX_MIN_BLUE_SGIS 0\n#define GLX_MAX_ALPHA_SGIS 0\n#define GLX_MIN_GREEN_SGIS 0\n#define GLX_MIN_ALPHA_SGIS 0\n#define GLX_MAX_RED_SGIS 0\n#define GLX_EXTENDED_RANGE_SGIS 0\n#define GLX_MAX_BLUE_SGIS 0\n\n#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range)\n\n#endif /* GLX_SGIS_color_range */\n\n/* -------------------------- GLX_SGIS_multisample ------------------------- */\n\n#ifndef GLX_SGIS_multisample\n#define GLX_SGIS_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_SGIS 100000\n#define GLX_SAMPLES_SGIS 100001\n\n#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample)\n\n#endif /* GLX_SGIS_multisample */\n\n/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */\n\n#ifndef GLX_SGIS_shared_multisample\n#define GLX_SGIS_shared_multisample 1\n\n#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026\n#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027\n\n#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample)\n\n#endif /* GLX_SGIS_shared_multisample */\n\n/* --------------------------- GLX_SGIX_fbconfig --------------------------- */\n\n#ifndef GLX_SGIX_fbconfig\n#define GLX_SGIX_fbconfig 1\n\n#define GLX_WINDOW_BIT_SGIX 0x00000001\n#define GLX_RGBA_BIT_SGIX 0x00000001\n#define GLX_PIXMAP_BIT_SGIX 0x00000002\n#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002\n#define GLX_SCREEN_EXT 0x800C\n#define GLX_DRAWABLE_TYPE_SGIX 0x8010\n#define GLX_RENDER_TYPE_SGIX 0x8011\n#define GLX_X_RENDERABLE_SGIX 0x8012\n#define GLX_FBCONFIG_ID_SGIX 0x8013\n#define GLX_RGBA_TYPE_SGIX 0x8014\n#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015\n\ntypedef XID GLXFBConfigIDSGIX;\ntypedef struct __GLXFBConfigRec *GLXFBConfigSGIX;\n\ntypedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\ntypedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap);\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value);\ntypedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis);\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config);\n\n#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX)\n#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX)\n#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX)\n#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX)\n#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX)\n#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX)\n\n#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig)\n\n#endif /* GLX_SGIX_fbconfig */\n\n/* --------------------------- GLX_SGIX_hyperpipe -------------------------- */\n\n#ifndef GLX_SGIX_hyperpipe\n#define GLX_SGIX_hyperpipe 1\n\n#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001\n#define GLX_PIPE_RECT_SGIX 0x00000001\n#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002\n#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002\n#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003\n#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004\n#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80\n#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91\n#define GLX_BAD_HYPERPIPE_SGIX 92\n#define GLX_HYPERPIPE_ID_SGIX 0x8030\n\ntypedef struct {\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n  int  networkId; \n} GLXHyperpipeNetworkSGIX;\ntypedef struct {\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n  int XOrigin; \n  int YOrigin; \n  int maxHeight; \n  int maxWidth; \n} GLXPipeRectLimits;\ntypedef struct {\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n  int channel; \n  unsigned int participationType; \n  int timeSlice; \n} GLXHyperpipeConfigSGIX;\ntypedef struct {\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n  int srcXOrigin; \n  int srcYOrigin; \n  int srcWidth; \n  int srcHeight; \n  int destXOrigin; \n  int destYOrigin; \n  int destWidth; \n  int destHeight; \n} GLXPipeRect;\n\ntypedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);\ntypedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);\ntypedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);\ntypedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);\ntypedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);\ntypedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);\ntypedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);\ntypedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);\n\n#define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX)\n#define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX)\n#define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX)\n#define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX)\n#define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX)\n#define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX)\n#define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX)\n#define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX)\n\n#define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe)\n\n#endif /* GLX_SGIX_hyperpipe */\n\n/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */\n\n#ifndef GLX_SGIX_pbuffer\n#define GLX_SGIX_pbuffer 1\n\n#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001\n#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002\n#define GLX_PBUFFER_BIT_SGIX 0x00000004\n#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004\n#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008\n#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010\n#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020\n#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040\n#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080\n#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100\n#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016\n#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017\n#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018\n#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019\n#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A\n#define GLX_PRESERVED_CONTENTS_SGIX 0x801B\n#define GLX_LARGEST_PBUFFER_SGIX 0x801C\n#define GLX_WIDTH_SGIX 0x801D\n#define GLX_HEIGHT_SGIX 0x801E\n#define GLX_EVENT_MASK_SGIX 0x801F\n#define GLX_DAMAGED_SGIX 0x8020\n#define GLX_SAVED_SGIX 0x8021\n#define GLX_WINDOW_SGIX 0x8022\n#define GLX_PBUFFER_SGIX 0x8023\n#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000\n\ntypedef XID GLXPbufferSGIX;\ntypedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX;\n\ntypedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list);\ntypedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf);\ntypedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask);\ntypedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value);\ntypedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask);\n\n#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX)\n#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX)\n#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX)\n#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX)\n#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX)\n\n#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer)\n\n#endif /* GLX_SGIX_pbuffer */\n\n/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */\n\n#ifndef GLX_SGIX_swap_barrier\n#define GLX_SGIX_swap_barrier 1\n\ntypedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);\ntypedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);\n\n#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX)\n#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX)\n\n#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier)\n\n#endif /* GLX_SGIX_swap_barrier */\n\n/* -------------------------- GLX_SGIX_swap_group -------------------------- */\n\n#ifndef GLX_SGIX_swap_group\n#define GLX_SGIX_swap_group 1\n\ntypedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);\n\n#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX)\n\n#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group)\n\n#endif /* GLX_SGIX_swap_group */\n\n/* ------------------------- GLX_SGIX_video_resize ------------------------- */\n\n#ifndef GLX_SGIX_video_resize\n#define GLX_SGIX_video_resize 1\n\n#define GLX_SYNC_FRAME_SGIX 0x00000000\n#define GLX_SYNC_SWAP_SGIX 0x00000001\n\ntypedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window);\ntypedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h);\ntypedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype);\ntypedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h);\ntypedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);\n\n#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX)\n#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX)\n#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX)\n#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX)\n#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX)\n\n#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize)\n\n#endif /* GLX_SGIX_video_resize */\n\n/* ---------------------- GLX_SGIX_visual_select_group --------------------- */\n\n#ifndef GLX_SGIX_visual_select_group\n#define GLX_SGIX_visual_select_group 1\n\n#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028\n\n#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group)\n\n#endif /* GLX_SGIX_visual_select_group */\n\n/* ---------------------------- GLX_SGI_cushion ---------------------------- */\n\n#ifndef GLX_SGI_cushion\n#define GLX_SGI_cushion 1\n\ntypedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion);\n\n#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI)\n\n#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion)\n\n#endif /* GLX_SGI_cushion */\n\n/* ----------------------- GLX_SGI_make_current_read ----------------------- */\n\n#ifndef GLX_SGI_make_current_read\n#define GLX_SGI_make_current_read 1\n\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);\ntypedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\n\n#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI)\n#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI)\n\n#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read)\n\n#endif /* GLX_SGI_make_current_read */\n\n/* -------------------------- GLX_SGI_swap_control ------------------------- */\n\n#ifndef GLX_SGI_swap_control\n#define GLX_SGI_swap_control 1\n\ntypedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);\n\n#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI)\n\n#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control)\n\n#endif /* GLX_SGI_swap_control */\n\n/* --------------------------- GLX_SGI_video_sync -------------------------- */\n\n#ifndef GLX_SGI_video_sync\n#define GLX_SGI_video_sync 1\n\ntypedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count);\ntypedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count);\n\n#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI)\n#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI)\n\n#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync)\n\n#endif /* GLX_SGI_video_sync */\n\n/* --------------------- GLX_SUN_get_transparent_index --------------------- */\n\n#ifndef GLX_SUN_get_transparent_index\n#define GLX_SUN_get_transparent_index 1\n\ntypedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);\n\n#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN)\n\n#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index)\n\n#endif /* GLX_SUN_get_transparent_index */\n\n/* -------------------------- GLX_SUN_video_resize ------------------------- */\n\n#ifndef GLX_SUN_video_resize\n#define GLX_SUN_video_resize 1\n\n#define GLX_VIDEO_RESIZE_SUN 0x8171\n#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD\n\ntypedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor);\ntypedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor);\n\n#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN)\n#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN)\n\n#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize)\n\n#endif /* GLX_SUN_video_resize */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLXEW_FUN_EXPORT\n#define GLXEW_VAR_EXPORT\n#else\n#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT\n#define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT\n#endif /* GLEW_MX */\n\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay;\n\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig;\nGLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext;\nGLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer;\nGLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap;\nGLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow;\nGLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer;\nGLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap;\nGLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow;\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs;\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent;\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig;\nGLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent;\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext;\nGLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable;\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent;\n\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB;\n\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI;\nGLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI;\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI;\n\nGLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT;\nGLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT;\nGLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT;\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT;\n\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT;\n\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT;\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT;\n\nGLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA;\n\nGLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA;\n\nGLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA;\n\nGLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA;\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV;\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV;\nGLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV;\n\nGLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV;\nGLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV;\nGLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV;\nGLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV;\nGLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV;\n\nGLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;\nGLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML;\nGLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML;\nGLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML;\nGLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;\n\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX;\nGLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX;\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX;\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI;\nGLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI;\n\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI;\nGLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN;\n\nGLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN;\nGLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN;\n\n#if defined(GLEW_MX)\nstruct GLXEWContextStruct\n{\n#endif /* GLEW_MX */\n\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize;\n\n#ifdef GLEW_MX\n}; /* GLXEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------ */\n\n#ifdef GLEW_MX\n\ntypedef struct GLXEWContextStruct GLXEWContext;\nGLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name);\n\n#define glxewInit() glxewContextInit(glxewGetContext())\n#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x)\n\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x))\n#define GLXEW_GET_FUN(x) x\n\n#else /* GLEW_MX */\n\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define GLXEW_GET_FUN(x) x\n\nGLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __glxew_h__ */\n"
  },
  {
    "path": "Engine/porting/OSX/glew/include/GL/wglew.h",
    "content": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>\n** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>\n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n**   this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n**   this list of conditions and the following disclaimer in the documentation \n**   and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n**   derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __wglew_h__\n#define __wglew_h__\n#define __WGLEW_H__\n\n#ifdef __wglext_h_\n#error wglext.h included before wglew.h\n#endif\n\n#define __wglext_h_\n\n#if !defined(WINAPI)\n#  ifndef WIN32_LEAN_AND_MEAN\n#    define WIN32_LEAN_AND_MEAN 1\n#  endif\n#include <windows.h>\n#  undef WIN32_LEAN_AND_MEAN\n#endif\n\n/*\n * GLEW_STATIC needs to be set when using the static version.\n * GLEW_BUILD is set when building the DLL version.\n */\n#ifdef GLEW_STATIC\n#  define GLEWAPI extern\n#else\n#  ifdef GLEW_BUILD\n#    define GLEWAPI extern __declspec(dllexport)\n#  else\n#    define GLEWAPI extern __declspec(dllimport)\n#  endif\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* -------------------------- WGL_3DFX_multisample ------------------------- */\n\n#ifndef WGL_3DFX_multisample\n#define WGL_3DFX_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\n#define WGL_SAMPLES_3DFX 0x2061\n\n#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)\n\n#endif /* WGL_3DFX_multisample */\n\n/* ------------------------- WGL_3DL_stereo_control ------------------------ */\n\n#ifndef WGL_3DL_stereo_control\n#define WGL_3DL_stereo_control 1\n\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\n\ntypedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\n\n#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)\n\n#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)\n\n#endif /* WGL_3DL_stereo_control */\n\n/* ------------------------ WGL_AMD_gpu_association ------------------------ */\n\n#ifndef WGL_AMD_gpu_association\n#define WGL_AMD_gpu_association 1\n\n#define WGL_GPU_VENDOR_AMD 0x1F00\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define WGL_GPU_RAM_AMD 0x21A3\n#define WGL_GPU_CLOCK_AMD 0x21A4\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\n#define WGL_GPU_NUM_RB_AMD 0x21A7\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\n\ntypedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList);\ntypedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\ntypedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\ntypedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\ntypedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids);\ntypedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data);\ntypedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\n\n#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD)\n#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD)\n#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD)\n#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD)\n#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD)\n#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD)\n#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD)\n#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD)\n#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD)\n\n#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association)\n\n#endif /* WGL_AMD_gpu_association */\n\n/* ------------------------- WGL_ARB_buffer_region ------------------------- */\n\n#ifndef WGL_ARB_buffer_region\n#define WGL_ARB_buffer_region 1\n\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\n\ntypedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\ntypedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\ntypedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\ntypedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\n\n#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)\n#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)\n#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)\n#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)\n\n#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)\n\n#endif /* WGL_ARB_buffer_region */\n\n/* ------------------------- WGL_ARB_create_context ------------------------ */\n\n#ifndef WGL_ARB_create_context\n#define WGL_ARB_create_context 1\n\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\n#define ERROR_INVALID_VERSION_ARB 0x2095\n#define ERROR_INVALID_PROFILE_ARB 0x2096\n\ntypedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);\n\n#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB)\n\n#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context)\n\n#endif /* WGL_ARB_create_context */\n\n/* --------------------- WGL_ARB_create_context_profile -------------------- */\n\n#ifndef WGL_ARB_create_context_profile\n#define WGL_ARB_create_context_profile 1\n\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\n\n#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile)\n\n#endif /* WGL_ARB_create_context_profile */\n\n/* ------------------- WGL_ARB_create_context_robustness ------------------- */\n\n#ifndef WGL_ARB_create_context_robustness\n#define WGL_ARB_create_context_robustness 1\n\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\n\n#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness)\n\n#endif /* WGL_ARB_create_context_robustness */\n\n/* ----------------------- WGL_ARB_extensions_string ----------------------- */\n\n#ifndef WGL_ARB_extensions_string\n#define WGL_ARB_extensions_string 1\n\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\n\n#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)\n\n#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)\n\n#endif /* WGL_ARB_extensions_string */\n\n/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */\n\n#ifndef WGL_ARB_framebuffer_sRGB\n#define WGL_ARB_framebuffer_sRGB 1\n\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\n\n#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB)\n\n#endif /* WGL_ARB_framebuffer_sRGB */\n\n/* ----------------------- WGL_ARB_make_current_read ----------------------- */\n\n#ifndef WGL_ARB_make_current_read\n#define WGL_ARB_make_current_read 1\n\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\n\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\n#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)\n#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)\n\n#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)\n\n#endif /* WGL_ARB_make_current_read */\n\n/* -------------------------- WGL_ARB_multisample -------------------------- */\n\n#ifndef WGL_ARB_multisample\n#define WGL_ARB_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\n#define WGL_SAMPLES_ARB 0x2042\n\n#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)\n\n#endif /* WGL_ARB_multisample */\n\n/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */\n\n#ifndef WGL_ARB_pbuffer\n#define WGL_ARB_pbuffer 1\n\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\n#define WGL_PBUFFER_LOST_ARB 0x2036\n\nDECLARE_HANDLE(HPBUFFERARB);\n\ntypedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\n\n#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)\n#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)\n#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)\n#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)\n#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)\n\n#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)\n\n#endif /* WGL_ARB_pbuffer */\n\n/* -------------------------- WGL_ARB_pixel_format ------------------------- */\n\n#ifndef WGL_ARB_pixel_format\n#define WGL_ARB_pixel_format 1\n\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\n#define WGL_ACCELERATION_ARB 0x2003\n#define WGL_NEED_PALETTE_ARB 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\n#define WGL_SWAP_METHOD_ARB 0x2007\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\n#define WGL_TRANSPARENT_ARB 0x200A\n#define WGL_SHARE_DEPTH_ARB 0x200C\n#define WGL_SHARE_STENCIL_ARB 0x200D\n#define WGL_SHARE_ACCUM_ARB 0x200E\n#define WGL_SUPPORT_GDI_ARB 0x200F\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\n#define WGL_STEREO_ARB 0x2012\n#define WGL_PIXEL_TYPE_ARB 0x2013\n#define WGL_COLOR_BITS_ARB 0x2014\n#define WGL_RED_BITS_ARB 0x2015\n#define WGL_RED_SHIFT_ARB 0x2016\n#define WGL_GREEN_BITS_ARB 0x2017\n#define WGL_GREEN_SHIFT_ARB 0x2018\n#define WGL_BLUE_BITS_ARB 0x2019\n#define WGL_BLUE_SHIFT_ARB 0x201A\n#define WGL_ALPHA_BITS_ARB 0x201B\n#define WGL_ALPHA_SHIFT_ARB 0x201C\n#define WGL_ACCUM_BITS_ARB 0x201D\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\n#define WGL_DEPTH_BITS_ARB 0x2022\n#define WGL_STENCIL_BITS_ARB 0x2023\n#define WGL_AUX_BUFFERS_ARB 0x2024\n#define WGL_NO_ACCELERATION_ARB 0x2025\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\n#define WGL_FULL_ACCELERATION_ARB 0x2027\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\n#define WGL_SWAP_COPY_ARB 0x2029\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\n#define WGL_TYPE_RGBA_ARB 0x202B\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\n\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);\n\n#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)\n#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)\n#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)\n\n#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)\n\n#endif /* WGL_ARB_pixel_format */\n\n/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */\n\n#ifndef WGL_ARB_pixel_format_float\n#define WGL_ARB_pixel_format_float 1\n\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\n\n#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)\n\n#endif /* WGL_ARB_pixel_format_float */\n\n/* ------------------------- WGL_ARB_render_texture ------------------------ */\n\n#ifndef WGL_ARB_render_texture\n#define WGL_ARB_render_texture 1\n\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\n#define WGL_TEXTURE_TARGET_ARB 0x2073\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\n#define WGL_TEXTURE_RGB_ARB 0x2075\n#define WGL_TEXTURE_RGBA_ARB 0x2076\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\n#define WGL_TEXTURE_1D_ARB 0x2079\n#define WGL_TEXTURE_2D_ARB 0x207A\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\n#define WGL_FRONT_LEFT_ARB 0x2083\n#define WGL_FRONT_RIGHT_ARB 0x2084\n#define WGL_BACK_LEFT_ARB 0x2085\n#define WGL_BACK_RIGHT_ARB 0x2086\n#define WGL_AUX0_ARB 0x2087\n#define WGL_AUX1_ARB 0x2088\n#define WGL_AUX2_ARB 0x2089\n#define WGL_AUX3_ARB 0x208A\n#define WGL_AUX4_ARB 0x208B\n#define WGL_AUX5_ARB 0x208C\n#define WGL_AUX6_ARB 0x208D\n#define WGL_AUX7_ARB 0x208E\n#define WGL_AUX8_ARB 0x208F\n#define WGL_AUX9_ARB 0x2090\n\ntypedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\ntypedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\ntypedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);\n\n#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)\n#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)\n#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)\n\n#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)\n\n#endif /* WGL_ARB_render_texture */\n\n/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */\n\n#ifndef WGL_ATI_pixel_format_float\n#define WGL_ATI_pixel_format_float 1\n\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\n#define GL_RGBA_FLOAT_MODE_ATI 0x8820\n#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835\n\n#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)\n\n#endif /* WGL_ATI_pixel_format_float */\n\n/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */\n\n#ifndef WGL_ATI_render_texture_rectangle\n#define WGL_ATI_render_texture_rectangle 1\n\n#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5\n\n#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)\n\n#endif /* WGL_ATI_render_texture_rectangle */\n\n/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */\n\n#ifndef WGL_EXT_create_context_es2_profile\n#define WGL_EXT_create_context_es2_profile 1\n\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n\n#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile)\n\n#endif /* WGL_EXT_create_context_es2_profile */\n\n/* ------------------- WGL_EXT_create_context_es_profile ------------------- */\n\n#ifndef WGL_EXT_create_context_es_profile\n#define WGL_EXT_create_context_es_profile 1\n\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n\n#define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile)\n\n#endif /* WGL_EXT_create_context_es_profile */\n\n/* -------------------------- WGL_EXT_depth_float -------------------------- */\n\n#ifndef WGL_EXT_depth_float\n#define WGL_EXT_depth_float 1\n\n#define WGL_DEPTH_FLOAT_EXT 0x2040\n\n#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)\n\n#endif /* WGL_EXT_depth_float */\n\n/* ---------------------- WGL_EXT_display_color_table ---------------------- */\n\n#ifndef WGL_EXT_display_color_table\n#define WGL_EXT_display_color_table 1\n\ntypedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);\n\n#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)\n#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)\n#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)\n#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)\n\n#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)\n\n#endif /* WGL_EXT_display_color_table */\n\n/* ----------------------- WGL_EXT_extensions_string ----------------------- */\n\n#ifndef WGL_EXT_extensions_string\n#define WGL_EXT_extensions_string 1\n\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\n\n#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)\n\n#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)\n\n#endif /* WGL_EXT_extensions_string */\n\n/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */\n\n#ifndef WGL_EXT_framebuffer_sRGB\n#define WGL_EXT_framebuffer_sRGB 1\n\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\n\n#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)\n\n#endif /* WGL_EXT_framebuffer_sRGB */\n\n/* ----------------------- WGL_EXT_make_current_read ----------------------- */\n\n#ifndef WGL_EXT_make_current_read\n#define WGL_EXT_make_current_read 1\n\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\n\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\n#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)\n#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)\n\n#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)\n\n#endif /* WGL_EXT_make_current_read */\n\n/* -------------------------- WGL_EXT_multisample -------------------------- */\n\n#ifndef WGL_EXT_multisample\n#define WGL_EXT_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\n#define WGL_SAMPLES_EXT 0x2042\n\n#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)\n\n#endif /* WGL_EXT_multisample */\n\n/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */\n\n#ifndef WGL_EXT_pbuffer\n#define WGL_EXT_pbuffer 1\n\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\n\nDECLARE_HANDLE(HPBUFFEREXT);\n\ntypedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\n\n#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)\n#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)\n#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)\n#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)\n#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)\n\n#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)\n\n#endif /* WGL_EXT_pbuffer */\n\n/* -------------------------- WGL_EXT_pixel_format ------------------------- */\n\n#ifndef WGL_EXT_pixel_format\n#define WGL_EXT_pixel_format 1\n\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\n#define WGL_ACCELERATION_EXT 0x2003\n#define WGL_NEED_PALETTE_EXT 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\n#define WGL_SWAP_METHOD_EXT 0x2007\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\n#define WGL_TRANSPARENT_EXT 0x200A\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\n#define WGL_SHARE_DEPTH_EXT 0x200C\n#define WGL_SHARE_STENCIL_EXT 0x200D\n#define WGL_SHARE_ACCUM_EXT 0x200E\n#define WGL_SUPPORT_GDI_EXT 0x200F\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\n#define WGL_STEREO_EXT 0x2012\n#define WGL_PIXEL_TYPE_EXT 0x2013\n#define WGL_COLOR_BITS_EXT 0x2014\n#define WGL_RED_BITS_EXT 0x2015\n#define WGL_RED_SHIFT_EXT 0x2016\n#define WGL_GREEN_BITS_EXT 0x2017\n#define WGL_GREEN_SHIFT_EXT 0x2018\n#define WGL_BLUE_BITS_EXT 0x2019\n#define WGL_BLUE_SHIFT_EXT 0x201A\n#define WGL_ALPHA_BITS_EXT 0x201B\n#define WGL_ALPHA_SHIFT_EXT 0x201C\n#define WGL_ACCUM_BITS_EXT 0x201D\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\n#define WGL_DEPTH_BITS_EXT 0x2022\n#define WGL_STENCIL_BITS_EXT 0x2023\n#define WGL_AUX_BUFFERS_EXT 0x2024\n#define WGL_NO_ACCELERATION_EXT 0x2025\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\n#define WGL_FULL_ACCELERATION_EXT 0x2027\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\n#define WGL_SWAP_COPY_EXT 0x2029\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\n#define WGL_TYPE_RGBA_EXT 0x202B\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\n\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);\n\n#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)\n#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)\n#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)\n\n#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)\n\n#endif /* WGL_EXT_pixel_format */\n\n/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */\n\n#ifndef WGL_EXT_pixel_format_packed_float\n#define WGL_EXT_pixel_format_packed_float 1\n\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\n\n#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)\n\n#endif /* WGL_EXT_pixel_format_packed_float */\n\n/* -------------------------- WGL_EXT_swap_control ------------------------- */\n\n#ifndef WGL_EXT_swap_control\n#define WGL_EXT_swap_control 1\n\ntypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\n\n#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)\n#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)\n\n#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)\n\n#endif /* WGL_EXT_swap_control */\n\n/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */\n\n#ifndef WGL_EXT_swap_control_tear\n#define WGL_EXT_swap_control_tear 1\n\n#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear)\n\n#endif /* WGL_EXT_swap_control_tear */\n\n/* --------------------- WGL_I3D_digital_video_control --------------------- */\n\n#ifndef WGL_I3D_digital_video_control\n#define WGL_I3D_digital_video_control 1\n\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\n\ntypedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\n\n#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)\n#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)\n\n#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)\n\n#endif /* WGL_I3D_digital_video_control */\n\n/* ----------------------------- WGL_I3D_gamma ----------------------------- */\n\n#ifndef WGL_I3D_gamma\n#define WGL_I3D_gamma 1\n\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\n\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\n\n#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)\n#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)\n#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)\n#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)\n\n#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)\n\n#endif /* WGL_I3D_gamma */\n\n/* ---------------------------- WGL_I3D_genlock ---------------------------- */\n\n#ifndef WGL_I3D_genlock\n#define WGL_I3D_genlock 1\n\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\n\ntypedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\ntypedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);\ntypedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);\ntypedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);\n\n#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)\n#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)\n#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)\n#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)\n#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)\n#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)\n#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)\n#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)\n#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)\n#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)\n#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)\n#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)\n\n#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)\n\n#endif /* WGL_I3D_genlock */\n\n/* -------------------------- WGL_I3D_image_buffer ------------------------- */\n\n#ifndef WGL_I3D_image_buffer\n#define WGL_I3D_image_buffer 1\n\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\n\ntypedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);\ntypedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\ntypedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\ntypedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);\n\n#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)\n#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)\n#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)\n#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)\n\n#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)\n\n#endif /* WGL_I3D_image_buffer */\n\n/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */\n\n#ifndef WGL_I3D_swap_frame_lock\n#define WGL_I3D_swap_frame_lock 1\n\ntypedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);\n\n#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)\n#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)\n#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)\n#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)\n\n#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)\n\n#endif /* WGL_I3D_swap_frame_lock */\n\n/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */\n\n#ifndef WGL_I3D_swap_frame_usage\n#define WGL_I3D_swap_frame_usage 1\n\ntypedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n\n#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)\n#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)\n#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)\n#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)\n\n#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)\n\n#endif /* WGL_I3D_swap_frame_usage */\n\n/* --------------------------- WGL_NV_DX_interop --------------------------- */\n\n#ifndef WGL_NV_DX_interop\n#define WGL_NV_DX_interop 1\n\n#define WGL_ACCESS_READ_ONLY_NV 0x0000\n#define WGL_ACCESS_READ_WRITE_NV 0x0001\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002\n\ntypedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\ntypedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\ntypedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\ntypedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice);\ntypedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access);\ntypedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle);\ntypedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\ntypedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\n\n#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV)\n#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV)\n#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV)\n#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV)\n#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV)\n#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV)\n#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV)\n#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV)\n\n#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop)\n\n#endif /* WGL_NV_DX_interop */\n\n/* --------------------------- WGL_NV_DX_interop2 -------------------------- */\n\n#ifndef WGL_NV_DX_interop2\n#define WGL_NV_DX_interop2 1\n\n#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2)\n\n#endif /* WGL_NV_DX_interop2 */\n\n/* --------------------------- WGL_NV_copy_image --------------------------- */\n\n#ifndef WGL_NV_copy_image\n#define WGL_NV_copy_image 1\n\ntypedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV)\n\n#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image)\n\n#endif /* WGL_NV_copy_image */\n\n/* -------------------------- WGL_NV_float_buffer -------------------------- */\n\n#ifndef WGL_NV_float_buffer\n#define WGL_NV_float_buffer 1\n\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\n\n#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)\n\n#endif /* WGL_NV_float_buffer */\n\n/* -------------------------- WGL_NV_gpu_affinity -------------------------- */\n\n#ifndef WGL_NV_gpu_affinity\n#define WGL_NV_gpu_affinity 1\n\n#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\n#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\n\nDECLARE_HANDLE(HGPUNV);\ntypedef struct _GPU_DEVICE {\n  DWORD cb; \n  CHAR DeviceName[32]; \n  CHAR DeviceString[128]; \n  DWORD Flags; \n  RECT rcVirtualScreen; \n} GPU_DEVICE, *PGPU_DEVICE;\n\ntypedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\ntypedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\n\n#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)\n#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)\n#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)\n#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)\n#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)\n\n#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)\n\n#endif /* WGL_NV_gpu_affinity */\n\n/* ---------------------- WGL_NV_multisample_coverage ---------------------- */\n\n#ifndef WGL_NV_multisample_coverage\n#define WGL_NV_multisample_coverage 1\n\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\n#define WGL_COLOR_SAMPLES_NV 0x20B9\n\n#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage)\n\n#endif /* WGL_NV_multisample_coverage */\n\n/* -------------------------- WGL_NV_present_video ------------------------- */\n\n#ifndef WGL_NV_present_video\n#define WGL_NV_present_video 1\n\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\n\nDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList);\ntypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList);\ntypedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue);\n\n#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV)\n#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV)\n#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV)\n\n#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video)\n\n#endif /* WGL_NV_present_video */\n\n/* ---------------------- WGL_NV_render_depth_texture ---------------------- */\n\n#ifndef WGL_NV_render_depth_texture\n#define WGL_NV_render_depth_texture 1\n\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\n\n#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)\n\n#endif /* WGL_NV_render_depth_texture */\n\n/* -------------------- WGL_NV_render_texture_rectangle -------------------- */\n\n#ifndef WGL_NV_render_texture_rectangle\n#define WGL_NV_render_texture_rectangle 1\n\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\n\n#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)\n\n#endif /* WGL_NV_render_texture_rectangle */\n\n/* --------------------------- WGL_NV_swap_group --------------------------- */\n\n#ifndef WGL_NV_swap_group\n#define WGL_NV_swap_group 1\n\ntypedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\ntypedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count);\ntypedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers);\ntypedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier);\ntypedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\n\n#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV)\n#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV)\n#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV)\n#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV)\n#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV)\n#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV)\n\n#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group)\n\n#endif /* WGL_NV_swap_group */\n\n/* ----------------------- WGL_NV_vertex_array_range ----------------------- */\n\n#ifndef WGL_NV_vertex_array_range\n#define WGL_NV_vertex_array_range 1\n\ntypedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\ntypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\n\n#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)\n#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)\n\n#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)\n\n#endif /* WGL_NV_vertex_array_range */\n\n/* -------------------------- WGL_NV_video_capture ------------------------- */\n\n#ifndef WGL_NV_video_capture\n#define WGL_NV_video_capture 1\n\n#define WGL_UNIQUE_ID_NV 0x20CE\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\nDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\ntypedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList);\ntypedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\ntypedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\n#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV)\n#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV)\n#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV)\n#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV)\n#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV)\n\n#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture)\n\n#endif /* WGL_NV_video_capture */\n\n/* -------------------------- WGL_NV_video_output -------------------------- */\n\n#ifndef WGL_NV_video_output\n#define WGL_NV_video_output 1\n\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define WGL_VIDEO_OUT_FRAME 0x20C8\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\n\nDECLARE_HANDLE(HPVIDEODEV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\ntypedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice);\ntypedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\ntypedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock);\n\n#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV)\n#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV)\n#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV)\n#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV)\n#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV)\n#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV)\n\n#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output)\n\n#endif /* WGL_NV_video_output */\n\n/* -------------------------- WGL_OML_sync_control ------------------------- */\n\n#ifndef WGL_OML_sync_control\n#define WGL_OML_sync_control 1\n\ntypedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);\ntypedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);\ntypedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\ntypedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\ntypedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);\ntypedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);\n\n#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)\n#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)\n#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)\n#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)\n#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)\n#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)\n\n#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)\n\n#endif /* WGL_OML_sync_control */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define WGLEW_FUN_EXPORT\n#define WGLEW_VAR_EXPORT\n#else\n#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT\n#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT\n#endif /* GLEW_MX */\n\n#ifdef GLEW_MX\nstruct WGLEWContextStruct\n{\n#endif /* GLEW_MX */\n\nWGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;\n\nWGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD;\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD;\nWGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD;\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD;\nWGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD;\nWGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;\n\nWGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB;\n\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;\n\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;\n\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;\n\nWGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;\nWGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;\nWGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;\n\nWGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;\n\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;\nWGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;\nWGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;\n\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;\nWGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;\n\nWGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;\nWGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;\nWGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;\nWGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;\n\nWGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;\nWGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;\nWGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV;\nWGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV;\nWGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV;\nWGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV;\nWGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV;\nWGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV;\n\nWGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;\nWGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV;\nWGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV;\nWGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV;\n\nWGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;\nWGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV;\nWGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV;\nWGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV;\n\nWGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;\nWGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;\nWGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;\nWGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;\nWGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;\nWGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control;\n\n#ifdef GLEW_MX\n}; /* WGLEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n\ntypedef struct WGLEWContextStruct WGLEWContext;\nGLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name);\n\n#define wglewInit() wglewContextInit(wglewGetContext())\n#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)\n\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))\n#define WGLEW_GET_FUN(x) wglewGetContext()->x\n\n#else /* GLEW_MX */\n\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define WGLEW_GET_FUN(x) x\n\nGLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#undef GLEWAPI\n\n#endif /* __wglew_h__ */\n"
  },
  {
    "path": "Engine/porting/Win32/EngineStdReference.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef EngineStdReference_h\r\n#define EngineStdReference_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n\r\ntemplate<class T>\r\ninline bool getFactoryFunc() {\r\n\treturn (0 != CKLBTaskFactory<T>::createFactory);\r\n}\r\n\r\ntemplate<class T>\r\ninline bool getFuncRegister() {\r\n\tT item(0);\r\n\treturn item.exist();\r\n}\r\n\r\nbool EngineStdReference();\r\n\r\n#endif // EngineStdReference_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/EngineStdReferenceOSS.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n\tGameEngine が標準として持つべきタスクおよびLua関数モジュールが、\r\n\t「必ずリンク対象になる」ように、シンボルリファレンスを生じさせるための関数。\r\n\t同時に、標準タスクおよびLua関数モジュールが存在しているかのチェックにもなっている。\r\n\r\n\t標準のタスクやLua関数を追加した場合は、必ずメンテナンスが必要となる。\r\n*/\r\n#include \"EngineStdReference.h\"\r\n\r\n// Utility Task\r\n#include \"CKLBGenericTask.h\"\r\n#include \"CKLBIntervalTimer.h\"\r\n#include \"CKLBLifeCtrlTask.h\"\r\n#include \"CKLBPauseCtrl.h\"\r\n\r\n// Net Task\r\n#include \"CKLBStoreService.h\"\r\n\r\n// UI Task\r\n#include \"CKLBUIActivityIndicator.h\"\r\n#include \"CKLBUICanvas.h\"\r\n#include \"CKLBUIClip.h\"\r\n#include \"CKLBUIControl.h\"\r\n#include \"CKLBUIDebugItem.h\"\r\n#include \"CKLBUIDragIcon.h\"\r\n#include \"CKLBUIForm.h\"\r\n#include \"CKLBUIFreeVertItem.h\"\r\n#include \"CKLBUIGroup.h\"\r\n#include \"CKLBUILabel.h\"\r\n#include \"CKLBUIList.h\"\r\n#include \"CKLBUIMoviePlayer.h\"\r\n#include \"CKLBUIMultiImgItem.h\"\r\n#include \"CKLBUIPieChart.h\"\r\n#include \"CKLBUIPolyline.h\"\r\n#include \"CKLBUIProgressBar.h\"\r\n#include \"CKLBUIRubberBand.h\"\r\n#include \"CKLBUIScale9.h\"\r\n#include \"CKLBUIScore.h\"\r\n#include \"CKLBUIScrollBar.h\"\r\n#include \"CKLBUISimpleItem.h\"\r\n#include \"CKLBUISWFPlayer.h\"\r\n#include \"CKLBUITextInput.h\"\r\n#include \"CKLBUIButton.h\"\r\n#include \"CKLBUITouchPad.h\"\r\n#include \"CKLBUIVariableItem.h\"\r\n#include \"CKLBUIVirtualDoc.h\"\r\n#include \"CKLBUIWebArea.h\"\r\n#include \"CKLBUpdate.h\"\r\n#include \"CKLBAsyncLoader.h\"\r\n#include \"CKLBAsyncFilecopy.h\"\r\n\r\nbool EngineTaskReference()\r\n{\r\n\tbool bResult = true;\r\n\r\n\t// Utility Task\r\n\tbResult = bResult && getFactoryFunc<CKLBGenericTask>();\r\n\tbResult = bResult && getFactoryFunc<CKLBIntervalTimer>();\r\n\tbResult = bResult && getFactoryFunc<CKLBLifeCtrlTask>();\r\n\tbResult = bResult && getFactoryFunc<CKLBPauseCtrl>();\r\n\tbResult = bResult && getFactoryFunc<CKLBAsyncLoader>();\r\n\tbResult = bResult && getFactoryFunc<CKLBAsyncFilecopy>();\r\n\r\n\t// Net Task\r\n\tbResult = bResult && getFactoryFunc<CKLBStoreService>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUpdate>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUpdateZip>();\r\n\r\n\t// UI Task\r\n\tbResult = bResult && getFactoryFunc<CKLBUIActivityIndicator>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUICanvas>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIClip>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIControl>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIDebugItem>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIDragIcon>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIForm>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIFreeVertItem>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIGroup>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUILabel>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIList>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIMoviePlayer>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIMultiImgItem>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIPieChart>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIPolyline>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIProgressBar>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIRubberBand>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIScale9>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIScore>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIScrollBar>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUISimpleItem>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUISWFPlayer>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUITextInput>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIButton>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUITouchPad>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIVariableItem>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIVirtualDoc>();\r\n\tbResult = bResult && getFactoryFunc<CKLBUIWebArea>();\r\n\r\n\r\n\treturn bResult;\r\n}\r\n\r\n// LuaLib\r\n#include \"CKLBLuaLibAPP.h\"\r\n#include \"CKLBLuaLibASSET.h\"\r\n#include \"CKLBLuaLibBIN.h\"\r\n#include \"CKLBLuaLibCONV.h\"\r\n#include \"CKLBLuaLibDATA.h\"\r\n#include \"CKLBLuaLibDB.h\"\r\n#include \"CKLBLuaLibDEBUG.h\"\r\n#include \"CKLBLuaLibENG.h\"\r\n#include \"CKLBLuaLibFONT.h\"\r\n#include \"CKLBLuaLibGL.h\"\r\n#include \"CKLBLuaLibKEY.h\"\r\n#include \"CKLBLuaLibLANG.h\"\r\n#include \"CKLBLuaLibMatrix.h\"\r\n#include \"CKLBLuaLibRES.h\"\r\n#include \"CKLBLuaLibSOUND.h\"\r\n#include \"CKLBLuaLibTASK.h\"\r\n#include \"CKLBLuaLibUI.h\"\r\n\r\n#include \"CKLBAppProperty.h\"\r\n\r\n#include \"CKLBScrMgrDefault.h\"\r\n#include \"CKLBScrMgrPage.h\"\r\n#include \"CKLBScrMgrSolid.h\"\r\n#include \"CKLBTexturePacker.h\"\r\n\r\nbool EngineLuaFuncReference()\r\n{\r\n\tbool bResult = true;\r\n\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibAPP>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibASSET>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibBIN>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibCONV>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibDATA>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibDB>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibDEBUG>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibENG>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibFONT>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibGL>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibKEY>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibLANG>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibMatrix>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibRES>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibSOUND>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibTASK>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibUI>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibUPDATE>();\r\n\tbResult = bResult && getFuncRegister<CKLBLuaLibPackerControl>();\r\n\tbResult = bResult && (0 != CKLBAppScriptIF::setValue);\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool EngineScrMgrReference()\r\n{\r\n\tbool bResult = true;\r\n\tbResult = bResult && getFuncRegister<CKLBScrMgrDefaultFactory>();\r\n\tbResult = bResult && getFuncRegister<CKLBScrMgrPageFactory>();\r\n\tbResult = bResult && getFuncRegister<CKLBScrMgrSolidFactory>();\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool EngineStdReference()\r\n{\r\n\tbool bResult = true;\r\n\tbResult = bResult && EngineTaskReference();\r\n\tbResult = bResult && EngineLuaFuncReference();\r\n\tbResult = bResult && EngineScrMgrReference();\r\n\treturn bResult;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/GameEngine.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef GameEngine_h\r\n#define GameEngine_h\r\n\r\n#include <Windows.h>\r\n#include <windowsx.h>\r\n\r\nint GameEngineMain(int argc, _TCHAR* argv[]);\r\n\r\n#endif // GameEngine_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/GameLibraryWin32.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// GameLibraryWin32.cpp : Defines the entry point for the console application.\r\n//\r\n\r\n#include \"stdafx.h\"\r\n#include \"assert_klb.h\"\r\n\r\n#include \"GameEngine.h\"\r\n#include \"EngineStdReference.h\"\r\n\r\n#include <assert.h>\r\n#include <float.h>\r\n#include <math.h>\r\n#include <stdio.h>\r\n#include \"RenderingFramework.h\"\r\n#include <Windows.h>\r\n#include <gl/GL.h>\r\n#include \"CPFInterface.h\"\r\n#include \"CWin32Platform.h\"\r\n#include \"CWin32PathConv.h\"\r\n#include \"Win32FileLocation.h\"\r\n\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBTouchPad.h\"\r\n\r\n// #pragma comment(lib, \"GameLibraryWin32.lib\")\r\n\r\n//\r\n//-----------------------------------------\r\n//  Global Execution Context\r\n//\r\n#include \"CKLBDebugger.h\"\r\n#include \"CKLBRendering.h\"\r\n#include \"CKLBAsset.h\"\r\n\r\n#include <conio.h>\r\n\r\n//\r\n//-----------------------------------------\r\n//\r\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r\nvoid EnableOpenGL (HWND hWnd, HDC * hDC, HGLRC * hRC);\r\nvoid DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC);\r\n\r\n// Enable OpenGL\r\nvoid EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)\r\n{\r\n\tPIXELFORMATDESCRIPTOR pfd;\r\n\tint format;\r\n\t\r\n\t// get the device context (DC)\r\n\t*hDC = GetDC( hWnd );\r\n\t\r\n\t// set the pixel format for the DC\r\n\tZeroMemory( &pfd, sizeof( pfd ) );\r\n\tpfd.nSize = sizeof( pfd );\r\n\tpfd.nVersion = 1;\r\n\tpfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;\r\n\tpfd.iPixelType = PFD_TYPE_RGBA;\r\n\tpfd.cColorBits = 24;\r\n\tpfd.cDepthBits = 16;\r\n\tpfd.iLayerType = PFD_MAIN_PLANE;\r\n\tformat = ChoosePixelFormat( *hDC, &pfd );\r\n\tSetPixelFormat( *hDC, format, &pfd );\r\n\t\r\n\t// create and enable the render context (RC)\r\n\t*hRC = wglCreateContext( *hDC );\r\n\twglMakeCurrent( *hDC, *hRC );\r\n\t\r\n}\r\n\r\n// Disable OpenGL\r\nvoid DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)\r\n{\r\n\twglMakeCurrent( NULL, NULL );\r\n\twglDeleteContext( hRC );\r\n\tReleaseDC( hWnd, hDC );\r\n}\r\n\r\n\r\nconst char* gsrc = NULL;\r\n\r\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r\n{                                                                       \r\n\tstatic int  rot         = 0;\r\n\tstatic int  mouse_stat  = 0;\r\n\tstatic int  lastX, lastY;\r\n\tstatic char commandBuff[1000];\r\n\tstatic int  commandLen      = 0;\r\n\tstatic int  g_bRender       = 0;\r\n\tstatic bool g_bRenderChange = true;\r\n\r\n\tswitch (message)\r\n    {\r\n\t\tcase WM_CREATE:\r\n\t\t\treturn 0;\r\n\t\t\r\n\t\tcase WM_CLOSE:\r\n\t\t\tPostQuitMessage( 0 );\r\n\t\t\treturn 0;\r\n\t\t\r\n\t\tcase WM_COMMAND:\r\n\t\t\t{\r\n\t\t\t\tCWin32Widget::ControlCommand(hWnd, message, wParam, lParam);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase WM_DROPFILES:\r\n\t\t\t// DragQueryFile((HDROP)wParam, 0, &fileNameBuff[0], 512);\t\t\t\r\n\t\t\tbreak;\r\n        case WM_LBUTTONDOWN:\r\n\t\t\tif(mouse_stat) {\t// ボタンを押したまま画面外に出た\r\n\t\t\t\t// 最後の座標を使って、無理やり RELEASEを送る\r\n                // If going out of the screen with a pushed button\r\n                // Force sending a RELEASE signal.\r\n\t\t\t\tCPFInterface::getInstance().client().inputPoint(0, IClientRequest::I_RELEASE,\r\n\t\t\t\t\t\tlastX, lastY);\r\n\t\t\t\tmouse_stat = 0;\r\n\t\t\t}\r\n\t\t\tCPFInterface::getInstance().client().inputPoint(0, IClientRequest::I_CLICK,\r\n\t\t\t\t\tGET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));\r\n\t\t\tmouse_stat = 1;\r\n\t\t\tbreak;\r\n\t\tcase WM_MOUSEMOVE:\r\n\t\t\tif (wParam & MK_LBUTTON) {\r\n\t\t\t\tlastX = GET_X_LPARAM(lParam);\r\n\t\t\t\tlastY = GET_Y_LPARAM(lParam);\r\n\t\t\t\tCPFInterface::getInstance().client().inputPoint(0, IClientRequest::I_DRAG,\r\n\t\t\t\t\t\tlastX, lastY);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase WM_LBUTTONUP:\r\n\t\t\tCPFInterface::getInstance().client().inputPoint(0, IClientRequest::I_RELEASE,\r\n\t\t\t\t\tGET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));\r\n\t\t\tmouse_stat = 0;\r\n\t\t\tbreak;\r\n\t\tcase WM_KEYDOWN:\r\n\t\t\tswitch (wParam) {\r\n\t\t\tcase VK_ESCAPE:\r\n\t\t\t\tPostQuitMessage(0);\r\n\t\t\t\treturn 0;\r\n\t\t\tcase VK_RETURN:\r\n\t\t\t\tif (commandLen != 0) {\r\n\t\t\t\t\tCPFInterface::getInstance().client().executeCommand(commandBuff);\r\n\t\t\t\t\tprintf(\"\\n\");\r\n\t\t\t\t\tcommandLen = 0;\r\n\t\t\t\t\tmemset(commandBuff, 0, 1000);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_LEFT:\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_RIGHT:\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_UP:\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_DOWN:\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_F1:\t// F1\r\n\t\t\t\t{\r\n\t\t\t\t\tstatic const char* eventList = NULL;\r\n\t\t\t\t\tif (!eventList) {\r\n\t\t\t\t\t\tFILE* f = fopen(\"EventLog.txt\",\"rb\");\r\n\t\t\t\t\t\tfseek (f, 0, SEEK_END);   // non-portable\r\n\t\t\t\t\t\tint size=ftell (f);\r\n\t\t\t\t\t\tu8* buff  = new u8[size+1];\r\n\t\t\t\t\t\tmemset(buff, 0, size+1);\r\n\t\t\t\t\t\tfseek (f, 0, SEEK_SET);\r\n\t\t\t\t\t\tfread (buff,1,size,f);\r\n\t\t\t\t\t\tfclose(f);\r\n\t\t\t\t\t\teventList = (const char*)buff;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgsrc = eventList;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_F9:\r\n\t\t\t\tif (g_bRenderChange) {\r\n\t\t\t\t\tg_bRender++;\r\n\t\t\t\t\tswitch (g_bRender % 3) {\r\n\t\t\t\t\tcase 0:\t\t\tCPFInterface::getInstance().client().executeCommand(\"RENDER NORMAL\"); break;\r\n\t\t\t\t\tcase 1:\t\t\tCPFInterface::getInstance().client().executeCommand(\"RENDER OVERDRAW\"); break;\r\n\t\t\t\t\tcase 2:\t\t\tCPFInterface::getInstance().client().executeCommand(\"RENDER BATCH\"); break;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_F2:\r\n\t\t\t\t{\r\n\t\t\t\t\tstatic bool gPlay = true;\r\n\t\t\t\t\tgPlay = !gPlay;\r\n\t\t\t\t\tif (gPlay) {\r\n\t\t\t\t\t\tCPFInterface::getInstance().client().executeCommand(\"PLAY\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tCPFInterface::getInstance().client().executeCommand(\"STOP\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_F3:\r\n\t\t\t\t{\r\n\t\t\t\t\tCPFInterface::getInstance().client().executeCommand(\"UNLOAD\");\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_F4:\r\n\t\t\t\t{\r\n\t\t\t\t\tCPFInterface::getInstance().client().executeCommand(\"RELOAD\");\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase VK_F8:\r\n\t\t\t\t{\r\n\t\t\t\t\tCPFInterface::getInstance().client().inputDeviceKey(IClientRequest::KEY_BACK, IClientRequest::KEYEVENT_CLICK);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\tdefault:\r\n\t\t\t\tif (wParam >=32 && wParam <= 127) {\r\n\t\t\t\t\tcommandBuff[commandLen++] = wParam;\r\n\t\t\t\t\tprintf(\"\\r%s\",commandBuff);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (wParam == 8) {\r\n\t\t\t\t\t\tcommandBuff[--commandLen] = 0;\r\n\t\t\t\t\t\tprintf(\"\\r%s                                                            \",commandBuff);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n        case WM_DESTROY:\r\n            PostQuitMessage(0);                                             \r\n            break;\r\n\r\n        default:                                                            \r\n            return DefWindowProc(hWnd, message, wParam, lParam);            \r\n    }                                                                   \r\n    return 0;                                                           \r\n}    \r\n\r\nvoid sendEvents() {\r\n\tif (gsrc) {\r\n\t\tint c = 0;\r\n\t\tbool exit = false;\r\n\t\tconst char* src = gsrc;\r\n\t\twhile (!exit && (*src != 0)) {\r\n\t\t\tint items = sscanf(src,\"Event%c\", &c);\r\n\t\t\tif (items == 1) {\r\n\t\t\t\tsrc += 6;\r\n\t\t\t\tswitch (c) {\r\n\t\t\t\tcase 'S':\r\n\t\t\t\t\t// Start\r\n\t\t\t\t\texit = true;\t// Point to the next frame.\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'E':\r\n\t\t\t\t\t// End\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'F':\r\n\t\t\t\t\texit = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'P':\r\n\t\t\t\t\t// Process\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase '0':\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsrc++;\t// skip :\r\n\t\t\t\t\t\tCKLBTouchPadQueue& queue = CKLBTouchPadQueue::getInstance();\r\n\t\t\t\t\t\tint id;\r\n\t\t\t\t\t\tint type;\r\n\t\t\t\t\t\tint x;\r\n\t\t\t\t\t\tint y;\r\n\t\t\t\t\t\titems = sscanf(src,\"%i,%i,%i,%i\", &id,&type,&x,&y);\r\n\t\t\t\t\t\tqueue.addQueue(id,(IClientRequest::INPUT_TYPE)type,x,y);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase '1':\r\n\t\t\t\t\t// Push while processing, should never happen !\r\n\t\t\t\t\tklb_assertAlways(\"Should never happend\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Reach until EOL\r\n\t\t\twhile ((*src != 0) && (*src != 0xA) && (*src != 0xD)) {\r\n\t\t\t\tsrc++;\r\n\t\t\t}\r\n\r\n\t\t\t// Skip EOL\r\n\t\t\twhile ((*src == 0xA) || (*src == 0xD)) {\r\n\t\t\t\tsrc++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (*src == 0) {\r\n\t\t\tgsrc = NULL; \r\n\t\t} else {\r\n\t\t\tgsrc = src;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nchar g_basePath[MAX_PATH];\r\nchar g_fileName[MAX_PATH];\r\nstatic char* g_pathExtern;\r\nstatic char* g_pathInstall;\r\n\r\n\r\nchar* convertPath(const char* input) {\r\n\tint len = strlen(input);\r\n\tbool addEnd = false;\r\n\tif ((input[len-1] != '\\\\') && (input[len-1] != '/')) {\r\n\t\taddEnd = true;\r\n\t}\r\n\r\n\tchar* buffDest = (char*)malloc(len + 1 + (addEnd ? 1 : 0));\r\n\tmemcpy(buffDest, input, len);\r\n\tfor (int n=0; n < len; n++) {\r\n\t\tif (buffDest[n] == '\\\\') {\r\n\t\t\tbuffDest[n] = '/';\r\n\t\t}\r\n\t}\r\n\tif (addEnd) {\r\n\t\tbuffDest[len] = '/';\r\n\t\tlen++;\r\n\t}\r\n\tbuffDest[len] = 0;\r\n\treturn buffDest;\r\n}\r\n\r\n#ifdef _WIN32_WCE\r\nint WINAPI WinMain( HINSTANCE,\r\n                    HINSTANCE,\r\n                    LPTSTR,\r\n                    int)\r\n#else\r\nint GameEngineMain(int argc, _TCHAR* argv[])\r\n// int _main (int argc, const char * const* argv)\r\n#endif\r\n{\r\n\tbool bStdModuleExist = EngineStdReference();\r\n\tklb_assert(bStdModuleExist, \"The links of a system are insufficient.\");\r\n\r\n\tglutInit(&argc, argv);\r\n\tglutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);\r\n\tglutCreateWindow(\"GLEW Test\");\r\n\r\n\tGLenum err = glewInit();\r\n\tif (GLEW_OK != err)\r\n\t{\r\n\t  /* Problem: glewInit failed, something is seriously wrong. */\r\n\t  fprintf(stderr, \"Error: %s\\n\", glewGetErrorString(err));\r\n\t}\r\n\tfprintf(stdout, \"Status: Using GLEW %s\\n\", glewGetString(GLEW_VERSION));\r\n\r\n#define HEIGHT\t(768)\r\n#define WIDTH\t(1024)\r\n#define POS_X\t(10)\r\n#define POS_Y\t(10)\r\n//#define HEIGHT\t(800)\r\n//#define WIDTH\t(400)\r\n\tint scrW\t= WIDTH;\r\n\tint scrH\t= HEIGHT;\r\n\t\r\n\tint fixedDelta = 0;\r\n\r\n\t*g_basePath = 0;\r\n\t*g_fileName = 0;\r\n\tg_pathExtern\t= PATH_EXTERN;\r\n\tg_pathInstall\t= PATH_INSTALL;\r\n\r\n\tg_fileName[0] = 0;\r\n\r\n\tbool hasDefaultFont = true;\r\n\tbool hasDefaultDB   = false;\r\n\r\n\tif (argc > 1) {\r\n\t\tint parse\t= 1;\r\n\t\tint max\t\t= argc;\r\n\t\twhile (parse < max) {\r\n\t\t\tif(*argv[parse] == '-') {\r\n\t\t\t\tif (strcmp(\"-w\",argv[parse]) == 0) {\r\n\t\t\t\t\tsscanf_s(argv[parse+1],\"%i\",&scrW);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (strcmp(\"-h\",argv[parse]) == 0) {\r\n\t\t\t\t\tsscanf_s(argv[parse+1],\"%i\",&scrH);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (strcmp(\"-i\",argv[parse]) == 0) {\r\n\t\t\t\t\tg_pathInstall = convertPath(argv[parse+1]);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (strcmp(\"-e\",argv[parse]) == 0) {\r\n\t\t\t\t\tg_pathExtern = convertPath(argv[parse+1]);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (strcmp(\"-t\",argv[parse]) == 0) {\r\n\t\t\t\t\tfixedDelta = atoi(argv[parse+1]);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (strcmp(\"-enc\", argv[parse]) == 0) {\r\n\t\t\t\t\tbool encrypt = false;\r\n\t\t\t\t\tif (stricmp(argv[parse+1],\"true\") == 0) {\r\n\t\t\t\t\t\tencrypt = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (stricmp(argv[parse+1],\"1\") == 0) {\r\n\t\t\t\t\t\tencrypt = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tCWin32Platform::setEncrypt(encrypt);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (strcmp(\"-no\", argv[parse]) == 0) {\r\n\t\t\t\t\tif (strcmp(\"defaultfont\", argv[parse+1]) == 0) {\r\n\t\t\t\t\t\thasDefaultFont = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tparse += 2;\r\n\t\t\t} else {\r\n\t\t\t\t// Specify the boot file\r\n\t\t\t\tconst char* file = argv[parse];\r\n\t\t\t\tint lenf = strlen(file);\r\n\t\t\t\t\r\n\t\t\t\tmemcpy(g_fileName, file, lenf);\r\n\t\t\t\tg_fileName[lenf] = 0;\r\n\r\n\t\t\t\t// ファイル名そのものは start.lua に相当する起動ファイルとする。\r\n                // File name of the file used as a start.lua\r\n\t\t\t\tparse++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tCWin32PathConv& pathconv = CWin32PathConv::getInstance();\r\n\tpathconv.setPath(g_pathInstall, g_pathExtern);\r\n\r\n\tWNDCLASS wc;\r\n\tHWND hwnd;\r\n\tHDC hDC;\r\n\tHGLRC hRC;\r\n\tHINSTANCE hInstance = GetModuleHandle(NULL);\r\n\r\n\t// register window class\r\n\twc.style = CS_OWNDC;\r\n\twc.lpfnWndProc = WndProc;\r\n\twc.cbClsExtra = 0;\r\n\twc.cbWndExtra = 0;\r\n\twc.hInstance = hInstance;\r\n\twc.hIcon = LoadIcon( NULL, IDI_APPLICATION );\r\n\twc.hCursor = LoadCursor( NULL, IDC_ARROW );\r\n\twc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );\r\n\twc.lpszMenuName = NULL;\r\n\twc.lpszClassName = \"GameEngineGL\";\r\n\tRegisterClass( &wc );\r\n\t\r\n\t// create main window\r\n\thwnd = CreateWindow(\r\n\t\t\"GameEngineGL\", \"Playground\", \r\n\t\tWS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,\r\n\t\t0, 0, 256, 256,\r\n\t\tNULL, NULL, hInstance, NULL );\r\n\r\n/*\t\t\"EngineGL\", NULL,\r\n\t\tWS_THICKFRAME|WS_DISABLED,\r\n\t\tCW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,\r\n\t\tNULL, NULL, \r\n\t\thInstance, \r\n\t\tNULL\r\n\t);*/\r\n\t\r\n\tif (!hwnd)\r\n\t\treturn -1;\r\n\r\n\t// enable OpenGL for the window\r\n\tEnableOpenGL( hwnd, &hDC, &hRC );\r\n\r\n\t// COM Initialization\r\n\tCoInitialize(NULL);\r\n\r\n\tEnableWindow(hwnd, TRUE);\r\n\r\n\tDragAcceptFiles(hwnd, true);\r\n\r\n\tRECT area;\r\n\tarea.left = 0;\r\n\tarea.top = 0;\r\n#ifdef _WIN32_WCE\r\n\tarea.right = GetSystemMetrics(SM_CXSCREEN);\r\n\tarea.bottom = GetSystemMetrics(SM_CYSCREEN);\r\n\r\n\tSetWindowLong(hwnd, GWL_STYLE, WS_POPUP);\r\n\r\n\tSetWindowPos(hwnd, HWND_TOPMOST,\r\n\t\t\t\t\tarea.left, area.top,\r\n\t\t\t\t\tarea.right, area.bottom,\r\n\t\t\t\t\tSWP_FRAMECHANGED);\r\n#else\r\n\t// Window border hard coded\r\n\t//area.right = scrW + 8;\r\n\t//area.bottom = scrH + 27;\r\n\t////area.right = GetSystemMetrics(SM_CXSCREEN);\r\n\t////area.bottom = GetSystemMetrics(SM_CYSCREEN);\r\n\tint addW = GetSystemMetrics(SM_CXSIZEFRAME) * 2;\r\n\tint addH = GetSystemMetrics(SM_CYSIZEFRAME) * 2 + GetSystemMetrics(SM_CYCAPTION);\r\n\tarea.right = scrW + addW;\r\n\tarea.bottom = scrH + addH;\r\n\t\r\n\r\n\t/*\r\n\tAdjustWindowRect(\r\n\t\t&area,\r\n\t\tWS_SYSMENU|WS_THICKFRAME|WS_DISABLED,\r\n\t\tfalse\r\n\t);*/\r\n\r\n\tSetWindowPos(hwnd, HWND_TOP,\r\n\t\t\t\t\tarea.left, area.top,\r\n\t\t\t\t\tarea.right, area.bottom,\r\n\t\t\t\t\tSWP_NOMOVE);\r\n#endif\r\n\r\n\t/* set as foreground window to give this app focus in case it doesn't have it */\r\n\tSetForegroundWindow(hwnd);\r\n\tShowWindow(hwnd, SW_SHOWNORMAL);\r\n\r\n\tglClearColor(1.0f, 0.7f, 0.2039f, 0.0f);\r\n\tglDisable( GL_CULL_FACE );\r\n\r\n\t//\r\n\r\n\t// testCodeInit();\r\n\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tCWin32Platform * pPlatform = new CWin32Platform(hwnd);\r\n\r\n\tif (!hasDefaultFont) {\r\n\t\tpPlatform->setNoDefaultFont();\r\n\t}\r\n\r\n\tpfif.setPlatformRequest(pPlatform);\r\n\tGameSetup();\t// client side setup\r\n\r\n\t// Can only access client AFTER GameSetup.\r\n\tpfif.client().setInitParam((hasDefaultDB   ? IClientRequest::ENGINE_USE_DEFAULTDB   : 0)\r\n\t\t\t\t\t\t\t|  (hasDefaultFont ? IClientRequest::ENGINE_USE_DEFAULTFONT : 0), NULL); \r\n\r\n\t// sound initialize\r\n\tSoundSystemInitFor_Win32();\r\n\tCWin32AudioMgr::getInstance().init(hwnd);\r\n\r\n\t// set screen size\r\n\tpfif.client().setScreenInfo(false, scrW, scrH);\r\n\t// boot path\r\n\tif (strlen(g_fileName)) {\r\n\t\tpfif.client().setFilePath(g_fileName);\r\n\t} else {\r\n\t\tpfif.client().setFilePath(NULL);\r\n\t}\r\n\tif (!pfif.client().initGame()) {\r\n\t\tklb_assertAlways(\"Could not initialize game, most likely memory error\");\r\n\t} else {\r\n\t\tstatic DWORD lastTime = GetTickCount();\r\n\r\n\t\t// Main message loop:\r\n\t\tbool quit = false;\r\n\t\ts32 frameTime = pfif.client().getFrameTime();\r\n\t\tIClientRequest& pClient = pfif.client();\r\n\r\n\t\twhile (!quit)\r\n\t\t{\r\n\t\t\t/* relay message queue messages to windowproc's */\r\n\t\t\tMSG msg;\r\n\t\t\twhile (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))\r\n\t\t\t{\r\n\t\t\t\tTranslateMessage(&msg);\r\n\r\n\t\t\t\tif (msg.message == WM_QUIT)\r\n\t\t\t\t{\r\n\t\t\t\t\tquit = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tDispatchMessage(&msg);\r\n\t\t\t}\r\n\r\n\t\t\tif (!quit) {\r\n\t\t\t\t// This is not the safest or best way to handle timing, but this code\r\n\t\t\t\t// is only added to make the triangle rotate at a basically constant\r\n\t\t\t\t// rate, independent of the target (Win32) platform\r\n\t\t\t\tDWORD newTime   = GetTickCount();\r\n\t\t\t\tDWORD delta     = newTime - lastTime;\r\n\r\n\t\t\t\t// Handle rollover\r\n\t\t\t\tif (newTime < lastTime) {\r\n\t\t\t\t\tdelta = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (delta > (DWORD)frameTime) {\r\n\t\t\t\t\t\tsendEvents();\r\n\r\n\t\t\t\t\t\tlastTime = newTime;\r\n\t\t\t\t\t\t//dglClear(GL_COLOR_BUFFER_BIT);\r\n\t\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Rendering complete.\r\n\t\t\t\t\t\t//\t\t\r\n\t\t\t\t\t\t//testCodeLoop(delta);\r\n\t\t\t\t\t\tpClient.frameFlip(fixedDelta ? fixedDelta : delta);\r\n\r\n\t\t\t\t\t\t// pfIF.platform().flipFrame();\r\n\t\t\t\t\t\tSwapBuffers( hDC );\r\n\t\t\t\t\t}\r\n                    // コントロール(ex. TextBox)が作られている場合、その再描画を行う\r\n\t\t\t\t\t// If a Control (ex TextBox) is done, redraw them.\r\n\t\t\t\t\tCWin32Widget::ReDrawControls();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tSleep(1);\r\n\t\t}\r\n\t}\r\n\r\n\tpfif.client().finishGame();\r\n\r\n\tSoundSystemExitFor_Win32();\r\n\r\n\tdelete pPlatform;\r\n\r\n\t// shutdown OpenGL\r\n\tDisableOpenGL( hwnd, hDC, hRC );\r\n\r\n\tCWin32AudioMgr::getInstance().release();\r\n\r\n\t// End of COM\r\n\tCoUninitialize();\r\n\r\n\tif(DestroyWindow (hwnd)) {\r\n\t\tprintf(\"DestroyWindow SUCCESS\\n\");\r\n    }\r\n\treturn 0;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/KHR/khrplatform.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __khrplatform_h_\r\n#define __khrplatform_h_\r\n\r\n/*\r\n** Copyright (c) 2008-2009 The Khronos Group Inc.\r\n**\r\n** Permission is hereby granted, free of charge, to any person obtaining a\r\n** copy of this software and/or associated documentation files (the\r\n** \"Materials\"), to deal in the Materials without restriction, including\r\n** without limitation the rights to use, copy, modify, merge, publish,\r\n** distribute, sublicense, and/or sell copies of the Materials, and to\r\n** permit persons to whom the Materials are furnished to do so, subject to\r\n** the following conditions:\r\n**\r\n** The above copyright notice and this permission notice shall be included\r\n** in all copies or substantial portions of the Materials.\r\n**\r\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\r\n*/\r\n\r\n/* Khronos platform-specific types and definitions.\r\n *\r\n * $Revision: 1.5 $ on $Date: 2010/06/03 16:51:55 $\r\n *\r\n * Adopters may modify this file to suit their platform. Adopters are\r\n * encouraged to submit platform specific modifications to the Khronos\r\n * group so that they can be included in future versions of this file.\r\n * Please submit changes by sending them to the public Khronos Bugzilla\r\n * (http://khronos.org/bugzilla) by filing a bug against product\r\n * \"Khronos (general)\" component \"Registry\".\r\n *\r\n * A predefined template which fills in some of the bug fields can be\r\n * reached using http://tinyurl.com/khrplatform-h-bugreport, but you\r\n * must create a Bugzilla login first.\r\n *\r\n *\r\n * See the Implementer's Guidelines for information about where this file\r\n * should be located on your system and for more details of its use:\r\n *    http://www.khronos.org/registry/implementers_guide.pdf\r\n *\r\n * This file should be included as\r\n *        #include <KHR/khrplatform.h>\r\n * by Khronos client API header files that use its types and defines.\r\n *\r\n * The types in khrplatform.h should only be used to define API-specific types.\r\n *\r\n * Types defined in khrplatform.h:\r\n *    khronos_int8_t              signed   8  bit\r\n *    khronos_uint8_t             unsigned 8  bit\r\n *    khronos_int16_t             signed   16 bit\r\n *    khronos_uint16_t            unsigned 16 bit\r\n *    khronos_int32_t             signed   32 bit\r\n *    khronos_uint32_t            unsigned 32 bit\r\n *    khronos_int64_t             signed   64 bit\r\n *    khronos_uint64_t            unsigned 64 bit\r\n *    khronos_intptr_t            signed   same number of bits as a pointer\r\n *    khronos_uintptr_t           unsigned same number of bits as a pointer\r\n *    khronos_ssize_t             signed   size\r\n *    khronos_usize_t             unsigned size\r\n *    khronos_float_t             signed   32 bit floating point\r\n *    khronos_time_ns_t           unsigned 64 bit time in nanoseconds\r\n *    khronos_utime_nanoseconds_t unsigned time interval or absolute time in\r\n *                                         nanoseconds\r\n *    khronos_stime_nanoseconds_t signed time interval in nanoseconds\r\n *    khronos_boolean_enum_t      enumerated boolean type. This should\r\n *      only be used as a base type when a client API's boolean type is\r\n *      an enum. Client APIs which use an integer or other type for\r\n *      booleans cannot use this as the base type for their boolean.\r\n *\r\n * Tokens defined in khrplatform.h:\r\n *\r\n *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.\r\n *\r\n *    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.\r\n *    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.\r\n *\r\n * Calling convention macros defined in this file:\r\n *    KHRONOS_APICALL\r\n *    KHRONOS_APIENTRY\r\n *    KHRONOS_APIATTRIBUTES\r\n *\r\n * These may be used in function prototypes as:\r\n *\r\n *      KHRONOS_APICALL void KHRONOS_APIENTRY funcname(\r\n *                                  int arg1,\r\n *                                  int arg2) KHRONOS_APIATTRIBUTES;\r\n */\r\n\r\n/*-------------------------------------------------------------------------\r\n * Definition of KHRONOS_APICALL\r\n *-------------------------------------------------------------------------\r\n * This precedes the return type of the function in the function prototype.\r\n */\r\n\r\n#if (defined(_WIN32) || defined(__VC32__)) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__)\r\n#   if defined (_DLL_EXPORTS)\r\n#       define KHRONOS_APICALL __declspec(dllexport)\r\n#   else\r\n#       define KHRONOS_APICALL __declspec(dllimport)\r\n#   endif\r\n#elif defined (__SYMBIAN32__)\r\n#   if defined (__GCC32__)\r\n#       define KHRONOS_APICALL __declspec(dllexport)\r\n#   else\r\n#       define KHRONOS_APICALL IMPORT_C\r\n#   endif\r\n#else\r\n#   define KHRONOS_APICALL\r\n#endif\r\n\r\n/*-------------------------------------------------------------------------\r\n * Definition of KHRONOS_APIENTRY\r\n *-------------------------------------------------------------------------\r\n * This follows the return type of the function  and precedes the function\r\n * name in the function prototype.\r\n */\r\n#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__)\r\n    /* Win32 but not WinCE */\r\n#   define KHRONOS_APIENTRY __stdcall\r\n#else\r\n#   define KHRONOS_APIENTRY\r\n#endif\r\n\r\n/*-------------------------------------------------------------------------\r\n * Definition of KHRONOS_APIATTRIBUTES\r\n *-------------------------------------------------------------------------\r\n * This follows the closing parenthesis of the function prototype arguments.\r\n */\r\n#if defined (__ARMCC_2__)\r\n#define KHRONOS_APIATTRIBUTES __softfp\r\n#else\r\n#define KHRONOS_APIATTRIBUTES\r\n#endif\r\n\r\n/*-------------------------------------------------------------------------\r\n * basic type definitions\r\n *-----------------------------------------------------------------------*/\r\n#if defined(__SYMBIAN32__)\r\n\r\n#include <e32def.h>\r\n\r\ntypedef TInt32                 khronos_int32_t;\r\ntypedef TUint32                khronos_uint32_t;\r\ntypedef TInt64                 khronos_int64_t;\r\ntypedef TUint64                khronos_uint64_t;\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)\r\n\r\n\r\n/*\r\n * Using <stdint.h>\r\n */\r\n#include <stdint.h>\r\ntypedef int32_t                 khronos_int32_t;\r\ntypedef uint32_t                khronos_uint32_t;\r\ntypedef int64_t                 khronos_int64_t;\r\ntypedef uint64_t                khronos_uint64_t;\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n#elif defined(__VMS ) || defined(__sgi)\r\n\r\n/*\r\n * Using <inttypes.h>\r\n */\r\n#include <inttypes.h>\r\ntypedef int32_t                 khronos_int32_t;\r\ntypedef uint32_t                khronos_uint32_t;\r\ntypedef int64_t                 khronos_int64_t;\r\ntypedef uint64_t                khronos_uint64_t;\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)\r\n\r\n/*\r\n * Win32\r\n */\r\ntypedef __int32                 khronos_int32_t;\r\ntypedef unsigned __int32        khronos_uint32_t;\r\ntypedef __int64                 khronos_int64_t;\r\ntypedef unsigned __int64        khronos_uint64_t;\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n#elif defined(__sun__) || defined(__digital__)\r\n\r\n/*\r\n * Sun or Digital\r\n */\r\ntypedef int                     khronos_int32_t;\r\ntypedef unsigned int            khronos_uint32_t;\r\n#if defined(__arch64__) || defined(_LP64)\r\ntypedef long int                khronos_int64_t;\r\ntypedef unsigned long int       khronos_uint64_t;\r\n#else\r\ntypedef long long int           khronos_int64_t;\r\ntypedef unsigned long long int  khronos_uint64_t;\r\n#endif /* __arch64__ */\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n#elif defined(_UITRON_)\r\n\r\n/*\r\n * uITRON\r\n */\r\ntypedef signed int              khronos_int32_t;\r\ntypedef unsigned int\t        khronos_uint32_t;\r\ntypedef long long               khronos_int64_t;\r\ntypedef unsigned long long      khronos_uint64_t;\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n\r\n#elif 0\r\n\r\n/*\r\n * Hypothetical platform with no float or int64 support\r\n */\r\ntypedef int                     khronos_int32_t;\r\ntypedef unsigned int            khronos_uint32_t;\r\n#define KHRONOS_SUPPORT_INT64   0\r\n#define KHRONOS_SUPPORT_FLOAT   0\r\n\r\n#else\r\n\r\n/*\r\n * Generic fallback\r\n */\r\n#include <stdint.h>\r\ntypedef int32_t                 khronos_int32_t;\r\ntypedef uint32_t                khronos_uint32_t;\r\ntypedef int64_t                 khronos_int64_t;\r\ntypedef uint64_t                khronos_uint64_t;\r\n#define KHRONOS_SUPPORT_INT64   1\r\n#define KHRONOS_SUPPORT_FLOAT   1\r\n\r\n#endif\r\n\r\n\r\n/*\r\n * Types that are (so far) the same on all platforms\r\n */\r\ntypedef signed   char          khronos_int8_t;\r\ntypedef unsigned char          khronos_uint8_t;\r\ntypedef signed   short int     khronos_int16_t;\r\ntypedef unsigned short int     khronos_uint16_t;\r\ntypedef signed   long  int     khronos_intptr_t;\r\ntypedef unsigned long  int     khronos_uintptr_t;\r\ntypedef signed   long  int     khronos_ssize_t;\r\ntypedef unsigned long  int     khronos_usize_t;\r\n\r\n#if KHRONOS_SUPPORT_FLOAT\r\n/*\r\n * Float type\r\n */\r\ntypedef          float         khronos_float_t;\r\n#endif\r\n\r\n#if KHRONOS_SUPPORT_INT64\r\n/* Time types\r\n *\r\n * These types can be used to represent a time interval in nanoseconds or\r\n * an absolute Unadjusted System Time.  Unadjusted System Time is the number\r\n * of nanoseconds since some arbitrary system event (e.g. since the last\r\n * time the system booted).  The Unadjusted System Time is an unsigned\r\n * 64 bit value that wraps back to 0 every 584 years.  Time intervals\r\n * may be either signed or unsigned.\r\n */\r\ntypedef khronos_uint64_t       khronos_utime_nanoseconds_t;\r\ntypedef khronos_int64_t        khronos_stime_nanoseconds_t;\r\n#endif\r\n\r\n/*\r\n * Dummy value used to pad enum types to 32 bits.\r\n */\r\n#ifndef KHRONOS_MAX_ENUM\r\n#define KHRONOS_MAX_ENUM 0x7FFFFFFF\r\n#endif\r\n\r\n/*\r\n * Enumerated boolean type\r\n *\r\n * Values other than zero should be considered to be true.  Therefore\r\n * comparisons should not be made against KHRONOS_TRUE.\r\n */\r\ntypedef enum {\r\n    KHRONOS_FALSE = 0,\r\n    KHRONOS_TRUE  = 1,\r\n    KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM\r\n} khronos_boolean_enum_t;\r\n\r\n#endif /* __khrplatform_h_ */\r\n"
  },
  {
    "path": "Engine/porting/Win32/Lame/BladeMP3EncDLL.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n * Blade Type of DLL Interface for Lame encoder\r\n *\r\n * Copyright (c) 1999-2002 A.L. Faber\r\n * Based on bladedll.h version 1.0 written by Jukka Poikolainen\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Library General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2 of the License, or (at your option) any later version.\r\n * \r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Library General Public License for more details.\r\n * \r\n * You should have received a copy of the GNU Library General Public\r\n * License along with this library; if not, write to the\r\n * Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r\n * Boston, MA  02111-1307, USA.\r\n */\r\n\r\n#ifndef ___BLADEDLL_H_INCLUDED___\r\n#define ___BLADEDLL_H_INCLUDED___\r\n\r\n#ifdef __GNUC__\r\n#define ATTRIBUTE_PACKED\t__attribute__((packed))\r\n#else\r\n#define ATTRIBUTE_PACKED\r\n#pragma pack(push)\r\n#pragma pack(1)\r\n#endif\r\n\r\n#ifdef\t__cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* encoding formats */\r\n\r\n#define\t\tBE_CONFIG_MP3\t\t\t0\t\t\t\t\t\t\t\t\t\t\r\n#define\t\tBE_CONFIG_LAME\t\t\t256\t\t\r\n\r\n/* type definitions */\r\n\r\ntypedef\t\tvoid*\t\t\tHBE_STREAM;\r\ntypedef\t\tHBE_STREAM\t\t\t\t*PHBE_STREAM;\r\ntypedef\t\tunsigned long\t\t\tBE_ERR;\r\n\r\n/* error codes */\r\n\r\n#define\t\tBE_ERR_SUCCESSFUL\t\t\t\t\t0x00000000\r\n#define\t\tBE_ERR_INVALID_FORMAT\t\t\t\t0x00000001\r\n#define\t\tBE_ERR_INVALID_FORMAT_PARAMETERS\t0x00000002\r\n#define\t\tBE_ERR_NO_MORE_HANDLES\t\t\t\t0x00000003\r\n#define\t\tBE_ERR_INVALID_HANDLE\t\t\t\t0x00000004\r\n#define\t\tBE_ERR_BUFFER_TOO_SMALL\t\t\t\t0x00000005\r\n\r\n/* other constants */\r\n\r\n#define\t\tBE_MAX_HOMEPAGE\t\t\t128\r\n\r\n/* format specific variables */\r\n\r\n#define\t\tBE_MP3_MODE_STEREO\t\t0\r\n#define\t\tBE_MP3_MODE_JSTEREO\t\t1\r\n#define\t\tBE_MP3_MODE_DUALCHANNEL\t2\r\n#define\t\tBE_MP3_MODE_MONO\t\t3\r\n\r\n\r\n\r\n#define\t\tMPEG1\t1\r\n#define\t\tMPEG2\t0\r\n\r\n#ifdef _BLADEDLL\r\n#undef FLOAT\r\n\t#include <Windows.h>\r\n#endif\r\n\r\n#define CURRENT_STRUCT_VERSION 1\r\n#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG)\t// is currently 331 bytes\r\n\r\n\r\ntypedef enum\r\n{\r\n\tVBR_METHOD_NONE\t\t\t= -1,\r\n\tVBR_METHOD_DEFAULT\t\t=  0,\r\n\tVBR_METHOD_OLD\t\t\t=  1,\r\n\tVBR_METHOD_NEW\t\t\t=  2,\r\n\tVBR_METHOD_MTRH\t\t\t=  3,\r\n\tVBR_METHOD_ABR\t\t\t=  4\r\n} VBRMETHOD;\r\n\r\ntypedef enum \r\n{\r\n\tLQP_NOPRESET\t\t\t=-1,\r\n\r\n\t// QUALITY PRESETS\r\n\tLQP_NORMAL_QUALITY\t\t= 0,\r\n\tLQP_LOW_QUALITY\t\t\t= 1,\r\n\tLQP_HIGH_QUALITY\t\t= 2,\r\n\tLQP_VOICE_QUALITY\t\t= 3,\r\n\tLQP_R3MIX\t\t\t\t= 4,\r\n\tLQP_VERYHIGH_QUALITY\t= 5,\r\n\tLQP_STANDARD\t\t\t= 6,\r\n\tLQP_FAST_STANDARD\t\t= 7,\r\n\tLQP_EXTREME\t\t\t\t= 8,\r\n\tLQP_FAST_EXTREME\t\t= 9,\r\n\tLQP_INSANE\t\t\t\t= 10,\r\n\tLQP_ABR\t\t\t\t\t= 11,\r\n\tLQP_CBR\t\t\t\t\t= 12,\r\n\tLQP_MEDIUM\t\t\t\t= 13,\r\n\tLQP_FAST_MEDIUM\t\t\t= 14,\r\n\r\n\t// NEW PRESET VALUES\r\n\tLQP_PHONE\t=1000,\r\n\tLQP_SW\t\t=2000,\r\n\tLQP_AM\t\t=3000,\r\n\tLQP_FM\t\t=4000,\r\n\tLQP_VOICE\t=5000,\r\n\tLQP_RADIO\t=6000,\r\n\tLQP_TAPE\t=7000,\r\n\tLQP_HIFI\t=8000,\r\n\tLQP_CD\t\t=9000,\r\n\tLQP_STUDIO\t=10000\r\n\r\n} LAME_QUALITY_PRESET;\r\n\r\n\r\n\r\ntypedef struct\t{\r\n\tDWORD\tdwConfig;\t\t\t// BE_CONFIG_XXXXX\r\n\t\t\t\t\t\t\t\t// Currently only BE_CONFIG_MP3 is supported\r\n\tunion\t{\r\n\r\n\t\tstruct\t{\r\n\r\n\t\t\tDWORD\tdwSampleRate;\t\t// 48000, 44100 and 32000 allowed\r\n\t\t\tBYTE\tbyMode;\t\t\t// BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO\r\n\t\t\tWORD\twBitrate;\t\t// 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed\r\n\t\t\tBOOL\tbPrivate;\t\t\r\n\t\t\tBOOL\tbCRC;\r\n\t\t\tBOOL\tbCopyright;\r\n\t\t\tBOOL\tbOriginal;\r\n\r\n\t\t\t} mp3;\t\t\t\t\t// BE_CONFIG_MP3\r\n\r\n\t\t\tstruct\r\n\t\t\t{\r\n\t\t\t// STRUCTURE INFORMATION\r\n\t\t\tDWORD\t\t\tdwStructVersion;\t\r\n\t\t\tDWORD\t\t\tdwStructSize;\r\n\r\n\t\t\t// BASIC ENCODER SETTINGS\r\n\t\t\tDWORD\t\t\tdwSampleRate;\t\t// SAMPLERATE OF INPUT FILE\r\n\t\t\tDWORD\t\t\tdwReSampleRate;\t\t// DOWNSAMPLERATE, 0=ENCODER DECIDES  \r\n\t\t\tLONG\t\t\tnMode;\t\t\t\t// BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO\r\n\t\t\tDWORD\t\t\tdwBitrate;\t\t\t// CBR bitrate, VBR min bitrate\r\n\t\t\tDWORD\t\t\tdwMaxBitrate;\t\t// CBR ignored, VBR Max bitrate\r\n\t\t\tLONG\t\t\tnPreset;\t\t\t// Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum\r\n\t\t\tDWORD\t\t\tdwMpegVersion;\t\t// FUTURE USE, MPEG-1 OR MPEG-2\r\n\t\t\tDWORD\t\t\tdwPsyModel;\t\t\t// FUTURE USE, SET TO 0\r\n\t\t\tDWORD\t\t\tdwEmphasis;\t\t\t// FUTURE USE, SET TO 0\r\n\r\n\t\t\t// BIT STREAM SETTINGS\r\n\t\t\tBOOL\t\t\tbPrivate;\t\t\t// Set Private Bit (TRUE/FALSE)\r\n\t\t\tBOOL\t\t\tbCRC;\t\t\t\t// Insert CRC (TRUE/FALSE)\r\n\t\t\tBOOL\t\t\tbCopyright;\t\t\t// Set Copyright Bit (TRUE/FALSE)\r\n\t\t\tBOOL\t\t\tbOriginal;\t\t\t// Set Original Bit (TRUE/FALSE)\r\n\t\t\t\r\n\t\t\t// VBR STUFF\r\n\t\t\tBOOL\t\t\tbWriteVBRHeader;\t// WRITE XING VBR HEADER (TRUE/FALSE)\r\n\t\t\tBOOL\t\t\tbEnableVBR;\t\t\t// USE VBR ENCODING (TRUE/FALSE)\r\n\t\t\tINT\t\t\t\tnVBRQuality;\t\t// VBR QUALITY 0..9\r\n\t\t\tDWORD\t\t\tdwVbrAbr_bps;\t\t// Use ABR in stead of nVBRQuality\r\n\t\t\tVBRMETHOD\t\tnVbrMethod;\r\n\t\t\tBOOL\t\t\tbNoRes;\t\t\t\t// Disable Bit resorvoir (TRUE/FALSE)\r\n\r\n\t\t\t// MISC SETTINGS\r\n\t\t\tBOOL\t\t\tbStrictIso;\t\t\t// Use strict ISO encoding rules (TRUE/FALSE)\r\n\t\t\tWORD\t\t\tnQuality;\t\t\t// Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5\r\n\r\n\t\t\t// FUTURE USE, SET TO 0, align strucutre to 331 bytes\r\n\t\t\tBYTE\t\t\tbtReserved[255-4*sizeof(DWORD) - sizeof( WORD )];\r\n\r\n\t\t\t} LHV1;\t\t\t\t\t// LAME header version 1\r\n\r\n\t\tstruct\t{\r\n\r\n\t\t\tDWORD\tdwSampleRate;\r\n\t\t\tBYTE\tbyMode;\r\n\t\t\tWORD\twBitrate;\r\n\t\t\tBYTE\tbyEncodingMethod;\r\n\r\n\t\t} aac;\r\n\r\n\t} format;\r\n\t\t\r\n} BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED;\r\n\r\n\r\ntypedef struct\t{\r\n\r\n\t// BladeEnc DLL Version number\r\n\r\n\tBYTE\tbyDLLMajorVersion;\r\n\tBYTE\tbyDLLMinorVersion;\r\n\r\n\t// BladeEnc Engine Version Number\r\n\r\n\tBYTE\tbyMajorVersion;\r\n\tBYTE\tbyMinorVersion;\r\n\r\n\t// DLL Release date\r\n\r\n\tBYTE\tbyDay;\r\n\tBYTE\tbyMonth;\r\n\tWORD\twYear;\r\n\r\n\t// BladeEnc\tHomepage URL\r\n\r\n\tCHAR\tzHomepage[BE_MAX_HOMEPAGE + 1];\t\r\n\r\n\tBYTE\tbyAlphaLevel;\r\n\tBYTE\tbyBetaLevel;\r\n\tBYTE\tbyMMXEnabled;\r\n\r\n\tBYTE\tbtReserved[125];\r\n\r\n\r\n} BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED;\r\n\r\n#ifndef _BLADEDLL\r\n\r\ntypedef BE_ERR\t(*BEINITSTREAM)\t\t\t(PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);\r\ntypedef BE_ERR\t(*BEENCODECHUNK)\t\t(HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);\r\n\r\n// added for floating point audio  -- DSPguru, jd\r\ntypedef BE_ERR\t(*BEENCODECHUNKFLOATS16NI)\t(HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);\r\ntypedef BE_ERR\t(*BEDEINITSTREAM)\t\t\t(HBE_STREAM, PBYTE, PDWORD);\r\ntypedef BE_ERR\t(*BECLOSESTREAM)\t\t\t(HBE_STREAM);\r\ntypedef VOID\t(*BEVERSION)\t\t\t\t(PBE_VERSION);\r\ntypedef BE_ERR\t(*BEWRITEVBRHEADER)\t\t\t(LPCSTR);\r\ntypedef BE_ERR\t(*BEWRITEINFOTAG)\t\t\t(HBE_STREAM, LPCSTR );\r\n\r\n#define\tTEXT_BEINITSTREAM\t\t\t\t\"beInitStream\"\r\n#define\tTEXT_BEENCODECHUNK\t\t\t\t\"beEncodeChunk\"\r\n#define\tTEXT_BEENCODECHUNKFLOATS16NI\t\"beEncodeChunkFloatS16NI\"\r\n#define\tTEXT_BEDEINITSTREAM\t\t\t\t\"beDeinitStream\"\r\n#define\tTEXT_BECLOSESTREAM\t\t\t\t\"beCloseStream\"\r\n#define\tTEXT_BEVERSION\t\t\t\t\t\"beVersion\"\r\n#define\tTEXT_BEWRITEVBRHEADER\t\t\t\"beWriteVBRHeader\"\r\n#define\tTEXT_BEFLUSHNOGAP\t\t\t\t\"beFlushNoGap\"\r\n#define\tTEXT_BEWRITEINFOTAG\t\t\t\t\"beWriteInfoTag\"\r\n\r\n\r\n#else\r\n\r\n__declspec(dllexport) BE_ERR\tbeInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);\r\n__declspec(dllexport) BE_ERR\tbeEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);\r\n\r\n// added for floating point audio  -- DSPguru, jd\r\n__declspec(dllexport) BE_ERR\tbeEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);\r\n__declspec(dllexport) BE_ERR\tbeDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);\r\n__declspec(dllexport) BE_ERR\tbeCloseStream(HBE_STREAM hbeStream);\r\n__declspec(dllexport) VOID\tbeVersion(PBE_VERSION pbeVersion);\r\n__declspec(dllexport) BE_ERR\tbeWriteVBRHeader(LPCSTR lpszFileName);\r\n__declspec(dllexport) BE_ERR\tbeFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);\r\n__declspec(dllexport) BE_ERR\tbeWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName );\r\n\r\n#endif\r\n\r\n#ifdef\t__cplusplus\r\n}\r\n#endif\r\n\r\n#ifndef __GNUC__\r\n#pragma pack(pop)\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/Lame/lame.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n *\tInterface to MP3 LAME encoding engine\r\n *\r\n *\tCopyright (c) 1999 Mark Taylor\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Library General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Library General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Library General Public\r\n * License along with this library; if not, write to the\r\n * Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r\n * Boston, MA 02111-1307, USA.\r\n */\r\n\r\n/* $Id: lame.h,v 1.189.2.1 2012/01/08 23:49:58 robert Exp $ */\r\n\r\n#ifndef LAME_LAME_H\r\n#define LAME_LAME_H\r\n\r\n/* for size_t typedef */\r\n#include <stddef.h>\r\n/* for va_list typedef */\r\n#include <stdarg.h>\r\n/* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */\r\n#include <stdio.h>\r\n\r\n#if defined(__cplusplus)\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void (*lame_report_function)(const char *format, va_list ap);\r\n\r\n#if defined(WIN32) || defined(_WIN32)\r\n#undef CDECL\r\n#define CDECL __cdecl\r\n#else\r\n#define CDECL\r\n#endif\r\n\r\n#define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1\r\n\r\ntypedef enum vbr_mode_e {\r\n  vbr_off=0,\r\n  vbr_mt,               /* obsolete, same as vbr_mtrh */\r\n  vbr_rh,\r\n  vbr_abr,\r\n  vbr_mtrh,\r\n  vbr_max_indicator,    /* Don't use this! It's used for sanity checks.       */\r\n  vbr_default=vbr_mtrh    /* change this to change the default VBR mode of LAME */\r\n} vbr_mode;\r\n\r\n\r\n/* MPEG modes */\r\ntypedef enum MPEG_mode_e {\r\n  STEREO = 0,\r\n  JOINT_STEREO,\r\n  DUAL_CHANNEL,   /* LAME doesn't supports this! */\r\n  MONO,\r\n  NOT_SET,\r\n  MAX_INDICATOR   /* Don't use this! It's used for sanity checks. */\r\n} MPEG_mode;\r\n\r\n/* Padding types */\r\ntypedef enum Padding_type_e {\r\n  PAD_NO = 0,\r\n  PAD_ALL,\r\n  PAD_ADJUST,\r\n  PAD_MAX_INDICATOR   /* Don't use this! It's used for sanity checks. */\r\n} Padding_type;\r\n\r\n\r\n\r\n/*presets*/\r\ntypedef enum preset_mode_e {\r\n    /*values from 8 to 320 should be reserved for abr bitrates*/\r\n    /*for abr I'd suggest to directly use the targeted bitrate as a value*/\r\n    ABR_8 = 8,\r\n    ABR_320 = 320,\r\n\r\n    V9 = 410, /*Vx to match Lame and VBR_xx to match FhG*/\r\n    VBR_10 = 410,\r\n    V8 = 420,\r\n    VBR_20 = 420,\r\n    V7 = 430,\r\n    VBR_30 = 430,\r\n    V6 = 440,\r\n    VBR_40 = 440,\r\n    V5 = 450,\r\n    VBR_50 = 450,\r\n    V4 = 460,\r\n    VBR_60 = 460,\r\n    V3 = 470,\r\n    VBR_70 = 470,\r\n    V2 = 480,\r\n    VBR_80 = 480,\r\n    V1 = 490,\r\n    VBR_90 = 490,\r\n    V0 = 500,\r\n    VBR_100 = 500,\r\n\r\n\r\n\r\n    /*still there for compatibility*/\r\n    R3MIX = 1000,\r\n    STANDARD = 1001,\r\n    EXTREME = 1002,\r\n    INSANE = 1003,\r\n    STANDARD_FAST = 1004,\r\n    EXTREME_FAST = 1005,\r\n    MEDIUM = 1006,\r\n    MEDIUM_FAST = 1007\r\n} preset_mode;\r\n\r\n\r\n/*asm optimizations*/\r\ntypedef enum asm_optimizations_e {\r\n    MMX = 1,\r\n    AMD_3DNOW = 2,\r\n    SSE = 3\r\n} asm_optimizations;\r\n\r\n\r\n/* psychoacoustic model */\r\ntypedef enum Psy_model_e {\r\n    PSY_GPSYCHO = 1,\r\n    PSY_NSPSYTUNE = 2\r\n} Psy_model;\r\n\r\n\r\n/* buffer considerations */\r\ntypedef enum buffer_constraint_e {\r\n    MDB_DEFAULT=0,\r\n    MDB_STRICT_ISO=1,\r\n    MDB_MAXIMUM=2\r\n} buffer_constraint;\r\n\r\n\r\nstruct lame_global_struct;\r\ntypedef struct lame_global_struct lame_global_flags;\r\ntypedef lame_global_flags *lame_t;\r\n\r\n\r\n\r\n\r\n/***********************************************************************\r\n *\r\n *  The LAME API\r\n *  These functions should be called, in this order, for each\r\n *  MP3 file to be encoded.  See the file \"API\" for more documentation\r\n *\r\n ***********************************************************************/\r\n\r\n\r\n/*\r\n * REQUIRED:\r\n * initialize the encoder.  sets default for all encoder parameters,\r\n * returns NULL if some malloc()'s failed\r\n * otherwise returns pointer to structure needed for all future\r\n * API calls.\r\n */\r\nlame_global_flags * CDECL lame_init(void);\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* obsolete version */\r\nint CDECL lame_init_old(lame_global_flags *);\r\n#endif\r\n\r\n/*\r\n * OPTIONAL:\r\n * set as needed to override defaults\r\n */\r\n\r\n/********************************************************************\r\n *  input stream description\r\n ***********************************************************************/\r\n/* number of samples.  default = 2^32-1   */\r\nint CDECL lame_set_num_samples(lame_global_flags *, unsigned long);\r\nunsigned long CDECL lame_get_num_samples(const lame_global_flags *);\r\n\r\n/* input sample rate in Hz.  default = 44100hz */\r\nint CDECL lame_set_in_samplerate(lame_global_flags *, int);\r\nint CDECL lame_get_in_samplerate(const lame_global_flags *);\r\n\r\n/* number of channels in input stream. default=2  */\r\nint CDECL lame_set_num_channels(lame_global_flags *, int);\r\nint CDECL lame_get_num_channels(const lame_global_flags *);\r\n\r\n/*\r\n  scale the input by this amount before encoding.  default=1\r\n  (not used by decoding routines)\r\n*/\r\nint CDECL lame_set_scale(lame_global_flags *, float);\r\nfloat CDECL lame_get_scale(const lame_global_flags *);\r\n\r\n/*\r\n  scale the channel 0 (left) input by this amount before encoding.  default=1\r\n  (not used by decoding routines)\r\n*/\r\nint CDECL lame_set_scale_left(lame_global_flags *, float);\r\nfloat CDECL lame_get_scale_left(const lame_global_flags *);\r\n\r\n/*\r\n  scale the channel 1 (right) input by this amount before encoding.  default=1\r\n  (not used by decoding routines)\r\n*/\r\nint CDECL lame_set_scale_right(lame_global_flags *, float);\r\nfloat CDECL lame_get_scale_right(const lame_global_flags *);\r\n\r\n/*\r\n  output sample rate in Hz.  default = 0, which means LAME picks best value\r\n  based on the amount of compression.  MPEG only allows:\r\n  MPEG1    32, 44.1,   48khz\r\n  MPEG2    16, 22.05,  24\r\n  MPEG2.5   8, 11.025, 12\r\n  (not used by decoding routines)\r\n*/\r\nint CDECL lame_set_out_samplerate(lame_global_flags *, int);\r\nint CDECL lame_get_out_samplerate(const lame_global_flags *);\r\n\r\n\r\n/********************************************************************\r\n *  general control parameters\r\n ***********************************************************************/\r\n/* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */\r\nint CDECL lame_set_analysis(lame_global_flags *, int);\r\nint CDECL lame_get_analysis(const lame_global_flags *);\r\n\r\n/*\r\n  1 = write a Xing VBR header frame.\r\n  default = 1\r\n  this variable must have been added by a Hungarian notation Windows programmer :-)\r\n*/\r\nint CDECL lame_set_bWriteVbrTag(lame_global_flags *, int);\r\nint CDECL lame_get_bWriteVbrTag(const lame_global_flags *);\r\n\r\n/* 1=decode only.  use lame/mpglib to convert mp3/ogg to wav.  default=0 */\r\nint CDECL lame_set_decode_only(lame_global_flags *, int);\r\nint CDECL lame_get_decode_only(const lame_global_flags *);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* 1=encode a Vorbis .ogg file.  default=0 */\r\n/* DEPRECATED */\r\nint CDECL lame_set_ogg(lame_global_flags *, int);\r\nint CDECL lame_get_ogg(const lame_global_flags *);\r\n#endif\r\n\r\n/*\r\n  internal algorithm selection.  True quality is determined by the bitrate\r\n  but this variable will effect quality by selecting expensive or cheap algorithms.\r\n  quality=0..9.  0=best (very slow).  9=worst.\r\n  recommended:  2     near-best quality, not too slow\r\n                5     good quality, fast\r\n                7     ok quality, really fast\r\n*/\r\nint CDECL lame_set_quality(lame_global_flags *, int);\r\nint CDECL lame_get_quality(const lame_global_flags *);\r\n\r\n/*\r\n  mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono\r\n  default: lame picks based on compression ration and input channels\r\n*/\r\nint CDECL lame_set_mode(lame_global_flags *, MPEG_mode);\r\nMPEG_mode CDECL lame_get_mode(const lame_global_flags *);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/*\r\n  mode_automs.  Use a M/S mode with a switching threshold based on\r\n  compression ratio\r\n  DEPRECATED\r\n*/\r\nint CDECL lame_set_mode_automs(lame_global_flags *, int);\r\nint CDECL lame_get_mode_automs(const lame_global_flags *);\r\n#endif\r\n\r\n/*\r\n  force_ms.  Force M/S for all frames.  For testing only.\r\n  default = 0 (disabled)\r\n*/\r\nint CDECL lame_set_force_ms(lame_global_flags *, int);\r\nint CDECL lame_get_force_ms(const lame_global_flags *);\r\n\r\n/* use free_format?  default = 0 (disabled) */\r\nint CDECL lame_set_free_format(lame_global_flags *, int);\r\nint CDECL lame_get_free_format(const lame_global_flags *);\r\n\r\n/* perform ReplayGain analysis?  default = 0 (disabled) */\r\nint CDECL lame_set_findReplayGain(lame_global_flags *, int);\r\nint CDECL lame_get_findReplayGain(const lame_global_flags *);\r\n\r\n/* decode on the fly. Search for the peak sample. If the ReplayGain\r\n * analysis is enabled then perform the analysis on the decoded data\r\n * stream. default = 0 (disabled)\r\n * NOTE: if this option is set the build-in decoder should not be used */\r\nint CDECL lame_set_decode_on_the_fly(lame_global_flags *, int);\r\nint CDECL lame_get_decode_on_the_fly(const lame_global_flags *);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* DEPRECATED: now does the same as lame_set_findReplayGain()\r\n   default = 0 (disabled) */\r\nint CDECL lame_set_ReplayGain_input(lame_global_flags *, int);\r\nint CDECL lame_get_ReplayGain_input(const lame_global_flags *);\r\n\r\n/* DEPRECATED: now does the same as\r\n   lame_set_decode_on_the_fly() && lame_set_findReplayGain()\r\n   default = 0 (disabled) */\r\nint CDECL lame_set_ReplayGain_decode(lame_global_flags *, int);\r\nint CDECL lame_get_ReplayGain_decode(const lame_global_flags *);\r\n\r\n/* DEPRECATED: now does the same as lame_set_decode_on_the_fly()\r\n   default = 0 (disabled) */\r\nint CDECL lame_set_findPeakSample(lame_global_flags *, int);\r\nint CDECL lame_get_findPeakSample(const lame_global_flags *);\r\n#endif\r\n\r\n/* counters for gapless encoding */\r\nint CDECL lame_set_nogap_total(lame_global_flags*, int);\r\nint CDECL lame_get_nogap_total(const lame_global_flags*);\r\n\r\nint CDECL lame_set_nogap_currentindex(lame_global_flags* , int);\r\nint CDECL lame_get_nogap_currentindex(const lame_global_flags*);\r\n\r\n\r\n/*\r\n * OPTIONAL:\r\n * Set printf like error/debug/message reporting functions.\r\n * The second argument has to be a pointer to a function which looks like\r\n *   void my_debugf(const char *format, va_list ap)\r\n *   {\r\n *       (void) vfprintf(stdout, format, ap);\r\n *   }\r\n * If you use NULL as the value of the pointer in the set function, the\r\n * lame buildin function will be used (prints to stderr).\r\n * To quiet any output you have to replace the body of the example function\r\n * with just \"return;\" and use it in the set function.\r\n */\r\nint CDECL lame_set_errorf(lame_global_flags *, lame_report_function);\r\nint CDECL lame_set_debugf(lame_global_flags *, lame_report_function);\r\nint CDECL lame_set_msgf  (lame_global_flags *, lame_report_function);\r\n\r\n\r\n\r\n/* set one of brate compression ratio.  default is compression ratio of 11.  */\r\nint CDECL lame_set_brate(lame_global_flags *, int);\r\nint CDECL lame_get_brate(const lame_global_flags *);\r\nint CDECL lame_set_compression_ratio(lame_global_flags *, float);\r\nfloat CDECL lame_get_compression_ratio(const lame_global_flags *);\r\n\r\n\r\nint CDECL lame_set_preset( lame_global_flags*  gfp, int );\r\nint CDECL lame_set_asm_optimizations( lame_global_flags*  gfp, int, int );\r\n\r\n\r\n\r\n/********************************************************************\r\n *  frame params\r\n ***********************************************************************/\r\n/* mark as copyright.  default=0 */\r\nint CDECL lame_set_copyright(lame_global_flags *, int);\r\nint CDECL lame_get_copyright(const lame_global_flags *);\r\n\r\n/* mark as original.  default=1 */\r\nint CDECL lame_set_original(lame_global_flags *, int);\r\nint CDECL lame_get_original(const lame_global_flags *);\r\n\r\n/* error_protection.  Use 2 bytes from each frame for CRC checksum. default=0 */\r\nint CDECL lame_set_error_protection(lame_global_flags *, int);\r\nint CDECL lame_get_error_protection(const lame_global_flags *);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* padding_type. 0=pad no frames  1=pad all frames 2=adjust padding(default) */\r\nint CDECL lame_set_padding_type(lame_global_flags *, Padding_type);\r\nPadding_type CDECL lame_get_padding_type(const lame_global_flags *);\r\n#endif\r\n\r\n/* MP3 'private extension' bit  Meaningless.  default=0 */\r\nint CDECL lame_set_extension(lame_global_flags *, int);\r\nint CDECL lame_get_extension(const lame_global_flags *);\r\n\r\n/* enforce strict ISO compliance.  default=0 */\r\nint CDECL lame_set_strict_ISO(lame_global_flags *, int);\r\nint CDECL lame_get_strict_ISO(const lame_global_flags *);\r\n\r\n\r\n/********************************************************************\r\n * quantization/noise shaping\r\n ***********************************************************************/\r\n\r\n/* disable the bit reservoir. For testing only. default=0 */\r\nint CDECL lame_set_disable_reservoir(lame_global_flags *, int);\r\nint CDECL lame_get_disable_reservoir(const lame_global_flags *);\r\n\r\n/* select a different \"best quantization\" function. default=0  */\r\nint CDECL lame_set_quant_comp(lame_global_flags *, int);\r\nint CDECL lame_get_quant_comp(const lame_global_flags *);\r\nint CDECL lame_set_quant_comp_short(lame_global_flags *, int);\r\nint CDECL lame_get_quant_comp_short(const lame_global_flags *);\r\n\r\nint CDECL lame_set_experimentalX(lame_global_flags *, int); /* compatibility*/\r\nint CDECL lame_get_experimentalX(const lame_global_flags *);\r\n\r\n/* another experimental option.  for testing only */\r\nint CDECL lame_set_experimentalY(lame_global_flags *, int);\r\nint CDECL lame_get_experimentalY(const lame_global_flags *);\r\n\r\n/* another experimental option.  for testing only */\r\nint CDECL lame_set_experimentalZ(lame_global_flags *, int);\r\nint CDECL lame_get_experimentalZ(const lame_global_flags *);\r\n\r\n/* Naoki's psycho acoustic model.  default=0 */\r\nint CDECL lame_set_exp_nspsytune(lame_global_flags *, int);\r\nint CDECL lame_get_exp_nspsytune(const lame_global_flags *);\r\n\r\nvoid CDECL lame_set_msfix(lame_global_flags *, double);\r\nfloat CDECL lame_get_msfix(const lame_global_flags *);\r\n\r\n\r\n/********************************************************************\r\n * VBR control\r\n ***********************************************************************/\r\n/* Types of VBR.  default = vbr_off = CBR */\r\nint CDECL lame_set_VBR(lame_global_flags *, vbr_mode);\r\nvbr_mode CDECL lame_get_VBR(const lame_global_flags *);\r\n\r\n/* VBR quality level.  0=highest  9=lowest  */\r\nint CDECL lame_set_VBR_q(lame_global_flags *, int);\r\nint CDECL lame_get_VBR_q(const lame_global_flags *);\r\n\r\n/* VBR quality level.  0=highest  9=lowest, Range [0,...,10[  */\r\nint CDECL lame_set_VBR_quality(lame_global_flags *, float);\r\nfloat CDECL lame_get_VBR_quality(const lame_global_flags *);\r\n\r\n/* Ignored except for VBR=vbr_abr (ABR mode) */\r\nint CDECL lame_set_VBR_mean_bitrate_kbps(lame_global_flags *, int);\r\nint CDECL lame_get_VBR_mean_bitrate_kbps(const lame_global_flags *);\r\n\r\nint CDECL lame_set_VBR_min_bitrate_kbps(lame_global_flags *, int);\r\nint CDECL lame_get_VBR_min_bitrate_kbps(const lame_global_flags *);\r\n\r\nint CDECL lame_set_VBR_max_bitrate_kbps(lame_global_flags *, int);\r\nint CDECL lame_get_VBR_max_bitrate_kbps(const lame_global_flags *);\r\n\r\n/*\r\n  1=strictly enforce VBR_min_bitrate.  Normally it will be violated for\r\n  analog silence\r\n*/\r\nint CDECL lame_set_VBR_hard_min(lame_global_flags *, int);\r\nint CDECL lame_get_VBR_hard_min(const lame_global_flags *);\r\n\r\n/* for preset */\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\nint CDECL lame_set_preset_expopts(lame_global_flags *, int);\r\n#endif\r\n\r\n/********************************************************************\r\n * Filtering control\r\n ***********************************************************************/\r\n/* freq in Hz to apply lowpass. Default = 0 = lame chooses.  -1 = disabled */\r\nint CDECL lame_set_lowpassfreq(lame_global_flags *, int);\r\nint CDECL lame_get_lowpassfreq(const lame_global_flags *);\r\n/* width of transition band, in Hz.  Default = one polyphase filter band */\r\nint CDECL lame_set_lowpasswidth(lame_global_flags *, int);\r\nint CDECL lame_get_lowpasswidth(const lame_global_flags *);\r\n\r\n/* freq in Hz to apply highpass. Default = 0 = lame chooses.  -1 = disabled */\r\nint CDECL lame_set_highpassfreq(lame_global_flags *, int);\r\nint CDECL lame_get_highpassfreq(const lame_global_flags *);\r\n/* width of transition band, in Hz.  Default = one polyphase filter band */\r\nint CDECL lame_set_highpasswidth(lame_global_flags *, int);\r\nint CDECL lame_get_highpasswidth(const lame_global_flags *);\r\n\r\n\r\n/********************************************************************\r\n * psycho acoustics and other arguments which you should not change\r\n * unless you know what you are doing\r\n ***********************************************************************/\r\n\r\n/* only use ATH for masking */\r\nint CDECL lame_set_ATHonly(lame_global_flags *, int);\r\nint CDECL lame_get_ATHonly(const lame_global_flags *);\r\n\r\n/* only use ATH for short blocks */\r\nint CDECL lame_set_ATHshort(lame_global_flags *, int);\r\nint CDECL lame_get_ATHshort(const lame_global_flags *);\r\n\r\n/* disable ATH */\r\nint CDECL lame_set_noATH(lame_global_flags *, int);\r\nint CDECL lame_get_noATH(const lame_global_flags *);\r\n\r\n/* select ATH formula */\r\nint CDECL lame_set_ATHtype(lame_global_flags *, int);\r\nint CDECL lame_get_ATHtype(const lame_global_flags *);\r\n\r\n/* lower ATH by this many db */\r\nint CDECL lame_set_ATHlower(lame_global_flags *, float);\r\nfloat CDECL lame_get_ATHlower(const lame_global_flags *);\r\n\r\n/* select ATH adaptive adjustment type */\r\nint CDECL lame_set_athaa_type( lame_global_flags *, int);\r\nint CDECL lame_get_athaa_type( const lame_global_flags *);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* select the loudness approximation used by the ATH adaptive auto-leveling  */\r\nint CDECL lame_set_athaa_loudapprox( lame_global_flags *, int);\r\nint CDECL lame_get_athaa_loudapprox( const lame_global_flags *);\r\n#endif\r\n\r\n/* adjust (in dB) the point below which adaptive ATH level adjustment occurs */\r\nint CDECL lame_set_athaa_sensitivity( lame_global_flags *, float);\r\nfloat CDECL lame_get_athaa_sensitivity( const lame_global_flags* );\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* OBSOLETE: predictability limit (ISO tonality formula) */\r\nint CDECL lame_set_cwlimit(lame_global_flags *, int);\r\nint CDECL lame_get_cwlimit(const lame_global_flags *);\r\n#endif\r\n\r\n/*\r\n  allow blocktypes to differ between channels?\r\n  default: 0 for jstereo, 1 for stereo\r\n*/\r\nint CDECL lame_set_allow_diff_short(lame_global_flags *, int);\r\nint CDECL lame_get_allow_diff_short(const lame_global_flags *);\r\n\r\n/* use temporal masking effect (default = 1) */\r\nint CDECL lame_set_useTemporal(lame_global_flags *, int);\r\nint CDECL lame_get_useTemporal(const lame_global_flags *);\r\n\r\n/* use temporal masking effect (default = 1) */\r\nint CDECL lame_set_interChRatio(lame_global_flags *, float);\r\nfloat CDECL lame_get_interChRatio(const lame_global_flags *);\r\n\r\n/* disable short blocks */\r\nint CDECL lame_set_no_short_blocks(lame_global_flags *, int);\r\nint CDECL lame_get_no_short_blocks(const lame_global_flags *);\r\n\r\n/* force short blocks */\r\nint CDECL lame_set_force_short_blocks(lame_global_flags *, int);\r\nint CDECL lame_get_force_short_blocks(const lame_global_flags *);\r\n\r\n/* Input PCM is emphased PCM (for instance from one of the rarely\r\n   emphased CDs), it is STRONGLY not recommended to use this, because\r\n   psycho does not take it into account, and last but not least many decoders\r\n   ignore these bits */\r\nint CDECL lame_set_emphasis(lame_global_flags *, int);\r\nint CDECL lame_get_emphasis(const lame_global_flags *);\r\n\r\n\r\n\r\n/************************************************************************/\r\n/* internal variables, cannot be set...                                 */\r\n/* provided because they may be of use to calling application           */\r\n/************************************************************************/\r\n/* version  0=MPEG-2  1=MPEG-1  (2=MPEG-2.5)     */\r\nint CDECL lame_get_version(const lame_global_flags *);\r\n\r\n/* encoder delay   */\r\nint CDECL lame_get_encoder_delay(const lame_global_flags *);\r\n\r\n/*\r\n  padding appended to the input to make sure decoder can fully decode\r\n  all input.  Note that this value can only be calculated during the\r\n  call to lame_encoder_flush().  Before lame_encoder_flush() has\r\n  been called, the value of encoder_padding = 0.\r\n*/\r\nint CDECL lame_get_encoder_padding(const lame_global_flags *);\r\n\r\n/* size of MPEG frame */\r\nint CDECL lame_get_framesize(const lame_global_flags *);\r\n\r\n/* number of PCM samples buffered, but not yet encoded to mp3 data. */\r\nint CDECL lame_get_mf_samples_to_encode( const lame_global_flags*  gfp );\r\n\r\n/*\r\n  size (bytes) of mp3 data buffered, but not yet encoded.\r\n  this is the number of bytes which would be output by a call to\r\n  lame_encode_flush_nogap.  NOTE: lame_encode_flush() will return\r\n  more bytes than this because it will encode the reamining buffered\r\n  PCM samples before flushing the mp3 buffers.\r\n*/\r\nint CDECL lame_get_size_mp3buffer( const lame_global_flags*  gfp );\r\n\r\n/* number of frames encoded so far */\r\nint CDECL lame_get_frameNum(const lame_global_flags *);\r\n\r\n/*\r\n  lame's estimate of the total number of frames to be encoded\r\n   only valid if calling program set num_samples\r\n*/\r\nint CDECL lame_get_totalframes(const lame_global_flags *);\r\n\r\n/* RadioGain value. Multiplied by 10 and rounded to the nearest. */\r\nint CDECL lame_get_RadioGain(const lame_global_flags *);\r\n\r\n/* AudiophileGain value. Multipled by 10 and rounded to the nearest. */\r\nint CDECL lame_get_AudiophileGain(const lame_global_flags *);\r\n\r\n/* the peak sample */\r\nfloat CDECL lame_get_PeakSample(const lame_global_flags *);\r\n\r\n/* Gain change required for preventing clipping. The value is correct only if\r\n   peak sample searching was enabled. If negative then the waveform\r\n   already does not clip. The value is multiplied by 10 and rounded up. */\r\nint CDECL lame_get_noclipGainChange(const lame_global_flags *);\r\n\r\n/* user-specified scale factor required for preventing clipping. Value is\r\n   correct only if peak sample searching was enabled and no user-specified\r\n   scaling was performed. If negative then either the waveform already does\r\n   not clip or the value cannot be determined */\r\nfloat CDECL lame_get_noclipScale(const lame_global_flags *);\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/*\r\n * REQUIRED:\r\n * sets more internal configuration based on data provided above.\r\n * returns -1 if something failed.\r\n */\r\nint CDECL lame_init_params(lame_global_flags *);\r\n\r\n\r\n/*\r\n * OPTIONAL:\r\n * get the version number, in a string. of the form:\r\n * \"3.63 (beta)\" or just \"3.63\".\r\n */\r\nconst char*  CDECL get_lame_version       ( void );\r\nconst char*  CDECL get_lame_short_version ( void );\r\nconst char*  CDECL get_lame_very_short_version ( void );\r\nconst char*  CDECL get_psy_version        ( void );\r\nconst char*  CDECL get_lame_url           ( void );\r\nconst char*  CDECL get_lame_os_bitness    ( void );\r\n\r\n/*\r\n * OPTIONAL:\r\n * get the version numbers in numerical form.\r\n */\r\ntypedef struct {\r\n    /* generic LAME version */\r\n    int major;\r\n    int minor;\r\n    int alpha;               /* 0 if not an alpha version                  */\r\n    int beta;                /* 0 if not a beta version                    */\r\n\r\n    /* version of the psy model */\r\n    int psy_major;\r\n    int psy_minor;\r\n    int psy_alpha;           /* 0 if not an alpha version                  */\r\n    int psy_beta;            /* 0 if not a beta version                    */\r\n\r\n    /* compile time features */\r\n    const char *features;    /* Don't make assumptions about the contents! */\r\n} lame_version_t;\r\nvoid CDECL get_lame_version_numerical(lame_version_t *);\r\n\r\n\r\n/*\r\n * OPTIONAL:\r\n * print internal lame configuration to message handler\r\n */\r\nvoid CDECL lame_print_config(const lame_global_flags*  gfp);\r\n\r\nvoid CDECL lame_print_internals( const lame_global_flags *gfp);\r\n\r\n\r\n/*\r\n * input pcm data, output (maybe) mp3 frames.\r\n * This routine handles all buffering, resampling and filtering for you.\r\n *\r\n * return code     number of bytes output in mp3buf. Can be 0\r\n *                 -1:  mp3buf was too small\r\n *                 -2:  malloc() problem\r\n *                 -3:  lame_init_params() not called\r\n *                 -4:  psycho acoustic problems\r\n *\r\n * The required mp3buf_size can be computed from num_samples,\r\n * samplerate and encoding rate, but here is a worst case estimate:\r\n *\r\n * mp3buf_size in bytes = 1.25*num_samples + 7200\r\n *\r\n * I think a tighter bound could be:  (mt, March 2000)\r\n * MPEG1:\r\n *    num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512\r\n * MPEG2:\r\n *    num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256\r\n *\r\n * but test first if you use that!\r\n *\r\n * set mp3buf_size = 0 and LAME will not check if mp3buf_size is\r\n * large enough.\r\n *\r\n * NOTE:\r\n * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels\r\n * will be averaged into the L channel before encoding only the L channel\r\n * This will overwrite the data in buffer_l[] and buffer_r[].\r\n *\r\n*/\r\nint CDECL lame_encode_buffer (\r\n        lame_global_flags*  gfp,           /* global context handle         */\r\n        const short int     buffer_l [],   /* PCM data for left channel     */\r\n        const short int     buffer_r [],   /* PCM data for right channel    */\r\n        const int           nsamples,      /* number of samples per channel */\r\n        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */\r\n        const int           mp3buf_size ); /* number of valid octets in this\r\n                                              stream                        */\r\n\r\n/*\r\n * as above, but input has L & R channel data interleaved.\r\n * NOTE:\r\n * num_samples = number of samples in the L (or R)\r\n * channel, not the total number of samples in pcm[]\r\n */\r\nint CDECL lame_encode_buffer_interleaved(\r\n        lame_global_flags*  gfp,           /* global context handlei        */\r\n        short int           pcm[],         /* PCM data for left and right\r\n                                              channel, interleaved          */\r\n        int                 num_samples,   /* number of samples per channel,\r\n                                              _not_ number of samples in\r\n                                              pcm[]                         */\r\n        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */\r\n        int                 mp3buf_size ); /* number of valid octets in this\r\n                                              stream                        */\r\n\r\n\r\n/* as lame_encode_buffer, but for 'float's.\r\n * !! NOTE: !! data must still be scaled to be in the same range as\r\n * short int, +/- 32768\r\n */\r\nint CDECL lame_encode_buffer_float(\r\n        lame_global_flags*  gfp,           /* global context handle         */\r\n        const float         pcm_l [],      /* PCM data for left channel     */\r\n        const float         pcm_r [],      /* PCM data for right channel    */\r\n        const int           nsamples,      /* number of samples per channel */\r\n        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */\r\n        const int           mp3buf_size ); /* number of valid octets in this\r\n                                              stream                        */\r\n\r\n/* as lame_encode_buffer, but for 'float's.\r\n * !! NOTE: !! data must be scaled to +/- 1 full scale\r\n */\r\nint CDECL lame_encode_buffer_ieee_float(\r\n        lame_t          gfp,\r\n        const float     pcm_l [],          /* PCM data for left channel     */\r\n        const float     pcm_r [],          /* PCM data for right channel    */\r\n        const int       nsamples,\r\n        unsigned char * mp3buf,\r\n        const int       mp3buf_size);\r\nint CDECL lame_encode_buffer_interleaved_ieee_float(\r\n        lame_t          gfp,\r\n        const float     pcm[],             /* PCM data for left and right\r\n                                              channel, interleaved          */\r\n        const int       nsamples,\r\n        unsigned char * mp3buf,\r\n        const int       mp3buf_size);\r\n\r\n/* as lame_encode_buffer, but for 'double's.\r\n * !! NOTE: !! data must be scaled to +/- 1 full scale\r\n */\r\nint CDECL lame_encode_buffer_ieee_double(\r\n        lame_t          gfp,\r\n        const double    pcm_l [],          /* PCM data for left channel     */\r\n        const double    pcm_r [],          /* PCM data for right channel    */\r\n        const int       nsamples,\r\n        unsigned char * mp3buf,\r\n        const int       mp3buf_size);\r\nint CDECL lame_encode_buffer_interleaved_ieee_double(\r\n        lame_t          gfp,\r\n        const double    pcm[],             /* PCM data for left and right\r\n                                              channel, interleaved          */\r\n        const int       nsamples,\r\n        unsigned char * mp3buf,\r\n        const int       mp3buf_size);\r\n\r\n/* as lame_encode_buffer, but for long's\r\n * !! NOTE: !! data must still be scaled to be in the same range as\r\n * short int, +/- 32768\r\n *\r\n * This scaling was a mistake (doesn't allow one to exploit full\r\n * precision of type 'long'.  Use lame_encode_buffer_long2() instead.\r\n *\r\n */\r\nint CDECL lame_encode_buffer_long(\r\n        lame_global_flags*  gfp,           /* global context handle         */\r\n        const long     buffer_l [],       /* PCM data for left channel     */\r\n        const long     buffer_r [],       /* PCM data for right channel    */\r\n        const int           nsamples,      /* number of samples per channel */\r\n        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */\r\n        const int           mp3buf_size ); /* number of valid octets in this\r\n                                              stream                        */\r\n\r\n/* Same as lame_encode_buffer_long(), but with correct scaling.\r\n * !! NOTE: !! data must still be scaled to be in the same range as\r\n * type 'long'.   Data should be in the range:  +/- 2^(8*size(long)-1)\r\n *\r\n */\r\nint CDECL lame_encode_buffer_long2(\r\n        lame_global_flags*  gfp,           /* global context handle         */\r\n        const long     buffer_l [],       /* PCM data for left channel     */\r\n        const long     buffer_r [],       /* PCM data for right channel    */\r\n        const int           nsamples,      /* number of samples per channel */\r\n        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */\r\n        const int           mp3buf_size ); /* number of valid octets in this\r\n                                              stream                        */\r\n\r\n/* as lame_encode_buffer, but for int's\r\n * !! NOTE: !! input should be scaled to the maximum range of 'int'\r\n * If int is 4 bytes, then the values should range from\r\n * +/- 2147483648.\r\n *\r\n * This routine does not (and cannot, without loosing precision) use\r\n * the same scaling as the rest of the lame_encode_buffer() routines.\r\n *\r\n */\r\nint CDECL lame_encode_buffer_int(\r\n        lame_global_flags*  gfp,           /* global context handle         */\r\n        const int      buffer_l [],       /* PCM data for left channel     */\r\n        const int      buffer_r [],       /* PCM data for right channel    */\r\n        const int           nsamples,      /* number of samples per channel */\r\n        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */\r\n        const int           mp3buf_size ); /* number of valid octets in this\r\n                                              stream                        */\r\n\r\n\r\n\r\n\r\n\r\n/*\r\n * REQUIRED:\r\n * lame_encode_flush will flush the intenal PCM buffers, padding with\r\n * 0's to make sure the final frame is complete, and then flush\r\n * the internal MP3 buffers, and thus may return a\r\n * final few mp3 frames.  'mp3buf' should be at least 7200 bytes long\r\n * to hold all possible emitted data.\r\n *\r\n * will also write id3v1 tags (if any) into the bitstream\r\n *\r\n * return code = number of bytes output to mp3buf. Can be 0\r\n */\r\nint CDECL lame_encode_flush(\r\n        lame_global_flags *  gfp,    /* global context handle                 */\r\n        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */\r\n        int                  size);  /* number of valid octets in this stream */\r\n\r\n/*\r\n * OPTIONAL:\r\n * lame_encode_flush_nogap will flush the internal mp3 buffers and pad\r\n * the last frame with ancillary data so it is a complete mp3 frame.\r\n *\r\n * 'mp3buf' should be at least 7200 bytes long\r\n * to hold all possible emitted data.\r\n *\r\n * After a call to this routine, the outputed mp3 data is complete, but\r\n * you may continue to encode new PCM samples and write future mp3 data\r\n * to a different file.  The two mp3 files will play back with no gaps\r\n * if they are concatenated together.\r\n *\r\n * This routine will NOT write id3v1 tags into the bitstream.\r\n *\r\n * return code = number of bytes output to mp3buf. Can be 0\r\n */\r\nint CDECL lame_encode_flush_nogap(\r\n        lame_global_flags *  gfp,    /* global context handle                 */\r\n        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */\r\n        int                  size);  /* number of valid octets in this stream */\r\n\r\n/*\r\n * OPTIONAL:\r\n * Normally, this is called by lame_init_params().  It writes id3v2 and\r\n * Xing headers into the front of the bitstream, and sets frame counters\r\n * and bitrate histogram data to 0.  You can also call this after\r\n * lame_encode_flush_nogap().\r\n */\r\nint CDECL lame_init_bitstream(\r\n        lame_global_flags *  gfp);    /* global context handle                 */\r\n\r\n\r\n\r\n/*\r\n * OPTIONAL:    some simple statistics\r\n * a bitrate histogram to visualize the distribution of used frame sizes\r\n * a stereo mode histogram to visualize the distribution of used stereo\r\n *   modes, useful in joint-stereo mode only\r\n *   0: LR    left-right encoded\r\n *   1: LR-I  left-right and intensity encoded (currently not supported)\r\n *   2: MS    mid-side encoded\r\n *   3: MS-I  mid-side and intensity encoded (currently not supported)\r\n *\r\n * attention: don't call them after lame_encode_finish\r\n * suggested: lame_encode_flush -> lame_*_hist -> lame_close\r\n */\r\n\r\nvoid CDECL lame_bitrate_hist(\r\n        const lame_global_flags * gfp,\r\n        int bitrate_count[14] );\r\nvoid CDECL lame_bitrate_kbps(\r\n        const lame_global_flags * gfp,\r\n        int bitrate_kbps [14] );\r\nvoid CDECL lame_stereo_mode_hist(\r\n        const lame_global_flags * gfp,\r\n        int stereo_mode_count[4] );\r\n\r\nvoid CDECL lame_bitrate_stereo_mode_hist (\r\n        const lame_global_flags * gfp,\r\n        int bitrate_stmode_count[14][4] );\r\n\r\nvoid CDECL lame_block_type_hist (\r\n        const lame_global_flags * gfp,\r\n        int btype_count[6] );\r\n\r\nvoid CDECL lame_bitrate_block_type_hist (\r\n        const lame_global_flags * gfp,\r\n        int bitrate_btype_count[14][6] );\r\n\r\n#if (DEPRECATED_OR_OBSOLETE_CODE_REMOVED && 0)\r\n#else\r\n/*\r\n * OPTIONAL:\r\n * lame_mp3_tags_fid will rewrite a Xing VBR tag to the mp3 file with file\r\n * pointer fid.  These calls perform forward and backwards seeks, so make\r\n * sure fid is a real file.  Make sure lame_encode_flush has been called,\r\n * and all mp3 data has been written to the file before calling this\r\n * function.\r\n * NOTE:\r\n * if VBR  tags are turned off by the user, or turned off by LAME because\r\n * the output is not a regular file, this call does nothing\r\n * NOTE:\r\n * LAME wants to read from the file to skip an optional ID3v2 tag, so\r\n * make sure you opened the file for writing and reading.\r\n * NOTE:\r\n * You can call lame_get_lametag_frame instead, if you want to insert\r\n * the lametag yourself.\r\n*/\r\nvoid CDECL lame_mp3_tags_fid(lame_global_flags *, FILE* fid);\r\n#endif\r\n\r\n/*\r\n * OPTIONAL:\r\n * lame_get_lametag_frame copies the final LAME-tag into 'buffer'.\r\n * The function returns the number of bytes copied into buffer, or\r\n * the required buffer size, if the provided buffer is too small.\r\n * Function failed, if the return value is larger than 'size'!\r\n * Make sure lame_encode flush has been called before calling this function.\r\n * NOTE:\r\n * if VBR  tags are turned off by the user, or turned off by LAME,\r\n * this call does nothing and returns 0.\r\n * NOTE:\r\n * LAME inserted an empty frame in the beginning of mp3 audio data,\r\n * which you have to replace by the final LAME-tag frame after encoding.\r\n * In case there is no ID3v2 tag, usually this frame will be the very first\r\n * data in your mp3 file. If you put some other leading data into your\r\n * file, you'll have to do some bookkeeping about where to write this buffer.\r\n */\r\nsize_t CDECL lame_get_lametag_frame(\r\n        const lame_global_flags *, unsigned char* buffer, size_t size);\r\n\r\n/*\r\n * REQUIRED:\r\n * final call to free all remaining buffers\r\n */\r\nint  CDECL lame_close (lame_global_flags *);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/*\r\n * OBSOLETE:\r\n * lame_encode_finish combines lame_encode_flush() and lame_close() in\r\n * one call.  However, once this call is made, the statistics routines\r\n * will no longer work because the data will have been cleared, and\r\n * lame_mp3_tags_fid() cannot be called to add data to the VBR header\r\n */\r\nint CDECL lame_encode_finish(\r\n        lame_global_flags*  gfp,\r\n        unsigned char*      mp3buf,\r\n        int                 size );\r\n#endif\r\n\r\n\r\n\r\n\r\n\r\n\r\n/*********************************************************************\r\n *\r\n * decoding\r\n *\r\n * a simple interface to mpglib, part of mpg123, is also included if\r\n * libmp3lame is compiled with HAVE_MPGLIB\r\n *\r\n *********************************************************************/\r\n\r\nstruct hip_global_struct;\r\ntypedef struct hip_global_struct hip_global_flags;\r\ntypedef hip_global_flags *hip_t;\r\n\r\n\r\ntypedef struct {\r\n  int header_parsed;   /* 1 if header was parsed and following data was\r\n                          computed                                       */\r\n  int stereo;          /* number of channels                             */\r\n  int samplerate;      /* sample rate                                    */\r\n  int bitrate;         /* bitrate                                        */\r\n  int mode;            /* mp3 frame type                                 */\r\n  int mode_ext;        /* mp3 frame type                                 */\r\n  int framesize;       /* number of samples per mp3 frame                */\r\n\r\n  /* this data is only computed if mpglib detects a Xing VBR header */\r\n  unsigned long nsamp; /* number of samples in mp3 file.                 */\r\n  int totalframes;     /* total number of frames in mp3 file             */\r\n\r\n  /* this data is not currently computed by the mpglib routines */\r\n  int framenum;        /* frames decoded counter                         */\r\n} mp3data_struct;\r\n\r\n/* required call to initialize decoder */\r\nhip_t CDECL hip_decode_init(void);\r\n\r\n/* cleanup call to exit decoder  */\r\nint CDECL hip_decode_exit(hip_t gfp);\r\n\r\n/* HIP reporting functions */\r\nvoid CDECL hip_set_errorf(hip_t gfp, lame_report_function f);\r\nvoid CDECL hip_set_debugf(hip_t gfp, lame_report_function f);\r\nvoid CDECL hip_set_msgf  (hip_t gfp, lame_report_function f);\r\n\r\n/*********************************************************************\r\n * input 1 mp3 frame, output (maybe) pcm data.\r\n *\r\n *  nout = hip_decode(hip, mp3buf,len,pcm_l,pcm_r);\r\n *\r\n * input:\r\n *    len          :  number of bytes of mp3 data in mp3buf\r\n *    mp3buf[len]  :  mp3 data to be decoded\r\n *\r\n * output:\r\n *    nout:  -1    : decoding error\r\n *            0    : need more data before we can complete the decode\r\n *           >0    : returned 'nout' samples worth of data in pcm_l,pcm_r\r\n *    pcm_l[nout]  : left channel data\r\n *    pcm_r[nout]  : right channel data\r\n *\r\n *********************************************************************/\r\nint CDECL hip_decode( hip_t           gfp\r\n                    , unsigned char * mp3buf\r\n                    , size_t          len\r\n                    , short           pcm_l[]\r\n                    , short           pcm_r[]\r\n                    );\r\n\r\n/* same as hip_decode, and also returns mp3 header data */\r\nint CDECL hip_decode_headers( hip_t           gfp\r\n                            , unsigned char*  mp3buf\r\n                            , size_t          len\r\n                            , short           pcm_l[]\r\n                            , short           pcm_r[]\r\n                            , mp3data_struct* mp3data\r\n                            );\r\n\r\n/* same as hip_decode, but returns at most one frame */\r\nint CDECL hip_decode1( hip_t          gfp\r\n                     , unsigned char* mp3buf\r\n                     , size_t         len\r\n                     , short          pcm_l[]\r\n                     , short          pcm_r[]\r\n                     );\r\n\r\n/* same as hip_decode1, but returns at most one frame and mp3 header data */\r\nint CDECL hip_decode1_headers( hip_t           gfp\r\n                             , unsigned char*  mp3buf\r\n                             , size_t          len\r\n                             , short           pcm_l[]\r\n                             , short           pcm_r[]\r\n                             , mp3data_struct* mp3data\r\n                             );\r\n\r\n/* same as hip_decode1_headers, but also returns enc_delay and enc_padding\r\n   from VBR Info tag, (-1 if no info tag was found) */\r\nint CDECL hip_decode1_headersB( hip_t gfp\r\n                              , unsigned char*   mp3buf\r\n                              , size_t           len\r\n                              , short            pcm_l[]\r\n                              , short            pcm_r[]\r\n                              , mp3data_struct*  mp3data\r\n                              , int             *enc_delay\r\n                              , int             *enc_padding\r\n                              );\r\n\r\n\r\n\r\n/* OBSOLETE:\r\n * lame_decode... functions are there to keep old code working\r\n * but it is strongly recommended to replace calls by hip_decode...\r\n * function calls, see above.\r\n */\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\nint CDECL lame_decode_init(void);\r\nint CDECL lame_decode(\r\n        unsigned char *  mp3buf,\r\n        int              len,\r\n        short            pcm_l[],\r\n        short            pcm_r[] );\r\nint CDECL lame_decode_headers(\r\n        unsigned char*   mp3buf,\r\n        int              len,\r\n        short            pcm_l[],\r\n        short            pcm_r[],\r\n        mp3data_struct*  mp3data );\r\nint CDECL lame_decode1(\r\n        unsigned char*  mp3buf,\r\n        int             len,\r\n        short           pcm_l[],\r\n        short           pcm_r[] );\r\nint CDECL lame_decode1_headers(\r\n        unsigned char*   mp3buf,\r\n        int              len,\r\n        short            pcm_l[],\r\n        short            pcm_r[],\r\n        mp3data_struct*  mp3data );\r\nint CDECL lame_decode1_headersB(\r\n        unsigned char*   mp3buf,\r\n        int              len,\r\n        short            pcm_l[],\r\n        short            pcm_r[],\r\n        mp3data_struct*  mp3data,\r\n        int              *enc_delay,\r\n        int              *enc_padding );\r\nint CDECL lame_decode_exit(void);\r\n\r\n#endif /* obsolete lame_decode API calls */\r\n\r\n\r\n/*********************************************************************\r\n *\r\n * id3tag stuff\r\n *\r\n *********************************************************************/\r\n\r\n/*\r\n * id3tag.h -- Interface to write ID3 version 1 and 2 tags.\r\n *\r\n * Copyright (C) 2000 Don Melton.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Library General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Library General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Library General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\r\n */\r\n\r\n/* utility to obtain alphabetically sorted list of genre names with numbers */\r\nvoid CDECL id3tag_genre_list(\r\n        void (*handler)(int, const char *, void *),\r\n        void*  cookie);\r\n\r\nvoid CDECL id3tag_init     (lame_t gfp);\r\n\r\n/* force addition of version 2 tag */\r\nvoid CDECL id3tag_add_v2   (lame_t gfp);\r\n\r\n/* add only a version 1 tag */\r\nvoid CDECL id3tag_v1_only  (lame_t gfp);\r\n\r\n/* add only a version 2 tag */\r\nvoid CDECL id3tag_v2_only  (lame_t gfp);\r\n\r\n/* pad version 1 tag with spaces instead of nulls */\r\nvoid CDECL id3tag_space_v1 (lame_t gfp);\r\n\r\n/* pad version 2 tag with extra 128 bytes */\r\nvoid CDECL id3tag_pad_v2   (lame_t gfp);\r\n\r\n/* pad version 2 tag with extra n bytes */\r\nvoid CDECL id3tag_set_pad  (lame_t gfp, size_t n);\r\n\r\nvoid CDECL id3tag_set_title(lame_t gfp, const char* title);\r\nvoid CDECL id3tag_set_artist(lame_t gfp, const char* artist);\r\nvoid CDECL id3tag_set_album(lame_t gfp, const char* album);\r\nvoid CDECL id3tag_set_year(lame_t gfp, const char* year);\r\nvoid CDECL id3tag_set_comment(lame_t gfp, const char* comment);\r\n            \r\n/* return -1 result if track number is out of ID3v1 range\r\n                    and ignored for ID3v1 */\r\nint CDECL id3tag_set_track(lame_t gfp, const char* track);\r\n\r\n/* return non-zero result if genre name or number is invalid\r\n  result 0: OK\r\n  result -1: genre number out of range\r\n  result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other'\r\n             but taken as-is for ID3v2 genre tag */\r\nint CDECL id3tag_set_genre(lame_t gfp, const char* genre);\r\n\r\n/* return non-zero result if field name is invalid */\r\nint CDECL id3tag_set_fieldvalue(lame_t gfp, const char* fieldvalue);\r\n\r\n/* return non-zero result if image type is invalid */\r\nint CDECL id3tag_set_albumart(lame_t gfp, const char* image, size_t size);\r\n\r\n/* lame_get_id3v1_tag copies ID3v1 tag into buffer.\r\n * Function returns number of bytes copied into buffer, or number\r\n * of bytes rquired if buffer 'size' is too small.\r\n * Function fails, if returned value is larger than 'size'.\r\n * NOTE:\r\n * This functions does nothing, if user/LAME disabled ID3v1 tag.\r\n */\r\nsize_t CDECL lame_get_id3v1_tag(lame_t gfp, unsigned char* buffer, size_t size);\r\n\r\n/* lame_get_id3v2_tag copies ID3v2 tag into buffer.\r\n * Function returns number of bytes copied into buffer, or number\r\n * of bytes rquired if buffer 'size' is too small.\r\n * Function fails, if returned value is larger than 'size'.\r\n * NOTE:\r\n * This functions does nothing, if user/LAME disabled ID3v2 tag.\r\n */\r\nsize_t CDECL lame_get_id3v2_tag(lame_t gfp, unsigned char* buffer, size_t size);\r\n\r\n/* normaly lame_init_param writes ID3v2 tags into the audio stream\r\n * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param\r\n * to turn off this behaviour and get ID3v2 tag with above function\r\n * write it yourself into your file.\r\n */\r\nvoid CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int);\r\nint CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp);\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_textinfo_latin1(lame_t gfp, char const *id, char const *text);\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_comment_latin1(lame_t gfp, char const *lang, char const *desc, char const *text);\r\n\r\n#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED\r\n#else\r\n/* experimental */\r\nint CDECL id3tag_set_textinfo_ucs2(lame_t gfp, char const *id, unsigned short const *text);\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_comment_ucs2(lame_t gfp, char const *lang,\r\n                                  unsigned short const *desc, unsigned short const *text);\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_fieldvalue_ucs2(lame_t gfp, const unsigned short *fieldvalue);\r\n#endif\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_fieldvalue_utf16(lame_t gfp, const unsigned short *fieldvalue);\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_textinfo_utf16(lame_t gfp, char const *id, unsigned short const *text);\r\n\r\n/* experimental */\r\nint CDECL id3tag_set_comment_utf16(lame_t gfp, char const *lang, unsigned short const *desc, unsigned short const *text);\r\n\r\n\r\n/***********************************************************************\r\n*\r\n*  list of valid bitrates [kbps] & sample frequencies [Hz].\r\n*  first index: 0: MPEG-2   values  (sample frequencies 16...24 kHz)\r\n*               1: MPEG-1   values  (sample frequencies 32...48 kHz)\r\n*               2: MPEG-2.5 values  (sample frequencies  8...12 kHz)\r\n***********************************************************************/\r\n\r\nextern const int     bitrate_table    [3][16];\r\nextern const int     samplerate_table [3][ 4];\r\n\r\n/* access functions for use in DLL, global vars are not exported */\r\nint CDECL lame_get_bitrate(int mpeg_version, int table_index);\r\nint CDECL lame_get_samplerate(int mpeg_version, int table_index);\r\n\r\n\r\n/* maximum size of albumart image (128KB), which affects LAME_MAXMP3BUFFER\r\n   as well since lame_encode_buffer() also returns ID3v2 tag data */\r\n#define LAME_MAXALBUMART    (128 * 1024)\r\n\r\n/* maximum size of mp3buffer needed if you encode at most 1152 samples for\r\n   each call to lame_encode_buffer.  see lame_encode_buffer() below  \r\n   (LAME_MAXMP3BUFFER is now obsolete)  */\r\n#define LAME_MAXMP3BUFFER   (16384 + LAME_MAXALBUMART)\r\n\r\n\r\ntypedef enum {\r\n    LAME_OKAY             =   0,\r\n    LAME_NOERROR          =   0,\r\n    LAME_GENERICERROR     =  -1,\r\n    LAME_NOMEM            = -10,\r\n    LAME_BADBITRATE       = -11,\r\n    LAME_BADSAMPFREQ      = -12,\r\n    LAME_INTERNALERROR    = -13,\r\n\r\n    FRONTEND_READERROR    = -80,\r\n    FRONTEND_WRITEERROR   = -81,\r\n    FRONTEND_FILETOOLARGE = -82\r\n\r\n} lame_errorcodes_t;\r\n\r\n#if defined(__cplusplus)\r\n}\r\n#endif\r\n#endif /* LAME_LAME_H */\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/OSSGameLibraryWin32.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Express 2012 for Windows Desktop\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"SampleProject\", \"SampleProject\\SampleProject.vcxproj\", \"{32B44C90-DD31-45A5-B7D9-A31332A95918}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01} = {FBA57D95-F571-4CFE-BDA1-E40610D58F01}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"OSSGameLibraryWin32\", \"OSSGameLibraryWin32.vcxproj\", \"{FBA57D95-F571-4CFE-BDA1-E40610D58F01}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug_Cpp|Win32 = Debug_Cpp|Win32\r\n\t\tDebug_CSharp|Win32 = Debug_CSharp|Win32\r\n\t\tDebug|Win32 = Debug|Win32\r\n\t\tRelease|Win32 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Debug_Cpp|Win32.ActiveCfg = Debug_Cpp|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Debug_Cpp|Win32.Build.0 = Debug_Cpp|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Debug_CSharp|Win32.ActiveCfg = Debug_CSharp|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Debug_CSharp|Win32.Build.0 = Debug_CSharp|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{32B44C90-DD31-45A5-B7D9-A31332A95918}.Release|Win32.Build.0 = Release|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Debug_Cpp|Win32.ActiveCfg = Debug_Cpp|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Debug_Cpp|Win32.Build.0 = Debug_Cpp|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Debug_CSharp|Win32.ActiveCfg = Debug_CSharp|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Debug_CSharp|Win32.Build.0 = Debug_CSharp|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{FBA57D95-F571-4CFE-BDA1-E40610D58F01}.Release|Win32.Build.0 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Engine/porting/Win32/OSSGameLibraryWin32.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug_Cpp|Win32\">\r\n      <Configuration>Debug_Cpp</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug_CSharp|Win32\">\r\n      <Configuration>Debug_CSharp</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{FBA57D95-F571-4CFE-BDA1-E40610D58F01}</ProjectGuid>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <RootNamespace>GameLibraryWin32</RootNamespace>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>StaticLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>StaticLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>StaticLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <ConfigurationType>StaticLibrary</ConfigurationType>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <LibraryPath>$(ProjectDir)openssl/lib;$(ProjectDir)Lame;$(ProjectDir)pure-Lua\\;$(ProjectDir)LuaEdit\\x86;$(ProjectDir)directx;$(LibraryPath)</LibraryPath>\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <LibraryPath>$(ProjectDir)openssl/lib;$(ProjectDir)Lame;$(ProjectDir)pure-Lua\\;$(ProjectDir)LuaEdit\\x86;$(ProjectDir)directx;$(LibraryPath)</LibraryPath>\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n    <LibraryPath>$(ProjectDir)openssl/lib;$(ProjectDir)Lame;$(ProjectDir)pure-Lua\\;$(ProjectDir)LuaEdit\\x86;$(ProjectDir)directx;$(LibraryPath)</LibraryPath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <LibraryPath>$(ProjectDir)openssl/lib;$(ProjectDir)Lame;$(ProjectDir)pure-Lua\\;$(ProjectDir)LuaEdit\\x86;$(ProjectDir)directx;$(LibraryPath)</LibraryPath>\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r\n      <WarningLevel>TurnOffAllWarnings</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>CURL_STATICLIB;WIN32;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_DEBUG;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>../../source/UISystem/;../../source/Animation/;../../source/Assets/;../../source/Core/;../../source/LuaLib/;../../source/HTTP/;../../source/SystemTask/;../../source/Rendering/;../../source/SceneGraph/;../../source/UnitSystem/;../../porting/;../../libs/freeType/include/;../../libs/sha1/;../../libs/utf8_converter/;../../include/;../../Source/include/;../../libs/minizip;../../libs/lua;../../porting/Win32/;../../porting/Win32/LuaEdit/include/;../../porting/Win32/Platform;../../porting/Win32/openssl/include/;../../porting/Win32/Lame/;../../libs/SQLite/;../../source/Database/;../../source/AISystem/;../../source/DataSet/;./zlib/include/;../../libs/;../../libs/curl-7.29.0-minimal/include/curl/;../../libs/curl-7.29.0-minimal/lib/;../../libs/curl-7.29.0-minimal/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AdditionalOptions>/D \"DEBUG\" %(AdditionalOptions)</AdditionalOptions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <ShowIncludes>false</ShowIncludes>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>wsock32.lib;C:\\Imagination Technologies\\POWERVR SDK\\OGLES_WINDOWS_X86EMULATION_2.09.29.0649\\Builds\\OGLES\\WindowsX86\\Lib\\libEGL.lib;C:\\Imagination Technologies\\POWERVR SDK\\OGLES_WINDOWS_X86EMULATION_2.09.29.0649\\Builds\\OGLES\\WindowsX86\\Lib\\libgles_cm.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n    <Lib />\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r\n      <WarningLevel>TurnOffAllWarnings</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>CURL_STATICLIB;WIN32;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_DEBUG;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;__CSHARP_VERSION__;DEBUG_WITH_MD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>../../source/UISystem/;../../source/Animation/;../../source/Assets/;../../source/Core/;../../source/LuaLib/;../../source/HTTP/;../../source/SystemTask/;../../source/Rendering/;../../source/SceneGraph/;../../source/UnitSystem/;../../porting/;../../libs/freeType/include/;../../libs/sha1/;../../libs/utf8_converter/;../../include/;../../Source/include/;../../libs/minizip;../../libs/lua;../../porting/Win32/;../../porting/Win32/LuaEdit/include/;../../porting/Win32/Platform;../../porting/Win32/openssl/include/;../../porting/Win32/Lame/;../../libs/SQLite/;../../source/Database/;../../source/AISystem/;../../source/DataSet/;./zlib/include/;../../libs/;../../libs/curl-7.29.0-minimal/include/curl/;../../libs/curl-7.29.0-minimal/lib/;../../libs/curl-7.29.0-minimal/include/;../../include/;../../libs/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <AdditionalOptions>/D \"DEBUG\" %(AdditionalOptions)</AdditionalOptions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <CompileAsManaged>false</CompileAsManaged>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>wsock32.lib;C:\\Imagination Technologies\\POWERVR SDK\\OGLES_WINDOWS_X86EMULATION_2.09.29.0649\\Builds\\OGLES\\WindowsX86\\Lib\\libEGL.lib;C:\\Imagination Technologies\\POWERVR SDK\\OGLES_WINDOWS_X86EMULATION_2.09.29.0649\\Builds\\OGLES\\WindowsX86\\Lib\\libgles_cm.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n    <Lib />\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r\n      <Optimization>MaxSpeed</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>CURL_STATICLIB;WIN32;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>../../source/UISystem/;../../source/Animation/;../../source/Assets/;../../source/Core/;../../source/LuaLib/;../../source/HTTP/;../../source/SystemTask/;../../source/Rendering/;../../source/SceneGraph/;../../source/UnitSystem/;../../porting/;../../libs/freeType/include/;../../libs/sha1/;../../libs/utf8_converter/;../../include/;../../Source/include/;../../libs/minizip;../../libs/lua;../../porting/Win32/;../../porting/Win32/LuaEdit/include/;../../porting/Win32/Platform;../../porting/Win32/openssl/include/;../../porting/Win32/Lame/;../../libs/SQLite/;../../source/Database/;../../source/AISystem/;../../source/DataSet/;./zlib/include/;../../libs/;../../libs/curl-7.29.0-minimal/include/curl/;../../libs/curl-7.29.0-minimal/lib/;../../libs/curl-7.29.0-minimal/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <ClCompile>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>CURL_STATICLIB;WIN32;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_DEBUG;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;__CPP_VERSION__;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalIncludeDirectories>../../source/UISystem/;../../source/Animation/;../../source/Assets/;../../source/Core/;../../source/LuaLib/;../../source/HTTP/;../../source/SystemTask/;../../source/Rendering/;../../source/SceneGraph/;../../source/UnitSystem/;../../porting/;../../libs/freeType/include/;../../libs/sha1/;../../libs/utf8_converter/;../../include/;../../Source/include/;../../libs/minizip;../../libs/lua;../../porting/Win32/;../../porting/Win32/LuaEdit/include/;../../porting/Win32/Platform;../../porting/Win32/openssl/include/;../../porting/Win32/Lame/;../../libs/SQLite/;../../source/Database/;../../source/AISystem/;../../source/DataSet/;./zlib/include/;../../libs/;../../libs/curl-7.29.0-minimal/include/curl/;../../libs/curl-7.29.0-minimal/lib/;../../libs/curl-7.29.0-minimal/include/;../../libs/;../../libs/RuntimeCSharp/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <CompileAsManaged>false</CompileAsManaged>\r\n      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <None Include=\"..\\..\\source\\Rendering\\shaderSource.inl\" />\r\n    <None Include=\"Playground.ico\" />\r\n    <None Include=\"ReadMe.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\..\\..\\Projects\\WorldTest\\CWorldTask.h\" />\r\n    <ClInclude Include=\"..\\..\\include\\BaseType.h\" />\r\n    <ClInclude Include=\"..\\..\\include\\FileSystem.h\" />\r\n    <ClInclude Include=\"..\\..\\include\\ITmpFile.h\" />\r\n    <ClInclude Include=\"..\\..\\include\\OSWidget.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_common.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_gen.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_parse.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_tree.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_alloc.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_assert.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_buf.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_bytestack.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_encode.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_lex.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_parser.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lapi.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lauxlib.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lcode.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lctype.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ldebug.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ldo.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lfunc.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lgc.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\llex.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\llimits.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lmem.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lobject.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lopcodes.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lparser.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lstate.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lstring.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ltable.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ltm.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lua.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lua.hpp\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\luaconf.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lualib.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lundump.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lvm.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lzio.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\crypt.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\ioapi.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\mztools.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\unzip.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\sha1\\hash_sha1.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\SQLite\\sqlite3.h\" />\r\n    <ClInclude Include=\"..\\..\\libs\\SQLite\\sqlite3ext.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBNodeVirtualDocument.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBScoreNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBSplineNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBSWFPlayer.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\AudioAsset.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\CKLBAsset.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\CKLBPropertyBag.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\CKLBTexturePacker.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\MapManagement.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\NodeAnimationAsset.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\TextureManagement.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\ArrayAllocator.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBAction.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBAppProperty.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBAsyncLoader.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBBinArray.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBDataHandler.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBDebugger.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBGenericTask.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBIntervalTimer.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLifeCtrlTask.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLuaEnv.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLuaPropTask.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLuaTask.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBObject.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBPauseCtrl.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBTextTempBuffer.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBUtility.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CLuaState.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\DebugAlloc.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\DebugTracker.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Core\\yasper.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Database\\CKLBDatabase.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Database\\CKLBLanguageDatabase.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Database\\CKLBLuaDB.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Database\\DataSet.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBHTTPInterface.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBJsonItem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBNetAPI.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBNetAPIKeyChain.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBStoreService.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBUpdate.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CUnZip.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\include\\CPFInterface.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\include\\CSoundAnalysis.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaConst.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibAPP.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibASSET.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibBIN.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibCONV.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDATA.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDB.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDEBUG.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibENG.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibFONT.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibGL.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibHASH.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibKEY.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibLANG.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibMatrix.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibRES.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibSOUND.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibTASK.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibUI.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\ILuaFuncLib.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Rendering\\CKLBCanvasSprite.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Rendering\\CKLBRendering.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SceneGraph\\CKLBNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Scripting\\CKLBGCTask.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\Sound\\CSoundAnalysisMP3.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBDebugMenu.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBDeviceKeyEvent.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBDrawTask.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBLuaScript.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBOSCtrlEvent.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBTouchEventUI.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBTouchPad.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBActivityIndicatorNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBDragCallbackIF.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBFormGroup.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBFormIF.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBLabelNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBModalStack.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBMovieNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBNodeAnimPack.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrMgrDefault.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrMgrPage.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrMgrSolid.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrollBarIF.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBTextInputNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIActivityIndicator.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIButton.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUICanvas.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIClip.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIControl.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIDebugItem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIDragIcon.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIForm.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIFreeVertItem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIGroup.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUILabel.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIList.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIMoviePlayer.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIMultiImgItem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIPieChart.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIPolyline.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIRubberBand.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUISimpleItem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUISystem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUITextInput.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIVariableItem.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIWebArea.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBWebViewNode.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\IMgrEntry.h\" />\r\n    <ClInclude Include=\"..\\..\\source\\UnitSystem\\UnitSystem.h\" />\r\n    <ClInclude Include=\"EngineStdReference.h\" />\r\n    <ClInclude Include=\"GameEngine.h\" />\r\n    <ClInclude Include=\"Lame\\BladeMP3EncDLL.h\" />\r\n    <ClInclude Include=\"Lame\\lame.h\" />\r\n    <ClInclude Include=\"Platform\\CSockReadStream.h\" />\r\n    <ClInclude Include=\"Platform\\CSockWriteStream.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32Audio.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32HttpStream.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32KeyChain.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32MP3.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32PathConv.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32Platform.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32ReadFileStream.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32TmpFile.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32Widget.h\" />\r\n    <ClInclude Include=\"Platform\\CWin32WriteFileStream.h\" />\r\n    <ClInclude Include=\"Platform\\KLBPlatformMetrics.h\" />\r\n    <ClInclude Include=\"Platform\\Win32FileLocation.h\" />\r\n    <ClInclude Include=\"stdafx.h\" />\r\n    <ClInclude Include=\"targetver.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\amigaos.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\asyn-ares.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\asyn-thread.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\axtls.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\base64.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\bundles.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\conncache.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\connect.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\content_encoding.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\cookie.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_addrinfo.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_darwinssl.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_fnmatch.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_gethostname.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_gssapi.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_memrchr.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_multibyte.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm_core.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm_msgs.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm_wb.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_rand.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_rtmp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_sasl.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_schannel.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_sspi.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_threads.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\cyassl.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\dict.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\easy.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\escape.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\file.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\fileinfo.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\formdata.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ftp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ftplistparser.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\getenv.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\getinfo.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\gopher.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\gtls.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hash.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hmac.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostasyn.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostcheck.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostip.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostip4.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostip6.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostsyn.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_chunks.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_digest.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_negotiate.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_negotiate_sspi.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_proxy.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\idn_win32.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\if2ip.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\imap.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\inet_ntop.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\inet_pton.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\krb4.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\krb5.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ldap.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\llist.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\md4.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\md5.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\memdebug.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\mprintf.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\multi.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\netrc.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\non-ascii.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nonblock.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nss.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nwlib.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nwos.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\openldap.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\parsedate.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\pingpong.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\polarssl.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\pop3.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\progress.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\qssl.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\rawstr.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\rtsp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\security.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\select.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\sendf.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\share.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\slist.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\smtp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\socks.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\socks_gssapi.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\socks_sspi.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\speedcheck.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\splay.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ssh.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\sslgen.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ssluse.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strdup.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strequal.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strerror.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strtok.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strtoofft.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\telnet.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\tftp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\timeval.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\transfer.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\url.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\version.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\warnless.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\wildcard.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_binmode.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_bname.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_dbg.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_hdr.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_prg.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_rea.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_see.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_wrt.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cfgable.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_convert.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_dirhie.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_doswin.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_easysrc.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_formparse.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_getparam.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_getpass.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_help.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_helpers.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_homedir.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_hugehelp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_libinfo.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_main.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_metalink.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_mfiles.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_msgs.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_operate.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_operhlp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_panykey.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_paramhlp.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_parsecfg.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_setopt.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_sleep.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_urlglob.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_util.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_vms.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_writeenv.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_writeout.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_xattr.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\autofit\\autofit.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftbase.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftbbox.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftbitmap.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftfstype.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftgasp.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftglyph.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftgxval.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftinit.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftlcdfil.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftmm.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftotval.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftpatent.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftpfr.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftstroke.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftsynth.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftsystem.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\fttype1.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftwinfnt.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftxf86.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\bdf\\bdf.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\cache\\ftcache.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\cff\\cff.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\cid\\type1cid.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\ftdebug.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\gzip\\ftgzip.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\lzw\\ftlzw.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\pcf\\pcf.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\pfr\\pfr.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\psaux\\psaux.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\pshinter\\pshinter.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\psnames\\psmodule.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\raster\\raster.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\sfnt\\sfnt.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\smooth\\smooth.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\truetype\\truetype.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\type1\\type1.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\type42\\type42.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\winfonts\\winfnt.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\json_binary_parser.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\msg_pack_parser.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_alloc.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_buf.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_encode.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_gen.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_lex.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_parser.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_tree.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_version.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\minizip\\ioapi.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\minizip\\mztools.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\minizip\\unzip.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\sha1\\hash_sha1.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\SQLite\\sqlite3.c\" />\r\n    <ClCompile Include=\"..\\..\\libs\\utf8_converter\\utf8.c\" />\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBNodeVirtualDocument.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBScoreNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBSplineNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBSWFPlayer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBSystem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\AudioAsset.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CKLBAssetManager.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CKLBPropertyBag.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CKLBTexturePacker.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CompositeManagement.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\NodeAnimationAsset.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\TextureManagement.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBAppProperty.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBAsyncFilecopy.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBAsyncLoader.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBBinArray.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBContext.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBDataHandler.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBDebugger.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBGameApplication.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBGameApplicationDebugModule.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBGenericTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBIntervalTimer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLibRegistrator.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLifeCtrlTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLuaEnv.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLuaPropTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLuaTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBObject.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBPauseCtrl.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBTextTempBuffer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBUITask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBUtility.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CLuaState.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CPFInterface.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\DebugAlloc.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\DebugTracker.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\Dictionnary.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\encryptFile.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Core\\ITmpFile.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Database\\CKLBDatabase.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Database\\CKLBLanguageDatabase.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Database\\CKLBLuaDB.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Database\\DataSet_JSonDB.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBHTTPInterface.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBJsonItem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBNetAPI.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBNetAPIKeyChain.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBStoreService.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBUpdate.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CUnZip.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\MultithreadedNetwork.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaConst.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibAPP.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibASSET.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibBIN.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibCONV.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDATA.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDB.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDEBUG.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibENG.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibFONT.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibGL.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibHASH.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibKEY.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibLANG.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibMatrix.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibRES.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibSOUND.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibTASK.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibUI.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\ILuaFuncLib.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CBuffer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CFrame.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CImageBuffer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CIndexBuffer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CKLBCanvasSprite.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CKLBRenderingManager.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CKLBSprite3D.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CRenderingManager.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CRenderingManager_GL1.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CRenderingManager_GL2.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CShaderSet.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CShaderSetInstance.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CTexture.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CTextureBase.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CTextureUsage.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\glWrapper.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SceneGraph\\CKLBNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBGCTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBScriptEnv_forCpp.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBScriptEnv_forCSharp.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBScriptEnv_forLUA.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Sound\\CSoundAnalysis.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\Sound\\CSoundAnalysisMP3.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBDebugMenu.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBDeviceKeyEvent.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBDrawTask.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBLuaScript.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBOSCtrlEvent.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBTouchEventUI.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBTouchPad.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBActivityIndicatorNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBDragCallbackIF.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBFormGroup.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBFormIF.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBLabelNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBModalStack.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBMovieNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBNodeAnimPack.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrMgrDefault.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrMgrPage.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrMgrSolid.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrollBarIF.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBTextInputNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIActivityIndicator.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIButton.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUICanvas.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIClip.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIControl.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIDebugItem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIDragIcon.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIForm.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIFreeVertItem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIGroup.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUILabel.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIList.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIMoviePlayer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIMultiImgItem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIPieChart.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIPolyline.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIProgressBar.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIRubberBand.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIScale9.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIScore.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIScrollBar.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUISimpleItem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUISWFPlayer.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUISystem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUITextInput.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUITouchPad.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIVariableItem.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIVirtualDoc.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIWebArea.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBWebViewNode.cpp\" />\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\IMgrEntry.cpp\" />\r\n    <ClCompile Include=\"..\\dirent.c\" />\r\n    <ClCompile Include=\"..\\FileDelete.cpp\" />\r\n    <ClCompile Include=\"..\\FontRendering.cpp\" />\r\n    <ClCompile Include=\"assert.c\">\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">CompileAsC</CompileAs>\r\n      <CompileAs Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">CompileAsC</CompileAs>\r\n    </ClCompile>\r\n    <ClCompile Include=\"EngineStdReferenceOSS.cpp\" />\r\n    <ClCompile Include=\"GameLibraryWin32.cpp\" />\r\n    <ClCompile Include=\"Platform\\CSockReadStream.cpp\" />\r\n    <ClCompile Include=\"Platform\\CSockWriteStream.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32Audio.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32HttpStream.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32KeyChain.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32MP3.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32PathConv.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32Platform.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32ReadFileStream.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32TmpFile.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32Widget.cpp\" />\r\n    <ClCompile Include=\"Platform\\CWin32WriteFileStream.cpp\" />\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"res.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "Engine/porting/Win32/OSSGameLibraryWin32.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Rendering\">\r\n      <UniqueIdentifier>{191477fc-ce36-4230-8560-bd63e3c948e4}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\SceneGraph\">\r\n      <UniqueIdentifier>{f8bcf784-9896-4ff3-870c-d2c50e880f80}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Assets\">\r\n      <UniqueIdentifier>{2e2c5026-ce5b-435a-9f66-02fe68eeb687}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Rendering\\OpenGLWrapper\">\r\n      <UniqueIdentifier>{1826bcbc-029a-46a7-b49d-1fdfe6592ed2}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Platform\">\r\n      <UniqueIdentifier>{81d99951-9458-45ca-8d66-667016001819}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"SystemTask\">\r\n      <UniqueIdentifier>{6e322d91-3851-4846-9f9b-a0020317438a}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\">\r\n      <UniqueIdentifier>{5acf2361-4b34-47e0-b390-3be153298476}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\JSonParser\">\r\n      <UniqueIdentifier>{dd87aa6d-110f-4038-b78e-024b014d3e80}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\Lua\">\r\n      <UniqueIdentifier>{06d107af-9509-499b-9762-2300dada5922}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\SQLite\">\r\n      <UniqueIdentifier>{95f387ff-b949-43a0-831b-6b95b40e4be4}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Database\">\r\n      <UniqueIdentifier>{8fb1d4c5-f805-4242-8381-4f52d407d27e}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\LuaLib\">\r\n      <UniqueIdentifier>{d9a096af-eec3-4709-8053-b01c0b84bd1d}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\mp3lame\">\r\n      <UniqueIdentifier>{f58709a6-c3ca-4211-9337-2c01988d41a8}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\UISystem\">\r\n      <UniqueIdentifier>{7c6d1eca-4aa7-4a05-a63d-6528ba44a481}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\UISystem\\Elements\">\r\n      <UniqueIdentifier>{9537358f-4954-4412-b767-4b5ca32d2ccf}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\UISystem\\Task\">\r\n      <UniqueIdentifier>{a27f1a91-bae0-44f3-9c98-10d38378d733}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\UISystem\\ScrollMgr\">\r\n      <UniqueIdentifier>{4e2e668e-905a-41f8-bc93-908ddcefb29b}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\UtilTask\">\r\n      <UniqueIdentifier>{8365e9bf-6dae-42fc-864e-ff78583f1402}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\LuaLib\\Element\">\r\n      <UniqueIdentifier>{a6389dff-f319-4f33-adb2-82473966296f}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\LuaLib\\modules\">\r\n      <UniqueIdentifier>{e5ec6d1e-9a14-42a8-a7e2-0506215142d2}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"boot\">\r\n      <UniqueIdentifier>{32ce2d29-696a-4393-bc74-aa4a109387a1}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\SceneGraph\\Animation\">\r\n      <UniqueIdentifier>{479d592e-65ba-4efd-bc90-0f905eceddeb}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Network\">\r\n      <UniqueIdentifier>{b9f41e39-eb1a-4d86-919a-1215e9fe2274}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Network\\Element\">\r\n      <UniqueIdentifier>{f3224719-d252-4dd6-ab7b-3e7740486224}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Network\\Task\">\r\n      <UniqueIdentifier>{9f5f5749-ed18-4454-bca6-81e6a135628d}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\minizip\">\r\n      <UniqueIdentifier>{6c900c52-1fcf-46c6-9f7e-25b816b33bd6}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Scripting\">\r\n      <UniqueIdentifier>{29f2620d-a954-4b24-8f7d-23c9b9c53b9e}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Core\">\r\n      <UniqueIdentifier>{9c3d1702-4fb8-41bb-b582-3498f145662b}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\LibCurl\">\r\n      <UniqueIdentifier>{45dc69c1-9e00-43c4-8044-41d9a863e6f1}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\LibCurl\\Src\">\r\n      <UniqueIdentifier>{b19b49cf-8a93-4290-87ae-5a5f1a68603a}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\LibCurl\\lib\">\r\n      <UniqueIdentifier>{a088816b-559a-41ed-9d78-267e7c85ebdd}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"libs\\sha1\">\r\n      <UniqueIdentifier>{9bbe57f9-d7c4-4903-aa44-22a0551ecaaa}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\Rendering\\Font\">\r\n      <UniqueIdentifier>{052c5c2d-5ab4-4d1a-bec4-dfa3854f63f3}</UniqueIdentifier>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"ReadMe.txt\" />\r\n    <None Include=\"..\\..\\source\\Rendering\\shaderSource.inl\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </None>\r\n    <None Include=\"Playground.ico\">\r\n      <Filter>Resource Files</Filter>\r\n    </None>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"stdafx.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"targetver.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBAction.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBDebugger.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBObject.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBSWFPlayer.h\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\CKLBAsset.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\TextureManagement.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SceneGraph\\CKLBNode.h\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Rendering\\CKLBRendering.h\">\r\n      <Filter>Source Files\\Rendering</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\include\\BaseType.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\include\\FileSystem.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBSplineNode.h\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\AudioAsset.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\MapManagement.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\include\\CPFInterface.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CSockReadStream.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CSockWriteStream.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32Platform.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32PathConv.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32ReadFileStream.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\Win32FileLocation.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32WriteFileStream.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32Audio.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLuaTask.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CLuaState.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLuaEnv.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\DebugTracker.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBDrawTask.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBLuaScript.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBTouchPad.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_alloc.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_assert.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_buf.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_bytestack.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_encode.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_lex.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\yajl_parser.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_common.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_gen.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_parse.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\JSonParser\\api\\yajl_tree.h\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBScoreNode.h\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\yasper.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBDataHandler.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Animation\\CKLBNodeVirtualDocument.h\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLuaPropTask.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\NodeAnimationAsset.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBTouchEventUI.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\DebugAlloc.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UnitSystem\\UnitSystem.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32HttpStream.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\SQLite\\sqlite3.h\">\r\n      <Filter>libs\\SQLite</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\SQLite\\sqlite3ext.h\">\r\n      <Filter>libs\\SQLite</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Database\\CKLBDatabase.h\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBUtility.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\Projects\\WorldTest\\CWorldTask.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Database\\CKLBLuaDB.h\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBBinArray.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\llex.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\llimits.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lmem.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lobject.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lopcodes.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lparser.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lstate.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lstring.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ltable.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ltm.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lua.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lua.hpp\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\luaconf.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lualib.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lundump.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lvm.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lzio.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lapi.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lauxlib.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lcode.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lctype.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ldebug.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\ldo.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lfunc.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\lua\\lgc.h\">\r\n      <Filter>libs\\Lua</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32Widget.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\include\\OSWidget.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBDebugMenu.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBOSCtrlEvent.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Lame\\BladeMP3EncDLL.h\">\r\n      <Filter>libs\\mp3lame</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Lame\\lame.h\">\r\n      <Filter>libs\\mp3lame</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32MP3.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\CKLBTexturePacker.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32KeyChain.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Database\\CKLBLanguageDatabase.h\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Database\\DataSet.h\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Rendering\\CKLBCanvasSprite.h\">\r\n      <Filter>Source Files\\Rendering</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBTextTempBuffer.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Assets\\CKLBPropertyBag.h\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\IMgrEntry.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBDragCallbackIF.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBFormGroup.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBFormIF.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBModalStack.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBNodeAnimPack.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrollBarIF.h\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIWebArea.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUICanvas.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIClip.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIControl.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIDebugItem.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIDragIcon.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIForm.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIFreeVertItem.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIGroup.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUILabel.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIList.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIMoviePlayer.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIMultiImgItem.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIPieChart.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIPolyline.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIRubberBand.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUISimpleItem.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUITextInput.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIVariableItem.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrMgrDefault.h\">\r\n      <Filter>Source Files\\UISystem\\ScrollMgr</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrMgrPage.h\">\r\n      <Filter>Source Files\\UISystem\\ScrollMgr</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBScrMgrSolid.h\">\r\n      <Filter>Source Files\\UISystem\\ScrollMgr</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBNetAPIKeyChain.h\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBHTTPInterface.h\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBJsonItem.h\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBStoreService.h\">\r\n      <Filter>Source Files\\Network\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBPauseCtrl.h\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBGenericTask.h\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBIntervalTimer.h\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBLifeCtrlTask.h\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\ILuaFuncLib.h\">\r\n      <Filter>Source Files\\LuaLib\\Element</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaConst.h\">\r\n      <Filter>Source Files\\LuaLib\\Element</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibUI.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBAppProperty.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibAPP.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibASSET.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibBIN.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibCONV.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDATA.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDB.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDEBUG.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibENG.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibFONT.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibGL.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibKEY.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibLANG.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibMatrix.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibRES.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibSOUND.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibTASK.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"GameEngine.h\">\r\n      <Filter>boot</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"EngineStdReference.h\">\r\n      <Filter>boot</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBLabelNode.h\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBMovieNode.h\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBTextInputNode.h\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBWebViewNode.h\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUISystem.h\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBActivityIndicatorNode.h\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIActivityIndicator.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\ioapi.h\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\mztools.h\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\unzip.h\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\minizip\\crypt.h\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CUnZip.h\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\include\\ITmpFile.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\CWin32TmpFile.h\">\r\n      <Filter>Platform</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBUpdate.h\">\r\n      <Filter>Source Files\\Network\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\ArrayAllocator.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Core\\CKLBAsyncLoader.h\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\include\\CSoundAnalysis.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Sound\\CSoundAnalysisMP3.h\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\Scripting\\CKLBGCTask.h\">\r\n      <Filter>Source Files\\Scripting</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Platform\\KLBPlatformMetrics.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\libs\\sha1\\hash_sha1.h\">\r\n      <Filter>libs\\sha1</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibHASH.h\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\UISystem\\CKLBUIButton.h\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\SystemTask\\CKLBDeviceKeyEvent.h\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\source\\HTTP\\CKLBNetAPI.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBSystem.cpp\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBSWFPlayer.cpp\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBContext.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBDebugger.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBObject.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CKLBAssetManager.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\TextureManagement.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SceneGraph\\CKLBNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CKLBRenderingManager.cpp\">\r\n      <Filter>Source Files\\Rendering</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CBuffer.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CIndexBuffer.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CRenderingManager.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CRenderingManager_GL1.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CRenderingManager_GL2.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CShaderSet.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CShaderSetInstance.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CTexture.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CTextureBase.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CTextureUsage.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"stdafx.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"assert.c\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CPFInterface.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBSplineNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBTask.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\AudioAsset.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CSockReadStream.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CSockWriteStream.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32Platform.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32PathConv.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32ReadFileStream.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32WriteFileStream.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32Audio.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLuaTask.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CLuaState.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLuaEnv.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\DebugTracker.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBLuaScript.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBTouchPad.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBDrawTask.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_buf.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_encode.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_gen.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_lex.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_parser.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_tree.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_version.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\yajl_alloc.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBScoreNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBDataHandler.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Animation\\CKLBNodeVirtualDocument.cpp\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLuaPropTask.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CompositeManagement.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CImageBuffer.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CFrame.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\NodeAnimationAsset.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBTouchEventUI.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\DebugAlloc.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32HttpStream.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\SQLite\\sqlite3.c\">\r\n      <Filter>libs\\SQLite</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Database\\CKLBDatabase.cpp\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Database\\CKLBLuaDB.cpp\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBBinArray.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32Widget.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBDebugMenu.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBOSCtrlEvent.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32MP3.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CKLBTexturePacker.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32KeyChain.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\json_binary_parser.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\Dictionnary.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Database\\CKLBLanguageDatabase.cpp\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Database\\DataSet_JSonDB.cpp\">\r\n      <Filter>Source Files\\Database</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CKLBCanvasSprite.cpp\">\r\n      <Filter>Source Files\\Rendering</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBTextTempBuffer.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Assets\\CKLBPropertyBag.cpp\">\r\n      <Filter>Source Files\\Assets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBUITask.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBDragCallbackIF.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBFormGroup.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBFormIF.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBModalStack.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBNodeAnimPack.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrollBarIF.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\IMgrEntry.cpp\">\r\n      <Filter>Source Files\\UISystem\\Elements</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUICanvas.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIClip.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIControl.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIDebugItem.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIDragIcon.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIForm.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIFreeVertItem.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIGroup.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUILabel.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIList.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIMoviePlayer.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIMultiImgItem.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIPieChart.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIPolyline.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIProgressBar.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIRubberBand.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIScale9.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIScore.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIScrollBar.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUISimpleItem.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUISWFPlayer.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUITextInput.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUITouchPad.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIVariableItem.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIVirtualDoc.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIWebArea.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrMgrDefault.cpp\">\r\n      <Filter>Source Files\\UISystem\\ScrollMgr</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrMgrPage.cpp\">\r\n      <Filter>Source Files\\UISystem\\ScrollMgr</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBScrMgrSolid.cpp\">\r\n      <Filter>Source Files\\UISystem\\ScrollMgr</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBHTTPInterface.cpp\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBJsonItem.cpp\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBNetAPIKeyChain.cpp\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBStoreService.cpp\">\r\n      <Filter>Source Files\\Network\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBGenericTask.cpp\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBIntervalTimer.cpp\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLifeCtrlTask.cpp\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBPauseCtrl.cpp\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaConst.cpp\">\r\n      <Filter>Source Files\\LuaLib\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\ILuaFuncLib.cpp\">\r\n      <Filter>Source Files\\LuaLib\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBAppProperty.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibAPP.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibASSET.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibBIN.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibCONV.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDATA.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDB.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibDEBUG.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibENG.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibFONT.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibGL.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibKEY.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibLANG.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibMatrix.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibRES.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibSOUND.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibTASK.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibUI.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBLabelNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBMovieNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBTextInputNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBWebViewNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUISystem.cpp\">\r\n      <Filter>Source Files\\SceneGraph</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBActivityIndicatorNode.cpp\">\r\n      <Filter>Source Files\\SceneGraph\\Animation</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIActivityIndicator.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\minizip\\mztools.c\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\minizip\\unzip.c\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\minizip\\ioapi.c\">\r\n      <Filter>libs\\minizip</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CUnZip.cpp\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Platform\\CWin32TmpFile.cpp\">\r\n      <Filter>Platform</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBUpdate.cpp\">\r\n      <Filter>Source Files\\Network\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\ITmpFile.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBGameApplicationDebugModule.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBScriptEnv_forCSharp.cpp\">\r\n      <Filter>Source Files\\Scripting</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBScriptEnv_forLUA.cpp\">\r\n      <Filter>Source Files\\Scripting</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBLibRegistrator.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBAsyncLoader.cpp\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\glWrapper.cpp\">\r\n      <Filter>Source Files\\Rendering\\OpenGLWrapper</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Sound\\CSoundAnalysis.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Sound\\CSoundAnalysisMP3.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBScriptEnv_forCpp.cpp\">\r\n      <Filter>Source Files\\Scripting</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Scripting\\CKLBGCTask.cpp\">\r\n      <Filter>Source Files\\Scripting</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\encryptFile.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_easysrc.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_formparse.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_getparam.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_getpass.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_help.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_helpers.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_homedir.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_hugehelp.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_libinfo.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_main.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_metalink.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_mfiles.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_msgs.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_operate.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_operhlp.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_panykey.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_paramhlp.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_parsecfg.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_setopt.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_sleep.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_urlglob.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_util.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_vms.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_writeenv.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_writeout.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_xattr.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_binmode.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_bname.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_dbg.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_hdr.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_prg.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_rea.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_see.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cb_wrt.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_cfgable.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_convert.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_dirhie.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\src\\tool_doswin.c\">\r\n      <Filter>libs\\LibCurl\\Src</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\amigaos.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\asyn-ares.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\asyn-thread.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\axtls.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\base64.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\bundles.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\conncache.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\connect.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\content_encoding.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\cookie.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_addrinfo.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_darwinssl.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_fnmatch.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_gethostname.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_gssapi.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_memrchr.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_multibyte.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm_core.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm_msgs.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_ntlm_wb.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_rand.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_rtmp.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_sasl.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_schannel.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_sspi.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\curl_threads.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\cyassl.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\dict.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\easy.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\escape.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\file.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\fileinfo.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\formdata.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ftp.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ftplistparser.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\getenv.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\getinfo.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\gopher.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\gtls.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hash.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hmac.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostasyn.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostcheck.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostip.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostip4.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostip6.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\hostsyn.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_chunks.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_digest.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_negotiate.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_negotiate_sspi.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\http_proxy.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\idn_win32.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\if2ip.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\imap.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\inet_ntop.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\inet_pton.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\krb4.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\krb5.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ldap.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\llist.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\md4.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\md5.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\memdebug.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\mprintf.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\multi.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\netrc.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\non-ascii.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nonblock.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nss.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nwlib.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\nwos.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\openldap.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\parsedate.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\pingpong.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\polarssl.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\pop3.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\progress.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\qssl.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\rawstr.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\rtsp.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\security.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\select.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\sendf.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\share.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\slist.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\smtp.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\socks.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\socks_gssapi.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\socks_sspi.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\speedcheck.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\splay.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ssh.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\sslgen.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\ssluse.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strdup.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strequal.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strerror.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strtok.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\strtoofft.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\telnet.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\tftp.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\timeval.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\transfer.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\url.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\version.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\warnless.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\curl-7.29.0-minimal\\lib\\wildcard.c\">\r\n      <Filter>libs\\LibCurl\\lib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\MultithreadedNetwork.cpp\">\r\n      <Filter>Source Files\\Network\\Element</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBAsyncFilecopy.cpp\">\r\n      <Filter>Source Files\\UtilTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\sha1\\hash_sha1.c\">\r\n      <Filter>libs\\sha1</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\LuaLib\\CKLBLuaLibHASH.cpp\">\r\n      <Filter>Source Files\\LuaLib\\modules</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Rendering\\CKLBSprite3D.cpp\">\r\n      <Filter>Source Files\\Rendering</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\autofit\\autofit.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\bdf\\bdf.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\cff\\cff.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\FontRendering.cpp\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftbase.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftbbox.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftbitmap.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\cache\\ftcache.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\ftdebug.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftfstype.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftgasp.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftglyph.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftgxval.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\gzip\\ftgzip.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftinit.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftlcdfil.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\lzw\\ftlzw.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftmm.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftotval.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftpatent.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftpfr.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftstroke.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftsynth.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftsystem.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\fttype1.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftwinfnt.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\base\\ftxf86.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\pcf\\pcf.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\pfr\\pfr.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\psaux\\psaux.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\pshinter\\pshinter.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\psnames\\psmodule.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\raster\\raster.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\sfnt\\sfnt.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\smooth\\smooth.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\truetype\\truetype.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\type1\\type1.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\cid\\type1cid.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\type42\\type42.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\freeType\\src\\winfonts\\winfnt.c\">\r\n      <Filter>Source Files\\Rendering\\Font</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\JSonParser\\msg_pack_parser.c\">\r\n      <Filter>libs\\JSonParser</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBUtility.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\libs\\utf8_converter\\utf8.c\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\UISystem\\CKLBUIButton.cpp\">\r\n      <Filter>Source Files\\UISystem\\Task</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\SystemTask\\CKLBDeviceKeyEvent.cpp\">\r\n      <Filter>SystemTask</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\dirent.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\FileDelete.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"GameLibraryWin32.cpp\">\r\n      <Filter>boot</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\Core\\CKLBGameApplication.cpp\">\r\n      <Filter>Source Files\\Core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"EngineStdReferenceOSS.cpp\">\r\n      <Filter>boot</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\source\\HTTP\\CKLBNetAPI.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"res.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "Engine/porting/Win32/Output/Debug_CSharp/libs/lib/README.txt",
    "content": "This directory is directly used by Mono, this is why the folder tree cannot be modified."
  },
  {
    "path": "Engine/porting/Win32/Output/Debug_CSharp/mono.def",
    "content": "; file generated by create-windef.pl\r\nLIBRARY mono-2.0.dll\r\nEXPORTS\r\nmono_add_internal_call\r\nmono_aot_register_globals\r\nmono_aot_register_module\r\nmono_array_addr_with_size\r\nmono_array_class_get\r\nmono_array_clone\r\nmono_array_element_size\r\nmono_array_length\r\nmono_array_new\r\nmono_array_new_full\r\nmono_array_new_specific\r\nmono_assemblies_cleanup\r\nmono_assemblies_init\r\nmono_assembly_close\r\nmono_assembly_fill_assembly_name\r\nmono_assembly_foreach\r\nmono_assembly_get_assemblyref\r\nmono_assembly_get_image\r\nmono_assembly_get_main\r\nmono_assembly_get_object\r\nmono_assembly_getrootdir\r\nmono_assembly_invoke_load_hook\r\nmono_assembly_invoke_search_hook\r\nmono_assembly_load\r\nmono_assembly_load_from\r\nmono_assembly_load_from_full\r\nmono_assembly_load_full\r\nmono_assembly_load_module\r\nmono_assembly_load_reference\r\nmono_assembly_load_references\r\nmono_assembly_load_with_partial_name\r\nmono_assembly_loaded\r\nmono_assembly_loaded_full\r\nmono_assembly_name_free\r\nmono_assembly_name_get_culture\r\nmono_assembly_name_get_name\r\nmono_assembly_name_get_pubkeytoken\r\nmono_assembly_name_get_version\r\nmono_assembly_name_new\r\nmono_assembly_names_equal\r\nmono_assembly_open\r\nmono_assembly_open_full\r\nmono_assembly_set_main\r\nmono_assembly_setrootdir\r\nmono_bitset_alloc_size\r\nmono_bitset_clear\r\nmono_bitset_clear_all\r\nmono_bitset_clone\r\nmono_bitset_copyto\r\nmono_bitset_count\r\nmono_bitset_equal\r\nmono_bitset_find_first\r\nmono_bitset_find_first_unset\r\nmono_bitset_find_last\r\nmono_bitset_find_start\r\nmono_bitset_foreach\r\nmono_bitset_free\r\nmono_bitset_intersection\r\nmono_bitset_intersection_2\r\nmono_bitset_invert\r\nmono_bitset_mem_new\r\nmono_bitset_new\r\nmono_bitset_set\r\nmono_bitset_set_all\r\nmono_bitset_size\r\nmono_bitset_sub\r\nmono_bitset_test\r\nmono_bitset_test_bulk\r\nmono_bitset_union\r\nmono_bounded_array_class_get\r\nmono_breakpoint_clean_code\r\nmono_check_corlib_version\r\nmono_class_array_element_size\r\nmono_class_data_size\r\nmono_class_describe_statics\r\nmono_class_enum_basetype\r\nmono_class_from_generic_parameter\r\nmono_class_from_mono_type\r\nmono_class_from_name\r\nmono_class_from_name_case\r\nmono_class_from_typeref\r\nmono_class_get\r\nmono_class_get_byref_type\r\nmono_class_get_element_class\r\nmono_class_get_event_token\r\nmono_class_get_events\r\nmono_class_get_field\r\nmono_class_get_field_from_name\r\nmono_class_get_field_token\r\nmono_class_get_fields\r\nmono_class_get_flags\r\nmono_class_get_full\r\nmono_class_get_image\r\nmono_class_get_interfaces\r\nmono_class_get_method_from_name\r\nmono_class_get_method_from_name_flags\r\nmono_class_get_methods\r\nmono_class_get_name\r\nmono_class_get_namespace\r\nmono_class_get_nested_types\r\nmono_class_get_nesting_type\r\nmono_class_get_parent\r\nmono_class_get_properties\r\nmono_class_get_property_from_name\r\nmono_class_get_property_token\r\nmono_class_get_rank\r\nmono_class_get_type\r\nmono_class_get_type_token\r\nmono_class_inflate_generic_method\r\nmono_class_inflate_generic_type\r\nmono_class_init\r\nmono_class_instance_size\r\nmono_class_interface_offset\r\nmono_class_is_assignable_from\r\nmono_class_is_enum\r\nmono_class_is_subclass_of\r\nmono_class_is_valid_enum\r\nmono_class_is_valuetype\r\nmono_class_min_align\r\nmono_class_name_from_token\r\nmono_class_num_events\r\nmono_class_num_fields\r\nmono_class_num_methods\r\nmono_class_num_properties\r\nmono_class_value_size\r\nmono_class_vtable\r\nmono_cli_rva_image_map\r\nmono_code_manager_commit\r\nmono_code_manager_destroy\r\nmono_code_manager_foreach\r\nmono_code_manager_invalidate\r\nmono_code_manager_new\r\nmono_code_manager_new_dynamic\r\nmono_code_manager_reserve\r\nmono_code_manager_reserve_align\r\nmono_code_manager_set_read_only\r\nmono_code_manager_size\r\nmono_compile_method\r\nmono_config_cleanup\r\nmono_config_for_assembly\r\nmono_config_parse\r\nmono_config_parse_memory\r\nmono_config_string_for_assembly_file\r\nmono_context_get\r\nmono_context_get_desc\r\nmono_context_init\r\nmono_context_set\r\nmono_counters_cleanup\r\nmono_counters_dump\r\nmono_counters_enable\r\nmono_counters_register\r\nmono_custom_attrs_construct\r\nmono_custom_attrs_free\r\nmono_custom_attrs_from_assembly\r\nmono_custom_attrs_from_class\r\nmono_custom_attrs_from_event\r\nmono_custom_attrs_from_field\r\nmono_custom_attrs_from_index\r\nmono_custom_attrs_from_method\r\nmono_custom_attrs_from_param\r\nmono_custom_attrs_from_property\r\nmono_custom_attrs_get_attr\r\nmono_custom_attrs_has_attr\r\nmono_debug_add_delegate_trampoline\r\nmono_debug_add_method\r\nmono_debug_cleanup\r\nmono_debug_close_image\r\nmono_debug_close_mono_symbol_file\r\nmono_debug_domain_create\r\nmono_debug_domain_unload\r\nmono_debug_find_method\r\nmono_debug_free_method_jit_info\r\nmono_debug_free_source_location\r\nmono_debug_il_offset_from_address\r\nmono_debug_init\r\nmono_debug_list_add\r\nmono_debug_list_remove\r\nmono_debug_lookup_locals\r\nmono_debug_lookup_method\r\nmono_debug_lookup_method_addresses\r\nmono_debug_lookup_source_location\r\nmono_debug_open_image_from_memory\r\nmono_debug_open_mono_symbols\r\nmono_debug_print_stack_frame\r\nmono_debug_print_vars\r\nmono_debug_symfile_free_locals\r\nmono_debug_symfile_free_location\r\nmono_debug_symfile_get_line_numbers\r\nmono_debug_symfile_is_loaded\r\nmono_debug_symfile_lookup_locals\r\nmono_debug_symfile_lookup_location\r\nmono_debug_symfile_lookup_method\r\nmono_debug_using_mono_debugger\r\nmono_debugger_breakpoint_callback\r\nmono_debugger_call_exception_handler\r\nmono_debugger_check_breakpoints\r\nmono_debugger_check_interruption\r\nmono_debugger_check_runtime_version\r\nmono_debugger_class_initialized\r\nmono_debugger_cleanup\r\nmono_debugger_event\r\nmono_debugger_event_create_appdomain\r\nmono_debugger_event_unload_appdomain\r\nmono_debugger_extended_notification\r\nmono_debugger_handle_exception\r\nmono_debugger_initialize\r\nmono_debugger_insert_breakpoint\r\nmono_debugger_insert_breakpoint_full\r\nmono_debugger_insert_method_breakpoint\r\nmono_debugger_lock\r\nmono_debugger_method_has_breakpoint\r\nmono_debugger_register_class_init_callback\r\nmono_debugger_remove_breakpoint\r\nmono_debugger_remove_class_init_callback\r\nmono_debugger_remove_method_breakpoint\r\nmono_debugger_run_finally\r\nmono_debugger_thread_cleanup\r\nmono_debugger_thread_created\r\nmono_debugger_trampoline_compiled\r\nmono_debugger_unlock\r\nmono_declsec_flags_from_assembly\r\nmono_declsec_flags_from_class\r\nmono_declsec_flags_from_method\r\nmono_declsec_get_assembly_action\r\nmono_declsec_get_class_action\r\nmono_declsec_get_demands\r\nmono_declsec_get_inheritdemands_class\r\nmono_declsec_get_inheritdemands_method\r\nmono_declsec_get_linkdemands\r\nmono_declsec_get_method_action\r\nmono_digest_get_public_token\r\nmono_disasm_code\r\nmono_disasm_code_one\r\nmono_dl_fallback_register\r\nmono_dl_fallback_unregister\r\nmono_dllmap_insert\r\nmono_domain_add_class_static_data\r\nmono_domain_assembly_open\r\nmono_domain_create\r\nmono_domain_create_appdomain\r\nmono_domain_finalize\r\nmono_domain_foreach\r\nmono_domain_free\r\nmono_domain_from_appdomain\r\nmono_domain_get\r\nmono_domain_get_by_id\r\nmono_domain_get_id\r\nmono_domain_has_type_resolve\r\nmono_domain_is_unloading\r\nmono_domain_owns_vtable_slot\r\nmono_domain_set\r\nmono_domain_set_internal\r\nmono_domain_try_type_resolve\r\nmono_domain_try_unload\r\nmono_domain_unload\r\nmono_emit_native_call\r\nmono_environment_exitcode_get\r\nmono_environment_exitcode_set\r\nmono_error_cleanup\r\nmono_error_get_error_code\r\nmono_error_get_message\r\nmono_error_init\r\nmono_error_init_flags\r\nmono_error_ok\r\nmono_escape_uri_string\r\nmono_event_get_add_method\r\nmono_event_get_flags\r\nmono_event_get_name\r\nmono_event_get_object\r\nmono_event_get_parent\r\nmono_event_get_raise_method\r\nmono_event_get_remove_method\r\nmono_exception_from_name\r\nmono_exception_from_name_domain\r\nmono_exception_from_name_msg\r\nmono_exception_from_name_two_strings\r\nmono_exception_from_token\r\nmono_exception_from_token_two_strings\r\nmono_field_from_token\r\nmono_field_full_name\r\nmono_field_get_data\r\nmono_field_get_flags\r\nmono_field_get_name\r\nmono_field_get_object\r\nmono_field_get_offset\r\nmono_field_get_parent\r\nmono_field_get_type\r\nmono_field_get_value\r\nmono_field_get_value_object\r\nmono_field_set_value\r\nmono_field_static_get_value\r\nmono_field_static_set_value\r\nmono_file_map\r\nmono_file_map_close\r\nmono_file_map_fd\r\nmono_file_map_open\r\nmono_file_map_size\r\nmono_file_unmap\r\nmono_free\r\nmono_free_bstr\r\nmono_free_method\r\nmono_free_verify_list\r\nmono_g_hash_table_destroy\r\nmono_g_hash_table_find\r\nmono_g_hash_table_foreach\r\nmono_g_hash_table_foreach_remove\r\nmono_g_hash_table_insert\r\nmono_g_hash_table_lookup\r\nmono_g_hash_table_lookup_extended\r\nmono_g_hash_table_new\r\nmono_g_hash_table_new_full\r\nmono_g_hash_table_new_type\r\nmono_g_hash_table_print_stats\r\nmono_g_hash_table_remove\r\nmono_g_hash_table_replace\r\nmono_g_hash_table_size\r\nmono_gc_collect\r\nmono_gc_collection_count\r\nmono_gc_enable_events\r\nmono_gc_get_generation\r\nmono_gc_get_heap_size\r\nmono_gc_get_used_size\r\nmono_gc_invoke_finalizers\r\nmono_gc_is_finalizer_thread\r\nmono_gc_max_generation\r\nmono_gc_out_of_memory\r\nmono_gc_walk_heap\r\nmono_gc_wbarrier_arrayref_copy\r\nmono_gc_wbarrier_generic_nostore\r\nmono_gc_wbarrier_generic_store\r\nmono_gc_wbarrier_object_copy\r\nmono_gc_wbarrier_set_arrayref\r\nmono_gc_wbarrier_set_field\r\nmono_gc_wbarrier_value_copy\r\nmono_gchandle_free\r\nmono_gchandle_get_target\r\nmono_gchandle_new\r\nmono_gchandle_new_weakref\r\nmono_get_array_class\r\nmono_get_boolean_class\r\nmono_get_byte_class\r\nmono_get_char_class\r\nmono_get_config_dir\r\nmono_get_corlib\r\nmono_get_dbnull_object\r\nmono_get_delegate_invoke\r\nmono_get_double_class\r\nmono_get_enum_class\r\nmono_get_exception_appdomain_unloaded\r\nmono_get_exception_argument\r\nmono_get_exception_argument_null\r\nmono_get_exception_argument_out_of_range\r\nmono_get_exception_arithmetic\r\nmono_get_exception_array_type_mismatch\r\nmono_get_exception_bad_image_format\r\nmono_get_exception_bad_image_format2\r\nmono_get_exception_cannot_unload_appdomain\r\nmono_get_exception_class\r\nmono_get_exception_divide_by_zero\r\nmono_get_exception_execution_engine\r\nmono_get_exception_field_access\r\nmono_get_exception_file_not_found\r\nmono_get_exception_file_not_found2\r\nmono_get_exception_index_out_of_range\r\nmono_get_exception_invalid_cast\r\nmono_get_exception_invalid_operation\r\nmono_get_exception_io\r\nmono_get_exception_method_access\r\nmono_get_exception_missing_field\r\nmono_get_exception_missing_method\r\nmono_get_exception_not_implemented\r\nmono_get_exception_not_supported\r\nmono_get_exception_null_reference\r\nmono_get_exception_out_of_memory\r\nmono_get_exception_overflow\r\nmono_get_exception_reflection_type_load\r\nmono_get_exception_runtime_wrapped\r\nmono_get_exception_security\r\nmono_get_exception_serialization\r\nmono_get_exception_stack_overflow\r\nmono_get_exception_synchronization_lock\r\nmono_get_exception_thread_abort\r\nmono_get_exception_thread_interrupted\r\nmono_get_exception_thread_state\r\nmono_get_exception_type_initialization\r\nmono_get_exception_type_load\r\nmono_get_inflated_method\r\nmono_get_int16_class\r\nmono_get_int32_class\r\nmono_get_int64_class\r\nmono_get_intptr_class\r\nmono_get_machine_config\r\nmono_get_method\r\nmono_get_method_constrained\r\nmono_get_method_full\r\nmono_get_object_class\r\nmono_get_root_domain\r\nmono_get_sbyte_class\r\nmono_get_single_class\r\nmono_get_string_class\r\nmono_get_thread_class\r\nmono_get_trampoline_func\r\nmono_get_uint16_class\r\nmono_get_uint32_class\r\nmono_get_uint64_class\r\nmono_get_uintptr_class\r\nmono_get_void_class\r\nmono_guid_to_string\r\nmono_image_add_to_name_cache\r\nmono_image_addref\r\nmono_image_close\r\nmono_image_ensure_section\r\nmono_image_ensure_section_idx\r\nmono_image_fixup_vtable\r\nmono_image_get_assembly\r\nmono_image_get_entry_point\r\nmono_image_get_filename\r\nmono_image_get_guid\r\nmono_image_get_name\r\nmono_image_get_public_key\r\nmono_image_get_resource\r\nmono_image_get_strong_name\r\nmono_image_get_table_info\r\nmono_image_get_table_rows\r\nmono_image_has_authenticode_entry\r\nmono_image_init\r\nmono_image_init_name_cache\r\nmono_image_is_dynamic\r\nmono_image_load_file_for_image\r\nmono_image_load_module\r\nmono_image_loaded\r\nmono_image_loaded_by_guid\r\nmono_image_loaded_by_guid_full\r\nmono_image_loaded_full\r\nmono_image_lookup_resource\r\nmono_image_open\r\nmono_image_open_from_data\r\nmono_image_open_from_data_full\r\nmono_image_open_from_data_with_name\r\nmono_image_open_full\r\nmono_image_rva_map\r\nmono_image_strerror\r\nmono_image_strong_name_position\r\nmono_images_cleanup\r\nmono_images_init\r\nmono_init\r\nmono_init_from_assembly\r\nmono_init_version\r\nmono_inst_name\r\nmono_install_assembly_load_hook\r\nmono_install_assembly_postload_refonly_search_hook\r\nmono_install_assembly_postload_search_hook\r\nmono_install_assembly_preload_hook\r\nmono_install_assembly_refonly_preload_hook\r\nmono_install_assembly_refonly_search_hook\r\nmono_install_assembly_search_hook\r\nmono_install_runtime_cleanup\r\nmono_install_threadpool_item_hooks\r\nmono_install_threadpool_thread_hooks\r\nmono_is_debugger_attached\r\nmono_jit_cleanup\r\nmono_jit_exec\r\nmono_jit_info_get_code_size\r\nmono_jit_info_get_code_start\r\nmono_jit_info_get_method\r\nmono_jit_info_table_find\r\nmono_jit_init\r\nmono_jit_init_version\r\nmono_jit_parse_options\r\nmono_jit_set_aot_only\r\nmono_jit_set_trace_options\r\nmono_jit_thread_attach\r\nmono_ldstr\r\nmono_ldtoken\r\nmono_load_remote_field\r\nmono_load_remote_field_new\r\nmono_local_deadce\r\nmono_locks_dump\r\nmono_lookup_internal_call\r\nmono_lookup_pinvoke_call\r\nmono_main\r\nmono_marshal_string_to_utf16\r\nmono_md5_final\r\nmono_md5_get_digest\r\nmono_md5_get_digest_from_file\r\nmono_md5_init\r\nmono_md5_update\r\nmono_mempool_alloc\r\nmono_mempool_alloc0\r\nmono_mempool_contains_addr\r\nmono_mempool_destroy\r\nmono_mempool_empty\r\nmono_mempool_get_allocated\r\nmono_mempool_invalidate\r\nmono_mempool_new\r\nmono_mempool_new_size\r\nmono_mempool_stats\r\nmono_mempool_strdup\r\nmono_metadata_blob_heap\r\nmono_metadata_cleanup\r\nmono_metadata_compute_size\r\nmono_metadata_custom_attrs_from_index\r\nmono_metadata_declsec_from_index\r\nmono_metadata_decode_blob_size\r\nmono_metadata_decode_row\r\nmono_metadata_decode_row_col\r\nmono_metadata_decode_signed_value\r\nmono_metadata_decode_table_row\r\nmono_metadata_decode_table_row_col\r\nmono_metadata_decode_value\r\nmono_metadata_encode_value\r\nmono_metadata_events_from_typedef\r\nmono_metadata_field_info\r\nmono_metadata_field_info_with_mempool\r\nmono_metadata_free_array\r\nmono_metadata_free_inflated_signature\r\nmono_metadata_free_marshal_spec\r\nmono_metadata_free_method_signature\r\nmono_metadata_free_mh\r\nmono_metadata_free_type\r\nmono_metadata_generic_class_is_valuetype\r\nmono_metadata_get_constant_index\r\nmono_metadata_get_generic_param_row\r\nmono_metadata_get_inflated_signature\r\nmono_metadata_get_marshal_info\r\nmono_metadata_guid_heap\r\nmono_metadata_implmap_from_method\r\nmono_metadata_init\r\nmono_metadata_interfaces_from_typedef\r\nmono_metadata_load_generic_param_constraints\r\nmono_metadata_load_generic_params\r\nmono_metadata_locate\r\nmono_metadata_locate_token\r\nmono_metadata_methods_from_event\r\nmono_metadata_methods_from_property\r\nmono_metadata_nested_in_typedef\r\nmono_metadata_nesting_typedef\r\nmono_metadata_packing_from_typedef\r\nmono_metadata_parse_array\r\nmono_metadata_parse_custom_mod\r\nmono_metadata_parse_field_type\r\nmono_metadata_parse_marshal_spec\r\nmono_metadata_parse_method_signature\r\nmono_metadata_parse_method_signature_full\r\nmono_metadata_parse_mh\r\nmono_metadata_parse_mh_full\r\nmono_metadata_parse_param\r\nmono_metadata_parse_signature\r\nmono_metadata_parse_type\r\nmono_metadata_parse_type_full\r\nmono_metadata_parse_typedef_or_ref\r\nmono_metadata_properties_from_typedef\r\nmono_metadata_signature_alloc\r\nmono_metadata_signature_dup\r\nmono_metadata_signature_equal\r\nmono_metadata_string_heap\r\nmono_metadata_token_from_dor\r\nmono_metadata_translate_token_index\r\nmono_metadata_type_equal\r\nmono_metadata_type_hash\r\nmono_metadata_typedef_from_field\r\nmono_metadata_typedef_from_method\r\nmono_metadata_user_string\r\nmono_method_body_get_object\r\nmono_method_can_access_field\r\nmono_method_can_access_method\r\nmono_method_desc_free\r\nmono_method_desc_from_method\r\nmono_method_desc_full_match\r\nmono_method_desc_match\r\nmono_method_desc_new\r\nmono_method_desc_search_in_class\r\nmono_method_desc_search_in_image\r\nmono_method_full_name\r\nmono_method_get_class\r\nmono_method_get_flags\r\nmono_method_get_generic_container\r\nmono_method_get_header\r\nmono_method_get_index\r\nmono_method_get_last_managed\r\nmono_method_get_marshal_info\r\nmono_method_get_name\r\nmono_method_get_object\r\nmono_method_get_param_names\r\nmono_method_get_param_token\r\nmono_method_get_signature\r\nmono_method_get_signature_full\r\nmono_method_get_token\r\nmono_method_get_unmanaged_thunk\r\nmono_method_has_marshal_info\r\nmono_method_header_get_clauses\r\nmono_method_header_get_code\r\nmono_method_header_get_locals\r\nmono_method_header_get_num_clauses\r\nmono_method_signature\r\nmono_method_verify\r\nmono_mlist_alloc\r\nmono_mlist_append\r\nmono_mlist_get_data\r\nmono_mlist_last\r\nmono_mlist_length\r\nmono_mlist_next\r\nmono_mlist_prepend\r\nmono_mlist_remove_item\r\nmono_mlist_set_data\r\nmono_mlist_set_next\r\nmono_module_file_get_object\r\nmono_module_get_object\r\nmono_monitor_enter\r\nmono_monitor_exit\r\nmono_monitor_try_enter\r\nmono_mprotect\r\nmono_object_castclass_mbyref\r\nmono_object_castclass_with_cache\r\nmono_object_clone\r\nmono_object_describe\r\nmono_object_describe_fields\r\nmono_object_get_class\r\nmono_object_get_domain\r\nmono_object_get_size\r\nmono_object_get_virtual_method\r\nmono_object_hash\r\nmono_object_is_alive\r\nmono_object_isinst\r\nmono_object_isinst_mbyref\r\nmono_object_isinst_with_cache\r\nmono_object_new\r\nmono_object_new_alloc_specific\r\nmono_object_new_fast\r\nmono_object_new_from_token\r\nmono_object_new_specific\r\nmono_object_to_string\r\nmono_object_unbox\r\nmono_op_to_op_imm_noemul\r\nmono_opcode_name\r\nmono_opcode_value\r\nmono_pagesize\r\nmono_param_get_objects\r\nmono_parse_default_optimizations\r\nmono_path_canonicalize\r\nmono_path_resolve_symlinks\r\nmono_pe_file_open\r\nmono_perfcounters_init\r\nmono_pmip\r\nmono_poll\r\nmono_print_method_from_ip\r\nmono_print_thread_dump\r\nmono_print_thread_dump_from_ctx\r\nmono_print_unhandled_exception\r\nmono_profiler_coverage_get\r\nmono_profiler_get_events\r\nmono_profiler_install\r\nmono_profiler_install_allocation\r\nmono_profiler_install_appdomain\r\nmono_profiler_install_assembly\r\nmono_profiler_install_class\r\nmono_profiler_install_code_buffer_new\r\nmono_profiler_install_code_chunk_destroy\r\nmono_profiler_install_code_chunk_new\r\nmono_profiler_install_coverage_filter\r\nmono_profiler_install_enter_leave\r\nmono_profiler_install_exception\r\nmono_profiler_install_gc\r\nmono_profiler_install_gc_moves\r\nmono_profiler_install_gc_roots\r\nmono_profiler_install_iomap\r\nmono_profiler_install_jit_compile\r\nmono_profiler_install_jit_end\r\nmono_profiler_install_method_free\r\nmono_profiler_install_method_invoke\r\nmono_profiler_install_module\r\nmono_profiler_install_monitor\r\nmono_profiler_install_runtime_initialized\r\nmono_profiler_install_statistical\r\nmono_profiler_install_statistical_call_chain\r\nmono_profiler_install_thread\r\nmono_profiler_install_thread_name\r\nmono_profiler_install_transition\r\nmono_profiler_load\r\nmono_profiler_set_events\r\nmono_property_get_flags\r\nmono_property_get_get_method\r\nmono_property_get_name\r\nmono_property_get_object\r\nmono_property_get_parent\r\nmono_property_get_set_method\r\nmono_property_get_value\r\nmono_property_hash_destroy\r\nmono_property_hash_insert\r\nmono_property_hash_lookup\r\nmono_property_hash_new\r\nmono_property_hash_remove_object\r\nmono_property_set_value\r\nmono_ptr_class_get\r\nmono_raise_exception\r\nmono_realloc_native_code\r\nmono_reflection_free_type_info\r\nmono_reflection_get_custom_attrs\r\nmono_reflection_get_custom_attrs_blob\r\nmono_reflection_get_custom_attrs_by_type\r\nmono_reflection_get_custom_attrs_data\r\nmono_reflection_get_custom_attrs_info\r\nmono_reflection_get_token\r\nmono_reflection_get_type\r\nmono_reflection_parse_type\r\nmono_reflection_type_from_name\r\nmono_register_bundled_assemblies\r\nmono_register_config_for_assembly\r\nmono_register_machine_config\r\nmono_register_symfile_for_assembly\r\nmono_replace_ins\r\nmono_runtime_class_init\r\nmono_runtime_cleanup\r\nmono_runtime_delegate_invoke\r\nmono_runtime_exec_main\r\nmono_runtime_exec_managed_code\r\nmono_runtime_get_main_args\r\nmono_runtime_init\r\nmono_runtime_invoke\r\nmono_runtime_invoke_array\r\nmono_runtime_is_shutting_down\r\nmono_runtime_object_init\r\nmono_runtime_quit\r\nmono_runtime_run_main\r\nmono_runtime_set_shutting_down\r\nmono_security_core_clr_require_elevated_permissions\r\nmono_security_enable_core_clr\r\nmono_security_set_core_clr_platform_callback\r\nmono_sem_post\r\nmono_sem_timedwait\r\nmono_sem_wait\r\nmono_set_assemblies_path\r\nmono_set_break_policy\r\nmono_set_config_dir\r\nmono_set_defaults\r\nmono_set_dirs\r\nmono_set_is_debugger_attached\r\nmono_set_rootdir\r\nmono_set_signal_chaining\r\nmono_sha1_final\r\nmono_sha1_get_digest\r\nmono_sha1_get_digest_from_file\r\nmono_sha1_init\r\nmono_sha1_update\r\nmono_shared_area\r\nmono_shared_area_for_pid\r\nmono_shared_area_instances\r\nmono_shared_area_remove\r\nmono_shared_area_unload\r\nmono_signature_explicit_this\r\nmono_signature_get_call_conv\r\nmono_signature_get_desc\r\nmono_signature_get_param_count\r\nmono_signature_get_params\r\nmono_signature_get_return_type\r\nmono_signature_hash\r\nmono_signature_is_instance\r\nmono_signature_vararg_start\r\nmono_signbit_double\r\nmono_signbit_float\r\nmono_stack_walk\r\nmono_stack_walk_no_il\r\nmono_store_remote_field\r\nmono_store_remote_field_new\r\nmono_string_chars\r\nmono_string_equal\r\nmono_string_from_bstr\r\nmono_string_from_utf16\r\nmono_string_hash\r\nmono_string_intern\r\nmono_string_is_interned\r\nmono_string_length\r\nmono_string_new\r\nmono_string_new_len\r\nmono_string_new_size\r\nmono_string_new_utf16\r\nmono_string_new_wrapper\r\nmono_string_to_utf16\r\nmono_string_to_utf8\r\nmono_string_to_utf8_checked\r\nmono_stringify_assembly_name\r\nmono_table_info_get_rows\r\nmono_thread_attach\r\nmono_thread_cleanup\r\nmono_thread_create\r\nmono_thread_current\r\nmono_thread_detach\r\nmono_thread_exit\r\nmono_thread_get_main\r\nmono_thread_get_undeniable_exception\r\nmono_thread_init\r\nmono_thread_manage\r\nmono_thread_new_init\r\nmono_thread_set_main\r\nmono_thread_set_manage_callback\r\nmono_thread_stop\r\nmono_threads_get_default_stacksize\r\nmono_threads_request_thread_dump\r\nmono_threads_set_default_stacksize\r\nmono_trace_set_level_string\r\nmono_trace_set_mask_string\r\nmono_type_create_from_typespec\r\nmono_type_full_name\r\nmono_type_generic_inst_is_valuetype\r\nmono_type_get_array_type\r\nmono_type_get_class\r\nmono_type_get_desc\r\nmono_type_get_modifiers\r\nmono_type_get_name\r\nmono_type_get_object\r\nmono_type_get_ptr_type\r\nmono_type_get_signature\r\nmono_type_get_type\r\nmono_type_get_underlying_type\r\nmono_type_is_byref\r\nmono_type_is_pointer\r\nmono_type_is_reference\r\nmono_type_is_struct\r\nmono_type_is_valid_enum_basetype\r\nmono_type_is_void\r\nmono_type_size\r\nmono_type_stack_size\r\nmono_type_to_unmanaged\r\nmono_unhandled_exception\r\nmono_unicode_from_external\r\nmono_unicode_to_external\r\nmono_upgrade_remote_class_wrapper\r\nmono_utf8_from_external\r\nmono_utf8_validate_and_len\r\nmono_utf8_validate_and_len_with_bounds\r\nmono_valloc\r\nmono_value_box\r\nmono_value_copy\r\nmono_value_copy_array\r\nmono_value_describe_fields\r\nmono_verify_corlib\r\nmono_vfree\r\nmono_vtable_get_static_field_data\r\nmono_win32_compat_CopyMemory\r\nmono_win32_compat_FillMemory\r\nmono_win32_compat_MoveMemory\r\nmono_win32_compat_ZeroMemory\r\nmono_xdebug_flush"
  },
  {
    "path": "Engine/porting/Win32/Platform/CSockReadStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockReadStream.cpp\r\n//\r\n#include <Windows.h>\r\n#include <WinSock.h>\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <errno.h>\r\n#include <iostream>\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CSockReadStream.h\"\r\n#include \"CSockWriteStream.h\"\r\n\r\n\r\nCSockReadStream::CSockReadStream() : m_writeStream(0), m_eStat(NORMAL), m_fd(0), m_lastPos(0), m_getPos(0) {}\r\nCSockReadStream::~CSockReadStream()\r\n{\r\n    // 生成時に作成した書き込み用ストリームオブジェクトを破棄\r\n    if(m_writeStream) delete m_writeStream;\r\n    // 破棄時にソケットをクローズする\r\n    if(m_fd) closesocket(m_fd);    \r\n}\r\n\r\n/*!\r\n \\param  hostname   IPアドレス表記またはFQDN表記のホスト指定\r\n \\param  port       接続する TCP/IP の port 番号\r\n\r\n \\return 接続成功ならば true, 失敗すれば false\r\n */\r\nint\r\nCSockReadStream::sock_connect(const char *hostname, int port)\r\n{\r\n    int dstSocket;\r\n    struct sockaddr_in dstAddr;\r\n\r\n    m_fd = 0;\r\n    memset(&dstAddr, 0, sizeof(dstAddr));\r\n    dstAddr.sin_port = htons((u16)port);\r\n    dstAddr.sin_family = AF_INET;\r\n    //dstAddr.sin_addr.s_addr = inet_addr(hostname);\r\n\tdstAddr.sin_addr.S_un.S_addr = inet_addr(hostname);\r\n\r\n    if(dstAddr.sin_addr.S_un.S_addr == 0xffffffff) {\r\n        struct hostent *host;\r\n        host = gethostbyname(hostname);\r\n        if(!host) return -1;\r\n        dstAddr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0];\r\n    }\r\n    dstSocket = socket(AF_INET, SOCK_STREAM, 0);\r\n\r\n    if(0 > connect(dstSocket, (struct sockaddr *)&dstAddr, sizeof(dstAddr))) {\r\n\t\tclosesocket(dstSocket);\t// クローズを忘れるとディスクリプタを食いつぶす\r\n        return -1;\r\n\t}\r\n\r\n    // 取得したディスクリプタは、ノンブロックモードにて運用する。\r\n    //int flags = fcntl(dstSocket, F_GETFL, 0);\r\n    //fcntl(dstSocket, F_SETFL, flags | O_NONBLOCK);\r\n\tu_long val = 1;\r\n\tioctlsocket(dstSocket, FIONBIO, &val);\r\n\r\n    return dstSocket;\r\n}\r\n\r\nbool\r\nCSockReadStream::setStatus()\r\n{\r\n\tint result = WSAGetLastError();\r\n    switch(result)\r\n    {\r\n        default:\r\n\t\t\tm_eStat = CLOSED;\r\n\t\t\tif(m_fd > 0) {\r\n\t\t\t\tclosesocket(m_fd);\r\n\t\t\t\tm_fd = 0;\r\n\t\t\t}\r\n            CPFInterface::getInstance().platform().logging(\"errno = %d\", errno);\r\n            break;\r\n        case WSAEWOULDBLOCK:\r\n            m_eStat = NOT_AVAILABLE;\r\n      //      CPFInterface::getInstance().platform().logging(\"errno = EAGAIN\");\r\n            break;\r\n        case WSAETIMEDOUT:\r\n            m_eStat = CLOSED;\r\n            if(m_fd > 0) {\r\n                closesocket(m_fd);\r\n                m_fd = 0;\r\n            }\r\n            CPFInterface::getInstance().platform().logging(\"errno = ETIMEDOUT\");\r\n            break;\r\n    }\r\n    return false;   // 必ず false を返す\r\n}\r\n/*!\r\n \\return  リングバッファ読み込みが正常終了していれば true, 失敗ならば false\r\n \r\n 受信データをリングバッファに蓄積します。\r\n */\r\nbool\r\nCSockReadStream::readRingBuf()\r\n{\r\n    if((m_lastPos > m_getPos) && (m_lastPos < READ_BUFSIZ)) {\r\n        int result = recv(m_fd, (char *)m_readBuf + m_lastPos, READ_BUFSIZ - m_lastPos, 0);\r\n        if(result < 0) { return false; }\r\n        m_lastPos += result;\r\n    }\r\n    if((m_lastPos == READ_BUFSIZ) && (m_getPos > 0)) {\r\n        int result = recv(m_fd, (char *)m_readBuf, m_getPos, 0);\r\n        if(result < 0) { return false; }\r\n        if(result > 0) { m_lastPos = result; }\r\n    } else if(m_lastPos < m_getPos) {\r\n\t\tint result = recv(m_fd, (char *)m_readBuf + m_lastPos, m_getPos - m_lastPos, 0);\r\n        if(result < 0) { return false; }\r\n        m_lastPos += result;\r\n    } else if(m_getPos == 0 && m_lastPos == 0) {\r\n        // バッファが完全に空の状態\r\n        int result = recv(m_fd, (char *)m_readBuf, READ_BUFSIZ, 0);\r\n        if(result < 0) { return false; }\r\n        m_lastPos += result;\r\n    }\r\n\t// m_lastPos == m_getPos && m_lastPos > 0 のときはバッファがいっぱい\r\n\t// m_lastPos == READ_BUFSIZE && m_getPos == 0 のときも同様\r\n\r\n    return true;\r\n}\r\n\r\n\r\n/*!\r\n \\param buf     データを受け取るバッファ\r\n \\param size    要求サイズ\r\n\r\n 読み込みバッファを経由して、指定サイズのデータを取得する。\r\n ネットワークの読み込みが追いつかない場合、読み込みポインタが更新されない。\r\n */\r\nbool\r\nCSockReadStream::requestData(unsigned char * buf, size_t reqSize)\r\n{\r\n    // 最初にステータスを NORMAL にする。途中で問題があれば書きかわる。\r\n    // 正常系を通れば問題なくNORMALを維持できる。\r\n    m_eStat = NORMAL;\r\n\r\n    // リングバッファへの読み込みを試みる。\r\n    if(!readRingBuf()) {\r\n\t\tsetStatus();\r\n\t}\r\n\r\n    // リングバッファの残りサイズが要求サイズ以上であるか確認し、サイズが足りなければ false を返す。\r\n    size_t leftSize = left_size();\r\n    if(!reqSize || leftSize < reqSize) {\r\n        // m_eStat = NOT_AVAILABLE;\r\n        return false;\r\n    }\r\n    // リングバッファから指定のバッファに指定サイズを転送する\r\n    int rdsiz = ((size_t)(READ_BUFSIZ - m_getPos) >= reqSize) ? reqSize : (READ_BUFSIZ - m_getPos);\r\n    memcpy(buf, m_readBuf + m_getPos, rdsiz);\r\n    m_getPos += rdsiz;\r\n    if(m_getPos == READ_BUFSIZ) {\r\n\t\tm_getPos = 0;\r\n        if(m_lastPos == READ_BUFSIZ) { m_lastPos = 0; }\r\n\t}\r\n    if(0 < (reqSize - rdsiz)) {\r\n        memcpy(buf + rdsiz, m_readBuf, reqSize - rdsiz);\r\n        m_getPos += reqSize - rdsiz;\r\n    }\r\n\r\n    // 読み込み済みデータに追いついたら、一旦バッファを仕切り直す。\r\n    if(m_lastPos == m_getPos) { m_lastPos = m_getPos = 0; }\r\n    \r\n    return true;\r\n}\r\n\r\nCSockReadStream *\r\nCSockReadStream::openStream(const char * sockName)\r\n{\r\n    char * strHost = NULL;\r\n    char * strPort = NULL;\r\n    CSockReadStream * pStream = NULL;\r\n    try {\r\n        pStream = new CSockReadStream();\r\n\r\n        // 渡されたホスト:portを分解する\r\n        for(int i = 0; sockName[i]; i++) {\r\n            if(sockName[i] == ':') {\r\n                strHost = new char [ i + 1 ];\r\n                strncpy(strHost, sockName, i);\r\n                strHost[i] = 0;\r\n                int plen = strlen(sockName + i + 1);\r\n                strPort = new char [ plen + 1 ];\r\n                strcpy(strPort, sockName + i + 1);\r\n                break;\r\n            }\r\n        }\r\n        if(!strHost || !strPort) {\r\n            // 与えられた名称の書式が不正\r\n            pStream->m_eStat = NOT_FOUND;\r\n            if( strPort ) { delete [] strPort; }\r\n\t\t\tif( strHost ) { delete [] strHost; }\r\n            return pStream;\r\n        }\r\n\r\n        // port を数値に変換する。\r\n        // 数列であることを確認。\r\n        for(int i = 0; strPort[i]; i++) {\r\n            if(strPort[i] < '0' || strPort[i] > '9') {\r\n                // 数字以外が含まれている場合は接続先指定として不正\r\n                pStream->m_eStat = NOT_FOUND;\r\n                if( strPort ) { delete [] strPort; }\r\n\t\t\t\tif( strHost ) { delete [] strHost; }\r\n                return pStream;\r\n            }\r\n        }\r\n        // 特に問題ないので、port を数値に変換する\r\n        int port = atoi(strPort);\r\n\r\n        // 接続を試みる\r\n        int fd = pStream->sock_connect(strHost, port);\r\n        if(fd < 0) {\r\n            // 接続に失敗した場合\r\n            pStream->m_eStat = NOT_FOUND;\r\n            if( strPort ) { delete [] strPort; }\r\n\t\t\tif( strHost ) { delete [] strHost; }\r\n            return pStream;\r\n        }\r\n        pStream->m_fd = fd;\r\n        // 同時に書き込み用クラスを生成\r\n        pStream->m_writeStream = new CSockWriteStream(*pStream);\r\n\r\n        pStream->m_eStat = NORMAL;\r\n        \r\n    } catch(...) {\r\n        if( strPort ) { delete [] strPort; }\r\n\t\tif( strHost ) { delete [] strHost; }\r\n        delete pStream;\r\n        return 0;\r\n    }\r\n    \r\n    if( strPort ) { delete [] strPort; }\r\n\tif( strHost ) { delete [] strHost; }\r\n\r\n    return pStream;\r\n}\r\n\r\n\r\ns32  \r\nCSockReadStream::getSize()\r\n{\r\n\r\n    // 最初にステータスを NORMAL にする。途中で問題があれば書きかわる。\r\n    // 正常系を通れば問題なくNORMALを維持できる。\r\n    m_eStat = NORMAL;\r\n\r\n    // リングバッファへの読み込みを試みる。\r\n    if(!readRingBuf()) {\r\n\t\tsetStatus();\r\n//\t\treturn 0;\r\n\t}\r\n\r\n\t// リングバッファ中の有効サイズを返す\r\n    size_t leftSize = left_size();\r\n\treturn (s32)leftSize;\r\n}\r\n\r\ns32\r\nCSockReadStream::getPosition()\r\n{\r\n    // ネットワークソケットは位置を取得できない\r\n    return 0;\r\n}\r\n\r\n/*\r\n ネットワークストリームの場合、全ての読み込みメソッドにおいて\r\n *必ずしも読み込みが成功するわけではない* ことに注意する必要がある。\r\n 相手ホストがデータを送信していない場合、たとえ8bitのデータでも読み込みに失敗することがある。\r\n \r\n readBlock() 以外は読み込みの成否を返すようには出来ていないため、\r\n 実行後に必ず getStatus() でステータスを確認し、NOT_AVAILABLE である場合は\r\n 戻り値に意味が無いものとして破棄する必要がある。\r\n*/\r\n\r\nu8\r\nCSockReadStream::readU8()\r\n{\r\n    u8 buf;\r\n    if(!requestData(&buf, 1)) { return 0xff; }\r\n    return buf;\r\n}\r\n\r\n\r\nu16\r\nCSockReadStream::readU16()\r\n{\r\n    u8 buf[2];\r\n    if(!requestData(buf, 2)) { return 0xffff; }\r\n    return (u16)buf[0] << 8 | (u16)buf[1];\r\n}\r\n\r\nu32\r\nCSockReadStream::readU32()\r\n{\r\n    u8 buf[4];\r\n    if(!requestData(buf, 4)) { return 0xffff; }\r\n    return ((u32)buf[0] << 24) | ((u32)buf[1] << 16) | ((u32)buf[2] << 8) | (u32)buf[3];\r\n    \r\n}\r\nfloat\r\nCSockReadStream::readFloat()\r\n{\r\n    float buf;\r\n    if(!requestData((unsigned char *)&buf, sizeof(float))) { return -6e24f; }\r\n    return buf;\r\n}\r\n\r\n/*!\r\n 指定サイズ読み込み失敗時に読み込み位置を更新しないリングバッファ方式のため、\r\n byteSize にはリングバッファのサイズ以上を指定できない。\r\n */\r\nbool\r\nCSockReadStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n    if(!requestData((unsigned char *)buffer, byteSize)) { return false; }\r\n    return true;\r\n}\r\n\r\nCSockReadStream::ESTATUS\r\nCSockReadStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\n// この Stream から書き込み(送出)可能なストリームを生成する\r\nIWriteStream *\r\nCSockReadStream::getWriteStream()\r\n{\r\n    return m_writeStream;\r\n}\r\n\r\nint\r\nCSockReadStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n    // リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\r\n    if(!requestData((unsigned char *)pBufferU16, items * sizeof(u16))) { return 0; }\r\n    \r\n    // iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\r\n\r\n    return items;\r\n}\r\n\r\nint\r\nCSockReadStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n    // リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\r\n    if(!requestData((unsigned char *)pBufferU32, items * sizeof(u32))) { return 0; }\r\n    \r\n    // iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\r\n    \r\n    return items;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CSockReadStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockReadStream.h\r\n//\r\n\r\n#ifndef CSockReadStream_h\r\n#define CSockReadStream_h\r\n\r\n#include <WinSock.h>\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CSockWriteStream;\r\n\r\nclass CSockReadStream : public IReadStream\r\n{\r\n    friend class CSockWriteStream;\r\nprivate:\r\n    enum {\r\n        READ_BUFSIZ = 4096\r\n    };\r\n    CSockReadStream();\r\n\r\npublic:\r\n    virtual ~CSockReadStream();\r\n\r\n    static CSockReadStream * openStream(const char * path);\r\n    \r\n\r\n    s32     getSize\t\t();\r\n    s32     getPosition\t();\r\n    u8      readU8\t\t();\r\n    u16     readU16\t\t();\r\n    u32     readU32\t\t();\r\n    float   readFloat\t();\r\n    bool    readBlock\t(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus\t();\r\n    \r\n    int     readU16arr\t(u16 * pBufferU16, int items);\r\n    int     readU32arr\t(u32 * pBufferU32, int items);\r\n    \r\n    \r\n    IWriteStream * getWriteStream();\r\nprivate:\r\n    int     sock_connect\t(const char * hostname, int port);\r\n    bool    readRingBuf\t\t();\r\n    bool    requestData\t\t(unsigned char * buf, size_t size);\r\n    bool    setStatus\t\t();\r\n\r\n\tinline size_t\tleft_size() {\r\n\t\tsize_t leftSize = 0;\r\n\t\tif(m_lastPos > m_getPos) {\r\n\t\t\tleftSize = m_lastPos - m_getPos;\r\n\t\t} else if(m_lastPos < m_getPos) {\r\n\t\t\tleftSize = m_lastPos + READ_BUFSIZ - m_getPos;\r\n\t\t} else {\r\n\t\t\tif(m_lastPos) {\r\n\t\t\t\tleftSize = READ_BUFSIZ;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn leftSize;\r\n\t}\r\nprivate:\r\n    ESTATUS     m_eStat;\r\n    SOCKET      m_fd;\r\n    \r\n\tu8          m_readBuf[ READ_BUFSIZ ];\r\n    int         m_lastPos;\r\n    int         m_getPos;\r\n\r\n    CSockWriteStream    *   m_writeStream;\r\n};\r\n\r\n\r\n#endif // CSockReadStream_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CSockWriteStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockWriteStream.cpp\r\n//\r\n\r\n#include <Windows.h>\r\n#include <WinSock.h>\r\n#include <iostream>\r\n#include \"CSockWriteStream.h\"\r\n#include \"CSockReadStream.h\"\r\n\r\n\r\n// CSockWriteStream は、CSockReadStream が CSockReadStream::create() によって\r\n// 生成されたタイミングで作られる、書き込み(送出)用インタフェースとなるクラス。\r\n// socket は基本的に書き込み可能なストリームなので、必ず生成され、内部的に保持される。\r\nCSockWriteStream::CSockWriteStream(CSockReadStream& rdStream) : m_fd(rdStream.m_fd), m_eStat(NORMAL) {}\r\nCSockWriteStream::~CSockWriteStream() {}\r\n\r\nbool\r\nCSockWriteStream::sendData(unsigned char *buffer, size_t sndSize)\r\n{\r\n    // ひとまず、送出についてはその場で与えられたブロック全てを送出し終わるまで続ける形で実装する。\r\n    // ゲームで使う上で問題が生じたら、それはそれで考える。\r\n    size_t pos = 0;\r\n    do {\r\n        int result = send(m_fd, (char *)buffer + pos, sndSize - pos, 0);\r\n        if(result < 0) { return false; }\r\n        pos += result;\r\n    } while(pos < sndSize);\r\n    return true;\r\n}\r\n\r\nCSockWriteStream::ESTATUS\r\nCSockWriteStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\ns32\r\nCSockWriteStream::getPosition()\r\n{\r\n    return 0;   // socket は位置の取得ができない\r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU8(u8 value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData(&value, 1)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }\r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU16(u16 value)\r\n{\r\n    unsigned char buf[2];\r\n    \r\n    // big endian\r\n    buf[0] = (value >> 8) & 0xff;\r\n    buf[1] = value & 0xff;\r\n    \r\n    m_eStat = NORMAL;\r\n    if(!sendData(buf, 2)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU32(u32 value)\r\n{\r\n    unsigned char buf[4];\r\n    \r\n    // big endian\r\n    buf[0] = (value >> 24) & 0xff;\r\n    buf[1] = (value >> 16) & 0xff;\r\n    buf[2] = (value >> 8) & 0xff;\r\n    buf[3] = value & 0xff;\r\n    \r\n    m_eStat = NORMAL;\r\n    if(!sendData(buf, 4)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeFloat(float value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData((unsigned char *)&value, sizeof(float))) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeBlock(void* buffer, u32 byteSize)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData((unsigned char *)buffer, byteSize)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CSockWriteStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockWriteStream.h\r\n//\r\n\r\n#ifndef CSockWriteStream_h\r\n#define CSockWriteStream_h\r\n\r\n#include <WinSock.h>\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CSockReadStream;\r\n\r\n// File Access Class Implementation\r\nclass CSockWriteStream : public IWriteStream\r\n{\r\n    friend class CSockReadStream;\r\nprivate:\r\n    CSockWriteStream(CSockReadStream& rdStream);\r\n    virtual ~CSockWriteStream();\r\n    \r\n    bool    sendData(unsigned char * buffer, size_t sndSize);\r\npublic:\t\r\n\tESTATUS\tgetStatus\t();\r\n\ts32\t\tgetPosition\t();\r\n\tvoid\twriteU8\t\t(u8 value);\t\t// Use cast to support s8\r\n\tvoid\twriteU16\t(u16 value);\t// Use cast to support s16\r\n\tvoid\twriteU32\t(u32 value);\t// Use cast to support s32\r\n\tvoid\twriteFloat\t(float);\r\n\tvoid\twriteBlock\t(void* buffer, u32 byteSize);\r\n\r\nprivate:\r\n    SOCKET      m_fd;\r\n    ESTATUS     m_eStat;\r\n};\r\n\r\n#endif // CSockWriteStream_h\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32Audio.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CWin32Audio.cpp\r\n//\r\n\r\n#include <iostream>\r\n#include <io.h>\r\n#include <fcntl.h>\r\n#include <sys/types.h>\r\n#include <sys/stat.h>\r\n#include <share.h>\r\n#include <stdio.h>\r\n#include <math.h>\r\n\r\n#include \"CWin32Platform.h\"\r\n#include \"Win32FileLocation.h\"\r\n#include \"CWin32PathConv.h\"\r\n#include \"CWin32Audio.h\"\r\n#include \"CWin32ReadFileStream.h\"\r\n#include \"CSoundAnalysis.h\"\r\n\r\nfloat CWin32Audio::m_masterBGMVolume = 1.0f;\r\nfloat CWin32Audio::m_masterSEVolume  = 1.0f;\r\n\r\ncAudioFadeParam* cAudioFadeParam::s_fadeParamList   = NULL;\r\nvoid*            cAudioFadeParam::s_fadeParamThread = NULL;\r\n\r\n// サウンド関係の初期化\r\nvoid SoundSystemInitFor_Win32()\r\n{\r\n    // フェード管理の初期化\r\n    cAudioFadeParam::AudioFadeParamInit();\r\n}\r\n\r\n// サウンド関係の終了処理\r\nvoid SoundSystemExitFor_Win32()\r\n{\r\n    // フェード管理の終了\r\n    cAudioFadeParam::AudioFadeParamExit();\r\n}\r\n\r\n// フェードパラメータクラス\r\ncAudioFadeParam::cAudioFadeParam()\r\n: m_fadeCnt (0)\r\n, m_startVol(0.0f)\r\n, m_endVol  (0.0f)\r\n, m_fadeRatio       (0.0f)\r\n, m_nowFadeInterType(INTER_TYPE_NONE)\r\n, m_nowFadeType     (FADE_TYPE_NONE)\r\n, m_fadeMiliSec     (0)\r\n, m_bfade   (false)\r\n, m_prevmseq(0)\r\n, m_pAudio  (NULL)\r\n, m_prev    (NULL)\r\n, m_next    (NULL)\r\n{\r\n    attach();\r\n}\r\n\r\ncAudioFadeParam::~cAudioFadeParam()\r\n{\r\n    detach();\r\n}\r\n\r\nvoid cAudioFadeParam::attach()\r\n{\r\n    if( s_fadeParamList == NULL ) {\r\n        s_fadeParamList = this;\r\n    } else {\r\n        // 先頭と入れ替え\r\n        m_next = s_fadeParamList;\r\n        s_fadeParamList->m_prev = this;\r\n        s_fadeParamList = this;\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::detach()\r\n{\r\n    if( m_pAudio != NULL ) {\r\n        return;\r\n    }\r\n    \r\n    if( m_next && m_prev ) {\r\n        m_next->m_prev = m_prev;\r\n        m_prev->m_next = m_next;\r\n    } else if( m_prev ) {\r\n        // 前方のみがいるつまりは自身は末尾\r\n        m_prev->m_next = NULL;\r\n    } else if( m_next ) {\r\n        // 後方のみがいるつまりは自身は先頭\r\n        m_next->m_prev = NULL;\r\n        s_fadeParamList = m_next;\r\n    } else {\r\n        // 自身のみ\r\n        s_fadeParamList = NULL;\r\n    }\r\n    \r\n    m_next = NULL;\r\n    m_prev = NULL;\r\n}\r\n\r\nvoid cAudioFadeParam::exec()\r\n{\r\n    if( m_pAudio == NULL ) { return; }\r\n    \r\n    s64 nowSeq = 0;\r\n    \r\n    if( (m_bfade == false) && (m_nowFadeType != FADE_TYPE_NONE) )\r\n    {\r\n        m_bfade = true;\r\n        if( m_pAudio ) {\r\n            m_prevmseq = m_pAudio->tell();\r\n        }\r\n        //CPFInterface::getInstance().platform().logging(\"[sound] sound[%p]: fade start!\", m_pAudio);\r\n    }\r\n    if( m_bfade )\r\n    {\r\n        if( m_pAudio ) {\r\n            nowSeq = m_pAudio->tell();\r\n        }\r\n        \r\n        // フェードカウントインクリメント\r\n        m_fadeCnt += (s32)(nowSeq - m_prevmseq);\r\n        if( m_fadeCnt >= m_fadeMiliSec ) {\r\n            m_fadeCnt = m_fadeMiliSec;\r\n        } else if (m_fadeCnt < 0) {\r\n\t\t\tm_fadeCnt = 0;\r\n\t\t}\r\n        \r\n        // 係数計算\r\n        if( m_fadeCnt >= 0 ) {\r\n\r\n            m_fadeRatio = m_startVol + ((m_endVol - m_startVol) * ((float)m_fadeCnt / (float)m_fadeMiliSec));\r\n            if( m_fadeRatio < 0.0f ) {\r\n                m_fadeRatio = 0.0f;\r\n            } else if( m_fadeRatio > 1.0f ) {\r\n                m_fadeRatio = 1.0f;\r\n            }\r\n        }\r\n        \r\n        // サウンドに大して設定\r\n        if( m_pAudio ) {\r\n            m_pAudio->setFadeRatio(m_fadeRatio);\r\n        }\r\n        \r\n        // フェード終了の確認\r\n        if( m_fadeCnt >= m_fadeMiliSec ) {\r\n            m_fadeCnt = m_fadeMiliSec;\r\n            m_bfade = false;\r\n            \r\n            if( m_nowFadeType == FADE_TYPE_STOP ) {\r\n                if( m_pAudio ) {\r\n                    m_pAudio->stop();\r\n                }\r\n            } else if( m_nowFadeType == FADE_TYPE_PAUSE ) {\r\n                if( m_pAudio ) {\r\n                    m_pAudio->pause();\r\n                }\r\n            }\r\n            \r\n            if( m_pAudio ) {\r\n                cAudioFadeParam::Remove(m_pAudio);\r\n            }\r\n            m_nowFadeType = FADE_TYPE_NONE;\r\n        }\r\n        \r\n        if( m_pAudio ) {\r\n            m_prevmseq = m_pAudio->tell();\r\n        }\r\n    }\r\n}\r\n\r\nbool cAudioFadeParam::setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVolume)\r\n{\r\n    if( _msec <= 0 || _fadeType >= FADE_TYPE_NUM || _fadeType <= FADE_TYPE_NONE ) {\r\n        // フェードしないため初期化\r\n        m_nowFadeType   = INTER_TYPE_NONE;\r\n        m_nowFadeType   = FADE_TYPE_NONE;\r\n        m_endVol        = 0.0f;\r\n        m_fadeCnt       = 0;\r\n        //m_fadeRatio   = 1.0f;\r\n        m_fadeMiliSec   = 0;\r\n        m_bfade         = false;\r\n        m_prevmseq      = 0;\r\n        return true;\r\n    }\r\n    \r\n    m_fadeCnt       = 0;\r\n    m_endVol        = _tgtVol;\r\n    m_nowFadeType   = _fadeType;\r\n    m_nowFadeInterType = _interType;\r\n    switch( _fadeType )\r\n    {\r\n        case FADE_TYPE_PLAY:\r\n        case FADE_TYPE_RESUME:\r\n            m_startVol  = _startVolume;\r\n            m_fadeRatio = _startVolume;\r\n            break;\r\n                \r\n        case FADE_TYPE_STOP:\r\n        case FADE_TYPE_PAUSE:\r\n        case FADE_TYPE_PLAYING:\r\n            if( m_pAudio ) {\r\n                m_startVol = m_pAudio->getFadeRatio();\r\n            }\r\n            m_fadeRatio = m_startVol;\r\n            break;\r\n    }\r\n    m_fadeMiliSec   = _msec;\r\n    m_bfade         = false;\r\n    m_prevmseq      = 0;\r\n    return true;\r\n}\r\n\r\n/*\r\n    @brief  サウンドのフェードパラメータの初期処理(スレッドの作成など)\r\n */\r\nvoid cAudioFadeParam::AudioFadeParamInit()\r\n{\r\n    // フェード管理用のスレッド作成\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    if( s_fadeParamThread == NULL ) {\r\n        s_fadeParamThread = pForm.createThread(ThreadAudioFadeParam, NULL);\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::AudioFadeParamExit()\r\n{\r\n    // フェード管理用のスレッド破棄\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    if( s_fadeParamThread != NULL ) {\r\n        pForm.deleteThread(s_fadeParamThread);\r\n        s_fadeParamThread = NULL;\r\n    }\r\n    \r\n    cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n    while( pfadeParam ) {\r\n        cAudioFadeParam* pNext = pfadeParam->m_next;\r\n        pfadeParam->detach();\r\n        delete pfadeParam;\r\n        \r\n        pfadeParam = pNext;\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::SetFadeParam(CWin32Audio * _audio, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVol)\r\n{\r\n    // 現在の設定がある場合は上書き\r\n    bool bFind = false;\r\n\r\n    cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n    while( pfadeParam ) {\r\n        cAudioFadeParam * pNext = pfadeParam->m_next;\r\n        if( pfadeParam->m_pAudio == _audio && _audio != NULL ) {\r\n            pfadeParam->setFadeParam(_fadeType, _tgtVol, _msec, _interType,_startVol);\r\n            bFind = true;\r\n            break;\r\n        }\r\n        pfadeParam = pNext;\r\n    }\r\n    \r\n    // 見つからなかった場合は新規で作成\r\n    if( bFind == false ) {\r\n        cAudioFadeParam * pNew = new cAudioFadeParam;\r\n        pNew->m_pAudio = _audio;\r\n        pNew->setFadeParam(_fadeType, _tgtVol, _msec,1,_startVol);\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::Remove(void * _audio)\r\n{\r\n    if( _audio == NULL ) { return; }\r\n    \r\n    cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n    while( pfadeParam ) {\r\n        // 先頭で次の要素を保持しておく\r\n        cAudioFadeParam* pNext = pfadeParam->m_next;\r\n        \r\n        if( pfadeParam->m_pAudio == _audio ) {\r\n            pfadeParam->m_pAudio = NULL;\r\n            //CPFInterface::getInstance().platform().logging(\"[sound] sound[%p]: fade end!\", _audio );\r\n        }\r\n        \r\n        pfadeParam = pNext;\r\n    }\r\n}\r\n\r\ns32 cAudioFadeParam::ThreadAudioFadeParam(void * /*hThread*/, void * /*data*/)\r\n{\r\n    while( 1 ) {\r\n        cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n        while( pfadeParam ) {\r\n            cAudioFadeParam* pNext = pfadeParam->m_next;\r\n            pfadeParam->exec();\r\n            pfadeParam = pNext;\r\n        }\r\n        \r\n        pfadeParam = s_fadeParamList;\r\n        while( pfadeParam ) {\r\n            cAudioFadeParam* pNext = pfadeParam->m_next;\r\n            \r\n            // detach\r\n            if( pfadeParam->m_pAudio == NULL ) {\r\n                delete pfadeParam;\r\n                pfadeParam = NULL;\r\n            }\r\n            \r\n            pfadeParam = pNext;\r\n        }\r\n\t\tSleep(16);\t// sleep\r\n    }\r\n    \r\n    return 0; // end\r\n}\r\n\r\nCWin32Audio::CWin32Audio()\r\n: m_bActive     (false)\r\n, m_soundPath   (NULL)\r\n, m_preLoad     (false)\r\n, m_step        (IClientRequest::E_SOUND_STATE_INVALID_HANDLE)\r\n, m_volume      (1.0f)\r\n, m_fadeRatio   (1.0f)\r\n, m_totalPlayTime(0)\r\n, m_pDSBuffer   (0)\r\n{\r\n}\r\n\r\nCWin32Audio::~CWin32Audio()\r\n{\r\n    closeAudio();\r\n}\r\n\r\nbool\r\nCWin32Audio::openAudio(const char * path)\r\n{\r\n    closeAudio();\r\n    \r\n    CWin32PathConv& pathconv = CWin32PathConv::getInstance();\r\n//    m_soundPath = pathconv.fullpath(path, \".wav\");\r\n    m_soundPath = pathconv.fullpath(path, \".mp3\");\r\n\tm_loop_cnt = 0;\r\n\tm_step = STEP_WAIT;\r\n    m_bActive = (m_soundPath) ? true : false;\r\n\tm_totalPlayTime = 0;\r\n\r\n\t// 演奏時間を取得\r\n\tif( m_bActive ) {\r\n\t\t// サウンドデータを解析\r\n\t\tsSoundAnalysisData analysisData;\r\n\t\tif( GetSoundAnalysisData(m_soundPath, &analysisData) ) {\r\n\t\t\tm_totalPlayTime = (u32)analysisData.m_totalTime;\r\n\t\t}\r\n\t}\r\n\r\n    return m_bActive;\r\n}\r\n\r\nbool\r\nCWin32Audio::loadMem()\r\n{\r\n    if(!m_bActive) { return false; }\r\n    if(m_preLoad)  { return true;  } // 2012.12.06  同じ処理を複数回しないように追加\r\n\r\n\tCPFInterface::getInstance().platform().logging(\"path:%s\", m_soundPath);\r\n\r\n\tCWin32AudioMgr::getInstance().loadSound(*this);\r\n\r\n    m_preLoad = true;\r\n    return true;\r\n}\r\n\r\nvoid\r\nCWin32Audio::play(s32 _msec, float _tgtVol, float _startVol)\r\n{\r\n    if(!m_bActive) { return; }\r\n\r\n\tif(m_step == STEP_PAUSE) {\r\n\t\tresume(_msec, _tgtVol);\r\n\t}\r\n\r\n\t// SEとして再生\r\n\tif(m_preLoad) {\r\n\t\tif(m_pDSBuffer) {\r\n\t\t\tif(m_preLoad) {\r\n\t\t\t\tm_pDSBuffer->Stop();\r\n\t\t\t\tm_pDSBuffer->SetCurrentPosition(0);\t// next play by top\r\n\t\t\t\tm_pDSBuffer->Play(0, 0, 0);\r\n\t\t\t\tm_step      = STEP_PLAY;\r\n\t\t\t\tm_loop_cnt  = 0;\r\n\t\t\t\tm_fadeRatio = _startVol;\r\n\t\t\t\tupdateVolume();\r\n\t\t\t\tif( _msec > 0 && (_tgtVol != _startVol) ) {\r\n\t\t\t\t\tcAudioFadeParam::SetFadeParam(this, cAudioFadeParam::FADE_TYPE_PLAY, _tgtVol, _msec, (s16)_tgtVol, _startVol);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\r\n\tif(m_step == STEP_PAUSE) {\r\n\t\tresume(_msec, _tgtVol);\r\n\t\treturn;\r\n\t}\r\n\tif(m_step != STEP_WAIT) return;\r\n\r\n\tif(!m_bInit) {\r\n\t\tm_bInit = true;\r\n\t}\r\n\tm_loop_cnt = 0;\r\n\r\n\tif(!m_pDSBuffer) {\r\n\t\tCWin32AudioMgr::getInstance().loadSound(*this);\r\n\t}\r\n\tif(m_pDSBuffer) {\r\n\t\tm_pDSBuffer->Stop();\r\n\t\tm_pDSBuffer->Play(0, 0, DSBPLAY_LOOPING);\r\n\t\tm_step = STEP_PLAY;\r\n\t\tif( _msec > 0 && (_tgtVol != _startVol) ) {\r\n\t\t\tcAudioFadeParam::SetFadeParam(this, (s16)cAudioFadeParam::FADE_TYPE_PLAY, _tgtVol, _msec, (s16)_tgtVol, _startVol);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Audio::stop(s32 _msec, float _tgtVol)\r\n{\r\n    if(!m_bActive)   { return; }\r\n\r\n    if(!m_pDSBuffer) { return; }\r\n\r\n\tif( _msec <= 0 ) {\r\n\t\tm_pDSBuffer->Stop();\r\n\t\tm_pDSBuffer->SetCurrentPosition(0);\t// next play by top\r\n\t\tm_loop_cnt = 0;\r\n\t\tm_step = STEP_WAIT;\t\r\n\t} else {\r\n\t\tcAudioFadeParam::SetFadeParam(this, cAudioFadeParam::FADE_TYPE_STOP, _tgtVol, _msec, 1, 0.0f);\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Audio::pause(s32 _msec, float _tgtVol)\r\n{\r\n    if(!m_pDSBuffer) { return; }\r\n\r\n\tif( m_step == STEP_PLAY ) {\r\n\t\tif( _msec <= 0 ) {\r\n\t\t\tm_pDSBuffer->Stop();\r\n\t\t\tm_bSeeked = false;\r\n\t\t\tm_step = STEP_PAUSE;\r\n\t\t} else {\r\n\t\t\tcAudioFadeParam::SetFadeParam(this, cAudioFadeParam::FADE_TYPE_PAUSE, _tgtVol, _msec, 1, 0.0f);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Audio::resume(s32 _msec, float _tgtVol)\r\n{\r\n    if(!m_pDSBuffer) { return; }\r\n\r\n\tif( m_step == STEP_PAUSE ) {\r\n\t\tif( m_preLoad ) {\r\n\t\t\tm_pDSBuffer->Play(0, 0, 0);\r\n\t\t} else {\r\n\t\t\tm_pDSBuffer->Play(0, 0, DSBPLAY_LOOPING);\r\n\t\t}\r\n\t\tm_step = STEP_PLAY;\r\n\t\tcAudioFadeParam::SetFadeParam(this, cAudioFadeParam::FADE_TYPE_RESUME, _tgtVol, _msec);\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Audio::seek(s32 /*millisec*/)\r\n{\r\n    if(!m_pDSBuffer) { return; }\r\n}\r\n\r\ns32\r\nCWin32Audio::tell()\r\n{\r\n\tif( m_pDSBuffer == NULL ) {\r\n\t\treturn 0;\r\n\t}\r\n\r\n\ts32 playTime  = 0;\r\n\tDWORD playPos = 0;\r\n\r\n\t// ループ分の再生位置\r\n\tplayTime = (s32)((m_sound_buf_size * m_loop_cnt * 1000.0f) / m_nAvgBytesPerSec);\r\n\r\n\t// 現在の再生位置\r\n\tm_pDSBuffer->GetCurrentPosition( &playPos, NULL );\r\n\tplayTime += (s32)((playPos * 1000.0f) / m_nAvgBytesPerSec);\r\n\r\n\treturn playTime;\r\n}\r\n\r\n/*\r\n\t@brief\t総演奏時間を取得\r\n\t@param[in]\tvoid\r\n\t@return\t\ts32\t\t演奏時間(ミリ秒)\r\n*/\r\ns32\r\nCWin32Audio::totalPlayTime()\r\n{\r\n\treturn m_totalPlayTime;\r\n}\r\n\r\ns32\r\nCWin32Audio::getState()\r\n{\r\n\tif( m_pDSBuffer == NULL ) {\r\n\t\treturn IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\r\n\t}\r\n\r\n\ts32 state = IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\r\n\tswitch( m_step )\r\n\t{\r\n\tcase STEP_PLAY:\r\n\t\tstate = IClientRequest::E_SOUND_STATE_PLAY;\r\n\t\tbreak;\r\n\tcase STEP_PAUSE:\r\n\t\tstate = IClientRequest::E_SOUND_STATE_PAUSE;\r\n\t\tbreak;\r\n\tcase STEP_WAIT:\r\n\t\tstate = IClientRequest::E_SOUND_STATE_STOP;\r\n\t\tbreak;\r\n\t}\r\n\treturn state;\r\n}\r\n\r\nvoid\r\nCWin32Audio::setFadeParam(float _tgtVol, u32 _msec)\r\n{\r\n    if( m_step == STEP_PLAY ) {\r\n\t\tcAudioFadeParam::SetFadeParam(this, cAudioFadeParam::FADE_TYPE_PLAYING, _tgtVol, _msec);\r\n    }\r\n}\r\n\r\nvoid\r\nCWin32Audio::closeAudio()\r\n{\r\n    if(!m_bActive) { return; }\r\n\r\n\t// フェード管理から除外\r\n\tcAudioFadeParam::Remove(this);\r\n\r\n    m_bActive = false;\r\n    m_preLoad = false;\r\n\tif(m_pDSBuffer) {\r\n\t\tm_pDSBuffer->Release();\r\n\t}\r\n\tm_pDSBuffer = 0;\r\n    delete [] m_soundPath;\r\n    m_soundPath = NULL;\r\n}\r\n\r\nvoid\r\nCWin32Audio::setVolume(float volume)\r\n{\r\n    if(volume >= 1.0f) { volume = 1.0f; }\r\n\tif(volume <= 0.0f) { volume = 0.0f; }\r\n\tm_volume = volume;\r\n\r\n\tupdateVolume();\r\n}\r\n\r\nvoid\r\nCWin32Audio::updateVolume()\r\n{\r\n\tLONG vol;\r\n\tfloat volume = m_volume * m_fadeRatio * ((m_preLoad) ? m_masterSEVolume : m_masterBGMVolume);\r\n\tif(volume >= 1.0f) {\r\n\t\tvol = DSBVOLUME_MAX;\r\n\t} else if(volume <= 0.0f) {\r\n\t\tvol = DSBVOLUME_MIN;\r\n\t} else {\r\n\t\tvol = (LONG)(33.2f * log10(volume) * 100);\r\n\t}\r\n\r\n  if (m_pDSBuffer) {\r\n\t  m_pDSBuffer->SetVolume(vol);\r\n  }\r\n}\r\n\r\nvoid\r\nCWin32Audio::setFadeRatio(float _fadeRatio)\r\n{\r\n\tm_fadeRatio = _fadeRatio;\r\n    updateVolume();\r\n}\r\n\r\nvoid\r\nCWin32Audio::setPan(float /*pan*/)\r\n{\r\n}\r\n\r\nvoid\r\nCWin32Audio::setMasterVolume(float volume, bool SEmode)\r\n{\r\n    if(volume >= 1.0f) { volume = 1.0f; }\r\n\tif(volume <= 0.0f) { volume = 0.0f; }\r\n\r\n\tif(SEmode) {\r\n\t\tm_masterSEVolume = volume;\r\n\t} else {\r\n\t\tm_masterBGMVolume = volume;\r\n\t}\r\n}\r\n\r\nDWORD WINAPI\r\nCWin32Audio::soundBufEventThread(LPVOID _lpParam)\r\n{\r\n\tif(_lpParam) {\r\n\t\treturn ((CWin32Audio*)_lpParam)->soundBufEvent(_lpParam);\r\n\t}\r\n\treturn (DWORD)0;\r\n}\r\n\r\nDWORD WINAPI\r\nCWin32Audio::soundBufEvent(LPVOID /*_lpParam*/)\r\n{\r\n\twhile( 1 ) {\r\n\t\tDWORD eventNo = WaitForMultipleObjects(SOUND_EVENT_NUM, m_soundEvent.m_eventHandle, FALSE, INFINITE);\r\n\t\tswitch( eventNo ) \r\n\t\t{\r\n\t\tcase SOUND_EVENT_BUFEND:\r\n\t\t\t{\r\n\t\t\t\tm_loop_cnt++;\r\n\r\n\t\t\t\t// SEの場合はこの時点で再生停止しているため停止状態にする\r\n\t\t\t\tif( m_preLoad ) {\r\n\t\t\t\t\tm_step = STEP_WAIT;\r\n\t\t\t\t\tm_loop_cnt = 0;\r\n\t\t\t\t\tcAudioFadeParam::Remove(this);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn (DWORD)0;\r\n}\r\n\r\nCWin32AudioMgr::CWin32AudioMgr()\r\n: m_pDS8    (0)\r\n, m_primary (0) \r\n{\r\n}\r\n\r\nCWin32AudioMgr::~CWin32AudioMgr()\r\n{\r\n\trelease();\r\n}\r\n\r\nCWin32AudioMgr&\r\nCWin32AudioMgr::getInstance()\r\n{\r\n\tstatic CWin32AudioMgr instance;\r\n\treturn instance;\r\n}\r\n\r\n\r\nbool\r\nCWin32AudioMgr::init(HWND hwnd)\r\n{\r\n\tHRESULT result;\r\n\tresult = DirectSoundCreate8(0, &m_pDS8, 0);\r\n\tif(result == DS_OK)\t{ \r\n        result = m_pDS8->SetCooperativeLevel(hwnd, DSSCL_PRIORITY);\r\n    }\r\n\r\n\t// プライマリサウンドバッファの作成\r\n\tif(result == DS_OK) {\r\n\t\tDSBUFFERDESC desc;\r\n\t\tmemset((void *)&desc, 0, sizeof(DSBUFFERDESC));\r\n\t\tdesc.dwSize     = sizeof(DSBUFFERDESC);\r\n\t\tdesc.dwFlags    = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME;\r\n\t\tdesc.dwBufferBytes  = 0;\r\n\t\tdesc.lpwfxFormat    = 0;\r\n\t\tresult = m_pDS8->CreateSoundBuffer(&desc, &m_primary, 0);\r\n\t}\r\n\tif(result == DS_OK) {\r\n\t\tWAVEFORMATEX wf;\r\n\t\tmemset((void *)&wf, 0, sizeof(WAVEFORMATEX));\r\n\t\twf.cbSize       = sizeof(WAVEFORMATEX);\r\n\t\twf.wFormatTag   = WAVE_FORMAT_PCM;\r\n\t\twf.nChannels    = 2;\r\n\t\twf.nSamplesPerSec = 44100;\r\n\t\twf.wBitsPerSample = 16;\r\n\t\twf.nBlockAlign  = wf.nChannels * (wf.wBitsPerSample / 8);\r\n\t\twf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;\r\n\t\tresult = m_primary->SetFormat(&wf);\r\n\t}\r\n\tbool ret = false;\r\n\tif(result == DS_OK) { \r\n        ret = true;\r\n    }\r\n\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCWin32AudioMgr::release()\r\n{\r\n\tif(m_primary) {\r\n\t\tm_primary->Release();\r\n\t\tm_primary = 0;\r\n\t}\r\n\tif(m_pDS8) {\r\n\t\tm_pDS8->Release();\r\n\t\tm_pDS8 = 0;\r\n\t}\r\n\t\r\n}\r\n\r\nbool\r\nCWin32AudioMgr::loadSound(CWin32Audio& audio)\r\n{\r\n\t// サウンドファイルの物理パス\r\n\tconst char * soundpath = audio.m_soundPath;\r\n\tbool bResult;\r\n\tSNDINFO info;\r\n\r\n\tif(strstr(soundpath, \".wav\")) {\r\n\t\tbResult = loadWAV(audio, &info);\r\n\t} else if(strstr(soundpath, \".mp3\")) {\r\n\t\tbResult = loadMP3(audio, &info);\r\n\t} else {\r\n\t\tbResult = false;\r\n\t}\r\n    if(!bResult) { return bResult; }\r\n\r\n\tHRESULT result;\r\n\r\n\tDSBUFFERDESC desc;\r\n\tmemset((void *)&desc, 0, sizeof(DSBUFFERDESC));\r\n\tdesc.dwSize         = sizeof(DSBUFFERDESC);\r\n\tdesc.dwFlags        = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STATIC | DSBCAPS_LOCDEFER | DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY;\r\n\tdesc.dwBufferBytes  = info.size;\r\n\tdesc.lpwfxFormat    = &info.format;\r\n\tdesc.guid3DAlgorithm = DS3DALG_DEFAULT;\r\n\r\n\tLPDIRECTSOUNDBUFFER dsb;\r\n\tresult = m_pDS8->CreateSoundBuffer(&desc, &dsb, 0);\r\n\tif(DS_OK != result) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// サウンドバッファイベントの登録\r\n\tif( dsb ) {\r\n\t\tLPDIRECTSOUNDNOTIFY8 notify;\r\n\t\tif( SUCCEEDED(dsb->QueryInterface(IID_IDirectSoundNotify8, (void**)&notify)) ) {\r\n\t\t\tfor( int i=0; i<CWin32Audio::SOUND_EVENT_NUM; ++i ) {\r\n\t\t\t\t// 以前のハンドルを一度閉じる\r\n\t\t\t\tif( audio.m_soundEvent.m_eventHandle[i] != 0 ) {\r\n\t\t\t\t\tCloseHandle( audio.m_soundEvent.m_eventHandle[i] );\r\n\t\t\t\t}\r\n\r\n\t\t\t\taudio.m_soundEvent.m_eventHandle[i] = CreateEvent(NULL, FALSE, FALSE, NULL );\r\n\r\n\t\t\t\tswitch( i )\r\n\t\t\t\t{\r\n\t\t\t\tcase CWin32Audio::SOUND_EVENT_BUFEND:\r\n\t\t\t\t\taudio.m_soundEvent.m_posNotify[i].dwOffset = info.size - 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\taudio.m_soundEvent.m_posNotify[i].hEventNotify = audio.m_soundEvent.m_eventHandle[i];\r\n\t\t\t}\r\n\r\n\t\t\t// 以前のスレッドハンドルを一度閉じる\r\n\t\t\tif( audio.m_soundEvent.m_eventThreadHandle != 0 ) {\r\n\t\t\t\tCloseHandle(audio.m_soundEvent.m_eventThreadHandle);\r\n\t\t\t}\r\n\r\n\t\t\t// スレッドの作成\r\n\t\t\tDWORD threadId;\r\n\t\t\tHANDLE threadHandle;\r\n\t\t\tthreadHandle = CreateThread(NULL, 0, CWin32Audio::soundBufEventThread, (LPVOID)&audio, CREATE_SUSPENDED, &threadId );\r\n\t\t\taudio.m_soundEvent.m_eventThreadId      = threadId;\r\n\t\t\taudio.m_soundEvent.m_eventThreadHandle  = threadHandle;\r\n\t\t\tif( audio.m_soundEvent.m_eventThreadHandle != 0 ) {\r\n\t\t\t\tResumeThread( audio.m_soundEvent.m_eventThreadHandle );\r\n\t\t\t}\r\n\r\n\t\t\tnotify->SetNotificationPositions( CWin32Audio::SOUND_EVENT_NUM, audio.m_soundEvent.m_posNotify );\r\n\t\t\tnotify->Release();\r\n\t\t}\r\n\t}\r\n\r\n\tLPVOID p1, p2;\r\n\tDWORD size1, size2;\r\n\tresult = dsb->Lock(0, info.size, &p1, &size1, &p2, &size2, 0);\r\n\tif(FAILED(result)) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tmemcpy(p1, info.data, size1);\r\n\tmemcpy(p2, info.data, size2);\r\n\r\n\t// mmioRead(hsrc, (char *)p1, size1);\r\n\t// mmioRead(hsrc, (char *)p2, size2);\r\n\r\n\tdsb->Unlock(p1, size1, p2, size2);\r\n\r\n\t// ロード済みのポインタを保存する\r\n\taudio.m_pDSBuffer       = dsb;\r\n\taudio.m_sound_buf_size  = info.size;\r\n\taudio.m_nAvgBytesPerSec = info.format.nAvgBytesPerSec;\r\n\r\n\tdelete [] info.data;\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCWin32AudioMgr::loadWAV(CWin32Audio& audio, SNDINFO * info)\r\n{\r\n\tbool res = false;\r\n\r\n\t// サウンドファイルの物理パス\r\n\tHRESULT result;\r\n\tconst char * soundpath = audio.m_soundPath;\r\n\tHMMIO hsrc = 0;\r\n\tMMCKINFO file;\r\n\tMMCKINFO fmt;\r\n\tMMCKINFO data;\r\n\tMMIOINFO mmioInfo;\r\n\tmemset(&mmioInfo, 0, sizeof(MMIOINFO));\r\n\r\n\t//\r\n\t// Read from file system and decrypt first.\r\n\t//\r\n\tu8*\t\tlpBuffer\t\t= NULL;\r\n\tu32\t\tdwBufferLength\t= 0;\r\n\tFILE*\tpFile\t\t\t= NULL;\r\n\r\n\tpFile = fopen(soundpath,\"rb\");\r\n\tif (!pFile) {\r\n\t\tgoto exit;\r\n\t}\r\n\r\n\t// Decryption\r\n\tu32 hasHeader = 0;\r\n\tif (CWin32Platform::g_useDecryption) {\r\n\t\tu8 hdr[4];\r\n\t\thdr[0] = 0;\r\n\t\thdr[1] = 0;\r\n\t\thdr[2] = 0;\r\n\t\thdr[3] = 0;\r\n\t\tfread(hdr,1,4,pFile);\r\n\t\thasHeader = decryptSetup((const u8*)soundpath, hdr);\r\n\t}\r\n\r\n\tfseek\t(pFile, 0, SEEK_END);\r\n    dwBufferLength=ftell (pFile) - (hasHeader * 4);\r\n\tif (!dwBufferLength) {\r\n\t\tgoto exit;\r\n\t} else {\r\n\t\tlpBuffer = (u8*)malloc(dwBufferLength);\r\n\t\tif (!lpBuffer) {\r\n\t\t\tgoto exit;\r\n\t\t}\r\n\t}\r\n\tfseek\t(pFile, hasHeader * 4, SEEK_SET);\r\n\tfread\t(lpBuffer, 1, dwBufferLength, pFile);\r\n\r\n\tdecrypt(lpBuffer, dwBufferLength);\r\n\r\n\t// Read Complete file and \r\n\tmmioInfo.pchBuffer = (HPSTR)lpBuffer;\r\n\tmmioInfo.cchBuffer = dwBufferLength;\r\n\tmmioInfo.fccIOProc = FOURCC_MEM;\r\n\r\n\thsrc = mmioOpen(NULL, &mmioInfo, MMIO_ALLOCBUF|MMIO_READ|MMIO_COMPAT);\r\n\tif(!hsrc) { goto exit; }\r\n\r\n\tmemset((void *)&file, 0, sizeof(MMCKINFO));\r\n\tresult = mmioDescend(hsrc, &file, 0, MMIO_FINDRIFF);\r\n\tif(file.fccType != mmioFOURCC('W', 'A', 'V', 'E')) {\r\n\t\tgoto exit;\r\n\t}\r\n\tmemset((void *)&fmt, 0, sizeof(MMCKINFO));\r\n\tresult = mmioDescend(hsrc, &fmt, &file, MMIO_FINDCHUNK);\r\n\tif(fmt.ckid != mmioFOURCC('f', 'm', 't', ' ')) {\r\n\t\tgoto exit;\r\n\t}\r\n\t// Header Calculation\r\n\tint hdrsize = fmt.cksize;\r\n    if(hdrsize < sizeof(WAVEFORMATEX)) { hdrsize = sizeof(WAVEFORMATEX); }\r\n\r\n\tmemset((void *)&(info->format), 0, sizeof(WAVEFORMATEX));\r\n\r\n\t// Buffer ensure\r\n\tchar * pBuf = (char *)&(info->format);\r\n\t// LPWAVEFORMATEX wf = (LPWAVEFORMATEX)pBuf;\r\n\tresult = mmioRead(hsrc, pBuf, fmt.cksize);\r\n\tif(FAILED(result)) {\r\n\t\tgoto exit;\r\n\t}\r\n\tmmioAscend(hsrc, &fmt, 0);\r\n\tfor(;;) {\r\n\t\tresult = mmioDescend(hsrc, &data, &file, 0);\r\n\t\tif(FAILED(result)) {\r\n\t\t\tdelete [] pBuf;\r\n\t\t\tgoto exit;\r\n\t\t}\r\n        if(data.ckid == mmioStringToFOURCC(\"data\", 0)) { break; }\r\n\t\tresult = mmioAscend(hsrc, &data, 0);\r\n\t}\r\n\tchar * buf = new char [ data.cksize ];\r\n\tif(!buf) {\r\n\t\tgoto exit;\r\n\t}\r\n\t// \r\n\tmmioRead(hsrc, buf, data.cksize);\r\n\tinfo->size = data.cksize;\r\n\tinfo->data = buf;\r\n\tres = true;\r\n\r\nexit:\r\n\tif (pFile)\t\t{ fclose(pFile);\t\t}\r\n\tif (lpBuffer)\t{ free(lpBuffer);\t\t}\r\n\tif (hsrc)\t\t{ mmioClose(hsrc, 0);\t}\r\n\treturn res;\r\n}\r\n\r\nbool\r\nCWin32AudioMgr::loadMP3(CWin32Audio& audio, SNDINFO * info)\r\n{\r\n\tconst char * soundpath = audio.m_soundPath;\r\n\tCWin32MP3 mp3(soundpath);\r\n\r\n    if(!mp3.getStatus()) { return false; }\r\n\r\n\tinfo->size = mp3.getSize();\r\n\tinfo->data = new char [ info->size ];\r\n\tmp3.getFormat(&(info->format));\r\n\treturn mp3.readData(info->data, info->size);\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32Audio.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CWin32Audio.h\r\n//\r\n\r\n#ifndef CWin32Audio_h\r\n#define CWin32Audio_h\r\n\r\n#include <Windows.h>\r\n#include <MMSystem.h>\r\n#include <dsound.h>\r\n#include \"encryptFile.h\"\r\n\r\n#pragma comment(lib, \"Dsound.lib\")\r\n#pragma comment(lib, \"dxguid.lib\")\r\n#pragma comment(lib, \"winmm.lib\")\r\n\r\n#include \"CWin32MP3.h\"\r\n\r\n\r\nclass CWin32AudioMgr;\r\n\r\n// サウンド全体の初期化と終了\r\nvoid SoundSystemInitFor_Win32();\r\nvoid SoundSystemExitFor_Win32();\r\n\r\n// サウンドフェード管理クラス\r\nclass cAudioFadeParam\r\n{\r\n    friend class CWin32Audio;\r\npublic:\r\n    cAudioFadeParam();\r\n    virtual ~cAudioFadeParam();\r\n\r\n    void attach\t();\r\n    void detach\t();\r\n    void exec\t();\r\n    bool setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType=INTER_TYPE_LINEAR, float _startVol = 0.0f);\r\n \r\n    static void AudioFadeParamInit();\r\n    static void AudioFadeParamExit();\r\n    static void SetFadeParam(CWin32Audio * _audio, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType=INTER_TYPE_LINEAR, float _startVol = 0.0f);\r\n    static void Remove(void * _audio);\r\n\tstatic s32 ThreadAudioFadeParam(void * hThread, void * data);\r\npublic:\r\n    // フェード関係のパラメータ\r\n    enum FADE_TYPE\r\n    {\r\n        FADE_TYPE_NONE = 0,\r\n        FADE_TYPE_PLAY,         //!< fade in\r\n        FADE_TYPE_STOP,         //!< fade out\r\n        FADE_TYPE_PAUSE,        //!< fade out\r\n        FADE_TYPE_RESUME,       //!< fade in\r\n        FADE_TYPE_PLAYING,      //!< fade\r\n        \r\n        FADE_TYPE_NUM,\r\n    };\r\n    \r\n    enum INTER_TYPE\r\n    {\r\n        INTER_TYPE_NONE = 0,\r\n        INTER_TYPE_LINEAR,         //!< Linear\r\n        \r\n        INTER_TYPE_NUM,\r\n    };\r\n    \r\nprivate:\r\n    s32                 m_fadeCnt;          //!< フェードカウント(ミリ秒)\r\n    float               m_startVol;         //!< フェード開始のボリューム値(0.0f~1.0f)\r\n    float               m_endVol;           //!< フェード終了のボリューム値(0.0f~1.0f)\r\n    float               m_fadeRatio;        //!< フェード割合(0.0f〜1.0f)\r\n    s32                 m_fadeMiliSec;      //!< フェードに要する時間(ミリ秒)\r\n    s16                 m_nowFadeInterType; //!< 現在のフェード補間タイプ\r\n    s16                 m_nowFadeType;      //!< 現在のフェードタイプ\r\n    bool                m_bfade;            //!< フェード中？\r\n    s64                 m_prevmseq;         //!< 前回の再生時間\r\n    \r\n    CWin32Audio*        m_pAudio;           //!< 対象者s\r\n    \r\n    cAudioFadeParam*    m_prev;\t\t\t\t//!< 前のフェードパラメータ\r\n    cAudioFadeParam*    m_next;\t\t\t\t//!< 次のフェードパラメータ\r\n    \r\n    static cAudioFadeParam* s_fadeParamList;\r\n    static void*            s_fadeParamThread;\r\n};\r\n\r\nclass CWin32Audio\r\n{\r\n\tfriend class CWin32AudioMgr;\r\npublic:\r\n    CWin32Audio();\r\n    virtual ~CWin32Audio();\r\n\r\n    bool openAudio\t\t(const char * path);\r\n    bool loadMem\t\t();\r\n    void play\t\t\t(s32 _msec=0, float _tgtVol=1.0f, float _startVol=1.0f);\r\n    void stop\t\t\t(s32 _msec=0, float _tgtVol=0.0f);\r\n\tvoid pause\t\t\t(s32 _msec=0, float _tgtVol=0.0f);\r\n\tvoid resume\t\t\t(s32 _msec=0, float _tgtVol=1.0f);\r\n\tvoid seek\t\t\t(s32 millisec);\r\n\ts32 tell\t\t\t();\r\n\ts32 totalPlayTime\t();\r\n\r\n\ts32 getState\t\t();\r\n\r\n\tvoid setFadeParam\t(float _tgtVol, u32 _msec);\r\n\r\n    void closeAudio\t\t();\r\n\r\n\tvoid setVolume\t\t(float volume);\r\n\tvoid setPan\t\t\t(float pan);\r\n\tvoid updateVolume\t();\r\n    \r\n    inline bool isActive() { return m_bActive; }\r\n\r\n\tinline float getFadeRatio(void) { return m_fadeRatio; }\r\n    void setFadeRatio\t(float _fadeRatio);\r\n\r\n\tstatic void setMasterVolume(float volume, bool SEmode);\r\n\tstatic DWORD WINAPI soundBufEventThread(LPVOID _lpParam);\r\nprivate:\r\n\tDWORD WINAPI soundBufEvent(LPVOID _lpParam);\r\n\r\npublic:\r\n\t// 再生時間計測用\r\n\tenum\r\n\t{\r\n\t\tSOUND_EVENT_BUFEND = 0,\t// 再生時のバッファ終端に来た際のイベント\r\n\t\tSOUND_EVENT_NUM,\t\t// サウンドイベントの個数\r\n\t};\r\n\tstruct sSoundEvent\r\n\t{\r\n\t\tDSBPOSITIONNOTIFY\tm_posNotify[SOUND_EVENT_NUM];\t\r\n\t\tHANDLE\t\t\t\tm_eventHandle[SOUND_EVENT_NUM];\t// イベントハンドル\r\n\t\tHANDLE\t\t\t\tm_eventThreadHandle;\t\t\t// スレッドハンドル\r\n\t\tDWORD\t\t\t\tm_eventThreadId;\r\n\r\n\t\tsSoundEvent() \r\n\t\t{\r\n\t\t\tfor( int i = 0; i<SOUND_EVENT_NUM; ++i ) {\r\n\t\t\t\tm_eventHandle[i] = 0;\r\n\t\t\t}\r\n\t\t\tm_eventThreadHandle = 0;\r\n\t\t\tm_eventThreadId = 0;\r\n\t\t}\r\n\t};\r\n\r\nprivate:\r\n\r\n\tenum {\r\n\t\tBUF_CUONT = 3\r\n\t};\r\n\tenum {\r\n\t\tSTEP_WAIT,\r\n\t\tSTEP_PLAY,\r\n\t\tSTEP_PAUSE,\r\n\t};\r\n\r\n    const char    * m_soundPath;\r\n    // char          * m_soundFullpath;\r\n    bool            m_bActive;\r\n    bool            m_preLoad;\r\n\tbool\t\t\tm_bInit;\r\n\tbool\t\t\tm_bSeeked;\r\n\r\n\tint\t\t\t\tm_buf_level;\r\n\tint\t\t\t\tm_step;\r\n\r\n\tfloat\t\t\tm_volume;\r\n\r\n\tfloat           m_fadeRatio;\r\n\tu32\t\t\t\tm_totalPlayTime;\t// 演奏時間\r\n\r\n\tLPDIRECTSOUNDBUFFER\t\tm_pDSBuffer;\r\n\r\n\tsSoundEvent\t\tm_soundEvent;\r\n\tu32\t\t\t\tm_loop_cnt;\t\t\t// ループカウント\r\n\tu32\t\t\t\tm_sound_buf_size;\t// バッファサイズ\r\n\tu32\t\t\t\tm_nAvgBytesPerSec;\t// 1秒あたりの出力バイト数\r\n\r\n\tstatic float\tm_masterBGMVolume;\r\n\tstatic float\tm_masterSEVolume;\r\n};\r\n\r\nclass CWin32AudioMgr\r\n{\r\n\tfriend class CWin32Audio;\r\nprivate:\r\n\tCWin32AudioMgr();\r\n\tvirtual ~CWin32AudioMgr();\r\npublic:\r\n\tstatic CWin32AudioMgr& getInstance();\r\n\r\n\tbool init\t\t(HWND hwnd);\r\n\tvoid release\t();\r\n\r\n\tbool loadSound\t(CWin32Audio& audio);\r\nprivate:\r\n\tbool loadWAV\t(CWin32Audio& audio);\r\n\tbool loadMP3\t(CWin32Audio& audio);\r\n\r\n\tstruct SNDINFO {\r\n\t\tsize_t\t\t\tsize;\r\n\t\tWAVEFORMATEX\tformat;\r\n\t\tchar\t\t*\tdata;\r\n\t};\r\n\tbool loadWAV\t(CWin32Audio& audio, SNDINFO * info);\r\n\tbool loadMP3\t(CWin32Audio& audio, SNDINFO * info);\r\n\r\n\tLPDIRECTSOUND8\t\t\tm_pDS8;\r\n\tLPDIRECTSOUNDBUFFER\t\tm_primary;\r\n\r\n\tCDecryptBaseClass   m_decrypter;\r\n\tinline void decrypt(void* ptr, u32 length) {\r\n        m_decrypter.decryptBlck(ptr, length);\r\n    }\r\n\r\n\tinline u32 decryptSetup(const u8* ptr, const u8* hdr) {\r\n        return m_decrypter.decryptSetup(ptr,hdr);\r\n    }\r\n};\r\n\r\n#endif // CWin32Audio_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32HttpStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CWin32HttpStream.h\"\r\n#pragma comment(lib, \"wininet.lib\")\r\nCWin32HttpStream::CWin32HttpStream() : m_fullpath(0), m_bufHTTP(0)\r\n{}\r\n\r\nCWin32HttpStream::~CWin32HttpStream()\r\n{\r\n\tdelete [] m_bufHTTP;\r\n    delete [] m_fullpath;\r\n}\r\n\r\nCWin32HttpStream *\r\nCWin32HttpStream::openStream(const char * path, const char * /*home*/)\r\n{\r\n    CWin32HttpStream * pStream = NULL;\r\n    try {\r\n        pStream = new CWin32HttpStream();\r\n\t\tif(!pStream){\r\n\t\t\treturn NULL;\r\n\t\t}\r\n        pStream->m_fullpath = NULL;\r\n\r\n\t\tchar * buf = new char [ strlen(path) + 1 ];\r\n\t\tif(!buf) {\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n\t\t\treturn pStream;\r\n\t\t}\r\n\t\tstrcpy(buf, path);\r\n\t\tpStream->m_fullpath = (const char *)buf;\r\n\r\n\t\tbool bHttps = false;\r\n\r\n\t\t// 一応 HTTPS も対応する\r\n        if(!strncmp(pStream->m_fullpath, \"https://\", 8)) { bHttps = true; }\r\n\r\n\t\t// WININET で HTTP リソースにアクセスする\r\n\t\tHINTERNET hInternet;\r\n\t\tHINTERNET hHttpRequest;\r\n\r\n\t\thInternet = InternetOpen(\r\n\t\t\t\"GameEngine HTTP Stream\",\r\n\t\t\tINTERNET_OPEN_TYPE_PRECONFIG,\r\n\t\t\tNULL,\r\n\t\t\tNULL,\r\n\t\t\t0);\r\n\r\n\t\tif(hInternet == NULL) {\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n\t\t\treturn pStream;\r\n\t\t}\t\t\t\r\n\r\n\t\thHttpRequest = InternetOpenUrl(\r\n\t\t\thInternet,\r\n\t\t\tpStream->m_fullpath,\r\n\t\t\tNULL,\r\n\t\t\t0,\r\n\t\t\tINTERNET_FLAG_RELOAD,\r\n\t\t\t0);\r\n\r\n\t\tif(hHttpRequest == NULL) {\r\n\t\t\tInternetCloseHandle(hInternet);\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n\t\t\treturn pStream;\r\n\t\t}\r\n\r\n\t\r\n\t\tDWORD dwLength  = 0;\r\n\t\tDWORD dwSize    = sizeof(dwLength);\r\n\t\tDWORD dwReadSize;\r\n\t\tBOOL bResult    = HttpQueryInfo(\r\n\t\t\thHttpRequest,\r\n\t\t\tHTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,\r\n\t\t\t(LPVOID)&dwLength,\r\n\t\t\t&dwSize,\r\n\t\t\tNULL);\r\n\r\n\t\tif(!bResult) {\r\n\t\t\tInternetCloseHandle(hHttpRequest);\r\n\t\t\tInternetCloseHandle(hInternet);\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n\t\t\treturn pStream;\r\n\t\t}\r\n\t\tchar * httpbuf = new char [ dwLength ];\r\n\t\tif(!httpbuf) {\r\n\t\t\tInternetCloseHandle(hHttpRequest);\r\n\t\t\tInternetCloseHandle(hInternet);\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n\t\t\treturn pStream;\r\n\t\t}\r\n\r\n\t\tbResult = InternetReadFile(\r\n\t\t\thHttpRequest,\r\n\t\t\thttpbuf,\r\n\t\t\tdwLength,\r\n\t\t\t&dwReadSize);\r\n\r\n\t\t// ここで読み終わり\r\n\r\n\t\tInternetCloseHandle(hHttpRequest);\r\n\t\tInternetCloseHandle(hInternet);\r\n\t\tpStream->m_pos      = 0;\r\n\t\tpStream->m_bufHTTP  = (const u8 *)httpbuf;\r\n\t\tpStream->m_bufLen   = dwLength;\r\n\r\n\t\tif(bResult) {\r\n\t\t\tpStream->m_eStat = NORMAL;\r\n\t\t} else {\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n\t\t}\r\n\t\treturn pStream;\r\n        \r\n    } catch(...) {\r\n        delete pStream;\r\n        return NULL;\r\n    }\r\n}\r\n\r\nCWin32HttpStream *\r\nCWin32HttpStream::openAssets(const char * path, const char * home)\r\n{\r\n\treturn openStream(path, home);\r\n\t// 中身が openStream() と全く同じになってしまったので。\r\n}\r\n\r\ns32 \r\nCWin32HttpStream::getSize()\r\n{\r\n    return (s32)m_bufLen;\r\n}\r\n\r\ns32\r\nCWin32HttpStream::getPosition()\r\n{\r\n    return (s32)m_pos;\r\n}\r\n\r\nu8       \r\nCWin32HttpStream::readU8()\r\n{\r\n    return (u8)*(m_bufHTTP + m_pos);\r\n}\r\n\r\nu16      \r\nCWin32HttpStream::readU16()\r\n{\r\n    if(m_pos > m_bufLen - 2) { return 0; }\r\n\tu16 ret = ((u16)m_bufHTTP[m_pos] << 8) | (u16)m_bufHTTP[m_pos+1];\r\n\tm_pos += 2;\r\n\treturn ret;\r\n}\r\n\r\nu32      \r\nCWin32HttpStream::readU32()\r\n{\r\n    if(m_pos > m_bufLen - 4) { return 0; }\r\n\r\n\tu32 ret = ((u32)m_bufHTTP[m_pos] << 24) | ((u32)m_bufHTTP[m_pos+1] << 16) |\r\n\t\t((u32)m_bufHTTP[m_pos+2] << 8) | (u32)m_bufHTTP[m_pos+3];\r\n\tm_pos += 4;\r\n\treturn ret;\r\n}\r\n\r\nfloat    \r\nCWin32HttpStream::readFloat()\r\n{\r\n    if(m_pos > m_bufLen - sizeof(float)) { return 0.0f; }\r\n    float f;\r\n\tmemcpy(&f, m_bufHTTP + m_pos, sizeof(float));\r\n\tm_pos += sizeof(float);\r\n\treturn f;\r\n}\r\n\r\nbool     \r\nCWin32HttpStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n    if(m_pos + byteSize > m_bufLen) { return false; }\r\n\tmemcpy(buffer, m_bufHTTP + m_pos, byteSize);\r\n\tm_pos += byteSize;\r\n\treturn true;\r\n}\r\n\r\nIReadStream::ESTATUS  \r\nCWin32HttpStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\nIWriteStream *  \r\nCWin32HttpStream::getWriteStream()\r\n{\r\n\treturn NULL;\r\n}\r\n\r\nint\r\nCWin32HttpStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n\tsize_t len = sizeof(u16) * items;\r\n\tint cnt = items;\r\n\tif(m_pos + len > m_bufLen) {\r\n\t\tcnt = (m_bufLen - m_pos) / sizeof(u16);\r\n\t}\r\n\r\n\tlen = sizeof(u16) * cnt;\r\n\tmemcpy(pBufferU16, m_bufHTTP + m_pos, len);\r\n\tm_pos += len;\r\n    \r\n    return cnt;\r\n}\r\n\r\nint\r\nCWin32HttpStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n\tsize_t len = sizeof(u32) * items;\r\n\tint cnt = items;\r\n\tif(m_pos + len > m_bufLen) {\r\n\t\tcnt = (m_bufLen - m_pos) / sizeof(u32);\r\n\t}\r\n\r\n\tlen = sizeof(u32) * cnt;\r\n\tmemcpy(pBufferU32, m_bufHTTP + m_pos, len);\r\n\tm_pos += len;\r\n    \r\n    return cnt;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32HttpStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CWin32HttpStream_h\r\n#define CWin32HttpStream_h\r\n\r\n#include <Windows.h>\r\n#include <WinInet.h>\r\n#include <stdio.h>\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CWin32HttpStream : public IReadStream\r\n{\r\nprivate:\r\n    CWin32HttpStream();\r\n    \r\npublic:\r\n    virtual ~CWin32HttpStream();\r\n    \r\n    static CWin32HttpStream * openStream(const char * path, const char * home);\r\n    \r\n    static CWin32HttpStream * openAssets(const char * path, const char * home);\r\n    \r\n    s32     getSize\t\t();\r\n    s32     getPosition\t();\r\n    u8      readU8\t\t();\r\n    u16     readU16\t\t();\r\n    u32     readU32\t\t();\r\n    float   readFloat\t();\r\n    bool    readBlock\t(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus\t();\r\n    \r\n    int     readU16arr\t(u16 * pBufferU16, int items);\r\n    int     readU32arr\t(u32 * PBufferU32, int items);\r\n    \r\n    IWriteStream * getWriteStream();\r\n\r\nprivate:\r\n    const char* m_fullpath;\r\n    ESTATUS     m_eStat;\r\n\r\n\tconst u8\t*\tm_bufHTTP;\t// read HTTP resource\r\n\tDWORD\t\t\tm_bufLen;\t// read size\r\n\tDWORD\t\t\tm_pos;\t\t// read point\r\n};\r\n\r\n#endif // CWin32HttpStream_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32KeyChain.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#include \"CWin32KeyChain.h\"\r\n\r\nCWin32KeyChain::CWin32KeyChain() : m_begin(NULL), m_end(NULL) {}\r\nCWin32KeyChain::~CWin32KeyChain()\r\n{\r\n\tclean();\r\n}\r\n\r\nvoid\r\nCWin32KeyChain::clean()\r\n{\r\n\t// 値を保持するために確保していた領域をすべて破棄\r\n\tSERVICE * pServ = m_begin;\r\n\twhile(pServ) {\r\n\t\tSERVICE * pNext = pServ->next;\r\n\r\n\t\tKEYVALUE * pVal = pServ->begin;\r\n\t\twhile(pVal) {\r\n\t\t\tKEYVALUE * next = pVal->next;\r\n\r\n\t\t\tdelete pVal->key;\r\n\t\t\tdelete pVal->value;\r\n\t\t\tdelete pVal;\r\n\r\n\t\t\tpVal = next;\r\n\t\t}\r\n\r\n\t\tdelete pServ;\r\n\t\tpServ = pNext;\r\n\t}\r\n\tm_begin = NULL;\r\n\tm_end   = NULL;\r\n}\r\n\r\nconst char *\r\nCWin32KeyChain::getValue(const char * service_name, const char * key)\r\n{\r\n\t// 指定された名称のサービスを検索\r\n\tSERVICE * pServ = m_begin;\r\n\twhile(pServ) {\r\n        if(!strcmp(pServ->service_name, service_name)) { break; }\r\n\t\tpServ = pServ->next;\r\n\t}\r\n    if(!pServ) { return NULL; }\r\n\r\n\t// サービスがあれば、その中を key で検索\r\n\tKEYVALUE * pKey = pServ->begin;\r\n\twhile(pKey) {\r\n        if(!strcmp(pKey->key, key)) { break; }\r\n\t\tpKey = pKey->next;\r\n\t}\r\n    if(!pKey) { return NULL; }\r\n\r\n\treturn pKey->value;\r\n}\r\n\r\nbool\r\nCWin32KeyChain::setValue(const char * service_name, const char * key, const char * value)\r\n{\r\n\t// 指定された名称のサービスを検索\r\n\tSERVICE * pServ = m_begin;\r\n\twhile(pServ) {\r\n        if(!strcmp(pServ->service_name, service_name)) { break; }\r\n\t\tpServ = pServ->next;\r\n\t}\r\n\tif(!pServ) {\r\n\t\t// ない場合はこの場で作る。\r\n\t\tpServ = new SERVICE;\r\n\t\tchar * name = new char [ strlen(service_name) + 1 ];\r\n\t\tstrcpy(name, service_name);\r\n\t\tpServ->service_name = (const char *)name;\r\n\t\tpServ->begin        = pServ->end = NULL;\r\n\t\tpServ->next         = NULL;\r\n\t\tpServ->prev         = m_end;\r\n\t\tif(pServ->prev) {\r\n\t\t\tpServ->prev->next = pServ;\r\n\t\t} else {\r\n\t\t\tm_begin = pServ;\r\n\t\t}\r\n\t\tm_end = pServ;\r\n\t}\r\n\r\n\t// 該当するサービスの中で、指定されたkeyを検索する\r\n\tKEYVALUE * pKey = pServ->begin;\r\n\twhile(pKey) {\r\n        if(!strcmp(pKey->key, key)) { break; }\r\n\t\tpKey = pKey->next;\r\n\t}\r\n\t// 該当するキーが無ければ作成する\r\n\tif(!pKey) {\r\n\t\tpKey = new KEYVALUE;\r\n\t\tchar * keystr = new char [ strlen(key) + 1 ];\r\n\t\tstrcpy(keystr, key);\r\n\t\tpKey->key   = keystr;\r\n\t\tpKey->value = NULL;\r\n\t\tpKey->next  = NULL;\r\n\t\tpKey->prev  = pServ->end;\r\n\t\tif(pKey->prev) {\r\n\t\t\tpKey->prev->next = pKey;\r\n\t\t} else {\r\n\t\t\tpServ->begin = pKey;\r\n\t\t}\r\n\t\tpServ->end = pKey;\r\n\t}\r\n\r\n\tdelete pKey->value;\r\n\r\n\t// 値を設定する\r\n\tchar * valstr = new char [ strlen(value) + 1 ];\r\n\tstrcpy(valstr, value);\r\n\tpKey->value = valstr;\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCWin32KeyChain::delValue(const char * service_name, const char * key)\r\n{\r\n\t// 指定された名称のサービスを検索\r\n\tSERVICE * pServ = m_begin;\r\n\twhile(pServ) {\r\n        if(!strcmp(pServ->service_name, service_name)) { break; }\r\n\t\tpServ = pServ->next;\r\n\t}\r\n\t// ない場合は指定のキーもあるわけがないのでそのまま終了。\r\n\tif(!pServ) return true;\r\n\r\n\t// 該当するサービスの中で、指定されたkeyを検索する\r\n\tKEYVALUE * pKey = pServ->begin;\r\n\twhile(pKey) {\r\n        if(!strcmp(pKey->key, key)) { break; }\r\n\t\tpKey = pKey->next;\r\n\t}\r\n\t// 該当するキーが無ければ目的は最初から達成されているのでそのまま終了\r\n    if(!pKey) { return true; }\r\n\r\n\t// value 領域を破棄\r\n\tdelete pKey->value;\r\n\r\n\t// key領域を破棄\r\n\tif(pKey->prev) {\r\n\t\tpKey->prev->next = pKey->next;\r\n\t} else {\r\n\t\tpServ->begin = pKey->next;\r\n\t}\r\n\tif(pKey->next) {\r\n\t\tpKey->next->prev = pKey->prev;\r\n\t} else {\r\n\t\tpServ->end = pKey->prev;\r\n\t}\r\n\tdelete [] pKey->key;\r\n\tdelete pKey;\t// key領域そのものを削除する。\r\n\r\n\t// keyが属していた service が持つ key が一つもない状態になっていたら、\r\n\t// service を削除する。\r\n\tif(!pServ->begin && !pServ->end) {\r\n\t\tif(pServ->prev) {\r\n\t\t\tpServ->prev->next = pServ->next;\r\n\t\t} else {\r\n\t\t\tm_begin = pServ->prev;\r\n\t\t}\r\n\t\tif(pServ->next) {\r\n\t\t\tpServ->next->prev = pServ->prev;\r\n\t\t} else {\r\n\t\t\tm_end = pServ->prev;\r\n\t\t}\r\n\t\tdelete [] pServ->service_name;\r\n\t\tdelete pServ;\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool\r\nCWin32KeyChain::loadKeyChain(const char * filename)\r\n{\r\n\tFILE * rfp;\r\n\trfp = fopen(filename, \"r\");\r\n\tif(!rfp) return false;\r\n\r\n\tclean();\r\n\r\n\tchar line[4096];\r\n\twhile(fgets(line, 4096, rfp)) {\r\n\t\t// 行をバラし、service_name : key : value に分割する\r\n\t\tchar * ptr = line;\r\n\t\tconst char * service_name = ptr;\r\n\t\tptr = strstr(ptr, \"::\");\r\n        if(!ptr) { goto failed_end; }\r\n\r\n\t\t*ptr = 0;\r\n\t\tptr += 2;\r\n\t\tconst char * key = ptr;\r\n\r\n\t\tptr = strstr(ptr, \"::\");\r\n\t\tif(!ptr) goto failed_end;\r\n\r\n\t\t*ptr = 0;\r\n\t\tptr += 2;\r\n\t\tconst char * value = ptr;\r\n\r\n\t\tptr = strstr(ptr, \"\\n\");\r\n\t\tif(ptr) *ptr = 0;\r\n\r\n\t\t// バラした値を登録\r\n\t\tbool result = setValue(service_name, key, value);\r\n        if(!result) { goto failed_end; }\r\n\t}\r\n\tfclose(rfp);\r\n\r\n\treturn true;\r\n\r\nfailed_end:\r\n\tfclose(rfp);\r\n\tclean();\r\n\treturn false;\r\n}\r\n\r\nbool\r\nCWin32KeyChain::saveKeyChain(const char * filename)\r\n{\r\n\tFILE * wfp;\r\n\twfp = fopen(filename, \"w\");\r\n    if(!wfp) { return false; }\r\n\r\n\tSERVICE * pServ = m_begin;\r\n\twhile(pServ) {\r\n\t\tKEYVALUE * pKey = pServ->begin;\r\n\t\twhile(pKey) {\r\n\t\t\tfprintf(wfp, \"%s::%s::%s\\n\", pServ->service_name, pKey->key, pKey->value);\r\n\t\t\tpKey = pKey->next;\r\n\t\t}\r\n\t\tpServ = pServ->next;\r\n\t}\r\n\r\n\tfclose(wfp);\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32KeyChain.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CWin32KeyChain_h\r\n#define CWin32KeyChain_h\r\n\r\nclass CWin32KeyChain\r\n{\r\npublic:\r\n\tCWin32KeyChain();\r\n\tvirtual ~CWin32KeyChain();\r\n\r\n\tconst char * getValue(const char * service_name, const char * key);\r\n\tbool setValue(const char * service_name, const char * key, const char * value);\r\n\tbool delValue(const char * service_name, const char * key);\r\n\r\n\tbool loadKeyChain(const char * filename);\r\n\tbool saveKeyChain(const char * filename);\r\n\r\nprivate:\r\n\r\n\tvoid clean();\r\n\r\n\t// KEYVALUE は key と値(文字列)の対応を持つ\r\n\tstruct KEYVALUE {\r\n\t\tKEYVALUE\t*\tprev;\r\n\t\tKEYVALUE\t*\tnext;\r\n\r\n\t\tconst char\t*\tkey;\r\n\t\tconst char\t*\tvalue;\r\n\t};\r\n\r\n\t// サービス名称ごとにKEYVALUE一覧を持つ\r\n\tstruct SERVICE {\r\n\t\tSERVICE\t*\tprev;\r\n\t\tSERVICE\t*\tnext;\r\n\r\n\t\tconst char\t*\tservice_name;\r\n\r\n\t\tKEYVALUE\t*\tbegin;\r\n\t\tKEYVALUE\t*\tend;\r\n\t};\r\n\r\n\tSERVICE\t\t*\tm_begin;\r\n\tSERVICE\t\t*\tm_end;\r\n};\r\n\r\n#endif // CWin32KeyChain_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32MP3.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CWin32Platform.h\"\r\n#include \"CWin32MP3.h\"\r\n#include \"encryptFile.h\"\r\n\r\nCWin32MP3::CWin32MP3(const char * mp3name) \r\n: m_status  (true)\r\n, m_lgf     (NULL)\r\n, m_hip     (0)\r\n, m_begin   (NULL)\r\n, m_end     (NULL)\r\n, m_decrypter()\r\n{\r\n\t// Lame の初期化\r\n\tm_lgf = lame_init();\r\n    if(!m_lgf) { m_status = false; }\r\n\r\n\t// Lameの初期化に成功していたらdecode関数の初期化\r\n\tif(m_status && !(m_hip = hip_decode_init())) {\r\n\t\tlame_close(m_lgf);\r\n\t\tm_status = false;\r\n\t}\r\n    if(m_status) { m_status = loadMP3(mp3name); }\r\n}\r\n\r\nCWin32MP3::~CWin32MP3()\r\n{\r\n\r\n\tMP3BLOCK * block = m_begin;\r\n\twhile(block) {\r\n\t\tMP3BLOCK * next = block->next;\r\n\t\tdelete block;\r\n\t\tblock = next;\r\n\t}\r\n\r\n\tif(m_hip) {\r\n\t\thip_decode_exit(m_hip);\r\n\t\tm_hip = 0;\r\n\t}\r\n\tif(m_lgf) {\r\n\t\tlame_close(m_lgf);\r\n\t\tm_lgf = 0;\r\n\t}\r\n}\r\n\r\nbool\r\nCWin32MP3::toRPCM(short * buf, int frameCount, int stereo, size_t buf_size)\r\n{\r\n    if(buf_size < ((size_t)frameCount) * 2 * stereo) { return false; }\r\n\r\n\tshort * p = buf;\r\n\tshort * pL = m_bufL;\r\n\tshort * pR = m_bufR;\r\n\twhile(frameCount--) {\r\n\t\t*p++ = *pL++;\r\n\t\tif(stereo == 2) {\r\n\t\t\t*p++ = *pR++;\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCWin32MP3::getFormat(WAVEFORMATEX * format)\r\n{\r\n\tmemcpy(format, &m_format, sizeof(WAVEFORMATEX));\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCWin32MP3::readData(char * buf, size_t max)\r\n{\r\n\tshort * ptr     = (short *)buf;\r\n\tsize_t maxlen   = max / 2;\r\n\r\n\tMP3BLOCK * block = m_begin;\r\n\twhile(block && maxlen > 0)\r\n\t{\r\n\t\tsize_t size = block->size;\r\n        if(maxlen < size) { size = maxlen; }\r\n\t\tmemcpy(ptr, block->buf, size * 2);\r\n\t\tptr     += size;\r\n\t\tmaxlen  -= size;\r\n\t\tblock   = block->next;\r\n\t}\r\n    if(block->next) { return false; }\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCWin32MP3::loadMP3(const char * name)\r\n{\r\n\tconst char * soundpath = name;\r\n\tchar * pBuf = new char [ FILE_BUF_SIZE ];\r\n\tFILE * rfp;\r\n\r\n\trfp = fopen(soundpath, \"rb\");\r\n\tif(!rfp) return false;\r\n\t\r\n\tif (CWin32Platform::g_useDecryption) {\r\n\t\tu8 hdr[4];\r\n\t\thdr[0] = 0;\r\n\t\thdr[1] = 0;\r\n\t\thdr[2] = 0;\r\n\t\thdr[3] = 0;\r\n\t\tfread(hdr,1,4,rfp);\r\n\t\tu32 hasHeader = decryptSetup((const u8*)name, hdr);\r\n\t\tif (hasHeader == 0) {\r\n\t\t\tfseek(rfp, 0, SEEK_SET);\r\n\t\t}\r\n\t}\r\n\r\n\tsize_t nSize, nPos;\r\n\tsize_t headerSize;\r\n\ts32 skipSamples = 0;\r\n\r\n\tnSize = fread(pBuf, 1, FILE_BUF_SIZE, rfp);\r\n\tif(nSize < 4) {\r\n\t\tklb_assert(nSize, \"CWin32AudioMgr::loadMP3(): fread failed.\");\r\n\t\tklb_assertAlways(\"too small file size.\");\r\n\t\tdelete [] pBuf;\r\n\t\tfclose(rfp);\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tdecrypt(pBuf,nSize);\r\n\r\n\tnPos = (size_t)0;\r\n\tif(!memcmp(pBuf, \"ID3\", 3)) {\r\n\t\tif(nSize < 10) {\r\n\t\t\tnPos = fread(pBuf + nSize, 1, 10 - nSize, rfp);\r\n            if (nPos + nSize < 10) {\r\n\t\t\t\t\tklb_assert(nPos + nSize, \"CWin32AudioMgr::loadMP3(): fread failed.\");\r\n\t\t\t\t\tklb_assertAlways(\"too small file size.\");\r\n\t\t\t\t\tdelete [] pBuf;\r\n\t\t\t\t\tfclose(rfp);\r\n\t\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tdecrypt(pBuf + nSize,nPos);\r\n\r\n            nSize += nPos;\r\n        }\r\n\t\theaderSize = ((size_t)(pBuf[6] & 0x7F) << 21) |\r\n            ((size_t)(pBuf[7] & 0x7F) << 14) |\r\n            ((size_t)(pBuf[8] & 0x7F) << 7) |\r\n            (size_t)(pBuf[9] & 0x7F);\r\n\t\tif(nSize - 10 >= headerSize) {\r\n\t\t\tnPos = 10 + headerSize;\r\n\t\t\tnSize -= nPos;\r\n\t\t} \r\n\t\telse {\r\n\t\t\t// ID3データをスキップ\r\n\t\t\twhile(headerSize) {\r\n\t\t\t\tif(headerSize > FILE_BUF_SIZE) {\r\n\t\t\t\t\tnSize = FILE_BUF_SIZE;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnSize = headerSize;\r\n\t\t\t\t}\r\n\t\t\t\tnPos = fread(pBuf, 1, nSize, rfp);\r\n\t\t\t\tif(!nPos) {\r\n\t\t\t\t\tklb_assert(nPos, \"CWin32AudioMgr::loadMP3(): fread failed.\");\r\n\t\t\t\t\tdelete [] pBuf;\r\n\t\t\t\t\tfclose(rfp);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\r\n\t\t\t\tdecrypt(pBuf,nPos);\r\n\r\n\t\t\t\theaderSize -= (int)nPos;\r\n\t\t\t}\r\n\t\t\tif(!headerSize) {\r\n\t\t\t\tnPos  = 0;\r\n\t\t\t\tnSize = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// ID3タグ情報をスキップしたので、再生に必要なヘッダ情報取得\r\n\tint decodeCount, nEncDelay, nEncPadding;\r\n\tmp3data_struct mp3data;\r\n\r\n\tdecodeCount = -1;\r\n\tnEncDelay = nEncPadding = -1;\r\n\tmp3data.header_parsed = 0;\r\n\tfor(;;) {\r\n\t\tif(nSize) {\r\n\t\t\tdecodeCount = hip_decode1_headersB(m_hip, (unsigned char *)pBuf + nPos, nSize,\r\n\t\t\t\t\t\t\t\t\t\t\t\tm_bufL, m_bufR, &mp3data, &nEncDelay, &nEncPadding);\r\n\r\n\t\t\tif(decodeCount < 0) {\r\n\t\t\t\tklb_assert(decodeCount >= 0, \"CWin32AudioMgr::loadMP3(): hip_decode1_headersB() failed.\");\r\n\t\t\t\tdelete [] pBuf;\r\n\t\t\t\tfclose(rfp);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tnPos = 0;\r\n            if(mp3data.header_parsed) { break; }\r\n\t\t}\r\n\r\n\t\t// 元の評価式だとFILE_BUF_SIZEピッタリで読めた時に死ぬので、eofに達した時点でヘッダが読めなかったときにエラーを返すように変更。\r\n\t\tnSize = fread(pBuf, 1, FILE_BUF_SIZE, rfp);\r\n\t\tif(!nSize) {\r\n\t\r\n\t\t\tdecrypt(pBuf,nSize);\r\n\r\n\t\t\t// 一回分のreadバッファでヘッダとデータが両方パース出来てしまった場合は、\r\n            // もう一度デコーダを呼ばないとheader_parsedフラグが立たないようなので、修正を追記。\r\n            // 参考：http://fossies.org/dox/xbmc-11.0/mpglib__interface_8c_source.htmldecode1_headersB_clipchoice \r\n            //       decode1_headersB_clipchoice関数\r\n            decodeCount = hip_decode1_headers(m_hip, (unsigned char *)pBuf + nPos, nSize, m_bufL, m_bufR, &mp3data);\r\n\r\n            if(decodeCount < 0)\r\n            {\r\n\t\t\t\tklb_assert(decodeCount >= 0, \"CWin32AudioMgr::loadMP3(): hip_decode1_headersB() failed.\");\r\n                delete [] pBuf;\r\n                fclose(rfp);\r\n                return false;\r\n            }\r\n            nPos = 0;\r\n            if(mp3data.header_parsed) {\r\n                break;\r\n            } else {\r\n                //klb_assertAlways(\"could not parse mp3 header\");        // ファイルの末尾まで読み終わっているのでそれ以降はない\r\n                delete [] pBuf;\r\n                fclose(rfp);\r\n                return false;\r\n            }\r\n\t\t}\r\n\t}\r\n\tif(decodeCount < 0) {\r\n\t\tdelete [] pBuf;\r\n\t\tfclose(rfp);\r\n\t\treturn false;\r\n\t} else {\r\n\t\tif( nEncDelay > -1 || nEncPadding > -1 ) {\r\n\t\t\tif( nEncDelay > -1 ) {\r\n\t\t\t\tskipSamples = 528 + 1 + nEncDelay;\r\n\t\t\t}\r\n\t\t\tif( nEncPadding > -1 ) {\r\n\t\t\t\tnEncPadding -= (528 + 1);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tskipSamples = 528 + 1 + lame_get_encoder_delay(m_lgf);\r\n\t\t}\r\n\t}\r\n\r\n\t// WAVEFORMATEX 構造体を生成。具体的には info->format を埋める。\r\n\tm_format.wFormatTag     = WAVE_FORMAT_PCM;\r\n\tm_format.nChannels      = (WORD)mp3data.stereo;\r\n\tm_format.nSamplesPerSec = (DWORD)mp3data.samplerate;\r\n\tm_format.wBitsPerSample = 16;\r\n\tm_format.nBlockAlign    = m_format.nChannels * (m_format.wBitsPerSample / 8);\r\n\tm_format.nAvgBytesPerSec = m_format.nSamplesPerSec * m_format.nBlockAlign;\r\n\tm_format.cbSize         = 0;\r\n\r\n\t// 最初のブロックを作る\r\n\tMP3BLOCK * pBlock = NULL;\r\n\tm_begin = m_end = NULL;\r\n\tm_totalSize = 0;\r\n\r\n\t// デコードする。\r\n\tint hdrPos, nowSample;\r\n\thdrPos      = 0;\r\n\tnowSample   = 0;\r\n\tfor(;;) {\r\n\t\tif(!pBlock) {\r\n\t\t\tpBlock       = new MP3BLOCK;\r\n\t\t\tpBlock->size = 0;\r\n\t\t\tpBlock->prev = m_end;\r\n\t\t\tpBlock->next = NULL;\r\n\t\t\tif(pBlock->prev) {\r\n\t\t\t\tpBlock->prev->next = pBlock;\r\n\t\t\t} else {\r\n\t\t\t\tm_begin = pBlock;\r\n\t\t\t}\r\n\t\t\tm_end = pBlock;\r\n\t\t}\r\n\r\n\t\tnSize = 1;\r\n\t\tif(!decodeCount) {\r\n\t\t\tdecodeCount = hip_decode1(m_hip, (unsigned char *)pBuf, 0, m_bufL, m_bufR);\r\n\t\t\twhile(!decodeCount) {\r\n\t\t\t\tnSize = fread(pBuf, 1, FILE_BUF_SIZE, rfp);\r\n\t\t\t\tif(!nSize) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\r\n\t\t\t\tdecrypt(pBuf,nSize);\r\n\r\n\t\t\t\tdecodeCount = hip_decode1(m_hip, (unsigned char *)pBuf, nSize, m_bufL, m_bufR);\r\n\t\t\t\tif(decodeCount < 0) {\r\n\t\t\t\t\tklb_assert(decodeCount >= 0, \"CWin32AudioMgr::loadMP3(): hip_decode1() failed.\");\r\n\t\t\t\t\tfclose(rfp);\r\n\t\t\t\t\tdelete [] pBuf;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!nSize || decodeCount < 0) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// 最初のサンプルスキップ\r\n\t\tif( skipSamples ) {\r\n\t\t\tif( decodeCount < skipSamples ) {\r\n\t\t\t\tskipSamples -= decodeCount;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tmemmove(&m_bufL[0], &m_bufL[skipSamples], sizeof(short) * (decodeCount - skipSamples));\r\n\t\t\tmemmove(&m_bufR[0], &m_bufR[skipSamples], sizeof(short) * (decodeCount - skipSamples));\r\n\t\t\tdecodeCount -= skipSamples;\r\n\t\t\tskipSamples = 0;\r\n\t\t}\r\n\r\n\t\t// 最後のサンプルスキップ\r\n\t\tif(nEncPadding > 0 && feof(rfp)) {\r\n\t\t\tdecodeCount = (decodeCount < nEncPadding) ? 0 : (decodeCount - nEncPadding);\r\n\t\t}\r\n\t\tif(nowSample + decodeCount > mp3data.nsamp) nowSample = mp3data.nsamp - nowSample;\r\n\r\n\t\t\r\n\r\n\t\ttoRPCM(pBlock->buf, decodeCount, mp3data.stereo, PCM_BUF_SIZE);\r\n\t\tpBlock->size = decodeCount * mp3data.stereo;\r\n\t\tm_totalSize += pBlock->size * 2;\t// byte unit\r\n\t\tpBlock      = NULL;\r\n\r\n\t\tnowSample   += decodeCount;\r\n\t\tdecodeCount = 0;\r\n\t}\r\n\r\n\t// 使用したリソースを解放する\r\n\tdelete [] pBuf;\r\n\tfclose(rfp);\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32MP3.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CWin32MP3_h\r\n#define CWin32MP3_h\r\n\r\n#include <Windows.h>\r\n#include <MMSystem.h>\r\n#include <dsound.h>\r\n#include \"lame.h\"\r\n#include \"encryptFile.h\"\r\n#pragma comment(lib, \"libmp3lame.lib\")\r\n\r\n\r\nclass CWin32MP3\r\n{\r\npublic:\r\n\tCWin32MP3(const char * mp3path);\r\n\tvirtual ~CWin32MP3();\r\n\r\n\tbool getFormat\t(WAVEFORMATEX * format);\r\n\tbool readData\t(char * buf, size_t max);\r\n\r\n\tinline bool\t\tgetStatus\t()\t{ return m_status; }\r\n\tinline size_t\tgetSize\t\t()\t{ return m_totalSize; }\r\n\r\nprivate:\r\n\tbool loadMP3(const char * name);\r\n\tbool toRPCM\t(short * buf, int frameCount, int stereo, size_t buf_size);\r\n\r\nprivate:\r\n\tenum {\r\n\t\tFILE_BUF_SIZE\t= 8192,\r\n\t\tMP3_MAX_SAMPLES = 1152,\r\n\t\tPCM_BUF_SIZE\t= (MP3_MAX_SAMPLES * 4)\r\n\t};\r\n\tstruct MP3BLOCK {\r\n\t\tMP3BLOCK\t*\tprev;\r\n\t\tMP3BLOCK\t*\tnext;\r\n\t\tsize_t\t\t\tsize;\r\n\t\tshort\t\t\tbuf[ MP3_MAX_SAMPLES * 2 ];\r\n\t};\r\n\r\n\tbool\t\t\t\t\tm_status;\r\n\tlame_global_flags\t*\tm_lgf;\r\n\thip_t\t\t\t\t\tm_hip;\r\n\tWAVEFORMATEX\t\t\tm_format;\r\n\tsize_t\t\t\t\t\tm_totalSize;\r\n\tMP3BLOCK\t*\t\t\tm_begin;\r\n\tMP3BLOCK\t*\t\t\tm_end;\r\n\tshort\t\t\t\t\tm_bufL[ MP3_MAX_SAMPLES ];\r\n\tshort\t\t\t\t\tm_bufR[ MP3_MAX_SAMPLES ];\r\n\tinline u32 decryptSetup(const u8* ptr, const u8* hdr) {\r\n        return m_decrypter.decryptSetup(ptr,hdr);\r\n    }\r\nprivate:\r\n\tCDecryptBaseClass   m_decrypter;\r\n\tinline void decrypt(void* ptr, u32 length) {\r\n        m_decrypter.decryptBlck(ptr, length);\r\n    }\r\n};\r\n\r\n#endif // CWin32MP3_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32PathConv.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  W32PathConv.cpp\r\n//\r\n#include <sys/stat.h>\r\n#include <errno.h>\r\n#include <string.h>\r\n#include \"CWin32PathConv.h\"\r\n#include \"CPFInterface.h\"\r\n\r\nCWin32PathConv::CWin32PathConv() : m_build(false), m_external(NULL), m_install(NULL) {}\r\nCWin32PathConv::~CWin32PathConv() {\r\n    delete [] m_external;\r\n    delete [] m_install;\r\n}\r\n\r\nCWin32PathConv&\r\nCWin32PathConv::getInstance()\r\n{\r\n    static CWin32PathConv instance;\r\n    return instance;\r\n}\r\n\r\nvoid\r\nCWin32PathConv::setPath(const char * pathInstall, const char * pathExtern)\r\n{\r\n\tg_pathInstall = pathInstall;\r\n\tg_pathExtern  = pathExtern;\r\n}\r\n\r\nconst char *\r\nCWin32PathConv::makePath(const char * path, const char * suffix, const char * base)\r\n{\r\n    int extlen  = (suffix) ? strlen(suffix) : 0;\r\n    int len     = strlen(path) + strlen(base) + extlen + 2;\r\n    char * buf  = new char [ len ];\r\n\r\n\tstrcpy(buf, base);\r\n    //strcat(buf, \"/\");\r\n    strcat(buf, path);\r\n    if(suffix) { strcat(buf, suffix); }\r\n    CPFInterface::getInstance().platform().logging(\"fullpath: %s\", buf);\r\n    return (const char *)buf;\r\n}\r\n\r\nbool\r\nCWin32PathConv::checkExists(const char * path)\r\n{\r\n    bool bResult = true;\r\n    struct stat st;\r\n    int iRes = stat(path, &st);\r\n    if((iRes != 0) && (errno == ENOENT)) { bResult = false; }\r\n    return bResult;\r\n}\r\n\r\nconst char *\r\nCWin32PathConv::fullpath(const char * url, const char * suffix, bool* isReadOnly)\r\n{\r\n    build();\r\n\t// Default\r\n\tif (isReadOnly) { *isReadOnly = true; }\r\n\r\n    if (!strncmp(url, \"asset://\", 8)) {\r\n        const char * path;\r\n        path = makePath(url + 8, suffix, m_external);\r\n        if(checkExists(path)) {\r\n\t\t\tif (isReadOnly) { *isReadOnly = false; }\r\n\t\t\treturn path;\r\n\t\t}\r\n        delete [] path;\r\n        \r\n        path = makePath(url + 8, suffix, m_install);\r\n        if(checkExists(path)) { return path; }\r\n        delete [] path;\r\n\r\n\t\tCPFInterface::getInstance().platform().logging(\"[file]: not found '%s%s'\", url, suffix);\r\n\r\n        return NULL;\r\n    }\r\n\tconst char * path = url;\r\n    if (!strncmp(path, \"external/\", 9)) {\r\n\t\tif (isReadOnly) { *isReadOnly = false; }\r\n\t\treturn makePath(path + 9, suffix, m_external);\r\n\t}\r\n    if (!strncmp(path, \"install/\", 8)) { return makePath(path + 8, suffix, m_install); }\r\n    return NULL;\r\n}\r\n\r\nextern char* g_pathExtern;\r\nextern char* g_pathInstall;\r\n\r\nvoid\r\nCWin32PathConv::create_external()\r\n{\r\n    int length = strlen(g_pathExtern);\r\n    char * buf = new char [length + 1];\r\n    strcpy(buf, g_pathExtern);\r\n    m_external = (const char *)buf;\r\n}\r\n\r\nvoid\r\nCWin32PathConv::create_install()\r\n{\r\n    int length = strlen(g_pathInstall);\r\n    char * buf = new char [length + 1];\r\n    strcpy(buf, g_pathInstall);\r\n    m_install = (const char *)buf;\r\n}\r\n\r\nvoid\r\nCWin32PathConv::build()\r\n{\r\n    if(m_build) return;\r\n    create_install();\r\n    create_external();\r\n    m_build = true;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32PathConv.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  iOSPathConv.h\r\n//\r\n\r\n#ifndef CWin32PathConv_h\r\n#define CWin32PathConv_h\r\n\r\n#include \"Win32FileLocation.h\"\r\n\r\nclass CWin32PathConv\r\n{\r\nprivate:\r\n    CWin32PathConv();\r\n    virtual ~CWin32PathConv();\r\n\r\npublic:\r\n    static CWin32PathConv& getInstance();\r\n    \r\n    const char * fullpath\t(const char * url, const char * suffix = 0, bool* isReadOnly = 0);\r\n    \r\n    const char * install\t()\t{ build(); return m_install; }\r\n    const char * external\t()\t{ build(); return m_external; }\r\n\r\n\tvoid\t\t setPath\t(const char * pathInstall, const char * pathExtern);\r\n\r\nprivate:\r\n    const char * makePath\t(const char * path, const char * suffix, const char * base);\r\n    bool\t\t checkExists(const char * path);\r\n\r\n    void\t\t build\t\t();\r\n    void\t\t create_external();\r\n    void\t\t create_install\t();\r\n\r\nprivate:\r\n    bool                m_build;\r\n    const char      *   m_external;\r\n    const char      *   m_install;\r\n\r\n\tconst char\t\t*\tg_pathInstall;\r\n\tconst char\t\t*\tg_pathExtern;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32Platform.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdio.h>\r\n#include <stdarg.h>\r\n#include <string.h>\r\n#include <time.h>\r\n#include <windows.h>\r\n#include <WinSock.h>\r\n#include <Rpc.h>\r\n#include \"openssl/sha.h\"\r\n#include \"CWin32KeyChain.h\"\r\n\r\n#include \"assert.h\"\r\n#include \"RenderingFramework.h\"\r\n\r\n#include \"CWin32Platform.h\"\r\n#include \"CWin32ReadFileStream.h\"\r\n#include \"CSockReadStream.h\"\r\n#include \"CWin32HttpStream.h\"\r\n#include \"CWin32Audio.h\"\r\n#include \"CWin32PathConv.h\"\r\n#include \"CWin32TmpFile.h\"\r\n\r\n#pragma comment(lib, \"Rpcrt4.lib\")\r\n#pragma comment(lib, \"libeay32.lib\")\r\n\r\n#include \"FontRendering.h\"\r\n\r\nbool CWin32Platform::g_useDecryption = false;\r\n\r\nvoid CWin32Platform::setEncrypt(bool encrypt) {\r\n\tg_useDecryption = encrypt;\r\n}\r\n\r\nCWin32Platform::CWin32Platform(HWND hWnd)\r\n: IPlatformRequest  ()\r\n, m_hWnd            (hWnd)\r\n, m_version_string  (NULL)\r\n, m_bNoDefaultFont  (false)\r\n{\r\n\t// WinSock 初期化\r\n\tWSADATA wsaData;\r\n\tWSAStartup(MAKEWORD(2, 0), &wsaData);\r\n\tm_hDC = GetDC(m_hWnd);\r\n\r\n\t// OSとバージョンをあらわす文字列を作っておく\r\n\tm_version_string = create_version_string();\r\n}\r\n\r\nCWin32Platform::~CWin32Platform()\r\n{\r\n\tdelete [] m_version_string;\r\n\r\n\tReleaseDC(m_hWnd, m_hDC);\r\n\t// WinSock 後始末\r\n\tWSACleanup();\r\n}\r\n\r\nconst char *\r\nCWin32Platform::create_version_string()\r\n{\r\n\tchar buf[4096];\r\n\tOSVERSIONINFO verInfo;\r\n\tTIME_ZONE_INFORMATION tzInfo;\r\n\tchar * OSlabel;\r\n\r\n\t// Win32 API でOSのバージョンを取得する。\r\n\tmemset(&verInfo, 0, sizeof(OSVERSIONINFO));\r\n\tverInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);\r\n\tGetVersionEx(&verInfo);\r\n\r\n\tswitch(verInfo.dwPlatformId)\r\n\t{\r\n\tcase VER_PLATFORM_WIN32_NT:\t\t\tOSlabel = \"WinNT\";\t\tbreak;\r\n\tcase VER_PLATFORM_WIN32_WINDOWS:\tOSlabel = \"Windows\";\tbreak;\r\n\tdefault:\t                        OSlabel = \"unknown\";\tbreak;\r\n\t}\r\n\r\n\t// Win32 API で、動作環境のタイムゾーンを取得する。\r\n\tmemset(&tzInfo, 0, sizeof(TIME_ZONE_INFORMATION));\r\n\tGetTimeZoneInformation(&tzInfo);\r\n\r\n\t// Win32 APIは各国語でTimezone名を返すので、そこを何とかせんといかんのですが、\r\n\t// どうするかは後で考えます。とりあえずこの場はJST固定で実装。\r\n\r\n\tsprintf(buf,\r\n\t\t\t\"Win32;%s %d.%d.%d/%s;JST\",\r\n\t\t\tOSlabel,\r\n\t\t\tverInfo.dwMajorVersion, verInfo.dwMinorVersion, verInfo.dwBuildNumber,\r\n\t\t\tverInfo.szCSDVersion);\r\n\r\n\tint len = strlen(buf);\r\n\r\n\tchar * ver = new char [ len + 1 ];\r\n\tstrcpy(ver, buf);\r\n\r\n\treturn (const char *)ver;\r\n}\r\n\r\nconst char *\r\nCWin32Platform::getPlatform()\r\n{\r\n\t// 生成済みのバージョン文字列を返す\r\n\treturn m_version_string;\r\n}\r\n\r\nu32 CWin32Platform::getPhysicalMemKB() {\r\n\t// Do not want to mess with WMI (Windows Management Instrumentation)\r\n\t// We will return a \"virtual\" 4 GB RAM memory computer.\r\n\treturn 4 << (10 + 10);\r\n}\r\n\r\nvoid\r\nCWin32Platform::detailedLogging(const char * /*basefile*/, const char * /*functionName*/, int /*lineNo*/, const char * format, ...)\r\n{\r\n\tva_list\tap;\r\n\tchar log\t[1024];\r\n\r\n\tva_start(ap, format);\r\n\tvsprintf_s( log,1024, format, ap);\r\n\tva_end(ap);\r\n\tstrcat(log, \"\\n\");\r\n\r\n\t// 生成された文字列は utf8 文字列であるはずなので、\r\n\t// 出力用にShiftJIS変換する\r\n\tconst char * sjisStr = utf8toSJIS(log);\r\n\r\n\t// 生成した文字列を何らかの方法で出力する\r\n\tOutputDebugString(sjisStr);\r\n\tprintf(\"%s\", sjisStr);\r\n\tdelete [] sjisStr;\r\n}\r\n\r\nvoid\r\nCWin32Platform::logging(const char * format, ...)\r\n{\r\n\tva_list\tap;\r\n\tchar log\t[1024];\r\n\r\n\tva_start(ap, format);\r\n\tvsprintf_s( log,1024, format, ap);\r\n\tva_end(ap);\r\n\tstrcat(log, \"\\n\");\r\n\r\n\t// 生成された文字列は utf8 文字列であるはずなので、\r\n\t// 出力用にShiftJIS変換する\r\n\tconst char * sjisStr = utf8toSJIS(log);\r\n\r\n\t// 生成した文字列を何らかの方法で出力する\r\n\tOutputDebugString(sjisStr);\r\n\tprintf(\"%s\", sjisStr);\r\n\tdelete [] sjisStr;\r\n}\r\n\r\ns64\r\nCWin32Platform::nanotime()\r\n{\r\n\tLARGE_INTEGER counter;\r\n\tLARGE_INTEGER freq;\r\n\r\n\tQueryPerformanceFrequency(&freq);\r\n\tQueryPerformanceCounter(&counter);\r\n\ts64 val = counter.QuadPart * 1000000000LL / freq.QuadPart;\r\n\treturn val;\r\n}\r\n\r\nconst char*\r\nCWin32Platform::getBundleVersion() {\r\n    return \"0.0\";\r\n}\r\n\r\nbool CWin32Platform::useEncryption() {\r\n\treturn g_useDecryption;\r\n}\r\n\r\nIReadStream *\r\nCWin32Platform::openReadStream(const char* pathname, bool decrypt)\r\n{\r\n\tif(!strncmp(pathname, \"file://\", 7)) {\r\n\t\t// ファイルストリーム\r\n\t\tCWin32ReadFileStream * pRds = CWin32ReadFileStream::openStream(pathname + 7, 0);\r\n\t\tif (decrypt) { pRds->decryptSetup((const u8*)pathname + 7); }\r\n\t\treturn pRds;\r\n\t}\r\n\tif(!strncmp(pathname, \"asset://\", 8)) {\r\n\t\tCWin32ReadFileStream * pRds = CWin32ReadFileStream::openStream(pathname, 0);\r\n\t\tif (decrypt) { pRds->decryptSetup((const u8*)pathname + 8); }\r\n\t\treturn pRds;\r\n\t}\r\n\tif(!strncmp(pathname, \"socket://\", 9)) {\r\n\t\t// ソケットストリーム\r\n\t\tCSockReadStream * pRds = CSockReadStream::openStream(pathname + 9);\r\n\t\treturn pRds;\r\n\t}\r\n\tif(!strncmp(pathname, \"http://\", 7)) {\r\n\t\tCWin32HttpStream * pRds = CWin32HttpStream::openStream(pathname, 0);\r\n\t\treturn pRds;\r\n\t}\r\n\tif(!strncmp(pathname, \"https://\", 8)) {\r\n\t\tCWin32HttpStream * pRds = CWin32HttpStream::openStream(pathname, 0);\r\n\t\treturn pRds;\r\n\t}\r\n\t\r\n\treturn NULL;\r\n}\r\n\r\nITmpFile *\r\nCWin32Platform::openTmpFile(const char * filePath)\r\n{\r\n\t// file://external/ 以外が指定された場合は処理を行わない。\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(filePath, target, len)) {\r\n\t\tCWin32TmpFile * pTmpFile = new CWin32TmpFile(filePath);\r\n\t\tif(!pTmpFile->isReady()) {\r\n\t\t\tdelete pTmpFile;\r\n\t\t\tpTmpFile = NULL;\r\n\t\t}\r\n\t\treturn pTmpFile;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n#include \"FileDelete.h\"\r\n\r\nconst char* getFullNativePath(const char* path) {\r\n\treturn CWin32PathConv::getInstance().fullpath(path + 7);\r\n}\r\n\r\nbool\r\nCWin32Platform::removeFileOrFolder(const char* filePath) {\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(filePath, target, len)) {\r\n\t\treturn deleteFiles(filePath);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid removeTmpFileNative(const char* filePath) {\r\n\tchar* pathStr = (char*)filePath;\r\n\twhile (*pathStr != 0) {\r\n\t\tif (*pathStr == '/') {\r\n\t\t\t*pathStr = '\\\\';\r\n\t\t}\r\n\t\tpathStr++;\r\n\t}\r\n\r\n\tbool res = DeleteFile(filePath);\r\n\tif (!res) {\r\n\t\tu32 code = GetLastError();\r\n\t\tif (code == ERROR_ACCESS_DENIED) {\r\n\t\t\tres = RemoveDirectory(filePath);\r\n\t\t\tif (!res) {\r\n\t\t\t\tklb_assertAlways(\"COULD NOT DELETE THE FILE %s !!!\",filePath);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (code == ERROR_FILE_NOT_FOUND) {\r\n\t\t\tklb_assertAlways(\"FILE DOES NOT EXIST %s !!!\",filePath);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nu32 CWin32Platform::getFreeSpaceExternalKB() {\r\n\tconst char * fullpath = CWin32PathConv::getInstance().fullpath(\"external/\");\r\n\tchar* patch = (char*)&fullpath[3]; // e:/\r\n\t*patch = 0;\r\n\tULARGE_INTEGER FreeByteCaller;\r\n\tULARGE_INTEGER TotalByte;\r\n\tULARGE_INTEGER FreeByteTotal;\r\n\t \r\n\tBOOL success = GetDiskFreeSpaceEx(fullpath, &FreeByteCaller, &TotalByte, &FreeByteTotal);\r\n\tu32 result = 0;\r\n\tif (success) {\r\n\t\ts64 r = FreeByteCaller.QuadPart;\r\n\t\tr >>= 10; // Into KB, round down !\r\n\t\tif (r > 0x00FFFFFFLL) {\r\n\t\t\tr = 0x00FFFFFF;\r\n\t\t}\r\n\t\tresult = (u32)r;\r\n\t}\r\n\tdelete [] fullpath;\r\n\treturn result;\r\n}\r\n\r\nvoid\r\nCWin32Platform::removeTmpFile(const char * filePath)\r\n{\r\n\t// file://external/ 以外が指定された場合は処理を行わない。\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(filePath, target, len)) {\r\n\t\tconst char * fullpath = CWin32PathConv::getInstance().fullpath(filePath + 7);\r\n\t\tremoveTmpFileNative(fullpath);\r\n\t\tdelete [] fullpath;\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Platform::excludePathFromBackup(const char * /*fullpath*/)\r\n{\r\n}\r\n\r\nvoid *\r\nCWin32Platform::loadAudio(const char* url, bool /*is_se*/)\r\n{\r\n\tint i;\r\n\tfor(i = 0; i < SND_SLOT; i++) {\r\n        if(m_audio[i].isActive()) { continue; }\r\n\t\tbool bResult = m_audio[i].openAudio(url);\r\n\t\treturn (bResult) ? (void *)&m_audio[i] : 0;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nbool\r\nCWin32Platform::setBufSize(void* /*handle*/, int /*level*/)\r\n{\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCWin32Platform::preLoad(void* handle)\r\n{\r\n    if(!handle) { return false; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\treturn audio->loadMem();\r\n}\r\n\r\n\r\nvoid\r\nCWin32Platform::playAudio(void* handle, s32 _msec, float _tgtVol, float _startVol)\r\n{\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->play(_msec, _tgtVol, _startVol);\r\n}\r\n\r\n\r\nvoid\r\nCWin32Platform::stopAudio(void* handle, s32 _msec, float _tgtVol)\r\n{\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->stop(_msec, _tgtVol);\r\n}\r\n\r\nvoid\r\nCWin32Platform::setAudioVolume(void * handle, float volume)\r\n{\r\n\t// ToDO\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->setVolume(volume);\r\n}\r\n\r\nvoid\r\nCWin32Platform::setAudioPan(void * handle, float pan)\r\n{\r\n\t// ToDO\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->setPan(pan);\r\n}\r\n\r\nvoid\r\nCWin32Platform::setMasterVolume(float volume, bool SEmode)\r\n{\r\n\tCWin32Audio::setMasterVolume(volume, SEmode);\r\n\tfor(int i = 0; i < SND_SLOT; i++) {\r\n        if(m_audio[i].isActive()) { m_audio[i].updateVolume(); }\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Platform::releaseAudio(void* handle)\r\n{\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->closeAudio();\r\n}\r\n\r\nvoid\r\nCWin32Platform::pauseAudio(void * handle, s32 _msec, float _tgtVol)\r\n{\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->pause(_msec, _tgtVol);\r\n}\r\n\r\nvoid\r\nCWin32Platform::resumeAudio(void * handle, s32 _msec, float _tgtVol)\r\n{\r\n    if(!handle) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\taudio->resume(_msec, _tgtVol);\r\n}\r\nvoid\r\nCWin32Platform::seekAudio(void * /*handle*/, s32 /*millisec*/)\r\n{\r\n\r\n}\r\n\r\ns32\r\nCWin32Platform::tellAudio(void * handle)\r\n{\r\n    if(!handle) { return 0; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\treturn audio->tell();\r\n}\r\n\r\ns32\r\nCWin32Platform::totalTimeAudio(void * handle)\r\n{\r\n    if(!handle) { return 0; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\treturn audio->totalPlayTime();\r\n}\r\n\r\ns32\r\nCWin32Platform::getState(void * handle)\r\n{\r\n    if(!handle) { return -1; }\r\n\tCWin32Audio * audio = (CWin32Audio *)handle;\r\n\treturn audio->getState();\r\n}\r\n\r\nvoid\r\nCWin32Platform::setFadeParam(void * _handle, float _tgtVol, u32 _msec)\r\n{\r\n    if( !_handle ) { return; }\r\n\tCWin32Audio * audio = (CWin32Audio*)_handle;\r\n\taudio->setFadeParam( _tgtVol, _msec );\r\n}\r\n\r\n/*!\r\n\t@brief\t経過時間を取得\r\n\t@param[in]\tvoid\r\n\t@return\t\ts64\r\n*/\r\ns64 CWin32Platform::getElapsedTime( void )\r\n{\r\n\tLARGE_INTEGER counter;\r\n\tLARGE_INTEGER freq;\r\n\r\n\tQueryPerformanceFrequency(&freq);\r\n\tQueryPerformanceCounter(&counter);\r\n\r\n\ts64 val = counter.QuadPart / freq.QuadPart;\r\n\treturn val;\r\n}\r\n\r\nbool CWin32Platform::registerFont(const char* logicalName, const char* physFile, bool default_) {\r\n\t// Return always true if we disabled default font to avoid ASSERT at startup.\r\n\treturn FontObject::registerFont(logicalName, physFile, default_) | m_bNoDefaultFont;\r\n}\r\n\r\nvoid *\r\nCWin32Platform::getFont(int size, const char * fontName, float* pAscent)\r\n{\r\n\tFontObject* pFont = FontObject::createFont(fontName, size);\r\n\tif (pFont) {\r\n\t\t// pFont->\r\n\t\tif (pAscent) {\r\n\t\t\t*pAscent = pFont->getAscent();\r\n\t\t}\r\n\t}\r\n\treturn pFont;\r\n}\r\n\r\nvoid\r\nCWin32Platform::deleteFont(void * pFont)\r\n{\r\n\tFontObject::destroyFont((FontObject*)pFont);\r\n}\r\n\r\nvoid *\r\nCWin32Platform::getFontSystem(int size, const char * fontName)\r\n{\r\n\ttry {\r\n\t\tCWin32Font * pFont = new CWin32Font(m_hDC, size, fontName);\r\n\t\treturn (void *)pFont;\r\n\t} catch(...) {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Platform::deleteFontSystem(void * pFont)\r\n{\r\n\tCWin32Font * f_pFont = (CWin32Font *)pFont;\r\n\tdelete f_pFont;\r\n}\r\n\r\nbool\r\nCWin32Platform::renderText(const char* utf8String, void * pFont, u32 color,\r\n\t\t\t\t\t\t   u16 width, u16 height, u8 * pBuffer8888,\r\n\t\t\t\t\t\t   s16 stride, s16 base_x, s16 base_y, bool use4444)\r\n{\r\n\tFontObject* pObjFont = (FontObject*)pFont;\r\n\tif (pObjFont) {\r\n\t\tpObjFont->renderText(base_x, base_y, utf8String, pBuffer8888, color, width, height, stride, use4444);\r\n\t}\r\n\treturn true;\r\n}\r\n\r\n\r\nbool\r\nCWin32Platform::getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo)\r\n{\r\n\tFontObject* pF = (FontObject*)pFont;\r\n\tif (pF) {\r\n\t\tpF->getTextInfo(utf8String, pReturnInfo);\r\n\t} else {\r\n\t\tpReturnInfo->ascent\t\t= 0.0f;\r\n\t\tpReturnInfo->descent\t= 0.0f;\r\n\t\tpReturnInfo->bottom\t\t= 0.0f;\r\n\t\tpReturnInfo->top\t\t= 0.0f;\r\n\t\tpReturnInfo->width\t\t= 0.0f;\r\n\t\tpReturnInfo->height\t\t= 0.0f;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\n void *\r\nCWin32Platform::getGLExtension(const char * /*ext*/)\r\n {\r\n\t// Not implemented\r\n\t klb_assertAlways(\"Not used and not implemented\");\r\n\treturn NULL;\r\n }\r\n\r\nconst char *\r\nCWin32Platform::utf8toSJIS(const char * utf8str)\r\n{\r\n\t// UTF-8 は、一文字最長3バイト(日本語の場合)\r\n\t// Shift_JIS は、一文字最長2バイト。\r\n\t// 同じ文字列のバッファサイズが、utf-8より長くなることはない。\r\n\tsize_t sizeBuffer = strlen(utf8str) + 1;\r\n\tLPWSTR pwszBuf = new wchar_t [ sizeBuffer ];\r\n\tchar * lastbuf = new char [ sizeBuffer ];\r\n\tklb_assert(0 != lastbuf, \"string conv buf not enough memory.\");\r\n\r\n\tMultiByteToWideChar(\r\n\t\tCP_UTF8,\r\n\t\t0,\r\n\t\tutf8str,\r\n\t\t-1,\r\n\t\tpwszBuf,\r\n\t\t(int)sizeBuffer);\r\n\r\n\tWideCharToMultiByte(\r\n\t\tCP_ACP,\r\n\t\t0,\r\n\t\tpwszBuf,\r\n\t\t-1,\r\n\t\tlastbuf,\r\n\t\t(int)sizeBuffer,\r\n\t\tNULL,\r\n\t\tNULL);\r\n\tdelete [] pwszBuf;\r\n\r\n\treturn (const char *)lastbuf;\r\n}\r\n\r\nconst char *\r\nCWin32Platform::SJIStoUTF8(const char * SJISstr)\r\n{\r\n\t// UTF-8 は、一文字最長3バイト(日本語の場合)\r\n\t// Shift_JIS は、一文字最長2バイト。\r\n\t// 同じ文字列のバッファサイズが、utf-8より長くなることはない。\r\n\tsize_t sizeBuffer = strlen(SJISstr) * 3 / 2 + 1;\t// 1.5倍のバッファサイズ\r\n\tLPWSTR pwszBuf = new wchar_t [ sizeBuffer ];\r\n\tchar * lastbuf = new char [ sizeBuffer ];\r\n\tklb_assert(0 != lastbuf, \"string conv buf not enough memory.\");\r\n\r\n\tMultiByteToWideChar(\r\n\t\tCP_ACP,\r\n\t\t0,\r\n\t\tSJISstr,\r\n\t\t-1,\r\n\t\tpwszBuf,\r\n\t\t(int)sizeBuffer);\r\n\r\n\tWideCharToMultiByte(\r\n\t\tCP_UTF8,\r\n\t\t0,\r\n\t\tpwszBuf,\r\n\t\t-1,\r\n\t\tlastbuf,\r\n\t\t(int)sizeBuffer,\r\n\t\tNULL,\r\n\t\tNULL);\r\n\tdelete [] pwszBuf;\r\n\r\n\treturn (const char *)lastbuf;\r\n}\r\n\r\n\r\nconst char *\r\nCWin32Platform::getFullPath(const char * assetPath, bool* isReadOnly)\r\n{\r\n\tCWin32PathConv& pathconv = CWin32PathConv::getInstance();\r\n\r\n\tif(!strncmp(assetPath, \"file://\", 7)) {\r\n\t\t// ファイルストリーム\r\n\t\treturn pathconv.fullpath(assetPath + 7,0,isReadOnly);\r\n\t}\r\n\tif(!strncmp(assetPath, \"asset://\", 8)) {\r\n\t\treturn pathconv.fullpath(assetPath,0,isReadOnly);\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n\r\n\r\nIWidget *\r\nCWin32Platform::createControl(IWidget::CONTROL type, int id,\r\n\t\t\t\t\t\t\t  const char * caption, int x, int y, int width, int height, ...)\r\n{\r\n\tIWidget * pWidget = NULL;\r\n\tva_list ap;\r\n\tva_start(ap, height);\r\n\tswitch(type)\r\n\t{\r\n\tcase IWidget::TEXTBOX:\r\n\tcase IWidget::PASSWDBOX:\r\n\t\t{\r\n\t\t\tint maxlen = va_arg(ap, int);\r\n\t\t\tCWin32TextWidget * pTextWidget = new CWin32TextWidget(this, maxlen);\r\n\t\t\tif(!pTextWidget || !pTextWidget->create(type, id, caption, x, y, width, height)) {\r\n\t\t\t\tdelete pTextWidget;\r\n\t\t\t\tpTextWidget = NULL;\r\n\t\t\t}\r\n\t\t\tpWidget = pTextWidget;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase IWidget::WEBVIEW:\r\n\tcase IWidget::WEBNOJUMP:\r\n\t\t{\r\n\t\t\tconst char * token  = va_arg(ap, const char *);\r\n\t\t\tconst char * region = va_arg(ap, const char *);\r\n\t\t\tconst char * client = va_arg(ap, const char *);\r\n\t\t\tconst char * cKey   = va_arg(ap, const char *);\r\n\t\t\tconst char * appID  = va_arg(ap, const char *);\r\n\t\t\tconst char * userID\t= va_arg(ap, const char *);\r\n\r\n\t\t\tCWin32WebWidget * pWebWidget = new CWin32WebWidget(this);\r\n\t\t\tif(!pWebWidget || !pWebWidget->create(type, id, caption, x, y, width, height,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  token, region, client, cKey, appID, userID)) {\r\n\t\t\t\tdelete pWebWidget;\r\n\t\t\t\tpWebWidget = NULL;\r\n\t\t\t}\r\n\t\t\tpWidget = pWebWidget;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase IWidget::MOVIEPLAYER:\r\n\tcase IWidget::BGMOVIEPLAYER:\r\n\t\t{\r\n\t\t\tCWin32MovieWidget * pMovieWidget = new CWin32MovieWidget(this);\r\n\t\t\tif(!pMovieWidget || !pMovieWidget->create(type, id, caption, x, y, width, height)) {\r\n\t\t\t\tdelete pMovieWidget;\r\n\t\t\t\tpMovieWidget = NULL;\r\n\t\t\t}\r\n\t\t\tpWidget = pMovieWidget;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase IWidget::ACTIVITYINDICATOR:\r\n\t\t{\r\n\t\t\tCWin32ActivityIndicator * pActIWidget = new CWin32ActivityIndicator(this);\r\n\t\t\tif(!pActIWidget || !pActIWidget->create(type, id, caption, x, y, width, height)) {\r\n\t\t\t\tdelete pActIWidget;\r\n\t\t\t\tpActIWidget = NULL;\r\n\t\t\t}\r\n\t\t\tpWidget = pActIWidget;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn pWidget;\r\n}\r\n\r\nvoid\r\nCWin32Platform::destroyControl(IWidget * pControl)\r\n{\r\n\tdelete pControl;\r\n}\r\n\r\n\r\nbool\r\nCWin32Platform::callApplication(IPlatformRequest::APP_TYPE type, ... )\r\n{\r\n\tbool result = true;\r\n\tva_list ap;\r\n\tva_start(ap, type);\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\tresult = false;\r\n\t\tbreak;\r\n\r\n\tcase IPlatformRequest::APP_UPDATE:\r\n\t\t{\r\n\t\t\tconst char * search_key = va_arg(ap, const char *);\r\n\t\t\tMessageBox(m_hWnd, search_key, \"CALL Application\", MB_OK);\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\tva_end(ap);\r\n\treturn result;\r\n}\r\n\r\nCWin32Font::CWin32Font(HDC hDC, int size, const char * fontname) : m_size(size)\r\n{\r\n\t// 指定されたフォント名から実際にAPIに渡すフォント名を得る\r\n\r\n\t// サイズからフォントを生成\r\n\tmemset((void *)&m_logfont, 0, sizeof(LOGFONT));\r\n\tm_logfont.lfCharSet = DEFAULT_CHARSET;\r\n\tm_logfont.lfHeight = (LONG)size;\r\n\r\n\t// 指定されたフォント名があれば、設定する。\r\n    if(fontname) { strcpy( m_logfont.lfFaceName, fontname); }\r\n\r\n\tm_hFont = CreateFontIndirect(&m_logfont);\r\n\r\n\tTEXTMETRIC metric;\r\n\t// フォントの metrics を取得\r\n\r\n\t// font metric はフォントそのものではなく、\r\n\t// フォントが適用されている DCから取得するため、\r\n\t// 上記で生成したフォントを hDC のフォントとして選択してやらねばならない。\r\n\t// そうしないと、直前に設定されたフォントのmetricを拾ってしまう。\r\n\tSelectObject(hDC, m_hFont);\r\n\r\n\r\n\tGetTextMetrics(hDC, &metric);\r\n\tm_ascent    = (float)metric.tmAscent;\r\n\tm_descent   = -(float)metric.tmDescent;\r\n\tm_top       = m_ascent + (metric.tmHeight - (m_ascent - m_descent)) / 3.0f;\r\n\tm_bottom    = m_top - metric.tmHeight;\r\n}\r\n\r\nCWin32Font::~CWin32Font()\r\n{\r\n\tDeleteObject(m_hFont);\r\n}\r\n\r\n// 直接OSから呼ばれる thread 関数。\r\n// 内容的には、各ワークに保存された関数ポインタを呼び出す\r\nDWORD WINAPI\r\nCWin32Platform::ThreadProc(LPVOID lpParam)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)lpParam;\r\n\tif(!(pThread->result = setjmp(pThread->jmp))) {\r\n\t\tpThread->result = (pThread->thread_func)(pThread, pThread->data);\r\n\t}\r\n\tExitThread(TRUE);\r\n}\r\n\r\n// スレッドを作る。\r\nvoid *\r\nCWin32Platform::createThread(s32 (*thread_func)(void *, void *), void *data)\r\n{\r\n\tPF_THREAD * thread = new PF_THREAD;\r\n    if(!thread) { return NULL; }\r\n\r\n\tthread->data        = data;\r\n\tthread->thread_func = thread_func;\r\n\tthread->result      = 0;\r\n\r\n\t// Windowsのthreadは、CWin32Platform::ThreadProc() を呼ぶように作る。\r\n\tthread->hWin32Thread = CreateThread(\r\n\t\tNULL , 0 , CWin32Platform::ThreadProc , thread, 0 , &(thread->idWin32Thread));\r\n\r\n\treturn thread;\r\n}\r\n\r\n// スレッドの中から呼ばれる、スレッドを中断する関数\r\nvoid\r\nCWin32Platform::exitThread(void * hThread, s32 status)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tlongjmp(pThread->jmp, status);\r\n}\r\n\r\n// スレッドの外から呼ばれる、スレッドの状態を取得する関数\r\nbool\r\nCWin32Platform::watchThread(void * hThread, s32 * status)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tDWORD dwParam;\r\n\tGetExitCodeThread(pThread->hWin32Thread, &dwParam);\r\n\tif(dwParam == STILL_ACTIVE) {\r\n\t\t// スレッドは実行中\r\n\t\treturn true;\r\n\t}\r\n\t// スレッドは終了しているので、終了コードを *status に返す\r\n\t*status = pThread->result;\r\n\treturn false;\t// スレッド終了なので false を返す\r\n}\r\n\r\n// スレッドを破棄する。\r\nvoid\r\nCWin32Platform::deleteThread(void * hThread)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tCloseHandle( pThread->hWin32Thread );\r\n\tdelete pThread;\r\n}\r\n\r\n// スレッドを強制中断する\r\nvoid\r\nCWin32Platform::breakThread(void * hThread)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tTerminateThread(pThread->hWin32Thread, 0);\r\n}\r\n\r\nint\r\nCWin32Platform::genUserID(char * retBuf, int maxlen)\r\n{\r\n\tunsigned char * p;\r\n\tUUID uuid;\r\n\t::UuidCreate(&uuid);\r\n\t::UuidToString(&uuid, &p);\r\n\r\n\tint i = 0;\r\n    for(i = 0; i < maxlen - 1 && p[i]; i++) { retBuf[i] = p[i]; }\r\n\tretBuf[i] = 0;\r\n\r\n\t::RpcStringFree(&p);\r\n\r\n\treturn i;\r\n}\r\n\r\nint\r\nCWin32Platform::genUserPW(const char * salt, char * retbuf, int maxlen)\r\n{\r\n\tchar buf[1024];\r\n\ttime_t tm;\r\n\tint rnd = rand();\r\n\ttime(&tm);\r\n\tsprintf(buf, \"%d.%ld.%s\", rnd, (u32)tm, salt);\r\n\treturn sha512(buf, retbuf, maxlen);\r\n}\r\n\r\nbool\r\nCWin32Platform::readyDevID()\r\n{\r\n\treturn true;\t// 常にデバイスID取得処理は完了したことにする\r\n}\r\n\r\nint\r\nCWin32Platform::getDevID(char * /*retBuf*/, int /*maxlen*/)\r\n{\r\n\treturn 0;\t// 常にデバイスID取得に失敗したことにする\r\n}\r\n\r\nbool\r\nCWin32Platform::setSecureDataID(const char * service_name, const char * user_id)\r\n{\r\n\treturn setKeyChain(service_name, \"user_id\", user_id);\r\n}\r\n\r\nbool\r\nCWin32Platform::setSecureDataPW(const char * service_name, const char * passwd)\r\n{\r\n\treturn setKeyChain(service_name, \"passwd\", passwd);\r\n}\r\n\r\nint\r\nCWin32Platform::getSecureDataID(const char * service_name, char * retBuf, int maxlen)\r\n{\r\n\treturn getKeyChain(service_name, \"user_id\", retBuf, maxlen);\r\n}\r\n\r\nint\r\nCWin32Platform::getSecureDataPW(const char * service_name, char * retBuf, int maxlen)\r\n{\r\n\treturn getKeyChain(service_name, \"passwd\", retBuf, maxlen);\r\n}\r\n\r\nbool\r\nCWin32Platform::delSecureDataID(const char * service_name)\r\n{\r\n\treturn delKeyChain(service_name, \"user_id\");\r\n}\r\n\r\nbool\r\nCWin32Platform::delSecureDataPW(const char * service_name)\r\n{\r\n\treturn delKeyChain(service_name, \"passwd\");\r\n}\r\n\r\n\r\nint\r\nCWin32Platform::sha512(const char * string, char * buf, int maxlen)\r\n{\r\n\tunsigned char obuf[64];\r\n\tSHA512((const unsigned char *)string, strlen(string), obuf);\r\n\tchar * ptr = buf;\r\n\tfor(int i = 0; i < 64 && (i * 2 + 1 < maxlen); i++) {\r\n\t\tsprintf(ptr, \"%02x\", obuf[i]);\r\n\t\tptr += strlen(ptr);\r\n\t}\r\n\treturn strlen(buf);\r\n}\r\n\r\nbool\r\nCWin32Platform::setKeyChain(const char * service_name, const char * key, const char * value)\r\n{\r\n\tbool result = true;\r\n\tCWin32KeyChain keychain;\r\n\r\n\tkeychain.loadKeyChain(W32_KEYCHAIN_FILENAME);\r\n\tresult = keychain.setValue(service_name, key, value);\r\n\treturn result && keychain.saveKeyChain(W32_KEYCHAIN_FILENAME);\r\n}\r\n\r\nint\r\nCWin32Platform::getKeyChain(const char * service_name, const char * key, char * retBuf, int maxlen)\r\n{\r\n\tCWin32KeyChain keychain;\r\n\r\n\tkeychain.loadKeyChain(W32_KEYCHAIN_FILENAME);\r\n\tconst char * value = keychain.getValue(service_name, key);\r\n\tif(!value) return 0;\r\n\tint i = 0;\r\n    for(i = 0; i < maxlen - 1 && value[i]; i++) { retBuf[i] = value[i]; }\r\n\tretBuf[i] = 0;\r\n\treturn i;\r\n}\r\n\r\nbool\r\nCWin32Platform::delKeyChain(const char * service_name, const char * key)\r\n{\r\n\tCWin32KeyChain keychain;\r\n\r\n\tkeychain.loadKeyChain(W32_KEYCHAIN_FILENAME);\r\n\tbool bResult = keychain.delValue(service_name, key);\r\n\treturn bResult && keychain.saveKeyChain(W32_KEYCHAIN_FILENAME);\r\n}\r\n\r\nvoid\r\nCWin32Platform::initStoreTransactionObserver()\r\n{\r\n}\r\n\r\nvoid\r\nCWin32Platform::releaseStoreTransactionObserver()\r\n{\r\n}\r\n\r\nvoid\r\nCWin32Platform::buyStoreItems(const char * /*item_id*/)\r\n{\r\n}\r\n\r\nvoid\r\nCWin32Platform::getStoreProducts(const char* /*json*/, bool /*currency_mode*/)\r\n{\r\n}\r\n\r\nvoid\r\nCWin32Platform::finishStoreTransaction(const char* /*receipt*/)\r\n{\r\n}\r\n\r\nvoid*\t\tCWin32Platform::ifopen\t(const char* name, const char* mode) {\r\n\treturn fopen(name, mode);\r\n}\r\n\r\nvoid\t\tCWin32Platform::ifclose\t(void* file) {\r\n\tif (file) {\r\n\t\tfclose((FILE*)file);\r\n\t}\r\n}\r\n\r\nint\t\t\tCWin32Platform::ifseek\t(void* file, long int offset, int origin) {\r\n\treturn fseek((FILE*)file,offset,origin);\r\n}\r\n\r\nu32\t\t\tCWin32Platform::ifread\t(void* ptr, u32 size, u32 count, void* file ) {\r\n\treturn fread(ptr, size, count, (FILE*)file);\r\n}\r\n\r\nu32\t\t\tCWin32Platform::ifwrite\t(const void * ptr, u32 size, u32 count, void* file) {\r\n\treturn fwrite(ptr, size, count, (FILE*)file);\r\n}\r\n\r\nint\t\t\tCWin32Platform::ifflush\t(void* file) {\r\n\treturn fflush((FILE*)file);\r\n}\r\n\r\nlong int\tCWin32Platform::iftell\t(void* file) {\r\n\treturn ftell((FILE*)file);\r\n}\r\n\r\nbool CWin32Platform::icreateEmptyFile(const char* name) {\r\n\tFILE* f = fopen(name,\"a\");\r\n\tif (f) {\r\n\t\tfclose(f);\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid*\tCWin32Platform::allocMutex\t\t()\r\n{\r\n\tCRITICAL_SECTION* pSection = new CRITICAL_SECTION();\r\n\tif (pSection) {\r\n\t\tInitializeCriticalSection(pSection);\r\n\t}\r\n\treturn pSection;\r\n}\r\n\r\nvoid\tCWin32Platform::freeMutex\t\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tDeleteCriticalSection((CRITICAL_SECTION*)mutex); \r\n\t\tdelete mutex;\r\n\t}\r\n}\r\n\r\nvoid\tCWin32Platform::mutexLock\t\t(void* mutex)\r\n{\r\n\tif (mutex) { EnterCriticalSection((CRITICAL_SECTION*)mutex); }\r\n}\r\n\r\nvoid\tCWin32Platform::mutexUnlock\t\t(void* mutex)\r\n{\r\n\tif (mutex) { LeaveCriticalSection((CRITICAL_SECTION*)mutex); }\r\n}\r\n\r\nvoid*\tCWin32Platform::allocEventLock\t()\r\n{\r\n\tHANDLE* pEvent = new HANDLE();\r\n\tif (pEvent) {\r\n\t\t*pEvent = CreateEvent(NULL,false,false,NULL);\r\n\t}\r\n\treturn pEvent;\r\n}\r\n\r\nvoid\tCWin32Platform::freeEventLock\t(void* lock)\r\n{\r\n\tif (lock) {\r\n\t\tHANDLE* pHandle = (HANDLE*)lock;\r\n\t\tif (*pHandle) {\r\n\t\t\tCloseHandle(*pHandle);\r\n\t\t}\r\n\t\tdelete pHandle;\r\n\t}\r\n}\r\n\r\nvoid\tCWin32Platform::eventSleep\t\t(void* lock)\r\n{\r\n\tif (lock) {\r\n\t\tHANDLE* pHandle = (HANDLE*)lock;\r\n\t\tif (*pHandle) {\r\n\t\t\tWaitForSingleObject( *pHandle , INFINITE );\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\tCWin32Platform::eventWakeup\t\t(void* lock)\r\n{\r\n\tif (lock) {\r\n\t\tHANDLE* pHandle = (HANDLE*)lock;\r\n\t\tif (*pHandle) {\r\n\t\t\tSetEvent(*pHandle);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32Platform.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CWin32Platform_h\r\n#define CWin32Platform_h\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CWin32Audio.h\"\r\n#include \"CWin32Widget.h\"\r\n#include <setjmp.h>\r\n\r\n\r\n#define W32_KEYCHAIN_FILENAME  \"GE_keychain.key\"\r\n\r\n\r\nclass CWin32Platform;\r\n\r\nclass CWin32Font\r\n{\r\n\tfriend class CWin32Platform;\r\npublic:\r\n\tCWin32Font(HDC hDC, int size, const char * fontname = 0);\r\n\tvirtual ~CWin32Font();\r\n\r\n\tinline float ascent\t() const { return m_ascent;\t\t}\r\n\tinline float descent() const { return m_descent;\t}\r\n\tinline float top\t() const { return m_top;\t\t}\r\n\tinline float bottom\t() const { return m_bottom;\t\t}\r\n\r\n\tinline HFONT get_hFont() const { return m_hFont;\t}\r\n\r\nprivate:\r\n\tint\t\tm_size;\r\n\tHFONT\tm_hFont;\r\n\tLOGFONT\tm_logfont;\r\n\r\n\tfloat\tm_ascent;\r\n\tfloat\tm_descent;\r\n\tfloat\tm_top;\r\n\tfloat\tm_bottom;\r\n};\r\n\r\n\r\nclass CWin32Platform : public IPlatformRequest\r\n{\r\n\tfriend class CWin32Font;\r\n\tfriend class CWin32Widget;\r\n\tfriend class CWin32AudioMgr;\r\n\tfriend class CWin32MP3;\r\npublic:\r\n\tCWin32Platform(HWND hWnd);\r\n\tvirtual ~CWin32Platform();\r\n\r\n\t//! Use Encryption for disk I/O\r\n\tvirtual bool useEncryption\t();\r\n\tstatic  void setEncrypt\t\t(bool encrypt);\r\n\r\n\t//! ログ出力\r\n\tvoid detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...);\r\n\tvoid logging(const char * format, ...);\r\n\r\n\t//! ナノ秒時刻取得\r\n\ts64  nanotime();\r\n    \r\n    // バンドルバージョン取得\r\n    const char* getBundleVersion();\r\n\r\n\t//! ストリーム取得\r\n\tIReadStream* openReadStream(const char* fileName, bool decrypt);\r\n\r\n\t//! テンポラリファイルオープン\r\n\tITmpFile *\topenTmpFile\t\t\t (const char * filePath);\r\n\tvoid\t\tremoveTmpFile\t\t (const char * filePath);\r\n\tvirtual bool removeFileOrFolder\t (const char * filePath);\r\n\tvirtual u32\t getFreeSpaceExternalKB();\r\n\tvirtual u32\t getPhysicalMemKB\t ();\r\n\tvoid\t\texcludePathFromBackup(const char * fullpath);\r\n\r\n\tvirtual void*\t\tifopen\t(const char* name, const char* mode);\r\n\tvirtual void\t\tifclose\t(void* file);\r\n\tvirtual int\t\t\tifseek\t(void* file, long int offset, int origin);\r\n\tvirtual u32\t\t\tifread\t(void* ptr, u32 size, u32 count, void* file );\r\n\tvirtual u32\t\t\tifwrite\t(const void * ptr, u32 size, u32 count, void* file);\r\n\tvirtual int\t\t\tifflush\t(void* file);\r\n\tvirtual long int\tiftell\t(void* file);\r\n\tvirtual bool\t\ticreateEmptyFile(const char* name);\r\n\r\n\t//! サウンド\r\n\tvoid*   loadAudio\t\t(const char* url, bool is_se = false);\r\n\tbool\tsetBufSize\t\t(void* handle, int level);\r\n\tbool    preLoad\t\t\t(void* handle);\r\n\tvoid    playAudio\t\t(void* handle, s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 1.0f);\r\n\tvoid    stopAudio\t\t(void* handle, s32 _msec = 0, float _tgtVol = 0.0f);\r\n\tvoid\tsetAudioVolume\t(void * handle, float volume);\r\n\tvoid\tsetAudioPan\t\t(void * handle, float pan);\r\n\tvoid\tsetMasterVolume\t(float volume, bool SEmode);\r\n\tvoid    releaseAudio\t(void* handle);\r\n\r\n\tvoid\tpauseAudio\t\t(void * handle, s32 _msec = 0, float _tgtVol = 0.0f);\r\n\tvoid\tresumeAudio\t\t(void * handle, s32 _msec = 0, float _tgtVol = 1.0f);\r\n\tvoid\tseekAudio\t\t(void * handle, s32 millisec);\r\n\ts32\t\ttellAudio\t\t(void * handle);\r\n\ts32\t\ttotalTimeAudio\t(void * handle);\r\n\r\n\ts32\t\tgetState(void * handle);\r\n\r\n\tvoid\tsetFadeParam(void * _handle, float _tgtVol, u32 _msec);\r\n\r\n\t//! サウンドとミュージックの並行処理タイプ設定\r\n\tvoid setAudioMultiProcessType( s32 /*_processType*/ ) {}\r\n    \r\n    //! サウンドの割り込み処理をエンジン側で制御するかどうか\r\n    void setPauseOnInterruption(bool /*_bPauseOnInterruption*/) {}\r\n\r\n\t//! 経過時間を取得\r\n\ts64 getElapsedTime( void );\r\n\r\n\t//! フォント\r\n\tbool\tregisterFont\t(const char* logicalName, const char* physFile, bool default_);\r\n\tvoid *\tgetFont\t\t\t(int size, const char * fontName = 0, float* pAscent = NULL);\r\n\tvoid\tdeleteFont\t\t(void * pFont);\r\n\tvoid *\tgetFontSystem\t(int size, const char * fontName = 0);\r\n\tvoid\tdeleteFontSystem(void * pFont);\r\n\r\n\t//! テキストレンダリング\r\n\tbool renderText(const char* utf8String, void * pFont, u32 color,\r\n\t\tu16 width, u16 height, u8 * pBuffer8888,\r\n\t\ts16 stride, s16 base_x, s16 base_y, bool use4444 = false);\r\n\tbool getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo);\r\n\r\n\tvoid *\t\t\tgetGLExtension(const char * ext);\r\n\r\n\tconst char *\tgetPlatform();\r\n\r\n\tconst char *\tgetFullPath(const char * assetPath, bool* isReadOnly);\r\n\r\n\r\n\tIWidget * createControl(IWidget::CONTROL type, int id,\r\n\t\t\t\t\t\t const char * caption, int x, int y, int width, int height, ...);\r\n\r\n\tvoid destroyControl(IWidget * pControl);\r\n\r\n\tbool callApplication(APP_TYPE type, ... );\r\n\r\n\tvoid *\tcreateThread\t(s32 (*thread_func)(void * hThread, void * data), void * data);\r\n\tvoid\texitThread\t\t(void * hThread, s32 status);\r\n\tbool\twatchThread\t\t(void * hThread, s32 * status);\r\n\tvoid\tdeleteThread\t(void * hThread);\r\n\tvoid\tbreakThread\t\t(void * hThread);\r\n\r\n\tint\t\tgenUserID\t\t(char * retBuf, int maxlen);\r\n\tint\t\tgenUserPW\t\t(const char * salt, char * retBuf, int maxlen);\r\n\r\n\tbool\treadyDevID\t\t();\r\n\tint\t\tgetDevID\t\t(char * retBuf, int maxlen);\r\n\r\n\tbool\tsetSecureDataID\t(const char * service_name, const char * user_id);\r\n\tbool\tsetSecureDataPW\t(const char * service_name, const char * passwd);\r\n\tint\t\tgetSecureDataID\t(const char * service_name, char * retBuf, int maxlen);\r\n\tint\t\tgetSecureDataPW\t(const char * service_name, char * retBuf, int maxlen);\r\n\r\n\tbool\tdelSecureDataID\t(const char * service_name);\r\n\tbool\tdelSecureDataPW\t(const char * service_name);\r\n\r\n\t//! ストア機能\r\n\tvoid\tinitStoreTransactionObserver\t();\r\n\tvoid\treleaseStoreTransactionObserver\t();\r\n\tvoid\tbuyStoreItems\t(const char * item_id);\r\n\tvoid\tgetStoreProducts(const char * json, bool currency_mode);\r\n\tvoid\tfinishStoreTransaction(const char* receipt);\r\n\r\n\r\n\tinline HWND get_hWnd() const { return m_hWnd; }\r\n\r\n\tvirtual void *\tallocMutex\t\t();\r\n\tvirtual void\tfreeMutex\t\t(void * mutex);\r\n\tvirtual void\tmutexLock\t\t(void * mutex);\r\n\tvirtual void\tmutexUnlock\t\t(void * mutex);\r\n\r\n\tvirtual void *\tallocEventLock\t();\r\n\tvirtual void\tfreeEventLock\t(void * lock);\r\n\tvirtual void\teventSleep\t\t(void * lock);\r\n\tvirtual void\teventWakeup\t\t(void * lock);\r\n\t\r\n\tvoid\tstartAlertDialog( const char* /*title*/ , const char* /*message*/){};\r\n\r\n\tvoid\tsetNoDefaultFont() {\r\n\t\tm_bNoDefaultFont = true;\r\n\t}\r\n\r\n\tinline void forbidSleep(bool is_forbidden) {}\r\n\r\nprivate:\r\n\tbool m_bNoDefaultFont;\r\n\r\n\tstatic bool g_useDecryption;\r\n\r\n\tstruct PF_THREAD {\r\n\t\tjmp_buf jmp;\r\n\t\tHANDLE\thWin32Thread;\r\n\t\tDWORD\tidWin32Thread;\r\n\t\ts32 (*thread_func)(void *, void *);\r\n\t\tvoid * data;\r\n\t\ts32 result;\r\n\t};\r\n\r\n\tint\t\tsha512\t\t(const char * string, char * buf, int maxlen);\r\n\tbool\tsetKeyChain\t(const char * service_name, const char * key, const char * value);\r\n\tint\t\tgetKeyChain\t(const char * service_name, const char * key, char * retBuf, int maxlen);\r\n\tbool\tdelKeyChain\t(const char * service_name, const char * key);\r\n\r\n\tconst char * utf8toSJIS(const char * utf8str);\r\n\tconst char * SJIStoUTF8(const char * SJISstr);\r\n\tconst char * create_version_string();\r\n\r\n\tenum {\r\n\t\tSND_SLOT = 256\r\n\t};\r\n\tCWin32Audio\t\t\tm_audio[ SND_SLOT ];\r\n\tHWND\t\t\t\tm_hWnd;\r\n\tHDC\t\t\t\t\tm_hDC;\r\n\r\n\tconst char\t\t*\tm_version_string;\r\n\r\n\tstatic DWORD WINAPI ThreadProc(LPVOID lpParam);\r\n};\r\n\r\n\r\n#endif // CWin32Platform_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32ReadFileStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CWin32ReadFileStream.cpp\r\n//\r\n#include <Windows.h>\r\n#include <io.h>\r\n#include <fcntl.h>\r\n#include <sys/types.h>\r\n#include <sys/stat.h>\r\n#include <share.h>\r\n#include <stdio.h>\r\n\r\n#include <iostream>\r\n\r\n#include \"Win32FileLocation.h\"\r\n#include \"CWin32PathConv.h\"\r\n#include \"CWin32ReadFileStream.h\"\r\n#include \"CWin32WriteFileStream.h\"\r\n\r\nCWin32ReadFileStream::CWin32ReadFileStream()\r\n: m_bReadOnly   (true)\r\n, m_fd          (-1)\r\n, m_fp          (NULL)\r\n, m_eStat       (CLOSED)\r\n, m_fullpath    (NULL)\r\n, m_writeStream (NULL)\r\n, m_decrypter   ()\r\n{\r\n}\r\n\r\nCWin32ReadFileStream::~CWin32ReadFileStream()\r\n{\r\n\t//if(m_fd > 0) { _close(m_fd); }\r\n    if(m_fp) { fclose(m_fp); }\r\n    m_fd    = -1;\r\n    m_eStat = CLOSED;\r\n    \r\n    delete [] m_fullpath;\r\n}\r\n\r\n\r\nCWin32ReadFileStream *\r\nCWin32ReadFileStream::openStream(const char * path, const char * /*home*/)\r\n{\r\n    CWin32ReadFileStream * pStream = NULL;\r\n    try {\r\n        pStream = new CWin32ReadFileStream();\r\n\t\tif(!pStream){\r\n\t\t\treturn NULL;\r\n\t\t}\r\n        pStream->m_fullpath = NULL;\r\n        \r\n        CWin32PathConv& pathconv = CWin32PathConv::getInstance();\r\n        pStream->m_fullpath      = pathconv.fullpath(path);\r\n\r\n        if(!pStream->m_fullpath) {\r\n            pStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        \r\n\t\tint result = _sopen_s(&(pStream->m_fd), pStream->m_fullpath, _O_RDONLY | _O_BINARY, _SH_DENYRW, 0);\r\n        if(result != 0) {\r\n\t\t\tpStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        pStream->m_fp = _fdopen(pStream->m_fd, \"rb\");\r\n        if(!pStream->m_fp) {\r\n            _close(pStream->m_fd);\r\n            pStream->m_fd = -1;\r\n            pStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        \r\n        pStream->m_eStat = NORMAL;\r\n        return pStream;\r\n        \r\n    } catch(...) {\r\n        delete pStream;\r\n        return NULL;\r\n    }\r\n}\r\n\r\nCWin32ReadFileStream *\r\nCWin32ReadFileStream::openAssets(const char * path, const char * home)\r\n{\r\n\treturn openStream(path, home);\r\n\t// 中身が openStream() と全く同じになってしまったので。\r\n}\r\n\r\ns32 \r\nCWin32ReadFileStream::getSize()\r\n{\r\n    struct _stat file_stats;\r\n    if(_fstat(m_fd, &file_stats) < 0) {\r\n        return -1;\r\n    }\r\n\treturn file_stats.st_size - (m_decrypter.m_useNew ? 4 : 0);\r\n}\r\n\r\ns32\r\nCWin32ReadFileStream::getPosition()\r\n{\r\n    return (s32)(ftell(m_fp) - (m_decrypter.m_useNew ? 4 : 0));\r\n}\r\n\r\nu8       \r\nCWin32ReadFileStream::readU8()\r\n{\r\n\tu8 val = fgetc(m_fp);\r\n\tdecrypt(&val,1);\r\n\treturn (u8)val;\r\n}\r\n\r\nu16      \r\nCWin32ReadFileStream::readU16()\r\n{\r\n\tu8 buf[2];\r\n\tif(1 == fread(buf, 2, 1, m_fp)) {\r\n\t\tdecrypt(buf,2);\r\n\t\tu16 ret = ((u16)buf[0] << 8) | (u16)buf[1];\r\n\t\treturn ret;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nu32      \r\nCWin32ReadFileStream::readU32()\r\n{\r\n\tu8 buf[4];\r\n\tif(1 == fread(buf, 4, 1, m_fp)) {\r\n\t\tdecrypt(buf,4);\r\n\t\tu32 ret = ((u32)buf[0] << 24) | ((u16)buf[1] <<16) | ((u16)buf[2] << 8) | (u16)buf[3];\r\n\t\treturn ret;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nfloat    \r\nCWin32ReadFileStream::readFloat()\r\n{\r\n\tfloat f;\r\n\tif(1 == fread(&f, sizeof(float), 1, m_fp)) {\r\n\t\tdecrypt(&f, sizeof(float));\r\n\t\treturn f;\r\n\t}\r\n\treturn 0.0f;\r\n}\r\n\r\nbool     \r\nCWin32ReadFileStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n\tu32 cnt;\r\n    \r\n\tcnt = fread(buffer, 1, byteSize, m_fp);\r\n\tdecrypt(buffer, cnt);\r\n\treturn (cnt == byteSize) ? true : false; \r\n}\r\n\r\nIReadStream::ESTATUS  \r\nCWin32ReadFileStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\nIWriteStream *  \r\nCWin32ReadFileStream::getWriteStream()\r\n{\r\n    if(m_bReadOnly) { return NULL; }\r\n\tif(!m_writeStream) { \r\n        m_writeStream = new CWin32WriteFileStream(*this);\r\n    }\r\n    return m_writeStream;\r\n}\r\n\r\nint\r\nCWin32ReadFileStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n    int cnt = fread(pBufferU16, sizeof(u16), items, m_fp);\r\n\tdecrypt(pBufferU16,sizeof(u16) * cnt);    \r\n    return cnt;\r\n}\r\n\r\nint\r\nCWin32ReadFileStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n    int cnt = fread(pBufferU32, sizeof(u32), items, m_fp);    \r\n\tdecrypt(pBufferU32,sizeof(u32) * cnt);\r\n    return cnt;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32ReadFileStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CWin32ReadFileStream.h\r\n//\r\n\r\n#ifndef CWin32ReadFileStream_h\r\n#define CWin32ReadFileStream_h\r\n#include <Windows.h>\r\n#include <stdio.h>\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n#include \"encryptFile.h\"\r\n\r\nclass CWin32WriteFileStream;\r\n\r\nclass CWin32ReadFileStream : public IReadStream\r\n{\r\n    friend class CWin32WriteFileStream;\r\nprivate:\r\n    CWin32ReadFileStream();\r\n    \r\n\tCDecryptBaseClass   m_decrypter;\r\n\tinline void decrypt(void* ptr, u32 length) {\r\n        m_decrypter.decryptBlck(ptr, length);\r\n    }\r\npublic:\r\n    virtual ~CWin32ReadFileStream();\r\n\tinline void decryptSetup(const u8* ptr) {\r\n\t\tu8 hdr[4];\r\n\t\thdr[0] = 0;\r\n\t\thdr[1] = 0;\r\n\t\thdr[2] = 0;\r\n\t\thdr[3] = 0;\r\n\t\tif (m_fp) {\r\n\t\t\tfread(hdr, 1, 4, m_fp); \r\n\t\t}\r\n\r\n\t\tu32 res = m_decrypter.decryptSetup(ptr, hdr);\r\n\t\tif (res == 0) {\r\n\t\t\tif (m_fp) {\r\n\t\t\t\tfseek(m_fp, 0, SEEK_SET);\r\n\t\t\t}\r\n\t\t}\r\n    }\r\n\r\n    static CWin32ReadFileStream * openStream(const char * path, const char * home);\r\n    \r\n    static CWin32ReadFileStream * openAssets(const char * path, const char * home);\r\n    \r\n    s32     getSize\t\t();\r\n    s32     getPosition\t();\r\n    u8      readU8\t\t();\r\n    u16     readU16\t\t();\r\n    u32     readU32\t\t();\r\n    float   readFloat\t();\r\n    bool    readBlock\t(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus\t();\r\n    \r\n    int     readU16arr\t(u16 * pBufferU16, int items);\r\n    int     readU32arr\t(u32 * PBufferU32, int items);\r\n    \r\n    IWriteStream * getWriteStream();\r\n\r\nprivate:\r\n    const char* m_fullpath;\r\n    ESTATUS     m_eStat;\r\n    FILE      * m_fp;\r\n    int         m_fd;\r\n    bool        m_bReadOnly;\r\n    CWin32WriteFileStream * m_writeStream;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32TmpFile.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n\r\n#include \"CWin32PathConv.h\"\r\n#include \"CWin32TmpFile.h\"\r\n\r\nCWin32TmpFile::CWin32TmpFile(const char * path)\r\n{\r\n\tconst char * ptr = path;\r\n\tif(!strncmp(\"file://\", path, 7)) ptr += 7;\r\n\tm_fullpath = CWin32PathConv::getInstance().fullpath(ptr);\r\n\tm_hHandle = CreateFile(\tm_fullpath,\r\n\t\t\t\t\t\t\tGENERIC_WRITE, \r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\tCREATE_ALWAYS,\r\n\t\t\t\t\t\t\tFILE_ATTRIBUTE_NORMAL,\r\n\t\t\t\t\t\t\t0);\r\n}\r\n\r\nCWin32TmpFile::~CWin32TmpFile()\r\n{\r\n\tif(m_hHandle) {\r\n\t\tFlushFileBuffers(m_hHandle);\r\n\t\tCloseHandle(m_hHandle);\r\n\t}\r\n\tdelete [] m_fullpath;\r\n}\r\n\r\nsize_t\r\nCWin32TmpFile::writeTmp(void * ptr, size_t size)\r\n{\r\n\tDWORD dwWrittenSize = 0;\r\n\tWriteFile(m_hHandle, ptr, size, &dwWrittenSize, 0);\r\n\treturn (size_t)dwWrittenSize;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32TmpFile.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CWin32TmpFile_h\r\n#define CWin32TmpFile_h\r\n\r\n#include <Windows.h>\r\n#include \"ITmpFile.h\"\r\n\r\nclass CWin32TmpFile : public ITmpFile\r\n{\r\npublic:\r\n\tCWin32TmpFile(const char * path);\r\n\tvirtual ~CWin32TmpFile();\r\n\r\n\tvirtual size_t\twriteTmp(void * ptr, size_t size);\r\n\r\n\tinline bool\t\tisReady\t() { return (m_hHandle) ? true : false; }\r\nprivate:\r\n\tconst char\t*\tm_fullpath;\r\n\tHANDLE\t\t\tm_hHandle;\r\n};\r\n\r\n#endif // CWin32TmpFile_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32Widget.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CWin32Widget.h\"\r\n#include \"CWin32Platform.h\"\r\n#include <ADSIid.h>\r\n\r\nCWin32Widget *  CWin32Widget::m_pBegin   = NULL;\r\nCWin32Widget *  CWin32Widget::m_pEnd     = NULL;\r\nint             CWin32Widget::m_uniqBase = 0;\r\n\r\nCWin32Widget::CWin32Widget(CWin32Platform * pPlatform)\r\n: m_id      (0)\r\n, m_hWnd    (0)\r\n, m_prev    (NULL)\r\n, m_next    (NULL)\r\n, m_x       (0)\r\n, m_y       (0)\r\n, m_width   (0)\r\n, m_height  (0)\r\n, m_bVisible(true)\r\n, m_bEnable (true)\r\n, m_bMove   (false)\r\n, m_chgVisible  (false)\r\n, m_chgEnable   (false)\r\n, m_pPlatform   (pPlatform)\r\n, m_uniqId      (++m_uniqBase)\r\n{\r\n\t// 自身をリンクに追加する\r\n\tm_prev = m_pEnd;\r\n\tm_pEnd = this;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tm_pBegin = this;\r\n\t}\r\n}\r\n\r\nCWin32Widget::~CWin32Widget()\r\n{\r\n\t// コントロールを破棄する\r\n\tif(m_hWnd) DestroyWindow(m_hWnd);\r\n\r\n\t// 自身をリンクから外す\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tm_pBegin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tm_pEnd = m_prev;\r\n\t}\r\n}\r\n\r\nvoid\r\nCWin32Widget::cmd(int /*cmd*/, ...)\r\n{\r\n}\r\n\r\nint\r\nCWin32Widget::status()\r\n{\r\n\treturn 0; \r\n}\r\n\r\nbool\r\nCWin32Widget::init(HWND hWnd, int id, int x, int y, int width, int height)\r\n{\r\n\tm_id     = id;\r\n\tm_hWnd   = hWnd;\r\n\tm_x      = x;\r\n\tm_y      = y;\r\n\tm_width  = width;\r\n\tm_height = height;\r\n\treturn true;\r\n}\r\n\r\nint\r\nCWin32Widget::getTextLength()\r\n{\r\n\tint length  = GetWindowTextLength(m_hWnd);\r\n\tchar * pBuf = new char [length + 1];\r\n\tGetWindowText(m_hWnd, (LPSTR)pBuf, length + 1);\r\n\r\n\t// control から取得した文字列は ShiftJISなので、\r\n\t// Engineが使用する UTF-8 文字列に変換したものの長さを計測する。\r\n\tconst char * utf8Str = m_pPlatform->SJIStoUTF8(pBuf);\r\n\tlength = strlen(utf8Str);\r\n\tdelete [] utf8Str;\r\n\tdelete [] pBuf;\r\n\r\n\treturn length;\r\n}\r\n\r\nbool\r\nCWin32Widget::getText(char * pBuf, int maxlen)\r\n{\r\n\tint result = GetWindowText(m_hWnd, (LPSTR)pBuf, maxlen);\r\n\t// 受けた文字列はShiftJISなので、EngineとしてはUTF8に変換する\r\n\tconst char * utf8Str = m_pPlatform->SJIStoUTF8(pBuf);\r\n\tint len = strlen(utf8Str);\r\n\tif(len > maxlen) len = maxlen;\r\n\tstrncpy(pBuf, utf8Str, len);\t// utf8に変換したものをバッファにコピー\r\n\tpBuf[len] = 0;\r\n\tdelete [] utf8Str;\r\n\treturn (!result) ? false : true;\r\n}\r\n\r\nbool\r\nCWin32Widget::setText(const char * string)\r\n{\r\n\t// 渡された文字列はutf8なので、OSのコントロールに渡す前に ShiftJISに変換する\r\n\tconst char * sjisStr = m_pPlatform->utf8toSJIS(string);\r\n\tint result = SetWindowText(m_hWnd, (LPSTR)sjisStr);\r\n\tdelete [] sjisStr;\r\n\treturn (!result) ? false : true;\r\n}\r\n\r\nconst char *\r\nCWin32Widget::toShiftJIS(const char * utf8)\r\n{\r\n\treturn m_pPlatform->utf8toSJIS(utf8);\r\n}\r\n\r\nvoid\r\nCWin32Widget::move(int x, int y)\r\n{\r\n\tm_x = x;\r\n\tm_y = y;\r\n\tm_bMove = true;\r\n}\r\n\r\nvoid\r\nCWin32Widget::resize(int width, int height)\r\n{\r\n\tm_width  = width;\r\n\tm_height = height;\r\n\tm_bMove  = true;\r\n}\r\n\r\nvoid\r\nCWin32Widget::visible(bool bVisible)\r\n{\r\n\tm_bVisible   = bVisible;\r\n\tm_chgVisible = true;\r\n}\r\n\r\nvoid\r\nCWin32Widget::enable(bool bEnable)\r\n{\r\n\tm_bEnable   = bEnable;\r\n\tm_chgEnable = true;\r\n}\r\n\r\nvoid\r\nCWin32Widget::redraw()\r\n\r\n{\r\n    if(!m_hWnd) { return; }\r\n\r\n\tif(m_chgVisible) {\r\n\t\tm_chgVisible = false;\r\n\t\tShowWindow(m_hWnd, (m_bVisible) ? SW_SHOW : SW_HIDE);\r\n\t}\r\n\tif(m_chgEnable) {\r\n\t\tm_chgEnable = false;\r\n\t\tEnableWindow(m_hWnd, (m_bEnable) ? TRUE : FALSE);\r\n\t}\r\n\tif(m_bMove) {\r\n\t\tm_bMove = false;\r\n\t\tMoveWindow(m_hWnd, m_x, m_y, m_width, m_height, true);\r\n\t} else {\r\n\t\tInvalidateRect(m_hWnd, NULL, FALSE);\r\n\t}\r\n\tRedrawWindow(m_hWnd, NULL, 0, RDW_UPDATENOW);\r\n}\r\n\r\nvoid\r\nCWin32Widget::ReDrawControls()\r\n{\r\n\tCWin32Widget * pCtrl = m_pBegin;\r\n\twhile(pCtrl) {\r\n\t\tpCtrl->redraw();\r\n\t\tpCtrl = pCtrl->m_next;\r\n\t}\r\n}\r\n\r\nLRESULT\r\nCWin32Widget::msgCommand(HWND /*hWnd*/, UINT /*message*/, WPARAM /*wParam*/, LPARAM /*lParam*/)\r\n{\r\n\treturn 0;\r\n}\r\n\r\nLRESULT\r\nCWin32Widget::ControlCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r\n{\r\n\tLRESULT lResult = 0;\r\n\tint id = LOWORD(wParam);\r\n\tCWin32Widget * pCtrl = m_pBegin;\r\n\twhile(pCtrl) {\r\n\t\tif(pCtrl->m_uniqId == id) {\r\n\t\t\tlResult = pCtrl->msgCommand(hWnd, message, wParam, lParam);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tpCtrl = pCtrl->m_next;\r\n\t}\r\n\treturn lResult;\r\n}\r\n\r\n\r\nCWin32TextWidget::CWin32TextWidget(CWin32Platform * pParent, int maxlen)\r\n: CWin32Widget  (pParent)\r\n, m_placeholder (NULL)\r\n, m_touched     (false)\r\n, m_maxlen      (maxlen)\r\n, m_hFont       (0)\r\n{\r\n\tm_cols[0] = 0xffffffff;\r\n\tm_cols[1] = 0xff000000;\r\n\tm_cols[2] = 0xffffffff;\r\n\tm_cols[3] = 0xff000000;\r\n}\r\nCWin32TextWidget::~CWin32TextWidget()\r\n{\r\n\tdelete [] m_placeholder;\r\n}\r\n\r\nbool\r\nCWin32TextWidget::create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height)\r\n{\r\n\tHWND hWnd = 0;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\t// unknown control.\r\n\t\treturn false;\r\n\tcase TEXTBOX:\r\n\t\t{\r\n\t\t\thWnd = CreateWindow(\r\n\t\t\t\t\t\t\t\tTEXT(\"EDIT\"),\r\n\t\t\t\t\t\t\t\tcaption,\r\n\t\t\t\t\t\t\t\tWS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | ES_LEFT,\r\n\t\t\t\t\t\t\t\tx, y, width, height,\r\n\t\t\t\t\t\t\t\tgetPlatform().get_hWnd(),\r\n\t\t\t\t\t\t\t\t(HMENU)(INT_PTR)m_uniqId,\r\n\t\t\t\t\t\t\t\t(HINSTANCE)GetModuleHandle(NULL),\r\n\t\t\t\t\t\t\t\t0);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase PASSWDBOX:\r\n\t\t{\r\n\t\t\thWnd = CreateWindow(TEXT(\"EDIT\"),\r\n\t\t\t\t\t\t\t\tcaption,\r\n\t\t\t\t\t\t\t\tWS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | ES_LEFT|ES_PASSWORD,\r\n\t\t\t\t\t\t\t\tx, y, width, height,\r\n\t\t\t\t\t\t\t\tgetPlatform().get_hWnd(),\r\n\t\t\t\t\t\t\t\t(HMENU)(INT_PTR)m_uniqId,\r\n\t\t\t\t\t\t\t\t(HINSTANCE)GetModuleHandle(NULL),\r\n\t\t\t\t\t\t\t\t0);\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n    if(m_maxlen > 0) { SendMessage(hWnd, EM_SETLIMITTEXT, (WPARAM)m_maxlen, 0); }\r\n\r\n\treturn init(hWnd, id, x, y, width, height);\r\n}\r\n\r\nvoid\r\nCWin32TextWidget::cmd(int cmd, ...)\r\n{\r\n\tva_list ap;\r\n\tva_start(ap, cmd);\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tcase TX_PLACEHOLDER:\r\n\t\t{\r\n\t\t\tconst char * placeholder = va_arg(ap, const char *);\r\n\t\t\t// 文字列を Shift_JIS に変換\r\n\t\t\tm_placeholder = toShiftJIS(placeholder);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase TX_FONT:\r\n\t\t{\r\n\t\t\t// フォントオブジェクト取得\r\n\t\t\t/*\r\n\t\t\tCWin32Font * fontobj = (CWin32Font *)va_arg(ap, void *);\r\n\t\t\tHDC hDC = GetDC( get_hWnd() );\r\n\t\t\tm_hFont = fontobj->get_hFont();\r\n\t\t\tSelectObject( hDC, m_hFont );\r\n\t\t\t*/\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\t{\r\n\t\t\tunsigned int color = va_arg(ap, unsigned int);\r\n\t\t\tcolor = (color & 0x00ff00) | ((color&0xff) << 16) | ((color>>16) & 0xff);\r\n\t\t\tswitch(cmd)\r\n\t\t\t{\r\n\t\t\tcase TX_BGCOLOR_NORMAL: m_cols[0] = color; break;\r\n\t\t\tcase TX_FGCOLOR_NORMAL: m_cols[1] = color; break;\r\n\t\t\tcase TX_BGCOLOR_TOUCH : m_cols[2] = color; break;\r\n\t\t\tcase TX_FGCOLOR_TOUCH : m_cols[3] = color; break;\r\n\t\t\t}\r\n\t\t\tset_color();\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\tva_end(ap);\r\n}\r\n\r\nvoid\r\nCWin32TextWidget::set_color()\r\n{\r\n\tint base = (m_touched) ? 2 : 0;\r\n\tunsigned int bg = m_cols[base];\r\n\tunsigned int fg = m_cols[base + 1];\r\n\r\n\tHDC hDC = GetDC( m_hWnd );\r\n\tSetTextColor(hDC, fg);\r\n\tSetBkColor(hDC, bg);\r\n\tReleaseDC(m_hWnd, hDC);\r\n}\r\n\r\nvoid\r\nCWin32TextWidget::redraw()\r\n{\r\n\tCWin32Widget::redraw();\r\n\r\n\tif(m_placeholder && getTextLength() == 0) {\r\n\t\tRECT rc;\r\n\t\tHDC hDC = GetDC( m_hWnd );\r\n\t\tint savedDC = SaveDC(hDC);\r\n\r\n\t\tint base = (m_touched) ? 2 : 0;\r\n\r\n\t\tSetTextColor(hDC , 0x999999);\r\n\t\tSetRect( &rc, 0, 0, m_width, m_height );\r\n\t\tDrawText(hDC, m_placeholder, -1, &rc, 0); \r\n\t\tRestoreDC(hDC, savedDC);\r\n\t\tReleaseDC( m_hWnd, hDC );\r\n\t}\r\n}\r\n\r\n\r\nLRESULT\r\nCWin32TextWidget::msgCommand(HWND /*hWnd*/, UINT /*message*/, WPARAM wParam, LPARAM /*lParam*/)\r\n{\r\n\tint code = HIWORD(wParam);\r\n\tswitch(code)\r\n\t{\r\n\tcase EN_SETFOCUS:\r\n\t\tm_touched = true;\r\n\t\tset_color();\r\n\t\tbreak;\r\n\tcase EN_KILLFOCUS:\r\n\t\tm_touched = false;\r\n\t\tset_color();\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nCWin32WebWidget::CWin32WebWidget(CWin32Platform * pParent) : CWin32Widget(pParent) {}\r\nCWin32WebWidget::~CWin32WebWidget() {}\r\n\r\nbool\r\nCWin32WebWidget::create(IWidget::CONTROL type, int id, const char * /*caption*/,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height,\r\n\t\t\t\t\t\t\tconst char * /*token*/, const char * /*region*/, const char * /*client*/,\r\n\t\t\t\t\t\t\tconst char * /*consumerKey*/, const char * /*applicationId*/, const char * /*userID*/)\r\n{\r\n\r\n\tHWND hWnd = 0;\r\n\tvoid (*AtlAxWinInit)();\r\n\tHRESULT (*AtlAxGetControl)(HWND,IUnknown **);\r\n\tHMODULE hAtl = LoadLibrary(\"atl\");\r\n\tAtlAxWinInit = (void (*)())GetProcAddress(hAtl ,\"AtlAxWinInit\");\r\n\tAtlAxGetControl = (HRESULT (*)(HWND, IUnknown **))GetProcAddress(hAtl, \"AtlAxGetControl\");\r\n\tAtlAxWinInit();\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\t// unknown control.\r\n\t\treturn false;\r\n\tcase WEBVIEW:\r\n\tcase WEBNOJUMP:\r\n\t\t{\r\n\t\t\thWnd = 0;\r\n\t\t\t/*\r\n\t\t\tCreateWindow(\"AtlAxWin\", \"Shell.Explorer.2\",\r\n\t\t\t\t\t\t\t\tWS_CHILD|WS_VISIBLE, x, y, width, height, \r\n\t\t\t\t\t\t\t\tgetPlatform().get_hWnd(),\r\n\t\t\t\t\t\t\t\t(HMENU)0, (HINSTANCE)GetModuleHandle(NULL), NULL);\r\n//\t\t\tIUnknown * hUnknown;\r\n//\t\t\tif(AtlAxGetControl(hWnd, &hUnknown) == S_OK) {\r\n\t\t\t\t\r\n//\t\t\t}\r\n\t\t\t*/\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn init(hWnd, id, x, y, width, height);\r\n}\r\n\r\n\r\n\r\n\r\nCWin32MovieWidget::CWin32MovieWidget(CWin32Platform * pParent) : CWin32Widget(pParent) {}\r\nCWin32MovieWidget::~CWin32MovieWidget() {}\r\n\r\nbool\r\nCWin32MovieWidget::create(IWidget::CONTROL type, int id, const char * /*caption*/,\r\n\t\t\t\t\t\t\tint x, int y, int width, int height)\r\n{\r\n\tHWND hWnd = 0;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\t// unknown control.\r\n\t\treturn false;\r\n\tcase MOVIEPLAYER:\r\n\t\t{\r\n\t\t\thWnd = 0;\r\n\t\t\t\t\t/*CreateWindow(TEXT(\"MovieArea\"),\r\n\t\t\t\t\t\t\t\tcaption,\r\n\t\t\t\t\t\t\t\tWS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | ES_LEFT,\r\n\t\t\t\t\t\t\t\tx, y, width, height,\r\n\t\t\t\t\t\t\t\tgetPlatform().get_hWnd(),\r\n\t\t\t\t\t\t\t\t(HMENU)(INT_PTR)id,\r\n\t\t\t\t\t\t\t\t(HINSTANCE)GetModuleHandle(NULL),\r\n\t\t\t\t\t\t\t\t0);\r\n\t\t\t\t\t\t\t\t*/\r\n\r\n\t\t}\r\n\t\tbreak;\r\n\tcase BGMOVIEPLAYER:\r\n\t\t{\r\n\t\t\thWnd = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn init(hWnd, id, x, y, width, height);\r\n}\r\n\r\n\r\n\r\nCWin32ActivityIndicator::CWin32ActivityIndicator(CWin32Platform * pParent) : CWin32Widget(pParent) {}\r\nCWin32ActivityIndicator::~CWin32ActivityIndicator() {}\r\n\r\nbool\r\nCWin32ActivityIndicator::create(IWidget::CONTROL type, int id, const char * /*caption*/,\r\n\t\t\t\t\t\t\t\tint x, int y, int width, int height)\r\n{\r\n\tHWND hWnd = 0;\r\n\r\n\tswitch(type)\r\n\t{\r\n\tdefault:\r\n\t\t// unknown control.\r\n\t\treturn false;\r\n\tcase ACTIVITYINDICATOR:\r\n\t\t{\r\n\t\t\thWnd = 0;\r\n\t\t\t\t\t/*CreateWindow(TEXT(\"MovieArea\"),\r\n\t\t\t\t\t\t\t\tcaption,\r\n\t\t\t\t\t\t\t\tWS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | ES_LEFT,\r\n\t\t\t\t\t\t\t\tx, y, width, height,\r\n\t\t\t\t\t\t\t\tgetPlatform().get_hWnd(),\r\n\t\t\t\t\t\t\t\t(HMENU)(INT_PTR)id,\r\n\t\t\t\t\t\t\t\t(HINSTANCE)GetModuleHandle(NULL),\r\n\t\t\t\t\t\t\t\t0);\r\n\t\t\t\t\t\t\t\t*/\r\n\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn init(hWnd, id, x, y, width, height);\r\n}"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32Widget.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CWin32Widget_h\r\n#define CWin32Widget_h\r\n\r\n#include <Windows.h>\r\n#include \"OSWidget.h\"\r\n\r\nclass CWin32Platform;\r\n\r\nclass CWin32Widget : public IWidget\r\n{\r\n\tfriend class CWin32Platform;\r\nprotected:\r\n\tCWin32Widget(CWin32Platform * pPlatform);\r\n\tvirtual ~CWin32Widget();\r\n\r\npublic:\r\n\r\n\tvirtual int  getTextLength\t();\r\n\tvirtual bool getText\t(char * pBuf, int maxlen);\r\n\tvirtual bool setText\t(const char * string);\r\n\tvirtual void move\t\t(int x, int y);\r\n\tvirtual void resize\t\t(int width, int height);\r\n\tvirtual void visible\t(bool bVisible);\r\n\tvirtual void enable\t\t(bool bEnable);\r\n\r\n\tvirtual void cmd\t\t(int cmd, ...);\r\n\tvirtual int  status\t\t();\r\n\r\n\t// 全てのコントロールを再描画する\r\n\tstatic void ReDrawControls();\r\n\r\n\t// コントロールに対するイベント処理\r\n\tvirtual LRESULT msgCommand\t\t(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r\n\tstatic  LRESULT ControlCommand\t(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r\n\r\nprotected:\r\n\tconst char* toShiftJIS\t(const char * utf8);\r\n\tbool\t\tinit\t\t(HWND hWnd, int id, int x, int y, int width, int height);\r\n\tinline HWND get_hWnd\t() const { return m_hWnd; }\r\n\tinline CWin32Platform& getPlatform() { return *m_pPlatform; }\r\n\r\n\tvirtual void redraw();\r\n\r\n\tint\t\t\t\t\tm_uniqId;\r\n\r\n//private:\r\n\r\n\tHWND\t\t\t\tm_hWnd;\t// HWND control\r\n\tint\t\t\t\t\tm_x;\r\n\tint\t\t\t\t\tm_y;\r\n\tint\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\tm_id;\r\n\r\n\tCWin32Widget\t*\tm_prev;\r\n\tCWin32Widget\t*\tm_next;\r\n\r\n\r\n\tbool\t\t\t\tm_bMove;\t// 移動/リサイズした際にtrueになる\r\n\r\n\tbool\t\t\t\tm_chgVisible;\r\n\tbool\t\t\t\tm_bVisible;\r\n\r\n\tbool\t\t\t\tm_chgEnable;\r\n\tbool\t\t\t\tm_bEnable;\r\n\r\n\tCWin32Platform\t*\tm_pPlatform;\r\n\r\n\tstatic CWin32Widget * m_pBegin;\r\n\tstatic CWin32Widget * m_pEnd;\r\n\r\n\tstatic int\t\t\t  m_uniqBase;\r\n};\r\n\r\n\r\nclass CWin32TextWidget : public CWin32Widget\r\n{\r\n\tfriend class CWin32Platform;\r\nprivate:\r\n\tCWin32TextWidget(CWin32Platform * pParent, int maxlen = 0);\r\n\tvirtual ~CWin32TextWidget();\r\n\r\npublic:\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\tint x, int y, int width, int height);\r\n\r\n\tvoid cmd(int cmd, ...);\r\n\r\n\tLRESULT msgCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r\n\r\nprivate:\r\n\tvoid redraw\t\t();\r\n\tvoid set_color\t();\r\n\r\n\tconst char\t\t*\tm_placeholder;\r\n\tHFONT\t\t\t\tm_hFont;\r\n\r\n\tbool\t\t\t\tm_touched;\r\n\tint\t\t\t\t\tm_maxlen;\r\n\tunsigned int\t\tm_cols[4];\r\n};\r\n\r\nclass CWin32WebWidget : public CWin32Widget\r\n{\r\n\tfriend class CWin32Platform;\r\nprivate:\r\n\tCWin32WebWidget(CWin32Platform * pParent);\r\n\tvirtual ~CWin32WebWidget();\r\npublic:\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\tint x, int y, int width, int height,\r\n\t\t\t\tconst char * token, const char * region, const char * client,\r\n\t\t\t\tconst char * consumerKey, const char * applicationId, const char * userID);\r\n\r\nprivate:\r\n\t// void redraw();\r\n};\r\n\r\nclass CWin32MovieWidget : public CWin32Widget\r\n{\r\n\tfriend class CWin32Platform;\r\nprivate:\r\n\tCWin32MovieWidget(CWin32Platform * pParent);\r\n\tvirtual ~CWin32MovieWidget();\r\npublic:\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\tint x, int y, int width, int height);\r\n\r\nprivate:\r\n};\r\n\r\nclass CWin32ActivityIndicator : public CWin32Widget\r\n{\r\n\tfriend class CWin32Platform;\r\nprivate:\r\n\tCWin32ActivityIndicator(CWin32Platform * pParent);\r\n\tvirtual ~CWin32ActivityIndicator();\r\npublic:\r\n\tbool create(IWidget::CONTROL type, int id, const char * caption,\r\n\t\t\t\tint x, int y, int width, int height);\r\n\r\nprivate:\r\n};\r\n\r\n#endif // CWin32Widget_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32WriteFileStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CWin32WriteFileStream.cpp\r\n//\r\n#include <Windows.h>\r\n#include <io.h>\r\n#include <fcntl.h>\r\n#include <sys/types.h>\r\n#include <sys/stat.h>\r\n#include <share.h>\r\n#include <stdio.h>\r\n#include <iostream>\r\n\r\n#include \"CWin32WriteFileStream.h\"\r\n#include \"CWin32ReadFileStream.h\"\r\n\r\n\r\nCWin32WriteFileStream::CWin32WriteFileStream(CWin32ReadFileStream& rdStream) \r\n: m_fd      (-1)\r\n, m_fp      (NULL)\r\n, m_eStat   (CLOSED)\r\n{\r\n    if(rdStream.m_fp && rdStream.m_eStat == IReadStream::NORMAL) {\r\n        fclose(rdStream.m_fp);\r\n        rdStream.m_fp = NULL;\r\n        rdStream.m_fd = -1;\r\n    }\r\n\r\n\tif(_sopen_s(&m_fd, rdStream.m_fullpath, _O_CREAT | _O_RDWR, _SH_DENYRW, _S_IREAD | _S_IWRITE)) {\r\n\t\treturn;\r\n\t}\r\n    m_fp = _fdopen(m_fd, \"r+b\");\r\n    if(!m_fp) {\r\n        _close(m_fd);\r\n        m_fd = -1;\r\n        return;\r\n    }\r\n    rdStream.m_fd = m_fd;\r\n    rdStream.m_fp = m_fp;    \r\n    m_eStat = NORMAL;\r\n}\r\n\r\nCWin32WriteFileStream::~CWin32WriteFileStream() {}\r\n\r\nIWriteStream::ESTATUS\r\nCWin32WriteFileStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\ns32\r\nCWin32WriteFileStream::getPosition()\r\n{\r\n    m_eStat = NORMAL;\r\n    return ftell(m_fp);\r\n}\r\n\r\nvoid\r\nCWin32WriteFileStream::writeU8(u8 value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(EOF == fputc(value, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCWin32WriteFileStream::writeU16(u16 value)\r\n{\r\n    u8 arr[2];\r\n    m_eStat = NORMAL;\r\n    arr[0] = (value >> 8) & 0xff;\r\n    arr[1] = value & 0xff;\r\n    if(1 > fwrite(arr, 2, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCWin32WriteFileStream::writeU32(u32 value)\r\n{\r\n    u8 arr[4];\r\n    m_eStat = NORMAL;\r\n    arr[0] = (value >> 24) & 0xff;\r\n    arr[1] = (value >> 16) & 0xff;\r\n    arr[2] = (value >> 8) & 0xff;\r\n    arr[3] = value & 0xff;\r\n    if(1 > fwrite(arr, 4, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCWin32WriteFileStream::writeFloat(float fval)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(1 > fwrite(&fval, sizeof(float), 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCWin32WriteFileStream::writeBlock(void* buffer, u32 byteSize)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(1 > fwrite(buffer, byteSize, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/CWin32WriteFileStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CWin32WriteFileStream.h\r\n//\r\n\r\n#ifndef CWin32WriteFileStream_h\r\n#define CWin32WriteFileStream_h\r\n\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CWin32ReadFileStream;\r\n\r\nclass CWin32WriteFileStream : public IWriteStream\r\n{\r\n    friend class CWin32ReadFileStream;\r\nprivate:\r\n    CWin32WriteFileStream(CWin32ReadFileStream& rdStream);\r\n    virtual ~CWin32WriteFileStream();\r\n    \r\npublic:\r\n    ESTATUS\tgetStatus\t();\r\n\ts32\t\tgetPosition\t();\r\n\tvoid\twriteU8\t\t(u8  value);\t// Use cast to support s8\r\n\tvoid\twriteU16\t(u16 value);\t// Use cast to support s16\r\n\tvoid\twriteU32\t(u32 value);\t// Use cast to support s32\r\n\tvoid\twriteFloat\t(float);\r\n\tvoid\twriteBlock\t(void* buffer, u32 byteSize);\r\n    \r\nprivate:\r\n    int         m_fd;\r\n    FILE    *   m_fp;\r\n    \r\n    ESTATUS     m_eStat;\r\n};\r\n\r\n#endif // CWin32WriteFileStream_h\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/KLBPlatformMetrics.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLBPlatformMetrics_h\r\n#define KLBPlatformMetrics_h\r\n\r\n#include \"KLBPlatformMetricsCommon.h\"\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/Win32FileLocation.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  Win32FileLocation.h\r\n//\r\n\r\n#ifndef Win32FileLocation_h\r\n#define Win32FileLocation_h\r\n\r\n// Warning : Path must finish with '/'\r\n#define PATH_EXTERN     \"C:/GameEngine2D/examples/\"\r\n#define PATH_INSTALL    \"C:/GameEngine2D/examples/\"\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/glew.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n** The OpenGL Extension Wrangler Library\r\n** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>\r\n** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>\r\n** Copyright (C) 2002, Lev Povalahev\r\n** All rights reserved.\r\n** \r\n** Redistribution and use in source and binary forms, with or without \r\n** modification, are permitted provided that the following conditions are met:\r\n** \r\n** * Redistributions of source code must retain the above copyright notice, \r\n**   this list of conditions and the following disclaimer.\r\n** * Redistributions in binary form must reproduce the above copyright notice, \r\n**   this list of conditions and the following disclaimer in the documentation \r\n**   and/or other materials provided with the distribution.\r\n** * The name of the author may be used to endorse or promote products \r\n**   derived from this software without specific prior written permission.\r\n**\r\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \r\n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \r\n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \r\n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \r\n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \r\n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\r\n** THE POSSIBILITY OF SUCH DAMAGE.\r\n*/\r\n\r\n/*\r\n * Mesa 3-D graphics library\r\n * Version:  7.0\r\n *\r\n * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the \"Software\"),\r\n * to deal in the Software without restriction, including without limitation\r\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n * and/or sell copies of the Software, and to permit persons to whom the\r\n * Software is furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included\r\n * in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n** Copyright (c) 2007 The Khronos Group Inc.\r\n** \r\n** Permission is hereby granted, free of charge, to any person obtaining a\r\n** copy of this software and/or associated documentation files (the\r\n** \"Materials\"), to deal in the Materials without restriction, including\r\n** without limitation the rights to use, copy, modify, merge, publish,\r\n** distribute, sublicense, and/or sell copies of the Materials, and to\r\n** permit persons to whom the Materials are furnished to do so, subject to\r\n** the following conditions:\r\n** \r\n** The above copyright notice and this permission notice shall be included\r\n** in all copies or substantial portions of the Materials.\r\n** \r\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\r\n*/\r\n\r\n#ifndef __glew_h__\r\n#define __glew_h__\r\n#define __GLEW_H__\r\n\r\n#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)\r\n#error gl.h included before glew.h\r\n#endif\r\n#if defined(__REGAL_H__)\r\n#error Regal.h included before glew.h\r\n#endif\r\n#if defined(__glext_h_) || defined(__GLEXT_H_)\r\n#error glext.h included before glew.h\r\n#endif\r\n#if defined(__gl_ATI_h_)\r\n#error glATI.h included before glew.h\r\n#endif\r\n\r\n#define __gl_h_\r\n#define __GL_H__\r\n#define __REGAL_H__\r\n#define __X_GL_H\r\n#define __glext_h_\r\n#define __GLEXT_H_\r\n#define __gl_ATI_h_\r\n\r\n#if defined(_WIN32)\r\n\r\n/*\r\n * GLEW does not include <windows.h> to avoid name space pollution.\r\n * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t\r\n * defined properly.\r\n */\r\n/* <windef.h> */\r\n#ifndef APIENTRY\r\n#define GLEW_APIENTRY_DEFINED\r\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\r\n#    define APIENTRY __stdcall\r\n#  elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)\r\n#    define APIENTRY __stdcall\r\n#  else\r\n#    define APIENTRY\r\n#  endif\r\n#endif\r\n#ifndef GLAPI\r\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\r\n#    define GLAPI extern\r\n#  endif\r\n#endif\r\n/* <winnt.h> */\r\n#ifndef CALLBACK\r\n#define GLEW_CALLBACK_DEFINED\r\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\r\n#    define CALLBACK __attribute__ ((__stdcall__))\r\n#  elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\r\n#    define CALLBACK __stdcall\r\n#  else\r\n#    define CALLBACK\r\n#  endif\r\n#endif\r\n/* <wingdi.h> and <winnt.h> */\r\n#ifndef WINGDIAPI\r\n#define GLEW_WINGDIAPI_DEFINED\r\n#define WINGDIAPI __declspec(dllimport)\r\n#endif\r\n/* <ctype.h> */\r\n#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED)\r\ntypedef unsigned short wchar_t;\r\n#  define _WCHAR_T_DEFINED\r\n#endif\r\n/* <stddef.h> */\r\n#if !defined(_W64)\r\n#  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300\r\n#    define _W64 __w64\r\n#  else\r\n#    define _W64\r\n#  endif\r\n#endif\r\n#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__)\r\n#  ifdef _WIN64\r\ntypedef __int64 ptrdiff_t;\r\n#  else\r\ntypedef _W64 int ptrdiff_t;\r\n#  endif\r\n#  define _PTRDIFF_T_DEFINED\r\n#  define _PTRDIFF_T_\r\n#endif\r\n\r\n#ifndef GLAPI\r\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\r\n#    define GLAPI extern\r\n#  else\r\n#    define GLAPI WINGDIAPI\r\n#  endif\r\n#endif\r\n\r\n#ifndef GLAPIENTRY\r\n#define GLAPIENTRY APIENTRY\r\n#endif\r\n\r\n#ifndef GLEWAPIENTRY\r\n#define GLEWAPIENTRY APIENTRY\r\n#endif\r\n\r\n/*\r\n * GLEW_STATIC is defined for static library.\r\n * GLEW_BUILD  is defined for building the DLL library.\r\n */\r\n\r\n#ifdef GLEW_STATIC\r\n#  define GLEWAPI extern\r\n#else\r\n#  ifdef GLEW_BUILD\r\n#    define GLEWAPI extern __declspec(dllexport)\r\n#  else\r\n#    define GLEWAPI extern __declspec(dllimport)\r\n#  endif\r\n#endif\r\n\r\n#else /* _UNIX */\r\n\r\n/*\r\n * Needed for ptrdiff_t in turn needed by VBO.  This is defined by ISO\r\n * C.  On my system, this amounts to _3 lines_ of included code, all of\r\n * them pretty much harmless.  If you know of a way of detecting 32 vs\r\n * 64 _targets_ at compile time you are free to replace this with\r\n * something that's portable.  For now, _this_ is the portable solution.\r\n * (mem, 2004-01-04)\r\n */\r\n\r\n#include <stddef.h>\r\n\r\n/* SGI MIPSPro doesn't like stdint.h in C++ mode          */\r\n/* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */\r\n\r\n#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__)\r\n#include <inttypes.h>\r\n#else\r\n#include <stdint.h>\r\n#endif\r\n\r\n#define GLEW_APIENTRY_DEFINED\r\n#define APIENTRY\r\n\r\n/*\r\n * GLEW_STATIC is defined for static library.\r\n */\r\n\r\n#ifdef GLEW_STATIC\r\n#  define GLEWAPI extern\r\n#else\r\n#  if defined(__GNUC__) && __GNUC__>=4\r\n#   define GLEWAPI extern __attribute__ ((visibility(\"default\")))\r\n#  elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)\r\n#   define GLEWAPI extern __global\r\n#  else\r\n#   define GLEWAPI extern\r\n#  endif\r\n#endif\r\n\r\n/* <glu.h> */\r\n#ifndef GLAPI\r\n#define GLAPI extern\r\n#endif\r\n\r\n#ifndef GLAPIENTRY\r\n#define GLAPIENTRY\r\n#endif\r\n\r\n#ifndef GLEWAPIENTRY\r\n#define GLEWAPIENTRY\r\n#endif\r\n\r\n#endif /* _WIN32 */\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* ----------------------------- GL_VERSION_1_1 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_1_1\r\n#define GL_VERSION_1_1 1\r\n\r\ntypedef unsigned int GLenum;\r\ntypedef unsigned int GLbitfield;\r\ntypedef unsigned int GLuint;\r\ntypedef int GLint;\r\ntypedef int GLsizei;\r\ntypedef unsigned char GLboolean;\r\ntypedef signed char GLbyte;\r\ntypedef short GLshort;\r\ntypedef unsigned char GLubyte;\r\ntypedef unsigned short GLushort;\r\ntypedef unsigned long GLulong;\r\ntypedef float GLfloat;\r\ntypedef float GLclampf;\r\ntypedef double GLdouble;\r\ntypedef double GLclampd;\r\ntypedef void GLvoid;\r\n#if defined(_MSC_VER) && _MSC_VER < 1400\r\ntypedef __int64 GLint64EXT;\r\ntypedef unsigned __int64 GLuint64EXT;\r\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\r\ntypedef signed long long GLint64EXT;\r\ntypedef unsigned long long GLuint64EXT;\r\n#else\r\n#  if defined(__MINGW32__) || defined(__CYGWIN__)\r\n#include <inttypes.h>\r\n#  endif\r\ntypedef int64_t GLint64EXT;\r\ntypedef uint64_t GLuint64EXT;\r\n#endif\r\ntypedef GLint64EXT  GLint64;\r\ntypedef GLuint64EXT GLuint64;\r\ntypedef struct __GLsync *GLsync;\r\n\r\ntypedef char GLchar;\r\n\r\n#define GL_ZERO 0\r\n#define GL_FALSE 0\r\n#define GL_LOGIC_OP 0x0BF1\r\n#define GL_NONE 0\r\n#define GL_TEXTURE_COMPONENTS 0x1003\r\n#define GL_NO_ERROR 0\r\n#define GL_POINTS 0x0000\r\n#define GL_CURRENT_BIT 0x00000001\r\n#define GL_TRUE 1\r\n#define GL_ONE 1\r\n#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001\r\n#define GL_LINES 0x0001\r\n#define GL_LINE_LOOP 0x0002\r\n#define GL_POINT_BIT 0x00000002\r\n#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002\r\n#define GL_LINE_STRIP 0x0003\r\n#define GL_LINE_BIT 0x00000004\r\n#define GL_TRIANGLES 0x0004\r\n#define GL_TRIANGLE_STRIP 0x0005\r\n#define GL_TRIANGLE_FAN 0x0006\r\n#define GL_QUADS 0x0007\r\n#define GL_QUAD_STRIP 0x0008\r\n#define GL_POLYGON_BIT 0x00000008\r\n#define GL_POLYGON 0x0009\r\n#define GL_POLYGON_STIPPLE_BIT 0x00000010\r\n#define GL_PIXEL_MODE_BIT 0x00000020\r\n#define GL_LIGHTING_BIT 0x00000040\r\n#define GL_FOG_BIT 0x00000080\r\n#define GL_DEPTH_BUFFER_BIT 0x00000100\r\n#define GL_ACCUM 0x0100\r\n#define GL_LOAD 0x0101\r\n#define GL_RETURN 0x0102\r\n#define GL_MULT 0x0103\r\n#define GL_ADD 0x0104\r\n#define GL_NEVER 0x0200\r\n#define GL_ACCUM_BUFFER_BIT 0x00000200\r\n#define GL_LESS 0x0201\r\n#define GL_EQUAL 0x0202\r\n#define GL_LEQUAL 0x0203\r\n#define GL_GREATER 0x0204\r\n#define GL_NOTEQUAL 0x0205\r\n#define GL_GEQUAL 0x0206\r\n#define GL_ALWAYS 0x0207\r\n#define GL_SRC_COLOR 0x0300\r\n#define GL_ONE_MINUS_SRC_COLOR 0x0301\r\n#define GL_SRC_ALPHA 0x0302\r\n#define GL_ONE_MINUS_SRC_ALPHA 0x0303\r\n#define GL_DST_ALPHA 0x0304\r\n#define GL_ONE_MINUS_DST_ALPHA 0x0305\r\n#define GL_DST_COLOR 0x0306\r\n#define GL_ONE_MINUS_DST_COLOR 0x0307\r\n#define GL_SRC_ALPHA_SATURATE 0x0308\r\n#define GL_STENCIL_BUFFER_BIT 0x00000400\r\n#define GL_FRONT_LEFT 0x0400\r\n#define GL_FRONT_RIGHT 0x0401\r\n#define GL_BACK_LEFT 0x0402\r\n#define GL_BACK_RIGHT 0x0403\r\n#define GL_FRONT 0x0404\r\n#define GL_BACK 0x0405\r\n#define GL_LEFT 0x0406\r\n#define GL_RIGHT 0x0407\r\n#define GL_FRONT_AND_BACK 0x0408\r\n#define GL_AUX0 0x0409\r\n#define GL_AUX1 0x040A\r\n#define GL_AUX2 0x040B\r\n#define GL_AUX3 0x040C\r\n#define GL_INVALID_ENUM 0x0500\r\n#define GL_INVALID_VALUE 0x0501\r\n#define GL_INVALID_OPERATION 0x0502\r\n#define GL_STACK_OVERFLOW 0x0503\r\n#define GL_STACK_UNDERFLOW 0x0504\r\n#define GL_OUT_OF_MEMORY 0x0505\r\n#define GL_2D 0x0600\r\n#define GL_3D 0x0601\r\n#define GL_3D_COLOR 0x0602\r\n#define GL_3D_COLOR_TEXTURE 0x0603\r\n#define GL_4D_COLOR_TEXTURE 0x0604\r\n#define GL_PASS_THROUGH_TOKEN 0x0700\r\n#define GL_POINT_TOKEN 0x0701\r\n#define GL_LINE_TOKEN 0x0702\r\n#define GL_POLYGON_TOKEN 0x0703\r\n#define GL_BITMAP_TOKEN 0x0704\r\n#define GL_DRAW_PIXEL_TOKEN 0x0705\r\n#define GL_COPY_PIXEL_TOKEN 0x0706\r\n#define GL_LINE_RESET_TOKEN 0x0707\r\n#define GL_EXP 0x0800\r\n#define GL_VIEWPORT_BIT 0x00000800\r\n#define GL_EXP2 0x0801\r\n#define GL_CW 0x0900\r\n#define GL_CCW 0x0901\r\n#define GL_COEFF 0x0A00\r\n#define GL_ORDER 0x0A01\r\n#define GL_DOMAIN 0x0A02\r\n#define GL_CURRENT_COLOR 0x0B00\r\n#define GL_CURRENT_INDEX 0x0B01\r\n#define GL_CURRENT_NORMAL 0x0B02\r\n#define GL_CURRENT_TEXTURE_COORDS 0x0B03\r\n#define GL_CURRENT_RASTER_COLOR 0x0B04\r\n#define GL_CURRENT_RASTER_INDEX 0x0B05\r\n#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06\r\n#define GL_CURRENT_RASTER_POSITION 0x0B07\r\n#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08\r\n#define GL_CURRENT_RASTER_DISTANCE 0x0B09\r\n#define GL_POINT_SMOOTH 0x0B10\r\n#define GL_POINT_SIZE 0x0B11\r\n#define GL_POINT_SIZE_RANGE 0x0B12\r\n#define GL_POINT_SIZE_GRANULARITY 0x0B13\r\n#define GL_LINE_SMOOTH 0x0B20\r\n#define GL_LINE_WIDTH 0x0B21\r\n#define GL_LINE_WIDTH_RANGE 0x0B22\r\n#define GL_LINE_WIDTH_GRANULARITY 0x0B23\r\n#define GL_LINE_STIPPLE 0x0B24\r\n#define GL_LINE_STIPPLE_PATTERN 0x0B25\r\n#define GL_LINE_STIPPLE_REPEAT 0x0B26\r\n#define GL_LIST_MODE 0x0B30\r\n#define GL_MAX_LIST_NESTING 0x0B31\r\n#define GL_LIST_BASE 0x0B32\r\n#define GL_LIST_INDEX 0x0B33\r\n#define GL_POLYGON_MODE 0x0B40\r\n#define GL_POLYGON_SMOOTH 0x0B41\r\n#define GL_POLYGON_STIPPLE 0x0B42\r\n#define GL_EDGE_FLAG 0x0B43\r\n#define GL_CULL_FACE 0x0B44\r\n#define GL_CULL_FACE_MODE 0x0B45\r\n#define GL_FRONT_FACE 0x0B46\r\n#define GL_LIGHTING 0x0B50\r\n#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51\r\n#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52\r\n#define GL_LIGHT_MODEL_AMBIENT 0x0B53\r\n#define GL_SHADE_MODEL 0x0B54\r\n#define GL_COLOR_MATERIAL_FACE 0x0B55\r\n#define GL_COLOR_MATERIAL_PARAMETER 0x0B56\r\n#define GL_COLOR_MATERIAL 0x0B57\r\n#define GL_FOG 0x0B60\r\n#define GL_FOG_INDEX 0x0B61\r\n#define GL_FOG_DENSITY 0x0B62\r\n#define GL_FOG_START 0x0B63\r\n#define GL_FOG_END 0x0B64\r\n#define GL_FOG_MODE 0x0B65\r\n#define GL_FOG_COLOR 0x0B66\r\n#define GL_DEPTH_RANGE 0x0B70\r\n#define GL_DEPTH_TEST 0x0B71\r\n#define GL_DEPTH_WRITEMASK 0x0B72\r\n#define GL_DEPTH_CLEAR_VALUE 0x0B73\r\n#define GL_DEPTH_FUNC 0x0B74\r\n#define GL_ACCUM_CLEAR_VALUE 0x0B80\r\n#define GL_STENCIL_TEST 0x0B90\r\n#define GL_STENCIL_CLEAR_VALUE 0x0B91\r\n#define GL_STENCIL_FUNC 0x0B92\r\n#define GL_STENCIL_VALUE_MASK 0x0B93\r\n#define GL_STENCIL_FAIL 0x0B94\r\n#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95\r\n#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96\r\n#define GL_STENCIL_REF 0x0B97\r\n#define GL_STENCIL_WRITEMASK 0x0B98\r\n#define GL_MATRIX_MODE 0x0BA0\r\n#define GL_NORMALIZE 0x0BA1\r\n#define GL_VIEWPORT 0x0BA2\r\n#define GL_MODELVIEW_STACK_DEPTH 0x0BA3\r\n#define GL_PROJECTION_STACK_DEPTH 0x0BA4\r\n#define GL_TEXTURE_STACK_DEPTH 0x0BA5\r\n#define GL_MODELVIEW_MATRIX 0x0BA6\r\n#define GL_PROJECTION_MATRIX 0x0BA7\r\n#define GL_TEXTURE_MATRIX 0x0BA8\r\n#define GL_ATTRIB_STACK_DEPTH 0x0BB0\r\n#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1\r\n#define GL_ALPHA_TEST 0x0BC0\r\n#define GL_ALPHA_TEST_FUNC 0x0BC1\r\n#define GL_ALPHA_TEST_REF 0x0BC2\r\n#define GL_DITHER 0x0BD0\r\n#define GL_BLEND_DST 0x0BE0\r\n#define GL_BLEND_SRC 0x0BE1\r\n#define GL_BLEND 0x0BE2\r\n#define GL_LOGIC_OP_MODE 0x0BF0\r\n#define GL_INDEX_LOGIC_OP 0x0BF1\r\n#define GL_COLOR_LOGIC_OP 0x0BF2\r\n#define GL_AUX_BUFFERS 0x0C00\r\n#define GL_DRAW_BUFFER 0x0C01\r\n#define GL_READ_BUFFER 0x0C02\r\n#define GL_SCISSOR_BOX 0x0C10\r\n#define GL_SCISSOR_TEST 0x0C11\r\n#define GL_INDEX_CLEAR_VALUE 0x0C20\r\n#define GL_INDEX_WRITEMASK 0x0C21\r\n#define GL_COLOR_CLEAR_VALUE 0x0C22\r\n#define GL_COLOR_WRITEMASK 0x0C23\r\n#define GL_INDEX_MODE 0x0C30\r\n#define GL_RGBA_MODE 0x0C31\r\n#define GL_DOUBLEBUFFER 0x0C32\r\n#define GL_STEREO 0x0C33\r\n#define GL_RENDER_MODE 0x0C40\r\n#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50\r\n#define GL_POINT_SMOOTH_HINT 0x0C51\r\n#define GL_LINE_SMOOTH_HINT 0x0C52\r\n#define GL_POLYGON_SMOOTH_HINT 0x0C53\r\n#define GL_FOG_HINT 0x0C54\r\n#define GL_TEXTURE_GEN_S 0x0C60\r\n#define GL_TEXTURE_GEN_T 0x0C61\r\n#define GL_TEXTURE_GEN_R 0x0C62\r\n#define GL_TEXTURE_GEN_Q 0x0C63\r\n#define GL_PIXEL_MAP_I_TO_I 0x0C70\r\n#define GL_PIXEL_MAP_S_TO_S 0x0C71\r\n#define GL_PIXEL_MAP_I_TO_R 0x0C72\r\n#define GL_PIXEL_MAP_I_TO_G 0x0C73\r\n#define GL_PIXEL_MAP_I_TO_B 0x0C74\r\n#define GL_PIXEL_MAP_I_TO_A 0x0C75\r\n#define GL_PIXEL_MAP_R_TO_R 0x0C76\r\n#define GL_PIXEL_MAP_G_TO_G 0x0C77\r\n#define GL_PIXEL_MAP_B_TO_B 0x0C78\r\n#define GL_PIXEL_MAP_A_TO_A 0x0C79\r\n#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0\r\n#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1\r\n#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2\r\n#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3\r\n#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4\r\n#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5\r\n#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6\r\n#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7\r\n#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8\r\n#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9\r\n#define GL_UNPACK_SWAP_BYTES 0x0CF0\r\n#define GL_UNPACK_LSB_FIRST 0x0CF1\r\n#define GL_UNPACK_ROW_LENGTH 0x0CF2\r\n#define GL_UNPACK_SKIP_ROWS 0x0CF3\r\n#define GL_UNPACK_SKIP_PIXELS 0x0CF4\r\n#define GL_UNPACK_ALIGNMENT 0x0CF5\r\n#define GL_PACK_SWAP_BYTES 0x0D00\r\n#define GL_PACK_LSB_FIRST 0x0D01\r\n#define GL_PACK_ROW_LENGTH 0x0D02\r\n#define GL_PACK_SKIP_ROWS 0x0D03\r\n#define GL_PACK_SKIP_PIXELS 0x0D04\r\n#define GL_PACK_ALIGNMENT 0x0D05\r\n#define GL_MAP_COLOR 0x0D10\r\n#define GL_MAP_STENCIL 0x0D11\r\n#define GL_INDEX_SHIFT 0x0D12\r\n#define GL_INDEX_OFFSET 0x0D13\r\n#define GL_RED_SCALE 0x0D14\r\n#define GL_RED_BIAS 0x0D15\r\n#define GL_ZOOM_X 0x0D16\r\n#define GL_ZOOM_Y 0x0D17\r\n#define GL_GREEN_SCALE 0x0D18\r\n#define GL_GREEN_BIAS 0x0D19\r\n#define GL_BLUE_SCALE 0x0D1A\r\n#define GL_BLUE_BIAS 0x0D1B\r\n#define GL_ALPHA_SCALE 0x0D1C\r\n#define GL_ALPHA_BIAS 0x0D1D\r\n#define GL_DEPTH_SCALE 0x0D1E\r\n#define GL_DEPTH_BIAS 0x0D1F\r\n#define GL_MAX_EVAL_ORDER 0x0D30\r\n#define GL_MAX_LIGHTS 0x0D31\r\n#define GL_MAX_CLIP_PLANES 0x0D32\r\n#define GL_MAX_TEXTURE_SIZE 0x0D33\r\n#define GL_MAX_PIXEL_MAP_TABLE 0x0D34\r\n#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35\r\n#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36\r\n#define GL_MAX_NAME_STACK_DEPTH 0x0D37\r\n#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38\r\n#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39\r\n#define GL_MAX_VIEWPORT_DIMS 0x0D3A\r\n#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B\r\n#define GL_SUBPIXEL_BITS 0x0D50\r\n#define GL_INDEX_BITS 0x0D51\r\n#define GL_RED_BITS 0x0D52\r\n#define GL_GREEN_BITS 0x0D53\r\n#define GL_BLUE_BITS 0x0D54\r\n#define GL_ALPHA_BITS 0x0D55\r\n#define GL_DEPTH_BITS 0x0D56\r\n#define GL_STENCIL_BITS 0x0D57\r\n#define GL_ACCUM_RED_BITS 0x0D58\r\n#define GL_ACCUM_GREEN_BITS 0x0D59\r\n#define GL_ACCUM_BLUE_BITS 0x0D5A\r\n#define GL_ACCUM_ALPHA_BITS 0x0D5B\r\n#define GL_NAME_STACK_DEPTH 0x0D70\r\n#define GL_AUTO_NORMAL 0x0D80\r\n#define GL_MAP1_COLOR_4 0x0D90\r\n#define GL_MAP1_INDEX 0x0D91\r\n#define GL_MAP1_NORMAL 0x0D92\r\n#define GL_MAP1_TEXTURE_COORD_1 0x0D93\r\n#define GL_MAP1_TEXTURE_COORD_2 0x0D94\r\n#define GL_MAP1_TEXTURE_COORD_3 0x0D95\r\n#define GL_MAP1_TEXTURE_COORD_4 0x0D96\r\n#define GL_MAP1_VERTEX_3 0x0D97\r\n#define GL_MAP1_VERTEX_4 0x0D98\r\n#define GL_MAP2_COLOR_4 0x0DB0\r\n#define GL_MAP2_INDEX 0x0DB1\r\n#define GL_MAP2_NORMAL 0x0DB2\r\n#define GL_MAP2_TEXTURE_COORD_1 0x0DB3\r\n#define GL_MAP2_TEXTURE_COORD_2 0x0DB4\r\n#define GL_MAP2_TEXTURE_COORD_3 0x0DB5\r\n#define GL_MAP2_TEXTURE_COORD_4 0x0DB6\r\n#define GL_MAP2_VERTEX_3 0x0DB7\r\n#define GL_MAP2_VERTEX_4 0x0DB8\r\n#define GL_MAP1_GRID_DOMAIN 0x0DD0\r\n#define GL_MAP1_GRID_SEGMENTS 0x0DD1\r\n#define GL_MAP2_GRID_DOMAIN 0x0DD2\r\n#define GL_MAP2_GRID_SEGMENTS 0x0DD3\r\n#define GL_TEXTURE_1D 0x0DE0\r\n#define GL_TEXTURE_2D 0x0DE1\r\n#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0\r\n#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1\r\n#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2\r\n#define GL_SELECTION_BUFFER_POINTER 0x0DF3\r\n#define GL_SELECTION_BUFFER_SIZE 0x0DF4\r\n#define GL_TEXTURE_WIDTH 0x1000\r\n#define GL_TRANSFORM_BIT 0x00001000\r\n#define GL_TEXTURE_HEIGHT 0x1001\r\n#define GL_TEXTURE_INTERNAL_FORMAT 0x1003\r\n#define GL_TEXTURE_BORDER_COLOR 0x1004\r\n#define GL_TEXTURE_BORDER 0x1005\r\n#define GL_DONT_CARE 0x1100\r\n#define GL_FASTEST 0x1101\r\n#define GL_NICEST 0x1102\r\n#define GL_AMBIENT 0x1200\r\n#define GL_DIFFUSE 0x1201\r\n#define GL_SPECULAR 0x1202\r\n#define GL_POSITION 0x1203\r\n#define GL_SPOT_DIRECTION 0x1204\r\n#define GL_SPOT_EXPONENT 0x1205\r\n#define GL_SPOT_CUTOFF 0x1206\r\n#define GL_CONSTANT_ATTENUATION 0x1207\r\n#define GL_LINEAR_ATTENUATION 0x1208\r\n#define GL_QUADRATIC_ATTENUATION 0x1209\r\n#define GL_COMPILE 0x1300\r\n#define GL_COMPILE_AND_EXECUTE 0x1301\r\n#define GL_BYTE 0x1400\r\n#define GL_UNSIGNED_BYTE 0x1401\r\n#define GL_SHORT 0x1402\r\n#define GL_UNSIGNED_SHORT 0x1403\r\n#define GL_INT 0x1404\r\n#define GL_UNSIGNED_INT 0x1405\r\n#define GL_FLOAT 0x1406\r\n#define GL_2_BYTES 0x1407\r\n#define GL_3_BYTES 0x1408\r\n#define GL_4_BYTES 0x1409\r\n#define GL_DOUBLE 0x140A\r\n#define GL_CLEAR 0x1500\r\n#define GL_AND 0x1501\r\n#define GL_AND_REVERSE 0x1502\r\n#define GL_COPY 0x1503\r\n#define GL_AND_INVERTED 0x1504\r\n#define GL_NOOP 0x1505\r\n#define GL_XOR 0x1506\r\n#define GL_OR 0x1507\r\n#define GL_NOR 0x1508\r\n#define GL_EQUIV 0x1509\r\n#define GL_INVERT 0x150A\r\n#define GL_OR_REVERSE 0x150B\r\n#define GL_COPY_INVERTED 0x150C\r\n#define GL_OR_INVERTED 0x150D\r\n#define GL_NAND 0x150E\r\n#define GL_SET 0x150F\r\n#define GL_EMISSION 0x1600\r\n#define GL_SHININESS 0x1601\r\n#define GL_AMBIENT_AND_DIFFUSE 0x1602\r\n#define GL_COLOR_INDEXES 0x1603\r\n#define GL_MODELVIEW 0x1700\r\n#define GL_PROJECTION 0x1701\r\n#define GL_TEXTURE 0x1702\r\n#define GL_COLOR 0x1800\r\n#define GL_DEPTH 0x1801\r\n#define GL_STENCIL 0x1802\r\n#define GL_COLOR_INDEX 0x1900\r\n#define GL_STENCIL_INDEX 0x1901\r\n#define GL_DEPTH_COMPONENT 0x1902\r\n#define GL_RED 0x1903\r\n#define GL_GREEN 0x1904\r\n#define GL_BLUE 0x1905\r\n#define GL_ALPHA 0x1906\r\n#define GL_RGB 0x1907\r\n#define GL_RGBA 0x1908\r\n#define GL_LUMINANCE 0x1909\r\n#define GL_LUMINANCE_ALPHA 0x190A\r\n#define GL_BITMAP 0x1A00\r\n#define GL_POINT 0x1B00\r\n#define GL_LINE 0x1B01\r\n#define GL_FILL 0x1B02\r\n#define GL_RENDER 0x1C00\r\n#define GL_FEEDBACK 0x1C01\r\n#define GL_SELECT 0x1C02\r\n#define GL_FLAT 0x1D00\r\n#define GL_SMOOTH 0x1D01\r\n#define GL_KEEP 0x1E00\r\n#define GL_REPLACE 0x1E01\r\n#define GL_INCR 0x1E02\r\n#define GL_DECR 0x1E03\r\n#define GL_VENDOR 0x1F00\r\n#define GL_RENDERER 0x1F01\r\n#define GL_VERSION 0x1F02\r\n#define GL_EXTENSIONS 0x1F03\r\n#define GL_S 0x2000\r\n#define GL_ENABLE_BIT 0x00002000\r\n#define GL_T 0x2001\r\n#define GL_R 0x2002\r\n#define GL_Q 0x2003\r\n#define GL_MODULATE 0x2100\r\n#define GL_DECAL 0x2101\r\n#define GL_TEXTURE_ENV_MODE 0x2200\r\n#define GL_TEXTURE_ENV_COLOR 0x2201\r\n#define GL_TEXTURE_ENV 0x2300\r\n#define GL_EYE_LINEAR 0x2400\r\n#define GL_OBJECT_LINEAR 0x2401\r\n#define GL_SPHERE_MAP 0x2402\r\n#define GL_TEXTURE_GEN_MODE 0x2500\r\n#define GL_OBJECT_PLANE 0x2501\r\n#define GL_EYE_PLANE 0x2502\r\n#define GL_NEAREST 0x2600\r\n#define GL_LINEAR 0x2601\r\n#define GL_NEAREST_MIPMAP_NEAREST 0x2700\r\n#define GL_LINEAR_MIPMAP_NEAREST 0x2701\r\n#define GL_NEAREST_MIPMAP_LINEAR 0x2702\r\n#define GL_LINEAR_MIPMAP_LINEAR 0x2703\r\n#define GL_TEXTURE_MAG_FILTER 0x2800\r\n#define GL_TEXTURE_MIN_FILTER 0x2801\r\n#define GL_TEXTURE_WRAP_S 0x2802\r\n#define GL_TEXTURE_WRAP_T 0x2803\r\n#define GL_CLAMP 0x2900\r\n#define GL_REPEAT 0x2901\r\n#define GL_POLYGON_OFFSET_UNITS 0x2A00\r\n#define GL_POLYGON_OFFSET_POINT 0x2A01\r\n#define GL_POLYGON_OFFSET_LINE 0x2A02\r\n#define GL_R3_G3_B2 0x2A10\r\n#define GL_V2F 0x2A20\r\n#define GL_V3F 0x2A21\r\n#define GL_C4UB_V2F 0x2A22\r\n#define GL_C4UB_V3F 0x2A23\r\n#define GL_C3F_V3F 0x2A24\r\n#define GL_N3F_V3F 0x2A25\r\n#define GL_C4F_N3F_V3F 0x2A26\r\n#define GL_T2F_V3F 0x2A27\r\n#define GL_T4F_V4F 0x2A28\r\n#define GL_T2F_C4UB_V3F 0x2A29\r\n#define GL_T2F_C3F_V3F 0x2A2A\r\n#define GL_T2F_N3F_V3F 0x2A2B\r\n#define GL_T2F_C4F_N3F_V3F 0x2A2C\r\n#define GL_T4F_C4F_N3F_V4F 0x2A2D\r\n#define GL_CLIP_PLANE0 0x3000\r\n#define GL_CLIP_PLANE1 0x3001\r\n#define GL_CLIP_PLANE2 0x3002\r\n#define GL_CLIP_PLANE3 0x3003\r\n#define GL_CLIP_PLANE4 0x3004\r\n#define GL_CLIP_PLANE5 0x3005\r\n#define GL_LIGHT0 0x4000\r\n#define GL_COLOR_BUFFER_BIT 0x00004000\r\n#define GL_LIGHT1 0x4001\r\n#define GL_LIGHT2 0x4002\r\n#define GL_LIGHT3 0x4003\r\n#define GL_LIGHT4 0x4004\r\n#define GL_LIGHT5 0x4005\r\n#define GL_LIGHT6 0x4006\r\n#define GL_LIGHT7 0x4007\r\n#define GL_HINT_BIT 0x00008000\r\n#define GL_POLYGON_OFFSET_FILL 0x8037\r\n#define GL_POLYGON_OFFSET_FACTOR 0x8038\r\n#define GL_ALPHA4 0x803B\r\n#define GL_ALPHA8 0x803C\r\n#define GL_ALPHA12 0x803D\r\n#define GL_ALPHA16 0x803E\r\n#define GL_LUMINANCE4 0x803F\r\n#define GL_LUMINANCE8 0x8040\r\n#define GL_LUMINANCE12 0x8041\r\n#define GL_LUMINANCE16 0x8042\r\n#define GL_LUMINANCE4_ALPHA4 0x8043\r\n#define GL_LUMINANCE6_ALPHA2 0x8044\r\n#define GL_LUMINANCE8_ALPHA8 0x8045\r\n#define GL_LUMINANCE12_ALPHA4 0x8046\r\n#define GL_LUMINANCE12_ALPHA12 0x8047\r\n#define GL_LUMINANCE16_ALPHA16 0x8048\r\n#define GL_INTENSITY 0x8049\r\n#define GL_INTENSITY4 0x804A\r\n#define GL_INTENSITY8 0x804B\r\n#define GL_INTENSITY12 0x804C\r\n#define GL_INTENSITY16 0x804D\r\n#define GL_RGB4 0x804F\r\n#define GL_RGB5 0x8050\r\n#define GL_RGB8 0x8051\r\n#define GL_RGB10 0x8052\r\n#define GL_RGB12 0x8053\r\n#define GL_RGB16 0x8054\r\n#define GL_RGBA2 0x8055\r\n#define GL_RGBA4 0x8056\r\n#define GL_RGB5_A1 0x8057\r\n#define GL_RGBA8 0x8058\r\n#define GL_RGB10_A2 0x8059\r\n#define GL_RGBA12 0x805A\r\n#define GL_RGBA16 0x805B\r\n#define GL_TEXTURE_RED_SIZE 0x805C\r\n#define GL_TEXTURE_GREEN_SIZE 0x805D\r\n#define GL_TEXTURE_BLUE_SIZE 0x805E\r\n#define GL_TEXTURE_ALPHA_SIZE 0x805F\r\n#define GL_TEXTURE_LUMINANCE_SIZE 0x8060\r\n#define GL_TEXTURE_INTENSITY_SIZE 0x8061\r\n#define GL_PROXY_TEXTURE_1D 0x8063\r\n#define GL_PROXY_TEXTURE_2D 0x8064\r\n#define GL_TEXTURE_PRIORITY 0x8066\r\n#define GL_TEXTURE_RESIDENT 0x8067\r\n#define GL_TEXTURE_BINDING_1D 0x8068\r\n#define GL_TEXTURE_BINDING_2D 0x8069\r\n#define GL_VERTEX_ARRAY 0x8074\r\n#define GL_NORMAL_ARRAY 0x8075\r\n#define GL_COLOR_ARRAY 0x8076\r\n#define GL_INDEX_ARRAY 0x8077\r\n#define GL_TEXTURE_COORD_ARRAY 0x8078\r\n#define GL_EDGE_FLAG_ARRAY 0x8079\r\n#define GL_VERTEX_ARRAY_SIZE 0x807A\r\n#define GL_VERTEX_ARRAY_TYPE 0x807B\r\n#define GL_VERTEX_ARRAY_STRIDE 0x807C\r\n#define GL_NORMAL_ARRAY_TYPE 0x807E\r\n#define GL_NORMAL_ARRAY_STRIDE 0x807F\r\n#define GL_COLOR_ARRAY_SIZE 0x8081\r\n#define GL_COLOR_ARRAY_TYPE 0x8082\r\n#define GL_COLOR_ARRAY_STRIDE 0x8083\r\n#define GL_INDEX_ARRAY_TYPE 0x8085\r\n#define GL_INDEX_ARRAY_STRIDE 0x8086\r\n#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088\r\n#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089\r\n#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A\r\n#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C\r\n#define GL_VERTEX_ARRAY_POINTER 0x808E\r\n#define GL_NORMAL_ARRAY_POINTER 0x808F\r\n#define GL_COLOR_ARRAY_POINTER 0x8090\r\n#define GL_INDEX_ARRAY_POINTER 0x8091\r\n#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092\r\n#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093\r\n#define GL_COLOR_INDEX1_EXT 0x80E2\r\n#define GL_COLOR_INDEX2_EXT 0x80E3\r\n#define GL_COLOR_INDEX4_EXT 0x80E4\r\n#define GL_COLOR_INDEX8_EXT 0x80E5\r\n#define GL_COLOR_INDEX12_EXT 0x80E6\r\n#define GL_COLOR_INDEX16_EXT 0x80E7\r\n#define GL_EVAL_BIT 0x00010000\r\n#define GL_LIST_BIT 0x00020000\r\n#define GL_TEXTURE_BIT 0x00040000\r\n#define GL_SCISSOR_BIT 0x00080000\r\n#define GL_ALL_ATTRIB_BITS 0x000fffff\r\n#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff\r\n\r\nGLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value);\r\nGLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref);\r\nGLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);\r\nGLAPI void GLAPIENTRY glArrayElement (GLint i);\r\nGLAPI void GLAPIENTRY glBegin (GLenum mode);\r\nGLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture);\r\nGLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);\r\nGLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);\r\nGLAPI void GLAPIENTRY glCallList (GLuint list);\r\nGLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists);\r\nGLAPI void GLAPIENTRY glClear (GLbitfield mask);\r\nGLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\nGLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\nGLAPI void GLAPIENTRY glClearDepth (GLclampd depth);\r\nGLAPI void GLAPIENTRY glClearIndex (GLfloat c);\r\nGLAPI void GLAPIENTRY glClearStencil (GLint s);\r\nGLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation);\r\nGLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue);\r\nGLAPI void GLAPIENTRY glColor3bv (const GLbyte *v);\r\nGLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue);\r\nGLAPI void GLAPIENTRY glColor3dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue);\r\nGLAPI void GLAPIENTRY glColor3fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue);\r\nGLAPI void GLAPIENTRY glColor3iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue);\r\nGLAPI void GLAPIENTRY glColor3sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue);\r\nGLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v);\r\nGLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue);\r\nGLAPI void GLAPIENTRY glColor3uiv (const GLuint *v);\r\nGLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue);\r\nGLAPI void GLAPIENTRY glColor3usv (const GLushort *v);\r\nGLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);\r\nGLAPI void GLAPIENTRY glColor4bv (const GLbyte *v);\r\nGLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);\r\nGLAPI void GLAPIENTRY glColor4dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\nGLAPI void GLAPIENTRY glColor4fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha);\r\nGLAPI void GLAPIENTRY glColor4iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);\r\nGLAPI void GLAPIENTRY glColor4sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\r\nGLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v);\r\nGLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);\r\nGLAPI void GLAPIENTRY glColor4uiv (const GLuint *v);\r\nGLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);\r\nGLAPI void GLAPIENTRY glColor4usv (const GLushort *v);\r\nGLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\nGLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode);\r\nGLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);\r\nGLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);\r\nGLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\nGLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\nGLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void GLAPIENTRY glCullFace (GLenum mode);\r\nGLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range);\r\nGLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);\r\nGLAPI void GLAPIENTRY glDepthFunc (GLenum func);\r\nGLAPI void GLAPIENTRY glDepthMask (GLboolean flag);\r\nGLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar);\r\nGLAPI void GLAPIENTRY glDisable (GLenum cap);\r\nGLAPI void GLAPIENTRY glDisableClientState (GLenum array);\r\nGLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);\r\nGLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);\r\nGLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);\r\nGLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag);\r\nGLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer);\r\nGLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag);\r\nGLAPI void GLAPIENTRY glEnable (GLenum cap);\r\nGLAPI void GLAPIENTRY glEnableClientState (GLenum array);\r\nGLAPI void GLAPIENTRY glEnd (void);\r\nGLAPI void GLAPIENTRY glEndList (void);\r\nGLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u);\r\nGLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u);\r\nGLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u);\r\nGLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u);\r\nGLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v);\r\nGLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u);\r\nGLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v);\r\nGLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u);\r\nGLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2);\r\nGLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);\r\nGLAPI void GLAPIENTRY glEvalPoint1 (GLint i);\r\nGLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j);\r\nGLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);\r\nGLAPI void GLAPIENTRY glFinish (void);\r\nGLAPI void GLAPIENTRY glFlush (void);\r\nGLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glFrontFace (GLenum mode);\r\nGLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\r\nGLAPI GLuint GLAPIENTRY glGenLists (GLsizei range);\r\nGLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures);\r\nGLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params);\r\nGLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation);\r\nGLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params);\r\nGLAPI GLenum GLAPIENTRY glGetError (void);\r\nGLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v);\r\nGLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v);\r\nGLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v);\r\nGLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values);\r\nGLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values);\r\nGLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values);\r\nGLAPI void GLAPIENTRY glGetPointerv (GLenum pname, GLvoid* *params);\r\nGLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask);\r\nGLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name);\r\nGLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);\r\nGLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode);\r\nGLAPI void GLAPIENTRY glIndexMask (GLuint mask);\r\nGLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void GLAPIENTRY glIndexd (GLdouble c);\r\nGLAPI void GLAPIENTRY glIndexdv (const GLdouble *c);\r\nGLAPI void GLAPIENTRY glIndexf (GLfloat c);\r\nGLAPI void GLAPIENTRY glIndexfv (const GLfloat *c);\r\nGLAPI void GLAPIENTRY glIndexi (GLint c);\r\nGLAPI void GLAPIENTRY glIndexiv (const GLint *c);\r\nGLAPI void GLAPIENTRY glIndexs (GLshort c);\r\nGLAPI void GLAPIENTRY glIndexsv (const GLshort *c);\r\nGLAPI void GLAPIENTRY glIndexub (GLubyte c);\r\nGLAPI void GLAPIENTRY glIndexubv (const GLubyte *c);\r\nGLAPI void GLAPIENTRY glInitNames (void);\r\nGLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer);\r\nGLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap);\r\nGLAPI GLboolean GLAPIENTRY glIsList (GLuint list);\r\nGLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture);\r\nGLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern);\r\nGLAPI void GLAPIENTRY glLineWidth (GLfloat width);\r\nGLAPI void GLAPIENTRY glListBase (GLuint base);\r\nGLAPI void GLAPIENTRY glLoadIdentity (void);\r\nGLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m);\r\nGLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m);\r\nGLAPI void GLAPIENTRY glLoadName (GLuint name);\r\nGLAPI void GLAPIENTRY glLogicOp (GLenum opcode);\r\nGLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);\r\nGLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);\r\nGLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);\r\nGLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);\r\nGLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);\r\nGLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);\r\nGLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);\r\nGLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);\r\nGLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glMatrixMode (GLenum mode);\r\nGLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m);\r\nGLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m);\r\nGLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode);\r\nGLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);\r\nGLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v);\r\nGLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);\r\nGLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);\r\nGLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz);\r\nGLAPI void GLAPIENTRY glNormal3iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz);\r\nGLAPI void GLAPIENTRY glNormal3sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\r\nGLAPI void GLAPIENTRY glPassThrough (GLfloat token);\r\nGLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values);\r\nGLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values);\r\nGLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values);\r\nGLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor);\r\nGLAPI void GLAPIENTRY glPointSize (GLfloat size);\r\nGLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode);\r\nGLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units);\r\nGLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask);\r\nGLAPI void GLAPIENTRY glPopAttrib (void);\r\nGLAPI void GLAPIENTRY glPopClientAttrib (void);\r\nGLAPI void GLAPIENTRY glPopMatrix (void);\r\nGLAPI void GLAPIENTRY glPopName (void);\r\nGLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities);\r\nGLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask);\r\nGLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask);\r\nGLAPI void GLAPIENTRY glPushMatrix (void);\r\nGLAPI void GLAPIENTRY glPushName (GLuint name);\r\nGLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y);\r\nGLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y);\r\nGLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y);\r\nGLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y);\r\nGLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z);\r\nGLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z);\r\nGLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glReadBuffer (GLenum mode);\r\nGLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);\r\nGLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2);\r\nGLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);\r\nGLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2);\r\nGLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2);\r\nGLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2);\r\nGLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);\r\nGLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2);\r\nGLAPI GLint GLAPIENTRY glRenderMode (GLenum mode);\r\nGLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer);\r\nGLAPI void GLAPIENTRY glShadeModel (GLenum mode);\r\nGLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);\r\nGLAPI void GLAPIENTRY glStencilMask (GLuint mask);\r\nGLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\r\nGLAPI void GLAPIENTRY glTexCoord1d (GLdouble s);\r\nGLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glTexCoord1f (GLfloat s);\r\nGLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glTexCoord1i (GLint s);\r\nGLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glTexCoord1s (GLshort s);\r\nGLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t);\r\nGLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t);\r\nGLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t);\r\nGLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t);\r\nGLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);\r\nGLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);\r\nGLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r);\r\nGLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r);\r\nGLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\nGLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\nGLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q);\r\nGLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);\r\nGLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param);\r\nGLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params);\r\nGLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);\r\nGLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y);\r\nGLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y);\r\nGLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y);\r\nGLAPI void GLAPIENTRY glVertex2iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y);\r\nGLAPI void GLAPIENTRY glVertex2sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z);\r\nGLAPI void GLAPIENTRY glVertex3iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z);\r\nGLAPI void GLAPIENTRY glVertex3sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v);\r\nGLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v);\r\nGLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void GLAPIENTRY glVertex4iv (const GLint *v);\r\nGLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void GLAPIENTRY glVertex4sv (const GLshort *v);\r\nGLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\r\n#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1)\r\n\r\n#endif /* GL_VERSION_1_1 */\r\n\r\n/* ---------------------------------- GLU ---------------------------------- */\r\n\r\n#ifndef GLEW_NO_GLU\r\n/* this is where we can safely include GLU */\r\n#  if defined(__APPLE__) && defined(__MACH__)\r\n#    include <OpenGL/glu.h>\r\n#  else\r\n#    include <GL/glu.h>\r\n#  endif\r\n#endif\r\n\r\n/* ----------------------------- GL_VERSION_1_2 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_1_2\r\n#define GL_VERSION_1_2 1\r\n\r\n#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12\r\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13\r\n#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22\r\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23\r\n#define GL_UNSIGNED_BYTE_3_3_2 0x8032\r\n#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033\r\n#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034\r\n#define GL_UNSIGNED_INT_8_8_8_8 0x8035\r\n#define GL_UNSIGNED_INT_10_10_10_2 0x8036\r\n#define GL_RESCALE_NORMAL 0x803A\r\n#define GL_TEXTURE_BINDING_3D 0x806A\r\n#define GL_PACK_SKIP_IMAGES 0x806B\r\n#define GL_PACK_IMAGE_HEIGHT 0x806C\r\n#define GL_UNPACK_SKIP_IMAGES 0x806D\r\n#define GL_UNPACK_IMAGE_HEIGHT 0x806E\r\n#define GL_TEXTURE_3D 0x806F\r\n#define GL_PROXY_TEXTURE_3D 0x8070\r\n#define GL_TEXTURE_DEPTH 0x8071\r\n#define GL_TEXTURE_WRAP_R 0x8072\r\n#define GL_MAX_3D_TEXTURE_SIZE 0x8073\r\n#define GL_BGR 0x80E0\r\n#define GL_BGRA 0x80E1\r\n#define GL_MAX_ELEMENTS_VERTICES 0x80E8\r\n#define GL_MAX_ELEMENTS_INDICES 0x80E9\r\n#define GL_CLAMP_TO_EDGE 0x812F\r\n#define GL_TEXTURE_MIN_LOD 0x813A\r\n#define GL_TEXTURE_MAX_LOD 0x813B\r\n#define GL_TEXTURE_BASE_LEVEL 0x813C\r\n#define GL_TEXTURE_MAX_LEVEL 0x813D\r\n#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8\r\n#define GL_SINGLE_COLOR 0x81F9\r\n#define GL_SEPARATE_SPECULAR_COLOR 0x81FA\r\n#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362\r\n#define GL_UNSIGNED_SHORT_5_6_5 0x8363\r\n#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364\r\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365\r\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366\r\n#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367\r\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\r\n#define GL_ALIASED_POINT_SIZE_RANGE 0x846D\r\n#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\n\r\n#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D)\r\n#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements)\r\n#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D)\r\n#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D)\r\n\r\n#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2)\r\n\r\n#endif /* GL_VERSION_1_2 */\r\n\r\n/* ---------------------------- GL_VERSION_1_2_1 --------------------------- */\r\n\r\n#ifndef GL_VERSION_1_2_1\r\n#define GL_VERSION_1_2_1 1\r\n\r\n#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1)\r\n\r\n#endif /* GL_VERSION_1_2_1 */\r\n\r\n/* ----------------------------- GL_VERSION_1_3 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_1_3\r\n#define GL_VERSION_1_3 1\r\n\r\n#define GL_MULTISAMPLE 0x809D\r\n#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE 0x809F\r\n#define GL_SAMPLE_COVERAGE 0x80A0\r\n#define GL_SAMPLE_BUFFERS 0x80A8\r\n#define GL_SAMPLES 0x80A9\r\n#define GL_SAMPLE_COVERAGE_VALUE 0x80AA\r\n#define GL_SAMPLE_COVERAGE_INVERT 0x80AB\r\n#define GL_CLAMP_TO_BORDER 0x812D\r\n#define GL_TEXTURE0 0x84C0\r\n#define GL_TEXTURE1 0x84C1\r\n#define GL_TEXTURE2 0x84C2\r\n#define GL_TEXTURE3 0x84C3\r\n#define GL_TEXTURE4 0x84C4\r\n#define GL_TEXTURE5 0x84C5\r\n#define GL_TEXTURE6 0x84C6\r\n#define GL_TEXTURE7 0x84C7\r\n#define GL_TEXTURE8 0x84C8\r\n#define GL_TEXTURE9 0x84C9\r\n#define GL_TEXTURE10 0x84CA\r\n#define GL_TEXTURE11 0x84CB\r\n#define GL_TEXTURE12 0x84CC\r\n#define GL_TEXTURE13 0x84CD\r\n#define GL_TEXTURE14 0x84CE\r\n#define GL_TEXTURE15 0x84CF\r\n#define GL_TEXTURE16 0x84D0\r\n#define GL_TEXTURE17 0x84D1\r\n#define GL_TEXTURE18 0x84D2\r\n#define GL_TEXTURE19 0x84D3\r\n#define GL_TEXTURE20 0x84D4\r\n#define GL_TEXTURE21 0x84D5\r\n#define GL_TEXTURE22 0x84D6\r\n#define GL_TEXTURE23 0x84D7\r\n#define GL_TEXTURE24 0x84D8\r\n#define GL_TEXTURE25 0x84D9\r\n#define GL_TEXTURE26 0x84DA\r\n#define GL_TEXTURE27 0x84DB\r\n#define GL_TEXTURE28 0x84DC\r\n#define GL_TEXTURE29 0x84DD\r\n#define GL_TEXTURE30 0x84DE\r\n#define GL_TEXTURE31 0x84DF\r\n#define GL_ACTIVE_TEXTURE 0x84E0\r\n#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1\r\n#define GL_MAX_TEXTURE_UNITS 0x84E2\r\n#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3\r\n#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4\r\n#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5\r\n#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6\r\n#define GL_SUBTRACT 0x84E7\r\n#define GL_COMPRESSED_ALPHA 0x84E9\r\n#define GL_COMPRESSED_LUMINANCE 0x84EA\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB\r\n#define GL_COMPRESSED_INTENSITY 0x84EC\r\n#define GL_COMPRESSED_RGB 0x84ED\r\n#define GL_COMPRESSED_RGBA 0x84EE\r\n#define GL_TEXTURE_COMPRESSION_HINT 0x84EF\r\n#define GL_NORMAL_MAP 0x8511\r\n#define GL_REFLECTION_MAP 0x8512\r\n#define GL_TEXTURE_CUBE_MAP 0x8513\r\n#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B\r\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C\r\n#define GL_COMBINE 0x8570\r\n#define GL_COMBINE_RGB 0x8571\r\n#define GL_COMBINE_ALPHA 0x8572\r\n#define GL_RGB_SCALE 0x8573\r\n#define GL_ADD_SIGNED 0x8574\r\n#define GL_INTERPOLATE 0x8575\r\n#define GL_CONSTANT 0x8576\r\n#define GL_PRIMARY_COLOR 0x8577\r\n#define GL_PREVIOUS 0x8578\r\n#define GL_SOURCE0_RGB 0x8580\r\n#define GL_SOURCE1_RGB 0x8581\r\n#define GL_SOURCE2_RGB 0x8582\r\n#define GL_SOURCE0_ALPHA 0x8588\r\n#define GL_SOURCE1_ALPHA 0x8589\r\n#define GL_SOURCE2_ALPHA 0x858A\r\n#define GL_OPERAND0_RGB 0x8590\r\n#define GL_OPERAND1_RGB 0x8591\r\n#define GL_OPERAND2_RGB 0x8592\r\n#define GL_OPERAND0_ALPHA 0x8598\r\n#define GL_OPERAND1_ALPHA 0x8599\r\n#define GL_OPERAND2_ALPHA 0x859A\r\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0\r\n#define GL_TEXTURE_COMPRESSED 0x86A1\r\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\r\n#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3\r\n#define GL_DOT3_RGB 0x86AE\r\n#define GL_DOT3_RGBA 0x86AF\r\n#define GL_MULTISAMPLE_BIT 0x20000000\r\n\r\ntypedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture);\r\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLvoid *img);\r\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);\r\n\r\n#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture)\r\n#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture)\r\n#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D)\r\n#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D)\r\n#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D)\r\n#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D)\r\n#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D)\r\n#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D)\r\n#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage)\r\n#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd)\r\n#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf)\r\n#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd)\r\n#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf)\r\n#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d)\r\n#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv)\r\n#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f)\r\n#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv)\r\n#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i)\r\n#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv)\r\n#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s)\r\n#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv)\r\n#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d)\r\n#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv)\r\n#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f)\r\n#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv)\r\n#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i)\r\n#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv)\r\n#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s)\r\n#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv)\r\n#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d)\r\n#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv)\r\n#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f)\r\n#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv)\r\n#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i)\r\n#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv)\r\n#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s)\r\n#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv)\r\n#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d)\r\n#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv)\r\n#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f)\r\n#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv)\r\n#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i)\r\n#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv)\r\n#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s)\r\n#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv)\r\n#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage)\r\n\r\n#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3)\r\n\r\n#endif /* GL_VERSION_1_3 */\r\n\r\n/* ----------------------------- GL_VERSION_1_4 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_1_4\r\n#define GL_VERSION_1_4 1\r\n\r\n#define GL_BLEND_DST_RGB 0x80C8\r\n#define GL_BLEND_SRC_RGB 0x80C9\r\n#define GL_BLEND_DST_ALPHA 0x80CA\r\n#define GL_BLEND_SRC_ALPHA 0x80CB\r\n#define GL_POINT_SIZE_MIN 0x8126\r\n#define GL_POINT_SIZE_MAX 0x8127\r\n#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128\r\n#define GL_POINT_DISTANCE_ATTENUATION 0x8129\r\n#define GL_GENERATE_MIPMAP 0x8191\r\n#define GL_GENERATE_MIPMAP_HINT 0x8192\r\n#define GL_DEPTH_COMPONENT16 0x81A5\r\n#define GL_DEPTH_COMPONENT24 0x81A6\r\n#define GL_DEPTH_COMPONENT32 0x81A7\r\n#define GL_MIRRORED_REPEAT 0x8370\r\n#define GL_FOG_COORDINATE_SOURCE 0x8450\r\n#define GL_FOG_COORDINATE 0x8451\r\n#define GL_FRAGMENT_DEPTH 0x8452\r\n#define GL_CURRENT_FOG_COORDINATE 0x8453\r\n#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454\r\n#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455\r\n#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456\r\n#define GL_FOG_COORDINATE_ARRAY 0x8457\r\n#define GL_COLOR_SUM 0x8458\r\n#define GL_CURRENT_SECONDARY_COLOR 0x8459\r\n#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A\r\n#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B\r\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C\r\n#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D\r\n#define GL_SECONDARY_COLOR_ARRAY 0x845E\r\n#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD\r\n#define GL_TEXTURE_FILTER_CONTROL 0x8500\r\n#define GL_TEXTURE_LOD_BIAS 0x8501\r\n#define GL_INCR_WRAP 0x8507\r\n#define GL_DECR_WRAP 0x8508\r\n#define GL_TEXTURE_DEPTH_SIZE 0x884A\r\n#define GL_DEPTH_TEXTURE_MODE 0x884B\r\n#define GL_TEXTURE_COMPARE_MODE 0x884C\r\n#define GL_TEXTURE_COMPARE_FUNC 0x884D\r\n#define GL_COMPARE_R_TO_TEXTURE 0x884E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei drawcount);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p);\r\n\r\n#define glBlendColor GLEW_GET_FUN(__glewBlendColor)\r\n#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation)\r\n#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate)\r\n#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer)\r\n#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd)\r\n#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv)\r\n#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf)\r\n#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv)\r\n#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays)\r\n#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements)\r\n#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf)\r\n#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv)\r\n#define glPointParameteri GLEW_GET_FUN(__glewPointParameteri)\r\n#define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv)\r\n#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b)\r\n#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv)\r\n#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d)\r\n#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv)\r\n#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f)\r\n#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv)\r\n#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i)\r\n#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv)\r\n#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s)\r\n#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv)\r\n#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub)\r\n#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv)\r\n#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui)\r\n#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv)\r\n#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us)\r\n#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv)\r\n#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer)\r\n#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d)\r\n#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv)\r\n#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f)\r\n#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv)\r\n#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i)\r\n#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv)\r\n#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s)\r\n#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv)\r\n#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d)\r\n#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv)\r\n#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f)\r\n#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv)\r\n#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i)\r\n#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv)\r\n#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s)\r\n#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv)\r\n\r\n#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4)\r\n\r\n#endif /* GL_VERSION_1_4 */\r\n\r\n/* ----------------------------- GL_VERSION_1_5 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_1_5\r\n#define GL_VERSION_1_5 1\r\n\r\n#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE\r\n#define GL_FOG_COORD GL_FOG_COORDINATE\r\n#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY\r\n#define GL_SRC0_RGB GL_SOURCE0_RGB\r\n#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER\r\n#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE\r\n#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA\r\n#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE\r\n#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE\r\n#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA\r\n#define GL_SRC1_RGB GL_SOURCE1_RGB\r\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\r\n#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA\r\n#define GL_SRC2_RGB GL_SOURCE2_RGB\r\n#define GL_BUFFER_SIZE 0x8764\r\n#define GL_BUFFER_USAGE 0x8765\r\n#define GL_QUERY_COUNTER_BITS 0x8864\r\n#define GL_CURRENT_QUERY 0x8865\r\n#define GL_QUERY_RESULT 0x8866\r\n#define GL_QUERY_RESULT_AVAILABLE 0x8867\r\n#define GL_ARRAY_BUFFER 0x8892\r\n#define GL_ELEMENT_ARRAY_BUFFER 0x8893\r\n#define GL_ARRAY_BUFFER_BINDING 0x8894\r\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895\r\n#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896\r\n#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897\r\n#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898\r\n#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899\r\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\r\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\r\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\r\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\r\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E\r\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\r\n#define GL_READ_ONLY 0x88B8\r\n#define GL_WRITE_ONLY 0x88B9\r\n#define GL_READ_WRITE 0x88BA\r\n#define GL_BUFFER_ACCESS 0x88BB\r\n#define GL_BUFFER_MAPPED 0x88BC\r\n#define GL_BUFFER_MAP_POINTER 0x88BD\r\n#define GL_STREAM_DRAW 0x88E0\r\n#define GL_STREAM_READ 0x88E1\r\n#define GL_STREAM_COPY 0x88E2\r\n#define GL_STATIC_DRAW 0x88E4\r\n#define GL_STATIC_READ 0x88E5\r\n#define GL_STATIC_COPY 0x88E6\r\n#define GL_DYNAMIC_DRAW 0x88E8\r\n#define GL_DYNAMIC_READ 0x88E9\r\n#define GL_DYNAMIC_COPY 0x88EA\r\n#define GL_SAMPLES_PASSED 0x8914\r\n\r\ntypedef ptrdiff_t GLintptr;\r\ntypedef ptrdiff_t GLsizeiptr;\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);\r\ntypedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);\r\ntypedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid** params);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id);\r\ntypedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target);\r\n\r\n#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery)\r\n#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer)\r\n#define glBufferData GLEW_GET_FUN(__glewBufferData)\r\n#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData)\r\n#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers)\r\n#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries)\r\n#define glEndQuery GLEW_GET_FUN(__glewEndQuery)\r\n#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers)\r\n#define glGenQueries GLEW_GET_FUN(__glewGenQueries)\r\n#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv)\r\n#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv)\r\n#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData)\r\n#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv)\r\n#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv)\r\n#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv)\r\n#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer)\r\n#define glIsQuery GLEW_GET_FUN(__glewIsQuery)\r\n#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer)\r\n#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer)\r\n\r\n#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5)\r\n\r\n#endif /* GL_VERSION_1_5 */\r\n\r\n/* ----------------------------- GL_VERSION_2_0 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_2_0\r\n#define GL_VERSION_2_0 1\r\n\r\n#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION\r\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622\r\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623\r\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624\r\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625\r\n#define GL_CURRENT_VERTEX_ATTRIB 0x8626\r\n#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642\r\n#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643\r\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645\r\n#define GL_STENCIL_BACK_FUNC 0x8800\r\n#define GL_STENCIL_BACK_FAIL 0x8801\r\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802\r\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803\r\n#define GL_MAX_DRAW_BUFFERS 0x8824\r\n#define GL_DRAW_BUFFER0 0x8825\r\n#define GL_DRAW_BUFFER1 0x8826\r\n#define GL_DRAW_BUFFER2 0x8827\r\n#define GL_DRAW_BUFFER3 0x8828\r\n#define GL_DRAW_BUFFER4 0x8829\r\n#define GL_DRAW_BUFFER5 0x882A\r\n#define GL_DRAW_BUFFER6 0x882B\r\n#define GL_DRAW_BUFFER7 0x882C\r\n#define GL_DRAW_BUFFER8 0x882D\r\n#define GL_DRAW_BUFFER9 0x882E\r\n#define GL_DRAW_BUFFER10 0x882F\r\n#define GL_DRAW_BUFFER11 0x8830\r\n#define GL_DRAW_BUFFER12 0x8831\r\n#define GL_DRAW_BUFFER13 0x8832\r\n#define GL_DRAW_BUFFER14 0x8833\r\n#define GL_DRAW_BUFFER15 0x8834\r\n#define GL_BLEND_EQUATION_ALPHA 0x883D\r\n#define GL_POINT_SPRITE 0x8861\r\n#define GL_COORD_REPLACE 0x8862\r\n#define GL_MAX_VERTEX_ATTRIBS 0x8869\r\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\r\n#define GL_MAX_TEXTURE_COORDS 0x8871\r\n#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872\r\n#define GL_FRAGMENT_SHADER 0x8B30\r\n#define GL_VERTEX_SHADER 0x8B31\r\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\r\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A\r\n#define GL_MAX_VARYING_FLOATS 0x8B4B\r\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\r\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\r\n#define GL_SHADER_TYPE 0x8B4F\r\n#define GL_FLOAT_VEC2 0x8B50\r\n#define GL_FLOAT_VEC3 0x8B51\r\n#define GL_FLOAT_VEC4 0x8B52\r\n#define GL_INT_VEC2 0x8B53\r\n#define GL_INT_VEC3 0x8B54\r\n#define GL_INT_VEC4 0x8B55\r\n#define GL_BOOL 0x8B56\r\n#define GL_BOOL_VEC2 0x8B57\r\n#define GL_BOOL_VEC3 0x8B58\r\n#define GL_BOOL_VEC4 0x8B59\r\n#define GL_FLOAT_MAT2 0x8B5A\r\n#define GL_FLOAT_MAT3 0x8B5B\r\n#define GL_FLOAT_MAT4 0x8B5C\r\n#define GL_SAMPLER_1D 0x8B5D\r\n#define GL_SAMPLER_2D 0x8B5E\r\n#define GL_SAMPLER_3D 0x8B5F\r\n#define GL_SAMPLER_CUBE 0x8B60\r\n#define GL_SAMPLER_1D_SHADOW 0x8B61\r\n#define GL_SAMPLER_2D_SHADOW 0x8B62\r\n#define GL_DELETE_STATUS 0x8B80\r\n#define GL_COMPILE_STATUS 0x8B81\r\n#define GL_LINK_STATUS 0x8B82\r\n#define GL_VALIDATE_STATUS 0x8B83\r\n#define GL_INFO_LOG_LENGTH 0x8B84\r\n#define GL_ATTACHED_SHADERS 0x8B85\r\n#define GL_ACTIVE_UNIFORMS 0x8B86\r\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87\r\n#define GL_SHADER_SOURCE_LENGTH 0x8B88\r\n#define GL_ACTIVE_ATTRIBUTES 0x8B89\r\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A\r\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\r\n#define GL_SHADING_LANGUAGE_VERSION 0x8B8C\r\n#define GL_CURRENT_PROGRAM 0x8B8D\r\n#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0\r\n#define GL_LOWER_LEFT 0x8CA1\r\n#define GL_UPPER_LEFT 0x8CA2\r\n#define GL_STENCIL_BACK_REF 0x8CA3\r\n#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4\r\n#define GL_STENCIL_BACK_WRITEMASK 0x8CA5\r\n\r\ntypedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);\r\ntypedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum, GLenum);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader);\r\ntypedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void);\r\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader);\r\ntypedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);\r\ntypedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\r\ntypedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source);\r\ntypedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint, GLenum, GLvoid**);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint, GLenum, GLdouble*);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint, GLenum, GLint*);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader);\r\ntypedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);\r\n\r\n#define glAttachShader GLEW_GET_FUN(__glewAttachShader)\r\n#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)\r\n#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)\r\n#define glCompileShader GLEW_GET_FUN(__glewCompileShader)\r\n#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram)\r\n#define glCreateShader GLEW_GET_FUN(__glewCreateShader)\r\n#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram)\r\n#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader)\r\n#define glDetachShader GLEW_GET_FUN(__glewDetachShader)\r\n#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray)\r\n#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers)\r\n#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray)\r\n#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib)\r\n#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform)\r\n#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders)\r\n#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation)\r\n#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog)\r\n#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv)\r\n#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog)\r\n#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource)\r\n#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv)\r\n#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation)\r\n#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv)\r\n#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv)\r\n#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv)\r\n#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv)\r\n#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv)\r\n#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv)\r\n#define glIsProgram GLEW_GET_FUN(__glewIsProgram)\r\n#define glIsShader GLEW_GET_FUN(__glewIsShader)\r\n#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram)\r\n#define glShaderSource GLEW_GET_FUN(__glewShaderSource)\r\n#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate)\r\n#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate)\r\n#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate)\r\n#define glUniform1f GLEW_GET_FUN(__glewUniform1f)\r\n#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv)\r\n#define glUniform1i GLEW_GET_FUN(__glewUniform1i)\r\n#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv)\r\n#define glUniform2f GLEW_GET_FUN(__glewUniform2f)\r\n#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv)\r\n#define glUniform2i GLEW_GET_FUN(__glewUniform2i)\r\n#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv)\r\n#define glUniform3f GLEW_GET_FUN(__glewUniform3f)\r\n#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv)\r\n#define glUniform3i GLEW_GET_FUN(__glewUniform3i)\r\n#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv)\r\n#define glUniform4f GLEW_GET_FUN(__glewUniform4f)\r\n#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv)\r\n#define glUniform4i GLEW_GET_FUN(__glewUniform4i)\r\n#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv)\r\n#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv)\r\n#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv)\r\n#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv)\r\n#define glUseProgram GLEW_GET_FUN(__glewUseProgram)\r\n#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram)\r\n#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d)\r\n#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv)\r\n#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f)\r\n#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv)\r\n#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s)\r\n#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv)\r\n#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d)\r\n#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv)\r\n#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f)\r\n#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv)\r\n#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s)\r\n#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv)\r\n#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d)\r\n#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv)\r\n#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f)\r\n#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv)\r\n#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s)\r\n#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv)\r\n#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv)\r\n#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv)\r\n#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv)\r\n#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub)\r\n#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv)\r\n#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv)\r\n#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv)\r\n#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv)\r\n#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d)\r\n#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv)\r\n#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f)\r\n#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv)\r\n#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv)\r\n#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s)\r\n#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv)\r\n#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv)\r\n#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)\r\n#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)\r\n#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)\r\n\r\n#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)\r\n\r\n#endif /* GL_VERSION_2_0 */\r\n\r\n/* ----------------------------- GL_VERSION_2_1 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_2_1\r\n#define GL_VERSION_2_1 1\r\n\r\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\r\n#define GL_PIXEL_PACK_BUFFER 0x88EB\r\n#define GL_PIXEL_UNPACK_BUFFER 0x88EC\r\n#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED\r\n#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF\r\n#define GL_FLOAT_MAT2x3 0x8B65\r\n#define GL_FLOAT_MAT2x4 0x8B66\r\n#define GL_FLOAT_MAT3x2 0x8B67\r\n#define GL_FLOAT_MAT3x4 0x8B68\r\n#define GL_FLOAT_MAT4x2 0x8B69\r\n#define GL_FLOAT_MAT4x3 0x8B6A\r\n#define GL_SRGB 0x8C40\r\n#define GL_SRGB8 0x8C41\r\n#define GL_SRGB_ALPHA 0x8C42\r\n#define GL_SRGB8_ALPHA8 0x8C43\r\n#define GL_SLUMINANCE_ALPHA 0x8C44\r\n#define GL_SLUMINANCE8_ALPHA8 0x8C45\r\n#define GL_SLUMINANCE 0x8C46\r\n#define GL_SLUMINANCE8 0x8C47\r\n#define GL_COMPRESSED_SRGB 0x8C48\r\n#define GL_COMPRESSED_SRGB_ALPHA 0x8C49\r\n#define GL_COMPRESSED_SLUMINANCE 0x8C4A\r\n#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B\r\n\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\n\r\n#define glUniformMatrix2x3fv GLEW_GET_FUN(__glewUniformMatrix2x3fv)\r\n#define glUniformMatrix2x4fv GLEW_GET_FUN(__glewUniformMatrix2x4fv)\r\n#define glUniformMatrix3x2fv GLEW_GET_FUN(__glewUniformMatrix3x2fv)\r\n#define glUniformMatrix3x4fv GLEW_GET_FUN(__glewUniformMatrix3x4fv)\r\n#define glUniformMatrix4x2fv GLEW_GET_FUN(__glewUniformMatrix4x2fv)\r\n#define glUniformMatrix4x3fv GLEW_GET_FUN(__glewUniformMatrix4x3fv)\r\n\r\n#define GLEW_VERSION_2_1 GLEW_GET_VAR(__GLEW_VERSION_2_1)\r\n\r\n#endif /* GL_VERSION_2_1 */\r\n\r\n/* ----------------------------- GL_VERSION_3_0 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_3_0\r\n#define GL_VERSION_3_0 1\r\n\r\n#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES\r\n#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5\r\n#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1\r\n#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3\r\n#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB\r\n#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0\r\n#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4\r\n#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2\r\n#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS\r\n#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001\r\n#define GL_MAJOR_VERSION 0x821B\r\n#define GL_MINOR_VERSION 0x821C\r\n#define GL_NUM_EXTENSIONS 0x821D\r\n#define GL_CONTEXT_FLAGS 0x821E\r\n#define GL_DEPTH_BUFFER 0x8223\r\n#define GL_STENCIL_BUFFER 0x8224\r\n#define GL_COMPRESSED_RED 0x8225\r\n#define GL_COMPRESSED_RG 0x8226\r\n#define GL_RGBA32F 0x8814\r\n#define GL_RGB32F 0x8815\r\n#define GL_RGBA16F 0x881A\r\n#define GL_RGB16F 0x881B\r\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD\r\n#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF\r\n#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904\r\n#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905\r\n#define GL_CLAMP_VERTEX_COLOR 0x891A\r\n#define GL_CLAMP_FRAGMENT_COLOR 0x891B\r\n#define GL_CLAMP_READ_COLOR 0x891C\r\n#define GL_FIXED_ONLY 0x891D\r\n#define GL_TEXTURE_RED_TYPE 0x8C10\r\n#define GL_TEXTURE_GREEN_TYPE 0x8C11\r\n#define GL_TEXTURE_BLUE_TYPE 0x8C12\r\n#define GL_TEXTURE_ALPHA_TYPE 0x8C13\r\n#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14\r\n#define GL_TEXTURE_INTENSITY_TYPE 0x8C15\r\n#define GL_TEXTURE_DEPTH_TYPE 0x8C16\r\n#define GL_TEXTURE_1D_ARRAY 0x8C18\r\n#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19\r\n#define GL_TEXTURE_2D_ARRAY 0x8C1A\r\n#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B\r\n#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C\r\n#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D\r\n#define GL_R11F_G11F_B10F 0x8C3A\r\n#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B\r\n#define GL_RGB9_E5 0x8C3D\r\n#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E\r\n#define GL_TEXTURE_SHARED_SIZE 0x8C3F\r\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80\r\n#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85\r\n#define GL_PRIMITIVES_GENERATED 0x8C87\r\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88\r\n#define GL_RASTERIZER_DISCARD 0x8C89\r\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B\r\n#define GL_INTERLEAVED_ATTRIBS 0x8C8C\r\n#define GL_SEPARATE_ATTRIBS 0x8C8D\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F\r\n#define GL_RGBA32UI 0x8D70\r\n#define GL_RGB32UI 0x8D71\r\n#define GL_RGBA16UI 0x8D76\r\n#define GL_RGB16UI 0x8D77\r\n#define GL_RGBA8UI 0x8D7C\r\n#define GL_RGB8UI 0x8D7D\r\n#define GL_RGBA32I 0x8D82\r\n#define GL_RGB32I 0x8D83\r\n#define GL_RGBA16I 0x8D88\r\n#define GL_RGB16I 0x8D89\r\n#define GL_RGBA8I 0x8D8E\r\n#define GL_RGB8I 0x8D8F\r\n#define GL_RED_INTEGER 0x8D94\r\n#define GL_GREEN_INTEGER 0x8D95\r\n#define GL_BLUE_INTEGER 0x8D96\r\n#define GL_ALPHA_INTEGER 0x8D97\r\n#define GL_RGB_INTEGER 0x8D98\r\n#define GL_RGBA_INTEGER 0x8D99\r\n#define GL_BGR_INTEGER 0x8D9A\r\n#define GL_BGRA_INTEGER 0x8D9B\r\n#define GL_SAMPLER_1D_ARRAY 0x8DC0\r\n#define GL_SAMPLER_2D_ARRAY 0x8DC1\r\n#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3\r\n#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4\r\n#define GL_SAMPLER_CUBE_SHADOW 0x8DC5\r\n#define GL_UNSIGNED_INT_VEC2 0x8DC6\r\n#define GL_UNSIGNED_INT_VEC3 0x8DC7\r\n#define GL_UNSIGNED_INT_VEC4 0x8DC8\r\n#define GL_INT_SAMPLER_1D 0x8DC9\r\n#define GL_INT_SAMPLER_2D 0x8DCA\r\n#define GL_INT_SAMPLER_3D 0x8DCB\r\n#define GL_INT_SAMPLER_CUBE 0x8DCC\r\n#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE\r\n#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF\r\n#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1\r\n#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2\r\n#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4\r\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7\r\n#define GL_QUERY_WAIT 0x8E13\r\n#define GL_QUERY_NO_WAIT 0x8E14\r\n#define GL_QUERY_BY_REGION_WAIT 0x8E15\r\n#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERPROC) (GLuint, GLenum);\r\ntypedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum);\r\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONPROC) (GLuint, GLuint, const GLchar*);\r\ntypedef void (GLAPIENTRY * PFNGLCLAMPCOLORPROC) (GLenum, GLenum);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERFIPROC) (GLenum, GLint, GLfloat, GLint);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERFVPROC) (GLenum, GLint, const GLfloat*);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERIVPROC) (GLenum, GLint, const GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum, GLint, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORMASKIPROC) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEIPROC) (GLenum, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEIPROC) (GLenum, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLGETBOOLEANI_VPROC) (GLenum, GLuint, GLboolean*);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONPROC) (GLuint, const GLchar*);\r\ntypedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC) (GLenum, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVPROC) (GLenum, GLenum, GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVPROC) (GLenum, GLenum, GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint, GLint, GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVPROC) (GLuint, GLenum, GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint, GLenum, GLuint*);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISENABLEDIPROC) (GLenum, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVPROC) (GLenum, GLenum, const GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVPROC) (GLenum, GLenum, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint, GLsizei, const GLchar **, GLenum);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIPROC) (GLint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIVPROC) (GLint, GLsizei, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIPROC) (GLint, GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIVPROC) (GLint, GLsizei, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIPROC) (GLint, GLuint, GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIVPROC) (GLint, GLsizei, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIPROC) (GLint, GLuint, GLuint, GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIVPROC) (GLint, GLsizei, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IPROC) (GLuint, GLint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVPROC) (GLuint, const GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIPROC) (GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVPROC) (GLuint, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IPROC) (GLuint, GLint, GLint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVPROC) (GLuint, const GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIPROC) (GLuint, GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVPROC) (GLuint, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IPROC) (GLuint, GLint, GLint, GLint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVPROC) (GLuint, const GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIPROC) (GLuint, GLuint, GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVPROC) (GLuint, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVPROC) (GLuint, const GLbyte*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IPROC) (GLuint, GLint, GLint, GLint, GLint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVPROC) (GLuint, const GLint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVPROC) (GLuint, const GLshort*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVPROC) (GLuint, const GLubyte*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIPROC) (GLuint, GLuint, GLuint, GLuint, GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVPROC) (GLuint, const GLuint*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVPROC) (GLuint, const GLushort*);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint, GLint, GLenum, GLsizei, const GLvoid*);\r\n\r\n#define glBeginConditionalRender GLEW_GET_FUN(__glewBeginConditionalRender)\r\n#define glBeginTransformFeedback GLEW_GET_FUN(__glewBeginTransformFeedback)\r\n#define glBindFragDataLocation GLEW_GET_FUN(__glewBindFragDataLocation)\r\n#define glClampColor GLEW_GET_FUN(__glewClampColor)\r\n#define glClearBufferfi GLEW_GET_FUN(__glewClearBufferfi)\r\n#define glClearBufferfv GLEW_GET_FUN(__glewClearBufferfv)\r\n#define glClearBufferiv GLEW_GET_FUN(__glewClearBufferiv)\r\n#define glClearBufferuiv GLEW_GET_FUN(__glewClearBufferuiv)\r\n#define glColorMaski GLEW_GET_FUN(__glewColorMaski)\r\n#define glDisablei GLEW_GET_FUN(__glewDisablei)\r\n#define glEnablei GLEW_GET_FUN(__glewEnablei)\r\n#define glEndConditionalRender GLEW_GET_FUN(__glewEndConditionalRender)\r\n#define glEndTransformFeedback GLEW_GET_FUN(__glewEndTransformFeedback)\r\n#define glGetBooleani_v GLEW_GET_FUN(__glewGetBooleani_v)\r\n#define glGetFragDataLocation GLEW_GET_FUN(__glewGetFragDataLocation)\r\n#define glGetStringi GLEW_GET_FUN(__glewGetStringi)\r\n#define glGetTexParameterIiv GLEW_GET_FUN(__glewGetTexParameterIiv)\r\n#define glGetTexParameterIuiv GLEW_GET_FUN(__glewGetTexParameterIuiv)\r\n#define glGetTransformFeedbackVarying GLEW_GET_FUN(__glewGetTransformFeedbackVarying)\r\n#define glGetUniformuiv GLEW_GET_FUN(__glewGetUniformuiv)\r\n#define glGetVertexAttribIiv GLEW_GET_FUN(__glewGetVertexAttribIiv)\r\n#define glGetVertexAttribIuiv GLEW_GET_FUN(__glewGetVertexAttribIuiv)\r\n#define glIsEnabledi GLEW_GET_FUN(__glewIsEnabledi)\r\n#define glTexParameterIiv GLEW_GET_FUN(__glewTexParameterIiv)\r\n#define glTexParameterIuiv GLEW_GET_FUN(__glewTexParameterIuiv)\r\n#define glTransformFeedbackVaryings GLEW_GET_FUN(__glewTransformFeedbackVaryings)\r\n#define glUniform1ui GLEW_GET_FUN(__glewUniform1ui)\r\n#define glUniform1uiv GLEW_GET_FUN(__glewUniform1uiv)\r\n#define glUniform2ui GLEW_GET_FUN(__glewUniform2ui)\r\n#define glUniform2uiv GLEW_GET_FUN(__glewUniform2uiv)\r\n#define glUniform3ui GLEW_GET_FUN(__glewUniform3ui)\r\n#define glUniform3uiv GLEW_GET_FUN(__glewUniform3uiv)\r\n#define glUniform4ui GLEW_GET_FUN(__glewUniform4ui)\r\n#define glUniform4uiv GLEW_GET_FUN(__glewUniform4uiv)\r\n#define glVertexAttribI1i GLEW_GET_FUN(__glewVertexAttribI1i)\r\n#define glVertexAttribI1iv GLEW_GET_FUN(__glewVertexAttribI1iv)\r\n#define glVertexAttribI1ui GLEW_GET_FUN(__glewVertexAttribI1ui)\r\n#define glVertexAttribI1uiv GLEW_GET_FUN(__glewVertexAttribI1uiv)\r\n#define glVertexAttribI2i GLEW_GET_FUN(__glewVertexAttribI2i)\r\n#define glVertexAttribI2iv GLEW_GET_FUN(__glewVertexAttribI2iv)\r\n#define glVertexAttribI2ui GLEW_GET_FUN(__glewVertexAttribI2ui)\r\n#define glVertexAttribI2uiv GLEW_GET_FUN(__glewVertexAttribI2uiv)\r\n#define glVertexAttribI3i GLEW_GET_FUN(__glewVertexAttribI3i)\r\n#define glVertexAttribI3iv GLEW_GET_FUN(__glewVertexAttribI3iv)\r\n#define glVertexAttribI3ui GLEW_GET_FUN(__glewVertexAttribI3ui)\r\n#define glVertexAttribI3uiv GLEW_GET_FUN(__glewVertexAttribI3uiv)\r\n#define glVertexAttribI4bv GLEW_GET_FUN(__glewVertexAttribI4bv)\r\n#define glVertexAttribI4i GLEW_GET_FUN(__glewVertexAttribI4i)\r\n#define glVertexAttribI4iv GLEW_GET_FUN(__glewVertexAttribI4iv)\r\n#define glVertexAttribI4sv GLEW_GET_FUN(__glewVertexAttribI4sv)\r\n#define glVertexAttribI4ubv GLEW_GET_FUN(__glewVertexAttribI4ubv)\r\n#define glVertexAttribI4ui GLEW_GET_FUN(__glewVertexAttribI4ui)\r\n#define glVertexAttribI4uiv GLEW_GET_FUN(__glewVertexAttribI4uiv)\r\n#define glVertexAttribI4usv GLEW_GET_FUN(__glewVertexAttribI4usv)\r\n#define glVertexAttribIPointer GLEW_GET_FUN(__glewVertexAttribIPointer)\r\n\r\n#define GLEW_VERSION_3_0 GLEW_GET_VAR(__GLEW_VERSION_3_0)\r\n\r\n#endif /* GL_VERSION_3_0 */\r\n\r\n/* ----------------------------- GL_VERSION_3_1 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_3_1\r\n#define GL_VERSION_3_1 1\r\n\r\n#define GL_TEXTURE_RECTANGLE 0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8\r\n#define GL_SAMPLER_2D_RECT 0x8B63\r\n#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64\r\n#define GL_TEXTURE_BUFFER 0x8C2A\r\n#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B\r\n#define GL_TEXTURE_BINDING_BUFFER 0x8C2C\r\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D\r\n#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E\r\n#define GL_SAMPLER_BUFFER 0x8DC2\r\n#define GL_INT_SAMPLER_2D_RECT 0x8DCD\r\n#define GL_INT_SAMPLER_BUFFER 0x8DD0\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5\r\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8\r\n#define GL_RED_SNORM 0x8F90\r\n#define GL_RG_SNORM 0x8F91\r\n#define GL_RGB_SNORM 0x8F92\r\n#define GL_RGBA_SNORM 0x8F93\r\n#define GL_R8_SNORM 0x8F94\r\n#define GL_RG8_SNORM 0x8F95\r\n#define GL_RGB8_SNORM 0x8F96\r\n#define GL_RGBA8_SNORM 0x8F97\r\n#define GL_R16_SNORM 0x8F98\r\n#define GL_RG16_SNORM 0x8F99\r\n#define GL_RGB16_SNORM 0x8F9A\r\n#define GL_RGBA16_SNORM 0x8F9B\r\n#define GL_SIGNED_NORMALIZED 0x8F9C\r\n#define GL_PRIMITIVE_RESTART 0x8F9D\r\n#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E\r\n#define GL_BUFFER_ACCESS_FLAGS 0x911F\r\n#define GL_BUFFER_MAP_LENGTH 0x9120\r\n#define GL_BUFFER_MAP_OFFSET 0x9121\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum, GLint, GLsizei, GLsizei);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum, GLsizei, GLenum, const GLvoid*, GLsizei);\r\ntypedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint);\r\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFERPROC) (GLenum, GLenum, GLuint);\r\n\r\n#define glDrawArraysInstanced GLEW_GET_FUN(__glewDrawArraysInstanced)\r\n#define glDrawElementsInstanced GLEW_GET_FUN(__glewDrawElementsInstanced)\r\n#define glPrimitiveRestartIndex GLEW_GET_FUN(__glewPrimitiveRestartIndex)\r\n#define glTexBuffer GLEW_GET_FUN(__glewTexBuffer)\r\n\r\n#define GLEW_VERSION_3_1 GLEW_GET_VAR(__GLEW_VERSION_3_1)\r\n\r\n#endif /* GL_VERSION_3_1 */\r\n\r\n/* ----------------------------- GL_VERSION_3_2 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_3_2\r\n#define GL_VERSION_3_2 1\r\n\r\n#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001\r\n#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002\r\n#define GL_LINES_ADJACENCY 0x000A\r\n#define GL_LINE_STRIP_ADJACENCY 0x000B\r\n#define GL_TRIANGLES_ADJACENCY 0x000C\r\n#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D\r\n#define GL_PROGRAM_POINT_SIZE 0x8642\r\n#define GL_GEOMETRY_VERTICES_OUT 0x8916\r\n#define GL_GEOMETRY_INPUT_TYPE 0x8917\r\n#define GL_GEOMETRY_OUTPUT_TYPE 0x8918\r\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29\r\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8\r\n#define GL_GEOMETRY_SHADER 0x8DD9\r\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF\r\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0\r\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1\r\n#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122\r\n#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123\r\n#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124\r\n#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125\r\n#define GL_CONTEXT_PROFILE_MASK 0x9126\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum, GLenum, GLuint, GLint);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum, GLenum, GLint64 *);\r\ntypedef void (GLAPIENTRY * PFNGLGETINTEGER64I_VPROC) (GLenum, GLuint, GLint64 *);\r\n\r\n#define glFramebufferTexture GLEW_GET_FUN(__glewFramebufferTexture)\r\n#define glGetBufferParameteri64v GLEW_GET_FUN(__glewGetBufferParameteri64v)\r\n#define glGetInteger64i_v GLEW_GET_FUN(__glewGetInteger64i_v)\r\n\r\n#define GLEW_VERSION_3_2 GLEW_GET_VAR(__GLEW_VERSION_3_2)\r\n\r\n#endif /* GL_VERSION_3_2 */\r\n\r\n/* ----------------------------- GL_VERSION_3_3 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_3_3\r\n#define GL_VERSION_3_3 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE\r\n#define GL_TEXTURE_SWIZZLE_R 0x8E42\r\n#define GL_TEXTURE_SWIZZLE_G 0x8E43\r\n#define GL_TEXTURE_SWIZZLE_B 0x8E44\r\n#define GL_TEXTURE_SWIZZLE_A 0x8E45\r\n#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46\r\n#define GL_RGB10_A2UI 0x906F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);\r\n\r\n#define glVertexAttribDivisor GLEW_GET_FUN(__glewVertexAttribDivisor)\r\n\r\n#define GLEW_VERSION_3_3 GLEW_GET_VAR(__GLEW_VERSION_3_3)\r\n\r\n#endif /* GL_VERSION_3_3 */\r\n\r\n/* ----------------------------- GL_VERSION_4_0 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_4_0\r\n#define GL_VERSION_4_0 1\r\n\r\n#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F\r\n#define GL_SAMPLE_SHADING 0x8C36\r\n#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37\r\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\r\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\r\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\r\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\r\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F\r\n#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D\r\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);\r\ntypedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGPROC) (GLclampf value);\r\n\r\n#define glBlendEquationSeparatei GLEW_GET_FUN(__glewBlendEquationSeparatei)\r\n#define glBlendEquationi GLEW_GET_FUN(__glewBlendEquationi)\r\n#define glBlendFuncSeparatei GLEW_GET_FUN(__glewBlendFuncSeparatei)\r\n#define glBlendFunci GLEW_GET_FUN(__glewBlendFunci)\r\n#define glMinSampleShading GLEW_GET_FUN(__glewMinSampleShading)\r\n\r\n#define GLEW_VERSION_4_0 GLEW_GET_VAR(__GLEW_VERSION_4_0)\r\n\r\n#endif /* GL_VERSION_4_0 */\r\n\r\n/* ----------------------------- GL_VERSION_4_1 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_4_1\r\n#define GL_VERSION_4_1 1\r\n\r\n#define GLEW_VERSION_4_1 GLEW_GET_VAR(__GLEW_VERSION_4_1)\r\n\r\n#endif /* GL_VERSION_4_1 */\r\n\r\n/* ----------------------------- GL_VERSION_4_2 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_4_2\r\n#define GL_VERSION_4_2 1\r\n\r\n#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C\r\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D\r\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E\r\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F\r\n\r\n#define GLEW_VERSION_4_2 GLEW_GET_VAR(__GLEW_VERSION_4_2)\r\n\r\n#endif /* GL_VERSION_4_2 */\r\n\r\n/* ----------------------------- GL_VERSION_4_3 ---------------------------- */\r\n\r\n#ifndef GL_VERSION_4_3\r\n#define GL_VERSION_4_3 1\r\n\r\n#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9\r\n#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E\r\n\r\n#define GLEW_VERSION_4_3 GLEW_GET_VAR(__GLEW_VERSION_4_3)\r\n\r\n#endif /* GL_VERSION_4_3 */\r\n\r\n/* -------------------------- GL_3DFX_multisample -------------------------- */\r\n\r\n#ifndef GL_3DFX_multisample\r\n#define GL_3DFX_multisample 1\r\n\r\n#define GL_MULTISAMPLE_3DFX 0x86B2\r\n#define GL_SAMPLE_BUFFERS_3DFX 0x86B3\r\n#define GL_SAMPLES_3DFX 0x86B4\r\n#define GL_MULTISAMPLE_BIT_3DFX 0x20000000\r\n\r\n#define GLEW_3DFX_multisample GLEW_GET_VAR(__GLEW_3DFX_multisample)\r\n\r\n#endif /* GL_3DFX_multisample */\r\n\r\n/* ---------------------------- GL_3DFX_tbuffer ---------------------------- */\r\n\r\n#ifndef GL_3DFX_tbuffer\r\n#define GL_3DFX_tbuffer 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);\r\n\r\n#define glTbufferMask3DFX GLEW_GET_FUN(__glewTbufferMask3DFX)\r\n\r\n#define GLEW_3DFX_tbuffer GLEW_GET_VAR(__GLEW_3DFX_tbuffer)\r\n\r\n#endif /* GL_3DFX_tbuffer */\r\n\r\n/* -------------------- GL_3DFX_texture_compression_FXT1 ------------------- */\r\n\r\n#ifndef GL_3DFX_texture_compression_FXT1\r\n#define GL_3DFX_texture_compression_FXT1 1\r\n\r\n#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0\r\n#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1\r\n\r\n#define GLEW_3DFX_texture_compression_FXT1 GLEW_GET_VAR(__GLEW_3DFX_texture_compression_FXT1)\r\n\r\n#endif /* GL_3DFX_texture_compression_FXT1 */\r\n\r\n/* ----------------------- GL_AMD_blend_minmax_factor ---------------------- */\r\n\r\n#ifndef GL_AMD_blend_minmax_factor\r\n#define GL_AMD_blend_minmax_factor 1\r\n\r\n#define GL_FACTOR_MIN_AMD 0x901C\r\n#define GL_FACTOR_MAX_AMD 0x901D\r\n\r\n#define GLEW_AMD_blend_minmax_factor GLEW_GET_VAR(__GLEW_AMD_blend_minmax_factor)\r\n\r\n#endif /* GL_AMD_blend_minmax_factor */\r\n\r\n/* ----------------------- GL_AMD_conservative_depth ----------------------- */\r\n\r\n#ifndef GL_AMD_conservative_depth\r\n#define GL_AMD_conservative_depth 1\r\n\r\n#define GLEW_AMD_conservative_depth GLEW_GET_VAR(__GLEW_AMD_conservative_depth)\r\n\r\n#endif /* GL_AMD_conservative_depth */\r\n\r\n/* -------------------------- GL_AMD_debug_output -------------------------- */\r\n\r\n#ifndef GL_AMD_debug_output\r\n#define GL_AMD_debug_output 1\r\n\r\n#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143\r\n#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144\r\n#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145\r\n#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146\r\n#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147\r\n#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148\r\n#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149\r\n#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A\r\n#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B\r\n#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C\r\n#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D\r\n#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E\r\n#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F\r\n#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150\r\n\r\ntypedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void* userParam);\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar* buf);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum* categories, GLuint* severities, GLuint* ids, GLsizei* lengths, GLchar* message);\r\n\r\n#define glDebugMessageCallbackAMD GLEW_GET_FUN(__glewDebugMessageCallbackAMD)\r\n#define glDebugMessageEnableAMD GLEW_GET_FUN(__glewDebugMessageEnableAMD)\r\n#define glDebugMessageInsertAMD GLEW_GET_FUN(__glewDebugMessageInsertAMD)\r\n#define glGetDebugMessageLogAMD GLEW_GET_FUN(__glewGetDebugMessageLogAMD)\r\n\r\n#define GLEW_AMD_debug_output GLEW_GET_VAR(__GLEW_AMD_debug_output)\r\n\r\n#endif /* GL_AMD_debug_output */\r\n\r\n/* ---------------------- GL_AMD_depth_clamp_separate ---------------------- */\r\n\r\n#ifndef GL_AMD_depth_clamp_separate\r\n#define GL_AMD_depth_clamp_separate 1\r\n\r\n#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E\r\n#define GL_DEPTH_CLAMP_FAR_AMD 0x901F\r\n\r\n#define GLEW_AMD_depth_clamp_separate GLEW_GET_VAR(__GLEW_AMD_depth_clamp_separate)\r\n\r\n#endif /* GL_AMD_depth_clamp_separate */\r\n\r\n/* ----------------------- GL_AMD_draw_buffers_blend ----------------------- */\r\n\r\n#ifndef GL_AMD_draw_buffers_blend\r\n#define GL_AMD_draw_buffers_blend 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n\r\n#define glBlendEquationIndexedAMD GLEW_GET_FUN(__glewBlendEquationIndexedAMD)\r\n#define glBlendEquationSeparateIndexedAMD GLEW_GET_FUN(__glewBlendEquationSeparateIndexedAMD)\r\n#define glBlendFuncIndexedAMD GLEW_GET_FUN(__glewBlendFuncIndexedAMD)\r\n#define glBlendFuncSeparateIndexedAMD GLEW_GET_FUN(__glewBlendFuncSeparateIndexedAMD)\r\n\r\n#define GLEW_AMD_draw_buffers_blend GLEW_GET_VAR(__GLEW_AMD_draw_buffers_blend)\r\n\r\n#endif /* GL_AMD_draw_buffers_blend */\r\n\r\n/* ----------------------- GL_AMD_multi_draw_indirect ---------------------- */\r\n\r\n#ifndef GL_AMD_multi_draw_indirect\r\n#define GL_AMD_multi_draw_indirect 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride);\r\n\r\n#define glMultiDrawArraysIndirectAMD GLEW_GET_FUN(__glewMultiDrawArraysIndirectAMD)\r\n#define glMultiDrawElementsIndirectAMD GLEW_GET_FUN(__glewMultiDrawElementsIndirectAMD)\r\n\r\n#define GLEW_AMD_multi_draw_indirect GLEW_GET_VAR(__GLEW_AMD_multi_draw_indirect)\r\n\r\n#endif /* GL_AMD_multi_draw_indirect */\r\n\r\n/* ------------------------- GL_AMD_name_gen_delete ------------------------ */\r\n\r\n#ifndef GL_AMD_name_gen_delete\r\n#define GL_AMD_name_gen_delete 1\r\n\r\n#define GL_DATA_BUFFER_AMD 0x9151\r\n#define GL_PERFORMANCE_MONITOR_AMD 0x9152\r\n#define GL_QUERY_OBJECT_AMD 0x9153\r\n#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154\r\n#define GL_SAMPLER_OBJECT_AMD 0x9155\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint* names);\r\ntypedef void (GLAPIENTRY * PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint* names);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);\r\n\r\n#define glDeleteNamesAMD GLEW_GET_FUN(__glewDeleteNamesAMD)\r\n#define glGenNamesAMD GLEW_GET_FUN(__glewGenNamesAMD)\r\n#define glIsNameAMD GLEW_GET_FUN(__glewIsNameAMD)\r\n\r\n#define GLEW_AMD_name_gen_delete GLEW_GET_VAR(__GLEW_AMD_name_gen_delete)\r\n\r\n#endif /* GL_AMD_name_gen_delete */\r\n\r\n/* ----------------------- GL_AMD_performance_monitor ---------------------- */\r\n\r\n#ifndef GL_AMD_performance_monitor\r\n#define GL_AMD_performance_monitor 1\r\n\r\n#define GL_COUNTER_TYPE_AMD 0x8BC0\r\n#define GL_COUNTER_RANGE_AMD 0x8BC1\r\n#define GL_UNSIGNED_INT64_AMD 0x8BC2\r\n#define GL_PERCENTAGE_AMD 0x8BC3\r\n#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4\r\n#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5\r\n#define GL_PERFMON_RESULT_AMD 0x8BC6\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors);\r\ntypedef void (GLAPIENTRY * PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);\r\ntypedef void (GLAPIENTRY * PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors);\r\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint *bytesWritten);\r\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar *counterString);\r\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint* numCounters, GLint *maxActiveCounters, GLsizei countersSize, GLuint *counters);\r\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei* length, GLchar *groupString);\r\ntypedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint* numGroups, GLsizei groupsSize, GLuint *groups);\r\ntypedef void (GLAPIENTRY * PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* counterList);\r\n\r\n#define glBeginPerfMonitorAMD GLEW_GET_FUN(__glewBeginPerfMonitorAMD)\r\n#define glDeletePerfMonitorsAMD GLEW_GET_FUN(__glewDeletePerfMonitorsAMD)\r\n#define glEndPerfMonitorAMD GLEW_GET_FUN(__glewEndPerfMonitorAMD)\r\n#define glGenPerfMonitorsAMD GLEW_GET_FUN(__glewGenPerfMonitorsAMD)\r\n#define glGetPerfMonitorCounterDataAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterDataAMD)\r\n#define glGetPerfMonitorCounterInfoAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterInfoAMD)\r\n#define glGetPerfMonitorCounterStringAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterStringAMD)\r\n#define glGetPerfMonitorCountersAMD GLEW_GET_FUN(__glewGetPerfMonitorCountersAMD)\r\n#define glGetPerfMonitorGroupStringAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupStringAMD)\r\n#define glGetPerfMonitorGroupsAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupsAMD)\r\n#define glSelectPerfMonitorCountersAMD GLEW_GET_FUN(__glewSelectPerfMonitorCountersAMD)\r\n\r\n#define GLEW_AMD_performance_monitor GLEW_GET_VAR(__GLEW_AMD_performance_monitor)\r\n\r\n#endif /* GL_AMD_performance_monitor */\r\n\r\n/* -------------------------- GL_AMD_pinned_memory ------------------------- */\r\n\r\n#ifndef GL_AMD_pinned_memory\r\n#define GL_AMD_pinned_memory 1\r\n\r\n#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160\r\n\r\n#define GLEW_AMD_pinned_memory GLEW_GET_VAR(__GLEW_AMD_pinned_memory)\r\n\r\n#endif /* GL_AMD_pinned_memory */\r\n\r\n/* ----------------------- GL_AMD_query_buffer_object ---------------------- */\r\n\r\n#ifndef GL_AMD_query_buffer_object\r\n#define GL_AMD_query_buffer_object 1\r\n\r\n#define GL_QUERY_BUFFER_AMD 0x9192\r\n#define GL_QUERY_BUFFER_BINDING_AMD 0x9193\r\n#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194\r\n\r\n#define GLEW_AMD_query_buffer_object GLEW_GET_VAR(__GLEW_AMD_query_buffer_object)\r\n\r\n#endif /* GL_AMD_query_buffer_object */\r\n\r\n/* ------------------------ GL_AMD_sample_positions ------------------------ */\r\n\r\n#ifndef GL_AMD_sample_positions\r\n#define GL_AMD_sample_positions 1\r\n\r\n#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat* val);\r\n\r\n#define glSetMultisamplefvAMD GLEW_GET_FUN(__glewSetMultisamplefvAMD)\r\n\r\n#define GLEW_AMD_sample_positions GLEW_GET_VAR(__GLEW_AMD_sample_positions)\r\n\r\n#endif /* GL_AMD_sample_positions */\r\n\r\n/* ------------------ GL_AMD_seamless_cubemap_per_texture ------------------ */\r\n\r\n#ifndef GL_AMD_seamless_cubemap_per_texture\r\n#define GL_AMD_seamless_cubemap_per_texture 1\r\n\r\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB 0x884F\r\n\r\n#define GLEW_AMD_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_AMD_seamless_cubemap_per_texture)\r\n\r\n#endif /* GL_AMD_seamless_cubemap_per_texture */\r\n\r\n/* ---------------------- GL_AMD_shader_stencil_export --------------------- */\r\n\r\n#ifndef GL_AMD_shader_stencil_export\r\n#define GL_AMD_shader_stencil_export 1\r\n\r\n#define GLEW_AMD_shader_stencil_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_export)\r\n\r\n#endif /* GL_AMD_shader_stencil_export */\r\n\r\n/* ------------------- GL_AMD_stencil_operation_extended ------------------- */\r\n\r\n#ifndef GL_AMD_stencil_operation_extended\r\n#define GL_AMD_stencil_operation_extended 1\r\n\r\n#define GL_SET_AMD 0x874A\r\n#define GL_REPLACE_VALUE_AMD 0x874B\r\n#define GL_STENCIL_OP_VALUE_AMD 0x874C\r\n#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);\r\n\r\n#define glStencilOpValueAMD GLEW_GET_FUN(__glewStencilOpValueAMD)\r\n\r\n#define GLEW_AMD_stencil_operation_extended GLEW_GET_VAR(__GLEW_AMD_stencil_operation_extended)\r\n\r\n#endif /* GL_AMD_stencil_operation_extended */\r\n\r\n/* ------------------------ GL_AMD_texture_texture4 ------------------------ */\r\n\r\n#ifndef GL_AMD_texture_texture4\r\n#define GL_AMD_texture_texture4 1\r\n\r\n#define GLEW_AMD_texture_texture4 GLEW_GET_VAR(__GLEW_AMD_texture_texture4)\r\n\r\n#endif /* GL_AMD_texture_texture4 */\r\n\r\n/* --------------- GL_AMD_transform_feedback3_lines_triangles -------------- */\r\n\r\n#ifndef GL_AMD_transform_feedback3_lines_triangles\r\n#define GL_AMD_transform_feedback3_lines_triangles 1\r\n\r\n#define GLEW_AMD_transform_feedback3_lines_triangles GLEW_GET_VAR(__GLEW_AMD_transform_feedback3_lines_triangles)\r\n\r\n#endif /* GL_AMD_transform_feedback3_lines_triangles */\r\n\r\n/* ----------------------- GL_AMD_vertex_shader_layer ---------------------- */\r\n\r\n#ifndef GL_AMD_vertex_shader_layer\r\n#define GL_AMD_vertex_shader_layer 1\r\n\r\n#define GLEW_AMD_vertex_shader_layer GLEW_GET_VAR(__GLEW_AMD_vertex_shader_layer)\r\n\r\n#endif /* GL_AMD_vertex_shader_layer */\r\n\r\n/* -------------------- GL_AMD_vertex_shader_tessellator ------------------- */\r\n\r\n#ifndef GL_AMD_vertex_shader_tessellator\r\n#define GL_AMD_vertex_shader_tessellator 1\r\n\r\n#define GL_SAMPLER_BUFFER_AMD 0x9001\r\n#define GL_INT_SAMPLER_BUFFER_AMD 0x9002\r\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003\r\n#define GL_TESSELLATION_MODE_AMD 0x9004\r\n#define GL_TESSELLATION_FACTOR_AMD 0x9005\r\n#define GL_DISCRETE_AMD 0x9006\r\n#define GL_CONTINUOUS_AMD 0x9007\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);\r\ntypedef void (GLAPIENTRY * PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);\r\n\r\n#define glTessellationFactorAMD GLEW_GET_FUN(__glewTessellationFactorAMD)\r\n#define glTessellationModeAMD GLEW_GET_FUN(__glewTessellationModeAMD)\r\n\r\n#define GLEW_AMD_vertex_shader_tessellator GLEW_GET_VAR(__GLEW_AMD_vertex_shader_tessellator)\r\n\r\n#endif /* GL_AMD_vertex_shader_tessellator */\r\n\r\n/* ------------------ GL_AMD_vertex_shader_viewport_index ------------------ */\r\n\r\n#ifndef GL_AMD_vertex_shader_viewport_index\r\n#define GL_AMD_vertex_shader_viewport_index 1\r\n\r\n#define GLEW_AMD_vertex_shader_viewport_index GLEW_GET_VAR(__GLEW_AMD_vertex_shader_viewport_index)\r\n\r\n#endif /* GL_AMD_vertex_shader_viewport_index */\r\n\r\n/* ----------------------- GL_APPLE_aux_depth_stencil ---------------------- */\r\n\r\n#ifndef GL_APPLE_aux_depth_stencil\r\n#define GL_APPLE_aux_depth_stencil 1\r\n\r\n#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14\r\n\r\n#define GLEW_APPLE_aux_depth_stencil GLEW_GET_VAR(__GLEW_APPLE_aux_depth_stencil)\r\n\r\n#endif /* GL_APPLE_aux_depth_stencil */\r\n\r\n/* ------------------------ GL_APPLE_client_storage ------------------------ */\r\n\r\n#ifndef GL_APPLE_client_storage\r\n#define GL_APPLE_client_storage 1\r\n\r\n#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2\r\n\r\n#define GLEW_APPLE_client_storage GLEW_GET_VAR(__GLEW_APPLE_client_storage)\r\n\r\n#endif /* GL_APPLE_client_storage */\r\n\r\n/* ------------------------- GL_APPLE_element_array ------------------------ */\r\n\r\n#ifndef GL_APPLE_element_array\r\n#define GL_APPLE_element_array 1\r\n\r\n#define GL_ELEMENT_ARRAY_APPLE 0x8A0C\r\n#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D\r\n#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);\r\ntypedef void (GLAPIENTRY * PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei *count, GLsizei primcount);\r\n\r\n#define glDrawElementArrayAPPLE GLEW_GET_FUN(__glewDrawElementArrayAPPLE)\r\n#define glDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewDrawRangeElementArrayAPPLE)\r\n#define glElementPointerAPPLE GLEW_GET_FUN(__glewElementPointerAPPLE)\r\n#define glMultiDrawElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawElementArrayAPPLE)\r\n#define glMultiDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawRangeElementArrayAPPLE)\r\n\r\n#define GLEW_APPLE_element_array GLEW_GET_VAR(__GLEW_APPLE_element_array)\r\n\r\n#endif /* GL_APPLE_element_array */\r\n\r\n/* ----------------------------- GL_APPLE_fence ---------------------------- */\r\n\r\n#ifndef GL_APPLE_fence\r\n#define GL_APPLE_fence 1\r\n\r\n#define GL_DRAW_PIXELS_APPLE 0x8A0A\r\n#define GL_FENCE_APPLE 0x8A0B\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint* fences);\r\ntypedef void (GLAPIENTRY * PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);\r\ntypedef void (GLAPIENTRY * PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);\r\ntypedef void (GLAPIENTRY * PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint* fences);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISFENCEAPPLEPROC) (GLuint fence);\r\ntypedef void (GLAPIENTRY * PFNGLSETFENCEAPPLEPROC) (GLuint fence);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLTESTFENCEAPPLEPROC) (GLuint fence);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);\r\n\r\n#define glDeleteFencesAPPLE GLEW_GET_FUN(__glewDeleteFencesAPPLE)\r\n#define glFinishFenceAPPLE GLEW_GET_FUN(__glewFinishFenceAPPLE)\r\n#define glFinishObjectAPPLE GLEW_GET_FUN(__glewFinishObjectAPPLE)\r\n#define glGenFencesAPPLE GLEW_GET_FUN(__glewGenFencesAPPLE)\r\n#define glIsFenceAPPLE GLEW_GET_FUN(__glewIsFenceAPPLE)\r\n#define glSetFenceAPPLE GLEW_GET_FUN(__glewSetFenceAPPLE)\r\n#define glTestFenceAPPLE GLEW_GET_FUN(__glewTestFenceAPPLE)\r\n#define glTestObjectAPPLE GLEW_GET_FUN(__glewTestObjectAPPLE)\r\n\r\n#define GLEW_APPLE_fence GLEW_GET_VAR(__GLEW_APPLE_fence)\r\n\r\n#endif /* GL_APPLE_fence */\r\n\r\n/* ------------------------- GL_APPLE_float_pixels ------------------------- */\r\n\r\n#ifndef GL_APPLE_float_pixels\r\n#define GL_APPLE_float_pixels 1\r\n\r\n#define GL_HALF_APPLE 0x140B\r\n#define GL_RGBA_FLOAT32_APPLE 0x8814\r\n#define GL_RGB_FLOAT32_APPLE 0x8815\r\n#define GL_ALPHA_FLOAT32_APPLE 0x8816\r\n#define GL_INTENSITY_FLOAT32_APPLE 0x8817\r\n#define GL_LUMINANCE_FLOAT32_APPLE 0x8818\r\n#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819\r\n#define GL_RGBA_FLOAT16_APPLE 0x881A\r\n#define GL_RGB_FLOAT16_APPLE 0x881B\r\n#define GL_ALPHA_FLOAT16_APPLE 0x881C\r\n#define GL_INTENSITY_FLOAT16_APPLE 0x881D\r\n#define GL_LUMINANCE_FLOAT16_APPLE 0x881E\r\n#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F\r\n#define GL_COLOR_FLOAT_APPLE 0x8A0F\r\n\r\n#define GLEW_APPLE_float_pixels GLEW_GET_VAR(__GLEW_APPLE_float_pixels)\r\n\r\n#endif /* GL_APPLE_float_pixels */\r\n\r\n/* ---------------------- GL_APPLE_flush_buffer_range ---------------------- */\r\n\r\n#ifndef GL_APPLE_flush_buffer_range\r\n#define GL_APPLE_flush_buffer_range 1\r\n\r\n#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12\r\n#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);\r\n\r\n#define glBufferParameteriAPPLE GLEW_GET_FUN(__glewBufferParameteriAPPLE)\r\n#define glFlushMappedBufferRangeAPPLE GLEW_GET_FUN(__glewFlushMappedBufferRangeAPPLE)\r\n\r\n#define GLEW_APPLE_flush_buffer_range GLEW_GET_VAR(__GLEW_APPLE_flush_buffer_range)\r\n\r\n#endif /* GL_APPLE_flush_buffer_range */\r\n\r\n/* ----------------------- GL_APPLE_object_purgeable ----------------------- */\r\n\r\n#ifndef GL_APPLE_object_purgeable\r\n#define GL_APPLE_object_purgeable 1\r\n\r\n#define GL_BUFFER_OBJECT_APPLE 0x85B3\r\n#define GL_RELEASED_APPLE 0x8A19\r\n#define GL_VOLATILE_APPLE 0x8A1A\r\n#define GL_RETAINED_APPLE 0x8A1B\r\n#define GL_UNDEFINED_APPLE 0x8A1C\r\n#define GL_PURGEABLE_APPLE 0x8A1D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint* params);\r\ntypedef GLenum (GLAPIENTRY * PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);\r\ntypedef GLenum (GLAPIENTRY * PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);\r\n\r\n#define glGetObjectParameterivAPPLE GLEW_GET_FUN(__glewGetObjectParameterivAPPLE)\r\n#define glObjectPurgeableAPPLE GLEW_GET_FUN(__glewObjectPurgeableAPPLE)\r\n#define glObjectUnpurgeableAPPLE GLEW_GET_FUN(__glewObjectUnpurgeableAPPLE)\r\n\r\n#define GLEW_APPLE_object_purgeable GLEW_GET_VAR(__GLEW_APPLE_object_purgeable)\r\n\r\n#endif /* GL_APPLE_object_purgeable */\r\n\r\n/* ------------------------- GL_APPLE_pixel_buffer ------------------------- */\r\n\r\n#ifndef GL_APPLE_pixel_buffer\r\n#define GL_APPLE_pixel_buffer 1\r\n\r\n#define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10\r\n\r\n#define GLEW_APPLE_pixel_buffer GLEW_GET_VAR(__GLEW_APPLE_pixel_buffer)\r\n\r\n#endif /* GL_APPLE_pixel_buffer */\r\n\r\n/* ---------------------------- GL_APPLE_rgb_422 --------------------------- */\r\n\r\n#ifndef GL_APPLE_rgb_422\r\n#define GL_APPLE_rgb_422 1\r\n\r\n#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA\r\n#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB\r\n#define GL_RGB_422_APPLE 0x8A1F\r\n\r\n#define GLEW_APPLE_rgb_422 GLEW_GET_VAR(__GLEW_APPLE_rgb_422)\r\n\r\n#endif /* GL_APPLE_rgb_422 */\r\n\r\n/* --------------------------- GL_APPLE_row_bytes -------------------------- */\r\n\r\n#ifndef GL_APPLE_row_bytes\r\n#define GL_APPLE_row_bytes 1\r\n\r\n#define GL_PACK_ROW_BYTES_APPLE 0x8A15\r\n#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16\r\n\r\n#define GLEW_APPLE_row_bytes GLEW_GET_VAR(__GLEW_APPLE_row_bytes)\r\n\r\n#endif /* GL_APPLE_row_bytes */\r\n\r\n/* ------------------------ GL_APPLE_specular_vector ----------------------- */\r\n\r\n#ifndef GL_APPLE_specular_vector\r\n#define GL_APPLE_specular_vector 1\r\n\r\n#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0\r\n\r\n#define GLEW_APPLE_specular_vector GLEW_GET_VAR(__GLEW_APPLE_specular_vector)\r\n\r\n#endif /* GL_APPLE_specular_vector */\r\n\r\n/* ------------------------- GL_APPLE_texture_range ------------------------ */\r\n\r\n#ifndef GL_APPLE_texture_range\r\n#define GL_APPLE_texture_range 1\r\n\r\n#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7\r\n#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8\r\n#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC\r\n#define GL_STORAGE_PRIVATE_APPLE 0x85BD\r\n#define GL_STORAGE_CACHED_APPLE 0x85BE\r\n#define GL_STORAGE_SHARED_APPLE 0x85BF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid **params);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, GLvoid *pointer);\r\n\r\n#define glGetTexParameterPointervAPPLE GLEW_GET_FUN(__glewGetTexParameterPointervAPPLE)\r\n#define glTextureRangeAPPLE GLEW_GET_FUN(__glewTextureRangeAPPLE)\r\n\r\n#define GLEW_APPLE_texture_range GLEW_GET_VAR(__GLEW_APPLE_texture_range)\r\n\r\n#endif /* GL_APPLE_texture_range */\r\n\r\n/* ------------------------ GL_APPLE_transform_hint ------------------------ */\r\n\r\n#ifndef GL_APPLE_transform_hint\r\n#define GL_APPLE_transform_hint 1\r\n\r\n#define GL_TRANSFORM_HINT_APPLE 0x85B1\r\n\r\n#define GLEW_APPLE_transform_hint GLEW_GET_VAR(__GLEW_APPLE_transform_hint)\r\n\r\n#endif /* GL_APPLE_transform_hint */\r\n\r\n/* ---------------------- GL_APPLE_vertex_array_object --------------------- */\r\n\r\n#ifndef GL_APPLE_vertex_array_object\r\n#define GL_APPLE_vertex_array_object 1\r\n\r\n#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays);\r\ntypedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);\r\n\r\n#define glBindVertexArrayAPPLE GLEW_GET_FUN(__glewBindVertexArrayAPPLE)\r\n#define glDeleteVertexArraysAPPLE GLEW_GET_FUN(__glewDeleteVertexArraysAPPLE)\r\n#define glGenVertexArraysAPPLE GLEW_GET_FUN(__glewGenVertexArraysAPPLE)\r\n#define glIsVertexArrayAPPLE GLEW_GET_FUN(__glewIsVertexArrayAPPLE)\r\n\r\n#define GLEW_APPLE_vertex_array_object GLEW_GET_VAR(__GLEW_APPLE_vertex_array_object)\r\n\r\n#endif /* GL_APPLE_vertex_array_object */\r\n\r\n/* ---------------------- GL_APPLE_vertex_array_range ---------------------- */\r\n\r\n#ifndef GL_APPLE_vertex_array_range\r\n#define GL_APPLE_vertex_array_range 1\r\n\r\n#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D\r\n#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E\r\n#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F\r\n#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE 0x8520\r\n#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521\r\n#define GL_STORAGE_CLIENT_APPLE 0x85B4\r\n#define GL_STORAGE_CACHED_APPLE 0x85BE\r\n#define GL_STORAGE_SHARED_APPLE 0x85BF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer);\r\n\r\n#define glFlushVertexArrayRangeAPPLE GLEW_GET_FUN(__glewFlushVertexArrayRangeAPPLE)\r\n#define glVertexArrayParameteriAPPLE GLEW_GET_FUN(__glewVertexArrayParameteriAPPLE)\r\n#define glVertexArrayRangeAPPLE GLEW_GET_FUN(__glewVertexArrayRangeAPPLE)\r\n\r\n#define GLEW_APPLE_vertex_array_range GLEW_GET_VAR(__GLEW_APPLE_vertex_array_range)\r\n\r\n#endif /* GL_APPLE_vertex_array_range */\r\n\r\n/* ------------------- GL_APPLE_vertex_program_evaluators ------------------ */\r\n\r\n#ifndef GL_APPLE_vertex_program_evaluators\r\n#define GL_APPLE_vertex_program_evaluators 1\r\n\r\n#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00\r\n#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01\r\n#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02\r\n#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03\r\n#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04\r\n#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05\r\n#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06\r\n#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07\r\n#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08\r\n#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);\r\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points);\r\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points);\r\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points);\r\ntypedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points);\r\n\r\n#define glDisableVertexAttribAPPLE GLEW_GET_FUN(__glewDisableVertexAttribAPPLE)\r\n#define glEnableVertexAttribAPPLE GLEW_GET_FUN(__glewEnableVertexAttribAPPLE)\r\n#define glIsVertexAttribEnabledAPPLE GLEW_GET_FUN(__glewIsVertexAttribEnabledAPPLE)\r\n#define glMapVertexAttrib1dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1dAPPLE)\r\n#define glMapVertexAttrib1fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1fAPPLE)\r\n#define glMapVertexAttrib2dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2dAPPLE)\r\n#define glMapVertexAttrib2fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2fAPPLE)\r\n\r\n#define GLEW_APPLE_vertex_program_evaluators GLEW_GET_VAR(__GLEW_APPLE_vertex_program_evaluators)\r\n\r\n#endif /* GL_APPLE_vertex_program_evaluators */\r\n\r\n/* --------------------------- GL_APPLE_ycbcr_422 -------------------------- */\r\n\r\n#ifndef GL_APPLE_ycbcr_422\r\n#define GL_APPLE_ycbcr_422 1\r\n\r\n#define GL_YCBCR_422_APPLE 0x85B9\r\n\r\n#define GLEW_APPLE_ycbcr_422 GLEW_GET_VAR(__GLEW_APPLE_ycbcr_422)\r\n\r\n#endif /* GL_APPLE_ycbcr_422 */\r\n\r\n/* ------------------------ GL_ARB_ES2_compatibility ----------------------- */\r\n\r\n#ifndef GL_ARB_ES2_compatibility\r\n#define GL_ARB_ES2_compatibility 1\r\n\r\n#define GL_FIXED 0x140C\r\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A\r\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B\r\n#define GL_RGB565 0x8D62\r\n#define GL_LOW_FLOAT 0x8DF0\r\n#define GL_MEDIUM_FLOAT 0x8DF1\r\n#define GL_HIGH_FLOAT 0x8DF2\r\n#define GL_LOW_INT 0x8DF3\r\n#define GL_MEDIUM_INT 0x8DF4\r\n#define GL_HIGH_INT 0x8DF5\r\n#define GL_SHADER_BINARY_FORMATS 0x8DF8\r\n#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9\r\n#define GL_SHADER_COMPILER 0x8DFA\r\n#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB\r\n#define GL_MAX_VARYING_VECTORS 0x8DFC\r\n#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf d);\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f);\r\ntypedef void (GLAPIENTRY * PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint *precision);\r\ntypedef void (GLAPIENTRY * PFNGLRELEASESHADERCOMPILERPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint* shaders, GLenum binaryformat, const GLvoid*binary, GLsizei length);\r\n\r\n#define glClearDepthf GLEW_GET_FUN(__glewClearDepthf)\r\n#define glDepthRangef GLEW_GET_FUN(__glewDepthRangef)\r\n#define glGetShaderPrecisionFormat GLEW_GET_FUN(__glewGetShaderPrecisionFormat)\r\n#define glReleaseShaderCompiler GLEW_GET_FUN(__glewReleaseShaderCompiler)\r\n#define glShaderBinary GLEW_GET_FUN(__glewShaderBinary)\r\n\r\n#define GLEW_ARB_ES2_compatibility GLEW_GET_VAR(__GLEW_ARB_ES2_compatibility)\r\n\r\n#endif /* GL_ARB_ES2_compatibility */\r\n\r\n/* ------------------------ GL_ARB_ES3_compatibility ----------------------- */\r\n\r\n#ifndef GL_ARB_ES3_compatibility\r\n#define GL_ARB_ES3_compatibility 1\r\n\r\n#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69\r\n#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A\r\n#define GL_MAX_ELEMENT_INDEX 0x8D6B\r\n#define GL_COMPRESSED_R11_EAC 0x9270\r\n#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271\r\n#define GL_COMPRESSED_RG11_EAC 0x9272\r\n#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273\r\n#define GL_COMPRESSED_RGB8_ETC2 0x9274\r\n#define GL_COMPRESSED_SRGB8_ETC2 0x9275\r\n#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276\r\n#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277\r\n#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279\r\n\r\n#define GLEW_ARB_ES3_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_compatibility)\r\n\r\n#endif /* GL_ARB_ES3_compatibility */\r\n\r\n/* ------------------------ GL_ARB_arrays_of_arrays ------------------------ */\r\n\r\n#ifndef GL_ARB_arrays_of_arrays\r\n#define GL_ARB_arrays_of_arrays 1\r\n\r\n#define GLEW_ARB_arrays_of_arrays GLEW_GET_VAR(__GLEW_ARB_arrays_of_arrays)\r\n\r\n#endif /* GL_ARB_arrays_of_arrays */\r\n\r\n/* -------------------------- GL_ARB_base_instance ------------------------- */\r\n\r\n#ifndef GL_ARB_base_instance\r\n#define GL_ARB_base_instance 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLuint baseinstance);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);\r\n\r\n#define glDrawArraysInstancedBaseInstance GLEW_GET_FUN(__glewDrawArraysInstancedBaseInstance)\r\n#define glDrawElementsInstancedBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseInstance)\r\n#define glDrawElementsInstancedBaseVertexBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertexBaseInstance)\r\n\r\n#define GLEW_ARB_base_instance GLEW_GET_VAR(__GLEW_ARB_base_instance)\r\n\r\n#endif /* GL_ARB_base_instance */\r\n\r\n/* ----------------------- GL_ARB_blend_func_extended ---------------------- */\r\n\r\n#ifndef GL_ARB_blend_func_extended\r\n#define GL_ARB_blend_func_extended 1\r\n\r\n#define GL_SRC1_COLOR 0x88F9\r\n#define GL_ONE_MINUS_SRC1_COLOR 0x88FA\r\n#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB\r\n#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar * name);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar * name);\r\n\r\n#define glBindFragDataLocationIndexed GLEW_GET_FUN(__glewBindFragDataLocationIndexed)\r\n#define glGetFragDataIndex GLEW_GET_FUN(__glewGetFragDataIndex)\r\n\r\n#define GLEW_ARB_blend_func_extended GLEW_GET_VAR(__GLEW_ARB_blend_func_extended)\r\n\r\n#endif /* GL_ARB_blend_func_extended */\r\n\r\n/* ---------------------------- GL_ARB_cl_event ---------------------------- */\r\n\r\n#ifndef GL_ARB_cl_event\r\n#define GL_ARB_cl_event 1\r\n\r\n#define GL_SYNC_CL_EVENT_ARB 0x8240\r\n#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241\r\n\r\ntypedef struct _cl_context *cl_context;\r\ntypedef struct _cl_event *cl_event;\r\n\r\ntypedef GLsync (GLAPIENTRY * PFNGLCREATESYNCFROMCLEVENTARBPROC) (cl_context context, cl_event event, GLbitfield flags);\r\n\r\n#define glCreateSyncFromCLeventARB GLEW_GET_FUN(__glewCreateSyncFromCLeventARB)\r\n\r\n#define GLEW_ARB_cl_event GLEW_GET_VAR(__GLEW_ARB_cl_event)\r\n\r\n#endif /* GL_ARB_cl_event */\r\n\r\n/* ----------------------- GL_ARB_clear_buffer_object ---------------------- */\r\n\r\n#ifndef GL_ARB_clear_buffer_object\r\n#define GL_ARB_clear_buffer_object 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const GLvoid* data);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid* data);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const GLvoid* data);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid* data);\r\n\r\n#define glClearBufferData GLEW_GET_FUN(__glewClearBufferData)\r\n#define glClearBufferSubData GLEW_GET_FUN(__glewClearBufferSubData)\r\n#define glClearNamedBufferDataEXT GLEW_GET_FUN(__glewClearNamedBufferDataEXT)\r\n#define glClearNamedBufferSubDataEXT GLEW_GET_FUN(__glewClearNamedBufferSubDataEXT)\r\n\r\n#define GLEW_ARB_clear_buffer_object GLEW_GET_VAR(__GLEW_ARB_clear_buffer_object)\r\n\r\n#endif /* GL_ARB_clear_buffer_object */\r\n\r\n/* ----------------------- GL_ARB_color_buffer_float ----------------------- */\r\n\r\n#ifndef GL_ARB_color_buffer_float\r\n#define GL_ARB_color_buffer_float 1\r\n\r\n#define GL_RGBA_FLOAT_MODE_ARB 0x8820\r\n#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A\r\n#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B\r\n#define GL_CLAMP_READ_COLOR_ARB 0x891C\r\n#define GL_FIXED_ONLY_ARB 0x891D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);\r\n\r\n#define glClampColorARB GLEW_GET_FUN(__glewClampColorARB)\r\n\r\n#define GLEW_ARB_color_buffer_float GLEW_GET_VAR(__GLEW_ARB_color_buffer_float)\r\n\r\n#endif /* GL_ARB_color_buffer_float */\r\n\r\n/* -------------------------- GL_ARB_compatibility ------------------------- */\r\n\r\n#ifndef GL_ARB_compatibility\r\n#define GL_ARB_compatibility 1\r\n\r\n#define GLEW_ARB_compatibility GLEW_GET_VAR(__GLEW_ARB_compatibility)\r\n\r\n#endif /* GL_ARB_compatibility */\r\n\r\n/* ---------------- GL_ARB_compressed_texture_pixel_storage ---------------- */\r\n\r\n#ifndef GL_ARB_compressed_texture_pixel_storage\r\n#define GL_ARB_compressed_texture_pixel_storage 1\r\n\r\n#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127\r\n#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128\r\n#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129\r\n#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A\r\n#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B\r\n#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C\r\n#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D\r\n#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E\r\n\r\n#define GLEW_ARB_compressed_texture_pixel_storage GLEW_GET_VAR(__GLEW_ARB_compressed_texture_pixel_storage)\r\n\r\n#endif /* GL_ARB_compressed_texture_pixel_storage */\r\n\r\n/* ------------------------- GL_ARB_compute_shader ------------------------- */\r\n\r\n#ifndef GL_ARB_compute_shader\r\n#define GL_ARB_compute_shader 1\r\n\r\n#define GL_COMPUTE_SHADER_BIT 0x00000020\r\n#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262\r\n#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263\r\n#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264\r\n#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265\r\n#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266\r\n#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267\r\n#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED\r\n#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE\r\n#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF\r\n#define GL_COMPUTE_SHADER 0x91B9\r\n#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB\r\n#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC\r\n#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD\r\n#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE\r\n#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\r\ntypedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);\r\n\r\n#define glDispatchCompute GLEW_GET_FUN(__glewDispatchCompute)\r\n#define glDispatchComputeIndirect GLEW_GET_FUN(__glewDispatchComputeIndirect)\r\n\r\n#define GLEW_ARB_compute_shader GLEW_GET_VAR(__GLEW_ARB_compute_shader)\r\n\r\n#endif /* GL_ARB_compute_shader */\r\n\r\n/* ----------------------- GL_ARB_conservative_depth ----------------------- */\r\n\r\n#ifndef GL_ARB_conservative_depth\r\n#define GL_ARB_conservative_depth 1\r\n\r\n#define GLEW_ARB_conservative_depth GLEW_GET_VAR(__GLEW_ARB_conservative_depth)\r\n\r\n#endif /* GL_ARB_conservative_depth */\r\n\r\n/* --------------------------- GL_ARB_copy_buffer -------------------------- */\r\n\r\n#ifndef GL_ARB_copy_buffer\r\n#define GL_ARB_copy_buffer 1\r\n\r\n#define GL_COPY_READ_BUFFER 0x8F36\r\n#define GL_COPY_WRITE_BUFFER 0x8F37\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size);\r\n\r\n#define glCopyBufferSubData GLEW_GET_FUN(__glewCopyBufferSubData)\r\n\r\n#define GLEW_ARB_copy_buffer GLEW_GET_VAR(__GLEW_ARB_copy_buffer)\r\n\r\n#endif /* GL_ARB_copy_buffer */\r\n\r\n/* --------------------------- GL_ARB_copy_image --------------------------- */\r\n\r\n#ifndef GL_ARB_copy_image\r\n#define GL_ARB_copy_image 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\r\n\r\n#define glCopyImageSubData GLEW_GET_FUN(__glewCopyImageSubData)\r\n\r\n#define GLEW_ARB_copy_image GLEW_GET_VAR(__GLEW_ARB_copy_image)\r\n\r\n#endif /* GL_ARB_copy_image */\r\n\r\n/* -------------------------- GL_ARB_debug_output -------------------------- */\r\n\r\n#ifndef GL_ARB_debug_output\r\n#define GL_ARB_debug_output 1\r\n\r\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242\r\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243\r\n#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244\r\n#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245\r\n#define GL_DEBUG_SOURCE_API_ARB 0x8246\r\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247\r\n#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248\r\n#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249\r\n#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A\r\n#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B\r\n#define GL_DEBUG_TYPE_ERROR_ARB 0x824C\r\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D\r\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E\r\n#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F\r\n#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250\r\n#define GL_DEBUG_TYPE_OTHER_ARB 0x8251\r\n#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143\r\n#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144\r\n#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145\r\n#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146\r\n#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147\r\n#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148\r\n\r\ntypedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, void* userParam);\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);\r\n\r\n#define glDebugMessageCallbackARB GLEW_GET_FUN(__glewDebugMessageCallbackARB)\r\n#define glDebugMessageControlARB GLEW_GET_FUN(__glewDebugMessageControlARB)\r\n#define glDebugMessageInsertARB GLEW_GET_FUN(__glewDebugMessageInsertARB)\r\n#define glGetDebugMessageLogARB GLEW_GET_FUN(__glewGetDebugMessageLogARB)\r\n\r\n#define GLEW_ARB_debug_output GLEW_GET_VAR(__GLEW_ARB_debug_output)\r\n\r\n#endif /* GL_ARB_debug_output */\r\n\r\n/* ----------------------- GL_ARB_depth_buffer_float ----------------------- */\r\n\r\n#ifndef GL_ARB_depth_buffer_float\r\n#define GL_ARB_depth_buffer_float 1\r\n\r\n#define GL_DEPTH_COMPONENT32F 0x8CAC\r\n#define GL_DEPTH32F_STENCIL8 0x8CAD\r\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD\r\n\r\n#define GLEW_ARB_depth_buffer_float GLEW_GET_VAR(__GLEW_ARB_depth_buffer_float)\r\n\r\n#endif /* GL_ARB_depth_buffer_float */\r\n\r\n/* --------------------------- GL_ARB_depth_clamp -------------------------- */\r\n\r\n#ifndef GL_ARB_depth_clamp\r\n#define GL_ARB_depth_clamp 1\r\n\r\n#define GL_DEPTH_CLAMP 0x864F\r\n\r\n#define GLEW_ARB_depth_clamp GLEW_GET_VAR(__GLEW_ARB_depth_clamp)\r\n\r\n#endif /* GL_ARB_depth_clamp */\r\n\r\n/* -------------------------- GL_ARB_depth_texture ------------------------- */\r\n\r\n#ifndef GL_ARB_depth_texture\r\n#define GL_ARB_depth_texture 1\r\n\r\n#define GL_DEPTH_COMPONENT16_ARB 0x81A5\r\n#define GL_DEPTH_COMPONENT24_ARB 0x81A6\r\n#define GL_DEPTH_COMPONENT32_ARB 0x81A7\r\n#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A\r\n#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B\r\n\r\n#define GLEW_ARB_depth_texture GLEW_GET_VAR(__GLEW_ARB_depth_texture)\r\n\r\n#endif /* GL_ARB_depth_texture */\r\n\r\n/* -------------------------- GL_ARB_draw_buffers -------------------------- */\r\n\r\n#ifndef GL_ARB_draw_buffers\r\n#define GL_ARB_draw_buffers 1\r\n\r\n#define GL_MAX_DRAW_BUFFERS_ARB 0x8824\r\n#define GL_DRAW_BUFFER0_ARB 0x8825\r\n#define GL_DRAW_BUFFER1_ARB 0x8826\r\n#define GL_DRAW_BUFFER2_ARB 0x8827\r\n#define GL_DRAW_BUFFER3_ARB 0x8828\r\n#define GL_DRAW_BUFFER4_ARB 0x8829\r\n#define GL_DRAW_BUFFER5_ARB 0x882A\r\n#define GL_DRAW_BUFFER6_ARB 0x882B\r\n#define GL_DRAW_BUFFER7_ARB 0x882C\r\n#define GL_DRAW_BUFFER8_ARB 0x882D\r\n#define GL_DRAW_BUFFER9_ARB 0x882E\r\n#define GL_DRAW_BUFFER10_ARB 0x882F\r\n#define GL_DRAW_BUFFER11_ARB 0x8830\r\n#define GL_DRAW_BUFFER12_ARB 0x8831\r\n#define GL_DRAW_BUFFER13_ARB 0x8832\r\n#define GL_DRAW_BUFFER14_ARB 0x8833\r\n#define GL_DRAW_BUFFER15_ARB 0x8834\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum* bufs);\r\n\r\n#define glDrawBuffersARB GLEW_GET_FUN(__glewDrawBuffersARB)\r\n\r\n#define GLEW_ARB_draw_buffers GLEW_GET_VAR(__GLEW_ARB_draw_buffers)\r\n\r\n#endif /* GL_ARB_draw_buffers */\r\n\r\n/* ----------------------- GL_ARB_draw_buffers_blend ----------------------- */\r\n\r\n#ifndef GL_ARB_draw_buffers_blend\r\n#define GL_ARB_draw_buffers_blend 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);\r\n\r\n#define glBlendEquationSeparateiARB GLEW_GET_FUN(__glewBlendEquationSeparateiARB)\r\n#define glBlendEquationiARB GLEW_GET_FUN(__glewBlendEquationiARB)\r\n#define glBlendFuncSeparateiARB GLEW_GET_FUN(__glewBlendFuncSeparateiARB)\r\n#define glBlendFunciARB GLEW_GET_FUN(__glewBlendFunciARB)\r\n\r\n#define GLEW_ARB_draw_buffers_blend GLEW_GET_VAR(__GLEW_ARB_draw_buffers_blend)\r\n\r\n#endif /* GL_ARB_draw_buffers_blend */\r\n\r\n/* -------------------- GL_ARB_draw_elements_base_vertex ------------------- */\r\n\r\n#ifndef GL_ARB_draw_elements_base_vertex\r\n#define GL_ARB_draw_elements_base_vertex 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, void* indices, GLint basevertex);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLint basevertex);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, void* indices, GLint basevertex);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei* count, GLenum type, GLvoid**indices, GLsizei primcount, GLint *basevertex);\r\n\r\n#define glDrawElementsBaseVertex GLEW_GET_FUN(__glewDrawElementsBaseVertex)\r\n#define glDrawElementsInstancedBaseVertex GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertex)\r\n#define glDrawRangeElementsBaseVertex GLEW_GET_FUN(__glewDrawRangeElementsBaseVertex)\r\n#define glMultiDrawElementsBaseVertex GLEW_GET_FUN(__glewMultiDrawElementsBaseVertex)\r\n\r\n#define GLEW_ARB_draw_elements_base_vertex GLEW_GET_VAR(__GLEW_ARB_draw_elements_base_vertex)\r\n\r\n#endif /* GL_ARB_draw_elements_base_vertex */\r\n\r\n/* -------------------------- GL_ARB_draw_indirect ------------------------- */\r\n\r\n#ifndef GL_ARB_draw_indirect\r\n#define GL_ARB_draw_indirect 1\r\n\r\n#define GL_DRAW_INDIRECT_BUFFER 0x8F3F\r\n#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void* indirect);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void* indirect);\r\n\r\n#define glDrawArraysIndirect GLEW_GET_FUN(__glewDrawArraysIndirect)\r\n#define glDrawElementsIndirect GLEW_GET_FUN(__glewDrawElementsIndirect)\r\n\r\n#define GLEW_ARB_draw_indirect GLEW_GET_VAR(__GLEW_ARB_draw_indirect)\r\n\r\n#endif /* GL_ARB_draw_indirect */\r\n\r\n/* ------------------------- GL_ARB_draw_instanced ------------------------- */\r\n\r\n#ifndef GL_ARB_draw_instanced\r\n#define GL_ARB_draw_instanced 1\r\n\r\n#define GLEW_ARB_draw_instanced GLEW_GET_VAR(__GLEW_ARB_draw_instanced)\r\n\r\n#endif /* GL_ARB_draw_instanced */\r\n\r\n/* -------------------- GL_ARB_explicit_attrib_location -------------------- */\r\n\r\n#ifndef GL_ARB_explicit_attrib_location\r\n#define GL_ARB_explicit_attrib_location 1\r\n\r\n#define GLEW_ARB_explicit_attrib_location GLEW_GET_VAR(__GLEW_ARB_explicit_attrib_location)\r\n\r\n#endif /* GL_ARB_explicit_attrib_location */\r\n\r\n/* -------------------- GL_ARB_explicit_uniform_location ------------------- */\r\n\r\n#ifndef GL_ARB_explicit_uniform_location\r\n#define GL_ARB_explicit_uniform_location 1\r\n\r\n#define GL_MAX_UNIFORM_LOCATIONS 0x826E\r\n\r\n#define GLEW_ARB_explicit_uniform_location GLEW_GET_VAR(__GLEW_ARB_explicit_uniform_location)\r\n\r\n#endif /* GL_ARB_explicit_uniform_location */\r\n\r\n/* ------------------- GL_ARB_fragment_coord_conventions ------------------- */\r\n\r\n#ifndef GL_ARB_fragment_coord_conventions\r\n#define GL_ARB_fragment_coord_conventions 1\r\n\r\n#define GLEW_ARB_fragment_coord_conventions GLEW_GET_VAR(__GLEW_ARB_fragment_coord_conventions)\r\n\r\n#endif /* GL_ARB_fragment_coord_conventions */\r\n\r\n/* --------------------- GL_ARB_fragment_layer_viewport -------------------- */\r\n\r\n#ifndef GL_ARB_fragment_layer_viewport\r\n#define GL_ARB_fragment_layer_viewport 1\r\n\r\n#define GLEW_ARB_fragment_layer_viewport GLEW_GET_VAR(__GLEW_ARB_fragment_layer_viewport)\r\n\r\n#endif /* GL_ARB_fragment_layer_viewport */\r\n\r\n/* ------------------------ GL_ARB_fragment_program ------------------------ */\r\n\r\n#ifndef GL_ARB_fragment_program\r\n#define GL_ARB_fragment_program 1\r\n\r\n#define GL_FRAGMENT_PROGRAM_ARB 0x8804\r\n#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805\r\n#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806\r\n#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807\r\n#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808\r\n#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809\r\n#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A\r\n#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B\r\n#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C\r\n#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D\r\n#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E\r\n#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F\r\n#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810\r\n#define GL_MAX_TEXTURE_COORDS_ARB 0x8871\r\n#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872\r\n\r\n#define GLEW_ARB_fragment_program GLEW_GET_VAR(__GLEW_ARB_fragment_program)\r\n\r\n#endif /* GL_ARB_fragment_program */\r\n\r\n/* --------------------- GL_ARB_fragment_program_shadow -------------------- */\r\n\r\n#ifndef GL_ARB_fragment_program_shadow\r\n#define GL_ARB_fragment_program_shadow 1\r\n\r\n#define GLEW_ARB_fragment_program_shadow GLEW_GET_VAR(__GLEW_ARB_fragment_program_shadow)\r\n\r\n#endif /* GL_ARB_fragment_program_shadow */\r\n\r\n/* ------------------------- GL_ARB_fragment_shader ------------------------ */\r\n\r\n#ifndef GL_ARB_fragment_shader\r\n#define GL_ARB_fragment_shader 1\r\n\r\n#define GL_FRAGMENT_SHADER_ARB 0x8B30\r\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49\r\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B\r\n\r\n#define GLEW_ARB_fragment_shader GLEW_GET_VAR(__GLEW_ARB_fragment_shader)\r\n\r\n#endif /* GL_ARB_fragment_shader */\r\n\r\n/* ------------------- GL_ARB_framebuffer_no_attachments ------------------- */\r\n\r\n#ifndef GL_ARB_framebuffer_no_attachments\r\n#define GL_ARB_framebuffer_no_attachments 1\r\n\r\n#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310\r\n#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311\r\n#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312\r\n#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313\r\n#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314\r\n#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315\r\n#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316\r\n#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317\r\n#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);\r\n\r\n#define glFramebufferParameteri GLEW_GET_FUN(__glewFramebufferParameteri)\r\n#define glGetFramebufferParameteriv GLEW_GET_FUN(__glewGetFramebufferParameteriv)\r\n#define glGetNamedFramebufferParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferParameterivEXT)\r\n#define glNamedFramebufferParameteriEXT GLEW_GET_FUN(__glewNamedFramebufferParameteriEXT)\r\n\r\n#define GLEW_ARB_framebuffer_no_attachments GLEW_GET_VAR(__GLEW_ARB_framebuffer_no_attachments)\r\n\r\n#endif /* GL_ARB_framebuffer_no_attachments */\r\n\r\n/* ----------------------- GL_ARB_framebuffer_object ----------------------- */\r\n\r\n#ifndef GL_ARB_framebuffer_object\r\n#define GL_ARB_framebuffer_object 1\r\n\r\n#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506\r\n#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210\r\n#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211\r\n#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212\r\n#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213\r\n#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214\r\n#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215\r\n#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216\r\n#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217\r\n#define GL_FRAMEBUFFER_DEFAULT 0x8218\r\n#define GL_FRAMEBUFFER_UNDEFINED 0x8219\r\n#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A\r\n#define GL_INDEX 0x8222\r\n#define GL_MAX_RENDERBUFFER_SIZE 0x84E8\r\n#define GL_DEPTH_STENCIL 0x84F9\r\n#define GL_UNSIGNED_INT_24_8 0x84FA\r\n#define GL_DEPTH24_STENCIL8 0x88F0\r\n#define GL_TEXTURE_STENCIL_SIZE 0x88F1\r\n#define GL_UNSIGNED_NORMALIZED 0x8C17\r\n#define GL_SRGB 0x8C40\r\n#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6\r\n#define GL_FRAMEBUFFER_BINDING 0x8CA6\r\n#define GL_RENDERBUFFER_BINDING 0x8CA7\r\n#define GL_READ_FRAMEBUFFER 0x8CA8\r\n#define GL_DRAW_FRAMEBUFFER 0x8CA9\r\n#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA\r\n#define GL_RENDERBUFFER_SAMPLES 0x8CAB\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\r\n#define GL_FRAMEBUFFER_COMPLETE 0x8CD5\r\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB\r\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC\r\n#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD\r\n#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF\r\n#define GL_COLOR_ATTACHMENT0 0x8CE0\r\n#define GL_COLOR_ATTACHMENT1 0x8CE1\r\n#define GL_COLOR_ATTACHMENT2 0x8CE2\r\n#define GL_COLOR_ATTACHMENT3 0x8CE3\r\n#define GL_COLOR_ATTACHMENT4 0x8CE4\r\n#define GL_COLOR_ATTACHMENT5 0x8CE5\r\n#define GL_COLOR_ATTACHMENT6 0x8CE6\r\n#define GL_COLOR_ATTACHMENT7 0x8CE7\r\n#define GL_COLOR_ATTACHMENT8 0x8CE8\r\n#define GL_COLOR_ATTACHMENT9 0x8CE9\r\n#define GL_COLOR_ATTACHMENT10 0x8CEA\r\n#define GL_COLOR_ATTACHMENT11 0x8CEB\r\n#define GL_COLOR_ATTACHMENT12 0x8CEC\r\n#define GL_COLOR_ATTACHMENT13 0x8CED\r\n#define GL_COLOR_ATTACHMENT14 0x8CEE\r\n#define GL_COLOR_ATTACHMENT15 0x8CEF\r\n#define GL_DEPTH_ATTACHMENT 0x8D00\r\n#define GL_STENCIL_ATTACHMENT 0x8D20\r\n#define GL_FRAMEBUFFER 0x8D40\r\n#define GL_RENDERBUFFER 0x8D41\r\n#define GL_RENDERBUFFER_WIDTH 0x8D42\r\n#define GL_RENDERBUFFER_HEIGHT 0x8D43\r\n#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44\r\n#define GL_STENCIL_INDEX1 0x8D46\r\n#define GL_STENCIL_INDEX4 0x8D47\r\n#define GL_STENCIL_INDEX8 0x8D48\r\n#define GL_STENCIL_INDEX16 0x8D49\r\n#define GL_RENDERBUFFER_RED_SIZE 0x8D50\r\n#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51\r\n#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52\r\n#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53\r\n#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54\r\n#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56\r\n#define GL_MAX_SAMPLES 0x8D57\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);\r\ntypedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\ntypedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);\r\ntypedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);\r\ntypedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers);\r\ntypedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers);\r\ntypedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\n\r\n#define glBindFramebuffer GLEW_GET_FUN(__glewBindFramebuffer)\r\n#define glBindRenderbuffer GLEW_GET_FUN(__glewBindRenderbuffer)\r\n#define glBlitFramebuffer GLEW_GET_FUN(__glewBlitFramebuffer)\r\n#define glCheckFramebufferStatus GLEW_GET_FUN(__glewCheckFramebufferStatus)\r\n#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)\r\n#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)\r\n#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)\r\n#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)\r\n#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)\r\n#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)\r\n#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)\r\n#define glGenFramebuffers GLEW_GET_FUN(__glewGenFramebuffers)\r\n#define glGenRenderbuffers GLEW_GET_FUN(__glewGenRenderbuffers)\r\n#define glGenerateMipmap GLEW_GET_FUN(__glewGenerateMipmap)\r\n#define glGetFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetFramebufferAttachmentParameteriv)\r\n#define glGetRenderbufferParameteriv GLEW_GET_FUN(__glewGetRenderbufferParameteriv)\r\n#define glIsFramebuffer GLEW_GET_FUN(__glewIsFramebuffer)\r\n#define glIsRenderbuffer GLEW_GET_FUN(__glewIsRenderbuffer)\r\n#define glRenderbufferStorage GLEW_GET_FUN(__glewRenderbufferStorage)\r\n#define glRenderbufferStorageMultisample GLEW_GET_FUN(__glewRenderbufferStorageMultisample)\r\n\r\n#define GLEW_ARB_framebuffer_object GLEW_GET_VAR(__GLEW_ARB_framebuffer_object)\r\n\r\n#endif /* GL_ARB_framebuffer_object */\r\n\r\n/* ------------------------ GL_ARB_framebuffer_sRGB ------------------------ */\r\n\r\n#ifndef GL_ARB_framebuffer_sRGB\r\n#define GL_ARB_framebuffer_sRGB 1\r\n\r\n#define GL_FRAMEBUFFER_SRGB 0x8DB9\r\n\r\n#define GLEW_ARB_framebuffer_sRGB GLEW_GET_VAR(__GLEW_ARB_framebuffer_sRGB)\r\n\r\n#endif /* GL_ARB_framebuffer_sRGB */\r\n\r\n/* ------------------------ GL_ARB_geometry_shader4 ------------------------ */\r\n\r\n#ifndef GL_ARB_geometry_shader4\r\n#define GL_ARB_geometry_shader4 1\r\n\r\n#define GL_LINES_ADJACENCY_ARB 0xA\r\n#define GL_LINE_STRIP_ADJACENCY_ARB 0xB\r\n#define GL_TRIANGLES_ADJACENCY_ARB 0xC\r\n#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0xD\r\n#define GL_PROGRAM_POINT_SIZE_ARB 0x8642\r\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\r\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9\r\n#define GL_GEOMETRY_SHADER_ARB 0x8DD9\r\n#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA\r\n#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB\r\n#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC\r\n#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD\r\n#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE\r\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF\r\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0\r\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);\r\n\r\n#define glFramebufferTextureARB GLEW_GET_FUN(__glewFramebufferTextureARB)\r\n#define glFramebufferTextureFaceARB GLEW_GET_FUN(__glewFramebufferTextureFaceARB)\r\n#define glFramebufferTextureLayerARB GLEW_GET_FUN(__glewFramebufferTextureLayerARB)\r\n#define glProgramParameteriARB GLEW_GET_FUN(__glewProgramParameteriARB)\r\n\r\n#define GLEW_ARB_geometry_shader4 GLEW_GET_VAR(__GLEW_ARB_geometry_shader4)\r\n\r\n#endif /* GL_ARB_geometry_shader4 */\r\n\r\n/* ----------------------- GL_ARB_get_program_binary ----------------------- */\r\n\r\n#ifndef GL_ARB_get_program_binary\r\n#define GL_ARB_get_program_binary 1\r\n\r\n#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257\r\n#define GL_PROGRAM_BINARY_LENGTH 0x8741\r\n#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE\r\n#define GL_PROGRAM_BINARY_FORMATS 0x87FF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, GLvoid*binary);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void* binary, GLsizei length);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);\r\n\r\n#define glGetProgramBinary GLEW_GET_FUN(__glewGetProgramBinary)\r\n#define glProgramBinary GLEW_GET_FUN(__glewProgramBinary)\r\n#define glProgramParameteri GLEW_GET_FUN(__glewProgramParameteri)\r\n\r\n#define GLEW_ARB_get_program_binary GLEW_GET_VAR(__GLEW_ARB_get_program_binary)\r\n\r\n#endif /* GL_ARB_get_program_binary */\r\n\r\n/* --------------------------- GL_ARB_gpu_shader5 -------------------------- */\r\n\r\n#ifndef GL_ARB_gpu_shader5\r\n#define GL_ARB_gpu_shader5 1\r\n\r\n#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F\r\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\r\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\r\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\r\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\r\n#define GL_MAX_VERTEX_STREAMS 0x8E71\r\n\r\n#define GLEW_ARB_gpu_shader5 GLEW_GET_VAR(__GLEW_ARB_gpu_shader5)\r\n\r\n#endif /* GL_ARB_gpu_shader5 */\r\n\r\n/* ------------------------- GL_ARB_gpu_shader_fp64 ------------------------ */\r\n\r\n#ifndef GL_ARB_gpu_shader_fp64\r\n#define GL_ARB_gpu_shader_fp64 1\r\n\r\n#define GL_DOUBLE_MAT2 0x8F46\r\n#define GL_DOUBLE_MAT3 0x8F47\r\n#define GL_DOUBLE_MAT4 0x8F48\r\n#define GL_DOUBLE_MAT2x3 0x8F49\r\n#define GL_DOUBLE_MAT2x4 0x8F4A\r\n#define GL_DOUBLE_MAT3x2 0x8F4B\r\n#define GL_DOUBLE_MAT3x4 0x8F4C\r\n#define GL_DOUBLE_MAT4x2 0x8F4D\r\n#define GL_DOUBLE_MAT4x3 0x8F4E\r\n#define GL_DOUBLE_VEC2 0x8FFC\r\n#define GL_DOUBLE_VEC3 0x8FFD\r\n#define GL_DOUBLE_VEC4 0x8FFE\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\n\r\n#define glGetUniformdv GLEW_GET_FUN(__glewGetUniformdv)\r\n#define glUniform1d GLEW_GET_FUN(__glewUniform1d)\r\n#define glUniform1dv GLEW_GET_FUN(__glewUniform1dv)\r\n#define glUniform2d GLEW_GET_FUN(__glewUniform2d)\r\n#define glUniform2dv GLEW_GET_FUN(__glewUniform2dv)\r\n#define glUniform3d GLEW_GET_FUN(__glewUniform3d)\r\n#define glUniform3dv GLEW_GET_FUN(__glewUniform3dv)\r\n#define glUniform4d GLEW_GET_FUN(__glewUniform4d)\r\n#define glUniform4dv GLEW_GET_FUN(__glewUniform4dv)\r\n#define glUniformMatrix2dv GLEW_GET_FUN(__glewUniformMatrix2dv)\r\n#define glUniformMatrix2x3dv GLEW_GET_FUN(__glewUniformMatrix2x3dv)\r\n#define glUniformMatrix2x4dv GLEW_GET_FUN(__glewUniformMatrix2x4dv)\r\n#define glUniformMatrix3dv GLEW_GET_FUN(__glewUniformMatrix3dv)\r\n#define glUniformMatrix3x2dv GLEW_GET_FUN(__glewUniformMatrix3x2dv)\r\n#define glUniformMatrix3x4dv GLEW_GET_FUN(__glewUniformMatrix3x4dv)\r\n#define glUniformMatrix4dv GLEW_GET_FUN(__glewUniformMatrix4dv)\r\n#define glUniformMatrix4x2dv GLEW_GET_FUN(__glewUniformMatrix4x2dv)\r\n#define glUniformMatrix4x3dv GLEW_GET_FUN(__glewUniformMatrix4x3dv)\r\n\r\n#define GLEW_ARB_gpu_shader_fp64 GLEW_GET_VAR(__GLEW_ARB_gpu_shader_fp64)\r\n\r\n#endif /* GL_ARB_gpu_shader_fp64 */\r\n\r\n/* ------------------------ GL_ARB_half_float_pixel ------------------------ */\r\n\r\n#ifndef GL_ARB_half_float_pixel\r\n#define GL_ARB_half_float_pixel 1\r\n\r\n#define GL_HALF_FLOAT_ARB 0x140B\r\n\r\n#define GLEW_ARB_half_float_pixel GLEW_GET_VAR(__GLEW_ARB_half_float_pixel)\r\n\r\n#endif /* GL_ARB_half_float_pixel */\r\n\r\n/* ------------------------ GL_ARB_half_float_vertex ----------------------- */\r\n\r\n#ifndef GL_ARB_half_float_vertex\r\n#define GL_ARB_half_float_vertex 1\r\n\r\n#define GL_HALF_FLOAT 0x140B\r\n\r\n#define GLEW_ARB_half_float_vertex GLEW_GET_VAR(__GLEW_ARB_half_float_vertex)\r\n\r\n#endif /* GL_ARB_half_float_vertex */\r\n\r\n/* ----------------------------- GL_ARB_imaging ---------------------------- */\r\n\r\n#ifndef GL_ARB_imaging\r\n#define GL_ARB_imaging 1\r\n\r\n#define GL_CONSTANT_COLOR 0x8001\r\n#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002\r\n#define GL_CONSTANT_ALPHA 0x8003\r\n#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004\r\n#define GL_BLEND_COLOR 0x8005\r\n#define GL_FUNC_ADD 0x8006\r\n#define GL_MIN 0x8007\r\n#define GL_MAX 0x8008\r\n#define GL_BLEND_EQUATION 0x8009\r\n#define GL_FUNC_SUBTRACT 0x800A\r\n#define GL_FUNC_REVERSE_SUBTRACT 0x800B\r\n#define GL_CONVOLUTION_1D 0x8010\r\n#define GL_CONVOLUTION_2D 0x8011\r\n#define GL_SEPARABLE_2D 0x8012\r\n#define GL_CONVOLUTION_BORDER_MODE 0x8013\r\n#define GL_CONVOLUTION_FILTER_SCALE 0x8014\r\n#define GL_CONVOLUTION_FILTER_BIAS 0x8015\r\n#define GL_REDUCE 0x8016\r\n#define GL_CONVOLUTION_FORMAT 0x8017\r\n#define GL_CONVOLUTION_WIDTH 0x8018\r\n#define GL_CONVOLUTION_HEIGHT 0x8019\r\n#define GL_MAX_CONVOLUTION_WIDTH 0x801A\r\n#define GL_MAX_CONVOLUTION_HEIGHT 0x801B\r\n#define GL_POST_CONVOLUTION_RED_SCALE 0x801C\r\n#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D\r\n#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E\r\n#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F\r\n#define GL_POST_CONVOLUTION_RED_BIAS 0x8020\r\n#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021\r\n#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022\r\n#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023\r\n#define GL_HISTOGRAM 0x8024\r\n#define GL_PROXY_HISTOGRAM 0x8025\r\n#define GL_HISTOGRAM_WIDTH 0x8026\r\n#define GL_HISTOGRAM_FORMAT 0x8027\r\n#define GL_HISTOGRAM_RED_SIZE 0x8028\r\n#define GL_HISTOGRAM_GREEN_SIZE 0x8029\r\n#define GL_HISTOGRAM_BLUE_SIZE 0x802A\r\n#define GL_HISTOGRAM_ALPHA_SIZE 0x802B\r\n#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C\r\n#define GL_HISTOGRAM_SINK 0x802D\r\n#define GL_MINMAX 0x802E\r\n#define GL_MINMAX_FORMAT 0x802F\r\n#define GL_MINMAX_SINK 0x8030\r\n#define GL_TABLE_TOO_LARGE 0x8031\r\n#define GL_COLOR_MATRIX 0x80B1\r\n#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2\r\n#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3\r\n#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4\r\n#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5\r\n#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6\r\n#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7\r\n#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8\r\n#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9\r\n#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA\r\n#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB\r\n#define GL_COLOR_TABLE 0x80D0\r\n#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1\r\n#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2\r\n#define GL_PROXY_COLOR_TABLE 0x80D3\r\n#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4\r\n#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5\r\n#define GL_COLOR_TABLE_SCALE 0x80D6\r\n#define GL_COLOR_TABLE_BIAS 0x80D7\r\n#define GL_COLOR_TABLE_FORMAT 0x80D8\r\n#define GL_COLOR_TABLE_WIDTH 0x80D9\r\n#define GL_COLOR_TABLE_RED_SIZE 0x80DA\r\n#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB\r\n#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC\r\n#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD\r\n#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE\r\n#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF\r\n#define GL_IGNORE_BORDER 0x8150\r\n#define GL_CONSTANT_BORDER 0x8151\r\n#define GL_WRAP_BORDER 0x8152\r\n#define GL_REPLICATE_BORDER 0x8153\r\n#define GL_CONVOLUTION_BORDER_COLOR 0x8154\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);\r\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values);\r\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);\r\ntypedef void (GLAPIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\r\ntypedef void (GLAPIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);\r\ntypedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLRESETMINMAXPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);\r\n\r\n#define glColorSubTable GLEW_GET_FUN(__glewColorSubTable)\r\n#define glColorTable GLEW_GET_FUN(__glewColorTable)\r\n#define glColorTableParameterfv GLEW_GET_FUN(__glewColorTableParameterfv)\r\n#define glColorTableParameteriv GLEW_GET_FUN(__glewColorTableParameteriv)\r\n#define glConvolutionFilter1D GLEW_GET_FUN(__glewConvolutionFilter1D)\r\n#define glConvolutionFilter2D GLEW_GET_FUN(__glewConvolutionFilter2D)\r\n#define glConvolutionParameterf GLEW_GET_FUN(__glewConvolutionParameterf)\r\n#define glConvolutionParameterfv GLEW_GET_FUN(__glewConvolutionParameterfv)\r\n#define glConvolutionParameteri GLEW_GET_FUN(__glewConvolutionParameteri)\r\n#define glConvolutionParameteriv GLEW_GET_FUN(__glewConvolutionParameteriv)\r\n#define glCopyColorSubTable GLEW_GET_FUN(__glewCopyColorSubTable)\r\n#define glCopyColorTable GLEW_GET_FUN(__glewCopyColorTable)\r\n#define glCopyConvolutionFilter1D GLEW_GET_FUN(__glewCopyConvolutionFilter1D)\r\n#define glCopyConvolutionFilter2D GLEW_GET_FUN(__glewCopyConvolutionFilter2D)\r\n#define glGetColorTable GLEW_GET_FUN(__glewGetColorTable)\r\n#define glGetColorTableParameterfv GLEW_GET_FUN(__glewGetColorTableParameterfv)\r\n#define glGetColorTableParameteriv GLEW_GET_FUN(__glewGetColorTableParameteriv)\r\n#define glGetConvolutionFilter GLEW_GET_FUN(__glewGetConvolutionFilter)\r\n#define glGetConvolutionParameterfv GLEW_GET_FUN(__glewGetConvolutionParameterfv)\r\n#define glGetConvolutionParameteriv GLEW_GET_FUN(__glewGetConvolutionParameteriv)\r\n#define glGetHistogram GLEW_GET_FUN(__glewGetHistogram)\r\n#define glGetHistogramParameterfv GLEW_GET_FUN(__glewGetHistogramParameterfv)\r\n#define glGetHistogramParameteriv GLEW_GET_FUN(__glewGetHistogramParameteriv)\r\n#define glGetMinmax GLEW_GET_FUN(__glewGetMinmax)\r\n#define glGetMinmaxParameterfv GLEW_GET_FUN(__glewGetMinmaxParameterfv)\r\n#define glGetMinmaxParameteriv GLEW_GET_FUN(__glewGetMinmaxParameteriv)\r\n#define glGetSeparableFilter GLEW_GET_FUN(__glewGetSeparableFilter)\r\n#define glHistogram GLEW_GET_FUN(__glewHistogram)\r\n#define glMinmax GLEW_GET_FUN(__glewMinmax)\r\n#define glResetHistogram GLEW_GET_FUN(__glewResetHistogram)\r\n#define glResetMinmax GLEW_GET_FUN(__glewResetMinmax)\r\n#define glSeparableFilter2D GLEW_GET_FUN(__glewSeparableFilter2D)\r\n\r\n#define GLEW_ARB_imaging GLEW_GET_VAR(__GLEW_ARB_imaging)\r\n\r\n#endif /* GL_ARB_imaging */\r\n\r\n/* ------------------------ GL_ARB_instanced_arrays ------------------------ */\r\n\r\n#ifndef GL_ARB_instanced_arrays\r\n#define GL_ARB_instanced_arrays 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);\r\n\r\n#define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB)\r\n#define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB)\r\n#define glVertexAttribDivisorARB GLEW_GET_FUN(__glewVertexAttribDivisorARB)\r\n\r\n#define GLEW_ARB_instanced_arrays GLEW_GET_VAR(__GLEW_ARB_instanced_arrays)\r\n\r\n#endif /* GL_ARB_instanced_arrays */\r\n\r\n/* ---------------------- GL_ARB_internalformat_query ---------------------- */\r\n\r\n#ifndef GL_ARB_internalformat_query\r\n#define GL_ARB_internalformat_query 1\r\n\r\n#define GL_NUM_SAMPLE_COUNTS 0x9380\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);\r\n\r\n#define glGetInternalformativ GLEW_GET_FUN(__glewGetInternalformativ)\r\n\r\n#define GLEW_ARB_internalformat_query GLEW_GET_VAR(__GLEW_ARB_internalformat_query)\r\n\r\n#endif /* GL_ARB_internalformat_query */\r\n\r\n/* ---------------------- GL_ARB_internalformat_query2 --------------------- */\r\n\r\n#ifndef GL_ARB_internalformat_query2\r\n#define GL_ARB_internalformat_query2 1\r\n\r\n#define GL_TEXTURE_1D 0x0DE0\r\n#define GL_TEXTURE_2D 0x0DE1\r\n#define GL_TEXTURE_3D 0x806F\r\n#define GL_SAMPLES 0x80A9\r\n#define GL_INTERNALFORMAT_SUPPORTED 0x826F\r\n#define GL_INTERNALFORMAT_PREFERRED 0x8270\r\n#define GL_INTERNALFORMAT_RED_SIZE 0x8271\r\n#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272\r\n#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273\r\n#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274\r\n#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275\r\n#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276\r\n#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277\r\n#define GL_INTERNALFORMAT_RED_TYPE 0x8278\r\n#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279\r\n#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A\r\n#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B\r\n#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C\r\n#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D\r\n#define GL_MAX_WIDTH 0x827E\r\n#define GL_MAX_HEIGHT 0x827F\r\n#define GL_MAX_DEPTH 0x8280\r\n#define GL_MAX_LAYERS 0x8281\r\n#define GL_MAX_COMBINED_DIMENSIONS 0x8282\r\n#define GL_COLOR_COMPONENTS 0x8283\r\n#define GL_DEPTH_COMPONENTS 0x8284\r\n#define GL_STENCIL_COMPONENTS 0x8285\r\n#define GL_COLOR_RENDERABLE 0x8286\r\n#define GL_DEPTH_RENDERABLE 0x8287\r\n#define GL_STENCIL_RENDERABLE 0x8288\r\n#define GL_FRAMEBUFFER_RENDERABLE 0x8289\r\n#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A\r\n#define GL_FRAMEBUFFER_BLEND 0x828B\r\n#define GL_READ_PIXELS 0x828C\r\n#define GL_READ_PIXELS_FORMAT 0x828D\r\n#define GL_READ_PIXELS_TYPE 0x828E\r\n#define GL_TEXTURE_IMAGE_FORMAT 0x828F\r\n#define GL_TEXTURE_IMAGE_TYPE 0x8290\r\n#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291\r\n#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292\r\n#define GL_MIPMAP 0x8293\r\n#define GL_MANUAL_GENERATE_MIPMAP 0x8294\r\n#define GL_AUTO_GENERATE_MIPMAP 0x8295\r\n#define GL_COLOR_ENCODING 0x8296\r\n#define GL_SRGB_READ 0x8297\r\n#define GL_SRGB_WRITE 0x8298\r\n#define GL_SRGB_DECODE_ARB 0x8299\r\n#define GL_FILTER 0x829A\r\n#define GL_VERTEX_TEXTURE 0x829B\r\n#define GL_TESS_CONTROL_TEXTURE 0x829C\r\n#define GL_TESS_EVALUATION_TEXTURE 0x829D\r\n#define GL_GEOMETRY_TEXTURE 0x829E\r\n#define GL_FRAGMENT_TEXTURE 0x829F\r\n#define GL_COMPUTE_TEXTURE 0x82A0\r\n#define GL_TEXTURE_SHADOW 0x82A1\r\n#define GL_TEXTURE_GATHER 0x82A2\r\n#define GL_TEXTURE_GATHER_SHADOW 0x82A3\r\n#define GL_SHADER_IMAGE_LOAD 0x82A4\r\n#define GL_SHADER_IMAGE_STORE 0x82A5\r\n#define GL_SHADER_IMAGE_ATOMIC 0x82A6\r\n#define GL_IMAGE_TEXEL_SIZE 0x82A7\r\n#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8\r\n#define GL_IMAGE_PIXEL_FORMAT 0x82A9\r\n#define GL_IMAGE_PIXEL_TYPE 0x82AA\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF\r\n#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1\r\n#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2\r\n#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3\r\n#define GL_CLEAR_BUFFER 0x82B4\r\n#define GL_TEXTURE_VIEW 0x82B5\r\n#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6\r\n#define GL_FULL_SUPPORT 0x82B7\r\n#define GL_CAVEAT_SUPPORT 0x82B8\r\n#define GL_IMAGE_CLASS_4_X_32 0x82B9\r\n#define GL_IMAGE_CLASS_2_X_32 0x82BA\r\n#define GL_IMAGE_CLASS_1_X_32 0x82BB\r\n#define GL_IMAGE_CLASS_4_X_16 0x82BC\r\n#define GL_IMAGE_CLASS_2_X_16 0x82BD\r\n#define GL_IMAGE_CLASS_1_X_16 0x82BE\r\n#define GL_IMAGE_CLASS_4_X_8 0x82BF\r\n#define GL_IMAGE_CLASS_2_X_8 0x82C0\r\n#define GL_IMAGE_CLASS_1_X_8 0x82C1\r\n#define GL_IMAGE_CLASS_11_11_10 0x82C2\r\n#define GL_IMAGE_CLASS_10_10_10_2 0x82C3\r\n#define GL_VIEW_CLASS_128_BITS 0x82C4\r\n#define GL_VIEW_CLASS_96_BITS 0x82C5\r\n#define GL_VIEW_CLASS_64_BITS 0x82C6\r\n#define GL_VIEW_CLASS_48_BITS 0x82C7\r\n#define GL_VIEW_CLASS_32_BITS 0x82C8\r\n#define GL_VIEW_CLASS_24_BITS 0x82C9\r\n#define GL_VIEW_CLASS_16_BITS 0x82CA\r\n#define GL_VIEW_CLASS_8_BITS 0x82CB\r\n#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC\r\n#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD\r\n#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE\r\n#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF\r\n#define GL_VIEW_CLASS_RGTC1_RED 0x82D0\r\n#define GL_VIEW_CLASS_RGTC2_RG 0x82D1\r\n#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2\r\n#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3\r\n#define GL_TEXTURE_RECTANGLE 0x84F5\r\n#define GL_TEXTURE_1D_ARRAY 0x8C18\r\n#define GL_TEXTURE_2D_ARRAY 0x8C1A\r\n#define GL_TEXTURE_BUFFER 0x8C2A\r\n#define GL_RENDERBUFFER 0x8D41\r\n#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009\r\n#define GL_TEXTURE_2D_MULTISAMPLE 0x9100\r\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102\r\n#define GL_NUM_SAMPLE_COUNTS 0x9380\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params);\r\n\r\n#define glGetInternalformati64v GLEW_GET_FUN(__glewGetInternalformati64v)\r\n\r\n#define GLEW_ARB_internalformat_query2 GLEW_GET_VAR(__GLEW_ARB_internalformat_query2)\r\n\r\n#endif /* GL_ARB_internalformat_query2 */\r\n\r\n/* ----------------------- GL_ARB_invalidate_subdata ----------------------- */\r\n\r\n#ifndef GL_ARB_invalidate_subdata\r\n#define GL_ARB_invalidate_subdata 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);\r\ntypedef void (GLAPIENTRY * PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments);\r\ntypedef void (GLAPIENTRY * PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\r\n\r\n#define glInvalidateBufferData GLEW_GET_FUN(__glewInvalidateBufferData)\r\n#define glInvalidateBufferSubData GLEW_GET_FUN(__glewInvalidateBufferSubData)\r\n#define glInvalidateFramebuffer GLEW_GET_FUN(__glewInvalidateFramebuffer)\r\n#define glInvalidateSubFramebuffer GLEW_GET_FUN(__glewInvalidateSubFramebuffer)\r\n#define glInvalidateTexImage GLEW_GET_FUN(__glewInvalidateTexImage)\r\n#define glInvalidateTexSubImage GLEW_GET_FUN(__glewInvalidateTexSubImage)\r\n\r\n#define GLEW_ARB_invalidate_subdata GLEW_GET_VAR(__GLEW_ARB_invalidate_subdata)\r\n\r\n#endif /* GL_ARB_invalidate_subdata */\r\n\r\n/* ---------------------- GL_ARB_map_buffer_alignment ---------------------- */\r\n\r\n#ifndef GL_ARB_map_buffer_alignment\r\n#define GL_ARB_map_buffer_alignment 1\r\n\r\n#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC\r\n\r\n#define GLEW_ARB_map_buffer_alignment GLEW_GET_VAR(__GLEW_ARB_map_buffer_alignment)\r\n\r\n#endif /* GL_ARB_map_buffer_alignment */\r\n\r\n/* ------------------------ GL_ARB_map_buffer_range ------------------------ */\r\n\r\n#ifndef GL_ARB_map_buffer_range\r\n#define GL_ARB_map_buffer_range 1\r\n\r\n#define GL_MAP_READ_BIT 0x0001\r\n#define GL_MAP_WRITE_BIT 0x0002\r\n#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004\r\n#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008\r\n#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010\r\n#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);\r\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\r\n\r\n#define glFlushMappedBufferRange GLEW_GET_FUN(__glewFlushMappedBufferRange)\r\n#define glMapBufferRange GLEW_GET_FUN(__glewMapBufferRange)\r\n\r\n#define GLEW_ARB_map_buffer_range GLEW_GET_VAR(__GLEW_ARB_map_buffer_range)\r\n\r\n#endif /* GL_ARB_map_buffer_range */\r\n\r\n/* ------------------------- GL_ARB_matrix_palette ------------------------- */\r\n\r\n#ifndef GL_ARB_matrix_palette\r\n#define GL_ARB_matrix_palette 1\r\n\r\n#define GL_MATRIX_PALETTE_ARB 0x8840\r\n#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841\r\n#define GL_MAX_PALETTE_MATRICES_ARB 0x8842\r\n#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843\r\n#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844\r\n#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845\r\n#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846\r\n#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847\r\n#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848\r\n#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, GLubyte *indices);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, GLuint *indices);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, GLushort *indices);\r\n\r\n#define glCurrentPaletteMatrixARB GLEW_GET_FUN(__glewCurrentPaletteMatrixARB)\r\n#define glMatrixIndexPointerARB GLEW_GET_FUN(__glewMatrixIndexPointerARB)\r\n#define glMatrixIndexubvARB GLEW_GET_FUN(__glewMatrixIndexubvARB)\r\n#define glMatrixIndexuivARB GLEW_GET_FUN(__glewMatrixIndexuivARB)\r\n#define glMatrixIndexusvARB GLEW_GET_FUN(__glewMatrixIndexusvARB)\r\n\r\n#define GLEW_ARB_matrix_palette GLEW_GET_VAR(__GLEW_ARB_matrix_palette)\r\n\r\n#endif /* GL_ARB_matrix_palette */\r\n\r\n/* ----------------------- GL_ARB_multi_draw_indirect ---------------------- */\r\n\r\n#ifndef GL_ARB_multi_draw_indirect\r\n#define GL_ARB_multi_draw_indirect 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride);\r\n\r\n#define glMultiDrawArraysIndirect GLEW_GET_FUN(__glewMultiDrawArraysIndirect)\r\n#define glMultiDrawElementsIndirect GLEW_GET_FUN(__glewMultiDrawElementsIndirect)\r\n\r\n#define GLEW_ARB_multi_draw_indirect GLEW_GET_VAR(__GLEW_ARB_multi_draw_indirect)\r\n\r\n#endif /* GL_ARB_multi_draw_indirect */\r\n\r\n/* --------------------------- GL_ARB_multisample -------------------------- */\r\n\r\n#ifndef GL_ARB_multisample\r\n#define GL_ARB_multisample 1\r\n\r\n#define GL_MULTISAMPLE_ARB 0x809D\r\n#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F\r\n#define GL_SAMPLE_COVERAGE_ARB 0x80A0\r\n#define GL_SAMPLE_BUFFERS_ARB 0x80A8\r\n#define GL_SAMPLES_ARB 0x80A9\r\n#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA\r\n#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB\r\n#define GL_MULTISAMPLE_BIT_ARB 0x20000000\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);\r\n\r\n#define glSampleCoverageARB GLEW_GET_FUN(__glewSampleCoverageARB)\r\n\r\n#define GLEW_ARB_multisample GLEW_GET_VAR(__GLEW_ARB_multisample)\r\n\r\n#endif /* GL_ARB_multisample */\r\n\r\n/* -------------------------- GL_ARB_multitexture -------------------------- */\r\n\r\n#ifndef GL_ARB_multitexture\r\n#define GL_ARB_multitexture 1\r\n\r\n#define GL_TEXTURE0_ARB 0x84C0\r\n#define GL_TEXTURE1_ARB 0x84C1\r\n#define GL_TEXTURE2_ARB 0x84C2\r\n#define GL_TEXTURE3_ARB 0x84C3\r\n#define GL_TEXTURE4_ARB 0x84C4\r\n#define GL_TEXTURE5_ARB 0x84C5\r\n#define GL_TEXTURE6_ARB 0x84C6\r\n#define GL_TEXTURE7_ARB 0x84C7\r\n#define GL_TEXTURE8_ARB 0x84C8\r\n#define GL_TEXTURE9_ARB 0x84C9\r\n#define GL_TEXTURE10_ARB 0x84CA\r\n#define GL_TEXTURE11_ARB 0x84CB\r\n#define GL_TEXTURE12_ARB 0x84CC\r\n#define GL_TEXTURE13_ARB 0x84CD\r\n#define GL_TEXTURE14_ARB 0x84CE\r\n#define GL_TEXTURE15_ARB 0x84CF\r\n#define GL_TEXTURE16_ARB 0x84D0\r\n#define GL_TEXTURE17_ARB 0x84D1\r\n#define GL_TEXTURE18_ARB 0x84D2\r\n#define GL_TEXTURE19_ARB 0x84D3\r\n#define GL_TEXTURE20_ARB 0x84D4\r\n#define GL_TEXTURE21_ARB 0x84D5\r\n#define GL_TEXTURE22_ARB 0x84D6\r\n#define GL_TEXTURE23_ARB 0x84D7\r\n#define GL_TEXTURE24_ARB 0x84D8\r\n#define GL_TEXTURE25_ARB 0x84D9\r\n#define GL_TEXTURE26_ARB 0x84DA\r\n#define GL_TEXTURE27_ARB 0x84DB\r\n#define GL_TEXTURE28_ARB 0x84DC\r\n#define GL_TEXTURE29_ARB 0x84DD\r\n#define GL_TEXTURE30_ARB 0x84DE\r\n#define GL_TEXTURE31_ARB 0x84DF\r\n#define GL_ACTIVE_TEXTURE_ARB 0x84E0\r\n#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1\r\n#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2\r\n\r\ntypedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);\r\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);\r\n\r\n#define glActiveTextureARB GLEW_GET_FUN(__glewActiveTextureARB)\r\n#define glClientActiveTextureARB GLEW_GET_FUN(__glewClientActiveTextureARB)\r\n#define glMultiTexCoord1dARB GLEW_GET_FUN(__glewMultiTexCoord1dARB)\r\n#define glMultiTexCoord1dvARB GLEW_GET_FUN(__glewMultiTexCoord1dvARB)\r\n#define glMultiTexCoord1fARB GLEW_GET_FUN(__glewMultiTexCoord1fARB)\r\n#define glMultiTexCoord1fvARB GLEW_GET_FUN(__glewMultiTexCoord1fvARB)\r\n#define glMultiTexCoord1iARB GLEW_GET_FUN(__glewMultiTexCoord1iARB)\r\n#define glMultiTexCoord1ivARB GLEW_GET_FUN(__glewMultiTexCoord1ivARB)\r\n#define glMultiTexCoord1sARB GLEW_GET_FUN(__glewMultiTexCoord1sARB)\r\n#define glMultiTexCoord1svARB GLEW_GET_FUN(__glewMultiTexCoord1svARB)\r\n#define glMultiTexCoord2dARB GLEW_GET_FUN(__glewMultiTexCoord2dARB)\r\n#define glMultiTexCoord2dvARB GLEW_GET_FUN(__glewMultiTexCoord2dvARB)\r\n#define glMultiTexCoord2fARB GLEW_GET_FUN(__glewMultiTexCoord2fARB)\r\n#define glMultiTexCoord2fvARB GLEW_GET_FUN(__glewMultiTexCoord2fvARB)\r\n#define glMultiTexCoord2iARB GLEW_GET_FUN(__glewMultiTexCoord2iARB)\r\n#define glMultiTexCoord2ivARB GLEW_GET_FUN(__glewMultiTexCoord2ivARB)\r\n#define glMultiTexCoord2sARB GLEW_GET_FUN(__glewMultiTexCoord2sARB)\r\n#define glMultiTexCoord2svARB GLEW_GET_FUN(__glewMultiTexCoord2svARB)\r\n#define glMultiTexCoord3dARB GLEW_GET_FUN(__glewMultiTexCoord3dARB)\r\n#define glMultiTexCoord3dvARB GLEW_GET_FUN(__glewMultiTexCoord3dvARB)\r\n#define glMultiTexCoord3fARB GLEW_GET_FUN(__glewMultiTexCoord3fARB)\r\n#define glMultiTexCoord3fvARB GLEW_GET_FUN(__glewMultiTexCoord3fvARB)\r\n#define glMultiTexCoord3iARB GLEW_GET_FUN(__glewMultiTexCoord3iARB)\r\n#define glMultiTexCoord3ivARB GLEW_GET_FUN(__glewMultiTexCoord3ivARB)\r\n#define glMultiTexCoord3sARB GLEW_GET_FUN(__glewMultiTexCoord3sARB)\r\n#define glMultiTexCoord3svARB GLEW_GET_FUN(__glewMultiTexCoord3svARB)\r\n#define glMultiTexCoord4dARB GLEW_GET_FUN(__glewMultiTexCoord4dARB)\r\n#define glMultiTexCoord4dvARB GLEW_GET_FUN(__glewMultiTexCoord4dvARB)\r\n#define glMultiTexCoord4fARB GLEW_GET_FUN(__glewMultiTexCoord4fARB)\r\n#define glMultiTexCoord4fvARB GLEW_GET_FUN(__glewMultiTexCoord4fvARB)\r\n#define glMultiTexCoord4iARB GLEW_GET_FUN(__glewMultiTexCoord4iARB)\r\n#define glMultiTexCoord4ivARB GLEW_GET_FUN(__glewMultiTexCoord4ivARB)\r\n#define glMultiTexCoord4sARB GLEW_GET_FUN(__glewMultiTexCoord4sARB)\r\n#define glMultiTexCoord4svARB GLEW_GET_FUN(__glewMultiTexCoord4svARB)\r\n\r\n#define GLEW_ARB_multitexture GLEW_GET_VAR(__GLEW_ARB_multitexture)\r\n\r\n#endif /* GL_ARB_multitexture */\r\n\r\n/* ------------------------- GL_ARB_occlusion_query ------------------------ */\r\n\r\n#ifndef GL_ARB_occlusion_query\r\n#define GL_ARB_occlusion_query 1\r\n\r\n#define GL_QUERY_COUNTER_BITS_ARB 0x8864\r\n#define GL_CURRENT_QUERY_ARB 0x8865\r\n#define GL_QUERY_RESULT_ARB 0x8866\r\n#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867\r\n#define GL_SAMPLES_PASSED_ARB 0x8914\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id);\r\n\r\n#define glBeginQueryARB GLEW_GET_FUN(__glewBeginQueryARB)\r\n#define glDeleteQueriesARB GLEW_GET_FUN(__glewDeleteQueriesARB)\r\n#define glEndQueryARB GLEW_GET_FUN(__glewEndQueryARB)\r\n#define glGenQueriesARB GLEW_GET_FUN(__glewGenQueriesARB)\r\n#define glGetQueryObjectivARB GLEW_GET_FUN(__glewGetQueryObjectivARB)\r\n#define glGetQueryObjectuivARB GLEW_GET_FUN(__glewGetQueryObjectuivARB)\r\n#define glGetQueryivARB GLEW_GET_FUN(__glewGetQueryivARB)\r\n#define glIsQueryARB GLEW_GET_FUN(__glewIsQueryARB)\r\n\r\n#define GLEW_ARB_occlusion_query GLEW_GET_VAR(__GLEW_ARB_occlusion_query)\r\n\r\n#endif /* GL_ARB_occlusion_query */\r\n\r\n/* ------------------------ GL_ARB_occlusion_query2 ------------------------ */\r\n\r\n#ifndef GL_ARB_occlusion_query2\r\n#define GL_ARB_occlusion_query2 1\r\n\r\n#define GL_ANY_SAMPLES_PASSED 0x8C2F\r\n\r\n#define GLEW_ARB_occlusion_query2 GLEW_GET_VAR(__GLEW_ARB_occlusion_query2)\r\n\r\n#endif /* GL_ARB_occlusion_query2 */\r\n\r\n/* ----------------------- GL_ARB_pixel_buffer_object ---------------------- */\r\n\r\n#ifndef GL_ARB_pixel_buffer_object\r\n#define GL_ARB_pixel_buffer_object 1\r\n\r\n#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB\r\n#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC\r\n#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED\r\n#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF\r\n\r\n#define GLEW_ARB_pixel_buffer_object GLEW_GET_VAR(__GLEW_ARB_pixel_buffer_object)\r\n\r\n#endif /* GL_ARB_pixel_buffer_object */\r\n\r\n/* ------------------------ GL_ARB_point_parameters ------------------------ */\r\n\r\n#ifndef GL_ARB_point_parameters\r\n#define GL_ARB_point_parameters 1\r\n\r\n#define GL_POINT_SIZE_MIN_ARB 0x8126\r\n#define GL_POINT_SIZE_MAX_ARB 0x8127\r\n#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128\r\n#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat* params);\r\n\r\n#define glPointParameterfARB GLEW_GET_FUN(__glewPointParameterfARB)\r\n#define glPointParameterfvARB GLEW_GET_FUN(__glewPointParameterfvARB)\r\n\r\n#define GLEW_ARB_point_parameters GLEW_GET_VAR(__GLEW_ARB_point_parameters)\r\n\r\n#endif /* GL_ARB_point_parameters */\r\n\r\n/* -------------------------- GL_ARB_point_sprite -------------------------- */\r\n\r\n#ifndef GL_ARB_point_sprite\r\n#define GL_ARB_point_sprite 1\r\n\r\n#define GL_POINT_SPRITE_ARB 0x8861\r\n#define GL_COORD_REPLACE_ARB 0x8862\r\n\r\n#define GLEW_ARB_point_sprite GLEW_GET_VAR(__GLEW_ARB_point_sprite)\r\n\r\n#endif /* GL_ARB_point_sprite */\r\n\r\n/* --------------------- GL_ARB_program_interface_query -------------------- */\r\n\r\n#ifndef GL_ARB_program_interface_query\r\n#define GL_ARB_program_interface_query 1\r\n\r\n#define GL_UNIFORM 0x92E1\r\n#define GL_UNIFORM_BLOCK 0x92E2\r\n#define GL_PROGRAM_INPUT 0x92E3\r\n#define GL_PROGRAM_OUTPUT 0x92E4\r\n#define GL_BUFFER_VARIABLE 0x92E5\r\n#define GL_SHADER_STORAGE_BLOCK 0x92E6\r\n#define GL_IS_PER_PATCH 0x92E7\r\n#define GL_VERTEX_SUBROUTINE 0x92E8\r\n#define GL_TESS_CONTROL_SUBROUTINE 0x92E9\r\n#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA\r\n#define GL_GEOMETRY_SUBROUTINE 0x92EB\r\n#define GL_FRAGMENT_SUBROUTINE 0x92EC\r\n#define GL_COMPUTE_SUBROUTINE 0x92ED\r\n#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE\r\n#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF\r\n#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0\r\n#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1\r\n#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2\r\n#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3\r\n#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4\r\n#define GL_ACTIVE_RESOURCES 0x92F5\r\n#define GL_MAX_NAME_LENGTH 0x92F6\r\n#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7\r\n#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8\r\n#define GL_NAME_LENGTH 0x92F9\r\n#define GL_TYPE 0x92FA\r\n#define GL_ARRAY_SIZE 0x92FB\r\n#define GL_OFFSET 0x92FC\r\n#define GL_BLOCK_INDEX 0x92FD\r\n#define GL_ARRAY_STRIDE 0x92FE\r\n#define GL_MATRIX_STRIDE 0x92FF\r\n#define GL_IS_ROW_MAJOR 0x9300\r\n#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301\r\n#define GL_BUFFER_BINDING 0x9302\r\n#define GL_BUFFER_DATA_SIZE 0x9303\r\n#define GL_NUM_ACTIVE_VARIABLES 0x9304\r\n#define GL_ACTIVE_VARIABLES 0x9305\r\n#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306\r\n#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307\r\n#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308\r\n#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309\r\n#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A\r\n#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B\r\n#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C\r\n#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D\r\n#define GL_LOCATION 0x930E\r\n#define GL_LOCATION_INDEX 0x930F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint* params);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar* name);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLint *params);\r\n\r\n#define glGetProgramInterfaceiv GLEW_GET_FUN(__glewGetProgramInterfaceiv)\r\n#define glGetProgramResourceIndex GLEW_GET_FUN(__glewGetProgramResourceIndex)\r\n#define glGetProgramResourceLocation GLEW_GET_FUN(__glewGetProgramResourceLocation)\r\n#define glGetProgramResourceLocationIndex GLEW_GET_FUN(__glewGetProgramResourceLocationIndex)\r\n#define glGetProgramResourceName GLEW_GET_FUN(__glewGetProgramResourceName)\r\n#define glGetProgramResourceiv GLEW_GET_FUN(__glewGetProgramResourceiv)\r\n\r\n#define GLEW_ARB_program_interface_query GLEW_GET_VAR(__GLEW_ARB_program_interface_query)\r\n\r\n#endif /* GL_ARB_program_interface_query */\r\n\r\n/* ------------------------ GL_ARB_provoking_vertex ------------------------ */\r\n\r\n#ifndef GL_ARB_provoking_vertex\r\n#define GL_ARB_provoking_vertex 1\r\n\r\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C\r\n#define GL_FIRST_VERTEX_CONVENTION 0x8E4D\r\n#define GL_LAST_VERTEX_CONVENTION 0x8E4E\r\n#define GL_PROVOKING_VERTEX 0x8E4F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXPROC) (GLenum mode);\r\n\r\n#define glProvokingVertex GLEW_GET_FUN(__glewProvokingVertex)\r\n\r\n#define GLEW_ARB_provoking_vertex GLEW_GET_VAR(__GLEW_ARB_provoking_vertex)\r\n\r\n#endif /* GL_ARB_provoking_vertex */\r\n\r\n/* ------------------ GL_ARB_robust_buffer_access_behavior ----------------- */\r\n\r\n#ifndef GL_ARB_robust_buffer_access_behavior\r\n#define GL_ARB_robust_buffer_access_behavior 1\r\n\r\n#define GLEW_ARB_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_ARB_robust_buffer_access_behavior)\r\n\r\n#endif /* GL_ARB_robust_buffer_access_behavior */\r\n\r\n/* --------------------------- GL_ARB_robustness --------------------------- */\r\n\r\n#ifndef GL_ARB_robustness\r\n#define GL_ARB_robustness 1\r\n\r\n#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004\r\n#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\r\n#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253\r\n#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254\r\n#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255\r\n#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\r\n#define GL_NO_RESET_NOTIFICATION_ARB 0x8261\r\n\r\ntypedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table);\r\ntypedef void (GLAPIENTRY * PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void* img);\r\ntypedef void (GLAPIENTRY * PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image);\r\ntypedef void (GLAPIENTRY * PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint* v);\r\ntypedef void (GLAPIENTRY * PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte* pattern);\r\ntypedef void (GLAPIENTRY * PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, GLvoid*column, GLvoid*span);\r\ntypedef void (GLAPIENTRY * PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* img);\r\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data);\r\n\r\n#define glGetGraphicsResetStatusARB GLEW_GET_FUN(__glewGetGraphicsResetStatusARB)\r\n#define glGetnColorTableARB GLEW_GET_FUN(__glewGetnColorTableARB)\r\n#define glGetnCompressedTexImageARB GLEW_GET_FUN(__glewGetnCompressedTexImageARB)\r\n#define glGetnConvolutionFilterARB GLEW_GET_FUN(__glewGetnConvolutionFilterARB)\r\n#define glGetnHistogramARB GLEW_GET_FUN(__glewGetnHistogramARB)\r\n#define glGetnMapdvARB GLEW_GET_FUN(__glewGetnMapdvARB)\r\n#define glGetnMapfvARB GLEW_GET_FUN(__glewGetnMapfvARB)\r\n#define glGetnMapivARB GLEW_GET_FUN(__glewGetnMapivARB)\r\n#define glGetnMinmaxARB GLEW_GET_FUN(__glewGetnMinmaxARB)\r\n#define glGetnPixelMapfvARB GLEW_GET_FUN(__glewGetnPixelMapfvARB)\r\n#define glGetnPixelMapuivARB GLEW_GET_FUN(__glewGetnPixelMapuivARB)\r\n#define glGetnPixelMapusvARB GLEW_GET_FUN(__glewGetnPixelMapusvARB)\r\n#define glGetnPolygonStippleARB GLEW_GET_FUN(__glewGetnPolygonStippleARB)\r\n#define glGetnSeparableFilterARB GLEW_GET_FUN(__glewGetnSeparableFilterARB)\r\n#define glGetnTexImageARB GLEW_GET_FUN(__glewGetnTexImageARB)\r\n#define glGetnUniformdvARB GLEW_GET_FUN(__glewGetnUniformdvARB)\r\n#define glGetnUniformfvARB GLEW_GET_FUN(__glewGetnUniformfvARB)\r\n#define glGetnUniformivARB GLEW_GET_FUN(__glewGetnUniformivARB)\r\n#define glGetnUniformuivARB GLEW_GET_FUN(__glewGetnUniformuivARB)\r\n#define glReadnPixelsARB GLEW_GET_FUN(__glewReadnPixelsARB)\r\n\r\n#define GLEW_ARB_robustness GLEW_GET_VAR(__GLEW_ARB_robustness)\r\n\r\n#endif /* GL_ARB_robustness */\r\n\r\n/* ---------------- GL_ARB_robustness_application_isolation ---------------- */\r\n\r\n#ifndef GL_ARB_robustness_application_isolation\r\n#define GL_ARB_robustness_application_isolation 1\r\n\r\n#define GLEW_ARB_robustness_application_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_application_isolation)\r\n\r\n#endif /* GL_ARB_robustness_application_isolation */\r\n\r\n/* ---------------- GL_ARB_robustness_share_group_isolation ---------------- */\r\n\r\n#ifndef GL_ARB_robustness_share_group_isolation\r\n#define GL_ARB_robustness_share_group_isolation 1\r\n\r\n#define GLEW_ARB_robustness_share_group_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_share_group_isolation)\r\n\r\n#endif /* GL_ARB_robustness_share_group_isolation */\r\n\r\n/* ------------------------- GL_ARB_sample_shading ------------------------- */\r\n\r\n#ifndef GL_ARB_sample_shading\r\n#define GL_ARB_sample_shading 1\r\n\r\n#define GL_SAMPLE_SHADING_ARB 0x8C36\r\n#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37\r\n\r\ntypedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value);\r\n\r\n#define glMinSampleShadingARB GLEW_GET_FUN(__glewMinSampleShadingARB)\r\n\r\n#define GLEW_ARB_sample_shading GLEW_GET_VAR(__GLEW_ARB_sample_shading)\r\n\r\n#endif /* GL_ARB_sample_shading */\r\n\r\n/* ------------------------- GL_ARB_sampler_objects ------------------------ */\r\n\r\n#ifndef GL_ARB_sampler_objects\r\n#define GL_ARB_sampler_objects 1\r\n\r\n#define GL_SAMPLER_BINDING 0x8919\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);\r\ntypedef void (GLAPIENTRY * PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint * samplers);\r\ntypedef void (GLAPIENTRY * PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint* samplers);\r\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISSAMPLERPROC) (GLuint sampler);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint* params);\r\n\r\n#define glBindSampler GLEW_GET_FUN(__glewBindSampler)\r\n#define glDeleteSamplers GLEW_GET_FUN(__glewDeleteSamplers)\r\n#define glGenSamplers GLEW_GET_FUN(__glewGenSamplers)\r\n#define glGetSamplerParameterIiv GLEW_GET_FUN(__glewGetSamplerParameterIiv)\r\n#define glGetSamplerParameterIuiv GLEW_GET_FUN(__glewGetSamplerParameterIuiv)\r\n#define glGetSamplerParameterfv GLEW_GET_FUN(__glewGetSamplerParameterfv)\r\n#define glGetSamplerParameteriv GLEW_GET_FUN(__glewGetSamplerParameteriv)\r\n#define glIsSampler GLEW_GET_FUN(__glewIsSampler)\r\n#define glSamplerParameterIiv GLEW_GET_FUN(__glewSamplerParameterIiv)\r\n#define glSamplerParameterIuiv GLEW_GET_FUN(__glewSamplerParameterIuiv)\r\n#define glSamplerParameterf GLEW_GET_FUN(__glewSamplerParameterf)\r\n#define glSamplerParameterfv GLEW_GET_FUN(__glewSamplerParameterfv)\r\n#define glSamplerParameteri GLEW_GET_FUN(__glewSamplerParameteri)\r\n#define glSamplerParameteriv GLEW_GET_FUN(__glewSamplerParameteriv)\r\n\r\n#define GLEW_ARB_sampler_objects GLEW_GET_VAR(__GLEW_ARB_sampler_objects)\r\n\r\n#endif /* GL_ARB_sampler_objects */\r\n\r\n/* ------------------------ GL_ARB_seamless_cube_map ----------------------- */\r\n\r\n#ifndef GL_ARB_seamless_cube_map\r\n#define GL_ARB_seamless_cube_map 1\r\n\r\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F\r\n\r\n#define GLEW_ARB_seamless_cube_map GLEW_GET_VAR(__GLEW_ARB_seamless_cube_map)\r\n\r\n#endif /* GL_ARB_seamless_cube_map */\r\n\r\n/* --------------------- GL_ARB_separate_shader_objects -------------------- */\r\n\r\n#ifndef GL_ARB_separate_shader_objects\r\n#define GL_ARB_separate_shader_objects 1\r\n\r\n#define GL_VERTEX_SHADER_BIT 0x00000001\r\n#define GL_FRAGMENT_SHADER_BIT 0x00000002\r\n#define GL_GEOMETRY_SHADER_BIT 0x00000004\r\n#define GL_TESS_CONTROL_SHADER_BIT 0x00000008\r\n#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010\r\n#define GL_PROGRAM_SEPARABLE 0x8258\r\n#define GL_ACTIVE_PROGRAM 0x8259\r\n#define GL_PROGRAM_PIPELINE_BINDING 0x825A\r\n#define GL_ALL_SHADER_BITS 0xFFFFFFFF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);\r\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar ** strings);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint* pipelines);\r\ntypedef void (GLAPIENTRY * PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar *infoLog);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint x, GLint y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint x, GLuint y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);\r\n\r\n#define glActiveShaderProgram GLEW_GET_FUN(__glewActiveShaderProgram)\r\n#define glBindProgramPipeline GLEW_GET_FUN(__glewBindProgramPipeline)\r\n#define glCreateShaderProgramv GLEW_GET_FUN(__glewCreateShaderProgramv)\r\n#define glDeleteProgramPipelines GLEW_GET_FUN(__glewDeleteProgramPipelines)\r\n#define glGenProgramPipelines GLEW_GET_FUN(__glewGenProgramPipelines)\r\n#define glGetProgramPipelineInfoLog GLEW_GET_FUN(__glewGetProgramPipelineInfoLog)\r\n#define glGetProgramPipelineiv GLEW_GET_FUN(__glewGetProgramPipelineiv)\r\n#define glIsProgramPipeline GLEW_GET_FUN(__glewIsProgramPipeline)\r\n#define glProgramUniform1d GLEW_GET_FUN(__glewProgramUniform1d)\r\n#define glProgramUniform1dv GLEW_GET_FUN(__glewProgramUniform1dv)\r\n#define glProgramUniform1f GLEW_GET_FUN(__glewProgramUniform1f)\r\n#define glProgramUniform1fv GLEW_GET_FUN(__glewProgramUniform1fv)\r\n#define glProgramUniform1i GLEW_GET_FUN(__glewProgramUniform1i)\r\n#define glProgramUniform1iv GLEW_GET_FUN(__glewProgramUniform1iv)\r\n#define glProgramUniform1ui GLEW_GET_FUN(__glewProgramUniform1ui)\r\n#define glProgramUniform1uiv GLEW_GET_FUN(__glewProgramUniform1uiv)\r\n#define glProgramUniform2d GLEW_GET_FUN(__glewProgramUniform2d)\r\n#define glProgramUniform2dv GLEW_GET_FUN(__glewProgramUniform2dv)\r\n#define glProgramUniform2f GLEW_GET_FUN(__glewProgramUniform2f)\r\n#define glProgramUniform2fv GLEW_GET_FUN(__glewProgramUniform2fv)\r\n#define glProgramUniform2i GLEW_GET_FUN(__glewProgramUniform2i)\r\n#define glProgramUniform2iv GLEW_GET_FUN(__glewProgramUniform2iv)\r\n#define glProgramUniform2ui GLEW_GET_FUN(__glewProgramUniform2ui)\r\n#define glProgramUniform2uiv GLEW_GET_FUN(__glewProgramUniform2uiv)\r\n#define glProgramUniform3d GLEW_GET_FUN(__glewProgramUniform3d)\r\n#define glProgramUniform3dv GLEW_GET_FUN(__glewProgramUniform3dv)\r\n#define glProgramUniform3f GLEW_GET_FUN(__glewProgramUniform3f)\r\n#define glProgramUniform3fv GLEW_GET_FUN(__glewProgramUniform3fv)\r\n#define glProgramUniform3i GLEW_GET_FUN(__glewProgramUniform3i)\r\n#define glProgramUniform3iv GLEW_GET_FUN(__glewProgramUniform3iv)\r\n#define glProgramUniform3ui GLEW_GET_FUN(__glewProgramUniform3ui)\r\n#define glProgramUniform3uiv GLEW_GET_FUN(__glewProgramUniform3uiv)\r\n#define glProgramUniform4d GLEW_GET_FUN(__glewProgramUniform4d)\r\n#define glProgramUniform4dv GLEW_GET_FUN(__glewProgramUniform4dv)\r\n#define glProgramUniform4f GLEW_GET_FUN(__glewProgramUniform4f)\r\n#define glProgramUniform4fv GLEW_GET_FUN(__glewProgramUniform4fv)\r\n#define glProgramUniform4i GLEW_GET_FUN(__glewProgramUniform4i)\r\n#define glProgramUniform4iv GLEW_GET_FUN(__glewProgramUniform4iv)\r\n#define glProgramUniform4ui GLEW_GET_FUN(__glewProgramUniform4ui)\r\n#define glProgramUniform4uiv GLEW_GET_FUN(__glewProgramUniform4uiv)\r\n#define glProgramUniformMatrix2dv GLEW_GET_FUN(__glewProgramUniformMatrix2dv)\r\n#define glProgramUniformMatrix2fv GLEW_GET_FUN(__glewProgramUniformMatrix2fv)\r\n#define glProgramUniformMatrix2x3dv GLEW_GET_FUN(__glewProgramUniformMatrix2x3dv)\r\n#define glProgramUniformMatrix2x3fv GLEW_GET_FUN(__glewProgramUniformMatrix2x3fv)\r\n#define glProgramUniformMatrix2x4dv GLEW_GET_FUN(__glewProgramUniformMatrix2x4dv)\r\n#define glProgramUniformMatrix2x4fv GLEW_GET_FUN(__glewProgramUniformMatrix2x4fv)\r\n#define glProgramUniformMatrix3dv GLEW_GET_FUN(__glewProgramUniformMatrix3dv)\r\n#define glProgramUniformMatrix3fv GLEW_GET_FUN(__glewProgramUniformMatrix3fv)\r\n#define glProgramUniformMatrix3x2dv GLEW_GET_FUN(__glewProgramUniformMatrix3x2dv)\r\n#define glProgramUniformMatrix3x2fv GLEW_GET_FUN(__glewProgramUniformMatrix3x2fv)\r\n#define glProgramUniformMatrix3x4dv GLEW_GET_FUN(__glewProgramUniformMatrix3x4dv)\r\n#define glProgramUniformMatrix3x4fv GLEW_GET_FUN(__glewProgramUniformMatrix3x4fv)\r\n#define glProgramUniformMatrix4dv GLEW_GET_FUN(__glewProgramUniformMatrix4dv)\r\n#define glProgramUniformMatrix4fv GLEW_GET_FUN(__glewProgramUniformMatrix4fv)\r\n#define glProgramUniformMatrix4x2dv GLEW_GET_FUN(__glewProgramUniformMatrix4x2dv)\r\n#define glProgramUniformMatrix4x2fv GLEW_GET_FUN(__glewProgramUniformMatrix4x2fv)\r\n#define glProgramUniformMatrix4x3dv GLEW_GET_FUN(__glewProgramUniformMatrix4x3dv)\r\n#define glProgramUniformMatrix4x3fv GLEW_GET_FUN(__glewProgramUniformMatrix4x3fv)\r\n#define glUseProgramStages GLEW_GET_FUN(__glewUseProgramStages)\r\n#define glValidateProgramPipeline GLEW_GET_FUN(__glewValidateProgramPipeline)\r\n\r\n#define GLEW_ARB_separate_shader_objects GLEW_GET_VAR(__GLEW_ARB_separate_shader_objects)\r\n\r\n#endif /* GL_ARB_separate_shader_objects */\r\n\r\n/* --------------------- GL_ARB_shader_atomic_counters --------------------- */\r\n\r\n#ifndef GL_ARB_shader_atomic_counters\r\n#define GL_ARB_shader_atomic_counters 1\r\n\r\n#define GL_ATOMIC_COUNTER_BUFFER 0x92C0\r\n#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1\r\n#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2\r\n#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3\r\n#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4\r\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5\r\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB\r\n#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC\r\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD\r\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE\r\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF\r\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0\r\n#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1\r\n#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2\r\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3\r\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4\r\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5\r\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6\r\n#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7\r\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8\r\n#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9\r\n#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA\r\n#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB\r\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint* params);\r\n\r\n#define glGetActiveAtomicCounterBufferiv GLEW_GET_FUN(__glewGetActiveAtomicCounterBufferiv)\r\n\r\n#define GLEW_ARB_shader_atomic_counters GLEW_GET_VAR(__GLEW_ARB_shader_atomic_counters)\r\n\r\n#endif /* GL_ARB_shader_atomic_counters */\r\n\r\n/* ----------------------- GL_ARB_shader_bit_encoding ---------------------- */\r\n\r\n#ifndef GL_ARB_shader_bit_encoding\r\n#define GL_ARB_shader_bit_encoding 1\r\n\r\n#define GLEW_ARB_shader_bit_encoding GLEW_GET_VAR(__GLEW_ARB_shader_bit_encoding)\r\n\r\n#endif /* GL_ARB_shader_bit_encoding */\r\n\r\n/* --------------------- GL_ARB_shader_image_load_store -------------------- */\r\n\r\n#ifndef GL_ARB_shader_image_load_store\r\n#define GL_ARB_shader_image_load_store 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001\r\n#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002\r\n#define GL_UNIFORM_BARRIER_BIT 0x00000004\r\n#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008\r\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020\r\n#define GL_COMMAND_BARRIER_BIT 0x00000040\r\n#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080\r\n#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100\r\n#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200\r\n#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400\r\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800\r\n#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000\r\n#define GL_MAX_IMAGE_UNITS 0x8F38\r\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39\r\n#define GL_IMAGE_BINDING_NAME 0x8F3A\r\n#define GL_IMAGE_BINDING_LEVEL 0x8F3B\r\n#define GL_IMAGE_BINDING_LAYERED 0x8F3C\r\n#define GL_IMAGE_BINDING_LAYER 0x8F3D\r\n#define GL_IMAGE_BINDING_ACCESS 0x8F3E\r\n#define GL_IMAGE_1D 0x904C\r\n#define GL_IMAGE_2D 0x904D\r\n#define GL_IMAGE_3D 0x904E\r\n#define GL_IMAGE_2D_RECT 0x904F\r\n#define GL_IMAGE_CUBE 0x9050\r\n#define GL_IMAGE_BUFFER 0x9051\r\n#define GL_IMAGE_1D_ARRAY 0x9052\r\n#define GL_IMAGE_2D_ARRAY 0x9053\r\n#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054\r\n#define GL_IMAGE_2D_MULTISAMPLE 0x9055\r\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056\r\n#define GL_INT_IMAGE_1D 0x9057\r\n#define GL_INT_IMAGE_2D 0x9058\r\n#define GL_INT_IMAGE_3D 0x9059\r\n#define GL_INT_IMAGE_2D_RECT 0x905A\r\n#define GL_INT_IMAGE_CUBE 0x905B\r\n#define GL_INT_IMAGE_BUFFER 0x905C\r\n#define GL_INT_IMAGE_1D_ARRAY 0x905D\r\n#define GL_INT_IMAGE_2D_ARRAY 0x905E\r\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061\r\n#define GL_UNSIGNED_INT_IMAGE_1D 0x9062\r\n#define GL_UNSIGNED_INT_IMAGE_2D 0x9063\r\n#define GL_UNSIGNED_INT_IMAGE_3D 0x9064\r\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066\r\n#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067\r\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068\r\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C\r\n#define GL_MAX_IMAGE_SAMPLES 0x906D\r\n#define GL_IMAGE_BINDING_FORMAT 0x906E\r\n#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7\r\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8\r\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9\r\n#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA\r\n#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB\r\n#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC\r\n#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD\r\n#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE\r\n#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF\r\n#define GL_ALL_BARRIER_BITS 0xFFFFFFFF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\r\ntypedef void (GLAPIENTRY * PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);\r\n\r\n#define glBindImageTexture GLEW_GET_FUN(__glewBindImageTexture)\r\n#define glMemoryBarrier GLEW_GET_FUN(__glewMemoryBarrier)\r\n\r\n#define GLEW_ARB_shader_image_load_store GLEW_GET_VAR(__GLEW_ARB_shader_image_load_store)\r\n\r\n#endif /* GL_ARB_shader_image_load_store */\r\n\r\n/* ------------------------ GL_ARB_shader_image_size ----------------------- */\r\n\r\n#ifndef GL_ARB_shader_image_size\r\n#define GL_ARB_shader_image_size 1\r\n\r\n#define GLEW_ARB_shader_image_size GLEW_GET_VAR(__GLEW_ARB_shader_image_size)\r\n\r\n#endif /* GL_ARB_shader_image_size */\r\n\r\n/* ------------------------- GL_ARB_shader_objects ------------------------- */\r\n\r\n#ifndef GL_ARB_shader_objects\r\n#define GL_ARB_shader_objects 1\r\n\r\n#define GL_PROGRAM_OBJECT_ARB 0x8B40\r\n#define GL_SHADER_OBJECT_ARB 0x8B48\r\n#define GL_OBJECT_TYPE_ARB 0x8B4E\r\n#define GL_OBJECT_SUBTYPE_ARB 0x8B4F\r\n#define GL_FLOAT_VEC2_ARB 0x8B50\r\n#define GL_FLOAT_VEC3_ARB 0x8B51\r\n#define GL_FLOAT_VEC4_ARB 0x8B52\r\n#define GL_INT_VEC2_ARB 0x8B53\r\n#define GL_INT_VEC3_ARB 0x8B54\r\n#define GL_INT_VEC4_ARB 0x8B55\r\n#define GL_BOOL_ARB 0x8B56\r\n#define GL_BOOL_VEC2_ARB 0x8B57\r\n#define GL_BOOL_VEC3_ARB 0x8B58\r\n#define GL_BOOL_VEC4_ARB 0x8B59\r\n#define GL_FLOAT_MAT2_ARB 0x8B5A\r\n#define GL_FLOAT_MAT3_ARB 0x8B5B\r\n#define GL_FLOAT_MAT4_ARB 0x8B5C\r\n#define GL_SAMPLER_1D_ARB 0x8B5D\r\n#define GL_SAMPLER_2D_ARB 0x8B5E\r\n#define GL_SAMPLER_3D_ARB 0x8B5F\r\n#define GL_SAMPLER_CUBE_ARB 0x8B60\r\n#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61\r\n#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62\r\n#define GL_SAMPLER_2D_RECT_ARB 0x8B63\r\n#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64\r\n#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80\r\n#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81\r\n#define GL_OBJECT_LINK_STATUS_ARB 0x8B82\r\n#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83\r\n#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84\r\n#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85\r\n#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86\r\n#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87\r\n#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88\r\n\r\ntypedef char GLcharARB;\r\ntypedef unsigned int GLhandleARB;\r\n\r\ntypedef void (GLAPIENTRY * PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);\r\ntypedef GLhandleARB (GLAPIENTRY * PFNGLCREATEPROGRAMOBJECTARBPROC) (void);\r\ntypedef GLhandleARB (GLAPIENTRY * PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);\r\ntypedef void (GLAPIENTRY * PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name);\r\ntypedef void (GLAPIENTRY * PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei* count, GLhandleARB *obj);\r\ntypedef GLhandleARB (GLAPIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname);\r\ntypedef void (GLAPIENTRY * PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *infoLog);\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *source);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);\r\ntypedef void (GLAPIENTRY * PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint *length);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);\r\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);\r\n\r\n#define glAttachObjectARB GLEW_GET_FUN(__glewAttachObjectARB)\r\n#define glCompileShaderARB GLEW_GET_FUN(__glewCompileShaderARB)\r\n#define glCreateProgramObjectARB GLEW_GET_FUN(__glewCreateProgramObjectARB)\r\n#define glCreateShaderObjectARB GLEW_GET_FUN(__glewCreateShaderObjectARB)\r\n#define glDeleteObjectARB GLEW_GET_FUN(__glewDeleteObjectARB)\r\n#define glDetachObjectARB GLEW_GET_FUN(__glewDetachObjectARB)\r\n#define glGetActiveUniformARB GLEW_GET_FUN(__glewGetActiveUniformARB)\r\n#define glGetAttachedObjectsARB GLEW_GET_FUN(__glewGetAttachedObjectsARB)\r\n#define glGetHandleARB GLEW_GET_FUN(__glewGetHandleARB)\r\n#define glGetInfoLogARB GLEW_GET_FUN(__glewGetInfoLogARB)\r\n#define glGetObjectParameterfvARB GLEW_GET_FUN(__glewGetObjectParameterfvARB)\r\n#define glGetObjectParameterivARB GLEW_GET_FUN(__glewGetObjectParameterivARB)\r\n#define glGetShaderSourceARB GLEW_GET_FUN(__glewGetShaderSourceARB)\r\n#define glGetUniformLocationARB GLEW_GET_FUN(__glewGetUniformLocationARB)\r\n#define glGetUniformfvARB GLEW_GET_FUN(__glewGetUniformfvARB)\r\n#define glGetUniformivARB GLEW_GET_FUN(__glewGetUniformivARB)\r\n#define glLinkProgramARB GLEW_GET_FUN(__glewLinkProgramARB)\r\n#define glShaderSourceARB GLEW_GET_FUN(__glewShaderSourceARB)\r\n#define glUniform1fARB GLEW_GET_FUN(__glewUniform1fARB)\r\n#define glUniform1fvARB GLEW_GET_FUN(__glewUniform1fvARB)\r\n#define glUniform1iARB GLEW_GET_FUN(__glewUniform1iARB)\r\n#define glUniform1ivARB GLEW_GET_FUN(__glewUniform1ivARB)\r\n#define glUniform2fARB GLEW_GET_FUN(__glewUniform2fARB)\r\n#define glUniform2fvARB GLEW_GET_FUN(__glewUniform2fvARB)\r\n#define glUniform2iARB GLEW_GET_FUN(__glewUniform2iARB)\r\n#define glUniform2ivARB GLEW_GET_FUN(__glewUniform2ivARB)\r\n#define glUniform3fARB GLEW_GET_FUN(__glewUniform3fARB)\r\n#define glUniform3fvARB GLEW_GET_FUN(__glewUniform3fvARB)\r\n#define glUniform3iARB GLEW_GET_FUN(__glewUniform3iARB)\r\n#define glUniform3ivARB GLEW_GET_FUN(__glewUniform3ivARB)\r\n#define glUniform4fARB GLEW_GET_FUN(__glewUniform4fARB)\r\n#define glUniform4fvARB GLEW_GET_FUN(__glewUniform4fvARB)\r\n#define glUniform4iARB GLEW_GET_FUN(__glewUniform4iARB)\r\n#define glUniform4ivARB GLEW_GET_FUN(__glewUniform4ivARB)\r\n#define glUniformMatrix2fvARB GLEW_GET_FUN(__glewUniformMatrix2fvARB)\r\n#define glUniformMatrix3fvARB GLEW_GET_FUN(__glewUniformMatrix3fvARB)\r\n#define glUniformMatrix4fvARB GLEW_GET_FUN(__glewUniformMatrix4fvARB)\r\n#define glUseProgramObjectARB GLEW_GET_FUN(__glewUseProgramObjectARB)\r\n#define glValidateProgramARB GLEW_GET_FUN(__glewValidateProgramARB)\r\n\r\n#define GLEW_ARB_shader_objects GLEW_GET_VAR(__GLEW_ARB_shader_objects)\r\n\r\n#endif /* GL_ARB_shader_objects */\r\n\r\n/* ------------------------ GL_ARB_shader_precision ------------------------ */\r\n\r\n#ifndef GL_ARB_shader_precision\r\n#define GL_ARB_shader_precision 1\r\n\r\n#define GLEW_ARB_shader_precision GLEW_GET_VAR(__GLEW_ARB_shader_precision)\r\n\r\n#endif /* GL_ARB_shader_precision */\r\n\r\n/* ---------------------- GL_ARB_shader_stencil_export --------------------- */\r\n\r\n#ifndef GL_ARB_shader_stencil_export\r\n#define GL_ARB_shader_stencil_export 1\r\n\r\n#define GLEW_ARB_shader_stencil_export GLEW_GET_VAR(__GLEW_ARB_shader_stencil_export)\r\n\r\n#endif /* GL_ARB_shader_stencil_export */\r\n\r\n/* ------------------ GL_ARB_shader_storage_buffer_object ------------------ */\r\n\r\n#ifndef GL_ARB_shader_storage_buffer_object\r\n#define GL_ARB_shader_storage_buffer_object 1\r\n\r\n#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000\r\n#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39\r\n#define GL_SHADER_STORAGE_BUFFER 0x90D2\r\n#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3\r\n#define GL_SHADER_STORAGE_BUFFER_START 0x90D4\r\n#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5\r\n#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6\r\n#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7\r\n#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8\r\n#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9\r\n#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA\r\n#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB\r\n#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC\r\n#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD\r\n#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE\r\n#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\r\n\r\n#define glShaderStorageBlockBinding GLEW_GET_FUN(__glewShaderStorageBlockBinding)\r\n\r\n#define GLEW_ARB_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_ARB_shader_storage_buffer_object)\r\n\r\n#endif /* GL_ARB_shader_storage_buffer_object */\r\n\r\n/* ------------------------ GL_ARB_shader_subroutine ----------------------- */\r\n\r\n#ifndef GL_ARB_shader_subroutine\r\n#define GL_ARB_shader_subroutine 1\r\n\r\n#define GL_ACTIVE_SUBROUTINES 0x8DE5\r\n#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6\r\n#define GL_MAX_SUBROUTINES 0x8DE7\r\n#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8\r\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47\r\n#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48\r\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49\r\n#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A\r\n#define GL_COMPATIBLE_SUBROUTINES 0x8E4B\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint* values);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar* name);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint* indices);\r\n\r\n#define glGetActiveSubroutineName GLEW_GET_FUN(__glewGetActiveSubroutineName)\r\n#define glGetActiveSubroutineUniformName GLEW_GET_FUN(__glewGetActiveSubroutineUniformName)\r\n#define glGetActiveSubroutineUniformiv GLEW_GET_FUN(__glewGetActiveSubroutineUniformiv)\r\n#define glGetProgramStageiv GLEW_GET_FUN(__glewGetProgramStageiv)\r\n#define glGetSubroutineIndex GLEW_GET_FUN(__glewGetSubroutineIndex)\r\n#define glGetSubroutineUniformLocation GLEW_GET_FUN(__glewGetSubroutineUniformLocation)\r\n#define glGetUniformSubroutineuiv GLEW_GET_FUN(__glewGetUniformSubroutineuiv)\r\n#define glUniformSubroutinesuiv GLEW_GET_FUN(__glewUniformSubroutinesuiv)\r\n\r\n#define GLEW_ARB_shader_subroutine GLEW_GET_VAR(__GLEW_ARB_shader_subroutine)\r\n\r\n#endif /* GL_ARB_shader_subroutine */\r\n\r\n/* ----------------------- GL_ARB_shader_texture_lod ----------------------- */\r\n\r\n#ifndef GL_ARB_shader_texture_lod\r\n#define GL_ARB_shader_texture_lod 1\r\n\r\n#define GLEW_ARB_shader_texture_lod GLEW_GET_VAR(__GLEW_ARB_shader_texture_lod)\r\n\r\n#endif /* GL_ARB_shader_texture_lod */\r\n\r\n/* ---------------------- GL_ARB_shading_language_100 ---------------------- */\r\n\r\n#ifndef GL_ARB_shading_language_100\r\n#define GL_ARB_shading_language_100 1\r\n\r\n#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C\r\n\r\n#define GLEW_ARB_shading_language_100 GLEW_GET_VAR(__GLEW_ARB_shading_language_100)\r\n\r\n#endif /* GL_ARB_shading_language_100 */\r\n\r\n/* -------------------- GL_ARB_shading_language_420pack -------------------- */\r\n\r\n#ifndef GL_ARB_shading_language_420pack\r\n#define GL_ARB_shading_language_420pack 1\r\n\r\n#define GLEW_ARB_shading_language_420pack GLEW_GET_VAR(__GLEW_ARB_shading_language_420pack)\r\n\r\n#endif /* GL_ARB_shading_language_420pack */\r\n\r\n/* -------------------- GL_ARB_shading_language_include -------------------- */\r\n\r\n#ifndef GL_ARB_shading_language_include\r\n#define GL_ARB_shading_language_include 1\r\n\r\n#define GL_SHADER_INCLUDE_ARB 0x8DAE\r\n#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9\r\n#define GL_NAMED_STRING_TYPE_ARB 0x8DEA\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar ** path, const GLint *length);\r\ntypedef void (GLAPIENTRY * PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name, GLsizei bufSize, GLint *stringlen, GLchar *string);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar* name, GLenum pname, GLint *params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar* name, GLint stringlen, const GLchar *string);\r\n\r\n#define glCompileShaderIncludeARB GLEW_GET_FUN(__glewCompileShaderIncludeARB)\r\n#define glDeleteNamedStringARB GLEW_GET_FUN(__glewDeleteNamedStringARB)\r\n#define glGetNamedStringARB GLEW_GET_FUN(__glewGetNamedStringARB)\r\n#define glGetNamedStringivARB GLEW_GET_FUN(__glewGetNamedStringivARB)\r\n#define glIsNamedStringARB GLEW_GET_FUN(__glewIsNamedStringARB)\r\n#define glNamedStringARB GLEW_GET_FUN(__glewNamedStringARB)\r\n\r\n#define GLEW_ARB_shading_language_include GLEW_GET_VAR(__GLEW_ARB_shading_language_include)\r\n\r\n#endif /* GL_ARB_shading_language_include */\r\n\r\n/* -------------------- GL_ARB_shading_language_packing -------------------- */\r\n\r\n#ifndef GL_ARB_shading_language_packing\r\n#define GL_ARB_shading_language_packing 1\r\n\r\n#define GLEW_ARB_shading_language_packing GLEW_GET_VAR(__GLEW_ARB_shading_language_packing)\r\n\r\n#endif /* GL_ARB_shading_language_packing */\r\n\r\n/* ----------------------------- GL_ARB_shadow ----------------------------- */\r\n\r\n#ifndef GL_ARB_shadow\r\n#define GL_ARB_shadow 1\r\n\r\n#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C\r\n#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D\r\n#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E\r\n\r\n#define GLEW_ARB_shadow GLEW_GET_VAR(__GLEW_ARB_shadow)\r\n\r\n#endif /* GL_ARB_shadow */\r\n\r\n/* ------------------------- GL_ARB_shadow_ambient ------------------------- */\r\n\r\n#ifndef GL_ARB_shadow_ambient\r\n#define GL_ARB_shadow_ambient 1\r\n\r\n#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF\r\n\r\n#define GLEW_ARB_shadow_ambient GLEW_GET_VAR(__GLEW_ARB_shadow_ambient)\r\n\r\n#endif /* GL_ARB_shadow_ambient */\r\n\r\n/* ------------------------ GL_ARB_stencil_texturing ----------------------- */\r\n\r\n#ifndef GL_ARB_stencil_texturing\r\n#define GL_ARB_stencil_texturing 1\r\n\r\n#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA\r\n\r\n#define GLEW_ARB_stencil_texturing GLEW_GET_VAR(__GLEW_ARB_stencil_texturing)\r\n\r\n#endif /* GL_ARB_stencil_texturing */\r\n\r\n/* ------------------------------ GL_ARB_sync ------------------------------ */\r\n\r\n#ifndef GL_ARB_sync\r\n#define GL_ARB_sync 1\r\n\r\n#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001\r\n#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111\r\n#define GL_OBJECT_TYPE 0x9112\r\n#define GL_SYNC_CONDITION 0x9113\r\n#define GL_SYNC_STATUS 0x9114\r\n#define GL_SYNC_FLAGS 0x9115\r\n#define GL_SYNC_FENCE 0x9116\r\n#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117\r\n#define GL_UNSIGNALED 0x9118\r\n#define GL_SIGNALED 0x9119\r\n#define GL_ALREADY_SIGNALED 0x911A\r\n#define GL_TIMEOUT_EXPIRED 0x911B\r\n#define GL_CONDITION_SATISFIED 0x911C\r\n#define GL_WAIT_FAILED 0x911D\r\n#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF\r\n\r\ntypedef GLenum (GLAPIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout);\r\ntypedef void (GLAPIENTRY * PFNGLDELETESYNCPROC) (GLsync GLsync);\r\ntypedef GLsync (GLAPIENTRY * PFNGLFENCESYNCPROC) (GLenum condition,GLbitfield flags);\r\ntypedef void (GLAPIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSYNCIVPROC) (GLsync GLsync,GLenum pname,GLsizei bufSize,GLsizei* length, GLint *values);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISSYNCPROC) (GLsync GLsync);\r\ntypedef void (GLAPIENTRY * PFNGLWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout);\r\n\r\n#define glClientWaitSync GLEW_GET_FUN(__glewClientWaitSync)\r\n#define glDeleteSync GLEW_GET_FUN(__glewDeleteSync)\r\n#define glFenceSync GLEW_GET_FUN(__glewFenceSync)\r\n#define glGetInteger64v GLEW_GET_FUN(__glewGetInteger64v)\r\n#define glGetSynciv GLEW_GET_FUN(__glewGetSynciv)\r\n#define glIsSync GLEW_GET_FUN(__glewIsSync)\r\n#define glWaitSync GLEW_GET_FUN(__glewWaitSync)\r\n\r\n#define GLEW_ARB_sync GLEW_GET_VAR(__GLEW_ARB_sync)\r\n\r\n#endif /* GL_ARB_sync */\r\n\r\n/* ----------------------- GL_ARB_tessellation_shader ---------------------- */\r\n\r\n#ifndef GL_ARB_tessellation_shader\r\n#define GL_ARB_tessellation_shader 1\r\n\r\n#define GL_PATCHES 0xE\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1\r\n#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C\r\n#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D\r\n#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E\r\n#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F\r\n#define GL_PATCH_VERTICES 0x8E72\r\n#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73\r\n#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74\r\n#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75\r\n#define GL_TESS_GEN_MODE 0x8E76\r\n#define GL_TESS_GEN_SPACING 0x8E77\r\n#define GL_TESS_GEN_VERTEX_ORDER 0x8E78\r\n#define GL_TESS_GEN_POINT_MODE 0x8E79\r\n#define GL_ISOLINES 0x8E7A\r\n#define GL_FRACTIONAL_ODD 0x8E7B\r\n#define GL_FRACTIONAL_EVEN 0x8E7C\r\n#define GL_MAX_PATCH_VERTICES 0x8E7D\r\n#define GL_MAX_TESS_GEN_LEVEL 0x8E7E\r\n#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F\r\n#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80\r\n#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81\r\n#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82\r\n#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83\r\n#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84\r\n#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85\r\n#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86\r\n#define GL_TESS_EVALUATION_SHADER 0x8E87\r\n#define GL_TESS_CONTROL_SHADER 0x8E88\r\n#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89\r\n#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat* values);\r\ntypedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);\r\n\r\n#define glPatchParameterfv GLEW_GET_FUN(__glewPatchParameterfv)\r\n#define glPatchParameteri GLEW_GET_FUN(__glewPatchParameteri)\r\n\r\n#define GLEW_ARB_tessellation_shader GLEW_GET_VAR(__GLEW_ARB_tessellation_shader)\r\n\r\n#endif /* GL_ARB_tessellation_shader */\r\n\r\n/* ---------------------- GL_ARB_texture_border_clamp ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_border_clamp\r\n#define GL_ARB_texture_border_clamp 1\r\n\r\n#define GL_CLAMP_TO_BORDER_ARB 0x812D\r\n\r\n#define GLEW_ARB_texture_border_clamp GLEW_GET_VAR(__GLEW_ARB_texture_border_clamp)\r\n\r\n#endif /* GL_ARB_texture_border_clamp */\r\n\r\n/* ---------------------- GL_ARB_texture_buffer_object --------------------- */\r\n\r\n#ifndef GL_ARB_texture_buffer_object\r\n#define GL_ARB_texture_buffer_object 1\r\n\r\n#define GL_TEXTURE_BUFFER_ARB 0x8C2A\r\n#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B\r\n#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C\r\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D\r\n#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);\r\n\r\n#define glTexBufferARB GLEW_GET_FUN(__glewTexBufferARB)\r\n\r\n#define GLEW_ARB_texture_buffer_object GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object)\r\n\r\n#endif /* GL_ARB_texture_buffer_object */\r\n\r\n/* ------------------- GL_ARB_texture_buffer_object_rgb32 ------------------ */\r\n\r\n#ifndef GL_ARB_texture_buffer_object_rgb32\r\n#define GL_ARB_texture_buffer_object_rgb32 1\r\n\r\n#define GLEW_ARB_texture_buffer_object_rgb32 GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object_rgb32)\r\n\r\n#endif /* GL_ARB_texture_buffer_object_rgb32 */\r\n\r\n/* ---------------------- GL_ARB_texture_buffer_range ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_buffer_range\r\n#define GL_ARB_texture_buffer_range 1\r\n\r\n#define GL_TEXTURE_BUFFER_OFFSET 0x919D\r\n#define GL_TEXTURE_BUFFER_SIZE 0x919E\r\n#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\n\r\n#define glTexBufferRange GLEW_GET_FUN(__glewTexBufferRange)\r\n#define glTextureBufferRangeEXT GLEW_GET_FUN(__glewTextureBufferRangeEXT)\r\n\r\n#define GLEW_ARB_texture_buffer_range GLEW_GET_VAR(__GLEW_ARB_texture_buffer_range)\r\n\r\n#endif /* GL_ARB_texture_buffer_range */\r\n\r\n/* ----------------------- GL_ARB_texture_compression ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_compression\r\n#define GL_ARB_texture_compression 1\r\n\r\n#define GL_COMPRESSED_ALPHA_ARB 0x84E9\r\n#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB\r\n#define GL_COMPRESSED_INTENSITY_ARB 0x84EC\r\n#define GL_COMPRESSED_RGB_ARB 0x84ED\r\n#define GL_COMPRESSED_RGBA_ARB 0x84EE\r\n#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF\r\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0\r\n#define GL_TEXTURE_COMPRESSED_ARB 0x86A1\r\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2\r\n#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, void* img);\r\n\r\n#define glCompressedTexImage1DARB GLEW_GET_FUN(__glewCompressedTexImage1DARB)\r\n#define glCompressedTexImage2DARB GLEW_GET_FUN(__glewCompressedTexImage2DARB)\r\n#define glCompressedTexImage3DARB GLEW_GET_FUN(__glewCompressedTexImage3DARB)\r\n#define glCompressedTexSubImage1DARB GLEW_GET_FUN(__glewCompressedTexSubImage1DARB)\r\n#define glCompressedTexSubImage2DARB GLEW_GET_FUN(__glewCompressedTexSubImage2DARB)\r\n#define glCompressedTexSubImage3DARB GLEW_GET_FUN(__glewCompressedTexSubImage3DARB)\r\n#define glGetCompressedTexImageARB GLEW_GET_FUN(__glewGetCompressedTexImageARB)\r\n\r\n#define GLEW_ARB_texture_compression GLEW_GET_VAR(__GLEW_ARB_texture_compression)\r\n\r\n#endif /* GL_ARB_texture_compression */\r\n\r\n/* -------------------- GL_ARB_texture_compression_bptc -------------------- */\r\n\r\n#ifndef GL_ARB_texture_compression_bptc\r\n#define GL_ARB_texture_compression_bptc 1\r\n\r\n#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C\r\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D\r\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E\r\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F\r\n\r\n#define GLEW_ARB_texture_compression_bptc GLEW_GET_VAR(__GLEW_ARB_texture_compression_bptc)\r\n\r\n#endif /* GL_ARB_texture_compression_bptc */\r\n\r\n/* -------------------- GL_ARB_texture_compression_rgtc -------------------- */\r\n\r\n#ifndef GL_ARB_texture_compression_rgtc\r\n#define GL_ARB_texture_compression_rgtc 1\r\n\r\n#define GL_COMPRESSED_RED_RGTC1 0x8DBB\r\n#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC\r\n#define GL_COMPRESSED_RG_RGTC2 0x8DBD\r\n#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE\r\n\r\n#define GLEW_ARB_texture_compression_rgtc GLEW_GET_VAR(__GLEW_ARB_texture_compression_rgtc)\r\n\r\n#endif /* GL_ARB_texture_compression_rgtc */\r\n\r\n/* ------------------------ GL_ARB_texture_cube_map ------------------------ */\r\n\r\n#ifndef GL_ARB_texture_cube_map\r\n#define GL_ARB_texture_cube_map 1\r\n\r\n#define GL_NORMAL_MAP_ARB 0x8511\r\n#define GL_REFLECTION_MAP_ARB 0x8512\r\n#define GL_TEXTURE_CUBE_MAP_ARB 0x8513\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B\r\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C\r\n\r\n#define GLEW_ARB_texture_cube_map GLEW_GET_VAR(__GLEW_ARB_texture_cube_map)\r\n\r\n#endif /* GL_ARB_texture_cube_map */\r\n\r\n/* --------------------- GL_ARB_texture_cube_map_array --------------------- */\r\n\r\n#ifndef GL_ARB_texture_cube_map_array\r\n#define GL_ARB_texture_cube_map_array 1\r\n\r\n#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D\r\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F\r\n\r\n#define GLEW_ARB_texture_cube_map_array GLEW_GET_VAR(__GLEW_ARB_texture_cube_map_array)\r\n\r\n#endif /* GL_ARB_texture_cube_map_array */\r\n\r\n/* ------------------------- GL_ARB_texture_env_add ------------------------ */\r\n\r\n#ifndef GL_ARB_texture_env_add\r\n#define GL_ARB_texture_env_add 1\r\n\r\n#define GLEW_ARB_texture_env_add GLEW_GET_VAR(__GLEW_ARB_texture_env_add)\r\n\r\n#endif /* GL_ARB_texture_env_add */\r\n\r\n/* ----------------------- GL_ARB_texture_env_combine ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_env_combine\r\n#define GL_ARB_texture_env_combine 1\r\n\r\n#define GL_SUBTRACT_ARB 0x84E7\r\n#define GL_COMBINE_ARB 0x8570\r\n#define GL_COMBINE_RGB_ARB 0x8571\r\n#define GL_COMBINE_ALPHA_ARB 0x8572\r\n#define GL_RGB_SCALE_ARB 0x8573\r\n#define GL_ADD_SIGNED_ARB 0x8574\r\n#define GL_INTERPOLATE_ARB 0x8575\r\n#define GL_CONSTANT_ARB 0x8576\r\n#define GL_PRIMARY_COLOR_ARB 0x8577\r\n#define GL_PREVIOUS_ARB 0x8578\r\n#define GL_SOURCE0_RGB_ARB 0x8580\r\n#define GL_SOURCE1_RGB_ARB 0x8581\r\n#define GL_SOURCE2_RGB_ARB 0x8582\r\n#define GL_SOURCE0_ALPHA_ARB 0x8588\r\n#define GL_SOURCE1_ALPHA_ARB 0x8589\r\n#define GL_SOURCE2_ALPHA_ARB 0x858A\r\n#define GL_OPERAND0_RGB_ARB 0x8590\r\n#define GL_OPERAND1_RGB_ARB 0x8591\r\n#define GL_OPERAND2_RGB_ARB 0x8592\r\n#define GL_OPERAND0_ALPHA_ARB 0x8598\r\n#define GL_OPERAND1_ALPHA_ARB 0x8599\r\n#define GL_OPERAND2_ALPHA_ARB 0x859A\r\n\r\n#define GLEW_ARB_texture_env_combine GLEW_GET_VAR(__GLEW_ARB_texture_env_combine)\r\n\r\n#endif /* GL_ARB_texture_env_combine */\r\n\r\n/* ---------------------- GL_ARB_texture_env_crossbar ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_env_crossbar\r\n#define GL_ARB_texture_env_crossbar 1\r\n\r\n#define GLEW_ARB_texture_env_crossbar GLEW_GET_VAR(__GLEW_ARB_texture_env_crossbar)\r\n\r\n#endif /* GL_ARB_texture_env_crossbar */\r\n\r\n/* ------------------------ GL_ARB_texture_env_dot3 ------------------------ */\r\n\r\n#ifndef GL_ARB_texture_env_dot3\r\n#define GL_ARB_texture_env_dot3 1\r\n\r\n#define GL_DOT3_RGB_ARB 0x86AE\r\n#define GL_DOT3_RGBA_ARB 0x86AF\r\n\r\n#define GLEW_ARB_texture_env_dot3 GLEW_GET_VAR(__GLEW_ARB_texture_env_dot3)\r\n\r\n#endif /* GL_ARB_texture_env_dot3 */\r\n\r\n/* -------------------------- GL_ARB_texture_float ------------------------- */\r\n\r\n#ifndef GL_ARB_texture_float\r\n#define GL_ARB_texture_float 1\r\n\r\n#define GL_RGBA32F_ARB 0x8814\r\n#define GL_RGB32F_ARB 0x8815\r\n#define GL_ALPHA32F_ARB 0x8816\r\n#define GL_INTENSITY32F_ARB 0x8817\r\n#define GL_LUMINANCE32F_ARB 0x8818\r\n#define GL_LUMINANCE_ALPHA32F_ARB 0x8819\r\n#define GL_RGBA16F_ARB 0x881A\r\n#define GL_RGB16F_ARB 0x881B\r\n#define GL_ALPHA16F_ARB 0x881C\r\n#define GL_INTENSITY16F_ARB 0x881D\r\n#define GL_LUMINANCE16F_ARB 0x881E\r\n#define GL_LUMINANCE_ALPHA16F_ARB 0x881F\r\n#define GL_TEXTURE_RED_TYPE_ARB 0x8C10\r\n#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11\r\n#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12\r\n#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13\r\n#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14\r\n#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15\r\n#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16\r\n#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17\r\n\r\n#define GLEW_ARB_texture_float GLEW_GET_VAR(__GLEW_ARB_texture_float)\r\n\r\n#endif /* GL_ARB_texture_float */\r\n\r\n/* ------------------------- GL_ARB_texture_gather ------------------------- */\r\n\r\n#ifndef GL_ARB_texture_gather\r\n#define GL_ARB_texture_gather 1\r\n\r\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F\r\n\r\n#define GLEW_ARB_texture_gather GLEW_GET_VAR(__GLEW_ARB_texture_gather)\r\n\r\n#endif /* GL_ARB_texture_gather */\r\n\r\n/* --------------------- GL_ARB_texture_mirrored_repeat -------------------- */\r\n\r\n#ifndef GL_ARB_texture_mirrored_repeat\r\n#define GL_ARB_texture_mirrored_repeat 1\r\n\r\n#define GL_MIRRORED_REPEAT_ARB 0x8370\r\n\r\n#define GLEW_ARB_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_ARB_texture_mirrored_repeat)\r\n\r\n#endif /* GL_ARB_texture_mirrored_repeat */\r\n\r\n/* ----------------------- GL_ARB_texture_multisample ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_multisample\r\n#define GL_ARB_texture_multisample 1\r\n\r\n#define GL_SAMPLE_POSITION 0x8E50\r\n#define GL_SAMPLE_MASK 0x8E51\r\n#define GL_SAMPLE_MASK_VALUE 0x8E52\r\n#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59\r\n#define GL_TEXTURE_2D_MULTISAMPLE 0x9100\r\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101\r\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102\r\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103\r\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104\r\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105\r\n#define GL_TEXTURE_SAMPLES 0x9106\r\n#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107\r\n#define GL_SAMPLER_2D_MULTISAMPLE 0x9108\r\n#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A\r\n#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B\r\n#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D\r\n#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E\r\n#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F\r\n#define GL_MAX_INTEGER_SAMPLES 0x9110\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat* val);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\n\r\n#define glGetMultisamplefv GLEW_GET_FUN(__glewGetMultisamplefv)\r\n#define glSampleMaski GLEW_GET_FUN(__glewSampleMaski)\r\n#define glTexImage2DMultisample GLEW_GET_FUN(__glewTexImage2DMultisample)\r\n#define glTexImage3DMultisample GLEW_GET_FUN(__glewTexImage3DMultisample)\r\n\r\n#define GLEW_ARB_texture_multisample GLEW_GET_VAR(__GLEW_ARB_texture_multisample)\r\n\r\n#endif /* GL_ARB_texture_multisample */\r\n\r\n/* -------------------- GL_ARB_texture_non_power_of_two -------------------- */\r\n\r\n#ifndef GL_ARB_texture_non_power_of_two\r\n#define GL_ARB_texture_non_power_of_two 1\r\n\r\n#define GLEW_ARB_texture_non_power_of_two GLEW_GET_VAR(__GLEW_ARB_texture_non_power_of_two)\r\n\r\n#endif /* GL_ARB_texture_non_power_of_two */\r\n\r\n/* ---------------------- GL_ARB_texture_query_levels ---------------------- */\r\n\r\n#ifndef GL_ARB_texture_query_levels\r\n#define GL_ARB_texture_query_levels 1\r\n\r\n#define GLEW_ARB_texture_query_levels GLEW_GET_VAR(__GLEW_ARB_texture_query_levels)\r\n\r\n#endif /* GL_ARB_texture_query_levels */\r\n\r\n/* ------------------------ GL_ARB_texture_query_lod ----------------------- */\r\n\r\n#ifndef GL_ARB_texture_query_lod\r\n#define GL_ARB_texture_query_lod 1\r\n\r\n#define GLEW_ARB_texture_query_lod GLEW_GET_VAR(__GLEW_ARB_texture_query_lod)\r\n\r\n#endif /* GL_ARB_texture_query_lod */\r\n\r\n/* ------------------------ GL_ARB_texture_rectangle ----------------------- */\r\n\r\n#ifndef GL_ARB_texture_rectangle\r\n#define GL_ARB_texture_rectangle 1\r\n\r\n#define GL_TEXTURE_RECTANGLE_ARB 0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8\r\n#define GL_SAMPLER_2D_RECT_ARB 0x8B63\r\n#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64\r\n\r\n#define GLEW_ARB_texture_rectangle GLEW_GET_VAR(__GLEW_ARB_texture_rectangle)\r\n\r\n#endif /* GL_ARB_texture_rectangle */\r\n\r\n/* --------------------------- GL_ARB_texture_rg --------------------------- */\r\n\r\n#ifndef GL_ARB_texture_rg\r\n#define GL_ARB_texture_rg 1\r\n\r\n#define GL_COMPRESSED_RED 0x8225\r\n#define GL_COMPRESSED_RG 0x8226\r\n#define GL_RG 0x8227\r\n#define GL_RG_INTEGER 0x8228\r\n#define GL_R8 0x8229\r\n#define GL_R16 0x822A\r\n#define GL_RG8 0x822B\r\n#define GL_RG16 0x822C\r\n#define GL_R16F 0x822D\r\n#define GL_R32F 0x822E\r\n#define GL_RG16F 0x822F\r\n#define GL_RG32F 0x8230\r\n#define GL_R8I 0x8231\r\n#define GL_R8UI 0x8232\r\n#define GL_R16I 0x8233\r\n#define GL_R16UI 0x8234\r\n#define GL_R32I 0x8235\r\n#define GL_R32UI 0x8236\r\n#define GL_RG8I 0x8237\r\n#define GL_RG8UI 0x8238\r\n#define GL_RG16I 0x8239\r\n#define GL_RG16UI 0x823A\r\n#define GL_RG32I 0x823B\r\n#define GL_RG32UI 0x823C\r\n\r\n#define GLEW_ARB_texture_rg GLEW_GET_VAR(__GLEW_ARB_texture_rg)\r\n\r\n#endif /* GL_ARB_texture_rg */\r\n\r\n/* ----------------------- GL_ARB_texture_rgb10_a2ui ----------------------- */\r\n\r\n#ifndef GL_ARB_texture_rgb10_a2ui\r\n#define GL_ARB_texture_rgb10_a2ui 1\r\n\r\n#define GL_RGB10_A2UI 0x906F\r\n\r\n#define GLEW_ARB_texture_rgb10_a2ui GLEW_GET_VAR(__GLEW_ARB_texture_rgb10_a2ui)\r\n\r\n#endif /* GL_ARB_texture_rgb10_a2ui */\r\n\r\n/* ------------------------- GL_ARB_texture_storage ------------------------ */\r\n\r\n#ifndef GL_ARB_texture_storage\r\n#define GL_ARB_texture_storage 1\r\n\r\n#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\r\n\r\n#define glTexStorage1D GLEW_GET_FUN(__glewTexStorage1D)\r\n#define glTexStorage2D GLEW_GET_FUN(__glewTexStorage2D)\r\n#define glTexStorage3D GLEW_GET_FUN(__glewTexStorage3D)\r\n#define glTextureStorage1DEXT GLEW_GET_FUN(__glewTextureStorage1DEXT)\r\n#define glTextureStorage2DEXT GLEW_GET_FUN(__glewTextureStorage2DEXT)\r\n#define glTextureStorage3DEXT GLEW_GET_FUN(__glewTextureStorage3DEXT)\r\n\r\n#define GLEW_ARB_texture_storage GLEW_GET_VAR(__GLEW_ARB_texture_storage)\r\n\r\n#endif /* GL_ARB_texture_storage */\r\n\r\n/* ------------------- GL_ARB_texture_storage_multisample ------------------ */\r\n\r\n#ifndef GL_ARB_texture_storage_multisample\r\n#define GL_ARB_texture_storage_multisample 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\n\r\n#define glTexStorage2DMultisample GLEW_GET_FUN(__glewTexStorage2DMultisample)\r\n#define glTexStorage3DMultisample GLEW_GET_FUN(__glewTexStorage3DMultisample)\r\n#define glTextureStorage2DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage2DMultisampleEXT)\r\n#define glTextureStorage3DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage3DMultisampleEXT)\r\n\r\n#define GLEW_ARB_texture_storage_multisample GLEW_GET_VAR(__GLEW_ARB_texture_storage_multisample)\r\n\r\n#endif /* GL_ARB_texture_storage_multisample */\r\n\r\n/* ------------------------- GL_ARB_texture_swizzle ------------------------ */\r\n\r\n#ifndef GL_ARB_texture_swizzle\r\n#define GL_ARB_texture_swizzle 1\r\n\r\n#define GL_TEXTURE_SWIZZLE_R 0x8E42\r\n#define GL_TEXTURE_SWIZZLE_G 0x8E43\r\n#define GL_TEXTURE_SWIZZLE_B 0x8E44\r\n#define GL_TEXTURE_SWIZZLE_A 0x8E45\r\n#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46\r\n\r\n#define GLEW_ARB_texture_swizzle GLEW_GET_VAR(__GLEW_ARB_texture_swizzle)\r\n\r\n#endif /* GL_ARB_texture_swizzle */\r\n\r\n/* -------------------------- GL_ARB_texture_view -------------------------- */\r\n\r\n#ifndef GL_ARB_texture_view\r\n#define GL_ARB_texture_view 1\r\n\r\n#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB\r\n#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC\r\n#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD\r\n#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE\r\n#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\r\n\r\n#define glTextureView GLEW_GET_FUN(__glewTextureView)\r\n\r\n#define GLEW_ARB_texture_view GLEW_GET_VAR(__GLEW_ARB_texture_view)\r\n\r\n#endif /* GL_ARB_texture_view */\r\n\r\n/* --------------------------- GL_ARB_timer_query -------------------------- */\r\n\r\n#ifndef GL_ARB_timer_query\r\n#define GL_ARB_timer_query 1\r\n\r\n#define GL_TIME_ELAPSED 0x88BF\r\n#define GL_TIMESTAMP 0x8E28\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64* params);\r\ntypedef void (GLAPIENTRY * PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);\r\n\r\n#define glGetQueryObjecti64v GLEW_GET_FUN(__glewGetQueryObjecti64v)\r\n#define glGetQueryObjectui64v GLEW_GET_FUN(__glewGetQueryObjectui64v)\r\n#define glQueryCounter GLEW_GET_FUN(__glewQueryCounter)\r\n\r\n#define GLEW_ARB_timer_query GLEW_GET_VAR(__GLEW_ARB_timer_query)\r\n\r\n#endif /* GL_ARB_timer_query */\r\n\r\n/* ----------------------- GL_ARB_transform_feedback2 ---------------------- */\r\n\r\n#ifndef GL_ARB_transform_feedback2\r\n#define GL_ARB_transform_feedback2 1\r\n\r\n#define GL_TRANSFORM_FEEDBACK 0x8E22\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24\r\n#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);\r\n\r\n#define glBindTransformFeedback GLEW_GET_FUN(__glewBindTransformFeedback)\r\n#define glDeleteTransformFeedbacks GLEW_GET_FUN(__glewDeleteTransformFeedbacks)\r\n#define glDrawTransformFeedback GLEW_GET_FUN(__glewDrawTransformFeedback)\r\n#define glGenTransformFeedbacks GLEW_GET_FUN(__glewGenTransformFeedbacks)\r\n#define glIsTransformFeedback GLEW_GET_FUN(__glewIsTransformFeedback)\r\n#define glPauseTransformFeedback GLEW_GET_FUN(__glewPauseTransformFeedback)\r\n#define glResumeTransformFeedback GLEW_GET_FUN(__glewResumeTransformFeedback)\r\n\r\n#define GLEW_ARB_transform_feedback2 GLEW_GET_VAR(__GLEW_ARB_transform_feedback2)\r\n\r\n#endif /* GL_ARB_transform_feedback2 */\r\n\r\n/* ----------------------- GL_ARB_transform_feedback3 ---------------------- */\r\n\r\n#ifndef GL_ARB_transform_feedback3\r\n#define GL_ARB_transform_feedback3 1\r\n\r\n#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70\r\n#define GL_MAX_VERTEX_STREAMS 0x8E71\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);\r\ntypedef void (GLAPIENTRY * PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params);\r\n\r\n#define glBeginQueryIndexed GLEW_GET_FUN(__glewBeginQueryIndexed)\r\n#define glDrawTransformFeedbackStream GLEW_GET_FUN(__glewDrawTransformFeedbackStream)\r\n#define glEndQueryIndexed GLEW_GET_FUN(__glewEndQueryIndexed)\r\n#define glGetQueryIndexediv GLEW_GET_FUN(__glewGetQueryIndexediv)\r\n\r\n#define GLEW_ARB_transform_feedback3 GLEW_GET_VAR(__GLEW_ARB_transform_feedback3)\r\n\r\n#endif /* GL_ARB_transform_feedback3 */\r\n\r\n/* ------------------ GL_ARB_transform_feedback_instanced ------------------ */\r\n\r\n#ifndef GL_ARB_transform_feedback_instanced\r\n#define GL_ARB_transform_feedback_instanced 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);\r\n\r\n#define glDrawTransformFeedbackInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackInstanced)\r\n#define glDrawTransformFeedbackStreamInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackStreamInstanced)\r\n\r\n#define GLEW_ARB_transform_feedback_instanced GLEW_GET_VAR(__GLEW_ARB_transform_feedback_instanced)\r\n\r\n#endif /* GL_ARB_transform_feedback_instanced */\r\n\r\n/* ------------------------ GL_ARB_transpose_matrix ------------------------ */\r\n\r\n#ifndef GL_ARB_transpose_matrix\r\n#define GL_ARB_transpose_matrix 1\r\n\r\n#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3\r\n#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4\r\n#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5\r\n#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6\r\n\r\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]);\r\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]);\r\n\r\n#define glLoadTransposeMatrixdARB GLEW_GET_FUN(__glewLoadTransposeMatrixdARB)\r\n#define glLoadTransposeMatrixfARB GLEW_GET_FUN(__glewLoadTransposeMatrixfARB)\r\n#define glMultTransposeMatrixdARB GLEW_GET_FUN(__glewMultTransposeMatrixdARB)\r\n#define glMultTransposeMatrixfARB GLEW_GET_FUN(__glewMultTransposeMatrixfARB)\r\n\r\n#define GLEW_ARB_transpose_matrix GLEW_GET_VAR(__GLEW_ARB_transpose_matrix)\r\n\r\n#endif /* GL_ARB_transpose_matrix */\r\n\r\n/* ---------------------- GL_ARB_uniform_buffer_object --------------------- */\r\n\r\n#ifndef GL_ARB_uniform_buffer_object\r\n#define GL_ARB_uniform_buffer_object 1\r\n\r\n#define GL_UNIFORM_BUFFER 0x8A11\r\n#define GL_UNIFORM_BUFFER_BINDING 0x8A28\r\n#define GL_UNIFORM_BUFFER_START 0x8A29\r\n#define GL_UNIFORM_BUFFER_SIZE 0x8A2A\r\n#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B\r\n#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C\r\n#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D\r\n#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E\r\n#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F\r\n#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30\r\n#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31\r\n#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32\r\n#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33\r\n#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34\r\n#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35\r\n#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36\r\n#define GL_UNIFORM_TYPE 0x8A37\r\n#define GL_UNIFORM_SIZE 0x8A38\r\n#define GL_UNIFORM_NAME_LENGTH 0x8A39\r\n#define GL_UNIFORM_BLOCK_INDEX 0x8A3A\r\n#define GL_UNIFORM_OFFSET 0x8A3B\r\n#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C\r\n#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D\r\n#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E\r\n#define GL_UNIFORM_BLOCK_BINDING 0x8A3F\r\n#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40\r\n#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41\r\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42\r\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46\r\n#define GL_INVALID_INDEX 0xFFFFFFFF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint* data);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar** uniformNames, GLuint* uniformIndices);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\r\n\r\n#define glBindBufferBase GLEW_GET_FUN(__glewBindBufferBase)\r\n#define glBindBufferRange GLEW_GET_FUN(__glewBindBufferRange)\r\n#define glGetActiveUniformBlockName GLEW_GET_FUN(__glewGetActiveUniformBlockName)\r\n#define glGetActiveUniformBlockiv GLEW_GET_FUN(__glewGetActiveUniformBlockiv)\r\n#define glGetActiveUniformName GLEW_GET_FUN(__glewGetActiveUniformName)\r\n#define glGetActiveUniformsiv GLEW_GET_FUN(__glewGetActiveUniformsiv)\r\n#define glGetIntegeri_v GLEW_GET_FUN(__glewGetIntegeri_v)\r\n#define glGetUniformBlockIndex GLEW_GET_FUN(__glewGetUniformBlockIndex)\r\n#define glGetUniformIndices GLEW_GET_FUN(__glewGetUniformIndices)\r\n#define glUniformBlockBinding GLEW_GET_FUN(__glewUniformBlockBinding)\r\n\r\n#define GLEW_ARB_uniform_buffer_object GLEW_GET_VAR(__GLEW_ARB_uniform_buffer_object)\r\n\r\n#endif /* GL_ARB_uniform_buffer_object */\r\n\r\n/* ------------------------ GL_ARB_vertex_array_bgra ----------------------- */\r\n\r\n#ifndef GL_ARB_vertex_array_bgra\r\n#define GL_ARB_vertex_array_bgra 1\r\n\r\n#define GL_BGRA 0x80E1\r\n\r\n#define GLEW_ARB_vertex_array_bgra GLEW_GET_VAR(__GLEW_ARB_vertex_array_bgra)\r\n\r\n#endif /* GL_ARB_vertex_array_bgra */\r\n\r\n/* ----------------------- GL_ARB_vertex_array_object ---------------------- */\r\n\r\n#ifndef GL_ARB_vertex_array_object\r\n#define GL_ARB_vertex_array_object 1\r\n\r\n#define GL_VERTEX_ARRAY_BINDING 0x85B5\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays);\r\ntypedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYPROC) (GLuint array);\r\n\r\n#define glBindVertexArray GLEW_GET_FUN(__glewBindVertexArray)\r\n#define glDeleteVertexArrays GLEW_GET_FUN(__glewDeleteVertexArrays)\r\n#define glGenVertexArrays GLEW_GET_FUN(__glewGenVertexArrays)\r\n#define glIsVertexArray GLEW_GET_FUN(__glewIsVertexArray)\r\n\r\n#define GLEW_ARB_vertex_array_object GLEW_GET_VAR(__GLEW_ARB_vertex_array_object)\r\n\r\n#endif /* GL_ARB_vertex_array_object */\r\n\r\n/* ----------------------- GL_ARB_vertex_attrib_64bit ---------------------- */\r\n\r\n#ifndef GL_ARB_vertex_attrib_64bit\r\n#define GL_ARB_vertex_attrib_64bit 1\r\n\r\n#define GL_DOUBLE_MAT2 0x8F46\r\n#define GL_DOUBLE_MAT3 0x8F47\r\n#define GL_DOUBLE_MAT4 0x8F48\r\n#define GL_DOUBLE_VEC2 0x8FFC\r\n#define GL_DOUBLE_VEC3 0x8FFD\r\n#define GL_DOUBLE_VEC4 0x8FFE\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);\r\n\r\n#define glGetVertexAttribLdv GLEW_GET_FUN(__glewGetVertexAttribLdv)\r\n#define glVertexAttribL1d GLEW_GET_FUN(__glewVertexAttribL1d)\r\n#define glVertexAttribL1dv GLEW_GET_FUN(__glewVertexAttribL1dv)\r\n#define glVertexAttribL2d GLEW_GET_FUN(__glewVertexAttribL2d)\r\n#define glVertexAttribL2dv GLEW_GET_FUN(__glewVertexAttribL2dv)\r\n#define glVertexAttribL3d GLEW_GET_FUN(__glewVertexAttribL3d)\r\n#define glVertexAttribL3dv GLEW_GET_FUN(__glewVertexAttribL3dv)\r\n#define glVertexAttribL4d GLEW_GET_FUN(__glewVertexAttribL4d)\r\n#define glVertexAttribL4dv GLEW_GET_FUN(__glewVertexAttribL4dv)\r\n#define glVertexAttribLPointer GLEW_GET_FUN(__glewVertexAttribLPointer)\r\n\r\n#define GLEW_ARB_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_64bit)\r\n\r\n#endif /* GL_ARB_vertex_attrib_64bit */\r\n\r\n/* ---------------------- GL_ARB_vertex_attrib_binding --------------------- */\r\n\r\n#ifndef GL_ARB_vertex_attrib_binding\r\n#define GL_ARB_vertex_attrib_binding 1\r\n\r\n#define GL_VERTEX_ATTRIB_BINDING 0x82D4\r\n#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5\r\n#define GL_VERTEX_BINDING_DIVISOR 0x82D6\r\n#define GL_VERTEX_BINDING_OFFSET 0x82D7\r\n#define GL_VERTEX_BINDING_STRIDE 0x82D8\r\n#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9\r\n#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);\r\n\r\n#define glBindVertexBuffer GLEW_GET_FUN(__glewBindVertexBuffer)\r\n#define glVertexAttribBinding GLEW_GET_FUN(__glewVertexAttribBinding)\r\n#define glVertexAttribFormat GLEW_GET_FUN(__glewVertexAttribFormat)\r\n#define glVertexAttribIFormat GLEW_GET_FUN(__glewVertexAttribIFormat)\r\n#define glVertexAttribLFormat GLEW_GET_FUN(__glewVertexAttribLFormat)\r\n#define glVertexBindingDivisor GLEW_GET_FUN(__glewVertexBindingDivisor)\r\n\r\n#define GLEW_ARB_vertex_attrib_binding GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_binding)\r\n\r\n#endif /* GL_ARB_vertex_attrib_binding */\r\n\r\n/* -------------------------- GL_ARB_vertex_blend -------------------------- */\r\n\r\n#ifndef GL_ARB_vertex_blend\r\n#define GL_ARB_vertex_blend 1\r\n\r\n#define GL_MODELVIEW0_ARB 0x1700\r\n#define GL_MODELVIEW1_ARB 0x850A\r\n#define GL_MAX_VERTEX_UNITS_ARB 0x86A4\r\n#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5\r\n#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6\r\n#define GL_VERTEX_BLEND_ARB 0x86A7\r\n#define GL_CURRENT_WEIGHT_ARB 0x86A8\r\n#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9\r\n#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA\r\n#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB\r\n#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC\r\n#define GL_WEIGHT_ARRAY_ARB 0x86AD\r\n#define GL_MODELVIEW2_ARB 0x8722\r\n#define GL_MODELVIEW3_ARB 0x8723\r\n#define GL_MODELVIEW4_ARB 0x8724\r\n#define GL_MODELVIEW5_ARB 0x8725\r\n#define GL_MODELVIEW6_ARB 0x8726\r\n#define GL_MODELVIEW7_ARB 0x8727\r\n#define GL_MODELVIEW8_ARB 0x8728\r\n#define GL_MODELVIEW9_ARB 0x8729\r\n#define GL_MODELVIEW10_ARB 0x872A\r\n#define GL_MODELVIEW11_ARB 0x872B\r\n#define GL_MODELVIEW12_ARB 0x872C\r\n#define GL_MODELVIEW13_ARB 0x872D\r\n#define GL_MODELVIEW14_ARB 0x872E\r\n#define GL_MODELVIEW15_ARB 0x872F\r\n#define GL_MODELVIEW16_ARB 0x8730\r\n#define GL_MODELVIEW17_ARB 0x8731\r\n#define GL_MODELVIEW18_ARB 0x8732\r\n#define GL_MODELVIEW19_ARB 0x8733\r\n#define GL_MODELVIEW20_ARB 0x8734\r\n#define GL_MODELVIEW21_ARB 0x8735\r\n#define GL_MODELVIEW22_ARB 0x8736\r\n#define GL_MODELVIEW23_ARB 0x8737\r\n#define GL_MODELVIEW24_ARB 0x8738\r\n#define GL_MODELVIEW25_ARB 0x8739\r\n#define GL_MODELVIEW26_ARB 0x873A\r\n#define GL_MODELVIEW27_ARB 0x873B\r\n#define GL_MODELVIEW28_ARB 0x873C\r\n#define GL_MODELVIEW29_ARB 0x873D\r\n#define GL_MODELVIEW30_ARB 0x873E\r\n#define GL_MODELVIEW31_ARB 0x873F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, GLbyte *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, GLdouble *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, GLfloat *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, GLint *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, GLshort *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, GLubyte *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, GLuint *weights);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, GLushort *weights);\r\n\r\n#define glVertexBlendARB GLEW_GET_FUN(__glewVertexBlendARB)\r\n#define glWeightPointerARB GLEW_GET_FUN(__glewWeightPointerARB)\r\n#define glWeightbvARB GLEW_GET_FUN(__glewWeightbvARB)\r\n#define glWeightdvARB GLEW_GET_FUN(__glewWeightdvARB)\r\n#define glWeightfvARB GLEW_GET_FUN(__glewWeightfvARB)\r\n#define glWeightivARB GLEW_GET_FUN(__glewWeightivARB)\r\n#define glWeightsvARB GLEW_GET_FUN(__glewWeightsvARB)\r\n#define glWeightubvARB GLEW_GET_FUN(__glewWeightubvARB)\r\n#define glWeightuivARB GLEW_GET_FUN(__glewWeightuivARB)\r\n#define glWeightusvARB GLEW_GET_FUN(__glewWeightusvARB)\r\n\r\n#define GLEW_ARB_vertex_blend GLEW_GET_VAR(__GLEW_ARB_vertex_blend)\r\n\r\n#endif /* GL_ARB_vertex_blend */\r\n\r\n/* ---------------------- GL_ARB_vertex_buffer_object ---------------------- */\r\n\r\n#ifndef GL_ARB_vertex_buffer_object\r\n#define GL_ARB_vertex_buffer_object 1\r\n\r\n#define GL_BUFFER_SIZE_ARB 0x8764\r\n#define GL_BUFFER_USAGE_ARB 0x8765\r\n#define GL_ARRAY_BUFFER_ARB 0x8892\r\n#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893\r\n#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894\r\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895\r\n#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896\r\n#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897\r\n#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898\r\n#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899\r\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A\r\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B\r\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C\r\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D\r\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E\r\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F\r\n#define GL_READ_ONLY_ARB 0x88B8\r\n#define GL_WRITE_ONLY_ARB 0x88B9\r\n#define GL_READ_WRITE_ARB 0x88BA\r\n#define GL_BUFFER_ACCESS_ARB 0x88BB\r\n#define GL_BUFFER_MAPPED_ARB 0x88BC\r\n#define GL_BUFFER_MAP_POINTER_ARB 0x88BD\r\n#define GL_STREAM_DRAW_ARB 0x88E0\r\n#define GL_STREAM_READ_ARB 0x88E1\r\n#define GL_STREAM_COPY_ARB 0x88E2\r\n#define GL_STATIC_DRAW_ARB 0x88E4\r\n#define GL_STATIC_READ_ARB 0x88E5\r\n#define GL_STATIC_COPY_ARB 0x88E6\r\n#define GL_DYNAMIC_DRAW_ARB 0x88E8\r\n#define GL_DYNAMIC_READ_ARB 0x88E9\r\n#define GL_DYNAMIC_COPY_ARB 0x88EA\r\n\r\ntypedef ptrdiff_t GLintptrARB;\r\ntypedef ptrdiff_t GLsizeiptrARB;\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid* data, GLenum usage);\r\ntypedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid* data);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint* buffers);\r\ntypedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint* buffers);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid** params);\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid* data);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer);\r\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target);\r\n\r\n#define glBindBufferARB GLEW_GET_FUN(__glewBindBufferARB)\r\n#define glBufferDataARB GLEW_GET_FUN(__glewBufferDataARB)\r\n#define glBufferSubDataARB GLEW_GET_FUN(__glewBufferSubDataARB)\r\n#define glDeleteBuffersARB GLEW_GET_FUN(__glewDeleteBuffersARB)\r\n#define glGenBuffersARB GLEW_GET_FUN(__glewGenBuffersARB)\r\n#define glGetBufferParameterivARB GLEW_GET_FUN(__glewGetBufferParameterivARB)\r\n#define glGetBufferPointervARB GLEW_GET_FUN(__glewGetBufferPointervARB)\r\n#define glGetBufferSubDataARB GLEW_GET_FUN(__glewGetBufferSubDataARB)\r\n#define glIsBufferARB GLEW_GET_FUN(__glewIsBufferARB)\r\n#define glMapBufferARB GLEW_GET_FUN(__glewMapBufferARB)\r\n#define glUnmapBufferARB GLEW_GET_FUN(__glewUnmapBufferARB)\r\n\r\n#define GLEW_ARB_vertex_buffer_object GLEW_GET_VAR(__GLEW_ARB_vertex_buffer_object)\r\n\r\n#endif /* GL_ARB_vertex_buffer_object */\r\n\r\n/* ------------------------- GL_ARB_vertex_program ------------------------- */\r\n\r\n#ifndef GL_ARB_vertex_program\r\n#define GL_ARB_vertex_program 1\r\n\r\n#define GL_COLOR_SUM_ARB 0x8458\r\n#define GL_VERTEX_PROGRAM_ARB 0x8620\r\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622\r\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623\r\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624\r\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625\r\n#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626\r\n#define GL_PROGRAM_LENGTH_ARB 0x8627\r\n#define GL_PROGRAM_STRING_ARB 0x8628\r\n#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E\r\n#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F\r\n#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640\r\n#define GL_CURRENT_MATRIX_ARB 0x8641\r\n#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642\r\n#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643\r\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645\r\n#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B\r\n#define GL_PROGRAM_BINDING_ARB 0x8677\r\n#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869\r\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A\r\n#define GL_PROGRAM_ERROR_STRING_ARB 0x8874\r\n#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875\r\n#define GL_PROGRAM_FORMAT_ARB 0x8876\r\n#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0\r\n#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1\r\n#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2\r\n#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3\r\n#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4\r\n#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5\r\n#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6\r\n#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7\r\n#define GL_PROGRAM_PARAMETERS_ARB 0x88A8\r\n#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9\r\n#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA\r\n#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB\r\n#define GL_PROGRAM_ATTRIBS_ARB 0x88AC\r\n#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD\r\n#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE\r\n#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF\r\n#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0\r\n#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1\r\n#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2\r\n#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3\r\n#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4\r\n#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5\r\n#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6\r\n#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7\r\n#define GL_MATRIX0_ARB 0x88C0\r\n#define GL_MATRIX1_ARB 0x88C1\r\n#define GL_MATRIX2_ARB 0x88C2\r\n#define GL_MATRIX3_ARB 0x88C3\r\n#define GL_MATRIX4_ARB 0x88C4\r\n#define GL_MATRIX5_ARB 0x88C5\r\n#define GL_MATRIX6_ARB 0x88C6\r\n#define GL_MATRIX7_ARB 0x88C7\r\n#define GL_MATRIX8_ARB 0x88C8\r\n#define GL_MATRIX9_ARB 0x88C9\r\n#define GL_MATRIX10_ARB 0x88CA\r\n#define GL_MATRIX11_ARB 0x88CB\r\n#define GL_MATRIX12_ARB 0x88CC\r\n#define GL_MATRIX13_ARB 0x88CD\r\n#define GL_MATRIX14_ARB 0x88CE\r\n#define GL_MATRIX15_ARB 0x88CF\r\n#define GL_MATRIX16_ARB 0x88D0\r\n#define GL_MATRIX17_ARB 0x88D1\r\n#define GL_MATRIX18_ARB 0x88D2\r\n#define GL_MATRIX19_ARB 0x88D3\r\n#define GL_MATRIX20_ARB 0x88D4\r\n#define GL_MATRIX21_ARB 0x88D5\r\n#define GL_MATRIX22_ARB 0x88D6\r\n#define GL_MATRIX23_ARB 0x88D7\r\n#define GL_MATRIX24_ARB 0x88D8\r\n#define GL_MATRIX25_ARB 0x88D9\r\n#define GL_MATRIX26_ARB 0x88DA\r\n#define GL_MATRIX27_ARB 0x88DB\r\n#define GL_MATRIX28_ARB 0x88DC\r\n#define GL_MATRIX29_ARB 0x88DD\r\n#define GL_MATRIX30_ARB 0x88DE\r\n#define GL_MATRIX31_ARB 0x88DF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint* programs);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint* programs);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void* string);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid** pointer);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void* string);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer);\r\n\r\n#define glBindProgramARB GLEW_GET_FUN(__glewBindProgramARB)\r\n#define glDeleteProgramsARB GLEW_GET_FUN(__glewDeleteProgramsARB)\r\n#define glDisableVertexAttribArrayARB GLEW_GET_FUN(__glewDisableVertexAttribArrayARB)\r\n#define glEnableVertexAttribArrayARB GLEW_GET_FUN(__glewEnableVertexAttribArrayARB)\r\n#define glGenProgramsARB GLEW_GET_FUN(__glewGenProgramsARB)\r\n#define glGetProgramEnvParameterdvARB GLEW_GET_FUN(__glewGetProgramEnvParameterdvARB)\r\n#define glGetProgramEnvParameterfvARB GLEW_GET_FUN(__glewGetProgramEnvParameterfvARB)\r\n#define glGetProgramLocalParameterdvARB GLEW_GET_FUN(__glewGetProgramLocalParameterdvARB)\r\n#define glGetProgramLocalParameterfvARB GLEW_GET_FUN(__glewGetProgramLocalParameterfvARB)\r\n#define glGetProgramStringARB GLEW_GET_FUN(__glewGetProgramStringARB)\r\n#define glGetProgramivARB GLEW_GET_FUN(__glewGetProgramivARB)\r\n#define glGetVertexAttribPointervARB GLEW_GET_FUN(__glewGetVertexAttribPointervARB)\r\n#define glGetVertexAttribdvARB GLEW_GET_FUN(__glewGetVertexAttribdvARB)\r\n#define glGetVertexAttribfvARB GLEW_GET_FUN(__glewGetVertexAttribfvARB)\r\n#define glGetVertexAttribivARB GLEW_GET_FUN(__glewGetVertexAttribivARB)\r\n#define glIsProgramARB GLEW_GET_FUN(__glewIsProgramARB)\r\n#define glProgramEnvParameter4dARB GLEW_GET_FUN(__glewProgramEnvParameter4dARB)\r\n#define glProgramEnvParameter4dvARB GLEW_GET_FUN(__glewProgramEnvParameter4dvARB)\r\n#define glProgramEnvParameter4fARB GLEW_GET_FUN(__glewProgramEnvParameter4fARB)\r\n#define glProgramEnvParameter4fvARB GLEW_GET_FUN(__glewProgramEnvParameter4fvARB)\r\n#define glProgramLocalParameter4dARB GLEW_GET_FUN(__glewProgramLocalParameter4dARB)\r\n#define glProgramLocalParameter4dvARB GLEW_GET_FUN(__glewProgramLocalParameter4dvARB)\r\n#define glProgramLocalParameter4fARB GLEW_GET_FUN(__glewProgramLocalParameter4fARB)\r\n#define glProgramLocalParameter4fvARB GLEW_GET_FUN(__glewProgramLocalParameter4fvARB)\r\n#define glProgramStringARB GLEW_GET_FUN(__glewProgramStringARB)\r\n#define glVertexAttrib1dARB GLEW_GET_FUN(__glewVertexAttrib1dARB)\r\n#define glVertexAttrib1dvARB GLEW_GET_FUN(__glewVertexAttrib1dvARB)\r\n#define glVertexAttrib1fARB GLEW_GET_FUN(__glewVertexAttrib1fARB)\r\n#define glVertexAttrib1fvARB GLEW_GET_FUN(__glewVertexAttrib1fvARB)\r\n#define glVertexAttrib1sARB GLEW_GET_FUN(__glewVertexAttrib1sARB)\r\n#define glVertexAttrib1svARB GLEW_GET_FUN(__glewVertexAttrib1svARB)\r\n#define glVertexAttrib2dARB GLEW_GET_FUN(__glewVertexAttrib2dARB)\r\n#define glVertexAttrib2dvARB GLEW_GET_FUN(__glewVertexAttrib2dvARB)\r\n#define glVertexAttrib2fARB GLEW_GET_FUN(__glewVertexAttrib2fARB)\r\n#define glVertexAttrib2fvARB GLEW_GET_FUN(__glewVertexAttrib2fvARB)\r\n#define glVertexAttrib2sARB GLEW_GET_FUN(__glewVertexAttrib2sARB)\r\n#define glVertexAttrib2svARB GLEW_GET_FUN(__glewVertexAttrib2svARB)\r\n#define glVertexAttrib3dARB GLEW_GET_FUN(__glewVertexAttrib3dARB)\r\n#define glVertexAttrib3dvARB GLEW_GET_FUN(__glewVertexAttrib3dvARB)\r\n#define glVertexAttrib3fARB GLEW_GET_FUN(__glewVertexAttrib3fARB)\r\n#define glVertexAttrib3fvARB GLEW_GET_FUN(__glewVertexAttrib3fvARB)\r\n#define glVertexAttrib3sARB GLEW_GET_FUN(__glewVertexAttrib3sARB)\r\n#define glVertexAttrib3svARB GLEW_GET_FUN(__glewVertexAttrib3svARB)\r\n#define glVertexAttrib4NbvARB GLEW_GET_FUN(__glewVertexAttrib4NbvARB)\r\n#define glVertexAttrib4NivARB GLEW_GET_FUN(__glewVertexAttrib4NivARB)\r\n#define glVertexAttrib4NsvARB GLEW_GET_FUN(__glewVertexAttrib4NsvARB)\r\n#define glVertexAttrib4NubARB GLEW_GET_FUN(__glewVertexAttrib4NubARB)\r\n#define glVertexAttrib4NubvARB GLEW_GET_FUN(__glewVertexAttrib4NubvARB)\r\n#define glVertexAttrib4NuivARB GLEW_GET_FUN(__glewVertexAttrib4NuivARB)\r\n#define glVertexAttrib4NusvARB GLEW_GET_FUN(__glewVertexAttrib4NusvARB)\r\n#define glVertexAttrib4bvARB GLEW_GET_FUN(__glewVertexAttrib4bvARB)\r\n#define glVertexAttrib4dARB GLEW_GET_FUN(__glewVertexAttrib4dARB)\r\n#define glVertexAttrib4dvARB GLEW_GET_FUN(__glewVertexAttrib4dvARB)\r\n#define glVertexAttrib4fARB GLEW_GET_FUN(__glewVertexAttrib4fARB)\r\n#define glVertexAttrib4fvARB GLEW_GET_FUN(__glewVertexAttrib4fvARB)\r\n#define glVertexAttrib4ivARB GLEW_GET_FUN(__glewVertexAttrib4ivARB)\r\n#define glVertexAttrib4sARB GLEW_GET_FUN(__glewVertexAttrib4sARB)\r\n#define glVertexAttrib4svARB GLEW_GET_FUN(__glewVertexAttrib4svARB)\r\n#define glVertexAttrib4ubvARB GLEW_GET_FUN(__glewVertexAttrib4ubvARB)\r\n#define glVertexAttrib4uivARB GLEW_GET_FUN(__glewVertexAttrib4uivARB)\r\n#define glVertexAttrib4usvARB GLEW_GET_FUN(__glewVertexAttrib4usvARB)\r\n#define glVertexAttribPointerARB GLEW_GET_FUN(__glewVertexAttribPointerARB)\r\n\r\n#define GLEW_ARB_vertex_program GLEW_GET_VAR(__GLEW_ARB_vertex_program)\r\n\r\n#endif /* GL_ARB_vertex_program */\r\n\r\n/* -------------------------- GL_ARB_vertex_shader ------------------------- */\r\n\r\n#ifndef GL_ARB_vertex_shader\r\n#define GL_ARB_vertex_shader 1\r\n\r\n#define GL_VERTEX_SHADER_ARB 0x8B31\r\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A\r\n#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B\r\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C\r\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D\r\n#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89\r\n#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB* name);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name);\r\n\r\n#define glBindAttribLocationARB GLEW_GET_FUN(__glewBindAttribLocationARB)\r\n#define glGetActiveAttribARB GLEW_GET_FUN(__glewGetActiveAttribARB)\r\n#define glGetAttribLocationARB GLEW_GET_FUN(__glewGetAttribLocationARB)\r\n\r\n#define GLEW_ARB_vertex_shader GLEW_GET_VAR(__GLEW_ARB_vertex_shader)\r\n\r\n#endif /* GL_ARB_vertex_shader */\r\n\r\n/* ------------------- GL_ARB_vertex_type_2_10_10_10_rev ------------------- */\r\n\r\n#ifndef GL_ARB_vertex_type_2_10_10_10_rev\r\n#define GL_ARB_vertex_type_2_10_10_10_rev 1\r\n\r\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\r\n#define GL_INT_2_10_10_10_REV 0x8D9F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint* color);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint* color);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint* color);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint* coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint* value);\r\n\r\n#define glColorP3ui GLEW_GET_FUN(__glewColorP3ui)\r\n#define glColorP3uiv GLEW_GET_FUN(__glewColorP3uiv)\r\n#define glColorP4ui GLEW_GET_FUN(__glewColorP4ui)\r\n#define glColorP4uiv GLEW_GET_FUN(__glewColorP4uiv)\r\n#define glMultiTexCoordP1ui GLEW_GET_FUN(__glewMultiTexCoordP1ui)\r\n#define glMultiTexCoordP1uiv GLEW_GET_FUN(__glewMultiTexCoordP1uiv)\r\n#define glMultiTexCoordP2ui GLEW_GET_FUN(__glewMultiTexCoordP2ui)\r\n#define glMultiTexCoordP2uiv GLEW_GET_FUN(__glewMultiTexCoordP2uiv)\r\n#define glMultiTexCoordP3ui GLEW_GET_FUN(__glewMultiTexCoordP3ui)\r\n#define glMultiTexCoordP3uiv GLEW_GET_FUN(__glewMultiTexCoordP3uiv)\r\n#define glMultiTexCoordP4ui GLEW_GET_FUN(__glewMultiTexCoordP4ui)\r\n#define glMultiTexCoordP4uiv GLEW_GET_FUN(__glewMultiTexCoordP4uiv)\r\n#define glNormalP3ui GLEW_GET_FUN(__glewNormalP3ui)\r\n#define glNormalP3uiv GLEW_GET_FUN(__glewNormalP3uiv)\r\n#define glSecondaryColorP3ui GLEW_GET_FUN(__glewSecondaryColorP3ui)\r\n#define glSecondaryColorP3uiv GLEW_GET_FUN(__glewSecondaryColorP3uiv)\r\n#define glTexCoordP1ui GLEW_GET_FUN(__glewTexCoordP1ui)\r\n#define glTexCoordP1uiv GLEW_GET_FUN(__glewTexCoordP1uiv)\r\n#define glTexCoordP2ui GLEW_GET_FUN(__glewTexCoordP2ui)\r\n#define glTexCoordP2uiv GLEW_GET_FUN(__glewTexCoordP2uiv)\r\n#define glTexCoordP3ui GLEW_GET_FUN(__glewTexCoordP3ui)\r\n#define glTexCoordP3uiv GLEW_GET_FUN(__glewTexCoordP3uiv)\r\n#define glTexCoordP4ui GLEW_GET_FUN(__glewTexCoordP4ui)\r\n#define glTexCoordP4uiv GLEW_GET_FUN(__glewTexCoordP4uiv)\r\n#define glVertexAttribP1ui GLEW_GET_FUN(__glewVertexAttribP1ui)\r\n#define glVertexAttribP1uiv GLEW_GET_FUN(__glewVertexAttribP1uiv)\r\n#define glVertexAttribP2ui GLEW_GET_FUN(__glewVertexAttribP2ui)\r\n#define glVertexAttribP2uiv GLEW_GET_FUN(__glewVertexAttribP2uiv)\r\n#define glVertexAttribP3ui GLEW_GET_FUN(__glewVertexAttribP3ui)\r\n#define glVertexAttribP3uiv GLEW_GET_FUN(__glewVertexAttribP3uiv)\r\n#define glVertexAttribP4ui GLEW_GET_FUN(__glewVertexAttribP4ui)\r\n#define glVertexAttribP4uiv GLEW_GET_FUN(__glewVertexAttribP4uiv)\r\n#define glVertexP2ui GLEW_GET_FUN(__glewVertexP2ui)\r\n#define glVertexP2uiv GLEW_GET_FUN(__glewVertexP2uiv)\r\n#define glVertexP3ui GLEW_GET_FUN(__glewVertexP3ui)\r\n#define glVertexP3uiv GLEW_GET_FUN(__glewVertexP3uiv)\r\n#define glVertexP4ui GLEW_GET_FUN(__glewVertexP4ui)\r\n#define glVertexP4uiv GLEW_GET_FUN(__glewVertexP4uiv)\r\n\r\n#define GLEW_ARB_vertex_type_2_10_10_10_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_2_10_10_10_rev)\r\n\r\n#endif /* GL_ARB_vertex_type_2_10_10_10_rev */\r\n\r\n/* ------------------------- GL_ARB_viewport_array ------------------------- */\r\n\r\n#ifndef GL_ARB_viewport_array\r\n#define GL_ARB_viewport_array 1\r\n\r\n#define GL_DEPTH_RANGE 0x0B70\r\n#define GL_VIEWPORT 0x0BA2\r\n#define GL_SCISSOR_BOX 0x0C10\r\n#define GL_SCISSOR_TEST 0x0C11\r\n#define GL_MAX_VIEWPORTS 0x825B\r\n#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C\r\n#define GL_VIEWPORT_BOUNDS_RANGE 0x825D\r\n#define GL_LAYER_PROVOKING_VERTEX 0x825E\r\n#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F\r\n#define GL_UNDEFINED_VERTEX 0x8260\r\n#define GL_FIRST_VERTEX_CONVENTION 0x8E4D\r\n#define GL_LAST_VERTEX_CONVENTION 0x8E4E\r\n#define GL_PROVOKING_VERTEX 0x8E4F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd * v);\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f);\r\ntypedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat* data);\r\ntypedef void (GLAPIENTRY * PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint * v);\r\ntypedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint * v);\r\ntypedef void (GLAPIENTRY * PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat * v);\r\ntypedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\r\ntypedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat * v);\r\n\r\n#define glDepthRangeArrayv GLEW_GET_FUN(__glewDepthRangeArrayv)\r\n#define glDepthRangeIndexed GLEW_GET_FUN(__glewDepthRangeIndexed)\r\n#define glGetDoublei_v GLEW_GET_FUN(__glewGetDoublei_v)\r\n#define glGetFloati_v GLEW_GET_FUN(__glewGetFloati_v)\r\n#define glScissorArrayv GLEW_GET_FUN(__glewScissorArrayv)\r\n#define glScissorIndexed GLEW_GET_FUN(__glewScissorIndexed)\r\n#define glScissorIndexedv GLEW_GET_FUN(__glewScissorIndexedv)\r\n#define glViewportArrayv GLEW_GET_FUN(__glewViewportArrayv)\r\n#define glViewportIndexedf GLEW_GET_FUN(__glewViewportIndexedf)\r\n#define glViewportIndexedfv GLEW_GET_FUN(__glewViewportIndexedfv)\r\n\r\n#define GLEW_ARB_viewport_array GLEW_GET_VAR(__GLEW_ARB_viewport_array)\r\n\r\n#endif /* GL_ARB_viewport_array */\r\n\r\n/* --------------------------- GL_ARB_window_pos --------------------------- */\r\n\r\n#ifndef GL_ARB_window_pos\r\n#define GL_ARB_window_pos 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p);\r\n\r\n#define glWindowPos2dARB GLEW_GET_FUN(__glewWindowPos2dARB)\r\n#define glWindowPos2dvARB GLEW_GET_FUN(__glewWindowPos2dvARB)\r\n#define glWindowPos2fARB GLEW_GET_FUN(__glewWindowPos2fARB)\r\n#define glWindowPos2fvARB GLEW_GET_FUN(__glewWindowPos2fvARB)\r\n#define glWindowPos2iARB GLEW_GET_FUN(__glewWindowPos2iARB)\r\n#define glWindowPos2ivARB GLEW_GET_FUN(__glewWindowPos2ivARB)\r\n#define glWindowPos2sARB GLEW_GET_FUN(__glewWindowPos2sARB)\r\n#define glWindowPos2svARB GLEW_GET_FUN(__glewWindowPos2svARB)\r\n#define glWindowPos3dARB GLEW_GET_FUN(__glewWindowPos3dARB)\r\n#define glWindowPos3dvARB GLEW_GET_FUN(__glewWindowPos3dvARB)\r\n#define glWindowPos3fARB GLEW_GET_FUN(__glewWindowPos3fARB)\r\n#define glWindowPos3fvARB GLEW_GET_FUN(__glewWindowPos3fvARB)\r\n#define glWindowPos3iARB GLEW_GET_FUN(__glewWindowPos3iARB)\r\n#define glWindowPos3ivARB GLEW_GET_FUN(__glewWindowPos3ivARB)\r\n#define glWindowPos3sARB GLEW_GET_FUN(__glewWindowPos3sARB)\r\n#define glWindowPos3svARB GLEW_GET_FUN(__glewWindowPos3svARB)\r\n\r\n#define GLEW_ARB_window_pos GLEW_GET_VAR(__GLEW_ARB_window_pos)\r\n\r\n#endif /* GL_ARB_window_pos */\r\n\r\n/* ------------------------- GL_ATIX_point_sprites ------------------------- */\r\n\r\n#ifndef GL_ATIX_point_sprites\r\n#define GL_ATIX_point_sprites 1\r\n\r\n#define GL_TEXTURE_POINT_MODE_ATIX 0x60B0\r\n#define GL_TEXTURE_POINT_ONE_COORD_ATIX 0x60B1\r\n#define GL_TEXTURE_POINT_SPRITE_ATIX 0x60B2\r\n#define GL_POINT_SPRITE_CULL_MODE_ATIX 0x60B3\r\n#define GL_POINT_SPRITE_CULL_CENTER_ATIX 0x60B4\r\n#define GL_POINT_SPRITE_CULL_CLIP_ATIX 0x60B5\r\n\r\n#define GLEW_ATIX_point_sprites GLEW_GET_VAR(__GLEW_ATIX_point_sprites)\r\n\r\n#endif /* GL_ATIX_point_sprites */\r\n\r\n/* ---------------------- GL_ATIX_texture_env_combine3 --------------------- */\r\n\r\n#ifndef GL_ATIX_texture_env_combine3\r\n#define GL_ATIX_texture_env_combine3 1\r\n\r\n#define GL_MODULATE_ADD_ATIX 0x8744\r\n#define GL_MODULATE_SIGNED_ADD_ATIX 0x8745\r\n#define GL_MODULATE_SUBTRACT_ATIX 0x8746\r\n\r\n#define GLEW_ATIX_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATIX_texture_env_combine3)\r\n\r\n#endif /* GL_ATIX_texture_env_combine3 */\r\n\r\n/* ----------------------- GL_ATIX_texture_env_route ----------------------- */\r\n\r\n#ifndef GL_ATIX_texture_env_route\r\n#define GL_ATIX_texture_env_route 1\r\n\r\n#define GL_SECONDARY_COLOR_ATIX 0x8747\r\n#define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748\r\n#define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749\r\n\r\n#define GLEW_ATIX_texture_env_route GLEW_GET_VAR(__GLEW_ATIX_texture_env_route)\r\n\r\n#endif /* GL_ATIX_texture_env_route */\r\n\r\n/* ---------------- GL_ATIX_vertex_shader_output_point_size ---------------- */\r\n\r\n#ifndef GL_ATIX_vertex_shader_output_point_size\r\n#define GL_ATIX_vertex_shader_output_point_size 1\r\n\r\n#define GL_OUTPUT_POINT_SIZE_ATIX 0x610E\r\n\r\n#define GLEW_ATIX_vertex_shader_output_point_size GLEW_GET_VAR(__GLEW_ATIX_vertex_shader_output_point_size)\r\n\r\n#endif /* GL_ATIX_vertex_shader_output_point_size */\r\n\r\n/* -------------------------- GL_ATI_draw_buffers -------------------------- */\r\n\r\n#ifndef GL_ATI_draw_buffers\r\n#define GL_ATI_draw_buffers 1\r\n\r\n#define GL_MAX_DRAW_BUFFERS_ATI 0x8824\r\n#define GL_DRAW_BUFFER0_ATI 0x8825\r\n#define GL_DRAW_BUFFER1_ATI 0x8826\r\n#define GL_DRAW_BUFFER2_ATI 0x8827\r\n#define GL_DRAW_BUFFER3_ATI 0x8828\r\n#define GL_DRAW_BUFFER4_ATI 0x8829\r\n#define GL_DRAW_BUFFER5_ATI 0x882A\r\n#define GL_DRAW_BUFFER6_ATI 0x882B\r\n#define GL_DRAW_BUFFER7_ATI 0x882C\r\n#define GL_DRAW_BUFFER8_ATI 0x882D\r\n#define GL_DRAW_BUFFER9_ATI 0x882E\r\n#define GL_DRAW_BUFFER10_ATI 0x882F\r\n#define GL_DRAW_BUFFER11_ATI 0x8830\r\n#define GL_DRAW_BUFFER12_ATI 0x8831\r\n#define GL_DRAW_BUFFER13_ATI 0x8832\r\n#define GL_DRAW_BUFFER14_ATI 0x8833\r\n#define GL_DRAW_BUFFER15_ATI 0x8834\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum* bufs);\r\n\r\n#define glDrawBuffersATI GLEW_GET_FUN(__glewDrawBuffersATI)\r\n\r\n#define GLEW_ATI_draw_buffers GLEW_GET_VAR(__GLEW_ATI_draw_buffers)\r\n\r\n#endif /* GL_ATI_draw_buffers */\r\n\r\n/* -------------------------- GL_ATI_element_array ------------------------- */\r\n\r\n#ifndef GL_ATI_element_array\r\n#define GL_ATI_element_array 1\r\n\r\n#define GL_ELEMENT_ARRAY_ATI 0x8768\r\n#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769\r\n#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);\r\ntypedef void (GLAPIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void* pointer);\r\n\r\n#define glDrawElementArrayATI GLEW_GET_FUN(__glewDrawElementArrayATI)\r\n#define glDrawRangeElementArrayATI GLEW_GET_FUN(__glewDrawRangeElementArrayATI)\r\n#define glElementPointerATI GLEW_GET_FUN(__glewElementPointerATI)\r\n\r\n#define GLEW_ATI_element_array GLEW_GET_VAR(__GLEW_ATI_element_array)\r\n\r\n#endif /* GL_ATI_element_array */\r\n\r\n/* ------------------------- GL_ATI_envmap_bumpmap ------------------------- */\r\n\r\n#ifndef GL_ATI_envmap_bumpmap\r\n#define GL_ATI_envmap_bumpmap 1\r\n\r\n#define GL_BUMP_ROT_MATRIX_ATI 0x8775\r\n#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776\r\n#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777\r\n#define GL_BUMP_TEX_UNITS_ATI 0x8778\r\n#define GL_DUDV_ATI 0x8779\r\n#define GL_DU8DV8_ATI 0x877A\r\n#define GL_BUMP_ENVMAP_ATI 0x877B\r\n#define GL_BUMP_TARGET_ATI 0x877C\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);\r\ntypedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);\r\ntypedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);\r\n\r\n#define glGetTexBumpParameterfvATI GLEW_GET_FUN(__glewGetTexBumpParameterfvATI)\r\n#define glGetTexBumpParameterivATI GLEW_GET_FUN(__glewGetTexBumpParameterivATI)\r\n#define glTexBumpParameterfvATI GLEW_GET_FUN(__glewTexBumpParameterfvATI)\r\n#define glTexBumpParameterivATI GLEW_GET_FUN(__glewTexBumpParameterivATI)\r\n\r\n#define GLEW_ATI_envmap_bumpmap GLEW_GET_VAR(__GLEW_ATI_envmap_bumpmap)\r\n\r\n#endif /* GL_ATI_envmap_bumpmap */\r\n\r\n/* ------------------------- GL_ATI_fragment_shader ------------------------ */\r\n\r\n#ifndef GL_ATI_fragment_shader\r\n#define GL_ATI_fragment_shader 1\r\n\r\n#define GL_RED_BIT_ATI 0x00000001\r\n#define GL_2X_BIT_ATI 0x00000001\r\n#define GL_4X_BIT_ATI 0x00000002\r\n#define GL_GREEN_BIT_ATI 0x00000002\r\n#define GL_COMP_BIT_ATI 0x00000002\r\n#define GL_BLUE_BIT_ATI 0x00000004\r\n#define GL_8X_BIT_ATI 0x00000004\r\n#define GL_NEGATE_BIT_ATI 0x00000004\r\n#define GL_BIAS_BIT_ATI 0x00000008\r\n#define GL_HALF_BIT_ATI 0x00000008\r\n#define GL_QUARTER_BIT_ATI 0x00000010\r\n#define GL_EIGHTH_BIT_ATI 0x00000020\r\n#define GL_SATURATE_BIT_ATI 0x00000040\r\n#define GL_FRAGMENT_SHADER_ATI 0x8920\r\n#define GL_REG_0_ATI 0x8921\r\n#define GL_REG_1_ATI 0x8922\r\n#define GL_REG_2_ATI 0x8923\r\n#define GL_REG_3_ATI 0x8924\r\n#define GL_REG_4_ATI 0x8925\r\n#define GL_REG_5_ATI 0x8926\r\n#define GL_CON_0_ATI 0x8941\r\n#define GL_CON_1_ATI 0x8942\r\n#define GL_CON_2_ATI 0x8943\r\n#define GL_CON_3_ATI 0x8944\r\n#define GL_CON_4_ATI 0x8945\r\n#define GL_CON_5_ATI 0x8946\r\n#define GL_CON_6_ATI 0x8947\r\n#define GL_CON_7_ATI 0x8948\r\n#define GL_MOV_ATI 0x8961\r\n#define GL_ADD_ATI 0x8963\r\n#define GL_MUL_ATI 0x8964\r\n#define GL_SUB_ATI 0x8965\r\n#define GL_DOT3_ATI 0x8966\r\n#define GL_DOT4_ATI 0x8967\r\n#define GL_MAD_ATI 0x8968\r\n#define GL_LERP_ATI 0x8969\r\n#define GL_CND_ATI 0x896A\r\n#define GL_CND0_ATI 0x896B\r\n#define GL_DOT2_ADD_ATI 0x896C\r\n#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D\r\n#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E\r\n#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F\r\n#define GL_NUM_PASSES_ATI 0x8970\r\n#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971\r\n#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972\r\n#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973\r\n#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974\r\n#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975\r\n#define GL_SWIZZLE_STR_ATI 0x8976\r\n#define GL_SWIZZLE_STQ_ATI 0x8977\r\n#define GL_SWIZZLE_STR_DR_ATI 0x8978\r\n#define GL_SWIZZLE_STQ_DQ_ATI 0x8979\r\n#define GL_SWIZZLE_STRQ_ATI 0x897A\r\n#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B\r\n\r\ntypedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\r\ntypedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\r\ntypedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\r\ntypedef void (GLAPIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);\r\ntypedef void (GLAPIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);\r\ntypedef void (GLAPIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat* value);\r\n\r\n#define glAlphaFragmentOp1ATI GLEW_GET_FUN(__glewAlphaFragmentOp1ATI)\r\n#define glAlphaFragmentOp2ATI GLEW_GET_FUN(__glewAlphaFragmentOp2ATI)\r\n#define glAlphaFragmentOp3ATI GLEW_GET_FUN(__glewAlphaFragmentOp3ATI)\r\n#define glBeginFragmentShaderATI GLEW_GET_FUN(__glewBeginFragmentShaderATI)\r\n#define glBindFragmentShaderATI GLEW_GET_FUN(__glewBindFragmentShaderATI)\r\n#define glColorFragmentOp1ATI GLEW_GET_FUN(__glewColorFragmentOp1ATI)\r\n#define glColorFragmentOp2ATI GLEW_GET_FUN(__glewColorFragmentOp2ATI)\r\n#define glColorFragmentOp3ATI GLEW_GET_FUN(__glewColorFragmentOp3ATI)\r\n#define glDeleteFragmentShaderATI GLEW_GET_FUN(__glewDeleteFragmentShaderATI)\r\n#define glEndFragmentShaderATI GLEW_GET_FUN(__glewEndFragmentShaderATI)\r\n#define glGenFragmentShadersATI GLEW_GET_FUN(__glewGenFragmentShadersATI)\r\n#define glPassTexCoordATI GLEW_GET_FUN(__glewPassTexCoordATI)\r\n#define glSampleMapATI GLEW_GET_FUN(__glewSampleMapATI)\r\n#define glSetFragmentShaderConstantATI GLEW_GET_FUN(__glewSetFragmentShaderConstantATI)\r\n\r\n#define GLEW_ATI_fragment_shader GLEW_GET_VAR(__GLEW_ATI_fragment_shader)\r\n\r\n#endif /* GL_ATI_fragment_shader */\r\n\r\n/* ------------------------ GL_ATI_map_object_buffer ----------------------- */\r\n\r\n#ifndef GL_ATI_map_object_buffer\r\n#define GL_ATI_map_object_buffer 1\r\n\r\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);\r\n\r\n#define glMapObjectBufferATI GLEW_GET_FUN(__glewMapObjectBufferATI)\r\n#define glUnmapObjectBufferATI GLEW_GET_FUN(__glewUnmapObjectBufferATI)\r\n\r\n#define GLEW_ATI_map_object_buffer GLEW_GET_VAR(__GLEW_ATI_map_object_buffer)\r\n\r\n#endif /* GL_ATI_map_object_buffer */\r\n\r\n/* ----------------------------- GL_ATI_meminfo ---------------------------- */\r\n\r\n#ifndef GL_ATI_meminfo\r\n#define GL_ATI_meminfo 1\r\n\r\n#define GL_VBO_FREE_MEMORY_ATI 0x87FB\r\n#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC\r\n#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD\r\n\r\n#define GLEW_ATI_meminfo GLEW_GET_VAR(__GLEW_ATI_meminfo)\r\n\r\n#endif /* GL_ATI_meminfo */\r\n\r\n/* -------------------------- GL_ATI_pn_triangles -------------------------- */\r\n\r\n#ifndef GL_ATI_pn_triangles\r\n#define GL_ATI_pn_triangles 1\r\n\r\n#define GL_PN_TRIANGLES_ATI 0x87F0\r\n#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1\r\n#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2\r\n#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3\r\n#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4\r\n#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5\r\n#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6\r\n#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7\r\n#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);\r\n\r\n#define glPNTrianglesfATI GLEW_GET_FUN(__glewPNTrianglesfATI)\r\n#define glPNTrianglesiATI GLEW_GET_FUN(__glewPNTrianglesiATI)\r\n\r\n#define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles)\r\n\r\n#endif /* GL_ATI_pn_triangles */\r\n\r\n/* ------------------------ GL_ATI_separate_stencil ------------------------ */\r\n\r\n#ifndef GL_ATI_separate_stencil\r\n#define GL_ATI_separate_stencil 1\r\n\r\n#define GL_STENCIL_BACK_FUNC_ATI 0x8800\r\n#define GL_STENCIL_BACK_FAIL_ATI 0x8801\r\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802\r\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\r\n\r\n#define glStencilFuncSeparateATI GLEW_GET_FUN(__glewStencilFuncSeparateATI)\r\n#define glStencilOpSeparateATI GLEW_GET_FUN(__glewStencilOpSeparateATI)\r\n\r\n#define GLEW_ATI_separate_stencil GLEW_GET_VAR(__GLEW_ATI_separate_stencil)\r\n\r\n#endif /* GL_ATI_separate_stencil */\r\n\r\n/* ----------------------- GL_ATI_shader_texture_lod ----------------------- */\r\n\r\n#ifndef GL_ATI_shader_texture_lod\r\n#define GL_ATI_shader_texture_lod 1\r\n\r\n#define GLEW_ATI_shader_texture_lod GLEW_GET_VAR(__GLEW_ATI_shader_texture_lod)\r\n\r\n#endif /* GL_ATI_shader_texture_lod */\r\n\r\n/* ---------------------- GL_ATI_text_fragment_shader ---------------------- */\r\n\r\n#ifndef GL_ATI_text_fragment_shader\r\n#define GL_ATI_text_fragment_shader 1\r\n\r\n#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200\r\n\r\n#define GLEW_ATI_text_fragment_shader GLEW_GET_VAR(__GLEW_ATI_text_fragment_shader)\r\n\r\n#endif /* GL_ATI_text_fragment_shader */\r\n\r\n/* --------------------- GL_ATI_texture_compression_3dc -------------------- */\r\n\r\n#ifndef GL_ATI_texture_compression_3dc\r\n#define GL_ATI_texture_compression_3dc 1\r\n\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837\r\n\r\n#define GLEW_ATI_texture_compression_3dc GLEW_GET_VAR(__GLEW_ATI_texture_compression_3dc)\r\n\r\n#endif /* GL_ATI_texture_compression_3dc */\r\n\r\n/* ---------------------- GL_ATI_texture_env_combine3 ---------------------- */\r\n\r\n#ifndef GL_ATI_texture_env_combine3\r\n#define GL_ATI_texture_env_combine3 1\r\n\r\n#define GL_MODULATE_ADD_ATI 0x8744\r\n#define GL_MODULATE_SIGNED_ADD_ATI 0x8745\r\n#define GL_MODULATE_SUBTRACT_ATI 0x8746\r\n\r\n#define GLEW_ATI_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATI_texture_env_combine3)\r\n\r\n#endif /* GL_ATI_texture_env_combine3 */\r\n\r\n/* -------------------------- GL_ATI_texture_float ------------------------- */\r\n\r\n#ifndef GL_ATI_texture_float\r\n#define GL_ATI_texture_float 1\r\n\r\n#define GL_RGBA_FLOAT32_ATI 0x8814\r\n#define GL_RGB_FLOAT32_ATI 0x8815\r\n#define GL_ALPHA_FLOAT32_ATI 0x8816\r\n#define GL_INTENSITY_FLOAT32_ATI 0x8817\r\n#define GL_LUMINANCE_FLOAT32_ATI 0x8818\r\n#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819\r\n#define GL_RGBA_FLOAT16_ATI 0x881A\r\n#define GL_RGB_FLOAT16_ATI 0x881B\r\n#define GL_ALPHA_FLOAT16_ATI 0x881C\r\n#define GL_INTENSITY_FLOAT16_ATI 0x881D\r\n#define GL_LUMINANCE_FLOAT16_ATI 0x881E\r\n#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F\r\n\r\n#define GLEW_ATI_texture_float GLEW_GET_VAR(__GLEW_ATI_texture_float)\r\n\r\n#endif /* GL_ATI_texture_float */\r\n\r\n/* ----------------------- GL_ATI_texture_mirror_once ---------------------- */\r\n\r\n#ifndef GL_ATI_texture_mirror_once\r\n#define GL_ATI_texture_mirror_once 1\r\n\r\n#define GL_MIRROR_CLAMP_ATI 0x8742\r\n#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743\r\n\r\n#define GLEW_ATI_texture_mirror_once GLEW_GET_VAR(__GLEW_ATI_texture_mirror_once)\r\n\r\n#endif /* GL_ATI_texture_mirror_once */\r\n\r\n/* ----------------------- GL_ATI_vertex_array_object ---------------------- */\r\n\r\n#ifndef GL_ATI_vertex_array_object\r\n#define GL_ATI_vertex_array_object 1\r\n\r\n#define GL_STATIC_ATI 0x8760\r\n#define GL_DYNAMIC_ATI 0x8761\r\n#define GL_PRESERVE_ATI 0x8762\r\n#define GL_DISCARD_ATI 0x8763\r\n#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764\r\n#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765\r\n#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766\r\n#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767\r\n\r\ntypedef void (GLAPIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\r\ntypedef void (GLAPIENTRY * PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);\r\ntypedef GLuint (GLAPIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void* pointer, GLenum usage);\r\ntypedef void (GLAPIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void* pointer, GLenum preserve);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\r\n\r\n#define glArrayObjectATI GLEW_GET_FUN(__glewArrayObjectATI)\r\n#define glFreeObjectBufferATI GLEW_GET_FUN(__glewFreeObjectBufferATI)\r\n#define glGetArrayObjectfvATI GLEW_GET_FUN(__glewGetArrayObjectfvATI)\r\n#define glGetArrayObjectivATI GLEW_GET_FUN(__glewGetArrayObjectivATI)\r\n#define glGetObjectBufferfvATI GLEW_GET_FUN(__glewGetObjectBufferfvATI)\r\n#define glGetObjectBufferivATI GLEW_GET_FUN(__glewGetObjectBufferivATI)\r\n#define glGetVariantArrayObjectfvATI GLEW_GET_FUN(__glewGetVariantArrayObjectfvATI)\r\n#define glGetVariantArrayObjectivATI GLEW_GET_FUN(__glewGetVariantArrayObjectivATI)\r\n#define glIsObjectBufferATI GLEW_GET_FUN(__glewIsObjectBufferATI)\r\n#define glNewObjectBufferATI GLEW_GET_FUN(__glewNewObjectBufferATI)\r\n#define glUpdateObjectBufferATI GLEW_GET_FUN(__glewUpdateObjectBufferATI)\r\n#define glVariantArrayObjectATI GLEW_GET_FUN(__glewVariantArrayObjectATI)\r\n\r\n#define GLEW_ATI_vertex_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_array_object)\r\n\r\n#endif /* GL_ATI_vertex_array_object */\r\n\r\n/* ------------------- GL_ATI_vertex_attrib_array_object ------------------- */\r\n\r\n#ifndef GL_ATI_vertex_attrib_array_object\r\n#define GL_ATI_vertex_attrib_array_object 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);\r\n\r\n#define glGetVertexAttribArrayObjectfvATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectfvATI)\r\n#define glGetVertexAttribArrayObjectivATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectivATI)\r\n#define glVertexAttribArrayObjectATI GLEW_GET_FUN(__glewVertexAttribArrayObjectATI)\r\n\r\n#define GLEW_ATI_vertex_attrib_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_attrib_array_object)\r\n\r\n#endif /* GL_ATI_vertex_attrib_array_object */\r\n\r\n/* ------------------------- GL_ATI_vertex_streams ------------------------- */\r\n\r\n#ifndef GL_ATI_vertex_streams\r\n#define GL_ATI_vertex_streams 1\r\n\r\n#define GL_MAX_VERTEX_STREAMS_ATI 0x876B\r\n#define GL_VERTEX_SOURCE_ATI 0x876C\r\n#define GL_VERTEX_STREAM0_ATI 0x876D\r\n#define GL_VERTEX_STREAM1_ATI 0x876E\r\n#define GL_VERTEX_STREAM2_ATI 0x876F\r\n#define GL_VERTEX_STREAM3_ATI 0x8770\r\n#define GL_VERTEX_STREAM4_ATI 0x8771\r\n#define GL_VERTEX_STREAM5_ATI 0x8772\r\n#define GL_VERTEX_STREAM6_ATI 0x8773\r\n#define GL_VERTEX_STREAM7_ATI 0x8774\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);\r\n\r\n#define glClientActiveVertexStreamATI GLEW_GET_FUN(__glewClientActiveVertexStreamATI)\r\n#define glNormalStream3bATI GLEW_GET_FUN(__glewNormalStream3bATI)\r\n#define glNormalStream3bvATI GLEW_GET_FUN(__glewNormalStream3bvATI)\r\n#define glNormalStream3dATI GLEW_GET_FUN(__glewNormalStream3dATI)\r\n#define glNormalStream3dvATI GLEW_GET_FUN(__glewNormalStream3dvATI)\r\n#define glNormalStream3fATI GLEW_GET_FUN(__glewNormalStream3fATI)\r\n#define glNormalStream3fvATI GLEW_GET_FUN(__glewNormalStream3fvATI)\r\n#define glNormalStream3iATI GLEW_GET_FUN(__glewNormalStream3iATI)\r\n#define glNormalStream3ivATI GLEW_GET_FUN(__glewNormalStream3ivATI)\r\n#define glNormalStream3sATI GLEW_GET_FUN(__glewNormalStream3sATI)\r\n#define glNormalStream3svATI GLEW_GET_FUN(__glewNormalStream3svATI)\r\n#define glVertexBlendEnvfATI GLEW_GET_FUN(__glewVertexBlendEnvfATI)\r\n#define glVertexBlendEnviATI GLEW_GET_FUN(__glewVertexBlendEnviATI)\r\n#define glVertexStream1dATI GLEW_GET_FUN(__glewVertexStream1dATI)\r\n#define glVertexStream1dvATI GLEW_GET_FUN(__glewVertexStream1dvATI)\r\n#define glVertexStream1fATI GLEW_GET_FUN(__glewVertexStream1fATI)\r\n#define glVertexStream1fvATI GLEW_GET_FUN(__glewVertexStream1fvATI)\r\n#define glVertexStream1iATI GLEW_GET_FUN(__glewVertexStream1iATI)\r\n#define glVertexStream1ivATI GLEW_GET_FUN(__glewVertexStream1ivATI)\r\n#define glVertexStream1sATI GLEW_GET_FUN(__glewVertexStream1sATI)\r\n#define glVertexStream1svATI GLEW_GET_FUN(__glewVertexStream1svATI)\r\n#define glVertexStream2dATI GLEW_GET_FUN(__glewVertexStream2dATI)\r\n#define glVertexStream2dvATI GLEW_GET_FUN(__glewVertexStream2dvATI)\r\n#define glVertexStream2fATI GLEW_GET_FUN(__glewVertexStream2fATI)\r\n#define glVertexStream2fvATI GLEW_GET_FUN(__glewVertexStream2fvATI)\r\n#define glVertexStream2iATI GLEW_GET_FUN(__glewVertexStream2iATI)\r\n#define glVertexStream2ivATI GLEW_GET_FUN(__glewVertexStream2ivATI)\r\n#define glVertexStream2sATI GLEW_GET_FUN(__glewVertexStream2sATI)\r\n#define glVertexStream2svATI GLEW_GET_FUN(__glewVertexStream2svATI)\r\n#define glVertexStream3dATI GLEW_GET_FUN(__glewVertexStream3dATI)\r\n#define glVertexStream3dvATI GLEW_GET_FUN(__glewVertexStream3dvATI)\r\n#define glVertexStream3fATI GLEW_GET_FUN(__glewVertexStream3fATI)\r\n#define glVertexStream3fvATI GLEW_GET_FUN(__glewVertexStream3fvATI)\r\n#define glVertexStream3iATI GLEW_GET_FUN(__glewVertexStream3iATI)\r\n#define glVertexStream3ivATI GLEW_GET_FUN(__glewVertexStream3ivATI)\r\n#define glVertexStream3sATI GLEW_GET_FUN(__glewVertexStream3sATI)\r\n#define glVertexStream3svATI GLEW_GET_FUN(__glewVertexStream3svATI)\r\n#define glVertexStream4dATI GLEW_GET_FUN(__glewVertexStream4dATI)\r\n#define glVertexStream4dvATI GLEW_GET_FUN(__glewVertexStream4dvATI)\r\n#define glVertexStream4fATI GLEW_GET_FUN(__glewVertexStream4fATI)\r\n#define glVertexStream4fvATI GLEW_GET_FUN(__glewVertexStream4fvATI)\r\n#define glVertexStream4iATI GLEW_GET_FUN(__glewVertexStream4iATI)\r\n#define glVertexStream4ivATI GLEW_GET_FUN(__glewVertexStream4ivATI)\r\n#define glVertexStream4sATI GLEW_GET_FUN(__glewVertexStream4sATI)\r\n#define glVertexStream4svATI GLEW_GET_FUN(__glewVertexStream4svATI)\r\n\r\n#define GLEW_ATI_vertex_streams GLEW_GET_VAR(__GLEW_ATI_vertex_streams)\r\n\r\n#endif /* GL_ATI_vertex_streams */\r\n\r\n/* --------------------------- GL_EXT_422_pixels --------------------------- */\r\n\r\n#ifndef GL_EXT_422_pixels\r\n#define GL_EXT_422_pixels 1\r\n\r\n#define GL_422_EXT 0x80CC\r\n#define GL_422_REV_EXT 0x80CD\r\n#define GL_422_AVERAGE_EXT 0x80CE\r\n#define GL_422_REV_AVERAGE_EXT 0x80CF\r\n\r\n#define GLEW_EXT_422_pixels GLEW_GET_VAR(__GLEW_EXT_422_pixels)\r\n\r\n#endif /* GL_EXT_422_pixels */\r\n\r\n/* ---------------------------- GL_EXT_Cg_shader --------------------------- */\r\n\r\n#ifndef GL_EXT_Cg_shader\r\n#define GL_EXT_Cg_shader 1\r\n\r\n#define GL_CG_VERTEX_SHADER_EXT 0x890E\r\n#define GL_CG_FRAGMENT_SHADER_EXT 0x890F\r\n\r\n#define GLEW_EXT_Cg_shader GLEW_GET_VAR(__GLEW_EXT_Cg_shader)\r\n\r\n#endif /* GL_EXT_Cg_shader */\r\n\r\n/* ------------------------------ GL_EXT_abgr ------------------------------ */\r\n\r\n#ifndef GL_EXT_abgr\r\n#define GL_EXT_abgr 1\r\n\r\n#define GL_ABGR_EXT 0x8000\r\n\r\n#define GLEW_EXT_abgr GLEW_GET_VAR(__GLEW_EXT_abgr)\r\n\r\n#endif /* GL_EXT_abgr */\r\n\r\n/* ------------------------------ GL_EXT_bgra ------------------------------ */\r\n\r\n#ifndef GL_EXT_bgra\r\n#define GL_EXT_bgra 1\r\n\r\n#define GL_BGR_EXT 0x80E0\r\n#define GL_BGRA_EXT 0x80E1\r\n\r\n#define GLEW_EXT_bgra GLEW_GET_VAR(__GLEW_EXT_bgra)\r\n\r\n#endif /* GL_EXT_bgra */\r\n\r\n/* ------------------------ GL_EXT_bindable_uniform ------------------------ */\r\n\r\n#ifndef GL_EXT_bindable_uniform\r\n#define GL_EXT_bindable_uniform 1\r\n\r\n#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2\r\n#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3\r\n#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4\r\n#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED\r\n#define GL_UNIFORM_BUFFER_EXT 0x8DEE\r\n#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF\r\n\r\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);\r\ntypedef GLintptr (GLAPIENTRY * PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);\r\n\r\n#define glGetUniformBufferSizeEXT GLEW_GET_FUN(__glewGetUniformBufferSizeEXT)\r\n#define glGetUniformOffsetEXT GLEW_GET_FUN(__glewGetUniformOffsetEXT)\r\n#define glUniformBufferEXT GLEW_GET_FUN(__glewUniformBufferEXT)\r\n\r\n#define GLEW_EXT_bindable_uniform GLEW_GET_VAR(__GLEW_EXT_bindable_uniform)\r\n\r\n#endif /* GL_EXT_bindable_uniform */\r\n\r\n/* --------------------------- GL_EXT_blend_color -------------------------- */\r\n\r\n#ifndef GL_EXT_blend_color\r\n#define GL_EXT_blend_color 1\r\n\r\n#define GL_CONSTANT_COLOR_EXT 0x8001\r\n#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002\r\n#define GL_CONSTANT_ALPHA_EXT 0x8003\r\n#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004\r\n#define GL_BLEND_COLOR_EXT 0x8005\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\r\n#define glBlendColorEXT GLEW_GET_FUN(__glewBlendColorEXT)\r\n\r\n#define GLEW_EXT_blend_color GLEW_GET_VAR(__GLEW_EXT_blend_color)\r\n\r\n#endif /* GL_EXT_blend_color */\r\n\r\n/* --------------------- GL_EXT_blend_equation_separate -------------------- */\r\n\r\n#ifndef GL_EXT_blend_equation_separate\r\n#define GL_EXT_blend_equation_separate 1\r\n\r\n#define GL_BLEND_EQUATION_RGB_EXT 0x8009\r\n#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);\r\n\r\n#define glBlendEquationSeparateEXT GLEW_GET_FUN(__glewBlendEquationSeparateEXT)\r\n\r\n#define GLEW_EXT_blend_equation_separate GLEW_GET_VAR(__GLEW_EXT_blend_equation_separate)\r\n\r\n#endif /* GL_EXT_blend_equation_separate */\r\n\r\n/* ----------------------- GL_EXT_blend_func_separate ---------------------- */\r\n\r\n#ifndef GL_EXT_blend_func_separate\r\n#define GL_EXT_blend_func_separate 1\r\n\r\n#define GL_BLEND_DST_RGB_EXT 0x80C8\r\n#define GL_BLEND_SRC_RGB_EXT 0x80C9\r\n#define GL_BLEND_DST_ALPHA_EXT 0x80CA\r\n#define GL_BLEND_SRC_ALPHA_EXT 0x80CB\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\n\r\n#define glBlendFuncSeparateEXT GLEW_GET_FUN(__glewBlendFuncSeparateEXT)\r\n\r\n#define GLEW_EXT_blend_func_separate GLEW_GET_VAR(__GLEW_EXT_blend_func_separate)\r\n\r\n#endif /* GL_EXT_blend_func_separate */\r\n\r\n/* ------------------------- GL_EXT_blend_logic_op ------------------------- */\r\n\r\n#ifndef GL_EXT_blend_logic_op\r\n#define GL_EXT_blend_logic_op 1\r\n\r\n#define GLEW_EXT_blend_logic_op GLEW_GET_VAR(__GLEW_EXT_blend_logic_op)\r\n\r\n#endif /* GL_EXT_blend_logic_op */\r\n\r\n/* -------------------------- GL_EXT_blend_minmax -------------------------- */\r\n\r\n#ifndef GL_EXT_blend_minmax\r\n#define GL_EXT_blend_minmax 1\r\n\r\n#define GL_FUNC_ADD_EXT 0x8006\r\n#define GL_MIN_EXT 0x8007\r\n#define GL_MAX_EXT 0x8008\r\n#define GL_BLEND_EQUATION_EXT 0x8009\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);\r\n\r\n#define glBlendEquationEXT GLEW_GET_FUN(__glewBlendEquationEXT)\r\n\r\n#define GLEW_EXT_blend_minmax GLEW_GET_VAR(__GLEW_EXT_blend_minmax)\r\n\r\n#endif /* GL_EXT_blend_minmax */\r\n\r\n/* ------------------------- GL_EXT_blend_subtract ------------------------- */\r\n\r\n#ifndef GL_EXT_blend_subtract\r\n#define GL_EXT_blend_subtract 1\r\n\r\n#define GL_FUNC_SUBTRACT_EXT 0x800A\r\n#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B\r\n\r\n#define GLEW_EXT_blend_subtract GLEW_GET_VAR(__GLEW_EXT_blend_subtract)\r\n\r\n#endif /* GL_EXT_blend_subtract */\r\n\r\n/* ------------------------ GL_EXT_clip_volume_hint ------------------------ */\r\n\r\n#ifndef GL_EXT_clip_volume_hint\r\n#define GL_EXT_clip_volume_hint 1\r\n\r\n#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0\r\n\r\n#define GLEW_EXT_clip_volume_hint GLEW_GET_VAR(__GLEW_EXT_clip_volume_hint)\r\n\r\n#endif /* GL_EXT_clip_volume_hint */\r\n\r\n/* ------------------------------ GL_EXT_cmyka ----------------------------- */\r\n\r\n#ifndef GL_EXT_cmyka\r\n#define GL_EXT_cmyka 1\r\n\r\n#define GL_CMYK_EXT 0x800C\r\n#define GL_CMYKA_EXT 0x800D\r\n#define GL_PACK_CMYK_HINT_EXT 0x800E\r\n#define GL_UNPACK_CMYK_HINT_EXT 0x800F\r\n\r\n#define GLEW_EXT_cmyka GLEW_GET_VAR(__GLEW_EXT_cmyka)\r\n\r\n#endif /* GL_EXT_cmyka */\r\n\r\n/* ------------------------- GL_EXT_color_subtable ------------------------- */\r\n\r\n#ifndef GL_EXT_color_subtable\r\n#define GL_EXT_color_subtable 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\r\n\r\n#define glColorSubTableEXT GLEW_GET_FUN(__glewColorSubTableEXT)\r\n#define glCopyColorSubTableEXT GLEW_GET_FUN(__glewCopyColorSubTableEXT)\r\n\r\n#define GLEW_EXT_color_subtable GLEW_GET_VAR(__GLEW_EXT_color_subtable)\r\n\r\n#endif /* GL_EXT_color_subtable */\r\n\r\n/* ---------------------- GL_EXT_compiled_vertex_array --------------------- */\r\n\r\n#ifndef GL_EXT_compiled_vertex_array\r\n#define GL_EXT_compiled_vertex_array 1\r\n\r\n#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8\r\n#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9\r\n\r\ntypedef void (GLAPIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);\r\ntypedef void (GLAPIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);\r\n\r\n#define glLockArraysEXT GLEW_GET_FUN(__glewLockArraysEXT)\r\n#define glUnlockArraysEXT GLEW_GET_FUN(__glewUnlockArraysEXT)\r\n\r\n#define GLEW_EXT_compiled_vertex_array GLEW_GET_VAR(__GLEW_EXT_compiled_vertex_array)\r\n\r\n#endif /* GL_EXT_compiled_vertex_array */\r\n\r\n/* --------------------------- GL_EXT_convolution -------------------------- */\r\n\r\n#ifndef GL_EXT_convolution\r\n#define GL_EXT_convolution 1\r\n\r\n#define GL_CONVOLUTION_1D_EXT 0x8010\r\n#define GL_CONVOLUTION_2D_EXT 0x8011\r\n#define GL_SEPARABLE_2D_EXT 0x8012\r\n#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013\r\n#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014\r\n#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015\r\n#define GL_REDUCE_EXT 0x8016\r\n#define GL_CONVOLUTION_FORMAT_EXT 0x8017\r\n#define GL_CONVOLUTION_WIDTH_EXT 0x8018\r\n#define GL_CONVOLUTION_HEIGHT_EXT 0x8019\r\n#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A\r\n#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B\r\n#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C\r\n#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D\r\n#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E\r\n#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F\r\n#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020\r\n#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021\r\n#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022\r\n#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* image);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* image);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* image);\r\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* row, void* column, void* span);\r\ntypedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* row, const void* column);\r\n\r\n#define glConvolutionFilter1DEXT GLEW_GET_FUN(__glewConvolutionFilter1DEXT)\r\n#define glConvolutionFilter2DEXT GLEW_GET_FUN(__glewConvolutionFilter2DEXT)\r\n#define glConvolutionParameterfEXT GLEW_GET_FUN(__glewConvolutionParameterfEXT)\r\n#define glConvolutionParameterfvEXT GLEW_GET_FUN(__glewConvolutionParameterfvEXT)\r\n#define glConvolutionParameteriEXT GLEW_GET_FUN(__glewConvolutionParameteriEXT)\r\n#define glConvolutionParameterivEXT GLEW_GET_FUN(__glewConvolutionParameterivEXT)\r\n#define glCopyConvolutionFilter1DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter1DEXT)\r\n#define glCopyConvolutionFilter2DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter2DEXT)\r\n#define glGetConvolutionFilterEXT GLEW_GET_FUN(__glewGetConvolutionFilterEXT)\r\n#define glGetConvolutionParameterfvEXT GLEW_GET_FUN(__glewGetConvolutionParameterfvEXT)\r\n#define glGetConvolutionParameterivEXT GLEW_GET_FUN(__glewGetConvolutionParameterivEXT)\r\n#define glGetSeparableFilterEXT GLEW_GET_FUN(__glewGetSeparableFilterEXT)\r\n#define glSeparableFilter2DEXT GLEW_GET_FUN(__glewSeparableFilter2DEXT)\r\n\r\n#define GLEW_EXT_convolution GLEW_GET_VAR(__GLEW_EXT_convolution)\r\n\r\n#endif /* GL_EXT_convolution */\r\n\r\n/* ------------------------ GL_EXT_coordinate_frame ------------------------ */\r\n\r\n#ifndef GL_EXT_coordinate_frame\r\n#define GL_EXT_coordinate_frame 1\r\n\r\n#define GL_TANGENT_ARRAY_EXT 0x8439\r\n#define GL_BINORMAL_ARRAY_EXT 0x843A\r\n#define GL_CURRENT_TANGENT_EXT 0x843B\r\n#define GL_CURRENT_BINORMAL_EXT 0x843C\r\n#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E\r\n#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F\r\n#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440\r\n#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441\r\n#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442\r\n#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443\r\n#define GL_MAP1_TANGENT_EXT 0x8444\r\n#define GL_MAP2_TANGENT_EXT 0x8445\r\n#define GL_MAP1_BINORMAL_EXT 0x8446\r\n#define GL_MAP2_BINORMAL_EXT 0x8447\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer);\r\n\r\n#define glBinormalPointerEXT GLEW_GET_FUN(__glewBinormalPointerEXT)\r\n#define glTangentPointerEXT GLEW_GET_FUN(__glewTangentPointerEXT)\r\n\r\n#define GLEW_EXT_coordinate_frame GLEW_GET_VAR(__GLEW_EXT_coordinate_frame)\r\n\r\n#endif /* GL_EXT_coordinate_frame */\r\n\r\n/* -------------------------- GL_EXT_copy_texture -------------------------- */\r\n\r\n#ifndef GL_EXT_copy_texture\r\n#define GL_EXT_copy_texture 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\r\n#define glCopyTexImage1DEXT GLEW_GET_FUN(__glewCopyTexImage1DEXT)\r\n#define glCopyTexImage2DEXT GLEW_GET_FUN(__glewCopyTexImage2DEXT)\r\n#define glCopyTexSubImage1DEXT GLEW_GET_FUN(__glewCopyTexSubImage1DEXT)\r\n#define glCopyTexSubImage2DEXT GLEW_GET_FUN(__glewCopyTexSubImage2DEXT)\r\n#define glCopyTexSubImage3DEXT GLEW_GET_FUN(__glewCopyTexSubImage3DEXT)\r\n\r\n#define GLEW_EXT_copy_texture GLEW_GET_VAR(__GLEW_EXT_copy_texture)\r\n\r\n#endif /* GL_EXT_copy_texture */\r\n\r\n/* --------------------------- GL_EXT_cull_vertex -------------------------- */\r\n\r\n#ifndef GL_EXT_cull_vertex\r\n#define GL_EXT_cull_vertex 1\r\n\r\n#define GL_CULL_VERTEX_EXT 0x81AA\r\n#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB\r\n#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params);\r\n\r\n#define glCullParameterdvEXT GLEW_GET_FUN(__glewCullParameterdvEXT)\r\n#define glCullParameterfvEXT GLEW_GET_FUN(__glewCullParameterfvEXT)\r\n\r\n#define GLEW_EXT_cull_vertex GLEW_GET_VAR(__GLEW_EXT_cull_vertex)\r\n\r\n#endif /* GL_EXT_cull_vertex */\r\n\r\n/* -------------------------- GL_EXT_debug_marker -------------------------- */\r\n\r\n#ifndef GL_EXT_debug_marker\r\n#define GL_EXT_debug_marker 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker);\r\ntypedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker);\r\n\r\n#define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT)\r\n#define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT)\r\n#define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT)\r\n\r\n#define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker)\r\n\r\n#endif /* GL_EXT_debug_marker */\r\n\r\n/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */\r\n\r\n#ifndef GL_EXT_depth_bounds_test\r\n#define GL_EXT_depth_bounds_test 1\r\n\r\n#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890\r\n#define GL_DEPTH_BOUNDS_EXT 0x8891\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);\r\n\r\n#define glDepthBoundsEXT GLEW_GET_FUN(__glewDepthBoundsEXT)\r\n\r\n#define GLEW_EXT_depth_bounds_test GLEW_GET_VAR(__GLEW_EXT_depth_bounds_test)\r\n\r\n#endif /* GL_EXT_depth_bounds_test */\r\n\r\n/* ----------------------- GL_EXT_direct_state_access ---------------------- */\r\n\r\n#ifndef GL_EXT_direct_state_access\r\n#define GL_EXT_direct_state_access 1\r\n\r\n#define GL_PROGRAM_MATRIX_EXT 0x8E2D\r\n#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E\r\n#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);\r\ntypedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);\r\ntypedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, void* img);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, void* img);\r\ntypedef void (GLAPIENTRY * PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* param);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void** params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void* string);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid** params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, GLvoid** params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint* param);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLvoid** param);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, GLvoid** param);\r\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);\r\ntypedef GLvoid * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXFRUSTUMEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum matrixMode);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADDEXTPROC) (GLenum matrixMode, const GLdouble* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXLOADFEXTPROC) (GLenum matrixMode, const GLfloat* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTDEXTPROC) (GLenum matrixMode, const GLdouble* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXMULTFEXTPROC) (GLenum matrixMode, const GLfloat* m);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXORTHOEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXPOPEXTPROC) (GLenum matrixMode);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXPUSHEXTPROC) (GLenum matrixMode);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXROTATEDEXTPROC) (GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXROTATEFEXTPROC) (GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXSCALEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXSCALEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* param);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void* data, GLenum usage);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void* string);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat* param);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* param);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\n\r\n#define glBindMultiTextureEXT GLEW_GET_FUN(__glewBindMultiTextureEXT)\r\n#define glCheckNamedFramebufferStatusEXT GLEW_GET_FUN(__glewCheckNamedFramebufferStatusEXT)\r\n#define glClientAttribDefaultEXT GLEW_GET_FUN(__glewClientAttribDefaultEXT)\r\n#define glCompressedMultiTexImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage1DEXT)\r\n#define glCompressedMultiTexImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage2DEXT)\r\n#define glCompressedMultiTexImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage3DEXT)\r\n#define glCompressedMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage1DEXT)\r\n#define glCompressedMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage2DEXT)\r\n#define glCompressedMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage3DEXT)\r\n#define glCompressedTextureImage1DEXT GLEW_GET_FUN(__glewCompressedTextureImage1DEXT)\r\n#define glCompressedTextureImage2DEXT GLEW_GET_FUN(__glewCompressedTextureImage2DEXT)\r\n#define glCompressedTextureImage3DEXT GLEW_GET_FUN(__glewCompressedTextureImage3DEXT)\r\n#define glCompressedTextureSubImage1DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage1DEXT)\r\n#define glCompressedTextureSubImage2DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage2DEXT)\r\n#define glCompressedTextureSubImage3DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage3DEXT)\r\n#define glCopyMultiTexImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexImage1DEXT)\r\n#define glCopyMultiTexImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexImage2DEXT)\r\n#define glCopyMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage1DEXT)\r\n#define glCopyMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage2DEXT)\r\n#define glCopyMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage3DEXT)\r\n#define glCopyTextureImage1DEXT GLEW_GET_FUN(__glewCopyTextureImage1DEXT)\r\n#define glCopyTextureImage2DEXT GLEW_GET_FUN(__glewCopyTextureImage2DEXT)\r\n#define glCopyTextureSubImage1DEXT GLEW_GET_FUN(__glewCopyTextureSubImage1DEXT)\r\n#define glCopyTextureSubImage2DEXT GLEW_GET_FUN(__glewCopyTextureSubImage2DEXT)\r\n#define glCopyTextureSubImage3DEXT GLEW_GET_FUN(__glewCopyTextureSubImage3DEXT)\r\n#define glDisableClientStateIndexedEXT GLEW_GET_FUN(__glewDisableClientStateIndexedEXT)\r\n#define glDisableClientStateiEXT GLEW_GET_FUN(__glewDisableClientStateiEXT)\r\n#define glDisableVertexArrayAttribEXT GLEW_GET_FUN(__glewDisableVertexArrayAttribEXT)\r\n#define glDisableVertexArrayEXT GLEW_GET_FUN(__glewDisableVertexArrayEXT)\r\n#define glEnableClientStateIndexedEXT GLEW_GET_FUN(__glewEnableClientStateIndexedEXT)\r\n#define glEnableClientStateiEXT GLEW_GET_FUN(__glewEnableClientStateiEXT)\r\n#define glEnableVertexArrayAttribEXT GLEW_GET_FUN(__glewEnableVertexArrayAttribEXT)\r\n#define glEnableVertexArrayEXT GLEW_GET_FUN(__glewEnableVertexArrayEXT)\r\n#define glFlushMappedNamedBufferRangeEXT GLEW_GET_FUN(__glewFlushMappedNamedBufferRangeEXT)\r\n#define glFramebufferDrawBufferEXT GLEW_GET_FUN(__glewFramebufferDrawBufferEXT)\r\n#define glFramebufferDrawBuffersEXT GLEW_GET_FUN(__glewFramebufferDrawBuffersEXT)\r\n#define glFramebufferReadBufferEXT GLEW_GET_FUN(__glewFramebufferReadBufferEXT)\r\n#define glGenerateMultiTexMipmapEXT GLEW_GET_FUN(__glewGenerateMultiTexMipmapEXT)\r\n#define glGenerateTextureMipmapEXT GLEW_GET_FUN(__glewGenerateTextureMipmapEXT)\r\n#define glGetCompressedMultiTexImageEXT GLEW_GET_FUN(__glewGetCompressedMultiTexImageEXT)\r\n#define glGetCompressedTextureImageEXT GLEW_GET_FUN(__glewGetCompressedTextureImageEXT)\r\n#define glGetDoubleIndexedvEXT GLEW_GET_FUN(__glewGetDoubleIndexedvEXT)\r\n#define glGetDoublei_vEXT GLEW_GET_FUN(__glewGetDoublei_vEXT)\r\n#define glGetFloatIndexedvEXT GLEW_GET_FUN(__glewGetFloatIndexedvEXT)\r\n#define glGetFloati_vEXT GLEW_GET_FUN(__glewGetFloati_vEXT)\r\n#define glGetFramebufferParameterivEXT GLEW_GET_FUN(__glewGetFramebufferParameterivEXT)\r\n#define glGetMultiTexEnvfvEXT GLEW_GET_FUN(__glewGetMultiTexEnvfvEXT)\r\n#define glGetMultiTexEnvivEXT GLEW_GET_FUN(__glewGetMultiTexEnvivEXT)\r\n#define glGetMultiTexGendvEXT GLEW_GET_FUN(__glewGetMultiTexGendvEXT)\r\n#define glGetMultiTexGenfvEXT GLEW_GET_FUN(__glewGetMultiTexGenfvEXT)\r\n#define glGetMultiTexGenivEXT GLEW_GET_FUN(__glewGetMultiTexGenivEXT)\r\n#define glGetMultiTexImageEXT GLEW_GET_FUN(__glewGetMultiTexImageEXT)\r\n#define glGetMultiTexLevelParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterfvEXT)\r\n#define glGetMultiTexLevelParameterivEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterivEXT)\r\n#define glGetMultiTexParameterIivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIivEXT)\r\n#define glGetMultiTexParameterIuivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIuivEXT)\r\n#define glGetMultiTexParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexParameterfvEXT)\r\n#define glGetMultiTexParameterivEXT GLEW_GET_FUN(__glewGetMultiTexParameterivEXT)\r\n#define glGetNamedBufferParameterivEXT GLEW_GET_FUN(__glewGetNamedBufferParameterivEXT)\r\n#define glGetNamedBufferPointervEXT GLEW_GET_FUN(__glewGetNamedBufferPointervEXT)\r\n#define glGetNamedBufferSubDataEXT GLEW_GET_FUN(__glewGetNamedBufferSubDataEXT)\r\n#define glGetNamedFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameterivEXT)\r\n#define glGetNamedProgramLocalParameterIivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIivEXT)\r\n#define glGetNamedProgramLocalParameterIuivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIuivEXT)\r\n#define glGetNamedProgramLocalParameterdvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterdvEXT)\r\n#define glGetNamedProgramLocalParameterfvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterfvEXT)\r\n#define glGetNamedProgramStringEXT GLEW_GET_FUN(__glewGetNamedProgramStringEXT)\r\n#define glGetNamedProgramivEXT GLEW_GET_FUN(__glewGetNamedProgramivEXT)\r\n#define glGetNamedRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetNamedRenderbufferParameterivEXT)\r\n#define glGetPointerIndexedvEXT GLEW_GET_FUN(__glewGetPointerIndexedvEXT)\r\n#define glGetPointeri_vEXT GLEW_GET_FUN(__glewGetPointeri_vEXT)\r\n#define glGetTextureImageEXT GLEW_GET_FUN(__glewGetTextureImageEXT)\r\n#define glGetTextureLevelParameterfvEXT GLEW_GET_FUN(__glewGetTextureLevelParameterfvEXT)\r\n#define glGetTextureLevelParameterivEXT GLEW_GET_FUN(__glewGetTextureLevelParameterivEXT)\r\n#define glGetTextureParameterIivEXT GLEW_GET_FUN(__glewGetTextureParameterIivEXT)\r\n#define glGetTextureParameterIuivEXT GLEW_GET_FUN(__glewGetTextureParameterIuivEXT)\r\n#define glGetTextureParameterfvEXT GLEW_GET_FUN(__glewGetTextureParameterfvEXT)\r\n#define glGetTextureParameterivEXT GLEW_GET_FUN(__glewGetTextureParameterivEXT)\r\n#define glGetVertexArrayIntegeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayIntegeri_vEXT)\r\n#define glGetVertexArrayIntegervEXT GLEW_GET_FUN(__glewGetVertexArrayIntegervEXT)\r\n#define glGetVertexArrayPointeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayPointeri_vEXT)\r\n#define glGetVertexArrayPointervEXT GLEW_GET_FUN(__glewGetVertexArrayPointervEXT)\r\n#define glMapNamedBufferEXT GLEW_GET_FUN(__glewMapNamedBufferEXT)\r\n#define glMapNamedBufferRangeEXT GLEW_GET_FUN(__glewMapNamedBufferRangeEXT)\r\n#define glMatrixFrustumEXT GLEW_GET_FUN(__glewMatrixFrustumEXT)\r\n#define glMatrixLoadIdentityEXT GLEW_GET_FUN(__glewMatrixLoadIdentityEXT)\r\n#define glMatrixLoadTransposedEXT GLEW_GET_FUN(__glewMatrixLoadTransposedEXT)\r\n#define glMatrixLoadTransposefEXT GLEW_GET_FUN(__glewMatrixLoadTransposefEXT)\r\n#define glMatrixLoaddEXT GLEW_GET_FUN(__glewMatrixLoaddEXT)\r\n#define glMatrixLoadfEXT GLEW_GET_FUN(__glewMatrixLoadfEXT)\r\n#define glMatrixMultTransposedEXT GLEW_GET_FUN(__glewMatrixMultTransposedEXT)\r\n#define glMatrixMultTransposefEXT GLEW_GET_FUN(__glewMatrixMultTransposefEXT)\r\n#define glMatrixMultdEXT GLEW_GET_FUN(__glewMatrixMultdEXT)\r\n#define glMatrixMultfEXT GLEW_GET_FUN(__glewMatrixMultfEXT)\r\n#define glMatrixOrthoEXT GLEW_GET_FUN(__glewMatrixOrthoEXT)\r\n#define glMatrixPopEXT GLEW_GET_FUN(__glewMatrixPopEXT)\r\n#define glMatrixPushEXT GLEW_GET_FUN(__glewMatrixPushEXT)\r\n#define glMatrixRotatedEXT GLEW_GET_FUN(__glewMatrixRotatedEXT)\r\n#define glMatrixRotatefEXT GLEW_GET_FUN(__glewMatrixRotatefEXT)\r\n#define glMatrixScaledEXT GLEW_GET_FUN(__glewMatrixScaledEXT)\r\n#define glMatrixScalefEXT GLEW_GET_FUN(__glewMatrixScalefEXT)\r\n#define glMatrixTranslatedEXT GLEW_GET_FUN(__glewMatrixTranslatedEXT)\r\n#define glMatrixTranslatefEXT GLEW_GET_FUN(__glewMatrixTranslatefEXT)\r\n#define glMultiTexBufferEXT GLEW_GET_FUN(__glewMultiTexBufferEXT)\r\n#define glMultiTexCoordPointerEXT GLEW_GET_FUN(__glewMultiTexCoordPointerEXT)\r\n#define glMultiTexEnvfEXT GLEW_GET_FUN(__glewMultiTexEnvfEXT)\r\n#define glMultiTexEnvfvEXT GLEW_GET_FUN(__glewMultiTexEnvfvEXT)\r\n#define glMultiTexEnviEXT GLEW_GET_FUN(__glewMultiTexEnviEXT)\r\n#define glMultiTexEnvivEXT GLEW_GET_FUN(__glewMultiTexEnvivEXT)\r\n#define glMultiTexGendEXT GLEW_GET_FUN(__glewMultiTexGendEXT)\r\n#define glMultiTexGendvEXT GLEW_GET_FUN(__glewMultiTexGendvEXT)\r\n#define glMultiTexGenfEXT GLEW_GET_FUN(__glewMultiTexGenfEXT)\r\n#define glMultiTexGenfvEXT GLEW_GET_FUN(__glewMultiTexGenfvEXT)\r\n#define glMultiTexGeniEXT GLEW_GET_FUN(__glewMultiTexGeniEXT)\r\n#define glMultiTexGenivEXT GLEW_GET_FUN(__glewMultiTexGenivEXT)\r\n#define glMultiTexImage1DEXT GLEW_GET_FUN(__glewMultiTexImage1DEXT)\r\n#define glMultiTexImage2DEXT GLEW_GET_FUN(__glewMultiTexImage2DEXT)\r\n#define glMultiTexImage3DEXT GLEW_GET_FUN(__glewMultiTexImage3DEXT)\r\n#define glMultiTexParameterIivEXT GLEW_GET_FUN(__glewMultiTexParameterIivEXT)\r\n#define glMultiTexParameterIuivEXT GLEW_GET_FUN(__glewMultiTexParameterIuivEXT)\r\n#define glMultiTexParameterfEXT GLEW_GET_FUN(__glewMultiTexParameterfEXT)\r\n#define glMultiTexParameterfvEXT GLEW_GET_FUN(__glewMultiTexParameterfvEXT)\r\n#define glMultiTexParameteriEXT GLEW_GET_FUN(__glewMultiTexParameteriEXT)\r\n#define glMultiTexParameterivEXT GLEW_GET_FUN(__glewMultiTexParameterivEXT)\r\n#define glMultiTexRenderbufferEXT GLEW_GET_FUN(__glewMultiTexRenderbufferEXT)\r\n#define glMultiTexSubImage1DEXT GLEW_GET_FUN(__glewMultiTexSubImage1DEXT)\r\n#define glMultiTexSubImage2DEXT GLEW_GET_FUN(__glewMultiTexSubImage2DEXT)\r\n#define glMultiTexSubImage3DEXT GLEW_GET_FUN(__glewMultiTexSubImage3DEXT)\r\n#define glNamedBufferDataEXT GLEW_GET_FUN(__glewNamedBufferDataEXT)\r\n#define glNamedBufferSubDataEXT GLEW_GET_FUN(__glewNamedBufferSubDataEXT)\r\n#define glNamedCopyBufferSubDataEXT GLEW_GET_FUN(__glewNamedCopyBufferSubDataEXT)\r\n#define glNamedFramebufferRenderbufferEXT GLEW_GET_FUN(__glewNamedFramebufferRenderbufferEXT)\r\n#define glNamedFramebufferTexture1DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture1DEXT)\r\n#define glNamedFramebufferTexture2DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture2DEXT)\r\n#define glNamedFramebufferTexture3DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture3DEXT)\r\n#define glNamedFramebufferTextureEXT GLEW_GET_FUN(__glewNamedFramebufferTextureEXT)\r\n#define glNamedFramebufferTextureFaceEXT GLEW_GET_FUN(__glewNamedFramebufferTextureFaceEXT)\r\n#define glNamedFramebufferTextureLayerEXT GLEW_GET_FUN(__glewNamedFramebufferTextureLayerEXT)\r\n#define glNamedProgramLocalParameter4dEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dEXT)\r\n#define glNamedProgramLocalParameter4dvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dvEXT)\r\n#define glNamedProgramLocalParameter4fEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fEXT)\r\n#define glNamedProgramLocalParameter4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fvEXT)\r\n#define glNamedProgramLocalParameterI4iEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4iEXT)\r\n#define glNamedProgramLocalParameterI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4ivEXT)\r\n#define glNamedProgramLocalParameterI4uiEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uiEXT)\r\n#define glNamedProgramLocalParameterI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uivEXT)\r\n#define glNamedProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameters4fvEXT)\r\n#define glNamedProgramLocalParametersI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4ivEXT)\r\n#define glNamedProgramLocalParametersI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4uivEXT)\r\n#define glNamedProgramStringEXT GLEW_GET_FUN(__glewNamedProgramStringEXT)\r\n#define glNamedRenderbufferStorageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageEXT)\r\n#define glNamedRenderbufferStorageMultisampleCoverageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleCoverageEXT)\r\n#define glNamedRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleEXT)\r\n#define glProgramUniform1dEXT GLEW_GET_FUN(__glewProgramUniform1dEXT)\r\n#define glProgramUniform1dvEXT GLEW_GET_FUN(__glewProgramUniform1dvEXT)\r\n#define glProgramUniform1fEXT GLEW_GET_FUN(__glewProgramUniform1fEXT)\r\n#define glProgramUniform1fvEXT GLEW_GET_FUN(__glewProgramUniform1fvEXT)\r\n#define glProgramUniform1iEXT GLEW_GET_FUN(__glewProgramUniform1iEXT)\r\n#define glProgramUniform1ivEXT GLEW_GET_FUN(__glewProgramUniform1ivEXT)\r\n#define glProgramUniform1uiEXT GLEW_GET_FUN(__glewProgramUniform1uiEXT)\r\n#define glProgramUniform1uivEXT GLEW_GET_FUN(__glewProgramUniform1uivEXT)\r\n#define glProgramUniform2dEXT GLEW_GET_FUN(__glewProgramUniform2dEXT)\r\n#define glProgramUniform2dvEXT GLEW_GET_FUN(__glewProgramUniform2dvEXT)\r\n#define glProgramUniform2fEXT GLEW_GET_FUN(__glewProgramUniform2fEXT)\r\n#define glProgramUniform2fvEXT GLEW_GET_FUN(__glewProgramUniform2fvEXT)\r\n#define glProgramUniform2iEXT GLEW_GET_FUN(__glewProgramUniform2iEXT)\r\n#define glProgramUniform2ivEXT GLEW_GET_FUN(__glewProgramUniform2ivEXT)\r\n#define glProgramUniform2uiEXT GLEW_GET_FUN(__glewProgramUniform2uiEXT)\r\n#define glProgramUniform2uivEXT GLEW_GET_FUN(__glewProgramUniform2uivEXT)\r\n#define glProgramUniform3dEXT GLEW_GET_FUN(__glewProgramUniform3dEXT)\r\n#define glProgramUniform3dvEXT GLEW_GET_FUN(__glewProgramUniform3dvEXT)\r\n#define glProgramUniform3fEXT GLEW_GET_FUN(__glewProgramUniform3fEXT)\r\n#define glProgramUniform3fvEXT GLEW_GET_FUN(__glewProgramUniform3fvEXT)\r\n#define glProgramUniform3iEXT GLEW_GET_FUN(__glewProgramUniform3iEXT)\r\n#define glProgramUniform3ivEXT GLEW_GET_FUN(__glewProgramUniform3ivEXT)\r\n#define glProgramUniform3uiEXT GLEW_GET_FUN(__glewProgramUniform3uiEXT)\r\n#define glProgramUniform3uivEXT GLEW_GET_FUN(__glewProgramUniform3uivEXT)\r\n#define glProgramUniform4dEXT GLEW_GET_FUN(__glewProgramUniform4dEXT)\r\n#define glProgramUniform4dvEXT GLEW_GET_FUN(__glewProgramUniform4dvEXT)\r\n#define glProgramUniform4fEXT GLEW_GET_FUN(__glewProgramUniform4fEXT)\r\n#define glProgramUniform4fvEXT GLEW_GET_FUN(__glewProgramUniform4fvEXT)\r\n#define glProgramUniform4iEXT GLEW_GET_FUN(__glewProgramUniform4iEXT)\r\n#define glProgramUniform4ivEXT GLEW_GET_FUN(__glewProgramUniform4ivEXT)\r\n#define glProgramUniform4uiEXT GLEW_GET_FUN(__glewProgramUniform4uiEXT)\r\n#define glProgramUniform4uivEXT GLEW_GET_FUN(__glewProgramUniform4uivEXT)\r\n#define glProgramUniformMatrix2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2dvEXT)\r\n#define glProgramUniformMatrix2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2fvEXT)\r\n#define glProgramUniformMatrix2x3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3dvEXT)\r\n#define glProgramUniformMatrix2x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3fvEXT)\r\n#define glProgramUniformMatrix2x4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4dvEXT)\r\n#define glProgramUniformMatrix2x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4fvEXT)\r\n#define glProgramUniformMatrix3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3dvEXT)\r\n#define glProgramUniformMatrix3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3fvEXT)\r\n#define glProgramUniformMatrix3x2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2dvEXT)\r\n#define glProgramUniformMatrix3x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2fvEXT)\r\n#define glProgramUniformMatrix3x4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4dvEXT)\r\n#define glProgramUniformMatrix3x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4fvEXT)\r\n#define glProgramUniformMatrix4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4dvEXT)\r\n#define glProgramUniformMatrix4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4fvEXT)\r\n#define glProgramUniformMatrix4x2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2dvEXT)\r\n#define glProgramUniformMatrix4x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2fvEXT)\r\n#define glProgramUniformMatrix4x3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3dvEXT)\r\n#define glProgramUniformMatrix4x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3fvEXT)\r\n#define glPushClientAttribDefaultEXT GLEW_GET_FUN(__glewPushClientAttribDefaultEXT)\r\n#define glTextureBufferEXT GLEW_GET_FUN(__glewTextureBufferEXT)\r\n#define glTextureImage1DEXT GLEW_GET_FUN(__glewTextureImage1DEXT)\r\n#define glTextureImage2DEXT GLEW_GET_FUN(__glewTextureImage2DEXT)\r\n#define glTextureImage3DEXT GLEW_GET_FUN(__glewTextureImage3DEXT)\r\n#define glTextureParameterIivEXT GLEW_GET_FUN(__glewTextureParameterIivEXT)\r\n#define glTextureParameterIuivEXT GLEW_GET_FUN(__glewTextureParameterIuivEXT)\r\n#define glTextureParameterfEXT GLEW_GET_FUN(__glewTextureParameterfEXT)\r\n#define glTextureParameterfvEXT GLEW_GET_FUN(__glewTextureParameterfvEXT)\r\n#define glTextureParameteriEXT GLEW_GET_FUN(__glewTextureParameteriEXT)\r\n#define glTextureParameterivEXT GLEW_GET_FUN(__glewTextureParameterivEXT)\r\n#define glTextureRenderbufferEXT GLEW_GET_FUN(__glewTextureRenderbufferEXT)\r\n#define glTextureSubImage1DEXT GLEW_GET_FUN(__glewTextureSubImage1DEXT)\r\n#define glTextureSubImage2DEXT GLEW_GET_FUN(__glewTextureSubImage2DEXT)\r\n#define glTextureSubImage3DEXT GLEW_GET_FUN(__glewTextureSubImage3DEXT)\r\n#define glUnmapNamedBufferEXT GLEW_GET_FUN(__glewUnmapNamedBufferEXT)\r\n#define glVertexArrayColorOffsetEXT GLEW_GET_FUN(__glewVertexArrayColorOffsetEXT)\r\n#define glVertexArrayEdgeFlagOffsetEXT GLEW_GET_FUN(__glewVertexArrayEdgeFlagOffsetEXT)\r\n#define glVertexArrayFogCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayFogCoordOffsetEXT)\r\n#define glVertexArrayIndexOffsetEXT GLEW_GET_FUN(__glewVertexArrayIndexOffsetEXT)\r\n#define glVertexArrayMultiTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayMultiTexCoordOffsetEXT)\r\n#define glVertexArrayNormalOffsetEXT GLEW_GET_FUN(__glewVertexArrayNormalOffsetEXT)\r\n#define glVertexArraySecondaryColorOffsetEXT GLEW_GET_FUN(__glewVertexArraySecondaryColorOffsetEXT)\r\n#define glVertexArrayTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayTexCoordOffsetEXT)\r\n#define glVertexArrayVertexAttribIOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIOffsetEXT)\r\n#define glVertexArrayVertexAttribOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribOffsetEXT)\r\n#define glVertexArrayVertexOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexOffsetEXT)\r\n\r\n#define GLEW_EXT_direct_state_access GLEW_GET_VAR(__GLEW_EXT_direct_state_access)\r\n\r\n#endif /* GL_EXT_direct_state_access */\r\n\r\n/* -------------------------- GL_EXT_draw_buffers2 ------------------------- */\r\n\r\n#ifndef GL_EXT_draw_buffers2\r\n#define GL_EXT_draw_buffers2 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum value, GLuint index, GLboolean* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum value, GLuint index, GLint* data);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);\r\n\r\n#define glColorMaskIndexedEXT GLEW_GET_FUN(__glewColorMaskIndexedEXT)\r\n#define glDisableIndexedEXT GLEW_GET_FUN(__glewDisableIndexedEXT)\r\n#define glEnableIndexedEXT GLEW_GET_FUN(__glewEnableIndexedEXT)\r\n#define glGetBooleanIndexedvEXT GLEW_GET_FUN(__glewGetBooleanIndexedvEXT)\r\n#define glGetIntegerIndexedvEXT GLEW_GET_FUN(__glewGetIntegerIndexedvEXT)\r\n#define glIsEnabledIndexedEXT GLEW_GET_FUN(__glewIsEnabledIndexedEXT)\r\n\r\n#define GLEW_EXT_draw_buffers2 GLEW_GET_VAR(__GLEW_EXT_draw_buffers2)\r\n\r\n#endif /* GL_EXT_draw_buffers2 */\r\n\r\n/* ------------------------- GL_EXT_draw_instanced ------------------------- */\r\n\r\n#ifndef GL_EXT_draw_instanced\r\n#define GL_EXT_draw_instanced 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);\r\n\r\n#define glDrawArraysInstancedEXT GLEW_GET_FUN(__glewDrawArraysInstancedEXT)\r\n#define glDrawElementsInstancedEXT GLEW_GET_FUN(__glewDrawElementsInstancedEXT)\r\n\r\n#define GLEW_EXT_draw_instanced GLEW_GET_VAR(__GLEW_EXT_draw_instanced)\r\n\r\n#endif /* GL_EXT_draw_instanced */\r\n\r\n/* ----------------------- GL_EXT_draw_range_elements ---------------------- */\r\n\r\n#ifndef GL_EXT_draw_range_elements\r\n#define GL_EXT_draw_range_elements 1\r\n\r\n#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8\r\n#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\r\n\r\n#define glDrawRangeElementsEXT GLEW_GET_FUN(__glewDrawRangeElementsEXT)\r\n\r\n#define GLEW_EXT_draw_range_elements GLEW_GET_VAR(__GLEW_EXT_draw_range_elements)\r\n\r\n#endif /* GL_EXT_draw_range_elements */\r\n\r\n/* ---------------------------- GL_EXT_fog_coord --------------------------- */\r\n\r\n#ifndef GL_EXT_fog_coord\r\n#define GL_EXT_fog_coord 1\r\n\r\n#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450\r\n#define GL_FOG_COORDINATE_EXT 0x8451\r\n#define GL_FRAGMENT_DEPTH_EXT 0x8452\r\n#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453\r\n#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454\r\n#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455\r\n#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456\r\n#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);\r\n\r\n#define glFogCoordPointerEXT GLEW_GET_FUN(__glewFogCoordPointerEXT)\r\n#define glFogCoorddEXT GLEW_GET_FUN(__glewFogCoorddEXT)\r\n#define glFogCoorddvEXT GLEW_GET_FUN(__glewFogCoorddvEXT)\r\n#define glFogCoordfEXT GLEW_GET_FUN(__glewFogCoordfEXT)\r\n#define glFogCoordfvEXT GLEW_GET_FUN(__glewFogCoordfvEXT)\r\n\r\n#define GLEW_EXT_fog_coord GLEW_GET_VAR(__GLEW_EXT_fog_coord)\r\n\r\n#endif /* GL_EXT_fog_coord */\r\n\r\n/* ------------------------ GL_EXT_fragment_lighting ----------------------- */\r\n\r\n#ifndef GL_EXT_fragment_lighting\r\n#define GL_EXT_fragment_lighting 1\r\n\r\n#define GL_FRAGMENT_LIGHTING_EXT 0x8400\r\n#define GL_FRAGMENT_COLOR_MATERIAL_EXT 0x8401\r\n#define GL_FRAGMENT_COLOR_MATERIAL_FACE_EXT 0x8402\r\n#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_EXT 0x8403\r\n#define GL_MAX_FRAGMENT_LIGHTS_EXT 0x8404\r\n#define GL_MAX_ACTIVE_LIGHTS_EXT 0x8405\r\n#define GL_CURRENT_RASTER_NORMAL_EXT 0x8406\r\n#define GL_LIGHT_ENV_MODE_EXT 0x8407\r\n#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_EXT 0x8408\r\n#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_EXT 0x8409\r\n#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_EXT 0x840A\r\n#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_EXT 0x840B\r\n#define GL_FRAGMENT_LIGHT0_EXT 0x840C\r\n#define GL_FRAGMENT_LIGHT7_EXT 0x8413\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALEXTPROC) (GLenum face, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFEXTPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVEXTPROC) (GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIEXTPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVEXTPROC) (GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFEXTPROC) (GLenum light, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIEXTPROC) (GLenum light, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFEXTPROC) (GLenum face, GLenum pname, const GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIEXTPROC) (GLenum face, GLenum pname, const GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLLIGHTENVIEXTPROC) (GLenum pname, GLint param);\r\n\r\n#define glFragmentColorMaterialEXT GLEW_GET_FUN(__glewFragmentColorMaterialEXT)\r\n#define glFragmentLightModelfEXT GLEW_GET_FUN(__glewFragmentLightModelfEXT)\r\n#define glFragmentLightModelfvEXT GLEW_GET_FUN(__glewFragmentLightModelfvEXT)\r\n#define glFragmentLightModeliEXT GLEW_GET_FUN(__glewFragmentLightModeliEXT)\r\n#define glFragmentLightModelivEXT GLEW_GET_FUN(__glewFragmentLightModelivEXT)\r\n#define glFragmentLightfEXT GLEW_GET_FUN(__glewFragmentLightfEXT)\r\n#define glFragmentLightfvEXT GLEW_GET_FUN(__glewFragmentLightfvEXT)\r\n#define glFragmentLightiEXT GLEW_GET_FUN(__glewFragmentLightiEXT)\r\n#define glFragmentLightivEXT GLEW_GET_FUN(__glewFragmentLightivEXT)\r\n#define glFragmentMaterialfEXT GLEW_GET_FUN(__glewFragmentMaterialfEXT)\r\n#define glFragmentMaterialfvEXT GLEW_GET_FUN(__glewFragmentMaterialfvEXT)\r\n#define glFragmentMaterialiEXT GLEW_GET_FUN(__glewFragmentMaterialiEXT)\r\n#define glFragmentMaterialivEXT GLEW_GET_FUN(__glewFragmentMaterialivEXT)\r\n#define glGetFragmentLightfvEXT GLEW_GET_FUN(__glewGetFragmentLightfvEXT)\r\n#define glGetFragmentLightivEXT GLEW_GET_FUN(__glewGetFragmentLightivEXT)\r\n#define glGetFragmentMaterialfvEXT GLEW_GET_FUN(__glewGetFragmentMaterialfvEXT)\r\n#define glGetFragmentMaterialivEXT GLEW_GET_FUN(__glewGetFragmentMaterialivEXT)\r\n#define glLightEnviEXT GLEW_GET_FUN(__glewLightEnviEXT)\r\n\r\n#define GLEW_EXT_fragment_lighting GLEW_GET_VAR(__GLEW_EXT_fragment_lighting)\r\n\r\n#endif /* GL_EXT_fragment_lighting */\r\n\r\n/* ------------------------ GL_EXT_framebuffer_blit ------------------------ */\r\n\r\n#ifndef GL_EXT_framebuffer_blit\r\n#define GL_EXT_framebuffer_blit 1\r\n\r\n#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6\r\n#define GL_READ_FRAMEBUFFER_EXT 0x8CA8\r\n#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9\r\n#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\n\r\n#define glBlitFramebufferEXT GLEW_GET_FUN(__glewBlitFramebufferEXT)\r\n\r\n#define GLEW_EXT_framebuffer_blit GLEW_GET_VAR(__GLEW_EXT_framebuffer_blit)\r\n\r\n#endif /* GL_EXT_framebuffer_blit */\r\n\r\n/* --------------------- GL_EXT_framebuffer_multisample -------------------- */\r\n\r\n#ifndef GL_EXT_framebuffer_multisample\r\n#define GL_EXT_framebuffer_multisample 1\r\n\r\n#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56\r\n#define GL_MAX_SAMPLES_EXT 0x8D57\r\n\r\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\n\r\n#define glRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewRenderbufferStorageMultisampleEXT)\r\n\r\n#define GLEW_EXT_framebuffer_multisample GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample)\r\n\r\n#endif /* GL_EXT_framebuffer_multisample */\r\n\r\n/* --------------- GL_EXT_framebuffer_multisample_blit_scaled -------------- */\r\n\r\n#ifndef GL_EXT_framebuffer_multisample_blit_scaled\r\n#define GL_EXT_framebuffer_multisample_blit_scaled 1\r\n\r\n#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA\r\n#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB\r\n\r\n#define GLEW_EXT_framebuffer_multisample_blit_scaled GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample_blit_scaled)\r\n\r\n#endif /* GL_EXT_framebuffer_multisample_blit_scaled */\r\n\r\n/* ----------------------- GL_EXT_framebuffer_object ----------------------- */\r\n\r\n#ifndef GL_EXT_framebuffer_object\r\n#define GL_EXT_framebuffer_object 1\r\n\r\n#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506\r\n#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8\r\n#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6\r\n#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4\r\n#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5\r\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9\r\n#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA\r\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB\r\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC\r\n#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD\r\n#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF\r\n#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0\r\n#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1\r\n#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2\r\n#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3\r\n#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4\r\n#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5\r\n#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6\r\n#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7\r\n#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8\r\n#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9\r\n#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA\r\n#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB\r\n#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC\r\n#define GL_COLOR_ATTACHMENT13_EXT 0x8CED\r\n#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE\r\n#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF\r\n#define GL_DEPTH_ATTACHMENT_EXT 0x8D00\r\n#define GL_STENCIL_ATTACHMENT_EXT 0x8D20\r\n#define GL_FRAMEBUFFER_EXT 0x8D40\r\n#define GL_RENDERBUFFER_EXT 0x8D41\r\n#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42\r\n#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43\r\n#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44\r\n#define GL_STENCIL_INDEX1_EXT 0x8D46\r\n#define GL_STENCIL_INDEX4_EXT 0x8D47\r\n#define GL_STENCIL_INDEX8_EXT 0x8D48\r\n#define GL_STENCIL_INDEX16_EXT 0x8D49\r\n#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50\r\n#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51\r\n#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52\r\n#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53\r\n#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54\r\n#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);\r\ntypedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);\r\ntypedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint* framebuffers);\r\ntypedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint* renderbuffers);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\ntypedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint* framebuffers);\r\ntypedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint* renderbuffers);\r\ntypedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);\r\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\n\r\n#define glBindFramebufferEXT GLEW_GET_FUN(__glewBindFramebufferEXT)\r\n#define glBindRenderbufferEXT GLEW_GET_FUN(__glewBindRenderbufferEXT)\r\n#define glCheckFramebufferStatusEXT GLEW_GET_FUN(__glewCheckFramebufferStatusEXT)\r\n#define glDeleteFramebuffersEXT GLEW_GET_FUN(__glewDeleteFramebuffersEXT)\r\n#define glDeleteRenderbuffersEXT GLEW_GET_FUN(__glewDeleteRenderbuffersEXT)\r\n#define glFramebufferRenderbufferEXT GLEW_GET_FUN(__glewFramebufferRenderbufferEXT)\r\n#define glFramebufferTexture1DEXT GLEW_GET_FUN(__glewFramebufferTexture1DEXT)\r\n#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT)\r\n#define glFramebufferTexture3DEXT GLEW_GET_FUN(__glewFramebufferTexture3DEXT)\r\n#define glGenFramebuffersEXT GLEW_GET_FUN(__glewGenFramebuffersEXT)\r\n#define glGenRenderbuffersEXT GLEW_GET_FUN(__glewGenRenderbuffersEXT)\r\n#define glGenerateMipmapEXT GLEW_GET_FUN(__glewGenerateMipmapEXT)\r\n#define glGetFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivEXT)\r\n#define glGetRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetRenderbufferParameterivEXT)\r\n#define glIsFramebufferEXT GLEW_GET_FUN(__glewIsFramebufferEXT)\r\n#define glIsRenderbufferEXT GLEW_GET_FUN(__glewIsRenderbufferEXT)\r\n#define glRenderbufferStorageEXT GLEW_GET_FUN(__glewRenderbufferStorageEXT)\r\n\r\n#define GLEW_EXT_framebuffer_object GLEW_GET_VAR(__GLEW_EXT_framebuffer_object)\r\n\r\n#endif /* GL_EXT_framebuffer_object */\r\n\r\n/* ------------------------ GL_EXT_framebuffer_sRGB ------------------------ */\r\n\r\n#ifndef GL_EXT_framebuffer_sRGB\r\n#define GL_EXT_framebuffer_sRGB 1\r\n\r\n#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9\r\n#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA\r\n\r\n#define GLEW_EXT_framebuffer_sRGB GLEW_GET_VAR(__GLEW_EXT_framebuffer_sRGB)\r\n\r\n#endif /* GL_EXT_framebuffer_sRGB */\r\n\r\n/* ------------------------ GL_EXT_geometry_shader4 ------------------------ */\r\n\r\n#ifndef GL_EXT_geometry_shader4\r\n#define GL_EXT_geometry_shader4 1\r\n\r\n#define GL_LINES_ADJACENCY_EXT 0xA\r\n#define GL_LINE_STRIP_ADJACENCY_EXT 0xB\r\n#define GL_TRIANGLES_ADJACENCY_EXT 0xC\r\n#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD\r\n#define GL_PROGRAM_POINT_SIZE_EXT 0x8642\r\n#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B\r\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4\r\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9\r\n#define GL_GEOMETRY_SHADER_EXT 0x8DD9\r\n#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA\r\n#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB\r\n#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC\r\n#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD\r\n#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE\r\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF\r\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0\r\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);\r\n\r\n#define glFramebufferTextureEXT GLEW_GET_FUN(__glewFramebufferTextureEXT)\r\n#define glFramebufferTextureFaceEXT GLEW_GET_FUN(__glewFramebufferTextureFaceEXT)\r\n#define glProgramParameteriEXT GLEW_GET_FUN(__glewProgramParameteriEXT)\r\n\r\n#define GLEW_EXT_geometry_shader4 GLEW_GET_VAR(__GLEW_EXT_geometry_shader4)\r\n\r\n#endif /* GL_EXT_geometry_shader4 */\r\n\r\n/* --------------------- GL_EXT_gpu_program_parameters --------------------- */\r\n\r\n#ifndef GL_EXT_gpu_program_parameters\r\n#define GL_EXT_gpu_program_parameters 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params);\r\n\r\n#define glProgramEnvParameters4fvEXT GLEW_GET_FUN(__glewProgramEnvParameters4fvEXT)\r\n#define glProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewProgramLocalParameters4fvEXT)\r\n\r\n#define GLEW_EXT_gpu_program_parameters GLEW_GET_VAR(__GLEW_EXT_gpu_program_parameters)\r\n\r\n#endif /* GL_EXT_gpu_program_parameters */\r\n\r\n/* --------------------------- GL_EXT_gpu_shader4 -------------------------- */\r\n\r\n#ifndef GL_EXT_gpu_shader4\r\n#define GL_EXT_gpu_shader4 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD\r\n#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0\r\n#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1\r\n#define GL_SAMPLER_BUFFER_EXT 0x8DC2\r\n#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3\r\n#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4\r\n#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5\r\n#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6\r\n#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7\r\n#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8\r\n#define GL_INT_SAMPLER_1D_EXT 0x8DC9\r\n#define GL_INT_SAMPLER_2D_EXT 0x8DCA\r\n#define GL_INT_SAMPLER_3D_EXT 0x8DCB\r\n#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC\r\n#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD\r\n#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE\r\n#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF\r\n#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0\r\n#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2\r\n#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5\r\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7\r\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\r\n#define glBindFragDataLocationEXT GLEW_GET_FUN(__glewBindFragDataLocationEXT)\r\n#define glGetFragDataLocationEXT GLEW_GET_FUN(__glewGetFragDataLocationEXT)\r\n#define glGetUniformuivEXT GLEW_GET_FUN(__glewGetUniformuivEXT)\r\n#define glGetVertexAttribIivEXT GLEW_GET_FUN(__glewGetVertexAttribIivEXT)\r\n#define glGetVertexAttribIuivEXT GLEW_GET_FUN(__glewGetVertexAttribIuivEXT)\r\n#define glUniform1uiEXT GLEW_GET_FUN(__glewUniform1uiEXT)\r\n#define glUniform1uivEXT GLEW_GET_FUN(__glewUniform1uivEXT)\r\n#define glUniform2uiEXT GLEW_GET_FUN(__glewUniform2uiEXT)\r\n#define glUniform2uivEXT GLEW_GET_FUN(__glewUniform2uivEXT)\r\n#define glUniform3uiEXT GLEW_GET_FUN(__glewUniform3uiEXT)\r\n#define glUniform3uivEXT GLEW_GET_FUN(__glewUniform3uivEXT)\r\n#define glUniform4uiEXT GLEW_GET_FUN(__glewUniform4uiEXT)\r\n#define glUniform4uivEXT GLEW_GET_FUN(__glewUniform4uivEXT)\r\n#define glVertexAttribI1iEXT GLEW_GET_FUN(__glewVertexAttribI1iEXT)\r\n#define glVertexAttribI1ivEXT GLEW_GET_FUN(__glewVertexAttribI1ivEXT)\r\n#define glVertexAttribI1uiEXT GLEW_GET_FUN(__glewVertexAttribI1uiEXT)\r\n#define glVertexAttribI1uivEXT GLEW_GET_FUN(__glewVertexAttribI1uivEXT)\r\n#define glVertexAttribI2iEXT GLEW_GET_FUN(__glewVertexAttribI2iEXT)\r\n#define glVertexAttribI2ivEXT GLEW_GET_FUN(__glewVertexAttribI2ivEXT)\r\n#define glVertexAttribI2uiEXT GLEW_GET_FUN(__glewVertexAttribI2uiEXT)\r\n#define glVertexAttribI2uivEXT GLEW_GET_FUN(__glewVertexAttribI2uivEXT)\r\n#define glVertexAttribI3iEXT GLEW_GET_FUN(__glewVertexAttribI3iEXT)\r\n#define glVertexAttribI3ivEXT GLEW_GET_FUN(__glewVertexAttribI3ivEXT)\r\n#define glVertexAttribI3uiEXT GLEW_GET_FUN(__glewVertexAttribI3uiEXT)\r\n#define glVertexAttribI3uivEXT GLEW_GET_FUN(__glewVertexAttribI3uivEXT)\r\n#define glVertexAttribI4bvEXT GLEW_GET_FUN(__glewVertexAttribI4bvEXT)\r\n#define glVertexAttribI4iEXT GLEW_GET_FUN(__glewVertexAttribI4iEXT)\r\n#define glVertexAttribI4ivEXT GLEW_GET_FUN(__glewVertexAttribI4ivEXT)\r\n#define glVertexAttribI4svEXT GLEW_GET_FUN(__glewVertexAttribI4svEXT)\r\n#define glVertexAttribI4ubvEXT GLEW_GET_FUN(__glewVertexAttribI4ubvEXT)\r\n#define glVertexAttribI4uiEXT GLEW_GET_FUN(__glewVertexAttribI4uiEXT)\r\n#define glVertexAttribI4uivEXT GLEW_GET_FUN(__glewVertexAttribI4uivEXT)\r\n#define glVertexAttribI4usvEXT GLEW_GET_FUN(__glewVertexAttribI4usvEXT)\r\n#define glVertexAttribIPointerEXT GLEW_GET_FUN(__glewVertexAttribIPointerEXT)\r\n\r\n#define GLEW_EXT_gpu_shader4 GLEW_GET_VAR(__GLEW_EXT_gpu_shader4)\r\n\r\n#endif /* GL_EXT_gpu_shader4 */\r\n\r\n/* ---------------------------- GL_EXT_histogram --------------------------- */\r\n\r\n#ifndef GL_EXT_histogram\r\n#define GL_EXT_histogram 1\r\n\r\n#define GL_HISTOGRAM_EXT 0x8024\r\n#define GL_PROXY_HISTOGRAM_EXT 0x8025\r\n#define GL_HISTOGRAM_WIDTH_EXT 0x8026\r\n#define GL_HISTOGRAM_FORMAT_EXT 0x8027\r\n#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028\r\n#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029\r\n#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A\r\n#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B\r\n#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C\r\n#define GL_HISTOGRAM_SINK_EXT 0x802D\r\n#define GL_MINMAX_EXT 0x802E\r\n#define GL_MINMAX_FORMAT_EXT 0x802F\r\n#define GL_MINMAX_SINK_EXT 0x8030\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values);\r\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\r\ntypedef void (GLAPIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);\r\ntypedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target);\r\n\r\n#define glGetHistogramEXT GLEW_GET_FUN(__glewGetHistogramEXT)\r\n#define glGetHistogramParameterfvEXT GLEW_GET_FUN(__glewGetHistogramParameterfvEXT)\r\n#define glGetHistogramParameterivEXT GLEW_GET_FUN(__glewGetHistogramParameterivEXT)\r\n#define glGetMinmaxEXT GLEW_GET_FUN(__glewGetMinmaxEXT)\r\n#define glGetMinmaxParameterfvEXT GLEW_GET_FUN(__glewGetMinmaxParameterfvEXT)\r\n#define glGetMinmaxParameterivEXT GLEW_GET_FUN(__glewGetMinmaxParameterivEXT)\r\n#define glHistogramEXT GLEW_GET_FUN(__glewHistogramEXT)\r\n#define glMinmaxEXT GLEW_GET_FUN(__glewMinmaxEXT)\r\n#define glResetHistogramEXT GLEW_GET_FUN(__glewResetHistogramEXT)\r\n#define glResetMinmaxEXT GLEW_GET_FUN(__glewResetMinmaxEXT)\r\n\r\n#define GLEW_EXT_histogram GLEW_GET_VAR(__GLEW_EXT_histogram)\r\n\r\n#endif /* GL_EXT_histogram */\r\n\r\n/* ----------------------- GL_EXT_index_array_formats ---------------------- */\r\n\r\n#ifndef GL_EXT_index_array_formats\r\n#define GL_EXT_index_array_formats 1\r\n\r\n#define GLEW_EXT_index_array_formats GLEW_GET_VAR(__GLEW_EXT_index_array_formats)\r\n\r\n#endif /* GL_EXT_index_array_formats */\r\n\r\n/* --------------------------- GL_EXT_index_func --------------------------- */\r\n\r\n#ifndef GL_EXT_index_func\r\n#define GL_EXT_index_func 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref);\r\n\r\n#define glIndexFuncEXT GLEW_GET_FUN(__glewIndexFuncEXT)\r\n\r\n#define GLEW_EXT_index_func GLEW_GET_VAR(__GLEW_EXT_index_func)\r\n\r\n#endif /* GL_EXT_index_func */\r\n\r\n/* ------------------------- GL_EXT_index_material ------------------------- */\r\n\r\n#ifndef GL_EXT_index_material\r\n#define GL_EXT_index_material 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);\r\n\r\n#define glIndexMaterialEXT GLEW_GET_FUN(__glewIndexMaterialEXT)\r\n\r\n#define GLEW_EXT_index_material GLEW_GET_VAR(__GLEW_EXT_index_material)\r\n\r\n#endif /* GL_EXT_index_material */\r\n\r\n/* -------------------------- GL_EXT_index_texture ------------------------- */\r\n\r\n#ifndef GL_EXT_index_texture\r\n#define GL_EXT_index_texture 1\r\n\r\n#define GLEW_EXT_index_texture GLEW_GET_VAR(__GLEW_EXT_index_texture)\r\n\r\n#endif /* GL_EXT_index_texture */\r\n\r\n/* -------------------------- GL_EXT_light_texture ------------------------- */\r\n\r\n#ifndef GL_EXT_light_texture\r\n#define GL_EXT_light_texture 1\r\n\r\n#define GL_FRAGMENT_MATERIAL_EXT 0x8349\r\n#define GL_FRAGMENT_NORMAL_EXT 0x834A\r\n#define GL_FRAGMENT_COLOR_EXT 0x834C\r\n#define GL_ATTENUATION_EXT 0x834D\r\n#define GL_SHADOW_ATTENUATION_EXT 0x834E\r\n#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F\r\n#define GL_TEXTURE_LIGHT_EXT 0x8350\r\n#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351\r\n#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352\r\n\r\ntypedef void (GLAPIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);\r\n\r\n#define glApplyTextureEXT GLEW_GET_FUN(__glewApplyTextureEXT)\r\n#define glTextureLightEXT GLEW_GET_FUN(__glewTextureLightEXT)\r\n#define glTextureMaterialEXT GLEW_GET_FUN(__glewTextureMaterialEXT)\r\n\r\n#define GLEW_EXT_light_texture GLEW_GET_VAR(__GLEW_EXT_light_texture)\r\n\r\n#endif /* GL_EXT_light_texture */\r\n\r\n/* ------------------------- GL_EXT_misc_attribute ------------------------- */\r\n\r\n#ifndef GL_EXT_misc_attribute\r\n#define GL_EXT_misc_attribute 1\r\n\r\n#define GLEW_EXT_misc_attribute GLEW_GET_VAR(__GLEW_EXT_misc_attribute)\r\n\r\n#endif /* GL_EXT_misc_attribute */\r\n\r\n/* ------------------------ GL_EXT_multi_draw_arrays ----------------------- */\r\n\r\n#ifndef GL_EXT_multi_draw_arrays\r\n#define GL_EXT_multi_draw_arrays 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, GLsizei* count, GLenum type, const GLvoid **indices, GLsizei primcount);\r\n\r\n#define glMultiDrawArraysEXT GLEW_GET_FUN(__glewMultiDrawArraysEXT)\r\n#define glMultiDrawElementsEXT GLEW_GET_FUN(__glewMultiDrawElementsEXT)\r\n\r\n#define GLEW_EXT_multi_draw_arrays GLEW_GET_VAR(__GLEW_EXT_multi_draw_arrays)\r\n\r\n#endif /* GL_EXT_multi_draw_arrays */\r\n\r\n/* --------------------------- GL_EXT_multisample -------------------------- */\r\n\r\n#ifndef GL_EXT_multisample\r\n#define GL_EXT_multisample 1\r\n\r\n#define GL_MULTISAMPLE_EXT 0x809D\r\n#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F\r\n#define GL_SAMPLE_MASK_EXT 0x80A0\r\n#define GL_1PASS_EXT 0x80A1\r\n#define GL_2PASS_0_EXT 0x80A2\r\n#define GL_2PASS_1_EXT 0x80A3\r\n#define GL_4PASS_0_EXT 0x80A4\r\n#define GL_4PASS_1_EXT 0x80A5\r\n#define GL_4PASS_2_EXT 0x80A6\r\n#define GL_4PASS_3_EXT 0x80A7\r\n#define GL_SAMPLE_BUFFERS_EXT 0x80A8\r\n#define GL_SAMPLES_EXT 0x80A9\r\n#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA\r\n#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB\r\n#define GL_SAMPLE_PATTERN_EXT 0x80AC\r\n#define GL_MULTISAMPLE_BIT_EXT 0x20000000\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);\r\n\r\n#define glSampleMaskEXT GLEW_GET_FUN(__glewSampleMaskEXT)\r\n#define glSamplePatternEXT GLEW_GET_FUN(__glewSamplePatternEXT)\r\n\r\n#define GLEW_EXT_multisample GLEW_GET_VAR(__GLEW_EXT_multisample)\r\n\r\n#endif /* GL_EXT_multisample */\r\n\r\n/* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */\r\n\r\n#ifndef GL_EXT_packed_depth_stencil\r\n#define GL_EXT_packed_depth_stencil 1\r\n\r\n#define GL_DEPTH_STENCIL_EXT 0x84F9\r\n#define GL_UNSIGNED_INT_24_8_EXT 0x84FA\r\n#define GL_DEPTH24_STENCIL8_EXT 0x88F0\r\n#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1\r\n\r\n#define GLEW_EXT_packed_depth_stencil GLEW_GET_VAR(__GLEW_EXT_packed_depth_stencil)\r\n\r\n#endif /* GL_EXT_packed_depth_stencil */\r\n\r\n/* -------------------------- GL_EXT_packed_float -------------------------- */\r\n\r\n#ifndef GL_EXT_packed_float\r\n#define GL_EXT_packed_float 1\r\n\r\n#define GL_R11F_G11F_B10F_EXT 0x8C3A\r\n#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B\r\n#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C\r\n\r\n#define GLEW_EXT_packed_float GLEW_GET_VAR(__GLEW_EXT_packed_float)\r\n\r\n#endif /* GL_EXT_packed_float */\r\n\r\n/* -------------------------- GL_EXT_packed_pixels ------------------------- */\r\n\r\n#ifndef GL_EXT_packed_pixels\r\n#define GL_EXT_packed_pixels 1\r\n\r\n#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032\r\n#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033\r\n#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034\r\n#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035\r\n#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036\r\n\r\n#define GLEW_EXT_packed_pixels GLEW_GET_VAR(__GLEW_EXT_packed_pixels)\r\n\r\n#endif /* GL_EXT_packed_pixels */\r\n\r\n/* ------------------------ GL_EXT_paletted_texture ------------------------ */\r\n\r\n#ifndef GL_EXT_paletted_texture\r\n#define GL_EXT_paletted_texture 1\r\n\r\n#define GL_TEXTURE_1D 0x0DE0\r\n#define GL_TEXTURE_2D 0x0DE1\r\n#define GL_PROXY_TEXTURE_1D 0x8063\r\n#define GL_PROXY_TEXTURE_2D 0x8064\r\n#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8\r\n#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9\r\n#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA\r\n#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB\r\n#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC\r\n#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD\r\n#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE\r\n#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF\r\n#define GL_COLOR_INDEX1_EXT 0x80E2\r\n#define GL_COLOR_INDEX2_EXT 0x80E3\r\n#define GL_COLOR_INDEX4_EXT 0x80E4\r\n#define GL_COLOR_INDEX8_EXT 0x80E5\r\n#define GL_COLOR_INDEX12_EXT 0x80E6\r\n#define GL_COLOR_INDEX16_EXT 0x80E7\r\n#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED\r\n#define GL_TEXTURE_CUBE_MAP_ARB 0x8513\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);\r\n\r\n#define glColorTableEXT GLEW_GET_FUN(__glewColorTableEXT)\r\n#define glGetColorTableEXT GLEW_GET_FUN(__glewGetColorTableEXT)\r\n#define glGetColorTableParameterfvEXT GLEW_GET_FUN(__glewGetColorTableParameterfvEXT)\r\n#define glGetColorTableParameterivEXT GLEW_GET_FUN(__glewGetColorTableParameterivEXT)\r\n\r\n#define GLEW_EXT_paletted_texture GLEW_GET_VAR(__GLEW_EXT_paletted_texture)\r\n\r\n#endif /* GL_EXT_paletted_texture */\r\n\r\n/* ----------------------- GL_EXT_pixel_buffer_object ---------------------- */\r\n\r\n#ifndef GL_EXT_pixel_buffer_object\r\n#define GL_EXT_pixel_buffer_object 1\r\n\r\n#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB\r\n#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC\r\n#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED\r\n#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF\r\n\r\n#define GLEW_EXT_pixel_buffer_object GLEW_GET_VAR(__GLEW_EXT_pixel_buffer_object)\r\n\r\n#endif /* GL_EXT_pixel_buffer_object */\r\n\r\n/* ------------------------- GL_EXT_pixel_transform ------------------------ */\r\n\r\n#ifndef GL_EXT_pixel_transform\r\n#define GL_EXT_pixel_transform 1\r\n\r\n#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330\r\n#define GL_PIXEL_MAG_FILTER_EXT 0x8331\r\n#define GL_PIXEL_MIN_FILTER_EXT 0x8332\r\n#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333\r\n#define GL_CUBIC_EXT 0x8334\r\n#define GL_AVERAGE_EXT 0x8335\r\n#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336\r\n#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337\r\n#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, const GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, const GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);\r\n\r\n#define glGetPixelTransformParameterfvEXT GLEW_GET_FUN(__glewGetPixelTransformParameterfvEXT)\r\n#define glGetPixelTransformParameterivEXT GLEW_GET_FUN(__glewGetPixelTransformParameterivEXT)\r\n#define glPixelTransformParameterfEXT GLEW_GET_FUN(__glewPixelTransformParameterfEXT)\r\n#define glPixelTransformParameterfvEXT GLEW_GET_FUN(__glewPixelTransformParameterfvEXT)\r\n#define glPixelTransformParameteriEXT GLEW_GET_FUN(__glewPixelTransformParameteriEXT)\r\n#define glPixelTransformParameterivEXT GLEW_GET_FUN(__glewPixelTransformParameterivEXT)\r\n\r\n#define GLEW_EXT_pixel_transform GLEW_GET_VAR(__GLEW_EXT_pixel_transform)\r\n\r\n#endif /* GL_EXT_pixel_transform */\r\n\r\n/* ------------------- GL_EXT_pixel_transform_color_table ------------------ */\r\n\r\n#ifndef GL_EXT_pixel_transform_color_table\r\n#define GL_EXT_pixel_transform_color_table 1\r\n\r\n#define GLEW_EXT_pixel_transform_color_table GLEW_GET_VAR(__GLEW_EXT_pixel_transform_color_table)\r\n\r\n#endif /* GL_EXT_pixel_transform_color_table */\r\n\r\n/* ------------------------ GL_EXT_point_parameters ------------------------ */\r\n\r\n#ifndef GL_EXT_point_parameters\r\n#define GL_EXT_point_parameters 1\r\n\r\n#define GL_POINT_SIZE_MIN_EXT 0x8126\r\n#define GL_POINT_SIZE_MAX_EXT 0x8127\r\n#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128\r\n#define GL_DISTANCE_ATTENUATION_EXT 0x8129\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat* params);\r\n\r\n#define glPointParameterfEXT GLEW_GET_FUN(__glewPointParameterfEXT)\r\n#define glPointParameterfvEXT GLEW_GET_FUN(__glewPointParameterfvEXT)\r\n\r\n#define GLEW_EXT_point_parameters GLEW_GET_VAR(__GLEW_EXT_point_parameters)\r\n\r\n#endif /* GL_EXT_point_parameters */\r\n\r\n/* ------------------------- GL_EXT_polygon_offset ------------------------- */\r\n\r\n#ifndef GL_EXT_polygon_offset\r\n#define GL_EXT_polygon_offset 1\r\n\r\n#define GL_POLYGON_OFFSET_EXT 0x8037\r\n#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038\r\n#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);\r\n\r\n#define glPolygonOffsetEXT GLEW_GET_FUN(__glewPolygonOffsetEXT)\r\n\r\n#define GLEW_EXT_polygon_offset GLEW_GET_VAR(__GLEW_EXT_polygon_offset)\r\n\r\n#endif /* GL_EXT_polygon_offset */\r\n\r\n/* ------------------------ GL_EXT_provoking_vertex ------------------------ */\r\n\r\n#ifndef GL_EXT_provoking_vertex\r\n#define GL_EXT_provoking_vertex 1\r\n\r\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C\r\n#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D\r\n#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E\r\n#define GL_PROVOKING_VERTEX_EXT 0x8E4F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);\r\n\r\n#define glProvokingVertexEXT GLEW_GET_FUN(__glewProvokingVertexEXT)\r\n\r\n#define GLEW_EXT_provoking_vertex GLEW_GET_VAR(__GLEW_EXT_provoking_vertex)\r\n\r\n#endif /* GL_EXT_provoking_vertex */\r\n\r\n/* ------------------------- GL_EXT_rescale_normal ------------------------- */\r\n\r\n#ifndef GL_EXT_rescale_normal\r\n#define GL_EXT_rescale_normal 1\r\n\r\n#define GL_RESCALE_NORMAL_EXT 0x803A\r\n\r\n#define GLEW_EXT_rescale_normal GLEW_GET_VAR(__GLEW_EXT_rescale_normal)\r\n\r\n#endif /* GL_EXT_rescale_normal */\r\n\r\n/* -------------------------- GL_EXT_scene_marker -------------------------- */\r\n\r\n#ifndef GL_EXT_scene_marker\r\n#define GL_EXT_scene_marker 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINSCENEEXTPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLENDSCENEEXTPROC) (void);\r\n\r\n#define glBeginSceneEXT GLEW_GET_FUN(__glewBeginSceneEXT)\r\n#define glEndSceneEXT GLEW_GET_FUN(__glewEndSceneEXT)\r\n\r\n#define GLEW_EXT_scene_marker GLEW_GET_VAR(__GLEW_EXT_scene_marker)\r\n\r\n#endif /* GL_EXT_scene_marker */\r\n\r\n/* ------------------------- GL_EXT_secondary_color ------------------------ */\r\n\r\n#ifndef GL_EXT_secondary_color\r\n#define GL_EXT_secondary_color 1\r\n\r\n#define GL_COLOR_SUM_EXT 0x8458\r\n#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459\r\n#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A\r\n#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B\r\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C\r\n#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D\r\n#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\r\n#define glSecondaryColor3bEXT GLEW_GET_FUN(__glewSecondaryColor3bEXT)\r\n#define glSecondaryColor3bvEXT GLEW_GET_FUN(__glewSecondaryColor3bvEXT)\r\n#define glSecondaryColor3dEXT GLEW_GET_FUN(__glewSecondaryColor3dEXT)\r\n#define glSecondaryColor3dvEXT GLEW_GET_FUN(__glewSecondaryColor3dvEXT)\r\n#define glSecondaryColor3fEXT GLEW_GET_FUN(__glewSecondaryColor3fEXT)\r\n#define glSecondaryColor3fvEXT GLEW_GET_FUN(__glewSecondaryColor3fvEXT)\r\n#define glSecondaryColor3iEXT GLEW_GET_FUN(__glewSecondaryColor3iEXT)\r\n#define glSecondaryColor3ivEXT GLEW_GET_FUN(__glewSecondaryColor3ivEXT)\r\n#define glSecondaryColor3sEXT GLEW_GET_FUN(__glewSecondaryColor3sEXT)\r\n#define glSecondaryColor3svEXT GLEW_GET_FUN(__glewSecondaryColor3svEXT)\r\n#define glSecondaryColor3ubEXT GLEW_GET_FUN(__glewSecondaryColor3ubEXT)\r\n#define glSecondaryColor3ubvEXT GLEW_GET_FUN(__glewSecondaryColor3ubvEXT)\r\n#define glSecondaryColor3uiEXT GLEW_GET_FUN(__glewSecondaryColor3uiEXT)\r\n#define glSecondaryColor3uivEXT GLEW_GET_FUN(__glewSecondaryColor3uivEXT)\r\n#define glSecondaryColor3usEXT GLEW_GET_FUN(__glewSecondaryColor3usEXT)\r\n#define glSecondaryColor3usvEXT GLEW_GET_FUN(__glewSecondaryColor3usvEXT)\r\n#define glSecondaryColorPointerEXT GLEW_GET_FUN(__glewSecondaryColorPointerEXT)\r\n\r\n#define GLEW_EXT_secondary_color GLEW_GET_VAR(__GLEW_EXT_secondary_color)\r\n\r\n#endif /* GL_EXT_secondary_color */\r\n\r\n/* --------------------- GL_EXT_separate_shader_objects -------------------- */\r\n\r\n#ifndef GL_EXT_separate_shader_objects\r\n#define GL_EXT_separate_shader_objects 1\r\n\r\n#define GL_ACTIVE_PROGRAM_EXT 0x8B8D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);\r\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar* string);\r\ntypedef void (GLAPIENTRY * PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);\r\n\r\n#define glActiveProgramEXT GLEW_GET_FUN(__glewActiveProgramEXT)\r\n#define glCreateShaderProgramEXT GLEW_GET_FUN(__glewCreateShaderProgramEXT)\r\n#define glUseShaderProgramEXT GLEW_GET_FUN(__glewUseShaderProgramEXT)\r\n\r\n#define GLEW_EXT_separate_shader_objects GLEW_GET_VAR(__GLEW_EXT_separate_shader_objects)\r\n\r\n#endif /* GL_EXT_separate_shader_objects */\r\n\r\n/* --------------------- GL_EXT_separate_specular_color -------------------- */\r\n\r\n#ifndef GL_EXT_separate_specular_color\r\n#define GL_EXT_separate_specular_color 1\r\n\r\n#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8\r\n#define GL_SINGLE_COLOR_EXT 0x81F9\r\n#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA\r\n\r\n#define GLEW_EXT_separate_specular_color GLEW_GET_VAR(__GLEW_EXT_separate_specular_color)\r\n\r\n#endif /* GL_EXT_separate_specular_color */\r\n\r\n/* --------------------- GL_EXT_shader_image_load_store -------------------- */\r\n\r\n#ifndef GL_EXT_shader_image_load_store\r\n#define GL_EXT_shader_image_load_store 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001\r\n#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002\r\n#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004\r\n#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008\r\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020\r\n#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040\r\n#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080\r\n#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100\r\n#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200\r\n#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400\r\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800\r\n#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000\r\n#define GL_MAX_IMAGE_UNITS_EXT 0x8F38\r\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39\r\n#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A\r\n#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B\r\n#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C\r\n#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D\r\n#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E\r\n#define GL_IMAGE_1D_EXT 0x904C\r\n#define GL_IMAGE_2D_EXT 0x904D\r\n#define GL_IMAGE_3D_EXT 0x904E\r\n#define GL_IMAGE_2D_RECT_EXT 0x904F\r\n#define GL_IMAGE_CUBE_EXT 0x9050\r\n#define GL_IMAGE_BUFFER_EXT 0x9051\r\n#define GL_IMAGE_1D_ARRAY_EXT 0x9052\r\n#define GL_IMAGE_2D_ARRAY_EXT 0x9053\r\n#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054\r\n#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055\r\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056\r\n#define GL_INT_IMAGE_1D_EXT 0x9057\r\n#define GL_INT_IMAGE_2D_EXT 0x9058\r\n#define GL_INT_IMAGE_3D_EXT 0x9059\r\n#define GL_INT_IMAGE_2D_RECT_EXT 0x905A\r\n#define GL_INT_IMAGE_CUBE_EXT 0x905B\r\n#define GL_INT_IMAGE_BUFFER_EXT 0x905C\r\n#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D\r\n#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E\r\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061\r\n#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062\r\n#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063\r\n#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064\r\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066\r\n#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067\r\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068\r\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C\r\n#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D\r\n#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E\r\n#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);\r\ntypedef void (GLAPIENTRY * PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);\r\n\r\n#define glBindImageTextureEXT GLEW_GET_FUN(__glewBindImageTextureEXT)\r\n#define glMemoryBarrierEXT GLEW_GET_FUN(__glewMemoryBarrierEXT)\r\n\r\n#define GLEW_EXT_shader_image_load_store GLEW_GET_VAR(__GLEW_EXT_shader_image_load_store)\r\n\r\n#endif /* GL_EXT_shader_image_load_store */\r\n\r\n/* -------------------------- GL_EXT_shadow_funcs -------------------------- */\r\n\r\n#ifndef GL_EXT_shadow_funcs\r\n#define GL_EXT_shadow_funcs 1\r\n\r\n#define GLEW_EXT_shadow_funcs GLEW_GET_VAR(__GLEW_EXT_shadow_funcs)\r\n\r\n#endif /* GL_EXT_shadow_funcs */\r\n\r\n/* --------------------- GL_EXT_shared_texture_palette --------------------- */\r\n\r\n#ifndef GL_EXT_shared_texture_palette\r\n#define GL_EXT_shared_texture_palette 1\r\n\r\n#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB\r\n\r\n#define GLEW_EXT_shared_texture_palette GLEW_GET_VAR(__GLEW_EXT_shared_texture_palette)\r\n\r\n#endif /* GL_EXT_shared_texture_palette */\r\n\r\n/* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */\r\n\r\n#ifndef GL_EXT_stencil_clear_tag\r\n#define GL_EXT_stencil_clear_tag 1\r\n\r\n#define GL_STENCIL_TAG_BITS_EXT 0x88F2\r\n#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3\r\n\r\n#define GLEW_EXT_stencil_clear_tag GLEW_GET_VAR(__GLEW_EXT_stencil_clear_tag)\r\n\r\n#endif /* GL_EXT_stencil_clear_tag */\r\n\r\n/* ------------------------ GL_EXT_stencil_two_side ------------------------ */\r\n\r\n#ifndef GL_EXT_stencil_two_side\r\n#define GL_EXT_stencil_two_side 1\r\n\r\n#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910\r\n#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911\r\n\r\ntypedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);\r\n\r\n#define glActiveStencilFaceEXT GLEW_GET_FUN(__glewActiveStencilFaceEXT)\r\n\r\n#define GLEW_EXT_stencil_two_side GLEW_GET_VAR(__GLEW_EXT_stencil_two_side)\r\n\r\n#endif /* GL_EXT_stencil_two_side */\r\n\r\n/* -------------------------- GL_EXT_stencil_wrap -------------------------- */\r\n\r\n#ifndef GL_EXT_stencil_wrap\r\n#define GL_EXT_stencil_wrap 1\r\n\r\n#define GL_INCR_WRAP_EXT 0x8507\r\n#define GL_DECR_WRAP_EXT 0x8508\r\n\r\n#define GLEW_EXT_stencil_wrap GLEW_GET_VAR(__GLEW_EXT_stencil_wrap)\r\n\r\n#endif /* GL_EXT_stencil_wrap */\r\n\r\n/* --------------------------- GL_EXT_subtexture --------------------------- */\r\n\r\n#ifndef GL_EXT_subtexture\r\n#define GL_EXT_subtexture 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);\r\n\r\n#define glTexSubImage1DEXT GLEW_GET_FUN(__glewTexSubImage1DEXT)\r\n#define glTexSubImage2DEXT GLEW_GET_FUN(__glewTexSubImage2DEXT)\r\n#define glTexSubImage3DEXT GLEW_GET_FUN(__glewTexSubImage3DEXT)\r\n\r\n#define GLEW_EXT_subtexture GLEW_GET_VAR(__GLEW_EXT_subtexture)\r\n\r\n#endif /* GL_EXT_subtexture */\r\n\r\n/* ----------------------------- GL_EXT_texture ---------------------------- */\r\n\r\n#ifndef GL_EXT_texture\r\n#define GL_EXT_texture 1\r\n\r\n#define GL_ALPHA4_EXT 0x803B\r\n#define GL_ALPHA8_EXT 0x803C\r\n#define GL_ALPHA12_EXT 0x803D\r\n#define GL_ALPHA16_EXT 0x803E\r\n#define GL_LUMINANCE4_EXT 0x803F\r\n#define GL_LUMINANCE8_EXT 0x8040\r\n#define GL_LUMINANCE12_EXT 0x8041\r\n#define GL_LUMINANCE16_EXT 0x8042\r\n#define GL_LUMINANCE4_ALPHA4_EXT 0x8043\r\n#define GL_LUMINANCE6_ALPHA2_EXT 0x8044\r\n#define GL_LUMINANCE8_ALPHA8_EXT 0x8045\r\n#define GL_LUMINANCE12_ALPHA4_EXT 0x8046\r\n#define GL_LUMINANCE12_ALPHA12_EXT 0x8047\r\n#define GL_LUMINANCE16_ALPHA16_EXT 0x8048\r\n#define GL_INTENSITY_EXT 0x8049\r\n#define GL_INTENSITY4_EXT 0x804A\r\n#define GL_INTENSITY8_EXT 0x804B\r\n#define GL_INTENSITY12_EXT 0x804C\r\n#define GL_INTENSITY16_EXT 0x804D\r\n#define GL_RGB2_EXT 0x804E\r\n#define GL_RGB4_EXT 0x804F\r\n#define GL_RGB5_EXT 0x8050\r\n#define GL_RGB8_EXT 0x8051\r\n#define GL_RGB10_EXT 0x8052\r\n#define GL_RGB12_EXT 0x8053\r\n#define GL_RGB16_EXT 0x8054\r\n#define GL_RGBA2_EXT 0x8055\r\n#define GL_RGBA4_EXT 0x8056\r\n#define GL_RGB5_A1_EXT 0x8057\r\n#define GL_RGBA8_EXT 0x8058\r\n#define GL_RGB10_A2_EXT 0x8059\r\n#define GL_RGBA12_EXT 0x805A\r\n#define GL_RGBA16_EXT 0x805B\r\n#define GL_TEXTURE_RED_SIZE_EXT 0x805C\r\n#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D\r\n#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E\r\n#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F\r\n#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060\r\n#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061\r\n#define GL_REPLACE_EXT 0x8062\r\n#define GL_PROXY_TEXTURE_1D_EXT 0x8063\r\n#define GL_PROXY_TEXTURE_2D_EXT 0x8064\r\n\r\n#define GLEW_EXT_texture GLEW_GET_VAR(__GLEW_EXT_texture)\r\n\r\n#endif /* GL_EXT_texture */\r\n\r\n/* ---------------------------- GL_EXT_texture3D --------------------------- */\r\n\r\n#ifndef GL_EXT_texture3D\r\n#define GL_EXT_texture3D 1\r\n\r\n#define GL_PACK_SKIP_IMAGES_EXT 0x806B\r\n#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C\r\n#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D\r\n#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E\r\n#define GL_TEXTURE_3D_EXT 0x806F\r\n#define GL_PROXY_TEXTURE_3D_EXT 0x8070\r\n#define GL_TEXTURE_DEPTH_EXT 0x8071\r\n#define GL_TEXTURE_WRAP_R_EXT 0x8072\r\n#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);\r\n\r\n#define glTexImage3DEXT GLEW_GET_FUN(__glewTexImage3DEXT)\r\n\r\n#define GLEW_EXT_texture3D GLEW_GET_VAR(__GLEW_EXT_texture3D)\r\n\r\n#endif /* GL_EXT_texture3D */\r\n\r\n/* -------------------------- GL_EXT_texture_array ------------------------- */\r\n\r\n#ifndef GL_EXT_texture_array\r\n#define GL_EXT_texture_array 1\r\n\r\n#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E\r\n#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF\r\n#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18\r\n#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19\r\n#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A\r\n#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B\r\n#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C\r\n#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\n\r\n#define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT)\r\n\r\n#define GLEW_EXT_texture_array GLEW_GET_VAR(__GLEW_EXT_texture_array)\r\n\r\n#endif /* GL_EXT_texture_array */\r\n\r\n/* ---------------------- GL_EXT_texture_buffer_object --------------------- */\r\n\r\n#ifndef GL_EXT_texture_buffer_object\r\n#define GL_EXT_texture_buffer_object 1\r\n\r\n#define GL_TEXTURE_BUFFER_EXT 0x8C2A\r\n#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B\r\n#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C\r\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D\r\n#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);\r\n\r\n#define glTexBufferEXT GLEW_GET_FUN(__glewTexBufferEXT)\r\n\r\n#define GLEW_EXT_texture_buffer_object GLEW_GET_VAR(__GLEW_EXT_texture_buffer_object)\r\n\r\n#endif /* GL_EXT_texture_buffer_object */\r\n\r\n/* -------------------- GL_EXT_texture_compression_dxt1 -------------------- */\r\n\r\n#ifndef GL_EXT_texture_compression_dxt1\r\n#define GL_EXT_texture_compression_dxt1 1\r\n\r\n#define GLEW_EXT_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_EXT_texture_compression_dxt1)\r\n\r\n#endif /* GL_EXT_texture_compression_dxt1 */\r\n\r\n/* -------------------- GL_EXT_texture_compression_latc -------------------- */\r\n\r\n#ifndef GL_EXT_texture_compression_latc\r\n#define GL_EXT_texture_compression_latc 1\r\n\r\n#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70\r\n#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72\r\n#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73\r\n\r\n#define GLEW_EXT_texture_compression_latc GLEW_GET_VAR(__GLEW_EXT_texture_compression_latc)\r\n\r\n#endif /* GL_EXT_texture_compression_latc */\r\n\r\n/* -------------------- GL_EXT_texture_compression_rgtc -------------------- */\r\n\r\n#ifndef GL_EXT_texture_compression_rgtc\r\n#define GL_EXT_texture_compression_rgtc 1\r\n\r\n#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB\r\n#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC\r\n#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD\r\n#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE\r\n\r\n#define GLEW_EXT_texture_compression_rgtc GLEW_GET_VAR(__GLEW_EXT_texture_compression_rgtc)\r\n\r\n#endif /* GL_EXT_texture_compression_rgtc */\r\n\r\n/* -------------------- GL_EXT_texture_compression_s3tc -------------------- */\r\n\r\n#ifndef GL_EXT_texture_compression_s3tc\r\n#define GL_EXT_texture_compression_s3tc 1\r\n\r\n#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0\r\n#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1\r\n#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2\r\n#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3\r\n\r\n#define GLEW_EXT_texture_compression_s3tc GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc)\r\n\r\n#endif /* GL_EXT_texture_compression_s3tc */\r\n\r\n/* ------------------------ GL_EXT_texture_cube_map ------------------------ */\r\n\r\n#ifndef GL_EXT_texture_cube_map\r\n#define GL_EXT_texture_cube_map 1\r\n\r\n#define GL_NORMAL_MAP_EXT 0x8511\r\n#define GL_REFLECTION_MAP_EXT 0x8512\r\n#define GL_TEXTURE_CUBE_MAP_EXT 0x8513\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B\r\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C\r\n\r\n#define GLEW_EXT_texture_cube_map GLEW_GET_VAR(__GLEW_EXT_texture_cube_map)\r\n\r\n#endif /* GL_EXT_texture_cube_map */\r\n\r\n/* ----------------------- GL_EXT_texture_edge_clamp ----------------------- */\r\n\r\n#ifndef GL_EXT_texture_edge_clamp\r\n#define GL_EXT_texture_edge_clamp 1\r\n\r\n#define GL_CLAMP_TO_EDGE_EXT 0x812F\r\n\r\n#define GLEW_EXT_texture_edge_clamp GLEW_GET_VAR(__GLEW_EXT_texture_edge_clamp)\r\n\r\n#endif /* GL_EXT_texture_edge_clamp */\r\n\r\n/* --------------------------- GL_EXT_texture_env -------------------------- */\r\n\r\n#ifndef GL_EXT_texture_env\r\n#define GL_EXT_texture_env 1\r\n\r\n#define GL_TEXTURE_ENV0_EXT 0\r\n#define GL_ENV_BLEND_EXT 0\r\n#define GL_TEXTURE_ENV_SHIFT_EXT 0\r\n#define GL_ENV_REPLACE_EXT 0\r\n#define GL_ENV_ADD_EXT 0\r\n#define GL_ENV_SUBTRACT_EXT 0\r\n#define GL_TEXTURE_ENV_MODE_ALPHA_EXT 0\r\n#define GL_ENV_REVERSE_SUBTRACT_EXT 0\r\n#define GL_ENV_REVERSE_BLEND_EXT 0\r\n#define GL_ENV_COPY_EXT 0\r\n#define GL_ENV_MODULATE_EXT 0\r\n\r\n#define GLEW_EXT_texture_env GLEW_GET_VAR(__GLEW_EXT_texture_env)\r\n\r\n#endif /* GL_EXT_texture_env */\r\n\r\n/* ------------------------- GL_EXT_texture_env_add ------------------------ */\r\n\r\n#ifndef GL_EXT_texture_env_add\r\n#define GL_EXT_texture_env_add 1\r\n\r\n#define GLEW_EXT_texture_env_add GLEW_GET_VAR(__GLEW_EXT_texture_env_add)\r\n\r\n#endif /* GL_EXT_texture_env_add */\r\n\r\n/* ----------------------- GL_EXT_texture_env_combine ---------------------- */\r\n\r\n#ifndef GL_EXT_texture_env_combine\r\n#define GL_EXT_texture_env_combine 1\r\n\r\n#define GL_COMBINE_EXT 0x8570\r\n#define GL_COMBINE_RGB_EXT 0x8571\r\n#define GL_COMBINE_ALPHA_EXT 0x8572\r\n#define GL_RGB_SCALE_EXT 0x8573\r\n#define GL_ADD_SIGNED_EXT 0x8574\r\n#define GL_INTERPOLATE_EXT 0x8575\r\n#define GL_CONSTANT_EXT 0x8576\r\n#define GL_PRIMARY_COLOR_EXT 0x8577\r\n#define GL_PREVIOUS_EXT 0x8578\r\n#define GL_SOURCE0_RGB_EXT 0x8580\r\n#define GL_SOURCE1_RGB_EXT 0x8581\r\n#define GL_SOURCE2_RGB_EXT 0x8582\r\n#define GL_SOURCE0_ALPHA_EXT 0x8588\r\n#define GL_SOURCE1_ALPHA_EXT 0x8589\r\n#define GL_SOURCE2_ALPHA_EXT 0x858A\r\n#define GL_OPERAND0_RGB_EXT 0x8590\r\n#define GL_OPERAND1_RGB_EXT 0x8591\r\n#define GL_OPERAND2_RGB_EXT 0x8592\r\n#define GL_OPERAND0_ALPHA_EXT 0x8598\r\n#define GL_OPERAND1_ALPHA_EXT 0x8599\r\n#define GL_OPERAND2_ALPHA_EXT 0x859A\r\n\r\n#define GLEW_EXT_texture_env_combine GLEW_GET_VAR(__GLEW_EXT_texture_env_combine)\r\n\r\n#endif /* GL_EXT_texture_env_combine */\r\n\r\n/* ------------------------ GL_EXT_texture_env_dot3 ------------------------ */\r\n\r\n#ifndef GL_EXT_texture_env_dot3\r\n#define GL_EXT_texture_env_dot3 1\r\n\r\n#define GL_DOT3_RGB_EXT 0x8740\r\n#define GL_DOT3_RGBA_EXT 0x8741\r\n\r\n#define GLEW_EXT_texture_env_dot3 GLEW_GET_VAR(__GLEW_EXT_texture_env_dot3)\r\n\r\n#endif /* GL_EXT_texture_env_dot3 */\r\n\r\n/* ------------------- GL_EXT_texture_filter_anisotropic ------------------- */\r\n\r\n#ifndef GL_EXT_texture_filter_anisotropic\r\n#define GL_EXT_texture_filter_anisotropic 1\r\n\r\n#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE\r\n#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF\r\n\r\n#define GLEW_EXT_texture_filter_anisotropic GLEW_GET_VAR(__GLEW_EXT_texture_filter_anisotropic)\r\n\r\n#endif /* GL_EXT_texture_filter_anisotropic */\r\n\r\n/* ------------------------- GL_EXT_texture_integer ------------------------ */\r\n\r\n#ifndef GL_EXT_texture_integer\r\n#define GL_EXT_texture_integer 1\r\n\r\n#define GL_RGBA32UI_EXT 0x8D70\r\n#define GL_RGB32UI_EXT 0x8D71\r\n#define GL_ALPHA32UI_EXT 0x8D72\r\n#define GL_INTENSITY32UI_EXT 0x8D73\r\n#define GL_LUMINANCE32UI_EXT 0x8D74\r\n#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75\r\n#define GL_RGBA16UI_EXT 0x8D76\r\n#define GL_RGB16UI_EXT 0x8D77\r\n#define GL_ALPHA16UI_EXT 0x8D78\r\n#define GL_INTENSITY16UI_EXT 0x8D79\r\n#define GL_LUMINANCE16UI_EXT 0x8D7A\r\n#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B\r\n#define GL_RGBA8UI_EXT 0x8D7C\r\n#define GL_RGB8UI_EXT 0x8D7D\r\n#define GL_ALPHA8UI_EXT 0x8D7E\r\n#define GL_INTENSITY8UI_EXT 0x8D7F\r\n#define GL_LUMINANCE8UI_EXT 0x8D80\r\n#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81\r\n#define GL_RGBA32I_EXT 0x8D82\r\n#define GL_RGB32I_EXT 0x8D83\r\n#define GL_ALPHA32I_EXT 0x8D84\r\n#define GL_INTENSITY32I_EXT 0x8D85\r\n#define GL_LUMINANCE32I_EXT 0x8D86\r\n#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87\r\n#define GL_RGBA16I_EXT 0x8D88\r\n#define GL_RGB16I_EXT 0x8D89\r\n#define GL_ALPHA16I_EXT 0x8D8A\r\n#define GL_INTENSITY16I_EXT 0x8D8B\r\n#define GL_LUMINANCE16I_EXT 0x8D8C\r\n#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D\r\n#define GL_RGBA8I_EXT 0x8D8E\r\n#define GL_RGB8I_EXT 0x8D8F\r\n#define GL_ALPHA8I_EXT 0x8D90\r\n#define GL_INTENSITY8I_EXT 0x8D91\r\n#define GL_LUMINANCE8I_EXT 0x8D92\r\n#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93\r\n#define GL_RED_INTEGER_EXT 0x8D94\r\n#define GL_GREEN_INTEGER_EXT 0x8D95\r\n#define GL_BLUE_INTEGER_EXT 0x8D96\r\n#define GL_ALPHA_INTEGER_EXT 0x8D97\r\n#define GL_RGB_INTEGER_EXT 0x8D98\r\n#define GL_RGBA_INTEGER_EXT 0x8D99\r\n#define GL_BGR_INTEGER_EXT 0x8D9A\r\n#define GL_BGRA_INTEGER_EXT 0x8D9B\r\n#define GL_LUMINANCE_INTEGER_EXT 0x8D9C\r\n#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D\r\n#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);\r\ntypedef void (GLAPIENTRY * PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);\r\n\r\n#define glClearColorIiEXT GLEW_GET_FUN(__glewClearColorIiEXT)\r\n#define glClearColorIuiEXT GLEW_GET_FUN(__glewClearColorIuiEXT)\r\n#define glGetTexParameterIivEXT GLEW_GET_FUN(__glewGetTexParameterIivEXT)\r\n#define glGetTexParameterIuivEXT GLEW_GET_FUN(__glewGetTexParameterIuivEXT)\r\n#define glTexParameterIivEXT GLEW_GET_FUN(__glewTexParameterIivEXT)\r\n#define glTexParameterIuivEXT GLEW_GET_FUN(__glewTexParameterIuivEXT)\r\n\r\n#define GLEW_EXT_texture_integer GLEW_GET_VAR(__GLEW_EXT_texture_integer)\r\n\r\n#endif /* GL_EXT_texture_integer */\r\n\r\n/* ------------------------ GL_EXT_texture_lod_bias ------------------------ */\r\n\r\n#ifndef GL_EXT_texture_lod_bias\r\n#define GL_EXT_texture_lod_bias 1\r\n\r\n#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD\r\n#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500\r\n#define GL_TEXTURE_LOD_BIAS_EXT 0x8501\r\n\r\n#define GLEW_EXT_texture_lod_bias GLEW_GET_VAR(__GLEW_EXT_texture_lod_bias)\r\n\r\n#endif /* GL_EXT_texture_lod_bias */\r\n\r\n/* ---------------------- GL_EXT_texture_mirror_clamp ---------------------- */\r\n\r\n#ifndef GL_EXT_texture_mirror_clamp\r\n#define GL_EXT_texture_mirror_clamp 1\r\n\r\n#define GL_MIRROR_CLAMP_EXT 0x8742\r\n#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743\r\n#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912\r\n\r\n#define GLEW_EXT_texture_mirror_clamp GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp)\r\n\r\n#endif /* GL_EXT_texture_mirror_clamp */\r\n\r\n/* ------------------------- GL_EXT_texture_object ------------------------- */\r\n\r\n#ifndef GL_EXT_texture_object\r\n#define GL_EXT_texture_object 1\r\n\r\n#define GL_TEXTURE_PRIORITY_EXT 0x8066\r\n#define GL_TEXTURE_RESIDENT_EXT 0x8067\r\n#define GL_TEXTURE_1D_BINDING_EXT 0x8068\r\n#define GL_TEXTURE_2D_BINDING_EXT 0x8069\r\n#define GL_TEXTURE_3D_BINDING_EXT 0x806A\r\n\r\ntypedef GLboolean (GLAPIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint* textures, GLboolean* residences);\r\ntypedef void (GLAPIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);\r\ntypedef void (GLAPIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint* textures);\r\ntypedef void (GLAPIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint* textures);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture);\r\ntypedef void (GLAPIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint* textures, const GLclampf* priorities);\r\n\r\n#define glAreTexturesResidentEXT GLEW_GET_FUN(__glewAreTexturesResidentEXT)\r\n#define glBindTextureEXT GLEW_GET_FUN(__glewBindTextureEXT)\r\n#define glDeleteTexturesEXT GLEW_GET_FUN(__glewDeleteTexturesEXT)\r\n#define glGenTexturesEXT GLEW_GET_FUN(__glewGenTexturesEXT)\r\n#define glIsTextureEXT GLEW_GET_FUN(__glewIsTextureEXT)\r\n#define glPrioritizeTexturesEXT GLEW_GET_FUN(__glewPrioritizeTexturesEXT)\r\n\r\n#define GLEW_EXT_texture_object GLEW_GET_VAR(__GLEW_EXT_texture_object)\r\n\r\n#endif /* GL_EXT_texture_object */\r\n\r\n/* --------------------- GL_EXT_texture_perturb_normal --------------------- */\r\n\r\n#ifndef GL_EXT_texture_perturb_normal\r\n#define GL_EXT_texture_perturb_normal 1\r\n\r\n#define GL_PERTURB_EXT 0x85AE\r\n#define GL_TEXTURE_NORMAL_EXT 0x85AF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode);\r\n\r\n#define glTextureNormalEXT GLEW_GET_FUN(__glewTextureNormalEXT)\r\n\r\n#define GLEW_EXT_texture_perturb_normal GLEW_GET_VAR(__GLEW_EXT_texture_perturb_normal)\r\n\r\n#endif /* GL_EXT_texture_perturb_normal */\r\n\r\n/* ------------------------ GL_EXT_texture_rectangle ----------------------- */\r\n\r\n#ifndef GL_EXT_texture_rectangle\r\n#define GL_EXT_texture_rectangle 1\r\n\r\n#define GL_TEXTURE_RECTANGLE_EXT 0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8\r\n\r\n#define GLEW_EXT_texture_rectangle GLEW_GET_VAR(__GLEW_EXT_texture_rectangle)\r\n\r\n#endif /* GL_EXT_texture_rectangle */\r\n\r\n/* -------------------------- GL_EXT_texture_sRGB -------------------------- */\r\n\r\n#ifndef GL_EXT_texture_sRGB\r\n#define GL_EXT_texture_sRGB 1\r\n\r\n#define GL_SRGB_EXT 0x8C40\r\n#define GL_SRGB8_EXT 0x8C41\r\n#define GL_SRGB_ALPHA_EXT 0x8C42\r\n#define GL_SRGB8_ALPHA8_EXT 0x8C43\r\n#define GL_SLUMINANCE_ALPHA_EXT 0x8C44\r\n#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45\r\n#define GL_SLUMINANCE_EXT 0x8C46\r\n#define GL_SLUMINANCE8_EXT 0x8C47\r\n#define GL_COMPRESSED_SRGB_EXT 0x8C48\r\n#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49\r\n#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A\r\n#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B\r\n#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C\r\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D\r\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E\r\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F\r\n\r\n#define GLEW_EXT_texture_sRGB GLEW_GET_VAR(__GLEW_EXT_texture_sRGB)\r\n\r\n#endif /* GL_EXT_texture_sRGB */\r\n\r\n/* ----------------------- GL_EXT_texture_sRGB_decode ---------------------- */\r\n\r\n#ifndef GL_EXT_texture_sRGB_decode\r\n#define GL_EXT_texture_sRGB_decode 1\r\n\r\n#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48\r\n#define GL_DECODE_EXT 0x8A49\r\n#define GL_SKIP_DECODE_EXT 0x8A4A\r\n\r\n#define GLEW_EXT_texture_sRGB_decode GLEW_GET_VAR(__GLEW_EXT_texture_sRGB_decode)\r\n\r\n#endif /* GL_EXT_texture_sRGB_decode */\r\n\r\n/* --------------------- GL_EXT_texture_shared_exponent -------------------- */\r\n\r\n#ifndef GL_EXT_texture_shared_exponent\r\n#define GL_EXT_texture_shared_exponent 1\r\n\r\n#define GL_RGB9_E5_EXT 0x8C3D\r\n#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E\r\n#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F\r\n\r\n#define GLEW_EXT_texture_shared_exponent GLEW_GET_VAR(__GLEW_EXT_texture_shared_exponent)\r\n\r\n#endif /* GL_EXT_texture_shared_exponent */\r\n\r\n/* -------------------------- GL_EXT_texture_snorm ------------------------- */\r\n\r\n#ifndef GL_EXT_texture_snorm\r\n#define GL_EXT_texture_snorm 1\r\n\r\n#define GL_RED_SNORM 0x8F90\r\n#define GL_RG_SNORM 0x8F91\r\n#define GL_RGB_SNORM 0x8F92\r\n#define GL_RGBA_SNORM 0x8F93\r\n#define GL_R8_SNORM 0x8F94\r\n#define GL_RG8_SNORM 0x8F95\r\n#define GL_RGB8_SNORM 0x8F96\r\n#define GL_RGBA8_SNORM 0x8F97\r\n#define GL_R16_SNORM 0x8F98\r\n#define GL_RG16_SNORM 0x8F99\r\n#define GL_RGB16_SNORM 0x8F9A\r\n#define GL_RGBA16_SNORM 0x8F9B\r\n#define GL_SIGNED_NORMALIZED 0x8F9C\r\n#define GL_ALPHA_SNORM 0x9010\r\n#define GL_LUMINANCE_SNORM 0x9011\r\n#define GL_LUMINANCE_ALPHA_SNORM 0x9012\r\n#define GL_INTENSITY_SNORM 0x9013\r\n#define GL_ALPHA8_SNORM 0x9014\r\n#define GL_LUMINANCE8_SNORM 0x9015\r\n#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016\r\n#define GL_INTENSITY8_SNORM 0x9017\r\n#define GL_ALPHA16_SNORM 0x9018\r\n#define GL_LUMINANCE16_SNORM 0x9019\r\n#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A\r\n#define GL_INTENSITY16_SNORM 0x901B\r\n\r\n#define GLEW_EXT_texture_snorm GLEW_GET_VAR(__GLEW_EXT_texture_snorm)\r\n\r\n#endif /* GL_EXT_texture_snorm */\r\n\r\n/* ------------------------- GL_EXT_texture_swizzle ------------------------ */\r\n\r\n#ifndef GL_EXT_texture_swizzle\r\n#define GL_EXT_texture_swizzle 1\r\n\r\n#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42\r\n#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43\r\n#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44\r\n#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45\r\n#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46\r\n\r\n#define GLEW_EXT_texture_swizzle GLEW_GET_VAR(__GLEW_EXT_texture_swizzle)\r\n\r\n#endif /* GL_EXT_texture_swizzle */\r\n\r\n/* --------------------------- GL_EXT_timer_query -------------------------- */\r\n\r\n#ifndef GL_EXT_timer_query\r\n#define GL_EXT_timer_query 1\r\n\r\n#define GL_TIME_ELAPSED_EXT 0x88BF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);\r\n\r\n#define glGetQueryObjecti64vEXT GLEW_GET_FUN(__glewGetQueryObjecti64vEXT)\r\n#define glGetQueryObjectui64vEXT GLEW_GET_FUN(__glewGetQueryObjectui64vEXT)\r\n\r\n#define GLEW_EXT_timer_query GLEW_GET_VAR(__GLEW_EXT_timer_query)\r\n\r\n#endif /* GL_EXT_timer_query */\r\n\r\n/* ----------------------- GL_EXT_transform_feedback ----------------------- */\r\n\r\n#ifndef GL_EXT_transform_feedback\r\n#define GL_EXT_transform_feedback 1\r\n\r\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80\r\n#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85\r\n#define GL_PRIMITIVES_GENERATED_EXT 0x8C87\r\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88\r\n#define GL_RASTERIZER_DISCARD_EXT 0x8C89\r\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B\r\n#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C\r\n#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei *size, GLenum *type, GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar ** varyings, GLenum bufferMode);\r\n\r\n#define glBeginTransformFeedbackEXT GLEW_GET_FUN(__glewBeginTransformFeedbackEXT)\r\n#define glBindBufferBaseEXT GLEW_GET_FUN(__glewBindBufferBaseEXT)\r\n#define glBindBufferOffsetEXT GLEW_GET_FUN(__glewBindBufferOffsetEXT)\r\n#define glBindBufferRangeEXT GLEW_GET_FUN(__glewBindBufferRangeEXT)\r\n#define glEndTransformFeedbackEXT GLEW_GET_FUN(__glewEndTransformFeedbackEXT)\r\n#define glGetTransformFeedbackVaryingEXT GLEW_GET_FUN(__glewGetTransformFeedbackVaryingEXT)\r\n#define glTransformFeedbackVaryingsEXT GLEW_GET_FUN(__glewTransformFeedbackVaryingsEXT)\r\n\r\n#define GLEW_EXT_transform_feedback GLEW_GET_VAR(__GLEW_EXT_transform_feedback)\r\n\r\n#endif /* GL_EXT_transform_feedback */\r\n\r\n/* -------------------------- GL_EXT_vertex_array -------------------------- */\r\n\r\n#ifndef GL_EXT_vertex_array\r\n#define GL_EXT_vertex_array 1\r\n\r\n#define GL_DOUBLE_EXT 0x140A\r\n#define GL_VERTEX_ARRAY_EXT 0x8074\r\n#define GL_NORMAL_ARRAY_EXT 0x8075\r\n#define GL_COLOR_ARRAY_EXT 0x8076\r\n#define GL_INDEX_ARRAY_EXT 0x8077\r\n#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078\r\n#define GL_EDGE_FLAG_ARRAY_EXT 0x8079\r\n#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A\r\n#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B\r\n#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C\r\n#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D\r\n#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E\r\n#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F\r\n#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080\r\n#define GL_COLOR_ARRAY_SIZE_EXT 0x8081\r\n#define GL_COLOR_ARRAY_TYPE_EXT 0x8082\r\n#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083\r\n#define GL_COLOR_ARRAY_COUNT_EXT 0x8084\r\n#define GL_INDEX_ARRAY_TYPE_EXT 0x8085\r\n#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086\r\n#define GL_INDEX_ARRAY_COUNT_EXT 0x8087\r\n#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088\r\n#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089\r\n#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A\r\n#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B\r\n#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C\r\n#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D\r\n#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E\r\n#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F\r\n#define GL_COLOR_ARRAY_POINTER_EXT 0x8090\r\n#define GL_INDEX_ARRAY_POINTER_EXT 0x8091\r\n#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092\r\n#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093\r\n\r\ntypedef void (GLAPIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);\r\ntypedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer);\r\n\r\n#define glArrayElementEXT GLEW_GET_FUN(__glewArrayElementEXT)\r\n#define glColorPointerEXT GLEW_GET_FUN(__glewColorPointerEXT)\r\n#define glDrawArraysEXT GLEW_GET_FUN(__glewDrawArraysEXT)\r\n#define glEdgeFlagPointerEXT GLEW_GET_FUN(__glewEdgeFlagPointerEXT)\r\n#define glIndexPointerEXT GLEW_GET_FUN(__glewIndexPointerEXT)\r\n#define glNormalPointerEXT GLEW_GET_FUN(__glewNormalPointerEXT)\r\n#define glTexCoordPointerEXT GLEW_GET_FUN(__glewTexCoordPointerEXT)\r\n#define glVertexPointerEXT GLEW_GET_FUN(__glewVertexPointerEXT)\r\n\r\n#define GLEW_EXT_vertex_array GLEW_GET_VAR(__GLEW_EXT_vertex_array)\r\n\r\n#endif /* GL_EXT_vertex_array */\r\n\r\n/* ------------------------ GL_EXT_vertex_array_bgra ----------------------- */\r\n\r\n#ifndef GL_EXT_vertex_array_bgra\r\n#define GL_EXT_vertex_array_bgra 1\r\n\r\n#define GL_BGRA 0x80E1\r\n\r\n#define GLEW_EXT_vertex_array_bgra GLEW_GET_VAR(__GLEW_EXT_vertex_array_bgra)\r\n\r\n#endif /* GL_EXT_vertex_array_bgra */\r\n\r\n/* ----------------------- GL_EXT_vertex_attrib_64bit ---------------------- */\r\n\r\n#ifndef GL_EXT_vertex_attrib_64bit\r\n#define GL_EXT_vertex_attrib_64bit 1\r\n\r\n#define GL_DOUBLE_MAT2_EXT 0x8F46\r\n#define GL_DOUBLE_MAT3_EXT 0x8F47\r\n#define GL_DOUBLE_MAT4_EXT 0x8F48\r\n#define GL_DOUBLE_MAT2x3_EXT 0x8F49\r\n#define GL_DOUBLE_MAT2x4_EXT 0x8F4A\r\n#define GL_DOUBLE_MAT3x2_EXT 0x8F4B\r\n#define GL_DOUBLE_MAT3x4_EXT 0x8F4C\r\n#define GL_DOUBLE_MAT4x2_EXT 0x8F4D\r\n#define GL_DOUBLE_MAT4x3_EXT 0x8F4E\r\n#define GL_DOUBLE_VEC2_EXT 0x8FFC\r\n#define GL_DOUBLE_VEC3_EXT 0x8FFD\r\n#define GL_DOUBLE_VEC4_EXT 0x8FFE\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);\r\n\r\n#define glGetVertexAttribLdvEXT GLEW_GET_FUN(__glewGetVertexAttribLdvEXT)\r\n#define glVertexArrayVertexAttribLOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLOffsetEXT)\r\n#define glVertexAttribL1dEXT GLEW_GET_FUN(__glewVertexAttribL1dEXT)\r\n#define glVertexAttribL1dvEXT GLEW_GET_FUN(__glewVertexAttribL1dvEXT)\r\n#define glVertexAttribL2dEXT GLEW_GET_FUN(__glewVertexAttribL2dEXT)\r\n#define glVertexAttribL2dvEXT GLEW_GET_FUN(__glewVertexAttribL2dvEXT)\r\n#define glVertexAttribL3dEXT GLEW_GET_FUN(__glewVertexAttribL3dEXT)\r\n#define glVertexAttribL3dvEXT GLEW_GET_FUN(__glewVertexAttribL3dvEXT)\r\n#define glVertexAttribL4dEXT GLEW_GET_FUN(__glewVertexAttribL4dEXT)\r\n#define glVertexAttribL4dvEXT GLEW_GET_FUN(__glewVertexAttribL4dvEXT)\r\n#define glVertexAttribLPointerEXT GLEW_GET_FUN(__glewVertexAttribLPointerEXT)\r\n\r\n#define GLEW_EXT_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_EXT_vertex_attrib_64bit)\r\n\r\n#endif /* GL_EXT_vertex_attrib_64bit */\r\n\r\n/* -------------------------- GL_EXT_vertex_shader ------------------------- */\r\n\r\n#ifndef GL_EXT_vertex_shader\r\n#define GL_EXT_vertex_shader 1\r\n\r\n#define GL_VERTEX_SHADER_EXT 0x8780\r\n#define GL_VERTEX_SHADER_BINDING_EXT 0x8781\r\n#define GL_OP_INDEX_EXT 0x8782\r\n#define GL_OP_NEGATE_EXT 0x8783\r\n#define GL_OP_DOT3_EXT 0x8784\r\n#define GL_OP_DOT4_EXT 0x8785\r\n#define GL_OP_MUL_EXT 0x8786\r\n#define GL_OP_ADD_EXT 0x8787\r\n#define GL_OP_MADD_EXT 0x8788\r\n#define GL_OP_FRAC_EXT 0x8789\r\n#define GL_OP_MAX_EXT 0x878A\r\n#define GL_OP_MIN_EXT 0x878B\r\n#define GL_OP_SET_GE_EXT 0x878C\r\n#define GL_OP_SET_LT_EXT 0x878D\r\n#define GL_OP_CLAMP_EXT 0x878E\r\n#define GL_OP_FLOOR_EXT 0x878F\r\n#define GL_OP_ROUND_EXT 0x8790\r\n#define GL_OP_EXP_BASE_2_EXT 0x8791\r\n#define GL_OP_LOG_BASE_2_EXT 0x8792\r\n#define GL_OP_POWER_EXT 0x8793\r\n#define GL_OP_RECIP_EXT 0x8794\r\n#define GL_OP_RECIP_SQRT_EXT 0x8795\r\n#define GL_OP_SUB_EXT 0x8796\r\n#define GL_OP_CROSS_PRODUCT_EXT 0x8797\r\n#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798\r\n#define GL_OP_MOV_EXT 0x8799\r\n#define GL_OUTPUT_VERTEX_EXT 0x879A\r\n#define GL_OUTPUT_COLOR0_EXT 0x879B\r\n#define GL_OUTPUT_COLOR1_EXT 0x879C\r\n#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D\r\n#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E\r\n#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F\r\n#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0\r\n#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1\r\n#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2\r\n#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3\r\n#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4\r\n#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5\r\n#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6\r\n#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7\r\n#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8\r\n#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9\r\n#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA\r\n#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB\r\n#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC\r\n#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD\r\n#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE\r\n#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF\r\n#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0\r\n#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1\r\n#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2\r\n#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3\r\n#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4\r\n#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5\r\n#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6\r\n#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7\r\n#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8\r\n#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9\r\n#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA\r\n#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB\r\n#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC\r\n#define GL_OUTPUT_FOG_EXT 0x87BD\r\n#define GL_SCALAR_EXT 0x87BE\r\n#define GL_VECTOR_EXT 0x87BF\r\n#define GL_MATRIX_EXT 0x87C0\r\n#define GL_VARIANT_EXT 0x87C1\r\n#define GL_INVARIANT_EXT 0x87C2\r\n#define GL_LOCAL_CONSTANT_EXT 0x87C3\r\n#define GL_LOCAL_EXT 0x87C4\r\n#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5\r\n#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6\r\n#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7\r\n#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8\r\n#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE\r\n#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF\r\n#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0\r\n#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1\r\n#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2\r\n#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3\r\n#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4\r\n#define GL_X_EXT 0x87D5\r\n#define GL_Y_EXT 0x87D6\r\n#define GL_Z_EXT 0x87D7\r\n#define GL_W_EXT 0x87D8\r\n#define GL_NEGATIVE_X_EXT 0x87D9\r\n#define GL_NEGATIVE_Y_EXT 0x87DA\r\n#define GL_NEGATIVE_Z_EXT 0x87DB\r\n#define GL_NEGATIVE_W_EXT 0x87DC\r\n#define GL_ZERO_EXT 0x87DD\r\n#define GL_ONE_EXT 0x87DE\r\n#define GL_NEGATIVE_ONE_EXT 0x87DF\r\n#define GL_NORMALIZED_RANGE_EXT 0x87E0\r\n#define GL_FULL_RANGE_EXT 0x87E1\r\n#define GL_CURRENT_VERTEX_EXT 0x87E2\r\n#define GL_MVP_MATRIX_EXT 0x87E3\r\n#define GL_VARIANT_VALUE_EXT 0x87E4\r\n#define GL_VARIANT_DATATYPE_EXT 0x87E5\r\n#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6\r\n#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7\r\n#define GL_VARIANT_ARRAY_EXT 0x87E8\r\n#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9\r\n#define GL_INVARIANT_VALUE_EXT 0x87EA\r\n#define GL_INVARIANT_DATATYPE_EXT 0x87EB\r\n#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC\r\n#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void);\r\ntypedef GLuint (GLAPIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);\r\ntypedef GLuint (GLAPIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);\r\ntypedef GLuint (GLAPIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value);\r\ntypedef GLuint (GLAPIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);\r\ntypedef GLuint (GLAPIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);\r\ntypedef void (GLAPIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);\r\ntypedef void (GLAPIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\r\ntypedef void (GLAPIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid **data);\r\ntypedef void (GLAPIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);\r\ntypedef void (GLAPIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr);\r\ntypedef void (GLAPIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr);\r\ntypedef void (GLAPIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);\r\ntypedef void (GLAPIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);\r\ntypedef void (GLAPIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);\r\ntypedef void (GLAPIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, GLvoid *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, GLbyte *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, GLdouble *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, GLfloat *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, GLint *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, GLshort *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, GLubyte *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, GLuint *addr);\r\ntypedef void (GLAPIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, GLushort *addr);\r\ntypedef void (GLAPIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\r\n\r\n#define glBeginVertexShaderEXT GLEW_GET_FUN(__glewBeginVertexShaderEXT)\r\n#define glBindLightParameterEXT GLEW_GET_FUN(__glewBindLightParameterEXT)\r\n#define glBindMaterialParameterEXT GLEW_GET_FUN(__glewBindMaterialParameterEXT)\r\n#define glBindParameterEXT GLEW_GET_FUN(__glewBindParameterEXT)\r\n#define glBindTexGenParameterEXT GLEW_GET_FUN(__glewBindTexGenParameterEXT)\r\n#define glBindTextureUnitParameterEXT GLEW_GET_FUN(__glewBindTextureUnitParameterEXT)\r\n#define glBindVertexShaderEXT GLEW_GET_FUN(__glewBindVertexShaderEXT)\r\n#define glDeleteVertexShaderEXT GLEW_GET_FUN(__glewDeleteVertexShaderEXT)\r\n#define glDisableVariantClientStateEXT GLEW_GET_FUN(__glewDisableVariantClientStateEXT)\r\n#define glEnableVariantClientStateEXT GLEW_GET_FUN(__glewEnableVariantClientStateEXT)\r\n#define glEndVertexShaderEXT GLEW_GET_FUN(__glewEndVertexShaderEXT)\r\n#define glExtractComponentEXT GLEW_GET_FUN(__glewExtractComponentEXT)\r\n#define glGenSymbolsEXT GLEW_GET_FUN(__glewGenSymbolsEXT)\r\n#define glGenVertexShadersEXT GLEW_GET_FUN(__glewGenVertexShadersEXT)\r\n#define glGetInvariantBooleanvEXT GLEW_GET_FUN(__glewGetInvariantBooleanvEXT)\r\n#define glGetInvariantFloatvEXT GLEW_GET_FUN(__glewGetInvariantFloatvEXT)\r\n#define glGetInvariantIntegervEXT GLEW_GET_FUN(__glewGetInvariantIntegervEXT)\r\n#define glGetLocalConstantBooleanvEXT GLEW_GET_FUN(__glewGetLocalConstantBooleanvEXT)\r\n#define glGetLocalConstantFloatvEXT GLEW_GET_FUN(__glewGetLocalConstantFloatvEXT)\r\n#define glGetLocalConstantIntegervEXT GLEW_GET_FUN(__glewGetLocalConstantIntegervEXT)\r\n#define glGetVariantBooleanvEXT GLEW_GET_FUN(__glewGetVariantBooleanvEXT)\r\n#define glGetVariantFloatvEXT GLEW_GET_FUN(__glewGetVariantFloatvEXT)\r\n#define glGetVariantIntegervEXT GLEW_GET_FUN(__glewGetVariantIntegervEXT)\r\n#define glGetVariantPointervEXT GLEW_GET_FUN(__glewGetVariantPointervEXT)\r\n#define glInsertComponentEXT GLEW_GET_FUN(__glewInsertComponentEXT)\r\n#define glIsVariantEnabledEXT GLEW_GET_FUN(__glewIsVariantEnabledEXT)\r\n#define glSetInvariantEXT GLEW_GET_FUN(__glewSetInvariantEXT)\r\n#define glSetLocalConstantEXT GLEW_GET_FUN(__glewSetLocalConstantEXT)\r\n#define glShaderOp1EXT GLEW_GET_FUN(__glewShaderOp1EXT)\r\n#define glShaderOp2EXT GLEW_GET_FUN(__glewShaderOp2EXT)\r\n#define glShaderOp3EXT GLEW_GET_FUN(__glewShaderOp3EXT)\r\n#define glSwizzleEXT GLEW_GET_FUN(__glewSwizzleEXT)\r\n#define glVariantPointerEXT GLEW_GET_FUN(__glewVariantPointerEXT)\r\n#define glVariantbvEXT GLEW_GET_FUN(__glewVariantbvEXT)\r\n#define glVariantdvEXT GLEW_GET_FUN(__glewVariantdvEXT)\r\n#define glVariantfvEXT GLEW_GET_FUN(__glewVariantfvEXT)\r\n#define glVariantivEXT GLEW_GET_FUN(__glewVariantivEXT)\r\n#define glVariantsvEXT GLEW_GET_FUN(__glewVariantsvEXT)\r\n#define glVariantubvEXT GLEW_GET_FUN(__glewVariantubvEXT)\r\n#define glVariantuivEXT GLEW_GET_FUN(__glewVariantuivEXT)\r\n#define glVariantusvEXT GLEW_GET_FUN(__glewVariantusvEXT)\r\n#define glWriteMaskEXT GLEW_GET_FUN(__glewWriteMaskEXT)\r\n\r\n#define GLEW_EXT_vertex_shader GLEW_GET_VAR(__GLEW_EXT_vertex_shader)\r\n\r\n#endif /* GL_EXT_vertex_shader */\r\n\r\n/* ------------------------ GL_EXT_vertex_weighting ------------------------ */\r\n\r\n#ifndef GL_EXT_vertex_weighting\r\n#define GL_EXT_vertex_weighting 1\r\n\r\n#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3\r\n#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6\r\n#define GL_MODELVIEW0_EXT 0x1700\r\n#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502\r\n#define GL_MODELVIEW1_MATRIX_EXT 0x8506\r\n#define GL_VERTEX_WEIGHTING_EXT 0x8509\r\n#define GL_MODELVIEW1_EXT 0x850A\r\n#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B\r\n#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C\r\n#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D\r\n#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E\r\n#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F\r\n#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510\r\n\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight);\r\n\r\n#define glVertexWeightPointerEXT GLEW_GET_FUN(__glewVertexWeightPointerEXT)\r\n#define glVertexWeightfEXT GLEW_GET_FUN(__glewVertexWeightfEXT)\r\n#define glVertexWeightfvEXT GLEW_GET_FUN(__glewVertexWeightfvEXT)\r\n\r\n#define GLEW_EXT_vertex_weighting GLEW_GET_VAR(__GLEW_EXT_vertex_weighting)\r\n\r\n#endif /* GL_EXT_vertex_weighting */\r\n\r\n/* ------------------------- GL_EXT_x11_sync_object ------------------------ */\r\n\r\n#ifndef GL_EXT_x11_sync_object\r\n#define GL_EXT_x11_sync_object 1\r\n\r\n#define GL_SYNC_X11_FENCE_EXT 0x90E1\r\n\r\ntypedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);\r\n\r\n#define glImportSyncEXT GLEW_GET_FUN(__glewImportSyncEXT)\r\n\r\n#define GLEW_EXT_x11_sync_object GLEW_GET_VAR(__GLEW_EXT_x11_sync_object)\r\n\r\n#endif /* GL_EXT_x11_sync_object */\r\n\r\n/* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */\r\n\r\n#ifndef GL_GREMEDY_frame_terminator\r\n#define GL_GREMEDY_frame_terminator 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMETERMINATORGREMEDYPROC) (void);\r\n\r\n#define glFrameTerminatorGREMEDY GLEW_GET_FUN(__glewFrameTerminatorGREMEDY)\r\n\r\n#define GLEW_GREMEDY_frame_terminator GLEW_GET_VAR(__GLEW_GREMEDY_frame_terminator)\r\n\r\n#endif /* GL_GREMEDY_frame_terminator */\r\n\r\n/* ------------------------ GL_GREMEDY_string_marker ----------------------- */\r\n\r\n#ifndef GL_GREMEDY_string_marker\r\n#define GL_GREMEDY_string_marker 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void* string);\r\n\r\n#define glStringMarkerGREMEDY GLEW_GET_FUN(__glewStringMarkerGREMEDY)\r\n\r\n#define GLEW_GREMEDY_string_marker GLEW_GET_VAR(__GLEW_GREMEDY_string_marker)\r\n\r\n#endif /* GL_GREMEDY_string_marker */\r\n\r\n/* --------------------- GL_HP_convolution_border_modes -------------------- */\r\n\r\n#ifndef GL_HP_convolution_border_modes\r\n#define GL_HP_convolution_border_modes 1\r\n\r\n#define GLEW_HP_convolution_border_modes GLEW_GET_VAR(__GLEW_HP_convolution_border_modes)\r\n\r\n#endif /* GL_HP_convolution_border_modes */\r\n\r\n/* ------------------------- GL_HP_image_transform ------------------------- */\r\n\r\n#ifndef GL_HP_image_transform\r\n#define GL_HP_image_transform 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params);\r\n\r\n#define glGetImageTransformParameterfvHP GLEW_GET_FUN(__glewGetImageTransformParameterfvHP)\r\n#define glGetImageTransformParameterivHP GLEW_GET_FUN(__glewGetImageTransformParameterivHP)\r\n#define glImageTransformParameterfHP GLEW_GET_FUN(__glewImageTransformParameterfHP)\r\n#define glImageTransformParameterfvHP GLEW_GET_FUN(__glewImageTransformParameterfvHP)\r\n#define glImageTransformParameteriHP GLEW_GET_FUN(__glewImageTransformParameteriHP)\r\n#define glImageTransformParameterivHP GLEW_GET_FUN(__glewImageTransformParameterivHP)\r\n\r\n#define GLEW_HP_image_transform GLEW_GET_VAR(__GLEW_HP_image_transform)\r\n\r\n#endif /* GL_HP_image_transform */\r\n\r\n/* -------------------------- GL_HP_occlusion_test ------------------------- */\r\n\r\n#ifndef GL_HP_occlusion_test\r\n#define GL_HP_occlusion_test 1\r\n\r\n#define GL_OCCLUSION_TEST_HP 0x8165\r\n#define GL_OCCLUSION_TEST_RESULT_HP 0x8166\r\n\r\n#define GLEW_HP_occlusion_test GLEW_GET_VAR(__GLEW_HP_occlusion_test)\r\n\r\n#endif /* GL_HP_occlusion_test */\r\n\r\n/* ------------------------- GL_HP_texture_lighting ------------------------ */\r\n\r\n#ifndef GL_HP_texture_lighting\r\n#define GL_HP_texture_lighting 1\r\n\r\n#define GLEW_HP_texture_lighting GLEW_GET_VAR(__GLEW_HP_texture_lighting)\r\n\r\n#endif /* GL_HP_texture_lighting */\r\n\r\n/* --------------------------- GL_IBM_cull_vertex -------------------------- */\r\n\r\n#ifndef GL_IBM_cull_vertex\r\n#define GL_IBM_cull_vertex 1\r\n\r\n#define GL_CULL_VERTEX_IBM 103050\r\n\r\n#define GLEW_IBM_cull_vertex GLEW_GET_VAR(__GLEW_IBM_cull_vertex)\r\n\r\n#endif /* GL_IBM_cull_vertex */\r\n\r\n/* ---------------------- GL_IBM_multimode_draw_arrays --------------------- */\r\n\r\n#ifndef GL_IBM_multimode_draw_arrays\r\n#define GL_IBM_multimode_draw_arrays 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum* mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);\r\ntypedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum* mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride);\r\n\r\n#define glMultiModeDrawArraysIBM GLEW_GET_FUN(__glewMultiModeDrawArraysIBM)\r\n#define glMultiModeDrawElementsIBM GLEW_GET_FUN(__glewMultiModeDrawElementsIBM)\r\n\r\n#define GLEW_IBM_multimode_draw_arrays GLEW_GET_VAR(__GLEW_IBM_multimode_draw_arrays)\r\n\r\n#endif /* GL_IBM_multimode_draw_arrays */\r\n\r\n/* ------------------------- GL_IBM_rasterpos_clip ------------------------- */\r\n\r\n#ifndef GL_IBM_rasterpos_clip\r\n#define GL_IBM_rasterpos_clip 1\r\n\r\n#define GL_RASTER_POSITION_UNCLIPPED_IBM 103010\r\n\r\n#define GLEW_IBM_rasterpos_clip GLEW_GET_VAR(__GLEW_IBM_rasterpos_clip)\r\n\r\n#endif /* GL_IBM_rasterpos_clip */\r\n\r\n/* --------------------------- GL_IBM_static_data -------------------------- */\r\n\r\n#ifndef GL_IBM_static_data\r\n#define GL_IBM_static_data 1\r\n\r\n#define GL_ALL_STATIC_DATA_IBM 103060\r\n#define GL_STATIC_VERTEX_ARRAY_IBM 103061\r\n\r\n#define GLEW_IBM_static_data GLEW_GET_VAR(__GLEW_IBM_static_data)\r\n\r\n#endif /* GL_IBM_static_data */\r\n\r\n/* --------------------- GL_IBM_texture_mirrored_repeat -------------------- */\r\n\r\n#ifndef GL_IBM_texture_mirrored_repeat\r\n#define GL_IBM_texture_mirrored_repeat 1\r\n\r\n#define GL_MIRRORED_REPEAT_IBM 0x8370\r\n\r\n#define GLEW_IBM_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_IBM_texture_mirrored_repeat)\r\n\r\n#endif /* GL_IBM_texture_mirrored_repeat */\r\n\r\n/* ----------------------- GL_IBM_vertex_array_lists ----------------------- */\r\n\r\n#ifndef GL_IBM_vertex_array_lists\r\n#define GL_IBM_vertex_array_lists 1\r\n\r\n#define GL_VERTEX_ARRAY_LIST_IBM 103070\r\n#define GL_NORMAL_ARRAY_LIST_IBM 103071\r\n#define GL_COLOR_ARRAY_LIST_IBM 103072\r\n#define GL_INDEX_ARRAY_LIST_IBM 103073\r\n#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074\r\n#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075\r\n#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076\r\n#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077\r\n#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080\r\n#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081\r\n#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082\r\n#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083\r\n#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084\r\n#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085\r\n#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086\r\n#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride);\r\n\r\n#define glColorPointerListIBM GLEW_GET_FUN(__glewColorPointerListIBM)\r\n#define glEdgeFlagPointerListIBM GLEW_GET_FUN(__glewEdgeFlagPointerListIBM)\r\n#define glFogCoordPointerListIBM GLEW_GET_FUN(__glewFogCoordPointerListIBM)\r\n#define glIndexPointerListIBM GLEW_GET_FUN(__glewIndexPointerListIBM)\r\n#define glNormalPointerListIBM GLEW_GET_FUN(__glewNormalPointerListIBM)\r\n#define glSecondaryColorPointerListIBM GLEW_GET_FUN(__glewSecondaryColorPointerListIBM)\r\n#define glTexCoordPointerListIBM GLEW_GET_FUN(__glewTexCoordPointerListIBM)\r\n#define glVertexPointerListIBM GLEW_GET_FUN(__glewVertexPointerListIBM)\r\n\r\n#define GLEW_IBM_vertex_array_lists GLEW_GET_VAR(__GLEW_IBM_vertex_array_lists)\r\n\r\n#endif /* GL_IBM_vertex_array_lists */\r\n\r\n/* -------------------------- GL_INGR_color_clamp -------------------------- */\r\n\r\n#ifndef GL_INGR_color_clamp\r\n#define GL_INGR_color_clamp 1\r\n\r\n#define GL_RED_MIN_CLAMP_INGR 0x8560\r\n#define GL_GREEN_MIN_CLAMP_INGR 0x8561\r\n#define GL_BLUE_MIN_CLAMP_INGR 0x8562\r\n#define GL_ALPHA_MIN_CLAMP_INGR 0x8563\r\n#define GL_RED_MAX_CLAMP_INGR 0x8564\r\n#define GL_GREEN_MAX_CLAMP_INGR 0x8565\r\n#define GL_BLUE_MAX_CLAMP_INGR 0x8566\r\n#define GL_ALPHA_MAX_CLAMP_INGR 0x8567\r\n\r\n#define GLEW_INGR_color_clamp GLEW_GET_VAR(__GLEW_INGR_color_clamp)\r\n\r\n#endif /* GL_INGR_color_clamp */\r\n\r\n/* ------------------------- GL_INGR_interlace_read ------------------------ */\r\n\r\n#ifndef GL_INGR_interlace_read\r\n#define GL_INGR_interlace_read 1\r\n\r\n#define GL_INTERLACE_READ_INGR 0x8568\r\n\r\n#define GLEW_INGR_interlace_read GLEW_GET_VAR(__GLEW_INGR_interlace_read)\r\n\r\n#endif /* GL_INGR_interlace_read */\r\n\r\n/* ------------------------ GL_INTEL_parallel_arrays ----------------------- */\r\n\r\n#ifndef GL_INTEL_parallel_arrays\r\n#define GL_INTEL_parallel_arrays 1\r\n\r\n#define GL_PARALLEL_ARRAYS_INTEL 0x83F4\r\n#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5\r\n#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6\r\n#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7\r\n#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);\r\n\r\n#define glColorPointervINTEL GLEW_GET_FUN(__glewColorPointervINTEL)\r\n#define glNormalPointervINTEL GLEW_GET_FUN(__glewNormalPointervINTEL)\r\n#define glTexCoordPointervINTEL GLEW_GET_FUN(__glewTexCoordPointervINTEL)\r\n#define glVertexPointervINTEL GLEW_GET_FUN(__glewVertexPointervINTEL)\r\n\r\n#define GLEW_INTEL_parallel_arrays GLEW_GET_VAR(__GLEW_INTEL_parallel_arrays)\r\n\r\n#endif /* GL_INTEL_parallel_arrays */\r\n\r\n/* ------------------------ GL_INTEL_texture_scissor ----------------------- */\r\n\r\n#ifndef GL_INTEL_texture_scissor\r\n#define GL_INTEL_texture_scissor 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh);\r\n\r\n#define glTexScissorFuncINTEL GLEW_GET_FUN(__glewTexScissorFuncINTEL)\r\n#define glTexScissorINTEL GLEW_GET_FUN(__glewTexScissorINTEL)\r\n\r\n#define GLEW_INTEL_texture_scissor GLEW_GET_VAR(__GLEW_INTEL_texture_scissor)\r\n\r\n#endif /* GL_INTEL_texture_scissor */\r\n\r\n/* ------------------------------ GL_KHR_debug ----------------------------- */\r\n\r\n#ifndef GL_KHR_debug\r\n#define GL_KHR_debug 1\r\n\r\n#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002\r\n#define GL_STACK_OVERFLOW 0x0503\r\n#define GL_STACK_UNDERFLOW 0x0504\r\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242\r\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243\r\n#define GL_DEBUG_CALLBACK_FUNCTION 0x8244\r\n#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245\r\n#define GL_DEBUG_SOURCE_API 0x8246\r\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247\r\n#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248\r\n#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249\r\n#define GL_DEBUG_SOURCE_APPLICATION 0x824A\r\n#define GL_DEBUG_SOURCE_OTHER 0x824B\r\n#define GL_DEBUG_TYPE_ERROR 0x824C\r\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D\r\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E\r\n#define GL_DEBUG_TYPE_PORTABILITY 0x824F\r\n#define GL_DEBUG_TYPE_PERFORMANCE 0x8250\r\n#define GL_DEBUG_TYPE_OTHER 0x8251\r\n#define GL_DEBUG_TYPE_MARKER 0x8268\r\n#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269\r\n#define GL_DEBUG_TYPE_POP_GROUP 0x826A\r\n#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B\r\n#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C\r\n#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D\r\n#define GL_BUFFER 0x82E0\r\n#define GL_SHADER 0x82E1\r\n#define GL_PROGRAM 0x82E2\r\n#define GL_QUERY 0x82E3\r\n#define GL_PROGRAM_PIPELINE 0x82E4\r\n#define GL_SAMPLER 0x82E6\r\n#define GL_DISPLAY_LIST 0x82E7\r\n#define GL_MAX_LABEL_LENGTH 0x82E8\r\n#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143\r\n#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144\r\n#define GL_DEBUG_LOGGED_MESSAGES 0x9145\r\n#define GL_DEBUG_SEVERITY_HIGH 0x9146\r\n#define GL_DEBUG_SEVERITY_MEDIUM 0x9147\r\n#define GL_DEBUG_SEVERITY_LOW 0x9148\r\n#define GL_DEBUG_OUTPUT 0x92E0\r\n\r\ntypedef void (APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, void* userParam);\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);\r\ntypedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar *label);\r\ntypedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABELPROC) (void* ptr, GLsizei bufSize, GLsizei* length, GLchar *label);\r\ntypedef void (GLAPIENTRY * PFNGLGETPOINTERVPROC) (GLenum pname, void** params);\r\ntypedef void (GLAPIENTRY * PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label);\r\ntypedef void (GLAPIENTRY * PFNGLOBJECTPTRLABELPROC) (void* ptr, GLsizei length, const GLchar* label);\r\ntypedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar * message);\r\n\r\n#define glDebugMessageCallback GLEW_GET_FUN(__glewDebugMessageCallback)\r\n#define glDebugMessageControl GLEW_GET_FUN(__glewDebugMessageControl)\r\n#define glDebugMessageInsert GLEW_GET_FUN(__glewDebugMessageInsert)\r\n#define glGetDebugMessageLog GLEW_GET_FUN(__glewGetDebugMessageLog)\r\n#define glGetObjectLabel GLEW_GET_FUN(__glewGetObjectLabel)\r\n#define glGetObjectPtrLabel GLEW_GET_FUN(__glewGetObjectPtrLabel)\r\n#define glGetPointerv GLEW_GET_FUN(__glewGetPointerv)\r\n#define glObjectLabel GLEW_GET_FUN(__glewObjectLabel)\r\n#define glObjectPtrLabel GLEW_GET_FUN(__glewObjectPtrLabel)\r\n#define glPushDebugGroup GLEW_GET_FUN(__glewPushDebugGroup)\r\n\r\n#define GLEW_KHR_debug GLEW_GET_VAR(__GLEW_KHR_debug)\r\n\r\n#endif /* GL_KHR_debug */\r\n\r\n/* ------------------ GL_KHR_texture_compression_astc_ldr ------------------ */\r\n\r\n#ifndef GL_KHR_texture_compression_astc_ldr\r\n#define GL_KHR_texture_compression_astc_ldr 1\r\n\r\n#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0\r\n#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1\r\n#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2\r\n#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3\r\n#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4\r\n#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5\r\n#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6\r\n#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7\r\n#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8\r\n#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9\r\n#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA\r\n#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB\r\n#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC\r\n#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD\r\n\r\n#define GLEW_KHR_texture_compression_astc_ldr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_ldr)\r\n\r\n#endif /* GL_KHR_texture_compression_astc_ldr */\r\n\r\n/* -------------------------- GL_KTX_buffer_region ------------------------- */\r\n\r\n#ifndef GL_KTX_buffer_region\r\n#define GL_KTX_buffer_region 1\r\n\r\n#define GL_KTX_FRONT_REGION 0x0\r\n#define GL_KTX_BACK_REGION 0x1\r\n#define GL_KTX_Z_REGION 0x2\r\n#define GL_KTX_STENCIL_REGION 0x3\r\n\r\ntypedef GLuint (GLAPIENTRY * PFNGLBUFFERREGIONENABLEDPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERREGIONPROC) (GLenum region);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height, GLint xDest, GLint yDest);\r\ntypedef GLuint (GLAPIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum region);\r\ntypedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\r\n#define glBufferRegionEnabled GLEW_GET_FUN(__glewBufferRegionEnabled)\r\n#define glDeleteBufferRegion GLEW_GET_FUN(__glewDeleteBufferRegion)\r\n#define glDrawBufferRegion GLEW_GET_FUN(__glewDrawBufferRegion)\r\n#define glNewBufferRegion GLEW_GET_FUN(__glewNewBufferRegion)\r\n#define glReadBufferRegion GLEW_GET_FUN(__glewReadBufferRegion)\r\n\r\n#define GLEW_KTX_buffer_region GLEW_GET_VAR(__GLEW_KTX_buffer_region)\r\n\r\n#endif /* GL_KTX_buffer_region */\r\n\r\n/* ------------------------- GL_MESAX_texture_stack ------------------------ */\r\n\r\n#ifndef GL_MESAX_texture_stack\r\n#define GL_MESAX_texture_stack 1\r\n\r\n#define GL_TEXTURE_1D_STACK_MESAX 0x8759\r\n#define GL_TEXTURE_2D_STACK_MESAX 0x875A\r\n#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B\r\n#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C\r\n#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D\r\n#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E\r\n\r\n#define GLEW_MESAX_texture_stack GLEW_GET_VAR(__GLEW_MESAX_texture_stack)\r\n\r\n#endif /* GL_MESAX_texture_stack */\r\n\r\n/* -------------------------- GL_MESA_pack_invert -------------------------- */\r\n\r\n#ifndef GL_MESA_pack_invert\r\n#define GL_MESA_pack_invert 1\r\n\r\n#define GL_PACK_INVERT_MESA 0x8758\r\n\r\n#define GLEW_MESA_pack_invert GLEW_GET_VAR(__GLEW_MESA_pack_invert)\r\n\r\n#endif /* GL_MESA_pack_invert */\r\n\r\n/* ------------------------- GL_MESA_resize_buffers ------------------------ */\r\n\r\n#ifndef GL_MESA_resize_buffers\r\n#define GL_MESA_resize_buffers 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void);\r\n\r\n#define glResizeBuffersMESA GLEW_GET_FUN(__glewResizeBuffersMESA)\r\n\r\n#define GLEW_MESA_resize_buffers GLEW_GET_VAR(__GLEW_MESA_resize_buffers)\r\n\r\n#endif /* GL_MESA_resize_buffers */\r\n\r\n/* --------------------------- GL_MESA_window_pos -------------------------- */\r\n\r\n#ifndef GL_MESA_window_pos\r\n#define GL_MESA_window_pos 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint* p);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p);\r\n\r\n#define glWindowPos2dMESA GLEW_GET_FUN(__glewWindowPos2dMESA)\r\n#define glWindowPos2dvMESA GLEW_GET_FUN(__glewWindowPos2dvMESA)\r\n#define glWindowPos2fMESA GLEW_GET_FUN(__glewWindowPos2fMESA)\r\n#define glWindowPos2fvMESA GLEW_GET_FUN(__glewWindowPos2fvMESA)\r\n#define glWindowPos2iMESA GLEW_GET_FUN(__glewWindowPos2iMESA)\r\n#define glWindowPos2ivMESA GLEW_GET_FUN(__glewWindowPos2ivMESA)\r\n#define glWindowPos2sMESA GLEW_GET_FUN(__glewWindowPos2sMESA)\r\n#define glWindowPos2svMESA GLEW_GET_FUN(__glewWindowPos2svMESA)\r\n#define glWindowPos3dMESA GLEW_GET_FUN(__glewWindowPos3dMESA)\r\n#define glWindowPos3dvMESA GLEW_GET_FUN(__glewWindowPos3dvMESA)\r\n#define glWindowPos3fMESA GLEW_GET_FUN(__glewWindowPos3fMESA)\r\n#define glWindowPos3fvMESA GLEW_GET_FUN(__glewWindowPos3fvMESA)\r\n#define glWindowPos3iMESA GLEW_GET_FUN(__glewWindowPos3iMESA)\r\n#define glWindowPos3ivMESA GLEW_GET_FUN(__glewWindowPos3ivMESA)\r\n#define glWindowPos3sMESA GLEW_GET_FUN(__glewWindowPos3sMESA)\r\n#define glWindowPos3svMESA GLEW_GET_FUN(__glewWindowPos3svMESA)\r\n#define glWindowPos4dMESA GLEW_GET_FUN(__glewWindowPos4dMESA)\r\n#define glWindowPos4dvMESA GLEW_GET_FUN(__glewWindowPos4dvMESA)\r\n#define glWindowPos4fMESA GLEW_GET_FUN(__glewWindowPos4fMESA)\r\n#define glWindowPos4fvMESA GLEW_GET_FUN(__glewWindowPos4fvMESA)\r\n#define glWindowPos4iMESA GLEW_GET_FUN(__glewWindowPos4iMESA)\r\n#define glWindowPos4ivMESA GLEW_GET_FUN(__glewWindowPos4ivMESA)\r\n#define glWindowPos4sMESA GLEW_GET_FUN(__glewWindowPos4sMESA)\r\n#define glWindowPos4svMESA GLEW_GET_FUN(__glewWindowPos4svMESA)\r\n\r\n#define GLEW_MESA_window_pos GLEW_GET_VAR(__GLEW_MESA_window_pos)\r\n\r\n#endif /* GL_MESA_window_pos */\r\n\r\n/* ------------------------- GL_MESA_ycbcr_texture ------------------------- */\r\n\r\n#ifndef GL_MESA_ycbcr_texture\r\n#define GL_MESA_ycbcr_texture 1\r\n\r\n#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA\r\n#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB\r\n#define GL_YCBCR_MESA 0x8757\r\n\r\n#define GLEW_MESA_ycbcr_texture GLEW_GET_VAR(__GLEW_MESA_ycbcr_texture)\r\n\r\n#endif /* GL_MESA_ycbcr_texture */\r\n\r\n/* ------------------------- GL_NVX_gpu_memory_info ------------------------ */\r\n\r\n#ifndef GL_NVX_gpu_memory_info\r\n#define GL_NVX_gpu_memory_info 1\r\n\r\n#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047\r\n#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048\r\n#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049\r\n#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A\r\n#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B\r\n\r\n#define GLEW_NVX_gpu_memory_info GLEW_GET_VAR(__GLEW_NVX_gpu_memory_info)\r\n\r\n#endif /* GL_NVX_gpu_memory_info */\r\n\r\n/* ------------------------- GL_NV_bindless_texture ------------------------ */\r\n\r\n#ifndef GL_NV_bindless_texture\r\n#define GL_NV_bindless_texture 1\r\n\r\ntypedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\r\ntypedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);\r\ntypedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);\r\ntypedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);\r\ntypedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);\r\ntypedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);\r\ntypedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64* value);\r\n\r\n#define glGetImageHandleNV GLEW_GET_FUN(__glewGetImageHandleNV)\r\n#define glGetTextureHandleNV GLEW_GET_FUN(__glewGetTextureHandleNV)\r\n#define glGetTextureSamplerHandleNV GLEW_GET_FUN(__glewGetTextureSamplerHandleNV)\r\n#define glIsImageHandleResidentNV GLEW_GET_FUN(__glewIsImageHandleResidentNV)\r\n#define glIsTextureHandleResidentNV GLEW_GET_FUN(__glewIsTextureHandleResidentNV)\r\n#define glMakeImageHandleNonResidentNV GLEW_GET_FUN(__glewMakeImageHandleNonResidentNV)\r\n#define glMakeImageHandleResidentNV GLEW_GET_FUN(__glewMakeImageHandleResidentNV)\r\n#define glMakeTextureHandleNonResidentNV GLEW_GET_FUN(__glewMakeTextureHandleNonResidentNV)\r\n#define glMakeTextureHandleResidentNV GLEW_GET_FUN(__glewMakeTextureHandleResidentNV)\r\n#define glProgramUniformHandleui64NV GLEW_GET_FUN(__glewProgramUniformHandleui64NV)\r\n#define glProgramUniformHandleui64vNV GLEW_GET_FUN(__glewProgramUniformHandleui64vNV)\r\n#define glUniformHandleui64NV GLEW_GET_FUN(__glewUniformHandleui64NV)\r\n#define glUniformHandleui64vNV GLEW_GET_FUN(__glewUniformHandleui64vNV)\r\n\r\n#define GLEW_NV_bindless_texture GLEW_GET_VAR(__GLEW_NV_bindless_texture)\r\n\r\n#endif /* GL_NV_bindless_texture */\r\n\r\n/* --------------------------- GL_NV_blend_square -------------------------- */\r\n\r\n#ifndef GL_NV_blend_square\r\n#define GL_NV_blend_square 1\r\n\r\n#define GLEW_NV_blend_square GLEW_GET_VAR(__GLEW_NV_blend_square)\r\n\r\n#endif /* GL_NV_blend_square */\r\n\r\n/* ------------------------ GL_NV_conditional_render ----------------------- */\r\n\r\n#ifndef GL_NV_conditional_render\r\n#define GL_NV_conditional_render 1\r\n\r\n#define GL_QUERY_WAIT_NV 0x8E13\r\n#define GL_QUERY_NO_WAIT_NV 0x8E14\r\n#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15\r\n#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVPROC) (void);\r\n\r\n#define glBeginConditionalRenderNV GLEW_GET_FUN(__glewBeginConditionalRenderNV)\r\n#define glEndConditionalRenderNV GLEW_GET_FUN(__glewEndConditionalRenderNV)\r\n\r\n#define GLEW_NV_conditional_render GLEW_GET_VAR(__GLEW_NV_conditional_render)\r\n\r\n#endif /* GL_NV_conditional_render */\r\n\r\n/* ----------------------- GL_NV_copy_depth_to_color ----------------------- */\r\n\r\n#ifndef GL_NV_copy_depth_to_color\r\n#define GL_NV_copy_depth_to_color 1\r\n\r\n#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E\r\n#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F\r\n\r\n#define GLEW_NV_copy_depth_to_color GLEW_GET_VAR(__GLEW_NV_copy_depth_to_color)\r\n\r\n#endif /* GL_NV_copy_depth_to_color */\r\n\r\n/* ---------------------------- GL_NV_copy_image --------------------------- */\r\n\r\n#ifndef GL_NV_copy_image\r\n#define GL_NV_copy_image 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\r\n\r\n#define glCopyImageSubDataNV GLEW_GET_FUN(__glewCopyImageSubDataNV)\r\n\r\n#define GLEW_NV_copy_image GLEW_GET_VAR(__GLEW_NV_copy_image)\r\n\r\n#endif /* GL_NV_copy_image */\r\n\r\n/* ------------------------ GL_NV_depth_buffer_float ----------------------- */\r\n\r\n#ifndef GL_NV_depth_buffer_float\r\n#define GL_NV_depth_buffer_float 1\r\n\r\n#define GL_DEPTH_COMPONENT32F_NV 0x8DAB\r\n#define GL_DEPTH32F_STENCIL8_NV 0x8DAC\r\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD\r\n#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);\r\n\r\n#define glClearDepthdNV GLEW_GET_FUN(__glewClearDepthdNV)\r\n#define glDepthBoundsdNV GLEW_GET_FUN(__glewDepthBoundsdNV)\r\n#define glDepthRangedNV GLEW_GET_FUN(__glewDepthRangedNV)\r\n\r\n#define GLEW_NV_depth_buffer_float GLEW_GET_VAR(__GLEW_NV_depth_buffer_float)\r\n\r\n#endif /* GL_NV_depth_buffer_float */\r\n\r\n/* --------------------------- GL_NV_depth_clamp --------------------------- */\r\n\r\n#ifndef GL_NV_depth_clamp\r\n#define GL_NV_depth_clamp 1\r\n\r\n#define GL_DEPTH_CLAMP_NV 0x864F\r\n\r\n#define GLEW_NV_depth_clamp GLEW_GET_VAR(__GLEW_NV_depth_clamp)\r\n\r\n#endif /* GL_NV_depth_clamp */\r\n\r\n/* ---------------------- GL_NV_depth_range_unclamped ---------------------- */\r\n\r\n#ifndef GL_NV_depth_range_unclamped\r\n#define GL_NV_depth_range_unclamped 1\r\n\r\n#define GL_SAMPLE_COUNT_BITS_NV 0x8864\r\n#define GL_CURRENT_SAMPLE_COUNT_QUERY_NV 0x8865\r\n#define GL_QUERY_RESULT_NV 0x8866\r\n#define GL_QUERY_RESULT_AVAILABLE_NV 0x8867\r\n#define GL_SAMPLE_COUNT_NV 0x8914\r\n\r\n#define GLEW_NV_depth_range_unclamped GLEW_GET_VAR(__GLEW_NV_depth_range_unclamped)\r\n\r\n#endif /* GL_NV_depth_range_unclamped */\r\n\r\n/* ---------------------------- GL_NV_evaluators --------------------------- */\r\n\r\n#ifndef GL_NV_evaluators\r\n#define GL_NV_evaluators 1\r\n\r\n#define GL_EVAL_2D_NV 0x86C0\r\n#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1\r\n#define GL_MAP_TESSELLATION_NV 0x86C2\r\n#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3\r\n#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4\r\n#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5\r\n#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6\r\n#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7\r\n#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8\r\n#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9\r\n#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA\r\n#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB\r\n#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC\r\n#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD\r\n#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE\r\n#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF\r\n#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0\r\n#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1\r\n#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2\r\n#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3\r\n#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4\r\n#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5\r\n#define GL_MAX_MAP_TESSELLATION_NV 0x86D6\r\n#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7\r\n\r\ntypedef void (GLAPIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void* points);\r\ntypedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void* points);\r\ntypedef void (GLAPIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint* params);\r\n\r\n#define glEvalMapsNV GLEW_GET_FUN(__glewEvalMapsNV)\r\n#define glGetMapAttribParameterfvNV GLEW_GET_FUN(__glewGetMapAttribParameterfvNV)\r\n#define glGetMapAttribParameterivNV GLEW_GET_FUN(__glewGetMapAttribParameterivNV)\r\n#define glGetMapControlPointsNV GLEW_GET_FUN(__glewGetMapControlPointsNV)\r\n#define glGetMapParameterfvNV GLEW_GET_FUN(__glewGetMapParameterfvNV)\r\n#define glGetMapParameterivNV GLEW_GET_FUN(__glewGetMapParameterivNV)\r\n#define glMapControlPointsNV GLEW_GET_FUN(__glewMapControlPointsNV)\r\n#define glMapParameterfvNV GLEW_GET_FUN(__glewMapParameterfvNV)\r\n#define glMapParameterivNV GLEW_GET_FUN(__glewMapParameterivNV)\r\n\r\n#define GLEW_NV_evaluators GLEW_GET_VAR(__GLEW_NV_evaluators)\r\n\r\n#endif /* GL_NV_evaluators */\r\n\r\n/* ----------------------- GL_NV_explicit_multisample ---------------------- */\r\n\r\n#ifndef GL_NV_explicit_multisample\r\n#define GL_NV_explicit_multisample 1\r\n\r\n#define GL_SAMPLE_POSITION_NV 0x8E50\r\n#define GL_SAMPLE_MASK_NV 0x8E51\r\n#define GL_SAMPLE_MASK_VALUE_NV 0x8E52\r\n#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53\r\n#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54\r\n#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55\r\n#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56\r\n#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57\r\n#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58\r\n#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat* val);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);\r\ntypedef void (GLAPIENTRY * PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);\r\n\r\n#define glGetMultisamplefvNV GLEW_GET_FUN(__glewGetMultisamplefvNV)\r\n#define glSampleMaskIndexedNV GLEW_GET_FUN(__glewSampleMaskIndexedNV)\r\n#define glTexRenderbufferNV GLEW_GET_FUN(__glewTexRenderbufferNV)\r\n\r\n#define GLEW_NV_explicit_multisample GLEW_GET_VAR(__GLEW_NV_explicit_multisample)\r\n\r\n#endif /* GL_NV_explicit_multisample */\r\n\r\n/* ------------------------------ GL_NV_fence ------------------------------ */\r\n\r\n#ifndef GL_NV_fence\r\n#define GL_NV_fence 1\r\n\r\n#define GL_ALL_COMPLETED_NV 0x84F2\r\n#define GL_FENCE_STATUS_NV 0x84F3\r\n#define GL_FENCE_CONDITION_NV 0x84F4\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint* fences);\r\ntypedef void (GLAPIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence);\r\ntypedef void (GLAPIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint* fences);\r\ntypedef void (GLAPIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISFENCENVPROC) (GLuint fence);\r\ntypedef void (GLAPIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence);\r\n\r\n#define glDeleteFencesNV GLEW_GET_FUN(__glewDeleteFencesNV)\r\n#define glFinishFenceNV GLEW_GET_FUN(__glewFinishFenceNV)\r\n#define glGenFencesNV GLEW_GET_FUN(__glewGenFencesNV)\r\n#define glGetFenceivNV GLEW_GET_FUN(__glewGetFenceivNV)\r\n#define glIsFenceNV GLEW_GET_FUN(__glewIsFenceNV)\r\n#define glSetFenceNV GLEW_GET_FUN(__glewSetFenceNV)\r\n#define glTestFenceNV GLEW_GET_FUN(__glewTestFenceNV)\r\n\r\n#define GLEW_NV_fence GLEW_GET_VAR(__GLEW_NV_fence)\r\n\r\n#endif /* GL_NV_fence */\r\n\r\n/* --------------------------- GL_NV_float_buffer -------------------------- */\r\n\r\n#ifndef GL_NV_float_buffer\r\n#define GL_NV_float_buffer 1\r\n\r\n#define GL_FLOAT_R_NV 0x8880\r\n#define GL_FLOAT_RG_NV 0x8881\r\n#define GL_FLOAT_RGB_NV 0x8882\r\n#define GL_FLOAT_RGBA_NV 0x8883\r\n#define GL_FLOAT_R16_NV 0x8884\r\n#define GL_FLOAT_R32_NV 0x8885\r\n#define GL_FLOAT_RG16_NV 0x8886\r\n#define GL_FLOAT_RG32_NV 0x8887\r\n#define GL_FLOAT_RGB16_NV 0x8888\r\n#define GL_FLOAT_RGB32_NV 0x8889\r\n#define GL_FLOAT_RGBA16_NV 0x888A\r\n#define GL_FLOAT_RGBA32_NV 0x888B\r\n#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C\r\n#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D\r\n#define GL_FLOAT_RGBA_MODE_NV 0x888E\r\n\r\n#define GLEW_NV_float_buffer GLEW_GET_VAR(__GLEW_NV_float_buffer)\r\n\r\n#endif /* GL_NV_float_buffer */\r\n\r\n/* --------------------------- GL_NV_fog_distance -------------------------- */\r\n\r\n#ifndef GL_NV_fog_distance\r\n#define GL_NV_fog_distance 1\r\n\r\n#define GL_FOG_DISTANCE_MODE_NV 0x855A\r\n#define GL_EYE_RADIAL_NV 0x855B\r\n#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C\r\n\r\n#define GLEW_NV_fog_distance GLEW_GET_VAR(__GLEW_NV_fog_distance)\r\n\r\n#endif /* GL_NV_fog_distance */\r\n\r\n/* ------------------------- GL_NV_fragment_program ------------------------ */\r\n\r\n#ifndef GL_NV_fragment_program\r\n#define GL_NV_fragment_program 1\r\n\r\n#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868\r\n#define GL_FRAGMENT_PROGRAM_NV 0x8870\r\n#define GL_MAX_TEXTURE_COORDS_NV 0x8871\r\n#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872\r\n#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873\r\n#define GL_PROGRAM_ERROR_STRING_NV 0x8874\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble *params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLdouble v[]);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLfloat v[]);\r\n\r\n#define glGetProgramNamedParameterdvNV GLEW_GET_FUN(__glewGetProgramNamedParameterdvNV)\r\n#define glGetProgramNamedParameterfvNV GLEW_GET_FUN(__glewGetProgramNamedParameterfvNV)\r\n#define glProgramNamedParameter4dNV GLEW_GET_FUN(__glewProgramNamedParameter4dNV)\r\n#define glProgramNamedParameter4dvNV GLEW_GET_FUN(__glewProgramNamedParameter4dvNV)\r\n#define glProgramNamedParameter4fNV GLEW_GET_FUN(__glewProgramNamedParameter4fNV)\r\n#define glProgramNamedParameter4fvNV GLEW_GET_FUN(__glewProgramNamedParameter4fvNV)\r\n\r\n#define GLEW_NV_fragment_program GLEW_GET_VAR(__GLEW_NV_fragment_program)\r\n\r\n#endif /* GL_NV_fragment_program */\r\n\r\n/* ------------------------ GL_NV_fragment_program2 ------------------------ */\r\n\r\n#ifndef GL_NV_fragment_program2\r\n#define GL_NV_fragment_program2 1\r\n\r\n#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4\r\n#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5\r\n#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6\r\n#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7\r\n#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8\r\n\r\n#define GLEW_NV_fragment_program2 GLEW_GET_VAR(__GLEW_NV_fragment_program2)\r\n\r\n#endif /* GL_NV_fragment_program2 */\r\n\r\n/* ------------------------ GL_NV_fragment_program4 ------------------------ */\r\n\r\n#ifndef GL_NV_fragment_program4\r\n#define GL_NV_fragment_program4 1\r\n\r\n#define GLEW_NV_fragment_program4 GLEW_GET_VAR(__GLEW_NV_fragment_program4)\r\n\r\n#endif /* GL_NV_fragment_program4 */\r\n\r\n/* --------------------- GL_NV_fragment_program_option --------------------- */\r\n\r\n#ifndef GL_NV_fragment_program_option\r\n#define GL_NV_fragment_program_option 1\r\n\r\n#define GLEW_NV_fragment_program_option GLEW_GET_VAR(__GLEW_NV_fragment_program_option)\r\n\r\n#endif /* GL_NV_fragment_program_option */\r\n\r\n/* ----------------- GL_NV_framebuffer_multisample_coverage ---------------- */\r\n\r\n#ifndef GL_NV_framebuffer_multisample_coverage\r\n#define GL_NV_framebuffer_multisample_coverage 1\r\n\r\n#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB\r\n#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10\r\n#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11\r\n#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12\r\n\r\ntypedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\r\n\r\n#define glRenderbufferStorageMultisampleCoverageNV GLEW_GET_FUN(__glewRenderbufferStorageMultisampleCoverageNV)\r\n\r\n#define GLEW_NV_framebuffer_multisample_coverage GLEW_GET_VAR(__GLEW_NV_framebuffer_multisample_coverage)\r\n\r\n#endif /* GL_NV_framebuffer_multisample_coverage */\r\n\r\n/* ------------------------ GL_NV_geometry_program4 ------------------------ */\r\n\r\n#ifndef GL_NV_geometry_program4\r\n#define GL_NV_geometry_program4 1\r\n\r\n#define GL_GEOMETRY_PROGRAM_NV 0x8C26\r\n#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27\r\n#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);\r\n\r\n#define glProgramVertexLimitNV GLEW_GET_FUN(__glewProgramVertexLimitNV)\r\n\r\n#define GLEW_NV_geometry_program4 GLEW_GET_VAR(__GLEW_NV_geometry_program4)\r\n\r\n#endif /* GL_NV_geometry_program4 */\r\n\r\n/* ------------------------- GL_NV_geometry_shader4 ------------------------ */\r\n\r\n#ifndef GL_NV_geometry_shader4\r\n#define GL_NV_geometry_shader4 1\r\n\r\n#define GLEW_NV_geometry_shader4 GLEW_GET_VAR(__GLEW_NV_geometry_shader4)\r\n\r\n#endif /* GL_NV_geometry_shader4 */\r\n\r\n/* --------------------------- GL_NV_gpu_program4 -------------------------- */\r\n\r\n#ifndef GL_NV_gpu_program4\r\n#define GL_NV_gpu_program4 1\r\n\r\n#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904\r\n#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905\r\n#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906\r\n#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907\r\n#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908\r\n#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909\r\n#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5\r\n#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\n\r\n#define glProgramEnvParameterI4iNV GLEW_GET_FUN(__glewProgramEnvParameterI4iNV)\r\n#define glProgramEnvParameterI4ivNV GLEW_GET_FUN(__glewProgramEnvParameterI4ivNV)\r\n#define glProgramEnvParameterI4uiNV GLEW_GET_FUN(__glewProgramEnvParameterI4uiNV)\r\n#define glProgramEnvParameterI4uivNV GLEW_GET_FUN(__glewProgramEnvParameterI4uivNV)\r\n#define glProgramEnvParametersI4ivNV GLEW_GET_FUN(__glewProgramEnvParametersI4ivNV)\r\n#define glProgramEnvParametersI4uivNV GLEW_GET_FUN(__glewProgramEnvParametersI4uivNV)\r\n#define glProgramLocalParameterI4iNV GLEW_GET_FUN(__glewProgramLocalParameterI4iNV)\r\n#define glProgramLocalParameterI4ivNV GLEW_GET_FUN(__glewProgramLocalParameterI4ivNV)\r\n#define glProgramLocalParameterI4uiNV GLEW_GET_FUN(__glewProgramLocalParameterI4uiNV)\r\n#define glProgramLocalParameterI4uivNV GLEW_GET_FUN(__glewProgramLocalParameterI4uivNV)\r\n#define glProgramLocalParametersI4ivNV GLEW_GET_FUN(__glewProgramLocalParametersI4ivNV)\r\n#define glProgramLocalParametersI4uivNV GLEW_GET_FUN(__glewProgramLocalParametersI4uivNV)\r\n\r\n#define GLEW_NV_gpu_program4 GLEW_GET_VAR(__GLEW_NV_gpu_program4)\r\n\r\n#endif /* GL_NV_gpu_program4 */\r\n\r\n/* --------------------------- GL_NV_gpu_program5 -------------------------- */\r\n\r\n#ifndef GL_NV_gpu_program5\r\n#define GL_NV_gpu_program5 1\r\n\r\n#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A\r\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B\r\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C\r\n#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D\r\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F\r\n\r\n#define GLEW_NV_gpu_program5 GLEW_GET_VAR(__GLEW_NV_gpu_program5)\r\n\r\n#endif /* GL_NV_gpu_program5 */\r\n\r\n/* ------------------------- GL_NV_gpu_program_fp64 ------------------------ */\r\n\r\n#ifndef GL_NV_gpu_program_fp64\r\n#define GL_NV_gpu_program_fp64 1\r\n\r\n#define GLEW_NV_gpu_program_fp64 GLEW_GET_VAR(__GLEW_NV_gpu_program_fp64)\r\n\r\n#endif /* GL_NV_gpu_program_fp64 */\r\n\r\n/* --------------------------- GL_NV_gpu_shader5 --------------------------- */\r\n\r\n#ifndef GL_NV_gpu_shader5\r\n#define GL_NV_gpu_shader5 1\r\n\r\n#define GL_INT64_NV 0x140E\r\n#define GL_UNSIGNED_INT64_NV 0x140F\r\n#define GL_INT8_NV 0x8FE0\r\n#define GL_INT8_VEC2_NV 0x8FE1\r\n#define GL_INT8_VEC3_NV 0x8FE2\r\n#define GL_INT8_VEC4_NV 0x8FE3\r\n#define GL_INT16_NV 0x8FE4\r\n#define GL_INT16_VEC2_NV 0x8FE5\r\n#define GL_INT16_VEC3_NV 0x8FE6\r\n#define GL_INT16_VEC4_NV 0x8FE7\r\n#define GL_INT64_VEC2_NV 0x8FE9\r\n#define GL_INT64_VEC3_NV 0x8FEA\r\n#define GL_INT64_VEC4_NV 0x8FEB\r\n#define GL_UNSIGNED_INT8_NV 0x8FEC\r\n#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED\r\n#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE\r\n#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF\r\n#define GL_UNSIGNED_INT16_NV 0x8FF0\r\n#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1\r\n#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2\r\n#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3\r\n#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5\r\n#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6\r\n#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7\r\n#define GL_FLOAT16_NV 0x8FF8\r\n#define GL_FLOAT16_VEC2_NV 0x8FF9\r\n#define GL_FLOAT16_VEC3_NV 0x8FFA\r\n#define GL_FLOAT16_VEC4_NV 0x8FFB\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\r\n\r\n#define glGetUniformi64vNV GLEW_GET_FUN(__glewGetUniformi64vNV)\r\n#define glGetUniformui64vNV GLEW_GET_FUN(__glewGetUniformui64vNV)\r\n#define glProgramUniform1i64NV GLEW_GET_FUN(__glewProgramUniform1i64NV)\r\n#define glProgramUniform1i64vNV GLEW_GET_FUN(__glewProgramUniform1i64vNV)\r\n#define glProgramUniform1ui64NV GLEW_GET_FUN(__glewProgramUniform1ui64NV)\r\n#define glProgramUniform1ui64vNV GLEW_GET_FUN(__glewProgramUniform1ui64vNV)\r\n#define glProgramUniform2i64NV GLEW_GET_FUN(__glewProgramUniform2i64NV)\r\n#define glProgramUniform2i64vNV GLEW_GET_FUN(__glewProgramUniform2i64vNV)\r\n#define glProgramUniform2ui64NV GLEW_GET_FUN(__glewProgramUniform2ui64NV)\r\n#define glProgramUniform2ui64vNV GLEW_GET_FUN(__glewProgramUniform2ui64vNV)\r\n#define glProgramUniform3i64NV GLEW_GET_FUN(__glewProgramUniform3i64NV)\r\n#define glProgramUniform3i64vNV GLEW_GET_FUN(__glewProgramUniform3i64vNV)\r\n#define glProgramUniform3ui64NV GLEW_GET_FUN(__glewProgramUniform3ui64NV)\r\n#define glProgramUniform3ui64vNV GLEW_GET_FUN(__glewProgramUniform3ui64vNV)\r\n#define glProgramUniform4i64NV GLEW_GET_FUN(__glewProgramUniform4i64NV)\r\n#define glProgramUniform4i64vNV GLEW_GET_FUN(__glewProgramUniform4i64vNV)\r\n#define glProgramUniform4ui64NV GLEW_GET_FUN(__glewProgramUniform4ui64NV)\r\n#define glProgramUniform4ui64vNV GLEW_GET_FUN(__glewProgramUniform4ui64vNV)\r\n#define glUniform1i64NV GLEW_GET_FUN(__glewUniform1i64NV)\r\n#define glUniform1i64vNV GLEW_GET_FUN(__glewUniform1i64vNV)\r\n#define glUniform1ui64NV GLEW_GET_FUN(__glewUniform1ui64NV)\r\n#define glUniform1ui64vNV GLEW_GET_FUN(__glewUniform1ui64vNV)\r\n#define glUniform2i64NV GLEW_GET_FUN(__glewUniform2i64NV)\r\n#define glUniform2i64vNV GLEW_GET_FUN(__glewUniform2i64vNV)\r\n#define glUniform2ui64NV GLEW_GET_FUN(__glewUniform2ui64NV)\r\n#define glUniform2ui64vNV GLEW_GET_FUN(__glewUniform2ui64vNV)\r\n#define glUniform3i64NV GLEW_GET_FUN(__glewUniform3i64NV)\r\n#define glUniform3i64vNV GLEW_GET_FUN(__glewUniform3i64vNV)\r\n#define glUniform3ui64NV GLEW_GET_FUN(__glewUniform3ui64NV)\r\n#define glUniform3ui64vNV GLEW_GET_FUN(__glewUniform3ui64vNV)\r\n#define glUniform4i64NV GLEW_GET_FUN(__glewUniform4i64NV)\r\n#define glUniform4i64vNV GLEW_GET_FUN(__glewUniform4i64vNV)\r\n#define glUniform4ui64NV GLEW_GET_FUN(__glewUniform4ui64NV)\r\n#define glUniform4ui64vNV GLEW_GET_FUN(__glewUniform4ui64vNV)\r\n\r\n#define GLEW_NV_gpu_shader5 GLEW_GET_VAR(__GLEW_NV_gpu_shader5)\r\n\r\n#endif /* GL_NV_gpu_shader5 */\r\n\r\n/* ---------------------------- GL_NV_half_float --------------------------- */\r\n\r\n#ifndef GL_NV_half_float\r\n#define GL_NV_half_float 1\r\n\r\n#define GL_HALF_FLOAT_NV 0x140B\r\n\r\ntypedef unsigned short GLhalf;\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR3HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4HNVPROC) (GLhalf red, GLhalf green, GLhalf blue, GLhalf alpha);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDHNVPROC) (GLhalf fog);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDHVNVPROC) (const GLhalf* fog);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r, GLhalf q);\r\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLNORMAL3HNVPROC) (GLhalf nx, GLhalf ny, GLhalf nz);\r\ntypedef void (GLAPIENTRY * PFNGLNORMAL3HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD1HNVPROC) (GLhalf s);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD1HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2HNVPROC) (GLhalf s, GLhalf t);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD3HNVPROC) (GLhalf s, GLhalf t, GLhalf r);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD3HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4HNVPROC) (GLhalf s, GLhalf t, GLhalf r, GLhalf q);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEX2HNVPROC) (GLhalf x, GLhalf y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEX2HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEX3HNVPROC) (GLhalf x, GLhalf y, GLhalf z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEX3HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEX4HNVPROC) (GLhalf x, GLhalf y, GLhalf z, GLhalf w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEX4HVNVPROC) (const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalf x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalf x, GLhalf y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z, GLhalf w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHNVPROC) (GLhalf weight);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalf* weight);\r\n\r\n#define glColor3hNV GLEW_GET_FUN(__glewColor3hNV)\r\n#define glColor3hvNV GLEW_GET_FUN(__glewColor3hvNV)\r\n#define glColor4hNV GLEW_GET_FUN(__glewColor4hNV)\r\n#define glColor4hvNV GLEW_GET_FUN(__glewColor4hvNV)\r\n#define glFogCoordhNV GLEW_GET_FUN(__glewFogCoordhNV)\r\n#define glFogCoordhvNV GLEW_GET_FUN(__glewFogCoordhvNV)\r\n#define glMultiTexCoord1hNV GLEW_GET_FUN(__glewMultiTexCoord1hNV)\r\n#define glMultiTexCoord1hvNV GLEW_GET_FUN(__glewMultiTexCoord1hvNV)\r\n#define glMultiTexCoord2hNV GLEW_GET_FUN(__glewMultiTexCoord2hNV)\r\n#define glMultiTexCoord2hvNV GLEW_GET_FUN(__glewMultiTexCoord2hvNV)\r\n#define glMultiTexCoord3hNV GLEW_GET_FUN(__glewMultiTexCoord3hNV)\r\n#define glMultiTexCoord3hvNV GLEW_GET_FUN(__glewMultiTexCoord3hvNV)\r\n#define glMultiTexCoord4hNV GLEW_GET_FUN(__glewMultiTexCoord4hNV)\r\n#define glMultiTexCoord4hvNV GLEW_GET_FUN(__glewMultiTexCoord4hvNV)\r\n#define glNormal3hNV GLEW_GET_FUN(__glewNormal3hNV)\r\n#define glNormal3hvNV GLEW_GET_FUN(__glewNormal3hvNV)\r\n#define glSecondaryColor3hNV GLEW_GET_FUN(__glewSecondaryColor3hNV)\r\n#define glSecondaryColor3hvNV GLEW_GET_FUN(__glewSecondaryColor3hvNV)\r\n#define glTexCoord1hNV GLEW_GET_FUN(__glewTexCoord1hNV)\r\n#define glTexCoord1hvNV GLEW_GET_FUN(__glewTexCoord1hvNV)\r\n#define glTexCoord2hNV GLEW_GET_FUN(__glewTexCoord2hNV)\r\n#define glTexCoord2hvNV GLEW_GET_FUN(__glewTexCoord2hvNV)\r\n#define glTexCoord3hNV GLEW_GET_FUN(__glewTexCoord3hNV)\r\n#define glTexCoord3hvNV GLEW_GET_FUN(__glewTexCoord3hvNV)\r\n#define glTexCoord4hNV GLEW_GET_FUN(__glewTexCoord4hNV)\r\n#define glTexCoord4hvNV GLEW_GET_FUN(__glewTexCoord4hvNV)\r\n#define glVertex2hNV GLEW_GET_FUN(__glewVertex2hNV)\r\n#define glVertex2hvNV GLEW_GET_FUN(__glewVertex2hvNV)\r\n#define glVertex3hNV GLEW_GET_FUN(__glewVertex3hNV)\r\n#define glVertex3hvNV GLEW_GET_FUN(__glewVertex3hvNV)\r\n#define glVertex4hNV GLEW_GET_FUN(__glewVertex4hNV)\r\n#define glVertex4hvNV GLEW_GET_FUN(__glewVertex4hvNV)\r\n#define glVertexAttrib1hNV GLEW_GET_FUN(__glewVertexAttrib1hNV)\r\n#define glVertexAttrib1hvNV GLEW_GET_FUN(__glewVertexAttrib1hvNV)\r\n#define glVertexAttrib2hNV GLEW_GET_FUN(__glewVertexAttrib2hNV)\r\n#define glVertexAttrib2hvNV GLEW_GET_FUN(__glewVertexAttrib2hvNV)\r\n#define glVertexAttrib3hNV GLEW_GET_FUN(__glewVertexAttrib3hNV)\r\n#define glVertexAttrib3hvNV GLEW_GET_FUN(__glewVertexAttrib3hvNV)\r\n#define glVertexAttrib4hNV GLEW_GET_FUN(__glewVertexAttrib4hNV)\r\n#define glVertexAttrib4hvNV GLEW_GET_FUN(__glewVertexAttrib4hvNV)\r\n#define glVertexAttribs1hvNV GLEW_GET_FUN(__glewVertexAttribs1hvNV)\r\n#define glVertexAttribs2hvNV GLEW_GET_FUN(__glewVertexAttribs2hvNV)\r\n#define glVertexAttribs3hvNV GLEW_GET_FUN(__glewVertexAttribs3hvNV)\r\n#define glVertexAttribs4hvNV GLEW_GET_FUN(__glewVertexAttribs4hvNV)\r\n#define glVertexWeighthNV GLEW_GET_FUN(__glewVertexWeighthNV)\r\n#define glVertexWeighthvNV GLEW_GET_FUN(__glewVertexWeighthvNV)\r\n\r\n#define GLEW_NV_half_float GLEW_GET_VAR(__GLEW_NV_half_float)\r\n\r\n#endif /* GL_NV_half_float */\r\n\r\n/* ------------------------ GL_NV_light_max_exponent ----------------------- */\r\n\r\n#ifndef GL_NV_light_max_exponent\r\n#define GL_NV_light_max_exponent 1\r\n\r\n#define GL_MAX_SHININESS_NV 0x8504\r\n#define GL_MAX_SPOT_EXPONENT_NV 0x8505\r\n\r\n#define GLEW_NV_light_max_exponent GLEW_GET_VAR(__GLEW_NV_light_max_exponent)\r\n\r\n#endif /* GL_NV_light_max_exponent */\r\n\r\n/* ----------------------- GL_NV_multisample_coverage ---------------------- */\r\n\r\n#ifndef GL_NV_multisample_coverage\r\n#define GL_NV_multisample_coverage 1\r\n\r\n#define GL_COVERAGE_SAMPLES_NV 0x80A9\r\n#define GL_COLOR_SAMPLES_NV 0x8E20\r\n\r\n#define GLEW_NV_multisample_coverage GLEW_GET_VAR(__GLEW_NV_multisample_coverage)\r\n\r\n#endif /* GL_NV_multisample_coverage */\r\n\r\n/* --------------------- GL_NV_multisample_filter_hint --------------------- */\r\n\r\n#ifndef GL_NV_multisample_filter_hint\r\n#define GL_NV_multisample_filter_hint 1\r\n\r\n#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534\r\n\r\n#define GLEW_NV_multisample_filter_hint GLEW_GET_VAR(__GLEW_NV_multisample_filter_hint)\r\n\r\n#endif /* GL_NV_multisample_filter_hint */\r\n\r\n/* ------------------------- GL_NV_occlusion_query ------------------------- */\r\n\r\n#ifndef GL_NV_occlusion_query\r\n#define GL_NV_occlusion_query 1\r\n\r\n#define GL_PIXEL_COUNTER_BITS_NV 0x8864\r\n#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865\r\n#define GL_PIXEL_COUNT_NV 0x8866\r\n#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);\r\n\r\n#define glBeginOcclusionQueryNV GLEW_GET_FUN(__glewBeginOcclusionQueryNV)\r\n#define glDeleteOcclusionQueriesNV GLEW_GET_FUN(__glewDeleteOcclusionQueriesNV)\r\n#define glEndOcclusionQueryNV GLEW_GET_FUN(__glewEndOcclusionQueryNV)\r\n#define glGenOcclusionQueriesNV GLEW_GET_FUN(__glewGenOcclusionQueriesNV)\r\n#define glGetOcclusionQueryivNV GLEW_GET_FUN(__glewGetOcclusionQueryivNV)\r\n#define glGetOcclusionQueryuivNV GLEW_GET_FUN(__glewGetOcclusionQueryuivNV)\r\n#define glIsOcclusionQueryNV GLEW_GET_FUN(__glewIsOcclusionQueryNV)\r\n\r\n#define GLEW_NV_occlusion_query GLEW_GET_VAR(__GLEW_NV_occlusion_query)\r\n\r\n#endif /* GL_NV_occlusion_query */\r\n\r\n/* ----------------------- GL_NV_packed_depth_stencil ---------------------- */\r\n\r\n#ifndef GL_NV_packed_depth_stencil\r\n#define GL_NV_packed_depth_stencil 1\r\n\r\n#define GL_DEPTH_STENCIL_NV 0x84F9\r\n#define GL_UNSIGNED_INT_24_8_NV 0x84FA\r\n\r\n#define GLEW_NV_packed_depth_stencil GLEW_GET_VAR(__GLEW_NV_packed_depth_stencil)\r\n\r\n#endif /* GL_NV_packed_depth_stencil */\r\n\r\n/* --------------------- GL_NV_parameter_buffer_object --------------------- */\r\n\r\n#ifndef GL_NV_parameter_buffer_object\r\n#define GL_NV_parameter_buffer_object 1\r\n\r\n#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0\r\n#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1\r\n#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2\r\n#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3\r\n#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);\r\n\r\n#define glProgramBufferParametersIivNV GLEW_GET_FUN(__glewProgramBufferParametersIivNV)\r\n#define glProgramBufferParametersIuivNV GLEW_GET_FUN(__glewProgramBufferParametersIuivNV)\r\n#define glProgramBufferParametersfvNV GLEW_GET_FUN(__glewProgramBufferParametersfvNV)\r\n\r\n#define GLEW_NV_parameter_buffer_object GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object)\r\n\r\n#endif /* GL_NV_parameter_buffer_object */\r\n\r\n/* --------------------- GL_NV_parameter_buffer_object2 -------------------- */\r\n\r\n#ifndef GL_NV_parameter_buffer_object2\r\n#define GL_NV_parameter_buffer_object2 1\r\n\r\n#define GLEW_NV_parameter_buffer_object2 GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object2)\r\n\r\n#endif /* GL_NV_parameter_buffer_object2 */\r\n\r\n/* -------------------------- GL_NV_path_rendering ------------------------- */\r\n\r\n#ifndef GL_NV_path_rendering\r\n#define GL_NV_path_rendering 1\r\n\r\n#define GL_CLOSE_PATH_NV 0x00\r\n#define GL_BOLD_BIT_NV 0x01\r\n#define GL_GLYPH_WIDTH_BIT_NV 0x01\r\n#define GL_GLYPH_HEIGHT_BIT_NV 0x02\r\n#define GL_ITALIC_BIT_NV 0x02\r\n#define GL_MOVE_TO_NV 0x02\r\n#define GL_RELATIVE_MOVE_TO_NV 0x03\r\n#define GL_LINE_TO_NV 0x04\r\n#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04\r\n#define GL_RELATIVE_LINE_TO_NV 0x05\r\n#define GL_HORIZONTAL_LINE_TO_NV 0x06\r\n#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07\r\n#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08\r\n#define GL_VERTICAL_LINE_TO_NV 0x08\r\n#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09\r\n#define GL_QUADRATIC_CURVE_TO_NV 0x0A\r\n#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B\r\n#define GL_CUBIC_CURVE_TO_NV 0x0C\r\n#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D\r\n#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E\r\n#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F\r\n#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10\r\n#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10\r\n#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11\r\n#define GL_SMALL_CCW_ARC_TO_NV 0x12\r\n#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13\r\n#define GL_SMALL_CW_ARC_TO_NV 0x14\r\n#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15\r\n#define GL_LARGE_CCW_ARC_TO_NV 0x16\r\n#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17\r\n#define GL_LARGE_CW_ARC_TO_NV 0x18\r\n#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19\r\n#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20\r\n#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40\r\n#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80\r\n#define GL_RESTART_PATH_NV 0xF0\r\n#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2\r\n#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4\r\n#define GL_RECT_NV 0xF6\r\n#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8\r\n#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA\r\n#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC\r\n#define GL_ARC_TO_NV 0xFE\r\n#define GL_RELATIVE_ARC_TO_NV 0xFF\r\n#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100\r\n#define GL_PRIMARY_COLOR_NV 0x852C\r\n#define GL_SECONDARY_COLOR_NV 0x852D\r\n#define GL_PRIMARY_COLOR 0x8577\r\n#define GL_PATH_FORMAT_SVG_NV 0x9070\r\n#define GL_PATH_FORMAT_PS_NV 0x9071\r\n#define GL_STANDARD_FONT_NAME_NV 0x9072\r\n#define GL_SYSTEM_FONT_NAME_NV 0x9073\r\n#define GL_FILE_NAME_NV 0x9074\r\n#define GL_PATH_STROKE_WIDTH_NV 0x9075\r\n#define GL_PATH_END_CAPS_NV 0x9076\r\n#define GL_PATH_INITIAL_END_CAP_NV 0x9077\r\n#define GL_PATH_TERMINAL_END_CAP_NV 0x9078\r\n#define GL_PATH_JOIN_STYLE_NV 0x9079\r\n#define GL_PATH_MITER_LIMIT_NV 0x907A\r\n#define GL_PATH_DASH_CAPS_NV 0x907B\r\n#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C\r\n#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D\r\n#define GL_PATH_DASH_OFFSET_NV 0x907E\r\n#define GL_PATH_CLIENT_LENGTH_NV 0x907F\r\n#define GL_PATH_FILL_MODE_NV 0x9080\r\n#define GL_PATH_FILL_MASK_NV 0x9081\r\n#define GL_PATH_FILL_COVER_MODE_NV 0x9082\r\n#define GL_PATH_STROKE_COVER_MODE_NV 0x9083\r\n#define GL_PATH_STROKE_MASK_NV 0x9084\r\n#define GL_COUNT_UP_NV 0x9088\r\n#define GL_COUNT_DOWN_NV 0x9089\r\n#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A\r\n#define GL_CONVEX_HULL_NV 0x908B\r\n#define GL_BOUNDING_BOX_NV 0x908D\r\n#define GL_TRANSLATE_X_NV 0x908E\r\n#define GL_TRANSLATE_Y_NV 0x908F\r\n#define GL_TRANSLATE_2D_NV 0x9090\r\n#define GL_TRANSLATE_3D_NV 0x9091\r\n#define GL_AFFINE_2D_NV 0x9092\r\n#define GL_AFFINE_3D_NV 0x9094\r\n#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096\r\n#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098\r\n#define GL_UTF8_NV 0x909A\r\n#define GL_UTF16_NV 0x909B\r\n#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C\r\n#define GL_PATH_COMMAND_COUNT_NV 0x909D\r\n#define GL_PATH_COORD_COUNT_NV 0x909E\r\n#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F\r\n#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0\r\n#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1\r\n#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2\r\n#define GL_SQUARE_NV 0x90A3\r\n#define GL_ROUND_NV 0x90A4\r\n#define GL_TRIANGULAR_NV 0x90A5\r\n#define GL_BEVEL_NV 0x90A6\r\n#define GL_MITER_REVERT_NV 0x90A7\r\n#define GL_MITER_TRUNCATE_NV 0x90A8\r\n#define GL_SKIP_MISSING_GLYPH_NV 0x90A9\r\n#define GL_USE_MISSING_GLYPH_NV 0x90AA\r\n#define GL_PATH_ERROR_POSITION_NV 0x90AB\r\n#define GL_PATH_FOG_GEN_MODE_NV 0x90AC\r\n#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD\r\n#define GL_ADJACENT_PAIRS_NV 0x90AE\r\n#define GL_FIRST_TO_REST_NV 0x90AF\r\n#define GL_PATH_GEN_MODE_NV 0x90B0\r\n#define GL_PATH_GEN_COEFF_NV 0x90B1\r\n#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2\r\n#define GL_PATH_GEN_COMPONENTS_NV 0x90B3\r\n#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4\r\n#define GL_MOVE_TO_RESETS_NV 0x90B5\r\n#define GL_MOVE_TO_CONTINUES_NV 0x90B6\r\n#define GL_PATH_STENCIL_FUNC_NV 0x90B7\r\n#define GL_PATH_STENCIL_REF_NV 0x90B8\r\n#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9\r\n#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD\r\n#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE\r\n#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF\r\n#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000\r\n#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000\r\n#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000\r\n#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000\r\n#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000\r\n#define GL_FONT_ASCENDER_BIT_NV 0x00200000\r\n#define GL_FONT_DESCENDER_BIT_NV 0x00400000\r\n#define GL_FONT_HEIGHT_BIT_NV 0x00800000\r\n#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000\r\n#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000\r\n#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000\r\n#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000\r\n#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);\r\ntypedef void (GLAPIENTRY * PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (GLAPIENTRY * PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);\r\ntypedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHNVPROC) (GLuint name, GLenum coverMode);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGENPATHSNVPROC) (GLsizei range);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOMMANDSNVPROC) (GLuint name, GLubyte* commands);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHCOORDSNVPROC) (GLuint name, GLfloat* coords);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHDASHARRAYNVPROC) (GLuint name, GLfloat* dashArray);\r\ntypedef GLfloat (GLAPIENTRY * PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint fistPathName, GLsizei numPaths, GLsizei stride, GLfloat* metrics);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERFVNVPROC) (GLuint name, GLenum param, GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERIVNVPROC) (GLuint name, GLenum param, GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPATHNVPROC) (GLuint path);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat* coeffs);\r\ntypedef void (GLAPIENTRY * PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const GLvoid*coords);\r\ntypedef void (GLAPIENTRY * PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void* coords);\r\ntypedef void (GLAPIENTRY * PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum zfunc);\r\ntypedef void (GLAPIENTRY * PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat* dashArray);\r\ntypedef void (GLAPIENTRY * PFNGLPATHFOGGENNVPROC) (GLenum genMode);\r\ntypedef void (GLAPIENTRY * PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\r\ntypedef void (GLAPIENTRY * PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid*charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\r\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);\r\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat* value);\r\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);\r\ntypedef void (GLAPIENTRY * PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint* value);\r\ntypedef void (GLAPIENTRY * PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);\r\ntypedef void (GLAPIENTRY * PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);\r\ntypedef void (GLAPIENTRY * PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void* pathString);\r\ntypedef void (GLAPIENTRY * PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const GLvoid*coords);\r\ntypedef void (GLAPIENTRY * PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void* coords);\r\ntypedef void (GLAPIENTRY * PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat* coeffs);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat* x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);\r\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat* transformValues);\r\ntypedef void (GLAPIENTRY * PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint paths[], const GLfloat weights[]);\r\n\r\n#define glCopyPathNV GLEW_GET_FUN(__glewCopyPathNV)\r\n#define glCoverFillPathInstancedNV GLEW_GET_FUN(__glewCoverFillPathInstancedNV)\r\n#define glCoverFillPathNV GLEW_GET_FUN(__glewCoverFillPathNV)\r\n#define glCoverStrokePathInstancedNV GLEW_GET_FUN(__glewCoverStrokePathInstancedNV)\r\n#define glCoverStrokePathNV GLEW_GET_FUN(__glewCoverStrokePathNV)\r\n#define glDeletePathsNV GLEW_GET_FUN(__glewDeletePathsNV)\r\n#define glGenPathsNV GLEW_GET_FUN(__glewGenPathsNV)\r\n#define glGetPathColorGenfvNV GLEW_GET_FUN(__glewGetPathColorGenfvNV)\r\n#define glGetPathColorGenivNV GLEW_GET_FUN(__glewGetPathColorGenivNV)\r\n#define glGetPathCommandsNV GLEW_GET_FUN(__glewGetPathCommandsNV)\r\n#define glGetPathCoordsNV GLEW_GET_FUN(__glewGetPathCoordsNV)\r\n#define glGetPathDashArrayNV GLEW_GET_FUN(__glewGetPathDashArrayNV)\r\n#define glGetPathLengthNV GLEW_GET_FUN(__glewGetPathLengthNV)\r\n#define glGetPathMetricRangeNV GLEW_GET_FUN(__glewGetPathMetricRangeNV)\r\n#define glGetPathMetricsNV GLEW_GET_FUN(__glewGetPathMetricsNV)\r\n#define glGetPathParameterfvNV GLEW_GET_FUN(__glewGetPathParameterfvNV)\r\n#define glGetPathParameterivNV GLEW_GET_FUN(__glewGetPathParameterivNV)\r\n#define glGetPathSpacingNV GLEW_GET_FUN(__glewGetPathSpacingNV)\r\n#define glGetPathTexGenfvNV GLEW_GET_FUN(__glewGetPathTexGenfvNV)\r\n#define glGetPathTexGenivNV GLEW_GET_FUN(__glewGetPathTexGenivNV)\r\n#define glInterpolatePathsNV GLEW_GET_FUN(__glewInterpolatePathsNV)\r\n#define glIsPathNV GLEW_GET_FUN(__glewIsPathNV)\r\n#define glIsPointInFillPathNV GLEW_GET_FUN(__glewIsPointInFillPathNV)\r\n#define glIsPointInStrokePathNV GLEW_GET_FUN(__glewIsPointInStrokePathNV)\r\n#define glPathColorGenNV GLEW_GET_FUN(__glewPathColorGenNV)\r\n#define glPathCommandsNV GLEW_GET_FUN(__glewPathCommandsNV)\r\n#define glPathCoordsNV GLEW_GET_FUN(__glewPathCoordsNV)\r\n#define glPathCoverDepthFuncNV GLEW_GET_FUN(__glewPathCoverDepthFuncNV)\r\n#define glPathDashArrayNV GLEW_GET_FUN(__glewPathDashArrayNV)\r\n#define glPathFogGenNV GLEW_GET_FUN(__glewPathFogGenNV)\r\n#define glPathGlyphRangeNV GLEW_GET_FUN(__glewPathGlyphRangeNV)\r\n#define glPathGlyphsNV GLEW_GET_FUN(__glewPathGlyphsNV)\r\n#define glPathParameterfNV GLEW_GET_FUN(__glewPathParameterfNV)\r\n#define glPathParameterfvNV GLEW_GET_FUN(__glewPathParameterfvNV)\r\n#define glPathParameteriNV GLEW_GET_FUN(__glewPathParameteriNV)\r\n#define glPathParameterivNV GLEW_GET_FUN(__glewPathParameterivNV)\r\n#define glPathStencilDepthOffsetNV GLEW_GET_FUN(__glewPathStencilDepthOffsetNV)\r\n#define glPathStencilFuncNV GLEW_GET_FUN(__glewPathStencilFuncNV)\r\n#define glPathStringNV GLEW_GET_FUN(__glewPathStringNV)\r\n#define glPathSubCommandsNV GLEW_GET_FUN(__glewPathSubCommandsNV)\r\n#define glPathSubCoordsNV GLEW_GET_FUN(__glewPathSubCoordsNV)\r\n#define glPathTexGenNV GLEW_GET_FUN(__glewPathTexGenNV)\r\n#define glPointAlongPathNV GLEW_GET_FUN(__glewPointAlongPathNV)\r\n#define glStencilFillPathInstancedNV GLEW_GET_FUN(__glewStencilFillPathInstancedNV)\r\n#define glStencilFillPathNV GLEW_GET_FUN(__glewStencilFillPathNV)\r\n#define glStencilStrokePathInstancedNV GLEW_GET_FUN(__glewStencilStrokePathInstancedNV)\r\n#define glStencilStrokePathNV GLEW_GET_FUN(__glewStencilStrokePathNV)\r\n#define glTransformPathNV GLEW_GET_FUN(__glewTransformPathNV)\r\n#define glWeightPathsNV GLEW_GET_FUN(__glewWeightPathsNV)\r\n\r\n#define GLEW_NV_path_rendering GLEW_GET_VAR(__GLEW_NV_path_rendering)\r\n\r\n#endif /* GL_NV_path_rendering */\r\n\r\n/* ------------------------- GL_NV_pixel_data_range ------------------------ */\r\n\r\n#ifndef GL_NV_pixel_data_range\r\n#define GL_NV_pixel_data_range 1\r\n\r\n#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878\r\n#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879\r\n#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A\r\n#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B\r\n#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C\r\n#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, void* pointer);\r\n\r\n#define glFlushPixelDataRangeNV GLEW_GET_FUN(__glewFlushPixelDataRangeNV)\r\n#define glPixelDataRangeNV GLEW_GET_FUN(__glewPixelDataRangeNV)\r\n\r\n#define GLEW_NV_pixel_data_range GLEW_GET_VAR(__GLEW_NV_pixel_data_range)\r\n\r\n#endif /* GL_NV_pixel_data_range */\r\n\r\n/* --------------------------- GL_NV_point_sprite -------------------------- */\r\n\r\n#ifndef GL_NV_point_sprite\r\n#define GL_NV_point_sprite 1\r\n\r\n#define GL_POINT_SPRITE_NV 0x8861\r\n#define GL_COORD_REPLACE_NV 0x8862\r\n#define GL_POINT_SPRITE_R_MODE_NV 0x8863\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint* params);\r\n\r\n#define glPointParameteriNV GLEW_GET_FUN(__glewPointParameteriNV)\r\n#define glPointParameterivNV GLEW_GET_FUN(__glewPointParameterivNV)\r\n\r\n#define GLEW_NV_point_sprite GLEW_GET_VAR(__GLEW_NV_point_sprite)\r\n\r\n#endif /* GL_NV_point_sprite */\r\n\r\n/* -------------------------- GL_NV_present_video -------------------------- */\r\n\r\n#ifndef GL_NV_present_video\r\n#define GL_NV_present_video 1\r\n\r\n#define GL_FRAME_NV 0x8E26\r\n#define GL_FIELDS_NV 0x8E27\r\n#define GL_CURRENT_TIME_NV 0x8E28\r\n#define GL_NUM_FILL_STREAMS_NV 0x8E29\r\n#define GL_PRESENT_TIME_NV 0x8E2A\r\n#define GL_PRESENT_DURATION_NV 0x8E2B\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint* params);\r\ntypedef void (GLAPIENTRY * PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);\r\ntypedef void (GLAPIENTRY * PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);\r\n\r\n#define glGetVideoi64vNV GLEW_GET_FUN(__glewGetVideoi64vNV)\r\n#define glGetVideoivNV GLEW_GET_FUN(__glewGetVideoivNV)\r\n#define glGetVideoui64vNV GLEW_GET_FUN(__glewGetVideoui64vNV)\r\n#define glGetVideouivNV GLEW_GET_FUN(__glewGetVideouivNV)\r\n#define glPresentFrameDualFillNV GLEW_GET_FUN(__glewPresentFrameDualFillNV)\r\n#define glPresentFrameKeyedNV GLEW_GET_FUN(__glewPresentFrameKeyedNV)\r\n\r\n#define GLEW_NV_present_video GLEW_GET_VAR(__GLEW_NV_present_video)\r\n\r\n#endif /* GL_NV_present_video */\r\n\r\n/* ------------------------ GL_NV_primitive_restart ------------------------ */\r\n\r\n#ifndef GL_NV_primitive_restart\r\n#define GL_NV_primitive_restart 1\r\n\r\n#define GL_PRIMITIVE_RESTART_NV 0x8558\r\n#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);\r\ntypedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void);\r\n\r\n#define glPrimitiveRestartIndexNV GLEW_GET_FUN(__glewPrimitiveRestartIndexNV)\r\n#define glPrimitiveRestartNV GLEW_GET_FUN(__glewPrimitiveRestartNV)\r\n\r\n#define GLEW_NV_primitive_restart GLEW_GET_VAR(__GLEW_NV_primitive_restart)\r\n\r\n#endif /* GL_NV_primitive_restart */\r\n\r\n/* ------------------------ GL_NV_register_combiners ----------------------- */\r\n\r\n#ifndef GL_NV_register_combiners\r\n#define GL_NV_register_combiners 1\r\n\r\n#define GL_REGISTER_COMBINERS_NV 0x8522\r\n#define GL_VARIABLE_A_NV 0x8523\r\n#define GL_VARIABLE_B_NV 0x8524\r\n#define GL_VARIABLE_C_NV 0x8525\r\n#define GL_VARIABLE_D_NV 0x8526\r\n#define GL_VARIABLE_E_NV 0x8527\r\n#define GL_VARIABLE_F_NV 0x8528\r\n#define GL_VARIABLE_G_NV 0x8529\r\n#define GL_CONSTANT_COLOR0_NV 0x852A\r\n#define GL_CONSTANT_COLOR1_NV 0x852B\r\n#define GL_PRIMARY_COLOR_NV 0x852C\r\n#define GL_SECONDARY_COLOR_NV 0x852D\r\n#define GL_SPARE0_NV 0x852E\r\n#define GL_SPARE1_NV 0x852F\r\n#define GL_DISCARD_NV 0x8530\r\n#define GL_E_TIMES_F_NV 0x8531\r\n#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532\r\n#define GL_UNSIGNED_IDENTITY_NV 0x8536\r\n#define GL_UNSIGNED_INVERT_NV 0x8537\r\n#define GL_EXPAND_NORMAL_NV 0x8538\r\n#define GL_EXPAND_NEGATE_NV 0x8539\r\n#define GL_HALF_BIAS_NORMAL_NV 0x853A\r\n#define GL_HALF_BIAS_NEGATE_NV 0x853B\r\n#define GL_SIGNED_IDENTITY_NV 0x853C\r\n#define GL_SIGNED_NEGATE_NV 0x853D\r\n#define GL_SCALE_BY_TWO_NV 0x853E\r\n#define GL_SCALE_BY_FOUR_NV 0x853F\r\n#define GL_SCALE_BY_ONE_HALF_NV 0x8540\r\n#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541\r\n#define GL_COMBINER_INPUT_NV 0x8542\r\n#define GL_COMBINER_MAPPING_NV 0x8543\r\n#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544\r\n#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545\r\n#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546\r\n#define GL_COMBINER_MUX_SUM_NV 0x8547\r\n#define GL_COMBINER_SCALE_NV 0x8548\r\n#define GL_COMBINER_BIAS_NV 0x8549\r\n#define GL_COMBINER_AB_OUTPUT_NV 0x854A\r\n#define GL_COMBINER_CD_OUTPUT_NV 0x854B\r\n#define GL_COMBINER_SUM_OUTPUT_NV 0x854C\r\n#define GL_MAX_GENERAL_COMBINERS_NV 0x854D\r\n#define GL_NUM_GENERAL_COMBINERS_NV 0x854E\r\n#define GL_COLOR_SUM_CLAMP_NV 0x854F\r\n#define GL_COMBINER0_NV 0x8550\r\n#define GL_COMBINER1_NV 0x8551\r\n#define GL_COMBINER2_NV 0x8552\r\n#define GL_COMBINER3_NV 0x8553\r\n#define GL_COMBINER4_NV 0x8554\r\n#define GL_COMBINER5_NV 0x8555\r\n#define GL_COMBINER6_NV 0x8556\r\n#define GL_COMBINER7_NV 0x8557\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint* params);\r\n\r\n#define glCombinerInputNV GLEW_GET_FUN(__glewCombinerInputNV)\r\n#define glCombinerOutputNV GLEW_GET_FUN(__glewCombinerOutputNV)\r\n#define glCombinerParameterfNV GLEW_GET_FUN(__glewCombinerParameterfNV)\r\n#define glCombinerParameterfvNV GLEW_GET_FUN(__glewCombinerParameterfvNV)\r\n#define glCombinerParameteriNV GLEW_GET_FUN(__glewCombinerParameteriNV)\r\n#define glCombinerParameterivNV GLEW_GET_FUN(__glewCombinerParameterivNV)\r\n#define glFinalCombinerInputNV GLEW_GET_FUN(__glewFinalCombinerInputNV)\r\n#define glGetCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetCombinerInputParameterfvNV)\r\n#define glGetCombinerInputParameterivNV GLEW_GET_FUN(__glewGetCombinerInputParameterivNV)\r\n#define glGetCombinerOutputParameterfvNV GLEW_GET_FUN(__glewGetCombinerOutputParameterfvNV)\r\n#define glGetCombinerOutputParameterivNV GLEW_GET_FUN(__glewGetCombinerOutputParameterivNV)\r\n#define glGetFinalCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterfvNV)\r\n#define glGetFinalCombinerInputParameterivNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterivNV)\r\n\r\n#define GLEW_NV_register_combiners GLEW_GET_VAR(__GLEW_NV_register_combiners)\r\n\r\n#endif /* GL_NV_register_combiners */\r\n\r\n/* ----------------------- GL_NV_register_combiners2 ----------------------- */\r\n\r\n#ifndef GL_NV_register_combiners2\r\n#define GL_NV_register_combiners2 1\r\n\r\n#define GL_PER_STAGE_CONSTANTS_NV 0x8535\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat* params);\r\n\r\n#define glCombinerStageParameterfvNV GLEW_GET_FUN(__glewCombinerStageParameterfvNV)\r\n#define glGetCombinerStageParameterfvNV GLEW_GET_FUN(__glewGetCombinerStageParameterfvNV)\r\n\r\n#define GLEW_NV_register_combiners2 GLEW_GET_VAR(__GLEW_NV_register_combiners2)\r\n\r\n#endif /* GL_NV_register_combiners2 */\r\n\r\n/* ----------------------- GL_NV_shader_atomic_float ----------------------- */\r\n\r\n#ifndef GL_NV_shader_atomic_float\r\n#define GL_NV_shader_atomic_float 1\r\n\r\n#define GLEW_NV_shader_atomic_float GLEW_GET_VAR(__GLEW_NV_shader_atomic_float)\r\n\r\n#endif /* GL_NV_shader_atomic_float */\r\n\r\n/* ------------------------ GL_NV_shader_buffer_load ----------------------- */\r\n\r\n#ifndef GL_NV_shader_buffer_load\r\n#define GL_NV_shader_buffer_load 1\r\n\r\n#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D\r\n#define GL_GPU_ADDRESS_NV 0x8F34\r\n#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT* result);\r\ntypedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);\r\ntypedef void (GLAPIENTRY * PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);\r\ntypedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);\r\ntypedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);\r\n\r\n#define glGetBufferParameterui64vNV GLEW_GET_FUN(__glewGetBufferParameterui64vNV)\r\n#define glGetIntegerui64vNV GLEW_GET_FUN(__glewGetIntegerui64vNV)\r\n#define glGetNamedBufferParameterui64vNV GLEW_GET_FUN(__glewGetNamedBufferParameterui64vNV)\r\n#define glIsBufferResidentNV GLEW_GET_FUN(__glewIsBufferResidentNV)\r\n#define glIsNamedBufferResidentNV GLEW_GET_FUN(__glewIsNamedBufferResidentNV)\r\n#define glMakeBufferNonResidentNV GLEW_GET_FUN(__glewMakeBufferNonResidentNV)\r\n#define glMakeBufferResidentNV GLEW_GET_FUN(__glewMakeBufferResidentNV)\r\n#define glMakeNamedBufferNonResidentNV GLEW_GET_FUN(__glewMakeNamedBufferNonResidentNV)\r\n#define glMakeNamedBufferResidentNV GLEW_GET_FUN(__glewMakeNamedBufferResidentNV)\r\n#define glProgramUniformui64NV GLEW_GET_FUN(__glewProgramUniformui64NV)\r\n#define glProgramUniformui64vNV GLEW_GET_FUN(__glewProgramUniformui64vNV)\r\n#define glUniformui64NV GLEW_GET_FUN(__glewUniformui64NV)\r\n#define glUniformui64vNV GLEW_GET_FUN(__glewUniformui64vNV)\r\n\r\n#define GLEW_NV_shader_buffer_load GLEW_GET_VAR(__GLEW_NV_shader_buffer_load)\r\n\r\n#endif /* GL_NV_shader_buffer_load */\r\n\r\n/* ---------------------- GL_NV_tessellation_program5 ---------------------- */\r\n\r\n#ifndef GL_NV_tessellation_program5\r\n#define GL_NV_tessellation_program5 1\r\n\r\n#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8\r\n#define GL_TESS_CONTROL_PROGRAM_NV 0x891E\r\n#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F\r\n#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74\r\n#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75\r\n\r\n#define GLEW_NV_tessellation_program5 GLEW_GET_VAR(__GLEW_NV_tessellation_program5)\r\n\r\n#endif /* GL_NV_tessellation_program5 */\r\n\r\n/* -------------------------- GL_NV_texgen_emboss -------------------------- */\r\n\r\n#ifndef GL_NV_texgen_emboss\r\n#define GL_NV_texgen_emboss 1\r\n\r\n#define GL_EMBOSS_LIGHT_NV 0x855D\r\n#define GL_EMBOSS_CONSTANT_NV 0x855E\r\n#define GL_EMBOSS_MAP_NV 0x855F\r\n\r\n#define GLEW_NV_texgen_emboss GLEW_GET_VAR(__GLEW_NV_texgen_emboss)\r\n\r\n#endif /* GL_NV_texgen_emboss */\r\n\r\n/* ------------------------ GL_NV_texgen_reflection ------------------------ */\r\n\r\n#ifndef GL_NV_texgen_reflection\r\n#define GL_NV_texgen_reflection 1\r\n\r\n#define GL_NORMAL_MAP_NV 0x8511\r\n#define GL_REFLECTION_MAP_NV 0x8512\r\n\r\n#define GLEW_NV_texgen_reflection GLEW_GET_VAR(__GLEW_NV_texgen_reflection)\r\n\r\n#endif /* GL_NV_texgen_reflection */\r\n\r\n/* ------------------------- GL_NV_texture_barrier ------------------------- */\r\n\r\n#ifndef GL_NV_texture_barrier\r\n#define GL_NV_texture_barrier 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERNVPROC) (void);\r\n\r\n#define glTextureBarrierNV GLEW_GET_FUN(__glewTextureBarrierNV)\r\n\r\n#define GLEW_NV_texture_barrier GLEW_GET_VAR(__GLEW_NV_texture_barrier)\r\n\r\n#endif /* GL_NV_texture_barrier */\r\n\r\n/* --------------------- GL_NV_texture_compression_vtc --------------------- */\r\n\r\n#ifndef GL_NV_texture_compression_vtc\r\n#define GL_NV_texture_compression_vtc 1\r\n\r\n#define GLEW_NV_texture_compression_vtc GLEW_GET_VAR(__GLEW_NV_texture_compression_vtc)\r\n\r\n#endif /* GL_NV_texture_compression_vtc */\r\n\r\n/* ----------------------- GL_NV_texture_env_combine4 ---------------------- */\r\n\r\n#ifndef GL_NV_texture_env_combine4\r\n#define GL_NV_texture_env_combine4 1\r\n\r\n#define GL_COMBINE4_NV 0x8503\r\n#define GL_SOURCE3_RGB_NV 0x8583\r\n#define GL_SOURCE3_ALPHA_NV 0x858B\r\n#define GL_OPERAND3_RGB_NV 0x8593\r\n#define GL_OPERAND3_ALPHA_NV 0x859B\r\n\r\n#define GLEW_NV_texture_env_combine4 GLEW_GET_VAR(__GLEW_NV_texture_env_combine4)\r\n\r\n#endif /* GL_NV_texture_env_combine4 */\r\n\r\n/* ---------------------- GL_NV_texture_expand_normal ---------------------- */\r\n\r\n#ifndef GL_NV_texture_expand_normal\r\n#define GL_NV_texture_expand_normal 1\r\n\r\n#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F\r\n\r\n#define GLEW_NV_texture_expand_normal GLEW_GET_VAR(__GLEW_NV_texture_expand_normal)\r\n\r\n#endif /* GL_NV_texture_expand_normal */\r\n\r\n/* ----------------------- GL_NV_texture_multisample ----------------------- */\r\n\r\n#ifndef GL_NV_texture_multisample\r\n#define GL_NV_texture_multisample 1\r\n\r\n#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045\r\n#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\n\r\n#define glTexImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage2DMultisampleCoverageNV)\r\n#define glTexImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage3DMultisampleCoverageNV)\r\n#define glTextureImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage2DMultisampleCoverageNV)\r\n#define glTextureImage2DMultisampleNV GLEW_GET_FUN(__glewTextureImage2DMultisampleNV)\r\n#define glTextureImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage3DMultisampleCoverageNV)\r\n#define glTextureImage3DMultisampleNV GLEW_GET_FUN(__glewTextureImage3DMultisampleNV)\r\n\r\n#define GLEW_NV_texture_multisample GLEW_GET_VAR(__GLEW_NV_texture_multisample)\r\n\r\n#endif /* GL_NV_texture_multisample */\r\n\r\n/* ------------------------ GL_NV_texture_rectangle ------------------------ */\r\n\r\n#ifndef GL_NV_texture_rectangle\r\n#define GL_NV_texture_rectangle 1\r\n\r\n#define GL_TEXTURE_RECTANGLE_NV 0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8\r\n\r\n#define GLEW_NV_texture_rectangle GLEW_GET_VAR(__GLEW_NV_texture_rectangle)\r\n\r\n#endif /* GL_NV_texture_rectangle */\r\n\r\n/* -------------------------- GL_NV_texture_shader ------------------------- */\r\n\r\n#ifndef GL_NV_texture_shader\r\n#define GL_NV_texture_shader 1\r\n\r\n#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C\r\n#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D\r\n#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E\r\n#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9\r\n#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA\r\n#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB\r\n#define GL_DSDT_MAG_INTENSITY_NV 0x86DC\r\n#define GL_SHADER_CONSISTENT_NV 0x86DD\r\n#define GL_TEXTURE_SHADER_NV 0x86DE\r\n#define GL_SHADER_OPERATION_NV 0x86DF\r\n#define GL_CULL_MODES_NV 0x86E0\r\n#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1\r\n#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1\r\n#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2\r\n#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2\r\n#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3\r\n#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3\r\n#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4\r\n#define GL_CONST_EYE_NV 0x86E5\r\n#define GL_PASS_THROUGH_NV 0x86E6\r\n#define GL_CULL_FRAGMENT_NV 0x86E7\r\n#define GL_OFFSET_TEXTURE_2D_NV 0x86E8\r\n#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9\r\n#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA\r\n#define GL_DOT_PRODUCT_NV 0x86EC\r\n#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED\r\n#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE\r\n#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0\r\n#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1\r\n#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2\r\n#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3\r\n#define GL_HILO_NV 0x86F4\r\n#define GL_DSDT_NV 0x86F5\r\n#define GL_DSDT_MAG_NV 0x86F6\r\n#define GL_DSDT_MAG_VIB_NV 0x86F7\r\n#define GL_HILO16_NV 0x86F8\r\n#define GL_SIGNED_HILO_NV 0x86F9\r\n#define GL_SIGNED_HILO16_NV 0x86FA\r\n#define GL_SIGNED_RGBA_NV 0x86FB\r\n#define GL_SIGNED_RGBA8_NV 0x86FC\r\n#define GL_SIGNED_RGB_NV 0x86FE\r\n#define GL_SIGNED_RGB8_NV 0x86FF\r\n#define GL_SIGNED_LUMINANCE_NV 0x8701\r\n#define GL_SIGNED_LUMINANCE8_NV 0x8702\r\n#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703\r\n#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704\r\n#define GL_SIGNED_ALPHA_NV 0x8705\r\n#define GL_SIGNED_ALPHA8_NV 0x8706\r\n#define GL_SIGNED_INTENSITY_NV 0x8707\r\n#define GL_SIGNED_INTENSITY8_NV 0x8708\r\n#define GL_DSDT8_NV 0x8709\r\n#define GL_DSDT8_MAG8_NV 0x870A\r\n#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B\r\n#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C\r\n#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D\r\n#define GL_HI_SCALE_NV 0x870E\r\n#define GL_LO_SCALE_NV 0x870F\r\n#define GL_DS_SCALE_NV 0x8710\r\n#define GL_DT_SCALE_NV 0x8711\r\n#define GL_MAGNITUDE_SCALE_NV 0x8712\r\n#define GL_VIBRANCE_SCALE_NV 0x8713\r\n#define GL_HI_BIAS_NV 0x8714\r\n#define GL_LO_BIAS_NV 0x8715\r\n#define GL_DS_BIAS_NV 0x8716\r\n#define GL_DT_BIAS_NV 0x8717\r\n#define GL_MAGNITUDE_BIAS_NV 0x8718\r\n#define GL_VIBRANCE_BIAS_NV 0x8719\r\n#define GL_TEXTURE_BORDER_VALUES_NV 0x871A\r\n#define GL_TEXTURE_HI_SIZE_NV 0x871B\r\n#define GL_TEXTURE_LO_SIZE_NV 0x871C\r\n#define GL_TEXTURE_DS_SIZE_NV 0x871D\r\n#define GL_TEXTURE_DT_SIZE_NV 0x871E\r\n#define GL_TEXTURE_MAG_SIZE_NV 0x871F\r\n\r\n#define GLEW_NV_texture_shader GLEW_GET_VAR(__GLEW_NV_texture_shader)\r\n\r\n#endif /* GL_NV_texture_shader */\r\n\r\n/* ------------------------- GL_NV_texture_shader2 ------------------------- */\r\n\r\n#ifndef GL_NV_texture_shader2\r\n#define GL_NV_texture_shader2 1\r\n\r\n#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA\r\n#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB\r\n#define GL_DSDT_MAG_INTENSITY_NV 0x86DC\r\n#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF\r\n#define GL_HILO_NV 0x86F4\r\n#define GL_DSDT_NV 0x86F5\r\n#define GL_DSDT_MAG_NV 0x86F6\r\n#define GL_DSDT_MAG_VIB_NV 0x86F7\r\n#define GL_HILO16_NV 0x86F8\r\n#define GL_SIGNED_HILO_NV 0x86F9\r\n#define GL_SIGNED_HILO16_NV 0x86FA\r\n#define GL_SIGNED_RGBA_NV 0x86FB\r\n#define GL_SIGNED_RGBA8_NV 0x86FC\r\n#define GL_SIGNED_RGB_NV 0x86FE\r\n#define GL_SIGNED_RGB8_NV 0x86FF\r\n#define GL_SIGNED_LUMINANCE_NV 0x8701\r\n#define GL_SIGNED_LUMINANCE8_NV 0x8702\r\n#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703\r\n#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704\r\n#define GL_SIGNED_ALPHA_NV 0x8705\r\n#define GL_SIGNED_ALPHA8_NV 0x8706\r\n#define GL_SIGNED_INTENSITY_NV 0x8707\r\n#define GL_SIGNED_INTENSITY8_NV 0x8708\r\n#define GL_DSDT8_NV 0x8709\r\n#define GL_DSDT8_MAG8_NV 0x870A\r\n#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B\r\n#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C\r\n#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D\r\n\r\n#define GLEW_NV_texture_shader2 GLEW_GET_VAR(__GLEW_NV_texture_shader2)\r\n\r\n#endif /* GL_NV_texture_shader2 */\r\n\r\n/* ------------------------- GL_NV_texture_shader3 ------------------------- */\r\n\r\n#ifndef GL_NV_texture_shader3\r\n#define GL_NV_texture_shader3 1\r\n\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853\r\n#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854\r\n#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855\r\n#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856\r\n#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857\r\n#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858\r\n#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859\r\n#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A\r\n#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B\r\n#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C\r\n#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D\r\n#define GL_HILO8_NV 0x885E\r\n#define GL_SIGNED_HILO8_NV 0x885F\r\n#define GL_FORCE_BLUE_TO_ONE_NV 0x8860\r\n\r\n#define GLEW_NV_texture_shader3 GLEW_GET_VAR(__GLEW_NV_texture_shader3)\r\n\r\n#endif /* GL_NV_texture_shader3 */\r\n\r\n/* ------------------------ GL_NV_transform_feedback ----------------------- */\r\n\r\n#ifndef GL_NV_transform_feedback\r\n#define GL_NV_transform_feedback 1\r\n\r\n#define GL_BACK_PRIMARY_COLOR_NV 0x8C77\r\n#define GL_BACK_SECONDARY_COLOR_NV 0x8C78\r\n#define GL_TEXTURE_COORD_NV 0x8C79\r\n#define GL_CLIP_DISTANCE_NV 0x8C7A\r\n#define GL_VERTEX_ID_NV 0x8C7B\r\n#define GL_PRIMITIVE_ID_NV 0x8C7C\r\n#define GL_GENERIC_ATTRIB_NV 0x8C7D\r\n#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80\r\n#define GL_ACTIVE_VARYINGS_NV 0x8C81\r\n#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82\r\n#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85\r\n#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86\r\n#define GL_PRIMITIVES_GENERATED_NV 0x8C87\r\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88\r\n#define GL_RASTERIZER_DISCARD_NV 0x8C89\r\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B\r\n#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C\r\n#define GL_SEPARATE_ATTRIBS_NV 0x8C8D\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\r\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);\r\ntypedef GLint (GLAPIENTRY * PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);\r\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);\r\ntypedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);\r\n\r\n#define glActiveVaryingNV GLEW_GET_FUN(__glewActiveVaryingNV)\r\n#define glBeginTransformFeedbackNV GLEW_GET_FUN(__glewBeginTransformFeedbackNV)\r\n#define glBindBufferBaseNV GLEW_GET_FUN(__glewBindBufferBaseNV)\r\n#define glBindBufferOffsetNV GLEW_GET_FUN(__glewBindBufferOffsetNV)\r\n#define glBindBufferRangeNV GLEW_GET_FUN(__glewBindBufferRangeNV)\r\n#define glEndTransformFeedbackNV GLEW_GET_FUN(__glewEndTransformFeedbackNV)\r\n#define glGetActiveVaryingNV GLEW_GET_FUN(__glewGetActiveVaryingNV)\r\n#define glGetTransformFeedbackVaryingNV GLEW_GET_FUN(__glewGetTransformFeedbackVaryingNV)\r\n#define glGetVaryingLocationNV GLEW_GET_FUN(__glewGetVaryingLocationNV)\r\n#define glTransformFeedbackAttribsNV GLEW_GET_FUN(__glewTransformFeedbackAttribsNV)\r\n#define glTransformFeedbackVaryingsNV GLEW_GET_FUN(__glewTransformFeedbackVaryingsNV)\r\n\r\n#define GLEW_NV_transform_feedback GLEW_GET_VAR(__GLEW_NV_transform_feedback)\r\n\r\n#endif /* GL_NV_transform_feedback */\r\n\r\n/* ----------------------- GL_NV_transform_feedback2 ----------------------- */\r\n\r\n#ifndef GL_NV_transform_feedback2\r\n#define GL_NV_transform_feedback2 1\r\n\r\n#define GL_TRANSFORM_FEEDBACK_NV 0x8E22\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24\r\n#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint* ids);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);\r\n\r\n#define glBindTransformFeedbackNV GLEW_GET_FUN(__glewBindTransformFeedbackNV)\r\n#define glDeleteTransformFeedbacksNV GLEW_GET_FUN(__glewDeleteTransformFeedbacksNV)\r\n#define glDrawTransformFeedbackNV GLEW_GET_FUN(__glewDrawTransformFeedbackNV)\r\n#define glGenTransformFeedbacksNV GLEW_GET_FUN(__glewGenTransformFeedbacksNV)\r\n#define glIsTransformFeedbackNV GLEW_GET_FUN(__glewIsTransformFeedbackNV)\r\n#define glPauseTransformFeedbackNV GLEW_GET_FUN(__glewPauseTransformFeedbackNV)\r\n#define glResumeTransformFeedbackNV GLEW_GET_FUN(__glewResumeTransformFeedbackNV)\r\n\r\n#define GLEW_NV_transform_feedback2 GLEW_GET_VAR(__GLEW_NV_transform_feedback2)\r\n\r\n#endif /* GL_NV_transform_feedback2 */\r\n\r\n/* -------------------------- GL_NV_vdpau_interop -------------------------- */\r\n\r\n#ifndef GL_NV_vdpau_interop\r\n#define GL_NV_vdpau_interop 1\r\n\r\n#define GL_SURFACE_STATE_NV 0x86EB\r\n#define GL_SURFACE_REGISTERED_NV 0x86FD\r\n#define GL_SURFACE_MAPPED_NV 0x8700\r\n#define GL_WRITE_DISCARD_NV 0x88BE\r\n\r\ntypedef GLintptr GLvdpauSurfaceNV;\r\n\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUFININVPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei* length, GLint *values);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUINITNVPROC) (const void* vdpDevice, const GLvoid*getProcAddress);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV* surfaces);\r\ntypedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\r\ntypedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV* surfaces);\r\ntypedef void (GLAPIENTRY * PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);\r\n\r\n#define glVDPAUFiniNV GLEW_GET_FUN(__glewVDPAUFiniNV)\r\n#define glVDPAUGetSurfaceivNV GLEW_GET_FUN(__glewVDPAUGetSurfaceivNV)\r\n#define glVDPAUInitNV GLEW_GET_FUN(__glewVDPAUInitNV)\r\n#define glVDPAUIsSurfaceNV GLEW_GET_FUN(__glewVDPAUIsSurfaceNV)\r\n#define glVDPAUMapSurfacesNV GLEW_GET_FUN(__glewVDPAUMapSurfacesNV)\r\n#define glVDPAURegisterOutputSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterOutputSurfaceNV)\r\n#define glVDPAURegisterVideoSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterVideoSurfaceNV)\r\n#define glVDPAUSurfaceAccessNV GLEW_GET_FUN(__glewVDPAUSurfaceAccessNV)\r\n#define glVDPAUUnmapSurfacesNV GLEW_GET_FUN(__glewVDPAUUnmapSurfacesNV)\r\n#define glVDPAUUnregisterSurfaceNV GLEW_GET_FUN(__glewVDPAUUnregisterSurfaceNV)\r\n\r\n#define GLEW_NV_vdpau_interop GLEW_GET_VAR(__GLEW_NV_vdpau_interop)\r\n\r\n#endif /* GL_NV_vdpau_interop */\r\n\r\n/* ------------------------ GL_NV_vertex_array_range ----------------------- */\r\n\r\n#ifndef GL_NV_vertex_array_range\r\n#define GL_NV_vertex_array_range 1\r\n\r\n#define GL_VERTEX_ARRAY_RANGE_NV 0x851D\r\n#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E\r\n#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F\r\n#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520\r\n#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, void* pointer);\r\n\r\n#define glFlushVertexArrayRangeNV GLEW_GET_FUN(__glewFlushVertexArrayRangeNV)\r\n#define glVertexArrayRangeNV GLEW_GET_FUN(__glewVertexArrayRangeNV)\r\n\r\n#define GLEW_NV_vertex_array_range GLEW_GET_VAR(__GLEW_NV_vertex_array_range)\r\n\r\n#endif /* GL_NV_vertex_array_range */\r\n\r\n/* ----------------------- GL_NV_vertex_array_range2 ----------------------- */\r\n\r\n#ifndef GL_NV_vertex_array_range2\r\n#define GL_NV_vertex_array_range2 1\r\n\r\n#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533\r\n\r\n#define GLEW_NV_vertex_array_range2 GLEW_GET_VAR(__GLEW_NV_vertex_array_range2)\r\n\r\n#endif /* GL_NV_vertex_array_range2 */\r\n\r\n/* ------------------- GL_NV_vertex_attrib_integer_64bit ------------------- */\r\n\r\n#ifndef GL_NV_vertex_attrib_integer_64bit\r\n#define GL_NV_vertex_attrib_integer_64bit 1\r\n\r\n#define GL_INT64_NV 0x140E\r\n#define GL_UNSIGNED_INT64_NV 0x140F\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT* params);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);\r\n\r\n#define glGetVertexAttribLi64vNV GLEW_GET_FUN(__glewGetVertexAttribLi64vNV)\r\n#define glGetVertexAttribLui64vNV GLEW_GET_FUN(__glewGetVertexAttribLui64vNV)\r\n#define glVertexAttribL1i64NV GLEW_GET_FUN(__glewVertexAttribL1i64NV)\r\n#define glVertexAttribL1i64vNV GLEW_GET_FUN(__glewVertexAttribL1i64vNV)\r\n#define glVertexAttribL1ui64NV GLEW_GET_FUN(__glewVertexAttribL1ui64NV)\r\n#define glVertexAttribL1ui64vNV GLEW_GET_FUN(__glewVertexAttribL1ui64vNV)\r\n#define glVertexAttribL2i64NV GLEW_GET_FUN(__glewVertexAttribL2i64NV)\r\n#define glVertexAttribL2i64vNV GLEW_GET_FUN(__glewVertexAttribL2i64vNV)\r\n#define glVertexAttribL2ui64NV GLEW_GET_FUN(__glewVertexAttribL2ui64NV)\r\n#define glVertexAttribL2ui64vNV GLEW_GET_FUN(__glewVertexAttribL2ui64vNV)\r\n#define glVertexAttribL3i64NV GLEW_GET_FUN(__glewVertexAttribL3i64NV)\r\n#define glVertexAttribL3i64vNV GLEW_GET_FUN(__glewVertexAttribL3i64vNV)\r\n#define glVertexAttribL3ui64NV GLEW_GET_FUN(__glewVertexAttribL3ui64NV)\r\n#define glVertexAttribL3ui64vNV GLEW_GET_FUN(__glewVertexAttribL3ui64vNV)\r\n#define glVertexAttribL4i64NV GLEW_GET_FUN(__glewVertexAttribL4i64NV)\r\n#define glVertexAttribL4i64vNV GLEW_GET_FUN(__glewVertexAttribL4i64vNV)\r\n#define glVertexAttribL4ui64NV GLEW_GET_FUN(__glewVertexAttribL4ui64NV)\r\n#define glVertexAttribL4ui64vNV GLEW_GET_FUN(__glewVertexAttribL4ui64vNV)\r\n#define glVertexAttribLFormatNV GLEW_GET_FUN(__glewVertexAttribLFormatNV)\r\n\r\n#define GLEW_NV_vertex_attrib_integer_64bit GLEW_GET_VAR(__GLEW_NV_vertex_attrib_integer_64bit)\r\n\r\n#endif /* GL_NV_vertex_attrib_integer_64bit */\r\n\r\n/* ------------------- GL_NV_vertex_buffer_unified_memory ------------------ */\r\n\r\n#ifndef GL_NV_vertex_buffer_unified_memory\r\n#define GL_NV_vertex_buffer_unified_memory 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E\r\n#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F\r\n#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20\r\n#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21\r\n#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22\r\n#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23\r\n#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24\r\n#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25\r\n#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26\r\n#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27\r\n#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28\r\n#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29\r\n#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A\r\n#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B\r\n#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C\r\n#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D\r\n#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E\r\n#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F\r\n#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30\r\n#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31\r\n#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32\r\n#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33\r\n#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40\r\n#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41\r\n#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT result[]);\r\ntypedef void (GLAPIENTRY * PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\n\r\n#define glBufferAddressRangeNV GLEW_GET_FUN(__glewBufferAddressRangeNV)\r\n#define glColorFormatNV GLEW_GET_FUN(__glewColorFormatNV)\r\n#define glEdgeFlagFormatNV GLEW_GET_FUN(__glewEdgeFlagFormatNV)\r\n#define glFogCoordFormatNV GLEW_GET_FUN(__glewFogCoordFormatNV)\r\n#define glGetIntegerui64i_vNV GLEW_GET_FUN(__glewGetIntegerui64i_vNV)\r\n#define glIndexFormatNV GLEW_GET_FUN(__glewIndexFormatNV)\r\n#define glNormalFormatNV GLEW_GET_FUN(__glewNormalFormatNV)\r\n#define glSecondaryColorFormatNV GLEW_GET_FUN(__glewSecondaryColorFormatNV)\r\n#define glTexCoordFormatNV GLEW_GET_FUN(__glewTexCoordFormatNV)\r\n#define glVertexAttribFormatNV GLEW_GET_FUN(__glewVertexAttribFormatNV)\r\n#define glVertexAttribIFormatNV GLEW_GET_FUN(__glewVertexAttribIFormatNV)\r\n#define glVertexFormatNV GLEW_GET_FUN(__glewVertexFormatNV)\r\n\r\n#define GLEW_NV_vertex_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_vertex_buffer_unified_memory)\r\n\r\n#endif /* GL_NV_vertex_buffer_unified_memory */\r\n\r\n/* -------------------------- GL_NV_vertex_program ------------------------- */\r\n\r\n#ifndef GL_NV_vertex_program\r\n#define GL_NV_vertex_program 1\r\n\r\n#define GL_VERTEX_PROGRAM_NV 0x8620\r\n#define GL_VERTEX_STATE_PROGRAM_NV 0x8621\r\n#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623\r\n#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624\r\n#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625\r\n#define GL_CURRENT_ATTRIB_NV 0x8626\r\n#define GL_PROGRAM_LENGTH_NV 0x8627\r\n#define GL_PROGRAM_STRING_NV 0x8628\r\n#define GL_MODELVIEW_PROJECTION_NV 0x8629\r\n#define GL_IDENTITY_NV 0x862A\r\n#define GL_INVERSE_NV 0x862B\r\n#define GL_TRANSPOSE_NV 0x862C\r\n#define GL_INVERSE_TRANSPOSE_NV 0x862D\r\n#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E\r\n#define GL_MAX_TRACK_MATRICES_NV 0x862F\r\n#define GL_MATRIX0_NV 0x8630\r\n#define GL_MATRIX1_NV 0x8631\r\n#define GL_MATRIX2_NV 0x8632\r\n#define GL_MATRIX3_NV 0x8633\r\n#define GL_MATRIX4_NV 0x8634\r\n#define GL_MATRIX5_NV 0x8635\r\n#define GL_MATRIX6_NV 0x8636\r\n#define GL_MATRIX7_NV 0x8637\r\n#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640\r\n#define GL_CURRENT_MATRIX_NV 0x8641\r\n#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642\r\n#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643\r\n#define GL_PROGRAM_PARAMETER_NV 0x8644\r\n#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645\r\n#define GL_PROGRAM_TARGET_NV 0x8646\r\n#define GL_PROGRAM_RESIDENT_NV 0x8647\r\n#define GL_TRACK_MATRIX_NV 0x8648\r\n#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649\r\n#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A\r\n#define GL_PROGRAM_ERROR_POSITION_NV 0x864B\r\n#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650\r\n#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651\r\n#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652\r\n#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653\r\n#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654\r\n#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655\r\n#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656\r\n#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657\r\n#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658\r\n#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659\r\n#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A\r\n#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B\r\n#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C\r\n#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D\r\n#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E\r\n#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F\r\n#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660\r\n#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661\r\n#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662\r\n#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663\r\n#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664\r\n#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665\r\n#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666\r\n#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667\r\n#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668\r\n#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669\r\n#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A\r\n#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B\r\n#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C\r\n#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D\r\n#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E\r\n#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F\r\n#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670\r\n#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671\r\n#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672\r\n#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673\r\n#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674\r\n#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675\r\n#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676\r\n#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677\r\n#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678\r\n#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679\r\n#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A\r\n#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B\r\n#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C\r\n#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D\r\n#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E\r\n#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F\r\n\r\ntypedef GLboolean (GLAPIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint* ids, GLboolean *residences);\r\ntypedef void (GLAPIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte* program);\r\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid** pointer);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint* params);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id);\r\ntypedef void (GLAPIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte* program);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, GLuint* ids);\r\ntypedef void (GLAPIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);\r\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei n, const GLubyte* v);\r\n\r\n#define glAreProgramsResidentNV GLEW_GET_FUN(__glewAreProgramsResidentNV)\r\n#define glBindProgramNV GLEW_GET_FUN(__glewBindProgramNV)\r\n#define glDeleteProgramsNV GLEW_GET_FUN(__glewDeleteProgramsNV)\r\n#define glExecuteProgramNV GLEW_GET_FUN(__glewExecuteProgramNV)\r\n#define glGenProgramsNV GLEW_GET_FUN(__glewGenProgramsNV)\r\n#define glGetProgramParameterdvNV GLEW_GET_FUN(__glewGetProgramParameterdvNV)\r\n#define glGetProgramParameterfvNV GLEW_GET_FUN(__glewGetProgramParameterfvNV)\r\n#define glGetProgramStringNV GLEW_GET_FUN(__glewGetProgramStringNV)\r\n#define glGetProgramivNV GLEW_GET_FUN(__glewGetProgramivNV)\r\n#define glGetTrackMatrixivNV GLEW_GET_FUN(__glewGetTrackMatrixivNV)\r\n#define glGetVertexAttribPointervNV GLEW_GET_FUN(__glewGetVertexAttribPointervNV)\r\n#define glGetVertexAttribdvNV GLEW_GET_FUN(__glewGetVertexAttribdvNV)\r\n#define glGetVertexAttribfvNV GLEW_GET_FUN(__glewGetVertexAttribfvNV)\r\n#define glGetVertexAttribivNV GLEW_GET_FUN(__glewGetVertexAttribivNV)\r\n#define glIsProgramNV GLEW_GET_FUN(__glewIsProgramNV)\r\n#define glLoadProgramNV GLEW_GET_FUN(__glewLoadProgramNV)\r\n#define glProgramParameter4dNV GLEW_GET_FUN(__glewProgramParameter4dNV)\r\n#define glProgramParameter4dvNV GLEW_GET_FUN(__glewProgramParameter4dvNV)\r\n#define glProgramParameter4fNV GLEW_GET_FUN(__glewProgramParameter4fNV)\r\n#define glProgramParameter4fvNV GLEW_GET_FUN(__glewProgramParameter4fvNV)\r\n#define glProgramParameters4dvNV GLEW_GET_FUN(__glewProgramParameters4dvNV)\r\n#define glProgramParameters4fvNV GLEW_GET_FUN(__glewProgramParameters4fvNV)\r\n#define glRequestResidentProgramsNV GLEW_GET_FUN(__glewRequestResidentProgramsNV)\r\n#define glTrackMatrixNV GLEW_GET_FUN(__glewTrackMatrixNV)\r\n#define glVertexAttrib1dNV GLEW_GET_FUN(__glewVertexAttrib1dNV)\r\n#define glVertexAttrib1dvNV GLEW_GET_FUN(__glewVertexAttrib1dvNV)\r\n#define glVertexAttrib1fNV GLEW_GET_FUN(__glewVertexAttrib1fNV)\r\n#define glVertexAttrib1fvNV GLEW_GET_FUN(__glewVertexAttrib1fvNV)\r\n#define glVertexAttrib1sNV GLEW_GET_FUN(__glewVertexAttrib1sNV)\r\n#define glVertexAttrib1svNV GLEW_GET_FUN(__glewVertexAttrib1svNV)\r\n#define glVertexAttrib2dNV GLEW_GET_FUN(__glewVertexAttrib2dNV)\r\n#define glVertexAttrib2dvNV GLEW_GET_FUN(__glewVertexAttrib2dvNV)\r\n#define glVertexAttrib2fNV GLEW_GET_FUN(__glewVertexAttrib2fNV)\r\n#define glVertexAttrib2fvNV GLEW_GET_FUN(__glewVertexAttrib2fvNV)\r\n#define glVertexAttrib2sNV GLEW_GET_FUN(__glewVertexAttrib2sNV)\r\n#define glVertexAttrib2svNV GLEW_GET_FUN(__glewVertexAttrib2svNV)\r\n#define glVertexAttrib3dNV GLEW_GET_FUN(__glewVertexAttrib3dNV)\r\n#define glVertexAttrib3dvNV GLEW_GET_FUN(__glewVertexAttrib3dvNV)\r\n#define glVertexAttrib3fNV GLEW_GET_FUN(__glewVertexAttrib3fNV)\r\n#define glVertexAttrib3fvNV GLEW_GET_FUN(__glewVertexAttrib3fvNV)\r\n#define glVertexAttrib3sNV GLEW_GET_FUN(__glewVertexAttrib3sNV)\r\n#define glVertexAttrib3svNV GLEW_GET_FUN(__glewVertexAttrib3svNV)\r\n#define glVertexAttrib4dNV GLEW_GET_FUN(__glewVertexAttrib4dNV)\r\n#define glVertexAttrib4dvNV GLEW_GET_FUN(__glewVertexAttrib4dvNV)\r\n#define glVertexAttrib4fNV GLEW_GET_FUN(__glewVertexAttrib4fNV)\r\n#define glVertexAttrib4fvNV GLEW_GET_FUN(__glewVertexAttrib4fvNV)\r\n#define glVertexAttrib4sNV GLEW_GET_FUN(__glewVertexAttrib4sNV)\r\n#define glVertexAttrib4svNV GLEW_GET_FUN(__glewVertexAttrib4svNV)\r\n#define glVertexAttrib4ubNV GLEW_GET_FUN(__glewVertexAttrib4ubNV)\r\n#define glVertexAttrib4ubvNV GLEW_GET_FUN(__glewVertexAttrib4ubvNV)\r\n#define glVertexAttribPointerNV GLEW_GET_FUN(__glewVertexAttribPointerNV)\r\n#define glVertexAttribs1dvNV GLEW_GET_FUN(__glewVertexAttribs1dvNV)\r\n#define glVertexAttribs1fvNV GLEW_GET_FUN(__glewVertexAttribs1fvNV)\r\n#define glVertexAttribs1svNV GLEW_GET_FUN(__glewVertexAttribs1svNV)\r\n#define glVertexAttribs2dvNV GLEW_GET_FUN(__glewVertexAttribs2dvNV)\r\n#define glVertexAttribs2fvNV GLEW_GET_FUN(__glewVertexAttribs2fvNV)\r\n#define glVertexAttribs2svNV GLEW_GET_FUN(__glewVertexAttribs2svNV)\r\n#define glVertexAttribs3dvNV GLEW_GET_FUN(__glewVertexAttribs3dvNV)\r\n#define glVertexAttribs3fvNV GLEW_GET_FUN(__glewVertexAttribs3fvNV)\r\n#define glVertexAttribs3svNV GLEW_GET_FUN(__glewVertexAttribs3svNV)\r\n#define glVertexAttribs4dvNV GLEW_GET_FUN(__glewVertexAttribs4dvNV)\r\n#define glVertexAttribs4fvNV GLEW_GET_FUN(__glewVertexAttribs4fvNV)\r\n#define glVertexAttribs4svNV GLEW_GET_FUN(__glewVertexAttribs4svNV)\r\n#define glVertexAttribs4ubvNV GLEW_GET_FUN(__glewVertexAttribs4ubvNV)\r\n\r\n#define GLEW_NV_vertex_program GLEW_GET_VAR(__GLEW_NV_vertex_program)\r\n\r\n#endif /* GL_NV_vertex_program */\r\n\r\n/* ------------------------ GL_NV_vertex_program1_1 ------------------------ */\r\n\r\n#ifndef GL_NV_vertex_program1_1\r\n#define GL_NV_vertex_program1_1 1\r\n\r\n#define GLEW_NV_vertex_program1_1 GLEW_GET_VAR(__GLEW_NV_vertex_program1_1)\r\n\r\n#endif /* GL_NV_vertex_program1_1 */\r\n\r\n/* ------------------------- GL_NV_vertex_program2 ------------------------- */\r\n\r\n#ifndef GL_NV_vertex_program2\r\n#define GL_NV_vertex_program2 1\r\n\r\n#define GLEW_NV_vertex_program2 GLEW_GET_VAR(__GLEW_NV_vertex_program2)\r\n\r\n#endif /* GL_NV_vertex_program2 */\r\n\r\n/* ---------------------- GL_NV_vertex_program2_option --------------------- */\r\n\r\n#ifndef GL_NV_vertex_program2_option\r\n#define GL_NV_vertex_program2_option 1\r\n\r\n#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4\r\n#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5\r\n\r\n#define GLEW_NV_vertex_program2_option GLEW_GET_VAR(__GLEW_NV_vertex_program2_option)\r\n\r\n#endif /* GL_NV_vertex_program2_option */\r\n\r\n/* ------------------------- GL_NV_vertex_program3 ------------------------- */\r\n\r\n#ifndef GL_NV_vertex_program3\r\n#define GL_NV_vertex_program3 1\r\n\r\n#define MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C\r\n\r\n#define GLEW_NV_vertex_program3 GLEW_GET_VAR(__GLEW_NV_vertex_program3)\r\n\r\n#endif /* GL_NV_vertex_program3 */\r\n\r\n/* ------------------------- GL_NV_vertex_program4 ------------------------- */\r\n\r\n#ifndef GL_NV_vertex_program4\r\n#define GL_NV_vertex_program4 1\r\n\r\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD\r\n\r\n#define GLEW_NV_vertex_program4 GLEW_GET_VAR(__GLEW_NV_vertex_program4)\r\n\r\n#endif /* GL_NV_vertex_program4 */\r\n\r\n/* -------------------------- GL_NV_video_capture -------------------------- */\r\n\r\n#ifndef GL_NV_video_capture\r\n#define GL_NV_video_capture 1\r\n\r\n#define GL_VIDEO_BUFFER_NV 0x9020\r\n#define GL_VIDEO_BUFFER_BINDING_NV 0x9021\r\n#define GL_FIELD_UPPER_NV 0x9022\r\n#define GL_FIELD_LOWER_NV 0x9023\r\n#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024\r\n#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025\r\n#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026\r\n#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027\r\n#define GL_VIDEO_BUFFER_PITCH_NV 0x9028\r\n#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029\r\n#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A\r\n#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B\r\n#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C\r\n#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D\r\n#define GL_PARTIAL_SUCCESS_NV 0x902E\r\n#define GL_SUCCESS_NV 0x902F\r\n#define GL_FAILURE_NV 0x9030\r\n#define GL_YCBYCR8_422_NV 0x9031\r\n#define GL_YCBAYCR8A_4224_NV 0x9032\r\n#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033\r\n#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034\r\n#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035\r\n#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036\r\n#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037\r\n#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038\r\n#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039\r\n#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A\r\n#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B\r\n#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C\r\n\r\ntypedef void (GLAPIENTRY * PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);\r\ntypedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);\r\ntypedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);\r\ntypedef void (GLAPIENTRY * PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint* params);\r\ntypedef GLenum (GLAPIENTRY * PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT *capture_time);\r\ntypedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params);\r\ntypedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params);\r\n\r\n#define glBeginVideoCaptureNV GLEW_GET_FUN(__glewBeginVideoCaptureNV)\r\n#define glBindVideoCaptureStreamBufferNV GLEW_GET_FUN(__glewBindVideoCaptureStreamBufferNV)\r\n#define glBindVideoCaptureStreamTextureNV GLEW_GET_FUN(__glewBindVideoCaptureStreamTextureNV)\r\n#define glEndVideoCaptureNV GLEW_GET_FUN(__glewEndVideoCaptureNV)\r\n#define glGetVideoCaptureStreamdvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamdvNV)\r\n#define glGetVideoCaptureStreamfvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamfvNV)\r\n#define glGetVideoCaptureStreamivNV GLEW_GET_FUN(__glewGetVideoCaptureStreamivNV)\r\n#define glGetVideoCaptureivNV GLEW_GET_FUN(__glewGetVideoCaptureivNV)\r\n#define glVideoCaptureNV GLEW_GET_FUN(__glewVideoCaptureNV)\r\n#define glVideoCaptureStreamParameterdvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterdvNV)\r\n#define glVideoCaptureStreamParameterfvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterfvNV)\r\n#define glVideoCaptureStreamParameterivNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterivNV)\r\n\r\n#define GLEW_NV_video_capture GLEW_GET_VAR(__GLEW_NV_video_capture)\r\n\r\n#endif /* GL_NV_video_capture */\r\n\r\n/* ------------------------ GL_OES_byte_coordinates ------------------------ */\r\n\r\n#ifndef GL_OES_byte_coordinates\r\n#define GL_OES_byte_coordinates 1\r\n\r\n#define GL_BYTE 0x1400\r\n\r\n#define GLEW_OES_byte_coordinates GLEW_GET_VAR(__GLEW_OES_byte_coordinates)\r\n\r\n#endif /* GL_OES_byte_coordinates */\r\n\r\n/* ------------------- GL_OES_compressed_paletted_texture ------------------ */\r\n\r\n#ifndef GL_OES_compressed_paletted_texture\r\n#define GL_OES_compressed_paletted_texture 1\r\n\r\n#define GL_PALETTE4_RGB8_OES 0x8B90\r\n#define GL_PALETTE4_RGBA8_OES 0x8B91\r\n#define GL_PALETTE4_R5_G6_B5_OES 0x8B92\r\n#define GL_PALETTE4_RGBA4_OES 0x8B93\r\n#define GL_PALETTE4_RGB5_A1_OES 0x8B94\r\n#define GL_PALETTE8_RGB8_OES 0x8B95\r\n#define GL_PALETTE8_RGBA8_OES 0x8B96\r\n#define GL_PALETTE8_R5_G6_B5_OES 0x8B97\r\n#define GL_PALETTE8_RGBA4_OES 0x8B98\r\n#define GL_PALETTE8_RGB5_A1_OES 0x8B99\r\n\r\n#define GLEW_OES_compressed_paletted_texture GLEW_GET_VAR(__GLEW_OES_compressed_paletted_texture)\r\n\r\n#endif /* GL_OES_compressed_paletted_texture */\r\n\r\n/* --------------------------- GL_OES_read_format -------------------------- */\r\n\r\n#ifndef GL_OES_read_format\r\n#define GL_OES_read_format 1\r\n\r\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A\r\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B\r\n\r\n#define GLEW_OES_read_format GLEW_GET_VAR(__GLEW_OES_read_format)\r\n\r\n#endif /* GL_OES_read_format */\r\n\r\n/* ------------------------ GL_OES_single_precision ------------------------ */\r\n\r\n#ifndef GL_OES_single_precision\r\n#define GL_OES_single_precision 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCLEARDEPTHFOESPROC) (GLclampd depth);\r\ntypedef void (GLAPIENTRY * PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat* equation);\r\ntypedef void (GLAPIENTRY * PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);\r\ntypedef void (GLAPIENTRY * PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\r\ntypedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat* equation);\r\ntypedef void (GLAPIENTRY * PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\r\n\r\n#define glClearDepthfOES GLEW_GET_FUN(__glewClearDepthfOES)\r\n#define glClipPlanefOES GLEW_GET_FUN(__glewClipPlanefOES)\r\n#define glDepthRangefOES GLEW_GET_FUN(__glewDepthRangefOES)\r\n#define glFrustumfOES GLEW_GET_FUN(__glewFrustumfOES)\r\n#define glGetClipPlanefOES GLEW_GET_FUN(__glewGetClipPlanefOES)\r\n#define glOrthofOES GLEW_GET_FUN(__glewOrthofOES)\r\n\r\n#define GLEW_OES_single_precision GLEW_GET_VAR(__GLEW_OES_single_precision)\r\n\r\n#endif /* GL_OES_single_precision */\r\n\r\n/* ---------------------------- GL_OML_interlace --------------------------- */\r\n\r\n#ifndef GL_OML_interlace\r\n#define GL_OML_interlace 1\r\n\r\n#define GL_INTERLACE_OML 0x8980\r\n#define GL_INTERLACE_READ_OML 0x8981\r\n\r\n#define GLEW_OML_interlace GLEW_GET_VAR(__GLEW_OML_interlace)\r\n\r\n#endif /* GL_OML_interlace */\r\n\r\n/* ---------------------------- GL_OML_resample ---------------------------- */\r\n\r\n#ifndef GL_OML_resample\r\n#define GL_OML_resample 1\r\n\r\n#define GL_PACK_RESAMPLE_OML 0x8984\r\n#define GL_UNPACK_RESAMPLE_OML 0x8985\r\n#define GL_RESAMPLE_REPLICATE_OML 0x8986\r\n#define GL_RESAMPLE_ZERO_FILL_OML 0x8987\r\n#define GL_RESAMPLE_AVERAGE_OML 0x8988\r\n#define GL_RESAMPLE_DECIMATE_OML 0x8989\r\n\r\n#define GLEW_OML_resample GLEW_GET_VAR(__GLEW_OML_resample)\r\n\r\n#endif /* GL_OML_resample */\r\n\r\n/* ---------------------------- GL_OML_subsample --------------------------- */\r\n\r\n#ifndef GL_OML_subsample\r\n#define GL_OML_subsample 1\r\n\r\n#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982\r\n#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983\r\n\r\n#define GLEW_OML_subsample GLEW_GET_VAR(__GLEW_OML_subsample)\r\n\r\n#endif /* GL_OML_subsample */\r\n\r\n/* --------------------------- GL_PGI_misc_hints --------------------------- */\r\n\r\n#ifndef GL_PGI_misc_hints\r\n#define GL_PGI_misc_hints 1\r\n\r\n#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000\r\n#define GL_CONSERVE_MEMORY_HINT_PGI 107005\r\n#define GL_RECLAIM_MEMORY_HINT_PGI 107006\r\n#define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010\r\n#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011\r\n#define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012\r\n#define GL_ALWAYS_FAST_HINT_PGI 107020\r\n#define GL_ALWAYS_SOFT_HINT_PGI 107021\r\n#define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022\r\n#define GL_ALLOW_DRAW_WIN_HINT_PGI 107023\r\n#define GL_ALLOW_DRAW_FRG_HINT_PGI 107024\r\n#define GL_ALLOW_DRAW_MEM_HINT_PGI 107025\r\n#define GL_STRICT_DEPTHFUNC_HINT_PGI 107030\r\n#define GL_STRICT_LIGHTING_HINT_PGI 107031\r\n#define GL_STRICT_SCISSOR_HINT_PGI 107032\r\n#define GL_FULL_STIPPLE_HINT_PGI 107033\r\n#define GL_CLIP_NEAR_HINT_PGI 107040\r\n#define GL_CLIP_FAR_HINT_PGI 107041\r\n#define GL_WIDE_LINE_HINT_PGI 107042\r\n#define GL_BACK_NORMALS_HINT_PGI 107043\r\n\r\n#define GLEW_PGI_misc_hints GLEW_GET_VAR(__GLEW_PGI_misc_hints)\r\n\r\n#endif /* GL_PGI_misc_hints */\r\n\r\n/* -------------------------- GL_PGI_vertex_hints -------------------------- */\r\n\r\n#ifndef GL_PGI_vertex_hints\r\n#define GL_PGI_vertex_hints 1\r\n\r\n#define GL_VERTEX23_BIT_PGI 0x00000004\r\n#define GL_VERTEX4_BIT_PGI 0x00000008\r\n#define GL_COLOR3_BIT_PGI 0x00010000\r\n#define GL_COLOR4_BIT_PGI 0x00020000\r\n#define GL_EDGEFLAG_BIT_PGI 0x00040000\r\n#define GL_INDEX_BIT_PGI 0x00080000\r\n#define GL_MAT_AMBIENT_BIT_PGI 0x00100000\r\n#define GL_VERTEX_DATA_HINT_PGI 107050\r\n#define GL_VERTEX_CONSISTENT_HINT_PGI 107051\r\n#define GL_MATERIAL_SIDE_HINT_PGI 107052\r\n#define GL_MAX_VERTEX_HINT_PGI 107053\r\n#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000\r\n#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000\r\n#define GL_MAT_EMISSION_BIT_PGI 0x00800000\r\n#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000\r\n#define GL_MAT_SHININESS_BIT_PGI 0x02000000\r\n#define GL_MAT_SPECULAR_BIT_PGI 0x04000000\r\n#define GL_NORMAL_BIT_PGI 0x08000000\r\n#define GL_TEXCOORD1_BIT_PGI 0x10000000\r\n#define GL_TEXCOORD2_BIT_PGI 0x20000000\r\n#define GL_TEXCOORD3_BIT_PGI 0x40000000\r\n#define GL_TEXCOORD4_BIT_PGI 0x80000000\r\n\r\n#define GLEW_PGI_vertex_hints GLEW_GET_VAR(__GLEW_PGI_vertex_hints)\r\n\r\n#endif /* GL_PGI_vertex_hints */\r\n\r\n/* ------------------------- GL_REGAL_error_string ------------------------- */\r\n\r\n#ifndef GL_REGAL_error_string\r\n#define GL_REGAL_error_string 1\r\n\r\ntypedef const GLchar* (GLAPIENTRY * PFNGLERRORSTRINGREGALPROC) (GLenum error);\r\n\r\n#define glErrorStringREGAL GLEW_GET_FUN(__glewErrorStringREGAL)\r\n\r\n#define GLEW_REGAL_error_string GLEW_GET_VAR(__GLEW_REGAL_error_string)\r\n\r\n#endif /* GL_REGAL_error_string */\r\n\r\n/* ------------------------ GL_REGAL_extension_query ----------------------- */\r\n\r\n#ifndef GL_REGAL_extension_query\r\n#define GL_REGAL_extension_query 1\r\n\r\ntypedef GLboolean (GLAPIENTRY * PFNGLGETEXTENSIONREGALPROC) (const GLchar* ext);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISSUPPORTEDREGALPROC) (const GLchar* ext);\r\n\r\n#define glGetExtensionREGAL GLEW_GET_FUN(__glewGetExtensionREGAL)\r\n#define glIsSupportedREGAL GLEW_GET_FUN(__glewIsSupportedREGAL)\r\n\r\n#define GLEW_REGAL_extension_query GLEW_GET_VAR(__GLEW_REGAL_extension_query)\r\n\r\n#endif /* GL_REGAL_extension_query */\r\n\r\n/* ------------------------------ GL_REGAL_log ----------------------------- */\r\n\r\n#ifndef GL_REGAL_log\r\n#define GL_REGAL_log 1\r\n\r\n#define GL_LOG_ERROR_REGAL 0x9319\r\n#define GL_LOG_WARNING_REGAL 0x931A\r\n#define GL_LOG_INFO_REGAL 0x931B\r\n#define GL_LOG_APP_REGAL 0x931C\r\n#define GL_LOG_DRIVER_REGAL 0x931D\r\n#define GL_LOG_INTERNAL_REGAL 0x931E\r\n#define GL_LOG_DEBUG_REGAL 0x931F\r\n#define GL_LOG_STATUS_REGAL 0x9320\r\n#define GL_LOG_HTTP_REGAL 0x9321\r\n\r\n#define GLEW_REGAL_log GLEW_GET_VAR(__GLEW_REGAL_log)\r\n\r\n#endif /* GL_REGAL_log */\r\n\r\n/* ----------------------- GL_REND_screen_coordinates ---------------------- */\r\n\r\n#ifndef GL_REND_screen_coordinates\r\n#define GL_REND_screen_coordinates 1\r\n\r\n#define GL_SCREEN_COORDINATES_REND 0x8490\r\n#define GL_INVERTED_SCREEN_W_REND 0x8491\r\n\r\n#define GLEW_REND_screen_coordinates GLEW_GET_VAR(__GLEW_REND_screen_coordinates)\r\n\r\n#endif /* GL_REND_screen_coordinates */\r\n\r\n/* ------------------------------- GL_S3_s3tc ------------------------------ */\r\n\r\n#ifndef GL_S3_s3tc\r\n#define GL_S3_s3tc 1\r\n\r\n#define GL_RGB_S3TC 0x83A0\r\n#define GL_RGB4_S3TC 0x83A1\r\n#define GL_RGBA_S3TC 0x83A2\r\n#define GL_RGBA4_S3TC 0x83A3\r\n#define GL_RGBA_DXT5_S3TC 0x83A4\r\n#define GL_RGBA4_DXT5_S3TC 0x83A5\r\n\r\n#define GLEW_S3_s3tc GLEW_GET_VAR(__GLEW_S3_s3tc)\r\n\r\n#endif /* GL_S3_s3tc */\r\n\r\n/* -------------------------- GL_SGIS_color_range -------------------------- */\r\n\r\n#ifndef GL_SGIS_color_range\r\n#define GL_SGIS_color_range 1\r\n\r\n#define GL_EXTENDED_RANGE_SGIS 0x85A5\r\n#define GL_MIN_RED_SGIS 0x85A6\r\n#define GL_MAX_RED_SGIS 0x85A7\r\n#define GL_MIN_GREEN_SGIS 0x85A8\r\n#define GL_MAX_GREEN_SGIS 0x85A9\r\n#define GL_MIN_BLUE_SGIS 0x85AA\r\n#define GL_MAX_BLUE_SGIS 0x85AB\r\n#define GL_MIN_ALPHA_SGIS 0x85AC\r\n#define GL_MAX_ALPHA_SGIS 0x85AD\r\n\r\n#define GLEW_SGIS_color_range GLEW_GET_VAR(__GLEW_SGIS_color_range)\r\n\r\n#endif /* GL_SGIS_color_range */\r\n\r\n/* ------------------------- GL_SGIS_detail_texture ------------------------ */\r\n\r\n#ifndef GL_SGIS_detail_texture\r\n#define GL_SGIS_detail_texture 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points);\r\ntypedef void (GLAPIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat* points);\r\n\r\n#define glDetailTexFuncSGIS GLEW_GET_FUN(__glewDetailTexFuncSGIS)\r\n#define glGetDetailTexFuncSGIS GLEW_GET_FUN(__glewGetDetailTexFuncSGIS)\r\n\r\n#define GLEW_SGIS_detail_texture GLEW_GET_VAR(__GLEW_SGIS_detail_texture)\r\n\r\n#endif /* GL_SGIS_detail_texture */\r\n\r\n/* -------------------------- GL_SGIS_fog_function ------------------------- */\r\n\r\n#ifndef GL_SGIS_fog_function\r\n#define GL_SGIS_fog_function 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat* points);\r\ntypedef void (GLAPIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat* points);\r\n\r\n#define glFogFuncSGIS GLEW_GET_FUN(__glewFogFuncSGIS)\r\n#define glGetFogFuncSGIS GLEW_GET_FUN(__glewGetFogFuncSGIS)\r\n\r\n#define GLEW_SGIS_fog_function GLEW_GET_VAR(__GLEW_SGIS_fog_function)\r\n\r\n#endif /* GL_SGIS_fog_function */\r\n\r\n/* ------------------------ GL_SGIS_generate_mipmap ------------------------ */\r\n\r\n#ifndef GL_SGIS_generate_mipmap\r\n#define GL_SGIS_generate_mipmap 1\r\n\r\n#define GL_GENERATE_MIPMAP_SGIS 0x8191\r\n#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192\r\n\r\n#define GLEW_SGIS_generate_mipmap GLEW_GET_VAR(__GLEW_SGIS_generate_mipmap)\r\n\r\n#endif /* GL_SGIS_generate_mipmap */\r\n\r\n/* -------------------------- GL_SGIS_multisample -------------------------- */\r\n\r\n#ifndef GL_SGIS_multisample\r\n#define GL_SGIS_multisample 1\r\n\r\n#define GL_MULTISAMPLE_SGIS 0x809D\r\n#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F\r\n#define GL_SAMPLE_MASK_SGIS 0x80A0\r\n#define GL_1PASS_SGIS 0x80A1\r\n#define GL_2PASS_0_SGIS 0x80A2\r\n#define GL_2PASS_1_SGIS 0x80A3\r\n#define GL_4PASS_0_SGIS 0x80A4\r\n#define GL_4PASS_1_SGIS 0x80A5\r\n#define GL_4PASS_2_SGIS 0x80A6\r\n#define GL_4PASS_3_SGIS 0x80A7\r\n#define GL_SAMPLE_BUFFERS_SGIS 0x80A8\r\n#define GL_SAMPLES_SGIS 0x80A9\r\n#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA\r\n#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB\r\n#define GL_SAMPLE_PATTERN_SGIS 0x80AC\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);\r\ntypedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);\r\n\r\n#define glSampleMaskSGIS GLEW_GET_FUN(__glewSampleMaskSGIS)\r\n#define glSamplePatternSGIS GLEW_GET_FUN(__glewSamplePatternSGIS)\r\n\r\n#define GLEW_SGIS_multisample GLEW_GET_VAR(__GLEW_SGIS_multisample)\r\n\r\n#endif /* GL_SGIS_multisample */\r\n\r\n/* ------------------------- GL_SGIS_pixel_texture ------------------------- */\r\n\r\n#ifndef GL_SGIS_pixel_texture\r\n#define GL_SGIS_pixel_texture 1\r\n\r\n#define GLEW_SGIS_pixel_texture GLEW_GET_VAR(__GLEW_SGIS_pixel_texture)\r\n\r\n#endif /* GL_SGIS_pixel_texture */\r\n\r\n/* ----------------------- GL_SGIS_point_line_texgen ----------------------- */\r\n\r\n#ifndef GL_SGIS_point_line_texgen\r\n#define GL_SGIS_point_line_texgen 1\r\n\r\n#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0\r\n#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1\r\n#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2\r\n#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3\r\n#define GL_EYE_POINT_SGIS 0x81F4\r\n#define GL_OBJECT_POINT_SGIS 0x81F5\r\n#define GL_EYE_LINE_SGIS 0x81F6\r\n#define GL_OBJECT_LINE_SGIS 0x81F7\r\n\r\n#define GLEW_SGIS_point_line_texgen GLEW_GET_VAR(__GLEW_SGIS_point_line_texgen)\r\n\r\n#endif /* GL_SGIS_point_line_texgen */\r\n\r\n/* ------------------------ GL_SGIS_sharpen_texture ------------------------ */\r\n\r\n#ifndef GL_SGIS_sharpen_texture\r\n#define GL_SGIS_sharpen_texture 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat* points);\r\ntypedef void (GLAPIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points);\r\n\r\n#define glGetSharpenTexFuncSGIS GLEW_GET_FUN(__glewGetSharpenTexFuncSGIS)\r\n#define glSharpenTexFuncSGIS GLEW_GET_FUN(__glewSharpenTexFuncSGIS)\r\n\r\n#define GLEW_SGIS_sharpen_texture GLEW_GET_VAR(__GLEW_SGIS_sharpen_texture)\r\n\r\n#endif /* GL_SGIS_sharpen_texture */\r\n\r\n/* --------------------------- GL_SGIS_texture4D --------------------------- */\r\n\r\n#ifndef GL_SGIS_texture4D\r\n#define GL_SGIS_texture4D 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void* pixels);\r\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void* pixels);\r\n\r\n#define glTexImage4DSGIS GLEW_GET_FUN(__glewTexImage4DSGIS)\r\n#define glTexSubImage4DSGIS GLEW_GET_FUN(__glewTexSubImage4DSGIS)\r\n\r\n#define GLEW_SGIS_texture4D GLEW_GET_VAR(__GLEW_SGIS_texture4D)\r\n\r\n#endif /* GL_SGIS_texture4D */\r\n\r\n/* ---------------------- GL_SGIS_texture_border_clamp --------------------- */\r\n\r\n#ifndef GL_SGIS_texture_border_clamp\r\n#define GL_SGIS_texture_border_clamp 1\r\n\r\n#define GL_CLAMP_TO_BORDER_SGIS 0x812D\r\n\r\n#define GLEW_SGIS_texture_border_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_border_clamp)\r\n\r\n#endif /* GL_SGIS_texture_border_clamp */\r\n\r\n/* ----------------------- GL_SGIS_texture_edge_clamp ---------------------- */\r\n\r\n#ifndef GL_SGIS_texture_edge_clamp\r\n#define GL_SGIS_texture_edge_clamp 1\r\n\r\n#define GL_CLAMP_TO_EDGE_SGIS 0x812F\r\n\r\n#define GLEW_SGIS_texture_edge_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_edge_clamp)\r\n\r\n#endif /* GL_SGIS_texture_edge_clamp */\r\n\r\n/* ------------------------ GL_SGIS_texture_filter4 ------------------------ */\r\n\r\n#ifndef GL_SGIS_texture_filter4\r\n#define GL_SGIS_texture_filter4 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat* weights);\r\ntypedef void (GLAPIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat* weights);\r\n\r\n#define glGetTexFilterFuncSGIS GLEW_GET_FUN(__glewGetTexFilterFuncSGIS)\r\n#define glTexFilterFuncSGIS GLEW_GET_FUN(__glewTexFilterFuncSGIS)\r\n\r\n#define GLEW_SGIS_texture_filter4 GLEW_GET_VAR(__GLEW_SGIS_texture_filter4)\r\n\r\n#endif /* GL_SGIS_texture_filter4 */\r\n\r\n/* -------------------------- GL_SGIS_texture_lod -------------------------- */\r\n\r\n#ifndef GL_SGIS_texture_lod\r\n#define GL_SGIS_texture_lod 1\r\n\r\n#define GL_TEXTURE_MIN_LOD_SGIS 0x813A\r\n#define GL_TEXTURE_MAX_LOD_SGIS 0x813B\r\n#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C\r\n#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D\r\n\r\n#define GLEW_SGIS_texture_lod GLEW_GET_VAR(__GLEW_SGIS_texture_lod)\r\n\r\n#endif /* GL_SGIS_texture_lod */\r\n\r\n/* ------------------------- GL_SGIS_texture_select ------------------------ */\r\n\r\n#ifndef GL_SGIS_texture_select\r\n#define GL_SGIS_texture_select 1\r\n\r\n#define GLEW_SGIS_texture_select GLEW_GET_VAR(__GLEW_SGIS_texture_select)\r\n\r\n#endif /* GL_SGIS_texture_select */\r\n\r\n/* ----------------------------- GL_SGIX_async ----------------------------- */\r\n\r\n#ifndef GL_SGIX_async\r\n#define GL_SGIX_async 1\r\n\r\n#define GL_ASYNC_MARKER_SGIX 0x8329\r\n\r\ntypedef void (GLAPIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker);\r\ntypedef void (GLAPIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);\r\ntypedef GLint (GLAPIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint* markerp);\r\ntypedef GLuint (GLAPIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);\r\ntypedef GLboolean (GLAPIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);\r\ntypedef GLint (GLAPIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint* markerp);\r\n\r\n#define glAsyncMarkerSGIX GLEW_GET_FUN(__glewAsyncMarkerSGIX)\r\n#define glDeleteAsyncMarkersSGIX GLEW_GET_FUN(__glewDeleteAsyncMarkersSGIX)\r\n#define glFinishAsyncSGIX GLEW_GET_FUN(__glewFinishAsyncSGIX)\r\n#define glGenAsyncMarkersSGIX GLEW_GET_FUN(__glewGenAsyncMarkersSGIX)\r\n#define glIsAsyncMarkerSGIX GLEW_GET_FUN(__glewIsAsyncMarkerSGIX)\r\n#define glPollAsyncSGIX GLEW_GET_FUN(__glewPollAsyncSGIX)\r\n\r\n#define GLEW_SGIX_async GLEW_GET_VAR(__GLEW_SGIX_async)\r\n\r\n#endif /* GL_SGIX_async */\r\n\r\n/* ------------------------ GL_SGIX_async_histogram ------------------------ */\r\n\r\n#ifndef GL_SGIX_async_histogram\r\n#define GL_SGIX_async_histogram 1\r\n\r\n#define GL_ASYNC_HISTOGRAM_SGIX 0x832C\r\n#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D\r\n\r\n#define GLEW_SGIX_async_histogram GLEW_GET_VAR(__GLEW_SGIX_async_histogram)\r\n\r\n#endif /* GL_SGIX_async_histogram */\r\n\r\n/* -------------------------- GL_SGIX_async_pixel -------------------------- */\r\n\r\n#ifndef GL_SGIX_async_pixel\r\n#define GL_SGIX_async_pixel 1\r\n\r\n#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C\r\n#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D\r\n#define GL_ASYNC_READ_PIXELS_SGIX 0x835E\r\n#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F\r\n#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360\r\n#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361\r\n\r\n#define GLEW_SGIX_async_pixel GLEW_GET_VAR(__GLEW_SGIX_async_pixel)\r\n\r\n#endif /* GL_SGIX_async_pixel */\r\n\r\n/* ----------------------- GL_SGIX_blend_alpha_minmax ---------------------- */\r\n\r\n#ifndef GL_SGIX_blend_alpha_minmax\r\n#define GL_SGIX_blend_alpha_minmax 1\r\n\r\n#define GL_ALPHA_MIN_SGIX 0x8320\r\n#define GL_ALPHA_MAX_SGIX 0x8321\r\n\r\n#define GLEW_SGIX_blend_alpha_minmax GLEW_GET_VAR(__GLEW_SGIX_blend_alpha_minmax)\r\n\r\n#endif /* GL_SGIX_blend_alpha_minmax */\r\n\r\n/* ---------------------------- GL_SGIX_clipmap ---------------------------- */\r\n\r\n#ifndef GL_SGIX_clipmap\r\n#define GL_SGIX_clipmap 1\r\n\r\n#define GLEW_SGIX_clipmap GLEW_GET_VAR(__GLEW_SGIX_clipmap)\r\n\r\n#endif /* GL_SGIX_clipmap */\r\n\r\n/* ---------------------- GL_SGIX_convolution_accuracy --------------------- */\r\n\r\n#ifndef GL_SGIX_convolution_accuracy\r\n#define GL_SGIX_convolution_accuracy 1\r\n\r\n#define GL_CONVOLUTION_HINT_SGIX 0x8316\r\n\r\n#define GLEW_SGIX_convolution_accuracy GLEW_GET_VAR(__GLEW_SGIX_convolution_accuracy)\r\n\r\n#endif /* GL_SGIX_convolution_accuracy */\r\n\r\n/* ------------------------- GL_SGIX_depth_texture ------------------------- */\r\n\r\n#ifndef GL_SGIX_depth_texture\r\n#define GL_SGIX_depth_texture 1\r\n\r\n#define GL_DEPTH_COMPONENT16_SGIX 0x81A5\r\n#define GL_DEPTH_COMPONENT24_SGIX 0x81A6\r\n#define GL_DEPTH_COMPONENT32_SGIX 0x81A7\r\n\r\n#define GLEW_SGIX_depth_texture GLEW_GET_VAR(__GLEW_SGIX_depth_texture)\r\n\r\n#endif /* GL_SGIX_depth_texture */\r\n\r\n/* -------------------------- GL_SGIX_flush_raster ------------------------- */\r\n\r\n#ifndef GL_SGIX_flush_raster\r\n#define GL_SGIX_flush_raster 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void);\r\n\r\n#define glFlushRasterSGIX GLEW_GET_FUN(__glewFlushRasterSGIX)\r\n\r\n#define GLEW_SGIX_flush_raster GLEW_GET_VAR(__GLEW_SGIX_flush_raster)\r\n\r\n#endif /* GL_SGIX_flush_raster */\r\n\r\n/* --------------------------- GL_SGIX_fog_offset -------------------------- */\r\n\r\n#ifndef GL_SGIX_fog_offset\r\n#define GL_SGIX_fog_offset 1\r\n\r\n#define GL_FOG_OFFSET_SGIX 0x8198\r\n#define GL_FOG_OFFSET_VALUE_SGIX 0x8199\r\n\r\n#define GLEW_SGIX_fog_offset GLEW_GET_VAR(__GLEW_SGIX_fog_offset)\r\n\r\n#endif /* GL_SGIX_fog_offset */\r\n\r\n/* -------------------------- GL_SGIX_fog_texture -------------------------- */\r\n\r\n#ifndef GL_SGIX_fog_texture\r\n#define GL_SGIX_fog_texture 1\r\n\r\n#define GL_TEXTURE_FOG_SGIX 0\r\n#define GL_FOG_PATCHY_FACTOR_SGIX 0\r\n#define GL_FRAGMENT_FOG_SGIX 0\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTEXTUREFOGSGIXPROC) (GLenum pname);\r\n\r\n#define glTextureFogSGIX GLEW_GET_FUN(__glewTextureFogSGIX)\r\n\r\n#define GLEW_SGIX_fog_texture GLEW_GET_VAR(__GLEW_SGIX_fog_texture)\r\n\r\n#endif /* GL_SGIX_fog_texture */\r\n\r\n/* ------------------- GL_SGIX_fragment_specular_lighting ------------------ */\r\n\r\n#ifndef GL_SGIX_fragment_specular_lighting\r\n#define GL_SGIX_fragment_specular_lighting 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, const GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, const GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data);\r\ntypedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data);\r\n\r\n#define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX)\r\n#define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX)\r\n#define glFragmentLightModelfvSGIX GLEW_GET_FUN(__glewFragmentLightModelfvSGIX)\r\n#define glFragmentLightModeliSGIX GLEW_GET_FUN(__glewFragmentLightModeliSGIX)\r\n#define glFragmentLightModelivSGIX GLEW_GET_FUN(__glewFragmentLightModelivSGIX)\r\n#define glFragmentLightfSGIX GLEW_GET_FUN(__glewFragmentLightfSGIX)\r\n#define glFragmentLightfvSGIX GLEW_GET_FUN(__glewFragmentLightfvSGIX)\r\n#define glFragmentLightiSGIX GLEW_GET_FUN(__glewFragmentLightiSGIX)\r\n#define glFragmentLightivSGIX GLEW_GET_FUN(__glewFragmentLightivSGIX)\r\n#define glFragmentMaterialfSGIX GLEW_GET_FUN(__glewFragmentMaterialfSGIX)\r\n#define glFragmentMaterialfvSGIX GLEW_GET_FUN(__glewFragmentMaterialfvSGIX)\r\n#define glFragmentMaterialiSGIX GLEW_GET_FUN(__glewFragmentMaterialiSGIX)\r\n#define glFragmentMaterialivSGIX GLEW_GET_FUN(__glewFragmentMaterialivSGIX)\r\n#define glGetFragmentLightfvSGIX GLEW_GET_FUN(__glewGetFragmentLightfvSGIX)\r\n#define glGetFragmentLightivSGIX GLEW_GET_FUN(__glewGetFragmentLightivSGIX)\r\n#define glGetFragmentMaterialfvSGIX GLEW_GET_FUN(__glewGetFragmentMaterialfvSGIX)\r\n#define glGetFragmentMaterialivSGIX GLEW_GET_FUN(__glewGetFragmentMaterialivSGIX)\r\n\r\n#define GLEW_SGIX_fragment_specular_lighting GLEW_GET_VAR(__GLEW_SGIX_fragment_specular_lighting)\r\n\r\n#endif /* GL_SGIX_fragment_specular_lighting */\r\n\r\n/* --------------------------- GL_SGIX_framezoom --------------------------- */\r\n\r\n#ifndef GL_SGIX_framezoom\r\n#define GL_SGIX_framezoom 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor);\r\n\r\n#define glFrameZoomSGIX GLEW_GET_FUN(__glewFrameZoomSGIX)\r\n\r\n#define GLEW_SGIX_framezoom GLEW_GET_VAR(__GLEW_SGIX_framezoom)\r\n\r\n#endif /* GL_SGIX_framezoom */\r\n\r\n/* --------------------------- GL_SGIX_interlace --------------------------- */\r\n\r\n#ifndef GL_SGIX_interlace\r\n#define GL_SGIX_interlace 1\r\n\r\n#define GL_INTERLACE_SGIX 0x8094\r\n\r\n#define GLEW_SGIX_interlace GLEW_GET_VAR(__GLEW_SGIX_interlace)\r\n\r\n#endif /* GL_SGIX_interlace */\r\n\r\n/* ------------------------- GL_SGIX_ir_instrument1 ------------------------ */\r\n\r\n#ifndef GL_SGIX_ir_instrument1\r\n#define GL_SGIX_ir_instrument1 1\r\n\r\n#define GLEW_SGIX_ir_instrument1 GLEW_GET_VAR(__GLEW_SGIX_ir_instrument1)\r\n\r\n#endif /* GL_SGIX_ir_instrument1 */\r\n\r\n/* ------------------------- GL_SGIX_list_priority ------------------------- */\r\n\r\n#ifndef GL_SGIX_list_priority\r\n#define GL_SGIX_list_priority 1\r\n\r\n#define GLEW_SGIX_list_priority GLEW_GET_VAR(__GLEW_SGIX_list_priority)\r\n\r\n#endif /* GL_SGIX_list_priority */\r\n\r\n/* ------------------------- GL_SGIX_pixel_texture ------------------------- */\r\n\r\n#ifndef GL_SGIX_pixel_texture\r\n#define GL_SGIX_pixel_texture 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);\r\n\r\n#define glPixelTexGenSGIX GLEW_GET_FUN(__glewPixelTexGenSGIX)\r\n\r\n#define GLEW_SGIX_pixel_texture GLEW_GET_VAR(__GLEW_SGIX_pixel_texture)\r\n\r\n#endif /* GL_SGIX_pixel_texture */\r\n\r\n/* ----------------------- GL_SGIX_pixel_texture_bits ---------------------- */\r\n\r\n#ifndef GL_SGIX_pixel_texture_bits\r\n#define GL_SGIX_pixel_texture_bits 1\r\n\r\n#define GLEW_SGIX_pixel_texture_bits GLEW_GET_VAR(__GLEW_SGIX_pixel_texture_bits)\r\n\r\n#endif /* GL_SGIX_pixel_texture_bits */\r\n\r\n/* ------------------------ GL_SGIX_reference_plane ------------------------ */\r\n\r\n#ifndef GL_SGIX_reference_plane\r\n#define GL_SGIX_reference_plane 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble* equation);\r\n\r\n#define glReferencePlaneSGIX GLEW_GET_FUN(__glewReferencePlaneSGIX)\r\n\r\n#define GLEW_SGIX_reference_plane GLEW_GET_VAR(__GLEW_SGIX_reference_plane)\r\n\r\n#endif /* GL_SGIX_reference_plane */\r\n\r\n/* ---------------------------- GL_SGIX_resample --------------------------- */\r\n\r\n#ifndef GL_SGIX_resample\r\n#define GL_SGIX_resample 1\r\n\r\n#define GL_PACK_RESAMPLE_SGIX 0x842E\r\n#define GL_UNPACK_RESAMPLE_SGIX 0x842F\r\n#define GL_RESAMPLE_DECIMATE_SGIX 0x8430\r\n#define GL_RESAMPLE_REPLICATE_SGIX 0x8433\r\n#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434\r\n\r\n#define GLEW_SGIX_resample GLEW_GET_VAR(__GLEW_SGIX_resample)\r\n\r\n#endif /* GL_SGIX_resample */\r\n\r\n/* ----------------------------- GL_SGIX_shadow ---------------------------- */\r\n\r\n#ifndef GL_SGIX_shadow\r\n#define GL_SGIX_shadow 1\r\n\r\n#define GL_TEXTURE_COMPARE_SGIX 0x819A\r\n#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B\r\n#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C\r\n#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D\r\n\r\n#define GLEW_SGIX_shadow GLEW_GET_VAR(__GLEW_SGIX_shadow)\r\n\r\n#endif /* GL_SGIX_shadow */\r\n\r\n/* ------------------------- GL_SGIX_shadow_ambient ------------------------ */\r\n\r\n#ifndef GL_SGIX_shadow_ambient\r\n#define GL_SGIX_shadow_ambient 1\r\n\r\n#define GL_SHADOW_AMBIENT_SGIX 0x80BF\r\n\r\n#define GLEW_SGIX_shadow_ambient GLEW_GET_VAR(__GLEW_SGIX_shadow_ambient)\r\n\r\n#endif /* GL_SGIX_shadow_ambient */\r\n\r\n/* ----------------------------- GL_SGIX_sprite ---------------------------- */\r\n\r\n#ifndef GL_SGIX_sprite\r\n#define GL_SGIX_sprite 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);\r\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);\r\ntypedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, GLint* params);\r\n\r\n#define glSpriteParameterfSGIX GLEW_GET_FUN(__glewSpriteParameterfSGIX)\r\n#define glSpriteParameterfvSGIX GLEW_GET_FUN(__glewSpriteParameterfvSGIX)\r\n#define glSpriteParameteriSGIX GLEW_GET_FUN(__glewSpriteParameteriSGIX)\r\n#define glSpriteParameterivSGIX GLEW_GET_FUN(__glewSpriteParameterivSGIX)\r\n\r\n#define GLEW_SGIX_sprite GLEW_GET_VAR(__GLEW_SGIX_sprite)\r\n\r\n#endif /* GL_SGIX_sprite */\r\n\r\n/* ----------------------- GL_SGIX_tag_sample_buffer ----------------------- */\r\n\r\n#ifndef GL_SGIX_tag_sample_buffer\r\n#define GL_SGIX_tag_sample_buffer 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);\r\n\r\n#define glTagSampleBufferSGIX GLEW_GET_FUN(__glewTagSampleBufferSGIX)\r\n\r\n#define GLEW_SGIX_tag_sample_buffer GLEW_GET_VAR(__GLEW_SGIX_tag_sample_buffer)\r\n\r\n#endif /* GL_SGIX_tag_sample_buffer */\r\n\r\n/* ------------------------ GL_SGIX_texture_add_env ------------------------ */\r\n\r\n#ifndef GL_SGIX_texture_add_env\r\n#define GL_SGIX_texture_add_env 1\r\n\r\n#define GLEW_SGIX_texture_add_env GLEW_GET_VAR(__GLEW_SGIX_texture_add_env)\r\n\r\n#endif /* GL_SGIX_texture_add_env */\r\n\r\n/* -------------------- GL_SGIX_texture_coordinate_clamp ------------------- */\r\n\r\n#ifndef GL_SGIX_texture_coordinate_clamp\r\n#define GL_SGIX_texture_coordinate_clamp 1\r\n\r\n#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369\r\n#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A\r\n#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B\r\n\r\n#define GLEW_SGIX_texture_coordinate_clamp GLEW_GET_VAR(__GLEW_SGIX_texture_coordinate_clamp)\r\n\r\n#endif /* GL_SGIX_texture_coordinate_clamp */\r\n\r\n/* ------------------------ GL_SGIX_texture_lod_bias ----------------------- */\r\n\r\n#ifndef GL_SGIX_texture_lod_bias\r\n#define GL_SGIX_texture_lod_bias 1\r\n\r\n#define GLEW_SGIX_texture_lod_bias GLEW_GET_VAR(__GLEW_SGIX_texture_lod_bias)\r\n\r\n#endif /* GL_SGIX_texture_lod_bias */\r\n\r\n/* ---------------------- GL_SGIX_texture_multi_buffer --------------------- */\r\n\r\n#ifndef GL_SGIX_texture_multi_buffer\r\n#define GL_SGIX_texture_multi_buffer 1\r\n\r\n#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E\r\n\r\n#define GLEW_SGIX_texture_multi_buffer GLEW_GET_VAR(__GLEW_SGIX_texture_multi_buffer)\r\n\r\n#endif /* GL_SGIX_texture_multi_buffer */\r\n\r\n/* ------------------------- GL_SGIX_texture_range ------------------------- */\r\n\r\n#ifndef GL_SGIX_texture_range\r\n#define GL_SGIX_texture_range 1\r\n\r\n#define GL_RGB_SIGNED_SGIX 0x85E0\r\n#define GL_RGBA_SIGNED_SGIX 0x85E1\r\n#define GL_ALPHA_SIGNED_SGIX 0x85E2\r\n#define GL_LUMINANCE_SIGNED_SGIX 0x85E3\r\n#define GL_INTENSITY_SIGNED_SGIX 0x85E4\r\n#define GL_LUMINANCE_ALPHA_SIGNED_SGIX 0x85E5\r\n#define GL_RGB16_SIGNED_SGIX 0x85E6\r\n#define GL_RGBA16_SIGNED_SGIX 0x85E7\r\n#define GL_ALPHA16_SIGNED_SGIX 0x85E8\r\n#define GL_LUMINANCE16_SIGNED_SGIX 0x85E9\r\n#define GL_INTENSITY16_SIGNED_SGIX 0x85EA\r\n#define GL_LUMINANCE16_ALPHA16_SIGNED_SGIX 0x85EB\r\n#define GL_RGB_EXTENDED_RANGE_SGIX 0x85EC\r\n#define GL_RGBA_EXTENDED_RANGE_SGIX 0x85ED\r\n#define GL_ALPHA_EXTENDED_RANGE_SGIX 0x85EE\r\n#define GL_LUMINANCE_EXTENDED_RANGE_SGIX 0x85EF\r\n#define GL_INTENSITY_EXTENDED_RANGE_SGIX 0x85F0\r\n#define GL_LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX 0x85F1\r\n#define GL_RGB16_EXTENDED_RANGE_SGIX 0x85F2\r\n#define GL_RGBA16_EXTENDED_RANGE_SGIX 0x85F3\r\n#define GL_ALPHA16_EXTENDED_RANGE_SGIX 0x85F4\r\n#define GL_LUMINANCE16_EXTENDED_RANGE_SGIX 0x85F5\r\n#define GL_INTENSITY16_EXTENDED_RANGE_SGIX 0x85F6\r\n#define GL_LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX 0x85F7\r\n#define GL_MIN_LUMINANCE_SGIS 0x85F8\r\n#define GL_MAX_LUMINANCE_SGIS 0x85F9\r\n#define GL_MIN_INTENSITY_SGIS 0x85FA\r\n#define GL_MAX_INTENSITY_SGIS 0x85FB\r\n\r\n#define GLEW_SGIX_texture_range GLEW_GET_VAR(__GLEW_SGIX_texture_range)\r\n\r\n#endif /* GL_SGIX_texture_range */\r\n\r\n/* ----------------------- GL_SGIX_texture_scale_bias ---------------------- */\r\n\r\n#ifndef GL_SGIX_texture_scale_bias\r\n#define GL_SGIX_texture_scale_bias 1\r\n\r\n#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179\r\n#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A\r\n#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B\r\n#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C\r\n\r\n#define GLEW_SGIX_texture_scale_bias GLEW_GET_VAR(__GLEW_SGIX_texture_scale_bias)\r\n\r\n#endif /* GL_SGIX_texture_scale_bias */\r\n\r\n/* ------------------------- GL_SGIX_vertex_preclip ------------------------ */\r\n\r\n#ifndef GL_SGIX_vertex_preclip\r\n#define GL_SGIX_vertex_preclip 1\r\n\r\n#define GL_VERTEX_PRECLIP_SGIX 0x83EE\r\n#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF\r\n\r\n#define GLEW_SGIX_vertex_preclip GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip)\r\n\r\n#endif /* GL_SGIX_vertex_preclip */\r\n\r\n/* ---------------------- GL_SGIX_vertex_preclip_hint ---------------------- */\r\n\r\n#ifndef GL_SGIX_vertex_preclip_hint\r\n#define GL_SGIX_vertex_preclip_hint 1\r\n\r\n#define GL_VERTEX_PRECLIP_SGIX 0x83EE\r\n#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF\r\n\r\n#define GLEW_SGIX_vertex_preclip_hint GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip_hint)\r\n\r\n#endif /* GL_SGIX_vertex_preclip_hint */\r\n\r\n/* ----------------------------- GL_SGIX_ycrcb ----------------------------- */\r\n\r\n#ifndef GL_SGIX_ycrcb\r\n#define GL_SGIX_ycrcb 1\r\n\r\n#define GLEW_SGIX_ycrcb GLEW_GET_VAR(__GLEW_SGIX_ycrcb)\r\n\r\n#endif /* GL_SGIX_ycrcb */\r\n\r\n/* -------------------------- GL_SGI_color_matrix -------------------------- */\r\n\r\n#ifndef GL_SGI_color_matrix\r\n#define GL_SGI_color_matrix 1\r\n\r\n#define GL_COLOR_MATRIX_SGI 0x80B1\r\n#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2\r\n#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3\r\n#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4\r\n#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5\r\n#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6\r\n#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7\r\n#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8\r\n#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9\r\n#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA\r\n#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB\r\n\r\n#define GLEW_SGI_color_matrix GLEW_GET_VAR(__GLEW_SGI_color_matrix)\r\n\r\n#endif /* GL_SGI_color_matrix */\r\n\r\n/* --------------------------- GL_SGI_color_table -------------------------- */\r\n\r\n#ifndef GL_SGI_color_table\r\n#define GL_SGI_color_table 1\r\n\r\n#define GL_COLOR_TABLE_SGI 0x80D0\r\n#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1\r\n#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2\r\n#define GL_PROXY_COLOR_TABLE_SGI 0x80D3\r\n#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4\r\n#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5\r\n#define GL_COLOR_TABLE_SCALE_SGI 0x80D6\r\n#define GL_COLOR_TABLE_BIAS_SGI 0x80D7\r\n#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8\r\n#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9\r\n#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA\r\n#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB\r\n#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC\r\n#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD\r\n#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE\r\n#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* table);\r\ntypedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint* params);\r\ntypedef void (GLAPIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void* table);\r\n\r\n#define glColorTableParameterfvSGI GLEW_GET_FUN(__glewColorTableParameterfvSGI)\r\n#define glColorTableParameterivSGI GLEW_GET_FUN(__glewColorTableParameterivSGI)\r\n#define glColorTableSGI GLEW_GET_FUN(__glewColorTableSGI)\r\n#define glCopyColorTableSGI GLEW_GET_FUN(__glewCopyColorTableSGI)\r\n#define glGetColorTableParameterfvSGI GLEW_GET_FUN(__glewGetColorTableParameterfvSGI)\r\n#define glGetColorTableParameterivSGI GLEW_GET_FUN(__glewGetColorTableParameterivSGI)\r\n#define glGetColorTableSGI GLEW_GET_FUN(__glewGetColorTableSGI)\r\n\r\n#define GLEW_SGI_color_table GLEW_GET_VAR(__GLEW_SGI_color_table)\r\n\r\n#endif /* GL_SGI_color_table */\r\n\r\n/* ----------------------- GL_SGI_texture_color_table ---------------------- */\r\n\r\n#ifndef GL_SGI_texture_color_table\r\n#define GL_SGI_texture_color_table 1\r\n\r\n#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC\r\n#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD\r\n\r\n#define GLEW_SGI_texture_color_table GLEW_GET_VAR(__GLEW_SGI_texture_color_table)\r\n\r\n#endif /* GL_SGI_texture_color_table */\r\n\r\n/* ------------------------- GL_SUNX_constant_data ------------------------- */\r\n\r\n#ifndef GL_SUNX_constant_data\r\n#define GL_SUNX_constant_data 1\r\n\r\n#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5\r\n#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6\r\n\r\ntypedef void (GLAPIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void);\r\n\r\n#define glFinishTextureSUNX GLEW_GET_FUN(__glewFinishTextureSUNX)\r\n\r\n#define GLEW_SUNX_constant_data GLEW_GET_VAR(__GLEW_SUNX_constant_data)\r\n\r\n#endif /* GL_SUNX_constant_data */\r\n\r\n/* -------------------- GL_SUN_convolution_border_modes -------------------- */\r\n\r\n#ifndef GL_SUN_convolution_border_modes\r\n#define GL_SUN_convolution_border_modes 1\r\n\r\n#define GL_WRAP_BORDER_SUN 0x81D4\r\n\r\n#define GLEW_SUN_convolution_border_modes GLEW_GET_VAR(__GLEW_SUN_convolution_border_modes)\r\n\r\n#endif /* GL_SUN_convolution_border_modes */\r\n\r\n/* -------------------------- GL_SUN_global_alpha -------------------------- */\r\n\r\n#ifndef GL_SUN_global_alpha\r\n#define GL_SUN_global_alpha 1\r\n\r\n#define GL_GLOBAL_ALPHA_SUN 0x81D9\r\n#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA\r\n\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);\r\ntypedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);\r\n\r\n#define glGlobalAlphaFactorbSUN GLEW_GET_FUN(__glewGlobalAlphaFactorbSUN)\r\n#define glGlobalAlphaFactordSUN GLEW_GET_FUN(__glewGlobalAlphaFactordSUN)\r\n#define glGlobalAlphaFactorfSUN GLEW_GET_FUN(__glewGlobalAlphaFactorfSUN)\r\n#define glGlobalAlphaFactoriSUN GLEW_GET_FUN(__glewGlobalAlphaFactoriSUN)\r\n#define glGlobalAlphaFactorsSUN GLEW_GET_FUN(__glewGlobalAlphaFactorsSUN)\r\n#define glGlobalAlphaFactorubSUN GLEW_GET_FUN(__glewGlobalAlphaFactorubSUN)\r\n#define glGlobalAlphaFactoruiSUN GLEW_GET_FUN(__glewGlobalAlphaFactoruiSUN)\r\n#define glGlobalAlphaFactorusSUN GLEW_GET_FUN(__glewGlobalAlphaFactorusSUN)\r\n\r\n#define GLEW_SUN_global_alpha GLEW_GET_VAR(__GLEW_SUN_global_alpha)\r\n\r\n#endif /* GL_SUN_global_alpha */\r\n\r\n/* --------------------------- GL_SUN_mesh_array --------------------------- */\r\n\r\n#ifndef GL_SUN_mesh_array\r\n#define GL_SUN_mesh_array 1\r\n\r\n#define GL_QUAD_MESH_SUN 0x8614\r\n#define GL_TRIANGLE_MESH_SUN 0x8615\r\n\r\n#define GLEW_SUN_mesh_array GLEW_GET_VAR(__GLEW_SUN_mesh_array)\r\n\r\n#endif /* GL_SUN_mesh_array */\r\n\r\n/* ------------------------ GL_SUN_read_video_pixels ----------------------- */\r\n\r\n#ifndef GL_SUN_read_video_pixels\r\n#define GL_SUN_read_video_pixels 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLREADVIDEOPIXELSSUNPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);\r\n\r\n#define glReadVideoPixelsSUN GLEW_GET_FUN(__glewReadVideoPixelsSUN)\r\n\r\n#define GLEW_SUN_read_video_pixels GLEW_GET_VAR(__GLEW_SUN_read_video_pixels)\r\n\r\n#endif /* GL_SUN_read_video_pixels */\r\n\r\n/* --------------------------- GL_SUN_slice_accum -------------------------- */\r\n\r\n#ifndef GL_SUN_slice_accum\r\n#define GL_SUN_slice_accum 1\r\n\r\n#define GL_SLICE_ACCUM_SUN 0x85CC\r\n\r\n#define GLEW_SUN_slice_accum GLEW_GET_VAR(__GLEW_SUN_slice_accum)\r\n\r\n#endif /* GL_SUN_slice_accum */\r\n\r\n/* -------------------------- GL_SUN_triangle_list ------------------------- */\r\n\r\n#ifndef GL_SUN_triangle_list\r\n#define GL_SUN_triangle_list 1\r\n\r\n#define GL_RESTART_SUN 0x01\r\n#define GL_REPLACE_MIDDLE_SUN 0x02\r\n#define GL_REPLACE_OLDEST_SUN 0x03\r\n#define GL_TRIANGLE_LIST_SUN 0x81D7\r\n#define GL_REPLACEMENT_CODE_SUN 0x81D8\r\n#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0\r\n#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1\r\n#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2\r\n#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3\r\n#define GL_R1UI_V3F_SUN 0x85C4\r\n#define GL_R1UI_C4UB_V3F_SUN 0x85C5\r\n#define GL_R1UI_C3F_V3F_SUN 0x85C6\r\n#define GL_R1UI_N3F_V3F_SUN 0x85C7\r\n#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8\r\n#define GL_R1UI_T2F_V3F_SUN 0x85C9\r\n#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA\r\n#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB\r\n\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void* pointer);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte* code);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint* code);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort* code);\r\n\r\n#define glReplacementCodePointerSUN GLEW_GET_FUN(__glewReplacementCodePointerSUN)\r\n#define glReplacementCodeubSUN GLEW_GET_FUN(__glewReplacementCodeubSUN)\r\n#define glReplacementCodeubvSUN GLEW_GET_FUN(__glewReplacementCodeubvSUN)\r\n#define glReplacementCodeuiSUN GLEW_GET_FUN(__glewReplacementCodeuiSUN)\r\n#define glReplacementCodeuivSUN GLEW_GET_FUN(__glewReplacementCodeuivSUN)\r\n#define glReplacementCodeusSUN GLEW_GET_FUN(__glewReplacementCodeusSUN)\r\n#define glReplacementCodeusvSUN GLEW_GET_FUN(__glewReplacementCodeusvSUN)\r\n\r\n#define GLEW_SUN_triangle_list GLEW_GET_VAR(__GLEW_SUN_triangle_list)\r\n\r\n#endif /* GL_SUN_triangle_list */\r\n\r\n/* ----------------------------- GL_SUN_vertex ----------------------------- */\r\n\r\n#ifndef GL_SUN_vertex\r\n#define GL_SUN_vertex 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte* c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte* c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint* rc, const GLubyte *c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat* tc, const GLubyte *c, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *v);\r\n\r\n#define glColor3fVertex3fSUN GLEW_GET_FUN(__glewColor3fVertex3fSUN)\r\n#define glColor3fVertex3fvSUN GLEW_GET_FUN(__glewColor3fVertex3fvSUN)\r\n#define glColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fSUN)\r\n#define glColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fvSUN)\r\n#define glColor4ubVertex2fSUN GLEW_GET_FUN(__glewColor4ubVertex2fSUN)\r\n#define glColor4ubVertex2fvSUN GLEW_GET_FUN(__glewColor4ubVertex2fvSUN)\r\n#define glColor4ubVertex3fSUN GLEW_GET_FUN(__glewColor4ubVertex3fSUN)\r\n#define glColor4ubVertex3fvSUN GLEW_GET_FUN(__glewColor4ubVertex3fvSUN)\r\n#define glNormal3fVertex3fSUN GLEW_GET_FUN(__glewNormal3fVertex3fSUN)\r\n#define glNormal3fVertex3fvSUN GLEW_GET_FUN(__glewNormal3fVertex3fvSUN)\r\n#define glReplacementCodeuiColor3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fSUN)\r\n#define glReplacementCodeuiColor3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fvSUN)\r\n#define glReplacementCodeuiColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fSUN)\r\n#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fvSUN)\r\n#define glReplacementCodeuiColor4ubVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fSUN)\r\n#define glReplacementCodeuiColor4ubVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fvSUN)\r\n#define glReplacementCodeuiNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fSUN)\r\n#define glReplacementCodeuiNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fvSUN)\r\n#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN)\r\n#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN)\r\n#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN)\r\n#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN)\r\n#define glReplacementCodeuiTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fSUN)\r\n#define glReplacementCodeuiTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fvSUN)\r\n#define glReplacementCodeuiVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fSUN)\r\n#define glReplacementCodeuiVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fvSUN)\r\n#define glTexCoord2fColor3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fSUN)\r\n#define glTexCoord2fColor3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fvSUN)\r\n#define glTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fSUN)\r\n#define glTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fvSUN)\r\n#define glTexCoord2fColor4ubVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fSUN)\r\n#define glTexCoord2fColor4ubVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fvSUN)\r\n#define glTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fSUN)\r\n#define glTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fvSUN)\r\n#define glTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fSUN)\r\n#define glTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fvSUN)\r\n#define glTexCoord4fColor4fNormal3fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fSUN)\r\n#define glTexCoord4fColor4fNormal3fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fvSUN)\r\n#define glTexCoord4fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fSUN)\r\n#define glTexCoord4fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fvSUN)\r\n\r\n#define GLEW_SUN_vertex GLEW_GET_VAR(__GLEW_SUN_vertex)\r\n\r\n#endif /* GL_SUN_vertex */\r\n\r\n/* -------------------------- GL_WIN_phong_shading ------------------------- */\r\n\r\n#ifndef GL_WIN_phong_shading\r\n#define GL_WIN_phong_shading 1\r\n\r\n#define GL_PHONG_WIN 0x80EA\r\n#define GL_PHONG_HINT_WIN 0x80EB\r\n\r\n#define GLEW_WIN_phong_shading GLEW_GET_VAR(__GLEW_WIN_phong_shading)\r\n\r\n#endif /* GL_WIN_phong_shading */\r\n\r\n/* -------------------------- GL_WIN_specular_fog -------------------------- */\r\n\r\n#ifndef GL_WIN_specular_fog\r\n#define GL_WIN_specular_fog 1\r\n\r\n#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC\r\n\r\n#define GLEW_WIN_specular_fog GLEW_GET_VAR(__GLEW_WIN_specular_fog)\r\n\r\n#endif /* GL_WIN_specular_fog */\r\n\r\n/* ---------------------------- GL_WIN_swap_hint --------------------------- */\r\n\r\n#ifndef GL_WIN_swap_hint\r\n#define GL_WIN_swap_hint 1\r\n\r\ntypedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\r\n#define glAddSwapHintRectWIN GLEW_GET_FUN(__glewAddSwapHintRectWIN)\r\n\r\n#define GLEW_WIN_swap_hint GLEW_GET_VAR(__GLEW_WIN_swap_hint)\r\n\r\n#endif /* GL_WIN_swap_hint */\r\n\r\n/* ------------------------------------------------------------------------- */\r\n\r\n#if defined(GLEW_MX) && defined(_WIN32)\r\n#define GLEW_FUN_EXPORT\r\n#else\r\n#define GLEW_FUN_EXPORT GLEWAPI\r\n#endif /* GLEW_MX */\r\n\r\n#if defined(GLEW_MX)\r\n#define GLEW_VAR_EXPORT\r\n#else\r\n#define GLEW_VAR_EXPORT GLEWAPI\r\n#endif /* GLEW_MX */\r\n\r\n#if defined(GLEW_MX) && defined(_WIN32)\r\nstruct GLEWContextStruct\r\n{\r\n#endif /* GLEW_MX */\r\n\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D;\r\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements;\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DPROC __glewTexImage3D;\r\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D;\r\n\r\nGLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture;\r\nGLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D;\r\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage;\r\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd;\r\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf;\r\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd;\r\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv;\r\nGLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDCOLORPROC __glewBlendColor;\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONPROC __glewBlendEquation;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDDPROC __glewFogCoordd;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDDVPROC __glewFogCoorddv;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDFPROC __glewFogCoordf;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDFVPROC __glewFogCoordfv;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFPROC __glewPointParameterf;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERIPROC __glewPointParameteri;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DPROC __glewWindowPos2d;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FPROC __glewWindowPos2f;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IPROC __glewWindowPos2i;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SPROC __glewWindowPos2s;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DPROC __glewWindowPos3d;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FPROC __glewWindowPos3f;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IPROC __glewWindowPos3i;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SPROC __glewWindowPos3s;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINQUERYPROC __glewBeginQuery;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer;\r\nGLEW_FUN_EXPORT PFNGLBUFFERDATAPROC __glewBufferData;\r\nGLEW_FUN_EXPORT PFNGLBUFFERSUBDATAPROC __glewBufferSubData;\r\nGLEW_FUN_EXPORT PFNGLDELETEBUFFERSPROC __glewDeleteBuffers;\r\nGLEW_FUN_EXPORT PFNGLDELETEQUERIESPROC __glewDeleteQueries;\r\nGLEW_FUN_EXPORT PFNGLENDQUERYPROC __glewEndQuery;\r\nGLEW_FUN_EXPORT PFNGLGENBUFFERSPROC __glewGenBuffers;\r\nGLEW_FUN_EXPORT PFNGLGENQUERIESPROC __glewGenQueries;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYIVPROC __glewGetQueryiv;\r\nGLEW_FUN_EXPORT PFNGLISBUFFERPROC __glewIsBuffer;\r\nGLEW_FUN_EXPORT PFNGLISQUERYPROC __glewIsQuery;\r\nGLEW_FUN_EXPORT PFNGLMAPBUFFERPROC __glewMapBuffer;\r\nGLEW_FUN_EXPORT PFNGLUNMAPBUFFERPROC __glewUnmapBuffer;\r\n\r\nGLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader;\r\nGLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation;\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate;\r\nGLEW_FUN_EXPORT PFNGLCOMPILESHADERPROC __glewCompileShader;\r\nGLEW_FUN_EXPORT PFNGLCREATEPROGRAMPROC __glewCreateProgram;\r\nGLEW_FUN_EXPORT PFNGLCREATESHADERPROC __glewCreateShader;\r\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMPROC __glewDeleteProgram;\r\nGLEW_FUN_EXPORT PFNGLDELETESHADERPROC __glewDeleteShader;\r\nGLEW_FUN_EXPORT PFNGLDETACHSHADERPROC __glewDetachShader;\r\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray;\r\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERSPROC __glewDrawBuffers;\r\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform;\r\nGLEW_FUN_EXPORT PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders;\r\nGLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMIVPROC __glewGetProgramiv;\r\nGLEW_FUN_EXPORT PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog;\r\nGLEW_FUN_EXPORT PFNGLGETSHADERSOURCEPROC __glewGetShaderSource;\r\nGLEW_FUN_EXPORT PFNGLGETSHADERIVPROC __glewGetShaderiv;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMFVPROC __glewGetUniformfv;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMIVPROC __glewGetUniformiv;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv;\r\nGLEW_FUN_EXPORT PFNGLISPROGRAMPROC __glewIsProgram;\r\nGLEW_FUN_EXPORT PFNGLISSHADERPROC __glewIsShader;\r\nGLEW_FUN_EXPORT PFNGLLINKPROGRAMPROC __glewLinkProgram;\r\nGLEW_FUN_EXPORT PFNGLSHADERSOURCEPROC __glewShaderSource;\r\nGLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate;\r\nGLEW_FUN_EXPORT PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate;\r\nGLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1FPROC __glewUniform1f;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1FVPROC __glewUniform1fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1IPROC __glewUniform1i;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1IVPROC __glewUniform1iv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2FPROC __glewUniform2f;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2IPROC __glewUniform2i;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2IVPROC __glewUniform2iv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3FPROC __glewUniform3f;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3FVPROC __glewUniform3fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3IPROC __glewUniform3i;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3IVPROC __glewUniform3iv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4FPROC __glewUniform4f;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4FVPROC __glewUniform4fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4IPROC __glewUniform4i;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4IVPROC __glewUniform4iv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv;\r\nGLEW_FUN_EXPORT PFNGLUSEPROGRAMPROC __glewUseProgram;\r\nGLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPROC __glewValidateProgram;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer;\r\n\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender;\r\nGLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback;\r\nGLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation;\r\nGLEW_FUN_EXPORT PFNGLCLAMPCOLORPROC __glewClampColor;\r\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERFIPROC __glewClearBufferfi;\r\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERFVPROC __glewClearBufferfv;\r\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERIVPROC __glewClearBufferiv;\r\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv;\r\nGLEW_FUN_EXPORT PFNGLCOLORMASKIPROC __glewColorMaski;\r\nGLEW_FUN_EXPORT PFNGLDISABLEIPROC __glewDisablei;\r\nGLEW_FUN_EXPORT PFNGLENABLEIPROC __glewEnablei;\r\nGLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender;\r\nGLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback;\r\nGLEW_FUN_EXPORT PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation;\r\nGLEW_FUN_EXPORT PFNGLGETSTRINGIPROC __glewGetStringi;\r\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv;\r\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv;\r\nGLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv;\r\nGLEW_FUN_EXPORT PFNGLISENABLEDIPROC __glewIsEnabledi;\r\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv;\r\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv;\r\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIPROC __glewUniform1ui;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIVPROC __glewUniform1uiv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIPROC __glewUniform2ui;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIVPROC __glewUniform2uiv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIPROC __glewUniform3ui;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIVPROC __glewUniform3uiv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIPROC __glewUniform4ui;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIVPROC __glewUniform4uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced;\r\nGLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex;\r\nGLEW_FUN_EXPORT PFNGLTEXBUFFERPROC __glewTexBuffer;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v;\r\nGLEW_FUN_EXPORT PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v;\r\n\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei;\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONIPROC __glewBlendEquationi;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCIPROC __glewBlendFunci;\r\nGLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading;\r\n\r\nGLEW_FUN_EXPORT PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX;\r\n\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD;\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD;\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD;\r\nGLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD;\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD;\r\nGLEW_FUN_EXPORT PFNGLGENNAMESAMDPROC __glewGenNamesAMD;\r\nGLEW_FUN_EXPORT PFNGLISNAMEAMDPROC __glewIsNameAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD;\r\nGLEW_FUN_EXPORT PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD;\r\nGLEW_FUN_EXPORT PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD;\r\nGLEW_FUN_EXPORT PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD;\r\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD;\r\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD;\r\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD;\r\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD;\r\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD;\r\nGLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD;\r\nGLEW_FUN_EXPORT PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD;\r\nGLEW_FUN_EXPORT PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE;\r\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE;\r\nGLEW_FUN_EXPORT PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE;\r\nGLEW_FUN_EXPORT PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE;\r\nGLEW_FUN_EXPORT PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE;\r\nGLEW_FUN_EXPORT PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE;\r\nGLEW_FUN_EXPORT PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE;\r\nGLEW_FUN_EXPORT PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE;\r\nGLEW_FUN_EXPORT PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE;\r\nGLEW_FUN_EXPORT PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE;\r\nGLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE;\r\nGLEW_FUN_EXPORT PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE;\r\nGLEW_FUN_EXPORT PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE;\r\nGLEW_FUN_EXPORT PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE;\r\nGLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE;\r\nGLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE;\r\nGLEW_FUN_EXPORT PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE;\r\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE;\r\nGLEW_FUN_EXPORT PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE;\r\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE;\r\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE;\r\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE;\r\nGLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLEARDEPTHFPROC __glewClearDepthf;\r\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEFPROC __glewDepthRangef;\r\nGLEW_FUN_EXPORT PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat;\r\nGLEW_FUN_EXPORT PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler;\r\nGLEW_FUN_EXPORT PFNGLSHADERBINARYPROC __glewShaderBinary;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex;\r\n\r\nGLEW_FUN_EXPORT PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERDATAPROC __glewClearBufferData;\r\nGLEW_FUN_EXPORT PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData;\r\nGLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT;\r\nGLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLAMPCOLORARBPROC __glewClampColorARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute;\r\nGLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData;\r\n\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB;\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB;\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB;\r\nGLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB;\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB;\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex;\r\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri;\r\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer;\r\nGLEW_FUN_EXPORT PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer;\r\nGLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer;\r\nGLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;\r\nGLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;\r\nGLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;\r\nGLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers;\r\nGLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers;\r\nGLEW_FUN_EXPORT PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap;\r\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv;\r\nGLEW_FUN_EXPORT PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer;\r\nGLEW_FUN_EXPORT PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer;\r\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage;\r\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMBINARYPROC __glewProgramBinary;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMDVPROC __glewGetUniformdv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1DPROC __glewUniform1d;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1DVPROC __glewUniform1dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2DPROC __glewUniform2d;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2DVPROC __glewUniform2dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3DPROC __glewUniform3d;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3DVPROC __glewUniform3dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4DPROC __glewUniform4d;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4DVPROC __glewUniform4dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORSUBTABLEPROC __glewColorSubTable;\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPROC __glewColorTable;\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv;\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv;\r\nGLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable;\r\nGLEW_FUN_EXPORT PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable;\r\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D;\r\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPROC __glewGetColorTable;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter;\r\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv;\r\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPROC __glewGetHistogram;\r\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv;\r\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETMINMAXPROC __glewGetMinmax;\r\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv;\r\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv;\r\nGLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter;\r\nGLEW_FUN_EXPORT PFNGLHISTOGRAMPROC __glewHistogram;\r\nGLEW_FUN_EXPORT PFNGLMINMAXPROC __glewMinmax;\r\nGLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram;\r\nGLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax;\r\nGLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v;\r\n\r\nGLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData;\r\nGLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData;\r\nGLEW_FUN_EXPORT PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer;\r\nGLEW_FUN_EXPORT PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer;\r\nGLEW_FUN_EXPORT PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage;\r\nGLEW_FUN_EXPORT PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage;\r\n\r\nGLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange;\r\nGLEW_FUN_EXPORT PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange;\r\n\r\nGLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB;\r\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB;\r\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB;\r\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB;\r\nGLEW_FUN_EXPORT PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect;\r\n\r\nGLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB;\r\nGLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINQUERYARBPROC __glewBeginQueryARB;\r\nGLEW_FUN_EXPORT PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB;\r\nGLEW_FUN_EXPORT PFNGLENDQUERYARBPROC __glewEndQueryARB;\r\nGLEW_FUN_EXPORT PFNGLGENQUERIESARBPROC __glewGenQueriesARB;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYIVARBPROC __glewGetQueryivARB;\r\nGLEW_FUN_EXPORT PFNGLISQUERYARBPROC __glewIsQueryARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv;\r\n\r\nGLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB;\r\nGLEW_FUN_EXPORT PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB;\r\nGLEW_FUN_EXPORT PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB;\r\nGLEW_FUN_EXPORT PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB;\r\nGLEW_FUN_EXPORT PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB;\r\nGLEW_FUN_EXPORT PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB;\r\nGLEW_FUN_EXPORT PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETNMAPIVARBPROC __glewGetnMapivARB;\r\nGLEW_FUN_EXPORT PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB;\r\nGLEW_FUN_EXPORT PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB;\r\nGLEW_FUN_EXPORT PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB;\r\nGLEW_FUN_EXPORT PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB;\r\nGLEW_FUN_EXPORT PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB;\r\nGLEW_FUN_EXPORT PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB;\r\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB;\r\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB;\r\nGLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB;\r\nGLEW_FUN_EXPORT PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDSAMPLERPROC __glewBindSampler;\r\nGLEW_FUN_EXPORT PFNGLDELETESAMPLERSPROC __glewDeleteSamplers;\r\nGLEW_FUN_EXPORT PFNGLGENSAMPLERSPROC __glewGenSamplers;\r\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv;\r\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv;\r\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv;\r\nGLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv;\r\nGLEW_FUN_EXPORT PFNGLISSAMPLERPROC __glewIsSampler;\r\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv;\r\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv;\r\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf;\r\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv;\r\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri;\r\nGLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv;\r\n\r\nGLEW_FUN_EXPORT PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram;\r\nGLEW_FUN_EXPORT PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline;\r\nGLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv;\r\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines;\r\nGLEW_FUN_EXPORT PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv;\r\nGLEW_FUN_EXPORT PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv;\r\nGLEW_FUN_EXPORT PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages;\r\nGLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture;\r\nGLEW_FUN_EXPORT PFNGLMEMORYBARRIERPROC __glewMemoryBarrier;\r\n\r\nGLEW_FUN_EXPORT PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB;\r\nGLEW_FUN_EXPORT PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB;\r\nGLEW_FUN_EXPORT PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB;\r\nGLEW_FUN_EXPORT PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB;\r\nGLEW_FUN_EXPORT PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB;\r\nGLEW_FUN_EXPORT PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB;\r\nGLEW_FUN_EXPORT PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB;\r\nGLEW_FUN_EXPORT PFNGLGETHANDLEARBPROC __glewGetHandleARB;\r\nGLEW_FUN_EXPORT PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB;\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB;\r\nGLEW_FUN_EXPORT PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB;\r\nGLEW_FUN_EXPORT PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB;\r\nGLEW_FUN_EXPORT PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1FARBPROC __glewUniform1fARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1IARBPROC __glewUniform1iARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2FARBPROC __glewUniform2fARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2IARBPROC __glewUniform2iARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3FARBPROC __glewUniform3fARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3IARBPROC __glewUniform3iARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4FARBPROC __glewUniform4fARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4IARBPROC __glewUniform4iARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB;\r\nGLEW_FUN_EXPORT PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB;\r\nGLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv;\r\nGLEW_FUN_EXPORT PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex;\r\nGLEW_FUN_EXPORT PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB;\r\nGLEW_FUN_EXPORT PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB;\r\nGLEW_FUN_EXPORT PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB;\r\nGLEW_FUN_EXPORT PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync;\r\nGLEW_FUN_EXPORT PFNGLDELETESYNCPROC __glewDeleteSync;\r\nGLEW_FUN_EXPORT PFNGLFENCESYNCPROC __glewFenceSync;\r\nGLEW_FUN_EXPORT PFNGLGETINTEGER64VPROC __glewGetInteger64v;\r\nGLEW_FUN_EXPORT PFNGLGETSYNCIVPROC __glewGetSynciv;\r\nGLEW_FUN_EXPORT PFNGLISSYNCPROC __glewIsSync;\r\nGLEW_FUN_EXPORT PFNGLWAITSYNCPROC __glewWaitSync;\r\n\r\nGLEW_FUN_EXPORT PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv;\r\nGLEW_FUN_EXPORT PFNGLPATCHPARAMETERIPROC __glewPatchParameteri;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXBUFFERARBPROC __glewTexBufferARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB;\r\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv;\r\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKIPROC __glewSampleMaski;\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample;\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE1DPROC __glewTexStorage1D;\r\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE2DPROC __glewTexStorage2D;\r\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE3DPROC __glewTexStorage3D;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample;\r\nGLEW_FUN_EXPORT PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXTUREVIEWPROC __glewTextureView;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v;\r\nGLEW_FUN_EXPORT PFNGLQUERYCOUNTERPROC __glewQueryCounter;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback;\r\nGLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks;\r\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback;\r\nGLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks;\r\nGLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback;\r\nGLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback;\r\nGLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed;\r\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream;\r\nGLEW_FUN_EXPORT PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced;\r\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced;\r\n\r\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB;\r\nGLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB;\r\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB;\r\nGLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERBASEPROC __glewBindBufferBase;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv;\r\nGLEW_FUN_EXPORT PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray;\r\nGLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays;\r\nGLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays;\r\nGLEW_FUN_EXPORT PFNGLISVERTEXARRAYPROC __glewIsVertexArray;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat;\r\nGLEW_FUN_EXPORT PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor;\r\n\r\nGLEW_FUN_EXPORT PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTBVARBPROC __glewWeightbvARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTDVARBPROC __glewWeightdvARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTFVARBPROC __glewWeightfvARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTIVARBPROC __glewWeightivARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTSVARBPROC __glewWeightsvARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTUBVARBPROC __glewWeightubvARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTUIVARBPROC __glewWeightuivARB;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTUSVARBPROC __glewWeightusvARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERARBPROC __glewBindBufferARB;\r\nGLEW_FUN_EXPORT PFNGLBUFFERDATAARBPROC __glewBufferDataARB;\r\nGLEW_FUN_EXPORT PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB;\r\nGLEW_FUN_EXPORT PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB;\r\nGLEW_FUN_EXPORT PFNGLGENBUFFERSARBPROC __glewGenBuffersARB;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB;\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB;\r\nGLEW_FUN_EXPORT PFNGLISBUFFERARBPROC __glewIsBufferARB;\r\nGLEW_FUN_EXPORT PFNGLMAPBUFFERARBPROC __glewMapBufferARB;\r\nGLEW_FUN_EXPORT PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDPROGRAMARBPROC __glewBindProgramARB;\r\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB;\r\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB;\r\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB;\r\nGLEW_FUN_EXPORT PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB;\r\nGLEW_FUN_EXPORT PFNGLISPROGRAMARBPROC __glewIsProgramARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB;\r\nGLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORP3UIPROC __glewColorP3ui;\r\nGLEW_FUN_EXPORT PFNGLCOLORP3UIVPROC __glewColorP3uiv;\r\nGLEW_FUN_EXPORT PFNGLCOLORP4UIPROC __glewColorP4ui;\r\nGLEW_FUN_EXPORT PFNGLCOLORP4UIVPROC __glewColorP4uiv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv;\r\nGLEW_FUN_EXPORT PFNGLNORMALP3UIPROC __glewNormalP3ui;\r\nGLEW_FUN_EXPORT PFNGLNORMALP3UIVPROC __glewNormalP3uiv;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXP2UIPROC __glewVertexP2ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXP2UIVPROC __glewVertexP2uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXP3UIPROC __glewVertexP3ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXP3UIVPROC __glewVertexP3uiv;\r\nGLEW_FUN_EXPORT PFNGLVERTEXP4UIPROC __glewVertexP4ui;\r\nGLEW_FUN_EXPORT PFNGLVERTEXP4UIVPROC __glewVertexP4uiv;\r\n\r\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv;\r\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed;\r\nGLEW_FUN_EXPORT PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v;\r\nGLEW_FUN_EXPORT PFNGLGETFLOATI_VPROC __glewGetFloati_v;\r\nGLEW_FUN_EXPORT PFNGLSCISSORARRAYVPROC __glewScissorArrayv;\r\nGLEW_FUN_EXPORT PFNGLSCISSORINDEXEDPROC __glewScissorIndexed;\r\nGLEW_FUN_EXPORT PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv;\r\nGLEW_FUN_EXPORT PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv;\r\nGLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf;\r\nGLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv;\r\n\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI;\r\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI;\r\nGLEW_FUN_EXPORT PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI;\r\nGLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI;\r\nGLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI;\r\nGLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI;\r\nGLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI;\r\nGLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI;\r\nGLEW_FUN_EXPORT PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI;\r\nGLEW_FUN_EXPORT PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI;\r\nGLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI;\r\nGLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI;\r\nGLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI;\r\nGLEW_FUN_EXPORT PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI;\r\nGLEW_FUN_EXPORT PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI;\r\nGLEW_FUN_EXPORT PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI;\r\nGLEW_FUN_EXPORT PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI;\r\nGLEW_FUN_EXPORT PFNGLSAMPLEMAPATIPROC __glewSampleMapATI;\r\nGLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI;\r\nGLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI;\r\nGLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI;\r\nGLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI;\r\nGLEW_FUN_EXPORT PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI;\r\nGLEW_FUN_EXPORT PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI;\r\nGLEW_FUN_EXPORT PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI;\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI;\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI;\r\nGLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI;\r\nGLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI;\r\nGLEW_FUN_EXPORT PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI;\r\nGLEW_FUN_EXPORT PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI;\r\nGLEW_FUN_EXPORT PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI;\r\nGLEW_FUN_EXPORT PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI;\r\nGLEW_FUN_EXPORT PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI;\r\nGLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT;\r\nGLEW_FUN_EXPORT PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT;\r\nGLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT;\r\nGLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT;\r\nGLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT;\r\nGLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT;\r\nGLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT;\r\nGLEW_FUN_EXPORT PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT;\r\nGLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT;\r\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT;\r\nGLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT;\r\nGLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT;\r\nGLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT;\r\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT;\r\nGLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT;\r\nGLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT;\r\nGLEW_FUN_EXPORT PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT;\r\nGLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT;\r\nGLEW_FUN_EXPORT PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT;\r\nGLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT;\r\nGLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT;\r\nGLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT;\r\nGLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DEXTPROC __glewProgramUniform1dEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVEXTPROC __glewProgramUniform1dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DEXTPROC __glewProgramUniform2dEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVEXTPROC __glewProgramUniform2dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DEXTPROC __glewProgramUniform3dEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVEXTPROC __glewProgramUniform3dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DEXTPROC __glewProgramUniform4dEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVEXTPROC __glewProgramUniform4dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC __glewProgramUniformMatrix2dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC __glewProgramUniformMatrix2x3dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC __glewProgramUniformMatrix2x4dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC __glewProgramUniformMatrix3dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC __glewProgramUniformMatrix3x2dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC __glewProgramUniformMatrix3x4dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC __glewProgramUniformMatrix4dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC __glewProgramUniformMatrix4x2dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC __glewProgramUniformMatrix4x3dvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT;\r\nGLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT;\r\nGLEW_FUN_EXPORT PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT;\r\nGLEW_FUN_EXPORT PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT;\r\nGLEW_FUN_EXPORT PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT;\r\nGLEW_FUN_EXPORT PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT;\r\nGLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT;\r\nGLEW_FUN_EXPORT PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT;\r\nGLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT;\r\nGLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT;\r\nGLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT;\r\nGLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT;\r\nGLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT;\r\nGLEW_FUN_EXPORT PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT;\r\nGLEW_FUN_EXPORT PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT;\r\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT;\r\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLHISTOGRAMEXTPROC __glewHistogramEXT;\r\nGLEW_FUN_EXPORT PFNGLMINMAXEXTPROC __glewMinmaxEXT;\r\nGLEW_FUN_EXPORT PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT;\r\nGLEW_FUN_EXPORT PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT;\r\nGLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT;\r\nGLEW_FUN_EXPORT PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLEEXTPROC __glewColorTableEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT;\r\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT;\r\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT;\r\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT;\r\nGLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT;\r\nGLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT;\r\nGLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT;\r\nGLEW_FUN_EXPORT PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT;\r\nGLEW_FUN_EXPORT PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT;\r\nGLEW_FUN_EXPORT PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT;\r\nGLEW_FUN_EXPORT PFNGLISTEXTUREEXTPROC __glewIsTextureEXT;\r\nGLEW_FUN_EXPORT PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT;\r\nGLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT;\r\nGLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT;\r\nGLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT;\r\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT;\r\nGLEW_FUN_EXPORT PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT;\r\nGLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT;\r\nGLEW_FUN_EXPORT PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT;\r\nGLEW_FUN_EXPORT PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT;\r\nGLEW_FUN_EXPORT PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT;\r\nGLEW_FUN_EXPORT PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT;\r\nGLEW_FUN_EXPORT PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT;\r\nGLEW_FUN_EXPORT PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT;\r\nGLEW_FUN_EXPORT PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT;\r\nGLEW_FUN_EXPORT PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT;\r\nGLEW_FUN_EXPORT PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT;\r\nGLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT;\r\nGLEW_FUN_EXPORT PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT;\r\nGLEW_FUN_EXPORT PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT;\r\nGLEW_FUN_EXPORT PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT;\r\nGLEW_FUN_EXPORT PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT;\r\nGLEW_FUN_EXPORT PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT;\r\nGLEW_FUN_EXPORT PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT;\r\nGLEW_FUN_EXPORT PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT;\r\nGLEW_FUN_EXPORT PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT;\r\nGLEW_FUN_EXPORT PFNGLSWIZZLEEXTPROC __glewSwizzleEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTBVEXTPROC __glewVariantbvEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTDVEXTPROC __glewVariantdvEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTFVEXTPROC __glewVariantfvEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTIVEXTPROC __glewVariantivEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTSVEXTPROC __glewVariantsvEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT;\r\nGLEW_FUN_EXPORT PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT;\r\nGLEW_FUN_EXPORT PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT;\r\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY;\r\n\r\nGLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP;\r\nGLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP;\r\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP;\r\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP;\r\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP;\r\nGLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP;\r\n\r\nGLEW_FUN_EXPORT PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM;\r\nGLEW_FUN_EXPORT PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM;\r\nGLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL;\r\nGLEW_FUN_EXPORT PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL;\r\nGLEW_FUN_EXPORT PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL;\r\nGLEW_FUN_EXPORT PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL;\r\n\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback;\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl;\r\nGLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert;\r\nGLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog;\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTLABELPROC __glewGetObjectLabel;\r\nGLEW_FUN_EXPORT PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel;\r\nGLEW_FUN_EXPORT PFNGLGETPOINTERVPROC __glewGetPointerv;\r\nGLEW_FUN_EXPORT PFNGLOBJECTLABELPROC __glewObjectLabel;\r\nGLEW_FUN_EXPORT PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel;\r\nGLEW_FUN_EXPORT PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup;\r\n\r\nGLEW_FUN_EXPORT PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled;\r\nGLEW_FUN_EXPORT PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion;\r\nGLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion;\r\nGLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion;\r\nGLEW_FUN_EXPORT PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion;\r\n\r\nGLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA;\r\n\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA;\r\nGLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV;\r\nGLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV;\r\nGLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV;\r\nGLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV;\r\nGLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV;\r\nGLEW_FUN_EXPORT PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV;\r\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV;\r\nGLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV;\r\nGLEW_FUN_EXPORT PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV;\r\nGLEW_FUN_EXPORT PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV;\r\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV;\r\nGLEW_FUN_EXPORT PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV;\r\nGLEW_FUN_EXPORT PFNGLFINISHFENCENVPROC __glewFinishFenceNV;\r\nGLEW_FUN_EXPORT PFNGLGENFENCESNVPROC __glewGenFencesNV;\r\nGLEW_FUN_EXPORT PFNGLGETFENCEIVNVPROC __glewGetFenceivNV;\r\nGLEW_FUN_EXPORT PFNGLISFENCENVPROC __glewIsFenceNV;\r\nGLEW_FUN_EXPORT PFNGLSETFENCENVPROC __glewSetFenceNV;\r\nGLEW_FUN_EXPORT PFNGLTESTFENCENVPROC __glewTestFenceNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV;\r\nGLEW_FUN_EXPORT PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLOR3HNVPROC __glewColor3hNV;\r\nGLEW_FUN_EXPORT PFNGLCOLOR3HVNVPROC __glewColor3hvNV;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4HNVPROC __glewColor4hNV;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4HVNVPROC __glewColor4hvNV;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDHNVPROC __glewFogCoordhNV;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV;\r\nGLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV;\r\nGLEW_FUN_EXPORT PFNGLNORMAL3HNVPROC __glewNormal3hNV;\r\nGLEW_FUN_EXPORT PFNGLNORMAL3HVNVPROC __glewNormal3hvNV;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEX2HNVPROC __glewVertex2hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEX2HVNVPROC __glewVertex2hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEX3HNVPROC __glewVertex3hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEX3HVNVPROC __glewVertex3hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEX4HNVPROC __glewVertex4hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEX4HVNVPROC __glewVertex4hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV;\r\nGLEW_FUN_EXPORT PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV;\r\nGLEW_FUN_EXPORT PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV;\r\nGLEW_FUN_EXPORT PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV;\r\nGLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV;\r\nGLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV;\r\nGLEW_FUN_EXPORT PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOPYPATHNVPROC __glewCopyPathNV;\r\nGLEW_FUN_EXPORT PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV;\r\nGLEW_FUN_EXPORT PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV;\r\nGLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV;\r\nGLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV;\r\nGLEW_FUN_EXPORT PFNGLDELETEPATHSNVPROC __glewDeletePathsNV;\r\nGLEW_FUN_EXPORT PFNGLGENPATHSNVPROC __glewGenPathsNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV;\r\nGLEW_FUN_EXPORT PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV;\r\nGLEW_FUN_EXPORT PFNGLISPATHNVPROC __glewIsPathNV;\r\nGLEW_FUN_EXPORT PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV;\r\nGLEW_FUN_EXPORT PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV;\r\nGLEW_FUN_EXPORT PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV;\r\nGLEW_FUN_EXPORT PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV;\r\nGLEW_FUN_EXPORT PFNGLPATHCOORDSNVPROC __glewPathCoordsNV;\r\nGLEW_FUN_EXPORT PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV;\r\nGLEW_FUN_EXPORT PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV;\r\nGLEW_FUN_EXPORT PFNGLPATHFOGGENNVPROC __glewPathFogGenNV;\r\nGLEW_FUN_EXPORT PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV;\r\nGLEW_FUN_EXPORT PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV;\r\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV;\r\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV;\r\nGLEW_FUN_EXPORT PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV;\r\nGLEW_FUN_EXPORT PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV;\r\nGLEW_FUN_EXPORT PFNGLPATHSTRINGNVPROC __glewPathStringNV;\r\nGLEW_FUN_EXPORT PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV;\r\nGLEW_FUN_EXPORT PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV;\r\nGLEW_FUN_EXPORT PFNGLPATHTEXGENNVPROC __glewPathTexGenNV;\r\nGLEW_FUN_EXPORT PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV;\r\nGLEW_FUN_EXPORT PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV;\r\nGLEW_FUN_EXPORT PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV;\r\nGLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV;\r\nGLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV;\r\nGLEW_FUN_EXPORT PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV;\r\nGLEW_FUN_EXPORT PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV;\r\nGLEW_FUN_EXPORT PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV;\r\nGLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV;\r\nGLEW_FUN_EXPORT PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV;\r\nGLEW_FUN_EXPORT PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV;\r\nGLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV;\r\nGLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV;\r\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV;\r\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV;\r\nGLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV;\r\nGLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV;\r\nGLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV;\r\nGLEW_FUN_EXPORT PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV;\r\nGLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV;\r\nGLEW_FUN_EXPORT PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV;\r\nGLEW_FUN_EXPORT PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV;\r\nGLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMUI64NVPROC __glewUniformui64NV;\r\nGLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV;\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV;\r\nGLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV;\r\nGLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV;\r\nGLEW_FUN_EXPORT PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV;\r\nGLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV;\r\nGLEW_FUN_EXPORT PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV;\r\nGLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV;\r\nGLEW_FUN_EXPORT PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV;\r\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV;\r\nGLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV;\r\nGLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV;\r\nGLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV;\r\nGLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV;\r\nGLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV;\r\nGLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV;\r\nGLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLVDPAUFININVPROC __glewVDPAUFiniNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUINITNVPROC __glewVDPAUInitNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV;\r\nGLEW_FUN_EXPORT PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV;\r\nGLEW_FUN_EXPORT PFNGLCOLORFORMATNVPROC __glewColorFormatNV;\r\nGLEW_FUN_EXPORT PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV;\r\nGLEW_FUN_EXPORT PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV;\r\nGLEW_FUN_EXPORT PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV;\r\nGLEW_FUN_EXPORT PFNGLINDEXFORMATNVPROC __glewIndexFormatNV;\r\nGLEW_FUN_EXPORT PFNGLNORMALFORMATNVPROC __glewNormalFormatNV;\r\nGLEW_FUN_EXPORT PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV;\r\nGLEW_FUN_EXPORT PFNGLBINDPROGRAMNVPROC __glewBindProgramNV;\r\nGLEW_FUN_EXPORT PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV;\r\nGLEW_FUN_EXPORT PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV;\r\nGLEW_FUN_EXPORT PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV;\r\nGLEW_FUN_EXPORT PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV;\r\nGLEW_FUN_EXPORT PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV;\r\nGLEW_FUN_EXPORT PFNGLISPROGRAMNVPROC __glewIsProgramNV;\r\nGLEW_FUN_EXPORT PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV;\r\nGLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV;\r\nGLEW_FUN_EXPORT PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV;\r\nGLEW_FUN_EXPORT PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV;\r\nGLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV;\r\nGLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV;\r\nGLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV;\r\nGLEW_FUN_EXPORT PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV;\r\nGLEW_FUN_EXPORT PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV;\r\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV;\r\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV;\r\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV;\r\nGLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV;\r\n\r\nGLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES;\r\nGLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES;\r\nGLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES;\r\nGLEW_FUN_EXPORT PFNGLFRUSTUMFOESPROC __glewFrustumfOES;\r\nGLEW_FUN_EXPORT PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES;\r\nGLEW_FUN_EXPORT PFNGLORTHOFOESPROC __glewOrthofOES;\r\n\r\nGLEW_FUN_EXPORT PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL;\r\nGLEW_FUN_EXPORT PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL;\r\n\r\nGLEW_FUN_EXPORT PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS;\r\nGLEW_FUN_EXPORT PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS;\r\n\r\nGLEW_FUN_EXPORT PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS;\r\nGLEW_FUN_EXPORT PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS;\r\n\r\nGLEW_FUN_EXPORT PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS;\r\nGLEW_FUN_EXPORT PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS;\r\nGLEW_FUN_EXPORT PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS;\r\nGLEW_FUN_EXPORT PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS;\r\n\r\nGLEW_FUN_EXPORT PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS;\r\nGLEW_FUN_EXPORT PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS;\r\n\r\nGLEW_FUN_EXPORT PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX;\r\nGLEW_FUN_EXPORT PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX;\r\nGLEW_FUN_EXPORT PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX;\r\nGLEW_FUN_EXPORT PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX;\r\nGLEW_FUN_EXPORT PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX;\r\nGLEW_FUN_EXPORT PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX;\r\nGLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX;\r\nGLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX;\r\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX;\r\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX;\r\nGLEW_FUN_EXPORT PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI;\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI;\r\nGLEW_FUN_EXPORT PFNGLCOLORTABLESGIPROC __glewColorTableSGI;\r\nGLEW_FUN_EXPORT PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI;\r\nGLEW_FUN_EXPORT PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI;\r\n\r\nGLEW_FUN_EXPORT PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX;\r\n\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN;\r\nGLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN;\r\n\r\nGLEW_FUN_EXPORT PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN;\r\n\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN;\r\n\r\nGLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN;\r\nGLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN;\r\n\r\nGLEW_FUN_EXPORT PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN;\r\n\r\n#if defined(GLEW_MX) && !defined(_WIN32)\r\nstruct GLEWContextStruct\r\n{\r\n#endif /* GLEW_MX */\r\n\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_0;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_0;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_blend_minmax_factor;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_multi_draw_indirect;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_name_gen_delete;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_performance_monitor;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_pinned_memory;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_query_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_sample_positions;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_stencil_operation_extended;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_texture_texture4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback3_lines_triangles;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_layer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_tessellator;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_viewport_index;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_aux_depth_stencil;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_client_storage;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_element_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_fence;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_float_pixels;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_flush_buffer_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_object_purgeable;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_pixel_buffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_rgb_422;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_row_bytes;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_specular_vector;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_texture_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_transform_hint;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_program_evaluators;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_APPLE_ycbcr_422;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES2_compatibility;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_compatibility;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_arrays_of_arrays;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_base_instance;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_blend_func_extended;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_cl_event;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_color_buffer_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_compatibility;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_compressed_texture_pixel_storage;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_conservative_depth;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_buffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_image;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_debug_output;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_buffer_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers_blend;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_elements_base_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_indirect;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_instanced;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_attrib_location;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_uniform_location;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_coord_conventions;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_layer_viewport;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program_shadow;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_no_attachments;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_sRGB;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_geometry_shader4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_program_binary;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader5;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_fp64;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_pixel;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_imaging;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_instanced_arrays;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_invalidate_subdata;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_alignment;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_matrix_palette;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_draw_indirect;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_multitexture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_pixel_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_parameters;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_sprite;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_program_interface_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_provoking_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robust_buffer_access_behavior;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_application_isolation;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_share_group_isolation;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_sample_shading;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_sampler_objects;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cube_map;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_separate_shader_objects;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_atomic_counters;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_bit_encoding;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_load_store;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_size;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_objects;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_precision;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_stencil_export;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_storage_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_subroutine;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_lod;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_100;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_420pack;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_include;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_packing;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow_ambient;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_stencil_texturing;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_sync;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_tessellation_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_border_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object_rgb32;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_bptc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_rgtc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_add;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_combine;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_crossbar;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_dot3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_gather;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirrored_repeat;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_non_power_of_two;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_levels;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_lod;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rectangle;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rg;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rgb10_a2ui;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_swizzle;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_view;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_timer_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_instanced;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_transpose_matrix;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_uniform_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_bgra;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_64bit;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_binding;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_blend;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_program;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_viewport_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ARB_window_pos;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATIX_vertex_shader_output_point_size;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_draw_buffers;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_element_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_envmap_bumpmap;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_fragment_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_map_object_buffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_meminfo;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_pn_triangles;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_separate_stencil;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_shader_texture_lod;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_text_fragment_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_compression_3dc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_env_combine3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_bgra;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_bindable_uniform;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_color;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_equation_separate;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_func_separate;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_logic_op;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_color_subtable;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_compiled_vertex_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_instanced;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_fragment_lighting;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_blit;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_sRGB;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_geometry_shader4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_program_parameters;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_shader4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_histogram;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_array_formats;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_func;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_material;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_light_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_misc_attribute;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_multi_draw_arrays;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_paletted_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform_color_table;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_provoking_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_secondary_color;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_shader_objects;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_store;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_funcs;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_latc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_rgtc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_add;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_combine;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_integer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_decode;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shared_exponent;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_snorm;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_swizzle;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_timer_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_transform_feedback;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array_bgra;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_attrib_64bit;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_image_transform;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_occlusion_test;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_HP_texture_lighting;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_cull_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_multimode_draw_arrays;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_KHR_debug;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_ldr;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_conditional_render;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_image;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_buffer_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_range_unclamped;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_explicit_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fence;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_float_buffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fog_distance;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_multisample_coverage;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_program4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program_fp64;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_shader5;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_half_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_coverage;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_occlusion_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_packed_depth_stencil;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_pixel_data_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_present_video;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_buffer_load;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_tessellation_program5;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_barrier;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_attrib_integer_64bit;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_buffer_unified_memory;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program1_1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OES_single_precision;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OML_resample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_REGAL_error_string;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_REGAL_extension_query;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_REGAL_log;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_REND_screen_coordinates;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_S3_s3tc;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_color_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_detail_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_fog_function;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_generate_mipmap;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_multisample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_pixel_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_point_line_texgen;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_sharpen_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture4D;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_border_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_edge_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_filter4;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_lod;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_select;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_histogram;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_pixel;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_blend_alpha_minmax;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_clipmap;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_convolution_accuracy;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_depth_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_flush_raster;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_offset;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fragment_specular_lighting;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_framezoom;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_interlace;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ir_instrument1;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_list_priority;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture_bits;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_reference_plane;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_resample;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow_ambient;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_sprite;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_tag_sample_buffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_add_env;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_coordinate_clamp;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_lod_bias;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_multi_buffer;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_range;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_scale_bias;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip_hint;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ycrcb;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_matrix;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_table;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SGI_texture_color_table;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUNX_constant_data;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_convolution_border_modes;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_global_alpha;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_mesh_array;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog;\r\nGLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint;\r\n\r\n#ifdef GLEW_MX\r\n}; /* GLEWContextStruct */\r\n#endif /* GLEW_MX */\r\n\r\n/* ------------------------------------------------------------------------- */\r\n\r\n/* error codes */\r\n#define GLEW_OK 0\r\n#define GLEW_NO_ERROR 0\r\n#define GLEW_ERROR_NO_GL_VERSION 1  /* missing GL version */\r\n#define GLEW_ERROR_GL_VERSION_10_ONLY 2  /* Need at least OpenGL 1.1 */\r\n#define GLEW_ERROR_GLX_VERSION_11_ONLY 3  /* Need at least GLX 1.2 */\r\n\r\n/* string codes */\r\n#define GLEW_VERSION 1\r\n#define GLEW_VERSION_MAJOR 2\r\n#define GLEW_VERSION_MINOR 3\r\n#define GLEW_VERSION_MICRO 4\r\n\r\n/* API */\r\n#ifdef GLEW_MX\r\n\r\ntypedef struct GLEWContextStruct GLEWContext;\r\nGLEWAPI GLenum GLEWAPIENTRY glewContextInit (GLEWContext *ctx);\r\nGLEWAPI GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext *ctx, const char *name);\r\n\r\n#define glewInit() glewContextInit(glewGetContext())\r\n#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)\r\n#define glewIsExtensionSupported(x) glewIsSupported(x)\r\n\r\n#define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x))\r\n#ifdef _WIN32\r\n#  define GLEW_GET_FUN(x) glewGetContext()->x\r\n#else\r\n#  define GLEW_GET_FUN(x) x\r\n#endif\r\n\r\n#else /* GLEW_MX */\r\n\r\nGLEWAPI GLenum GLEWAPIENTRY glewInit (void);\r\nGLEWAPI GLboolean GLEWAPIENTRY glewIsSupported (const char *name);\r\n#define glewIsExtensionSupported(x) glewIsSupported(x)\r\n\r\n#define GLEW_GET_VAR(x) (*(const GLboolean*)&x)\r\n#define GLEW_GET_FUN(x) x\r\n\r\n#endif /* GLEW_MX */\r\n\r\nGLEWAPI GLboolean glewExperimental;\r\nGLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name);\r\nGLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error);\r\nGLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#ifdef GLEW_APIENTRY_DEFINED\r\n#undef GLEW_APIENTRY_DEFINED\r\n#undef APIENTRY\r\n#undef GLAPIENTRY\r\n#define GLAPIENTRY\r\n#endif\r\n\r\n#ifdef GLEW_CALLBACK_DEFINED\r\n#undef GLEW_CALLBACK_DEFINED\r\n#undef CALLBACK\r\n#endif\r\n\r\n#ifdef GLEW_WINGDIAPI_DEFINED\r\n#undef GLEW_WINGDIAPI_DEFINED\r\n#undef WINGDIAPI\r\n#endif\r\n\r\n#undef GLAPI\r\n/* #undef GLEWAPI */\r\n\r\n#endif /* __glew_h__ */\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/glext.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __glext_h_\r\n#define __glext_h_\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/*\r\n** THIS FILE IS OBSOLETE. Please migrate away from using the\r\n** \".spec\" files and the headers generated from them to the\r\n** XML Registry and headers generated from that. See\r\n**   http://www.opengl.org/registry/api/README.txt\r\n** for more information.\r\n** \r\n** \r\n** Copyright (c) 2007-2013 The Khronos Group Inc.\r\n** \r\n** Permission is hereby granted, free of charge, to any person obtaining a\r\n** copy of this software and/or associated documentation files (the\r\n** \"Materials\"), to deal in the Materials without restriction, including\r\n** without limitation the rights to use, copy, modify, merge, publish,\r\n** distribute, sublicense, and/or sell copies of the Materials, and to\r\n** permit persons to whom the Materials are furnished to do so, subject to\r\n** the following conditions:\r\n** \r\n** The above copyright notice and this permission notice shall be included\r\n** in all copies or substantial portions of the Materials.\r\n** \r\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\r\n*/\r\n\r\n/* Header file version number, required by OpenGL ABI for Linux */\r\n/* glext.h last updated $Date: 2013-06-13 02:52:31 -0700 (Thu, 13 Jun 2013) $ */\r\n/* Current version at http://www.opengl.org/registry/ */\r\n#define GL_GLEXT_VERSION 87\r\n/* Function declaration macros - to move into glplatform.h */\r\n\r\n#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)\r\n#define WIN32_LEAN_AND_MEAN 1\r\n#include <windows.h>\r\n#endif\r\n\r\n#ifndef APIENTRY\r\n#define APIENTRY\r\n#endif\r\n#ifndef APIENTRYP\r\n#define APIENTRYP APIENTRY *\r\n#endif\r\n#ifndef GLAPI\r\n#define GLAPI extern\r\n#endif\r\n\r\n/*************************************************************/\r\n\r\n#ifndef GL_VERSION_1_2\r\n#define GL_UNSIGNED_BYTE_3_3_2            0x8032\r\n#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033\r\n#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034\r\n#define GL_UNSIGNED_INT_8_8_8_8           0x8035\r\n#define GL_UNSIGNED_INT_10_10_10_2        0x8036\r\n#define GL_TEXTURE_BINDING_3D             0x806A\r\n#define GL_PACK_SKIP_IMAGES               0x806B\r\n#define GL_PACK_IMAGE_HEIGHT              0x806C\r\n#define GL_UNPACK_SKIP_IMAGES             0x806D\r\n#define GL_UNPACK_IMAGE_HEIGHT            0x806E\r\n#define GL_TEXTURE_3D                     0x806F\r\n#define GL_PROXY_TEXTURE_3D               0x8070\r\n#define GL_TEXTURE_DEPTH                  0x8071\r\n#define GL_TEXTURE_WRAP_R                 0x8072\r\n#define GL_MAX_3D_TEXTURE_SIZE            0x8073\r\n#define GL_UNSIGNED_BYTE_2_3_3_REV        0x8362\r\n#define GL_UNSIGNED_SHORT_5_6_5           0x8363\r\n#define GL_UNSIGNED_SHORT_5_6_5_REV       0x8364\r\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV     0x8365\r\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV     0x8366\r\n#define GL_UNSIGNED_INT_8_8_8_8_REV       0x8367\r\n#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368\r\n#define GL_BGR                            0x80E0\r\n#define GL_BGRA                           0x80E1\r\n#define GL_MAX_ELEMENTS_VERTICES          0x80E8\r\n#define GL_MAX_ELEMENTS_INDICES           0x80E9\r\n#define GL_CLAMP_TO_EDGE                  0x812F\r\n#define GL_TEXTURE_MIN_LOD                0x813A\r\n#define GL_TEXTURE_MAX_LOD                0x813B\r\n#define GL_TEXTURE_BASE_LEVEL             0x813C\r\n#define GL_TEXTURE_MAX_LEVEL              0x813D\r\n#define GL_SMOOTH_POINT_SIZE_RANGE        0x0B12\r\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY  0x0B13\r\n#define GL_SMOOTH_LINE_WIDTH_RANGE        0x0B22\r\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY  0x0B23\r\n#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E\r\n#define GL_RESCALE_NORMAL                 0x803A\r\n#define GL_LIGHT_MODEL_COLOR_CONTROL      0x81F8\r\n#define GL_SINGLE_COLOR                   0x81F9\r\n#define GL_SEPARATE_SPECULAR_COLOR        0x81FA\r\n#define GL_ALIASED_POINT_SIZE_RANGE       0x846D\r\n#endif\r\n\r\n#ifndef GL_ARB_imaging\r\n#define GL_CONSTANT_COLOR                 0x8001\r\n#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002\r\n#define GL_CONSTANT_ALPHA                 0x8003\r\n#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004\r\n#define GL_BLEND_COLOR                    0x8005\r\n#define GL_FUNC_ADD                       0x8006\r\n#define GL_MIN                            0x8007\r\n#define GL_MAX                            0x8008\r\n#define GL_BLEND_EQUATION                 0x8009\r\n#define GL_FUNC_SUBTRACT                  0x800A\r\n#define GL_FUNC_REVERSE_SUBTRACT          0x800B\r\n#define GL_CONVOLUTION_1D                 0x8010\r\n#define GL_CONVOLUTION_2D                 0x8011\r\n#define GL_SEPARABLE_2D                   0x8012\r\n#define GL_CONVOLUTION_BORDER_MODE        0x8013\r\n#define GL_CONVOLUTION_FILTER_SCALE       0x8014\r\n#define GL_CONVOLUTION_FILTER_BIAS        0x8015\r\n#define GL_REDUCE                         0x8016\r\n#define GL_CONVOLUTION_FORMAT             0x8017\r\n#define GL_CONVOLUTION_WIDTH              0x8018\r\n#define GL_CONVOLUTION_HEIGHT             0x8019\r\n#define GL_MAX_CONVOLUTION_WIDTH          0x801A\r\n#define GL_MAX_CONVOLUTION_HEIGHT         0x801B\r\n#define GL_POST_CONVOLUTION_RED_SCALE     0x801C\r\n#define GL_POST_CONVOLUTION_GREEN_SCALE   0x801D\r\n#define GL_POST_CONVOLUTION_BLUE_SCALE    0x801E\r\n#define GL_POST_CONVOLUTION_ALPHA_SCALE   0x801F\r\n#define GL_POST_CONVOLUTION_RED_BIAS      0x8020\r\n#define GL_POST_CONVOLUTION_GREEN_BIAS    0x8021\r\n#define GL_POST_CONVOLUTION_BLUE_BIAS     0x8022\r\n#define GL_POST_CONVOLUTION_ALPHA_BIAS    0x8023\r\n#define GL_HISTOGRAM                      0x8024\r\n#define GL_PROXY_HISTOGRAM                0x8025\r\n#define GL_HISTOGRAM_WIDTH                0x8026\r\n#define GL_HISTOGRAM_FORMAT               0x8027\r\n#define GL_HISTOGRAM_RED_SIZE             0x8028\r\n#define GL_HISTOGRAM_GREEN_SIZE           0x8029\r\n#define GL_HISTOGRAM_BLUE_SIZE            0x802A\r\n#define GL_HISTOGRAM_ALPHA_SIZE           0x802B\r\n#define GL_HISTOGRAM_LUMINANCE_SIZE       0x802C\r\n#define GL_HISTOGRAM_SINK                 0x802D\r\n#define GL_MINMAX                         0x802E\r\n#define GL_MINMAX_FORMAT                  0x802F\r\n#define GL_MINMAX_SINK                    0x8030\r\n#define GL_TABLE_TOO_LARGE                0x8031\r\n#define GL_COLOR_MATRIX                   0x80B1\r\n#define GL_COLOR_MATRIX_STACK_DEPTH       0x80B2\r\n#define GL_MAX_COLOR_MATRIX_STACK_DEPTH   0x80B3\r\n#define GL_POST_COLOR_MATRIX_RED_SCALE    0x80B4\r\n#define GL_POST_COLOR_MATRIX_GREEN_SCALE  0x80B5\r\n#define GL_POST_COLOR_MATRIX_BLUE_SCALE   0x80B6\r\n#define GL_POST_COLOR_MATRIX_ALPHA_SCALE  0x80B7\r\n#define GL_POST_COLOR_MATRIX_RED_BIAS     0x80B8\r\n#define GL_POST_COLOR_MATRIX_GREEN_BIAS   0x80B9\r\n#define GL_POST_COLOR_MATRIX_BLUE_BIAS    0x80BA\r\n#define GL_POST_COLOR_MATRIX_ALPHA_BIAS   0x80BB\r\n#define GL_COLOR_TABLE                    0x80D0\r\n#define GL_POST_CONVOLUTION_COLOR_TABLE   0x80D1\r\n#define GL_POST_COLOR_MATRIX_COLOR_TABLE  0x80D2\r\n#define GL_PROXY_COLOR_TABLE              0x80D3\r\n#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4\r\n#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5\r\n#define GL_COLOR_TABLE_SCALE              0x80D6\r\n#define GL_COLOR_TABLE_BIAS               0x80D7\r\n#define GL_COLOR_TABLE_FORMAT             0x80D8\r\n#define GL_COLOR_TABLE_WIDTH              0x80D9\r\n#define GL_COLOR_TABLE_RED_SIZE           0x80DA\r\n#define GL_COLOR_TABLE_GREEN_SIZE         0x80DB\r\n#define GL_COLOR_TABLE_BLUE_SIZE          0x80DC\r\n#define GL_COLOR_TABLE_ALPHA_SIZE         0x80DD\r\n#define GL_COLOR_TABLE_LUMINANCE_SIZE     0x80DE\r\n#define GL_COLOR_TABLE_INTENSITY_SIZE     0x80DF\r\n#define GL_CONSTANT_BORDER                0x8151\r\n#define GL_REPLICATE_BORDER               0x8153\r\n#define GL_CONVOLUTION_BORDER_COLOR       0x8154\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_3\r\n#define GL_TEXTURE0                       0x84C0\r\n#define GL_TEXTURE1                       0x84C1\r\n#define GL_TEXTURE2                       0x84C2\r\n#define GL_TEXTURE3                       0x84C3\r\n#define GL_TEXTURE4                       0x84C4\r\n#define GL_TEXTURE5                       0x84C5\r\n#define GL_TEXTURE6                       0x84C6\r\n#define GL_TEXTURE7                       0x84C7\r\n#define GL_TEXTURE8                       0x84C8\r\n#define GL_TEXTURE9                       0x84C9\r\n#define GL_TEXTURE10                      0x84CA\r\n#define GL_TEXTURE11                      0x84CB\r\n#define GL_TEXTURE12                      0x84CC\r\n#define GL_TEXTURE13                      0x84CD\r\n#define GL_TEXTURE14                      0x84CE\r\n#define GL_TEXTURE15                      0x84CF\r\n#define GL_TEXTURE16                      0x84D0\r\n#define GL_TEXTURE17                      0x84D1\r\n#define GL_TEXTURE18                      0x84D2\r\n#define GL_TEXTURE19                      0x84D3\r\n#define GL_TEXTURE20                      0x84D4\r\n#define GL_TEXTURE21                      0x84D5\r\n#define GL_TEXTURE22                      0x84D6\r\n#define GL_TEXTURE23                      0x84D7\r\n#define GL_TEXTURE24                      0x84D8\r\n#define GL_TEXTURE25                      0x84D9\r\n#define GL_TEXTURE26                      0x84DA\r\n#define GL_TEXTURE27                      0x84DB\r\n#define GL_TEXTURE28                      0x84DC\r\n#define GL_TEXTURE29                      0x84DD\r\n#define GL_TEXTURE30                      0x84DE\r\n#define GL_TEXTURE31                      0x84DF\r\n#define GL_ACTIVE_TEXTURE                 0x84E0\r\n#define GL_MULTISAMPLE                    0x809D\r\n#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE            0x809F\r\n#define GL_SAMPLE_COVERAGE                0x80A0\r\n#define GL_SAMPLE_BUFFERS                 0x80A8\r\n#define GL_SAMPLES                        0x80A9\r\n#define GL_SAMPLE_COVERAGE_VALUE          0x80AA\r\n#define GL_SAMPLE_COVERAGE_INVERT         0x80AB\r\n#define GL_TEXTURE_CUBE_MAP               0x8513\r\n#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP         0x851B\r\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C\r\n#define GL_COMPRESSED_RGB                 0x84ED\r\n#define GL_COMPRESSED_RGBA                0x84EE\r\n#define GL_TEXTURE_COMPRESSION_HINT       0x84EF\r\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE  0x86A0\r\n#define GL_TEXTURE_COMPRESSED             0x86A1\r\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\r\n#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3\r\n#define GL_CLAMP_TO_BORDER                0x812D\r\n#define GL_CLIENT_ACTIVE_TEXTURE          0x84E1\r\n#define GL_MAX_TEXTURE_UNITS              0x84E2\r\n#define GL_TRANSPOSE_MODELVIEW_MATRIX     0x84E3\r\n#define GL_TRANSPOSE_PROJECTION_MATRIX    0x84E4\r\n#define GL_TRANSPOSE_TEXTURE_MATRIX       0x84E5\r\n#define GL_TRANSPOSE_COLOR_MATRIX         0x84E6\r\n#define GL_MULTISAMPLE_BIT                0x20000000\r\n#define GL_NORMAL_MAP                     0x8511\r\n#define GL_REFLECTION_MAP                 0x8512\r\n#define GL_COMPRESSED_ALPHA               0x84E9\r\n#define GL_COMPRESSED_LUMINANCE           0x84EA\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA     0x84EB\r\n#define GL_COMPRESSED_INTENSITY           0x84EC\r\n#define GL_COMBINE                        0x8570\r\n#define GL_COMBINE_RGB                    0x8571\r\n#define GL_COMBINE_ALPHA                  0x8572\r\n#define GL_SOURCE0_RGB                    0x8580\r\n#define GL_SOURCE1_RGB                    0x8581\r\n#define GL_SOURCE2_RGB                    0x8582\r\n#define GL_SOURCE0_ALPHA                  0x8588\r\n#define GL_SOURCE1_ALPHA                  0x8589\r\n#define GL_SOURCE2_ALPHA                  0x858A\r\n#define GL_OPERAND0_RGB                   0x8590\r\n#define GL_OPERAND1_RGB                   0x8591\r\n#define GL_OPERAND2_RGB                   0x8592\r\n#define GL_OPERAND0_ALPHA                 0x8598\r\n#define GL_OPERAND1_ALPHA                 0x8599\r\n#define GL_OPERAND2_ALPHA                 0x859A\r\n#define GL_RGB_SCALE                      0x8573\r\n#define GL_ADD_SIGNED                     0x8574\r\n#define GL_INTERPOLATE                    0x8575\r\n#define GL_SUBTRACT                       0x84E7\r\n#define GL_CONSTANT                       0x8576\r\n#define GL_PRIMARY_COLOR                  0x8577\r\n#define GL_PREVIOUS                       0x8578\r\n#define GL_DOT3_RGB                       0x86AE\r\n#define GL_DOT3_RGBA                      0x86AF\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_4\r\n#define GL_BLEND_DST_RGB                  0x80C8\r\n#define GL_BLEND_SRC_RGB                  0x80C9\r\n#define GL_BLEND_DST_ALPHA                0x80CA\r\n#define GL_BLEND_SRC_ALPHA                0x80CB\r\n#define GL_POINT_FADE_THRESHOLD_SIZE      0x8128\r\n#define GL_DEPTH_COMPONENT16              0x81A5\r\n#define GL_DEPTH_COMPONENT24              0x81A6\r\n#define GL_DEPTH_COMPONENT32              0x81A7\r\n#define GL_MIRRORED_REPEAT                0x8370\r\n#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD\r\n#define GL_TEXTURE_LOD_BIAS               0x8501\r\n#define GL_INCR_WRAP                      0x8507\r\n#define GL_DECR_WRAP                      0x8508\r\n#define GL_TEXTURE_DEPTH_SIZE             0x884A\r\n#define GL_TEXTURE_COMPARE_MODE           0x884C\r\n#define GL_TEXTURE_COMPARE_FUNC           0x884D\r\n#define GL_POINT_SIZE_MIN                 0x8126\r\n#define GL_POINT_SIZE_MAX                 0x8127\r\n#define GL_POINT_DISTANCE_ATTENUATION     0x8129\r\n#define GL_GENERATE_MIPMAP                0x8191\r\n#define GL_GENERATE_MIPMAP_HINT           0x8192\r\n#define GL_FOG_COORDINATE_SOURCE          0x8450\r\n#define GL_FOG_COORDINATE                 0x8451\r\n#define GL_FRAGMENT_DEPTH                 0x8452\r\n#define GL_CURRENT_FOG_COORDINATE         0x8453\r\n#define GL_FOG_COORDINATE_ARRAY_TYPE      0x8454\r\n#define GL_FOG_COORDINATE_ARRAY_STRIDE    0x8455\r\n#define GL_FOG_COORDINATE_ARRAY_POINTER   0x8456\r\n#define GL_FOG_COORDINATE_ARRAY           0x8457\r\n#define GL_COLOR_SUM                      0x8458\r\n#define GL_CURRENT_SECONDARY_COLOR        0x8459\r\n#define GL_SECONDARY_COLOR_ARRAY_SIZE     0x845A\r\n#define GL_SECONDARY_COLOR_ARRAY_TYPE     0x845B\r\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE   0x845C\r\n#define GL_SECONDARY_COLOR_ARRAY_POINTER  0x845D\r\n#define GL_SECONDARY_COLOR_ARRAY          0x845E\r\n#define GL_TEXTURE_FILTER_CONTROL         0x8500\r\n#define GL_DEPTH_TEXTURE_MODE             0x884B\r\n#define GL_COMPARE_R_TO_TEXTURE           0x884E\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_5\r\n#define GL_BUFFER_SIZE                    0x8764\r\n#define GL_BUFFER_USAGE                   0x8765\r\n#define GL_QUERY_COUNTER_BITS             0x8864\r\n#define GL_CURRENT_QUERY                  0x8865\r\n#define GL_QUERY_RESULT                   0x8866\r\n#define GL_QUERY_RESULT_AVAILABLE         0x8867\r\n#define GL_ARRAY_BUFFER                   0x8892\r\n#define GL_ELEMENT_ARRAY_BUFFER           0x8893\r\n#define GL_ARRAY_BUFFER_BINDING           0x8894\r\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895\r\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\r\n#define GL_READ_ONLY                      0x88B8\r\n#define GL_WRITE_ONLY                     0x88B9\r\n#define GL_READ_WRITE                     0x88BA\r\n#define GL_BUFFER_ACCESS                  0x88BB\r\n#define GL_BUFFER_MAPPED                  0x88BC\r\n#define GL_BUFFER_MAP_POINTER             0x88BD\r\n#define GL_STREAM_DRAW                    0x88E0\r\n#define GL_STREAM_READ                    0x88E1\r\n#define GL_STREAM_COPY                    0x88E2\r\n#define GL_STATIC_DRAW                    0x88E4\r\n#define GL_STATIC_READ                    0x88E5\r\n#define GL_STATIC_COPY                    0x88E6\r\n#define GL_DYNAMIC_DRAW                   0x88E8\r\n#define GL_DYNAMIC_READ                   0x88E9\r\n#define GL_DYNAMIC_COPY                   0x88EA\r\n#define GL_SAMPLES_PASSED                 0x8914\r\n#define GL_SRC1_ALPHA                     0x8589\r\n#define GL_VERTEX_ARRAY_BUFFER_BINDING    0x8896\r\n#define GL_NORMAL_ARRAY_BUFFER_BINDING    0x8897\r\n#define GL_COLOR_ARRAY_BUFFER_BINDING     0x8898\r\n#define GL_INDEX_ARRAY_BUFFER_BINDING     0x8899\r\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\r\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\r\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\r\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\r\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING    0x889E\r\n#define GL_FOG_COORD_SRC                  0x8450\r\n#define GL_FOG_COORD                      0x8451\r\n#define GL_CURRENT_FOG_COORD              0x8453\r\n#define GL_FOG_COORD_ARRAY_TYPE           0x8454\r\n#define GL_FOG_COORD_ARRAY_STRIDE         0x8455\r\n#define GL_FOG_COORD_ARRAY_POINTER        0x8456\r\n#define GL_FOG_COORD_ARRAY                0x8457\r\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D\r\n#define GL_SRC0_RGB                       0x8580\r\n#define GL_SRC1_RGB                       0x8581\r\n#define GL_SRC2_RGB                       0x8582\r\n#define GL_SRC0_ALPHA                     0x8588\r\n#define GL_SRC2_ALPHA                     0x858A\r\n#endif\r\n\r\n#ifndef GL_VERSION_2_0\r\n#define GL_BLEND_EQUATION_RGB             0x8009\r\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED    0x8622\r\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE       0x8623\r\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE     0x8624\r\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE       0x8625\r\n#define GL_CURRENT_VERTEX_ATTRIB          0x8626\r\n#define GL_VERTEX_PROGRAM_POINT_SIZE      0x8642\r\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER    0x8645\r\n#define GL_STENCIL_BACK_FUNC              0x8800\r\n#define GL_STENCIL_BACK_FAIL              0x8801\r\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802\r\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803\r\n#define GL_MAX_DRAW_BUFFERS               0x8824\r\n#define GL_DRAW_BUFFER0                   0x8825\r\n#define GL_DRAW_BUFFER1                   0x8826\r\n#define GL_DRAW_BUFFER2                   0x8827\r\n#define GL_DRAW_BUFFER3                   0x8828\r\n#define GL_DRAW_BUFFER4                   0x8829\r\n#define GL_DRAW_BUFFER5                   0x882A\r\n#define GL_DRAW_BUFFER6                   0x882B\r\n#define GL_DRAW_BUFFER7                   0x882C\r\n#define GL_DRAW_BUFFER8                   0x882D\r\n#define GL_DRAW_BUFFER9                   0x882E\r\n#define GL_DRAW_BUFFER10                  0x882F\r\n#define GL_DRAW_BUFFER11                  0x8830\r\n#define GL_DRAW_BUFFER12                  0x8831\r\n#define GL_DRAW_BUFFER13                  0x8832\r\n#define GL_DRAW_BUFFER14                  0x8833\r\n#define GL_DRAW_BUFFER15                  0x8834\r\n#define GL_BLEND_EQUATION_ALPHA           0x883D\r\n#define GL_MAX_VERTEX_ATTRIBS             0x8869\r\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\r\n#define GL_MAX_TEXTURE_IMAGE_UNITS        0x8872\r\n#define GL_FRAGMENT_SHADER                0x8B30\r\n#define GL_VERTEX_SHADER                  0x8B31\r\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\r\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A\r\n#define GL_MAX_VARYING_FLOATS             0x8B4B\r\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\r\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\r\n#define GL_SHADER_TYPE                    0x8B4F\r\n#define GL_FLOAT_VEC2                     0x8B50\r\n#define GL_FLOAT_VEC3                     0x8B51\r\n#define GL_FLOAT_VEC4                     0x8B52\r\n#define GL_INT_VEC2                       0x8B53\r\n#define GL_INT_VEC3                       0x8B54\r\n#define GL_INT_VEC4                       0x8B55\r\n#define GL_BOOL                           0x8B56\r\n#define GL_BOOL_VEC2                      0x8B57\r\n#define GL_BOOL_VEC3                      0x8B58\r\n#define GL_BOOL_VEC4                      0x8B59\r\n#define GL_FLOAT_MAT2                     0x8B5A\r\n#define GL_FLOAT_MAT3                     0x8B5B\r\n#define GL_FLOAT_MAT4                     0x8B5C\r\n#define GL_SAMPLER_1D                     0x8B5D\r\n#define GL_SAMPLER_2D                     0x8B5E\r\n#define GL_SAMPLER_3D                     0x8B5F\r\n#define GL_SAMPLER_CUBE                   0x8B60\r\n#define GL_SAMPLER_1D_SHADOW              0x8B61\r\n#define GL_SAMPLER_2D_SHADOW              0x8B62\r\n#define GL_DELETE_STATUS                  0x8B80\r\n#define GL_COMPILE_STATUS                 0x8B81\r\n#define GL_LINK_STATUS                    0x8B82\r\n#define GL_VALIDATE_STATUS                0x8B83\r\n#define GL_INFO_LOG_LENGTH                0x8B84\r\n#define GL_ATTACHED_SHADERS               0x8B85\r\n#define GL_ACTIVE_UNIFORMS                0x8B86\r\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH      0x8B87\r\n#define GL_SHADER_SOURCE_LENGTH           0x8B88\r\n#define GL_ACTIVE_ATTRIBUTES              0x8B89\r\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH    0x8B8A\r\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\r\n#define GL_SHADING_LANGUAGE_VERSION       0x8B8C\r\n#define GL_CURRENT_PROGRAM                0x8B8D\r\n#define GL_POINT_SPRITE_COORD_ORIGIN      0x8CA0\r\n#define GL_LOWER_LEFT                     0x8CA1\r\n#define GL_UPPER_LEFT                     0x8CA2\r\n#define GL_STENCIL_BACK_REF               0x8CA3\r\n#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4\r\n#define GL_STENCIL_BACK_WRITEMASK         0x8CA5\r\n#define GL_VERTEX_PROGRAM_TWO_SIDE        0x8643\r\n#define GL_POINT_SPRITE                   0x8861\r\n#define GL_COORD_REPLACE                  0x8862\r\n#define GL_MAX_TEXTURE_COORDS             0x8871\r\n#endif\r\n\r\n#ifndef GL_VERSION_2_1\r\n#define GL_PIXEL_PACK_BUFFER              0x88EB\r\n#define GL_PIXEL_UNPACK_BUFFER            0x88EC\r\n#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED\r\n#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF\r\n#define GL_FLOAT_MAT2x3                   0x8B65\r\n#define GL_FLOAT_MAT2x4                   0x8B66\r\n#define GL_FLOAT_MAT3x2                   0x8B67\r\n#define GL_FLOAT_MAT3x4                   0x8B68\r\n#define GL_FLOAT_MAT4x2                   0x8B69\r\n#define GL_FLOAT_MAT4x3                   0x8B6A\r\n#define GL_SRGB                           0x8C40\r\n#define GL_SRGB8                          0x8C41\r\n#define GL_SRGB_ALPHA                     0x8C42\r\n#define GL_SRGB8_ALPHA8                   0x8C43\r\n#define GL_COMPRESSED_SRGB                0x8C48\r\n#define GL_COMPRESSED_SRGB_ALPHA          0x8C49\r\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\r\n#define GL_SLUMINANCE_ALPHA               0x8C44\r\n#define GL_SLUMINANCE8_ALPHA8             0x8C45\r\n#define GL_SLUMINANCE                     0x8C46\r\n#define GL_SLUMINANCE8                    0x8C47\r\n#define GL_COMPRESSED_SLUMINANCE          0x8C4A\r\n#define GL_COMPRESSED_SLUMINANCE_ALPHA    0x8C4B\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_0\r\n#define GL_COMPARE_REF_TO_TEXTURE         0x884E\r\n#define GL_CLIP_DISTANCE0                 0x3000\r\n#define GL_CLIP_DISTANCE1                 0x3001\r\n#define GL_CLIP_DISTANCE2                 0x3002\r\n#define GL_CLIP_DISTANCE3                 0x3003\r\n#define GL_CLIP_DISTANCE4                 0x3004\r\n#define GL_CLIP_DISTANCE5                 0x3005\r\n#define GL_CLIP_DISTANCE6                 0x3006\r\n#define GL_CLIP_DISTANCE7                 0x3007\r\n#define GL_MAX_CLIP_DISTANCES             0x0D32\r\n#define GL_MAJOR_VERSION                  0x821B\r\n#define GL_MINOR_VERSION                  0x821C\r\n#define GL_NUM_EXTENSIONS                 0x821D\r\n#define GL_CONTEXT_FLAGS                  0x821E\r\n#define GL_COMPRESSED_RED                 0x8225\r\n#define GL_COMPRESSED_RG                  0x8226\r\n#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001\r\n#define GL_RGBA32F                        0x8814\r\n#define GL_RGB32F                         0x8815\r\n#define GL_RGBA16F                        0x881A\r\n#define GL_RGB16F                         0x881B\r\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD\r\n#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF\r\n#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904\r\n#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905\r\n#define GL_CLAMP_READ_COLOR               0x891C\r\n#define GL_FIXED_ONLY                     0x891D\r\n#define GL_MAX_VARYING_COMPONENTS         0x8B4B\r\n#define GL_TEXTURE_1D_ARRAY               0x8C18\r\n#define GL_PROXY_TEXTURE_1D_ARRAY         0x8C19\r\n#define GL_TEXTURE_2D_ARRAY               0x8C1A\r\n#define GL_PROXY_TEXTURE_2D_ARRAY         0x8C1B\r\n#define GL_TEXTURE_BINDING_1D_ARRAY       0x8C1C\r\n#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D\r\n#define GL_R11F_G11F_B10F                 0x8C3A\r\n#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B\r\n#define GL_RGB9_E5                        0x8C3D\r\n#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E\r\n#define GL_TEXTURE_SHARED_SIZE            0x8C3F\r\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80\r\n#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85\r\n#define GL_PRIMITIVES_GENERATED           0x8C87\r\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88\r\n#define GL_RASTERIZER_DISCARD             0x8C89\r\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B\r\n#define GL_INTERLEAVED_ATTRIBS            0x8C8C\r\n#define GL_SEPARATE_ATTRIBS               0x8C8D\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F\r\n#define GL_RGBA32UI                       0x8D70\r\n#define GL_RGB32UI                        0x8D71\r\n#define GL_RGBA16UI                       0x8D76\r\n#define GL_RGB16UI                        0x8D77\r\n#define GL_RGBA8UI                        0x8D7C\r\n#define GL_RGB8UI                         0x8D7D\r\n#define GL_RGBA32I                        0x8D82\r\n#define GL_RGB32I                         0x8D83\r\n#define GL_RGBA16I                        0x8D88\r\n#define GL_RGB16I                         0x8D89\r\n#define GL_RGBA8I                         0x8D8E\r\n#define GL_RGB8I                          0x8D8F\r\n#define GL_RED_INTEGER                    0x8D94\r\n#define GL_GREEN_INTEGER                  0x8D95\r\n#define GL_BLUE_INTEGER                   0x8D96\r\n#define GL_RGB_INTEGER                    0x8D98\r\n#define GL_RGBA_INTEGER                   0x8D99\r\n#define GL_BGR_INTEGER                    0x8D9A\r\n#define GL_BGRA_INTEGER                   0x8D9B\r\n#define GL_SAMPLER_1D_ARRAY               0x8DC0\r\n#define GL_SAMPLER_2D_ARRAY               0x8DC1\r\n#define GL_SAMPLER_1D_ARRAY_SHADOW        0x8DC3\r\n#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4\r\n#define GL_SAMPLER_CUBE_SHADOW            0x8DC5\r\n#define GL_UNSIGNED_INT_VEC2              0x8DC6\r\n#define GL_UNSIGNED_INT_VEC3              0x8DC7\r\n#define GL_UNSIGNED_INT_VEC4              0x8DC8\r\n#define GL_INT_SAMPLER_1D                 0x8DC9\r\n#define GL_INT_SAMPLER_2D                 0x8DCA\r\n#define GL_INT_SAMPLER_3D                 0x8DCB\r\n#define GL_INT_SAMPLER_CUBE               0x8DCC\r\n#define GL_INT_SAMPLER_1D_ARRAY           0x8DCE\r\n#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF\r\n#define GL_UNSIGNED_INT_SAMPLER_1D        0x8DD1\r\n#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2\r\n#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4\r\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY  0x8DD6\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7\r\n#define GL_QUERY_WAIT                     0x8E13\r\n#define GL_QUERY_NO_WAIT                  0x8E14\r\n#define GL_QUERY_BY_REGION_WAIT           0x8E15\r\n#define GL_QUERY_BY_REGION_NO_WAIT        0x8E16\r\n#define GL_BUFFER_ACCESS_FLAGS            0x911F\r\n#define GL_BUFFER_MAP_LENGTH              0x9120\r\n#define GL_BUFFER_MAP_OFFSET              0x9121\r\n/* Reuse tokens from ARB_depth_buffer_float */\r\n/* reuse GL_DEPTH_COMPONENT32F */\r\n/* reuse GL_DEPTH32F_STENCIL8 */\r\n/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n/* Reuse tokens from ARB_framebuffer_object */\r\n/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */\r\n/* reuse GL_FRAMEBUFFER_DEFAULT */\r\n/* reuse GL_FRAMEBUFFER_UNDEFINED */\r\n/* reuse GL_DEPTH_STENCIL_ATTACHMENT */\r\n/* reuse GL_INDEX */\r\n/* reuse GL_MAX_RENDERBUFFER_SIZE */\r\n/* reuse GL_DEPTH_STENCIL */\r\n/* reuse GL_UNSIGNED_INT_24_8 */\r\n/* reuse GL_DEPTH24_STENCIL8 */\r\n/* reuse GL_TEXTURE_STENCIL_SIZE */\r\n/* reuse GL_TEXTURE_RED_TYPE */\r\n/* reuse GL_TEXTURE_GREEN_TYPE */\r\n/* reuse GL_TEXTURE_BLUE_TYPE */\r\n/* reuse GL_TEXTURE_ALPHA_TYPE */\r\n/* reuse GL_TEXTURE_DEPTH_TYPE */\r\n/* reuse GL_UNSIGNED_NORMALIZED */\r\n/* reuse GL_FRAMEBUFFER_BINDING */\r\n/* reuse GL_DRAW_FRAMEBUFFER_BINDING */\r\n/* reuse GL_RENDERBUFFER_BINDING */\r\n/* reuse GL_READ_FRAMEBUFFER */\r\n/* reuse GL_DRAW_FRAMEBUFFER */\r\n/* reuse GL_READ_FRAMEBUFFER_BINDING */\r\n/* reuse GL_RENDERBUFFER_SAMPLES */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */\r\n/* reuse GL_FRAMEBUFFER_COMPLETE */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */\r\n/* reuse GL_FRAMEBUFFER_UNSUPPORTED */\r\n/* reuse GL_MAX_COLOR_ATTACHMENTS */\r\n/* reuse GL_COLOR_ATTACHMENT0 */\r\n/* reuse GL_COLOR_ATTACHMENT1 */\r\n/* reuse GL_COLOR_ATTACHMENT2 */\r\n/* reuse GL_COLOR_ATTACHMENT3 */\r\n/* reuse GL_COLOR_ATTACHMENT4 */\r\n/* reuse GL_COLOR_ATTACHMENT5 */\r\n/* reuse GL_COLOR_ATTACHMENT6 */\r\n/* reuse GL_COLOR_ATTACHMENT7 */\r\n/* reuse GL_COLOR_ATTACHMENT8 */\r\n/* reuse GL_COLOR_ATTACHMENT9 */\r\n/* reuse GL_COLOR_ATTACHMENT10 */\r\n/* reuse GL_COLOR_ATTACHMENT11 */\r\n/* reuse GL_COLOR_ATTACHMENT12 */\r\n/* reuse GL_COLOR_ATTACHMENT13 */\r\n/* reuse GL_COLOR_ATTACHMENT14 */\r\n/* reuse GL_COLOR_ATTACHMENT15 */\r\n/* reuse GL_DEPTH_ATTACHMENT */\r\n/* reuse GL_STENCIL_ATTACHMENT */\r\n/* reuse GL_FRAMEBUFFER */\r\n/* reuse GL_RENDERBUFFER */\r\n/* reuse GL_RENDERBUFFER_WIDTH */\r\n/* reuse GL_RENDERBUFFER_HEIGHT */\r\n/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */\r\n/* reuse GL_STENCIL_INDEX1 */\r\n/* reuse GL_STENCIL_INDEX4 */\r\n/* reuse GL_STENCIL_INDEX8 */\r\n/* reuse GL_STENCIL_INDEX16 */\r\n/* reuse GL_RENDERBUFFER_RED_SIZE */\r\n/* reuse GL_RENDERBUFFER_GREEN_SIZE */\r\n/* reuse GL_RENDERBUFFER_BLUE_SIZE */\r\n/* reuse GL_RENDERBUFFER_ALPHA_SIZE */\r\n/* reuse GL_RENDERBUFFER_DEPTH_SIZE */\r\n/* reuse GL_RENDERBUFFER_STENCIL_SIZE */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */\r\n/* reuse GL_MAX_SAMPLES */\r\n/* Reuse tokens from ARB_framebuffer_sRGB */\r\n/* reuse GL_FRAMEBUFFER_SRGB */\r\n/* Reuse tokens from ARB_half_float_vertex */\r\n/* reuse GL_HALF_FLOAT */\r\n/* Reuse tokens from ARB_map_buffer_range */\r\n/* reuse GL_MAP_READ_BIT */\r\n/* reuse GL_MAP_WRITE_BIT */\r\n/* reuse GL_MAP_INVALIDATE_RANGE_BIT */\r\n/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */\r\n/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */\r\n/* reuse GL_MAP_UNSYNCHRONIZED_BIT */\r\n/* Reuse tokens from ARB_texture_compression_rgtc */\r\n/* reuse GL_COMPRESSED_RED_RGTC1 */\r\n/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */\r\n/* reuse GL_COMPRESSED_RG_RGTC2 */\r\n/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */\r\n/* Reuse tokens from ARB_texture_rg */\r\n/* reuse GL_RG */\r\n/* reuse GL_RG_INTEGER */\r\n/* reuse GL_R8 */\r\n/* reuse GL_R16 */\r\n/* reuse GL_RG8 */\r\n/* reuse GL_RG16 */\r\n/* reuse GL_R16F */\r\n/* reuse GL_R32F */\r\n/* reuse GL_RG16F */\r\n/* reuse GL_RG32F */\r\n/* reuse GL_R8I */\r\n/* reuse GL_R8UI */\r\n/* reuse GL_R16I */\r\n/* reuse GL_R16UI */\r\n/* reuse GL_R32I */\r\n/* reuse GL_R32UI */\r\n/* reuse GL_RG8I */\r\n/* reuse GL_RG8UI */\r\n/* reuse GL_RG16I */\r\n/* reuse GL_RG16UI */\r\n/* reuse GL_RG32I */\r\n/* reuse GL_RG32UI */\r\n/* Reuse tokens from ARB_vertex_array_object */\r\n/* reuse GL_VERTEX_ARRAY_BINDING */\r\n#define GL_CLAMP_VERTEX_COLOR             0x891A\r\n#define GL_CLAMP_FRAGMENT_COLOR           0x891B\r\n#define GL_ALPHA_INTEGER                  0x8D97\r\n/* Reuse tokens from ARB_framebuffer_object */\r\n/* reuse GL_TEXTURE_LUMINANCE_TYPE */\r\n/* reuse GL_TEXTURE_INTENSITY_TYPE */\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_1\r\n#define GL_SAMPLER_2D_RECT                0x8B63\r\n#define GL_SAMPLER_2D_RECT_SHADOW         0x8B64\r\n#define GL_SAMPLER_BUFFER                 0x8DC2\r\n#define GL_INT_SAMPLER_2D_RECT            0x8DCD\r\n#define GL_INT_SAMPLER_BUFFER             0x8DD0\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT   0x8DD5\r\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER    0x8DD8\r\n#define GL_TEXTURE_BUFFER                 0x8C2A\r\n#define GL_MAX_TEXTURE_BUFFER_SIZE        0x8C2B\r\n#define GL_TEXTURE_BINDING_BUFFER         0x8C2C\r\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D\r\n#define GL_TEXTURE_RECTANGLE              0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE      0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE        0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE     0x84F8\r\n#define GL_RED_SNORM                      0x8F90\r\n#define GL_RG_SNORM                       0x8F91\r\n#define GL_RGB_SNORM                      0x8F92\r\n#define GL_RGBA_SNORM                     0x8F93\r\n#define GL_R8_SNORM                       0x8F94\r\n#define GL_RG8_SNORM                      0x8F95\r\n#define GL_RGB8_SNORM                     0x8F96\r\n#define GL_RGBA8_SNORM                    0x8F97\r\n#define GL_R16_SNORM                      0x8F98\r\n#define GL_RG16_SNORM                     0x8F99\r\n#define GL_RGB16_SNORM                    0x8F9A\r\n#define GL_RGBA16_SNORM                   0x8F9B\r\n#define GL_SIGNED_NORMALIZED              0x8F9C\r\n#define GL_PRIMITIVE_RESTART              0x8F9D\r\n#define GL_PRIMITIVE_RESTART_INDEX        0x8F9E\r\n/* Reuse tokens from ARB_copy_buffer */\r\n/* reuse GL_COPY_READ_BUFFER */\r\n/* reuse GL_COPY_WRITE_BUFFER */\r\n/* Reuse tokens from ARB_draw_instanced (none) */\r\n/* Reuse tokens from ARB_uniform_buffer_object */\r\n/* reuse GL_UNIFORM_BUFFER */\r\n/* reuse GL_UNIFORM_BUFFER_BINDING */\r\n/* reuse GL_UNIFORM_BUFFER_START */\r\n/* reuse GL_UNIFORM_BUFFER_SIZE */\r\n/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */\r\n/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */\r\n/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */\r\n/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */\r\n/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */\r\n/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */\r\n/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */\r\n/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */\r\n/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */\r\n/* reuse GL_ACTIVE_UNIFORM_BLOCKS */\r\n/* reuse GL_UNIFORM_TYPE */\r\n/* reuse GL_UNIFORM_SIZE */\r\n/* reuse GL_UNIFORM_NAME_LENGTH */\r\n/* reuse GL_UNIFORM_BLOCK_INDEX */\r\n/* reuse GL_UNIFORM_OFFSET */\r\n/* reuse GL_UNIFORM_ARRAY_STRIDE */\r\n/* reuse GL_UNIFORM_MATRIX_STRIDE */\r\n/* reuse GL_UNIFORM_IS_ROW_MAJOR */\r\n/* reuse GL_UNIFORM_BLOCK_BINDING */\r\n/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */\r\n/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */\r\n/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */\r\n/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */\r\n/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */\r\n/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */\r\n/* reuse GL_INVALID_INDEX */\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_2\r\n#define GL_CONTEXT_CORE_PROFILE_BIT       0x00000001\r\n#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002\r\n#define GL_LINES_ADJACENCY                0x000A\r\n#define GL_LINE_STRIP_ADJACENCY           0x000B\r\n#define GL_TRIANGLES_ADJACENCY            0x000C\r\n#define GL_TRIANGLE_STRIP_ADJACENCY       0x000D\r\n#define GL_PROGRAM_POINT_SIZE             0x8642\r\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29\r\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8\r\n#define GL_GEOMETRY_SHADER                0x8DD9\r\n#define GL_GEOMETRY_VERTICES_OUT          0x8916\r\n#define GL_GEOMETRY_INPUT_TYPE            0x8917\r\n#define GL_GEOMETRY_OUTPUT_TYPE           0x8918\r\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF\r\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES   0x8DE0\r\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1\r\n#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122\r\n#define GL_MAX_GEOMETRY_INPUT_COMPONENTS  0x9123\r\n#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124\r\n#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125\r\n#define GL_CONTEXT_PROFILE_MASK           0x9126\r\n/* reuse GL_MAX_VARYING_COMPONENTS */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */\r\n/* Reuse tokens from ARB_depth_clamp */\r\n/* reuse GL_DEPTH_CLAMP */\r\n/* Reuse tokens from ARB_draw_elements_base_vertex (none) */\r\n/* Reuse tokens from ARB_fragment_coord_conventions (none) */\r\n/* Reuse tokens from ARB_provoking_vertex */\r\n/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */\r\n/* reuse GL_FIRST_VERTEX_CONVENTION */\r\n/* reuse GL_LAST_VERTEX_CONVENTION */\r\n/* reuse GL_PROVOKING_VERTEX */\r\n/* Reuse tokens from ARB_seamless_cube_map */\r\n/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */\r\n/* Reuse tokens from ARB_sync */\r\n/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */\r\n/* reuse GL_OBJECT_TYPE */\r\n/* reuse GL_SYNC_CONDITION */\r\n/* reuse GL_SYNC_STATUS */\r\n/* reuse GL_SYNC_FLAGS */\r\n/* reuse GL_SYNC_FENCE */\r\n/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */\r\n/* reuse GL_UNSIGNALED */\r\n/* reuse GL_SIGNALED */\r\n/* reuse GL_ALREADY_SIGNALED */\r\n/* reuse GL_TIMEOUT_EXPIRED */\r\n/* reuse GL_CONDITION_SATISFIED */\r\n/* reuse GL_WAIT_FAILED */\r\n/* reuse GL_TIMEOUT_IGNORED */\r\n/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */\r\n/* reuse GL_TIMEOUT_IGNORED */\r\n/* Reuse tokens from ARB_texture_multisample */\r\n/* reuse GL_SAMPLE_POSITION */\r\n/* reuse GL_SAMPLE_MASK */\r\n/* reuse GL_SAMPLE_MASK_VALUE */\r\n/* reuse GL_MAX_SAMPLE_MASK_WORDS */\r\n/* reuse GL_TEXTURE_2D_MULTISAMPLE */\r\n/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */\r\n/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */\r\n/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_TEXTURE_SAMPLES */\r\n/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */\r\n/* reuse GL_SAMPLER_2D_MULTISAMPLE */\r\n/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */\r\n/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */\r\n/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */\r\n/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */\r\n/* reuse GL_MAX_INTEGER_SAMPLES */\r\n/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_3\r\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE\r\n/* Reuse tokens from ARB_blend_func_extended */\r\n/* reuse GL_SRC1_COLOR */\r\n/* reuse GL_ONE_MINUS_SRC1_COLOR */\r\n/* reuse GL_ONE_MINUS_SRC1_ALPHA */\r\n/* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */\r\n/* Reuse tokens from ARB_explicit_attrib_location (none) */\r\n/* Reuse tokens from ARB_occlusion_query2 */\r\n/* reuse GL_ANY_SAMPLES_PASSED */\r\n/* Reuse tokens from ARB_sampler_objects */\r\n/* reuse GL_SAMPLER_BINDING */\r\n/* Reuse tokens from ARB_shader_bit_encoding (none) */\r\n/* Reuse tokens from ARB_texture_rgb10_a2ui */\r\n/* reuse GL_RGB10_A2UI */\r\n/* Reuse tokens from ARB_texture_swizzle */\r\n/* reuse GL_TEXTURE_SWIZZLE_R */\r\n/* reuse GL_TEXTURE_SWIZZLE_G */\r\n/* reuse GL_TEXTURE_SWIZZLE_B */\r\n/* reuse GL_TEXTURE_SWIZZLE_A */\r\n/* reuse GL_TEXTURE_SWIZZLE_RGBA */\r\n/* Reuse tokens from ARB_timer_query */\r\n/* reuse GL_TIME_ELAPSED */\r\n/* reuse GL_TIMESTAMP */\r\n/* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */\r\n/* reuse GL_INT_2_10_10_10_REV */\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_0\r\n#define GL_SAMPLE_SHADING                 0x8C36\r\n#define GL_MIN_SAMPLE_SHADING_VALUE       0x8C37\r\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F\r\n#define GL_TEXTURE_CUBE_MAP_ARRAY         0x9009\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY   0x900B\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY         0x900C\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW  0x900D\r\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY     0x900E\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F\r\n/* Reuse tokens from ARB_texture_query_lod (none) */\r\n/* Reuse tokens from ARB_draw_buffers_blend (none) */\r\n/* Reuse tokens from ARB_draw_indirect */\r\n/* reuse GL_DRAW_INDIRECT_BUFFER */\r\n/* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */\r\n/* Reuse tokens from ARB_gpu_shader5 */\r\n/* reuse GL_GEOMETRY_SHADER_INVOCATIONS */\r\n/* reuse GL_MAX_GEOMETRY_SHADER_INVOCATIONS */\r\n/* reuse GL_MIN_FRAGMENT_INTERPOLATION_OFFSET */\r\n/* reuse GL_MAX_FRAGMENT_INTERPOLATION_OFFSET */\r\n/* reuse GL_FRAGMENT_INTERPOLATION_OFFSET_BITS */\r\n/* Reuse tokens from ARB_gpu_shader_fp64 */\r\n/* reuse GL_DOUBLE_VEC2 */\r\n/* reuse GL_DOUBLE_VEC3 */\r\n/* reuse GL_DOUBLE_VEC4 */\r\n/* reuse GL_DOUBLE_MAT2 */\r\n/* reuse GL_DOUBLE_MAT3 */\r\n/* reuse GL_DOUBLE_MAT4 */\r\n/* reuse GL_DOUBLE_MAT2x3 */\r\n/* reuse GL_DOUBLE_MAT2x4 */\r\n/* reuse GL_DOUBLE_MAT3x2 */\r\n/* reuse GL_DOUBLE_MAT3x4 */\r\n/* reuse GL_DOUBLE_MAT4x2 */\r\n/* reuse GL_DOUBLE_MAT4x3 */\r\n/* Reuse tokens from ARB_shader_subroutine */\r\n/* reuse GL_ACTIVE_SUBROUTINES */\r\n/* reuse GL_ACTIVE_SUBROUTINE_UNIFORMS */\r\n/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS */\r\n/* reuse GL_ACTIVE_SUBROUTINE_MAX_LENGTH */\r\n/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH */\r\n/* reuse GL_MAX_SUBROUTINES */\r\n/* reuse GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS */\r\n/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */\r\n/* reuse GL_COMPATIBLE_SUBROUTINES */\r\n/* Reuse tokens from ARB_tessellation_shader */\r\n/* reuse GL_PATCHES */\r\n/* reuse GL_PATCH_VERTICES */\r\n/* reuse GL_PATCH_DEFAULT_INNER_LEVEL */\r\n/* reuse GL_PATCH_DEFAULT_OUTER_LEVEL */\r\n/* reuse GL_TESS_CONTROL_OUTPUT_VERTICES */\r\n/* reuse GL_TESS_GEN_MODE */\r\n/* reuse GL_TESS_GEN_SPACING */\r\n/* reuse GL_TESS_GEN_VERTEX_ORDER */\r\n/* reuse GL_TESS_GEN_POINT_MODE */\r\n/* reuse GL_ISOLINES */\r\n/* reuse GL_FRACTIONAL_ODD */\r\n/* reuse GL_FRACTIONAL_EVEN */\r\n/* reuse GL_MAX_PATCH_VERTICES */\r\n/* reuse GL_MAX_TESS_GEN_LEVEL */\r\n/* reuse GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS */\r\n/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS */\r\n/* reuse GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS */\r\n/* reuse GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS */\r\n/* reuse GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS */\r\n/* reuse GL_MAX_TESS_PATCH_COMPONENTS */\r\n/* reuse GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS */\r\n/* reuse GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS */\r\n/* reuse GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS */\r\n/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS */\r\n/* reuse GL_MAX_TESS_CONTROL_INPUT_COMPONENTS */\r\n/* reuse GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS */\r\n/* reuse GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS */\r\n/* reuse GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS */\r\n/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER */\r\n/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */\r\n/* reuse GL_TESS_EVALUATION_SHADER */\r\n/* reuse GL_TESS_CONTROL_SHADER */\r\n/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */\r\n/* Reuse tokens from ARB_transform_feedback2 */\r\n/* reuse GL_TRANSFORM_FEEDBACK */\r\n/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */\r\n/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */\r\n/* reuse GL_TRANSFORM_FEEDBACK_BINDING */\r\n/* Reuse tokens from ARB_transform_feedback3 */\r\n/* reuse GL_MAX_TRANSFORM_FEEDBACK_BUFFERS */\r\n/* reuse GL_MAX_VERTEX_STREAMS */\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_1\r\n/* Reuse tokens from ARB_ES2_compatibility */\r\n/* reuse GL_FIXED */\r\n/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */\r\n/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */\r\n/* reuse GL_LOW_FLOAT */\r\n/* reuse GL_MEDIUM_FLOAT */\r\n/* reuse GL_HIGH_FLOAT */\r\n/* reuse GL_LOW_INT */\r\n/* reuse GL_MEDIUM_INT */\r\n/* reuse GL_HIGH_INT */\r\n/* reuse GL_SHADER_COMPILER */\r\n/* reuse GL_SHADER_BINARY_FORMATS */\r\n/* reuse GL_NUM_SHADER_BINARY_FORMATS */\r\n/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */\r\n/* reuse GL_MAX_VARYING_VECTORS */\r\n/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */\r\n/* reuse GL_RGB565 */\r\n/* Reuse tokens from ARB_get_program_binary */\r\n/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */\r\n/* reuse GL_PROGRAM_BINARY_LENGTH */\r\n/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */\r\n/* reuse GL_PROGRAM_BINARY_FORMATS */\r\n/* Reuse tokens from ARB_separate_shader_objects */\r\n/* reuse GL_VERTEX_SHADER_BIT */\r\n/* reuse GL_FRAGMENT_SHADER_BIT */\r\n/* reuse GL_GEOMETRY_SHADER_BIT */\r\n/* reuse GL_TESS_CONTROL_SHADER_BIT */\r\n/* reuse GL_TESS_EVALUATION_SHADER_BIT */\r\n/* reuse GL_ALL_SHADER_BITS */\r\n/* reuse GL_PROGRAM_SEPARABLE */\r\n/* reuse GL_ACTIVE_PROGRAM */\r\n/* reuse GL_PROGRAM_PIPELINE_BINDING */\r\n/* Reuse tokens from ARB_shader_precision (none) */\r\n/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */\r\n/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */\r\n/* reuse GL_MAX_VIEWPORTS */\r\n/* reuse GL_VIEWPORT_SUBPIXEL_BITS */\r\n/* reuse GL_VIEWPORT_BOUNDS_RANGE */\r\n/* reuse GL_LAYER_PROVOKING_VERTEX */\r\n/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */\r\n/* reuse GL_UNDEFINED_VERTEX */\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_2\r\n/* Reuse tokens from ARB_base_instance (none) */\r\n/* Reuse tokens from ARB_shading_language_420pack (none) */\r\n/* Reuse tokens from ARB_transform_feedback_instanced (none) */\r\n/* Reuse tokens from ARB_compressed_texture_pixel_storage */\r\n/* reuse GL_UNPACK_COMPRESSED_BLOCK_WIDTH */\r\n/* reuse GL_UNPACK_COMPRESSED_BLOCK_HEIGHT */\r\n/* reuse GL_UNPACK_COMPRESSED_BLOCK_DEPTH */\r\n/* reuse GL_UNPACK_COMPRESSED_BLOCK_SIZE */\r\n/* reuse GL_PACK_COMPRESSED_BLOCK_WIDTH */\r\n/* reuse GL_PACK_COMPRESSED_BLOCK_HEIGHT */\r\n/* reuse GL_PACK_COMPRESSED_BLOCK_DEPTH */\r\n/* reuse GL_PACK_COMPRESSED_BLOCK_SIZE */\r\n/* Reuse tokens from ARB_conservative_depth (none) */\r\n/* Reuse tokens from ARB_internalformat_query */\r\n/* reuse GL_NUM_SAMPLE_COUNTS */\r\n/* Reuse tokens from ARB_map_buffer_alignment */\r\n/* reuse GL_MIN_MAP_BUFFER_ALIGNMENT */\r\n/* Reuse tokens from ARB_shader_atomic_counters */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_BINDING */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_START */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_SIZE */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER */\r\n/* reuse GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_VERTEX_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_COMBINED_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE */\r\n/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS */\r\n/* reuse GL_ACTIVE_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX */\r\n/* reuse GL_UNSIGNED_INT_ATOMIC_COUNTER */\r\n/* Reuse tokens from ARB_shader_image_load_store */\r\n/* reuse GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT */\r\n/* reuse GL_ELEMENT_ARRAY_BARRIER_BIT */\r\n/* reuse GL_UNIFORM_BARRIER_BIT */\r\n/* reuse GL_TEXTURE_FETCH_BARRIER_BIT */\r\n/* reuse GL_SHADER_IMAGE_ACCESS_BARRIER_BIT */\r\n/* reuse GL_COMMAND_BARRIER_BIT */\r\n/* reuse GL_PIXEL_BUFFER_BARRIER_BIT */\r\n/* reuse GL_TEXTURE_UPDATE_BARRIER_BIT */\r\n/* reuse GL_BUFFER_UPDATE_BARRIER_BIT */\r\n/* reuse GL_FRAMEBUFFER_BARRIER_BIT */\r\n/* reuse GL_TRANSFORM_FEEDBACK_BARRIER_BIT */\r\n/* reuse GL_ATOMIC_COUNTER_BARRIER_BIT */\r\n/* reuse GL_ALL_BARRIER_BITS */\r\n/* reuse GL_MAX_IMAGE_UNITS */\r\n/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */\r\n/* reuse GL_IMAGE_BINDING_NAME */\r\n/* reuse GL_IMAGE_BINDING_LEVEL */\r\n/* reuse GL_IMAGE_BINDING_LAYERED */\r\n/* reuse GL_IMAGE_BINDING_LAYER */\r\n/* reuse GL_IMAGE_BINDING_ACCESS */\r\n/* reuse GL_IMAGE_1D */\r\n/* reuse GL_IMAGE_2D */\r\n/* reuse GL_IMAGE_3D */\r\n/* reuse GL_IMAGE_2D_RECT */\r\n/* reuse GL_IMAGE_CUBE */\r\n/* reuse GL_IMAGE_BUFFER */\r\n/* reuse GL_IMAGE_1D_ARRAY */\r\n/* reuse GL_IMAGE_2D_ARRAY */\r\n/* reuse GL_IMAGE_CUBE_MAP_ARRAY */\r\n/* reuse GL_IMAGE_2D_MULTISAMPLE */\r\n/* reuse GL_IMAGE_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_INT_IMAGE_1D */\r\n/* reuse GL_INT_IMAGE_2D */\r\n/* reuse GL_INT_IMAGE_3D */\r\n/* reuse GL_INT_IMAGE_2D_RECT */\r\n/* reuse GL_INT_IMAGE_CUBE */\r\n/* reuse GL_INT_IMAGE_BUFFER */\r\n/* reuse GL_INT_IMAGE_1D_ARRAY */\r\n/* reuse GL_INT_IMAGE_2D_ARRAY */\r\n/* reuse GL_INT_IMAGE_CUBE_MAP_ARRAY */\r\n/* reuse GL_INT_IMAGE_2D_MULTISAMPLE */\r\n/* reuse GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_1D */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_2D */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_3D */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_2D_RECT */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_CUBE */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_BUFFER */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_1D_ARRAY */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_2D_ARRAY */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE */\r\n/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_MAX_IMAGE_SAMPLES */\r\n/* reuse GL_IMAGE_BINDING_FORMAT */\r\n/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */\r\n/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE */\r\n/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS */\r\n/* reuse GL_MAX_VERTEX_IMAGE_UNIFORMS */\r\n/* reuse GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS */\r\n/* reuse GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS */\r\n/* reuse GL_MAX_GEOMETRY_IMAGE_UNIFORMS */\r\n/* reuse GL_MAX_FRAGMENT_IMAGE_UNIFORMS */\r\n/* reuse GL_MAX_COMBINED_IMAGE_UNIFORMS */\r\n/* Reuse tokens from ARB_shading_language_packing (none) */\r\n/* Reuse tokens from ARB_texture_storage */\r\n/* reuse GL_TEXTURE_IMMUTABLE_FORMAT */\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_3\r\n#define GL_NUM_SHADING_LANGUAGE_VERSIONS  0x82E9\r\n#define GL_VERTEX_ATTRIB_ARRAY_LONG       0x874E\r\n/* Reuse tokens from ARB_arrays_of_arrays (none, GLSL only) */\r\n/* Reuse tokens from ARB_fragment_layer_viewport (none, GLSL only) */\r\n/* Reuse tokens from ARB_shader_image_size (none, GLSL only) */\r\n/* Reuse tokens from ARB_ES3_compatibility */\r\n/* reuse GL_COMPRESSED_RGB8_ETC2 */\r\n/* reuse GL_COMPRESSED_SRGB8_ETC2 */\r\n/* reuse GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 */\r\n/* reuse GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 */\r\n/* reuse GL_COMPRESSED_RGBA8_ETC2_EAC */\r\n/* reuse GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC */\r\n/* reuse GL_COMPRESSED_R11_EAC */\r\n/* reuse GL_COMPRESSED_SIGNED_R11_EAC */\r\n/* reuse GL_COMPRESSED_RG11_EAC */\r\n/* reuse GL_COMPRESSED_SIGNED_RG11_EAC */\r\n/* reuse GL_PRIMITIVE_RESTART_FIXED_INDEX */\r\n/* reuse GL_ANY_SAMPLES_PASSED_CONSERVATIVE */\r\n/* reuse GL_MAX_ELEMENT_INDEX */\r\n/* Reuse tokens from ARB_clear_buffer_object (none) */\r\n/* Reuse tokens from ARB_compute_shader */\r\n/* reuse GL_COMPUTE_SHADER */\r\n/* reuse GL_MAX_COMPUTE_UNIFORM_BLOCKS */\r\n/* reuse GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS */\r\n/* reuse GL_MAX_COMPUTE_IMAGE_UNIFORMS */\r\n/* reuse GL_MAX_COMPUTE_SHARED_MEMORY_SIZE */\r\n/* reuse GL_MAX_COMPUTE_UNIFORM_COMPONENTS */\r\n/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS */\r\n/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTERS */\r\n/* reuse GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS */\r\n/* reuse GL_MAX_COMPUTE_LOCAL_INVOCATIONS */\r\n/* reuse GL_MAX_COMPUTE_WORK_GROUP_COUNT */\r\n/* reuse GL_MAX_COMPUTE_WORK_GROUP_SIZE */\r\n/* reuse GL_COMPUTE_LOCAL_WORK_SIZE */\r\n/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER */\r\n/* reuse GL_DISPATCH_INDIRECT_BUFFER */\r\n/* reuse GL_DISPATCH_INDIRECT_BUFFER_BINDING */\r\n/* Reuse tokens from ARB_copy_image (none) */\r\n/* Reuse tokens from KHR_debug */\r\n/* reuse GL_DEBUG_OUTPUT_SYNCHRONOUS */\r\n/* reuse GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH */\r\n/* reuse GL_DEBUG_CALLBACK_FUNCTION */\r\n/* reuse GL_DEBUG_CALLBACK_USER_PARAM */\r\n/* reuse GL_DEBUG_SOURCE_API */\r\n/* reuse GL_DEBUG_SOURCE_WINDOW_SYSTEM */\r\n/* reuse GL_DEBUG_SOURCE_SHADER_COMPILER */\r\n/* reuse GL_DEBUG_SOURCE_THIRD_PARTY */\r\n/* reuse GL_DEBUG_SOURCE_APPLICATION */\r\n/* reuse GL_DEBUG_SOURCE_OTHER */\r\n/* reuse GL_DEBUG_TYPE_ERROR */\r\n/* reuse GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR */\r\n/* reuse GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR */\r\n/* reuse GL_DEBUG_TYPE_PORTABILITY */\r\n/* reuse GL_DEBUG_TYPE_PERFORMANCE */\r\n/* reuse GL_DEBUG_TYPE_OTHER */\r\n/* reuse GL_MAX_DEBUG_MESSAGE_LENGTH */\r\n/* reuse GL_MAX_DEBUG_LOGGED_MESSAGES */\r\n/* reuse GL_DEBUG_LOGGED_MESSAGES */\r\n/* reuse GL_DEBUG_SEVERITY_HIGH */\r\n/* reuse GL_DEBUG_SEVERITY_MEDIUM */\r\n/* reuse GL_DEBUG_SEVERITY_LOW */\r\n/* reuse GL_DEBUG_TYPE_MARKER */\r\n/* reuse GL_DEBUG_TYPE_PUSH_GROUP */\r\n/* reuse GL_DEBUG_TYPE_POP_GROUP */\r\n/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */\r\n/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */\r\n/* reuse GL_DEBUG_GROUP_STACK_DEPTH */\r\n/* reuse GL_BUFFER */\r\n/* reuse GL_SHADER */\r\n/* reuse GL_PROGRAM */\r\n/* reuse GL_QUERY */\r\n/* reuse GL_PROGRAM_PIPELINE */\r\n/* reuse GL_SAMPLER */\r\n/* reuse GL_DISPLAY_LIST */\r\n/* reuse GL_MAX_LABEL_LENGTH */\r\n/* reuse GL_DEBUG_OUTPUT */\r\n/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */\r\n/* reuse GL_STACK_UNDERFLOW */\r\n/* reuse GL_STACK_OVERFLOW */\r\n/* Reuse tokens from ARB_explicit_uniform_location */\r\n/* reuse GL_MAX_UNIFORM_LOCATIONS */\r\n/* Reuse tokens from ARB_framebuffer_no_attachments */\r\n/* reuse GL_FRAMEBUFFER_DEFAULT_WIDTH */\r\n/* reuse GL_FRAMEBUFFER_DEFAULT_HEIGHT */\r\n/* reuse GL_FRAMEBUFFER_DEFAULT_LAYERS */\r\n/* reuse GL_FRAMEBUFFER_DEFAULT_SAMPLES */\r\n/* reuse GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS */\r\n/* reuse GL_MAX_FRAMEBUFFER_WIDTH */\r\n/* reuse GL_MAX_FRAMEBUFFER_HEIGHT */\r\n/* reuse GL_MAX_FRAMEBUFFER_LAYERS */\r\n/* reuse GL_MAX_FRAMEBUFFER_SAMPLES */\r\n/* Reuse tokens from ARB_internalformat_query2 */\r\n/* reuse GL_INTERNALFORMAT_SUPPORTED */\r\n/* reuse GL_INTERNALFORMAT_PREFERRED */\r\n/* reuse GL_INTERNALFORMAT_RED_SIZE */\r\n/* reuse GL_INTERNALFORMAT_GREEN_SIZE */\r\n/* reuse GL_INTERNALFORMAT_BLUE_SIZE */\r\n/* reuse GL_INTERNALFORMAT_ALPHA_SIZE */\r\n/* reuse GL_INTERNALFORMAT_DEPTH_SIZE */\r\n/* reuse GL_INTERNALFORMAT_STENCIL_SIZE */\r\n/* reuse GL_INTERNALFORMAT_SHARED_SIZE */\r\n/* reuse GL_INTERNALFORMAT_RED_TYPE */\r\n/* reuse GL_INTERNALFORMAT_GREEN_TYPE */\r\n/* reuse GL_INTERNALFORMAT_BLUE_TYPE */\r\n/* reuse GL_INTERNALFORMAT_ALPHA_TYPE */\r\n/* reuse GL_INTERNALFORMAT_DEPTH_TYPE */\r\n/* reuse GL_INTERNALFORMAT_STENCIL_TYPE */\r\n/* reuse GL_MAX_WIDTH */\r\n/* reuse GL_MAX_HEIGHT */\r\n/* reuse GL_MAX_DEPTH */\r\n/* reuse GL_MAX_LAYERS */\r\n/* reuse GL_MAX_COMBINED_DIMENSIONS */\r\n/* reuse GL_COLOR_COMPONENTS */\r\n/* reuse GL_DEPTH_COMPONENTS */\r\n/* reuse GL_STENCIL_COMPONENTS */\r\n/* reuse GL_COLOR_RENDERABLE */\r\n/* reuse GL_DEPTH_RENDERABLE */\r\n/* reuse GL_STENCIL_RENDERABLE */\r\n/* reuse GL_FRAMEBUFFER_RENDERABLE */\r\n/* reuse GL_FRAMEBUFFER_RENDERABLE_LAYERED */\r\n/* reuse GL_FRAMEBUFFER_BLEND */\r\n/* reuse GL_READ_PIXELS */\r\n/* reuse GL_READ_PIXELS_FORMAT */\r\n/* reuse GL_READ_PIXELS_TYPE */\r\n/* reuse GL_TEXTURE_IMAGE_FORMAT */\r\n/* reuse GL_TEXTURE_IMAGE_TYPE */\r\n/* reuse GL_GET_TEXTURE_IMAGE_FORMAT */\r\n/* reuse GL_GET_TEXTURE_IMAGE_TYPE */\r\n/* reuse GL_MIPMAP */\r\n/* reuse GL_MANUAL_GENERATE_MIPMAP */\r\n/* reuse GL_AUTO_GENERATE_MIPMAP */\r\n/* reuse GL_COLOR_ENCODING */\r\n/* reuse GL_SRGB_READ */\r\n/* reuse GL_SRGB_WRITE */\r\n/* reuse GL_FILTER */\r\n/* reuse GL_VERTEX_TEXTURE */\r\n/* reuse GL_TESS_CONTROL_TEXTURE */\r\n/* reuse GL_TESS_EVALUATION_TEXTURE */\r\n/* reuse GL_GEOMETRY_TEXTURE */\r\n/* reuse GL_FRAGMENT_TEXTURE */\r\n/* reuse GL_COMPUTE_TEXTURE */\r\n/* reuse GL_TEXTURE_SHADOW */\r\n/* reuse GL_TEXTURE_GATHER */\r\n/* reuse GL_TEXTURE_GATHER_SHADOW */\r\n/* reuse GL_SHADER_IMAGE_LOAD */\r\n/* reuse GL_SHADER_IMAGE_STORE */\r\n/* reuse GL_SHADER_IMAGE_ATOMIC */\r\n/* reuse GL_IMAGE_TEXEL_SIZE */\r\n/* reuse GL_IMAGE_COMPATIBILITY_CLASS */\r\n/* reuse GL_IMAGE_PIXEL_FORMAT */\r\n/* reuse GL_IMAGE_PIXEL_TYPE */\r\n/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST */\r\n/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST */\r\n/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE */\r\n/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE */\r\n/* reuse GL_TEXTURE_COMPRESSED_BLOCK_WIDTH */\r\n/* reuse GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT */\r\n/* reuse GL_TEXTURE_COMPRESSED_BLOCK_SIZE */\r\n/* reuse GL_CLEAR_BUFFER */\r\n/* reuse GL_TEXTURE_VIEW */\r\n/* reuse GL_VIEW_COMPATIBILITY_CLASS */\r\n/* reuse GL_FULL_SUPPORT */\r\n/* reuse GL_CAVEAT_SUPPORT */\r\n/* reuse GL_IMAGE_CLASS_4_X_32 */\r\n/* reuse GL_IMAGE_CLASS_2_X_32 */\r\n/* reuse GL_IMAGE_CLASS_1_X_32 */\r\n/* reuse GL_IMAGE_CLASS_4_X_16 */\r\n/* reuse GL_IMAGE_CLASS_2_X_16 */\r\n/* reuse GL_IMAGE_CLASS_1_X_16 */\r\n/* reuse GL_IMAGE_CLASS_4_X_8 */\r\n/* reuse GL_IMAGE_CLASS_2_X_8 */\r\n/* reuse GL_IMAGE_CLASS_1_X_8 */\r\n/* reuse GL_IMAGE_CLASS_11_11_10 */\r\n/* reuse GL_IMAGE_CLASS_10_10_10_2 */\r\n/* reuse GL_VIEW_CLASS_128_BITS */\r\n/* reuse GL_VIEW_CLASS_96_BITS */\r\n/* reuse GL_VIEW_CLASS_64_BITS */\r\n/* reuse GL_VIEW_CLASS_48_BITS */\r\n/* reuse GL_VIEW_CLASS_32_BITS */\r\n/* reuse GL_VIEW_CLASS_24_BITS */\r\n/* reuse GL_VIEW_CLASS_16_BITS */\r\n/* reuse GL_VIEW_CLASS_8_BITS */\r\n/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGB */\r\n/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGBA */\r\n/* reuse GL_VIEW_CLASS_S3TC_DXT3_RGBA */\r\n/* reuse GL_VIEW_CLASS_S3TC_DXT5_RGBA */\r\n/* reuse GL_VIEW_CLASS_RGTC1_RED */\r\n/* reuse GL_VIEW_CLASS_RGTC2_RG */\r\n/* reuse GL_VIEW_CLASS_BPTC_UNORM */\r\n/* reuse GL_VIEW_CLASS_BPTC_FLOAT */\r\n/* Reuse tokens from ARB_invalidate_subdata (none) */\r\n/* Reuse tokens from ARB_multi_draw_indirect (none) */\r\n/* Reuse tokens from ARB_program_interface_query */\r\n/* reuse GL_UNIFORM */\r\n/* reuse GL_UNIFORM_BLOCK */\r\n/* reuse GL_PROGRAM_INPUT */\r\n/* reuse GL_PROGRAM_OUTPUT */\r\n/* reuse GL_BUFFER_VARIABLE */\r\n/* reuse GL_SHADER_STORAGE_BLOCK */\r\n/* reuse GL_VERTEX_SUBROUTINE */\r\n/* reuse GL_TESS_CONTROL_SUBROUTINE */\r\n/* reuse GL_TESS_EVALUATION_SUBROUTINE */\r\n/* reuse GL_GEOMETRY_SUBROUTINE */\r\n/* reuse GL_FRAGMENT_SUBROUTINE */\r\n/* reuse GL_COMPUTE_SUBROUTINE */\r\n/* reuse GL_VERTEX_SUBROUTINE_UNIFORM */\r\n/* reuse GL_TESS_CONTROL_SUBROUTINE_UNIFORM */\r\n/* reuse GL_TESS_EVALUATION_SUBROUTINE_UNIFORM */\r\n/* reuse GL_GEOMETRY_SUBROUTINE_UNIFORM */\r\n/* reuse GL_FRAGMENT_SUBROUTINE_UNIFORM */\r\n/* reuse GL_COMPUTE_SUBROUTINE_UNIFORM */\r\n/* reuse GL_TRANSFORM_FEEDBACK_VARYING */\r\n/* reuse GL_ACTIVE_RESOURCES */\r\n/* reuse GL_MAX_NAME_LENGTH */\r\n/* reuse GL_MAX_NUM_ACTIVE_VARIABLES */\r\n/* reuse GL_MAX_NUM_COMPATIBLE_SUBROUTINES */\r\n/* reuse GL_NAME_LENGTH */\r\n/* reuse GL_TYPE */\r\n/* reuse GL_ARRAY_SIZE */\r\n/* reuse GL_OFFSET */\r\n/* reuse GL_BLOCK_INDEX */\r\n/* reuse GL_ARRAY_STRIDE */\r\n/* reuse GL_MATRIX_STRIDE */\r\n/* reuse GL_IS_ROW_MAJOR */\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER_INDEX */\r\n/* reuse GL_BUFFER_BINDING */\r\n/* reuse GL_BUFFER_DATA_SIZE */\r\n/* reuse GL_NUM_ACTIVE_VARIABLES */\r\n/* reuse GL_ACTIVE_VARIABLES */\r\n/* reuse GL_REFERENCED_BY_VERTEX_SHADER */\r\n/* reuse GL_REFERENCED_BY_TESS_CONTROL_SHADER */\r\n/* reuse GL_REFERENCED_BY_TESS_EVALUATION_SHADER */\r\n/* reuse GL_REFERENCED_BY_GEOMETRY_SHADER */\r\n/* reuse GL_REFERENCED_BY_FRAGMENT_SHADER */\r\n/* reuse GL_REFERENCED_BY_COMPUTE_SHADER */\r\n/* reuse GL_TOP_LEVEL_ARRAY_SIZE */\r\n/* reuse GL_TOP_LEVEL_ARRAY_STRIDE */\r\n/* reuse GL_LOCATION */\r\n/* reuse GL_LOCATION_INDEX */\r\n/* reuse GL_IS_PER_PATCH */\r\n/* Reuse tokens from ARB_robust_buffer_access_behavior (none) */\r\n/* Reuse tokens from ARB_shader_storage_buffer_object */\r\n/* reuse GL_SHADER_STORAGE_BUFFER */\r\n/* reuse GL_SHADER_STORAGE_BUFFER_BINDING */\r\n/* reuse GL_SHADER_STORAGE_BUFFER_START */\r\n/* reuse GL_SHADER_STORAGE_BUFFER_SIZE */\r\n/* reuse GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS */\r\n/* reuse GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS */\r\n/* reuse GL_MAX_SHADER_STORAGE_BLOCK_SIZE */\r\n/* reuse GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT */\r\n/* reuse GL_SHADER_STORAGE_BARRIER_BIT */\r\n/* reuse GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES */\r\n/* Reuse tokens from ARB_stencil_texturing */\r\n/* reuse GL_DEPTH_STENCIL_TEXTURE_MODE */\r\n/* Reuse tokens from ARB_texture_buffer_range */\r\n/* reuse GL_TEXTURE_BUFFER_OFFSET */\r\n/* reuse GL_TEXTURE_BUFFER_SIZE */\r\n/* reuse GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT */\r\n/* Reuse tokens from ARB_texture_query_levels (none) */\r\n/* Reuse tokens from ARB_texture_storage_multisample (none) */\r\n/* Reuse tokens from ARB_texture_view */\r\n/* reuse GL_TEXTURE_VIEW_MIN_LEVEL */\r\n/* reuse GL_TEXTURE_VIEW_NUM_LEVELS */\r\n/* reuse GL_TEXTURE_VIEW_MIN_LAYER */\r\n/* reuse GL_TEXTURE_VIEW_NUM_LAYERS */\r\n/* reuse GL_TEXTURE_IMMUTABLE_LEVELS */\r\n/* Reuse tokens from ARB_vertex_attrib_binding */\r\n/* reuse GL_VERTEX_ATTRIB_BINDING */\r\n/* reuse GL_VERTEX_ATTRIB_RELATIVE_OFFSET */\r\n/* reuse GL_VERTEX_BINDING_DIVISOR */\r\n/* reuse GL_VERTEX_BINDING_OFFSET */\r\n/* reuse GL_VERTEX_BINDING_STRIDE */\r\n/* reuse GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET */\r\n/* reuse GL_MAX_VERTEX_ATTRIB_BINDINGS */\r\n#endif\r\n\r\n#ifndef GL_ARB_multitexture\r\n#define GL_TEXTURE0_ARB                   0x84C0\r\n#define GL_TEXTURE1_ARB                   0x84C1\r\n#define GL_TEXTURE2_ARB                   0x84C2\r\n#define GL_TEXTURE3_ARB                   0x84C3\r\n#define GL_TEXTURE4_ARB                   0x84C4\r\n#define GL_TEXTURE5_ARB                   0x84C5\r\n#define GL_TEXTURE6_ARB                   0x84C6\r\n#define GL_TEXTURE7_ARB                   0x84C7\r\n#define GL_TEXTURE8_ARB                   0x84C8\r\n#define GL_TEXTURE9_ARB                   0x84C9\r\n#define GL_TEXTURE10_ARB                  0x84CA\r\n#define GL_TEXTURE11_ARB                  0x84CB\r\n#define GL_TEXTURE12_ARB                  0x84CC\r\n#define GL_TEXTURE13_ARB                  0x84CD\r\n#define GL_TEXTURE14_ARB                  0x84CE\r\n#define GL_TEXTURE15_ARB                  0x84CF\r\n#define GL_TEXTURE16_ARB                  0x84D0\r\n#define GL_TEXTURE17_ARB                  0x84D1\r\n#define GL_TEXTURE18_ARB                  0x84D2\r\n#define GL_TEXTURE19_ARB                  0x84D3\r\n#define GL_TEXTURE20_ARB                  0x84D4\r\n#define GL_TEXTURE21_ARB                  0x84D5\r\n#define GL_TEXTURE22_ARB                  0x84D6\r\n#define GL_TEXTURE23_ARB                  0x84D7\r\n#define GL_TEXTURE24_ARB                  0x84D8\r\n#define GL_TEXTURE25_ARB                  0x84D9\r\n#define GL_TEXTURE26_ARB                  0x84DA\r\n#define GL_TEXTURE27_ARB                  0x84DB\r\n#define GL_TEXTURE28_ARB                  0x84DC\r\n#define GL_TEXTURE29_ARB                  0x84DD\r\n#define GL_TEXTURE30_ARB                  0x84DE\r\n#define GL_TEXTURE31_ARB                  0x84DF\r\n#define GL_ACTIVE_TEXTURE_ARB             0x84E0\r\n#define GL_CLIENT_ACTIVE_TEXTURE_ARB      0x84E1\r\n#define GL_MAX_TEXTURE_UNITS_ARB          0x84E2\r\n#endif\r\n\r\n#ifndef GL_ARB_transpose_matrix\r\n#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3\r\n#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4\r\n#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB   0x84E5\r\n#define GL_TRANSPOSE_COLOR_MATRIX_ARB     0x84E6\r\n#endif\r\n\r\n#ifndef GL_ARB_multisample\r\n#define GL_MULTISAMPLE_ARB                0x809D\r\n#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB   0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE_ARB        0x809F\r\n#define GL_SAMPLE_COVERAGE_ARB            0x80A0\r\n#define GL_SAMPLE_BUFFERS_ARB             0x80A8\r\n#define GL_SAMPLES_ARB                    0x80A9\r\n#define GL_SAMPLE_COVERAGE_VALUE_ARB      0x80AA\r\n#define GL_SAMPLE_COVERAGE_INVERT_ARB     0x80AB\r\n#define GL_MULTISAMPLE_BIT_ARB            0x20000000\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_add\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_cube_map\r\n#define GL_NORMAL_MAP_ARB                 0x8511\r\n#define GL_REFLECTION_MAP_ARB             0x8512\r\n#define GL_TEXTURE_CUBE_MAP_ARB           0x8513\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARB   0x8514\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARB     0x851B\r\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB  0x851C\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_compression\r\n#define GL_COMPRESSED_ALPHA_ARB           0x84E9\r\n#define GL_COMPRESSED_LUMINANCE_ARB       0x84EA\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB\r\n#define GL_COMPRESSED_INTENSITY_ARB       0x84EC\r\n#define GL_COMPRESSED_RGB_ARB             0x84ED\r\n#define GL_COMPRESSED_RGBA_ARB            0x84EE\r\n#define GL_TEXTURE_COMPRESSION_HINT_ARB   0x84EF\r\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0\r\n#define GL_TEXTURE_COMPRESSED_ARB         0x86A1\r\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2\r\n#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_border_clamp\r\n#define GL_CLAMP_TO_BORDER_ARB            0x812D\r\n#endif\r\n\r\n#ifndef GL_ARB_point_parameters\r\n#define GL_POINT_SIZE_MIN_ARB             0x8126\r\n#define GL_POINT_SIZE_MAX_ARB             0x8127\r\n#define GL_POINT_FADE_THRESHOLD_SIZE_ARB  0x8128\r\n#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_blend\r\n#define GL_MAX_VERTEX_UNITS_ARB           0x86A4\r\n#define GL_ACTIVE_VERTEX_UNITS_ARB        0x86A5\r\n#define GL_WEIGHT_SUM_UNITY_ARB           0x86A6\r\n#define GL_VERTEX_BLEND_ARB               0x86A7\r\n#define GL_CURRENT_WEIGHT_ARB             0x86A8\r\n#define GL_WEIGHT_ARRAY_TYPE_ARB          0x86A9\r\n#define GL_WEIGHT_ARRAY_STRIDE_ARB        0x86AA\r\n#define GL_WEIGHT_ARRAY_SIZE_ARB          0x86AB\r\n#define GL_WEIGHT_ARRAY_POINTER_ARB       0x86AC\r\n#define GL_WEIGHT_ARRAY_ARB               0x86AD\r\n#define GL_MODELVIEW0_ARB                 0x1700\r\n#define GL_MODELVIEW1_ARB                 0x850A\r\n#define GL_MODELVIEW2_ARB                 0x8722\r\n#define GL_MODELVIEW3_ARB                 0x8723\r\n#define GL_MODELVIEW4_ARB                 0x8724\r\n#define GL_MODELVIEW5_ARB                 0x8725\r\n#define GL_MODELVIEW6_ARB                 0x8726\r\n#define GL_MODELVIEW7_ARB                 0x8727\r\n#define GL_MODELVIEW8_ARB                 0x8728\r\n#define GL_MODELVIEW9_ARB                 0x8729\r\n#define GL_MODELVIEW10_ARB                0x872A\r\n#define GL_MODELVIEW11_ARB                0x872B\r\n#define GL_MODELVIEW12_ARB                0x872C\r\n#define GL_MODELVIEW13_ARB                0x872D\r\n#define GL_MODELVIEW14_ARB                0x872E\r\n#define GL_MODELVIEW15_ARB                0x872F\r\n#define GL_MODELVIEW16_ARB                0x8730\r\n#define GL_MODELVIEW17_ARB                0x8731\r\n#define GL_MODELVIEW18_ARB                0x8732\r\n#define GL_MODELVIEW19_ARB                0x8733\r\n#define GL_MODELVIEW20_ARB                0x8734\r\n#define GL_MODELVIEW21_ARB                0x8735\r\n#define GL_MODELVIEW22_ARB                0x8736\r\n#define GL_MODELVIEW23_ARB                0x8737\r\n#define GL_MODELVIEW24_ARB                0x8738\r\n#define GL_MODELVIEW25_ARB                0x8739\r\n#define GL_MODELVIEW26_ARB                0x873A\r\n#define GL_MODELVIEW27_ARB                0x873B\r\n#define GL_MODELVIEW28_ARB                0x873C\r\n#define GL_MODELVIEW29_ARB                0x873D\r\n#define GL_MODELVIEW30_ARB                0x873E\r\n#define GL_MODELVIEW31_ARB                0x873F\r\n#endif\r\n\r\n#ifndef GL_ARB_matrix_palette\r\n#define GL_MATRIX_PALETTE_ARB             0x8840\r\n#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841\r\n#define GL_MAX_PALETTE_MATRICES_ARB       0x8842\r\n#define GL_CURRENT_PALETTE_MATRIX_ARB     0x8843\r\n#define GL_MATRIX_INDEX_ARRAY_ARB         0x8844\r\n#define GL_CURRENT_MATRIX_INDEX_ARB       0x8845\r\n#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB    0x8846\r\n#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB    0x8847\r\n#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB  0x8848\r\n#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_combine\r\n#define GL_COMBINE_ARB                    0x8570\r\n#define GL_COMBINE_RGB_ARB                0x8571\r\n#define GL_COMBINE_ALPHA_ARB              0x8572\r\n#define GL_SOURCE0_RGB_ARB                0x8580\r\n#define GL_SOURCE1_RGB_ARB                0x8581\r\n#define GL_SOURCE2_RGB_ARB                0x8582\r\n#define GL_SOURCE0_ALPHA_ARB              0x8588\r\n#define GL_SOURCE1_ALPHA_ARB              0x8589\r\n#define GL_SOURCE2_ALPHA_ARB              0x858A\r\n#define GL_OPERAND0_RGB_ARB               0x8590\r\n#define GL_OPERAND1_RGB_ARB               0x8591\r\n#define GL_OPERAND2_RGB_ARB               0x8592\r\n#define GL_OPERAND0_ALPHA_ARB             0x8598\r\n#define GL_OPERAND1_ALPHA_ARB             0x8599\r\n#define GL_OPERAND2_ALPHA_ARB             0x859A\r\n#define GL_RGB_SCALE_ARB                  0x8573\r\n#define GL_ADD_SIGNED_ARB                 0x8574\r\n#define GL_INTERPOLATE_ARB                0x8575\r\n#define GL_SUBTRACT_ARB                   0x84E7\r\n#define GL_CONSTANT_ARB                   0x8576\r\n#define GL_PRIMARY_COLOR_ARB              0x8577\r\n#define GL_PREVIOUS_ARB                   0x8578\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_crossbar\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_dot3\r\n#define GL_DOT3_RGB_ARB                   0x86AE\r\n#define GL_DOT3_RGBA_ARB                  0x86AF\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_mirrored_repeat\r\n#define GL_MIRRORED_REPEAT_ARB            0x8370\r\n#endif\r\n\r\n#ifndef GL_ARB_depth_texture\r\n#define GL_DEPTH_COMPONENT16_ARB          0x81A5\r\n#define GL_DEPTH_COMPONENT24_ARB          0x81A6\r\n#define GL_DEPTH_COMPONENT32_ARB          0x81A7\r\n#define GL_TEXTURE_DEPTH_SIZE_ARB         0x884A\r\n#define GL_DEPTH_TEXTURE_MODE_ARB         0x884B\r\n#endif\r\n\r\n#ifndef GL_ARB_shadow\r\n#define GL_TEXTURE_COMPARE_MODE_ARB       0x884C\r\n#define GL_TEXTURE_COMPARE_FUNC_ARB       0x884D\r\n#define GL_COMPARE_R_TO_TEXTURE_ARB       0x884E\r\n#endif\r\n\r\n#ifndef GL_ARB_shadow_ambient\r\n#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF\r\n#endif\r\n\r\n#ifndef GL_ARB_window_pos\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_program\r\n#define GL_COLOR_SUM_ARB                  0x8458\r\n#define GL_VERTEX_PROGRAM_ARB             0x8620\r\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622\r\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB   0x8623\r\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624\r\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB   0x8625\r\n#define GL_CURRENT_VERTEX_ATTRIB_ARB      0x8626\r\n#define GL_PROGRAM_LENGTH_ARB             0x8627\r\n#define GL_PROGRAM_STRING_ARB             0x8628\r\n#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E\r\n#define GL_MAX_PROGRAM_MATRICES_ARB       0x862F\r\n#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640\r\n#define GL_CURRENT_MATRIX_ARB             0x8641\r\n#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB  0x8642\r\n#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB    0x8643\r\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645\r\n#define GL_PROGRAM_ERROR_POSITION_ARB     0x864B\r\n#define GL_PROGRAM_BINDING_ARB            0x8677\r\n#define GL_MAX_VERTEX_ATTRIBS_ARB         0x8869\r\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A\r\n#define GL_PROGRAM_ERROR_STRING_ARB       0x8874\r\n#define GL_PROGRAM_FORMAT_ASCII_ARB       0x8875\r\n#define GL_PROGRAM_FORMAT_ARB             0x8876\r\n#define GL_PROGRAM_INSTRUCTIONS_ARB       0x88A0\r\n#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB   0x88A1\r\n#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2\r\n#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3\r\n#define GL_PROGRAM_TEMPORARIES_ARB        0x88A4\r\n#define GL_MAX_PROGRAM_TEMPORARIES_ARB    0x88A5\r\n#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6\r\n#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7\r\n#define GL_PROGRAM_PARAMETERS_ARB         0x88A8\r\n#define GL_MAX_PROGRAM_PARAMETERS_ARB     0x88A9\r\n#define GL_PROGRAM_NATIVE_PARAMETERS_ARB  0x88AA\r\n#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB\r\n#define GL_PROGRAM_ATTRIBS_ARB            0x88AC\r\n#define GL_MAX_PROGRAM_ATTRIBS_ARB        0x88AD\r\n#define GL_PROGRAM_NATIVE_ATTRIBS_ARB     0x88AE\r\n#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF\r\n#define GL_PROGRAM_ADDRESS_REGISTERS_ARB  0x88B0\r\n#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1\r\n#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2\r\n#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3\r\n#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4\r\n#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5\r\n#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6\r\n#define GL_TRANSPOSE_CURRENT_MATRIX_ARB   0x88B7\r\n#define GL_MATRIX0_ARB                    0x88C0\r\n#define GL_MATRIX1_ARB                    0x88C1\r\n#define GL_MATRIX2_ARB                    0x88C2\r\n#define GL_MATRIX3_ARB                    0x88C3\r\n#define GL_MATRIX4_ARB                    0x88C4\r\n#define GL_MATRIX5_ARB                    0x88C5\r\n#define GL_MATRIX6_ARB                    0x88C6\r\n#define GL_MATRIX7_ARB                    0x88C7\r\n#define GL_MATRIX8_ARB                    0x88C8\r\n#define GL_MATRIX9_ARB                    0x88C9\r\n#define GL_MATRIX10_ARB                   0x88CA\r\n#define GL_MATRIX11_ARB                   0x88CB\r\n#define GL_MATRIX12_ARB                   0x88CC\r\n#define GL_MATRIX13_ARB                   0x88CD\r\n#define GL_MATRIX14_ARB                   0x88CE\r\n#define GL_MATRIX15_ARB                   0x88CF\r\n#define GL_MATRIX16_ARB                   0x88D0\r\n#define GL_MATRIX17_ARB                   0x88D1\r\n#define GL_MATRIX18_ARB                   0x88D2\r\n#define GL_MATRIX19_ARB                   0x88D3\r\n#define GL_MATRIX20_ARB                   0x88D4\r\n#define GL_MATRIX21_ARB                   0x88D5\r\n#define GL_MATRIX22_ARB                   0x88D6\r\n#define GL_MATRIX23_ARB                   0x88D7\r\n#define GL_MATRIX24_ARB                   0x88D8\r\n#define GL_MATRIX25_ARB                   0x88D9\r\n#define GL_MATRIX26_ARB                   0x88DA\r\n#define GL_MATRIX27_ARB                   0x88DB\r\n#define GL_MATRIX28_ARB                   0x88DC\r\n#define GL_MATRIX29_ARB                   0x88DD\r\n#define GL_MATRIX30_ARB                   0x88DE\r\n#define GL_MATRIX31_ARB                   0x88DF\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_program\r\n#define GL_FRAGMENT_PROGRAM_ARB           0x8804\r\n#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB   0x8805\r\n#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB   0x8806\r\n#define GL_PROGRAM_TEX_INDIRECTIONS_ARB   0x8807\r\n#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808\r\n#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809\r\n#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A\r\n#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B\r\n#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C\r\n#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D\r\n#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E\r\n#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F\r\n#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810\r\n#define GL_MAX_TEXTURE_COORDS_ARB         0x8871\r\n#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB    0x8872\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_buffer_object\r\n#define GL_BUFFER_SIZE_ARB                0x8764\r\n#define GL_BUFFER_USAGE_ARB               0x8765\r\n#define GL_ARRAY_BUFFER_ARB               0x8892\r\n#define GL_ELEMENT_ARRAY_BUFFER_ARB       0x8893\r\n#define GL_ARRAY_BUFFER_BINDING_ARB       0x8894\r\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895\r\n#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896\r\n#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897\r\n#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898\r\n#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899\r\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A\r\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B\r\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C\r\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D\r\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E\r\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F\r\n#define GL_READ_ONLY_ARB                  0x88B8\r\n#define GL_WRITE_ONLY_ARB                 0x88B9\r\n#define GL_READ_WRITE_ARB                 0x88BA\r\n#define GL_BUFFER_ACCESS_ARB              0x88BB\r\n#define GL_BUFFER_MAPPED_ARB              0x88BC\r\n#define GL_BUFFER_MAP_POINTER_ARB         0x88BD\r\n#define GL_STREAM_DRAW_ARB                0x88E0\r\n#define GL_STREAM_READ_ARB                0x88E1\r\n#define GL_STREAM_COPY_ARB                0x88E2\r\n#define GL_STATIC_DRAW_ARB                0x88E4\r\n#define GL_STATIC_READ_ARB                0x88E5\r\n#define GL_STATIC_COPY_ARB                0x88E6\r\n#define GL_DYNAMIC_DRAW_ARB               0x88E8\r\n#define GL_DYNAMIC_READ_ARB               0x88E9\r\n#define GL_DYNAMIC_COPY_ARB               0x88EA\r\n#endif\r\n\r\n#ifndef GL_ARB_occlusion_query\r\n#define GL_QUERY_COUNTER_BITS_ARB         0x8864\r\n#define GL_CURRENT_QUERY_ARB              0x8865\r\n#define GL_QUERY_RESULT_ARB               0x8866\r\n#define GL_QUERY_RESULT_AVAILABLE_ARB     0x8867\r\n#define GL_SAMPLES_PASSED_ARB             0x8914\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_objects\r\n#define GL_PROGRAM_OBJECT_ARB             0x8B40\r\n#define GL_SHADER_OBJECT_ARB              0x8B48\r\n#define GL_OBJECT_TYPE_ARB                0x8B4E\r\n#define GL_OBJECT_SUBTYPE_ARB             0x8B4F\r\n#define GL_FLOAT_VEC2_ARB                 0x8B50\r\n#define GL_FLOAT_VEC3_ARB                 0x8B51\r\n#define GL_FLOAT_VEC4_ARB                 0x8B52\r\n#define GL_INT_VEC2_ARB                   0x8B53\r\n#define GL_INT_VEC3_ARB                   0x8B54\r\n#define GL_INT_VEC4_ARB                   0x8B55\r\n#define GL_BOOL_ARB                       0x8B56\r\n#define GL_BOOL_VEC2_ARB                  0x8B57\r\n#define GL_BOOL_VEC3_ARB                  0x8B58\r\n#define GL_BOOL_VEC4_ARB                  0x8B59\r\n#define GL_FLOAT_MAT2_ARB                 0x8B5A\r\n#define GL_FLOAT_MAT3_ARB                 0x8B5B\r\n#define GL_FLOAT_MAT4_ARB                 0x8B5C\r\n#define GL_SAMPLER_1D_ARB                 0x8B5D\r\n#define GL_SAMPLER_2D_ARB                 0x8B5E\r\n#define GL_SAMPLER_3D_ARB                 0x8B5F\r\n#define GL_SAMPLER_CUBE_ARB               0x8B60\r\n#define GL_SAMPLER_1D_SHADOW_ARB          0x8B61\r\n#define GL_SAMPLER_2D_SHADOW_ARB          0x8B62\r\n#define GL_SAMPLER_2D_RECT_ARB            0x8B63\r\n#define GL_SAMPLER_2D_RECT_SHADOW_ARB     0x8B64\r\n#define GL_OBJECT_DELETE_STATUS_ARB       0x8B80\r\n#define GL_OBJECT_COMPILE_STATUS_ARB      0x8B81\r\n#define GL_OBJECT_LINK_STATUS_ARB         0x8B82\r\n#define GL_OBJECT_VALIDATE_STATUS_ARB     0x8B83\r\n#define GL_OBJECT_INFO_LOG_LENGTH_ARB     0x8B84\r\n#define GL_OBJECT_ATTACHED_OBJECTS_ARB    0x8B85\r\n#define GL_OBJECT_ACTIVE_UNIFORMS_ARB     0x8B86\r\n#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87\r\n#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_shader\r\n#define GL_VERTEX_SHADER_ARB              0x8B31\r\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A\r\n#define GL_MAX_VARYING_FLOATS_ARB         0x8B4B\r\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C\r\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D\r\n#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB   0x8B89\r\n#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_shader\r\n#define GL_FRAGMENT_SHADER_ARB            0x8B30\r\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49\r\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_100\r\n#define GL_SHADING_LANGUAGE_VERSION_ARB   0x8B8C\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_non_power_of_two\r\n#endif\r\n\r\n#ifndef GL_ARB_point_sprite\r\n#define GL_POINT_SPRITE_ARB               0x8861\r\n#define GL_COORD_REPLACE_ARB              0x8862\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_program_shadow\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_buffers\r\n#define GL_MAX_DRAW_BUFFERS_ARB           0x8824\r\n#define GL_DRAW_BUFFER0_ARB               0x8825\r\n#define GL_DRAW_BUFFER1_ARB               0x8826\r\n#define GL_DRAW_BUFFER2_ARB               0x8827\r\n#define GL_DRAW_BUFFER3_ARB               0x8828\r\n#define GL_DRAW_BUFFER4_ARB               0x8829\r\n#define GL_DRAW_BUFFER5_ARB               0x882A\r\n#define GL_DRAW_BUFFER6_ARB               0x882B\r\n#define GL_DRAW_BUFFER7_ARB               0x882C\r\n#define GL_DRAW_BUFFER8_ARB               0x882D\r\n#define GL_DRAW_BUFFER9_ARB               0x882E\r\n#define GL_DRAW_BUFFER10_ARB              0x882F\r\n#define GL_DRAW_BUFFER11_ARB              0x8830\r\n#define GL_DRAW_BUFFER12_ARB              0x8831\r\n#define GL_DRAW_BUFFER13_ARB              0x8832\r\n#define GL_DRAW_BUFFER14_ARB              0x8833\r\n#define GL_DRAW_BUFFER15_ARB              0x8834\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_rectangle\r\n#define GL_TEXTURE_RECTANGLE_ARB          0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE_ARB  0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE_ARB    0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8\r\n#endif\r\n\r\n#ifndef GL_ARB_color_buffer_float\r\n#define GL_RGBA_FLOAT_MODE_ARB            0x8820\r\n#define GL_CLAMP_VERTEX_COLOR_ARB         0x891A\r\n#define GL_CLAMP_FRAGMENT_COLOR_ARB       0x891B\r\n#define GL_CLAMP_READ_COLOR_ARB           0x891C\r\n#define GL_FIXED_ONLY_ARB                 0x891D\r\n#endif\r\n\r\n#ifndef GL_ARB_half_float_pixel\r\n#define GL_HALF_FLOAT_ARB                 0x140B\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_float\r\n#define GL_TEXTURE_RED_TYPE_ARB           0x8C10\r\n#define GL_TEXTURE_GREEN_TYPE_ARB         0x8C11\r\n#define GL_TEXTURE_BLUE_TYPE_ARB          0x8C12\r\n#define GL_TEXTURE_ALPHA_TYPE_ARB         0x8C13\r\n#define GL_TEXTURE_LUMINANCE_TYPE_ARB     0x8C14\r\n#define GL_TEXTURE_INTENSITY_TYPE_ARB     0x8C15\r\n#define GL_TEXTURE_DEPTH_TYPE_ARB         0x8C16\r\n#define GL_UNSIGNED_NORMALIZED_ARB        0x8C17\r\n#define GL_RGBA32F_ARB                    0x8814\r\n#define GL_RGB32F_ARB                     0x8815\r\n#define GL_ALPHA32F_ARB                   0x8816\r\n#define GL_INTENSITY32F_ARB               0x8817\r\n#define GL_LUMINANCE32F_ARB               0x8818\r\n#define GL_LUMINANCE_ALPHA32F_ARB         0x8819\r\n#define GL_RGBA16F_ARB                    0x881A\r\n#define GL_RGB16F_ARB                     0x881B\r\n#define GL_ALPHA16F_ARB                   0x881C\r\n#define GL_INTENSITY16F_ARB               0x881D\r\n#define GL_LUMINANCE16F_ARB               0x881E\r\n#define GL_LUMINANCE_ALPHA16F_ARB         0x881F\r\n#endif\r\n\r\n#ifndef GL_ARB_pixel_buffer_object\r\n#define GL_PIXEL_PACK_BUFFER_ARB          0x88EB\r\n#define GL_PIXEL_UNPACK_BUFFER_ARB        0x88EC\r\n#define GL_PIXEL_PACK_BUFFER_BINDING_ARB  0x88ED\r\n#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF\r\n#endif\r\n\r\n#ifndef GL_ARB_depth_buffer_float\r\n#define GL_DEPTH_COMPONENT32F             0x8CAC\r\n#define GL_DEPTH32F_STENCIL8              0x8CAD\r\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_instanced\r\n#endif\r\n\r\n#ifndef GL_ARB_framebuffer_object\r\n#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506\r\n#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210\r\n#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211\r\n#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212\r\n#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213\r\n#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214\r\n#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215\r\n#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216\r\n#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217\r\n#define GL_FRAMEBUFFER_DEFAULT            0x8218\r\n#define GL_FRAMEBUFFER_UNDEFINED          0x8219\r\n#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A\r\n#define GL_MAX_RENDERBUFFER_SIZE          0x84E8\r\n#define GL_DEPTH_STENCIL                  0x84F9\r\n#define GL_UNSIGNED_INT_24_8              0x84FA\r\n#define GL_DEPTH24_STENCIL8               0x88F0\r\n#define GL_TEXTURE_STENCIL_SIZE           0x88F1\r\n#define GL_TEXTURE_RED_TYPE               0x8C10\r\n#define GL_TEXTURE_GREEN_TYPE             0x8C11\r\n#define GL_TEXTURE_BLUE_TYPE              0x8C12\r\n#define GL_TEXTURE_ALPHA_TYPE             0x8C13\r\n#define GL_TEXTURE_DEPTH_TYPE             0x8C16\r\n#define GL_UNSIGNED_NORMALIZED            0x8C17\r\n#define GL_FRAMEBUFFER_BINDING            0x8CA6\r\n#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6\r\n#define GL_RENDERBUFFER_BINDING           0x8CA7\r\n#define GL_READ_FRAMEBUFFER               0x8CA8\r\n#define GL_DRAW_FRAMEBUFFER               0x8CA9\r\n#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA\r\n#define GL_RENDERBUFFER_SAMPLES           0x8CAB\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\r\n#define GL_FRAMEBUFFER_COMPLETE           0x8CD5\r\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB\r\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC\r\n#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD\r\n#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF\r\n#define GL_COLOR_ATTACHMENT0              0x8CE0\r\n#define GL_COLOR_ATTACHMENT1              0x8CE1\r\n#define GL_COLOR_ATTACHMENT2              0x8CE2\r\n#define GL_COLOR_ATTACHMENT3              0x8CE3\r\n#define GL_COLOR_ATTACHMENT4              0x8CE4\r\n#define GL_COLOR_ATTACHMENT5              0x8CE5\r\n#define GL_COLOR_ATTACHMENT6              0x8CE6\r\n#define GL_COLOR_ATTACHMENT7              0x8CE7\r\n#define GL_COLOR_ATTACHMENT8              0x8CE8\r\n#define GL_COLOR_ATTACHMENT9              0x8CE9\r\n#define GL_COLOR_ATTACHMENT10             0x8CEA\r\n#define GL_COLOR_ATTACHMENT11             0x8CEB\r\n#define GL_COLOR_ATTACHMENT12             0x8CEC\r\n#define GL_COLOR_ATTACHMENT13             0x8CED\r\n#define GL_COLOR_ATTACHMENT14             0x8CEE\r\n#define GL_COLOR_ATTACHMENT15             0x8CEF\r\n#define GL_DEPTH_ATTACHMENT               0x8D00\r\n#define GL_STENCIL_ATTACHMENT             0x8D20\r\n#define GL_FRAMEBUFFER                    0x8D40\r\n#define GL_RENDERBUFFER                   0x8D41\r\n#define GL_RENDERBUFFER_WIDTH             0x8D42\r\n#define GL_RENDERBUFFER_HEIGHT            0x8D43\r\n#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44\r\n#define GL_STENCIL_INDEX1                 0x8D46\r\n#define GL_STENCIL_INDEX4                 0x8D47\r\n#define GL_STENCIL_INDEX8                 0x8D48\r\n#define GL_STENCIL_INDEX16                0x8D49\r\n#define GL_RENDERBUFFER_RED_SIZE          0x8D50\r\n#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51\r\n#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52\r\n#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53\r\n#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54\r\n#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56\r\n#define GL_MAX_SAMPLES                    0x8D57\r\n#define GL_INDEX                          0x8222\r\n#define GL_TEXTURE_LUMINANCE_TYPE         0x8C14\r\n#define GL_TEXTURE_INTENSITY_TYPE         0x8C15\r\n#endif\r\n\r\n#ifndef GL_ARB_framebuffer_sRGB\r\n#define GL_FRAMEBUFFER_SRGB               0x8DB9\r\n#endif\r\n\r\n#ifndef GL_ARB_geometry_shader4\r\n#define GL_LINES_ADJACENCY_ARB            0x000A\r\n#define GL_LINE_STRIP_ADJACENCY_ARB       0x000B\r\n#define GL_TRIANGLES_ADJACENCY_ARB        0x000C\r\n#define GL_TRIANGLE_STRIP_ADJACENCY_ARB   0x000D\r\n#define GL_PROGRAM_POINT_SIZE_ARB         0x8642\r\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29\r\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9\r\n#define GL_GEOMETRY_SHADER_ARB            0x8DD9\r\n#define GL_GEOMETRY_VERTICES_OUT_ARB      0x8DDA\r\n#define GL_GEOMETRY_INPUT_TYPE_ARB        0x8DDB\r\n#define GL_GEOMETRY_OUTPUT_TYPE_ARB       0x8DDC\r\n#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD\r\n#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE\r\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF\r\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0\r\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1\r\n/* reuse GL_MAX_VARYING_COMPONENTS */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */\r\n#endif\r\n\r\n#ifndef GL_ARB_half_float_vertex\r\n#define GL_HALF_FLOAT                     0x140B\r\n#endif\r\n\r\n#ifndef GL_ARB_instanced_arrays\r\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE\r\n#endif\r\n\r\n#ifndef GL_ARB_map_buffer_range\r\n#define GL_MAP_READ_BIT                   0x0001\r\n#define GL_MAP_WRITE_BIT                  0x0002\r\n#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004\r\n#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008\r\n#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010\r\n#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_buffer_object\r\n#define GL_TEXTURE_BUFFER_ARB             0x8C2A\r\n#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB    0x8C2B\r\n#define GL_TEXTURE_BINDING_BUFFER_ARB     0x8C2C\r\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D\r\n#define GL_TEXTURE_BUFFER_FORMAT_ARB      0x8C2E\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_compression_rgtc\r\n#define GL_COMPRESSED_RED_RGTC1           0x8DBB\r\n#define GL_COMPRESSED_SIGNED_RED_RGTC1    0x8DBC\r\n#define GL_COMPRESSED_RG_RGTC2            0x8DBD\r\n#define GL_COMPRESSED_SIGNED_RG_RGTC2     0x8DBE\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_rg\r\n#define GL_RG                             0x8227\r\n#define GL_RG_INTEGER                     0x8228\r\n#define GL_R8                             0x8229\r\n#define GL_R16                            0x822A\r\n#define GL_RG8                            0x822B\r\n#define GL_RG16                           0x822C\r\n#define GL_R16F                           0x822D\r\n#define GL_R32F                           0x822E\r\n#define GL_RG16F                          0x822F\r\n#define GL_RG32F                          0x8230\r\n#define GL_R8I                            0x8231\r\n#define GL_R8UI                           0x8232\r\n#define GL_R16I                           0x8233\r\n#define GL_R16UI                          0x8234\r\n#define GL_R32I                           0x8235\r\n#define GL_R32UI                          0x8236\r\n#define GL_RG8I                           0x8237\r\n#define GL_RG8UI                          0x8238\r\n#define GL_RG16I                          0x8239\r\n#define GL_RG16UI                         0x823A\r\n#define GL_RG32I                          0x823B\r\n#define GL_RG32UI                         0x823C\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_array_object\r\n#define GL_VERTEX_ARRAY_BINDING           0x85B5\r\n#endif\r\n\r\n#ifndef GL_ARB_uniform_buffer_object\r\n#define GL_UNIFORM_BUFFER                 0x8A11\r\n#define GL_UNIFORM_BUFFER_BINDING         0x8A28\r\n#define GL_UNIFORM_BUFFER_START           0x8A29\r\n#define GL_UNIFORM_BUFFER_SIZE            0x8A2A\r\n#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B\r\n#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS    0x8A2C\r\n#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D\r\n#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E\r\n#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F\r\n#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30\r\n#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31\r\n#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32\r\n#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33\r\n#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34\r\n#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35\r\n#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36\r\n#define GL_UNIFORM_TYPE                   0x8A37\r\n#define GL_UNIFORM_SIZE                   0x8A38\r\n#define GL_UNIFORM_NAME_LENGTH            0x8A39\r\n#define GL_UNIFORM_BLOCK_INDEX            0x8A3A\r\n#define GL_UNIFORM_OFFSET                 0x8A3B\r\n#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C\r\n#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D\r\n#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E\r\n#define GL_UNIFORM_BLOCK_BINDING          0x8A3F\r\n#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40\r\n#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41\r\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42\r\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46\r\n#define GL_INVALID_INDEX                  0xFFFFFFFFu\r\n#endif\r\n\r\n#ifndef GL_ARB_compatibility\r\n/* ARB_compatibility just defines tokens from core 3.0 */\r\n#endif\r\n\r\n#ifndef GL_ARB_copy_buffer\r\n#define GL_COPY_READ_BUFFER_BINDING       0x8F36\r\n#define GL_COPY_READ_BUFFER               0x8F36\r\n#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37\r\n#define GL_COPY_WRITE_BUFFER              0x8F37\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_texture_lod\r\n#endif\r\n\r\n#ifndef GL_ARB_depth_clamp\r\n#define GL_DEPTH_CLAMP                    0x864F\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_elements_base_vertex\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_coord_conventions\r\n#endif\r\n\r\n#ifndef GL_ARB_provoking_vertex\r\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C\r\n#define GL_FIRST_VERTEX_CONVENTION        0x8E4D\r\n#define GL_LAST_VERTEX_CONVENTION         0x8E4E\r\n#define GL_PROVOKING_VERTEX               0x8E4F\r\n#endif\r\n\r\n#ifndef GL_ARB_seamless_cube_map\r\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS      0x884F\r\n#endif\r\n\r\n#ifndef GL_ARB_sync\r\n#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111\r\n#define GL_OBJECT_TYPE                    0x9112\r\n#define GL_SYNC_CONDITION                 0x9113\r\n#define GL_SYNC_STATUS                    0x9114\r\n#define GL_SYNC_FLAGS                     0x9115\r\n#define GL_SYNC_FENCE                     0x9116\r\n#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117\r\n#define GL_UNSIGNALED                     0x9118\r\n#define GL_SIGNALED                       0x9119\r\n#define GL_ALREADY_SIGNALED               0x911A\r\n#define GL_TIMEOUT_EXPIRED                0x911B\r\n#define GL_CONDITION_SATISFIED            0x911C\r\n#define GL_WAIT_FAILED                    0x911D\r\n#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001\r\n#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_multisample\r\n#define GL_SAMPLE_POSITION                0x8E50\r\n#define GL_SAMPLE_MASK                    0x8E51\r\n#define GL_SAMPLE_MASK_VALUE              0x8E52\r\n#define GL_MAX_SAMPLE_MASK_WORDS          0x8E59\r\n#define GL_TEXTURE_2D_MULTISAMPLE         0x9100\r\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE   0x9101\r\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY   0x9102\r\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103\r\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104\r\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105\r\n#define GL_TEXTURE_SAMPLES                0x9106\r\n#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107\r\n#define GL_SAMPLER_2D_MULTISAMPLE         0x9108\r\n#define GL_INT_SAMPLER_2D_MULTISAMPLE     0x9109\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A\r\n#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY   0x910B\r\n#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D\r\n#define GL_MAX_COLOR_TEXTURE_SAMPLES      0x910E\r\n#define GL_MAX_DEPTH_TEXTURE_SAMPLES      0x910F\r\n#define GL_MAX_INTEGER_SAMPLES            0x9110\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_array_bgra\r\n/* reuse GL_BGRA */\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_buffers_blend\r\n#endif\r\n\r\n#ifndef GL_ARB_sample_shading\r\n#define GL_SAMPLE_SHADING_ARB             0x8C36\r\n#define GL_MIN_SAMPLE_SHADING_VALUE_ARB   0x8C37\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_cube_map_array\r\n#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB     0x9009\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB     0x900C\r\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D\r\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_gather\r\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_query_lod\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_include\r\n#define GL_SHADER_INCLUDE_ARB             0x8DAE\r\n#define GL_NAMED_STRING_LENGTH_ARB        0x8DE9\r\n#define GL_NAMED_STRING_TYPE_ARB          0x8DEA\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_compression_bptc\r\n#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C\r\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D\r\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E\r\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F\r\n#endif\r\n\r\n#ifndef GL_ARB_blend_func_extended\r\n#define GL_SRC1_COLOR                     0x88F9\r\n/* reuse GL_SRC1_ALPHA */\r\n#define GL_ONE_MINUS_SRC1_COLOR           0x88FA\r\n#define GL_ONE_MINUS_SRC1_ALPHA           0x88FB\r\n#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS   0x88FC\r\n#endif\r\n\r\n#ifndef GL_ARB_explicit_attrib_location\r\n#endif\r\n\r\n#ifndef GL_ARB_occlusion_query2\r\n#define GL_ANY_SAMPLES_PASSED             0x8C2F\r\n#endif\r\n\r\n#ifndef GL_ARB_sampler_objects\r\n#define GL_SAMPLER_BINDING                0x8919\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_bit_encoding\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_rgb10_a2ui\r\n#define GL_RGB10_A2UI                     0x906F\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_swizzle\r\n#define GL_TEXTURE_SWIZZLE_R              0x8E42\r\n#define GL_TEXTURE_SWIZZLE_G              0x8E43\r\n#define GL_TEXTURE_SWIZZLE_B              0x8E44\r\n#define GL_TEXTURE_SWIZZLE_A              0x8E45\r\n#define GL_TEXTURE_SWIZZLE_RGBA           0x8E46\r\n#endif\r\n\r\n#ifndef GL_ARB_timer_query\r\n#define GL_TIME_ELAPSED                   0x88BF\r\n#define GL_TIMESTAMP                      0x8E28\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_type_2_10_10_10_rev\r\n/* reuse GL_UNSIGNED_INT_2_10_10_10_REV */\r\n#define GL_INT_2_10_10_10_REV             0x8D9F\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_indirect\r\n#define GL_DRAW_INDIRECT_BUFFER           0x8F3F\r\n#define GL_DRAW_INDIRECT_BUFFER_BINDING   0x8F43\r\n#endif\r\n\r\n#ifndef GL_ARB_gpu_shader5\r\n#define GL_GEOMETRY_SHADER_INVOCATIONS    0x887F\r\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\r\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\r\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\r\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\r\n/* reuse GL_MAX_VERTEX_STREAMS */\r\n#endif\r\n\r\n#ifndef GL_ARB_gpu_shader_fp64\r\n/* reuse GL_DOUBLE */\r\n#define GL_DOUBLE_VEC2                    0x8FFC\r\n#define GL_DOUBLE_VEC3                    0x8FFD\r\n#define GL_DOUBLE_VEC4                    0x8FFE\r\n#define GL_DOUBLE_MAT2                    0x8F46\r\n#define GL_DOUBLE_MAT3                    0x8F47\r\n#define GL_DOUBLE_MAT4                    0x8F48\r\n#define GL_DOUBLE_MAT2x3                  0x8F49\r\n#define GL_DOUBLE_MAT2x4                  0x8F4A\r\n#define GL_DOUBLE_MAT3x2                  0x8F4B\r\n#define GL_DOUBLE_MAT3x4                  0x8F4C\r\n#define GL_DOUBLE_MAT4x2                  0x8F4D\r\n#define GL_DOUBLE_MAT4x3                  0x8F4E\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_subroutine\r\n#define GL_ACTIVE_SUBROUTINES             0x8DE5\r\n#define GL_ACTIVE_SUBROUTINE_UNIFORMS     0x8DE6\r\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47\r\n#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH   0x8E48\r\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49\r\n#define GL_MAX_SUBROUTINES                0x8DE7\r\n#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8\r\n#define GL_NUM_COMPATIBLE_SUBROUTINES     0x8E4A\r\n#define GL_COMPATIBLE_SUBROUTINES         0x8E4B\r\n/* reuse GL_UNIFORM_SIZE */\r\n/* reuse GL_UNIFORM_NAME_LENGTH */\r\n#endif\r\n\r\n#ifndef GL_ARB_tessellation_shader\r\n#define GL_PATCHES                        0x000E\r\n#define GL_PATCH_VERTICES                 0x8E72\r\n#define GL_PATCH_DEFAULT_INNER_LEVEL      0x8E73\r\n#define GL_PATCH_DEFAULT_OUTER_LEVEL      0x8E74\r\n#define GL_TESS_CONTROL_OUTPUT_VERTICES   0x8E75\r\n#define GL_TESS_GEN_MODE                  0x8E76\r\n#define GL_TESS_GEN_SPACING               0x8E77\r\n#define GL_TESS_GEN_VERTEX_ORDER          0x8E78\r\n#define GL_TESS_GEN_POINT_MODE            0x8E79\r\n/* reuse GL_TRIANGLES */\r\n/* reuse GL_QUADS */\r\n#define GL_ISOLINES                       0x8E7A\r\n/* reuse GL_EQUAL */\r\n#define GL_FRACTIONAL_ODD                 0x8E7B\r\n#define GL_FRACTIONAL_EVEN                0x8E7C\r\n/* reuse GL_CCW */\r\n/* reuse GL_CW */\r\n#define GL_MAX_PATCH_VERTICES             0x8E7D\r\n#define GL_MAX_TESS_GEN_LEVEL             0x8E7E\r\n#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F\r\n#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80\r\n#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81\r\n#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82\r\n#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83\r\n#define GL_MAX_TESS_PATCH_COMPONENTS      0x8E84\r\n#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85\r\n#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86\r\n#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89\r\n#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A\r\n#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C\r\n#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D\r\n#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E\r\n#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1\r\n#define GL_TESS_EVALUATION_SHADER         0x8E87\r\n#define GL_TESS_CONTROL_SHADER            0x8E88\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_buffer_object_rgb32\r\n/* reuse GL_RGB32F */\r\n/* reuse GL_RGB32UI */\r\n/* reuse GL_RGB32I */\r\n#endif\r\n\r\n#ifndef GL_ARB_transform_feedback2\r\n#define GL_TRANSFORM_FEEDBACK             0x8E22\r\n#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23\r\n#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24\r\n#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25\r\n#endif\r\n\r\n#ifndef GL_ARB_transform_feedback3\r\n#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70\r\n#define GL_MAX_VERTEX_STREAMS             0x8E71\r\n#endif\r\n\r\n#ifndef GL_ARB_ES2_compatibility\r\n#define GL_FIXED                          0x140C\r\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A\r\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B\r\n#define GL_LOW_FLOAT                      0x8DF0\r\n#define GL_MEDIUM_FLOAT                   0x8DF1\r\n#define GL_HIGH_FLOAT                     0x8DF2\r\n#define GL_LOW_INT                        0x8DF3\r\n#define GL_MEDIUM_INT                     0x8DF4\r\n#define GL_HIGH_INT                       0x8DF5\r\n#define GL_SHADER_COMPILER                0x8DFA\r\n#define GL_SHADER_BINARY_FORMATS          0x8DF8\r\n#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9\r\n#define GL_MAX_VERTEX_UNIFORM_VECTORS     0x8DFB\r\n#define GL_MAX_VARYING_VECTORS            0x8DFC\r\n#define GL_MAX_FRAGMENT_UNIFORM_VECTORS   0x8DFD\r\n#define GL_RGB565                         0x8D62\r\n#endif\r\n\r\n#ifndef GL_ARB_get_program_binary\r\n#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257\r\n#define GL_PROGRAM_BINARY_LENGTH          0x8741\r\n#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE\r\n#define GL_PROGRAM_BINARY_FORMATS         0x87FF\r\n#endif\r\n\r\n#ifndef GL_ARB_separate_shader_objects\r\n#define GL_VERTEX_SHADER_BIT              0x00000001\r\n#define GL_FRAGMENT_SHADER_BIT            0x00000002\r\n#define GL_GEOMETRY_SHADER_BIT            0x00000004\r\n#define GL_TESS_CONTROL_SHADER_BIT        0x00000008\r\n#define GL_TESS_EVALUATION_SHADER_BIT     0x00000010\r\n#define GL_ALL_SHADER_BITS                0xFFFFFFFF\r\n#define GL_PROGRAM_SEPARABLE              0x8258\r\n#define GL_ACTIVE_PROGRAM                 0x8259\r\n#define GL_PROGRAM_PIPELINE_BINDING       0x825A\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_precision\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_attrib_64bit\r\n/* reuse GL_RGB32I */\r\n/* reuse GL_DOUBLE_VEC2 */\r\n/* reuse GL_DOUBLE_VEC3 */\r\n/* reuse GL_DOUBLE_VEC4 */\r\n/* reuse GL_DOUBLE_MAT2 */\r\n/* reuse GL_DOUBLE_MAT3 */\r\n/* reuse GL_DOUBLE_MAT4 */\r\n/* reuse GL_DOUBLE_MAT2x3 */\r\n/* reuse GL_DOUBLE_MAT2x4 */\r\n/* reuse GL_DOUBLE_MAT3x2 */\r\n/* reuse GL_DOUBLE_MAT3x4 */\r\n/* reuse GL_DOUBLE_MAT4x2 */\r\n/* reuse GL_DOUBLE_MAT4x3 */\r\n#endif\r\n\r\n#ifndef GL_ARB_viewport_array\r\n/* reuse GL_SCISSOR_BOX */\r\n/* reuse GL_VIEWPORT */\r\n/* reuse GL_DEPTH_RANGE */\r\n/* reuse GL_SCISSOR_TEST */\r\n#define GL_MAX_VIEWPORTS                  0x825B\r\n#define GL_VIEWPORT_SUBPIXEL_BITS         0x825C\r\n#define GL_VIEWPORT_BOUNDS_RANGE          0x825D\r\n#define GL_LAYER_PROVOKING_VERTEX         0x825E\r\n#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F\r\n#define GL_UNDEFINED_VERTEX               0x8260\r\n/* reuse GL_FIRST_VERTEX_CONVENTION */\r\n/* reuse GL_LAST_VERTEX_CONVENTION */\r\n/* reuse GL_PROVOKING_VERTEX */\r\n#endif\r\n\r\n#ifndef GL_ARB_cl_event\r\n#define GL_SYNC_CL_EVENT_ARB              0x8240\r\n#define GL_SYNC_CL_EVENT_COMPLETE_ARB     0x8241\r\n#endif\r\n\r\n#ifndef GL_ARB_debug_output\r\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB   0x8242\r\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243\r\n#define GL_DEBUG_CALLBACK_FUNCTION_ARB    0x8244\r\n#define GL_DEBUG_CALLBACK_USER_PARAM_ARB  0x8245\r\n#define GL_DEBUG_SOURCE_API_ARB           0x8246\r\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247\r\n#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248\r\n#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB   0x8249\r\n#define GL_DEBUG_SOURCE_APPLICATION_ARB   0x824A\r\n#define GL_DEBUG_SOURCE_OTHER_ARB         0x824B\r\n#define GL_DEBUG_TYPE_ERROR_ARB           0x824C\r\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D\r\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E\r\n#define GL_DEBUG_TYPE_PORTABILITY_ARB     0x824F\r\n#define GL_DEBUG_TYPE_PERFORMANCE_ARB     0x8250\r\n#define GL_DEBUG_TYPE_OTHER_ARB           0x8251\r\n#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB   0x9143\r\n#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB  0x9144\r\n#define GL_DEBUG_LOGGED_MESSAGES_ARB      0x9145\r\n#define GL_DEBUG_SEVERITY_HIGH_ARB        0x9146\r\n#define GL_DEBUG_SEVERITY_MEDIUM_ARB      0x9147\r\n#define GL_DEBUG_SEVERITY_LOW_ARB         0x9148\r\n#endif\r\n\r\n#ifndef GL_ARB_robustness\r\n/* reuse GL_NO_ERROR */\r\n#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004\r\n#define GL_LOSE_CONTEXT_ON_RESET_ARB      0x8252\r\n#define GL_GUILTY_CONTEXT_RESET_ARB       0x8253\r\n#define GL_INNOCENT_CONTEXT_RESET_ARB     0x8254\r\n#define GL_UNKNOWN_CONTEXT_RESET_ARB      0x8255\r\n#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\r\n#define GL_NO_RESET_NOTIFICATION_ARB      0x8261\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_stencil_export\r\n#endif\r\n\r\n#ifndef GL_ARB_base_instance\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_420pack\r\n#endif\r\n\r\n#ifndef GL_ARB_transform_feedback_instanced\r\n#endif\r\n\r\n#ifndef GL_ARB_compressed_texture_pixel_storage\r\n#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH  0x9127\r\n#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128\r\n#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH  0x9129\r\n#define GL_UNPACK_COMPRESSED_BLOCK_SIZE   0x912A\r\n#define GL_PACK_COMPRESSED_BLOCK_WIDTH    0x912B\r\n#define GL_PACK_COMPRESSED_BLOCK_HEIGHT   0x912C\r\n#define GL_PACK_COMPRESSED_BLOCK_DEPTH    0x912D\r\n#define GL_PACK_COMPRESSED_BLOCK_SIZE     0x912E\r\n#endif\r\n\r\n#ifndef GL_ARB_conservative_depth\r\n#endif\r\n\r\n#ifndef GL_ARB_internalformat_query\r\n#define GL_NUM_SAMPLE_COUNTS              0x9380\r\n#endif\r\n\r\n#ifndef GL_ARB_map_buffer_alignment\r\n#define GL_MIN_MAP_BUFFER_ALIGNMENT       0x90BC\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_atomic_counters\r\n#define GL_ATOMIC_COUNTER_BUFFER          0x92C0\r\n#define GL_ATOMIC_COUNTER_BUFFER_BINDING  0x92C1\r\n#define GL_ATOMIC_COUNTER_BUFFER_START    0x92C2\r\n#define GL_ATOMIC_COUNTER_BUFFER_SIZE     0x92C3\r\n#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4\r\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5\r\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB\r\n#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC\r\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD\r\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE\r\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF\r\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0\r\n#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1\r\n#define GL_MAX_VERTEX_ATOMIC_COUNTERS     0x92D2\r\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3\r\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4\r\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS   0x92D5\r\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS   0x92D6\r\n#define GL_MAX_COMBINED_ATOMIC_COUNTERS   0x92D7\r\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8\r\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC\r\n#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS  0x92D9\r\n#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA\r\n#define GL_UNSIGNED_INT_ATOMIC_COUNTER    0x92DB\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_image_load_store\r\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001\r\n#define GL_ELEMENT_ARRAY_BARRIER_BIT      0x00000002\r\n#define GL_UNIFORM_BARRIER_BIT            0x00000004\r\n#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008\r\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020\r\n#define GL_COMMAND_BARRIER_BIT            0x00000040\r\n#define GL_PIXEL_BUFFER_BARRIER_BIT       0x00000080\r\n#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100\r\n#define GL_BUFFER_UPDATE_BARRIER_BIT      0x00000200\r\n#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400\r\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800\r\n#define GL_ATOMIC_COUNTER_BARRIER_BIT     0x00001000\r\n#define GL_ALL_BARRIER_BITS               0xFFFFFFFF\r\n#define GL_MAX_IMAGE_UNITS                0x8F38\r\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39\r\n#define GL_IMAGE_BINDING_NAME             0x8F3A\r\n#define GL_IMAGE_BINDING_LEVEL            0x8F3B\r\n#define GL_IMAGE_BINDING_LAYERED          0x8F3C\r\n#define GL_IMAGE_BINDING_LAYER            0x8F3D\r\n#define GL_IMAGE_BINDING_ACCESS           0x8F3E\r\n#define GL_IMAGE_1D                       0x904C\r\n#define GL_IMAGE_2D                       0x904D\r\n#define GL_IMAGE_3D                       0x904E\r\n#define GL_IMAGE_2D_RECT                  0x904F\r\n#define GL_IMAGE_CUBE                     0x9050\r\n#define GL_IMAGE_BUFFER                   0x9051\r\n#define GL_IMAGE_1D_ARRAY                 0x9052\r\n#define GL_IMAGE_2D_ARRAY                 0x9053\r\n#define GL_IMAGE_CUBE_MAP_ARRAY           0x9054\r\n#define GL_IMAGE_2D_MULTISAMPLE           0x9055\r\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY     0x9056\r\n#define GL_INT_IMAGE_1D                   0x9057\r\n#define GL_INT_IMAGE_2D                   0x9058\r\n#define GL_INT_IMAGE_3D                   0x9059\r\n#define GL_INT_IMAGE_2D_RECT              0x905A\r\n#define GL_INT_IMAGE_CUBE                 0x905B\r\n#define GL_INT_IMAGE_BUFFER               0x905C\r\n#define GL_INT_IMAGE_1D_ARRAY             0x905D\r\n#define GL_INT_IMAGE_2D_ARRAY             0x905E\r\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY       0x905F\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE       0x9060\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061\r\n#define GL_UNSIGNED_INT_IMAGE_1D          0x9062\r\n#define GL_UNSIGNED_INT_IMAGE_2D          0x9063\r\n#define GL_UNSIGNED_INT_IMAGE_3D          0x9064\r\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT     0x9065\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE        0x9066\r\n#define GL_UNSIGNED_INT_IMAGE_BUFFER      0x9067\r\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY    0x9068\r\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY    0x9069\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C\r\n#define GL_MAX_IMAGE_SAMPLES              0x906D\r\n#define GL_IMAGE_BINDING_FORMAT           0x906E\r\n#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7\r\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8\r\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9\r\n#define GL_MAX_VERTEX_IMAGE_UNIFORMS      0x90CA\r\n#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB\r\n#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC\r\n#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS    0x90CD\r\n#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS    0x90CE\r\n#define GL_MAX_COMBINED_IMAGE_UNIFORMS    0x90CF\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_packing\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_storage\r\n#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F\r\n#endif\r\n\r\n#ifndef GL_KHR_texture_compression_astc_ldr\r\n#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR   0x93B0\r\n#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR   0x93B1\r\n#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR   0x93B2\r\n#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR   0x93B3\r\n#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR   0x93B4\r\n#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR   0x93B5\r\n#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR   0x93B6\r\n#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR   0x93B7\r\n#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR  0x93B8\r\n#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR  0x93B9\r\n#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR  0x93BA\r\n#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB\r\n#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC\r\n#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD\r\n#endif\r\n\r\n#ifndef GL_KHR_debug\r\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS       0x8242\r\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243\r\n#define GL_DEBUG_CALLBACK_FUNCTION        0x8244\r\n#define GL_DEBUG_CALLBACK_USER_PARAM      0x8245\r\n#define GL_DEBUG_SOURCE_API               0x8246\r\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM     0x8247\r\n#define GL_DEBUG_SOURCE_SHADER_COMPILER   0x8248\r\n#define GL_DEBUG_SOURCE_THIRD_PARTY       0x8249\r\n#define GL_DEBUG_SOURCE_APPLICATION       0x824A\r\n#define GL_DEBUG_SOURCE_OTHER             0x824B\r\n#define GL_DEBUG_TYPE_ERROR               0x824C\r\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D\r\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR  0x824E\r\n#define GL_DEBUG_TYPE_PORTABILITY         0x824F\r\n#define GL_DEBUG_TYPE_PERFORMANCE         0x8250\r\n#define GL_DEBUG_TYPE_OTHER               0x8251\r\n#define GL_DEBUG_TYPE_MARKER              0x8268\r\n#define GL_DEBUG_TYPE_PUSH_GROUP          0x8269\r\n#define GL_DEBUG_TYPE_POP_GROUP           0x826A\r\n#define GL_DEBUG_SEVERITY_NOTIFICATION    0x826B\r\n#define GL_MAX_DEBUG_GROUP_STACK_DEPTH    0x826C\r\n#define GL_DEBUG_GROUP_STACK_DEPTH        0x826D\r\n#define GL_BUFFER                         0x82E0\r\n#define GL_SHADER                         0x82E1\r\n#define GL_PROGRAM                        0x82E2\r\n#define GL_QUERY                          0x82E3\r\n#define GL_PROGRAM_PIPELINE               0x82E4\r\n#define GL_SAMPLER                        0x82E6\r\n#define GL_DISPLAY_LIST                   0x82E7\r\n/* DISPLAY_LIST used in compatibility profile only */\r\n#define GL_MAX_LABEL_LENGTH               0x82E8\r\n#define GL_MAX_DEBUG_MESSAGE_LENGTH       0x9143\r\n#define GL_MAX_DEBUG_LOGGED_MESSAGES      0x9144\r\n#define GL_DEBUG_LOGGED_MESSAGES          0x9145\r\n#define GL_DEBUG_SEVERITY_HIGH            0x9146\r\n#define GL_DEBUG_SEVERITY_MEDIUM          0x9147\r\n#define GL_DEBUG_SEVERITY_LOW             0x9148\r\n#define GL_DEBUG_OUTPUT                   0x92E0\r\n#define GL_CONTEXT_FLAG_DEBUG_BIT         0x00000002\r\n/* reuse GL_STACK_UNDERFLOW */\r\n/* reuse GL_STACK_OVERFLOW */\r\n#endif\r\n\r\n#ifndef GL_ARB_arrays_of_arrays\r\n#endif\r\n\r\n#ifndef GL_ARB_clear_buffer_object\r\n#endif\r\n\r\n#ifndef GL_ARB_compute_shader\r\n#define GL_COMPUTE_SHADER                 0x91B9\r\n#define GL_MAX_COMPUTE_UNIFORM_BLOCKS     0x91BB\r\n#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC\r\n#define GL_MAX_COMPUTE_IMAGE_UNIFORMS     0x91BD\r\n#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262\r\n#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263\r\n#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264\r\n#define GL_MAX_COMPUTE_ATOMIC_COUNTERS    0x8265\r\n#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266\r\n#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS  0x90EB\r\n#define GL_MAX_COMPUTE_WORK_GROUP_COUNT   0x91BE\r\n#define GL_MAX_COMPUTE_WORK_GROUP_SIZE    0x91BF\r\n#define GL_COMPUTE_LOCAL_WORK_SIZE        0x8267\r\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC\r\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED\r\n#define GL_DISPATCH_INDIRECT_BUFFER       0x90EE\r\n#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF\r\n#define GL_COMPUTE_SHADER_BIT             0x00000020\r\n#endif\r\n\r\n#ifndef GL_ARB_copy_image\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_view\r\n#define GL_TEXTURE_VIEW_MIN_LEVEL         0x82DB\r\n#define GL_TEXTURE_VIEW_NUM_LEVELS        0x82DC\r\n#define GL_TEXTURE_VIEW_MIN_LAYER         0x82DD\r\n#define GL_TEXTURE_VIEW_NUM_LAYERS        0x82DE\r\n#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_attrib_binding\r\n#define GL_VERTEX_ATTRIB_BINDING          0x82D4\r\n#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET  0x82D5\r\n#define GL_VERTEX_BINDING_DIVISOR         0x82D6\r\n#define GL_VERTEX_BINDING_OFFSET          0x82D7\r\n#define GL_VERTEX_BINDING_STRIDE          0x82D8\r\n#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9\r\n#define GL_MAX_VERTEX_ATTRIB_BINDINGS     0x82DA\r\n#endif\r\n\r\n#ifndef GL_ARB_robustness_isolation\r\n#endif\r\n\r\n#ifndef GL_ARB_ES3_compatibility\r\n#define GL_COMPRESSED_RGB8_ETC2           0x9274\r\n#define GL_COMPRESSED_SRGB8_ETC2          0x9275\r\n#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276\r\n#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277\r\n#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278\r\n#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279\r\n#define GL_COMPRESSED_R11_EAC             0x9270\r\n#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271\r\n#define GL_COMPRESSED_RG11_EAC            0x9272\r\n#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273\r\n#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69\r\n#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A\r\n#define GL_MAX_ELEMENT_INDEX              0x8D6B\r\n#endif\r\n\r\n#ifndef GL_ARB_explicit_uniform_location\r\n#define GL_MAX_UNIFORM_LOCATIONS          0x826E\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_layer_viewport\r\n#endif\r\n\r\n#ifndef GL_ARB_framebuffer_no_attachments\r\n#define GL_FRAMEBUFFER_DEFAULT_WIDTH      0x9310\r\n#define GL_FRAMEBUFFER_DEFAULT_HEIGHT     0x9311\r\n#define GL_FRAMEBUFFER_DEFAULT_LAYERS     0x9312\r\n#define GL_FRAMEBUFFER_DEFAULT_SAMPLES    0x9313\r\n#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314\r\n#define GL_MAX_FRAMEBUFFER_WIDTH          0x9315\r\n#define GL_MAX_FRAMEBUFFER_HEIGHT         0x9316\r\n#define GL_MAX_FRAMEBUFFER_LAYERS         0x9317\r\n#define GL_MAX_FRAMEBUFFER_SAMPLES        0x9318\r\n#endif\r\n\r\n#ifndef GL_ARB_internalformat_query2\r\n/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */\r\n/* reuse GL_NUM_SAMPLE_COUNTS */\r\n/* reuse GL_RENDERBUFFER */\r\n/* reuse GL_SAMPLES */\r\n/* reuse GL_TEXTURE_1D */\r\n/* reuse GL_TEXTURE_1D_ARRAY */\r\n/* reuse GL_TEXTURE_2D */\r\n/* reuse GL_TEXTURE_2D_ARRAY */\r\n/* reuse GL_TEXTURE_3D */\r\n/* reuse GL_TEXTURE_CUBE_MAP */\r\n/* reuse GL_TEXTURE_CUBE_MAP_ARRAY */\r\n/* reuse GL_TEXTURE_RECTANGLE */\r\n/* reuse GL_TEXTURE_BUFFER */\r\n/* reuse GL_TEXTURE_2D_MULTISAMPLE */\r\n/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */\r\n/* reuse GL_TEXTURE_COMPRESSED */\r\n#define GL_INTERNALFORMAT_SUPPORTED       0x826F\r\n#define GL_INTERNALFORMAT_PREFERRED       0x8270\r\n#define GL_INTERNALFORMAT_RED_SIZE        0x8271\r\n#define GL_INTERNALFORMAT_GREEN_SIZE      0x8272\r\n#define GL_INTERNALFORMAT_BLUE_SIZE       0x8273\r\n#define GL_INTERNALFORMAT_ALPHA_SIZE      0x8274\r\n#define GL_INTERNALFORMAT_DEPTH_SIZE      0x8275\r\n#define GL_INTERNALFORMAT_STENCIL_SIZE    0x8276\r\n#define GL_INTERNALFORMAT_SHARED_SIZE     0x8277\r\n#define GL_INTERNALFORMAT_RED_TYPE        0x8278\r\n#define GL_INTERNALFORMAT_GREEN_TYPE      0x8279\r\n#define GL_INTERNALFORMAT_BLUE_TYPE       0x827A\r\n#define GL_INTERNALFORMAT_ALPHA_TYPE      0x827B\r\n#define GL_INTERNALFORMAT_DEPTH_TYPE      0x827C\r\n#define GL_INTERNALFORMAT_STENCIL_TYPE    0x827D\r\n#define GL_MAX_WIDTH                      0x827E\r\n#define GL_MAX_HEIGHT                     0x827F\r\n#define GL_MAX_DEPTH                      0x8280\r\n#define GL_MAX_LAYERS                     0x8281\r\n#define GL_MAX_COMBINED_DIMENSIONS        0x8282\r\n#define GL_COLOR_COMPONENTS               0x8283\r\n#define GL_DEPTH_COMPONENTS               0x8284\r\n#define GL_STENCIL_COMPONENTS             0x8285\r\n#define GL_COLOR_RENDERABLE               0x8286\r\n#define GL_DEPTH_RENDERABLE               0x8287\r\n#define GL_STENCIL_RENDERABLE             0x8288\r\n#define GL_FRAMEBUFFER_RENDERABLE         0x8289\r\n#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A\r\n#define GL_FRAMEBUFFER_BLEND              0x828B\r\n#define GL_READ_PIXELS                    0x828C\r\n#define GL_READ_PIXELS_FORMAT             0x828D\r\n#define GL_READ_PIXELS_TYPE               0x828E\r\n#define GL_TEXTURE_IMAGE_FORMAT           0x828F\r\n#define GL_TEXTURE_IMAGE_TYPE             0x8290\r\n#define GL_GET_TEXTURE_IMAGE_FORMAT       0x8291\r\n#define GL_GET_TEXTURE_IMAGE_TYPE         0x8292\r\n#define GL_MIPMAP                         0x8293\r\n#define GL_MANUAL_GENERATE_MIPMAP         0x8294\r\n#define GL_AUTO_GENERATE_MIPMAP           0x8295\r\n#define GL_COLOR_ENCODING                 0x8296\r\n#define GL_SRGB_READ                      0x8297\r\n#define GL_SRGB_WRITE                     0x8298\r\n#define GL_SRGB_DECODE_ARB                0x8299\r\n#define GL_FILTER                         0x829A\r\n#define GL_VERTEX_TEXTURE                 0x829B\r\n#define GL_TESS_CONTROL_TEXTURE           0x829C\r\n#define GL_TESS_EVALUATION_TEXTURE        0x829D\r\n#define GL_GEOMETRY_TEXTURE               0x829E\r\n#define GL_FRAGMENT_TEXTURE               0x829F\r\n#define GL_COMPUTE_TEXTURE                0x82A0\r\n#define GL_TEXTURE_SHADOW                 0x82A1\r\n#define GL_TEXTURE_GATHER                 0x82A2\r\n#define GL_TEXTURE_GATHER_SHADOW          0x82A3\r\n#define GL_SHADER_IMAGE_LOAD              0x82A4\r\n#define GL_SHADER_IMAGE_STORE             0x82A5\r\n#define GL_SHADER_IMAGE_ATOMIC            0x82A6\r\n#define GL_IMAGE_TEXEL_SIZE               0x82A7\r\n#define GL_IMAGE_COMPATIBILITY_CLASS      0x82A8\r\n#define GL_IMAGE_PIXEL_FORMAT             0x82A9\r\n#define GL_IMAGE_PIXEL_TYPE               0x82AA\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE\r\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF\r\n#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1\r\n#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2\r\n#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE  0x82B3\r\n#define GL_CLEAR_BUFFER                   0x82B4\r\n#define GL_TEXTURE_VIEW                   0x82B5\r\n#define GL_VIEW_COMPATIBILITY_CLASS       0x82B6\r\n#define GL_FULL_SUPPORT                   0x82B7\r\n#define GL_CAVEAT_SUPPORT                 0x82B8\r\n#define GL_IMAGE_CLASS_4_X_32             0x82B9\r\n#define GL_IMAGE_CLASS_2_X_32             0x82BA\r\n#define GL_IMAGE_CLASS_1_X_32             0x82BB\r\n#define GL_IMAGE_CLASS_4_X_16             0x82BC\r\n#define GL_IMAGE_CLASS_2_X_16             0x82BD\r\n#define GL_IMAGE_CLASS_1_X_16             0x82BE\r\n#define GL_IMAGE_CLASS_4_X_8              0x82BF\r\n#define GL_IMAGE_CLASS_2_X_8              0x82C0\r\n#define GL_IMAGE_CLASS_1_X_8              0x82C1\r\n#define GL_IMAGE_CLASS_11_11_10           0x82C2\r\n#define GL_IMAGE_CLASS_10_10_10_2         0x82C3\r\n#define GL_VIEW_CLASS_128_BITS            0x82C4\r\n#define GL_VIEW_CLASS_96_BITS             0x82C5\r\n#define GL_VIEW_CLASS_64_BITS             0x82C6\r\n#define GL_VIEW_CLASS_48_BITS             0x82C7\r\n#define GL_VIEW_CLASS_32_BITS             0x82C8\r\n#define GL_VIEW_CLASS_24_BITS             0x82C9\r\n#define GL_VIEW_CLASS_16_BITS             0x82CA\r\n#define GL_VIEW_CLASS_8_BITS              0x82CB\r\n#define GL_VIEW_CLASS_S3TC_DXT1_RGB       0x82CC\r\n#define GL_VIEW_CLASS_S3TC_DXT1_RGBA      0x82CD\r\n#define GL_VIEW_CLASS_S3TC_DXT3_RGBA      0x82CE\r\n#define GL_VIEW_CLASS_S3TC_DXT5_RGBA      0x82CF\r\n#define GL_VIEW_CLASS_RGTC1_RED           0x82D0\r\n#define GL_VIEW_CLASS_RGTC2_RG            0x82D1\r\n#define GL_VIEW_CLASS_BPTC_UNORM          0x82D2\r\n#define GL_VIEW_CLASS_BPTC_FLOAT          0x82D3\r\n#endif\r\n\r\n#ifndef GL_ARB_invalidate_subdata\r\n#endif\r\n\r\n#ifndef GL_ARB_multi_draw_indirect\r\n#endif\r\n\r\n#ifndef GL_ARB_program_interface_query\r\n#define GL_UNIFORM                        0x92E1\r\n#define GL_UNIFORM_BLOCK                  0x92E2\r\n#define GL_PROGRAM_INPUT                  0x92E3\r\n#define GL_PROGRAM_OUTPUT                 0x92E4\r\n#define GL_BUFFER_VARIABLE                0x92E5\r\n#define GL_SHADER_STORAGE_BLOCK           0x92E6\r\n/* reuse GL_ATOMIC_COUNTER_BUFFER */\r\n#define GL_VERTEX_SUBROUTINE              0x92E8\r\n#define GL_TESS_CONTROL_SUBROUTINE        0x92E9\r\n#define GL_TESS_EVALUATION_SUBROUTINE     0x92EA\r\n#define GL_GEOMETRY_SUBROUTINE            0x92EB\r\n#define GL_FRAGMENT_SUBROUTINE            0x92EC\r\n#define GL_COMPUTE_SUBROUTINE             0x92ED\r\n#define GL_VERTEX_SUBROUTINE_UNIFORM      0x92EE\r\n#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF\r\n#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0\r\n#define GL_GEOMETRY_SUBROUTINE_UNIFORM    0x92F1\r\n#define GL_FRAGMENT_SUBROUTINE_UNIFORM    0x92F2\r\n#define GL_COMPUTE_SUBROUTINE_UNIFORM     0x92F3\r\n#define GL_TRANSFORM_FEEDBACK_VARYING     0x92F4\r\n#define GL_ACTIVE_RESOURCES               0x92F5\r\n#define GL_MAX_NAME_LENGTH                0x92F6\r\n#define GL_MAX_NUM_ACTIVE_VARIABLES       0x92F7\r\n#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8\r\n#define GL_NAME_LENGTH                    0x92F9\r\n#define GL_TYPE                           0x92FA\r\n#define GL_ARRAY_SIZE                     0x92FB\r\n#define GL_OFFSET                         0x92FC\r\n#define GL_BLOCK_INDEX                    0x92FD\r\n#define GL_ARRAY_STRIDE                   0x92FE\r\n#define GL_MATRIX_STRIDE                  0x92FF\r\n#define GL_IS_ROW_MAJOR                   0x9300\r\n#define GL_ATOMIC_COUNTER_BUFFER_INDEX    0x9301\r\n#define GL_BUFFER_BINDING                 0x9302\r\n#define GL_BUFFER_DATA_SIZE               0x9303\r\n#define GL_NUM_ACTIVE_VARIABLES           0x9304\r\n#define GL_ACTIVE_VARIABLES               0x9305\r\n#define GL_REFERENCED_BY_VERTEX_SHADER    0x9306\r\n#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307\r\n#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308\r\n#define GL_REFERENCED_BY_GEOMETRY_SHADER  0x9309\r\n#define GL_REFERENCED_BY_FRAGMENT_SHADER  0x930A\r\n#define GL_REFERENCED_BY_COMPUTE_SHADER   0x930B\r\n#define GL_TOP_LEVEL_ARRAY_SIZE           0x930C\r\n#define GL_TOP_LEVEL_ARRAY_STRIDE         0x930D\r\n#define GL_LOCATION                       0x930E\r\n#define GL_LOCATION_INDEX                 0x930F\r\n#define GL_IS_PER_PATCH                   0x92E7\r\n/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */\r\n/* reuse GL_COMPATIBLE_SUBROUTINES */\r\n#endif\r\n\r\n#ifndef GL_ARB_robust_buffer_access_behavior\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_image_size\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_storage_buffer_object\r\n#define GL_SHADER_STORAGE_BUFFER          0x90D2\r\n#define GL_SHADER_STORAGE_BUFFER_BINDING  0x90D3\r\n#define GL_SHADER_STORAGE_BUFFER_START    0x90D4\r\n#define GL_SHADER_STORAGE_BUFFER_SIZE     0x90D5\r\n#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6\r\n#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7\r\n#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8\r\n#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9\r\n#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA\r\n#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB\r\n#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC\r\n#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD\r\n#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE  0x90DE\r\n#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF\r\n#define GL_SHADER_STORAGE_BARRIER_BIT     0x00002000\r\n#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39\r\n/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */\r\n#endif\r\n\r\n#ifndef GL_ARB_stencil_texturing\r\n#define GL_DEPTH_STENCIL_TEXTURE_MODE     0x90EA\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_buffer_range\r\n#define GL_TEXTURE_BUFFER_OFFSET          0x919D\r\n#define GL_TEXTURE_BUFFER_SIZE            0x919E\r\n#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_query_levels\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_storage_multisample\r\n#endif\r\n\r\n#ifndef GL_EXT_abgr\r\n#define GL_ABGR_EXT                       0x8000\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_color\r\n#define GL_CONSTANT_COLOR_EXT             0x8001\r\n#define GL_ONE_MINUS_CONSTANT_COLOR_EXT   0x8002\r\n#define GL_CONSTANT_ALPHA_EXT             0x8003\r\n#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT   0x8004\r\n#define GL_BLEND_COLOR_EXT                0x8005\r\n#endif\r\n\r\n#ifndef GL_EXT_polygon_offset\r\n#define GL_POLYGON_OFFSET_EXT             0x8037\r\n#define GL_POLYGON_OFFSET_FACTOR_EXT      0x8038\r\n#define GL_POLYGON_OFFSET_BIAS_EXT        0x8039\r\n#endif\r\n\r\n#ifndef GL_EXT_texture\r\n#define GL_ALPHA4_EXT                     0x803B\r\n#define GL_ALPHA8_EXT                     0x803C\r\n#define GL_ALPHA12_EXT                    0x803D\r\n#define GL_ALPHA16_EXT                    0x803E\r\n#define GL_LUMINANCE4_EXT                 0x803F\r\n#define GL_LUMINANCE8_EXT                 0x8040\r\n#define GL_LUMINANCE12_EXT                0x8041\r\n#define GL_LUMINANCE16_EXT                0x8042\r\n#define GL_LUMINANCE4_ALPHA4_EXT          0x8043\r\n#define GL_LUMINANCE6_ALPHA2_EXT          0x8044\r\n#define GL_LUMINANCE8_ALPHA8_EXT          0x8045\r\n#define GL_LUMINANCE12_ALPHA4_EXT         0x8046\r\n#define GL_LUMINANCE12_ALPHA12_EXT        0x8047\r\n#define GL_LUMINANCE16_ALPHA16_EXT        0x8048\r\n#define GL_INTENSITY_EXT                  0x8049\r\n#define GL_INTENSITY4_EXT                 0x804A\r\n#define GL_INTENSITY8_EXT                 0x804B\r\n#define GL_INTENSITY12_EXT                0x804C\r\n#define GL_INTENSITY16_EXT                0x804D\r\n#define GL_RGB2_EXT                       0x804E\r\n#define GL_RGB4_EXT                       0x804F\r\n#define GL_RGB5_EXT                       0x8050\r\n#define GL_RGB8_EXT                       0x8051\r\n#define GL_RGB10_EXT                      0x8052\r\n#define GL_RGB12_EXT                      0x8053\r\n#define GL_RGB16_EXT                      0x8054\r\n#define GL_RGBA2_EXT                      0x8055\r\n#define GL_RGBA4_EXT                      0x8056\r\n#define GL_RGB5_A1_EXT                    0x8057\r\n#define GL_RGBA8_EXT                      0x8058\r\n#define GL_RGB10_A2_EXT                   0x8059\r\n#define GL_RGBA12_EXT                     0x805A\r\n#define GL_RGBA16_EXT                     0x805B\r\n#define GL_TEXTURE_RED_SIZE_EXT           0x805C\r\n#define GL_TEXTURE_GREEN_SIZE_EXT         0x805D\r\n#define GL_TEXTURE_BLUE_SIZE_EXT          0x805E\r\n#define GL_TEXTURE_ALPHA_SIZE_EXT         0x805F\r\n#define GL_TEXTURE_LUMINANCE_SIZE_EXT     0x8060\r\n#define GL_TEXTURE_INTENSITY_SIZE_EXT     0x8061\r\n#define GL_REPLACE_EXT                    0x8062\r\n#define GL_PROXY_TEXTURE_1D_EXT           0x8063\r\n#define GL_PROXY_TEXTURE_2D_EXT           0x8064\r\n#define GL_TEXTURE_TOO_LARGE_EXT          0x8065\r\n#endif\r\n\r\n#ifndef GL_EXT_texture3D\r\n#define GL_PACK_SKIP_IMAGES_EXT           0x806B\r\n#define GL_PACK_IMAGE_HEIGHT_EXT          0x806C\r\n#define GL_UNPACK_SKIP_IMAGES_EXT         0x806D\r\n#define GL_UNPACK_IMAGE_HEIGHT_EXT        0x806E\r\n#define GL_TEXTURE_3D_EXT                 0x806F\r\n#define GL_PROXY_TEXTURE_3D_EXT           0x8070\r\n#define GL_TEXTURE_DEPTH_EXT              0x8071\r\n#define GL_TEXTURE_WRAP_R_EXT             0x8072\r\n#define GL_MAX_3D_TEXTURE_SIZE_EXT        0x8073\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_filter4\r\n#define GL_FILTER4_SGIS                   0x8146\r\n#define GL_TEXTURE_FILTER4_SIZE_SGIS      0x8147\r\n#endif\r\n\r\n#ifndef GL_EXT_subtexture\r\n#endif\r\n\r\n#ifndef GL_EXT_copy_texture\r\n#endif\r\n\r\n#ifndef GL_EXT_histogram\r\n#define GL_HISTOGRAM_EXT                  0x8024\r\n#define GL_PROXY_HISTOGRAM_EXT            0x8025\r\n#define GL_HISTOGRAM_WIDTH_EXT            0x8026\r\n#define GL_HISTOGRAM_FORMAT_EXT           0x8027\r\n#define GL_HISTOGRAM_RED_SIZE_EXT         0x8028\r\n#define GL_HISTOGRAM_GREEN_SIZE_EXT       0x8029\r\n#define GL_HISTOGRAM_BLUE_SIZE_EXT        0x802A\r\n#define GL_HISTOGRAM_ALPHA_SIZE_EXT       0x802B\r\n#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT   0x802C\r\n#define GL_HISTOGRAM_SINK_EXT             0x802D\r\n#define GL_MINMAX_EXT                     0x802E\r\n#define GL_MINMAX_FORMAT_EXT              0x802F\r\n#define GL_MINMAX_SINK_EXT                0x8030\r\n#define GL_TABLE_TOO_LARGE_EXT            0x8031\r\n#endif\r\n\r\n#ifndef GL_EXT_convolution\r\n#define GL_CONVOLUTION_1D_EXT             0x8010\r\n#define GL_CONVOLUTION_2D_EXT             0x8011\r\n#define GL_SEPARABLE_2D_EXT               0x8012\r\n#define GL_CONVOLUTION_BORDER_MODE_EXT    0x8013\r\n#define GL_CONVOLUTION_FILTER_SCALE_EXT   0x8014\r\n#define GL_CONVOLUTION_FILTER_BIAS_EXT    0x8015\r\n#define GL_REDUCE_EXT                     0x8016\r\n#define GL_CONVOLUTION_FORMAT_EXT         0x8017\r\n#define GL_CONVOLUTION_WIDTH_EXT          0x8018\r\n#define GL_CONVOLUTION_HEIGHT_EXT         0x8019\r\n#define GL_MAX_CONVOLUTION_WIDTH_EXT      0x801A\r\n#define GL_MAX_CONVOLUTION_HEIGHT_EXT     0x801B\r\n#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C\r\n#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D\r\n#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E\r\n#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F\r\n#define GL_POST_CONVOLUTION_RED_BIAS_EXT  0x8020\r\n#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021\r\n#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022\r\n#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023\r\n#endif\r\n\r\n#ifndef GL_SGI_color_matrix\r\n#define GL_COLOR_MATRIX_SGI               0x80B1\r\n#define GL_COLOR_MATRIX_STACK_DEPTH_SGI   0x80B2\r\n#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3\r\n#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4\r\n#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5\r\n#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6\r\n#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7\r\n#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8\r\n#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9\r\n#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA\r\n#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB\r\n#endif\r\n\r\n#ifndef GL_SGI_color_table\r\n#define GL_COLOR_TABLE_SGI                0x80D0\r\n#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1\r\n#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2\r\n#define GL_PROXY_COLOR_TABLE_SGI          0x80D3\r\n#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4\r\n#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5\r\n#define GL_COLOR_TABLE_SCALE_SGI          0x80D6\r\n#define GL_COLOR_TABLE_BIAS_SGI           0x80D7\r\n#define GL_COLOR_TABLE_FORMAT_SGI         0x80D8\r\n#define GL_COLOR_TABLE_WIDTH_SGI          0x80D9\r\n#define GL_COLOR_TABLE_RED_SIZE_SGI       0x80DA\r\n#define GL_COLOR_TABLE_GREEN_SIZE_SGI     0x80DB\r\n#define GL_COLOR_TABLE_BLUE_SIZE_SGI      0x80DC\r\n#define GL_COLOR_TABLE_ALPHA_SIZE_SGI     0x80DD\r\n#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE\r\n#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF\r\n#endif\r\n\r\n#ifndef GL_SGIS_pixel_texture\r\n#define GL_PIXEL_TEXTURE_SGIS             0x8353\r\n#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354\r\n#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355\r\n#define GL_PIXEL_GROUP_COLOR_SGIS         0x8356\r\n#endif\r\n\r\n#ifndef GL_SGIX_pixel_texture\r\n#define GL_PIXEL_TEX_GEN_SGIX             0x8139\r\n#define GL_PIXEL_TEX_GEN_MODE_SGIX        0x832B\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture4D\r\n#define GL_PACK_SKIP_VOLUMES_SGIS         0x8130\r\n#define GL_PACK_IMAGE_DEPTH_SGIS          0x8131\r\n#define GL_UNPACK_SKIP_VOLUMES_SGIS       0x8132\r\n#define GL_UNPACK_IMAGE_DEPTH_SGIS        0x8133\r\n#define GL_TEXTURE_4D_SGIS                0x8134\r\n#define GL_PROXY_TEXTURE_4D_SGIS          0x8135\r\n#define GL_TEXTURE_4DSIZE_SGIS            0x8136\r\n#define GL_TEXTURE_WRAP_Q_SGIS            0x8137\r\n#define GL_MAX_4D_TEXTURE_SIZE_SGIS       0x8138\r\n#define GL_TEXTURE_4D_BINDING_SGIS        0x814F\r\n#endif\r\n\r\n#ifndef GL_SGI_texture_color_table\r\n#define GL_TEXTURE_COLOR_TABLE_SGI        0x80BC\r\n#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI  0x80BD\r\n#endif\r\n\r\n#ifndef GL_EXT_cmyka\r\n#define GL_CMYK_EXT                       0x800C\r\n#define GL_CMYKA_EXT                      0x800D\r\n#define GL_PACK_CMYK_HINT_EXT             0x800E\r\n#define GL_UNPACK_CMYK_HINT_EXT           0x800F\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_object\r\n#define GL_TEXTURE_PRIORITY_EXT           0x8066\r\n#define GL_TEXTURE_RESIDENT_EXT           0x8067\r\n#define GL_TEXTURE_1D_BINDING_EXT         0x8068\r\n#define GL_TEXTURE_2D_BINDING_EXT         0x8069\r\n#define GL_TEXTURE_3D_BINDING_EXT         0x806A\r\n#endif\r\n\r\n#ifndef GL_SGIS_detail_texture\r\n#define GL_DETAIL_TEXTURE_2D_SGIS         0x8095\r\n#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096\r\n#define GL_LINEAR_DETAIL_SGIS             0x8097\r\n#define GL_LINEAR_DETAIL_ALPHA_SGIS       0x8098\r\n#define GL_LINEAR_DETAIL_COLOR_SGIS       0x8099\r\n#define GL_DETAIL_TEXTURE_LEVEL_SGIS      0x809A\r\n#define GL_DETAIL_TEXTURE_MODE_SGIS       0x809B\r\n#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C\r\n#endif\r\n\r\n#ifndef GL_SGIS_sharpen_texture\r\n#define GL_LINEAR_SHARPEN_SGIS            0x80AD\r\n#define GL_LINEAR_SHARPEN_ALPHA_SGIS      0x80AE\r\n#define GL_LINEAR_SHARPEN_COLOR_SGIS      0x80AF\r\n#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0\r\n#endif\r\n\r\n#ifndef GL_EXT_packed_pixels\r\n#define GL_UNSIGNED_BYTE_3_3_2_EXT        0x8032\r\n#define GL_UNSIGNED_SHORT_4_4_4_4_EXT     0x8033\r\n#define GL_UNSIGNED_SHORT_5_5_5_1_EXT     0x8034\r\n#define GL_UNSIGNED_INT_8_8_8_8_EXT       0x8035\r\n#define GL_UNSIGNED_INT_10_10_10_2_EXT    0x8036\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_lod\r\n#define GL_TEXTURE_MIN_LOD_SGIS           0x813A\r\n#define GL_TEXTURE_MAX_LOD_SGIS           0x813B\r\n#define GL_TEXTURE_BASE_LEVEL_SGIS        0x813C\r\n#define GL_TEXTURE_MAX_LEVEL_SGIS         0x813D\r\n#endif\r\n\r\n#ifndef GL_SGIS_multisample\r\n#define GL_MULTISAMPLE_SGIS               0x809D\r\n#define GL_SAMPLE_ALPHA_TO_MASK_SGIS      0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE_SGIS       0x809F\r\n#define GL_SAMPLE_MASK_SGIS               0x80A0\r\n#define GL_1PASS_SGIS                     0x80A1\r\n#define GL_2PASS_0_SGIS                   0x80A2\r\n#define GL_2PASS_1_SGIS                   0x80A3\r\n#define GL_4PASS_0_SGIS                   0x80A4\r\n#define GL_4PASS_1_SGIS                   0x80A5\r\n#define GL_4PASS_2_SGIS                   0x80A6\r\n#define GL_4PASS_3_SGIS                   0x80A7\r\n#define GL_SAMPLE_BUFFERS_SGIS            0x80A8\r\n#define GL_SAMPLES_SGIS                   0x80A9\r\n#define GL_SAMPLE_MASK_VALUE_SGIS         0x80AA\r\n#define GL_SAMPLE_MASK_INVERT_SGIS        0x80AB\r\n#define GL_SAMPLE_PATTERN_SGIS            0x80AC\r\n#endif\r\n\r\n#ifndef GL_EXT_rescale_normal\r\n#define GL_RESCALE_NORMAL_EXT             0x803A\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_array\r\n#define GL_VERTEX_ARRAY_EXT               0x8074\r\n#define GL_NORMAL_ARRAY_EXT               0x8075\r\n#define GL_COLOR_ARRAY_EXT                0x8076\r\n#define GL_INDEX_ARRAY_EXT                0x8077\r\n#define GL_TEXTURE_COORD_ARRAY_EXT        0x8078\r\n#define GL_EDGE_FLAG_ARRAY_EXT            0x8079\r\n#define GL_VERTEX_ARRAY_SIZE_EXT          0x807A\r\n#define GL_VERTEX_ARRAY_TYPE_EXT          0x807B\r\n#define GL_VERTEX_ARRAY_STRIDE_EXT        0x807C\r\n#define GL_VERTEX_ARRAY_COUNT_EXT         0x807D\r\n#define GL_NORMAL_ARRAY_TYPE_EXT          0x807E\r\n#define GL_NORMAL_ARRAY_STRIDE_EXT        0x807F\r\n#define GL_NORMAL_ARRAY_COUNT_EXT         0x8080\r\n#define GL_COLOR_ARRAY_SIZE_EXT           0x8081\r\n#define GL_COLOR_ARRAY_TYPE_EXT           0x8082\r\n#define GL_COLOR_ARRAY_STRIDE_EXT         0x8083\r\n#define GL_COLOR_ARRAY_COUNT_EXT          0x8084\r\n#define GL_INDEX_ARRAY_TYPE_EXT           0x8085\r\n#define GL_INDEX_ARRAY_STRIDE_EXT         0x8086\r\n#define GL_INDEX_ARRAY_COUNT_EXT          0x8087\r\n#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT   0x8088\r\n#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT   0x8089\r\n#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A\r\n#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT  0x808B\r\n#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT     0x808C\r\n#define GL_EDGE_FLAG_ARRAY_COUNT_EXT      0x808D\r\n#define GL_VERTEX_ARRAY_POINTER_EXT       0x808E\r\n#define GL_NORMAL_ARRAY_POINTER_EXT       0x808F\r\n#define GL_COLOR_ARRAY_POINTER_EXT        0x8090\r\n#define GL_INDEX_ARRAY_POINTER_EXT        0x8091\r\n#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092\r\n#define GL_EDGE_FLAG_ARRAY_POINTER_EXT    0x8093\r\n#endif\r\n\r\n#ifndef GL_EXT_misc_attribute\r\n#endif\r\n\r\n#ifndef GL_SGIS_generate_mipmap\r\n#define GL_GENERATE_MIPMAP_SGIS           0x8191\r\n#define GL_GENERATE_MIPMAP_HINT_SGIS      0x8192\r\n#endif\r\n\r\n#ifndef GL_SGIX_clipmap\r\n#define GL_LINEAR_CLIPMAP_LINEAR_SGIX     0x8170\r\n#define GL_TEXTURE_CLIPMAP_CENTER_SGIX    0x8171\r\n#define GL_TEXTURE_CLIPMAP_FRAME_SGIX     0x8172\r\n#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX    0x8173\r\n#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174\r\n#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175\r\n#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX     0x8176\r\n#define GL_MAX_CLIPMAP_DEPTH_SGIX         0x8177\r\n#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178\r\n#define GL_NEAREST_CLIPMAP_NEAREST_SGIX   0x844D\r\n#define GL_NEAREST_CLIPMAP_LINEAR_SGIX    0x844E\r\n#define GL_LINEAR_CLIPMAP_NEAREST_SGIX    0x844F\r\n#endif\r\n\r\n#ifndef GL_SGIX_shadow\r\n#define GL_TEXTURE_COMPARE_SGIX           0x819A\r\n#define GL_TEXTURE_COMPARE_OPERATOR_SGIX  0x819B\r\n#define GL_TEXTURE_LEQUAL_R_SGIX          0x819C\r\n#define GL_TEXTURE_GEQUAL_R_SGIX          0x819D\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_edge_clamp\r\n#define GL_CLAMP_TO_EDGE_SGIS             0x812F\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_border_clamp\r\n#define GL_CLAMP_TO_BORDER_SGIS           0x812D\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_minmax\r\n#define GL_FUNC_ADD_EXT                   0x8006\r\n#define GL_MIN_EXT                        0x8007\r\n#define GL_MAX_EXT                        0x8008\r\n#define GL_BLEND_EQUATION_EXT             0x8009\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_subtract\r\n#define GL_FUNC_SUBTRACT_EXT              0x800A\r\n#define GL_FUNC_REVERSE_SUBTRACT_EXT      0x800B\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_logic_op\r\n#endif\r\n\r\n#ifndef GL_SGIX_interlace\r\n#define GL_INTERLACE_SGIX                 0x8094\r\n#endif\r\n\r\n#ifndef GL_SGIX_pixel_tiles\r\n#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E\r\n#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F\r\n#define GL_PIXEL_TILE_WIDTH_SGIX          0x8140\r\n#define GL_PIXEL_TILE_HEIGHT_SGIX         0x8141\r\n#define GL_PIXEL_TILE_GRID_WIDTH_SGIX     0x8142\r\n#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX    0x8143\r\n#define GL_PIXEL_TILE_GRID_DEPTH_SGIX     0x8144\r\n#define GL_PIXEL_TILE_CACHE_SIZE_SGIX     0x8145\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_select\r\n#define GL_DUAL_ALPHA4_SGIS               0x8110\r\n#define GL_DUAL_ALPHA8_SGIS               0x8111\r\n#define GL_DUAL_ALPHA12_SGIS              0x8112\r\n#define GL_DUAL_ALPHA16_SGIS              0x8113\r\n#define GL_DUAL_LUMINANCE4_SGIS           0x8114\r\n#define GL_DUAL_LUMINANCE8_SGIS           0x8115\r\n#define GL_DUAL_LUMINANCE12_SGIS          0x8116\r\n#define GL_DUAL_LUMINANCE16_SGIS          0x8117\r\n#define GL_DUAL_INTENSITY4_SGIS           0x8118\r\n#define GL_DUAL_INTENSITY8_SGIS           0x8119\r\n#define GL_DUAL_INTENSITY12_SGIS          0x811A\r\n#define GL_DUAL_INTENSITY16_SGIS          0x811B\r\n#define GL_DUAL_LUMINANCE_ALPHA4_SGIS     0x811C\r\n#define GL_DUAL_LUMINANCE_ALPHA8_SGIS     0x811D\r\n#define GL_QUAD_ALPHA4_SGIS               0x811E\r\n#define GL_QUAD_ALPHA8_SGIS               0x811F\r\n#define GL_QUAD_LUMINANCE4_SGIS           0x8120\r\n#define GL_QUAD_LUMINANCE8_SGIS           0x8121\r\n#define GL_QUAD_INTENSITY4_SGIS           0x8122\r\n#define GL_QUAD_INTENSITY8_SGIS           0x8123\r\n#define GL_DUAL_TEXTURE_SELECT_SGIS       0x8124\r\n#define GL_QUAD_TEXTURE_SELECT_SGIS       0x8125\r\n#endif\r\n\r\n#ifndef GL_SGIX_sprite\r\n#define GL_SPRITE_SGIX                    0x8148\r\n#define GL_SPRITE_MODE_SGIX               0x8149\r\n#define GL_SPRITE_AXIS_SGIX               0x814A\r\n#define GL_SPRITE_TRANSLATION_SGIX        0x814B\r\n#define GL_SPRITE_AXIAL_SGIX              0x814C\r\n#define GL_SPRITE_OBJECT_ALIGNED_SGIX     0x814D\r\n#define GL_SPRITE_EYE_ALIGNED_SGIX        0x814E\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_multi_buffer\r\n#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E\r\n#endif\r\n\r\n#ifndef GL_EXT_point_parameters\r\n#define GL_POINT_SIZE_MIN_EXT             0x8126\r\n#define GL_POINT_SIZE_MAX_EXT             0x8127\r\n#define GL_POINT_FADE_THRESHOLD_SIZE_EXT  0x8128\r\n#define GL_DISTANCE_ATTENUATION_EXT       0x8129\r\n#endif\r\n\r\n#ifndef GL_SGIS_point_parameters\r\n#define GL_POINT_SIZE_MIN_SGIS            0x8126\r\n#define GL_POINT_SIZE_MAX_SGIS            0x8127\r\n#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128\r\n#define GL_DISTANCE_ATTENUATION_SGIS      0x8129\r\n#endif\r\n\r\n#ifndef GL_SGIX_instruments\r\n#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180\r\n#define GL_INSTRUMENT_MEASUREMENTS_SGIX   0x8181\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_scale_bias\r\n#define GL_POST_TEXTURE_FILTER_BIAS_SGIX  0x8179\r\n#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A\r\n#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B\r\n#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C\r\n#endif\r\n\r\n#ifndef GL_SGIX_framezoom\r\n#define GL_FRAMEZOOM_SGIX                 0x818B\r\n#define GL_FRAMEZOOM_FACTOR_SGIX          0x818C\r\n#define GL_MAX_FRAMEZOOM_FACTOR_SGIX      0x818D\r\n#endif\r\n\r\n#ifndef GL_SGIX_tag_sample_buffer\r\n#endif\r\n\r\n#ifndef GL_SGIX_polynomial_ffd\r\n#define GL_TEXTURE_DEFORMATION_BIT_SGIX   0x00000001\r\n#define GL_GEOMETRY_DEFORMATION_BIT_SGIX  0x00000002\r\n#define GL_GEOMETRY_DEFORMATION_SGIX      0x8194\r\n#define GL_TEXTURE_DEFORMATION_SGIX       0x8195\r\n#define GL_DEFORMATIONS_MASK_SGIX         0x8196\r\n#define GL_MAX_DEFORMATION_ORDER_SGIX     0x8197\r\n#endif\r\n\r\n#ifndef GL_SGIX_reference_plane\r\n#define GL_REFERENCE_PLANE_SGIX           0x817D\r\n#define GL_REFERENCE_PLANE_EQUATION_SGIX  0x817E\r\n#endif\r\n\r\n#ifndef GL_SGIX_flush_raster\r\n#endif\r\n\r\n#ifndef GL_SGIX_depth_texture\r\n#define GL_DEPTH_COMPONENT16_SGIX         0x81A5\r\n#define GL_DEPTH_COMPONENT24_SGIX         0x81A6\r\n#define GL_DEPTH_COMPONENT32_SGIX         0x81A7\r\n#endif\r\n\r\n#ifndef GL_SGIS_fog_function\r\n#define GL_FOG_FUNC_SGIS                  0x812A\r\n#define GL_FOG_FUNC_POINTS_SGIS           0x812B\r\n#define GL_MAX_FOG_FUNC_POINTS_SGIS       0x812C\r\n#endif\r\n\r\n#ifndef GL_SGIX_fog_offset\r\n#define GL_FOG_OFFSET_SGIX                0x8198\r\n#define GL_FOG_OFFSET_VALUE_SGIX          0x8199\r\n#endif\r\n\r\n#ifndef GL_HP_image_transform\r\n#define GL_IMAGE_SCALE_X_HP               0x8155\r\n#define GL_IMAGE_SCALE_Y_HP               0x8156\r\n#define GL_IMAGE_TRANSLATE_X_HP           0x8157\r\n#define GL_IMAGE_TRANSLATE_Y_HP           0x8158\r\n#define GL_IMAGE_ROTATE_ANGLE_HP          0x8159\r\n#define GL_IMAGE_ROTATE_ORIGIN_X_HP       0x815A\r\n#define GL_IMAGE_ROTATE_ORIGIN_Y_HP       0x815B\r\n#define GL_IMAGE_MAG_FILTER_HP            0x815C\r\n#define GL_IMAGE_MIN_FILTER_HP            0x815D\r\n#define GL_IMAGE_CUBIC_WEIGHT_HP          0x815E\r\n#define GL_CUBIC_HP                       0x815F\r\n#define GL_AVERAGE_HP                     0x8160\r\n#define GL_IMAGE_TRANSFORM_2D_HP          0x8161\r\n#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162\r\n#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163\r\n#endif\r\n\r\n#ifndef GL_HP_convolution_border_modes\r\n#define GL_IGNORE_BORDER_HP               0x8150\r\n#define GL_CONSTANT_BORDER_HP             0x8151\r\n#define GL_REPLICATE_BORDER_HP            0x8153\r\n#define GL_CONVOLUTION_BORDER_COLOR_HP    0x8154\r\n#endif\r\n\r\n#ifndef GL_INGR_palette_buffer\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_add_env\r\n#define GL_TEXTURE_ENV_BIAS_SGIX          0x80BE\r\n#endif\r\n\r\n#ifndef GL_EXT_color_subtable\r\n#endif\r\n\r\n#ifndef GL_PGI_vertex_hints\r\n#define GL_VERTEX_DATA_HINT_PGI           0x1A22A\r\n#define GL_VERTEX_CONSISTENT_HINT_PGI     0x1A22B\r\n#define GL_MATERIAL_SIDE_HINT_PGI         0x1A22C\r\n#define GL_MAX_VERTEX_HINT_PGI            0x1A22D\r\n#define GL_VERTEX23_BIT_PGI               0x00000004\r\n#define GL_VERTEX4_BIT_PGI                0x00000008\r\n#define GL_COLOR3_BIT_PGI                 0x00010000\r\n#define GL_COLOR4_BIT_PGI                 0x00020000\r\n#define GL_EDGEFLAG_BIT_PGI               0x00040000\r\n#define GL_INDEX_BIT_PGI                  0x00080000\r\n#define GL_MAT_AMBIENT_BIT_PGI            0x00100000\r\n#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000\r\n#define GL_MAT_DIFFUSE_BIT_PGI            0x00400000\r\n#define GL_MAT_EMISSION_BIT_PGI           0x00800000\r\n#define GL_MAT_COLOR_INDEXES_BIT_PGI      0x01000000\r\n#define GL_MAT_SHININESS_BIT_PGI          0x02000000\r\n#define GL_MAT_SPECULAR_BIT_PGI           0x04000000\r\n#define GL_NORMAL_BIT_PGI                 0x08000000\r\n#define GL_TEXCOORD1_BIT_PGI              0x10000000\r\n#define GL_TEXCOORD2_BIT_PGI              0x20000000\r\n#define GL_TEXCOORD3_BIT_PGI              0x40000000\r\n#define GL_TEXCOORD4_BIT_PGI              0x80000000\r\n#endif\r\n\r\n#ifndef GL_PGI_misc_hints\r\n#define GL_PREFER_DOUBLEBUFFER_HINT_PGI   0x1A1F8\r\n#define GL_CONSERVE_MEMORY_HINT_PGI       0x1A1FD\r\n#define GL_RECLAIM_MEMORY_HINT_PGI        0x1A1FE\r\n#define GL_NATIVE_GRAPHICS_HANDLE_PGI     0x1A202\r\n#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203\r\n#define GL_NATIVE_GRAPHICS_END_HINT_PGI   0x1A204\r\n#define GL_ALWAYS_FAST_HINT_PGI           0x1A20C\r\n#define GL_ALWAYS_SOFT_HINT_PGI           0x1A20D\r\n#define GL_ALLOW_DRAW_OBJ_HINT_PGI        0x1A20E\r\n#define GL_ALLOW_DRAW_WIN_HINT_PGI        0x1A20F\r\n#define GL_ALLOW_DRAW_FRG_HINT_PGI        0x1A210\r\n#define GL_ALLOW_DRAW_MEM_HINT_PGI        0x1A211\r\n#define GL_STRICT_DEPTHFUNC_HINT_PGI      0x1A216\r\n#define GL_STRICT_LIGHTING_HINT_PGI       0x1A217\r\n#define GL_STRICT_SCISSOR_HINT_PGI        0x1A218\r\n#define GL_FULL_STIPPLE_HINT_PGI          0x1A219\r\n#define GL_CLIP_NEAR_HINT_PGI             0x1A220\r\n#define GL_CLIP_FAR_HINT_PGI              0x1A221\r\n#define GL_WIDE_LINE_HINT_PGI             0x1A222\r\n#define GL_BACK_NORMALS_HINT_PGI          0x1A223\r\n#endif\r\n\r\n#ifndef GL_EXT_paletted_texture\r\n#define GL_COLOR_INDEX1_EXT               0x80E2\r\n#define GL_COLOR_INDEX2_EXT               0x80E3\r\n#define GL_COLOR_INDEX4_EXT               0x80E4\r\n#define GL_COLOR_INDEX8_EXT               0x80E5\r\n#define GL_COLOR_INDEX12_EXT              0x80E6\r\n#define GL_COLOR_INDEX16_EXT              0x80E7\r\n#define GL_TEXTURE_INDEX_SIZE_EXT         0x80ED\r\n#endif\r\n\r\n#ifndef GL_EXT_clip_volume_hint\r\n#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT  0x80F0\r\n#endif\r\n\r\n#ifndef GL_SGIX_list_priority\r\n#define GL_LIST_PRIORITY_SGIX             0x8182\r\n#endif\r\n\r\n#ifndef GL_SGIX_ir_instrument1\r\n#define GL_IR_INSTRUMENT1_SGIX            0x817F\r\n#endif\r\n\r\n#ifndef GL_SGIX_calligraphic_fragment\r\n#define GL_CALLIGRAPHIC_FRAGMENT_SGIX     0x8183\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_lod_bias\r\n#define GL_TEXTURE_LOD_BIAS_S_SGIX        0x818E\r\n#define GL_TEXTURE_LOD_BIAS_T_SGIX        0x818F\r\n#define GL_TEXTURE_LOD_BIAS_R_SGIX        0x8190\r\n#endif\r\n\r\n#ifndef GL_SGIX_shadow_ambient\r\n#define GL_SHADOW_AMBIENT_SGIX            0x80BF\r\n#endif\r\n\r\n#ifndef GL_EXT_index_texture\r\n#endif\r\n\r\n#ifndef GL_EXT_index_material\r\n#define GL_INDEX_MATERIAL_EXT             0x81B8\r\n#define GL_INDEX_MATERIAL_PARAMETER_EXT   0x81B9\r\n#define GL_INDEX_MATERIAL_FACE_EXT        0x81BA\r\n#endif\r\n\r\n#ifndef GL_EXT_index_func\r\n#define GL_INDEX_TEST_EXT                 0x81B5\r\n#define GL_INDEX_TEST_FUNC_EXT            0x81B6\r\n#define GL_INDEX_TEST_REF_EXT             0x81B7\r\n#endif\r\n\r\n#ifndef GL_EXT_index_array_formats\r\n#define GL_IUI_V2F_EXT                    0x81AD\r\n#define GL_IUI_V3F_EXT                    0x81AE\r\n#define GL_IUI_N3F_V2F_EXT                0x81AF\r\n#define GL_IUI_N3F_V3F_EXT                0x81B0\r\n#define GL_T2F_IUI_V2F_EXT                0x81B1\r\n#define GL_T2F_IUI_V3F_EXT                0x81B2\r\n#define GL_T2F_IUI_N3F_V2F_EXT            0x81B3\r\n#define GL_T2F_IUI_N3F_V3F_EXT            0x81B4\r\n#endif\r\n\r\n#ifndef GL_EXT_compiled_vertex_array\r\n#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT   0x81A8\r\n#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT   0x81A9\r\n#endif\r\n\r\n#ifndef GL_EXT_cull_vertex\r\n#define GL_CULL_VERTEX_EXT                0x81AA\r\n#define GL_CULL_VERTEX_EYE_POSITION_EXT   0x81AB\r\n#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC\r\n#endif\r\n\r\n#ifndef GL_SGIX_ycrcb\r\n#define GL_YCRCB_422_SGIX                 0x81BB\r\n#define GL_YCRCB_444_SGIX                 0x81BC\r\n#endif\r\n\r\n#ifndef GL_SGIX_fragment_lighting\r\n#define GL_FRAGMENT_LIGHTING_SGIX         0x8400\r\n#define GL_FRAGMENT_COLOR_MATERIAL_SGIX   0x8401\r\n#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402\r\n#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403\r\n#define GL_MAX_FRAGMENT_LIGHTS_SGIX       0x8404\r\n#define GL_MAX_ACTIVE_LIGHTS_SGIX         0x8405\r\n#define GL_CURRENT_RASTER_NORMAL_SGIX     0x8406\r\n#define GL_LIGHT_ENV_MODE_SGIX            0x8407\r\n#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408\r\n#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409\r\n#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A\r\n#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B\r\n#define GL_FRAGMENT_LIGHT0_SGIX           0x840C\r\n#define GL_FRAGMENT_LIGHT1_SGIX           0x840D\r\n#define GL_FRAGMENT_LIGHT2_SGIX           0x840E\r\n#define GL_FRAGMENT_LIGHT3_SGIX           0x840F\r\n#define GL_FRAGMENT_LIGHT4_SGIX           0x8410\r\n#define GL_FRAGMENT_LIGHT5_SGIX           0x8411\r\n#define GL_FRAGMENT_LIGHT6_SGIX           0x8412\r\n#define GL_FRAGMENT_LIGHT7_SGIX           0x8413\r\n#endif\r\n\r\n#ifndef GL_IBM_rasterpos_clip\r\n#define GL_RASTER_POSITION_UNCLIPPED_IBM  0x19262\r\n#endif\r\n\r\n#ifndef GL_HP_texture_lighting\r\n#define GL_TEXTURE_LIGHTING_MODE_HP       0x8167\r\n#define GL_TEXTURE_POST_SPECULAR_HP       0x8168\r\n#define GL_TEXTURE_PRE_SPECULAR_HP        0x8169\r\n#endif\r\n\r\n#ifndef GL_EXT_draw_range_elements\r\n#define GL_MAX_ELEMENTS_VERTICES_EXT      0x80E8\r\n#define GL_MAX_ELEMENTS_INDICES_EXT       0x80E9\r\n#endif\r\n\r\n#ifndef GL_WIN_phong_shading\r\n#define GL_PHONG_WIN                      0x80EA\r\n#define GL_PHONG_HINT_WIN                 0x80EB\r\n#endif\r\n\r\n#ifndef GL_WIN_specular_fog\r\n#define GL_FOG_SPECULAR_TEXTURE_WIN       0x80EC\r\n#endif\r\n\r\n#ifndef GL_EXT_light_texture\r\n#define GL_FRAGMENT_MATERIAL_EXT          0x8349\r\n#define GL_FRAGMENT_NORMAL_EXT            0x834A\r\n#define GL_FRAGMENT_COLOR_EXT             0x834C\r\n#define GL_ATTENUATION_EXT                0x834D\r\n#define GL_SHADOW_ATTENUATION_EXT         0x834E\r\n#define GL_TEXTURE_APPLICATION_MODE_EXT   0x834F\r\n#define GL_TEXTURE_LIGHT_EXT              0x8350\r\n#define GL_TEXTURE_MATERIAL_FACE_EXT      0x8351\r\n#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352\r\n/* reuse GL_FRAGMENT_DEPTH_EXT */\r\n#endif\r\n\r\n#ifndef GL_SGIX_blend_alpha_minmax\r\n#define GL_ALPHA_MIN_SGIX                 0x8320\r\n#define GL_ALPHA_MAX_SGIX                 0x8321\r\n#endif\r\n\r\n#ifndef GL_EXT_bgra\r\n#define GL_BGR_EXT                        0x80E0\r\n#define GL_BGRA_EXT                       0x80E1\r\n#endif\r\n\r\n#ifndef GL_SGIX_async\r\n#define GL_ASYNC_MARKER_SGIX              0x8329\r\n#endif\r\n\r\n#ifndef GL_SGIX_async_pixel\r\n#define GL_ASYNC_TEX_IMAGE_SGIX           0x835C\r\n#define GL_ASYNC_DRAW_PIXELS_SGIX         0x835D\r\n#define GL_ASYNC_READ_PIXELS_SGIX         0x835E\r\n#define GL_MAX_ASYNC_TEX_IMAGE_SGIX       0x835F\r\n#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX     0x8360\r\n#define GL_MAX_ASYNC_READ_PIXELS_SGIX     0x8361\r\n#endif\r\n\r\n#ifndef GL_SGIX_async_histogram\r\n#define GL_ASYNC_HISTOGRAM_SGIX           0x832C\r\n#define GL_MAX_ASYNC_HISTOGRAM_SGIX       0x832D\r\n#endif\r\n\r\n#ifndef GL_INTEL_texture_scissor\r\n#endif\r\n\r\n#ifndef GL_INTEL_parallel_arrays\r\n#define GL_PARALLEL_ARRAYS_INTEL          0x83F4\r\n#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5\r\n#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6\r\n#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7\r\n#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8\r\n#endif\r\n\r\n#ifndef GL_HP_occlusion_test\r\n#define GL_OCCLUSION_TEST_HP              0x8165\r\n#define GL_OCCLUSION_TEST_RESULT_HP       0x8166\r\n#endif\r\n\r\n#ifndef GL_EXT_pixel_transform\r\n#define GL_PIXEL_TRANSFORM_2D_EXT         0x8330\r\n#define GL_PIXEL_MAG_FILTER_EXT           0x8331\r\n#define GL_PIXEL_MIN_FILTER_EXT           0x8332\r\n#define GL_PIXEL_CUBIC_WEIGHT_EXT         0x8333\r\n#define GL_CUBIC_EXT                      0x8334\r\n#define GL_AVERAGE_EXT                    0x8335\r\n#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336\r\n#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337\r\n#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT  0x8338\r\n#endif\r\n\r\n#ifndef GL_EXT_pixel_transform_color_table\r\n#endif\r\n\r\n#ifndef GL_EXT_shared_texture_palette\r\n#define GL_SHARED_TEXTURE_PALETTE_EXT     0x81FB\r\n#endif\r\n\r\n#ifndef GL_EXT_separate_specular_color\r\n#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT  0x81F8\r\n#define GL_SINGLE_COLOR_EXT               0x81F9\r\n#define GL_SEPARATE_SPECULAR_COLOR_EXT    0x81FA\r\n#endif\r\n\r\n#ifndef GL_EXT_secondary_color\r\n#define GL_COLOR_SUM_EXT                  0x8458\r\n#define GL_CURRENT_SECONDARY_COLOR_EXT    0x8459\r\n#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A\r\n#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B\r\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C\r\n#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D\r\n#define GL_SECONDARY_COLOR_ARRAY_EXT      0x845E\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_perturb_normal\r\n#define GL_PERTURB_EXT                    0x85AE\r\n#define GL_TEXTURE_NORMAL_EXT             0x85AF\r\n#endif\r\n\r\n#ifndef GL_EXT_multi_draw_arrays\r\n#endif\r\n\r\n#ifndef GL_EXT_fog_coord\r\n#define GL_FOG_COORDINATE_SOURCE_EXT      0x8450\r\n#define GL_FOG_COORDINATE_EXT             0x8451\r\n#define GL_FRAGMENT_DEPTH_EXT             0x8452\r\n#define GL_CURRENT_FOG_COORDINATE_EXT     0x8453\r\n#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT  0x8454\r\n#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455\r\n#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456\r\n#define GL_FOG_COORDINATE_ARRAY_EXT       0x8457\r\n#endif\r\n\r\n#ifndef GL_REND_screen_coordinates\r\n#define GL_SCREEN_COORDINATES_REND        0x8490\r\n#define GL_INVERTED_SCREEN_W_REND         0x8491\r\n#endif\r\n\r\n#ifndef GL_EXT_coordinate_frame\r\n#define GL_TANGENT_ARRAY_EXT              0x8439\r\n#define GL_BINORMAL_ARRAY_EXT             0x843A\r\n#define GL_CURRENT_TANGENT_EXT            0x843B\r\n#define GL_CURRENT_BINORMAL_EXT           0x843C\r\n#define GL_TANGENT_ARRAY_TYPE_EXT         0x843E\r\n#define GL_TANGENT_ARRAY_STRIDE_EXT       0x843F\r\n#define GL_BINORMAL_ARRAY_TYPE_EXT        0x8440\r\n#define GL_BINORMAL_ARRAY_STRIDE_EXT      0x8441\r\n#define GL_TANGENT_ARRAY_POINTER_EXT      0x8442\r\n#define GL_BINORMAL_ARRAY_POINTER_EXT     0x8443\r\n#define GL_MAP1_TANGENT_EXT               0x8444\r\n#define GL_MAP2_TANGENT_EXT               0x8445\r\n#define GL_MAP1_BINORMAL_EXT              0x8446\r\n#define GL_MAP2_BINORMAL_EXT              0x8447\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_env_combine\r\n#define GL_COMBINE_EXT                    0x8570\r\n#define GL_COMBINE_RGB_EXT                0x8571\r\n#define GL_COMBINE_ALPHA_EXT              0x8572\r\n#define GL_RGB_SCALE_EXT                  0x8573\r\n#define GL_ADD_SIGNED_EXT                 0x8574\r\n#define GL_INTERPOLATE_EXT                0x8575\r\n#define GL_CONSTANT_EXT                   0x8576\r\n#define GL_PRIMARY_COLOR_EXT              0x8577\r\n#define GL_PREVIOUS_EXT                   0x8578\r\n#define GL_SOURCE0_RGB_EXT                0x8580\r\n#define GL_SOURCE1_RGB_EXT                0x8581\r\n#define GL_SOURCE2_RGB_EXT                0x8582\r\n#define GL_SOURCE0_ALPHA_EXT              0x8588\r\n#define GL_SOURCE1_ALPHA_EXT              0x8589\r\n#define GL_SOURCE2_ALPHA_EXT              0x858A\r\n#define GL_OPERAND0_RGB_EXT               0x8590\r\n#define GL_OPERAND1_RGB_EXT               0x8591\r\n#define GL_OPERAND2_RGB_EXT               0x8592\r\n#define GL_OPERAND0_ALPHA_EXT             0x8598\r\n#define GL_OPERAND1_ALPHA_EXT             0x8599\r\n#define GL_OPERAND2_ALPHA_EXT             0x859A\r\n#endif\r\n\r\n#ifndef GL_APPLE_specular_vector\r\n#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0\r\n#endif\r\n\r\n#ifndef GL_APPLE_transform_hint\r\n#define GL_TRANSFORM_HINT_APPLE           0x85B1\r\n#endif\r\n\r\n#ifndef GL_SUNX_constant_data\r\n#define GL_UNPACK_CONSTANT_DATA_SUNX      0x81D5\r\n#define GL_TEXTURE_CONSTANT_DATA_SUNX     0x81D6\r\n#endif\r\n\r\n#ifndef GL_SUN_global_alpha\r\n#define GL_GLOBAL_ALPHA_SUN               0x81D9\r\n#define GL_GLOBAL_ALPHA_FACTOR_SUN        0x81DA\r\n#endif\r\n\r\n#ifndef GL_SUN_triangle_list\r\n#define GL_RESTART_SUN                    0x0001\r\n#define GL_REPLACE_MIDDLE_SUN             0x0002\r\n#define GL_REPLACE_OLDEST_SUN             0x0003\r\n#define GL_TRIANGLE_LIST_SUN              0x81D7\r\n#define GL_REPLACEMENT_CODE_SUN           0x81D8\r\n#define GL_REPLACEMENT_CODE_ARRAY_SUN     0x85C0\r\n#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1\r\n#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2\r\n#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3\r\n#define GL_R1UI_V3F_SUN                   0x85C4\r\n#define GL_R1UI_C4UB_V3F_SUN              0x85C5\r\n#define GL_R1UI_C3F_V3F_SUN               0x85C6\r\n#define GL_R1UI_N3F_V3F_SUN               0x85C7\r\n#define GL_R1UI_C4F_N3F_V3F_SUN           0x85C8\r\n#define GL_R1UI_T2F_V3F_SUN               0x85C9\r\n#define GL_R1UI_T2F_N3F_V3F_SUN           0x85CA\r\n#define GL_R1UI_T2F_C4F_N3F_V3F_SUN       0x85CB\r\n#endif\r\n\r\n#ifndef GL_SUN_vertex\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_func_separate\r\n#define GL_BLEND_DST_RGB_EXT              0x80C8\r\n#define GL_BLEND_SRC_RGB_EXT              0x80C9\r\n#define GL_BLEND_DST_ALPHA_EXT            0x80CA\r\n#define GL_BLEND_SRC_ALPHA_EXT            0x80CB\r\n#endif\r\n\r\n#ifndef GL_INGR_color_clamp\r\n#define GL_RED_MIN_CLAMP_INGR             0x8560\r\n#define GL_GREEN_MIN_CLAMP_INGR           0x8561\r\n#define GL_BLUE_MIN_CLAMP_INGR            0x8562\r\n#define GL_ALPHA_MIN_CLAMP_INGR           0x8563\r\n#define GL_RED_MAX_CLAMP_INGR             0x8564\r\n#define GL_GREEN_MAX_CLAMP_INGR           0x8565\r\n#define GL_BLUE_MAX_CLAMP_INGR            0x8566\r\n#define GL_ALPHA_MAX_CLAMP_INGR           0x8567\r\n#endif\r\n\r\n#ifndef GL_INGR_interlace_read\r\n#define GL_INTERLACE_READ_INGR            0x8568\r\n#endif\r\n\r\n#ifndef GL_EXT_stencil_wrap\r\n#define GL_INCR_WRAP_EXT                  0x8507\r\n#define GL_DECR_WRAP_EXT                  0x8508\r\n#endif\r\n\r\n#ifndef GL_EXT_422_pixels\r\n#define GL_422_EXT                        0x80CC\r\n#define GL_422_REV_EXT                    0x80CD\r\n#define GL_422_AVERAGE_EXT                0x80CE\r\n#define GL_422_REV_AVERAGE_EXT            0x80CF\r\n#endif\r\n\r\n#ifndef GL_NV_texgen_reflection\r\n#define GL_NORMAL_MAP_NV                  0x8511\r\n#define GL_REFLECTION_MAP_NV              0x8512\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_cube_map\r\n#define GL_NORMAL_MAP_EXT                 0x8511\r\n#define GL_REFLECTION_MAP_EXT             0x8512\r\n#define GL_TEXTURE_CUBE_MAP_EXT           0x8513\r\n#define GL_TEXTURE_BINDING_CUBE_MAP_EXT   0x8514\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518\r\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519\r\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A\r\n#define GL_PROXY_TEXTURE_CUBE_MAP_EXT     0x851B\r\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT  0x851C\r\n#endif\r\n\r\n#ifndef GL_SUN_convolution_border_modes\r\n#define GL_WRAP_BORDER_SUN                0x81D4\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_env_add\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_lod_bias\r\n#define GL_MAX_TEXTURE_LOD_BIAS_EXT       0x84FD\r\n#define GL_TEXTURE_FILTER_CONTROL_EXT     0x8500\r\n#define GL_TEXTURE_LOD_BIAS_EXT           0x8501\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_filter_anisotropic\r\n#define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE\r\n#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_weighting\r\n#define GL_MODELVIEW0_STACK_DEPTH_EXT     0x0BA3\r\n#define GL_MODELVIEW1_STACK_DEPTH_EXT     0x8502\r\n#define GL_MODELVIEW0_MATRIX_EXT          0x0BA6\r\n#define GL_MODELVIEW1_MATRIX_EXT          0x8506\r\n#define GL_VERTEX_WEIGHTING_EXT           0x8509\r\n#define GL_MODELVIEW0_EXT                 0x1700\r\n#define GL_MODELVIEW1_EXT                 0x850A\r\n#define GL_CURRENT_VERTEX_WEIGHT_EXT      0x850B\r\n#define GL_VERTEX_WEIGHT_ARRAY_EXT        0x850C\r\n#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT   0x850D\r\n#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT   0x850E\r\n#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F\r\n#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510\r\n#endif\r\n\r\n#ifndef GL_NV_light_max_exponent\r\n#define GL_MAX_SHININESS_NV               0x8504\r\n#define GL_MAX_SPOT_EXPONENT_NV           0x8505\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_array_range\r\n#define GL_VERTEX_ARRAY_RANGE_NV          0x851D\r\n#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV   0x851E\r\n#define GL_VERTEX_ARRAY_RANGE_VALID_NV    0x851F\r\n#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520\r\n#define GL_VERTEX_ARRAY_RANGE_POINTER_NV  0x8521\r\n#endif\r\n\r\n#ifndef GL_NV_register_combiners\r\n#define GL_REGISTER_COMBINERS_NV          0x8522\r\n#define GL_VARIABLE_A_NV                  0x8523\r\n#define GL_VARIABLE_B_NV                  0x8524\r\n#define GL_VARIABLE_C_NV                  0x8525\r\n#define GL_VARIABLE_D_NV                  0x8526\r\n#define GL_VARIABLE_E_NV                  0x8527\r\n#define GL_VARIABLE_F_NV                  0x8528\r\n#define GL_VARIABLE_G_NV                  0x8529\r\n#define GL_CONSTANT_COLOR0_NV             0x852A\r\n#define GL_CONSTANT_COLOR1_NV             0x852B\r\n#define GL_PRIMARY_COLOR_NV               0x852C\r\n#define GL_SECONDARY_COLOR_NV             0x852D\r\n#define GL_SPARE0_NV                      0x852E\r\n#define GL_SPARE1_NV                      0x852F\r\n#define GL_DISCARD_NV                     0x8530\r\n#define GL_E_TIMES_F_NV                   0x8531\r\n#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532\r\n#define GL_UNSIGNED_IDENTITY_NV           0x8536\r\n#define GL_UNSIGNED_INVERT_NV             0x8537\r\n#define GL_EXPAND_NORMAL_NV               0x8538\r\n#define GL_EXPAND_NEGATE_NV               0x8539\r\n#define GL_HALF_BIAS_NORMAL_NV            0x853A\r\n#define GL_HALF_BIAS_NEGATE_NV            0x853B\r\n#define GL_SIGNED_IDENTITY_NV             0x853C\r\n#define GL_SIGNED_NEGATE_NV               0x853D\r\n#define GL_SCALE_BY_TWO_NV                0x853E\r\n#define GL_SCALE_BY_FOUR_NV               0x853F\r\n#define GL_SCALE_BY_ONE_HALF_NV           0x8540\r\n#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV   0x8541\r\n#define GL_COMBINER_INPUT_NV              0x8542\r\n#define GL_COMBINER_MAPPING_NV            0x8543\r\n#define GL_COMBINER_COMPONENT_USAGE_NV    0x8544\r\n#define GL_COMBINER_AB_DOT_PRODUCT_NV     0x8545\r\n#define GL_COMBINER_CD_DOT_PRODUCT_NV     0x8546\r\n#define GL_COMBINER_MUX_SUM_NV            0x8547\r\n#define GL_COMBINER_SCALE_NV              0x8548\r\n#define GL_COMBINER_BIAS_NV               0x8549\r\n#define GL_COMBINER_AB_OUTPUT_NV          0x854A\r\n#define GL_COMBINER_CD_OUTPUT_NV          0x854B\r\n#define GL_COMBINER_SUM_OUTPUT_NV         0x854C\r\n#define GL_MAX_GENERAL_COMBINERS_NV       0x854D\r\n#define GL_NUM_GENERAL_COMBINERS_NV       0x854E\r\n#define GL_COLOR_SUM_CLAMP_NV             0x854F\r\n#define GL_COMBINER0_NV                   0x8550\r\n#define GL_COMBINER1_NV                   0x8551\r\n#define GL_COMBINER2_NV                   0x8552\r\n#define GL_COMBINER3_NV                   0x8553\r\n#define GL_COMBINER4_NV                   0x8554\r\n#define GL_COMBINER5_NV                   0x8555\r\n#define GL_COMBINER6_NV                   0x8556\r\n#define GL_COMBINER7_NV                   0x8557\r\n/* reuse GL_TEXTURE0_ARB */\r\n/* reuse GL_TEXTURE1_ARB */\r\n/* reuse GL_ZERO */\r\n/* reuse GL_NONE */\r\n/* reuse GL_FOG */\r\n#endif\r\n\r\n#ifndef GL_NV_fog_distance\r\n#define GL_FOG_DISTANCE_MODE_NV           0x855A\r\n#define GL_EYE_RADIAL_NV                  0x855B\r\n#define GL_EYE_PLANE_ABSOLUTE_NV          0x855C\r\n/* reuse GL_EYE_PLANE */\r\n#endif\r\n\r\n#ifndef GL_NV_texgen_emboss\r\n#define GL_EMBOSS_LIGHT_NV                0x855D\r\n#define GL_EMBOSS_CONSTANT_NV             0x855E\r\n#define GL_EMBOSS_MAP_NV                  0x855F\r\n#endif\r\n\r\n#ifndef GL_NV_blend_square\r\n#endif\r\n\r\n#ifndef GL_NV_texture_env_combine4\r\n#define GL_COMBINE4_NV                    0x8503\r\n#define GL_SOURCE3_RGB_NV                 0x8583\r\n#define GL_SOURCE3_ALPHA_NV               0x858B\r\n#define GL_OPERAND3_RGB_NV                0x8593\r\n#define GL_OPERAND3_ALPHA_NV              0x859B\r\n#endif\r\n\r\n#ifndef GL_MESA_resize_buffers\r\n#endif\r\n\r\n#ifndef GL_MESA_window_pos\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_compression_s3tc\r\n#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0\r\n#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1\r\n#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2\r\n#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3\r\n#endif\r\n\r\n#ifndef GL_IBM_cull_vertex\r\n#define GL_CULL_VERTEX_IBM                103050\r\n#endif\r\n\r\n#ifndef GL_IBM_multimode_draw_arrays\r\n#endif\r\n\r\n#ifndef GL_IBM_vertex_array_lists\r\n#define GL_VERTEX_ARRAY_LIST_IBM          103070\r\n#define GL_NORMAL_ARRAY_LIST_IBM          103071\r\n#define GL_COLOR_ARRAY_LIST_IBM           103072\r\n#define GL_INDEX_ARRAY_LIST_IBM           103073\r\n#define GL_TEXTURE_COORD_ARRAY_LIST_IBM   103074\r\n#define GL_EDGE_FLAG_ARRAY_LIST_IBM       103075\r\n#define GL_FOG_COORDINATE_ARRAY_LIST_IBM  103076\r\n#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077\r\n#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM   103080\r\n#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM   103081\r\n#define GL_COLOR_ARRAY_LIST_STRIDE_IBM    103082\r\n#define GL_INDEX_ARRAY_LIST_STRIDE_IBM    103083\r\n#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084\r\n#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085\r\n#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086\r\n#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087\r\n#endif\r\n\r\n#ifndef GL_SGIX_subsample\r\n#define GL_PACK_SUBSAMPLE_RATE_SGIX       0x85A0\r\n#define GL_UNPACK_SUBSAMPLE_RATE_SGIX     0x85A1\r\n#define GL_PIXEL_SUBSAMPLE_4444_SGIX      0x85A2\r\n#define GL_PIXEL_SUBSAMPLE_2424_SGIX      0x85A3\r\n#define GL_PIXEL_SUBSAMPLE_4242_SGIX      0x85A4\r\n#endif\r\n\r\n#ifndef GL_SGIX_ycrcb_subsample\r\n#endif\r\n\r\n#ifndef GL_SGIX_ycrcba\r\n#define GL_YCRCB_SGIX                     0x8318\r\n#define GL_YCRCBA_SGIX                    0x8319\r\n#endif\r\n\r\n#ifndef GL_3DFX_texture_compression_FXT1\r\n#define GL_COMPRESSED_RGB_FXT1_3DFX       0x86B0\r\n#define GL_COMPRESSED_RGBA_FXT1_3DFX      0x86B1\r\n#endif\r\n\r\n#ifndef GL_3DFX_multisample\r\n#define GL_MULTISAMPLE_3DFX               0x86B2\r\n#define GL_SAMPLE_BUFFERS_3DFX            0x86B3\r\n#define GL_SAMPLES_3DFX                   0x86B4\r\n#define GL_MULTISAMPLE_BIT_3DFX           0x20000000\r\n#endif\r\n\r\n#ifndef GL_3DFX_tbuffer\r\n#endif\r\n\r\n#ifndef GL_EXT_multisample\r\n#define GL_MULTISAMPLE_EXT                0x809D\r\n#define GL_SAMPLE_ALPHA_TO_MASK_EXT       0x809E\r\n#define GL_SAMPLE_ALPHA_TO_ONE_EXT        0x809F\r\n#define GL_SAMPLE_MASK_EXT                0x80A0\r\n#define GL_1PASS_EXT                      0x80A1\r\n#define GL_2PASS_0_EXT                    0x80A2\r\n#define GL_2PASS_1_EXT                    0x80A3\r\n#define GL_4PASS_0_EXT                    0x80A4\r\n#define GL_4PASS_1_EXT                    0x80A5\r\n#define GL_4PASS_2_EXT                    0x80A6\r\n#define GL_4PASS_3_EXT                    0x80A7\r\n#define GL_SAMPLE_BUFFERS_EXT             0x80A8\r\n#define GL_SAMPLES_EXT                    0x80A9\r\n#define GL_SAMPLE_MASK_VALUE_EXT          0x80AA\r\n#define GL_SAMPLE_MASK_INVERT_EXT         0x80AB\r\n#define GL_SAMPLE_PATTERN_EXT             0x80AC\r\n#define GL_MULTISAMPLE_BIT_EXT            0x20000000\r\n#endif\r\n\r\n#ifndef GL_SGIX_vertex_preclip\r\n#define GL_VERTEX_PRECLIP_SGIX            0x83EE\r\n#define GL_VERTEX_PRECLIP_HINT_SGIX       0x83EF\r\n#endif\r\n\r\n#ifndef GL_SGIX_convolution_accuracy\r\n#define GL_CONVOLUTION_HINT_SGIX          0x8316\r\n#endif\r\n\r\n#ifndef GL_SGIX_resample\r\n#define GL_PACK_RESAMPLE_SGIX             0x842C\r\n#define GL_UNPACK_RESAMPLE_SGIX           0x842D\r\n#define GL_RESAMPLE_REPLICATE_SGIX        0x842E\r\n#define GL_RESAMPLE_ZERO_FILL_SGIX        0x842F\r\n#define GL_RESAMPLE_DECIMATE_SGIX         0x8430\r\n#endif\r\n\r\n#ifndef GL_SGIS_point_line_texgen\r\n#define GL_EYE_DISTANCE_TO_POINT_SGIS     0x81F0\r\n#define GL_OBJECT_DISTANCE_TO_POINT_SGIS  0x81F1\r\n#define GL_EYE_DISTANCE_TO_LINE_SGIS      0x81F2\r\n#define GL_OBJECT_DISTANCE_TO_LINE_SGIS   0x81F3\r\n#define GL_EYE_POINT_SGIS                 0x81F4\r\n#define GL_OBJECT_POINT_SGIS              0x81F5\r\n#define GL_EYE_LINE_SGIS                  0x81F6\r\n#define GL_OBJECT_LINE_SGIS               0x81F7\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_color_mask\r\n#define GL_TEXTURE_COLOR_WRITEMASK_SGIS   0x81EF\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_env_dot3\r\n#define GL_DOT3_RGB_EXT                   0x8740\r\n#define GL_DOT3_RGBA_EXT                  0x8741\r\n#endif\r\n\r\n#ifndef GL_ATI_texture_mirror_once\r\n#define GL_MIRROR_CLAMP_ATI               0x8742\r\n#define GL_MIRROR_CLAMP_TO_EDGE_ATI       0x8743\r\n#endif\r\n\r\n#ifndef GL_NV_fence\r\n#define GL_ALL_COMPLETED_NV               0x84F2\r\n#define GL_FENCE_STATUS_NV                0x84F3\r\n#define GL_FENCE_CONDITION_NV             0x84F4\r\n#endif\r\n\r\n#ifndef GL_IBM_static_data\r\n#define GL_ALL_STATIC_DATA_IBM            103060\r\n#define GL_STATIC_VERTEX_ARRAY_IBM        103061\r\n#endif\r\n\r\n#ifndef GL_IBM_texture_mirrored_repeat\r\n#define GL_MIRRORED_REPEAT_IBM            0x8370\r\n#endif\r\n\r\n#ifndef GL_NV_evaluators\r\n#define GL_EVAL_2D_NV                     0x86C0\r\n#define GL_EVAL_TRIANGULAR_2D_NV          0x86C1\r\n#define GL_MAP_TESSELLATION_NV            0x86C2\r\n#define GL_MAP_ATTRIB_U_ORDER_NV          0x86C3\r\n#define GL_MAP_ATTRIB_V_ORDER_NV          0x86C4\r\n#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5\r\n#define GL_EVAL_VERTEX_ATTRIB0_NV         0x86C6\r\n#define GL_EVAL_VERTEX_ATTRIB1_NV         0x86C7\r\n#define GL_EVAL_VERTEX_ATTRIB2_NV         0x86C8\r\n#define GL_EVAL_VERTEX_ATTRIB3_NV         0x86C9\r\n#define GL_EVAL_VERTEX_ATTRIB4_NV         0x86CA\r\n#define GL_EVAL_VERTEX_ATTRIB5_NV         0x86CB\r\n#define GL_EVAL_VERTEX_ATTRIB6_NV         0x86CC\r\n#define GL_EVAL_VERTEX_ATTRIB7_NV         0x86CD\r\n#define GL_EVAL_VERTEX_ATTRIB8_NV         0x86CE\r\n#define GL_EVAL_VERTEX_ATTRIB9_NV         0x86CF\r\n#define GL_EVAL_VERTEX_ATTRIB10_NV        0x86D0\r\n#define GL_EVAL_VERTEX_ATTRIB11_NV        0x86D1\r\n#define GL_EVAL_VERTEX_ATTRIB12_NV        0x86D2\r\n#define GL_EVAL_VERTEX_ATTRIB13_NV        0x86D3\r\n#define GL_EVAL_VERTEX_ATTRIB14_NV        0x86D4\r\n#define GL_EVAL_VERTEX_ATTRIB15_NV        0x86D5\r\n#define GL_MAX_MAP_TESSELLATION_NV        0x86D6\r\n#define GL_MAX_RATIONAL_EVAL_ORDER_NV     0x86D7\r\n#endif\r\n\r\n#ifndef GL_NV_packed_depth_stencil\r\n#define GL_DEPTH_STENCIL_NV               0x84F9\r\n#define GL_UNSIGNED_INT_24_8_NV           0x84FA\r\n#endif\r\n\r\n#ifndef GL_NV_register_combiners2\r\n#define GL_PER_STAGE_CONSTANTS_NV         0x8535\r\n#endif\r\n\r\n#ifndef GL_NV_texture_compression_vtc\r\n#endif\r\n\r\n#ifndef GL_NV_texture_rectangle\r\n#define GL_TEXTURE_RECTANGLE_NV           0x84F5\r\n#define GL_TEXTURE_BINDING_RECTANGLE_NV   0x84F6\r\n#define GL_PROXY_TEXTURE_RECTANGLE_NV     0x84F7\r\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV  0x84F8\r\n#endif\r\n\r\n#ifndef GL_NV_texture_shader\r\n#define GL_OFFSET_TEXTURE_RECTANGLE_NV    0x864C\r\n#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D\r\n#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E\r\n#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9\r\n#define GL_UNSIGNED_INT_S8_S8_8_8_NV      0x86DA\r\n#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV  0x86DB\r\n#define GL_DSDT_MAG_INTENSITY_NV          0x86DC\r\n#define GL_SHADER_CONSISTENT_NV           0x86DD\r\n#define GL_TEXTURE_SHADER_NV              0x86DE\r\n#define GL_SHADER_OPERATION_NV            0x86DF\r\n#define GL_CULL_MODES_NV                  0x86E0\r\n#define GL_OFFSET_TEXTURE_MATRIX_NV       0x86E1\r\n#define GL_OFFSET_TEXTURE_2D_MATRIX_NV    0x86E1\r\n#define GL_OFFSET_TEXTURE_SCALE_NV        0x86E2\r\n#define GL_OFFSET_TEXTURE_2D_SCALE_NV     0x86E2\r\n#define GL_OFFSET_TEXTURE_BIAS_NV         0x86E3\r\n#define GL_OFFSET_TEXTURE_2D_BIAS_NV      0x86E3\r\n#define GL_PREVIOUS_TEXTURE_INPUT_NV      0x86E4\r\n#define GL_CONST_EYE_NV                   0x86E5\r\n#define GL_PASS_THROUGH_NV                0x86E6\r\n#define GL_CULL_FRAGMENT_NV               0x86E7\r\n#define GL_OFFSET_TEXTURE_2D_NV           0x86E8\r\n#define GL_DEPENDENT_AR_TEXTURE_2D_NV     0x86E9\r\n#define GL_DEPENDENT_GB_TEXTURE_2D_NV     0x86EA\r\n#define GL_DOT_PRODUCT_NV                 0x86EC\r\n#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV   0x86ED\r\n#define GL_DOT_PRODUCT_TEXTURE_2D_NV      0x86EE\r\n#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0\r\n#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1\r\n#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2\r\n#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3\r\n#define GL_HILO_NV                        0x86F4\r\n#define GL_DSDT_NV                        0x86F5\r\n#define GL_DSDT_MAG_NV                    0x86F6\r\n#define GL_DSDT_MAG_VIB_NV                0x86F7\r\n#define GL_HILO16_NV                      0x86F8\r\n#define GL_SIGNED_HILO_NV                 0x86F9\r\n#define GL_SIGNED_HILO16_NV               0x86FA\r\n#define GL_SIGNED_RGBA_NV                 0x86FB\r\n#define GL_SIGNED_RGBA8_NV                0x86FC\r\n#define GL_SIGNED_RGB_NV                  0x86FE\r\n#define GL_SIGNED_RGB8_NV                 0x86FF\r\n#define GL_SIGNED_LUMINANCE_NV            0x8701\r\n#define GL_SIGNED_LUMINANCE8_NV           0x8702\r\n#define GL_SIGNED_LUMINANCE_ALPHA_NV      0x8703\r\n#define GL_SIGNED_LUMINANCE8_ALPHA8_NV    0x8704\r\n#define GL_SIGNED_ALPHA_NV                0x8705\r\n#define GL_SIGNED_ALPHA8_NV               0x8706\r\n#define GL_SIGNED_INTENSITY_NV            0x8707\r\n#define GL_SIGNED_INTENSITY8_NV           0x8708\r\n#define GL_DSDT8_NV                       0x8709\r\n#define GL_DSDT8_MAG8_NV                  0x870A\r\n#define GL_DSDT8_MAG8_INTENSITY8_NV       0x870B\r\n#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV   0x870C\r\n#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D\r\n#define GL_HI_SCALE_NV                    0x870E\r\n#define GL_LO_SCALE_NV                    0x870F\r\n#define GL_DS_SCALE_NV                    0x8710\r\n#define GL_DT_SCALE_NV                    0x8711\r\n#define GL_MAGNITUDE_SCALE_NV             0x8712\r\n#define GL_VIBRANCE_SCALE_NV              0x8713\r\n#define GL_HI_BIAS_NV                     0x8714\r\n#define GL_LO_BIAS_NV                     0x8715\r\n#define GL_DS_BIAS_NV                     0x8716\r\n#define GL_DT_BIAS_NV                     0x8717\r\n#define GL_MAGNITUDE_BIAS_NV              0x8718\r\n#define GL_VIBRANCE_BIAS_NV               0x8719\r\n#define GL_TEXTURE_BORDER_VALUES_NV       0x871A\r\n#define GL_TEXTURE_HI_SIZE_NV             0x871B\r\n#define GL_TEXTURE_LO_SIZE_NV             0x871C\r\n#define GL_TEXTURE_DS_SIZE_NV             0x871D\r\n#define GL_TEXTURE_DT_SIZE_NV             0x871E\r\n#define GL_TEXTURE_MAG_SIZE_NV            0x871F\r\n#endif\r\n\r\n#ifndef GL_NV_texture_shader2\r\n#define GL_DOT_PRODUCT_TEXTURE_3D_NV      0x86EF\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_array_range2\r\n#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program\r\n#define GL_VERTEX_PROGRAM_NV              0x8620\r\n#define GL_VERTEX_STATE_PROGRAM_NV        0x8621\r\n#define GL_ATTRIB_ARRAY_SIZE_NV           0x8623\r\n#define GL_ATTRIB_ARRAY_STRIDE_NV         0x8624\r\n#define GL_ATTRIB_ARRAY_TYPE_NV           0x8625\r\n#define GL_CURRENT_ATTRIB_NV              0x8626\r\n#define GL_PROGRAM_LENGTH_NV              0x8627\r\n#define GL_PROGRAM_STRING_NV              0x8628\r\n#define GL_MODELVIEW_PROJECTION_NV        0x8629\r\n#define GL_IDENTITY_NV                    0x862A\r\n#define GL_INVERSE_NV                     0x862B\r\n#define GL_TRANSPOSE_NV                   0x862C\r\n#define GL_INVERSE_TRANSPOSE_NV           0x862D\r\n#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E\r\n#define GL_MAX_TRACK_MATRICES_NV          0x862F\r\n#define GL_MATRIX0_NV                     0x8630\r\n#define GL_MATRIX1_NV                     0x8631\r\n#define GL_MATRIX2_NV                     0x8632\r\n#define GL_MATRIX3_NV                     0x8633\r\n#define GL_MATRIX4_NV                     0x8634\r\n#define GL_MATRIX5_NV                     0x8635\r\n#define GL_MATRIX6_NV                     0x8636\r\n#define GL_MATRIX7_NV                     0x8637\r\n#define GL_CURRENT_MATRIX_STACK_DEPTH_NV  0x8640\r\n#define GL_CURRENT_MATRIX_NV              0x8641\r\n#define GL_VERTEX_PROGRAM_POINT_SIZE_NV   0x8642\r\n#define GL_VERTEX_PROGRAM_TWO_SIDE_NV     0x8643\r\n#define GL_PROGRAM_PARAMETER_NV           0x8644\r\n#define GL_ATTRIB_ARRAY_POINTER_NV        0x8645\r\n#define GL_PROGRAM_TARGET_NV              0x8646\r\n#define GL_PROGRAM_RESIDENT_NV            0x8647\r\n#define GL_TRACK_MATRIX_NV                0x8648\r\n#define GL_TRACK_MATRIX_TRANSFORM_NV      0x8649\r\n#define GL_VERTEX_PROGRAM_BINDING_NV      0x864A\r\n#define GL_PROGRAM_ERROR_POSITION_NV      0x864B\r\n#define GL_VERTEX_ATTRIB_ARRAY0_NV        0x8650\r\n#define GL_VERTEX_ATTRIB_ARRAY1_NV        0x8651\r\n#define GL_VERTEX_ATTRIB_ARRAY2_NV        0x8652\r\n#define GL_VERTEX_ATTRIB_ARRAY3_NV        0x8653\r\n#define GL_VERTEX_ATTRIB_ARRAY4_NV        0x8654\r\n#define GL_VERTEX_ATTRIB_ARRAY5_NV        0x8655\r\n#define GL_VERTEX_ATTRIB_ARRAY6_NV        0x8656\r\n#define GL_VERTEX_ATTRIB_ARRAY7_NV        0x8657\r\n#define GL_VERTEX_ATTRIB_ARRAY8_NV        0x8658\r\n#define GL_VERTEX_ATTRIB_ARRAY9_NV        0x8659\r\n#define GL_VERTEX_ATTRIB_ARRAY10_NV       0x865A\r\n#define GL_VERTEX_ATTRIB_ARRAY11_NV       0x865B\r\n#define GL_VERTEX_ATTRIB_ARRAY12_NV       0x865C\r\n#define GL_VERTEX_ATTRIB_ARRAY13_NV       0x865D\r\n#define GL_VERTEX_ATTRIB_ARRAY14_NV       0x865E\r\n#define GL_VERTEX_ATTRIB_ARRAY15_NV       0x865F\r\n#define GL_MAP1_VERTEX_ATTRIB0_4_NV       0x8660\r\n#define GL_MAP1_VERTEX_ATTRIB1_4_NV       0x8661\r\n#define GL_MAP1_VERTEX_ATTRIB2_4_NV       0x8662\r\n#define GL_MAP1_VERTEX_ATTRIB3_4_NV       0x8663\r\n#define GL_MAP1_VERTEX_ATTRIB4_4_NV       0x8664\r\n#define GL_MAP1_VERTEX_ATTRIB5_4_NV       0x8665\r\n#define GL_MAP1_VERTEX_ATTRIB6_4_NV       0x8666\r\n#define GL_MAP1_VERTEX_ATTRIB7_4_NV       0x8667\r\n#define GL_MAP1_VERTEX_ATTRIB8_4_NV       0x8668\r\n#define GL_MAP1_VERTEX_ATTRIB9_4_NV       0x8669\r\n#define GL_MAP1_VERTEX_ATTRIB10_4_NV      0x866A\r\n#define GL_MAP1_VERTEX_ATTRIB11_4_NV      0x866B\r\n#define GL_MAP1_VERTEX_ATTRIB12_4_NV      0x866C\r\n#define GL_MAP1_VERTEX_ATTRIB13_4_NV      0x866D\r\n#define GL_MAP1_VERTEX_ATTRIB14_4_NV      0x866E\r\n#define GL_MAP1_VERTEX_ATTRIB15_4_NV      0x866F\r\n#define GL_MAP2_VERTEX_ATTRIB0_4_NV       0x8670\r\n#define GL_MAP2_VERTEX_ATTRIB1_4_NV       0x8671\r\n#define GL_MAP2_VERTEX_ATTRIB2_4_NV       0x8672\r\n#define GL_MAP2_VERTEX_ATTRIB3_4_NV       0x8673\r\n#define GL_MAP2_VERTEX_ATTRIB4_4_NV       0x8674\r\n#define GL_MAP2_VERTEX_ATTRIB5_4_NV       0x8675\r\n#define GL_MAP2_VERTEX_ATTRIB6_4_NV       0x8676\r\n#define GL_MAP2_VERTEX_ATTRIB7_4_NV       0x8677\r\n#define GL_MAP2_VERTEX_ATTRIB8_4_NV       0x8678\r\n#define GL_MAP2_VERTEX_ATTRIB9_4_NV       0x8679\r\n#define GL_MAP2_VERTEX_ATTRIB10_4_NV      0x867A\r\n#define GL_MAP2_VERTEX_ATTRIB11_4_NV      0x867B\r\n#define GL_MAP2_VERTEX_ATTRIB12_4_NV      0x867C\r\n#define GL_MAP2_VERTEX_ATTRIB13_4_NV      0x867D\r\n#define GL_MAP2_VERTEX_ATTRIB14_4_NV      0x867E\r\n#define GL_MAP2_VERTEX_ATTRIB15_4_NV      0x867F\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_coordinate_clamp\r\n#define GL_TEXTURE_MAX_CLAMP_S_SGIX       0x8369\r\n#define GL_TEXTURE_MAX_CLAMP_T_SGIX       0x836A\r\n#define GL_TEXTURE_MAX_CLAMP_R_SGIX       0x836B\r\n#endif\r\n\r\n#ifndef GL_SGIX_scalebias_hint\r\n#define GL_SCALEBIAS_HINT_SGIX            0x8322\r\n#endif\r\n\r\n#ifndef GL_OML_interlace\r\n#define GL_INTERLACE_OML                  0x8980\r\n#define GL_INTERLACE_READ_OML             0x8981\r\n#endif\r\n\r\n#ifndef GL_OML_subsample\r\n#define GL_FORMAT_SUBSAMPLE_24_24_OML     0x8982\r\n#define GL_FORMAT_SUBSAMPLE_244_244_OML   0x8983\r\n#endif\r\n\r\n#ifndef GL_OML_resample\r\n#define GL_PACK_RESAMPLE_OML              0x8984\r\n#define GL_UNPACK_RESAMPLE_OML            0x8985\r\n#define GL_RESAMPLE_REPLICATE_OML         0x8986\r\n#define GL_RESAMPLE_ZERO_FILL_OML         0x8987\r\n#define GL_RESAMPLE_AVERAGE_OML           0x8988\r\n#define GL_RESAMPLE_DECIMATE_OML          0x8989\r\n#endif\r\n\r\n#ifndef GL_NV_copy_depth_to_color\r\n#define GL_DEPTH_STENCIL_TO_RGBA_NV       0x886E\r\n#define GL_DEPTH_STENCIL_TO_BGRA_NV       0x886F\r\n#endif\r\n\r\n#ifndef GL_ATI_envmap_bumpmap\r\n#define GL_BUMP_ROT_MATRIX_ATI            0x8775\r\n#define GL_BUMP_ROT_MATRIX_SIZE_ATI       0x8776\r\n#define GL_BUMP_NUM_TEX_UNITS_ATI         0x8777\r\n#define GL_BUMP_TEX_UNITS_ATI             0x8778\r\n#define GL_DUDV_ATI                       0x8779\r\n#define GL_DU8DV8_ATI                     0x877A\r\n#define GL_BUMP_ENVMAP_ATI                0x877B\r\n#define GL_BUMP_TARGET_ATI                0x877C\r\n#endif\r\n\r\n#ifndef GL_ATI_fragment_shader\r\n#define GL_FRAGMENT_SHADER_ATI            0x8920\r\n#define GL_REG_0_ATI                      0x8921\r\n#define GL_REG_1_ATI                      0x8922\r\n#define GL_REG_2_ATI                      0x8923\r\n#define GL_REG_3_ATI                      0x8924\r\n#define GL_REG_4_ATI                      0x8925\r\n#define GL_REG_5_ATI                      0x8926\r\n#define GL_REG_6_ATI                      0x8927\r\n#define GL_REG_7_ATI                      0x8928\r\n#define GL_REG_8_ATI                      0x8929\r\n#define GL_REG_9_ATI                      0x892A\r\n#define GL_REG_10_ATI                     0x892B\r\n#define GL_REG_11_ATI                     0x892C\r\n#define GL_REG_12_ATI                     0x892D\r\n#define GL_REG_13_ATI                     0x892E\r\n#define GL_REG_14_ATI                     0x892F\r\n#define GL_REG_15_ATI                     0x8930\r\n#define GL_REG_16_ATI                     0x8931\r\n#define GL_REG_17_ATI                     0x8932\r\n#define GL_REG_18_ATI                     0x8933\r\n#define GL_REG_19_ATI                     0x8934\r\n#define GL_REG_20_ATI                     0x8935\r\n#define GL_REG_21_ATI                     0x8936\r\n#define GL_REG_22_ATI                     0x8937\r\n#define GL_REG_23_ATI                     0x8938\r\n#define GL_REG_24_ATI                     0x8939\r\n#define GL_REG_25_ATI                     0x893A\r\n#define GL_REG_26_ATI                     0x893B\r\n#define GL_REG_27_ATI                     0x893C\r\n#define GL_REG_28_ATI                     0x893D\r\n#define GL_REG_29_ATI                     0x893E\r\n#define GL_REG_30_ATI                     0x893F\r\n#define GL_REG_31_ATI                     0x8940\r\n#define GL_CON_0_ATI                      0x8941\r\n#define GL_CON_1_ATI                      0x8942\r\n#define GL_CON_2_ATI                      0x8943\r\n#define GL_CON_3_ATI                      0x8944\r\n#define GL_CON_4_ATI                      0x8945\r\n#define GL_CON_5_ATI                      0x8946\r\n#define GL_CON_6_ATI                      0x8947\r\n#define GL_CON_7_ATI                      0x8948\r\n#define GL_CON_8_ATI                      0x8949\r\n#define GL_CON_9_ATI                      0x894A\r\n#define GL_CON_10_ATI                     0x894B\r\n#define GL_CON_11_ATI                     0x894C\r\n#define GL_CON_12_ATI                     0x894D\r\n#define GL_CON_13_ATI                     0x894E\r\n#define GL_CON_14_ATI                     0x894F\r\n#define GL_CON_15_ATI                     0x8950\r\n#define GL_CON_16_ATI                     0x8951\r\n#define GL_CON_17_ATI                     0x8952\r\n#define GL_CON_18_ATI                     0x8953\r\n#define GL_CON_19_ATI                     0x8954\r\n#define GL_CON_20_ATI                     0x8955\r\n#define GL_CON_21_ATI                     0x8956\r\n#define GL_CON_22_ATI                     0x8957\r\n#define GL_CON_23_ATI                     0x8958\r\n#define GL_CON_24_ATI                     0x8959\r\n#define GL_CON_25_ATI                     0x895A\r\n#define GL_CON_26_ATI                     0x895B\r\n#define GL_CON_27_ATI                     0x895C\r\n#define GL_CON_28_ATI                     0x895D\r\n#define GL_CON_29_ATI                     0x895E\r\n#define GL_CON_30_ATI                     0x895F\r\n#define GL_CON_31_ATI                     0x8960\r\n#define GL_MOV_ATI                        0x8961\r\n#define GL_ADD_ATI                        0x8963\r\n#define GL_MUL_ATI                        0x8964\r\n#define GL_SUB_ATI                        0x8965\r\n#define GL_DOT3_ATI                       0x8966\r\n#define GL_DOT4_ATI                       0x8967\r\n#define GL_MAD_ATI                        0x8968\r\n#define GL_LERP_ATI                       0x8969\r\n#define GL_CND_ATI                        0x896A\r\n#define GL_CND0_ATI                       0x896B\r\n#define GL_DOT2_ADD_ATI                   0x896C\r\n#define GL_SECONDARY_INTERPOLATOR_ATI     0x896D\r\n#define GL_NUM_FRAGMENT_REGISTERS_ATI     0x896E\r\n#define GL_NUM_FRAGMENT_CONSTANTS_ATI     0x896F\r\n#define GL_NUM_PASSES_ATI                 0x8970\r\n#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI  0x8971\r\n#define GL_NUM_INSTRUCTIONS_TOTAL_ATI     0x8972\r\n#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973\r\n#define GL_NUM_LOOPBACK_COMPONENTS_ATI    0x8974\r\n#define GL_COLOR_ALPHA_PAIRING_ATI        0x8975\r\n#define GL_SWIZZLE_STR_ATI                0x8976\r\n#define GL_SWIZZLE_STQ_ATI                0x8977\r\n#define GL_SWIZZLE_STR_DR_ATI             0x8978\r\n#define GL_SWIZZLE_STQ_DQ_ATI             0x8979\r\n#define GL_SWIZZLE_STRQ_ATI               0x897A\r\n#define GL_SWIZZLE_STRQ_DQ_ATI            0x897B\r\n#define GL_RED_BIT_ATI                    0x00000001\r\n#define GL_GREEN_BIT_ATI                  0x00000002\r\n#define GL_BLUE_BIT_ATI                   0x00000004\r\n#define GL_2X_BIT_ATI                     0x00000001\r\n#define GL_4X_BIT_ATI                     0x00000002\r\n#define GL_8X_BIT_ATI                     0x00000004\r\n#define GL_HALF_BIT_ATI                   0x00000008\r\n#define GL_QUARTER_BIT_ATI                0x00000010\r\n#define GL_EIGHTH_BIT_ATI                 0x00000020\r\n#define GL_SATURATE_BIT_ATI               0x00000040\r\n#define GL_COMP_BIT_ATI                   0x00000002\r\n#define GL_NEGATE_BIT_ATI                 0x00000004\r\n#define GL_BIAS_BIT_ATI                   0x00000008\r\n#endif\r\n\r\n#ifndef GL_ATI_pn_triangles\r\n#define GL_PN_TRIANGLES_ATI               0x87F0\r\n#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1\r\n#define GL_PN_TRIANGLES_POINT_MODE_ATI    0x87F2\r\n#define GL_PN_TRIANGLES_NORMAL_MODE_ATI   0x87F3\r\n#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4\r\n#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5\r\n#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6\r\n#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7\r\n#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8\r\n#endif\r\n\r\n#ifndef GL_ATI_vertex_array_object\r\n#define GL_STATIC_ATI                     0x8760\r\n#define GL_DYNAMIC_ATI                    0x8761\r\n#define GL_PRESERVE_ATI                   0x8762\r\n#define GL_DISCARD_ATI                    0x8763\r\n#define GL_OBJECT_BUFFER_SIZE_ATI         0x8764\r\n#define GL_OBJECT_BUFFER_USAGE_ATI        0x8765\r\n#define GL_ARRAY_OBJECT_BUFFER_ATI        0x8766\r\n#define GL_ARRAY_OBJECT_OFFSET_ATI        0x8767\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_shader\r\n#define GL_VERTEX_SHADER_EXT              0x8780\r\n#define GL_VERTEX_SHADER_BINDING_EXT      0x8781\r\n#define GL_OP_INDEX_EXT                   0x8782\r\n#define GL_OP_NEGATE_EXT                  0x8783\r\n#define GL_OP_DOT3_EXT                    0x8784\r\n#define GL_OP_DOT4_EXT                    0x8785\r\n#define GL_OP_MUL_EXT                     0x8786\r\n#define GL_OP_ADD_EXT                     0x8787\r\n#define GL_OP_MADD_EXT                    0x8788\r\n#define GL_OP_FRAC_EXT                    0x8789\r\n#define GL_OP_MAX_EXT                     0x878A\r\n#define GL_OP_MIN_EXT                     0x878B\r\n#define GL_OP_SET_GE_EXT                  0x878C\r\n#define GL_OP_SET_LT_EXT                  0x878D\r\n#define GL_OP_CLAMP_EXT                   0x878E\r\n#define GL_OP_FLOOR_EXT                   0x878F\r\n#define GL_OP_ROUND_EXT                   0x8790\r\n#define GL_OP_EXP_BASE_2_EXT              0x8791\r\n#define GL_OP_LOG_BASE_2_EXT              0x8792\r\n#define GL_OP_POWER_EXT                   0x8793\r\n#define GL_OP_RECIP_EXT                   0x8794\r\n#define GL_OP_RECIP_SQRT_EXT              0x8795\r\n#define GL_OP_SUB_EXT                     0x8796\r\n#define GL_OP_CROSS_PRODUCT_EXT           0x8797\r\n#define GL_OP_MULTIPLY_MATRIX_EXT         0x8798\r\n#define GL_OP_MOV_EXT                     0x8799\r\n#define GL_OUTPUT_VERTEX_EXT              0x879A\r\n#define GL_OUTPUT_COLOR0_EXT              0x879B\r\n#define GL_OUTPUT_COLOR1_EXT              0x879C\r\n#define GL_OUTPUT_TEXTURE_COORD0_EXT      0x879D\r\n#define GL_OUTPUT_TEXTURE_COORD1_EXT      0x879E\r\n#define GL_OUTPUT_TEXTURE_COORD2_EXT      0x879F\r\n#define GL_OUTPUT_TEXTURE_COORD3_EXT      0x87A0\r\n#define GL_OUTPUT_TEXTURE_COORD4_EXT      0x87A1\r\n#define GL_OUTPUT_TEXTURE_COORD5_EXT      0x87A2\r\n#define GL_OUTPUT_TEXTURE_COORD6_EXT      0x87A3\r\n#define GL_OUTPUT_TEXTURE_COORD7_EXT      0x87A4\r\n#define GL_OUTPUT_TEXTURE_COORD8_EXT      0x87A5\r\n#define GL_OUTPUT_TEXTURE_COORD9_EXT      0x87A6\r\n#define GL_OUTPUT_TEXTURE_COORD10_EXT     0x87A7\r\n#define GL_OUTPUT_TEXTURE_COORD11_EXT     0x87A8\r\n#define GL_OUTPUT_TEXTURE_COORD12_EXT     0x87A9\r\n#define GL_OUTPUT_TEXTURE_COORD13_EXT     0x87AA\r\n#define GL_OUTPUT_TEXTURE_COORD14_EXT     0x87AB\r\n#define GL_OUTPUT_TEXTURE_COORD15_EXT     0x87AC\r\n#define GL_OUTPUT_TEXTURE_COORD16_EXT     0x87AD\r\n#define GL_OUTPUT_TEXTURE_COORD17_EXT     0x87AE\r\n#define GL_OUTPUT_TEXTURE_COORD18_EXT     0x87AF\r\n#define GL_OUTPUT_TEXTURE_COORD19_EXT     0x87B0\r\n#define GL_OUTPUT_TEXTURE_COORD20_EXT     0x87B1\r\n#define GL_OUTPUT_TEXTURE_COORD21_EXT     0x87B2\r\n#define GL_OUTPUT_TEXTURE_COORD22_EXT     0x87B3\r\n#define GL_OUTPUT_TEXTURE_COORD23_EXT     0x87B4\r\n#define GL_OUTPUT_TEXTURE_COORD24_EXT     0x87B5\r\n#define GL_OUTPUT_TEXTURE_COORD25_EXT     0x87B6\r\n#define GL_OUTPUT_TEXTURE_COORD26_EXT     0x87B7\r\n#define GL_OUTPUT_TEXTURE_COORD27_EXT     0x87B8\r\n#define GL_OUTPUT_TEXTURE_COORD28_EXT     0x87B9\r\n#define GL_OUTPUT_TEXTURE_COORD29_EXT     0x87BA\r\n#define GL_OUTPUT_TEXTURE_COORD30_EXT     0x87BB\r\n#define GL_OUTPUT_TEXTURE_COORD31_EXT     0x87BC\r\n#define GL_OUTPUT_FOG_EXT                 0x87BD\r\n#define GL_SCALAR_EXT                     0x87BE\r\n#define GL_VECTOR_EXT                     0x87BF\r\n#define GL_MATRIX_EXT                     0x87C0\r\n#define GL_VARIANT_EXT                    0x87C1\r\n#define GL_INVARIANT_EXT                  0x87C2\r\n#define GL_LOCAL_CONSTANT_EXT             0x87C3\r\n#define GL_LOCAL_EXT                      0x87C4\r\n#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5\r\n#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6\r\n#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7\r\n#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8\r\n#define GL_MAX_VERTEX_SHADER_LOCALS_EXT   0x87C9\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD\r\n#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE\r\n#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF\r\n#define GL_VERTEX_SHADER_VARIANTS_EXT     0x87D0\r\n#define GL_VERTEX_SHADER_INVARIANTS_EXT   0x87D1\r\n#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2\r\n#define GL_VERTEX_SHADER_LOCALS_EXT       0x87D3\r\n#define GL_VERTEX_SHADER_OPTIMIZED_EXT    0x87D4\r\n#define GL_X_EXT                          0x87D5\r\n#define GL_Y_EXT                          0x87D6\r\n#define GL_Z_EXT                          0x87D7\r\n#define GL_W_EXT                          0x87D8\r\n#define GL_NEGATIVE_X_EXT                 0x87D9\r\n#define GL_NEGATIVE_Y_EXT                 0x87DA\r\n#define GL_NEGATIVE_Z_EXT                 0x87DB\r\n#define GL_NEGATIVE_W_EXT                 0x87DC\r\n#define GL_ZERO_EXT                       0x87DD\r\n#define GL_ONE_EXT                        0x87DE\r\n#define GL_NEGATIVE_ONE_EXT               0x87DF\r\n#define GL_NORMALIZED_RANGE_EXT           0x87E0\r\n#define GL_FULL_RANGE_EXT                 0x87E1\r\n#define GL_CURRENT_VERTEX_EXT             0x87E2\r\n#define GL_MVP_MATRIX_EXT                 0x87E3\r\n#define GL_VARIANT_VALUE_EXT              0x87E4\r\n#define GL_VARIANT_DATATYPE_EXT           0x87E5\r\n#define GL_VARIANT_ARRAY_STRIDE_EXT       0x87E6\r\n#define GL_VARIANT_ARRAY_TYPE_EXT         0x87E7\r\n#define GL_VARIANT_ARRAY_EXT              0x87E8\r\n#define GL_VARIANT_ARRAY_POINTER_EXT      0x87E9\r\n#define GL_INVARIANT_VALUE_EXT            0x87EA\r\n#define GL_INVARIANT_DATATYPE_EXT         0x87EB\r\n#define GL_LOCAL_CONSTANT_VALUE_EXT       0x87EC\r\n#define GL_LOCAL_CONSTANT_DATATYPE_EXT    0x87ED\r\n#endif\r\n\r\n#ifndef GL_ATI_vertex_streams\r\n#define GL_MAX_VERTEX_STREAMS_ATI         0x876B\r\n#define GL_VERTEX_STREAM0_ATI             0x876C\r\n#define GL_VERTEX_STREAM1_ATI             0x876D\r\n#define GL_VERTEX_STREAM2_ATI             0x876E\r\n#define GL_VERTEX_STREAM3_ATI             0x876F\r\n#define GL_VERTEX_STREAM4_ATI             0x8770\r\n#define GL_VERTEX_STREAM5_ATI             0x8771\r\n#define GL_VERTEX_STREAM6_ATI             0x8772\r\n#define GL_VERTEX_STREAM7_ATI             0x8773\r\n#define GL_VERTEX_SOURCE_ATI              0x8774\r\n#endif\r\n\r\n#ifndef GL_ATI_element_array\r\n#define GL_ELEMENT_ARRAY_ATI              0x8768\r\n#define GL_ELEMENT_ARRAY_TYPE_ATI         0x8769\r\n#define GL_ELEMENT_ARRAY_POINTER_ATI      0x876A\r\n#endif\r\n\r\n#ifndef GL_SUN_mesh_array\r\n#define GL_QUAD_MESH_SUN                  0x8614\r\n#define GL_TRIANGLE_MESH_SUN              0x8615\r\n#endif\r\n\r\n#ifndef GL_SUN_slice_accum\r\n#define GL_SLICE_ACCUM_SUN                0x85CC\r\n#endif\r\n\r\n#ifndef GL_NV_multisample_filter_hint\r\n#define GL_MULTISAMPLE_FILTER_HINT_NV     0x8534\r\n#endif\r\n\r\n#ifndef GL_NV_depth_clamp\r\n#define GL_DEPTH_CLAMP_NV                 0x864F\r\n#endif\r\n\r\n#ifndef GL_NV_occlusion_query\r\n#define GL_PIXEL_COUNTER_BITS_NV          0x8864\r\n#define GL_CURRENT_OCCLUSION_QUERY_ID_NV  0x8865\r\n#define GL_PIXEL_COUNT_NV                 0x8866\r\n#define GL_PIXEL_COUNT_AVAILABLE_NV       0x8867\r\n#endif\r\n\r\n#ifndef GL_NV_point_sprite\r\n#define GL_POINT_SPRITE_NV                0x8861\r\n#define GL_COORD_REPLACE_NV               0x8862\r\n#define GL_POINT_SPRITE_R_MODE_NV         0x8863\r\n#endif\r\n\r\n#ifndef GL_NV_texture_shader3\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852\r\n#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853\r\n#define GL_OFFSET_HILO_TEXTURE_2D_NV      0x8854\r\n#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855\r\n#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856\r\n#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857\r\n#define GL_DEPENDENT_HILO_TEXTURE_2D_NV   0x8858\r\n#define GL_DEPENDENT_RGB_TEXTURE_3D_NV    0x8859\r\n#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A\r\n#define GL_DOT_PRODUCT_PASS_THROUGH_NV    0x885B\r\n#define GL_DOT_PRODUCT_TEXTURE_1D_NV      0x885C\r\n#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D\r\n#define GL_HILO8_NV                       0x885E\r\n#define GL_SIGNED_HILO8_NV                0x885F\r\n#define GL_FORCE_BLUE_TO_ONE_NV           0x8860\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program1_1\r\n#endif\r\n\r\n#ifndef GL_EXT_shadow_funcs\r\n#endif\r\n\r\n#ifndef GL_EXT_stencil_two_side\r\n#define GL_STENCIL_TEST_TWO_SIDE_EXT      0x8910\r\n#define GL_ACTIVE_STENCIL_FACE_EXT        0x8911\r\n#endif\r\n\r\n#ifndef GL_ATI_text_fragment_shader\r\n#define GL_TEXT_FRAGMENT_SHADER_ATI       0x8200\r\n#endif\r\n\r\n#ifndef GL_APPLE_client_storage\r\n#define GL_UNPACK_CLIENT_STORAGE_APPLE    0x85B2\r\n#endif\r\n\r\n#ifndef GL_APPLE_element_array\r\n#define GL_ELEMENT_ARRAY_APPLE            0x8A0C\r\n#define GL_ELEMENT_ARRAY_TYPE_APPLE       0x8A0D\r\n#define GL_ELEMENT_ARRAY_POINTER_APPLE    0x8A0E\r\n#endif\r\n\r\n#ifndef GL_APPLE_fence\r\n#define GL_DRAW_PIXELS_APPLE              0x8A0A\r\n#define GL_FENCE_APPLE                    0x8A0B\r\n#endif\r\n\r\n#ifndef GL_APPLE_vertex_array_object\r\n#define GL_VERTEX_ARRAY_BINDING_APPLE     0x85B5\r\n#endif\r\n\r\n#ifndef GL_APPLE_vertex_array_range\r\n#define GL_VERTEX_ARRAY_RANGE_APPLE       0x851D\r\n#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E\r\n#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F\r\n#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521\r\n#define GL_STORAGE_CLIENT_APPLE           0x85B4\r\n#define GL_STORAGE_CACHED_APPLE           0x85BE\r\n#define GL_STORAGE_SHARED_APPLE           0x85BF\r\n#endif\r\n\r\n#ifndef GL_APPLE_ycbcr_422\r\n#define GL_YCBCR_422_APPLE                0x85B9\r\n#define GL_UNSIGNED_SHORT_8_8_APPLE       0x85BA\r\n#define GL_UNSIGNED_SHORT_8_8_REV_APPLE   0x85BB\r\n#endif\r\n\r\n#ifndef GL_S3_s3tc\r\n#define GL_RGB_S3TC                       0x83A0\r\n#define GL_RGB4_S3TC                      0x83A1\r\n#define GL_RGBA_S3TC                      0x83A2\r\n#define GL_RGBA4_S3TC                     0x83A3\r\n#define GL_RGBA_DXT5_S3TC                 0x83A4\r\n#define GL_RGBA4_DXT5_S3TC                0x83A5\r\n#endif\r\n\r\n#ifndef GL_ATI_draw_buffers\r\n#define GL_MAX_DRAW_BUFFERS_ATI           0x8824\r\n#define GL_DRAW_BUFFER0_ATI               0x8825\r\n#define GL_DRAW_BUFFER1_ATI               0x8826\r\n#define GL_DRAW_BUFFER2_ATI               0x8827\r\n#define GL_DRAW_BUFFER3_ATI               0x8828\r\n#define GL_DRAW_BUFFER4_ATI               0x8829\r\n#define GL_DRAW_BUFFER5_ATI               0x882A\r\n#define GL_DRAW_BUFFER6_ATI               0x882B\r\n#define GL_DRAW_BUFFER7_ATI               0x882C\r\n#define GL_DRAW_BUFFER8_ATI               0x882D\r\n#define GL_DRAW_BUFFER9_ATI               0x882E\r\n#define GL_DRAW_BUFFER10_ATI              0x882F\r\n#define GL_DRAW_BUFFER11_ATI              0x8830\r\n#define GL_DRAW_BUFFER12_ATI              0x8831\r\n#define GL_DRAW_BUFFER13_ATI              0x8832\r\n#define GL_DRAW_BUFFER14_ATI              0x8833\r\n#define GL_DRAW_BUFFER15_ATI              0x8834\r\n#endif\r\n\r\n#ifndef GL_ATI_pixel_format_float\r\n#define GL_RGBA_FLOAT_MODE_ATI            0x8820\r\n#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835\r\n#endif\r\n\r\n#ifndef GL_ATI_texture_env_combine3\r\n#define GL_MODULATE_ADD_ATI               0x8744\r\n#define GL_MODULATE_SIGNED_ADD_ATI        0x8745\r\n#define GL_MODULATE_SUBTRACT_ATI          0x8746\r\n#endif\r\n\r\n#ifndef GL_ATI_texture_float\r\n#define GL_RGBA_FLOAT32_ATI               0x8814\r\n#define GL_RGB_FLOAT32_ATI                0x8815\r\n#define GL_ALPHA_FLOAT32_ATI              0x8816\r\n#define GL_INTENSITY_FLOAT32_ATI          0x8817\r\n#define GL_LUMINANCE_FLOAT32_ATI          0x8818\r\n#define GL_LUMINANCE_ALPHA_FLOAT32_ATI    0x8819\r\n#define GL_RGBA_FLOAT16_ATI               0x881A\r\n#define GL_RGB_FLOAT16_ATI                0x881B\r\n#define GL_ALPHA_FLOAT16_ATI              0x881C\r\n#define GL_INTENSITY_FLOAT16_ATI          0x881D\r\n#define GL_LUMINANCE_FLOAT16_ATI          0x881E\r\n#define GL_LUMINANCE_ALPHA_FLOAT16_ATI    0x881F\r\n#endif\r\n\r\n#ifndef GL_NV_float_buffer\r\n#define GL_FLOAT_R_NV                     0x8880\r\n#define GL_FLOAT_RG_NV                    0x8881\r\n#define GL_FLOAT_RGB_NV                   0x8882\r\n#define GL_FLOAT_RGBA_NV                  0x8883\r\n#define GL_FLOAT_R16_NV                   0x8884\r\n#define GL_FLOAT_R32_NV                   0x8885\r\n#define GL_FLOAT_RG16_NV                  0x8886\r\n#define GL_FLOAT_RG32_NV                  0x8887\r\n#define GL_FLOAT_RGB16_NV                 0x8888\r\n#define GL_FLOAT_RGB32_NV                 0x8889\r\n#define GL_FLOAT_RGBA16_NV                0x888A\r\n#define GL_FLOAT_RGBA32_NV                0x888B\r\n#define GL_TEXTURE_FLOAT_COMPONENTS_NV    0x888C\r\n#define GL_FLOAT_CLEAR_COLOR_VALUE_NV     0x888D\r\n#define GL_FLOAT_RGBA_MODE_NV             0x888E\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program\r\n#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868\r\n#define GL_FRAGMENT_PROGRAM_NV            0x8870\r\n#define GL_MAX_TEXTURE_COORDS_NV          0x8871\r\n#define GL_MAX_TEXTURE_IMAGE_UNITS_NV     0x8872\r\n#define GL_FRAGMENT_PROGRAM_BINDING_NV    0x8873\r\n#define GL_PROGRAM_ERROR_STRING_NV        0x8874\r\n#endif\r\n\r\n#ifndef GL_NV_half_float\r\n#define GL_HALF_FLOAT_NV                  0x140B\r\n#endif\r\n\r\n#ifndef GL_NV_pixel_data_range\r\n#define GL_WRITE_PIXEL_DATA_RANGE_NV      0x8878\r\n#define GL_READ_PIXEL_DATA_RANGE_NV       0x8879\r\n#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A\r\n#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B\r\n#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C\r\n#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D\r\n#endif\r\n\r\n#ifndef GL_NV_primitive_restart\r\n#define GL_PRIMITIVE_RESTART_NV           0x8558\r\n#define GL_PRIMITIVE_RESTART_INDEX_NV     0x8559\r\n#endif\r\n\r\n#ifndef GL_NV_texture_expand_normal\r\n#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program2\r\n#endif\r\n\r\n#ifndef GL_ATI_map_object_buffer\r\n#endif\r\n\r\n#ifndef GL_ATI_separate_stencil\r\n#define GL_STENCIL_BACK_FUNC_ATI          0x8800\r\n#define GL_STENCIL_BACK_FAIL_ATI          0x8801\r\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802\r\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803\r\n#endif\r\n\r\n#ifndef GL_ATI_vertex_attrib_array_object\r\n#endif\r\n\r\n#ifndef GL_OES_byte_coordinates\r\n#endif\r\n\r\n#ifndef GL_OES_fixed_point\r\n#define GL_FIXED_OES                      0x140C\r\n#endif\r\n\r\n#ifndef GL_OES_single_precision\r\n#endif\r\n\r\n#ifndef GL_OES_compressed_paletted_texture\r\n#define GL_PALETTE4_RGB8_OES              0x8B90\r\n#define GL_PALETTE4_RGBA8_OES             0x8B91\r\n#define GL_PALETTE4_R5_G6_B5_OES          0x8B92\r\n#define GL_PALETTE4_RGBA4_OES             0x8B93\r\n#define GL_PALETTE4_RGB5_A1_OES           0x8B94\r\n#define GL_PALETTE8_RGB8_OES              0x8B95\r\n#define GL_PALETTE8_RGBA8_OES             0x8B96\r\n#define GL_PALETTE8_R5_G6_B5_OES          0x8B97\r\n#define GL_PALETTE8_RGBA4_OES             0x8B98\r\n#define GL_PALETTE8_RGB5_A1_OES           0x8B99\r\n#endif\r\n\r\n#ifndef GL_OES_read_format\r\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A\r\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B\r\n#endif\r\n\r\n#ifndef GL_OES_query_matrix\r\n#endif\r\n\r\n#ifndef GL_EXT_depth_bounds_test\r\n#define GL_DEPTH_BOUNDS_TEST_EXT          0x8890\r\n#define GL_DEPTH_BOUNDS_EXT               0x8891\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_mirror_clamp\r\n#define GL_MIRROR_CLAMP_EXT               0x8742\r\n#define GL_MIRROR_CLAMP_TO_EDGE_EXT       0x8743\r\n#define GL_MIRROR_CLAMP_TO_BORDER_EXT     0x8912\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_equation_separate\r\n#define GL_BLEND_EQUATION_RGB_EXT         0x8009\r\n#define GL_BLEND_EQUATION_ALPHA_EXT       0x883D\r\n#endif\r\n\r\n#ifndef GL_MESA_pack_invert\r\n#define GL_PACK_INVERT_MESA               0x8758\r\n#endif\r\n\r\n#ifndef GL_MESA_ycbcr_texture\r\n#define GL_UNSIGNED_SHORT_8_8_MESA        0x85BA\r\n#define GL_UNSIGNED_SHORT_8_8_REV_MESA    0x85BB\r\n#define GL_YCBCR_MESA                     0x8757\r\n#endif\r\n\r\n#ifndef GL_EXT_pixel_buffer_object\r\n#define GL_PIXEL_PACK_BUFFER_EXT          0x88EB\r\n#define GL_PIXEL_UNPACK_BUFFER_EXT        0x88EC\r\n#define GL_PIXEL_PACK_BUFFER_BINDING_EXT  0x88ED\r\n#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program_option\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program2\r\n#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4\r\n#define GL_MAX_PROGRAM_CALL_DEPTH_NV      0x88F5\r\n#define GL_MAX_PROGRAM_IF_DEPTH_NV        0x88F6\r\n#define GL_MAX_PROGRAM_LOOP_DEPTH_NV      0x88F7\r\n#define GL_MAX_PROGRAM_LOOP_COUNT_NV      0x88F8\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program2_option\r\n/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */\r\n/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program3\r\n/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_object\r\n#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506\r\n#define GL_MAX_RENDERBUFFER_SIZE_EXT      0x84E8\r\n#define GL_FRAMEBUFFER_BINDING_EXT        0x8CA6\r\n#define GL_RENDERBUFFER_BINDING_EXT       0x8CA7\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0\r\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4\r\n#define GL_FRAMEBUFFER_COMPLETE_EXT       0x8CD5\r\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9\r\n#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA\r\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB\r\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC\r\n#define GL_FRAMEBUFFER_UNSUPPORTED_EXT    0x8CDD\r\n#define GL_MAX_COLOR_ATTACHMENTS_EXT      0x8CDF\r\n#define GL_COLOR_ATTACHMENT0_EXT          0x8CE0\r\n#define GL_COLOR_ATTACHMENT1_EXT          0x8CE1\r\n#define GL_COLOR_ATTACHMENT2_EXT          0x8CE2\r\n#define GL_COLOR_ATTACHMENT3_EXT          0x8CE3\r\n#define GL_COLOR_ATTACHMENT4_EXT          0x8CE4\r\n#define GL_COLOR_ATTACHMENT5_EXT          0x8CE5\r\n#define GL_COLOR_ATTACHMENT6_EXT          0x8CE6\r\n#define GL_COLOR_ATTACHMENT7_EXT          0x8CE7\r\n#define GL_COLOR_ATTACHMENT8_EXT          0x8CE8\r\n#define GL_COLOR_ATTACHMENT9_EXT          0x8CE9\r\n#define GL_COLOR_ATTACHMENT10_EXT         0x8CEA\r\n#define GL_COLOR_ATTACHMENT11_EXT         0x8CEB\r\n#define GL_COLOR_ATTACHMENT12_EXT         0x8CEC\r\n#define GL_COLOR_ATTACHMENT13_EXT         0x8CED\r\n#define GL_COLOR_ATTACHMENT14_EXT         0x8CEE\r\n#define GL_COLOR_ATTACHMENT15_EXT         0x8CEF\r\n#define GL_DEPTH_ATTACHMENT_EXT           0x8D00\r\n#define GL_STENCIL_ATTACHMENT_EXT         0x8D20\r\n#define GL_FRAMEBUFFER_EXT                0x8D40\r\n#define GL_RENDERBUFFER_EXT               0x8D41\r\n#define GL_RENDERBUFFER_WIDTH_EXT         0x8D42\r\n#define GL_RENDERBUFFER_HEIGHT_EXT        0x8D43\r\n#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44\r\n#define GL_STENCIL_INDEX1_EXT             0x8D46\r\n#define GL_STENCIL_INDEX4_EXT             0x8D47\r\n#define GL_STENCIL_INDEX8_EXT             0x8D48\r\n#define GL_STENCIL_INDEX16_EXT            0x8D49\r\n#define GL_RENDERBUFFER_RED_SIZE_EXT      0x8D50\r\n#define GL_RENDERBUFFER_GREEN_SIZE_EXT    0x8D51\r\n#define GL_RENDERBUFFER_BLUE_SIZE_EXT     0x8D52\r\n#define GL_RENDERBUFFER_ALPHA_SIZE_EXT    0x8D53\r\n#define GL_RENDERBUFFER_DEPTH_SIZE_EXT    0x8D54\r\n#define GL_RENDERBUFFER_STENCIL_SIZE_EXT  0x8D55\r\n#endif\r\n\r\n#ifndef GL_GREMEDY_string_marker\r\n#endif\r\n\r\n#ifndef GL_EXT_packed_depth_stencil\r\n#define GL_DEPTH_STENCIL_EXT              0x84F9\r\n#define GL_UNSIGNED_INT_24_8_EXT          0x84FA\r\n#define GL_DEPTH24_STENCIL8_EXT           0x88F0\r\n#define GL_TEXTURE_STENCIL_SIZE_EXT       0x88F1\r\n#endif\r\n\r\n#ifndef GL_EXT_stencil_clear_tag\r\n#define GL_STENCIL_TAG_BITS_EXT           0x88F2\r\n#define GL_STENCIL_CLEAR_TAG_VALUE_EXT    0x88F3\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_sRGB\r\n#define GL_SRGB_EXT                       0x8C40\r\n#define GL_SRGB8_EXT                      0x8C41\r\n#define GL_SRGB_ALPHA_EXT                 0x8C42\r\n#define GL_SRGB8_ALPHA8_EXT               0x8C43\r\n#define GL_SLUMINANCE_ALPHA_EXT           0x8C44\r\n#define GL_SLUMINANCE8_ALPHA8_EXT         0x8C45\r\n#define GL_SLUMINANCE_EXT                 0x8C46\r\n#define GL_SLUMINANCE8_EXT                0x8C47\r\n#define GL_COMPRESSED_SRGB_EXT            0x8C48\r\n#define GL_COMPRESSED_SRGB_ALPHA_EXT      0x8C49\r\n#define GL_COMPRESSED_SLUMINANCE_EXT      0x8C4A\r\n#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B\r\n#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT  0x8C4C\r\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D\r\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E\r\n#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_blit\r\n#define GL_READ_FRAMEBUFFER_EXT           0x8CA8\r\n#define GL_DRAW_FRAMEBUFFER_EXT           0x8CA9\r\n#define GL_DRAW_FRAMEBUFFER_BINDING_EXT   0x8CA6\r\n#define GL_READ_FRAMEBUFFER_BINDING_EXT   0x8CAA\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_multisample\r\n#define GL_RENDERBUFFER_SAMPLES_EXT       0x8CAB\r\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56\r\n#define GL_MAX_SAMPLES_EXT                0x8D57\r\n#endif\r\n\r\n#ifndef GL_MESAX_texture_stack\r\n#define GL_TEXTURE_1D_STACK_MESAX         0x8759\r\n#define GL_TEXTURE_2D_STACK_MESAX         0x875A\r\n#define GL_PROXY_TEXTURE_1D_STACK_MESAX   0x875B\r\n#define GL_PROXY_TEXTURE_2D_STACK_MESAX   0x875C\r\n#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D\r\n#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E\r\n#endif\r\n\r\n#ifndef GL_EXT_timer_query\r\n#define GL_TIME_ELAPSED_EXT               0x88BF\r\n#endif\r\n\r\n#ifndef GL_EXT_gpu_program_parameters\r\n#endif\r\n\r\n#ifndef GL_APPLE_flush_buffer_range\r\n#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12\r\n#define GL_BUFFER_FLUSHING_UNMAP_APPLE    0x8A13\r\n#endif\r\n\r\n#ifndef GL_NV_gpu_program4\r\n#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV    0x8904\r\n#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV    0x8905\r\n#define GL_PROGRAM_ATTRIB_COMPONENTS_NV   0x8906\r\n#define GL_PROGRAM_RESULT_COMPONENTS_NV   0x8907\r\n#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908\r\n#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909\r\n#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5\r\n#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6\r\n#endif\r\n\r\n#ifndef GL_NV_geometry_program4\r\n#define GL_LINES_ADJACENCY_EXT            0x000A\r\n#define GL_LINE_STRIP_ADJACENCY_EXT       0x000B\r\n#define GL_TRIANGLES_ADJACENCY_EXT        0x000C\r\n#define GL_TRIANGLE_STRIP_ADJACENCY_EXT   0x000D\r\n#define GL_GEOMETRY_PROGRAM_NV            0x8C26\r\n#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27\r\n#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28\r\n#define GL_GEOMETRY_VERTICES_OUT_EXT      0x8DDA\r\n#define GL_GEOMETRY_INPUT_TYPE_EXT        0x8DDB\r\n#define GL_GEOMETRY_OUTPUT_TYPE_EXT       0x8DDC\r\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29\r\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8\r\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9\r\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4\r\n#define GL_PROGRAM_POINT_SIZE_EXT         0x8642\r\n#endif\r\n\r\n#ifndef GL_EXT_geometry_shader4\r\n#define GL_GEOMETRY_SHADER_EXT            0x8DD9\r\n/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */\r\n/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */\r\n/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */\r\n/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */\r\n#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD\r\n#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE\r\n#define GL_MAX_VARYING_COMPONENTS_EXT     0x8B4B\r\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF\r\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0\r\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1\r\n/* reuse GL_LINES_ADJACENCY_EXT */\r\n/* reuse GL_LINE_STRIP_ADJACENCY_EXT */\r\n/* reuse GL_TRIANGLES_ADJACENCY_EXT */\r\n/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */\r\n/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */\r\n/* reuse GL_PROGRAM_POINT_SIZE_EXT */\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program4\r\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD\r\n#endif\r\n\r\n#ifndef GL_EXT_gpu_shader4\r\n#define GL_SAMPLER_1D_ARRAY_EXT           0x8DC0\r\n#define GL_SAMPLER_2D_ARRAY_EXT           0x8DC1\r\n#define GL_SAMPLER_BUFFER_EXT             0x8DC2\r\n#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT    0x8DC3\r\n#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT    0x8DC4\r\n#define GL_SAMPLER_CUBE_SHADOW_EXT        0x8DC5\r\n#define GL_UNSIGNED_INT_VEC2_EXT          0x8DC6\r\n#define GL_UNSIGNED_INT_VEC3_EXT          0x8DC7\r\n#define GL_UNSIGNED_INT_VEC4_EXT          0x8DC8\r\n#define GL_INT_SAMPLER_1D_EXT             0x8DC9\r\n#define GL_INT_SAMPLER_2D_EXT             0x8DCA\r\n#define GL_INT_SAMPLER_3D_EXT             0x8DCB\r\n#define GL_INT_SAMPLER_CUBE_EXT           0x8DCC\r\n#define GL_INT_SAMPLER_2D_RECT_EXT        0x8DCD\r\n#define GL_INT_SAMPLER_1D_ARRAY_EXT       0x8DCE\r\n#define GL_INT_SAMPLER_2D_ARRAY_EXT       0x8DCF\r\n#define GL_INT_SAMPLER_BUFFER_EXT         0x8DD0\r\n#define GL_UNSIGNED_INT_SAMPLER_1D_EXT    0x8DD1\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_EXT    0x8DD2\r\n#define GL_UNSIGNED_INT_SAMPLER_3D_EXT    0x8DD3\r\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT  0x8DD4\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5\r\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6\r\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7\r\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8\r\n#endif\r\n\r\n#ifndef GL_EXT_draw_instanced\r\n#endif\r\n\r\n#ifndef GL_EXT_packed_float\r\n#define GL_R11F_G11F_B10F_EXT             0x8C3A\r\n#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B\r\n#define GL_RGBA_SIGNED_COMPONENTS_EXT     0x8C3C\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_array\r\n#define GL_TEXTURE_1D_ARRAY_EXT           0x8C18\r\n#define GL_PROXY_TEXTURE_1D_ARRAY_EXT     0x8C19\r\n#define GL_TEXTURE_2D_ARRAY_EXT           0x8C1A\r\n#define GL_PROXY_TEXTURE_2D_ARRAY_EXT     0x8C1B\r\n#define GL_TEXTURE_BINDING_1D_ARRAY_EXT   0x8C1C\r\n#define GL_TEXTURE_BINDING_2D_ARRAY_EXT   0x8C1D\r\n#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT   0x88FF\r\n#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E\r\n/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_buffer_object\r\n#define GL_TEXTURE_BUFFER_EXT             0x8C2A\r\n#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT    0x8C2B\r\n#define GL_TEXTURE_BINDING_BUFFER_EXT     0x8C2C\r\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D\r\n#define GL_TEXTURE_BUFFER_FORMAT_EXT      0x8C2E\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_compression_latc\r\n#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70\r\n#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71\r\n#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72\r\n#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_compression_rgtc\r\n#define GL_COMPRESSED_RED_RGTC1_EXT       0x8DBB\r\n#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC\r\n#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD\r\n#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_shared_exponent\r\n#define GL_RGB9_E5_EXT                    0x8C3D\r\n#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT   0x8C3E\r\n#define GL_TEXTURE_SHARED_SIZE_EXT        0x8C3F\r\n#endif\r\n\r\n#ifndef GL_NV_depth_buffer_float\r\n#define GL_DEPTH_COMPONENT32F_NV          0x8DAB\r\n#define GL_DEPTH32F_STENCIL8_NV           0x8DAC\r\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD\r\n#define GL_DEPTH_BUFFER_FLOAT_MODE_NV     0x8DAF\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program4\r\n#endif\r\n\r\n#ifndef GL_NV_framebuffer_multisample_coverage\r\n#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB\r\n#define GL_RENDERBUFFER_COLOR_SAMPLES_NV  0x8E10\r\n#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11\r\n#define GL_MULTISAMPLE_COVERAGE_MODES_NV  0x8E12\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_sRGB\r\n#define GL_FRAMEBUFFER_SRGB_EXT           0x8DB9\r\n#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT   0x8DBA\r\n#endif\r\n\r\n#ifndef GL_NV_geometry_shader4\r\n#endif\r\n\r\n#ifndef GL_NV_parameter_buffer_object\r\n#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0\r\n#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1\r\n#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2\r\n#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3\r\n#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4\r\n#endif\r\n\r\n#ifndef GL_EXT_draw_buffers2\r\n#endif\r\n\r\n#ifndef GL_NV_transform_feedback\r\n#define GL_BACK_PRIMARY_COLOR_NV          0x8C77\r\n#define GL_BACK_SECONDARY_COLOR_NV        0x8C78\r\n#define GL_TEXTURE_COORD_NV               0x8C79\r\n#define GL_CLIP_DISTANCE_NV               0x8C7A\r\n#define GL_VERTEX_ID_NV                   0x8C7B\r\n#define GL_PRIMITIVE_ID_NV                0x8C7C\r\n#define GL_GENERIC_ATTRIB_NV              0x8C7D\r\n#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV  0x8C7E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80\r\n#define GL_ACTIVE_VARYINGS_NV             0x8C81\r\n#define GL_ACTIVE_VARYING_MAX_LENGTH_NV   0x8C82\r\n#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85\r\n#define GL_TRANSFORM_FEEDBACK_RECORD_NV   0x8C86\r\n#define GL_PRIMITIVES_GENERATED_NV        0x8C87\r\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88\r\n#define GL_RASTERIZER_DISCARD_NV          0x8C89\r\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B\r\n#define GL_INTERLEAVED_ATTRIBS_NV         0x8C8C\r\n#define GL_SEPARATE_ATTRIBS_NV            0x8C8D\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_NV   0x8C8E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F\r\n#define GL_LAYER_NV                       0x8DAA\r\n#define GL_NEXT_BUFFER_NV                 -2\r\n#define GL_SKIP_COMPONENTS4_NV            -3\r\n#define GL_SKIP_COMPONENTS3_NV            -4\r\n#define GL_SKIP_COMPONENTS2_NV            -5\r\n#define GL_SKIP_COMPONENTS1_NV            -6\r\n#endif\r\n\r\n#ifndef GL_EXT_bindable_uniform\r\n#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2\r\n#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3\r\n#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4\r\n#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT  0x8DED\r\n#define GL_UNIFORM_BUFFER_EXT             0x8DEE\r\n#define GL_UNIFORM_BUFFER_BINDING_EXT     0x8DEF\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_integer\r\n#define GL_RGBA32UI_EXT                   0x8D70\r\n#define GL_RGB32UI_EXT                    0x8D71\r\n#define GL_ALPHA32UI_EXT                  0x8D72\r\n#define GL_INTENSITY32UI_EXT              0x8D73\r\n#define GL_LUMINANCE32UI_EXT              0x8D74\r\n#define GL_LUMINANCE_ALPHA32UI_EXT        0x8D75\r\n#define GL_RGBA16UI_EXT                   0x8D76\r\n#define GL_RGB16UI_EXT                    0x8D77\r\n#define GL_ALPHA16UI_EXT                  0x8D78\r\n#define GL_INTENSITY16UI_EXT              0x8D79\r\n#define GL_LUMINANCE16UI_EXT              0x8D7A\r\n#define GL_LUMINANCE_ALPHA16UI_EXT        0x8D7B\r\n#define GL_RGBA8UI_EXT                    0x8D7C\r\n#define GL_RGB8UI_EXT                     0x8D7D\r\n#define GL_ALPHA8UI_EXT                   0x8D7E\r\n#define GL_INTENSITY8UI_EXT               0x8D7F\r\n#define GL_LUMINANCE8UI_EXT               0x8D80\r\n#define GL_LUMINANCE_ALPHA8UI_EXT         0x8D81\r\n#define GL_RGBA32I_EXT                    0x8D82\r\n#define GL_RGB32I_EXT                     0x8D83\r\n#define GL_ALPHA32I_EXT                   0x8D84\r\n#define GL_INTENSITY32I_EXT               0x8D85\r\n#define GL_LUMINANCE32I_EXT               0x8D86\r\n#define GL_LUMINANCE_ALPHA32I_EXT         0x8D87\r\n#define GL_RGBA16I_EXT                    0x8D88\r\n#define GL_RGB16I_EXT                     0x8D89\r\n#define GL_ALPHA16I_EXT                   0x8D8A\r\n#define GL_INTENSITY16I_EXT               0x8D8B\r\n#define GL_LUMINANCE16I_EXT               0x8D8C\r\n#define GL_LUMINANCE_ALPHA16I_EXT         0x8D8D\r\n#define GL_RGBA8I_EXT                     0x8D8E\r\n#define GL_RGB8I_EXT                      0x8D8F\r\n#define GL_ALPHA8I_EXT                    0x8D90\r\n#define GL_INTENSITY8I_EXT                0x8D91\r\n#define GL_LUMINANCE8I_EXT                0x8D92\r\n#define GL_LUMINANCE_ALPHA8I_EXT          0x8D93\r\n#define GL_RED_INTEGER_EXT                0x8D94\r\n#define GL_GREEN_INTEGER_EXT              0x8D95\r\n#define GL_BLUE_INTEGER_EXT               0x8D96\r\n#define GL_ALPHA_INTEGER_EXT              0x8D97\r\n#define GL_RGB_INTEGER_EXT                0x8D98\r\n#define GL_RGBA_INTEGER_EXT               0x8D99\r\n#define GL_BGR_INTEGER_EXT                0x8D9A\r\n#define GL_BGRA_INTEGER_EXT               0x8D9B\r\n#define GL_LUMINANCE_INTEGER_EXT          0x8D9C\r\n#define GL_LUMINANCE_ALPHA_INTEGER_EXT    0x8D9D\r\n#define GL_RGBA_INTEGER_MODE_EXT          0x8D9E\r\n#endif\r\n\r\n#ifndef GL_GREMEDY_frame_terminator\r\n#endif\r\n\r\n#ifndef GL_NV_conditional_render\r\n#define GL_QUERY_WAIT_NV                  0x8E13\r\n#define GL_QUERY_NO_WAIT_NV               0x8E14\r\n#define GL_QUERY_BY_REGION_WAIT_NV        0x8E15\r\n#define GL_QUERY_BY_REGION_NO_WAIT_NV     0x8E16\r\n#endif\r\n\r\n#ifndef GL_NV_present_video\r\n#define GL_FRAME_NV                       0x8E26\r\n#define GL_FIELDS_NV                      0x8E27\r\n#define GL_CURRENT_TIME_NV                0x8E28\r\n#define GL_NUM_FILL_STREAMS_NV            0x8E29\r\n#define GL_PRESENT_TIME_NV                0x8E2A\r\n#define GL_PRESENT_DURATION_NV            0x8E2B\r\n#endif\r\n\r\n#ifndef GL_EXT_transform_feedback\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT  0x8C8E\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F\r\n#define GL_INTERLEAVED_ATTRIBS_EXT        0x8C8C\r\n#define GL_SEPARATE_ATTRIBS_EXT           0x8C8D\r\n#define GL_PRIMITIVES_GENERATED_EXT       0x8C87\r\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88\r\n#define GL_RASTERIZER_DISCARD_EXT         0x8C89\r\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B\r\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80\r\n#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F\r\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76\r\n#endif\r\n\r\n#ifndef GL_EXT_direct_state_access\r\n#define GL_PROGRAM_MATRIX_EXT             0x8E2D\r\n#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT   0x8E2E\r\n#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_array_bgra\r\n/* reuse GL_BGRA */\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_swizzle\r\n#define GL_TEXTURE_SWIZZLE_R_EXT          0x8E42\r\n#define GL_TEXTURE_SWIZZLE_G_EXT          0x8E43\r\n#define GL_TEXTURE_SWIZZLE_B_EXT          0x8E44\r\n#define GL_TEXTURE_SWIZZLE_A_EXT          0x8E45\r\n#define GL_TEXTURE_SWIZZLE_RGBA_EXT       0x8E46\r\n#endif\r\n\r\n#ifndef GL_NV_explicit_multisample\r\n#define GL_SAMPLE_POSITION_NV             0x8E50\r\n#define GL_SAMPLE_MASK_NV                 0x8E51\r\n#define GL_SAMPLE_MASK_VALUE_NV           0x8E52\r\n#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53\r\n#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54\r\n#define GL_TEXTURE_RENDERBUFFER_NV        0x8E55\r\n#define GL_SAMPLER_RENDERBUFFER_NV        0x8E56\r\n#define GL_INT_SAMPLER_RENDERBUFFER_NV    0x8E57\r\n#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58\r\n#define GL_MAX_SAMPLE_MASK_WORDS_NV       0x8E59\r\n#endif\r\n\r\n#ifndef GL_NV_transform_feedback2\r\n#define GL_TRANSFORM_FEEDBACK_NV          0x8E22\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23\r\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24\r\n#define GL_TRANSFORM_FEEDBACK_BINDING_NV  0x8E25\r\n#endif\r\n\r\n#ifndef GL_ATI_meminfo\r\n#define GL_VBO_FREE_MEMORY_ATI            0x87FB\r\n#define GL_TEXTURE_FREE_MEMORY_ATI        0x87FC\r\n#define GL_RENDERBUFFER_FREE_MEMORY_ATI   0x87FD\r\n#endif\r\n\r\n#ifndef GL_AMD_performance_monitor\r\n#define GL_COUNTER_TYPE_AMD               0x8BC0\r\n#define GL_COUNTER_RANGE_AMD              0x8BC1\r\n#define GL_UNSIGNED_INT64_AMD             0x8BC2\r\n#define GL_PERCENTAGE_AMD                 0x8BC3\r\n#define GL_PERFMON_RESULT_AVAILABLE_AMD   0x8BC4\r\n#define GL_PERFMON_RESULT_SIZE_AMD        0x8BC5\r\n#define GL_PERFMON_RESULT_AMD             0x8BC6\r\n#endif\r\n\r\n#ifndef GL_AMD_texture_texture4\r\n#endif\r\n\r\n#ifndef GL_AMD_vertex_shader_tessellator\r\n#define GL_SAMPLER_BUFFER_AMD             0x9001\r\n#define GL_INT_SAMPLER_BUFFER_AMD         0x9002\r\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003\r\n#define GL_TESSELLATION_MODE_AMD          0x9004\r\n#define GL_TESSELLATION_FACTOR_AMD        0x9005\r\n#define GL_DISCRETE_AMD                   0x9006\r\n#define GL_CONTINUOUS_AMD                 0x9007\r\n#endif\r\n\r\n#ifndef GL_EXT_provoking_vertex\r\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C\r\n#define GL_FIRST_VERTEX_CONVENTION_EXT    0x8E4D\r\n#define GL_LAST_VERTEX_CONVENTION_EXT     0x8E4E\r\n#define GL_PROVOKING_VERTEX_EXT           0x8E4F\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_snorm\r\n#define GL_ALPHA_SNORM                    0x9010\r\n#define GL_LUMINANCE_SNORM                0x9011\r\n#define GL_LUMINANCE_ALPHA_SNORM          0x9012\r\n#define GL_INTENSITY_SNORM                0x9013\r\n#define GL_ALPHA8_SNORM                   0x9014\r\n#define GL_LUMINANCE8_SNORM               0x9015\r\n#define GL_LUMINANCE8_ALPHA8_SNORM        0x9016\r\n#define GL_INTENSITY8_SNORM               0x9017\r\n#define GL_ALPHA16_SNORM                  0x9018\r\n#define GL_LUMINANCE16_SNORM              0x9019\r\n#define GL_LUMINANCE16_ALPHA16_SNORM      0x901A\r\n#define GL_INTENSITY16_SNORM              0x901B\r\n/* reuse GL_RED_SNORM */\r\n/* reuse GL_RG_SNORM */\r\n/* reuse GL_RGB_SNORM */\r\n/* reuse GL_RGBA_SNORM */\r\n/* reuse GL_R8_SNORM */\r\n/* reuse GL_RG8_SNORM */\r\n/* reuse GL_RGB8_SNORM */\r\n/* reuse GL_RGBA8_SNORM */\r\n/* reuse GL_R16_SNORM */\r\n/* reuse GL_RG16_SNORM */\r\n/* reuse GL_RGB16_SNORM */\r\n/* reuse GL_RGBA16_SNORM */\r\n/* reuse GL_SIGNED_NORMALIZED */\r\n#endif\r\n\r\n#ifndef GL_AMD_draw_buffers_blend\r\n#endif\r\n\r\n#ifndef GL_APPLE_texture_range\r\n#define GL_TEXTURE_RANGE_LENGTH_APPLE     0x85B7\r\n#define GL_TEXTURE_RANGE_POINTER_APPLE    0x85B8\r\n#define GL_TEXTURE_STORAGE_HINT_APPLE     0x85BC\r\n#define GL_STORAGE_PRIVATE_APPLE          0x85BD\r\n/* reuse GL_STORAGE_CACHED_APPLE */\r\n/* reuse GL_STORAGE_SHARED_APPLE */\r\n#endif\r\n\r\n#ifndef GL_APPLE_float_pixels\r\n#define GL_HALF_APPLE                     0x140B\r\n#define GL_RGBA_FLOAT32_APPLE             0x8814\r\n#define GL_RGB_FLOAT32_APPLE              0x8815\r\n#define GL_ALPHA_FLOAT32_APPLE            0x8816\r\n#define GL_INTENSITY_FLOAT32_APPLE        0x8817\r\n#define GL_LUMINANCE_FLOAT32_APPLE        0x8818\r\n#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE  0x8819\r\n#define GL_RGBA_FLOAT16_APPLE             0x881A\r\n#define GL_RGB_FLOAT16_APPLE              0x881B\r\n#define GL_ALPHA_FLOAT16_APPLE            0x881C\r\n#define GL_INTENSITY_FLOAT16_APPLE        0x881D\r\n#define GL_LUMINANCE_FLOAT16_APPLE        0x881E\r\n#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE  0x881F\r\n#define GL_COLOR_FLOAT_APPLE              0x8A0F\r\n#endif\r\n\r\n#ifndef GL_APPLE_vertex_program_evaluators\r\n#define GL_VERTEX_ATTRIB_MAP1_APPLE       0x8A00\r\n#define GL_VERTEX_ATTRIB_MAP2_APPLE       0x8A01\r\n#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE  0x8A02\r\n#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03\r\n#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04\r\n#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05\r\n#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE  0x8A06\r\n#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07\r\n#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08\r\n#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09\r\n#endif\r\n\r\n#ifndef GL_APPLE_aux_depth_stencil\r\n#define GL_AUX_DEPTH_STENCIL_APPLE        0x8A14\r\n#endif\r\n\r\n#ifndef GL_APPLE_object_purgeable\r\n#define GL_BUFFER_OBJECT_APPLE            0x85B3\r\n#define GL_RELEASED_APPLE                 0x8A19\r\n#define GL_VOLATILE_APPLE                 0x8A1A\r\n#define GL_RETAINED_APPLE                 0x8A1B\r\n#define GL_UNDEFINED_APPLE                0x8A1C\r\n#define GL_PURGEABLE_APPLE                0x8A1D\r\n#endif\r\n\r\n#ifndef GL_APPLE_row_bytes\r\n#define GL_PACK_ROW_BYTES_APPLE           0x8A15\r\n#define GL_UNPACK_ROW_BYTES_APPLE         0x8A16\r\n#endif\r\n\r\n#ifndef GL_APPLE_rgb_422\r\n#define GL_RGB_422_APPLE                  0x8A1F\r\n/* reuse GL_UNSIGNED_SHORT_8_8_APPLE */\r\n/* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */\r\n#endif\r\n\r\n#ifndef GL_NV_video_capture\r\n#define GL_VIDEO_BUFFER_NV                0x9020\r\n#define GL_VIDEO_BUFFER_BINDING_NV        0x9021\r\n#define GL_FIELD_UPPER_NV                 0x9022\r\n#define GL_FIELD_LOWER_NV                 0x9023\r\n#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV   0x9024\r\n#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025\r\n#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026\r\n#define GL_LAST_VIDEO_CAPTURE_STATUS_NV   0x9027\r\n#define GL_VIDEO_BUFFER_PITCH_NV          0x9028\r\n#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029\r\n#define GL_VIDEO_COLOR_CONVERSION_MAX_NV  0x902A\r\n#define GL_VIDEO_COLOR_CONVERSION_MIN_NV  0x902B\r\n#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C\r\n#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D\r\n#define GL_PARTIAL_SUCCESS_NV             0x902E\r\n#define GL_SUCCESS_NV                     0x902F\r\n#define GL_FAILURE_NV                     0x9030\r\n#define GL_YCBYCR8_422_NV                 0x9031\r\n#define GL_YCBAYCR8A_4224_NV              0x9032\r\n#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV  0x9033\r\n#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034\r\n#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV  0x9035\r\n#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036\r\n#define GL_Z4Y12Z4CB12Z4CR12_444_NV       0x9037\r\n#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV   0x9038\r\n#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV  0x9039\r\n#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A\r\n#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B\r\n#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C\r\n#endif\r\n\r\n#ifndef GL_NV_copy_image\r\n#endif\r\n\r\n#ifndef GL_EXT_separate_shader_objects\r\n#define GL_ACTIVE_PROGRAM_EXT             0x8B8D\r\n#endif\r\n\r\n#ifndef GL_NV_parameter_buffer_object2\r\n#endif\r\n\r\n#ifndef GL_NV_shader_buffer_load\r\n#define GL_BUFFER_GPU_ADDRESS_NV          0x8F1D\r\n#define GL_GPU_ADDRESS_NV                 0x8F34\r\n#define GL_MAX_SHADER_BUFFER_ADDRESS_NV   0x8F35\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_buffer_unified_memory\r\n#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E\r\n#define GL_ELEMENT_ARRAY_UNIFIED_NV       0x8F1F\r\n#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20\r\n#define GL_VERTEX_ARRAY_ADDRESS_NV        0x8F21\r\n#define GL_NORMAL_ARRAY_ADDRESS_NV        0x8F22\r\n#define GL_COLOR_ARRAY_ADDRESS_NV         0x8F23\r\n#define GL_INDEX_ARRAY_ADDRESS_NV         0x8F24\r\n#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25\r\n#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV     0x8F26\r\n#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27\r\n#define GL_FOG_COORD_ARRAY_ADDRESS_NV     0x8F28\r\n#define GL_ELEMENT_ARRAY_ADDRESS_NV       0x8F29\r\n#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV  0x8F2A\r\n#define GL_VERTEX_ARRAY_LENGTH_NV         0x8F2B\r\n#define GL_NORMAL_ARRAY_LENGTH_NV         0x8F2C\r\n#define GL_COLOR_ARRAY_LENGTH_NV          0x8F2D\r\n#define GL_INDEX_ARRAY_LENGTH_NV          0x8F2E\r\n#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV  0x8F2F\r\n#define GL_EDGE_FLAG_ARRAY_LENGTH_NV      0x8F30\r\n#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31\r\n#define GL_FOG_COORD_ARRAY_LENGTH_NV      0x8F32\r\n#define GL_ELEMENT_ARRAY_LENGTH_NV        0x8F33\r\n#define GL_DRAW_INDIRECT_UNIFIED_NV       0x8F40\r\n#define GL_DRAW_INDIRECT_ADDRESS_NV       0x8F41\r\n#define GL_DRAW_INDIRECT_LENGTH_NV        0x8F42\r\n#endif\r\n\r\n#ifndef GL_NV_texture_barrier\r\n#endif\r\n\r\n#ifndef GL_AMD_shader_stencil_export\r\n#endif\r\n\r\n#ifndef GL_AMD_seamless_cubemap_per_texture\r\n/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */\r\n#endif\r\n\r\n#ifndef GL_AMD_conservative_depth\r\n#endif\r\n\r\n#ifndef GL_EXT_shader_image_load_store\r\n#define GL_MAX_IMAGE_UNITS_EXT            0x8F38\r\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39\r\n#define GL_IMAGE_BINDING_NAME_EXT         0x8F3A\r\n#define GL_IMAGE_BINDING_LEVEL_EXT        0x8F3B\r\n#define GL_IMAGE_BINDING_LAYERED_EXT      0x8F3C\r\n#define GL_IMAGE_BINDING_LAYER_EXT        0x8F3D\r\n#define GL_IMAGE_BINDING_ACCESS_EXT       0x8F3E\r\n#define GL_IMAGE_1D_EXT                   0x904C\r\n#define GL_IMAGE_2D_EXT                   0x904D\r\n#define GL_IMAGE_3D_EXT                   0x904E\r\n#define GL_IMAGE_2D_RECT_EXT              0x904F\r\n#define GL_IMAGE_CUBE_EXT                 0x9050\r\n#define GL_IMAGE_BUFFER_EXT               0x9051\r\n#define GL_IMAGE_1D_ARRAY_EXT             0x9052\r\n#define GL_IMAGE_2D_ARRAY_EXT             0x9053\r\n#define GL_IMAGE_CUBE_MAP_ARRAY_EXT       0x9054\r\n#define GL_IMAGE_2D_MULTISAMPLE_EXT       0x9055\r\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056\r\n#define GL_INT_IMAGE_1D_EXT               0x9057\r\n#define GL_INT_IMAGE_2D_EXT               0x9058\r\n#define GL_INT_IMAGE_3D_EXT               0x9059\r\n#define GL_INT_IMAGE_2D_RECT_EXT          0x905A\r\n#define GL_INT_IMAGE_CUBE_EXT             0x905B\r\n#define GL_INT_IMAGE_BUFFER_EXT           0x905C\r\n#define GL_INT_IMAGE_1D_ARRAY_EXT         0x905D\r\n#define GL_INT_IMAGE_2D_ARRAY_EXT         0x905E\r\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT   0x905F\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT   0x9060\r\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061\r\n#define GL_UNSIGNED_INT_IMAGE_1D_EXT      0x9062\r\n#define GL_UNSIGNED_INT_IMAGE_2D_EXT      0x9063\r\n#define GL_UNSIGNED_INT_IMAGE_3D_EXT      0x9064\r\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT    0x9066\r\n#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT  0x9067\r\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068\r\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069\r\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B\r\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C\r\n#define GL_MAX_IMAGE_SAMPLES_EXT          0x906D\r\n#define GL_IMAGE_BINDING_FORMAT_EXT       0x906E\r\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001\r\n#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT  0x00000002\r\n#define GL_UNIFORM_BARRIER_BIT_EXT        0x00000004\r\n#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT  0x00000008\r\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020\r\n#define GL_COMMAND_BARRIER_BIT_EXT        0x00000040\r\n#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT   0x00000080\r\n#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100\r\n#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT  0x00000200\r\n#define GL_FRAMEBUFFER_BARRIER_BIT_EXT    0x00000400\r\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800\r\n#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000\r\n#define GL_ALL_BARRIER_BITS_EXT           0xFFFFFFFF\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_attrib_64bit\r\n/* reuse GL_DOUBLE */\r\n#define GL_DOUBLE_VEC2_EXT                0x8FFC\r\n#define GL_DOUBLE_VEC3_EXT                0x8FFD\r\n#define GL_DOUBLE_VEC4_EXT                0x8FFE\r\n#define GL_DOUBLE_MAT2_EXT                0x8F46\r\n#define GL_DOUBLE_MAT3_EXT                0x8F47\r\n#define GL_DOUBLE_MAT4_EXT                0x8F48\r\n#define GL_DOUBLE_MAT2x3_EXT              0x8F49\r\n#define GL_DOUBLE_MAT2x4_EXT              0x8F4A\r\n#define GL_DOUBLE_MAT3x2_EXT              0x8F4B\r\n#define GL_DOUBLE_MAT3x4_EXT              0x8F4C\r\n#define GL_DOUBLE_MAT4x2_EXT              0x8F4D\r\n#define GL_DOUBLE_MAT4x3_EXT              0x8F4E\r\n#endif\r\n\r\n#ifndef GL_NV_gpu_program5\r\n#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A\r\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B\r\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C\r\n#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D\r\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E\r\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F\r\n#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44\r\n#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV  0x8F45\r\n#endif\r\n\r\n#ifndef GL_NV_gpu_shader5\r\n#define GL_INT64_NV                       0x140E\r\n#define GL_UNSIGNED_INT64_NV              0x140F\r\n#define GL_INT8_NV                        0x8FE0\r\n#define GL_INT8_VEC2_NV                   0x8FE1\r\n#define GL_INT8_VEC3_NV                   0x8FE2\r\n#define GL_INT8_VEC4_NV                   0x8FE3\r\n#define GL_INT16_NV                       0x8FE4\r\n#define GL_INT16_VEC2_NV                  0x8FE5\r\n#define GL_INT16_VEC3_NV                  0x8FE6\r\n#define GL_INT16_VEC4_NV                  0x8FE7\r\n#define GL_INT64_VEC2_NV                  0x8FE9\r\n#define GL_INT64_VEC3_NV                  0x8FEA\r\n#define GL_INT64_VEC4_NV                  0x8FEB\r\n#define GL_UNSIGNED_INT8_NV               0x8FEC\r\n#define GL_UNSIGNED_INT8_VEC2_NV          0x8FED\r\n#define GL_UNSIGNED_INT8_VEC3_NV          0x8FEE\r\n#define GL_UNSIGNED_INT8_VEC4_NV          0x8FEF\r\n#define GL_UNSIGNED_INT16_NV              0x8FF0\r\n#define GL_UNSIGNED_INT16_VEC2_NV         0x8FF1\r\n#define GL_UNSIGNED_INT16_VEC3_NV         0x8FF2\r\n#define GL_UNSIGNED_INT16_VEC4_NV         0x8FF3\r\n#define GL_UNSIGNED_INT64_VEC2_NV         0x8FF5\r\n#define GL_UNSIGNED_INT64_VEC3_NV         0x8FF6\r\n#define GL_UNSIGNED_INT64_VEC4_NV         0x8FF7\r\n#define GL_FLOAT16_NV                     0x8FF8\r\n#define GL_FLOAT16_VEC2_NV                0x8FF9\r\n#define GL_FLOAT16_VEC3_NV                0x8FFA\r\n#define GL_FLOAT16_VEC4_NV                0x8FFB\r\n/* reuse GL_PATCHES */\r\n#endif\r\n\r\n#ifndef GL_NV_shader_buffer_store\r\n#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010\r\n/* reuse GL_READ_WRITE */\r\n/* reuse GL_WRITE_ONLY */\r\n#endif\r\n\r\n#ifndef GL_NV_tessellation_program5\r\n#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV   0x86D8\r\n#define GL_TESS_CONTROL_PROGRAM_NV        0x891E\r\n#define GL_TESS_EVALUATION_PROGRAM_NV     0x891F\r\n#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74\r\n#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_attrib_integer_64bit\r\n/* reuse GL_INT64_NV */\r\n/* reuse GL_UNSIGNED_INT64_NV */\r\n#endif\r\n\r\n#ifndef GL_NV_multisample_coverage\r\n#define GL_COLOR_SAMPLES_NV               0x8E20\r\n/* reuse GL_SAMPLES_ARB */\r\n#endif\r\n\r\n#ifndef GL_AMD_name_gen_delete\r\n#define GL_DATA_BUFFER_AMD                0x9151\r\n#define GL_PERFORMANCE_MONITOR_AMD        0x9152\r\n#define GL_QUERY_OBJECT_AMD               0x9153\r\n#define GL_VERTEX_ARRAY_OBJECT_AMD        0x9154\r\n#define GL_SAMPLER_OBJECT_AMD             0x9155\r\n#endif\r\n\r\n#ifndef GL_AMD_debug_output\r\n#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD   0x9143\r\n#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD  0x9144\r\n#define GL_DEBUG_LOGGED_MESSAGES_AMD      0x9145\r\n#define GL_DEBUG_SEVERITY_HIGH_AMD        0x9146\r\n#define GL_DEBUG_SEVERITY_MEDIUM_AMD      0x9147\r\n#define GL_DEBUG_SEVERITY_LOW_AMD         0x9148\r\n#define GL_DEBUG_CATEGORY_API_ERROR_AMD   0x9149\r\n#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A\r\n#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B\r\n#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C\r\n#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D\r\n#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E\r\n#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F\r\n#define GL_DEBUG_CATEGORY_OTHER_AMD       0x9150\r\n#endif\r\n\r\n#ifndef GL_NV_vdpau_interop\r\n#define GL_SURFACE_STATE_NV               0x86EB\r\n#define GL_SURFACE_REGISTERED_NV          0x86FD\r\n#define GL_SURFACE_MAPPED_NV              0x8700\r\n#define GL_WRITE_DISCARD_NV               0x88BE\r\n#endif\r\n\r\n#ifndef GL_AMD_transform_feedback3_lines_triangles\r\n#endif\r\n\r\n#ifndef GL_AMD_depth_clamp_separate\r\n#define GL_DEPTH_CLAMP_NEAR_AMD           0x901E\r\n#define GL_DEPTH_CLAMP_FAR_AMD            0x901F\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_sRGB_decode\r\n#define GL_TEXTURE_SRGB_DECODE_EXT        0x8A48\r\n#define GL_DECODE_EXT                     0x8A49\r\n#define GL_SKIP_DECODE_EXT                0x8A4A\r\n#endif\r\n\r\n#ifndef GL_NV_texture_multisample\r\n#define GL_TEXTURE_COVERAGE_SAMPLES_NV    0x9045\r\n#define GL_TEXTURE_COLOR_SAMPLES_NV       0x9046\r\n#endif\r\n\r\n#ifndef GL_AMD_blend_minmax_factor\r\n#define GL_FACTOR_MIN_AMD                 0x901C\r\n#define GL_FACTOR_MAX_AMD                 0x901D\r\n#endif\r\n\r\n#ifndef GL_AMD_sample_positions\r\n#define GL_SUBSAMPLE_DISTANCE_AMD         0x883F\r\n#endif\r\n\r\n#ifndef GL_EXT_x11_sync_object\r\n#define GL_SYNC_X11_FENCE_EXT             0x90E1\r\n#endif\r\n\r\n#ifndef GL_AMD_multi_draw_indirect\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_multisample_blit_scaled\r\n#define GL_SCALED_RESOLVE_FASTEST_EXT     0x90BA\r\n#define GL_SCALED_RESOLVE_NICEST_EXT      0x90BB\r\n#endif\r\n\r\n#ifndef GL_NV_path_rendering\r\n#define GL_PATH_FORMAT_SVG_NV             0x9070\r\n#define GL_PATH_FORMAT_PS_NV              0x9071\r\n#define GL_STANDARD_FONT_NAME_NV          0x9072\r\n#define GL_SYSTEM_FONT_NAME_NV            0x9073\r\n#define GL_FILE_NAME_NV                   0x9074\r\n#define GL_PATH_STROKE_WIDTH_NV           0x9075\r\n#define GL_PATH_END_CAPS_NV               0x9076\r\n#define GL_PATH_INITIAL_END_CAP_NV        0x9077\r\n#define GL_PATH_TERMINAL_END_CAP_NV       0x9078\r\n#define GL_PATH_JOIN_STYLE_NV             0x9079\r\n#define GL_PATH_MITER_LIMIT_NV            0x907A\r\n#define GL_PATH_DASH_CAPS_NV              0x907B\r\n#define GL_PATH_INITIAL_DASH_CAP_NV       0x907C\r\n#define GL_PATH_TERMINAL_DASH_CAP_NV      0x907D\r\n#define GL_PATH_DASH_OFFSET_NV            0x907E\r\n#define GL_PATH_CLIENT_LENGTH_NV          0x907F\r\n#define GL_PATH_FILL_MODE_NV              0x9080\r\n#define GL_PATH_FILL_MASK_NV              0x9081\r\n#define GL_PATH_FILL_COVER_MODE_NV        0x9082\r\n#define GL_PATH_STROKE_COVER_MODE_NV      0x9083\r\n#define GL_PATH_STROKE_MASK_NV            0x9084\r\n#define GL_COUNT_UP_NV                    0x9088\r\n#define GL_COUNT_DOWN_NV                  0x9089\r\n#define GL_PATH_OBJECT_BOUNDING_BOX_NV    0x908A\r\n#define GL_CONVEX_HULL_NV                 0x908B\r\n#define GL_BOUNDING_BOX_NV                0x908D\r\n#define GL_TRANSLATE_X_NV                 0x908E\r\n#define GL_TRANSLATE_Y_NV                 0x908F\r\n#define GL_TRANSLATE_2D_NV                0x9090\r\n#define GL_TRANSLATE_3D_NV                0x9091\r\n#define GL_AFFINE_2D_NV                   0x9092\r\n#define GL_AFFINE_3D_NV                   0x9094\r\n#define GL_TRANSPOSE_AFFINE_2D_NV         0x9096\r\n#define GL_TRANSPOSE_AFFINE_3D_NV         0x9098\r\n#define GL_UTF8_NV                        0x909A\r\n#define GL_UTF16_NV                       0x909B\r\n#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C\r\n#define GL_PATH_COMMAND_COUNT_NV          0x909D\r\n#define GL_PATH_COORD_COUNT_NV            0x909E\r\n#define GL_PATH_DASH_ARRAY_COUNT_NV       0x909F\r\n#define GL_PATH_COMPUTED_LENGTH_NV        0x90A0\r\n#define GL_PATH_FILL_BOUNDING_BOX_NV      0x90A1\r\n#define GL_PATH_STROKE_BOUNDING_BOX_NV    0x90A2\r\n#define GL_SQUARE_NV                      0x90A3\r\n#define GL_ROUND_NV                       0x90A4\r\n#define GL_TRIANGULAR_NV                  0x90A5\r\n#define GL_BEVEL_NV                       0x90A6\r\n#define GL_MITER_REVERT_NV                0x90A7\r\n#define GL_MITER_TRUNCATE_NV              0x90A8\r\n#define GL_SKIP_MISSING_GLYPH_NV          0x90A9\r\n#define GL_USE_MISSING_GLYPH_NV           0x90AA\r\n#define GL_PATH_ERROR_POSITION_NV         0x90AB\r\n#define GL_PATH_FOG_GEN_MODE_NV           0x90AC\r\n#define GL_ACCUM_ADJACENT_PAIRS_NV        0x90AD\r\n#define GL_ADJACENT_PAIRS_NV              0x90AE\r\n#define GL_FIRST_TO_REST_NV               0x90AF\r\n#define GL_PATH_GEN_MODE_NV               0x90B0\r\n#define GL_PATH_GEN_COEFF_NV              0x90B1\r\n#define GL_PATH_GEN_COLOR_FORMAT_NV       0x90B2\r\n#define GL_PATH_GEN_COMPONENTS_NV         0x90B3\r\n#define GL_PATH_STENCIL_FUNC_NV           0x90B7\r\n#define GL_PATH_STENCIL_REF_NV            0x90B8\r\n#define GL_PATH_STENCIL_VALUE_MASK_NV     0x90B9\r\n#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD\r\n#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE\r\n#define GL_PATH_COVER_DEPTH_FUNC_NV       0x90BF\r\n#define GL_PATH_DASH_OFFSET_RESET_NV      0x90B4\r\n#define GL_MOVE_TO_RESETS_NV              0x90B5\r\n#define GL_MOVE_TO_CONTINUES_NV           0x90B6\r\n#define GL_CLOSE_PATH_NV                  0x00\r\n#define GL_MOVE_TO_NV                     0x02\r\n#define GL_RELATIVE_MOVE_TO_NV            0x03\r\n#define GL_LINE_TO_NV                     0x04\r\n#define GL_RELATIVE_LINE_TO_NV            0x05\r\n#define GL_HORIZONTAL_LINE_TO_NV          0x06\r\n#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07\r\n#define GL_VERTICAL_LINE_TO_NV            0x08\r\n#define GL_RELATIVE_VERTICAL_LINE_TO_NV   0x09\r\n#define GL_QUADRATIC_CURVE_TO_NV          0x0A\r\n#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B\r\n#define GL_CUBIC_CURVE_TO_NV              0x0C\r\n#define GL_RELATIVE_CUBIC_CURVE_TO_NV     0x0D\r\n#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV   0x0E\r\n#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F\r\n#define GL_SMOOTH_CUBIC_CURVE_TO_NV       0x10\r\n#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11\r\n#define GL_SMALL_CCW_ARC_TO_NV            0x12\r\n#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV   0x13\r\n#define GL_SMALL_CW_ARC_TO_NV             0x14\r\n#define GL_RELATIVE_SMALL_CW_ARC_TO_NV    0x15\r\n#define GL_LARGE_CCW_ARC_TO_NV            0x16\r\n#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV   0x17\r\n#define GL_LARGE_CW_ARC_TO_NV             0x18\r\n#define GL_RELATIVE_LARGE_CW_ARC_TO_NV    0x19\r\n#define GL_RESTART_PATH_NV                0xF0\r\n#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV    0xF2\r\n#define GL_DUP_LAST_CUBIC_CURVE_TO_NV     0xF4\r\n#define GL_RECT_NV                        0xF6\r\n#define GL_CIRCULAR_CCW_ARC_TO_NV         0xF8\r\n#define GL_CIRCULAR_CW_ARC_TO_NV          0xFA\r\n#define GL_CIRCULAR_TANGENT_ARC_TO_NV     0xFC\r\n#define GL_ARC_TO_NV                      0xFE\r\n#define GL_RELATIVE_ARC_TO_NV             0xFF\r\n#define GL_BOLD_BIT_NV                    0x01\r\n#define GL_ITALIC_BIT_NV                  0x02\r\n#define GL_GLYPH_WIDTH_BIT_NV             0x01\r\n#define GL_GLYPH_HEIGHT_BIT_NV            0x02\r\n#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04\r\n#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08\r\n#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10\r\n#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20\r\n#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40\r\n#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80\r\n#define GL_GLYPH_HAS_KERNING_BIT_NV       0x100\r\n#define GL_FONT_X_MIN_BOUNDS_BIT_NV       0x00010000\r\n#define GL_FONT_Y_MIN_BOUNDS_BIT_NV       0x00020000\r\n#define GL_FONT_X_MAX_BOUNDS_BIT_NV       0x00040000\r\n#define GL_FONT_Y_MAX_BOUNDS_BIT_NV       0x00080000\r\n#define GL_FONT_UNITS_PER_EM_BIT_NV       0x00100000\r\n#define GL_FONT_ASCENDER_BIT_NV           0x00200000\r\n#define GL_FONT_DESCENDER_BIT_NV          0x00400000\r\n#define GL_FONT_HEIGHT_BIT_NV             0x00800000\r\n#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV  0x01000000\r\n#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000\r\n#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000\r\n#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000\r\n#define GL_FONT_HAS_KERNING_BIT_NV        0x10000000\r\n/* reuse GL_PRIMARY_COLOR */\r\n/* reuse GL_PRIMARY_COLOR_NV */\r\n/* reuse GL_SECONDARY_COLOR_NV */\r\n#endif\r\n\r\n#ifndef GL_AMD_pinned_memory\r\n#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160\r\n#endif\r\n\r\n#ifndef GL_AMD_stencil_operation_extended\r\n#define GL_SET_AMD                        0x874A\r\n#define GL_REPLACE_VALUE_AMD              0x874B\r\n#define GL_STENCIL_OP_VALUE_AMD           0x874C\r\n#define GL_STENCIL_BACK_OP_VALUE_AMD      0x874D\r\n#endif\r\n\r\n#ifndef GL_AMD_vertex_shader_viewport_index\r\n#endif\r\n\r\n#ifndef GL_AMD_vertex_shader_layer\r\n#endif\r\n\r\n#ifndef GL_NV_bindless_texture\r\n#endif\r\n\r\n#ifndef GL_NV_shader_atomic_float\r\n#endif\r\n\r\n#ifndef GL_AMD_query_buffer_object\r\n#define GL_QUERY_BUFFER_AMD               0x9192\r\n#define GL_QUERY_BUFFER_BINDING_AMD       0x9193\r\n#define GL_QUERY_RESULT_NO_WAIT_AMD       0x9194\r\n#endif\r\n\r\n#ifndef GL_NV_compute_program5\r\n#define GL_COMPUTE_PROGRAM_NV             0x90FB\r\n#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC\r\n#endif\r\n\r\n#ifndef GL_NV_shader_storage_buffer_object\r\n#endif\r\n\r\n#ifndef GL_NV_shader_atomic_counters\r\n#endif\r\n\r\n#ifndef GL_NV_deep_texture3D\r\n#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0\r\n#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV   0x90D1\r\n#endif\r\n\r\n#ifndef GL_NVX_conditional_render\r\n#endif\r\n\r\n#ifndef GL_AMD_sparse_texture\r\n#define GL_VIRTUAL_PAGE_SIZE_X_AMD        0x9195\r\n#define GL_VIRTUAL_PAGE_SIZE_Y_AMD        0x9196\r\n#define GL_VIRTUAL_PAGE_SIZE_Z_AMD        0x9197\r\n#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD    0x9198\r\n#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199\r\n#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A\r\n#define GL_MIN_SPARSE_LEVEL_AMD           0x919B\r\n#define GL_MIN_LOD_WARNING_AMD            0x919C\r\n#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001\r\n#endif\r\n\r\n#ifndef GL_AMD_shader_trinary_minmax\r\n#endif\r\n\r\n#ifndef GL_INTEL_map_texture\r\n#define GL_TEXTURE_MEMORY_LAYOUT_INTEL    0x83FF\r\n#define GL_LAYOUT_DEFAULT_INTEL           0\r\n#define GL_LAYOUT_LINEAR_INTEL            1\r\n#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2\r\n#endif\r\n\r\n#ifndef GL_NV_draw_texture\r\n#endif\r\n\r\n\r\n/*************************************************************/\r\n\r\n#include <stddef.h>\r\n#ifndef GL_VERSION_2_0\r\n/* GL type for program/shader text */\r\ntypedef char GLchar;\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_5\r\n/* GL types for handling large vertex buffer objects */\r\ntypedef ptrdiff_t GLintptr;\r\ntypedef ptrdiff_t GLsizeiptr;\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_buffer_object\r\n/* GL types for handling large vertex buffer objects */\r\ntypedef ptrdiff_t GLintptrARB;\r\ntypedef ptrdiff_t GLsizeiptrARB;\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_objects\r\n/* GL types for program/shader text and shader object handles */\r\ntypedef char GLcharARB;\r\ntypedef unsigned int GLhandleARB;\r\n#endif\r\n\r\n/* GL type for \"half\" precision (s10e5) float data in host memory */\r\n#ifndef GL_ARB_half_float_pixel\r\ntypedef unsigned short GLhalfARB;\r\n#endif\r\n\r\n#ifndef GL_NV_half_float\r\ntypedef unsigned short GLhalfNV;\r\n#endif\r\n\r\n#ifndef GLEXT_64_TYPES_DEFINED\r\n/* This code block is duplicated in glxext.h, so must be protected */\r\n#define GLEXT_64_TYPES_DEFINED\r\n/* Define int32_t, int64_t, and uint64_t types for UST/MSC */\r\n/* (as used in the GL_EXT_timer_query extension). */\r\n#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\r\n#include <inttypes.h>\r\n#elif defined(__sun__) || defined(__digital__)\r\n#include <inttypes.h>\r\n#if defined(__STDC__)\r\n#if defined(__arch64__) || defined(_LP64)\r\ntypedef long int int64_t;\r\ntypedef unsigned long int uint64_t;\r\n#else\r\ntypedef long long int int64_t;\r\ntypedef unsigned long long int uint64_t;\r\n#endif /* __arch64__ */\r\n#endif /* __STDC__ */\r\n#elif defined( __VMS ) || defined(__sgi)\r\n#include <inttypes.h>\r\n#elif defined(__SCO__) || defined(__USLC__)\r\n#include <stdint.h>\r\n#elif defined(__UNIXOS2__) || defined(__SOL64__)\r\ntypedef long int int32_t;\r\ntypedef long long int int64_t;\r\ntypedef unsigned long long int uint64_t;\r\n#elif defined(_WIN32) && defined(__GNUC__)\r\n#include <stdint.h>\r\n#elif defined(_WIN32)\r\ntypedef __int32 int32_t;\r\ntypedef __int64 int64_t;\r\ntypedef unsigned __int64 uint64_t;\r\n#else\r\n/* Fallback if nothing above works */\r\n#include <inttypes.h>\r\n#endif\r\n#endif\r\n\r\n#ifndef GL_EXT_timer_query\r\ntypedef int64_t GLint64EXT;\r\ntypedef uint64_t GLuint64EXT;\r\n#endif\r\n\r\n#ifndef GL_ARB_sync\r\ntypedef int64_t GLint64;\r\ntypedef uint64_t GLuint64;\r\ntypedef struct __GLsync *GLsync;\r\n#endif\r\n\r\n#ifndef GL_ARB_cl_event\r\n/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */\r\nstruct _cl_context;\r\nstruct _cl_event;\r\n#endif\r\n\r\n#ifndef GL_ARB_debug_output\r\ntypedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);\r\n#endif\r\n\r\n#ifndef GL_AMD_debug_output\r\ntypedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);\r\n#endif\r\n\r\n#ifndef GL_KHR_debug\r\ntypedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);\r\n#endif\r\n\r\n#ifndef GL_NV_vdpau_interop\r\ntypedef GLintptr GLvdpauSurfaceNV;\r\n#endif\r\n\r\n#ifndef GL_OES_fixed_point\r\n/* GLint must be 32 bits, a relatively safe assumption on modern CPUs */\r\ntypedef GLint GLfixed;\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_2\r\n#define GL_VERSION_1_2 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\nGLAPI void APIENTRY glBlendEquation (GLenum mode);\r\nGLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\r\nGLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\nGLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table);\r\nGLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);\r\nGLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);\r\nGLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);\r\nGLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params);\r\nGLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params);\r\nGLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image);\r\nGLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);\r\nGLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);\r\nGLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\nGLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\nGLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\r\nGLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink);\r\nGLAPI void APIENTRY glResetHistogram (GLenum target);\r\nGLAPI void APIENTRY glResetMinmax (GLenum target);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);\r\ntypedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\ntypedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);\r\ntypedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\ntypedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\r\ntypedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);\r\ntypedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_3\r\n#define GL_VERSION_1_3 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glActiveTexture (GLenum texture);\r\nGLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);\r\nGLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img);\r\nGLAPI void APIENTRY glClientActiveTexture (GLenum texture);\r\nGLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s);\r\nGLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s);\r\nGLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s);\r\nGLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s);\r\nGLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t);\r\nGLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t);\r\nGLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t);\r\nGLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t);\r\nGLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r);\r\nGLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r);\r\nGLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r);\r\nGLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r);\r\nGLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\nGLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\nGLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q);\r\nGLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\r\nGLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m);\r\nGLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m);\r\nGLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m);\r\nGLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);\r\ntypedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);\r\ntypedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);\r\ntypedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_4\r\n#define GL_VERSION_1_4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\nGLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\r\nGLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);\r\nGLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glFogCoordf (GLfloat coord);\r\nGLAPI void APIENTRY glFogCoordfv (const GLfloat *coord);\r\nGLAPI void APIENTRY glFogCoordd (GLdouble coord);\r\nGLAPI void APIENTRY glFogCoorddv (const GLdouble *coord);\r\nGLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue);\r\nGLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v);\r\nGLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue);\r\nGLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v);\r\nGLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue);\r\nGLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v);\r\nGLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue);\r\nGLAPI void APIENTRY glSecondaryColor3iv (const GLint *v);\r\nGLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue);\r\nGLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v);\r\nGLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue);\r\nGLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v);\r\nGLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue);\r\nGLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v);\r\nGLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue);\r\nGLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v);\r\nGLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glWindowPos2dv (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glWindowPos2fv (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos2i (GLint x, GLint y);\r\nGLAPI void APIENTRY glWindowPos2iv (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y);\r\nGLAPI void APIENTRY glWindowPos2sv (const GLshort *v);\r\nGLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glWindowPos3dv (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glWindowPos3fv (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z);\r\nGLAPI void APIENTRY glWindowPos3iv (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glWindowPos3sv (const GLshort *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v);\r\n#endif\r\n\r\n#ifndef GL_VERSION_1_5\r\n#define GL_VERSION_1_5 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);\r\nGLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);\r\nGLAPI GLboolean APIENTRY glIsQuery (GLuint id);\r\nGLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);\r\nGLAPI void APIENTRY glEndQuery (GLenum target);\r\nGLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);\r\nGLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);\r\nGLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);\r\nGLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);\r\nGLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);\r\nGLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);\r\nGLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);\r\nGLAPI GLvoid* APIENTRY glMapBuffer (GLenum target, GLenum access);\r\nGLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);\r\nGLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);\r\ntypedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);\r\ntypedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);\r\ntypedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);\r\ntypedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);\r\ntypedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);\r\ntypedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);\r\ntypedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params);\r\n#endif\r\n\r\n#ifndef GL_VERSION_2_0\r\n#define GL_VERSION_2_0 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);\r\nGLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);\r\nGLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\r\nGLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);\r\nGLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);\r\nGLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);\r\nGLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);\r\nGLAPI void APIENTRY glCompileShader (GLuint shader);\r\nGLAPI GLuint APIENTRY glCreateProgram (void);\r\nGLAPI GLuint APIENTRY glCreateShader (GLenum type);\r\nGLAPI void APIENTRY glDeleteProgram (GLuint program);\r\nGLAPI void APIENTRY glDeleteShader (GLuint shader);\r\nGLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);\r\nGLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);\r\nGLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);\r\nGLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\r\nGLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\r\nGLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);\r\nGLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);\r\nGLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\r\nGLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\r\nGLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);\r\nGLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);\r\nGLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);\r\nGLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer);\r\nGLAPI GLboolean APIENTRY glIsProgram (GLuint program);\r\nGLAPI GLboolean APIENTRY glIsShader (GLuint shader);\r\nGLAPI void APIENTRY glLinkProgram (GLuint program);\r\nGLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);\r\nGLAPI void APIENTRY glUseProgram (GLuint program);\r\nGLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);\r\nGLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);\r\nGLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\nGLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\nGLAPI void APIENTRY glUniform1i (GLint location, GLint v0);\r\nGLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);\r\nGLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);\r\nGLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\nGLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glValidateProgram (GLuint program);\r\nGLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);\r\nGLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);\r\nGLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);\r\nGLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);\r\nGLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\nGLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);\r\nGLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);\r\nGLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);\r\ntypedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);\r\ntypedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\r\ntypedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);\r\ntypedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);\r\ntypedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);\r\ntypedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);\r\ntypedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);\r\ntypedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);\r\ntypedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);\r\ntypedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);\r\ntypedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);\r\ntypedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);\r\ntypedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);\r\ntypedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\r\ntypedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\r\ntypedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);\r\ntypedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);\r\ntypedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);\r\ntypedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);\r\ntypedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);\r\ntypedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);\r\ntypedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_VERSION_2_1\r\n#define GL_VERSION_2_1 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_0\r\n#define GL_VERSION_3_0 1\r\n/* OpenGL 3.0 also reuses entry points from these extensions: */\r\n/* ARB_framebuffer_object */\r\n/* ARB_map_buffer_range */\r\n/* ARB_vertex_array_object */\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\r\nGLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);\r\nGLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);\r\nGLAPI void APIENTRY glEnablei (GLenum target, GLuint index);\r\nGLAPI void APIENTRY glDisablei (GLenum target, GLuint index);\r\nGLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);\r\nGLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);\r\nGLAPI void APIENTRY glEndTransformFeedback (void);\r\nGLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\nGLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);\r\nGLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);\r\nGLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\nGLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);\r\nGLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);\r\nGLAPI void APIENTRY glEndConditionalRender (void);\r\nGLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);\r\nGLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);\r\nGLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);\r\nGLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);\r\nGLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);\r\nGLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);\r\nGLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\nGLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);\r\nGLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);\r\nGLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);\r\nGLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);\r\nGLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);\r\nGLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);\r\nGLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);\r\nGLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);\r\nGLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\nGLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);\r\nGLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);\r\nGLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);\r\nGLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);\r\nGLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\r\nGLAPI const GLubyte * APIENTRY glGetStringi (GLenum name, GLuint index);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\r\ntypedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);\r\ntypedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);\r\ntypedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);\r\ntypedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);\r\ntypedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);\r\ntypedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);\r\ntypedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);\r\ntypedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);\r\ntypedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);\r\ntypedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\r\ntypedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_1\r\n#define GL_VERSION_3_1 1\r\n/* OpenGL 3.1 also reuses entry points from these extensions: */\r\n/* ARB_copy_buffer */\r\n/* ARB_uniform_buffer_object */\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);\r\nGLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);\r\nGLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);\r\nGLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);\r\ntypedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_2\r\n#define GL_VERSION_3_2 1\r\n/* OpenGL 3.2 also reuses entry points from these extensions: */\r\n/* ARB_draw_elements_base_vertex */\r\n/* ARB_provoking_vertex */\r\n/* ARB_sync */\r\n/* ARB_texture_multisample */\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);\r\nGLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);\r\nGLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\n#endif\r\n\r\n#ifndef GL_VERSION_3_3\r\n#define GL_VERSION_3_3 1\r\n/* OpenGL 3.3 also reuses entry points from these extensions: */\r\n/* ARB_blend_func_extended */\r\n/* ARB_sampler_objects */\r\n/* ARB_explicit_attrib_location, but it has none */\r\n/* ARB_occlusion_query2 (no entry points) */\r\n/* ARB_shader_bit_encoding (no entry points) */\r\n/* ARB_texture_rgb10_a2ui (no entry points) */\r\n/* ARB_texture_swizzle (no entry points) */\r\n/* ARB_timer_query */\r\n/* ARB_vertex_type_2_10_10_10_rev */\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_0\r\n#define GL_VERSION_4_0 1\r\n/* OpenGL 4.0 also reuses entry points from these extensions: */\r\n/* ARB_texture_query_lod (no entry points) */\r\n/* ARB_draw_indirect */\r\n/* ARB_gpu_shader5 (no entry points) */\r\n/* ARB_gpu_shader_fp64 */\r\n/* ARB_shader_subroutine */\r\n/* ARB_tessellation_shader */\r\n/* ARB_texture_buffer_object_rgb32 (no entry points) */\r\n/* ARB_texture_cube_map_array (no entry points) */\r\n/* ARB_texture_gather (no entry points) */\r\n/* ARB_transform_feedback2 */\r\n/* ARB_transform_feedback3 */\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMinSampleShading (GLfloat value);\r\nGLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);\r\nGLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\nGLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);\r\nGLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_1\r\n#define GL_VERSION_4_1 1\r\n/* OpenGL 4.1 reuses entry points from these extensions: */\r\n/* ARB_ES2_compatibility */\r\n/* ARB_get_program_binary */\r\n/* ARB_separate_shader_objects */\r\n/* ARB_shader_precision (no entry points) */\r\n/* ARB_vertex_attrib_64bit */\r\n/* ARB_viewport_array */\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_2\r\n#define GL_VERSION_4_2 1\r\n/* OpenGL 4.2 reuses entry points from these extensions: */\r\n/* ARB_base_instance */\r\n/* ARB_shading_language_420pack (no entry points) */\r\n/* ARB_transform_feedback_instanced */\r\n/* ARB_compressed_texture_pixel_storage (no entry points) */\r\n/* ARB_conservative_depth (no entry points) */\r\n/* ARB_internalformat_query */\r\n/* ARB_map_buffer_alignment (no entry points) */\r\n/* ARB_shader_atomic_counters */\r\n/* ARB_shader_image_load_store */\r\n/* ARB_shading_language_packing (no entry points) */\r\n/* ARB_texture_storage */\r\n#endif\r\n\r\n#ifndef GL_VERSION_4_3\r\n#define GL_VERSION_4_3 1\r\n/* OpenGL 4.3 reuses entry points from these extensions: */\r\n/* ARB_arrays_of_arrays (no entry points, GLSL only) */\r\n/* ARB_fragment_layer_viewport (no entry points, GLSL only) */\r\n/* ARB_shader_image_size (no entry points, GLSL only) */\r\n/* ARB_ES3_compatibility (no entry points) */\r\n/* ARB_clear_buffer_object */\r\n/* ARB_compute_shader */\r\n/* ARB_copy_image */\r\n/* KHR_debug (includes ARB_debug_output commands promoted to KHR without suffixes) */\r\n/* ARB_explicit_uniform_location (no entry points) */\r\n/* ARB_framebuffer_no_attachments */\r\n/* ARB_internalformat_query2 */\r\n/* ARB_invalidate_subdata */\r\n/* ARB_multi_draw_indirect */\r\n/* ARB_program_interface_query */\r\n/* ARB_robust_buffer_access_behavior (no entry points) */\r\n/* ARB_shader_storage_buffer_object */\r\n/* ARB_stencil_texturing (no entry points) */\r\n/* ARB_texture_buffer_range */\r\n/* ARB_texture_query_levels (no entry points) */\r\n/* ARB_texture_storage_multisample */\r\n/* ARB_texture_view */\r\n/* ARB_vertex_attrib_binding */\r\n#endif\r\n\r\n#ifndef GL_ARB_multitexture\r\n#define GL_ARB_multitexture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glActiveTextureARB (GLenum texture);\r\nGLAPI void APIENTRY glClientActiveTextureARB (GLenum texture);\r\nGLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s);\r\nGLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s);\r\nGLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s);\r\nGLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s);\r\nGLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t);\r\nGLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t);\r\nGLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t);\r\nGLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t);\r\nGLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r);\r\nGLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r);\r\nGLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r);\r\nGLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r);\r\nGLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v);\r\nGLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\nGLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v);\r\nGLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\nGLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v);\r\nGLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q);\r\nGLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v);\r\nGLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\r\nGLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);\r\ntypedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);\r\n#endif\r\n\r\n#ifndef GL_ARB_transpose_matrix\r\n#define GL_ARB_transpose_matrix 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m);\r\nGLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m);\r\nGLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m);\r\nGLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);\r\ntypedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);\r\n#endif\r\n\r\n#ifndef GL_ARB_multisample\r\n#define GL_ARB_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_add\r\n#define GL_ARB_texture_env_add 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_cube_map\r\n#define GL_ARB_texture_cube_map 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_compression\r\n#define GL_ARB_texture_compression 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\r\nGLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_border_clamp\r\n#define GL_ARB_texture_border_clamp 1\r\n#endif\r\n\r\n#ifndef GL_ARB_point_parameters\r\n#define GL_ARB_point_parameters 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_blend\r\n#define GL_ARB_vertex_blend 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights);\r\nGLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights);\r\nGLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights);\r\nGLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights);\r\nGLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights);\r\nGLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights);\r\nGLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights);\r\nGLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights);\r\nGLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glVertexBlendARB (GLint count);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights);\r\ntypedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count);\r\n#endif\r\n\r\n#ifndef GL_ARB_matrix_palette\r\n#define GL_ARB_matrix_palette 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index);\r\nGLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices);\r\nGLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices);\r\nGLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices);\r\nGLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);\r\ntypedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices);\r\ntypedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices);\r\ntypedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices);\r\ntypedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_combine\r\n#define GL_ARB_texture_env_combine 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_crossbar\r\n#define GL_ARB_texture_env_crossbar 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_env_dot3\r\n#define GL_ARB_texture_env_dot3 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_mirrored_repeat\r\n#define GL_ARB_texture_mirrored_repeat 1\r\n#endif\r\n\r\n#ifndef GL_ARB_depth_texture\r\n#define GL_ARB_depth_texture 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shadow\r\n#define GL_ARB_shadow 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shadow_ambient\r\n#define GL_ARB_shadow_ambient 1\r\n#endif\r\n\r\n#ifndef GL_ARB_window_pos\r\n#define GL_ARB_window_pos 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y);\r\nGLAPI void APIENTRY glWindowPos2ivARB (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y);\r\nGLAPI void APIENTRY glWindowPos2svARB (const GLshort *v);\r\nGLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z);\r\nGLAPI void APIENTRY glWindowPos3ivARB (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glWindowPos3svARB (const GLshort *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_program\r\n#define GL_ARB_vertex_program 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x);\r\nGLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x);\r\nGLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x);\r\nGLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y);\r\nGLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\nGLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v);\r\nGLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v);\r\nGLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index);\r\nGLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index);\r\nGLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string);\r\nGLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program);\r\nGLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs);\r\nGLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs);\r\nGLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);\r\nGLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);\r\nGLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);\r\nGLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);\r\nGLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params);\r\nGLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params);\r\nGLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params);\r\nGLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params);\r\nGLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string);\r\nGLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer);\r\nGLAPI GLboolean APIENTRY glIsProgramARB (GLuint program);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);\r\ntypedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);\r\ntypedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);\r\ntypedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);\r\ntypedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);\r\ntypedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer);\r\ntypedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_program\r\n#define GL_ARB_fragment_program 1\r\n/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_buffer_object\r\n#define GL_ARB_vertex_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer);\r\nGLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers);\r\nGLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers);\r\nGLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer);\r\nGLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);\r\nGLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);\r\nGLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);\r\nGLAPI GLvoid* APIENTRY glMapBufferARB (GLenum target, GLenum access);\r\nGLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target);\r\nGLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);\r\ntypedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);\r\ntypedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);\r\ntypedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);\r\ntypedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_occlusion_query\r\n#define GL_ARB_occlusion_query 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids);\r\nGLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids);\r\nGLAPI GLboolean APIENTRY glIsQueryARB (GLuint id);\r\nGLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id);\r\nGLAPI void APIENTRY glEndQueryARB (GLenum target);\r\nGLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);\r\ntypedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);\r\ntypedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);\r\ntypedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_objects\r\n#define GL_ARB_shader_objects 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj);\r\nGLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname);\r\nGLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj);\r\nGLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType);\r\nGLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);\r\nGLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj);\r\nGLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void);\r\nGLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj);\r\nGLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj);\r\nGLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj);\r\nGLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj);\r\nGLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0);\r\nGLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1);\r\nGLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\nGLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\nGLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0);\r\nGLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1);\r\nGLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2);\r\nGLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\nGLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);\r\nGLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);\r\nGLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name);\r\nGLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);\r\nGLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params);\r\nGLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params);\r\nGLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);\r\ntypedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);\r\ntypedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);\r\ntypedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);\r\ntypedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);\r\ntypedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);\r\ntypedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);\r\ntypedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);\r\ntypedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);\r\ntypedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);\r\ntypedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);\r\ntypedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);\r\ntypedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_shader\r\n#define GL_ARB_vertex_shader 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name);\r\nGLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);\r\nGLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);\r\ntypedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_shader\r\n#define GL_ARB_fragment_shader 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_100\r\n#define GL_ARB_shading_language_100 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_non_power_of_two\r\n#define GL_ARB_texture_non_power_of_two 1\r\n#endif\r\n\r\n#ifndef GL_ARB_point_sprite\r\n#define GL_ARB_point_sprite 1\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_program_shadow\r\n#define GL_ARB_fragment_program_shadow 1\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_buffers\r\n#define GL_ARB_draw_buffers 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_rectangle\r\n#define GL_ARB_texture_rectangle 1\r\n#endif\r\n\r\n#ifndef GL_ARB_color_buffer_float\r\n#define GL_ARB_color_buffer_float 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);\r\n#endif\r\n\r\n#ifndef GL_ARB_half_float_pixel\r\n#define GL_ARB_half_float_pixel 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_float\r\n#define GL_ARB_texture_float 1\r\n#endif\r\n\r\n#ifndef GL_ARB_pixel_buffer_object\r\n#define GL_ARB_pixel_buffer_object 1\r\n#endif\r\n\r\n#ifndef GL_ARB_depth_buffer_float\r\n#define GL_ARB_depth_buffer_float 1\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_instanced\r\n#define GL_ARB_draw_instanced 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount);\r\nGLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);\r\n#endif\r\n\r\n#ifndef GL_ARB_framebuffer_object\r\n#define GL_ARB_framebuffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);\r\nGLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);\r\nGLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);\r\nGLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);\r\nGLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);\r\nGLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);\r\nGLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);\r\nGLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);\r\nGLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);\r\nGLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\nGLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\nGLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGenerateMipmap (GLenum target);\r\nGLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\nGLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);\r\ntypedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);\r\ntypedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);\r\ntypedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);\r\ntypedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);\r\ntypedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);\r\ntypedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\ntypedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\n#endif\r\n\r\n#ifndef GL_ARB_framebuffer_sRGB\r\n#define GL_ARB_framebuffer_sRGB 1\r\n#endif\r\n\r\n#ifndef GL_ARB_geometry_shader4\r\n#define GL_ARB_geometry_shader4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value);\r\nGLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\nGLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\n#endif\r\n\r\n#ifndef GL_ARB_half_float_vertex\r\n#define GL_ARB_half_float_vertex 1\r\n#endif\r\n\r\n#ifndef GL_ARB_instanced_arrays\r\n#define GL_ARB_instanced_arrays 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);\r\n#endif\r\n\r\n#ifndef GL_ARB_map_buffer_range\r\n#define GL_ARB_map_buffer_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLvoid* APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\r\nGLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\r\ntypedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_buffer_object\r\n#define GL_ARB_texture_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_compression_rgtc\r\n#define GL_ARB_texture_compression_rgtc 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_rg\r\n#define GL_ARB_texture_rg 1\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_array_object\r\n#define GL_ARB_vertex_array_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindVertexArray (GLuint array);\r\nGLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);\r\nGLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);\r\nGLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);\r\ntypedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);\r\ntypedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);\r\ntypedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);\r\n#endif\r\n\r\n#ifndef GL_ARB_uniform_buffer_object\r\n#define GL_ARB_uniform_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);\r\nGLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);\r\nGLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);\r\nGLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);\r\nGLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);\r\ntypedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);\r\ntypedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\r\n#endif\r\n\r\n#ifndef GL_ARB_compatibility\r\n#define GL_ARB_compatibility 1\r\n#endif\r\n\r\n#ifndef GL_ARB_copy_buffer\r\n#define GL_ARB_copy_buffer 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_texture_lod\r\n#define GL_ARB_shader_texture_lod 1\r\n#endif\r\n\r\n#ifndef GL_ARB_depth_clamp\r\n#define GL_ARB_depth_clamp 1\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_elements_base_vertex\r\n#define GL_ARB_draw_elements_base_vertex 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);\r\nGLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);\r\nGLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);\r\nGLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);\r\ntypedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_coord_conventions\r\n#define GL_ARB_fragment_coord_conventions 1\r\n#endif\r\n\r\n#ifndef GL_ARB_provoking_vertex\r\n#define GL_ARB_provoking_vertex 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProvokingVertex (GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_ARB_seamless_cube_map\r\n#define GL_ARB_seamless_cube_map 1\r\n#endif\r\n\r\n#ifndef GL_ARB_sync\r\n#define GL_ARB_sync 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);\r\nGLAPI GLboolean APIENTRY glIsSync (GLsync sync);\r\nGLAPI void APIENTRY glDeleteSync (GLsync sync);\r\nGLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);\r\nGLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);\r\nGLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params);\r\nGLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);\r\ntypedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);\r\ntypedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);\r\ntypedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);\r\ntypedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);\r\ntypedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params);\r\ntypedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_multisample\r\n#define GL_ARB_texture_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\nGLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\nGLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);\r\nGLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\ntypedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);\r\ntypedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_array_bgra\r\n#define GL_ARB_vertex_array_bgra 1\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_buffers_blend\r\n#define GL_ARB_draw_buffers_blend 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);\r\nGLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\nGLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);\r\nGLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n#endif\r\n\r\n#ifndef GL_ARB_sample_shading\r\n#define GL_ARB_sample_shading 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_cube_map_array\r\n#define GL_ARB_texture_cube_map_array 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_gather\r\n#define GL_ARB_texture_gather 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_query_lod\r\n#define GL_ARB_texture_query_lod 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_include\r\n#define GL_ARB_shading_language_include 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);\r\nGLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);\r\nGLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length);\r\nGLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);\r\nGLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);\r\nGLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);\r\ntypedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length);\r\ntypedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_compression_bptc\r\n#define GL_ARB_texture_compression_bptc 1\r\n#endif\r\n\r\n#ifndef GL_ARB_blend_func_extended\r\n#define GL_ARB_blend_func_extended 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);\r\nGLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);\r\ntypedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);\r\n#endif\r\n\r\n#ifndef GL_ARB_explicit_attrib_location\r\n#define GL_ARB_explicit_attrib_location 1\r\n#endif\r\n\r\n#ifndef GL_ARB_occlusion_query2\r\n#define GL_ARB_occlusion_query2 1\r\n#endif\r\n\r\n#ifndef GL_ARB_sampler_objects\r\n#define GL_ARB_sampler_objects 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);\r\nGLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);\r\nGLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);\r\nGLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);\r\nGLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);\r\nGLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);\r\nGLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);\r\nGLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);\r\nGLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);\r\ntypedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);\r\ntypedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);\r\ntypedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);\r\ntypedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);\r\ntypedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);\r\ntypedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);\r\ntypedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);\r\ntypedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_bit_encoding\r\n#define GL_ARB_shader_bit_encoding 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_rgb10_a2ui\r\n#define GL_ARB_texture_rgb10_a2ui 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_swizzle\r\n#define GL_ARB_texture_swizzle 1\r\n#endif\r\n\r\n#ifndef GL_ARB_timer_query\r\n#define GL_ARB_timer_query 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);\r\nGLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);\r\nGLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_type_2_10_10_10_rev\r\n#define GL_ARB_vertex_type_2_10_10_10_rev 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value);\r\nGLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value);\r\nGLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value);\r\nGLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value);\r\nGLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value);\r\nGLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value);\r\nGLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords);\r\nGLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords);\r\nGLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color);\r\nGLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color);\r\nGLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color);\r\nGLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color);\r\nGLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color);\r\nGLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color);\r\nGLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\nGLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\nGLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\nGLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\nGLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\nGLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\nGLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\nGLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);\r\ntypedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords);\r\ntypedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);\r\ntypedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color);\r\ntypedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);\r\ntypedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\r\n#endif\r\n\r\n#ifndef GL_ARB_draw_indirect\r\n#define GL_ARB_draw_indirect 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect);\r\nGLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect);\r\n#endif\r\n\r\n#ifndef GL_ARB_gpu_shader5\r\n#define GL_ARB_gpu_shader5 1\r\n#endif\r\n\r\n#ifndef GL_ARB_gpu_shader_fp64\r\n#define GL_ARB_gpu_shader_fp64 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);\r\nGLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_subroutine\r\n#define GL_ARB_shader_subroutine 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);\r\nGLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);\r\nGLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);\r\nGLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);\r\nGLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);\r\nGLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);\r\nGLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);\r\nGLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);\r\ntypedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);\r\ntypedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);\r\n#endif\r\n\r\n#ifndef GL_ARB_tessellation_shader\r\n#define GL_ARB_tessellation_shader 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);\r\nGLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);\r\ntypedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_buffer_object_rgb32\r\n#define GL_ARB_texture_buffer_object_rgb32 1\r\n#endif\r\n\r\n#ifndef GL_ARB_transform_feedback2\r\n#define GL_ARB_transform_feedback2 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);\r\nGLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);\r\nGLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);\r\nGLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);\r\nGLAPI void APIENTRY glPauseTransformFeedback (void);\r\nGLAPI void APIENTRY glResumeTransformFeedback (void);\r\nGLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);\r\ntypedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);\r\ntypedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);\r\ntypedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);\r\ntypedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);\r\ntypedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);\r\n#endif\r\n\r\n#ifndef GL_ARB_transform_feedback3\r\n#define GL_ARB_transform_feedback3 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);\r\nGLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);\r\nGLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);\r\nGLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);\r\ntypedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);\r\ntypedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);\r\ntypedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_ES2_compatibility\r\n#define GL_ARB_ES2_compatibility 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glReleaseShaderCompiler (void);\r\nGLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);\r\nGLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);\r\nGLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f);\r\nGLAPI void APIENTRY glClearDepthf (GLfloat d);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);\r\ntypedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);\r\ntypedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);\r\ntypedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);\r\ntypedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);\r\n#endif\r\n\r\n#ifndef GL_ARB_get_program_binary\r\n#define GL_ARB_get_program_binary 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);\r\nGLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);\r\nGLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);\r\ntypedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);\r\n#endif\r\n\r\n#ifndef GL_ARB_separate_shader_objects\r\n#define GL_ARB_separate_shader_objects 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);\r\nGLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);\r\nGLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* const *strings);\r\nGLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);\r\nGLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);\r\nGLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);\r\nGLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);\r\nGLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);\r\nGLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);\r\nGLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);\r\nGLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);\r\nGLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);\r\nGLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);\r\nGLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);\r\nGLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);\r\nGLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\r\nGLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\nGLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);\r\nGLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\r\nGLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\nGLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\nGLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);\r\nGLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\nGLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);\r\nGLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);\r\ntypedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);\r\ntypedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* const *strings);\r\ntypedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);\r\ntypedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);\r\ntypedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);\r\ntypedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_attrib_64bit\r\n#define GL_ARB_vertex_attrib_64bit 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);\r\nGLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_viewport_array\r\n#define GL_ARB_viewport_array 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);\r\nGLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\r\nGLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);\r\nGLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v);\r\nGLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f);\r\nGLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);\r\nGLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\r\ntypedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f);\r\ntypedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);\r\ntypedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);\r\n#endif\r\n\r\n#ifndef GL_ARB_cl_event\r\n#define GL_ARB_cl_event 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags);\r\n#endif\r\n\r\n#ifndef GL_ARB_debug_output\r\n#define GL_ARB_debug_output 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\r\nGLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\r\nGLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam);\r\nGLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam);\r\ntypedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\r\n#endif\r\n\r\n#ifndef GL_ARB_robustness\r\n#define GL_ARB_robustness 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);\r\nGLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);\r\nGLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);\r\nGLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v);\r\nGLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values);\r\nGLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values);\r\nGLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values);\r\nGLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern);\r\nGLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);\r\nGLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);\r\nGLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);\r\nGLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);\r\nGLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);\r\nGLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);\r\nGLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);\r\nGLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);\r\nGLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);\r\nGLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);\r\nGLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);\r\nGLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);\r\ntypedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v);\r\ntypedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values);\r\ntypedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values);\r\ntypedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values);\r\ntypedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern);\r\ntypedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);\r\ntypedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);\r\ntypedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);\r\ntypedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);\r\ntypedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);\r\ntypedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);\r\ntypedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_stencil_export\r\n#define GL_ARB_shader_stencil_export 1\r\n#endif\r\n\r\n#ifndef GL_ARB_base_instance\r\n#define GL_ARB_base_instance 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);\r\nGLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);\r\nGLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_420pack\r\n#define GL_ARB_shading_language_420pack 1\r\n#endif\r\n\r\n#ifndef GL_ARB_transform_feedback_instanced\r\n#define GL_ARB_transform_feedback_instanced 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount);\r\nGLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount);\r\ntypedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);\r\n#endif\r\n\r\n#ifndef GL_ARB_compressed_texture_pixel_storage\r\n#define GL_ARB_compressed_texture_pixel_storage 1\r\n#endif\r\n\r\n#ifndef GL_ARB_conservative_depth\r\n#define GL_ARB_conservative_depth 1\r\n#endif\r\n\r\n#ifndef GL_ARB_internalformat_query\r\n#define GL_ARB_internalformat_query 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_map_buffer_alignment\r\n#define GL_ARB_map_buffer_alignment 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_atomic_counters\r\n#define GL_ARB_shader_atomic_counters 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_image_load_store\r\n#define GL_ARB_shader_image_load_store 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\r\nGLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\r\ntypedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);\r\n#endif\r\n\r\n#ifndef GL_ARB_shading_language_packing\r\n#define GL_ARB_shading_language_packing 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_storage\r\n#define GL_ARB_texture_storage 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\r\nGLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\r\nGLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\r\nGLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\r\ntypedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\r\n#endif\r\n\r\n#ifndef GL_KHR_texture_compression_astc_ldr\r\n#define GL_KHR_texture_compression_astc_ldr 1\r\n#endif\r\n\r\n#ifndef GL_KHR_debug\r\n#define GL_KHR_debug 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\r\nGLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\r\nGLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);\r\nGLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\r\nGLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);\r\nGLAPI void APIENTRY glPopDebugGroup (void);\r\nGLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);\r\nGLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);\r\nGLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);\r\nGLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);\r\ntypedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\r\ntypedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);\r\ntypedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);\r\ntypedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);\r\ntypedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);\r\n#endif\r\n\r\n#ifndef GL_ARB_arrays_of_arrays\r\n#define GL_ARB_arrays_of_arrays 1\r\n#endif\r\n\r\n#ifndef GL_ARB_clear_buffer_object\r\n#define GL_ARB_clear_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);\r\nGLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\r\nGLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);\r\nGLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);\r\ntypedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\r\ntypedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);\r\ntypedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);\r\n#endif\r\n\r\n#ifndef GL_ARB_compute_shader\r\n#define GL_ARB_compute_shader 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\r\nGLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\r\ntypedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);\r\n#endif\r\n\r\n#ifndef GL_ARB_copy_image\r\n#define GL_ARB_copy_image 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_view\r\n#define GL_ARB_texture_view 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\r\n#endif\r\n\r\n#ifndef GL_ARB_vertex_attrib_binding\r\n#define GL_ARB_vertex_attrib_binding 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\r\nGLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\r\nGLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\nGLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\nGLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);\r\nGLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);\r\nGLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\r\nGLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\r\nGLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\nGLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\nGLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);\r\nGLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);\r\ntypedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);\r\n#endif\r\n\r\n#ifndef GL_ARB_robustness_isolation\r\n#define GL_ARB_robustness_isolation 1\r\n#endif\r\n\r\n#ifndef GL_ARB_ES3_compatibility\r\n#define GL_ARB_ES3_compatibility 1\r\n#endif\r\n\r\n#ifndef GL_ARB_explicit_uniform_location\r\n#define GL_ARB_explicit_uniform_location 1\r\n#endif\r\n\r\n#ifndef GL_ARB_fragment_layer_viewport\r\n#define GL_ARB_fragment_layer_viewport 1\r\n#endif\r\n\r\n#ifndef GL_ARB_framebuffer_no_attachments\r\n#define GL_ARB_framebuffer_no_attachments 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_internalformat_query2\r\n#define GL_ARB_internalformat_query2 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);\r\n#endif\r\n\r\n#ifndef GL_ARB_invalidate_subdata\r\n#define GL_ARB_invalidate_subdata 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\r\nGLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level);\r\nGLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length);\r\nGLAPI void APIENTRY glInvalidateBufferData (GLuint buffer);\r\nGLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);\r\nGLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\r\ntypedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);\r\ntypedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);\r\ntypedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\r\n#endif\r\n\r\n#ifndef GL_ARB_multi_draw_indirect\r\n#define GL_ARB_multi_draw_indirect 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);\r\nGLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);\r\n#endif\r\n\r\n#ifndef GL_ARB_program_interface_query\r\n#define GL_ARB_program_interface_query 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);\r\nGLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);\r\nGLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\r\nGLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);\r\nGLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);\r\nGLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);\r\ntypedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);\r\ntypedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);\r\ntypedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);\r\n#endif\r\n\r\n#ifndef GL_ARB_robust_buffer_access_behavior\r\n#define GL_ARB_robust_buffer_access_behavior 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_image_size\r\n#define GL_ARB_shader_image_size 1\r\n#endif\r\n\r\n#ifndef GL_ARB_shader_storage_buffer_object\r\n#define GL_ARB_shader_storage_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\r\n#endif\r\n\r\n#ifndef GL_ARB_stencil_texturing\r\n#define GL_ARB_stencil_texturing 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_buffer_range\r\n#define GL_ARB_texture_buffer_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\nGLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_query_levels\r\n#define GL_ARB_texture_query_levels 1\r\n#endif\r\n\r\n#ifndef GL_ARB_texture_storage_multisample\r\n#define GL_ARB_texture_storage_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\nGLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\nGLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\nGLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\ntypedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\ntypedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\r\ntypedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\r\n#endif\r\n\r\n#ifndef GL_EXT_abgr\r\n#define GL_EXT_abgr 1\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_color\r\n#define GL_EXT_blend_color 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\n#endif\r\n\r\n#ifndef GL_EXT_polygon_offset\r\n#define GL_EXT_polygon_offset 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture\r\n#define GL_EXT_texture 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture3D\r\n#define GL_EXT_texture3D 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_filter4\r\n#define GL_SGIS_texture_filter4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights);\r\nGLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);\r\ntypedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);\r\n#endif\r\n\r\n#ifndef GL_EXT_subtexture\r\n#define GL_EXT_subtexture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\n#endif\r\n\r\n#ifndef GL_EXT_copy_texture\r\n#define GL_EXT_copy_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\nGLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\nGLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n#endif\r\n\r\n#ifndef GL_EXT_histogram\r\n#define GL_EXT_histogram 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\nGLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\nGLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\r\nGLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink);\r\nGLAPI void APIENTRY glResetHistogramEXT (GLenum target);\r\nGLAPI void APIENTRY glResetMinmaxEXT (GLenum target);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);\r\ntypedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);\r\ntypedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);\r\ntypedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target);\r\n#endif\r\n\r\n#ifndef GL_EXT_convolution\r\n#define GL_EXT_convolution 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);\r\nGLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);\r\nGLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params);\r\nGLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params);\r\nGLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *image);\r\nGLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);\r\nGLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);\r\ntypedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);\r\n#endif\r\n\r\n#ifndef GL_SGI_color_matrix\r\n#define GL_SGI_color_matrix 1\r\n#endif\r\n\r\n#ifndef GL_SGI_color_table\r\n#define GL_SGI_color_table 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\nGLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, GLvoid *table);\r\nGLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\ntypedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_SGIX_pixel_texture\r\n#define GL_SGIX_pixel_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_SGIS_pixel_texture\r\n#define GL_SGIS_pixel_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture4D\r\n#define GL_SGIS_texture4D 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);\r\n#endif\r\n\r\n#ifndef GL_SGI_texture_color_table\r\n#define GL_SGI_texture_color_table 1\r\n#endif\r\n\r\n#ifndef GL_EXT_cmyka\r\n#define GL_EXT_cmyka 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_object\r\n#define GL_EXT_texture_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences);\r\nGLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture);\r\nGLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures);\r\nGLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures);\r\nGLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture);\r\nGLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);\r\ntypedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);\r\ntypedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures);\r\ntypedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures);\r\ntypedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture);\r\ntypedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities);\r\n#endif\r\n\r\n#ifndef GL_SGIS_detail_texture\r\n#define GL_SGIS_detail_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);\r\nGLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);\r\ntypedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);\r\n#endif\r\n\r\n#ifndef GL_SGIS_sharpen_texture\r\n#define GL_SGIS_sharpen_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);\r\nGLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);\r\ntypedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);\r\n#endif\r\n\r\n#ifndef GL_EXT_packed_pixels\r\n#define GL_EXT_packed_pixels 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_lod\r\n#define GL_SGIS_texture_lod 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_multisample\r\n#define GL_SGIS_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert);\r\nGLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);\r\ntypedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);\r\n#endif\r\n\r\n#ifndef GL_EXT_rescale_normal\r\n#define GL_EXT_rescale_normal 1\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_array\r\n#define GL_EXT_vertex_array 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glArrayElementEXT (GLint i);\r\nGLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\nGLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count);\r\nGLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer);\r\nGLAPI void APIENTRY glGetPointervEXT (GLenum pname, GLvoid* *params);\r\nGLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\nGLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\nGLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\nGLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i);\r\ntypedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);\r\ntypedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);\r\ntypedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params);\r\ntypedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_EXT_misc_attribute\r\n#define GL_EXT_misc_attribute 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_generate_mipmap\r\n#define GL_SGIS_generate_mipmap 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_clipmap\r\n#define GL_SGIX_clipmap 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_shadow\r\n#define GL_SGIX_shadow 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_edge_clamp\r\n#define GL_SGIS_texture_edge_clamp 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_border_clamp\r\n#define GL_SGIS_texture_border_clamp 1\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_minmax\r\n#define GL_EXT_blend_minmax 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendEquationEXT (GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_subtract\r\n#define GL_EXT_blend_subtract 1\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_logic_op\r\n#define GL_EXT_blend_logic_op 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_interlace\r\n#define GL_SGIX_interlace 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_pixel_tiles\r\n#define GL_SGIX_pixel_tiles 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_select\r\n#define GL_SGIS_texture_select 1\r\n/* This used to be SGIX prefix, which was an error in the header */\r\n#endif\r\n\r\n#ifndef GL_SGIX_sprite\r\n#define GL_SGIX_sprite 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params);\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_multi_buffer\r\n#define GL_SGIX_texture_multi_buffer 1\r\n#endif\r\n\r\n#ifndef GL_EXT_point_parameters\r\n#define GL_EXT_point_parameters 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_SGIS_point_parameters\r\n#define GL_SGIS_point_parameters 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_SGIX_instruments\r\n#define GL_SGIX_instruments 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLint APIENTRY glGetInstrumentsSGIX (void);\r\nGLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer);\r\nGLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p);\r\nGLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker);\r\nGLAPI void APIENTRY glStartInstrumentsSGIX (void);\r\nGLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void);\r\ntypedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);\r\ntypedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p);\r\ntypedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker);\r\ntypedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void);\r\ntypedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_scale_bias\r\n#define GL_SGIX_texture_scale_bias 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_framezoom\r\n#define GL_SGIX_framezoom 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFrameZoomSGIX (GLint factor);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor);\r\n#endif\r\n\r\n#ifndef GL_SGIX_tag_sample_buffer\r\n#define GL_SGIX_tag_sample_buffer 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTagSampleBufferSGIX (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_SGIX_polynomial_ffd\r\n#define GL_SGIX_polynomial_ffd 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);\r\nGLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);\r\nGLAPI void APIENTRY glDeformSGIX (GLbitfield mask);\r\nGLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);\r\ntypedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);\r\ntypedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask);\r\ntypedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask);\r\n#endif\r\n\r\n#ifndef GL_SGIX_reference_plane\r\n#define GL_SGIX_reference_plane 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);\r\n#endif\r\n\r\n#ifndef GL_SGIX_flush_raster\r\n#define GL_SGIX_flush_raster 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFlushRasterSGIX (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_SGIX_depth_texture\r\n#define GL_SGIX_depth_texture 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_fog_function\r\n#define GL_SGIS_fog_function 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points);\r\nGLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);\r\ntypedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);\r\n#endif\r\n\r\n#ifndef GL_SGIX_fog_offset\r\n#define GL_SGIX_fog_offset 1\r\n#endif\r\n\r\n#ifndef GL_HP_image_transform\r\n#define GL_HP_image_transform 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_HP_convolution_border_modes\r\n#define GL_HP_convolution_border_modes 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_add_env\r\n#define GL_SGIX_texture_add_env 1\r\n#endif\r\n\r\n#ifndef GL_EXT_color_subtable\r\n#define GL_EXT_color_subtable 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);\r\nGLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);\r\n#endif\r\n\r\n#ifndef GL_PGI_vertex_hints\r\n#define GL_PGI_vertex_hints 1\r\n#endif\r\n\r\n#ifndef GL_PGI_misc_hints\r\n#define GL_PGI_misc_hints 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glHintPGI (GLenum target, GLint mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);\r\n#endif\r\n\r\n#ifndef GL_EXT_paletted_texture\r\n#define GL_EXT_paletted_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\nGLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, GLvoid *data);\r\nGLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_clip_volume_hint\r\n#define GL_EXT_clip_volume_hint 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_list_priority\r\n#define GL_SGIX_list_priority 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params);\r\n#endif\r\n\r\n#ifndef GL_SGIX_ir_instrument1\r\n#define GL_SGIX_ir_instrument1 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_calligraphic_fragment\r\n#define GL_SGIX_calligraphic_fragment 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_lod_bias\r\n#define GL_SGIX_texture_lod_bias 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_shadow_ambient\r\n#define GL_SGIX_shadow_ambient 1\r\n#endif\r\n\r\n#ifndef GL_EXT_index_texture\r\n#define GL_EXT_index_texture 1\r\n#endif\r\n\r\n#ifndef GL_EXT_index_material\r\n#define GL_EXT_index_material 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_EXT_index_func\r\n#define GL_EXT_index_func 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);\r\n#endif\r\n\r\n#ifndef GL_EXT_index_array_formats\r\n#define GL_EXT_index_array_formats 1\r\n#endif\r\n\r\n#ifndef GL_EXT_compiled_vertex_array\r\n#define GL_EXT_compiled_vertex_array 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count);\r\nGLAPI void APIENTRY glUnlockArraysEXT (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);\r\ntypedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_EXT_cull_vertex\r\n#define GL_EXT_cull_vertex 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_SGIX_ycrcb\r\n#define GL_SGIX_ycrcb 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_fragment_lighting\r\n#define GL_SGIX_fragment_lighting 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode);\r\nGLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);\r\n#endif\r\n\r\n#ifndef GL_IBM_rasterpos_clip\r\n#define GL_IBM_rasterpos_clip 1\r\n#endif\r\n\r\n#ifndef GL_HP_texture_lighting\r\n#define GL_HP_texture_lighting 1\r\n#endif\r\n\r\n#ifndef GL_EXT_draw_range_elements\r\n#define GL_EXT_draw_range_elements 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\r\n#endif\r\n\r\n#ifndef GL_WIN_phong_shading\r\n#define GL_WIN_phong_shading 1\r\n#endif\r\n\r\n#ifndef GL_WIN_specular_fog\r\n#define GL_WIN_specular_fog 1\r\n#endif\r\n\r\n#ifndef GL_EXT_light_texture\r\n#define GL_EXT_light_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glApplyTextureEXT (GLenum mode);\r\nGLAPI void APIENTRY glTextureLightEXT (GLenum pname);\r\nGLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);\r\ntypedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);\r\ntypedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_SGIX_blend_alpha_minmax\r\n#define GL_SGIX_blend_alpha_minmax 1\r\n#endif\r\n\r\n#ifndef GL_EXT_bgra\r\n#define GL_EXT_bgra 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_async\r\n#define GL_SGIX_async 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker);\r\nGLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp);\r\nGLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp);\r\nGLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range);\r\nGLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range);\r\nGLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker);\r\ntypedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp);\r\ntypedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp);\r\ntypedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);\r\ntypedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);\r\ntypedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);\r\n#endif\r\n\r\n#ifndef GL_SGIX_async_pixel\r\n#define GL_SGIX_async_pixel 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_async_histogram\r\n#define GL_SGIX_async_histogram 1\r\n#endif\r\n\r\n#ifndef GL_INTEL_parallel_arrays\r\n#define GL_INTEL_parallel_arrays 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);\r\nGLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const GLvoid* *pointer);\r\nGLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);\r\nGLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);\r\ntypedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer);\r\ntypedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);\r\n#endif\r\n\r\n#ifndef GL_HP_occlusion_test\r\n#define GL_HP_occlusion_test 1\r\n#endif\r\n\r\n#ifndef GL_EXT_pixel_transform\r\n#define GL_EXT_pixel_transform 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_pixel_transform_color_table\r\n#define GL_EXT_pixel_transform_color_table 1\r\n#endif\r\n\r\n#ifndef GL_EXT_shared_texture_palette\r\n#define GL_EXT_shared_texture_palette 1\r\n#endif\r\n\r\n#ifndef GL_EXT_separate_specular_color\r\n#define GL_EXT_separate_specular_color 1\r\n#endif\r\n\r\n#ifndef GL_EXT_secondary_color\r\n#define GL_EXT_secondary_color 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue);\r\nGLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v);\r\nGLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue);\r\nGLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v);\r\nGLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue);\r\nGLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v);\r\nGLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue);\r\nGLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v);\r\nGLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue);\r\nGLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v);\r\nGLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue);\r\nGLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v);\r\nGLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue);\r\nGLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v);\r\nGLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue);\r\nGLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v);\r\nGLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_perturb_normal\r\n#define GL_EXT_texture_perturb_normal 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTextureNormalEXT (GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_EXT_multi_draw_arrays\r\n#define GL_EXT_multi_draw_arrays 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);\r\nGLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);\r\n#endif\r\n\r\n#ifndef GL_EXT_fog_coord\r\n#define GL_EXT_fog_coord 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFogCoordfEXT (GLfloat coord);\r\nGLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord);\r\nGLAPI void APIENTRY glFogCoorddEXT (GLdouble coord);\r\nGLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord);\r\nGLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_REND_screen_coordinates\r\n#define GL_REND_screen_coordinates 1\r\n#endif\r\n\r\n#ifndef GL_EXT_coordinate_frame\r\n#define GL_EXT_coordinate_frame 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz);\r\nGLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v);\r\nGLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz);\r\nGLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v);\r\nGLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz);\r\nGLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v);\r\nGLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz);\r\nGLAPI void APIENTRY glTangent3ivEXT (const GLint *v);\r\nGLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz);\r\nGLAPI void APIENTRY glTangent3svEXT (const GLshort *v);\r\nGLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz);\r\nGLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v);\r\nGLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz);\r\nGLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v);\r\nGLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz);\r\nGLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v);\r\nGLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz);\r\nGLAPI void APIENTRY glBinormal3ivEXT (const GLint *v);\r\nGLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz);\r\nGLAPI void APIENTRY glBinormal3svEXT (const GLshort *v);\r\nGLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);\r\ntypedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz);\r\ntypedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz);\r\ntypedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz);\r\ntypedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz);\r\ntypedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz);\r\ntypedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_env_combine\r\n#define GL_EXT_texture_env_combine 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_specular_vector\r\n#define GL_APPLE_specular_vector 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_transform_hint\r\n#define GL_APPLE_transform_hint 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_fog_scale\r\n#define GL_SGIX_fog_scale 1\r\n#endif\r\n\r\n#ifndef GL_SUNX_constant_data\r\n#define GL_SUNX_constant_data 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFinishTextureSUNX (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_SUN_global_alpha\r\n#define GL_SUN_global_alpha 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor);\r\nGLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);\r\ntypedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);\r\n#endif\r\n\r\n#ifndef GL_SUN_triangle_list\r\n#define GL_SUN_triangle_list 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code);\r\nGLAPI void APIENTRY glReplacementCodeusSUN (GLushort code);\r\nGLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code);\r\nGLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code);\r\nGLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code);\r\nGLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code);\r\nGLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const GLvoid* *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer);\r\n#endif\r\n\r\n#ifndef GL_SUN_vertex\r\n#define GL_SUN_vertex 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v);\r\nGLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v);\r\nGLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v);\r\nGLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);\r\nGLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_func_separate\r\n#define GL_EXT_blend_func_separate 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\n#endif\r\n\r\n#ifndef GL_INGR_blend_func_separate\r\n#define GL_INGR_blend_func_separate 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\r\n#endif\r\n\r\n#ifndef GL_INGR_color_clamp\r\n#define GL_INGR_color_clamp 1\r\n#endif\r\n\r\n#ifndef GL_INGR_interlace_read\r\n#define GL_INGR_interlace_read 1\r\n#endif\r\n\r\n#ifndef GL_EXT_stencil_wrap\r\n#define GL_EXT_stencil_wrap 1\r\n#endif\r\n\r\n#ifndef GL_EXT_422_pixels\r\n#define GL_EXT_422_pixels 1\r\n#endif\r\n\r\n#ifndef GL_NV_texgen_reflection\r\n#define GL_NV_texgen_reflection 1\r\n#endif\r\n\r\n#ifndef GL_SUN_convolution_border_modes\r\n#define GL_SUN_convolution_border_modes 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_env_add\r\n#define GL_EXT_texture_env_add 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_lod_bias\r\n#define GL_EXT_texture_lod_bias 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_filter_anisotropic\r\n#define GL_EXT_texture_filter_anisotropic 1\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_weighting\r\n#define GL_EXT_vertex_weighting 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight);\r\nGLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight);\r\nGLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);\r\ntypedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);\r\ntypedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_NV_light_max_exponent\r\n#define GL_NV_light_max_exponent 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_array_range\r\n#define GL_NV_vertex_array_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFlushVertexArrayRangeNV (void);\r\nGLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const GLvoid *pointer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer);\r\n#endif\r\n\r\n#ifndef GL_NV_register_combiners\r\n#define GL_NV_register_combiners 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\r\nGLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);\r\nGLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\r\nGLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\r\ntypedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);\r\ntypedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);\r\ntypedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_NV_fog_distance\r\n#define GL_NV_fog_distance 1\r\n#endif\r\n\r\n#ifndef GL_NV_texgen_emboss\r\n#define GL_NV_texgen_emboss 1\r\n#endif\r\n\r\n#ifndef GL_NV_blend_square\r\n#define GL_NV_blend_square 1\r\n#endif\r\n\r\n#ifndef GL_NV_texture_env_combine4\r\n#define GL_NV_texture_env_combine4 1\r\n#endif\r\n\r\n#ifndef GL_MESA_resize_buffers\r\n#define GL_MESA_resize_buffers 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glResizeBuffersMESA (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_MESA_window_pos\r\n#define GL_MESA_window_pos 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y);\r\nGLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y);\r\nGLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v);\r\nGLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z);\r\nGLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v);\r\nGLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v);\r\nGLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v);\r\nGLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v);\r\nGLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_compression_s3tc\r\n#define GL_EXT_texture_compression_s3tc 1\r\n#endif\r\n\r\n#ifndef GL_IBM_cull_vertex\r\n#define GL_IBM_cull_vertex 1\r\n#endif\r\n\r\n#ifndef GL_IBM_multimode_draw_arrays\r\n#define GL_IBM_multimode_draw_arrays 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);\r\nGLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);\r\ntypedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);\r\n#endif\r\n\r\n#ifndef GL_IBM_vertex_array_lists\r\n#define GL_IBM_vertex_array_lists 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\nGLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\ntypedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);\r\n#endif\r\n\r\n#ifndef GL_SGIX_subsample\r\n#define GL_SGIX_subsample 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_ycrcba\r\n#define GL_SGIX_ycrcba 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_ycrcb_subsample\r\n#define GL_SGIX_ycrcb_subsample 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_depth_pass_instrument\r\n#define GL_SGIX_depth_pass_instrument 1\r\n#endif\r\n\r\n#ifndef GL_3DFX_texture_compression_FXT1\r\n#define GL_3DFX_texture_compression_FXT1 1\r\n#endif\r\n\r\n#ifndef GL_3DFX_multisample\r\n#define GL_3DFX_multisample 1\r\n#endif\r\n\r\n#ifndef GL_3DFX_tbuffer\r\n#define GL_3DFX_tbuffer 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTbufferMask3DFX (GLuint mask);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);\r\n#endif\r\n\r\n#ifndef GL_EXT_multisample\r\n#define GL_EXT_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert);\r\nGLAPI void APIENTRY glSamplePatternEXT (GLenum pattern);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);\r\ntypedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);\r\n#endif\r\n\r\n#ifndef GL_SGIX_vertex_preclip\r\n#define GL_SGIX_vertex_preclip 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_convolution_accuracy\r\n#define GL_SGIX_convolution_accuracy 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_resample\r\n#define GL_SGIX_resample 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_point_line_texgen\r\n#define GL_SGIS_point_line_texgen 1\r\n#endif\r\n\r\n#ifndef GL_SGIS_texture_color_mask\r\n#define GL_SGIS_texture_color_mask 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\n#endif\r\n\r\n#ifndef GL_SGIX_igloo_interface\r\n#define GL_SGIX_igloo_interface 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const GLvoid *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_env_dot3\r\n#define GL_EXT_texture_env_dot3 1\r\n#endif\r\n\r\n#ifndef GL_ATI_texture_mirror_once\r\n#define GL_ATI_texture_mirror_once 1\r\n#endif\r\n\r\n#ifndef GL_NV_fence\r\n#define GL_NV_fence 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);\r\nGLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);\r\nGLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence);\r\nGLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence);\r\nGLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glFinishFenceNV (GLuint fence);\r\nGLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);\r\ntypedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);\r\ntypedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);\r\ntypedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);\r\ntypedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);\r\ntypedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);\r\n#endif\r\n\r\n#ifndef GL_IBM_static_data\r\n#define GL_IBM_static_data 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFlushStaticDataIBM (GLenum target);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFLUSHSTATICDATAIBMPROC) (GLenum target);\r\n#endif\r\n\r\n#ifndef GL_IBM_texture_mirrored_repeat\r\n#define GL_IBM_texture_mirrored_repeat 1\r\n#endif\r\n\r\n#ifndef GL_NV_evaluators\r\n#define GL_NV_evaluators 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);\r\nGLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);\r\nGLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);\r\ntypedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);\r\ntypedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_NV_packed_depth_stencil\r\n#define GL_NV_packed_depth_stencil 1\r\n#endif\r\n\r\n#ifndef GL_NV_register_combiners2\r\n#define GL_NV_register_combiners2 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_NV_texture_compression_vtc\r\n#define GL_NV_texture_compression_vtc 1\r\n#endif\r\n\r\n#ifndef GL_NV_texture_rectangle\r\n#define GL_NV_texture_rectangle 1\r\n#endif\r\n\r\n#ifndef GL_NV_texture_shader\r\n#define GL_NV_texture_shader 1\r\n#endif\r\n\r\n#ifndef GL_NV_texture_shader2\r\n#define GL_NV_texture_shader2 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_array_range2\r\n#define GL_NV_vertex_array_range2 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program\r\n#define GL_NV_vertex_program 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences);\r\nGLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id);\r\nGLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs);\r\nGLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params);\r\nGLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs);\r\nGLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program);\r\nGLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, GLvoid* *pointer);\r\nGLAPI GLboolean APIENTRY glIsProgramNV (GLuint id);\r\nGLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program);\r\nGLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v);\r\nGLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v);\r\nGLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs);\r\nGLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform);\r\nGLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x);\r\nGLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x);\r\nGLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x);\r\nGLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y);\r\nGLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\nGLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v);\r\nGLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);\r\ntypedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);\r\ntypedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);\r\ntypedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);\r\ntypedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);\r\ntypedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);\r\ntypedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);\r\n#endif\r\n\r\n#ifndef GL_SGIX_texture_coordinate_clamp\r\n#define GL_SGIX_texture_coordinate_clamp 1\r\n#endif\r\n\r\n#ifndef GL_SGIX_scalebias_hint\r\n#define GL_SGIX_scalebias_hint 1\r\n#endif\r\n\r\n#ifndef GL_OML_interlace\r\n#define GL_OML_interlace 1\r\n#endif\r\n\r\n#ifndef GL_OML_subsample\r\n#define GL_OML_subsample 1\r\n#endif\r\n\r\n#ifndef GL_OML_resample\r\n#define GL_OML_resample 1\r\n#endif\r\n\r\n#ifndef GL_NV_copy_depth_to_color\r\n#define GL_NV_copy_depth_to_color 1\r\n#endif\r\n\r\n#ifndef GL_ATI_envmap_bumpmap\r\n#define GL_ATI_envmap_bumpmap 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param);\r\nGLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param);\r\nGLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param);\r\nGLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param);\r\ntypedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param);\r\ntypedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);\r\ntypedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);\r\n#endif\r\n\r\n#ifndef GL_ATI_fragment_shader\r\n#define GL_ATI_fragment_shader 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range);\r\nGLAPI void APIENTRY glBindFragmentShaderATI (GLuint id);\r\nGLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id);\r\nGLAPI void APIENTRY glBeginFragmentShaderATI (void);\r\nGLAPI void APIENTRY glEndFragmentShaderATI (void);\r\nGLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle);\r\nGLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle);\r\nGLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\r\nGLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\r\nGLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\r\nGLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\r\nGLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\r\nGLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\r\nGLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);\r\ntypedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void);\r\ntypedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void);\r\ntypedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);\r\ntypedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);\r\ntypedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\r\ntypedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\r\ntypedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\r\ntypedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);\r\ntypedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);\r\ntypedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);\r\ntypedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value);\r\n#endif\r\n\r\n#ifndef GL_ATI_pn_triangles\r\n#define GL_ATI_pn_triangles 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);\r\n#endif\r\n\r\n#ifndef GL_ATI_vertex_array_object\r\n#define GL_ATI_vertex_array_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const GLvoid *pointer, GLenum usage);\r\nGLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer);\r\nGLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);\r\nGLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer);\r\nGLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\r\nGLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\r\nGLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);\r\ntypedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\r\ntypedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);\r\ntypedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_shader\r\n#define GL_EXT_vertex_shader 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBeginVertexShaderEXT (void);\r\nGLAPI void APIENTRY glEndVertexShaderEXT (void);\r\nGLAPI void APIENTRY glBindVertexShaderEXT (GLuint id);\r\nGLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range);\r\nGLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id);\r\nGLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1);\r\nGLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2);\r\nGLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);\r\nGLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\r\nGLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\r\nGLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num);\r\nGLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num);\r\nGLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);\r\nGLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const GLvoid *addr);\r\nGLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const GLvoid *addr);\r\nGLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr);\r\nGLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr);\r\nGLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr);\r\nGLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr);\r\nGLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr);\r\nGLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr);\r\nGLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr);\r\nGLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr);\r\nGLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const GLvoid *addr);\r\nGLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id);\r\nGLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id);\r\nGLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value);\r\nGLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value);\r\nGLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value);\r\nGLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value);\r\nGLAPI GLuint APIENTRY glBindParameterEXT (GLenum value);\r\nGLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap);\r\nGLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);\r\nGLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data);\r\nGLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);\r\nGLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, GLvoid* *data);\r\nGLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);\r\nGLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data);\r\nGLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);\r\nGLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);\r\nGLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data);\r\nGLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void);\r\ntypedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void);\r\ntypedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);\r\ntypedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);\r\ntypedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);\r\ntypedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);\r\ntypedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);\r\ntypedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\r\ntypedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);\r\ntypedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);\r\ntypedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);\r\ntypedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);\r\ntypedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr);\r\ntypedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr);\r\ntypedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr);\r\ntypedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);\r\ntypedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);\r\ntypedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);\r\ntypedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);\r\ntypedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);\r\ntypedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value);\r\ntypedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);\r\ntypedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\r\ntypedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\r\ntypedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\r\ntypedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data);\r\ntypedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\r\ntypedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\r\ntypedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\r\ntypedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);\r\ntypedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);\r\ntypedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);\r\n#endif\r\n\r\n#ifndef GL_ATI_vertex_streams\r\n#define GL_ATI_vertex_streams 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x);\r\nGLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords);\r\nGLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x);\r\nGLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords);\r\nGLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x);\r\nGLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords);\r\nGLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x);\r\nGLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords);\r\nGLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y);\r\nGLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords);\r\nGLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y);\r\nGLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords);\r\nGLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y);\r\nGLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords);\r\nGLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords);\r\nGLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z);\r\nGLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords);\r\nGLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z);\r\nGLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords);\r\nGLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords);\r\nGLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords);\r\nGLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);\r\nGLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords);\r\nGLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords);\r\nGLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords);\r\nGLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords);\r\nGLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);\r\nGLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords);\r\nGLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz);\r\nGLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords);\r\nGLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz);\r\nGLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords);\r\nGLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);\r\nGLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords);\r\nGLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);\r\nGLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords);\r\nGLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream);\r\nGLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);\r\ntypedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);\r\ntypedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);\r\ntypedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);\r\n#endif\r\n\r\n#ifndef GL_ATI_element_array\r\n#define GL_ATI_element_array 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glElementPointerATI (GLenum type, const GLvoid *pointer);\r\nGLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count);\r\nGLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);\r\ntypedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);\r\n#endif\r\n\r\n#ifndef GL_SUN_mesh_array\r\n#define GL_SUN_mesh_array 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width);\r\n#endif\r\n\r\n#ifndef GL_SUN_slice_accum\r\n#define GL_SUN_slice_accum 1\r\n#endif\r\n\r\n#ifndef GL_NV_multisample_filter_hint\r\n#define GL_NV_multisample_filter_hint 1\r\n#endif\r\n\r\n#ifndef GL_NV_depth_clamp\r\n#define GL_NV_depth_clamp 1\r\n#endif\r\n\r\n#ifndef GL_NV_occlusion_query\r\n#define GL_NV_occlusion_query 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids);\r\nGLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids);\r\nGLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id);\r\nGLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id);\r\nGLAPI void APIENTRY glEndOcclusionQueryNV (void);\r\nGLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);\r\ntypedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);\r\ntypedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void);\r\ntypedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);\r\n#endif\r\n\r\n#ifndef GL_NV_point_sprite\r\n#define GL_NV_point_sprite 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param);\r\nGLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params);\r\n#endif\r\n\r\n#ifndef GL_NV_texture_shader3\r\n#define GL_NV_texture_shader3 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program1_1\r\n#define GL_NV_vertex_program1_1 1\r\n#endif\r\n\r\n#ifndef GL_EXT_shadow_funcs\r\n#define GL_EXT_shadow_funcs 1\r\n#endif\r\n\r\n#ifndef GL_EXT_stencil_two_side\r\n#define GL_EXT_stencil_two_side 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);\r\n#endif\r\n\r\n#ifndef GL_ATI_text_fragment_shader\r\n#define GL_ATI_text_fragment_shader 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_client_storage\r\n#define GL_APPLE_client_storage 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_element_array\r\n#define GL_APPLE_element_array 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const GLvoid *pointer);\r\nGLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count);\r\nGLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);\r\nGLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);\r\nGLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);\r\ntypedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);\r\n#endif\r\n\r\n#ifndef GL_APPLE_fence\r\n#define GL_APPLE_fence 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences);\r\nGLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences);\r\nGLAPI void APIENTRY glSetFenceAPPLE (GLuint fence);\r\nGLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence);\r\nGLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence);\r\nGLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence);\r\nGLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name);\r\nGLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences);\r\ntypedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences);\r\ntypedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence);\r\ntypedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence);\r\ntypedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence);\r\ntypedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);\r\ntypedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);\r\ntypedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);\r\n#endif\r\n\r\n#ifndef GL_APPLE_vertex_array_object\r\n#define GL_APPLE_vertex_array_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array);\r\nGLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays);\r\nGLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays);\r\nGLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);\r\ntypedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);\r\ntypedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);\r\ntypedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);\r\n#endif\r\n\r\n#ifndef GL_APPLE_vertex_array_range\r\n#define GL_APPLE_vertex_array_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer);\r\nGLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer);\r\nGLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);\r\n#endif\r\n\r\n#ifndef GL_APPLE_ycbcr_422\r\n#define GL_APPLE_ycbcr_422 1\r\n#endif\r\n\r\n#ifndef GL_S3_s3tc\r\n#define GL_S3_s3tc 1\r\n#endif\r\n\r\n#ifndef GL_ATI_draw_buffers\r\n#define GL_ATI_draw_buffers 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs);\r\n#endif\r\n\r\n#ifndef GL_ATI_pixel_format_float\r\n#define GL_ATI_pixel_format_float 1\r\n/* This is really a WGL extension, but defines some associated GL enums.\r\n * ATI does not export \"GL_ATI_pixel_format_float\" in the GL_EXTENSIONS string.\r\n */\r\n#endif\r\n\r\n#ifndef GL_ATI_texture_env_combine3\r\n#define GL_ATI_texture_env_combine3 1\r\n#endif\r\n\r\n#ifndef GL_ATI_texture_float\r\n#define GL_ATI_texture_float 1\r\n#endif\r\n\r\n#ifndef GL_NV_float_buffer\r\n#define GL_NV_float_buffer 1\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program\r\n#define GL_NV_fragment_program 1\r\n/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);\r\nGLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);\r\nGLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);\r\nGLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);\r\ntypedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);\r\n#endif\r\n\r\n#ifndef GL_NV_half_float\r\n#define GL_NV_half_float 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y);\r\nGLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z);\r\nGLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);\r\nGLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);\r\nGLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);\r\nGLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);\r\nGLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s);\r\nGLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t);\r\nGLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r);\r\nGLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);\r\nGLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s);\r\nGLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v);\r\nGLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t);\r\nGLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v);\r\nGLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);\r\nGLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v);\r\nGLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);\r\nGLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v);\r\nGLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);\r\nGLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);\r\nGLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);\r\nGLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);\r\nGLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);\r\nGLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x);\r\nGLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y);\r\nGLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);\r\nGLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);\r\nGLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v);\r\nGLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y);\r\ntypedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z);\r\ntypedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);\r\ntypedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);\r\ntypedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);\r\ntypedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);\r\ntypedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);\r\ntypedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);\r\n#endif\r\n\r\n#ifndef GL_NV_pixel_data_range\r\n#define GL_NV_pixel_data_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const GLvoid *pointer);\r\nGLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);\r\n#endif\r\n\r\n#ifndef GL_NV_primitive_restart\r\n#define GL_NV_primitive_restart 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPrimitiveRestartNV (void);\r\nGLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void);\r\ntypedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);\r\n#endif\r\n\r\n#ifndef GL_NV_texture_expand_normal\r\n#define GL_NV_texture_expand_normal 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program2\r\n#define GL_NV_vertex_program2 1\r\n#endif\r\n\r\n#ifndef GL_ATI_map_object_buffer\r\n#define GL_ATI_map_object_buffer 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint buffer);\r\nGLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);\r\n#endif\r\n\r\n#ifndef GL_ATI_separate_stencil\r\n#define GL_ATI_separate_stencil 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\r\nGLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\r\ntypedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\r\n#endif\r\n\r\n#ifndef GL_ATI_vertex_attrib_array_object\r\n#define GL_ATI_vertex_attrib_array_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);\r\nGLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_OES_byte_coordinates\r\n#define GL_OES_byte_coordinates 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s);\r\nGLAPI void APIENTRY glMultiTexCoord1bvOES (GLenum texture, const GLbyte *coords);\r\nGLAPI void APIENTRY glMultiTexCoord2bOES (GLenum texture, GLbyte s, GLbyte t);\r\nGLAPI void APIENTRY glMultiTexCoord2bvOES (GLenum texture, const GLbyte *coords);\r\nGLAPI void APIENTRY glMultiTexCoord3bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r);\r\nGLAPI void APIENTRY glMultiTexCoord3bvOES (GLenum texture, const GLbyte *coords);\r\nGLAPI void APIENTRY glMultiTexCoord4bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q);\r\nGLAPI void APIENTRY glMultiTexCoord4bvOES (GLenum texture, const GLbyte *coords);\r\nGLAPI void APIENTRY glTexCoord1bOES (GLbyte s);\r\nGLAPI void APIENTRY glTexCoord1bvOES (const GLbyte *coords);\r\nGLAPI void APIENTRY glTexCoord2bOES (GLbyte s, GLbyte t);\r\nGLAPI void APIENTRY glTexCoord2bvOES (const GLbyte *coords);\r\nGLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r);\r\nGLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords);\r\nGLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q);\r\nGLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords);\r\nGLAPI void APIENTRY glVertex2bOES (GLbyte x);\r\nGLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords);\r\nGLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y);\r\nGLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords);\r\nGLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z);\r\nGLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD1BOESPROC) (GLbyte s);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD1BVOESPROC) (const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2BVOESPROC) (const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x);\r\ntypedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y);\r\ntypedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z);\r\ntypedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords);\r\n#endif\r\n\r\n#ifndef GL_OES_fixed_point\r\n#define GL_OES_fixed_point 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glAccumxOES (GLenum op, GLfixed value);\r\nGLAPI void APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref);\r\nGLAPI void APIENTRY glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap);\r\nGLAPI void APIENTRY glBlendColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\nGLAPI void APIENTRY glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\nGLAPI void APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\nGLAPI void APIENTRY glClearDepthxOES (GLfixed depth);\r\nGLAPI void APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);\r\nGLAPI void APIENTRY glColor3xOES (GLfixed red, GLfixed green, GLfixed blue);\r\nGLAPI void APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\nGLAPI void APIENTRY glColor3xvOES (const GLfixed *components);\r\nGLAPI void APIENTRY glColor4xvOES (const GLfixed *components);\r\nGLAPI void APIENTRY glConvolutionParameterxOES (GLenum target, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glConvolutionParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);\r\nGLAPI void APIENTRY glDepthRangexOES (GLfixed n, GLfixed f);\r\nGLAPI void APIENTRY glEvalCoord1xOES (GLfixed u);\r\nGLAPI void APIENTRY glEvalCoord2xOES (GLfixed u, GLfixed v);\r\nGLAPI void APIENTRY glEvalCoord1xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glEvalCoord2xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glFeedbackBufferxOES (GLsizei n, GLenum type, const GLfixed *buffer);\r\nGLAPI void APIENTRY glFogxOES (GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glFogxvOES (GLenum pname, const GLfixed *param);\r\nGLAPI void APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);\r\nGLAPI void APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation);\r\nGLAPI void APIENTRY glGetConvolutionParameterxvOES (GLenum target, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetHistogramParameterxvOES (GLenum target, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetLightxOES (GLenum light, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetMapxvOES (GLenum target, GLenum query, GLfixed *v);\r\nGLAPI void APIENTRY glGetMaterialxOES (GLenum face, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glGetPixelMapxv (GLenum map, GLint size, GLfixed *values);\r\nGLAPI void APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetTexLevelParameterxvOES (GLenum target, GLint level, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);\r\nGLAPI void APIENTRY glIndexxOES (GLfixed component);\r\nGLAPI void APIENTRY glIndexxvOES (const GLfixed *component);\r\nGLAPI void APIENTRY glLightModelxOES (GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param);\r\nGLAPI void APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);\r\nGLAPI void APIENTRY glLineWidthxOES (GLfixed width);\r\nGLAPI void APIENTRY glLoadMatrixxOES (const GLfixed *m);\r\nGLAPI void APIENTRY glLoadTransposeMatrixxOES (const GLfixed *m);\r\nGLAPI void APIENTRY glMap1xOES (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points);\r\nGLAPI void APIENTRY glMap2xOES (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points);\r\nGLAPI void APIENTRY glMapGrid1xOES (GLint n, GLfixed u1, GLfixed u2);\r\nGLAPI void APIENTRY glMapGrid2xOES (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2);\r\nGLAPI void APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param);\r\nGLAPI void APIENTRY glMultMatrixxOES (const GLfixed *m);\r\nGLAPI void APIENTRY glMultTransposeMatrixxOES (const GLfixed *m);\r\nGLAPI void APIENTRY glMultiTexCoord1xOES (GLenum texture, GLfixed s);\r\nGLAPI void APIENTRY glMultiTexCoord2xOES (GLenum texture, GLfixed s, GLfixed t);\r\nGLAPI void APIENTRY glMultiTexCoord3xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r);\r\nGLAPI void APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);\r\nGLAPI void APIENTRY glMultiTexCoord1xvOES (GLenum texture, const GLfixed *coords);\r\nGLAPI void APIENTRY glMultiTexCoord2xvOES (GLenum texture, const GLfixed *coords);\r\nGLAPI void APIENTRY glMultiTexCoord3xvOES (GLenum texture, const GLfixed *coords);\r\nGLAPI void APIENTRY glMultiTexCoord4xvOES (GLenum texture, const GLfixed *coords);\r\nGLAPI void APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);\r\nGLAPI void APIENTRY glNormal3xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);\r\nGLAPI void APIENTRY glPassThroughxOES (GLfixed token);\r\nGLAPI void APIENTRY glPixelMapx (GLenum map, GLint size, const GLfixed *values);\r\nGLAPI void APIENTRY glPixelStorex (GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glPixelTransferxOES (GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glPixelZoomxOES (GLfixed xfactor, GLfixed yfactor);\r\nGLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);\r\nGLAPI void APIENTRY glPointSizexOES (GLfixed size);\r\nGLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);\r\nGLAPI void APIENTRY glPrioritizeTexturesxOES (GLsizei n, const GLuint *textures, const GLfixed *priorities);\r\nGLAPI void APIENTRY glRasterPos2xOES (GLfixed x, GLfixed y);\r\nGLAPI void APIENTRY glRasterPos3xOES (GLfixed x, GLfixed y, GLfixed z);\r\nGLAPI void APIENTRY glRasterPos4xOES (GLfixed x, GLfixed y, GLfixed z, GLfixed w);\r\nGLAPI void APIENTRY glRasterPos2xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glRasterPos3xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glRasterPos4xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glRectxOES (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2);\r\nGLAPI void APIENTRY glRectxvOES (const GLfixed *v1, const GLfixed *v2);\r\nGLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);\r\nGLAPI void APIENTRY glSampleCoverageOES (GLfixed value, GLboolean invert);\r\nGLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);\r\nGLAPI void APIENTRY glTexCoord1xOES (GLfixed s);\r\nGLAPI void APIENTRY glTexCoord2xOES (GLfixed s, GLfixed t);\r\nGLAPI void APIENTRY glTexCoord3xOES (GLfixed s, GLfixed t, GLfixed r);\r\nGLAPI void APIENTRY glTexCoord4xOES (GLfixed s, GLfixed t, GLfixed r, GLfixed q);\r\nGLAPI void APIENTRY glTexCoord1xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glTexCoord2xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glTexCoord3xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glTexCoord4xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);\r\nGLAPI void APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);\r\nGLAPI void APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);\r\nGLAPI void APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);\r\nGLAPI void APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);\r\nGLAPI void APIENTRY glVertex2xOES (GLfixed x);\r\nGLAPI void APIENTRY glVertex3xOES (GLfixed x, GLfixed y);\r\nGLAPI void APIENTRY glVertex4xOES (GLfixed x, GLfixed y, GLfixed z);\r\nGLAPI void APIENTRY glVertex2xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glVertex3xvOES (const GLfixed *coords);\r\nGLAPI void APIENTRY glVertex4xvOES (const GLfixed *coords);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLACCUMXOESPROC) (GLenum op, GLfixed value);\r\ntypedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref);\r\ntypedef void (APIENTRYP PFNGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap);\r\ntypedef void (APIENTRYP PFNGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\ntypedef void (APIENTRYP PFNGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\ntypedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\ntypedef void (APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth);\r\ntypedef void (APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);\r\ntypedef void (APIENTRYP PFNGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue);\r\ntypedef void (APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\ntypedef void (APIENTRYP PFNGLCOLOR3XVOESPROC) (const GLfixed *components);\r\ntypedef void (APIENTRYP PFNGLCOLOR4XVOESPROC) (const GLfixed *components);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f);\r\ntypedef void (APIENTRYP PFNGLEVALCOORD1XOESPROC) (GLfixed u);\r\ntypedef void (APIENTRYP PFNGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v);\r\ntypedef void (APIENTRYP PFNGLEVALCOORD1XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLEVALCOORD2XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer);\r\ntypedef void (APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param);\r\ntypedef void (APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);\r\ntypedef void (APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation);\r\ntypedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v);\r\ntypedef void (APIENTRYP PFNGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values);\r\ntypedef void (APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLINDEXXOESPROC) (GLfixed component);\r\ntypedef void (APIENTRYP PFNGLINDEXXVOESPROC) (const GLfixed *component);\r\ntypedef void (APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param);\r\ntypedef void (APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);\r\ntypedef void (APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);\r\ntypedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m);\r\ntypedef void (APIENTRYP PFNGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points);\r\ntypedef void (APIENTRYP PFNGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points);\r\ntypedef void (APIENTRYP PFNGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2);\r\ntypedef void (APIENTRYP PFNGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2);\r\ntypedef void (APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param);\r\ntypedef void (APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);\r\ntypedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);\r\ntypedef void (APIENTRYP PFNGLNORMAL3XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);\r\ntypedef void (APIENTRYP PFNGLPASSTHROUGHXOESPROC) (GLfixed token);\r\ntypedef void (APIENTRYP PFNGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values);\r\ntypedef void (APIENTRYP PFNGLPIXELSTOREXPROC) (GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor);\r\ntypedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);\r\ntypedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);\r\ntypedef void (APIENTRYP PFNGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities);\r\ntypedef void (APIENTRYP PFNGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y);\r\ntypedef void (APIENTRYP PFNGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z);\r\ntypedef void (APIENTRYP PFNGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w);\r\ntypedef void (APIENTRYP PFNGLRASTERPOS2XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLRASTERPOS3XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLRASTERPOS4XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2);\r\ntypedef void (APIENTRYP PFNGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2);\r\ntypedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);\r\ntypedef void (APIENTRYP PFNGLSAMPLECOVERAGEOESPROC) (GLfixed value, GLboolean invert);\r\ntypedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD1XOESPROC) (GLfixed s);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD1XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD2XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD3XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLTEXCOORD4XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);\r\ntypedef void (APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);\r\ntypedef void (APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);\r\ntypedef void (APIENTRYP PFNGLVERTEX2XOESPROC) (GLfixed x);\r\ntypedef void (APIENTRYP PFNGLVERTEX3XOESPROC) (GLfixed x, GLfixed y);\r\ntypedef void (APIENTRYP PFNGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z);\r\ntypedef void (APIENTRYP PFNGLVERTEX2XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEX3XVOESPROC) (const GLfixed *coords);\r\ntypedef void (APIENTRYP PFNGLVERTEX4XVOESPROC) (const GLfixed *coords);\r\n#endif\r\n\r\n#ifndef GL_OES_single_precision\r\n#define GL_OES_single_precision 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDepthRangefOES (GLclampf n, GLclampf f);\r\nGLAPI void APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\r\nGLAPI void APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\r\nGLAPI void APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);\r\nGLAPI void APIENTRY glClearDepthfOES (GLclampf depth);\r\nGLAPI void APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);\r\ntypedef void (APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\r\ntypedef void (APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);\r\ntypedef void (APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);\r\ntypedef void (APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);\r\ntypedef void (APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation);\r\n#endif\r\n\r\n#ifndef GL_OES_compressed_paletted_texture\r\n#define GL_OES_compressed_paletted_texture 1\r\n#endif\r\n\r\n#ifndef GL_OES_read_format\r\n#define GL_OES_read_format 1\r\n#endif\r\n\r\n#ifndef GL_OES_query_matrix\r\n#define GL_OES_query_matrix 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLbitfield APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLbitfield (APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent);\r\n#endif\r\n\r\n#ifndef GL_EXT_depth_bounds_test\r\n#define GL_EXT_depth_bounds_test 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_mirror_clamp\r\n#define GL_EXT_texture_mirror_clamp 1\r\n#endif\r\n\r\n#ifndef GL_EXT_blend_equation_separate\r\n#define GL_EXT_blend_equation_separate 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);\r\n#endif\r\n\r\n#ifndef GL_MESA_pack_invert\r\n#define GL_MESA_pack_invert 1\r\n#endif\r\n\r\n#ifndef GL_MESA_ycbcr_texture\r\n#define GL_MESA_ycbcr_texture 1\r\n#endif\r\n\r\n#ifndef GL_EXT_pixel_buffer_object\r\n#define GL_EXT_pixel_buffer_object 1\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program_option\r\n#define GL_NV_fragment_program_option 1\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program2\r\n#define GL_NV_fragment_program2 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program2_option\r\n#define GL_NV_vertex_program2_option 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program3\r\n#define GL_NV_vertex_program3 1\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_object\r\n#define GL_EXT_framebuffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer);\r\nGLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer);\r\nGLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers);\r\nGLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers);\r\nGLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer);\r\nGLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer);\r\nGLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers);\r\nGLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers);\r\nGLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target);\r\nGLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\nGLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\nGLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGenerateMipmapEXT (GLenum target);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);\r\ntypedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);\r\ntypedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);\r\ntypedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);\r\ntypedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);\r\ntypedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);\r\ntypedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);\r\n#endif\r\n\r\n#ifndef GL_GREMEDY_string_marker\r\n#define GL_GREMEDY_string_marker 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const GLvoid *string);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string);\r\n#endif\r\n\r\n#ifndef GL_EXT_packed_depth_stencil\r\n#define GL_EXT_packed_depth_stencil 1\r\n#endif\r\n\r\n#ifndef GL_EXT_stencil_clear_tag\r\n#define GL_EXT_stencil_clear_tag 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_sRGB\r\n#define GL_EXT_texture_sRGB 1\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_blit\r\n#define GL_EXT_framebuffer_blit 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_multisample\r\n#define GL_EXT_framebuffer_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\n#endif\r\n\r\n#ifndef GL_MESAX_texture_stack\r\n#define GL_MESAX_texture_stack 1\r\n#endif\r\n\r\n#ifndef GL_EXT_timer_query\r\n#define GL_EXT_timer_query 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64EXT *params);\r\nGLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64EXT *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_gpu_program_parameters\r\n#define GL_EXT_gpu_program_parameters 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);\r\nGLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);\r\n#endif\r\n\r\n#ifndef GL_APPLE_flush_buffer_range\r\n#define GL_APPLE_flush_buffer_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);\r\n#endif\r\n\r\n#ifndef GL_NV_gpu_program4\r\n#define GL_NV_gpu_program4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params);\r\nGLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);\r\nGLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\nGLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);\r\nGLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\nGLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params);\r\nGLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);\r\nGLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\nGLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);\r\nGLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\nGLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params);\r\nGLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params);\r\nGLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params);\r\nGLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);\r\n#endif\r\n\r\n#ifndef GL_NV_geometry_program4\r\n#define GL_NV_geometry_program4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit);\r\nGLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\nGLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\n#endif\r\n\r\n#ifndef GL_EXT_geometry_shader4\r\n#define GL_EXT_geometry_shader4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_program4\r\n#define GL_NV_vertex_program4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);\r\nGLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);\r\nGLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);\r\nGLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);\r\nGLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);\r\nGLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);\r\nGLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\nGLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);\r\nGLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);\r\nGLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);\r\nGLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);\r\nGLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);\r\nGLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);\r\nGLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_gpu_shader4\r\n#define GL_EXT_gpu_shader4 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params);\r\nGLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);\r\nGLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name);\r\nGLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0);\r\nGLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1);\r\nGLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2);\r\nGLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\nGLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);\r\ntypedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);\r\n#endif\r\n\r\n#ifndef GL_EXT_draw_instanced\r\n#define GL_EXT_draw_instanced 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);\r\nGLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);\r\ntypedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);\r\n#endif\r\n\r\n#ifndef GL_EXT_packed_float\r\n#define GL_EXT_packed_float 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_array\r\n#define GL_EXT_texture_array 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_buffer_object\r\n#define GL_EXT_texture_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_compression_latc\r\n#define GL_EXT_texture_compression_latc 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_compression_rgtc\r\n#define GL_EXT_texture_compression_rgtc 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_shared_exponent\r\n#define GL_EXT_texture_shared_exponent 1\r\n#endif\r\n\r\n#ifndef GL_NV_depth_buffer_float\r\n#define GL_NV_depth_buffer_float 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar);\r\nGLAPI void APIENTRY glClearDepthdNV (GLdouble depth);\r\nGLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);\r\ntypedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);\r\ntypedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);\r\n#endif\r\n\r\n#ifndef GL_NV_fragment_program4\r\n#define GL_NV_fragment_program4 1\r\n#endif\r\n\r\n#ifndef GL_NV_framebuffer_multisample_coverage\r\n#define GL_NV_framebuffer_multisample_coverage 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_sRGB\r\n#define GL_EXT_framebuffer_sRGB 1\r\n#endif\r\n\r\n#ifndef GL_NV_geometry_shader4\r\n#define GL_NV_geometry_shader4 1\r\n#endif\r\n\r\n#ifndef GL_NV_parameter_buffer_object\r\n#define GL_NV_parameter_buffer_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params);\r\nGLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params);\r\nGLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_draw_buffers2\r\n#define GL_EXT_draw_buffers2 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\r\nGLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data);\r\nGLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data);\r\nGLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index);\r\nGLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index);\r\nGLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\r\ntypedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);\r\ntypedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);\r\ntypedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);\r\ntypedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);\r\ntypedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);\r\n#endif\r\n\r\n#ifndef GL_NV_transform_feedback\r\n#define GL_NV_transform_feedback 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode);\r\nGLAPI void APIENTRY glEndTransformFeedbackNV (void);\r\nGLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode);\r\nGLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\nGLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\r\nGLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer);\r\nGLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);\r\nGLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name);\r\nGLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name);\r\nGLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\nGLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location);\r\nGLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);\r\ntypedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);\r\ntypedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);\r\ntypedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);\r\ntypedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\ntypedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);\r\ntypedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);\r\n#endif\r\n\r\n#ifndef GL_EXT_bindable_uniform\r\n#define GL_EXT_bindable_uniform 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer);\r\nGLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location);\r\nGLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);\r\ntypedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);\r\ntypedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_integer\r\n#define GL_EXT_texture_integer 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);\r\nGLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha);\r\nGLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);\r\ntypedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);\r\n#endif\r\n\r\n#ifndef GL_GREMEDY_frame_terminator\r\n#define GL_GREMEDY_frame_terminator 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glFrameTerminatorGREMEDY (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_NV_conditional_render\r\n#define GL_NV_conditional_render 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);\r\nGLAPI void APIENTRY glEndConditionalRenderNV (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_NV_present_video\r\n#define GL_NV_present_video 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);\r\nGLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);\r\nGLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params);\r\nGLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);\r\ntypedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);\r\n#endif\r\n\r\n#ifndef GL_EXT_transform_feedback\r\n#define GL_EXT_transform_feedback 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode);\r\nGLAPI void APIENTRY glEndTransformFeedbackEXT (void);\r\nGLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\nGLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\r\nGLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer);\r\nGLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);\r\nGLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);\r\ntypedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);\r\ntypedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);\r\ntypedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\r\n#endif\r\n\r\n#ifndef GL_EXT_direct_state_access\r\n#define GL_EXT_direct_state_access 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask);\r\nGLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask);\r\nGLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);\r\nGLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);\r\nGLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);\r\nGLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);\r\nGLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode);\r\nGLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);\r\nGLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\r\nGLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\r\nGLAPI void APIENTRY glMatrixPopEXT (GLenum mode);\r\nGLAPI void APIENTRY glMatrixPushEXT (GLenum mode);\r\nGLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);\r\nGLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);\r\nGLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);\r\nGLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);\r\nGLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\nGLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\nGLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\r\nGLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\nGLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\nGLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\nGLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\r\nGLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\nGLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture);\r\nGLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index);\r\nGLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index);\r\nGLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);\r\nGLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);\r\nGLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);\r\nGLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param);\r\nGLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data);\r\nGLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data);\r\nGLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, GLvoid* *data);\r\nGLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, GLvoid *img);\r\nGLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\nGLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, GLvoid *img);\r\nGLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string);\r\nGLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params);\r\nGLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\nGLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params);\r\nGLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params);\r\nGLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params);\r\nGLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, GLvoid *string);\r\nGLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);\r\nGLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\nGLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params);\r\nGLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);\r\nGLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\nGLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params);\r\nGLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\nGLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params);\r\nGLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params);\r\nGLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params);\r\nGLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);\r\nGLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params);\r\nGLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);\r\nGLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);\r\nGLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\nGLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\nGLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);\r\nGLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);\r\nGLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\r\nGLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\nGLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\nGLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);\r\nGLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);\r\nGLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\r\nGLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\nGLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\nGLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage);\r\nGLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);\r\nGLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access);\r\nGLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer);\r\nGLAPI GLvoid* APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\r\nGLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);\r\nGLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\r\nGLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, GLvoid* *params);\r\nGLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);\r\nGLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);\r\nGLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);\r\nGLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params);\r\nGLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target);\r\nGLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\nGLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\nGLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target);\r\nGLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target);\r\nGLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode);\r\nGLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs);\r\nGLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode);\r\nGLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\r\nGLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\r\nGLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\nGLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\nGLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer);\r\nGLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer);\r\nGLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);\r\nGLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\nGLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);\r\ntypedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);\r\ntypedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);\r\ntypedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);\r\ntypedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\r\ntypedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\r\ntypedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);\r\ntypedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);\r\ntypedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);\r\ntypedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);\r\ntypedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);\r\ntypedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\ntypedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\r\ntypedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\r\ntypedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);\r\ntypedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);\r\ntypedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);\r\ntypedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);\r\ntypedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data);\r\ntypedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data);\r\ntypedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid* *data);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, GLvoid *img);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);\r\ntypedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, GLvoid *img);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, GLvoid *string);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);\r\ntypedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage);\r\ntypedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);\r\ntypedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\r\ntypedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);\r\ntypedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params);\r\ntypedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);\r\ntypedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);\r\ntypedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\r\ntypedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);\r\ntypedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_array_bgra\r\n#define GL_EXT_vertex_array_bgra 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_swizzle\r\n#define GL_EXT_texture_swizzle 1\r\n#endif\r\n\r\n#ifndef GL_NV_explicit_multisample\r\n#define GL_NV_explicit_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val);\r\nGLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask);\r\nGLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);\r\ntypedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);\r\ntypedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);\r\n#endif\r\n\r\n#ifndef GL_NV_transform_feedback2\r\n#define GL_NV_transform_feedback2 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id);\r\nGLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids);\r\nGLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids);\r\nGLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id);\r\nGLAPI void APIENTRY glPauseTransformFeedbackNV (void);\r\nGLAPI void APIENTRY glResumeTransformFeedbackNV (void);\r\nGLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);\r\ntypedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);\r\ntypedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids);\r\ntypedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);\r\ntypedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);\r\ntypedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);\r\n#endif\r\n\r\n#ifndef GL_ATI_meminfo\r\n#define GL_ATI_meminfo 1\r\n#endif\r\n\r\n#ifndef GL_AMD_performance_monitor\r\n#define GL_AMD_performance_monitor 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);\r\nGLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);\r\nGLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);\r\nGLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);\r\nGLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);\r\nGLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);\r\nGLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);\r\nGLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);\r\nGLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor);\r\nGLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor);\r\nGLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);\r\ntypedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);\r\ntypedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);\r\ntypedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);\r\ntypedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);\r\ntypedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);\r\ntypedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);\r\ntypedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);\r\ntypedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);\r\ntypedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);\r\ntypedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);\r\n#endif\r\n\r\n#ifndef GL_AMD_texture_texture4\r\n#define GL_AMD_texture_texture4 1\r\n#endif\r\n\r\n#ifndef GL_AMD_vertex_shader_tessellator\r\n#define GL_AMD_vertex_shader_tessellator 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor);\r\nGLAPI void APIENTRY glTessellationModeAMD (GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);\r\ntypedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_EXT_provoking_vertex\r\n#define GL_EXT_provoking_vertex 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProvokingVertexEXT (GLenum mode);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_snorm\r\n#define GL_EXT_texture_snorm 1\r\n#endif\r\n\r\n#ifndef GL_AMD_draw_buffers_blend\r\n#define GL_AMD_draw_buffers_blend 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst);\r\nGLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\nGLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode);\r\nGLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);\r\ntypedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);\r\ntypedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);\r\n#endif\r\n\r\n#ifndef GL_APPLE_texture_range\r\n#define GL_APPLE_texture_range 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const GLvoid *pointer);\r\nGLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, GLvoid* *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params);\r\n#endif\r\n\r\n#ifndef GL_APPLE_float_pixels\r\n#define GL_APPLE_float_pixels 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_vertex_program_evaluators\r\n#define GL_APPLE_vertex_program_evaluators 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname);\r\nGLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname);\r\nGLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname);\r\nGLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);\r\nGLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);\r\nGLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);\r\nGLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);\r\ntypedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);\r\ntypedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);\r\ntypedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);\r\ntypedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);\r\ntypedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);\r\ntypedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);\r\n#endif\r\n\r\n#ifndef GL_APPLE_aux_depth_stencil\r\n#define GL_APPLE_aux_depth_stencil 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_object_purgeable\r\n#define GL_APPLE_object_purgeable 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);\r\nGLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);\r\nGLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);\r\ntypedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);\r\ntypedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params);\r\n#endif\r\n\r\n#ifndef GL_APPLE_row_bytes\r\n#define GL_APPLE_row_bytes 1\r\n#endif\r\n\r\n#ifndef GL_APPLE_rgb_422\r\n#define GL_APPLE_rgb_422 1\r\n#endif\r\n\r\n#ifndef GL_NV_video_capture\r\n#define GL_NV_video_capture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot);\r\nGLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);\r\nGLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);\r\nGLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot);\r\nGLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);\r\nGLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);\r\nGLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);\r\nGLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);\r\nGLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);\r\nGLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);\r\nGLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);\r\ntypedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);\r\ntypedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);\r\ntypedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);\r\ntypedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);\r\ntypedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);\r\ntypedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);\r\ntypedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);\r\n#endif\r\n\r\n#ifndef GL_NV_copy_image\r\n#define GL_NV_copy_image 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\r\n#endif\r\n\r\n#ifndef GL_EXT_separate_shader_objects\r\n#define GL_EXT_separate_shader_objects 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program);\r\nGLAPI void APIENTRY glActiveProgramEXT (GLuint program);\r\nGLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);\r\ntypedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);\r\ntypedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);\r\n#endif\r\n\r\n#ifndef GL_NV_parameter_buffer_object2\r\n#define GL_NV_parameter_buffer_object2 1\r\n#endif\r\n\r\n#ifndef GL_NV_shader_buffer_load\r\n#define GL_NV_shader_buffer_load 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access);\r\nGLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target);\r\nGLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target);\r\nGLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access);\r\nGLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer);\r\nGLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer);\r\nGLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params);\r\nGLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params);\r\nGLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result);\r\nGLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value);\r\nGLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params);\r\nGLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value);\r\nGLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);\r\ntypedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);\r\ntypedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);\r\ntypedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);\r\ntypedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);\r\ntypedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);\r\ntypedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);\r\ntypedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_buffer_unified_memory\r\n#define GL_NV_vertex_buffer_unified_memory 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);\r\nGLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride);\r\nGLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);\r\nGLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);\r\nGLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);\r\ntypedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);\r\n#endif\r\n\r\n#ifndef GL_NV_texture_barrier\r\n#define GL_NV_texture_barrier 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTextureBarrierNV (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_AMD_shader_stencil_export\r\n#define GL_AMD_shader_stencil_export 1\r\n#endif\r\n\r\n#ifndef GL_AMD_seamless_cubemap_per_texture\r\n#define GL_AMD_seamless_cubemap_per_texture 1\r\n#endif\r\n\r\n#ifndef GL_AMD_conservative_depth\r\n#define GL_AMD_conservative_depth 1\r\n#endif\r\n\r\n#ifndef GL_EXT_shader_image_load_store\r\n#define GL_EXT_shader_image_load_store 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);\r\nGLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);\r\ntypedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);\r\n#endif\r\n\r\n#ifndef GL_EXT_vertex_attrib_64bit\r\n#define GL_EXT_vertex_attrib_64bit 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x);\r\nGLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y);\r\nGLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\nGLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\nGLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v);\r\nGLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\nGLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params);\r\nGLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params);\r\ntypedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);\r\n#endif\r\n\r\n#ifndef GL_NV_gpu_program5\r\n#define GL_NV_gpu_program5 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params);\r\nGLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params);\r\ntypedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param);\r\n#endif\r\n\r\n#ifndef GL_NV_gpu_shader5\r\n#define GL_NV_gpu_shader5 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);\r\nGLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);\r\nGLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\nGLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\nGLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);\r\nGLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);\r\nGLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\nGLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\nGLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);\r\nGLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);\r\nGLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);\r\nGLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\nGLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\nGLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);\r\nGLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);\r\nGLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\nGLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\nGLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\nGLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\ntypedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);\r\n#endif\r\n\r\n#ifndef GL_NV_shader_buffer_store\r\n#define GL_NV_shader_buffer_store 1\r\n#endif\r\n\r\n#ifndef GL_NV_tessellation_program5\r\n#define GL_NV_tessellation_program5 1\r\n#endif\r\n\r\n#ifndef GL_NV_vertex_attrib_integer_64bit\r\n#define GL_NV_vertex_attrib_integer_64bit 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x);\r\nGLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y);\r\nGLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\nGLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\nGLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x);\r\nGLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y);\r\nGLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\nGLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\nGLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v);\r\nGLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v);\r\nGLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params);\r\nGLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params);\r\nGLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params);\r\ntypedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);\r\n#endif\r\n\r\n#ifndef GL_NV_multisample_coverage\r\n#define GL_NV_multisample_coverage 1\r\n#endif\r\n\r\n#ifndef GL_AMD_name_gen_delete\r\n#define GL_AMD_name_gen_delete 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names);\r\nGLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names);\r\nGLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names);\r\ntypedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names);\r\ntypedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);\r\n#endif\r\n\r\n#ifndef GL_AMD_debug_output\r\n#define GL_AMD_debug_output 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\r\nGLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);\r\nGLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, GLvoid *userParam);\r\nGLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);\r\ntypedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam);\r\ntypedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);\r\n#endif\r\n\r\n#ifndef GL_NV_vdpau_interop\r\n#define GL_NV_vdpau_interop 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress);\r\nGLAPI void APIENTRY glVDPAUFiniNV (void);\r\nGLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\r\nGLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\r\nGLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);\r\nGLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);\r\nGLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);\r\nGLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access);\r\nGLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);\r\nGLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress);\r\ntypedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);\r\ntypedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\r\ntypedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);\r\ntypedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);\r\ntypedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);\r\ntypedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);\r\ntypedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);\r\ntypedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);\r\ntypedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);\r\n#endif\r\n\r\n#ifndef GL_AMD_transform_feedback3_lines_triangles\r\n#define GL_AMD_transform_feedback3_lines_triangles 1\r\n#endif\r\n\r\n#ifndef GL_AMD_depth_clamp_separate\r\n#define GL_AMD_depth_clamp_separate 1\r\n#endif\r\n\r\n#ifndef GL_EXT_texture_sRGB_decode\r\n#define GL_EXT_texture_sRGB_decode 1\r\n#endif\r\n\r\n#ifndef GL_NV_texture_multisample\r\n#define GL_NV_texture_multisample 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\nGLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\nGLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\nGLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\nGLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\nGLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\ntypedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);\r\ntypedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);\r\n#endif\r\n\r\n#ifndef GL_AMD_blend_minmax_factor\r\n#define GL_AMD_blend_minmax_factor 1\r\n#endif\r\n\r\n#ifndef GL_AMD_sample_positions\r\n#define GL_AMD_sample_positions 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val);\r\n#endif\r\n\r\n#ifndef GL_EXT_x11_sync_object\r\n#define GL_EXT_x11_sync_object 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);\r\n#endif\r\n\r\n#ifndef GL_AMD_multi_draw_indirect\r\n#define GL_AMD_multi_draw_indirect 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);\r\nGLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);\r\ntypedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);\r\n#endif\r\n\r\n#ifndef GL_EXT_framebuffer_multisample_blit_scaled\r\n#define GL_EXT_framebuffer_multisample_blit_scaled 1\r\n#endif\r\n\r\n#ifndef GL_NV_path_rendering\r\n#define GL_NV_path_rendering 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLuint APIENTRY glGenPathsNV (GLsizei range);\r\nGLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range);\r\nGLAPI GLboolean APIENTRY glIsPathNV (GLuint path);\r\nGLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\nGLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\nGLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\nGLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\nGLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const GLvoid *pathString);\r\nGLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\r\nGLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\r\nGLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);\r\nGLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);\r\nGLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);\r\nGLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);\r\nGLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);\r\nGLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);\r\nGLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);\r\nGLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);\r\nGLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);\r\nGLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);\r\nGLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);\r\nGLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);\r\nGLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);\r\nGLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);\r\nGLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);\r\nGLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func);\r\nGLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);\r\nGLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);\r\nGLAPI void APIENTRY glPathFogGenNV (GLenum genMode);\r\nGLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);\r\nGLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);\r\nGLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\r\nGLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\r\nGLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);\r\nGLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);\r\nGLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);\r\nGLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);\r\nGLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);\r\nGLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);\r\nGLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);\r\nGLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);\r\nGLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value);\r\nGLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value);\r\nGLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value);\r\nGLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value);\r\nGLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);\r\nGLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);\r\nGLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);\r\nGLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);\r\ntypedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);\r\ntypedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path);\r\ntypedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\ntypedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\ntypedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\ntypedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const GLvoid *coords);\r\ntypedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const GLvoid *pathString);\r\ntypedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\r\ntypedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);\r\ntypedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);\r\ntypedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);\r\ntypedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);\r\ntypedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);\r\ntypedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);\r\ntypedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);\r\ntypedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);\r\ntypedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);\r\ntypedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);\r\ntypedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);\r\ntypedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);\r\ntypedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);\r\ntypedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);\r\ntypedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);\r\ntypedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode);\r\ntypedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);\r\ntypedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);\r\ntypedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);\r\ntypedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);\r\ntypedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);\r\ntypedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);\r\ntypedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);\r\ntypedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);\r\ntypedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);\r\ntypedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);\r\ntypedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value);\r\ntypedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value);\r\ntypedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value);\r\ntypedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value);\r\ntypedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);\r\ntypedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);\r\ntypedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);\r\ntypedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);\r\n#endif\r\n\r\n#ifndef GL_AMD_pinned_memory\r\n#define GL_AMD_pinned_memory 1\r\n#endif\r\n\r\n#ifndef GL_AMD_stencil_operation_extended\r\n#define GL_AMD_stencil_operation_extended 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);\r\n#endif\r\n\r\n#ifndef GL_AMD_vertex_shader_viewport_index\r\n#define GL_AMD_vertex_shader_viewport_index 1\r\n#endif\r\n\r\n#ifndef GL_AMD_vertex_shader_layer\r\n#define GL_AMD_vertex_shader_layer 1\r\n#endif\r\n\r\n#ifndef GL_NV_bindless_texture\r\n#define GL_NV_bindless_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture);\r\nGLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);\r\nGLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);\r\nGLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);\r\nGLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\r\nGLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);\r\nGLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);\r\nGLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);\r\nGLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);\r\nGLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);\r\nGLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);\r\nGLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);\r\nGLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);\r\ntypedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);\r\ntypedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);\r\ntypedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);\r\ntypedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\r\ntypedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);\r\ntypedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);\r\ntypedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);\r\ntypedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);\r\ntypedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);\r\ntypedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);\r\ntypedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);\r\n#endif\r\n\r\n#ifndef GL_NV_shader_atomic_float\r\n#define GL_NV_shader_atomic_float 1\r\n#endif\r\n\r\n#ifndef GL_AMD_query_buffer_object\r\n#define GL_AMD_query_buffer_object 1\r\n#endif\r\n\r\n#ifndef GL_NV_compute_program5\r\n#define GL_NV_compute_program5 1\r\n#endif\r\n\r\n#ifndef GL_NV_shader_storage_buffer_object\r\n#define GL_NV_shader_storage_buffer_object 1\r\n#endif\r\n\r\n#ifndef GL_NV_shader_atomic_counters\r\n#define GL_NV_shader_atomic_counters 1\r\n#endif\r\n\r\n#ifndef GL_NV_deep_texture3D\r\n#define GL_NV_deep_texture3D 1\r\n#endif\r\n\r\n#ifndef GL_NVX_conditional_render\r\n#define GL_NVX_conditional_render 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glBeginConditionalRenderNVX (GLuint id);\r\nGLAPI void APIENTRY glEndConditionalRenderNVX (void);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id);\r\ntypedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVXPROC) (void);\r\n#endif\r\n\r\n#ifndef GL_AMD_sparse_texture\r\n#define GL_AMD_sparse_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);\r\nGLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);\r\ntypedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);\r\n#endif\r\n\r\n#ifndef GL_AMD_shader_trinary_minmax\r\n#define GL_AMD_shader_trinary_minmax 1\r\n#endif\r\n\r\n#ifndef GL_INTEL_map_texture\r\n#define GL_INTEL_map_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glSyncTextureINTEL (GLuint texture);\r\nGLAPI void APIENTRY glUnmapTexture2DINTEL (GLuint texture, GLint level);\r\nGLAPI GLvoid* APIENTRY glMapTexture2DINTEL (GLuint texture, GLint level, GLbitfield access, const GLint *stride, const GLenum *layout);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLSYNCTEXTUREINTELPROC) (GLuint texture);\r\ntypedef void (APIENTRYP PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level);\r\ntypedef GLvoid* (APIENTRYP PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, const GLint *stride, const GLenum *layout);\r\n#endif\r\n\r\n#ifndef GL_NV_draw_texture\r\n#define GL_NV_draw_texture 1\r\n#ifdef GL_GLEXT_PROTOTYPES\r\nGLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);\r\n#endif /* GL_GLEXT_PROTOTYPES */\r\ntypedef void (APIENTRYP PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);\r\n#endif\r\n\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/glut.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __glut_h__\r\n#define __glut_h__\r\n\r\n/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */\r\n\r\n/* This program is freely distributable without licensing fees  and is\r\n   provided without guarantee or warrantee expressed or  implied. This\r\n   program is -not- in the public domain. */\r\n\r\n#if defined(_WIN32)\r\n\r\n/* GLUT 3.7 now tries to avoid including <windows.h>\r\n   to avoid name space pollution, but Win32's <GL/gl.h> \r\n   needs APIENTRY and WINGDIAPI defined properly. */\r\n# if 0\r\n#  define  WIN32_LEAN_AND_MEAN\r\n#  include <windows.h>\r\n# else\r\n   /* XXX This is from Win32's <windef.h> */\r\n#  ifndef APIENTRY\r\n#   define GLUT_APIENTRY_DEFINED\r\n#   if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)\r\n#    define APIENTRY    __stdcall\r\n#   else\r\n#    define APIENTRY\r\n#   endif\r\n#  endif\r\n   /* XXX This is from Win32's <winnt.h> */\r\n#  ifndef CALLBACK\r\n#   if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\r\n#    define CALLBACK __stdcall\r\n#   else\r\n#    define CALLBACK\r\n#   endif\r\n#  endif\r\n   /* XXX This is from Win32's <wingdi.h> and <winnt.h> */\r\n#  ifndef WINGDIAPI\r\n#   define GLUT_WINGDIAPI_DEFINED\r\n#   define WINGDIAPI __declspec(dllimport)\r\n#  endif\r\n   /* XXX This is from Win32's <ctype.h> */\r\n#  ifndef _WCHAR_T_DEFINED\r\ntypedef unsigned short wchar_t;\r\n#   define _WCHAR_T_DEFINED\r\n#  endif\r\n# endif\r\n\r\n#pragma comment (lib, \"winmm.lib\")     /* link with Windows MultiMedia lib */\r\n#pragma comment (lib, \"opengl32.lib\")  /* link with Microsoft OpenGL lib */\r\n#pragma comment (lib, \"glu32.lib\")     /* link with OpenGL Utility lib */\r\n#pragma comment (lib, \"glut32.lib\")    /* link with Win32 GLUT lib */\r\n\r\n#pragma warning (disable:4244)\t/* Disable bogus conversion warnings. */\r\n#pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */\r\n\r\n#endif\r\n\r\n#include <GL/gl.h>\r\n#include <GL/glu.h>\r\n\r\n/* define APIENTRY and CALLBACK to null string if we aren't on Win32 */\r\n#if !defined(_WIN32)\r\n#define APIENTRY\r\n#define GLUT_APIENTRY_DEFINED\r\n#define CALLBACK\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/**\r\n GLUT API revision history:\r\n \r\n GLUT_API_VERSION is updated to reflect incompatible GLUT\r\n API changes (interface changes, semantic changes, deletions,\r\n or additions).\r\n \r\n GLUT_API_VERSION=1  First public release of GLUT.  11/29/94\r\n\r\n GLUT_API_VERSION=2  Added support for OpenGL/GLX multisampling,\r\n extension.  Supports new input devices like tablet, dial and button\r\n box, and Spaceball.  Easy to query OpenGL extensions.\r\n\r\n GLUT_API_VERSION=3  glutMenuStatus added.\r\n\r\n GLUT_API_VERSION=4  glutInitDisplayString, glutWarpPointer,\r\n glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic\r\n video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,\r\n glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,\r\n glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).\r\n**/\r\n#ifndef GLUT_API_VERSION  /* allow this to be overriden */\r\n#define GLUT_API_VERSION\t\t3\r\n#endif\r\n\r\n/**\r\n GLUT implementation revision history:\r\n \r\n GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT\r\n API revisions and implementation revisions (ie, bug fixes).\r\n\r\n GLUT_XLIB_IMPLEMENTATION=1  mjk's first public release of\r\n GLUT Xlib-based implementation.  11/29/94\r\n\r\n GLUT_XLIB_IMPLEMENTATION=2  mjk's second public release of\r\n GLUT Xlib-based implementation providing GLUT version 2 \r\n interfaces.\r\n\r\n GLUT_XLIB_IMPLEMENTATION=3  mjk's GLUT 2.2 images. 4/17/95\r\n\r\n GLUT_XLIB_IMPLEMENTATION=4  mjk's GLUT 2.3 images. 6/?/95\r\n\r\n GLUT_XLIB_IMPLEMENTATION=5  mjk's GLUT 3.0 images. 10/?/95\r\n\r\n GLUT_XLIB_IMPLEMENTATION=7  mjk's GLUT 3.1+ with glutWarpPoitner.  7/24/96\r\n\r\n GLUT_XLIB_IMPLEMENTATION=8  mjk's GLUT 3.1+ with glutWarpPoitner\r\n and video resize.  1/3/97\r\n\r\n GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.\r\n\r\n GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.\r\n\r\n GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.\r\n\r\n GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 release with GameGLUT support.\r\n**/\r\n#ifndef GLUT_XLIB_IMPLEMENTATION  /* Allow this to be overriden. */\r\n#define GLUT_XLIB_IMPLEMENTATION\t13\r\n#endif\r\n\r\n/* Display mode bit masks. */\r\n#define GLUT_RGB\t\t\t0\r\n#define GLUT_RGBA\t\t\tGLUT_RGB\r\n#define GLUT_INDEX\t\t\t1\r\n#define GLUT_SINGLE\t\t\t0\r\n#define GLUT_DOUBLE\t\t\t2\r\n#define GLUT_ACCUM\t\t\t4\r\n#define GLUT_ALPHA\t\t\t8\r\n#define GLUT_DEPTH\t\t\t16\r\n#define GLUT_STENCIL\t\t\t32\r\n#if (GLUT_API_VERSION >= 2)\r\n#define GLUT_MULTISAMPLE\t\t128\r\n#define GLUT_STEREO\t\t\t256\r\n#endif\r\n#if (GLUT_API_VERSION >= 3)\r\n#define GLUT_LUMINANCE\t\t\t512\r\n#endif\r\n\r\n/* Mouse buttons. */\r\n#define GLUT_LEFT_BUTTON\t\t0\r\n#define GLUT_MIDDLE_BUTTON\t\t1\r\n#define GLUT_RIGHT_BUTTON\t\t2\r\n\r\n/* Mouse button  state. */\r\n#define GLUT_DOWN\t\t\t0\r\n#define GLUT_UP\t\t\t\t1\r\n\r\n#if (GLUT_API_VERSION >= 2)\r\n/* function keys */\r\n#define GLUT_KEY_F1\t\t\t1\r\n#define GLUT_KEY_F2\t\t\t2\r\n#define GLUT_KEY_F3\t\t\t3\r\n#define GLUT_KEY_F4\t\t\t4\r\n#define GLUT_KEY_F5\t\t\t5\r\n#define GLUT_KEY_F6\t\t\t6\r\n#define GLUT_KEY_F7\t\t\t7\r\n#define GLUT_KEY_F8\t\t\t8\r\n#define GLUT_KEY_F9\t\t\t9\r\n#define GLUT_KEY_F10\t\t\t10\r\n#define GLUT_KEY_F11\t\t\t11\r\n#define GLUT_KEY_F12\t\t\t12\r\n/* directional keys */\r\n#define GLUT_KEY_LEFT\t\t\t100\r\n#define GLUT_KEY_UP\t\t\t101\r\n#define GLUT_KEY_RIGHT\t\t\t102\r\n#define GLUT_KEY_DOWN\t\t\t103\r\n#define GLUT_KEY_PAGE_UP\t\t104\r\n#define GLUT_KEY_PAGE_DOWN\t\t105\r\n#define GLUT_KEY_HOME\t\t\t106\r\n#define GLUT_KEY_END\t\t\t107\r\n#define GLUT_KEY_INSERT\t\t\t108\r\n#endif\r\n\r\n/* Entry/exit  state. */\r\n#define GLUT_LEFT\t\t\t0\r\n#define GLUT_ENTERED\t\t\t1\r\n\r\n/* Menu usage  state. */\r\n#define GLUT_MENU_NOT_IN_USE\t\t0\r\n#define GLUT_MENU_IN_USE\t\t1\r\n\r\n/* Visibility  state. */\r\n#define GLUT_NOT_VISIBLE\t\t0\r\n#define GLUT_VISIBLE\t\t\t1\r\n\r\n/* Window status  state. */\r\n#define GLUT_HIDDEN\t\t\t0\r\n#define GLUT_FULLY_RETAINED\t\t1\r\n#define GLUT_PARTIALLY_RETAINED\t\t2\r\n#define GLUT_FULLY_COVERED\t\t3\r\n\r\n/* Color index component selection values. */\r\n#define GLUT_RED\t\t\t0\r\n#define GLUT_GREEN\t\t\t1\r\n#define GLUT_BLUE\t\t\t2\r\n\r\n/* Layers for use. */\r\n#define GLUT_NORMAL\t\t\t0\r\n#define GLUT_OVERLAY\t\t\t1\r\n\r\n#if defined(_WIN32)\r\n/* Stroke font constants (use these in GLUT program). */\r\n#define GLUT_STROKE_ROMAN\t\t((void*)0)\r\n#define GLUT_STROKE_MONO_ROMAN\t\t((void*)1)\r\n\r\n/* Bitmap font constants (use these in GLUT program). */\r\n#define GLUT_BITMAP_9_BY_15\t\t((void*)2)\r\n#define GLUT_BITMAP_8_BY_13\t\t((void*)3)\r\n#define GLUT_BITMAP_TIMES_ROMAN_10\t((void*)4)\r\n#define GLUT_BITMAP_TIMES_ROMAN_24\t((void*)5)\r\n#if (GLUT_API_VERSION >= 3)\r\n#define GLUT_BITMAP_HELVETICA_10\t((void*)6)\r\n#define GLUT_BITMAP_HELVETICA_12\t((void*)7)\r\n#define GLUT_BITMAP_HELVETICA_18\t((void*)8)\r\n#endif\r\n#else\r\n/* Stroke font opaque addresses (use constants instead in source code). */\r\nextern void *glutStrokeRoman;\r\nextern void *glutStrokeMonoRoman;\r\n\r\n/* Stroke font constants (use these in GLUT program). */\r\n#define GLUT_STROKE_ROMAN\t\t(&glutStrokeRoman)\r\n#define GLUT_STROKE_MONO_ROMAN\t\t(&glutStrokeMonoRoman)\r\n\r\n/* Bitmap font opaque addresses (use constants instead in source code). */\r\nextern void *glutBitmap9By15;\r\nextern void *glutBitmap8By13;\r\nextern void *glutBitmapTimesRoman10;\r\nextern void *glutBitmapTimesRoman24;\r\nextern void *glutBitmapHelvetica10;\r\nextern void *glutBitmapHelvetica12;\r\nextern void *glutBitmapHelvetica18;\r\n\r\n/* Bitmap font constants (use these in GLUT program). */\r\n#define GLUT_BITMAP_9_BY_15\t\t(&glutBitmap9By15)\r\n#define GLUT_BITMAP_8_BY_13\t\t(&glutBitmap8By13)\r\n#define GLUT_BITMAP_TIMES_ROMAN_10\t(&glutBitmapTimesRoman10)\r\n#define GLUT_BITMAP_TIMES_ROMAN_24\t(&glutBitmapTimesRoman24)\r\n#if (GLUT_API_VERSION >= 3)\r\n#define GLUT_BITMAP_HELVETICA_10\t(&glutBitmapHelvetica10)\r\n#define GLUT_BITMAP_HELVETICA_12\t(&glutBitmapHelvetica12)\r\n#define GLUT_BITMAP_HELVETICA_18\t(&glutBitmapHelvetica18)\r\n#endif\r\n#endif\r\n\r\n/* glutGet parameters. */\r\n#define GLUT_WINDOW_X\t\t\t100\r\n#define GLUT_WINDOW_Y\t\t\t101\r\n#define GLUT_WINDOW_WIDTH\t\t102\r\n#define GLUT_WINDOW_HEIGHT\t\t103\r\n#define GLUT_WINDOW_BUFFER_SIZE\t\t104\r\n#define GLUT_WINDOW_STENCIL_SIZE\t105\r\n#define GLUT_WINDOW_DEPTH_SIZE\t\t106\r\n#define GLUT_WINDOW_RED_SIZE\t\t107\r\n#define GLUT_WINDOW_GREEN_SIZE\t\t108\r\n#define GLUT_WINDOW_BLUE_SIZE\t\t109\r\n#define GLUT_WINDOW_ALPHA_SIZE\t\t110\r\n#define GLUT_WINDOW_ACCUM_RED_SIZE\t111\r\n#define GLUT_WINDOW_ACCUM_GREEN_SIZE\t112\r\n#define GLUT_WINDOW_ACCUM_BLUE_SIZE\t113\r\n#define GLUT_WINDOW_ACCUM_ALPHA_SIZE\t114\r\n#define GLUT_WINDOW_DOUBLEBUFFER\t115\r\n#define GLUT_WINDOW_RGBA\t\t116\r\n#define GLUT_WINDOW_PARENT\t\t117\r\n#define GLUT_WINDOW_NUM_CHILDREN\t118\r\n#define GLUT_WINDOW_COLORMAP_SIZE\t119\r\n#if (GLUT_API_VERSION >= 2)\r\n#define GLUT_WINDOW_NUM_SAMPLES\t\t120\r\n#define GLUT_WINDOW_STEREO\t\t121\r\n#endif\r\n#if (GLUT_API_VERSION >= 3)\r\n#define GLUT_WINDOW_CURSOR\t\t122\r\n#endif\r\n#define GLUT_SCREEN_WIDTH\t\t200\r\n#define GLUT_SCREEN_HEIGHT\t\t201\r\n#define GLUT_SCREEN_WIDTH_MM\t\t202\r\n#define GLUT_SCREEN_HEIGHT_MM\t\t203\r\n#define GLUT_MENU_NUM_ITEMS\t\t300\r\n#define GLUT_DISPLAY_MODE_POSSIBLE\t400\r\n#define GLUT_INIT_WINDOW_X\t\t500\r\n#define GLUT_INIT_WINDOW_Y\t\t501\r\n#define GLUT_INIT_WINDOW_WIDTH\t\t502\r\n#define GLUT_INIT_WINDOW_HEIGHT\t\t503\r\n#define GLUT_INIT_DISPLAY_MODE\t\t504\r\n#if (GLUT_API_VERSION >= 2)\r\n#define GLUT_ELAPSED_TIME\t\t700\r\n#endif\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)\r\n#define GLUT_WINDOW_FORMAT_ID\t\t123\r\n#endif\r\n\r\n#if (GLUT_API_VERSION >= 2)\r\n/* glutDeviceGet parameters. */\r\n#define GLUT_HAS_KEYBOARD\t\t600\r\n#define GLUT_HAS_MOUSE\t\t\t601\r\n#define GLUT_HAS_SPACEBALL\t\t602\r\n#define GLUT_HAS_DIAL_AND_BUTTON_BOX\t603\r\n#define GLUT_HAS_TABLET\t\t\t604\r\n#define GLUT_NUM_MOUSE_BUTTONS\t\t605\r\n#define GLUT_NUM_SPACEBALL_BUTTONS\t606\r\n#define GLUT_NUM_BUTTON_BOX_BUTTONS\t607\r\n#define GLUT_NUM_DIALS\t\t\t608\r\n#define GLUT_NUM_TABLET_BUTTONS\t\t609\r\n#endif\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)\r\n#define GLUT_DEVICE_IGNORE_KEY_REPEAT   610\r\n#define GLUT_DEVICE_KEY_REPEAT          611\r\n#define GLUT_HAS_JOYSTICK\t\t612\r\n#define GLUT_OWNS_JOYSTICK\t\t613\r\n#define GLUT_JOYSTICK_BUTTONS\t\t614\r\n#define GLUT_JOYSTICK_AXES\t\t615\r\n#define GLUT_JOYSTICK_POLL_RATE\t\t616\r\n#endif\r\n\r\n#if (GLUT_API_VERSION >= 3)\r\n/* glutLayerGet parameters. */\r\n#define GLUT_OVERLAY_POSSIBLE           800\r\n#define GLUT_LAYER_IN_USE\t\t801\r\n#define GLUT_HAS_OVERLAY\t\t802\r\n#define GLUT_TRANSPARENT_INDEX\t\t803\r\n#define GLUT_NORMAL_DAMAGED\t\t804\r\n#define GLUT_OVERLAY_DAMAGED\t\t805\r\n\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)\r\n/* glutVideoResizeGet parameters. */\r\n#define GLUT_VIDEO_RESIZE_POSSIBLE\t900\r\n#define GLUT_VIDEO_RESIZE_IN_USE\t901\r\n#define GLUT_VIDEO_RESIZE_X_DELTA\t902\r\n#define GLUT_VIDEO_RESIZE_Y_DELTA\t903\r\n#define GLUT_VIDEO_RESIZE_WIDTH_DELTA\t904\r\n#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA\t905\r\n#define GLUT_VIDEO_RESIZE_X\t\t906\r\n#define GLUT_VIDEO_RESIZE_Y\t\t907\r\n#define GLUT_VIDEO_RESIZE_WIDTH\t\t908\r\n#define GLUT_VIDEO_RESIZE_HEIGHT\t909\r\n#endif\r\n\r\n/* glutUseLayer parameters. */\r\n#define GLUT_NORMAL\t\t\t0\r\n#define GLUT_OVERLAY\t\t\t1\r\n\r\n/* glutGetModifiers return mask. */\r\n#define GLUT_ACTIVE_SHIFT               1\r\n#define GLUT_ACTIVE_CTRL                2\r\n#define GLUT_ACTIVE_ALT                 4\r\n\r\n/* glutSetCursor parameters. */\r\n/* Basic arrows. */\r\n#define GLUT_CURSOR_RIGHT_ARROW\t\t0\r\n#define GLUT_CURSOR_LEFT_ARROW\t\t1\r\n/* Symbolic cursor shapes. */\r\n#define GLUT_CURSOR_INFO\t\t2\r\n#define GLUT_CURSOR_DESTROY\t\t3\r\n#define GLUT_CURSOR_HELP\t\t4\r\n#define GLUT_CURSOR_CYCLE\t\t5\r\n#define GLUT_CURSOR_SPRAY\t\t6\r\n#define GLUT_CURSOR_WAIT\t\t7\r\n#define GLUT_CURSOR_TEXT\t\t8\r\n#define GLUT_CURSOR_CROSSHAIR\t\t9\r\n/* Directional cursors. */\r\n#define GLUT_CURSOR_UP_DOWN\t\t10\r\n#define GLUT_CURSOR_LEFT_RIGHT\t\t11\r\n/* Sizing cursors. */\r\n#define GLUT_CURSOR_TOP_SIDE\t\t12\r\n#define GLUT_CURSOR_BOTTOM_SIDE\t\t13\r\n#define GLUT_CURSOR_LEFT_SIDE\t\t14\r\n#define GLUT_CURSOR_RIGHT_SIDE\t\t15\r\n#define GLUT_CURSOR_TOP_LEFT_CORNER\t16\r\n#define GLUT_CURSOR_TOP_RIGHT_CORNER\t17\r\n#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER\t18\r\n#define GLUT_CURSOR_BOTTOM_LEFT_CORNER\t19\r\n/* Inherit from parent window. */\r\n#define GLUT_CURSOR_INHERIT\t\t100\r\n/* Blank cursor. */\r\n#define GLUT_CURSOR_NONE\t\t101\r\n/* Fullscreen crosshair (if available). */\r\n#define GLUT_CURSOR_FULL_CROSSHAIR\t102\r\n#endif\r\n\r\n/* GLUT initialization sub-API. */\r\nextern void APIENTRY glutInit(int *argcp, char **argv);\r\nextern void APIENTRY glutInitDisplayMode(unsigned int mode);\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)\r\nextern void APIENTRY glutInitDisplayString(const char *string);\r\n#endif\r\nextern void APIENTRY glutInitWindowPosition(int x, int y);\r\nextern void APIENTRY glutInitWindowSize(int width, int height);\r\nextern void APIENTRY glutMainLoop(void);\r\n\r\n/* GLUT window sub-API. */\r\nextern int APIENTRY glutCreateWindow(const char *title);\r\nextern int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);\r\nextern void APIENTRY glutDestroyWindow(int win);\r\nextern void APIENTRY glutPostRedisplay(void);\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)\r\nextern void APIENTRY glutPostWindowRedisplay(int win);\r\n#endif\r\nextern void APIENTRY glutSwapBuffers(void);\r\nextern int APIENTRY glutGetWindow(void);\r\nextern void APIENTRY glutSetWindow(int win);\r\nextern void APIENTRY glutSetWindowTitle(const char *title);\r\nextern void APIENTRY glutSetIconTitle(const char *title);\r\nextern void APIENTRY glutPositionWindow(int x, int y);\r\nextern void APIENTRY glutReshapeWindow(int width, int height);\r\nextern void APIENTRY glutPopWindow(void);\r\nextern void APIENTRY glutPushWindow(void);\r\nextern void APIENTRY glutIconifyWindow(void);\r\nextern void APIENTRY glutShowWindow(void);\r\nextern void APIENTRY glutHideWindow(void);\r\n#if (GLUT_API_VERSION >= 3)\r\nextern void APIENTRY glutFullScreen(void);\r\nextern void APIENTRY glutSetCursor(int cursor);\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)\r\nextern void APIENTRY glutWarpPointer(int x, int y);\r\n#endif\r\n\r\n/* GLUT overlay sub-API. */\r\nextern void APIENTRY glutEstablishOverlay(void);\r\nextern void APIENTRY glutRemoveOverlay(void);\r\nextern void APIENTRY glutUseLayer(GLenum layer);\r\nextern void APIENTRY glutPostOverlayRedisplay(void);\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)\r\nextern void APIENTRY glutPostWindowOverlayRedisplay(int win);\r\n#endif\r\nextern void APIENTRY glutShowOverlay(void);\r\nextern void APIENTRY glutHideOverlay(void);\r\n#endif\r\n\r\n/* GLUT menu sub-API. */\r\nextern int APIENTRY glutCreateMenu(void (*)(int));\r\nextern void APIENTRY glutDestroyMenu(int menu);\r\nextern int APIENTRY glutGetMenu(void);\r\nextern void APIENTRY glutSetMenu(int menu);\r\nextern void APIENTRY glutAddMenuEntry(const char *label, int value);\r\nextern void APIENTRY glutAddSubMenu(const char *label, int submenu);\r\nextern void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);\r\nextern void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);\r\nextern void APIENTRY glutRemoveMenuItem(int item);\r\nextern void APIENTRY glutAttachMenu(int button);\r\nextern void APIENTRY glutDetachMenu(int button);\r\n\r\n/* GLUT window callback sub-API. */\r\nextern void APIENTRY glutDisplayFunc(void (*func)(void));\r\nextern void APIENTRY glutReshapeFunc(void (*func)(int width, int height));\r\nextern void APIENTRY glutKeyboardFunc(void (*func)(unsigned char key, int x, int y));\r\nextern void APIENTRY glutMouseFunc(void (*func)(int button, int state, int x, int y));\r\nextern void APIENTRY glutMotionFunc(void (*func)(int x, int y));\r\nextern void APIENTRY glutPassiveMotionFunc(void (*func)(int x, int y));\r\nextern void APIENTRY glutEntryFunc(void (*func)(int state));\r\nextern void APIENTRY glutVisibilityFunc(void (*func)(int state));\r\nextern void APIENTRY glutIdleFunc(void (*func)(void));\r\nextern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value);\r\nextern void APIENTRY glutMenuStateFunc(void (*func)(int state));\r\n#if (GLUT_API_VERSION >= 2)\r\nextern void APIENTRY glutSpecialFunc(void (*func)(int key, int x, int y));\r\nextern void APIENTRY glutSpaceballMotionFunc(void (*func)(int x, int y, int z));\r\nextern void APIENTRY glutSpaceballRotateFunc(void (*func)(int x, int y, int z));\r\nextern void APIENTRY glutSpaceballButtonFunc(void (*func)(int button, int state));\r\nextern void APIENTRY glutButtonBoxFunc(void (*func)(int button, int state));\r\nextern void APIENTRY glutDialsFunc(void (*func)(int dial, int value));\r\nextern void APIENTRY glutTabletMotionFunc(void (*func)(int x, int y));\r\nextern void APIENTRY glutTabletButtonFunc(void (*func)(int button, int state, int x, int y));\r\n#if (GLUT_API_VERSION >= 3)\r\nextern void APIENTRY glutMenuStatusFunc(void (*func)(int status, int x, int y));\r\nextern void APIENTRY glutOverlayDisplayFunc(void (*func)(void));\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)\r\nextern void APIENTRY glutWindowStatusFunc(void (*func)(int state));\r\n#endif\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)\r\nextern void APIENTRY glutKeyboardUpFunc(void (*func)(unsigned char key, int x, int y));\r\nextern void APIENTRY glutSpecialUpFunc(void (*func)(int key, int x, int y));\r\nextern void APIENTRY glutJoystickFunc(void (*func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);\r\n#endif\r\n#endif\r\n#endif\r\n\r\n/* GLUT color index sub-API. */\r\nextern void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);\r\nextern GLfloat APIENTRY glutGetColor(int ndx, int component);\r\nextern void APIENTRY glutCopyColormap(int win);\r\n\r\n/* GLUT state retrieval sub-API. */\r\nextern int APIENTRY glutGet(GLenum type);\r\nextern int APIENTRY glutDeviceGet(GLenum type);\r\n#if (GLUT_API_VERSION >= 2)\r\n/* GLUT extension support sub-API */\r\nextern int APIENTRY glutExtensionSupported(const char *name);\r\n#endif\r\n#if (GLUT_API_VERSION >= 3)\r\nextern int APIENTRY glutGetModifiers(void);\r\nextern int APIENTRY glutLayerGet(GLenum type);\r\n#endif\r\n\r\n/* GLUT font sub-API */\r\nextern void APIENTRY glutBitmapCharacter(void *font, int character);\r\nextern int APIENTRY glutBitmapWidth(void *font, int character);\r\nextern void APIENTRY glutStrokeCharacter(void *font, int character);\r\nextern int APIENTRY glutStrokeWidth(void *font, int character);\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)\r\nextern int APIENTRY glutBitmapLength(void *font, const unsigned char *string);\r\nextern int APIENTRY glutStrokeLength(void *font, const unsigned char *string);\r\n#endif\r\n\r\n/* GLUT pre-built models sub-API */\r\nextern void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);\r\nextern void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);\r\nextern void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);\r\nextern void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);\r\nextern void APIENTRY glutWireCube(GLdouble size);\r\nextern void APIENTRY glutSolidCube(GLdouble size);\r\nextern void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);\r\nextern void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);\r\nextern void APIENTRY glutWireDodecahedron(void);\r\nextern void APIENTRY glutSolidDodecahedron(void);\r\nextern void APIENTRY glutWireTeapot(GLdouble size);\r\nextern void APIENTRY glutSolidTeapot(GLdouble size);\r\nextern void APIENTRY glutWireOctahedron(void);\r\nextern void APIENTRY glutSolidOctahedron(void);\r\nextern void APIENTRY glutWireTetrahedron(void);\r\nextern void APIENTRY glutSolidTetrahedron(void);\r\nextern void APIENTRY glutWireIcosahedron(void);\r\nextern void APIENTRY glutSolidIcosahedron(void);\r\n\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)\r\n/* GLUT video resize sub-API. */\r\nextern int APIENTRY glutVideoResizeGet(GLenum param);\r\nextern void APIENTRY glutSetupVideoResizing(void);\r\nextern void APIENTRY glutStopVideoResizing(void);\r\nextern void APIENTRY glutVideoResize(int x, int y, int width, int height);\r\nextern void APIENTRY glutVideoPan(int x, int y, int width, int height);\r\n\r\n/* GLUT debugging sub-API. */\r\nextern void APIENTRY glutReportErrors(void);\r\n#endif\r\n\r\n#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)\r\n/* GLUT device control sub-API. */\r\n/* glutSetKeyRepeat modes. */\r\n#define GLUT_KEY_REPEAT_OFF\t\t0\r\n#define GLUT_KEY_REPEAT_ON\t\t1\r\n#define GLUT_KEY_REPEAT_DEFAULT\t\t2\r\n\r\n/* Joystick button masks. */\r\n#define GLUT_JOYSTICK_BUTTON_A\t\t1\r\n#define GLUT_JOYSTICK_BUTTON_B\t\t2\r\n#define GLUT_JOYSTICK_BUTTON_C\t\t4\r\n#define GLUT_JOYSTICK_BUTTON_D\t\t8\r\n\r\nextern void APIENTRY glutIgnoreKeyRepeat(int ignore);\r\nextern void APIENTRY glutSetKeyRepeat(int repeatMode);\r\nextern void APIENTRY glutForceJoystickFunc(void);\r\n\r\n/* GLUT game mode sub-API. */\r\n/* glutGameModeGet. */\r\n#define GLUT_GAME_MODE_ACTIVE           0\r\n#define GLUT_GAME_MODE_POSSIBLE         1\r\n#define GLUT_GAME_MODE_WIDTH            2\r\n#define GLUT_GAME_MODE_HEIGHT           3\r\n#define GLUT_GAME_MODE_PIXEL_DEPTH      4\r\n#define GLUT_GAME_MODE_REFRESH_RATE     5\r\n#define GLUT_GAME_MODE_DISPLAY_CHANGED  6\r\n\r\nextern void APIENTRY glutGameModeString(const char *string);\r\nextern int APIENTRY glutEnterGameMode(void);\r\nextern void APIENTRY glutLeaveGameMode(void);\r\nextern int APIENTRY glutGameModeGet(GLenum mode);\r\n#endif\r\n\r\n#ifdef __cplusplus\r\n}\r\n\r\n#endif\r\n\r\n#ifdef GLUT_APIENTRY_DEFINED\r\n# undef GLUT_APIENTRY_DEFINED\r\n# undef APIENTRY\r\n#endif\r\n\r\n#ifdef GLUT_WINGDIAPI_DEFINED\r\n# undef GLUT_WINGDIAPI_DEFINED\r\n# undef WINGDIAPI\r\n#endif\r\n\r\n#endif                  /* __glut_h__ */\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/glxew.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n** The OpenGL Extension Wrangler Library\r\n** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>\r\n** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>\r\n** Copyright (C) 2002, Lev Povalahev\r\n** All rights reserved.\r\n** \r\n** Redistribution and use in source and binary forms, with or without \r\n** modification, are permitted provided that the following conditions are met:\r\n** \r\n** * Redistributions of source code must retain the above copyright notice, \r\n**   this list of conditions and the following disclaimer.\r\n** * Redistributions in binary form must reproduce the above copyright notice, \r\n**   this list of conditions and the following disclaimer in the documentation \r\n**   and/or other materials provided with the distribution.\r\n** * The name of the author may be used to endorse or promote products \r\n**   derived from this software without specific prior written permission.\r\n**\r\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \r\n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \r\n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \r\n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \r\n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \r\n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\r\n** THE POSSIBILITY OF SUCH DAMAGE.\r\n*/\r\n\r\n/*\r\n * Mesa 3-D graphics library\r\n * Version:  7.0\r\n *\r\n * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the \"Software\"),\r\n * to deal in the Software without restriction, including without limitation\r\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n * and/or sell copies of the Software, and to permit persons to whom the\r\n * Software is furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included\r\n * in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n** Copyright (c) 2007 The Khronos Group Inc.\r\n** \r\n** Permission is hereby granted, free of charge, to any person obtaining a\r\n** copy of this software and/or associated documentation files (the\r\n** \"Materials\"), to deal in the Materials without restriction, including\r\n** without limitation the rights to use, copy, modify, merge, publish,\r\n** distribute, sublicense, and/or sell copies of the Materials, and to\r\n** permit persons to whom the Materials are furnished to do so, subject to\r\n** the following conditions:\r\n** \r\n** The above copyright notice and this permission notice shall be included\r\n** in all copies or substantial portions of the Materials.\r\n** \r\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\r\n*/\r\n\r\n#ifndef __glxew_h__\r\n#define __glxew_h__\r\n#define __GLXEW_H__\r\n\r\n#ifdef __glxext_h_\r\n#error glxext.h included before glxew.h\r\n#endif\r\n\r\n#if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__)\r\n#error glx.h included before glxew.h\r\n#endif\r\n\r\n#define __glxext_h_\r\n\r\n#define GLX_H\r\n#define __GLX_glx_h__\r\n#define __glx_h__\r\n\r\n#include <X11/Xlib.h>\r\n#include <X11/Xutil.h>\r\n#include <X11/Xmd.h>\r\n#include <GL/glew.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* ---------------------------- GLX_VERSION_1_0 --------------------------- */\r\n\r\n#ifndef GLX_VERSION_1_0\r\n#define GLX_VERSION_1_0 1\r\n\r\n#define GLX_USE_GL 1\r\n#define GLX_BUFFER_SIZE 2\r\n#define GLX_LEVEL 3\r\n#define GLX_RGBA 4\r\n#define GLX_DOUBLEBUFFER 5\r\n#define GLX_STEREO 6\r\n#define GLX_AUX_BUFFERS 7\r\n#define GLX_RED_SIZE 8\r\n#define GLX_GREEN_SIZE 9\r\n#define GLX_BLUE_SIZE 10\r\n#define GLX_ALPHA_SIZE 11\r\n#define GLX_DEPTH_SIZE 12\r\n#define GLX_STENCIL_SIZE 13\r\n#define GLX_ACCUM_RED_SIZE 14\r\n#define GLX_ACCUM_GREEN_SIZE 15\r\n#define GLX_ACCUM_BLUE_SIZE 16\r\n#define GLX_ACCUM_ALPHA_SIZE 17\r\n#define GLX_BAD_SCREEN 1\r\n#define GLX_BAD_ATTRIBUTE 2\r\n#define GLX_NO_EXTENSION 3\r\n#define GLX_BAD_VISUAL 4\r\n#define GLX_BAD_CONTEXT 5\r\n#define GLX_BAD_VALUE 6\r\n#define GLX_BAD_ENUM 7\r\n\r\ntypedef XID GLXDrawable;\r\ntypedef XID GLXPixmap;\r\n#ifdef __sun\r\ntypedef struct __glXContextRec *GLXContext;\r\n#else\r\ntypedef struct __GLXcontextRec *GLXContext;\r\n#endif\r\n\r\ntypedef unsigned int GLXVideoDeviceNV; \r\n\r\nextern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);\r\nextern Bool glXQueryVersion (Display *dpy, int *major, int *minor);\r\nextern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);\r\nextern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);\r\nextern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);\r\nextern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);\r\nextern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);\r\nextern void glXDestroyContext (Display *dpy, GLXContext ctx);\r\nextern Bool glXIsDirect (Display *dpy, GLXContext ctx);\r\nextern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask);\r\nextern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);\r\nextern GLXContext glXGetCurrentContext (void);\r\nextern GLXDrawable glXGetCurrentDrawable (void);\r\nextern void glXWaitGL (void);\r\nextern void glXWaitX (void);\r\nextern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);\r\nextern void glXUseXFont (Font font, int first, int count, int listBase);\r\n\r\n#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0)\r\n\r\n#endif /* GLX_VERSION_1_0 */\r\n\r\n/* ---------------------------- GLX_VERSION_1_1 --------------------------- */\r\n\r\n#ifndef GLX_VERSION_1_1\r\n#define GLX_VERSION_1_1\r\n\r\n#define GLX_VENDOR 0x1\r\n#define GLX_VERSION 0x2\r\n#define GLX_EXTENSIONS 0x3\r\n\r\nextern const char* glXQueryExtensionsString (Display *dpy, int screen);\r\nextern const char* glXGetClientString (Display *dpy, int name);\r\nextern const char* glXQueryServerString (Display *dpy, int screen, int name);\r\n\r\n#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1)\r\n\r\n#endif /* GLX_VERSION_1_1 */\r\n\r\n/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */\r\n\r\n#ifndef GLX_VERSION_1_2\r\n#define GLX_VERSION_1_2 1\r\n\r\ntypedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void);\r\n\r\n#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay)\r\n\r\n#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2)\r\n\r\n#endif /* GLX_VERSION_1_2 */\r\n\r\n/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */\r\n\r\n#ifndef GLX_VERSION_1_3\r\n#define GLX_VERSION_1_3 1\r\n\r\n#define GLX_RGBA_BIT 0x00000001\r\n#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001\r\n#define GLX_WINDOW_BIT 0x00000001\r\n#define GLX_COLOR_INDEX_BIT 0x00000002\r\n#define GLX_PIXMAP_BIT 0x00000002\r\n#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002\r\n#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004\r\n#define GLX_PBUFFER_BIT 0x00000004\r\n#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008\r\n#define GLX_AUX_BUFFERS_BIT 0x00000010\r\n#define GLX_CONFIG_CAVEAT 0x20\r\n#define GLX_DEPTH_BUFFER_BIT 0x00000020\r\n#define GLX_X_VISUAL_TYPE 0x22\r\n#define GLX_TRANSPARENT_TYPE 0x23\r\n#define GLX_TRANSPARENT_INDEX_VALUE 0x24\r\n#define GLX_TRANSPARENT_RED_VALUE 0x25\r\n#define GLX_TRANSPARENT_GREEN_VALUE 0x26\r\n#define GLX_TRANSPARENT_BLUE_VALUE 0x27\r\n#define GLX_TRANSPARENT_ALPHA_VALUE 0x28\r\n#define GLX_STENCIL_BUFFER_BIT 0x00000040\r\n#define GLX_ACCUM_BUFFER_BIT 0x00000080\r\n#define GLX_NONE 0x8000\r\n#define GLX_SLOW_CONFIG 0x8001\r\n#define GLX_TRUE_COLOR 0x8002\r\n#define GLX_DIRECT_COLOR 0x8003\r\n#define GLX_PSEUDO_COLOR 0x8004\r\n#define GLX_STATIC_COLOR 0x8005\r\n#define GLX_GRAY_SCALE 0x8006\r\n#define GLX_STATIC_GRAY 0x8007\r\n#define GLX_TRANSPARENT_RGB 0x8008\r\n#define GLX_TRANSPARENT_INDEX 0x8009\r\n#define GLX_VISUAL_ID 0x800B\r\n#define GLX_SCREEN 0x800C\r\n#define GLX_NON_CONFORMANT_CONFIG 0x800D\r\n#define GLX_DRAWABLE_TYPE 0x8010\r\n#define GLX_RENDER_TYPE 0x8011\r\n#define GLX_X_RENDERABLE 0x8012\r\n#define GLX_FBCONFIG_ID 0x8013\r\n#define GLX_RGBA_TYPE 0x8014\r\n#define GLX_COLOR_INDEX_TYPE 0x8015\r\n#define GLX_MAX_PBUFFER_WIDTH 0x8016\r\n#define GLX_MAX_PBUFFER_HEIGHT 0x8017\r\n#define GLX_MAX_PBUFFER_PIXELS 0x8018\r\n#define GLX_PRESERVED_CONTENTS 0x801B\r\n#define GLX_LARGEST_PBUFFER 0x801C\r\n#define GLX_WIDTH 0x801D\r\n#define GLX_HEIGHT 0x801E\r\n#define GLX_EVENT_MASK 0x801F\r\n#define GLX_DAMAGED 0x8020\r\n#define GLX_SAVED 0x8021\r\n#define GLX_WINDOW 0x8022\r\n#define GLX_PBUFFER 0x8023\r\n#define GLX_PBUFFER_HEIGHT 0x8040\r\n#define GLX_PBUFFER_WIDTH 0x8041\r\n#define GLX_PBUFFER_CLOBBER_MASK 0x08000000\r\n#define GLX_DONT_CARE 0xFFFFFFFF\r\n\r\ntypedef XID GLXFBConfigID;\r\ntypedef XID GLXPbuffer;\r\ntypedef XID GLXWindow;\r\ntypedef struct __GLXFBConfigRec *GLXFBConfig;\r\n\r\ntypedef struct {\r\n  int event_type; \r\n  int draw_type; \r\n  unsigned long serial; \r\n  Bool send_event; \r\n  Display *display; \r\n  GLXDrawable drawable; \r\n  unsigned int buffer_mask; \r\n  unsigned int aux_buffer; \r\n  int x, y; \r\n  int width, height; \r\n  int count; \r\n} GLXPbufferClobberEvent;\r\ntypedef union __GLXEvent {\r\n  GLXPbufferClobberEvent glxpbufferclobber; \r\n  long pad[24]; \r\n} GLXEvent;\r\n\r\ntypedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\r\ntypedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\r\ntypedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);\r\ntypedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);\r\ntypedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);\r\ntypedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);\r\ntypedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);\r\ntypedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);\r\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);\r\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);\r\ntypedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);\r\ntypedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);\r\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);\r\ntypedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\r\ntypedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);\r\ntypedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);\r\ntypedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);\r\n\r\n#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig)\r\n#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext)\r\n#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer)\r\n#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap)\r\n#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow)\r\n#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer)\r\n#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap)\r\n#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow)\r\n#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable)\r\n#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib)\r\n#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs)\r\n#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent)\r\n#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig)\r\n#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent)\r\n#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext)\r\n#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable)\r\n#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent)\r\n\r\n#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3)\r\n\r\n#endif /* GLX_VERSION_1_3 */\r\n\r\n/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */\r\n\r\n#ifndef GLX_VERSION_1_4\r\n#define GLX_VERSION_1_4 1\r\n\r\n#define GLX_SAMPLE_BUFFERS 100000\r\n#define GLX_SAMPLES 100001\r\n\r\nextern void ( * glXGetProcAddress (const GLubyte *procName)) (void);\r\n\r\n#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4)\r\n\r\n#endif /* GLX_VERSION_1_4 */\r\n\r\n/* -------------------------- GLX_3DFX_multisample ------------------------- */\r\n\r\n#ifndef GLX_3DFX_multisample\r\n#define GLX_3DFX_multisample 1\r\n\r\n#define GLX_SAMPLE_BUFFERS_3DFX 0x8050\r\n#define GLX_SAMPLES_3DFX 0x8051\r\n\r\n#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample)\r\n\r\n#endif /* GLX_3DFX_multisample */\r\n\r\n/* ------------------------ GLX_AMD_gpu_association ------------------------ */\r\n\r\n#ifndef GLX_AMD_gpu_association\r\n#define GLX_AMD_gpu_association 1\r\n\r\n#define GLX_GPU_VENDOR_AMD 0x1F00\r\n#define GLX_GPU_RENDERER_STRING_AMD 0x1F01\r\n#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\r\n#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\r\n#define GLX_GPU_RAM_AMD 0x21A3\r\n#define GLX_GPU_CLOCK_AMD 0x21A4\r\n#define GLX_GPU_NUM_PIPES_AMD 0x21A5\r\n#define GLX_GPU_NUM_SIMD_AMD 0x21A6\r\n#define GLX_GPU_NUM_RB_AMD 0x21A7\r\n#define GLX_GPU_NUM_SPI_AMD 0x21A8\r\n\r\n#define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association)\r\n\r\n#endif /* GLX_AMD_gpu_association */\r\n\r\n/* ------------------------- GLX_ARB_create_context ------------------------ */\r\n\r\n#ifndef GLX_ARB_create_context\r\n#define GLX_ARB_create_context 1\r\n\r\n#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001\r\n#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\r\n#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091\r\n#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092\r\n#define GLX_CONTEXT_FLAGS_ARB 0x2094\r\n\r\ntypedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);\r\n\r\n#define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB)\r\n\r\n#define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context)\r\n\r\n#endif /* GLX_ARB_create_context */\r\n\r\n/* --------------------- GLX_ARB_create_context_profile -------------------- */\r\n\r\n#ifndef GLX_ARB_create_context_profile\r\n#define GLX_ARB_create_context_profile 1\r\n\r\n#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\r\n#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\r\n#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126\r\n\r\n#define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile)\r\n\r\n#endif /* GLX_ARB_create_context_profile */\r\n\r\n/* ------------------- GLX_ARB_create_context_robustness ------------------- */\r\n\r\n#ifndef GLX_ARB_create_context_robustness\r\n#define GLX_ARB_create_context_robustness 1\r\n\r\n#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\r\n#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252\r\n#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\r\n#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261\r\n\r\n#define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness)\r\n\r\n#endif /* GLX_ARB_create_context_robustness */\r\n\r\n/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */\r\n\r\n#ifndef GLX_ARB_fbconfig_float\r\n#define GLX_ARB_fbconfig_float 1\r\n\r\n#define GLX_RGBA_FLOAT_BIT 0x00000004\r\n#define GLX_RGBA_FLOAT_TYPE 0x20B9\r\n\r\n#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float)\r\n\r\n#endif /* GLX_ARB_fbconfig_float */\r\n\r\n/* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */\r\n\r\n#ifndef GLX_ARB_framebuffer_sRGB\r\n#define GLX_ARB_framebuffer_sRGB 1\r\n\r\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2\r\n\r\n#define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB)\r\n\r\n#endif /* GLX_ARB_framebuffer_sRGB */\r\n\r\n/* ------------------------ GLX_ARB_get_proc_address ----------------------- */\r\n\r\n#ifndef GLX_ARB_get_proc_address\r\n#define GLX_ARB_get_proc_address 1\r\n\r\nextern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);\r\n\r\n#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address)\r\n\r\n#endif /* GLX_ARB_get_proc_address */\r\n\r\n/* -------------------------- GLX_ARB_multisample -------------------------- */\r\n\r\n#ifndef GLX_ARB_multisample\r\n#define GLX_ARB_multisample 1\r\n\r\n#define GLX_SAMPLE_BUFFERS_ARB 100000\r\n#define GLX_SAMPLES_ARB 100001\r\n\r\n#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample)\r\n\r\n#endif /* GLX_ARB_multisample */\r\n\r\n/* ---------------- GLX_ARB_robustness_application_isolation --------------- */\r\n\r\n#ifndef GLX_ARB_robustness_application_isolation\r\n#define GLX_ARB_robustness_application_isolation 1\r\n\r\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\r\n\r\n#define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation)\r\n\r\n#endif /* GLX_ARB_robustness_application_isolation */\r\n\r\n/* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */\r\n\r\n#ifndef GLX_ARB_robustness_share_group_isolation\r\n#define GLX_ARB_robustness_share_group_isolation 1\r\n\r\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\r\n\r\n#define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation)\r\n\r\n#endif /* GLX_ARB_robustness_share_group_isolation */\r\n\r\n/* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */\r\n\r\n#ifndef GLX_ARB_vertex_buffer_object\r\n#define GLX_ARB_vertex_buffer_object 1\r\n\r\n#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095\r\n\r\n#define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object)\r\n\r\n#endif /* GLX_ARB_vertex_buffer_object */\r\n\r\n/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */\r\n\r\n#ifndef GLX_ATI_pixel_format_float\r\n#define GLX_ATI_pixel_format_float 1\r\n\r\n#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100\r\n\r\n#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float)\r\n\r\n#endif /* GLX_ATI_pixel_format_float */\r\n\r\n/* ------------------------- GLX_ATI_render_texture ------------------------ */\r\n\r\n#ifndef GLX_ATI_render_texture\r\n#define GLX_ATI_render_texture 1\r\n\r\n#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800\r\n#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801\r\n#define GLX_TEXTURE_FORMAT_ATI 0x9802\r\n#define GLX_TEXTURE_TARGET_ATI 0x9803\r\n#define GLX_MIPMAP_TEXTURE_ATI 0x9804\r\n#define GLX_TEXTURE_RGB_ATI 0x9805\r\n#define GLX_TEXTURE_RGBA_ATI 0x9806\r\n#define GLX_NO_TEXTURE_ATI 0x9807\r\n#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808\r\n#define GLX_TEXTURE_1D_ATI 0x9809\r\n#define GLX_TEXTURE_2D_ATI 0x980A\r\n#define GLX_MIPMAP_LEVEL_ATI 0x980B\r\n#define GLX_CUBE_MAP_FACE_ATI 0x980C\r\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D\r\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E\r\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F\r\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810\r\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811\r\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812\r\n#define GLX_FRONT_LEFT_ATI 0x9813\r\n#define GLX_FRONT_RIGHT_ATI 0x9814\r\n#define GLX_BACK_LEFT_ATI 0x9815\r\n#define GLX_BACK_RIGHT_ATI 0x9816\r\n#define GLX_AUX0_ATI 0x9817\r\n#define GLX_AUX1_ATI 0x9818\r\n#define GLX_AUX2_ATI 0x9819\r\n#define GLX_AUX3_ATI 0x981A\r\n#define GLX_AUX4_ATI 0x981B\r\n#define GLX_AUX5_ATI 0x981C\r\n#define GLX_AUX6_ATI 0x981D\r\n#define GLX_AUX7_ATI 0x981E\r\n#define GLX_AUX8_ATI 0x981F\r\n#define GLX_AUX9_ATI 0x9820\r\n#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821\r\n#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822\r\n\r\ntypedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\r\ntypedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list);\r\ntypedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\r\n\r\n#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI)\r\n#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI)\r\n#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI)\r\n\r\n#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture)\r\n\r\n#endif /* GLX_ATI_render_texture */\r\n\r\n/* ------------------- GLX_EXT_create_context_es2_profile ------------------ */\r\n\r\n#ifndef GLX_EXT_create_context_es2_profile\r\n#define GLX_EXT_create_context_es2_profile 1\r\n\r\n#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\r\n\r\n#define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile)\r\n\r\n#endif /* GLX_EXT_create_context_es2_profile */\r\n\r\n/* ------------------- GLX_EXT_create_context_es_profile ------------------- */\r\n\r\n#ifndef GLX_EXT_create_context_es_profile\r\n#define GLX_EXT_create_context_es_profile 1\r\n\r\n#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\r\n\r\n#define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile)\r\n\r\n#endif /* GLX_EXT_create_context_es_profile */\r\n\r\n/* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */\r\n\r\n#ifndef GLX_EXT_fbconfig_packed_float\r\n#define GLX_EXT_fbconfig_packed_float 1\r\n\r\n#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008\r\n#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1\r\n\r\n#define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float)\r\n\r\n#endif /* GLX_EXT_fbconfig_packed_float */\r\n\r\n/* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */\r\n\r\n#ifndef GLX_EXT_framebuffer_sRGB\r\n#define GLX_EXT_framebuffer_sRGB 1\r\n\r\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2\r\n\r\n#define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB)\r\n\r\n#endif /* GLX_EXT_framebuffer_sRGB */\r\n\r\n/* ------------------------- GLX_EXT_import_context ------------------------ */\r\n\r\n#ifndef GLX_EXT_import_context\r\n#define GLX_EXT_import_context 1\r\n\r\n#define GLX_SHARE_CONTEXT_EXT 0x800A\r\n#define GLX_VISUAL_ID_EXT 0x800B\r\n#define GLX_SCREEN_EXT 0x800C\r\n\r\ntypedef XID GLXContextID;\r\n\r\ntypedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context);\r\ntypedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);\r\ntypedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID);\r\ntypedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value);\r\n\r\n#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT)\r\n#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT)\r\n#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT)\r\n#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT)\r\n\r\n#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context)\r\n\r\n#endif /* GLX_EXT_import_context */\r\n\r\n/* -------------------------- GLX_EXT_scene_marker ------------------------- */\r\n\r\n#ifndef GLX_EXT_scene_marker\r\n#define GLX_EXT_scene_marker 1\r\n\r\n#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker)\r\n\r\n#endif /* GLX_EXT_scene_marker */\r\n\r\n/* -------------------------- GLX_EXT_swap_control ------------------------- */\r\n\r\n#ifndef GLX_EXT_swap_control\r\n#define GLX_EXT_swap_control 1\r\n\r\n#define GLX_SWAP_INTERVAL_EXT 0x20F1\r\n#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2\r\n\r\ntypedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval);\r\n\r\n#define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT)\r\n\r\n#define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control)\r\n\r\n#endif /* GLX_EXT_swap_control */\r\n\r\n/* ----------------------- GLX_EXT_swap_control_tear ----------------------- */\r\n\r\n#ifndef GLX_EXT_swap_control_tear\r\n#define GLX_EXT_swap_control_tear 1\r\n\r\n#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3\r\n\r\n#define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear)\r\n\r\n#endif /* GLX_EXT_swap_control_tear */\r\n\r\n/* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */\r\n\r\n#ifndef GLX_EXT_texture_from_pixmap\r\n#define GLX_EXT_texture_from_pixmap 1\r\n\r\n#define GLX_TEXTURE_1D_BIT_EXT 0x00000001\r\n#define GLX_TEXTURE_2D_BIT_EXT 0x00000002\r\n#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004\r\n#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0\r\n#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1\r\n#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2\r\n#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3\r\n#define GLX_Y_INVERTED_EXT 0x20D4\r\n#define GLX_TEXTURE_FORMAT_EXT 0x20D5\r\n#define GLX_TEXTURE_TARGET_EXT 0x20D6\r\n#define GLX_MIPMAP_TEXTURE_EXT 0x20D7\r\n#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8\r\n#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9\r\n#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA\r\n#define GLX_TEXTURE_1D_EXT 0x20DB\r\n#define GLX_TEXTURE_2D_EXT 0x20DC\r\n#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD\r\n#define GLX_FRONT_LEFT_EXT 0x20DE\r\n#define GLX_FRONT_RIGHT_EXT 0x20DF\r\n#define GLX_BACK_LEFT_EXT 0x20E0\r\n#define GLX_BACK_RIGHT_EXT 0x20E1\r\n#define GLX_AUX0_EXT 0x20E2\r\n#define GLX_AUX1_EXT 0x20E3\r\n#define GLX_AUX2_EXT 0x20E4\r\n#define GLX_AUX3_EXT 0x20E5\r\n#define GLX_AUX4_EXT 0x20E6\r\n#define GLX_AUX5_EXT 0x20E7\r\n#define GLX_AUX6_EXT 0x20E8\r\n#define GLX_AUX7_EXT 0x20E9\r\n#define GLX_AUX8_EXT 0x20EA\r\n#define GLX_AUX9_EXT 0x20EB\r\n\r\ntypedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list);\r\ntypedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer);\r\n\r\n#define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT)\r\n#define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT)\r\n\r\n#define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap)\r\n\r\n#endif /* GLX_EXT_texture_from_pixmap */\r\n\r\n/* -------------------------- GLX_EXT_visual_info -------------------------- */\r\n\r\n#ifndef GLX_EXT_visual_info\r\n#define GLX_EXT_visual_info 1\r\n\r\n#define GLX_X_VISUAL_TYPE_EXT 0x22\r\n#define GLX_TRANSPARENT_TYPE_EXT 0x23\r\n#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24\r\n#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25\r\n#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26\r\n#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27\r\n#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28\r\n#define GLX_NONE_EXT 0x8000\r\n#define GLX_TRUE_COLOR_EXT 0x8002\r\n#define GLX_DIRECT_COLOR_EXT 0x8003\r\n#define GLX_PSEUDO_COLOR_EXT 0x8004\r\n#define GLX_STATIC_COLOR_EXT 0x8005\r\n#define GLX_GRAY_SCALE_EXT 0x8006\r\n#define GLX_STATIC_GRAY_EXT 0x8007\r\n#define GLX_TRANSPARENT_RGB_EXT 0x8008\r\n#define GLX_TRANSPARENT_INDEX_EXT 0x8009\r\n\r\n#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info)\r\n\r\n#endif /* GLX_EXT_visual_info */\r\n\r\n/* ------------------------- GLX_EXT_visual_rating ------------------------- */\r\n\r\n#ifndef GLX_EXT_visual_rating\r\n#define GLX_EXT_visual_rating 1\r\n\r\n#define GLX_VISUAL_CAVEAT_EXT 0x20\r\n#define GLX_SLOW_VISUAL_EXT 0x8001\r\n#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D\r\n\r\n#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating)\r\n\r\n#endif /* GLX_EXT_visual_rating */\r\n\r\n/* -------------------------- GLX_INTEL_swap_event ------------------------- */\r\n\r\n#ifndef GLX_INTEL_swap_event\r\n#define GLX_INTEL_swap_event 1\r\n\r\n#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180\r\n#define GLX_COPY_COMPLETE_INTEL 0x8181\r\n#define GLX_FLIP_COMPLETE_INTEL 0x8182\r\n#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000\r\n\r\n#define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event)\r\n\r\n#endif /* GLX_INTEL_swap_event */\r\n\r\n/* -------------------------- GLX_MESA_agp_offset -------------------------- */\r\n\r\n#ifndef GLX_MESA_agp_offset\r\n#define GLX_MESA_agp_offset 1\r\n\r\ntypedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer);\r\n\r\n#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA)\r\n\r\n#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset)\r\n\r\n#endif /* GLX_MESA_agp_offset */\r\n\r\n/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */\r\n\r\n#ifndef GLX_MESA_copy_sub_buffer\r\n#define GLX_MESA_copy_sub_buffer 1\r\n\r\ntypedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height);\r\n\r\n#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA)\r\n\r\n#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer)\r\n\r\n#endif /* GLX_MESA_copy_sub_buffer */\r\n\r\n/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */\r\n\r\n#ifndef GLX_MESA_pixmap_colormap\r\n#define GLX_MESA_pixmap_colormap 1\r\n\r\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);\r\n\r\n#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA)\r\n\r\n#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap)\r\n\r\n#endif /* GLX_MESA_pixmap_colormap */\r\n\r\n/* ------------------------ GLX_MESA_release_buffers ----------------------- */\r\n\r\n#ifndef GLX_MESA_release_buffers\r\n#define GLX_MESA_release_buffers 1\r\n\r\ntypedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d);\r\n\r\n#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA)\r\n\r\n#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers)\r\n\r\n#endif /* GLX_MESA_release_buffers */\r\n\r\n/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */\r\n\r\n#ifndef GLX_MESA_set_3dfx_mode\r\n#define GLX_MESA_set_3dfx_mode 1\r\n\r\n#define GLX_3DFX_WINDOW_MODE_MESA 0x1\r\n#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2\r\n\r\ntypedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode);\r\n\r\n#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA)\r\n\r\n#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode)\r\n\r\n#endif /* GLX_MESA_set_3dfx_mode */\r\n\r\n/* ------------------------- GLX_MESA_swap_control ------------------------- */\r\n\r\n#ifndef GLX_MESA_swap_control\r\n#define GLX_MESA_swap_control 1\r\n\r\ntypedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void);\r\ntypedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);\r\n\r\n#define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA)\r\n#define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA)\r\n\r\n#define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control)\r\n\r\n#endif /* GLX_MESA_swap_control */\r\n\r\n/* --------------------------- GLX_NV_copy_image --------------------------- */\r\n\r\n#ifndef GLX_NV_copy_image\r\n#define GLX_NV_copy_image 1\r\n\r\ntypedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\r\n\r\n#define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV)\r\n\r\n#define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image)\r\n\r\n#endif /* GLX_NV_copy_image */\r\n\r\n/* -------------------------- GLX_NV_float_buffer -------------------------- */\r\n\r\n#ifndef GLX_NV_float_buffer\r\n#define GLX_NV_float_buffer 1\r\n\r\n#define GLX_FLOAT_COMPONENTS_NV 0x20B0\r\n\r\n#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer)\r\n\r\n#endif /* GLX_NV_float_buffer */\r\n\r\n/* ---------------------- GLX_NV_multisample_coverage ---------------------- */\r\n\r\n#ifndef GLX_NV_multisample_coverage\r\n#define GLX_NV_multisample_coverage 1\r\n\r\n#define GLX_COLOR_SAMPLES_NV 0x20B3\r\n#define GLX_COVERAGE_SAMPLES_NV 100001\r\n\r\n#define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage)\r\n\r\n#endif /* GLX_NV_multisample_coverage */\r\n\r\n/* -------------------------- GLX_NV_present_video ------------------------- */\r\n\r\n#ifndef GLX_NV_present_video\r\n#define GLX_NV_present_video 1\r\n\r\n#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0\r\n\r\ntypedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);\r\ntypedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);\r\n\r\n#define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV)\r\n#define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV)\r\n\r\n#define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video)\r\n\r\n#endif /* GLX_NV_present_video */\r\n\r\n/* --------------------------- GLX_NV_swap_group --------------------------- */\r\n\r\n#ifndef GLX_NV_swap_group\r\n#define GLX_NV_swap_group 1\r\n\r\ntypedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier);\r\ntypedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group);\r\ntypedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count);\r\ntypedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);\r\ntypedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);\r\ntypedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen);\r\n\r\n#define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV)\r\n#define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV)\r\n#define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV)\r\n#define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV)\r\n#define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV)\r\n#define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV)\r\n\r\n#define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group)\r\n\r\n#endif /* GLX_NV_swap_group */\r\n\r\n/* ----------------------- GLX_NV_vertex_array_range ----------------------- */\r\n\r\n#ifndef GLX_NV_vertex_array_range\r\n#define GLX_NV_vertex_array_range 1\r\n\r\ntypedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\r\ntypedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer);\r\n\r\n#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV)\r\n#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV)\r\n\r\n#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range)\r\n\r\n#endif /* GLX_NV_vertex_array_range */\r\n\r\n/* -------------------------- GLX_NV_video_capture ------------------------- */\r\n\r\n#ifndef GLX_NV_video_capture\r\n#define GLX_NV_video_capture 1\r\n\r\n#define GLX_DEVICE_ID_NV 0x20CD\r\n#define GLX_UNIQUE_ID_NV 0x20CE\r\n#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\r\n\r\ntypedef XID GLXVideoCaptureDeviceNV;\r\n\r\ntypedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);\r\ntypedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements);\r\ntypedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\r\ntypedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);\r\ntypedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\r\n\r\n#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV)\r\n#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV)\r\n#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV)\r\n#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV)\r\n#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV)\r\n\r\n#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture)\r\n\r\n#endif /* GLX_NV_video_capture */\r\n\r\n/* ---------------------------- GLX_NV_video_out --------------------------- */\r\n\r\n#ifndef GLX_NV_video_out\r\n#define GLX_NV_video_out 1\r\n\r\n#define GLX_VIDEO_OUT_COLOR_NV 0x20C3\r\n#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4\r\n#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5\r\n#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\r\n#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\r\n#define GLX_VIDEO_OUT_FRAME_NV 0x20C8\r\n#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9\r\n#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA\r\n#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB\r\n#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC\r\n\r\ntypedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);\r\ntypedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);\r\ntypedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\r\ntypedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice);\r\ntypedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf);\r\ntypedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);\r\n\r\n#define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV)\r\n#define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV)\r\n#define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV)\r\n#define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV)\r\n#define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV)\r\n#define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV)\r\n\r\n#define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out)\r\n\r\n#endif /* GLX_NV_video_out */\r\n\r\n/* -------------------------- GLX_OML_swap_method -------------------------- */\r\n\r\n#ifndef GLX_OML_swap_method\r\n#define GLX_OML_swap_method 1\r\n\r\n#define GLX_SWAP_METHOD_OML 0x8060\r\n#define GLX_SWAP_EXCHANGE_OML 0x8061\r\n#define GLX_SWAP_COPY_OML 0x8062\r\n#define GLX_SWAP_UNDEFINED_OML 0x8063\r\n\r\n#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method)\r\n\r\n#endif /* GLX_OML_swap_method */\r\n\r\n/* -------------------------- GLX_OML_sync_control ------------------------- */\r\n\r\n#ifndef GLX_OML_sync_control\r\n#define GLX_OML_sync_control 1\r\n\r\ntypedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator);\r\ntypedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);\r\ntypedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);\r\ntypedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc);\r\ntypedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc);\r\n\r\n#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML)\r\n#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML)\r\n#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML)\r\n#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML)\r\n#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML)\r\n\r\n#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control)\r\n\r\n#endif /* GLX_OML_sync_control */\r\n\r\n/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */\r\n\r\n#ifndef GLX_SGIS_blended_overlay\r\n#define GLX_SGIS_blended_overlay 1\r\n\r\n#define GLX_BLENDED_RGBA_SGIS 0x8025\r\n\r\n#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay)\r\n\r\n#endif /* GLX_SGIS_blended_overlay */\r\n\r\n/* -------------------------- GLX_SGIS_color_range ------------------------- */\r\n\r\n#ifndef GLX_SGIS_color_range\r\n#define GLX_SGIS_color_range 1\r\n\r\n#define GLX_MIN_RED_SGIS 0\r\n#define GLX_MAX_GREEN_SGIS 0\r\n#define GLX_MIN_BLUE_SGIS 0\r\n#define GLX_MAX_ALPHA_SGIS 0\r\n#define GLX_MIN_GREEN_SGIS 0\r\n#define GLX_MIN_ALPHA_SGIS 0\r\n#define GLX_MAX_RED_SGIS 0\r\n#define GLX_EXTENDED_RANGE_SGIS 0\r\n#define GLX_MAX_BLUE_SGIS 0\r\n\r\n#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range)\r\n\r\n#endif /* GLX_SGIS_color_range */\r\n\r\n/* -------------------------- GLX_SGIS_multisample ------------------------- */\r\n\r\n#ifndef GLX_SGIS_multisample\r\n#define GLX_SGIS_multisample 1\r\n\r\n#define GLX_SAMPLE_BUFFERS_SGIS 100000\r\n#define GLX_SAMPLES_SGIS 100001\r\n\r\n#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample)\r\n\r\n#endif /* GLX_SGIS_multisample */\r\n\r\n/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */\r\n\r\n#ifndef GLX_SGIS_shared_multisample\r\n#define GLX_SGIS_shared_multisample 1\r\n\r\n#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026\r\n#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027\r\n\r\n#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample)\r\n\r\n#endif /* GLX_SGIS_shared_multisample */\r\n\r\n/* --------------------------- GLX_SGIX_fbconfig --------------------------- */\r\n\r\n#ifndef GLX_SGIX_fbconfig\r\n#define GLX_SGIX_fbconfig 1\r\n\r\n#define GLX_WINDOW_BIT_SGIX 0x00000001\r\n#define GLX_RGBA_BIT_SGIX 0x00000001\r\n#define GLX_PIXMAP_BIT_SGIX 0x00000002\r\n#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002\r\n#define GLX_SCREEN_EXT 0x800C\r\n#define GLX_DRAWABLE_TYPE_SGIX 0x8010\r\n#define GLX_RENDER_TYPE_SGIX 0x8011\r\n#define GLX_X_RENDERABLE_SGIX 0x8012\r\n#define GLX_FBCONFIG_ID_SGIX 0x8013\r\n#define GLX_RGBA_TYPE_SGIX 0x8014\r\n#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015\r\n\r\ntypedef XID GLXFBConfigIDSGIX;\r\ntypedef struct __GLXFBConfigRec *GLXFBConfigSGIX;\r\n\r\ntypedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\r\ntypedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\r\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap);\r\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value);\r\ntypedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis);\r\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config);\r\n\r\n#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX)\r\n#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX)\r\n#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX)\r\n#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX)\r\n#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX)\r\n#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX)\r\n\r\n#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig)\r\n\r\n#endif /* GLX_SGIX_fbconfig */\r\n\r\n/* --------------------------- GLX_SGIX_hyperpipe -------------------------- */\r\n\r\n#ifndef GLX_SGIX_hyperpipe\r\n#define GLX_SGIX_hyperpipe 1\r\n\r\n#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001\r\n#define GLX_PIPE_RECT_SGIX 0x00000001\r\n#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002\r\n#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002\r\n#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003\r\n#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004\r\n#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80\r\n#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91\r\n#define GLX_BAD_HYPERPIPE_SGIX 92\r\n#define GLX_HYPERPIPE_ID_SGIX 0x8030\r\n\r\ntypedef struct {\r\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \r\n  int  networkId; \r\n} GLXHyperpipeNetworkSGIX;\r\ntypedef struct {\r\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \r\n  int XOrigin; \r\n  int YOrigin; \r\n  int maxHeight; \r\n  int maxWidth; \r\n} GLXPipeRectLimits;\r\ntypedef struct {\r\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \r\n  int channel; \r\n  unsigned int participationType; \r\n  int timeSlice; \r\n} GLXHyperpipeConfigSGIX;\r\ntypedef struct {\r\n  char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \r\n  int srcXOrigin; \r\n  int srcYOrigin; \r\n  int srcWidth; \r\n  int srcHeight; \r\n  int destXOrigin; \r\n  int destYOrigin; \r\n  int destWidth; \r\n  int destHeight; \r\n} GLXPipeRect;\r\n\r\ntypedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);\r\ntypedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);\r\ntypedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);\r\ntypedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);\r\ntypedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);\r\ntypedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);\r\ntypedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);\r\ntypedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);\r\n\r\n#define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX)\r\n#define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX)\r\n#define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX)\r\n#define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX)\r\n#define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX)\r\n#define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX)\r\n#define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX)\r\n#define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX)\r\n\r\n#define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe)\r\n\r\n#endif /* GLX_SGIX_hyperpipe */\r\n\r\n/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */\r\n\r\n#ifndef GLX_SGIX_pbuffer\r\n#define GLX_SGIX_pbuffer 1\r\n\r\n#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001\r\n#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002\r\n#define GLX_PBUFFER_BIT_SGIX 0x00000004\r\n#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004\r\n#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008\r\n#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010\r\n#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020\r\n#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040\r\n#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080\r\n#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100\r\n#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016\r\n#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017\r\n#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018\r\n#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019\r\n#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A\r\n#define GLX_PRESERVED_CONTENTS_SGIX 0x801B\r\n#define GLX_LARGEST_PBUFFER_SGIX 0x801C\r\n#define GLX_WIDTH_SGIX 0x801D\r\n#define GLX_HEIGHT_SGIX 0x801E\r\n#define GLX_EVENT_MASK_SGIX 0x801F\r\n#define GLX_DAMAGED_SGIX 0x8020\r\n#define GLX_SAVED_SGIX 0x8021\r\n#define GLX_WINDOW_SGIX 0x8022\r\n#define GLX_PBUFFER_SGIX 0x8023\r\n#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000\r\n\r\ntypedef XID GLXPbufferSGIX;\r\ntypedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX;\r\n\r\ntypedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list);\r\ntypedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf);\r\ntypedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask);\r\ntypedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value);\r\ntypedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask);\r\n\r\n#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX)\r\n#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX)\r\n#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX)\r\n#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX)\r\n#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX)\r\n\r\n#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer)\r\n\r\n#endif /* GLX_SGIX_pbuffer */\r\n\r\n/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */\r\n\r\n#ifndef GLX_SGIX_swap_barrier\r\n#define GLX_SGIX_swap_barrier 1\r\n\r\ntypedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);\r\ntypedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);\r\n\r\n#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX)\r\n#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX)\r\n\r\n#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier)\r\n\r\n#endif /* GLX_SGIX_swap_barrier */\r\n\r\n/* -------------------------- GLX_SGIX_swap_group -------------------------- */\r\n\r\n#ifndef GLX_SGIX_swap_group\r\n#define GLX_SGIX_swap_group 1\r\n\r\ntypedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);\r\n\r\n#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX)\r\n\r\n#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group)\r\n\r\n#endif /* GLX_SGIX_swap_group */\r\n\r\n/* ------------------------- GLX_SGIX_video_resize ------------------------- */\r\n\r\n#ifndef GLX_SGIX_video_resize\r\n#define GLX_SGIX_video_resize 1\r\n\r\n#define GLX_SYNC_FRAME_SGIX 0x00000000\r\n#define GLX_SYNC_SWAP_SGIX 0x00000001\r\n\r\ntypedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window);\r\ntypedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h);\r\ntypedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype);\r\ntypedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h);\r\ntypedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);\r\n\r\n#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX)\r\n#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX)\r\n#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX)\r\n#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX)\r\n#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX)\r\n\r\n#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize)\r\n\r\n#endif /* GLX_SGIX_video_resize */\r\n\r\n/* ---------------------- GLX_SGIX_visual_select_group --------------------- */\r\n\r\n#ifndef GLX_SGIX_visual_select_group\r\n#define GLX_SGIX_visual_select_group 1\r\n\r\n#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028\r\n\r\n#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group)\r\n\r\n#endif /* GLX_SGIX_visual_select_group */\r\n\r\n/* ---------------------------- GLX_SGI_cushion ---------------------------- */\r\n\r\n#ifndef GLX_SGI_cushion\r\n#define GLX_SGI_cushion 1\r\n\r\ntypedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion);\r\n\r\n#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI)\r\n\r\n#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion)\r\n\r\n#endif /* GLX_SGI_cushion */\r\n\r\n/* ----------------------- GLX_SGI_make_current_read ----------------------- */\r\n\r\n#ifndef GLX_SGI_make_current_read\r\n#define GLX_SGI_make_current_read 1\r\n\r\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);\r\ntypedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\r\n\r\n#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI)\r\n#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI)\r\n\r\n#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read)\r\n\r\n#endif /* GLX_SGI_make_current_read */\r\n\r\n/* -------------------------- GLX_SGI_swap_control ------------------------- */\r\n\r\n#ifndef GLX_SGI_swap_control\r\n#define GLX_SGI_swap_control 1\r\n\r\ntypedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);\r\n\r\n#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI)\r\n\r\n#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control)\r\n\r\n#endif /* GLX_SGI_swap_control */\r\n\r\n/* --------------------------- GLX_SGI_video_sync -------------------------- */\r\n\r\n#ifndef GLX_SGI_video_sync\r\n#define GLX_SGI_video_sync 1\r\n\r\ntypedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count);\r\ntypedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count);\r\n\r\n#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI)\r\n#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI)\r\n\r\n#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync)\r\n\r\n#endif /* GLX_SGI_video_sync */\r\n\r\n/* --------------------- GLX_SUN_get_transparent_index --------------------- */\r\n\r\n#ifndef GLX_SUN_get_transparent_index\r\n#define GLX_SUN_get_transparent_index 1\r\n\r\ntypedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);\r\n\r\n#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN)\r\n\r\n#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index)\r\n\r\n#endif /* GLX_SUN_get_transparent_index */\r\n\r\n/* -------------------------- GLX_SUN_video_resize ------------------------- */\r\n\r\n#ifndef GLX_SUN_video_resize\r\n#define GLX_SUN_video_resize 1\r\n\r\n#define GLX_VIDEO_RESIZE_SUN 0x8171\r\n#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD\r\n\r\ntypedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor);\r\ntypedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor);\r\n\r\n#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN)\r\n#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN)\r\n\r\n#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize)\r\n\r\n#endif /* GLX_SUN_video_resize */\r\n\r\n/* ------------------------------------------------------------------------- */\r\n\r\n#ifdef GLEW_MX\r\n#define GLXEW_FUN_EXPORT\r\n#define GLXEW_VAR_EXPORT\r\n#else\r\n#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT\r\n#define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT\r\n#endif /* GLEW_MX */\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig;\r\nGLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext;\r\nGLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer;\r\nGLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap;\r\nGLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow;\r\nGLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer;\r\nGLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap;\r\nGLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow;\r\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable;\r\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib;\r\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs;\r\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent;\r\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig;\r\nGLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable;\r\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI;\r\nGLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI;\r\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT;\r\nGLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT;\r\nGLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT;\r\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA;\r\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV;\r\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV;\r\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV;\r\nGLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV;\r\nGLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV;\r\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV;\r\nGLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV;\r\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV;\r\nGLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV;\r\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV;\r\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV;\r\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV;\r\nGLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;\r\nGLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML;\r\nGLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML;\r\nGLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML;\r\nGLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX;\r\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI;\r\nGLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI;\r\nGLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN;\r\n\r\nGLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN;\r\nGLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN;\r\n\r\n#if defined(GLEW_MX)\r\nstruct GLXEWContextStruct\r\n{\r\n#endif /* GLEW_MX */\r\n\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index;\r\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize;\r\n\r\n#ifdef GLEW_MX\r\n}; /* GLXEWContextStruct */\r\n#endif /* GLEW_MX */\r\n\r\n/* ------------------------------------------------------------------------ */\r\n\r\n#ifdef GLEW_MX\r\n\r\ntypedef struct GLXEWContextStruct GLXEWContext;\r\nGLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx);\r\nGLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name);\r\n\r\n#define glxewInit() glxewContextInit(glxewGetContext())\r\n#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x)\r\n\r\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x))\r\n#define GLXEW_GET_FUN(x) x\r\n\r\n#else /* GLEW_MX */\r\n\r\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)\r\n#define GLXEW_GET_FUN(x) x\r\n\r\nGLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);\r\n\r\n#endif /* GLEW_MX */\r\n\r\nGLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* __glxew_h__ */\r\n"
  },
  {
    "path": "Engine/porting/Win32/Platform/wglew.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n** The OpenGL Extension Wrangler Library\r\n** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>\r\n** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>\r\n** Copyright (C) 2002, Lev Povalahev\r\n** All rights reserved.\r\n** \r\n** Redistribution and use in source and binary forms, with or without \r\n** modification, are permitted provided that the following conditions are met:\r\n** \r\n** * Redistributions of source code must retain the above copyright notice, \r\n**   this list of conditions and the following disclaimer.\r\n** * Redistributions in binary form must reproduce the above copyright notice, \r\n**   this list of conditions and the following disclaimer in the documentation \r\n**   and/or other materials provided with the distribution.\r\n** * The name of the author may be used to endorse or promote products \r\n**   derived from this software without specific prior written permission.\r\n**\r\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \r\n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \r\n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \r\n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \r\n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \r\n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\r\n** THE POSSIBILITY OF SUCH DAMAGE.\r\n*/\r\n\r\n/*\r\n** Copyright (c) 2007 The Khronos Group Inc.\r\n** \r\n** Permission is hereby granted, free of charge, to any person obtaining a\r\n** copy of this software and/or associated documentation files (the\r\n** \"Materials\"), to deal in the Materials without restriction, including\r\n** without limitation the rights to use, copy, modify, merge, publish,\r\n** distribute, sublicense, and/or sell copies of the Materials, and to\r\n** permit persons to whom the Materials are furnished to do so, subject to\r\n** the following conditions:\r\n** \r\n** The above copyright notice and this permission notice shall be included\r\n** in all copies or substantial portions of the Materials.\r\n** \r\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\r\n*/\r\n\r\n#ifndef __wglew_h__\r\n#define __wglew_h__\r\n#define __WGLEW_H__\r\n\r\n#ifdef __wglext_h_\r\n#error wglext.h included before wglew.h\r\n#endif\r\n\r\n#define __wglext_h_\r\n\r\n#if !defined(WINAPI)\r\n#  ifndef WIN32_LEAN_AND_MEAN\r\n#    define WIN32_LEAN_AND_MEAN 1\r\n#  endif\r\n#include <windows.h>\r\n#  undef WIN32_LEAN_AND_MEAN\r\n#endif\r\n\r\n/*\r\n * GLEW_STATIC needs to be set when using the static version.\r\n * GLEW_BUILD is set when building the DLL version.\r\n */\r\n#ifdef GLEW_STATIC\r\n#  define GLEWAPI extern\r\n#else\r\n#  ifdef GLEW_BUILD\r\n#    define GLEWAPI extern __declspec(dllexport)\r\n#  else\r\n#    define GLEWAPI extern __declspec(dllimport)\r\n#  endif\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* -------------------------- WGL_3DFX_multisample ------------------------- */\r\n\r\n#ifndef WGL_3DFX_multisample\r\n#define WGL_3DFX_multisample 1\r\n\r\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\r\n#define WGL_SAMPLES_3DFX 0x2061\r\n\r\n#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)\r\n\r\n#endif /* WGL_3DFX_multisample */\r\n\r\n/* ------------------------- WGL_3DL_stereo_control ------------------------ */\r\n\r\n#ifndef WGL_3DL_stereo_control\r\n#define WGL_3DL_stereo_control 1\r\n\r\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\r\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\r\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\r\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\r\n\r\ntypedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\r\n\r\n#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)\r\n\r\n#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)\r\n\r\n#endif /* WGL_3DL_stereo_control */\r\n\r\n/* ------------------------ WGL_AMD_gpu_association ------------------------ */\r\n\r\n#ifndef WGL_AMD_gpu_association\r\n#define WGL_AMD_gpu_association 1\r\n\r\n#define WGL_GPU_VENDOR_AMD 0x1F00\r\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\r\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\r\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\r\n#define WGL_GPU_RAM_AMD 0x21A3\r\n#define WGL_GPU_CLOCK_AMD 0x21A4\r\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\r\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\r\n#define WGL_GPU_NUM_RB_AMD 0x21A7\r\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\r\n\r\ntypedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\r\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\r\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList);\r\ntypedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\r\ntypedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\r\ntypedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\r\ntypedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids);\r\ntypedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data);\r\ntypedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\r\n\r\n#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD)\r\n#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD)\r\n#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD)\r\n#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD)\r\n#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD)\r\n#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD)\r\n#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD)\r\n#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD)\r\n#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD)\r\n\r\n#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association)\r\n\r\n#endif /* WGL_AMD_gpu_association */\r\n\r\n/* ------------------------- WGL_ARB_buffer_region ------------------------- */\r\n\r\n#ifndef WGL_ARB_buffer_region\r\n#define WGL_ARB_buffer_region 1\r\n\r\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\r\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\r\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\r\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\r\n\r\ntypedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\r\ntypedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\r\ntypedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\r\ntypedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\r\n\r\n#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)\r\n#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)\r\n#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)\r\n#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)\r\n\r\n#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)\r\n\r\n#endif /* WGL_ARB_buffer_region */\r\n\r\n/* ------------------------- WGL_ARB_create_context ------------------------ */\r\n\r\n#ifndef WGL_ARB_create_context\r\n#define WGL_ARB_create_context 1\r\n\r\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001\r\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\r\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\r\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\r\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\r\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\r\n#define ERROR_INVALID_VERSION_ARB 0x2095\r\n#define ERROR_INVALID_PROFILE_ARB 0x2096\r\n\r\ntypedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);\r\n\r\n#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB)\r\n\r\n#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context)\r\n\r\n#endif /* WGL_ARB_create_context */\r\n\r\n/* --------------------- WGL_ARB_create_context_profile -------------------- */\r\n\r\n#ifndef WGL_ARB_create_context_profile\r\n#define WGL_ARB_create_context_profile 1\r\n\r\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\r\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\r\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\r\n\r\n#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile)\r\n\r\n#endif /* WGL_ARB_create_context_profile */\r\n\r\n/* ------------------- WGL_ARB_create_context_robustness ------------------- */\r\n\r\n#ifndef WGL_ARB_create_context_robustness\r\n#define WGL_ARB_create_context_robustness 1\r\n\r\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\r\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\r\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\r\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\r\n\r\n#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness)\r\n\r\n#endif /* WGL_ARB_create_context_robustness */\r\n\r\n/* ----------------------- WGL_ARB_extensions_string ----------------------- */\r\n\r\n#ifndef WGL_ARB_extensions_string\r\n#define WGL_ARB_extensions_string 1\r\n\r\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\r\n\r\n#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)\r\n\r\n#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)\r\n\r\n#endif /* WGL_ARB_extensions_string */\r\n\r\n/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */\r\n\r\n#ifndef WGL_ARB_framebuffer_sRGB\r\n#define WGL_ARB_framebuffer_sRGB 1\r\n\r\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\r\n\r\n#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB)\r\n\r\n#endif /* WGL_ARB_framebuffer_sRGB */\r\n\r\n/* ----------------------- WGL_ARB_make_current_read ----------------------- */\r\n\r\n#ifndef WGL_ARB_make_current_read\r\n#define WGL_ARB_make_current_read 1\r\n\r\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\r\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\r\n\r\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);\r\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\r\n\r\n#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)\r\n#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)\r\n\r\n#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)\r\n\r\n#endif /* WGL_ARB_make_current_read */\r\n\r\n/* -------------------------- WGL_ARB_multisample -------------------------- */\r\n\r\n#ifndef WGL_ARB_multisample\r\n#define WGL_ARB_multisample 1\r\n\r\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\r\n#define WGL_SAMPLES_ARB 0x2042\r\n\r\n#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)\r\n\r\n#endif /* WGL_ARB_multisample */\r\n\r\n/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */\r\n\r\n#ifndef WGL_ARB_pbuffer\r\n#define WGL_ARB_pbuffer 1\r\n\r\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\r\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\r\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\r\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\r\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\r\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\r\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\r\n#define WGL_PBUFFER_LOST_ARB 0x2036\r\n\r\nDECLARE_HANDLE(HPBUFFERARB);\r\n\r\ntypedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\r\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\r\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);\r\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\r\n\r\n#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)\r\n#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)\r\n#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)\r\n#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)\r\n#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)\r\n\r\n#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)\r\n\r\n#endif /* WGL_ARB_pbuffer */\r\n\r\n/* -------------------------- WGL_ARB_pixel_format ------------------------- */\r\n\r\n#ifndef WGL_ARB_pixel_format\r\n#define WGL_ARB_pixel_format 1\r\n\r\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\r\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\r\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\r\n#define WGL_ACCELERATION_ARB 0x2003\r\n#define WGL_NEED_PALETTE_ARB 0x2004\r\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\r\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\r\n#define WGL_SWAP_METHOD_ARB 0x2007\r\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\r\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\r\n#define WGL_TRANSPARENT_ARB 0x200A\r\n#define WGL_SHARE_DEPTH_ARB 0x200C\r\n#define WGL_SHARE_STENCIL_ARB 0x200D\r\n#define WGL_SHARE_ACCUM_ARB 0x200E\r\n#define WGL_SUPPORT_GDI_ARB 0x200F\r\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\r\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\r\n#define WGL_STEREO_ARB 0x2012\r\n#define WGL_PIXEL_TYPE_ARB 0x2013\r\n#define WGL_COLOR_BITS_ARB 0x2014\r\n#define WGL_RED_BITS_ARB 0x2015\r\n#define WGL_RED_SHIFT_ARB 0x2016\r\n#define WGL_GREEN_BITS_ARB 0x2017\r\n#define WGL_GREEN_SHIFT_ARB 0x2018\r\n#define WGL_BLUE_BITS_ARB 0x2019\r\n#define WGL_BLUE_SHIFT_ARB 0x201A\r\n#define WGL_ALPHA_BITS_ARB 0x201B\r\n#define WGL_ALPHA_SHIFT_ARB 0x201C\r\n#define WGL_ACCUM_BITS_ARB 0x201D\r\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\r\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\r\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\r\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\r\n#define WGL_DEPTH_BITS_ARB 0x2022\r\n#define WGL_STENCIL_BITS_ARB 0x2023\r\n#define WGL_AUX_BUFFERS_ARB 0x2024\r\n#define WGL_NO_ACCELERATION_ARB 0x2025\r\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\r\n#define WGL_FULL_ACCELERATION_ARB 0x2027\r\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\r\n#define WGL_SWAP_COPY_ARB 0x2029\r\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\r\n#define WGL_TYPE_RGBA_ARB 0x202B\r\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\r\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\r\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\r\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\r\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\r\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\r\n\r\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\r\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);\r\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);\r\n\r\n#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)\r\n#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)\r\n#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)\r\n\r\n#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)\r\n\r\n#endif /* WGL_ARB_pixel_format */\r\n\r\n/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */\r\n\r\n#ifndef WGL_ARB_pixel_format_float\r\n#define WGL_ARB_pixel_format_float 1\r\n\r\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\r\n\r\n#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)\r\n\r\n#endif /* WGL_ARB_pixel_format_float */\r\n\r\n/* ------------------------- WGL_ARB_render_texture ------------------------ */\r\n\r\n#ifndef WGL_ARB_render_texture\r\n#define WGL_ARB_render_texture 1\r\n\r\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\r\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\r\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\r\n#define WGL_TEXTURE_TARGET_ARB 0x2073\r\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\r\n#define WGL_TEXTURE_RGB_ARB 0x2075\r\n#define WGL_TEXTURE_RGBA_ARB 0x2076\r\n#define WGL_NO_TEXTURE_ARB 0x2077\r\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\r\n#define WGL_TEXTURE_1D_ARB 0x2079\r\n#define WGL_TEXTURE_2D_ARB 0x207A\r\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\r\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\r\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\r\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\r\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\r\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\r\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\r\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\r\n#define WGL_FRONT_LEFT_ARB 0x2083\r\n#define WGL_FRONT_RIGHT_ARB 0x2084\r\n#define WGL_BACK_LEFT_ARB 0x2085\r\n#define WGL_BACK_RIGHT_ARB 0x2086\r\n#define WGL_AUX0_ARB 0x2087\r\n#define WGL_AUX1_ARB 0x2088\r\n#define WGL_AUX2_ARB 0x2089\r\n#define WGL_AUX3_ARB 0x208A\r\n#define WGL_AUX4_ARB 0x208B\r\n#define WGL_AUX5_ARB 0x208C\r\n#define WGL_AUX6_ARB 0x208D\r\n#define WGL_AUX7_ARB 0x208E\r\n#define WGL_AUX8_ARB 0x208F\r\n#define WGL_AUX9_ARB 0x2090\r\n\r\ntypedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\r\ntypedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\r\ntypedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);\r\n\r\n#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)\r\n#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)\r\n#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)\r\n\r\n#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)\r\n\r\n#endif /* WGL_ARB_render_texture */\r\n\r\n/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */\r\n\r\n#ifndef WGL_ATI_pixel_format_float\r\n#define WGL_ATI_pixel_format_float 1\r\n\r\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\r\n#define GL_RGBA_FLOAT_MODE_ATI 0x8820\r\n#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835\r\n\r\n#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)\r\n\r\n#endif /* WGL_ATI_pixel_format_float */\r\n\r\n/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */\r\n\r\n#ifndef WGL_ATI_render_texture_rectangle\r\n#define WGL_ATI_render_texture_rectangle 1\r\n\r\n#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5\r\n\r\n#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)\r\n\r\n#endif /* WGL_ATI_render_texture_rectangle */\r\n\r\n/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */\r\n\r\n#ifndef WGL_EXT_create_context_es2_profile\r\n#define WGL_EXT_create_context_es2_profile 1\r\n\r\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\r\n\r\n#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile)\r\n\r\n#endif /* WGL_EXT_create_context_es2_profile */\r\n\r\n/* ------------------- WGL_EXT_create_context_es_profile ------------------- */\r\n\r\n#ifndef WGL_EXT_create_context_es_profile\r\n#define WGL_EXT_create_context_es_profile 1\r\n\r\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\r\n\r\n#define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile)\r\n\r\n#endif /* WGL_EXT_create_context_es_profile */\r\n\r\n/* -------------------------- WGL_EXT_depth_float -------------------------- */\r\n\r\n#ifndef WGL_EXT_depth_float\r\n#define WGL_EXT_depth_float 1\r\n\r\n#define WGL_DEPTH_FLOAT_EXT 0x2040\r\n\r\n#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)\r\n\r\n#endif /* WGL_EXT_depth_float */\r\n\r\n/* ---------------------- WGL_EXT_display_color_table ---------------------- */\r\n\r\n#ifndef WGL_EXT_display_color_table\r\n#define WGL_EXT_display_color_table 1\r\n\r\ntypedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\r\ntypedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\r\ntypedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\r\ntypedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);\r\n\r\n#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)\r\n#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)\r\n#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)\r\n#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)\r\n\r\n#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)\r\n\r\n#endif /* WGL_EXT_display_color_table */\r\n\r\n/* ----------------------- WGL_EXT_extensions_string ----------------------- */\r\n\r\n#ifndef WGL_EXT_extensions_string\r\n#define WGL_EXT_extensions_string 1\r\n\r\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\r\n\r\n#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)\r\n\r\n#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)\r\n\r\n#endif /* WGL_EXT_extensions_string */\r\n\r\n/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */\r\n\r\n#ifndef WGL_EXT_framebuffer_sRGB\r\n#define WGL_EXT_framebuffer_sRGB 1\r\n\r\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\r\n\r\n#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)\r\n\r\n#endif /* WGL_EXT_framebuffer_sRGB */\r\n\r\n/* ----------------------- WGL_EXT_make_current_read ----------------------- */\r\n\r\n#ifndef WGL_EXT_make_current_read\r\n#define WGL_EXT_make_current_read 1\r\n\r\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\r\n\r\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);\r\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\r\n\r\n#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)\r\n#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)\r\n\r\n#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)\r\n\r\n#endif /* WGL_EXT_make_current_read */\r\n\r\n/* -------------------------- WGL_EXT_multisample -------------------------- */\r\n\r\n#ifndef WGL_EXT_multisample\r\n#define WGL_EXT_multisample 1\r\n\r\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\r\n#define WGL_SAMPLES_EXT 0x2042\r\n\r\n#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)\r\n\r\n#endif /* WGL_EXT_multisample */\r\n\r\n/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */\r\n\r\n#ifndef WGL_EXT_pbuffer\r\n#define WGL_EXT_pbuffer 1\r\n\r\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\r\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\r\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\r\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\r\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\r\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\r\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\r\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\r\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\r\n\r\nDECLARE_HANDLE(HPBUFFEREXT);\r\n\r\ntypedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\r\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\r\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);\r\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\r\n\r\n#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)\r\n#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)\r\n#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)\r\n#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)\r\n#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)\r\n\r\n#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)\r\n\r\n#endif /* WGL_EXT_pbuffer */\r\n\r\n/* -------------------------- WGL_EXT_pixel_format ------------------------- */\r\n\r\n#ifndef WGL_EXT_pixel_format\r\n#define WGL_EXT_pixel_format 1\r\n\r\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\r\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\r\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\r\n#define WGL_ACCELERATION_EXT 0x2003\r\n#define WGL_NEED_PALETTE_EXT 0x2004\r\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\r\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\r\n#define WGL_SWAP_METHOD_EXT 0x2007\r\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\r\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\r\n#define WGL_TRANSPARENT_EXT 0x200A\r\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\r\n#define WGL_SHARE_DEPTH_EXT 0x200C\r\n#define WGL_SHARE_STENCIL_EXT 0x200D\r\n#define WGL_SHARE_ACCUM_EXT 0x200E\r\n#define WGL_SUPPORT_GDI_EXT 0x200F\r\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\r\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\r\n#define WGL_STEREO_EXT 0x2012\r\n#define WGL_PIXEL_TYPE_EXT 0x2013\r\n#define WGL_COLOR_BITS_EXT 0x2014\r\n#define WGL_RED_BITS_EXT 0x2015\r\n#define WGL_RED_SHIFT_EXT 0x2016\r\n#define WGL_GREEN_BITS_EXT 0x2017\r\n#define WGL_GREEN_SHIFT_EXT 0x2018\r\n#define WGL_BLUE_BITS_EXT 0x2019\r\n#define WGL_BLUE_SHIFT_EXT 0x201A\r\n#define WGL_ALPHA_BITS_EXT 0x201B\r\n#define WGL_ALPHA_SHIFT_EXT 0x201C\r\n#define WGL_ACCUM_BITS_EXT 0x201D\r\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\r\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\r\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\r\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\r\n#define WGL_DEPTH_BITS_EXT 0x2022\r\n#define WGL_STENCIL_BITS_EXT 0x2023\r\n#define WGL_AUX_BUFFERS_EXT 0x2024\r\n#define WGL_NO_ACCELERATION_EXT 0x2025\r\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\r\n#define WGL_FULL_ACCELERATION_EXT 0x2027\r\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\r\n#define WGL_SWAP_COPY_EXT 0x2029\r\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\r\n#define WGL_TYPE_RGBA_EXT 0x202B\r\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\r\n\r\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\r\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);\r\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);\r\n\r\n#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)\r\n#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)\r\n#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)\r\n\r\n#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)\r\n\r\n#endif /* WGL_EXT_pixel_format */\r\n\r\n/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */\r\n\r\n#ifndef WGL_EXT_pixel_format_packed_float\r\n#define WGL_EXT_pixel_format_packed_float 1\r\n\r\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\r\n\r\n#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)\r\n\r\n#endif /* WGL_EXT_pixel_format_packed_float */\r\n\r\n/* -------------------------- WGL_EXT_swap_control ------------------------- */\r\n\r\n#ifndef WGL_EXT_swap_control\r\n#define WGL_EXT_swap_control 1\r\n\r\ntypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\r\ntypedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\r\n\r\n#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)\r\n#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)\r\n\r\n#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)\r\n\r\n#endif /* WGL_EXT_swap_control */\r\n\r\n/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */\r\n\r\n#ifndef WGL_EXT_swap_control_tear\r\n#define WGL_EXT_swap_control_tear 1\r\n\r\n#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear)\r\n\r\n#endif /* WGL_EXT_swap_control_tear */\r\n\r\n/* --------------------- WGL_I3D_digital_video_control --------------------- */\r\n\r\n#ifndef WGL_I3D_digital_video_control\r\n#define WGL_I3D_digital_video_control 1\r\n\r\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\r\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\r\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\r\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\r\n\r\ntypedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\r\ntypedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\r\n\r\n#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)\r\n#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)\r\n\r\n#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)\r\n\r\n#endif /* WGL_I3D_digital_video_control */\r\n\r\n/* ----------------------------- WGL_I3D_gamma ----------------------------- */\r\n\r\n#ifndef WGL_I3D_gamma\r\n#define WGL_I3D_gamma 1\r\n\r\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\r\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\r\n\r\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);\r\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\r\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);\r\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\r\n\r\n#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)\r\n#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)\r\n#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)\r\n#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)\r\n\r\n#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)\r\n\r\n#endif /* WGL_I3D_gamma */\r\n\r\n/* ---------------------------- WGL_I3D_genlock ---------------------------- */\r\n\r\n#ifndef WGL_I3D_genlock\r\n#define WGL_I3D_genlock 1\r\n\r\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\r\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\r\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\r\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\r\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\r\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\r\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\r\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\r\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\r\n\r\ntypedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\r\ntypedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\r\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\r\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\r\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\r\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\r\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);\r\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);\r\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);\r\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);\r\ntypedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);\r\n\r\n#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)\r\n#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)\r\n#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)\r\n#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)\r\n#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)\r\n#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)\r\n#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)\r\n#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)\r\n#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)\r\n#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)\r\n#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)\r\n#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)\r\n\r\n#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)\r\n\r\n#endif /* WGL_I3D_genlock */\r\n\r\n/* -------------------------- WGL_I3D_image_buffer ------------------------- */\r\n\r\n#ifndef WGL_I3D_image_buffer\r\n#define WGL_I3D_image_buffer 1\r\n\r\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\r\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\r\n\r\ntypedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);\r\ntypedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\r\ntypedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\r\ntypedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);\r\n\r\n#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)\r\n#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)\r\n#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)\r\n#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)\r\n\r\n#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)\r\n\r\n#endif /* WGL_I3D_image_buffer */\r\n\r\n/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */\r\n\r\n#ifndef WGL_I3D_swap_frame_lock\r\n#define WGL_I3D_swap_frame_lock 1\r\n\r\ntypedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);\r\ntypedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);\r\ntypedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);\r\n\r\n#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)\r\n#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)\r\n#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)\r\n#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)\r\n\r\n#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)\r\n\r\n#endif /* WGL_I3D_swap_frame_lock */\r\n\r\n/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */\r\n\r\n#ifndef WGL_I3D_swap_frame_usage\r\n#define WGL_I3D_swap_frame_usage 1\r\n\r\ntypedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\r\ntypedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\r\ntypedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\r\n\r\n#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)\r\n#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)\r\n#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)\r\n#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)\r\n\r\n#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)\r\n\r\n#endif /* WGL_I3D_swap_frame_usage */\r\n\r\n/* --------------------------- WGL_NV_DX_interop --------------------------- */\r\n\r\n#ifndef WGL_NV_DX_interop\r\n#define WGL_NV_DX_interop 1\r\n\r\n#define WGL_ACCESS_READ_ONLY_NV 0x0000\r\n#define WGL_ACCESS_READ_WRITE_NV 0x0001\r\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002\r\n\r\ntypedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\r\ntypedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\r\ntypedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\r\ntypedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice);\r\ntypedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access);\r\ntypedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle);\r\ntypedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\r\ntypedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\r\n\r\n#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV)\r\n#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV)\r\n#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV)\r\n#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV)\r\n#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV)\r\n#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV)\r\n#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV)\r\n#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV)\r\n\r\n#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop)\r\n\r\n#endif /* WGL_NV_DX_interop */\r\n\r\n/* --------------------------- WGL_NV_DX_interop2 -------------------------- */\r\n\r\n#ifndef WGL_NV_DX_interop2\r\n#define WGL_NV_DX_interop2 1\r\n\r\n#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2)\r\n\r\n#endif /* WGL_NV_DX_interop2 */\r\n\r\n/* --------------------------- WGL_NV_copy_image --------------------------- */\r\n\r\n#ifndef WGL_NV_copy_image\r\n#define WGL_NV_copy_image 1\r\n\r\ntypedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\r\n\r\n#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV)\r\n\r\n#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image)\r\n\r\n#endif /* WGL_NV_copy_image */\r\n\r\n/* -------------------------- WGL_NV_float_buffer -------------------------- */\r\n\r\n#ifndef WGL_NV_float_buffer\r\n#define WGL_NV_float_buffer 1\r\n\r\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\r\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\r\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\r\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\r\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\r\n\r\n#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)\r\n\r\n#endif /* WGL_NV_float_buffer */\r\n\r\n/* -------------------------- WGL_NV_gpu_affinity -------------------------- */\r\n\r\n#ifndef WGL_NV_gpu_affinity\r\n#define WGL_NV_gpu_affinity 1\r\n\r\n#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\r\n#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\r\n\r\nDECLARE_HANDLE(HGPUNV);\r\ntypedef struct _GPU_DEVICE {\r\n  DWORD cb; \r\n  CHAR DeviceName[32]; \r\n  CHAR DeviceString[128]; \r\n  DWORD Flags; \r\n  RECT rcVirtualScreen; \r\n} GPU_DEVICE, *PGPU_DEVICE;\r\n\r\ntypedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\r\ntypedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\r\ntypedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\r\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\r\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\r\n\r\n#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)\r\n#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)\r\n#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)\r\n#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)\r\n#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)\r\n\r\n#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)\r\n\r\n#endif /* WGL_NV_gpu_affinity */\r\n\r\n/* ---------------------- WGL_NV_multisample_coverage ---------------------- */\r\n\r\n#ifndef WGL_NV_multisample_coverage\r\n#define WGL_NV_multisample_coverage 1\r\n\r\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\r\n#define WGL_COLOR_SAMPLES_NV 0x20B9\r\n\r\n#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage)\r\n\r\n#endif /* WGL_NV_multisample_coverage */\r\n\r\n/* -------------------------- WGL_NV_present_video ------------------------- */\r\n\r\n#ifndef WGL_NV_present_video\r\n#define WGL_NV_present_video 1\r\n\r\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\r\n\r\nDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\r\n\r\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList);\r\ntypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue);\r\n\r\n#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV)\r\n#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV)\r\n#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV)\r\n\r\n#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video)\r\n\r\n#endif /* WGL_NV_present_video */\r\n\r\n/* ---------------------- WGL_NV_render_depth_texture ---------------------- */\r\n\r\n#ifndef WGL_NV_render_depth_texture\r\n#define WGL_NV_render_depth_texture 1\r\n\r\n#define WGL_NO_TEXTURE_ARB 0x2077\r\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\r\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\r\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\r\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\r\n\r\n#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)\r\n\r\n#endif /* WGL_NV_render_depth_texture */\r\n\r\n/* -------------------- WGL_NV_render_texture_rectangle -------------------- */\r\n\r\n#ifndef WGL_NV_render_texture_rectangle\r\n#define WGL_NV_render_texture_rectangle 1\r\n\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\r\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\r\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\r\n\r\n#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)\r\n\r\n#endif /* WGL_NV_render_texture_rectangle */\r\n\r\n/* --------------------------- WGL_NV_swap_group --------------------------- */\r\n\r\n#ifndef WGL_NV_swap_group\r\n#define WGL_NV_swap_group 1\r\n\r\ntypedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\r\ntypedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier);\r\ntypedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\r\n\r\n#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV)\r\n#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV)\r\n#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV)\r\n#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV)\r\n#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV)\r\n#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV)\r\n\r\n#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group)\r\n\r\n#endif /* WGL_NV_swap_group */\r\n\r\n/* ----------------------- WGL_NV_vertex_array_range ----------------------- */\r\n\r\n#ifndef WGL_NV_vertex_array_range\r\n#define WGL_NV_vertex_array_range 1\r\n\r\ntypedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\r\ntypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\r\n\r\n#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)\r\n#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)\r\n\r\n#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)\r\n\r\n#endif /* WGL_NV_vertex_array_range */\r\n\r\n/* -------------------------- WGL_NV_video_capture ------------------------- */\r\n\r\n#ifndef WGL_NV_video_capture\r\n#define WGL_NV_video_capture 1\r\n\r\n#define WGL_UNIQUE_ID_NV 0x20CE\r\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\r\n\r\nDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\r\n\r\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\r\ntypedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList);\r\ntypedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\r\ntypedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue);\r\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\r\n\r\n#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV)\r\n#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV)\r\n#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV)\r\n#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV)\r\n#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV)\r\n\r\n#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture)\r\n\r\n#endif /* WGL_NV_video_capture */\r\n\r\n/* -------------------------- WGL_NV_video_output -------------------------- */\r\n\r\n#ifndef WGL_NV_video_output\r\n#define WGL_NV_video_output 1\r\n\r\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\r\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\r\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\r\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\r\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\r\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\r\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\r\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\r\n#define WGL_VIDEO_OUT_FRAME 0x20C8\r\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\r\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\r\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\r\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\r\n\r\nDECLARE_HANDLE(HPVIDEODEV);\r\n\r\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\r\ntypedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice);\r\ntypedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\r\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\r\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\r\ntypedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock);\r\n\r\n#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV)\r\n#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV)\r\n#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV)\r\n#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV)\r\n#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV)\r\n#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV)\r\n\r\n#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output)\r\n\r\n#endif /* WGL_NV_video_output */\r\n\r\n/* -------------------------- WGL_OML_sync_control ------------------------- */\r\n\r\n#ifndef WGL_OML_sync_control\r\n#define WGL_OML_sync_control 1\r\n\r\ntypedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);\r\ntypedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);\r\ntypedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\r\ntypedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\r\ntypedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);\r\ntypedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);\r\n\r\n#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)\r\n#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)\r\n#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)\r\n#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)\r\n#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)\r\n#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)\r\n\r\n#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)\r\n\r\n#endif /* WGL_OML_sync_control */\r\n\r\n/* ------------------------------------------------------------------------- */\r\n\r\n#ifdef GLEW_MX\r\n#define WGLEW_FUN_EXPORT\r\n#define WGLEW_VAR_EXPORT\r\n#else\r\n#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT\r\n#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT\r\n#endif /* GLEW_MX */\r\n\r\n#ifdef GLEW_MX\r\nstruct WGLEWContextStruct\r\n{\r\n#endif /* GLEW_MX */\r\n\r\nWGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD;\r\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD;\r\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD;\r\nWGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD;\r\nWGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD;\r\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD;\r\nWGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD;\r\nWGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD;\r\nWGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;\r\nWGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;\r\nWGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;\r\nWGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;\r\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;\r\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;\r\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;\r\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;\r\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;\r\nWGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;\r\nWGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;\r\nWGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;\r\nWGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;\r\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;\r\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;\r\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;\r\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;\r\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;\r\nWGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;\r\nWGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;\r\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;\r\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;\r\nWGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;\r\nWGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;\r\nWGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;\r\nWGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;\r\nWGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;\r\nWGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;\r\nWGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;\r\nWGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV;\r\nWGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;\r\nWGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;\r\nWGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;\r\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;\r\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV;\r\nWGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV;\r\nWGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;\r\nWGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV;\r\nWGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV;\r\nWGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV;\r\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV;\r\nWGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV;\r\n\r\nWGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;\r\nWGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;\r\nWGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;\r\nWGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;\r\nWGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;\r\nWGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output;\r\nWGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control;\r\n\r\n#ifdef GLEW_MX\r\n}; /* WGLEWContextStruct */\r\n#endif /* GLEW_MX */\r\n\r\n/* ------------------------------------------------------------------------- */\r\n\r\n#ifdef GLEW_MX\r\n\r\ntypedef struct WGLEWContextStruct WGLEWContext;\r\nGLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx);\r\nGLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name);\r\n\r\n#define wglewInit() wglewContextInit(wglewGetContext())\r\n#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)\r\n\r\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))\r\n#define WGLEW_GET_FUN(x) wglewGetContext()->x\r\n\r\n#else /* GLEW_MX */\r\n\r\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)\r\n#define WGLEW_GET_FUN(x) x\r\n\r\nGLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);\r\n\r\n#endif /* GLEW_MX */\r\n\r\nGLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#undef GLEWAPI\r\n\r\n#endif /* __wglew_h__ */\r\n"
  },
  {
    "path": "Engine/porting/Win32/SampleProject/SampleProject.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdafx.h>\r\n#include \"GameEngine.h\"\r\n\r\nint _tmain(int argc, _TCHAR * argv[])\r\n{\r\n\treturn GameEngineMain(argc, argv);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/SampleProject/SampleProject.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug_Cpp|Win32\">\r\n      <Configuration>Debug_Cpp</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug_CSharp|Win32\">\r\n      <Configuration>Debug_CSharp</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{32B44C90-DD31-45A5-B7D9-A31332A95918}</ProjectGuid>\r\n    <RootNamespace>SampleProject</RootNamespace>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Debug CSharp|Win32'\">\r\n    <CharacterSet>MultiByte</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <PlatformToolset>v120</PlatformToolset>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\" Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n    <LibraryPath>$(SolutionDir)openssl/lib;$(SolutionDir)Lame;$(SolutionDir)pure-Lua\\;$(SolutionDir)LuaEdit\\x86;$(SolutionDir)zlib\\;$(SolutionDir)directx;$(LibraryPath)</LibraryPath>\r\n    <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\\include;</IncludePath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n    <LibraryPath>$(SolutionDir)openssl/lib;$(SolutionDir)Lame;$(SolutionDir)pure-Lua\\;$(SolutionDir)LuaEdit\\x86;$(SolutionDir)zlib\\;$(SolutionDir)directx;$(LibraryPath)</LibraryPath>\r\n    <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\\include;</IncludePath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug CSharp|Win32'\">\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n    <LibraryPath>$(SolutionDir)openssl/lib;$(SolutionDir)Lame;$(SolutionDir)pure-Lua\\;$(SolutionDir)LuaEdit\\x86;$(SolutionDir)zlib\\;$(SolutionDir)directx;$(LibraryPath)</LibraryPath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <LibraryPath>$(SolutionDir)openssl/lib;$(SolutionDir)Lame;$(SolutionDir)pure-Lua\\;$(SolutionDir)LuaEdit\\x86;$(SolutionDir)zlib\\;$(SolutionDir)directx;$(LibraryPath)</LibraryPath>\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <OutDir>$(SolutionDir)Output\\$(Configuration)\\</OutDir>\r\n    <LibraryPath>$(SolutionDir)openssl/lib;$(SolutionDir)Lame;$(SolutionDir)pure-Lua\\;$(SolutionDir)LuaEdit\\x86;$(SolutionDir)zlib\\;$(SolutionDir)directx;$(LibraryPath)</LibraryPath>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <AdditionalIncludeDirectories>../../../source/UISystem/;../../../source/Animation/;../../../source/Assets/;../../../source/Core/;../../../source/LuaLib/;../../../source/HTTP/;../../../source/SystemTask/;../../../source/Rendering/;../../../source/SceneGraph/;../../../source/UnitSystem/;../../../include/;../../../Source/include/;../../../libs/minizip;../../../libs/lua;../../../porting/Win32/;../../../porting/Win32/LuaEdit/include/;../../../porting/Win32/Platform;../../../porting/Win32/openssl/include/;../../../porting/Win32/zlib/include/;../../../porting/Win32/Lame/;../../../libs/SQLite/;../../../source/Database/;../../../source/AISystem/;../../../source/DataSet/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>$(SolutionDir)/Output/$(Configuration)\\OSSGameLibraryWin32.lib;wsock32.lib;Ws2_32.lib;Wldap32.lib;opengl32.lib;glu32.lib;$(SolutionDir)/Platform/libs/glut32.lib;$(SolutionDir)/Platform/libs/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>\r\n      <AdditionalLibraryDirectories>$(ProjectDir)directx</AdditionalLibraryDirectories>\r\n    </Link>\r\n    <PostBuildEvent>\r\n      <Command>copy $(OutDir)..\\..\\gl*.dll $(OutDir)</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <AdditionalIncludeDirectories>../../../source/UISystem/;../../../source/Animation/;../../../source/Assets/;../../../source/Core/;../../../source/LuaLib/;../../../source/HTTP/;../../../source/SystemTask/;../../../source/Rendering/;../../../source/SceneGraph/;../../../source/UnitSystem/;../../../include/;../../../Source/include/;../../../libs/minizip;../../../libs/lua;../../../porting/Win32/;../../../porting/Win32/LuaEdit/include/;../../../porting/Win32/Platform;../../../porting/Win32/openssl/include/;../../../porting/Win32/zlib/include/;../../../porting/Win32/Lame/;../../../libs/SQLite/;../../../source/Database/;../../../source/AISystem/;../../../source/DataSet/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalOptions>/D __CSHARP_VERSION__ %(AdditionalOptions)</AdditionalOptions>\r\n    </ClCompile>\r\n    <Link>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>$(SolutionDir)/Output/$(Configuration)\\OSSGameLibraryWin32.lib;wsock32.lib;Ws2_32.lib;Wldap32.lib;opengl32.lib;glu32.lib;$(SolutionDir)/Platform/libs/glut32.lib;$(SolutionDir)/Platform/libs/glew32.lib;$(SolutionDir)/Output/$(Configuration)\\mono.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>\r\n      <AdditionalLibraryDirectories>$(ProjectDir)directx</AdditionalLibraryDirectories>\r\n    </Link>\r\n    <PostBuildEvent>\r\n      <Command>copy $(OutDir)..\\..\\gl*.dll $(OutDir)</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>MaxSpeed</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <AdditionalIncludeDirectories>../../../source/UISystem/;../../../source/Animation/;../../../source/Assets/;../../../source/Core/;../../../source/LuaLib/;../../../source/HTTP/;../../../source/SystemTask/;../../../source/Rendering/;../../../source/SceneGraph/;../../../source/UnitSystem/;../../../include/;../../../Source/include/;../../../libs/minizip;../../../libs/lua;../../../porting/Win32/;../../../porting/Win32/LuaEdit/include/;../../../porting/Win32/Platform;../../../porting/Win32/openssl/include/;../../../porting/Win32/zlib/include/;../../../porting/Win32/Lame/;../../../libs/SQLite/;../../../source/Database/;../../../source/AISystem/;../../../source/DataSet/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <AdditionalDependencies>$(SolutionDir)/Output/$(Configuration)\\OSSGameLibraryWin32.lib;wsock32.lib;Ws2_32.lib;Wldap32.lib;opengl32.lib;glu32.lib;$(SolutionDir)/Platform/libs/glut32.lib;$(SolutionDir)/Platform/libs/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>\r\n      <AdditionalLibraryDirectories>$(ProjectDir)directx</AdditionalLibraryDirectories>\r\n      <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\r\n    </Link>\r\n    <PostBuildEvent>\r\n      <Command>copy $(OutDir)..\\..\\*.dll $(OutDir)</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug CSharp|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <AdditionalIncludeDirectories>../../../source/UISystem/;../../../source/Animation/;../../../source/Assets/;../../../source/Core/;../../../source/LuaLib/;../../../source/HTTP/;../../../source/SystemTask/;../../../source/Rendering/;../../../source/SceneGraph/;../../../source/UnitSystem/;../../../include/;../../../Source/include/;../../../libs/minizip;../../../libs/lua;../../../porting/Win32/;../../../porting/Win32/LuaEdit/include/;../../../porting/Win32/Platform;../../../porting/Win32/openssl/include/;../../../porting/Win32/zlib/include/;../../../porting/Win32/Lame/;../../../libs/SQLite/;../../../source/Database/;../../../source/AISystem/;../../../source/DataSet/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <ClCompile>\r\n      <AdditionalIncludeDirectories>../../../source/UISystem/;../../../source/Animation/;../../../source/Assets/;../../../source/Core/;../../../source/LuaLib/;../../../source/HTTP/;../../../source/SystemTask/;../../../source/Rendering/;../../../source/SceneGraph/;../../../source/UnitSystem/;../../../include/;../../../Source/include/;../../../libs/minizip;../../../libs/lua;../../../porting/Win32/;../../../porting/Win32/LuaEdit/include/;../../../porting/Win32/Platform;../../../porting/Win32/openssl/include/;../../../porting/Win32/zlib/include/;../../../porting/Win32/Lame/;../../../libs/SQLite/;../../../source/Database/;../../../source/AISystem/;../../../source/DataSet/;%(AdditionalIncludeDirectories);../../../libs/RuntimeCSharp/;../../../source/Scripting/</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug_Cpp|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;DEBUG_MEMORY_OFF;DEBUG_PERFORMANCE_OFF;DEBUG_LUAEDIT_OFF;DEBUG_RT_CHECK;DEBUG_MENU;__CPP_VERSION__;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <AdditionalOptions>/D __CPP_VERSION__ %(AdditionalOptions)</AdditionalOptions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r\n      <ExceptionHandling>Sync</ExceptionHandling>\r\n      <OmitFramePointers>false</OmitFramePointers>\r\n    </ClCompile>\r\n    <Link>\r\n      <AdditionalLibraryDirectories>$(ProjectDir)directx</AdditionalLibraryDirectories>\r\n      <AdditionalDependencies>$(SolutionDir)/Output/$(Configuration)\\OSSGameLibraryWin32.lib;wsock32.lib;Ws2_32.lib;Wldap32.lib;opengl32.lib;glu32.lib;$(SolutionDir)/Platform/libs/glut32.lib;$(SolutionDir)/Platform/libs/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n    <PostBuildEvent>\r\n      <Command>copy $(OutDir)..\\..\\gl*.dll $(OutDir)</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\..\\..\\..\\SampleProject\\Cpp\\out.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\..\\SampleProject\\game\\CSampleProjectEntrance.cpp\" />\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_Dictionary.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_List.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Array.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Console.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Exception.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Memory.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Object.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_String.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_System.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\InternalUtils.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\MarshallingUtils.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\source\\Scripting\\ExportListC_Likefunction.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"SampleProject.cpp\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Collections.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_Dictionary.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_List.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\Generic.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Array.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Console.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Marshal.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Math.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Memory.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Object.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_String.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_System.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\InternalUtils.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\MarshallingUtils.h\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\inline\\classPrototypes.inl\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </None>\r\n    <None Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\inline\\__InternalUtilsGetTypeID_specializations.inl\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">true</ExcludedFromBuild>\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Debug_CSharp|Win32'\">true</ExcludedFromBuild>\r\n    </None>\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "Engine/porting/Win32/SampleProject/SampleProject.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"source\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"source\\game\">\r\n      <UniqueIdentifier>{c00262c1-79e2-417a-8022-9a1736f0ccf0}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"source\\Scripting\">\r\n      <UniqueIdentifier>{c9284a41-5d70-4085-9a21-f8e0f571c40e}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"source\\RuntimeLib\">\r\n      <UniqueIdentifier>{ee3e12ae-ae5b-45df-b4ab-923ecbdabcaf}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"source\\CppCode\">\r\n      <UniqueIdentifier>{9e6cc6c1-7d7c-44d2-9bb2-2d1d139f662f}</UniqueIdentifier>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\..\\..\\source\\Scripting\\ExportListC_Likefunction.cpp\">\r\n      <Filter>source\\Scripting</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Array.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Console.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Exception.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Memory.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_String.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_System.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\InternalUtils.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\MarshallingUtils.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_Dictionary.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_List.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Object.cpp\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\..\\SampleProject\\game\\CSampleProjectEntrance.cpp\">\r\n      <Filter>source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"SampleProject.cpp\">\r\n      <Filter>source</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\..\\..\\..\\SampleProject\\Cpp\\out.cpp\">\r\n      <Filter>source\\CppCode</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Array.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Console.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Marshal.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Math.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Memory.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_Object.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_String.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\CS_System.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\InternalUtils.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\MarshallingUtils.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Collections.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_Dictionary.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\CS_List.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\Collections\\Generic\\Generic.h\">\r\n      <Filter>source\\RuntimeLib</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\inline\\__InternalUtilsGetTypeID_specializations.inl\">\r\n      <Filter>source\\CppCode</Filter>\r\n    </None>\r\n    <None Include=\"..\\..\\..\\libs\\RuntimeCSharp\\RuntimeLibrary\\inline\\classPrototypes.inl\">\r\n      <Filter>source\\CppCode</Filter>\r\n    </None>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "Engine/porting/Win32/assert.c",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"assert_klb.h\"\r\n#include <Windows.h>\r\n#include <stdio.h>\r\n\r\nvoid assertFunction(int line, const char* file, const char* msg,...) {\r\n\tva_list\targp;\r\n\tchar pszBuf [1024];\r\n\tchar log\t[1024];\r\n\r\n\tva_start(argp, msg);\r\n\tvsprintf_s( pszBuf,1024, msg, argp);\r\n\tva_end(argp);\r\n\r\n\tsprintf_s( log,1024, \"Assert l.%i in %s : \\n%s\\n\",line, file, pszBuf); \r\n\r\n\tMessageBox( NULL, log, \"Assert\", MB_OK);\r\n#ifndef DEBUG_TOOL_EXTERNAL\r\n\tDebugBreak();\r\n#else\r\n\texit(1);\r\n#endif\r\n}\r\n\r\nvoid msgBox(char* log) {\r\n\tMessageBox( NULL, log, \"Sinc Error\", MB_OK);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/aes.h",
    "content": "/* crypto/aes/aes.h -*- mode:C; c-file-style: \"eay\" -*- */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n */\r\n\r\n#ifndef HEADER_AES_H\r\n#define HEADER_AES_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_AES\r\n#error AES is disabled.\r\n#endif\r\n\r\n#include <stddef.h>\r\n\r\n#define AES_ENCRYPT\t1\r\n#define AES_DECRYPT\t0\r\n\r\n/* Because array size can't be a const in C, the following two are macros.\r\n   Both sizes are in bytes. */\r\n#define AES_MAXNR 14\r\n#define AES_BLOCK_SIZE 16\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* This should be a hidden type, but EVP requires that the size be known */\r\nstruct aes_key_st {\r\n#ifdef AES_LONG\r\n    unsigned long rd_key[4 *(AES_MAXNR + 1)];\r\n#else\r\n    unsigned int rd_key[4 *(AES_MAXNR + 1)];\r\n#endif\r\n    int rounds;\r\n};\r\ntypedef struct aes_key_st AES_KEY;\r\n\r\nconst char *AES_options(void);\r\n\r\nint AES_set_encrypt_key(const unsigned char *userKey, const int bits,\r\n\tAES_KEY *key);\r\nint AES_set_decrypt_key(const unsigned char *userKey, const int bits,\r\n\tAES_KEY *key);\r\n\r\nint private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,\r\n\tAES_KEY *key);\r\nint private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,\r\n\tAES_KEY *key);\r\n\r\nvoid AES_encrypt(const unsigned char *in, unsigned char *out,\r\n\tconst AES_KEY *key);\r\nvoid AES_decrypt(const unsigned char *in, unsigned char *out,\r\n\tconst AES_KEY *key);\r\n\r\nvoid AES_ecb_encrypt(const unsigned char *in, unsigned char *out,\r\n\tconst AES_KEY *key, const int enc);\r\nvoid AES_cbc_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const AES_KEY *key,\r\n\tunsigned char *ivec, const int enc);\r\nvoid AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const AES_KEY *key,\r\n\tunsigned char *ivec, int *num, const int enc);\r\nvoid AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const AES_KEY *key,\r\n\tunsigned char *ivec, int *num, const int enc);\r\nvoid AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const AES_KEY *key,\r\n\tunsigned char *ivec, int *num, const int enc);\r\nvoid AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const AES_KEY *key,\r\n\tunsigned char *ivec, int *num);\r\nvoid AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const AES_KEY *key,\r\n\tunsigned char ivec[AES_BLOCK_SIZE],\r\n\tunsigned char ecount_buf[AES_BLOCK_SIZE],\r\n\tunsigned int *num);\r\n/* NB: the IV is _two_ blocks long */\r\nvoid AES_ige_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t     size_t length, const AES_KEY *key,\r\n\t\t     unsigned char *ivec, const int enc);\r\n/* NB: the IV is _four_ blocks long */\r\nvoid AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t length, const AES_KEY *key,\r\n\t\t\tconst AES_KEY *key2, const unsigned char *ivec,\r\n\t\t\tconst int enc);\r\n\r\nint AES_wrap_key(AES_KEY *key, const unsigned char *iv,\r\n\t\tunsigned char *out,\r\n\t\tconst unsigned char *in, unsigned int inlen);\r\nint AES_unwrap_key(AES_KEY *key, const unsigned char *iv,\r\n\t\tunsigned char *out,\r\n\t\tconst unsigned char *in, unsigned int inlen);\r\n\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* !HEADER_AES_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/applink.c",
    "content": "#define APPLINK_STDIN\t1\r\n#define APPLINK_STDOUT\t2\r\n#define APPLINK_STDERR\t3\r\n#define APPLINK_FPRINTF\t4\r\n#define APPLINK_FGETS\t5\r\n#define APPLINK_FREAD\t6\r\n#define APPLINK_FWRITE\t7\r\n#define APPLINK_FSETMOD\t8\r\n#define APPLINK_FEOF\t9\r\n#define APPLINK_FCLOSE \t10\t/* should not be used */\r\n\r\n#define APPLINK_FOPEN\t11\t/* solely for completeness */\r\n#define APPLINK_FSEEK\t12\r\n#define APPLINK_FTELL\t13\r\n#define APPLINK_FFLUSH\t14\r\n#define APPLINK_FERROR\t15\r\n#define APPLINK_CLEARERR 16\r\n#define APPLINK_FILENO\t17\t/* to be used with below */\r\n\r\n#define APPLINK_OPEN\t18\t/* formally can't be used, as flags can vary */\r\n#define APPLINK_READ\t19\r\n#define APPLINK_WRITE\t20\r\n#define APPLINK_LSEEK\t21\r\n#define APPLINK_CLOSE\t22\r\n#define APPLINK_MAX\t22\t/* always same as last macro */\r\n\r\n#ifndef APPMACROS_ONLY\r\n#include <stdio.h>\r\n#include <io.h>\r\n#include <fcntl.h>\r\n\r\nstatic void *app_stdin(void)\t\t{ return stdin;  }\r\nstatic void *app_stdout(void)\t\t{ return stdout; }\r\nstatic void *app_stderr(void)\t\t{ return stderr; }\r\nstatic int   app_feof(FILE *fp)\t\t{ return feof(fp); }\r\nstatic int   app_ferror(FILE *fp)\t{ return ferror(fp); }\r\nstatic void  app_clearerr(FILE *fp)\t{ clearerr(fp); }\r\nstatic int   app_fileno(FILE *fp)\t{ return _fileno(fp); }\r\nstatic int   app_fsetmod(FILE *fp,char mod)\r\n{ return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); }\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n__declspec(dllexport)\r\nvoid **\r\n#if defined(__BORLANDC__)\r\n__stdcall\t/* __stdcall appears to be the only way to get the name\r\n\t\t * decoration right with Borland C. Otherwise it works\r\n\t\t * purely incidentally, as we pass no parameters. */\r\n#else\r\n__cdecl\r\n#endif\r\nOPENSSL_Applink(void)\r\n{ static int once=1;\r\n  static void *OPENSSL_ApplinkTable[APPLINK_MAX+1]={(void *)APPLINK_MAX};\r\n\r\n    if (once)\r\n    {\tOPENSSL_ApplinkTable[APPLINK_STDIN]\t= app_stdin;\r\n\tOPENSSL_ApplinkTable[APPLINK_STDOUT]\t= app_stdout;\r\n\tOPENSSL_ApplinkTable[APPLINK_STDERR]\t= app_stderr;\r\n\tOPENSSL_ApplinkTable[APPLINK_FPRINTF]\t= fprintf;\r\n\tOPENSSL_ApplinkTable[APPLINK_FGETS]\t= fgets;\r\n\tOPENSSL_ApplinkTable[APPLINK_FREAD]\t= fread;\r\n\tOPENSSL_ApplinkTable[APPLINK_FWRITE]\t= fwrite;\r\n\tOPENSSL_ApplinkTable[APPLINK_FSETMOD]\t= app_fsetmod;\r\n\tOPENSSL_ApplinkTable[APPLINK_FEOF]\t= app_feof;\r\n\tOPENSSL_ApplinkTable[APPLINK_FCLOSE]\t= fclose;\r\n\r\n\tOPENSSL_ApplinkTable[APPLINK_FOPEN]\t= fopen;\r\n\tOPENSSL_ApplinkTable[APPLINK_FSEEK]\t= fseek;\r\n\tOPENSSL_ApplinkTable[APPLINK_FTELL]\t= ftell;\r\n\tOPENSSL_ApplinkTable[APPLINK_FFLUSH]\t= fflush;\r\n\tOPENSSL_ApplinkTable[APPLINK_FERROR]\t= app_ferror;\r\n\tOPENSSL_ApplinkTable[APPLINK_CLEARERR]\t= app_clearerr;\r\n\tOPENSSL_ApplinkTable[APPLINK_FILENO]\t= app_fileno;\r\n\r\n\tOPENSSL_ApplinkTable[APPLINK_OPEN]\t= _open;\r\n\tOPENSSL_ApplinkTable[APPLINK_READ]\t= _read;\r\n\tOPENSSL_ApplinkTable[APPLINK_WRITE]\t= _write;\r\n\tOPENSSL_ApplinkTable[APPLINK_LSEEK]\t= _lseek;\r\n\tOPENSSL_ApplinkTable[APPLINK_CLOSE]\t= _close;\r\n\r\n\tonce = 0;\r\n    }\r\n\r\n  return OPENSSL_ApplinkTable;\r\n}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/asn1.h",
    "content": "/* crypto/asn1/asn1.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_ASN1_H\r\n#define HEADER_ASN1_H\r\n\r\n#include <time.h>\r\n#include <openssl/e_os2.h>\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/stack.h>\r\n#include <openssl/safestack.h>\r\n\r\n#include <openssl/symhacks.h>\r\n\r\n#include <openssl/ossl_typ.h>\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#endif\r\n\r\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\r\n# undef OPENSSL_EXTERN\r\n# define OPENSSL_EXTERN OPENSSL_EXPORT\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define V_ASN1_UNIVERSAL\t\t0x00\r\n#define\tV_ASN1_APPLICATION\t\t0x40\r\n#define V_ASN1_CONTEXT_SPECIFIC\t\t0x80\r\n#define V_ASN1_PRIVATE\t\t\t0xc0\r\n\r\n#define V_ASN1_CONSTRUCTED\t\t0x20\r\n#define V_ASN1_PRIMITIVE_TAG\t\t0x1f\r\n#define V_ASN1_PRIMATIVE_TAG\t\t0x1f\r\n\r\n#define V_ASN1_APP_CHOOSE\t\t-2\t/* let the recipient choose */\r\n#define V_ASN1_OTHER\t\t\t-3\t/* used in ASN1_TYPE */\r\n#define V_ASN1_ANY\t\t\t-4\t/* used in ASN1 template code */\r\n\r\n#define V_ASN1_NEG\t\t\t0x100\t/* negative flag */\r\n\r\n#define V_ASN1_UNDEF\t\t\t-1\r\n#define V_ASN1_EOC\t\t\t0\r\n#define V_ASN1_BOOLEAN\t\t\t1\t/**/\r\n#define V_ASN1_INTEGER\t\t\t2\r\n#define V_ASN1_NEG_INTEGER\t\t(2 | V_ASN1_NEG)\r\n#define V_ASN1_BIT_STRING\t\t3\r\n#define V_ASN1_OCTET_STRING\t\t4\r\n#define V_ASN1_NULL\t\t\t5\r\n#define V_ASN1_OBJECT\t\t\t6\r\n#define V_ASN1_OBJECT_DESCRIPTOR\t7\r\n#define V_ASN1_EXTERNAL\t\t\t8\r\n#define V_ASN1_REAL\t\t\t9\r\n#define V_ASN1_ENUMERATED\t\t10\r\n#define V_ASN1_NEG_ENUMERATED\t\t(10 | V_ASN1_NEG)\r\n#define V_ASN1_UTF8STRING\t\t12\r\n#define V_ASN1_SEQUENCE\t\t\t16\r\n#define V_ASN1_SET\t\t\t17\r\n#define V_ASN1_NUMERICSTRING\t\t18\t/**/\r\n#define V_ASN1_PRINTABLESTRING\t\t19\r\n#define V_ASN1_T61STRING\t\t20\r\n#define V_ASN1_TELETEXSTRING\t\t20\t/* alias */\r\n#define V_ASN1_VIDEOTEXSTRING\t\t21\t/**/\r\n#define V_ASN1_IA5STRING\t\t22\r\n#define V_ASN1_UTCTIME\t\t\t23\r\n#define V_ASN1_GENERALIZEDTIME\t\t24\t/**/\r\n#define V_ASN1_GRAPHICSTRING\t\t25\t/**/\r\n#define V_ASN1_ISO64STRING\t\t26\t/**/\r\n#define V_ASN1_VISIBLESTRING\t\t26\t/* alias */\r\n#define V_ASN1_GENERALSTRING\t\t27\t/**/\r\n#define V_ASN1_UNIVERSALSTRING\t\t28\t/**/\r\n#define V_ASN1_BMPSTRING\t\t30\r\n\r\n/* For use with d2i_ASN1_type_bytes() */\r\n#define B_ASN1_NUMERICSTRING\t0x0001\r\n#define B_ASN1_PRINTABLESTRING\t0x0002\r\n#define B_ASN1_T61STRING\t0x0004\r\n#define B_ASN1_TELETEXSTRING\t0x0004\r\n#define B_ASN1_VIDEOTEXSTRING\t0x0008\r\n#define B_ASN1_IA5STRING\t0x0010\r\n#define B_ASN1_GRAPHICSTRING\t0x0020\r\n#define B_ASN1_ISO64STRING\t0x0040\r\n#define B_ASN1_VISIBLESTRING\t0x0040\r\n#define B_ASN1_GENERALSTRING\t0x0080\r\n#define B_ASN1_UNIVERSALSTRING\t0x0100\r\n#define B_ASN1_OCTET_STRING\t0x0200\r\n#define B_ASN1_BIT_STRING\t0x0400\r\n#define B_ASN1_BMPSTRING\t0x0800\r\n#define B_ASN1_UNKNOWN\t\t0x1000\r\n#define B_ASN1_UTF8STRING\t0x2000\r\n#define B_ASN1_UTCTIME\t\t0x4000\r\n#define B_ASN1_GENERALIZEDTIME\t0x8000\r\n#define B_ASN1_SEQUENCE\t\t0x10000\r\n\r\n/* For use with ASN1_mbstring_copy() */\r\n#define MBSTRING_FLAG\t\t0x1000\r\n#define MBSTRING_UTF8\t\t(MBSTRING_FLAG)\r\n#define MBSTRING_ASC\t\t(MBSTRING_FLAG|1)\r\n#define MBSTRING_BMP\t\t(MBSTRING_FLAG|2)\r\n#define MBSTRING_UNIV\t\t(MBSTRING_FLAG|4)\r\n\r\n#define SMIME_OLDMIME\t\t0x400\r\n#define SMIME_CRLFEOL\t\t0x800\r\n#define SMIME_STREAM\t\t0x1000\r\n\r\nstruct X509_algor_st;\r\nDECLARE_STACK_OF(X509_ALGOR)\r\n\r\n#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */\r\n#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */\r\n\r\n/* We MUST make sure that, except for constness, asn1_ctx_st and\r\n   asn1_const_ctx are exactly the same.  Fortunately, as soon as\r\n   the old ASN1 parsing macros are gone, we can throw this away\r\n   as well... */\r\ntypedef struct asn1_ctx_st\r\n\t{\r\n\tunsigned char *p;/* work char pointer */\r\n\tint eos;\t/* end of sequence read for indefinite encoding */\r\n\tint error;\t/* error code to use when returning an error */\r\n\tint inf;\t/* constructed if 0x20, indefinite is 0x21 */\r\n\tint tag;\t/* tag from last 'get object' */\r\n\tint xclass;\t/* class from last 'get object' */\r\n\tlong slen;\t/* length of last 'get object' */\r\n\tunsigned char *max; /* largest value of p allowed */\r\n\tunsigned char *q;/* temporary variable */\r\n\tunsigned char **pp;/* variable */\r\n\tint line;\t/* used in error processing */\r\n\t} ASN1_CTX;\r\n\r\ntypedef struct asn1_const_ctx_st\r\n\t{\r\n\tconst unsigned char *p;/* work char pointer */\r\n\tint eos;\t/* end of sequence read for indefinite encoding */\r\n\tint error;\t/* error code to use when returning an error */\r\n\tint inf;\t/* constructed if 0x20, indefinite is 0x21 */\r\n\tint tag;\t/* tag from last 'get object' */\r\n\tint xclass;\t/* class from last 'get object' */\r\n\tlong slen;\t/* length of last 'get object' */\r\n\tconst unsigned char *max; /* largest value of p allowed */\r\n\tconst unsigned char *q;/* temporary variable */\r\n\tconst unsigned char **pp;/* variable */\r\n\tint line;\t/* used in error processing */\r\n\t} ASN1_const_CTX;\r\n\r\n/* These are used internally in the ASN1_OBJECT to keep track of\r\n * whether the names and data need to be free()ed */\r\n#define ASN1_OBJECT_FLAG_DYNAMIC\t 0x01\t/* internal use */\r\n#define ASN1_OBJECT_FLAG_CRITICAL\t 0x02\t/* critical x509v3 object id */\r\n#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04\t/* internal use */\r\n#define ASN1_OBJECT_FLAG_DYNAMIC_DATA \t 0x08\t/* internal use */\r\ntypedef struct asn1_object_st\r\n\t{\r\n\tconst char *sn,*ln;\r\n\tint nid;\r\n\tint length;\r\n\tconst unsigned char *data;\t/* data remains const after init */\r\n\tint flags;\t/* Should we free this one */\r\n\t} ASN1_OBJECT;\r\n\r\n#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */\r\n/* This indicates that the ASN1_STRING is not a real value but just a place\r\n * holder for the location where indefinite length constructed data should\r\n * be inserted in the memory buffer \r\n */\r\n#define ASN1_STRING_FLAG_NDEF 0x010 \r\n\r\n/* This flag is used by the CMS code to indicate that a string is not\r\n * complete and is a place holder for content when it had all been \r\n * accessed. The flag will be reset when content has been written to it.\r\n */\r\n\r\n#define ASN1_STRING_FLAG_CONT 0x020 \r\n/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING\r\n * type.\r\n */\r\n#define ASN1_STRING_FLAG_MSTRING 0x040 \r\n/* This is the base type that holds just about everything :-) */\r\nstruct asn1_string_st\r\n\t{\r\n\tint length;\r\n\tint type;\r\n\tunsigned char *data;\r\n\t/* The value of the following field depends on the type being\r\n\t * held.  It is mostly being used for BIT_STRING so if the\r\n\t * input data has a non-zero 'unused bits' value, it will be\r\n\t * handled correctly */\r\n\tlong flags;\r\n\t};\r\n\r\n/* ASN1_ENCODING structure: this is used to save the received\r\n * encoding of an ASN1 type. This is useful to get round\r\n * problems with invalid encodings which can break signatures.\r\n */\r\n\r\ntypedef struct ASN1_ENCODING_st\r\n\t{\r\n\tunsigned char *enc;\t/* DER encoding */\r\n\tlong len;\t\t/* Length of encoding */\r\n\tint modified;\t\t /* set to 1 if 'enc' is invalid */\r\n\t} ASN1_ENCODING;\r\n\r\n/* Used with ASN1 LONG type: if a long is set to this it is omitted */\r\n#define ASN1_LONG_UNDEF\t0x7fffffffL\r\n\r\n#define STABLE_FLAGS_MALLOC\t0x01\r\n#define STABLE_NO_MASK\t\t0x02\r\n#define DIRSTRING_TYPE\t\\\r\n (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)\r\n#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)\r\n\r\ntypedef struct asn1_string_table_st {\r\n\tint nid;\r\n\tlong minsize;\r\n\tlong maxsize;\r\n\tunsigned long mask;\r\n\tunsigned long flags;\r\n} ASN1_STRING_TABLE;\r\n\r\nDECLARE_STACK_OF(ASN1_STRING_TABLE)\r\n\r\n/* size limits: this stuff is taken straight from RFC2459 */\r\n\r\n#define ub_name\t\t\t\t32768\r\n#define ub_common_name\t\t\t64\r\n#define ub_locality_name\t\t128\r\n#define ub_state_name\t\t\t128\r\n#define ub_organization_name\t\t64\r\n#define ub_organization_unit_name\t64\r\n#define ub_title\t\t\t64\r\n#define ub_email_address\t\t128\r\n\r\n/* Declarations for template structures: for full definitions\r\n * see asn1t.h\r\n */\r\ntypedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;\r\ntypedef struct ASN1_TLC_st ASN1_TLC;\r\n/* This is just an opaque pointer */\r\ntypedef struct ASN1_VALUE_st ASN1_VALUE;\r\n\r\n/* Declare ASN1 functions: the implement macro in in asn1t.h */\r\n\r\n#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)\r\n\r\n#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \\\r\n\tDECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)\r\n\r\n#define DECLARE_ASN1_FUNCTIONS_name(type, name) \\\r\n\tDECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \\\r\n\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)\r\n\r\n#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \\\r\n\tDECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \\\r\n\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)\r\n\r\n#define\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \\\r\n\ttype *d2i_##name(type **a, const unsigned char **in, long len); \\\r\n\tint i2d_##name(type *a, unsigned char **out); \\\r\n\tDECLARE_ASN1_ITEM(itname)\r\n\r\n#define\tDECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \\\r\n\ttype *d2i_##name(type **a, const unsigned char **in, long len); \\\r\n\tint i2d_##name(const type *a, unsigned char **out); \\\r\n\tDECLARE_ASN1_ITEM(name)\r\n\r\n#define\tDECLARE_ASN1_NDEF_FUNCTION(name) \\\r\n\tint i2d_##name##_NDEF(name *a, unsigned char **out);\r\n\r\n#define DECLARE_ASN1_FUNCTIONS_const(name) \\\r\n\tDECLARE_ASN1_ALLOC_FUNCTIONS(name) \\\r\n\tDECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)\r\n\r\n#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \\\r\n\ttype *name##_new(void); \\\r\n\tvoid name##_free(type *a);\r\n\r\n#define DECLARE_ASN1_PRINT_FUNCTION(stname) \\\r\n\tDECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)\r\n\r\n#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \\\r\n\tint fname##_print_ctx(BIO *out, stname *x, int indent, \\\r\n\t\t\t\t\t const ASN1_PCTX *pctx);\r\n\r\n#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)\r\n#define I2D_OF(type) int (*)(type *,unsigned char **)\r\n#define I2D_OF_const(type) int (*)(const type *,unsigned char **)\r\n\r\n#define CHECKED_D2I_OF(type, d2i) \\\r\n    ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))\r\n#define CHECKED_I2D_OF(type, i2d) \\\r\n    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))\r\n#define CHECKED_NEW_OF(type, xnew) \\\r\n    ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))\r\n#define CHECKED_PTR_OF(type, p) \\\r\n    ((void*) (1 ? p : (type*)0))\r\n#define CHECKED_PPTR_OF(type, p) \\\r\n    ((void**) (1 ? p : (type**)0))\r\n\r\n#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)\r\n#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)\r\n#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)\r\n\r\nTYPEDEF_D2I2D_OF(void);\r\n\r\n/* The following macros and typedefs allow an ASN1_ITEM\r\n * to be embedded in a structure and referenced. Since\r\n * the ASN1_ITEM pointers need to be globally accessible\r\n * (possibly from shared libraries) they may exist in\r\n * different forms. On platforms that support it the\r\n * ASN1_ITEM structure itself will be globally exported.\r\n * Other platforms will export a function that returns\r\n * an ASN1_ITEM pointer.\r\n *\r\n * To handle both cases transparently the macros below\r\n * should be used instead of hard coding an ASN1_ITEM\r\n * pointer in a structure.\r\n *\r\n * The structure will look like this:\r\n *\r\n * typedef struct SOMETHING_st {\r\n *      ...\r\n *      ASN1_ITEM_EXP *iptr;\r\n *      ...\r\n * } SOMETHING; \r\n *\r\n * It would be initialised as e.g.:\r\n *\r\n * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};\r\n *\r\n * and the actual pointer extracted with:\r\n *\r\n * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);\r\n *\r\n * Finally an ASN1_ITEM pointer can be extracted from an\r\n * appropriate reference with: ASN1_ITEM_rptr(X509). This\r\n * would be used when a function takes an ASN1_ITEM * argument.\r\n *\r\n */\r\n\r\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n\r\n/* ASN1_ITEM pointer exported type */\r\ntypedef const ASN1_ITEM ASN1_ITEM_EXP;\r\n\r\n/* Macro to obtain ASN1_ITEM pointer from exported type */\r\n#define ASN1_ITEM_ptr(iptr) (iptr)\r\n\r\n/* Macro to include ASN1_ITEM pointer from base type */\r\n#define ASN1_ITEM_ref(iptr) (&(iptr##_it))\r\n\r\n#define ASN1_ITEM_rptr(ref) (&(ref##_it))\r\n\r\n#define DECLARE_ASN1_ITEM(name) \\\r\n\tOPENSSL_EXTERN const ASN1_ITEM name##_it;\r\n\r\n#else\r\n\r\n/* Platforms that can't easily handle shared global variables are declared\r\n * as functions returning ASN1_ITEM pointers.\r\n */\r\n\r\n/* ASN1_ITEM pointer exported type */\r\ntypedef const ASN1_ITEM * ASN1_ITEM_EXP(void);\r\n\r\n/* Macro to obtain ASN1_ITEM pointer from exported type */\r\n#define ASN1_ITEM_ptr(iptr) (iptr())\r\n\r\n/* Macro to include ASN1_ITEM pointer from base type */\r\n#define ASN1_ITEM_ref(iptr) (iptr##_it)\r\n\r\n#define ASN1_ITEM_rptr(ref) (ref##_it())\r\n\r\n#define DECLARE_ASN1_ITEM(name) \\\r\n\tconst ASN1_ITEM * name##_it(void);\r\n\r\n#endif\r\n\r\n/* Parameters used by ASN1_STRING_print_ex() */\r\n\r\n/* These determine which characters to escape:\r\n * RFC2253 special characters, control characters and\r\n * MSB set characters\r\n */\r\n\r\n#define ASN1_STRFLGS_ESC_2253\t\t1\r\n#define ASN1_STRFLGS_ESC_CTRL\t\t2\r\n#define ASN1_STRFLGS_ESC_MSB\t\t4\r\n\r\n\r\n/* This flag determines how we do escaping: normally\r\n * RC2253 backslash only, set this to use backslash and\r\n * quote.\r\n */\r\n\r\n#define ASN1_STRFLGS_ESC_QUOTE\t\t8\r\n\r\n\r\n/* These three flags are internal use only. */\r\n\r\n/* Character is a valid PrintableString character */\r\n#define CHARTYPE_PRINTABLESTRING\t0x10\r\n/* Character needs escaping if it is the first character */\r\n#define CHARTYPE_FIRST_ESC_2253\t\t0x20\r\n/* Character needs escaping if it is the last character */\r\n#define CHARTYPE_LAST_ESC_2253\t\t0x40\r\n\r\n/* NB the internal flags are safely reused below by flags\r\n * handled at the top level.\r\n */\r\n\r\n/* If this is set we convert all character strings\r\n * to UTF8 first \r\n */\r\n\r\n#define ASN1_STRFLGS_UTF8_CONVERT\t0x10\r\n\r\n/* If this is set we don't attempt to interpret content:\r\n * just assume all strings are 1 byte per character. This\r\n * will produce some pretty odd looking output!\r\n */\r\n\r\n#define ASN1_STRFLGS_IGNORE_TYPE\t0x20\r\n\r\n/* If this is set we include the string type in the output */\r\n#define ASN1_STRFLGS_SHOW_TYPE\t\t0x40\r\n\r\n/* This determines which strings to display and which to\r\n * 'dump' (hex dump of content octets or DER encoding). We can\r\n * only dump non character strings or everything. If we\r\n * don't dump 'unknown' they are interpreted as character\r\n * strings with 1 octet per character and are subject to\r\n * the usual escaping options.\r\n */\r\n\r\n#define ASN1_STRFLGS_DUMP_ALL\t\t0x80\r\n#define ASN1_STRFLGS_DUMP_UNKNOWN\t0x100\r\n\r\n/* These determine what 'dumping' does, we can dump the\r\n * content octets or the DER encoding: both use the\r\n * RFC2253 #XXXXX notation.\r\n */\r\n\r\n#define ASN1_STRFLGS_DUMP_DER\t\t0x200\r\n\r\n/* All the string flags consistent with RFC2253,\r\n * escaping control characters isn't essential in\r\n * RFC2253 but it is advisable anyway.\r\n */\r\n\r\n#define ASN1_STRFLGS_RFC2253\t(ASN1_STRFLGS_ESC_2253 | \\\r\n\t\t\t\tASN1_STRFLGS_ESC_CTRL | \\\r\n\t\t\t\tASN1_STRFLGS_ESC_MSB | \\\r\n\t\t\t\tASN1_STRFLGS_UTF8_CONVERT | \\\r\n\t\t\t\tASN1_STRFLGS_DUMP_UNKNOWN | \\\r\n\t\t\t\tASN1_STRFLGS_DUMP_DER)\r\n\r\nDECLARE_STACK_OF(ASN1_INTEGER)\r\nDECLARE_ASN1_SET_OF(ASN1_INTEGER)\r\n\r\nDECLARE_STACK_OF(ASN1_GENERALSTRING)\r\n\r\ntypedef struct asn1_type_st\r\n\t{\r\n\tint type;\r\n\tunion\t{\r\n\t\tchar *ptr;\r\n\t\tASN1_BOOLEAN\t\tboolean;\r\n\t\tASN1_STRING *\t\tasn1_string;\r\n\t\tASN1_OBJECT *\t\tobject;\r\n\t\tASN1_INTEGER *\t\tinteger;\r\n\t\tASN1_ENUMERATED *\tenumerated;\r\n\t\tASN1_BIT_STRING *\tbit_string;\r\n\t\tASN1_OCTET_STRING *\toctet_string;\r\n\t\tASN1_PRINTABLESTRING *\tprintablestring;\r\n\t\tASN1_T61STRING *\tt61string;\r\n\t\tASN1_IA5STRING *\tia5string;\r\n\t\tASN1_GENERALSTRING *\tgeneralstring;\r\n\t\tASN1_BMPSTRING *\tbmpstring;\r\n\t\tASN1_UNIVERSALSTRING *\tuniversalstring;\r\n\t\tASN1_UTCTIME *\t\tutctime;\r\n\t\tASN1_GENERALIZEDTIME *\tgeneralizedtime;\r\n\t\tASN1_VISIBLESTRING *\tvisiblestring;\r\n\t\tASN1_UTF8STRING *\tutf8string;\r\n\t\t/* set and sequence are left complete and still\r\n\t\t * contain the set or sequence bytes */\r\n\t\tASN1_STRING *\t\tset;\r\n\t\tASN1_STRING *\t\tsequence;\r\n\t\tASN1_VALUE *\t\tasn1_value;\r\n\t\t} value;\r\n\t} ASN1_TYPE;\r\n\r\nDECLARE_STACK_OF(ASN1_TYPE)\r\nDECLARE_ASN1_SET_OF(ASN1_TYPE)\r\n\r\ntypedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;\r\n\r\nDECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)\r\nDECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)\r\n\r\ntypedef struct NETSCAPE_X509_st\r\n\t{\r\n\tASN1_OCTET_STRING *header;\r\n\tX509 *cert;\r\n\t} NETSCAPE_X509;\r\n\r\n/* This is used to contain a list of bit names */\r\ntypedef struct BIT_STRING_BITNAME_st {\r\n\tint bitnum;\r\n\tconst char *lname;\r\n\tconst char *sname;\r\n} BIT_STRING_BITNAME;\r\n\r\n\r\n#define M_ASN1_STRING_length(x)\t((x)->length)\r\n#define M_ASN1_STRING_length_set(x, n)\t((x)->length = (n))\r\n#define M_ASN1_STRING_type(x)\t((x)->type)\r\n#define M_ASN1_STRING_data(x)\t((x)->data)\r\n\r\n/* Macros for string operations */\r\n#define M_ASN1_BIT_STRING_new()\t(ASN1_BIT_STRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_BIT_STRING)\r\n#define M_ASN1_BIT_STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\\\r\n\t\tASN1_STRING_dup((const ASN1_STRING *)a)\r\n#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\\\r\n\t\t(const ASN1_STRING *)a,(const ASN1_STRING *)b)\r\n#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)\r\n\r\n#define M_ASN1_INTEGER_new()\t(ASN1_INTEGER *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_INTEGER)\r\n#define M_ASN1_INTEGER_free(a)\t\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\\\r\n\t\tASN1_STRING_dup((const ASN1_STRING *)a)\r\n#define M_ASN1_INTEGER_cmp(a,b)\tASN1_STRING_cmp(\\\r\n\t\t(const ASN1_STRING *)a,(const ASN1_STRING *)b)\r\n\r\n#define M_ASN1_ENUMERATED_new()\t(ASN1_ENUMERATED *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_ENUMERATED)\r\n#define M_ASN1_ENUMERATED_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\\\r\n\t\tASN1_STRING_dup((const ASN1_STRING *)a)\r\n#define M_ASN1_ENUMERATED_cmp(a,b)\tASN1_STRING_cmp(\\\r\n\t\t(const ASN1_STRING *)a,(const ASN1_STRING *)b)\r\n\r\n#define M_ASN1_OCTET_STRING_new()\t(ASN1_OCTET_STRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_OCTET_STRING)\r\n#define M_ASN1_OCTET_STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\\\r\n\t\tASN1_STRING_dup((const ASN1_STRING *)a)\r\n#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\\\r\n\t\t(const ASN1_STRING *)a,(const ASN1_STRING *)b)\r\n#define M_ASN1_OCTET_STRING_set(a,b,c)\tASN1_STRING_set((ASN1_STRING *)a,b,c)\r\n#define M_ASN1_OCTET_STRING_print(a,b)\tASN1_STRING_print(a,(ASN1_STRING *)b)\r\n#define M_i2d_ASN1_OCTET_STRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\\\r\n\t\tV_ASN1_UNIVERSAL)\r\n\r\n#define B_ASN1_TIME \\\r\n\t\t\tB_ASN1_UTCTIME | \\\r\n\t\t\tB_ASN1_GENERALIZEDTIME\r\n\r\n#define B_ASN1_PRINTABLE \\\r\n\t\t\tB_ASN1_NUMERICSTRING| \\\r\n\t\t\tB_ASN1_PRINTABLESTRING| \\\r\n\t\t\tB_ASN1_T61STRING| \\\r\n\t\t\tB_ASN1_IA5STRING| \\\r\n\t\t\tB_ASN1_BIT_STRING| \\\r\n\t\t\tB_ASN1_UNIVERSALSTRING|\\\r\n\t\t\tB_ASN1_BMPSTRING|\\\r\n\t\t\tB_ASN1_UTF8STRING|\\\r\n\t\t\tB_ASN1_SEQUENCE|\\\r\n\t\t\tB_ASN1_UNKNOWN\r\n\r\n#define B_ASN1_DIRECTORYSTRING \\\r\n\t\t\tB_ASN1_PRINTABLESTRING| \\\r\n\t\t\tB_ASN1_TELETEXSTRING|\\\r\n\t\t\tB_ASN1_BMPSTRING|\\\r\n\t\t\tB_ASN1_UNIVERSALSTRING|\\\r\n\t\t\tB_ASN1_UTF8STRING\r\n\r\n#define B_ASN1_DISPLAYTEXT \\\r\n\t\t\tB_ASN1_IA5STRING| \\\r\n\t\t\tB_ASN1_VISIBLESTRING| \\\r\n\t\t\tB_ASN1_BMPSTRING|\\\r\n\t\t\tB_ASN1_UTF8STRING\r\n\r\n#define M_ASN1_PRINTABLE_new()\tASN1_STRING_type_new(V_ASN1_T61STRING)\r\n#define M_ASN1_PRINTABLE_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\\\r\n\t\tpp,a->type,V_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_PRINTABLE(a,pp,l) \\\r\n\t\td2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \\\r\n\t\t\tB_ASN1_PRINTABLE)\r\n\r\n#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)\r\n#define M_DIRECTORYSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\\\r\n\t\t\t\t\t\tpp,a->type,V_ASN1_UNIVERSAL)\r\n#define M_d2i_DIRECTORYSTRING(a,pp,l) \\\r\n\t\td2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \\\r\n\t\t\tB_ASN1_DIRECTORYSTRING)\r\n\r\n#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)\r\n#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\\\r\n\t\t\t\t\t\tpp,a->type,V_ASN1_UNIVERSAL)\r\n#define M_d2i_DISPLAYTEXT(a,pp,l) \\\r\n\t\td2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \\\r\n\t\t\tB_ASN1_DISPLAYTEXT)\r\n\r\n#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)\r\n#define M_ASN1_PRINTABLESTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\\\r\n\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \\\r\n\t\t(ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)\r\n\r\n#define M_ASN1_T61STRING_new()\t(ASN1_T61STRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_T61STRING)\r\n#define M_ASN1_T61STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_T61STRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\\\r\n\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_T61STRING(a,pp,l) \\\r\n\t\t(ASN1_T61STRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)\r\n\r\n#define M_ASN1_IA5STRING_new()\t(ASN1_IA5STRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_IA5STRING)\r\n#define M_ASN1_IA5STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_IA5STRING_dup(a)\t\\\r\n\t\t(ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)\r\n#define M_i2d_ASN1_IA5STRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\\\r\n\t\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_IA5STRING(a,pp,l) \\\r\n\t\t(ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\\\r\n\t\t\tB_ASN1_IA5STRING)\r\n\r\n#define M_ASN1_UTCTIME_new()\t(ASN1_UTCTIME *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_UTCTIME)\r\n#define M_ASN1_UTCTIME_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\\\r\n\t\tASN1_STRING_dup((const ASN1_STRING *)a)\r\n\r\n#define M_ASN1_GENERALIZEDTIME_new()\t(ASN1_GENERALIZEDTIME *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)\r\n#define M_ASN1_GENERALIZEDTIME_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\\\r\n\t(const ASN1_STRING *)a)\r\n\r\n#define M_ASN1_TIME_new()\t(ASN1_TIME *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_UTCTIME)\r\n#define M_ASN1_TIME_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_ASN1_TIME_dup(a) (ASN1_TIME *)\\\r\n\tASN1_STRING_dup((const ASN1_STRING *)a)\r\n\r\n#define M_ASN1_GENERALSTRING_new()\t(ASN1_GENERALSTRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_GENERALSTRING)\r\n#define M_ASN1_GENERALSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_GENERALSTRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\\\r\n\t\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_GENERALSTRING(a,pp,l) \\\r\n\t\t(ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)\r\n\r\n#define M_ASN1_UNIVERSALSTRING_new()\t(ASN1_UNIVERSALSTRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)\r\n#define M_ASN1_UNIVERSALSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\\\r\n\t\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \\\r\n\t\t(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)\r\n\r\n#define M_ASN1_BMPSTRING_new()\t(ASN1_BMPSTRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_BMPSTRING)\r\n#define M_ASN1_BMPSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_BMPSTRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\\\r\n\t\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_BMPSTRING(a,pp,l) \\\r\n\t\t(ASN1_BMPSTRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)\r\n\r\n#define M_ASN1_VISIBLESTRING_new()\t(ASN1_VISIBLESTRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_VISIBLESTRING)\r\n#define M_ASN1_VISIBLESTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_VISIBLESTRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\\\r\n\t\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \\\r\n\t\t(ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)\r\n\r\n#define M_ASN1_UTF8STRING_new()\t(ASN1_UTF8STRING *)\\\r\n\t\tASN1_STRING_type_new(V_ASN1_UTF8STRING)\r\n#define M_ASN1_UTF8STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\r\n#define M_i2d_ASN1_UTF8STRING(a,pp) \\\r\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\\\r\n\t\t\tV_ASN1_UNIVERSAL)\r\n#define M_d2i_ASN1_UTF8STRING(a,pp,l) \\\r\n\t\t(ASN1_UTF8STRING *)d2i_ASN1_type_bytes\\\r\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)\r\n\r\n  /* for the is_set parameter to i2d_ASN1_SET */\r\n#define IS_SEQUENCE\t0\r\n#define IS_SET\t\t1\r\n\r\nDECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)\r\n\r\nint ASN1_TYPE_get(ASN1_TYPE *a);\r\nvoid ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);\r\nint ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);\r\nint            ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);\r\n\r\nASN1_OBJECT *\tASN1_OBJECT_new(void );\r\nvoid\t\tASN1_OBJECT_free(ASN1_OBJECT *a);\r\nint\t\ti2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);\r\nASN1_OBJECT *\tc2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\nASN1_OBJECT *\td2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\n\r\nDECLARE_ASN1_ITEM(ASN1_OBJECT)\r\n\r\nDECLARE_STACK_OF(ASN1_OBJECT)\r\nDECLARE_ASN1_SET_OF(ASN1_OBJECT)\r\n\r\nASN1_STRING *\tASN1_STRING_new(void);\r\nvoid\t\tASN1_STRING_free(ASN1_STRING *a);\r\nint\t\tASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);\r\nASN1_STRING *\tASN1_STRING_dup(const ASN1_STRING *a);\r\nASN1_STRING *\tASN1_STRING_type_new(int type );\r\nint \t\tASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);\r\n  /* Since this is used to store all sorts of things, via macros, for now, make\r\n     its data void * */\r\nint \t\tASN1_STRING_set(ASN1_STRING *str, const void *data, int len);\r\nvoid\t\tASN1_STRING_set0(ASN1_STRING *str, void *data, int len);\r\nint ASN1_STRING_length(const ASN1_STRING *x);\r\nvoid ASN1_STRING_length_set(ASN1_STRING *x, int n);\r\nint ASN1_STRING_type(ASN1_STRING *x);\r\nunsigned char * ASN1_STRING_data(ASN1_STRING *x);\r\n\r\nDECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)\r\nint\t\ti2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);\r\nASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\nint\t\tASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,\r\n\t\t\tint length );\r\nint\t\tASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);\r\nint\t\tASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);\r\nint            ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,\r\n                                     unsigned char *flags, int flags_len);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,\r\n\t\t\t\tBIT_STRING_BITNAME *tbl, int indent);\r\n#endif\r\nint ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);\r\nint ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,\r\n\t\t\t\tBIT_STRING_BITNAME *tbl);\r\n\r\nint\t\ti2d_ASN1_BOOLEAN(int a,unsigned char **pp);\r\nint \t\td2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);\r\n\r\nDECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)\r\nint\t\ti2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);\r\nASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\nASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\nASN1_INTEGER *\tASN1_INTEGER_dup(const ASN1_INTEGER *x);\r\nint ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);\r\n\r\nDECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)\r\n\r\nint ASN1_UTCTIME_check(ASN1_UTCTIME *a);\r\nASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);\r\nASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,\r\n\t\t\t\tint offset_day, long offset_sec);\r\nint ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);\r\nint ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);\r\n#if 0\r\ntime_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);\r\n#endif\r\n\r\nint ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);\r\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);\r\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,\r\n\t     time_t t, int offset_day, long offset_sec);\r\nint ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);\r\n\r\nDECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)\r\nASN1_OCTET_STRING *\tASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);\r\nint \tASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b);\r\nint \tASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);\r\n\r\nDECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_NULL)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)\r\n\r\nint UTF8_getc(const unsigned char *str, int len, unsigned long *val);\r\nint UTF8_putc(unsigned char *str, int len, unsigned long value);\r\n\r\nDECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)\r\n\r\nDECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)\r\nDECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)\r\nDECLARE_ASN1_FUNCTIONS(ASN1_TIME)\r\n\r\nDECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)\r\n\r\nASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);\r\nASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,\r\n\t\t\t\tint offset_day, long offset_sec);\r\nint ASN1_TIME_check(ASN1_TIME *t);\r\nASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);\r\nint ASN1_TIME_set_string(ASN1_TIME *s, const char *str);\r\n\r\nint i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,\r\n\t\t i2d_of_void *i2d, int ex_tag, int ex_class,\r\n\t\t int is_set);\r\nSTACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,\r\n\t\t\t      const unsigned char **pp,\r\n\t\t\t      long length, d2i_of_void *d2i,\r\n\t\t\t      void (*free_func)(OPENSSL_BLOCK), int ex_tag,\r\n\t\t\t      int ex_class);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);\r\nint a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);\r\nint i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);\r\nint a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size);\r\nint i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);\r\nint a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);\r\nint i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);\r\n#endif\r\nint i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);\r\n\r\nint a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);\r\nASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,\r\n\tconst char *sn, const char *ln);\r\n\r\nint ASN1_INTEGER_set(ASN1_INTEGER *a, long v);\r\nlong ASN1_INTEGER_get(const ASN1_INTEGER *a);\r\nASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);\r\nBIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn);\r\n\r\nint ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);\r\nlong ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);\r\nASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);\r\nBIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);\r\n\r\n/* General */\r\n/* given a string, return the correct type, max is the maximum length */\r\nint ASN1_PRINTABLE_type(const unsigned char *s, int max);\r\n\r\nint i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);\r\nASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,\r\n\tlong length, int Ptag, int Pclass);\r\nunsigned long ASN1_tag2bit(int tag);\r\n/* type is one or more of the B_ASN1_ values. */\r\nASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,\r\n\t\tlong length,int type);\r\n\r\n/* PARSING */\r\nint asn1_Finish(ASN1_CTX *c);\r\nint asn1_const_Finish(ASN1_const_CTX *c);\r\n\r\n/* SPECIALS */\r\nint ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,\r\n\tint *pclass, long omax);\r\nint ASN1_check_infinite_end(unsigned char **p,long len);\r\nint ASN1_const_check_infinite_end(const unsigned char **p,long len);\r\nvoid ASN1_put_object(unsigned char **pp, int constructed, int length,\r\n\tint tag, int xclass);\r\nint ASN1_put_eoc(unsigned char **pp);\r\nint ASN1_object_size(int constructed, int length, int tag);\r\n\r\n/* Used to implement other functions */\r\nvoid *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);\r\n\r\n#define ASN1_dup_of(type,i2d,d2i,x) \\\r\n    ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \\\r\n\t\t     CHECKED_D2I_OF(type, d2i), \\\r\n\t\t     CHECKED_PTR_OF(type, x)))\r\n\r\n#define ASN1_dup_of_const(type,i2d,d2i,x) \\\r\n    ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \\\r\n\t\t     CHECKED_D2I_OF(type, d2i), \\\r\n\t\t     CHECKED_PTR_OF(const type, x)))\r\n\r\nvoid *ASN1_item_dup(const ASN1_ITEM *it, void *x);\r\n\r\n/* ASN1 alloc/free macros for when a type is only used internally */\r\n\r\n#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))\r\n#define M_ASN1_free_of(x, type) \\\r\n\t\tASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\nvoid *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);\r\n\r\n#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \\\r\n    ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \\\r\n\t\t\tCHECKED_D2I_OF(type, d2i), \\\r\n\t\t\tin, \\\r\n\t\t\tCHECKED_PPTR_OF(type, x)))\r\n\r\nvoid *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);\r\nint ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);\r\n\r\n#define ASN1_i2d_fp_of(type,i2d,out,x) \\\r\n    (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \\\r\n\t\t out, \\\r\n\t\t CHECKED_PTR_OF(type, x)))\r\n\r\n#define ASN1_i2d_fp_of_const(type,i2d,out,x) \\\r\n    (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \\\r\n\t\t out, \\\r\n\t\t CHECKED_PTR_OF(const type, x)))\r\n\r\nint ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);\r\nint ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);\r\n#endif\r\n\r\nint ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nvoid *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);\r\n\r\n#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \\\r\n    ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \\\r\n\t\t\t  CHECKED_D2I_OF(type, d2i), \\\r\n\t\t\t  in, \\\r\n\t\t\t  CHECKED_PPTR_OF(type, x)))\r\n\r\nvoid *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);\r\nint ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);\r\n\r\n#define ASN1_i2d_bio_of(type,i2d,out,x) \\\r\n    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \\\r\n\t\t  out, \\\r\n\t\t  CHECKED_PTR_OF(type, x)))\r\n\r\n#define ASN1_i2d_bio_of_const(type,i2d,out,x) \\\r\n    (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \\\r\n\t\t  out, \\\r\n\t\t  CHECKED_PTR_OF(const type, x)))\r\n\r\nint ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);\r\nint ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);\r\nint ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);\r\nint ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);\r\nint ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);\r\nint ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);\r\nint ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,\r\n\t\t\t\tunsigned char *buf, int off);\r\nint ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);\r\nint ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);\r\n#endif\r\nconst char *ASN1_tag2str(int tag);\r\n\r\n/* Used to load and write netscape format cert */\r\n\r\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)\r\n\r\nint ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);\r\n\r\nint ASN1_TYPE_set_octetstring(ASN1_TYPE *a,\r\n\tunsigned char *data, int len);\r\nint ASN1_TYPE_get_octetstring(ASN1_TYPE *a,\r\n\tunsigned char *data, int max_len);\r\nint ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,\r\n\tunsigned char *data, int len);\r\nint ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,\r\n\tunsigned char *data, int max_len);\r\n\r\nSTACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,\r\n\t\t\t\t d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));\r\nunsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,\r\n\t\t\t     unsigned char **buf, int *len );\r\nvoid *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);\r\nvoid *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);\r\nASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,\r\n\t\t\t      ASN1_OCTET_STRING **oct);\r\n\r\n#define ASN1_pack_string_of(type,obj,i2d,oct) \\\r\n    (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \\\r\n\t\t      CHECKED_I2D_OF(type, i2d), \\\r\n\t\t      oct))\r\n\r\nASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);\r\n\r\nvoid ASN1_STRING_set_default_mask(unsigned long mask);\r\nint ASN1_STRING_set_default_mask_asc(const char *p);\r\nunsigned long ASN1_STRING_get_default_mask(void);\r\nint ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,\r\n\t\t\t\t\tint inform, unsigned long mask);\r\nint ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,\r\n\t\t\t\t\tint inform, unsigned long mask, \r\n\t\t\t\t\tlong minsize, long maxsize);\r\n\r\nASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, \r\n\t\tconst unsigned char *in, int inlen, int inform, int nid);\r\nASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);\r\nint ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);\r\nvoid ASN1_STRING_TABLE_cleanup(void);\r\n\r\n/* ASN1 template functions */\r\n\r\n/* Old API compatible functions */\r\nASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);\r\nvoid ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);\r\nASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);\r\nint ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);\r\nint ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);\r\n\r\nvoid ASN1_add_oid_module(void);\r\n\r\nASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);\r\nASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);\r\n\r\n/* ASN1 Print flags */\r\n\r\n/* Indicate missing OPTIONAL fields */\r\n#define ASN1_PCTX_FLAGS_SHOW_ABSENT\t\t0x001\t\r\n/* Mark start and end of SEQUENCE */\r\n#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE\t\t0x002\r\n/* Mark start and end of SEQUENCE/SET OF */\r\n#define ASN1_PCTX_FLAGS_SHOW_SSOF\t\t0x004\r\n/* Show the ASN1 type of primitives */\r\n#define ASN1_PCTX_FLAGS_SHOW_TYPE\t\t0x008\r\n/* Don't show ASN1 type of ANY */\r\n#define ASN1_PCTX_FLAGS_NO_ANY_TYPE\t\t0x010\r\n/* Don't show ASN1 type of MSTRINGs */\r\n#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE\t\t0x020\r\n/* Don't show field names in SEQUENCE */\r\n#define ASN1_PCTX_FLAGS_NO_FIELD_NAME\t\t0x040\r\n/* Show structure names of each SEQUENCE field */\r\n#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME\t0x080\r\n/* Don't show structure name even at top level */\r\n#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME\t\t0x100\r\n\r\nint ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,\r\n\t\t\t\tconst ASN1_ITEM *it, const ASN1_PCTX *pctx);\r\nASN1_PCTX *ASN1_PCTX_new(void);\r\nvoid ASN1_PCTX_free(ASN1_PCTX *p);\r\nunsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);\r\nvoid ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);\r\nunsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);\r\nvoid ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);\r\nunsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);\r\nvoid ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);\r\nunsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);\r\nvoid ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);\r\nunsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);\r\nvoid ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);\r\n\r\nBIO_METHOD *BIO_f_asn1(void);\r\n\r\nBIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);\r\n\r\nint i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,\r\n\t\t\t\tconst ASN1_ITEM *it);\r\nint PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,\r\n\t\t\t\tconst char *hdr,\r\n\t\t\t\tconst ASN1_ITEM *it);\r\nint SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,\r\n\t\t\t\tint ctype_nid, int econt_nid,\r\n\t\t\t\tSTACK_OF(X509_ALGOR) *mdalgs,\r\n\t\t\t\tconst ASN1_ITEM *it);\r\nASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);\r\nint SMIME_crlf_copy(BIO *in, BIO *out, int flags);\r\nint SMIME_text(BIO *in, BIO *out);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_ASN1_strings(void);\r\n\r\n/* Error codes for the ASN1 functions. */\r\n\r\n/* Function codes. */\r\n#define ASN1_F_A2D_ASN1_OBJECT\t\t\t\t 100\r\n#define ASN1_F_A2I_ASN1_ENUMERATED\t\t\t 101\r\n#define ASN1_F_A2I_ASN1_INTEGER\t\t\t\t 102\r\n#define ASN1_F_A2I_ASN1_STRING\t\t\t\t 103\r\n#define ASN1_F_APPEND_EXP\t\t\t\t 176\r\n#define ASN1_F_ASN1_BIT_STRING_SET_BIT\t\t\t 183\r\n#define ASN1_F_ASN1_CB\t\t\t\t\t 177\r\n#define ASN1_F_ASN1_CHECK_TLEN\t\t\t\t 104\r\n#define ASN1_F_ASN1_COLLATE_PRIMITIVE\t\t\t 105\r\n#define ASN1_F_ASN1_COLLECT\t\t\t\t 106\r\n#define ASN1_F_ASN1_D2I_EX_PRIMITIVE\t\t\t 108\r\n#define ASN1_F_ASN1_D2I_FP\t\t\t\t 109\r\n#define ASN1_F_ASN1_D2I_READ_BIO\t\t\t 107\r\n#define ASN1_F_ASN1_DIGEST\t\t\t\t 184\r\n#define ASN1_F_ASN1_DO_ADB\t\t\t\t 110\r\n#define ASN1_F_ASN1_DUP\t\t\t\t\t 111\r\n#define ASN1_F_ASN1_ENUMERATED_SET\t\t\t 112\r\n#define ASN1_F_ASN1_ENUMERATED_TO_BN\t\t\t 113\r\n#define ASN1_F_ASN1_EX_C2I\t\t\t\t 204\r\n#define ASN1_F_ASN1_FIND_END\t\t\t\t 190\r\n#define ASN1_F_ASN1_GENERALIZEDTIME_ADJ\t\t\t 216\r\n#define ASN1_F_ASN1_GENERALIZEDTIME_SET\t\t\t 185\r\n#define ASN1_F_ASN1_GENERATE_V3\t\t\t\t 178\r\n#define ASN1_F_ASN1_GET_OBJECT\t\t\t\t 114\r\n#define ASN1_F_ASN1_HEADER_NEW\t\t\t\t 115\r\n#define ASN1_F_ASN1_I2D_BIO\t\t\t\t 116\r\n#define ASN1_F_ASN1_I2D_FP\t\t\t\t 117\r\n#define ASN1_F_ASN1_INTEGER_SET\t\t\t\t 118\r\n#define ASN1_F_ASN1_INTEGER_TO_BN\t\t\t 119\r\n#define ASN1_F_ASN1_ITEM_D2I_FP\t\t\t\t 206\r\n#define ASN1_F_ASN1_ITEM_DUP\t\t\t\t 191\r\n#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW\t\t\t 121\r\n#define ASN1_F_ASN1_ITEM_EX_D2I\t\t\t\t 120\r\n#define ASN1_F_ASN1_ITEM_I2D_BIO\t\t\t 192\r\n#define ASN1_F_ASN1_ITEM_I2D_FP\t\t\t\t 193\r\n#define ASN1_F_ASN1_ITEM_PACK\t\t\t\t 198\r\n#define ASN1_F_ASN1_ITEM_SIGN\t\t\t\t 195\r\n#define ASN1_F_ASN1_ITEM_SIGN_CTX\t\t\t 220\r\n#define ASN1_F_ASN1_ITEM_UNPACK\t\t\t\t 199\r\n#define ASN1_F_ASN1_ITEM_VERIFY\t\t\t\t 197\r\n#define ASN1_F_ASN1_MBSTRING_NCOPY\t\t\t 122\r\n#define ASN1_F_ASN1_OBJECT_NEW\t\t\t\t 123\r\n#define ASN1_F_ASN1_OUTPUT_DATA\t\t\t\t 214\r\n#define ASN1_F_ASN1_PACK_STRING\t\t\t\t 124\r\n#define ASN1_F_ASN1_PCTX_NEW\t\t\t\t 205\r\n#define ASN1_F_ASN1_PKCS5_PBE_SET\t\t\t 125\r\n#define ASN1_F_ASN1_SEQ_PACK\t\t\t\t 126\r\n#define ASN1_F_ASN1_SEQ_UNPACK\t\t\t\t 127\r\n#define ASN1_F_ASN1_SIGN\t\t\t\t 128\r\n#define ASN1_F_ASN1_STR2TYPE\t\t\t\t 179\r\n#define ASN1_F_ASN1_STRING_SET\t\t\t\t 186\r\n#define ASN1_F_ASN1_STRING_TABLE_ADD\t\t\t 129\r\n#define ASN1_F_ASN1_STRING_TYPE_NEW\t\t\t 130\r\n#define ASN1_F_ASN1_TEMPLATE_EX_D2I\t\t\t 132\r\n#define ASN1_F_ASN1_TEMPLATE_NEW\t\t\t 133\r\n#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I\t\t\t 131\r\n#define ASN1_F_ASN1_TIME_ADJ\t\t\t\t 217\r\n#define ASN1_F_ASN1_TIME_SET\t\t\t\t 175\r\n#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING\t\t 134\r\n#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING\t\t 135\r\n#define ASN1_F_ASN1_UNPACK_STRING\t\t\t 136\r\n#define ASN1_F_ASN1_UTCTIME_ADJ\t\t\t\t 218\r\n#define ASN1_F_ASN1_UTCTIME_SET\t\t\t\t 187\r\n#define ASN1_F_ASN1_VERIFY\t\t\t\t 137\r\n#define ASN1_F_B64_READ_ASN1\t\t\t\t 209\r\n#define ASN1_F_B64_WRITE_ASN1\t\t\t\t 210\r\n#define ASN1_F_BIO_NEW_NDEF\t\t\t\t 208\r\n#define ASN1_F_BITSTR_CB\t\t\t\t 180\r\n#define ASN1_F_BN_TO_ASN1_ENUMERATED\t\t\t 138\r\n#define ASN1_F_BN_TO_ASN1_INTEGER\t\t\t 139\r\n#define ASN1_F_C2I_ASN1_BIT_STRING\t\t\t 189\r\n#define ASN1_F_C2I_ASN1_INTEGER\t\t\t\t 194\r\n#define ASN1_F_C2I_ASN1_OBJECT\t\t\t\t 196\r\n#define ASN1_F_COLLECT_DATA\t\t\t\t 140\r\n#define ASN1_F_D2I_ASN1_BIT_STRING\t\t\t 141\r\n#define ASN1_F_D2I_ASN1_BOOLEAN\t\t\t\t 142\r\n#define ASN1_F_D2I_ASN1_BYTES\t\t\t\t 143\r\n#define ASN1_F_D2I_ASN1_GENERALIZEDTIME\t\t\t 144\r\n#define ASN1_F_D2I_ASN1_HEADER\t\t\t\t 145\r\n#define ASN1_F_D2I_ASN1_INTEGER\t\t\t\t 146\r\n#define ASN1_F_D2I_ASN1_OBJECT\t\t\t\t 147\r\n#define ASN1_F_D2I_ASN1_SET\t\t\t\t 148\r\n#define ASN1_F_D2I_ASN1_TYPE_BYTES\t\t\t 149\r\n#define ASN1_F_D2I_ASN1_UINTEGER\t\t\t 150\r\n#define ASN1_F_D2I_ASN1_UTCTIME\t\t\t\t 151\r\n#define ASN1_F_D2I_AUTOPRIVATEKEY\t\t\t 207\r\n#define ASN1_F_D2I_NETSCAPE_RSA\t\t\t\t 152\r\n#define ASN1_F_D2I_NETSCAPE_RSA_2\t\t\t 153\r\n#define ASN1_F_D2I_PRIVATEKEY\t\t\t\t 154\r\n#define ASN1_F_D2I_PUBLICKEY\t\t\t\t 155\r\n#define ASN1_F_D2I_RSA_NET\t\t\t\t 200\r\n#define ASN1_F_D2I_RSA_NET_2\t\t\t\t 201\r\n#define ASN1_F_D2I_X509\t\t\t\t\t 156\r\n#define ASN1_F_D2I_X509_CINF\t\t\t\t 157\r\n#define ASN1_F_D2I_X509_PKEY\t\t\t\t 159\r\n#define ASN1_F_I2D_ASN1_BIO_STREAM\t\t\t 211\r\n#define ASN1_F_I2D_ASN1_SET\t\t\t\t 188\r\n#define ASN1_F_I2D_ASN1_TIME\t\t\t\t 160\r\n#define ASN1_F_I2D_DSA_PUBKEY\t\t\t\t 161\r\n#define ASN1_F_I2D_EC_PUBKEY\t\t\t\t 181\r\n#define ASN1_F_I2D_PRIVATEKEY\t\t\t\t 163\r\n#define ASN1_F_I2D_PUBLICKEY\t\t\t\t 164\r\n#define ASN1_F_I2D_RSA_NET\t\t\t\t 162\r\n#define ASN1_F_I2D_RSA_PUBKEY\t\t\t\t 165\r\n#define ASN1_F_LONG_C2I\t\t\t\t\t 166\r\n#define ASN1_F_OID_MODULE_INIT\t\t\t\t 174\r\n#define ASN1_F_PARSE_TAGGING\t\t\t\t 182\r\n#define ASN1_F_PKCS5_PBE2_SET_IV\t\t\t 167\r\n#define ASN1_F_PKCS5_PBE_SET\t\t\t\t 202\r\n#define ASN1_F_PKCS5_PBE_SET0_ALGOR\t\t\t 215\r\n#define ASN1_F_PKCS5_PBKDF2_SET\t\t\t\t 219\r\n#define ASN1_F_SMIME_READ_ASN1\t\t\t\t 212\r\n#define ASN1_F_SMIME_TEXT\t\t\t\t 213\r\n#define ASN1_F_X509_CINF_NEW\t\t\t\t 168\r\n#define ASN1_F_X509_CRL_ADD0_REVOKED\t\t\t 169\r\n#define ASN1_F_X509_INFO_NEW\t\t\t\t 170\r\n#define ASN1_F_X509_NAME_ENCODE\t\t\t\t 203\r\n#define ASN1_F_X509_NAME_EX_D2I\t\t\t\t 158\r\n#define ASN1_F_X509_NAME_EX_NEW\t\t\t\t 171\r\n#define ASN1_F_X509_NEW\t\t\t\t\t 172\r\n#define ASN1_F_X509_PKEY_NEW\t\t\t\t 173\r\n\r\n/* Reason codes. */\r\n#define ASN1_R_ADDING_OBJECT\t\t\t\t 171\r\n#define ASN1_R_ASN1_PARSE_ERROR\t\t\t\t 203\r\n#define ASN1_R_ASN1_SIG_PARSE_ERROR\t\t\t 204\r\n#define ASN1_R_AUX_ERROR\t\t\t\t 100\r\n#define ASN1_R_BAD_CLASS\t\t\t\t 101\r\n#define ASN1_R_BAD_OBJECT_HEADER\t\t\t 102\r\n#define ASN1_R_BAD_PASSWORD_READ\t\t\t 103\r\n#define ASN1_R_BAD_TAG\t\t\t\t\t 104\r\n#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH\t\t 214\r\n#define ASN1_R_BN_LIB\t\t\t\t\t 105\r\n#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH\t\t\t 106\r\n#define ASN1_R_BUFFER_TOO_SMALL\t\t\t\t 107\r\n#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER\t\t 108\r\n#define ASN1_R_CONTEXT_NOT_INITIALISED\t\t\t 217\r\n#define ASN1_R_DATA_IS_WRONG\t\t\t\t 109\r\n#define ASN1_R_DECODE_ERROR\t\t\t\t 110\r\n#define ASN1_R_DECODING_ERROR\t\t\t\t 111\r\n#define ASN1_R_DEPTH_EXCEEDED\t\t\t\t 174\r\n#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED\t 198\r\n#define ASN1_R_ENCODE_ERROR\t\t\t\t 112\r\n#define ASN1_R_ERROR_GETTING_TIME\t\t\t 173\r\n#define ASN1_R_ERROR_LOADING_SECTION\t\t\t 172\r\n#define ASN1_R_ERROR_PARSING_SET_ELEMENT\t\t 113\r\n#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS\t\t 114\r\n#define ASN1_R_EXPECTING_AN_INTEGER\t\t\t 115\r\n#define ASN1_R_EXPECTING_AN_OBJECT\t\t\t 116\r\n#define ASN1_R_EXPECTING_A_BOOLEAN\t\t\t 117\r\n#define ASN1_R_EXPECTING_A_TIME\t\t\t\t 118\r\n#define ASN1_R_EXPLICIT_LENGTH_MISMATCH\t\t\t 119\r\n#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED\t\t 120\r\n#define ASN1_R_FIELD_MISSING\t\t\t\t 121\r\n#define ASN1_R_FIRST_NUM_TOO_LARGE\t\t\t 122\r\n#define ASN1_R_HEADER_TOO_LONG\t\t\t\t 123\r\n#define ASN1_R_ILLEGAL_BITSTRING_FORMAT\t\t\t 175\r\n#define ASN1_R_ILLEGAL_BOOLEAN\t\t\t\t 176\r\n#define ASN1_R_ILLEGAL_CHARACTERS\t\t\t 124\r\n#define ASN1_R_ILLEGAL_FORMAT\t\t\t\t 177\r\n#define ASN1_R_ILLEGAL_HEX\t\t\t\t 178\r\n#define ASN1_R_ILLEGAL_IMPLICIT_TAG\t\t\t 179\r\n#define ASN1_R_ILLEGAL_INTEGER\t\t\t\t 180\r\n#define ASN1_R_ILLEGAL_NESTED_TAGGING\t\t\t 181\r\n#define ASN1_R_ILLEGAL_NULL\t\t\t\t 125\r\n#define ASN1_R_ILLEGAL_NULL_VALUE\t\t\t 182\r\n#define ASN1_R_ILLEGAL_OBJECT\t\t\t\t 183\r\n#define ASN1_R_ILLEGAL_OPTIONAL_ANY\t\t\t 126\r\n#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE\t\t 170\r\n#define ASN1_R_ILLEGAL_TAGGED_ANY\t\t\t 127\r\n#define ASN1_R_ILLEGAL_TIME_VALUE\t\t\t 184\r\n#define ASN1_R_INTEGER_NOT_ASCII_FORMAT\t\t\t 185\r\n#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG\t\t 128\r\n#define ASN1_R_INVALID_BMPSTRING_LENGTH\t\t\t 129\r\n#define ASN1_R_INVALID_DIGIT\t\t\t\t 130\r\n#define ASN1_R_INVALID_MIME_TYPE\t\t\t 205\r\n#define ASN1_R_INVALID_MODIFIER\t\t\t\t 186\r\n#define ASN1_R_INVALID_NUMBER\t\t\t\t 187\r\n#define ASN1_R_INVALID_OBJECT_ENCODING\t\t\t 216\r\n#define ASN1_R_INVALID_SEPARATOR\t\t\t 131\r\n#define ASN1_R_INVALID_TIME_FORMAT\t\t\t 132\r\n#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH\t\t 133\r\n#define ASN1_R_INVALID_UTF8STRING\t\t\t 134\r\n#define ASN1_R_IV_TOO_LARGE\t\t\t\t 135\r\n#define ASN1_R_LENGTH_ERROR\t\t\t\t 136\r\n#define ASN1_R_LIST_ERROR\t\t\t\t 188\r\n#define ASN1_R_MIME_NO_CONTENT_TYPE\t\t\t 206\r\n#define ASN1_R_MIME_PARSE_ERROR\t\t\t\t 207\r\n#define ASN1_R_MIME_SIG_PARSE_ERROR\t\t\t 208\r\n#define ASN1_R_MISSING_EOC\t\t\t\t 137\r\n#define ASN1_R_MISSING_SECOND_NUMBER\t\t\t 138\r\n#define ASN1_R_MISSING_VALUE\t\t\t\t 189\r\n#define ASN1_R_MSTRING_NOT_UNIVERSAL\t\t\t 139\r\n#define ASN1_R_MSTRING_WRONG_TAG\t\t\t 140\r\n#define ASN1_R_NESTED_ASN1_STRING\t\t\t 197\r\n#define ASN1_R_NON_HEX_CHARACTERS\t\t\t 141\r\n#define ASN1_R_NOT_ASCII_FORMAT\t\t\t\t 190\r\n#define ASN1_R_NOT_ENOUGH_DATA\t\t\t\t 142\r\n#define ASN1_R_NO_CONTENT_TYPE\t\t\t\t 209\r\n#define ASN1_R_NO_DEFAULT_DIGEST\t\t\t 201\r\n#define ASN1_R_NO_MATCHING_CHOICE_TYPE\t\t\t 143\r\n#define ASN1_R_NO_MULTIPART_BODY_FAILURE\t\t 210\r\n#define ASN1_R_NO_MULTIPART_BOUNDARY\t\t\t 211\r\n#define ASN1_R_NO_SIG_CONTENT_TYPE\t\t\t 212\r\n#define ASN1_R_NULL_IS_WRONG_LENGTH\t\t\t 144\r\n#define ASN1_R_OBJECT_NOT_ASCII_FORMAT\t\t\t 191\r\n#define ASN1_R_ODD_NUMBER_OF_CHARS\t\t\t 145\r\n#define ASN1_R_PRIVATE_KEY_HEADER_MISSING\t\t 146\r\n#define ASN1_R_SECOND_NUMBER_TOO_LARGE\t\t\t 147\r\n#define ASN1_R_SEQUENCE_LENGTH_MISMATCH\t\t\t 148\r\n#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED\t\t\t 149\r\n#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG\t\t 192\r\n#define ASN1_R_SHORT_LINE\t\t\t\t 150\r\n#define ASN1_R_SIG_INVALID_MIME_TYPE\t\t\t 213\r\n#define ASN1_R_STREAMING_NOT_SUPPORTED\t\t\t 202\r\n#define ASN1_R_STRING_TOO_LONG\t\t\t\t 151\r\n#define ASN1_R_STRING_TOO_SHORT\t\t\t\t 152\r\n#define ASN1_R_TAG_VALUE_TOO_HIGH\t\t\t 153\r\n#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154\r\n#define ASN1_R_TIME_NOT_ASCII_FORMAT\t\t\t 193\r\n#define ASN1_R_TOO_LONG\t\t\t\t\t 155\r\n#define ASN1_R_TYPE_NOT_CONSTRUCTED\t\t\t 156\r\n#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY\t\t\t 157\r\n#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY\t\t 158\r\n#define ASN1_R_UNEXPECTED_EOC\t\t\t\t 159\r\n#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH\t\t 215\r\n#define ASN1_R_UNKNOWN_FORMAT\t\t\t\t 160\r\n#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM\t\t 161\r\n#define ASN1_R_UNKNOWN_OBJECT_TYPE\t\t\t 162\r\n#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE\t\t\t 163\r\n#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM\t\t 199\r\n#define ASN1_R_UNKNOWN_TAG\t\t\t\t 194\r\n#define ASN1_R_UNKOWN_FORMAT\t\t\t\t 195\r\n#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE\t\t 164\r\n#define ASN1_R_UNSUPPORTED_CIPHER\t\t\t 165\r\n#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM\t\t 166\r\n#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE\t\t 167\r\n#define ASN1_R_UNSUPPORTED_TYPE\t\t\t\t 196\r\n#define ASN1_R_WRONG_PUBLIC_KEY_TYPE\t\t\t 200\r\n#define ASN1_R_WRONG_TAG\t\t\t\t 168\r\n#define ASN1_R_WRONG_TYPE\t\t\t\t 169\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/asn1_mac.h",
    "content": "/* crypto/asn1/asn1_mac.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_ASN1_MAC_H\r\n#define HEADER_ASN1_MAC_H\r\n\r\n#include <openssl/asn1.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifndef ASN1_MAC_ERR_LIB\r\n#define ASN1_MAC_ERR_LIB\tERR_LIB_ASN1\r\n#endif \r\n\r\n#define ASN1_MAC_H_err(f,r,line) \\\r\n\tERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))\r\n\r\n#define M_ASN1_D2I_vars(a,type,func) \\\r\n\tASN1_const_CTX c; \\\r\n\ttype ret=NULL; \\\r\n\t\\\r\n\tc.pp=(const unsigned char **)pp; \\\r\n\tc.q= *(const unsigned char **)pp; \\\r\n\tc.error=ERR_R_NESTED_ASN1_ERROR; \\\r\n\tif ((a == NULL) || ((*a) == NULL)) \\\r\n\t\t{ if ((ret=(type)func()) == NULL) \\\r\n\t\t\t{ c.line=__LINE__; goto err; } } \\\r\n\telse\tret=(*a);\r\n\r\n#define M_ASN1_D2I_Init() \\\r\n\tc.p= *(const unsigned char **)pp; \\\r\n\tc.max=(length == 0)?0:(c.p+length);\r\n\r\n#define M_ASN1_D2I_Finish_2(a) \\\r\n\tif (!asn1_const_Finish(&c)) \\\r\n\t\t{ c.line=__LINE__; goto err; } \\\r\n\t*(const unsigned char **)pp=c.p; \\\r\n\tif (a != NULL) (*a)=ret; \\\r\n\treturn(ret);\r\n\r\n#define M_ASN1_D2I_Finish(a,func,e) \\\r\n\tM_ASN1_D2I_Finish_2(a); \\\r\nerr:\\\r\n\tASN1_MAC_H_err((e),c.error,c.line); \\\r\n\tasn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \\\r\n\tif ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \\\r\n\treturn(NULL)\r\n\r\n#define M_ASN1_D2I_start_sequence() \\\r\n\tif (!asn1_GetSequence(&c,&length)) \\\r\n\t\t{ c.line=__LINE__; goto err; }\r\n/* Begin reading ASN1 without a surrounding sequence */\r\n#define M_ASN1_D2I_begin() \\\r\n\tc.slen = length;\r\n\r\n/* End reading ASN1 with no check on length */\r\n#define M_ASN1_D2I_Finish_nolen(a, func, e) \\\r\n\t*pp=c.p; \\\r\n\tif (a != NULL) (*a)=ret; \\\r\n\treturn(ret); \\\r\nerr:\\\r\n\tASN1_MAC_H_err((e),c.error,c.line); \\\r\n\tasn1_add_error(*pp,(int)(c.q- *pp)); \\\r\n\tif ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \\\r\n\treturn(NULL)\r\n\r\n#define M_ASN1_D2I_end_sequence() \\\r\n\t(((c.inf&1) == 0)?(c.slen <= 0): \\\r\n\t\t(c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))\r\n\r\n/* Don't use this with d2i_ASN1_BOOLEAN() */\r\n#define M_ASN1_D2I_get(b, func) \\\r\n\tc.q=c.p; \\\r\n\tif (func(&(b),&c.p,c.slen) == NULL) \\\r\n\t\t{c.line=__LINE__; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\r\n\r\n/* Don't use this with d2i_ASN1_BOOLEAN() */\r\n#define M_ASN1_D2I_get_x(type,b,func) \\\r\n\tc.q=c.p; \\\r\n\tif (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \\\r\n\t\t{c.line=__LINE__; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\r\n\r\n/* use this instead () */\r\n#define M_ASN1_D2I_get_int(b,func) \\\r\n\tc.q=c.p; \\\r\n\tif (func(&(b),&c.p,c.slen) < 0) \\\r\n\t\t{c.line=__LINE__; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\r\n\r\n#define M_ASN1_D2I_get_opt(b,func,type) \\\r\n\tif ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \\\r\n\t\t== (V_ASN1_UNIVERSAL|(type)))) \\\r\n\t\t{ \\\r\n\t\tM_ASN1_D2I_get(b,func); \\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_int_opt(b,func,type) \\\r\n\tif ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \\\r\n\t\t== (V_ASN1_UNIVERSAL|(type)))) \\\r\n\t\t{ \\\r\n\t\tM_ASN1_D2I_get_int(b,func); \\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_imp(b,func, type) \\\r\n\tM_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \\\r\n\tc.q=c.p; \\\r\n\tif (func(&(b),&c.p,c.slen) == NULL) \\\r\n\t\t{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\\\r\n\tM_ASN1_next_prev=_tmp;\r\n\r\n#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \\\r\n\tif ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \\\r\n\t\t(V_ASN1_CONTEXT_SPECIFIC|(tag)))) \\\r\n\t\t{ \\\r\n\t\tunsigned char _tmp = M_ASN1_next; \\\r\n\t\tM_ASN1_D2I_get_imp(b,func, type);\\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_set(r,func,free_func) \\\r\n\t\tM_ASN1_D2I_get_imp_set(r,func,free_func, \\\r\n\t\t\tV_ASN1_SET,V_ASN1_UNIVERSAL);\r\n\r\n#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \\\r\n\t\tM_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \\\r\n\t\t\tV_ASN1_SET,V_ASN1_UNIVERSAL);\r\n\r\n#define M_ASN1_D2I_get_set_opt(r,func,free_func) \\\r\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\r\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SET)))\\\r\n\t\t{ M_ASN1_D2I_get_set(r,func,free_func); }\r\n\r\n#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \\\r\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\r\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SET)))\\\r\n\t\t{ M_ASN1_D2I_get_set_type(type,r,func,free_func); }\r\n\r\n#define M_ASN1_I2D_len_SET_opt(a,f) \\\r\n\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\tM_ASN1_I2D_len_SET(a,f);\r\n\r\n#define M_ASN1_I2D_put_SET_opt(a,f) \\\r\n\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\tM_ASN1_I2D_put_SET(a,f);\r\n\r\n#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \\\r\n\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\tM_ASN1_I2D_put_SEQUENCE(a,f);\r\n\r\n#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \\\r\n\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\tM_ASN1_I2D_put_SEQUENCE_type(type,a,f);\r\n\r\n#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \\\r\n\tif ((c.slen != 0) && \\\r\n\t\t(M_ASN1_next == \\\r\n\t\t(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\\\r\n\t\t{ \\\r\n\t\tM_ASN1_D2I_get_imp_set(b,func,free_func,\\\r\n\t\t\ttag,V_ASN1_CONTEXT_SPECIFIC); \\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \\\r\n\tif ((c.slen != 0) && \\\r\n\t\t(M_ASN1_next == \\\r\n\t\t(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\\\r\n\t\t{ \\\r\n\t\tM_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\\\r\n\t\t\ttag,V_ASN1_CONTEXT_SPECIFIC); \\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_seq(r,func,free_func) \\\r\n\t\tM_ASN1_D2I_get_imp_set(r,func,free_func,\\\r\n\t\t\tV_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);\r\n\r\n#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \\\r\n\t\tM_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\\\r\n\t\t\t\t\t    V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)\r\n\r\n#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \\\r\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\r\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\\\r\n\t\t{ M_ASN1_D2I_get_seq(r,func,free_func); }\r\n\r\n#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \\\r\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\r\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\\\r\n\t\t{ M_ASN1_D2I_get_seq_type(type,r,func,free_func); }\r\n\r\n#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \\\r\n\t\tM_ASN1_D2I_get_imp_set(r,func,free_func,\\\r\n\t\t\tx,V_ASN1_CONTEXT_SPECIFIC);\r\n\r\n#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \\\r\n\t\tM_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\\\r\n\t\t\tx,V_ASN1_CONTEXT_SPECIFIC);\r\n\r\n#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \\\r\n\tc.q=c.p; \\\r\n\tif (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\\\r\n\t\t(void (*)())free_func,a,b) == NULL) \\\r\n\t\t{ c.line=__LINE__; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\r\n\r\n#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \\\r\n\tc.q=c.p; \\\r\n\tif (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\\\r\n\t\t\t\t   free_func,a,b) == NULL) \\\r\n\t\t{ c.line=__LINE__; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\r\n\r\n#define M_ASN1_D2I_get_set_strings(r,func,a,b) \\\r\n\tc.q=c.p; \\\r\n\tif (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \\\r\n\t\t{ c.line=__LINE__; goto err; } \\\r\n\tc.slen-=(c.p-c.q);\r\n\r\n#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \\\r\n\tif ((c.slen != 0L) && (M_ASN1_next == \\\r\n\t\t(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \\\r\n\t\t{ \\\r\n\t\tint Tinf,Ttag,Tclass; \\\r\n\t\tlong Tlen; \\\r\n\t\t\\\r\n\t\tc.q=c.p; \\\r\n\t\tTinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \\\r\n\t\tif (Tinf & 0x80) \\\r\n\t\t\t{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \\\r\n\t\t\tc.line=__LINE__; goto err; } \\\r\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) \\\r\n\t\t\t\t\tTlen = c.slen - (c.p - c.q) - 2; \\\r\n\t\tif (func(&(r),&c.p,Tlen) == NULL) \\\r\n\t\t\t{ c.line=__LINE__; goto err; } \\\r\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) { \\\r\n\t\t\tTlen = c.slen - (c.p - c.q); \\\r\n\t\t\tif(!ASN1_const_check_infinite_end(&c.p, Tlen)) \\\r\n\t\t\t\t{ c.error=ERR_R_MISSING_ASN1_EOS; \\\r\n\t\t\t\tc.line=__LINE__; goto err; } \\\r\n\t\t}\\\r\n\t\tc.slen-=(c.p-c.q); \\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \\\r\n\tif ((c.slen != 0) && (M_ASN1_next == \\\r\n\t\t(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \\\r\n\t\t{ \\\r\n\t\tint Tinf,Ttag,Tclass; \\\r\n\t\tlong Tlen; \\\r\n\t\t\\\r\n\t\tc.q=c.p; \\\r\n\t\tTinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \\\r\n\t\tif (Tinf & 0x80) \\\r\n\t\t\t{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \\\r\n\t\t\tc.line=__LINE__; goto err; } \\\r\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) \\\r\n\t\t\t\t\tTlen = c.slen - (c.p - c.q) - 2; \\\r\n\t\tif (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \\\r\n\t\t\t(void (*)())free_func, \\\r\n\t\t\tb,V_ASN1_UNIVERSAL) == NULL) \\\r\n\t\t\t{ c.line=__LINE__; goto err; } \\\r\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) { \\\r\n\t\t\tTlen = c.slen - (c.p - c.q); \\\r\n\t\t\tif(!ASN1_check_infinite_end(&c.p, Tlen)) \\\r\n\t\t\t\t{ c.error=ERR_R_MISSING_ASN1_EOS; \\\r\n\t\t\t\tc.line=__LINE__; goto err; } \\\r\n\t\t}\\\r\n\t\tc.slen-=(c.p-c.q); \\\r\n\t\t}\r\n\r\n#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \\\r\n\tif ((c.slen != 0) && (M_ASN1_next == \\\r\n\t\t(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \\\r\n\t\t{ \\\r\n\t\tint Tinf,Ttag,Tclass; \\\r\n\t\tlong Tlen; \\\r\n\t\t\\\r\n\t\tc.q=c.p; \\\r\n\t\tTinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \\\r\n\t\tif (Tinf & 0x80) \\\r\n\t\t\t{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \\\r\n\t\t\tc.line=__LINE__; goto err; } \\\r\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) \\\r\n\t\t\t\t\tTlen = c.slen - (c.p - c.q) - 2; \\\r\n\t\tif (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \\\r\n\t\t\tfree_func,b,V_ASN1_UNIVERSAL) == NULL) \\\r\n\t\t\t{ c.line=__LINE__; goto err; } \\\r\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) { \\\r\n\t\t\tTlen = c.slen - (c.p - c.q); \\\r\n\t\t\tif(!ASN1_check_infinite_end(&c.p, Tlen)) \\\r\n\t\t\t\t{ c.error=ERR_R_MISSING_ASN1_EOS; \\\r\n\t\t\t\tc.line=__LINE__; goto err; } \\\r\n\t\t}\\\r\n\t\tc.slen-=(c.p-c.q); \\\r\n\t\t}\r\n\r\n/* New macros */\r\n#define M_ASN1_New_Malloc(ret,type) \\\r\n\tif ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \\\r\n\t\t{ c.line=__LINE__; goto err2; }\r\n\r\n#define M_ASN1_New(arg,func) \\\r\n\tif (((arg)=func()) == NULL) return(NULL)\r\n\r\n#define M_ASN1_New_Error(a) \\\r\n/*\terr:\tASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \\\r\n\t\treturn(NULL);*/ \\\r\n\terr2:\tASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \\\r\n\t\treturn(NULL)\r\n\r\n\r\n/* BIG UGLY WARNING!  This is so damn ugly I wanna puke.  Unfortunately,\r\n   some macros that use ASN1_const_CTX still insist on writing in the input\r\n   stream.  ARGH!  ARGH!  ARGH!  Let's get rid of this macro package.\r\n   Please?\t\t\t\t\t\t-- Richard Levitte */\r\n#define M_ASN1_next\t\t(*((unsigned char *)(c.p)))\r\n#define M_ASN1_next_prev\t(*((unsigned char *)(c.q)))\r\n\r\n/*************************************************/\r\n\r\n#define M_ASN1_I2D_vars(a)\tint r=0,ret=0; \\\r\n\t\t\t\tunsigned char *p; \\\r\n\t\t\t\tif (a == NULL) return(0)\r\n\r\n/* Length Macros */\r\n#define M_ASN1_I2D_len(a,f)\tret+=f(a,NULL)\r\n#define M_ASN1_I2D_len_IMP_opt(a,f)\tif (a != NULL) M_ASN1_I2D_len(a,f)\r\n\r\n#define M_ASN1_I2D_len_SET(a,f) \\\r\n\t\tret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);\r\n\r\n#define M_ASN1_I2D_len_SET_type(type,a,f) \\\r\n\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \\\r\n\t\t\t\t\t    V_ASN1_UNIVERSAL,IS_SET);\r\n\r\n#define M_ASN1_I2D_len_SEQUENCE(a,f) \\\r\n\t\tret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \\\r\n\t\t\t\t  IS_SEQUENCE);\r\n\r\n#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \\\r\n\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \\\r\n\t\t\t\t\t    V_ASN1_UNIVERSAL,IS_SEQUENCE)\r\n\r\n#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\tM_ASN1_I2D_len_SEQUENCE(a,f);\r\n\r\n#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\t\tM_ASN1_I2D_len_SEQUENCE_type(type,a,f);\r\n\r\n#define M_ASN1_I2D_len_IMP_SET(a,f,x) \\\r\n\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);\r\n\r\n#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \\\r\n\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \\\r\n\t\t\t\t\t    V_ASN1_CONTEXT_SPECIFIC,IS_SET);\r\n\r\n#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t\t  IS_SET);\r\n\r\n#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \\\r\n\t\t\t\t\t       V_ASN1_CONTEXT_SPECIFIC,IS_SET);\r\n\r\n#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \\\r\n\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t  IS_SEQUENCE);\r\n\r\n#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t\t  IS_SEQUENCE);\r\n\r\n#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \\\r\n\t\t\t\t\t\t    V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t\t\t    IS_SEQUENCE);\r\n\r\n#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \\\r\n\t\tif (a != NULL)\\\r\n\t\t\t{ \\\r\n\t\t\tv=f(a,NULL); \\\r\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0))\\\r\n\t\t\t{ \\\r\n\t\t\tv=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \\\r\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0))\\\r\n\t\t\t{ \\\r\n\t\t\tv=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \\\r\n\t\t\t\t       IS_SEQUENCE); \\\r\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0))\\\r\n\t\t\t{ \\\r\n\t\t\tv=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \\\r\n\t\t\t\t\t\t V_ASN1_UNIVERSAL, \\\r\n\t\t\t\t\t\t IS_SEQUENCE); \\\r\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\r\n\t\t\t}\r\n\r\n/* Put Macros */\r\n#define M_ASN1_I2D_put(a,f)\tf(a,&p)\r\n\r\n#define M_ASN1_I2D_put_IMP_opt(a,f,t)\t\\\r\n\t\tif (a != NULL) \\\r\n\t\t\t{ \\\r\n\t\t\tunsigned char *q=p; \\\r\n\t\t\tf(a,&p); \\\r\n\t\t\t*q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\\\r\n\t\t\tV_ASN1_UNIVERSAL,IS_SET)\r\n#define M_ASN1_I2D_put_SET_type(type,a,f) \\\r\n     i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)\r\n#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\\\r\n\t\t\tV_ASN1_CONTEXT_SPECIFIC,IS_SET)\r\n#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \\\r\n     i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)\r\n#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\\\r\n\t\t\tV_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)\r\n\r\n#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\\\r\n\t\t\t\t\t     V_ASN1_UNIVERSAL,IS_SEQUENCE)\r\n\r\n#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \\\r\n     i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \\\r\n\t\t\t    IS_SEQUENCE)\r\n\r\n#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\tM_ASN1_I2D_put_SEQUENCE(a,f);\r\n\r\n#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\t{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t       IS_SET); }\r\n\r\n#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\t\t{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \\\r\n\t\t\t\t\t\t V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t\t\t IS_SET); }\r\n\r\n#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\t{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t       IS_SEQUENCE); }\r\n\r\n#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\t\t{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \\\r\n\t\t\t\t\t\t V_ASN1_CONTEXT_SPECIFIC, \\\r\n\t\t\t\t\t\t IS_SEQUENCE); }\r\n\r\n#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \\\r\n\t\tif (a != NULL) \\\r\n\t\t\t{ \\\r\n\t\t\tASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \\\r\n\t\t\tf(a,&p); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\t{ \\\r\n\t\t\tASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \\\r\n\t\t\ti2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \\\r\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\r\n\t\t\t{ \\\r\n\t\t\tASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \\\r\n\t\t\ti2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \\\r\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\r\n\t\t\t{ \\\r\n\t\t\tASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \\\r\n\t\t\ti2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \\\r\n\t\t\t\t\t       IS_SEQUENCE); \\\r\n\t\t\t}\r\n\r\n#define M_ASN1_I2D_seq_total() \\\r\n\t\tr=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \\\r\n\t\tif (pp == NULL) return(r); \\\r\n\t\tp= *pp; \\\r\n\t\tASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)\r\n\r\n#define M_ASN1_I2D_INF_seq_start(tag,ctx) \\\r\n\t\t*(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \\\r\n\t\t*(p++)=0x80\r\n\r\n#define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00\r\n\r\n#define M_ASN1_I2D_finish()\t*pp=p; \\\r\n\t\t\t\treturn(r);\r\n\r\nint asn1_GetSequence(ASN1_const_CTX *c, long *length);\r\nvoid asn1_add_error(const unsigned char *address,int offset);\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/asn1t.h",
    "content": "/* asn1t.h */\r\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\r\n * project 2000.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n#ifndef HEADER_ASN1T_H\r\n#define HEADER_ASN1T_H\r\n\r\n#include <stddef.h>\r\n#include <openssl/e_os2.h>\r\n#include <openssl/asn1.h>\r\n\r\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\r\n# undef OPENSSL_EXTERN\r\n# define OPENSSL_EXTERN OPENSSL_EXPORT\r\n#endif\r\n\r\n/* ASN1 template defines, structures and functions */\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n\r\n/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */\r\n#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))\r\n\r\n\r\n/* Macros for start and end of ASN1_ITEM definition */\r\n\r\n#define ASN1_ITEM_start(itname) \\\r\n\tOPENSSL_GLOBAL const ASN1_ITEM itname##_it = {\r\n\r\n#define ASN1_ITEM_end(itname) \\\r\n\t\t};\r\n\r\n#else\r\n\r\n/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */\r\n#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))\r\n\r\n\r\n/* Macros for start and end of ASN1_ITEM definition */\r\n\r\n#define ASN1_ITEM_start(itname) \\\r\n\tconst ASN1_ITEM * itname##_it(void) \\\r\n\t{ \\\r\n\t\tstatic const ASN1_ITEM local_it = { \r\n\r\n#define ASN1_ITEM_end(itname) \\\r\n\t\t}; \\\r\n\treturn &local_it; \\\r\n\t}\r\n\r\n#endif\r\n\r\n\r\n/* Macros to aid ASN1 template writing */\r\n\r\n#define ASN1_ITEM_TEMPLATE(tname) \\\r\n\tstatic const ASN1_TEMPLATE tname##_item_tt \r\n\r\n#define ASN1_ITEM_TEMPLATE_END(tname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_PRIMITIVE,\\\r\n\t\t-1,\\\r\n\t\t&tname##_item_tt,\\\r\n\t\t0,\\\r\n\t\tNULL,\\\r\n\t\t0,\\\r\n\t\t#tname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n\r\n/* This is a ASN1 type which just embeds a template */\r\n \r\n/* This pair helps declare a SEQUENCE. We can do:\r\n *\r\n * \tASN1_SEQUENCE(stname) = {\r\n * \t\t... SEQUENCE components ...\r\n * \t} ASN1_SEQUENCE_END(stname)\r\n *\r\n * \tThis will produce an ASN1_ITEM called stname_it\r\n *\tfor a structure called stname.\r\n *\r\n * \tIf you want the same structure but a different\r\n *\tname then use:\r\n *\r\n * \tASN1_SEQUENCE(itname) = {\r\n * \t\t... SEQUENCE components ...\r\n * \t} ASN1_SEQUENCE_END_name(stname, itname)\r\n *\r\n *\tThis will create an item called itname_it using\r\n *\ta structure called stname.\r\n */\r\n\r\n#define ASN1_SEQUENCE(tname) \\\r\n\tstatic const ASN1_TEMPLATE tname##_seq_tt[] \r\n\r\n#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)\r\n\r\n#define ASN1_SEQUENCE_END_name(stname, tname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_SEQUENCE,\\\r\n\t\tV_ASN1_SEQUENCE,\\\r\n\t\ttname##_seq_tt,\\\r\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\r\n\t\tNULL,\\\r\n\t\tsizeof(stname),\\\r\n\t\t#stname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n#define ASN1_NDEF_SEQUENCE(tname) \\\r\n\tASN1_SEQUENCE(tname)\r\n\r\n#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \\\r\n\tASN1_SEQUENCE_cb(tname, cb)\r\n\r\n#define ASN1_SEQUENCE_cb(tname, cb) \\\r\n\tstatic const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \\\r\n\tASN1_SEQUENCE(tname)\r\n\r\n#define ASN1_BROKEN_SEQUENCE(tname) \\\r\n\tstatic const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \\\r\n\tASN1_SEQUENCE(tname)\r\n\r\n#define ASN1_SEQUENCE_ref(tname, cb, lck) \\\r\n\tstatic const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \\\r\n\tASN1_SEQUENCE(tname)\r\n\r\n#define ASN1_SEQUENCE_enc(tname, enc, cb) \\\r\n\tstatic const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \\\r\n\tASN1_SEQUENCE(tname)\r\n\r\n#define ASN1_NDEF_SEQUENCE_END(tname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_NDEF_SEQUENCE,\\\r\n\t\tV_ASN1_SEQUENCE,\\\r\n\t\ttname##_seq_tt,\\\r\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\r\n\t\tNULL,\\\r\n\t\tsizeof(tname),\\\r\n\t\t#tname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)\r\n\r\n#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)\r\n\r\n#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)\r\n\r\n#define ASN1_SEQUENCE_END_ref(stname, tname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_SEQUENCE,\\\r\n\t\tV_ASN1_SEQUENCE,\\\r\n\t\ttname##_seq_tt,\\\r\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\r\n\t\t&tname##_aux,\\\r\n\t\tsizeof(stname),\\\r\n\t\t#stname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_NDEF_SEQUENCE,\\\r\n\t\tV_ASN1_SEQUENCE,\\\r\n\t\ttname##_seq_tt,\\\r\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\r\n\t\t&tname##_aux,\\\r\n\t\tsizeof(stname),\\\r\n\t\t#stname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n\r\n/* This pair helps declare a CHOICE type. We can do:\r\n *\r\n * \tASN1_CHOICE(chname) = {\r\n * \t\t... CHOICE options ...\r\n * \tASN1_CHOICE_END(chname)\r\n *\r\n * \tThis will produce an ASN1_ITEM called chname_it\r\n *\tfor a structure called chname. The structure\r\n *\tdefinition must look like this:\r\n *\ttypedef struct {\r\n *\t\tint type;\r\n *\t\tunion {\r\n *\t\t\tASN1_SOMETHING *opt1;\r\n *\t\t\tASN1_SOMEOTHER *opt2;\r\n *\t\t} value;\r\n *\t} chname;\r\n *\t\r\n *\tthe name of the selector must be 'type'.\r\n * \tto use an alternative selector name use the\r\n *      ASN1_CHOICE_END_selector() version.\r\n */\r\n\r\n#define ASN1_CHOICE(tname) \\\r\n\tstatic const ASN1_TEMPLATE tname##_ch_tt[] \r\n\r\n#define ASN1_CHOICE_cb(tname, cb) \\\r\n\tstatic const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \\\r\n\tASN1_CHOICE(tname)\r\n\r\n#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)\r\n\r\n#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)\r\n\r\n#define ASN1_CHOICE_END_selector(stname, tname, selname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_CHOICE,\\\r\n\t\toffsetof(stname,selname) ,\\\r\n\t\ttname##_ch_tt,\\\r\n\t\tsizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\\\r\n\t\tNULL,\\\r\n\t\tsizeof(stname),\\\r\n\t\t#stname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n#define ASN1_CHOICE_END_cb(stname, tname, selname) \\\r\n\t;\\\r\n\tASN1_ITEM_start(tname) \\\r\n\t\tASN1_ITYPE_CHOICE,\\\r\n\t\toffsetof(stname,selname) ,\\\r\n\t\ttname##_ch_tt,\\\r\n\t\tsizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\\\r\n\t\t&tname##_aux,\\\r\n\t\tsizeof(stname),\\\r\n\t\t#stname \\\r\n\tASN1_ITEM_end(tname)\r\n\r\n/* This helps with the template wrapper form of ASN1_ITEM */\r\n\r\n#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \\\r\n\t(flags), (tag), 0,\\\r\n\t#name, ASN1_ITEM_ref(type) }\r\n\r\n/* These help with SEQUENCE or CHOICE components */\r\n\r\n/* used to declare other types */\r\n\r\n#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \\\r\n\t(flags), (tag), offsetof(stname, field),\\\r\n\t#field, ASN1_ITEM_ref(type) }\r\n\r\n/* used when the structure is combined with the parent */\r\n\r\n#define ASN1_EX_COMBINE(flags, tag, type) { \\\r\n\t(flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }\r\n\r\n/* implicit and explicit helper macros */\r\n\r\n#define ASN1_IMP_EX(stname, field, type, tag, ex) \\\r\n\t\tASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)\r\n\r\n#define ASN1_EXP_EX(stname, field, type, tag, ex) \\\r\n\t\tASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)\r\n\r\n/* Any defined by macros: the field used is in the table itself */\r\n\r\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }\r\n#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }\r\n#else\r\n#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }\r\n#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }\r\n#endif\r\n/* Plain simple type */\r\n#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)\r\n\r\n/* OPTIONAL simple type */\r\n#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)\r\n\r\n/* IMPLICIT tagged simple type */\r\n#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)\r\n\r\n/* IMPLICIT tagged OPTIONAL simple type */\r\n#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)\r\n\r\n/* Same as above but EXPLICIT */\r\n\r\n#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)\r\n#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)\r\n\r\n/* SEQUENCE OF type */\r\n#define ASN1_SEQUENCE_OF(stname, field, type) \\\r\n\t\tASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)\r\n\r\n/* OPTIONAL SEQUENCE OF */\r\n#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \\\r\n\t\tASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)\r\n\r\n/* Same as above but for SET OF */\r\n\r\n#define ASN1_SET_OF(stname, field, type) \\\r\n\t\tASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)\r\n\r\n#define ASN1_SET_OF_OPT(stname, field, type) \\\r\n\t\tASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)\r\n\r\n/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */\r\n\r\n#define ASN1_IMP_SET_OF(stname, field, type, tag) \\\r\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)\r\n\r\n#define ASN1_EXP_SET_OF(stname, field, type, tag) \\\r\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)\r\n\r\n#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \\\r\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)\r\n\r\n#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \\\r\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)\r\n\r\n#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \\\r\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)\r\n\r\n#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \\\r\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)\r\n\r\n#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \\\r\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)\r\n\r\n#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \\\r\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)\r\n\r\n/* EXPLICIT using indefinite length constructed form */\r\n#define ASN1_NDEF_EXP(stname, field, type, tag) \\\r\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)\r\n\r\n/* EXPLICIT OPTIONAL using indefinite length constructed form */\r\n#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \\\r\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)\r\n\r\n/* Macros for the ASN1_ADB structure */\r\n\r\n#define ASN1_ADB(name) \\\r\n\tstatic const ASN1_ADB_TABLE name##_adbtbl[] \r\n\r\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n\r\n#define ASN1_ADB_END(name, flags, field, app_table, def, none) \\\r\n\t;\\\r\n\tstatic const ASN1_ADB name##_adb = {\\\r\n\t\tflags,\\\r\n\t\toffsetof(name, field),\\\r\n\t\tapp_table,\\\r\n\t\tname##_adbtbl,\\\r\n\t\tsizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\\\r\n\t\tdef,\\\r\n\t\tnone\\\r\n\t}\r\n\r\n#else\r\n\r\n#define ASN1_ADB_END(name, flags, field, app_table, def, none) \\\r\n\t;\\\r\n\tstatic const ASN1_ITEM *name##_adb(void) \\\r\n\t{ \\\r\n\tstatic const ASN1_ADB internal_adb = \\\r\n\t\t{\\\r\n\t\tflags,\\\r\n\t\toffsetof(name, field),\\\r\n\t\tapp_table,\\\r\n\t\tname##_adbtbl,\\\r\n\t\tsizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\\\r\n\t\tdef,\\\r\n\t\tnone\\\r\n\t\t}; \\\r\n\t\treturn (const ASN1_ITEM *) &internal_adb; \\\r\n\t} \\\r\n\tvoid dummy_function(void)\r\n\r\n#endif\r\n\r\n#define ADB_ENTRY(val, template) {val, template}\r\n\r\n#define ASN1_ADB_TEMPLATE(name) \\\r\n\tstatic const ASN1_TEMPLATE name##_tt \r\n\r\n/* This is the ASN1 template structure that defines\r\n * a wrapper round the actual type. It determines the\r\n * actual position of the field in the value structure,\r\n * various flags such as OPTIONAL and the field name.\r\n */\r\n\r\nstruct ASN1_TEMPLATE_st {\r\nunsigned long flags;\t\t/* Various flags */\r\nlong tag;\t\t\t/* tag, not used if no tagging */\r\nunsigned long offset;\t\t/* Offset of this field in structure */\r\n#ifndef NO_ASN1_FIELD_NAMES\r\nconst char *field_name;\t\t/* Field name */\r\n#endif\r\nASN1_ITEM_EXP *item;\t\t/* Relevant ASN1_ITEM or ASN1_ADB */\r\n};\r\n\r\n/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */\r\n\r\n#define ASN1_TEMPLATE_item(t) (t->item_ptr)\r\n#define ASN1_TEMPLATE_adb(t) (t->item_ptr)\r\n\r\ntypedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;\r\ntypedef struct ASN1_ADB_st ASN1_ADB;\r\n\r\nstruct ASN1_ADB_st {\r\n\tunsigned long flags;\t/* Various flags */\r\n\tunsigned long offset;\t/* Offset of selector field */\r\n\tSTACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */\r\n\tconst ASN1_ADB_TABLE *tbl;\t/* Table of possible types */\r\n\tlong tblcount;\t\t/* Number of entries in tbl */\r\n\tconst ASN1_TEMPLATE *default_tt;  /* Type to use if no match */\r\n\tconst ASN1_TEMPLATE *null_tt;  /* Type to use if selector is NULL */\r\n};\r\n\r\nstruct ASN1_ADB_TABLE_st {\r\n\tlong value;\t\t/* NID for an object or value for an int */\r\n\tconst ASN1_TEMPLATE tt;\t\t/* item for this value */\r\n};\r\n\r\n/* template flags */\r\n\r\n/* Field is optional */\r\n#define ASN1_TFLG_OPTIONAL\t(0x1)\r\n\r\n/* Field is a SET OF */\r\n#define ASN1_TFLG_SET_OF\t(0x1 << 1)\r\n\r\n/* Field is a SEQUENCE OF */\r\n#define ASN1_TFLG_SEQUENCE_OF\t(0x2 << 1)\r\n\r\n/* Special case: this refers to a SET OF that\r\n * will be sorted into DER order when encoded *and*\r\n * the corresponding STACK will be modified to match\r\n * the new order.\r\n */\r\n#define ASN1_TFLG_SET_ORDER\t(0x3 << 1)\r\n\r\n/* Mask for SET OF or SEQUENCE OF */\r\n#define ASN1_TFLG_SK_MASK\t(0x3 << 1)\r\n\r\n/* These flags mean the tag should be taken from the\r\n * tag field. If EXPLICIT then the underlying type\r\n * is used for the inner tag.\r\n */\r\n\r\n/* IMPLICIT tagging */\r\n#define ASN1_TFLG_IMPTAG\t(0x1 << 3)\r\n\r\n\r\n/* EXPLICIT tagging, inner tag from underlying type */\r\n#define ASN1_TFLG_EXPTAG\t(0x2 << 3)\r\n\r\n#define ASN1_TFLG_TAG_MASK\t(0x3 << 3)\r\n\r\n/* context specific IMPLICIT */\r\n#define ASN1_TFLG_IMPLICIT\tASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT\r\n\r\n/* context specific EXPLICIT */\r\n#define ASN1_TFLG_EXPLICIT\tASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT\r\n\r\n/* If tagging is in force these determine the\r\n * type of tag to use. Otherwise the tag is\r\n * determined by the underlying type. These \r\n * values reflect the actual octet format.\r\n */\r\n\r\n/* Universal tag */ \r\n#define ASN1_TFLG_UNIVERSAL\t(0x0<<6)\r\n/* Application tag */ \r\n#define ASN1_TFLG_APPLICATION\t(0x1<<6)\r\n/* Context specific tag */ \r\n#define ASN1_TFLG_CONTEXT\t(0x2<<6)\r\n/* Private tag */ \r\n#define ASN1_TFLG_PRIVATE\t(0x3<<6)\r\n\r\n#define ASN1_TFLG_TAG_CLASS\t(0x3<<6)\r\n\r\n/* These are for ANY DEFINED BY type. In this case\r\n * the 'item' field points to an ASN1_ADB structure\r\n * which contains a table of values to decode the\r\n * relevant type\r\n */\r\n\r\n#define ASN1_TFLG_ADB_MASK\t(0x3<<8)\r\n\r\n#define ASN1_TFLG_ADB_OID\t(0x1<<8)\r\n\r\n#define ASN1_TFLG_ADB_INT\t(0x1<<9)\r\n\r\n/* This flag means a parent structure is passed\r\n * instead of the field: this is useful is a\r\n * SEQUENCE is being combined with a CHOICE for\r\n * example. Since this means the structure and\r\n * item name will differ we need to use the\r\n * ASN1_CHOICE_END_name() macro for example.\r\n */\r\n\r\n#define ASN1_TFLG_COMBINE\t(0x1<<10)\r\n\r\n/* This flag when present in a SEQUENCE OF, SET OF\r\n * or EXPLICIT causes indefinite length constructed\r\n * encoding to be used if required.\r\n */\r\n\r\n#define ASN1_TFLG_NDEF\t\t(0x1<<11)\r\n\r\n/* This is the actual ASN1 item itself */\r\n\r\nstruct ASN1_ITEM_st {\r\nchar itype;\t\t\t/* The item type, primitive, SEQUENCE, CHOICE or extern */\r\nlong utype;\t\t\t/* underlying type */\r\nconst ASN1_TEMPLATE *templates;\t/* If SEQUENCE or CHOICE this contains the contents */\r\nlong tcount;\t\t\t/* Number of templates if SEQUENCE or CHOICE */\r\nconst void *funcs;\t\t/* functions that handle this type */\r\nlong size;\t\t\t/* Structure size (usually)*/\r\n#ifndef NO_ASN1_FIELD_NAMES\r\nconst char *sname;\t\t/* Structure name */\r\n#endif\r\n};\r\n\r\n/* These are values for the itype field and\r\n * determine how the type is interpreted.\r\n *\r\n * For PRIMITIVE types the underlying type\r\n * determines the behaviour if items is NULL.\r\n *\r\n * Otherwise templates must contain a single \r\n * template and the type is treated in the\r\n * same way as the type specified in the template.\r\n *\r\n * For SEQUENCE types the templates field points\r\n * to the members, the size field is the\r\n * structure size.\r\n *\r\n * For CHOICE types the templates field points\r\n * to each possible member (typically a union)\r\n * and the 'size' field is the offset of the\r\n * selector.\r\n *\r\n * The 'funcs' field is used for application\r\n * specific functions. \r\n *\r\n * For COMPAT types the funcs field gives a\r\n * set of functions that handle this type, this\r\n * supports the old d2i, i2d convention.\r\n *\r\n * The EXTERN type uses a new style d2i/i2d.\r\n * The new style should be used where possible\r\n * because it avoids things like the d2i IMPLICIT\r\n * hack.\r\n *\r\n * MSTRING is a multiple string type, it is used\r\n * for a CHOICE of character strings where the\r\n * actual strings all occupy an ASN1_STRING\r\n * structure. In this case the 'utype' field\r\n * has a special meaning, it is used as a mask\r\n * of acceptable types using the B_ASN1 constants.\r\n *\r\n * NDEF_SEQUENCE is the same as SEQUENCE except\r\n * that it will use indefinite length constructed\r\n * encoding if requested.\r\n *\r\n */\r\n\r\n#define ASN1_ITYPE_PRIMITIVE\t\t0x0\r\n\r\n#define ASN1_ITYPE_SEQUENCE\t\t0x1\r\n\r\n#define ASN1_ITYPE_CHOICE\t\t0x2\r\n\r\n#define ASN1_ITYPE_COMPAT\t\t0x3\r\n\r\n#define ASN1_ITYPE_EXTERN\t\t0x4\r\n\r\n#define ASN1_ITYPE_MSTRING\t\t0x5\r\n\r\n#define ASN1_ITYPE_NDEF_SEQUENCE\t0x6\r\n\r\n/* Cache for ASN1 tag and length, so we\r\n * don't keep re-reading it for things\r\n * like CHOICE\r\n */\r\n\r\nstruct ASN1_TLC_st{\r\n\tchar valid;\t/* Values below are valid */\r\n\tint ret;\t/* return value */\r\n\tlong plen;\t/* length */\r\n\tint ptag;\t/* class value */\r\n\tint pclass;\t/* class value */\r\n\tint hdrlen;\t/* header length */\r\n};\r\n\r\n/* Typedefs for ASN1 function pointers */\r\n\r\ntypedef ASN1_VALUE * ASN1_new_func(void);\r\ntypedef void ASN1_free_func(ASN1_VALUE *a);\r\ntypedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length);\r\ntypedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in);\r\n\r\ntypedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,\r\n\t\t\t\t\tint tag, int aclass, char opt, ASN1_TLC *ctx);\r\n\r\ntypedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);\r\ntypedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\ntypedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\n\r\ntypedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, \r\n\t\t\t\t\t\tint indent, const char *fname, \r\n\t\t\t\t\t\tconst ASN1_PCTX *pctx);\r\n\r\ntypedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);\r\ntypedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);\r\ntypedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);\r\n\r\ntypedef struct ASN1_COMPAT_FUNCS_st {\r\n\tASN1_new_func *asn1_new;\r\n\tASN1_free_func *asn1_free;\r\n\tASN1_d2i_func *asn1_d2i;\r\n\tASN1_i2d_func *asn1_i2d;\r\n} ASN1_COMPAT_FUNCS;\r\n\r\ntypedef struct ASN1_EXTERN_FUNCS_st {\r\n\tvoid *app_data;\r\n\tASN1_ex_new_func *asn1_ex_new;\r\n\tASN1_ex_free_func *asn1_ex_free;\r\n\tASN1_ex_free_func *asn1_ex_clear;\r\n\tASN1_ex_d2i *asn1_ex_d2i;\r\n\tASN1_ex_i2d *asn1_ex_i2d;\r\n\tASN1_ex_print_func *asn1_ex_print;\r\n} ASN1_EXTERN_FUNCS;\r\n\r\ntypedef struct ASN1_PRIMITIVE_FUNCS_st {\r\n\tvoid *app_data;\r\n\tunsigned long flags;\r\n\tASN1_ex_new_func *prim_new;\r\n\tASN1_ex_free_func *prim_free;\r\n\tASN1_ex_free_func *prim_clear;\r\n\tASN1_primitive_c2i *prim_c2i;\r\n\tASN1_primitive_i2c *prim_i2c;\r\n\tASN1_primitive_print *prim_print;\r\n} ASN1_PRIMITIVE_FUNCS;\r\n\r\n/* This is the ASN1_AUX structure: it handles various\r\n * miscellaneous requirements. For example the use of\r\n * reference counts and an informational callback.\r\n *\r\n * The \"informational callback\" is called at various\r\n * points during the ASN1 encoding and decoding. It can\r\n * be used to provide minor customisation of the structures\r\n * used. This is most useful where the supplied routines\r\n * *almost* do the right thing but need some extra help\r\n * at a few points. If the callback returns zero then\r\n * it is assumed a fatal error has occurred and the \r\n * main operation should be abandoned.\r\n *\r\n * If major changes in the default behaviour are required\r\n * then an external type is more appropriate.\r\n */\r\n\r\ntypedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,\r\n\t\t\t\tvoid *exarg);\r\n\r\ntypedef struct ASN1_AUX_st {\r\n\tvoid *app_data;\r\n\tint flags;\r\n\tint ref_offset;\t\t/* Offset of reference value */\r\n\tint ref_lock;\t\t/* Lock type to use */\r\n\tASN1_aux_cb *asn1_cb;\r\n\tint enc_offset;\t\t/* Offset of ASN1_ENCODING structure */\r\n} ASN1_AUX;\r\n\r\n/* For print related callbacks exarg points to this structure */\r\ntypedef struct ASN1_PRINT_ARG_st {\r\n\tBIO *out;\r\n\tint indent;\r\n\tconst ASN1_PCTX *pctx;\r\n} ASN1_PRINT_ARG;\r\n\r\n/* For streaming related callbacks exarg points to this structure */\r\ntypedef struct ASN1_STREAM_ARG_st {\r\n\t/* BIO to stream through */\r\n\tBIO *out;\r\n\t/* BIO with filters appended */\r\n\tBIO *ndef_bio;\r\n\t/* Streaming I/O boundary */\r\n\tunsigned char **boundary;\r\n} ASN1_STREAM_ARG;\r\n\r\n/* Flags in ASN1_AUX */\r\n\r\n/* Use a reference count */\r\n#define ASN1_AFLG_REFCOUNT\t1\r\n/* Save the encoding of structure (useful for signatures) */\r\n#define ASN1_AFLG_ENCODING\t2\r\n/* The Sequence length is invalid */\r\n#define ASN1_AFLG_BROKEN\t4\r\n\r\n/* operation values for asn1_cb */\r\n\r\n#define ASN1_OP_NEW_PRE\t\t0\r\n#define ASN1_OP_NEW_POST\t1\r\n#define ASN1_OP_FREE_PRE\t2\r\n#define ASN1_OP_FREE_POST\t3\r\n#define ASN1_OP_D2I_PRE\t\t4\r\n#define ASN1_OP_D2I_POST\t5\r\n#define ASN1_OP_I2D_PRE\t\t6\r\n#define ASN1_OP_I2D_POST\t7\r\n#define ASN1_OP_PRINT_PRE\t8\r\n#define ASN1_OP_PRINT_POST\t9\r\n#define ASN1_OP_STREAM_PRE\t10\r\n#define ASN1_OP_STREAM_POST\t11\r\n#define ASN1_OP_DETACHED_PRE\t12\r\n#define ASN1_OP_DETACHED_POST\t13\r\n\r\n/* Macro to implement a primitive type */\r\n#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)\r\n#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \\\r\n\t\t\t\tASN1_ITEM_start(itname) \\\r\n\t\t\t\t\tASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \\\r\n\t\t\t\tASN1_ITEM_end(itname)\r\n\r\n/* Macro to implement a multi string type */\r\n#define IMPLEMENT_ASN1_MSTRING(itname, mask) \\\r\n\t\t\t\tASN1_ITEM_start(itname) \\\r\n\t\t\t\t\tASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \\\r\n\t\t\t\tASN1_ITEM_end(itname)\r\n\r\n/* Macro to implement an ASN1_ITEM in terms of old style funcs */\r\n\r\n#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)\r\n\r\n#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \\\r\n\tstatic const ASN1_COMPAT_FUNCS sname##_ff = { \\\r\n\t\t(ASN1_new_func *)sname##_new, \\\r\n\t\t(ASN1_free_func *)sname##_free, \\\r\n\t\t(ASN1_d2i_func *)d2i_##sname, \\\r\n\t\t(ASN1_i2d_func *)i2d_##sname, \\\r\n\t}; \\\r\n\tASN1_ITEM_start(sname) \\\r\n\t\tASN1_ITYPE_COMPAT, \\\r\n\t\ttag, \\\r\n\t\tNULL, \\\r\n\t\t0, \\\r\n\t\t&sname##_ff, \\\r\n\t\t0, \\\r\n\t\t#sname \\\r\n\tASN1_ITEM_end(sname)\r\n\r\n#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \\\r\n\tASN1_ITEM_start(sname) \\\r\n\t\tASN1_ITYPE_EXTERN, \\\r\n\t\ttag, \\\r\n\t\tNULL, \\\r\n\t\t0, \\\r\n\t\t&fptrs, \\\r\n\t\t0, \\\r\n\t\t#sname \\\r\n\tASN1_ITEM_end(sname)\r\n\r\n/* Macro to implement standard functions in terms of ASN1_ITEM structures */\r\n\r\n#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)\r\n\r\n#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)\r\n\r\n#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \\\r\n\t\t\tIMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)\r\n\r\n#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \\\r\n\t\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)\r\n\r\n#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \\\r\n\t\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)\r\n\r\n#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \\\r\n\tpre stname *fname##_new(void) \\\r\n\t{ \\\r\n\t\treturn (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \\\r\n\t} \\\r\n\tpre void fname##_free(stname *a) \\\r\n\t{ \\\r\n\t\tASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \\\r\n\t}\r\n\r\n#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \\\r\n\tstname *fname##_new(void) \\\r\n\t{ \\\r\n\t\treturn (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \\\r\n\t} \\\r\n\tvoid fname##_free(stname *a) \\\r\n\t{ \\\r\n\t\tASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \\\r\n\t}\r\n\r\n#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \\\r\n\tIMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \\\r\n\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)\r\n\r\n#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \\\r\n\tstname *d2i_##fname(stname **a, const unsigned char **in, long len) \\\r\n\t{ \\\r\n\t\treturn (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\\\r\n\t} \\\r\n\tint i2d_##fname(stname *a, unsigned char **out) \\\r\n\t{ \\\r\n\t\treturn ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\\\r\n\t} \r\n\r\n#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \\\r\n\tint i2d_##stname##_NDEF(stname *a, unsigned char **out) \\\r\n\t{ \\\r\n\t\treturn ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\\\r\n\t} \r\n\r\n/* This includes evil casts to remove const: they will go away when full\r\n * ASN1 constification is done.\r\n */\r\n#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \\\r\n\tstname *d2i_##fname(stname **a, const unsigned char **in, long len) \\\r\n\t{ \\\r\n\t\treturn (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\\\r\n\t} \\\r\n\tint i2d_##fname(const stname *a, unsigned char **out) \\\r\n\t{ \\\r\n\t\treturn ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\\\r\n\t} \r\n\r\n#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \\\r\n\tstname * stname##_dup(stname *x) \\\r\n        { \\\r\n        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \\\r\n        }\r\n\r\n#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \\\r\n\tIMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)\r\n\r\n#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \\\r\n\tint fname##_print_ctx(BIO *out, stname *x, int indent, \\\r\n\t\t\t\t\t\tconst ASN1_PCTX *pctx) \\\r\n\t{ \\\r\n\t\treturn ASN1_item_print(out, (ASN1_VALUE *)x, indent, \\\r\n\t\t\tASN1_ITEM_rptr(itname), pctx); \\\r\n\t} \r\n\r\n#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \\\r\n\t\tIMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)\r\n\r\n#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \\\r\n\tIMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \\\r\n\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)\r\n\r\n/* external definitions for primitive types */\r\n\r\nDECLARE_ASN1_ITEM(ASN1_BOOLEAN)\r\nDECLARE_ASN1_ITEM(ASN1_TBOOLEAN)\r\nDECLARE_ASN1_ITEM(ASN1_FBOOLEAN)\r\nDECLARE_ASN1_ITEM(ASN1_SEQUENCE)\r\nDECLARE_ASN1_ITEM(CBIGNUM)\r\nDECLARE_ASN1_ITEM(BIGNUM)\r\nDECLARE_ASN1_ITEM(LONG)\r\nDECLARE_ASN1_ITEM(ZLONG)\r\n\r\nDECLARE_STACK_OF(ASN1_VALUE)\r\n\r\n/* Functions used internally by the ASN1 code */\r\n\r\nint ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\nvoid ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\nint ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);\r\nint ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\n\r\nvoid ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);\r\nint ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt);\r\nint ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,\r\n\t\t\t\tint tag, int aclass, char opt, ASN1_TLC *ctx);\r\n\r\nint ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);\r\nint ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt);\r\nvoid ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\n\r\nint asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);\r\nint asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);\r\n\r\nint asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\nint asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);\r\n\r\nASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);\r\n\r\nconst ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr);\r\n\r\nint asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);\r\n\r\nvoid asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\nvoid asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);\r\nint asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);\r\nint asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/bio.h",
    "content": "/* crypto/bio/bio.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_BIO_H\r\n#define HEADER_BIO_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\n# include <stdio.h>\r\n#endif\r\n#include <stdarg.h>\r\n\r\n#include <openssl/crypto.h>\r\n\r\n#ifndef OPENSSL_NO_SCTP\r\n# ifndef OPENSSL_SYS_VMS\r\n# include <stdint.h>\r\n# else\r\n# include <inttypes.h>\r\n# endif\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* These are the 'types' of BIOs */\r\n#define BIO_TYPE_NONE\t\t0\r\n#define BIO_TYPE_MEM\t\t(1|0x0400)\r\n#define BIO_TYPE_FILE\t\t(2|0x0400)\r\n\r\n#define BIO_TYPE_FD\t\t(4|0x0400|0x0100)\r\n#define BIO_TYPE_SOCKET\t\t(5|0x0400|0x0100)\r\n#define BIO_TYPE_NULL\t\t(6|0x0400)\r\n#define BIO_TYPE_SSL\t\t(7|0x0200)\r\n#define BIO_TYPE_MD\t\t(8|0x0200)\t\t/* passive filter */\r\n#define BIO_TYPE_BUFFER\t\t(9|0x0200)\t\t/* filter */\r\n#define BIO_TYPE_CIPHER\t\t(10|0x0200)\t\t/* filter */\r\n#define BIO_TYPE_BASE64\t\t(11|0x0200)\t\t/* filter */\r\n#define BIO_TYPE_CONNECT\t(12|0x0400|0x0100)\t/* socket - connect */\r\n#define BIO_TYPE_ACCEPT\t\t(13|0x0400|0x0100)\t/* socket for accept */\r\n#define BIO_TYPE_PROXY_CLIENT\t(14|0x0200)\t\t/* client proxy BIO */\r\n#define BIO_TYPE_PROXY_SERVER\t(15|0x0200)\t\t/* server proxy BIO */\r\n#define BIO_TYPE_NBIO_TEST\t(16|0x0200)\t\t/* server proxy BIO */\r\n#define BIO_TYPE_NULL_FILTER\t(17|0x0200)\r\n#define BIO_TYPE_BER\t\t(18|0x0200)\t\t/* BER -> bin filter */\r\n#define BIO_TYPE_BIO\t\t(19|0x0400)\t\t/* (half a) BIO pair */\r\n#define BIO_TYPE_LINEBUFFER\t(20|0x0200)\t\t/* filter */\r\n#define BIO_TYPE_DGRAM\t\t(21|0x0400|0x0100)\r\n#ifndef OPENSSL_NO_SCTP\r\n#define BIO_TYPE_DGRAM_SCTP\t(24|0x0400|0x0100)\r\n#endif\r\n#define BIO_TYPE_ASN1 \t\t(22|0x0200)\t\t/* filter */\r\n#define BIO_TYPE_COMP \t\t(23|0x0200)\t\t/* filter */\r\n\r\n#define BIO_TYPE_DESCRIPTOR\t0x0100\t/* socket, fd, connect or accept */\r\n#define BIO_TYPE_FILTER\t\t0x0200\r\n#define BIO_TYPE_SOURCE_SINK\t0x0400\r\n\r\n/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.\r\n * BIO_set_fp(in,stdin,BIO_NOCLOSE); */\r\n#define BIO_NOCLOSE\t\t0x00\r\n#define BIO_CLOSE\t\t0x01\r\n\r\n/* These are used in the following macros and are passed to\r\n * BIO_ctrl() */\r\n#define BIO_CTRL_RESET\t\t1  /* opt - rewind/zero etc */\r\n#define BIO_CTRL_EOF\t\t2  /* opt - are we at the eof */\r\n#define BIO_CTRL_INFO\t\t3  /* opt - extra tit-bits */\r\n#define BIO_CTRL_SET\t\t4  /* man - set the 'IO' type */\r\n#define BIO_CTRL_GET\t\t5  /* man - get the 'IO' type */\r\n#define BIO_CTRL_PUSH\t\t6  /* opt - internal, used to signify change */\r\n#define BIO_CTRL_POP\t\t7  /* opt - internal, used to signify change */\r\n#define BIO_CTRL_GET_CLOSE\t8  /* man - set the 'close' on free */\r\n#define BIO_CTRL_SET_CLOSE\t9  /* man - set the 'close' on free */\r\n#define BIO_CTRL_PENDING\t10  /* opt - is their more data buffered */\r\n#define BIO_CTRL_FLUSH\t\t11  /* opt - 'flush' buffered output */\r\n#define BIO_CTRL_DUP\t\t12  /* man - extra stuff for 'duped' BIO */\r\n#define BIO_CTRL_WPENDING\t13  /* opt - number of bytes still to write */\r\n/* callback is int cb(BIO *bio,state,ret); */\r\n#define BIO_CTRL_SET_CALLBACK\t14  /* opt - set callback function */\r\n#define BIO_CTRL_GET_CALLBACK\t15  /* opt - set callback function */\r\n\r\n#define BIO_CTRL_SET_FILENAME\t30\t/* BIO_s_file special */\r\n\r\n/* dgram BIO stuff */\r\n#define BIO_CTRL_DGRAM_CONNECT       31  /* BIO dgram special */\r\n#define BIO_CTRL_DGRAM_SET_CONNECTED 32  /* allow for an externally\r\n\t\t\t\t\t  * connected socket to be\r\n\t\t\t\t\t  * passed in */ \r\n#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */\r\n#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */\r\n#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */\r\n#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */\r\n\r\n#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */\r\n#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */\r\n\t\t\t\t\t\r\n/* #ifdef IP_MTU_DISCOVER */\r\n#define BIO_CTRL_DGRAM_MTU_DISCOVER       39 /* set DF bit on egress packets */\r\n/* #endif */\r\n\r\n#define BIO_CTRL_DGRAM_QUERY_MTU          40 /* as kernel for current MTU */\r\n#define BIO_CTRL_DGRAM_GET_FALLBACK_MTU   47\r\n#define BIO_CTRL_DGRAM_GET_MTU            41 /* get cached value for MTU */\r\n#define BIO_CTRL_DGRAM_SET_MTU            42 /* set cached value for\r\n\t\t\t\t\t      * MTU. want to use this\r\n\t\t\t\t\t      * if asking the kernel\r\n\t\t\t\t\t      * fails */\r\n\r\n#define BIO_CTRL_DGRAM_MTU_EXCEEDED       43 /* check whether the MTU\r\n\t\t\t\t\t      * was exceed in the\r\n\t\t\t\t\t      * previous write\r\n\t\t\t\t\t      * operation */\r\n\r\n#define BIO_CTRL_DGRAM_GET_PEER           46\r\n#define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */\r\n\r\n#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT   45 /* Next DTLS handshake timeout to\r\n                                              * adjust socket timeouts */\r\n\r\n#ifndef OPENSSL_NO_SCTP\r\n/* SCTP stuff */\r\n#define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE\t50\r\n#define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY\t\t51\r\n#define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY\t\t52\r\n#define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD\t\t53\r\n#define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO\t\t60\r\n#define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO\t\t61\r\n#define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO\t\t62\r\n#define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO\t\t63\r\n#define BIO_CTRL_DGRAM_SCTP_GET_PRINFO\t\t\t64\r\n#define BIO_CTRL_DGRAM_SCTP_SET_PRINFO\t\t\t65\r\n#define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN\t\t70\r\n#endif\r\n\r\n/* modifiers */\r\n#define BIO_FP_READ\t\t0x02\r\n#define BIO_FP_WRITE\t\t0x04\r\n#define BIO_FP_APPEND\t\t0x08\r\n#define BIO_FP_TEXT\t\t0x10\r\n\r\n#define BIO_FLAGS_READ\t\t0x01\r\n#define BIO_FLAGS_WRITE\t\t0x02\r\n#define BIO_FLAGS_IO_SPECIAL\t0x04\r\n#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)\r\n#define BIO_FLAGS_SHOULD_RETRY\t0x08\r\n#ifndef\tBIO_FLAGS_UPLINK\r\n/* \"UPLINK\" flag denotes file descriptors provided by application.\r\n   It defaults to 0, as most platforms don't require UPLINK interface. */\r\n#define\tBIO_FLAGS_UPLINK\t0\r\n#endif\r\n\r\n/* Used in BIO_gethostbyname() */\r\n#define BIO_GHBN_CTRL_HITS\t\t1\r\n#define BIO_GHBN_CTRL_MISSES\t\t2\r\n#define BIO_GHBN_CTRL_CACHE_SIZE\t3\r\n#define BIO_GHBN_CTRL_GET_ENTRY\t\t4\r\n#define BIO_GHBN_CTRL_FLUSH\t\t5\r\n\r\n/* Mostly used in the SSL BIO */\r\n/* Not used anymore\r\n * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10\r\n * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20\r\n * #define BIO_FLAGS_PROTOCOL_STARTUP\t0x40\r\n */\r\n\r\n#define BIO_FLAGS_BASE64_NO_NL\t0x100\r\n\r\n/* This is used with memory BIOs: it means we shouldn't free up or change the\r\n * data in any way.\r\n */\r\n#define BIO_FLAGS_MEM_RDONLY\t0x200\r\n\r\ntypedef struct bio_st BIO;\r\n\r\nvoid BIO_set_flags(BIO *b, int flags);\r\nint  BIO_test_flags(const BIO *b, int flags);\r\nvoid BIO_clear_flags(BIO *b, int flags);\r\n\r\n#define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))\r\n#define BIO_set_retry_special(b) \\\r\n\t\tBIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))\r\n#define BIO_set_retry_read(b) \\\r\n\t\tBIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))\r\n#define BIO_set_retry_write(b) \\\r\n\t\tBIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))\r\n\r\n/* These are normally used internally in BIOs */\r\n#define BIO_clear_retry_flags(b) \\\r\n\t\tBIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))\r\n#define BIO_get_retry_flags(b) \\\r\n\t\tBIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))\r\n\r\n/* These should be used by the application to tell why we should retry */\r\n#define BIO_should_read(a)\t\tBIO_test_flags(a, BIO_FLAGS_READ)\r\n#define BIO_should_write(a)\t\tBIO_test_flags(a, BIO_FLAGS_WRITE)\r\n#define BIO_should_io_special(a)\tBIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)\r\n#define BIO_retry_type(a)\t\tBIO_test_flags(a, BIO_FLAGS_RWS)\r\n#define BIO_should_retry(a)\t\tBIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)\r\n\r\n/* The next three are used in conjunction with the\r\n * BIO_should_io_special() condition.  After this returns true,\r\n * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO \r\n * stack and return the 'reason' for the special and the offending BIO.\r\n * Given a BIO, BIO_get_retry_reason(bio) will return the code. */\r\n/* Returned from the SSL bio when the certificate retrieval code had an error */\r\n#define BIO_RR_SSL_X509_LOOKUP\t\t0x01\r\n/* Returned from the connect BIO when a connect would have blocked */\r\n#define BIO_RR_CONNECT\t\t\t0x02\r\n/* Returned from the accept BIO when an accept would have blocked */\r\n#define BIO_RR_ACCEPT\t\t\t0x03\r\n\r\n/* These are passed by the BIO callback */\r\n#define BIO_CB_FREE\t0x01\r\n#define BIO_CB_READ\t0x02\r\n#define BIO_CB_WRITE\t0x03\r\n#define BIO_CB_PUTS\t0x04\r\n#define BIO_CB_GETS\t0x05\r\n#define BIO_CB_CTRL\t0x06\r\n\r\n/* The callback is called before and after the underling operation,\r\n * The BIO_CB_RETURN flag indicates if it is after the call */\r\n#define BIO_CB_RETURN\t0x80\r\n#define BIO_CB_return(a) ((a)|BIO_CB_RETURN))\r\n#define BIO_cb_pre(a)\t(!((a)&BIO_CB_RETURN))\r\n#define BIO_cb_post(a)\t((a)&BIO_CB_RETURN)\r\n\r\nlong (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long);\r\nvoid BIO_set_callback(BIO *b, \r\n\tlong (*callback)(struct bio_st *,int,const char *,int, long,long));\r\nchar *BIO_get_callback_arg(const BIO *b);\r\nvoid BIO_set_callback_arg(BIO *b, char *arg);\r\n\r\nconst char * BIO_method_name(const BIO *b);\r\nint BIO_method_type(const BIO *b);\r\n\r\ntypedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);\r\n\r\ntypedef struct bio_method_st\r\n\t{\r\n\tint type;\r\n\tconst char *name;\r\n\tint (*bwrite)(BIO *, const char *, int);\r\n\tint (*bread)(BIO *, char *, int);\r\n\tint (*bputs)(BIO *, const char *);\r\n\tint (*bgets)(BIO *, char *, int);\r\n\tlong (*ctrl)(BIO *, int, long, void *);\r\n\tint (*create)(BIO *);\r\n\tint (*destroy)(BIO *);\r\n        long (*callback_ctrl)(BIO *, int, bio_info_cb *);\r\n\t} BIO_METHOD;\r\n\r\nstruct bio_st\r\n\t{\r\n\tBIO_METHOD *method;\r\n\t/* bio, mode, argp, argi, argl, ret */\r\n\tlong (*callback)(struct bio_st *,int,const char *,int, long,long);\r\n\tchar *cb_arg; /* first argument for the callback */\r\n\r\n\tint init;\r\n\tint shutdown;\r\n\tint flags;\t/* extra storage */\r\n\tint retry_reason;\r\n\tint num;\r\n\tvoid *ptr;\r\n\tstruct bio_st *next_bio;\t/* used by filter BIOs */\r\n\tstruct bio_st *prev_bio;\t/* used by filter BIOs */\r\n\tint references;\r\n\tunsigned long num_read;\r\n\tunsigned long num_write;\r\n\r\n\tCRYPTO_EX_DATA ex_data;\r\n\t};\r\n\r\nDECLARE_STACK_OF(BIO)\r\n\r\ntypedef struct bio_f_buffer_ctx_struct\r\n\t{\r\n\t/* Buffers are setup like this:\r\n\t *\r\n\t * <---------------------- size ----------------------->\r\n\t * +---------------------------------------------------+\r\n\t * | consumed | remaining          | free space        |\r\n\t * +---------------------------------------------------+\r\n\t * <-- off --><------- len ------->\r\n\t */\r\n\r\n\t/* BIO *bio; */ /* this is now in the BIO struct */\r\n\tint ibuf_size;\t/* how big is the input buffer */\r\n\tint obuf_size;\t/* how big is the output buffer */\r\n\r\n\tchar *ibuf;\t\t/* the char array */\r\n\tint ibuf_len;\t\t/* how many bytes are in it */\r\n\tint ibuf_off;\t\t/* write/read offset */\r\n\r\n\tchar *obuf;\t\t/* the char array */\r\n\tint obuf_len;\t\t/* how many bytes are in it */\r\n\tint obuf_off;\t\t/* write/read offset */\r\n\t} BIO_F_BUFFER_CTX;\r\n\r\n/* Prefix and suffix callback in ASN1 BIO */\r\ntypedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg);\r\n\r\n#ifndef OPENSSL_NO_SCTP\r\n/* SCTP parameter structs */\r\nstruct bio_dgram_sctp_sndinfo\r\n\t{\r\n\tuint16_t snd_sid;\r\n\tuint16_t snd_flags;\r\n\tuint32_t snd_ppid;\r\n\tuint32_t snd_context;\r\n\t};\r\n\r\nstruct bio_dgram_sctp_rcvinfo\r\n\t{\r\n\tuint16_t rcv_sid;\r\n\tuint16_t rcv_ssn;\r\n\tuint16_t rcv_flags;\r\n\tuint32_t rcv_ppid;\r\n\tuint32_t rcv_tsn;\r\n\tuint32_t rcv_cumtsn;\r\n\tuint32_t rcv_context;\r\n\t};\r\n\r\nstruct bio_dgram_sctp_prinfo\r\n\t{\r\n\tuint16_t pr_policy;\r\n\tuint32_t pr_value;\r\n\t};\r\n#endif\r\n\r\n/* connect BIO stuff */\r\n#define BIO_CONN_S_BEFORE\t\t1\r\n#define BIO_CONN_S_GET_IP\t\t2\r\n#define BIO_CONN_S_GET_PORT\t\t3\r\n#define BIO_CONN_S_CREATE_SOCKET\t4\r\n#define BIO_CONN_S_CONNECT\t\t5\r\n#define BIO_CONN_S_OK\t\t\t6\r\n#define BIO_CONN_S_BLOCKED_CONNECT\t7\r\n#define BIO_CONN_S_NBIO\t\t\t8\r\n/*#define BIO_CONN_get_param_hostname\tBIO_ctrl */\r\n\r\n#define BIO_C_SET_CONNECT\t\t\t100\r\n#define BIO_C_DO_STATE_MACHINE\t\t\t101\r\n#define BIO_C_SET_NBIO\t\t\t\t102\r\n#define BIO_C_SET_PROXY_PARAM\t\t\t103\r\n#define BIO_C_SET_FD\t\t\t\t104\r\n#define BIO_C_GET_FD\t\t\t\t105\r\n#define BIO_C_SET_FILE_PTR\t\t\t106\r\n#define BIO_C_GET_FILE_PTR\t\t\t107\r\n#define BIO_C_SET_FILENAME\t\t\t108\r\n#define BIO_C_SET_SSL\t\t\t\t109\r\n#define BIO_C_GET_SSL\t\t\t\t110\r\n#define BIO_C_SET_MD\t\t\t\t111\r\n#define BIO_C_GET_MD\t\t\t\t112\r\n#define BIO_C_GET_CIPHER_STATUS\t\t\t113\r\n#define BIO_C_SET_BUF_MEM\t\t\t114\r\n#define BIO_C_GET_BUF_MEM_PTR\t\t\t115\r\n#define BIO_C_GET_BUFF_NUM_LINES\t\t116\r\n#define BIO_C_SET_BUFF_SIZE\t\t\t117\r\n#define BIO_C_SET_ACCEPT\t\t\t118\r\n#define BIO_C_SSL_MODE\t\t\t\t119\r\n#define BIO_C_GET_MD_CTX\t\t\t120\r\n#define BIO_C_GET_PROXY_PARAM\t\t\t121\r\n#define BIO_C_SET_BUFF_READ_DATA\t\t122 /* data to read first */\r\n#define BIO_C_GET_CONNECT\t\t\t123\r\n#define BIO_C_GET_ACCEPT\t\t\t124\r\n#define BIO_C_SET_SSL_RENEGOTIATE_BYTES\t\t125\r\n#define BIO_C_GET_SSL_NUM_RENEGOTIATES\t\t126\r\n#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT\t127\r\n#define BIO_C_FILE_SEEK\t\t\t\t128\r\n#define BIO_C_GET_CIPHER_CTX\t\t\t129\r\n#define BIO_C_SET_BUF_MEM_EOF_RETURN\t\t130/*return end of input value*/\r\n#define BIO_C_SET_BIND_MODE\t\t\t131\r\n#define BIO_C_GET_BIND_MODE\t\t\t132\r\n#define BIO_C_FILE_TELL\t\t\t\t133\r\n#define BIO_C_GET_SOCKS\t\t\t\t134\r\n#define BIO_C_SET_SOCKS\t\t\t\t135\r\n\r\n#define BIO_C_SET_WRITE_BUF_SIZE\t\t136/* for BIO_s_bio */\r\n#define BIO_C_GET_WRITE_BUF_SIZE\t\t137\r\n#define BIO_C_MAKE_BIO_PAIR\t\t\t138\r\n#define BIO_C_DESTROY_BIO_PAIR\t\t\t139\r\n#define BIO_C_GET_WRITE_GUARANTEE\t\t140\r\n#define BIO_C_GET_READ_REQUEST\t\t\t141\r\n#define BIO_C_SHUTDOWN_WR\t\t\t142\r\n#define BIO_C_NREAD0\t\t\t\t143\r\n#define BIO_C_NREAD\t\t\t\t144\r\n#define BIO_C_NWRITE0\t\t\t\t145\r\n#define BIO_C_NWRITE\t\t\t\t146\r\n#define BIO_C_RESET_READ_REQUEST\t\t147\r\n#define BIO_C_SET_MD_CTX\t\t\t148\r\n\r\n#define BIO_C_SET_PREFIX\t\t\t149\r\n#define BIO_C_GET_PREFIX\t\t\t150\r\n#define BIO_C_SET_SUFFIX\t\t\t151\r\n#define BIO_C_GET_SUFFIX\t\t\t152\r\n\r\n#define BIO_C_SET_EX_ARG\t\t\t153\r\n#define BIO_C_GET_EX_ARG\t\t\t154\r\n\r\n#define BIO_set_app_data(s,arg)\t\tBIO_set_ex_data(s,0,arg)\r\n#define BIO_get_app_data(s)\t\tBIO_get_ex_data(s,0)\r\n\r\n/* BIO_s_connect() and BIO_s_socks4a_connect() */\r\n#define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)\r\n#define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)\r\n#define BIO_set_conn_ip(b,ip)\t  BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)\r\n#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)\r\n#define BIO_get_conn_hostname(b)  BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)\r\n#define BIO_get_conn_port(b)      BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)\r\n#define BIO_get_conn_ip(b) \t\t BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)\r\n#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)\r\n\r\n\r\n#define BIO_set_nbio(b,n)\tBIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)\r\n\r\n/* BIO_s_accept_socket() */\r\n#define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)\r\n#define BIO_get_accept_port(b)\tBIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)\r\n/* #define BIO_set_nbio(b,n)\tBIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */\r\n#define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)\"a\":NULL)\r\n#define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)\r\n\r\n#define BIO_BIND_NORMAL\t\t\t0\r\n#define BIO_BIND_REUSEADDR_IF_UNUSED\t1\r\n#define BIO_BIND_REUSEADDR\t\t2\r\n#define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)\r\n#define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)\r\n\r\n#define BIO_do_connect(b)\tBIO_do_handshake(b)\r\n#define BIO_do_accept(b)\tBIO_do_handshake(b)\r\n#define BIO_do_handshake(b)\tBIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)\r\n\r\n/* BIO_s_proxy_client() */\r\n#define BIO_set_url(b,url)\tBIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))\r\n#define BIO_set_proxies(b,p)\tBIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))\r\n/* BIO_set_nbio(b,n) */\r\n#define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))\r\n/* BIO *BIO_get_filter_bio(BIO *bio); */\r\n#define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)()))\r\n#define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)\r\n#define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool)\r\n\r\n#define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)\r\n#define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))\r\n#define BIO_get_url(b,url)\tBIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))\r\n#define BIO_get_no_connect_return(b)\tBIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)\r\n\r\n#define BIO_set_fd(b,fd,c)\tBIO_int_ctrl(b,BIO_C_SET_FD,c,fd)\r\n#define BIO_get_fd(b,c)\t\tBIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)\r\n\r\n#define BIO_set_fp(b,fp,c)\tBIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)\r\n#define BIO_get_fp(b,fpp)\tBIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)\r\n\r\n#define BIO_seek(b,ofs)\t(int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)\r\n#define BIO_tell(b)\t(int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)\r\n\r\n/* name is cast to lose const, but might be better to route through a function\r\n   so we can do it safely */\r\n#ifdef CONST_STRICT\r\n/* If you are wondering why this isn't defined, its because CONST_STRICT is\r\n * purely a compile-time kludge to allow const to be checked.\r\n */\r\nint BIO_read_filename(BIO *b,const char *name);\r\n#else\r\n#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\r\n\t\tBIO_CLOSE|BIO_FP_READ,(char *)name)\r\n#endif\r\n#define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\r\n\t\tBIO_CLOSE|BIO_FP_WRITE,name)\r\n#define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\r\n\t\tBIO_CLOSE|BIO_FP_APPEND,name)\r\n#define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\r\n\t\tBIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)\r\n\r\n/* WARNING WARNING, this ups the reference count on the read bio of the\r\n * SSL structure.  This is because the ssl read BIO is now pointed to by\r\n * the next_bio field in the bio.  So when you free the BIO, make sure\r\n * you are doing a BIO_free_all() to catch the underlying BIO. */\r\n#define BIO_set_ssl(b,ssl,c)\tBIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)\r\n#define BIO_get_ssl(b,sslp)\tBIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)\r\n#define BIO_set_ssl_mode(b,client)\tBIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)\r\n#define BIO_set_ssl_renegotiate_bytes(b,num) \\\r\n\tBIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);\r\n#define BIO_get_num_renegotiates(b) \\\r\n\tBIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);\r\n#define BIO_set_ssl_renegotiate_timeout(b,seconds) \\\r\n\tBIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);\r\n\r\n/* defined in evp.h */\r\n/* #define BIO_set_md(b,md)\tBIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */\r\n\r\n#define BIO_get_mem_data(b,pp)\tBIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)\r\n#define BIO_set_mem_buf(b,bm,c)\tBIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)\r\n#define BIO_get_mem_ptr(b,pp)\tBIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)\r\n#define BIO_set_mem_eof_return(b,v) \\\r\n\t\t\t\tBIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)\r\n\r\n/* For the BIO_f_buffer() type */\r\n#define BIO_get_buffer_num_lines(b)\tBIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)\r\n#define BIO_set_buffer_size(b,size)\tBIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)\r\n#define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)\r\n#define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)\r\n#define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)\r\n\r\n/* Don't use the next one unless you know what you are doing :-) */\r\n#define BIO_dup_state(b,ret)\tBIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))\r\n\r\n#define BIO_reset(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)\r\n#define BIO_eof(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)\r\n#define BIO_set_close(b,c)\t(int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)\r\n#define BIO_get_close(b)\t(int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)\r\n#define BIO_pending(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)\r\n#define BIO_wpending(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)\r\n/* ...pending macros have inappropriate return type */\r\nsize_t BIO_ctrl_pending(BIO *b);\r\nsize_t BIO_ctrl_wpending(BIO *b);\r\n#define BIO_flush(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)\r\n#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \\\r\n\t\t\t\t\t\t   cbp)\r\n#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)\r\n\r\n/* For the BIO_f_buffer() type */\r\n#define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)\r\n\r\n/* For BIO_s_bio() */\r\n#define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)\r\n#define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)\r\n#define BIO_make_bio_pair(b1,b2)   (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)\r\n#define BIO_destroy_bio_pair(b)    (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)\r\n#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)\r\n/* macros with inappropriate type -- but ...pending macros use int too: */\r\n#define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)\r\n#define BIO_get_read_request(b)    (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)\r\nsize_t BIO_ctrl_get_write_guarantee(BIO *b);\r\nsize_t BIO_ctrl_get_read_request(BIO *b);\r\nint BIO_ctrl_reset_read_request(BIO *b);\r\n\r\n/* ctrl macros for dgram */\r\n#define BIO_ctrl_dgram_connect(b,peer)  \\\r\n                     (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer)\r\n#define BIO_ctrl_set_connected(b, state, peer) \\\r\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer)\r\n#define BIO_dgram_recv_timedout(b) \\\r\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)\r\n#define BIO_dgram_send_timedout(b) \\\r\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)\r\n#define BIO_dgram_get_peer(b,peer) \\\r\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer)\r\n#define BIO_dgram_set_peer(b,peer) \\\r\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)\r\n\r\n/* These two aren't currently implemented */\r\n/* int BIO_get_ex_num(BIO *bio); */\r\n/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */\r\nint BIO_set_ex_data(BIO *bio,int idx,void *data);\r\nvoid *BIO_get_ex_data(BIO *bio,int idx);\r\nint BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nunsigned long BIO_number_read(BIO *bio);\r\nunsigned long BIO_number_written(BIO *bio);\r\n\r\n/* For BIO_f_asn1() */\r\nint BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,\r\n\t\t\t\t\tasn1_ps_func *prefix_free);\r\nint BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,\r\n\t\t\t\t\tasn1_ps_func **pprefix_free);\r\nint BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,\r\n\t\t\t\t\tasn1_ps_func *suffix_free);\r\nint BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,\r\n\t\t\t\t\tasn1_ps_func **psuffix_free);\r\n\r\n# ifndef OPENSSL_NO_FP_API\r\nBIO_METHOD *BIO_s_file(void );\r\nBIO *BIO_new_file(const char *filename, const char *mode);\r\nBIO *BIO_new_fp(FILE *stream, int close_flag);\r\n# define BIO_s_file_internal\tBIO_s_file\r\n# endif\r\nBIO *\tBIO_new(BIO_METHOD *type);\r\nint\tBIO_set(BIO *a,BIO_METHOD *type);\r\nint\tBIO_free(BIO *a);\r\nvoid\tBIO_vfree(BIO *a);\r\nint\tBIO_read(BIO *b, void *data, int len);\r\nint\tBIO_gets(BIO *bp,char *buf, int size);\r\nint\tBIO_write(BIO *b, const void *data, int len);\r\nint\tBIO_puts(BIO *bp,const char *buf);\r\nint\tBIO_indent(BIO *b,int indent,int max);\r\nlong\tBIO_ctrl(BIO *bp,int cmd,long larg,void *parg);\r\nlong BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));\r\nchar *\tBIO_ptr_ctrl(BIO *bp,int cmd,long larg);\r\nlong\tBIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);\r\nBIO *\tBIO_push(BIO *b,BIO *append);\r\nBIO *\tBIO_pop(BIO *b);\r\nvoid\tBIO_free_all(BIO *a);\r\nBIO *\tBIO_find_type(BIO *b,int bio_type);\r\nBIO *\tBIO_next(BIO *b);\r\nBIO *\tBIO_get_retry_BIO(BIO *bio, int *reason);\r\nint\tBIO_get_retry_reason(BIO *bio);\r\nBIO *\tBIO_dup_chain(BIO *in);\r\n\r\nint BIO_nread0(BIO *bio, char **buf);\r\nint BIO_nread(BIO *bio, char **buf, int num);\r\nint BIO_nwrite0(BIO *bio, char **buf);\r\nint BIO_nwrite(BIO *bio, char **buf, int num);\r\n\r\nlong BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,\r\n\tlong argl,long ret);\r\n\r\nBIO_METHOD *BIO_s_mem(void);\r\nBIO *BIO_new_mem_buf(void *buf, int len);\r\nBIO_METHOD *BIO_s_socket(void);\r\nBIO_METHOD *BIO_s_connect(void);\r\nBIO_METHOD *BIO_s_accept(void);\r\nBIO_METHOD *BIO_s_fd(void);\r\n#ifndef OPENSSL_SYS_OS2\r\nBIO_METHOD *BIO_s_log(void);\r\n#endif\r\nBIO_METHOD *BIO_s_bio(void);\r\nBIO_METHOD *BIO_s_null(void);\r\nBIO_METHOD *BIO_f_null(void);\r\nBIO_METHOD *BIO_f_buffer(void);\r\n#ifdef OPENSSL_SYS_VMS\r\nBIO_METHOD *BIO_f_linebuffer(void);\r\n#endif\r\nBIO_METHOD *BIO_f_nbio_test(void);\r\n#ifndef OPENSSL_NO_DGRAM\r\nBIO_METHOD *BIO_s_datagram(void);\r\n#ifndef OPENSSL_NO_SCTP\r\nBIO_METHOD *BIO_s_datagram_sctp(void);\r\n#endif\r\n#endif\r\n\r\n/* BIO_METHOD *BIO_f_ber(void); */\r\n\r\nint BIO_sock_should_retry(int i);\r\nint BIO_sock_non_fatal_error(int error);\r\nint BIO_dgram_non_fatal_error(int error);\r\n\r\nint BIO_fd_should_retry(int i);\r\nint BIO_fd_non_fatal_error(int error);\r\nint BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),\r\n\t\tvoid *u, const char *s, int len);\r\nint BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),\r\n\t\t       void *u, const char *s, int len, int indent);\r\nint BIO_dump(BIO *b,const char *bytes,int len);\r\nint BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);\r\n#ifndef OPENSSL_NO_FP_API\r\nint BIO_dump_fp(FILE *fp, const char *s, int len);\r\nint BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);\r\n#endif\r\nstruct hostent *BIO_gethostbyname(const char *name);\r\n/* We might want a thread-safe interface too:\r\n * struct hostent *BIO_gethostbyname_r(const char *name,\r\n *     struct hostent *result, void *buffer, size_t buflen);\r\n * or something similar (caller allocates a struct hostent,\r\n * pointed to by \"result\", and additional buffer space for the various\r\n * substructures; if the buffer does not suffice, NULL is returned\r\n * and an appropriate error code is set).\r\n */\r\nint BIO_sock_error(int sock);\r\nint BIO_socket_ioctl(int fd, long type, void *arg);\r\nint BIO_socket_nbio(int fd,int mode);\r\nint BIO_get_port(const char *str, unsigned short *port_ptr);\r\nint BIO_get_host_ip(const char *str, unsigned char *ip);\r\nint BIO_get_accept_socket(char *host_port,int mode);\r\nint BIO_accept(int sock,char **ip_port);\r\nint BIO_sock_init(void );\r\nvoid BIO_sock_cleanup(void);\r\nint BIO_set_tcp_ndelay(int sock,int turn_on);\r\n\r\nBIO *BIO_new_socket(int sock, int close_flag);\r\nBIO *BIO_new_dgram(int fd, int close_flag);\r\n#ifndef OPENSSL_NO_SCTP\r\nBIO *BIO_new_dgram_sctp(int fd, int close_flag);\r\nint BIO_dgram_is_sctp(BIO *bio);\r\nint BIO_dgram_sctp_notification_cb(BIO *b,\r\n                                   void (*handle_notifications)(BIO *bio, void *context, void *buf),\r\n                                   void *context);\r\nint BIO_dgram_sctp_wait_for_dry(BIO *b);\r\nint BIO_dgram_sctp_msg_waiting(BIO *b);\r\n#endif\r\nBIO *BIO_new_fd(int fd, int close_flag);\r\nBIO *BIO_new_connect(char *host_port);\r\nBIO *BIO_new_accept(char *host_port);\r\n\r\nint BIO_new_bio_pair(BIO **bio1, size_t writebuf1,\r\n\tBIO **bio2, size_t writebuf2);\r\n/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.\r\n * Otherwise returns 0 and sets *bio1 and *bio2 to NULL.\r\n * Size 0 uses default value.\r\n */\r\n\r\nvoid BIO_copy_next_retry(BIO *b);\r\n\r\n/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/\r\n\r\n#ifdef __GNUC__\r\n#  define __bio_h__attr__ __attribute__\r\n#else\r\n#  define __bio_h__attr__(x)\r\n#endif\r\nint BIO_printf(BIO *bio, const char *format, ...)\r\n\t__bio_h__attr__((__format__(__printf__,2,3)));\r\nint BIO_vprintf(BIO *bio, const char *format, va_list args)\r\n\t__bio_h__attr__((__format__(__printf__,2,0)));\r\nint BIO_snprintf(char *buf, size_t n, const char *format, ...)\r\n\t__bio_h__attr__((__format__(__printf__,3,4)));\r\nint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)\r\n\t__bio_h__attr__((__format__(__printf__,3,0)));\r\n#undef __bio_h__attr__\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_BIO_strings(void);\r\n\r\n/* Error codes for the BIO functions. */\r\n\r\n/* Function codes. */\r\n#define BIO_F_ACPT_STATE\t\t\t\t 100\r\n#define BIO_F_BIO_ACCEPT\t\t\t\t 101\r\n#define BIO_F_BIO_BER_GET_HEADER\t\t\t 102\r\n#define BIO_F_BIO_CALLBACK_CTRL\t\t\t\t 131\r\n#define BIO_F_BIO_CTRL\t\t\t\t\t 103\r\n#define BIO_F_BIO_GETHOSTBYNAME\t\t\t\t 120\r\n#define BIO_F_BIO_GETS\t\t\t\t\t 104\r\n#define BIO_F_BIO_GET_ACCEPT_SOCKET\t\t\t 105\r\n#define BIO_F_BIO_GET_HOST_IP\t\t\t\t 106\r\n#define BIO_F_BIO_GET_PORT\t\t\t\t 107\r\n#define BIO_F_BIO_MAKE_PAIR\t\t\t\t 121\r\n#define BIO_F_BIO_NEW\t\t\t\t\t 108\r\n#define BIO_F_BIO_NEW_FILE\t\t\t\t 109\r\n#define BIO_F_BIO_NEW_MEM_BUF\t\t\t\t 126\r\n#define BIO_F_BIO_NREAD\t\t\t\t\t 123\r\n#define BIO_F_BIO_NREAD0\t\t\t\t 124\r\n#define BIO_F_BIO_NWRITE\t\t\t\t 125\r\n#define BIO_F_BIO_NWRITE0\t\t\t\t 122\r\n#define BIO_F_BIO_PUTS\t\t\t\t\t 110\r\n#define BIO_F_BIO_READ\t\t\t\t\t 111\r\n#define BIO_F_BIO_SOCK_INIT\t\t\t\t 112\r\n#define BIO_F_BIO_WRITE\t\t\t\t\t 113\r\n#define BIO_F_BUFFER_CTRL\t\t\t\t 114\r\n#define BIO_F_CONN_CTRL\t\t\t\t\t 127\r\n#define BIO_F_CONN_STATE\t\t\t\t 115\r\n#define BIO_F_DGRAM_SCTP_READ\t\t\t\t 132\r\n#define BIO_F_FILE_CTRL\t\t\t\t\t 116\r\n#define BIO_F_FILE_READ\t\t\t\t\t 130\r\n#define BIO_F_LINEBUFFER_CTRL\t\t\t\t 129\r\n#define BIO_F_MEM_READ\t\t\t\t\t 128\r\n#define BIO_F_MEM_WRITE\t\t\t\t\t 117\r\n#define BIO_F_SSL_NEW\t\t\t\t\t 118\r\n#define BIO_F_WSASTARTUP\t\t\t\t 119\r\n\r\n/* Reason codes. */\r\n#define BIO_R_ACCEPT_ERROR\t\t\t\t 100\r\n#define BIO_R_BAD_FOPEN_MODE\t\t\t\t 101\r\n#define BIO_R_BAD_HOSTNAME_LOOKUP\t\t\t 102\r\n#define BIO_R_BROKEN_PIPE\t\t\t\t 124\r\n#define BIO_R_CONNECT_ERROR\t\t\t\t 103\r\n#define BIO_R_EOF_ON_MEMORY_BIO\t\t\t\t 127\r\n#define BIO_R_ERROR_SETTING_NBIO\t\t\t 104\r\n#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET\t 105\r\n#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET\t 106\r\n#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET\t\t 107\r\n#define BIO_R_INVALID_ARGUMENT\t\t\t\t 125\r\n#define BIO_R_INVALID_IP_ADDRESS\t\t\t 108\r\n#define BIO_R_IN_USE\t\t\t\t\t 123\r\n#define BIO_R_KEEPALIVE\t\t\t\t\t 109\r\n#define BIO_R_NBIO_CONNECT_ERROR\t\t\t 110\r\n#define BIO_R_NO_ACCEPT_PORT_SPECIFIED\t\t\t 111\r\n#define BIO_R_NO_HOSTNAME_SPECIFIED\t\t\t 112\r\n#define BIO_R_NO_PORT_DEFINED\t\t\t\t 113\r\n#define BIO_R_NO_PORT_SPECIFIED\t\t\t\t 114\r\n#define BIO_R_NO_SUCH_FILE\t\t\t\t 128\r\n#define BIO_R_NULL_PARAMETER\t\t\t\t 115\r\n#define BIO_R_TAG_MISMATCH\t\t\t\t 116\r\n#define BIO_R_UNABLE_TO_BIND_SOCKET\t\t\t 117\r\n#define BIO_R_UNABLE_TO_CREATE_SOCKET\t\t\t 118\r\n#define BIO_R_UNABLE_TO_LISTEN_SOCKET\t\t\t 119\r\n#define BIO_R_UNINITIALIZED\t\t\t\t 120\r\n#define BIO_R_UNSUPPORTED_METHOD\t\t\t 121\r\n#define BIO_R_WRITE_TO_READ_ONLY_BIO\t\t\t 126\r\n#define BIO_R_WSASTARTUP\t\t\t\t 122\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/blowfish.h",
    "content": "/* crypto/bf/blowfish.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_BLOWFISH_H\r\n#define HEADER_BLOWFISH_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_NO_BF\r\n#error BF is disabled.\r\n#endif\r\n\r\n#define BF_ENCRYPT\t1\r\n#define BF_DECRYPT\t0\r\n\r\n/*\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n * ! BF_LONG has to be at least 32 bits wide. If it's wider, then !\r\n * ! BF_LONG_LOG2 has to be defined along.                        !\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n */\r\n\r\n#if defined(__LP32__)\r\n#define BF_LONG unsigned long\r\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\r\n#define BF_LONG unsigned long\r\n#define BF_LONG_LOG2 3\r\n/*\r\n * _CRAY note. I could declare short, but I have no idea what impact\r\n * does it have on performance on none-T3E machines. I could declare\r\n * int, but at least on C90 sizeof(int) can be chosen at compile time.\r\n * So I've chosen long...\r\n *\t\t\t\t\t<appro@fy.chalmers.se>\r\n */\r\n#else\r\n#define BF_LONG unsigned int\r\n#endif\r\n\r\n#define BF_ROUNDS\t16\r\n#define BF_BLOCK\t8\r\n\r\ntypedef struct bf_key_st\r\n\t{\r\n\tBF_LONG P[BF_ROUNDS+2];\r\n\tBF_LONG S[4*256];\r\n\t} BF_KEY;\r\n\r\n#ifdef OPENSSL_FIPS \r\nvoid private_BF_set_key(BF_KEY *key, int len, const unsigned char *data);\r\n#endif\r\nvoid BF_set_key(BF_KEY *key, int len, const unsigned char *data);\r\n\r\nvoid BF_encrypt(BF_LONG *data,const BF_KEY *key);\r\nvoid BF_decrypt(BF_LONG *data,const BF_KEY *key);\r\n\r\nvoid BF_ecb_encrypt(const unsigned char *in, unsigned char *out,\r\n\tconst BF_KEY *key, int enc);\r\nvoid BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,\r\n\tconst BF_KEY *schedule, unsigned char *ivec, int enc);\r\nvoid BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,\r\n\tconst BF_KEY *schedule, unsigned char *ivec, int *num, int enc);\r\nvoid BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,\r\n\tconst BF_KEY *schedule, unsigned char *ivec, int *num);\r\nconst char *BF_options(void);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/bn.h",
    "content": "/* crypto/bn/bn.h */\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n *\r\n * Portions of the attached software (\"Contribution\") are developed by \r\n * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.\r\n *\r\n * The Contribution is licensed pursuant to the Eric Young open source\r\n * license provided above.\r\n *\r\n * The binary polynomial arithmetic software is originally written by \r\n * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.\r\n *\r\n */\r\n\r\n#ifndef HEADER_BN_H\r\n#define HEADER_BN_H\r\n\r\n#include <openssl/e_os2.h>\r\n#ifndef OPENSSL_NO_FP_API\r\n#include <stdio.h> /* FILE */\r\n#endif\r\n#include <openssl/ossl_typ.h>\r\n#include <openssl/crypto.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* These preprocessor symbols control various aspects of the bignum headers and\r\n * library code. They're not defined by any \"normal\" configuration, as they are\r\n * intended for development and testing purposes. NB: defining all three can be\r\n * useful for debugging application code as well as openssl itself.\r\n *\r\n * BN_DEBUG - turn on various debugging alterations to the bignum code\r\n * BN_DEBUG_RAND - uses random poisoning of unused words to trip up\r\n * mismanagement of bignum internals. You must also define BN_DEBUG.\r\n */\r\n/* #define BN_DEBUG */\r\n/* #define BN_DEBUG_RAND */\r\n\r\n#ifndef OPENSSL_SMALL_FOOTPRINT\r\n#define BN_MUL_COMBA\r\n#define BN_SQR_COMBA\r\n#define BN_RECURSION\r\n#endif\r\n\r\n/* This next option uses the C libraries (2 word)/(1 word) function.\r\n * If it is not defined, I use my C version (which is slower).\r\n * The reason for this flag is that when the particular C compiler\r\n * library routine is used, and the library is linked with a different\r\n * compiler, the library is missing.  This mostly happens when the\r\n * library is built with gcc and then linked using normal cc.  This would\r\n * be a common occurrence because gcc normally produces code that is\r\n * 2 times faster than system compilers for the big number stuff.\r\n * For machines with only one compiler (or shared libraries), this should\r\n * be on.  Again this in only really a problem on machines\r\n * using \"long long's\", are 32bit, and are not using my assembler code. */\r\n#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \\\r\n    defined(OPENSSL_SYS_WIN32) || defined(linux)\r\n# ifndef BN_DIV2W\r\n#  define BN_DIV2W\r\n# endif\r\n#endif\r\n\r\n/* assuming long is 64bit - this is the DEC Alpha\r\n * unsigned long long is only 64 bits :-(, don't define\r\n * BN_LLONG for the DEC Alpha */\r\n#ifdef SIXTY_FOUR_BIT_LONG\r\n#define BN_ULLONG\tunsigned long long\r\n#define BN_ULONG\tunsigned long\r\n#define BN_LONG\t\tlong\r\n#define BN_BITS\t\t128\r\n#define BN_BYTES\t8\r\n#define BN_BITS2\t64\r\n#define BN_BITS4\t32\r\n#define BN_MASK\t\t(0xffffffffffffffffffffffffffffffffLL)\r\n#define BN_MASK2\t(0xffffffffffffffffL)\r\n#define BN_MASK2l\t(0xffffffffL)\r\n#define BN_MASK2h\t(0xffffffff00000000L)\r\n#define BN_MASK2h1\t(0xffffffff80000000L)\r\n#define BN_TBIT\t\t(0x8000000000000000L)\r\n#define BN_DEC_CONV\t(10000000000000000000UL)\r\n#define BN_DEC_FMT1\t\"%lu\"\r\n#define BN_DEC_FMT2\t\"%019lu\"\r\n#define BN_DEC_NUM\t19\r\n#define BN_HEX_FMT1\t\"%lX\"\r\n#define BN_HEX_FMT2\t\"%016lX\"\r\n#endif\r\n\r\n/* This is where the long long data type is 64 bits, but long is 32.\r\n * For machines where there are 64bit registers, this is the mode to use.\r\n * IRIX, on R4000 and above should use this mode, along with the relevant\r\n * assembler code :-).  Do NOT define BN_LLONG.\r\n */\r\n#ifdef SIXTY_FOUR_BIT\r\n#undef BN_LLONG\r\n#undef BN_ULLONG\r\n#define BN_ULONG\tunsigned long long\r\n#define BN_LONG\t\tlong long\r\n#define BN_BITS\t\t128\r\n#define BN_BYTES\t8\r\n#define BN_BITS2\t64\r\n#define BN_BITS4\t32\r\n#define BN_MASK2\t(0xffffffffffffffffLL)\r\n#define BN_MASK2l\t(0xffffffffL)\r\n#define BN_MASK2h\t(0xffffffff00000000LL)\r\n#define BN_MASK2h1\t(0xffffffff80000000LL)\r\n#define BN_TBIT\t\t(0x8000000000000000LL)\r\n#define BN_DEC_CONV\t(10000000000000000000ULL)\r\n#define BN_DEC_FMT1\t\"%llu\"\r\n#define BN_DEC_FMT2\t\"%019llu\"\r\n#define BN_DEC_NUM\t19\r\n#define BN_HEX_FMT1\t\"%llX\"\r\n#define BN_HEX_FMT2\t\"%016llX\"\r\n#endif\r\n\r\n#ifdef THIRTY_TWO_BIT\r\n#ifdef BN_LLONG\r\n# if defined(_WIN32) && !defined(__GNUC__)\r\n#  define BN_ULLONG\tunsigned __int64\r\n#  define BN_MASK\t(0xffffffffffffffffI64)\r\n# else\r\n#  define BN_ULLONG\tunsigned long long\r\n#  define BN_MASK\t(0xffffffffffffffffLL)\r\n# endif\r\n#endif\r\n#define BN_ULONG\tunsigned int\r\n#define BN_LONG\t\tint\r\n#define BN_BITS\t\t64\r\n#define BN_BYTES\t4\r\n#define BN_BITS2\t32\r\n#define BN_BITS4\t16\r\n#define BN_MASK2\t(0xffffffffL)\r\n#define BN_MASK2l\t(0xffff)\r\n#define BN_MASK2h1\t(0xffff8000L)\r\n#define BN_MASK2h\t(0xffff0000L)\r\n#define BN_TBIT\t\t(0x80000000L)\r\n#define BN_DEC_CONV\t(1000000000L)\r\n#define BN_DEC_FMT1\t\"%u\"\r\n#define BN_DEC_FMT2\t\"%09u\"\r\n#define BN_DEC_NUM\t9\r\n#define BN_HEX_FMT1\t\"%X\"\r\n#define BN_HEX_FMT2\t\"%08X\"\r\n#endif\r\n\r\n/* 2011-02-22 SMS.\r\n * In various places, a size_t variable or a type cast to size_t was\r\n * used to perform integer-only operations on pointers.  This failed on\r\n * VMS with 64-bit pointers (CC /POINTER_SIZE = 64) because size_t is\r\n * still only 32 bits.  What's needed in these cases is an integer type\r\n * with the same size as a pointer, which size_t is not certain to be. \r\n * The only fix here is VMS-specific.\r\n */\r\n#if defined(OPENSSL_SYS_VMS)\r\n# if __INITIAL_POINTER_SIZE == 64\r\n#  define PTR_SIZE_INT long long\r\n# else /* __INITIAL_POINTER_SIZE == 64 */\r\n#  define PTR_SIZE_INT int\r\n# endif /* __INITIAL_POINTER_SIZE == 64 [else] */\r\n#else /* defined(OPENSSL_SYS_VMS) */\r\n# define PTR_SIZE_INT size_t\r\n#endif /* defined(OPENSSL_SYS_VMS) [else] */\r\n\r\n#define BN_DEFAULT_BITS\t1280\r\n\r\n#define BN_FLG_MALLOCED\t\t0x01\r\n#define BN_FLG_STATIC_DATA\t0x02\r\n#define BN_FLG_CONSTTIME\t0x04 /* avoid leaking exponent information through timing,\r\n                                      * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,\r\n                                      * BN_div() will call BN_div_no_branch,\r\n                                      * BN_mod_inverse() will call BN_mod_inverse_no_branch.\r\n                                      */\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME /* deprecated name for the flag */\r\n                                      /* avoid leaking exponent information through timings\r\n                                      * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#define BN_FLG_FREE\t\t0x8000\t/* used for debuging */\r\n#endif\r\n#define BN_set_flags(b,n)\t((b)->flags|=(n))\r\n#define BN_get_flags(b,n)\t((b)->flags&(n))\r\n\r\n/* get a clone of a BIGNUM with changed flags, for *temporary* use only\r\n * (the two BIGNUMs cannot not be used in parallel!) */\r\n#define BN_with_flags(dest,b,n)  ((dest)->d=(b)->d, \\\r\n                                  (dest)->top=(b)->top, \\\r\n                                  (dest)->dmax=(b)->dmax, \\\r\n                                  (dest)->neg=(b)->neg, \\\r\n                                  (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \\\r\n                                                 |  ((b)->flags & ~BN_FLG_MALLOCED) \\\r\n                                                 |  BN_FLG_STATIC_DATA \\\r\n                                                 |  (n)))\r\n\r\n/* Already declared in ossl_typ.h */\r\n#if 0\r\ntypedef struct bignum_st BIGNUM;\r\n/* Used for temp variables (declaration hidden in bn_lcl.h) */\r\ntypedef struct bignum_ctx BN_CTX;\r\ntypedef struct bn_blinding_st BN_BLINDING;\r\ntypedef struct bn_mont_ctx_st BN_MONT_CTX;\r\ntypedef struct bn_recp_ctx_st BN_RECP_CTX;\r\ntypedef struct bn_gencb_st BN_GENCB;\r\n#endif\r\n\r\nstruct bignum_st\r\n\t{\r\n\tBN_ULONG *d;\t/* Pointer to an array of 'BN_BITS2' bit chunks. */\r\n\tint top;\t/* Index of last used d +1. */\r\n\t/* The next are internal book keeping for bn_expand. */\r\n\tint dmax;\t/* Size of the d array. */\r\n\tint neg;\t/* one if the number is negative */\r\n\tint flags;\r\n\t};\r\n\r\n/* Used for montgomery multiplication */\r\nstruct bn_mont_ctx_st\r\n\t{\r\n\tint ri;        /* number of bits in R */\r\n\tBIGNUM RR;     /* used to convert to montgomery form */\r\n\tBIGNUM N;      /* The modulus */\r\n\tBIGNUM Ni;     /* R*(1/R mod N) - N*Ni = 1\r\n\t                * (Ni is only stored for bignum algorithm) */\r\n\tBN_ULONG n0[2];/* least significant word(s) of Ni;\r\n\t                  (type changed with 0.9.9, was \"BN_ULONG n0;\" before) */\r\n\tint flags;\r\n\t};\r\n\r\n/* Used for reciprocal division/mod functions\r\n * It cannot be shared between threads\r\n */\r\nstruct bn_recp_ctx_st\r\n\t{\r\n\tBIGNUM N;\t/* the divisor */\r\n\tBIGNUM Nr;\t/* the reciprocal */\r\n\tint num_bits;\r\n\tint shift;\r\n\tint flags;\r\n\t};\r\n\r\n/* Used for slow \"generation\" functions. */\r\nstruct bn_gencb_st\r\n\t{\r\n\tunsigned int ver;\t/* To handle binary (in)compatibility */\r\n\tvoid *arg;\t\t/* callback-specific data */\r\n\tunion\r\n\t\t{\r\n\t\t/* if(ver==1) - handles old style callbacks */\r\n\t\tvoid (*cb_1)(int, int, void *);\r\n\t\t/* if(ver==2) - new callback style */\r\n\t\tint (*cb_2)(int, int, BN_GENCB *);\r\n\t\t} cb;\r\n\t};\r\n/* Wrapper function to make using BN_GENCB easier,  */\r\nint BN_GENCB_call(BN_GENCB *cb, int a, int b);\r\n/* Macro to populate a BN_GENCB structure with an \"old\"-style callback */\r\n#define BN_GENCB_set_old(gencb, callback, cb_arg) { \\\r\n\t\tBN_GENCB *tmp_gencb = (gencb); \\\r\n\t\ttmp_gencb->ver = 1; \\\r\n\t\ttmp_gencb->arg = (cb_arg); \\\r\n\t\ttmp_gencb->cb.cb_1 = (callback); }\r\n/* Macro to populate a BN_GENCB structure with a \"new\"-style callback */\r\n#define BN_GENCB_set(gencb, callback, cb_arg) { \\\r\n\t\tBN_GENCB *tmp_gencb = (gencb); \\\r\n\t\ttmp_gencb->ver = 2; \\\r\n\t\ttmp_gencb->arg = (cb_arg); \\\r\n\t\ttmp_gencb->cb.cb_2 = (callback); }\r\n\r\n#define BN_prime_checks 0 /* default: select number of iterations\r\n\t\t\t     based on the size of the number */\r\n\r\n/* number of Miller-Rabin iterations for an error rate  of less than 2^-80\r\n * for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook\r\n * of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996];\r\n * original paper: Damgaard, Landrock, Pomerance: Average case error estimates\r\n * for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */\r\n#define BN_prime_checks_for_size(b) ((b) >= 1300 ?  2 : \\\r\n                                (b) >=  850 ?  3 : \\\r\n                                (b) >=  650 ?  4 : \\\r\n                                (b) >=  550 ?  5 : \\\r\n                                (b) >=  450 ?  6 : \\\r\n                                (b) >=  400 ?  7 : \\\r\n                                (b) >=  350 ?  8 : \\\r\n                                (b) >=  300 ?  9 : \\\r\n                                (b) >=  250 ? 12 : \\\r\n                                (b) >=  200 ? 15 : \\\r\n                                (b) >=  150 ? 18 : \\\r\n                                /* b >= 100 */ 27)\r\n\r\n#define BN_num_bytes(a)\t((BN_num_bits(a)+7)/8)\r\n\r\n/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */\r\n#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \\\r\n\t\t\t\t(((w) == 0) && ((a)->top == 0)))\r\n#define BN_is_zero(a)       ((a)->top == 0)\r\n#define BN_is_one(a)        (BN_abs_is_word((a),1) && !(a)->neg)\r\n#define BN_is_word(a,w)     (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))\r\n#define BN_is_odd(a)\t    (((a)->top > 0) && ((a)->d[0] & 1))\r\n\r\n#define BN_one(a)\t(BN_set_word((a),1))\r\n#define BN_zero_ex(a) \\\r\n\tdo { \\\r\n\t\tBIGNUM *_tmp_bn = (a); \\\r\n\t\t_tmp_bn->top = 0; \\\r\n\t\t_tmp_bn->neg = 0; \\\r\n\t} while(0)\r\n#ifdef OPENSSL_NO_DEPRECATED\r\n#define BN_zero(a)\tBN_zero_ex(a)\r\n#else\r\n#define BN_zero(a)\t(BN_set_word((a),0))\r\n#endif\r\n\r\nconst BIGNUM *BN_value_one(void);\r\nchar *\tBN_options(void);\r\nBN_CTX *BN_CTX_new(void);\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nvoid\tBN_CTX_init(BN_CTX *c);\r\n#endif\r\nvoid\tBN_CTX_free(BN_CTX *c);\r\nvoid\tBN_CTX_start(BN_CTX *ctx);\r\nBIGNUM *BN_CTX_get(BN_CTX *ctx);\r\nvoid\tBN_CTX_end(BN_CTX *ctx);\r\nint     BN_rand(BIGNUM *rnd, int bits, int top,int bottom);\r\nint     BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);\r\nint\tBN_rand_range(BIGNUM *rnd, const BIGNUM *range);\r\nint\tBN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);\r\nint\tBN_num_bits(const BIGNUM *a);\r\nint\tBN_num_bits_word(BN_ULONG);\r\nBIGNUM *BN_new(void);\r\nvoid\tBN_init(BIGNUM *);\r\nvoid\tBN_clear_free(BIGNUM *a);\r\nBIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);\r\nvoid\tBN_swap(BIGNUM *a, BIGNUM *b);\r\nBIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);\r\nint\tBN_bn2bin(const BIGNUM *a, unsigned char *to);\r\nBIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);\r\nint\tBN_bn2mpi(const BIGNUM *a, unsigned char *to);\r\nint\tBN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\r\nint\tBN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\r\nint\tBN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\r\nint\tBN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\r\nint\tBN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\r\nint\tBN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);\r\n/** BN_set_negative sets sign of a BIGNUM\r\n * \\param  b  pointer to the BIGNUM object\r\n * \\param  n  0 if the BIGNUM b should be positive and a value != 0 otherwise \r\n */\r\nvoid\tBN_set_negative(BIGNUM *b, int n);\r\n/** BN_is_negative returns 1 if the BIGNUM is negative\r\n * \\param  a  pointer to the BIGNUM object\r\n * \\return 1 if a < 0 and 0 otherwise\r\n */\r\n#define BN_is_negative(a) ((a)->neg != 0)\r\n\r\nint\tBN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,\r\n\tBN_CTX *ctx);\r\n#define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))\r\nint\tBN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);\r\nint\tBN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);\r\nint\tBN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);\r\nint\tBN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);\r\nint\tBN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);\r\n\r\nBN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);\r\nBN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);\r\nint\tBN_mul_word(BIGNUM *a, BN_ULONG w);\r\nint\tBN_add_word(BIGNUM *a, BN_ULONG w);\r\nint\tBN_sub_word(BIGNUM *a, BN_ULONG w);\r\nint\tBN_set_word(BIGNUM *a, BN_ULONG w);\r\nBN_ULONG BN_get_word(const BIGNUM *a);\r\n\r\nint\tBN_cmp(const BIGNUM *a, const BIGNUM *b);\r\nvoid\tBN_free(BIGNUM *a);\r\nint\tBN_is_bit_set(const BIGNUM *a, int n);\r\nint\tBN_lshift(BIGNUM *r, const BIGNUM *a, int n);\r\nint\tBN_lshift1(BIGNUM *r, const BIGNUM *a);\r\nint\tBN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx);\r\n\r\nint\tBN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tconst BIGNUM *m,BN_CTX *ctx);\r\nint\tBN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\r\nint BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\r\n\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);\r\nint\tBN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,\r\n\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\r\nint\tBN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,\r\n\tconst BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m,\r\n\tBN_CTX *ctx,BN_MONT_CTX *m_ctx);\r\nint\tBN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tconst BIGNUM *m,BN_CTX *ctx);\r\n\r\nint\tBN_mask_bits(BIGNUM *a,int n);\r\n#ifndef OPENSSL_NO_FP_API\r\nint\tBN_print_fp(FILE *fp, const BIGNUM *a);\r\n#endif\r\n#ifdef HEADER_BIO_H\r\nint\tBN_print(BIO *fp, const BIGNUM *a);\r\n#else\r\nint\tBN_print(void *fp, const BIGNUM *a);\r\n#endif\r\nint\tBN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);\r\nint\tBN_rshift(BIGNUM *r, const BIGNUM *a, int n);\r\nint\tBN_rshift1(BIGNUM *r, const BIGNUM *a);\r\nvoid\tBN_clear(BIGNUM *a);\r\nBIGNUM *BN_dup(const BIGNUM *a);\r\nint\tBN_ucmp(const BIGNUM *a, const BIGNUM *b);\r\nint\tBN_set_bit(BIGNUM *a, int n);\r\nint\tBN_clear_bit(BIGNUM *a, int n);\r\nchar *\tBN_bn2hex(const BIGNUM *a);\r\nchar *\tBN_bn2dec(const BIGNUM *a);\r\nint \tBN_hex2bn(BIGNUM **a, const char *str);\r\nint \tBN_dec2bn(BIGNUM **a, const char *str);\r\nint\tBN_asc2bn(BIGNUM **a, const char *str);\r\nint\tBN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);\r\nint\tBN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */\r\nBIGNUM *BN_mod_inverse(BIGNUM *ret,\r\n\tconst BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);\r\nBIGNUM *BN_mod_sqrt(BIGNUM *ret,\r\n\tconst BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);\r\n\r\n/* Deprecated versions */\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nBIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,\r\n\tconst BIGNUM *add, const BIGNUM *rem,\r\n\tvoid (*callback)(int,int,void *),void *cb_arg);\r\nint\tBN_is_prime(const BIGNUM *p,int nchecks,\r\n\tvoid (*callback)(int,int,void *),\r\n\tBN_CTX *ctx,void *cb_arg);\r\nint\tBN_is_prime_fasttest(const BIGNUM *p,int nchecks,\r\n\tvoid (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,\r\n\tint do_trial_division);\r\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\r\n\r\n/* Newer versions */\r\nint\tBN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,\r\n\t\tconst BIGNUM *rem, BN_GENCB *cb);\r\nint\tBN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);\r\nint\tBN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,\r\n\t\tint do_trial_division, BN_GENCB *cb);\r\n\r\nint BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);\r\n\r\nint BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,\r\n\t\t\tconst BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2,\r\n\t\t\tconst BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);\r\nint BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,\r\n\t\t\tBIGNUM *Xp1, BIGNUM *Xp2,\r\n\t\t\tconst BIGNUM *Xp,\r\n\t\t\tconst BIGNUM *e, BN_CTX *ctx,\r\n\t\t\tBN_GENCB *cb);\r\n\r\nBN_MONT_CTX *BN_MONT_CTX_new(void );\r\nvoid BN_MONT_CTX_init(BN_MONT_CTX *ctx);\r\nint BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,\r\n\tBN_MONT_CTX *mont, BN_CTX *ctx);\r\n#define BN_to_montgomery(r,a,mont,ctx)\tBN_mod_mul_montgomery(\\\r\n\t(r),(a),&((mont)->RR),(mont),(ctx))\r\nint BN_from_montgomery(BIGNUM *r,const BIGNUM *a,\r\n\tBN_MONT_CTX *mont, BN_CTX *ctx);\r\nvoid BN_MONT_CTX_free(BN_MONT_CTX *mont);\r\nint BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);\r\nBN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from);\r\nBN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,\r\n\t\t\t\t\tconst BIGNUM *mod, BN_CTX *ctx);\r\n\r\n/* BN_BLINDING flags */\r\n#define\tBN_BLINDING_NO_UPDATE\t0x00000001\r\n#define\tBN_BLINDING_NO_RECREATE\t0x00000002\r\n\r\nBN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);\r\nvoid BN_BLINDING_free(BN_BLINDING *b);\r\nint BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);\r\nint BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\r\nint BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\r\nint BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);\r\nint BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nunsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);\r\nvoid BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);\r\n#endif\r\nCRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);\r\nunsigned long BN_BLINDING_get_flags(const BN_BLINDING *);\r\nvoid BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);\r\nBN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,\r\n\tconst BIGNUM *e, BIGNUM *m, BN_CTX *ctx,\r\n\tint (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\t\t\t  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),\r\n\tBN_MONT_CTX *m_ctx);\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nvoid BN_set_params(int mul,int high,int low,int mont);\r\nint BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */\r\n#endif\r\n\r\nvoid\tBN_RECP_CTX_init(BN_RECP_CTX *recp);\r\nBN_RECP_CTX *BN_RECP_CTX_new(void);\r\nvoid\tBN_RECP_CTX_free(BN_RECP_CTX *recp);\r\nint\tBN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx);\r\nint\tBN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,\r\n\tBN_RECP_CTX *recp,BN_CTX *ctx);\r\nint\tBN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tconst BIGNUM *m, BN_CTX *ctx);\r\nint\tBN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,\r\n\tBN_RECP_CTX *recp, BN_CTX *ctx);\r\n\r\n#ifndef OPENSSL_NO_EC2M\r\n\r\n/* Functions for arithmetic over binary polynomials represented by BIGNUMs. \r\n *\r\n * The BIGNUM::neg property of BIGNUMs representing binary polynomials is\r\n * ignored.\r\n *\r\n * Note that input arguments are not const so that their bit arrays can\r\n * be expanded to the appropriate size if needed.\r\n */\r\n\r\nint\tBN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/\r\n#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)\r\nint\tBN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/\r\nint\tBN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */\r\nint\tBN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tBN_CTX *ctx); /* r = (a * a) mod p */\r\nint\tBN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,\r\n\tBN_CTX *ctx); /* r = (1 / b) mod p */\r\nint\tBN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */\r\nint\tBN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */\r\nint\tBN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tBN_CTX *ctx); /* r = sqrt(a) mod p */\r\nint\tBN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\tBN_CTX *ctx); /* r^2 + r = a mod p */\r\n#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))\r\n/* Some functions allow for representation of the irreducible polynomials\r\n * as an unsigned int[], say p.  The irreducible f(t) is then of the form:\r\n *     t^p[0] + t^p[1] + ... + t^p[k]\r\n * where m = p[0] > p[1] > ... > p[k] = 0.\r\n */\r\nint\tBN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);\r\n\t/* r = a mod p */\r\nint\tBN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst int p[], BN_CTX *ctx); /* r = (a * b) mod p */\r\nint\tBN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],\r\n\tBN_CTX *ctx); /* r = (a * a) mod p */\r\nint\tBN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],\r\n\tBN_CTX *ctx); /* r = (1 / b) mod p */\r\nint\tBN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst int p[], BN_CTX *ctx); /* r = (a / b) mod p */\r\nint\tBN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\r\n\tconst int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */\r\nint\tBN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,\r\n\tconst int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */\r\nint\tBN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,\r\n\tconst int p[], BN_CTX *ctx); /* r^2 + r = a mod p */\r\nint\tBN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);\r\nint\tBN_GF2m_arr2poly(const int p[], BIGNUM *a);\r\n\r\n#endif\r\n\r\n/* faster mod functions for the 'NIST primes' \r\n * 0 <= a < p^2 */\r\nint BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\r\nint BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\r\nint BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\r\nint BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\r\nint BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\r\n\r\nconst BIGNUM *BN_get0_nist_prime_192(void);\r\nconst BIGNUM *BN_get0_nist_prime_224(void);\r\nconst BIGNUM *BN_get0_nist_prime_256(void);\r\nconst BIGNUM *BN_get0_nist_prime_384(void);\r\nconst BIGNUM *BN_get0_nist_prime_521(void);\r\n\r\n/* library internal functions */\r\n\r\n#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\\\r\n\t(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))\r\n#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))\r\nBIGNUM *bn_expand2(BIGNUM *a, int words);\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nBIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */\r\n#endif\r\n\r\n/* Bignum consistency macros\r\n * There is one \"API\" macro, bn_fix_top(), for stripping leading zeroes from\r\n * bignum data after direct manipulations on the data. There is also an\r\n * \"internal\" macro, bn_check_top(), for verifying that there are no leading\r\n * zeroes. Unfortunately, some auditing is required due to the fact that\r\n * bn_fix_top() has become an overabused duct-tape because bignum data is\r\n * occasionally passed around in an inconsistent state. So the following\r\n * changes have been made to sort this out;\r\n * - bn_fix_top()s implementation has been moved to bn_correct_top()\r\n * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and\r\n *   bn_check_top() is as before.\r\n * - if BN_DEBUG *is* defined;\r\n *   - bn_check_top() tries to pollute unused words even if the bignum 'top' is\r\n *     consistent. (ed: only if BN_DEBUG_RAND is defined)\r\n *   - bn_fix_top() maps to bn_check_top() rather than \"fixing\" anything.\r\n * The idea is to have debug builds flag up inconsistent bignums when they\r\n * occur. If that occurs in a bn_fix_top(), we examine the code in question; if\r\n * the use of bn_fix_top() was appropriate (ie. it follows directly after code\r\n * that manipulates the bignum) it is converted to bn_correct_top(), and if it\r\n * was not appropriate, we convert it permanently to bn_check_top() and track\r\n * down the cause of the bug. Eventually, no internal code should be using the\r\n * bn_fix_top() macro. External applications and libraries should try this with\r\n * their own code too, both in terms of building against the openssl headers\r\n * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it\r\n * defined. This not only improves external code, it provides more test\r\n * coverage for openssl's own code.\r\n */\r\n\r\n#ifdef BN_DEBUG\r\n\r\n/* We only need assert() when debugging */\r\n#include <assert.h>\r\n\r\n#ifdef BN_DEBUG_RAND\r\n/* To avoid \"make update\" cvs wars due to BN_DEBUG, use some tricks */\r\n#ifndef RAND_pseudo_bytes\r\nint RAND_pseudo_bytes(unsigned char *buf,int num);\r\n#define BN_DEBUG_TRIX\r\n#endif\r\n#define bn_pollute(a) \\\r\n\tdo { \\\r\n\t\tconst BIGNUM *_bnum1 = (a); \\\r\n\t\tif(_bnum1->top < _bnum1->dmax) { \\\r\n\t\t\tunsigned char _tmp_char; \\\r\n\t\t\t/* We cast away const without the compiler knowing, any \\\r\n\t\t\t * *genuinely* constant variables that aren't mutable \\\r\n\t\t\t * wouldn't be constructed with top!=dmax. */ \\\r\n\t\t\tBN_ULONG *_not_const; \\\r\n\t\t\tmemcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \\\r\n\t\t\tRAND_pseudo_bytes(&_tmp_char, 1); \\\r\n\t\t\tmemset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \\\r\n\t\t\t\t(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \\\r\n\t\t} \\\r\n\t} while(0)\r\n#ifdef BN_DEBUG_TRIX\r\n#undef RAND_pseudo_bytes\r\n#endif\r\n#else\r\n#define bn_pollute(a)\r\n#endif\r\n#define bn_check_top(a) \\\r\n\tdo { \\\r\n\t\tconst BIGNUM *_bnum2 = (a); \\\r\n\t\tif (_bnum2 != NULL) { \\\r\n\t\t\tassert((_bnum2->top == 0) || \\\r\n\t\t\t\t(_bnum2->d[_bnum2->top - 1] != 0)); \\\r\n\t\t\tbn_pollute(_bnum2); \\\r\n\t\t} \\\r\n\t} while(0)\r\n\r\n#define bn_fix_top(a)\t\tbn_check_top(a)\r\n\r\n#else /* !BN_DEBUG */\r\n\r\n#define bn_pollute(a)\r\n#define bn_check_top(a)\r\n#define bn_fix_top(a)\t\tbn_correct_top(a)\r\n\r\n#endif\r\n\r\n#define bn_correct_top(a) \\\r\n        { \\\r\n        BN_ULONG *ftl; \\\r\n\tint tmp_top = (a)->top; \\\r\n\tif (tmp_top > 0) \\\r\n\t\t{ \\\r\n\t\tfor (ftl= &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \\\r\n\t\t\tif (*(ftl--)) break; \\\r\n\t\t(a)->top = tmp_top; \\\r\n\t\t} \\\r\n\tbn_pollute(a); \\\r\n\t}\r\n\r\nBN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);\r\nBN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);\r\nvoid     bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);\r\nBN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);\r\nBN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);\r\nBN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);\r\n\r\n/* Primes from RFC 2409 */\r\nBIGNUM *get_rfc2409_prime_768(BIGNUM *bn);\r\nBIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);\r\n\r\n/* Primes from RFC 3526 */\r\nBIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);\r\nBIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);\r\nBIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);\r\nBIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);\r\nBIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);\r\nBIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);\r\n\r\nint BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_BN_strings(void);\r\n\r\n/* Error codes for the BN functions. */\r\n\r\n/* Function codes. */\r\n#define BN_F_BNRAND\t\t\t\t\t 127\r\n#define BN_F_BN_BLINDING_CONVERT_EX\t\t\t 100\r\n#define BN_F_BN_BLINDING_CREATE_PARAM\t\t\t 128\r\n#define BN_F_BN_BLINDING_INVERT_EX\t\t\t 101\r\n#define BN_F_BN_BLINDING_NEW\t\t\t\t 102\r\n#define BN_F_BN_BLINDING_UPDATE\t\t\t\t 103\r\n#define BN_F_BN_BN2DEC\t\t\t\t\t 104\r\n#define BN_F_BN_BN2HEX\t\t\t\t\t 105\r\n#define BN_F_BN_CTX_GET\t\t\t\t\t 116\r\n#define BN_F_BN_CTX_NEW\t\t\t\t\t 106\r\n#define BN_F_BN_CTX_START\t\t\t\t 129\r\n#define BN_F_BN_DIV\t\t\t\t\t 107\r\n#define BN_F_BN_DIV_NO_BRANCH\t\t\t\t 138\r\n#define BN_F_BN_DIV_RECP\t\t\t\t 130\r\n#define BN_F_BN_EXP\t\t\t\t\t 123\r\n#define BN_F_BN_EXPAND2\t\t\t\t\t 108\r\n#define BN_F_BN_EXPAND_INTERNAL\t\t\t\t 120\r\n#define BN_F_BN_GF2M_MOD\t\t\t\t 131\r\n#define BN_F_BN_GF2M_MOD_EXP\t\t\t\t 132\r\n#define BN_F_BN_GF2M_MOD_MUL\t\t\t\t 133\r\n#define BN_F_BN_GF2M_MOD_SOLVE_QUAD\t\t\t 134\r\n#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR\t\t\t 135\r\n#define BN_F_BN_GF2M_MOD_SQR\t\t\t\t 136\r\n#define BN_F_BN_GF2M_MOD_SQRT\t\t\t\t 137\r\n#define BN_F_BN_MOD_EXP2_MONT\t\t\t\t 118\r\n#define BN_F_BN_MOD_EXP_MONT\t\t\t\t 109\r\n#define BN_F_BN_MOD_EXP_MONT_CONSTTIME\t\t\t 124\r\n#define BN_F_BN_MOD_EXP_MONT_WORD\t\t\t 117\r\n#define BN_F_BN_MOD_EXP_RECP\t\t\t\t 125\r\n#define BN_F_BN_MOD_EXP_SIMPLE\t\t\t\t 126\r\n#define BN_F_BN_MOD_INVERSE\t\t\t\t 110\r\n#define BN_F_BN_MOD_INVERSE_NO_BRANCH\t\t\t 139\r\n#define BN_F_BN_MOD_LSHIFT_QUICK\t\t\t 119\r\n#define BN_F_BN_MOD_MUL_RECIPROCAL\t\t\t 111\r\n#define BN_F_BN_MOD_SQRT\t\t\t\t 121\r\n#define BN_F_BN_MPI2BN\t\t\t\t\t 112\r\n#define BN_F_BN_NEW\t\t\t\t\t 113\r\n#define BN_F_BN_RAND\t\t\t\t\t 114\r\n#define BN_F_BN_RAND_RANGE\t\t\t\t 122\r\n#define BN_F_BN_USUB\t\t\t\t\t 115\r\n\r\n/* Reason codes. */\r\n#define BN_R_ARG2_LT_ARG3\t\t\t\t 100\r\n#define BN_R_BAD_RECIPROCAL\t\t\t\t 101\r\n#define BN_R_BIGNUM_TOO_LONG\t\t\t\t 114\r\n#define BN_R_CALLED_WITH_EVEN_MODULUS\t\t\t 102\r\n#define BN_R_DIV_BY_ZERO\t\t\t\t 103\r\n#define BN_R_ENCODING_ERROR\t\t\t\t 104\r\n#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA\t\t 105\r\n#define BN_R_INPUT_NOT_REDUCED\t\t\t\t 110\r\n#define BN_R_INVALID_LENGTH\t\t\t\t 106\r\n#define BN_R_INVALID_RANGE\t\t\t\t 115\r\n#define BN_R_NOT_A_SQUARE\t\t\t\t 111\r\n#define BN_R_NOT_INITIALIZED\t\t\t\t 107\r\n#define BN_R_NO_INVERSE\t\t\t\t\t 108\r\n#define BN_R_NO_SOLUTION\t\t\t\t 116\r\n#define BN_R_P_IS_NOT_PRIME\t\t\t\t 112\r\n#define BN_R_TOO_MANY_ITERATIONS\t\t\t 113\r\n#define BN_R_TOO_MANY_TEMPORARY_VARIABLES\t\t 109\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/buffer.h",
    "content": "/* crypto/buffer/buffer.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_BUFFER_H\r\n#define HEADER_BUFFER_H\r\n\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#include <stddef.h>\r\n\r\n#if !defined(NO_SYS_TYPES_H)\r\n#include <sys/types.h>\r\n#endif\r\n\r\n/* Already declared in ossl_typ.h */\r\n/* typedef struct buf_mem_st BUF_MEM; */\r\n\r\nstruct buf_mem_st\r\n\t{\r\n\tsize_t length;\t/* current number of bytes */\r\n\tchar *data;\r\n\tsize_t max;\t/* size of buffer */\r\n\t};\r\n\r\nBUF_MEM *BUF_MEM_new(void);\r\nvoid\tBUF_MEM_free(BUF_MEM *a);\r\nint\tBUF_MEM_grow(BUF_MEM *str, size_t len);\r\nint\tBUF_MEM_grow_clean(BUF_MEM *str, size_t len);\r\nchar *\tBUF_strdup(const char *str);\r\nchar *\tBUF_strndup(const char *str, size_t siz);\r\nvoid *\tBUF_memdup(const void *data, size_t siz);\r\nvoid\tBUF_reverse(unsigned char *out, unsigned char *in, size_t siz);\r\n\r\n/* safe string functions */\r\nsize_t BUF_strlcpy(char *dst,const char *src,size_t siz);\r\nsize_t BUF_strlcat(char *dst,const char *src,size_t siz);\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_BUF_strings(void);\r\n\r\n/* Error codes for the BUF functions. */\r\n\r\n/* Function codes. */\r\n#define BUF_F_BUF_MEMDUP\t\t\t\t 103\r\n#define BUF_F_BUF_MEM_GROW\t\t\t\t 100\r\n#define BUF_F_BUF_MEM_GROW_CLEAN\t\t\t 105\r\n#define BUF_F_BUF_MEM_NEW\t\t\t\t 101\r\n#define BUF_F_BUF_STRDUP\t\t\t\t 102\r\n#define BUF_F_BUF_STRNDUP\t\t\t\t 104\r\n\r\n/* Reason codes. */\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/camellia.h",
    "content": "/* crypto/camellia/camellia.h -*- mode:C; c-file-style: \"eay\" -*- */\r\n/* ====================================================================\r\n * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n */\r\n\r\n#ifndef HEADER_CAMELLIA_H\r\n#define HEADER_CAMELLIA_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_CAMELLIA\r\n#error CAMELLIA is disabled.\r\n#endif\r\n\r\n#include <stddef.h>\r\n\r\n#define CAMELLIA_ENCRYPT\t1\r\n#define CAMELLIA_DECRYPT\t0\r\n\r\n/* Because array size can't be a const in C, the following two are macros.\r\n   Both sizes are in bytes. */\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* This should be a hidden type, but EVP requires that the size be known */\r\n\r\n#define CAMELLIA_BLOCK_SIZE 16\r\n#define CAMELLIA_TABLE_BYTE_LEN 272\r\n#define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)\r\n\r\ntypedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match with WORD */\r\n\r\nstruct camellia_key_st \r\n\t{\r\n\tunion\t{\r\n\t\tdouble d;\t/* ensures 64-bit align */\r\n\t\tKEY_TABLE_TYPE rd_key;\r\n\t\t} u;\r\n\tint grand_rounds;\r\n\t};\r\ntypedef struct camellia_key_st CAMELLIA_KEY;\r\n\r\n#ifdef OPENSSL_FIPS\r\nint private_Camellia_set_key(const unsigned char *userKey, const int bits,\r\n\tCAMELLIA_KEY *key);\r\n#endif\r\nint Camellia_set_key(const unsigned char *userKey, const int bits,\r\n\tCAMELLIA_KEY *key);\r\n\r\nvoid Camellia_encrypt(const unsigned char *in, unsigned char *out,\r\n\tconst CAMELLIA_KEY *key);\r\nvoid Camellia_decrypt(const unsigned char *in, unsigned char *out,\r\n\tconst CAMELLIA_KEY *key);\r\n\r\nvoid Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,\r\n\tconst CAMELLIA_KEY *key, const int enc);\r\nvoid Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const CAMELLIA_KEY *key,\r\n\tunsigned char *ivec, const int enc);\r\nvoid Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const CAMELLIA_KEY *key,\r\n\tunsigned char *ivec, int *num, const int enc);\r\nvoid Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const CAMELLIA_KEY *key,\r\n\tunsigned char *ivec, int *num, const int enc);\r\nvoid Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const CAMELLIA_KEY *key,\r\n\tunsigned char *ivec, int *num, const int enc);\r\nvoid Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const CAMELLIA_KEY *key,\r\n\tunsigned char *ivec, int *num);\r\nvoid Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,\r\n\tsize_t length, const CAMELLIA_KEY *key,\r\n\tunsigned char ivec[CAMELLIA_BLOCK_SIZE],\r\n\tunsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],\r\n\tunsigned int *num);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* !HEADER_Camellia_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/cast.h",
    "content": "/* crypto/cast/cast.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_CAST_H\r\n#define HEADER_CAST_H\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_CAST\r\n#error CAST is disabled.\r\n#endif\r\n\r\n#define CAST_ENCRYPT\t1\r\n#define CAST_DECRYPT\t0\r\n\r\n#define CAST_LONG unsigned int\r\n\r\n#define CAST_BLOCK\t8\r\n#define CAST_KEY_LENGTH\t16\r\n\r\ntypedef struct cast_key_st\r\n\t{\r\n\tCAST_LONG data[32];\r\n\tint short_key;\t/* Use reduced rounds for short key */\r\n\t} CAST_KEY;\r\n\r\n#ifdef OPENSSL_FIPS \r\nvoid private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);\r\n#endif\r\nvoid CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);\r\nvoid CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key,\r\n\t\t      int enc);\r\nvoid CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);\r\nvoid CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);\r\nvoid CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,\r\n\t\t      const CAST_KEY *ks, unsigned char *iv, int enc);\r\nvoid CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tlong length, const CAST_KEY *schedule, unsigned char *ivec,\r\n\t\t\tint *num, int enc);\r\nvoid CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, \r\n\t\t\tlong length, const CAST_KEY *schedule, unsigned char *ivec,\r\n\t\t\tint *num);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/cmac.h",
    "content": "/* crypto/cmac/cmac.h */\r\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\r\n * project.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n */\r\n\r\n\r\n#ifndef HEADER_CMAC_H\r\n#define HEADER_CMAC_H\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#include <openssl/evp.h>\r\n\r\n/* Opaque */\r\ntypedef struct CMAC_CTX_st CMAC_CTX;\r\n\r\nCMAC_CTX *CMAC_CTX_new(void);\r\nvoid CMAC_CTX_cleanup(CMAC_CTX *ctx);\r\nvoid CMAC_CTX_free(CMAC_CTX *ctx);\r\nEVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);\r\nint CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);\r\n\r\nint CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, \r\n\t\t\tconst EVP_CIPHER *cipher, ENGINE *impl);\r\nint CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);\r\nint CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);\r\nint CMAC_resume(CMAC_CTX *ctx);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/cms.h",
    "content": "/* crypto/cms/cms.h */\r\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\r\n * project.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n */\r\n\r\n\r\n#ifndef HEADER_CMS_H\r\n#define HEADER_CMS_H\r\n\r\n#include <openssl/x509.h>\r\n\r\n#ifdef OPENSSL_NO_CMS\r\n#error CMS is disabled.\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\ntypedef struct CMS_ContentInfo_st CMS_ContentInfo;\r\ntypedef struct CMS_SignerInfo_st CMS_SignerInfo;\r\ntypedef struct CMS_CertificateChoices CMS_CertificateChoices;\r\ntypedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;\r\ntypedef struct CMS_RecipientInfo_st CMS_RecipientInfo;\r\ntypedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;\r\ntypedef struct CMS_Receipt_st CMS_Receipt;\r\n\r\nDECLARE_STACK_OF(CMS_SignerInfo)\r\nDECLARE_STACK_OF(GENERAL_NAMES)\r\nDECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)\r\nDECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)\r\nDECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)\r\n\r\n#define CMS_SIGNERINFO_ISSUER_SERIAL\t0\r\n#define CMS_SIGNERINFO_KEYIDENTIFIER\t1\r\n\r\n#define CMS_RECIPINFO_TRANS\t\t0\r\n#define CMS_RECIPINFO_AGREE\t\t1\r\n#define CMS_RECIPINFO_KEK\t\t2\r\n#define CMS_RECIPINFO_PASS\t\t3\r\n#define CMS_RECIPINFO_OTHER\t\t4\r\n\r\n/* S/MIME related flags */\r\n\r\n#define CMS_TEXT\t\t\t0x1\r\n#define CMS_NOCERTS\t\t\t0x2\r\n#define CMS_NO_CONTENT_VERIFY\t\t0x4\r\n#define CMS_NO_ATTR_VERIFY\t\t0x8\r\n#define CMS_NOSIGS\t\t\t\\\r\n\t\t\t(CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)\r\n#define CMS_NOINTERN\t\t\t0x10\r\n#define CMS_NO_SIGNER_CERT_VERIFY\t0x20\r\n#define CMS_NOVERIFY\t\t\t0x20\r\n#define CMS_DETACHED\t\t\t0x40\r\n#define CMS_BINARY\t\t\t0x80\r\n#define CMS_NOATTR\t\t\t0x100\r\n#define\tCMS_NOSMIMECAP\t\t\t0x200\r\n#define CMS_NOOLDMIMETYPE\t\t0x400\r\n#define CMS_CRLFEOL\t\t\t0x800\r\n#define CMS_STREAM\t\t\t0x1000\r\n#define CMS_NOCRL\t\t\t0x2000\r\n#define CMS_PARTIAL\t\t\t0x4000\r\n#define CMS_REUSE_DIGEST\t\t0x8000\r\n#define CMS_USE_KEYID\t\t\t0x10000\r\n#define CMS_DEBUG_DECRYPT\t\t0x20000\r\n\r\nconst ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);\r\n\r\nBIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);\r\nint CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);\r\n\r\nASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);\r\nint CMS_is_detached(CMS_ContentInfo *cms);\r\nint CMS_set_detached(CMS_ContentInfo *cms, int detached);\r\n\r\n#ifdef HEADER_PEM_H\r\nDECLARE_PEM_rw_const(CMS, CMS_ContentInfo)\r\n#endif\r\n\r\nint CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);\r\nCMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);\r\nint i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);\r\n\r\nBIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);\r\nint i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);\r\nint PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);\r\nCMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);\r\nint SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);\r\n\r\nint CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);\r\n\r\nCMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\r\n\t\t\t\t\t\tBIO *data, unsigned int flags);\r\n\r\nCMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,\r\n\t\t\t\t\tX509 *signcert, EVP_PKEY *pkey,\r\n\t\t\t\t\tSTACK_OF(X509) *certs,\r\n\t\t\t\t\tunsigned int flags);\r\n\r\nint CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);\r\nCMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);\r\n\r\nint CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,\r\n\t\t\t\t\t\t\tunsigned int flags);\r\nCMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,\r\n\t\t\t\t\t\t\tunsigned int flags);\r\n\r\nint CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,\r\n\t\t\t\tconst unsigned char *key, size_t keylen,\r\n\t\t\t\tBIO *dcont, BIO *out, unsigned int flags);\r\n\r\nCMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,\r\n\t\t\t\t\tconst unsigned char *key, size_t keylen,\r\n\t\t\t\t\tunsigned int flags);\r\n\r\nint CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,\r\n\t\t\t\tconst unsigned char *key, size_t keylen);\r\n\r\nint CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,\r\n\t\t X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);\r\n\r\nint CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,\r\n\t\t\tSTACK_OF(X509) *certs,\r\n\t\t\tX509_STORE *store, unsigned int flags);\r\n\r\nSTACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);\r\n\r\nCMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,\r\n\t\t\t\tconst EVP_CIPHER *cipher, unsigned int flags);\r\n\r\nint CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,\r\n\t\t\t\tBIO *dcont, BIO *out,\r\n\t\t\t\tunsigned int flags);\r\n\t\r\nint CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);\r\nint CMS_decrypt_set1_key(CMS_ContentInfo *cms, \r\n\t\t\t\tunsigned char *key, size_t keylen,\r\n\t\t\t\tunsigned char *id, size_t idlen);\r\nint CMS_decrypt_set1_password(CMS_ContentInfo *cms, \r\n\t\t\t\tunsigned char *pass, ossl_ssize_t passlen);\r\n\r\nSTACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);\r\nint CMS_RecipientInfo_type(CMS_RecipientInfo *ri);\r\nCMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);\r\nCMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,\r\n\t\t\t\t\tX509 *recip, unsigned int flags);\r\nint CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);\r\nint CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);\r\nint CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,\r\n\t\t\t\t\tEVP_PKEY **pk, X509 **recip,\r\n\t\t\t\t\tX509_ALGOR **palg);\r\nint CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,\r\n\t\t\t\t\tASN1_OCTET_STRING **keyid,\r\n\t\t\t\t\tX509_NAME **issuer, ASN1_INTEGER **sno);\r\n\r\nCMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,\r\n\t\t\t\t\tunsigned char *key, size_t keylen,\r\n\t\t\t\t\tunsigned char *id, size_t idlen,\r\n\t\t\t\t\tASN1_GENERALIZEDTIME *date,\r\n\t\t\t\t\tASN1_OBJECT *otherTypeId,\r\n\t\t\t\t\tASN1_TYPE *otherType);\r\n\r\nint CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,\r\n\t\t\t\t\tX509_ALGOR **palg,\r\n\t\t\t\t\tASN1_OCTET_STRING **pid,\r\n\t\t\t\t\tASN1_GENERALIZEDTIME **pdate,\r\n\t\t\t\t\tASN1_OBJECT **potherid,\r\n\t\t\t\t\tASN1_TYPE **pothertype);\r\n\r\nint CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, \r\n\t\t\t\tunsigned char *key, size_t keylen);\r\n\r\nint CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, \r\n\t\t\t\t\tconst unsigned char *id, size_t idlen);\r\n\r\nint CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, \r\n\t\t\t\t\tunsigned char *pass,\r\n\t\t\t\t\tossl_ssize_t passlen);\r\n\r\nCMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,\r\n\t\t\t\t\tint iter, int wrap_nid, int pbe_nid,\r\n\t\t\t\t\tunsigned char *pass,\r\n\t\t\t\t\tossl_ssize_t passlen,\r\n\t\t\t\t\tconst EVP_CIPHER *kekciph);\r\n\r\nint CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);\r\n\t\r\nint CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,\r\n\t\t\t\t\t\t\tunsigned int flags);\r\nCMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);\r\n\r\nint CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);\r\nconst ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);\r\n\r\nCMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);\r\nint CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);\r\nint CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);\r\nSTACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);\r\n\r\nCMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);\r\nint CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);\r\nint CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);\r\nSTACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);\r\n\r\nint CMS_SignedData_init(CMS_ContentInfo *cms);\r\nCMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,\r\n\t\t\tX509 *signer, EVP_PKEY *pk, const EVP_MD *md,\r\n\t\t\tunsigned int flags);\r\nSTACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);\r\n\r\nvoid CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);\r\nint CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,\r\n\t\t\t\t\tASN1_OCTET_STRING **keyid,\r\n\t\t\t\t\tX509_NAME **issuer, ASN1_INTEGER **sno);\r\nint CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);\r\nint CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,\r\n\t\t\t\t\tunsigned int flags);\r\nvoid CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,\r\n\t\t\t\t\tX509_ALGOR **pdig, X509_ALGOR **psig);\r\nint CMS_SignerInfo_sign(CMS_SignerInfo *si);\r\nint CMS_SignerInfo_verify(CMS_SignerInfo *si);\r\nint CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);\r\n\r\nint CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);\r\nint CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,\r\n\t\t\t\tint algnid, int keysize);\r\nint CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);\r\n\r\nint CMS_signed_get_attr_count(const CMS_SignerInfo *si);\r\nint CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,\r\n\t\t\t  int lastpos);\r\nint CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,\r\n\t\t\t  int lastpos);\r\nX509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);\r\nX509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);\r\nint CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);\r\nint CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,\r\n\t\t\tconst ASN1_OBJECT *obj, int type,\r\n\t\t\tconst void *bytes, int len);\r\nint CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,\r\n\t\t\tint nid, int type,\r\n\t\t\tconst void *bytes, int len);\r\nint CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,\r\n\t\t\tconst char *attrname, int type,\r\n\t\t\tconst void *bytes, int len);\r\nvoid *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,\r\n\t\t\t\t\tint lastpos, int type);\r\n\r\nint CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);\r\nint CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,\r\n\t\t\t  int lastpos);\r\nint CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,\r\n\t\t\t  int lastpos);\r\nX509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);\r\nX509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);\r\nint CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);\r\nint CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,\r\n\t\t\tconst ASN1_OBJECT *obj, int type,\r\n\t\t\tconst void *bytes, int len);\r\nint CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,\r\n\t\t\tint nid, int type,\r\n\t\t\tconst void *bytes, int len);\r\nint CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,\r\n\t\t\tconst char *attrname, int type,\r\n\t\t\tconst void *bytes, int len);\r\nvoid *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,\r\n\t\t\t\t\tint lastpos, int type);\r\n\r\n#ifdef HEADER_X509V3_H\r\n\r\nint CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);\r\nCMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,\r\n\t\t\t\tint allorfirst,\r\n\t\t\t\tSTACK_OF(GENERAL_NAMES) *receiptList,\r\n\t\t\t\tSTACK_OF(GENERAL_NAMES) *receiptsTo);\r\nint CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);\r\nvoid CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,\r\n\t\t\t\t\tASN1_STRING **pcid,\r\n\t\t\t\t\tint *pallorfirst,\r\n\t\t\t\t\tSTACK_OF(GENERAL_NAMES) **plist,\r\n\t\t\t\t\tSTACK_OF(GENERAL_NAMES) **prto);\r\n\r\n#endif\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_CMS_strings(void);\r\n\r\n/* Error codes for the CMS functions. */\r\n\r\n/* Function codes. */\r\n#define CMS_F_CHECK_CONTENT\t\t\t\t 99\r\n#define CMS_F_CMS_ADD0_CERT\t\t\t\t 164\r\n#define CMS_F_CMS_ADD0_RECIPIENT_KEY\t\t\t 100\r\n#define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD\t\t 165\r\n#define CMS_F_CMS_ADD1_RECEIPTREQUEST\t\t\t 158\r\n#define CMS_F_CMS_ADD1_RECIPIENT_CERT\t\t\t 101\r\n#define CMS_F_CMS_ADD1_SIGNER\t\t\t\t 102\r\n#define CMS_F_CMS_ADD1_SIGNINGTIME\t\t\t 103\r\n#define CMS_F_CMS_COMPRESS\t\t\t\t 104\r\n#define CMS_F_CMS_COMPRESSEDDATA_CREATE\t\t\t 105\r\n#define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO\t\t 106\r\n#define CMS_F_CMS_COPY_CONTENT\t\t\t\t 107\r\n#define CMS_F_CMS_COPY_MESSAGEDIGEST\t\t\t 108\r\n#define CMS_F_CMS_DATA\t\t\t\t\t 109\r\n#define CMS_F_CMS_DATAFINAL\t\t\t\t 110\r\n#define CMS_F_CMS_DATAINIT\t\t\t\t 111\r\n#define CMS_F_CMS_DECRYPT\t\t\t\t 112\r\n#define CMS_F_CMS_DECRYPT_SET1_KEY\t\t\t 113\r\n#define CMS_F_CMS_DECRYPT_SET1_PASSWORD\t\t\t 166\r\n#define CMS_F_CMS_DECRYPT_SET1_PKEY\t\t\t 114\r\n#define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX\t\t 115\r\n#define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO\t\t 116\r\n#define CMS_F_CMS_DIGESTEDDATA_DO_FINAL\t\t\t 117\r\n#define CMS_F_CMS_DIGEST_VERIFY\t\t\t\t 118\r\n#define CMS_F_CMS_ENCODE_RECEIPT\t\t\t 161\r\n#define CMS_F_CMS_ENCRYPT\t\t\t\t 119\r\n#define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO\t\t 120\r\n#define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT\t\t\t 121\r\n#define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT\t\t\t 122\r\n#define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY\t\t 123\r\n#define CMS_F_CMS_ENVELOPEDDATA_CREATE\t\t\t 124\r\n#define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO\t\t 125\r\n#define CMS_F_CMS_ENVELOPED_DATA_INIT\t\t\t 126\r\n#define CMS_F_CMS_FINAL\t\t\t\t\t 127\r\n#define CMS_F_CMS_GET0_CERTIFICATE_CHOICES\t\t 128\r\n#define CMS_F_CMS_GET0_CONTENT\t\t\t\t 129\r\n#define CMS_F_CMS_GET0_ECONTENT_TYPE\t\t\t 130\r\n#define CMS_F_CMS_GET0_ENVELOPED\t\t\t 131\r\n#define CMS_F_CMS_GET0_REVOCATION_CHOICES\t\t 132\r\n#define CMS_F_CMS_GET0_SIGNED\t\t\t\t 133\r\n#define CMS_F_CMS_MSGSIGDIGEST_ADD1\t\t\t 162\r\n#define CMS_F_CMS_RECEIPTREQUEST_CREATE0\t\t 159\r\n#define CMS_F_CMS_RECEIPT_VERIFY\t\t\t 160\r\n#define CMS_F_CMS_RECIPIENTINFO_DECRYPT\t\t\t 134\r\n#define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT\t\t 135\r\n#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT\t\t 136\r\n#define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID\t\t 137\r\n#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP\t\t 138\r\n#define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP\t\t 139\r\n#define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT\t\t 140\r\n#define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT\t\t 141\r\n#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS\t\t 142\r\n#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID\t 143\r\n#define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT\t\t 167\r\n#define CMS_F_CMS_RECIPIENTINFO_SET0_KEY\t\t 144\r\n#define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD\t\t 168\r\n#define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY\t\t 145\r\n#define CMS_F_CMS_SET1_SIGNERIDENTIFIER\t\t\t 146\r\n#define CMS_F_CMS_SET_DETACHED\t\t\t\t 147\r\n#define CMS_F_CMS_SIGN\t\t\t\t\t 148\r\n#define CMS_F_CMS_SIGNED_DATA_INIT\t\t\t 149\r\n#define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN\t\t 150\r\n#define CMS_F_CMS_SIGNERINFO_SIGN\t\t\t 151\r\n#define CMS_F_CMS_SIGNERINFO_VERIFY\t\t\t 152\r\n#define CMS_F_CMS_SIGNERINFO_VERIFY_CERT\t\t 153\r\n#define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT\t\t 154\r\n#define CMS_F_CMS_SIGN_RECEIPT\t\t\t\t 163\r\n#define CMS_F_CMS_STREAM\t\t\t\t 155\r\n#define CMS_F_CMS_UNCOMPRESS\t\t\t\t 156\r\n#define CMS_F_CMS_VERIFY\t\t\t\t 157\r\n\r\n/* Reason codes. */\r\n#define CMS_R_ADD_SIGNER_ERROR\t\t\t\t 99\r\n#define CMS_R_CERTIFICATE_ALREADY_PRESENT\t\t 175\r\n#define CMS_R_CERTIFICATE_HAS_NO_KEYID\t\t\t 160\r\n#define CMS_R_CERTIFICATE_VERIFY_ERROR\t\t\t 100\r\n#define CMS_R_CIPHER_INITIALISATION_ERROR\t\t 101\r\n#define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR\t 102\r\n#define CMS_R_CMS_DATAFINAL_ERROR\t\t\t 103\r\n#define CMS_R_CMS_LIB\t\t\t\t\t 104\r\n#define CMS_R_CONTENTIDENTIFIER_MISMATCH\t\t 170\r\n#define CMS_R_CONTENT_NOT_FOUND\t\t\t\t 105\r\n#define CMS_R_CONTENT_TYPE_MISMATCH\t\t\t 171\r\n#define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA\t\t 106\r\n#define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA\t\t 107\r\n#define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA\t\t 108\r\n#define CMS_R_CONTENT_VERIFY_ERROR\t\t\t 109\r\n#define CMS_R_CTRL_ERROR\t\t\t\t 110\r\n#define CMS_R_CTRL_FAILURE\t\t\t\t 111\r\n#define CMS_R_DECRYPT_ERROR\t\t\t\t 112\r\n#define CMS_R_DIGEST_ERROR\t\t\t\t 161\r\n#define CMS_R_ERROR_GETTING_PUBLIC_KEY\t\t\t 113\r\n#define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE\t 114\r\n#define CMS_R_ERROR_SETTING_KEY\t\t\t\t 115\r\n#define CMS_R_ERROR_SETTING_RECIPIENTINFO\t\t 116\r\n#define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH\t\t 117\r\n#define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER\t\t 176\r\n#define CMS_R_INVALID_KEY_LENGTH\t\t\t 118\r\n#define CMS_R_MD_BIO_INIT_ERROR\t\t\t\t 119\r\n#define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH\t 120\r\n#define CMS_R_MESSAGEDIGEST_WRONG_LENGTH\t\t 121\r\n#define CMS_R_MSGSIGDIGEST_ERROR\t\t\t 172\r\n#define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE\t\t 162\r\n#define CMS_R_MSGSIGDIGEST_WRONG_LENGTH\t\t\t 163\r\n#define CMS_R_NEED_ONE_SIGNER\t\t\t\t 164\r\n#define CMS_R_NOT_A_SIGNED_RECEIPT\t\t\t 165\r\n#define CMS_R_NOT_ENCRYPTED_DATA\t\t\t 122\r\n#define CMS_R_NOT_KEK\t\t\t\t\t 123\r\n#define CMS_R_NOT_KEY_TRANSPORT\t\t\t\t 124\r\n#define CMS_R_NOT_PWRI\t\t\t\t\t 177\r\n#define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE\t\t 125\r\n#define CMS_R_NO_CIPHER\t\t\t\t\t 126\r\n#define CMS_R_NO_CONTENT\t\t\t\t 127\r\n#define CMS_R_NO_CONTENT_TYPE\t\t\t\t 173\r\n#define CMS_R_NO_DEFAULT_DIGEST\t\t\t\t 128\r\n#define CMS_R_NO_DIGEST_SET\t\t\t\t 129\r\n#define CMS_R_NO_KEY\t\t\t\t\t 130\r\n#define CMS_R_NO_KEY_OR_CERT\t\t\t\t 174\r\n#define CMS_R_NO_MATCHING_DIGEST\t\t\t 131\r\n#define CMS_R_NO_MATCHING_RECIPIENT\t\t\t 132\r\n#define CMS_R_NO_MATCHING_SIGNATURE\t\t\t 166\r\n#define CMS_R_NO_MSGSIGDIGEST\t\t\t\t 167\r\n#define CMS_R_NO_PASSWORD\t\t\t\t 178\r\n#define CMS_R_NO_PRIVATE_KEY\t\t\t\t 133\r\n#define CMS_R_NO_PUBLIC_KEY\t\t\t\t 134\r\n#define CMS_R_NO_RECEIPT_REQUEST\t\t\t 168\r\n#define CMS_R_NO_SIGNERS\t\t\t\t 135\r\n#define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE\t 136\r\n#define CMS_R_RECEIPT_DECODE_ERROR\t\t\t 169\r\n#define CMS_R_RECIPIENT_ERROR\t\t\t\t 137\r\n#define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND\t\t 138\r\n#define CMS_R_SIGNFINAL_ERROR\t\t\t\t 139\r\n#define CMS_R_SMIME_TEXT_ERROR\t\t\t\t 140\r\n#define CMS_R_STORE_INIT_ERROR\t\t\t\t 141\r\n#define CMS_R_TYPE_NOT_COMPRESSED_DATA\t\t\t 142\r\n#define CMS_R_TYPE_NOT_DATA\t\t\t\t 143\r\n#define CMS_R_TYPE_NOT_DIGESTED_DATA\t\t\t 144\r\n#define CMS_R_TYPE_NOT_ENCRYPTED_DATA\t\t\t 145\r\n#define CMS_R_TYPE_NOT_ENVELOPED_DATA\t\t\t 146\r\n#define CMS_R_UNABLE_TO_FINALIZE_CONTEXT\t\t 147\r\n#define CMS_R_UNKNOWN_CIPHER\t\t\t\t 148\r\n#define CMS_R_UNKNOWN_DIGEST_ALGORIHM\t\t\t 149\r\n#define CMS_R_UNKNOWN_ID\t\t\t\t 150\r\n#define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM\t\t 151\r\n#define CMS_R_UNSUPPORTED_CONTENT_TYPE\t\t\t 152\r\n#define CMS_R_UNSUPPORTED_KEK_ALGORITHM\t\t\t 153\r\n#define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM\t 179\r\n#define CMS_R_UNSUPPORTED_RECIPIENT_TYPE\t\t 154\r\n#define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE\t\t 155\r\n#define CMS_R_UNSUPPORTED_TYPE\t\t\t\t 156\r\n#define CMS_R_UNWRAP_ERROR\t\t\t\t 157\r\n#define CMS_R_UNWRAP_FAILURE\t\t\t\t 180\r\n#define CMS_R_VERIFICATION_FAILURE\t\t\t 158\r\n#define CMS_R_WRAP_ERROR\t\t\t\t 159\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/comp.h",
    "content": "\r\n#ifndef HEADER_COMP_H\r\n#define HEADER_COMP_H\r\n\r\n#include <openssl/crypto.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct comp_ctx_st COMP_CTX;\r\n\r\ntypedef struct comp_method_st\r\n\t{\r\n\tint type;\t\t/* NID for compression library */\r\n\tconst char *name;\t/* A text string to identify the library */\r\n\tint (*init)(COMP_CTX *ctx);\r\n\tvoid (*finish)(COMP_CTX *ctx);\r\n\tint (*compress)(COMP_CTX *ctx,\r\n\t\t\tunsigned char *out, unsigned int olen,\r\n\t\t\tunsigned char *in, unsigned int ilen);\r\n\tint (*expand)(COMP_CTX *ctx,\r\n\t\t      unsigned char *out, unsigned int olen,\r\n\t\t      unsigned char *in, unsigned int ilen);\r\n\t/* The following two do NOTHING, but are kept for backward compatibility */\r\n\tlong (*ctrl)(void);\r\n\tlong (*callback_ctrl)(void);\r\n\t} COMP_METHOD;\r\n\r\nstruct comp_ctx_st\r\n\t{\r\n\tCOMP_METHOD *meth;\r\n\tunsigned long compress_in;\r\n\tunsigned long compress_out;\r\n\tunsigned long expand_in;\r\n\tunsigned long expand_out;\r\n\r\n\tCRYPTO_EX_DATA\tex_data;\r\n\t};\r\n\r\n\r\nCOMP_CTX *COMP_CTX_new(COMP_METHOD *meth);\r\nvoid COMP_CTX_free(COMP_CTX *ctx);\r\nint COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,\r\n\tunsigned char *in, int ilen);\r\nint COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,\r\n\tunsigned char *in, int ilen);\r\nCOMP_METHOD *COMP_rle(void );\r\nCOMP_METHOD *COMP_zlib(void );\r\nvoid COMP_zlib_cleanup(void);\r\n\r\n#ifdef HEADER_BIO_H\r\n#ifdef ZLIB\r\nBIO_METHOD *BIO_f_zlib(void);\r\n#endif\r\n#endif\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_COMP_strings(void);\r\n\r\n/* Error codes for the COMP functions. */\r\n\r\n/* Function codes. */\r\n#define COMP_F_BIO_ZLIB_FLUSH\t\t\t\t 99\r\n#define COMP_F_BIO_ZLIB_NEW\t\t\t\t 100\r\n#define COMP_F_BIO_ZLIB_READ\t\t\t\t 101\r\n#define COMP_F_BIO_ZLIB_WRITE\t\t\t\t 102\r\n\r\n/* Reason codes. */\r\n#define COMP_R_ZLIB_DEFLATE_ERROR\t\t\t 99\r\n#define COMP_R_ZLIB_INFLATE_ERROR\t\t\t 100\r\n#define COMP_R_ZLIB_NOT_SUPPORTED\t\t\t 101\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/conf.h",
    "content": "/* crypto/conf/conf.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef  HEADER_CONF_H\r\n#define HEADER_CONF_H\r\n\r\n#include <openssl/bio.h>\r\n#include <openssl/lhash.h>\r\n#include <openssl/stack.h>\r\n#include <openssl/safestack.h>\r\n#include <openssl/e_os2.h>\r\n\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct\r\n\t{\r\n\tchar *section;\r\n\tchar *name;\r\n\tchar *value;\r\n\t} CONF_VALUE;\r\n\r\nDECLARE_STACK_OF(CONF_VALUE)\r\nDECLARE_LHASH_OF(CONF_VALUE);\r\n\r\nstruct conf_st;\r\nstruct conf_method_st;\r\ntypedef struct conf_method_st CONF_METHOD;\r\n\r\nstruct conf_method_st\r\n\t{\r\n\tconst char *name;\r\n\tCONF *(*create)(CONF_METHOD *meth);\r\n\tint (*init)(CONF *conf);\r\n\tint (*destroy)(CONF *conf);\r\n\tint (*destroy_data)(CONF *conf);\r\n\tint (*load_bio)(CONF *conf, BIO *bp, long *eline);\r\n\tint (*dump)(const CONF *conf, BIO *bp);\r\n\tint (*is_number)(const CONF *conf, char c);\r\n\tint (*to_int)(const CONF *conf, char c);\r\n\tint (*load)(CONF *conf, const char *name, long *eline);\r\n\t};\r\n\r\n/* Module definitions */\r\n\r\ntypedef struct conf_imodule_st CONF_IMODULE;\r\ntypedef struct conf_module_st CONF_MODULE;\r\n\r\nDECLARE_STACK_OF(CONF_MODULE)\r\nDECLARE_STACK_OF(CONF_IMODULE)\r\n\r\n/* DSO module function typedefs */\r\ntypedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);\r\ntypedef void conf_finish_func(CONF_IMODULE *md);\r\n\r\n#define\tCONF_MFLAGS_IGNORE_ERRORS\t0x1\r\n#define CONF_MFLAGS_IGNORE_RETURN_CODES\t0x2\r\n#define CONF_MFLAGS_SILENT\t\t0x4\r\n#define CONF_MFLAGS_NO_DSO\t\t0x8\r\n#define CONF_MFLAGS_IGNORE_MISSING_FILE\t0x10\r\n#define CONF_MFLAGS_DEFAULT_SECTION\t0x20\r\n\r\nint CONF_set_default_method(CONF_METHOD *meth);\r\nvoid CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash);\r\nLHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *file,\r\n\t\t\t\tlong *eline);\r\n#ifndef OPENSSL_NO_FP_API\r\nLHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,\r\n\t\t\t\t   long *eline);\r\n#endif\r\nLHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline);\r\nSTACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,\r\n\t\t\t\t       const char *section);\r\nchar *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group,\r\n\t\t      const char *name);\r\nlong CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group,\r\n\t\t     const char *name);\r\nvoid CONF_free(LHASH_OF(CONF_VALUE) *conf);\r\nint CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);\r\nint CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);\r\n\r\nvoid OPENSSL_config(const char *config_name);\r\nvoid OPENSSL_no_config(void);\r\n\r\n/* New conf code.  The semantics are different from the functions above.\r\n   If that wasn't the case, the above functions would have been replaced */\r\n\r\nstruct conf_st\r\n\t{\r\n\tCONF_METHOD *meth;\r\n\tvoid *meth_data;\r\n\tLHASH_OF(CONF_VALUE) *data;\r\n\t};\r\n\r\nCONF *NCONF_new(CONF_METHOD *meth);\r\nCONF_METHOD *NCONF_default(void);\r\nCONF_METHOD *NCONF_WIN32(void);\r\n#if 0 /* Just to give you an idea of what I have in mind */\r\nCONF_METHOD *NCONF_XML(void);\r\n#endif\r\nvoid NCONF_free(CONF *conf);\r\nvoid NCONF_free_data(CONF *conf);\r\n\r\nint NCONF_load(CONF *conf,const char *file,long *eline);\r\n#ifndef OPENSSL_NO_FP_API\r\nint NCONF_load_fp(CONF *conf, FILE *fp,long *eline);\r\n#endif\r\nint NCONF_load_bio(CONF *conf, BIO *bp,long *eline);\r\nSTACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);\r\nchar *NCONF_get_string(const CONF *conf,const char *group,const char *name);\r\nint NCONF_get_number_e(const CONF *conf,const char *group,const char *name,\r\n\t\t       long *result);\r\nint NCONF_dump_fp(const CONF *conf, FILE *out);\r\nint NCONF_dump_bio(const CONF *conf, BIO *out);\r\n\r\n#if 0 /* The following function has no error checking,\r\n\t and should therefore be avoided */\r\nlong NCONF_get_number(CONF *conf,char *group,char *name);\r\n#else\r\n#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)\r\n#endif\r\n  \r\n/* Module functions */\r\n\r\nint CONF_modules_load(const CONF *cnf, const char *appname,\r\n\t\t      unsigned long flags);\r\nint CONF_modules_load_file(const char *filename, const char *appname,\r\n\t\t\t   unsigned long flags);\r\nvoid CONF_modules_unload(int all);\r\nvoid CONF_modules_finish(void);\r\nvoid CONF_modules_free(void);\r\nint CONF_module_add(const char *name, conf_init_func *ifunc,\r\n\t\t    conf_finish_func *ffunc);\r\n\r\nconst char *CONF_imodule_get_name(const CONF_IMODULE *md);\r\nconst char *CONF_imodule_get_value(const CONF_IMODULE *md);\r\nvoid *CONF_imodule_get_usr_data(const CONF_IMODULE *md);\r\nvoid CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);\r\nCONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);\r\nunsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);\r\nvoid CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);\r\nvoid *CONF_module_get_usr_data(CONF_MODULE *pmod);\r\nvoid CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);\r\n\r\nchar *CONF_get1_default_config_file(void);\r\n\r\nint CONF_parse_list(const char *list, int sep, int nospc,\r\n\tint (*list_cb)(const char *elem, int len, void *usr), void *arg);\r\n\r\nvoid OPENSSL_load_builtin_modules(void);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_CONF_strings(void);\r\n\r\n/* Error codes for the CONF functions. */\r\n\r\n/* Function codes. */\r\n#define CONF_F_CONF_DUMP_FP\t\t\t\t 104\r\n#define CONF_F_CONF_LOAD\t\t\t\t 100\r\n#define CONF_F_CONF_LOAD_BIO\t\t\t\t 102\r\n#define CONF_F_CONF_LOAD_FP\t\t\t\t 103\r\n#define CONF_F_CONF_MODULES_LOAD\t\t\t 116\r\n#define CONF_F_CONF_PARSE_LIST\t\t\t\t 119\r\n#define CONF_F_DEF_LOAD\t\t\t\t\t 120\r\n#define CONF_F_DEF_LOAD_BIO\t\t\t\t 121\r\n#define CONF_F_MODULE_INIT\t\t\t\t 115\r\n#define CONF_F_MODULE_LOAD_DSO\t\t\t\t 117\r\n#define CONF_F_MODULE_RUN\t\t\t\t 118\r\n#define CONF_F_NCONF_DUMP_BIO\t\t\t\t 105\r\n#define CONF_F_NCONF_DUMP_FP\t\t\t\t 106\r\n#define CONF_F_NCONF_GET_NUMBER\t\t\t\t 107\r\n#define CONF_F_NCONF_GET_NUMBER_E\t\t\t 112\r\n#define CONF_F_NCONF_GET_SECTION\t\t\t 108\r\n#define CONF_F_NCONF_GET_STRING\t\t\t\t 109\r\n#define CONF_F_NCONF_LOAD\t\t\t\t 113\r\n#define CONF_F_NCONF_LOAD_BIO\t\t\t\t 110\r\n#define CONF_F_NCONF_LOAD_FP\t\t\t\t 114\r\n#define CONF_F_NCONF_NEW\t\t\t\t 111\r\n#define CONF_F_STR_COPY\t\t\t\t\t 101\r\n\r\n/* Reason codes. */\r\n#define CONF_R_ERROR_LOADING_DSO\t\t\t 110\r\n#define CONF_R_LIST_CANNOT_BE_NULL\t\t\t 115\r\n#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET\t\t 100\r\n#define CONF_R_MISSING_EQUAL_SIGN\t\t\t 101\r\n#define CONF_R_MISSING_FINISH_FUNCTION\t\t\t 111\r\n#define CONF_R_MISSING_INIT_FUNCTION\t\t\t 112\r\n#define CONF_R_MODULE_INITIALIZATION_ERROR\t\t 109\r\n#define CONF_R_NO_CLOSE_BRACE\t\t\t\t 102\r\n#define CONF_R_NO_CONF\t\t\t\t\t 105\r\n#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE\t\t 106\r\n#define CONF_R_NO_SECTION\t\t\t\t 107\r\n#define CONF_R_NO_SUCH_FILE\t\t\t\t 114\r\n#define CONF_R_NO_VALUE\t\t\t\t\t 108\r\n#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION\t\t 103\r\n#define CONF_R_UNKNOWN_MODULE_NAME\t\t\t 113\r\n#define CONF_R_VARIABLE_HAS_NO_VALUE\t\t\t 104\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/conf_api.h",
    "content": "/* conf_api.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef  HEADER_CONF_API_H\r\n#define HEADER_CONF_API_H\r\n\r\n#include <openssl/lhash.h>\r\n#include <openssl/conf.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Up until OpenSSL 0.9.5a, this was new_section */\r\nCONF_VALUE *_CONF_new_section(CONF *conf, const char *section);\r\n/* Up until OpenSSL 0.9.5a, this was get_section */\r\nCONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);\r\n/* Up until OpenSSL 0.9.5a, this was CONF_get_section */\r\nSTACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,\r\n\t\t\t\t\t       const char *section);\r\n\r\nint _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);\r\nchar *_CONF_get_string(const CONF *conf, const char *section,\r\n\t\t       const char *name);\r\nlong _CONF_get_number(const CONF *conf, const char *section, const char *name);\r\n\r\nint _CONF_new_data(CONF *conf);\r\nvoid _CONF_free_data(CONF *conf);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/crypto.h",
    "content": "/* crypto/crypto.h */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n * ECDH support in OpenSSL originally developed by \r\n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\r\n */\r\n\r\n#ifndef HEADER_CRYPTO_H\r\n#define HEADER_CRYPTO_H\r\n\r\n#include <stdlib.h>\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\n#include <stdio.h>\r\n#endif\r\n\r\n#include <openssl/stack.h>\r\n#include <openssl/safestack.h>\r\n#include <openssl/opensslv.h>\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifdef CHARSET_EBCDIC\r\n#include <openssl/ebcdic.h>\r\n#endif\r\n\r\n/* Resolve problems on some operating systems with symbol names that clash\r\n   one way or another */\r\n#include <openssl/symhacks.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Backward compatibility to SSLeay */\r\n/* This is more to be used to check the correct DLL is being used\r\n * in the MS world. */\r\n#define SSLEAY_VERSION_NUMBER\tOPENSSL_VERSION_NUMBER\r\n#define SSLEAY_VERSION\t\t0\r\n/* #define SSLEAY_OPTIONS\t1 no longer supported */\r\n#define SSLEAY_CFLAGS\t\t2\r\n#define SSLEAY_BUILT_ON\t\t3\r\n#define SSLEAY_PLATFORM\t\t4\r\n#define SSLEAY_DIR\t\t5\r\n\r\n/* Already declared in ossl_typ.h */\r\n#if 0\r\ntypedef struct crypto_ex_data_st CRYPTO_EX_DATA;\r\n/* Called when a new object is created */\r\ntypedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\r\n\t\t\t\t\tint idx, long argl, void *argp);\r\n/* Called when an object is free()ed */\r\ntypedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\r\n\t\t\t\t\tint idx, long argl, void *argp);\r\n/* Called when we need to dup an object */\r\ntypedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, \r\n\t\t\t\t\tint idx, long argl, void *argp);\r\n#endif\r\n\r\n/* A generic structure to pass assorted data in a expandable way */\r\ntypedef struct openssl_item_st\r\n\t{\r\n\tint code;\r\n\tvoid *value;\t\t/* Not used for flag attributes */\r\n\tsize_t value_size;\t/* Max size of value for output, length for input */\r\n\tsize_t *value_length;\t/* Returned length of value for output */\r\n\t} OPENSSL_ITEM;\r\n\r\n\r\n/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock\r\n * names in cryptlib.c\r\n */\r\n\r\n#define\tCRYPTO_LOCK_ERR\t\t\t1\r\n#define\tCRYPTO_LOCK_EX_DATA\t\t2\r\n#define\tCRYPTO_LOCK_X509\t\t3\r\n#define\tCRYPTO_LOCK_X509_INFO\t\t4\r\n#define\tCRYPTO_LOCK_X509_PKEY\t\t5\r\n#define CRYPTO_LOCK_X509_CRL\t\t6\r\n#define CRYPTO_LOCK_X509_REQ\t\t7\r\n#define CRYPTO_LOCK_DSA\t\t\t8\r\n#define CRYPTO_LOCK_RSA\t\t\t9\r\n#define CRYPTO_LOCK_EVP_PKEY\t\t10\r\n#define CRYPTO_LOCK_X509_STORE\t\t11\r\n#define CRYPTO_LOCK_SSL_CTX\t\t12\r\n#define CRYPTO_LOCK_SSL_CERT\t\t13\r\n#define CRYPTO_LOCK_SSL_SESSION\t\t14\r\n#define CRYPTO_LOCK_SSL_SESS_CERT\t15\r\n#define CRYPTO_LOCK_SSL\t\t\t16\r\n#define CRYPTO_LOCK_SSL_METHOD\t\t17\r\n#define CRYPTO_LOCK_RAND\t\t18\r\n#define CRYPTO_LOCK_RAND2\t\t19\r\n#define CRYPTO_LOCK_MALLOC\t\t20\r\n#define CRYPTO_LOCK_BIO\t\t\t21\r\n#define CRYPTO_LOCK_GETHOSTBYNAME\t22\r\n#define CRYPTO_LOCK_GETSERVBYNAME\t23\r\n#define CRYPTO_LOCK_READDIR\t\t24\r\n#define CRYPTO_LOCK_RSA_BLINDING\t25\r\n#define CRYPTO_LOCK_DH\t\t\t26\r\n#define CRYPTO_LOCK_MALLOC2\t\t27\r\n#define CRYPTO_LOCK_DSO\t\t\t28\r\n#define CRYPTO_LOCK_DYNLOCK\t\t29\r\n#define CRYPTO_LOCK_ENGINE\t\t30\r\n#define CRYPTO_LOCK_UI\t\t\t31\r\n#define CRYPTO_LOCK_ECDSA               32\r\n#define CRYPTO_LOCK_EC\t\t\t33\r\n#define CRYPTO_LOCK_ECDH\t\t34\r\n#define CRYPTO_LOCK_BN  \t\t35\r\n#define CRYPTO_LOCK_EC_PRE_COMP\t\t36\r\n#define CRYPTO_LOCK_STORE\t\t37\r\n#define CRYPTO_LOCK_COMP\t\t38\r\n#define CRYPTO_LOCK_FIPS\t\t39\r\n#define CRYPTO_LOCK_FIPS2\t\t40\r\n#define CRYPTO_NUM_LOCKS\t\t41\r\n\r\n#define CRYPTO_LOCK\t\t1\r\n#define CRYPTO_UNLOCK\t\t2\r\n#define CRYPTO_READ\t\t4\r\n#define CRYPTO_WRITE\t\t8\r\n\r\n#ifndef OPENSSL_NO_LOCKING\r\n#ifndef CRYPTO_w_lock\r\n#define CRYPTO_w_lock(type)\t\\\r\n\tCRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)\r\n#define CRYPTO_w_unlock(type)\t\\\r\n\tCRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)\r\n#define CRYPTO_r_lock(type)\t\\\r\n\tCRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)\r\n#define CRYPTO_r_unlock(type)\t\\\r\n\tCRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)\r\n#define CRYPTO_add(addr,amount,type)\t\\\r\n\tCRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)\r\n#endif\r\n#else\r\n#define CRYPTO_w_lock(a)\r\n#define CRYPTO_w_unlock(a)\r\n#define CRYPTO_r_lock(a)\r\n#define CRYPTO_r_unlock(a)\r\n#define CRYPTO_add(a,b,c)\t((*(a))+=(b))\r\n#endif\r\n\r\n/* Some applications as well as some parts of OpenSSL need to allocate\r\n   and deallocate locks in a dynamic fashion.  The following typedef\r\n   makes this possible in a type-safe manner.  */\r\n/* struct CRYPTO_dynlock_value has to be defined by the application. */\r\ntypedef struct\r\n\t{\r\n\tint references;\r\n\tstruct CRYPTO_dynlock_value *data;\r\n\t} CRYPTO_dynlock;\r\n\r\n\r\n/* The following can be used to detect memory leaks in the SSLeay library.\r\n * It used, it turns on malloc checking */\r\n\r\n#define CRYPTO_MEM_CHECK_OFF\t0x0\t/* an enume */\r\n#define CRYPTO_MEM_CHECK_ON\t0x1\t/* a bit */\r\n#define CRYPTO_MEM_CHECK_ENABLE\t0x2\t/* a bit */\r\n#define CRYPTO_MEM_CHECK_DISABLE 0x3\t/* an enume */\r\n\r\n/* The following are bit values to turn on or off options connected to the\r\n * malloc checking functionality */\r\n\r\n/* Adds time to the memory checking information */\r\n#define V_CRYPTO_MDEBUG_TIME\t0x1 /* a bit */\r\n/* Adds thread number to the memory checking information */\r\n#define V_CRYPTO_MDEBUG_THREAD\t0x2 /* a bit */\r\n\r\n#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)\r\n\r\n\r\n/* predec of the BIO type */\r\ntypedef struct bio_st BIO_dummy;\r\n\r\nstruct crypto_ex_data_st\r\n\t{\r\n\tSTACK_OF(void) *sk;\r\n\tint dummy; /* gcc is screwing up this data structure :-( */\r\n\t};\r\nDECLARE_STACK_OF(void)\r\n\r\n/* This stuff is basically class callback functions\r\n * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */\r\n\r\ntypedef struct crypto_ex_data_func_st\r\n\t{\r\n\tlong argl;\t/* Arbitary long */\r\n\tvoid *argp;\t/* Arbitary void * */\r\n\tCRYPTO_EX_new *new_func;\r\n\tCRYPTO_EX_free *free_func;\r\n\tCRYPTO_EX_dup *dup_func;\r\n\t} CRYPTO_EX_DATA_FUNCS;\r\n\r\nDECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)\r\n\r\n/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA\r\n * entry.\r\n */\r\n\r\n#define CRYPTO_EX_INDEX_BIO\t\t0\r\n#define CRYPTO_EX_INDEX_SSL\t\t1\r\n#define CRYPTO_EX_INDEX_SSL_CTX\t\t2\r\n#define CRYPTO_EX_INDEX_SSL_SESSION\t3\r\n#define CRYPTO_EX_INDEX_X509_STORE\t4\r\n#define CRYPTO_EX_INDEX_X509_STORE_CTX\t5\r\n#define CRYPTO_EX_INDEX_RSA\t\t6\r\n#define CRYPTO_EX_INDEX_DSA\t\t7\r\n#define CRYPTO_EX_INDEX_DH\t\t8\r\n#define CRYPTO_EX_INDEX_ENGINE\t\t9\r\n#define CRYPTO_EX_INDEX_X509\t\t10\r\n#define CRYPTO_EX_INDEX_UI\t\t11\r\n#define CRYPTO_EX_INDEX_ECDSA\t\t12\r\n#define CRYPTO_EX_INDEX_ECDH\t\t13\r\n#define CRYPTO_EX_INDEX_COMP\t\t14\r\n#define CRYPTO_EX_INDEX_STORE\t\t15\r\n\r\n/* Dynamically assigned indexes start from this value (don't use directly, use\r\n * via CRYPTO_ex_data_new_class). */\r\n#define CRYPTO_EX_INDEX_USER\t\t100\r\n\r\n\r\n/* This is the default callbacks, but we can have others as well:\r\n * this is needed in Win32 where the application malloc and the\r\n * library malloc may not be the same.\r\n */\r\n#define CRYPTO_malloc_init()\tCRYPTO_set_mem_functions(\\\r\n\tmalloc, realloc, free)\r\n\r\n#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD\r\n# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */\r\n#  define CRYPTO_MDEBUG\r\n# endif\r\n#endif\r\n\r\n/* Set standard debugging functions (not done by default\r\n * unless CRYPTO_MDEBUG is defined) */\r\n#define CRYPTO_malloc_debug_init()\tdo {\\\r\n\tCRYPTO_set_mem_debug_functions(\\\r\n\t\tCRYPTO_dbg_malloc,\\\r\n\t\tCRYPTO_dbg_realloc,\\\r\n\t\tCRYPTO_dbg_free,\\\r\n\t\tCRYPTO_dbg_set_options,\\\r\n\t\tCRYPTO_dbg_get_options);\\\r\n\t} while(0)\r\n\r\nint CRYPTO_mem_ctrl(int mode);\r\nint CRYPTO_is_mem_check_on(void);\r\n\r\n/* for applications */\r\n#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)\r\n#define MemCheck_stop()\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)\r\n\r\n/* for library-internal use */\r\n#define MemCheck_on()\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)\r\n#define MemCheck_off()\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)\r\n#define is_MemCheck_on() CRYPTO_is_mem_check_on()\r\n\r\n#define OPENSSL_malloc(num)\tCRYPTO_malloc((int)num,__FILE__,__LINE__)\r\n#define OPENSSL_strdup(str)\tCRYPTO_strdup((str),__FILE__,__LINE__)\r\n#define OPENSSL_realloc(addr,num) \\\r\n\tCRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)\r\n#define OPENSSL_realloc_clean(addr,old_num,num) \\\r\n\tCRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)\r\n#define OPENSSL_remalloc(addr,num) \\\r\n\tCRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)\r\n#define OPENSSL_freeFunc\tCRYPTO_free\r\n#define OPENSSL_free(addr)\tCRYPTO_free(addr)\r\n\r\n#define OPENSSL_malloc_locked(num) \\\r\n\tCRYPTO_malloc_locked((int)num,__FILE__,__LINE__)\r\n#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)\r\n\r\n\r\nconst char *SSLeay_version(int type);\r\nunsigned long SSLeay(void);\r\n\r\nint OPENSSL_issetugid(void);\r\n\r\n/* An opaque type representing an implementation of \"ex_data\" support */\r\ntypedef struct st_CRYPTO_EX_DATA_IMPL\tCRYPTO_EX_DATA_IMPL;\r\n/* Return an opaque pointer to the current \"ex_data\" implementation */\r\nconst CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);\r\n/* Sets the \"ex_data\" implementation to be used (if it's not too late) */\r\nint CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);\r\n/* Get a new \"ex_data\" class, and return the corresponding \"class_index\" */\r\nint CRYPTO_ex_data_new_class(void);\r\n/* Within a given class, get/register a new index */\r\nint CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,\r\n\t\tCRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,\r\n\t\tCRYPTO_EX_free *free_func);\r\n/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given\r\n * class (invokes whatever per-class callbacks are applicable) */\r\nint CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);\r\nint CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,\r\n\t\tCRYPTO_EX_DATA *from);\r\nvoid CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);\r\n/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index\r\n * (relative to the class type involved) */\r\nint CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);\r\nvoid *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);\r\n/* This function cleans up all \"ex_data\" state. It mustn't be called under\r\n * potential race-conditions. */\r\nvoid CRYPTO_cleanup_all_ex_data(void);\r\n\r\nint CRYPTO_get_new_lockid(char *name);\r\n\r\nint CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */\r\nvoid CRYPTO_lock(int mode, int type,const char *file,int line);\r\nvoid CRYPTO_set_locking_callback(void (*func)(int mode,int type,\r\n\t\t\t\t\t      const char *file,int line));\r\nvoid (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,\r\n\t\tint line);\r\nvoid CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,\r\n\t\t\t\t\t      const char *file, int line));\r\nint (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,\r\n\t\t\t\t\t  const char *file,int line);\r\n\r\n/* Don't use this structure directly. */\r\ntypedef struct crypto_threadid_st\r\n\t{\r\n\tvoid *ptr;\r\n\tunsigned long val;\r\n\t} CRYPTO_THREADID;\r\n/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */\r\nvoid CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);\r\nvoid CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);\r\nint CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *));\r\nvoid (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);\r\nvoid CRYPTO_THREADID_current(CRYPTO_THREADID *id);\r\nint CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);\r\nvoid CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);\r\nunsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nvoid CRYPTO_set_id_callback(unsigned long (*func)(void));\r\nunsigned long (*CRYPTO_get_id_callback(void))(void);\r\nunsigned long CRYPTO_thread_id(void);\r\n#endif\r\n\r\nconst char *CRYPTO_get_lock_name(int type);\r\nint CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,\r\n\t\t    int line);\r\n\r\nint CRYPTO_get_new_dynlockid(void);\r\nvoid CRYPTO_destroy_dynlockid(int i);\r\nstruct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);\r\nvoid CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));\r\nvoid CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));\r\nvoid CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));\r\nstruct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);\r\nvoid (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);\r\nvoid (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);\r\n\r\n/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --\r\n * call the latter last if you need different functions */\r\nint CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));\r\nint CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));\r\nint CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),\r\n                                void *(*r)(void *,size_t,const char *,int),\r\n                                void (*f)(void *));\r\nint CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),\r\n                                       void (*free_func)(void *));\r\nint CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),\r\n\t\t\t\t   void (*r)(void *,void *,int,const char *,int,int),\r\n\t\t\t\t   void (*f)(void *,int),\r\n\t\t\t\t   void (*so)(long),\r\n\t\t\t\t   long (*go)(void));\r\nvoid CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));\r\nvoid CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));\r\nvoid CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),\r\n                                 void *(**r)(void *, size_t,const char *,int),\r\n                                 void (**f)(void *));\r\nvoid CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),\r\n                                        void (**f)(void *));\r\nvoid CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),\r\n\t\t\t\t    void (**r)(void *,void *,int,const char *,int,int),\r\n\t\t\t\t    void (**f)(void *,int),\r\n\t\t\t\t    void (**so)(long),\r\n\t\t\t\t    long (**go)(void));\r\n\r\nvoid *CRYPTO_malloc_locked(int num, const char *file, int line);\r\nvoid CRYPTO_free_locked(void *);\r\nvoid *CRYPTO_malloc(int num, const char *file, int line);\r\nchar *CRYPTO_strdup(const char *str, const char *file, int line);\r\nvoid CRYPTO_free(void *);\r\nvoid *CRYPTO_realloc(void *addr,int num, const char *file, int line);\r\nvoid *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,\r\n\t\t\t   int line);\r\nvoid *CRYPTO_remalloc(void *addr,int num, const char *file, int line);\r\n\r\nvoid OPENSSL_cleanse(void *ptr, size_t len);\r\n\r\nvoid CRYPTO_set_mem_debug_options(long bits);\r\nlong CRYPTO_get_mem_debug_options(void);\r\n\r\n#define CRYPTO_push_info(info) \\\r\n        CRYPTO_push_info_(info, __FILE__, __LINE__);\r\nint CRYPTO_push_info_(const char *info, const char *file, int line);\r\nint CRYPTO_pop_info(void);\r\nint CRYPTO_remove_all_info(void);\r\n\r\n\r\n/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;\r\n * used as default in CRYPTO_MDEBUG compilations): */\r\n/* The last argument has the following significance:\r\n *\r\n * 0:\tcalled before the actual memory allocation has taken place\r\n * 1:\tcalled after the actual memory allocation has taken place\r\n */\r\nvoid CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);\r\nvoid CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);\r\nvoid CRYPTO_dbg_free(void *addr,int before_p);\r\n/* Tell the debugging code about options.  By default, the following values\r\n * apply:\r\n *\r\n * 0:                           Clear all options.\r\n * V_CRYPTO_MDEBUG_TIME (1):    Set the \"Show Time\" option.\r\n * V_CRYPTO_MDEBUG_THREAD (2):  Set the \"Show Thread Number\" option.\r\n * V_CRYPTO_MDEBUG_ALL (3):     1 + 2\r\n */\r\nvoid CRYPTO_dbg_set_options(long bits);\r\nlong CRYPTO_dbg_get_options(void);\r\n\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\nvoid CRYPTO_mem_leaks_fp(FILE *);\r\n#endif\r\nvoid CRYPTO_mem_leaks(struct bio_st *bio);\r\n/* unsigned long order, char *file, int line, int num_bytes, char *addr */\r\ntypedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);\r\nvoid CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);\r\n\r\n/* die if we have to */\r\nvoid OpenSSLDie(const char *file,int line,const char *assertion);\r\n#define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))\r\n\r\nunsigned long *OPENSSL_ia32cap_loc(void);\r\n#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))\r\nint OPENSSL_isservice(void);\r\n\r\nint FIPS_mode(void);\r\nint FIPS_mode_set(int r);\r\n\r\nvoid OPENSSL_init(void);\r\n\r\n#define fips_md_init(alg) fips_md_init_ctx(alg, alg)\r\n\r\n#ifdef OPENSSL_FIPS\r\n#define fips_md_init_ctx(alg, cx) \\\r\n\tint alg##_Init(cx##_CTX *c) \\\r\n\t{ \\\r\n\tif (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \\\r\n\t\t\"Low level API call to digest \" #alg \" forbidden in FIPS mode!\"); \\\r\n\treturn private_##alg##_Init(c); \\\r\n\t} \\\r\n\tint private_##alg##_Init(cx##_CTX *c)\r\n\r\n#define fips_cipher_abort(alg) \\\r\n\tif (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \\\r\n\t\t\"Low level API call to cipher \" #alg \" forbidden in FIPS mode!\")\r\n\r\n#else\r\n#define fips_md_init_ctx(alg, cx) \\\r\n\tint alg##_Init(cx##_CTX *c)\r\n#define fips_cipher_abort(alg) while(0)\r\n#endif\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_CRYPTO_strings(void);\r\n\r\n/* Error codes for the CRYPTO functions. */\r\n\r\n/* Function codes. */\r\n#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX\t\t 100\r\n#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID\t\t 103\r\n#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID\t\t\t 101\r\n#define CRYPTO_F_CRYPTO_SET_EX_DATA\t\t\t 102\r\n#define CRYPTO_F_DEF_ADD_INDEX\t\t\t\t 104\r\n#define CRYPTO_F_DEF_GET_CLASS\t\t\t\t 105\r\n#define CRYPTO_F_FIPS_MODE_SET\t\t\t\t 109\r\n#define CRYPTO_F_INT_DUP_EX_DATA\t\t\t 106\r\n#define CRYPTO_F_INT_FREE_EX_DATA\t\t\t 107\r\n#define CRYPTO_F_INT_NEW_EX_DATA\t\t\t 108\r\n\r\n/* Reason codes. */\r\n#define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED\t\t 101\r\n#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK\t\t 100\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/des.h",
    "content": "/* crypto/des/des.h */\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_NEW_DES_H\r\n#define HEADER_NEW_DES_H\r\n\r\n#include <openssl/e_os2.h>\t/* OPENSSL_EXTERN, OPENSSL_NO_DES,\r\n\t\t\t\t   DES_LONG (via openssl/opensslconf.h */\r\n\r\n#ifdef OPENSSL_NO_DES\r\n#error DES is disabled.\r\n#endif\r\n\r\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\r\n# undef OPENSSL_EXTERN\r\n# define OPENSSL_EXTERN OPENSSL_EXPORT\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef unsigned char DES_cblock[8];\r\ntypedef /* const */ unsigned char const_DES_cblock[8];\r\n/* With \"const\", gcc 2.8.1 on Solaris thinks that DES_cblock *\r\n * and const_DES_cblock * are incompatible pointer types. */\r\n\r\ntypedef struct DES_ks\r\n    {\r\n    union\r\n\t{\r\n\tDES_cblock cblock;\r\n\t/* make sure things are correct size on machines with\r\n\t * 8 byte longs */\r\n\tDES_LONG deslong[2];\r\n\t} ks[16];\r\n    } DES_key_schedule;\r\n\r\n#ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT\r\n# ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT\r\n#  define OPENSSL_ENABLE_OLD_DES_SUPPORT\r\n# endif\r\n#endif\r\n\r\n#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT\r\n# include <openssl/des_old.h>\r\n#endif\r\n\r\n#define DES_KEY_SZ \t(sizeof(DES_cblock))\r\n#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))\r\n\r\n#define DES_ENCRYPT\t1\r\n#define DES_DECRYPT\t0\r\n\r\n#define DES_CBC_MODE\t0\r\n#define DES_PCBC_MODE\t1\r\n\r\n#define DES_ecb2_encrypt(i,o,k1,k2,e) \\\r\n\tDES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))\r\n\r\n#define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \\\r\n\tDES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))\r\n\r\n#define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \\\r\n\tDES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))\r\n\r\n#define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \\\r\n\tDES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))\r\n\r\nOPENSSL_DECLARE_GLOBAL(int,DES_check_key);\t/* defaults to false */\r\n#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)\r\nOPENSSL_DECLARE_GLOBAL(int,DES_rw_mode);\t/* defaults to DES_PCBC_MODE */\r\n#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)\r\n\r\nconst char *DES_options(void);\r\nvoid DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,\r\n\t\t      DES_key_schedule *ks1,DES_key_schedule *ks2,\r\n\t\t      DES_key_schedule *ks3, int enc);\r\nDES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output,\r\n\t\t       long length,DES_key_schedule *schedule,\r\n\t\t       const_DES_cblock *ivec);\r\n/* DES_cbc_encrypt does not update the IV!  Use DES_ncbc_encrypt instead. */\r\nvoid DES_cbc_encrypt(const unsigned char *input,unsigned char *output,\r\n\t\t     long length,DES_key_schedule *schedule,DES_cblock *ivec,\r\n\t\t     int enc);\r\nvoid DES_ncbc_encrypt(const unsigned char *input,unsigned char *output,\r\n\t\t      long length,DES_key_schedule *schedule,DES_cblock *ivec,\r\n\t\t      int enc);\r\nvoid DES_xcbc_encrypt(const unsigned char *input,unsigned char *output,\r\n\t\t      long length,DES_key_schedule *schedule,DES_cblock *ivec,\r\n\t\t      const_DES_cblock *inw,const_DES_cblock *outw,int enc);\r\nvoid DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits,\r\n\t\t     long length,DES_key_schedule *schedule,DES_cblock *ivec,\r\n\t\t     int enc);\r\nvoid DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output,\r\n\t\t     DES_key_schedule *ks,int enc);\r\n\r\n/* \tThis is the DES encryption function that gets called by just about\r\n\tevery other DES routine in the library.  You should not use this\r\n\tfunction except to implement 'modes' of DES.  I say this because the\r\n\tfunctions that call this routine do the conversion from 'char *' to\r\n\tlong, and this needs to be done to make sure 'non-aligned' memory\r\n\taccess do not occur.  The characters are loaded 'little endian'.\r\n\tData is a pointer to 2 unsigned long's and ks is the\r\n\tDES_key_schedule to use.  enc, is non zero specifies encryption,\r\n\tzero if decryption. */\r\nvoid DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc);\r\n\r\n/* \tThis functions is the same as DES_encrypt1() except that the DES\r\n\tinitial permutation (IP) and final permutation (FP) have been left\r\n\tout.  As for DES_encrypt1(), you should not use this function.\r\n\tIt is used by the routines in the library that implement triple DES.\r\n\tIP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same\r\n\tas DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */\r\nvoid DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc);\r\n\r\nvoid DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,\r\n\t\t  DES_key_schedule *ks2, DES_key_schedule *ks3);\r\nvoid DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,\r\n\t\t  DES_key_schedule *ks2, DES_key_schedule *ks3);\r\nvoid DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, \r\n\t\t\t  long length,\r\n\t\t\t  DES_key_schedule *ks1,DES_key_schedule *ks2,\r\n\t\t\t  DES_key_schedule *ks3,DES_cblock *ivec,int enc);\r\nvoid DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out,\r\n\t\t\t   long length,\r\n\t\t\t   DES_key_schedule *ks1,DES_key_schedule *ks2,\r\n\t\t\t   DES_key_schedule *ks3,\r\n\t\t\t   DES_cblock *ivec1,DES_cblock *ivec2,\r\n\t\t\t   int enc);\r\nvoid DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out,\r\n\t\t\t    long length,DES_key_schedule *ks1,\r\n\t\t\t    DES_key_schedule *ks2,DES_key_schedule *ks3,\r\n\t\t\t    DES_cblock *ivec,int *num,int enc);\r\nvoid DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,\r\n\t\t\t  int numbits,long length,DES_key_schedule *ks1,\r\n\t\t\t  DES_key_schedule *ks2,DES_key_schedule *ks3,\r\n\t\t\t  DES_cblock *ivec,int enc);\r\nvoid DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,\r\n\t\t\t    long length,DES_key_schedule *ks1,\r\n\t\t\t    DES_key_schedule *ks2,DES_key_schedule *ks3,\r\n\t\t\t    DES_cblock *ivec,int *num);\r\n#if 0\r\nvoid DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white,\r\n\t\t       DES_cblock *out_white);\r\n#endif\r\n\r\nint DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched,\r\n\t\t DES_cblock *iv);\r\nint DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched,\r\n\t\t  DES_cblock *iv);\r\nchar *DES_fcrypt(const char *buf,const char *salt, char *ret);\r\nchar *DES_crypt(const char *buf,const char *salt);\r\nvoid DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits,\r\n\t\t     long length,DES_key_schedule *schedule,DES_cblock *ivec);\r\nvoid DES_pcbc_encrypt(const unsigned char *input,unsigned char *output,\r\n\t\t      long length,DES_key_schedule *schedule,DES_cblock *ivec,\r\n\t\t      int enc);\r\nDES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[],\r\n\t\t\tlong length,int out_count,DES_cblock *seed);\r\nint DES_random_key(DES_cblock *ret);\r\nvoid DES_set_odd_parity(DES_cblock *key);\r\nint DES_check_key_parity(const_DES_cblock *key);\r\nint DES_is_weak_key(const_DES_cblock *key);\r\n/* DES_set_key (= set_key = DES_key_sched = key_sched) calls\r\n * DES_set_key_checked if global variable DES_check_key is set,\r\n * DES_set_key_unchecked otherwise. */\r\nint DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule);\r\nint DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule);\r\nint DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule);\r\nvoid DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule);\r\n#ifdef OPENSSL_FIPS\r\nvoid private_DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule);\r\n#endif\r\nvoid DES_string_to_key(const char *str,DES_cblock *key);\r\nvoid DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2);\r\nvoid DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length,\r\n\t\t       DES_key_schedule *schedule,DES_cblock *ivec,int *num,\r\n\t\t       int enc);\r\nvoid DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length,\r\n\t\t       DES_key_schedule *schedule,DES_cblock *ivec,int *num);\r\n\r\nint DES_read_password(DES_cblock *key, const char *prompt, int verify);\r\nint DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,\r\n\tint verify);\r\n\r\n#define DES_fixup_key_parity DES_set_odd_parity\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/des_old.h",
    "content": "/* crypto/des/des_old.h -*- mode:C; c-file-style: \"eay\" -*- */\r\n\r\n/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\r\n *\r\n * The function names in here are deprecated and are only present to\r\n * provide an interface compatible with openssl 0.9.6 and older as\r\n * well as libdes.  OpenSSL now provides functions where \"des_\" has\r\n * been replaced with \"DES_\" in the names, to make it possible to\r\n * make incompatible changes that are needed for C type security and\r\n * other stuff.\r\n *\r\n * This include files has two compatibility modes:\r\n *\r\n *   - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API\r\n *     that is compatible with libdes and SSLeay.\r\n *   - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an\r\n *     API that is compatible with OpenSSL 0.9.5x to 0.9.6x.\r\n *\r\n * Note that these modes break earlier snapshots of OpenSSL, where\r\n * libdes compatibility was the only available mode or (later on) the\r\n * prefered compatibility mode.  However, after much consideration\r\n * (and more or less violent discussions with external parties), it\r\n * was concluded that OpenSSL should be compatible with earlier versions\r\n * of itself before anything else.  Also, in all honesty, libdes is\r\n * an old beast that shouldn't really be used any more.\r\n *\r\n * Please consider starting to use the DES_ functions rather than the\r\n * des_ ones.  The des_ functions will disappear completely before\r\n * OpenSSL 1.0!\r\n *\r\n * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\r\n */\r\n\r\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\r\n * project 2001.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_DES_H\r\n#define HEADER_DES_H\r\n\r\n#include <openssl/e_os2.h>\t/* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */\r\n\r\n#ifdef OPENSSL_NO_DES\r\n#error DES is disabled.\r\n#endif\r\n\r\n#ifndef HEADER_NEW_DES_H\r\n#error You must include des.h, not des_old.h directly.\r\n#endif\r\n\r\n#ifdef _KERBEROS_DES_H\r\n#error <openssl/des_old.h> replaces <kerberos/des.h>.\r\n#endif\r\n\r\n#include <openssl/symhacks.h>\r\n\r\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\r\n# undef OPENSSL_EXTERN\r\n# define OPENSSL_EXTERN OPENSSL_EXPORT\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef _\r\n#undef _\r\n#endif\r\n\r\ntypedef unsigned char _ossl_old_des_cblock[8];\r\ntypedef struct _ossl_old_des_ks_struct\r\n\t{\r\n\tunion\t{\r\n\t\t_ossl_old_des_cblock _;\r\n\t\t/* make sure things are correct size on machines with\r\n\t\t * 8 byte longs */\r\n\t\tDES_LONG pad[2];\r\n\t\t} ks;\r\n\t} _ossl_old_des_key_schedule[16];\r\n\r\n#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY\r\n#define des_cblock DES_cblock\r\n#define const_des_cblock const_DES_cblock\r\n#define des_key_schedule DES_key_schedule\r\n#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\\\r\n\tDES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))\r\n#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\\\r\n\tDES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))\r\n#define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\\\r\n\tDES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))\r\n#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\\\r\n\tDES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))\r\n#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\\\r\n\tDES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))\r\n#define des_options()\\\r\n\tDES_options()\r\n#define des_cbc_cksum(i,o,l,k,iv)\\\r\n\tDES_cbc_cksum((i),(o),(l),&(k),(iv))\r\n#define des_cbc_encrypt(i,o,l,k,iv,e)\\\r\n\tDES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))\r\n#define des_ncbc_encrypt(i,o,l,k,iv,e)\\\r\n\tDES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))\r\n#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\\\r\n\tDES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))\r\n#define des_cfb_encrypt(i,o,n,l,k,iv,e)\\\r\n\tDES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))\r\n#define des_ecb_encrypt(i,o,k,e)\\\r\n\tDES_ecb_encrypt((i),(o),&(k),(e))\r\n#define des_encrypt1(d,k,e)\\\r\n\tDES_encrypt1((d),&(k),(e))\r\n#define des_encrypt2(d,k,e)\\\r\n\tDES_encrypt2((d),&(k),(e))\r\n#define des_encrypt3(d,k1,k2,k3)\\\r\n\tDES_encrypt3((d),&(k1),&(k2),&(k3))\r\n#define des_decrypt3(d,k1,k2,k3)\\\r\n\tDES_decrypt3((d),&(k1),&(k2),&(k3))\r\n#define des_xwhite_in2out(k,i,o)\\\r\n\tDES_xwhite_in2out((k),(i),(o))\r\n#define des_enc_read(f,b,l,k,iv)\\\r\n\tDES_enc_read((f),(b),(l),&(k),(iv))\r\n#define des_enc_write(f,b,l,k,iv)\\\r\n\tDES_enc_write((f),(b),(l),&(k),(iv))\r\n#define des_fcrypt(b,s,r)\\\r\n\tDES_fcrypt((b),(s),(r))\r\n#if 0\r\n#define des_crypt(b,s)\\\r\n\tDES_crypt((b),(s))\r\n#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)\r\n#define crypt(b,s)\\\r\n\tDES_crypt((b),(s))\r\n#endif\r\n#endif\r\n#define des_ofb_encrypt(i,o,n,l,k,iv)\\\r\n\tDES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))\r\n#define des_pcbc_encrypt(i,o,l,k,iv,e)\\\r\n\tDES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))\r\n#define des_quad_cksum(i,o,l,c,s)\\\r\n\tDES_quad_cksum((i),(o),(l),(c),(s))\r\n#define des_random_seed(k)\\\r\n\t_ossl_096_des_random_seed((k))\r\n#define des_random_key(r)\\\r\n\tDES_random_key((r))\r\n#define des_read_password(k,p,v) \\\r\n\tDES_read_password((k),(p),(v))\r\n#define des_read_2passwords(k1,k2,p,v) \\\r\n\tDES_read_2passwords((k1),(k2),(p),(v))\r\n#define des_set_odd_parity(k)\\\r\n\tDES_set_odd_parity((k))\r\n#define des_check_key_parity(k)\\\r\n\tDES_check_key_parity((k))\r\n#define des_is_weak_key(k)\\\r\n\tDES_is_weak_key((k))\r\n#define des_set_key(k,ks)\\\r\n\tDES_set_key((k),&(ks))\r\n#define des_key_sched(k,ks)\\\r\n\tDES_key_sched((k),&(ks))\r\n#define des_set_key_checked(k,ks)\\\r\n\tDES_set_key_checked((k),&(ks))\r\n#define des_set_key_unchecked(k,ks)\\\r\n\tDES_set_key_unchecked((k),&(ks))\r\n#define des_string_to_key(s,k)\\\r\n\tDES_string_to_key((s),(k))\r\n#define des_string_to_2keys(s,k1,k2)\\\r\n\tDES_string_to_2keys((s),(k1),(k2))\r\n#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\\\r\n\tDES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))\r\n#define des_ofb64_encrypt(i,o,l,ks,iv,n)\\\r\n\tDES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))\r\n\t\t\r\n\r\n#define des_ecb2_encrypt(i,o,k1,k2,e) \\\r\n\tdes_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))\r\n\r\n#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \\\r\n\tdes_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))\r\n\r\n#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \\\r\n\tdes_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))\r\n\r\n#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \\\r\n\tdes_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))\r\n\r\n#define des_check_key DES_check_key\r\n#define des_rw_mode DES_rw_mode\r\n#else /* libdes compatibility */\r\n/* Map all symbol names to _ossl_old_des_* form, so we avoid all\r\n   clashes with libdes */\r\n#define des_cblock _ossl_old_des_cblock\r\n#define des_key_schedule _ossl_old_des_key_schedule\r\n#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\\\r\n\t_ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))\r\n#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\\\r\n\t_ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))\r\n#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\\\r\n\t_ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))\r\n#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\\\r\n\t_ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))\r\n#define des_options()\\\r\n\t_ossl_old_des_options()\r\n#define des_cbc_cksum(i,o,l,k,iv)\\\r\n\t_ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))\r\n#define des_cbc_encrypt(i,o,l,k,iv,e)\\\r\n\t_ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))\r\n#define des_ncbc_encrypt(i,o,l,k,iv,e)\\\r\n\t_ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))\r\n#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\\\r\n\t_ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))\r\n#define des_cfb_encrypt(i,o,n,l,k,iv,e)\\\r\n\t_ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))\r\n#define des_ecb_encrypt(i,o,k,e)\\\r\n\t_ossl_old_des_ecb_encrypt((i),(o),(k),(e))\r\n#define des_encrypt(d,k,e)\\\r\n\t_ossl_old_des_encrypt((d),(k),(e))\r\n#define des_encrypt2(d,k,e)\\\r\n\t_ossl_old_des_encrypt2((d),(k),(e))\r\n#define des_encrypt3(d,k1,k2,k3)\\\r\n\t_ossl_old_des_encrypt3((d),(k1),(k2),(k3))\r\n#define des_decrypt3(d,k1,k2,k3)\\\r\n\t_ossl_old_des_decrypt3((d),(k1),(k2),(k3))\r\n#define des_xwhite_in2out(k,i,o)\\\r\n\t_ossl_old_des_xwhite_in2out((k),(i),(o))\r\n#define des_enc_read(f,b,l,k,iv)\\\r\n\t_ossl_old_des_enc_read((f),(b),(l),(k),(iv))\r\n#define des_enc_write(f,b,l,k,iv)\\\r\n\t_ossl_old_des_enc_write((f),(b),(l),(k),(iv))\r\n#define des_fcrypt(b,s,r)\\\r\n\t_ossl_old_des_fcrypt((b),(s),(r))\r\n#define des_crypt(b,s)\\\r\n\t_ossl_old_des_crypt((b),(s))\r\n#if 0\r\n#define crypt(b,s)\\\r\n\t_ossl_old_crypt((b),(s))\r\n#endif\r\n#define des_ofb_encrypt(i,o,n,l,k,iv)\\\r\n\t_ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))\r\n#define des_pcbc_encrypt(i,o,l,k,iv,e)\\\r\n\t_ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))\r\n#define des_quad_cksum(i,o,l,c,s)\\\r\n\t_ossl_old_des_quad_cksum((i),(o),(l),(c),(s))\r\n#define des_random_seed(k)\\\r\n\t_ossl_old_des_random_seed((k))\r\n#define des_random_key(r)\\\r\n\t_ossl_old_des_random_key((r))\r\n#define des_read_password(k,p,v) \\\r\n\t_ossl_old_des_read_password((k),(p),(v))\r\n#define des_read_2passwords(k1,k2,p,v) \\\r\n\t_ossl_old_des_read_2passwords((k1),(k2),(p),(v))\r\n#define des_set_odd_parity(k)\\\r\n\t_ossl_old_des_set_odd_parity((k))\r\n#define des_is_weak_key(k)\\\r\n\t_ossl_old_des_is_weak_key((k))\r\n#define des_set_key(k,ks)\\\r\n\t_ossl_old_des_set_key((k),(ks))\r\n#define des_key_sched(k,ks)\\\r\n\t_ossl_old_des_key_sched((k),(ks))\r\n#define des_string_to_key(s,k)\\\r\n\t_ossl_old_des_string_to_key((s),(k))\r\n#define des_string_to_2keys(s,k1,k2)\\\r\n\t_ossl_old_des_string_to_2keys((s),(k1),(k2))\r\n#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\\\r\n\t_ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))\r\n#define des_ofb64_encrypt(i,o,l,ks,iv,n)\\\r\n\t_ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))\r\n\t\t\r\n\r\n#define des_ecb2_encrypt(i,o,k1,k2,e) \\\r\n\tdes_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))\r\n\r\n#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \\\r\n\tdes_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))\r\n\r\n#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \\\r\n\tdes_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))\r\n\r\n#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \\\r\n\tdes_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))\r\n\r\n#define des_check_key DES_check_key\r\n#define des_rw_mode DES_rw_mode\r\n#endif\r\n\r\nconst char *_ossl_old_des_options(void);\r\nvoid _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\r\n\t_ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,\r\n\t_ossl_old_des_key_schedule ks3, int enc);\r\nDES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\r\n\tlong length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);\r\nvoid _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\r\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\r\nvoid _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\r\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\r\nvoid _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\r\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,\r\n\t_ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);\r\nvoid _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,\r\n\tlong length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\r\nvoid _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\r\n\t_ossl_old_des_key_schedule ks,int enc);\r\nvoid _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);\r\nvoid _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);\r\nvoid _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,\r\n\t_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);\r\nvoid _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,\r\n\t_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);\r\nvoid _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, \r\n\tlong length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, \r\n\t_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);\r\nvoid _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,\r\n\tlong length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,\r\n\t_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);\r\nvoid _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,\r\n\tlong length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,\r\n\t_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);\r\n#if 0\r\nvoid _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),\r\n\t_ossl_old_des_cblock (*out_white));\r\n#endif\r\n\r\nint _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,\r\n\t_ossl_old_des_cblock *iv);\r\nint _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,\r\n\t_ossl_old_des_cblock *iv);\r\nchar *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret);\r\nchar *_ossl_old_des_crypt(const char *buf,const char *salt);\r\n#if !defined(PERL5) && !defined(NeXT)\r\nchar *_ossl_old_crypt(const char *buf,const char *salt);\r\n#endif\r\nvoid _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,\r\n\tint numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);\r\nvoid _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\r\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\r\nDES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\r\n\tlong length,int out_count,_ossl_old_des_cblock *seed);\r\nvoid _ossl_old_des_random_seed(_ossl_old_des_cblock key);\r\nvoid _ossl_old_des_random_key(_ossl_old_des_cblock ret);\r\nint _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify);\r\nint _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2,\r\n\tconst char *prompt,int verify);\r\nvoid _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);\r\nint _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);\r\nint _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);\r\nint _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);\r\nvoid _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key);\r\nvoid _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2);\r\nvoid _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,\r\n\t_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);\r\nvoid _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,\r\n\t_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);\r\n\r\nvoid _ossl_096_des_random_seed(des_cblock *key);\r\n\r\n/* The following definitions provide compatibility with the MIT Kerberos\r\n * library. The _ossl_old_des_key_schedule structure is not binary compatible. */\r\n\r\n#define _KERBEROS_DES_H\r\n\r\n#define KRBDES_ENCRYPT DES_ENCRYPT\r\n#define KRBDES_DECRYPT DES_DECRYPT\r\n\r\n#ifdef KERBEROS\r\n#  define ENCRYPT DES_ENCRYPT\r\n#  define DECRYPT DES_DECRYPT\r\n#endif\r\n\r\n#ifndef NCOMPAT\r\n#  define C_Block des_cblock\r\n#  define Key_schedule des_key_schedule\r\n#  define KEY_SZ DES_KEY_SZ\r\n#  define string_to_key des_string_to_key\r\n#  define read_pw_string des_read_pw_string\r\n#  define random_key des_random_key\r\n#  define pcbc_encrypt des_pcbc_encrypt\r\n#  define set_key des_set_key\r\n#  define key_sched des_key_sched\r\n#  define ecb_encrypt des_ecb_encrypt\r\n#  define cbc_encrypt des_cbc_encrypt\r\n#  define ncbc_encrypt des_ncbc_encrypt\r\n#  define xcbc_encrypt des_xcbc_encrypt\r\n#  define cbc_cksum des_cbc_cksum\r\n#  define quad_cksum des_quad_cksum\r\n#  define check_parity des_check_key_parity\r\n#endif\r\n\r\n#define des_fixup_key_parity DES_fixup_key_parity\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n/* for DES_read_pw_string et al */\r\n#include <openssl/ui_compat.h>\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/dh.h",
    "content": "/* crypto/dh/dh.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_DH_H\r\n#define HEADER_DH_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifdef OPENSSL_NO_DH\r\n#error DH is disabled.\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/ossl_typ.h>\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#endif\r\n\t\r\n#ifndef OPENSSL_DH_MAX_MODULUS_BITS\r\n# define OPENSSL_DH_MAX_MODULUS_BITS\t10000\r\n#endif\r\n\r\n#define DH_FLAG_CACHE_MONT_P     0x01\r\n#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH\r\n                                       * implementation now uses constant time\r\n                                       * modular exponentiation for secret exponents\r\n                                       * by default. This flag causes the\r\n                                       * faster variable sliding window method to\r\n                                       * be used for all exponents.\r\n                                       */\r\n\r\n/* If this flag is set the DH method is FIPS compliant and can be used\r\n * in FIPS mode. This is set in the validated module method. If an\r\n * application sets this flag in its own methods it is its reposibility\r\n * to ensure the result is compliant.\r\n */\r\n\r\n#define DH_FLAG_FIPS_METHOD\t\t\t0x0400\r\n\r\n/* If this flag is set the operations normally disabled in FIPS mode are\r\n * permitted it is then the applications responsibility to ensure that the\r\n * usage is compliant.\r\n */\r\n\r\n#define DH_FLAG_NON_FIPS_ALLOW\t\t\t0x0400\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Already defined in ossl_typ.h */\r\n/* typedef struct dh_st DH; */\r\n/* typedef struct dh_method DH_METHOD; */\r\n\r\nstruct dh_method\r\n\t{\r\n\tconst char *name;\r\n\t/* Methods here */\r\n\tint (*generate_key)(DH *dh);\r\n\tint (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);\r\n\tint (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,\r\n\t\t\t\tconst BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\r\n\t\t\t\tBN_MONT_CTX *m_ctx); /* Can be null */\r\n\r\n\tint (*init)(DH *dh);\r\n\tint (*finish)(DH *dh);\r\n\tint flags;\r\n\tchar *app_data;\r\n\t/* If this is non-NULL, it will be used to generate parameters */\r\n\tint (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);\r\n\t};\r\n\r\nstruct dh_st\r\n\t{\r\n\t/* This first argument is used to pick up errors when\r\n\t * a DH is passed instead of a EVP_PKEY */\r\n\tint pad;\r\n\tint version;\r\n\tBIGNUM *p;\r\n\tBIGNUM *g;\r\n\tlong length; /* optional */\r\n\tBIGNUM *pub_key;\t/* g^x */\r\n\tBIGNUM *priv_key;\t/* x */\r\n\r\n\tint flags;\r\n\tBN_MONT_CTX *method_mont_p;\r\n\t/* Place holders if we want to do X9.42 DH */\r\n\tBIGNUM *q;\r\n\tBIGNUM *j;\r\n\tunsigned char *seed;\r\n\tint seedlen;\r\n\tBIGNUM *counter;\r\n\r\n\tint references;\r\n\tCRYPTO_EX_DATA ex_data;\r\n\tconst DH_METHOD *meth;\r\n\tENGINE *engine;\r\n\t};\r\n\r\n#define DH_GENERATOR_2\t\t2\r\n/* #define DH_GENERATOR_3\t3 */\r\n#define DH_GENERATOR_5\t\t5\r\n\r\n/* DH_check error codes */\r\n#define DH_CHECK_P_NOT_PRIME\t\t0x01\r\n#define DH_CHECK_P_NOT_SAFE_PRIME\t0x02\r\n#define DH_UNABLE_TO_CHECK_GENERATOR\t0x04\r\n#define DH_NOT_SUITABLE_GENERATOR\t0x08\r\n\r\n/* DH_check_pub_key error codes */\r\n#define DH_CHECK_PUBKEY_TOO_SMALL\t0x01\r\n#define DH_CHECK_PUBKEY_TOO_LARGE\t0x02\r\n\r\n/* primes p where (p-1)/2 is prime too are called \"safe\"; we define\r\n   this for backward compatibility: */\r\n#define DH_CHECK_P_NOT_STRONG_PRIME\tDH_CHECK_P_NOT_SAFE_PRIME\r\n\r\n#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \\\r\n\t\t(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))\r\n#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \\\r\n\t\t(unsigned char *)(x))\r\n#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)\r\n#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)\r\n\r\nDH *DHparams_dup(DH *);\r\n\r\nconst DH_METHOD *DH_OpenSSL(void);\r\n\r\nvoid DH_set_default_method(const DH_METHOD *meth);\r\nconst DH_METHOD *DH_get_default_method(void);\r\nint DH_set_method(DH *dh, const DH_METHOD *meth);\r\nDH *DH_new_method(ENGINE *engine);\r\n\r\nDH *\tDH_new(void);\r\nvoid\tDH_free(DH *dh);\r\nint\tDH_up_ref(DH *dh);\r\nint\tDH_size(const DH *dh);\r\nint DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\t     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint DH_set_ex_data(DH *d, int idx, void *arg);\r\nvoid *DH_get_ex_data(DH *d, int idx);\r\n\r\n/* Deprecated version */\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nDH *\tDH_generate_parameters(int prime_len,int generator,\r\n\t\tvoid (*callback)(int,int,void *),void *cb_arg);\r\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\r\n\r\n/* New version */\r\nint\tDH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);\r\n\r\nint\tDH_check(const DH *dh,int *codes);\r\nint\tDH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);\r\nint\tDH_generate_key(DH *dh);\r\nint\tDH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);\r\nDH *\td2i_DHparams(DH **a,const unsigned char **pp, long length);\r\nint\ti2d_DHparams(const DH *a,unsigned char **pp);\r\n#ifndef OPENSSL_NO_FP_API\r\nint\tDHparams_print_fp(FILE *fp, const DH *x);\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\nint\tDHparams_print(BIO *bp, const DH *x);\r\n#else\r\nint\tDHparams_print(char *bp, const DH *x);\r\n#endif\r\n\r\n#define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \\\r\n\t\t\tEVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL)\r\n\r\n#define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \\\r\n\t\t\tEVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)\r\n\r\n#define\tEVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN\t(EVP_PKEY_ALG_CTRL + 1)\r\n#define\tEVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR\t(EVP_PKEY_ALG_CTRL + 2)\r\n\t\t\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_DH_strings(void);\r\n\r\n/* Error codes for the DH functions. */\r\n\r\n/* Function codes. */\r\n#define DH_F_COMPUTE_KEY\t\t\t\t 102\r\n#define DH_F_DHPARAMS_PRINT_FP\t\t\t\t 101\r\n#define DH_F_DH_BUILTIN_GENPARAMS\t\t\t 106\r\n#define DH_F_DH_COMPUTE_KEY\t\t\t\t 114\r\n#define DH_F_DH_GENERATE_KEY\t\t\t\t 115\r\n#define DH_F_DH_GENERATE_PARAMETERS_EX\t\t\t 116\r\n#define DH_F_DH_NEW_METHOD\t\t\t\t 105\r\n#define DH_F_DH_PARAM_DECODE\t\t\t\t 107\r\n#define DH_F_DH_PRIV_DECODE\t\t\t\t 110\r\n#define DH_F_DH_PRIV_ENCODE\t\t\t\t 111\r\n#define DH_F_DH_PUB_DECODE\t\t\t\t 108\r\n#define DH_F_DH_PUB_ENCODE\t\t\t\t 109\r\n#define DH_F_DO_DH_PRINT\t\t\t\t 100\r\n#define DH_F_GENERATE_KEY\t\t\t\t 103\r\n#define DH_F_GENERATE_PARAMETERS\t\t\t 104\r\n#define DH_F_PKEY_DH_DERIVE\t\t\t\t 112\r\n#define DH_F_PKEY_DH_KEYGEN\t\t\t\t 113\r\n\r\n/* Reason codes. */\r\n#define DH_R_BAD_GENERATOR\t\t\t\t 101\r\n#define DH_R_BN_DECODE_ERROR\t\t\t\t 109\r\n#define DH_R_BN_ERROR\t\t\t\t\t 106\r\n#define DH_R_DECODE_ERROR\t\t\t\t 104\r\n#define DH_R_INVALID_PUBKEY\t\t\t\t 102\r\n#define DH_R_KEYS_NOT_SET\t\t\t\t 108\r\n#define DH_R_KEY_SIZE_TOO_SMALL\t\t\t\t 110\r\n#define DH_R_MODULUS_TOO_LARGE\t\t\t\t 103\r\n#define DH_R_NON_FIPS_METHOD\t\t\t\t 111\r\n#define DH_R_NO_PARAMETERS_SET\t\t\t\t 107\r\n#define DH_R_NO_PRIVATE_VALUE\t\t\t\t 100\r\n#define DH_R_PARAMETER_ENCODING_ERROR\t\t\t 105\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/dsa.h",
    "content": "/* crypto/dsa/dsa.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n/*\r\n * The DSS routines are based on patches supplied by\r\n * Steven Schoch <schoch@sheba.arc.nasa.gov>.  He basically did the\r\n * work and I have just tweaked them a little to fit into my\r\n * stylistic vision for SSLeay :-) */\r\n\r\n#ifndef HEADER_DSA_H\r\n#define HEADER_DSA_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifdef OPENSSL_NO_DSA\r\n#error DSA is disabled.\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/crypto.h>\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#ifndef OPENSSL_NO_DH\r\n# include <openssl/dh.h>\r\n#endif\r\n#endif\r\n\r\n#ifndef OPENSSL_DSA_MAX_MODULUS_BITS\r\n# define OPENSSL_DSA_MAX_MODULUS_BITS\t10000\r\n#endif\r\n\r\n#define DSA_FLAG_CACHE_MONT_P\t0x01\r\n#define DSA_FLAG_NO_EXP_CONSTTIME       0x02 /* new with 0.9.7h; the built-in DSA\r\n                                              * implementation now uses constant time\r\n                                              * modular exponentiation for secret exponents\r\n                                              * by default. This flag causes the\r\n                                              * faster variable sliding window method to\r\n                                              * be used for all exponents.\r\n                                              */\r\n\r\n/* If this flag is set the DSA method is FIPS compliant and can be used\r\n * in FIPS mode. This is set in the validated module method. If an\r\n * application sets this flag in its own methods it is its reposibility\r\n * to ensure the result is compliant.\r\n */\r\n\r\n#define DSA_FLAG_FIPS_METHOD\t\t\t0x0400\r\n\r\n/* If this flag is set the operations normally disabled in FIPS mode are\r\n * permitted it is then the applications responsibility to ensure that the\r\n * usage is compliant.\r\n */\r\n\r\n#define DSA_FLAG_NON_FIPS_ALLOW\t\t\t0x0400\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Already defined in ossl_typ.h */\r\n/* typedef struct dsa_st DSA; */\r\n/* typedef struct dsa_method DSA_METHOD; */\r\n\r\ntypedef struct DSA_SIG_st\r\n\t{\r\n\tBIGNUM *r;\r\n\tBIGNUM *s;\r\n\t} DSA_SIG;\r\n\r\nstruct dsa_method\r\n\t{\r\n\tconst char *name;\r\n\tDSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);\r\n\tint (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,\r\n\t\t\t\t\t\t\t\tBIGNUM **rp);\r\n\tint (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,\r\n\t\t\t     DSA_SIG *sig, DSA *dsa);\r\n\tint (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,\r\n\t\t\tBIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,\r\n\t\t\tBN_MONT_CTX *in_mont);\r\n\tint (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,\r\n\t\t\t\tconst BIGNUM *m, BN_CTX *ctx,\r\n\t\t\t\tBN_MONT_CTX *m_ctx); /* Can be null */\r\n\tint (*init)(DSA *dsa);\r\n\tint (*finish)(DSA *dsa);\r\n\tint flags;\r\n\tchar *app_data;\r\n\t/* If this is non-NULL, it is used to generate DSA parameters */\r\n\tint (*dsa_paramgen)(DSA *dsa, int bits,\r\n\t\t\tconst unsigned char *seed, int seed_len,\r\n\t\t\tint *counter_ret, unsigned long *h_ret,\r\n\t\t\tBN_GENCB *cb);\r\n\t/* If this is non-NULL, it is used to generate DSA keys */\r\n\tint (*dsa_keygen)(DSA *dsa);\r\n\t};\r\n\r\nstruct dsa_st\r\n\t{\r\n\t/* This first variable is used to pick up errors where\r\n\t * a DSA is passed instead of of a EVP_PKEY */\r\n\tint pad;\r\n\tlong version;\r\n\tint write_params;\r\n\tBIGNUM *p;\r\n\tBIGNUM *q;\t/* == 20 */\r\n\tBIGNUM *g;\r\n\r\n\tBIGNUM *pub_key;  /* y public key */\r\n\tBIGNUM *priv_key; /* x private key */\r\n\r\n\tBIGNUM *kinv;\t/* Signing pre-calc */\r\n\tBIGNUM *r;\t/* Signing pre-calc */\r\n\r\n\tint flags;\r\n\t/* Normally used to cache montgomery values */\r\n\tBN_MONT_CTX *method_mont_p;\r\n\tint references;\r\n\tCRYPTO_EX_DATA ex_data;\r\n\tconst DSA_METHOD *meth;\r\n\t/* functional reference if 'meth' is ENGINE-provided */\r\n\tENGINE *engine;\r\n\t};\r\n\r\n#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \\\r\n\t\t(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))\r\n#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \\\r\n\t\t(unsigned char *)(x))\r\n#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)\r\n#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)\r\n\r\n\r\nDSA *DSAparams_dup(DSA *x);\r\nDSA_SIG * DSA_SIG_new(void);\r\nvoid\tDSA_SIG_free(DSA_SIG *a);\r\nint\ti2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);\r\nDSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);\r\n\r\nDSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);\r\nint\tDSA_do_verify(const unsigned char *dgst,int dgst_len,\r\n\t\t      DSA_SIG *sig,DSA *dsa);\r\n\r\nconst DSA_METHOD *DSA_OpenSSL(void);\r\n\r\nvoid\tDSA_set_default_method(const DSA_METHOD *);\r\nconst DSA_METHOD *DSA_get_default_method(void);\r\nint\tDSA_set_method(DSA *dsa, const DSA_METHOD *);\r\n\r\nDSA *\tDSA_new(void);\r\nDSA *\tDSA_new_method(ENGINE *engine);\r\nvoid\tDSA_free (DSA *r);\r\n/* \"up\" the DSA object's reference count */\r\nint\tDSA_up_ref(DSA *r);\r\nint\tDSA_size(const DSA *);\r\n\t/* next 4 return -1 on error */\r\nint\tDSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);\r\nint\tDSA_sign(int type,const unsigned char *dgst,int dlen,\r\n\t\tunsigned char *sig, unsigned int *siglen, DSA *dsa);\r\nint\tDSA_verify(int type,const unsigned char *dgst,int dgst_len,\r\n\t\tconst unsigned char *sigbuf, int siglen, DSA *dsa);\r\nint DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\t     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint DSA_set_ex_data(DSA *d, int idx, void *arg);\r\nvoid *DSA_get_ex_data(DSA *d, int idx);\r\n\r\nDSA *\td2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);\r\nDSA *\td2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);\r\nDSA * \td2i_DSAparams(DSA **a, const unsigned char **pp, long length);\r\n\r\n/* Deprecated version */\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nDSA *\tDSA_generate_parameters(int bits,\r\n\t\tunsigned char *seed,int seed_len,\r\n\t\tint *counter_ret, unsigned long *h_ret,void\r\n\t\t(*callback)(int, int, void *),void *cb_arg);\r\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\r\n\r\n/* New version */\r\nint\tDSA_generate_parameters_ex(DSA *dsa, int bits,\r\n\t\tconst unsigned char *seed,int seed_len,\r\n\t\tint *counter_ret, unsigned long *h_ret, BN_GENCB *cb);\r\n\r\nint\tDSA_generate_key(DSA *a);\r\nint\ti2d_DSAPublicKey(const DSA *a, unsigned char **pp);\r\nint \ti2d_DSAPrivateKey(const DSA *a, unsigned char **pp);\r\nint\ti2d_DSAparams(const DSA *a,unsigned char **pp);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint\tDSAparams_print(BIO *bp, const DSA *x);\r\nint\tDSA_print(BIO *bp, const DSA *x, int off);\r\n#endif\r\n#ifndef OPENSSL_NO_FP_API\r\nint\tDSAparams_print_fp(FILE *fp, const DSA *x);\r\nint\tDSA_print_fp(FILE *bp, const DSA *x, int off);\r\n#endif\r\n\r\n#define DSS_prime_checks 50\r\n/* Primality test according to FIPS PUB 186[-1], Appendix 2.1:\r\n * 50 rounds of Rabin-Miller */\r\n#define DSA_is_prime(n, callback, cb_arg) \\\r\n\tBN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)\r\n\r\n#ifndef OPENSSL_NO_DH\r\n/* Convert DSA structure (key or just parameters) into DH structure\r\n * (be careful to avoid small subgroup attacks when using this!) */\r\nDH *DSA_dup_DH(const DSA *r);\r\n#endif\r\n\r\n#define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \\\r\n\t\t\t\tEVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)\r\n\r\n#define\tEVP_PKEY_CTRL_DSA_PARAMGEN_BITS\t\t(EVP_PKEY_ALG_CTRL + 1)\r\n#define\tEVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS\t(EVP_PKEY_ALG_CTRL + 2)\r\n#define\tEVP_PKEY_CTRL_DSA_PARAMGEN_MD\t\t(EVP_PKEY_ALG_CTRL + 3)\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_DSA_strings(void);\r\n\r\n/* Error codes for the DSA functions. */\r\n\r\n/* Function codes. */\r\n#define DSA_F_D2I_DSA_SIG\t\t\t\t 110\r\n#define DSA_F_DO_DSA_PRINT\t\t\t\t 104\r\n#define DSA_F_DSAPARAMS_PRINT\t\t\t\t 100\r\n#define DSA_F_DSAPARAMS_PRINT_FP\t\t\t 101\r\n#define DSA_F_DSA_DO_SIGN\t\t\t\t 112\r\n#define DSA_F_DSA_DO_VERIFY\t\t\t\t 113\r\n#define DSA_F_DSA_GENERATE_KEY\t\t\t\t 124\r\n#define DSA_F_DSA_GENERATE_PARAMETERS_EX\t\t 123\r\n#define DSA_F_DSA_NEW_METHOD\t\t\t\t 103\r\n#define DSA_F_DSA_PARAM_DECODE\t\t\t\t 119\r\n#define DSA_F_DSA_PRINT_FP\t\t\t\t 105\r\n#define DSA_F_DSA_PRIV_DECODE\t\t\t\t 115\r\n#define DSA_F_DSA_PRIV_ENCODE\t\t\t\t 116\r\n#define DSA_F_DSA_PUB_DECODE\t\t\t\t 117\r\n#define DSA_F_DSA_PUB_ENCODE\t\t\t\t 118\r\n#define DSA_F_DSA_SIGN\t\t\t\t\t 106\r\n#define DSA_F_DSA_SIGN_SETUP\t\t\t\t 107\r\n#define DSA_F_DSA_SIG_NEW\t\t\t\t 109\r\n#define DSA_F_DSA_SIG_PRINT\t\t\t\t 125\r\n#define DSA_F_DSA_VERIFY\t\t\t\t 108\r\n#define DSA_F_I2D_DSA_SIG\t\t\t\t 111\r\n#define DSA_F_OLD_DSA_PRIV_DECODE\t\t\t 122\r\n#define DSA_F_PKEY_DSA_CTRL\t\t\t\t 120\r\n#define DSA_F_PKEY_DSA_KEYGEN\t\t\t\t 121\r\n#define DSA_F_SIG_CB\t\t\t\t\t 114\r\n\r\n/* Reason codes. */\r\n#define DSA_R_BAD_Q_VALUE\t\t\t\t 102\r\n#define DSA_R_BN_DECODE_ERROR\t\t\t\t 108\r\n#define DSA_R_BN_ERROR\t\t\t\t\t 109\r\n#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE\t\t 100\r\n#define DSA_R_DECODE_ERROR\t\t\t\t 104\r\n#define DSA_R_INVALID_DIGEST_TYPE\t\t\t 106\r\n#define DSA_R_MISSING_PARAMETERS\t\t\t 101\r\n#define DSA_R_MODULUS_TOO_LARGE\t\t\t\t 103\r\n#define DSA_R_NEED_NEW_SETUP_VALUES\t\t\t 110\r\n#define DSA_R_NON_FIPS_DSA_METHOD\t\t\t 111\r\n#define DSA_R_NO_PARAMETERS_SET\t\t\t\t 107\r\n#define DSA_R_PARAMETER_ENCODING_ERROR\t\t\t 105\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/dso.h",
    "content": "/* dso.h -*- mode:C; c-file-style: \"eay\" -*- */\r\n/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL\r\n * project 2000.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_DSO_H\r\n#define HEADER_DSO_H\r\n\r\n#include <openssl/crypto.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* These values are used as commands to DSO_ctrl() */\r\n#define DSO_CTRL_GET_FLAGS\t1\r\n#define DSO_CTRL_SET_FLAGS\t2\r\n#define DSO_CTRL_OR_FLAGS\t3\r\n\r\n/* By default, DSO_load() will translate the provided filename into a form\r\n * typical for the platform (more specifically the DSO_METHOD) using the\r\n * dso_name_converter function of the method. Eg. win32 will transform \"blah\"\r\n * into \"blah.dll\", and dlfcn will transform it into \"libblah.so\". The\r\n * behaviour can be overriden by setting the name_converter callback in the DSO\r\n * object (using DSO_set_name_converter()). This callback could even utilise\r\n * the DSO_METHOD's converter too if it only wants to override behaviour for\r\n * one or two possible DSO methods. However, the following flag can be set in a\r\n * DSO to prevent *any* native name-translation at all - eg. if the caller has\r\n * prompted the user for a path to a driver library so the filename should be\r\n * interpreted as-is. */\r\n#define DSO_FLAG_NO_NAME_TRANSLATION\t\t0x01\r\n/* An extra flag to give if only the extension should be added as\r\n * translation.  This is obviously only of importance on Unix and\r\n * other operating systems where the translation also may prefix\r\n * the name with something, like 'lib', and ignored everywhere else.\r\n * This flag is also ignored if DSO_FLAG_NO_NAME_TRANSLATION is used\r\n * at the same time. */\r\n#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY\t0x02\r\n\r\n/* The following flag controls the translation of symbol names to upper\r\n * case.  This is currently only being implemented for OpenVMS.\r\n */\r\n#define DSO_FLAG_UPCASE_SYMBOL\t\t\t0x10\r\n\r\n/* This flag loads the library with public symbols.\r\n * Meaning: The exported symbols of this library are public\r\n * to all libraries loaded after this library.\r\n * At the moment only implemented in unix.\r\n */\r\n#define DSO_FLAG_GLOBAL_SYMBOLS\t\t\t0x20\r\n\r\n\r\ntypedef void (*DSO_FUNC_TYPE)(void);\r\n\r\ntypedef struct dso_st DSO;\r\n\r\n/* The function prototype used for method functions (or caller-provided\r\n * callbacks) that transform filenames. They are passed a DSO structure pointer\r\n * (or NULL if they are to be used independantly of a DSO object) and a\r\n * filename to transform. They should either return NULL (if there is an error\r\n * condition) or a newly allocated string containing the transformed form that\r\n * the caller will need to free with OPENSSL_free() when done. */\r\ntypedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);\r\n/* The function prototype used for method functions (or caller-provided\r\n * callbacks) that merge two file specifications. They are passed a\r\n * DSO structure pointer (or NULL if they are to be used independantly of\r\n * a DSO object) and two file specifications to merge. They should\r\n * either return NULL (if there is an error condition) or a newly allocated\r\n * string containing the result of merging that the caller will need\r\n * to free with OPENSSL_free() when done.\r\n * Here, merging means that bits and pieces are taken from each of the\r\n * file specifications and added together in whatever fashion that is\r\n * sensible for the DSO method in question.  The only rule that really\r\n * applies is that if the two specification contain pieces of the same\r\n * type, the copy from the first string takes priority.  One could see\r\n * it as the first specification is the one given by the user and the\r\n * second being a bunch of defaults to add on if they're missing in the\r\n * first. */\r\ntypedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *);\r\n\r\ntypedef struct dso_meth_st\r\n\t{\r\n\tconst char *name;\r\n\t/* Loads a shared library, NB: new DSO_METHODs must ensure that a\r\n\t * successful load populates the loaded_filename field, and likewise a\r\n\t * successful unload OPENSSL_frees and NULLs it out. */\r\n\tint (*dso_load)(DSO *dso);\r\n\t/* Unloads a shared library */\r\n\tint (*dso_unload)(DSO *dso);\r\n\t/* Binds a variable */\r\n\tvoid *(*dso_bind_var)(DSO *dso, const char *symname);\r\n\t/* Binds a function - assumes a return type of DSO_FUNC_TYPE.\r\n\t * This should be cast to the real function prototype by the\r\n\t * caller. Platforms that don't have compatible representations\r\n\t * for different prototypes (this is possible within ANSI C)\r\n\t * are highly unlikely to have shared libraries at all, let\r\n\t * alone a DSO_METHOD implemented for them. */\r\n\tDSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname);\r\n\r\n/* I don't think this would actually be used in any circumstances. */\r\n#if 0\r\n\t/* Unbinds a variable */\r\n\tint (*dso_unbind_var)(DSO *dso, char *symname, void *symptr);\r\n\t/* Unbinds a function */\r\n\tint (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);\r\n#endif\r\n\t/* The generic (yuck) \"ctrl()\" function. NB: Negative return\r\n\t * values (rather than zero) indicate errors. */\r\n\tlong (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg);\r\n\t/* The default DSO_METHOD-specific function for converting filenames to\r\n\t * a canonical native form. */\r\n\tDSO_NAME_CONVERTER_FUNC dso_name_converter;\r\n\t/* The default DSO_METHOD-specific function for converting filenames to\r\n\t * a canonical native form. */\r\n\tDSO_MERGER_FUNC dso_merger;\r\n\r\n\t/* [De]Initialisation handlers. */\r\n\tint (*init)(DSO *dso);\r\n\tint (*finish)(DSO *dso);\r\n\r\n\t/* Return pathname of the module containing location */\r\n\tint (*pathbyaddr)(void *addr,char *path,int sz);\r\n\t/* Perform global symbol lookup, i.e. among *all* modules */\r\n\tvoid *(*globallookup)(const char *symname);\r\n\t} DSO_METHOD;\r\n\r\n/**********************************************************************/\r\n/* The low-level handle type used to refer to a loaded shared library */\r\n\r\nstruct dso_st\r\n\t{\r\n\tDSO_METHOD *meth;\r\n\t/* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS\r\n\t * doesn't use anything but will need to cache the filename\r\n\t * for use in the dso_bind handler. All in all, let each\r\n\t * method control its own destiny. \"Handles\" and such go in\r\n\t * a STACK. */\r\n\tSTACK_OF(void) *meth_data;\r\n\tint references;\r\n\tint flags;\r\n\t/* For use by applications etc ... use this for your bits'n'pieces,\r\n\t * don't touch meth_data! */\r\n\tCRYPTO_EX_DATA ex_data;\r\n\t/* If this callback function pointer is set to non-NULL, then it will\r\n\t * be used in DSO_load() in place of meth->dso_name_converter. NB: This\r\n\t * should normally set using DSO_set_name_converter(). */\r\n\tDSO_NAME_CONVERTER_FUNC name_converter;\r\n\t/* If this callback function pointer is set to non-NULL, then it will\r\n\t * be used in DSO_load() in place of meth->dso_merger. NB: This\r\n\t * should normally set using DSO_set_merger(). */\r\n\tDSO_MERGER_FUNC merger;\r\n\t/* This is populated with (a copy of) the platform-independant\r\n\t * filename used for this DSO. */\r\n\tchar *filename;\r\n\t/* This is populated with (a copy of) the translated filename by which\r\n\t * the DSO was actually loaded. It is NULL iff the DSO is not currently\r\n\t * loaded. NB: This is here because the filename translation process\r\n\t * may involve a callback being invoked more than once not only to\r\n\t * convert to a platform-specific form, but also to try different\r\n\t * filenames in the process of trying to perform a load. As such, this\r\n\t * variable can be used to indicate (a) whether this DSO structure\r\n\t * corresponds to a loaded library or not, and (b) the filename with\r\n\t * which it was actually loaded. */\r\n\tchar *loaded_filename;\r\n\t};\r\n\r\n\r\nDSO *\tDSO_new(void);\r\nDSO *\tDSO_new_method(DSO_METHOD *method);\r\nint\tDSO_free(DSO *dso);\r\nint\tDSO_flags(DSO *dso);\r\nint\tDSO_up_ref(DSO *dso);\r\nlong\tDSO_ctrl(DSO *dso, int cmd, long larg, void *parg);\r\n\r\n/* This function sets the DSO's name_converter callback. If it is non-NULL,\r\n * then it will be used instead of the associated DSO_METHOD's function. If\r\n * oldcb is non-NULL then it is set to the function pointer value being\r\n * replaced. Return value is non-zero for success. */\r\nint\tDSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,\r\n\t\t\t\tDSO_NAME_CONVERTER_FUNC *oldcb);\r\n/* These functions can be used to get/set the platform-independant filename\r\n * used for a DSO. NB: set will fail if the DSO is already loaded. */\r\nconst char *DSO_get_filename(DSO *dso);\r\nint\tDSO_set_filename(DSO *dso, const char *filename);\r\n/* This function will invoke the DSO's name_converter callback to translate a\r\n * filename, or if the callback isn't set it will instead use the DSO_METHOD's\r\n * converter. If \"filename\" is NULL, the \"filename\" in the DSO itself will be\r\n * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is\r\n * simply duplicated. NB: This function is usually called from within a\r\n * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that\r\n * caller-created DSO_METHODs can do the same thing. A non-NULL return value\r\n * will need to be OPENSSL_free()'d. */\r\nchar\t*DSO_convert_filename(DSO *dso, const char *filename);\r\n/* This function will invoke the DSO's merger callback to merge two file\r\n * specifications, or if the callback isn't set it will instead use the\r\n * DSO_METHOD's merger.  A non-NULL return value will need to be\r\n * OPENSSL_free()'d. */\r\nchar\t*DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);\r\n/* If the DSO is currently loaded, this returns the filename that it was loaded\r\n * under, otherwise it returns NULL. So it is also useful as a test as to\r\n * whether the DSO is currently loaded. NB: This will not necessarily return\r\n * the same value as DSO_convert_filename(dso, dso->filename), because the\r\n * DSO_METHOD's load function may have tried a variety of filenames (with\r\n * and/or without the aid of the converters) before settling on the one it\r\n * actually loaded. */\r\nconst char *DSO_get_loaded_filename(DSO *dso);\r\n\r\nvoid\tDSO_set_default_method(DSO_METHOD *meth);\r\nDSO_METHOD *DSO_get_default_method(void);\r\nDSO_METHOD *DSO_get_method(DSO *dso);\r\nDSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);\r\n\r\n/* The all-singing all-dancing load function, you normally pass NULL\r\n * for the first and third parameters. Use DSO_up and DSO_free for\r\n * subsequent reference count handling. Any flags passed in will be set\r\n * in the constructed DSO after its init() function but before the\r\n * load operation. If 'dso' is non-NULL, 'flags' is ignored. */\r\nDSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);\r\n\r\n/* This function binds to a variable inside a shared library. */\r\nvoid *DSO_bind_var(DSO *dso, const char *symname);\r\n\r\n/* This function binds to a function inside a shared library. */\r\nDSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);\r\n\r\n/* This method is the default, but will beg, borrow, or steal whatever\r\n * method should be the default on any particular platform (including\r\n * DSO_METH_null() if necessary). */\r\nDSO_METHOD *DSO_METHOD_openssl(void);\r\n\r\n/* This method is defined for all platforms - if a platform has no\r\n * DSO support then this will be the only method! */\r\nDSO_METHOD *DSO_METHOD_null(void);\r\n\r\n/* If DSO_DLFCN is defined, the standard dlfcn.h-style functions\r\n * (dlopen, dlclose, dlsym, etc) will be used and incorporated into\r\n * this method. If not, this method will return NULL. */\r\nDSO_METHOD *DSO_METHOD_dlfcn(void);\r\n\r\n/* If DSO_DL is defined, the standard dl.h-style functions (shl_load, \r\n * shl_unload, shl_findsym, etc) will be used and incorporated into\r\n * this method. If not, this method will return NULL. */\r\nDSO_METHOD *DSO_METHOD_dl(void);\r\n\r\n/* If WIN32 is defined, use DLLs. If not, return NULL. */\r\nDSO_METHOD *DSO_METHOD_win32(void);\r\n\r\n/* If VMS is defined, use shared images. If not, return NULL. */\r\nDSO_METHOD *DSO_METHOD_vms(void);\r\n\r\n/* This function writes null-terminated pathname of DSO module\r\n * containing 'addr' into 'sz' large caller-provided 'path' and\r\n * returns the number of characters [including trailing zero]\r\n * written to it. If 'sz' is 0 or negative, 'path' is ignored and\r\n * required amount of charachers [including trailing zero] to\r\n * accomodate pathname is returned. If 'addr' is NULL, then\r\n * pathname of cryptolib itself is returned. Negative or zero\r\n * return value denotes error.\r\n */\r\nint DSO_pathbyaddr(void *addr,char *path,int sz);\r\n\r\n/* This function should be used with caution! It looks up symbols in\r\n * *all* loaded modules and if module gets unloaded by somebody else\r\n * attempt to dereference the pointer is doomed to have fatal\r\n * consequences. Primary usage for this function is to probe *core*\r\n * system functionality, e.g. check if getnameinfo(3) is available\r\n * at run-time without bothering about OS-specific details such as\r\n * libc.so.versioning or where does it actually reside: in libc\r\n * itself or libsocket. */\r\nvoid *DSO_global_lookup(const char *name);\r\n\r\n/* If BeOS is defined, use shared images. If not, return NULL. */\r\nDSO_METHOD *DSO_METHOD_beos(void);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_DSO_strings(void);\r\n\r\n/* Error codes for the DSO functions. */\r\n\r\n/* Function codes. */\r\n#define DSO_F_BEOS_BIND_FUNC\t\t\t\t 144\r\n#define DSO_F_BEOS_BIND_VAR\t\t\t\t 145\r\n#define DSO_F_BEOS_LOAD\t\t\t\t\t 146\r\n#define DSO_F_BEOS_NAME_CONVERTER\t\t\t 147\r\n#define DSO_F_BEOS_UNLOAD\t\t\t\t 148\r\n#define DSO_F_DLFCN_BIND_FUNC\t\t\t\t 100\r\n#define DSO_F_DLFCN_BIND_VAR\t\t\t\t 101\r\n#define DSO_F_DLFCN_LOAD\t\t\t\t 102\r\n#define DSO_F_DLFCN_MERGER\t\t\t\t 130\r\n#define DSO_F_DLFCN_NAME_CONVERTER\t\t\t 123\r\n#define DSO_F_DLFCN_UNLOAD\t\t\t\t 103\r\n#define DSO_F_DL_BIND_FUNC\t\t\t\t 104\r\n#define DSO_F_DL_BIND_VAR\t\t\t\t 105\r\n#define DSO_F_DL_LOAD\t\t\t\t\t 106\r\n#define DSO_F_DL_MERGER\t\t\t\t\t 131\r\n#define DSO_F_DL_NAME_CONVERTER\t\t\t\t 124\r\n#define DSO_F_DL_UNLOAD\t\t\t\t\t 107\r\n#define DSO_F_DSO_BIND_FUNC\t\t\t\t 108\r\n#define DSO_F_DSO_BIND_VAR\t\t\t\t 109\r\n#define DSO_F_DSO_CONVERT_FILENAME\t\t\t 126\r\n#define DSO_F_DSO_CTRL\t\t\t\t\t 110\r\n#define DSO_F_DSO_FREE\t\t\t\t\t 111\r\n#define DSO_F_DSO_GET_FILENAME\t\t\t\t 127\r\n#define DSO_F_DSO_GET_LOADED_FILENAME\t\t\t 128\r\n#define DSO_F_DSO_GLOBAL_LOOKUP\t\t\t\t 139\r\n#define DSO_F_DSO_LOAD\t\t\t\t\t 112\r\n#define DSO_F_DSO_MERGE\t\t\t\t\t 132\r\n#define DSO_F_DSO_NEW_METHOD\t\t\t\t 113\r\n#define DSO_F_DSO_PATHBYADDR\t\t\t\t 140\r\n#define DSO_F_DSO_SET_FILENAME\t\t\t\t 129\r\n#define DSO_F_DSO_SET_NAME_CONVERTER\t\t\t 122\r\n#define DSO_F_DSO_UP_REF\t\t\t\t 114\r\n#define DSO_F_GLOBAL_LOOKUP_FUNC\t\t\t 138\r\n#define DSO_F_PATHBYADDR\t\t\t\t 137\r\n#define DSO_F_VMS_BIND_SYM\t\t\t\t 115\r\n#define DSO_F_VMS_LOAD\t\t\t\t\t 116\r\n#define DSO_F_VMS_MERGER\t\t\t\t 133\r\n#define DSO_F_VMS_UNLOAD\t\t\t\t 117\r\n#define DSO_F_WIN32_BIND_FUNC\t\t\t\t 118\r\n#define DSO_F_WIN32_BIND_VAR\t\t\t\t 119\r\n#define DSO_F_WIN32_GLOBALLOOKUP\t\t\t 142\r\n#define DSO_F_WIN32_GLOBALLOOKUP_FUNC\t\t\t 143\r\n#define DSO_F_WIN32_JOINER\t\t\t\t 135\r\n#define DSO_F_WIN32_LOAD\t\t\t\t 120\r\n#define DSO_F_WIN32_MERGER\t\t\t\t 134\r\n#define DSO_F_WIN32_NAME_CONVERTER\t\t\t 125\r\n#define DSO_F_WIN32_PATHBYADDR\t\t\t\t 141\r\n#define DSO_F_WIN32_SPLITTER\t\t\t\t 136\r\n#define DSO_F_WIN32_UNLOAD\t\t\t\t 121\r\n\r\n/* Reason codes. */\r\n#define DSO_R_CTRL_FAILED\t\t\t\t 100\r\n#define DSO_R_DSO_ALREADY_LOADED\t\t\t 110\r\n#define DSO_R_EMPTY_FILE_STRUCTURE\t\t\t 113\r\n#define DSO_R_FAILURE\t\t\t\t\t 114\r\n#define DSO_R_FILENAME_TOO_BIG\t\t\t\t 101\r\n#define DSO_R_FINISH_FAILED\t\t\t\t 102\r\n#define DSO_R_INCORRECT_FILE_SYNTAX\t\t\t 115\r\n#define DSO_R_LOAD_FAILED\t\t\t\t 103\r\n#define DSO_R_NAME_TRANSLATION_FAILED\t\t\t 109\r\n#define DSO_R_NO_FILENAME\t\t\t\t 111\r\n#define DSO_R_NO_FILE_SPECIFICATION\t\t\t 116\r\n#define DSO_R_NULL_HANDLE\t\t\t\t 104\r\n#define DSO_R_SET_FILENAME_FAILED\t\t\t 112\r\n#define DSO_R_STACK_ERROR\t\t\t\t 105\r\n#define DSO_R_SYM_FAILURE\t\t\t\t 106\r\n#define DSO_R_UNLOAD_FAILED\t\t\t\t 107\r\n#define DSO_R_UNSUPPORTED\t\t\t\t 108\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/dtls1.h",
    "content": "/* ssl/dtls1.h */\r\n/* \r\n * DTLS implementation written by Nagendra Modadugu\r\n * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  \r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_DTLS1_H \r\n#define HEADER_DTLS1_H \r\n\r\n#include <openssl/buffer.h>\r\n#include <openssl/pqueue.h>\r\n#ifdef OPENSSL_SYS_VMS\r\n#include <resource.h>\r\n#include <sys/timeb.h>\r\n#endif\r\n#ifdef OPENSSL_SYS_WIN32\r\n/* Needed for struct timeval */\r\n#include <winsock.h>\r\n#elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)\r\n#include <sys/timeval.h>\r\n#else\r\n#include <sys/time.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define DTLS1_VERSION\t\t\t0xFEFF\r\n#define DTLS1_BAD_VER\t\t\t0x0100\r\n\r\n#if 0\r\n/* this alert description is not specified anywhere... */\r\n#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE    110\r\n#endif\r\n\r\n/* lengths of messages */\r\n#define DTLS1_COOKIE_LENGTH                     256\r\n\r\n#define DTLS1_RT_HEADER_LENGTH                  13\r\n\r\n#define DTLS1_HM_HEADER_LENGTH                  12\r\n\r\n#define DTLS1_HM_BAD_FRAGMENT                   -2\r\n#define DTLS1_HM_FRAGMENT_RETRY                 -3\r\n\r\n#define DTLS1_CCS_HEADER_LENGTH                  1\r\n\r\n#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE\r\n#define DTLS1_AL_HEADER_LENGTH                   7\r\n#else\r\n#define DTLS1_AL_HEADER_LENGTH                   2\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\n#ifndef OPENSSL_NO_SCTP\r\n#define DTLS1_SCTP_AUTH_LABEL\t\"EXPORTER_DTLS_OVER_SCTP\"\r\n#endif\r\n\r\ntypedef struct dtls1_bitmap_st\r\n\t{\r\n\tunsigned long map;\t\t/* track 32 packets on 32-bit systems\r\n\t\t\t\t\t   and 64 - on 64-bit systems */\r\n\tunsigned char max_seq_num[8];\t/* max record number seen so far,\r\n\t\t\t\t\t   64-bit value in big-endian\r\n\t\t\t\t\t   encoding */\r\n\t} DTLS1_BITMAP;\r\n\r\nstruct dtls1_retransmit_state\r\n\t{\r\n\tEVP_CIPHER_CTX *enc_write_ctx;\t/* cryptographic state */\r\n\tEVP_MD_CTX *write_hash;\t\t\t/* used for mac generation */\r\n#ifndef OPENSSL_NO_COMP\r\n\tCOMP_CTX *compress;\t\t\t\t/* compression */\r\n#else\r\n\tchar *compress;\t\r\n#endif\r\n\tSSL_SESSION *session;\r\n\tunsigned short epoch;\r\n\t};\r\n\r\nstruct hm_header_st\r\n\t{\r\n\tunsigned char type;\r\n\tunsigned long msg_len;\r\n\tunsigned short seq;\r\n\tunsigned long frag_off;\r\n\tunsigned long frag_len;\r\n\tunsigned int is_ccs;\r\n\tstruct dtls1_retransmit_state saved_retransmit_state;\r\n\t};\r\n\r\nstruct ccs_header_st\r\n\t{\r\n\tunsigned char type;\r\n\tunsigned short seq;\r\n\t};\r\n\r\nstruct dtls1_timeout_st\r\n\t{\r\n\t/* Number of read timeouts so far */\r\n\tunsigned int read_timeouts;\r\n\t\r\n\t/* Number of write timeouts so far */\r\n\tunsigned int write_timeouts;\r\n\t\r\n\t/* Number of alerts received so far */\r\n\tunsigned int num_alerts;\r\n\t};\r\n\r\ntypedef struct record_pqueue_st\r\n\t{\r\n\tunsigned short epoch;\r\n\tpqueue q;\r\n\t} record_pqueue;\r\n\r\ntypedef struct hm_fragment_st\r\n\t{\r\n\tstruct hm_header_st msg_header;\r\n\tunsigned char *fragment;\r\n\tunsigned char *reassembly;\r\n\t} hm_fragment;\r\n\r\ntypedef struct dtls1_state_st\r\n\t{\r\n\tunsigned int send_cookie;\r\n\tunsigned char cookie[DTLS1_COOKIE_LENGTH];\r\n\tunsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];\r\n\tunsigned int cookie_len;\r\n\r\n\t/* \r\n\t * The current data and handshake epoch.  This is initially\r\n\t * undefined, and starts at zero once the initial handshake is\r\n\t * completed \r\n\t */\r\n\tunsigned short r_epoch;\r\n\tunsigned short w_epoch;\r\n\r\n\t/* records being received in the current epoch */\r\n\tDTLS1_BITMAP bitmap;\r\n\r\n\t/* renegotiation starts a new set of sequence numbers */\r\n\tDTLS1_BITMAP next_bitmap;\r\n\r\n\t/* handshake message numbers */\r\n\tunsigned short handshake_write_seq;\r\n\tunsigned short next_handshake_write_seq;\r\n\r\n\tunsigned short handshake_read_seq;\r\n\r\n\t/* save last sequence number for retransmissions */\r\n\tunsigned char last_write_sequence[8];\r\n\r\n\t/* Received handshake records (processed and unprocessed) */\r\n\trecord_pqueue unprocessed_rcds;\r\n\trecord_pqueue processed_rcds;\r\n\r\n\t/* Buffered handshake messages */\r\n\tpqueue buffered_messages;\r\n\r\n\t/* Buffered (sent) handshake records */\r\n\tpqueue sent_messages;\r\n\r\n\t/* Buffered application records.\r\n\t * Only for records between CCS and Finished\r\n\t * to prevent either protocol violation or\r\n\t * unnecessary message loss.\r\n\t */\r\n\trecord_pqueue buffered_app_data;\r\n\r\n\t/* Is set when listening for new connections with dtls1_listen() */\r\n\tunsigned int listen;\r\n\r\n\tunsigned int mtu; /* max DTLS packet size */\r\n\r\n\tstruct hm_header_st w_msg_hdr;\r\n\tstruct hm_header_st r_msg_hdr;\r\n\r\n\tstruct dtls1_timeout_st timeout;\r\n\r\n\t/* Indicates when the last handshake msg or heartbeat sent will timeout */\r\n\tstruct timeval next_timeout;\r\n\r\n\t/* Timeout duration */\r\n\tunsigned short timeout_duration;\r\n\r\n\t/* storage for Alert/Handshake protocol data received but not\r\n\t * yet processed by ssl3_read_bytes: */\r\n\tunsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];\r\n\tunsigned int alert_fragment_len;\r\n\tunsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];\r\n\tunsigned int handshake_fragment_len;\r\n\r\n\tunsigned int retransmitting;\r\n\tunsigned int change_cipher_spec_ok;\r\n\r\n#ifndef OPENSSL_NO_SCTP\r\n\t/* used when SSL_ST_XX_FLUSH is entered */\r\n\tint next_state;\r\n\r\n\tint shutdown_received;\r\n#endif\r\n\r\n\t} DTLS1_STATE;\r\n\r\ntypedef struct dtls1_record_data_st\r\n\t{\r\n\tunsigned char *packet;\r\n\tunsigned int   packet_length;\r\n\tSSL3_BUFFER    rbuf;\r\n\tSSL3_RECORD    rrec;\r\n#ifndef OPENSSL_NO_SCTP\r\n\tstruct bio_dgram_sctp_rcvinfo recordinfo;\r\n#endif\r\n\t} DTLS1_RECORD_DATA;\r\n\r\n#endif\r\n\r\n/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */\r\n#define DTLS1_TMO_READ_COUNT                      2\r\n#define DTLS1_TMO_WRITE_COUNT                     2\r\n\r\n#define DTLS1_TMO_ALERT_COUNT                     12\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/e_os2.h",
    "content": "/* e_os2.h */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifndef HEADER_E_OS2_H\r\n#define HEADER_E_OS2_H\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/******************************************************************************\r\n * Detect operating systems.  This probably needs completing.\r\n * The result is that at least one OPENSSL_SYS_os macro should be defined.\r\n * However, if none is defined, Unix is assumed.\r\n **/\r\n\r\n#define OPENSSL_SYS_UNIX\r\n\r\n/* ----------------------- Macintosh, before MacOS X ----------------------- */\r\n#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_MACINTOSH_CLASSIC\r\n#endif\r\n\r\n/* ----------------------- NetWare ----------------------------------------- */\r\n#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_NETWARE\r\n#endif\r\n\r\n/* ---------------------- Microsoft operating systems ---------------------- */\r\n\r\n/* Note that MSDOS actually denotes 32-bit environments running on top of\r\n   MS-DOS, such as DJGPP one. */\r\n#if defined(OPENSSL_SYSNAME_MSDOS)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_MSDOS\r\n#endif\r\n\r\n/* For 32 bit environment, there seems to be the CygWin environment and then\r\n   all the others that try to do the same thing Microsoft does... */\r\n#if defined(OPENSSL_SYSNAME_UWIN)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_WIN32_UWIN\r\n#else\r\n# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32)\r\n#  undef OPENSSL_SYS_UNIX\r\n#  define OPENSSL_SYS_WIN32_CYGWIN\r\n# else\r\n#  if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)\r\n#   undef OPENSSL_SYS_UNIX\r\n#   define OPENSSL_SYS_WIN32\r\n#  endif\r\n#  if defined(OPENSSL_SYSNAME_WINNT)\r\n#   undef OPENSSL_SYS_UNIX\r\n#   define OPENSSL_SYS_WINNT\r\n#  endif\r\n#  if defined(OPENSSL_SYSNAME_WINCE)\r\n#   undef OPENSSL_SYS_UNIX\r\n#   define OPENSSL_SYS_WINCE\r\n#  endif\r\n# endif\r\n#endif\r\n\r\n/* Anything that tries to look like Microsoft is \"Windows\" */\r\n#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_WINDOWS\r\n# ifndef OPENSSL_SYS_MSDOS\r\n#  define OPENSSL_SYS_MSDOS\r\n# endif\r\n#endif\r\n\r\n/* DLL settings.  This part is a bit tough, because it's up to the application\r\n   implementor how he or she will link the application, so it requires some\r\n   macro to be used. */\r\n#ifdef OPENSSL_SYS_WINDOWS\r\n# ifndef OPENSSL_OPT_WINDLL\r\n#  if defined(_WINDLL) /* This is used when building OpenSSL to indicate that\r\n                          DLL linkage should be used */\r\n#   define OPENSSL_OPT_WINDLL\r\n#  endif\r\n# endif\r\n#endif\r\n\r\n/* -------------------------------- OpenVMS -------------------------------- */\r\n#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_VMS\r\n# if defined(__DECC)\r\n#  define OPENSSL_SYS_VMS_DECC\r\n# elif defined(__DECCXX)\r\n#  define OPENSSL_SYS_VMS_DECC\r\n#  define OPENSSL_SYS_VMS_DECCXX\r\n# else\r\n#  define OPENSSL_SYS_VMS_NODECC\r\n# endif\r\n#endif\r\n\r\n/* --------------------------------- OS/2 ---------------------------------- */\r\n#if defined(__EMX__) || defined(__OS2__)\r\n# undef OPENSSL_SYS_UNIX\r\n# define OPENSSL_SYS_OS2\r\n#endif\r\n\r\n/* --------------------------------- Unix ---------------------------------- */\r\n#ifdef OPENSSL_SYS_UNIX\r\n# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)\r\n#  define OPENSSL_SYS_LINUX\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_MPE\r\n#  define OPENSSL_SYS_MPE\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_SNI\r\n#  define OPENSSL_SYS_SNI\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_ULTRASPARC\r\n#  define OPENSSL_SYS_ULTRASPARC\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_NEWS4\r\n#  define OPENSSL_SYS_NEWS4\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_MACOSX\r\n#  define OPENSSL_SYS_MACOSX\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY\r\n#  define OPENSSL_SYS_MACOSX_RHAPSODY\r\n#  define OPENSSL_SYS_MACOSX\r\n# endif\r\n# ifdef OPENSSL_SYSNAME_SUNOS\r\n#  define OPENSSL_SYS_SUNOS\r\n#endif\r\n# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)\r\n#  define OPENSSL_SYS_CRAY\r\n# endif\r\n# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)\r\n#  define OPENSSL_SYS_AIX\r\n# endif\r\n#endif\r\n\r\n/* --------------------------------- VOS ----------------------------------- */\r\n#if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS)\r\n# define OPENSSL_SYS_VOS\r\n#ifdef __HPPA__\r\n# define OPENSSL_SYS_VOS_HPPA\r\n#endif\r\n#ifdef __IA32__\r\n# define OPENSSL_SYS_VOS_IA32\r\n#endif\r\n#endif\r\n\r\n/* ------------------------------- VxWorks --------------------------------- */\r\n#ifdef OPENSSL_SYSNAME_VXWORKS\r\n# define OPENSSL_SYS_VXWORKS\r\n#endif\r\n\r\n/* --------------------------------- BeOS ---------------------------------- */\r\n#if defined(__BEOS__)\r\n# define OPENSSL_SYS_BEOS\r\n# include <sys/socket.h>\r\n# if defined(BONE_VERSION)\r\n#  define OPENSSL_SYS_BEOS_BONE\r\n# else\r\n#  define OPENSSL_SYS_BEOS_R5\r\n# endif\r\n#endif\r\n\r\n/**\r\n * That's it for OS-specific stuff\r\n *****************************************************************************/\r\n\r\n\r\n/* Specials for I/O an exit */\r\n#ifdef OPENSSL_SYS_MSDOS\r\n# define OPENSSL_UNISTD_IO <io.h>\r\n# define OPENSSL_DECLARE_EXIT extern void exit(int);\r\n#else\r\n# define OPENSSL_UNISTD_IO OPENSSL_UNISTD\r\n# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */\r\n#endif\r\n\r\n/* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare\r\n   certain global symbols that, with some compilers under VMS, have to be\r\n   defined and declared explicitely with globaldef and globalref.\r\n   Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare\r\n   DLL exports and imports for compilers under Win32.  These are a little\r\n   more complicated to use.  Basically, for any library that exports some\r\n   global variables, the following code must be present in the header file\r\n   that declares them, before OPENSSL_EXTERN is used:\r\n\r\n   #ifdef SOME_BUILD_FLAG_MACRO\r\n   # undef OPENSSL_EXTERN\r\n   # define OPENSSL_EXTERN OPENSSL_EXPORT\r\n   #endif\r\n\r\n   The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL\r\n   have some generally sensible values, and for OPENSSL_EXTERN to have the\r\n   value OPENSSL_IMPORT.\r\n*/\r\n\r\n#if defined(OPENSSL_SYS_VMS_NODECC)\r\n# define OPENSSL_EXPORT globalref\r\n# define OPENSSL_IMPORT globalref\r\n# define OPENSSL_GLOBAL globaldef\r\n#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)\r\n# define OPENSSL_EXPORT extern __declspec(dllexport)\r\n# define OPENSSL_IMPORT extern __declspec(dllimport)\r\n# define OPENSSL_GLOBAL\r\n#else\r\n# define OPENSSL_EXPORT extern\r\n# define OPENSSL_IMPORT extern\r\n# define OPENSSL_GLOBAL\r\n#endif\r\n#define OPENSSL_EXTERN OPENSSL_IMPORT\r\n\r\n/* Macros to allow global variables to be reached through function calls when\r\n   required (if a shared library version requires it, for example.\r\n   The way it's done allows definitions like this:\r\n\r\n\t// in foobar.c\r\n\tOPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)\r\n\t// in foobar.h\r\n\tOPENSSL_DECLARE_GLOBAL(int,foobar);\r\n\t#define foobar OPENSSL_GLOBAL_REF(foobar)\r\n*/\r\n#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value)\t\t\t\\\r\n\ttype *_shadow_##name(void)\t\t\t\t\t\\\r\n\t{ static type _hide_##name=value; return &_hide_##name; }\r\n# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)\r\n# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))\r\n#else\r\n# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value;\r\n# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name\r\n# define OPENSSL_GLOBAL_REF(name) _shadow_##name\r\n#endif\r\n\r\n#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE)\r\n#  define ossl_ssize_t long\r\n#endif\r\n\r\n#ifdef OPENSSL_SYS_MSDOS\r\n#  define ossl_ssize_t long\r\n#endif\r\n\r\n#if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)\r\n#  define ssize_t int\r\n#endif\r\n\r\n#if defined(__ultrix) && !defined(ssize_t)\r\n#  define ossl_ssize_t int \r\n#endif\r\n\r\n#ifndef ossl_ssize_t\r\n#  define ossl_ssize_t ssize_t\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ebcdic.h",
    "content": "/* crypto/ebcdic.h */\r\n\r\n#ifndef HEADER_EBCDIC_H\r\n#define HEADER_EBCDIC_H\r\n\r\n#include <sys/types.h>\r\n\r\n/* Avoid name clashes with other applications */\r\n#define os_toascii   _openssl_os_toascii\r\n#define os_toebcdic  _openssl_os_toebcdic\r\n#define ebcdic2ascii _openssl_ebcdic2ascii\r\n#define ascii2ebcdic _openssl_ascii2ebcdic\r\n\r\nextern const unsigned char os_toascii[256];\r\nextern const unsigned char os_toebcdic[256];\r\nvoid *ebcdic2ascii(void *dest, const void *srce, size_t count);\r\nvoid *ascii2ebcdic(void *dest, const void *srce, size_t count);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ec.h",
    "content": "/* crypto/ec/ec.h */\r\n/*\r\n * Originally written by Bodo Moeller for the OpenSSL project.\r\n */\r\n/**\r\n * \\file crypto/ec/ec.h Include file for the OpenSSL EC functions\r\n * \\author Originally written by Bodo Moeller for the OpenSSL project\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n *\r\n * Portions of the attached software (\"Contribution\") are developed by \r\n * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.\r\n *\r\n * The Contribution is licensed pursuant to the OpenSSL open source\r\n * license provided above.\r\n *\r\n * The elliptic curve binary polynomial software is originally written by \r\n * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.\r\n *\r\n */\r\n\r\n#ifndef HEADER_EC_H\r\n#define HEADER_EC_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_EC\r\n#error EC is disabled.\r\n#endif\r\n\r\n#include <openssl/asn1.h>\r\n#include <openssl/symhacks.h>\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#elif defined(__SUNPRO_C)\r\n# if __SUNPRO_C >= 0x520\r\n# pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)\r\n# endif\r\n#endif\r\n\r\n  \r\n#ifndef OPENSSL_ECC_MAX_FIELD_BITS\r\n# define OPENSSL_ECC_MAX_FIELD_BITS 661\r\n#endif\r\n\r\n/** Enum for the point conversion form as defined in X9.62 (ECDSA)\r\n *  for the encoding of a elliptic curve point (x,y) */\r\ntypedef enum {\r\n\t/** the point is encoded as z||x, where the octet z specifies \r\n\t *  which solution of the quadratic equation y is  */\r\n\tPOINT_CONVERSION_COMPRESSED = 2,\r\n\t/** the point is encoded as z||x||y, where z is the octet 0x02  */\r\n\tPOINT_CONVERSION_UNCOMPRESSED = 4,\r\n\t/** the point is encoded as z||x||y, where the octet z specifies\r\n         *  which solution of the quadratic equation y is  */\r\n\tPOINT_CONVERSION_HYBRID = 6\r\n} point_conversion_form_t;\r\n\r\n\r\ntypedef struct ec_method_st EC_METHOD;\r\n\r\ntypedef struct ec_group_st\r\n\t/*\r\n\t EC_METHOD *meth;\r\n\t -- field definition\r\n\t -- curve coefficients\r\n\t -- optional generator with associated information (order, cofactor)\r\n\t -- optional extra data (precomputed table for fast computation of multiples of generator)\r\n\t -- ASN1 stuff\r\n\t*/\r\n\tEC_GROUP;\r\n\r\ntypedef struct ec_point_st EC_POINT;\r\n\r\n\r\n/********************************************************************/\r\n/*               EC_METHODs for curves over GF(p)                   */       \r\n/********************************************************************/\r\n\r\n/** Returns the basic GFp ec methods which provides the basis for the\r\n *  optimized methods. \r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GFp_simple_method(void);\r\n\r\n/** Returns GFp methods using montgomery multiplication.\r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GFp_mont_method(void);\r\n\r\n/** Returns GFp methods using optimized methods for NIST recommended curves\r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GFp_nist_method(void);\r\n\r\n#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128\r\n/** Returns 64-bit optimized methods for nistp224\r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GFp_nistp224_method(void);\r\n\r\n/** Returns 64-bit optimized methods for nistp256\r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GFp_nistp256_method(void);\r\n\r\n/** Returns 64-bit optimized methods for nistp521\r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GFp_nistp521_method(void);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_EC2M\r\n/********************************************************************/ \r\n/*           EC_METHOD for curves over GF(2^m)                      */\r\n/********************************************************************/\r\n\r\n/** Returns the basic GF2m ec method \r\n *  \\return  EC_METHOD object\r\n */\r\nconst EC_METHOD *EC_GF2m_simple_method(void);\r\n\r\n#endif\r\n\r\n\r\n/********************************************************************/\r\n/*                   EC_GROUP functions                             */\r\n/********************************************************************/\r\n\r\n/** Creates a new EC_GROUP object\r\n *  \\param   meth  EC_METHOD to use\r\n *  \\return  newly created EC_GROUP object or NULL in case of an error.\r\n */\r\nEC_GROUP *EC_GROUP_new(const EC_METHOD *meth);\r\n\r\n/** Frees a EC_GROUP object\r\n *  \\param  group  EC_GROUP object to be freed.\r\n */\r\nvoid EC_GROUP_free(EC_GROUP *group);\r\n\r\n/** Clears and frees a EC_GROUP object\r\n *  \\param  group  EC_GROUP object to be cleared and freed.\r\n */\r\nvoid EC_GROUP_clear_free(EC_GROUP *group);\r\n\r\n/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD.\r\n *  \\param  dst  destination EC_GROUP object\r\n *  \\param  src  source EC_GROUP object\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);\r\n\r\n/** Creates a new EC_GROUP object and copies the copies the content\r\n *  form src to the newly created EC_KEY object\r\n *  \\param  src  source EC_GROUP object\r\n *  \\return newly created EC_GROUP object or NULL in case of an error.\r\n */\r\nEC_GROUP *EC_GROUP_dup(const EC_GROUP *src);\r\n\r\n/** Returns the EC_METHOD of the EC_GROUP object.\r\n *  \\param  group  EC_GROUP object \r\n *  \\return EC_METHOD used in this EC_GROUP object.\r\n */\r\nconst EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);\r\n\r\n/** Returns the field type of the EC_METHOD.\r\n *  \\param  meth  EC_METHOD object\r\n *  \\return NID of the underlying field type OID.\r\n */\r\nint EC_METHOD_get_field_type(const EC_METHOD *meth);\r\n\r\n/** Sets the generator and it's order/cofactor of a EC_GROUP object.\r\n *  \\param  group      EC_GROUP object \r\n *  \\param  generator  EC_POINT object with the generator.\r\n *  \\param  order      the order of the group generated by the generator.\r\n *  \\param  cofactor   the index of the sub-group generated by the generator\r\n *                     in the group of all points on the elliptic curve.\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);\r\n\r\n/** Returns the generator of a EC_GROUP object.\r\n *  \\param  group  EC_GROUP object\r\n *  \\return the currently used generator (possibly NULL).\r\n */\r\nconst EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);\r\n\r\n/** Gets the order of a EC_GROUP\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  order  BIGNUM to which the order is copied\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);\r\n\r\n/** Gets the cofactor of a EC_GROUP\r\n *  \\param  group     EC_GROUP object\r\n *  \\param  cofactor  BIGNUM to which the cofactor is copied\r\n *  \\param  ctx       BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);\r\n\r\n/** Sets the name of a EC_GROUP object\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  nid    NID of the curve name OID\r\n */\r\nvoid EC_GROUP_set_curve_name(EC_GROUP *group, int nid);\r\n\r\n/** Returns the curve name of a EC_GROUP object\r\n *  \\param  group  EC_GROUP object\r\n *  \\return NID of the curve name OID or 0 if not set.\r\n */\r\nint EC_GROUP_get_curve_name(const EC_GROUP *group);\r\n\r\nvoid EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);\r\nint EC_GROUP_get_asn1_flag(const EC_GROUP *group);\r\n\r\nvoid EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);\r\npoint_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);\r\n\r\nunsigned char *EC_GROUP_get0_seed(const EC_GROUP *);\r\nsize_t EC_GROUP_get_seed_len(const EC_GROUP *);\r\nsize_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);\r\n\r\n/** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  p      BIGNUM with the prime number\r\n *  \\param  a      BIGNUM with parameter a of the equation\r\n *  \\param  b      BIGNUM with parameter b of the equation\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\r\n\r\n/** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  p      BIGNUM for the prime number\r\n *  \\param  a      BIGNUM for parameter a of the equation\r\n *  \\param  b      BIGNUM for parameter b of the equation\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\r\n\r\n#ifndef OPENSSL_NO_EC2M\r\n/** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  p      BIGNUM with the polynomial defining the underlying field\r\n *  \\param  a      BIGNUM with parameter a of the equation\r\n *  \\param  b      BIGNUM with parameter b of the equation\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\r\n\r\n/** Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  p      BIGNUM for the polynomial defining the underlying field\r\n *  \\param  a      BIGNUM for parameter a of the equation\r\n *  \\param  b      BIGNUM for parameter b of the equation\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\r\n#endif\r\n/** Returns the number of bits needed to represent a field element \r\n *  \\param  group  EC_GROUP object\r\n *  \\return number of bits needed to represent a field element\r\n */\r\nint EC_GROUP_get_degree(const EC_GROUP *group);\r\n\r\n/** Checks whether the parameter in the EC_GROUP define a valid ec group\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 if group is a valid ec group and 0 otherwise\r\n */\r\nint EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);\r\n\r\n/** Checks whether the discriminant of the elliptic curve is zero or not\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 if the discriminant is not zero and 0 otherwise\r\n */\r\nint EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);\r\n\r\n/** Compares two EC_GROUP objects\r\n *  \\param  a    first EC_GROUP object\r\n *  \\param  b    second EC_GROUP object\r\n *  \\param  ctx  BN_CTX object (optional)\r\n *  \\return 0 if both groups are equal and 1 otherwise\r\n */\r\nint EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);\r\n\r\n/* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*()\r\n * after choosing an appropriate EC_METHOD */\r\n\r\n/** Creates a new EC_GROUP object with the specified parameters defined\r\n *  over GFp (defined by the equation y^2 = x^3 + a*x + b)\r\n *  \\param  p    BIGNUM with the prime number\r\n *  \\param  a    BIGNUM with the parameter a of the equation\r\n *  \\param  b    BIGNUM with the parameter b of the equation\r\n *  \\param  ctx  BN_CTX object (optional)\r\n *  \\return newly created EC_GROUP object with the specified parameters\r\n */\r\nEC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\r\n#ifndef OPENSSL_NO_EC2M\r\n/** Creates a new EC_GROUP object with the specified parameters defined\r\n *  over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b)\r\n *  \\param  p    BIGNUM with the polynomial defining the underlying field\r\n *  \\param  a    BIGNUM with the parameter a of the equation\r\n *  \\param  b    BIGNUM with the parameter b of the equation\r\n *  \\param  ctx  BN_CTX object (optional)\r\n *  \\return newly created EC_GROUP object with the specified parameters\r\n */\r\nEC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\r\n#endif\r\n/** Creates a EC_GROUP object with a curve specified by a NID\r\n *  \\param  nid  NID of the OID of the curve name\r\n *  \\return newly created EC_GROUP object with specified curve or NULL\r\n *          if an error occurred\r\n */\r\nEC_GROUP *EC_GROUP_new_by_curve_name(int nid);\r\n\r\n\r\n/********************************************************************/\r\n/*               handling of internal curves                        */\r\n/********************************************************************/\r\n\r\ntypedef struct { \r\n\tint nid;\r\n\tconst char *comment;\r\n\t} EC_builtin_curve;\r\n\r\n/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number \r\n * of all available curves or zero if a error occurred. \r\n * In case r ist not zero nitems EC_builtin_curve structures \r\n * are filled with the data of the first nitems internal groups */\r\nsize_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);\r\n\r\n\r\n/********************************************************************/\r\n/*                    EC_POINT functions                            */\r\n/********************************************************************/\r\n\r\n/** Creates a new EC_POINT object for the specified EC_GROUP\r\n *  \\param  group  EC_GROUP the underlying EC_GROUP object\r\n *  \\return newly created EC_POINT object or NULL if an error occurred\r\n */\r\nEC_POINT *EC_POINT_new(const EC_GROUP *group);\r\n\r\n/** Frees a EC_POINT object\r\n *  \\param  point  EC_POINT object to be freed\r\n */\r\nvoid EC_POINT_free(EC_POINT *point);\r\n\r\n/** Clears and frees a EC_POINT object\r\n *  \\param  point  EC_POINT object to be cleared and freed\r\n */\r\nvoid EC_POINT_clear_free(EC_POINT *point);\r\n\r\n/** Copies EC_POINT object\r\n *  \\param  dst  destination EC_POINT object\r\n *  \\param  src  source EC_POINT object\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);\r\n\r\n/** Creates a new EC_POINT object and copies the content of the supplied\r\n *  EC_POINT\r\n *  \\param  src    source EC_POINT object\r\n *  \\param  group  underlying the EC_GROUP object\r\n *  \\return newly created EC_POINT object or NULL if an error occurred \r\n */\r\nEC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);\r\n \r\n/** Returns the EC_METHOD used in EC_POINT object \r\n *  \\param  point  EC_POINT object\r\n *  \\return the EC_METHOD used\r\n */\r\nconst EC_METHOD *EC_POINT_method_of(const EC_POINT *point);\r\n\r\n/** Sets a point to infinity (neutral element)\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  point  EC_POINT to set to infinity\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);\r\n\r\n/** Sets the jacobian projective coordinates of a EC_POINT over GFp\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM with the x-coordinate\r\n *  \\param  y      BIGNUM with the y-coordinate\r\n *  \\param  z      BIGNUM with the z-coordinate\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,\r\n\tconst BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);\r\n\r\n/** Gets the jacobian projective coordinates of a EC_POINT over GFp\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM for the x-coordinate\r\n *  \\param  y      BIGNUM for the y-coordinate\r\n *  \\param  z      BIGNUM for the z-coordinate\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,\r\n\tconst EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);\r\n\r\n/** Sets the affine coordinates of a EC_POINT over GFp\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM with the x-coordinate\r\n *  \\param  y      BIGNUM with the y-coordinate\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,\r\n\tconst BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);\r\n\r\n/** Gets the affine coordinates of a EC_POINT over GFp\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM for the x-coordinate\r\n *  \\param  y      BIGNUM for the y-coordinate\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,\r\n\tconst EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\r\n\r\n/** Sets the x9.62 compressed coordinates of a EC_POINT over GFp\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM with x-coordinate\r\n *  \\param  y_bit  integer with the y-Bit (either 0 or 1)\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,\r\n\tconst BIGNUM *x, int y_bit, BN_CTX *ctx);\r\n#ifndef OPENSSL_NO_EC2M\r\n/** Sets the affine coordinates of a EC_POINT over GF2m\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM with the x-coordinate\r\n *  \\param  y      BIGNUM with the y-coordinate\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,\r\n\tconst BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);\r\n\r\n/** Gets the affine coordinates of a EC_POINT over GF2m\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM for the x-coordinate\r\n *  \\param  y      BIGNUM for the y-coordinate\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,\r\n\tconst EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\r\n\r\n/** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  x      BIGNUM with x-coordinate\r\n *  \\param  y_bit  integer with the y-Bit (either 0 or 1)\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,\r\n\tconst BIGNUM *x, int y_bit, BN_CTX *ctx);\r\n#endif\r\n/** Encodes a EC_POINT object to a octet string\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  form   point conversion form\r\n *  \\param  buf    memory buffer for the result. If NULL the function returns\r\n *                 required buffer size.\r\n *  \\param  len    length of the memory buffer\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return the length of the encoded octet string or 0 if an error occurred\r\n */\r\nsize_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,\r\n\tpoint_conversion_form_t form,\r\n        unsigned char *buf, size_t len, BN_CTX *ctx);\r\n\r\n/** Decodes a EC_POINT from a octet string\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\param  buf    memory buffer with the encoded ec point\r\n *  \\param  len    length of the encoded ec point\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,\r\n        const unsigned char *buf, size_t len, BN_CTX *ctx);\r\n\r\n/* other interfaces to point2oct/oct2point: */\r\nBIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,\r\n\tpoint_conversion_form_t form, BIGNUM *, BN_CTX *);\r\nEC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,\r\n\tEC_POINT *, BN_CTX *);\r\nchar *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,\r\n\tpoint_conversion_form_t form, BN_CTX *);\r\nEC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,\r\n\tEC_POINT *, BN_CTX *);\r\n\r\n\r\n/********************************************************************/\r\n/*         functions for doing EC_POINT arithmetic                  */\r\n/********************************************************************/\r\n\r\n/** Computes the sum of two EC_POINT \r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  r      EC_POINT object for the result (r = a + b)\r\n *  \\param  a      EC_POINT object with the first summand\r\n *  \\param  b      EC_POINT object with the second summand\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);\r\n\r\n/** Computes the double of a EC_POINT\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  r      EC_POINT object for the result (r = 2 * a)\r\n *  \\param  a      EC_POINT object \r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx);\r\n\r\n/** Computes the inverse of a EC_POINT\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  a      EC_POINT object to be inverted (it's used for the result as well)\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);\r\n\r\n/** Checks whether the point is the neutral element of the group\r\n *  \\param  group  the underlying EC_GROUP object\r\n *  \\param  p      EC_POINT object\r\n *  \\return 1 if the point is the neutral element and 0 otherwise\r\n */\r\nint EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);\r\n\r\n/** Checks whether the point is on the curve \r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  point  EC_POINT object to check\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 if point if on the curve and 0 otherwise\r\n */\r\nint EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx);\r\n\r\n/** Compares two EC_POINTs \r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  a      first EC_POINT object\r\n *  \\param  b      second EC_POINT object\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 0 if both points are equal and a value != 0 otherwise\r\n */\r\nint EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);\r\n\r\nint EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);\r\nint EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *);\r\n\r\n/** Computes r = generator * n sum_{i=0}^num p[i] * m[i]\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  r      EC_POINT object for the result\r\n *  \\param  n      BIGNUM with the multiplier for the group generator (optional)\r\n *  \\param  num    number futher summands\r\n *  \\param  p      array of size num of EC_POINT objects\r\n *  \\param  m      array of size num of BIGNUM objects\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);\r\n\r\n/** Computes r = generator * n + q * m\r\n *  \\param  group  underlying EC_GROUP object\r\n *  \\param  r      EC_POINT object for the result\r\n *  \\param  n      BIGNUM with the multiplier for the group generator (optional)\r\n *  \\param  q      EC_POINT object with the first factor of the second summand\r\n *  \\param  m      BIGNUM with the second factor of the second summand\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);\r\n\r\n/** Stores multiples of generator for faster point multiplication\r\n *  \\param  group  EC_GROUP object\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occured\r\n */\r\nint EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);\r\n\r\n/** Reports whether a precomputation has been done\r\n *  \\param  group  EC_GROUP object\r\n *  \\return 1 if a pre-computation has been done and 0 otherwise\r\n */\r\nint EC_GROUP_have_precompute_mult(const EC_GROUP *group);\r\n\r\n\r\n/********************************************************************/\r\n/*                       ASN1 stuff                                 */\r\n/********************************************************************/\r\n\r\n/* EC_GROUP_get_basis_type() returns the NID of the basis type\r\n * used to represent the field elements */\r\nint EC_GROUP_get_basis_type(const EC_GROUP *);\r\n#ifndef OPENSSL_NO_EC2M\r\nint EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);\r\nint EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, \r\n\tunsigned int *k2, unsigned int *k3);\r\n#endif\r\n\r\n#define OPENSSL_EC_NAMED_CURVE\t0x001\r\n\r\ntypedef struct ecpk_parameters_st ECPKPARAMETERS;\r\n\r\nEC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);\r\nint i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);\r\n\r\n#define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)\r\n#define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)\r\n#define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \\\r\n                (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))\r\n#define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \\\r\n\t\t(unsigned char *)(x))\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint     ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);\r\n#endif\r\n#ifndef OPENSSL_NO_FP_API\r\nint     ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);\r\n#endif\r\n\r\n\r\n/********************************************************************/\r\n/*                      EC_KEY functions                            */\r\n/********************************************************************/\r\n\r\ntypedef struct ec_key_st EC_KEY;\r\n\r\n/* some values for the encoding_flag */\r\n#define EC_PKEY_NO_PARAMETERS\t0x001\r\n#define EC_PKEY_NO_PUBKEY\t0x002\r\n\r\n/* some values for the flags field */\r\n#define EC_FLAG_NON_FIPS_ALLOW\t0x1\r\n#define EC_FLAG_FIPS_CHECKED\t0x2\r\n\r\n/** Creates a new EC_KEY object.\r\n *  \\return EC_KEY object or NULL if an error occurred.\r\n */\r\nEC_KEY *EC_KEY_new(void);\r\n\r\nint EC_KEY_get_flags(const EC_KEY *key);\r\n\r\nvoid EC_KEY_set_flags(EC_KEY *key, int flags);\r\n\r\nvoid EC_KEY_clear_flags(EC_KEY *key, int flags);\r\n\r\n/** Creates a new EC_KEY object using a named curve as underlying\r\n *  EC_GROUP object.\r\n *  \\param  nid  NID of the named curve.\r\n *  \\return EC_KEY object or NULL if an error occurred. \r\n */\r\nEC_KEY *EC_KEY_new_by_curve_name(int nid);\r\n\r\n/** Frees a EC_KEY object.\r\n *  \\param  key  EC_KEY object to be freed.\r\n */\r\nvoid EC_KEY_free(EC_KEY *key);\r\n\r\n/** Copies a EC_KEY object.\r\n *  \\param  dst  destination EC_KEY object\r\n *  \\param  src  src EC_KEY object\r\n *  \\return dst or NULL if an error occurred.\r\n */\r\nEC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);\r\n\r\n/** Creates a new EC_KEY object and copies the content from src to it.\r\n *  \\param  src  the source EC_KEY object\r\n *  \\return newly created EC_KEY object or NULL if an error occurred.\r\n */\r\nEC_KEY *EC_KEY_dup(const EC_KEY *src);\r\n\r\n/** Increases the internal reference count of a EC_KEY object.\r\n *  \\param  key  EC_KEY object\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_KEY_up_ref(EC_KEY *key);\r\n\r\n/** Returns the EC_GROUP object of a EC_KEY object\r\n *  \\param  key  EC_KEY object\r\n *  \\return the EC_GROUP object (possibly NULL).\r\n */\r\nconst EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);\r\n\r\n/** Sets the EC_GROUP of a EC_KEY object.\r\n *  \\param  key    EC_KEY object\r\n *  \\param  group  EC_GROUP to use in the EC_KEY object (note: the EC_KEY\r\n *                 object will use an own copy of the EC_GROUP).\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);\r\n\r\n/** Returns the private key of a EC_KEY object.\r\n *  \\param  key  EC_KEY object\r\n *  \\return a BIGNUM with the private key (possibly NULL).\r\n */\r\nconst BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);\r\n\r\n/** Sets the private key of a EC_KEY object.\r\n *  \\param  key  EC_KEY object\r\n *  \\param  prv  BIGNUM with the private key (note: the EC_KEY object\r\n *               will use an own copy of the BIGNUM).\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);\r\n\r\n/** Returns the public key of a EC_KEY object.\r\n *  \\param  key  the EC_KEY object\r\n *  \\return a EC_POINT object with the public key (possibly NULL)\r\n */\r\nconst EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);\r\n\r\n/** Sets the public key of a EC_KEY object.\r\n *  \\param  key  EC_KEY object\r\n *  \\param  pub  EC_POINT object with the public key (note: the EC_KEY object\r\n *               will use an own copy of the EC_POINT object).\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);\r\n\r\nunsigned EC_KEY_get_enc_flags(const EC_KEY *key);\r\nvoid EC_KEY_set_enc_flags(EC_KEY *, unsigned int);\r\npoint_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);\r\nvoid EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);\r\n/* functions to set/get method specific data  */\r\nvoid *EC_KEY_get_key_method_data(EC_KEY *, \r\n\tvoid *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));\r\nvoid EC_KEY_insert_key_method_data(EC_KEY *, void *data,\r\n\tvoid *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));\r\n/* wrapper functions for the underlying EC_GROUP object */\r\nvoid EC_KEY_set_asn1_flag(EC_KEY *, int);\r\n\r\n/** Creates a table of pre-computed multiples of the generator to \r\n *  accelerate further EC_KEY operations.\r\n *  \\param  key  EC_KEY object\r\n *  \\param  ctx  BN_CTX object (optional)\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);\r\n\r\n/** Creates a new ec private (and optional a new public) key.\r\n *  \\param  key  EC_KEY object\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint EC_KEY_generate_key(EC_KEY *key);\r\n\r\n/** Verifies that a private and/or public key is valid.\r\n *  \\param  key  the EC_KEY object\r\n *  \\return 1 on success and 0 otherwise.\r\n */\r\nint EC_KEY_check_key(const EC_KEY *key);\r\n\r\n/** Sets a public key from affine coordindates performing\r\n *  neccessary NIST PKV tests.\r\n *  \\param  key  the EC_KEY object\r\n *  \\param  x    public key x coordinate\r\n *  \\param  y    public key y coordinate\r\n *  \\return 1 on success and 0 otherwise.\r\n */\r\nint EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y);\r\n\r\n\r\n/********************************************************************/\r\n/*        de- and encoding functions for SEC1 ECPrivateKey          */\r\n/********************************************************************/\r\n\r\n/** Decodes a private key from a memory buffer.\r\n *  \\param  key  a pointer to a EC_KEY object which should be used (or NULL)\r\n *  \\param  in   pointer to memory with the DER encoded private key\r\n *  \\param  len  length of the DER encoded private key\r\n *  \\return the decoded private key or NULL if an error occurred.\r\n */\r\nEC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);\r\n\r\n/** Encodes a private key object and stores the result in a buffer.\r\n *  \\param  key  the EC_KEY object to encode\r\n *  \\param  out  the buffer for the result (if NULL the function returns number\r\n *               of bytes needed).\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);\r\n\r\n\r\n/********************************************************************/\r\n/*        de- and encoding functions for EC parameters              */\r\n/********************************************************************/\r\n\r\n/** Decodes ec parameter from a memory buffer.\r\n *  \\param  key  a pointer to a EC_KEY object which should be used (or NULL)\r\n *  \\param  in   pointer to memory with the DER encoded ec parameters\r\n *  \\param  len  length of the DER encoded ec parameters\r\n *  \\return a EC_KEY object with the decoded parameters or NULL if an error\r\n *          occurred.\r\n */\r\nEC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len);\r\n\r\n/** Encodes ec parameter and stores the result in a buffer.\r\n *  \\param  key  the EC_KEY object with ec paramters to encode\r\n *  \\param  out  the buffer for the result (if NULL the function returns number\r\n *               of bytes needed).\r\n *  \\return 1 on success and 0 if an error occurred.\r\n */\r\nint i2d_ECParameters(EC_KEY *key, unsigned char **out);\r\n\r\n\r\n/********************************************************************/\r\n/*         de- and encoding functions for EC public key             */\r\n/*         (octet string, not DER -- hence 'o2i' and 'i2o')         */\r\n/********************************************************************/\r\n\r\n/** Decodes a ec public key from a octet string.\r\n *  \\param  key  a pointer to a EC_KEY object which should be used\r\n *  \\param  in   memory buffer with the encoded public key\r\n *  \\param  len  length of the encoded public key\r\n *  \\return EC_KEY object with decoded public key or NULL if an error\r\n *          occurred.\r\n */\r\nEC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len);\r\n\r\n/** Encodes a ec public key in an octet string.\r\n *  \\param  key  the EC_KEY object with the public key\r\n *  \\param  out  the buffer for the result (if NULL the function returns number\r\n *               of bytes needed).\r\n *  \\return 1 on success and 0 if an error occurred\r\n */\r\nint i2o_ECPublicKey(EC_KEY *key, unsigned char **out);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n/** Prints out the ec parameters on human readable form.\r\n *  \\param  bp   BIO object to which the information is printed\r\n *  \\param  key  EC_KEY object\r\n *  \\return 1 on success and 0 if an error occurred\r\n */\r\nint\tECParameters_print(BIO *bp, const EC_KEY *key);\r\n\r\n/** Prints out the contents of a EC_KEY object\r\n *  \\param  bp   BIO object to which the information is printed\r\n *  \\param  key  EC_KEY object\r\n *  \\param  off  line offset \r\n *  \\return 1 on success and 0 if an error occurred\r\n */\r\nint\tEC_KEY_print(BIO *bp, const EC_KEY *key, int off);\r\n\r\n#endif\r\n#ifndef OPENSSL_NO_FP_API\r\n/** Prints out the ec parameters on human readable form.\r\n *  \\param  fp   file descriptor to which the information is printed\r\n *  \\param  key  EC_KEY object\r\n *  \\return 1 on success and 0 if an error occurred\r\n */\r\nint\tECParameters_print_fp(FILE *fp, const EC_KEY *key);\r\n\r\n/** Prints out the contents of a EC_KEY object\r\n *  \\param  fp   file descriptor to which the information is printed\r\n *  \\param  key  EC_KEY object\r\n *  \\param  off  line offset \r\n *  \\return 1 on success and 0 if an error occurred\r\n */\r\nint\tEC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);\r\n\r\n#endif\r\n\r\n#define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)\r\n\r\n#ifndef __cplusplus\r\n#if defined(__SUNPRO_C)\r\n#  if __SUNPRO_C >= 0x520\r\n# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)\r\n#  endif\r\n# endif\r\n#endif\r\n\r\n#define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN, \\\r\n\t\t\t\tEVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL)\r\n\r\n\r\n#define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID\t\t(EVP_PKEY_ALG_CTRL + 1)\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_EC_strings(void);\r\n\r\n/* Error codes for the EC functions. */\r\n\r\n/* Function codes. */\r\n#define EC_F_BN_TO_FELEM\t\t\t\t 224\r\n#define EC_F_COMPUTE_WNAF\t\t\t\t 143\r\n#define EC_F_D2I_ECPARAMETERS\t\t\t\t 144\r\n#define EC_F_D2I_ECPKPARAMETERS\t\t\t\t 145\r\n#define EC_F_D2I_ECPRIVATEKEY\t\t\t\t 146\r\n#define EC_F_DO_EC_KEY_PRINT\t\t\t\t 221\r\n#define EC_F_ECKEY_PARAM2TYPE\t\t\t\t 223\r\n#define EC_F_ECKEY_PARAM_DECODE\t\t\t\t 212\r\n#define EC_F_ECKEY_PRIV_DECODE\t\t\t\t 213\r\n#define EC_F_ECKEY_PRIV_ENCODE\t\t\t\t 214\r\n#define EC_F_ECKEY_PUB_DECODE\t\t\t\t 215\r\n#define EC_F_ECKEY_PUB_ENCODE\t\t\t\t 216\r\n#define EC_F_ECKEY_TYPE2PARAM\t\t\t\t 220\r\n#define EC_F_ECPARAMETERS_PRINT\t\t\t\t 147\r\n#define EC_F_ECPARAMETERS_PRINT_FP\t\t\t 148\r\n#define EC_F_ECPKPARAMETERS_PRINT\t\t\t 149\r\n#define EC_F_ECPKPARAMETERS_PRINT_FP\t\t\t 150\r\n#define EC_F_ECP_NIST_MOD_192\t\t\t\t 203\r\n#define EC_F_ECP_NIST_MOD_224\t\t\t\t 204\r\n#define EC_F_ECP_NIST_MOD_256\t\t\t\t 205\r\n#define EC_F_ECP_NIST_MOD_521\t\t\t\t 206\r\n#define EC_F_EC_ASN1_GROUP2CURVE\t\t\t 153\r\n#define EC_F_EC_ASN1_GROUP2FIELDID\t\t\t 154\r\n#define EC_F_EC_ASN1_GROUP2PARAMETERS\t\t\t 155\r\n#define EC_F_EC_ASN1_GROUP2PKPARAMETERS\t\t\t 156\r\n#define EC_F_EC_ASN1_PARAMETERS2GROUP\t\t\t 157\r\n#define EC_F_EC_ASN1_PKPARAMETERS2GROUP\t\t\t 158\r\n#define EC_F_EC_EX_DATA_SET_DATA\t\t\t 211\r\n#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY\t\t 208\r\n#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT\t 159\r\n#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE\t\t 195\r\n#define EC_F_EC_GF2M_SIMPLE_OCT2POINT\t\t\t 160\r\n#define EC_F_EC_GF2M_SIMPLE_POINT2OCT\t\t\t 161\r\n#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162\r\n#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163\r\n#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES\t 164\r\n#define EC_F_EC_GFP_MONT_FIELD_DECODE\t\t\t 133\r\n#define EC_F_EC_GFP_MONT_FIELD_ENCODE\t\t\t 134\r\n#define EC_F_EC_GFP_MONT_FIELD_MUL\t\t\t 131\r\n#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE\t\t 209\r\n#define EC_F_EC_GFP_MONT_FIELD_SQR\t\t\t 132\r\n#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE\t\t 189\r\n#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP\t\t 135\r\n#define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE\t\t 225\r\n#define EC_F_EC_GFP_NISTP224_POINTS_MUL\t\t\t 228\r\n#define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226\r\n#define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE\t\t 230\r\n#define EC_F_EC_GFP_NISTP256_POINTS_MUL\t\t\t 231\r\n#define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232\r\n#define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE\t\t 233\r\n#define EC_F_EC_GFP_NISTP521_POINTS_MUL\t\t\t 234\r\n#define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235\r\n#define EC_F_EC_GFP_NIST_FIELD_MUL\t\t\t 200\r\n#define EC_F_EC_GFP_NIST_FIELD_SQR\t\t\t 201\r\n#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE\t\t 202\r\n#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT\t 165\r\n#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE\t\t 166\r\n#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP\t\t 100\r\n#define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR\t\t 101\r\n#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE\t\t\t 102\r\n#define EC_F_EC_GFP_SIMPLE_OCT2POINT\t\t\t 103\r\n#define EC_F_EC_GFP_SIMPLE_POINT2OCT\t\t\t 104\r\n#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE\t\t 137\r\n#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES\t 167\r\n#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105\r\n#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES\t 168\r\n#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128\r\n#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES\t 169\r\n#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129\r\n#define EC_F_EC_GROUP_CHECK\t\t\t\t 170\r\n#define EC_F_EC_GROUP_CHECK_DISCRIMINANT\t\t 171\r\n#define EC_F_EC_GROUP_COPY\t\t\t\t 106\r\n#define EC_F_EC_GROUP_GET0_GENERATOR\t\t\t 139\r\n#define EC_F_EC_GROUP_GET_COFACTOR\t\t\t 140\r\n#define EC_F_EC_GROUP_GET_CURVE_GF2M\t\t\t 172\r\n#define EC_F_EC_GROUP_GET_CURVE_GFP\t\t\t 130\r\n#define EC_F_EC_GROUP_GET_DEGREE\t\t\t 173\r\n#define EC_F_EC_GROUP_GET_ORDER\t\t\t\t 141\r\n#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS\t\t 193\r\n#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS\t\t 194\r\n#define EC_F_EC_GROUP_NEW\t\t\t\t 108\r\n#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME\t\t\t 174\r\n#define EC_F_EC_GROUP_NEW_FROM_DATA\t\t\t 175\r\n#define EC_F_EC_GROUP_PRECOMPUTE_MULT\t\t\t 142\r\n#define EC_F_EC_GROUP_SET_CURVE_GF2M\t\t\t 176\r\n#define EC_F_EC_GROUP_SET_CURVE_GFP\t\t\t 109\r\n#define EC_F_EC_GROUP_SET_EXTRA_DATA\t\t\t 110\r\n#define EC_F_EC_GROUP_SET_GENERATOR\t\t\t 111\r\n#define EC_F_EC_KEY_CHECK_KEY\t\t\t\t 177\r\n#define EC_F_EC_KEY_COPY\t\t\t\t 178\r\n#define EC_F_EC_KEY_GENERATE_KEY\t\t\t 179\r\n#define EC_F_EC_KEY_NEW\t\t\t\t\t 182\r\n#define EC_F_EC_KEY_PRINT\t\t\t\t 180\r\n#define EC_F_EC_KEY_PRINT_FP\t\t\t\t 181\r\n#define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES\t 229\r\n#define EC_F_EC_POINTS_MAKE_AFFINE\t\t\t 136\r\n#define EC_F_EC_POINT_ADD\t\t\t\t 112\r\n#define EC_F_EC_POINT_CMP\t\t\t\t 113\r\n#define EC_F_EC_POINT_COPY\t\t\t\t 114\r\n#define EC_F_EC_POINT_DBL\t\t\t\t 115\r\n#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M\t 183\r\n#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP\t 116\r\n#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP\t 117\r\n#define EC_F_EC_POINT_INVERT\t\t\t\t 210\r\n#define EC_F_EC_POINT_IS_AT_INFINITY\t\t\t 118\r\n#define EC_F_EC_POINT_IS_ON_CURVE\t\t\t 119\r\n#define EC_F_EC_POINT_MAKE_AFFINE\t\t\t 120\r\n#define EC_F_EC_POINT_MUL\t\t\t\t 184\r\n#define EC_F_EC_POINT_NEW\t\t\t\t 121\r\n#define EC_F_EC_POINT_OCT2POINT\t\t\t\t 122\r\n#define EC_F_EC_POINT_POINT2OCT\t\t\t\t 123\r\n#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M\t 185\r\n#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP\t 124\r\n#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M\t 186\r\n#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP\t 125\r\n#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP\t 126\r\n#define EC_F_EC_POINT_SET_TO_INFINITY\t\t\t 127\r\n#define EC_F_EC_PRE_COMP_DUP\t\t\t\t 207\r\n#define EC_F_EC_PRE_COMP_NEW\t\t\t\t 196\r\n#define EC_F_EC_WNAF_MUL\t\t\t\t 187\r\n#define EC_F_EC_WNAF_PRECOMPUTE_MULT\t\t\t 188\r\n#define EC_F_I2D_ECPARAMETERS\t\t\t\t 190\r\n#define EC_F_I2D_ECPKPARAMETERS\t\t\t\t 191\r\n#define EC_F_I2D_ECPRIVATEKEY\t\t\t\t 192\r\n#define EC_F_I2O_ECPUBLICKEY\t\t\t\t 151\r\n#define EC_F_NISTP224_PRE_COMP_NEW\t\t\t 227\r\n#define EC_F_NISTP256_PRE_COMP_NEW\t\t\t 236\r\n#define EC_F_NISTP521_PRE_COMP_NEW\t\t\t 237\r\n#define EC_F_O2I_ECPUBLICKEY\t\t\t\t 152\r\n#define EC_F_OLD_EC_PRIV_DECODE\t\t\t\t 222\r\n#define EC_F_PKEY_EC_CTRL\t\t\t\t 197\r\n#define EC_F_PKEY_EC_CTRL_STR\t\t\t\t 198\r\n#define EC_F_PKEY_EC_DERIVE\t\t\t\t 217\r\n#define EC_F_PKEY_EC_KEYGEN\t\t\t\t 199\r\n#define EC_F_PKEY_EC_PARAMGEN\t\t\t\t 219\r\n#define EC_F_PKEY_EC_SIGN\t\t\t\t 218\r\n\r\n/* Reason codes. */\r\n#define EC_R_ASN1_ERROR\t\t\t\t\t 115\r\n#define EC_R_ASN1_UNKNOWN_FIELD\t\t\t\t 116\r\n#define EC_R_BIGNUM_OUT_OF_RANGE\t\t\t 144\r\n#define EC_R_BUFFER_TOO_SMALL\t\t\t\t 100\r\n#define EC_R_COORDINATES_OUT_OF_RANGE\t\t\t 146\r\n#define EC_R_D2I_ECPKPARAMETERS_FAILURE\t\t\t 117\r\n#define EC_R_DECODE_ERROR\t\t\t\t 142\r\n#define EC_R_DISCRIMINANT_IS_ZERO\t\t\t 118\r\n#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE\t\t 119\r\n#define EC_R_FIELD_TOO_LARGE\t\t\t\t 143\r\n#define EC_R_GF2M_NOT_SUPPORTED\t\t\t\t 147\r\n#define EC_R_GROUP2PKPARAMETERS_FAILURE\t\t\t 120\r\n#define EC_R_I2D_ECPKPARAMETERS_FAILURE\t\t\t 121\r\n#define EC_R_INCOMPATIBLE_OBJECTS\t\t\t 101\r\n#define EC_R_INVALID_ARGUMENT\t\t\t\t 112\r\n#define EC_R_INVALID_COMPRESSED_POINT\t\t\t 110\r\n#define EC_R_INVALID_COMPRESSION_BIT\t\t\t 109\r\n#define EC_R_INVALID_CURVE\t\t\t\t 141\r\n#define EC_R_INVALID_DIGEST_TYPE\t\t\t 138\r\n#define EC_R_INVALID_ENCODING\t\t\t\t 102\r\n#define EC_R_INVALID_FIELD\t\t\t\t 103\r\n#define EC_R_INVALID_FORM\t\t\t\t 104\r\n#define EC_R_INVALID_GROUP_ORDER\t\t\t 122\r\n#define EC_R_INVALID_PENTANOMIAL_BASIS\t\t\t 132\r\n#define EC_R_INVALID_PRIVATE_KEY\t\t\t 123\r\n#define EC_R_INVALID_TRINOMIAL_BASIS\t\t\t 137\r\n#define EC_R_KEYS_NOT_SET\t\t\t\t 140\r\n#define EC_R_MISSING_PARAMETERS\t\t\t\t 124\r\n#define EC_R_MISSING_PRIVATE_KEY\t\t\t 125\r\n#define EC_R_NOT_A_NIST_PRIME\t\t\t\t 135\r\n#define EC_R_NOT_A_SUPPORTED_NIST_PRIME\t\t\t 136\r\n#define EC_R_NOT_IMPLEMENTED\t\t\t\t 126\r\n#define EC_R_NOT_INITIALIZED\t\t\t\t 111\r\n#define EC_R_NO_FIELD_MOD\t\t\t\t 133\r\n#define EC_R_NO_PARAMETERS_SET\t\t\t\t 139\r\n#define EC_R_PASSED_NULL_PARAMETER\t\t\t 134\r\n#define EC_R_PKPARAMETERS2GROUP_FAILURE\t\t\t 127\r\n#define EC_R_POINT_AT_INFINITY\t\t\t\t 106\r\n#define EC_R_POINT_IS_NOT_ON_CURVE\t\t\t 107\r\n#define EC_R_SLOT_FULL\t\t\t\t\t 108\r\n#define EC_R_UNDEFINED_GENERATOR\t\t\t 113\r\n#define EC_R_UNDEFINED_ORDER\t\t\t\t 128\r\n#define EC_R_UNKNOWN_GROUP\t\t\t\t 129\r\n#define EC_R_UNKNOWN_ORDER\t\t\t\t 114\r\n#define EC_R_UNSUPPORTED_FIELD\t\t\t\t 131\r\n#define EC_R_WRONG_CURVE_PARAMETERS\t\t\t 145\r\n#define EC_R_WRONG_ORDER\t\t\t\t 130\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ecdh.h",
    "content": "/* crypto/ecdh/ecdh.h */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n *\r\n * The Elliptic Curve Public-Key Crypto Library (ECC Code) included\r\n * herein is developed by SUN MICROSYSTEMS, INC., and is contributed\r\n * to the OpenSSL project.\r\n *\r\n * The ECC Code is licensed pursuant to the OpenSSL open source\r\n * license provided below.\r\n *\r\n * The ECDH software is originally written by Douglas Stebila of\r\n * Sun Microsystems Laboratories.\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2000-2002 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n#ifndef HEADER_ECDH_H\r\n#define HEADER_ECDH_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_ECDH\r\n#error ECDH is disabled.\r\n#endif\r\n\r\n#include <openssl/ec.h>\r\n#include <openssl/ossl_typ.h>\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nconst ECDH_METHOD *ECDH_OpenSSL(void);\r\n\r\nvoid\t  ECDH_set_default_method(const ECDH_METHOD *);\r\nconst ECDH_METHOD *ECDH_get_default_method(void);\r\nint \t  ECDH_set_method(EC_KEY *, const ECDH_METHOD *);\r\n\r\nint ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,\r\n                     void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));\r\n\r\nint \t  ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new \r\n\t\t*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint \t  ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);\r\nvoid \t  *ECDH_get_ex_data(EC_KEY *d, int idx);\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_ECDH_strings(void);\r\n\r\n/* Error codes for the ECDH functions. */\r\n\r\n/* Function codes. */\r\n#define ECDH_F_ECDH_CHECK\t\t\t\t 102\r\n#define ECDH_F_ECDH_COMPUTE_KEY\t\t\t\t 100\r\n#define ECDH_F_ECDH_DATA_NEW_METHOD\t\t\t 101\r\n\r\n/* Reason codes. */\r\n#define ECDH_R_KDF_FAILED\t\t\t\t 102\r\n#define ECDH_R_NON_FIPS_METHOD\t\t\t\t 103\r\n#define ECDH_R_NO_PRIVATE_VALUE\t\t\t\t 100\r\n#define ECDH_R_POINT_ARITHMETIC_FAILURE\t\t\t 101\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ecdsa.h",
    "content": "/* crypto/ecdsa/ecdsa.h */\r\n/**\r\n * \\file   crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions\r\n * \\author Written by Nils Larsch for the OpenSSL project\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n#ifndef HEADER_ECDSA_H\r\n#define HEADER_ECDSA_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_ECDSA\r\n#error ECDSA is disabled.\r\n#endif\r\n\r\n#include <openssl/ec.h>\r\n#include <openssl/ossl_typ.h>\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct ECDSA_SIG_st\r\n\t{\r\n\tBIGNUM *r;\r\n\tBIGNUM *s;\r\n\t} ECDSA_SIG;\r\n\r\n/** Allocates and initialize a ECDSA_SIG structure\r\n *  \\return pointer to a ECDSA_SIG structure or NULL if an error occurred\r\n */\r\nECDSA_SIG *ECDSA_SIG_new(void);\r\n\r\n/** frees a ECDSA_SIG structure\r\n *  \\param  sig  pointer to the ECDSA_SIG structure\r\n */\r\nvoid\t  ECDSA_SIG_free(ECDSA_SIG *sig);\r\n\r\n/** DER encode content of ECDSA_SIG object (note: this function modifies *pp\r\n *  (*pp += length of the DER encoded signature)).\r\n *  \\param  sig  pointer to the ECDSA_SIG object\r\n *  \\param  pp   pointer to a unsigned char pointer for the output or NULL\r\n *  \\return the length of the DER encoded ECDSA_SIG object or 0 \r\n */\r\nint\t  i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);\r\n\r\n/** Decodes a DER encoded ECDSA signature (note: this function changes *pp\r\n *  (*pp += len)). \r\n *  \\param  sig  pointer to ECDSA_SIG pointer (may be NULL)\r\n *  \\param  pp   memory buffer with the DER encoded signature\r\n *  \\param  len  length of the buffer\r\n *  \\return pointer to the decoded ECDSA_SIG structure (or NULL)\r\n */\r\nECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);\r\n\r\n/** Computes the ECDSA signature of the given hash value using\r\n *  the supplied private key and returns the created signature.\r\n *  \\param  dgst      pointer to the hash value\r\n *  \\param  dgst_len  length of the hash value\r\n *  \\param  eckey     EC_KEY object containing a private EC key\r\n *  \\return pointer to a ECDSA_SIG structure or NULL if an error occurred\r\n */\r\nECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);\r\n\r\n/** Computes ECDSA signature of a given hash value using the supplied\r\n *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).\r\n *  \\param  dgst     pointer to the hash value to sign\r\n *  \\param  dgstlen  length of the hash value\r\n *  \\param  kinv     BIGNUM with a pre-computed inverse k (optional)\r\n *  \\param  rp       BIGNUM with a pre-computed rp value (optioanl), \r\n *                   see ECDSA_sign_setup\r\n *  \\param  eckey    EC_KEY object containing a private EC key\r\n *  \\return pointer to a ECDSA_SIG structure or NULL if an error occurred\r\n */\r\nECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, \r\n\t\tconst BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);\r\n\r\n/** Verifies that the supplied signature is a valid ECDSA\r\n *  signature of the supplied hash value using the supplied public key.\r\n *  \\param  dgst      pointer to the hash value\r\n *  \\param  dgst_len  length of the hash value\r\n *  \\param  sig       ECDSA_SIG structure\r\n *  \\param  eckey     EC_KEY object containing a public EC key\r\n *  \\return 1 if the signature is valid, 0 if the signature is invalid\r\n *          and -1 on error\r\n */\r\nint\t  ECDSA_do_verify(const unsigned char *dgst, int dgst_len,\r\n\t\tconst ECDSA_SIG *sig, EC_KEY* eckey);\r\n\r\nconst ECDSA_METHOD *ECDSA_OpenSSL(void);\r\n\r\n/** Sets the default ECDSA method\r\n *  \\param  meth  new default ECDSA_METHOD\r\n */\r\nvoid\t  ECDSA_set_default_method(const ECDSA_METHOD *meth);\r\n\r\n/** Returns the default ECDSA method\r\n *  \\return pointer to ECDSA_METHOD structure containing the default method\r\n */\r\nconst ECDSA_METHOD *ECDSA_get_default_method(void);\r\n\r\n/** Sets method to be used for the ECDSA operations\r\n *  \\param  eckey  EC_KEY object\r\n *  \\param  meth   new method\r\n *  \\return 1 on success and 0 otherwise \r\n */\r\nint \t  ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);\r\n\r\n/** Returns the maximum length of the DER encoded signature\r\n *  \\param  eckey  EC_KEY object\r\n *  \\return numbers of bytes required for the DER encoded signature\r\n */\r\nint\t  ECDSA_size(const EC_KEY *eckey);\r\n\r\n/** Precompute parts of the signing operation\r\n *  \\param  eckey  EC_KEY object containing a private EC key\r\n *  \\param  ctx    BN_CTX object (optional)\r\n *  \\param  kinv   BIGNUM pointer for the inverse of k\r\n *  \\param  rp     BIGNUM pointer for x coordinate of k * generator\r\n *  \\return 1 on success and 0 otherwise\r\n */\r\nint \t  ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, \r\n\t\tBIGNUM **rp);\r\n\r\n/** Computes ECDSA signature of a given hash value using the supplied\r\n *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).\r\n *  \\param  type     this parameter is ignored\r\n *  \\param  dgst     pointer to the hash value to sign\r\n *  \\param  dgstlen  length of the hash value\r\n *  \\param  sig      memory for the DER encoded created signature\r\n *  \\param  siglen   pointer to the length of the returned signature\r\n *  \\param  eckey    EC_KEY object containing a private EC key\r\n *  \\return 1 on success and 0 otherwise\r\n */\r\nint\t  ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, \r\n\t\tunsigned char *sig, unsigned int *siglen, EC_KEY *eckey);\r\n\r\n\r\n/** Computes ECDSA signature of a given hash value using the supplied\r\n *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).\r\n *  \\param  type     this parameter is ignored\r\n *  \\param  dgst     pointer to the hash value to sign\r\n *  \\param  dgstlen  length of the hash value\r\n *  \\param  sig      buffer to hold the DER encoded signature\r\n *  \\param  siglen   pointer to the length of the returned signature\r\n *  \\param  kinv     BIGNUM with a pre-computed inverse k (optional)\r\n *  \\param  rp       BIGNUM with a pre-computed rp value (optioanl), \r\n *                   see ECDSA_sign_setup\r\n *  \\param  eckey    EC_KEY object containing a private EC key\r\n *  \\return 1 on success and 0 otherwise\r\n */\r\nint\t  ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, \r\n\t\tunsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,\r\n\t\tconst BIGNUM *rp, EC_KEY *eckey);\r\n\r\n/** Verifies that the given signature is valid ECDSA signature\r\n *  of the supplied hash value using the specified public key.\r\n *  \\param  type     this parameter is ignored\r\n *  \\param  dgst     pointer to the hash value \r\n *  \\param  dgstlen  length of the hash value\r\n *  \\param  sig      pointer to the DER encoded signature\r\n *  \\param  siglen   length of the DER encoded signature\r\n *  \\param  eckey    EC_KEY object containing a public EC key\r\n *  \\return 1 if the signature is valid, 0 if the signature is invalid\r\n *          and -1 on error\r\n */\r\nint \t  ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, \r\n\t\tconst unsigned char *sig, int siglen, EC_KEY *eckey);\r\n\r\n/* the standard ex_data functions */\r\nint \t  ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new \r\n\t\t*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint \t  ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);\r\nvoid \t  *ECDSA_get_ex_data(EC_KEY *d, int idx);\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_ECDSA_strings(void);\r\n\r\n/* Error codes for the ECDSA functions. */\r\n\r\n/* Function codes. */\r\n#define ECDSA_F_ECDSA_CHECK\t\t\t\t 104\r\n#define ECDSA_F_ECDSA_DATA_NEW_METHOD\t\t\t 100\r\n#define ECDSA_F_ECDSA_DO_SIGN\t\t\t\t 101\r\n#define ECDSA_F_ECDSA_DO_VERIFY\t\t\t\t 102\r\n#define ECDSA_F_ECDSA_SIGN_SETUP\t\t\t 103\r\n\r\n/* Reason codes. */\r\n#define ECDSA_R_BAD_SIGNATURE\t\t\t\t 100\r\n#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE\t\t 101\r\n#define ECDSA_R_ERR_EC_LIB\t\t\t\t 102\r\n#define ECDSA_R_MISSING_PARAMETERS\t\t\t 103\r\n#define ECDSA_R_NEED_NEW_SETUP_VALUES\t\t\t 106\r\n#define ECDSA_R_NON_FIPS_METHOD\t\t\t\t 107\r\n#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED\t\t 104\r\n#define ECDSA_R_SIGNATURE_MALLOC_FAILED\t\t\t 105\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/engine.h",
    "content": "/* openssl/engine.h */\r\n/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL\r\n * project 2000.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n * ECDH support in OpenSSL originally developed by \r\n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\r\n */\r\n\r\n#ifndef HEADER_ENGINE_H\r\n#define HEADER_ENGINE_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_ENGINE\r\n#error ENGINE is disabled.\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#ifndef OPENSSL_NO_RSA\r\n#include <openssl/rsa.h>\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\n#include <openssl/dsa.h>\r\n#endif\r\n#ifndef OPENSSL_NO_DH\r\n#include <openssl/dh.h>\r\n#endif\r\n#ifndef OPENSSL_NO_ECDH\r\n#include <openssl/ecdh.h>\r\n#endif\r\n#ifndef OPENSSL_NO_ECDSA\r\n#include <openssl/ecdsa.h>\r\n#endif\r\n#include <openssl/rand.h>\r\n#include <openssl/ui.h>\r\n#include <openssl/err.h>\r\n#endif\r\n\r\n#include <openssl/ossl_typ.h>\r\n#include <openssl/symhacks.h>\r\n\r\n#include <openssl/x509.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* These flags are used to control combinations of algorithm (methods)\r\n * by bitwise \"OR\"ing. */\r\n#define ENGINE_METHOD_RSA\t\t(unsigned int)0x0001\r\n#define ENGINE_METHOD_DSA\t\t(unsigned int)0x0002\r\n#define ENGINE_METHOD_DH\t\t(unsigned int)0x0004\r\n#define ENGINE_METHOD_RAND\t\t(unsigned int)0x0008\r\n#define ENGINE_METHOD_ECDH\t\t(unsigned int)0x0010\r\n#define ENGINE_METHOD_ECDSA\t\t(unsigned int)0x0020\r\n#define ENGINE_METHOD_CIPHERS\t\t(unsigned int)0x0040\r\n#define ENGINE_METHOD_DIGESTS\t\t(unsigned int)0x0080\r\n#define ENGINE_METHOD_STORE\t\t(unsigned int)0x0100\r\n#define ENGINE_METHOD_PKEY_METHS\t(unsigned int)0x0200\r\n#define ENGINE_METHOD_PKEY_ASN1_METHS\t(unsigned int)0x0400\r\n/* Obvious all-or-nothing cases. */\r\n#define ENGINE_METHOD_ALL\t\t(unsigned int)0xFFFF\r\n#define ENGINE_METHOD_NONE\t\t(unsigned int)0x0000\r\n\r\n/* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used\r\n * internally to control registration of ENGINE implementations, and can be set\r\n * by ENGINE_set_table_flags(). The \"NOINIT\" flag prevents attempts to\r\n * initialise registered ENGINEs if they are not already initialised. */\r\n#define ENGINE_TABLE_FLAG_NOINIT\t(unsigned int)0x0001\r\n\r\n/* ENGINE flags that can be set by ENGINE_set_flags(). */\r\n/* #define ENGINE_FLAGS_MALLOCED\t0x0001 */ /* Not used */\r\n\r\n/* This flag is for ENGINEs that wish to handle the various 'CMD'-related\r\n * control commands on their own. Without this flag, ENGINE_ctrl() handles these\r\n * control commands on behalf of the ENGINE using their \"cmd_defns\" data. */\r\n#define ENGINE_FLAGS_MANUAL_CMD_CTRL\t(int)0x0002\r\n\r\n/* This flag is for ENGINEs who return new duplicate structures when found via\r\n * \"ENGINE_by_id()\". When an ENGINE must store state (eg. if ENGINE_ctrl()\r\n * commands are called in sequence as part of some stateful process like\r\n * key-generation setup and execution), it can set this flag - then each attempt\r\n * to obtain the ENGINE will result in it being copied into a new structure.\r\n * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments\r\n * the existing ENGINE's structural reference count. */\r\n#define ENGINE_FLAGS_BY_ID_COPY\t\t(int)0x0004\r\n\r\n/* This flag if for an ENGINE that does not want its methods registered as \r\n * part of ENGINE_register_all_complete() for example if the methods are\r\n * not usable as default methods.\r\n */\r\n\r\n#define ENGINE_FLAGS_NO_REGISTER_ALL\t(int)0x0008\r\n\r\n/* ENGINEs can support their own command types, and these flags are used in\r\n * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each\r\n * command expects. Currently only numeric and string input is supported. If a\r\n * control command supports none of the _NUMERIC, _STRING, or _NO_INPUT options,\r\n * then it is regarded as an \"internal\" control command - and not for use in\r\n * config setting situations. As such, they're not available to the\r\n * ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() access. Changes to\r\n * this list of 'command types' should be reflected carefully in\r\n * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */\r\n\r\n/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */\r\n#define ENGINE_CMD_FLAG_NUMERIC\t\t(unsigned int)0x0001\r\n/* accepts string input (cast from 'void*' to 'const char *', 4th parameter to\r\n * ENGINE_ctrl) */\r\n#define ENGINE_CMD_FLAG_STRING\t\t(unsigned int)0x0002\r\n/* Indicates that the control command takes *no* input. Ie. the control command\r\n * is unparameterised. */\r\n#define ENGINE_CMD_FLAG_NO_INPUT\t(unsigned int)0x0004\r\n/* Indicates that the control command is internal. This control command won't\r\n * be shown in any output, and is only usable through the ENGINE_ctrl_cmd()\r\n * function. */\r\n#define ENGINE_CMD_FLAG_INTERNAL\t(unsigned int)0x0008\r\n\r\n/* NB: These 3 control commands are deprecated and should not be used. ENGINEs\r\n * relying on these commands should compile conditional support for\r\n * compatibility (eg. if these symbols are defined) but should also migrate the\r\n * same functionality to their own ENGINE-specific control functions that can be\r\n * \"discovered\" by calling applications. The fact these control commands\r\n * wouldn't be \"executable\" (ie. usable by text-based config) doesn't change the\r\n * fact that application code can find and use them without requiring per-ENGINE\r\n * hacking. */\r\n\r\n/* These flags are used to tell the ctrl function what should be done.\r\n * All command numbers are shared between all engines, even if some don't\r\n * make sense to some engines.  In such a case, they do nothing but return\r\n * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */\r\n#define ENGINE_CTRL_SET_LOGSTREAM\t\t1\r\n#define ENGINE_CTRL_SET_PASSWORD_CALLBACK\t2\r\n#define ENGINE_CTRL_HUP\t\t\t\t3 /* Close and reinitialise any\r\n\t\t\t\t\t\t     handles/connections etc. */\r\n#define ENGINE_CTRL_SET_USER_INTERFACE          4 /* Alternative to callback */\r\n#define ENGINE_CTRL_SET_CALLBACK_DATA           5 /* User-specific data, used\r\n\t\t\t\t\t\t     when calling the password\r\n\t\t\t\t\t\t     callback and the user\r\n\t\t\t\t\t\t     interface */\r\n#define ENGINE_CTRL_LOAD_CONFIGURATION\t\t6 /* Load a configuration, given\r\n\t\t\t\t\t\t     a string that represents a\r\n\t\t\t\t\t\t     file name or so */\r\n#define ENGINE_CTRL_LOAD_SECTION\t\t7 /* Load data from a given\r\n\t\t\t\t\t\t     section in the already loaded\r\n\t\t\t\t\t\t     configuration */\r\n\r\n/* These control commands allow an application to deal with an arbitrary engine\r\n * in a dynamic way. Warn: Negative return values indicate errors FOR THESE\r\n * COMMANDS because zero is used to indicate 'end-of-list'. Other commands,\r\n * including ENGINE-specific command types, return zero for an error.\r\n *\r\n * An ENGINE can choose to implement these ctrl functions, and can internally\r\n * manage things however it chooses - it does so by setting the\r\n * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise the\r\n * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns\r\n * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl()\r\n * handler need only implement its own commands - the above \"meta\" commands will\r\n * be taken care of. */\r\n\r\n/* Returns non-zero if the supplied ENGINE has a ctrl() handler. If \"not\", then\r\n * all the remaining control commands will return failure, so it is worth\r\n * checking this first if the caller is trying to \"discover\" the engine's\r\n * capabilities and doesn't want errors generated unnecessarily. */\r\n#define ENGINE_CTRL_HAS_CTRL_FUNCTION\t\t10\r\n/* Returns a positive command number for the first command supported by the\r\n * engine. Returns zero if no ctrl commands are supported. */\r\n#define ENGINE_CTRL_GET_FIRST_CMD_TYPE\t\t11\r\n/* The 'long' argument specifies a command implemented by the engine, and the\r\n * return value is the next command supported, or zero if there are no more. */\r\n#define ENGINE_CTRL_GET_NEXT_CMD_TYPE\t\t12\r\n/* The 'void*' argument is a command name (cast from 'const char *'), and the\r\n * return value is the command that corresponds to it. */\r\n#define ENGINE_CTRL_GET_CMD_FROM_NAME\t\t13\r\n/* The next two allow a command to be converted into its corresponding string\r\n * form. In each case, the 'long' argument supplies the command. In the NAME_LEN\r\n * case, the return value is the length of the command name (not counting a\r\n * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer\r\n * large enough, and it will be populated with the name of the command (WITH a\r\n * trailing EOL). */\r\n#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD\t14\r\n#define ENGINE_CTRL_GET_NAME_FROM_CMD\t\t15\r\n/* The next two are similar but give a \"short description\" of a command. */\r\n#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD\t16\r\n#define ENGINE_CTRL_GET_DESC_FROM_CMD\t\t17\r\n/* With this command, the return value is the OR'd combination of\r\n * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given\r\n * engine-specific ctrl command expects. */\r\n#define ENGINE_CTRL_GET_CMD_FLAGS\t\t18\r\n\r\n/* ENGINE implementations should start the numbering of their own control\r\n * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */\r\n#define ENGINE_CMD_BASE\t\t\t\t200\r\n\r\n/* NB: These 2 nCipher \"chil\" control commands are deprecated, and their\r\n * functionality is now available through ENGINE-specific control commands\r\n * (exposed through the above-mentioned 'CMD'-handling). Code using these 2\r\n * commands should be migrated to the more general command handling before these\r\n * are removed. */\r\n\r\n/* Flags specific to the nCipher \"chil\" engine */\r\n#define ENGINE_CTRL_CHIL_SET_FORKCHECK\t\t100\r\n\t/* Depending on the value of the (long)i argument, this sets or\r\n\t * unsets the SimpleForkCheck flag in the CHIL API to enable or\r\n\t * disable checking and workarounds for applications that fork().\r\n\t */\r\n#define ENGINE_CTRL_CHIL_NO_LOCKING\t\t101\r\n\t/* This prevents the initialisation function from providing mutex\r\n\t * callbacks to the nCipher library. */\r\n\r\n/* If an ENGINE supports its own specific control commands and wishes the\r\n * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its\r\n * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries\r\n * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that\r\n * supports the stated commands (ie. the \"cmd_num\" entries as described by the\r\n * array). NB: The array must be ordered in increasing order of cmd_num.\r\n * \"null-terminated\" means that the last ENGINE_CMD_DEFN element has cmd_num set\r\n * to zero and/or cmd_name set to NULL. */\r\ntypedef struct ENGINE_CMD_DEFN_st\r\n\t{\r\n\tunsigned int cmd_num; /* The command number */\r\n\tconst char *cmd_name; /* The command name itself */\r\n\tconst char *cmd_desc; /* A short description of the command */\r\n\tunsigned int cmd_flags; /* The input the command expects */\r\n\t} ENGINE_CMD_DEFN;\r\n\r\n/* Generic function pointer */\r\ntypedef int (*ENGINE_GEN_FUNC_PTR)(void);\r\n/* Generic function pointer taking no arguments */\r\ntypedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);\r\n/* Specific control function pointer */\r\ntypedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void));\r\n/* Generic load_key function pointer */\r\ntypedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,\r\n\tUI_METHOD *ui_method, void *callback_data);\r\ntypedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl,\r\n\tSTACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey,\r\n\tSTACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data);\r\n/* These callback types are for an ENGINE's handler for cipher and digest logic.\r\n * These handlers have these prototypes;\r\n *   int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);\r\n *   int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid);\r\n * Looking at how to implement these handlers in the case of cipher support, if\r\n * the framework wants the EVP_CIPHER for 'nid', it will call;\r\n *   foo(e, &p_evp_cipher, NULL, nid);    (return zero for failure)\r\n * If the framework wants a list of supported 'nid's, it will call;\r\n *   foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error)\r\n */\r\n/* Returns to a pointer to the array of supported cipher 'nid's. If the second\r\n * parameter is non-NULL it is set to the size of the returned array. */\r\ntypedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int);\r\ntypedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int);\r\ntypedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const int **, int);\r\ntypedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int);\r\n/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE\r\n * structures where the pointers have a \"structural reference\". This means that\r\n * their reference is to allowed access to the structure but it does not imply\r\n * that the structure is functional. To simply increment or decrement the\r\n * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not\r\n * required when iterating using ENGINE_get_next as it will automatically\r\n * decrement the structural reference count of the \"current\" ENGINE and\r\n * increment the structural reference count of the ENGINE it returns (unless it\r\n * is NULL). */\r\n\r\n/* Get the first/last \"ENGINE\" type available. */\r\nENGINE *ENGINE_get_first(void);\r\nENGINE *ENGINE_get_last(void);\r\n/* Iterate to the next/previous \"ENGINE\" type (NULL = end of the list). */\r\nENGINE *ENGINE_get_next(ENGINE *e);\r\nENGINE *ENGINE_get_prev(ENGINE *e);\r\n/* Add another \"ENGINE\" type into the array. */\r\nint ENGINE_add(ENGINE *e);\r\n/* Remove an existing \"ENGINE\" type from the array. */\r\nint ENGINE_remove(ENGINE *e);\r\n/* Retrieve an engine from the list by its unique \"id\" value. */\r\nENGINE *ENGINE_by_id(const char *id);\r\n/* Add all the built-in engines. */\r\nvoid ENGINE_load_openssl(void);\r\nvoid ENGINE_load_dynamic(void);\r\n#ifndef OPENSSL_NO_STATIC_ENGINE\r\nvoid ENGINE_load_4758cca(void);\r\nvoid ENGINE_load_aep(void);\r\nvoid ENGINE_load_atalla(void);\r\nvoid ENGINE_load_chil(void);\r\nvoid ENGINE_load_cswift(void);\r\nvoid ENGINE_load_nuron(void);\r\nvoid ENGINE_load_sureware(void);\r\nvoid ENGINE_load_ubsec(void);\r\nvoid ENGINE_load_padlock(void);\r\nvoid ENGINE_load_capi(void);\r\n#ifndef OPENSSL_NO_GMP\r\nvoid ENGINE_load_gmp(void);\r\n#endif\r\n#ifndef OPENSSL_NO_GOST\r\nvoid ENGINE_load_gost(void);\r\n#endif\r\n#endif\r\nvoid ENGINE_load_cryptodev(void);\r\nvoid ENGINE_load_rsax(void);\r\nvoid ENGINE_load_rdrand(void);\r\nvoid ENGINE_load_builtin_engines(void);\r\n\r\n/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation\r\n * \"registry\" handling. */\r\nunsigned int ENGINE_get_table_flags(void);\r\nvoid ENGINE_set_table_flags(unsigned int flags);\r\n\r\n/* Manage registration of ENGINEs per \"table\". For each type, there are 3\r\n * functions;\r\n *   ENGINE_register_***(e) - registers the implementation from 'e' (if it has one)\r\n *   ENGINE_unregister_***(e) - unregister the implementation from 'e'\r\n *   ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list\r\n * Cleanup is automatically registered from each table when required, so\r\n * ENGINE_cleanup() will reverse any \"register\" operations. */\r\n\r\nint ENGINE_register_RSA(ENGINE *e);\r\nvoid ENGINE_unregister_RSA(ENGINE *e);\r\nvoid ENGINE_register_all_RSA(void);\r\n\r\nint ENGINE_register_DSA(ENGINE *e);\r\nvoid ENGINE_unregister_DSA(ENGINE *e);\r\nvoid ENGINE_register_all_DSA(void);\r\n\r\nint ENGINE_register_ECDH(ENGINE *e);\r\nvoid ENGINE_unregister_ECDH(ENGINE *e);\r\nvoid ENGINE_register_all_ECDH(void);\r\n\r\nint ENGINE_register_ECDSA(ENGINE *e);\r\nvoid ENGINE_unregister_ECDSA(ENGINE *e);\r\nvoid ENGINE_register_all_ECDSA(void);\r\n\r\nint ENGINE_register_DH(ENGINE *e);\r\nvoid ENGINE_unregister_DH(ENGINE *e);\r\nvoid ENGINE_register_all_DH(void);\r\n\r\nint ENGINE_register_RAND(ENGINE *e);\r\nvoid ENGINE_unregister_RAND(ENGINE *e);\r\nvoid ENGINE_register_all_RAND(void);\r\n\r\nint ENGINE_register_STORE(ENGINE *e);\r\nvoid ENGINE_unregister_STORE(ENGINE *e);\r\nvoid ENGINE_register_all_STORE(void);\r\n\r\nint ENGINE_register_ciphers(ENGINE *e);\r\nvoid ENGINE_unregister_ciphers(ENGINE *e);\r\nvoid ENGINE_register_all_ciphers(void);\r\n\r\nint ENGINE_register_digests(ENGINE *e);\r\nvoid ENGINE_unregister_digests(ENGINE *e);\r\nvoid ENGINE_register_all_digests(void);\r\n\r\nint ENGINE_register_pkey_meths(ENGINE *e);\r\nvoid ENGINE_unregister_pkey_meths(ENGINE *e);\r\nvoid ENGINE_register_all_pkey_meths(void);\r\n\r\nint ENGINE_register_pkey_asn1_meths(ENGINE *e);\r\nvoid ENGINE_unregister_pkey_asn1_meths(ENGINE *e);\r\nvoid ENGINE_register_all_pkey_asn1_meths(void);\r\n\r\n/* These functions register all support from the above categories. Note, use of\r\n * these functions can result in static linkage of code your application may not\r\n * need. If you only need a subset of functionality, consider using more\r\n * selective initialisation. */\r\nint ENGINE_register_complete(ENGINE *e);\r\nint ENGINE_register_all_complete(void);\r\n\r\n/* Send parametrised control commands to the engine. The possibilities to send\r\n * down an integer, a pointer to data or a function pointer are provided. Any of\r\n * the parameters may or may not be NULL, depending on the command number. In\r\n * actuality, this function only requires a structural (rather than functional)\r\n * reference to an engine, but many control commands may require the engine be\r\n * functional. The caller should be aware of trying commands that require an\r\n * operational ENGINE, and only use functional references in such situations. */\r\nint ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));\r\n\r\n/* This function tests if an ENGINE-specific command is usable as a \"setting\".\r\n * Eg. in an application's config file that gets processed through\r\n * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to\r\n * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */\r\nint ENGINE_cmd_is_executable(ENGINE *e, int cmd);\r\n\r\n/* This function works like ENGINE_ctrl() with the exception of taking a\r\n * command name instead of a command number, and can handle optional commands.\r\n * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to\r\n * use the cmd_name and cmd_optional. */\r\nint ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,\r\n        long i, void *p, void (*f)(void), int cmd_optional);\r\n\r\n/* This function passes a command-name and argument to an ENGINE. The cmd_name\r\n * is converted to a command number and the control command is called using\r\n * 'arg' as an argument (unless the ENGINE doesn't support such a command, in\r\n * which case no control command is called). The command is checked for input\r\n * flags, and if necessary the argument will be converted to a numeric value. If\r\n * cmd_optional is non-zero, then if the ENGINE doesn't support the given\r\n * cmd_name the return value will be success anyway. This function is intended\r\n * for applications to use so that users (or config files) can supply\r\n * engine-specific config data to the ENGINE at run-time to control behaviour of\r\n * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl()\r\n * functions that return data, deal with binary data, or that are otherwise\r\n * supposed to be used directly through ENGINE_ctrl() in application code. Any\r\n * \"return\" data from an ENGINE_ctrl() operation in this function will be lost -\r\n * the return value is interpreted as failure if the return value is zero,\r\n * success otherwise, and this function returns a boolean value as a result. In\r\n * other words, vendors of 'ENGINE'-enabled devices should write ENGINE\r\n * implementations with parameterisations that work in this scheme, so that\r\n * compliant ENGINE-based applications can work consistently with the same\r\n * configuration for the same ENGINE-enabled devices, across applications. */\r\nint ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,\r\n\t\t\t\tint cmd_optional);\r\n\r\n/* These functions are useful for manufacturing new ENGINE structures. They\r\n * don't address reference counting at all - one uses them to populate an ENGINE\r\n * structure with personalised implementations of things prior to using it\r\n * directly or adding it to the builtin ENGINE list in OpenSSL. These are also\r\n * here so that the ENGINE structure doesn't have to be exposed and break binary\r\n * compatibility! */\r\nENGINE *ENGINE_new(void);\r\nint ENGINE_free(ENGINE *e);\r\nint ENGINE_up_ref(ENGINE *e);\r\nint ENGINE_set_id(ENGINE *e, const char *id);\r\nint ENGINE_set_name(ENGINE *e, const char *name);\r\nint ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);\r\nint ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);\r\nint ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth);\r\nint ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth);\r\nint ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);\r\nint ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);\r\nint ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth);\r\nint ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);\r\nint ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);\r\nint ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);\r\nint ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);\r\nint ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);\r\nint ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);\r\nint ENGINE_set_load_ssl_client_cert_function(ENGINE *e,\r\n\t\t\t\tENGINE_SSL_CLIENT_CERT_PTR loadssl_f);\r\nint ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);\r\nint ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);\r\nint ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);\r\nint ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f);\r\nint ENGINE_set_flags(ENGINE *e, int flags);\r\nint ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);\r\n/* These functions allow control over any per-structure ENGINE data. */\r\nint ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\t\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);\r\nvoid *ENGINE_get_ex_data(const ENGINE *e, int idx);\r\n\r\n/* This function cleans up anything that needs it. Eg. the ENGINE_add() function\r\n * automatically ensures the list cleanup function is registered to be called\r\n * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure\r\n * ENGINE_cleanup() will clean up after them. */\r\nvoid ENGINE_cleanup(void);\r\n\r\n/* These return values from within the ENGINE structure. These can be useful\r\n * with functional references as well as structural references - it depends\r\n * which you obtained. Using the result for functional purposes if you only\r\n * obtained a structural reference may be problematic! */\r\nconst char *ENGINE_get_id(const ENGINE *e);\r\nconst char *ENGINE_get_name(const ENGINE *e);\r\nconst RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);\r\nconst DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);\r\nconst ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);\r\nconst ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);\r\nconst DH_METHOD *ENGINE_get_DH(const ENGINE *e);\r\nconst RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);\r\nconst STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);\r\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);\r\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);\r\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);\r\nENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);\r\nENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);\r\nENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);\r\nENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e);\r\nENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);\r\nENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);\r\nENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e);\r\nENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e);\r\nconst EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);\r\nconst EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);\r\nconst EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);\r\nconst EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);\r\nconst EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,\r\n\t\t\t\t\tconst char *str, int len);\r\nconst EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,\r\n\t\t\t\t\tconst char *str, int len);\r\nconst ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);\r\nint ENGINE_get_flags(const ENGINE *e);\r\n\r\n/* FUNCTIONAL functions. These functions deal with ENGINE structures\r\n * that have (or will) be initialised for use. Broadly speaking, the\r\n * structural functions are useful for iterating the list of available\r\n * engine types, creating new engine types, and other \"list\" operations.\r\n * These functions actually deal with ENGINEs that are to be used. As\r\n * such these functions can fail (if applicable) when particular\r\n * engines are unavailable - eg. if a hardware accelerator is not\r\n * attached or not functioning correctly. Each ENGINE has 2 reference\r\n * counts; structural and functional. Every time a functional reference\r\n * is obtained or released, a corresponding structural reference is\r\n * automatically obtained or released too. */\r\n\r\n/* Initialise a engine type for use (or up its reference count if it's\r\n * already in use). This will fail if the engine is not currently\r\n * operational and cannot initialise. */\r\nint ENGINE_init(ENGINE *e);\r\n/* Free a functional reference to a engine type. This does not require\r\n * a corresponding call to ENGINE_free as it also releases a structural\r\n * reference. */\r\nint ENGINE_finish(ENGINE *e);\r\n\r\n/* The following functions handle keys that are stored in some secondary\r\n * location, handled by the engine.  The storage may be on a card or\r\n * whatever. */\r\nEVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,\r\n\tUI_METHOD *ui_method, void *callback_data);\r\nEVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,\r\n\tUI_METHOD *ui_method, void *callback_data);\r\nint ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,\r\n\tSTACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey,\r\n\tSTACK_OF(X509) **pother,\r\n\tUI_METHOD *ui_method, void *callback_data);\r\n\r\n/* This returns a pointer for the current ENGINE structure that\r\n * is (by default) performing any RSA operations. The value returned\r\n * is an incremented reference, so it should be free'd (ENGINE_finish)\r\n * before it is discarded. */\r\nENGINE *ENGINE_get_default_RSA(void);\r\n/* Same for the other \"methods\" */\r\nENGINE *ENGINE_get_default_DSA(void);\r\nENGINE *ENGINE_get_default_ECDH(void);\r\nENGINE *ENGINE_get_default_ECDSA(void);\r\nENGINE *ENGINE_get_default_DH(void);\r\nENGINE *ENGINE_get_default_RAND(void);\r\n/* These functions can be used to get a functional reference to perform\r\n * ciphering or digesting corresponding to \"nid\". */\r\nENGINE *ENGINE_get_cipher_engine(int nid);\r\nENGINE *ENGINE_get_digest_engine(int nid);\r\nENGINE *ENGINE_get_pkey_meth_engine(int nid);\r\nENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid);\r\n\r\n/* This sets a new default ENGINE structure for performing RSA\r\n * operations. If the result is non-zero (success) then the ENGINE\r\n * structure will have had its reference count up'd so the caller\r\n * should still free their own reference 'e'. */\r\nint ENGINE_set_default_RSA(ENGINE *e);\r\nint ENGINE_set_default_string(ENGINE *e, const char *def_list);\r\n/* Same for the other \"methods\" */\r\nint ENGINE_set_default_DSA(ENGINE *e);\r\nint ENGINE_set_default_ECDH(ENGINE *e);\r\nint ENGINE_set_default_ECDSA(ENGINE *e);\r\nint ENGINE_set_default_DH(ENGINE *e);\r\nint ENGINE_set_default_RAND(ENGINE *e);\r\nint ENGINE_set_default_ciphers(ENGINE *e);\r\nint ENGINE_set_default_digests(ENGINE *e);\r\nint ENGINE_set_default_pkey_meths(ENGINE *e);\r\nint ENGINE_set_default_pkey_asn1_meths(ENGINE *e);\r\n\r\n/* The combination \"set\" - the flags are bitwise \"OR\"d from the\r\n * ENGINE_METHOD_*** defines above. As with the \"ENGINE_register_complete()\"\r\n * function, this function can result in unnecessary static linkage. If your\r\n * application requires only specific functionality, consider using more\r\n * selective functions. */\r\nint ENGINE_set_default(ENGINE *e, unsigned int flags);\r\n\r\nvoid ENGINE_add_conf_module(void);\r\n\r\n/* Deprecated functions ... */\r\n/* int ENGINE_clear_defaults(void); */\r\n\r\n/**************************/\r\n/* DYNAMIC ENGINE SUPPORT */\r\n/**************************/\r\n\r\n/* Binary/behaviour compatibility levels */\r\n#define OSSL_DYNAMIC_VERSION\t\t(unsigned long)0x00020000\r\n/* Binary versions older than this are too old for us (whether we're a loader or\r\n * a loadee) */\r\n#define OSSL_DYNAMIC_OLDEST\t\t(unsigned long)0x00020000\r\n\r\n/* When compiling an ENGINE entirely as an external shared library, loadable by\r\n * the \"dynamic\" ENGINE, these types are needed. The 'dynamic_fns' structure\r\n * type provides the calling application's (or library's) error functionality\r\n * and memory management function pointers to the loaded library. These should\r\n * be used/set in the loaded library code so that the loading application's\r\n * 'state' will be used/changed in all operations. The 'static_state' pointer\r\n * allows the loaded library to know if it shares the same static data as the\r\n * calling application (or library), and thus whether these callbacks need to be\r\n * set or not. */\r\ntypedef void *(*dyn_MEM_malloc_cb)(size_t);\r\ntypedef void *(*dyn_MEM_realloc_cb)(void *, size_t);\r\ntypedef void (*dyn_MEM_free_cb)(void *);\r\ntypedef struct st_dynamic_MEM_fns {\r\n\tdyn_MEM_malloc_cb\t\t\tmalloc_cb;\r\n\tdyn_MEM_realloc_cb\t\t\trealloc_cb;\r\n\tdyn_MEM_free_cb\t\t\t\tfree_cb;\r\n\t} dynamic_MEM_fns;\r\n/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use\r\n * these types so we (and any other dependant code) can simplify a bit?? */\r\ntypedef void (*dyn_lock_locking_cb)(int,int,const char *,int);\r\ntypedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int);\r\ntypedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)(\r\n\t\t\t\t\t\tconst char *,int);\r\ntypedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *,\r\n\t\t\t\t\t\tconst char *,int);\r\ntypedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *,\r\n\t\t\t\t\t\tconst char *,int);\r\ntypedef struct st_dynamic_LOCK_fns {\r\n\tdyn_lock_locking_cb\t\t\tlock_locking_cb;\r\n\tdyn_lock_add_lock_cb\t\t\tlock_add_lock_cb;\r\n\tdyn_dynlock_create_cb\t\t\tdynlock_create_cb;\r\n\tdyn_dynlock_lock_cb\t\t\tdynlock_lock_cb;\r\n\tdyn_dynlock_destroy_cb\t\t\tdynlock_destroy_cb;\r\n\t} dynamic_LOCK_fns;\r\n/* The top-level structure */\r\ntypedef struct st_dynamic_fns {\r\n\tvoid \t\t\t\t\t*static_state;\r\n\tconst ERR_FNS\t\t\t\t*err_fns;\r\n\tconst CRYPTO_EX_DATA_IMPL\t\t*ex_data_fns;\r\n\tdynamic_MEM_fns\t\t\t\tmem_fns;\r\n\tdynamic_LOCK_fns\t\t\tlock_fns;\r\n\t} dynamic_fns;\r\n\r\n/* The version checking function should be of this prototype. NB: The\r\n * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code.\r\n * If this function returns zero, it indicates a (potential) version\r\n * incompatibility and the loaded library doesn't believe it can proceed.\r\n * Otherwise, the returned value is the (latest) version supported by the\r\n * loading library. The loader may still decide that the loaded code's version\r\n * is unsatisfactory and could veto the load. The function is expected to\r\n * be implemented with the symbol name \"v_check\", and a default implementation\r\n * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */\r\ntypedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);\r\n#define IMPLEMENT_DYNAMIC_CHECK_FN() \\\r\n\tOPENSSL_EXPORT unsigned long v_check(unsigned long v); \\\r\n\tOPENSSL_EXPORT unsigned long v_check(unsigned long v) { \\\r\n\t\tif(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \\\r\n\t\treturn 0; }\r\n\r\n/* This function is passed the ENGINE structure to initialise with its own\r\n * function and command settings. It should not adjust the structural or\r\n * functional reference counts. If this function returns zero, (a) the load will\r\n * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the\r\n * structure, and (c) the shared library will be unloaded. So implementations\r\n * should do their own internal cleanup in failure circumstances otherwise they\r\n * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that\r\n * the loader is looking for. If this is NULL, the shared library can choose to\r\n * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared\r\n * library must initialise only an ENGINE matching the passed 'id'. The function\r\n * is expected to be implemented with the symbol name \"bind_engine\". A standard\r\n * implementation can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where\r\n * the parameter 'fn' is a callback function that populates the ENGINE structure\r\n * and returns an int value (zero for failure). 'fn' should have prototype;\r\n *    [static] int fn(ENGINE *e, const char *id); */\r\ntypedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,\r\n\t\t\t\tconst dynamic_fns *fns);\r\n#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \\\r\n\tOPENSSL_EXPORT \\\r\n\tint bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \\\r\n\tOPENSSL_EXPORT \\\r\n\tint bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \\\r\n\t\tif(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \\\r\n\t\tif(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \\\r\n\t\t\tfns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \\\r\n\t\t\treturn 0; \\\r\n\t\tCRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \\\r\n\t\tCRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \\\r\n\t\tCRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \\\r\n\t\tCRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \\\r\n\t\tCRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \\\r\n\t\tif(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \\\r\n\t\t\treturn 0; \\\r\n\t\tif(!ERR_set_implementation(fns->err_fns)) return 0; \\\r\n\tskip_cbs: \\\r\n\t\tif(!fn(e,id)) return 0; \\\r\n\t\treturn 1; }\r\n\r\n/* If the loading application (or library) and the loaded ENGINE library share\r\n * the same static data (eg. they're both dynamically linked to the same\r\n * libcrypto.so) we need a way to avoid trying to set system callbacks - this\r\n * would fail, and for the same reason that it's unnecessary to try. If the\r\n * loaded ENGINE has (or gets from through the loader) its own copy of the\r\n * libcrypto static data, we will need to set the callbacks. The easiest way to\r\n * detect this is to have a function that returns a pointer to some static data\r\n * and let the loading application and loaded ENGINE compare their respective\r\n * values. */\r\nvoid *ENGINE_get_static_state(void);\r\n\r\n#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)\r\nvoid ENGINE_setup_bsd_cryptodev(void);\r\n#endif\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_ENGINE_strings(void);\r\n\r\n/* Error codes for the ENGINE functions. */\r\n\r\n/* Function codes. */\r\n#define ENGINE_F_DYNAMIC_CTRL\t\t\t\t 180\r\n#define ENGINE_F_DYNAMIC_GET_DATA_CTX\t\t\t 181\r\n#define ENGINE_F_DYNAMIC_LOAD\t\t\t\t 182\r\n#define ENGINE_F_DYNAMIC_SET_DATA_CTX\t\t\t 183\r\n#define ENGINE_F_ENGINE_ADD\t\t\t\t 105\r\n#define ENGINE_F_ENGINE_BY_ID\t\t\t\t 106\r\n#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE\t\t 170\r\n#define ENGINE_F_ENGINE_CTRL\t\t\t\t 142\r\n#define ENGINE_F_ENGINE_CTRL_CMD\t\t\t 178\r\n#define ENGINE_F_ENGINE_CTRL_CMD_STRING\t\t\t 171\r\n#define ENGINE_F_ENGINE_FINISH\t\t\t\t 107\r\n#define ENGINE_F_ENGINE_FREE_UTIL\t\t\t 108\r\n#define ENGINE_F_ENGINE_GET_CIPHER\t\t\t 185\r\n#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE\t\t 177\r\n#define ENGINE_F_ENGINE_GET_DIGEST\t\t\t 186\r\n#define ENGINE_F_ENGINE_GET_NEXT\t\t\t 115\r\n#define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH\t\t 193\r\n#define ENGINE_F_ENGINE_GET_PKEY_METH\t\t\t 192\r\n#define ENGINE_F_ENGINE_GET_PREV\t\t\t 116\r\n#define ENGINE_F_ENGINE_INIT\t\t\t\t 119\r\n#define ENGINE_F_ENGINE_LIST_ADD\t\t\t 120\r\n#define ENGINE_F_ENGINE_LIST_REMOVE\t\t\t 121\r\n#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY\t\t 150\r\n#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY\t\t\t 151\r\n#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT\t\t 194\r\n#define ENGINE_F_ENGINE_NEW\t\t\t\t 122\r\n#define ENGINE_F_ENGINE_REMOVE\t\t\t\t 123\r\n#define ENGINE_F_ENGINE_SET_DEFAULT_STRING\t\t 189\r\n#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE\t\t 126\r\n#define ENGINE_F_ENGINE_SET_ID\t\t\t\t 129\r\n#define ENGINE_F_ENGINE_SET_NAME\t\t\t 130\r\n#define ENGINE_F_ENGINE_TABLE_REGISTER\t\t\t 184\r\n#define ENGINE_F_ENGINE_UNLOAD_KEY\t\t\t 152\r\n#define ENGINE_F_ENGINE_UNLOCKED_FINISH\t\t\t 191\r\n#define ENGINE_F_ENGINE_UP_REF\t\t\t\t 190\r\n#define ENGINE_F_INT_CTRL_HELPER\t\t\t 172\r\n#define ENGINE_F_INT_ENGINE_CONFIGURE\t\t\t 188\r\n#define ENGINE_F_INT_ENGINE_MODULE_INIT\t\t\t 187\r\n#define ENGINE_F_LOG_MESSAGE\t\t\t\t 141\r\n\r\n/* Reason codes. */\r\n#define ENGINE_R_ALREADY_LOADED\t\t\t\t 100\r\n#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER\t\t 133\r\n#define ENGINE_R_CMD_NOT_EXECUTABLE\t\t\t 134\r\n#define ENGINE_R_COMMAND_TAKES_INPUT\t\t\t 135\r\n#define ENGINE_R_COMMAND_TAKES_NO_INPUT\t\t\t 136\r\n#define ENGINE_R_CONFLICTING_ENGINE_ID\t\t\t 103\r\n#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED\t\t 119\r\n#define ENGINE_R_DH_NOT_IMPLEMENTED\t\t\t 139\r\n#define ENGINE_R_DSA_NOT_IMPLEMENTED\t\t\t 140\r\n#define ENGINE_R_DSO_FAILURE\t\t\t\t 104\r\n#define ENGINE_R_DSO_NOT_FOUND\t\t\t\t 132\r\n#define ENGINE_R_ENGINES_SECTION_ERROR\t\t\t 148\r\n#define ENGINE_R_ENGINE_CONFIGURATION_ERROR\t\t 102\r\n#define ENGINE_R_ENGINE_IS_NOT_IN_LIST\t\t\t 105\r\n#define ENGINE_R_ENGINE_SECTION_ERROR\t\t\t 149\r\n#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY\t\t 128\r\n#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY\t\t 129\r\n#define ENGINE_R_FINISH_FAILED\t\t\t\t 106\r\n#define ENGINE_R_GET_HANDLE_FAILED\t\t\t 107\r\n#define ENGINE_R_ID_OR_NAME_MISSING\t\t\t 108\r\n#define ENGINE_R_INIT_FAILED\t\t\t\t 109\r\n#define ENGINE_R_INTERNAL_LIST_ERROR\t\t\t 110\r\n#define ENGINE_R_INVALID_ARGUMENT\t\t\t 143\r\n#define ENGINE_R_INVALID_CMD_NAME\t\t\t 137\r\n#define ENGINE_R_INVALID_CMD_NUMBER\t\t\t 138\r\n#define ENGINE_R_INVALID_INIT_VALUE\t\t\t 151\r\n#define ENGINE_R_INVALID_STRING\t\t\t\t 150\r\n#define ENGINE_R_NOT_INITIALISED\t\t\t 117\r\n#define ENGINE_R_NOT_LOADED\t\t\t\t 112\r\n#define ENGINE_R_NO_CONTROL_FUNCTION\t\t\t 120\r\n#define ENGINE_R_NO_INDEX\t\t\t\t 144\r\n#define ENGINE_R_NO_LOAD_FUNCTION\t\t\t 125\r\n#define ENGINE_R_NO_REFERENCE\t\t\t\t 130\r\n#define ENGINE_R_NO_SUCH_ENGINE\t\t\t\t 116\r\n#define ENGINE_R_NO_UNLOAD_FUNCTION\t\t\t 126\r\n#define ENGINE_R_PROVIDE_PARAMETERS\t\t\t 113\r\n#define ENGINE_R_RSA_NOT_IMPLEMENTED\t\t\t 141\r\n#define ENGINE_R_UNIMPLEMENTED_CIPHER\t\t\t 146\r\n#define ENGINE_R_UNIMPLEMENTED_DIGEST\t\t\t 147\r\n#define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD\t 101\r\n#define ENGINE_R_VERSION_INCOMPATIBILITY\t\t 145\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/err.h",
    "content": "/* crypto/err/err.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_ERR_H\r\n#define HEADER_ERR_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#endif\r\n\r\n#include <openssl/ossl_typ.h>\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#ifndef OPENSSL_NO_LHASH\r\n#include <openssl/lhash.h>\r\n#endif\r\n\r\n#ifdef\t__cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_ERR\r\n#define ERR_PUT_error(a,b,c,d,e)\tERR_put_error(a,b,c,d,e)\r\n#else\r\n#define ERR_PUT_error(a,b,c,d,e)\tERR_put_error(a,b,c,NULL,0)\r\n#endif\r\n\r\n#include <errno.h>\r\n\r\n#define ERR_TXT_MALLOCED\t0x01\r\n#define ERR_TXT_STRING\t\t0x02\r\n\r\n#define ERR_FLAG_MARK\t\t0x01\r\n\r\n#define ERR_NUM_ERRORS\t16\r\ntypedef struct err_state_st\r\n\t{\r\n\tCRYPTO_THREADID tid;\r\n\tint err_flags[ERR_NUM_ERRORS];\r\n\tunsigned long err_buffer[ERR_NUM_ERRORS];\r\n\tchar *err_data[ERR_NUM_ERRORS];\r\n\tint err_data_flags[ERR_NUM_ERRORS];\r\n\tconst char *err_file[ERR_NUM_ERRORS];\r\n\tint err_line[ERR_NUM_ERRORS];\r\n\tint top,bottom;\r\n\t} ERR_STATE;\r\n\r\n/* library */\r\n#define ERR_LIB_NONE\t\t1\r\n#define ERR_LIB_SYS\t\t2\r\n#define ERR_LIB_BN\t\t3\r\n#define ERR_LIB_RSA\t\t4\r\n#define ERR_LIB_DH\t\t5\r\n#define ERR_LIB_EVP\t\t6\r\n#define ERR_LIB_BUF\t\t7\r\n#define ERR_LIB_OBJ\t\t8\r\n#define ERR_LIB_PEM\t\t9\r\n#define ERR_LIB_DSA\t\t10\r\n#define ERR_LIB_X509\t\t11\r\n/* #define ERR_LIB_METH         12 */\r\n#define ERR_LIB_ASN1\t\t13\r\n#define ERR_LIB_CONF\t\t14\r\n#define ERR_LIB_CRYPTO\t\t15\r\n#define ERR_LIB_EC\t\t16\r\n#define ERR_LIB_SSL\t\t20\r\n/* #define ERR_LIB_SSL23        21 */\r\n/* #define ERR_LIB_SSL2         22 */\r\n/* #define ERR_LIB_SSL3         23 */\r\n/* #define ERR_LIB_RSAREF       30 */\r\n/* #define ERR_LIB_PROXY        31 */\r\n#define ERR_LIB_BIO\t\t32\r\n#define ERR_LIB_PKCS7\t\t33\r\n#define ERR_LIB_X509V3\t\t34\r\n#define ERR_LIB_PKCS12\t\t35\r\n#define ERR_LIB_RAND\t\t36\r\n#define ERR_LIB_DSO\t\t37\r\n#define ERR_LIB_ENGINE\t\t38\r\n#define ERR_LIB_OCSP            39\r\n#define ERR_LIB_UI              40\r\n#define ERR_LIB_COMP            41\r\n#define ERR_LIB_ECDSA\t\t42\r\n#define ERR_LIB_ECDH\t\t43\r\n#define ERR_LIB_STORE           44\r\n#define ERR_LIB_FIPS\t\t45\r\n#define ERR_LIB_CMS\t\t46\r\n#define ERR_LIB_TS\t\t47\r\n#define ERR_LIB_HMAC\t\t48\r\n#define ERR_LIB_JPAKE\t\t49\r\n\r\n#define ERR_LIB_USER\t\t128\r\n\r\n#define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)\r\n#define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)\r\n#define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)\r\n#define DHerr(f,r)   ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)\r\n#define EVPerr(f,r)  ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)\r\n#define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)\r\n#define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)\r\n#define PEMerr(f,r)  ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)\r\n#define DSAerr(f,r)  ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)\r\n#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)\r\n#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)\r\n#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)\r\n#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)\r\n#define ECerr(f,r)   ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)\r\n#define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)\r\n#define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)\r\n#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)\r\n#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)\r\n#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)\r\n#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)\r\n#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)\r\n#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)\r\n#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)\r\n#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)\r\n#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)\r\n#define ECDSAerr(f,r)  ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)\r\n#define ECDHerr(f,r)  ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)\r\n#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)\r\n#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)\r\n#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)\r\n#define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)\r\n#define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)\r\n#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)\r\n\r\n/* Borland C seems too stupid to be able to shift and do longs in\r\n * the pre-processor :-( */\r\n#define ERR_PACK(l,f,r)\t\t(((((unsigned long)l)&0xffL)*0x1000000)| \\\r\n\t\t\t\t((((unsigned long)f)&0xfffL)*0x1000)| \\\r\n\t\t\t\t((((unsigned long)r)&0xfffL)))\r\n#define ERR_GET_LIB(l)\t\t(int)((((unsigned long)l)>>24L)&0xffL)\r\n#define ERR_GET_FUNC(l)\t\t(int)((((unsigned long)l)>>12L)&0xfffL)\r\n#define ERR_GET_REASON(l)\t(int)((l)&0xfffL)\r\n#define ERR_FATAL_ERROR(l)\t(int)((l)&ERR_R_FATAL)\r\n\r\n\r\n/* OS functions */\r\n#define SYS_F_FOPEN\t\t1\r\n#define SYS_F_CONNECT\t\t2\r\n#define SYS_F_GETSERVBYNAME\t3\r\n#define SYS_F_SOCKET\t\t4\r\n#define SYS_F_IOCTLSOCKET\t5\r\n#define SYS_F_BIND\t\t6\r\n#define SYS_F_LISTEN\t\t7\r\n#define SYS_F_ACCEPT\t\t8\r\n#define SYS_F_WSASTARTUP\t9 /* Winsock stuff */\r\n#define SYS_F_OPENDIR\t\t10\r\n#define SYS_F_FREAD\t\t11\r\n\r\n\r\n/* reasons */\r\n#define ERR_R_SYS_LIB\tERR_LIB_SYS       /* 2 */\r\n#define ERR_R_BN_LIB\tERR_LIB_BN        /* 3 */\r\n#define ERR_R_RSA_LIB\tERR_LIB_RSA       /* 4 */\r\n#define ERR_R_DH_LIB\tERR_LIB_DH        /* 5 */\r\n#define ERR_R_EVP_LIB\tERR_LIB_EVP       /* 6 */\r\n#define ERR_R_BUF_LIB\tERR_LIB_BUF       /* 7 */\r\n#define ERR_R_OBJ_LIB\tERR_LIB_OBJ       /* 8 */\r\n#define ERR_R_PEM_LIB\tERR_LIB_PEM       /* 9 */\r\n#define ERR_R_DSA_LIB\tERR_LIB_DSA      /* 10 */\r\n#define ERR_R_X509_LIB\tERR_LIB_X509     /* 11 */\r\n#define ERR_R_ASN1_LIB\tERR_LIB_ASN1     /* 13 */\r\n#define ERR_R_CONF_LIB\tERR_LIB_CONF     /* 14 */\r\n#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO  /* 15 */\r\n#define ERR_R_EC_LIB\tERR_LIB_EC       /* 16 */\r\n#define ERR_R_SSL_LIB\tERR_LIB_SSL      /* 20 */\r\n#define ERR_R_BIO_LIB\tERR_LIB_BIO      /* 32 */\r\n#define ERR_R_PKCS7_LIB\tERR_LIB_PKCS7    /* 33 */\r\n#define ERR_R_X509V3_LIB ERR_LIB_X509V3  /* 34 */\r\n#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12  /* 35 */\r\n#define ERR_R_RAND_LIB\tERR_LIB_RAND     /* 36 */\r\n#define ERR_R_DSO_LIB\tERR_LIB_DSO      /* 37 */\r\n#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE  /* 38 */\r\n#define ERR_R_OCSP_LIB  ERR_LIB_OCSP     /* 39 */\r\n#define ERR_R_UI_LIB    ERR_LIB_UI       /* 40 */\r\n#define ERR_R_COMP_LIB\tERR_LIB_COMP     /* 41 */\r\n#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA\t /* 42 */\r\n#define ERR_R_ECDH_LIB  ERR_LIB_ECDH\t /* 43 */\r\n#define ERR_R_STORE_LIB ERR_LIB_STORE    /* 44 */\r\n#define ERR_R_TS_LIB\tERR_LIB_TS       /* 45 */\r\n\r\n#define ERR_R_NESTED_ASN1_ERROR\t\t\t58\r\n#define ERR_R_BAD_ASN1_OBJECT_HEADER\t\t59\r\n#define ERR_R_BAD_GET_ASN1_OBJECT_CALL\t\t60\r\n#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE\t61\r\n#define ERR_R_ASN1_LENGTH_MISMATCH\t\t62\r\n#define ERR_R_MISSING_ASN1_EOS\t\t\t63\r\n\r\n/* fatal error */\r\n#define ERR_R_FATAL\t\t\t\t64\r\n#define\tERR_R_MALLOC_FAILURE\t\t\t(1|ERR_R_FATAL)\r\n#define\tERR_R_SHOULD_NOT_HAVE_BEEN_CALLED\t(2|ERR_R_FATAL)\r\n#define\tERR_R_PASSED_NULL_PARAMETER\t\t(3|ERR_R_FATAL)\r\n#define\tERR_R_INTERNAL_ERROR\t\t\t(4|ERR_R_FATAL)\r\n#define\tERR_R_DISABLED\t\t\t\t(5|ERR_R_FATAL)\r\n\r\n/* 99 is the maximum possible ERR_R_... code, higher values\r\n * are reserved for the individual libraries */\r\n\r\n\r\ntypedef struct ERR_string_data_st\r\n\t{\r\n\tunsigned long error;\r\n\tconst char *string;\r\n\t} ERR_STRING_DATA;\r\n\r\nvoid ERR_put_error(int lib, int func,int reason,const char *file,int line);\r\nvoid ERR_set_error_data(char *data,int flags);\r\n\r\nunsigned long ERR_get_error(void);\r\nunsigned long ERR_get_error_line(const char **file,int *line);\r\nunsigned long ERR_get_error_line_data(const char **file,int *line,\r\n\t\t\t\t      const char **data, int *flags);\r\nunsigned long ERR_peek_error(void);\r\nunsigned long ERR_peek_error_line(const char **file,int *line);\r\nunsigned long ERR_peek_error_line_data(const char **file,int *line,\r\n\t\t\t\t       const char **data,int *flags);\r\nunsigned long ERR_peek_last_error(void);\r\nunsigned long ERR_peek_last_error_line(const char **file,int *line);\r\nunsigned long ERR_peek_last_error_line_data(const char **file,int *line,\r\n\t\t\t\t       const char **data,int *flags);\r\nvoid ERR_clear_error(void );\r\nchar *ERR_error_string(unsigned long e,char *buf);\r\nvoid ERR_error_string_n(unsigned long e, char *buf, size_t len);\r\nconst char *ERR_lib_error_string(unsigned long e);\r\nconst char *ERR_func_error_string(unsigned long e);\r\nconst char *ERR_reason_error_string(unsigned long e);\r\nvoid ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),\r\n\t\t\t void *u);\r\n#ifndef OPENSSL_NO_FP_API\r\nvoid ERR_print_errors_fp(FILE *fp);\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\nvoid ERR_print_errors(BIO *bp);\r\n#endif\r\nvoid ERR_add_error_data(int num, ...);\r\nvoid ERR_add_error_vdata(int num, va_list args);\r\nvoid ERR_load_strings(int lib,ERR_STRING_DATA str[]);\r\nvoid ERR_unload_strings(int lib,ERR_STRING_DATA str[]);\r\nvoid ERR_load_ERR_strings(void);\r\nvoid ERR_load_crypto_strings(void);\r\nvoid ERR_free_strings(void);\r\n\r\nvoid ERR_remove_thread_state(const CRYPTO_THREADID *tid);\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nvoid ERR_remove_state(unsigned long pid); /* if zero we look it up */\r\n#endif\r\nERR_STATE *ERR_get_state(void);\r\n\r\n#ifndef OPENSSL_NO_LHASH\r\nLHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);\r\nLHASH_OF(ERR_STATE) *ERR_get_err_state_table(void);\r\nvoid ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash);\r\n#endif\r\n\r\nint ERR_get_next_error_library(void);\r\n\r\nint ERR_set_mark(void);\r\nint ERR_pop_to_mark(void);\r\n\r\n/* Already defined in ossl_typ.h */\r\n/* typedef struct st_ERR_FNS ERR_FNS; */\r\n/* An application can use this function and provide the return value to loaded\r\n * modules that should use the application's ERR state/functionality */\r\nconst ERR_FNS *ERR_get_implementation(void);\r\n/* A loaded module should call this function prior to any ERR operations using\r\n * the application's \"ERR_FNS\". */\r\nint ERR_set_implementation(const ERR_FNS *fns);\r\n\r\n#ifdef\t__cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/evp.h",
    "content": "/* crypto/evp/evp.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_ENVELOPE_H\r\n#define HEADER_ENVELOPE_H\r\n\r\n#ifdef OPENSSL_ALGORITHM_DEFINES\r\n# include <openssl/opensslconf.h>\r\n#else\r\n# define OPENSSL_ALGORITHM_DEFINES\r\n# include <openssl/opensslconf.h>\r\n# undef OPENSSL_ALGORITHM_DEFINES\r\n#endif\r\n\r\n#include <openssl/ossl_typ.h>\r\n\r\n#include <openssl/symhacks.h>\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n\r\n/*\r\n#define EVP_RC2_KEY_SIZE\t\t16\r\n#define EVP_RC4_KEY_SIZE\t\t16\r\n#define EVP_BLOWFISH_KEY_SIZE\t\t16\r\n#define EVP_CAST5_KEY_SIZE\t\t16\r\n#define EVP_RC5_32_12_16_KEY_SIZE\t16\r\n*/\r\n#define EVP_MAX_MD_SIZE\t\t\t64\t/* longest known is SHA512 */\r\n#define EVP_MAX_KEY_LENGTH\t\t64\r\n#define EVP_MAX_IV_LENGTH\t\t16\r\n#define EVP_MAX_BLOCK_LENGTH\t\t32\r\n\r\n#define PKCS5_SALT_LEN\t\t\t8\r\n/* Default PKCS#5 iteration count */\r\n#define PKCS5_DEFAULT_ITER\t\t2048\r\n\r\n#include <openssl/objects.h>\r\n\r\n#define EVP_PK_RSA\t0x0001\r\n#define EVP_PK_DSA\t0x0002\r\n#define EVP_PK_DH\t0x0004\r\n#define EVP_PK_EC\t0x0008\r\n#define EVP_PKT_SIGN\t0x0010\r\n#define EVP_PKT_ENC\t0x0020\r\n#define EVP_PKT_EXCH\t0x0040\r\n#define EVP_PKS_RSA\t0x0100\r\n#define EVP_PKS_DSA\t0x0200\r\n#define EVP_PKS_EC\t0x0400\r\n#define EVP_PKT_EXP\t0x1000 /* <= 512 bit key */\r\n\r\n#define EVP_PKEY_NONE\tNID_undef\r\n#define EVP_PKEY_RSA\tNID_rsaEncryption\r\n#define EVP_PKEY_RSA2\tNID_rsa\r\n#define EVP_PKEY_DSA\tNID_dsa\r\n#define EVP_PKEY_DSA1\tNID_dsa_2\r\n#define EVP_PKEY_DSA2\tNID_dsaWithSHA\r\n#define EVP_PKEY_DSA3\tNID_dsaWithSHA1\r\n#define EVP_PKEY_DSA4\tNID_dsaWithSHA1_2\r\n#define EVP_PKEY_DH\tNID_dhKeyAgreement\r\n#define EVP_PKEY_EC\tNID_X9_62_id_ecPublicKey\r\n#define EVP_PKEY_HMAC\tNID_hmac\r\n#define EVP_PKEY_CMAC\tNID_cmac\r\n\r\n#ifdef\t__cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Type needs to be a bit field\r\n * Sub-type needs to be for variations on the method, as in, can it do\r\n * arbitrary encryption.... */\r\nstruct evp_pkey_st\r\n\t{\r\n\tint type;\r\n\tint save_type;\r\n\tint references;\r\n\tconst EVP_PKEY_ASN1_METHOD *ameth;\r\n\tENGINE *engine;\r\n\tunion\t{\r\n\t\tchar *ptr;\r\n#ifndef OPENSSL_NO_RSA\r\n\t\tstruct rsa_st *rsa;\t/* RSA */\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\n\t\tstruct dsa_st *dsa;\t/* DSA */\r\n#endif\r\n#ifndef OPENSSL_NO_DH\r\n\t\tstruct dh_st *dh;\t/* DH */\r\n#endif\r\n#ifndef OPENSSL_NO_EC\r\n\t\tstruct ec_key_st *ec;\t/* ECC */\r\n#endif\r\n\t\t} pkey;\r\n\tint save_parameters;\r\n\tSTACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */\r\n\t} /* EVP_PKEY */;\r\n\r\n#define EVP_PKEY_MO_SIGN\t0x0001\r\n#define EVP_PKEY_MO_VERIFY\t0x0002\r\n#define EVP_PKEY_MO_ENCRYPT\t0x0004\r\n#define EVP_PKEY_MO_DECRYPT\t0x0008\r\n\r\n#ifndef EVP_MD\r\nstruct env_md_st\r\n\t{\r\n\tint type;\r\n\tint pkey_type;\r\n\tint md_size;\r\n\tunsigned long flags;\r\n\tint (*init)(EVP_MD_CTX *ctx);\r\n\tint (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);\r\n\tint (*final)(EVP_MD_CTX *ctx,unsigned char *md);\r\n\tint (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);\r\n\tint (*cleanup)(EVP_MD_CTX *ctx);\r\n\r\n\t/* FIXME: prototype these some day */\r\n\tint (*sign)(int type, const unsigned char *m, unsigned int m_length,\r\n\t\t    unsigned char *sigret, unsigned int *siglen, void *key);\r\n\tint (*verify)(int type, const unsigned char *m, unsigned int m_length,\r\n\t\t      const unsigned char *sigbuf, unsigned int siglen,\r\n\t\t      void *key);\r\n\tint required_pkey_type[5]; /*EVP_PKEY_xxx */\r\n\tint block_size;\r\n\tint ctx_size; /* how big does the ctx->md_data need to be */\r\n\t/* control function */\r\n\tint (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);\r\n\t} /* EVP_MD */;\r\n\r\ntypedef int evp_sign_method(int type,const unsigned char *m,\r\n\t\t\t    unsigned int m_length,unsigned char *sigret,\r\n\t\t\t    unsigned int *siglen, void *key);\r\ntypedef int evp_verify_method(int type,const unsigned char *m,\r\n\t\t\t    unsigned int m_length,const unsigned char *sigbuf,\r\n\t\t\t    unsigned int siglen, void *key);\r\n\r\n#define EVP_MD_FLAG_ONESHOT\t0x0001 /* digest can only handle a single\r\n\t\t\t\t\t* block */\r\n\r\n#define EVP_MD_FLAG_PKEY_DIGEST\t0x0002 /* digest is a \"clone\" digest used\r\n\t\t\t\t\t* which is a copy of an existing\r\n\t\t\t\t\t* one for a specific public key type.\r\n\t\t\t\t\t* EVP_dss1() etc */\r\n\r\n/* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */\r\n\r\n#define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE\t0x0004\r\n\r\n/* DigestAlgorithmIdentifier flags... */\r\n\r\n#define EVP_MD_FLAG_DIGALGID_MASK\t\t0x0018\r\n\r\n/* NULL or absent parameter accepted. Use NULL */\r\n\r\n#define EVP_MD_FLAG_DIGALGID_NULL\t\t0x0000\r\n\r\n/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */\r\n\r\n#define EVP_MD_FLAG_DIGALGID_ABSENT\t\t0x0008\r\n\r\n/* Custom handling via ctrl */\r\n\r\n#define EVP_MD_FLAG_DIGALGID_CUSTOM\t\t0x0018\r\n\r\n#define EVP_MD_FLAG_FIPS\t0x0400 /* Note if suitable for use in FIPS mode */\r\n\r\n/* Digest ctrls */\r\n\r\n#define\tEVP_MD_CTRL_DIGALGID\t\t\t0x1\r\n#define\tEVP_MD_CTRL_MICALG\t\t\t0x2\r\n\r\n/* Minimum Algorithm specific ctrl value */\r\n\r\n#define\tEVP_MD_CTRL_ALG_CTRL\t\t\t0x1000\r\n\r\n#define EVP_PKEY_NULL_method\tNULL,NULL,{0,0,0,0}\r\n\r\n#ifndef OPENSSL_NO_DSA\r\n#define EVP_PKEY_DSA_method\t(evp_sign_method *)DSA_sign, \\\r\n\t\t\t\t(evp_verify_method *)DSA_verify, \\\r\n\t\t\t\t{EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \\\r\n\t\t\t\t\tEVP_PKEY_DSA4,0}\r\n#else\r\n#define EVP_PKEY_DSA_method\tEVP_PKEY_NULL_method\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_ECDSA\r\n#define EVP_PKEY_ECDSA_method   (evp_sign_method *)ECDSA_sign, \\\r\n\t\t\t\t(evp_verify_method *)ECDSA_verify, \\\r\n                                 {EVP_PKEY_EC,0,0,0}\r\n#else   \r\n#define EVP_PKEY_ECDSA_method   EVP_PKEY_NULL_method\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_RSA\r\n#define EVP_PKEY_RSA_method\t(evp_sign_method *)RSA_sign, \\\r\n\t\t\t\t(evp_verify_method *)RSA_verify, \\\r\n\t\t\t\t{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}\r\n#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \\\r\n\t\t\t\t(evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \\\r\n\t\t\t\t(evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \\\r\n\t\t\t\t{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}\r\n#else\r\n#define EVP_PKEY_RSA_method\tEVP_PKEY_NULL_method\r\n#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method\r\n#endif\r\n\r\n#endif /* !EVP_MD */\r\n\r\nstruct env_md_ctx_st\r\n\t{\r\n\tconst EVP_MD *digest;\r\n\tENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */\r\n\tunsigned long flags;\r\n\tvoid *md_data;\r\n\t/* Public key context for sign/verify */\r\n\tEVP_PKEY_CTX *pctx;\r\n\t/* Update function: usually copied from EVP_MD */\r\n\tint (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);\r\n\t} /* EVP_MD_CTX */;\r\n\r\n/* values for EVP_MD_CTX flags */\r\n\r\n#define EVP_MD_CTX_FLAG_ONESHOT\t\t0x0001 /* digest update will be called\r\n\t\t\t\t\t\t* once only */\r\n#define EVP_MD_CTX_FLAG_CLEANED\t\t0x0002 /* context has already been\r\n\t\t\t\t\t\t* cleaned */\r\n#define EVP_MD_CTX_FLAG_REUSE\t\t0x0004 /* Don't free up ctx->md_data\r\n\t\t\t\t\t\t* in EVP_MD_CTX_cleanup */\r\n/* FIPS and pad options are ignored in 1.0.0, definitions are here\r\n * so we don't accidentally reuse the values for other purposes.\r\n */\r\n\r\n#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW\t0x0008\t/* Allow use of non FIPS digest\r\n\t\t\t\t\t\t * in FIPS mode */\r\n\r\n/* The following PAD options are also currently ignored in 1.0.0, digest\r\n * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*()\r\n * instead.\r\n */\r\n#define EVP_MD_CTX_FLAG_PAD_MASK\t0xF0\t/* RSA mode to use */\r\n#define EVP_MD_CTX_FLAG_PAD_PKCS1\t0x00\t/* PKCS#1 v1.5 mode */\r\n#define EVP_MD_CTX_FLAG_PAD_X931\t0x10\t/* X9.31 mode */\r\n#define EVP_MD_CTX_FLAG_PAD_PSS\t\t0x20\t/* PSS mode */\r\n\r\n#define EVP_MD_CTX_FLAG_NO_INIT\t\t0x0100 /* Don't initialize md_data */\r\n\r\nstruct evp_cipher_st\r\n\t{\r\n\tint nid;\r\n\tint block_size;\r\n\tint key_len;\t\t/* Default value for variable length ciphers */\r\n\tint iv_len;\r\n\tunsigned long flags;\t/* Various flags */\r\n\tint (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,\r\n\t\t    const unsigned char *iv, int enc);\t/* init key */\r\n\tint (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,\r\n\t\t\t const unsigned char *in, size_t inl);/* encrypt/decrypt data */\r\n\tint (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */\r\n\tint ctx_size;\t\t/* how big ctx->cipher_data needs to be */\r\n\tint (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */\r\n\tint (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */\r\n\tint (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */\r\n\tvoid *app_data;\t\t/* Application data */\r\n\t} /* EVP_CIPHER */;\r\n\r\n/* Values for cipher flags */\r\n\r\n/* Modes for ciphers */\r\n\r\n#define\t\tEVP_CIPH_STREAM_CIPHER\t\t0x0\r\n#define\t\tEVP_CIPH_ECB_MODE\t\t0x1\r\n#define\t\tEVP_CIPH_CBC_MODE\t\t0x2\r\n#define\t\tEVP_CIPH_CFB_MODE\t\t0x3\r\n#define\t\tEVP_CIPH_OFB_MODE\t\t0x4\r\n#define\t\tEVP_CIPH_CTR_MODE\t\t0x5\r\n#define\t\tEVP_CIPH_GCM_MODE\t\t0x6\r\n#define\t\tEVP_CIPH_CCM_MODE\t\t0x7\r\n#define\t\tEVP_CIPH_XTS_MODE\t\t0x10001\r\n#define \tEVP_CIPH_MODE\t\t\t0xF0007\r\n/* Set if variable length cipher */\r\n#define \tEVP_CIPH_VARIABLE_LENGTH\t0x8\r\n/* Set if the iv handling should be done by the cipher itself */\r\n#define \tEVP_CIPH_CUSTOM_IV\t\t0x10\r\n/* Set if the cipher's init() function should be called if key is NULL */\r\n#define \tEVP_CIPH_ALWAYS_CALL_INIT\t0x20\r\n/* Call ctrl() to init cipher parameters */\r\n#define \tEVP_CIPH_CTRL_INIT\t\t0x40\r\n/* Don't use standard key length function */\r\n#define \tEVP_CIPH_CUSTOM_KEY_LENGTH\t0x80\r\n/* Don't use standard block padding */\r\n#define \tEVP_CIPH_NO_PADDING\t\t0x100\r\n/* cipher handles random key generation */\r\n#define \tEVP_CIPH_RAND_KEY\t\t0x200\r\n/* cipher has its own additional copying logic */\r\n#define \tEVP_CIPH_CUSTOM_COPY\t\t0x400\r\n/* Allow use default ASN1 get/set iv */\r\n#define\t\tEVP_CIPH_FLAG_DEFAULT_ASN1\t0x1000\r\n/* Buffer length in bits not bytes: CFB1 mode only */\r\n#define\t\tEVP_CIPH_FLAG_LENGTH_BITS\t0x2000\r\n/* Note if suitable for use in FIPS mode */\r\n#define\t\tEVP_CIPH_FLAG_FIPS\t\t0x4000\r\n/* Allow non FIPS cipher in FIPS mode */\r\n#define\t\tEVP_CIPH_FLAG_NON_FIPS_ALLOW\t0x8000\r\n/* Cipher handles any and all padding logic as well\r\n * as finalisation.\r\n */\r\n#define \tEVP_CIPH_FLAG_CUSTOM_CIPHER\t0x100000\r\n#define\t\tEVP_CIPH_FLAG_AEAD_CIPHER\t0x200000\r\n\r\n/* ctrl() values */\r\n\r\n#define\t\tEVP_CTRL_INIT\t\t\t0x0\r\n#define \tEVP_CTRL_SET_KEY_LENGTH\t\t0x1\r\n#define \tEVP_CTRL_GET_RC2_KEY_BITS\t0x2\r\n#define \tEVP_CTRL_SET_RC2_KEY_BITS\t0x3\r\n#define \tEVP_CTRL_GET_RC5_ROUNDS\t\t0x4\r\n#define \tEVP_CTRL_SET_RC5_ROUNDS\t\t0x5\r\n#define \tEVP_CTRL_RAND_KEY\t\t0x6\r\n#define \tEVP_CTRL_PBE_PRF_NID\t\t0x7\r\n#define \tEVP_CTRL_COPY\t\t\t0x8\r\n#define \tEVP_CTRL_GCM_SET_IVLEN\t\t0x9\r\n#define \tEVP_CTRL_GCM_GET_TAG\t\t0x10\r\n#define \tEVP_CTRL_GCM_SET_TAG\t\t0x11\r\n#define\t\tEVP_CTRL_GCM_SET_IV_FIXED\t0x12\r\n#define\t\tEVP_CTRL_GCM_IV_GEN\t\t0x13\r\n#define\t\tEVP_CTRL_CCM_SET_IVLEN\t\tEVP_CTRL_GCM_SET_IVLEN\r\n#define\t\tEVP_CTRL_CCM_GET_TAG\t\tEVP_CTRL_GCM_GET_TAG\r\n#define\t\tEVP_CTRL_CCM_SET_TAG\t\tEVP_CTRL_GCM_SET_TAG\r\n#define\t\tEVP_CTRL_CCM_SET_L\t\t0x14\r\n#define\t\tEVP_CTRL_CCM_SET_MSGLEN\t\t0x15\r\n/* AEAD cipher deduces payload length and returns number of bytes\r\n * required to store MAC and eventual padding. Subsequent call to\r\n * EVP_Cipher even appends/verifies MAC.\r\n */\r\n#define\t\tEVP_CTRL_AEAD_TLS1_AAD\t\t0x16\r\n/* Used by composite AEAD ciphers, no-op in GCM, CCM... */\r\n#define\t\tEVP_CTRL_AEAD_SET_MAC_KEY\t0x17\r\n/* Set the GCM invocation field, decrypt only */\r\n#define\t\tEVP_CTRL_GCM_SET_IV_INV\t\t0x18\r\n\r\n/* GCM TLS constants */\r\n/* Length of fixed part of IV derived from PRF */\r\n#define EVP_GCM_TLS_FIXED_IV_LEN\t\t\t4\r\n/* Length of explicit part of IV part of TLS records */\r\n#define EVP_GCM_TLS_EXPLICIT_IV_LEN\t\t\t8\r\n/* Length of tag for TLS */\r\n#define EVP_GCM_TLS_TAG_LEN\t\t\t\t16\r\n\r\n\r\ntypedef struct evp_cipher_info_st\r\n\t{\r\n\tconst EVP_CIPHER *cipher;\r\n\tunsigned char iv[EVP_MAX_IV_LENGTH];\r\n\t} EVP_CIPHER_INFO;\r\n\r\nstruct evp_cipher_ctx_st\r\n\t{\r\n\tconst EVP_CIPHER *cipher;\r\n\tENGINE *engine;\t/* functional reference if 'cipher' is ENGINE-provided */\r\n\tint encrypt;\t\t/* encrypt or decrypt */\r\n\tint buf_len;\t\t/* number we have left */\r\n\r\n\tunsigned char  oiv[EVP_MAX_IV_LENGTH];\t/* original iv */\r\n\tunsigned char  iv[EVP_MAX_IV_LENGTH];\t/* working iv */\r\n\tunsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */\r\n\tint num;\t\t\t\t/* used by cfb/ofb/ctr mode */\r\n\r\n\tvoid *app_data;\t\t/* application stuff */\r\n\tint key_len;\t\t/* May change for variable length cipher */\r\n\tunsigned long flags;\t/* Various flags */\r\n\tvoid *cipher_data; /* per EVP data */\r\n\tint final_used;\r\n\tint block_mask;\r\n\tunsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */\r\n\t} /* EVP_CIPHER_CTX */;\r\n\r\ntypedef struct evp_Encode_Ctx_st\r\n\t{\r\n\tint num;\t/* number saved in a partial encode/decode */\r\n\tint length;\t/* The length is either the output line length\r\n\t\t\t * (in input bytes) or the shortest input line\r\n\t\t\t * length that is ok.  Once decoding begins,\r\n\t\t\t * the length is adjusted up each time a longer\r\n\t\t\t * line is decoded */\r\n\tunsigned char enc_data[80];\t/* data to encode */\r\n\tint line_num;\t/* number read on current line */\r\n\tint expect_nl;\r\n\t} EVP_ENCODE_CTX;\r\n\r\n/* Password based encryption function */\r\ntypedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\r\n\t\tASN1_TYPE *param, const EVP_CIPHER *cipher,\r\n                const EVP_MD *md, int en_de);\r\n\r\n#ifndef OPENSSL_NO_RSA\r\n#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\\\r\n\t\t\t\t\t(char *)(rsa))\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DSA\r\n#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\\\r\n\t\t\t\t\t(char *)(dsa))\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DH\r\n#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\\\r\n\t\t\t\t\t(char *)(dh))\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_EC\r\n#define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\\\r\n                                        (char *)(eckey))\r\n#endif\r\n\r\n/* Add some extra combinations */\r\n#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))\r\n#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))\r\n#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))\r\n#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))\r\n\r\nint EVP_MD_type(const EVP_MD *md);\r\n#define EVP_MD_nid(e)\t\t\tEVP_MD_type(e)\r\n#define EVP_MD_name(e)\t\t\tOBJ_nid2sn(EVP_MD_nid(e))\r\nint EVP_MD_pkey_type(const EVP_MD *md);\t\r\nint EVP_MD_size(const EVP_MD *md);\r\nint EVP_MD_block_size(const EVP_MD *md);\r\nunsigned long EVP_MD_flags(const EVP_MD *md);\r\n\r\nconst EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);\r\n#define EVP_MD_CTX_size(e)\t\tEVP_MD_size(EVP_MD_CTX_md(e))\r\n#define EVP_MD_CTX_block_size(e)\tEVP_MD_block_size(EVP_MD_CTX_md(e))\r\n#define EVP_MD_CTX_type(e)\t\tEVP_MD_type(EVP_MD_CTX_md(e))\r\n\r\nint EVP_CIPHER_nid(const EVP_CIPHER *cipher);\r\n#define EVP_CIPHER_name(e)\t\tOBJ_nid2sn(EVP_CIPHER_nid(e))\r\nint EVP_CIPHER_block_size(const EVP_CIPHER *cipher);\r\nint EVP_CIPHER_key_length(const EVP_CIPHER *cipher);\r\nint EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);\r\nunsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);\r\n#define EVP_CIPHER_mode(e)\t\t(EVP_CIPHER_flags(e) & EVP_CIPH_MODE)\r\n\r\nconst EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);\r\nint EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);\r\nint EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);\r\nint EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);\r\nint EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);\r\nint EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);\r\nvoid * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);\r\nvoid EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);\r\n#define EVP_CIPHER_CTX_type(c)         EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))\r\nunsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);\r\n#define EVP_CIPHER_CTX_mode(e)\t\t(EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE)\r\n\r\n#define EVP_ENCODE_LENGTH(l)\t(((l+2)/3*4)+(l/48+1)*2+80)\r\n#define EVP_DECODE_LENGTH(l)\t((l+3)/4*3+80)\r\n\r\n#define EVP_SignInit_ex(a,b,c)\t\tEVP_DigestInit_ex(a,b,c)\r\n#define EVP_SignInit(a,b)\t\tEVP_DigestInit(a,b)\r\n#define EVP_SignUpdate(a,b,c)\t\tEVP_DigestUpdate(a,b,c)\r\n#define\tEVP_VerifyInit_ex(a,b,c)\tEVP_DigestInit_ex(a,b,c)\r\n#define\tEVP_VerifyInit(a,b)\t\tEVP_DigestInit(a,b)\r\n#define\tEVP_VerifyUpdate(a,b,c)\t\tEVP_DigestUpdate(a,b,c)\r\n#define EVP_OpenUpdate(a,b,c,d,e)\tEVP_DecryptUpdate(a,b,c,d,e)\r\n#define EVP_SealUpdate(a,b,c,d,e)\tEVP_EncryptUpdate(a,b,c,d,e)\t\r\n#define EVP_DigestSignUpdate(a,b,c)\tEVP_DigestUpdate(a,b,c)\r\n#define EVP_DigestVerifyUpdate(a,b,c)\tEVP_DigestUpdate(a,b,c)\r\n\r\n#ifdef CONST_STRICT\r\nvoid BIO_set_md(BIO *,const EVP_MD *md);\r\n#else\r\n# define BIO_set_md(b,md)\t\tBIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)\r\n#endif\r\n#define BIO_get_md(b,mdp)\t\tBIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)\r\n#define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)\r\n#define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp)\r\n#define BIO_get_cipher_status(b)\tBIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)\r\n#define BIO_get_cipher_ctx(b,c_pp)\tBIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)\r\n\r\nint EVP_Cipher(EVP_CIPHER_CTX *c,\r\n\t\tunsigned char *out,\r\n\t\tconst unsigned char *in,\r\n\t\tunsigned int inl);\r\n\r\n#define EVP_add_cipher_alias(n,alias) \\\r\n\tOBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))\r\n#define EVP_add_digest_alias(n,alias) \\\r\n\tOBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))\r\n#define EVP_delete_cipher_alias(alias) \\\r\n\tOBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);\r\n#define EVP_delete_digest_alias(alias) \\\r\n\tOBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);\r\n\r\nvoid\tEVP_MD_CTX_init(EVP_MD_CTX *ctx);\r\nint\tEVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);\r\nEVP_MD_CTX *EVP_MD_CTX_create(void);\r\nvoid\tEVP_MD_CTX_destroy(EVP_MD_CTX *ctx);\r\nint     EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);  \r\nvoid\tEVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);\r\nvoid\tEVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);\r\nint \tEVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags);\r\nint\tEVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\r\nint\tEVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,\r\n\t\t\t size_t cnt);\r\nint\tEVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);\r\nint\tEVP_Digest(const void *data, size_t count,\r\n\t\tunsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);\r\n\r\nint     EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);  \r\nint\tEVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);\r\nint\tEVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);\r\n\r\nint\tEVP_read_pw_string(char *buf,int length,const char *prompt,int verify);\r\nint\tEVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *prompt,int verify);\r\nvoid\tEVP_set_pw_prompt(const char *prompt);\r\nchar *\tEVP_get_pw_prompt(void);\r\n\r\nint\tEVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,\r\n\t\tconst unsigned char *salt, const unsigned char *data,\r\n\t\tint datal, int count, unsigned char *key,unsigned char *iv);\r\n\r\nvoid\tEVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);\r\nvoid\tEVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);\r\nint \tEVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags);\r\n\r\nint\tEVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,\r\n\t\tconst unsigned char *key, const unsigned char *iv);\r\nint\tEVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,\r\n\t\tconst unsigned char *key, const unsigned char *iv);\r\nint\tEVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\r\n\t\tint *outl, const unsigned char *in, int inl);\r\nint\tEVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\r\nint\tEVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\r\n\r\nint\tEVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,\r\n\t\tconst unsigned char *key, const unsigned char *iv);\r\nint\tEVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,\r\n\t\tconst unsigned char *key, const unsigned char *iv);\r\nint\tEVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\r\n\t\tint *outl, const unsigned char *in, int inl);\r\nint\tEVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\r\nint\tEVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\r\n\r\nint\tEVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,\r\n\t\t       const unsigned char *key,const unsigned char *iv,\r\n\t\t       int enc);\r\nint\tEVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,\r\n\t\t       const unsigned char *key,const unsigned char *iv,\r\n\t\t       int enc);\r\nint\tEVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\r\n\t\tint *outl, const unsigned char *in, int inl);\r\nint\tEVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\r\nint\tEVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\r\n\r\nint\tEVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,\r\n\t\tEVP_PKEY *pkey);\r\n\r\nint\tEVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,\r\n\t\tunsigned int siglen,EVP_PKEY *pkey);\r\n\r\nint\tEVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\r\n\t\t\tconst EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);\r\nint\tEVP_DigestSignFinal(EVP_MD_CTX *ctx,\r\n\t\t\tunsigned char *sigret, size_t *siglen);\r\n\r\nint\tEVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\r\n\t\t\tconst EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);\r\nint\tEVP_DigestVerifyFinal(EVP_MD_CTX *ctx,\r\n\t\t\tunsigned char *sig, size_t siglen);\r\n\r\nint\tEVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,\r\n\t\tconst unsigned char *ek, int ekl, const unsigned char *iv,\r\n\t\tEVP_PKEY *priv);\r\nint\tEVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\r\n\r\nint\tEVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\r\n\t\t unsigned char **ek, int *ekl, unsigned char *iv,\r\n\t\tEVP_PKEY **pubk, int npubk);\r\nint\tEVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);\r\n\r\nvoid\tEVP_EncodeInit(EVP_ENCODE_CTX *ctx);\r\nvoid\tEVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,\r\n\t\tconst unsigned char *in,int inl);\r\nvoid\tEVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);\r\nint\tEVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);\r\n\r\nvoid\tEVP_DecodeInit(EVP_ENCODE_CTX *ctx);\r\nint\tEVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,\r\n\t\tconst unsigned char *in, int inl);\r\nint\tEVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned\r\n\t\tchar *out, int *outl);\r\nint\tEVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);\r\n\r\nvoid EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);\r\nint EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);\r\nEVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);\r\nvoid EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);\r\nint EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);\r\nint EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);\r\nint EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);\r\nint EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nBIO_METHOD *BIO_f_md(void);\r\nBIO_METHOD *BIO_f_base64(void);\r\nBIO_METHOD *BIO_f_cipher(void);\r\nBIO_METHOD *BIO_f_reliable(void);\r\nvoid BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k,\r\n\t\tconst unsigned char *i, int enc);\r\n#endif\r\n\r\nconst EVP_MD *EVP_md_null(void);\r\n#ifndef OPENSSL_NO_MD2\r\nconst EVP_MD *EVP_md2(void);\r\n#endif\r\n#ifndef OPENSSL_NO_MD4\r\nconst EVP_MD *EVP_md4(void);\r\n#endif\r\n#ifndef OPENSSL_NO_MD5\r\nconst EVP_MD *EVP_md5(void);\r\n#endif\r\n#ifndef OPENSSL_NO_SHA\r\nconst EVP_MD *EVP_sha(void);\r\nconst EVP_MD *EVP_sha1(void);\r\nconst EVP_MD *EVP_dss(void);\r\nconst EVP_MD *EVP_dss1(void);\r\nconst EVP_MD *EVP_ecdsa(void);\r\n#endif\r\n#ifndef OPENSSL_NO_SHA256\r\nconst EVP_MD *EVP_sha224(void);\r\nconst EVP_MD *EVP_sha256(void);\r\n#endif\r\n#ifndef OPENSSL_NO_SHA512\r\nconst EVP_MD *EVP_sha384(void);\r\nconst EVP_MD *EVP_sha512(void);\r\n#endif\r\n#ifndef OPENSSL_NO_MDC2\r\nconst EVP_MD *EVP_mdc2(void);\r\n#endif\r\n#ifndef OPENSSL_NO_RIPEMD\r\nconst EVP_MD *EVP_ripemd160(void);\r\n#endif\r\n#ifndef OPENSSL_NO_WHIRLPOOL\r\nconst EVP_MD *EVP_whirlpool(void);\r\n#endif\r\nconst EVP_CIPHER *EVP_enc_null(void);\t\t/* does nothing :-) */\r\n#ifndef OPENSSL_NO_DES\r\nconst EVP_CIPHER *EVP_des_ecb(void);\r\nconst EVP_CIPHER *EVP_des_ede(void);\r\nconst EVP_CIPHER *EVP_des_ede3(void);\r\nconst EVP_CIPHER *EVP_des_ede_ecb(void);\r\nconst EVP_CIPHER *EVP_des_ede3_ecb(void);\r\nconst EVP_CIPHER *EVP_des_cfb64(void);\r\n# define EVP_des_cfb EVP_des_cfb64\r\nconst EVP_CIPHER *EVP_des_cfb1(void);\r\nconst EVP_CIPHER *EVP_des_cfb8(void);\r\nconst EVP_CIPHER *EVP_des_ede_cfb64(void);\r\n# define EVP_des_ede_cfb EVP_des_ede_cfb64\r\n#if 0\r\nconst EVP_CIPHER *EVP_des_ede_cfb1(void);\r\nconst EVP_CIPHER *EVP_des_ede_cfb8(void);\r\n#endif\r\nconst EVP_CIPHER *EVP_des_ede3_cfb64(void);\r\n# define EVP_des_ede3_cfb EVP_des_ede3_cfb64\r\nconst EVP_CIPHER *EVP_des_ede3_cfb1(void);\r\nconst EVP_CIPHER *EVP_des_ede3_cfb8(void);\r\nconst EVP_CIPHER *EVP_des_ofb(void);\r\nconst EVP_CIPHER *EVP_des_ede_ofb(void);\r\nconst EVP_CIPHER *EVP_des_ede3_ofb(void);\r\nconst EVP_CIPHER *EVP_des_cbc(void);\r\nconst EVP_CIPHER *EVP_des_ede_cbc(void);\r\nconst EVP_CIPHER *EVP_des_ede3_cbc(void);\r\nconst EVP_CIPHER *EVP_desx_cbc(void);\r\n/* This should now be supported through the dev_crypto ENGINE. But also, why are\r\n * rc4 and md5 declarations made here inside a \"NO_DES\" precompiler branch? */\r\n#if 0\r\n# ifdef OPENSSL_OPENBSD_DEV_CRYPTO\r\nconst EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void);\r\nconst EVP_CIPHER *EVP_dev_crypto_rc4(void);\r\nconst EVP_MD *EVP_dev_crypto_md5(void);\r\n# endif\r\n#endif\r\n#endif\r\n#ifndef OPENSSL_NO_RC4\r\nconst EVP_CIPHER *EVP_rc4(void);\r\nconst EVP_CIPHER *EVP_rc4_40(void);\r\n#ifndef OPENSSL_NO_MD5\r\nconst EVP_CIPHER *EVP_rc4_hmac_md5(void);\r\n#endif\r\n#endif\r\n#ifndef OPENSSL_NO_IDEA\r\nconst EVP_CIPHER *EVP_idea_ecb(void);\r\nconst EVP_CIPHER *EVP_idea_cfb64(void);\r\n# define EVP_idea_cfb EVP_idea_cfb64\r\nconst EVP_CIPHER *EVP_idea_ofb(void);\r\nconst EVP_CIPHER *EVP_idea_cbc(void);\r\n#endif\r\n#ifndef OPENSSL_NO_RC2\r\nconst EVP_CIPHER *EVP_rc2_ecb(void);\r\nconst EVP_CIPHER *EVP_rc2_cbc(void);\r\nconst EVP_CIPHER *EVP_rc2_40_cbc(void);\r\nconst EVP_CIPHER *EVP_rc2_64_cbc(void);\r\nconst EVP_CIPHER *EVP_rc2_cfb64(void);\r\n# define EVP_rc2_cfb EVP_rc2_cfb64\r\nconst EVP_CIPHER *EVP_rc2_ofb(void);\r\n#endif\r\n#ifndef OPENSSL_NO_BF\r\nconst EVP_CIPHER *EVP_bf_ecb(void);\r\nconst EVP_CIPHER *EVP_bf_cbc(void);\r\nconst EVP_CIPHER *EVP_bf_cfb64(void);\r\n# define EVP_bf_cfb EVP_bf_cfb64\r\nconst EVP_CIPHER *EVP_bf_ofb(void);\r\n#endif\r\n#ifndef OPENSSL_NO_CAST\r\nconst EVP_CIPHER *EVP_cast5_ecb(void);\r\nconst EVP_CIPHER *EVP_cast5_cbc(void);\r\nconst EVP_CIPHER *EVP_cast5_cfb64(void);\r\n# define EVP_cast5_cfb EVP_cast5_cfb64\r\nconst EVP_CIPHER *EVP_cast5_ofb(void);\r\n#endif\r\n#ifndef OPENSSL_NO_RC5\r\nconst EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);\r\nconst EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);\r\nconst EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);\r\n# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64\r\nconst EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);\r\n#endif\r\n#ifndef OPENSSL_NO_AES\r\nconst EVP_CIPHER *EVP_aes_128_ecb(void);\r\nconst EVP_CIPHER *EVP_aes_128_cbc(void);\r\nconst EVP_CIPHER *EVP_aes_128_cfb1(void);\r\nconst EVP_CIPHER *EVP_aes_128_cfb8(void);\r\nconst EVP_CIPHER *EVP_aes_128_cfb128(void);\r\n# define EVP_aes_128_cfb EVP_aes_128_cfb128\r\nconst EVP_CIPHER *EVP_aes_128_ofb(void);\r\nconst EVP_CIPHER *EVP_aes_128_ctr(void);\r\nconst EVP_CIPHER *EVP_aes_128_gcm(void);\r\nconst EVP_CIPHER *EVP_aes_128_ccm(void);\r\nconst EVP_CIPHER *EVP_aes_128_xts(void);\r\nconst EVP_CIPHER *EVP_aes_192_ecb(void);\r\nconst EVP_CIPHER *EVP_aes_192_cbc(void);\r\nconst EVP_CIPHER *EVP_aes_192_cfb1(void);\r\nconst EVP_CIPHER *EVP_aes_192_cfb8(void);\r\nconst EVP_CIPHER *EVP_aes_192_cfb128(void);\r\n# define EVP_aes_192_cfb EVP_aes_192_cfb128\r\nconst EVP_CIPHER *EVP_aes_192_ofb(void);\r\nconst EVP_CIPHER *EVP_aes_192_ctr(void);\r\nconst EVP_CIPHER *EVP_aes_192_gcm(void);\r\nconst EVP_CIPHER *EVP_aes_192_ccm(void);\r\nconst EVP_CIPHER *EVP_aes_256_ecb(void);\r\nconst EVP_CIPHER *EVP_aes_256_cbc(void);\r\nconst EVP_CIPHER *EVP_aes_256_cfb1(void);\r\nconst EVP_CIPHER *EVP_aes_256_cfb8(void);\r\nconst EVP_CIPHER *EVP_aes_256_cfb128(void);\r\n# define EVP_aes_256_cfb EVP_aes_256_cfb128\r\nconst EVP_CIPHER *EVP_aes_256_ofb(void);\r\nconst EVP_CIPHER *EVP_aes_256_ctr(void);\r\nconst EVP_CIPHER *EVP_aes_256_gcm(void);\r\nconst EVP_CIPHER *EVP_aes_256_ccm(void);\r\nconst EVP_CIPHER *EVP_aes_256_xts(void);\r\n#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)\r\nconst EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);\r\nconst EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);\r\n#endif\r\n#endif\r\n#ifndef OPENSSL_NO_CAMELLIA\r\nconst EVP_CIPHER *EVP_camellia_128_ecb(void);\r\nconst EVP_CIPHER *EVP_camellia_128_cbc(void);\r\nconst EVP_CIPHER *EVP_camellia_128_cfb1(void);\r\nconst EVP_CIPHER *EVP_camellia_128_cfb8(void);\r\nconst EVP_CIPHER *EVP_camellia_128_cfb128(void);\r\n# define EVP_camellia_128_cfb EVP_camellia_128_cfb128\r\nconst EVP_CIPHER *EVP_camellia_128_ofb(void);\r\nconst EVP_CIPHER *EVP_camellia_192_ecb(void);\r\nconst EVP_CIPHER *EVP_camellia_192_cbc(void);\r\nconst EVP_CIPHER *EVP_camellia_192_cfb1(void);\r\nconst EVP_CIPHER *EVP_camellia_192_cfb8(void);\r\nconst EVP_CIPHER *EVP_camellia_192_cfb128(void);\r\n# define EVP_camellia_192_cfb EVP_camellia_192_cfb128\r\nconst EVP_CIPHER *EVP_camellia_192_ofb(void);\r\nconst EVP_CIPHER *EVP_camellia_256_ecb(void);\r\nconst EVP_CIPHER *EVP_camellia_256_cbc(void);\r\nconst EVP_CIPHER *EVP_camellia_256_cfb1(void);\r\nconst EVP_CIPHER *EVP_camellia_256_cfb8(void);\r\nconst EVP_CIPHER *EVP_camellia_256_cfb128(void);\r\n# define EVP_camellia_256_cfb EVP_camellia_256_cfb128\r\nconst EVP_CIPHER *EVP_camellia_256_ofb(void);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_SEED\r\nconst EVP_CIPHER *EVP_seed_ecb(void);\r\nconst EVP_CIPHER *EVP_seed_cbc(void);\r\nconst EVP_CIPHER *EVP_seed_cfb128(void);\r\n# define EVP_seed_cfb EVP_seed_cfb128\r\nconst EVP_CIPHER *EVP_seed_ofb(void);\r\n#endif\r\n\r\nvoid OPENSSL_add_all_algorithms_noconf(void);\r\nvoid OPENSSL_add_all_algorithms_conf(void);\r\n\r\n#ifdef OPENSSL_LOAD_CONF\r\n#define OpenSSL_add_all_algorithms() \\\r\n\t\tOPENSSL_add_all_algorithms_conf()\r\n#else\r\n#define OpenSSL_add_all_algorithms() \\\r\n\t\tOPENSSL_add_all_algorithms_noconf()\r\n#endif\r\n\r\nvoid OpenSSL_add_all_ciphers(void);\r\nvoid OpenSSL_add_all_digests(void);\r\n#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms()\r\n#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers()\r\n#define SSLeay_add_all_digests() OpenSSL_add_all_digests()\r\n\r\nint EVP_add_cipher(const EVP_CIPHER *cipher);\r\nint EVP_add_digest(const EVP_MD *digest);\r\n\r\nconst EVP_CIPHER *EVP_get_cipherbyname(const char *name);\r\nconst EVP_MD *EVP_get_digestbyname(const char *name);\r\nvoid EVP_cleanup(void);\r\n\r\nvoid EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph,\r\n\t\tconst char *from, const char *to, void *x), void *arg);\r\nvoid EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph,\r\n\t\tconst char *from, const char *to, void *x), void *arg);\r\n\r\nvoid EVP_MD_do_all(void (*fn)(const EVP_MD *ciph,\r\n\t\tconst char *from, const char *to, void *x), void *arg);\r\nvoid EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph,\r\n\t\tconst char *from, const char *to, void *x), void *arg);\r\n\r\nint\t\tEVP_PKEY_decrypt_old(unsigned char *dec_key,\r\n\t\t\tconst unsigned char *enc_key,int enc_key_len,\r\n\t\t\tEVP_PKEY *private_key);\r\nint\t\tEVP_PKEY_encrypt_old(unsigned char *enc_key,\r\n\t\t\tconst unsigned char *key,int key_len,\r\n\t\t\tEVP_PKEY *pub_key);\r\nint\t\tEVP_PKEY_type(int type);\r\nint\t\tEVP_PKEY_id(const EVP_PKEY *pkey);\r\nint\t\tEVP_PKEY_base_id(const EVP_PKEY *pkey);\r\nint\t\tEVP_PKEY_bits(EVP_PKEY *pkey);\r\nint\t\tEVP_PKEY_size(EVP_PKEY *pkey);\r\nint \t\tEVP_PKEY_set_type(EVP_PKEY *pkey,int type);\r\nint\t\tEVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);\r\nint \t\tEVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key);\r\nvoid *\t\tEVP_PKEY_get0(EVP_PKEY *pkey);\r\n\r\n#ifndef OPENSSL_NO_RSA\r\nstruct rsa_st;\r\nint EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key);\r\nstruct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\nstruct dsa_st;\r\nint EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key);\r\nstruct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);\r\n#endif\r\n#ifndef OPENSSL_NO_DH\r\nstruct dh_st;\r\nint EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);\r\nstruct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);\r\n#endif\r\n#ifndef OPENSSL_NO_EC\r\nstruct ec_key_st;\r\nint EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key);\r\nstruct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);\r\n#endif\r\n\r\nEVP_PKEY *\tEVP_PKEY_new(void);\r\nvoid\t\tEVP_PKEY_free(EVP_PKEY *pkey);\r\n\r\nEVP_PKEY *\td2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,\r\n\t\t\tlong length);\r\nint\t\ti2d_PublicKey(EVP_PKEY *a, unsigned char **pp);\r\n\r\nEVP_PKEY *\td2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,\r\n\t\t\tlong length);\r\nEVP_PKEY *\td2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,\r\n\t\t\tlong length);\r\nint\t\ti2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);\r\n\r\nint EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);\r\nint EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);\r\nint EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode);\r\nint EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);\r\n\r\nint EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);\r\n\r\nint EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,\r\n\t\t\t\tint indent, ASN1_PCTX *pctx);\r\nint EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,\r\n\t\t\t\tint indent, ASN1_PCTX *pctx);\r\nint EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,\r\n\t\t\t\tint indent, ASN1_PCTX *pctx);\r\n\r\nint EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);\r\n\r\nint EVP_CIPHER_type(const EVP_CIPHER *ctx);\r\n\r\n/* calls methods */\r\nint EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\r\nint EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\r\n\r\n/* These are used by EVP_CIPHER methods */\r\nint EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);\r\nint EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);\r\n\r\n/* PKCS5 password based encryption */\r\nint PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\r\n\t\t\t ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,\r\n\t\t\t int en_de);\r\nint PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,\r\n\t\t\t   const unsigned char *salt, int saltlen, int iter,\r\n\t\t\t   int keylen, unsigned char *out);\r\nint PKCS5_PBKDF2_HMAC(const char *pass, int passlen,\r\n\t\t\t   const unsigned char *salt, int saltlen, int iter,\r\n\t\t\t   const EVP_MD *digest,\r\n\t\t      int keylen, unsigned char *out);\r\nint PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\r\n\t\t\t ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,\r\n\t\t\t int en_de);\r\n\r\nvoid PKCS5_PBE_add(void);\r\n\r\nint EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\r\n\t     ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);\r\n\r\n/* PBE type */\r\n\r\n/* Can appear as the outermost AlgorithmIdentifier */\r\n#define EVP_PBE_TYPE_OUTER\t0x0\r\n/* Is an PRF type OID */\r\n#define EVP_PBE_TYPE_PRF\t0x1\r\n\r\nint EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid,\r\n\t     EVP_PBE_KEYGEN *keygen);\r\nint EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,\r\n\t\t    EVP_PBE_KEYGEN *keygen);\r\nint EVP_PBE_find(int type, int pbe_nid,\r\n\t\t\tint *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen);\r\nvoid EVP_PBE_cleanup(void);\r\n\r\n#define ASN1_PKEY_ALIAS\t\t0x1\r\n#define ASN1_PKEY_DYNAMIC\t0x2\r\n#define ASN1_PKEY_SIGPARAM_NULL\t0x4\r\n\r\n#define ASN1_PKEY_CTRL_PKCS7_SIGN\t0x1\r\n#define ASN1_PKEY_CTRL_PKCS7_ENCRYPT\t0x2\r\n#define ASN1_PKEY_CTRL_DEFAULT_MD_NID\t0x3\r\n#define ASN1_PKEY_CTRL_CMS_SIGN\t\t0x5\r\n#define ASN1_PKEY_CTRL_CMS_ENVELOPE\t0x7\r\n\r\nint EVP_PKEY_asn1_get_count(void);\r\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);\r\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);\r\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,\r\n\t\t\t\t\tconst char *str, int len);\r\nint EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);\r\nint EVP_PKEY_asn1_add_alias(int to, int from);\r\nint EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags,\r\n\t\t\t\tconst char **pinfo, const char **ppem_str,\r\n\t\t\t\t\tconst EVP_PKEY_ASN1_METHOD *ameth);\r\n\r\nconst EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey);\r\nEVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,\r\n\t\t\t\t\tconst char *pem_str, const char *info);\r\nvoid EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, \r\n\t\t\tconst EVP_PKEY_ASN1_METHOD *src);\r\nvoid EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);\r\nvoid EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,\r\n\t\tint (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub),\r\n\t\tint (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk),\r\n\t\tint (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),\r\n\t\tint (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,\r\n\t\t\t\t\t\t\tASN1_PCTX *pctx),\r\n\t\tint (*pkey_size)(const EVP_PKEY *pk),\r\n\t\tint (*pkey_bits)(const EVP_PKEY *pk));\r\nvoid EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,\r\n\t\tint (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf),\r\n\t\tint (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk),\r\n\t\tint (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,\r\n\t\t\t\t\t\t\tASN1_PCTX *pctx));\r\nvoid EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,\r\n\t\tint (*param_decode)(EVP_PKEY *pkey,\r\n\t\t\t\tconst unsigned char **pder, int derlen),\r\n\t\tint (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),\r\n\t\tint (*param_missing)(const EVP_PKEY *pk),\r\n\t\tint (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),\r\n\t\tint (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),\r\n\t\tint (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,\r\n\t\t\t\t\t\t\tASN1_PCTX *pctx));\r\n\r\nvoid EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,\r\n\t\tvoid (*pkey_free)(EVP_PKEY *pkey));\r\nvoid EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,\r\n\t\tint (*pkey_ctrl)(EVP_PKEY *pkey, int op,\r\n\t\t\t\t\t\t\tlong arg1, void *arg2));\r\n\r\n\r\n#define EVP_PKEY_OP_UNDEFINED\t\t0\r\n#define EVP_PKEY_OP_PARAMGEN\t\t(1<<1)\r\n#define EVP_PKEY_OP_KEYGEN\t\t(1<<2)\r\n#define EVP_PKEY_OP_SIGN\t\t(1<<3)\r\n#define EVP_PKEY_OP_VERIFY\t\t(1<<4)\r\n#define EVP_PKEY_OP_VERIFYRECOVER\t(1<<5)\r\n#define EVP_PKEY_OP_SIGNCTX\t\t(1<<6)\r\n#define EVP_PKEY_OP_VERIFYCTX\t\t(1<<7)\r\n#define EVP_PKEY_OP_ENCRYPT\t\t(1<<8)\r\n#define EVP_PKEY_OP_DECRYPT\t\t(1<<9)\r\n#define EVP_PKEY_OP_DERIVE\t\t(1<<10)\r\n\r\n#define EVP_PKEY_OP_TYPE_SIG\t\\\r\n\t(EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \\\r\n\t\t| EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)\r\n\r\n#define EVP_PKEY_OP_TYPE_CRYPT \\\r\n\t(EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)\r\n\r\n#define EVP_PKEY_OP_TYPE_NOGEN \\\r\n\t(EVP_PKEY_OP_SIG | EVP_PKEY_OP_CRYPT | EVP_PKEY_OP_DERIVE)\r\n\r\n#define EVP_PKEY_OP_TYPE_GEN \\\r\n\t\t(EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)\r\n\r\n#define\t EVP_PKEY_CTX_set_signature_md(ctx, md)\t\\\r\n\t\tEVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG,  \\\r\n\t\t\t\t\tEVP_PKEY_CTRL_MD, 0, (void *)md)\r\n\r\n#define EVP_PKEY_CTRL_MD\t\t1\r\n#define EVP_PKEY_CTRL_PEER_KEY\t\t2\r\n\r\n#define EVP_PKEY_CTRL_PKCS7_ENCRYPT\t3\r\n#define EVP_PKEY_CTRL_PKCS7_DECRYPT\t4\r\n\r\n#define EVP_PKEY_CTRL_PKCS7_SIGN\t5\r\n\r\n#define EVP_PKEY_CTRL_SET_MAC_KEY\t6\r\n\r\n#define EVP_PKEY_CTRL_DIGESTINIT\t7\r\n\r\n/* Used by GOST key encryption in TLS */\r\n#define EVP_PKEY_CTRL_SET_IV \t\t8\r\n\r\n#define EVP_PKEY_CTRL_CMS_ENCRYPT\t9\r\n#define EVP_PKEY_CTRL_CMS_DECRYPT\t10\r\n#define EVP_PKEY_CTRL_CMS_SIGN\t\t11\r\n\r\n#define EVP_PKEY_CTRL_CIPHER\t\t12\r\n\r\n#define EVP_PKEY_ALG_CTRL\t\t0x1000\r\n\r\n\r\n#define EVP_PKEY_FLAG_AUTOARGLEN\t2\r\n/* Method handles all operations: don't assume any digest related\r\n * defaults.\r\n */\r\n#define EVP_PKEY_FLAG_SIGCTX_CUSTOM\t4\r\n\r\nconst EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);\r\nEVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags);\r\nvoid EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,\r\n\t\t\t\tconst EVP_PKEY_METHOD *meth);\r\nvoid EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);\r\nvoid EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);\r\nint EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);\r\n\r\nEVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);\r\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);\r\nEVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);\r\nvoid EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);\r\n\r\nint EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,\r\n\t\t\t\tint cmd, int p1, void *p2);\r\nint EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,\r\n\t\t\t\t\t\tconst char *value);\r\n\r\nint EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);\r\nvoid EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);\r\n\r\nEVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,\r\n\t\t\t\tconst unsigned char *key, int keylen);\r\n\r\nvoid EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);\r\nvoid *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);\r\nEVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);\r\n\r\nEVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);\r\n\r\nvoid EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);\r\nvoid *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);\r\n\r\nint EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_sign(EVP_PKEY_CTX *ctx,\r\n\t\t\tunsigned char *sig, size_t *siglen,\r\n\t\t\tconst unsigned char *tbs, size_t tbslen);\r\nint EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_verify(EVP_PKEY_CTX *ctx,\r\n\t\t\tconst unsigned char *sig, size_t siglen,\r\n\t\t\tconst unsigned char *tbs, size_t tbslen);\r\nint EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,\r\n\t\t\tunsigned char *rout, size_t *routlen,\r\n\t\t\tconst unsigned char *sig, size_t siglen);\r\nint EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,\r\n\t\t\tunsigned char *out, size_t *outlen,\r\n\t\t\tconst unsigned char *in, size_t inlen);\r\nint EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,\r\n\t\t\tunsigned char *out, size_t *outlen,\r\n\t\t\tconst unsigned char *in, size_t inlen);\r\n\r\nint EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);\r\nint EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);\r\n\r\ntypedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);\r\n\r\nint EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\r\nint EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);\r\nint EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\r\n\r\nvoid EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);\r\nEVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);\r\n\r\nint EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);\r\n\r\nvoid EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,\r\n\tint (*init)(EVP_PKEY_CTX *ctx));\r\n\r\nvoid EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,\r\n\tint (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src));\r\n\r\nvoid EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,\r\n\tvoid (*cleanup)(EVP_PKEY_CTX *ctx));\r\n\r\nvoid EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,\r\n\tint (*paramgen_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));\r\n\r\nvoid EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,\r\n\tint (*keygen_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));\r\n\r\nvoid EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,\r\n\tint (*sign_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\r\n\t\t\t\t\tconst unsigned char *tbs, size_t tbslen));\r\n\r\nvoid EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,\r\n\tint (*verify_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,\r\n\t\t\t\t\tconst unsigned char *tbs, size_t tbslen));\r\n\r\nvoid EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,\r\n\tint (*verify_recover_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*verify_recover)(EVP_PKEY_CTX *ctx,\r\n\t\t\t\t\tunsigned char *sig, size_t *siglen,\r\n\t\t\t\t\tconst unsigned char *tbs, size_t tbslen));\r\n\r\nvoid EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,\r\n\tint (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),\r\n\tint (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\r\n\t\t\t\t\tEVP_MD_CTX *mctx));\r\n\r\nvoid EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,\r\n\tint (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),\r\n\tint (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen,\r\n\t\t\t\t\tEVP_MD_CTX *mctx));\r\n\r\nvoid EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,\r\n\tint (*encrypt_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,\r\n\t\t\t\t\tconst unsigned char *in, size_t inlen));\r\n\r\nvoid EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,\r\n\tint (*decrypt_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,\r\n\t\t\t\t\tconst unsigned char *in, size_t inlen));\r\n\r\nvoid EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,\r\n\tint (*derive_init)(EVP_PKEY_CTX *ctx),\r\n\tint (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen));\r\n\r\nvoid EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,\r\n\tint (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2),\r\n\tint (*ctrl_str)(EVP_PKEY_CTX *ctx,\r\n\t\t\t\t\tconst char *type, const char *value));\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_EVP_strings(void);\r\n\r\n/* Error codes for the EVP functions. */\r\n\r\n/* Function codes. */\r\n#define EVP_F_AESNI_INIT_KEY\t\t\t\t 165\r\n#define EVP_F_AESNI_XTS_CIPHER\t\t\t\t 176\r\n#define EVP_F_AES_INIT_KEY\t\t\t\t 133\r\n#define EVP_F_AES_XTS\t\t\t\t\t 172\r\n#define EVP_F_AES_XTS_CIPHER\t\t\t\t 175\r\n#define EVP_F_CAMELLIA_INIT_KEY\t\t\t\t 159\r\n#define EVP_F_CMAC_INIT\t\t\t\t\t 173\r\n#define EVP_F_D2I_PKEY\t\t\t\t\t 100\r\n#define EVP_F_DO_SIGVER_INIT\t\t\t\t 161\r\n#define EVP_F_DSAPKEY2PKCS8\t\t\t\t 134\r\n#define EVP_F_DSA_PKEY2PKCS8\t\t\t\t 135\r\n#define EVP_F_ECDSA_PKEY2PKCS8\t\t\t\t 129\r\n#define EVP_F_ECKEY_PKEY2PKCS8\t\t\t\t 132\r\n#define EVP_F_EVP_CIPHERINIT_EX\t\t\t\t 123\r\n#define EVP_F_EVP_CIPHER_CTX_COPY\t\t\t 163\r\n#define EVP_F_EVP_CIPHER_CTX_CTRL\t\t\t 124\r\n#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH\t\t 122\r\n#define EVP_F_EVP_DECRYPTFINAL_EX\t\t\t 101\r\n#define EVP_F_EVP_DIGESTINIT_EX\t\t\t\t 128\r\n#define EVP_F_EVP_ENCRYPTFINAL_EX\t\t\t 127\r\n#define EVP_F_EVP_MD_CTX_COPY_EX\t\t\t 110\r\n#define EVP_F_EVP_MD_SIZE\t\t\t\t 162\r\n#define EVP_F_EVP_OPENINIT\t\t\t\t 102\r\n#define EVP_F_EVP_PBE_ALG_ADD\t\t\t\t 115\r\n#define EVP_F_EVP_PBE_ALG_ADD_TYPE\t\t\t 160\r\n#define EVP_F_EVP_PBE_CIPHERINIT\t\t\t 116\r\n#define EVP_F_EVP_PKCS82PKEY\t\t\t\t 111\r\n#define EVP_F_EVP_PKCS82PKEY_BROKEN\t\t\t 136\r\n#define EVP_F_EVP_PKEY2PKCS8_BROKEN\t\t\t 113\r\n#define EVP_F_EVP_PKEY_COPY_PARAMETERS\t\t\t 103\r\n#define EVP_F_EVP_PKEY_CTX_CTRL\t\t\t\t 137\r\n#define EVP_F_EVP_PKEY_CTX_CTRL_STR\t\t\t 150\r\n#define EVP_F_EVP_PKEY_CTX_DUP\t\t\t\t 156\r\n#define EVP_F_EVP_PKEY_DECRYPT\t\t\t\t 104\r\n#define EVP_F_EVP_PKEY_DECRYPT_INIT\t\t\t 138\r\n#define EVP_F_EVP_PKEY_DECRYPT_OLD\t\t\t 151\r\n#define EVP_F_EVP_PKEY_DERIVE\t\t\t\t 153\r\n#define EVP_F_EVP_PKEY_DERIVE_INIT\t\t\t 154\r\n#define EVP_F_EVP_PKEY_DERIVE_SET_PEER\t\t\t 155\r\n#define EVP_F_EVP_PKEY_ENCRYPT\t\t\t\t 105\r\n#define EVP_F_EVP_PKEY_ENCRYPT_INIT\t\t\t 139\r\n#define EVP_F_EVP_PKEY_ENCRYPT_OLD\t\t\t 152\r\n#define EVP_F_EVP_PKEY_GET1_DH\t\t\t\t 119\r\n#define EVP_F_EVP_PKEY_GET1_DSA\t\t\t\t 120\r\n#define EVP_F_EVP_PKEY_GET1_ECDSA\t\t\t 130\r\n#define EVP_F_EVP_PKEY_GET1_EC_KEY\t\t\t 131\r\n#define EVP_F_EVP_PKEY_GET1_RSA\t\t\t\t 121\r\n#define EVP_F_EVP_PKEY_KEYGEN\t\t\t\t 146\r\n#define EVP_F_EVP_PKEY_KEYGEN_INIT\t\t\t 147\r\n#define EVP_F_EVP_PKEY_NEW\t\t\t\t 106\r\n#define EVP_F_EVP_PKEY_PARAMGEN\t\t\t\t 148\r\n#define EVP_F_EVP_PKEY_PARAMGEN_INIT\t\t\t 149\r\n#define EVP_F_EVP_PKEY_SIGN\t\t\t\t 140\r\n#define EVP_F_EVP_PKEY_SIGN_INIT\t\t\t 141\r\n#define EVP_F_EVP_PKEY_VERIFY\t\t\t\t 142\r\n#define EVP_F_EVP_PKEY_VERIFY_INIT\t\t\t 143\r\n#define EVP_F_EVP_PKEY_VERIFY_RECOVER\t\t\t 144\r\n#define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT\t\t 145\r\n#define EVP_F_EVP_RIJNDAEL\t\t\t\t 126\r\n#define EVP_F_EVP_SIGNFINAL\t\t\t\t 107\r\n#define EVP_F_EVP_VERIFYFINAL\t\t\t\t 108\r\n#define EVP_F_FIPS_CIPHERINIT\t\t\t\t 166\r\n#define EVP_F_FIPS_CIPHER_CTX_COPY\t\t\t 170\r\n#define EVP_F_FIPS_CIPHER_CTX_CTRL\t\t\t 167\r\n#define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH\t\t 171\r\n#define EVP_F_FIPS_DIGESTINIT\t\t\t\t 168\r\n#define EVP_F_FIPS_MD_CTX_COPY\t\t\t\t 169\r\n#define EVP_F_HMAC_INIT_EX\t\t\t\t 174\r\n#define EVP_F_INT_CTX_NEW\t\t\t\t 157\r\n#define EVP_F_PKCS5_PBE_KEYIVGEN\t\t\t 117\r\n#define EVP_F_PKCS5_V2_PBE_KEYIVGEN\t\t\t 118\r\n#define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN\t\t\t 164\r\n#define EVP_F_PKCS8_SET_BROKEN\t\t\t\t 112\r\n#define EVP_F_PKEY_SET_TYPE\t\t\t\t 158\r\n#define EVP_F_RC2_MAGIC_TO_METH\t\t\t\t 109\r\n#define EVP_F_RC5_CTRL\t\t\t\t\t 125\r\n\r\n/* Reason codes. */\r\n#define EVP_R_AES_IV_SETUP_FAILED\t\t\t 162\r\n#define EVP_R_AES_KEY_SETUP_FAILED\t\t\t 143\r\n#define EVP_R_ASN1_LIB\t\t\t\t\t 140\r\n#define EVP_R_BAD_BLOCK_LENGTH\t\t\t\t 136\r\n#define EVP_R_BAD_DECRYPT\t\t\t\t 100\r\n#define EVP_R_BAD_KEY_LENGTH\t\t\t\t 137\r\n#define EVP_R_BN_DECODE_ERROR\t\t\t\t 112\r\n#define EVP_R_BN_PUBKEY_ERROR\t\t\t\t 113\r\n#define EVP_R_BUFFER_TOO_SMALL\t\t\t\t 155\r\n#define EVP_R_CAMELLIA_KEY_SETUP_FAILED\t\t\t 157\r\n#define EVP_R_CIPHER_PARAMETER_ERROR\t\t\t 122\r\n#define EVP_R_COMMAND_NOT_SUPPORTED\t\t\t 147\r\n#define EVP_R_CTRL_NOT_IMPLEMENTED\t\t\t 132\r\n#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED\t\t 133\r\n#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH\t\t 138\r\n#define EVP_R_DECODE_ERROR\t\t\t\t 114\r\n#define EVP_R_DIFFERENT_KEY_TYPES\t\t\t 101\r\n#define EVP_R_DIFFERENT_PARAMETERS\t\t\t 153\r\n#define EVP_R_DISABLED_FOR_FIPS\t\t\t\t 163\r\n#define EVP_R_ENCODE_ERROR\t\t\t\t 115\r\n#define EVP_R_EVP_PBE_CIPHERINIT_ERROR\t\t\t 119\r\n#define EVP_R_EXPECTING_AN_RSA_KEY\t\t\t 127\r\n#define EVP_R_EXPECTING_A_DH_KEY\t\t\t 128\r\n#define EVP_R_EXPECTING_A_DSA_KEY\t\t\t 129\r\n#define EVP_R_EXPECTING_A_ECDSA_KEY\t\t\t 141\r\n#define EVP_R_EXPECTING_A_EC_KEY\t\t\t 142\r\n#define EVP_R_INITIALIZATION_ERROR\t\t\t 134\r\n#define EVP_R_INPUT_NOT_INITIALIZED\t\t\t 111\r\n#define EVP_R_INVALID_DIGEST\t\t\t\t 152\r\n#define EVP_R_INVALID_KEY_LENGTH\t\t\t 130\r\n#define EVP_R_INVALID_OPERATION\t\t\t\t 148\r\n#define EVP_R_IV_TOO_LARGE\t\t\t\t 102\r\n#define EVP_R_KEYGEN_FAILURE\t\t\t\t 120\r\n#define EVP_R_MESSAGE_DIGEST_IS_NULL\t\t\t 159\r\n#define EVP_R_METHOD_NOT_SUPPORTED\t\t\t 144\r\n#define EVP_R_MISSING_PARAMETERS\t\t\t 103\r\n#define EVP_R_NO_CIPHER_SET\t\t\t\t 131\r\n#define EVP_R_NO_DEFAULT_DIGEST\t\t\t\t 158\r\n#define EVP_R_NO_DIGEST_SET\t\t\t\t 139\r\n#define EVP_R_NO_DSA_PARAMETERS\t\t\t\t 116\r\n#define EVP_R_NO_KEY_SET\t\t\t\t 154\r\n#define EVP_R_NO_OPERATION_SET\t\t\t\t 149\r\n#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED\t\t 104\r\n#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED\t\t 105\r\n#define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\t 150\r\n#define EVP_R_OPERATON_NOT_INITIALIZED\t\t\t 151\r\n#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE\t\t\t 117\r\n#define EVP_R_PRIVATE_KEY_DECODE_ERROR\t\t\t 145\r\n#define EVP_R_PRIVATE_KEY_ENCODE_ERROR\t\t\t 146\r\n#define EVP_R_PUBLIC_KEY_NOT_RSA\t\t\t 106\r\n#define EVP_R_TOO_LARGE\t\t\t\t\t 164\r\n#define EVP_R_UNKNOWN_CIPHER\t\t\t\t 160\r\n#define EVP_R_UNKNOWN_DIGEST\t\t\t\t 161\r\n#define EVP_R_UNKNOWN_PBE_ALGORITHM\t\t\t 121\r\n#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS\t\t 135\r\n#define EVP_R_UNSUPPORTED_ALGORITHM\t\t\t 156\r\n#define EVP_R_UNSUPPORTED_CIPHER\t\t\t 107\r\n#define EVP_R_UNSUPPORTED_KEYLENGTH\t\t\t 123\r\n#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION\t 124\r\n#define EVP_R_UNSUPPORTED_KEY_SIZE\t\t\t 108\r\n#define EVP_R_UNSUPPORTED_PRF\t\t\t\t 125\r\n#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM\t\t 118\r\n#define EVP_R_UNSUPPORTED_SALT_TYPE\t\t\t 126\r\n#define EVP_R_WRONG_FINAL_BLOCK_LENGTH\t\t\t 109\r\n#define EVP_R_WRONG_PUBLIC_KEY_TYPE\t\t\t 110\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/hmac.h",
    "content": "/* crypto/hmac/hmac.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n#ifndef HEADER_HMAC_H\r\n#define HEADER_HMAC_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifdef OPENSSL_NO_HMAC\r\n#error HMAC is disabled.\r\n#endif\r\n\r\n#include <openssl/evp.h>\r\n\r\n#define HMAC_MAX_MD_CBLOCK\t128\t/* largest known is SHA512 */\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct hmac_ctx_st\r\n\t{\r\n\tconst EVP_MD *md;\r\n\tEVP_MD_CTX md_ctx;\r\n\tEVP_MD_CTX i_ctx;\r\n\tEVP_MD_CTX o_ctx;\r\n\tunsigned int key_length;\r\n\tunsigned char key[HMAC_MAX_MD_CBLOCK];\r\n\t} HMAC_CTX;\r\n\r\n#define HMAC_size(e)\t(EVP_MD_size((e)->md))\r\n\r\n\r\nvoid HMAC_CTX_init(HMAC_CTX *ctx);\r\nvoid HMAC_CTX_cleanup(HMAC_CTX *ctx);\r\n\r\n#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */\r\n\r\nint HMAC_Init(HMAC_CTX *ctx, const void *key, int len,\r\n\t       const EVP_MD *md); /* deprecated */\r\nint HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,\r\n\t\t  const EVP_MD *md, ENGINE *impl);\r\nint HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);\r\nint HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);\r\nunsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,\r\n\t\t    const unsigned char *d, size_t n, unsigned char *md,\r\n\t\t    unsigned int *md_len);\r\nint HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);\r\n\r\nvoid HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/idea.h",
    "content": "/* crypto/idea/idea.h */\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_IDEA_H\r\n#define HEADER_IDEA_H\r\n\r\n#include <openssl/opensslconf.h> /* IDEA_INT, OPENSSL_NO_IDEA */\r\n\r\n#ifdef OPENSSL_NO_IDEA\r\n#error IDEA is disabled.\r\n#endif\r\n\r\n#define IDEA_ENCRYPT\t1\r\n#define IDEA_DECRYPT\t0\r\n\r\n#define IDEA_BLOCK\t8\r\n#define IDEA_KEY_LENGTH\t16\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct idea_key_st\r\n\t{\r\n\tIDEA_INT data[9][6];\r\n\t} IDEA_KEY_SCHEDULE;\r\n\r\nconst char *idea_options(void);\r\nvoid idea_ecb_encrypt(const unsigned char *in, unsigned char *out,\r\n\tIDEA_KEY_SCHEDULE *ks);\r\n#ifdef OPENSSL_FIPS\r\nvoid private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);\r\n#endif\r\nvoid idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);\r\nvoid idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);\r\nvoid idea_cbc_encrypt(const unsigned char *in, unsigned char *out,\r\n\tlong length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);\r\nvoid idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,\r\n\tlong length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,\r\n\tint *num,int enc);\r\nvoid idea_ofb64_encrypt(const unsigned char *in, unsigned char *out,\r\n\tlong length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num);\r\nvoid idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/krb5_asn.h",
    "content": "/* krb5_asn.h */\r\n/* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project,\r\n** using ocsp/{*.h,*asn*.c} as a starting point\r\n*/\r\n\r\n/* ====================================================================\r\n * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_KRB5_ASN_H\r\n#define HEADER_KRB5_ASN_H\r\n\r\n/*\r\n#include <krb5.h>\r\n*/\r\n#include <openssl/safestack.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\n/*\tASN.1 from Kerberos RFC 1510\r\n*/\r\n\r\n/*\tEncryptedData ::=   SEQUENCE {\r\n**\t\tetype[0]                      INTEGER, -- EncryptionType\r\n**\t\tkvno[1]                       INTEGER OPTIONAL,\r\n**\t\tcipher[2]                     OCTET STRING -- ciphertext\r\n**\t}\r\n*/\r\ntypedef\tstruct\tkrb5_encdata_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*etype;\r\n\tASN1_INTEGER\t\t\t*kvno;\r\n\tASN1_OCTET_STRING\t\t*cipher;\r\n\t}\tKRB5_ENCDATA;\r\n\r\nDECLARE_STACK_OF(KRB5_ENCDATA)\r\n\r\n/*\tPrincipalName ::=   SEQUENCE {\r\n**\t\tname-type[0]                  INTEGER,\r\n**\t\tname-string[1]                SEQUENCE OF GeneralString\r\n**\t}\r\n*/\r\ntypedef\tstruct\tkrb5_princname_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*nametype;\r\n\tSTACK_OF(ASN1_GENERALSTRING)\t*namestring;\r\n\t}\tKRB5_PRINCNAME;\r\n\r\nDECLARE_STACK_OF(KRB5_PRINCNAME)\r\n\r\n\r\n/*\tTicket ::=\t[APPLICATION 1] SEQUENCE {\r\n**\t\ttkt-vno[0]                    INTEGER,\r\n**\t\trealm[1]                      Realm,\r\n**\t\tsname[2]                      PrincipalName,\r\n**\t\tenc-part[3]                   EncryptedData\r\n**\t}\r\n*/\r\ntypedef\tstruct\tkrb5_tktbody_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*tktvno;\r\n\tASN1_GENERALSTRING\t\t*realm;\r\n\tKRB5_PRINCNAME\t\t\t*sname;\r\n\tKRB5_ENCDATA\t\t\t*encdata;\r\n\t}\tKRB5_TKTBODY;\r\n\r\ntypedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;\r\nDECLARE_STACK_OF(KRB5_TKTBODY)\r\n\r\n\r\n/*\tAP-REQ ::=      [APPLICATION 14] SEQUENCE {\r\n**\t\tpvno[0]                       INTEGER,\r\n**\t\tmsg-type[1]                   INTEGER,\r\n**\t\tap-options[2]                 APOptions,\r\n**\t\tticket[3]                     Ticket,\r\n**\t\tauthenticator[4]              EncryptedData\r\n**\t}\r\n**\r\n**\tAPOptions ::=   BIT STRING {\r\n**\t\treserved(0), use-session-key(1), mutual-required(2) }\r\n*/\r\ntypedef\tstruct\tkrb5_ap_req_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*pvno;\r\n\tASN1_INTEGER\t\t\t*msgtype;\r\n\tASN1_BIT_STRING\t\t\t*apoptions;\r\n\tKRB5_TICKET\t\t\t*ticket;\r\n\tKRB5_ENCDATA\t\t\t*authenticator;\r\n\t}\tKRB5_APREQBODY;\r\n\r\ntypedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;\r\nDECLARE_STACK_OF(KRB5_APREQBODY)\r\n\r\n\r\n/*\tAuthenticator Stuff\t*/\r\n\r\n\r\n/*\tChecksum ::=   SEQUENCE {\r\n**\t\tcksumtype[0]                  INTEGER,\r\n**\t\tchecksum[1]                   OCTET STRING\r\n**\t}\r\n*/\r\ntypedef\tstruct\tkrb5_checksum_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*ctype;\r\n\tASN1_OCTET_STRING\t\t*checksum;\r\n\t}\tKRB5_CHECKSUM;\r\n\r\nDECLARE_STACK_OF(KRB5_CHECKSUM)\r\n\r\n\r\n/*\tEncryptionKey ::=   SEQUENCE {\r\n**\t\tkeytype[0]                    INTEGER,\r\n**\t\tkeyvalue[1]                   OCTET STRING\r\n**\t}\r\n*/\r\ntypedef struct  krb5_encryptionkey_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*ktype;\r\n\tASN1_OCTET_STRING\t\t*keyvalue;\r\n\t}\tKRB5_ENCKEY;\r\n\r\nDECLARE_STACK_OF(KRB5_ENCKEY)\r\n\r\n\r\n/*\tAuthorizationData ::=   SEQUENCE OF SEQUENCE {\r\n**\t\tad-type[0]                    INTEGER,\r\n**              ad-data[1]                    OCTET STRING\r\n**\t}\r\n*/\r\ntypedef struct\tkrb5_authorization_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*adtype;\r\n\tASN1_OCTET_STRING\t\t*addata;\r\n\t}\tKRB5_AUTHDATA;\r\n\r\nDECLARE_STACK_OF(KRB5_AUTHDATA)\r\n\r\n\t\t\t\r\n/*\t-- Unencrypted authenticator\r\n**\tAuthenticator ::=    [APPLICATION 2] SEQUENCE    {\r\n**\t\tauthenticator-vno[0]          INTEGER,\r\n**\t\tcrealm[1]                     Realm,\r\n**\t\tcname[2]                      PrincipalName,\r\n**\t\tcksum[3]                      Checksum OPTIONAL,\r\n**\t\tcusec[4]                      INTEGER,\r\n**\t\tctime[5]                      KerberosTime,\r\n**\t\tsubkey[6]                     EncryptionKey OPTIONAL,\r\n**\t\tseq-number[7]                 INTEGER OPTIONAL,\r\n**\t\tauthorization-data[8]         AuthorizationData OPTIONAL\r\n**\t}\r\n*/\r\ntypedef struct\tkrb5_authenticator_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*avno;\r\n\tASN1_GENERALSTRING\t\t*crealm;\r\n\tKRB5_PRINCNAME\t\t\t*cname;\r\n\tKRB5_CHECKSUM\t\t\t*cksum;\r\n\tASN1_INTEGER\t\t\t*cusec;\r\n\tASN1_GENERALIZEDTIME\t\t*ctime;\r\n\tKRB5_ENCKEY\t\t\t*subkey;\r\n\tASN1_INTEGER\t\t\t*seqnum;\r\n\tKRB5_AUTHDATA\t\t\t*authorization;\r\n\t}\tKRB5_AUTHENTBODY;\r\n\r\ntypedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;\r\nDECLARE_STACK_OF(KRB5_AUTHENTBODY)\r\n\r\n\r\n/*  DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =\r\n**\ttype *name##_new(void);\r\n**\tvoid name##_free(type *a);\r\n**\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =\r\n**\t DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =\r\n**\t  type *d2i_##name(type **a, const unsigned char **in, long len);\r\n**\t  int i2d_##name(type *a, unsigned char **out);\r\n**\t  DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it\r\n*/\r\n\r\nDECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_TICKET)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_APREQ)\r\n\r\nDECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY)\r\nDECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT)\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/kssl.h",
    "content": "/* ssl/kssl.h -*- mode: C; c-file-style: \"eay\" -*- */\r\n/* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project 2000.\r\n * project 2000.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n/*\r\n**\t19990701\tVRS \tStarted.\r\n*/\r\n\r\n#ifndef\tKSSL_H\r\n#define\tKSSL_H\r\n\r\n#include <openssl/opensslconf.h>\r\n\r\n#ifndef OPENSSL_NO_KRB5\r\n\r\n#include <stdio.h>\r\n#include <ctype.h>\r\n#include <krb5.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/*\r\n**\tDepending on which KRB5 implementation used, some types from\r\n**\tthe other may be missing.  Resolve that here and now\r\n*/\r\n#ifdef KRB5_HEIMDAL\r\ntypedef unsigned char krb5_octet;\r\n#define FAR\r\n#else\r\n\r\n#ifndef FAR\r\n#define FAR\r\n#endif\r\n\r\n#endif\r\n\r\n/*\tUncomment this to debug kssl problems or\r\n**\tto trace usage of the Kerberos session key\r\n**\r\n**\t#define\t\tKSSL_DEBUG\r\n*/\r\n\r\n#ifndef\tKRB5SVC\r\n#define KRB5SVC\t\"host\"\r\n#endif\r\n\r\n#ifndef\tKRB5KEYTAB\r\n#define KRB5KEYTAB\t\"/etc/krb5.keytab\"\r\n#endif\r\n\r\n#ifndef KRB5SENDAUTH\r\n#define KRB5SENDAUTH\t1\r\n#endif\r\n\r\n#ifndef KRB5CHECKAUTH\r\n#define KRB5CHECKAUTH\t1\r\n#endif\r\n\r\n#ifndef KSSL_CLOCKSKEW\r\n#define\tKSSL_CLOCKSKEW\t300;\r\n#endif\r\n\r\n#define\tKSSL_ERR_MAX\t255\r\ntypedef struct kssl_err_st  {\r\n\tint  reason;\r\n\tchar text[KSSL_ERR_MAX+1];\r\n\t} KSSL_ERR;\r\n\r\n\r\n/*\tContext for passing\r\n**\t\t(1) Kerberos session key to SSL, and\r\n**\t\t(2)\tConfig data between application and SSL lib\r\n*/\r\ntypedef struct kssl_ctx_st\r\n        {\r\n                                /*\tused by:    disposition:            */\r\n\tchar *service_name;\t/*\tC,S\t    default ok (kssl)       */\r\n\tchar *service_host;\t/*\tC\t    input, REQUIRED         */\r\n\tchar *client_princ;\t/*\tS\t    output from krb5 ticket */\r\n\tchar *keytab_file;\t/*      S\t    NULL (/etc/krb5.keytab) */\r\n\tchar *cred_cache;\t/*\tC\t    NULL (default)          */\r\n\tkrb5_enctype enctype;\r\n\tint length;\r\n\tkrb5_octet FAR *key;\r\n\t} KSSL_CTX;\r\n\r\n#define\tKSSL_CLIENT \t1\r\n#define KSSL_SERVER \t2\r\n#define\tKSSL_SERVICE\t3\r\n#define\tKSSL_KEYTAB \t4\r\n\r\n#define KSSL_CTX_OK \t0\r\n#define KSSL_CTX_ERR\t1\r\n#define KSSL_NOMEM\t2\r\n\r\n/* Public (for use by applications that use OpenSSL with Kerberos 5 support */\r\nkrb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text);\r\nKSSL_CTX *kssl_ctx_new(void);\r\nKSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);\r\nvoid kssl_ctx_show(KSSL_CTX *kssl_ctx);\r\nkrb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,\r\n        krb5_data *realm, krb5_data *entity, int nentities);\r\nkrb5_error_code\tkssl_cget_tkt(KSSL_CTX *kssl_ctx,  krb5_data **enc_tktp,\r\n        krb5_data *authenp, KSSL_ERR *kssl_err);\r\nkrb5_error_code\tkssl_sget_tkt(KSSL_CTX *kssl_ctx,  krb5_data *indata,\r\n        krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);\r\nkrb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);\r\nvoid\tkssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);\r\nvoid kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);\r\nkrb5_error_code  kssl_build_principal_2(krb5_context context,\r\n\t\t\tkrb5_principal *princ, int rlen, const char *realm,\r\n\t\t\tint slen, const char *svc, int hlen, const char *host);\r\nkrb5_error_code  kssl_validate_times(krb5_timestamp atime,\r\n\t\t\t\t\tkrb5_ticket_times *ttimes);\r\nkrb5_error_code  kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,\r\n\t\t\t            krb5_timestamp *atimep, KSSL_ERR *kssl_err);\r\nunsigned char\t*kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);\r\n\r\nvoid SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx);\r\nKSSL_CTX * SSL_get0_kssl_ctx(SSL *s);\r\nchar *kssl_ctx_get0_client_princ(KSSL_CTX *kctx);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\t/* OPENSSL_NO_KRB5\t*/\r\n#endif\t/* KSSL_H \t*/\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/lhash.h",
    "content": "/* crypto/lhash/lhash.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n/* Header for dynamic hash table routines\r\n * Author - Eric Young\r\n */\r\n\r\n#ifndef HEADER_LHASH_H\r\n#define HEADER_LHASH_H\r\n\r\n#include <openssl/e_os2.h>\r\n#ifndef OPENSSL_NO_FP_API\r\n#include <stdio.h>\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct lhash_node_st\r\n\t{\r\n\tvoid *data;\r\n\tstruct lhash_node_st *next;\r\n#ifndef OPENSSL_NO_HASH_COMP\r\n\tunsigned long hash;\r\n#endif\r\n\t} LHASH_NODE;\r\n\r\ntypedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);\r\ntypedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);\r\ntypedef void (*LHASH_DOALL_FN_TYPE)(void *);\r\ntypedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);\r\n\r\n/* Macros for declaring and implementing type-safe wrappers for LHASH callbacks.\r\n * This way, callbacks can be provided to LHASH structures without function\r\n * pointer casting and the macro-defined callbacks provide per-variable casting\r\n * before deferring to the underlying type-specific callbacks. NB: It is\r\n * possible to place a \"static\" in front of both the DECLARE and IMPLEMENT\r\n * macros if the functions are strictly internal. */\r\n\r\n/* First: \"hash\" functions */\r\n#define DECLARE_LHASH_HASH_FN(name, o_type) \\\r\n\tunsigned long name##_LHASH_HASH(const void *);\r\n#define IMPLEMENT_LHASH_HASH_FN(name, o_type) \\\r\n\tunsigned long name##_LHASH_HASH(const void *arg) { \\\r\n\t\tconst o_type *a = arg; \\\r\n\t\treturn name##_hash(a); }\r\n#define LHASH_HASH_FN(name) name##_LHASH_HASH\r\n\r\n/* Second: \"compare\" functions */\r\n#define DECLARE_LHASH_COMP_FN(name, o_type) \\\r\n\tint name##_LHASH_COMP(const void *, const void *);\r\n#define IMPLEMENT_LHASH_COMP_FN(name, o_type) \\\r\n\tint name##_LHASH_COMP(const void *arg1, const void *arg2) { \\\r\n\t\tconst o_type *a = arg1;\t\t    \\\r\n\t\tconst o_type *b = arg2; \\\r\n\t\treturn name##_cmp(a,b); }\r\n#define LHASH_COMP_FN(name) name##_LHASH_COMP\r\n\r\n/* Third: \"doall\" functions */\r\n#define DECLARE_LHASH_DOALL_FN(name, o_type) \\\r\n\tvoid name##_LHASH_DOALL(void *);\r\n#define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \\\r\n\tvoid name##_LHASH_DOALL(void *arg) { \\\r\n\t\to_type *a = arg; \\\r\n\t\tname##_doall(a); }\r\n#define LHASH_DOALL_FN(name) name##_LHASH_DOALL\r\n\r\n/* Fourth: \"doall_arg\" functions */\r\n#define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \\\r\n\tvoid name##_LHASH_DOALL_ARG(void *, void *);\r\n#define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \\\r\n\tvoid name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \\\r\n\t\to_type *a = arg1; \\\r\n\t\ta_type *b = arg2; \\\r\n\t\tname##_doall_arg(a, b); }\r\n#define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG\r\n\r\ntypedef struct lhash_st\r\n\t{\r\n\tLHASH_NODE **b;\r\n\tLHASH_COMP_FN_TYPE comp;\r\n\tLHASH_HASH_FN_TYPE hash;\r\n\tunsigned int num_nodes;\r\n\tunsigned int num_alloc_nodes;\r\n\tunsigned int p;\r\n\tunsigned int pmax;\r\n\tunsigned long up_load; /* load times 256 */\r\n\tunsigned long down_load; /* load times 256 */\r\n\tunsigned long num_items;\r\n\r\n\tunsigned long num_expands;\r\n\tunsigned long num_expand_reallocs;\r\n\tunsigned long num_contracts;\r\n\tunsigned long num_contract_reallocs;\r\n\tunsigned long num_hash_calls;\r\n\tunsigned long num_comp_calls;\r\n\tunsigned long num_insert;\r\n\tunsigned long num_replace;\r\n\tunsigned long num_delete;\r\n\tunsigned long num_no_delete;\r\n\tunsigned long num_retrieve;\r\n\tunsigned long num_retrieve_miss;\r\n\tunsigned long num_hash_comps;\r\n\r\n\tint error;\r\n\t} _LHASH;\t/* Do not use _LHASH directly, use LHASH_OF\r\n\t\t\t * and friends */\r\n\r\n#define LH_LOAD_MULT\t256\r\n\r\n/* Indicates a malloc() error in the last call, this is only bad\r\n * in lh_insert(). */\r\n#define lh_error(lh)\t((lh)->error)\r\n\r\n_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);\r\nvoid lh_free(_LHASH *lh);\r\nvoid *lh_insert(_LHASH *lh, void *data);\r\nvoid *lh_delete(_LHASH *lh, const void *data);\r\nvoid *lh_retrieve(_LHASH *lh, const void *data);\r\nvoid lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func);\r\nvoid lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);\r\nunsigned long lh_strhash(const char *c);\r\nunsigned long lh_num_items(const _LHASH *lh);\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\nvoid lh_stats(const _LHASH *lh, FILE *out);\r\nvoid lh_node_stats(const _LHASH *lh, FILE *out);\r\nvoid lh_node_usage_stats(const _LHASH *lh, FILE *out);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nvoid lh_stats_bio(const _LHASH *lh, BIO *out);\r\nvoid lh_node_stats_bio(const _LHASH *lh, BIO *out);\r\nvoid lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);\r\n#endif\r\n\r\n/* Type checking... */\r\n\r\n#define LHASH_OF(type) struct lhash_st_##type\r\n\r\n#define DECLARE_LHASH_OF(type) LHASH_OF(type) { int dummy; }\r\n\r\n#define CHECKED_LHASH_OF(type,lh) \\\r\n  ((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh))\r\n\r\n/* Define wrapper functions. */\r\n#define LHM_lh_new(type, name) \\\r\n  ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name)))\r\n#define LHM_lh_error(type, lh) \\\r\n  lh_error(CHECKED_LHASH_OF(type,lh))\r\n#define LHM_lh_insert(type, lh, inst) \\\r\n  ((type *)lh_insert(CHECKED_LHASH_OF(type, lh), \\\r\n\t\t     CHECKED_PTR_OF(type, inst)))\r\n#define LHM_lh_retrieve(type, lh, inst) \\\r\n  ((type *)lh_retrieve(CHECKED_LHASH_OF(type, lh), \\\r\n\t\t       CHECKED_PTR_OF(type, inst)))\r\n#define LHM_lh_delete(type, lh, inst) \\\r\n  ((type *)lh_delete(CHECKED_LHASH_OF(type, lh),\t\t\t\\\r\n\t\t     CHECKED_PTR_OF(type, inst)))\r\n#define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn)\r\n#define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \\\r\n  lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))\r\n#define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh))\r\n#define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load)\r\n#define LHM_lh_node_stats_bio(type, lh, out) \\\r\n  lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out)\r\n#define LHM_lh_node_usage_stats_bio(type, lh, out) \\\r\n  lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out)\r\n#define LHM_lh_stats_bio(type, lh, out) \\\r\n  lh_stats_bio(CHECKED_LHASH_OF(type, lh), out)\r\n#define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh))\r\n\r\nDECLARE_LHASH_OF(OPENSSL_STRING);\r\nDECLARE_LHASH_OF(OPENSSL_CSTRING);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/md4.h",
    "content": "/* crypto/md4/md4.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_MD4_H\r\n#define HEADER_MD4_H\r\n\r\n#include <openssl/e_os2.h>\r\n#include <stddef.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_NO_MD4\r\n#error MD4 is disabled.\r\n#endif\r\n\r\n/*\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then !\r\n * ! MD4_LONG_LOG2 has to be defined along.\t\t\t   !\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n */\r\n\r\n#if defined(__LP32__)\r\n#define MD4_LONG unsigned long\r\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\r\n#define MD4_LONG unsigned long\r\n#define MD4_LONG_LOG2 3\r\n/*\r\n * _CRAY note. I could declare short, but I have no idea what impact\r\n * does it have on performance on none-T3E machines. I could declare\r\n * int, but at least on C90 sizeof(int) can be chosen at compile time.\r\n * So I've chosen long...\r\n *\t\t\t\t\t<appro@fy.chalmers.se>\r\n */\r\n#else\r\n#define MD4_LONG unsigned int\r\n#endif\r\n\r\n#define MD4_CBLOCK\t64\r\n#define MD4_LBLOCK\t(MD4_CBLOCK/4)\r\n#define MD4_DIGEST_LENGTH 16\r\n\r\ntypedef struct MD4state_st\r\n\t{\r\n\tMD4_LONG A,B,C,D;\r\n\tMD4_LONG Nl,Nh;\r\n\tMD4_LONG data[MD4_LBLOCK];\r\n\tunsigned int num;\r\n\t} MD4_CTX;\r\n\r\n#ifdef OPENSSL_FIPS\r\nint private_MD4_Init(MD4_CTX *c);\r\n#endif\r\nint MD4_Init(MD4_CTX *c);\r\nint MD4_Update(MD4_CTX *c, const void *data, size_t len);\r\nint MD4_Final(unsigned char *md, MD4_CTX *c);\r\nunsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);\r\nvoid MD4_Transform(MD4_CTX *c, const unsigned char *b);\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/md5.h",
    "content": "/* crypto/md5/md5.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_MD5_H\r\n#define HEADER_MD5_H\r\n\r\n#include <openssl/e_os2.h>\r\n#include <stddef.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_NO_MD5\r\n#error MD5 is disabled.\r\n#endif\r\n\r\n/*\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then !\r\n * ! MD5_LONG_LOG2 has to be defined along.\t\t\t   !\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n */\r\n\r\n#if defined(__LP32__)\r\n#define MD5_LONG unsigned long\r\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\r\n#define MD5_LONG unsigned long\r\n#define MD5_LONG_LOG2 3\r\n/*\r\n * _CRAY note. I could declare short, but I have no idea what impact\r\n * does it have on performance on none-T3E machines. I could declare\r\n * int, but at least on C90 sizeof(int) can be chosen at compile time.\r\n * So I've chosen long...\r\n *\t\t\t\t\t<appro@fy.chalmers.se>\r\n */\r\n#else\r\n#define MD5_LONG unsigned int\r\n#endif\r\n\r\n#define MD5_CBLOCK\t64\r\n#define MD5_LBLOCK\t(MD5_CBLOCK/4)\r\n#define MD5_DIGEST_LENGTH 16\r\n\r\ntypedef struct MD5state_st\r\n\t{\r\n\tMD5_LONG A,B,C,D;\r\n\tMD5_LONG Nl,Nh;\r\n\tMD5_LONG data[MD5_LBLOCK];\r\n\tunsigned int num;\r\n\t} MD5_CTX;\r\n\r\n#ifdef OPENSSL_FIPS\r\nint private_MD5_Init(MD5_CTX *c);\r\n#endif\r\nint MD5_Init(MD5_CTX *c);\r\nint MD5_Update(MD5_CTX *c, const void *data, size_t len);\r\nint MD5_Final(unsigned char *md, MD5_CTX *c);\r\nunsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md);\r\nvoid MD5_Transform(MD5_CTX *c, const unsigned char *b);\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/mdc2.h",
    "content": "/* crypto/mdc2/mdc2.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_MDC2_H\r\n#define HEADER_MDC2_H\r\n\r\n#include <openssl/des.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_NO_MDC2\r\n#error MDC2 is disabled.\r\n#endif\r\n\r\n#define MDC2_BLOCK              8\r\n#define MDC2_DIGEST_LENGTH      16\r\n \r\ntypedef struct mdc2_ctx_st\r\n\t{\r\n\tunsigned int num;\r\n\tunsigned char data[MDC2_BLOCK];\r\n\tDES_cblock h,hh;\r\n\tint pad_type; /* either 1 or 2, default 1 */\r\n\t} MDC2_CTX;\r\n\r\n\r\n#ifdef OPENSSL_FIPS\r\nint private_MDC2_Init(MDC2_CTX *c);\r\n#endif\r\nint MDC2_Init(MDC2_CTX *c);\r\nint MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);\r\nint MDC2_Final(unsigned char *md, MDC2_CTX *c);\r\nunsigned char *MDC2(const unsigned char *d, size_t n,\r\n\tunsigned char *md);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/modes.h",
    "content": "/* ====================================================================\r\n * Copyright (c) 2008 The OpenSSL Project. All rights reserved.\r\n *\r\n * Rights for redistribution and usage in source and binary\r\n * forms are granted according to the OpenSSL license.\r\n */\r\n\r\n#include <stddef.h>\r\n\r\ntypedef void (*block128_f)(const unsigned char in[16],\r\n\t\t\tunsigned char out[16],\r\n\t\t\tconst void *key);\r\n\r\ntypedef void (*cbc128_f)(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], int enc);\r\n\r\ntypedef void (*ctr128_f)(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t blocks, const void *key,\r\n\t\t\tconst unsigned char ivec[16]);\r\n\r\ntypedef void (*ccm128_f)(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t blocks, const void *key,\r\n\t\t\tconst unsigned char ivec[16],unsigned char cmac[16]);\r\n\r\nvoid CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], block128_f block);\r\nvoid CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], block128_f block);\r\n\r\nvoid CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], unsigned char ecount_buf[16],\r\n\t\t\tunsigned int *num, block128_f block);\r\n\r\nvoid CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], unsigned char ecount_buf[16],\r\n\t\t\tunsigned int *num, ctr128_f ctr);\r\n\r\nvoid CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], int *num,\r\n\t\t\tblock128_f block);\r\n\r\nvoid CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], int *num,\r\n\t\t\tint enc, block128_f block);\r\nvoid CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t length, const void *key,\r\n\t\t\tunsigned char ivec[16], int *num,\r\n\t\t\tint enc, block128_f block);\r\nvoid CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t bits, const void *key,\r\n\t\t\tunsigned char ivec[16], int *num,\r\n\t\t\tint enc, block128_f block);\r\n\r\nsize_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], block128_f block);\r\nsize_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], cbc128_f cbc);\r\nsize_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], block128_f block);\r\nsize_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], cbc128_f cbc);\r\n\r\nsize_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], block128_f block);\r\nsize_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], cbc128_f cbc);\r\nsize_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], block128_f block);\r\nsize_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, const void *key,\r\n\t\t\tunsigned char ivec[16], cbc128_f cbc);\r\n\r\ntypedef struct gcm128_context GCM128_CONTEXT;\r\n\r\nGCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block);\r\nvoid CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block);\r\nvoid CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,\r\n\t\t\tsize_t len);\r\nint CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,\r\n\t\t\tsize_t len);\r\nint CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,\r\n\t\t\tconst unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len);\r\nint CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,\r\n\t\t\tconst unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len);\r\nint CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,\r\n\t\t\tconst unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, ctr128_f stream);\r\nint CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,\r\n\t\t\tconst unsigned char *in, unsigned char *out,\r\n\t\t\tsize_t len, ctr128_f stream);\r\nint CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,\r\n\t\t\tsize_t len);\r\nvoid CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);\r\nvoid CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);\r\n\r\ntypedef struct ccm128_context CCM128_CONTEXT;\r\n\r\nvoid CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,\r\n\tunsigned int M, unsigned int L, void *key,block128_f block);\r\nint CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx,\r\n\tconst unsigned char *nonce, size_t nlen, size_t mlen);\r\nvoid CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,\r\n\tconst unsigned char *aad, size_t alen);\r\nint CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,\r\n\tconst unsigned char *inp, unsigned char *out, size_t len);\r\nint CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,\r\n\tconst unsigned char *inp, unsigned char *out, size_t len);\r\nint CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx,\r\n\tconst unsigned char *inp, unsigned char *out, size_t len,\r\n\tccm128_f stream);\r\nint CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx,\r\n\tconst unsigned char *inp, unsigned char *out, size_t len,\r\n\tccm128_f stream);\r\nsize_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len);\r\n\r\ntypedef struct xts128_context XTS128_CONTEXT;\r\n\r\nint CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],\r\n\tconst unsigned char *inp, unsigned char *out, size_t len, int enc);\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/obj_mac.h",
    "content": "/* crypto/objects/obj_mac.h */\r\n\r\n/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the\r\n * following command:\r\n * perl objects.pl objects.txt obj_mac.num obj_mac.h\r\n */\r\n\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#define SN_undef\t\t\t\"UNDEF\"\r\n#define LN_undef\t\t\t\"undefined\"\r\n#define NID_undef\t\t\t0\r\n#define OBJ_undef\t\t\t0L\r\n\r\n#define SN_itu_t\t\t\"ITU-T\"\r\n#define LN_itu_t\t\t\"itu-t\"\r\n#define NID_itu_t\t\t645\r\n#define OBJ_itu_t\t\t0L\r\n\r\n#define NID_ccitt\t\t404\r\n#define OBJ_ccitt\t\tOBJ_itu_t\r\n\r\n#define SN_iso\t\t\"ISO\"\r\n#define LN_iso\t\t\"iso\"\r\n#define NID_iso\t\t181\r\n#define OBJ_iso\t\t1L\r\n\r\n#define SN_joint_iso_itu_t\t\t\"JOINT-ISO-ITU-T\"\r\n#define LN_joint_iso_itu_t\t\t\"joint-iso-itu-t\"\r\n#define NID_joint_iso_itu_t\t\t646\r\n#define OBJ_joint_iso_itu_t\t\t2L\r\n\r\n#define NID_joint_iso_ccitt\t\t393\r\n#define OBJ_joint_iso_ccitt\t\tOBJ_joint_iso_itu_t\r\n\r\n#define SN_member_body\t\t\"member-body\"\r\n#define LN_member_body\t\t\"ISO Member Body\"\r\n#define NID_member_body\t\t182\r\n#define OBJ_member_body\t\tOBJ_iso,2L\r\n\r\n#define SN_identified_organization\t\t\"identified-organization\"\r\n#define NID_identified_organization\t\t676\r\n#define OBJ_identified_organization\t\tOBJ_iso,3L\r\n\r\n#define SN_hmac_md5\t\t\"HMAC-MD5\"\r\n#define LN_hmac_md5\t\t\"hmac-md5\"\r\n#define NID_hmac_md5\t\t780\r\n#define OBJ_hmac_md5\t\tOBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L\r\n\r\n#define SN_hmac_sha1\t\t\"HMAC-SHA1\"\r\n#define LN_hmac_sha1\t\t\"hmac-sha1\"\r\n#define NID_hmac_sha1\t\t781\r\n#define OBJ_hmac_sha1\t\tOBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L\r\n\r\n#define SN_certicom_arc\t\t\"certicom-arc\"\r\n#define NID_certicom_arc\t\t677\r\n#define OBJ_certicom_arc\t\tOBJ_identified_organization,132L\r\n\r\n#define SN_international_organizations\t\t\"international-organizations\"\r\n#define LN_international_organizations\t\t\"International Organizations\"\r\n#define NID_international_organizations\t\t647\r\n#define OBJ_international_organizations\t\tOBJ_joint_iso_itu_t,23L\r\n\r\n#define SN_wap\t\t\"wap\"\r\n#define NID_wap\t\t678\r\n#define OBJ_wap\t\tOBJ_international_organizations,43L\r\n\r\n#define SN_wap_wsg\t\t\"wap-wsg\"\r\n#define NID_wap_wsg\t\t679\r\n#define OBJ_wap_wsg\t\tOBJ_wap,1L\r\n\r\n#define SN_selected_attribute_types\t\t\"selected-attribute-types\"\r\n#define LN_selected_attribute_types\t\t\"Selected Attribute Types\"\r\n#define NID_selected_attribute_types\t\t394\r\n#define OBJ_selected_attribute_types\t\tOBJ_joint_iso_itu_t,5L,1L,5L\r\n\r\n#define SN_clearance\t\t\"clearance\"\r\n#define NID_clearance\t\t395\r\n#define OBJ_clearance\t\tOBJ_selected_attribute_types,55L\r\n\r\n#define SN_ISO_US\t\t\"ISO-US\"\r\n#define LN_ISO_US\t\t\"ISO US Member Body\"\r\n#define NID_ISO_US\t\t183\r\n#define OBJ_ISO_US\t\tOBJ_member_body,840L\r\n\r\n#define SN_X9_57\t\t\"X9-57\"\r\n#define LN_X9_57\t\t\"X9.57\"\r\n#define NID_X9_57\t\t184\r\n#define OBJ_X9_57\t\tOBJ_ISO_US,10040L\r\n\r\n#define SN_X9cm\t\t\"X9cm\"\r\n#define LN_X9cm\t\t\"X9.57 CM ?\"\r\n#define NID_X9cm\t\t185\r\n#define OBJ_X9cm\t\tOBJ_X9_57,4L\r\n\r\n#define SN_dsa\t\t\"DSA\"\r\n#define LN_dsa\t\t\"dsaEncryption\"\r\n#define NID_dsa\t\t116\r\n#define OBJ_dsa\t\tOBJ_X9cm,1L\r\n\r\n#define SN_dsaWithSHA1\t\t\"DSA-SHA1\"\r\n#define LN_dsaWithSHA1\t\t\"dsaWithSHA1\"\r\n#define NID_dsaWithSHA1\t\t113\r\n#define OBJ_dsaWithSHA1\t\tOBJ_X9cm,3L\r\n\r\n#define SN_ansi_X9_62\t\t\"ansi-X9-62\"\r\n#define LN_ansi_X9_62\t\t\"ANSI X9.62\"\r\n#define NID_ansi_X9_62\t\t405\r\n#define OBJ_ansi_X9_62\t\tOBJ_ISO_US,10045L\r\n\r\n#define OBJ_X9_62_id_fieldType\t\tOBJ_ansi_X9_62,1L\r\n\r\n#define SN_X9_62_prime_field\t\t\"prime-field\"\r\n#define NID_X9_62_prime_field\t\t406\r\n#define OBJ_X9_62_prime_field\t\tOBJ_X9_62_id_fieldType,1L\r\n\r\n#define SN_X9_62_characteristic_two_field\t\t\"characteristic-two-field\"\r\n#define NID_X9_62_characteristic_two_field\t\t407\r\n#define OBJ_X9_62_characteristic_two_field\t\tOBJ_X9_62_id_fieldType,2L\r\n\r\n#define SN_X9_62_id_characteristic_two_basis\t\t\"id-characteristic-two-basis\"\r\n#define NID_X9_62_id_characteristic_two_basis\t\t680\r\n#define OBJ_X9_62_id_characteristic_two_basis\t\tOBJ_X9_62_characteristic_two_field,3L\r\n\r\n#define SN_X9_62_onBasis\t\t\"onBasis\"\r\n#define NID_X9_62_onBasis\t\t681\r\n#define OBJ_X9_62_onBasis\t\tOBJ_X9_62_id_characteristic_two_basis,1L\r\n\r\n#define SN_X9_62_tpBasis\t\t\"tpBasis\"\r\n#define NID_X9_62_tpBasis\t\t682\r\n#define OBJ_X9_62_tpBasis\t\tOBJ_X9_62_id_characteristic_two_basis,2L\r\n\r\n#define SN_X9_62_ppBasis\t\t\"ppBasis\"\r\n#define NID_X9_62_ppBasis\t\t683\r\n#define OBJ_X9_62_ppBasis\t\tOBJ_X9_62_id_characteristic_two_basis,3L\r\n\r\n#define OBJ_X9_62_id_publicKeyType\t\tOBJ_ansi_X9_62,2L\r\n\r\n#define SN_X9_62_id_ecPublicKey\t\t\"id-ecPublicKey\"\r\n#define NID_X9_62_id_ecPublicKey\t\t408\r\n#define OBJ_X9_62_id_ecPublicKey\t\tOBJ_X9_62_id_publicKeyType,1L\r\n\r\n#define OBJ_X9_62_ellipticCurve\t\tOBJ_ansi_X9_62,3L\r\n\r\n#define OBJ_X9_62_c_TwoCurve\t\tOBJ_X9_62_ellipticCurve,0L\r\n\r\n#define SN_X9_62_c2pnb163v1\t\t\"c2pnb163v1\"\r\n#define NID_X9_62_c2pnb163v1\t\t684\r\n#define OBJ_X9_62_c2pnb163v1\t\tOBJ_X9_62_c_TwoCurve,1L\r\n\r\n#define SN_X9_62_c2pnb163v2\t\t\"c2pnb163v2\"\r\n#define NID_X9_62_c2pnb163v2\t\t685\r\n#define OBJ_X9_62_c2pnb163v2\t\tOBJ_X9_62_c_TwoCurve,2L\r\n\r\n#define SN_X9_62_c2pnb163v3\t\t\"c2pnb163v3\"\r\n#define NID_X9_62_c2pnb163v3\t\t686\r\n#define OBJ_X9_62_c2pnb163v3\t\tOBJ_X9_62_c_TwoCurve,3L\r\n\r\n#define SN_X9_62_c2pnb176v1\t\t\"c2pnb176v1\"\r\n#define NID_X9_62_c2pnb176v1\t\t687\r\n#define OBJ_X9_62_c2pnb176v1\t\tOBJ_X9_62_c_TwoCurve,4L\r\n\r\n#define SN_X9_62_c2tnb191v1\t\t\"c2tnb191v1\"\r\n#define NID_X9_62_c2tnb191v1\t\t688\r\n#define OBJ_X9_62_c2tnb191v1\t\tOBJ_X9_62_c_TwoCurve,5L\r\n\r\n#define SN_X9_62_c2tnb191v2\t\t\"c2tnb191v2\"\r\n#define NID_X9_62_c2tnb191v2\t\t689\r\n#define OBJ_X9_62_c2tnb191v2\t\tOBJ_X9_62_c_TwoCurve,6L\r\n\r\n#define SN_X9_62_c2tnb191v3\t\t\"c2tnb191v3\"\r\n#define NID_X9_62_c2tnb191v3\t\t690\r\n#define OBJ_X9_62_c2tnb191v3\t\tOBJ_X9_62_c_TwoCurve,7L\r\n\r\n#define SN_X9_62_c2onb191v4\t\t\"c2onb191v4\"\r\n#define NID_X9_62_c2onb191v4\t\t691\r\n#define OBJ_X9_62_c2onb191v4\t\tOBJ_X9_62_c_TwoCurve,8L\r\n\r\n#define SN_X9_62_c2onb191v5\t\t\"c2onb191v5\"\r\n#define NID_X9_62_c2onb191v5\t\t692\r\n#define OBJ_X9_62_c2onb191v5\t\tOBJ_X9_62_c_TwoCurve,9L\r\n\r\n#define SN_X9_62_c2pnb208w1\t\t\"c2pnb208w1\"\r\n#define NID_X9_62_c2pnb208w1\t\t693\r\n#define OBJ_X9_62_c2pnb208w1\t\tOBJ_X9_62_c_TwoCurve,10L\r\n\r\n#define SN_X9_62_c2tnb239v1\t\t\"c2tnb239v1\"\r\n#define NID_X9_62_c2tnb239v1\t\t694\r\n#define OBJ_X9_62_c2tnb239v1\t\tOBJ_X9_62_c_TwoCurve,11L\r\n\r\n#define SN_X9_62_c2tnb239v2\t\t\"c2tnb239v2\"\r\n#define NID_X9_62_c2tnb239v2\t\t695\r\n#define OBJ_X9_62_c2tnb239v2\t\tOBJ_X9_62_c_TwoCurve,12L\r\n\r\n#define SN_X9_62_c2tnb239v3\t\t\"c2tnb239v3\"\r\n#define NID_X9_62_c2tnb239v3\t\t696\r\n#define OBJ_X9_62_c2tnb239v3\t\tOBJ_X9_62_c_TwoCurve,13L\r\n\r\n#define SN_X9_62_c2onb239v4\t\t\"c2onb239v4\"\r\n#define NID_X9_62_c2onb239v4\t\t697\r\n#define OBJ_X9_62_c2onb239v4\t\tOBJ_X9_62_c_TwoCurve,14L\r\n\r\n#define SN_X9_62_c2onb239v5\t\t\"c2onb239v5\"\r\n#define NID_X9_62_c2onb239v5\t\t698\r\n#define OBJ_X9_62_c2onb239v5\t\tOBJ_X9_62_c_TwoCurve,15L\r\n\r\n#define SN_X9_62_c2pnb272w1\t\t\"c2pnb272w1\"\r\n#define NID_X9_62_c2pnb272w1\t\t699\r\n#define OBJ_X9_62_c2pnb272w1\t\tOBJ_X9_62_c_TwoCurve,16L\r\n\r\n#define SN_X9_62_c2pnb304w1\t\t\"c2pnb304w1\"\r\n#define NID_X9_62_c2pnb304w1\t\t700\r\n#define OBJ_X9_62_c2pnb304w1\t\tOBJ_X9_62_c_TwoCurve,17L\r\n\r\n#define SN_X9_62_c2tnb359v1\t\t\"c2tnb359v1\"\r\n#define NID_X9_62_c2tnb359v1\t\t701\r\n#define OBJ_X9_62_c2tnb359v1\t\tOBJ_X9_62_c_TwoCurve,18L\r\n\r\n#define SN_X9_62_c2pnb368w1\t\t\"c2pnb368w1\"\r\n#define NID_X9_62_c2pnb368w1\t\t702\r\n#define OBJ_X9_62_c2pnb368w1\t\tOBJ_X9_62_c_TwoCurve,19L\r\n\r\n#define SN_X9_62_c2tnb431r1\t\t\"c2tnb431r1\"\r\n#define NID_X9_62_c2tnb431r1\t\t703\r\n#define OBJ_X9_62_c2tnb431r1\t\tOBJ_X9_62_c_TwoCurve,20L\r\n\r\n#define OBJ_X9_62_primeCurve\t\tOBJ_X9_62_ellipticCurve,1L\r\n\r\n#define SN_X9_62_prime192v1\t\t\"prime192v1\"\r\n#define NID_X9_62_prime192v1\t\t409\r\n#define OBJ_X9_62_prime192v1\t\tOBJ_X9_62_primeCurve,1L\r\n\r\n#define SN_X9_62_prime192v2\t\t\"prime192v2\"\r\n#define NID_X9_62_prime192v2\t\t410\r\n#define OBJ_X9_62_prime192v2\t\tOBJ_X9_62_primeCurve,2L\r\n\r\n#define SN_X9_62_prime192v3\t\t\"prime192v3\"\r\n#define NID_X9_62_prime192v3\t\t411\r\n#define OBJ_X9_62_prime192v3\t\tOBJ_X9_62_primeCurve,3L\r\n\r\n#define SN_X9_62_prime239v1\t\t\"prime239v1\"\r\n#define NID_X9_62_prime239v1\t\t412\r\n#define OBJ_X9_62_prime239v1\t\tOBJ_X9_62_primeCurve,4L\r\n\r\n#define SN_X9_62_prime239v2\t\t\"prime239v2\"\r\n#define NID_X9_62_prime239v2\t\t413\r\n#define OBJ_X9_62_prime239v2\t\tOBJ_X9_62_primeCurve,5L\r\n\r\n#define SN_X9_62_prime239v3\t\t\"prime239v3\"\r\n#define NID_X9_62_prime239v3\t\t414\r\n#define OBJ_X9_62_prime239v3\t\tOBJ_X9_62_primeCurve,6L\r\n\r\n#define SN_X9_62_prime256v1\t\t\"prime256v1\"\r\n#define NID_X9_62_prime256v1\t\t415\r\n#define OBJ_X9_62_prime256v1\t\tOBJ_X9_62_primeCurve,7L\r\n\r\n#define OBJ_X9_62_id_ecSigType\t\tOBJ_ansi_X9_62,4L\r\n\r\n#define SN_ecdsa_with_SHA1\t\t\"ecdsa-with-SHA1\"\r\n#define NID_ecdsa_with_SHA1\t\t416\r\n#define OBJ_ecdsa_with_SHA1\t\tOBJ_X9_62_id_ecSigType,1L\r\n\r\n#define SN_ecdsa_with_Recommended\t\t\"ecdsa-with-Recommended\"\r\n#define NID_ecdsa_with_Recommended\t\t791\r\n#define OBJ_ecdsa_with_Recommended\t\tOBJ_X9_62_id_ecSigType,2L\r\n\r\n#define SN_ecdsa_with_Specified\t\t\"ecdsa-with-Specified\"\r\n#define NID_ecdsa_with_Specified\t\t792\r\n#define OBJ_ecdsa_with_Specified\t\tOBJ_X9_62_id_ecSigType,3L\r\n\r\n#define SN_ecdsa_with_SHA224\t\t\"ecdsa-with-SHA224\"\r\n#define NID_ecdsa_with_SHA224\t\t793\r\n#define OBJ_ecdsa_with_SHA224\t\tOBJ_ecdsa_with_Specified,1L\r\n\r\n#define SN_ecdsa_with_SHA256\t\t\"ecdsa-with-SHA256\"\r\n#define NID_ecdsa_with_SHA256\t\t794\r\n#define OBJ_ecdsa_with_SHA256\t\tOBJ_ecdsa_with_Specified,2L\r\n\r\n#define SN_ecdsa_with_SHA384\t\t\"ecdsa-with-SHA384\"\r\n#define NID_ecdsa_with_SHA384\t\t795\r\n#define OBJ_ecdsa_with_SHA384\t\tOBJ_ecdsa_with_Specified,3L\r\n\r\n#define SN_ecdsa_with_SHA512\t\t\"ecdsa-with-SHA512\"\r\n#define NID_ecdsa_with_SHA512\t\t796\r\n#define OBJ_ecdsa_with_SHA512\t\tOBJ_ecdsa_with_Specified,4L\r\n\r\n#define OBJ_secg_ellipticCurve\t\tOBJ_certicom_arc,0L\r\n\r\n#define SN_secp112r1\t\t\"secp112r1\"\r\n#define NID_secp112r1\t\t704\r\n#define OBJ_secp112r1\t\tOBJ_secg_ellipticCurve,6L\r\n\r\n#define SN_secp112r2\t\t\"secp112r2\"\r\n#define NID_secp112r2\t\t705\r\n#define OBJ_secp112r2\t\tOBJ_secg_ellipticCurve,7L\r\n\r\n#define SN_secp128r1\t\t\"secp128r1\"\r\n#define NID_secp128r1\t\t706\r\n#define OBJ_secp128r1\t\tOBJ_secg_ellipticCurve,28L\r\n\r\n#define SN_secp128r2\t\t\"secp128r2\"\r\n#define NID_secp128r2\t\t707\r\n#define OBJ_secp128r2\t\tOBJ_secg_ellipticCurve,29L\r\n\r\n#define SN_secp160k1\t\t\"secp160k1\"\r\n#define NID_secp160k1\t\t708\r\n#define OBJ_secp160k1\t\tOBJ_secg_ellipticCurve,9L\r\n\r\n#define SN_secp160r1\t\t\"secp160r1\"\r\n#define NID_secp160r1\t\t709\r\n#define OBJ_secp160r1\t\tOBJ_secg_ellipticCurve,8L\r\n\r\n#define SN_secp160r2\t\t\"secp160r2\"\r\n#define NID_secp160r2\t\t710\r\n#define OBJ_secp160r2\t\tOBJ_secg_ellipticCurve,30L\r\n\r\n#define SN_secp192k1\t\t\"secp192k1\"\r\n#define NID_secp192k1\t\t711\r\n#define OBJ_secp192k1\t\tOBJ_secg_ellipticCurve,31L\r\n\r\n#define SN_secp224k1\t\t\"secp224k1\"\r\n#define NID_secp224k1\t\t712\r\n#define OBJ_secp224k1\t\tOBJ_secg_ellipticCurve,32L\r\n\r\n#define SN_secp224r1\t\t\"secp224r1\"\r\n#define NID_secp224r1\t\t713\r\n#define OBJ_secp224r1\t\tOBJ_secg_ellipticCurve,33L\r\n\r\n#define SN_secp256k1\t\t\"secp256k1\"\r\n#define NID_secp256k1\t\t714\r\n#define OBJ_secp256k1\t\tOBJ_secg_ellipticCurve,10L\r\n\r\n#define SN_secp384r1\t\t\"secp384r1\"\r\n#define NID_secp384r1\t\t715\r\n#define OBJ_secp384r1\t\tOBJ_secg_ellipticCurve,34L\r\n\r\n#define SN_secp521r1\t\t\"secp521r1\"\r\n#define NID_secp521r1\t\t716\r\n#define OBJ_secp521r1\t\tOBJ_secg_ellipticCurve,35L\r\n\r\n#define SN_sect113r1\t\t\"sect113r1\"\r\n#define NID_sect113r1\t\t717\r\n#define OBJ_sect113r1\t\tOBJ_secg_ellipticCurve,4L\r\n\r\n#define SN_sect113r2\t\t\"sect113r2\"\r\n#define NID_sect113r2\t\t718\r\n#define OBJ_sect113r2\t\tOBJ_secg_ellipticCurve,5L\r\n\r\n#define SN_sect131r1\t\t\"sect131r1\"\r\n#define NID_sect131r1\t\t719\r\n#define OBJ_sect131r1\t\tOBJ_secg_ellipticCurve,22L\r\n\r\n#define SN_sect131r2\t\t\"sect131r2\"\r\n#define NID_sect131r2\t\t720\r\n#define OBJ_sect131r2\t\tOBJ_secg_ellipticCurve,23L\r\n\r\n#define SN_sect163k1\t\t\"sect163k1\"\r\n#define NID_sect163k1\t\t721\r\n#define OBJ_sect163k1\t\tOBJ_secg_ellipticCurve,1L\r\n\r\n#define SN_sect163r1\t\t\"sect163r1\"\r\n#define NID_sect163r1\t\t722\r\n#define OBJ_sect163r1\t\tOBJ_secg_ellipticCurve,2L\r\n\r\n#define SN_sect163r2\t\t\"sect163r2\"\r\n#define NID_sect163r2\t\t723\r\n#define OBJ_sect163r2\t\tOBJ_secg_ellipticCurve,15L\r\n\r\n#define SN_sect193r1\t\t\"sect193r1\"\r\n#define NID_sect193r1\t\t724\r\n#define OBJ_sect193r1\t\tOBJ_secg_ellipticCurve,24L\r\n\r\n#define SN_sect193r2\t\t\"sect193r2\"\r\n#define NID_sect193r2\t\t725\r\n#define OBJ_sect193r2\t\tOBJ_secg_ellipticCurve,25L\r\n\r\n#define SN_sect233k1\t\t\"sect233k1\"\r\n#define NID_sect233k1\t\t726\r\n#define OBJ_sect233k1\t\tOBJ_secg_ellipticCurve,26L\r\n\r\n#define SN_sect233r1\t\t\"sect233r1\"\r\n#define NID_sect233r1\t\t727\r\n#define OBJ_sect233r1\t\tOBJ_secg_ellipticCurve,27L\r\n\r\n#define SN_sect239k1\t\t\"sect239k1\"\r\n#define NID_sect239k1\t\t728\r\n#define OBJ_sect239k1\t\tOBJ_secg_ellipticCurve,3L\r\n\r\n#define SN_sect283k1\t\t\"sect283k1\"\r\n#define NID_sect283k1\t\t729\r\n#define OBJ_sect283k1\t\tOBJ_secg_ellipticCurve,16L\r\n\r\n#define SN_sect283r1\t\t\"sect283r1\"\r\n#define NID_sect283r1\t\t730\r\n#define OBJ_sect283r1\t\tOBJ_secg_ellipticCurve,17L\r\n\r\n#define SN_sect409k1\t\t\"sect409k1\"\r\n#define NID_sect409k1\t\t731\r\n#define OBJ_sect409k1\t\tOBJ_secg_ellipticCurve,36L\r\n\r\n#define SN_sect409r1\t\t\"sect409r1\"\r\n#define NID_sect409r1\t\t732\r\n#define OBJ_sect409r1\t\tOBJ_secg_ellipticCurve,37L\r\n\r\n#define SN_sect571k1\t\t\"sect571k1\"\r\n#define NID_sect571k1\t\t733\r\n#define OBJ_sect571k1\t\tOBJ_secg_ellipticCurve,38L\r\n\r\n#define SN_sect571r1\t\t\"sect571r1\"\r\n#define NID_sect571r1\t\t734\r\n#define OBJ_sect571r1\t\tOBJ_secg_ellipticCurve,39L\r\n\r\n#define OBJ_wap_wsg_idm_ecid\t\tOBJ_wap_wsg,4L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls1\t\t\"wap-wsg-idm-ecid-wtls1\"\r\n#define NID_wap_wsg_idm_ecid_wtls1\t\t735\r\n#define OBJ_wap_wsg_idm_ecid_wtls1\t\tOBJ_wap_wsg_idm_ecid,1L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls3\t\t\"wap-wsg-idm-ecid-wtls3\"\r\n#define NID_wap_wsg_idm_ecid_wtls3\t\t736\r\n#define OBJ_wap_wsg_idm_ecid_wtls3\t\tOBJ_wap_wsg_idm_ecid,3L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls4\t\t\"wap-wsg-idm-ecid-wtls4\"\r\n#define NID_wap_wsg_idm_ecid_wtls4\t\t737\r\n#define OBJ_wap_wsg_idm_ecid_wtls4\t\tOBJ_wap_wsg_idm_ecid,4L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls5\t\t\"wap-wsg-idm-ecid-wtls5\"\r\n#define NID_wap_wsg_idm_ecid_wtls5\t\t738\r\n#define OBJ_wap_wsg_idm_ecid_wtls5\t\tOBJ_wap_wsg_idm_ecid,5L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls6\t\t\"wap-wsg-idm-ecid-wtls6\"\r\n#define NID_wap_wsg_idm_ecid_wtls6\t\t739\r\n#define OBJ_wap_wsg_idm_ecid_wtls6\t\tOBJ_wap_wsg_idm_ecid,6L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls7\t\t\"wap-wsg-idm-ecid-wtls7\"\r\n#define NID_wap_wsg_idm_ecid_wtls7\t\t740\r\n#define OBJ_wap_wsg_idm_ecid_wtls7\t\tOBJ_wap_wsg_idm_ecid,7L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls8\t\t\"wap-wsg-idm-ecid-wtls8\"\r\n#define NID_wap_wsg_idm_ecid_wtls8\t\t741\r\n#define OBJ_wap_wsg_idm_ecid_wtls8\t\tOBJ_wap_wsg_idm_ecid,8L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls9\t\t\"wap-wsg-idm-ecid-wtls9\"\r\n#define NID_wap_wsg_idm_ecid_wtls9\t\t742\r\n#define OBJ_wap_wsg_idm_ecid_wtls9\t\tOBJ_wap_wsg_idm_ecid,9L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls10\t\t\"wap-wsg-idm-ecid-wtls10\"\r\n#define NID_wap_wsg_idm_ecid_wtls10\t\t743\r\n#define OBJ_wap_wsg_idm_ecid_wtls10\t\tOBJ_wap_wsg_idm_ecid,10L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls11\t\t\"wap-wsg-idm-ecid-wtls11\"\r\n#define NID_wap_wsg_idm_ecid_wtls11\t\t744\r\n#define OBJ_wap_wsg_idm_ecid_wtls11\t\tOBJ_wap_wsg_idm_ecid,11L\r\n\r\n#define SN_wap_wsg_idm_ecid_wtls12\t\t\"wap-wsg-idm-ecid-wtls12\"\r\n#define NID_wap_wsg_idm_ecid_wtls12\t\t745\r\n#define OBJ_wap_wsg_idm_ecid_wtls12\t\tOBJ_wap_wsg_idm_ecid,12L\r\n\r\n#define SN_cast5_cbc\t\t\"CAST5-CBC\"\r\n#define LN_cast5_cbc\t\t\"cast5-cbc\"\r\n#define NID_cast5_cbc\t\t108\r\n#define OBJ_cast5_cbc\t\tOBJ_ISO_US,113533L,7L,66L,10L\r\n\r\n#define SN_cast5_ecb\t\t\"CAST5-ECB\"\r\n#define LN_cast5_ecb\t\t\"cast5-ecb\"\r\n#define NID_cast5_ecb\t\t109\r\n\r\n#define SN_cast5_cfb64\t\t\"CAST5-CFB\"\r\n#define LN_cast5_cfb64\t\t\"cast5-cfb\"\r\n#define NID_cast5_cfb64\t\t110\r\n\r\n#define SN_cast5_ofb64\t\t\"CAST5-OFB\"\r\n#define LN_cast5_ofb64\t\t\"cast5-ofb\"\r\n#define NID_cast5_ofb64\t\t111\r\n\r\n#define LN_pbeWithMD5AndCast5_CBC\t\t\"pbeWithMD5AndCast5CBC\"\r\n#define NID_pbeWithMD5AndCast5_CBC\t\t112\r\n#define OBJ_pbeWithMD5AndCast5_CBC\t\tOBJ_ISO_US,113533L,7L,66L,12L\r\n\r\n#define SN_id_PasswordBasedMAC\t\t\"id-PasswordBasedMAC\"\r\n#define LN_id_PasswordBasedMAC\t\t\"password based MAC\"\r\n#define NID_id_PasswordBasedMAC\t\t782\r\n#define OBJ_id_PasswordBasedMAC\t\tOBJ_ISO_US,113533L,7L,66L,13L\r\n\r\n#define SN_id_DHBasedMac\t\t\"id-DHBasedMac\"\r\n#define LN_id_DHBasedMac\t\t\"Diffie-Hellman based MAC\"\r\n#define NID_id_DHBasedMac\t\t783\r\n#define OBJ_id_DHBasedMac\t\tOBJ_ISO_US,113533L,7L,66L,30L\r\n\r\n#define SN_rsadsi\t\t\"rsadsi\"\r\n#define LN_rsadsi\t\t\"RSA Data Security, Inc.\"\r\n#define NID_rsadsi\t\t1\r\n#define OBJ_rsadsi\t\tOBJ_ISO_US,113549L\r\n\r\n#define SN_pkcs\t\t\"pkcs\"\r\n#define LN_pkcs\t\t\"RSA Data Security, Inc. PKCS\"\r\n#define NID_pkcs\t\t2\r\n#define OBJ_pkcs\t\tOBJ_rsadsi,1L\r\n\r\n#define SN_pkcs1\t\t\"pkcs1\"\r\n#define NID_pkcs1\t\t186\r\n#define OBJ_pkcs1\t\tOBJ_pkcs,1L\r\n\r\n#define LN_rsaEncryption\t\t\"rsaEncryption\"\r\n#define NID_rsaEncryption\t\t6\r\n#define OBJ_rsaEncryption\t\tOBJ_pkcs1,1L\r\n\r\n#define SN_md2WithRSAEncryption\t\t\"RSA-MD2\"\r\n#define LN_md2WithRSAEncryption\t\t\"md2WithRSAEncryption\"\r\n#define NID_md2WithRSAEncryption\t\t7\r\n#define OBJ_md2WithRSAEncryption\t\tOBJ_pkcs1,2L\r\n\r\n#define SN_md4WithRSAEncryption\t\t\"RSA-MD4\"\r\n#define LN_md4WithRSAEncryption\t\t\"md4WithRSAEncryption\"\r\n#define NID_md4WithRSAEncryption\t\t396\r\n#define OBJ_md4WithRSAEncryption\t\tOBJ_pkcs1,3L\r\n\r\n#define SN_md5WithRSAEncryption\t\t\"RSA-MD5\"\r\n#define LN_md5WithRSAEncryption\t\t\"md5WithRSAEncryption\"\r\n#define NID_md5WithRSAEncryption\t\t8\r\n#define OBJ_md5WithRSAEncryption\t\tOBJ_pkcs1,4L\r\n\r\n#define SN_sha1WithRSAEncryption\t\t\"RSA-SHA1\"\r\n#define LN_sha1WithRSAEncryption\t\t\"sha1WithRSAEncryption\"\r\n#define NID_sha1WithRSAEncryption\t\t65\r\n#define OBJ_sha1WithRSAEncryption\t\tOBJ_pkcs1,5L\r\n\r\n#define SN_rsaesOaep\t\t\"RSAES-OAEP\"\r\n#define LN_rsaesOaep\t\t\"rsaesOaep\"\r\n#define NID_rsaesOaep\t\t919\r\n#define OBJ_rsaesOaep\t\tOBJ_pkcs1,7L\r\n\r\n#define SN_mgf1\t\t\"MGF1\"\r\n#define LN_mgf1\t\t\"mgf1\"\r\n#define NID_mgf1\t\t911\r\n#define OBJ_mgf1\t\tOBJ_pkcs1,8L\r\n\r\n#define SN_rsassaPss\t\t\"RSASSA-PSS\"\r\n#define LN_rsassaPss\t\t\"rsassaPss\"\r\n#define NID_rsassaPss\t\t912\r\n#define OBJ_rsassaPss\t\tOBJ_pkcs1,10L\r\n\r\n#define SN_sha256WithRSAEncryption\t\t\"RSA-SHA256\"\r\n#define LN_sha256WithRSAEncryption\t\t\"sha256WithRSAEncryption\"\r\n#define NID_sha256WithRSAEncryption\t\t668\r\n#define OBJ_sha256WithRSAEncryption\t\tOBJ_pkcs1,11L\r\n\r\n#define SN_sha384WithRSAEncryption\t\t\"RSA-SHA384\"\r\n#define LN_sha384WithRSAEncryption\t\t\"sha384WithRSAEncryption\"\r\n#define NID_sha384WithRSAEncryption\t\t669\r\n#define OBJ_sha384WithRSAEncryption\t\tOBJ_pkcs1,12L\r\n\r\n#define SN_sha512WithRSAEncryption\t\t\"RSA-SHA512\"\r\n#define LN_sha512WithRSAEncryption\t\t\"sha512WithRSAEncryption\"\r\n#define NID_sha512WithRSAEncryption\t\t670\r\n#define OBJ_sha512WithRSAEncryption\t\tOBJ_pkcs1,13L\r\n\r\n#define SN_sha224WithRSAEncryption\t\t\"RSA-SHA224\"\r\n#define LN_sha224WithRSAEncryption\t\t\"sha224WithRSAEncryption\"\r\n#define NID_sha224WithRSAEncryption\t\t671\r\n#define OBJ_sha224WithRSAEncryption\t\tOBJ_pkcs1,14L\r\n\r\n#define SN_pkcs3\t\t\"pkcs3\"\r\n#define NID_pkcs3\t\t27\r\n#define OBJ_pkcs3\t\tOBJ_pkcs,3L\r\n\r\n#define LN_dhKeyAgreement\t\t\"dhKeyAgreement\"\r\n#define NID_dhKeyAgreement\t\t28\r\n#define OBJ_dhKeyAgreement\t\tOBJ_pkcs3,1L\r\n\r\n#define SN_pkcs5\t\t\"pkcs5\"\r\n#define NID_pkcs5\t\t187\r\n#define OBJ_pkcs5\t\tOBJ_pkcs,5L\r\n\r\n#define SN_pbeWithMD2AndDES_CBC\t\t\"PBE-MD2-DES\"\r\n#define LN_pbeWithMD2AndDES_CBC\t\t\"pbeWithMD2AndDES-CBC\"\r\n#define NID_pbeWithMD2AndDES_CBC\t\t9\r\n#define OBJ_pbeWithMD2AndDES_CBC\t\tOBJ_pkcs5,1L\r\n\r\n#define SN_pbeWithMD5AndDES_CBC\t\t\"PBE-MD5-DES\"\r\n#define LN_pbeWithMD5AndDES_CBC\t\t\"pbeWithMD5AndDES-CBC\"\r\n#define NID_pbeWithMD5AndDES_CBC\t\t10\r\n#define OBJ_pbeWithMD5AndDES_CBC\t\tOBJ_pkcs5,3L\r\n\r\n#define SN_pbeWithMD2AndRC2_CBC\t\t\"PBE-MD2-RC2-64\"\r\n#define LN_pbeWithMD2AndRC2_CBC\t\t\"pbeWithMD2AndRC2-CBC\"\r\n#define NID_pbeWithMD2AndRC2_CBC\t\t168\r\n#define OBJ_pbeWithMD2AndRC2_CBC\t\tOBJ_pkcs5,4L\r\n\r\n#define SN_pbeWithMD5AndRC2_CBC\t\t\"PBE-MD5-RC2-64\"\r\n#define LN_pbeWithMD5AndRC2_CBC\t\t\"pbeWithMD5AndRC2-CBC\"\r\n#define NID_pbeWithMD5AndRC2_CBC\t\t169\r\n#define OBJ_pbeWithMD5AndRC2_CBC\t\tOBJ_pkcs5,6L\r\n\r\n#define SN_pbeWithSHA1AndDES_CBC\t\t\"PBE-SHA1-DES\"\r\n#define LN_pbeWithSHA1AndDES_CBC\t\t\"pbeWithSHA1AndDES-CBC\"\r\n#define NID_pbeWithSHA1AndDES_CBC\t\t170\r\n#define OBJ_pbeWithSHA1AndDES_CBC\t\tOBJ_pkcs5,10L\r\n\r\n#define SN_pbeWithSHA1AndRC2_CBC\t\t\"PBE-SHA1-RC2-64\"\r\n#define LN_pbeWithSHA1AndRC2_CBC\t\t\"pbeWithSHA1AndRC2-CBC\"\r\n#define NID_pbeWithSHA1AndRC2_CBC\t\t68\r\n#define OBJ_pbeWithSHA1AndRC2_CBC\t\tOBJ_pkcs5,11L\r\n\r\n#define LN_id_pbkdf2\t\t\"PBKDF2\"\r\n#define NID_id_pbkdf2\t\t69\r\n#define OBJ_id_pbkdf2\t\tOBJ_pkcs5,12L\r\n\r\n#define LN_pbes2\t\t\"PBES2\"\r\n#define NID_pbes2\t\t161\r\n#define OBJ_pbes2\t\tOBJ_pkcs5,13L\r\n\r\n#define LN_pbmac1\t\t\"PBMAC1\"\r\n#define NID_pbmac1\t\t162\r\n#define OBJ_pbmac1\t\tOBJ_pkcs5,14L\r\n\r\n#define SN_pkcs7\t\t\"pkcs7\"\r\n#define NID_pkcs7\t\t20\r\n#define OBJ_pkcs7\t\tOBJ_pkcs,7L\r\n\r\n#define LN_pkcs7_data\t\t\"pkcs7-data\"\r\n#define NID_pkcs7_data\t\t21\r\n#define OBJ_pkcs7_data\t\tOBJ_pkcs7,1L\r\n\r\n#define LN_pkcs7_signed\t\t\"pkcs7-signedData\"\r\n#define NID_pkcs7_signed\t\t22\r\n#define OBJ_pkcs7_signed\t\tOBJ_pkcs7,2L\r\n\r\n#define LN_pkcs7_enveloped\t\t\"pkcs7-envelopedData\"\r\n#define NID_pkcs7_enveloped\t\t23\r\n#define OBJ_pkcs7_enveloped\t\tOBJ_pkcs7,3L\r\n\r\n#define LN_pkcs7_signedAndEnveloped\t\t\"pkcs7-signedAndEnvelopedData\"\r\n#define NID_pkcs7_signedAndEnveloped\t\t24\r\n#define OBJ_pkcs7_signedAndEnveloped\t\tOBJ_pkcs7,4L\r\n\r\n#define LN_pkcs7_digest\t\t\"pkcs7-digestData\"\r\n#define NID_pkcs7_digest\t\t25\r\n#define OBJ_pkcs7_digest\t\tOBJ_pkcs7,5L\r\n\r\n#define LN_pkcs7_encrypted\t\t\"pkcs7-encryptedData\"\r\n#define NID_pkcs7_encrypted\t\t26\r\n#define OBJ_pkcs7_encrypted\t\tOBJ_pkcs7,6L\r\n\r\n#define SN_pkcs9\t\t\"pkcs9\"\r\n#define NID_pkcs9\t\t47\r\n#define OBJ_pkcs9\t\tOBJ_pkcs,9L\r\n\r\n#define LN_pkcs9_emailAddress\t\t\"emailAddress\"\r\n#define NID_pkcs9_emailAddress\t\t48\r\n#define OBJ_pkcs9_emailAddress\t\tOBJ_pkcs9,1L\r\n\r\n#define LN_pkcs9_unstructuredName\t\t\"unstructuredName\"\r\n#define NID_pkcs9_unstructuredName\t\t49\r\n#define OBJ_pkcs9_unstructuredName\t\tOBJ_pkcs9,2L\r\n\r\n#define LN_pkcs9_contentType\t\t\"contentType\"\r\n#define NID_pkcs9_contentType\t\t50\r\n#define OBJ_pkcs9_contentType\t\tOBJ_pkcs9,3L\r\n\r\n#define LN_pkcs9_messageDigest\t\t\"messageDigest\"\r\n#define NID_pkcs9_messageDigest\t\t51\r\n#define OBJ_pkcs9_messageDigest\t\tOBJ_pkcs9,4L\r\n\r\n#define LN_pkcs9_signingTime\t\t\"signingTime\"\r\n#define NID_pkcs9_signingTime\t\t52\r\n#define OBJ_pkcs9_signingTime\t\tOBJ_pkcs9,5L\r\n\r\n#define LN_pkcs9_countersignature\t\t\"countersignature\"\r\n#define NID_pkcs9_countersignature\t\t53\r\n#define OBJ_pkcs9_countersignature\t\tOBJ_pkcs9,6L\r\n\r\n#define LN_pkcs9_challengePassword\t\t\"challengePassword\"\r\n#define NID_pkcs9_challengePassword\t\t54\r\n#define OBJ_pkcs9_challengePassword\t\tOBJ_pkcs9,7L\r\n\r\n#define LN_pkcs9_unstructuredAddress\t\t\"unstructuredAddress\"\r\n#define NID_pkcs9_unstructuredAddress\t\t55\r\n#define OBJ_pkcs9_unstructuredAddress\t\tOBJ_pkcs9,8L\r\n\r\n#define LN_pkcs9_extCertAttributes\t\t\"extendedCertificateAttributes\"\r\n#define NID_pkcs9_extCertAttributes\t\t56\r\n#define OBJ_pkcs9_extCertAttributes\t\tOBJ_pkcs9,9L\r\n\r\n#define SN_ext_req\t\t\"extReq\"\r\n#define LN_ext_req\t\t\"Extension Request\"\r\n#define NID_ext_req\t\t172\r\n#define OBJ_ext_req\t\tOBJ_pkcs9,14L\r\n\r\n#define SN_SMIMECapabilities\t\t\"SMIME-CAPS\"\r\n#define LN_SMIMECapabilities\t\t\"S/MIME Capabilities\"\r\n#define NID_SMIMECapabilities\t\t167\r\n#define OBJ_SMIMECapabilities\t\tOBJ_pkcs9,15L\r\n\r\n#define SN_SMIME\t\t\"SMIME\"\r\n#define LN_SMIME\t\t\"S/MIME\"\r\n#define NID_SMIME\t\t188\r\n#define OBJ_SMIME\t\tOBJ_pkcs9,16L\r\n\r\n#define SN_id_smime_mod\t\t\"id-smime-mod\"\r\n#define NID_id_smime_mod\t\t189\r\n#define OBJ_id_smime_mod\t\tOBJ_SMIME,0L\r\n\r\n#define SN_id_smime_ct\t\t\"id-smime-ct\"\r\n#define NID_id_smime_ct\t\t190\r\n#define OBJ_id_smime_ct\t\tOBJ_SMIME,1L\r\n\r\n#define SN_id_smime_aa\t\t\"id-smime-aa\"\r\n#define NID_id_smime_aa\t\t191\r\n#define OBJ_id_smime_aa\t\tOBJ_SMIME,2L\r\n\r\n#define SN_id_smime_alg\t\t\"id-smime-alg\"\r\n#define NID_id_smime_alg\t\t192\r\n#define OBJ_id_smime_alg\t\tOBJ_SMIME,3L\r\n\r\n#define SN_id_smime_cd\t\t\"id-smime-cd\"\r\n#define NID_id_smime_cd\t\t193\r\n#define OBJ_id_smime_cd\t\tOBJ_SMIME,4L\r\n\r\n#define SN_id_smime_spq\t\t\"id-smime-spq\"\r\n#define NID_id_smime_spq\t\t194\r\n#define OBJ_id_smime_spq\t\tOBJ_SMIME,5L\r\n\r\n#define SN_id_smime_cti\t\t\"id-smime-cti\"\r\n#define NID_id_smime_cti\t\t195\r\n#define OBJ_id_smime_cti\t\tOBJ_SMIME,6L\r\n\r\n#define SN_id_smime_mod_cms\t\t\"id-smime-mod-cms\"\r\n#define NID_id_smime_mod_cms\t\t196\r\n#define OBJ_id_smime_mod_cms\t\tOBJ_id_smime_mod,1L\r\n\r\n#define SN_id_smime_mod_ess\t\t\"id-smime-mod-ess\"\r\n#define NID_id_smime_mod_ess\t\t197\r\n#define OBJ_id_smime_mod_ess\t\tOBJ_id_smime_mod,2L\r\n\r\n#define SN_id_smime_mod_oid\t\t\"id-smime-mod-oid\"\r\n#define NID_id_smime_mod_oid\t\t198\r\n#define OBJ_id_smime_mod_oid\t\tOBJ_id_smime_mod,3L\r\n\r\n#define SN_id_smime_mod_msg_v3\t\t\"id-smime-mod-msg-v3\"\r\n#define NID_id_smime_mod_msg_v3\t\t199\r\n#define OBJ_id_smime_mod_msg_v3\t\tOBJ_id_smime_mod,4L\r\n\r\n#define SN_id_smime_mod_ets_eSignature_88\t\t\"id-smime-mod-ets-eSignature-88\"\r\n#define NID_id_smime_mod_ets_eSignature_88\t\t200\r\n#define OBJ_id_smime_mod_ets_eSignature_88\t\tOBJ_id_smime_mod,5L\r\n\r\n#define SN_id_smime_mod_ets_eSignature_97\t\t\"id-smime-mod-ets-eSignature-97\"\r\n#define NID_id_smime_mod_ets_eSignature_97\t\t201\r\n#define OBJ_id_smime_mod_ets_eSignature_97\t\tOBJ_id_smime_mod,6L\r\n\r\n#define SN_id_smime_mod_ets_eSigPolicy_88\t\t\"id-smime-mod-ets-eSigPolicy-88\"\r\n#define NID_id_smime_mod_ets_eSigPolicy_88\t\t202\r\n#define OBJ_id_smime_mod_ets_eSigPolicy_88\t\tOBJ_id_smime_mod,7L\r\n\r\n#define SN_id_smime_mod_ets_eSigPolicy_97\t\t\"id-smime-mod-ets-eSigPolicy-97\"\r\n#define NID_id_smime_mod_ets_eSigPolicy_97\t\t203\r\n#define OBJ_id_smime_mod_ets_eSigPolicy_97\t\tOBJ_id_smime_mod,8L\r\n\r\n#define SN_id_smime_ct_receipt\t\t\"id-smime-ct-receipt\"\r\n#define NID_id_smime_ct_receipt\t\t204\r\n#define OBJ_id_smime_ct_receipt\t\tOBJ_id_smime_ct,1L\r\n\r\n#define SN_id_smime_ct_authData\t\t\"id-smime-ct-authData\"\r\n#define NID_id_smime_ct_authData\t\t205\r\n#define OBJ_id_smime_ct_authData\t\tOBJ_id_smime_ct,2L\r\n\r\n#define SN_id_smime_ct_publishCert\t\t\"id-smime-ct-publishCert\"\r\n#define NID_id_smime_ct_publishCert\t\t206\r\n#define OBJ_id_smime_ct_publishCert\t\tOBJ_id_smime_ct,3L\r\n\r\n#define SN_id_smime_ct_TSTInfo\t\t\"id-smime-ct-TSTInfo\"\r\n#define NID_id_smime_ct_TSTInfo\t\t207\r\n#define OBJ_id_smime_ct_TSTInfo\t\tOBJ_id_smime_ct,4L\r\n\r\n#define SN_id_smime_ct_TDTInfo\t\t\"id-smime-ct-TDTInfo\"\r\n#define NID_id_smime_ct_TDTInfo\t\t208\r\n#define OBJ_id_smime_ct_TDTInfo\t\tOBJ_id_smime_ct,5L\r\n\r\n#define SN_id_smime_ct_contentInfo\t\t\"id-smime-ct-contentInfo\"\r\n#define NID_id_smime_ct_contentInfo\t\t209\r\n#define OBJ_id_smime_ct_contentInfo\t\tOBJ_id_smime_ct,6L\r\n\r\n#define SN_id_smime_ct_DVCSRequestData\t\t\"id-smime-ct-DVCSRequestData\"\r\n#define NID_id_smime_ct_DVCSRequestData\t\t210\r\n#define OBJ_id_smime_ct_DVCSRequestData\t\tOBJ_id_smime_ct,7L\r\n\r\n#define SN_id_smime_ct_DVCSResponseData\t\t\"id-smime-ct-DVCSResponseData\"\r\n#define NID_id_smime_ct_DVCSResponseData\t\t211\r\n#define OBJ_id_smime_ct_DVCSResponseData\t\tOBJ_id_smime_ct,8L\r\n\r\n#define SN_id_smime_ct_compressedData\t\t\"id-smime-ct-compressedData\"\r\n#define NID_id_smime_ct_compressedData\t\t786\r\n#define OBJ_id_smime_ct_compressedData\t\tOBJ_id_smime_ct,9L\r\n\r\n#define SN_id_ct_asciiTextWithCRLF\t\t\"id-ct-asciiTextWithCRLF\"\r\n#define NID_id_ct_asciiTextWithCRLF\t\t787\r\n#define OBJ_id_ct_asciiTextWithCRLF\t\tOBJ_id_smime_ct,27L\r\n\r\n#define SN_id_smime_aa_receiptRequest\t\t\"id-smime-aa-receiptRequest\"\r\n#define NID_id_smime_aa_receiptRequest\t\t212\r\n#define OBJ_id_smime_aa_receiptRequest\t\tOBJ_id_smime_aa,1L\r\n\r\n#define SN_id_smime_aa_securityLabel\t\t\"id-smime-aa-securityLabel\"\r\n#define NID_id_smime_aa_securityLabel\t\t213\r\n#define OBJ_id_smime_aa_securityLabel\t\tOBJ_id_smime_aa,2L\r\n\r\n#define SN_id_smime_aa_mlExpandHistory\t\t\"id-smime-aa-mlExpandHistory\"\r\n#define NID_id_smime_aa_mlExpandHistory\t\t214\r\n#define OBJ_id_smime_aa_mlExpandHistory\t\tOBJ_id_smime_aa,3L\r\n\r\n#define SN_id_smime_aa_contentHint\t\t\"id-smime-aa-contentHint\"\r\n#define NID_id_smime_aa_contentHint\t\t215\r\n#define OBJ_id_smime_aa_contentHint\t\tOBJ_id_smime_aa,4L\r\n\r\n#define SN_id_smime_aa_msgSigDigest\t\t\"id-smime-aa-msgSigDigest\"\r\n#define NID_id_smime_aa_msgSigDigest\t\t216\r\n#define OBJ_id_smime_aa_msgSigDigest\t\tOBJ_id_smime_aa,5L\r\n\r\n#define SN_id_smime_aa_encapContentType\t\t\"id-smime-aa-encapContentType\"\r\n#define NID_id_smime_aa_encapContentType\t\t217\r\n#define OBJ_id_smime_aa_encapContentType\t\tOBJ_id_smime_aa,6L\r\n\r\n#define SN_id_smime_aa_contentIdentifier\t\t\"id-smime-aa-contentIdentifier\"\r\n#define NID_id_smime_aa_contentIdentifier\t\t218\r\n#define OBJ_id_smime_aa_contentIdentifier\t\tOBJ_id_smime_aa,7L\r\n\r\n#define SN_id_smime_aa_macValue\t\t\"id-smime-aa-macValue\"\r\n#define NID_id_smime_aa_macValue\t\t219\r\n#define OBJ_id_smime_aa_macValue\t\tOBJ_id_smime_aa,8L\r\n\r\n#define SN_id_smime_aa_equivalentLabels\t\t\"id-smime-aa-equivalentLabels\"\r\n#define NID_id_smime_aa_equivalentLabels\t\t220\r\n#define OBJ_id_smime_aa_equivalentLabels\t\tOBJ_id_smime_aa,9L\r\n\r\n#define SN_id_smime_aa_contentReference\t\t\"id-smime-aa-contentReference\"\r\n#define NID_id_smime_aa_contentReference\t\t221\r\n#define OBJ_id_smime_aa_contentReference\t\tOBJ_id_smime_aa,10L\r\n\r\n#define SN_id_smime_aa_encrypKeyPref\t\t\"id-smime-aa-encrypKeyPref\"\r\n#define NID_id_smime_aa_encrypKeyPref\t\t222\r\n#define OBJ_id_smime_aa_encrypKeyPref\t\tOBJ_id_smime_aa,11L\r\n\r\n#define SN_id_smime_aa_signingCertificate\t\t\"id-smime-aa-signingCertificate\"\r\n#define NID_id_smime_aa_signingCertificate\t\t223\r\n#define OBJ_id_smime_aa_signingCertificate\t\tOBJ_id_smime_aa,12L\r\n\r\n#define SN_id_smime_aa_smimeEncryptCerts\t\t\"id-smime-aa-smimeEncryptCerts\"\r\n#define NID_id_smime_aa_smimeEncryptCerts\t\t224\r\n#define OBJ_id_smime_aa_smimeEncryptCerts\t\tOBJ_id_smime_aa,13L\r\n\r\n#define SN_id_smime_aa_timeStampToken\t\t\"id-smime-aa-timeStampToken\"\r\n#define NID_id_smime_aa_timeStampToken\t\t225\r\n#define OBJ_id_smime_aa_timeStampToken\t\tOBJ_id_smime_aa,14L\r\n\r\n#define SN_id_smime_aa_ets_sigPolicyId\t\t\"id-smime-aa-ets-sigPolicyId\"\r\n#define NID_id_smime_aa_ets_sigPolicyId\t\t226\r\n#define OBJ_id_smime_aa_ets_sigPolicyId\t\tOBJ_id_smime_aa,15L\r\n\r\n#define SN_id_smime_aa_ets_commitmentType\t\t\"id-smime-aa-ets-commitmentType\"\r\n#define NID_id_smime_aa_ets_commitmentType\t\t227\r\n#define OBJ_id_smime_aa_ets_commitmentType\t\tOBJ_id_smime_aa,16L\r\n\r\n#define SN_id_smime_aa_ets_signerLocation\t\t\"id-smime-aa-ets-signerLocation\"\r\n#define NID_id_smime_aa_ets_signerLocation\t\t228\r\n#define OBJ_id_smime_aa_ets_signerLocation\t\tOBJ_id_smime_aa,17L\r\n\r\n#define SN_id_smime_aa_ets_signerAttr\t\t\"id-smime-aa-ets-signerAttr\"\r\n#define NID_id_smime_aa_ets_signerAttr\t\t229\r\n#define OBJ_id_smime_aa_ets_signerAttr\t\tOBJ_id_smime_aa,18L\r\n\r\n#define SN_id_smime_aa_ets_otherSigCert\t\t\"id-smime-aa-ets-otherSigCert\"\r\n#define NID_id_smime_aa_ets_otherSigCert\t\t230\r\n#define OBJ_id_smime_aa_ets_otherSigCert\t\tOBJ_id_smime_aa,19L\r\n\r\n#define SN_id_smime_aa_ets_contentTimestamp\t\t\"id-smime-aa-ets-contentTimestamp\"\r\n#define NID_id_smime_aa_ets_contentTimestamp\t\t231\r\n#define OBJ_id_smime_aa_ets_contentTimestamp\t\tOBJ_id_smime_aa,20L\r\n\r\n#define SN_id_smime_aa_ets_CertificateRefs\t\t\"id-smime-aa-ets-CertificateRefs\"\r\n#define NID_id_smime_aa_ets_CertificateRefs\t\t232\r\n#define OBJ_id_smime_aa_ets_CertificateRefs\t\tOBJ_id_smime_aa,21L\r\n\r\n#define SN_id_smime_aa_ets_RevocationRefs\t\t\"id-smime-aa-ets-RevocationRefs\"\r\n#define NID_id_smime_aa_ets_RevocationRefs\t\t233\r\n#define OBJ_id_smime_aa_ets_RevocationRefs\t\tOBJ_id_smime_aa,22L\r\n\r\n#define SN_id_smime_aa_ets_certValues\t\t\"id-smime-aa-ets-certValues\"\r\n#define NID_id_smime_aa_ets_certValues\t\t234\r\n#define OBJ_id_smime_aa_ets_certValues\t\tOBJ_id_smime_aa,23L\r\n\r\n#define SN_id_smime_aa_ets_revocationValues\t\t\"id-smime-aa-ets-revocationValues\"\r\n#define NID_id_smime_aa_ets_revocationValues\t\t235\r\n#define OBJ_id_smime_aa_ets_revocationValues\t\tOBJ_id_smime_aa,24L\r\n\r\n#define SN_id_smime_aa_ets_escTimeStamp\t\t\"id-smime-aa-ets-escTimeStamp\"\r\n#define NID_id_smime_aa_ets_escTimeStamp\t\t236\r\n#define OBJ_id_smime_aa_ets_escTimeStamp\t\tOBJ_id_smime_aa,25L\r\n\r\n#define SN_id_smime_aa_ets_certCRLTimestamp\t\t\"id-smime-aa-ets-certCRLTimestamp\"\r\n#define NID_id_smime_aa_ets_certCRLTimestamp\t\t237\r\n#define OBJ_id_smime_aa_ets_certCRLTimestamp\t\tOBJ_id_smime_aa,26L\r\n\r\n#define SN_id_smime_aa_ets_archiveTimeStamp\t\t\"id-smime-aa-ets-archiveTimeStamp\"\r\n#define NID_id_smime_aa_ets_archiveTimeStamp\t\t238\r\n#define OBJ_id_smime_aa_ets_archiveTimeStamp\t\tOBJ_id_smime_aa,27L\r\n\r\n#define SN_id_smime_aa_signatureType\t\t\"id-smime-aa-signatureType\"\r\n#define NID_id_smime_aa_signatureType\t\t239\r\n#define OBJ_id_smime_aa_signatureType\t\tOBJ_id_smime_aa,28L\r\n\r\n#define SN_id_smime_aa_dvcs_dvc\t\t\"id-smime-aa-dvcs-dvc\"\r\n#define NID_id_smime_aa_dvcs_dvc\t\t240\r\n#define OBJ_id_smime_aa_dvcs_dvc\t\tOBJ_id_smime_aa,29L\r\n\r\n#define SN_id_smime_alg_ESDHwith3DES\t\t\"id-smime-alg-ESDHwith3DES\"\r\n#define NID_id_smime_alg_ESDHwith3DES\t\t241\r\n#define OBJ_id_smime_alg_ESDHwith3DES\t\tOBJ_id_smime_alg,1L\r\n\r\n#define SN_id_smime_alg_ESDHwithRC2\t\t\"id-smime-alg-ESDHwithRC2\"\r\n#define NID_id_smime_alg_ESDHwithRC2\t\t242\r\n#define OBJ_id_smime_alg_ESDHwithRC2\t\tOBJ_id_smime_alg,2L\r\n\r\n#define SN_id_smime_alg_3DESwrap\t\t\"id-smime-alg-3DESwrap\"\r\n#define NID_id_smime_alg_3DESwrap\t\t243\r\n#define OBJ_id_smime_alg_3DESwrap\t\tOBJ_id_smime_alg,3L\r\n\r\n#define SN_id_smime_alg_RC2wrap\t\t\"id-smime-alg-RC2wrap\"\r\n#define NID_id_smime_alg_RC2wrap\t\t244\r\n#define OBJ_id_smime_alg_RC2wrap\t\tOBJ_id_smime_alg,4L\r\n\r\n#define SN_id_smime_alg_ESDH\t\t\"id-smime-alg-ESDH\"\r\n#define NID_id_smime_alg_ESDH\t\t245\r\n#define OBJ_id_smime_alg_ESDH\t\tOBJ_id_smime_alg,5L\r\n\r\n#define SN_id_smime_alg_CMS3DESwrap\t\t\"id-smime-alg-CMS3DESwrap\"\r\n#define NID_id_smime_alg_CMS3DESwrap\t\t246\r\n#define OBJ_id_smime_alg_CMS3DESwrap\t\tOBJ_id_smime_alg,6L\r\n\r\n#define SN_id_smime_alg_CMSRC2wrap\t\t\"id-smime-alg-CMSRC2wrap\"\r\n#define NID_id_smime_alg_CMSRC2wrap\t\t247\r\n#define OBJ_id_smime_alg_CMSRC2wrap\t\tOBJ_id_smime_alg,7L\r\n\r\n#define SN_id_alg_PWRI_KEK\t\t\"id-alg-PWRI-KEK\"\r\n#define NID_id_alg_PWRI_KEK\t\t893\r\n#define OBJ_id_alg_PWRI_KEK\t\tOBJ_id_smime_alg,9L\r\n\r\n#define SN_id_smime_cd_ldap\t\t\"id-smime-cd-ldap\"\r\n#define NID_id_smime_cd_ldap\t\t248\r\n#define OBJ_id_smime_cd_ldap\t\tOBJ_id_smime_cd,1L\r\n\r\n#define SN_id_smime_spq_ets_sqt_uri\t\t\"id-smime-spq-ets-sqt-uri\"\r\n#define NID_id_smime_spq_ets_sqt_uri\t\t249\r\n#define OBJ_id_smime_spq_ets_sqt_uri\t\tOBJ_id_smime_spq,1L\r\n\r\n#define SN_id_smime_spq_ets_sqt_unotice\t\t\"id-smime-spq-ets-sqt-unotice\"\r\n#define NID_id_smime_spq_ets_sqt_unotice\t\t250\r\n#define OBJ_id_smime_spq_ets_sqt_unotice\t\tOBJ_id_smime_spq,2L\r\n\r\n#define SN_id_smime_cti_ets_proofOfOrigin\t\t\"id-smime-cti-ets-proofOfOrigin\"\r\n#define NID_id_smime_cti_ets_proofOfOrigin\t\t251\r\n#define OBJ_id_smime_cti_ets_proofOfOrigin\t\tOBJ_id_smime_cti,1L\r\n\r\n#define SN_id_smime_cti_ets_proofOfReceipt\t\t\"id-smime-cti-ets-proofOfReceipt\"\r\n#define NID_id_smime_cti_ets_proofOfReceipt\t\t252\r\n#define OBJ_id_smime_cti_ets_proofOfReceipt\t\tOBJ_id_smime_cti,2L\r\n\r\n#define SN_id_smime_cti_ets_proofOfDelivery\t\t\"id-smime-cti-ets-proofOfDelivery\"\r\n#define NID_id_smime_cti_ets_proofOfDelivery\t\t253\r\n#define OBJ_id_smime_cti_ets_proofOfDelivery\t\tOBJ_id_smime_cti,3L\r\n\r\n#define SN_id_smime_cti_ets_proofOfSender\t\t\"id-smime-cti-ets-proofOfSender\"\r\n#define NID_id_smime_cti_ets_proofOfSender\t\t254\r\n#define OBJ_id_smime_cti_ets_proofOfSender\t\tOBJ_id_smime_cti,4L\r\n\r\n#define SN_id_smime_cti_ets_proofOfApproval\t\t\"id-smime-cti-ets-proofOfApproval\"\r\n#define NID_id_smime_cti_ets_proofOfApproval\t\t255\r\n#define OBJ_id_smime_cti_ets_proofOfApproval\t\tOBJ_id_smime_cti,5L\r\n\r\n#define SN_id_smime_cti_ets_proofOfCreation\t\t\"id-smime-cti-ets-proofOfCreation\"\r\n#define NID_id_smime_cti_ets_proofOfCreation\t\t256\r\n#define OBJ_id_smime_cti_ets_proofOfCreation\t\tOBJ_id_smime_cti,6L\r\n\r\n#define LN_friendlyName\t\t\"friendlyName\"\r\n#define NID_friendlyName\t\t156\r\n#define OBJ_friendlyName\t\tOBJ_pkcs9,20L\r\n\r\n#define LN_localKeyID\t\t\"localKeyID\"\r\n#define NID_localKeyID\t\t157\r\n#define OBJ_localKeyID\t\tOBJ_pkcs9,21L\r\n\r\n#define SN_ms_csp_name\t\t\"CSPName\"\r\n#define LN_ms_csp_name\t\t\"Microsoft CSP Name\"\r\n#define NID_ms_csp_name\t\t417\r\n#define OBJ_ms_csp_name\t\t1L,3L,6L,1L,4L,1L,311L,17L,1L\r\n\r\n#define SN_LocalKeySet\t\t\"LocalKeySet\"\r\n#define LN_LocalKeySet\t\t\"Microsoft Local Key set\"\r\n#define NID_LocalKeySet\t\t856\r\n#define OBJ_LocalKeySet\t\t1L,3L,6L,1L,4L,1L,311L,17L,2L\r\n\r\n#define OBJ_certTypes\t\tOBJ_pkcs9,22L\r\n\r\n#define LN_x509Certificate\t\t\"x509Certificate\"\r\n#define NID_x509Certificate\t\t158\r\n#define OBJ_x509Certificate\t\tOBJ_certTypes,1L\r\n\r\n#define LN_sdsiCertificate\t\t\"sdsiCertificate\"\r\n#define NID_sdsiCertificate\t\t159\r\n#define OBJ_sdsiCertificate\t\tOBJ_certTypes,2L\r\n\r\n#define OBJ_crlTypes\t\tOBJ_pkcs9,23L\r\n\r\n#define LN_x509Crl\t\t\"x509Crl\"\r\n#define NID_x509Crl\t\t160\r\n#define OBJ_x509Crl\t\tOBJ_crlTypes,1L\r\n\r\n#define OBJ_pkcs12\t\tOBJ_pkcs,12L\r\n\r\n#define OBJ_pkcs12_pbeids\t\tOBJ_pkcs12,1L\r\n\r\n#define SN_pbe_WithSHA1And128BitRC4\t\t\"PBE-SHA1-RC4-128\"\r\n#define LN_pbe_WithSHA1And128BitRC4\t\t\"pbeWithSHA1And128BitRC4\"\r\n#define NID_pbe_WithSHA1And128BitRC4\t\t144\r\n#define OBJ_pbe_WithSHA1And128BitRC4\t\tOBJ_pkcs12_pbeids,1L\r\n\r\n#define SN_pbe_WithSHA1And40BitRC4\t\t\"PBE-SHA1-RC4-40\"\r\n#define LN_pbe_WithSHA1And40BitRC4\t\t\"pbeWithSHA1And40BitRC4\"\r\n#define NID_pbe_WithSHA1And40BitRC4\t\t145\r\n#define OBJ_pbe_WithSHA1And40BitRC4\t\tOBJ_pkcs12_pbeids,2L\r\n\r\n#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\t\"PBE-SHA1-3DES\"\r\n#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\t\"pbeWithSHA1And3-KeyTripleDES-CBC\"\r\n#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC\t\t146\r\n#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC\t\tOBJ_pkcs12_pbeids,3L\r\n\r\n#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\t\"PBE-SHA1-2DES\"\r\n#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\t\"pbeWithSHA1And2-KeyTripleDES-CBC\"\r\n#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC\t\t147\r\n#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC\t\tOBJ_pkcs12_pbeids,4L\r\n\r\n#define SN_pbe_WithSHA1And128BitRC2_CBC\t\t\"PBE-SHA1-RC2-128\"\r\n#define LN_pbe_WithSHA1And128BitRC2_CBC\t\t\"pbeWithSHA1And128BitRC2-CBC\"\r\n#define NID_pbe_WithSHA1And128BitRC2_CBC\t\t148\r\n#define OBJ_pbe_WithSHA1And128BitRC2_CBC\t\tOBJ_pkcs12_pbeids,5L\r\n\r\n#define SN_pbe_WithSHA1And40BitRC2_CBC\t\t\"PBE-SHA1-RC2-40\"\r\n#define LN_pbe_WithSHA1And40BitRC2_CBC\t\t\"pbeWithSHA1And40BitRC2-CBC\"\r\n#define NID_pbe_WithSHA1And40BitRC2_CBC\t\t149\r\n#define OBJ_pbe_WithSHA1And40BitRC2_CBC\t\tOBJ_pkcs12_pbeids,6L\r\n\r\n#define OBJ_pkcs12_Version1\t\tOBJ_pkcs12,10L\r\n\r\n#define OBJ_pkcs12_BagIds\t\tOBJ_pkcs12_Version1,1L\r\n\r\n#define LN_keyBag\t\t\"keyBag\"\r\n#define NID_keyBag\t\t150\r\n#define OBJ_keyBag\t\tOBJ_pkcs12_BagIds,1L\r\n\r\n#define LN_pkcs8ShroudedKeyBag\t\t\"pkcs8ShroudedKeyBag\"\r\n#define NID_pkcs8ShroudedKeyBag\t\t151\r\n#define OBJ_pkcs8ShroudedKeyBag\t\tOBJ_pkcs12_BagIds,2L\r\n\r\n#define LN_certBag\t\t\"certBag\"\r\n#define NID_certBag\t\t152\r\n#define OBJ_certBag\t\tOBJ_pkcs12_BagIds,3L\r\n\r\n#define LN_crlBag\t\t\"crlBag\"\r\n#define NID_crlBag\t\t153\r\n#define OBJ_crlBag\t\tOBJ_pkcs12_BagIds,4L\r\n\r\n#define LN_secretBag\t\t\"secretBag\"\r\n#define NID_secretBag\t\t154\r\n#define OBJ_secretBag\t\tOBJ_pkcs12_BagIds,5L\r\n\r\n#define LN_safeContentsBag\t\t\"safeContentsBag\"\r\n#define NID_safeContentsBag\t\t155\r\n#define OBJ_safeContentsBag\t\tOBJ_pkcs12_BagIds,6L\r\n\r\n#define SN_md2\t\t\"MD2\"\r\n#define LN_md2\t\t\"md2\"\r\n#define NID_md2\t\t3\r\n#define OBJ_md2\t\tOBJ_rsadsi,2L,2L\r\n\r\n#define SN_md4\t\t\"MD4\"\r\n#define LN_md4\t\t\"md4\"\r\n#define NID_md4\t\t257\r\n#define OBJ_md4\t\tOBJ_rsadsi,2L,4L\r\n\r\n#define SN_md5\t\t\"MD5\"\r\n#define LN_md5\t\t\"md5\"\r\n#define NID_md5\t\t4\r\n#define OBJ_md5\t\tOBJ_rsadsi,2L,5L\r\n\r\n#define SN_md5_sha1\t\t\"MD5-SHA1\"\r\n#define LN_md5_sha1\t\t\"md5-sha1\"\r\n#define NID_md5_sha1\t\t114\r\n\r\n#define LN_hmacWithMD5\t\t\"hmacWithMD5\"\r\n#define NID_hmacWithMD5\t\t797\r\n#define OBJ_hmacWithMD5\t\tOBJ_rsadsi,2L,6L\r\n\r\n#define LN_hmacWithSHA1\t\t\"hmacWithSHA1\"\r\n#define NID_hmacWithSHA1\t\t163\r\n#define OBJ_hmacWithSHA1\t\tOBJ_rsadsi,2L,7L\r\n\r\n#define LN_hmacWithSHA224\t\t\"hmacWithSHA224\"\r\n#define NID_hmacWithSHA224\t\t798\r\n#define OBJ_hmacWithSHA224\t\tOBJ_rsadsi,2L,8L\r\n\r\n#define LN_hmacWithSHA256\t\t\"hmacWithSHA256\"\r\n#define NID_hmacWithSHA256\t\t799\r\n#define OBJ_hmacWithSHA256\t\tOBJ_rsadsi,2L,9L\r\n\r\n#define LN_hmacWithSHA384\t\t\"hmacWithSHA384\"\r\n#define NID_hmacWithSHA384\t\t800\r\n#define OBJ_hmacWithSHA384\t\tOBJ_rsadsi,2L,10L\r\n\r\n#define LN_hmacWithSHA512\t\t\"hmacWithSHA512\"\r\n#define NID_hmacWithSHA512\t\t801\r\n#define OBJ_hmacWithSHA512\t\tOBJ_rsadsi,2L,11L\r\n\r\n#define SN_rc2_cbc\t\t\"RC2-CBC\"\r\n#define LN_rc2_cbc\t\t\"rc2-cbc\"\r\n#define NID_rc2_cbc\t\t37\r\n#define OBJ_rc2_cbc\t\tOBJ_rsadsi,3L,2L\r\n\r\n#define SN_rc2_ecb\t\t\"RC2-ECB\"\r\n#define LN_rc2_ecb\t\t\"rc2-ecb\"\r\n#define NID_rc2_ecb\t\t38\r\n\r\n#define SN_rc2_cfb64\t\t\"RC2-CFB\"\r\n#define LN_rc2_cfb64\t\t\"rc2-cfb\"\r\n#define NID_rc2_cfb64\t\t39\r\n\r\n#define SN_rc2_ofb64\t\t\"RC2-OFB\"\r\n#define LN_rc2_ofb64\t\t\"rc2-ofb\"\r\n#define NID_rc2_ofb64\t\t40\r\n\r\n#define SN_rc2_40_cbc\t\t\"RC2-40-CBC\"\r\n#define LN_rc2_40_cbc\t\t\"rc2-40-cbc\"\r\n#define NID_rc2_40_cbc\t\t98\r\n\r\n#define SN_rc2_64_cbc\t\t\"RC2-64-CBC\"\r\n#define LN_rc2_64_cbc\t\t\"rc2-64-cbc\"\r\n#define NID_rc2_64_cbc\t\t166\r\n\r\n#define SN_rc4\t\t\"RC4\"\r\n#define LN_rc4\t\t\"rc4\"\r\n#define NID_rc4\t\t5\r\n#define OBJ_rc4\t\tOBJ_rsadsi,3L,4L\r\n\r\n#define SN_rc4_40\t\t\"RC4-40\"\r\n#define LN_rc4_40\t\t\"rc4-40\"\r\n#define NID_rc4_40\t\t97\r\n\r\n#define SN_des_ede3_cbc\t\t\"DES-EDE3-CBC\"\r\n#define LN_des_ede3_cbc\t\t\"des-ede3-cbc\"\r\n#define NID_des_ede3_cbc\t\t44\r\n#define OBJ_des_ede3_cbc\t\tOBJ_rsadsi,3L,7L\r\n\r\n#define SN_rc5_cbc\t\t\"RC5-CBC\"\r\n#define LN_rc5_cbc\t\t\"rc5-cbc\"\r\n#define NID_rc5_cbc\t\t120\r\n#define OBJ_rc5_cbc\t\tOBJ_rsadsi,3L,8L\r\n\r\n#define SN_rc5_ecb\t\t\"RC5-ECB\"\r\n#define LN_rc5_ecb\t\t\"rc5-ecb\"\r\n#define NID_rc5_ecb\t\t121\r\n\r\n#define SN_rc5_cfb64\t\t\"RC5-CFB\"\r\n#define LN_rc5_cfb64\t\t\"rc5-cfb\"\r\n#define NID_rc5_cfb64\t\t122\r\n\r\n#define SN_rc5_ofb64\t\t\"RC5-OFB\"\r\n#define LN_rc5_ofb64\t\t\"rc5-ofb\"\r\n#define NID_rc5_ofb64\t\t123\r\n\r\n#define SN_ms_ext_req\t\t\"msExtReq\"\r\n#define LN_ms_ext_req\t\t\"Microsoft Extension Request\"\r\n#define NID_ms_ext_req\t\t171\r\n#define OBJ_ms_ext_req\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,14L\r\n\r\n#define SN_ms_code_ind\t\t\"msCodeInd\"\r\n#define LN_ms_code_ind\t\t\"Microsoft Individual Code Signing\"\r\n#define NID_ms_code_ind\t\t134\r\n#define OBJ_ms_code_ind\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,21L\r\n\r\n#define SN_ms_code_com\t\t\"msCodeCom\"\r\n#define LN_ms_code_com\t\t\"Microsoft Commercial Code Signing\"\r\n#define NID_ms_code_com\t\t135\r\n#define OBJ_ms_code_com\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,22L\r\n\r\n#define SN_ms_ctl_sign\t\t\"msCTLSign\"\r\n#define LN_ms_ctl_sign\t\t\"Microsoft Trust List Signing\"\r\n#define NID_ms_ctl_sign\t\t136\r\n#define OBJ_ms_ctl_sign\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,1L\r\n\r\n#define SN_ms_sgc\t\t\"msSGC\"\r\n#define LN_ms_sgc\t\t\"Microsoft Server Gated Crypto\"\r\n#define NID_ms_sgc\t\t137\r\n#define OBJ_ms_sgc\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,3L\r\n\r\n#define SN_ms_efs\t\t\"msEFS\"\r\n#define LN_ms_efs\t\t\"Microsoft Encrypted File System\"\r\n#define NID_ms_efs\t\t138\r\n#define OBJ_ms_efs\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,4L\r\n\r\n#define SN_ms_smartcard_login\t\t\"msSmartcardLogin\"\r\n#define LN_ms_smartcard_login\t\t\"Microsoft Smartcardlogin\"\r\n#define NID_ms_smartcard_login\t\t648\r\n#define OBJ_ms_smartcard_login\t\t1L,3L,6L,1L,4L,1L,311L,20L,2L,2L\r\n\r\n#define SN_ms_upn\t\t\"msUPN\"\r\n#define LN_ms_upn\t\t\"Microsoft Universal Principal Name\"\r\n#define NID_ms_upn\t\t649\r\n#define OBJ_ms_upn\t\t1L,3L,6L,1L,4L,1L,311L,20L,2L,3L\r\n\r\n#define SN_idea_cbc\t\t\"IDEA-CBC\"\r\n#define LN_idea_cbc\t\t\"idea-cbc\"\r\n#define NID_idea_cbc\t\t34\r\n#define OBJ_idea_cbc\t\t1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L\r\n\r\n#define SN_idea_ecb\t\t\"IDEA-ECB\"\r\n#define LN_idea_ecb\t\t\"idea-ecb\"\r\n#define NID_idea_ecb\t\t36\r\n\r\n#define SN_idea_cfb64\t\t\"IDEA-CFB\"\r\n#define LN_idea_cfb64\t\t\"idea-cfb\"\r\n#define NID_idea_cfb64\t\t35\r\n\r\n#define SN_idea_ofb64\t\t\"IDEA-OFB\"\r\n#define LN_idea_ofb64\t\t\"idea-ofb\"\r\n#define NID_idea_ofb64\t\t46\r\n\r\n#define SN_bf_cbc\t\t\"BF-CBC\"\r\n#define LN_bf_cbc\t\t\"bf-cbc\"\r\n#define NID_bf_cbc\t\t91\r\n#define OBJ_bf_cbc\t\t1L,3L,6L,1L,4L,1L,3029L,1L,2L\r\n\r\n#define SN_bf_ecb\t\t\"BF-ECB\"\r\n#define LN_bf_ecb\t\t\"bf-ecb\"\r\n#define NID_bf_ecb\t\t92\r\n\r\n#define SN_bf_cfb64\t\t\"BF-CFB\"\r\n#define LN_bf_cfb64\t\t\"bf-cfb\"\r\n#define NID_bf_cfb64\t\t93\r\n\r\n#define SN_bf_ofb64\t\t\"BF-OFB\"\r\n#define LN_bf_ofb64\t\t\"bf-ofb\"\r\n#define NID_bf_ofb64\t\t94\r\n\r\n#define SN_id_pkix\t\t\"PKIX\"\r\n#define NID_id_pkix\t\t127\r\n#define OBJ_id_pkix\t\t1L,3L,6L,1L,5L,5L,7L\r\n\r\n#define SN_id_pkix_mod\t\t\"id-pkix-mod\"\r\n#define NID_id_pkix_mod\t\t258\r\n#define OBJ_id_pkix_mod\t\tOBJ_id_pkix,0L\r\n\r\n#define SN_id_pe\t\t\"id-pe\"\r\n#define NID_id_pe\t\t175\r\n#define OBJ_id_pe\t\tOBJ_id_pkix,1L\r\n\r\n#define SN_id_qt\t\t\"id-qt\"\r\n#define NID_id_qt\t\t259\r\n#define OBJ_id_qt\t\tOBJ_id_pkix,2L\r\n\r\n#define SN_id_kp\t\t\"id-kp\"\r\n#define NID_id_kp\t\t128\r\n#define OBJ_id_kp\t\tOBJ_id_pkix,3L\r\n\r\n#define SN_id_it\t\t\"id-it\"\r\n#define NID_id_it\t\t260\r\n#define OBJ_id_it\t\tOBJ_id_pkix,4L\r\n\r\n#define SN_id_pkip\t\t\"id-pkip\"\r\n#define NID_id_pkip\t\t261\r\n#define OBJ_id_pkip\t\tOBJ_id_pkix,5L\r\n\r\n#define SN_id_alg\t\t\"id-alg\"\r\n#define NID_id_alg\t\t262\r\n#define OBJ_id_alg\t\tOBJ_id_pkix,6L\r\n\r\n#define SN_id_cmc\t\t\"id-cmc\"\r\n#define NID_id_cmc\t\t263\r\n#define OBJ_id_cmc\t\tOBJ_id_pkix,7L\r\n\r\n#define SN_id_on\t\t\"id-on\"\r\n#define NID_id_on\t\t264\r\n#define OBJ_id_on\t\tOBJ_id_pkix,8L\r\n\r\n#define SN_id_pda\t\t\"id-pda\"\r\n#define NID_id_pda\t\t265\r\n#define OBJ_id_pda\t\tOBJ_id_pkix,9L\r\n\r\n#define SN_id_aca\t\t\"id-aca\"\r\n#define NID_id_aca\t\t266\r\n#define OBJ_id_aca\t\tOBJ_id_pkix,10L\r\n\r\n#define SN_id_qcs\t\t\"id-qcs\"\r\n#define NID_id_qcs\t\t267\r\n#define OBJ_id_qcs\t\tOBJ_id_pkix,11L\r\n\r\n#define SN_id_cct\t\t\"id-cct\"\r\n#define NID_id_cct\t\t268\r\n#define OBJ_id_cct\t\tOBJ_id_pkix,12L\r\n\r\n#define SN_id_ppl\t\t\"id-ppl\"\r\n#define NID_id_ppl\t\t662\r\n#define OBJ_id_ppl\t\tOBJ_id_pkix,21L\r\n\r\n#define SN_id_ad\t\t\"id-ad\"\r\n#define NID_id_ad\t\t176\r\n#define OBJ_id_ad\t\tOBJ_id_pkix,48L\r\n\r\n#define SN_id_pkix1_explicit_88\t\t\"id-pkix1-explicit-88\"\r\n#define NID_id_pkix1_explicit_88\t\t269\r\n#define OBJ_id_pkix1_explicit_88\t\tOBJ_id_pkix_mod,1L\r\n\r\n#define SN_id_pkix1_implicit_88\t\t\"id-pkix1-implicit-88\"\r\n#define NID_id_pkix1_implicit_88\t\t270\r\n#define OBJ_id_pkix1_implicit_88\t\tOBJ_id_pkix_mod,2L\r\n\r\n#define SN_id_pkix1_explicit_93\t\t\"id-pkix1-explicit-93\"\r\n#define NID_id_pkix1_explicit_93\t\t271\r\n#define OBJ_id_pkix1_explicit_93\t\tOBJ_id_pkix_mod,3L\r\n\r\n#define SN_id_pkix1_implicit_93\t\t\"id-pkix1-implicit-93\"\r\n#define NID_id_pkix1_implicit_93\t\t272\r\n#define OBJ_id_pkix1_implicit_93\t\tOBJ_id_pkix_mod,4L\r\n\r\n#define SN_id_mod_crmf\t\t\"id-mod-crmf\"\r\n#define NID_id_mod_crmf\t\t273\r\n#define OBJ_id_mod_crmf\t\tOBJ_id_pkix_mod,5L\r\n\r\n#define SN_id_mod_cmc\t\t\"id-mod-cmc\"\r\n#define NID_id_mod_cmc\t\t274\r\n#define OBJ_id_mod_cmc\t\tOBJ_id_pkix_mod,6L\r\n\r\n#define SN_id_mod_kea_profile_88\t\t\"id-mod-kea-profile-88\"\r\n#define NID_id_mod_kea_profile_88\t\t275\r\n#define OBJ_id_mod_kea_profile_88\t\tOBJ_id_pkix_mod,7L\r\n\r\n#define SN_id_mod_kea_profile_93\t\t\"id-mod-kea-profile-93\"\r\n#define NID_id_mod_kea_profile_93\t\t276\r\n#define OBJ_id_mod_kea_profile_93\t\tOBJ_id_pkix_mod,8L\r\n\r\n#define SN_id_mod_cmp\t\t\"id-mod-cmp\"\r\n#define NID_id_mod_cmp\t\t277\r\n#define OBJ_id_mod_cmp\t\tOBJ_id_pkix_mod,9L\r\n\r\n#define SN_id_mod_qualified_cert_88\t\t\"id-mod-qualified-cert-88\"\r\n#define NID_id_mod_qualified_cert_88\t\t278\r\n#define OBJ_id_mod_qualified_cert_88\t\tOBJ_id_pkix_mod,10L\r\n\r\n#define SN_id_mod_qualified_cert_93\t\t\"id-mod-qualified-cert-93\"\r\n#define NID_id_mod_qualified_cert_93\t\t279\r\n#define OBJ_id_mod_qualified_cert_93\t\tOBJ_id_pkix_mod,11L\r\n\r\n#define SN_id_mod_attribute_cert\t\t\"id-mod-attribute-cert\"\r\n#define NID_id_mod_attribute_cert\t\t280\r\n#define OBJ_id_mod_attribute_cert\t\tOBJ_id_pkix_mod,12L\r\n\r\n#define SN_id_mod_timestamp_protocol\t\t\"id-mod-timestamp-protocol\"\r\n#define NID_id_mod_timestamp_protocol\t\t281\r\n#define OBJ_id_mod_timestamp_protocol\t\tOBJ_id_pkix_mod,13L\r\n\r\n#define SN_id_mod_ocsp\t\t\"id-mod-ocsp\"\r\n#define NID_id_mod_ocsp\t\t282\r\n#define OBJ_id_mod_ocsp\t\tOBJ_id_pkix_mod,14L\r\n\r\n#define SN_id_mod_dvcs\t\t\"id-mod-dvcs\"\r\n#define NID_id_mod_dvcs\t\t283\r\n#define OBJ_id_mod_dvcs\t\tOBJ_id_pkix_mod,15L\r\n\r\n#define SN_id_mod_cmp2000\t\t\"id-mod-cmp2000\"\r\n#define NID_id_mod_cmp2000\t\t284\r\n#define OBJ_id_mod_cmp2000\t\tOBJ_id_pkix_mod,16L\r\n\r\n#define SN_info_access\t\t\"authorityInfoAccess\"\r\n#define LN_info_access\t\t\"Authority Information Access\"\r\n#define NID_info_access\t\t177\r\n#define OBJ_info_access\t\tOBJ_id_pe,1L\r\n\r\n#define SN_biometricInfo\t\t\"biometricInfo\"\r\n#define LN_biometricInfo\t\t\"Biometric Info\"\r\n#define NID_biometricInfo\t\t285\r\n#define OBJ_biometricInfo\t\tOBJ_id_pe,2L\r\n\r\n#define SN_qcStatements\t\t\"qcStatements\"\r\n#define NID_qcStatements\t\t286\r\n#define OBJ_qcStatements\t\tOBJ_id_pe,3L\r\n\r\n#define SN_ac_auditEntity\t\t\"ac-auditEntity\"\r\n#define NID_ac_auditEntity\t\t287\r\n#define OBJ_ac_auditEntity\t\tOBJ_id_pe,4L\r\n\r\n#define SN_ac_targeting\t\t\"ac-targeting\"\r\n#define NID_ac_targeting\t\t288\r\n#define OBJ_ac_targeting\t\tOBJ_id_pe,5L\r\n\r\n#define SN_aaControls\t\t\"aaControls\"\r\n#define NID_aaControls\t\t289\r\n#define OBJ_aaControls\t\tOBJ_id_pe,6L\r\n\r\n#define SN_sbgp_ipAddrBlock\t\t\"sbgp-ipAddrBlock\"\r\n#define NID_sbgp_ipAddrBlock\t\t290\r\n#define OBJ_sbgp_ipAddrBlock\t\tOBJ_id_pe,7L\r\n\r\n#define SN_sbgp_autonomousSysNum\t\t\"sbgp-autonomousSysNum\"\r\n#define NID_sbgp_autonomousSysNum\t\t291\r\n#define OBJ_sbgp_autonomousSysNum\t\tOBJ_id_pe,8L\r\n\r\n#define SN_sbgp_routerIdentifier\t\t\"sbgp-routerIdentifier\"\r\n#define NID_sbgp_routerIdentifier\t\t292\r\n#define OBJ_sbgp_routerIdentifier\t\tOBJ_id_pe,9L\r\n\r\n#define SN_ac_proxying\t\t\"ac-proxying\"\r\n#define NID_ac_proxying\t\t397\r\n#define OBJ_ac_proxying\t\tOBJ_id_pe,10L\r\n\r\n#define SN_sinfo_access\t\t\"subjectInfoAccess\"\r\n#define LN_sinfo_access\t\t\"Subject Information Access\"\r\n#define NID_sinfo_access\t\t398\r\n#define OBJ_sinfo_access\t\tOBJ_id_pe,11L\r\n\r\n#define SN_proxyCertInfo\t\t\"proxyCertInfo\"\r\n#define LN_proxyCertInfo\t\t\"Proxy Certificate Information\"\r\n#define NID_proxyCertInfo\t\t663\r\n#define OBJ_proxyCertInfo\t\tOBJ_id_pe,14L\r\n\r\n#define SN_id_qt_cps\t\t\"id-qt-cps\"\r\n#define LN_id_qt_cps\t\t\"Policy Qualifier CPS\"\r\n#define NID_id_qt_cps\t\t164\r\n#define OBJ_id_qt_cps\t\tOBJ_id_qt,1L\r\n\r\n#define SN_id_qt_unotice\t\t\"id-qt-unotice\"\r\n#define LN_id_qt_unotice\t\t\"Policy Qualifier User Notice\"\r\n#define NID_id_qt_unotice\t\t165\r\n#define OBJ_id_qt_unotice\t\tOBJ_id_qt,2L\r\n\r\n#define SN_textNotice\t\t\"textNotice\"\r\n#define NID_textNotice\t\t293\r\n#define OBJ_textNotice\t\tOBJ_id_qt,3L\r\n\r\n#define SN_server_auth\t\t\"serverAuth\"\r\n#define LN_server_auth\t\t\"TLS Web Server Authentication\"\r\n#define NID_server_auth\t\t129\r\n#define OBJ_server_auth\t\tOBJ_id_kp,1L\r\n\r\n#define SN_client_auth\t\t\"clientAuth\"\r\n#define LN_client_auth\t\t\"TLS Web Client Authentication\"\r\n#define NID_client_auth\t\t130\r\n#define OBJ_client_auth\t\tOBJ_id_kp,2L\r\n\r\n#define SN_code_sign\t\t\"codeSigning\"\r\n#define LN_code_sign\t\t\"Code Signing\"\r\n#define NID_code_sign\t\t131\r\n#define OBJ_code_sign\t\tOBJ_id_kp,3L\r\n\r\n#define SN_email_protect\t\t\"emailProtection\"\r\n#define LN_email_protect\t\t\"E-mail Protection\"\r\n#define NID_email_protect\t\t132\r\n#define OBJ_email_protect\t\tOBJ_id_kp,4L\r\n\r\n#define SN_ipsecEndSystem\t\t\"ipsecEndSystem\"\r\n#define LN_ipsecEndSystem\t\t\"IPSec End System\"\r\n#define NID_ipsecEndSystem\t\t294\r\n#define OBJ_ipsecEndSystem\t\tOBJ_id_kp,5L\r\n\r\n#define SN_ipsecTunnel\t\t\"ipsecTunnel\"\r\n#define LN_ipsecTunnel\t\t\"IPSec Tunnel\"\r\n#define NID_ipsecTunnel\t\t295\r\n#define OBJ_ipsecTunnel\t\tOBJ_id_kp,6L\r\n\r\n#define SN_ipsecUser\t\t\"ipsecUser\"\r\n#define LN_ipsecUser\t\t\"IPSec User\"\r\n#define NID_ipsecUser\t\t296\r\n#define OBJ_ipsecUser\t\tOBJ_id_kp,7L\r\n\r\n#define SN_time_stamp\t\t\"timeStamping\"\r\n#define LN_time_stamp\t\t\"Time Stamping\"\r\n#define NID_time_stamp\t\t133\r\n#define OBJ_time_stamp\t\tOBJ_id_kp,8L\r\n\r\n#define SN_OCSP_sign\t\t\"OCSPSigning\"\r\n#define LN_OCSP_sign\t\t\"OCSP Signing\"\r\n#define NID_OCSP_sign\t\t180\r\n#define OBJ_OCSP_sign\t\tOBJ_id_kp,9L\r\n\r\n#define SN_dvcs\t\t\"DVCS\"\r\n#define LN_dvcs\t\t\"dvcs\"\r\n#define NID_dvcs\t\t297\r\n#define OBJ_dvcs\t\tOBJ_id_kp,10L\r\n\r\n#define SN_id_it_caProtEncCert\t\t\"id-it-caProtEncCert\"\r\n#define NID_id_it_caProtEncCert\t\t298\r\n#define OBJ_id_it_caProtEncCert\t\tOBJ_id_it,1L\r\n\r\n#define SN_id_it_signKeyPairTypes\t\t\"id-it-signKeyPairTypes\"\r\n#define NID_id_it_signKeyPairTypes\t\t299\r\n#define OBJ_id_it_signKeyPairTypes\t\tOBJ_id_it,2L\r\n\r\n#define SN_id_it_encKeyPairTypes\t\t\"id-it-encKeyPairTypes\"\r\n#define NID_id_it_encKeyPairTypes\t\t300\r\n#define OBJ_id_it_encKeyPairTypes\t\tOBJ_id_it,3L\r\n\r\n#define SN_id_it_preferredSymmAlg\t\t\"id-it-preferredSymmAlg\"\r\n#define NID_id_it_preferredSymmAlg\t\t301\r\n#define OBJ_id_it_preferredSymmAlg\t\tOBJ_id_it,4L\r\n\r\n#define SN_id_it_caKeyUpdateInfo\t\t\"id-it-caKeyUpdateInfo\"\r\n#define NID_id_it_caKeyUpdateInfo\t\t302\r\n#define OBJ_id_it_caKeyUpdateInfo\t\tOBJ_id_it,5L\r\n\r\n#define SN_id_it_currentCRL\t\t\"id-it-currentCRL\"\r\n#define NID_id_it_currentCRL\t\t303\r\n#define OBJ_id_it_currentCRL\t\tOBJ_id_it,6L\r\n\r\n#define SN_id_it_unsupportedOIDs\t\t\"id-it-unsupportedOIDs\"\r\n#define NID_id_it_unsupportedOIDs\t\t304\r\n#define OBJ_id_it_unsupportedOIDs\t\tOBJ_id_it,7L\r\n\r\n#define SN_id_it_subscriptionRequest\t\t\"id-it-subscriptionRequest\"\r\n#define NID_id_it_subscriptionRequest\t\t305\r\n#define OBJ_id_it_subscriptionRequest\t\tOBJ_id_it,8L\r\n\r\n#define SN_id_it_subscriptionResponse\t\t\"id-it-subscriptionResponse\"\r\n#define NID_id_it_subscriptionResponse\t\t306\r\n#define OBJ_id_it_subscriptionResponse\t\tOBJ_id_it,9L\r\n\r\n#define SN_id_it_keyPairParamReq\t\t\"id-it-keyPairParamReq\"\r\n#define NID_id_it_keyPairParamReq\t\t307\r\n#define OBJ_id_it_keyPairParamReq\t\tOBJ_id_it,10L\r\n\r\n#define SN_id_it_keyPairParamRep\t\t\"id-it-keyPairParamRep\"\r\n#define NID_id_it_keyPairParamRep\t\t308\r\n#define OBJ_id_it_keyPairParamRep\t\tOBJ_id_it,11L\r\n\r\n#define SN_id_it_revPassphrase\t\t\"id-it-revPassphrase\"\r\n#define NID_id_it_revPassphrase\t\t309\r\n#define OBJ_id_it_revPassphrase\t\tOBJ_id_it,12L\r\n\r\n#define SN_id_it_implicitConfirm\t\t\"id-it-implicitConfirm\"\r\n#define NID_id_it_implicitConfirm\t\t310\r\n#define OBJ_id_it_implicitConfirm\t\tOBJ_id_it,13L\r\n\r\n#define SN_id_it_confirmWaitTime\t\t\"id-it-confirmWaitTime\"\r\n#define NID_id_it_confirmWaitTime\t\t311\r\n#define OBJ_id_it_confirmWaitTime\t\tOBJ_id_it,14L\r\n\r\n#define SN_id_it_origPKIMessage\t\t\"id-it-origPKIMessage\"\r\n#define NID_id_it_origPKIMessage\t\t312\r\n#define OBJ_id_it_origPKIMessage\t\tOBJ_id_it,15L\r\n\r\n#define SN_id_it_suppLangTags\t\t\"id-it-suppLangTags\"\r\n#define NID_id_it_suppLangTags\t\t784\r\n#define OBJ_id_it_suppLangTags\t\tOBJ_id_it,16L\r\n\r\n#define SN_id_regCtrl\t\t\"id-regCtrl\"\r\n#define NID_id_regCtrl\t\t313\r\n#define OBJ_id_regCtrl\t\tOBJ_id_pkip,1L\r\n\r\n#define SN_id_regInfo\t\t\"id-regInfo\"\r\n#define NID_id_regInfo\t\t314\r\n#define OBJ_id_regInfo\t\tOBJ_id_pkip,2L\r\n\r\n#define SN_id_regCtrl_regToken\t\t\"id-regCtrl-regToken\"\r\n#define NID_id_regCtrl_regToken\t\t315\r\n#define OBJ_id_regCtrl_regToken\t\tOBJ_id_regCtrl,1L\r\n\r\n#define SN_id_regCtrl_authenticator\t\t\"id-regCtrl-authenticator\"\r\n#define NID_id_regCtrl_authenticator\t\t316\r\n#define OBJ_id_regCtrl_authenticator\t\tOBJ_id_regCtrl,2L\r\n\r\n#define SN_id_regCtrl_pkiPublicationInfo\t\t\"id-regCtrl-pkiPublicationInfo\"\r\n#define NID_id_regCtrl_pkiPublicationInfo\t\t317\r\n#define OBJ_id_regCtrl_pkiPublicationInfo\t\tOBJ_id_regCtrl,3L\r\n\r\n#define SN_id_regCtrl_pkiArchiveOptions\t\t\"id-regCtrl-pkiArchiveOptions\"\r\n#define NID_id_regCtrl_pkiArchiveOptions\t\t318\r\n#define OBJ_id_regCtrl_pkiArchiveOptions\t\tOBJ_id_regCtrl,4L\r\n\r\n#define SN_id_regCtrl_oldCertID\t\t\"id-regCtrl-oldCertID\"\r\n#define NID_id_regCtrl_oldCertID\t\t319\r\n#define OBJ_id_regCtrl_oldCertID\t\tOBJ_id_regCtrl,5L\r\n\r\n#define SN_id_regCtrl_protocolEncrKey\t\t\"id-regCtrl-protocolEncrKey\"\r\n#define NID_id_regCtrl_protocolEncrKey\t\t320\r\n#define OBJ_id_regCtrl_protocolEncrKey\t\tOBJ_id_regCtrl,6L\r\n\r\n#define SN_id_regInfo_utf8Pairs\t\t\"id-regInfo-utf8Pairs\"\r\n#define NID_id_regInfo_utf8Pairs\t\t321\r\n#define OBJ_id_regInfo_utf8Pairs\t\tOBJ_id_regInfo,1L\r\n\r\n#define SN_id_regInfo_certReq\t\t\"id-regInfo-certReq\"\r\n#define NID_id_regInfo_certReq\t\t322\r\n#define OBJ_id_regInfo_certReq\t\tOBJ_id_regInfo,2L\r\n\r\n#define SN_id_alg_des40\t\t\"id-alg-des40\"\r\n#define NID_id_alg_des40\t\t323\r\n#define OBJ_id_alg_des40\t\tOBJ_id_alg,1L\r\n\r\n#define SN_id_alg_noSignature\t\t\"id-alg-noSignature\"\r\n#define NID_id_alg_noSignature\t\t324\r\n#define OBJ_id_alg_noSignature\t\tOBJ_id_alg,2L\r\n\r\n#define SN_id_alg_dh_sig_hmac_sha1\t\t\"id-alg-dh-sig-hmac-sha1\"\r\n#define NID_id_alg_dh_sig_hmac_sha1\t\t325\r\n#define OBJ_id_alg_dh_sig_hmac_sha1\t\tOBJ_id_alg,3L\r\n\r\n#define SN_id_alg_dh_pop\t\t\"id-alg-dh-pop\"\r\n#define NID_id_alg_dh_pop\t\t326\r\n#define OBJ_id_alg_dh_pop\t\tOBJ_id_alg,4L\r\n\r\n#define SN_id_cmc_statusInfo\t\t\"id-cmc-statusInfo\"\r\n#define NID_id_cmc_statusInfo\t\t327\r\n#define OBJ_id_cmc_statusInfo\t\tOBJ_id_cmc,1L\r\n\r\n#define SN_id_cmc_identification\t\t\"id-cmc-identification\"\r\n#define NID_id_cmc_identification\t\t328\r\n#define OBJ_id_cmc_identification\t\tOBJ_id_cmc,2L\r\n\r\n#define SN_id_cmc_identityProof\t\t\"id-cmc-identityProof\"\r\n#define NID_id_cmc_identityProof\t\t329\r\n#define OBJ_id_cmc_identityProof\t\tOBJ_id_cmc,3L\r\n\r\n#define SN_id_cmc_dataReturn\t\t\"id-cmc-dataReturn\"\r\n#define NID_id_cmc_dataReturn\t\t330\r\n#define OBJ_id_cmc_dataReturn\t\tOBJ_id_cmc,4L\r\n\r\n#define SN_id_cmc_transactionId\t\t\"id-cmc-transactionId\"\r\n#define NID_id_cmc_transactionId\t\t331\r\n#define OBJ_id_cmc_transactionId\t\tOBJ_id_cmc,5L\r\n\r\n#define SN_id_cmc_senderNonce\t\t\"id-cmc-senderNonce\"\r\n#define NID_id_cmc_senderNonce\t\t332\r\n#define OBJ_id_cmc_senderNonce\t\tOBJ_id_cmc,6L\r\n\r\n#define SN_id_cmc_recipientNonce\t\t\"id-cmc-recipientNonce\"\r\n#define NID_id_cmc_recipientNonce\t\t333\r\n#define OBJ_id_cmc_recipientNonce\t\tOBJ_id_cmc,7L\r\n\r\n#define SN_id_cmc_addExtensions\t\t\"id-cmc-addExtensions\"\r\n#define NID_id_cmc_addExtensions\t\t334\r\n#define OBJ_id_cmc_addExtensions\t\tOBJ_id_cmc,8L\r\n\r\n#define SN_id_cmc_encryptedPOP\t\t\"id-cmc-encryptedPOP\"\r\n#define NID_id_cmc_encryptedPOP\t\t335\r\n#define OBJ_id_cmc_encryptedPOP\t\tOBJ_id_cmc,9L\r\n\r\n#define SN_id_cmc_decryptedPOP\t\t\"id-cmc-decryptedPOP\"\r\n#define NID_id_cmc_decryptedPOP\t\t336\r\n#define OBJ_id_cmc_decryptedPOP\t\tOBJ_id_cmc,10L\r\n\r\n#define SN_id_cmc_lraPOPWitness\t\t\"id-cmc-lraPOPWitness\"\r\n#define NID_id_cmc_lraPOPWitness\t\t337\r\n#define OBJ_id_cmc_lraPOPWitness\t\tOBJ_id_cmc,11L\r\n\r\n#define SN_id_cmc_getCert\t\t\"id-cmc-getCert\"\r\n#define NID_id_cmc_getCert\t\t338\r\n#define OBJ_id_cmc_getCert\t\tOBJ_id_cmc,15L\r\n\r\n#define SN_id_cmc_getCRL\t\t\"id-cmc-getCRL\"\r\n#define NID_id_cmc_getCRL\t\t339\r\n#define OBJ_id_cmc_getCRL\t\tOBJ_id_cmc,16L\r\n\r\n#define SN_id_cmc_revokeRequest\t\t\"id-cmc-revokeRequest\"\r\n#define NID_id_cmc_revokeRequest\t\t340\r\n#define OBJ_id_cmc_revokeRequest\t\tOBJ_id_cmc,17L\r\n\r\n#define SN_id_cmc_regInfo\t\t\"id-cmc-regInfo\"\r\n#define NID_id_cmc_regInfo\t\t341\r\n#define OBJ_id_cmc_regInfo\t\tOBJ_id_cmc,18L\r\n\r\n#define SN_id_cmc_responseInfo\t\t\"id-cmc-responseInfo\"\r\n#define NID_id_cmc_responseInfo\t\t342\r\n#define OBJ_id_cmc_responseInfo\t\tOBJ_id_cmc,19L\r\n\r\n#define SN_id_cmc_queryPending\t\t\"id-cmc-queryPending\"\r\n#define NID_id_cmc_queryPending\t\t343\r\n#define OBJ_id_cmc_queryPending\t\tOBJ_id_cmc,21L\r\n\r\n#define SN_id_cmc_popLinkRandom\t\t\"id-cmc-popLinkRandom\"\r\n#define NID_id_cmc_popLinkRandom\t\t344\r\n#define OBJ_id_cmc_popLinkRandom\t\tOBJ_id_cmc,22L\r\n\r\n#define SN_id_cmc_popLinkWitness\t\t\"id-cmc-popLinkWitness\"\r\n#define NID_id_cmc_popLinkWitness\t\t345\r\n#define OBJ_id_cmc_popLinkWitness\t\tOBJ_id_cmc,23L\r\n\r\n#define SN_id_cmc_confirmCertAcceptance\t\t\"id-cmc-confirmCertAcceptance\"\r\n#define NID_id_cmc_confirmCertAcceptance\t\t346\r\n#define OBJ_id_cmc_confirmCertAcceptance\t\tOBJ_id_cmc,24L\r\n\r\n#define SN_id_on_personalData\t\t\"id-on-personalData\"\r\n#define NID_id_on_personalData\t\t347\r\n#define OBJ_id_on_personalData\t\tOBJ_id_on,1L\r\n\r\n#define SN_id_on_permanentIdentifier\t\t\"id-on-permanentIdentifier\"\r\n#define LN_id_on_permanentIdentifier\t\t\"Permanent Identifier\"\r\n#define NID_id_on_permanentIdentifier\t\t858\r\n#define OBJ_id_on_permanentIdentifier\t\tOBJ_id_on,3L\r\n\r\n#define SN_id_pda_dateOfBirth\t\t\"id-pda-dateOfBirth\"\r\n#define NID_id_pda_dateOfBirth\t\t348\r\n#define OBJ_id_pda_dateOfBirth\t\tOBJ_id_pda,1L\r\n\r\n#define SN_id_pda_placeOfBirth\t\t\"id-pda-placeOfBirth\"\r\n#define NID_id_pda_placeOfBirth\t\t349\r\n#define OBJ_id_pda_placeOfBirth\t\tOBJ_id_pda,2L\r\n\r\n#define SN_id_pda_gender\t\t\"id-pda-gender\"\r\n#define NID_id_pda_gender\t\t351\r\n#define OBJ_id_pda_gender\t\tOBJ_id_pda,3L\r\n\r\n#define SN_id_pda_countryOfCitizenship\t\t\"id-pda-countryOfCitizenship\"\r\n#define NID_id_pda_countryOfCitizenship\t\t352\r\n#define OBJ_id_pda_countryOfCitizenship\t\tOBJ_id_pda,4L\r\n\r\n#define SN_id_pda_countryOfResidence\t\t\"id-pda-countryOfResidence\"\r\n#define NID_id_pda_countryOfResidence\t\t353\r\n#define OBJ_id_pda_countryOfResidence\t\tOBJ_id_pda,5L\r\n\r\n#define SN_id_aca_authenticationInfo\t\t\"id-aca-authenticationInfo\"\r\n#define NID_id_aca_authenticationInfo\t\t354\r\n#define OBJ_id_aca_authenticationInfo\t\tOBJ_id_aca,1L\r\n\r\n#define SN_id_aca_accessIdentity\t\t\"id-aca-accessIdentity\"\r\n#define NID_id_aca_accessIdentity\t\t355\r\n#define OBJ_id_aca_accessIdentity\t\tOBJ_id_aca,2L\r\n\r\n#define SN_id_aca_chargingIdentity\t\t\"id-aca-chargingIdentity\"\r\n#define NID_id_aca_chargingIdentity\t\t356\r\n#define OBJ_id_aca_chargingIdentity\t\tOBJ_id_aca,3L\r\n\r\n#define SN_id_aca_group\t\t\"id-aca-group\"\r\n#define NID_id_aca_group\t\t357\r\n#define OBJ_id_aca_group\t\tOBJ_id_aca,4L\r\n\r\n#define SN_id_aca_role\t\t\"id-aca-role\"\r\n#define NID_id_aca_role\t\t358\r\n#define OBJ_id_aca_role\t\tOBJ_id_aca,5L\r\n\r\n#define SN_id_aca_encAttrs\t\t\"id-aca-encAttrs\"\r\n#define NID_id_aca_encAttrs\t\t399\r\n#define OBJ_id_aca_encAttrs\t\tOBJ_id_aca,6L\r\n\r\n#define SN_id_qcs_pkixQCSyntax_v1\t\t\"id-qcs-pkixQCSyntax-v1\"\r\n#define NID_id_qcs_pkixQCSyntax_v1\t\t359\r\n#define OBJ_id_qcs_pkixQCSyntax_v1\t\tOBJ_id_qcs,1L\r\n\r\n#define SN_id_cct_crs\t\t\"id-cct-crs\"\r\n#define NID_id_cct_crs\t\t360\r\n#define OBJ_id_cct_crs\t\tOBJ_id_cct,1L\r\n\r\n#define SN_id_cct_PKIData\t\t\"id-cct-PKIData\"\r\n#define NID_id_cct_PKIData\t\t361\r\n#define OBJ_id_cct_PKIData\t\tOBJ_id_cct,2L\r\n\r\n#define SN_id_cct_PKIResponse\t\t\"id-cct-PKIResponse\"\r\n#define NID_id_cct_PKIResponse\t\t362\r\n#define OBJ_id_cct_PKIResponse\t\tOBJ_id_cct,3L\r\n\r\n#define SN_id_ppl_anyLanguage\t\t\"id-ppl-anyLanguage\"\r\n#define LN_id_ppl_anyLanguage\t\t\"Any language\"\r\n#define NID_id_ppl_anyLanguage\t\t664\r\n#define OBJ_id_ppl_anyLanguage\t\tOBJ_id_ppl,0L\r\n\r\n#define SN_id_ppl_inheritAll\t\t\"id-ppl-inheritAll\"\r\n#define LN_id_ppl_inheritAll\t\t\"Inherit all\"\r\n#define NID_id_ppl_inheritAll\t\t665\r\n#define OBJ_id_ppl_inheritAll\t\tOBJ_id_ppl,1L\r\n\r\n#define SN_Independent\t\t\"id-ppl-independent\"\r\n#define LN_Independent\t\t\"Independent\"\r\n#define NID_Independent\t\t667\r\n#define OBJ_Independent\t\tOBJ_id_ppl,2L\r\n\r\n#define SN_ad_OCSP\t\t\"OCSP\"\r\n#define LN_ad_OCSP\t\t\"OCSP\"\r\n#define NID_ad_OCSP\t\t178\r\n#define OBJ_ad_OCSP\t\tOBJ_id_ad,1L\r\n\r\n#define SN_ad_ca_issuers\t\t\"caIssuers\"\r\n#define LN_ad_ca_issuers\t\t\"CA Issuers\"\r\n#define NID_ad_ca_issuers\t\t179\r\n#define OBJ_ad_ca_issuers\t\tOBJ_id_ad,2L\r\n\r\n#define SN_ad_timeStamping\t\t\"ad_timestamping\"\r\n#define LN_ad_timeStamping\t\t\"AD Time Stamping\"\r\n#define NID_ad_timeStamping\t\t363\r\n#define OBJ_ad_timeStamping\t\tOBJ_id_ad,3L\r\n\r\n#define SN_ad_dvcs\t\t\"AD_DVCS\"\r\n#define LN_ad_dvcs\t\t\"ad dvcs\"\r\n#define NID_ad_dvcs\t\t364\r\n#define OBJ_ad_dvcs\t\tOBJ_id_ad,4L\r\n\r\n#define SN_caRepository\t\t\"caRepository\"\r\n#define LN_caRepository\t\t\"CA Repository\"\r\n#define NID_caRepository\t\t785\r\n#define OBJ_caRepository\t\tOBJ_id_ad,5L\r\n\r\n#define OBJ_id_pkix_OCSP\t\tOBJ_ad_OCSP\r\n\r\n#define SN_id_pkix_OCSP_basic\t\t\"basicOCSPResponse\"\r\n#define LN_id_pkix_OCSP_basic\t\t\"Basic OCSP Response\"\r\n#define NID_id_pkix_OCSP_basic\t\t365\r\n#define OBJ_id_pkix_OCSP_basic\t\tOBJ_id_pkix_OCSP,1L\r\n\r\n#define SN_id_pkix_OCSP_Nonce\t\t\"Nonce\"\r\n#define LN_id_pkix_OCSP_Nonce\t\t\"OCSP Nonce\"\r\n#define NID_id_pkix_OCSP_Nonce\t\t366\r\n#define OBJ_id_pkix_OCSP_Nonce\t\tOBJ_id_pkix_OCSP,2L\r\n\r\n#define SN_id_pkix_OCSP_CrlID\t\t\"CrlID\"\r\n#define LN_id_pkix_OCSP_CrlID\t\t\"OCSP CRL ID\"\r\n#define NID_id_pkix_OCSP_CrlID\t\t367\r\n#define OBJ_id_pkix_OCSP_CrlID\t\tOBJ_id_pkix_OCSP,3L\r\n\r\n#define SN_id_pkix_OCSP_acceptableResponses\t\t\"acceptableResponses\"\r\n#define LN_id_pkix_OCSP_acceptableResponses\t\t\"Acceptable OCSP Responses\"\r\n#define NID_id_pkix_OCSP_acceptableResponses\t\t368\r\n#define OBJ_id_pkix_OCSP_acceptableResponses\t\tOBJ_id_pkix_OCSP,4L\r\n\r\n#define SN_id_pkix_OCSP_noCheck\t\t\"noCheck\"\r\n#define LN_id_pkix_OCSP_noCheck\t\t\"OCSP No Check\"\r\n#define NID_id_pkix_OCSP_noCheck\t\t369\r\n#define OBJ_id_pkix_OCSP_noCheck\t\tOBJ_id_pkix_OCSP,5L\r\n\r\n#define SN_id_pkix_OCSP_archiveCutoff\t\t\"archiveCutoff\"\r\n#define LN_id_pkix_OCSP_archiveCutoff\t\t\"OCSP Archive Cutoff\"\r\n#define NID_id_pkix_OCSP_archiveCutoff\t\t370\r\n#define OBJ_id_pkix_OCSP_archiveCutoff\t\tOBJ_id_pkix_OCSP,6L\r\n\r\n#define SN_id_pkix_OCSP_serviceLocator\t\t\"serviceLocator\"\r\n#define LN_id_pkix_OCSP_serviceLocator\t\t\"OCSP Service Locator\"\r\n#define NID_id_pkix_OCSP_serviceLocator\t\t371\r\n#define OBJ_id_pkix_OCSP_serviceLocator\t\tOBJ_id_pkix_OCSP,7L\r\n\r\n#define SN_id_pkix_OCSP_extendedStatus\t\t\"extendedStatus\"\r\n#define LN_id_pkix_OCSP_extendedStatus\t\t\"Extended OCSP Status\"\r\n#define NID_id_pkix_OCSP_extendedStatus\t\t372\r\n#define OBJ_id_pkix_OCSP_extendedStatus\t\tOBJ_id_pkix_OCSP,8L\r\n\r\n#define SN_id_pkix_OCSP_valid\t\t\"valid\"\r\n#define NID_id_pkix_OCSP_valid\t\t373\r\n#define OBJ_id_pkix_OCSP_valid\t\tOBJ_id_pkix_OCSP,9L\r\n\r\n#define SN_id_pkix_OCSP_path\t\t\"path\"\r\n#define NID_id_pkix_OCSP_path\t\t374\r\n#define OBJ_id_pkix_OCSP_path\t\tOBJ_id_pkix_OCSP,10L\r\n\r\n#define SN_id_pkix_OCSP_trustRoot\t\t\"trustRoot\"\r\n#define LN_id_pkix_OCSP_trustRoot\t\t\"Trust Root\"\r\n#define NID_id_pkix_OCSP_trustRoot\t\t375\r\n#define OBJ_id_pkix_OCSP_trustRoot\t\tOBJ_id_pkix_OCSP,11L\r\n\r\n#define SN_algorithm\t\t\"algorithm\"\r\n#define LN_algorithm\t\t\"algorithm\"\r\n#define NID_algorithm\t\t376\r\n#define OBJ_algorithm\t\t1L,3L,14L,3L,2L\r\n\r\n#define SN_md5WithRSA\t\t\"RSA-NP-MD5\"\r\n#define LN_md5WithRSA\t\t\"md5WithRSA\"\r\n#define NID_md5WithRSA\t\t104\r\n#define OBJ_md5WithRSA\t\tOBJ_algorithm,3L\r\n\r\n#define SN_des_ecb\t\t\"DES-ECB\"\r\n#define LN_des_ecb\t\t\"des-ecb\"\r\n#define NID_des_ecb\t\t29\r\n#define OBJ_des_ecb\t\tOBJ_algorithm,6L\r\n\r\n#define SN_des_cbc\t\t\"DES-CBC\"\r\n#define LN_des_cbc\t\t\"des-cbc\"\r\n#define NID_des_cbc\t\t31\r\n#define OBJ_des_cbc\t\tOBJ_algorithm,7L\r\n\r\n#define SN_des_ofb64\t\t\"DES-OFB\"\r\n#define LN_des_ofb64\t\t\"des-ofb\"\r\n#define NID_des_ofb64\t\t45\r\n#define OBJ_des_ofb64\t\tOBJ_algorithm,8L\r\n\r\n#define SN_des_cfb64\t\t\"DES-CFB\"\r\n#define LN_des_cfb64\t\t\"des-cfb\"\r\n#define NID_des_cfb64\t\t30\r\n#define OBJ_des_cfb64\t\tOBJ_algorithm,9L\r\n\r\n#define SN_rsaSignature\t\t\"rsaSignature\"\r\n#define NID_rsaSignature\t\t377\r\n#define OBJ_rsaSignature\t\tOBJ_algorithm,11L\r\n\r\n#define SN_dsa_2\t\t\"DSA-old\"\r\n#define LN_dsa_2\t\t\"dsaEncryption-old\"\r\n#define NID_dsa_2\t\t67\r\n#define OBJ_dsa_2\t\tOBJ_algorithm,12L\r\n\r\n#define SN_dsaWithSHA\t\t\"DSA-SHA\"\r\n#define LN_dsaWithSHA\t\t\"dsaWithSHA\"\r\n#define NID_dsaWithSHA\t\t66\r\n#define OBJ_dsaWithSHA\t\tOBJ_algorithm,13L\r\n\r\n#define SN_shaWithRSAEncryption\t\t\"RSA-SHA\"\r\n#define LN_shaWithRSAEncryption\t\t\"shaWithRSAEncryption\"\r\n#define NID_shaWithRSAEncryption\t\t42\r\n#define OBJ_shaWithRSAEncryption\t\tOBJ_algorithm,15L\r\n\r\n#define SN_des_ede_ecb\t\t\"DES-EDE\"\r\n#define LN_des_ede_ecb\t\t\"des-ede\"\r\n#define NID_des_ede_ecb\t\t32\r\n#define OBJ_des_ede_ecb\t\tOBJ_algorithm,17L\r\n\r\n#define SN_des_ede3_ecb\t\t\"DES-EDE3\"\r\n#define LN_des_ede3_ecb\t\t\"des-ede3\"\r\n#define NID_des_ede3_ecb\t\t33\r\n\r\n#define SN_des_ede_cbc\t\t\"DES-EDE-CBC\"\r\n#define LN_des_ede_cbc\t\t\"des-ede-cbc\"\r\n#define NID_des_ede_cbc\t\t43\r\n\r\n#define SN_des_ede_cfb64\t\t\"DES-EDE-CFB\"\r\n#define LN_des_ede_cfb64\t\t\"des-ede-cfb\"\r\n#define NID_des_ede_cfb64\t\t60\r\n\r\n#define SN_des_ede3_cfb64\t\t\"DES-EDE3-CFB\"\r\n#define LN_des_ede3_cfb64\t\t\"des-ede3-cfb\"\r\n#define NID_des_ede3_cfb64\t\t61\r\n\r\n#define SN_des_ede_ofb64\t\t\"DES-EDE-OFB\"\r\n#define LN_des_ede_ofb64\t\t\"des-ede-ofb\"\r\n#define NID_des_ede_ofb64\t\t62\r\n\r\n#define SN_des_ede3_ofb64\t\t\"DES-EDE3-OFB\"\r\n#define LN_des_ede3_ofb64\t\t\"des-ede3-ofb\"\r\n#define NID_des_ede3_ofb64\t\t63\r\n\r\n#define SN_desx_cbc\t\t\"DESX-CBC\"\r\n#define LN_desx_cbc\t\t\"desx-cbc\"\r\n#define NID_desx_cbc\t\t80\r\n\r\n#define SN_sha\t\t\"SHA\"\r\n#define LN_sha\t\t\"sha\"\r\n#define NID_sha\t\t41\r\n#define OBJ_sha\t\tOBJ_algorithm,18L\r\n\r\n#define SN_sha1\t\t\"SHA1\"\r\n#define LN_sha1\t\t\"sha1\"\r\n#define NID_sha1\t\t64\r\n#define OBJ_sha1\t\tOBJ_algorithm,26L\r\n\r\n#define SN_dsaWithSHA1_2\t\t\"DSA-SHA1-old\"\r\n#define LN_dsaWithSHA1_2\t\t\"dsaWithSHA1-old\"\r\n#define NID_dsaWithSHA1_2\t\t70\r\n#define OBJ_dsaWithSHA1_2\t\tOBJ_algorithm,27L\r\n\r\n#define SN_sha1WithRSA\t\t\"RSA-SHA1-2\"\r\n#define LN_sha1WithRSA\t\t\"sha1WithRSA\"\r\n#define NID_sha1WithRSA\t\t115\r\n#define OBJ_sha1WithRSA\t\tOBJ_algorithm,29L\r\n\r\n#define SN_ripemd160\t\t\"RIPEMD160\"\r\n#define LN_ripemd160\t\t\"ripemd160\"\r\n#define NID_ripemd160\t\t117\r\n#define OBJ_ripemd160\t\t1L,3L,36L,3L,2L,1L\r\n\r\n#define SN_ripemd160WithRSA\t\t\"RSA-RIPEMD160\"\r\n#define LN_ripemd160WithRSA\t\t\"ripemd160WithRSA\"\r\n#define NID_ripemd160WithRSA\t\t119\r\n#define OBJ_ripemd160WithRSA\t\t1L,3L,36L,3L,3L,1L,2L\r\n\r\n#define SN_sxnet\t\t\"SXNetID\"\r\n#define LN_sxnet\t\t\"Strong Extranet ID\"\r\n#define NID_sxnet\t\t143\r\n#define OBJ_sxnet\t\t1L,3L,101L,1L,4L,1L\r\n\r\n#define SN_X500\t\t\"X500\"\r\n#define LN_X500\t\t\"directory services (X.500)\"\r\n#define NID_X500\t\t11\r\n#define OBJ_X500\t\t2L,5L\r\n\r\n#define SN_X509\t\t\"X509\"\r\n#define NID_X509\t\t12\r\n#define OBJ_X509\t\tOBJ_X500,4L\r\n\r\n#define SN_commonName\t\t\"CN\"\r\n#define LN_commonName\t\t\"commonName\"\r\n#define NID_commonName\t\t13\r\n#define OBJ_commonName\t\tOBJ_X509,3L\r\n\r\n#define SN_surname\t\t\"SN\"\r\n#define LN_surname\t\t\"surname\"\r\n#define NID_surname\t\t100\r\n#define OBJ_surname\t\tOBJ_X509,4L\r\n\r\n#define LN_serialNumber\t\t\"serialNumber\"\r\n#define NID_serialNumber\t\t105\r\n#define OBJ_serialNumber\t\tOBJ_X509,5L\r\n\r\n#define SN_countryName\t\t\"C\"\r\n#define LN_countryName\t\t\"countryName\"\r\n#define NID_countryName\t\t14\r\n#define OBJ_countryName\t\tOBJ_X509,6L\r\n\r\n#define SN_localityName\t\t\"L\"\r\n#define LN_localityName\t\t\"localityName\"\r\n#define NID_localityName\t\t15\r\n#define OBJ_localityName\t\tOBJ_X509,7L\r\n\r\n#define SN_stateOrProvinceName\t\t\"ST\"\r\n#define LN_stateOrProvinceName\t\t\"stateOrProvinceName\"\r\n#define NID_stateOrProvinceName\t\t16\r\n#define OBJ_stateOrProvinceName\t\tOBJ_X509,8L\r\n\r\n#define SN_streetAddress\t\t\"street\"\r\n#define LN_streetAddress\t\t\"streetAddress\"\r\n#define NID_streetAddress\t\t660\r\n#define OBJ_streetAddress\t\tOBJ_X509,9L\r\n\r\n#define SN_organizationName\t\t\"O\"\r\n#define LN_organizationName\t\t\"organizationName\"\r\n#define NID_organizationName\t\t17\r\n#define OBJ_organizationName\t\tOBJ_X509,10L\r\n\r\n#define SN_organizationalUnitName\t\t\"OU\"\r\n#define LN_organizationalUnitName\t\t\"organizationalUnitName\"\r\n#define NID_organizationalUnitName\t\t18\r\n#define OBJ_organizationalUnitName\t\tOBJ_X509,11L\r\n\r\n#define SN_title\t\t\"title\"\r\n#define LN_title\t\t\"title\"\r\n#define NID_title\t\t106\r\n#define OBJ_title\t\tOBJ_X509,12L\r\n\r\n#define LN_description\t\t\"description\"\r\n#define NID_description\t\t107\r\n#define OBJ_description\t\tOBJ_X509,13L\r\n\r\n#define LN_searchGuide\t\t\"searchGuide\"\r\n#define NID_searchGuide\t\t859\r\n#define OBJ_searchGuide\t\tOBJ_X509,14L\r\n\r\n#define LN_businessCategory\t\t\"businessCategory\"\r\n#define NID_businessCategory\t\t860\r\n#define OBJ_businessCategory\t\tOBJ_X509,15L\r\n\r\n#define LN_postalAddress\t\t\"postalAddress\"\r\n#define NID_postalAddress\t\t861\r\n#define OBJ_postalAddress\t\tOBJ_X509,16L\r\n\r\n#define LN_postalCode\t\t\"postalCode\"\r\n#define NID_postalCode\t\t661\r\n#define OBJ_postalCode\t\tOBJ_X509,17L\r\n\r\n#define LN_postOfficeBox\t\t\"postOfficeBox\"\r\n#define NID_postOfficeBox\t\t862\r\n#define OBJ_postOfficeBox\t\tOBJ_X509,18L\r\n\r\n#define LN_physicalDeliveryOfficeName\t\t\"physicalDeliveryOfficeName\"\r\n#define NID_physicalDeliveryOfficeName\t\t863\r\n#define OBJ_physicalDeliveryOfficeName\t\tOBJ_X509,19L\r\n\r\n#define LN_telephoneNumber\t\t\"telephoneNumber\"\r\n#define NID_telephoneNumber\t\t864\r\n#define OBJ_telephoneNumber\t\tOBJ_X509,20L\r\n\r\n#define LN_telexNumber\t\t\"telexNumber\"\r\n#define NID_telexNumber\t\t865\r\n#define OBJ_telexNumber\t\tOBJ_X509,21L\r\n\r\n#define LN_teletexTerminalIdentifier\t\t\"teletexTerminalIdentifier\"\r\n#define NID_teletexTerminalIdentifier\t\t866\r\n#define OBJ_teletexTerminalIdentifier\t\tOBJ_X509,22L\r\n\r\n#define LN_facsimileTelephoneNumber\t\t\"facsimileTelephoneNumber\"\r\n#define NID_facsimileTelephoneNumber\t\t867\r\n#define OBJ_facsimileTelephoneNumber\t\tOBJ_X509,23L\r\n\r\n#define LN_x121Address\t\t\"x121Address\"\r\n#define NID_x121Address\t\t868\r\n#define OBJ_x121Address\t\tOBJ_X509,24L\r\n\r\n#define LN_internationaliSDNNumber\t\t\"internationaliSDNNumber\"\r\n#define NID_internationaliSDNNumber\t\t869\r\n#define OBJ_internationaliSDNNumber\t\tOBJ_X509,25L\r\n\r\n#define LN_registeredAddress\t\t\"registeredAddress\"\r\n#define NID_registeredAddress\t\t870\r\n#define OBJ_registeredAddress\t\tOBJ_X509,26L\r\n\r\n#define LN_destinationIndicator\t\t\"destinationIndicator\"\r\n#define NID_destinationIndicator\t\t871\r\n#define OBJ_destinationIndicator\t\tOBJ_X509,27L\r\n\r\n#define LN_preferredDeliveryMethod\t\t\"preferredDeliveryMethod\"\r\n#define NID_preferredDeliveryMethod\t\t872\r\n#define OBJ_preferredDeliveryMethod\t\tOBJ_X509,28L\r\n\r\n#define LN_presentationAddress\t\t\"presentationAddress\"\r\n#define NID_presentationAddress\t\t873\r\n#define OBJ_presentationAddress\t\tOBJ_X509,29L\r\n\r\n#define LN_supportedApplicationContext\t\t\"supportedApplicationContext\"\r\n#define NID_supportedApplicationContext\t\t874\r\n#define OBJ_supportedApplicationContext\t\tOBJ_X509,30L\r\n\r\n#define SN_member\t\t\"member\"\r\n#define NID_member\t\t875\r\n#define OBJ_member\t\tOBJ_X509,31L\r\n\r\n#define SN_owner\t\t\"owner\"\r\n#define NID_owner\t\t876\r\n#define OBJ_owner\t\tOBJ_X509,32L\r\n\r\n#define LN_roleOccupant\t\t\"roleOccupant\"\r\n#define NID_roleOccupant\t\t877\r\n#define OBJ_roleOccupant\t\tOBJ_X509,33L\r\n\r\n#define SN_seeAlso\t\t\"seeAlso\"\r\n#define NID_seeAlso\t\t878\r\n#define OBJ_seeAlso\t\tOBJ_X509,34L\r\n\r\n#define LN_userPassword\t\t\"userPassword\"\r\n#define NID_userPassword\t\t879\r\n#define OBJ_userPassword\t\tOBJ_X509,35L\r\n\r\n#define LN_userCertificate\t\t\"userCertificate\"\r\n#define NID_userCertificate\t\t880\r\n#define OBJ_userCertificate\t\tOBJ_X509,36L\r\n\r\n#define LN_cACertificate\t\t\"cACertificate\"\r\n#define NID_cACertificate\t\t881\r\n#define OBJ_cACertificate\t\tOBJ_X509,37L\r\n\r\n#define LN_authorityRevocationList\t\t\"authorityRevocationList\"\r\n#define NID_authorityRevocationList\t\t882\r\n#define OBJ_authorityRevocationList\t\tOBJ_X509,38L\r\n\r\n#define LN_certificateRevocationList\t\t\"certificateRevocationList\"\r\n#define NID_certificateRevocationList\t\t883\r\n#define OBJ_certificateRevocationList\t\tOBJ_X509,39L\r\n\r\n#define LN_crossCertificatePair\t\t\"crossCertificatePair\"\r\n#define NID_crossCertificatePair\t\t884\r\n#define OBJ_crossCertificatePair\t\tOBJ_X509,40L\r\n\r\n#define SN_name\t\t\"name\"\r\n#define LN_name\t\t\"name\"\r\n#define NID_name\t\t173\r\n#define OBJ_name\t\tOBJ_X509,41L\r\n\r\n#define SN_givenName\t\t\"GN\"\r\n#define LN_givenName\t\t\"givenName\"\r\n#define NID_givenName\t\t99\r\n#define OBJ_givenName\t\tOBJ_X509,42L\r\n\r\n#define SN_initials\t\t\"initials\"\r\n#define LN_initials\t\t\"initials\"\r\n#define NID_initials\t\t101\r\n#define OBJ_initials\t\tOBJ_X509,43L\r\n\r\n#define LN_generationQualifier\t\t\"generationQualifier\"\r\n#define NID_generationQualifier\t\t509\r\n#define OBJ_generationQualifier\t\tOBJ_X509,44L\r\n\r\n#define LN_x500UniqueIdentifier\t\t\"x500UniqueIdentifier\"\r\n#define NID_x500UniqueIdentifier\t\t503\r\n#define OBJ_x500UniqueIdentifier\t\tOBJ_X509,45L\r\n\r\n#define SN_dnQualifier\t\t\"dnQualifier\"\r\n#define LN_dnQualifier\t\t\"dnQualifier\"\r\n#define NID_dnQualifier\t\t174\r\n#define OBJ_dnQualifier\t\tOBJ_X509,46L\r\n\r\n#define LN_enhancedSearchGuide\t\t\"enhancedSearchGuide\"\r\n#define NID_enhancedSearchGuide\t\t885\r\n#define OBJ_enhancedSearchGuide\t\tOBJ_X509,47L\r\n\r\n#define LN_protocolInformation\t\t\"protocolInformation\"\r\n#define NID_protocolInformation\t\t886\r\n#define OBJ_protocolInformation\t\tOBJ_X509,48L\r\n\r\n#define LN_distinguishedName\t\t\"distinguishedName\"\r\n#define NID_distinguishedName\t\t887\r\n#define OBJ_distinguishedName\t\tOBJ_X509,49L\r\n\r\n#define LN_uniqueMember\t\t\"uniqueMember\"\r\n#define NID_uniqueMember\t\t888\r\n#define OBJ_uniqueMember\t\tOBJ_X509,50L\r\n\r\n#define LN_houseIdentifier\t\t\"houseIdentifier\"\r\n#define NID_houseIdentifier\t\t889\r\n#define OBJ_houseIdentifier\t\tOBJ_X509,51L\r\n\r\n#define LN_supportedAlgorithms\t\t\"supportedAlgorithms\"\r\n#define NID_supportedAlgorithms\t\t890\r\n#define OBJ_supportedAlgorithms\t\tOBJ_X509,52L\r\n\r\n#define LN_deltaRevocationList\t\t\"deltaRevocationList\"\r\n#define NID_deltaRevocationList\t\t891\r\n#define OBJ_deltaRevocationList\t\tOBJ_X509,53L\r\n\r\n#define SN_dmdName\t\t\"dmdName\"\r\n#define NID_dmdName\t\t892\r\n#define OBJ_dmdName\t\tOBJ_X509,54L\r\n\r\n#define LN_pseudonym\t\t\"pseudonym\"\r\n#define NID_pseudonym\t\t510\r\n#define OBJ_pseudonym\t\tOBJ_X509,65L\r\n\r\n#define SN_role\t\t\"role\"\r\n#define LN_role\t\t\"role\"\r\n#define NID_role\t\t400\r\n#define OBJ_role\t\tOBJ_X509,72L\r\n\r\n#define SN_X500algorithms\t\t\"X500algorithms\"\r\n#define LN_X500algorithms\t\t\"directory services - algorithms\"\r\n#define NID_X500algorithms\t\t378\r\n#define OBJ_X500algorithms\t\tOBJ_X500,8L\r\n\r\n#define SN_rsa\t\t\"RSA\"\r\n#define LN_rsa\t\t\"rsa\"\r\n#define NID_rsa\t\t19\r\n#define OBJ_rsa\t\tOBJ_X500algorithms,1L,1L\r\n\r\n#define SN_mdc2WithRSA\t\t\"RSA-MDC2\"\r\n#define LN_mdc2WithRSA\t\t\"mdc2WithRSA\"\r\n#define NID_mdc2WithRSA\t\t96\r\n#define OBJ_mdc2WithRSA\t\tOBJ_X500algorithms,3L,100L\r\n\r\n#define SN_mdc2\t\t\"MDC2\"\r\n#define LN_mdc2\t\t\"mdc2\"\r\n#define NID_mdc2\t\t95\r\n#define OBJ_mdc2\t\tOBJ_X500algorithms,3L,101L\r\n\r\n#define SN_id_ce\t\t\"id-ce\"\r\n#define NID_id_ce\t\t81\r\n#define OBJ_id_ce\t\tOBJ_X500,29L\r\n\r\n#define SN_subject_directory_attributes\t\t\"subjectDirectoryAttributes\"\r\n#define LN_subject_directory_attributes\t\t\"X509v3 Subject Directory Attributes\"\r\n#define NID_subject_directory_attributes\t\t769\r\n#define OBJ_subject_directory_attributes\t\tOBJ_id_ce,9L\r\n\r\n#define SN_subject_key_identifier\t\t\"subjectKeyIdentifier\"\r\n#define LN_subject_key_identifier\t\t\"X509v3 Subject Key Identifier\"\r\n#define NID_subject_key_identifier\t\t82\r\n#define OBJ_subject_key_identifier\t\tOBJ_id_ce,14L\r\n\r\n#define SN_key_usage\t\t\"keyUsage\"\r\n#define LN_key_usage\t\t\"X509v3 Key Usage\"\r\n#define NID_key_usage\t\t83\r\n#define OBJ_key_usage\t\tOBJ_id_ce,15L\r\n\r\n#define SN_private_key_usage_period\t\t\"privateKeyUsagePeriod\"\r\n#define LN_private_key_usage_period\t\t\"X509v3 Private Key Usage Period\"\r\n#define NID_private_key_usage_period\t\t84\r\n#define OBJ_private_key_usage_period\t\tOBJ_id_ce,16L\r\n\r\n#define SN_subject_alt_name\t\t\"subjectAltName\"\r\n#define LN_subject_alt_name\t\t\"X509v3 Subject Alternative Name\"\r\n#define NID_subject_alt_name\t\t85\r\n#define OBJ_subject_alt_name\t\tOBJ_id_ce,17L\r\n\r\n#define SN_issuer_alt_name\t\t\"issuerAltName\"\r\n#define LN_issuer_alt_name\t\t\"X509v3 Issuer Alternative Name\"\r\n#define NID_issuer_alt_name\t\t86\r\n#define OBJ_issuer_alt_name\t\tOBJ_id_ce,18L\r\n\r\n#define SN_basic_constraints\t\t\"basicConstraints\"\r\n#define LN_basic_constraints\t\t\"X509v3 Basic Constraints\"\r\n#define NID_basic_constraints\t\t87\r\n#define OBJ_basic_constraints\t\tOBJ_id_ce,19L\r\n\r\n#define SN_crl_number\t\t\"crlNumber\"\r\n#define LN_crl_number\t\t\"X509v3 CRL Number\"\r\n#define NID_crl_number\t\t88\r\n#define OBJ_crl_number\t\tOBJ_id_ce,20L\r\n\r\n#define SN_crl_reason\t\t\"CRLReason\"\r\n#define LN_crl_reason\t\t\"X509v3 CRL Reason Code\"\r\n#define NID_crl_reason\t\t141\r\n#define OBJ_crl_reason\t\tOBJ_id_ce,21L\r\n\r\n#define SN_invalidity_date\t\t\"invalidityDate\"\r\n#define LN_invalidity_date\t\t\"Invalidity Date\"\r\n#define NID_invalidity_date\t\t142\r\n#define OBJ_invalidity_date\t\tOBJ_id_ce,24L\r\n\r\n#define SN_delta_crl\t\t\"deltaCRL\"\r\n#define LN_delta_crl\t\t\"X509v3 Delta CRL Indicator\"\r\n#define NID_delta_crl\t\t140\r\n#define OBJ_delta_crl\t\tOBJ_id_ce,27L\r\n\r\n#define SN_issuing_distribution_point\t\t\"issuingDistributionPoint\"\r\n#define LN_issuing_distribution_point\t\t\"X509v3 Issuing Distrubution Point\"\r\n#define NID_issuing_distribution_point\t\t770\r\n#define OBJ_issuing_distribution_point\t\tOBJ_id_ce,28L\r\n\r\n#define SN_certificate_issuer\t\t\"certificateIssuer\"\r\n#define LN_certificate_issuer\t\t\"X509v3 Certificate Issuer\"\r\n#define NID_certificate_issuer\t\t771\r\n#define OBJ_certificate_issuer\t\tOBJ_id_ce,29L\r\n\r\n#define SN_name_constraints\t\t\"nameConstraints\"\r\n#define LN_name_constraints\t\t\"X509v3 Name Constraints\"\r\n#define NID_name_constraints\t\t666\r\n#define OBJ_name_constraints\t\tOBJ_id_ce,30L\r\n\r\n#define SN_crl_distribution_points\t\t\"crlDistributionPoints\"\r\n#define LN_crl_distribution_points\t\t\"X509v3 CRL Distribution Points\"\r\n#define NID_crl_distribution_points\t\t103\r\n#define OBJ_crl_distribution_points\t\tOBJ_id_ce,31L\r\n\r\n#define SN_certificate_policies\t\t\"certificatePolicies\"\r\n#define LN_certificate_policies\t\t\"X509v3 Certificate Policies\"\r\n#define NID_certificate_policies\t\t89\r\n#define OBJ_certificate_policies\t\tOBJ_id_ce,32L\r\n\r\n#define SN_any_policy\t\t\"anyPolicy\"\r\n#define LN_any_policy\t\t\"X509v3 Any Policy\"\r\n#define NID_any_policy\t\t746\r\n#define OBJ_any_policy\t\tOBJ_certificate_policies,0L\r\n\r\n#define SN_policy_mappings\t\t\"policyMappings\"\r\n#define LN_policy_mappings\t\t\"X509v3 Policy Mappings\"\r\n#define NID_policy_mappings\t\t747\r\n#define OBJ_policy_mappings\t\tOBJ_id_ce,33L\r\n\r\n#define SN_authority_key_identifier\t\t\"authorityKeyIdentifier\"\r\n#define LN_authority_key_identifier\t\t\"X509v3 Authority Key Identifier\"\r\n#define NID_authority_key_identifier\t\t90\r\n#define OBJ_authority_key_identifier\t\tOBJ_id_ce,35L\r\n\r\n#define SN_policy_constraints\t\t\"policyConstraints\"\r\n#define LN_policy_constraints\t\t\"X509v3 Policy Constraints\"\r\n#define NID_policy_constraints\t\t401\r\n#define OBJ_policy_constraints\t\tOBJ_id_ce,36L\r\n\r\n#define SN_ext_key_usage\t\t\"extendedKeyUsage\"\r\n#define LN_ext_key_usage\t\t\"X509v3 Extended Key Usage\"\r\n#define NID_ext_key_usage\t\t126\r\n#define OBJ_ext_key_usage\t\tOBJ_id_ce,37L\r\n\r\n#define SN_freshest_crl\t\t\"freshestCRL\"\r\n#define LN_freshest_crl\t\t\"X509v3 Freshest CRL\"\r\n#define NID_freshest_crl\t\t857\r\n#define OBJ_freshest_crl\t\tOBJ_id_ce,46L\r\n\r\n#define SN_inhibit_any_policy\t\t\"inhibitAnyPolicy\"\r\n#define LN_inhibit_any_policy\t\t\"X509v3 Inhibit Any Policy\"\r\n#define NID_inhibit_any_policy\t\t748\r\n#define OBJ_inhibit_any_policy\t\tOBJ_id_ce,54L\r\n\r\n#define SN_target_information\t\t\"targetInformation\"\r\n#define LN_target_information\t\t\"X509v3 AC Targeting\"\r\n#define NID_target_information\t\t402\r\n#define OBJ_target_information\t\tOBJ_id_ce,55L\r\n\r\n#define SN_no_rev_avail\t\t\"noRevAvail\"\r\n#define LN_no_rev_avail\t\t\"X509v3 No Revocation Available\"\r\n#define NID_no_rev_avail\t\t403\r\n#define OBJ_no_rev_avail\t\tOBJ_id_ce,56L\r\n\r\n#define SN_anyExtendedKeyUsage\t\t\"anyExtendedKeyUsage\"\r\n#define LN_anyExtendedKeyUsage\t\t\"Any Extended Key Usage\"\r\n#define NID_anyExtendedKeyUsage\t\t910\r\n#define OBJ_anyExtendedKeyUsage\t\tOBJ_ext_key_usage,0L\r\n\r\n#define SN_netscape\t\t\"Netscape\"\r\n#define LN_netscape\t\t\"Netscape Communications Corp.\"\r\n#define NID_netscape\t\t57\r\n#define OBJ_netscape\t\t2L,16L,840L,1L,113730L\r\n\r\n#define SN_netscape_cert_extension\t\t\"nsCertExt\"\r\n#define LN_netscape_cert_extension\t\t\"Netscape Certificate Extension\"\r\n#define NID_netscape_cert_extension\t\t58\r\n#define OBJ_netscape_cert_extension\t\tOBJ_netscape,1L\r\n\r\n#define SN_netscape_data_type\t\t\"nsDataType\"\r\n#define LN_netscape_data_type\t\t\"Netscape Data Type\"\r\n#define NID_netscape_data_type\t\t59\r\n#define OBJ_netscape_data_type\t\tOBJ_netscape,2L\r\n\r\n#define SN_netscape_cert_type\t\t\"nsCertType\"\r\n#define LN_netscape_cert_type\t\t\"Netscape Cert Type\"\r\n#define NID_netscape_cert_type\t\t71\r\n#define OBJ_netscape_cert_type\t\tOBJ_netscape_cert_extension,1L\r\n\r\n#define SN_netscape_base_url\t\t\"nsBaseUrl\"\r\n#define LN_netscape_base_url\t\t\"Netscape Base Url\"\r\n#define NID_netscape_base_url\t\t72\r\n#define OBJ_netscape_base_url\t\tOBJ_netscape_cert_extension,2L\r\n\r\n#define SN_netscape_revocation_url\t\t\"nsRevocationUrl\"\r\n#define LN_netscape_revocation_url\t\t\"Netscape Revocation Url\"\r\n#define NID_netscape_revocation_url\t\t73\r\n#define OBJ_netscape_revocation_url\t\tOBJ_netscape_cert_extension,3L\r\n\r\n#define SN_netscape_ca_revocation_url\t\t\"nsCaRevocationUrl\"\r\n#define LN_netscape_ca_revocation_url\t\t\"Netscape CA Revocation Url\"\r\n#define NID_netscape_ca_revocation_url\t\t74\r\n#define OBJ_netscape_ca_revocation_url\t\tOBJ_netscape_cert_extension,4L\r\n\r\n#define SN_netscape_renewal_url\t\t\"nsRenewalUrl\"\r\n#define LN_netscape_renewal_url\t\t\"Netscape Renewal Url\"\r\n#define NID_netscape_renewal_url\t\t75\r\n#define OBJ_netscape_renewal_url\t\tOBJ_netscape_cert_extension,7L\r\n\r\n#define SN_netscape_ca_policy_url\t\t\"nsCaPolicyUrl\"\r\n#define LN_netscape_ca_policy_url\t\t\"Netscape CA Policy Url\"\r\n#define NID_netscape_ca_policy_url\t\t76\r\n#define OBJ_netscape_ca_policy_url\t\tOBJ_netscape_cert_extension,8L\r\n\r\n#define SN_netscape_ssl_server_name\t\t\"nsSslServerName\"\r\n#define LN_netscape_ssl_server_name\t\t\"Netscape SSL Server Name\"\r\n#define NID_netscape_ssl_server_name\t\t77\r\n#define OBJ_netscape_ssl_server_name\t\tOBJ_netscape_cert_extension,12L\r\n\r\n#define SN_netscape_comment\t\t\"nsComment\"\r\n#define LN_netscape_comment\t\t\"Netscape Comment\"\r\n#define NID_netscape_comment\t\t78\r\n#define OBJ_netscape_comment\t\tOBJ_netscape_cert_extension,13L\r\n\r\n#define SN_netscape_cert_sequence\t\t\"nsCertSequence\"\r\n#define LN_netscape_cert_sequence\t\t\"Netscape Certificate Sequence\"\r\n#define NID_netscape_cert_sequence\t\t79\r\n#define OBJ_netscape_cert_sequence\t\tOBJ_netscape_data_type,5L\r\n\r\n#define SN_ns_sgc\t\t\"nsSGC\"\r\n#define LN_ns_sgc\t\t\"Netscape Server Gated Crypto\"\r\n#define NID_ns_sgc\t\t139\r\n#define OBJ_ns_sgc\t\tOBJ_netscape,4L,1L\r\n\r\n#define SN_org\t\t\"ORG\"\r\n#define LN_org\t\t\"org\"\r\n#define NID_org\t\t379\r\n#define OBJ_org\t\tOBJ_iso,3L\r\n\r\n#define SN_dod\t\t\"DOD\"\r\n#define LN_dod\t\t\"dod\"\r\n#define NID_dod\t\t380\r\n#define OBJ_dod\t\tOBJ_org,6L\r\n\r\n#define SN_iana\t\t\"IANA\"\r\n#define LN_iana\t\t\"iana\"\r\n#define NID_iana\t\t381\r\n#define OBJ_iana\t\tOBJ_dod,1L\r\n\r\n#define OBJ_internet\t\tOBJ_iana\r\n\r\n#define SN_Directory\t\t\"directory\"\r\n#define LN_Directory\t\t\"Directory\"\r\n#define NID_Directory\t\t382\r\n#define OBJ_Directory\t\tOBJ_internet,1L\r\n\r\n#define SN_Management\t\t\"mgmt\"\r\n#define LN_Management\t\t\"Management\"\r\n#define NID_Management\t\t383\r\n#define OBJ_Management\t\tOBJ_internet,2L\r\n\r\n#define SN_Experimental\t\t\"experimental\"\r\n#define LN_Experimental\t\t\"Experimental\"\r\n#define NID_Experimental\t\t384\r\n#define OBJ_Experimental\t\tOBJ_internet,3L\r\n\r\n#define SN_Private\t\t\"private\"\r\n#define LN_Private\t\t\"Private\"\r\n#define NID_Private\t\t385\r\n#define OBJ_Private\t\tOBJ_internet,4L\r\n\r\n#define SN_Security\t\t\"security\"\r\n#define LN_Security\t\t\"Security\"\r\n#define NID_Security\t\t386\r\n#define OBJ_Security\t\tOBJ_internet,5L\r\n\r\n#define SN_SNMPv2\t\t\"snmpv2\"\r\n#define LN_SNMPv2\t\t\"SNMPv2\"\r\n#define NID_SNMPv2\t\t387\r\n#define OBJ_SNMPv2\t\tOBJ_internet,6L\r\n\r\n#define LN_Mail\t\t\"Mail\"\r\n#define NID_Mail\t\t388\r\n#define OBJ_Mail\t\tOBJ_internet,7L\r\n\r\n#define SN_Enterprises\t\t\"enterprises\"\r\n#define LN_Enterprises\t\t\"Enterprises\"\r\n#define NID_Enterprises\t\t389\r\n#define OBJ_Enterprises\t\tOBJ_Private,1L\r\n\r\n#define SN_dcObject\t\t\"dcobject\"\r\n#define LN_dcObject\t\t\"dcObject\"\r\n#define NID_dcObject\t\t390\r\n#define OBJ_dcObject\t\tOBJ_Enterprises,1466L,344L\r\n\r\n#define SN_mime_mhs\t\t\"mime-mhs\"\r\n#define LN_mime_mhs\t\t\"MIME MHS\"\r\n#define NID_mime_mhs\t\t504\r\n#define OBJ_mime_mhs\t\tOBJ_Mail,1L\r\n\r\n#define SN_mime_mhs_headings\t\t\"mime-mhs-headings\"\r\n#define LN_mime_mhs_headings\t\t\"mime-mhs-headings\"\r\n#define NID_mime_mhs_headings\t\t505\r\n#define OBJ_mime_mhs_headings\t\tOBJ_mime_mhs,1L\r\n\r\n#define SN_mime_mhs_bodies\t\t\"mime-mhs-bodies\"\r\n#define LN_mime_mhs_bodies\t\t\"mime-mhs-bodies\"\r\n#define NID_mime_mhs_bodies\t\t506\r\n#define OBJ_mime_mhs_bodies\t\tOBJ_mime_mhs,2L\r\n\r\n#define SN_id_hex_partial_message\t\t\"id-hex-partial-message\"\r\n#define LN_id_hex_partial_message\t\t\"id-hex-partial-message\"\r\n#define NID_id_hex_partial_message\t\t507\r\n#define OBJ_id_hex_partial_message\t\tOBJ_mime_mhs_headings,1L\r\n\r\n#define SN_id_hex_multipart_message\t\t\"id-hex-multipart-message\"\r\n#define LN_id_hex_multipart_message\t\t\"id-hex-multipart-message\"\r\n#define NID_id_hex_multipart_message\t\t508\r\n#define OBJ_id_hex_multipart_message\t\tOBJ_mime_mhs_headings,2L\r\n\r\n#define SN_rle_compression\t\t\"RLE\"\r\n#define LN_rle_compression\t\t\"run length compression\"\r\n#define NID_rle_compression\t\t124\r\n#define OBJ_rle_compression\t\t1L,1L,1L,1L,666L,1L\r\n\r\n#define SN_zlib_compression\t\t\"ZLIB\"\r\n#define LN_zlib_compression\t\t\"zlib compression\"\r\n#define NID_zlib_compression\t\t125\r\n#define OBJ_zlib_compression\t\tOBJ_id_smime_alg,8L\r\n\r\n#define OBJ_csor\t\t2L,16L,840L,1L,101L,3L\r\n\r\n#define OBJ_nistAlgorithms\t\tOBJ_csor,4L\r\n\r\n#define OBJ_aes\t\tOBJ_nistAlgorithms,1L\r\n\r\n#define SN_aes_128_ecb\t\t\"AES-128-ECB\"\r\n#define LN_aes_128_ecb\t\t\"aes-128-ecb\"\r\n#define NID_aes_128_ecb\t\t418\r\n#define OBJ_aes_128_ecb\t\tOBJ_aes,1L\r\n\r\n#define SN_aes_128_cbc\t\t\"AES-128-CBC\"\r\n#define LN_aes_128_cbc\t\t\"aes-128-cbc\"\r\n#define NID_aes_128_cbc\t\t419\r\n#define OBJ_aes_128_cbc\t\tOBJ_aes,2L\r\n\r\n#define SN_aes_128_ofb128\t\t\"AES-128-OFB\"\r\n#define LN_aes_128_ofb128\t\t\"aes-128-ofb\"\r\n#define NID_aes_128_ofb128\t\t420\r\n#define OBJ_aes_128_ofb128\t\tOBJ_aes,3L\r\n\r\n#define SN_aes_128_cfb128\t\t\"AES-128-CFB\"\r\n#define LN_aes_128_cfb128\t\t\"aes-128-cfb\"\r\n#define NID_aes_128_cfb128\t\t421\r\n#define OBJ_aes_128_cfb128\t\tOBJ_aes,4L\r\n\r\n#define SN_id_aes128_wrap\t\t\"id-aes128-wrap\"\r\n#define NID_id_aes128_wrap\t\t788\r\n#define OBJ_id_aes128_wrap\t\tOBJ_aes,5L\r\n\r\n#define SN_aes_128_gcm\t\t\"id-aes128-GCM\"\r\n#define LN_aes_128_gcm\t\t\"aes-128-gcm\"\r\n#define NID_aes_128_gcm\t\t895\r\n#define OBJ_aes_128_gcm\t\tOBJ_aes,6L\r\n\r\n#define SN_aes_128_ccm\t\t\"id-aes128-CCM\"\r\n#define LN_aes_128_ccm\t\t\"aes-128-ccm\"\r\n#define NID_aes_128_ccm\t\t896\r\n#define OBJ_aes_128_ccm\t\tOBJ_aes,7L\r\n\r\n#define SN_id_aes128_wrap_pad\t\t\"id-aes128-wrap-pad\"\r\n#define NID_id_aes128_wrap_pad\t\t897\r\n#define OBJ_id_aes128_wrap_pad\t\tOBJ_aes,8L\r\n\r\n#define SN_aes_192_ecb\t\t\"AES-192-ECB\"\r\n#define LN_aes_192_ecb\t\t\"aes-192-ecb\"\r\n#define NID_aes_192_ecb\t\t422\r\n#define OBJ_aes_192_ecb\t\tOBJ_aes,21L\r\n\r\n#define SN_aes_192_cbc\t\t\"AES-192-CBC\"\r\n#define LN_aes_192_cbc\t\t\"aes-192-cbc\"\r\n#define NID_aes_192_cbc\t\t423\r\n#define OBJ_aes_192_cbc\t\tOBJ_aes,22L\r\n\r\n#define SN_aes_192_ofb128\t\t\"AES-192-OFB\"\r\n#define LN_aes_192_ofb128\t\t\"aes-192-ofb\"\r\n#define NID_aes_192_ofb128\t\t424\r\n#define OBJ_aes_192_ofb128\t\tOBJ_aes,23L\r\n\r\n#define SN_aes_192_cfb128\t\t\"AES-192-CFB\"\r\n#define LN_aes_192_cfb128\t\t\"aes-192-cfb\"\r\n#define NID_aes_192_cfb128\t\t425\r\n#define OBJ_aes_192_cfb128\t\tOBJ_aes,24L\r\n\r\n#define SN_id_aes192_wrap\t\t\"id-aes192-wrap\"\r\n#define NID_id_aes192_wrap\t\t789\r\n#define OBJ_id_aes192_wrap\t\tOBJ_aes,25L\r\n\r\n#define SN_aes_192_gcm\t\t\"id-aes192-GCM\"\r\n#define LN_aes_192_gcm\t\t\"aes-192-gcm\"\r\n#define NID_aes_192_gcm\t\t898\r\n#define OBJ_aes_192_gcm\t\tOBJ_aes,26L\r\n\r\n#define SN_aes_192_ccm\t\t\"id-aes192-CCM\"\r\n#define LN_aes_192_ccm\t\t\"aes-192-ccm\"\r\n#define NID_aes_192_ccm\t\t899\r\n#define OBJ_aes_192_ccm\t\tOBJ_aes,27L\r\n\r\n#define SN_id_aes192_wrap_pad\t\t\"id-aes192-wrap-pad\"\r\n#define NID_id_aes192_wrap_pad\t\t900\r\n#define OBJ_id_aes192_wrap_pad\t\tOBJ_aes,28L\r\n\r\n#define SN_aes_256_ecb\t\t\"AES-256-ECB\"\r\n#define LN_aes_256_ecb\t\t\"aes-256-ecb\"\r\n#define NID_aes_256_ecb\t\t426\r\n#define OBJ_aes_256_ecb\t\tOBJ_aes,41L\r\n\r\n#define SN_aes_256_cbc\t\t\"AES-256-CBC\"\r\n#define LN_aes_256_cbc\t\t\"aes-256-cbc\"\r\n#define NID_aes_256_cbc\t\t427\r\n#define OBJ_aes_256_cbc\t\tOBJ_aes,42L\r\n\r\n#define SN_aes_256_ofb128\t\t\"AES-256-OFB\"\r\n#define LN_aes_256_ofb128\t\t\"aes-256-ofb\"\r\n#define NID_aes_256_ofb128\t\t428\r\n#define OBJ_aes_256_ofb128\t\tOBJ_aes,43L\r\n\r\n#define SN_aes_256_cfb128\t\t\"AES-256-CFB\"\r\n#define LN_aes_256_cfb128\t\t\"aes-256-cfb\"\r\n#define NID_aes_256_cfb128\t\t429\r\n#define OBJ_aes_256_cfb128\t\tOBJ_aes,44L\r\n\r\n#define SN_id_aes256_wrap\t\t\"id-aes256-wrap\"\r\n#define NID_id_aes256_wrap\t\t790\r\n#define OBJ_id_aes256_wrap\t\tOBJ_aes,45L\r\n\r\n#define SN_aes_256_gcm\t\t\"id-aes256-GCM\"\r\n#define LN_aes_256_gcm\t\t\"aes-256-gcm\"\r\n#define NID_aes_256_gcm\t\t901\r\n#define OBJ_aes_256_gcm\t\tOBJ_aes,46L\r\n\r\n#define SN_aes_256_ccm\t\t\"id-aes256-CCM\"\r\n#define LN_aes_256_ccm\t\t\"aes-256-ccm\"\r\n#define NID_aes_256_ccm\t\t902\r\n#define OBJ_aes_256_ccm\t\tOBJ_aes,47L\r\n\r\n#define SN_id_aes256_wrap_pad\t\t\"id-aes256-wrap-pad\"\r\n#define NID_id_aes256_wrap_pad\t\t903\r\n#define OBJ_id_aes256_wrap_pad\t\tOBJ_aes,48L\r\n\r\n#define SN_aes_128_cfb1\t\t\"AES-128-CFB1\"\r\n#define LN_aes_128_cfb1\t\t\"aes-128-cfb1\"\r\n#define NID_aes_128_cfb1\t\t650\r\n\r\n#define SN_aes_192_cfb1\t\t\"AES-192-CFB1\"\r\n#define LN_aes_192_cfb1\t\t\"aes-192-cfb1\"\r\n#define NID_aes_192_cfb1\t\t651\r\n\r\n#define SN_aes_256_cfb1\t\t\"AES-256-CFB1\"\r\n#define LN_aes_256_cfb1\t\t\"aes-256-cfb1\"\r\n#define NID_aes_256_cfb1\t\t652\r\n\r\n#define SN_aes_128_cfb8\t\t\"AES-128-CFB8\"\r\n#define LN_aes_128_cfb8\t\t\"aes-128-cfb8\"\r\n#define NID_aes_128_cfb8\t\t653\r\n\r\n#define SN_aes_192_cfb8\t\t\"AES-192-CFB8\"\r\n#define LN_aes_192_cfb8\t\t\"aes-192-cfb8\"\r\n#define NID_aes_192_cfb8\t\t654\r\n\r\n#define SN_aes_256_cfb8\t\t\"AES-256-CFB8\"\r\n#define LN_aes_256_cfb8\t\t\"aes-256-cfb8\"\r\n#define NID_aes_256_cfb8\t\t655\r\n\r\n#define SN_aes_128_ctr\t\t\"AES-128-CTR\"\r\n#define LN_aes_128_ctr\t\t\"aes-128-ctr\"\r\n#define NID_aes_128_ctr\t\t904\r\n\r\n#define SN_aes_192_ctr\t\t\"AES-192-CTR\"\r\n#define LN_aes_192_ctr\t\t\"aes-192-ctr\"\r\n#define NID_aes_192_ctr\t\t905\r\n\r\n#define SN_aes_256_ctr\t\t\"AES-256-CTR\"\r\n#define LN_aes_256_ctr\t\t\"aes-256-ctr\"\r\n#define NID_aes_256_ctr\t\t906\r\n\r\n#define SN_aes_128_xts\t\t\"AES-128-XTS\"\r\n#define LN_aes_128_xts\t\t\"aes-128-xts\"\r\n#define NID_aes_128_xts\t\t913\r\n\r\n#define SN_aes_256_xts\t\t\"AES-256-XTS\"\r\n#define LN_aes_256_xts\t\t\"aes-256-xts\"\r\n#define NID_aes_256_xts\t\t914\r\n\r\n#define SN_des_cfb1\t\t\"DES-CFB1\"\r\n#define LN_des_cfb1\t\t\"des-cfb1\"\r\n#define NID_des_cfb1\t\t656\r\n\r\n#define SN_des_cfb8\t\t\"DES-CFB8\"\r\n#define LN_des_cfb8\t\t\"des-cfb8\"\r\n#define NID_des_cfb8\t\t657\r\n\r\n#define SN_des_ede3_cfb1\t\t\"DES-EDE3-CFB1\"\r\n#define LN_des_ede3_cfb1\t\t\"des-ede3-cfb1\"\r\n#define NID_des_ede3_cfb1\t\t658\r\n\r\n#define SN_des_ede3_cfb8\t\t\"DES-EDE3-CFB8\"\r\n#define LN_des_ede3_cfb8\t\t\"des-ede3-cfb8\"\r\n#define NID_des_ede3_cfb8\t\t659\r\n\r\n#define OBJ_nist_hashalgs\t\tOBJ_nistAlgorithms,2L\r\n\r\n#define SN_sha256\t\t\"SHA256\"\r\n#define LN_sha256\t\t\"sha256\"\r\n#define NID_sha256\t\t672\r\n#define OBJ_sha256\t\tOBJ_nist_hashalgs,1L\r\n\r\n#define SN_sha384\t\t\"SHA384\"\r\n#define LN_sha384\t\t\"sha384\"\r\n#define NID_sha384\t\t673\r\n#define OBJ_sha384\t\tOBJ_nist_hashalgs,2L\r\n\r\n#define SN_sha512\t\t\"SHA512\"\r\n#define LN_sha512\t\t\"sha512\"\r\n#define NID_sha512\t\t674\r\n#define OBJ_sha512\t\tOBJ_nist_hashalgs,3L\r\n\r\n#define SN_sha224\t\t\"SHA224\"\r\n#define LN_sha224\t\t\"sha224\"\r\n#define NID_sha224\t\t675\r\n#define OBJ_sha224\t\tOBJ_nist_hashalgs,4L\r\n\r\n#define OBJ_dsa_with_sha2\t\tOBJ_nistAlgorithms,3L\r\n\r\n#define SN_dsa_with_SHA224\t\t\"dsa_with_SHA224\"\r\n#define NID_dsa_with_SHA224\t\t802\r\n#define OBJ_dsa_with_SHA224\t\tOBJ_dsa_with_sha2,1L\r\n\r\n#define SN_dsa_with_SHA256\t\t\"dsa_with_SHA256\"\r\n#define NID_dsa_with_SHA256\t\t803\r\n#define OBJ_dsa_with_SHA256\t\tOBJ_dsa_with_sha2,2L\r\n\r\n#define SN_hold_instruction_code\t\t\"holdInstructionCode\"\r\n#define LN_hold_instruction_code\t\t\"Hold Instruction Code\"\r\n#define NID_hold_instruction_code\t\t430\r\n#define OBJ_hold_instruction_code\t\tOBJ_id_ce,23L\r\n\r\n#define OBJ_holdInstruction\t\tOBJ_X9_57,2L\r\n\r\n#define SN_hold_instruction_none\t\t\"holdInstructionNone\"\r\n#define LN_hold_instruction_none\t\t\"Hold Instruction None\"\r\n#define NID_hold_instruction_none\t\t431\r\n#define OBJ_hold_instruction_none\t\tOBJ_holdInstruction,1L\r\n\r\n#define SN_hold_instruction_call_issuer\t\t\"holdInstructionCallIssuer\"\r\n#define LN_hold_instruction_call_issuer\t\t\"Hold Instruction Call Issuer\"\r\n#define NID_hold_instruction_call_issuer\t\t432\r\n#define OBJ_hold_instruction_call_issuer\t\tOBJ_holdInstruction,2L\r\n\r\n#define SN_hold_instruction_reject\t\t\"holdInstructionReject\"\r\n#define LN_hold_instruction_reject\t\t\"Hold Instruction Reject\"\r\n#define NID_hold_instruction_reject\t\t433\r\n#define OBJ_hold_instruction_reject\t\tOBJ_holdInstruction,3L\r\n\r\n#define SN_data\t\t\"data\"\r\n#define NID_data\t\t434\r\n#define OBJ_data\t\tOBJ_itu_t,9L\r\n\r\n#define SN_pss\t\t\"pss\"\r\n#define NID_pss\t\t435\r\n#define OBJ_pss\t\tOBJ_data,2342L\r\n\r\n#define SN_ucl\t\t\"ucl\"\r\n#define NID_ucl\t\t436\r\n#define OBJ_ucl\t\tOBJ_pss,19200300L\r\n\r\n#define SN_pilot\t\t\"pilot\"\r\n#define NID_pilot\t\t437\r\n#define OBJ_pilot\t\tOBJ_ucl,100L\r\n\r\n#define LN_pilotAttributeType\t\t\"pilotAttributeType\"\r\n#define NID_pilotAttributeType\t\t438\r\n#define OBJ_pilotAttributeType\t\tOBJ_pilot,1L\r\n\r\n#define LN_pilotAttributeSyntax\t\t\"pilotAttributeSyntax\"\r\n#define NID_pilotAttributeSyntax\t\t439\r\n#define OBJ_pilotAttributeSyntax\t\tOBJ_pilot,3L\r\n\r\n#define LN_pilotObjectClass\t\t\"pilotObjectClass\"\r\n#define NID_pilotObjectClass\t\t440\r\n#define OBJ_pilotObjectClass\t\tOBJ_pilot,4L\r\n\r\n#define LN_pilotGroups\t\t\"pilotGroups\"\r\n#define NID_pilotGroups\t\t441\r\n#define OBJ_pilotGroups\t\tOBJ_pilot,10L\r\n\r\n#define LN_iA5StringSyntax\t\t\"iA5StringSyntax\"\r\n#define NID_iA5StringSyntax\t\t442\r\n#define OBJ_iA5StringSyntax\t\tOBJ_pilotAttributeSyntax,4L\r\n\r\n#define LN_caseIgnoreIA5StringSyntax\t\t\"caseIgnoreIA5StringSyntax\"\r\n#define NID_caseIgnoreIA5StringSyntax\t\t443\r\n#define OBJ_caseIgnoreIA5StringSyntax\t\tOBJ_pilotAttributeSyntax,5L\r\n\r\n#define LN_pilotObject\t\t\"pilotObject\"\r\n#define NID_pilotObject\t\t444\r\n#define OBJ_pilotObject\t\tOBJ_pilotObjectClass,3L\r\n\r\n#define LN_pilotPerson\t\t\"pilotPerson\"\r\n#define NID_pilotPerson\t\t445\r\n#define OBJ_pilotPerson\t\tOBJ_pilotObjectClass,4L\r\n\r\n#define SN_account\t\t\"account\"\r\n#define NID_account\t\t446\r\n#define OBJ_account\t\tOBJ_pilotObjectClass,5L\r\n\r\n#define SN_document\t\t\"document\"\r\n#define NID_document\t\t447\r\n#define OBJ_document\t\tOBJ_pilotObjectClass,6L\r\n\r\n#define SN_room\t\t\"room\"\r\n#define NID_room\t\t448\r\n#define OBJ_room\t\tOBJ_pilotObjectClass,7L\r\n\r\n#define LN_documentSeries\t\t\"documentSeries\"\r\n#define NID_documentSeries\t\t449\r\n#define OBJ_documentSeries\t\tOBJ_pilotObjectClass,9L\r\n\r\n#define SN_Domain\t\t\"domain\"\r\n#define LN_Domain\t\t\"Domain\"\r\n#define NID_Domain\t\t392\r\n#define OBJ_Domain\t\tOBJ_pilotObjectClass,13L\r\n\r\n#define LN_rFC822localPart\t\t\"rFC822localPart\"\r\n#define NID_rFC822localPart\t\t450\r\n#define OBJ_rFC822localPart\t\tOBJ_pilotObjectClass,14L\r\n\r\n#define LN_dNSDomain\t\t\"dNSDomain\"\r\n#define NID_dNSDomain\t\t451\r\n#define OBJ_dNSDomain\t\tOBJ_pilotObjectClass,15L\r\n\r\n#define LN_domainRelatedObject\t\t\"domainRelatedObject\"\r\n#define NID_domainRelatedObject\t\t452\r\n#define OBJ_domainRelatedObject\t\tOBJ_pilotObjectClass,17L\r\n\r\n#define LN_friendlyCountry\t\t\"friendlyCountry\"\r\n#define NID_friendlyCountry\t\t453\r\n#define OBJ_friendlyCountry\t\tOBJ_pilotObjectClass,18L\r\n\r\n#define LN_simpleSecurityObject\t\t\"simpleSecurityObject\"\r\n#define NID_simpleSecurityObject\t\t454\r\n#define OBJ_simpleSecurityObject\t\tOBJ_pilotObjectClass,19L\r\n\r\n#define LN_pilotOrganization\t\t\"pilotOrganization\"\r\n#define NID_pilotOrganization\t\t455\r\n#define OBJ_pilotOrganization\t\tOBJ_pilotObjectClass,20L\r\n\r\n#define LN_pilotDSA\t\t\"pilotDSA\"\r\n#define NID_pilotDSA\t\t456\r\n#define OBJ_pilotDSA\t\tOBJ_pilotObjectClass,21L\r\n\r\n#define LN_qualityLabelledData\t\t\"qualityLabelledData\"\r\n#define NID_qualityLabelledData\t\t457\r\n#define OBJ_qualityLabelledData\t\tOBJ_pilotObjectClass,22L\r\n\r\n#define SN_userId\t\t\"UID\"\r\n#define LN_userId\t\t\"userId\"\r\n#define NID_userId\t\t458\r\n#define OBJ_userId\t\tOBJ_pilotAttributeType,1L\r\n\r\n#define LN_textEncodedORAddress\t\t\"textEncodedORAddress\"\r\n#define NID_textEncodedORAddress\t\t459\r\n#define OBJ_textEncodedORAddress\t\tOBJ_pilotAttributeType,2L\r\n\r\n#define SN_rfc822Mailbox\t\t\"mail\"\r\n#define LN_rfc822Mailbox\t\t\"rfc822Mailbox\"\r\n#define NID_rfc822Mailbox\t\t460\r\n#define OBJ_rfc822Mailbox\t\tOBJ_pilotAttributeType,3L\r\n\r\n#define SN_info\t\t\"info\"\r\n#define NID_info\t\t461\r\n#define OBJ_info\t\tOBJ_pilotAttributeType,4L\r\n\r\n#define LN_favouriteDrink\t\t\"favouriteDrink\"\r\n#define NID_favouriteDrink\t\t462\r\n#define OBJ_favouriteDrink\t\tOBJ_pilotAttributeType,5L\r\n\r\n#define LN_roomNumber\t\t\"roomNumber\"\r\n#define NID_roomNumber\t\t463\r\n#define OBJ_roomNumber\t\tOBJ_pilotAttributeType,6L\r\n\r\n#define SN_photo\t\t\"photo\"\r\n#define NID_photo\t\t464\r\n#define OBJ_photo\t\tOBJ_pilotAttributeType,7L\r\n\r\n#define LN_userClass\t\t\"userClass\"\r\n#define NID_userClass\t\t465\r\n#define OBJ_userClass\t\tOBJ_pilotAttributeType,8L\r\n\r\n#define SN_host\t\t\"host\"\r\n#define NID_host\t\t466\r\n#define OBJ_host\t\tOBJ_pilotAttributeType,9L\r\n\r\n#define SN_manager\t\t\"manager\"\r\n#define NID_manager\t\t467\r\n#define OBJ_manager\t\tOBJ_pilotAttributeType,10L\r\n\r\n#define LN_documentIdentifier\t\t\"documentIdentifier\"\r\n#define NID_documentIdentifier\t\t468\r\n#define OBJ_documentIdentifier\t\tOBJ_pilotAttributeType,11L\r\n\r\n#define LN_documentTitle\t\t\"documentTitle\"\r\n#define NID_documentTitle\t\t469\r\n#define OBJ_documentTitle\t\tOBJ_pilotAttributeType,12L\r\n\r\n#define LN_documentVersion\t\t\"documentVersion\"\r\n#define NID_documentVersion\t\t470\r\n#define OBJ_documentVersion\t\tOBJ_pilotAttributeType,13L\r\n\r\n#define LN_documentAuthor\t\t\"documentAuthor\"\r\n#define NID_documentAuthor\t\t471\r\n#define OBJ_documentAuthor\t\tOBJ_pilotAttributeType,14L\r\n\r\n#define LN_documentLocation\t\t\"documentLocation\"\r\n#define NID_documentLocation\t\t472\r\n#define OBJ_documentLocation\t\tOBJ_pilotAttributeType,15L\r\n\r\n#define LN_homeTelephoneNumber\t\t\"homeTelephoneNumber\"\r\n#define NID_homeTelephoneNumber\t\t473\r\n#define OBJ_homeTelephoneNumber\t\tOBJ_pilotAttributeType,20L\r\n\r\n#define SN_secretary\t\t\"secretary\"\r\n#define NID_secretary\t\t474\r\n#define OBJ_secretary\t\tOBJ_pilotAttributeType,21L\r\n\r\n#define LN_otherMailbox\t\t\"otherMailbox\"\r\n#define NID_otherMailbox\t\t475\r\n#define OBJ_otherMailbox\t\tOBJ_pilotAttributeType,22L\r\n\r\n#define LN_lastModifiedTime\t\t\"lastModifiedTime\"\r\n#define NID_lastModifiedTime\t\t476\r\n#define OBJ_lastModifiedTime\t\tOBJ_pilotAttributeType,23L\r\n\r\n#define LN_lastModifiedBy\t\t\"lastModifiedBy\"\r\n#define NID_lastModifiedBy\t\t477\r\n#define OBJ_lastModifiedBy\t\tOBJ_pilotAttributeType,24L\r\n\r\n#define SN_domainComponent\t\t\"DC\"\r\n#define LN_domainComponent\t\t\"domainComponent\"\r\n#define NID_domainComponent\t\t391\r\n#define OBJ_domainComponent\t\tOBJ_pilotAttributeType,25L\r\n\r\n#define LN_aRecord\t\t\"aRecord\"\r\n#define NID_aRecord\t\t478\r\n#define OBJ_aRecord\t\tOBJ_pilotAttributeType,26L\r\n\r\n#define LN_pilotAttributeType27\t\t\"pilotAttributeType27\"\r\n#define NID_pilotAttributeType27\t\t479\r\n#define OBJ_pilotAttributeType27\t\tOBJ_pilotAttributeType,27L\r\n\r\n#define LN_mXRecord\t\t\"mXRecord\"\r\n#define NID_mXRecord\t\t480\r\n#define OBJ_mXRecord\t\tOBJ_pilotAttributeType,28L\r\n\r\n#define LN_nSRecord\t\t\"nSRecord\"\r\n#define NID_nSRecord\t\t481\r\n#define OBJ_nSRecord\t\tOBJ_pilotAttributeType,29L\r\n\r\n#define LN_sOARecord\t\t\"sOARecord\"\r\n#define NID_sOARecord\t\t482\r\n#define OBJ_sOARecord\t\tOBJ_pilotAttributeType,30L\r\n\r\n#define LN_cNAMERecord\t\t\"cNAMERecord\"\r\n#define NID_cNAMERecord\t\t483\r\n#define OBJ_cNAMERecord\t\tOBJ_pilotAttributeType,31L\r\n\r\n#define LN_associatedDomain\t\t\"associatedDomain\"\r\n#define NID_associatedDomain\t\t484\r\n#define OBJ_associatedDomain\t\tOBJ_pilotAttributeType,37L\r\n\r\n#define LN_associatedName\t\t\"associatedName\"\r\n#define NID_associatedName\t\t485\r\n#define OBJ_associatedName\t\tOBJ_pilotAttributeType,38L\r\n\r\n#define LN_homePostalAddress\t\t\"homePostalAddress\"\r\n#define NID_homePostalAddress\t\t486\r\n#define OBJ_homePostalAddress\t\tOBJ_pilotAttributeType,39L\r\n\r\n#define LN_personalTitle\t\t\"personalTitle\"\r\n#define NID_personalTitle\t\t487\r\n#define OBJ_personalTitle\t\tOBJ_pilotAttributeType,40L\r\n\r\n#define LN_mobileTelephoneNumber\t\t\"mobileTelephoneNumber\"\r\n#define NID_mobileTelephoneNumber\t\t488\r\n#define OBJ_mobileTelephoneNumber\t\tOBJ_pilotAttributeType,41L\r\n\r\n#define LN_pagerTelephoneNumber\t\t\"pagerTelephoneNumber\"\r\n#define NID_pagerTelephoneNumber\t\t489\r\n#define OBJ_pagerTelephoneNumber\t\tOBJ_pilotAttributeType,42L\r\n\r\n#define LN_friendlyCountryName\t\t\"friendlyCountryName\"\r\n#define NID_friendlyCountryName\t\t490\r\n#define OBJ_friendlyCountryName\t\tOBJ_pilotAttributeType,43L\r\n\r\n#define LN_organizationalStatus\t\t\"organizationalStatus\"\r\n#define NID_organizationalStatus\t\t491\r\n#define OBJ_organizationalStatus\t\tOBJ_pilotAttributeType,45L\r\n\r\n#define LN_janetMailbox\t\t\"janetMailbox\"\r\n#define NID_janetMailbox\t\t492\r\n#define OBJ_janetMailbox\t\tOBJ_pilotAttributeType,46L\r\n\r\n#define LN_mailPreferenceOption\t\t\"mailPreferenceOption\"\r\n#define NID_mailPreferenceOption\t\t493\r\n#define OBJ_mailPreferenceOption\t\tOBJ_pilotAttributeType,47L\r\n\r\n#define LN_buildingName\t\t\"buildingName\"\r\n#define NID_buildingName\t\t494\r\n#define OBJ_buildingName\t\tOBJ_pilotAttributeType,48L\r\n\r\n#define LN_dSAQuality\t\t\"dSAQuality\"\r\n#define NID_dSAQuality\t\t495\r\n#define OBJ_dSAQuality\t\tOBJ_pilotAttributeType,49L\r\n\r\n#define LN_singleLevelQuality\t\t\"singleLevelQuality\"\r\n#define NID_singleLevelQuality\t\t496\r\n#define OBJ_singleLevelQuality\t\tOBJ_pilotAttributeType,50L\r\n\r\n#define LN_subtreeMinimumQuality\t\t\"subtreeMinimumQuality\"\r\n#define NID_subtreeMinimumQuality\t\t497\r\n#define OBJ_subtreeMinimumQuality\t\tOBJ_pilotAttributeType,51L\r\n\r\n#define LN_subtreeMaximumQuality\t\t\"subtreeMaximumQuality\"\r\n#define NID_subtreeMaximumQuality\t\t498\r\n#define OBJ_subtreeMaximumQuality\t\tOBJ_pilotAttributeType,52L\r\n\r\n#define LN_personalSignature\t\t\"personalSignature\"\r\n#define NID_personalSignature\t\t499\r\n#define OBJ_personalSignature\t\tOBJ_pilotAttributeType,53L\r\n\r\n#define LN_dITRedirect\t\t\"dITRedirect\"\r\n#define NID_dITRedirect\t\t500\r\n#define OBJ_dITRedirect\t\tOBJ_pilotAttributeType,54L\r\n\r\n#define SN_audio\t\t\"audio\"\r\n#define NID_audio\t\t501\r\n#define OBJ_audio\t\tOBJ_pilotAttributeType,55L\r\n\r\n#define LN_documentPublisher\t\t\"documentPublisher\"\r\n#define NID_documentPublisher\t\t502\r\n#define OBJ_documentPublisher\t\tOBJ_pilotAttributeType,56L\r\n\r\n#define SN_id_set\t\t\"id-set\"\r\n#define LN_id_set\t\t\"Secure Electronic Transactions\"\r\n#define NID_id_set\t\t512\r\n#define OBJ_id_set\t\tOBJ_international_organizations,42L\r\n\r\n#define SN_set_ctype\t\t\"set-ctype\"\r\n#define LN_set_ctype\t\t\"content types\"\r\n#define NID_set_ctype\t\t513\r\n#define OBJ_set_ctype\t\tOBJ_id_set,0L\r\n\r\n#define SN_set_msgExt\t\t\"set-msgExt\"\r\n#define LN_set_msgExt\t\t\"message extensions\"\r\n#define NID_set_msgExt\t\t514\r\n#define OBJ_set_msgExt\t\tOBJ_id_set,1L\r\n\r\n#define SN_set_attr\t\t\"set-attr\"\r\n#define NID_set_attr\t\t515\r\n#define OBJ_set_attr\t\tOBJ_id_set,3L\r\n\r\n#define SN_set_policy\t\t\"set-policy\"\r\n#define NID_set_policy\t\t516\r\n#define OBJ_set_policy\t\tOBJ_id_set,5L\r\n\r\n#define SN_set_certExt\t\t\"set-certExt\"\r\n#define LN_set_certExt\t\t\"certificate extensions\"\r\n#define NID_set_certExt\t\t517\r\n#define OBJ_set_certExt\t\tOBJ_id_set,7L\r\n\r\n#define SN_set_brand\t\t\"set-brand\"\r\n#define NID_set_brand\t\t518\r\n#define OBJ_set_brand\t\tOBJ_id_set,8L\r\n\r\n#define SN_setct_PANData\t\t\"setct-PANData\"\r\n#define NID_setct_PANData\t\t519\r\n#define OBJ_setct_PANData\t\tOBJ_set_ctype,0L\r\n\r\n#define SN_setct_PANToken\t\t\"setct-PANToken\"\r\n#define NID_setct_PANToken\t\t520\r\n#define OBJ_setct_PANToken\t\tOBJ_set_ctype,1L\r\n\r\n#define SN_setct_PANOnly\t\t\"setct-PANOnly\"\r\n#define NID_setct_PANOnly\t\t521\r\n#define OBJ_setct_PANOnly\t\tOBJ_set_ctype,2L\r\n\r\n#define SN_setct_OIData\t\t\"setct-OIData\"\r\n#define NID_setct_OIData\t\t522\r\n#define OBJ_setct_OIData\t\tOBJ_set_ctype,3L\r\n\r\n#define SN_setct_PI\t\t\"setct-PI\"\r\n#define NID_setct_PI\t\t523\r\n#define OBJ_setct_PI\t\tOBJ_set_ctype,4L\r\n\r\n#define SN_setct_PIData\t\t\"setct-PIData\"\r\n#define NID_setct_PIData\t\t524\r\n#define OBJ_setct_PIData\t\tOBJ_set_ctype,5L\r\n\r\n#define SN_setct_PIDataUnsigned\t\t\"setct-PIDataUnsigned\"\r\n#define NID_setct_PIDataUnsigned\t\t525\r\n#define OBJ_setct_PIDataUnsigned\t\tOBJ_set_ctype,6L\r\n\r\n#define SN_setct_HODInput\t\t\"setct-HODInput\"\r\n#define NID_setct_HODInput\t\t526\r\n#define OBJ_setct_HODInput\t\tOBJ_set_ctype,7L\r\n\r\n#define SN_setct_AuthResBaggage\t\t\"setct-AuthResBaggage\"\r\n#define NID_setct_AuthResBaggage\t\t527\r\n#define OBJ_setct_AuthResBaggage\t\tOBJ_set_ctype,8L\r\n\r\n#define SN_setct_AuthRevReqBaggage\t\t\"setct-AuthRevReqBaggage\"\r\n#define NID_setct_AuthRevReqBaggage\t\t528\r\n#define OBJ_setct_AuthRevReqBaggage\t\tOBJ_set_ctype,9L\r\n\r\n#define SN_setct_AuthRevResBaggage\t\t\"setct-AuthRevResBaggage\"\r\n#define NID_setct_AuthRevResBaggage\t\t529\r\n#define OBJ_setct_AuthRevResBaggage\t\tOBJ_set_ctype,10L\r\n\r\n#define SN_setct_CapTokenSeq\t\t\"setct-CapTokenSeq\"\r\n#define NID_setct_CapTokenSeq\t\t530\r\n#define OBJ_setct_CapTokenSeq\t\tOBJ_set_ctype,11L\r\n\r\n#define SN_setct_PInitResData\t\t\"setct-PInitResData\"\r\n#define NID_setct_PInitResData\t\t531\r\n#define OBJ_setct_PInitResData\t\tOBJ_set_ctype,12L\r\n\r\n#define SN_setct_PI_TBS\t\t\"setct-PI-TBS\"\r\n#define NID_setct_PI_TBS\t\t532\r\n#define OBJ_setct_PI_TBS\t\tOBJ_set_ctype,13L\r\n\r\n#define SN_setct_PResData\t\t\"setct-PResData\"\r\n#define NID_setct_PResData\t\t533\r\n#define OBJ_setct_PResData\t\tOBJ_set_ctype,14L\r\n\r\n#define SN_setct_AuthReqTBS\t\t\"setct-AuthReqTBS\"\r\n#define NID_setct_AuthReqTBS\t\t534\r\n#define OBJ_setct_AuthReqTBS\t\tOBJ_set_ctype,16L\r\n\r\n#define SN_setct_AuthResTBS\t\t\"setct-AuthResTBS\"\r\n#define NID_setct_AuthResTBS\t\t535\r\n#define OBJ_setct_AuthResTBS\t\tOBJ_set_ctype,17L\r\n\r\n#define SN_setct_AuthResTBSX\t\t\"setct-AuthResTBSX\"\r\n#define NID_setct_AuthResTBSX\t\t536\r\n#define OBJ_setct_AuthResTBSX\t\tOBJ_set_ctype,18L\r\n\r\n#define SN_setct_AuthTokenTBS\t\t\"setct-AuthTokenTBS\"\r\n#define NID_setct_AuthTokenTBS\t\t537\r\n#define OBJ_setct_AuthTokenTBS\t\tOBJ_set_ctype,19L\r\n\r\n#define SN_setct_CapTokenData\t\t\"setct-CapTokenData\"\r\n#define NID_setct_CapTokenData\t\t538\r\n#define OBJ_setct_CapTokenData\t\tOBJ_set_ctype,20L\r\n\r\n#define SN_setct_CapTokenTBS\t\t\"setct-CapTokenTBS\"\r\n#define NID_setct_CapTokenTBS\t\t539\r\n#define OBJ_setct_CapTokenTBS\t\tOBJ_set_ctype,21L\r\n\r\n#define SN_setct_AcqCardCodeMsg\t\t\"setct-AcqCardCodeMsg\"\r\n#define NID_setct_AcqCardCodeMsg\t\t540\r\n#define OBJ_setct_AcqCardCodeMsg\t\tOBJ_set_ctype,22L\r\n\r\n#define SN_setct_AuthRevReqTBS\t\t\"setct-AuthRevReqTBS\"\r\n#define NID_setct_AuthRevReqTBS\t\t541\r\n#define OBJ_setct_AuthRevReqTBS\t\tOBJ_set_ctype,23L\r\n\r\n#define SN_setct_AuthRevResData\t\t\"setct-AuthRevResData\"\r\n#define NID_setct_AuthRevResData\t\t542\r\n#define OBJ_setct_AuthRevResData\t\tOBJ_set_ctype,24L\r\n\r\n#define SN_setct_AuthRevResTBS\t\t\"setct-AuthRevResTBS\"\r\n#define NID_setct_AuthRevResTBS\t\t543\r\n#define OBJ_setct_AuthRevResTBS\t\tOBJ_set_ctype,25L\r\n\r\n#define SN_setct_CapReqTBS\t\t\"setct-CapReqTBS\"\r\n#define NID_setct_CapReqTBS\t\t544\r\n#define OBJ_setct_CapReqTBS\t\tOBJ_set_ctype,26L\r\n\r\n#define SN_setct_CapReqTBSX\t\t\"setct-CapReqTBSX\"\r\n#define NID_setct_CapReqTBSX\t\t545\r\n#define OBJ_setct_CapReqTBSX\t\tOBJ_set_ctype,27L\r\n\r\n#define SN_setct_CapResData\t\t\"setct-CapResData\"\r\n#define NID_setct_CapResData\t\t546\r\n#define OBJ_setct_CapResData\t\tOBJ_set_ctype,28L\r\n\r\n#define SN_setct_CapRevReqTBS\t\t\"setct-CapRevReqTBS\"\r\n#define NID_setct_CapRevReqTBS\t\t547\r\n#define OBJ_setct_CapRevReqTBS\t\tOBJ_set_ctype,29L\r\n\r\n#define SN_setct_CapRevReqTBSX\t\t\"setct-CapRevReqTBSX\"\r\n#define NID_setct_CapRevReqTBSX\t\t548\r\n#define OBJ_setct_CapRevReqTBSX\t\tOBJ_set_ctype,30L\r\n\r\n#define SN_setct_CapRevResData\t\t\"setct-CapRevResData\"\r\n#define NID_setct_CapRevResData\t\t549\r\n#define OBJ_setct_CapRevResData\t\tOBJ_set_ctype,31L\r\n\r\n#define SN_setct_CredReqTBS\t\t\"setct-CredReqTBS\"\r\n#define NID_setct_CredReqTBS\t\t550\r\n#define OBJ_setct_CredReqTBS\t\tOBJ_set_ctype,32L\r\n\r\n#define SN_setct_CredReqTBSX\t\t\"setct-CredReqTBSX\"\r\n#define NID_setct_CredReqTBSX\t\t551\r\n#define OBJ_setct_CredReqTBSX\t\tOBJ_set_ctype,33L\r\n\r\n#define SN_setct_CredResData\t\t\"setct-CredResData\"\r\n#define NID_setct_CredResData\t\t552\r\n#define OBJ_setct_CredResData\t\tOBJ_set_ctype,34L\r\n\r\n#define SN_setct_CredRevReqTBS\t\t\"setct-CredRevReqTBS\"\r\n#define NID_setct_CredRevReqTBS\t\t553\r\n#define OBJ_setct_CredRevReqTBS\t\tOBJ_set_ctype,35L\r\n\r\n#define SN_setct_CredRevReqTBSX\t\t\"setct-CredRevReqTBSX\"\r\n#define NID_setct_CredRevReqTBSX\t\t554\r\n#define OBJ_setct_CredRevReqTBSX\t\tOBJ_set_ctype,36L\r\n\r\n#define SN_setct_CredRevResData\t\t\"setct-CredRevResData\"\r\n#define NID_setct_CredRevResData\t\t555\r\n#define OBJ_setct_CredRevResData\t\tOBJ_set_ctype,37L\r\n\r\n#define SN_setct_PCertReqData\t\t\"setct-PCertReqData\"\r\n#define NID_setct_PCertReqData\t\t556\r\n#define OBJ_setct_PCertReqData\t\tOBJ_set_ctype,38L\r\n\r\n#define SN_setct_PCertResTBS\t\t\"setct-PCertResTBS\"\r\n#define NID_setct_PCertResTBS\t\t557\r\n#define OBJ_setct_PCertResTBS\t\tOBJ_set_ctype,39L\r\n\r\n#define SN_setct_BatchAdminReqData\t\t\"setct-BatchAdminReqData\"\r\n#define NID_setct_BatchAdminReqData\t\t558\r\n#define OBJ_setct_BatchAdminReqData\t\tOBJ_set_ctype,40L\r\n\r\n#define SN_setct_BatchAdminResData\t\t\"setct-BatchAdminResData\"\r\n#define NID_setct_BatchAdminResData\t\t559\r\n#define OBJ_setct_BatchAdminResData\t\tOBJ_set_ctype,41L\r\n\r\n#define SN_setct_CardCInitResTBS\t\t\"setct-CardCInitResTBS\"\r\n#define NID_setct_CardCInitResTBS\t\t560\r\n#define OBJ_setct_CardCInitResTBS\t\tOBJ_set_ctype,42L\r\n\r\n#define SN_setct_MeAqCInitResTBS\t\t\"setct-MeAqCInitResTBS\"\r\n#define NID_setct_MeAqCInitResTBS\t\t561\r\n#define OBJ_setct_MeAqCInitResTBS\t\tOBJ_set_ctype,43L\r\n\r\n#define SN_setct_RegFormResTBS\t\t\"setct-RegFormResTBS\"\r\n#define NID_setct_RegFormResTBS\t\t562\r\n#define OBJ_setct_RegFormResTBS\t\tOBJ_set_ctype,44L\r\n\r\n#define SN_setct_CertReqData\t\t\"setct-CertReqData\"\r\n#define NID_setct_CertReqData\t\t563\r\n#define OBJ_setct_CertReqData\t\tOBJ_set_ctype,45L\r\n\r\n#define SN_setct_CertReqTBS\t\t\"setct-CertReqTBS\"\r\n#define NID_setct_CertReqTBS\t\t564\r\n#define OBJ_setct_CertReqTBS\t\tOBJ_set_ctype,46L\r\n\r\n#define SN_setct_CertResData\t\t\"setct-CertResData\"\r\n#define NID_setct_CertResData\t\t565\r\n#define OBJ_setct_CertResData\t\tOBJ_set_ctype,47L\r\n\r\n#define SN_setct_CertInqReqTBS\t\t\"setct-CertInqReqTBS\"\r\n#define NID_setct_CertInqReqTBS\t\t566\r\n#define OBJ_setct_CertInqReqTBS\t\tOBJ_set_ctype,48L\r\n\r\n#define SN_setct_ErrorTBS\t\t\"setct-ErrorTBS\"\r\n#define NID_setct_ErrorTBS\t\t567\r\n#define OBJ_setct_ErrorTBS\t\tOBJ_set_ctype,49L\r\n\r\n#define SN_setct_PIDualSignedTBE\t\t\"setct-PIDualSignedTBE\"\r\n#define NID_setct_PIDualSignedTBE\t\t568\r\n#define OBJ_setct_PIDualSignedTBE\t\tOBJ_set_ctype,50L\r\n\r\n#define SN_setct_PIUnsignedTBE\t\t\"setct-PIUnsignedTBE\"\r\n#define NID_setct_PIUnsignedTBE\t\t569\r\n#define OBJ_setct_PIUnsignedTBE\t\tOBJ_set_ctype,51L\r\n\r\n#define SN_setct_AuthReqTBE\t\t\"setct-AuthReqTBE\"\r\n#define NID_setct_AuthReqTBE\t\t570\r\n#define OBJ_setct_AuthReqTBE\t\tOBJ_set_ctype,52L\r\n\r\n#define SN_setct_AuthResTBE\t\t\"setct-AuthResTBE\"\r\n#define NID_setct_AuthResTBE\t\t571\r\n#define OBJ_setct_AuthResTBE\t\tOBJ_set_ctype,53L\r\n\r\n#define SN_setct_AuthResTBEX\t\t\"setct-AuthResTBEX\"\r\n#define NID_setct_AuthResTBEX\t\t572\r\n#define OBJ_setct_AuthResTBEX\t\tOBJ_set_ctype,54L\r\n\r\n#define SN_setct_AuthTokenTBE\t\t\"setct-AuthTokenTBE\"\r\n#define NID_setct_AuthTokenTBE\t\t573\r\n#define OBJ_setct_AuthTokenTBE\t\tOBJ_set_ctype,55L\r\n\r\n#define SN_setct_CapTokenTBE\t\t\"setct-CapTokenTBE\"\r\n#define NID_setct_CapTokenTBE\t\t574\r\n#define OBJ_setct_CapTokenTBE\t\tOBJ_set_ctype,56L\r\n\r\n#define SN_setct_CapTokenTBEX\t\t\"setct-CapTokenTBEX\"\r\n#define NID_setct_CapTokenTBEX\t\t575\r\n#define OBJ_setct_CapTokenTBEX\t\tOBJ_set_ctype,57L\r\n\r\n#define SN_setct_AcqCardCodeMsgTBE\t\t\"setct-AcqCardCodeMsgTBE\"\r\n#define NID_setct_AcqCardCodeMsgTBE\t\t576\r\n#define OBJ_setct_AcqCardCodeMsgTBE\t\tOBJ_set_ctype,58L\r\n\r\n#define SN_setct_AuthRevReqTBE\t\t\"setct-AuthRevReqTBE\"\r\n#define NID_setct_AuthRevReqTBE\t\t577\r\n#define OBJ_setct_AuthRevReqTBE\t\tOBJ_set_ctype,59L\r\n\r\n#define SN_setct_AuthRevResTBE\t\t\"setct-AuthRevResTBE\"\r\n#define NID_setct_AuthRevResTBE\t\t578\r\n#define OBJ_setct_AuthRevResTBE\t\tOBJ_set_ctype,60L\r\n\r\n#define SN_setct_AuthRevResTBEB\t\t\"setct-AuthRevResTBEB\"\r\n#define NID_setct_AuthRevResTBEB\t\t579\r\n#define OBJ_setct_AuthRevResTBEB\t\tOBJ_set_ctype,61L\r\n\r\n#define SN_setct_CapReqTBE\t\t\"setct-CapReqTBE\"\r\n#define NID_setct_CapReqTBE\t\t580\r\n#define OBJ_setct_CapReqTBE\t\tOBJ_set_ctype,62L\r\n\r\n#define SN_setct_CapReqTBEX\t\t\"setct-CapReqTBEX\"\r\n#define NID_setct_CapReqTBEX\t\t581\r\n#define OBJ_setct_CapReqTBEX\t\tOBJ_set_ctype,63L\r\n\r\n#define SN_setct_CapResTBE\t\t\"setct-CapResTBE\"\r\n#define NID_setct_CapResTBE\t\t582\r\n#define OBJ_setct_CapResTBE\t\tOBJ_set_ctype,64L\r\n\r\n#define SN_setct_CapRevReqTBE\t\t\"setct-CapRevReqTBE\"\r\n#define NID_setct_CapRevReqTBE\t\t583\r\n#define OBJ_setct_CapRevReqTBE\t\tOBJ_set_ctype,65L\r\n\r\n#define SN_setct_CapRevReqTBEX\t\t\"setct-CapRevReqTBEX\"\r\n#define NID_setct_CapRevReqTBEX\t\t584\r\n#define OBJ_setct_CapRevReqTBEX\t\tOBJ_set_ctype,66L\r\n\r\n#define SN_setct_CapRevResTBE\t\t\"setct-CapRevResTBE\"\r\n#define NID_setct_CapRevResTBE\t\t585\r\n#define OBJ_setct_CapRevResTBE\t\tOBJ_set_ctype,67L\r\n\r\n#define SN_setct_CredReqTBE\t\t\"setct-CredReqTBE\"\r\n#define NID_setct_CredReqTBE\t\t586\r\n#define OBJ_setct_CredReqTBE\t\tOBJ_set_ctype,68L\r\n\r\n#define SN_setct_CredReqTBEX\t\t\"setct-CredReqTBEX\"\r\n#define NID_setct_CredReqTBEX\t\t587\r\n#define OBJ_setct_CredReqTBEX\t\tOBJ_set_ctype,69L\r\n\r\n#define SN_setct_CredResTBE\t\t\"setct-CredResTBE\"\r\n#define NID_setct_CredResTBE\t\t588\r\n#define OBJ_setct_CredResTBE\t\tOBJ_set_ctype,70L\r\n\r\n#define SN_setct_CredRevReqTBE\t\t\"setct-CredRevReqTBE\"\r\n#define NID_setct_CredRevReqTBE\t\t589\r\n#define OBJ_setct_CredRevReqTBE\t\tOBJ_set_ctype,71L\r\n\r\n#define SN_setct_CredRevReqTBEX\t\t\"setct-CredRevReqTBEX\"\r\n#define NID_setct_CredRevReqTBEX\t\t590\r\n#define OBJ_setct_CredRevReqTBEX\t\tOBJ_set_ctype,72L\r\n\r\n#define SN_setct_CredRevResTBE\t\t\"setct-CredRevResTBE\"\r\n#define NID_setct_CredRevResTBE\t\t591\r\n#define OBJ_setct_CredRevResTBE\t\tOBJ_set_ctype,73L\r\n\r\n#define SN_setct_BatchAdminReqTBE\t\t\"setct-BatchAdminReqTBE\"\r\n#define NID_setct_BatchAdminReqTBE\t\t592\r\n#define OBJ_setct_BatchAdminReqTBE\t\tOBJ_set_ctype,74L\r\n\r\n#define SN_setct_BatchAdminResTBE\t\t\"setct-BatchAdminResTBE\"\r\n#define NID_setct_BatchAdminResTBE\t\t593\r\n#define OBJ_setct_BatchAdminResTBE\t\tOBJ_set_ctype,75L\r\n\r\n#define SN_setct_RegFormReqTBE\t\t\"setct-RegFormReqTBE\"\r\n#define NID_setct_RegFormReqTBE\t\t594\r\n#define OBJ_setct_RegFormReqTBE\t\tOBJ_set_ctype,76L\r\n\r\n#define SN_setct_CertReqTBE\t\t\"setct-CertReqTBE\"\r\n#define NID_setct_CertReqTBE\t\t595\r\n#define OBJ_setct_CertReqTBE\t\tOBJ_set_ctype,77L\r\n\r\n#define SN_setct_CertReqTBEX\t\t\"setct-CertReqTBEX\"\r\n#define NID_setct_CertReqTBEX\t\t596\r\n#define OBJ_setct_CertReqTBEX\t\tOBJ_set_ctype,78L\r\n\r\n#define SN_setct_CertResTBE\t\t\"setct-CertResTBE\"\r\n#define NID_setct_CertResTBE\t\t597\r\n#define OBJ_setct_CertResTBE\t\tOBJ_set_ctype,79L\r\n\r\n#define SN_setct_CRLNotificationTBS\t\t\"setct-CRLNotificationTBS\"\r\n#define NID_setct_CRLNotificationTBS\t\t598\r\n#define OBJ_setct_CRLNotificationTBS\t\tOBJ_set_ctype,80L\r\n\r\n#define SN_setct_CRLNotificationResTBS\t\t\"setct-CRLNotificationResTBS\"\r\n#define NID_setct_CRLNotificationResTBS\t\t599\r\n#define OBJ_setct_CRLNotificationResTBS\t\tOBJ_set_ctype,81L\r\n\r\n#define SN_setct_BCIDistributionTBS\t\t\"setct-BCIDistributionTBS\"\r\n#define NID_setct_BCIDistributionTBS\t\t600\r\n#define OBJ_setct_BCIDistributionTBS\t\tOBJ_set_ctype,82L\r\n\r\n#define SN_setext_genCrypt\t\t\"setext-genCrypt\"\r\n#define LN_setext_genCrypt\t\t\"generic cryptogram\"\r\n#define NID_setext_genCrypt\t\t601\r\n#define OBJ_setext_genCrypt\t\tOBJ_set_msgExt,1L\r\n\r\n#define SN_setext_miAuth\t\t\"setext-miAuth\"\r\n#define LN_setext_miAuth\t\t\"merchant initiated auth\"\r\n#define NID_setext_miAuth\t\t602\r\n#define OBJ_setext_miAuth\t\tOBJ_set_msgExt,3L\r\n\r\n#define SN_setext_pinSecure\t\t\"setext-pinSecure\"\r\n#define NID_setext_pinSecure\t\t603\r\n#define OBJ_setext_pinSecure\t\tOBJ_set_msgExt,4L\r\n\r\n#define SN_setext_pinAny\t\t\"setext-pinAny\"\r\n#define NID_setext_pinAny\t\t604\r\n#define OBJ_setext_pinAny\t\tOBJ_set_msgExt,5L\r\n\r\n#define SN_setext_track2\t\t\"setext-track2\"\r\n#define NID_setext_track2\t\t605\r\n#define OBJ_setext_track2\t\tOBJ_set_msgExt,7L\r\n\r\n#define SN_setext_cv\t\t\"setext-cv\"\r\n#define LN_setext_cv\t\t\"additional verification\"\r\n#define NID_setext_cv\t\t606\r\n#define OBJ_setext_cv\t\tOBJ_set_msgExt,8L\r\n\r\n#define SN_set_policy_root\t\t\"set-policy-root\"\r\n#define NID_set_policy_root\t\t607\r\n#define OBJ_set_policy_root\t\tOBJ_set_policy,0L\r\n\r\n#define SN_setCext_hashedRoot\t\t\"setCext-hashedRoot\"\r\n#define NID_setCext_hashedRoot\t\t608\r\n#define OBJ_setCext_hashedRoot\t\tOBJ_set_certExt,0L\r\n\r\n#define SN_setCext_certType\t\t\"setCext-certType\"\r\n#define NID_setCext_certType\t\t609\r\n#define OBJ_setCext_certType\t\tOBJ_set_certExt,1L\r\n\r\n#define SN_setCext_merchData\t\t\"setCext-merchData\"\r\n#define NID_setCext_merchData\t\t610\r\n#define OBJ_setCext_merchData\t\tOBJ_set_certExt,2L\r\n\r\n#define SN_setCext_cCertRequired\t\t\"setCext-cCertRequired\"\r\n#define NID_setCext_cCertRequired\t\t611\r\n#define OBJ_setCext_cCertRequired\t\tOBJ_set_certExt,3L\r\n\r\n#define SN_setCext_tunneling\t\t\"setCext-tunneling\"\r\n#define NID_setCext_tunneling\t\t612\r\n#define OBJ_setCext_tunneling\t\tOBJ_set_certExt,4L\r\n\r\n#define SN_setCext_setExt\t\t\"setCext-setExt\"\r\n#define NID_setCext_setExt\t\t613\r\n#define OBJ_setCext_setExt\t\tOBJ_set_certExt,5L\r\n\r\n#define SN_setCext_setQualf\t\t\"setCext-setQualf\"\r\n#define NID_setCext_setQualf\t\t614\r\n#define OBJ_setCext_setQualf\t\tOBJ_set_certExt,6L\r\n\r\n#define SN_setCext_PGWYcapabilities\t\t\"setCext-PGWYcapabilities\"\r\n#define NID_setCext_PGWYcapabilities\t\t615\r\n#define OBJ_setCext_PGWYcapabilities\t\tOBJ_set_certExt,7L\r\n\r\n#define SN_setCext_TokenIdentifier\t\t\"setCext-TokenIdentifier\"\r\n#define NID_setCext_TokenIdentifier\t\t616\r\n#define OBJ_setCext_TokenIdentifier\t\tOBJ_set_certExt,8L\r\n\r\n#define SN_setCext_Track2Data\t\t\"setCext-Track2Data\"\r\n#define NID_setCext_Track2Data\t\t617\r\n#define OBJ_setCext_Track2Data\t\tOBJ_set_certExt,9L\r\n\r\n#define SN_setCext_TokenType\t\t\"setCext-TokenType\"\r\n#define NID_setCext_TokenType\t\t618\r\n#define OBJ_setCext_TokenType\t\tOBJ_set_certExt,10L\r\n\r\n#define SN_setCext_IssuerCapabilities\t\t\"setCext-IssuerCapabilities\"\r\n#define NID_setCext_IssuerCapabilities\t\t619\r\n#define OBJ_setCext_IssuerCapabilities\t\tOBJ_set_certExt,11L\r\n\r\n#define SN_setAttr_Cert\t\t\"setAttr-Cert\"\r\n#define NID_setAttr_Cert\t\t620\r\n#define OBJ_setAttr_Cert\t\tOBJ_set_attr,0L\r\n\r\n#define SN_setAttr_PGWYcap\t\t\"setAttr-PGWYcap\"\r\n#define LN_setAttr_PGWYcap\t\t\"payment gateway capabilities\"\r\n#define NID_setAttr_PGWYcap\t\t621\r\n#define OBJ_setAttr_PGWYcap\t\tOBJ_set_attr,1L\r\n\r\n#define SN_setAttr_TokenType\t\t\"setAttr-TokenType\"\r\n#define NID_setAttr_TokenType\t\t622\r\n#define OBJ_setAttr_TokenType\t\tOBJ_set_attr,2L\r\n\r\n#define SN_setAttr_IssCap\t\t\"setAttr-IssCap\"\r\n#define LN_setAttr_IssCap\t\t\"issuer capabilities\"\r\n#define NID_setAttr_IssCap\t\t623\r\n#define OBJ_setAttr_IssCap\t\tOBJ_set_attr,3L\r\n\r\n#define SN_set_rootKeyThumb\t\t\"set-rootKeyThumb\"\r\n#define NID_set_rootKeyThumb\t\t624\r\n#define OBJ_set_rootKeyThumb\t\tOBJ_setAttr_Cert,0L\r\n\r\n#define SN_set_addPolicy\t\t\"set-addPolicy\"\r\n#define NID_set_addPolicy\t\t625\r\n#define OBJ_set_addPolicy\t\tOBJ_setAttr_Cert,1L\r\n\r\n#define SN_setAttr_Token_EMV\t\t\"setAttr-Token-EMV\"\r\n#define NID_setAttr_Token_EMV\t\t626\r\n#define OBJ_setAttr_Token_EMV\t\tOBJ_setAttr_TokenType,1L\r\n\r\n#define SN_setAttr_Token_B0Prime\t\t\"setAttr-Token-B0Prime\"\r\n#define NID_setAttr_Token_B0Prime\t\t627\r\n#define OBJ_setAttr_Token_B0Prime\t\tOBJ_setAttr_TokenType,2L\r\n\r\n#define SN_setAttr_IssCap_CVM\t\t\"setAttr-IssCap-CVM\"\r\n#define NID_setAttr_IssCap_CVM\t\t628\r\n#define OBJ_setAttr_IssCap_CVM\t\tOBJ_setAttr_IssCap,3L\r\n\r\n#define SN_setAttr_IssCap_T2\t\t\"setAttr-IssCap-T2\"\r\n#define NID_setAttr_IssCap_T2\t\t629\r\n#define OBJ_setAttr_IssCap_T2\t\tOBJ_setAttr_IssCap,4L\r\n\r\n#define SN_setAttr_IssCap_Sig\t\t\"setAttr-IssCap-Sig\"\r\n#define NID_setAttr_IssCap_Sig\t\t630\r\n#define OBJ_setAttr_IssCap_Sig\t\tOBJ_setAttr_IssCap,5L\r\n\r\n#define SN_setAttr_GenCryptgrm\t\t\"setAttr-GenCryptgrm\"\r\n#define LN_setAttr_GenCryptgrm\t\t\"generate cryptogram\"\r\n#define NID_setAttr_GenCryptgrm\t\t631\r\n#define OBJ_setAttr_GenCryptgrm\t\tOBJ_setAttr_IssCap_CVM,1L\r\n\r\n#define SN_setAttr_T2Enc\t\t\"setAttr-T2Enc\"\r\n#define LN_setAttr_T2Enc\t\t\"encrypted track 2\"\r\n#define NID_setAttr_T2Enc\t\t632\r\n#define OBJ_setAttr_T2Enc\t\tOBJ_setAttr_IssCap_T2,1L\r\n\r\n#define SN_setAttr_T2cleartxt\t\t\"setAttr-T2cleartxt\"\r\n#define LN_setAttr_T2cleartxt\t\t\"cleartext track 2\"\r\n#define NID_setAttr_T2cleartxt\t\t633\r\n#define OBJ_setAttr_T2cleartxt\t\tOBJ_setAttr_IssCap_T2,2L\r\n\r\n#define SN_setAttr_TokICCsig\t\t\"setAttr-TokICCsig\"\r\n#define LN_setAttr_TokICCsig\t\t\"ICC or token signature\"\r\n#define NID_setAttr_TokICCsig\t\t634\r\n#define OBJ_setAttr_TokICCsig\t\tOBJ_setAttr_IssCap_Sig,1L\r\n\r\n#define SN_setAttr_SecDevSig\t\t\"setAttr-SecDevSig\"\r\n#define LN_setAttr_SecDevSig\t\t\"secure device signature\"\r\n#define NID_setAttr_SecDevSig\t\t635\r\n#define OBJ_setAttr_SecDevSig\t\tOBJ_setAttr_IssCap_Sig,2L\r\n\r\n#define SN_set_brand_IATA_ATA\t\t\"set-brand-IATA-ATA\"\r\n#define NID_set_brand_IATA_ATA\t\t636\r\n#define OBJ_set_brand_IATA_ATA\t\tOBJ_set_brand,1L\r\n\r\n#define SN_set_brand_Diners\t\t\"set-brand-Diners\"\r\n#define NID_set_brand_Diners\t\t637\r\n#define OBJ_set_brand_Diners\t\tOBJ_set_brand,30L\r\n\r\n#define SN_set_brand_AmericanExpress\t\t\"set-brand-AmericanExpress\"\r\n#define NID_set_brand_AmericanExpress\t\t638\r\n#define OBJ_set_brand_AmericanExpress\t\tOBJ_set_brand,34L\r\n\r\n#define SN_set_brand_JCB\t\t\"set-brand-JCB\"\r\n#define NID_set_brand_JCB\t\t639\r\n#define OBJ_set_brand_JCB\t\tOBJ_set_brand,35L\r\n\r\n#define SN_set_brand_Visa\t\t\"set-brand-Visa\"\r\n#define NID_set_brand_Visa\t\t640\r\n#define OBJ_set_brand_Visa\t\tOBJ_set_brand,4L\r\n\r\n#define SN_set_brand_MasterCard\t\t\"set-brand-MasterCard\"\r\n#define NID_set_brand_MasterCard\t\t641\r\n#define OBJ_set_brand_MasterCard\t\tOBJ_set_brand,5L\r\n\r\n#define SN_set_brand_Novus\t\t\"set-brand-Novus\"\r\n#define NID_set_brand_Novus\t\t642\r\n#define OBJ_set_brand_Novus\t\tOBJ_set_brand,6011L\r\n\r\n#define SN_des_cdmf\t\t\"DES-CDMF\"\r\n#define LN_des_cdmf\t\t\"des-cdmf\"\r\n#define NID_des_cdmf\t\t643\r\n#define OBJ_des_cdmf\t\tOBJ_rsadsi,3L,10L\r\n\r\n#define SN_rsaOAEPEncryptionSET\t\t\"rsaOAEPEncryptionSET\"\r\n#define NID_rsaOAEPEncryptionSET\t\t644\r\n#define OBJ_rsaOAEPEncryptionSET\t\tOBJ_rsadsi,1L,1L,6L\r\n\r\n#define SN_ipsec3\t\t\"Oakley-EC2N-3\"\r\n#define LN_ipsec3\t\t\"ipsec3\"\r\n#define NID_ipsec3\t\t749\r\n\r\n#define SN_ipsec4\t\t\"Oakley-EC2N-4\"\r\n#define LN_ipsec4\t\t\"ipsec4\"\r\n#define NID_ipsec4\t\t750\r\n\r\n#define SN_whirlpool\t\t\"whirlpool\"\r\n#define NID_whirlpool\t\t804\r\n#define OBJ_whirlpool\t\tOBJ_iso,0L,10118L,3L,0L,55L\r\n\r\n#define SN_cryptopro\t\t\"cryptopro\"\r\n#define NID_cryptopro\t\t805\r\n#define OBJ_cryptopro\t\tOBJ_member_body,643L,2L,2L\r\n\r\n#define SN_cryptocom\t\t\"cryptocom\"\r\n#define NID_cryptocom\t\t806\r\n#define OBJ_cryptocom\t\tOBJ_member_body,643L,2L,9L\r\n\r\n#define SN_id_GostR3411_94_with_GostR3410_2001\t\t\"id-GostR3411-94-with-GostR3410-2001\"\r\n#define LN_id_GostR3411_94_with_GostR3410_2001\t\t\"GOST R 34.11-94 with GOST R 34.10-2001\"\r\n#define NID_id_GostR3411_94_with_GostR3410_2001\t\t807\r\n#define OBJ_id_GostR3411_94_with_GostR3410_2001\t\tOBJ_cryptopro,3L\r\n\r\n#define SN_id_GostR3411_94_with_GostR3410_94\t\t\"id-GostR3411-94-with-GostR3410-94\"\r\n#define LN_id_GostR3411_94_with_GostR3410_94\t\t\"GOST R 34.11-94 with GOST R 34.10-94\"\r\n#define NID_id_GostR3411_94_with_GostR3410_94\t\t808\r\n#define OBJ_id_GostR3411_94_with_GostR3410_94\t\tOBJ_cryptopro,4L\r\n\r\n#define SN_id_GostR3411_94\t\t\"md_gost94\"\r\n#define LN_id_GostR3411_94\t\t\"GOST R 34.11-94\"\r\n#define NID_id_GostR3411_94\t\t809\r\n#define OBJ_id_GostR3411_94\t\tOBJ_cryptopro,9L\r\n\r\n#define SN_id_HMACGostR3411_94\t\t\"id-HMACGostR3411-94\"\r\n#define LN_id_HMACGostR3411_94\t\t\"HMAC GOST 34.11-94\"\r\n#define NID_id_HMACGostR3411_94\t\t810\r\n#define OBJ_id_HMACGostR3411_94\t\tOBJ_cryptopro,10L\r\n\r\n#define SN_id_GostR3410_2001\t\t\"gost2001\"\r\n#define LN_id_GostR3410_2001\t\t\"GOST R 34.10-2001\"\r\n#define NID_id_GostR3410_2001\t\t811\r\n#define OBJ_id_GostR3410_2001\t\tOBJ_cryptopro,19L\r\n\r\n#define SN_id_GostR3410_94\t\t\"gost94\"\r\n#define LN_id_GostR3410_94\t\t\"GOST R 34.10-94\"\r\n#define NID_id_GostR3410_94\t\t812\r\n#define OBJ_id_GostR3410_94\t\tOBJ_cryptopro,20L\r\n\r\n#define SN_id_Gost28147_89\t\t\"gost89\"\r\n#define LN_id_Gost28147_89\t\t\"GOST 28147-89\"\r\n#define NID_id_Gost28147_89\t\t813\r\n#define OBJ_id_Gost28147_89\t\tOBJ_cryptopro,21L\r\n\r\n#define SN_gost89_cnt\t\t\"gost89-cnt\"\r\n#define NID_gost89_cnt\t\t814\r\n\r\n#define SN_id_Gost28147_89_MAC\t\t\"gost-mac\"\r\n#define LN_id_Gost28147_89_MAC\t\t\"GOST 28147-89 MAC\"\r\n#define NID_id_Gost28147_89_MAC\t\t815\r\n#define OBJ_id_Gost28147_89_MAC\t\tOBJ_cryptopro,22L\r\n\r\n#define SN_id_GostR3411_94_prf\t\t\"prf-gostr3411-94\"\r\n#define LN_id_GostR3411_94_prf\t\t\"GOST R 34.11-94 PRF\"\r\n#define NID_id_GostR3411_94_prf\t\t816\r\n#define OBJ_id_GostR3411_94_prf\t\tOBJ_cryptopro,23L\r\n\r\n#define SN_id_GostR3410_2001DH\t\t\"id-GostR3410-2001DH\"\r\n#define LN_id_GostR3410_2001DH\t\t\"GOST R 34.10-2001 DH\"\r\n#define NID_id_GostR3410_2001DH\t\t817\r\n#define OBJ_id_GostR3410_2001DH\t\tOBJ_cryptopro,98L\r\n\r\n#define SN_id_GostR3410_94DH\t\t\"id-GostR3410-94DH\"\r\n#define LN_id_GostR3410_94DH\t\t\"GOST R 34.10-94 DH\"\r\n#define NID_id_GostR3410_94DH\t\t818\r\n#define OBJ_id_GostR3410_94DH\t\tOBJ_cryptopro,99L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_KeyMeshing\t\t\"id-Gost28147-89-CryptoPro-KeyMeshing\"\r\n#define NID_id_Gost28147_89_CryptoPro_KeyMeshing\t\t819\r\n#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing\t\tOBJ_cryptopro,14L,1L\r\n\r\n#define SN_id_Gost28147_89_None_KeyMeshing\t\t\"id-Gost28147-89-None-KeyMeshing\"\r\n#define NID_id_Gost28147_89_None_KeyMeshing\t\t820\r\n#define OBJ_id_Gost28147_89_None_KeyMeshing\t\tOBJ_cryptopro,14L,0L\r\n\r\n#define SN_id_GostR3411_94_TestParamSet\t\t\"id-GostR3411-94-TestParamSet\"\r\n#define NID_id_GostR3411_94_TestParamSet\t\t821\r\n#define OBJ_id_GostR3411_94_TestParamSet\t\tOBJ_cryptopro,30L,0L\r\n\r\n#define SN_id_GostR3411_94_CryptoProParamSet\t\t\"id-GostR3411-94-CryptoProParamSet\"\r\n#define NID_id_GostR3411_94_CryptoProParamSet\t\t822\r\n#define OBJ_id_GostR3411_94_CryptoProParamSet\t\tOBJ_cryptopro,30L,1L\r\n\r\n#define SN_id_Gost28147_89_TestParamSet\t\t\"id-Gost28147-89-TestParamSet\"\r\n#define NID_id_Gost28147_89_TestParamSet\t\t823\r\n#define OBJ_id_Gost28147_89_TestParamSet\t\tOBJ_cryptopro,31L,0L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_A_ParamSet\t\t\"id-Gost28147-89-CryptoPro-A-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_A_ParamSet\t\t824\r\n#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet\t\tOBJ_cryptopro,31L,1L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_B_ParamSet\t\t\"id-Gost28147-89-CryptoPro-B-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_B_ParamSet\t\t825\r\n#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet\t\tOBJ_cryptopro,31L,2L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_C_ParamSet\t\t\"id-Gost28147-89-CryptoPro-C-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_C_ParamSet\t\t826\r\n#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet\t\tOBJ_cryptopro,31L,3L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_D_ParamSet\t\t\"id-Gost28147-89-CryptoPro-D-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_D_ParamSet\t\t827\r\n#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet\t\tOBJ_cryptopro,31L,4L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet\t\t\"id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet\t\t828\r\n#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet\t\tOBJ_cryptopro,31L,5L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet\t\t\"id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet\t\t829\r\n#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet\t\tOBJ_cryptopro,31L,6L\r\n\r\n#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet\t\t\"id-Gost28147-89-CryptoPro-RIC-1-ParamSet\"\r\n#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet\t\t830\r\n#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet\t\tOBJ_cryptopro,31L,7L\r\n\r\n#define SN_id_GostR3410_94_TestParamSet\t\t\"id-GostR3410-94-TestParamSet\"\r\n#define NID_id_GostR3410_94_TestParamSet\t\t831\r\n#define OBJ_id_GostR3410_94_TestParamSet\t\tOBJ_cryptopro,32L,0L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_A_ParamSet\t\t\"id-GostR3410-94-CryptoPro-A-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_A_ParamSet\t\t832\r\n#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet\t\tOBJ_cryptopro,32L,2L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_B_ParamSet\t\t\"id-GostR3410-94-CryptoPro-B-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_B_ParamSet\t\t833\r\n#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet\t\tOBJ_cryptopro,32L,3L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_C_ParamSet\t\t\"id-GostR3410-94-CryptoPro-C-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_C_ParamSet\t\t834\r\n#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet\t\tOBJ_cryptopro,32L,4L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_D_ParamSet\t\t\"id-GostR3410-94-CryptoPro-D-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_D_ParamSet\t\t835\r\n#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet\t\tOBJ_cryptopro,32L,5L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet\t\t\"id-GostR3410-94-CryptoPro-XchA-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet\t\t836\r\n#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet\t\tOBJ_cryptopro,33L,1L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet\t\t\"id-GostR3410-94-CryptoPro-XchB-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet\t\t837\r\n#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet\t\tOBJ_cryptopro,33L,2L\r\n\r\n#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet\t\t\"id-GostR3410-94-CryptoPro-XchC-ParamSet\"\r\n#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet\t\t838\r\n#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet\t\tOBJ_cryptopro,33L,3L\r\n\r\n#define SN_id_GostR3410_2001_TestParamSet\t\t\"id-GostR3410-2001-TestParamSet\"\r\n#define NID_id_GostR3410_2001_TestParamSet\t\t839\r\n#define OBJ_id_GostR3410_2001_TestParamSet\t\tOBJ_cryptopro,35L,0L\r\n\r\n#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-A-ParamSet\"\r\n#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet\t\t840\r\n#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet\t\tOBJ_cryptopro,35L,1L\r\n\r\n#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-B-ParamSet\"\r\n#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet\t\t841\r\n#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet\t\tOBJ_cryptopro,35L,2L\r\n\r\n#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-C-ParamSet\"\r\n#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet\t\t842\r\n#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet\t\tOBJ_cryptopro,35L,3L\r\n\r\n#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-XchA-ParamSet\"\r\n#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet\t\t843\r\n#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet\t\tOBJ_cryptopro,36L,0L\r\n\r\n#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-XchB-ParamSet\"\r\n#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet\t\t844\r\n#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet\t\tOBJ_cryptopro,36L,1L\r\n\r\n#define SN_id_GostR3410_94_a\t\t\"id-GostR3410-94-a\"\r\n#define NID_id_GostR3410_94_a\t\t845\r\n#define OBJ_id_GostR3410_94_a\t\tOBJ_id_GostR3410_94,1L\r\n\r\n#define SN_id_GostR3410_94_aBis\t\t\"id-GostR3410-94-aBis\"\r\n#define NID_id_GostR3410_94_aBis\t\t846\r\n#define OBJ_id_GostR3410_94_aBis\t\tOBJ_id_GostR3410_94,2L\r\n\r\n#define SN_id_GostR3410_94_b\t\t\"id-GostR3410-94-b\"\r\n#define NID_id_GostR3410_94_b\t\t847\r\n#define OBJ_id_GostR3410_94_b\t\tOBJ_id_GostR3410_94,3L\r\n\r\n#define SN_id_GostR3410_94_bBis\t\t\"id-GostR3410-94-bBis\"\r\n#define NID_id_GostR3410_94_bBis\t\t848\r\n#define OBJ_id_GostR3410_94_bBis\t\tOBJ_id_GostR3410_94,4L\r\n\r\n#define SN_id_Gost28147_89_cc\t\t\"id-Gost28147-89-cc\"\r\n#define LN_id_Gost28147_89_cc\t\t\"GOST 28147-89 Cryptocom ParamSet\"\r\n#define NID_id_Gost28147_89_cc\t\t849\r\n#define OBJ_id_Gost28147_89_cc\t\tOBJ_cryptocom,1L,6L,1L\r\n\r\n#define SN_id_GostR3410_94_cc\t\t\"gost94cc\"\r\n#define LN_id_GostR3410_94_cc\t\t\"GOST 34.10-94 Cryptocom\"\r\n#define NID_id_GostR3410_94_cc\t\t850\r\n#define OBJ_id_GostR3410_94_cc\t\tOBJ_cryptocom,1L,5L,3L\r\n\r\n#define SN_id_GostR3410_2001_cc\t\t\"gost2001cc\"\r\n#define LN_id_GostR3410_2001_cc\t\t\"GOST 34.10-2001 Cryptocom\"\r\n#define NID_id_GostR3410_2001_cc\t\t851\r\n#define OBJ_id_GostR3410_2001_cc\t\tOBJ_cryptocom,1L,5L,4L\r\n\r\n#define SN_id_GostR3411_94_with_GostR3410_94_cc\t\t\"id-GostR3411-94-with-GostR3410-94-cc\"\r\n#define LN_id_GostR3411_94_with_GostR3410_94_cc\t\t\"GOST R 34.11-94 with GOST R 34.10-94 Cryptocom\"\r\n#define NID_id_GostR3411_94_with_GostR3410_94_cc\t\t852\r\n#define OBJ_id_GostR3411_94_with_GostR3410_94_cc\t\tOBJ_cryptocom,1L,3L,3L\r\n\r\n#define SN_id_GostR3411_94_with_GostR3410_2001_cc\t\t\"id-GostR3411-94-with-GostR3410-2001-cc\"\r\n#define LN_id_GostR3411_94_with_GostR3410_2001_cc\t\t\"GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom\"\r\n#define NID_id_GostR3411_94_with_GostR3410_2001_cc\t\t853\r\n#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc\t\tOBJ_cryptocom,1L,3L,4L\r\n\r\n#define SN_id_GostR3410_2001_ParamSet_cc\t\t\"id-GostR3410-2001-ParamSet-cc\"\r\n#define LN_id_GostR3410_2001_ParamSet_cc\t\t\"GOST R 3410-2001 Parameter Set Cryptocom\"\r\n#define NID_id_GostR3410_2001_ParamSet_cc\t\t854\r\n#define OBJ_id_GostR3410_2001_ParamSet_cc\t\tOBJ_cryptocom,1L,8L,1L\r\n\r\n#define SN_camellia_128_cbc\t\t\"CAMELLIA-128-CBC\"\r\n#define LN_camellia_128_cbc\t\t\"camellia-128-cbc\"\r\n#define NID_camellia_128_cbc\t\t751\r\n#define OBJ_camellia_128_cbc\t\t1L,2L,392L,200011L,61L,1L,1L,1L,2L\r\n\r\n#define SN_camellia_192_cbc\t\t\"CAMELLIA-192-CBC\"\r\n#define LN_camellia_192_cbc\t\t\"camellia-192-cbc\"\r\n#define NID_camellia_192_cbc\t\t752\r\n#define OBJ_camellia_192_cbc\t\t1L,2L,392L,200011L,61L,1L,1L,1L,3L\r\n\r\n#define SN_camellia_256_cbc\t\t\"CAMELLIA-256-CBC\"\r\n#define LN_camellia_256_cbc\t\t\"camellia-256-cbc\"\r\n#define NID_camellia_256_cbc\t\t753\r\n#define OBJ_camellia_256_cbc\t\t1L,2L,392L,200011L,61L,1L,1L,1L,4L\r\n\r\n#define SN_id_camellia128_wrap\t\t\"id-camellia128-wrap\"\r\n#define NID_id_camellia128_wrap\t\t907\r\n#define OBJ_id_camellia128_wrap\t\t1L,2L,392L,200011L,61L,1L,1L,3L,2L\r\n\r\n#define SN_id_camellia192_wrap\t\t\"id-camellia192-wrap\"\r\n#define NID_id_camellia192_wrap\t\t908\r\n#define OBJ_id_camellia192_wrap\t\t1L,2L,392L,200011L,61L,1L,1L,3L,3L\r\n\r\n#define SN_id_camellia256_wrap\t\t\"id-camellia256-wrap\"\r\n#define NID_id_camellia256_wrap\t\t909\r\n#define OBJ_id_camellia256_wrap\t\t1L,2L,392L,200011L,61L,1L,1L,3L,4L\r\n\r\n#define OBJ_ntt_ds\t\t0L,3L,4401L,5L\r\n\r\n#define OBJ_camellia\t\tOBJ_ntt_ds,3L,1L,9L\r\n\r\n#define SN_camellia_128_ecb\t\t\"CAMELLIA-128-ECB\"\r\n#define LN_camellia_128_ecb\t\t\"camellia-128-ecb\"\r\n#define NID_camellia_128_ecb\t\t754\r\n#define OBJ_camellia_128_ecb\t\tOBJ_camellia,1L\r\n\r\n#define SN_camellia_128_ofb128\t\t\"CAMELLIA-128-OFB\"\r\n#define LN_camellia_128_ofb128\t\t\"camellia-128-ofb\"\r\n#define NID_camellia_128_ofb128\t\t766\r\n#define OBJ_camellia_128_ofb128\t\tOBJ_camellia,3L\r\n\r\n#define SN_camellia_128_cfb128\t\t\"CAMELLIA-128-CFB\"\r\n#define LN_camellia_128_cfb128\t\t\"camellia-128-cfb\"\r\n#define NID_camellia_128_cfb128\t\t757\r\n#define OBJ_camellia_128_cfb128\t\tOBJ_camellia,4L\r\n\r\n#define SN_camellia_192_ecb\t\t\"CAMELLIA-192-ECB\"\r\n#define LN_camellia_192_ecb\t\t\"camellia-192-ecb\"\r\n#define NID_camellia_192_ecb\t\t755\r\n#define OBJ_camellia_192_ecb\t\tOBJ_camellia,21L\r\n\r\n#define SN_camellia_192_ofb128\t\t\"CAMELLIA-192-OFB\"\r\n#define LN_camellia_192_ofb128\t\t\"camellia-192-ofb\"\r\n#define NID_camellia_192_ofb128\t\t767\r\n#define OBJ_camellia_192_ofb128\t\tOBJ_camellia,23L\r\n\r\n#define SN_camellia_192_cfb128\t\t\"CAMELLIA-192-CFB\"\r\n#define LN_camellia_192_cfb128\t\t\"camellia-192-cfb\"\r\n#define NID_camellia_192_cfb128\t\t758\r\n#define OBJ_camellia_192_cfb128\t\tOBJ_camellia,24L\r\n\r\n#define SN_camellia_256_ecb\t\t\"CAMELLIA-256-ECB\"\r\n#define LN_camellia_256_ecb\t\t\"camellia-256-ecb\"\r\n#define NID_camellia_256_ecb\t\t756\r\n#define OBJ_camellia_256_ecb\t\tOBJ_camellia,41L\r\n\r\n#define SN_camellia_256_ofb128\t\t\"CAMELLIA-256-OFB\"\r\n#define LN_camellia_256_ofb128\t\t\"camellia-256-ofb\"\r\n#define NID_camellia_256_ofb128\t\t768\r\n#define OBJ_camellia_256_ofb128\t\tOBJ_camellia,43L\r\n\r\n#define SN_camellia_256_cfb128\t\t\"CAMELLIA-256-CFB\"\r\n#define LN_camellia_256_cfb128\t\t\"camellia-256-cfb\"\r\n#define NID_camellia_256_cfb128\t\t759\r\n#define OBJ_camellia_256_cfb128\t\tOBJ_camellia,44L\r\n\r\n#define SN_camellia_128_cfb1\t\t\"CAMELLIA-128-CFB1\"\r\n#define LN_camellia_128_cfb1\t\t\"camellia-128-cfb1\"\r\n#define NID_camellia_128_cfb1\t\t760\r\n\r\n#define SN_camellia_192_cfb1\t\t\"CAMELLIA-192-CFB1\"\r\n#define LN_camellia_192_cfb1\t\t\"camellia-192-cfb1\"\r\n#define NID_camellia_192_cfb1\t\t761\r\n\r\n#define SN_camellia_256_cfb1\t\t\"CAMELLIA-256-CFB1\"\r\n#define LN_camellia_256_cfb1\t\t\"camellia-256-cfb1\"\r\n#define NID_camellia_256_cfb1\t\t762\r\n\r\n#define SN_camellia_128_cfb8\t\t\"CAMELLIA-128-CFB8\"\r\n#define LN_camellia_128_cfb8\t\t\"camellia-128-cfb8\"\r\n#define NID_camellia_128_cfb8\t\t763\r\n\r\n#define SN_camellia_192_cfb8\t\t\"CAMELLIA-192-CFB8\"\r\n#define LN_camellia_192_cfb8\t\t\"camellia-192-cfb8\"\r\n#define NID_camellia_192_cfb8\t\t764\r\n\r\n#define SN_camellia_256_cfb8\t\t\"CAMELLIA-256-CFB8\"\r\n#define LN_camellia_256_cfb8\t\t\"camellia-256-cfb8\"\r\n#define NID_camellia_256_cfb8\t\t765\r\n\r\n#define SN_kisa\t\t\"KISA\"\r\n#define LN_kisa\t\t\"kisa\"\r\n#define NID_kisa\t\t773\r\n#define OBJ_kisa\t\tOBJ_member_body,410L,200004L\r\n\r\n#define SN_seed_ecb\t\t\"SEED-ECB\"\r\n#define LN_seed_ecb\t\t\"seed-ecb\"\r\n#define NID_seed_ecb\t\t776\r\n#define OBJ_seed_ecb\t\tOBJ_kisa,1L,3L\r\n\r\n#define SN_seed_cbc\t\t\"SEED-CBC\"\r\n#define LN_seed_cbc\t\t\"seed-cbc\"\r\n#define NID_seed_cbc\t\t777\r\n#define OBJ_seed_cbc\t\tOBJ_kisa,1L,4L\r\n\r\n#define SN_seed_cfb128\t\t\"SEED-CFB\"\r\n#define LN_seed_cfb128\t\t\"seed-cfb\"\r\n#define NID_seed_cfb128\t\t779\r\n#define OBJ_seed_cfb128\t\tOBJ_kisa,1L,5L\r\n\r\n#define SN_seed_ofb128\t\t\"SEED-OFB\"\r\n#define LN_seed_ofb128\t\t\"seed-ofb\"\r\n#define NID_seed_ofb128\t\t778\r\n#define OBJ_seed_ofb128\t\tOBJ_kisa,1L,6L\r\n\r\n#define SN_hmac\t\t\"HMAC\"\r\n#define LN_hmac\t\t\"hmac\"\r\n#define NID_hmac\t\t855\r\n\r\n#define SN_cmac\t\t\"CMAC\"\r\n#define LN_cmac\t\t\"cmac\"\r\n#define NID_cmac\t\t894\r\n\r\n#define SN_rc4_hmac_md5\t\t\"RC4-HMAC-MD5\"\r\n#define LN_rc4_hmac_md5\t\t\"rc4-hmac-md5\"\r\n#define NID_rc4_hmac_md5\t\t915\r\n\r\n#define SN_aes_128_cbc_hmac_sha1\t\t\"AES-128-CBC-HMAC-SHA1\"\r\n#define LN_aes_128_cbc_hmac_sha1\t\t\"aes-128-cbc-hmac-sha1\"\r\n#define NID_aes_128_cbc_hmac_sha1\t\t916\r\n\r\n#define SN_aes_192_cbc_hmac_sha1\t\t\"AES-192-CBC-HMAC-SHA1\"\r\n#define LN_aes_192_cbc_hmac_sha1\t\t\"aes-192-cbc-hmac-sha1\"\r\n#define NID_aes_192_cbc_hmac_sha1\t\t917\r\n\r\n#define SN_aes_256_cbc_hmac_sha1\t\t\"AES-256-CBC-HMAC-SHA1\"\r\n#define LN_aes_256_cbc_hmac_sha1\t\t\"aes-256-cbc-hmac-sha1\"\r\n#define NID_aes_256_cbc_hmac_sha1\t\t918\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/objects.h",
    "content": "/* crypto/objects/objects.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_OBJECTS_H\r\n#define HEADER_OBJECTS_H\r\n\r\n#define USE_OBJ_MAC\r\n\r\n#ifdef USE_OBJ_MAC\r\n#include <openssl/obj_mac.h>\r\n#else\r\n#define SN_undef\t\t\t\"UNDEF\"\r\n#define LN_undef\t\t\t\"undefined\"\r\n#define NID_undef\t\t\t0\r\n#define OBJ_undef\t\t\t0L\r\n\r\n#define SN_Algorithm\t\t\t\"Algorithm\"\r\n#define LN_algorithm\t\t\t\"algorithm\"\r\n#define NID_algorithm\t\t\t38\r\n#define OBJ_algorithm\t\t\t1L,3L,14L,3L,2L\r\n\r\n#define LN_rsadsi\t\t\t\"rsadsi\"\r\n#define NID_rsadsi\t\t\t1\r\n#define OBJ_rsadsi\t\t\t1L,2L,840L,113549L\r\n\r\n#define LN_pkcs\t\t\t\t\"pkcs\"\r\n#define NID_pkcs\t\t\t2\r\n#define OBJ_pkcs\t\t\tOBJ_rsadsi,1L\r\n\r\n#define SN_md2\t\t\t\t\"MD2\"\r\n#define LN_md2\t\t\t\t\"md2\"\r\n#define NID_md2\t\t\t\t3\r\n#define OBJ_md2\t\t\t\tOBJ_rsadsi,2L,2L\r\n\r\n#define SN_md5\t\t\t\t\"MD5\"\r\n#define LN_md5\t\t\t\t\"md5\"\r\n#define NID_md5\t\t\t\t4\r\n#define OBJ_md5\t\t\t\tOBJ_rsadsi,2L,5L\r\n\r\n#define SN_rc4\t\t\t\t\"RC4\"\r\n#define LN_rc4\t\t\t\t\"rc4\"\r\n#define NID_rc4\t\t\t\t5\r\n#define OBJ_rc4\t\t\t\tOBJ_rsadsi,3L,4L\r\n\r\n#define LN_rsaEncryption\t\t\"rsaEncryption\"\r\n#define NID_rsaEncryption\t\t6\r\n#define OBJ_rsaEncryption\t\tOBJ_pkcs,1L,1L\r\n\r\n#define SN_md2WithRSAEncryption\t\t\"RSA-MD2\"\r\n#define LN_md2WithRSAEncryption\t\t\"md2WithRSAEncryption\"\r\n#define NID_md2WithRSAEncryption\t7\r\n#define OBJ_md2WithRSAEncryption\tOBJ_pkcs,1L,2L\r\n\r\n#define SN_md5WithRSAEncryption\t\t\"RSA-MD5\"\r\n#define LN_md5WithRSAEncryption\t\t\"md5WithRSAEncryption\"\r\n#define NID_md5WithRSAEncryption\t8\r\n#define OBJ_md5WithRSAEncryption\tOBJ_pkcs,1L,4L\r\n\r\n#define SN_pbeWithMD2AndDES_CBC\t\t\"PBE-MD2-DES\"\r\n#define LN_pbeWithMD2AndDES_CBC\t\t\"pbeWithMD2AndDES-CBC\"\r\n#define NID_pbeWithMD2AndDES_CBC\t9\r\n#define OBJ_pbeWithMD2AndDES_CBC\tOBJ_pkcs,5L,1L\r\n\r\n#define SN_pbeWithMD5AndDES_CBC\t\t\"PBE-MD5-DES\"\r\n#define LN_pbeWithMD5AndDES_CBC\t\t\"pbeWithMD5AndDES-CBC\"\r\n#define NID_pbeWithMD5AndDES_CBC\t10\r\n#define OBJ_pbeWithMD5AndDES_CBC\tOBJ_pkcs,5L,3L\r\n\r\n#define LN_X500\t\t\t\t\"X500\"\r\n#define NID_X500\t\t\t11\r\n#define OBJ_X500\t\t\t2L,5L\r\n\r\n#define LN_X509\t\t\t\t\"X509\"\r\n#define NID_X509\t\t\t12\r\n#define OBJ_X509\t\t\tOBJ_X500,4L\r\n\r\n#define SN_commonName\t\t\t\"CN\"\r\n#define LN_commonName\t\t\t\"commonName\"\r\n#define NID_commonName\t\t\t13\r\n#define OBJ_commonName\t\t\tOBJ_X509,3L\r\n\r\n#define SN_countryName\t\t\t\"C\"\r\n#define LN_countryName\t\t\t\"countryName\"\r\n#define NID_countryName\t\t\t14\r\n#define OBJ_countryName\t\t\tOBJ_X509,6L\r\n\r\n#define SN_localityName\t\t\t\"L\"\r\n#define LN_localityName\t\t\t\"localityName\"\r\n#define NID_localityName\t\t15\r\n#define OBJ_localityName\t\tOBJ_X509,7L\r\n\r\n/* Postal Address? PA */\r\n\r\n/* should be \"ST\" (rfc1327) but MS uses 'S' */\r\n#define SN_stateOrProvinceName\t\t\"ST\"\r\n#define LN_stateOrProvinceName\t\t\"stateOrProvinceName\"\r\n#define NID_stateOrProvinceName\t\t16\r\n#define OBJ_stateOrProvinceName\t\tOBJ_X509,8L\r\n\r\n#define SN_organizationName\t\t\"O\"\r\n#define LN_organizationName\t\t\"organizationName\"\r\n#define NID_organizationName\t\t17\r\n#define OBJ_organizationName\t\tOBJ_X509,10L\r\n\r\n#define SN_organizationalUnitName\t\"OU\"\r\n#define LN_organizationalUnitName\t\"organizationalUnitName\"\r\n#define NID_organizationalUnitName\t18\r\n#define OBJ_organizationalUnitName\tOBJ_X509,11L\r\n\r\n#define SN_rsa\t\t\t\t\"RSA\"\r\n#define LN_rsa\t\t\t\t\"rsa\"\r\n#define NID_rsa\t\t\t\t19\r\n#define OBJ_rsa\t\t\t\tOBJ_X500,8L,1L,1L\r\n\r\n#define LN_pkcs7\t\t\t\"pkcs7\"\r\n#define NID_pkcs7\t\t\t20\r\n#define OBJ_pkcs7\t\t\tOBJ_pkcs,7L\r\n\r\n#define LN_pkcs7_data\t\t\t\"pkcs7-data\"\r\n#define NID_pkcs7_data\t\t\t21\r\n#define OBJ_pkcs7_data\t\t\tOBJ_pkcs7,1L\r\n\r\n#define LN_pkcs7_signed\t\t\t\"pkcs7-signedData\"\r\n#define NID_pkcs7_signed\t\t22\r\n#define OBJ_pkcs7_signed\t\tOBJ_pkcs7,2L\r\n\r\n#define LN_pkcs7_enveloped\t\t\"pkcs7-envelopedData\"\r\n#define NID_pkcs7_enveloped\t\t23\r\n#define OBJ_pkcs7_enveloped\t\tOBJ_pkcs7,3L\r\n\r\n#define LN_pkcs7_signedAndEnveloped\t\"pkcs7-signedAndEnvelopedData\"\r\n#define NID_pkcs7_signedAndEnveloped\t24\r\n#define OBJ_pkcs7_signedAndEnveloped\tOBJ_pkcs7,4L\r\n\r\n#define LN_pkcs7_digest\t\t\t\"pkcs7-digestData\"\r\n#define NID_pkcs7_digest\t\t25\r\n#define OBJ_pkcs7_digest\t\tOBJ_pkcs7,5L\r\n\r\n#define LN_pkcs7_encrypted\t\t\"pkcs7-encryptedData\"\r\n#define NID_pkcs7_encrypted\t\t26\r\n#define OBJ_pkcs7_encrypted\t\tOBJ_pkcs7,6L\r\n\r\n#define LN_pkcs3\t\t\t\"pkcs3\"\r\n#define NID_pkcs3\t\t\t27\r\n#define OBJ_pkcs3\t\t\tOBJ_pkcs,3L\r\n\r\n#define LN_dhKeyAgreement\t\t\"dhKeyAgreement\"\r\n#define NID_dhKeyAgreement\t\t28\r\n#define OBJ_dhKeyAgreement\t\tOBJ_pkcs3,1L\r\n\r\n#define SN_des_ecb\t\t\t\"DES-ECB\"\r\n#define LN_des_ecb\t\t\t\"des-ecb\"\r\n#define NID_des_ecb\t\t\t29\r\n#define OBJ_des_ecb\t\t\tOBJ_algorithm,6L\r\n\r\n#define SN_des_cfb64\t\t\t\"DES-CFB\"\r\n#define LN_des_cfb64\t\t\t\"des-cfb\"\r\n#define NID_des_cfb64\t\t\t30\r\n/* IV + num */\r\n#define OBJ_des_cfb64\t\t\tOBJ_algorithm,9L\r\n\r\n#define SN_des_cbc\t\t\t\"DES-CBC\"\r\n#define LN_des_cbc\t\t\t\"des-cbc\"\r\n#define NID_des_cbc\t\t\t31\r\n/* IV */\r\n#define OBJ_des_cbc\t\t\tOBJ_algorithm,7L\r\n\r\n#define SN_des_ede\t\t\t\"DES-EDE\"\r\n#define LN_des_ede\t\t\t\"des-ede\"\r\n#define NID_des_ede\t\t\t32\r\n/* ?? */\r\n#define OBJ_des_ede\t\t\tOBJ_algorithm,17L\r\n\r\n#define SN_des_ede3\t\t\t\"DES-EDE3\"\r\n#define LN_des_ede3\t\t\t\"des-ede3\"\r\n#define NID_des_ede3\t\t\t33\r\n\r\n#define SN_idea_cbc\t\t\t\"IDEA-CBC\"\r\n#define LN_idea_cbc\t\t\t\"idea-cbc\"\r\n#define NID_idea_cbc\t\t\t34\r\n#define OBJ_idea_cbc\t\t\t1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L\r\n\r\n#define SN_idea_cfb64\t\t\t\"IDEA-CFB\"\r\n#define LN_idea_cfb64\t\t\t\"idea-cfb\"\r\n#define NID_idea_cfb64\t\t\t35\r\n\r\n#define SN_idea_ecb\t\t\t\"IDEA-ECB\"\r\n#define LN_idea_ecb\t\t\t\"idea-ecb\"\r\n#define NID_idea_ecb\t\t\t36\r\n\r\n#define SN_rc2_cbc\t\t\t\"RC2-CBC\"\r\n#define LN_rc2_cbc\t\t\t\"rc2-cbc\"\r\n#define NID_rc2_cbc\t\t\t37\r\n#define OBJ_rc2_cbc\t\t\tOBJ_rsadsi,3L,2L\r\n\r\n#define SN_rc2_ecb\t\t\t\"RC2-ECB\"\r\n#define LN_rc2_ecb\t\t\t\"rc2-ecb\"\r\n#define NID_rc2_ecb\t\t\t38\r\n\r\n#define SN_rc2_cfb64\t\t\t\"RC2-CFB\"\r\n#define LN_rc2_cfb64\t\t\t\"rc2-cfb\"\r\n#define NID_rc2_cfb64\t\t\t39\r\n\r\n#define SN_rc2_ofb64\t\t\t\"RC2-OFB\"\r\n#define LN_rc2_ofb64\t\t\t\"rc2-ofb\"\r\n#define NID_rc2_ofb64\t\t\t40\r\n\r\n#define SN_sha\t\t\t\t\"SHA\"\r\n#define LN_sha\t\t\t\t\"sha\"\r\n#define NID_sha\t\t\t\t41\r\n#define OBJ_sha\t\t\t\tOBJ_algorithm,18L\r\n\r\n#define SN_shaWithRSAEncryption\t\t\"RSA-SHA\"\r\n#define LN_shaWithRSAEncryption\t\t\"shaWithRSAEncryption\"\r\n#define NID_shaWithRSAEncryption\t42\r\n#define OBJ_shaWithRSAEncryption\tOBJ_algorithm,15L\r\n\r\n#define SN_des_ede_cbc\t\t\t\"DES-EDE-CBC\"\r\n#define LN_des_ede_cbc\t\t\t\"des-ede-cbc\"\r\n#define NID_des_ede_cbc\t\t\t43\r\n\r\n#define SN_des_ede3_cbc\t\t\t\"DES-EDE3-CBC\"\r\n#define LN_des_ede3_cbc\t\t\t\"des-ede3-cbc\"\r\n#define NID_des_ede3_cbc\t\t44\r\n#define OBJ_des_ede3_cbc\t\tOBJ_rsadsi,3L,7L\r\n\r\n#define SN_des_ofb64\t\t\t\"DES-OFB\"\r\n#define LN_des_ofb64\t\t\t\"des-ofb\"\r\n#define NID_des_ofb64\t\t\t45\r\n#define OBJ_des_ofb64\t\t\tOBJ_algorithm,8L\r\n\r\n#define SN_idea_ofb64\t\t\t\"IDEA-OFB\"\r\n#define LN_idea_ofb64\t\t\t\"idea-ofb\"\r\n#define NID_idea_ofb64\t\t\t46\r\n\r\n#define LN_pkcs9\t\t\t\"pkcs9\"\r\n#define NID_pkcs9\t\t\t47\r\n#define OBJ_pkcs9\t\t\tOBJ_pkcs,9L\r\n\r\n#define SN_pkcs9_emailAddress\t\t\"Email\"\r\n#define LN_pkcs9_emailAddress\t\t\"emailAddress\"\r\n#define NID_pkcs9_emailAddress\t\t48\r\n#define OBJ_pkcs9_emailAddress\t\tOBJ_pkcs9,1L\r\n\r\n#define LN_pkcs9_unstructuredName\t\"unstructuredName\"\r\n#define NID_pkcs9_unstructuredName\t49\r\n#define OBJ_pkcs9_unstructuredName\tOBJ_pkcs9,2L\r\n\r\n#define LN_pkcs9_contentType\t\t\"contentType\"\r\n#define NID_pkcs9_contentType\t\t50\r\n#define OBJ_pkcs9_contentType\t\tOBJ_pkcs9,3L\r\n\r\n#define LN_pkcs9_messageDigest\t\t\"messageDigest\"\r\n#define NID_pkcs9_messageDigest\t\t51\r\n#define OBJ_pkcs9_messageDigest\t\tOBJ_pkcs9,4L\r\n\r\n#define LN_pkcs9_signingTime\t\t\"signingTime\"\r\n#define NID_pkcs9_signingTime\t\t52\r\n#define OBJ_pkcs9_signingTime\t\tOBJ_pkcs9,5L\r\n\r\n#define LN_pkcs9_countersignature\t\"countersignature\"\r\n#define NID_pkcs9_countersignature\t53\r\n#define OBJ_pkcs9_countersignature\tOBJ_pkcs9,6L\r\n\r\n#define LN_pkcs9_challengePassword\t\"challengePassword\"\r\n#define NID_pkcs9_challengePassword\t54\r\n#define OBJ_pkcs9_challengePassword\tOBJ_pkcs9,7L\r\n\r\n#define LN_pkcs9_unstructuredAddress\t\"unstructuredAddress\"\r\n#define NID_pkcs9_unstructuredAddress\t55\r\n#define OBJ_pkcs9_unstructuredAddress\tOBJ_pkcs9,8L\r\n\r\n#define LN_pkcs9_extCertAttributes\t\"extendedCertificateAttributes\"\r\n#define NID_pkcs9_extCertAttributes\t56\r\n#define OBJ_pkcs9_extCertAttributes\tOBJ_pkcs9,9L\r\n\r\n#define SN_netscape\t\t\t\"Netscape\"\r\n#define LN_netscape\t\t\t\"Netscape Communications Corp.\"\r\n#define NID_netscape\t\t\t57\r\n#define OBJ_netscape\t\t\t2L,16L,840L,1L,113730L\r\n\r\n#define SN_netscape_cert_extension\t\"nsCertExt\"\r\n#define LN_netscape_cert_extension\t\"Netscape Certificate Extension\"\r\n#define NID_netscape_cert_extension\t58\r\n#define OBJ_netscape_cert_extension\tOBJ_netscape,1L\r\n\r\n#define SN_netscape_data_type\t\t\"nsDataType\"\r\n#define LN_netscape_data_type\t\t\"Netscape Data Type\"\r\n#define NID_netscape_data_type\t\t59\r\n#define OBJ_netscape_data_type\t\tOBJ_netscape,2L\r\n\r\n#define SN_des_ede_cfb64\t\t\"DES-EDE-CFB\"\r\n#define LN_des_ede_cfb64\t\t\"des-ede-cfb\"\r\n#define NID_des_ede_cfb64\t\t60\r\n\r\n#define SN_des_ede3_cfb64\t\t\"DES-EDE3-CFB\"\r\n#define LN_des_ede3_cfb64\t\t\"des-ede3-cfb\"\r\n#define NID_des_ede3_cfb64\t\t61\r\n\r\n#define SN_des_ede_ofb64\t\t\"DES-EDE-OFB\"\r\n#define LN_des_ede_ofb64\t\t\"des-ede-ofb\"\r\n#define NID_des_ede_ofb64\t\t62\r\n\r\n#define SN_des_ede3_ofb64\t\t\"DES-EDE3-OFB\"\r\n#define LN_des_ede3_ofb64\t\t\"des-ede3-ofb\"\r\n#define NID_des_ede3_ofb64\t\t63\r\n\r\n/* I'm not sure about the object ID */\r\n#define SN_sha1\t\t\t\t\"SHA1\"\r\n#define LN_sha1\t\t\t\t\"sha1\"\r\n#define NID_sha1\t\t\t64\r\n#define OBJ_sha1\t\t\tOBJ_algorithm,26L\r\n/* 28 Jun 1996 - eay */\r\n/* #define OBJ_sha1\t\t\t1L,3L,14L,2L,26L,05L <- wrong */\r\n\r\n#define SN_sha1WithRSAEncryption\t\"RSA-SHA1\"\r\n#define LN_sha1WithRSAEncryption\t\"sha1WithRSAEncryption\"\r\n#define NID_sha1WithRSAEncryption\t65\r\n#define OBJ_sha1WithRSAEncryption\tOBJ_pkcs,1L,5L\r\n\r\n#define SN_dsaWithSHA\t\t\t\"DSA-SHA\"\r\n#define LN_dsaWithSHA\t\t\t\"dsaWithSHA\"\r\n#define NID_dsaWithSHA\t\t\t66\r\n#define OBJ_dsaWithSHA\t\t\tOBJ_algorithm,13L\r\n\r\n#define SN_dsa_2\t\t\t\"DSA-old\"\r\n#define LN_dsa_2\t\t\t\"dsaEncryption-old\"\r\n#define NID_dsa_2\t\t\t67\r\n#define OBJ_dsa_2\t\t\tOBJ_algorithm,12L\r\n\r\n/* proposed by microsoft to RSA */\r\n#define SN_pbeWithSHA1AndRC2_CBC\t\"PBE-SHA1-RC2-64\"\r\n#define LN_pbeWithSHA1AndRC2_CBC\t\"pbeWithSHA1AndRC2-CBC\"\r\n#define NID_pbeWithSHA1AndRC2_CBC\t68\r\n#define OBJ_pbeWithSHA1AndRC2_CBC\tOBJ_pkcs,5L,11L \r\n\r\n/* proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now\r\n * defined explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something\r\n * completely different.\r\n */\r\n#define LN_id_pbkdf2\t\t\t\"PBKDF2\"\r\n#define NID_id_pbkdf2\t\t\t69\r\n#define OBJ_id_pbkdf2\t\t\tOBJ_pkcs,5L,12L \r\n\r\n#define SN_dsaWithSHA1_2\t\t\"DSA-SHA1-old\"\r\n#define LN_dsaWithSHA1_2\t\t\"dsaWithSHA1-old\"\r\n#define NID_dsaWithSHA1_2\t\t70\r\n/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */\r\n#define OBJ_dsaWithSHA1_2\t\tOBJ_algorithm,27L\r\n\r\n#define SN_netscape_cert_type\t\t\"nsCertType\"\r\n#define LN_netscape_cert_type\t\t\"Netscape Cert Type\"\r\n#define NID_netscape_cert_type\t\t71\r\n#define OBJ_netscape_cert_type\t\tOBJ_netscape_cert_extension,1L\r\n\r\n#define SN_netscape_base_url\t\t\"nsBaseUrl\"\r\n#define LN_netscape_base_url\t\t\"Netscape Base Url\"\r\n#define NID_netscape_base_url\t\t72\r\n#define OBJ_netscape_base_url\t\tOBJ_netscape_cert_extension,2L\r\n\r\n#define SN_netscape_revocation_url\t\"nsRevocationUrl\"\r\n#define LN_netscape_revocation_url\t\"Netscape Revocation Url\"\r\n#define NID_netscape_revocation_url\t73\r\n#define OBJ_netscape_revocation_url\tOBJ_netscape_cert_extension,3L\r\n\r\n#define SN_netscape_ca_revocation_url\t\"nsCaRevocationUrl\"\r\n#define LN_netscape_ca_revocation_url\t\"Netscape CA Revocation Url\"\r\n#define NID_netscape_ca_revocation_url\t74\r\n#define OBJ_netscape_ca_revocation_url\tOBJ_netscape_cert_extension,4L\r\n\r\n#define SN_netscape_renewal_url\t\t\"nsRenewalUrl\"\r\n#define LN_netscape_renewal_url\t\t\"Netscape Renewal Url\"\r\n#define NID_netscape_renewal_url\t75\r\n#define OBJ_netscape_renewal_url\tOBJ_netscape_cert_extension,7L\r\n\r\n#define SN_netscape_ca_policy_url\t\"nsCaPolicyUrl\"\r\n#define LN_netscape_ca_policy_url\t\"Netscape CA Policy Url\"\r\n#define NID_netscape_ca_policy_url\t76\r\n#define OBJ_netscape_ca_policy_url\tOBJ_netscape_cert_extension,8L\r\n\r\n#define SN_netscape_ssl_server_name\t\"nsSslServerName\"\r\n#define LN_netscape_ssl_server_name\t\"Netscape SSL Server Name\"\r\n#define NID_netscape_ssl_server_name\t77\r\n#define OBJ_netscape_ssl_server_name\tOBJ_netscape_cert_extension,12L\r\n\r\n#define SN_netscape_comment\t\t\"nsComment\"\r\n#define LN_netscape_comment\t\t\"Netscape Comment\"\r\n#define NID_netscape_comment\t\t78\r\n#define OBJ_netscape_comment\t\tOBJ_netscape_cert_extension,13L\r\n\r\n#define SN_netscape_cert_sequence\t\"nsCertSequence\"\r\n#define LN_netscape_cert_sequence\t\"Netscape Certificate Sequence\"\r\n#define NID_netscape_cert_sequence\t79\r\n#define OBJ_netscape_cert_sequence\tOBJ_netscape_data_type,5L\r\n\r\n#define SN_desx_cbc\t\t\t\"DESX-CBC\"\r\n#define LN_desx_cbc\t\t\t\"desx-cbc\"\r\n#define NID_desx_cbc\t\t\t80\r\n\r\n#define SN_id_ce\t\t\t\"id-ce\"\r\n#define NID_id_ce\t\t\t81\r\n#define OBJ_id_ce\t\t\t2L,5L,29L\r\n\r\n#define SN_subject_key_identifier\t\"subjectKeyIdentifier\"\r\n#define LN_subject_key_identifier\t\"X509v3 Subject Key Identifier\"\r\n#define NID_subject_key_identifier\t82\r\n#define OBJ_subject_key_identifier\tOBJ_id_ce,14L\r\n\r\n#define SN_key_usage\t\t\t\"keyUsage\"\r\n#define LN_key_usage\t\t\t\"X509v3 Key Usage\"\r\n#define NID_key_usage\t\t\t83\r\n#define OBJ_key_usage\t\t\tOBJ_id_ce,15L\r\n\r\n#define SN_private_key_usage_period\t\"privateKeyUsagePeriod\"\r\n#define LN_private_key_usage_period\t\"X509v3 Private Key Usage Period\"\r\n#define NID_private_key_usage_period\t84\r\n#define OBJ_private_key_usage_period\tOBJ_id_ce,16L\r\n\r\n#define SN_subject_alt_name\t\t\"subjectAltName\"\r\n#define LN_subject_alt_name\t\t\"X509v3 Subject Alternative Name\"\r\n#define NID_subject_alt_name\t\t85\r\n#define OBJ_subject_alt_name\t\tOBJ_id_ce,17L\r\n\r\n#define SN_issuer_alt_name\t\t\"issuerAltName\"\r\n#define LN_issuer_alt_name\t\t\"X509v3 Issuer Alternative Name\"\r\n#define NID_issuer_alt_name\t\t86\r\n#define OBJ_issuer_alt_name\t\tOBJ_id_ce,18L\r\n\r\n#define SN_basic_constraints\t\t\"basicConstraints\"\r\n#define LN_basic_constraints\t\t\"X509v3 Basic Constraints\"\r\n#define NID_basic_constraints\t\t87\r\n#define OBJ_basic_constraints\t\tOBJ_id_ce,19L\r\n\r\n#define SN_crl_number\t\t\t\"crlNumber\"\r\n#define LN_crl_number\t\t\t\"X509v3 CRL Number\"\r\n#define NID_crl_number\t\t\t88\r\n#define OBJ_crl_number\t\t\tOBJ_id_ce,20L\r\n\r\n#define SN_certificate_policies\t\t\"certificatePolicies\"\r\n#define LN_certificate_policies\t\t\"X509v3 Certificate Policies\"\r\n#define NID_certificate_policies\t89\r\n#define OBJ_certificate_policies\tOBJ_id_ce,32L\r\n\r\n#define SN_authority_key_identifier\t\"authorityKeyIdentifier\"\r\n#define LN_authority_key_identifier\t\"X509v3 Authority Key Identifier\"\r\n#define NID_authority_key_identifier\t90\r\n#define OBJ_authority_key_identifier\tOBJ_id_ce,35L\r\n\r\n#define SN_bf_cbc\t\t\t\"BF-CBC\"\r\n#define LN_bf_cbc\t\t\t\"bf-cbc\"\r\n#define NID_bf_cbc\t\t\t91\r\n#define OBJ_bf_cbc\t\t\t1L,3L,6L,1L,4L,1L,3029L,1L,2L\r\n\r\n#define SN_bf_ecb\t\t\t\"BF-ECB\"\r\n#define LN_bf_ecb\t\t\t\"bf-ecb\"\r\n#define NID_bf_ecb\t\t\t92\r\n\r\n#define SN_bf_cfb64\t\t\t\"BF-CFB\"\r\n#define LN_bf_cfb64\t\t\t\"bf-cfb\"\r\n#define NID_bf_cfb64\t\t\t93\r\n\r\n#define SN_bf_ofb64\t\t\t\"BF-OFB\"\r\n#define LN_bf_ofb64\t\t\t\"bf-ofb\"\r\n#define NID_bf_ofb64\t\t\t94\r\n\r\n#define SN_mdc2\t\t\t\t\"MDC2\"\r\n#define LN_mdc2\t\t\t\t\"mdc2\"\r\n#define NID_mdc2\t\t\t95\r\n#define OBJ_mdc2\t\t\t2L,5L,8L,3L,101L\r\n/* An alternative?\t\t\t1L,3L,14L,3L,2L,19L */\r\n\r\n#define SN_mdc2WithRSA\t\t\t\"RSA-MDC2\"\r\n#define LN_mdc2WithRSA\t\t\t\"mdc2withRSA\"\r\n#define NID_mdc2WithRSA\t\t\t96\r\n#define OBJ_mdc2WithRSA\t\t\t2L,5L,8L,3L,100L\r\n\r\n#define SN_rc4_40\t\t\t\"RC4-40\"\r\n#define LN_rc4_40\t\t\t\"rc4-40\"\r\n#define NID_rc4_40\t\t\t97\r\n\r\n#define SN_rc2_40_cbc\t\t\t\"RC2-40-CBC\"\r\n#define LN_rc2_40_cbc\t\t\t\"rc2-40-cbc\"\r\n#define NID_rc2_40_cbc\t\t\t98\r\n\r\n#define SN_givenName\t\t\t\"G\"\r\n#define LN_givenName\t\t\t\"givenName\"\r\n#define NID_givenName\t\t\t99\r\n#define OBJ_givenName\t\t\tOBJ_X509,42L\r\n\r\n#define SN_surname\t\t\t\"S\"\r\n#define LN_surname\t\t\t\"surname\"\r\n#define NID_surname\t\t\t100\r\n#define OBJ_surname\t\t\tOBJ_X509,4L\r\n\r\n#define SN_initials\t\t\t\"I\"\r\n#define LN_initials\t\t\t\"initials\"\r\n#define NID_initials\t\t\t101\r\n#define OBJ_initials\t\t\tOBJ_X509,43L\r\n\r\n#define SN_uniqueIdentifier\t\t\"UID\"\r\n#define LN_uniqueIdentifier\t\t\"uniqueIdentifier\"\r\n#define NID_uniqueIdentifier\t\t102\r\n#define OBJ_uniqueIdentifier\t\tOBJ_X509,45L\r\n\r\n#define SN_crl_distribution_points\t\"crlDistributionPoints\"\r\n#define LN_crl_distribution_points\t\"X509v3 CRL Distribution Points\"\r\n#define NID_crl_distribution_points\t103\r\n#define OBJ_crl_distribution_points\tOBJ_id_ce,31L\r\n\r\n#define SN_md5WithRSA\t\t\t\"RSA-NP-MD5\"\r\n#define LN_md5WithRSA\t\t\t\"md5WithRSA\"\r\n#define NID_md5WithRSA\t\t\t104\r\n#define OBJ_md5WithRSA\t\t\tOBJ_algorithm,3L\r\n\r\n#define SN_serialNumber\t\t\t\"SN\"\r\n#define LN_serialNumber\t\t\t\"serialNumber\"\r\n#define NID_serialNumber\t\t105\r\n#define OBJ_serialNumber\t\tOBJ_X509,5L\r\n\r\n#define SN_title\t\t\t\"T\"\r\n#define LN_title\t\t\t\"title\"\r\n#define NID_title\t\t\t106\r\n#define OBJ_title\t\t\tOBJ_X509,12L\r\n\r\n#define SN_description\t\t\t\"D\"\r\n#define LN_description\t\t\t\"description\"\r\n#define NID_description\t\t\t107\r\n#define OBJ_description\t\t\tOBJ_X509,13L\r\n\r\n/* CAST5 is CAST-128, I'm just sticking with the documentation */\r\n#define SN_cast5_cbc\t\t\t\"CAST5-CBC\"\r\n#define LN_cast5_cbc\t\t\t\"cast5-cbc\"\r\n#define NID_cast5_cbc\t\t\t108\r\n#define OBJ_cast5_cbc\t\t\t1L,2L,840L,113533L,7L,66L,10L\r\n\r\n#define SN_cast5_ecb\t\t\t\"CAST5-ECB\"\r\n#define LN_cast5_ecb\t\t\t\"cast5-ecb\"\r\n#define NID_cast5_ecb\t\t\t109\r\n\r\n#define SN_cast5_cfb64\t\t\t\"CAST5-CFB\"\r\n#define LN_cast5_cfb64\t\t\t\"cast5-cfb\"\r\n#define NID_cast5_cfb64\t\t\t110\r\n\r\n#define SN_cast5_ofb64\t\t\t\"CAST5-OFB\"\r\n#define LN_cast5_ofb64\t\t\t\"cast5-ofb\"\r\n#define NID_cast5_ofb64\t\t\t111\r\n\r\n#define LN_pbeWithMD5AndCast5_CBC\t\"pbeWithMD5AndCast5CBC\"\r\n#define NID_pbeWithMD5AndCast5_CBC\t112\r\n#define OBJ_pbeWithMD5AndCast5_CBC\t1L,2L,840L,113533L,7L,66L,12L\r\n\r\n/* This is one sun will soon be using :-(\r\n * id-dsa-with-sha1 ID  ::= {\r\n *   iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }\r\n */\r\n#define SN_dsaWithSHA1\t\t\t\"DSA-SHA1\"\r\n#define LN_dsaWithSHA1\t\t\t\"dsaWithSHA1\"\r\n#define NID_dsaWithSHA1\t\t\t113\r\n#define OBJ_dsaWithSHA1\t\t\t1L,2L,840L,10040L,4L,3L\r\n\r\n#define NID_md5_sha1\t\t\t114\r\n#define SN_md5_sha1\t\t\t\"MD5-SHA1\"\r\n#define LN_md5_sha1\t\t\t\"md5-sha1\"\r\n\r\n#define SN_sha1WithRSA\t\t\t\"RSA-SHA1-2\"\r\n#define LN_sha1WithRSA\t\t\t\"sha1WithRSA\"\r\n#define NID_sha1WithRSA\t\t\t115\r\n#define OBJ_sha1WithRSA\t\t\tOBJ_algorithm,29L\r\n\r\n#define SN_dsa\t\t\t\t\"DSA\"\r\n#define LN_dsa\t\t\t\t\"dsaEncryption\"\r\n#define NID_dsa\t\t\t\t116\r\n#define OBJ_dsa\t\t\t\t1L,2L,840L,10040L,4L,1L\r\n\r\n#define SN_ripemd160\t\t\t\"RIPEMD160\"\r\n#define LN_ripemd160\t\t\t\"ripemd160\"\r\n#define NID_ripemd160\t\t\t117\r\n#define OBJ_ripemd160\t\t\t1L,3L,36L,3L,2L,1L\r\n\r\n/* The name should actually be rsaSignatureWithripemd160, but I'm going\r\n * to continue using the convention I'm using with the other ciphers */\r\n#define SN_ripemd160WithRSA\t\t\"RSA-RIPEMD160\"\r\n#define LN_ripemd160WithRSA\t\t\"ripemd160WithRSA\"\r\n#define NID_ripemd160WithRSA\t\t119\r\n#define OBJ_ripemd160WithRSA\t\t1L,3L,36L,3L,3L,1L,2L\r\n\r\n/* Taken from rfc2040\r\n *  RC5_CBC_Parameters ::= SEQUENCE {\r\n *\tversion           INTEGER (v1_0(16)),\r\n *\trounds            INTEGER (8..127),\r\n *\tblockSizeInBits   INTEGER (64, 128),\r\n *\tiv                OCTET STRING OPTIONAL\r\n *\t}\r\n */\r\n#define SN_rc5_cbc\t\t\t\"RC5-CBC\"\r\n#define LN_rc5_cbc\t\t\t\"rc5-cbc\"\r\n#define NID_rc5_cbc\t\t\t120\r\n#define OBJ_rc5_cbc\t\t\tOBJ_rsadsi,3L,8L\r\n\r\n#define SN_rc5_ecb\t\t\t\"RC5-ECB\"\r\n#define LN_rc5_ecb\t\t\t\"rc5-ecb\"\r\n#define NID_rc5_ecb\t\t\t121\r\n\r\n#define SN_rc5_cfb64\t\t\t\"RC5-CFB\"\r\n#define LN_rc5_cfb64\t\t\t\"rc5-cfb\"\r\n#define NID_rc5_cfb64\t\t\t122\r\n\r\n#define SN_rc5_ofb64\t\t\t\"RC5-OFB\"\r\n#define LN_rc5_ofb64\t\t\t\"rc5-ofb\"\r\n#define NID_rc5_ofb64\t\t\t123\r\n\r\n#define SN_rle_compression\t\t\"RLE\"\r\n#define LN_rle_compression\t\t\"run length compression\"\r\n#define NID_rle_compression\t\t124\r\n#define OBJ_rle_compression\t\t1L,1L,1L,1L,666L,1L\r\n\r\n#define SN_zlib_compression\t\t\"ZLIB\"\r\n#define LN_zlib_compression\t\t\"zlib compression\"\r\n#define NID_zlib_compression\t\t125\r\n#define OBJ_zlib_compression\t\t1L,1L,1L,1L,666L,2L\r\n\r\n#define SN_ext_key_usage\t\t\"extendedKeyUsage\"\r\n#define LN_ext_key_usage\t\t\"X509v3 Extended Key Usage\"\r\n#define NID_ext_key_usage\t\t126\r\n#define OBJ_ext_key_usage\t\tOBJ_id_ce,37\r\n\r\n#define SN_id_pkix\t\t\t\"PKIX\"\r\n#define NID_id_pkix\t\t\t127\r\n#define OBJ_id_pkix\t\t\t1L,3L,6L,1L,5L,5L,7L\r\n\r\n#define SN_id_kp\t\t\t\"id-kp\"\r\n#define NID_id_kp\t\t\t128\r\n#define OBJ_id_kp\t\t\tOBJ_id_pkix,3L\r\n\r\n/* PKIX extended key usage OIDs */\r\n\r\n#define SN_server_auth\t\t\t\"serverAuth\"\r\n#define LN_server_auth\t\t\t\"TLS Web Server Authentication\"\r\n#define NID_server_auth\t\t\t129\r\n#define OBJ_server_auth\t\t\tOBJ_id_kp,1L\r\n\r\n#define SN_client_auth\t\t\t\"clientAuth\"\r\n#define LN_client_auth\t\t\t\"TLS Web Client Authentication\"\r\n#define NID_client_auth\t\t\t130\r\n#define OBJ_client_auth\t\t\tOBJ_id_kp,2L\r\n\r\n#define SN_code_sign\t\t\t\"codeSigning\"\r\n#define LN_code_sign\t\t\t\"Code Signing\"\r\n#define NID_code_sign\t\t\t131\r\n#define OBJ_code_sign\t\t\tOBJ_id_kp,3L\r\n\r\n#define SN_email_protect\t\t\"emailProtection\"\r\n#define LN_email_protect\t\t\"E-mail Protection\"\r\n#define NID_email_protect\t\t132\r\n#define OBJ_email_protect\t\tOBJ_id_kp,4L\r\n\r\n#define SN_time_stamp\t\t\t\"timeStamping\"\r\n#define LN_time_stamp\t\t\t\"Time Stamping\"\r\n#define NID_time_stamp\t\t\t133\r\n#define OBJ_time_stamp\t\t\tOBJ_id_kp,8L\r\n\r\n/* Additional extended key usage OIDs: Microsoft */\r\n\r\n#define SN_ms_code_ind\t\t\t\"msCodeInd\"\r\n#define LN_ms_code_ind\t\t\t\"Microsoft Individual Code Signing\"\r\n#define NID_ms_code_ind\t\t\t134\r\n#define OBJ_ms_code_ind\t\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,21L\r\n\r\n#define SN_ms_code_com\t\t\t\"msCodeCom\"\r\n#define LN_ms_code_com\t\t\t\"Microsoft Commercial Code Signing\"\r\n#define NID_ms_code_com\t\t\t135\r\n#define OBJ_ms_code_com\t\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,22L\r\n\r\n#define SN_ms_ctl_sign\t\t\t\"msCTLSign\"\r\n#define LN_ms_ctl_sign\t\t\t\"Microsoft Trust List Signing\"\r\n#define NID_ms_ctl_sign\t\t\t136\r\n#define OBJ_ms_ctl_sign\t\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,1L\r\n\r\n#define SN_ms_sgc\t\t\t\"msSGC\"\r\n#define LN_ms_sgc\t\t\t\"Microsoft Server Gated Crypto\"\r\n#define NID_ms_sgc\t\t\t137\r\n#define OBJ_ms_sgc\t\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,3L\r\n\r\n#define SN_ms_efs\t\t\t\"msEFS\"\r\n#define LN_ms_efs\t\t\t\"Microsoft Encrypted File System\"\r\n#define NID_ms_efs\t\t\t138\r\n#define OBJ_ms_efs\t\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,4L\r\n\r\n/* Additional usage: Netscape */\r\n\r\n#define SN_ns_sgc\t\t\t\"nsSGC\"\r\n#define LN_ns_sgc\t\t\t\"Netscape Server Gated Crypto\"\r\n#define NID_ns_sgc\t\t\t139\r\n#define OBJ_ns_sgc\t\t\tOBJ_netscape,4L,1L\r\n\r\n#define SN_delta_crl\t\t\t\"deltaCRL\"\r\n#define LN_delta_crl\t\t\t\"X509v3 Delta CRL Indicator\"\r\n#define NID_delta_crl\t\t\t140\r\n#define OBJ_delta_crl\t\t\tOBJ_id_ce,27L\r\n\r\n#define SN_crl_reason\t\t\t\"CRLReason\"\r\n#define LN_crl_reason\t\t\t\"CRL Reason Code\"\r\n#define NID_crl_reason\t\t\t141\r\n#define OBJ_crl_reason\t\t\tOBJ_id_ce,21L\r\n\r\n#define SN_invalidity_date\t\t\"invalidityDate\"\r\n#define LN_invalidity_date\t\t\"Invalidity Date\"\r\n#define NID_invalidity_date\t\t142\r\n#define OBJ_invalidity_date\t\tOBJ_id_ce,24L\r\n\r\n#define SN_sxnet\t\t\t\"SXNetID\"\r\n#define LN_sxnet\t\t\t\"Strong Extranet ID\"\r\n#define NID_sxnet\t\t\t143\r\n#define OBJ_sxnet\t\t\t1L,3L,101L,1L,4L,1L\r\n\r\n/* PKCS12 and related OBJECT IDENTIFIERS */\r\n\r\n#define OBJ_pkcs12\t\t\tOBJ_pkcs,12L\r\n#define OBJ_pkcs12_pbeids\t\tOBJ_pkcs12, 1\r\n\r\n#define SN_pbe_WithSHA1And128BitRC4\t\"PBE-SHA1-RC4-128\"\r\n#define LN_pbe_WithSHA1And128BitRC4\t\"pbeWithSHA1And128BitRC4\"\r\n#define NID_pbe_WithSHA1And128BitRC4\t144\r\n#define OBJ_pbe_WithSHA1And128BitRC4\tOBJ_pkcs12_pbeids, 1L\r\n\r\n#define SN_pbe_WithSHA1And40BitRC4\t\"PBE-SHA1-RC4-40\"\r\n#define LN_pbe_WithSHA1And40BitRC4\t\"pbeWithSHA1And40BitRC4\"\r\n#define NID_pbe_WithSHA1And40BitRC4\t145\r\n#define OBJ_pbe_WithSHA1And40BitRC4\tOBJ_pkcs12_pbeids, 2L\r\n\r\n#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\"PBE-SHA1-3DES\"\r\n#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\"pbeWithSHA1And3-KeyTripleDES-CBC\"\r\n#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC\t146\r\n#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC\tOBJ_pkcs12_pbeids, 3L\r\n\r\n#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\"PBE-SHA1-2DES\"\r\n#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\"pbeWithSHA1And2-KeyTripleDES-CBC\"\r\n#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC\t147\r\n#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC\tOBJ_pkcs12_pbeids, 4L\r\n\r\n#define SN_pbe_WithSHA1And128BitRC2_CBC\t\t\"PBE-SHA1-RC2-128\"\r\n#define LN_pbe_WithSHA1And128BitRC2_CBC\t\t\"pbeWithSHA1And128BitRC2-CBC\"\r\n#define NID_pbe_WithSHA1And128BitRC2_CBC\t148\r\n#define OBJ_pbe_WithSHA1And128BitRC2_CBC\tOBJ_pkcs12_pbeids, 5L\r\n\r\n#define SN_pbe_WithSHA1And40BitRC2_CBC\t\"PBE-SHA1-RC2-40\"\r\n#define LN_pbe_WithSHA1And40BitRC2_CBC\t\"pbeWithSHA1And40BitRC2-CBC\"\r\n#define NID_pbe_WithSHA1And40BitRC2_CBC\t149\r\n#define OBJ_pbe_WithSHA1And40BitRC2_CBC\tOBJ_pkcs12_pbeids, 6L\r\n\r\n#define OBJ_pkcs12_Version1\tOBJ_pkcs12, 10L\r\n\r\n#define OBJ_pkcs12_BagIds\tOBJ_pkcs12_Version1, 1L\r\n\r\n#define LN_keyBag\t\t\"keyBag\"\r\n#define NID_keyBag\t\t150\r\n#define OBJ_keyBag\t\tOBJ_pkcs12_BagIds, 1L\r\n\r\n#define LN_pkcs8ShroudedKeyBag\t\"pkcs8ShroudedKeyBag\"\r\n#define NID_pkcs8ShroudedKeyBag\t151\r\n#define OBJ_pkcs8ShroudedKeyBag\tOBJ_pkcs12_BagIds, 2L\r\n\r\n#define LN_certBag\t\t\"certBag\"\r\n#define NID_certBag\t\t152\r\n#define OBJ_certBag\t\tOBJ_pkcs12_BagIds, 3L\r\n\r\n#define LN_crlBag\t\t\"crlBag\"\r\n#define NID_crlBag\t\t153\r\n#define OBJ_crlBag\t\tOBJ_pkcs12_BagIds, 4L\r\n\r\n#define LN_secretBag\t\t\"secretBag\"\r\n#define NID_secretBag\t\t154\r\n#define OBJ_secretBag\t\tOBJ_pkcs12_BagIds, 5L\r\n\r\n#define LN_safeContentsBag\t\"safeContentsBag\"\r\n#define NID_safeContentsBag\t155\r\n#define OBJ_safeContentsBag\tOBJ_pkcs12_BagIds, 6L\r\n\r\n#define LN_friendlyName\t\t\"friendlyName\"\r\n#define\tNID_friendlyName\t156\r\n#define OBJ_friendlyName\tOBJ_pkcs9, 20L\r\n\r\n#define LN_localKeyID\t\t\"localKeyID\"\r\n#define\tNID_localKeyID\t\t157\r\n#define OBJ_localKeyID\t\tOBJ_pkcs9, 21L\r\n\r\n#define OBJ_certTypes\t\tOBJ_pkcs9, 22L\r\n\r\n#define LN_x509Certificate\t\"x509Certificate\"\r\n#define\tNID_x509Certificate\t158\r\n#define OBJ_x509Certificate\tOBJ_certTypes, 1L\r\n\r\n#define LN_sdsiCertificate\t\"sdsiCertificate\"\r\n#define\tNID_sdsiCertificate\t159\r\n#define OBJ_sdsiCertificate\tOBJ_certTypes, 2L\r\n\r\n#define OBJ_crlTypes\t\tOBJ_pkcs9, 23L\r\n\r\n#define LN_x509Crl\t\t\"x509Crl\"\r\n#define\tNID_x509Crl\t\t160\r\n#define OBJ_x509Crl\t\tOBJ_crlTypes, 1L\r\n\r\n/* PKCS#5 v2 OIDs */\r\n\r\n#define LN_pbes2\t\t\"PBES2\"\r\n#define NID_pbes2\t\t161\r\n#define OBJ_pbes2\t\tOBJ_pkcs,5L,13L\r\n\r\n#define LN_pbmac1\t\t\"PBMAC1\"\r\n#define NID_pbmac1\t\t162\r\n#define OBJ_pbmac1\t\tOBJ_pkcs,5L,14L\r\n\r\n#define LN_hmacWithSHA1\t\t\"hmacWithSHA1\"\r\n#define NID_hmacWithSHA1\t163\r\n#define OBJ_hmacWithSHA1\tOBJ_rsadsi,2L,7L\r\n\r\n/* Policy Qualifier Ids */\r\n\r\n#define LN_id_qt_cps\t\t\"Policy Qualifier CPS\"\r\n#define SN_id_qt_cps\t\t\"id-qt-cps\"\r\n#define NID_id_qt_cps\t\t164\r\n#define OBJ_id_qt_cps\t\tOBJ_id_pkix,2L,1L\r\n\r\n#define LN_id_qt_unotice\t\"Policy Qualifier User Notice\"\r\n#define SN_id_qt_unotice\t\"id-qt-unotice\"\r\n#define NID_id_qt_unotice\t165\r\n#define OBJ_id_qt_unotice\tOBJ_id_pkix,2L,2L\r\n\r\n#define SN_rc2_64_cbc\t\t\t\"RC2-64-CBC\"\r\n#define LN_rc2_64_cbc\t\t\t\"rc2-64-cbc\"\r\n#define NID_rc2_64_cbc\t\t\t166\r\n\r\n#define SN_SMIMECapabilities\t\t\"SMIME-CAPS\"\r\n#define LN_SMIMECapabilities\t\t\"S/MIME Capabilities\"\r\n#define NID_SMIMECapabilities\t\t167\r\n#define OBJ_SMIMECapabilities\t\tOBJ_pkcs9,15L\r\n\r\n#define SN_pbeWithMD2AndRC2_CBC\t\t\"PBE-MD2-RC2-64\"\r\n#define LN_pbeWithMD2AndRC2_CBC\t\t\"pbeWithMD2AndRC2-CBC\"\r\n#define NID_pbeWithMD2AndRC2_CBC\t168\r\n#define OBJ_pbeWithMD2AndRC2_CBC\tOBJ_pkcs,5L,4L\r\n\r\n#define SN_pbeWithMD5AndRC2_CBC\t\t\"PBE-MD5-RC2-64\"\r\n#define LN_pbeWithMD5AndRC2_CBC\t\t\"pbeWithMD5AndRC2-CBC\"\r\n#define NID_pbeWithMD5AndRC2_CBC\t169\r\n#define OBJ_pbeWithMD5AndRC2_CBC\tOBJ_pkcs,5L,6L\r\n\r\n#define SN_pbeWithSHA1AndDES_CBC\t\"PBE-SHA1-DES\"\r\n#define LN_pbeWithSHA1AndDES_CBC\t\"pbeWithSHA1AndDES-CBC\"\r\n#define NID_pbeWithSHA1AndDES_CBC\t170\r\n#define OBJ_pbeWithSHA1AndDES_CBC\tOBJ_pkcs,5L,10L\r\n\r\n/* Extension request OIDs */\r\n\r\n#define LN_ms_ext_req\t\t\t\"Microsoft Extension Request\"\r\n#define SN_ms_ext_req\t\t\t\"msExtReq\"\r\n#define NID_ms_ext_req\t\t\t171\r\n#define OBJ_ms_ext_req\t\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,14L\r\n\r\n#define LN_ext_req\t\t\t\"Extension Request\"\r\n#define SN_ext_req\t\t\t\"extReq\"\r\n#define NID_ext_req\t\t\t172\r\n#define OBJ_ext_req\t\t\tOBJ_pkcs9,14L\r\n\r\n#define SN_name\t\t\t\t\"name\"\r\n#define LN_name\t\t\t\t\"name\"\r\n#define NID_name\t\t\t173\r\n#define OBJ_name\t\t\tOBJ_X509,41L\r\n\r\n#define SN_dnQualifier\t\t\t\"dnQualifier\"\r\n#define LN_dnQualifier\t\t\t\"dnQualifier\"\r\n#define NID_dnQualifier\t\t\t174\r\n#define OBJ_dnQualifier\t\t\tOBJ_X509,46L\r\n\r\n#define SN_id_pe\t\t\t\"id-pe\"\r\n#define NID_id_pe\t\t\t175\r\n#define OBJ_id_pe\t\t\tOBJ_id_pkix,1L\r\n\r\n#define SN_id_ad\t\t\t\"id-ad\"\r\n#define NID_id_ad\t\t\t176\r\n#define OBJ_id_ad\t\t\tOBJ_id_pkix,48L\r\n\r\n#define SN_info_access\t\t\t\"authorityInfoAccess\"\r\n#define LN_info_access\t\t\t\"Authority Information Access\"\r\n#define NID_info_access\t\t\t177\r\n#define OBJ_info_access\t\t\tOBJ_id_pe,1L\r\n\r\n#define SN_ad_OCSP\t\t\t\"OCSP\"\r\n#define LN_ad_OCSP\t\t\t\"OCSP\"\r\n#define NID_ad_OCSP\t\t\t178\r\n#define OBJ_ad_OCSP\t\t\tOBJ_id_ad,1L\r\n\r\n#define SN_ad_ca_issuers\t\t\"caIssuers\"\r\n#define LN_ad_ca_issuers\t\t\"CA Issuers\"\r\n#define NID_ad_ca_issuers\t\t179\r\n#define OBJ_ad_ca_issuers\t\tOBJ_id_ad,2L\r\n\r\n#define SN_OCSP_sign\t\t\t\"OCSPSigning\"\r\n#define LN_OCSP_sign\t\t\t\"OCSP Signing\"\r\n#define NID_OCSP_sign\t\t\t180\r\n#define OBJ_OCSP_sign\t\t\tOBJ_id_kp,9L\r\n#endif /* USE_OBJ_MAC */\r\n\r\n#include <openssl/bio.h>\r\n#include <openssl/asn1.h>\r\n\r\n#define\tOBJ_NAME_TYPE_UNDEF\t\t0x00\r\n#define\tOBJ_NAME_TYPE_MD_METH\t\t0x01\r\n#define\tOBJ_NAME_TYPE_CIPHER_METH\t0x02\r\n#define\tOBJ_NAME_TYPE_PKEY_METH\t\t0x03\r\n#define\tOBJ_NAME_TYPE_COMP_METH\t\t0x04\r\n#define\tOBJ_NAME_TYPE_NUM\t\t0x05\r\n\r\n#define\tOBJ_NAME_ALIAS\t\t\t0x8000\r\n\r\n#define OBJ_BSEARCH_VALUE_ON_NOMATCH\t\t0x01\r\n#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH\t0x02\r\n\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct obj_name_st\r\n\t{\r\n\tint type;\r\n\tint alias;\r\n\tconst char *name;\r\n\tconst char *data;\r\n\t} OBJ_NAME;\r\n\r\n#define\t\tOBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)\r\n\r\n\r\nint OBJ_NAME_init(void);\r\nint OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),\r\n\t\t       int (*cmp_func)(const char *, const char *),\r\n\t\t       void (*free_func)(const char *, int, const char *));\r\nconst char *OBJ_NAME_get(const char *name,int type);\r\nint OBJ_NAME_add(const char *name,int type,const char *data);\r\nint OBJ_NAME_remove(const char *name,int type);\r\nvoid OBJ_NAME_cleanup(int type); /* -1 for everything */\r\nvoid OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),\r\n\t\t     void *arg);\r\nvoid OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg),\r\n\t\t\t    void *arg);\r\n\r\nASN1_OBJECT *\tOBJ_dup(const ASN1_OBJECT *o);\r\nASN1_OBJECT *\tOBJ_nid2obj(int n);\r\nconst char *\tOBJ_nid2ln(int n);\r\nconst char *\tOBJ_nid2sn(int n);\r\nint\t\tOBJ_obj2nid(const ASN1_OBJECT *o);\r\nASN1_OBJECT *\tOBJ_txt2obj(const char *s, int no_name);\r\nint\tOBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);\r\nint\t\tOBJ_txt2nid(const char *s);\r\nint\t\tOBJ_ln2nid(const char *s);\r\nint\t\tOBJ_sn2nid(const char *s);\r\nint\t\tOBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);\r\nconst void *\tOBJ_bsearch_(const void *key,const void *base,int num,int size,\r\n\t\t\t     int (*cmp)(const void *, const void *));\r\nconst void *\tOBJ_bsearch_ex_(const void *key,const void *base,int num,\r\n\t\t\t\tint size,\r\n\t\t\t\tint (*cmp)(const void *, const void *),\r\n\t\t\t\tint flags);\r\n\r\n#define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm)\t\\\r\n  static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \\\r\n  static int nm##_cmp(type1 const *, type2 const *); \\\r\n  scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)\r\n\r\n#define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp)\t\\\r\n  _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp)\r\n#define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm)\t\\\r\n  type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)\r\n\r\n/*\r\n * Unsolved problem: if a type is actually a pointer type, like\r\n * nid_triple is, then its impossible to get a const where you need\r\n * it. Consider:\r\n *\r\n * typedef int nid_triple[3];\r\n * const void *a_;\r\n * const nid_triple const *a = a_;\r\n *\r\n * The assignement discards a const because what you really want is:\r\n *\r\n * const int const * const *a = a_;\r\n *\r\n * But if you do that, you lose the fact that a is an array of 3 ints,\r\n * which breaks comparison functions.\r\n *\r\n * Thus we end up having to cast, sadly, or unpack the\r\n * declarations. Or, as I finally did in this case, delcare nid_triple\r\n * to be a struct, which it should have been in the first place.\r\n *\r\n * Ben, August 2008.\r\n *\r\n * Also, strictly speaking not all types need be const, but handling\r\n * the non-constness means a lot of complication, and in practice\r\n * comparison routines do always not touch their arguments.\r\n */\r\n\r\n#define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm)\t\\\r\n  static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)\t\\\r\n      { \\\r\n      type1 const *a = a_; \\\r\n      type2 const *b = b_; \\\r\n      return nm##_cmp(a,b); \\\r\n      } \\\r\n  static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \\\r\n      { \\\r\n      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \\\r\n\t\t\t\t\tnm##_cmp_BSEARCH_CMP_FN); \\\r\n      } \\\r\n      extern void dummy_prototype(void)\r\n\r\n#define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm)\t\\\r\n  static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)\t\\\r\n      { \\\r\n      type1 const *a = a_; \\\r\n      type2 const *b = b_; \\\r\n      return nm##_cmp(a,b); \\\r\n      } \\\r\n  type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \\\r\n      { \\\r\n      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \\\r\n\t\t\t\t\tnm##_cmp_BSEARCH_CMP_FN); \\\r\n      } \\\r\n      extern void dummy_prototype(void)\r\n\r\n#define OBJ_bsearch(type1,key,type2,base,num,cmp)\t\t\t       \\\r\n  ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \\\r\n\t\t\t num,sizeof(type2),\t\t\t\t\\\r\n\t\t\t ((void)CHECKED_PTR_OF(type1,cmp##_type_1),\t\\\r\n\t\t\t  (void)CHECKED_PTR_OF(type2,cmp##_type_2),\t\\\r\n\t\t\t  cmp##_BSEARCH_CMP_FN)))\r\n\r\n#define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags)\t\t\t\\\r\n  ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \\\r\n\t\t\t num,sizeof(type2),\t\t\t\t\\\r\n\t\t\t ((void)CHECKED_PTR_OF(type1,cmp##_type_1),\t\\\r\n\t\t\t  (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \\\r\n\t\t\t  cmp##_BSEARCH_CMP_FN)),flags)\r\n\r\nint\t\tOBJ_new_nid(int num);\r\nint\t\tOBJ_add_object(const ASN1_OBJECT *obj);\r\nint\t\tOBJ_create(const char *oid,const char *sn,const char *ln);\r\nvoid\t\tOBJ_cleanup(void );\r\nint\t\tOBJ_create_objects(BIO *in);\r\n\r\nint OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);\r\nint OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);\r\nint OBJ_add_sigid(int signid, int dig_id, int pkey_id);\r\nvoid OBJ_sigid_free(void);\r\n\r\nextern int obj_cleanup_defer;\r\nvoid check_defer(int nid);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_OBJ_strings(void);\r\n\r\n/* Error codes for the OBJ functions. */\r\n\r\n/* Function codes. */\r\n#define OBJ_F_OBJ_ADD_OBJECT\t\t\t\t 105\r\n#define OBJ_F_OBJ_CREATE\t\t\t\t 100\r\n#define OBJ_F_OBJ_DUP\t\t\t\t\t 101\r\n#define OBJ_F_OBJ_NAME_NEW_INDEX\t\t\t 106\r\n#define OBJ_F_OBJ_NID2LN\t\t\t\t 102\r\n#define OBJ_F_OBJ_NID2OBJ\t\t\t\t 103\r\n#define OBJ_F_OBJ_NID2SN\t\t\t\t 104\r\n\r\n/* Reason codes. */\r\n#define OBJ_R_MALLOC_FAILURE\t\t\t\t 100\r\n#define OBJ_R_UNKNOWN_NID\t\t\t\t 101\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ocsp.h",
    "content": "/* ocsp.h */\r\n/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL\r\n * project. */\r\n\r\n/* History:\r\n   This file was transfered to Richard Levitte from CertCo by Kathy\r\n   Weinhold in mid-spring 2000 to be included in OpenSSL or released\r\n   as a patch kit. */\r\n\r\n/* ====================================================================\r\n * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_OCSP_H\r\n#define HEADER_OCSP_H\r\n\r\n#include <openssl/ossl_typ.h>\r\n#include <openssl/x509.h>\r\n#include <openssl/x509v3.h>\r\n#include <openssl/safestack.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Various flags and values */\r\n\r\n#define OCSP_DEFAULT_NONCE_LENGTH\t16\r\n\r\n#define OCSP_NOCERTS\t\t\t0x1\r\n#define OCSP_NOINTERN\t\t\t0x2\r\n#define OCSP_NOSIGS\t\t\t0x4\r\n#define OCSP_NOCHAIN\t\t\t0x8\r\n#define OCSP_NOVERIFY\t\t\t0x10\r\n#define OCSP_NOEXPLICIT\t\t\t0x20\r\n#define OCSP_NOCASIGN\t\t\t0x40\r\n#define OCSP_NODELEGATED\t\t0x80\r\n#define OCSP_NOCHECKS\t\t\t0x100\r\n#define OCSP_TRUSTOTHER\t\t\t0x200\r\n#define OCSP_RESPID_KEY\t\t\t0x400\r\n#define OCSP_NOTIME\t\t\t0x800\r\n\r\n/*   CertID ::= SEQUENCE {\r\n *       hashAlgorithm            AlgorithmIdentifier,\r\n *       issuerNameHash     OCTET STRING, -- Hash of Issuer's DN\r\n *       issuerKeyHash      OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)\r\n *       serialNumber       CertificateSerialNumber }\r\n */\r\ntypedef struct ocsp_cert_id_st\r\n\t{\r\n\tX509_ALGOR *hashAlgorithm;\r\n\tASN1_OCTET_STRING *issuerNameHash;\r\n\tASN1_OCTET_STRING *issuerKeyHash;\r\n\tASN1_INTEGER *serialNumber;\r\n\t} OCSP_CERTID;\r\n\r\nDECLARE_STACK_OF(OCSP_CERTID)\r\n\r\n/*   Request ::=     SEQUENCE {\r\n *       reqCert                    CertID,\r\n *       singleRequestExtensions    [0] EXPLICIT Extensions OPTIONAL }\r\n */\r\ntypedef struct ocsp_one_request_st\r\n\t{\r\n\tOCSP_CERTID *reqCert;\r\n\tSTACK_OF(X509_EXTENSION) *singleRequestExtensions;\r\n\t} OCSP_ONEREQ;\r\n\r\nDECLARE_STACK_OF(OCSP_ONEREQ)\r\nDECLARE_ASN1_SET_OF(OCSP_ONEREQ)\r\n\r\n\r\n/*   TBSRequest      ::=     SEQUENCE {\r\n *       version             [0] EXPLICIT Version DEFAULT v1,\r\n *       requestorName       [1] EXPLICIT GeneralName OPTIONAL,\r\n *       requestList             SEQUENCE OF Request,\r\n *       requestExtensions   [2] EXPLICIT Extensions OPTIONAL }\r\n */\r\ntypedef struct ocsp_req_info_st\r\n\t{\r\n\tASN1_INTEGER *version;\r\n\tGENERAL_NAME *requestorName;\r\n\tSTACK_OF(OCSP_ONEREQ) *requestList;\r\n\tSTACK_OF(X509_EXTENSION) *requestExtensions;\r\n\t} OCSP_REQINFO;\r\n\r\n/*   Signature       ::=     SEQUENCE {\r\n *       signatureAlgorithm   AlgorithmIdentifier,\r\n *       signature            BIT STRING,\r\n *       certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }\r\n */\r\ntypedef struct ocsp_signature_st\r\n\t{\r\n\tX509_ALGOR *signatureAlgorithm;\r\n\tASN1_BIT_STRING *signature;\r\n\tSTACK_OF(X509) *certs;\r\n\t} OCSP_SIGNATURE;\r\n\r\n/*   OCSPRequest     ::=     SEQUENCE {\r\n *       tbsRequest                  TBSRequest,\r\n *       optionalSignature   [0]     EXPLICIT Signature OPTIONAL }\r\n */\r\ntypedef struct ocsp_request_st\r\n\t{\r\n\tOCSP_REQINFO *tbsRequest;\r\n\tOCSP_SIGNATURE *optionalSignature; /* OPTIONAL */\r\n\t} OCSP_REQUEST;\r\n\r\n/*   OCSPResponseStatus ::= ENUMERATED {\r\n *       successful            (0),      --Response has valid confirmations\r\n *       malformedRequest      (1),      --Illegal confirmation request\r\n *       internalError         (2),      --Internal error in issuer\r\n *       tryLater              (3),      --Try again later\r\n *                                       --(4) is not used\r\n *       sigRequired           (5),      --Must sign the request\r\n *       unauthorized          (6)       --Request unauthorized\r\n *   }\r\n */\r\n#define OCSP_RESPONSE_STATUS_SUCCESSFUL          0\r\n#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST     1\r\n#define OCSP_RESPONSE_STATUS_INTERNALERROR        2\r\n#define OCSP_RESPONSE_STATUS_TRYLATER             3\r\n#define OCSP_RESPONSE_STATUS_SIGREQUIRED          5\r\n#define OCSP_RESPONSE_STATUS_UNAUTHORIZED         6\r\n\r\n/*   ResponseBytes ::=       SEQUENCE {\r\n *       responseType   OBJECT IDENTIFIER,\r\n *       response       OCTET STRING }\r\n */\r\ntypedef struct ocsp_resp_bytes_st\r\n\t{\r\n\tASN1_OBJECT *responseType;\r\n\tASN1_OCTET_STRING *response;\r\n\t} OCSP_RESPBYTES;\r\n\r\n/*   OCSPResponse ::= SEQUENCE {\r\n *      responseStatus         OCSPResponseStatus,\r\n *      responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }\r\n */\r\nstruct ocsp_response_st\r\n\t{\r\n\tASN1_ENUMERATED *responseStatus;\r\n\tOCSP_RESPBYTES  *responseBytes;\r\n\t};\r\n\r\n/*   ResponderID ::= CHOICE {\r\n *      byName   [1] Name,\r\n *      byKey    [2] KeyHash }\r\n */\r\n#define V_OCSP_RESPID_NAME 0\r\n#define V_OCSP_RESPID_KEY  1\r\nstruct ocsp_responder_id_st\r\n\t{\r\n\tint type;\r\n\tunion   {\r\n\t\tX509_NAME* byName;\r\n        \tASN1_OCTET_STRING *byKey;\r\n\t\t} value;\r\n\t};\r\n\r\nDECLARE_STACK_OF(OCSP_RESPID)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPID)\r\n\r\n/*   KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key\r\n *                            --(excluding the tag and length fields)\r\n */\r\n\r\n/*   RevokedInfo ::= SEQUENCE {\r\n *       revocationTime              GeneralizedTime,\r\n *       revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }\r\n */\r\ntypedef struct ocsp_revoked_info_st\r\n\t{\r\n\tASN1_GENERALIZEDTIME *revocationTime;\r\n\tASN1_ENUMERATED *revocationReason;\r\n\t} OCSP_REVOKEDINFO;\r\n\r\n/*   CertStatus ::= CHOICE {\r\n *       good                [0]     IMPLICIT NULL,\r\n *       revoked             [1]     IMPLICIT RevokedInfo,\r\n *       unknown             [2]     IMPLICIT UnknownInfo }\r\n */\r\n#define V_OCSP_CERTSTATUS_GOOD    0\r\n#define V_OCSP_CERTSTATUS_REVOKED 1\r\n#define V_OCSP_CERTSTATUS_UNKNOWN 2\r\ntypedef struct ocsp_cert_status_st\r\n\t{\r\n\tint type;\r\n\tunion\t{\r\n\t\tASN1_NULL *good;\r\n\t\tOCSP_REVOKEDINFO *revoked;\r\n\t\tASN1_NULL *unknown;\r\n\t\t} value;\r\n\t} OCSP_CERTSTATUS;\r\n\r\n/*   SingleResponse ::= SEQUENCE {\r\n *      certID                       CertID,\r\n *      certStatus                   CertStatus,\r\n *      thisUpdate                   GeneralizedTime,\r\n *      nextUpdate           [0]     EXPLICIT GeneralizedTime OPTIONAL,\r\n *      singleExtensions     [1]     EXPLICIT Extensions OPTIONAL }\r\n */\r\ntypedef struct ocsp_single_response_st\r\n\t{\r\n\tOCSP_CERTID *certId;\r\n\tOCSP_CERTSTATUS *certStatus;\r\n\tASN1_GENERALIZEDTIME *thisUpdate;\r\n\tASN1_GENERALIZEDTIME *nextUpdate;\r\n\tSTACK_OF(X509_EXTENSION) *singleExtensions;\r\n\t} OCSP_SINGLERESP;\r\n\r\nDECLARE_STACK_OF(OCSP_SINGLERESP)\r\nDECLARE_ASN1_SET_OF(OCSP_SINGLERESP)\r\n\r\n/*   ResponseData ::= SEQUENCE {\r\n *      version              [0] EXPLICIT Version DEFAULT v1,\r\n *      responderID              ResponderID,\r\n *      producedAt               GeneralizedTime,\r\n *      responses                SEQUENCE OF SingleResponse,\r\n *      responseExtensions   [1] EXPLICIT Extensions OPTIONAL }\r\n */\r\ntypedef struct ocsp_response_data_st\r\n\t{\r\n\tASN1_INTEGER *version;\r\n\tOCSP_RESPID  *responderId;\r\n\tASN1_GENERALIZEDTIME *producedAt;\r\n\tSTACK_OF(OCSP_SINGLERESP) *responses;\r\n\tSTACK_OF(X509_EXTENSION) *responseExtensions;\r\n\t} OCSP_RESPDATA;\r\n\r\n/*   BasicOCSPResponse       ::= SEQUENCE {\r\n *      tbsResponseData      ResponseData,\r\n *      signatureAlgorithm   AlgorithmIdentifier,\r\n *      signature            BIT STRING,\r\n *      certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }\r\n */\r\n  /* Note 1:\r\n     The value for \"signature\" is specified in the OCSP rfc2560 as follows:\r\n     \"The value for the signature SHALL be computed on the hash of the DER\r\n     encoding ResponseData.\"  This means that you must hash the DER-encoded\r\n     tbsResponseData, and then run it through a crypto-signing function, which\r\n     will (at least w/RSA) do a hash-'n'-private-encrypt operation.  This seems\r\n     a bit odd, but that's the spec.  Also note that the data structures do not\r\n     leave anywhere to independently specify the algorithm used for the initial\r\n     hash. So, we look at the signature-specification algorithm, and try to do\r\n     something intelligent.\t-- Kathy Weinhold, CertCo */\r\n  /* Note 2:\r\n     It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open\r\n     for interpretation.  I've done tests against another responder, and found\r\n     that it doesn't do the double hashing that the RFC seems to say one\r\n     should.  Therefore, all relevant functions take a flag saying which\r\n     variant should be used.\t-- Richard Levitte, OpenSSL team and CeloCom */\r\ntypedef struct ocsp_basic_response_st\r\n\t{\r\n\tOCSP_RESPDATA *tbsResponseData;\r\n\tX509_ALGOR *signatureAlgorithm;\r\n\tASN1_BIT_STRING *signature;\r\n\tSTACK_OF(X509) *certs;\r\n\t} OCSP_BASICRESP;\r\n\r\n/*\r\n *   CRLReason ::= ENUMERATED {\r\n *        unspecified             (0),\r\n *        keyCompromise           (1),\r\n *        cACompromise            (2),\r\n *        affiliationChanged      (3),\r\n *        superseded              (4),\r\n *        cessationOfOperation    (5),\r\n *        certificateHold         (6),\r\n *        removeFromCRL           (8) }\r\n */\r\n#define OCSP_REVOKED_STATUS_NOSTATUS               -1\r\n#define OCSP_REVOKED_STATUS_UNSPECIFIED             0\r\n#define OCSP_REVOKED_STATUS_KEYCOMPROMISE           1\r\n#define OCSP_REVOKED_STATUS_CACOMPROMISE            2\r\n#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED      3\r\n#define OCSP_REVOKED_STATUS_SUPERSEDED              4\r\n#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION    5\r\n#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD         6\r\n#define OCSP_REVOKED_STATUS_REMOVEFROMCRL           8\r\n\r\n/* CrlID ::= SEQUENCE {\r\n *     crlUrl               [0]     EXPLICIT IA5String OPTIONAL,\r\n *     crlNum               [1]     EXPLICIT INTEGER OPTIONAL,\r\n *     crlTime              [2]     EXPLICIT GeneralizedTime OPTIONAL }\r\n */\r\ntypedef struct ocsp_crl_id_st\r\n        {\r\n\tASN1_IA5STRING *crlUrl;\r\n\tASN1_INTEGER *crlNum;\r\n\tASN1_GENERALIZEDTIME *crlTime;\r\n        } OCSP_CRLID;\r\n\r\n/* ServiceLocator ::= SEQUENCE {\r\n *      issuer    Name,\r\n *      locator   AuthorityInfoAccessSyntax OPTIONAL }\r\n */\r\ntypedef struct ocsp_service_locator_st\r\n        {\r\n\tX509_NAME* issuer;\r\n\tSTACK_OF(ACCESS_DESCRIPTION) *locator;\r\n        } OCSP_SERVICELOC;\r\n \r\n#define PEM_STRING_OCSP_REQUEST\t\"OCSP REQUEST\"\r\n#define PEM_STRING_OCSP_RESPONSE \"OCSP RESPONSE\"\r\n\r\n#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)\r\n\r\n#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)\r\n\r\n#define\tPEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \\\r\n     (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)\r\n\r\n#define\tPEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\\\r\n     (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)\r\n\r\n#define PEM_write_bio_OCSP_REQUEST(bp,o) \\\r\n    PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\\\r\n\t\t\tbp,(char *)o, NULL,NULL,0,NULL,NULL)\r\n\r\n#define PEM_write_bio_OCSP_RESPONSE(bp,o) \\\r\n    PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\\\r\n\t\t\tbp,(char *)o, NULL,NULL,0,NULL,NULL)\r\n\r\n#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)\r\n\r\n#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)\r\n\r\n#define OCSP_REQUEST_sign(o,pkey,md) \\\r\n\tASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\\\r\n\t\to->optionalSignature->signatureAlgorithm,NULL,\\\r\n\t        o->optionalSignature->signature,o->tbsRequest,pkey,md)\r\n\r\n#define OCSP_BASICRESP_sign(o,pkey,md,d) \\\r\n\tASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\\\r\n\t\to->signature,o->tbsResponseData,pkey,md)\r\n\r\n#define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\\\r\n        a->optionalSignature->signatureAlgorithm,\\\r\n\ta->optionalSignature->signature,a->tbsRequest,r)\r\n\r\n#define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\\\r\n\ta->signatureAlgorithm,a->signature,a->tbsResponseData,r)\r\n\r\n#define ASN1_BIT_STRING_digest(data,type,md,len) \\\r\n\tASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)\r\n\r\n#define OCSP_CERTSTATUS_dup(cs)\\\r\n                (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\\\r\n\t\t(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))\r\n\r\nOCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id);\r\n\r\nOCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);\r\nOCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,\r\n\t\t\t\t\t\t\t\tint maxline);\r\nint OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);\r\nvoid OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);\r\nint OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req);\r\nint OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,\r\n\t\tconst char *name, const char *value);\r\n\r\nOCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);\r\n\r\nOCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, \r\n\t\t\t      X509_NAME *issuerName, \r\n\t\t\t      ASN1_BIT_STRING* issuerKey, \r\n\t\t\t      ASN1_INTEGER *serialNumber);\r\n\r\nOCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);\r\n\r\nint OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);\r\nint OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);\r\nint OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);\r\nint OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);\r\n\r\nint OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);\r\nint OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);\r\n\r\nint OCSP_request_sign(OCSP_REQUEST   *req,\r\n\t\t      X509           *signer,\r\n\t\t      EVP_PKEY       *key,\r\n\t\t      const EVP_MD   *dgst,\r\n\t\t      STACK_OF(X509) *certs,\r\n\t\t      unsigned long flags);\r\n\r\nint OCSP_response_status(OCSP_RESPONSE *resp);\r\nOCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);\r\n\r\nint OCSP_resp_count(OCSP_BASICRESP *bs);\r\nOCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);\r\nint OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);\r\nint OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,\r\n\t\t\t\tASN1_GENERALIZEDTIME **revtime,\r\n\t\t\t\tASN1_GENERALIZEDTIME **thisupd,\r\n\t\t\t\tASN1_GENERALIZEDTIME **nextupd);\r\nint OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,\r\n\t\t\t\tint *reason,\r\n\t\t\t\tASN1_GENERALIZEDTIME **revtime,\r\n\t\t\t\tASN1_GENERALIZEDTIME **thisupd,\r\n\t\t\t\tASN1_GENERALIZEDTIME **nextupd);\r\nint OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,\r\n\t\t\tASN1_GENERALIZEDTIME *nextupd,\r\n\t\t\tlong sec, long maxsec);\r\n\r\nint OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags);\r\n\r\nint OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pssl);\r\n\r\nint OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);\r\nint OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);\r\n\r\nint OCSP_request_onereq_count(OCSP_REQUEST *req);\r\nOCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);\r\nOCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);\r\nint OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,\r\n\t\t\tASN1_OCTET_STRING **pikeyHash,\r\n\t\t\tASN1_INTEGER **pserial, OCSP_CERTID *cid);\r\nint OCSP_request_is_signed(OCSP_REQUEST *req);\r\nOCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);\r\nOCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp,\r\n\t\t\t\t\t\tOCSP_CERTID *cid,\r\n\t\t\t\t\t\tint status, int reason,\r\n\t\t\t\t\t\tASN1_TIME *revtime,\r\n\t\t\t\t\tASN1_TIME *thisupd, ASN1_TIME *nextupd);\r\nint OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);\r\nint OCSP_basic_sign(OCSP_BASICRESP *brsp, \r\n\t\t\tX509 *signer, EVP_PKEY *key, const EVP_MD *dgst,\r\n\t\t\tSTACK_OF(X509) *certs, unsigned long flags);\r\n\r\nX509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);\r\n\r\nX509_EXTENSION *OCSP_accept_responses_new(char **oids);\r\n\r\nX509_EXTENSION *OCSP_archive_cutoff_new(char* tim);\r\n\r\nX509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);\r\n\r\nint OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);\r\nint OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);\r\nint OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos);\r\nint OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);\r\nX509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);\r\nX509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);\r\nvoid *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);\r\nint OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\nint OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);\r\n\r\nint OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);\r\nint OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);\r\nint OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos);\r\nint OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);\r\nX509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);\r\nX509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);\r\nvoid *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);\r\nint OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\nint OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);\r\n\r\nint OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);\r\nint OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);\r\nint OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos);\r\nint OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos);\r\nX509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);\r\nX509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);\r\nvoid *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx);\r\nint OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\nint OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);\r\n\r\nint OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);\r\nint OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);\r\nint OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos);\r\nint OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos);\r\nX509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);\r\nX509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);\r\nvoid *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx);\r\nint OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\nint OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);\r\n\r\nDECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPID)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_CERTID)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_REQUEST)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_CRLID)\r\nDECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)\r\n\r\nconst char *OCSP_response_status_str(long s);\r\nconst char *OCSP_cert_status_str(long s);\r\nconst char *OCSP_crl_reason_str(long s);\r\n\r\nint OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);\r\nint OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);\r\n\r\nint OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,\r\n\t\t\t\tX509_STORE *st, unsigned long flags);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_OCSP_strings(void);\r\n\r\n/* Error codes for the OCSP functions. */\r\n\r\n/* Function codes. */\r\n#define OCSP_F_ASN1_STRING_ENCODE\t\t\t 100\r\n#define OCSP_F_D2I_OCSP_NONCE\t\t\t\t 102\r\n#define OCSP_F_OCSP_BASIC_ADD1_STATUS\t\t\t 103\r\n#define OCSP_F_OCSP_BASIC_SIGN\t\t\t\t 104\r\n#define OCSP_F_OCSP_BASIC_VERIFY\t\t\t 105\r\n#define OCSP_F_OCSP_CERT_ID_NEW\t\t\t\t 101\r\n#define OCSP_F_OCSP_CHECK_DELEGATED\t\t\t 106\r\n#define OCSP_F_OCSP_CHECK_IDS\t\t\t\t 107\r\n#define OCSP_F_OCSP_CHECK_ISSUER\t\t\t 108\r\n#define OCSP_F_OCSP_CHECK_VALIDITY\t\t\t 115\r\n#define OCSP_F_OCSP_MATCH_ISSUERID\t\t\t 109\r\n#define OCSP_F_OCSP_PARSE_URL\t\t\t\t 114\r\n#define OCSP_F_OCSP_REQUEST_SIGN\t\t\t 110\r\n#define OCSP_F_OCSP_REQUEST_VERIFY\t\t\t 116\r\n#define OCSP_F_OCSP_RESPONSE_GET1_BASIC\t\t\t 111\r\n#define OCSP_F_OCSP_SENDREQ_BIO\t\t\t\t 112\r\n#define OCSP_F_OCSP_SENDREQ_NBIO\t\t\t 117\r\n#define OCSP_F_PARSE_HTTP_LINE1\t\t\t\t 118\r\n#define OCSP_F_REQUEST_VERIFY\t\t\t\t 113\r\n\r\n/* Reason codes. */\r\n#define OCSP_R_BAD_DATA\t\t\t\t\t 100\r\n#define OCSP_R_CERTIFICATE_VERIFY_ERROR\t\t\t 101\r\n#define OCSP_R_DIGEST_ERR\t\t\t\t 102\r\n#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD\t\t 122\r\n#define OCSP_R_ERROR_IN_THISUPDATE_FIELD\t\t 123\r\n#define OCSP_R_ERROR_PARSING_URL\t\t\t 121\r\n#define OCSP_R_MISSING_OCSPSIGNING_USAGE\t\t 103\r\n#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE\t\t 124\r\n#define OCSP_R_NOT_BASIC_RESPONSE\t\t\t 104\r\n#define OCSP_R_NO_CERTIFICATES_IN_CHAIN\t\t\t 105\r\n#define OCSP_R_NO_CONTENT\t\t\t\t 106\r\n#define OCSP_R_NO_PUBLIC_KEY\t\t\t\t 107\r\n#define OCSP_R_NO_RESPONSE_DATA\t\t\t\t 108\r\n#define OCSP_R_NO_REVOKED_TIME\t\t\t\t 109\r\n#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE\t 110\r\n#define OCSP_R_REQUEST_NOT_SIGNED\t\t\t 128\r\n#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA\t 111\r\n#define OCSP_R_ROOT_CA_NOT_TRUSTED\t\t\t 112\r\n#define OCSP_R_SERVER_READ_ERROR\t\t\t 113\r\n#define OCSP_R_SERVER_RESPONSE_ERROR\t\t\t 114\r\n#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR\t\t 115\r\n#define OCSP_R_SERVER_WRITE_ERROR\t\t\t 116\r\n#define OCSP_R_SIGNATURE_FAILURE\t\t\t 117\r\n#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND\t\t 118\r\n#define OCSP_R_STATUS_EXPIRED\t\t\t\t 125\r\n#define OCSP_R_STATUS_NOT_YET_VALID\t\t\t 126\r\n#define OCSP_R_STATUS_TOO_OLD\t\t\t\t 127\r\n#define OCSP_R_UNKNOWN_MESSAGE_DIGEST\t\t\t 119\r\n#define OCSP_R_UNKNOWN_NID\t\t\t\t 120\r\n#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE\t\t 129\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/opensslconf.h",
    "content": "/* opensslconf.h */\r\n/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\r\n\r\n/* OpenSSL was configured with the following options: */\r\n#ifndef OPENSSL_SYSNAME_WIN32\r\n# define OPENSSL_SYSNAME_WIN32\r\n#endif\r\n#ifndef OPENSSL_DOING_MAKEDEPEND\r\n\r\n\r\n#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128\r\n# define OPENSSL_NO_EC_NISTP_64_GCC_128\r\n#endif\r\n#ifndef OPENSSL_NO_GMP\r\n# define OPENSSL_NO_GMP\r\n#endif\r\n#ifndef OPENSSL_NO_JPAKE\r\n# define OPENSSL_NO_JPAKE\r\n#endif\r\n#ifndef OPENSSL_NO_KRB5\r\n# define OPENSSL_NO_KRB5\r\n#endif\r\n#ifndef OPENSSL_NO_MD2\r\n# define OPENSSL_NO_MD2\r\n#endif\r\n#ifndef OPENSSL_NO_RC5\r\n# define OPENSSL_NO_RC5\r\n#endif\r\n#ifndef OPENSSL_NO_RFC3779\r\n# define OPENSSL_NO_RFC3779\r\n#endif\r\n#ifndef OPENSSL_NO_SCTP\r\n# define OPENSSL_NO_SCTP\r\n#endif\r\n#ifndef OPENSSL_NO_STORE\r\n# define OPENSSL_NO_STORE\r\n#endif\r\n\r\n#endif /* OPENSSL_DOING_MAKEDEPEND */\r\n\r\n#ifndef OPENSSL_THREADS\r\n# define OPENSSL_THREADS\r\n#endif\r\n#ifndef OPENSSL_NO_ASM\r\n# define OPENSSL_NO_ASM\r\n#endif\r\n\r\n/* The OPENSSL_NO_* macros are also defined as NO_* if the application\r\n   asks for it.  This is a transient feature that is provided for those\r\n   who haven't had the time to do the appropriate changes in their\r\n   applications.  */\r\n#ifdef OPENSSL_ALGORITHM_DEFINES\r\n# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)\r\n#  define NO_EC_NISTP_64_GCC_128\r\n# endif\r\n# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)\r\n#  define NO_GMP\r\n# endif\r\n# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)\r\n#  define NO_JPAKE\r\n# endif\r\n# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)\r\n#  define NO_KRB5\r\n# endif\r\n# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)\r\n#  define NO_MD2\r\n# endif\r\n# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)\r\n#  define NO_RC5\r\n# endif\r\n# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)\r\n#  define NO_RFC3779\r\n# endif\r\n# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)\r\n#  define NO_SCTP\r\n# endif\r\n# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)\r\n#  define NO_STORE\r\n# endif\r\n#endif\r\n\r\n/* crypto/opensslconf.h.in */\r\n\r\n/* Generate 80386 code? */\r\n#undef I386_ONLY\r\n\r\n#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */\r\n#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)\r\n#define ENGINESDIR \"c:\\\\openssl/lib/engines\"\r\n#define OPENSSLDIR \"c:\\\\openssl/ssl\"\r\n#endif\r\n#endif\r\n\r\n#undef OPENSSL_UNISTD\r\n#define OPENSSL_UNISTD <unistd.h>\r\n\r\n#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n#define OPENSSL_EXPORT_VAR_AS_FUNCTION\r\n\r\n#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)\r\n#define IDEA_INT unsigned int\r\n#endif\r\n\r\n#if defined(HEADER_MD2_H) && !defined(MD2_INT)\r\n#define MD2_INT unsigned int\r\n#endif\r\n\r\n#if defined(HEADER_RC2_H) && !defined(RC2_INT)\r\n/* I need to put in a mod for the alpha - eay */\r\n#define RC2_INT unsigned int\r\n#endif\r\n\r\n#if defined(HEADER_RC4_H)\r\n#if !defined(RC4_INT)\r\n/* using int types make the structure larger but make the code faster\r\n * on most boxes I have tested - up to %20 faster. */\r\n/*\r\n * I don't know what does \"most\" mean, but declaring \"int\" is a must on:\r\n * - Intel P6 because partial register stalls are very expensive;\r\n * - elder Alpha because it lacks byte load/store instructions;\r\n */\r\n#define RC4_INT unsigned int\r\n#endif\r\n#if !defined(RC4_CHUNK)\r\n/*\r\n * This enables code handling data aligned at natural CPU word\r\n * boundary. See crypto/rc4/rc4_enc.c for further details.\r\n */\r\n#undef RC4_CHUNK\r\n#endif\r\n#endif\r\n\r\n#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)\r\n/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a\r\n * %20 speed up (longs are 8 bytes, int's are 4). */\r\n#ifndef DES_LONG\r\n#define DES_LONG unsigned long\r\n#endif\r\n#endif\r\n\r\n#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)\r\n#define CONFIG_HEADER_BN_H\r\n#define BN_LLONG\r\n\r\n/* Should we define BN_DIV2W here? */\r\n\r\n/* Only one for the following should be defined */\r\n#undef SIXTY_FOUR_BIT_LONG\r\n#undef SIXTY_FOUR_BIT\r\n#define THIRTY_TWO_BIT\r\n#endif\r\n\r\n#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)\r\n#define CONFIG_HEADER_RC4_LOCL_H\r\n/* if this is defined data[i] is used instead of *data, this is a %20\r\n * speedup on x86 */\r\n#define RC4_INDEX\r\n#endif\r\n\r\n#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)\r\n#define CONFIG_HEADER_BF_LOCL_H\r\n#undef BF_PTR\r\n#endif /* HEADER_BF_LOCL_H */\r\n\r\n#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)\r\n#define CONFIG_HEADER_DES_LOCL_H\r\n#ifndef DES_DEFAULT_OPTIONS\r\n/* the following is tweaked from a config script, that is why it is a\r\n * protected undef/define */\r\n#ifndef DES_PTR\r\n#undef DES_PTR\r\n#endif\r\n\r\n/* This helps C compiler generate the correct code for multiple functional\r\n * units.  It reduces register dependancies at the expense of 2 more\r\n * registers */\r\n#ifndef DES_RISC1\r\n#undef DES_RISC1\r\n#endif\r\n\r\n#ifndef DES_RISC2\r\n#undef DES_RISC2\r\n#endif\r\n\r\n#if defined(DES_RISC1) && defined(DES_RISC2)\r\nYOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!\r\n#endif\r\n\r\n/* Unroll the inner loop, this sometimes helps, sometimes hinders.\r\n * Very mucy CPU dependant */\r\n#ifndef DES_UNROLL\r\n#undef DES_UNROLL\r\n#endif\r\n\r\n/* These default values were supplied by\r\n * Peter Gutman <pgut001@cs.auckland.ac.nz>\r\n * They are only used if nothing else has been defined */\r\n#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)\r\n/* Special defines which change the way the code is built depending on the\r\n   CPU and OS.  For SGI machines you can use _MIPS_SZLONG (32 or 64) to find\r\n   even newer MIPS CPU's, but at the moment one size fits all for\r\n   optimization options.  Older Sparc's work better with only UNROLL, but\r\n   there's no way to tell at compile time what it is you're running on */\r\n \r\n#if defined( sun )\t\t/* Newer Sparc's */\r\n#  define DES_PTR\r\n#  define DES_RISC1\r\n#  define DES_UNROLL\r\n#elif defined( __ultrix )\t/* Older MIPS */\r\n#  define DES_PTR\r\n#  define DES_RISC2\r\n#  define DES_UNROLL\r\n#elif defined( __osf1__ )\t/* Alpha */\r\n#  define DES_PTR\r\n#  define DES_RISC2\r\n#elif defined ( _AIX )\t\t/* RS6000 */\r\n  /* Unknown */\r\n#elif defined( __hpux )\t\t/* HP-PA */\r\n  /* Unknown */\r\n#elif defined( __aux )\t\t/* 68K */\r\n  /* Unknown */\r\n#elif defined( __dgux )\t\t/* 88K (but P6 in latest boxes) */\r\n#  define DES_UNROLL\r\n#elif defined( __sgi )\t\t/* Newer MIPS */\r\n#  define DES_PTR\r\n#  define DES_RISC2\r\n#  define DES_UNROLL\r\n#elif defined(i386) || defined(__i386__)\t/* x86 boxes, should be gcc */\r\n#  define DES_PTR\r\n#  define DES_RISC1\r\n#  define DES_UNROLL\r\n#endif /* Systems-specific speed defines */\r\n#endif\r\n\r\n#endif /* DES_DEFAULT_OPTIONS */\r\n#endif /* HEADER_DES_LOCL_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/opensslv.h",
    "content": "#ifndef HEADER_OPENSSLV_H\r\n#define HEADER_OPENSSLV_H\r\n\r\n/* Numeric release version identifier:\r\n * MNNFFPPS: major minor fix patch status\r\n * The status nibble has one of the values 0 for development, 1 to e for betas\r\n * 1 to 14, and f for release.  The patch level is exactly that.\r\n * For example:\r\n * 0.9.3-dev\t  0x00903000\r\n * 0.9.3-beta1\t  0x00903001\r\n * 0.9.3-beta2-dev 0x00903002\r\n * 0.9.3-beta2    0x00903002 (same as ...beta2-dev)\r\n * 0.9.3\t  0x0090300f\r\n * 0.9.3a\t  0x0090301f\r\n * 0.9.4 \t  0x0090400f\r\n * 1.2.3z\t  0x102031af\r\n *\r\n * For continuity reasons (because 0.9.5 is already out, and is coded\r\n * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level\r\n * part is slightly different, by setting the highest bit.  This means\r\n * that 0.9.5a looks like this: 0x0090581f.  At 0.9.6, we can start\r\n * with 0x0090600S...\r\n *\r\n * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.)\r\n * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for\r\n *  major minor fix final patch/beta)\r\n */\r\n#define OPENSSL_VERSION_NUMBER\t0x1000103fL\r\n#ifdef OPENSSL_FIPS\r\n#define OPENSSL_VERSION_TEXT\t\"OpenSSL 1.0.1c-fips 10 May 2012\"\r\n#else\r\n#define OPENSSL_VERSION_TEXT\t\"OpenSSL 1.0.1c 10 May 2012\"\r\n#endif\r\n#define OPENSSL_VERSION_PTEXT\t\" part of \" OPENSSL_VERSION_TEXT\r\n\r\n\r\n/* The macros below are to be used for shared library (.so, .dll, ...)\r\n * versioning.  That kind of versioning works a bit differently between\r\n * operating systems.  The most usual scheme is to set a major and a minor\r\n * number, and have the runtime loader check that the major number is equal\r\n * to what it was at application link time, while the minor number has to\r\n * be greater or equal to what it was at application link time.  With this\r\n * scheme, the version number is usually part of the file name, like this:\r\n *\r\n *\tlibcrypto.so.0.9\r\n *\r\n * Some unixen also make a softlink with the major verson number only:\r\n *\r\n *\tlibcrypto.so.0\r\n *\r\n * On Tru64 and IRIX 6.x it works a little bit differently.  There, the\r\n * shared library version is stored in the file, and is actually a series\r\n * of versions, separated by colons.  The rightmost version present in the\r\n * library when linking an application is stored in the application to be\r\n * matched at run time.  When the application is run, a check is done to\r\n * see if the library version stored in the application matches any of the\r\n * versions in the version string of the library itself.\r\n * This version string can be constructed in any way, depending on what\r\n * kind of matching is desired.  However, to implement the same scheme as\r\n * the one used in the other unixen, all compatible versions, from lowest\r\n * to highest, should be part of the string.  Consecutive builds would\r\n * give the following versions strings:\r\n *\r\n *\t3.0\r\n *\t3.0:3.1\r\n *\t3.0:3.1:3.2\r\n *\t4.0\r\n *\t4.0:4.1\r\n *\r\n * Notice how version 4 is completely incompatible with version, and\r\n * therefore give the breach you can see.\r\n *\r\n * There may be other schemes as well that I haven't yet discovered.\r\n *\r\n * So, here's the way it works here: first of all, the library version\r\n * number doesn't need at all to match the overall OpenSSL version.\r\n * However, it's nice and more understandable if it actually does.\r\n * The current library version is stored in the macro SHLIB_VERSION_NUMBER,\r\n * which is just a piece of text in the format \"M.m.e\" (Major, minor, edit).\r\n * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways,\r\n * we need to keep a history of version numbers, which is done in the\r\n * macro SHLIB_VERSION_HISTORY.  The numbers are separated by colons and\r\n * should only keep the versions that are binary compatible with the current.\r\n */\r\n#define SHLIB_VERSION_HISTORY \"\"\r\n#define SHLIB_VERSION_NUMBER \"1.0.0\"\r\n\r\n\r\n#endif /* HEADER_OPENSSLV_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ossl_typ.h",
    "content": "/* ====================================================================\r\n * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_OPENSSL_TYPES_H\r\n#define HEADER_OPENSSL_TYPES_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifdef NO_ASN1_TYPEDEFS\r\n#define ASN1_INTEGER\t\tASN1_STRING\r\n#define ASN1_ENUMERATED\t\tASN1_STRING\r\n#define ASN1_BIT_STRING\t\tASN1_STRING\r\n#define ASN1_OCTET_STRING\tASN1_STRING\r\n#define ASN1_PRINTABLESTRING\tASN1_STRING\r\n#define ASN1_T61STRING\t\tASN1_STRING\r\n#define ASN1_IA5STRING\t\tASN1_STRING\r\n#define ASN1_UTCTIME\t\tASN1_STRING\r\n#define ASN1_GENERALIZEDTIME\tASN1_STRING\r\n#define ASN1_TIME\t\tASN1_STRING\r\n#define ASN1_GENERALSTRING\tASN1_STRING\r\n#define ASN1_UNIVERSALSTRING\tASN1_STRING\r\n#define ASN1_BMPSTRING\t\tASN1_STRING\r\n#define ASN1_VISIBLESTRING\tASN1_STRING\r\n#define ASN1_UTF8STRING\t\tASN1_STRING\r\n#define ASN1_BOOLEAN\t\tint\r\n#define ASN1_NULL\t\tint\r\n#else\r\ntypedef struct asn1_string_st ASN1_INTEGER;\r\ntypedef struct asn1_string_st ASN1_ENUMERATED;\r\ntypedef struct asn1_string_st ASN1_BIT_STRING;\r\ntypedef struct asn1_string_st ASN1_OCTET_STRING;\r\ntypedef struct asn1_string_st ASN1_PRINTABLESTRING;\r\ntypedef struct asn1_string_st ASN1_T61STRING;\r\ntypedef struct asn1_string_st ASN1_IA5STRING;\r\ntypedef struct asn1_string_st ASN1_GENERALSTRING;\r\ntypedef struct asn1_string_st ASN1_UNIVERSALSTRING;\r\ntypedef struct asn1_string_st ASN1_BMPSTRING;\r\ntypedef struct asn1_string_st ASN1_UTCTIME;\r\ntypedef struct asn1_string_st ASN1_TIME;\r\ntypedef struct asn1_string_st ASN1_GENERALIZEDTIME;\r\ntypedef struct asn1_string_st ASN1_VISIBLESTRING;\r\ntypedef struct asn1_string_st ASN1_UTF8STRING;\r\ntypedef struct asn1_string_st ASN1_STRING;\r\ntypedef int ASN1_BOOLEAN;\r\ntypedef int ASN1_NULL;\r\n#endif\r\n\r\ntypedef struct ASN1_ITEM_st ASN1_ITEM;\r\ntypedef struct asn1_pctx_st ASN1_PCTX;\r\n\r\n#ifdef OPENSSL_SYS_WIN32\r\n#undef X509_NAME\r\n#undef X509_EXTENSIONS\r\n#undef X509_CERT_PAIR\r\n#undef PKCS7_ISSUER_AND_SERIAL\r\n#undef OCSP_REQUEST\r\n#undef OCSP_RESPONSE\r\n#endif\r\n\r\n#ifdef BIGNUM\r\n#undef BIGNUM\r\n#endif\r\ntypedef struct bignum_st BIGNUM;\r\ntypedef struct bignum_ctx BN_CTX;\r\ntypedef struct bn_blinding_st BN_BLINDING;\r\ntypedef struct bn_mont_ctx_st BN_MONT_CTX;\r\ntypedef struct bn_recp_ctx_st BN_RECP_CTX;\r\ntypedef struct bn_gencb_st BN_GENCB;\r\n\r\ntypedef struct buf_mem_st BUF_MEM;\r\n\r\ntypedef struct evp_cipher_st EVP_CIPHER;\r\ntypedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;\r\ntypedef struct env_md_st EVP_MD;\r\ntypedef struct env_md_ctx_st EVP_MD_CTX;\r\ntypedef struct evp_pkey_st EVP_PKEY;\r\n\r\ntypedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;\r\n\r\ntypedef struct evp_pkey_method_st EVP_PKEY_METHOD;\r\ntypedef struct evp_pkey_ctx_st EVP_PKEY_CTX;\r\n\r\ntypedef struct dh_st DH;\r\ntypedef struct dh_method DH_METHOD;\r\n\r\ntypedef struct dsa_st DSA;\r\ntypedef struct dsa_method DSA_METHOD;\r\n\r\ntypedef struct rsa_st RSA;\r\ntypedef struct rsa_meth_st RSA_METHOD;\r\n\r\ntypedef struct rand_meth_st RAND_METHOD;\r\n\r\ntypedef struct ecdh_method ECDH_METHOD;\r\ntypedef struct ecdsa_method ECDSA_METHOD;\r\n\r\ntypedef struct x509_st X509;\r\ntypedef struct X509_algor_st X509_ALGOR;\r\ntypedef struct X509_crl_st X509_CRL;\r\ntypedef struct x509_crl_method_st X509_CRL_METHOD;\r\ntypedef struct x509_revoked_st X509_REVOKED;\r\ntypedef struct X509_name_st X509_NAME;\r\ntypedef struct X509_pubkey_st X509_PUBKEY;\r\ntypedef struct x509_store_st X509_STORE;\r\ntypedef struct x509_store_ctx_st X509_STORE_CTX;\r\n\r\ntypedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;\r\n\r\ntypedef struct v3_ext_ctx X509V3_CTX;\r\ntypedef struct conf_st CONF;\r\n\r\ntypedef struct store_st STORE;\r\ntypedef struct store_method_st STORE_METHOD;\r\n\r\ntypedef struct ui_st UI;\r\ntypedef struct ui_method_st UI_METHOD;\r\n\r\ntypedef struct st_ERR_FNS ERR_FNS;\r\n\r\ntypedef struct engine_st ENGINE;\r\ntypedef struct ssl_st SSL;\r\ntypedef struct ssl_ctx_st SSL_CTX;\r\n\r\ntypedef struct X509_POLICY_NODE_st X509_POLICY_NODE;\r\ntypedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;\r\ntypedef struct X509_POLICY_TREE_st X509_POLICY_TREE;\r\ntypedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;\r\n\r\ntypedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID;\r\ntypedef struct DIST_POINT_st DIST_POINT;\r\ntypedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT;\r\ntypedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS;\r\n\r\n  /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */\r\n#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */\r\n#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */\r\n\r\ntypedef struct crypto_ex_data_st CRYPTO_EX_DATA;\r\n/* Callback types for crypto.h */\r\ntypedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\r\n\t\t\t\t\tint idx, long argl, void *argp);\r\ntypedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\r\n\t\t\t\t\tint idx, long argl, void *argp);\r\ntypedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, \r\n\t\t\t\t\tint idx, long argl, void *argp);\r\n\r\ntypedef struct ocsp_req_ctx_st OCSP_REQ_CTX;\r\ntypedef struct ocsp_response_st OCSP_RESPONSE;\r\ntypedef struct ocsp_responder_id_st OCSP_RESPID;\r\n\r\n#endif /* def HEADER_OPENSSL_TYPES_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/pem.h",
    "content": "/* crypto/pem/pem.h */\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_PEM_H\r\n#define HEADER_PEM_H\r\n\r\n#include <openssl/e_os2.h>\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#ifndef OPENSSL_NO_STACK\r\n#include <openssl/stack.h>\r\n#endif\r\n#include <openssl/evp.h>\r\n#include <openssl/x509.h>\r\n#include <openssl/pem2.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define PEM_BUFSIZE\t\t1024\r\n\r\n#define PEM_OBJ_UNDEF\t\t0\r\n#define PEM_OBJ_X509\t\t1\r\n#define PEM_OBJ_X509_REQ\t2\r\n#define PEM_OBJ_CRL\t\t3\r\n#define PEM_OBJ_SSL_SESSION\t4\r\n#define PEM_OBJ_PRIV_KEY\t10\r\n#define PEM_OBJ_PRIV_RSA\t11\r\n#define PEM_OBJ_PRIV_DSA\t12\r\n#define PEM_OBJ_PRIV_DH\t\t13\r\n#define PEM_OBJ_PUB_RSA\t\t14\r\n#define PEM_OBJ_PUB_DSA\t\t15\r\n#define PEM_OBJ_PUB_DH\t\t16\r\n#define PEM_OBJ_DHPARAMS\t17\r\n#define PEM_OBJ_DSAPARAMS\t18\r\n#define PEM_OBJ_PRIV_RSA_PUBLIC\t19\r\n#define PEM_OBJ_PRIV_ECDSA\t20\r\n#define PEM_OBJ_PUB_ECDSA\t21\r\n#define PEM_OBJ_ECPARAMETERS\t22\r\n\r\n#define PEM_ERROR\t\t30\r\n#define PEM_DEK_DES_CBC         40\r\n#define PEM_DEK_IDEA_CBC        45\r\n#define PEM_DEK_DES_EDE         50\r\n#define PEM_DEK_DES_ECB         60\r\n#define PEM_DEK_RSA             70\r\n#define PEM_DEK_RSA_MD2         80\r\n#define PEM_DEK_RSA_MD5         90\r\n\r\n#define PEM_MD_MD2\t\tNID_md2\r\n#define PEM_MD_MD5\t\tNID_md5\r\n#define PEM_MD_SHA\t\tNID_sha\r\n#define PEM_MD_MD2_RSA\t\tNID_md2WithRSAEncryption\r\n#define PEM_MD_MD5_RSA\t\tNID_md5WithRSAEncryption\r\n#define PEM_MD_SHA_RSA\t\tNID_sha1WithRSAEncryption\r\n\r\n#define PEM_STRING_X509_OLD\t\"X509 CERTIFICATE\"\r\n#define PEM_STRING_X509\t\t\"CERTIFICATE\"\r\n#define PEM_STRING_X509_PAIR\t\"CERTIFICATE PAIR\"\r\n#define PEM_STRING_X509_TRUSTED\t\"TRUSTED CERTIFICATE\"\r\n#define PEM_STRING_X509_REQ_OLD\t\"NEW CERTIFICATE REQUEST\"\r\n#define PEM_STRING_X509_REQ\t\"CERTIFICATE REQUEST\"\r\n#define PEM_STRING_X509_CRL\t\"X509 CRL\"\r\n#define PEM_STRING_EVP_PKEY\t\"ANY PRIVATE KEY\"\r\n#define PEM_STRING_PUBLIC\t\"PUBLIC KEY\"\r\n#define PEM_STRING_RSA\t\t\"RSA PRIVATE KEY\"\r\n#define PEM_STRING_RSA_PUBLIC\t\"RSA PUBLIC KEY\"\r\n#define PEM_STRING_DSA\t\t\"DSA PRIVATE KEY\"\r\n#define PEM_STRING_DSA_PUBLIC\t\"DSA PUBLIC KEY\"\r\n#define PEM_STRING_PKCS7\t\"PKCS7\"\r\n#define PEM_STRING_PKCS7_SIGNED\t\"PKCS #7 SIGNED DATA\"\r\n#define PEM_STRING_PKCS8\t\"ENCRYPTED PRIVATE KEY\"\r\n#define PEM_STRING_PKCS8INF\t\"PRIVATE KEY\"\r\n#define PEM_STRING_DHPARAMS\t\"DH PARAMETERS\"\r\n#define PEM_STRING_SSL_SESSION\t\"SSL SESSION PARAMETERS\"\r\n#define PEM_STRING_DSAPARAMS\t\"DSA PARAMETERS\"\r\n#define PEM_STRING_ECDSA_PUBLIC \"ECDSA PUBLIC KEY\"\r\n#define PEM_STRING_ECPARAMETERS \"EC PARAMETERS\"\r\n#define PEM_STRING_ECPRIVATEKEY\t\"EC PRIVATE KEY\"\r\n#define PEM_STRING_PARAMETERS\t\"PARAMETERS\"\r\n#define PEM_STRING_CMS\t\t\"CMS\"\r\n\r\n  /* Note that this structure is initialised by PEM_SealInit and cleaned up\r\n     by PEM_SealFinal (at least for now) */\r\ntypedef struct PEM_Encode_Seal_st\r\n\t{\r\n\tEVP_ENCODE_CTX encode;\r\n\tEVP_MD_CTX md;\r\n\tEVP_CIPHER_CTX cipher;\r\n\t} PEM_ENCODE_SEAL_CTX;\r\n\r\n/* enc_type is one off */\r\n#define PEM_TYPE_ENCRYPTED      10\r\n#define PEM_TYPE_MIC_ONLY       20\r\n#define PEM_TYPE_MIC_CLEAR      30\r\n#define PEM_TYPE_CLEAR\t\t40\r\n\r\ntypedef struct pem_recip_st\r\n\t{\r\n\tchar *name;\r\n\tX509_NAME *dn;\r\n\r\n\tint cipher;\r\n\tint key_enc;\r\n\t/*\tchar iv[8]; unused and wrong size */\r\n\t} PEM_USER;\r\n\r\ntypedef struct pem_ctx_st\r\n\t{\r\n\tint type;\t\t/* what type of object */\r\n\r\n\tstruct\t{\r\n\t\tint version;\t\r\n\t\tint mode;\t\t\r\n\t\t} proc_type;\r\n\r\n\tchar *domain;\r\n\r\n\tstruct\t{\r\n\t\tint cipher;\r\n\t/* unused, and wrong size\r\n\t   unsigned char iv[8]; */\r\n\t\t} DEK_info;\r\n\t\t\r\n\tPEM_USER *originator;\r\n\r\n\tint num_recipient;\r\n\tPEM_USER **recipient;\r\n\r\n\t/* XXX(ben): don#t think this is used! \r\n\t\tSTACK *x509_chain;\t/ * certificate chain */\r\n\tEVP_MD *md;\t\t/* signature type */\r\n\r\n\tint md_enc;\t\t/* is the md encrypted or not? */\r\n\tint md_len;\t\t/* length of md_data */\r\n\tchar *md_data;\t\t/* message digest, could be pkey encrypted */\r\n\r\n\tEVP_CIPHER *dec;\t/* date encryption cipher */\r\n\tint key_len;\t\t/* key length */\r\n\tunsigned char *key;\t/* key */\r\n\t/* unused, and wrong size\r\n\t   unsigned char iv[8]; */\r\n\r\n\t\r\n\tint  data_enc;\t\t/* is the data encrypted */\r\n\tint data_len;\r\n\tunsigned char *data;\r\n\t} PEM_CTX;\r\n\r\n/* These macros make the PEM_read/PEM_write functions easier to maintain and\r\n * write. Now they are all implemented with either:\r\n * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)\r\n */\r\n\r\n#ifdef OPENSSL_NO_FP_API\r\n\r\n#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/\r\n#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/\r\n#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/\r\n#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/\r\n#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/\r\n\r\n#else\r\n\r\n#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \\\r\ntype *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\\\r\n{ \\\r\nreturn PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \\\r\n} \r\n\r\n#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \\\r\nint PEM_write_##name(FILE *fp, type *x) \\\r\n{ \\\r\nreturn PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \\\r\n}\r\n\r\n#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \\\r\nint PEM_write_##name(FILE *fp, const type *x) \\\r\n{ \\\r\nreturn PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \\\r\n}\r\n\r\n#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \\\r\nint PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \\\r\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, \\\r\n\t\t  void *u) \\\r\n\t{ \\\r\n\treturn PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \\\r\n\t}\r\n\r\n#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \\\r\nint PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \\\r\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, \\\r\n\t\t  void *u) \\\r\n\t{ \\\r\n\treturn PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \\\r\n\t}\r\n\r\n#endif\r\n\r\n#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \\\r\ntype *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\\\r\n{ \\\r\nreturn PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \\\r\n}\r\n\r\n#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \\\r\nint PEM_write_bio_##name(BIO *bp, type *x) \\\r\n{ \\\r\nreturn PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \\\r\n}\r\n\r\n#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \\\r\nint PEM_write_bio_##name(BIO *bp, const type *x) \\\r\n{ \\\r\nreturn PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \\\r\n}\r\n\r\n#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \\\r\nint PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \\\r\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \\\r\n\t{ \\\r\n\treturn PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \\\r\n\t}\r\n\r\n#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \\\r\nint PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \\\r\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \\\r\n\t{ \\\r\n\treturn PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \\\r\n\t}\r\n\r\n#define IMPLEMENT_PEM_write(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_bio(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_fp(name, type, str, asn1) \r\n\r\n#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \r\n\r\n#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \r\n\r\n#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \r\n\r\n#define IMPLEMENT_PEM_read(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_read_bio(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_read_fp(name, type, str, asn1) \r\n\r\n#define IMPLEMENT_PEM_rw(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_read(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write(name, type, str, asn1)\r\n\r\n#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_read(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_const(name, type, str, asn1)\r\n\r\n#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_read(name, type, str, asn1) \\\r\n\tIMPLEMENT_PEM_write_cb(name, type, str, asn1)\r\n\r\n/* These are the same except they are for the declarations */\r\n\r\n#if defined(OPENSSL_NO_FP_API)\r\n\r\n#define DECLARE_PEM_read_fp(name, type) /**/\r\n#define DECLARE_PEM_write_fp(name, type) /**/\r\n#define DECLARE_PEM_write_cb_fp(name, type) /**/\r\n\r\n#else\r\n\r\n#define DECLARE_PEM_read_fp(name, type) \\\r\n\ttype *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);\r\n\r\n#define DECLARE_PEM_write_fp(name, type) \\\r\n\tint PEM_write_##name(FILE *fp, type *x);\r\n\r\n#define DECLARE_PEM_write_fp_const(name, type) \\\r\n\tint PEM_write_##name(FILE *fp, const type *x);\r\n\r\n#define DECLARE_PEM_write_cb_fp(name, type) \\\r\n\tint PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \\\r\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);\r\n\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n#define DECLARE_PEM_read_bio(name, type) \\\r\n\ttype *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);\r\n\r\n#define DECLARE_PEM_write_bio(name, type) \\\r\n\tint PEM_write_bio_##name(BIO *bp, type *x);\r\n\r\n#define DECLARE_PEM_write_bio_const(name, type) \\\r\n\tint PEM_write_bio_##name(BIO *bp, const type *x);\r\n\r\n#define DECLARE_PEM_write_cb_bio(name, type) \\\r\n\tint PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \\\r\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);\r\n\r\n#else\r\n\r\n#define DECLARE_PEM_read_bio(name, type) /**/\r\n#define DECLARE_PEM_write_bio(name, type) /**/\r\n#define DECLARE_PEM_write_bio_const(name, type) /**/\r\n#define DECLARE_PEM_write_cb_bio(name, type) /**/\r\n\r\n#endif\r\n\r\n#define DECLARE_PEM_write(name, type) \\\r\n\tDECLARE_PEM_write_bio(name, type) \\\r\n\tDECLARE_PEM_write_fp(name, type) \r\n\r\n#define DECLARE_PEM_write_const(name, type) \\\r\n\tDECLARE_PEM_write_bio_const(name, type) \\\r\n\tDECLARE_PEM_write_fp_const(name, type)\r\n\r\n#define DECLARE_PEM_write_cb(name, type) \\\r\n\tDECLARE_PEM_write_cb_bio(name, type) \\\r\n\tDECLARE_PEM_write_cb_fp(name, type) \r\n\r\n#define DECLARE_PEM_read(name, type) \\\r\n\tDECLARE_PEM_read_bio(name, type) \\\r\n\tDECLARE_PEM_read_fp(name, type)\r\n\r\n#define DECLARE_PEM_rw(name, type) \\\r\n\tDECLARE_PEM_read(name, type) \\\r\n\tDECLARE_PEM_write(name, type)\r\n\r\n#define DECLARE_PEM_rw_const(name, type) \\\r\n\tDECLARE_PEM_read(name, type) \\\r\n\tDECLARE_PEM_write_const(name, type)\r\n\r\n#define DECLARE_PEM_rw_cb(name, type) \\\r\n\tDECLARE_PEM_read(name, type) \\\r\n\tDECLARE_PEM_write_cb(name, type)\r\n\r\n#if 1\r\n/* \"userdata\": new with OpenSSL 0.9.4 */\r\ntypedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);\r\n#else\r\n/* OpenSSL 0.9.3, 0.9.3a */\r\ntypedef int pem_password_cb(char *buf, int size, int rwflag);\r\n#endif\r\n\r\nint\tPEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);\r\nint\tPEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,\r\n\tpem_password_cb *callback,void *u);\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint\tPEM_read_bio(BIO *bp, char **name, char **header,\r\n\t\tunsigned char **data,long *len);\r\nint\tPEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,\r\n\t\tlong len);\r\nint PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,\r\n\t     pem_password_cb *cb, void *u);\r\nvoid *\tPEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,\r\n\t\t\t  void **x, pem_password_cb *cb, void *u);\r\nint\tPEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x,\r\n\t\t\t   const EVP_CIPHER *enc,unsigned char *kstr,int klen,\r\n\t\t\t   pem_password_cb *cb, void *u);\r\n\r\nSTACK_OF(X509_INFO) *\tPEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);\r\nint\tPEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,\r\n\t\tunsigned char *kstr, int klen, pem_password_cb *cd, void *u);\r\n#endif\r\n\r\nint\tPEM_read(FILE *fp, char **name, char **header,\r\n\t\tunsigned char **data,long *len);\r\nint\tPEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);\r\nvoid *  PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,\r\n\t\t      pem_password_cb *cb, void *u);\r\nint\tPEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,\r\n\t\t       void *x,const EVP_CIPHER *enc,unsigned char *kstr,\r\n\t\t       int klen,pem_password_cb *callback, void *u);\r\nSTACK_OF(X509_INFO) *\tPEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,\r\n\tpem_password_cb *cb, void *u);\r\n\r\nint\tPEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,\r\n\t\tEVP_MD *md_type, unsigned char **ek, int *ekl,\r\n\t\tunsigned char *iv, EVP_PKEY **pubk, int npubk);\r\nvoid\tPEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,\r\n\t\tunsigned char *in, int inl);\r\nint\tPEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl,\r\n\t\tunsigned char *out, int *outl, EVP_PKEY *priv);\r\n\r\nvoid    PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);\r\nvoid    PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);\r\nint\tPEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,\r\n\t\tunsigned int *siglen, EVP_PKEY *pkey);\r\n\r\nint\tPEM_def_callback(char *buf, int num, int w, void *key);\r\nvoid\tPEM_proc_type(char *buf, int type);\r\nvoid\tPEM_dek_info(char *buf, const char *type, int len, char *str);\r\n\r\n\r\n#include <openssl/symhacks.h>\r\n\r\nDECLARE_PEM_rw(X509, X509)\r\n\r\nDECLARE_PEM_rw(X509_AUX, X509)\r\n\r\nDECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR)\r\n\r\nDECLARE_PEM_rw(X509_REQ, X509_REQ)\r\nDECLARE_PEM_write(X509_REQ_NEW, X509_REQ)\r\n\r\nDECLARE_PEM_rw(X509_CRL, X509_CRL)\r\n\r\nDECLARE_PEM_rw(PKCS7, PKCS7)\r\n\r\nDECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)\r\n\r\nDECLARE_PEM_rw(PKCS8, X509_SIG)\r\n\r\nDECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)\r\n\r\n#ifndef OPENSSL_NO_RSA\r\n\r\nDECLARE_PEM_rw_cb(RSAPrivateKey, RSA)\r\n\r\nDECLARE_PEM_rw_const(RSAPublicKey, RSA)\r\nDECLARE_PEM_rw(RSA_PUBKEY, RSA)\r\n\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DSA\r\n\r\nDECLARE_PEM_rw_cb(DSAPrivateKey, DSA)\r\n\r\nDECLARE_PEM_rw(DSA_PUBKEY, DSA)\r\n\r\nDECLARE_PEM_rw_const(DSAparams, DSA)\r\n\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_EC\r\nDECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)\r\nDECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)\r\nDECLARE_PEM_rw(EC_PUBKEY, EC_KEY)\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DH\r\n\r\nDECLARE_PEM_rw_const(DHparams, DH)\r\n\r\n#endif\r\n\r\nDECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)\r\n\r\nDECLARE_PEM_rw(PUBKEY, EVP_PKEY)\r\n\r\nint PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,\r\n\t\t\t\t  char *kstr, int klen,\r\n\t\t\t\t  pem_password_cb *cb, void *u);\r\nint PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,\r\n                                  char *, int, pem_password_cb *, void *);\r\nint i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,\r\n\t\t\t\t  char *kstr, int klen,\r\n\t\t\t\t  pem_password_cb *cb, void *u);\r\nint i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,\r\n\t\t\t\t  char *kstr, int klen,\r\n\t\t\t\t  pem_password_cb *cb, void *u);\r\nEVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);\r\n\r\nint i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\r\n\t\t\t\t  char *kstr, int klen,\r\n\t\t\t\t  pem_password_cb *cb, void *u);\r\nint i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,\r\n\t\t\t\t  char *kstr, int klen,\r\n\t\t\t\t  pem_password_cb *cb, void *u);\r\nint PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,\r\n\t\t\t\t  char *kstr, int klen,\r\n\t\t\t\t  pem_password_cb *cb, void *u);\r\n\r\nEVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);\r\n\r\nint PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,\r\n\t\t\t      char *kstr,int klen, pem_password_cb *cd, void *u);\r\n\r\nEVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);\r\nint PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);\r\n\r\n\r\nEVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);\r\nEVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);\r\nEVP_PKEY *b2i_PrivateKey_bio(BIO *in);\r\nEVP_PKEY *b2i_PublicKey_bio(BIO *in);\r\nint i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);\r\nint i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);\r\n#ifndef OPENSSL_NO_RC4\r\nEVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);\r\nint i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,\r\n\t\tpem_password_cb *cb, void *u);\r\n#endif\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_PEM_strings(void);\r\n\r\n/* Error codes for the PEM functions. */\r\n\r\n/* Function codes. */\r\n#define PEM_F_B2I_DSS\t\t\t\t\t 127\r\n#define PEM_F_B2I_PVK_BIO\t\t\t\t 128\r\n#define PEM_F_B2I_RSA\t\t\t\t\t 129\r\n#define PEM_F_CHECK_BITLEN_DSA\t\t\t\t 130\r\n#define PEM_F_CHECK_BITLEN_RSA\t\t\t\t 131\r\n#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO\t\t\t 120\r\n#define PEM_F_D2I_PKCS8PRIVATEKEY_FP\t\t\t 121\r\n#define PEM_F_DO_B2I\t\t\t\t\t 132\r\n#define PEM_F_DO_B2I_BIO\t\t\t\t 133\r\n#define PEM_F_DO_BLOB_HEADER\t\t\t\t 134\r\n#define PEM_F_DO_PK8PKEY\t\t\t\t 126\r\n#define PEM_F_DO_PK8PKEY_FP\t\t\t\t 125\r\n#define PEM_F_DO_PVK_BODY\t\t\t\t 135\r\n#define PEM_F_DO_PVK_HEADER\t\t\t\t 136\r\n#define PEM_F_I2B_PVK\t\t\t\t\t 137\r\n#define PEM_F_I2B_PVK_BIO\t\t\t\t 138\r\n#define PEM_F_LOAD_IV\t\t\t\t\t 101\r\n#define PEM_F_PEM_ASN1_READ\t\t\t\t 102\r\n#define PEM_F_PEM_ASN1_READ_BIO\t\t\t\t 103\r\n#define PEM_F_PEM_ASN1_WRITE\t\t\t\t 104\r\n#define PEM_F_PEM_ASN1_WRITE_BIO\t\t\t 105\r\n#define PEM_F_PEM_DEF_CALLBACK\t\t\t\t 100\r\n#define PEM_F_PEM_DO_HEADER\t\t\t\t 106\r\n#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY\t\t 118\r\n#define PEM_F_PEM_GET_EVP_CIPHER_INFO\t\t\t 107\r\n#define PEM_F_PEM_PK8PKEY\t\t\t\t 119\r\n#define PEM_F_PEM_READ\t\t\t\t\t 108\r\n#define PEM_F_PEM_READ_BIO\t\t\t\t 109\r\n#define PEM_F_PEM_READ_BIO_PARAMETERS\t\t\t 140\r\n#define PEM_F_PEM_READ_BIO_PRIVATEKEY\t\t\t 123\r\n#define PEM_F_PEM_READ_PRIVATEKEY\t\t\t 124\r\n#define PEM_F_PEM_SEALFINAL\t\t\t\t 110\r\n#define PEM_F_PEM_SEALINIT\t\t\t\t 111\r\n#define PEM_F_PEM_SIGNFINAL\t\t\t\t 112\r\n#define PEM_F_PEM_WRITE\t\t\t\t\t 113\r\n#define PEM_F_PEM_WRITE_BIO\t\t\t\t 114\r\n#define PEM_F_PEM_WRITE_PRIVATEKEY\t\t\t 139\r\n#define PEM_F_PEM_X509_INFO_READ\t\t\t 115\r\n#define PEM_F_PEM_X509_INFO_READ_BIO\t\t\t 116\r\n#define PEM_F_PEM_X509_INFO_WRITE_BIO\t\t\t 117\r\n\r\n/* Reason codes. */\r\n#define PEM_R_BAD_BASE64_DECODE\t\t\t\t 100\r\n#define PEM_R_BAD_DECRYPT\t\t\t\t 101\r\n#define PEM_R_BAD_END_LINE\t\t\t\t 102\r\n#define PEM_R_BAD_IV_CHARS\t\t\t\t 103\r\n#define PEM_R_BAD_MAGIC_NUMBER\t\t\t\t 116\r\n#define PEM_R_BAD_PASSWORD_READ\t\t\t\t 104\r\n#define PEM_R_BAD_VERSION_NUMBER\t\t\t 117\r\n#define PEM_R_BIO_WRITE_FAILURE\t\t\t\t 118\r\n#define PEM_R_CIPHER_IS_NULL\t\t\t\t 127\r\n#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY\t\t 115\r\n#define PEM_R_EXPECTING_PRIVATE_KEY_BLOB\t\t 119\r\n#define PEM_R_EXPECTING_PUBLIC_KEY_BLOB\t\t\t 120\r\n#define PEM_R_INCONSISTENT_HEADER\t\t\t 121\r\n#define PEM_R_KEYBLOB_HEADER_PARSE_ERROR\t\t 122\r\n#define PEM_R_KEYBLOB_TOO_SHORT\t\t\t\t 123\r\n#define PEM_R_NOT_DEK_INFO\t\t\t\t 105\r\n#define PEM_R_NOT_ENCRYPTED\t\t\t\t 106\r\n#define PEM_R_NOT_PROC_TYPE\t\t\t\t 107\r\n#define PEM_R_NO_START_LINE\t\t\t\t 108\r\n#define PEM_R_PROBLEMS_GETTING_PASSWORD\t\t\t 109\r\n#define PEM_R_PUBLIC_KEY_NO_RSA\t\t\t\t 110\r\n#define PEM_R_PVK_DATA_TOO_SHORT\t\t\t 124\r\n#define PEM_R_PVK_TOO_SHORT\t\t\t\t 125\r\n#define PEM_R_READ_KEY\t\t\t\t\t 111\r\n#define PEM_R_SHORT_HEADER\t\t\t\t 112\r\n#define PEM_R_UNSUPPORTED_CIPHER\t\t\t 113\r\n#define PEM_R_UNSUPPORTED_ENCRYPTION\t\t\t 114\r\n#define PEM_R_UNSUPPORTED_KEY_COMPONENTS\t\t 126\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/pem2.h",
    "content": "/* ====================================================================\r\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n/*\r\n * This header only exists to break a circular dependency between pem and err\r\n * Ben 30 Jan 1999.\r\n */\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifndef HEADER_PEM_H\r\nvoid ERR_load_PEM_strings(void);\r\n#endif\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/pkcs12.h",
    "content": "/* pkcs12.h */\r\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\r\n * project 1999.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_PKCS12_H\r\n#define HEADER_PKCS12_H\r\n\r\n#include <openssl/bio.h>\r\n#include <openssl/x509.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define PKCS12_KEY_ID\t1\r\n#define PKCS12_IV_ID\t2\r\n#define PKCS12_MAC_ID\t3\r\n\r\n/* Default iteration count */\r\n#ifndef PKCS12_DEFAULT_ITER\r\n#define PKCS12_DEFAULT_ITER\tPKCS5_DEFAULT_ITER\r\n#endif\r\n\r\n#define PKCS12_MAC_KEY_LENGTH 20\r\n\r\n#define PKCS12_SALT_LEN\t8\r\n\r\n/* Uncomment out next line for unicode password and names, otherwise ASCII */\r\n\r\n/*#define PBE_UNICODE*/\r\n\r\n#ifdef PBE_UNICODE\r\n#define PKCS12_key_gen PKCS12_key_gen_uni\r\n#define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni\r\n#else\r\n#define PKCS12_key_gen PKCS12_key_gen_asc\r\n#define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc\r\n#endif\r\n\r\n/* MS key usage constants */\r\n\r\n#define KEY_EX\t0x10\r\n#define KEY_SIG 0x80\r\n\r\ntypedef struct {\r\nX509_SIG *dinfo;\r\nASN1_OCTET_STRING *salt;\r\nASN1_INTEGER *iter;\t/* defaults to 1 */\r\n} PKCS12_MAC_DATA;\r\n\r\ntypedef struct {\r\nASN1_INTEGER *version;\r\nPKCS12_MAC_DATA *mac;\r\nPKCS7 *authsafes;\r\n} PKCS12;\r\n\r\ntypedef struct {\r\nASN1_OBJECT *type;\r\nunion {\r\n\tstruct pkcs12_bag_st *bag; /* secret, crl and certbag */\r\n\tstruct pkcs8_priv_key_info_st\t*keybag; /* keybag */\r\n\tX509_SIG *shkeybag; /* shrouded key bag */\r\n\tSTACK_OF(PKCS12_SAFEBAG) *safes;\r\n\tASN1_TYPE *other;\r\n}value;\r\nSTACK_OF(X509_ATTRIBUTE) *attrib;\r\n} PKCS12_SAFEBAG;\r\n\r\nDECLARE_STACK_OF(PKCS12_SAFEBAG)\r\nDECLARE_ASN1_SET_OF(PKCS12_SAFEBAG)\r\nDECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)\r\n\r\ntypedef struct pkcs12_bag_st {\r\nASN1_OBJECT *type;\r\nunion {\r\n\tASN1_OCTET_STRING *x509cert;\r\n\tASN1_OCTET_STRING *x509crl;\r\n\tASN1_OCTET_STRING *octet;\r\n\tASN1_IA5STRING *sdsicert;\r\n\tASN1_TYPE *other; /* Secret or other bag */\r\n}value;\r\n} PKCS12_BAGS;\r\n\r\n#define PKCS12_ERROR\t0\r\n#define PKCS12_OK\t1\r\n\r\n/* Compatibility macros */\r\n\r\n#define M_PKCS12_x5092certbag PKCS12_x5092certbag\r\n#define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag\r\n\r\n#define M_PKCS12_certbag2x509 PKCS12_certbag2x509\r\n#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl \r\n\r\n#define M_PKCS12_unpack_p7data PKCS12_unpack_p7data\r\n#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes\r\n#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes\r\n#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata\r\n\r\n#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey\r\n#define M_PKCS8_decrypt PKCS8_decrypt\r\n\r\n#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type)\r\n#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type)\r\n#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type\r\n\r\n#define PKCS12_get_attr(bag, attr_nid) \\\r\n\t\t\t PKCS12_get_attr_gen(bag->attrib, attr_nid)\r\n\r\n#define PKCS8_get_attr(p8, attr_nid) \\\r\n\t\tPKCS12_get_attr_gen(p8->attributes, attr_nid)\r\n\r\n#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)\r\n\r\n\r\nPKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509);\r\nPKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl);\r\nX509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag);\r\nX509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag);\r\n\r\nPKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1,\r\n\t     int nid2);\r\nPKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8);\r\nPKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen);\r\nPKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass,\r\n\t\t\t\t\t\t\t\tint passlen);\r\nX509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, \r\n\t\t\tconst char *pass, int passlen,\r\n\t\t\tunsigned char *salt, int saltlen, int iter,\r\n\t\t\tPKCS8_PRIV_KEY_INFO *p8);\r\nPKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass,\r\n\t\t\t\t     int passlen, unsigned char *salt,\r\n\t\t\t\t     int saltlen, int iter,\r\n\t\t\t\t     PKCS8_PRIV_KEY_INFO *p8);\r\nPKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);\r\nSTACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);\r\nPKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,\r\n\t\t\t     unsigned char *salt, int saltlen, int iter,\r\n\t\t\t     STACK_OF(PKCS12_SAFEBAG) *bags);\r\nSTACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen);\r\n\r\nint PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes);\r\nSTACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12);\r\n\r\nint PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen);\r\nint PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,\r\n\t\t\t\tint namelen);\r\nint PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name,\r\n\t\t\t\tint namelen);\r\nint PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name,\r\n\t\t\t\tint namelen);\r\nint PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage);\r\nASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid);\r\nchar *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);\r\nunsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,\r\n\t\t\t\tint passlen, unsigned char *in, int inlen,\r\n\t\t\t\tunsigned char **data, int *datalen, int en_de);\r\nvoid * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,\r\n\t     const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf);\r\nASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it,\r\n\t\t\t\t       const char *pass, int passlen,\r\n\t\t\t\t       void *obj, int zbuf);\r\nPKCS12 *PKCS12_init(int mode);\r\nint PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,\r\n\t\t       int saltlen, int id, int iter, int n,\r\n\t\t       unsigned char *out, const EVP_MD *md_type);\r\nint PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type);\r\nint PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\r\n\t\t\t ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type,\r\n\t\t\t int en_de);\r\nint PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,\r\n\t\t\t unsigned char *mac, unsigned int *maclen);\r\nint PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);\r\nint PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,\r\n\t\t   unsigned char *salt, int saltlen, int iter,\r\n\t\t   const EVP_MD *md_type);\r\nint PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,\r\n\t\t\t\t\t int saltlen, const EVP_MD *md_type);\r\nunsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen);\r\nchar *OPENSSL_uni2asc(unsigned char *uni, int unilen);\r\n\r\nDECLARE_ASN1_FUNCTIONS(PKCS12)\r\nDECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA)\r\nDECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG)\r\nDECLARE_ASN1_FUNCTIONS(PKCS12_BAGS)\r\n\r\nDECLARE_ASN1_ITEM(PKCS12_SAFEBAGS)\r\nDECLARE_ASN1_ITEM(PKCS12_AUTHSAFES)\r\n\r\nvoid PKCS12_PBE_add(void);\r\nint PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,\r\n\t\t STACK_OF(X509) **ca);\r\nPKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,\r\n\t\t\t STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,\r\n\t\t\t\t\t\t int mac_iter, int keytype);\r\n\r\nPKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);\r\nPKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key,\r\n\t\t\t\t\t\tint key_usage, int iter,\r\n\t\t\t\t\t\tint key_nid, char *pass);\r\nint PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,\r\n\t\t\t\t\tint safe_nid, int iter, char *pass);\r\nPKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);\r\n\r\nint i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);\r\nint i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);\r\nPKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);\r\nPKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);\r\nint PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_PKCS12_strings(void);\r\n\r\n/* Error codes for the PKCS12 functions. */\r\n\r\n/* Function codes. */\r\n#define PKCS12_F_PARSE_BAG\t\t\t\t 129\r\n#define PKCS12_F_PARSE_BAGS\t\t\t\t 103\r\n#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME\t\t 100\r\n#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC\t\t 127\r\n#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI\t\t 102\r\n#define PKCS12_F_PKCS12_ADD_LOCALKEYID\t\t\t 104\r\n#define PKCS12_F_PKCS12_CREATE\t\t\t\t 105\r\n#define PKCS12_F_PKCS12_GEN_MAC\t\t\t\t 107\r\n#define PKCS12_F_PKCS12_INIT\t\t\t\t 109\r\n#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I\t\t 106\r\n#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT\t\t 108\r\n#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG\t\t 117\r\n#define PKCS12_F_PKCS12_KEY_GEN_ASC\t\t\t 110\r\n#define PKCS12_F_PKCS12_KEY_GEN_UNI\t\t\t 111\r\n#define PKCS12_F_PKCS12_MAKE_KEYBAG\t\t\t 112\r\n#define PKCS12_F_PKCS12_MAKE_SHKEYBAG\t\t\t 113\r\n#define PKCS12_F_PKCS12_NEWPASS\t\t\t\t 128\r\n#define PKCS12_F_PKCS12_PACK_P7DATA\t\t\t 114\r\n#define PKCS12_F_PKCS12_PACK_P7ENCDATA\t\t\t 115\r\n#define PKCS12_F_PKCS12_PARSE\t\t\t\t 118\r\n#define PKCS12_F_PKCS12_PBE_CRYPT\t\t\t 119\r\n#define PKCS12_F_PKCS12_PBE_KEYIVGEN\t\t\t 120\r\n#define PKCS12_F_PKCS12_SETUP_MAC\t\t\t 122\r\n#define PKCS12_F_PKCS12_SET_MAC\t\t\t\t 123\r\n#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES\t\t 130\r\n#define PKCS12_F_PKCS12_UNPACK_P7DATA\t\t\t 131\r\n#define PKCS12_F_PKCS12_VERIFY_MAC\t\t\t 126\r\n#define PKCS12_F_PKCS8_ADD_KEYUSAGE\t\t\t 124\r\n#define PKCS12_F_PKCS8_ENCRYPT\t\t\t\t 125\r\n\r\n/* Reason codes. */\r\n#define PKCS12_R_CANT_PACK_STRUCTURE\t\t\t 100\r\n#define PKCS12_R_CONTENT_TYPE_NOT_DATA\t\t\t 121\r\n#define PKCS12_R_DECODE_ERROR\t\t\t\t 101\r\n#define PKCS12_R_ENCODE_ERROR\t\t\t\t 102\r\n#define PKCS12_R_ENCRYPT_ERROR\t\t\t\t 103\r\n#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE\t 120\r\n#define PKCS12_R_INVALID_NULL_ARGUMENT\t\t\t 104\r\n#define PKCS12_R_INVALID_NULL_PKCS12_POINTER\t\t 105\r\n#define PKCS12_R_IV_GEN_ERROR\t\t\t\t 106\r\n#define PKCS12_R_KEY_GEN_ERROR\t\t\t\t 107\r\n#define PKCS12_R_MAC_ABSENT\t\t\t\t 108\r\n#define PKCS12_R_MAC_GENERATION_ERROR\t\t\t 109\r\n#define PKCS12_R_MAC_SETUP_ERROR\t\t\t 110\r\n#define PKCS12_R_MAC_STRING_SET_ERROR\t\t\t 111\r\n#define PKCS12_R_MAC_VERIFY_ERROR\t\t\t 112\r\n#define PKCS12_R_MAC_VERIFY_FAILURE\t\t\t 113\r\n#define PKCS12_R_PARSE_ERROR\t\t\t\t 114\r\n#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR\t\t 115\r\n#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR\t\t 116\r\n#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR\t\t\t 117\r\n#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM\t\t 118\r\n#define PKCS12_R_UNSUPPORTED_PKCS12_MODE\t\t 119\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/pkcs7.h",
    "content": "/* crypto/pkcs7/pkcs7.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_PKCS7_H\r\n#define HEADER_PKCS7_H\r\n\r\n#include <openssl/asn1.h>\r\n#include <openssl/bio.h>\r\n#include <openssl/e_os2.h>\r\n\r\n#include <openssl/symhacks.h>\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_SYS_WIN32\r\n/* Under Win32 thes are defined in wincrypt.h */\r\n#undef PKCS7_ISSUER_AND_SERIAL\r\n#undef PKCS7_SIGNER_INFO\r\n#endif\r\n\r\n/*\r\nEncryption_ID\t\tDES-CBC\r\nDigest_ID\t\tMD5\r\nDigest_Encryption_ID\trsaEncryption\r\nKey_Encryption_ID\trsaEncryption\r\n*/\r\n\r\ntypedef struct pkcs7_issuer_and_serial_st\r\n\t{\r\n\tX509_NAME *issuer;\r\n\tASN1_INTEGER *serial;\r\n\t} PKCS7_ISSUER_AND_SERIAL;\r\n\r\ntypedef struct pkcs7_signer_info_st\r\n\t{\r\n\tASN1_INTEGER \t\t\t*version;\t/* version 1 */\r\n\tPKCS7_ISSUER_AND_SERIAL\t\t*issuer_and_serial;\r\n\tX509_ALGOR\t\t\t*digest_alg;\r\n\tSTACK_OF(X509_ATTRIBUTE)\t*auth_attr;\t/* [ 0 ] */\r\n\tX509_ALGOR\t\t\t*digest_enc_alg;\r\n\tASN1_OCTET_STRING\t\t*enc_digest;\r\n\tSTACK_OF(X509_ATTRIBUTE)\t*unauth_attr;\t/* [ 1 ] */\r\n\r\n\t/* The private key to sign with */\r\n\tEVP_PKEY\t\t\t*pkey;\r\n\t} PKCS7_SIGNER_INFO;\r\n\r\nDECLARE_STACK_OF(PKCS7_SIGNER_INFO)\r\nDECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)\r\n\r\ntypedef struct pkcs7_recip_info_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\r\n\tPKCS7_ISSUER_AND_SERIAL\t\t*issuer_and_serial;\r\n\tX509_ALGOR\t\t\t*key_enc_algor;\r\n\tASN1_OCTET_STRING\t\t*enc_key;\r\n\tX509\t\t\t\t*cert; /* get the pub-key from this */\r\n\t} PKCS7_RECIP_INFO;\r\n\r\nDECLARE_STACK_OF(PKCS7_RECIP_INFO)\r\nDECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)\r\n\r\ntypedef struct pkcs7_signed_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*version;\t/* version 1 */\r\n\tSTACK_OF(X509_ALGOR)\t\t*md_algs;\t/* md used */\r\n\tSTACK_OF(X509)\t\t\t*cert;\t\t/* [ 0 ] */\r\n\tSTACK_OF(X509_CRL)\t\t*crl;\t\t/* [ 1 ] */\r\n\tSTACK_OF(PKCS7_SIGNER_INFO)\t*signer_info;\r\n\r\n\tstruct pkcs7_st\t\t\t*contents;\r\n\t} PKCS7_SIGNED;\r\n/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE.\r\n * How about merging the two */\r\n\r\ntypedef struct pkcs7_enc_content_st\r\n\t{\r\n\tASN1_OBJECT\t\t\t*content_type;\r\n\tX509_ALGOR\t\t\t*algorithm;\r\n\tASN1_OCTET_STRING\t\t*enc_data;\t/* [ 0 ] */\r\n\tconst EVP_CIPHER\t\t*cipher;\r\n\t} PKCS7_ENC_CONTENT;\r\n\r\ntypedef struct pkcs7_enveloped_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\r\n\tSTACK_OF(PKCS7_RECIP_INFO)\t*recipientinfo;\r\n\tPKCS7_ENC_CONTENT\t\t*enc_data;\r\n\t} PKCS7_ENVELOPE;\r\n\r\ntypedef struct pkcs7_signedandenveloped_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*version;\t/* version 1 */\r\n\tSTACK_OF(X509_ALGOR)\t\t*md_algs;\t/* md used */\r\n\tSTACK_OF(X509)\t\t\t*cert;\t\t/* [ 0 ] */\r\n\tSTACK_OF(X509_CRL)\t\t*crl;\t\t/* [ 1 ] */\r\n\tSTACK_OF(PKCS7_SIGNER_INFO)\t*signer_info;\r\n\r\n\tPKCS7_ENC_CONTENT\t\t*enc_data;\r\n\tSTACK_OF(PKCS7_RECIP_INFO)\t*recipientinfo;\r\n\t} PKCS7_SIGN_ENVELOPE;\r\n\r\ntypedef struct pkcs7_digest_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\r\n\tX509_ALGOR\t\t\t*md;\t\t/* md used */\r\n\tstruct pkcs7_st \t\t*contents;\r\n\tASN1_OCTET_STRING\t\t*digest;\r\n\t} PKCS7_DIGEST;\r\n\r\ntypedef struct pkcs7_encrypted_st\r\n\t{\r\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\r\n\tPKCS7_ENC_CONTENT\t\t*enc_data;\r\n\t} PKCS7_ENCRYPT;\r\n\r\ntypedef struct pkcs7_st\r\n\t{\r\n\t/* The following is non NULL if it contains ASN1 encoding of\r\n\t * this structure */\r\n\tunsigned char *asn1;\r\n\tlong length;\r\n\r\n#define PKCS7_S_HEADER\t0\r\n#define PKCS7_S_BODY\t1\r\n#define PKCS7_S_TAIL\t2\r\n\tint state; /* used during processing */\r\n\r\n\tint detached;\r\n\r\n\tASN1_OBJECT *type;\r\n\t/* content as defined by the type */\r\n\t/* all encryption/message digests are applied to the 'contents',\r\n\t * leaving out the 'type' field. */\r\n\tunion\t{\r\n\t\tchar *ptr;\r\n\r\n\t\t/* NID_pkcs7_data */\r\n\t\tASN1_OCTET_STRING *data;\r\n\r\n\t\t/* NID_pkcs7_signed */\r\n\t\tPKCS7_SIGNED *sign;\r\n\r\n\t\t/* NID_pkcs7_enveloped */\r\n\t\tPKCS7_ENVELOPE *enveloped;\r\n\r\n\t\t/* NID_pkcs7_signedAndEnveloped */\r\n\t\tPKCS7_SIGN_ENVELOPE *signed_and_enveloped;\r\n\r\n\t\t/* NID_pkcs7_digest */\r\n\t\tPKCS7_DIGEST *digest;\r\n\r\n\t\t/* NID_pkcs7_encrypted */\r\n\t\tPKCS7_ENCRYPT *encrypted;\r\n\r\n\t\t/* Anything else */\r\n\t\tASN1_TYPE *other;\r\n\t\t} d;\r\n\t} PKCS7;\r\n\r\nDECLARE_STACK_OF(PKCS7)\r\nDECLARE_ASN1_SET_OF(PKCS7)\r\nDECLARE_PKCS12_STACK_OF(PKCS7)\r\n\r\n#define PKCS7_OP_SET_DETACHED_SIGNATURE\t1\r\n#define PKCS7_OP_GET_DETACHED_SIGNATURE\t2\r\n\r\n#define PKCS7_get_signed_attributes(si)\t((si)->auth_attr)\r\n#define PKCS7_get_attributes(si)\t((si)->unauth_attr)\r\n\r\n#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)\r\n#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)\r\n#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)\r\n#define PKCS7_type_is_signedAndEnveloped(a) \\\r\n\t\t(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)\r\n#define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)\r\n#define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)\r\n#define PKCS7_type_is_encrypted(a) \\\r\n\t\t(OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)\r\n\r\n#define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)\r\n\r\n#define PKCS7_set_detached(p,v) \\\r\n\t\tPKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)\r\n#define PKCS7_get_detached(p) \\\r\n\t\tPKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)\r\n\r\n#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))\r\n\r\n/* S/MIME related flags */\r\n\r\n#define PKCS7_TEXT\t\t0x1\r\n#define PKCS7_NOCERTS\t\t0x2\r\n#define PKCS7_NOSIGS\t\t0x4\r\n#define PKCS7_NOCHAIN\t\t0x8\r\n#define PKCS7_NOINTERN\t\t0x10\r\n#define PKCS7_NOVERIFY\t\t0x20\r\n#define PKCS7_DETACHED\t\t0x40\r\n#define PKCS7_BINARY\t\t0x80\r\n#define PKCS7_NOATTR\t\t0x100\r\n#define\tPKCS7_NOSMIMECAP\t0x200\r\n#define PKCS7_NOOLDMIMETYPE\t0x400\r\n#define PKCS7_CRLFEOL\t\t0x800\r\n#define PKCS7_STREAM\t\t0x1000\r\n#define PKCS7_NOCRL\t\t0x2000\r\n#define PKCS7_PARTIAL\t\t0x4000\r\n#define PKCS7_REUSE_DIGEST\t0x8000\r\n\r\n/* Flags: for compatibility with older code */\r\n\r\n#define SMIME_TEXT\tPKCS7_TEXT\r\n#define SMIME_NOCERTS\tPKCS7_NOCERTS\r\n#define SMIME_NOSIGS\tPKCS7_NOSIGS\r\n#define SMIME_NOCHAIN\tPKCS7_NOCHAIN\r\n#define SMIME_NOINTERN\tPKCS7_NOINTERN\r\n#define SMIME_NOVERIFY\tPKCS7_NOVERIFY\r\n#define SMIME_DETACHED\tPKCS7_DETACHED\r\n#define SMIME_BINARY\tPKCS7_BINARY\r\n#define SMIME_NOATTR\tPKCS7_NOATTR\r\n\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)\r\n\r\nint PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,\r\n\tunsigned char *md,unsigned int *len);\r\n#ifndef OPENSSL_NO_FP_API\r\nPKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);\r\nint i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);\r\n#endif\r\nPKCS7 *PKCS7_dup(PKCS7 *p7);\r\nPKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);\r\nint i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);\r\nint i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);\r\nint PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);\r\n\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)\r\nDECLARE_ASN1_FUNCTIONS(PKCS7)\r\n\r\nDECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)\r\nDECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)\r\n\r\nDECLARE_ASN1_NDEF_FUNCTION(PKCS7)\r\nDECLARE_ASN1_PRINT_FUNCTION(PKCS7)\r\n\r\nlong PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);\r\n\r\nint PKCS7_set_type(PKCS7 *p7, int type);\r\nint PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);\r\nint PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);\r\nint PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,\r\n\tconst EVP_MD *dgst);\r\nint PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si);\r\nint PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);\r\nint PKCS7_add_certificate(PKCS7 *p7, X509 *x509);\r\nint PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);\r\nint PKCS7_content_new(PKCS7 *p7, int nid);\r\nint PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,\r\n\tBIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); \r\nint PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,\r\n\t\t\t\t\t\t\t\tX509 *x509);\r\n\r\nBIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);\r\nint PKCS7_dataFinal(PKCS7 *p7, BIO *bio);\r\nBIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);\r\n\r\n\r\nPKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,\r\n\tEVP_PKEY *pkey, const EVP_MD *dgst);\r\nX509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);\r\nint PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);\r\nSTACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);\r\n\r\nPKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);\r\nvoid PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,\r\n\t\t\t\t\tX509_ALGOR **pdig, X509_ALGOR **psig);\r\nvoid PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc);\r\nint PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);\r\nint PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);\r\nint PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);\r\nint PKCS7_stream(unsigned char ***boundary, PKCS7 *p7);\r\n\r\nPKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);\r\nASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);\r\nint PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,\r\n\tvoid *data);\r\nint PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,\r\n\tvoid *value);\r\nASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);\r\nASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);\r\nint PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,\r\n\t\t\t\tSTACK_OF(X509_ATTRIBUTE) *sk);\r\nint PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk);\r\n\r\n\r\nPKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\r\n\t\t\t\t\t\t\tBIO *data, int flags);\r\n\r\nPKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7,\r\n\t\t\tX509 *signcert, EVP_PKEY *pkey, const EVP_MD *md,\r\n\t\t\tint flags);\r\n\r\nint PKCS7_final(PKCS7 *p7, BIO *data, int flags);\r\nint PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,\r\n\t\t\t\t\tBIO *indata, BIO *out, int flags);\r\nSTACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);\r\nPKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,\r\n\t\t\t\t\t\t\t\tint flags);\r\nint PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);\r\n\r\nint PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,\r\n\t\t\t      STACK_OF(X509_ALGOR) *cap);\r\nSTACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);\r\nint PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);\r\n\r\nint PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid);\r\nint PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t);\r\nint PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,\r\n\t\t\t\tconst unsigned char *md, int mdlen);\r\n\r\nint SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);\r\nPKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);\r\n\r\nBIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_PKCS7_strings(void);\r\n\r\n/* Error codes for the PKCS7 functions. */\r\n\r\n/* Function codes. */\r\n#define PKCS7_F_B64_READ_PKCS7\t\t\t\t 120\r\n#define PKCS7_F_B64_WRITE_PKCS7\t\t\t\t 121\r\n#define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB\t\t\t 136\r\n#define PKCS7_F_I2D_PKCS7_BIO_STREAM\t\t\t 140\r\n#define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME\t\t 135\r\n#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP\t\t 118\r\n#define PKCS7_F_PKCS7_ADD_CERTIFICATE\t\t\t 100\r\n#define PKCS7_F_PKCS7_ADD_CRL\t\t\t\t 101\r\n#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO\t\t 102\r\n#define PKCS7_F_PKCS7_ADD_SIGNATURE\t\t\t 131\r\n#define PKCS7_F_PKCS7_ADD_SIGNER\t\t\t 103\r\n#define PKCS7_F_PKCS7_BIO_ADD_DIGEST\t\t\t 125\r\n#define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST\t\t 138\r\n#define PKCS7_F_PKCS7_CTRL\t\t\t\t 104\r\n#define PKCS7_F_PKCS7_DATADECODE\t\t\t 112\r\n#define PKCS7_F_PKCS7_DATAFINAL\t\t\t\t 128\r\n#define PKCS7_F_PKCS7_DATAINIT\t\t\t\t 105\r\n#define PKCS7_F_PKCS7_DATASIGN\t\t\t\t 106\r\n#define PKCS7_F_PKCS7_DATAVERIFY\t\t\t 107\r\n#define PKCS7_F_PKCS7_DECRYPT\t\t\t\t 114\r\n#define PKCS7_F_PKCS7_DECRYPT_RINFO\t\t\t 133\r\n#define PKCS7_F_PKCS7_ENCODE_RINFO\t\t\t 132\r\n#define PKCS7_F_PKCS7_ENCRYPT\t\t\t\t 115\r\n#define PKCS7_F_PKCS7_FINAL\t\t\t\t 134\r\n#define PKCS7_F_PKCS7_FIND_DIGEST\t\t\t 127\r\n#define PKCS7_F_PKCS7_GET0_SIGNERS\t\t\t 124\r\n#define PKCS7_F_PKCS7_RECIP_INFO_SET\t\t\t 130\r\n#define PKCS7_F_PKCS7_SET_CIPHER\t\t\t 108\r\n#define PKCS7_F_PKCS7_SET_CONTENT\t\t\t 109\r\n#define PKCS7_F_PKCS7_SET_DIGEST\t\t\t 126\r\n#define PKCS7_F_PKCS7_SET_TYPE\t\t\t\t 110\r\n#define PKCS7_F_PKCS7_SIGN\t\t\t\t 116\r\n#define PKCS7_F_PKCS7_SIGNATUREVERIFY\t\t\t 113\r\n#define PKCS7_F_PKCS7_SIGNER_INFO_SET\t\t\t 129\r\n#define PKCS7_F_PKCS7_SIGNER_INFO_SIGN\t\t\t 139\r\n#define PKCS7_F_PKCS7_SIGN_ADD_SIGNER\t\t\t 137\r\n#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP\t\t\t 119\r\n#define PKCS7_F_PKCS7_VERIFY\t\t\t\t 117\r\n#define PKCS7_F_SMIME_READ_PKCS7\t\t\t 122\r\n#define PKCS7_F_SMIME_TEXT\t\t\t\t 123\r\n\r\n/* Reason codes. */\r\n#define PKCS7_R_CERTIFICATE_VERIFY_ERROR\t\t 117\r\n#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER\t\t 144\r\n#define PKCS7_R_CIPHER_NOT_INITIALIZED\t\t\t 116\r\n#define PKCS7_R_CONTENT_AND_DATA_PRESENT\t\t 118\r\n#define PKCS7_R_CTRL_ERROR\t\t\t\t 152\r\n#define PKCS7_R_DECODE_ERROR\t\t\t\t 130\r\n#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH\t\t 100\r\n#define PKCS7_R_DECRYPT_ERROR\t\t\t\t 119\r\n#define PKCS7_R_DIGEST_FAILURE\t\t\t\t 101\r\n#define PKCS7_R_ENCRYPTION_CTRL_FAILURE\t\t\t 149\r\n#define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150\r\n#define PKCS7_R_ERROR_ADDING_RECIPIENT\t\t\t 120\r\n#define PKCS7_R_ERROR_SETTING_CIPHER\t\t\t 121\r\n#define PKCS7_R_INVALID_MIME_TYPE\t\t\t 131\r\n#define PKCS7_R_INVALID_NULL_POINTER\t\t\t 143\r\n#define PKCS7_R_MIME_NO_CONTENT_TYPE\t\t\t 132\r\n#define PKCS7_R_MIME_PARSE_ERROR\t\t\t 133\r\n#define PKCS7_R_MIME_SIG_PARSE_ERROR\t\t\t 134\r\n#define PKCS7_R_MISSING_CERIPEND_INFO\t\t\t 103\r\n#define PKCS7_R_NO_CONTENT\t\t\t\t 122\r\n#define PKCS7_R_NO_CONTENT_TYPE\t\t\t\t 135\r\n#define PKCS7_R_NO_DEFAULT_DIGEST\t\t\t 151\r\n#define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND\t\t 154\r\n#define PKCS7_R_NO_MULTIPART_BODY_FAILURE\t\t 136\r\n#define PKCS7_R_NO_MULTIPART_BOUNDARY\t\t\t 137\r\n#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE\t 115\r\n#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY\t\t 146\r\n#define PKCS7_R_NO_SIGNATURES_ON_DATA\t\t\t 123\r\n#define PKCS7_R_NO_SIGNERS\t\t\t\t 142\r\n#define PKCS7_R_NO_SIG_CONTENT_TYPE\t\t\t 138\r\n#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE\t 104\r\n#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR\t\t 124\r\n#define PKCS7_R_PKCS7_ADD_SIGNER_ERROR\t\t\t 153\r\n#define PKCS7_R_PKCS7_DATAFINAL\t\t\t\t 126\r\n#define PKCS7_R_PKCS7_DATAFINAL_ERROR\t\t\t 125\r\n#define PKCS7_R_PKCS7_DATASIGN\t\t\t\t 145\r\n#define PKCS7_R_PKCS7_PARSE_ERROR\t\t\t 139\r\n#define PKCS7_R_PKCS7_SIG_PARSE_ERROR\t\t\t 140\r\n#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE\t 127\r\n#define PKCS7_R_SIGNATURE_FAILURE\t\t\t 105\r\n#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND\t\t 128\r\n#define PKCS7_R_SIGNING_CTRL_FAILURE\t\t\t 147\r\n#define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE\t 148\r\n#define PKCS7_R_SIG_INVALID_MIME_TYPE\t\t\t 141\r\n#define PKCS7_R_SMIME_TEXT_ERROR\t\t\t 129\r\n#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE\t\t 106\r\n#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO\t\t\t 107\r\n#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST\t\t 108\r\n#define PKCS7_R_UNKNOWN_DIGEST_TYPE\t\t\t 109\r\n#define PKCS7_R_UNKNOWN_OPERATION\t\t\t 110\r\n#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE\t\t\t 111\r\n#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE\t\t 112\r\n#define PKCS7_R_WRONG_CONTENT_TYPE\t\t\t 113\r\n#define PKCS7_R_WRONG_PKCS7_TYPE\t\t\t 114\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/pqueue.h",
    "content": "/* crypto/pqueue/pqueue.h */\r\n/* \r\n * DTLS implementation written by Nagendra Modadugu\r\n * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  \r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_PQUEUE_H\r\n#define HEADER_PQUEUE_H\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\ntypedef struct _pqueue *pqueue;\r\n\r\ntypedef struct _pitem\r\n\t{\r\n\tunsigned char priority[8]; /* 64-bit value in big-endian encoding */\r\n\tvoid *data;\r\n\tstruct _pitem *next;\r\n\t} pitem;\r\n\r\ntypedef struct _pitem *piterator;\r\n\r\npitem *pitem_new(unsigned char *prio64be, void *data);\r\nvoid   pitem_free(pitem *item);\r\n\r\npqueue pqueue_new(void);\r\nvoid   pqueue_free(pqueue pq);\r\n\r\npitem *pqueue_insert(pqueue pq, pitem *item);\r\npitem *pqueue_peek(pqueue pq);\r\npitem *pqueue_pop(pqueue pq);\r\npitem *pqueue_find(pqueue pq, unsigned char *prio64be);\r\npitem *pqueue_iterator(pqueue pq);\r\npitem *pqueue_next(piterator *iter);\r\n\r\nvoid   pqueue_print(pqueue pq);\r\nint    pqueue_size(pqueue pq);\r\n\r\n#endif /* ! HEADER_PQUEUE_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/rand.h",
    "content": "/* crypto/rand/rand.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_RAND_H\r\n#define HEADER_RAND_H\r\n\r\n#include <stdlib.h>\r\n#include <openssl/ossl_typ.h>\r\n#include <openssl/e_os2.h>\r\n\r\n#if defined(OPENSSL_SYS_WINDOWS)\r\n#include <windows.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#if defined(OPENSSL_FIPS)\r\n#define FIPS_RAND_SIZE_T size_t\r\n#endif\r\n\r\n/* Already defined in ossl_typ.h */\r\n/* typedef struct rand_meth_st RAND_METHOD; */\r\n\r\nstruct rand_meth_st\r\n\t{\r\n\tvoid (*seed)(const void *buf, int num);\r\n\tint (*bytes)(unsigned char *buf, int num);\r\n\tvoid (*cleanup)(void);\r\n\tvoid (*add)(const void *buf, int num, double entropy);\r\n\tint (*pseudorand)(unsigned char *buf, int num);\r\n\tint (*status)(void);\r\n\t};\r\n\r\n#ifdef BN_DEBUG\r\nextern int rand_predictable;\r\n#endif\r\n\r\nint RAND_set_rand_method(const RAND_METHOD *meth);\r\nconst RAND_METHOD *RAND_get_rand_method(void);\r\n#ifndef OPENSSL_NO_ENGINE\r\nint RAND_set_rand_engine(ENGINE *engine);\r\n#endif\r\nRAND_METHOD *RAND_SSLeay(void);\r\nvoid RAND_cleanup(void );\r\nint  RAND_bytes(unsigned char *buf,int num);\r\nint  RAND_pseudo_bytes(unsigned char *buf,int num);\r\nvoid RAND_seed(const void *buf,int num);\r\nvoid RAND_add(const void *buf,int num,double entropy);\r\nint  RAND_load_file(const char *file,long max_bytes);\r\nint  RAND_write_file(const char *file);\r\nconst char *RAND_file_name(char *file,size_t num);\r\nint RAND_status(void);\r\nint RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);\r\nint RAND_egd(const char *path);\r\nint RAND_egd_bytes(const char *path,int bytes);\r\nint RAND_poll(void);\r\n\r\n#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)\r\n\r\nvoid RAND_screen(void);\r\nint RAND_event(UINT, WPARAM, LPARAM);\r\n\r\n#endif\r\n\r\n#ifdef OPENSSL_FIPS\r\nvoid RAND_set_fips_drbg_type(int type, int flags);\r\nint RAND_init_fips(void);\r\n#endif\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_RAND_strings(void);\r\n\r\n/* Error codes for the RAND functions. */\r\n\r\n/* Function codes. */\r\n#define RAND_F_RAND_GET_RAND_METHOD\t\t\t 101\r\n#define RAND_F_RAND_INIT_FIPS\t\t\t\t 102\r\n#define RAND_F_SSLEAY_RAND_BYTES\t\t\t 100\r\n\r\n/* Reason codes. */\r\n#define RAND_R_ERROR_INITIALISING_DRBG\t\t\t 102\r\n#define RAND_R_ERROR_INSTANTIATING_DRBG\t\t\t 103\r\n#define RAND_R_NO_FIPS_RANDOM_METHOD_SET\t\t 101\r\n#define RAND_R_PRNG_NOT_SEEDED\t\t\t\t 100\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/rc2.h",
    "content": "/* crypto/rc2/rc2.h */\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_RC2_H\r\n#define HEADER_RC2_H\r\n\r\n#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */\r\n#ifdef OPENSSL_NO_RC2\r\n#error RC2 is disabled.\r\n#endif\r\n\r\n#define RC2_ENCRYPT\t1\r\n#define RC2_DECRYPT\t0\r\n\r\n#define RC2_BLOCK\t8\r\n#define RC2_KEY_LENGTH\t16\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct rc2_key_st\r\n\t{\r\n\tRC2_INT data[64];\r\n\t} RC2_KEY;\r\n\r\n#ifdef OPENSSL_FIPS \r\nvoid private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);\r\n#endif\r\nvoid RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);\r\nvoid RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key,\r\n\t\t     int enc);\r\nvoid RC2_encrypt(unsigned long *data,RC2_KEY *key);\r\nvoid RC2_decrypt(unsigned long *data,RC2_KEY *key);\r\nvoid RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,\r\n\tRC2_KEY *ks, unsigned char *iv, int enc);\r\nvoid RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t       long length, RC2_KEY *schedule, unsigned char *ivec,\r\n\t\t       int *num, int enc);\r\nvoid RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,\r\n\t\t       long length, RC2_KEY *schedule, unsigned char *ivec,\r\n\t\t       int *num);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/rc4.h",
    "content": "/* crypto/rc4/rc4.h */\r\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_RC4_H\r\n#define HEADER_RC4_H\r\n\r\n#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */\r\n#ifdef OPENSSL_NO_RC4\r\n#error RC4 is disabled.\r\n#endif\r\n\r\n#include <stddef.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct rc4_key_st\r\n\t{\r\n\tRC4_INT x,y;\r\n\tRC4_INT data[256];\r\n\t} RC4_KEY;\r\n\r\n \r\nconst char *RC4_options(void);\r\nvoid RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);\r\nvoid private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);\r\nvoid RC4(RC4_KEY *key, size_t len, const unsigned char *indata,\r\n\t\tunsigned char *outdata);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ripemd.h",
    "content": "/* crypto/ripemd/ripemd.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_RIPEMD_H\r\n#define HEADER_RIPEMD_H\r\n\r\n#include <openssl/e_os2.h>\r\n#include <stddef.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_NO_RIPEMD\r\n#error RIPEMD is disabled.\r\n#endif\r\n\r\n#if defined(__LP32__)\r\n#define RIPEMD160_LONG unsigned long\r\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\r\n#define RIPEMD160_LONG unsigned long\r\n#define RIPEMD160_LONG_LOG2 3\r\n#else\r\n#define RIPEMD160_LONG unsigned int\r\n#endif\r\n\r\n#define RIPEMD160_CBLOCK\t64\r\n#define RIPEMD160_LBLOCK\t(RIPEMD160_CBLOCK/4)\r\n#define RIPEMD160_DIGEST_LENGTH\t20\r\n\r\ntypedef struct RIPEMD160state_st\r\n\t{\r\n\tRIPEMD160_LONG A,B,C,D,E;\r\n\tRIPEMD160_LONG Nl,Nh;\r\n\tRIPEMD160_LONG data[RIPEMD160_LBLOCK];\r\n\tunsigned int   num;\r\n\t} RIPEMD160_CTX;\r\n\r\n#ifdef OPENSSL_FIPS\r\nint private_RIPEMD160_Init(RIPEMD160_CTX *c);\r\n#endif\r\nint RIPEMD160_Init(RIPEMD160_CTX *c);\r\nint RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);\r\nint RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);\r\nunsigned char *RIPEMD160(const unsigned char *d, size_t n,\r\n\tunsigned char *md);\r\nvoid RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/rsa.h",
    "content": "/* crypto/rsa/rsa.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_RSA_H\r\n#define HEADER_RSA_H\r\n\r\n#include <openssl/asn1.h>\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/crypto.h>\r\n#include <openssl/ossl_typ.h>\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/bn.h>\r\n#endif\r\n\r\n#ifdef OPENSSL_NO_RSA\r\n#error RSA is disabled.\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Declared already in ossl_typ.h */\r\n/* typedef struct rsa_st RSA; */\r\n/* typedef struct rsa_meth_st RSA_METHOD; */\r\n\r\nstruct rsa_meth_st\r\n\t{\r\n\tconst char *name;\r\n\tint (*rsa_pub_enc)(int flen,const unsigned char *from,\r\n\t\t\t   unsigned char *to,\r\n\t\t\t   RSA *rsa,int padding);\r\n\tint (*rsa_pub_dec)(int flen,const unsigned char *from,\r\n\t\t\t   unsigned char *to,\r\n\t\t\t   RSA *rsa,int padding);\r\n\tint (*rsa_priv_enc)(int flen,const unsigned char *from,\r\n\t\t\t    unsigned char *to,\r\n\t\t\t    RSA *rsa,int padding);\r\n\tint (*rsa_priv_dec)(int flen,const unsigned char *from,\r\n\t\t\t    unsigned char *to,\r\n\t\t\t    RSA *rsa,int padding);\r\n\tint (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */\r\n\tint (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\r\n\t\t\t  const BIGNUM *m, BN_CTX *ctx,\r\n\t\t\t  BN_MONT_CTX *m_ctx); /* Can be null */\r\n\tint (*init)(RSA *rsa);\t\t/* called at new */\r\n\tint (*finish)(RSA *rsa);\t/* called at free */\r\n\tint flags;\t\t\t/* RSA_METHOD_FLAG_* things */\r\n\tchar *app_data;\t\t\t/* may be needed! */\r\n/* New sign and verify functions: some libraries don't allow arbitrary data\r\n * to be signed/verified: this allows them to be used. Note: for this to work\r\n * the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used\r\n * RSA_sign(), RSA_verify() should be used instead. Note: for backwards\r\n * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER\r\n * option is set in 'flags'.\r\n */\r\n\tint (*rsa_sign)(int type,\r\n\t\tconst unsigned char *m, unsigned int m_length,\r\n\t\tunsigned char *sigret, unsigned int *siglen, const RSA *rsa);\r\n\tint (*rsa_verify)(int dtype,\r\n\t\tconst unsigned char *m, unsigned int m_length,\r\n\t\tconst unsigned char *sigbuf, unsigned int siglen,\r\n\t\t\t\t\t\t\t\tconst RSA *rsa);\r\n/* If this callback is NULL, the builtin software RSA key-gen will be used. This\r\n * is for behavioural compatibility whilst the code gets rewired, but one day\r\n * it would be nice to assume there are no such things as \"builtin software\"\r\n * implementations. */\r\n\tint (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\r\n\t};\r\n\r\nstruct rsa_st\r\n\t{\r\n\t/* The first parameter is used to pickup errors where\r\n\t * this is passed instead of aEVP_PKEY, it is set to 0 */\r\n\tint pad;\r\n\tlong version;\r\n\tconst RSA_METHOD *meth;\r\n\t/* functional reference if 'meth' is ENGINE-provided */\r\n\tENGINE *engine;\r\n\tBIGNUM *n;\r\n\tBIGNUM *e;\r\n\tBIGNUM *d;\r\n\tBIGNUM *p;\r\n\tBIGNUM *q;\r\n\tBIGNUM *dmp1;\r\n\tBIGNUM *dmq1;\r\n\tBIGNUM *iqmp;\r\n\t/* be careful using this if the RSA structure is shared */\r\n\tCRYPTO_EX_DATA ex_data;\r\n\tint references;\r\n\tint flags;\r\n\r\n\t/* Used to cache montgomery values */\r\n\tBN_MONT_CTX *_method_mod_n;\r\n\tBN_MONT_CTX *_method_mod_p;\r\n\tBN_MONT_CTX *_method_mod_q;\r\n\r\n\t/* all BIGNUM values are actually in the following data, if it is not\r\n\t * NULL */\r\n\tchar *bignum_data;\r\n\tBN_BLINDING *blinding;\r\n\tBN_BLINDING *mt_blinding;\r\n\t};\r\n\r\n#ifndef OPENSSL_RSA_MAX_MODULUS_BITS\r\n# define OPENSSL_RSA_MAX_MODULUS_BITS\t16384\r\n#endif\r\n\r\n#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS\r\n# define OPENSSL_RSA_SMALL_MODULUS_BITS\t3072\r\n#endif\r\n#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS\r\n# define OPENSSL_RSA_MAX_PUBEXP_BITS\t64 /* exponent limit enforced for \"large\" modulus only */\r\n#endif\r\n\r\n#define RSA_3\t0x3L\r\n#define RSA_F4\t0x10001L\r\n\r\n#define RSA_METHOD_FLAG_NO_CHECK\t0x0001 /* don't check pub/private match */\r\n\r\n#define RSA_FLAG_CACHE_PUBLIC\t\t0x0002\r\n#define RSA_FLAG_CACHE_PRIVATE\t\t0x0004\r\n#define RSA_FLAG_BLINDING\t\t0x0008\r\n#define RSA_FLAG_THREAD_SAFE\t\t0x0010\r\n/* This flag means the private key operations will be handled by rsa_mod_exp\r\n * and that they do not depend on the private key components being present:\r\n * for example a key stored in external hardware. Without this flag bn_mod_exp\r\n * gets called when private key components are absent.\r\n */\r\n#define RSA_FLAG_EXT_PKEY\t\t0x0020\r\n\r\n/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions.\r\n */\r\n#define RSA_FLAG_SIGN_VER\t\t0x0040\r\n\r\n#define RSA_FLAG_NO_BLINDING\t\t0x0080 /* new with 0.9.6j and 0.9.7b; the built-in\r\n                                                * RSA implementation now uses blinding by\r\n                                                * default (ignoring RSA_FLAG_BLINDING),\r\n                                                * but other engines might not need it\r\n                                                */\r\n#define RSA_FLAG_NO_CONSTTIME\t\t0x0100 /* new with 0.9.8f; the built-in RSA\r\n\t\t\t\t\t\t* implementation now uses constant time\r\n\t\t\t\t\t\t* operations by default in private key operations,\r\n\t\t\t\t\t\t* e.g., constant time modular exponentiation, \r\n                                                * modular inverse without leaking branches, \r\n                                                * division without leaking branches. This \r\n                                                * flag disables these constant time \r\n                                                * operations and results in faster RSA \r\n                                                * private key operations.\r\n                                                */ \r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/\r\n                                                /* new with 0.9.7h; the built-in RSA\r\n                                                * implementation now uses constant time\r\n                                                * modular exponentiation for secret exponents\r\n                                                * by default. This flag causes the\r\n                                                * faster variable sliding window method to\r\n                                                * be used for all exponents.\r\n                                                */\r\n#endif\r\n\r\n\r\n#define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \\\r\n\t\t\t\tpad, NULL)\r\n\r\n#define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, \\\r\n\t\t\t\tEVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad)\r\n\r\n#define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \\\r\n\t\t\t\t(EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \\\r\n\t\t\t\tEVP_PKEY_CTRL_RSA_PSS_SALTLEN, \\\r\n\t\t\t\tlen, NULL)\r\n\r\n#define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \\\r\n\t\t\t\t(EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \\\r\n\t\t\t\tEVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \\\r\n\t\t\t\t0, plen)\r\n\r\n#define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \\\r\n\t\t\t\tEVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL)\r\n\r\n#define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \\\r\n\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \\\r\n\t\t\t\tEVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp)\r\n\r\n#define\t EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md)\t\\\r\n\t\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG,  \\\r\n\t\t\t\tEVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)md)\r\n\r\n#define\t EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd)\t\\\r\n\t\tEVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG,  \\\r\n\t\t\t\tEVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd)\r\n\r\n#define EVP_PKEY_CTRL_RSA_PADDING\t(EVP_PKEY_ALG_CTRL + 1)\r\n#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN\t(EVP_PKEY_ALG_CTRL + 2)\r\n\r\n#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS\t(EVP_PKEY_ALG_CTRL + 3)\r\n#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP\t(EVP_PKEY_ALG_CTRL + 4)\r\n#define EVP_PKEY_CTRL_RSA_MGF1_MD\t(EVP_PKEY_ALG_CTRL + 5)\r\n\r\n#define EVP_PKEY_CTRL_GET_RSA_PADDING\t\t(EVP_PKEY_ALG_CTRL + 6)\r\n#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN\t(EVP_PKEY_ALG_CTRL + 7)\r\n#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD\t\t(EVP_PKEY_ALG_CTRL + 8)\r\n\r\n#define RSA_PKCS1_PADDING\t1\r\n#define RSA_SSLV23_PADDING\t2\r\n#define RSA_NO_PADDING\t\t3\r\n#define RSA_PKCS1_OAEP_PADDING\t4\r\n#define RSA_X931_PADDING\t5\r\n/* EVP_PKEY_ only */\r\n#define RSA_PKCS1_PSS_PADDING\t6\r\n\r\n#define RSA_PKCS1_PADDING_SIZE\t11\r\n\r\n#define RSA_set_app_data(s,arg)         RSA_set_ex_data(s,0,arg)\r\n#define RSA_get_app_data(s)             RSA_get_ex_data(s,0)\r\n\r\nRSA *\tRSA_new(void);\r\nRSA *\tRSA_new_method(ENGINE *engine);\r\nint\tRSA_size(const RSA *);\r\n\r\n/* Deprecated version */\r\n#ifndef OPENSSL_NO_DEPRECATED\r\nRSA *\tRSA_generate_key(int bits, unsigned long e,void\r\n\t\t(*callback)(int,int,void *),void *cb_arg);\r\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\r\n\r\n/* New version */\r\nint\tRSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\r\n\r\nint\tRSA_check_key(const RSA *);\r\n\t/* next 4 return -1 on error */\r\nint\tRSA_public_encrypt(int flen, const unsigned char *from,\r\n\t\tunsigned char *to, RSA *rsa,int padding);\r\nint\tRSA_private_encrypt(int flen, const unsigned char *from,\r\n\t\tunsigned char *to, RSA *rsa,int padding);\r\nint\tRSA_public_decrypt(int flen, const unsigned char *from, \r\n\t\tunsigned char *to, RSA *rsa,int padding);\r\nint\tRSA_private_decrypt(int flen, const unsigned char *from, \r\n\t\tunsigned char *to, RSA *rsa,int padding);\r\nvoid\tRSA_free (RSA *r);\r\n/* \"up\" the RSA object's reference count */\r\nint\tRSA_up_ref(RSA *r);\r\n\r\nint\tRSA_flags(const RSA *r);\r\n\r\nvoid RSA_set_default_method(const RSA_METHOD *meth);\r\nconst RSA_METHOD *RSA_get_default_method(void);\r\nconst RSA_METHOD *RSA_get_method(const RSA *rsa);\r\nint RSA_set_method(RSA *rsa, const RSA_METHOD *meth);\r\n\r\n/* This function needs the memory locking malloc callbacks to be installed */\r\nint RSA_memory_lock(RSA *r);\r\n\r\n/* these are the actual SSLeay RSA functions */\r\nconst RSA_METHOD *RSA_PKCS1_SSLeay(void);\r\n\r\nconst RSA_METHOD *RSA_null_method(void);\r\n\r\nDECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey)\r\nDECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey)\r\n\r\ntypedef struct rsa_pss_params_st\r\n\t{\r\n\tX509_ALGOR *hashAlgorithm;\r\n\tX509_ALGOR *maskGenAlgorithm;\r\n\tASN1_INTEGER *saltLength;\r\n\tASN1_INTEGER *trailerField;\r\n\t} RSA_PSS_PARAMS;\r\n\r\nDECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS)\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\nint\tRSA_print_fp(FILE *fp, const RSA *r,int offset);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint\tRSA_print(BIO *bp, const RSA *r,int offset);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_RC4\r\nint i2d_RSA_NET(const RSA *a, unsigned char **pp,\r\n\t\tint (*cb)(char *buf, int len, const char *prompt, int verify),\r\n\t\tint sgckey);\r\nRSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,\r\n\t\t int (*cb)(char *buf, int len, const char *prompt, int verify),\r\n\t\t int sgckey);\r\n\r\nint i2d_Netscape_RSA(const RSA *a, unsigned char **pp,\r\n\t\t     int (*cb)(char *buf, int len, const char *prompt,\r\n\t\t\t       int verify));\r\nRSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,\r\n\t\t      int (*cb)(char *buf, int len, const char *prompt,\r\n\t\t\t\tint verify));\r\n#endif\r\n\r\n/* The following 2 functions sign and verify a X509_SIG ASN1 object\r\n * inside PKCS#1 padded RSA encryption */\r\nint RSA_sign(int type, const unsigned char *m, unsigned int m_length,\r\n\tunsigned char *sigret, unsigned int *siglen, RSA *rsa);\r\nint RSA_verify(int type, const unsigned char *m, unsigned int m_length,\r\n\tconst unsigned char *sigbuf, unsigned int siglen, RSA *rsa);\r\n\r\n/* The following 2 function sign and verify a ASN1_OCTET_STRING\r\n * object inside PKCS#1 padded RSA encryption */\r\nint RSA_sign_ASN1_OCTET_STRING(int type,\r\n\tconst unsigned char *m, unsigned int m_length,\r\n\tunsigned char *sigret, unsigned int *siglen, RSA *rsa);\r\nint RSA_verify_ASN1_OCTET_STRING(int type,\r\n\tconst unsigned char *m, unsigned int m_length,\r\n\tunsigned char *sigbuf, unsigned int siglen, RSA *rsa);\r\n\r\nint RSA_blinding_on(RSA *rsa, BN_CTX *ctx);\r\nvoid RSA_blinding_off(RSA *rsa);\r\nBN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);\r\n\r\nint RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl);\r\nint RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,int rsa_len);\r\nint RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl);\r\nint RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,int rsa_len);\r\nint PKCS1_MGF1(unsigned char *mask, long len,\r\n\tconst unsigned char *seed, long seedlen, const EVP_MD *dgst);\r\nint RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,\r\n\tconst unsigned char *p,int pl);\r\nint RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,int rsa_len,\r\n\tconst unsigned char *p,int pl);\r\nint RSA_padding_add_SSLv23(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl);\r\nint RSA_padding_check_SSLv23(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,int rsa_len);\r\nint RSA_padding_add_none(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl);\r\nint RSA_padding_check_none(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,int rsa_len);\r\nint RSA_padding_add_X931(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl);\r\nint RSA_padding_check_X931(unsigned char *to,int tlen,\r\n\tconst unsigned char *f,int fl,int rsa_len);\r\nint RSA_X931_hash_id(int nid);\r\n\r\nint RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,\r\n\t\t\tconst EVP_MD *Hash, const unsigned char *EM, int sLen);\r\nint RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,\r\n\t\t\tconst unsigned char *mHash,\r\n\t\t\tconst EVP_MD *Hash, int sLen);\r\n\r\nint RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,\r\n\t\t\tconst EVP_MD *Hash, const EVP_MD *mgf1Hash, \r\n\t\t\tconst unsigned char *EM, int sLen);\r\n\r\nint RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,\r\n\t\t\tconst unsigned char *mHash,\r\n\t\t\tconst EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen);\r\n\r\nint RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint RSA_set_ex_data(RSA *r,int idx,void *arg);\r\nvoid *RSA_get_ex_data(const RSA *r, int idx);\r\n\r\nRSA *RSAPublicKey_dup(RSA *rsa);\r\nRSA *RSAPrivateKey_dup(RSA *rsa);\r\n\r\n/* If this flag is set the RSA method is FIPS compliant and can be used\r\n * in FIPS mode. This is set in the validated module method. If an\r\n * application sets this flag in its own methods it is its responsibility\r\n * to ensure the result is compliant.\r\n */\r\n\r\n#define RSA_FLAG_FIPS_METHOD\t\t\t0x0400\r\n\r\n/* If this flag is set the operations normally disabled in FIPS mode are\r\n * permitted it is then the applications responsibility to ensure that the\r\n * usage is compliant.\r\n */\r\n\r\n#define RSA_FLAG_NON_FIPS_ALLOW\t\t\t0x0400\r\n/* Application has decided PRNG is good enough to generate a key: don't\r\n * check.\r\n */\r\n#define RSA_FLAG_CHECKED\t\t\t0x0800\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_RSA_strings(void);\r\n\r\n/* Error codes for the RSA functions. */\r\n\r\n/* Function codes. */\r\n#define RSA_F_CHECK_PADDING_MD\t\t\t\t 140\r\n#define RSA_F_DO_RSA_PRINT\t\t\t\t 146\r\n#define RSA_F_INT_RSA_VERIFY\t\t\t\t 145\r\n#define RSA_F_MEMORY_LOCK\t\t\t\t 100\r\n#define RSA_F_OLD_RSA_PRIV_DECODE\t\t\t 147\r\n#define RSA_F_PKEY_RSA_CTRL\t\t\t\t 143\r\n#define RSA_F_PKEY_RSA_CTRL_STR\t\t\t\t 144\r\n#define RSA_F_PKEY_RSA_SIGN\t\t\t\t 142\r\n#define RSA_F_PKEY_RSA_VERIFY\t\t\t\t 154\r\n#define RSA_F_PKEY_RSA_VERIFYRECOVER\t\t\t 141\r\n#define RSA_F_RSA_BUILTIN_KEYGEN\t\t\t 129\r\n#define RSA_F_RSA_CHECK_KEY\t\t\t\t 123\r\n#define RSA_F_RSA_EAY_PRIVATE_DECRYPT\t\t\t 101\r\n#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT\t\t\t 102\r\n#define RSA_F_RSA_EAY_PUBLIC_DECRYPT\t\t\t 103\r\n#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT\t\t\t 104\r\n#define RSA_F_RSA_GENERATE_KEY\t\t\t\t 105\r\n#define RSA_F_RSA_GENERATE_KEY_EX\t\t\t 155\r\n#define RSA_F_RSA_ITEM_VERIFY\t\t\t\t 156\r\n#define RSA_F_RSA_MEMORY_LOCK\t\t\t\t 130\r\n#define RSA_F_RSA_NEW_METHOD\t\t\t\t 106\r\n#define RSA_F_RSA_NULL\t\t\t\t\t 124\r\n#define RSA_F_RSA_NULL_MOD_EXP\t\t\t\t 131\r\n#define RSA_F_RSA_NULL_PRIVATE_DECRYPT\t\t\t 132\r\n#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT\t\t\t 133\r\n#define RSA_F_RSA_NULL_PUBLIC_DECRYPT\t\t\t 134\r\n#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT\t\t\t 135\r\n#define RSA_F_RSA_PADDING_ADD_NONE\t\t\t 107\r\n#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP\t\t 121\r\n#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS\t\t\t 125\r\n#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1\t\t 148\r\n#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1\t\t 108\r\n#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2\t\t 109\r\n#define RSA_F_RSA_PADDING_ADD_SSLV23\t\t\t 110\r\n#define RSA_F_RSA_PADDING_ADD_X931\t\t\t 127\r\n#define RSA_F_RSA_PADDING_CHECK_NONE\t\t\t 111\r\n#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP\t\t 122\r\n#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1\t\t 112\r\n#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2\t\t 113\r\n#define RSA_F_RSA_PADDING_CHECK_SSLV23\t\t\t 114\r\n#define RSA_F_RSA_PADDING_CHECK_X931\t\t\t 128\r\n#define RSA_F_RSA_PRINT\t\t\t\t\t 115\r\n#define RSA_F_RSA_PRINT_FP\t\t\t\t 116\r\n#define RSA_F_RSA_PRIVATE_DECRYPT\t\t\t 150\r\n#define RSA_F_RSA_PRIVATE_ENCRYPT\t\t\t 151\r\n#define RSA_F_RSA_PRIV_DECODE\t\t\t\t 137\r\n#define RSA_F_RSA_PRIV_ENCODE\t\t\t\t 138\r\n#define RSA_F_RSA_PUBLIC_DECRYPT\t\t\t 152\r\n#define RSA_F_RSA_PUBLIC_ENCRYPT\t\t\t 153\r\n#define RSA_F_RSA_PUB_DECODE\t\t\t\t 139\r\n#define RSA_F_RSA_SETUP_BLINDING\t\t\t 136\r\n#define RSA_F_RSA_SIGN\t\t\t\t\t 117\r\n#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING\t\t 118\r\n#define RSA_F_RSA_VERIFY\t\t\t\t 119\r\n#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING\t\t 120\r\n#define RSA_F_RSA_VERIFY_PKCS1_PSS\t\t\t 126\r\n#define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1\t\t\t 149\r\n\r\n/* Reason codes. */\r\n#define RSA_R_ALGORITHM_MISMATCH\t\t\t 100\r\n#define RSA_R_BAD_E_VALUE\t\t\t\t 101\r\n#define RSA_R_BAD_FIXED_HEADER_DECRYPT\t\t\t 102\r\n#define RSA_R_BAD_PAD_BYTE_COUNT\t\t\t 103\r\n#define RSA_R_BAD_SIGNATURE\t\t\t\t 104\r\n#define RSA_R_BLOCK_TYPE_IS_NOT_01\t\t\t 106\r\n#define RSA_R_BLOCK_TYPE_IS_NOT_02\t\t\t 107\r\n#define RSA_R_DATA_GREATER_THAN_MOD_LEN\t\t\t 108\r\n#define RSA_R_DATA_TOO_LARGE\t\t\t\t 109\r\n#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE\t\t 110\r\n#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS\t\t 132\r\n#define RSA_R_DATA_TOO_SMALL\t\t\t\t 111\r\n#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE\t\t 122\r\n#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY\t\t 112\r\n#define RSA_R_DMP1_NOT_CONGRUENT_TO_D\t\t\t 124\r\n#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D\t\t\t 125\r\n#define RSA_R_D_E_NOT_CONGRUENT_TO_1\t\t\t 123\r\n#define RSA_R_FIRST_OCTET_INVALID\t\t\t 133\r\n#define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE\t 144\r\n#define RSA_R_INVALID_DIGEST_LENGTH\t\t\t 143\r\n#define RSA_R_INVALID_HEADER\t\t\t\t 137\r\n#define RSA_R_INVALID_KEYBITS\t\t\t\t 145\r\n#define RSA_R_INVALID_MESSAGE_LENGTH\t\t\t 131\r\n#define RSA_R_INVALID_MGF1_MD\t\t\t\t 156\r\n#define RSA_R_INVALID_PADDING\t\t\t\t 138\r\n#define RSA_R_INVALID_PADDING_MODE\t\t\t 141\r\n#define RSA_R_INVALID_PSS_PARAMETERS\t\t\t 149\r\n#define RSA_R_INVALID_PSS_SALTLEN\t\t\t 146\r\n#define RSA_R_INVALID_SALT_LENGTH\t\t\t 150\r\n#define RSA_R_INVALID_TRAILER\t\t\t\t 139\r\n#define RSA_R_INVALID_X931_DIGEST\t\t\t 142\r\n#define RSA_R_IQMP_NOT_INVERSE_OF_Q\t\t\t 126\r\n#define RSA_R_KEY_SIZE_TOO_SMALL\t\t\t 120\r\n#define RSA_R_LAST_OCTET_INVALID\t\t\t 134\r\n#define RSA_R_MODULUS_TOO_LARGE\t\t\t\t 105\r\n#define RSA_R_NON_FIPS_RSA_METHOD\t\t\t 157\r\n#define RSA_R_NO_PUBLIC_EXPONENT\t\t\t 140\r\n#define RSA_R_NULL_BEFORE_BLOCK_MISSING\t\t\t 113\r\n#define RSA_R_N_DOES_NOT_EQUAL_P_Q\t\t\t 127\r\n#define RSA_R_OAEP_DECODING_ERROR\t\t\t 121\r\n#define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE\t 158\r\n#define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE\t 148\r\n#define RSA_R_PADDING_CHECK_FAILED\t\t\t 114\r\n#define RSA_R_P_NOT_PRIME\t\t\t\t 128\r\n#define RSA_R_Q_NOT_PRIME\t\t\t\t 129\r\n#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED\t\t 130\r\n#define RSA_R_SLEN_CHECK_FAILED\t\t\t\t 136\r\n#define RSA_R_SLEN_RECOVERY_FAILED\t\t\t 135\r\n#define RSA_R_SSLV3_ROLLBACK_ATTACK\t\t\t 115\r\n#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116\r\n#define RSA_R_UNKNOWN_ALGORITHM_TYPE\t\t\t 117\r\n#define RSA_R_UNKNOWN_MASK_DIGEST\t\t\t 151\r\n#define RSA_R_UNKNOWN_PADDING_TYPE\t\t\t 118\r\n#define RSA_R_UNKNOWN_PSS_DIGEST\t\t\t 152\r\n#define RSA_R_UNSUPPORTED_MASK_ALGORITHM\t\t 153\r\n#define RSA_R_UNSUPPORTED_MASK_PARAMETER\t\t 154\r\n#define RSA_R_UNSUPPORTED_SIGNATURE_TYPE\t\t 155\r\n#define RSA_R_VALUE_MISSING\t\t\t\t 147\r\n#define RSA_R_WRONG_SIGNATURE_LENGTH\t\t\t 119\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/safestack.h",
    "content": "/* ====================================================================\r\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_SAFESTACK_H\r\n#define HEADER_SAFESTACK_H\r\n\r\n#include <openssl/stack.h>\r\n\r\n#ifndef CHECKED_PTR_OF\r\n#define CHECKED_PTR_OF(type, p) \\\r\n    ((void*) (1 ? p : (type*)0))\r\n#endif\r\n\r\n/* In C++ we get problems because an explicit cast is needed from (void *)\r\n * we use CHECKED_STACK_OF to ensure the correct type is passed in the macros\r\n * below. \r\n */\r\n\r\n#define CHECKED_STACK_OF(type, p) \\\r\n    ((_STACK*) (1 ? p : (STACK_OF(type)*)0))\r\n\r\n#define CHECKED_SK_FREE_FUNC(type, p) \\\r\n    ((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))\r\n\r\n#define CHECKED_SK_FREE_FUNC2(type, p) \\\r\n    ((void (*)(void *)) ((1 ? p : (void (*)(type))0)))\r\n\r\n#define CHECKED_SK_CMP_FUNC(type, p) \\\r\n    ((int (*)(const void *, const void *)) \\\r\n\t((1 ? p : (int (*)(const type * const *, const type * const *))0)))\r\n\r\n#define STACK_OF(type) struct stack_st_##type\r\n#define PREDECLARE_STACK_OF(type) STACK_OF(type);\r\n\r\n#define DECLARE_STACK_OF(type) \\\r\nSTACK_OF(type) \\\r\n    { \\\r\n    _STACK stack; \\\r\n    };\r\n#define DECLARE_SPECIAL_STACK_OF(type, type2) \\\r\nSTACK_OF(type) \\\r\n    { \\\r\n    _STACK stack; \\\r\n    };\r\n\r\n#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/\r\n\r\n\r\n/* Strings are special: normally an lhash entry will point to a single\r\n * (somewhat) mutable object. In the case of strings:\r\n *\r\n * a) Instead of a single char, there is an array of chars, NUL-terminated.\r\n * b) The string may have be immutable.\r\n *\r\n * So, they need their own declarations. Especially important for\r\n * type-checking tools, such as Deputy.\r\n *\r\no * In practice, however, it appears to be hard to have a const\r\n * string. For now, I'm settling for dealing with the fact it is a\r\n * string at all.\r\n */\r\ntypedef char *OPENSSL_STRING;\r\n\r\ntypedef const char *OPENSSL_CSTRING;\r\n\r\n/* Confusingly, LHASH_OF(STRING) deals with char ** throughout, but\r\n * STACK_OF(STRING) is really more like STACK_OF(char), only, as\r\n * mentioned above, instead of a single char each entry is a\r\n * NUL-terminated array of chars. So, we have to implement STRING\r\n * specially for STACK_OF. This is dealt with in the autogenerated\r\n * macros below.\r\n */\r\n\r\nDECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)\r\n\r\n/* Similarly, we sometimes use a block of characters, NOT\r\n * nul-terminated. These should also be distinguished from \"normal\"\r\n * stacks. */\r\n\r\ntypedef void *OPENSSL_BLOCK;\r\nDECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)\r\n\r\n/* SKM_sk_... stack macros are internal to safestack.h:\r\n * never use them directly, use sk_<type>_... instead */\r\n#define SKM_sk_new(type, cmp) \\\r\n\t((STACK_OF(type) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp)))\r\n#define SKM_sk_new_null(type) \\\r\n\t((STACK_OF(type) *)sk_new_null())\r\n#define SKM_sk_free(type, st) \\\r\n\tsk_free(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_num(type, st) \\\r\n\tsk_num(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_value(type, st,i) \\\r\n\t((type *)sk_value(CHECKED_STACK_OF(type, st), i))\r\n#define SKM_sk_set(type, st,i,val) \\\r\n\tsk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val))\r\n#define SKM_sk_zero(type, st) \\\r\n\tsk_zero(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_push(type, st, val) \\\r\n\tsk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))\r\n#define SKM_sk_unshift(type, st, val) \\\r\n\tsk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))\r\n#define SKM_sk_find(type, st, val) \\\r\n\tsk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))\r\n#define SKM_sk_find_ex(type, st, val) \\\r\n\tsk_find_ex(CHECKED_STACK_OF(type, st), \\\r\n\t\t   CHECKED_PTR_OF(type, val))\r\n#define SKM_sk_delete(type, st, i) \\\r\n\t(type *)sk_delete(CHECKED_STACK_OF(type, st), i)\r\n#define SKM_sk_delete_ptr(type, st, ptr) \\\r\n\t(type *)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, ptr))\r\n#define SKM_sk_insert(type, st,val, i) \\\r\n\tsk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i)\r\n#define SKM_sk_set_cmp_func(type, st, cmp) \\\r\n\t((int (*)(const type * const *,const type * const *)) \\\r\n\tsk_set_cmp_func(CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp)))\r\n#define SKM_sk_dup(type, st) \\\r\n\t(STACK_OF(type) *)sk_dup(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_pop_free(type, st, free_func) \\\r\n\tsk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, free_func))\r\n#define SKM_sk_shift(type, st) \\\r\n\t(type *)sk_shift(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_pop(type, st) \\\r\n\t(type *)sk_pop(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_sort(type, st) \\\r\n\tsk_sort(CHECKED_STACK_OF(type, st))\r\n#define SKM_sk_is_sorted(type, st) \\\r\n\tsk_is_sorted(CHECKED_STACK_OF(type, st))\r\n\r\n#define\tSKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n  (STACK_OF(type) *)d2i_ASN1_SET( \\\r\n\t\t\t\t(STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \\\r\n\t\t\t\tpp, length, \\\r\n\t\t\t\tCHECKED_D2I_OF(type, d2i_func), \\\r\n\t\t\t\tCHECKED_SK_FREE_FUNC(type, free_func), \\\r\n\t\t\t\tex_tag, ex_class)\r\n\r\n#define\tSKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n  i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK) *)CHECKED_STACK_OF(type, st), pp, \\\r\n\t\t\t\tCHECKED_I2D_OF(type, i2d_func), \\\r\n\t\t\t\tex_tag, ex_class, is_set)\r\n\r\n#define\tSKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \\\r\n\tASN1_seq_pack(CHECKED_PTR_OF(STACK_OF(type), st), \\\r\n\t\t\tCHECKED_I2D_OF(type, i2d_func), buf, len)\r\n\r\n#define\tSKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \\\r\n\t(STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2i_func), CHECKED_SK_FREE_FUNC(type, free_func))\r\n\r\n#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \\\r\n\t(STACK_OF(type) *)PKCS12_decrypt_d2i(algor, \\\r\n\t\t\t\tCHECKED_D2I_OF(type, d2i_func), \\\r\n\t\t\t\tCHECKED_SK_FREE_FUNC(type, free_func), \\\r\n\t\t\t\tpass, passlen, oct, seq)\r\n\r\n/* This block of defines is updated by util/mkstack.pl, please do not touch! */\r\n#define sk_ACCESS_DESCRIPTION_new(cmp) SKM_sk_new(ACCESS_DESCRIPTION, (cmp))\r\n#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION)\r\n#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st))\r\n#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st))\r\n#define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i))\r\n#define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val))\r\n#define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st))\r\n#define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val))\r\n#define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val))\r\n#define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val))\r\n#define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val))\r\n#define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i))\r\n#define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr))\r\n#define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i))\r\n#define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp))\r\n#define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st)\r\n#define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func))\r\n#define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st))\r\n#define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st))\r\n#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st))\r\n#define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st))\r\n\r\n#define sk_ASIdOrRange_new(cmp) SKM_sk_new(ASIdOrRange, (cmp))\r\n#define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange)\r\n#define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st))\r\n#define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st))\r\n#define sk_ASIdOrRange_value(st, i) SKM_sk_value(ASIdOrRange, (st), (i))\r\n#define sk_ASIdOrRange_set(st, i, val) SKM_sk_set(ASIdOrRange, (st), (i), (val))\r\n#define sk_ASIdOrRange_zero(st) SKM_sk_zero(ASIdOrRange, (st))\r\n#define sk_ASIdOrRange_push(st, val) SKM_sk_push(ASIdOrRange, (st), (val))\r\n#define sk_ASIdOrRange_unshift(st, val) SKM_sk_unshift(ASIdOrRange, (st), (val))\r\n#define sk_ASIdOrRange_find(st, val) SKM_sk_find(ASIdOrRange, (st), (val))\r\n#define sk_ASIdOrRange_find_ex(st, val) SKM_sk_find_ex(ASIdOrRange, (st), (val))\r\n#define sk_ASIdOrRange_delete(st, i) SKM_sk_delete(ASIdOrRange, (st), (i))\r\n#define sk_ASIdOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASIdOrRange, (st), (ptr))\r\n#define sk_ASIdOrRange_insert(st, val, i) SKM_sk_insert(ASIdOrRange, (st), (val), (i))\r\n#define sk_ASIdOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASIdOrRange, (st), (cmp))\r\n#define sk_ASIdOrRange_dup(st) SKM_sk_dup(ASIdOrRange, st)\r\n#define sk_ASIdOrRange_pop_free(st, free_func) SKM_sk_pop_free(ASIdOrRange, (st), (free_func))\r\n#define sk_ASIdOrRange_shift(st) SKM_sk_shift(ASIdOrRange, (st))\r\n#define sk_ASIdOrRange_pop(st) SKM_sk_pop(ASIdOrRange, (st))\r\n#define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st))\r\n#define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st))\r\n\r\n#define sk_ASN1_GENERALSTRING_new(cmp) SKM_sk_new(ASN1_GENERALSTRING, (cmp))\r\n#define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING)\r\n#define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st))\r\n#define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st))\r\n#define sk_ASN1_GENERALSTRING_value(st, i) SKM_sk_value(ASN1_GENERALSTRING, (st), (i))\r\n#define sk_ASN1_GENERALSTRING_set(st, i, val) SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val))\r\n#define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st))\r\n#define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val))\r\n#define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val))\r\n#define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val))\r\n#define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val))\r\n#define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i))\r\n#define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr))\r\n#define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i))\r\n#define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp))\r\n#define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st)\r\n#define sk_ASN1_GENERALSTRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func))\r\n#define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st))\r\n#define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st))\r\n#define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st))\r\n#define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st))\r\n\r\n#define sk_ASN1_INTEGER_new(cmp) SKM_sk_new(ASN1_INTEGER, (cmp))\r\n#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER)\r\n#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st))\r\n#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st))\r\n#define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i))\r\n#define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val))\r\n#define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st))\r\n#define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val))\r\n#define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val))\r\n#define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val))\r\n#define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val))\r\n#define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i))\r\n#define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr))\r\n#define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i))\r\n#define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp))\r\n#define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st)\r\n#define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func))\r\n#define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st))\r\n#define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st))\r\n#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st))\r\n#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st))\r\n\r\n#define sk_ASN1_OBJECT_new(cmp) SKM_sk_new(ASN1_OBJECT, (cmp))\r\n#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT)\r\n#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st))\r\n#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st))\r\n#define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i))\r\n#define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val))\r\n#define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st))\r\n#define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val))\r\n#define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val))\r\n#define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val))\r\n#define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val))\r\n#define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i))\r\n#define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr))\r\n#define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i))\r\n#define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp))\r\n#define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st)\r\n#define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func))\r\n#define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st))\r\n#define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st))\r\n#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st))\r\n#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st))\r\n\r\n#define sk_ASN1_STRING_TABLE_new(cmp) SKM_sk_new(ASN1_STRING_TABLE, (cmp))\r\n#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE)\r\n#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st))\r\n#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st))\r\n#define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i))\r\n#define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val))\r\n#define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st))\r\n#define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val))\r\n#define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val))\r\n#define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val))\r\n#define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val))\r\n#define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i))\r\n#define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr))\r\n#define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i))\r\n#define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp))\r\n#define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st)\r\n#define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func))\r\n#define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st))\r\n#define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st))\r\n#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st))\r\n#define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st))\r\n\r\n#define sk_ASN1_TYPE_new(cmp) SKM_sk_new(ASN1_TYPE, (cmp))\r\n#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE)\r\n#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st))\r\n#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st))\r\n#define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i))\r\n#define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val))\r\n#define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st))\r\n#define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val))\r\n#define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val))\r\n#define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val))\r\n#define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val))\r\n#define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i))\r\n#define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr))\r\n#define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i))\r\n#define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp))\r\n#define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st)\r\n#define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func))\r\n#define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st))\r\n#define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st))\r\n#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st))\r\n#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st))\r\n\r\n#define sk_ASN1_UTF8STRING_new(cmp) SKM_sk_new(ASN1_UTF8STRING, (cmp))\r\n#define sk_ASN1_UTF8STRING_new_null() SKM_sk_new_null(ASN1_UTF8STRING)\r\n#define sk_ASN1_UTF8STRING_free(st) SKM_sk_free(ASN1_UTF8STRING, (st))\r\n#define sk_ASN1_UTF8STRING_num(st) SKM_sk_num(ASN1_UTF8STRING, (st))\r\n#define sk_ASN1_UTF8STRING_value(st, i) SKM_sk_value(ASN1_UTF8STRING, (st), (i))\r\n#define sk_ASN1_UTF8STRING_set(st, i, val) SKM_sk_set(ASN1_UTF8STRING, (st), (i), (val))\r\n#define sk_ASN1_UTF8STRING_zero(st) SKM_sk_zero(ASN1_UTF8STRING, (st))\r\n#define sk_ASN1_UTF8STRING_push(st, val) SKM_sk_push(ASN1_UTF8STRING, (st), (val))\r\n#define sk_ASN1_UTF8STRING_unshift(st, val) SKM_sk_unshift(ASN1_UTF8STRING, (st), (val))\r\n#define sk_ASN1_UTF8STRING_find(st, val) SKM_sk_find(ASN1_UTF8STRING, (st), (val))\r\n#define sk_ASN1_UTF8STRING_find_ex(st, val) SKM_sk_find_ex(ASN1_UTF8STRING, (st), (val))\r\n#define sk_ASN1_UTF8STRING_delete(st, i) SKM_sk_delete(ASN1_UTF8STRING, (st), (i))\r\n#define sk_ASN1_UTF8STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_UTF8STRING, (st), (ptr))\r\n#define sk_ASN1_UTF8STRING_insert(st, val, i) SKM_sk_insert(ASN1_UTF8STRING, (st), (val), (i))\r\n#define sk_ASN1_UTF8STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_UTF8STRING, (st), (cmp))\r\n#define sk_ASN1_UTF8STRING_dup(st) SKM_sk_dup(ASN1_UTF8STRING, st)\r\n#define sk_ASN1_UTF8STRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_UTF8STRING, (st), (free_func))\r\n#define sk_ASN1_UTF8STRING_shift(st) SKM_sk_shift(ASN1_UTF8STRING, (st))\r\n#define sk_ASN1_UTF8STRING_pop(st) SKM_sk_pop(ASN1_UTF8STRING, (st))\r\n#define sk_ASN1_UTF8STRING_sort(st) SKM_sk_sort(ASN1_UTF8STRING, (st))\r\n#define sk_ASN1_UTF8STRING_is_sorted(st) SKM_sk_is_sorted(ASN1_UTF8STRING, (st))\r\n\r\n#define sk_ASN1_VALUE_new(cmp) SKM_sk_new(ASN1_VALUE, (cmp))\r\n#define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE)\r\n#define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st))\r\n#define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st))\r\n#define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i))\r\n#define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val))\r\n#define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st))\r\n#define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val))\r\n#define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val))\r\n#define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val))\r\n#define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val))\r\n#define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i))\r\n#define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr))\r\n#define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i))\r\n#define sk_ASN1_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp))\r\n#define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st)\r\n#define sk_ASN1_VALUE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_VALUE, (st), (free_func))\r\n#define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st))\r\n#define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st))\r\n#define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st))\r\n#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st))\r\n\r\n#define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp))\r\n#define sk_BIO_new_null() SKM_sk_new_null(BIO)\r\n#define sk_BIO_free(st) SKM_sk_free(BIO, (st))\r\n#define sk_BIO_num(st) SKM_sk_num(BIO, (st))\r\n#define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i))\r\n#define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val))\r\n#define sk_BIO_zero(st) SKM_sk_zero(BIO, (st))\r\n#define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val))\r\n#define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val))\r\n#define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val))\r\n#define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val))\r\n#define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i))\r\n#define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr))\r\n#define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i))\r\n#define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp))\r\n#define sk_BIO_dup(st) SKM_sk_dup(BIO, st)\r\n#define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func))\r\n#define sk_BIO_shift(st) SKM_sk_shift(BIO, (st))\r\n#define sk_BIO_pop(st) SKM_sk_pop(BIO, (st))\r\n#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st))\r\n#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st))\r\n\r\n#define sk_BY_DIR_ENTRY_new(cmp) SKM_sk_new(BY_DIR_ENTRY, (cmp))\r\n#define sk_BY_DIR_ENTRY_new_null() SKM_sk_new_null(BY_DIR_ENTRY)\r\n#define sk_BY_DIR_ENTRY_free(st) SKM_sk_free(BY_DIR_ENTRY, (st))\r\n#define sk_BY_DIR_ENTRY_num(st) SKM_sk_num(BY_DIR_ENTRY, (st))\r\n#define sk_BY_DIR_ENTRY_value(st, i) SKM_sk_value(BY_DIR_ENTRY, (st), (i))\r\n#define sk_BY_DIR_ENTRY_set(st, i, val) SKM_sk_set(BY_DIR_ENTRY, (st), (i), (val))\r\n#define sk_BY_DIR_ENTRY_zero(st) SKM_sk_zero(BY_DIR_ENTRY, (st))\r\n#define sk_BY_DIR_ENTRY_push(st, val) SKM_sk_push(BY_DIR_ENTRY, (st), (val))\r\n#define sk_BY_DIR_ENTRY_unshift(st, val) SKM_sk_unshift(BY_DIR_ENTRY, (st), (val))\r\n#define sk_BY_DIR_ENTRY_find(st, val) SKM_sk_find(BY_DIR_ENTRY, (st), (val))\r\n#define sk_BY_DIR_ENTRY_find_ex(st, val) SKM_sk_find_ex(BY_DIR_ENTRY, (st), (val))\r\n#define sk_BY_DIR_ENTRY_delete(st, i) SKM_sk_delete(BY_DIR_ENTRY, (st), (i))\r\n#define sk_BY_DIR_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_ENTRY, (st), (ptr))\r\n#define sk_BY_DIR_ENTRY_insert(st, val, i) SKM_sk_insert(BY_DIR_ENTRY, (st), (val), (i))\r\n#define sk_BY_DIR_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_ENTRY, (st), (cmp))\r\n#define sk_BY_DIR_ENTRY_dup(st) SKM_sk_dup(BY_DIR_ENTRY, st)\r\n#define sk_BY_DIR_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_ENTRY, (st), (free_func))\r\n#define sk_BY_DIR_ENTRY_shift(st) SKM_sk_shift(BY_DIR_ENTRY, (st))\r\n#define sk_BY_DIR_ENTRY_pop(st) SKM_sk_pop(BY_DIR_ENTRY, (st))\r\n#define sk_BY_DIR_ENTRY_sort(st) SKM_sk_sort(BY_DIR_ENTRY, (st))\r\n#define sk_BY_DIR_ENTRY_is_sorted(st) SKM_sk_is_sorted(BY_DIR_ENTRY, (st))\r\n\r\n#define sk_BY_DIR_HASH_new(cmp) SKM_sk_new(BY_DIR_HASH, (cmp))\r\n#define sk_BY_DIR_HASH_new_null() SKM_sk_new_null(BY_DIR_HASH)\r\n#define sk_BY_DIR_HASH_free(st) SKM_sk_free(BY_DIR_HASH, (st))\r\n#define sk_BY_DIR_HASH_num(st) SKM_sk_num(BY_DIR_HASH, (st))\r\n#define sk_BY_DIR_HASH_value(st, i) SKM_sk_value(BY_DIR_HASH, (st), (i))\r\n#define sk_BY_DIR_HASH_set(st, i, val) SKM_sk_set(BY_DIR_HASH, (st), (i), (val))\r\n#define sk_BY_DIR_HASH_zero(st) SKM_sk_zero(BY_DIR_HASH, (st))\r\n#define sk_BY_DIR_HASH_push(st, val) SKM_sk_push(BY_DIR_HASH, (st), (val))\r\n#define sk_BY_DIR_HASH_unshift(st, val) SKM_sk_unshift(BY_DIR_HASH, (st), (val))\r\n#define sk_BY_DIR_HASH_find(st, val) SKM_sk_find(BY_DIR_HASH, (st), (val))\r\n#define sk_BY_DIR_HASH_find_ex(st, val) SKM_sk_find_ex(BY_DIR_HASH, (st), (val))\r\n#define sk_BY_DIR_HASH_delete(st, i) SKM_sk_delete(BY_DIR_HASH, (st), (i))\r\n#define sk_BY_DIR_HASH_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_HASH, (st), (ptr))\r\n#define sk_BY_DIR_HASH_insert(st, val, i) SKM_sk_insert(BY_DIR_HASH, (st), (val), (i))\r\n#define sk_BY_DIR_HASH_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_HASH, (st), (cmp))\r\n#define sk_BY_DIR_HASH_dup(st) SKM_sk_dup(BY_DIR_HASH, st)\r\n#define sk_BY_DIR_HASH_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_HASH, (st), (free_func))\r\n#define sk_BY_DIR_HASH_shift(st) SKM_sk_shift(BY_DIR_HASH, (st))\r\n#define sk_BY_DIR_HASH_pop(st) SKM_sk_pop(BY_DIR_HASH, (st))\r\n#define sk_BY_DIR_HASH_sort(st) SKM_sk_sort(BY_DIR_HASH, (st))\r\n#define sk_BY_DIR_HASH_is_sorted(st) SKM_sk_is_sorted(BY_DIR_HASH, (st))\r\n\r\n#define sk_CMS_CertificateChoices_new(cmp) SKM_sk_new(CMS_CertificateChoices, (cmp))\r\n#define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices)\r\n#define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st))\r\n#define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st))\r\n#define sk_CMS_CertificateChoices_value(st, i) SKM_sk_value(CMS_CertificateChoices, (st), (i))\r\n#define sk_CMS_CertificateChoices_set(st, i, val) SKM_sk_set(CMS_CertificateChoices, (st), (i), (val))\r\n#define sk_CMS_CertificateChoices_zero(st) SKM_sk_zero(CMS_CertificateChoices, (st))\r\n#define sk_CMS_CertificateChoices_push(st, val) SKM_sk_push(CMS_CertificateChoices, (st), (val))\r\n#define sk_CMS_CertificateChoices_unshift(st, val) SKM_sk_unshift(CMS_CertificateChoices, (st), (val))\r\n#define sk_CMS_CertificateChoices_find(st, val) SKM_sk_find(CMS_CertificateChoices, (st), (val))\r\n#define sk_CMS_CertificateChoices_find_ex(st, val) SKM_sk_find_ex(CMS_CertificateChoices, (st), (val))\r\n#define sk_CMS_CertificateChoices_delete(st, i) SKM_sk_delete(CMS_CertificateChoices, (st), (i))\r\n#define sk_CMS_CertificateChoices_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_CertificateChoices, (st), (ptr))\r\n#define sk_CMS_CertificateChoices_insert(st, val, i) SKM_sk_insert(CMS_CertificateChoices, (st), (val), (i))\r\n#define sk_CMS_CertificateChoices_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_CertificateChoices, (st), (cmp))\r\n#define sk_CMS_CertificateChoices_dup(st) SKM_sk_dup(CMS_CertificateChoices, st)\r\n#define sk_CMS_CertificateChoices_pop_free(st, free_func) SKM_sk_pop_free(CMS_CertificateChoices, (st), (free_func))\r\n#define sk_CMS_CertificateChoices_shift(st) SKM_sk_shift(CMS_CertificateChoices, (st))\r\n#define sk_CMS_CertificateChoices_pop(st) SKM_sk_pop(CMS_CertificateChoices, (st))\r\n#define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st))\r\n#define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st))\r\n\r\n#define sk_CMS_RecipientInfo_new(cmp) SKM_sk_new(CMS_RecipientInfo, (cmp))\r\n#define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo)\r\n#define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st))\r\n#define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st))\r\n#define sk_CMS_RecipientInfo_value(st, i) SKM_sk_value(CMS_RecipientInfo, (st), (i))\r\n#define sk_CMS_RecipientInfo_set(st, i, val) SKM_sk_set(CMS_RecipientInfo, (st), (i), (val))\r\n#define sk_CMS_RecipientInfo_zero(st) SKM_sk_zero(CMS_RecipientInfo, (st))\r\n#define sk_CMS_RecipientInfo_push(st, val) SKM_sk_push(CMS_RecipientInfo, (st), (val))\r\n#define sk_CMS_RecipientInfo_unshift(st, val) SKM_sk_unshift(CMS_RecipientInfo, (st), (val))\r\n#define sk_CMS_RecipientInfo_find(st, val) SKM_sk_find(CMS_RecipientInfo, (st), (val))\r\n#define sk_CMS_RecipientInfo_find_ex(st, val) SKM_sk_find_ex(CMS_RecipientInfo, (st), (val))\r\n#define sk_CMS_RecipientInfo_delete(st, i) SKM_sk_delete(CMS_RecipientInfo, (st), (i))\r\n#define sk_CMS_RecipientInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RecipientInfo, (st), (ptr))\r\n#define sk_CMS_RecipientInfo_insert(st, val, i) SKM_sk_insert(CMS_RecipientInfo, (st), (val), (i))\r\n#define sk_CMS_RecipientInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RecipientInfo, (st), (cmp))\r\n#define sk_CMS_RecipientInfo_dup(st) SKM_sk_dup(CMS_RecipientInfo, st)\r\n#define sk_CMS_RecipientInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_RecipientInfo, (st), (free_func))\r\n#define sk_CMS_RecipientInfo_shift(st) SKM_sk_shift(CMS_RecipientInfo, (st))\r\n#define sk_CMS_RecipientInfo_pop(st) SKM_sk_pop(CMS_RecipientInfo, (st))\r\n#define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st))\r\n#define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st))\r\n\r\n#define sk_CMS_RevocationInfoChoice_new(cmp) SKM_sk_new(CMS_RevocationInfoChoice, (cmp))\r\n#define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice)\r\n#define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st))\r\n#define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st))\r\n#define sk_CMS_RevocationInfoChoice_value(st, i) SKM_sk_value(CMS_RevocationInfoChoice, (st), (i))\r\n#define sk_CMS_RevocationInfoChoice_set(st, i, val) SKM_sk_set(CMS_RevocationInfoChoice, (st), (i), (val))\r\n#define sk_CMS_RevocationInfoChoice_zero(st) SKM_sk_zero(CMS_RevocationInfoChoice, (st))\r\n#define sk_CMS_RevocationInfoChoice_push(st, val) SKM_sk_push(CMS_RevocationInfoChoice, (st), (val))\r\n#define sk_CMS_RevocationInfoChoice_unshift(st, val) SKM_sk_unshift(CMS_RevocationInfoChoice, (st), (val))\r\n#define sk_CMS_RevocationInfoChoice_find(st, val) SKM_sk_find(CMS_RevocationInfoChoice, (st), (val))\r\n#define sk_CMS_RevocationInfoChoice_find_ex(st, val) SKM_sk_find_ex(CMS_RevocationInfoChoice, (st), (val))\r\n#define sk_CMS_RevocationInfoChoice_delete(st, i) SKM_sk_delete(CMS_RevocationInfoChoice, (st), (i))\r\n#define sk_CMS_RevocationInfoChoice_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RevocationInfoChoice, (st), (ptr))\r\n#define sk_CMS_RevocationInfoChoice_insert(st, val, i) SKM_sk_insert(CMS_RevocationInfoChoice, (st), (val), (i))\r\n#define sk_CMS_RevocationInfoChoice_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RevocationInfoChoice, (st), (cmp))\r\n#define sk_CMS_RevocationInfoChoice_dup(st) SKM_sk_dup(CMS_RevocationInfoChoice, st)\r\n#define sk_CMS_RevocationInfoChoice_pop_free(st, free_func) SKM_sk_pop_free(CMS_RevocationInfoChoice, (st), (free_func))\r\n#define sk_CMS_RevocationInfoChoice_shift(st) SKM_sk_shift(CMS_RevocationInfoChoice, (st))\r\n#define sk_CMS_RevocationInfoChoice_pop(st) SKM_sk_pop(CMS_RevocationInfoChoice, (st))\r\n#define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st))\r\n#define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st))\r\n\r\n#define sk_CMS_SignerInfo_new(cmp) SKM_sk_new(CMS_SignerInfo, (cmp))\r\n#define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo)\r\n#define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st))\r\n#define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st))\r\n#define sk_CMS_SignerInfo_value(st, i) SKM_sk_value(CMS_SignerInfo, (st), (i))\r\n#define sk_CMS_SignerInfo_set(st, i, val) SKM_sk_set(CMS_SignerInfo, (st), (i), (val))\r\n#define sk_CMS_SignerInfo_zero(st) SKM_sk_zero(CMS_SignerInfo, (st))\r\n#define sk_CMS_SignerInfo_push(st, val) SKM_sk_push(CMS_SignerInfo, (st), (val))\r\n#define sk_CMS_SignerInfo_unshift(st, val) SKM_sk_unshift(CMS_SignerInfo, (st), (val))\r\n#define sk_CMS_SignerInfo_find(st, val) SKM_sk_find(CMS_SignerInfo, (st), (val))\r\n#define sk_CMS_SignerInfo_find_ex(st, val) SKM_sk_find_ex(CMS_SignerInfo, (st), (val))\r\n#define sk_CMS_SignerInfo_delete(st, i) SKM_sk_delete(CMS_SignerInfo, (st), (i))\r\n#define sk_CMS_SignerInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_SignerInfo, (st), (ptr))\r\n#define sk_CMS_SignerInfo_insert(st, val, i) SKM_sk_insert(CMS_SignerInfo, (st), (val), (i))\r\n#define sk_CMS_SignerInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_SignerInfo, (st), (cmp))\r\n#define sk_CMS_SignerInfo_dup(st) SKM_sk_dup(CMS_SignerInfo, st)\r\n#define sk_CMS_SignerInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_SignerInfo, (st), (free_func))\r\n#define sk_CMS_SignerInfo_shift(st) SKM_sk_shift(CMS_SignerInfo, (st))\r\n#define sk_CMS_SignerInfo_pop(st) SKM_sk_pop(CMS_SignerInfo, (st))\r\n#define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st))\r\n#define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st))\r\n\r\n#define sk_CONF_IMODULE_new(cmp) SKM_sk_new(CONF_IMODULE, (cmp))\r\n#define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE)\r\n#define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st))\r\n#define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st))\r\n#define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i))\r\n#define sk_CONF_IMODULE_set(st, i, val) SKM_sk_set(CONF_IMODULE, (st), (i), (val))\r\n#define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st))\r\n#define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val))\r\n#define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val))\r\n#define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val))\r\n#define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val))\r\n#define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i))\r\n#define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr))\r\n#define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i))\r\n#define sk_CONF_IMODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp))\r\n#define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st)\r\n#define sk_CONF_IMODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_IMODULE, (st), (free_func))\r\n#define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st))\r\n#define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st))\r\n#define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st))\r\n#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st))\r\n\r\n#define sk_CONF_MODULE_new(cmp) SKM_sk_new(CONF_MODULE, (cmp))\r\n#define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE)\r\n#define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st))\r\n#define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st))\r\n#define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i))\r\n#define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val))\r\n#define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st))\r\n#define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val))\r\n#define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val))\r\n#define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val))\r\n#define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val))\r\n#define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i))\r\n#define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr))\r\n#define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i))\r\n#define sk_CONF_MODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp))\r\n#define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st)\r\n#define sk_CONF_MODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_MODULE, (st), (free_func))\r\n#define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st))\r\n#define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st))\r\n#define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st))\r\n#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st))\r\n\r\n#define sk_CONF_VALUE_new(cmp) SKM_sk_new(CONF_VALUE, (cmp))\r\n#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE)\r\n#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st))\r\n#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st))\r\n#define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i))\r\n#define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val))\r\n#define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st))\r\n#define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val))\r\n#define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val))\r\n#define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val))\r\n#define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val))\r\n#define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i))\r\n#define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr))\r\n#define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i))\r\n#define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp))\r\n#define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st)\r\n#define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func))\r\n#define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st))\r\n#define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st))\r\n#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st))\r\n#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st))\r\n\r\n#define sk_CRYPTO_EX_DATA_FUNCS_new(cmp) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (cmp))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS)\r\n#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st)\r\n#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st))\r\n#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st))\r\n\r\n#define sk_CRYPTO_dynlock_new(cmp) SKM_sk_new(CRYPTO_dynlock, (cmp))\r\n#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock)\r\n#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st))\r\n#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st))\r\n#define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i))\r\n#define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val))\r\n#define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st))\r\n#define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val))\r\n#define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val))\r\n#define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val))\r\n#define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val))\r\n#define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i))\r\n#define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr))\r\n#define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i))\r\n#define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp))\r\n#define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st)\r\n#define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func))\r\n#define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st))\r\n#define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st))\r\n#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st))\r\n#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st))\r\n\r\n#define sk_DIST_POINT_new(cmp) SKM_sk_new(DIST_POINT, (cmp))\r\n#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT)\r\n#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st))\r\n#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st))\r\n#define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i))\r\n#define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val))\r\n#define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st))\r\n#define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val))\r\n#define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val))\r\n#define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val))\r\n#define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val))\r\n#define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i))\r\n#define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr))\r\n#define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i))\r\n#define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp))\r\n#define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st)\r\n#define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func))\r\n#define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st))\r\n#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st))\r\n#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))\r\n#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st))\r\n\r\n#define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp))\r\n#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE)\r\n#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st))\r\n#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st))\r\n#define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i))\r\n#define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val))\r\n#define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st))\r\n#define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val))\r\n#define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val))\r\n#define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val))\r\n#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val))\r\n#define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i))\r\n#define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr))\r\n#define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i))\r\n#define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp))\r\n#define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st)\r\n#define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func))\r\n#define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st))\r\n#define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st))\r\n#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st))\r\n#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st))\r\n\r\n#define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (cmp))\r\n#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM)\r\n#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st))\r\n#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st))\r\n#define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i))\r\n#define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val))\r\n#define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st))\r\n#define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val))\r\n#define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val))\r\n#define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val))\r\n#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val))\r\n#define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i))\r\n#define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr))\r\n#define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i))\r\n#define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp))\r\n#define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st)\r\n#define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func))\r\n#define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st))\r\n#define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st))\r\n#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st))\r\n#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st))\r\n\r\n#define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp))\r\n#define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID)\r\n#define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st))\r\n#define sk_ESS_CERT_ID_num(st) SKM_sk_num(ESS_CERT_ID, (st))\r\n#define sk_ESS_CERT_ID_value(st, i) SKM_sk_value(ESS_CERT_ID, (st), (i))\r\n#define sk_ESS_CERT_ID_set(st, i, val) SKM_sk_set(ESS_CERT_ID, (st), (i), (val))\r\n#define sk_ESS_CERT_ID_zero(st) SKM_sk_zero(ESS_CERT_ID, (st))\r\n#define sk_ESS_CERT_ID_push(st, val) SKM_sk_push(ESS_CERT_ID, (st), (val))\r\n#define sk_ESS_CERT_ID_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID, (st), (val))\r\n#define sk_ESS_CERT_ID_find(st, val) SKM_sk_find(ESS_CERT_ID, (st), (val))\r\n#define sk_ESS_CERT_ID_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID, (st), (val))\r\n#define sk_ESS_CERT_ID_delete(st, i) SKM_sk_delete(ESS_CERT_ID, (st), (i))\r\n#define sk_ESS_CERT_ID_delete_ptr(st, ptr) SKM_sk_delete_ptr(ESS_CERT_ID, (st), (ptr))\r\n#define sk_ESS_CERT_ID_insert(st, val, i) SKM_sk_insert(ESS_CERT_ID, (st), (val), (i))\r\n#define sk_ESS_CERT_ID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ESS_CERT_ID, (st), (cmp))\r\n#define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st)\r\n#define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func))\r\n#define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st))\r\n#define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st))\r\n#define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st))\r\n#define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st))\r\n\r\n#define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp))\r\n#define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD)\r\n#define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st))\r\n#define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st))\r\n#define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i))\r\n#define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val))\r\n#define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st))\r\n#define sk_EVP_MD_push(st, val) SKM_sk_push(EVP_MD, (st), (val))\r\n#define sk_EVP_MD_unshift(st, val) SKM_sk_unshift(EVP_MD, (st), (val))\r\n#define sk_EVP_MD_find(st, val) SKM_sk_find(EVP_MD, (st), (val))\r\n#define sk_EVP_MD_find_ex(st, val) SKM_sk_find_ex(EVP_MD, (st), (val))\r\n#define sk_EVP_MD_delete(st, i) SKM_sk_delete(EVP_MD, (st), (i))\r\n#define sk_EVP_MD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_MD, (st), (ptr))\r\n#define sk_EVP_MD_insert(st, val, i) SKM_sk_insert(EVP_MD, (st), (val), (i))\r\n#define sk_EVP_MD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_MD, (st), (cmp))\r\n#define sk_EVP_MD_dup(st) SKM_sk_dup(EVP_MD, st)\r\n#define sk_EVP_MD_pop_free(st, free_func) SKM_sk_pop_free(EVP_MD, (st), (free_func))\r\n#define sk_EVP_MD_shift(st) SKM_sk_shift(EVP_MD, (st))\r\n#define sk_EVP_MD_pop(st) SKM_sk_pop(EVP_MD, (st))\r\n#define sk_EVP_MD_sort(st) SKM_sk_sort(EVP_MD, (st))\r\n#define sk_EVP_MD_is_sorted(st) SKM_sk_is_sorted(EVP_MD, (st))\r\n\r\n#define sk_EVP_PBE_CTL_new(cmp) SKM_sk_new(EVP_PBE_CTL, (cmp))\r\n#define sk_EVP_PBE_CTL_new_null() SKM_sk_new_null(EVP_PBE_CTL)\r\n#define sk_EVP_PBE_CTL_free(st) SKM_sk_free(EVP_PBE_CTL, (st))\r\n#define sk_EVP_PBE_CTL_num(st) SKM_sk_num(EVP_PBE_CTL, (st))\r\n#define sk_EVP_PBE_CTL_value(st, i) SKM_sk_value(EVP_PBE_CTL, (st), (i))\r\n#define sk_EVP_PBE_CTL_set(st, i, val) SKM_sk_set(EVP_PBE_CTL, (st), (i), (val))\r\n#define sk_EVP_PBE_CTL_zero(st) SKM_sk_zero(EVP_PBE_CTL, (st))\r\n#define sk_EVP_PBE_CTL_push(st, val) SKM_sk_push(EVP_PBE_CTL, (st), (val))\r\n#define sk_EVP_PBE_CTL_unshift(st, val) SKM_sk_unshift(EVP_PBE_CTL, (st), (val))\r\n#define sk_EVP_PBE_CTL_find(st, val) SKM_sk_find(EVP_PBE_CTL, (st), (val))\r\n#define sk_EVP_PBE_CTL_find_ex(st, val) SKM_sk_find_ex(EVP_PBE_CTL, (st), (val))\r\n#define sk_EVP_PBE_CTL_delete(st, i) SKM_sk_delete(EVP_PBE_CTL, (st), (i))\r\n#define sk_EVP_PBE_CTL_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PBE_CTL, (st), (ptr))\r\n#define sk_EVP_PBE_CTL_insert(st, val, i) SKM_sk_insert(EVP_PBE_CTL, (st), (val), (i))\r\n#define sk_EVP_PBE_CTL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PBE_CTL, (st), (cmp))\r\n#define sk_EVP_PBE_CTL_dup(st) SKM_sk_dup(EVP_PBE_CTL, st)\r\n#define sk_EVP_PBE_CTL_pop_free(st, free_func) SKM_sk_pop_free(EVP_PBE_CTL, (st), (free_func))\r\n#define sk_EVP_PBE_CTL_shift(st) SKM_sk_shift(EVP_PBE_CTL, (st))\r\n#define sk_EVP_PBE_CTL_pop(st) SKM_sk_pop(EVP_PBE_CTL, (st))\r\n#define sk_EVP_PBE_CTL_sort(st) SKM_sk_sort(EVP_PBE_CTL, (st))\r\n#define sk_EVP_PBE_CTL_is_sorted(st) SKM_sk_is_sorted(EVP_PBE_CTL, (st))\r\n\r\n#define sk_EVP_PKEY_ASN1_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_ASN1_METHOD, (cmp))\r\n#define sk_EVP_PKEY_ASN1_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_ASN1_METHOD)\r\n#define sk_EVP_PKEY_ASN1_METHOD_free(st) SKM_sk_free(EVP_PKEY_ASN1_METHOD, (st))\r\n#define sk_EVP_PKEY_ASN1_METHOD_num(st) SKM_sk_num(EVP_PKEY_ASN1_METHOD, (st))\r\n#define sk_EVP_PKEY_ASN1_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_ASN1_METHOD, (st), (i))\r\n#define sk_EVP_PKEY_ASN1_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_ASN1_METHOD, (st), (i), (val))\r\n#define sk_EVP_PKEY_ASN1_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_ASN1_METHOD, (st))\r\n#define sk_EVP_PKEY_ASN1_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_ASN1_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_ASN1_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_ASN1_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_ASN1_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_ASN1_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_ASN1_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_ASN1_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_ASN1_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_ASN1_METHOD, (st), (i))\r\n#define sk_EVP_PKEY_ASN1_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_ASN1_METHOD, (st), (ptr))\r\n#define sk_EVP_PKEY_ASN1_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_ASN1_METHOD, (st), (val), (i))\r\n#define sk_EVP_PKEY_ASN1_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_ASN1_METHOD, (st), (cmp))\r\n#define sk_EVP_PKEY_ASN1_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_ASN1_METHOD, st)\r\n#define sk_EVP_PKEY_ASN1_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_ASN1_METHOD, (st), (free_func))\r\n#define sk_EVP_PKEY_ASN1_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_ASN1_METHOD, (st))\r\n#define sk_EVP_PKEY_ASN1_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_ASN1_METHOD, (st))\r\n#define sk_EVP_PKEY_ASN1_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_ASN1_METHOD, (st))\r\n#define sk_EVP_PKEY_ASN1_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_ASN1_METHOD, (st))\r\n\r\n#define sk_EVP_PKEY_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_METHOD, (cmp))\r\n#define sk_EVP_PKEY_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_METHOD)\r\n#define sk_EVP_PKEY_METHOD_free(st) SKM_sk_free(EVP_PKEY_METHOD, (st))\r\n#define sk_EVP_PKEY_METHOD_num(st) SKM_sk_num(EVP_PKEY_METHOD, (st))\r\n#define sk_EVP_PKEY_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_METHOD, (st), (i))\r\n#define sk_EVP_PKEY_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_METHOD, (st), (i), (val))\r\n#define sk_EVP_PKEY_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_METHOD, (st))\r\n#define sk_EVP_PKEY_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_METHOD, (st), (val))\r\n#define sk_EVP_PKEY_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_METHOD, (st), (i))\r\n#define sk_EVP_PKEY_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_METHOD, (st), (ptr))\r\n#define sk_EVP_PKEY_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_METHOD, (st), (val), (i))\r\n#define sk_EVP_PKEY_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_METHOD, (st), (cmp))\r\n#define sk_EVP_PKEY_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_METHOD, st)\r\n#define sk_EVP_PKEY_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_METHOD, (st), (free_func))\r\n#define sk_EVP_PKEY_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_METHOD, (st))\r\n#define sk_EVP_PKEY_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_METHOD, (st))\r\n#define sk_EVP_PKEY_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_METHOD, (st))\r\n#define sk_EVP_PKEY_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_METHOD, (st))\r\n\r\n#define sk_GENERAL_NAME_new(cmp) SKM_sk_new(GENERAL_NAME, (cmp))\r\n#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME)\r\n#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st))\r\n#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st))\r\n#define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i))\r\n#define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val))\r\n#define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st))\r\n#define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val))\r\n#define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val))\r\n#define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val))\r\n#define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val))\r\n#define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i))\r\n#define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr))\r\n#define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i))\r\n#define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp))\r\n#define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st)\r\n#define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func))\r\n#define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st))\r\n#define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st))\r\n#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st))\r\n#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st))\r\n\r\n#define sk_GENERAL_NAMES_new(cmp) SKM_sk_new(GENERAL_NAMES, (cmp))\r\n#define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES)\r\n#define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st))\r\n#define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st))\r\n#define sk_GENERAL_NAMES_value(st, i) SKM_sk_value(GENERAL_NAMES, (st), (i))\r\n#define sk_GENERAL_NAMES_set(st, i, val) SKM_sk_set(GENERAL_NAMES, (st), (i), (val))\r\n#define sk_GENERAL_NAMES_zero(st) SKM_sk_zero(GENERAL_NAMES, (st))\r\n#define sk_GENERAL_NAMES_push(st, val) SKM_sk_push(GENERAL_NAMES, (st), (val))\r\n#define sk_GENERAL_NAMES_unshift(st, val) SKM_sk_unshift(GENERAL_NAMES, (st), (val))\r\n#define sk_GENERAL_NAMES_find(st, val) SKM_sk_find(GENERAL_NAMES, (st), (val))\r\n#define sk_GENERAL_NAMES_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAMES, (st), (val))\r\n#define sk_GENERAL_NAMES_delete(st, i) SKM_sk_delete(GENERAL_NAMES, (st), (i))\r\n#define sk_GENERAL_NAMES_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAMES, (st), (ptr))\r\n#define sk_GENERAL_NAMES_insert(st, val, i) SKM_sk_insert(GENERAL_NAMES, (st), (val), (i))\r\n#define sk_GENERAL_NAMES_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAMES, (st), (cmp))\r\n#define sk_GENERAL_NAMES_dup(st) SKM_sk_dup(GENERAL_NAMES, st)\r\n#define sk_GENERAL_NAMES_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAMES, (st), (free_func))\r\n#define sk_GENERAL_NAMES_shift(st) SKM_sk_shift(GENERAL_NAMES, (st))\r\n#define sk_GENERAL_NAMES_pop(st) SKM_sk_pop(GENERAL_NAMES, (st))\r\n#define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st))\r\n#define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st))\r\n\r\n#define sk_GENERAL_SUBTREE_new(cmp) SKM_sk_new(GENERAL_SUBTREE, (cmp))\r\n#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE)\r\n#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st))\r\n#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st))\r\n#define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i))\r\n#define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val))\r\n#define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st))\r\n#define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val))\r\n#define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val))\r\n#define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val))\r\n#define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val))\r\n#define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i))\r\n#define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr))\r\n#define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i))\r\n#define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp))\r\n#define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st)\r\n#define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func))\r\n#define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st))\r\n#define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st))\r\n#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st))\r\n#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st))\r\n\r\n#define sk_IPAddressFamily_new(cmp) SKM_sk_new(IPAddressFamily, (cmp))\r\n#define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily)\r\n#define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st))\r\n#define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st))\r\n#define sk_IPAddressFamily_value(st, i) SKM_sk_value(IPAddressFamily, (st), (i))\r\n#define sk_IPAddressFamily_set(st, i, val) SKM_sk_set(IPAddressFamily, (st), (i), (val))\r\n#define sk_IPAddressFamily_zero(st) SKM_sk_zero(IPAddressFamily, (st))\r\n#define sk_IPAddressFamily_push(st, val) SKM_sk_push(IPAddressFamily, (st), (val))\r\n#define sk_IPAddressFamily_unshift(st, val) SKM_sk_unshift(IPAddressFamily, (st), (val))\r\n#define sk_IPAddressFamily_find(st, val) SKM_sk_find(IPAddressFamily, (st), (val))\r\n#define sk_IPAddressFamily_find_ex(st, val) SKM_sk_find_ex(IPAddressFamily, (st), (val))\r\n#define sk_IPAddressFamily_delete(st, i) SKM_sk_delete(IPAddressFamily, (st), (i))\r\n#define sk_IPAddressFamily_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressFamily, (st), (ptr))\r\n#define sk_IPAddressFamily_insert(st, val, i) SKM_sk_insert(IPAddressFamily, (st), (val), (i))\r\n#define sk_IPAddressFamily_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressFamily, (st), (cmp))\r\n#define sk_IPAddressFamily_dup(st) SKM_sk_dup(IPAddressFamily, st)\r\n#define sk_IPAddressFamily_pop_free(st, free_func) SKM_sk_pop_free(IPAddressFamily, (st), (free_func))\r\n#define sk_IPAddressFamily_shift(st) SKM_sk_shift(IPAddressFamily, (st))\r\n#define sk_IPAddressFamily_pop(st) SKM_sk_pop(IPAddressFamily, (st))\r\n#define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st))\r\n#define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st))\r\n\r\n#define sk_IPAddressOrRange_new(cmp) SKM_sk_new(IPAddressOrRange, (cmp))\r\n#define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange)\r\n#define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st))\r\n#define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st))\r\n#define sk_IPAddressOrRange_value(st, i) SKM_sk_value(IPAddressOrRange, (st), (i))\r\n#define sk_IPAddressOrRange_set(st, i, val) SKM_sk_set(IPAddressOrRange, (st), (i), (val))\r\n#define sk_IPAddressOrRange_zero(st) SKM_sk_zero(IPAddressOrRange, (st))\r\n#define sk_IPAddressOrRange_push(st, val) SKM_sk_push(IPAddressOrRange, (st), (val))\r\n#define sk_IPAddressOrRange_unshift(st, val) SKM_sk_unshift(IPAddressOrRange, (st), (val))\r\n#define sk_IPAddressOrRange_find(st, val) SKM_sk_find(IPAddressOrRange, (st), (val))\r\n#define sk_IPAddressOrRange_find_ex(st, val) SKM_sk_find_ex(IPAddressOrRange, (st), (val))\r\n#define sk_IPAddressOrRange_delete(st, i) SKM_sk_delete(IPAddressOrRange, (st), (i))\r\n#define sk_IPAddressOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressOrRange, (st), (ptr))\r\n#define sk_IPAddressOrRange_insert(st, val, i) SKM_sk_insert(IPAddressOrRange, (st), (val), (i))\r\n#define sk_IPAddressOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressOrRange, (st), (cmp))\r\n#define sk_IPAddressOrRange_dup(st) SKM_sk_dup(IPAddressOrRange, st)\r\n#define sk_IPAddressOrRange_pop_free(st, free_func) SKM_sk_pop_free(IPAddressOrRange, (st), (free_func))\r\n#define sk_IPAddressOrRange_shift(st) SKM_sk_shift(IPAddressOrRange, (st))\r\n#define sk_IPAddressOrRange_pop(st) SKM_sk_pop(IPAddressOrRange, (st))\r\n#define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st))\r\n#define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st))\r\n\r\n#define sk_KRB5_APREQBODY_new(cmp) SKM_sk_new(KRB5_APREQBODY, (cmp))\r\n#define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY)\r\n#define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st))\r\n#define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st))\r\n#define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i))\r\n#define sk_KRB5_APREQBODY_set(st, i, val) SKM_sk_set(KRB5_APREQBODY, (st), (i), (val))\r\n#define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st))\r\n#define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val))\r\n#define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val))\r\n#define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val))\r\n#define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val))\r\n#define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i))\r\n#define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr))\r\n#define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i))\r\n#define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp))\r\n#define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st)\r\n#define sk_KRB5_APREQBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func))\r\n#define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st))\r\n#define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st))\r\n#define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st))\r\n#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st))\r\n\r\n#define sk_KRB5_AUTHDATA_new(cmp) SKM_sk_new(KRB5_AUTHDATA, (cmp))\r\n#define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA)\r\n#define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st))\r\n#define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st))\r\n#define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i))\r\n#define sk_KRB5_AUTHDATA_set(st, i, val) SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val))\r\n#define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st))\r\n#define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val))\r\n#define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val))\r\n#define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val))\r\n#define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val))\r\n#define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i))\r\n#define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr))\r\n#define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i))\r\n#define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp))\r\n#define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st)\r\n#define sk_KRB5_AUTHDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func))\r\n#define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st))\r\n#define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st))\r\n#define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st))\r\n#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st))\r\n\r\n#define sk_KRB5_AUTHENTBODY_new(cmp) SKM_sk_new(KRB5_AUTHENTBODY, (cmp))\r\n#define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY)\r\n#define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st))\r\n#define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st))\r\n#define sk_KRB5_AUTHENTBODY_value(st, i) SKM_sk_value(KRB5_AUTHENTBODY, (st), (i))\r\n#define sk_KRB5_AUTHENTBODY_set(st, i, val) SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val))\r\n#define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st))\r\n#define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val))\r\n#define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val))\r\n#define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val))\r\n#define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val))\r\n#define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i))\r\n#define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr))\r\n#define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i))\r\n#define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp))\r\n#define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st)\r\n#define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func))\r\n#define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st))\r\n#define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st))\r\n#define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st))\r\n#define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st))\r\n\r\n#define sk_KRB5_CHECKSUM_new(cmp) SKM_sk_new(KRB5_CHECKSUM, (cmp))\r\n#define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM)\r\n#define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st))\r\n#define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st))\r\n#define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i))\r\n#define sk_KRB5_CHECKSUM_set(st, i, val) SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val))\r\n#define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st))\r\n#define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val))\r\n#define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val))\r\n#define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val))\r\n#define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val))\r\n#define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i))\r\n#define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr))\r\n#define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i))\r\n#define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp))\r\n#define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st)\r\n#define sk_KRB5_CHECKSUM_pop_free(st, free_func) SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func))\r\n#define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st))\r\n#define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st))\r\n#define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st))\r\n#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st))\r\n\r\n#define sk_KRB5_ENCDATA_new(cmp) SKM_sk_new(KRB5_ENCDATA, (cmp))\r\n#define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA)\r\n#define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st))\r\n#define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st))\r\n#define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i))\r\n#define sk_KRB5_ENCDATA_set(st, i, val) SKM_sk_set(KRB5_ENCDATA, (st), (i), (val))\r\n#define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st))\r\n#define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val))\r\n#define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val))\r\n#define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val))\r\n#define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val))\r\n#define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i))\r\n#define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr))\r\n#define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i))\r\n#define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp))\r\n#define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st)\r\n#define sk_KRB5_ENCDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func))\r\n#define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st))\r\n#define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st))\r\n#define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st))\r\n#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st))\r\n\r\n#define sk_KRB5_ENCKEY_new(cmp) SKM_sk_new(KRB5_ENCKEY, (cmp))\r\n#define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY)\r\n#define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st))\r\n#define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st))\r\n#define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i))\r\n#define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val))\r\n#define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st))\r\n#define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val))\r\n#define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val))\r\n#define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val))\r\n#define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val))\r\n#define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i))\r\n#define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr))\r\n#define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i))\r\n#define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp))\r\n#define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st)\r\n#define sk_KRB5_ENCKEY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func))\r\n#define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st))\r\n#define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st))\r\n#define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st))\r\n#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st))\r\n\r\n#define sk_KRB5_PRINCNAME_new(cmp) SKM_sk_new(KRB5_PRINCNAME, (cmp))\r\n#define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME)\r\n#define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st))\r\n#define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st))\r\n#define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i))\r\n#define sk_KRB5_PRINCNAME_set(st, i, val) SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val))\r\n#define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st))\r\n#define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val))\r\n#define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val))\r\n#define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val))\r\n#define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val))\r\n#define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i))\r\n#define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr))\r\n#define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i))\r\n#define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp))\r\n#define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st)\r\n#define sk_KRB5_PRINCNAME_pop_free(st, free_func) SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func))\r\n#define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st))\r\n#define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st))\r\n#define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st))\r\n#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st))\r\n\r\n#define sk_KRB5_TKTBODY_new(cmp) SKM_sk_new(KRB5_TKTBODY, (cmp))\r\n#define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY)\r\n#define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st))\r\n#define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st))\r\n#define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i))\r\n#define sk_KRB5_TKTBODY_set(st, i, val) SKM_sk_set(KRB5_TKTBODY, (st), (i), (val))\r\n#define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st))\r\n#define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val))\r\n#define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val))\r\n#define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val))\r\n#define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val))\r\n#define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i))\r\n#define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr))\r\n#define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i))\r\n#define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp))\r\n#define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st)\r\n#define sk_KRB5_TKTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func))\r\n#define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st))\r\n#define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st))\r\n#define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st))\r\n#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st))\r\n\r\n#define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp))\r\n#define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA)\r\n#define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st))\r\n#define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st))\r\n#define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st), (i))\r\n#define sk_MEM_OBJECT_DATA_set(st, i, val) SKM_sk_set(MEM_OBJECT_DATA, (st), (i), (val))\r\n#define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st))\r\n#define sk_MEM_OBJECT_DATA_push(st, val) SKM_sk_push(MEM_OBJECT_DATA, (st), (val))\r\n#define sk_MEM_OBJECT_DATA_unshift(st, val) SKM_sk_unshift(MEM_OBJECT_DATA, (st), (val))\r\n#define sk_MEM_OBJECT_DATA_find(st, val) SKM_sk_find(MEM_OBJECT_DATA, (st), (val))\r\n#define sk_MEM_OBJECT_DATA_find_ex(st, val) SKM_sk_find_ex(MEM_OBJECT_DATA, (st), (val))\r\n#define sk_MEM_OBJECT_DATA_delete(st, i) SKM_sk_delete(MEM_OBJECT_DATA, (st), (i))\r\n#define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(MEM_OBJECT_DATA, (st), (ptr))\r\n#define sk_MEM_OBJECT_DATA_insert(st, val, i) SKM_sk_insert(MEM_OBJECT_DATA, (st), (val), (i))\r\n#define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MEM_OBJECT_DATA, (st), (cmp))\r\n#define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st)\r\n#define sk_MEM_OBJECT_DATA_pop_free(st, free_func) SKM_sk_pop_free(MEM_OBJECT_DATA, (st), (free_func))\r\n#define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st))\r\n#define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st))\r\n#define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st))\r\n#define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA, (st))\r\n\r\n#define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp))\r\n#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER)\r\n#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st))\r\n#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st))\r\n#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i))\r\n#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val))\r\n#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st))\r\n#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val))\r\n#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val))\r\n#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val))\r\n#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val))\r\n#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i))\r\n#define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr))\r\n#define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i))\r\n#define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp))\r\n#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st)\r\n#define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func))\r\n#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st))\r\n#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st))\r\n#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st))\r\n#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st))\r\n\r\n#define sk_MIME_PARAM_new(cmp) SKM_sk_new(MIME_PARAM, (cmp))\r\n#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM)\r\n#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st))\r\n#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st))\r\n#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i))\r\n#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val))\r\n#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st))\r\n#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val))\r\n#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val))\r\n#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val))\r\n#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val))\r\n#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i))\r\n#define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr))\r\n#define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i))\r\n#define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp))\r\n#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st)\r\n#define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func))\r\n#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st))\r\n#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st))\r\n#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st))\r\n#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st))\r\n\r\n#define sk_NAME_FUNCS_new(cmp) SKM_sk_new(NAME_FUNCS, (cmp))\r\n#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS)\r\n#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st))\r\n#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st))\r\n#define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i))\r\n#define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val))\r\n#define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st))\r\n#define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val))\r\n#define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val))\r\n#define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val))\r\n#define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val))\r\n#define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i))\r\n#define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr))\r\n#define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i))\r\n#define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp))\r\n#define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st)\r\n#define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func))\r\n#define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st))\r\n#define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st))\r\n#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st))\r\n#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st))\r\n\r\n#define sk_OCSP_CERTID_new(cmp) SKM_sk_new(OCSP_CERTID, (cmp))\r\n#define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID)\r\n#define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st))\r\n#define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st))\r\n#define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i))\r\n#define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val))\r\n#define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st))\r\n#define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val))\r\n#define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val))\r\n#define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val))\r\n#define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val))\r\n#define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i))\r\n#define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr))\r\n#define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i))\r\n#define sk_OCSP_CERTID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp))\r\n#define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st)\r\n#define sk_OCSP_CERTID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_CERTID, (st), (free_func))\r\n#define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st))\r\n#define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st))\r\n#define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st))\r\n#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st))\r\n\r\n#define sk_OCSP_ONEREQ_new(cmp) SKM_sk_new(OCSP_ONEREQ, (cmp))\r\n#define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ)\r\n#define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st))\r\n#define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st))\r\n#define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i))\r\n#define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val))\r\n#define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st))\r\n#define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val))\r\n#define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val))\r\n#define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val))\r\n#define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val))\r\n#define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i))\r\n#define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr))\r\n#define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i))\r\n#define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp))\r\n#define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st)\r\n#define sk_OCSP_ONEREQ_pop_free(st, free_func) SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func))\r\n#define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st))\r\n#define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st))\r\n#define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st))\r\n#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st))\r\n\r\n#define sk_OCSP_RESPID_new(cmp) SKM_sk_new(OCSP_RESPID, (cmp))\r\n#define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID)\r\n#define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st))\r\n#define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st))\r\n#define sk_OCSP_RESPID_value(st, i) SKM_sk_value(OCSP_RESPID, (st), (i))\r\n#define sk_OCSP_RESPID_set(st, i, val) SKM_sk_set(OCSP_RESPID, (st), (i), (val))\r\n#define sk_OCSP_RESPID_zero(st) SKM_sk_zero(OCSP_RESPID, (st))\r\n#define sk_OCSP_RESPID_push(st, val) SKM_sk_push(OCSP_RESPID, (st), (val))\r\n#define sk_OCSP_RESPID_unshift(st, val) SKM_sk_unshift(OCSP_RESPID, (st), (val))\r\n#define sk_OCSP_RESPID_find(st, val) SKM_sk_find(OCSP_RESPID, (st), (val))\r\n#define sk_OCSP_RESPID_find_ex(st, val) SKM_sk_find_ex(OCSP_RESPID, (st), (val))\r\n#define sk_OCSP_RESPID_delete(st, i) SKM_sk_delete(OCSP_RESPID, (st), (i))\r\n#define sk_OCSP_RESPID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_RESPID, (st), (ptr))\r\n#define sk_OCSP_RESPID_insert(st, val, i) SKM_sk_insert(OCSP_RESPID, (st), (val), (i))\r\n#define sk_OCSP_RESPID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_RESPID, (st), (cmp))\r\n#define sk_OCSP_RESPID_dup(st) SKM_sk_dup(OCSP_RESPID, st)\r\n#define sk_OCSP_RESPID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_RESPID, (st), (free_func))\r\n#define sk_OCSP_RESPID_shift(st) SKM_sk_shift(OCSP_RESPID, (st))\r\n#define sk_OCSP_RESPID_pop(st) SKM_sk_pop(OCSP_RESPID, (st))\r\n#define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st))\r\n#define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st))\r\n\r\n#define sk_OCSP_SINGLERESP_new(cmp) SKM_sk_new(OCSP_SINGLERESP, (cmp))\r\n#define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP)\r\n#define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st))\r\n#define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st))\r\n#define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i))\r\n#define sk_OCSP_SINGLERESP_set(st, i, val) SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val))\r\n#define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st))\r\n#define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val))\r\n#define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val))\r\n#define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val))\r\n#define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val))\r\n#define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i))\r\n#define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr))\r\n#define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i))\r\n#define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp))\r\n#define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st)\r\n#define sk_OCSP_SINGLERESP_pop_free(st, free_func) SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func))\r\n#define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st))\r\n#define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st))\r\n#define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st))\r\n#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st))\r\n\r\n#define sk_PKCS12_SAFEBAG_new(cmp) SKM_sk_new(PKCS12_SAFEBAG, (cmp))\r\n#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG)\r\n#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st))\r\n#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st))\r\n#define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i))\r\n#define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val))\r\n#define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st))\r\n#define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val))\r\n#define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val))\r\n#define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val))\r\n#define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val))\r\n#define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i))\r\n#define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr))\r\n#define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i))\r\n#define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp))\r\n#define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st)\r\n#define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func))\r\n#define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st))\r\n#define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st))\r\n#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st))\r\n#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st))\r\n\r\n#define sk_PKCS7_new(cmp) SKM_sk_new(PKCS7, (cmp))\r\n#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7)\r\n#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st))\r\n#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st))\r\n#define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i))\r\n#define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val))\r\n#define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st))\r\n#define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val))\r\n#define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val))\r\n#define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val))\r\n#define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val))\r\n#define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i))\r\n#define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr))\r\n#define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i))\r\n#define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp))\r\n#define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st)\r\n#define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func))\r\n#define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st))\r\n#define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st))\r\n#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st))\r\n#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st))\r\n\r\n#define sk_PKCS7_RECIP_INFO_new(cmp) SKM_sk_new(PKCS7_RECIP_INFO, (cmp))\r\n#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO)\r\n#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st))\r\n#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st))\r\n#define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i))\r\n#define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val))\r\n#define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st))\r\n#define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val))\r\n#define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val))\r\n#define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val))\r\n#define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val))\r\n#define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i))\r\n#define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr))\r\n#define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i))\r\n#define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp))\r\n#define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st)\r\n#define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func))\r\n#define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st))\r\n#define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st))\r\n#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st))\r\n#define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st))\r\n\r\n#define sk_PKCS7_SIGNER_INFO_new(cmp) SKM_sk_new(PKCS7_SIGNER_INFO, (cmp))\r\n#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO)\r\n#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st))\r\n#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st))\r\n#define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i))\r\n#define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val))\r\n#define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st))\r\n#define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val))\r\n#define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val))\r\n#define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val))\r\n#define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val))\r\n#define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i))\r\n#define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr))\r\n#define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i))\r\n#define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp))\r\n#define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st)\r\n#define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func))\r\n#define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st))\r\n#define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st))\r\n#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st))\r\n#define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st))\r\n\r\n#define sk_POLICYINFO_new(cmp) SKM_sk_new(POLICYINFO, (cmp))\r\n#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO)\r\n#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st))\r\n#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st))\r\n#define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i))\r\n#define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val))\r\n#define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st))\r\n#define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val))\r\n#define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val))\r\n#define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val))\r\n#define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val))\r\n#define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i))\r\n#define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr))\r\n#define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i))\r\n#define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp))\r\n#define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st)\r\n#define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func))\r\n#define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st))\r\n#define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st))\r\n#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st))\r\n#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st))\r\n\r\n#define sk_POLICYQUALINFO_new(cmp) SKM_sk_new(POLICYQUALINFO, (cmp))\r\n#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO)\r\n#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st))\r\n#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st))\r\n#define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i))\r\n#define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val))\r\n#define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st))\r\n#define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val))\r\n#define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val))\r\n#define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val))\r\n#define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val))\r\n#define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i))\r\n#define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr))\r\n#define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i))\r\n#define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp))\r\n#define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st)\r\n#define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func))\r\n#define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st))\r\n#define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st))\r\n#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st))\r\n#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st))\r\n\r\n#define sk_POLICY_MAPPING_new(cmp) SKM_sk_new(POLICY_MAPPING, (cmp))\r\n#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING)\r\n#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st))\r\n#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st))\r\n#define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i))\r\n#define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val))\r\n#define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st))\r\n#define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val))\r\n#define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val))\r\n#define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val))\r\n#define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val))\r\n#define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i))\r\n#define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr))\r\n#define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i))\r\n#define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp))\r\n#define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st)\r\n#define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func))\r\n#define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st))\r\n#define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st))\r\n#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st))\r\n#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st))\r\n\r\n#define sk_SRP_gN_new(cmp) SKM_sk_new(SRP_gN, (cmp))\r\n#define sk_SRP_gN_new_null() SKM_sk_new_null(SRP_gN)\r\n#define sk_SRP_gN_free(st) SKM_sk_free(SRP_gN, (st))\r\n#define sk_SRP_gN_num(st) SKM_sk_num(SRP_gN, (st))\r\n#define sk_SRP_gN_value(st, i) SKM_sk_value(SRP_gN, (st), (i))\r\n#define sk_SRP_gN_set(st, i, val) SKM_sk_set(SRP_gN, (st), (i), (val))\r\n#define sk_SRP_gN_zero(st) SKM_sk_zero(SRP_gN, (st))\r\n#define sk_SRP_gN_push(st, val) SKM_sk_push(SRP_gN, (st), (val))\r\n#define sk_SRP_gN_unshift(st, val) SKM_sk_unshift(SRP_gN, (st), (val))\r\n#define sk_SRP_gN_find(st, val) SKM_sk_find(SRP_gN, (st), (val))\r\n#define sk_SRP_gN_find_ex(st, val) SKM_sk_find_ex(SRP_gN, (st), (val))\r\n#define sk_SRP_gN_delete(st, i) SKM_sk_delete(SRP_gN, (st), (i))\r\n#define sk_SRP_gN_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN, (st), (ptr))\r\n#define sk_SRP_gN_insert(st, val, i) SKM_sk_insert(SRP_gN, (st), (val), (i))\r\n#define sk_SRP_gN_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN, (st), (cmp))\r\n#define sk_SRP_gN_dup(st) SKM_sk_dup(SRP_gN, st)\r\n#define sk_SRP_gN_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN, (st), (free_func))\r\n#define sk_SRP_gN_shift(st) SKM_sk_shift(SRP_gN, (st))\r\n#define sk_SRP_gN_pop(st) SKM_sk_pop(SRP_gN, (st))\r\n#define sk_SRP_gN_sort(st) SKM_sk_sort(SRP_gN, (st))\r\n#define sk_SRP_gN_is_sorted(st) SKM_sk_is_sorted(SRP_gN, (st))\r\n\r\n#define sk_SRP_gN_cache_new(cmp) SKM_sk_new(SRP_gN_cache, (cmp))\r\n#define sk_SRP_gN_cache_new_null() SKM_sk_new_null(SRP_gN_cache)\r\n#define sk_SRP_gN_cache_free(st) SKM_sk_free(SRP_gN_cache, (st))\r\n#define sk_SRP_gN_cache_num(st) SKM_sk_num(SRP_gN_cache, (st))\r\n#define sk_SRP_gN_cache_value(st, i) SKM_sk_value(SRP_gN_cache, (st), (i))\r\n#define sk_SRP_gN_cache_set(st, i, val) SKM_sk_set(SRP_gN_cache, (st), (i), (val))\r\n#define sk_SRP_gN_cache_zero(st) SKM_sk_zero(SRP_gN_cache, (st))\r\n#define sk_SRP_gN_cache_push(st, val) SKM_sk_push(SRP_gN_cache, (st), (val))\r\n#define sk_SRP_gN_cache_unshift(st, val) SKM_sk_unshift(SRP_gN_cache, (st), (val))\r\n#define sk_SRP_gN_cache_find(st, val) SKM_sk_find(SRP_gN_cache, (st), (val))\r\n#define sk_SRP_gN_cache_find_ex(st, val) SKM_sk_find_ex(SRP_gN_cache, (st), (val))\r\n#define sk_SRP_gN_cache_delete(st, i) SKM_sk_delete(SRP_gN_cache, (st), (i))\r\n#define sk_SRP_gN_cache_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN_cache, (st), (ptr))\r\n#define sk_SRP_gN_cache_insert(st, val, i) SKM_sk_insert(SRP_gN_cache, (st), (val), (i))\r\n#define sk_SRP_gN_cache_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN_cache, (st), (cmp))\r\n#define sk_SRP_gN_cache_dup(st) SKM_sk_dup(SRP_gN_cache, st)\r\n#define sk_SRP_gN_cache_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN_cache, (st), (free_func))\r\n#define sk_SRP_gN_cache_shift(st) SKM_sk_shift(SRP_gN_cache, (st))\r\n#define sk_SRP_gN_cache_pop(st) SKM_sk_pop(SRP_gN_cache, (st))\r\n#define sk_SRP_gN_cache_sort(st) SKM_sk_sort(SRP_gN_cache, (st))\r\n#define sk_SRP_gN_cache_is_sorted(st) SKM_sk_is_sorted(SRP_gN_cache, (st))\r\n\r\n#define sk_SRP_user_pwd_new(cmp) SKM_sk_new(SRP_user_pwd, (cmp))\r\n#define sk_SRP_user_pwd_new_null() SKM_sk_new_null(SRP_user_pwd)\r\n#define sk_SRP_user_pwd_free(st) SKM_sk_free(SRP_user_pwd, (st))\r\n#define sk_SRP_user_pwd_num(st) SKM_sk_num(SRP_user_pwd, (st))\r\n#define sk_SRP_user_pwd_value(st, i) SKM_sk_value(SRP_user_pwd, (st), (i))\r\n#define sk_SRP_user_pwd_set(st, i, val) SKM_sk_set(SRP_user_pwd, (st), (i), (val))\r\n#define sk_SRP_user_pwd_zero(st) SKM_sk_zero(SRP_user_pwd, (st))\r\n#define sk_SRP_user_pwd_push(st, val) SKM_sk_push(SRP_user_pwd, (st), (val))\r\n#define sk_SRP_user_pwd_unshift(st, val) SKM_sk_unshift(SRP_user_pwd, (st), (val))\r\n#define sk_SRP_user_pwd_find(st, val) SKM_sk_find(SRP_user_pwd, (st), (val))\r\n#define sk_SRP_user_pwd_find_ex(st, val) SKM_sk_find_ex(SRP_user_pwd, (st), (val))\r\n#define sk_SRP_user_pwd_delete(st, i) SKM_sk_delete(SRP_user_pwd, (st), (i))\r\n#define sk_SRP_user_pwd_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_user_pwd, (st), (ptr))\r\n#define sk_SRP_user_pwd_insert(st, val, i) SKM_sk_insert(SRP_user_pwd, (st), (val), (i))\r\n#define sk_SRP_user_pwd_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_user_pwd, (st), (cmp))\r\n#define sk_SRP_user_pwd_dup(st) SKM_sk_dup(SRP_user_pwd, st)\r\n#define sk_SRP_user_pwd_pop_free(st, free_func) SKM_sk_pop_free(SRP_user_pwd, (st), (free_func))\r\n#define sk_SRP_user_pwd_shift(st) SKM_sk_shift(SRP_user_pwd, (st))\r\n#define sk_SRP_user_pwd_pop(st) SKM_sk_pop(SRP_user_pwd, (st))\r\n#define sk_SRP_user_pwd_sort(st) SKM_sk_sort(SRP_user_pwd, (st))\r\n#define sk_SRP_user_pwd_is_sorted(st) SKM_sk_is_sorted(SRP_user_pwd, (st))\r\n\r\n#define sk_SRTP_PROTECTION_PROFILE_new(cmp) SKM_sk_new(SRTP_PROTECTION_PROFILE, (cmp))\r\n#define sk_SRTP_PROTECTION_PROFILE_new_null() SKM_sk_new_null(SRTP_PROTECTION_PROFILE)\r\n#define sk_SRTP_PROTECTION_PROFILE_free(st) SKM_sk_free(SRTP_PROTECTION_PROFILE, (st))\r\n#define sk_SRTP_PROTECTION_PROFILE_num(st) SKM_sk_num(SRTP_PROTECTION_PROFILE, (st))\r\n#define sk_SRTP_PROTECTION_PROFILE_value(st, i) SKM_sk_value(SRTP_PROTECTION_PROFILE, (st), (i))\r\n#define sk_SRTP_PROTECTION_PROFILE_set(st, i, val) SKM_sk_set(SRTP_PROTECTION_PROFILE, (st), (i), (val))\r\n#define sk_SRTP_PROTECTION_PROFILE_zero(st) SKM_sk_zero(SRTP_PROTECTION_PROFILE, (st))\r\n#define sk_SRTP_PROTECTION_PROFILE_push(st, val) SKM_sk_push(SRTP_PROTECTION_PROFILE, (st), (val))\r\n#define sk_SRTP_PROTECTION_PROFILE_unshift(st, val) SKM_sk_unshift(SRTP_PROTECTION_PROFILE, (st), (val))\r\n#define sk_SRTP_PROTECTION_PROFILE_find(st, val) SKM_sk_find(SRTP_PROTECTION_PROFILE, (st), (val))\r\n#define sk_SRTP_PROTECTION_PROFILE_find_ex(st, val) SKM_sk_find_ex(SRTP_PROTECTION_PROFILE, (st), (val))\r\n#define sk_SRTP_PROTECTION_PROFILE_delete(st, i) SKM_sk_delete(SRTP_PROTECTION_PROFILE, (st), (i))\r\n#define sk_SRTP_PROTECTION_PROFILE_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRTP_PROTECTION_PROFILE, (st), (ptr))\r\n#define sk_SRTP_PROTECTION_PROFILE_insert(st, val, i) SKM_sk_insert(SRTP_PROTECTION_PROFILE, (st), (val), (i))\r\n#define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRTP_PROTECTION_PROFILE, (st), (cmp))\r\n#define sk_SRTP_PROTECTION_PROFILE_dup(st) SKM_sk_dup(SRTP_PROTECTION_PROFILE, st)\r\n#define sk_SRTP_PROTECTION_PROFILE_pop_free(st, free_func) SKM_sk_pop_free(SRTP_PROTECTION_PROFILE, (st), (free_func))\r\n#define sk_SRTP_PROTECTION_PROFILE_shift(st) SKM_sk_shift(SRTP_PROTECTION_PROFILE, (st))\r\n#define sk_SRTP_PROTECTION_PROFILE_pop(st) SKM_sk_pop(SRTP_PROTECTION_PROFILE, (st))\r\n#define sk_SRTP_PROTECTION_PROFILE_sort(st) SKM_sk_sort(SRTP_PROTECTION_PROFILE, (st))\r\n#define sk_SRTP_PROTECTION_PROFILE_is_sorted(st) SKM_sk_is_sorted(SRTP_PROTECTION_PROFILE, (st))\r\n\r\n#define sk_SSL_CIPHER_new(cmp) SKM_sk_new(SSL_CIPHER, (cmp))\r\n#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER)\r\n#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st))\r\n#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st))\r\n#define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i))\r\n#define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val))\r\n#define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st))\r\n#define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val))\r\n#define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val))\r\n#define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val))\r\n#define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val))\r\n#define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i))\r\n#define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr))\r\n#define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i))\r\n#define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp))\r\n#define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st)\r\n#define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func))\r\n#define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st))\r\n#define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st))\r\n#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st))\r\n#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st))\r\n\r\n#define sk_SSL_COMP_new(cmp) SKM_sk_new(SSL_COMP, (cmp))\r\n#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP)\r\n#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st))\r\n#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st))\r\n#define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i))\r\n#define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val))\r\n#define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st))\r\n#define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val))\r\n#define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val))\r\n#define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val))\r\n#define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val))\r\n#define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i))\r\n#define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr))\r\n#define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i))\r\n#define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp))\r\n#define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st)\r\n#define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func))\r\n#define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st))\r\n#define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st))\r\n#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st))\r\n#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st))\r\n\r\n#define sk_STACK_OF_X509_NAME_ENTRY_new(cmp) SKM_sk_new(STACK_OF_X509_NAME_ENTRY, (cmp))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_new_null() SKM_sk_new_null(STACK_OF_X509_NAME_ENTRY)\r\n#define sk_STACK_OF_X509_NAME_ENTRY_free(st) SKM_sk_free(STACK_OF_X509_NAME_ENTRY, (st))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_num(st) SKM_sk_num(STACK_OF_X509_NAME_ENTRY, (st))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_value(st, i) SKM_sk_value(STACK_OF_X509_NAME_ENTRY, (st), (i))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(STACK_OF_X509_NAME_ENTRY, (st), (i), (val))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_zero(st) SKM_sk_zero(STACK_OF_X509_NAME_ENTRY, (st))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_push(st, val) SKM_sk_push(STACK_OF_X509_NAME_ENTRY, (st), (val))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(STACK_OF_X509_NAME_ENTRY, (st), (val))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_find(st, val) SKM_sk_find(STACK_OF_X509_NAME_ENTRY, (st), (val))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(STACK_OF_X509_NAME_ENTRY, (st), (val))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(STACK_OF_X509_NAME_ENTRY, (st), (i))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(STACK_OF_X509_NAME_ENTRY, (st), (ptr))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(STACK_OF_X509_NAME_ENTRY, (st), (val), (i))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STACK_OF_X509_NAME_ENTRY, (st), (cmp))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_dup(st) SKM_sk_dup(STACK_OF_X509_NAME_ENTRY, st)\r\n#define sk_STACK_OF_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(STACK_OF_X509_NAME_ENTRY, (st), (free_func))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_shift(st) SKM_sk_shift(STACK_OF_X509_NAME_ENTRY, (st))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_pop(st) SKM_sk_pop(STACK_OF_X509_NAME_ENTRY, (st))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_sort(st) SKM_sk_sort(STACK_OF_X509_NAME_ENTRY, (st))\r\n#define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(STACK_OF_X509_NAME_ENTRY, (st))\r\n\r\n#define sk_STORE_ATTR_INFO_new(cmp) SKM_sk_new(STORE_ATTR_INFO, (cmp))\r\n#define sk_STORE_ATTR_INFO_new_null() SKM_sk_new_null(STORE_ATTR_INFO)\r\n#define sk_STORE_ATTR_INFO_free(st) SKM_sk_free(STORE_ATTR_INFO, (st))\r\n#define sk_STORE_ATTR_INFO_num(st) SKM_sk_num(STORE_ATTR_INFO, (st))\r\n#define sk_STORE_ATTR_INFO_value(st, i) SKM_sk_value(STORE_ATTR_INFO, (st), (i))\r\n#define sk_STORE_ATTR_INFO_set(st, i, val) SKM_sk_set(STORE_ATTR_INFO, (st), (i), (val))\r\n#define sk_STORE_ATTR_INFO_zero(st) SKM_sk_zero(STORE_ATTR_INFO, (st))\r\n#define sk_STORE_ATTR_INFO_push(st, val) SKM_sk_push(STORE_ATTR_INFO, (st), (val))\r\n#define sk_STORE_ATTR_INFO_unshift(st, val) SKM_sk_unshift(STORE_ATTR_INFO, (st), (val))\r\n#define sk_STORE_ATTR_INFO_find(st, val) SKM_sk_find(STORE_ATTR_INFO, (st), (val))\r\n#define sk_STORE_ATTR_INFO_find_ex(st, val) SKM_sk_find_ex(STORE_ATTR_INFO, (st), (val))\r\n#define sk_STORE_ATTR_INFO_delete(st, i) SKM_sk_delete(STORE_ATTR_INFO, (st), (i))\r\n#define sk_STORE_ATTR_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_ATTR_INFO, (st), (ptr))\r\n#define sk_STORE_ATTR_INFO_insert(st, val, i) SKM_sk_insert(STORE_ATTR_INFO, (st), (val), (i))\r\n#define sk_STORE_ATTR_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_ATTR_INFO, (st), (cmp))\r\n#define sk_STORE_ATTR_INFO_dup(st) SKM_sk_dup(STORE_ATTR_INFO, st)\r\n#define sk_STORE_ATTR_INFO_pop_free(st, free_func) SKM_sk_pop_free(STORE_ATTR_INFO, (st), (free_func))\r\n#define sk_STORE_ATTR_INFO_shift(st) SKM_sk_shift(STORE_ATTR_INFO, (st))\r\n#define sk_STORE_ATTR_INFO_pop(st) SKM_sk_pop(STORE_ATTR_INFO, (st))\r\n#define sk_STORE_ATTR_INFO_sort(st) SKM_sk_sort(STORE_ATTR_INFO, (st))\r\n#define sk_STORE_ATTR_INFO_is_sorted(st) SKM_sk_is_sorted(STORE_ATTR_INFO, (st))\r\n\r\n#define sk_STORE_OBJECT_new(cmp) SKM_sk_new(STORE_OBJECT, (cmp))\r\n#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT)\r\n#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st))\r\n#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st))\r\n#define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i))\r\n#define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val))\r\n#define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st))\r\n#define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val))\r\n#define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val))\r\n#define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val))\r\n#define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val))\r\n#define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i))\r\n#define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr))\r\n#define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i))\r\n#define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp))\r\n#define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st)\r\n#define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func))\r\n#define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st))\r\n#define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st))\r\n#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st))\r\n#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st))\r\n\r\n#define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp))\r\n#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID)\r\n#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st))\r\n#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st))\r\n#define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i))\r\n#define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val))\r\n#define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st))\r\n#define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val))\r\n#define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val))\r\n#define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val))\r\n#define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val))\r\n#define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i))\r\n#define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr))\r\n#define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i))\r\n#define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp))\r\n#define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st)\r\n#define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func))\r\n#define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st))\r\n#define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st))\r\n#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st))\r\n#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st))\r\n\r\n#define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp))\r\n#define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING)\r\n#define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st))\r\n#define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st))\r\n#define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i))\r\n#define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val))\r\n#define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st))\r\n#define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val))\r\n#define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val))\r\n#define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val))\r\n#define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val))\r\n#define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i))\r\n#define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr))\r\n#define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i))\r\n#define sk_UI_STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(UI_STRING, (st), (cmp))\r\n#define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st)\r\n#define sk_UI_STRING_pop_free(st, free_func) SKM_sk_pop_free(UI_STRING, (st), (free_func))\r\n#define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st))\r\n#define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st))\r\n#define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st))\r\n#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st))\r\n\r\n#define sk_X509_new(cmp) SKM_sk_new(X509, (cmp))\r\n#define sk_X509_new_null() SKM_sk_new_null(X509)\r\n#define sk_X509_free(st) SKM_sk_free(X509, (st))\r\n#define sk_X509_num(st) SKM_sk_num(X509, (st))\r\n#define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i))\r\n#define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val))\r\n#define sk_X509_zero(st) SKM_sk_zero(X509, (st))\r\n#define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val))\r\n#define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val))\r\n#define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val))\r\n#define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val))\r\n#define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i))\r\n#define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr))\r\n#define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i))\r\n#define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp))\r\n#define sk_X509_dup(st) SKM_sk_dup(X509, st)\r\n#define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func))\r\n#define sk_X509_shift(st) SKM_sk_shift(X509, (st))\r\n#define sk_X509_pop(st) SKM_sk_pop(X509, (st))\r\n#define sk_X509_sort(st) SKM_sk_sort(X509, (st))\r\n#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st))\r\n\r\n#define sk_X509V3_EXT_METHOD_new(cmp) SKM_sk_new(X509V3_EXT_METHOD, (cmp))\r\n#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD)\r\n#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st))\r\n#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st))\r\n#define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i))\r\n#define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val))\r\n#define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st))\r\n#define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val))\r\n#define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val))\r\n#define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val))\r\n#define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val))\r\n#define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i))\r\n#define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr))\r\n#define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i))\r\n#define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp))\r\n#define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st)\r\n#define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func))\r\n#define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st))\r\n#define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st))\r\n#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st))\r\n#define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st))\r\n\r\n#define sk_X509_ALGOR_new(cmp) SKM_sk_new(X509_ALGOR, (cmp))\r\n#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR)\r\n#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st))\r\n#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st))\r\n#define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i))\r\n#define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val))\r\n#define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st))\r\n#define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val))\r\n#define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val))\r\n#define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val))\r\n#define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val))\r\n#define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i))\r\n#define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr))\r\n#define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i))\r\n#define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp))\r\n#define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st)\r\n#define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func))\r\n#define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st))\r\n#define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st))\r\n#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st))\r\n#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st))\r\n\r\n#define sk_X509_ATTRIBUTE_new(cmp) SKM_sk_new(X509_ATTRIBUTE, (cmp))\r\n#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE)\r\n#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st))\r\n#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st))\r\n#define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i))\r\n#define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val))\r\n#define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st))\r\n#define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val))\r\n#define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val))\r\n#define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val))\r\n#define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val))\r\n#define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i))\r\n#define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr))\r\n#define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i))\r\n#define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp))\r\n#define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st)\r\n#define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func))\r\n#define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st))\r\n#define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st))\r\n#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st))\r\n#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st))\r\n\r\n#define sk_X509_CRL_new(cmp) SKM_sk_new(X509_CRL, (cmp))\r\n#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL)\r\n#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st))\r\n#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st))\r\n#define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i))\r\n#define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val))\r\n#define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st))\r\n#define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val))\r\n#define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val))\r\n#define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val))\r\n#define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val))\r\n#define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i))\r\n#define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr))\r\n#define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i))\r\n#define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp))\r\n#define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st)\r\n#define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func))\r\n#define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st))\r\n#define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st))\r\n#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st))\r\n#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st))\r\n\r\n#define sk_X509_EXTENSION_new(cmp) SKM_sk_new(X509_EXTENSION, (cmp))\r\n#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION)\r\n#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st))\r\n#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st))\r\n#define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i))\r\n#define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val))\r\n#define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st))\r\n#define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val))\r\n#define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val))\r\n#define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val))\r\n#define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val))\r\n#define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i))\r\n#define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr))\r\n#define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i))\r\n#define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp))\r\n#define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st)\r\n#define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func))\r\n#define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st))\r\n#define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st))\r\n#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st))\r\n#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st))\r\n\r\n#define sk_X509_INFO_new(cmp) SKM_sk_new(X509_INFO, (cmp))\r\n#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO)\r\n#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st))\r\n#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st))\r\n#define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i))\r\n#define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val))\r\n#define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st))\r\n#define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val))\r\n#define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val))\r\n#define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val))\r\n#define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val))\r\n#define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i))\r\n#define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr))\r\n#define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i))\r\n#define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp))\r\n#define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st)\r\n#define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func))\r\n#define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st))\r\n#define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st))\r\n#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st))\r\n#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st))\r\n\r\n#define sk_X509_LOOKUP_new(cmp) SKM_sk_new(X509_LOOKUP, (cmp))\r\n#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP)\r\n#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st))\r\n#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st))\r\n#define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i))\r\n#define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val))\r\n#define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st))\r\n#define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val))\r\n#define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val))\r\n#define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val))\r\n#define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val))\r\n#define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i))\r\n#define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr))\r\n#define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i))\r\n#define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp))\r\n#define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st)\r\n#define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func))\r\n#define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st))\r\n#define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st))\r\n#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st))\r\n#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st))\r\n\r\n#define sk_X509_NAME_new(cmp) SKM_sk_new(X509_NAME, (cmp))\r\n#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)\r\n#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st))\r\n#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st))\r\n#define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i))\r\n#define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val))\r\n#define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st))\r\n#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val))\r\n#define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val))\r\n#define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val))\r\n#define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val))\r\n#define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i))\r\n#define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr))\r\n#define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i))\r\n#define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp))\r\n#define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st)\r\n#define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func))\r\n#define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st))\r\n#define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st))\r\n#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st))\r\n#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st))\r\n\r\n#define sk_X509_NAME_ENTRY_new(cmp) SKM_sk_new(X509_NAME_ENTRY, (cmp))\r\n#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY)\r\n#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st))\r\n#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st))\r\n#define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i))\r\n#define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val))\r\n#define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st))\r\n#define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val))\r\n#define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val))\r\n#define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val))\r\n#define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val))\r\n#define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i))\r\n#define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr))\r\n#define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i))\r\n#define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp))\r\n#define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st)\r\n#define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func))\r\n#define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st))\r\n#define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st))\r\n#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st))\r\n#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st))\r\n\r\n#define sk_X509_OBJECT_new(cmp) SKM_sk_new(X509_OBJECT, (cmp))\r\n#define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT)\r\n#define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st))\r\n#define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st))\r\n#define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i))\r\n#define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val))\r\n#define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st))\r\n#define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val))\r\n#define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val))\r\n#define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val))\r\n#define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val))\r\n#define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i))\r\n#define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr))\r\n#define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i))\r\n#define sk_X509_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp))\r\n#define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st)\r\n#define sk_X509_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(X509_OBJECT, (st), (free_func))\r\n#define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st))\r\n#define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st))\r\n#define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st))\r\n#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st))\r\n\r\n#define sk_X509_POLICY_DATA_new(cmp) SKM_sk_new(X509_POLICY_DATA, (cmp))\r\n#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA)\r\n#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st))\r\n#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st))\r\n#define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i))\r\n#define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val))\r\n#define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st))\r\n#define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val))\r\n#define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val))\r\n#define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val))\r\n#define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val))\r\n#define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i))\r\n#define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr))\r\n#define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i))\r\n#define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp))\r\n#define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st)\r\n#define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func))\r\n#define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st))\r\n#define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st))\r\n#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st))\r\n#define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st))\r\n\r\n#define sk_X509_POLICY_NODE_new(cmp) SKM_sk_new(X509_POLICY_NODE, (cmp))\r\n#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE)\r\n#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st))\r\n#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st))\r\n#define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i))\r\n#define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val))\r\n#define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st))\r\n#define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val))\r\n#define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val))\r\n#define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val))\r\n#define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val))\r\n#define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i))\r\n#define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr))\r\n#define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i))\r\n#define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp))\r\n#define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st)\r\n#define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func))\r\n#define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st))\r\n#define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st))\r\n#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st))\r\n#define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st))\r\n\r\n#define sk_X509_PURPOSE_new(cmp) SKM_sk_new(X509_PURPOSE, (cmp))\r\n#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE)\r\n#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st))\r\n#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st))\r\n#define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i))\r\n#define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val))\r\n#define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st))\r\n#define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val))\r\n#define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val))\r\n#define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val))\r\n#define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val))\r\n#define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i))\r\n#define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr))\r\n#define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i))\r\n#define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp))\r\n#define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st)\r\n#define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func))\r\n#define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st))\r\n#define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st))\r\n#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st))\r\n#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st))\r\n\r\n#define sk_X509_REVOKED_new(cmp) SKM_sk_new(X509_REVOKED, (cmp))\r\n#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED)\r\n#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st))\r\n#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st))\r\n#define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i))\r\n#define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val))\r\n#define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st))\r\n#define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val))\r\n#define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val))\r\n#define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val))\r\n#define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val))\r\n#define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i))\r\n#define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr))\r\n#define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i))\r\n#define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp))\r\n#define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st)\r\n#define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func))\r\n#define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st))\r\n#define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st))\r\n#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st))\r\n#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st))\r\n\r\n#define sk_X509_TRUST_new(cmp) SKM_sk_new(X509_TRUST, (cmp))\r\n#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST)\r\n#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st))\r\n#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st))\r\n#define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i))\r\n#define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val))\r\n#define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st))\r\n#define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val))\r\n#define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val))\r\n#define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val))\r\n#define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val))\r\n#define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i))\r\n#define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr))\r\n#define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i))\r\n#define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp))\r\n#define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st)\r\n#define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func))\r\n#define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st))\r\n#define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st))\r\n#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st))\r\n#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st))\r\n\r\n#define sk_X509_VERIFY_PARAM_new(cmp) SKM_sk_new(X509_VERIFY_PARAM, (cmp))\r\n#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM)\r\n#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st))\r\n#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st))\r\n#define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i))\r\n#define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val))\r\n#define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st))\r\n#define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val))\r\n#define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val))\r\n#define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val))\r\n#define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val))\r\n#define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i))\r\n#define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr))\r\n#define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i))\r\n#define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp))\r\n#define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st)\r\n#define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func))\r\n#define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st))\r\n#define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st))\r\n#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st))\r\n#define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st))\r\n\r\n#define sk_nid_triple_new(cmp) SKM_sk_new(nid_triple, (cmp))\r\n#define sk_nid_triple_new_null() SKM_sk_new_null(nid_triple)\r\n#define sk_nid_triple_free(st) SKM_sk_free(nid_triple, (st))\r\n#define sk_nid_triple_num(st) SKM_sk_num(nid_triple, (st))\r\n#define sk_nid_triple_value(st, i) SKM_sk_value(nid_triple, (st), (i))\r\n#define sk_nid_triple_set(st, i, val) SKM_sk_set(nid_triple, (st), (i), (val))\r\n#define sk_nid_triple_zero(st) SKM_sk_zero(nid_triple, (st))\r\n#define sk_nid_triple_push(st, val) SKM_sk_push(nid_triple, (st), (val))\r\n#define sk_nid_triple_unshift(st, val) SKM_sk_unshift(nid_triple, (st), (val))\r\n#define sk_nid_triple_find(st, val) SKM_sk_find(nid_triple, (st), (val))\r\n#define sk_nid_triple_find_ex(st, val) SKM_sk_find_ex(nid_triple, (st), (val))\r\n#define sk_nid_triple_delete(st, i) SKM_sk_delete(nid_triple, (st), (i))\r\n#define sk_nid_triple_delete_ptr(st, ptr) SKM_sk_delete_ptr(nid_triple, (st), (ptr))\r\n#define sk_nid_triple_insert(st, val, i) SKM_sk_insert(nid_triple, (st), (val), (i))\r\n#define sk_nid_triple_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(nid_triple, (st), (cmp))\r\n#define sk_nid_triple_dup(st) SKM_sk_dup(nid_triple, st)\r\n#define sk_nid_triple_pop_free(st, free_func) SKM_sk_pop_free(nid_triple, (st), (free_func))\r\n#define sk_nid_triple_shift(st) SKM_sk_shift(nid_triple, (st))\r\n#define sk_nid_triple_pop(st) SKM_sk_pop(nid_triple, (st))\r\n#define sk_nid_triple_sort(st) SKM_sk_sort(nid_triple, (st))\r\n#define sk_nid_triple_is_sorted(st) SKM_sk_is_sorted(nid_triple, (st))\r\n\r\n#define sk_void_new(cmp) SKM_sk_new(void, (cmp))\r\n#define sk_void_new_null() SKM_sk_new_null(void)\r\n#define sk_void_free(st) SKM_sk_free(void, (st))\r\n#define sk_void_num(st) SKM_sk_num(void, (st))\r\n#define sk_void_value(st, i) SKM_sk_value(void, (st), (i))\r\n#define sk_void_set(st, i, val) SKM_sk_set(void, (st), (i), (val))\r\n#define sk_void_zero(st) SKM_sk_zero(void, (st))\r\n#define sk_void_push(st, val) SKM_sk_push(void, (st), (val))\r\n#define sk_void_unshift(st, val) SKM_sk_unshift(void, (st), (val))\r\n#define sk_void_find(st, val) SKM_sk_find(void, (st), (val))\r\n#define sk_void_find_ex(st, val) SKM_sk_find_ex(void, (st), (val))\r\n#define sk_void_delete(st, i) SKM_sk_delete(void, (st), (i))\r\n#define sk_void_delete_ptr(st, ptr) SKM_sk_delete_ptr(void, (st), (ptr))\r\n#define sk_void_insert(st, val, i) SKM_sk_insert(void, (st), (val), (i))\r\n#define sk_void_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(void, (st), (cmp))\r\n#define sk_void_dup(st) SKM_sk_dup(void, st)\r\n#define sk_void_pop_free(st, free_func) SKM_sk_pop_free(void, (st), (free_func))\r\n#define sk_void_shift(st) SKM_sk_shift(void, (st))\r\n#define sk_void_pop(st) SKM_sk_pop(void, (st))\r\n#define sk_void_sort(st) SKM_sk_sort(void, (st))\r\n#define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st))\r\n\r\n#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp)))\r\n#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())\r\n#define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))\r\n#define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))\r\n#define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_STACK_OF(OPENSSL_STRING, st), i))\r\n#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)\r\n#define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))\r\n#define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val), i)\r\n#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)\r\n#define sk_OPENSSL_STRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_STRING, st), i, CHECKED_PTR_OF(char, val))\r\n#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))\r\n#define sk_OPENSSL_STRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))\r\n#define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))\r\n#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i))\r\n#define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr))\r\n#define sk_OPENSSL_STRING_set_cmp_func(st, cmp)  \\\r\n\t((int (*)(const char * const *,const char * const *)) \\\r\n\tsk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC(char, cmp)))\r\n#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)\r\n#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))\r\n#define sk_OPENSSL_STRING_pop(st) (char *)sk_pop(CHECKED_STACK_OF(OPENSSL_STRING, st))\r\n#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))\r\n#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))\r\n\r\n\r\n#define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp)))\r\n#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())\r\n#define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))\r\n#define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))\r\n#define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i))\r\n#define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st)\r\n#define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func))\r\n#define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i)\r\n#define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st)\r\n#define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val))\r\n#define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st))\r\n#define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))\r\n#define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val))\r\n#define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i))\r\n#define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr))\r\n#define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp)  \\\r\n\t((int (*)(const void * const *,const void * const *)) \\\r\n\tsk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp)))\r\n#define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st)\r\n#define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st))\r\n#define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st))\r\n#define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st))\r\n#define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st))\r\n\r\n\r\n#define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))\r\n#define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null())\r\n#define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))\r\n#define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))\r\n#define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i))\r\n#define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st)\r\n#define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_func))\r\n#define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val), i)\r\n#define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st)\r\n#define sk_OPENSSL_PSTRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i, CHECKED_PTR_OF(OPENSSL_STRING, val))\r\n#define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st))\r\n#define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))\r\n#define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_STRING, val))\r\n#define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i))\r\n#define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, ptr))\r\n#define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp)  \\\r\n\t((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \\\r\n\tsk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))\r\n#define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st)\r\n#define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st))\r\n#define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop(CHECKED_STACK_OF(OPENSSL_PSTRING, st))\r\n#define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st))\r\n#define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st))\r\n\r\n\r\n#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(ASN1_UTF8STRING, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(ASN1_UTF8STRING, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_ASN1_UTF8STRING(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(ASN1_UTF8STRING, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_ASN1_UTF8STRING(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(ASN1_UTF8STRING, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_ESS_CERT_ID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(ESS_CERT_ID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_ESS_CERT_ID(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(ESS_CERT_ID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_ESS_CERT_ID(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(ESS_CERT_ID, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_ESS_CERT_ID(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(ESS_CERT_ID, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_EVP_MD(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(EVP_MD, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_EVP_MD(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(EVP_MD, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_EVP_MD(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(EVP_MD, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_EVP_MD(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(EVP_MD, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\r\n\tSKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \r\n#define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\r\n\tSKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\r\n#define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \\\r\n\tSKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len))\r\n#define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \\\r\n\tSKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func))\r\n\r\n#define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \\\r\n\tSKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))\r\n\r\n#define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \\\r\n\tSKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))\r\n\r\n#define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ,added_obj)\r\n#define lh_ADDED_OBJ_insert(lh,inst) LHM_lh_insert(ADDED_OBJ,lh,inst)\r\n#define lh_ADDED_OBJ_retrieve(lh,inst) LHM_lh_retrieve(ADDED_OBJ,lh,inst)\r\n#define lh_ADDED_OBJ_delete(lh,inst) LHM_lh_delete(ADDED_OBJ,lh,inst)\r\n#define lh_ADDED_OBJ_doall(lh,fn) LHM_lh_doall(ADDED_OBJ,lh,fn)\r\n#define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg)\r\n#define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh)\r\n#define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh)\r\n#define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ,lh)\r\n#define lh_ADDED_OBJ_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(ADDED_OBJ,lh,out)\r\n#define lh_ADDED_OBJ_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(ADDED_OBJ,lh,out)\r\n#define lh_ADDED_OBJ_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(ADDED_OBJ,lh,out)\r\n#define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh)\r\n\r\n#define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info)\r\n#define lh_APP_INFO_insert(lh,inst) LHM_lh_insert(APP_INFO,lh,inst)\r\n#define lh_APP_INFO_retrieve(lh,inst) LHM_lh_retrieve(APP_INFO,lh,inst)\r\n#define lh_APP_INFO_delete(lh,inst) LHM_lh_delete(APP_INFO,lh,inst)\r\n#define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn)\r\n#define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg)\r\n#define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO,lh)\r\n#define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO,lh)\r\n#define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO,lh)\r\n#define lh_APP_INFO_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(APP_INFO,lh,out)\r\n#define lh_APP_INFO_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(APP_INFO,lh,out)\r\n#define lh_APP_INFO_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(APP_INFO,lh,out)\r\n#define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO,lh)\r\n\r\n#define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value)\r\n#define lh_CONF_VALUE_insert(lh,inst) LHM_lh_insert(CONF_VALUE,lh,inst)\r\n#define lh_CONF_VALUE_retrieve(lh,inst) LHM_lh_retrieve(CONF_VALUE,lh,inst)\r\n#define lh_CONF_VALUE_delete(lh,inst) LHM_lh_delete(CONF_VALUE,lh,inst)\r\n#define lh_CONF_VALUE_doall(lh,fn) LHM_lh_doall(CONF_VALUE,lh,fn)\r\n#define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg)\r\n#define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh)\r\n#define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh)\r\n#define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE,lh)\r\n#define lh_CONF_VALUE_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(CONF_VALUE,lh,out)\r\n#define lh_CONF_VALUE_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(CONF_VALUE,lh,out)\r\n#define lh_CONF_VALUE_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(CONF_VALUE,lh,out)\r\n#define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh)\r\n\r\n#define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile)\r\n#define lh_ENGINE_PILE_insert(lh,inst) LHM_lh_insert(ENGINE_PILE,lh,inst)\r\n#define lh_ENGINE_PILE_retrieve(lh,inst) LHM_lh_retrieve(ENGINE_PILE,lh,inst)\r\n#define lh_ENGINE_PILE_delete(lh,inst) LHM_lh_delete(ENGINE_PILE,lh,inst)\r\n#define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn)\r\n#define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg)\r\n#define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE,lh)\r\n#define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE,lh)\r\n#define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE,lh)\r\n#define lh_ENGINE_PILE_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(ENGINE_PILE,lh,out)\r\n#define lh_ENGINE_PILE_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(ENGINE_PILE,lh,out)\r\n#define lh_ENGINE_PILE_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(ENGINE_PILE,lh,out)\r\n#define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE,lh)\r\n\r\n#define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state)\r\n#define lh_ERR_STATE_insert(lh,inst) LHM_lh_insert(ERR_STATE,lh,inst)\r\n#define lh_ERR_STATE_retrieve(lh,inst) LHM_lh_retrieve(ERR_STATE,lh,inst)\r\n#define lh_ERR_STATE_delete(lh,inst) LHM_lh_delete(ERR_STATE,lh,inst)\r\n#define lh_ERR_STATE_doall(lh,fn) LHM_lh_doall(ERR_STATE,lh,fn)\r\n#define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg)\r\n#define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh)\r\n#define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh)\r\n#define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE,lh)\r\n#define lh_ERR_STATE_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(ERR_STATE,lh,out)\r\n#define lh_ERR_STATE_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(ERR_STATE,lh,out)\r\n#define lh_ERR_STATE_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(ERR_STATE,lh,out)\r\n#define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh)\r\n\r\n#define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data)\r\n#define lh_ERR_STRING_DATA_insert(lh,inst) LHM_lh_insert(ERR_STRING_DATA,lh,inst)\r\n#define lh_ERR_STRING_DATA_retrieve(lh,inst) LHM_lh_retrieve(ERR_STRING_DATA,lh,inst)\r\n#define lh_ERR_STRING_DATA_delete(lh,inst) LHM_lh_delete(ERR_STRING_DATA,lh,inst)\r\n#define lh_ERR_STRING_DATA_doall(lh,fn) LHM_lh_doall(ERR_STRING_DATA,lh,fn)\r\n#define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg)\r\n#define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh)\r\n#define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,lh)\r\n#define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA,lh)\r\n#define lh_ERR_STRING_DATA_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(ERR_STRING_DATA,lh,out)\r\n#define lh_ERR_STRING_DATA_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(ERR_STRING_DATA,lh,out)\r\n#define lh_ERR_STRING_DATA_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(ERR_STRING_DATA,lh,out)\r\n#define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh)\r\n\r\n#define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item)\r\n#define lh_EX_CLASS_ITEM_insert(lh,inst) LHM_lh_insert(EX_CLASS_ITEM,lh,inst)\r\n#define lh_EX_CLASS_ITEM_retrieve(lh,inst) LHM_lh_retrieve(EX_CLASS_ITEM,lh,inst)\r\n#define lh_EX_CLASS_ITEM_delete(lh,inst) LHM_lh_delete(EX_CLASS_ITEM,lh,inst)\r\n#define lh_EX_CLASS_ITEM_doall(lh,fn) LHM_lh_doall(EX_CLASS_ITEM,lh,fn)\r\n#define lh_EX_CLASS_ITEM_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg)\r\n#define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh)\r\n#define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh)\r\n#define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM,lh)\r\n#define lh_EX_CLASS_ITEM_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(EX_CLASS_ITEM,lh,out)\r\n#define lh_EX_CLASS_ITEM_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(EX_CLASS_ITEM,lh,out)\r\n#define lh_EX_CLASS_ITEM_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(EX_CLASS_ITEM,lh,out)\r\n#define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh)\r\n\r\n#define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function)\r\n#define lh_FUNCTION_insert(lh,inst) LHM_lh_insert(FUNCTION,lh,inst)\r\n#define lh_FUNCTION_retrieve(lh,inst) LHM_lh_retrieve(FUNCTION,lh,inst)\r\n#define lh_FUNCTION_delete(lh,inst) LHM_lh_delete(FUNCTION,lh,inst)\r\n#define lh_FUNCTION_doall(lh,fn) LHM_lh_doall(FUNCTION,lh,fn)\r\n#define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg)\r\n#define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh)\r\n#define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh)\r\n#define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION,lh)\r\n#define lh_FUNCTION_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(FUNCTION,lh,out)\r\n#define lh_FUNCTION_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(FUNCTION,lh,out)\r\n#define lh_FUNCTION_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(FUNCTION,lh,out)\r\n#define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh)\r\n\r\n#define lh_MEM_new() LHM_lh_new(MEM,mem)\r\n#define lh_MEM_insert(lh,inst) LHM_lh_insert(MEM,lh,inst)\r\n#define lh_MEM_retrieve(lh,inst) LHM_lh_retrieve(MEM,lh,inst)\r\n#define lh_MEM_delete(lh,inst) LHM_lh_delete(MEM,lh,inst)\r\n#define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn)\r\n#define lh_MEM_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg)\r\n#define lh_MEM_error(lh) LHM_lh_error(MEM,lh)\r\n#define lh_MEM_num_items(lh) LHM_lh_num_items(MEM,lh)\r\n#define lh_MEM_down_load(lh) LHM_lh_down_load(MEM,lh)\r\n#define lh_MEM_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(MEM,lh,out)\r\n#define lh_MEM_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(MEM,lh,out)\r\n#define lh_MEM_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(MEM,lh,out)\r\n#define lh_MEM_free(lh) LHM_lh_free(MEM,lh)\r\n\r\n#define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name)\r\n#define lh_OBJ_NAME_insert(lh,inst) LHM_lh_insert(OBJ_NAME,lh,inst)\r\n#define lh_OBJ_NAME_retrieve(lh,inst) LHM_lh_retrieve(OBJ_NAME,lh,inst)\r\n#define lh_OBJ_NAME_delete(lh,inst) LHM_lh_delete(OBJ_NAME,lh,inst)\r\n#define lh_OBJ_NAME_doall(lh,fn) LHM_lh_doall(OBJ_NAME,lh,fn)\r\n#define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg)\r\n#define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh)\r\n#define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh)\r\n#define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME,lh)\r\n#define lh_OBJ_NAME_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(OBJ_NAME,lh,out)\r\n#define lh_OBJ_NAME_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(OBJ_NAME,lh,out)\r\n#define lh_OBJ_NAME_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(OBJ_NAME,lh,out)\r\n#define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh)\r\n\r\n#define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstring)\r\n#define lh_OPENSSL_CSTRING_insert(lh,inst) LHM_lh_insert(OPENSSL_CSTRING,lh,inst)\r\n#define lh_OPENSSL_CSTRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_CSTRING,lh,inst)\r\n#define lh_OPENSSL_CSTRING_delete(lh,inst) LHM_lh_delete(OPENSSL_CSTRING,lh,inst)\r\n#define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn)\r\n#define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg)\r\n#define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING,lh)\r\n#define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING,lh)\r\n#define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING,lh)\r\n#define lh_OPENSSL_CSTRING_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(OPENSSL_CSTRING,lh,out)\r\n#define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING,lh,out)\r\n#define lh_OPENSSL_CSTRING_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(OPENSSL_CSTRING,lh,out)\r\n#define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING,lh)\r\n\r\n#define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string)\r\n#define lh_OPENSSL_STRING_insert(lh,inst) LHM_lh_insert(OPENSSL_STRING,lh,inst)\r\n#define lh_OPENSSL_STRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_STRING,lh,inst)\r\n#define lh_OPENSSL_STRING_delete(lh,inst) LHM_lh_delete(OPENSSL_STRING,lh,inst)\r\n#define lh_OPENSSL_STRING_doall(lh,fn) LHM_lh_doall(OPENSSL_STRING,lh,fn)\r\n#define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg)\r\n#define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh)\r\n#define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh)\r\n#define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING,lh)\r\n#define lh_OPENSSL_STRING_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(OPENSSL_STRING,lh,out)\r\n#define lh_OPENSSL_STRING_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(OPENSSL_STRING,lh,out)\r\n#define lh_OPENSSL_STRING_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(OPENSSL_STRING,lh,out)\r\n#define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh)\r\n\r\n#define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session)\r\n#define lh_SSL_SESSION_insert(lh,inst) LHM_lh_insert(SSL_SESSION,lh,inst)\r\n#define lh_SSL_SESSION_retrieve(lh,inst) LHM_lh_retrieve(SSL_SESSION,lh,inst)\r\n#define lh_SSL_SESSION_delete(lh,inst) LHM_lh_delete(SSL_SESSION,lh,inst)\r\n#define lh_SSL_SESSION_doall(lh,fn) LHM_lh_doall(SSL_SESSION,lh,fn)\r\n#define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \\\r\n  LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg)\r\n#define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh)\r\n#define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh)\r\n#define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION,lh)\r\n#define lh_SSL_SESSION_node_stats_bio(lh,out) \\\r\n  LHM_lh_node_stats_bio(SSL_SESSION,lh,out)\r\n#define lh_SSL_SESSION_node_usage_stats_bio(lh,out) \\\r\n  LHM_lh_node_usage_stats_bio(SSL_SESSION,lh,out)\r\n#define lh_SSL_SESSION_stats_bio(lh,out) \\\r\n  LHM_lh_stats_bio(SSL_SESSION,lh,out)\r\n#define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh)\r\n/* End of util/mkstack.pl block, you may now edit :-) */\r\n\r\n#endif /* !defined HEADER_SAFESTACK_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/seed.h",
    "content": "/*\r\n * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.  \r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Neither the name of author nor the names of its contributors may\r\n *    be used to endorse or promote products derived from this software\r\n *    without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2007 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n\r\n#ifndef HEADER_SEED_H\r\n#define HEADER_SEED_H\r\n\r\n#include <openssl/opensslconf.h>\r\n#include <openssl/e_os2.h>\r\n#include <openssl/crypto.h>\r\n\r\n#ifdef OPENSSL_NO_SEED\r\n#error SEED is disabled.\r\n#endif\r\n\r\n#ifdef AES_LONG /* look whether we need 'long' to get 32 bits */\r\n# ifndef SEED_LONG\r\n#  define SEED_LONG 1\r\n# endif\r\n#endif\r\n\r\n#if !defined(NO_SYS_TYPES_H)\r\n# include <sys/types.h>\r\n#endif\r\n\r\n#define SEED_BLOCK_SIZE 16\r\n#define SEED_KEY_LENGTH\t16\r\n\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n\r\ntypedef struct seed_key_st {\r\n#ifdef SEED_LONG\r\n    unsigned long data[32];\r\n#else\r\n    unsigned int data[32];\r\n#endif\r\n} SEED_KEY_SCHEDULE;\r\n\r\n#ifdef OPENSSL_FIPS\r\nvoid private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks);\r\n#endif\r\nvoid SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks);\r\n\r\nvoid SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);\r\nvoid SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);\r\n\r\nvoid SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc);\r\nvoid SEED_cbc_encrypt(const unsigned char *in, unsigned char *out,\r\n        size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc);\r\nvoid SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,\r\n        size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc);\r\nvoid SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,\r\n        size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* HEADER_SEED_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/sha.h",
    "content": "/* crypto/sha/sha.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_SHA_H\r\n#define HEADER_SHA_H\r\n\r\n#include <openssl/e_os2.h>\r\n#include <stddef.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1))\r\n#error SHA is disabled.\r\n#endif\r\n\r\n#if defined(OPENSSL_FIPS)\r\n#define FIPS_SHA_SIZE_T size_t\r\n#endif\r\n\r\n/*\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !\r\n * ! SHA_LONG_LOG2 has to be defined along.                        !\r\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n */\r\n\r\n#if defined(__LP32__)\r\n#define SHA_LONG unsigned long\r\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\r\n#define SHA_LONG unsigned long\r\n#define SHA_LONG_LOG2 3\r\n#else\r\n#define SHA_LONG unsigned int\r\n#endif\r\n\r\n#define SHA_LBLOCK\t16\r\n#define SHA_CBLOCK\t(SHA_LBLOCK*4)\t/* SHA treats input data as a\r\n\t\t\t\t\t * contiguous array of 32 bit\r\n\t\t\t\t\t * wide big-endian values. */\r\n#define SHA_LAST_BLOCK  (SHA_CBLOCK-8)\r\n#define SHA_DIGEST_LENGTH 20\r\n\r\ntypedef struct SHAstate_st\r\n\t{\r\n\tSHA_LONG h0,h1,h2,h3,h4;\r\n\tSHA_LONG Nl,Nh;\r\n\tSHA_LONG data[SHA_LBLOCK];\r\n\tunsigned int num;\r\n\t} SHA_CTX;\r\n\r\n#ifndef OPENSSL_NO_SHA0\r\n#ifdef OPENSSL_FIPS\r\nint private_SHA_Init(SHA_CTX *c);\r\n#endif\r\nint SHA_Init(SHA_CTX *c);\r\nint SHA_Update(SHA_CTX *c, const void *data, size_t len);\r\nint SHA_Final(unsigned char *md, SHA_CTX *c);\r\nunsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);\r\nvoid SHA_Transform(SHA_CTX *c, const unsigned char *data);\r\n#endif\r\n#ifndef OPENSSL_NO_SHA1\r\n#ifdef OPENSSL_FIPS\r\nint private_SHA1_Init(SHA_CTX *c);\r\n#endif\r\nint SHA1_Init(SHA_CTX *c);\r\nint SHA1_Update(SHA_CTX *c, const void *data, size_t len);\r\nint SHA1_Final(unsigned char *md, SHA_CTX *c);\r\nunsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);\r\nvoid SHA1_Transform(SHA_CTX *c, const unsigned char *data);\r\n#endif\r\n\r\n#define SHA256_CBLOCK\t(SHA_LBLOCK*4)\t/* SHA-256 treats input data as a\r\n\t\t\t\t\t * contiguous array of 32 bit\r\n\t\t\t\t\t * wide big-endian values. */\r\n#define SHA224_DIGEST_LENGTH\t28\r\n#define SHA256_DIGEST_LENGTH\t32\r\n\r\ntypedef struct SHA256state_st\r\n\t{\r\n\tSHA_LONG h[8];\r\n\tSHA_LONG Nl,Nh;\r\n\tSHA_LONG data[SHA_LBLOCK];\r\n\tunsigned int num,md_len;\r\n\t} SHA256_CTX;\r\n\r\n#ifndef OPENSSL_NO_SHA256\r\n#ifdef OPENSSL_FIPS\r\nint private_SHA224_Init(SHA256_CTX *c);\r\nint private_SHA256_Init(SHA256_CTX *c);\r\n#endif\r\nint SHA224_Init(SHA256_CTX *c);\r\nint SHA224_Update(SHA256_CTX *c, const void *data, size_t len);\r\nint SHA224_Final(unsigned char *md, SHA256_CTX *c);\r\nunsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md);\r\nint SHA256_Init(SHA256_CTX *c);\r\nint SHA256_Update(SHA256_CTX *c, const void *data, size_t len);\r\nint SHA256_Final(unsigned char *md, SHA256_CTX *c);\r\nunsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);\r\nvoid SHA256_Transform(SHA256_CTX *c, const unsigned char *data);\r\n#endif\r\n\r\n#define SHA384_DIGEST_LENGTH\t48\r\n#define SHA512_DIGEST_LENGTH\t64\r\n\r\n#ifndef OPENSSL_NO_SHA512\r\n/*\r\n * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64\r\n * being exactly 64-bit wide. See Implementation Notes in sha512.c\r\n * for further details.\r\n */\r\n#define SHA512_CBLOCK\t(SHA_LBLOCK*8)\t/* SHA-512 treats input data as a\r\n\t\t\t\t\t * contiguous array of 64 bit\r\n\t\t\t\t\t * wide big-endian values. */\r\n#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)\r\n#define SHA_LONG64 unsigned __int64\r\n#define U64(C)     C##UI64\r\n#elif defined(__arch64__)\r\n#define SHA_LONG64 unsigned long\r\n#define U64(C)     C##UL\r\n#else\r\n#define SHA_LONG64 unsigned long long\r\n#define U64(C)     C##ULL\r\n#endif\r\n\r\ntypedef struct SHA512state_st\r\n\t{\r\n\tSHA_LONG64 h[8];\r\n\tSHA_LONG64 Nl,Nh;\r\n\tunion {\r\n\t\tSHA_LONG64\td[SHA_LBLOCK];\r\n\t\tunsigned char\tp[SHA512_CBLOCK];\r\n\t} u;\r\n\tunsigned int num,md_len;\r\n\t} SHA512_CTX;\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_SHA512\r\n#ifdef OPENSSL_FIPS\r\nint private_SHA384_Init(SHA512_CTX *c);\r\nint private_SHA512_Init(SHA512_CTX *c);\r\n#endif\r\nint SHA384_Init(SHA512_CTX *c);\r\nint SHA384_Update(SHA512_CTX *c, const void *data, size_t len);\r\nint SHA384_Final(unsigned char *md, SHA512_CTX *c);\r\nunsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md);\r\nint SHA512_Init(SHA512_CTX *c);\r\nint SHA512_Update(SHA512_CTX *c, const void *data, size_t len);\r\nint SHA512_Final(unsigned char *md, SHA512_CTX *c);\r\nunsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);\r\nvoid SHA512_Transform(SHA512_CTX *c, const unsigned char *data);\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/srp.h",
    "content": "/* crypto/srp/srp.h */\r\n/* Written by Christophe Renou (christophe.renou@edelweb.fr) with \r\n * the precious help of Peter Sylvester (peter.sylvester@edelweb.fr) \r\n * for the EdelKey project and contributed to the OpenSSL project 2004.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n#ifndef __SRP_H__\r\n#define __SRP_H__\r\n\r\n#ifndef OPENSSL_NO_SRP\r\n\r\n#include <stdio.h>\r\n#include <string.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#include <openssl/safestack.h>\r\n#include <openssl/bn.h>\r\n#include <openssl/crypto.h>\r\n\r\ntypedef struct SRP_gN_cache_st\r\n\t{\r\n\tchar *b64_bn;\r\n\tBIGNUM *bn;\r\n\t} SRP_gN_cache;\r\n\r\n\r\nDECLARE_STACK_OF(SRP_gN_cache)\r\n\r\ntypedef struct SRP_user_pwd_st\r\n\t{\r\n\tchar *id;\r\n\tBIGNUM *s;\r\n\tBIGNUM *v;\r\n\tconst BIGNUM *g;\r\n\tconst BIGNUM *N;\r\n\tchar *info;\r\n\t} SRP_user_pwd;\r\n\r\nDECLARE_STACK_OF(SRP_user_pwd)\r\n\r\ntypedef struct SRP_VBASE_st\r\n\t{\r\n\tSTACK_OF(SRP_user_pwd) *users_pwd;\r\n\tSTACK_OF(SRP_gN_cache) *gN_cache;\r\n/* to simulate a user */\r\n\tchar *seed_key;\r\n\tBIGNUM *default_g;\r\n\tBIGNUM *default_N;\r\n\t} SRP_VBASE;\r\n\r\n\r\n/*Structure interne pour retenir les couples N et g*/\r\ntypedef struct SRP_gN_st\r\n\t{\r\n\tchar *id;\r\n\tBIGNUM *g;\r\n\tBIGNUM *N;\r\n\t} SRP_gN;\r\n\r\nDECLARE_STACK_OF(SRP_gN)\r\n\r\nSRP_VBASE *SRP_VBASE_new(char *seed_key);\r\nint SRP_VBASE_free(SRP_VBASE *vb);\r\nint SRP_VBASE_init(SRP_VBASE *vb, char * verifier_file);\r\nSRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);\r\nchar *SRP_create_verifier(const char *user, const char *pass, char **salt,\r\n\t\t\t  char **verifier, const char *N, const char *g);\r\nint SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, BIGNUM **verifier, BIGNUM *N, BIGNUM *g);\r\n\r\n\r\n#define SRP_NO_ERROR 0\r\n#define SRP_ERR_VBASE_INCOMPLETE_FILE 1\r\n#define SRP_ERR_VBASE_BN_LIB 2\r\n#define SRP_ERR_OPEN_FILE 3\r\n#define SRP_ERR_MEMORY 4\r\n\r\n#define DB_srptype\t0\r\n#define DB_srpverifier\t1\r\n#define DB_srpsalt \t2\r\n#define DB_srpid\t3              \r\n#define DB_srpgN\t4       \r\n#define DB_srpinfo\t5 \r\n#undef  DB_NUMBER      \r\n#define DB_NUMBER       6\r\n\r\n#define DB_SRP_INDEX\t'I'\r\n#define DB_SRP_VALID\t'V'\r\n#define DB_SRP_REVOKED\t'R'\r\n#define DB_SRP_MODIF\t'v'\r\n\r\n\r\n/* see srp.c */\r\nchar * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N); \r\nSRP_gN *SRP_get_default_gN(const char * id) ;\r\n\r\n/* server side .... */\r\nBIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BIGNUM *N);\r\nBIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v);\r\nint SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N);\r\nBIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) ;\r\n\r\n\r\n\r\n/* client side .... */\r\nBIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass);\r\nBIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g);\r\nBIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x, BIGNUM *a, BIGNUM *u);\r\nint SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);\r\n\r\n#define SRP_MINIMAL_N 1024\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/srtp.h",
    "content": "/* ssl/tls1.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/*\r\n  DTLS code by Eric Rescorla <ekr@rtfm.com>\r\n\r\n  Copyright (C) 2006, Network Resonance, Inc.\r\n  Copyright (C) 2011, RTFM, Inc.\r\n*/\r\n\r\n#ifndef HEADER_D1_SRTP_H\r\n#define HEADER_D1_SRTP_H\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n     \r\n#define SRTP_AES128_CM_SHA1_80 0x0001\r\n#define SRTP_AES128_CM_SHA1_32 0x0002\r\n#define SRTP_AES128_F8_SHA1_80 0x0003\r\n#define SRTP_AES128_F8_SHA1_32 0x0004\r\n#define SRTP_NULL_SHA1_80      0x0005\r\n#define SRTP_NULL_SHA1_32      0x0006\r\n\r\nint SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);\r\nint SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles);\r\nSRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);\r\n\r\nSTACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);\r\nSRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ssl.h",
    "content": "/* ssl/ssl.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2007 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n * ECC cipher suite support in OpenSSL originally developed by \r\n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\r\n */\r\n/* ====================================================================\r\n * Copyright 2005 Nokia. All rights reserved.\r\n *\r\n * The portions of the attached software (\"Contribution\") is developed by\r\n * Nokia Corporation and is licensed pursuant to the OpenSSL open source\r\n * license.\r\n *\r\n * The Contribution, originally written by Mika Kousa and Pasi Eronen of\r\n * Nokia Corporation, consists of the \"PSK\" (Pre-Shared Key) ciphersuites\r\n * support (see RFC 4279) to OpenSSL.\r\n *\r\n * No patent licenses or other rights except those expressly stated in\r\n * the OpenSSL open source license shall be deemed granted or received\r\n * expressly, by implication, estoppel, or otherwise.\r\n *\r\n * No assurances are provided by Nokia that the Contribution does not\r\n * infringe the patent or other intellectual property rights of any third\r\n * party or that the license provides you with all the necessary rights\r\n * to make use of the Contribution.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND. IN\r\n * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA\r\n * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY\r\n * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR\r\n * OTHERWISE.\r\n */\r\n\r\n#ifndef HEADER_SSL_H \r\n#define HEADER_SSL_H \r\n\r\n#include <openssl/e_os2.h>\r\n\r\n#ifndef OPENSSL_NO_COMP\r\n#include <openssl/comp.h>\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#ifndef OPENSSL_NO_X509\r\n#include <openssl/x509.h>\r\n#endif\r\n#include <openssl/crypto.h>\r\n#include <openssl/lhash.h>\r\n#include <openssl/buffer.h>\r\n#endif\r\n#include <openssl/pem.h>\r\n#include <openssl/hmac.h>\r\n\r\n#include <openssl/kssl.h>\r\n#include <openssl/safestack.h>\r\n#include <openssl/symhacks.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* SSLeay version number for ASN.1 encoding of the session information */\r\n/* Version 0 - initial version\r\n * Version 1 - added the optional peer certificate\r\n */\r\n#define SSL_SESSION_ASN1_VERSION 0x0001\r\n\r\n/* text strings for the ciphers */\r\n#define SSL_TXT_NULL_WITH_MD5\t\tSSL2_TXT_NULL_WITH_MD5\t\t\t\r\n#define SSL_TXT_RC4_128_WITH_MD5\tSSL2_TXT_RC4_128_WITH_MD5\t\t\r\n#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5\t\r\n#define SSL_TXT_RC2_128_CBC_WITH_MD5\tSSL2_TXT_RC2_128_CBC_WITH_MD5\t\t\r\n#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5\t\r\n#define SSL_TXT_IDEA_128_CBC_WITH_MD5\tSSL2_TXT_IDEA_128_CBC_WITH_MD5\t\t\r\n#define SSL_TXT_DES_64_CBC_WITH_MD5\tSSL2_TXT_DES_64_CBC_WITH_MD5\t\t\r\n#define SSL_TXT_DES_64_CBC_WITH_SHA\tSSL2_TXT_DES_64_CBC_WITH_SHA\t\t\r\n#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5\t\r\n#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA\t\r\n\r\n/*    VRS Additional Kerberos5 entries\r\n */\r\n#define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA\r\n#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA\r\n#define SSL_TXT_KRB5_RC4_128_SHA      SSL3_TXT_KRB5_RC4_128_SHA\r\n#define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA\r\n#define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5       \r\n#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5       \r\n#define SSL_TXT_KRB5_RC4_128_MD5      SSL3_TXT_KRB5_RC4_128_MD5\r\n#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 \r\n\r\n#define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA \r\n#define SSL_TXT_KRB5_RC2_40_CBC_SHA   SSL3_TXT_KRB5_RC2_40_CBC_SHA \r\n#define SSL_TXT_KRB5_RC4_40_SHA\t      SSL3_TXT_KRB5_RC4_40_SHA\r\n#define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5 \r\n#define SSL_TXT_KRB5_RC2_40_CBC_MD5   SSL3_TXT_KRB5_RC2_40_CBC_MD5 \r\n#define SSL_TXT_KRB5_RC4_40_MD5\t      SSL3_TXT_KRB5_RC4_40_MD5\r\n\r\n#define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA\r\n#define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5\r\n#define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA\r\n#define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5\r\n#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA\r\n#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5\r\n#define SSL_MAX_KRB5_PRINCIPAL_LENGTH  256\r\n\r\n#define SSL_MAX_SSL_SESSION_ID_LENGTH\t\t32\r\n#define SSL_MAX_SID_CTX_LENGTH\t\t\t32\r\n\r\n#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES\t(512/8)\r\n#define SSL_MAX_KEY_ARG_LENGTH\t\t\t8\r\n#define SSL_MAX_MASTER_KEY_LENGTH\t\t48\r\n\r\n\r\n/* These are used to specify which ciphers to use and not to use */\r\n\r\n#define SSL_TXT_EXP40\t\t\"EXPORT40\"\r\n#define SSL_TXT_EXP56\t\t\"EXPORT56\"\r\n#define SSL_TXT_LOW\t\t\"LOW\"\r\n#define SSL_TXT_MEDIUM\t\t\"MEDIUM\"\r\n#define SSL_TXT_HIGH\t\t\"HIGH\"\r\n#define SSL_TXT_FIPS\t\t\"FIPS\"\r\n\r\n#define SSL_TXT_kFZA\t\t\"kFZA\" /* unused! */\r\n#define\tSSL_TXT_aFZA\t\t\"aFZA\" /* unused! */\r\n#define SSL_TXT_eFZA\t\t\"eFZA\" /* unused! */\r\n#define SSL_TXT_FZA\t\t\"FZA\"  /* unused! */\r\n\r\n#define\tSSL_TXT_aNULL\t\t\"aNULL\"\r\n#define\tSSL_TXT_eNULL\t\t\"eNULL\"\r\n#define\tSSL_TXT_NULL\t\t\"NULL\"\r\n\r\n#define SSL_TXT_kRSA\t\t\"kRSA\"\r\n#define SSL_TXT_kDHr\t\t\"kDHr\" /* no such ciphersuites supported! */\r\n#define SSL_TXT_kDHd\t\t\"kDHd\" /* no such ciphersuites supported! */\r\n#define SSL_TXT_kDH \t\t\"kDH\"  /* no such ciphersuites supported! */\r\n#define SSL_TXT_kEDH\t\t\"kEDH\"\r\n#define SSL_TXT_kKRB5     \t\"kKRB5\"\r\n#define SSL_TXT_kECDHr\t\t\"kECDHr\"\r\n#define SSL_TXT_kECDHe\t\t\"kECDHe\"\r\n#define SSL_TXT_kECDH\t\t\"kECDH\"\r\n#define SSL_TXT_kEECDH\t\t\"kEECDH\"\r\n#define SSL_TXT_kPSK            \"kPSK\"\r\n#define SSL_TXT_kGOST\t\t\"kGOST\"\r\n#define SSL_TXT_kSRP\t\t\"kSRP\"\r\n\r\n#define\tSSL_TXT_aRSA\t\t\"aRSA\"\r\n#define\tSSL_TXT_aDSS\t\t\"aDSS\"\r\n#define\tSSL_TXT_aDH\t\t\"aDH\" /* no such ciphersuites supported! */\r\n#define\tSSL_TXT_aECDH\t\t\"aECDH\"\r\n#define SSL_TXT_aKRB5     \t\"aKRB5\"\r\n#define SSL_TXT_aECDSA\t\t\"aECDSA\"\r\n#define SSL_TXT_aPSK            \"aPSK\"\r\n#define SSL_TXT_aGOST94\t\"aGOST94\"\r\n#define SSL_TXT_aGOST01 \"aGOST01\"\r\n#define SSL_TXT_aGOST  \"aGOST\"\r\n\r\n#define\tSSL_TXT_DSS\t\t\"DSS\"\r\n#define SSL_TXT_DH\t\t\"DH\"\r\n#define SSL_TXT_EDH\t\t\"EDH\" /* same as \"kEDH:-ADH\" */\r\n#define SSL_TXT_ADH\t\t\"ADH\"\r\n#define SSL_TXT_RSA\t\t\"RSA\"\r\n#define SSL_TXT_ECDH\t\t\"ECDH\"\r\n#define SSL_TXT_EECDH\t\t\"EECDH\" /* same as \"kEECDH:-AECDH\" */\r\n#define SSL_TXT_AECDH\t\t\"AECDH\"\r\n#define SSL_TXT_ECDSA\t\t\"ECDSA\"\r\n#define SSL_TXT_KRB5      \t\"KRB5\"\r\n#define SSL_TXT_PSK             \"PSK\"\r\n#define SSL_TXT_SRP\t\t\"SRP\"\r\n\r\n#define SSL_TXT_DES\t\t\"DES\"\r\n#define SSL_TXT_3DES\t\t\"3DES\"\r\n#define SSL_TXT_RC4\t\t\"RC4\"\r\n#define SSL_TXT_RC2\t\t\"RC2\"\r\n#define SSL_TXT_IDEA\t\t\"IDEA\"\r\n#define SSL_TXT_SEED\t\t\"SEED\"\r\n#define SSL_TXT_AES128\t\t\"AES128\"\r\n#define SSL_TXT_AES256\t\t\"AES256\"\r\n#define SSL_TXT_AES\t\t\"AES\"\r\n#define SSL_TXT_AES_GCM\t\t\"AESGCM\"\r\n#define SSL_TXT_CAMELLIA128\t\"CAMELLIA128\"\r\n#define SSL_TXT_CAMELLIA256\t\"CAMELLIA256\"\r\n#define SSL_TXT_CAMELLIA\t\"CAMELLIA\"\r\n\r\n#define SSL_TXT_MD5\t\t\"MD5\"\r\n#define SSL_TXT_SHA1\t\t\"SHA1\"\r\n#define SSL_TXT_SHA\t\t\"SHA\" /* same as \"SHA1\" */\r\n#define SSL_TXT_GOST94\t\t\"GOST94\" \r\n#define SSL_TXT_GOST89MAC\t\t\"GOST89MAC\" \r\n#define SSL_TXT_SHA256\t\t\"SHA256\"\r\n#define SSL_TXT_SHA384\t\t\"SHA384\"\r\n\r\n#define SSL_TXT_SSLV2\t\t\"SSLv2\"\r\n#define SSL_TXT_SSLV3\t\t\"SSLv3\"\r\n#define SSL_TXT_TLSV1\t\t\"TLSv1\"\r\n#define SSL_TXT_TLSV1_1\t\t\"TLSv1.1\"\r\n#define SSL_TXT_TLSV1_2\t\t\"TLSv1.2\"\r\n\r\n#define SSL_TXT_EXP\t\t\"EXP\"\r\n#define SSL_TXT_EXPORT\t\t\"EXPORT\"\r\n\r\n#define SSL_TXT_ALL\t\t\"ALL\"\r\n\r\n/*\r\n * COMPLEMENTOF* definitions. These identifiers are used to (de-select)\r\n * ciphers normally not being used.\r\n * Example: \"RC4\" will activate all ciphers using RC4 including ciphers\r\n * without authentication, which would normally disabled by DEFAULT (due\r\n * the \"!ADH\" being part of default). Therefore \"RC4:!COMPLEMENTOFDEFAULT\"\r\n * will make sure that it is also disabled in the specific selection.\r\n * COMPLEMENTOF* identifiers are portable between version, as adjustments\r\n * to the default cipher setup will also be included here.\r\n *\r\n * COMPLEMENTOFDEFAULT does not experience the same special treatment that\r\n * DEFAULT gets, as only selection is being done and no sorting as needed\r\n * for DEFAULT.\r\n */\r\n#define SSL_TXT_CMPALL\t\t\"COMPLEMENTOFALL\"\r\n#define SSL_TXT_CMPDEF\t\t\"COMPLEMENTOFDEFAULT\"\r\n\r\n/* The following cipher list is used by default.\r\n * It also is substituted when an application-defined cipher list string\r\n * starts with 'DEFAULT'. */\r\n#define SSL_DEFAULT_CIPHER_LIST\t\"ALL:!aNULL:!eNULL:!SSLv2\"\r\n/* As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always\r\n * starts with a reasonable order, and all we have to do for DEFAULT is\r\n * throwing out anonymous and unencrypted ciphersuites!\r\n * (The latter are not actually enabled by ALL, but \"ALL:RSA\" would enable\r\n * some of them.)\r\n */\r\n\r\n/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */\r\n#define SSL_SENT_SHUTDOWN\t1\r\n#define SSL_RECEIVED_SHUTDOWN\t2\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2)\r\n#define OPENSSL_NO_SSL2\r\n#endif\r\n\r\n#define SSL_FILETYPE_ASN1\tX509_FILETYPE_ASN1\r\n#define SSL_FILETYPE_PEM\tX509_FILETYPE_PEM\r\n\r\n/* This is needed to stop compilers complaining about the\r\n * 'struct ssl_st *' function parameters used to prototype callbacks\r\n * in SSL_CTX. */\r\ntypedef struct ssl_st *ssl_crock_st;\r\ntypedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;\r\ntypedef struct ssl_method_st SSL_METHOD;\r\ntypedef struct ssl_cipher_st SSL_CIPHER;\r\ntypedef struct ssl_session_st SSL_SESSION;\r\n\r\nDECLARE_STACK_OF(SSL_CIPHER)\r\n\r\n/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/\r\ntypedef struct srtp_protection_profile_st\r\n       {\r\n       const char *name;\r\n       unsigned long id;\r\n       } SRTP_PROTECTION_PROFILE;\r\n\r\nDECLARE_STACK_OF(SRTP_PROTECTION_PROFILE)\r\n\r\ntypedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, int len, void *arg);\r\ntypedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg);\r\n\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\n/* used to hold info on the particular ciphers used */\r\nstruct ssl_cipher_st\r\n\t{\r\n\tint valid;\r\n\tconst char *name;\t\t/* text name */\r\n\tunsigned long id;\t\t/* id, 4 bytes, first is version */\r\n\r\n\t/* changed in 0.9.9: these four used to be portions of a single value 'algorithms' */\r\n\tunsigned long algorithm_mkey;\t/* key exchange algorithm */\r\n\tunsigned long algorithm_auth;\t/* server authentication */\r\n\tunsigned long algorithm_enc;\t/* symmetric encryption */\r\n\tunsigned long algorithm_mac;\t/* symmetric authentication */\r\n\tunsigned long algorithm_ssl;\t/* (major) protocol version */\r\n\r\n\tunsigned long algo_strength;\t/* strength and export flags */\r\n\tunsigned long algorithm2;\t/* Extra flags */\r\n\tint strength_bits;\t\t/* Number of bits really used */\r\n\tint alg_bits;\t\t\t/* Number of bits for algorithm */\r\n\t};\r\n\r\n\r\n/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */\r\nstruct ssl_method_st\r\n\t{\r\n\tint version;\r\n\tint (*ssl_new)(SSL *s);\r\n\tvoid (*ssl_clear)(SSL *s);\r\n\tvoid (*ssl_free)(SSL *s);\r\n\tint (*ssl_accept)(SSL *s);\r\n\tint (*ssl_connect)(SSL *s);\r\n\tint (*ssl_read)(SSL *s,void *buf,int len);\r\n\tint (*ssl_peek)(SSL *s,void *buf,int len);\r\n\tint (*ssl_write)(SSL *s,const void *buf,int len);\r\n\tint (*ssl_shutdown)(SSL *s);\r\n\tint (*ssl_renegotiate)(SSL *s);\r\n\tint (*ssl_renegotiate_check)(SSL *s);\r\n\tlong (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long\r\n\t\tmax, int *ok);\r\n\tint (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, \r\n\t\tint peek);\r\n\tint (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);\r\n\tint (*ssl_dispatch_alert)(SSL *s);\r\n\tlong (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);\r\n\tlong (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);\r\n\tconst SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);\r\n\tint (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);\r\n\tint (*ssl_pending)(const SSL *s);\r\n\tint (*num_ciphers)(void);\r\n\tconst SSL_CIPHER *(*get_cipher)(unsigned ncipher);\r\n\tconst struct ssl_method_st *(*get_ssl_method)(int version);\r\n\tlong (*get_timeout)(void);\r\n\tstruct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */\r\n\tint (*ssl_version)(void);\r\n\tlong (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));\r\n\tlong (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));\r\n\t};\r\n\r\n/* Lets make this into an ASN.1 type structure as follows\r\n * SSL_SESSION_ID ::= SEQUENCE {\r\n *\tversion \t\tINTEGER,\t-- structure version number\r\n *\tSSLversion \t\tINTEGER,\t-- SSL version number\r\n *\tCipher \t\t\tOCTET STRING,\t-- the 3 byte cipher ID\r\n *\tSession_ID \t\tOCTET STRING,\t-- the Session ID\r\n *\tMaster_key \t\tOCTET STRING,\t-- the master key\r\n *\tKRB5_principal\t\tOCTET STRING\t-- optional Kerberos principal\r\n *\tKey_Arg [ 0 ] IMPLICIT\tOCTET STRING,\t-- the optional Key argument\r\n *\tTime [ 1 ] EXPLICIT\tINTEGER,\t-- optional Start Time\r\n *\tTimeout [ 2 ] EXPLICIT\tINTEGER,\t-- optional Timeout ins seconds\r\n *\tPeer [ 3 ] EXPLICIT\tX509,\t\t-- optional Peer Certificate\r\n *\tSession_ID_context [ 4 ] EXPLICIT OCTET STRING,   -- the Session ID context\r\n *\tVerify_result [ 5 ] EXPLICIT INTEGER,   -- X509_V_... code for `Peer'\r\n *\tHostName [ 6 ] EXPLICIT OCTET STRING,   -- optional HostName from servername TLS extension \r\n *\tPSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint\r\n *\tPSK_identity [ 8 ] EXPLICIT OCTET STRING,  -- optional PSK identity\r\n *\tTicket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket\r\n *\tTicket [10]             EXPLICIT OCTET STRING, -- session ticket (clients only)\r\n *\tCompression_meth [11]   EXPLICIT OCTET STRING, -- optional compression method\r\n *\tSRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username\r\n *\t}\r\n * Look in ssl/ssl_asn1.c for more details\r\n * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).\r\n */\r\nstruct ssl_session_st\r\n\t{\r\n\tint ssl_version;\t/* what ssl version session info is\r\n\t\t\t\t * being kept in here? */\r\n\r\n\t/* only really used in SSLv2 */\r\n\tunsigned int key_arg_length;\r\n\tunsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH];\r\n\tint master_key_length;\r\n\tunsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];\r\n\t/* session_id - valid? */\r\n\tunsigned int session_id_length;\r\n\tunsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];\r\n\t/* this is used to determine whether the session is being reused in\r\n\t * the appropriate context. It is up to the application to set this,\r\n\t * via SSL_new */\r\n\tunsigned int sid_ctx_length;\r\n\tunsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];\r\n\r\n#ifndef OPENSSL_NO_KRB5\r\n        unsigned int krb5_client_princ_len;\r\n        unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];\r\n#endif /* OPENSSL_NO_KRB5 */\r\n#ifndef OPENSSL_NO_PSK\r\n\tchar *psk_identity_hint;\r\n\tchar *psk_identity;\r\n#endif\r\n\tint not_resumable;\r\n\r\n\t/* The cert is the certificate used to establish this connection */\r\n\tstruct sess_cert_st /* SESS_CERT */ *sess_cert;\r\n\r\n\t/* This is the cert for the other end.\r\n\t * On clients, it will be the same as sess_cert->peer_key->x509\r\n\t * (the latter is not enough as sess_cert is not retained\r\n\t * in the external representation of sessions, see ssl_asn1.c). */\r\n\tX509 *peer;\r\n\t/* when app_verify_callback accepts a session where the peer's certificate\r\n\t * is not ok, we must remember the error for session reuse: */\r\n\tlong verify_result; /* only for servers */\r\n\r\n\tint references;\r\n\tlong timeout;\r\n\tlong time;\r\n\r\n\tunsigned int compress_meth;\t/* Need to lookup the method */\r\n\r\n\tconst SSL_CIPHER *cipher;\r\n\tunsigned long cipher_id;\t/* when ASN.1 loaded, this\r\n\t\t\t\t\t * needs to be used to load\r\n\t\t\t\t\t * the 'cipher' structure */\r\n\r\n\tSTACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */\r\n\r\n\tCRYPTO_EX_DATA ex_data; /* application specific data */\r\n\r\n\t/* These are used to make removal of session-ids more\r\n\t * efficient and to implement a maximum cache size. */\r\n\tstruct ssl_session_st *prev,*next;\r\n#ifndef OPENSSL_NO_TLSEXT\r\n\tchar *tlsext_hostname;\r\n#ifndef OPENSSL_NO_EC\r\n\tsize_t tlsext_ecpointformatlist_length;\r\n\tunsigned char *tlsext_ecpointformatlist; /* peer's list */\r\n\tsize_t tlsext_ellipticcurvelist_length;\r\n\tunsigned char *tlsext_ellipticcurvelist; /* peer's list */\r\n#endif /* OPENSSL_NO_EC */\r\n\t/* RFC4507 info */\r\n\tunsigned char *tlsext_tick;\t/* Session ticket */\r\n\tsize_t\ttlsext_ticklen;\t\t/* Session ticket length */\t\r\n\tlong tlsext_tick_lifetime_hint;\t/* Session lifetime hint in seconds */\r\n#endif\r\n#ifndef OPENSSL_NO_SRP\r\n\tchar *srp_username;\r\n#endif\r\n\t};\r\n\r\n#endif\r\n\r\n#define SSL_OP_MICROSOFT_SESS_ID_BUG\t\t\t0x00000001L\r\n#define SSL_OP_NETSCAPE_CHALLENGE_BUG\t\t\t0x00000002L\r\n/* Allow initial connection to servers that don't support RI */\r\n#define SSL_OP_LEGACY_SERVER_CONNECT\t\t\t0x00000004L\r\n#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG\t\t0x00000008L\r\n#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG\t\t0x00000010L\r\n#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER\t\t0x00000020L\r\n#define SSL_OP_MSIE_SSLV2_RSA_PADDING\t\t\t0x00000040L /* no effect since 0.9.7h and 0.9.8b */\r\n#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG\t\t\t0x00000080L\r\n#define SSL_OP_TLS_D5_BUG\t\t\t\t0x00000100L\r\n#define SSL_OP_TLS_BLOCK_PADDING_BUG\t\t\t0x00000200L\r\n\r\n/* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added\r\n * in OpenSSL 0.9.6d.  Usually (depending on the application protocol)\r\n * the workaround is not needed.  Unfortunately some broken SSL/TLS\r\n * implementations cannot handle it at all, which is why we include\r\n * it in SSL_OP_ALL. */\r\n#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS              0x00000800L /* added in 0.9.6e */\r\n\r\n/* SSL_OP_ALL: various bug workarounds that should be rather harmless.\r\n *             This used to be 0x000FFFFFL before 0.9.7. */\r\n#define SSL_OP_ALL\t\t\t\t\t0x80000BFFL\r\n\r\n/* DTLS options */\r\n#define SSL_OP_NO_QUERY_MTU                 0x00001000L\r\n/* Turn on Cookie Exchange (on relevant for servers) */\r\n#define SSL_OP_COOKIE_EXCHANGE              0x00002000L\r\n/* Don't use RFC4507 ticket extension */\r\n#define SSL_OP_NO_TICKET\t            0x00004000L\r\n/* Use Cisco's \"speshul\" version of DTLS_BAD_VER (as client)  */\r\n#define SSL_OP_CISCO_ANYCONNECT\t\t    0x00008000L\r\n\r\n/* As server, disallow session resumption on renegotiation */\r\n#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION\t0x00010000L\r\n/* Don't use compression even if supported */\r\n#define SSL_OP_NO_COMPRESSION\t\t\t\t0x00020000L\r\n/* Permit unsafe legacy renegotiation */\r\n#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\t0x00040000L\r\n/* If set, always create a new key when using tmp_ecdh parameters */\r\n#define SSL_OP_SINGLE_ECDH_USE\t\t\t\t0x00080000L\r\n/* If set, always create a new key when using tmp_dh parameters */\r\n#define SSL_OP_SINGLE_DH_USE\t\t\t\t0x00100000L\r\n/* Set to always use the tmp_rsa key when doing RSA operations,\r\n * even when this violates protocol specs */\r\n#define SSL_OP_EPHEMERAL_RSA\t\t\t\t0x00200000L\r\n/* Set on servers to choose the cipher according to the server's\r\n * preferences */\r\n#define SSL_OP_CIPHER_SERVER_PREFERENCE\t\t\t0x00400000L\r\n/* If set, a server will allow a client to issue a SSLv3.0 version number\r\n * as latest version supported in the premaster secret, even when TLSv1.0\r\n * (version 3.1) was announced in the client hello. Normally this is\r\n * forbidden to prevent version rollback attacks. */\r\n#define SSL_OP_TLS_ROLLBACK_BUG\t\t\t\t0x00800000L\r\n\r\n#define SSL_OP_NO_SSLv2\t\t\t\t\t0x01000000L\r\n#define SSL_OP_NO_SSLv3\t\t\t\t\t0x02000000L\r\n#define SSL_OP_NO_TLSv1\t\t\t\t\t0x04000000L\r\n#define SSL_OP_NO_TLSv1_2\t\t\t\t0x08000000L\r\n#define SSL_OP_NO_TLSv1_1\t\t\t\t0x10000000L\r\n\r\n/* These next two were never actually used for anything since SSLeay\r\n * zap so we have some more flags.\r\n */\r\n/* The next flag deliberately changes the ciphertest, this is a check\r\n * for the PKCS#1 attack */\r\n#define SSL_OP_PKCS1_CHECK_1\t\t\t\t0x0\r\n#define SSL_OP_PKCS1_CHECK_2\t\t\t\t0x0\r\n\r\n#define SSL_OP_NETSCAPE_CA_DN_BUG\t\t\t0x20000000L\r\n#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG\t\t0x40000000L\r\n/* Make server add server-hello extension from early version of\r\n * cryptopro draft, when GOST ciphersuite is negotiated. \r\n * Required for interoperability with CryptoPro CSP 3.x \r\n */\r\n#define SSL_OP_CRYPTOPRO_TLSEXT_BUG\t\t\t0x80000000L\r\n\r\n/* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success\r\n * when just a single record has been written): */\r\n#define SSL_MODE_ENABLE_PARTIAL_WRITE       0x00000001L\r\n/* Make it possible to retry SSL_write() with changed buffer location\r\n * (buffer contents must stay the same!); this is not the default to avoid\r\n * the misconception that non-blocking SSL_write() behaves like\r\n * non-blocking write(): */\r\n#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L\r\n/* Never bother the application with retries if the transport\r\n * is blocking: */\r\n#define SSL_MODE_AUTO_RETRY 0x00000004L\r\n/* Don't attempt to automatically build certificate chain */\r\n#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L\r\n/* Save RAM by releasing read and write buffers when they're empty. (SSL3 and\r\n * TLS only.)  \"Released\" buffers are put onto a free-list in the context\r\n * or just freed (depending on the context's setting for freelist_max_len). */\r\n#define SSL_MODE_RELEASE_BUFFERS 0x00000010L\r\n\r\n/* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value,\r\n * they cannot be used to clear bits. */\r\n\r\n#define SSL_CTX_set_options(ctx,op) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)\r\n#define SSL_CTX_clear_options(ctx,op) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_OPTIONS,(op),NULL)\r\n#define SSL_CTX_get_options(ctx) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)\r\n#define SSL_set_options(ssl,op) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)\r\n#define SSL_clear_options(ssl,op) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_CLEAR_OPTIONS,(op),NULL)\r\n#define SSL_get_options(ssl) \\\r\n        SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL)\r\n\r\n#define SSL_CTX_set_mode(ctx,op) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)\r\n#define SSL_CTX_clear_mode(ctx,op) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)\r\n#define SSL_CTX_get_mode(ctx) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)\r\n#define SSL_clear_mode(ssl,op) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)\r\n#define SSL_set_mode(ssl,op) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)\r\n#define SSL_get_mode(ssl) \\\r\n        SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)\r\n#define SSL_set_mtu(ssl, mtu) \\\r\n        SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL)\r\n\r\n#define SSL_get_secure_renegotiation_support(ssl) \\\r\n\tSSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)\r\n\r\n#ifndef OPENSSL_NO_HEARTBEATS\r\n#define SSL_heartbeat(ssl) \\\r\n        SSL_ctrl((ssl),SSL_CTRL_TLS_EXT_SEND_HEARTBEAT,0,NULL)\r\n#endif\r\n\r\nvoid SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));\r\nvoid SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));\r\n#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))\r\n#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))\r\n\r\n#ifndef OPENSSL_NO_SRP\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\ntypedef struct srp_ctx_st\r\n\t{\r\n\t/* param for all the callbacks */\r\n\tvoid *SRP_cb_arg;\r\n\t/* set client Hello login callback */\r\n\tint (*TLS_ext_srp_username_callback)(SSL *, int *, void *);\r\n\t/* set SRP N/g param callback for verification */\r\n\tint (*SRP_verify_param_callback)(SSL *, void *);\r\n\t/* set SRP client passwd callback */\r\n\tchar *(*SRP_give_srp_client_pwd_callback)(SSL *, void *);\r\n\r\n\tchar *login;\r\n\tBIGNUM *N,*g,*s,*B,*A;\r\n\tBIGNUM *a,*b,*v;\r\n\tchar *info;\r\n\tint strength;\r\n\r\n\tunsigned long srp_Mask;\r\n\t} SRP_CTX;\r\n\r\n#endif\r\n\r\n/* see tls_srp.c */\r\nint SSL_SRP_CTX_init(SSL *s);\r\nint SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);\r\nint SSL_SRP_CTX_free(SSL *ctx);\r\nint SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);\r\nint SSL_srp_server_param_with_username(SSL *s, int *ad);\r\nint SRP_generate_server_master_secret(SSL *s,unsigned char *master_key);\r\nint SRP_Calc_A_param(SSL *s);\r\nint SRP_generate_client_master_secret(SSL *s,unsigned char *master_key);\r\n\r\n#endif\r\n\r\n#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)\r\n#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */\r\n#else\r\n#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */\r\n#endif\r\n\r\n#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT\t(1024*20)\r\n\r\n/* This callback type is used inside SSL_CTX, SSL, and in the functions that set\r\n * them. It is used to override the generation of SSL/TLS session IDs in a\r\n * server. Return value should be zero on an error, non-zero to proceed. Also,\r\n * callbacks should themselves check if the id they generate is unique otherwise\r\n * the SSL handshake will fail with an error - callbacks can do this using the\r\n * 'ssl' value they're passed by;\r\n *      SSL_has_matching_session_id(ssl, id, *id_len)\r\n * The length value passed in is set at the maximum size the session ID can be.\r\n * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback\r\n * can alter this length to be less if desired, but under SSLv2 session IDs are\r\n * supposed to be fixed at 16 bytes so the id will be padded after the callback\r\n * returns in this case. It is also an error for the callback to set the size to\r\n * zero. */\r\ntypedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,\r\n\t\t\t\tunsigned int *id_len);\r\n\r\ntypedef struct ssl_comp_st SSL_COMP;\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\nstruct ssl_comp_st\r\n\t{\r\n\tint id;\r\n\tconst char *name;\r\n#ifndef OPENSSL_NO_COMP\r\n\tCOMP_METHOD *method;\r\n#else\r\n\tchar *method;\r\n#endif\r\n\t};\r\n\r\nDECLARE_STACK_OF(SSL_COMP)\r\nDECLARE_LHASH_OF(SSL_SESSION);\r\n\r\nstruct ssl_ctx_st\r\n\t{\r\n\tconst SSL_METHOD *method;\r\n\r\n\tSTACK_OF(SSL_CIPHER) *cipher_list;\r\n\t/* same as above but sorted for lookup */\r\n\tSTACK_OF(SSL_CIPHER) *cipher_list_by_id;\r\n\r\n\tstruct x509_store_st /* X509_STORE */ *cert_store;\r\n\tLHASH_OF(SSL_SESSION) *sessions;\r\n\t/* Most session-ids that will be cached, default is\r\n\t * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */\r\n\tunsigned long session_cache_size;\r\n\tstruct ssl_session_st *session_cache_head;\r\n\tstruct ssl_session_st *session_cache_tail;\r\n\r\n\t/* This can have one of 2 values, ored together,\r\n\t * SSL_SESS_CACHE_CLIENT,\r\n\t * SSL_SESS_CACHE_SERVER,\r\n\t * Default is SSL_SESSION_CACHE_SERVER, which means only\r\n\t * SSL_accept which cache SSL_SESSIONS. */\r\n\tint session_cache_mode;\r\n\r\n\t/* If timeout is not 0, it is the default timeout value set\r\n\t * when SSL_new() is called.  This has been put in to make\r\n\t * life easier to set things up */\r\n\tlong session_timeout;\r\n\r\n\t/* If this callback is not null, it will be called each\r\n\t * time a session id is added to the cache.  If this function\r\n\t * returns 1, it means that the callback will do a\r\n\t * SSL_SESSION_free() when it has finished using it.  Otherwise,\r\n\t * on 0, it means the callback has finished with it.\r\n\t * If remove_session_cb is not null, it will be called when\r\n\t * a session-id is removed from the cache.  After the call,\r\n\t * OpenSSL will SSL_SESSION_free() it. */\r\n\tint (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess);\r\n\tvoid (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);\r\n\tSSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,\r\n\t\tunsigned char *data,int len,int *copy);\r\n\r\n\tstruct\r\n\t\t{\r\n\t\tint sess_connect;\t/* SSL new conn - started */\r\n\t\tint sess_connect_renegotiate;/* SSL reneg - requested */\r\n\t\tint sess_connect_good;\t/* SSL new conne/reneg - finished */\r\n\t\tint sess_accept;\t/* SSL new accept - started */\r\n\t\tint sess_accept_renegotiate;/* SSL reneg - requested */\r\n\t\tint sess_accept_good;\t/* SSL accept/reneg - finished */\r\n\t\tint sess_miss;\t\t/* session lookup misses  */\r\n\t\tint sess_timeout;\t/* reuse attempt on timeouted session */\r\n\t\tint sess_cache_full;\t/* session removed due to full cache */\r\n\t\tint sess_hit;\t\t/* session reuse actually done */\r\n\t\tint sess_cb_hit;\t/* session-id that was not\r\n\t\t\t\t\t * in the cache was\r\n\t\t\t\t\t * passed back via the callback.  This\r\n\t\t\t\t\t * indicates that the application is\r\n\t\t\t\t\t * supplying session-id's from other\r\n\t\t\t\t\t * processes - spooky :-) */\r\n\t\t} stats;\r\n\r\n\tint references;\r\n\r\n\t/* if defined, these override the X509_verify_cert() calls */\r\n\tint (*app_verify_callback)(X509_STORE_CTX *, void *);\r\n\tvoid *app_verify_arg;\r\n\t/* before OpenSSL 0.9.7, 'app_verify_arg' was ignored\r\n\t * ('app_verify_callback' was called with just one argument) */\r\n\r\n\t/* Default password callback. */\r\n\tpem_password_cb *default_passwd_callback;\r\n\r\n\t/* Default password callback user data. */\r\n\tvoid *default_passwd_callback_userdata;\r\n\r\n\t/* get client cert callback */\r\n\tint (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);\r\n\r\n    /* cookie generate callback */\r\n    int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, \r\n        unsigned int *cookie_len);\r\n\r\n    /* verify cookie callback */\r\n    int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, \r\n        unsigned int cookie_len);\r\n\r\n\tCRYPTO_EX_DATA ex_data;\r\n\r\n\tconst EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */\r\n\tconst EVP_MD *md5;\t/* For SSLv3/TLSv1 'ssl3-md5' */\r\n\tconst EVP_MD *sha1;   /* For SSLv3/TLSv1 'ssl3->sha1' */\r\n\r\n\tSTACK_OF(X509) *extra_certs;\r\n\tSTACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */\r\n\r\n\r\n\t/* Default values used when no per-SSL value is defined follow */\r\n\r\n\tvoid (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */\r\n\r\n\t/* what we put in client cert requests */\r\n\tSTACK_OF(X509_NAME) *client_CA;\r\n\r\n\r\n\t/* Default values to use in SSL structures follow (these are copied by SSL_new) */\r\n\r\n\tunsigned long options;\r\n\tunsigned long mode;\r\n\tlong max_cert_list;\r\n\r\n\tstruct cert_st /* CERT */ *cert;\r\n\tint read_ahead;\r\n\r\n\t/* callback that allows applications to peek at protocol messages */\r\n\tvoid (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);\r\n\tvoid *msg_callback_arg;\r\n\r\n\tint verify_mode;\r\n\tunsigned int sid_ctx_length;\r\n\tunsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];\r\n\tint (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */\r\n\r\n\t/* Default generate session ID callback. */\r\n\tGEN_SESSION_CB generate_session_id;\r\n\r\n\tX509_VERIFY_PARAM *param;\r\n\r\n#if 0\r\n\tint purpose;\t\t/* Purpose setting */\r\n\tint trust;\t\t/* Trust setting */\r\n#endif\r\n\r\n\tint quiet_shutdown;\r\n\r\n\t/* Maximum amount of data to send in one fragment.\r\n\t * actual record size can be more than this due to\r\n\t * padding and MAC overheads.\r\n\t */\r\n\tunsigned int max_send_fragment;\r\n\r\n#ifndef OPENSSL_ENGINE\r\n\t/* Engine to pass requests for client certs to\r\n\t */\r\n\tENGINE *client_cert_engine;\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_TLSEXT\r\n\t/* TLS extensions servername callback */\r\n\tint (*tlsext_servername_callback)(SSL*, int *, void *);\r\n\tvoid *tlsext_servername_arg;\r\n\t/* RFC 4507 session ticket keys */\r\n\tunsigned char tlsext_tick_key_name[16];\r\n\tunsigned char tlsext_tick_hmac_key[16];\r\n\tunsigned char tlsext_tick_aes_key[16];\r\n\t/* Callback to support customisation of ticket key setting */\r\n\tint (*tlsext_ticket_key_cb)(SSL *ssl,\r\n\t\t\t\t\tunsigned char *name, unsigned char *iv,\r\n\t\t\t\t\tEVP_CIPHER_CTX *ectx,\r\n \t\t\t\t\tHMAC_CTX *hctx, int enc);\r\n\r\n\t/* certificate status request info */\r\n\t/* Callback for status request */\r\n\tint (*tlsext_status_cb)(SSL *ssl, void *arg);\r\n\tvoid *tlsext_status_arg;\r\n\t/* draft-rescorla-tls-opaque-prf-input-00.txt information */\r\n\tint (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput, size_t len, void *arg);\r\n\tvoid *tlsext_opaque_prf_input_callback_arg;\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_PSK\r\n\tchar *psk_identity_hint;\r\n\tunsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *identity,\r\n\t\tunsigned int max_identity_len, unsigned char *psk,\r\n\t\tunsigned int max_psk_len);\r\n\tunsigned int (*psk_server_callback)(SSL *ssl, const char *identity,\r\n\t\tunsigned char *psk, unsigned int max_psk_len);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BUF_FREELISTS\r\n#define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32\r\n\tunsigned int freelist_max_len;\r\n\tstruct ssl3_buf_freelist_st *wbuf_freelist;\r\n\tstruct ssl3_buf_freelist_st *rbuf_freelist;\r\n#endif\r\n#ifndef OPENSSL_NO_SRP\r\n\tSRP_CTX srp_ctx; /* ctx for SRP authentication */\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_TLSEXT\r\n# ifndef OPENSSL_NO_NEXTPROTONEG\r\n\t/* Next protocol negotiation information */\r\n\t/* (for experimental NPN extension). */\r\n\r\n\t/* For a server, this contains a callback function by which the set of\r\n\t * advertised protocols can be provided. */\r\n\tint (*next_protos_advertised_cb)(SSL *s, const unsigned char **buf,\r\n\t\t\t                 unsigned int *len, void *arg);\r\n\tvoid *next_protos_advertised_cb_arg;\r\n\t/* For a client, this contains a callback function that selects the\r\n\t * next protocol from the list provided by the server. */\r\n\tint (*next_proto_select_cb)(SSL *s, unsigned char **out,\r\n\t\t\t\t    unsigned char *outlen,\r\n\t\t\t\t    const unsigned char *in,\r\n\t\t\t\t    unsigned int inlen,\r\n\t\t\t\t    void *arg);\r\n\tvoid *next_proto_select_cb_arg;\r\n# endif\r\n        /* SRTP profiles we are willing to do from RFC 5764 */\r\n        STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;  \r\n#endif\r\n\t};\r\n\r\n#endif\r\n\r\n#define SSL_SESS_CACHE_OFF\t\t\t0x0000\r\n#define SSL_SESS_CACHE_CLIENT\t\t\t0x0001\r\n#define SSL_SESS_CACHE_SERVER\t\t\t0x0002\r\n#define SSL_SESS_CACHE_BOTH\t(SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)\r\n#define SSL_SESS_CACHE_NO_AUTO_CLEAR\t\t0x0080\r\n/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */\r\n#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP\t0x0100\r\n#define SSL_SESS_CACHE_NO_INTERNAL_STORE\t0x0200\r\n#define SSL_SESS_CACHE_NO_INTERNAL \\\r\n\t(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)\r\n\r\nLHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);\r\n#define SSL_CTX_sess_number(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)\r\n#define SSL_CTX_sess_connect(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)\r\n#define SSL_CTX_sess_connect_good(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)\r\n#define SSL_CTX_sess_connect_renegotiate(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)\r\n#define SSL_CTX_sess_accept(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)\r\n#define SSL_CTX_sess_accept_renegotiate(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)\r\n#define SSL_CTX_sess_accept_good(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)\r\n#define SSL_CTX_sess_hits(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)\r\n#define SSL_CTX_sess_cb_hits(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)\r\n#define SSL_CTX_sess_misses(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)\r\n#define SSL_CTX_sess_timeouts(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)\r\n#define SSL_CTX_sess_cache_full(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)\r\n\r\nvoid SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess));\r\nint (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess);\r\nvoid SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess));\r\nvoid (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess);\r\nvoid SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,int len,int *copy));\r\nSSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *Data, int len, int *copy);\r\nvoid SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,int type,int val));\r\nvoid (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl,int type,int val);\r\nvoid SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));\r\nint (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);\r\n#ifndef OPENSSL_NO_ENGINE\r\nint SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e);\r\n#endif\r\nvoid SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len));\r\nvoid SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len));\r\n#ifndef OPENSSL_NO_NEXTPROTONEG\r\nvoid SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s,\r\n\t\t\t\t\t   int (*cb) (SSL *ssl,\r\n\t\t\t\t\t\t      const unsigned char **out,\r\n\t\t\t\t\t\t      unsigned int *outlen,\r\n\t\t\t\t\t\t      void *arg),\r\n\t\t\t\t\t   void *arg);\r\nvoid SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,\r\n\t\t\t\t      int (*cb) (SSL *ssl,\r\n\t\t\t\t\t\t unsigned char **out,\r\n\t\t\t\t\t\t unsigned char *outlen,\r\n\t\t\t\t\t\t const unsigned char *in,\r\n\t\t\t\t\t\t unsigned int inlen,\r\n\t\t\t\t\t\t void *arg),\r\n\t\t\t\t      void *arg);\r\n\r\nint SSL_select_next_proto(unsigned char **out, unsigned char *outlen,\r\n\t\t\t  const unsigned char *in, unsigned int inlen,\r\n\t\t\t  const unsigned char *client, unsigned int client_len);\r\nvoid SSL_get0_next_proto_negotiated(const SSL *s,\r\n\t\t\t\t    const unsigned char **data, unsigned *len);\r\n\r\n#define OPENSSL_NPN_UNSUPPORTED\t0\r\n#define OPENSSL_NPN_NEGOTIATED\t1\r\n#define OPENSSL_NPN_NO_OVERLAP\t2\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_PSK\r\n/* the maximum length of the buffer given to callbacks containing the\r\n * resulting identity/psk */\r\n#define PSK_MAX_IDENTITY_LEN 128\r\n#define PSK_MAX_PSK_LEN 256\r\nvoid SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, \r\n\tunsigned int (*psk_client_callback)(SSL *ssl, const char *hint, \r\n\t\tchar *identity, unsigned int max_identity_len, unsigned char *psk,\r\n\t\tunsigned int max_psk_len));\r\nvoid SSL_set_psk_client_callback(SSL *ssl, \r\n\tunsigned int (*psk_client_callback)(SSL *ssl, const char *hint, \r\n\t\tchar *identity, unsigned int max_identity_len, unsigned char *psk,\r\n\t\tunsigned int max_psk_len));\r\nvoid SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, \r\n\tunsigned int (*psk_server_callback)(SSL *ssl, const char *identity,\r\n\t\tunsigned char *psk, unsigned int max_psk_len));\r\nvoid SSL_set_psk_server_callback(SSL *ssl,\r\n\tunsigned int (*psk_server_callback)(SSL *ssl, const char *identity,\r\n\t\tunsigned char *psk, unsigned int max_psk_len));\r\nint SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint);\r\nint SSL_use_psk_identity_hint(SSL *s, const char *identity_hint);\r\nconst char *SSL_get_psk_identity_hint(const SSL *s);\r\nconst char *SSL_get_psk_identity(const SSL *s);\r\n#endif\r\n\r\n#define SSL_NOTHING\t1\r\n#define SSL_WRITING\t2\r\n#define SSL_READING\t3\r\n#define SSL_X509_LOOKUP\t4\r\n\r\n/* These will only be used when doing non-blocking IO */\r\n#define SSL_want_nothing(s)\t(SSL_want(s) == SSL_NOTHING)\r\n#define SSL_want_read(s)\t(SSL_want(s) == SSL_READING)\r\n#define SSL_want_write(s)\t(SSL_want(s) == SSL_WRITING)\r\n#define SSL_want_x509_lookup(s)\t(SSL_want(s) == SSL_X509_LOOKUP)\r\n\r\n#define SSL_MAC_FLAG_READ_MAC_STREAM 1\r\n#define SSL_MAC_FLAG_WRITE_MAC_STREAM 2\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\nstruct ssl_st\r\n\t{\r\n\t/* protocol version\r\n\t * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)\r\n\t */\r\n\tint version;\r\n\tint type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */\r\n\r\n\tconst SSL_METHOD *method; /* SSLv3 */\r\n\r\n\t/* There are 2 BIO's even though they are normally both the\r\n\t * same.  This is so data can be read and written to different\r\n\t * handlers */\r\n\r\n#ifndef OPENSSL_NO_BIO\r\n\tBIO *rbio; /* used by SSL_read */\r\n\tBIO *wbio; /* used by SSL_write */\r\n\tBIO *bbio; /* used during session-id reuse to concatenate\r\n\t\t    * messages */\r\n#else\r\n\tchar *rbio; /* used by SSL_read */\r\n\tchar *wbio; /* used by SSL_write */\r\n\tchar *bbio;\r\n#endif\r\n\t/* This holds a variable that indicates what we were doing\r\n\t * when a 0 or -1 is returned.  This is needed for\r\n\t * non-blocking IO so we know what request needs re-doing when\r\n\t * in SSL_accept or SSL_connect */\r\n\tint rwstate;\r\n\r\n\t/* true when we are actually in SSL_accept() or SSL_connect() */\r\n\tint in_handshake;\r\n\tint (*handshake_func)(SSL *);\r\n\r\n\t/* Imagine that here's a boolean member \"init\" that is\r\n\t * switched as soon as SSL_set_{accept/connect}_state\r\n\t * is called for the first time, so that \"state\" and\r\n\t * \"handshake_func\" are properly initialized.  But as\r\n\t * handshake_func is == 0 until then, we use this\r\n\t * test instead of an \"init\" member.\r\n\t */\r\n\r\n\tint server;\t/* are we the server side? - mostly used by SSL_clear*/\r\n\r\n\tint new_session;/* Generate a new session or reuse an old one.\r\n\t                 * NB: For servers, the 'new' session may actually be a previously\r\n\t                 * cached session or even the previous session unless\r\n\t                 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */\r\n\tint quiet_shutdown;/* don't send shutdown packets */\r\n\tint shutdown;\t/* we have shut things down, 0x01 sent, 0x02\r\n\t\t\t * for received */\r\n\tint state;\t/* where we are */\r\n\tint rstate;\t/* where we are when reading */\r\n\r\n\tBUF_MEM *init_buf;\t/* buffer used during init */\r\n\tvoid *init_msg;   \t/* pointer to handshake message body, set by ssl3_get_message() */\r\n\tint init_num;\t\t/* amount read/written */\r\n\tint init_off;\t\t/* amount read/written */\r\n\r\n\t/* used internally to point at a raw packet */\r\n\tunsigned char *packet;\r\n\tunsigned int packet_length;\r\n\r\n\tstruct ssl2_state_st *s2; /* SSLv2 variables */\r\n\tstruct ssl3_state_st *s3; /* SSLv3 variables */\r\n\tstruct dtls1_state_st *d1; /* DTLSv1 variables */\r\n\r\n\tint read_ahead;\t\t/* Read as many input bytes as possible\r\n\t               \t \t * (for non-blocking reads) */\r\n\r\n\t/* callback that allows applications to peek at protocol messages */\r\n\tvoid (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);\r\n\tvoid *msg_callback_arg;\r\n\r\n\tint hit;\t\t/* reusing a previous session */\r\n\r\n\tX509_VERIFY_PARAM *param;\r\n\r\n#if 0\r\n\tint purpose;\t\t/* Purpose setting */\r\n\tint trust;\t\t/* Trust setting */\r\n#endif\r\n\r\n\t/* crypto */\r\n\tSTACK_OF(SSL_CIPHER) *cipher_list;\r\n\tSTACK_OF(SSL_CIPHER) *cipher_list_by_id;\r\n\r\n\t/* These are the ones being used, the ones in SSL_SESSION are\r\n\t * the ones to be 'copied' into these ones */\r\n\tint mac_flags; \r\n\tEVP_CIPHER_CTX *enc_read_ctx;\t\t/* cryptographic state */\r\n\tEVP_MD_CTX *read_hash;\t\t/* used for mac generation */\r\n#ifndef OPENSSL_NO_COMP\r\n\tCOMP_CTX *expand;\t\t\t/* uncompress */\r\n#else\r\n\tchar *expand;\r\n#endif\r\n\r\n\tEVP_CIPHER_CTX *enc_write_ctx;\t\t/* cryptographic state */\r\n\tEVP_MD_CTX *write_hash;\t\t/* used for mac generation */\r\n#ifndef OPENSSL_NO_COMP\r\n\tCOMP_CTX *compress;\t\t\t/* compression */\r\n#else\r\n\tchar *compress;\t\r\n#endif\r\n\r\n\t/* session info */\r\n\r\n\t/* client cert? */\r\n\t/* This is used to hold the server certificate used */\r\n\tstruct cert_st /* CERT */ *cert;\r\n\r\n\t/* the session_id_context is used to ensure sessions are only reused\r\n\t * in the appropriate context */\r\n\tunsigned int sid_ctx_length;\r\n\tunsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];\r\n\r\n\t/* This can also be in the session once a session is established */\r\n\tSSL_SESSION *session;\r\n\r\n\t/* Default generate session ID callback. */\r\n\tGEN_SESSION_CB generate_session_id;\r\n\r\n\t/* Used in SSL2 and SSL3 */\r\n\tint verify_mode;\t/* 0 don't care about verify failure.\r\n\t\t\t\t * 1 fail if verify fails */\r\n\tint (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */\r\n\r\n\tvoid (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */\r\n\r\n\tint error;\t\t/* error bytes to be written */\r\n\tint error_code;\t\t/* actual code */\r\n\r\n#ifndef OPENSSL_NO_KRB5\r\n\tKSSL_CTX *kssl_ctx;     /* Kerberos 5 context */\r\n#endif\t/* OPENSSL_NO_KRB5 */\r\n\r\n#ifndef OPENSSL_NO_PSK\r\n\tunsigned int (*psk_client_callback)(SSL *ssl, const char *hint, char *identity,\r\n\t\tunsigned int max_identity_len, unsigned char *psk,\r\n\t\tunsigned int max_psk_len);\r\n\tunsigned int (*psk_server_callback)(SSL *ssl, const char *identity,\r\n\t\tunsigned char *psk, unsigned int max_psk_len);\r\n#endif\r\n\r\n\tSSL_CTX *ctx;\r\n\t/* set this flag to 1 and a sleep(1) is put into all SSL_read()\r\n\t * and SSL_write() calls, good for nbio debuging :-) */\r\n\tint debug;\t\r\n\r\n\t/* extra application data */\r\n\tlong verify_result;\r\n\tCRYPTO_EX_DATA ex_data;\r\n\r\n\t/* for server side, keep the list of CA_dn we can use */\r\n\tSTACK_OF(X509_NAME) *client_CA;\r\n\r\n\tint references;\r\n\tunsigned long options; /* protocol behaviour */\r\n\tunsigned long mode; /* API behaviour */\r\n\tlong max_cert_list;\r\n\tint first_packet;\r\n\tint client_version;\t/* what was passed, used for\r\n\t\t\t\t * SSLv3/TLS rollback check */\r\n\tunsigned int max_send_fragment;\r\n#ifndef OPENSSL_NO_TLSEXT\r\n\t/* TLS extension debug callback */\r\n\tvoid (*tlsext_debug_cb)(SSL *s, int client_server, int type,\r\n\t\t\t\t\tunsigned char *data, int len,\r\n\t\t\t\t\tvoid *arg);\r\n\tvoid *tlsext_debug_arg;\r\n\tchar *tlsext_hostname;\r\n\tint servername_done;   /* no further mod of servername \r\n\t                          0 : call the servername extension callback.\r\n\t                          1 : prepare 2, allow last ack just after in server callback.\r\n\t                          2 : don't call servername callback, no ack in server hello\r\n\t                       */\r\n\t/* certificate status request info */\r\n\t/* Status type or -1 if no status type */\r\n\tint tlsext_status_type;\r\n\t/* Expect OCSP CertificateStatus message */\r\n\tint tlsext_status_expected;\r\n\t/* OCSP status request only */\r\n\tSTACK_OF(OCSP_RESPID) *tlsext_ocsp_ids;\r\n\tX509_EXTENSIONS *tlsext_ocsp_exts;\r\n\t/* OCSP response received or to be sent */\r\n\tunsigned char *tlsext_ocsp_resp;\r\n\tint tlsext_ocsp_resplen;\r\n\r\n\t/* RFC4507 session ticket expected to be received or sent */\r\n\tint tlsext_ticket_expected;\r\n#ifndef OPENSSL_NO_EC\r\n\tsize_t tlsext_ecpointformatlist_length;\r\n\tunsigned char *tlsext_ecpointformatlist; /* our list */\r\n\tsize_t tlsext_ellipticcurvelist_length;\r\n\tunsigned char *tlsext_ellipticcurvelist; /* our list */\r\n#endif /* OPENSSL_NO_EC */\r\n\r\n\t/* draft-rescorla-tls-opaque-prf-input-00.txt information to be used for handshakes */\r\n\tvoid *tlsext_opaque_prf_input;\r\n\tsize_t tlsext_opaque_prf_input_len;\r\n\r\n\t/* TLS Session Ticket extension override */\r\n\tTLS_SESSION_TICKET_EXT *tlsext_session_ticket;\r\n\r\n\t/* TLS Session Ticket extension callback */\r\n\ttls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb;\r\n\tvoid *tls_session_ticket_ext_cb_arg;\r\n\r\n\t/* TLS pre-shared secret session resumption */\r\n\ttls_session_secret_cb_fn tls_session_secret_cb;\r\n\tvoid *tls_session_secret_cb_arg;\r\n\r\n\tSSL_CTX * initial_ctx; /* initial ctx, used to store sessions */\r\n\r\n#ifndef OPENSSL_NO_NEXTPROTONEG\r\n\t/* Next protocol negotiation. For the client, this is the protocol that\r\n\t * we sent in NextProtocol and is set when handling ServerHello\r\n\t * extensions.\r\n\t *\r\n\t * For a server, this is the client's selected_protocol from\r\n\t * NextProtocol and is set when handling the NextProtocol message,\r\n\t * before the Finished message. */\r\n\tunsigned char *next_proto_negotiated;\r\n\tunsigned char next_proto_negotiated_len;\r\n#endif\r\n\r\n#define session_ctx initial_ctx\r\n\r\n\tSTACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;  /* What we'll do */\r\n\tSRTP_PROTECTION_PROFILE *srtp_profile;            /* What's been chosen */\r\n\r\n\tunsigned int tlsext_heartbeat;  /* Is use of the Heartbeat extension negotiated?\r\n\t                                   0: disabled\r\n\t                                   1: enabled\r\n\t                                   2: enabled, but not allowed to send Requests\r\n\t                                 */\r\n\tunsigned int tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in flight */\r\n\tunsigned int tlsext_hb_seq;     /* HeartbeatRequest sequence number */\r\n#else\r\n#define session_ctx ctx\r\n#endif /* OPENSSL_NO_TLSEXT */\r\n\r\n\tint renegotiate;/* 1 if we are renegotiating.\r\n\t                 * 2 if we are a server and are inside a handshake\r\n\t                 * (i.e. not just sending a HelloRequest) */\r\n\r\n#ifndef OPENSSL_NO_SRP\r\n\tSRP_CTX srp_ctx; /* ctx for SRP authentication */\r\n#endif\r\n\t};\r\n\r\n#endif\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#include <openssl/ssl2.h>\r\n#include <openssl/ssl3.h>\r\n#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */\r\n#include <openssl/dtls1.h> /* Datagram TLS */\r\n#include <openssl/ssl23.h>\r\n#include <openssl/srtp.h>  /* Support for the use_srtp extension */\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* compatibility */\r\n#define SSL_set_app_data(s,arg)\t\t(SSL_set_ex_data(s,0,(char *)arg))\r\n#define SSL_get_app_data(s)\t\t(SSL_get_ex_data(s,0))\r\n#define SSL_SESSION_set_app_data(s,a)\t(SSL_SESSION_set_ex_data(s,0,(char *)a))\r\n#define SSL_SESSION_get_app_data(s)\t(SSL_SESSION_get_ex_data(s,0))\r\n#define SSL_CTX_get_app_data(ctx)\t(SSL_CTX_get_ex_data(ctx,0))\r\n#define SSL_CTX_set_app_data(ctx,arg)\t(SSL_CTX_set_ex_data(ctx,0,(char *)arg))\r\n\r\n/* The following are the possible values for ssl->state are are\r\n * used to indicate where we are up to in the SSL connection establishment.\r\n * The macros that follow are about the only things you should need to use\r\n * and even then, only when using non-blocking IO.\r\n * It can also be useful to work out where you were when the connection\r\n * failed */\r\n\r\n#define SSL_ST_CONNECT\t\t\t0x1000\r\n#define SSL_ST_ACCEPT\t\t\t0x2000\r\n#define SSL_ST_MASK\t\t\t0x0FFF\r\n#define SSL_ST_INIT\t\t\t(SSL_ST_CONNECT|SSL_ST_ACCEPT)\r\n#define SSL_ST_BEFORE\t\t\t0x4000\r\n#define SSL_ST_OK\t\t\t0x03\r\n#define SSL_ST_RENEGOTIATE\t\t(0x04|SSL_ST_INIT)\r\n\r\n#define SSL_CB_LOOP\t\t\t0x01\r\n#define SSL_CB_EXIT\t\t\t0x02\r\n#define SSL_CB_READ\t\t\t0x04\r\n#define SSL_CB_WRITE\t\t\t0x08\r\n#define SSL_CB_ALERT\t\t\t0x4000 /* used in callback */\r\n#define SSL_CB_READ_ALERT\t\t(SSL_CB_ALERT|SSL_CB_READ)\r\n#define SSL_CB_WRITE_ALERT\t\t(SSL_CB_ALERT|SSL_CB_WRITE)\r\n#define SSL_CB_ACCEPT_LOOP\t\t(SSL_ST_ACCEPT|SSL_CB_LOOP)\r\n#define SSL_CB_ACCEPT_EXIT\t\t(SSL_ST_ACCEPT|SSL_CB_EXIT)\r\n#define SSL_CB_CONNECT_LOOP\t\t(SSL_ST_CONNECT|SSL_CB_LOOP)\r\n#define SSL_CB_CONNECT_EXIT\t\t(SSL_ST_CONNECT|SSL_CB_EXIT)\r\n#define SSL_CB_HANDSHAKE_START\t\t0x10\r\n#define SSL_CB_HANDSHAKE_DONE\t\t0x20\r\n\r\n/* Is the SSL_connection established? */\r\n#define SSL_get_state(a)\t\tSSL_state(a)\r\n#define SSL_is_init_finished(a)\t\t(SSL_state(a) == SSL_ST_OK)\r\n#define SSL_in_init(a)\t\t\t(SSL_state(a)&SSL_ST_INIT)\r\n#define SSL_in_before(a)\t\t(SSL_state(a)&SSL_ST_BEFORE)\r\n#define SSL_in_connect_init(a)\t\t(SSL_state(a)&SSL_ST_CONNECT)\r\n#define SSL_in_accept_init(a)\t\t(SSL_state(a)&SSL_ST_ACCEPT)\r\n\r\n/* The following 2 states are kept in ssl->rstate when reads fail,\r\n * you should not need these */\r\n#define SSL_ST_READ_HEADER\t\t\t0xF0\r\n#define SSL_ST_READ_BODY\t\t\t0xF1\r\n#define SSL_ST_READ_DONE\t\t\t0xF2\r\n\r\n/* Obtain latest Finished message\r\n *   -- that we sent (SSL_get_finished)\r\n *   -- that we expected from peer (SSL_get_peer_finished).\r\n * Returns length (0 == no Finished so far), copies up to 'count' bytes. */\r\nsize_t SSL_get_finished(const SSL *s, void *buf, size_t count);\r\nsize_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);\r\n\r\n/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options\r\n * are 'ored' with SSL_VERIFY_PEER if they are desired */\r\n#define SSL_VERIFY_NONE\t\t\t0x00\r\n#define SSL_VERIFY_PEER\t\t\t0x01\r\n#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT\t0x02\r\n#define SSL_VERIFY_CLIENT_ONCE\t\t0x04\r\n\r\n#define OpenSSL_add_ssl_algorithms()\tSSL_library_init()\r\n#define SSLeay_add_ssl_algorithms()\tSSL_library_init()\r\n\r\n/* this is for backward compatibility */\r\n#if 0 /* NEW_SSLEAY */\r\n#define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)\r\n#define SSL_set_pref_cipher(c,n)\tSSL_set_cipher_list(c,n)\r\n#define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))\r\n#define SSL_remove_session(a,b)\t\tSSL_CTX_remove_session((a),(b))\r\n#define SSL_flush_sessions(a,b)\t\tSSL_CTX_flush_sessions((a),(b))\r\n#endif\r\n/* More backward compatibility */\r\n#define SSL_get_cipher(s) \\\r\n\t\tSSL_CIPHER_get_name(SSL_get_current_cipher(s))\r\n#define SSL_get_cipher_bits(s,np) \\\r\n\t\tSSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)\r\n#define SSL_get_cipher_version(s) \\\r\n\t\tSSL_CIPHER_get_version(SSL_get_current_cipher(s))\r\n#define SSL_get_cipher_name(s) \\\r\n\t\tSSL_CIPHER_get_name(SSL_get_current_cipher(s))\r\n#define SSL_get_time(a)\t\tSSL_SESSION_get_time(a)\r\n#define SSL_set_time(a,b)\tSSL_SESSION_set_time((a),(b))\r\n#define SSL_get_timeout(a)\tSSL_SESSION_get_timeout(a)\r\n#define SSL_set_timeout(a,b)\tSSL_SESSION_set_timeout((a),(b))\r\n\r\n#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)\r\n#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)\r\n\r\nDECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)\r\n\r\n#define SSL_AD_REASON_OFFSET\t\t1000 /* offset to get SSL_R_... value from SSL_AD_... */\r\n\r\n/* These alert types are for SSLv3 and TLSv1 */\r\n#define SSL_AD_CLOSE_NOTIFY\t\tSSL3_AD_CLOSE_NOTIFY\r\n#define SSL_AD_UNEXPECTED_MESSAGE\tSSL3_AD_UNEXPECTED_MESSAGE /* fatal */\r\n#define SSL_AD_BAD_RECORD_MAC\t\tSSL3_AD_BAD_RECORD_MAC     /* fatal */\r\n#define SSL_AD_DECRYPTION_FAILED\tTLS1_AD_DECRYPTION_FAILED\r\n#define SSL_AD_RECORD_OVERFLOW\t\tTLS1_AD_RECORD_OVERFLOW\r\n#define SSL_AD_DECOMPRESSION_FAILURE\tSSL3_AD_DECOMPRESSION_FAILURE/* fatal */\r\n#define SSL_AD_HANDSHAKE_FAILURE\tSSL3_AD_HANDSHAKE_FAILURE/* fatal */\r\n#define SSL_AD_NO_CERTIFICATE\t\tSSL3_AD_NO_CERTIFICATE /* Not for TLS */\r\n#define SSL_AD_BAD_CERTIFICATE\t\tSSL3_AD_BAD_CERTIFICATE\r\n#define SSL_AD_UNSUPPORTED_CERTIFICATE\tSSL3_AD_UNSUPPORTED_CERTIFICATE\r\n#define SSL_AD_CERTIFICATE_REVOKED\tSSL3_AD_CERTIFICATE_REVOKED\r\n#define SSL_AD_CERTIFICATE_EXPIRED\tSSL3_AD_CERTIFICATE_EXPIRED\r\n#define SSL_AD_CERTIFICATE_UNKNOWN\tSSL3_AD_CERTIFICATE_UNKNOWN\r\n#define SSL_AD_ILLEGAL_PARAMETER\tSSL3_AD_ILLEGAL_PARAMETER   /* fatal */\r\n#define SSL_AD_UNKNOWN_CA\t\tTLS1_AD_UNKNOWN_CA\t/* fatal */\r\n#define SSL_AD_ACCESS_DENIED\t\tTLS1_AD_ACCESS_DENIED\t/* fatal */\r\n#define SSL_AD_DECODE_ERROR\t\tTLS1_AD_DECODE_ERROR\t/* fatal */\r\n#define SSL_AD_DECRYPT_ERROR\t\tTLS1_AD_DECRYPT_ERROR\r\n#define SSL_AD_EXPORT_RESTRICTION\tTLS1_AD_EXPORT_RESTRICTION/* fatal */\r\n#define SSL_AD_PROTOCOL_VERSION\t\tTLS1_AD_PROTOCOL_VERSION /* fatal */\r\n#define SSL_AD_INSUFFICIENT_SECURITY\tTLS1_AD_INSUFFICIENT_SECURITY/* fatal */\r\n#define SSL_AD_INTERNAL_ERROR\t\tTLS1_AD_INTERNAL_ERROR\t/* fatal */\r\n#define SSL_AD_USER_CANCELLED\t\tTLS1_AD_USER_CANCELLED\r\n#define SSL_AD_NO_RENEGOTIATION\t\tTLS1_AD_NO_RENEGOTIATION\r\n#define SSL_AD_UNSUPPORTED_EXTENSION\tTLS1_AD_UNSUPPORTED_EXTENSION\r\n#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE\r\n#define SSL_AD_UNRECOGNIZED_NAME\tTLS1_AD_UNRECOGNIZED_NAME\r\n#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE\r\n#define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE\r\n#define SSL_AD_UNKNOWN_PSK_IDENTITY     TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */\r\n\r\n#define SSL_ERROR_NONE\t\t\t0\r\n#define SSL_ERROR_SSL\t\t\t1\r\n#define SSL_ERROR_WANT_READ\t\t2\r\n#define SSL_ERROR_WANT_WRITE\t\t3\r\n#define SSL_ERROR_WANT_X509_LOOKUP\t4\r\n#define SSL_ERROR_SYSCALL\t\t5 /* look at error stack/return value/errno */\r\n#define SSL_ERROR_ZERO_RETURN\t\t6\r\n#define SSL_ERROR_WANT_CONNECT\t\t7\r\n#define SSL_ERROR_WANT_ACCEPT\t\t8\r\n\r\n#define SSL_CTRL_NEED_TMP_RSA\t\t\t1\r\n#define SSL_CTRL_SET_TMP_RSA\t\t\t2\r\n#define SSL_CTRL_SET_TMP_DH\t\t\t3\r\n#define SSL_CTRL_SET_TMP_ECDH\t\t\t4\r\n#define SSL_CTRL_SET_TMP_RSA_CB\t\t\t5\r\n#define SSL_CTRL_SET_TMP_DH_CB\t\t\t6\r\n#define SSL_CTRL_SET_TMP_ECDH_CB\t\t7\r\n\r\n#define SSL_CTRL_GET_SESSION_REUSED\t\t8\r\n#define SSL_CTRL_GET_CLIENT_CERT_REQUEST\t9\r\n#define SSL_CTRL_GET_NUM_RENEGOTIATIONS\t\t10\r\n#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS\t11\r\n#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS\t12\r\n#define SSL_CTRL_GET_FLAGS\t\t\t13\r\n#define SSL_CTRL_EXTRA_CHAIN_CERT\t\t14\r\n\r\n#define SSL_CTRL_SET_MSG_CALLBACK               15\r\n#define SSL_CTRL_SET_MSG_CALLBACK_ARG           16\r\n\r\n/* only applies to datagram connections */\r\n#define SSL_CTRL_SET_MTU                17\r\n/* Stats */\r\n#define SSL_CTRL_SESS_NUMBER\t\t\t20\r\n#define SSL_CTRL_SESS_CONNECT\t\t\t21\r\n#define SSL_CTRL_SESS_CONNECT_GOOD\t\t22\r\n#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE\t23\r\n#define SSL_CTRL_SESS_ACCEPT\t\t\t24\r\n#define SSL_CTRL_SESS_ACCEPT_GOOD\t\t25\r\n#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE\t26\r\n#define SSL_CTRL_SESS_HIT\t\t\t27\r\n#define SSL_CTRL_SESS_CB_HIT\t\t\t28\r\n#define SSL_CTRL_SESS_MISSES\t\t\t29\r\n#define SSL_CTRL_SESS_TIMEOUTS\t\t\t30\r\n#define SSL_CTRL_SESS_CACHE_FULL\t\t31\r\n#define SSL_CTRL_OPTIONS\t\t\t32\r\n#define SSL_CTRL_MODE\t\t\t\t33\r\n\r\n#define SSL_CTRL_GET_READ_AHEAD\t\t\t40\r\n#define SSL_CTRL_SET_READ_AHEAD\t\t\t41\r\n#define SSL_CTRL_SET_SESS_CACHE_SIZE\t\t42\r\n#define SSL_CTRL_GET_SESS_CACHE_SIZE\t\t43\r\n#define SSL_CTRL_SET_SESS_CACHE_MODE\t\t44\r\n#define SSL_CTRL_GET_SESS_CACHE_MODE\t\t45\r\n\r\n#define SSL_CTRL_GET_MAX_CERT_LIST\t\t50\r\n#define SSL_CTRL_SET_MAX_CERT_LIST\t\t51\r\n\r\n#define SSL_CTRL_SET_MAX_SEND_FRAGMENT\t\t52\r\n\r\n/* see tls1.h for macros based on these */\r\n#ifndef OPENSSL_NO_TLSEXT\r\n#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB\t53\r\n#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG\t54\r\n#define SSL_CTRL_SET_TLSEXT_HOSTNAME\t\t55\r\n#define SSL_CTRL_SET_TLSEXT_DEBUG_CB\t\t56\r\n#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG\t\t57\r\n#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS\t\t58\r\n#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS\t\t59\r\n#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT\t60\r\n#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB\t61\r\n#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62\r\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB\t63\r\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG\t64\r\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE\t65\r\n#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS\t66\r\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS\t67\r\n#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS\t68\r\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS\t69\r\n#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP\t70\r\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP\t71\r\n\r\n#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB\t72\r\n\r\n#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB\t75\r\n#define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB\t\t76\r\n#define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB\t\t77\r\n\r\n#define SSL_CTRL_SET_SRP_ARG\t\t78\r\n#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME\t\t79\r\n#define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH\t\t80\r\n#define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD\t\t81\r\n#ifndef OPENSSL_NO_HEARTBEATS\r\n#define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT\t\t\t\t85\r\n#define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING\t\t86\r\n#define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS\t87\r\n#endif\r\n#endif\r\n\r\n#define DTLS_CTRL_GET_TIMEOUT\t\t73\r\n#define DTLS_CTRL_HANDLE_TIMEOUT\t74\r\n#define DTLS_CTRL_LISTEN\t\t\t75\r\n\r\n#define SSL_CTRL_GET_RI_SUPPORT\t\t\t76\r\n#define SSL_CTRL_CLEAR_OPTIONS\t\t\t77\r\n#define SSL_CTRL_CLEAR_MODE\t\t\t78\r\n\r\n#define SSL_CTRL_GET_EXTRA_CHAIN_CERTS\t\t82\r\n#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS\t83\r\n\r\n#define DTLSv1_get_timeout(ssl, arg) \\\r\n\tSSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg)\r\n#define DTLSv1_handle_timeout(ssl) \\\r\n\tSSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL)\r\n#define DTLSv1_listen(ssl, peer) \\\r\n\tSSL_ctrl(ssl,DTLS_CTRL_LISTEN,0, (void *)peer)\r\n\r\n#define SSL_session_reused(ssl) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)\r\n#define SSL_num_renegotiations(ssl) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)\r\n#define SSL_clear_num_renegotiations(ssl) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)\r\n#define SSL_total_renegotiations(ssl) \\\r\n\tSSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)\r\n\r\n#define SSL_CTX_need_tmp_RSA(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)\r\n#define SSL_CTX_set_tmp_rsa(ctx,rsa) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)\r\n#define SSL_CTX_set_tmp_dh(ctx,dh) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)\r\n#define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)\r\n\r\n#define SSL_need_tmp_RSA(ssl) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)\r\n#define SSL_set_tmp_rsa(ssl,rsa) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)\r\n#define SSL_set_tmp_dh(ssl,dh) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)\r\n#define SSL_set_tmp_ecdh(ssl,ecdh) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)\r\n\r\n#define SSL_CTX_add_extra_chain_cert(ctx,x509) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)\r\n#define SSL_CTX_get_extra_chain_certs(ctx,px509) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509)\r\n#define SSL_CTX_clear_extra_chain_certs(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL)\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nBIO_METHOD *BIO_f_ssl(void);\r\nBIO *BIO_new_ssl(SSL_CTX *ctx,int client);\r\nBIO *BIO_new_ssl_connect(SSL_CTX *ctx);\r\nBIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);\r\nint BIO_ssl_copy_session_id(BIO *to,BIO *from);\r\nvoid BIO_ssl_shutdown(BIO *ssl_bio);\r\n\r\n#endif\r\n\r\nint\tSSL_CTX_set_cipher_list(SSL_CTX *,const char *str);\r\nSSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);\r\nvoid\tSSL_CTX_free(SSL_CTX *);\r\nlong SSL_CTX_set_timeout(SSL_CTX *ctx,long t);\r\nlong SSL_CTX_get_timeout(const SSL_CTX *ctx);\r\nX509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);\r\nvoid SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);\r\nint SSL_want(const SSL *s);\r\nint\tSSL_clear(SSL *s);\r\n\r\nvoid\tSSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);\r\n\r\nconst SSL_CIPHER *SSL_get_current_cipher(const SSL *s);\r\nint\tSSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits);\r\nchar *\tSSL_CIPHER_get_version(const SSL_CIPHER *c);\r\nconst char *\tSSL_CIPHER_get_name(const SSL_CIPHER *c);\r\nunsigned long \tSSL_CIPHER_get_id(const SSL_CIPHER *c);\r\n\r\nint\tSSL_get_fd(const SSL *s);\r\nint\tSSL_get_rfd(const SSL *s);\r\nint\tSSL_get_wfd(const SSL *s);\r\nconst char  * SSL_get_cipher_list(const SSL *s,int n);\r\nchar *\tSSL_get_shared_ciphers(const SSL *s, char *buf, int len);\r\nint\tSSL_get_read_ahead(const SSL * s);\r\nint\tSSL_pending(const SSL *s);\r\n#ifndef OPENSSL_NO_SOCK\r\nint\tSSL_set_fd(SSL *s, int fd);\r\nint\tSSL_set_rfd(SSL *s, int fd);\r\nint\tSSL_set_wfd(SSL *s, int fd);\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\nvoid\tSSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);\r\nBIO *\tSSL_get_rbio(const SSL *s);\r\nBIO *\tSSL_get_wbio(const SSL *s);\r\n#endif\r\nint\tSSL_set_cipher_list(SSL *s, const char *str);\r\nvoid\tSSL_set_read_ahead(SSL *s, int yes);\r\nint\tSSL_get_verify_mode(const SSL *s);\r\nint\tSSL_get_verify_depth(const SSL *s);\r\nint\t(*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *);\r\nvoid\tSSL_set_verify(SSL *s, int mode,\r\n\t\t       int (*callback)(int ok,X509_STORE_CTX *ctx));\r\nvoid\tSSL_set_verify_depth(SSL *s, int depth);\r\n#ifndef OPENSSL_NO_RSA\r\nint\tSSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);\r\n#endif\r\nint\tSSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);\r\nint\tSSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);\r\nint\tSSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len);\r\nint\tSSL_use_certificate(SSL *ssl, X509 *x);\r\nint\tSSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);\r\n\r\n#ifndef OPENSSL_NO_STDIO\r\nint\tSSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);\r\nint\tSSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);\r\nint\tSSL_use_certificate_file(SSL *ssl, const char *file, int type);\r\nint\tSSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);\r\nint\tSSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);\r\nint\tSSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);\r\nint\tSSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */\r\nSTACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);\r\nint\tSSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,\r\n\t\t\t\t\t    const char *file);\r\n#ifndef OPENSSL_SYS_VMS\r\n#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */\r\nint\tSSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,\r\n\t\t\t\t\t   const char *dir);\r\n#endif\r\n#endif\r\n\r\n#endif\r\n\r\nvoid\tSSL_load_error_strings(void );\r\nconst char *SSL_state_string(const SSL *s);\r\nconst char *SSL_rstate_string(const SSL *s);\r\nconst char *SSL_state_string_long(const SSL *s);\r\nconst char *SSL_rstate_string_long(const SSL *s);\r\nlong\tSSL_SESSION_get_time(const SSL_SESSION *s);\r\nlong\tSSL_SESSION_set_time(SSL_SESSION *s, long t);\r\nlong\tSSL_SESSION_get_timeout(const SSL_SESSION *s);\r\nlong\tSSL_SESSION_set_timeout(SSL_SESSION *s, long t);\r\nvoid\tSSL_copy_session_id(SSL *to,const SSL *from);\r\nX509 *SSL_SESSION_get0_peer(SSL_SESSION *s);\r\nint SSL_SESSION_set1_id_context(SSL_SESSION *s,const unsigned char *sid_ctx,\r\n\t\t\t       unsigned int sid_ctx_len);\r\n\r\nSSL_SESSION *SSL_SESSION_new(void);\r\nconst unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,\r\n\t\t\t\t\tunsigned int *len);\r\nunsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);\r\n#ifndef OPENSSL_NO_FP_API\r\nint\tSSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\nint\tSSL_SESSION_print(BIO *fp,const SSL_SESSION *ses);\r\n#endif\r\nvoid\tSSL_SESSION_free(SSL_SESSION *ses);\r\nint\ti2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);\r\nint\tSSL_set_session(SSL *to, SSL_SESSION *session);\r\nint\tSSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);\r\nint\tSSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);\r\nint\tSSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);\r\nint\tSSL_set_generate_session_id(SSL *, GEN_SESSION_CB);\r\nint\tSSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,\r\n\t\t\t\t\tunsigned int id_len);\r\nSSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,\r\n\t\t\t     long length);\r\n\r\n#ifdef HEADER_X509_H\r\nX509 *\tSSL_get_peer_certificate(const SSL *s);\r\n#endif\r\n\r\nSTACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);\r\n\r\nint SSL_CTX_get_verify_mode(const SSL_CTX *ctx);\r\nint SSL_CTX_get_verify_depth(const SSL_CTX *ctx);\r\nint (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *);\r\nvoid SSL_CTX_set_verify(SSL_CTX *ctx,int mode,\r\n\t\t\tint (*callback)(int, X509_STORE_CTX *));\r\nvoid SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth);\r\nvoid SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg);\r\n#ifndef OPENSSL_NO_RSA\r\nint SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);\r\n#endif\r\nint SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);\r\nint SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);\r\nint SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx,\r\n\tconst unsigned char *d, long len);\r\nint SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);\r\nint SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);\r\n\r\nvoid SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);\r\nvoid SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);\r\n\r\nint SSL_CTX_check_private_key(const SSL_CTX *ctx);\r\nint SSL_check_private_key(const SSL *ctx);\r\n\r\nint\tSSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,\r\n\t\t\t\t       unsigned int sid_ctx_len);\r\n\r\nSSL *\tSSL_new(SSL_CTX *ctx);\r\nint\tSSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,\r\n\t\t\t\t   unsigned int sid_ctx_len);\r\n\r\nint SSL_CTX_set_purpose(SSL_CTX *s, int purpose);\r\nint SSL_set_purpose(SSL *s, int purpose);\r\nint SSL_CTX_set_trust(SSL_CTX *s, int trust);\r\nint SSL_set_trust(SSL *s, int trust);\r\n\r\nint SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);\r\nint SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);\r\n\r\n#ifndef OPENSSL_NO_SRP\r\nint SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name);\r\nint SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password);\r\nint SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);\r\nint SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,\r\n\t\t\t\t\tchar *(*cb)(SSL *,void *));\r\nint SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,\r\n\t\t\t\t\t  int (*cb)(SSL *,void *));\r\nint SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,\r\n\t\t\t\t      int (*cb)(SSL *,int *,void *));\r\nint SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);\r\n\r\nint SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,\r\n\t\t\t     BIGNUM *sa, BIGNUM *v, char *info);\r\nint SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,\r\n\t\t\t\tconst char *grp);\r\n\r\nBIGNUM *SSL_get_srp_g(SSL *s);\r\nBIGNUM *SSL_get_srp_N(SSL *s);\r\n\r\nchar *SSL_get_srp_username(SSL *s);\r\nchar *SSL_get_srp_userinfo(SSL *s);\r\n#endif\r\n\r\nvoid\tSSL_free(SSL *ssl);\r\nint \tSSL_accept(SSL *ssl);\r\nint \tSSL_connect(SSL *ssl);\r\nint \tSSL_read(SSL *ssl,void *buf,int num);\r\nint \tSSL_peek(SSL *ssl,void *buf,int num);\r\nint \tSSL_write(SSL *ssl,const void *buf,int num);\r\nlong\tSSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);\r\nlong\tSSL_callback_ctrl(SSL *, int, void (*)(void));\r\nlong\tSSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);\r\nlong\tSSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));\r\n\r\nint\tSSL_get_error(const SSL *s,int ret_code);\r\nconst char *SSL_get_version(const SSL *s);\r\n\r\n/* This sets the 'default' SSL version that SSL_new() will create */\r\nint SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth);\r\n\r\n#ifndef OPENSSL_NO_SSL2\r\nconst SSL_METHOD *SSLv2_method(void);\t\t/* SSLv2 */\r\nconst SSL_METHOD *SSLv2_server_method(void);\t/* SSLv2 */\r\nconst SSL_METHOD *SSLv2_client_method(void);\t/* SSLv2 */\r\n#endif\r\n\r\nconst SSL_METHOD *SSLv3_method(void);\t\t/* SSLv3 */\r\nconst SSL_METHOD *SSLv3_server_method(void);\t/* SSLv3 */\r\nconst SSL_METHOD *SSLv3_client_method(void);\t/* SSLv3 */\r\n\r\nconst SSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2 */\r\nconst SSL_METHOD *SSLv23_server_method(void);\t/* SSLv3 but can rollback to v2 */\r\nconst SSL_METHOD *SSLv23_client_method(void);\t/* SSLv3 but can rollback to v2 */\r\n\r\nconst SSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\r\nconst SSL_METHOD *TLSv1_server_method(void);\t/* TLSv1.0 */\r\nconst SSL_METHOD *TLSv1_client_method(void);\t/* TLSv1.0 */\r\n\r\nconst SSL_METHOD *TLSv1_1_method(void);\t\t/* TLSv1.1 */\r\nconst SSL_METHOD *TLSv1_1_server_method(void);\t/* TLSv1.1 */\r\nconst SSL_METHOD *TLSv1_1_client_method(void);\t/* TLSv1.1 */\r\n\r\nconst SSL_METHOD *TLSv1_2_method(void);\t\t/* TLSv1.2 */\r\nconst SSL_METHOD *TLSv1_2_server_method(void);\t/* TLSv1.2 */\r\nconst SSL_METHOD *TLSv1_2_client_method(void);\t/* TLSv1.2 */\r\n\r\n\r\nconst SSL_METHOD *DTLSv1_method(void);\t\t/* DTLSv1.0 */\r\nconst SSL_METHOD *DTLSv1_server_method(void);\t/* DTLSv1.0 */\r\nconst SSL_METHOD *DTLSv1_client_method(void);\t/* DTLSv1.0 */\r\n\r\nSTACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);\r\n\r\nint SSL_do_handshake(SSL *s);\r\nint SSL_renegotiate(SSL *s);\r\nint SSL_renegotiate_abbreviated(SSL *s);\r\nint SSL_renegotiate_pending(SSL *s);\r\nint SSL_shutdown(SSL *s);\r\n\r\nconst SSL_METHOD *SSL_get_ssl_method(SSL *s);\r\nint SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);\r\nconst char *SSL_alert_type_string_long(int value);\r\nconst char *SSL_alert_type_string(int value);\r\nconst char *SSL_alert_desc_string_long(int value);\r\nconst char *SSL_alert_desc_string(int value);\r\n\r\nvoid SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);\r\nvoid SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);\r\nSTACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);\r\nSTACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);\r\nint SSL_add_client_CA(SSL *ssl,X509 *x);\r\nint SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x);\r\n\r\nvoid SSL_set_connect_state(SSL *s);\r\nvoid SSL_set_accept_state(SSL *s);\r\n\r\nlong SSL_get_default_timeout(const SSL *s);\r\n\r\nint SSL_library_init(void );\r\n\r\nchar *SSL_CIPHER_description(const SSL_CIPHER *,char *buf,int size);\r\nSTACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);\r\n\r\nSSL *SSL_dup(SSL *ssl);\r\n\r\nX509 *SSL_get_certificate(const SSL *ssl);\r\n/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl);\r\n\r\nvoid SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode);\r\nint SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);\r\nvoid SSL_set_quiet_shutdown(SSL *ssl,int mode);\r\nint SSL_get_quiet_shutdown(const SSL *ssl);\r\nvoid SSL_set_shutdown(SSL *ssl,int mode);\r\nint SSL_get_shutdown(const SSL *ssl);\r\nint SSL_version(const SSL *ssl);\r\nint SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);\r\nint SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,\r\n\tconst char *CApath);\r\n#define SSL_get0_session SSL_get_session /* just peek at pointer */\r\nSSL_SESSION *SSL_get_session(const SSL *ssl);\r\nSSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */\r\nSSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);\r\nSSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx);\r\nvoid SSL_set_info_callback(SSL *ssl,\r\n\t\t\t   void (*cb)(const SSL *ssl,int type,int val));\r\nvoid (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val);\r\nint SSL_state(const SSL *ssl);\r\nvoid SSL_set_state(SSL *ssl, int state);\r\n\r\nvoid SSL_set_verify_result(SSL *ssl,long v);\r\nlong SSL_get_verify_result(const SSL *ssl);\r\n\r\nint SSL_set_ex_data(SSL *ssl,int idx,void *data);\r\nvoid *SSL_get_ex_data(const SSL *ssl,int idx);\r\nint SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\n\r\nint SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data);\r\nvoid *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx);\r\nint SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\n\r\nint SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data);\r\nvoid *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx);\r\nint SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\n\r\nint SSL_get_ex_data_X509_STORE_CTX_idx(void );\r\n\r\n#define SSL_CTX_sess_set_cache_size(ctx,t) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)\r\n#define SSL_CTX_sess_get_cache_size(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)\r\n#define SSL_CTX_set_session_cache_mode(ctx,m) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)\r\n#define SSL_CTX_get_session_cache_mode(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)\r\n\r\n#define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx)\r\n#define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m)\r\n#define SSL_CTX_get_read_ahead(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)\r\n#define SSL_CTX_set_read_ahead(ctx,m) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)\r\n#define SSL_CTX_get_max_cert_list(ctx) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)\r\n#define SSL_CTX_set_max_cert_list(ctx,m) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)\r\n#define SSL_get_max_cert_list(ssl) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)\r\n#define SSL_set_max_cert_list(ssl,m) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)\r\n\r\n#define SSL_CTX_set_max_send_fragment(ctx,m) \\\r\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)\r\n#define SSL_set_max_send_fragment(ssl,m) \\\r\n\tSSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)\r\n\r\n     /* NB: the keylength is only applicable when is_export is true */\r\n#ifndef OPENSSL_NO_RSA\r\nvoid SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,\r\n\t\t\t\t  RSA *(*cb)(SSL *ssl,int is_export,\r\n\t\t\t\t\t     int keylength));\r\n\r\nvoid SSL_set_tmp_rsa_callback(SSL *ssl,\r\n\t\t\t\t  RSA *(*cb)(SSL *ssl,int is_export,\r\n\t\t\t\t\t     int keylength));\r\n#endif\r\n#ifndef OPENSSL_NO_DH\r\nvoid SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,\r\n\t\t\t\t DH *(*dh)(SSL *ssl,int is_export,\r\n\t\t\t\t\t   int keylength));\r\nvoid SSL_set_tmp_dh_callback(SSL *ssl,\r\n\t\t\t\t DH *(*dh)(SSL *ssl,int is_export,\r\n\t\t\t\t\t   int keylength));\r\n#endif\r\n#ifndef OPENSSL_NO_ECDH\r\nvoid SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,\r\n\t\t\t\t EC_KEY *(*ecdh)(SSL *ssl,int is_export,\r\n\t\t\t\t\t   int keylength));\r\nvoid SSL_set_tmp_ecdh_callback(SSL *ssl,\r\n\t\t\t\t EC_KEY *(*ecdh)(SSL *ssl,int is_export,\r\n\t\t\t\t\t   int keylength));\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_COMP\r\nconst COMP_METHOD *SSL_get_current_compression(SSL *s);\r\nconst COMP_METHOD *SSL_get_current_expansion(SSL *s);\r\nconst char *SSL_COMP_get_name(const COMP_METHOD *comp);\r\nSTACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);\r\nint SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);\r\n#else\r\nconst void *SSL_get_current_compression(SSL *s);\r\nconst void *SSL_get_current_expansion(SSL *s);\r\nconst char *SSL_COMP_get_name(const void *comp);\r\nvoid *SSL_COMP_get_compression_methods(void);\r\nint SSL_COMP_add_compression_method(int id,void *cm);\r\n#endif\r\n\r\n/* TLS extensions functions */\r\nint SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);\r\n\r\nint SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb,\r\n\t\t\t\t  void *arg);\r\n\r\n/* Pre-shared secret session resumption functions */\r\nint SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session_secret_cb, void *arg);\r\n\r\nvoid SSL_set_debug(SSL *s, int debug);\r\nint SSL_cache_hit(SSL *s);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_SSL_strings(void);\r\n\r\n/* Error codes for the SSL functions. */\r\n\r\n/* Function codes. */\r\n#define SSL_F_CLIENT_CERTIFICATE\t\t\t 100\r\n#define SSL_F_CLIENT_FINISHED\t\t\t\t 167\r\n#define SSL_F_CLIENT_HELLO\t\t\t\t 101\r\n#define SSL_F_CLIENT_MASTER_KEY\t\t\t\t 102\r\n#define SSL_F_D2I_SSL_SESSION\t\t\t\t 103\r\n#define SSL_F_DO_DTLS1_WRITE\t\t\t\t 245\r\n#define SSL_F_DO_SSL3_WRITE\t\t\t\t 104\r\n#define SSL_F_DTLS1_ACCEPT\t\t\t\t 246\r\n#define SSL_F_DTLS1_ADD_CERT_TO_BUF\t\t\t 295\r\n#define SSL_F_DTLS1_BUFFER_RECORD\t\t\t 247\r\n#define SSL_F_DTLS1_CHECK_TIMEOUT_NUM\t\t\t 316\r\n#define SSL_F_DTLS1_CLIENT_HELLO\t\t\t 248\r\n#define SSL_F_DTLS1_CONNECT\t\t\t\t 249\r\n#define SSL_F_DTLS1_ENC\t\t\t\t\t 250\r\n#define SSL_F_DTLS1_GET_HELLO_VERIFY\t\t\t 251\r\n#define SSL_F_DTLS1_GET_MESSAGE\t\t\t\t 252\r\n#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT\t\t 253\r\n#define SSL_F_DTLS1_GET_RECORD\t\t\t\t 254\r\n#define SSL_F_DTLS1_HANDLE_TIMEOUT\t\t\t 297\r\n#define SSL_F_DTLS1_HEARTBEAT\t\t\t\t 305\r\n#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN\t\t\t 255\r\n#define SSL_F_DTLS1_PREPROCESS_FRAGMENT\t\t\t 288\r\n#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE\t\t 256\r\n#define SSL_F_DTLS1_PROCESS_RECORD\t\t\t 257\r\n#define SSL_F_DTLS1_READ_BYTES\t\t\t\t 258\r\n#define SSL_F_DTLS1_READ_FAILED\t\t\t\t 259\r\n#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST\t\t 260\r\n#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE\t\t 261\r\n#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE\t\t 262\r\n#define SSL_F_DTLS1_SEND_CLIENT_VERIFY\t\t\t 263\r\n#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST\t\t 264\r\n#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE\t\t 265\r\n#define SSL_F_DTLS1_SEND_SERVER_HELLO\t\t\t 266\r\n#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE\t\t 267\r\n#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES\t\t 268\r\n#define SSL_F_GET_CLIENT_FINISHED\t\t\t 105\r\n#define SSL_F_GET_CLIENT_HELLO\t\t\t\t 106\r\n#define SSL_F_GET_CLIENT_MASTER_KEY\t\t\t 107\r\n#define SSL_F_GET_SERVER_FINISHED\t\t\t 108\r\n#define SSL_F_GET_SERVER_HELLO\t\t\t\t 109\r\n#define SSL_F_GET_SERVER_VERIFY\t\t\t\t 110\r\n#define SSL_F_I2D_SSL_SESSION\t\t\t\t 111\r\n#define SSL_F_READ_N\t\t\t\t\t 112\r\n#define SSL_F_REQUEST_CERTIFICATE\t\t\t 113\r\n#define SSL_F_SERVER_FINISH\t\t\t\t 239\r\n#define SSL_F_SERVER_HELLO\t\t\t\t 114\r\n#define SSL_F_SERVER_VERIFY\t\t\t\t 240\r\n#define SSL_F_SSL23_ACCEPT\t\t\t\t 115\r\n#define SSL_F_SSL23_CLIENT_HELLO\t\t\t 116\r\n#define SSL_F_SSL23_CONNECT\t\t\t\t 117\r\n#define SSL_F_SSL23_GET_CLIENT_HELLO\t\t\t 118\r\n#define SSL_F_SSL23_GET_SERVER_HELLO\t\t\t 119\r\n#define SSL_F_SSL23_PEEK\t\t\t\t 237\r\n#define SSL_F_SSL23_READ\t\t\t\t 120\r\n#define SSL_F_SSL23_WRITE\t\t\t\t 121\r\n#define SSL_F_SSL2_ACCEPT\t\t\t\t 122\r\n#define SSL_F_SSL2_CONNECT\t\t\t\t 123\r\n#define SSL_F_SSL2_ENC_INIT\t\t\t\t 124\r\n#define SSL_F_SSL2_GENERATE_KEY_MATERIAL\t\t 241\r\n#define SSL_F_SSL2_PEEK\t\t\t\t\t 234\r\n#define SSL_F_SSL2_READ\t\t\t\t\t 125\r\n#define SSL_F_SSL2_READ_INTERNAL\t\t\t 236\r\n#define SSL_F_SSL2_SET_CERTIFICATE\t\t\t 126\r\n#define SSL_F_SSL2_WRITE\t\t\t\t 127\r\n#define SSL_F_SSL3_ACCEPT\t\t\t\t 128\r\n#define SSL_F_SSL3_ADD_CERT_TO_BUF\t\t\t 296\r\n#define SSL_F_SSL3_CALLBACK_CTRL\t\t\t 233\r\n#define SSL_F_SSL3_CHANGE_CIPHER_STATE\t\t\t 129\r\n#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM\t\t 130\r\n#define SSL_F_SSL3_CHECK_CLIENT_HELLO\t\t\t 304\r\n#define SSL_F_SSL3_CLIENT_HELLO\t\t\t\t 131\r\n#define SSL_F_SSL3_CONNECT\t\t\t\t 132\r\n#define SSL_F_SSL3_CTRL\t\t\t\t\t 213\r\n#define SSL_F_SSL3_CTX_CTRL\t\t\t\t 133\r\n#define SSL_F_SSL3_DIGEST_CACHED_RECORDS\t\t 293\r\n#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC\t\t 292\r\n#define SSL_F_SSL3_ENC\t\t\t\t\t 134\r\n#define SSL_F_SSL3_GENERATE_KEY_BLOCK\t\t\t 238\r\n#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST\t\t 135\r\n#define SSL_F_SSL3_GET_CERT_STATUS\t\t\t 289\r\n#define SSL_F_SSL3_GET_CERT_VERIFY\t\t\t 136\r\n#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE\t\t 137\r\n#define SSL_F_SSL3_GET_CLIENT_HELLO\t\t\t 138\r\n#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE\t\t 139\r\n#define SSL_F_SSL3_GET_FINISHED\t\t\t\t 140\r\n#define SSL_F_SSL3_GET_KEY_EXCHANGE\t\t\t 141\r\n#define SSL_F_SSL3_GET_MESSAGE\t\t\t\t 142\r\n#define SSL_F_SSL3_GET_NEW_SESSION_TICKET\t\t 283\r\n#define SSL_F_SSL3_GET_NEXT_PROTO\t\t\t 306\r\n#define SSL_F_SSL3_GET_RECORD\t\t\t\t 143\r\n#define SSL_F_SSL3_GET_SERVER_CERTIFICATE\t\t 144\r\n#define SSL_F_SSL3_GET_SERVER_DONE\t\t\t 145\r\n#define SSL_F_SSL3_GET_SERVER_HELLO\t\t\t 146\r\n#define SSL_F_SSL3_HANDSHAKE_MAC\t\t\t 285\r\n#define SSL_F_SSL3_NEW_SESSION_TICKET\t\t\t 287\r\n#define SSL_F_SSL3_OUTPUT_CERT_CHAIN\t\t\t 147\r\n#define SSL_F_SSL3_PEEK\t\t\t\t\t 235\r\n#define SSL_F_SSL3_READ_BYTES\t\t\t\t 148\r\n#define SSL_F_SSL3_READ_N\t\t\t\t 149\r\n#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST\t\t 150\r\n#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE\t\t 151\r\n#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE\t\t 152\r\n#define SSL_F_SSL3_SEND_CLIENT_VERIFY\t\t\t 153\r\n#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE\t\t 154\r\n#define SSL_F_SSL3_SEND_SERVER_HELLO\t\t\t 242\r\n#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE\t\t 155\r\n#define SSL_F_SSL3_SETUP_KEY_BLOCK\t\t\t 157\r\n#define SSL_F_SSL3_SETUP_READ_BUFFER\t\t\t 156\r\n#define SSL_F_SSL3_SETUP_WRITE_BUFFER\t\t\t 291\r\n#define SSL_F_SSL3_WRITE_BYTES\t\t\t\t 158\r\n#define SSL_F_SSL3_WRITE_PENDING\t\t\t 159\r\n#define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT\t 298\r\n#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT\t\t 277\r\n#define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT\t\t 307\r\n#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK\t 215\r\n#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK\t 216\r\n#define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT\t 299\r\n#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT\t\t 278\r\n#define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT\t\t 308\r\n#define SSL_F_SSL_BAD_METHOD\t\t\t\t 160\r\n#define SSL_F_SSL_BYTES_TO_CIPHER_LIST\t\t\t 161\r\n#define SSL_F_SSL_CERT_DUP\t\t\t\t 221\r\n#define SSL_F_SSL_CERT_INST\t\t\t\t 222\r\n#define SSL_F_SSL_CERT_INSTANTIATE\t\t\t 214\r\n#define SSL_F_SSL_CERT_NEW\t\t\t\t 162\r\n#define SSL_F_SSL_CHECK_PRIVATE_KEY\t\t\t 163\r\n#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT\t\t 280\r\n#define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG\t\t 279\r\n#define SSL_F_SSL_CIPHER_PROCESS_RULESTR\t\t 230\r\n#define SSL_F_SSL_CIPHER_STRENGTH_SORT\t\t\t 231\r\n#define SSL_F_SSL_CLEAR\t\t\t\t\t 164\r\n#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD\t\t 165\r\n#define SSL_F_SSL_CREATE_CIPHER_LIST\t\t\t 166\r\n#define SSL_F_SSL_CTRL\t\t\t\t\t 232\r\n#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY\t\t\t 168\r\n#define SSL_F_SSL_CTX_MAKE_PROFILES\t\t\t 309\r\n#define SSL_F_SSL_CTX_NEW\t\t\t\t 169\r\n#define SSL_F_SSL_CTX_SET_CIPHER_LIST\t\t\t 269\r\n#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE\t\t 290\r\n#define SSL_F_SSL_CTX_SET_PURPOSE\t\t\t 226\r\n#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT\t\t 219\r\n#define SSL_F_SSL_CTX_SET_SSL_VERSION\t\t\t 170\r\n#define SSL_F_SSL_CTX_SET_TRUST\t\t\t\t 229\r\n#define SSL_F_SSL_CTX_USE_CERTIFICATE\t\t\t 171\r\n#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1\t\t 172\r\n#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE\t 220\r\n#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE\t\t 173\r\n#define SSL_F_SSL_CTX_USE_PRIVATEKEY\t\t\t 174\r\n#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1\t\t 175\r\n#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE\t\t 176\r\n#define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT\t\t 272\r\n#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY\t\t\t 177\r\n#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1\t\t 178\r\n#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE\t\t 179\r\n#define SSL_F_SSL_DO_HANDSHAKE\t\t\t\t 180\r\n#define SSL_F_SSL_GET_NEW_SESSION\t\t\t 181\r\n#define SSL_F_SSL_GET_PREV_SESSION\t\t\t 217\r\n#define SSL_F_SSL_GET_SERVER_SEND_CERT\t\t\t 182\r\n#define SSL_F_SSL_GET_SIGN_PKEY\t\t\t\t 183\r\n#define SSL_F_SSL_INIT_WBIO_BUFFER\t\t\t 184\r\n#define SSL_F_SSL_LOAD_CLIENT_CA_FILE\t\t\t 185\r\n#define SSL_F_SSL_NEW\t\t\t\t\t 186\r\n#define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT\t 300\r\n#define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT\t\t 302\r\n#define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT\t 310\r\n#define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT\t 301\r\n#define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT\t\t 303\r\n#define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT\t 311\r\n#define SSL_F_SSL_PEEK\t\t\t\t\t 270\r\n#define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT\t\t 281\r\n#define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT\t\t 282\r\n#define SSL_F_SSL_READ\t\t\t\t\t 223\r\n#define SSL_F_SSL_RSA_PRIVATE_DECRYPT\t\t\t 187\r\n#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT\t\t\t 188\r\n#define SSL_F_SSL_SESSION_NEW\t\t\t\t 189\r\n#define SSL_F_SSL_SESSION_PRINT_FP\t\t\t 190\r\n#define SSL_F_SSL_SESSION_SET1_ID_CONTEXT\t\t 312\r\n#define SSL_F_SSL_SESS_CERT_NEW\t\t\t\t 225\r\n#define SSL_F_SSL_SET_CERT\t\t\t\t 191\r\n#define SSL_F_SSL_SET_CIPHER_LIST\t\t\t 271\r\n#define SSL_F_SSL_SET_FD\t\t\t\t 192\r\n#define SSL_F_SSL_SET_PKEY\t\t\t\t 193\r\n#define SSL_F_SSL_SET_PURPOSE\t\t\t\t 227\r\n#define SSL_F_SSL_SET_RFD\t\t\t\t 194\r\n#define SSL_F_SSL_SET_SESSION\t\t\t\t 195\r\n#define SSL_F_SSL_SET_SESSION_ID_CONTEXT\t\t 218\r\n#define SSL_F_SSL_SET_SESSION_TICKET_EXT\t\t 294\r\n#define SSL_F_SSL_SET_TRUST\t\t\t\t 228\r\n#define SSL_F_SSL_SET_WFD\t\t\t\t 196\r\n#define SSL_F_SSL_SHUTDOWN\t\t\t\t 224\r\n#define SSL_F_SSL_SRP_CTX_INIT\t\t\t\t 313\r\n#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION\t\t 243\r\n#define SSL_F_SSL_UNDEFINED_FUNCTION\t\t\t 197\r\n#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION\t\t 244\r\n#define SSL_F_SSL_USE_CERTIFICATE\t\t\t 198\r\n#define SSL_F_SSL_USE_CERTIFICATE_ASN1\t\t\t 199\r\n#define SSL_F_SSL_USE_CERTIFICATE_FILE\t\t\t 200\r\n#define SSL_F_SSL_USE_PRIVATEKEY\t\t\t 201\r\n#define SSL_F_SSL_USE_PRIVATEKEY_ASN1\t\t\t 202\r\n#define SSL_F_SSL_USE_PRIVATEKEY_FILE\t\t\t 203\r\n#define SSL_F_SSL_USE_PSK_IDENTITY_HINT\t\t\t 273\r\n#define SSL_F_SSL_USE_RSAPRIVATEKEY\t\t\t 204\r\n#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1\t\t 205\r\n#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE\t\t 206\r\n#define SSL_F_SSL_VERIFY_CERT_CHAIN\t\t\t 207\r\n#define SSL_F_SSL_WRITE\t\t\t\t\t 208\r\n#define SSL_F_TLS1_CERT_VERIFY_MAC\t\t\t 286\r\n#define SSL_F_TLS1_CHANGE_CIPHER_STATE\t\t\t 209\r\n#define SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT\t\t 274\r\n#define SSL_F_TLS1_ENC\t\t\t\t\t 210\r\n#define SSL_F_TLS1_EXPORT_KEYING_MATERIAL\t\t 314\r\n#define SSL_F_TLS1_HEARTBEAT\t\t\t\t 315\r\n#define SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT\t\t 275\r\n#define SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT\t\t 276\r\n#define SSL_F_TLS1_PRF\t\t\t\t\t 284\r\n#define SSL_F_TLS1_SETUP_KEY_BLOCK\t\t\t 211\r\n#define SSL_F_WRITE_PENDING\t\t\t\t 212\r\n\r\n/* Reason codes. */\r\n#define SSL_R_APP_DATA_IN_HANDSHAKE\t\t\t 100\r\n#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272\r\n#define SSL_R_BAD_ALERT_RECORD\t\t\t\t 101\r\n#define SSL_R_BAD_AUTHENTICATION_TYPE\t\t\t 102\r\n#define SSL_R_BAD_CHANGE_CIPHER_SPEC\t\t\t 103\r\n#define SSL_R_BAD_CHECKSUM\t\t\t\t 104\r\n#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK\t\t 106\r\n#define SSL_R_BAD_DECOMPRESSION\t\t\t\t 107\r\n#define SSL_R_BAD_DH_G_LENGTH\t\t\t\t 108\r\n#define SSL_R_BAD_DH_PUB_KEY_LENGTH\t\t\t 109\r\n#define SSL_R_BAD_DH_P_LENGTH\t\t\t\t 110\r\n#define SSL_R_BAD_DIGEST_LENGTH\t\t\t\t 111\r\n#define SSL_R_BAD_DSA_SIGNATURE\t\t\t\t 112\r\n#define SSL_R_BAD_ECC_CERT\t\t\t\t 304\r\n#define SSL_R_BAD_ECDSA_SIGNATURE\t\t\t 305\r\n#define SSL_R_BAD_ECPOINT\t\t\t\t 306\r\n#define SSL_R_BAD_HANDSHAKE_LENGTH\t\t\t 332\r\n#define SSL_R_BAD_HELLO_REQUEST\t\t\t\t 105\r\n#define SSL_R_BAD_LENGTH\t\t\t\t 271\r\n#define SSL_R_BAD_MAC_DECODE\t\t\t\t 113\r\n#define SSL_R_BAD_MAC_LENGTH\t\t\t\t 333\r\n#define SSL_R_BAD_MESSAGE_TYPE\t\t\t\t 114\r\n#define SSL_R_BAD_PACKET_LENGTH\t\t\t\t 115\r\n#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER\t\t 116\r\n#define SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH\t\t 316\r\n#define SSL_R_BAD_RESPONSE_ARGUMENT\t\t\t 117\r\n#define SSL_R_BAD_RSA_DECRYPT\t\t\t\t 118\r\n#define SSL_R_BAD_RSA_ENCRYPT\t\t\t\t 119\r\n#define SSL_R_BAD_RSA_E_LENGTH\t\t\t\t 120\r\n#define SSL_R_BAD_RSA_MODULUS_LENGTH\t\t\t 121\r\n#define SSL_R_BAD_RSA_SIGNATURE\t\t\t\t 122\r\n#define SSL_R_BAD_SIGNATURE\t\t\t\t 123\r\n#define SSL_R_BAD_SRP_A_LENGTH\t\t\t\t 347\r\n#define SSL_R_BAD_SRP_B_LENGTH\t\t\t\t 348\r\n#define SSL_R_BAD_SRP_G_LENGTH\t\t\t\t 349\r\n#define SSL_R_BAD_SRP_N_LENGTH\t\t\t\t 350\r\n#define SSL_R_BAD_SRP_S_LENGTH\t\t\t\t 351\r\n#define SSL_R_BAD_SRTP_MKI_VALUE\t\t\t 352\r\n#define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST\t\t 353\r\n#define SSL_R_BAD_SSL_FILETYPE\t\t\t\t 124\r\n#define SSL_R_BAD_SSL_SESSION_ID_LENGTH\t\t\t 125\r\n#define SSL_R_BAD_STATE\t\t\t\t\t 126\r\n#define SSL_R_BAD_WRITE_RETRY\t\t\t\t 127\r\n#define SSL_R_BIO_NOT_SET\t\t\t\t 128\r\n#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG\t\t\t 129\r\n#define SSL_R_BN_LIB\t\t\t\t\t 130\r\n#define SSL_R_CA_DN_LENGTH_MISMATCH\t\t\t 131\r\n#define SSL_R_CA_DN_TOO_LONG\t\t\t\t 132\r\n#define SSL_R_CCS_RECEIVED_EARLY\t\t\t 133\r\n#define SSL_R_CERTIFICATE_VERIFY_FAILED\t\t\t 134\r\n#define SSL_R_CERT_LENGTH_MISMATCH\t\t\t 135\r\n#define SSL_R_CHALLENGE_IS_DIFFERENT\t\t\t 136\r\n#define SSL_R_CIPHER_CODE_WRONG_LENGTH\t\t\t 137\r\n#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE\t\t 138\r\n#define SSL_R_CIPHER_TABLE_SRC_ERROR\t\t\t 139\r\n#define SSL_R_CLIENTHELLO_TLSEXT\t\t\t 226\r\n#define SSL_R_COMPRESSED_LENGTH_TOO_LONG\t\t 140\r\n#define SSL_R_COMPRESSION_DISABLED\t\t\t 343\r\n#define SSL_R_COMPRESSION_FAILURE\t\t\t 141\r\n#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE\t 307\r\n#define SSL_R_COMPRESSION_LIBRARY_ERROR\t\t\t 142\r\n#define SSL_R_CONNECTION_ID_IS_DIFFERENT\t\t 143\r\n#define SSL_R_CONNECTION_TYPE_NOT_SET\t\t\t 144\r\n#define SSL_R_COOKIE_MISMATCH\t\t\t\t 308\r\n#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED\t\t 145\r\n#define SSL_R_DATA_LENGTH_TOO_LONG\t\t\t 146\r\n#define SSL_R_DECRYPTION_FAILED\t\t\t\t 147\r\n#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC\t 281\r\n#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG\t\t 148\r\n#define SSL_R_DIGEST_CHECK_FAILED\t\t\t 149\r\n#define SSL_R_DTLS_MESSAGE_TOO_BIG\t\t\t 334\r\n#define SSL_R_DUPLICATE_COMPRESSION_ID\t\t\t 309\r\n#define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT\t\t 317\r\n#define SSL_R_ECC_CERT_NOT_FOR_SIGNING\t\t\t 318\r\n#define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE\t 322\r\n#define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE\t 323\r\n#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER\t\t 310\r\n#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST\t 354\r\n#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG\t\t\t 150\r\n#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY\t\t 282\r\n#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST\t\t 151\r\n#define SSL_R_EXCESSIVE_MESSAGE_SIZE\t\t\t 152\r\n#define SSL_R_EXTRA_DATA_IN_MESSAGE\t\t\t 153\r\n#define SSL_R_GOT_A_FIN_BEFORE_A_CCS\t\t\t 154\r\n#define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS\t\t 355\r\n#define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION\t\t 356\r\n#define SSL_R_HTTPS_PROXY_REQUEST\t\t\t 155\r\n#define SSL_R_HTTP_REQUEST\t\t\t\t 156\r\n#define SSL_R_ILLEGAL_PADDING\t\t\t\t 283\r\n#define SSL_R_INCONSISTENT_COMPRESSION\t\t\t 340\r\n#define SSL_R_INVALID_CHALLENGE_LENGTH\t\t\t 158\r\n#define SSL_R_INVALID_COMMAND\t\t\t\t 280\r\n#define SSL_R_INVALID_COMPRESSION_ALGORITHM\t\t 341\r\n#define SSL_R_INVALID_PURPOSE\t\t\t\t 278\r\n#define SSL_R_INVALID_SRP_USERNAME\t\t\t 357\r\n#define SSL_R_INVALID_STATUS_RESPONSE\t\t\t 328\r\n#define SSL_R_INVALID_TICKET_KEYS_LENGTH\t\t 325\r\n#define SSL_R_INVALID_TRUST\t\t\t\t 279\r\n#define SSL_R_KEY_ARG_TOO_LONG\t\t\t\t 284\r\n#define SSL_R_KRB5\t\t\t\t\t 285\r\n#define SSL_R_KRB5_C_CC_PRINC\t\t\t\t 286\r\n#define SSL_R_KRB5_C_GET_CRED\t\t\t\t 287\r\n#define SSL_R_KRB5_C_INIT\t\t\t\t 288\r\n#define SSL_R_KRB5_C_MK_REQ\t\t\t\t 289\r\n#define SSL_R_KRB5_S_BAD_TICKET\t\t\t\t 290\r\n#define SSL_R_KRB5_S_INIT\t\t\t\t 291\r\n#define SSL_R_KRB5_S_RD_REQ\t\t\t\t 292\r\n#define SSL_R_KRB5_S_TKT_EXPIRED\t\t\t 293\r\n#define SSL_R_KRB5_S_TKT_NYV\t\t\t\t 294\r\n#define SSL_R_KRB5_S_TKT_SKEW\t\t\t\t 295\r\n#define SSL_R_LENGTH_MISMATCH\t\t\t\t 159\r\n#define SSL_R_LENGTH_TOO_SHORT\t\t\t\t 160\r\n#define SSL_R_LIBRARY_BUG\t\t\t\t 274\r\n#define SSL_R_LIBRARY_HAS_NO_CIPHERS\t\t\t 161\r\n#define SSL_R_MESSAGE_TOO_LONG\t\t\t\t 296\r\n#define SSL_R_MISSING_DH_DSA_CERT\t\t\t 162\r\n#define SSL_R_MISSING_DH_KEY\t\t\t\t 163\r\n#define SSL_R_MISSING_DH_RSA_CERT\t\t\t 164\r\n#define SSL_R_MISSING_DSA_SIGNING_CERT\t\t\t 165\r\n#define SSL_R_MISSING_EXPORT_TMP_DH_KEY\t\t\t 166\r\n#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY\t\t 167\r\n#define SSL_R_MISSING_RSA_CERTIFICATE\t\t\t 168\r\n#define SSL_R_MISSING_RSA_ENCRYPTING_CERT\t\t 169\r\n#define SSL_R_MISSING_RSA_SIGNING_CERT\t\t\t 170\r\n#define SSL_R_MISSING_SRP_PARAM\t\t\t\t 358\r\n#define SSL_R_MISSING_TMP_DH_KEY\t\t\t 171\r\n#define SSL_R_MISSING_TMP_ECDH_KEY\t\t\t 311\r\n#define SSL_R_MISSING_TMP_RSA_KEY\t\t\t 172\r\n#define SSL_R_MISSING_TMP_RSA_PKEY\t\t\t 173\r\n#define SSL_R_MISSING_VERIFY_MESSAGE\t\t\t 174\r\n#define SSL_R_MULTIPLE_SGC_RESTARTS\t\t\t 346\r\n#define SSL_R_NON_SSLV2_INITIAL_PACKET\t\t\t 175\r\n#define SSL_R_NO_CERTIFICATES_RETURNED\t\t\t 176\r\n#define SSL_R_NO_CERTIFICATE_ASSIGNED\t\t\t 177\r\n#define SSL_R_NO_CERTIFICATE_RETURNED\t\t\t 178\r\n#define SSL_R_NO_CERTIFICATE_SET\t\t\t 179\r\n#define SSL_R_NO_CERTIFICATE_SPECIFIED\t\t\t 180\r\n#define SSL_R_NO_CIPHERS_AVAILABLE\t\t\t 181\r\n#define SSL_R_NO_CIPHERS_PASSED\t\t\t\t 182\r\n#define SSL_R_NO_CIPHERS_SPECIFIED\t\t\t 183\r\n#define SSL_R_NO_CIPHER_LIST\t\t\t\t 184\r\n#define SSL_R_NO_CIPHER_MATCH\t\t\t\t 185\r\n#define SSL_R_NO_CLIENT_CERT_METHOD\t\t\t 331\r\n#define SSL_R_NO_CLIENT_CERT_RECEIVED\t\t\t 186\r\n#define SSL_R_NO_COMPRESSION_SPECIFIED\t\t\t 187\r\n#define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER\t\t 330\r\n#define SSL_R_NO_METHOD_SPECIFIED\t\t\t 188\r\n#define SSL_R_NO_PRIVATEKEY\t\t\t\t 189\r\n#define SSL_R_NO_PRIVATE_KEY_ASSIGNED\t\t\t 190\r\n#define SSL_R_NO_PROTOCOLS_AVAILABLE\t\t\t 191\r\n#define SSL_R_NO_PUBLICKEY\t\t\t\t 192\r\n#define SSL_R_NO_RENEGOTIATION\t\t\t\t 339\r\n#define SSL_R_NO_REQUIRED_DIGEST\t\t\t 324\r\n#define SSL_R_NO_SHARED_CIPHER\t\t\t\t 193\r\n#define SSL_R_NO_SRTP_PROFILES\t\t\t\t 359\r\n#define SSL_R_NO_VERIFY_CALLBACK\t\t\t 194\r\n#define SSL_R_NULL_SSL_CTX\t\t\t\t 195\r\n#define SSL_R_NULL_SSL_METHOD_PASSED\t\t\t 196\r\n#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED\t\t 197\r\n#define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344\r\n#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE\t\t 297\r\n#define SSL_R_OPAQUE_PRF_INPUT_TOO_LONG\t\t\t 327\r\n#define SSL_R_PACKET_LENGTH_TOO_LONG\t\t\t 198\r\n#define SSL_R_PARSE_TLSEXT\t\t\t\t 227\r\n#define SSL_R_PATH_TOO_LONG\t\t\t\t 270\r\n#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE\t\t 199\r\n#define SSL_R_PEER_ERROR\t\t\t\t 200\r\n#define SSL_R_PEER_ERROR_CERTIFICATE\t\t\t 201\r\n#define SSL_R_PEER_ERROR_NO_CERTIFICATE\t\t\t 202\r\n#define SSL_R_PEER_ERROR_NO_CIPHER\t\t\t 203\r\n#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE\t 204\r\n#define SSL_R_PRE_MAC_LENGTH_TOO_LONG\t\t\t 205\r\n#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS\t\t 206\r\n#define SSL_R_PROTOCOL_IS_SHUTDOWN\t\t\t 207\r\n#define SSL_R_PSK_IDENTITY_NOT_FOUND\t\t\t 223\r\n#define SSL_R_PSK_NO_CLIENT_CB\t\t\t\t 224\r\n#define SSL_R_PSK_NO_SERVER_CB\t\t\t\t 225\r\n#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR\t\t\t 208\r\n#define SSL_R_PUBLIC_KEY_IS_NOT_RSA\t\t\t 209\r\n#define SSL_R_PUBLIC_KEY_NOT_RSA\t\t\t 210\r\n#define SSL_R_READ_BIO_NOT_SET\t\t\t\t 211\r\n#define SSL_R_READ_TIMEOUT_EXPIRED\t\t\t 312\r\n#define SSL_R_READ_WRONG_PACKET_TYPE\t\t\t 212\r\n#define SSL_R_RECORD_LENGTH_MISMATCH\t\t\t 213\r\n#define SSL_R_RECORD_TOO_LARGE\t\t\t\t 214\r\n#define SSL_R_RECORD_TOO_SMALL\t\t\t\t 298\r\n#define SSL_R_RENEGOTIATE_EXT_TOO_LONG\t\t\t 335\r\n#define SSL_R_RENEGOTIATION_ENCODING_ERR\t\t 336\r\n#define SSL_R_RENEGOTIATION_MISMATCH\t\t\t 337\r\n#define SSL_R_REQUIRED_CIPHER_MISSING\t\t\t 215\r\n#define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING\t 342\r\n#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO\t\t 216\r\n#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO\t\t\t 217\r\n#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO\t\t 218\r\n#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING\t\t 345\r\n#define SSL_R_SERVERHELLO_TLSEXT\t\t\t 275\r\n#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED\t\t 277\r\n#define SSL_R_SHORT_READ\t\t\t\t 219\r\n#define SSL_R_SIGNATURE_ALGORITHMS_ERROR\t\t 360\r\n#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE\t 220\r\n#define SSL_R_SRP_A_CALC\t\t\t\t 361\r\n#define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES\t\t 362\r\n#define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG\t 363\r\n#define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE\t\t 364\r\n#define SSL_R_SSL23_DOING_SESSION_ID_REUSE\t\t 221\r\n#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG\t\t 299\r\n#define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT\t\t 321\r\n#define SSL_R_SSL3_EXT_INVALID_SERVERNAME\t\t 319\r\n#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE\t\t 320\r\n#define SSL_R_SSL3_SESSION_ID_TOO_LONG\t\t\t 300\r\n#define SSL_R_SSL3_SESSION_ID_TOO_SHORT\t\t\t 222\r\n#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE\t\t 1042\r\n#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC\t\t 1020\r\n#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED\t\t 1045\r\n#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED\t\t 1044\r\n#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN\t\t 1046\r\n#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE\t\t 1030\r\n#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE\t\t 1040\r\n#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER\t\t 1047\r\n#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE\t\t 1041\r\n#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE\t\t 1010\r\n#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE\t 1043\r\n#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION\t 228\r\n#define SSL_R_SSL_HANDSHAKE_FAILURE\t\t\t 229\r\n#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS\t\t 230\r\n#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED\t\t 301\r\n#define SSL_R_SSL_SESSION_ID_CONFLICT\t\t\t 302\r\n#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG\t\t 273\r\n#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH\t\t 303\r\n#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT\t\t 231\r\n#define SSL_R_TLSV1_ALERT_ACCESS_DENIED\t\t\t 1049\r\n#define SSL_R_TLSV1_ALERT_DECODE_ERROR\t\t\t 1050\r\n#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED\t\t 1021\r\n#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR\t\t\t 1051\r\n#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION\t\t 1060\r\n#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY\t\t 1071\r\n#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR\t\t 1080\r\n#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION\t\t 1100\r\n#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION\t\t 1070\r\n#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW\t\t 1022\r\n#define SSL_R_TLSV1_ALERT_UNKNOWN_CA\t\t\t 1048\r\n#define SSL_R_TLSV1_ALERT_USER_CANCELLED\t\t 1090\r\n#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE\t\t 1114\r\n#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE\t 1113\r\n#define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE\t\t 1111\r\n#define SSL_R_TLSV1_UNRECOGNIZED_NAME\t\t\t 1112\r\n#define SSL_R_TLSV1_UNSUPPORTED_EXTENSION\t\t 1110\r\n#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER\t 232\r\n#define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT\t\t 365\r\n#define SSL_R_TLS_HEARTBEAT_PENDING\t\t\t 366\r\n#define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL\t\t 367\r\n#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST\t\t 157\r\n#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233\r\n#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG\t 234\r\n#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER\t\t 235\r\n#define SSL_R_UNABLE_TO_DECODE_DH_CERTS\t\t\t 236\r\n#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS\t\t 313\r\n#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY\t\t 237\r\n#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS\t\t 238\r\n#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS\t\t 314\r\n#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS\t 239\r\n#define SSL_R_UNABLE_TO_FIND_SSL_METHOD\t\t\t 240\r\n#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES\t\t 241\r\n#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES\t\t 242\r\n#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES\t\t 243\r\n#define SSL_R_UNEXPECTED_MESSAGE\t\t\t 244\r\n#define SSL_R_UNEXPECTED_RECORD\t\t\t\t 245\r\n#define SSL_R_UNINITIALIZED\t\t\t\t 276\r\n#define SSL_R_UNKNOWN_ALERT_TYPE\t\t\t 246\r\n#define SSL_R_UNKNOWN_CERTIFICATE_TYPE\t\t\t 247\r\n#define SSL_R_UNKNOWN_CIPHER_RETURNED\t\t\t 248\r\n#define SSL_R_UNKNOWN_CIPHER_TYPE\t\t\t 249\r\n#define SSL_R_UNKNOWN_DIGEST\t\t\t\t 368\r\n#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE\t\t\t 250\r\n#define SSL_R_UNKNOWN_PKEY_TYPE\t\t\t\t 251\r\n#define SSL_R_UNKNOWN_PROTOCOL\t\t\t\t 252\r\n#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE\t\t\t 253\r\n#define SSL_R_UNKNOWN_SSL_VERSION\t\t\t 254\r\n#define SSL_R_UNKNOWN_STATE\t\t\t\t 255\r\n#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED\t 338\r\n#define SSL_R_UNSUPPORTED_CIPHER\t\t\t 256\r\n#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM\t\t 257\r\n#define SSL_R_UNSUPPORTED_DIGEST_TYPE\t\t\t 326\r\n#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE\t\t 315\r\n#define SSL_R_UNSUPPORTED_PROTOCOL\t\t\t 258\r\n#define SSL_R_UNSUPPORTED_SSL_VERSION\t\t\t 259\r\n#define SSL_R_UNSUPPORTED_STATUS_TYPE\t\t\t 329\r\n#define SSL_R_USE_SRTP_NOT_NEGOTIATED\t\t\t 369\r\n#define SSL_R_WRITE_BIO_NOT_SET\t\t\t\t 260\r\n#define SSL_R_WRONG_CIPHER_RETURNED\t\t\t 261\r\n#define SSL_R_WRONG_MESSAGE_TYPE\t\t\t 262\r\n#define SSL_R_WRONG_NUMBER_OF_KEY_BITS\t\t\t 263\r\n#define SSL_R_WRONG_SIGNATURE_LENGTH\t\t\t 264\r\n#define SSL_R_WRONG_SIGNATURE_SIZE\t\t\t 265\r\n#define SSL_R_WRONG_SIGNATURE_TYPE\t\t\t 370\r\n#define SSL_R_WRONG_SSL_VERSION\t\t\t\t 266\r\n#define SSL_R_WRONG_VERSION_NUMBER\t\t\t 267\r\n#define SSL_R_X509_LIB\t\t\t\t\t 268\r\n#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS\t\t 269\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ssl2.h",
    "content": "/* ssl/ssl2.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_SSL2_H \r\n#define HEADER_SSL2_H \r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Protocol Version Codes */\r\n#define SSL2_VERSION\t\t0x0002\r\n#define SSL2_VERSION_MAJOR\t0x00\r\n#define SSL2_VERSION_MINOR\t0x02\r\n/* #define SSL2_CLIENT_VERSION\t0x0002 */\r\n/* #define SSL2_SERVER_VERSION\t0x0002 */\r\n\r\n/* Protocol Message Codes */\r\n#define SSL2_MT_ERROR\t\t\t0\r\n#define SSL2_MT_CLIENT_HELLO\t\t1\r\n#define SSL2_MT_CLIENT_MASTER_KEY\t2\r\n#define SSL2_MT_CLIENT_FINISHED\t\t3\r\n#define SSL2_MT_SERVER_HELLO\t\t4\r\n#define SSL2_MT_SERVER_VERIFY\t\t5\r\n#define SSL2_MT_SERVER_FINISHED\t\t6\r\n#define SSL2_MT_REQUEST_CERTIFICATE\t7\r\n#define SSL2_MT_CLIENT_CERTIFICATE\t8\r\n\r\n/* Error Message Codes */\r\n#define SSL2_PE_UNDEFINED_ERROR\t\t0x0000\r\n#define SSL2_PE_NO_CIPHER\t\t0x0001\r\n#define SSL2_PE_NO_CERTIFICATE\t\t0x0002\r\n#define SSL2_PE_BAD_CERTIFICATE\t\t0x0004\r\n#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006\r\n\r\n/* Cipher Kind Values */\r\n#define SSL2_CK_NULL_WITH_MD5\t\t\t0x02000000 /* v3 */\r\n#define SSL2_CK_RC4_128_WITH_MD5\t\t0x02010080\r\n#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5\t0x02020080\r\n#define SSL2_CK_RC2_128_CBC_WITH_MD5\t\t0x02030080\r\n#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5\t0x02040080\r\n#define SSL2_CK_IDEA_128_CBC_WITH_MD5\t\t0x02050080\r\n#define SSL2_CK_DES_64_CBC_WITH_MD5\t\t0x02060040\r\n#define SSL2_CK_DES_64_CBC_WITH_SHA\t\t0x02060140 /* v3 */\r\n#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5\t0x020700c0\r\n#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA\t0x020701c0 /* v3 */\r\n#define SSL2_CK_RC4_64_WITH_MD5\t\t\t0x02080080 /* MS hack */\r\n \r\n#define SSL2_CK_DES_64_CFB64_WITH_MD5_1\t\t0x02ff0800 /* SSLeay */\r\n#define SSL2_CK_NULL\t\t\t\t0x02ff0810 /* SSLeay */\r\n\r\n#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1\t\"DES-CFB-M1\"\r\n#define SSL2_TXT_NULL_WITH_MD5\t\t\t\"NULL-MD5\"\r\n#define SSL2_TXT_RC4_128_WITH_MD5\t\t\"RC4-MD5\"\r\n#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5\t\"EXP-RC4-MD5\"\r\n#define SSL2_TXT_RC2_128_CBC_WITH_MD5\t\t\"RC2-CBC-MD5\"\r\n#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5\t\"EXP-RC2-CBC-MD5\"\r\n#define SSL2_TXT_IDEA_128_CBC_WITH_MD5\t\t\"IDEA-CBC-MD5\"\r\n#define SSL2_TXT_DES_64_CBC_WITH_MD5\t\t\"DES-CBC-MD5\"\r\n#define SSL2_TXT_DES_64_CBC_WITH_SHA\t\t\"DES-CBC-SHA\"\r\n#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5\t\"DES-CBC3-MD5\"\r\n#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA\t\"DES-CBC3-SHA\"\r\n#define SSL2_TXT_RC4_64_WITH_MD5\t\t\"RC4-64-MD5\"\r\n\r\n#define SSL2_TXT_NULL\t\t\t\t\"NULL\"\r\n\r\n/* Flags for the SSL_CIPHER.algorithm2 field */\r\n#define SSL2_CF_5_BYTE_ENC\t\t\t0x01\r\n#define SSL2_CF_8_BYTE_ENC\t\t\t0x02\r\n\r\n/* Certificate Type Codes */\r\n#define SSL2_CT_X509_CERTIFICATE\t\t0x01\r\n\r\n/* Authentication Type Code */\r\n#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION\t\t0x01\r\n\r\n#define SSL2_MAX_SSL_SESSION_ID_LENGTH\t\t32\r\n\r\n/* Upper/Lower Bounds */\r\n#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS\t256\r\n#ifdef OPENSSL_SYS_MPE\r\n#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER\t29998u\r\n#else\r\n#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER\t32767u  /* 2^15-1 */\r\n#endif\r\n#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER\t16383 /* 2^14-1 */\r\n\r\n#define SSL2_CHALLENGE_LENGTH\t16\r\n/*#define SSL2_CHALLENGE_LENGTH\t32 */\r\n#define SSL2_MIN_CHALLENGE_LENGTH\t16\r\n#define SSL2_MAX_CHALLENGE_LENGTH\t32\r\n#define SSL2_CONNECTION_ID_LENGTH\t16\r\n#define SSL2_MAX_CONNECTION_ID_LENGTH\t16\r\n#define SSL2_SSL_SESSION_ID_LENGTH\t16\r\n#define SSL2_MAX_CERT_CHALLENGE_LENGTH\t32\r\n#define SSL2_MIN_CERT_CHALLENGE_LENGTH\t16\r\n#define SSL2_MAX_KEY_MATERIAL_LENGTH\t24\r\n\r\n#ifndef HEADER_SSL_LOCL_H\r\n#define  CERT\t\tchar\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\ntypedef struct ssl2_state_st\r\n\t{\r\n\tint three_byte_header;\r\n\tint clear_text;\t\t/* clear text */\r\n\tint escape;\t\t/* not used in SSLv2 */\r\n\tint ssl2_rollback;\t/* used if SSLv23 rolled back to SSLv2 */\r\n\r\n\t/* non-blocking io info, used to make sure the same\r\n\t * args were passwd */\r\n\tunsigned int wnum;\t/* number of bytes sent so far */\r\n\tint wpend_tot;\r\n\tconst unsigned char *wpend_buf;\r\n\r\n\tint wpend_off;\t/* offset to data to write */\r\n\tint wpend_len; \t/* number of bytes passwd to write */\r\n\tint wpend_ret; \t/* number of bytes to return to caller */\r\n\r\n\t/* buffer raw data */\r\n\tint rbuf_left;\r\n\tint rbuf_offs;\r\n\tunsigned char *rbuf;\r\n\tunsigned char *wbuf;\r\n\r\n\tunsigned char *write_ptr;/* used to point to the start due to\r\n\t\t\t\t  * 2/3 byte header. */\r\n\r\n\tunsigned int padding;\r\n\tunsigned int rlength; /* passed to ssl2_enc */\r\n\tint ract_data_length; /* Set when things are encrypted. */\r\n\tunsigned int wlength; /* passed to ssl2_enc */\r\n\tint wact_data_length; /* Set when things are decrypted. */\r\n\tunsigned char *ract_data;\r\n\tunsigned char *wact_data;\r\n\tunsigned char *mac_data;\r\n\r\n\tunsigned char *read_key;\r\n\tunsigned char *write_key;\r\n\r\n\t\t/* Stuff specifically to do with this SSL session */\r\n\tunsigned int challenge_length;\r\n\tunsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];\r\n\tunsigned int conn_id_length;\r\n\tunsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];\r\n\tunsigned int key_material_length;\r\n\tunsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];\r\n\r\n\tunsigned long read_sequence;\r\n\tunsigned long write_sequence;\r\n\r\n\tstruct\t{\r\n\t\tunsigned int conn_id_length;\r\n\t\tunsigned int cert_type;\t\r\n\t\tunsigned int cert_length;\r\n\t\tunsigned int csl; \r\n\t\tunsigned int clear;\r\n\t\tunsigned int enc; \r\n\t\tunsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];\r\n\t\tunsigned int cipher_spec_length;\r\n\t\tunsigned int session_id_length;\r\n\t\tunsigned int clen;\r\n\t\tunsigned int rlen;\r\n\t\t} tmp;\r\n\t} SSL2_STATE;\r\n\r\n#endif\r\n\r\n/* SSLv2 */\r\n/* client */\r\n#define SSL2_ST_SEND_CLIENT_HELLO_A\t\t(0x10|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_HELLO_B\t\t(0x11|SSL_ST_CONNECT)\r\n#define SSL2_ST_GET_SERVER_HELLO_A\t\t(0x20|SSL_ST_CONNECT)\r\n#define SSL2_ST_GET_SERVER_HELLO_B\t\t(0x21|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A\t(0x30|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B\t(0x31|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_FINISHED_A\t\t(0x40|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_FINISHED_B\t\t(0x41|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A\t(0x50|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B\t(0x51|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C\t(0x52|SSL_ST_CONNECT)\r\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D\t(0x53|SSL_ST_CONNECT)\r\n#define SSL2_ST_GET_SERVER_VERIFY_A\t\t(0x60|SSL_ST_CONNECT)\r\n#define SSL2_ST_GET_SERVER_VERIFY_B\t\t(0x61|SSL_ST_CONNECT)\r\n#define SSL2_ST_GET_SERVER_FINISHED_A\t\t(0x70|SSL_ST_CONNECT)\r\n#define SSL2_ST_GET_SERVER_FINISHED_B\t\t(0x71|SSL_ST_CONNECT)\r\n#define SSL2_ST_CLIENT_START_ENCRYPTION\t\t(0x80|SSL_ST_CONNECT)\r\n#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE\t(0x90|SSL_ST_CONNECT)\r\n/* server */\r\n#define SSL2_ST_GET_CLIENT_HELLO_A\t\t(0x10|SSL_ST_ACCEPT)\r\n#define SSL2_ST_GET_CLIENT_HELLO_B\t\t(0x11|SSL_ST_ACCEPT)\r\n#define SSL2_ST_GET_CLIENT_HELLO_C\t\t(0x12|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_HELLO_A\t\t(0x20|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_HELLO_B\t\t(0x21|SSL_ST_ACCEPT)\r\n#define SSL2_ST_GET_CLIENT_MASTER_KEY_A\t\t(0x30|SSL_ST_ACCEPT)\r\n#define SSL2_ST_GET_CLIENT_MASTER_KEY_B\t\t(0x31|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_VERIFY_A\t\t(0x40|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_VERIFY_B\t\t(0x41|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_VERIFY_C\t\t(0x42|SSL_ST_ACCEPT)\r\n#define SSL2_ST_GET_CLIENT_FINISHED_A\t\t(0x50|SSL_ST_ACCEPT)\r\n#define SSL2_ST_GET_CLIENT_FINISHED_B\t\t(0x51|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_FINISHED_A\t\t(0x60|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_SERVER_FINISHED_B\t\t(0x61|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A\t(0x70|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B\t(0x71|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C\t(0x72|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D\t(0x73|SSL_ST_ACCEPT)\r\n#define SSL2_ST_SERVER_START_ENCRYPTION\t\t(0x80|SSL_ST_ACCEPT)\r\n#define SSL2_ST_X509_GET_SERVER_CERTIFICATE\t(0x90|SSL_ST_ACCEPT)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ssl23.h",
    "content": "/* ssl/ssl23.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_SSL23_H \r\n#define HEADER_SSL23_H \r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/*client */\r\n/* write to server */\r\n#define SSL23_ST_CW_CLNT_HELLO_A\t(0x210|SSL_ST_CONNECT)\r\n#define SSL23_ST_CW_CLNT_HELLO_B\t(0x211|SSL_ST_CONNECT)\r\n/* read from server */\r\n#define SSL23_ST_CR_SRVR_HELLO_A\t(0x220|SSL_ST_CONNECT)\r\n#define SSL23_ST_CR_SRVR_HELLO_B\t(0x221|SSL_ST_CONNECT)\r\n\r\n/* server */\r\n/* read from client */\r\n#define SSL23_ST_SR_CLNT_HELLO_A\t(0x210|SSL_ST_ACCEPT)\r\n#define SSL23_ST_SR_CLNT_HELLO_B\t(0x211|SSL_ST_ACCEPT)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ssl3.h",
    "content": "/* ssl/ssl3.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n * ECC cipher suite support in OpenSSL originally developed by \r\n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\r\n */\r\n\r\n#ifndef HEADER_SSL3_H \r\n#define HEADER_SSL3_H \r\n\r\n#ifndef OPENSSL_NO_COMP\r\n#include <openssl/comp.h>\r\n#endif\r\n#include <openssl/buffer.h>\r\n#include <openssl/evp.h>\r\n#include <openssl/ssl.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Signalling cipher suite value: from draft-ietf-tls-renegotiation-03.txt */\r\n#define SSL3_CK_SCSV\t\t\t\t0x030000FF\r\n\r\n#define SSL3_CK_RSA_NULL_MD5\t\t\t0x03000001\r\n#define SSL3_CK_RSA_NULL_SHA\t\t\t0x03000002\r\n#define SSL3_CK_RSA_RC4_40_MD5 \t\t\t0x03000003\r\n#define SSL3_CK_RSA_RC4_128_MD5\t\t\t0x03000004\r\n#define SSL3_CK_RSA_RC4_128_SHA\t\t\t0x03000005\r\n#define SSL3_CK_RSA_RC2_40_MD5\t\t\t0x03000006\r\n#define SSL3_CK_RSA_IDEA_128_SHA\t\t0x03000007\r\n#define SSL3_CK_RSA_DES_40_CBC_SHA\t\t0x03000008\r\n#define SSL3_CK_RSA_DES_64_CBC_SHA\t\t0x03000009\r\n#define SSL3_CK_RSA_DES_192_CBC3_SHA\t\t0x0300000A\r\n\r\n#define SSL3_CK_DH_DSS_DES_40_CBC_SHA\t\t0x0300000B\r\n#define SSL3_CK_DH_DSS_DES_64_CBC_SHA\t\t0x0300000C\r\n#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA \t0x0300000D\r\n#define SSL3_CK_DH_RSA_DES_40_CBC_SHA\t\t0x0300000E\r\n#define SSL3_CK_DH_RSA_DES_64_CBC_SHA\t\t0x0300000F\r\n#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA \t0x03000010\r\n\r\n#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA\t\t0x03000011\r\n#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA\t\t0x03000012\r\n#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA\t0x03000013\r\n#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA\t\t0x03000014\r\n#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA\t\t0x03000015\r\n#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA\t0x03000016\r\n\r\n#define SSL3_CK_ADH_RC4_40_MD5\t\t\t0x03000017\r\n#define SSL3_CK_ADH_RC4_128_MD5\t\t\t0x03000018\r\n#define SSL3_CK_ADH_DES_40_CBC_SHA\t\t0x03000019\r\n#define SSL3_CK_ADH_DES_64_CBC_SHA\t\t0x0300001A\r\n#define SSL3_CK_ADH_DES_192_CBC_SHA\t\t0x0300001B\r\n\r\n#if 0\r\n\t#define SSL3_CK_FZA_DMS_NULL_SHA\t\t0x0300001C\r\n\t#define SSL3_CK_FZA_DMS_FZA_SHA\t\t\t0x0300001D\r\n\t#if 0 /* Because it clashes with KRB5, is never used any more, and is safe\r\n\t\t to remove according to David Hopwood <david.hopwood@zetnet.co.uk>\r\n\t\t of the ietf-tls list */\r\n\t#define SSL3_CK_FZA_DMS_RC4_SHA\t\t\t0x0300001E\r\n\t#endif\r\n#endif\r\n\r\n/*    VRS Additional Kerberos5 entries\r\n */\r\n#define SSL3_CK_KRB5_DES_64_CBC_SHA\t\t0x0300001E\r\n#define SSL3_CK_KRB5_DES_192_CBC3_SHA\t\t0x0300001F\r\n#define SSL3_CK_KRB5_RC4_128_SHA\t\t0x03000020\r\n#define SSL3_CK_KRB5_IDEA_128_CBC_SHA\t       \t0x03000021\r\n#define SSL3_CK_KRB5_DES_64_CBC_MD5       \t0x03000022\r\n#define SSL3_CK_KRB5_DES_192_CBC3_MD5       \t0x03000023\r\n#define SSL3_CK_KRB5_RC4_128_MD5\t       \t0x03000024\r\n#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 \t\t0x03000025\r\n\r\n#define SSL3_CK_KRB5_DES_40_CBC_SHA \t\t0x03000026\r\n#define SSL3_CK_KRB5_RC2_40_CBC_SHA \t\t0x03000027\r\n#define SSL3_CK_KRB5_RC4_40_SHA\t \t\t0x03000028\r\n#define SSL3_CK_KRB5_DES_40_CBC_MD5 \t\t0x03000029\r\n#define SSL3_CK_KRB5_RC2_40_CBC_MD5 \t\t0x0300002A\r\n#define SSL3_CK_KRB5_RC4_40_MD5\t \t\t0x0300002B\r\n\r\n#define SSL3_TXT_RSA_NULL_MD5\t\t\t\"NULL-MD5\"\r\n#define SSL3_TXT_RSA_NULL_SHA\t\t\t\"NULL-SHA\"\r\n#define SSL3_TXT_RSA_RC4_40_MD5 \t\t\"EXP-RC4-MD5\"\r\n#define SSL3_TXT_RSA_RC4_128_MD5\t\t\"RC4-MD5\"\r\n#define SSL3_TXT_RSA_RC4_128_SHA\t\t\"RC4-SHA\"\r\n#define SSL3_TXT_RSA_RC2_40_MD5\t\t\t\"EXP-RC2-CBC-MD5\"\r\n#define SSL3_TXT_RSA_IDEA_128_SHA\t\t\"IDEA-CBC-SHA\"\r\n#define SSL3_TXT_RSA_DES_40_CBC_SHA\t\t\"EXP-DES-CBC-SHA\"\r\n#define SSL3_TXT_RSA_DES_64_CBC_SHA\t\t\"DES-CBC-SHA\"\r\n#define SSL3_TXT_RSA_DES_192_CBC3_SHA\t\t\"DES-CBC3-SHA\"\r\n\r\n#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA\t\t\"EXP-DH-DSS-DES-CBC-SHA\"\r\n#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA\t\t\"DH-DSS-DES-CBC-SHA\"\r\n#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA \t\"DH-DSS-DES-CBC3-SHA\"\r\n#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA\t\t\"EXP-DH-RSA-DES-CBC-SHA\"\r\n#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA\t\t\"DH-RSA-DES-CBC-SHA\"\r\n#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA \t\"DH-RSA-DES-CBC3-SHA\"\r\n\r\n#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA\t\t\"EXP-EDH-DSS-DES-CBC-SHA\"\r\n#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA\t\t\"EDH-DSS-DES-CBC-SHA\"\r\n#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA\t\"EDH-DSS-DES-CBC3-SHA\"\r\n#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA\t\t\"EXP-EDH-RSA-DES-CBC-SHA\"\r\n#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA\t\t\"EDH-RSA-DES-CBC-SHA\"\r\n#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA\t\"EDH-RSA-DES-CBC3-SHA\"\r\n\r\n#define SSL3_TXT_ADH_RC4_40_MD5\t\t\t\"EXP-ADH-RC4-MD5\"\r\n#define SSL3_TXT_ADH_RC4_128_MD5\t\t\"ADH-RC4-MD5\"\r\n#define SSL3_TXT_ADH_DES_40_CBC_SHA\t\t\"EXP-ADH-DES-CBC-SHA\"\r\n#define SSL3_TXT_ADH_DES_64_CBC_SHA\t\t\"ADH-DES-CBC-SHA\"\r\n#define SSL3_TXT_ADH_DES_192_CBC_SHA\t\t\"ADH-DES-CBC3-SHA\"\r\n\r\n#if 0\r\n\t#define SSL3_TXT_FZA_DMS_NULL_SHA\t\t\"FZA-NULL-SHA\"\r\n\t#define SSL3_TXT_FZA_DMS_FZA_SHA\t\t\"FZA-FZA-CBC-SHA\"\r\n\t#define SSL3_TXT_FZA_DMS_RC4_SHA\t\t\"FZA-RC4-SHA\"\r\n#endif\r\n\r\n#define SSL3_TXT_KRB5_DES_64_CBC_SHA\t\t\"KRB5-DES-CBC-SHA\"\r\n#define SSL3_TXT_KRB5_DES_192_CBC3_SHA\t\t\"KRB5-DES-CBC3-SHA\"\r\n#define SSL3_TXT_KRB5_RC4_128_SHA\t\t\"KRB5-RC4-SHA\"\r\n#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA\t       \t\"KRB5-IDEA-CBC-SHA\"\r\n#define SSL3_TXT_KRB5_DES_64_CBC_MD5       \t\"KRB5-DES-CBC-MD5\"\r\n#define SSL3_TXT_KRB5_DES_192_CBC3_MD5       \t\"KRB5-DES-CBC3-MD5\"\r\n#define SSL3_TXT_KRB5_RC4_128_MD5\t\t\"KRB5-RC4-MD5\"\r\n#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 \t\t\"KRB5-IDEA-CBC-MD5\"\r\n\r\n#define SSL3_TXT_KRB5_DES_40_CBC_SHA \t\t\"EXP-KRB5-DES-CBC-SHA\"\r\n#define SSL3_TXT_KRB5_RC2_40_CBC_SHA \t\t\"EXP-KRB5-RC2-CBC-SHA\"\r\n#define SSL3_TXT_KRB5_RC4_40_SHA\t \t\"EXP-KRB5-RC4-SHA\"\r\n#define SSL3_TXT_KRB5_DES_40_CBC_MD5 \t\t\"EXP-KRB5-DES-CBC-MD5\"\r\n#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 \t\t\"EXP-KRB5-RC2-CBC-MD5\"\r\n#define SSL3_TXT_KRB5_RC4_40_MD5\t \t\"EXP-KRB5-RC4-MD5\"\r\n\r\n#define SSL3_SSL_SESSION_ID_LENGTH\t\t32\r\n#define SSL3_MAX_SSL_SESSION_ID_LENGTH\t\t32\r\n\r\n#define SSL3_MASTER_SECRET_SIZE\t\t\t48\r\n#define SSL3_RANDOM_SIZE\t\t\t32\r\n#define SSL3_SESSION_ID_SIZE\t\t\t32\r\n#define SSL3_RT_HEADER_LENGTH\t\t\t5\r\n\r\n#ifndef SSL3_ALIGN_PAYLOAD\r\n /* Some will argue that this increases memory footprint, but it's\r\n  * not actually true. Point is that malloc has to return at least\r\n  * 64-bit aligned pointers, meaning that allocating 5 bytes wastes\r\n  * 3 bytes in either case. Suggested pre-gaping simply moves these\r\n  * wasted bytes from the end of allocated region to its front,\r\n  * but makes data payload aligned, which improves performance:-) */\r\n# define SSL3_ALIGN_PAYLOAD\t\t\t8\r\n#else\r\n# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0\r\n#  error \"insane SSL3_ALIGN_PAYLOAD\"\r\n#  undef SSL3_ALIGN_PAYLOAD\r\n# endif\r\n#endif\r\n\r\n/* This is the maximum MAC (digest) size used by the SSL library.\r\n * Currently maximum of 20 is used by SHA1, but we reserve for\r\n * future extension for 512-bit hashes.\r\n */\r\n\r\n#define SSL3_RT_MAX_MD_SIZE\t\t\t64\r\n\r\n/* Maximum block size used in all ciphersuites. Currently 16 for AES.\r\n */\r\n\r\n#define\tSSL_RT_MAX_CIPHER_BLOCK_SIZE\t\t16\r\n\r\n#define SSL3_RT_MAX_EXTRA\t\t\t(16384)\r\n\r\n/* Maximum plaintext length: defined by SSL/TLS standards */\r\n#define SSL3_RT_MAX_PLAIN_LENGTH\t\t16384\r\n/* Maximum compression overhead: defined by SSL/TLS standards */\r\n#define SSL3_RT_MAX_COMPRESSED_OVERHEAD\t\t1024\r\n\r\n/* The standards give a maximum encryption overhead of 1024 bytes.\r\n * In practice the value is lower than this. The overhead is the maximum\r\n * number of padding bytes (256) plus the mac size.\r\n */\r\n#define SSL3_RT_MAX_ENCRYPTED_OVERHEAD\t(256 + SSL3_RT_MAX_MD_SIZE)\r\n\r\n/* OpenSSL currently only uses a padding length of at most one block so\r\n * the send overhead is smaller.\r\n */\r\n\r\n#define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \\\r\n\t\t\t(SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE)\r\n\r\n/* If compression isn't used don't include the compression overhead */\r\n\r\n#ifdef OPENSSL_NO_COMP\r\n#define SSL3_RT_MAX_COMPRESSED_LENGTH\t\tSSL3_RT_MAX_PLAIN_LENGTH\r\n#else\r\n#define SSL3_RT_MAX_COMPRESSED_LENGTH\t\\\r\n\t\t(SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD)\r\n#endif\r\n#define SSL3_RT_MAX_ENCRYPTED_LENGTH\t\\\r\n\t\t(SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH)\r\n#define SSL3_RT_MAX_PACKET_SIZE\t\t\\\r\n\t\t(SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)\r\n\r\n#define SSL3_MD_CLIENT_FINISHED_CONST\t\"\\x43\\x4C\\x4E\\x54\"\r\n#define SSL3_MD_SERVER_FINISHED_CONST\t\"\\x53\\x52\\x56\\x52\"\r\n\r\n#define SSL3_VERSION\t\t\t0x0300\r\n#define SSL3_VERSION_MAJOR\t\t0x03\r\n#define SSL3_VERSION_MINOR\t\t0x00\r\n\r\n#define SSL3_RT_CHANGE_CIPHER_SPEC\t20\r\n#define SSL3_RT_ALERT\t\t\t21\r\n#define SSL3_RT_HANDSHAKE\t\t22\r\n#define SSL3_RT_APPLICATION_DATA\t23\r\n#define TLS1_RT_HEARTBEAT\t\t24\r\n\r\n#define SSL3_AL_WARNING\t\t\t1\r\n#define SSL3_AL_FATAL\t\t\t2\r\n\r\n#define SSL3_AD_CLOSE_NOTIFY\t\t 0\r\n#define SSL3_AD_UNEXPECTED_MESSAGE\t10\t/* fatal */\r\n#define SSL3_AD_BAD_RECORD_MAC\t\t20\t/* fatal */\r\n#define SSL3_AD_DECOMPRESSION_FAILURE\t30\t/* fatal */\r\n#define SSL3_AD_HANDSHAKE_FAILURE\t40\t/* fatal */\r\n#define SSL3_AD_NO_CERTIFICATE\t\t41\r\n#define SSL3_AD_BAD_CERTIFICATE\t\t42\r\n#define SSL3_AD_UNSUPPORTED_CERTIFICATE\t43\r\n#define SSL3_AD_CERTIFICATE_REVOKED\t44\r\n#define SSL3_AD_CERTIFICATE_EXPIRED\t45\r\n#define SSL3_AD_CERTIFICATE_UNKNOWN\t46\r\n#define SSL3_AD_ILLEGAL_PARAMETER\t47\t/* fatal */\r\n\r\n#define TLS1_HB_REQUEST\t\t1\r\n#define TLS1_HB_RESPONSE\t2\r\n\t\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\ntypedef struct ssl3_record_st\r\n\t{\r\n/*r */\tint type;               /* type of record */\r\n/*rw*/\tunsigned int length;    /* How many bytes available */\r\n/*r */\tunsigned int off;       /* read/write offset into 'buf' */\r\n/*rw*/\tunsigned char *data;    /* pointer to the record data */\r\n/*rw*/\tunsigned char *input;   /* where the decode bytes are */\r\n/*r */\tunsigned char *comp;    /* only used with decompression - malloc()ed */\r\n/*r */  unsigned long epoch;    /* epoch number, needed by DTLS1 */\r\n/*r */  unsigned char seq_num[8]; /* sequence number, needed by DTLS1 */\r\n\t} SSL3_RECORD;\r\n\r\ntypedef struct ssl3_buffer_st\r\n\t{\r\n\tunsigned char *buf;     /* at least SSL3_RT_MAX_PACKET_SIZE bytes,\r\n\t                         * see ssl3_setup_buffers() */\r\n\tsize_t len;             /* buffer size */\r\n\tint offset;             /* where to 'copy from' */\r\n\tint left;               /* how many bytes left */\r\n\t} SSL3_BUFFER;\r\n\r\n#endif\r\n\r\n#define SSL3_CT_RSA_SIGN\t\t\t1\r\n#define SSL3_CT_DSS_SIGN\t\t\t2\r\n#define SSL3_CT_RSA_FIXED_DH\t\t\t3\r\n#define SSL3_CT_DSS_FIXED_DH\t\t\t4\r\n#define SSL3_CT_RSA_EPHEMERAL_DH\t\t5\r\n#define SSL3_CT_DSS_EPHEMERAL_DH\t\t6\r\n#define SSL3_CT_FORTEZZA_DMS\t\t\t20\r\n/* SSL3_CT_NUMBER is used to size arrays and it must be large\r\n * enough to contain all of the cert types defined either for\r\n * SSLv3 and TLSv1.\r\n */\r\n#define SSL3_CT_NUMBER\t\t\t9\r\n\r\n\r\n#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS\t0x0001\r\n#define SSL3_FLAGS_DELAY_CLIENT_FINISHED\t0x0002\r\n#define SSL3_FLAGS_POP_BUFFER\t\t\t0x0004\r\n#define TLS1_FLAGS_TLS_PADDING_BUG\t\t0x0008\r\n#define TLS1_FLAGS_SKIP_CERT_VERIFY\t\t0x0010\r\n#define TLS1_FLAGS_KEEP_HANDSHAKE\t\t0x0020\r\n \r\n/* SSL3_FLAGS_SGC_RESTART_DONE is set when we\r\n * restart a handshake because of MS SGC and so prevents us\r\n * from restarting the handshake in a loop. It's reset on a\r\n * renegotiation, so effectively limits the client to one restart\r\n * per negotiation. This limits the possibility of a DDoS\r\n * attack where the client handshakes in a loop using SGC to\r\n * restart. Servers which permit renegotiation can still be\r\n * effected, but we can't prevent that.\r\n */\r\n#define SSL3_FLAGS_SGC_RESTART_DONE\t\t0x0040\r\n\r\n#ifndef OPENSSL_NO_SSL_INTERN\r\n\r\ntypedef struct ssl3_state_st\r\n\t{\r\n\tlong flags;\r\n\tint delay_buf_pop_ret;\r\n\r\n\tunsigned char read_sequence[8];\r\n\tint read_mac_secret_size;\r\n\tunsigned char read_mac_secret[EVP_MAX_MD_SIZE];\r\n\tunsigned char write_sequence[8];\r\n\tint write_mac_secret_size;\r\n\tunsigned char write_mac_secret[EVP_MAX_MD_SIZE];\r\n\r\n\tunsigned char server_random[SSL3_RANDOM_SIZE];\r\n\tunsigned char client_random[SSL3_RANDOM_SIZE];\r\n\r\n\t/* flags for countermeasure against known-IV weakness */\r\n\tint need_empty_fragments;\r\n\tint empty_fragment_done;\r\n\r\n\t/* The value of 'extra' when the buffers were initialized */\r\n\tint init_extra;\r\n\r\n\tSSL3_BUFFER rbuf;\t/* read IO goes into here */\r\n\tSSL3_BUFFER wbuf;\t/* write IO goes into here */\r\n\r\n\tSSL3_RECORD rrec;\t/* each decoded record goes in here */\r\n\tSSL3_RECORD wrec;\t/* goes out from here */\r\n\r\n\t/* storage for Alert/Handshake protocol data received but not\r\n\t * yet processed by ssl3_read_bytes: */\r\n\tunsigned char alert_fragment[2];\r\n\tunsigned int alert_fragment_len;\r\n\tunsigned char handshake_fragment[4];\r\n\tunsigned int handshake_fragment_len;\r\n\r\n\t/* partial write - check the numbers match */\r\n\tunsigned int wnum;\t/* number of bytes sent so far */\r\n\tint wpend_tot;\t\t/* number bytes written */\r\n\tint wpend_type;\r\n\tint wpend_ret;\t\t/* number of bytes submitted */\r\n\tconst unsigned char *wpend_buf;\r\n\r\n\t/* used during startup, digest all incoming/outgoing packets */\r\n\tBIO *handshake_buffer;\r\n\t/* When set of handshake digests is determined, buffer is hashed\r\n\t * and freed and MD_CTX-es for all required digests are stored in\r\n\t * this array */\r\n\tEVP_MD_CTX **handshake_dgst;\r\n\t/* this is set whenerver we see a change_cipher_spec message\r\n\t * come in when we are not looking for one */\r\n\tint change_cipher_spec;\r\n\r\n\tint warn_alert;\r\n\tint fatal_alert;\r\n\t/* we allow one fatal and one warning alert to be outstanding,\r\n\t * send close alert via the warning alert */\r\n\tint alert_dispatch;\r\n\tunsigned char send_alert[2];\r\n\r\n\t/* This flag is set when we should renegotiate ASAP, basically when\r\n\t * there is no more data in the read or write buffers */\r\n\tint renegotiate;\r\n\tint total_renegotiations;\r\n\tint num_renegotiations;\r\n\r\n\tint in_read_app_data;\r\n\r\n\t/* Opaque PRF input as used for the current handshake.\r\n\t * These fields are used only if TLSEXT_TYPE_opaque_prf_input is defined\r\n\t * (otherwise, they are merely present to improve binary compatibility) */\r\n\tvoid *client_opaque_prf_input;\r\n\tsize_t client_opaque_prf_input_len;\r\n\tvoid *server_opaque_prf_input;\r\n\tsize_t server_opaque_prf_input_len;\r\n\r\n\tstruct\t{\r\n\t\t/* actually only needs to be 16+20 */\r\n\t\tunsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];\r\n\r\n\t\t/* actually only need to be 16+20 for SSLv3 and 12 for TLS */\r\n\t\tunsigned char finish_md[EVP_MAX_MD_SIZE*2];\r\n\t\tint finish_md_len;\r\n\t\tunsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];\r\n\t\tint peer_finish_md_len;\r\n\r\n\t\tunsigned long message_size;\r\n\t\tint message_type;\r\n\r\n\t\t/* used to hold the new cipher we are going to use */\r\n\t\tconst SSL_CIPHER *new_cipher;\r\n#ifndef OPENSSL_NO_DH\r\n\t\tDH *dh;\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_ECDH\r\n\t\tEC_KEY *ecdh; /* holds short lived ECDH key */\r\n#endif\r\n\r\n\t\t/* used when SSL_ST_FLUSH_DATA is entered */\r\n\t\tint next_state;\t\t\t\r\n\r\n\t\tint reuse_message;\r\n\r\n\t\t/* used for certificate requests */\r\n\t\tint cert_req;\r\n\t\tint ctype_num;\r\n\t\tchar ctype[SSL3_CT_NUMBER];\r\n\t\tSTACK_OF(X509_NAME) *ca_names;\r\n\r\n\t\tint use_rsa_tmp;\r\n\r\n\t\tint key_block_length;\r\n\t\tunsigned char *key_block;\r\n\r\n\t\tconst EVP_CIPHER *new_sym_enc;\r\n\t\tconst EVP_MD *new_hash;\r\n\t\tint new_mac_pkey_type;\r\n\t\tint new_mac_secret_size;\r\n#ifndef OPENSSL_NO_COMP\r\n\t\tconst SSL_COMP *new_compression;\r\n#else\r\n\t\tchar *new_compression;\r\n#endif\r\n\t\tint cert_request;\r\n\t\t} tmp;\r\n\r\n        /* Connection binding to prevent renegotiation attacks */\r\n        unsigned char previous_client_finished[EVP_MAX_MD_SIZE];\r\n        unsigned char previous_client_finished_len;\r\n        unsigned char previous_server_finished[EVP_MAX_MD_SIZE];\r\n        unsigned char previous_server_finished_len;\r\n        int send_connection_binding; /* TODOEKR */\r\n\r\n#ifndef OPENSSL_NO_NEXTPROTONEG\r\n\t/* Set if we saw the Next Protocol Negotiation extension from our peer. */\r\n\tint next_proto_neg_seen;\r\n#endif\r\n\t} SSL3_STATE;\r\n\r\n#endif\r\n\r\n/* SSLv3 */\r\n/*client */\r\n/* extra state */\r\n#define SSL3_ST_CW_FLUSH\t\t(0x100|SSL_ST_CONNECT)\r\n#ifndef OPENSSL_NO_SCTP\r\n#define DTLS1_SCTP_ST_CW_WRITE_SOCK\t\t\t(0x310|SSL_ST_CONNECT)\r\n#define DTLS1_SCTP_ST_CR_READ_SOCK\t\t\t(0x320|SSL_ST_CONNECT)\r\n#endif\t\r\n/* write to server */\r\n#define SSL3_ST_CW_CLNT_HELLO_A\t\t(0x110|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CLNT_HELLO_B\t\t(0x111|SSL_ST_CONNECT)\r\n/* read from server */\r\n#define SSL3_ST_CR_SRVR_HELLO_A\t\t(0x120|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_SRVR_HELLO_B\t\t(0x121|SSL_ST_CONNECT)\r\n#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)\r\n#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CERT_A\t\t(0x130|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CERT_B\t\t(0x131|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_KEY_EXCH_A\t\t(0x140|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_KEY_EXCH_B\t\t(0x141|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CERT_REQ_A\t\t(0x150|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CERT_REQ_B\t\t(0x151|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_SRVR_DONE_A\t\t(0x160|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_SRVR_DONE_B\t\t(0x161|SSL_ST_CONNECT)\r\n/* write to server */\r\n#define SSL3_ST_CW_CERT_A\t\t(0x170|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CERT_B\t\t(0x171|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CERT_C\t\t(0x172|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CERT_D\t\t(0x173|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_KEY_EXCH_A\t\t(0x180|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_KEY_EXCH_B\t\t(0x181|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CERT_VRFY_A\t\t(0x190|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CERT_VRFY_B\t\t(0x191|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CHANGE_A\t\t(0x1A0|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_CHANGE_B\t\t(0x1A1|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_NEXT_PROTO_A\t\t(0x200|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_NEXT_PROTO_B\t\t(0x201|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_FINISHED_A\t\t(0x1B0|SSL_ST_CONNECT)\r\n#define SSL3_ST_CW_FINISHED_B\t\t(0x1B1|SSL_ST_CONNECT)\r\n/* read from server */\r\n#define SSL3_ST_CR_CHANGE_A\t\t(0x1C0|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CHANGE_B\t\t(0x1C1|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_FINISHED_A\t\t(0x1D0|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_FINISHED_B\t\t(0x1D1|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_SESSION_TICKET_A\t(0x1E0|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_SESSION_TICKET_B\t(0x1E1|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CERT_STATUS_A\t(0x1F0|SSL_ST_CONNECT)\r\n#define SSL3_ST_CR_CERT_STATUS_B\t(0x1F1|SSL_ST_CONNECT)\r\n\r\n/* server */\r\n/* extra state */\r\n#define SSL3_ST_SW_FLUSH\t\t(0x100|SSL_ST_ACCEPT)\r\n#ifndef OPENSSL_NO_SCTP\r\n#define DTLS1_SCTP_ST_SW_WRITE_SOCK\t\t\t(0x310|SSL_ST_ACCEPT)\r\n#define DTLS1_SCTP_ST_SR_READ_SOCK\t\t\t(0x320|SSL_ST_ACCEPT)\r\n#endif\t\r\n/* read from client */\r\n/* Do not change the number values, they do matter */\r\n#define SSL3_ST_SR_CLNT_HELLO_A\t\t(0x110|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CLNT_HELLO_B\t\t(0x111|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CLNT_HELLO_C\t\t(0x112|SSL_ST_ACCEPT)\r\n/* write to client */\r\n#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)\r\n#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_HELLO_REQ_A\t\t(0x120|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_HELLO_REQ_B\t\t(0x121|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_HELLO_REQ_C\t\t(0x122|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_SRVR_HELLO_A\t\t(0x130|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_SRVR_HELLO_B\t\t(0x131|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CERT_A\t\t(0x140|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CERT_B\t\t(0x141|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_KEY_EXCH_A\t\t(0x150|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_KEY_EXCH_B\t\t(0x151|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CERT_REQ_A\t\t(0x160|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CERT_REQ_B\t\t(0x161|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_SRVR_DONE_A\t\t(0x170|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_SRVR_DONE_B\t\t(0x171|SSL_ST_ACCEPT)\r\n/* read from client */\r\n#define SSL3_ST_SR_CERT_A\t\t(0x180|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CERT_B\t\t(0x181|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_KEY_EXCH_A\t\t(0x190|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_KEY_EXCH_B\t\t(0x191|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CERT_VRFY_A\t\t(0x1A0|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CERT_VRFY_B\t\t(0x1A1|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CHANGE_A\t\t(0x1B0|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_CHANGE_B\t\t(0x1B1|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_NEXT_PROTO_A\t\t(0x210|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_NEXT_PROTO_B\t\t(0x211|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_FINISHED_A\t\t(0x1C0|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SR_FINISHED_B\t\t(0x1C1|SSL_ST_ACCEPT)\r\n/* write to client */\r\n#define SSL3_ST_SW_CHANGE_A\t\t(0x1D0|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CHANGE_B\t\t(0x1D1|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_FINISHED_A\t\t(0x1E0|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_FINISHED_B\t\t(0x1E1|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_SESSION_TICKET_A\t(0x1F0|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_SESSION_TICKET_B\t(0x1F1|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CERT_STATUS_A\t(0x200|SSL_ST_ACCEPT)\r\n#define SSL3_ST_SW_CERT_STATUS_B\t(0x201|SSL_ST_ACCEPT)\r\n\r\n#define SSL3_MT_HELLO_REQUEST\t\t\t0\r\n#define SSL3_MT_CLIENT_HELLO\t\t\t1\r\n#define SSL3_MT_SERVER_HELLO\t\t\t2\r\n#define\tSSL3_MT_NEWSESSION_TICKET\t\t4\r\n#define SSL3_MT_CERTIFICATE\t\t\t11\r\n#define SSL3_MT_SERVER_KEY_EXCHANGE\t\t12\r\n#define SSL3_MT_CERTIFICATE_REQUEST\t\t13\r\n#define SSL3_MT_SERVER_DONE\t\t\t14\r\n#define SSL3_MT_CERTIFICATE_VERIFY\t\t15\r\n#define SSL3_MT_CLIENT_KEY_EXCHANGE\t\t16\r\n#define SSL3_MT_FINISHED\t\t\t20\r\n#define SSL3_MT_CERTIFICATE_STATUS\t\t22\r\n#define SSL3_MT_NEXT_PROTO\t\t\t67\r\n#define DTLS1_MT_HELLO_VERIFY_REQUEST    3\r\n\r\n\r\n#define SSL3_MT_CCS\t\t\t\t1\r\n\r\n/* These are used when changing over to a new cipher */\r\n#define SSL3_CC_READ\t\t0x01\r\n#define SSL3_CC_WRITE\t\t0x02\r\n#define SSL3_CC_CLIENT\t\t0x10\r\n#define SSL3_CC_SERVER\t\t0x20\r\n#define SSL3_CHANGE_CIPHER_CLIENT_WRITE\t(SSL3_CC_CLIENT|SSL3_CC_WRITE)\t\r\n#define SSL3_CHANGE_CIPHER_SERVER_READ\t(SSL3_CC_SERVER|SSL3_CC_READ)\r\n#define SSL3_CHANGE_CIPHER_CLIENT_READ\t(SSL3_CC_CLIENT|SSL3_CC_READ)\r\n#define SSL3_CHANGE_CIPHER_SERVER_WRITE\t(SSL3_CC_SERVER|SSL3_CC_WRITE)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/stack.h",
    "content": "/* crypto/stack/stack.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_STACK_H\r\n#define HEADER_STACK_H\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef struct stack_st\r\n\t{\r\n\tint num;\r\n\tchar **data;\r\n\tint sorted;\r\n\r\n\tint num_alloc;\r\n\tint (*comp)(const void *, const void *);\r\n\t} _STACK;  /* Use STACK_OF(...) instead */\r\n\r\n#define M_sk_num(sk)\t\t((sk) ? (sk)->num:-1)\r\n#define M_sk_value(sk,n)\t((sk) ? (sk)->data[n] : NULL)\r\n\r\nint sk_num(const _STACK *);\r\nvoid *sk_value(const _STACK *, int);\r\n\r\nvoid *sk_set(_STACK *, int, void *);\r\n\r\n_STACK *sk_new(int (*cmp)(const void *, const void *));\r\n_STACK *sk_new_null(void);\r\nvoid sk_free(_STACK *);\r\nvoid sk_pop_free(_STACK *st, void (*func)(void *));\r\nint sk_insert(_STACK *sk, void *data, int where);\r\nvoid *sk_delete(_STACK *st, int loc);\r\nvoid *sk_delete_ptr(_STACK *st, void *p);\r\nint sk_find(_STACK *st, void *data);\r\nint sk_find_ex(_STACK *st, void *data);\r\nint sk_push(_STACK *st, void *data);\r\nint sk_unshift(_STACK *st, void *data);\r\nvoid *sk_shift(_STACK *st);\r\nvoid *sk_pop(_STACK *st);\r\nvoid sk_zero(_STACK *st);\r\nint (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *)))\r\n\t(const void *, const void *);\r\n_STACK *sk_dup(_STACK *st);\r\nvoid sk_sort(_STACK *st);\r\nint sk_is_sorted(const _STACK *st);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/symhacks.h",
    "content": "/* ====================================================================\r\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_SYMHACKS_H\r\n#define HEADER_SYMHACKS_H\r\n\r\n#include <openssl/e_os2.h>\r\n\r\n/* Hacks to solve the problem with linkers incapable of handling very long\r\n   symbol names.  In the case of VMS, the limit is 31 characters on VMS for\r\n   VAX. */\r\n/* Note that this affects util/libeay.num and util/ssleay.num...  you may\r\n   change those manually, but that's not recommended, as those files are\r\n   controlled centrally and updated on Unix, and the central definition\r\n   may disagree with yours, which in turn may come with shareable library\r\n   incompatibilities. */\r\n#ifdef OPENSSL_SYS_VMS\r\n\r\n/* Hack a long name in crypto/ex_data.c */\r\n#undef CRYPTO_get_ex_data_implementation\r\n#define CRYPTO_get_ex_data_implementation\tCRYPTO_get_ex_data_impl\r\n#undef CRYPTO_set_ex_data_implementation\r\n#define CRYPTO_set_ex_data_implementation\tCRYPTO_set_ex_data_impl\r\n\r\n/* Hack a long name in crypto/asn1/a_mbstr.c */\r\n#undef ASN1_STRING_set_default_mask_asc\r\n#define ASN1_STRING_set_default_mask_asc\tASN1_STRING_set_def_mask_asc\r\n\r\n#if 0 /* No longer needed, since safestack macro magic does the job */\r\n/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */\r\n#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO\r\n#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO\ti2d_ASN1_SET_OF_PKCS7_SIGINF\r\n#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO\r\n#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO\td2i_ASN1_SET_OF_PKCS7_SIGINF\r\n#endif\r\n\r\n#if 0 /* No longer needed, since safestack macro magic does the job */\r\n/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */\r\n#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO\r\n#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO\ti2d_ASN1_SET_OF_PKCS7_RECINF\r\n#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO\r\n#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO\td2i_ASN1_SET_OF_PKCS7_RECINF\r\n#endif\r\n\r\n#if 0 /* No longer needed, since safestack macro magic does the job */\r\n/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */\r\n#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION\r\n#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION\ti2d_ASN1_SET_OF_ACC_DESC\r\n#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION\r\n#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION\td2i_ASN1_SET_OF_ACC_DESC\r\n#endif\r\n\r\n/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */\r\n#undef PEM_read_NETSCAPE_CERT_SEQUENCE\r\n#define PEM_read_NETSCAPE_CERT_SEQUENCE\t\tPEM_read_NS_CERT_SEQ\r\n#undef PEM_write_NETSCAPE_CERT_SEQUENCE\r\n#define PEM_write_NETSCAPE_CERT_SEQUENCE\tPEM_write_NS_CERT_SEQ\r\n#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE\r\n#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE\tPEM_read_bio_NS_CERT_SEQ\r\n#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE\r\n#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE\tPEM_write_bio_NS_CERT_SEQ\r\n#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE\r\n#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE\tPEM_write_cb_bio_NS_CERT_SEQ\r\n\r\n/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */\r\n#undef PEM_read_PKCS8_PRIV_KEY_INFO\r\n#define PEM_read_PKCS8_PRIV_KEY_INFO\t\tPEM_read_P8_PRIV_KEY_INFO\r\n#undef PEM_write_PKCS8_PRIV_KEY_INFO\r\n#define PEM_write_PKCS8_PRIV_KEY_INFO\t\tPEM_write_P8_PRIV_KEY_INFO\r\n#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO\r\n#define PEM_read_bio_PKCS8_PRIV_KEY_INFO\tPEM_read_bio_P8_PRIV_KEY_INFO\r\n#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO\r\n#define PEM_write_bio_PKCS8_PRIV_KEY_INFO\tPEM_write_bio_P8_PRIV_KEY_INFO\r\n#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO\r\n#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO\tPEM_wrt_cb_bio_P8_PRIV_KEY_INFO\r\n\r\n/* Hack other PEM names */\r\n#undef PEM_write_bio_PKCS8PrivateKey_nid\r\n#define PEM_write_bio_PKCS8PrivateKey_nid\tPEM_write_bio_PKCS8PrivKey_nid\r\n\r\n/* Hack some long X509 names */\r\n#undef X509_REVOKED_get_ext_by_critical\r\n#define X509_REVOKED_get_ext_by_critical\tX509_REVOKED_get_ext_by_critic\r\n#undef X509_policy_tree_get0_user_policies\r\n#define X509_policy_tree_get0_user_policies\tX509_pcy_tree_get0_usr_policies\r\n#undef X509_policy_node_get0_qualifiers\r\n#define X509_policy_node_get0_qualifiers\tX509_pcy_node_get0_qualifiers\r\n#undef X509_STORE_CTX_get_explicit_policy\r\n#define X509_STORE_CTX_get_explicit_policy\tX509_STORE_CTX_get_expl_policy\r\n#undef X509_STORE_CTX_get0_current_issuer\r\n#define X509_STORE_CTX_get0_current_issuer\tX509_STORE_CTX_get0_cur_issuer\r\n\r\n/* Hack some long CRYPTO names */\r\n#undef CRYPTO_set_dynlock_destroy_callback\r\n#define CRYPTO_set_dynlock_destroy_callback     CRYPTO_set_dynlock_destroy_cb\r\n#undef CRYPTO_set_dynlock_create_callback\r\n#define CRYPTO_set_dynlock_create_callback      CRYPTO_set_dynlock_create_cb\r\n#undef CRYPTO_set_dynlock_lock_callback\r\n#define CRYPTO_set_dynlock_lock_callback\tCRYPTO_set_dynlock_lock_cb\r\n#undef CRYPTO_get_dynlock_lock_callback\r\n#define CRYPTO_get_dynlock_lock_callback\tCRYPTO_get_dynlock_lock_cb\r\n#undef CRYPTO_get_dynlock_destroy_callback\r\n#define CRYPTO_get_dynlock_destroy_callback     CRYPTO_get_dynlock_destroy_cb\r\n#undef CRYPTO_get_dynlock_create_callback\r\n#define CRYPTO_get_dynlock_create_callback      CRYPTO_get_dynlock_create_cb\r\n#undef CRYPTO_set_locked_mem_ex_functions\r\n#define CRYPTO_set_locked_mem_ex_functions      CRYPTO_set_locked_mem_ex_funcs\r\n#undef CRYPTO_get_locked_mem_ex_functions\r\n#define CRYPTO_get_locked_mem_ex_functions      CRYPTO_get_locked_mem_ex_funcs\r\n\r\n/* Hack some long SSL names */\r\n#undef SSL_CTX_set_default_verify_paths\r\n#define SSL_CTX_set_default_verify_paths\tSSL_CTX_set_def_verify_paths\r\n#undef SSL_get_ex_data_X509_STORE_CTX_idx\r\n#define SSL_get_ex_data_X509_STORE_CTX_idx      SSL_get_ex_d_X509_STORE_CTX_idx\r\n#undef SSL_add_file_cert_subjects_to_stack\r\n#define SSL_add_file_cert_subjects_to_stack     SSL_add_file_cert_subjs_to_stk\r\n#undef SSL_add_dir_cert_subjects_to_stack\r\n#define SSL_add_dir_cert_subjects_to_stack      SSL_add_dir_cert_subjs_to_stk\r\n#undef SSL_CTX_use_certificate_chain_file\r\n#define SSL_CTX_use_certificate_chain_file      SSL_CTX_use_cert_chain_file\r\n#undef SSL_CTX_set_cert_verify_callback\r\n#define SSL_CTX_set_cert_verify_callback\tSSL_CTX_set_cert_verify_cb\r\n#undef SSL_CTX_set_default_passwd_cb_userdata\r\n#define SSL_CTX_set_default_passwd_cb_userdata  SSL_CTX_set_def_passwd_cb_ud\r\n#undef SSL_COMP_get_compression_methods\r\n#define SSL_COMP_get_compression_methods\tSSL_COMP_get_compress_methods\r\n#undef ssl_add_clienthello_renegotiate_ext\r\n#define ssl_add_clienthello_renegotiate_ext\tssl_add_clienthello_reneg_ext\r\n#undef ssl_add_serverhello_renegotiate_ext\r\n#define ssl_add_serverhello_renegotiate_ext\tssl_add_serverhello_reneg_ext\r\n#undef ssl_parse_clienthello_renegotiate_ext\r\n#define ssl_parse_clienthello_renegotiate_ext\tssl_parse_clienthello_reneg_ext\r\n#undef ssl_parse_serverhello_renegotiate_ext\r\n#define ssl_parse_serverhello_renegotiate_ext\tssl_parse_serverhello_reneg_ext\r\n#undef SSL_srp_server_param_with_username\r\n#define SSL_srp_server_param_with_username\tSSL_srp_server_param_with_un\r\n#undef SSL_CTX_set_srp_client_pwd_callback\r\n#define SSL_CTX_set_srp_client_pwd_callback\tSSL_CTX_set_srp_client_pwd_cb\r\n#undef SSL_CTX_set_srp_verify_param_callback\r\n#define SSL_CTX_set_srp_verify_param_callback\tSSL_CTX_set_srp_vfy_param_cb\r\n#undef SSL_CTX_set_srp_username_callback\r\n#define SSL_CTX_set_srp_username_callback\tSSL_CTX_set_srp_un_cb\r\n#undef ssl_add_clienthello_use_srtp_ext\r\n#define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext\r\n#undef ssl_add_serverhello_use_srtp_ext\r\n#define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext\r\n#undef ssl_parse_clienthello_use_srtp_ext\r\n#define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext\r\n#undef ssl_parse_serverhello_use_srtp_ext\r\n#define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext\r\n#undef SSL_CTX_set_next_protos_advertised_cb\r\n#define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb\r\n#undef SSL_CTX_set_next_proto_select_cb\r\n#define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb\r\n\r\n/* Hack some long ENGINE names */\r\n#undef ENGINE_get_default_BN_mod_exp_crt\r\n#define ENGINE_get_default_BN_mod_exp_crt\tENGINE_get_def_BN_mod_exp_crt\r\n#undef ENGINE_set_default_BN_mod_exp_crt\r\n#define ENGINE_set_default_BN_mod_exp_crt\tENGINE_set_def_BN_mod_exp_crt\r\n#undef ENGINE_set_load_privkey_function\r\n#define ENGINE_set_load_privkey_function\tENGINE_set_load_privkey_fn\r\n#undef ENGINE_get_load_privkey_function\r\n#define ENGINE_get_load_privkey_function\tENGINE_get_load_privkey_fn\r\n#undef ENGINE_unregister_pkey_asn1_meths\r\n#define ENGINE_unregister_pkey_asn1_meths\tENGINE_unreg_pkey_asn1_meths\r\n#undef ENGINE_register_all_pkey_asn1_meths\r\n#define ENGINE_register_all_pkey_asn1_meths\tENGINE_reg_all_pkey_asn1_meths\r\n#undef ENGINE_set_default_pkey_asn1_meths\r\n#define ENGINE_set_default_pkey_asn1_meths\tENGINE_set_def_pkey_asn1_meths\r\n#undef ENGINE_get_pkey_asn1_meth_engine\r\n#define ENGINE_get_pkey_asn1_meth_engine\tENGINE_get_pkey_asn1_meth_eng\r\n#undef ENGINE_set_load_ssl_client_cert_function\r\n#define ENGINE_set_load_ssl_client_cert_function \\\r\n\t\t\t\t\t\tENGINE_set_ld_ssl_clnt_cert_fn\r\n#undef ENGINE_get_ssl_client_cert_function\r\n#define ENGINE_get_ssl_client_cert_function\tENGINE_get_ssl_client_cert_fn\r\n\r\n/* Hack some long OCSP names */\r\n#undef OCSP_REQUEST_get_ext_by_critical\r\n#define OCSP_REQUEST_get_ext_by_critical\tOCSP_REQUEST_get_ext_by_crit\r\n#undef OCSP_BASICRESP_get_ext_by_critical\r\n#define OCSP_BASICRESP_get_ext_by_critical      OCSP_BASICRESP_get_ext_by_crit\r\n#undef OCSP_SINGLERESP_get_ext_by_critical\r\n#define OCSP_SINGLERESP_get_ext_by_critical     OCSP_SINGLERESP_get_ext_by_crit\r\n\r\n/* Hack some long DES names */\r\n#undef _ossl_old_des_ede3_cfb64_encrypt\r\n#define _ossl_old_des_ede3_cfb64_encrypt\t_ossl_odes_ede3_cfb64_encrypt\r\n#undef _ossl_old_des_ede3_ofb64_encrypt\r\n#define _ossl_old_des_ede3_ofb64_encrypt\t_ossl_odes_ede3_ofb64_encrypt\r\n\r\n/* Hack some long EVP names */\r\n#undef OPENSSL_add_all_algorithms_noconf\r\n#define OPENSSL_add_all_algorithms_noconf\tOPENSSL_add_all_algo_noconf\r\n#undef OPENSSL_add_all_algorithms_conf\r\n#define OPENSSL_add_all_algorithms_conf\t\tOPENSSL_add_all_algo_conf\r\n#undef EVP_PKEY_meth_set_verify_recover\r\n#define EVP_PKEY_meth_set_verify_recover\tEVP_PKEY_meth_set_vrfy_recover\r\n\r\n/* Hack some long EC names */\r\n#undef EC_GROUP_set_point_conversion_form\r\n#define EC_GROUP_set_point_conversion_form\tEC_GROUP_set_point_conv_form\r\n#undef EC_GROUP_get_point_conversion_form\r\n#define EC_GROUP_get_point_conversion_form\tEC_GROUP_get_point_conv_form\r\n#undef EC_GROUP_clear_free_all_extra_data\r\n#define EC_GROUP_clear_free_all_extra_data\tEC_GROUP_clr_free_all_xtra_data\r\n#undef EC_KEY_set_public_key_affine_coordinates\r\n#define EC_KEY_set_public_key_affine_coordinates \\\r\n\t\t\t\t\t\tEC_KEY_set_pub_key_aff_coords\r\n#undef EC_POINT_set_Jprojective_coordinates_GFp\r\n#define EC_POINT_set_Jprojective_coordinates_GFp \\\r\n                                                EC_POINT_set_Jproj_coords_GFp\r\n#undef EC_POINT_get_Jprojective_coordinates_GFp\r\n#define EC_POINT_get_Jprojective_coordinates_GFp \\\r\n                                                EC_POINT_get_Jproj_coords_GFp\r\n#undef EC_POINT_set_affine_coordinates_GFp\r\n#define EC_POINT_set_affine_coordinates_GFp     EC_POINT_set_affine_coords_GFp\r\n#undef EC_POINT_get_affine_coordinates_GFp\r\n#define EC_POINT_get_affine_coordinates_GFp     EC_POINT_get_affine_coords_GFp\r\n#undef EC_POINT_set_compressed_coordinates_GFp\r\n#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp\r\n#undef EC_POINT_set_affine_coordinates_GF2m\r\n#define EC_POINT_set_affine_coordinates_GF2m    EC_POINT_set_affine_coords_GF2m\r\n#undef EC_POINT_get_affine_coordinates_GF2m\r\n#define EC_POINT_get_affine_coordinates_GF2m    EC_POINT_get_affine_coords_GF2m\r\n#undef EC_POINT_set_compressed_coordinates_GF2m\r\n#define EC_POINT_set_compressed_coordinates_GF2m \\\r\n                                                EC_POINT_set_compr_coords_GF2m\r\n#undef ec_GF2m_simple_group_clear_finish\r\n#define ec_GF2m_simple_group_clear_finish\tec_GF2m_simple_grp_clr_finish\r\n#undef ec_GF2m_simple_group_check_discriminant\r\n#define ec_GF2m_simple_group_check_discriminant\tec_GF2m_simple_grp_chk_discrim\r\n#undef ec_GF2m_simple_point_clear_finish\r\n#define ec_GF2m_simple_point_clear_finish\tec_GF2m_simple_pt_clr_finish\r\n#undef ec_GF2m_simple_point_set_to_infinity\r\n#define ec_GF2m_simple_point_set_to_infinity\tec_GF2m_simple_pt_set_to_inf\r\n#undef ec_GF2m_simple_points_make_affine\r\n#define ec_GF2m_simple_points_make_affine\tec_GF2m_simple_pts_make_affine\r\n#undef ec_GF2m_simple_point_set_affine_coordinates\r\n#define ec_GF2m_simple_point_set_affine_coordinates \\\r\n                                                ec_GF2m_smp_pt_set_af_coords\r\n#undef ec_GF2m_simple_point_get_affine_coordinates\r\n#define ec_GF2m_simple_point_get_affine_coordinates \\\r\n                                                ec_GF2m_smp_pt_get_af_coords\r\n#undef ec_GF2m_simple_set_compressed_coordinates\r\n#define ec_GF2m_simple_set_compressed_coordinates \\\r\n                                                ec_GF2m_smp_set_compr_coords\r\n#undef ec_GFp_simple_group_set_curve_GFp\r\n#define ec_GFp_simple_group_set_curve_GFp       ec_GFp_simple_grp_set_curve_GFp\r\n#undef ec_GFp_simple_group_get_curve_GFp\r\n#define ec_GFp_simple_group_get_curve_GFp       ec_GFp_simple_grp_get_curve_GFp\r\n#undef ec_GFp_simple_group_clear_finish\r\n#define ec_GFp_simple_group_clear_finish\tec_GFp_simple_grp_clear_finish\r\n#undef ec_GFp_simple_group_set_generator\r\n#define ec_GFp_simple_group_set_generator       ec_GFp_simple_grp_set_generator\r\n#undef ec_GFp_simple_group_get0_generator\r\n#define ec_GFp_simple_group_get0_generator      ec_GFp_simple_grp_gt0_generator\r\n#undef ec_GFp_simple_group_get_cofactor\r\n#define ec_GFp_simple_group_get_cofactor\tec_GFp_simple_grp_get_cofactor\r\n#undef ec_GFp_simple_point_clear_finish\r\n#define ec_GFp_simple_point_clear_finish\tec_GFp_simple_pt_clear_finish\r\n#undef ec_GFp_simple_point_set_to_infinity\r\n#define ec_GFp_simple_point_set_to_infinity     ec_GFp_simple_pt_set_to_inf\r\n#undef ec_GFp_simple_points_make_affine\r\n#define ec_GFp_simple_points_make_affine\tec_GFp_simple_pts_make_affine\r\n#undef ec_GFp_simple_group_get_curve_GFp\r\n#define ec_GFp_simple_group_get_curve_GFp       ec_GFp_simple_grp_get_curve_GFp\r\n#undef ec_GFp_simple_set_Jprojective_coordinates_GFp\r\n#define ec_GFp_simple_set_Jprojective_coordinates_GFp \\\r\n                                                ec_GFp_smp_set_Jproj_coords_GFp\r\n#undef ec_GFp_simple_get_Jprojective_coordinates_GFp\r\n#define ec_GFp_simple_get_Jprojective_coordinates_GFp \\\r\n                                                ec_GFp_smp_get_Jproj_coords_GFp\r\n#undef ec_GFp_simple_point_set_affine_coordinates_GFp\r\n#define ec_GFp_simple_point_set_affine_coordinates_GFp \\\r\n                                                ec_GFp_smp_pt_set_af_coords_GFp\r\n#undef ec_GFp_simple_point_get_affine_coordinates_GFp\r\n#define ec_GFp_simple_point_get_affine_coordinates_GFp \\\r\n                                                ec_GFp_smp_pt_get_af_coords_GFp\r\n#undef ec_GFp_simple_set_compressed_coordinates_GFp\r\n#define ec_GFp_simple_set_compressed_coordinates_GFp \\\r\n                                                ec_GFp_smp_set_compr_coords_GFp\r\n#undef ec_GFp_simple_point_set_affine_coordinates\r\n#define ec_GFp_simple_point_set_affine_coordinates \\\r\n                                                ec_GFp_smp_pt_set_af_coords\r\n#undef ec_GFp_simple_point_get_affine_coordinates\r\n#define ec_GFp_simple_point_get_affine_coordinates \\\r\n                                                ec_GFp_smp_pt_get_af_coords\r\n#undef ec_GFp_simple_set_compressed_coordinates\r\n#define ec_GFp_simple_set_compressed_coordinates \\\r\n                                                ec_GFp_smp_set_compr_coords\r\n#undef ec_GFp_simple_group_check_discriminant\r\n#define ec_GFp_simple_group_check_discriminant\tec_GFp_simple_grp_chk_discrim\r\n\r\n/* Hack som long STORE names */\r\n#undef STORE_method_set_initialise_function\r\n#define STORE_method_set_initialise_function\tSTORE_meth_set_initialise_fn\r\n#undef STORE_method_set_cleanup_function\r\n#define STORE_method_set_cleanup_function\tSTORE_meth_set_cleanup_fn\r\n#undef STORE_method_set_generate_function\r\n#define STORE_method_set_generate_function\tSTORE_meth_set_generate_fn\r\n#undef STORE_method_set_modify_function\r\n#define STORE_method_set_modify_function\tSTORE_meth_set_modify_fn\r\n#undef STORE_method_set_revoke_function\r\n#define STORE_method_set_revoke_function\tSTORE_meth_set_revoke_fn\r\n#undef STORE_method_set_delete_function\r\n#define STORE_method_set_delete_function\tSTORE_meth_set_delete_fn\r\n#undef STORE_method_set_list_start_function\r\n#define STORE_method_set_list_start_function\tSTORE_meth_set_list_start_fn\r\n#undef STORE_method_set_list_next_function\r\n#define STORE_method_set_list_next_function\tSTORE_meth_set_list_next_fn\r\n#undef STORE_method_set_list_end_function\r\n#define STORE_method_set_list_end_function\tSTORE_meth_set_list_end_fn\r\n#undef STORE_method_set_update_store_function\r\n#define STORE_method_set_update_store_function\tSTORE_meth_set_update_store_fn\r\n#undef STORE_method_set_lock_store_function\r\n#define STORE_method_set_lock_store_function\tSTORE_meth_set_lock_store_fn\r\n#undef STORE_method_set_unlock_store_function\r\n#define STORE_method_set_unlock_store_function\tSTORE_meth_set_unlock_store_fn\r\n#undef STORE_method_get_initialise_function\r\n#define STORE_method_get_initialise_function\tSTORE_meth_get_initialise_fn\r\n#undef STORE_method_get_cleanup_function\r\n#define STORE_method_get_cleanup_function\tSTORE_meth_get_cleanup_fn\r\n#undef STORE_method_get_generate_function\r\n#define STORE_method_get_generate_function\tSTORE_meth_get_generate_fn\r\n#undef STORE_method_get_modify_function\r\n#define STORE_method_get_modify_function\tSTORE_meth_get_modify_fn\r\n#undef STORE_method_get_revoke_function\r\n#define STORE_method_get_revoke_function\tSTORE_meth_get_revoke_fn\r\n#undef STORE_method_get_delete_function\r\n#define STORE_method_get_delete_function\tSTORE_meth_get_delete_fn\r\n#undef STORE_method_get_list_start_function\r\n#define STORE_method_get_list_start_function\tSTORE_meth_get_list_start_fn\r\n#undef STORE_method_get_list_next_function\r\n#define STORE_method_get_list_next_function\tSTORE_meth_get_list_next_fn\r\n#undef STORE_method_get_list_end_function\r\n#define STORE_method_get_list_end_function\tSTORE_meth_get_list_end_fn\r\n#undef STORE_method_get_update_store_function\r\n#define STORE_method_get_update_store_function\tSTORE_meth_get_update_store_fn\r\n#undef STORE_method_get_lock_store_function\r\n#define STORE_method_get_lock_store_function\tSTORE_meth_get_lock_store_fn\r\n#undef STORE_method_get_unlock_store_function\r\n#define STORE_method_get_unlock_store_function\tSTORE_meth_get_unlock_store_fn\r\n\r\n/* Hack some long TS names */\r\n#undef TS_RESP_CTX_set_status_info_cond\r\n#define TS_RESP_CTX_set_status_info_cond\tTS_RESP_CTX_set_stat_info_cond\r\n#undef TS_RESP_CTX_set_clock_precision_digits\r\n#define TS_RESP_CTX_set_clock_precision_digits\tTS_RESP_CTX_set_clk_prec_digits\r\n#undef TS_CONF_set_clock_precision_digits\r\n#define TS_CONF_set_clock_precision_digits\tTS_CONF_set_clk_prec_digits\r\n\r\n/* Hack some long CMS names */\r\n#undef CMS_RecipientInfo_ktri_get0_algs\r\n#define CMS_RecipientInfo_ktri_get0_algs\tCMS_RecipInfo_ktri_get0_algs\r\n#undef CMS_RecipientInfo_ktri_get0_signer_id\r\n#define CMS_RecipientInfo_ktri_get0_signer_id\tCMS_RecipInfo_ktri_get0_sigr_id\r\n#undef CMS_OtherRevocationInfoFormat_it\r\n#define CMS_OtherRevocationInfoFormat_it\tCMS_OtherRevocInfoFormat_it\r\n#undef CMS_KeyAgreeRecipientIdentifier_it\r\n#define CMS_KeyAgreeRecipientIdentifier_it\tCMS_KeyAgreeRecipIdentifier_it\r\n#undef CMS_OriginatorIdentifierOrKey_it\r\n#define CMS_OriginatorIdentifierOrKey_it\tCMS_OriginatorIdOrKey_it\r\n#undef cms_SignerIdentifier_get0_signer_id\r\n#define cms_SignerIdentifier_get0_signer_id\tcms_SignerId_get0_signer_id\r\n\r\n/* Hack some long DTLS1 names */\r\n#undef dtls1_retransmit_buffered_messages\r\n#define dtls1_retransmit_buffered_messages\tdtls1_retransmit_buffered_msgs\r\n\r\n/* Hack some long SRP names */\r\n#undef SRP_generate_server_master_secret\r\n#define SRP_generate_server_master_secret\tSRP_gen_server_master_secret\r\n#undef SRP_generate_client_master_secret\r\n#define SRP_generate_client_master_secret\tSRP_gen_client_master_secret\r\n\r\n/* Hack some long UI names */\r\n#undef UI_method_get_prompt_constructor\r\n#define UI_method_get_prompt_constructor\tUI_method_get_prompt_constructr\r\n#undef UI_method_set_prompt_constructor\r\n#define UI_method_set_prompt_constructor\tUI_method_set_prompt_constructr\r\n\r\n#endif /* defined OPENSSL_SYS_VMS */\r\n\r\n\r\n/* Case insensitive linking causes problems.... */\r\n#if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)\r\n#undef ERR_load_CRYPTO_strings\r\n#define ERR_load_CRYPTO_strings\t\t\tERR_load_CRYPTOlib_strings\r\n#undef OCSP_crlID_new\r\n#define OCSP_crlID_new\t\t\t\tOCSP_crlID2_new\r\n\r\n#undef d2i_ECPARAMETERS\r\n#define d2i_ECPARAMETERS\t\t\td2i_UC_ECPARAMETERS\r\n#undef i2d_ECPARAMETERS\r\n#define i2d_ECPARAMETERS\t\t\ti2d_UC_ECPARAMETERS\r\n#undef d2i_ECPKPARAMETERS\r\n#define d2i_ECPKPARAMETERS\t\t\td2i_UC_ECPKPARAMETERS\r\n#undef i2d_ECPKPARAMETERS\r\n#define i2d_ECPKPARAMETERS\t\t\ti2d_UC_ECPKPARAMETERS\r\n\r\n/* These functions do not seem to exist!  However, I'm paranoid...\r\n   Original command in x509v3.h:\r\n   These functions are being redefined in another directory,\r\n   and clash when the linker is case-insensitive, so let's\r\n   hide them a little, by giving them an extra 'o' at the\r\n   beginning of the name... */\r\n#undef X509v3_cleanup_extensions\r\n#define X509v3_cleanup_extensions\t\toX509v3_cleanup_extensions\r\n#undef X509v3_add_extension\r\n#define X509v3_add_extension\t\t\toX509v3_add_extension\r\n#undef X509v3_add_netscape_extensions\r\n#define X509v3_add_netscape_extensions\t\toX509v3_add_netscape_extensions\r\n#undef X509v3_add_standard_extensions\r\n#define X509v3_add_standard_extensions\t\toX509v3_add_standard_extensions\r\n\r\n/* This one clashes with CMS_data_create */\r\n#undef cms_Data_create\r\n#define cms_Data_create\t\t\t\tpriv_cms_Data_create\r\n\r\n#endif\r\n\r\n\r\n#endif /* ! defined HEADER_VMS_IDHACKS_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/tls1.h",
    "content": "/* ssl/tls1.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n *\r\n * Portions of the attached software (\"Contribution\") are developed by \r\n * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.\r\n *\r\n * The Contribution is licensed pursuant to the OpenSSL open source\r\n * license provided above.\r\n *\r\n * ECC cipher suite support in OpenSSL originally written by\r\n * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.\r\n *\r\n */\r\n/* ====================================================================\r\n * Copyright 2005 Nokia. All rights reserved.\r\n *\r\n * The portions of the attached software (\"Contribution\") is developed by\r\n * Nokia Corporation and is licensed pursuant to the OpenSSL open source\r\n * license.\r\n *\r\n * The Contribution, originally written by Mika Kousa and Pasi Eronen of\r\n * Nokia Corporation, consists of the \"PSK\" (Pre-Shared Key) ciphersuites\r\n * support (see RFC 4279) to OpenSSL.\r\n *\r\n * No patent licenses or other rights except those expressly stated in\r\n * the OpenSSL open source license shall be deemed granted or received\r\n * expressly, by implication, estoppel, or otherwise.\r\n *\r\n * No assurances are provided by Nokia that the Contribution does not\r\n * infringe the patent or other intellectual property rights of any third\r\n * party or that the license provides you with all the necessary rights\r\n * to make use of the Contribution.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND. IN\r\n * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA\r\n * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY\r\n * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR\r\n * OTHERWISE.\r\n */\r\n\r\n#ifndef HEADER_TLS1_H \r\n#define HEADER_TLS1_H \r\n\r\n#include <openssl/buffer.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES\t0\r\n\r\n#define TLS1_2_VERSION\t\t\t0x0303\r\n#define TLS1_2_VERSION_MAJOR\t\t0x03\r\n#define TLS1_2_VERSION_MINOR\t\t0x03\r\n\r\n#define TLS1_1_VERSION\t\t\t0x0302\r\n#define TLS1_1_VERSION_MAJOR\t\t0x03\r\n#define TLS1_1_VERSION_MINOR\t\t0x02\r\n\r\n#define TLS1_VERSION\t\t\t0x0301\r\n#define TLS1_VERSION_MAJOR\t\t0x03\r\n#define TLS1_VERSION_MINOR\t\t0x01\r\n\r\n#define TLS1_get_version(s) \\\r\n\t\t((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0)\r\n\r\n#define TLS1_get_client_version(s) \\\r\n\t\t((s->client_version >> 8) == TLS1_VERSION_MAJOR ? s->client_version : 0)\r\n\r\n#define TLS1_AD_DECRYPTION_FAILED\t21\r\n#define TLS1_AD_RECORD_OVERFLOW\t\t22\r\n#define TLS1_AD_UNKNOWN_CA\t\t48\t/* fatal */\r\n#define TLS1_AD_ACCESS_DENIED\t\t49\t/* fatal */\r\n#define TLS1_AD_DECODE_ERROR\t\t50\t/* fatal */\r\n#define TLS1_AD_DECRYPT_ERROR\t\t51\r\n#define TLS1_AD_EXPORT_RESTRICTION\t60\t/* fatal */\r\n#define TLS1_AD_PROTOCOL_VERSION\t70\t/* fatal */\r\n#define TLS1_AD_INSUFFICIENT_SECURITY\t71\t/* fatal */\r\n#define TLS1_AD_INTERNAL_ERROR\t\t80\t/* fatal */\r\n#define TLS1_AD_USER_CANCELLED\t\t90\r\n#define TLS1_AD_NO_RENEGOTIATION\t100\r\n/* codes 110-114 are from RFC3546 */\r\n#define TLS1_AD_UNSUPPORTED_EXTENSION\t110\r\n#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111\r\n#define TLS1_AD_UNRECOGNIZED_NAME \t112\r\n#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113\r\n#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114\r\n#define TLS1_AD_UNKNOWN_PSK_IDENTITY\t115\t/* fatal */\r\n\r\n/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */\r\n#define TLSEXT_TYPE_server_name\t\t\t0\r\n#define TLSEXT_TYPE_max_fragment_length\t\t1\r\n#define TLSEXT_TYPE_client_certificate_url\t2\r\n#define TLSEXT_TYPE_trusted_ca_keys\t\t3\r\n#define TLSEXT_TYPE_truncated_hmac\t\t4\r\n#define TLSEXT_TYPE_status_request\t\t5\r\n/* ExtensionType values from RFC4681 */\r\n#define TLSEXT_TYPE_user_mapping\t\t6\r\n\r\n/* ExtensionType values from RFC5878 */\r\n#define TLSEXT_TYPE_client_authz\t\t7\r\n#define TLSEXT_TYPE_server_authz\t\t8\r\n\r\n/* ExtensionType values from RFC6091 */\r\n#define TLSEXT_TYPE_cert_type\t\t9\r\n\r\n/* ExtensionType values from RFC4492 */\r\n#define TLSEXT_TYPE_elliptic_curves\t\t10\r\n#define TLSEXT_TYPE_ec_point_formats\t\t11\r\n\r\n/* ExtensionType value from RFC5054 */\r\n#define TLSEXT_TYPE_srp\t\t\t\t12\r\n\r\n/* ExtensionType values from RFC5246 */\r\n#define TLSEXT_TYPE_signature_algorithms\t13\r\n\r\n/* ExtensionType value from RFC5764 */\r\n#define TLSEXT_TYPE_use_srtp\t14\r\n\r\n/* ExtensionType value from RFC5620 */\r\n#define TLSEXT_TYPE_heartbeat\t15\r\n\r\n/* ExtensionType value from RFC4507 */\r\n#define TLSEXT_TYPE_session_ticket\t\t35\r\n\r\n/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */\r\n#if 0 /* will have to be provided externally for now ,\r\n       * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=38183\r\n       * using whatever extension number you'd like to try */\r\n# define TLSEXT_TYPE_opaque_prf_input\t\t?? */\r\n#endif\r\n\r\n/* Temporary extension type */\r\n#define TLSEXT_TYPE_renegotiate                 0xff01\r\n\r\n#ifndef OPENSSL_NO_NEXTPROTONEG\r\n/* This is not an IANA defined extension number */\r\n#define TLSEXT_TYPE_next_proto_neg\t\t13172\r\n#endif\r\n\r\n/* NameType value from RFC 3546 */\r\n#define TLSEXT_NAMETYPE_host_name 0\r\n/* status request value from RFC 3546 */\r\n#define TLSEXT_STATUSTYPE_ocsp 1\r\n\r\n/* ECPointFormat values from draft-ietf-tls-ecc-12 */\r\n#define TLSEXT_ECPOINTFORMAT_first\t\t\t0\r\n#define TLSEXT_ECPOINTFORMAT_uncompressed\t\t0\r\n#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime\t1\r\n#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2\t2\r\n#define TLSEXT_ECPOINTFORMAT_last\t\t\t2\r\n\r\n/* Signature and hash algorithms from RFC 5246 */\r\n\r\n#define TLSEXT_signature_anonymous\t\t\t0\r\n#define TLSEXT_signature_rsa\t\t\t\t1\r\n#define TLSEXT_signature_dsa\t\t\t\t2\r\n#define TLSEXT_signature_ecdsa\t\t\t\t3\r\n\r\n#define TLSEXT_hash_none\t\t\t\t0\r\n#define TLSEXT_hash_md5\t\t\t\t\t1\r\n#define TLSEXT_hash_sha1\t\t\t\t2\r\n#define TLSEXT_hash_sha224\t\t\t\t3\r\n#define TLSEXT_hash_sha256\t\t\t\t4\r\n#define TLSEXT_hash_sha384\t\t\t\t5\r\n#define TLSEXT_hash_sha512\t\t\t\t6\r\n\r\n#ifndef OPENSSL_NO_TLSEXT\r\n\r\n#define TLSEXT_MAXLEN_host_name 255\r\n\r\nconst char *SSL_get_servername(const SSL *s, const int type);\r\nint SSL_get_servername_type(const SSL *s);\r\n/* SSL_export_keying_material exports a value derived from the master secret,\r\n * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and\r\n * optional context. (Since a zero length context is allowed, the |use_context|\r\n * flag controls whether a context is included.)\r\n *\r\n * It returns 1 on success and zero otherwise.\r\n */\r\nint SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,\r\n\tconst char *label, size_t llen, const unsigned char *p, size_t plen,\r\n\tint use_context);\r\n\r\n#define SSL_set_tlsext_host_name(s,name) \\\r\nSSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name)\r\n\r\n#define SSL_set_tlsext_debug_callback(ssl, cb) \\\r\nSSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,(void (*)(void))cb)\r\n\r\n#define SSL_set_tlsext_debug_arg(ssl, arg) \\\r\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0, (void *)arg)\r\n\r\n#define SSL_set_tlsext_status_type(ssl, type) \\\r\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type, NULL)\r\n\r\n#define SSL_get_tlsext_status_exts(ssl, arg) \\\r\nSSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg)\r\n\r\n#define SSL_set_tlsext_status_exts(ssl, arg) \\\r\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg)\r\n\r\n#define SSL_get_tlsext_status_ids(ssl, arg) \\\r\nSSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg)\r\n\r\n#define SSL_set_tlsext_status_ids(ssl, arg) \\\r\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg)\r\n\r\n#define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \\\r\nSSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0, (void *)arg)\r\n\r\n#define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \\\r\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen, (void *)arg)\r\n\r\n#define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \\\r\nSSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,(void (*)(void))cb)\r\n\r\n#define SSL_TLSEXT_ERR_OK 0\r\n#define SSL_TLSEXT_ERR_ALERT_WARNING 1\r\n#define SSL_TLSEXT_ERR_ALERT_FATAL 2\r\n#define SSL_TLSEXT_ERR_NOACK 3\r\n\r\n#define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \\\r\nSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0, (void *)arg)\r\n\r\n#define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_GET_TLSEXT_TICKET_KEYS,(keylen),(keys))\r\n#define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \\\r\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_SET_TLSEXT_TICKET_KEYS,(keylen),(keys))\r\n\r\n#define SSL_CTX_set_tlsext_status_cb(ssl, cb) \\\r\nSSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,(void (*)(void))cb)\r\n\r\n#define SSL_CTX_set_tlsext_status_arg(ssl, arg) \\\r\nSSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0, (void *)arg)\r\n\r\n#define SSL_set_tlsext_opaque_prf_input(s, src, len) \\\r\nSSL_ctrl(s,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT, len, src)\r\n#define SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb) \\\r\nSSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB, (void (*)(void))cb)\r\n#define SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg) \\\r\nSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG, 0, arg)\r\n\r\n#define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \\\r\nSSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)\r\n\r\n#ifndef OPENSSL_NO_HEARTBEATS\r\n#define SSL_TLSEXT_HB_ENABLED\t\t\t\t0x01\r\n#define SSL_TLSEXT_HB_DONT_SEND_REQUESTS\t0x02\r\n#define SSL_TLSEXT_HB_DONT_RECV_REQUESTS\t0x04\r\n\r\n#define SSL_get_tlsext_heartbeat_pending(ssl) \\\r\n        SSL_ctrl((ssl),SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING,0,NULL)\r\n#define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \\\r\n        SSL_ctrl((ssl),SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL)\r\n#endif\r\n#endif\r\n\r\n/* PSK ciphersuites from 4279 */\r\n#define TLS1_CK_PSK_WITH_RC4_128_SHA                    0x0300008A\r\n#define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA               0x0300008B\r\n#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA                0x0300008C\r\n#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA                0x0300008D\r\n\r\n/* Additional TLS ciphersuites from expired Internet Draft\r\n * draft-ietf-tls-56-bit-ciphersuites-01.txt\r\n * (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see\r\n * s3_lib.c).  We actually treat them like SSL 3.0 ciphers, which we probably\r\n * shouldn't.  Note that the first two are actually not in the IDs. */\r\n#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5\t\t0x03000060 /* not in ID */\r\n#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5\t0x03000061 /* not in ID */\r\n#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA\t\t0x03000062\r\n#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA\t0x03000063\r\n#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA\t\t0x03000064\r\n#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA\t0x03000065\r\n#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA\t\t0x03000066\r\n\r\n/* AES ciphersuites from RFC3268 */\r\n\r\n#define TLS1_CK_RSA_WITH_AES_128_SHA\t\t\t0x0300002F\r\n#define TLS1_CK_DH_DSS_WITH_AES_128_SHA\t\t\t0x03000030\r\n#define TLS1_CK_DH_RSA_WITH_AES_128_SHA\t\t\t0x03000031\r\n#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA\t\t0x03000032\r\n#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA\t\t0x03000033\r\n#define TLS1_CK_ADH_WITH_AES_128_SHA\t\t\t0x03000034\r\n\r\n#define TLS1_CK_RSA_WITH_AES_256_SHA\t\t\t0x03000035\r\n#define TLS1_CK_DH_DSS_WITH_AES_256_SHA\t\t\t0x03000036\r\n#define TLS1_CK_DH_RSA_WITH_AES_256_SHA\t\t\t0x03000037\r\n#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA\t\t0x03000038\r\n#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA\t\t0x03000039\r\n#define TLS1_CK_ADH_WITH_AES_256_SHA\t\t\t0x0300003A\r\n\r\n/* TLS v1.2 ciphersuites */\r\n#define TLS1_CK_RSA_WITH_NULL_SHA256\t\t\t0x0300003B\r\n#define TLS1_CK_RSA_WITH_AES_128_SHA256\t\t\t0x0300003C\r\n#define TLS1_CK_RSA_WITH_AES_256_SHA256\t\t\t0x0300003D\r\n#define TLS1_CK_DH_DSS_WITH_AES_128_SHA256\t\t0x0300003E\r\n#define TLS1_CK_DH_RSA_WITH_AES_128_SHA256\t\t0x0300003F\r\n#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256\t\t0x03000040\r\n\r\n/* Camellia ciphersuites from RFC4132 */\r\n#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA\t\t0x03000041\r\n#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA\t0x03000042\r\n#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA\t0x03000043\r\n#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA\t0x03000044\r\n#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA\t0x03000045\r\n#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA\t\t0x03000046\r\n\r\n/* TLS v1.2 ciphersuites */\r\n#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256\t\t0x03000067\r\n#define TLS1_CK_DH_DSS_WITH_AES_256_SHA256\t\t0x03000068\r\n#define TLS1_CK_DH_RSA_WITH_AES_256_SHA256\t\t0x03000069\r\n#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256\t\t0x0300006A\r\n#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256\t\t0x0300006B\r\n#define TLS1_CK_ADH_WITH_AES_128_SHA256\t\t\t0x0300006C\r\n#define TLS1_CK_ADH_WITH_AES_256_SHA256\t\t\t0x0300006D\r\n\r\n/* Camellia ciphersuites from RFC4132 */\r\n#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA\t\t0x03000084\r\n#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA\t0x03000085\r\n#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA\t0x03000086\r\n#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA\t0x03000087\r\n#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA\t0x03000088\r\n#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA\t\t0x03000089\r\n\r\n/* SEED ciphersuites from RFC4162 */\r\n#define TLS1_CK_RSA_WITH_SEED_SHA                       0x03000096\r\n#define TLS1_CK_DH_DSS_WITH_SEED_SHA                    0x03000097\r\n#define TLS1_CK_DH_RSA_WITH_SEED_SHA                    0x03000098\r\n#define TLS1_CK_DHE_DSS_WITH_SEED_SHA                   0x03000099\r\n#define TLS1_CK_DHE_RSA_WITH_SEED_SHA                   0x0300009A\r\n#define TLS1_CK_ADH_WITH_SEED_SHA                \t0x0300009B\r\n\r\n/* TLS v1.2 GCM ciphersuites from RFC5288 */\r\n#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256\t\t0x0300009C\r\n#define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384\t\t0x0300009D\r\n#define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256\t\t0x0300009E\r\n#define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384\t\t0x0300009F\r\n#define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256\t\t0x030000A0\r\n#define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384\t\t0x030000A1\r\n#define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256\t\t0x030000A2\r\n#define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384\t\t0x030000A3\r\n#define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256\t\t0x030000A4\r\n#define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384\t\t0x030000A5\r\n#define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256\t\t0x030000A6\r\n#define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384\t\t0x030000A7\r\n\r\n/* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in draft 13 */\r\n#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA                0x0300C001\r\n#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA             0x0300C002\r\n#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA        0x0300C003\r\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA         0x0300C004\r\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA         0x0300C005\r\n\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA               0x0300C006\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA            0x0300C007\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA       0x0300C008\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA        0x0300C009\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA        0x0300C00A\r\n\r\n#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA                  0x0300C00B\r\n#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA               0x0300C00C\r\n#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA          0x0300C00D\r\n#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA           0x0300C00E\r\n#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA           0x0300C00F\r\n\r\n#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA                 0x0300C010\r\n#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA              0x0300C011\r\n#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA         0x0300C012\r\n#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA          0x0300C013\r\n#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA          0x0300C014\r\n\r\n#define TLS1_CK_ECDH_anon_WITH_NULL_SHA                 0x0300C015\r\n#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA              0x0300C016\r\n#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA         0x0300C017\r\n#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA          0x0300C018\r\n#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA          0x0300C019\r\n\r\n/* SRP ciphersuites from RFC 5054 */\r\n#define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA\t\t0x0300C01A\r\n#define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA\t0x0300C01B\r\n#define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA\t0x0300C01C\r\n#define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA\t\t0x0300C01D\r\n#define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA\t0x0300C01E\r\n#define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA\t0x0300C01F\r\n#define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA\t\t0x0300C020\r\n#define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA\t0x0300C021\r\n#define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA\t0x0300C022\r\n\r\n/* ECDH HMAC based ciphersuites from RFC5289 */\r\n\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256         0x0300C023\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384         0x0300C024\r\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256          0x0300C025\r\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384          0x0300C026\r\n#define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256           0x0300C027\r\n#define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384           0x0300C028\r\n#define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256            0x0300C029\r\n#define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384            0x0300C02A\r\n\r\n/* ECDH GCM based ciphersuites from RFC5289 */\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\t0x0300C02B\r\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\t0x0300C02C\r\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256      0x0300C02D\r\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384      0x0300C02E\r\n#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256       0x0300C02F\r\n#define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384       0x0300C030\r\n#define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256        0x0300C031\r\n#define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384        0x0300C032\r\n\r\n/* XXX\r\n * Inconsistency alert:\r\n * The OpenSSL names of ciphers with ephemeral DH here include the string\r\n * \"DHE\", while elsewhere it has always been \"EDH\".\r\n * (The alias for the list of all such ciphers also is \"EDH\".)\r\n * The specifications speak of \"EDH\"; maybe we should allow both forms\r\n * for everything. */\r\n#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5\t\t\"EXP1024-RC4-MD5\"\r\n#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5\t\"EXP1024-RC2-CBC-MD5\"\r\n#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA\t\"EXP1024-DES-CBC-SHA\"\r\n#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA\t\"EXP1024-DHE-DSS-DES-CBC-SHA\"\r\n#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA\t\t\"EXP1024-RC4-SHA\"\r\n#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA\t\"EXP1024-DHE-DSS-RC4-SHA\"\r\n#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA\t\t\"DHE-DSS-RC4-SHA\"\r\n\r\n/* AES ciphersuites from RFC3268 */\r\n#define TLS1_TXT_RSA_WITH_AES_128_SHA\t\t\t\"AES128-SHA\"\r\n#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA\t\t\"DH-DSS-AES128-SHA\"\r\n#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA\t\t\"DH-RSA-AES128-SHA\"\r\n#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA\t\t\"DHE-DSS-AES128-SHA\"\r\n#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA\t\t\"DHE-RSA-AES128-SHA\"\r\n#define TLS1_TXT_ADH_WITH_AES_128_SHA\t\t\t\"ADH-AES128-SHA\"\r\n\r\n#define TLS1_TXT_RSA_WITH_AES_256_SHA\t\t\t\"AES256-SHA\"\r\n#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA\t\t\"DH-DSS-AES256-SHA\"\r\n#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA\t\t\"DH-RSA-AES256-SHA\"\r\n#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA\t\t\"DHE-DSS-AES256-SHA\"\r\n#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA\t\t\"DHE-RSA-AES256-SHA\"\r\n#define TLS1_TXT_ADH_WITH_AES_256_SHA\t\t\t\"ADH-AES256-SHA\"\r\n\r\n/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA               \"ECDH-ECDSA-NULL-SHA\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA            \"ECDH-ECDSA-RC4-SHA\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA       \"ECDH-ECDSA-DES-CBC3-SHA\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA        \"ECDH-ECDSA-AES128-SHA\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA        \"ECDH-ECDSA-AES256-SHA\"\r\n\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA              \"ECDHE-ECDSA-NULL-SHA\"\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA           \"ECDHE-ECDSA-RC4-SHA\"\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA      \"ECDHE-ECDSA-DES-CBC3-SHA\"\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA       \"ECDHE-ECDSA-AES128-SHA\"\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA       \"ECDHE-ECDSA-AES256-SHA\"\r\n\r\n#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA                 \"ECDH-RSA-NULL-SHA\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA              \"ECDH-RSA-RC4-SHA\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA         \"ECDH-RSA-DES-CBC3-SHA\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA          \"ECDH-RSA-AES128-SHA\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA          \"ECDH-RSA-AES256-SHA\"\r\n\r\n#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA                \"ECDHE-RSA-NULL-SHA\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA             \"ECDHE-RSA-RC4-SHA\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA        \"ECDHE-RSA-DES-CBC3-SHA\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA         \"ECDHE-RSA-AES128-SHA\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA         \"ECDHE-RSA-AES256-SHA\"\r\n\r\n#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA                \"AECDH-NULL-SHA\"\r\n#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA             \"AECDH-RC4-SHA\"\r\n#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA        \"AECDH-DES-CBC3-SHA\"\r\n#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA         \"AECDH-AES128-SHA\"\r\n#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA         \"AECDH-AES256-SHA\"\r\n\r\n/* PSK ciphersuites from RFC 4279 */\r\n#define TLS1_TXT_PSK_WITH_RC4_128_SHA\t\t\t\"PSK-RC4-SHA\"\r\n#define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA\t\t\"PSK-3DES-EDE-CBC-SHA\"\r\n#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA\t\t\"PSK-AES128-CBC-SHA\"\r\n#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA\t\t\"PSK-AES256-CBC-SHA\"\r\n\r\n/* SRP ciphersuite from RFC 5054 */\r\n#define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA\t\t\"SRP-3DES-EDE-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA\t\"SRP-RSA-3DES-EDE-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA\t\"SRP-DSS-3DES-EDE-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA\t\t\"SRP-AES-128-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA\t\"SRP-RSA-AES-128-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA\t\"SRP-DSS-AES-128-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA\t\t\"SRP-AES-256-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA\t\"SRP-RSA-AES-256-CBC-SHA\"\r\n#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA\t\"SRP-DSS-AES-256-CBC-SHA\"\r\n\r\n/* Camellia ciphersuites from RFC4132 */\r\n#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA\t\t\"CAMELLIA128-SHA\"\r\n#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA\t\"DH-DSS-CAMELLIA128-SHA\"\r\n#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA\t\"DH-RSA-CAMELLIA128-SHA\"\r\n#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA\t\"DHE-DSS-CAMELLIA128-SHA\"\r\n#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA\t\"DHE-RSA-CAMELLIA128-SHA\"\r\n#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA\t\t\"ADH-CAMELLIA128-SHA\"\r\n\r\n#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA\t\t\"CAMELLIA256-SHA\"\r\n#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA\t\"DH-DSS-CAMELLIA256-SHA\"\r\n#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA\t\"DH-RSA-CAMELLIA256-SHA\"\r\n#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA\t\"DHE-DSS-CAMELLIA256-SHA\"\r\n#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA\t\"DHE-RSA-CAMELLIA256-SHA\"\r\n#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA\t\t\"ADH-CAMELLIA256-SHA\"\r\n\r\n/* SEED ciphersuites from RFC4162 */\r\n#define TLS1_TXT_RSA_WITH_SEED_SHA                      \"SEED-SHA\"\r\n#define TLS1_TXT_DH_DSS_WITH_SEED_SHA                   \"DH-DSS-SEED-SHA\"\r\n#define TLS1_TXT_DH_RSA_WITH_SEED_SHA                   \"DH-RSA-SEED-SHA\"\r\n#define TLS1_TXT_DHE_DSS_WITH_SEED_SHA                  \"DHE-DSS-SEED-SHA\"\r\n#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA                  \"DHE-RSA-SEED-SHA\"\r\n#define TLS1_TXT_ADH_WITH_SEED_SHA                      \"ADH-SEED-SHA\"\r\n\r\n/* TLS v1.2 ciphersuites */\r\n#define TLS1_TXT_RSA_WITH_NULL_SHA256\t\t\t\"NULL-SHA256\"\r\n#define TLS1_TXT_RSA_WITH_AES_128_SHA256\t\t\"AES128-SHA256\"\r\n#define TLS1_TXT_RSA_WITH_AES_256_SHA256\t\t\"AES256-SHA256\"\r\n#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256\t\t\"DH-DSS-AES128-SHA256\"\r\n#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256\t\t\"DH-RSA-AES128-SHA256\"\r\n#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256\t\t\"DHE-DSS-AES128-SHA256\"\r\n#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256\t\t\"DHE-RSA-AES128-SHA256\"\r\n#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256\t\t\"DH-DSS-AES256-SHA256\"\r\n#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256\t\t\"DH-RSA-AES256-SHA256\"\r\n#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256\t\t\"DHE-DSS-AES256-SHA256\"\r\n#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256\t\t\"DHE-RSA-AES256-SHA256\"\r\n#define TLS1_TXT_ADH_WITH_AES_128_SHA256\t\t\"ADH-AES128-SHA256\"\r\n#define TLS1_TXT_ADH_WITH_AES_256_SHA256\t\t\"ADH-AES256-SHA256\"\r\n\r\n/* TLS v1.2 GCM ciphersuites from RFC5288 */\r\n#define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256\t\t\"AES128-GCM-SHA256\"\r\n#define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384\t\t\"AES256-GCM-SHA384\"\r\n#define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256\t\"DHE-RSA-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384\t\"DHE-RSA-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256\t\t\"DH-RSA-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384\t\t\"DH-RSA-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256\t\"DHE-DSS-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384\t\"DHE-DSS-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256\t\t\"DH-DSS-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384\t\t\"DH-DSS-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256\t\t\"ADH-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384\t\t\"ADH-AES256-GCM-SHA384\"\r\n\r\n/* ECDH HMAC based ciphersuites from RFC5289 */\r\n\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256    \"ECDHE-ECDSA-AES128-SHA256\"\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384    \"ECDHE-ECDSA-AES256-SHA384\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256     \"ECDH-ECDSA-AES128-SHA256\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384     \"ECDH-ECDSA-AES256-SHA384\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256      \"ECDHE-RSA-AES128-SHA256\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384      \"ECDHE-RSA-AES256-SHA384\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256       \"ECDH-RSA-AES128-SHA256\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384       \"ECDH-RSA-AES256-SHA384\"\r\n\r\n/* ECDH GCM based ciphersuites from RFC5289 */\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256    \"ECDHE-ECDSA-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384    \"ECDHE-ECDSA-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256     \"ECDH-ECDSA-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384     \"ECDH-ECDSA-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256      \"ECDHE-RSA-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384      \"ECDHE-RSA-AES256-GCM-SHA384\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256       \"ECDH-RSA-AES128-GCM-SHA256\"\r\n#define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384       \"ECDH-RSA-AES256-GCM-SHA384\"\r\n\r\n#define TLS_CT_RSA_SIGN\t\t\t1\r\n#define TLS_CT_DSS_SIGN\t\t\t2\r\n#define TLS_CT_RSA_FIXED_DH\t\t3\r\n#define TLS_CT_DSS_FIXED_DH\t\t4\r\n#define TLS_CT_ECDSA_SIGN\t\t64\r\n#define TLS_CT_RSA_FIXED_ECDH\t\t65\r\n#define TLS_CT_ECDSA_FIXED_ECDH \t66\r\n#define TLS_CT_GOST94_SIGN\t\t21\r\n#define TLS_CT_GOST01_SIGN\t\t22\r\n/* when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see\r\n * comment there) */\r\n#define TLS_CT_NUMBER\t\t\t9\r\n\r\n#define TLS1_FINISH_MAC_LENGTH\t\t12\r\n\r\n#define TLS_MD_MAX_CONST_SIZE\t\t\t20\r\n#define TLS_MD_CLIENT_FINISH_CONST\t\t\"client finished\"\r\n#define TLS_MD_CLIENT_FINISH_CONST_SIZE\t\t15\r\n#define TLS_MD_SERVER_FINISH_CONST\t\t\"server finished\"\r\n#define TLS_MD_SERVER_FINISH_CONST_SIZE\t\t15\r\n#define TLS_MD_SERVER_WRITE_KEY_CONST\t\t\"server write key\"\r\n#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE\t16\r\n#define TLS_MD_KEY_EXPANSION_CONST\t\t\"key expansion\"\r\n#define TLS_MD_KEY_EXPANSION_CONST_SIZE\t\t13\r\n#define TLS_MD_CLIENT_WRITE_KEY_CONST\t\t\"client write key\"\r\n#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE\t16\r\n#define TLS_MD_SERVER_WRITE_KEY_CONST\t\t\"server write key\"\r\n#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE\t16\r\n#define TLS_MD_IV_BLOCK_CONST\t\t\t\"IV block\"\r\n#define TLS_MD_IV_BLOCK_CONST_SIZE\t\t8\r\n#define TLS_MD_MASTER_SECRET_CONST\t\t\"master secret\"\r\n#define TLS_MD_MASTER_SECRET_CONST_SIZE\t\t13\r\n\r\n#ifdef CHARSET_EBCDIC\r\n#undef TLS_MD_CLIENT_FINISH_CONST\r\n#define TLS_MD_CLIENT_FINISH_CONST    \"\\x63\\x6c\\x69\\x65\\x6e\\x74\\x20\\x66\\x69\\x6e\\x69\\x73\\x68\\x65\\x64\"  /*client finished*/\r\n#undef TLS_MD_SERVER_FINISH_CONST\r\n#define TLS_MD_SERVER_FINISH_CONST    \"\\x73\\x65\\x72\\x76\\x65\\x72\\x20\\x66\\x69\\x6e\\x69\\x73\\x68\\x65\\x64\"  /*server finished*/\r\n#undef TLS_MD_SERVER_WRITE_KEY_CONST\r\n#define TLS_MD_SERVER_WRITE_KEY_CONST \"\\x73\\x65\\x72\\x76\\x65\\x72\\x20\\x77\\x72\\x69\\x74\\x65\\x20\\x6b\\x65\\x79\"  /*server write key*/\r\n#undef TLS_MD_KEY_EXPANSION_CONST\r\n#define TLS_MD_KEY_EXPANSION_CONST    \"\\x6b\\x65\\x79\\x20\\x65\\x78\\x70\\x61\\x6e\\x73\\x69\\x6f\\x6e\"  /*key expansion*/\r\n#undef TLS_MD_CLIENT_WRITE_KEY_CONST\r\n#define TLS_MD_CLIENT_WRITE_KEY_CONST \"\\x63\\x6c\\x69\\x65\\x6e\\x74\\x20\\x77\\x72\\x69\\x74\\x65\\x20\\x6b\\x65\\x79\"  /*client write key*/\r\n#undef TLS_MD_SERVER_WRITE_KEY_CONST\r\n#define TLS_MD_SERVER_WRITE_KEY_CONST \"\\x73\\x65\\x72\\x76\\x65\\x72\\x20\\x77\\x72\\x69\\x74\\x65\\x20\\x6b\\x65\\x79\"  /*server write key*/\r\n#undef TLS_MD_IV_BLOCK_CONST\r\n#define TLS_MD_IV_BLOCK_CONST         \"\\x49\\x56\\x20\\x62\\x6c\\x6f\\x63\\x6b\"  /*IV block*/\r\n#undef TLS_MD_MASTER_SECRET_CONST\r\n#define TLS_MD_MASTER_SECRET_CONST    \"\\x6d\\x61\\x73\\x74\\x65\\x72\\x20\\x73\\x65\\x63\\x72\\x65\\x74\"  /*master secret*/\r\n#endif\r\n\r\n/* TLS Session Ticket extension struct */\r\nstruct tls_session_ticket_ext_st\r\n\t{\r\n\tunsigned short length;\r\n\tvoid *data;\r\n\t};\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ts.h",
    "content": "/* crypto/ts/ts.h */\r\n/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL\r\n * project 2002, 2003, 2004.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_TS_H\r\n#define HEADER_TS_H\r\n\r\n#include <openssl/opensslconf.h>\r\n#include <openssl/symhacks.h>\r\n#ifndef OPENSSL_NO_BUFFER\r\n#include <openssl/buffer.h>\r\n#endif\r\n#ifndef OPENSSL_NO_EVP\r\n#include <openssl/evp.h>\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/stack.h>\r\n#include <openssl/asn1.h>\r\n#include <openssl/safestack.h>\r\n\r\n#ifndef OPENSSL_NO_RSA\r\n#include <openssl/rsa.h>\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DSA\r\n#include <openssl/dsa.h>\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DH\r\n#include <openssl/dh.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef WIN32\r\n/* Under Win32 this is defined in wincrypt.h */\r\n#undef X509_NAME\r\n#endif\r\n\r\n#include <openssl/x509.h>\r\n#include <openssl/x509v3.h>\r\n\r\n/*\r\nMessageImprint ::= SEQUENCE  {\r\n     hashAlgorithm                AlgorithmIdentifier,\r\n     hashedMessage                OCTET STRING  }\r\n*/\r\n\r\ntypedef struct TS_msg_imprint_st\r\n\t{\r\n\tX509_ALGOR *hash_algo;\r\n\tASN1_OCTET_STRING *hashed_msg;\r\n\t} TS_MSG_IMPRINT;\r\n\r\n/*\r\nTimeStampReq ::= SEQUENCE  {\r\n   version                  INTEGER  { v1(1) },\r\n   messageImprint           MessageImprint,\r\n     --a hash algorithm OID and the hash value of the data to be\r\n     --time-stamped\r\n   reqPolicy                TSAPolicyId                OPTIONAL,\r\n   nonce                    INTEGER                    OPTIONAL,\r\n   certReq                  BOOLEAN                    DEFAULT FALSE,\r\n   extensions               [0] IMPLICIT Extensions    OPTIONAL  }\r\n*/\r\n\r\ntypedef struct TS_req_st\r\n\t{\r\n\tASN1_INTEGER *version;\r\n\tTS_MSG_IMPRINT *msg_imprint;\r\n\tASN1_OBJECT *policy_id;\t\t/* OPTIONAL */\r\n\tASN1_INTEGER *nonce;\t\t/* OPTIONAL */\r\n\tASN1_BOOLEAN cert_req;\t\t/* DEFAULT FALSE */\r\n\tSTACK_OF(X509_EXTENSION) *extensions;\t/* [0] OPTIONAL */\r\n\t} TS_REQ;\r\n\r\n/*\r\nAccuracy ::= SEQUENCE {\r\n                seconds        INTEGER           OPTIONAL,\r\n                millis     [0] INTEGER  (1..999) OPTIONAL,\r\n                micros     [1] INTEGER  (1..999) OPTIONAL  }\r\n*/\r\n\r\ntypedef struct TS_accuracy_st\r\n\t{\r\n\tASN1_INTEGER *seconds;\r\n\tASN1_INTEGER *millis;\r\n\tASN1_INTEGER *micros;\r\n\t} TS_ACCURACY;\r\n\r\n/*\r\nTSTInfo ::= SEQUENCE  {\r\n    version                      INTEGER  { v1(1) },\r\n    policy                       TSAPolicyId,\r\n    messageImprint               MessageImprint,\r\n      -- MUST have the same value as the similar field in\r\n      -- TimeStampReq\r\n    serialNumber                 INTEGER,\r\n     -- Time-Stamping users MUST be ready to accommodate integers\r\n     -- up to 160 bits.\r\n    genTime                      GeneralizedTime,\r\n    accuracy                     Accuracy                 OPTIONAL,\r\n    ordering                     BOOLEAN             DEFAULT FALSE,\r\n    nonce                        INTEGER                  OPTIONAL,\r\n      -- MUST be present if the similar field was present\r\n      -- in TimeStampReq.  In that case it MUST have the same value.\r\n    tsa                          [0] GeneralName          OPTIONAL,\r\n    extensions                   [1] IMPLICIT Extensions  OPTIONAL   }\r\n*/\r\n\r\ntypedef struct TS_tst_info_st\r\n\t{\r\n\tASN1_INTEGER *version;\r\n\tASN1_OBJECT *policy_id;\r\n\tTS_MSG_IMPRINT *msg_imprint;\r\n\tASN1_INTEGER *serial;\r\n\tASN1_GENERALIZEDTIME *time;\r\n\tTS_ACCURACY *accuracy;\r\n\tASN1_BOOLEAN ordering;\r\n\tASN1_INTEGER *nonce;\r\n\tGENERAL_NAME *tsa;\r\n\tSTACK_OF(X509_EXTENSION) *extensions;\r\n\t} TS_TST_INFO;\t\r\n\r\n/*\r\nPKIStatusInfo ::= SEQUENCE {\r\n    status        PKIStatus,\r\n    statusString  PKIFreeText     OPTIONAL,\r\n    failInfo      PKIFailureInfo  OPTIONAL  }\r\n\r\nFrom RFC 1510 - section 3.1.1:\r\nPKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String\r\n\t-- text encoded as UTF-8 String (note:  each UTF8String SHOULD\r\n\t-- include an RFC 1766 language tag to indicate the language\r\n\t-- of the contained text)\r\n*/\r\n\r\n/* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */\r\n\r\n#define\tTS_STATUS_GRANTED\t\t\t0\r\n#define\tTS_STATUS_GRANTED_WITH_MODS\t\t1\r\n#define\tTS_STATUS_REJECTION\t\t\t2\r\n#define\tTS_STATUS_WAITING\t\t\t3\r\n#define\tTS_STATUS_REVOCATION_WARNING\t\t4\r\n#define\tTS_STATUS_REVOCATION_NOTIFICATION\t5\r\n\r\n/* Possible values for failure_info. See ts_resp_print.c && ts_resp_verify.c */\r\n\r\n#define\tTS_INFO_BAD_ALG\t\t\t0\r\n#define\tTS_INFO_BAD_REQUEST\t\t2\r\n#define\tTS_INFO_BAD_DATA_FORMAT\t\t5\r\n#define\tTS_INFO_TIME_NOT_AVAILABLE\t14\r\n#define\tTS_INFO_UNACCEPTED_POLICY\t15\r\n#define\tTS_INFO_UNACCEPTED_EXTENSION\t16\r\n#define\tTS_INFO_ADD_INFO_NOT_AVAILABLE\t17\r\n#define\tTS_INFO_SYSTEM_FAILURE\t\t25\r\n\r\ntypedef struct TS_status_info_st\r\n\t{\r\n\tASN1_INTEGER *status;\r\n\tSTACK_OF(ASN1_UTF8STRING) *text;\r\n\tASN1_BIT_STRING *failure_info;\r\n\t} TS_STATUS_INFO;\r\n\r\nDECLARE_STACK_OF(ASN1_UTF8STRING)\r\nDECLARE_ASN1_SET_OF(ASN1_UTF8STRING)\r\n\r\n/*\r\nTimeStampResp ::= SEQUENCE  {\r\n     status                  PKIStatusInfo,\r\n     timeStampToken          TimeStampToken     OPTIONAL }\r\n*/\r\n\r\ntypedef struct TS_resp_st\r\n\t{\r\n\tTS_STATUS_INFO *status_info;\r\n\tPKCS7 *token;\r\n\tTS_TST_INFO *tst_info;\r\n\t} TS_RESP;\r\n\r\n/* The structure below would belong to the ESS component. */\r\n\r\n/*\r\nIssuerSerial ::= SEQUENCE {\r\n\tissuer                   GeneralNames,\r\n\tserialNumber             CertificateSerialNumber\r\n\t}\r\n*/\r\n\r\ntypedef struct ESS_issuer_serial\r\n\t{\r\n\tSTACK_OF(GENERAL_NAME)\t*issuer;\r\n\tASN1_INTEGER\t\t*serial;\r\n\t} ESS_ISSUER_SERIAL;\r\n\r\n/*\r\nESSCertID ::=  SEQUENCE {\r\n        certHash                 Hash,\r\n        issuerSerial             IssuerSerial OPTIONAL\r\n}\r\n*/\r\n\r\ntypedef struct ESS_cert_id\r\n\t{\r\n\tASN1_OCTET_STRING *hash;\t/* Always SHA-1 digest. */\r\n\tESS_ISSUER_SERIAL *issuer_serial;\r\n\t} ESS_CERT_ID;\r\n\r\nDECLARE_STACK_OF(ESS_CERT_ID)\r\nDECLARE_ASN1_SET_OF(ESS_CERT_ID)\r\n\r\n/*\r\nSigningCertificate ::=  SEQUENCE {\r\n       certs        SEQUENCE OF ESSCertID,\r\n       policies     SEQUENCE OF PolicyInformation OPTIONAL\r\n}\r\n*/\r\n\r\ntypedef struct ESS_signing_cert\r\n\t{\r\n\tSTACK_OF(ESS_CERT_ID) *cert_ids;\r\n\tSTACK_OF(POLICYINFO) *policy_info;\r\n\t} ESS_SIGNING_CERT;\r\n\r\n\r\nTS_REQ\t*TS_REQ_new(void);\r\nvoid\tTS_REQ_free(TS_REQ *a);\r\nint\ti2d_TS_REQ(const TS_REQ *a, unsigned char **pp);\r\nTS_REQ\t*d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);\r\n\r\nTS_REQ\t*TS_REQ_dup(TS_REQ *a);\r\n\r\nTS_REQ\t*d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);\r\nint\ti2d_TS_REQ_fp(FILE *fp, TS_REQ *a);\r\nTS_REQ\t*d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);\r\nint\ti2d_TS_REQ_bio(BIO *fp, TS_REQ *a);\r\n\r\nTS_MSG_IMPRINT\t*TS_MSG_IMPRINT_new(void);\r\nvoid\t\tTS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a);\r\nint\t\ti2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);\r\nTS_MSG_IMPRINT\t*d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,\r\n\t\t\t\t    const unsigned char **pp, long length);\r\n\r\nTS_MSG_IMPRINT\t*TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);\r\n\r\nTS_MSG_IMPRINT\t*d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);\r\nint\t\ti2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);\r\nTS_MSG_IMPRINT\t*d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);\r\nint\t\ti2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);\r\n\r\nTS_RESP\t*TS_RESP_new(void);\r\nvoid\tTS_RESP_free(TS_RESP *a);\r\nint\ti2d_TS_RESP(const TS_RESP *a, unsigned char **pp);\r\nTS_RESP\t*d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);\r\nTS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);\r\nTS_RESP\t*TS_RESP_dup(TS_RESP *a);\r\n\r\nTS_RESP\t*d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);\r\nint\ti2d_TS_RESP_fp(FILE *fp, TS_RESP *a);\r\nTS_RESP\t*d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);\r\nint\ti2d_TS_RESP_bio(BIO *fp, TS_RESP *a);\r\n\r\nTS_STATUS_INFO\t*TS_STATUS_INFO_new(void);\r\nvoid\t\tTS_STATUS_INFO_free(TS_STATUS_INFO *a);\r\nint\t\ti2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);\r\nTS_STATUS_INFO\t*d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, \r\n\t\t\t\t    const unsigned char **pp, long length);\r\nTS_STATUS_INFO\t*TS_STATUS_INFO_dup(TS_STATUS_INFO *a);\r\n\r\nTS_TST_INFO\t*TS_TST_INFO_new(void);\r\nvoid\t\tTS_TST_INFO_free(TS_TST_INFO *a);\r\nint\t\ti2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp);\r\nTS_TST_INFO\t*d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,\r\n\t\t\t\t    long length);\r\nTS_TST_INFO\t*TS_TST_INFO_dup(TS_TST_INFO *a);\r\n\r\nTS_TST_INFO\t*d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);\r\nint\t\ti2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);\r\nTS_TST_INFO\t*d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);\r\nint\t\ti2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);\r\n\r\nTS_ACCURACY\t*TS_ACCURACY_new(void);\r\nvoid\t\tTS_ACCURACY_free(TS_ACCURACY *a);\r\nint\t\ti2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);\r\nTS_ACCURACY\t*d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,\r\n\t\t\t\t    long length);\r\nTS_ACCURACY\t*TS_ACCURACY_dup(TS_ACCURACY *a);\r\n\r\nESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);\r\nvoid\t\t  ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);\r\nint\t\t  i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a,\r\n\t\t\t\t\tunsigned char **pp);\r\nESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,\r\n\t\t\t\t\t const unsigned char **pp, long length);\r\nESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);\r\n\r\nESS_CERT_ID\t*ESS_CERT_ID_new(void);\r\nvoid\t\tESS_CERT_ID_free(ESS_CERT_ID *a);\r\nint\t\ti2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp);\r\nESS_CERT_ID\t*d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp,\r\n\t\t\t\t long length);\r\nESS_CERT_ID\t*ESS_CERT_ID_dup(ESS_CERT_ID *a);\r\n\r\nESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);\r\nvoid\t\t ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);\r\nint\t\t i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, \r\n\t\t\t\t      unsigned char **pp);\r\nESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,\r\n\t\t\t\t       const unsigned char **pp, long length);\r\nESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);\r\n\r\nvoid ERR_load_TS_strings(void);\r\n\r\nint TS_REQ_set_version(TS_REQ *a, long version);\r\nlong TS_REQ_get_version(const TS_REQ *a);\r\n\r\nint TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);\r\nTS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);\r\n\r\nint TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);\r\nX509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a);\r\n\r\nint TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len);\r\nASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a);\r\n\r\nint TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy);\r\nASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a);\r\n\r\nint TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce);\r\nconst ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a);\r\n\r\nint TS_REQ_set_cert_req(TS_REQ *a, int cert_req);\r\nint TS_REQ_get_cert_req(const TS_REQ *a);\r\n\r\nSTACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a);\r\nvoid TS_REQ_ext_free(TS_REQ *a);\r\nint TS_REQ_get_ext_count(TS_REQ *a);\r\nint TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos);\r\nint TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos);\r\nint TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos);\r\nX509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc);\r\nX509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc);\r\nint TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);\r\nvoid *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);\r\n\r\n/* Function declarations for TS_REQ defined in ts/ts_req_print.c */\r\n\r\nint TS_REQ_print_bio(BIO *bio, TS_REQ *a);\r\n\r\n/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */\r\n\r\nint TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);\r\nTS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);\r\n\r\n/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */\r\nvoid TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);\r\nPKCS7 *TS_RESP_get_token(TS_RESP *a);\r\nTS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);\r\n\r\nint TS_TST_INFO_set_version(TS_TST_INFO *a, long version);\r\nlong TS_TST_INFO_get_version(const TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id);\r\nASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint);\r\nTS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial);\r\nconst ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime);\r\nconst ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy);\r\nTS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a);\r\n\r\nint TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds);\r\nconst ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a);\r\n\r\nint TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis);\r\nconst ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a);\r\n\r\nint TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros);\r\nconst ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a);\r\n\r\nint TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering);\r\nint TS_TST_INFO_get_ordering(const TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce);\r\nconst ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a);\r\n\r\nint TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa);\r\nGENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a);\r\n\r\nSTACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a);\r\nvoid TS_TST_INFO_ext_free(TS_TST_INFO *a);\r\nint TS_TST_INFO_get_ext_count(TS_TST_INFO *a);\r\nint TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos);\r\nint TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastpos);\r\nint TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);\r\nX509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);\r\nX509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);\r\nint TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);\r\nvoid *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx);\r\n\r\n/* Declarations related to response generation, defined in ts/ts_resp_sign.c. */\r\n\r\n/* Optional flags for response generation. */\r\n\r\n/* Don't include the TSA name in response. */\r\n#define\tTS_TSA_NAME\t\t0x01\r\n\r\n/* Set ordering to true in response. */\r\n#define\tTS_ORDERING\t\t0x02\r\n\r\n/*\r\n * Include the signer certificate and the other specified certificates in\r\n * the ESS signing certificate attribute beside the PKCS7 signed data.\r\n * Only the signer certificates is included by default.\r\n */\r\n#define\tTS_ESS_CERT_ID_CHAIN\t0x04\r\n\r\n/* Forward declaration. */\r\nstruct TS_resp_ctx;\r\n\r\n/* This must return a unique number less than 160 bits long. */\r\ntypedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *);\r\n\r\n/* This must return the seconds and microseconds since Jan 1, 1970 in\r\n   the sec and usec variables allocated by the caller. \r\n   Return non-zero for success and zero for failure. */\r\ntypedef\tint (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, long *usec);\r\n\r\n/* This must process the given extension.\r\n * It can modify the TS_TST_INFO object of the context.\r\n * Return values: !0 (processed), 0 (error, it must set the \r\n * status info/failure info of the response).\r\n */\r\ntypedef\tint (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *);\r\n\r\ntypedef struct TS_resp_ctx\r\n\t{\r\n\tX509\t\t*signer_cert;\r\n\tEVP_PKEY\t*signer_key;\r\n\tSTACK_OF(X509)\t*certs;\t/* Certs to include in signed data. */\r\n\tSTACK_OF(ASN1_OBJECT)\t*policies;\t/* Acceptable policies. */\r\n\tASN1_OBJECT\t*default_policy; /* It may appear in policies, too. */\r\n\tSTACK_OF(EVP_MD)\t*mds;\t/* Acceptable message digests. */\r\n\tASN1_INTEGER\t*seconds;\t/* accuracy, 0 means not specified. */\r\n\tASN1_INTEGER\t*millis;\t/* accuracy, 0 means not specified. */\r\n\tASN1_INTEGER\t*micros;\t/* accuracy, 0 means not specified. */\r\n\tunsigned\tclock_precision_digits; /* fraction of seconds in\r\n\t\t\t\t\t\t   time stamp token. */\r\n\tunsigned\tflags;\t\t/* Optional info, see values above. */\r\n\r\n\t/* Callback functions. */\r\n\tTS_serial_cb serial_cb;\r\n\tvoid *serial_cb_data;\t/* User data for serial_cb. */\r\n\t\r\n\tTS_time_cb time_cb;\r\n\tvoid *time_cb_data;\t/* User data for time_cb. */\r\n\t\r\n\tTS_extension_cb extension_cb;\r\n\tvoid *extension_cb_data;\t/* User data for extension_cb. */\r\n\r\n\t/* These members are used only while creating the response. */\r\n\tTS_REQ\t\t*request;\r\n\tTS_RESP\t\t*response;\r\n\tTS_TST_INFO\t*tst_info;\r\n\t} TS_RESP_CTX;\r\n\r\nDECLARE_STACK_OF(EVP_MD)\r\nDECLARE_ASN1_SET_OF(EVP_MD)\r\n\r\n/* Creates a response context that can be used for generating responses. */\r\nTS_RESP_CTX *TS_RESP_CTX_new(void);\r\nvoid TS_RESP_CTX_free(TS_RESP_CTX *ctx);\r\n\r\n/* This parameter must be set. */\r\nint TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);\r\n\r\n/* This parameter must be set. */\r\nint TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key);\r\n\r\n/* This parameter must be set. */\r\nint TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy);\r\n\r\n/* No additional certs are included in the response by default. */\r\nint TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs);\r\n\r\n/* Adds a new acceptable policy, only the default policy \r\n   is accepted by default. */\r\nint TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy);\r\n\r\n/* Adds a new acceptable message digest. Note that no message digests \r\n   are accepted by default. The md argument is shared with the caller. */\r\nint TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md);\r\n\r\n/* Accuracy is not included by default. */\r\nint TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx,\r\n\t\t\t     int secs, int millis, int micros);\r\n\r\n/* Clock precision digits, i.e. the number of decimal digits: \r\n   '0' means sec, '3' msec, '6' usec, and so on. Default is 0. */ \r\nint TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx,\r\n\t\t\t\t\t   unsigned clock_precision_digits);\r\n/* At most we accept usec precision. */\t\r\n#define TS_MAX_CLOCK_PRECISION_DIGITS\t6\r\n\r\n/* No flags are set by default. */\r\nvoid TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);\r\n\r\n/* Default callback always returns a constant. */\r\nvoid TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);\r\n\r\n/* Default callback uses the gettimeofday() and gmtime() system calls. */\r\nvoid TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);\r\n\r\n/* Default callback rejects all extensions. The extension callback is called \r\n * when the TS_TST_INFO object is already set up and not signed yet. */\r\n/* FIXME: extension handling is not tested yet. */\r\nvoid TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, \r\n\t\t\t\t  TS_extension_cb cb, void *data);\r\n\r\n/* The following methods can be used in the callbacks. */\r\nint TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, \r\n\t\t\t\tint status, const char *text);\r\n\r\n/* Sets the status info only if it is still TS_STATUS_GRANTED. */\r\nint TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, \r\n\t\t\t\t     int status, const char *text);\r\n\r\nint TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure);\r\n\r\n/* The get methods below can be used in the extension callback. */\r\nTS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx);\r\n\r\nTS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx);\r\n\r\n/* \r\n * Creates the signed TS_TST_INFO and puts it in TS_RESP.\r\n * In case of errors it sets the status info properly.\r\n * Returns NULL only in case of memory allocation/fatal error.\r\n */\r\nTS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);\r\n\r\n/*\r\n * Declarations related to response verification,\r\n * they are defined in ts/ts_resp_verify.c.\r\n */\r\n\r\nint TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,\r\n\t\t\t     X509_STORE *store, X509 **signer_out);\r\n\r\n/* Context structure for the generic verify method. */\r\n\r\n/* Verify the signer's certificate and the signature of the response. */\r\n#define\tTS_VFY_SIGNATURE\t(1u << 0)\r\n/* Verify the version number of the response. */\r\n#define\tTS_VFY_VERSION\t\t(1u << 1)\r\n/* Verify if the policy supplied by the user matches the policy of the TSA. */\r\n#define\tTS_VFY_POLICY\t\t(1u << 2)\r\n/* Verify the message imprint provided by the user. This flag should not be\r\n   specified with TS_VFY_DATA. */\r\n#define\tTS_VFY_IMPRINT\t\t(1u << 3)\r\n/* Verify the message imprint computed by the verify method from the user\r\n   provided data and the MD algorithm of the response. This flag should not be\r\n   specified with TS_VFY_IMPRINT. */\r\n#define\tTS_VFY_DATA\t\t(1u << 4)\r\n/* Verify the nonce value. */\r\n#define\tTS_VFY_NONCE\t\t(1u << 5)\r\n/* Verify if the TSA name field matches the signer certificate. */\r\n#define\tTS_VFY_SIGNER\t\t(1u << 6)\r\n/* Verify if the TSA name field equals to the user provided name. */\r\n#define\tTS_VFY_TSA_NAME\t\t(1u << 7)\r\n\r\n/* You can use the following convenience constants. */\r\n#define\tTS_VFY_ALL_IMPRINT\t(TS_VFY_SIGNATURE\t\\\r\n\t\t\t\t | TS_VFY_VERSION\t\\\r\n\t\t\t\t | TS_VFY_POLICY\t\\\r\n\t\t\t\t | TS_VFY_IMPRINT\t\\\r\n\t\t\t\t | TS_VFY_NONCE\t\t\\\r\n\t\t\t\t | TS_VFY_SIGNER\t\\\r\n\t\t\t\t | TS_VFY_TSA_NAME)\r\n#define\tTS_VFY_ALL_DATA\t\t(TS_VFY_SIGNATURE\t\\\r\n\t\t\t\t | TS_VFY_VERSION\t\\\r\n\t\t\t\t | TS_VFY_POLICY\t\\\r\n\t\t\t\t | TS_VFY_DATA\t\t\\\r\n\t\t\t\t | TS_VFY_NONCE\t\t\\\r\n\t\t\t\t | TS_VFY_SIGNER\t\\\r\n\t\t\t\t | TS_VFY_TSA_NAME)\r\n\r\ntypedef struct TS_verify_ctx\r\n\t{\r\n\t/* Set this to the union of TS_VFY_... flags you want to carry out. */\r\n\tunsigned\tflags;\r\n\r\n\t/* Must be set only with TS_VFY_SIGNATURE. certs is optional. */\r\n\tX509_STORE\t*store;\r\n\tSTACK_OF(X509)\t*certs;\r\n\r\n\t/* Must be set only with TS_VFY_POLICY. */\r\n\tASN1_OBJECT\t*policy;\r\n\r\n\t/* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, \r\n\t   the algorithm from the response is used. */\r\n\tX509_ALGOR\t*md_alg;\r\n\tunsigned char\t*imprint;\r\n\tunsigned\timprint_len;\r\n\r\n\t/* Must be set only with TS_VFY_DATA. */\r\n\tBIO\t\t*data;\r\n\r\n\t/* Must be set only with TS_VFY_TSA_NAME. */\r\n\tASN1_INTEGER\t*nonce;\r\n\r\n\t/* Must be set only with TS_VFY_TSA_NAME. */\r\n\tGENERAL_NAME\t*tsa_name;\r\n\t} TS_VERIFY_CTX;\r\n\r\nint TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);\r\nint TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);\r\n\r\n/*\r\n * Declarations related to response verification context,\r\n * they are defined in ts/ts_verify_ctx.c.\r\n */\r\n\r\n/* Set all fields to zero. */\r\nTS_VERIFY_CTX *TS_VERIFY_CTX_new(void);\r\nvoid TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);\r\nvoid TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);\r\nvoid TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);\r\n\r\n/* \r\n * If ctx is NULL, it allocates and returns a new object, otherwise\r\n * it returns ctx. It initialises all the members as follows:\r\n * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)\r\n * certs = NULL\r\n * store = NULL\r\n * policy = policy from the request or NULL if absent (in this case\r\n *\tTS_VFY_POLICY is cleared from flags as well)\r\n * md_alg = MD algorithm from request\r\n * imprint, imprint_len = imprint from request\r\n * data = NULL\r\n * nonce, nonce_len = nonce from the request or NULL if absent (in this case\r\n * \tTS_VFY_NONCE is cleared from flags as well)\r\n * tsa_name = NULL\r\n * Important: after calling this method TS_VFY_SIGNATURE should be added!\r\n */\r\nTS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);\r\n\r\n/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */\r\n\r\nint TS_RESP_print_bio(BIO *bio, TS_RESP *a);\r\nint TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);\r\nint TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);\r\n\r\n/* Common utility functions defined in ts/ts_lib.c */\r\n\r\nint TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num);\r\nint TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj);\r\nint TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions);\r\nint TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg);\r\nint TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);\r\n\r\n/* Function declarations for handling configuration options,\r\n   defined in ts/ts_conf.c */\r\n\r\nX509 *TS_CONF_load_cert(const char *file);\r\nSTACK_OF(X509) *TS_CONF_load_certs(const char *file);\r\nEVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);\r\nconst char *TS_CONF_get_tsa_section(CONF *conf, const char *section);\r\nint TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,\r\n\t\t       TS_RESP_CTX *ctx);\r\nint TS_CONF_set_crypto_device(CONF *conf, const char *section,\r\n\t\t\t      const char *device);\r\nint TS_CONF_set_default_engine(const char *name);\r\nint TS_CONF_set_signer_cert(CONF *conf, const char *section,\r\n\t\t\t    const char *cert, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,\r\n\t\t      TS_RESP_CTX *ctx);\r\nint TS_CONF_set_signer_key(CONF *conf, const char *section,\r\n\t\t\t   const char *key, const char *pass, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_def_policy(CONF *conf, const char *section,\r\n\t\t\t   const char *policy, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,\r\n\t\t\t\t       TS_RESP_CTX *ctx);\r\nint TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);\r\nint TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,\r\n\t\t\t\t  TS_RESP_CTX *ctx);\r\n\r\n/* -------------------------------------------------- */\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_TS_strings(void);\r\n\r\n/* Error codes for the TS functions. */\r\n\r\n/* Function codes. */\r\n#define TS_F_D2I_TS_RESP\t\t\t\t 147\r\n#define TS_F_DEF_SERIAL_CB\t\t\t\t 110\r\n#define TS_F_DEF_TIME_CB\t\t\t\t 111\r\n#define TS_F_ESS_ADD_SIGNING_CERT\t\t\t 112\r\n#define TS_F_ESS_CERT_ID_NEW_INIT\t\t\t 113\r\n#define TS_F_ESS_SIGNING_CERT_NEW_INIT\t\t\t 114\r\n#define TS_F_INT_TS_RESP_VERIFY_TOKEN\t\t\t 149\r\n#define TS_F_PKCS7_TO_TS_TST_INFO\t\t\t 148\r\n#define TS_F_TS_ACCURACY_SET_MICROS\t\t\t 115\r\n#define TS_F_TS_ACCURACY_SET_MILLIS\t\t\t 116\r\n#define TS_F_TS_ACCURACY_SET_SECONDS\t\t\t 117\r\n#define TS_F_TS_CHECK_IMPRINTS\t\t\t\t 100\r\n#define TS_F_TS_CHECK_NONCES\t\t\t\t 101\r\n#define TS_F_TS_CHECK_POLICY\t\t\t\t 102\r\n#define TS_F_TS_CHECK_SIGNING_CERTS\t\t\t 103\r\n#define TS_F_TS_CHECK_STATUS_INFO\t\t\t 104\r\n#define TS_F_TS_COMPUTE_IMPRINT\t\t\t\t 145\r\n#define TS_F_TS_CONF_SET_DEFAULT_ENGINE\t\t\t 146\r\n#define TS_F_TS_GET_STATUS_TEXT\t\t\t\t 105\r\n#define TS_F_TS_MSG_IMPRINT_SET_ALGO\t\t\t 118\r\n#define TS_F_TS_REQ_SET_MSG_IMPRINT\t\t\t 119\r\n#define TS_F_TS_REQ_SET_NONCE\t\t\t\t 120\r\n#define TS_F_TS_REQ_SET_POLICY_ID\t\t\t 121\r\n#define TS_F_TS_RESP_CREATE_RESPONSE\t\t\t 122\r\n#define TS_F_TS_RESP_CREATE_TST_INFO\t\t\t 123\r\n#define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO\t\t 124\r\n#define TS_F_TS_RESP_CTX_ADD_MD\t\t\t\t 125\r\n#define TS_F_TS_RESP_CTX_ADD_POLICY\t\t\t 126\r\n#define TS_F_TS_RESP_CTX_NEW\t\t\t\t 127\r\n#define TS_F_TS_RESP_CTX_SET_ACCURACY\t\t\t 128\r\n#define TS_F_TS_RESP_CTX_SET_CERTS\t\t\t 129\r\n#define TS_F_TS_RESP_CTX_SET_DEF_POLICY\t\t\t 130\r\n#define TS_F_TS_RESP_CTX_SET_SIGNER_CERT\t\t 131\r\n#define TS_F_TS_RESP_CTX_SET_STATUS_INFO\t\t 132\r\n#define TS_F_TS_RESP_GET_POLICY\t\t\t\t 133\r\n#define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION\t\t 134\r\n#define TS_F_TS_RESP_SET_STATUS_INFO\t\t\t 135\r\n#define TS_F_TS_RESP_SET_TST_INFO\t\t\t 150\r\n#define TS_F_TS_RESP_SIGN\t\t\t\t 136\r\n#define TS_F_TS_RESP_VERIFY_SIGNATURE\t\t\t 106\r\n#define TS_F_TS_RESP_VERIFY_TOKEN\t\t\t 107\r\n#define TS_F_TS_TST_INFO_SET_ACCURACY\t\t\t 137\r\n#define TS_F_TS_TST_INFO_SET_MSG_IMPRINT\t\t 138\r\n#define TS_F_TS_TST_INFO_SET_NONCE\t\t\t 139\r\n#define TS_F_TS_TST_INFO_SET_POLICY_ID\t\t\t 140\r\n#define TS_F_TS_TST_INFO_SET_SERIAL\t\t\t 141\r\n#define TS_F_TS_TST_INFO_SET_TIME\t\t\t 142\r\n#define TS_F_TS_TST_INFO_SET_TSA\t\t\t 143\r\n#define TS_F_TS_VERIFY\t\t\t\t\t 108\r\n#define TS_F_TS_VERIFY_CERT\t\t\t\t 109\r\n#define TS_F_TS_VERIFY_CTX_NEW\t\t\t\t 144\r\n\r\n/* Reason codes. */\r\n#define TS_R_BAD_PKCS7_TYPE\t\t\t\t 132\r\n#define TS_R_BAD_TYPE\t\t\t\t\t 133\r\n#define TS_R_CERTIFICATE_VERIFY_ERROR\t\t\t 100\r\n#define TS_R_COULD_NOT_SET_ENGINE\t\t\t 127\r\n#define TS_R_COULD_NOT_SET_TIME\t\t\t\t 115\r\n#define TS_R_D2I_TS_RESP_INT_FAILED\t\t\t 128\r\n#define TS_R_DETACHED_CONTENT\t\t\t\t 134\r\n#define TS_R_ESS_ADD_SIGNING_CERT_ERROR\t\t\t 116\r\n#define TS_R_ESS_SIGNING_CERTIFICATE_ERROR\t\t 101\r\n#define TS_R_INVALID_NULL_POINTER\t\t\t 102\r\n#define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE\t\t 117\r\n#define TS_R_MESSAGE_IMPRINT_MISMATCH\t\t\t 103\r\n#define TS_R_NONCE_MISMATCH\t\t\t\t 104\r\n#define TS_R_NONCE_NOT_RETURNED\t\t\t\t 105\r\n#define TS_R_NO_CONTENT\t\t\t\t\t 106\r\n#define TS_R_NO_TIME_STAMP_TOKEN\t\t\t 107\r\n#define TS_R_PKCS7_ADD_SIGNATURE_ERROR\t\t\t 118\r\n#define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR\t\t 119\r\n#define TS_R_PKCS7_TO_TS_TST_INFO_FAILED\t\t 129\r\n#define TS_R_POLICY_MISMATCH\t\t\t\t 108\r\n#define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE\t 120\r\n#define TS_R_RESPONSE_SETUP_ERROR\t\t\t 121\r\n#define TS_R_SIGNATURE_FAILURE\t\t\t\t 109\r\n#define TS_R_THERE_MUST_BE_ONE_SIGNER\t\t\t 110\r\n#define TS_R_TIME_SYSCALL_ERROR\t\t\t\t 122\r\n#define TS_R_TOKEN_NOT_PRESENT\t\t\t\t 130\r\n#define TS_R_TOKEN_PRESENT\t\t\t\t 131\r\n#define TS_R_TSA_NAME_MISMATCH\t\t\t\t 111\r\n#define TS_R_TSA_UNTRUSTED\t\t\t\t 112\r\n#define TS_R_TST_INFO_SETUP_ERROR\t\t\t 123\r\n#define TS_R_TS_DATASIGN\t\t\t\t 124\r\n#define TS_R_UNACCEPTABLE_POLICY\t\t\t 125\r\n#define TS_R_UNSUPPORTED_MD_ALGORITHM\t\t\t 126\r\n#define TS_R_UNSUPPORTED_VERSION\t\t\t 113\r\n#define TS_R_WRONG_CONTENT_TYPE\t\t\t\t 114\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/txt_db.h",
    "content": "/* crypto/txt_db/txt_db.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_TXT_DB_H\r\n#define HEADER_TXT_DB_H\r\n\r\n#include <openssl/opensslconf.h>\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/stack.h>\r\n#include <openssl/lhash.h>\r\n\r\n#define DB_ERROR_OK\t\t\t0\r\n#define DB_ERROR_MALLOC\t\t\t1\r\n#define DB_ERROR_INDEX_CLASH    \t2\r\n#define DB_ERROR_INDEX_OUT_OF_RANGE\t3\r\n#define DB_ERROR_NO_INDEX\t\t4\r\n#define DB_ERROR_INSERT_INDEX_CLASH    \t5\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef OPENSSL_STRING *OPENSSL_PSTRING;\r\nDECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)\r\n\r\ntypedef struct txt_db_st\r\n\t{\r\n\tint num_fields;\r\n\tSTACK_OF(OPENSSL_PSTRING) *data;\r\n\tLHASH_OF(OPENSSL_STRING) **index;\r\n\tint (**qual)(OPENSSL_STRING *);\r\n\tlong error;\r\n\tlong arg1;\r\n\tlong arg2;\r\n\tOPENSSL_STRING *arg_row;\r\n\t} TXT_DB;\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nTXT_DB *TXT_DB_read(BIO *in, int num);\r\nlong TXT_DB_write(BIO *out, TXT_DB *db);\r\n#else\r\nTXT_DB *TXT_DB_read(char *in, int num);\r\nlong TXT_DB_write(char *out, TXT_DB *db);\r\n#endif\r\nint TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(OPENSSL_STRING *),\r\n\t\t\tLHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);\r\nvoid TXT_DB_free(TXT_DB *db);\r\nOPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value);\r\nint TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ui.h",
    "content": "/* crypto/ui/ui.h -*- mode:C; c-file-style: \"eay\" -*- */\r\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\r\n * project 2001.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_UI_H\r\n#define HEADER_UI_H\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#include <openssl/crypto.h>\r\n#endif\r\n#include <openssl/safestack.h>\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Declared already in ossl_typ.h */\r\n/* typedef struct ui_st UI; */\r\n/* typedef struct ui_method_st UI_METHOD; */\r\n\r\n\r\n/* All the following functions return -1 or NULL on error and in some cases\r\n   (UI_process()) -2 if interrupted or in some other way cancelled.\r\n   When everything is fine, they return 0, a positive value or a non-NULL\r\n   pointer, all depending on their purpose. */\r\n\r\n/* Creators and destructor.   */\r\nUI *UI_new(void);\r\nUI *UI_new_method(const UI_METHOD *method);\r\nvoid UI_free(UI *ui);\r\n\r\n/* The following functions are used to add strings to be printed and prompt\r\n   strings to prompt for data.  The names are UI_{add,dup}_<function>_string\r\n   and UI_{add,dup}_input_boolean.\r\n\r\n   UI_{add,dup}_<function>_string have the following meanings:\r\n\tadd\tadd a text or prompt string.  The pointers given to these\r\n\t\tfunctions are used verbatim, no copying is done.\r\n\tdup\tmake a copy of the text or prompt string, then add the copy\r\n\t\tto the collection of strings in the user interface.\r\n\t<function>\r\n\t\tThe function is a name for the functionality that the given\r\n\t\tstring shall be used for.  It can be one of:\r\n\t\t\tinput\tuse the string as data prompt.\r\n\t\t\tverify\tuse the string as verification prompt.  This\r\n\t\t\t\tis used to verify a previous input.\r\n\t\t\tinfo\tuse the string for informational output.\r\n\t\t\terror\tuse the string for error output.\r\n   Honestly, there's currently no difference between info and error for the\r\n   moment.\r\n\r\n   UI_{add,dup}_input_boolean have the same semantics for \"add\" and \"dup\",\r\n   and are typically used when one wants to prompt for a yes/no response.\r\n\r\n\r\n   All of the functions in this group take a UI and a prompt string.\r\n   The string input and verify addition functions also take a flag argument,\r\n   a buffer for the result to end up with, a minimum input size and a maximum\r\n   input size (the result buffer MUST be large enough to be able to contain\r\n   the maximum number of characters).  Additionally, the verify addition\r\n   functions takes another buffer to compare the result against.\r\n   The boolean input functions take an action description string (which should\r\n   be safe to ignore if the expected user action is obvious, for example with\r\n   a dialog box with an OK button and a Cancel button), a string of acceptable\r\n   characters to mean OK and to mean Cancel.  The two last strings are checked\r\n   to make sure they don't have common characters.  Additionally, the same\r\n   flag argument as for the string input is taken, as well as a result buffer.\r\n   The result buffer is required to be at least one byte long.  Depending on\r\n   the answer, the first character from the OK or the Cancel character strings\r\n   will be stored in the first byte of the result buffer.  No NUL will be\r\n   added, so the result is *not* a string.\r\n\r\n   On success, the all return an index of the added information.  That index\r\n   is usefull when retrieving results with UI_get0_result(). */\r\nint UI_add_input_string(UI *ui, const char *prompt, int flags,\r\n\tchar *result_buf, int minsize, int maxsize);\r\nint UI_dup_input_string(UI *ui, const char *prompt, int flags,\r\n\tchar *result_buf, int minsize, int maxsize);\r\nint UI_add_verify_string(UI *ui, const char *prompt, int flags,\r\n\tchar *result_buf, int minsize, int maxsize, const char *test_buf);\r\nint UI_dup_verify_string(UI *ui, const char *prompt, int flags,\r\n\tchar *result_buf, int minsize, int maxsize, const char *test_buf);\r\nint UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,\r\n\tconst char *ok_chars, const char *cancel_chars,\r\n\tint flags, char *result_buf);\r\nint UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,\r\n\tconst char *ok_chars, const char *cancel_chars,\r\n\tint flags, char *result_buf);\r\nint UI_add_info_string(UI *ui, const char *text);\r\nint UI_dup_info_string(UI *ui, const char *text);\r\nint UI_add_error_string(UI *ui, const char *text);\r\nint UI_dup_error_string(UI *ui, const char *text);\r\n\r\n/* These are the possible flags.  They can be or'ed together. */\r\n/* Use to have echoing of input */\r\n#define UI_INPUT_FLAG_ECHO\t\t0x01\r\n/* Use a default password.  Where that password is found is completely\r\n   up to the application, it might for example be in the user data set\r\n   with UI_add_user_data().  It is not recommended to have more than\r\n   one input in each UI being marked with this flag, or the application\r\n   might get confused. */\r\n#define UI_INPUT_FLAG_DEFAULT_PWD\t0x02\r\n\r\n/* The user of these routines may want to define flags of their own.  The core\r\n   UI won't look at those, but will pass them on to the method routines.  They\r\n   must use higher bits so they don't get confused with the UI bits above.\r\n   UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use.  A good\r\n   example of use is this:\r\n\r\n\t#define MY_UI_FLAG1\t(0x01 << UI_INPUT_FLAG_USER_BASE)\r\n\r\n*/\r\n#define UI_INPUT_FLAG_USER_BASE\t16\r\n\r\n\r\n/* The following function helps construct a prompt.  object_desc is a\r\n   textual short description of the object, for example \"pass phrase\",\r\n   and object_name is the name of the object (might be a card name or\r\n   a file name.\r\n   The returned string shall always be allocated on the heap with\r\n   OPENSSL_malloc(), and need to be free'd with OPENSSL_free().\r\n\r\n   If the ui_method doesn't contain a pointer to a user-defined prompt\r\n   constructor, a default string is built, looking like this:\r\n\r\n\t\"Enter {object_desc} for {object_name}:\"\r\n\r\n   So, if object_desc has the value \"pass phrase\" and object_name has\r\n   the value \"foo.key\", the resulting string is:\r\n\r\n\t\"Enter pass phrase for foo.key:\"\r\n*/\r\nchar *UI_construct_prompt(UI *ui_method,\r\n\tconst char *object_desc, const char *object_name);\r\n\r\n\r\n/* The following function is used to store a pointer to user-specific data.\r\n   Any previous such pointer will be returned and replaced.\r\n\r\n   For callback purposes, this function makes a lot more sense than using\r\n   ex_data, since the latter requires that different parts of OpenSSL or\r\n   applications share the same ex_data index.\r\n\r\n   Note that the UI_OpenSSL() method completely ignores the user data.\r\n   Other methods may not, however.  */\r\nvoid *UI_add_user_data(UI *ui, void *user_data);\r\n/* We need a user data retrieving function as well.  */\r\nvoid *UI_get0_user_data(UI *ui);\r\n\r\n/* Return the result associated with a prompt given with the index i. */\r\nconst char *UI_get0_result(UI *ui, int i);\r\n\r\n/* When all strings have been added, process the whole thing. */\r\nint UI_process(UI *ui);\r\n\r\n/* Give a user interface parametrised control commands.  This can be used to\r\n   send down an integer, a data pointer or a function pointer, as well as\r\n   be used to get information from a UI. */\r\nint UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));\r\n\r\n/* The commands */\r\n/* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the\r\n   OpenSSL error stack before printing any info or added error messages and\r\n   before any prompting. */\r\n#define UI_CTRL_PRINT_ERRORS\t\t1\r\n/* Check if a UI_process() is possible to do again with the same instance of\r\n   a user interface.  This makes UI_ctrl() return 1 if it is redoable, and 0\r\n   if not. */\r\n#define UI_CTRL_IS_REDOABLE\t\t2\r\n\r\n\r\n/* Some methods may use extra data */\r\n#define UI_set_app_data(s,arg)         UI_set_ex_data(s,0,arg)\r\n#define UI_get_app_data(s)             UI_get_ex_data(s,0)\r\nint UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint UI_set_ex_data(UI *r,int idx,void *arg);\r\nvoid *UI_get_ex_data(UI *r, int idx);\r\n\r\n/* Use specific methods instead of the built-in one */\r\nvoid UI_set_default_method(const UI_METHOD *meth);\r\nconst UI_METHOD *UI_get_default_method(void);\r\nconst UI_METHOD *UI_get_method(UI *ui);\r\nconst UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);\r\n\r\n/* The method with all the built-in thingies */\r\nUI_METHOD *UI_OpenSSL(void);\r\n\r\n\r\n/* ---------- For method writers ---------- */\r\n/* A method contains a number of functions that implement the low level\r\n   of the User Interface.  The functions are:\r\n\r\n\tan opener\tThis function starts a session, maybe by opening\r\n\t\t\ta channel to a tty, or by opening a window.\r\n\ta writer\tThis function is called to write a given string,\r\n\t\t\tmaybe to the tty, maybe as a field label in a\r\n\t\t\twindow.\r\n\ta flusher\tThis function is called to flush everything that\r\n\t\t\thas been output so far.  It can be used to actually\r\n\t\t\tdisplay a dialog box after it has been built.\r\n\ta reader\tThis function is called to read a given prompt,\r\n\t\t\tmaybe from the tty, maybe from a field in a\r\n\t\t\twindow.  Note that it's called wth all string\r\n\t\t\tstructures, not only the prompt ones, so it must\r\n\t\t\tcheck such things itself.\r\n\ta closer\tThis function closes the session, maybe by closing\r\n\t\t\tthe channel to the tty, or closing the window.\r\n\r\n   All these functions are expected to return:\r\n\r\n\t0\ton error.\r\n\t1\ton success.\r\n\t-1\ton out-of-band events, for example if some prompting has\r\n\t\tbeen canceled (by pressing Ctrl-C, for example).  This is\r\n\t\tonly checked when returned by the flusher or the reader.\r\n\r\n   The way this is used, the opener is first called, then the writer for all\r\n   strings, then the flusher, then the reader for all strings and finally the\r\n   closer.  Note that if you want to prompt from a terminal or other command\r\n   line interface, the best is to have the reader also write the prompts\r\n   instead of having the writer do it.  If you want to prompt from a dialog\r\n   box, the writer can be used to build up the contents of the box, and the\r\n   flusher to actually display the box and run the event loop until all data\r\n   has been given, after which the reader only grabs the given data and puts\r\n   them back into the UI strings.\r\n\r\n   All method functions take a UI as argument.  Additionally, the writer and\r\n   the reader take a UI_STRING.\r\n*/\r\n\r\n/* The UI_STRING type is the data structure that contains all the needed info\r\n   about a string or a prompt, including test data for a verification prompt.\r\n*/\r\ntypedef struct ui_string_st UI_STRING;\r\nDECLARE_STACK_OF(UI_STRING)\r\n\r\n/* The different types of strings that are currently supported.\r\n   This is only needed by method authors. */\r\nenum UI_string_types\r\n\t{\r\n\tUIT_NONE=0,\r\n\tUIT_PROMPT,\t\t/* Prompt for a string */\r\n\tUIT_VERIFY,\t\t/* Prompt for a string and verify */\r\n\tUIT_BOOLEAN,\t\t/* Prompt for a yes/no response */\r\n\tUIT_INFO,\t\t/* Send info to the user */\r\n\tUIT_ERROR\t\t/* Send an error message to the user */\r\n\t};\r\n\r\n/* Create and manipulate methods */\r\nUI_METHOD *UI_create_method(char *name);\r\nvoid UI_destroy_method(UI_METHOD *ui_method);\r\nint UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui));\r\nint UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis));\r\nint UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui));\r\nint UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis));\r\nint UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui));\r\nint UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor)(UI* ui, const char* object_desc, const char* object_name));\r\nint (*UI_method_get_opener(UI_METHOD *method))(UI*);\r\nint (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*);\r\nint (*UI_method_get_flusher(UI_METHOD *method))(UI*);\r\nint (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*);\r\nint (*UI_method_get_closer(UI_METHOD *method))(UI*);\r\nchar * (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*);\r\n\r\n/* The following functions are helpers for method writers to access relevant\r\n   data from a UI_STRING. */\r\n\r\n/* Return type of the UI_STRING */\r\nenum UI_string_types UI_get_string_type(UI_STRING *uis);\r\n/* Return input flags of the UI_STRING */\r\nint UI_get_input_flags(UI_STRING *uis);\r\n/* Return the actual string to output (the prompt, info or error) */\r\nconst char *UI_get0_output_string(UI_STRING *uis);\r\n/* Return the optional action string to output (the boolean promtp instruction) */\r\nconst char *UI_get0_action_string(UI_STRING *uis);\r\n/* Return the result of a prompt */\r\nconst char *UI_get0_result_string(UI_STRING *uis);\r\n/* Return the string to test the result against.  Only useful with verifies. */\r\nconst char *UI_get0_test_string(UI_STRING *uis);\r\n/* Return the required minimum size of the result */\r\nint UI_get_result_minsize(UI_STRING *uis);\r\n/* Return the required maximum size of the result */\r\nint UI_get_result_maxsize(UI_STRING *uis);\r\n/* Set the result of a UI_STRING. */\r\nint UI_set_result(UI *ui, UI_STRING *uis, const char *result);\r\n\r\n\r\n/* A couple of popular utility functions */\r\nint UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify);\r\nint UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);\r\n\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_UI_strings(void);\r\n\r\n/* Error codes for the UI functions. */\r\n\r\n/* Function codes. */\r\n#define UI_F_GENERAL_ALLOCATE_BOOLEAN\t\t\t 108\r\n#define UI_F_GENERAL_ALLOCATE_PROMPT\t\t\t 109\r\n#define UI_F_GENERAL_ALLOCATE_STRING\t\t\t 100\r\n#define UI_F_UI_CTRL\t\t\t\t\t 111\r\n#define UI_F_UI_DUP_ERROR_STRING\t\t\t 101\r\n#define UI_F_UI_DUP_INFO_STRING\t\t\t\t 102\r\n#define UI_F_UI_DUP_INPUT_BOOLEAN\t\t\t 110\r\n#define UI_F_UI_DUP_INPUT_STRING\t\t\t 103\r\n#define UI_F_UI_DUP_VERIFY_STRING\t\t\t 106\r\n#define UI_F_UI_GET0_RESULT\t\t\t\t 107\r\n#define UI_F_UI_NEW_METHOD\t\t\t\t 104\r\n#define UI_F_UI_SET_RESULT\t\t\t\t 105\r\n\r\n/* Reason codes. */\r\n#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS\t\t 104\r\n#define UI_R_INDEX_TOO_LARGE\t\t\t\t 102\r\n#define UI_R_INDEX_TOO_SMALL\t\t\t\t 103\r\n#define UI_R_NO_RESULT_BUFFER\t\t\t\t 105\r\n#define UI_R_RESULT_TOO_LARGE\t\t\t\t 100\r\n#define UI_R_RESULT_TOO_SMALL\t\t\t\t 101\r\n#define UI_R_UNKNOWN_CONTROL_COMMAND\t\t\t 106\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/ui_compat.h",
    "content": "/* crypto/ui/ui.h -*- mode:C; c-file-style: \"eay\" -*- */\r\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\r\n * project 2001.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    openssl-core@openssl.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n\r\n#ifndef HEADER_UI_COMPAT_H\r\n#define HEADER_UI_COMPAT_H\r\n\r\n#include <openssl/opensslconf.h>\r\n#include <openssl/ui.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* The following functions were previously part of the DES section,\r\n   and are provided here for backward compatibility reasons. */\r\n\r\n#define des_read_pw_string(b,l,p,v) \\\r\n\t_ossl_old_des_read_pw_string((b),(l),(p),(v))\r\n#define des_read_pw(b,bf,s,p,v) \\\r\n\t_ossl_old_des_read_pw((b),(bf),(s),(p),(v))\r\n\r\nint _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify);\r\nint _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/whrlpool.h",
    "content": "#ifndef HEADER_WHRLPOOL_H\r\n#define HEADER_WHRLPOOL_H\r\n\r\n#include <openssl/e_os2.h>\r\n#include <stddef.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define WHIRLPOOL_DIGEST_LENGTH\t(512/8)\r\n#define WHIRLPOOL_BBLOCK\t512\r\n#define WHIRLPOOL_COUNTER\t(256/8)\r\n\r\ntypedef struct\t{\r\n\tunion\t{\r\n\t\tunsigned char\tc[WHIRLPOOL_DIGEST_LENGTH];\r\n\t\t/* double q is here to ensure 64-bit alignment */\r\n\t\tdouble\t\tq[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)];\r\n\t\t}\tH;\r\n\tunsigned char\tdata[WHIRLPOOL_BBLOCK/8];\r\n\tunsigned int\tbitoff;\r\n\tsize_t\t\tbitlen[WHIRLPOOL_COUNTER/sizeof(size_t)];\r\n\t} WHIRLPOOL_CTX;\r\n\r\n#ifndef OPENSSL_NO_WHIRLPOOL\r\n#ifdef OPENSSL_FIPS\r\nint private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c);\r\n#endif\r\nint WHIRLPOOL_Init\t(WHIRLPOOL_CTX *c);\r\nint WHIRLPOOL_Update\t(WHIRLPOOL_CTX *c,const void *inp,size_t bytes);\r\nvoid WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits);\r\nint WHIRLPOOL_Final\t(unsigned char *md,WHIRLPOOL_CTX *c);\r\nunsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md);\r\n#endif\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/x509.h",
    "content": "/* crypto/x509/x509.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n/* ====================================================================\r\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r\n * ECDH support in OpenSSL originally developed by \r\n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\r\n */\r\n\r\n#ifndef HEADER_X509_H\r\n#define HEADER_X509_H\r\n\r\n#include <openssl/e_os2.h>\r\n#include <openssl/symhacks.h>\r\n#ifndef OPENSSL_NO_BUFFER\r\n#include <openssl/buffer.h>\r\n#endif\r\n#ifndef OPENSSL_NO_EVP\r\n#include <openssl/evp.h>\r\n#endif\r\n#ifndef OPENSSL_NO_BIO\r\n#include <openssl/bio.h>\r\n#endif\r\n#include <openssl/stack.h>\r\n#include <openssl/asn1.h>\r\n#include <openssl/safestack.h>\r\n\r\n#ifndef OPENSSL_NO_EC\r\n#include <openssl/ec.h>\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_ECDSA\r\n#include <openssl/ecdsa.h>\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_ECDH\r\n#include <openssl/ecdh.h>\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_DEPRECATED\r\n#ifndef OPENSSL_NO_RSA\r\n#include <openssl/rsa.h>\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\n#include <openssl/dsa.h>\r\n#endif\r\n#ifndef OPENSSL_NO_DH\r\n#include <openssl/dh.h>\r\n#endif\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_SHA\r\n#include <openssl/sha.h>\r\n#endif\r\n#include <openssl/ossl_typ.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef OPENSSL_SYS_WIN32\r\n/* Under Win32 these are defined in wincrypt.h */\r\n#undef X509_NAME\r\n#undef X509_CERT_PAIR\r\n#undef X509_EXTENSIONS\r\n#endif\r\n\r\n#define X509_FILETYPE_PEM\t1\r\n#define X509_FILETYPE_ASN1\t2\r\n#define X509_FILETYPE_DEFAULT\t3\r\n\r\n#define X509v3_KU_DIGITAL_SIGNATURE\t0x0080\r\n#define X509v3_KU_NON_REPUDIATION\t0x0040\r\n#define X509v3_KU_KEY_ENCIPHERMENT\t0x0020\r\n#define X509v3_KU_DATA_ENCIPHERMENT\t0x0010\r\n#define X509v3_KU_KEY_AGREEMENT\t\t0x0008\r\n#define X509v3_KU_KEY_CERT_SIGN\t\t0x0004\r\n#define X509v3_KU_CRL_SIGN\t\t0x0002\r\n#define X509v3_KU_ENCIPHER_ONLY\t\t0x0001\r\n#define X509v3_KU_DECIPHER_ONLY\t\t0x8000\r\n#define X509v3_KU_UNDEF\t\t\t0xffff\r\n\r\ntypedef struct X509_objects_st\r\n\t{\r\n\tint nid;\r\n\tint (*a2i)(void);\r\n\tint (*i2a)(void);\r\n\t} X509_OBJECTS;\r\n\r\nstruct X509_algor_st\r\n\t{\r\n\tASN1_OBJECT *algorithm;\r\n\tASN1_TYPE *parameter;\r\n\t} /* X509_ALGOR */;\r\n\r\nDECLARE_ASN1_SET_OF(X509_ALGOR)\r\n\r\ntypedef STACK_OF(X509_ALGOR) X509_ALGORS;\r\n\r\ntypedef struct X509_val_st\r\n\t{\r\n\tASN1_TIME *notBefore;\r\n\tASN1_TIME *notAfter;\r\n\t} X509_VAL;\r\n\r\nstruct X509_pubkey_st\r\n\t{\r\n\tX509_ALGOR *algor;\r\n\tASN1_BIT_STRING *public_key;\r\n\tEVP_PKEY *pkey;\r\n\t};\r\n\r\ntypedef struct X509_sig_st\r\n\t{\r\n\tX509_ALGOR *algor;\r\n\tASN1_OCTET_STRING *digest;\r\n\t} X509_SIG;\r\n\r\ntypedef struct X509_name_entry_st\r\n\t{\r\n\tASN1_OBJECT *object;\r\n\tASN1_STRING *value;\r\n\tint set;\r\n\tint size; \t/* temp variable */\r\n\t} X509_NAME_ENTRY;\r\n\r\nDECLARE_STACK_OF(X509_NAME_ENTRY)\r\nDECLARE_ASN1_SET_OF(X509_NAME_ENTRY)\r\n\r\n/* we always keep X509_NAMEs in 2 forms. */\r\nstruct X509_name_st\r\n\t{\r\n\tSTACK_OF(X509_NAME_ENTRY) *entries;\r\n\tint modified;\t/* true if 'bytes' needs to be built */\r\n#ifndef OPENSSL_NO_BUFFER\r\n\tBUF_MEM *bytes;\r\n#else\r\n\tchar *bytes;\r\n#endif\r\n/*\tunsigned long hash; Keep the hash around for lookups */\r\n\tunsigned char *canon_enc;\r\n\tint canon_enclen;\r\n\t} /* X509_NAME */;\r\n\r\nDECLARE_STACK_OF(X509_NAME)\r\n\r\n#define X509_EX_V_NETSCAPE_HACK\t\t0x8000\r\n#define X509_EX_V_INIT\t\t\t0x0001\r\ntypedef struct X509_extension_st\r\n\t{\r\n\tASN1_OBJECT *object;\r\n\tASN1_BOOLEAN critical;\r\n\tASN1_OCTET_STRING *value;\r\n\t} X509_EXTENSION;\r\n\r\ntypedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;\r\n\r\nDECLARE_STACK_OF(X509_EXTENSION)\r\nDECLARE_ASN1_SET_OF(X509_EXTENSION)\r\n\r\n/* a sequence of these are used */\r\ntypedef struct x509_attributes_st\r\n\t{\r\n\tASN1_OBJECT *object;\r\n\tint single; /* 0 for a set, 1 for a single item (which is wrong) */\r\n\tunion\t{\r\n\t\tchar\t\t*ptr;\r\n/* 0 */\t\tSTACK_OF(ASN1_TYPE) *set;\r\n/* 1 */\t\tASN1_TYPE\t*single;\r\n\t\t} value;\r\n\t} X509_ATTRIBUTE;\r\n\r\nDECLARE_STACK_OF(X509_ATTRIBUTE)\r\nDECLARE_ASN1_SET_OF(X509_ATTRIBUTE)\r\n\r\n\r\ntypedef struct X509_req_info_st\r\n\t{\r\n\tASN1_ENCODING enc;\r\n\tASN1_INTEGER *version;\r\n\tX509_NAME *subject;\r\n\tX509_PUBKEY *pubkey;\r\n\t/*  d=2 hl=2 l=  0 cons: cont: 00 */\r\n\tSTACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */\r\n\t} X509_REQ_INFO;\r\n\r\ntypedef struct X509_req_st\r\n\t{\r\n\tX509_REQ_INFO *req_info;\r\n\tX509_ALGOR *sig_alg;\r\n\tASN1_BIT_STRING *signature;\r\n\tint references;\r\n\t} X509_REQ;\r\n\r\ntypedef struct x509_cinf_st\r\n\t{\r\n\tASN1_INTEGER *version;\t\t/* [ 0 ] default of v1 */\r\n\tASN1_INTEGER *serialNumber;\r\n\tX509_ALGOR *signature;\r\n\tX509_NAME *issuer;\r\n\tX509_VAL *validity;\r\n\tX509_NAME *subject;\r\n\tX509_PUBKEY *key;\r\n\tASN1_BIT_STRING *issuerUID;\t\t/* [ 1 ] optional in v2 */\r\n\tASN1_BIT_STRING *subjectUID;\t\t/* [ 2 ] optional in v2 */\r\n\tSTACK_OF(X509_EXTENSION) *extensions;\t/* [ 3 ] optional in v3 */\r\n\tASN1_ENCODING enc;\r\n\t} X509_CINF;\r\n\r\n/* This stuff is certificate \"auxiliary info\"\r\n * it contains details which are useful in certificate\r\n * stores and databases. When used this is tagged onto\r\n * the end of the certificate itself\r\n */\r\n\r\ntypedef struct x509_cert_aux_st\r\n\t{\r\n\tSTACK_OF(ASN1_OBJECT) *trust;\t\t/* trusted uses */\r\n\tSTACK_OF(ASN1_OBJECT) *reject;\t\t/* rejected uses */\r\n\tASN1_UTF8STRING *alias;\t\t\t/* \"friendly name\" */\r\n\tASN1_OCTET_STRING *keyid;\t\t/* key id of private key */\r\n\tSTACK_OF(X509_ALGOR) *other;\t\t/* other unspecified info */\r\n\t} X509_CERT_AUX;\r\n\r\nstruct x509_st\r\n\t{\r\n\tX509_CINF *cert_info;\r\n\tX509_ALGOR *sig_alg;\r\n\tASN1_BIT_STRING *signature;\r\n\tint valid;\r\n\tint references;\r\n\tchar *name;\r\n\tCRYPTO_EX_DATA ex_data;\r\n\t/* These contain copies of various extension values */\r\n\tlong ex_pathlen;\r\n\tlong ex_pcpathlen;\r\n\tunsigned long ex_flags;\r\n\tunsigned long ex_kusage;\r\n\tunsigned long ex_xkusage;\r\n\tunsigned long ex_nscert;\r\n\tASN1_OCTET_STRING *skid;\r\n\tAUTHORITY_KEYID *akid;\r\n\tX509_POLICY_CACHE *policy_cache;\r\n\tSTACK_OF(DIST_POINT) *crldp;\r\n\tSTACK_OF(GENERAL_NAME) *altname;\r\n\tNAME_CONSTRAINTS *nc;\r\n#ifndef OPENSSL_NO_RFC3779\r\n\tSTACK_OF(IPAddressFamily) *rfc3779_addr;\r\n\tstruct ASIdentifiers_st *rfc3779_asid;\r\n#endif\r\n#ifndef OPENSSL_NO_SHA\r\n\tunsigned char sha1_hash[SHA_DIGEST_LENGTH];\r\n#endif\r\n\tX509_CERT_AUX *aux;\r\n\t} /* X509 */;\r\n\r\nDECLARE_STACK_OF(X509)\r\nDECLARE_ASN1_SET_OF(X509)\r\n\r\n/* This is used for a table of trust checking functions */\r\n\r\ntypedef struct x509_trust_st {\r\n\tint trust;\r\n\tint flags;\r\n\tint (*check_trust)(struct x509_trust_st *, X509 *, int);\r\n\tchar *name;\r\n\tint arg1;\r\n\tvoid *arg2;\r\n} X509_TRUST;\r\n\r\nDECLARE_STACK_OF(X509_TRUST)\r\n\r\ntypedef struct x509_cert_pair_st {\r\n\tX509 *forward;\r\n\tX509 *reverse;\r\n} X509_CERT_PAIR;\r\n\r\n/* standard trust ids */\r\n\r\n#define X509_TRUST_DEFAULT\t-1\t/* Only valid in purpose settings */\r\n\r\n#define X509_TRUST_COMPAT\t1\r\n#define X509_TRUST_SSL_CLIENT\t2\r\n#define X509_TRUST_SSL_SERVER\t3\r\n#define X509_TRUST_EMAIL\t4\r\n#define X509_TRUST_OBJECT_SIGN\t5\r\n#define X509_TRUST_OCSP_SIGN\t6\r\n#define X509_TRUST_OCSP_REQUEST\t7\r\n#define X509_TRUST_TSA\t\t8\r\n\r\n/* Keep these up to date! */\r\n#define X509_TRUST_MIN\t\t1\r\n#define X509_TRUST_MAX\t\t8\r\n\r\n\r\n/* trust_flags values */\r\n#define\tX509_TRUST_DYNAMIC \t1\r\n#define\tX509_TRUST_DYNAMIC_NAME\t2\r\n\r\n/* check_trust return codes */\r\n\r\n#define X509_TRUST_TRUSTED\t1\r\n#define X509_TRUST_REJECTED\t2\r\n#define X509_TRUST_UNTRUSTED\t3\r\n\r\n/* Flags for X509_print_ex() */\r\n\r\n#define\tX509_FLAG_COMPAT\t\t0\r\n#define\tX509_FLAG_NO_HEADER\t\t1L\r\n#define\tX509_FLAG_NO_VERSION\t\t(1L << 1)\r\n#define\tX509_FLAG_NO_SERIAL\t\t(1L << 2)\r\n#define\tX509_FLAG_NO_SIGNAME\t\t(1L << 3)\r\n#define\tX509_FLAG_NO_ISSUER\t\t(1L << 4)\r\n#define\tX509_FLAG_NO_VALIDITY\t\t(1L << 5)\r\n#define\tX509_FLAG_NO_SUBJECT\t\t(1L << 6)\r\n#define\tX509_FLAG_NO_PUBKEY\t\t(1L << 7)\r\n#define\tX509_FLAG_NO_EXTENSIONS\t\t(1L << 8)\r\n#define\tX509_FLAG_NO_SIGDUMP\t\t(1L << 9)\r\n#define\tX509_FLAG_NO_AUX\t\t(1L << 10)\r\n#define\tX509_FLAG_NO_ATTRIBUTES\t\t(1L << 11)\r\n\r\n/* Flags specific to X509_NAME_print_ex() */\t\r\n\r\n/* The field separator information */\r\n\r\n#define XN_FLAG_SEP_MASK\t(0xf << 16)\r\n\r\n#define XN_FLAG_COMPAT\t\t0\t\t/* Traditional SSLeay: use old X509_NAME_print */\r\n#define XN_FLAG_SEP_COMMA_PLUS\t(1 << 16)\t/* RFC2253 ,+ */\r\n#define XN_FLAG_SEP_CPLUS_SPC\t(2 << 16)\t/* ,+ spaced: more readable */\r\n#define XN_FLAG_SEP_SPLUS_SPC\t(3 << 16)\t/* ;+ spaced */\r\n#define XN_FLAG_SEP_MULTILINE\t(4 << 16)\t/* One line per field */\r\n\r\n#define XN_FLAG_DN_REV\t\t(1 << 20)\t/* Reverse DN order */\r\n\r\n/* How the field name is shown */\r\n\r\n#define XN_FLAG_FN_MASK\t\t(0x3 << 21)\r\n\r\n#define XN_FLAG_FN_SN\t\t0\t\t/* Object short name */\r\n#define XN_FLAG_FN_LN\t\t(1 << 21)\t/* Object long name */\r\n#define XN_FLAG_FN_OID\t\t(2 << 21)\t/* Always use OIDs */\r\n#define XN_FLAG_FN_NONE\t\t(3 << 21)\t/* No field names */\r\n\r\n#define XN_FLAG_SPC_EQ\t\t(1 << 23)\t/* Put spaces round '=' */\r\n\r\n/* This determines if we dump fields we don't recognise:\r\n * RFC2253 requires this.\r\n */\r\n\r\n#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)\r\n\r\n#define XN_FLAG_FN_ALIGN\t(1 << 25)\t/* Align field names to 20 characters */\r\n\r\n/* Complete set of RFC2253 flags */\r\n\r\n#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \\\r\n\t\t\tXN_FLAG_SEP_COMMA_PLUS | \\\r\n\t\t\tXN_FLAG_DN_REV | \\\r\n\t\t\tXN_FLAG_FN_SN | \\\r\n\t\t\tXN_FLAG_DUMP_UNKNOWN_FIELDS)\r\n\r\n/* readable oneline form */\r\n\r\n#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \\\r\n\t\t\tASN1_STRFLGS_ESC_QUOTE | \\\r\n\t\t\tXN_FLAG_SEP_CPLUS_SPC | \\\r\n\t\t\tXN_FLAG_SPC_EQ | \\\r\n\t\t\tXN_FLAG_FN_SN)\r\n\r\n/* readable multiline form */\r\n\r\n#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \\\r\n\t\t\tASN1_STRFLGS_ESC_MSB | \\\r\n\t\t\tXN_FLAG_SEP_MULTILINE | \\\r\n\t\t\tXN_FLAG_SPC_EQ | \\\r\n\t\t\tXN_FLAG_FN_LN | \\\r\n\t\t\tXN_FLAG_FN_ALIGN)\r\n\r\nstruct x509_revoked_st\r\n\t{\r\n\tASN1_INTEGER *serialNumber;\r\n\tASN1_TIME *revocationDate;\r\n\tSTACK_OF(X509_EXTENSION) /* optional */ *extensions;\r\n\t/* Set up if indirect CRL */\r\n\tSTACK_OF(GENERAL_NAME) *issuer;\r\n\t/* Revocation reason */\r\n\tint reason;\r\n\tint sequence; /* load sequence */\r\n\t};\r\n\r\nDECLARE_STACK_OF(X509_REVOKED)\r\nDECLARE_ASN1_SET_OF(X509_REVOKED)\r\n\r\ntypedef struct X509_crl_info_st\r\n\t{\r\n\tASN1_INTEGER *version;\r\n\tX509_ALGOR *sig_alg;\r\n\tX509_NAME *issuer;\r\n\tASN1_TIME *lastUpdate;\r\n\tASN1_TIME *nextUpdate;\r\n\tSTACK_OF(X509_REVOKED) *revoked;\r\n\tSTACK_OF(X509_EXTENSION) /* [0] */ *extensions;\r\n\tASN1_ENCODING enc;\r\n\t} X509_CRL_INFO;\r\n\r\nstruct X509_crl_st\r\n\t{\r\n\t/* actual signature */\r\n\tX509_CRL_INFO *crl;\r\n\tX509_ALGOR *sig_alg;\r\n\tASN1_BIT_STRING *signature;\r\n\tint references;\r\n\tint flags;\r\n\t/* Copies of various extensions */\r\n\tAUTHORITY_KEYID *akid;\r\n\tISSUING_DIST_POINT *idp;\r\n\t/* Convenient breakdown of IDP */\r\n\tint idp_flags;\r\n\tint idp_reasons;\r\n\t/* CRL and base CRL numbers for delta processing */\r\n\tASN1_INTEGER *crl_number;\r\n\tASN1_INTEGER *base_crl_number;\r\n#ifndef OPENSSL_NO_SHA\r\n\tunsigned char sha1_hash[SHA_DIGEST_LENGTH];\r\n#endif\r\n\tSTACK_OF(GENERAL_NAMES) *issuers;\r\n\tconst X509_CRL_METHOD *meth;\r\n\tvoid *meth_data;\r\n\t} /* X509_CRL */;\r\n\r\nDECLARE_STACK_OF(X509_CRL)\r\nDECLARE_ASN1_SET_OF(X509_CRL)\r\n\r\ntypedef struct private_key_st\r\n\t{\r\n\tint version;\r\n\t/* The PKCS#8 data types */\r\n\tX509_ALGOR *enc_algor;\r\n\tASN1_OCTET_STRING *enc_pkey;\t/* encrypted pub key */\r\n\r\n\t/* When decrypted, the following will not be NULL */\r\n\tEVP_PKEY *dec_pkey;\r\n\r\n\t/* used to encrypt and decrypt */\r\n\tint key_length;\r\n\tchar *key_data;\r\n\tint key_free;\t/* true if we should auto free key_data */\r\n\r\n\t/* expanded version of 'enc_algor' */\r\n\tEVP_CIPHER_INFO cipher;\r\n\r\n\tint references;\r\n\t} X509_PKEY;\r\n\r\n#ifndef OPENSSL_NO_EVP\r\ntypedef struct X509_info_st\r\n\t{\r\n\tX509 *x509;\r\n\tX509_CRL *crl;\r\n\tX509_PKEY *x_pkey;\r\n\r\n\tEVP_CIPHER_INFO enc_cipher;\r\n\tint enc_len;\r\n\tchar *enc_data;\r\n\r\n\tint references;\r\n\t} X509_INFO;\r\n\r\nDECLARE_STACK_OF(X509_INFO)\r\n#endif\r\n\r\n/* The next 2 structures and their 8 routines were sent to me by\r\n * Pat Richard <patr@x509.com> and are used to manipulate\r\n * Netscapes spki structures - useful if you are writing a CA web page\r\n */\r\ntypedef struct Netscape_spkac_st\r\n\t{\r\n\tX509_PUBKEY *pubkey;\r\n\tASN1_IA5STRING *challenge;\t/* challenge sent in atlas >= PR2 */\r\n\t} NETSCAPE_SPKAC;\r\n\r\ntypedef struct Netscape_spki_st\r\n\t{\r\n\tNETSCAPE_SPKAC *spkac;\t/* signed public key and challenge */\r\n\tX509_ALGOR *sig_algor;\r\n\tASN1_BIT_STRING *signature;\r\n\t} NETSCAPE_SPKI;\r\n\r\n/* Netscape certificate sequence structure */\r\ntypedef struct Netscape_certificate_sequence\r\n\t{\r\n\tASN1_OBJECT *type;\r\n\tSTACK_OF(X509) *certs;\r\n\t} NETSCAPE_CERT_SEQUENCE;\r\n\r\n/* Unused (and iv length is wrong)\r\ntypedef struct CBCParameter_st\r\n\t{\r\n\tunsigned char iv[8];\r\n\t} CBC_PARAM;\r\n*/\r\n\r\n/* Password based encryption structure */\r\n\r\ntypedef struct PBEPARAM_st {\r\nASN1_OCTET_STRING *salt;\r\nASN1_INTEGER *iter;\r\n} PBEPARAM;\r\n\r\n/* Password based encryption V2 structures */\r\n\r\ntypedef struct PBE2PARAM_st {\r\nX509_ALGOR *keyfunc;\r\nX509_ALGOR *encryption;\r\n} PBE2PARAM;\r\n\r\ntypedef struct PBKDF2PARAM_st {\r\nASN1_TYPE *salt;\t/* Usually OCTET STRING but could be anything */\r\nASN1_INTEGER *iter;\r\nASN1_INTEGER *keylength;\r\nX509_ALGOR *prf;\r\n} PBKDF2PARAM;\r\n\r\n\r\n/* PKCS#8 private key info structure */\r\n\r\nstruct pkcs8_priv_key_info_st\r\n        {\r\n        int broken;     /* Flag for various broken formats */\r\n#define PKCS8_OK\t\t0\r\n#define PKCS8_NO_OCTET\t\t1\r\n#define PKCS8_EMBEDDED_PARAM\t2\r\n#define PKCS8_NS_DB\t\t3\r\n#define PKCS8_NEG_PRIVKEY\t4\r\n        ASN1_INTEGER *version;\r\n        X509_ALGOR *pkeyalg;\r\n        ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */\r\n        STACK_OF(X509_ATTRIBUTE) *attributes;\r\n        };\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#include <openssl/x509_vfy.h>\r\n#include <openssl/pkcs7.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define X509_EXT_PACK_UNKNOWN\t1\r\n#define X509_EXT_PACK_STRING\t2\r\n\r\n#define\t\tX509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)\r\n/* #define\tX509_get_serialNumber(x) ((x)->cert_info->serialNumber) */\r\n#define\t\tX509_get_notBefore(x) ((x)->cert_info->validity->notBefore)\r\n#define\t\tX509_get_notAfter(x) ((x)->cert_info->validity->notAfter)\r\n#define\t\tX509_extract_key(x)\tX509_get_pubkey(x) /*****/\r\n#define\t\tX509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)\r\n#define\t\tX509_REQ_get_subject_name(x) ((x)->req_info->subject)\r\n#define\t\tX509_REQ_extract_key(a)\tX509_REQ_get_pubkey(a)\r\n#define\t\tX509_name_cmp(a,b)\tX509_NAME_cmp((a),(b))\r\n#define\t\tX509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))\r\n\r\n#define\t\tX509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)\r\n#define \tX509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)\r\n#define \tX509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)\r\n#define\t\tX509_CRL_get_issuer(x) ((x)->crl->issuer)\r\n#define\t\tX509_CRL_get_REVOKED(x) ((x)->crl->revoked)\r\n\r\nvoid X509_CRL_set_default_method(const X509_CRL_METHOD *meth);\r\nX509_CRL_METHOD *X509_CRL_METHOD_new(\r\n\tint (*crl_init)(X509_CRL *crl),\r\n\tint (*crl_free)(X509_CRL *crl),\r\n\tint (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,\r\n\t\t\t\tASN1_INTEGER *ser, X509_NAME *issuer),\r\n\tint (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk));\r\nvoid X509_CRL_METHOD_free(X509_CRL_METHOD *m);\r\n\r\nvoid X509_CRL_set_meth_data(X509_CRL *crl, void *dat);\r\nvoid *X509_CRL_get_meth_data(X509_CRL *crl);\r\n\r\n/* This one is only used so that a binary form can output, as in\r\n * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */\r\n#define \tX509_get_X509_PUBKEY(x) ((x)->cert_info->key)\r\n\r\n\r\nconst char *X509_verify_cert_error_string(long n);\r\n\r\n#ifndef OPENSSL_NO_EVP\r\nint X509_verify(X509 *a, EVP_PKEY *r);\r\n\r\nint X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);\r\nint X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);\r\nint NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);\r\n\r\nNETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len);\r\nchar * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);\r\nEVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);\r\nint NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);\r\n\r\nint NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);\r\n\r\nint X509_signature_dump(BIO *bp,const ASN1_STRING *sig, int indent);\r\nint X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig);\r\n\r\nint X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);\r\nint X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);\r\nint X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);\r\nint X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);\r\nint X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);\r\nint X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);\r\nint NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);\r\n\r\nint X509_pubkey_digest(const X509 *data,const EVP_MD *type,\r\n\t\tunsigned char *md, unsigned int *len);\r\nint X509_digest(const X509 *data,const EVP_MD *type,\r\n\t\tunsigned char *md, unsigned int *len);\r\nint X509_CRL_digest(const X509_CRL *data,const EVP_MD *type,\r\n\t\tunsigned char *md, unsigned int *len);\r\nint X509_REQ_digest(const X509_REQ *data,const EVP_MD *type,\r\n\t\tunsigned char *md, unsigned int *len);\r\nint X509_NAME_digest(const X509_NAME *data,const EVP_MD *type,\r\n\t\tunsigned char *md, unsigned int *len);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_FP_API\r\nX509 *d2i_X509_fp(FILE *fp, X509 **x509);\r\nint i2d_X509_fp(FILE *fp,X509 *x509);\r\nX509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl);\r\nint i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl);\r\nX509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req);\r\nint i2d_X509_REQ_fp(FILE *fp,X509_REQ *req);\r\n#ifndef OPENSSL_NO_RSA\r\nRSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa);\r\nint i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa);\r\nRSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa);\r\nint i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa);\r\nRSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa);\r\nint i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa);\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\nDSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);\r\nint i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);\r\nDSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);\r\nint i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);\r\n#endif\r\n#ifndef OPENSSL_NO_EC\r\nEC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);\r\nint   i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);\r\nEC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);\r\nint   i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);\r\n#endif\r\nX509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8);\r\nint i2d_PKCS8_fp(FILE *fp,X509_SIG *p8);\r\nPKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,\r\n\t\t\t\t\t\tPKCS8_PRIV_KEY_INFO **p8inf);\r\nint i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf);\r\nint i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);\r\nint i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);\r\nEVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);\r\nint i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);\r\nEVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nX509 *d2i_X509_bio(BIO *bp,X509 **x509);\r\nint i2d_X509_bio(BIO *bp,X509 *x509);\r\nX509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl);\r\nint i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl);\r\nX509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req);\r\nint i2d_X509_REQ_bio(BIO *bp,X509_REQ *req);\r\n#ifndef OPENSSL_NO_RSA\r\nRSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa);\r\nint i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa);\r\nRSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa);\r\nint i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa);\r\nRSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa);\r\nint i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa);\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\nDSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);\r\nint i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);\r\nDSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);\r\nint i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);\r\n#endif\r\n#ifndef OPENSSL_NO_EC\r\nEC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);\r\nint   i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);\r\nEC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);\r\nint   i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);\r\n#endif\r\nX509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8);\r\nint i2d_PKCS8_bio(BIO *bp,X509_SIG *p8);\r\nPKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,\r\n\t\t\t\t\t\tPKCS8_PRIV_KEY_INFO **p8inf);\r\nint i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf);\r\nint i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);\r\nint i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);\r\nEVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);\r\nint i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);\r\nEVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);\r\n#endif\r\n\r\nX509 *X509_dup(X509 *x509);\r\nX509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa);\r\nX509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);\r\nX509_CRL *X509_CRL_dup(X509_CRL *crl);\r\nX509_REQ *X509_REQ_dup(X509_REQ *req);\r\nX509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);\r\nint X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);\r\nvoid X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,\r\n\t\t\t\t\t\tX509_ALGOR *algor);\r\nvoid X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);\r\n\r\nX509_NAME *X509_NAME_dup(X509_NAME *xn);\r\nX509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);\r\n\r\nint\t\tX509_cmp_time(const ASN1_TIME *s, time_t *t);\r\nint\t\tX509_cmp_current_time(const ASN1_TIME *s);\r\nASN1_TIME *\tX509_time_adj(ASN1_TIME *s, long adj, time_t *t);\r\nASN1_TIME *\tX509_time_adj_ex(ASN1_TIME *s,\r\n\t\t\t\tint offset_day, long offset_sec, time_t *t);\r\nASN1_TIME *\tX509_gmtime_adj(ASN1_TIME *s, long adj);\r\n\r\nconst char *\tX509_get_default_cert_area(void );\r\nconst char *\tX509_get_default_cert_dir(void );\r\nconst char *\tX509_get_default_cert_file(void );\r\nconst char *\tX509_get_default_cert_dir_env(void );\r\nconst char *\tX509_get_default_cert_file_env(void );\r\nconst char *\tX509_get_default_private_dir(void );\r\n\r\nX509_REQ *\tX509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);\r\nX509 *\t\tX509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_ALGOR)\r\nDECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)\r\nDECLARE_ASN1_FUNCTIONS(X509_VAL)\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_PUBKEY)\r\n\r\nint\t\tX509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);\r\nEVP_PKEY *\tX509_PUBKEY_get(X509_PUBKEY *key);\r\nint\t\tX509_get_pubkey_parameters(EVP_PKEY *pkey,\r\n\t\t\t\t\t   STACK_OF(X509) *chain);\r\nint\t\ti2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);\r\nEVP_PKEY *\td2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\n#ifndef OPENSSL_NO_RSA\r\nint\t\ti2d_RSA_PUBKEY(RSA *a,unsigned char **pp);\r\nRSA *\t\td2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\n#endif\r\n#ifndef OPENSSL_NO_DSA\r\nint\t\ti2d_DSA_PUBKEY(DSA *a,unsigned char **pp);\r\nDSA *\t\td2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,\r\n\t\t\tlong length);\r\n#endif\r\n#ifndef OPENSSL_NO_EC\r\nint\t\ti2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);\r\nEC_KEY \t\t*d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,\r\n\t\t\tlong length);\r\n#endif\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_SIG)\r\nDECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)\r\nDECLARE_ASN1_FUNCTIONS(X509_REQ)\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)\r\nX509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_EXTENSION)\r\nDECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_NAME)\r\n\r\nint\t\tX509_NAME_set(X509_NAME **xn, X509_NAME *name);\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_CINF)\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509)\r\nDECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)\r\n\r\nint X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\t     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint X509_set_ex_data(X509 *r, int idx, void *arg);\r\nvoid *X509_get_ex_data(X509 *r, int idx);\r\nint\t\ti2d_X509_AUX(X509 *a,unsigned char **pp);\r\nX509 *\t\td2i_X509_AUX(X509 **a,const unsigned char **pp,long length);\r\n\r\nint X509_alias_set1(X509 *x, unsigned char *name, int len);\r\nint X509_keyid_set1(X509 *x, unsigned char *id, int len);\r\nunsigned char * X509_alias_get0(X509 *x, int *len);\r\nunsigned char * X509_keyid_get0(X509 *x, int *len);\r\nint (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int);\r\nint X509_TRUST_set(int *t, int trust);\r\nint X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);\r\nint X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);\r\nvoid X509_trust_clear(X509 *x);\r\nvoid X509_reject_clear(X509 *x);\r\n\r\nDECLARE_ASN1_FUNCTIONS(X509_REVOKED)\r\nDECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)\r\nDECLARE_ASN1_FUNCTIONS(X509_CRL)\r\n\r\nint X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);\r\nint X509_CRL_get0_by_serial(X509_CRL *crl,\r\n\t\tX509_REVOKED **ret, ASN1_INTEGER *serial);\r\nint X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);\r\n\r\nX509_PKEY *\tX509_PKEY_new(void );\r\nvoid\t\tX509_PKEY_free(X509_PKEY *a);\r\nint\t\ti2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);\r\nX509_PKEY *\td2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);\r\n\r\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)\r\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)\r\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)\r\n\r\n#ifndef OPENSSL_NO_EVP\r\nX509_INFO *\tX509_INFO_new(void);\r\nvoid\t\tX509_INFO_free(X509_INFO *a);\r\nchar *\t\tX509_NAME_oneline(X509_NAME *a,char *buf,int size);\r\n\r\nint ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,\r\n\t\tASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);\r\n\r\nint ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data,\r\n\t\tunsigned char *md,unsigned int *len);\r\n\r\nint ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,\r\n\t      X509_ALGOR *algor2, ASN1_BIT_STRING *signature,\r\n\t      char *data,EVP_PKEY *pkey, const EVP_MD *type);\r\n\r\nint ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,\r\n\tunsigned char *md,unsigned int *len);\r\n\r\nint ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,\r\n\tASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey);\r\n\r\nint ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,\r\n\tASN1_BIT_STRING *signature,\r\n\tvoid *data, EVP_PKEY *pkey, const EVP_MD *type);\r\nint ASN1_item_sign_ctx(const ASN1_ITEM *it,\r\n\t\tX509_ALGOR *algor1, X509_ALGOR *algor2,\r\n\t     \tASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx);\r\n#endif\r\n\r\nint \t\tX509_set_version(X509 *x,long version);\r\nint \t\tX509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);\r\nASN1_INTEGER *\tX509_get_serialNumber(X509 *x);\r\nint \t\tX509_set_issuer_name(X509 *x, X509_NAME *name);\r\nX509_NAME *\tX509_get_issuer_name(X509 *a);\r\nint \t\tX509_set_subject_name(X509 *x, X509_NAME *name);\r\nX509_NAME *\tX509_get_subject_name(X509 *a);\r\nint \t\tX509_set_notBefore(X509 *x, const ASN1_TIME *tm);\r\nint \t\tX509_set_notAfter(X509 *x, const ASN1_TIME *tm);\r\nint \t\tX509_set_pubkey(X509 *x, EVP_PKEY *pkey);\r\nEVP_PKEY *\tX509_get_pubkey(X509 *x);\r\nASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);\r\nint\t\tX509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */);\r\n\r\nint\t\tX509_REQ_set_version(X509_REQ *x,long version);\r\nint\t\tX509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name);\r\nint\t\tX509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);\r\nEVP_PKEY *\tX509_REQ_get_pubkey(X509_REQ *req);\r\nint\t\tX509_REQ_extension_nid(int nid);\r\nint *\t\tX509_REQ_get_extension_nids(void);\r\nvoid\t\tX509_REQ_set_extension_nids(int *nids);\r\nSTACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);\r\nint X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,\r\n\t\t\t\tint nid);\r\nint X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts);\r\nint X509_REQ_get_attr_count(const X509_REQ *req);\r\nint X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid,\r\n\t\t\t  int lastpos);\r\nint X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,\r\n\t\t\t  int lastpos);\r\nX509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);\r\nX509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);\r\nint X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);\r\nint X509_REQ_add1_attr_by_OBJ(X509_REQ *req,\r\n\t\t\tconst ASN1_OBJECT *obj, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nint X509_REQ_add1_attr_by_NID(X509_REQ *req,\r\n\t\t\tint nid, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nint X509_REQ_add1_attr_by_txt(X509_REQ *req,\r\n\t\t\tconst char *attrname, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\n\r\nint X509_CRL_set_version(X509_CRL *x, long version);\r\nint X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);\r\nint X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);\r\nint X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);\r\nint X509_CRL_sort(X509_CRL *crl);\r\n\r\nint X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);\r\nint X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);\r\n\r\nint\t\tX509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);\r\n\r\nint\t\tX509_check_private_key(X509 *x509,EVP_PKEY *pkey);\r\n\r\nint\t\tX509_issuer_and_serial_cmp(const X509 *a, const X509 *b);\r\nunsigned long\tX509_issuer_and_serial_hash(X509 *a);\r\n\r\nint\t\tX509_issuer_name_cmp(const X509 *a, const X509 *b);\r\nunsigned long\tX509_issuer_name_hash(X509 *a);\r\n\r\nint\t\tX509_subject_name_cmp(const X509 *a, const X509 *b);\r\nunsigned long\tX509_subject_name_hash(X509 *x);\r\n\r\n#ifndef OPENSSL_NO_MD5\r\nunsigned long\tX509_issuer_name_hash_old(X509 *a);\r\nunsigned long\tX509_subject_name_hash_old(X509 *x);\r\n#endif\r\n\r\nint\t\tX509_cmp(const X509 *a, const X509 *b);\r\nint\t\tX509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);\r\nunsigned long\tX509_NAME_hash(X509_NAME *x);\r\nunsigned long\tX509_NAME_hash_old(X509_NAME *x);\r\n\r\nint\t\tX509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);\r\nint\t\tX509_CRL_match(const X509_CRL *a, const X509_CRL *b);\r\n#ifndef OPENSSL_NO_FP_API\r\nint\t\tX509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag);\r\nint\t\tX509_print_fp(FILE *bp,X509 *x);\r\nint\t\tX509_CRL_print_fp(FILE *bp,X509_CRL *x);\r\nint\t\tX509_REQ_print_fp(FILE *bp,X509_REQ *req);\r\nint X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags);\r\n#endif\r\n\r\n#ifndef OPENSSL_NO_BIO\r\nint\t\tX509_NAME_print(BIO *bp, X509_NAME *name, int obase);\r\nint X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags);\r\nint\t\tX509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag);\r\nint\t\tX509_print(BIO *bp,X509 *x);\r\nint\t\tX509_ocspid_print(BIO *bp,X509 *x);\r\nint\t\tX509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);\r\nint\t\tX509_CRL_print(BIO *bp,X509_CRL *x);\r\nint\t\tX509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag);\r\nint\t\tX509_REQ_print(BIO *bp,X509_REQ *req);\r\n#endif\r\n\r\nint \t\tX509_NAME_entry_count(X509_NAME *name);\r\nint \t\tX509_NAME_get_text_by_NID(X509_NAME *name, int nid,\r\n\t\t\tchar *buf,int len);\r\nint\t\tX509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,\r\n\t\t\tchar *buf,int len);\r\n\r\n/* NOTE: you should be passsing -1, not 0 as lastpos.  The functions that use\r\n * lastpos, search after that position on. */\r\nint \t\tX509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos);\r\nint \t\tX509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj,\r\n\t\t\tint lastpos);\r\nX509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);\r\nX509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);\r\nint \t\tX509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne,\r\n\t\t\tint loc, int set);\r\nint X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,\r\n\t\t\tunsigned char *bytes, int len, int loc, int set);\r\nint X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,\r\n\t\t\tunsigned char *bytes, int len, int loc, int set);\r\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,\r\n\t\tconst char *field, int type, const unsigned char *bytes, int len);\r\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,\r\n\t\t\tint type,unsigned char *bytes, int len);\r\nint X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,\r\n\t\t\tconst unsigned char *bytes, int len, int loc, int set);\r\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,\r\n\t\t\tASN1_OBJECT *obj, int type,const unsigned char *bytes,\r\n\t\t\tint len);\r\nint \t\tX509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,\r\n\t\t\tASN1_OBJECT *obj);\r\nint \t\tX509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nASN1_OBJECT *\tX509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);\r\nASN1_STRING *\tX509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);\r\n\r\nint\t\tX509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);\r\nint\t\tX509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,\r\n\t\t\t\t      int nid, int lastpos);\r\nint\t\tX509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,\r\n\t\t\t\t      ASN1_OBJECT *obj,int lastpos);\r\nint\t\tX509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,\r\n\t\t\t\t\t   int crit, int lastpos);\r\nX509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);\r\nX509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);\r\nSTACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,\r\n\t\t\t\t\t X509_EXTENSION *ex, int loc);\r\n\r\nint\t\tX509_get_ext_count(X509 *x);\r\nint\t\tX509_get_ext_by_NID(X509 *x, int nid, int lastpos);\r\nint\t\tX509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);\r\nint\t\tX509_get_ext_by_critical(X509 *x, int crit, int lastpos);\r\nX509_EXTENSION *X509_get_ext(X509 *x, int loc);\r\nX509_EXTENSION *X509_delete_ext(X509 *x, int loc);\r\nint\t\tX509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);\r\nvoid\t*\tX509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);\r\nint\t\tX509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\n\r\nint\t\tX509_CRL_get_ext_count(X509_CRL *x);\r\nint\t\tX509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);\r\nint\t\tX509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos);\r\nint\t\tX509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);\r\nX509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);\r\nX509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);\r\nint\t\tX509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);\r\nvoid\t*\tX509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);\r\nint\t\tX509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\n\r\nint\t\tX509_REVOKED_get_ext_count(X509_REVOKED *x);\r\nint\t\tX509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);\r\nint\t\tX509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos);\r\nint\t\tX509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);\r\nX509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);\r\nX509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);\r\nint\t\tX509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);\r\nvoid\t*\tX509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);\r\nint\t\tX509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\n\r\nX509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,\r\n\t\t\tint nid, int crit, ASN1_OCTET_STRING *data);\r\nX509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,\r\n\t\t\tASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data);\r\nint\t\tX509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj);\r\nint\t\tX509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);\r\nint\t\tX509_EXTENSION_set_data(X509_EXTENSION *ex,\r\n\t\t\tASN1_OCTET_STRING *data);\r\nASN1_OBJECT *\tX509_EXTENSION_get_object(X509_EXTENSION *ex);\r\nASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);\r\nint\t\tX509_EXTENSION_get_critical(X509_EXTENSION *ex);\r\n\r\nint X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);\r\nint X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,\r\n\t\t\t  int lastpos);\r\nint X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj,\r\n\t\t\t  int lastpos);\r\nX509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);\r\nX509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);\r\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,\r\n\t\t\t\t\t X509_ATTRIBUTE *attr);\r\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x,\r\n\t\t\tconst ASN1_OBJECT *obj, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x,\r\n\t\t\tint nid, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x,\r\n\t\t\tconst char *attrname, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nvoid *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,\r\n\t\t\t\tASN1_OBJECT *obj, int lastpos, int type);\r\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,\r\n\t     int atrtype, const void *data, int len);\r\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,\r\n\t     const ASN1_OBJECT *obj, int atrtype, const void *data, int len);\r\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,\r\n\t\tconst char *atrname, int type, const unsigned char *bytes, int len);\r\nint X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);\r\nint X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len);\r\nvoid *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx,\r\n\t\t\t\t\tint atrtype, void *data);\r\nint X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);\r\nASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);\r\nASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);\r\n\r\nint EVP_PKEY_get_attr_count(const EVP_PKEY *key);\r\nint EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,\r\n\t\t\t  int lastpos);\r\nint EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,\r\n\t\t\t  int lastpos);\r\nX509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);\r\nX509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);\r\nint EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);\r\nint EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,\r\n\t\t\tconst ASN1_OBJECT *obj, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nint EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,\r\n\t\t\tint nid, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\nint EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,\r\n\t\t\tconst char *attrname, int type,\r\n\t\t\tconst unsigned char *bytes, int len);\r\n\r\nint\t\tX509_verify_cert(X509_STORE_CTX *ctx);\r\n\r\n/* lookup a cert from a X509 STACK */\r\nX509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name,\r\n\t\t\t\t     ASN1_INTEGER *serial);\r\nX509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name);\r\n\r\nDECLARE_ASN1_FUNCTIONS(PBEPARAM)\r\nDECLARE_ASN1_FUNCTIONS(PBE2PARAM)\r\nDECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)\r\n\r\nint PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,\r\n\t\t\t\tconst unsigned char *salt, int saltlen);\r\n\r\nX509_ALGOR *PKCS5_pbe_set(int alg, int iter,\r\n\t\t\t\tconst unsigned char *salt, int saltlen);\r\nX509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,\r\n\t\t\t\t\t unsigned char *salt, int saltlen);\r\nX509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,\r\n\t\t\t\t unsigned char *salt, int saltlen,\r\n\t\t\t\t unsigned char *aiv, int prf_nid);\r\n\r\nX509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,\r\n\t\t\t\tint prf_nid, int keylen);\r\n\r\n/* PKCS#8 utilities */\r\n\r\nDECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)\r\n\r\nEVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8);\r\nPKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey);\r\nPKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);\r\nPKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);\r\n\r\nint PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,\r\n\t\t\tint version, int ptype, void *pval,\r\n\t\t\t\tunsigned char *penc, int penclen);\r\nint PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,\r\n\t\tconst unsigned char **pk, int *ppklen,\r\n\t\tX509_ALGOR **pa,\r\n\t\tPKCS8_PRIV_KEY_INFO *p8);\r\n\r\nint X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,\r\n\t\t\t\t\tint ptype, void *pval,\r\n\t\t\t\t\tunsigned char *penc, int penclen);\r\nint X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,\r\n\t\tconst unsigned char **pk, int *ppklen,\r\n\t\tX509_ALGOR **pa,\r\n\t\tX509_PUBKEY *pub);\r\n\r\nint X509_check_trust(X509 *x, int id, int flags);\r\nint X509_TRUST_get_count(void);\r\nX509_TRUST * X509_TRUST_get0(int idx);\r\nint X509_TRUST_get_by_id(int id);\r\nint X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),\r\n\t\t\t\t\tchar *name, int arg1, void *arg2);\r\nvoid X509_TRUST_cleanup(void);\r\nint X509_TRUST_get_flags(X509_TRUST *xp);\r\nchar *X509_TRUST_get0_name(X509_TRUST *xp);\r\nint X509_TRUST_get_trust(X509_TRUST *xp);\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_X509_strings(void);\r\n\r\n/* Error codes for the X509 functions. */\r\n\r\n/* Function codes. */\r\n#define X509_F_ADD_CERT_DIR\t\t\t\t 100\r\n#define X509_F_BY_FILE_CTRL\t\t\t\t 101\r\n#define X509_F_CHECK_POLICY\t\t\t\t 145\r\n#define X509_F_DIR_CTRL\t\t\t\t\t 102\r\n#define X509_F_GET_CERT_BY_SUBJECT\t\t\t 103\r\n#define X509_F_NETSCAPE_SPKI_B64_DECODE\t\t\t 129\r\n#define X509_F_NETSCAPE_SPKI_B64_ENCODE\t\t\t 130\r\n#define X509_F_X509AT_ADD1_ATTR\t\t\t\t 135\r\n#define X509_F_X509V3_ADD_EXT\t\t\t\t 104\r\n#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID\t\t 136\r\n#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ\t\t 137\r\n#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT\t\t 140\r\n#define X509_F_X509_ATTRIBUTE_GET0_DATA\t\t\t 139\r\n#define X509_F_X509_ATTRIBUTE_SET1_DATA\t\t\t 138\r\n#define X509_F_X509_CHECK_PRIVATE_KEY\t\t\t 128\r\n#define X509_F_X509_CRL_PRINT_FP\t\t\t 147\r\n#define X509_F_X509_EXTENSION_CREATE_BY_NID\t\t 108\r\n#define X509_F_X509_EXTENSION_CREATE_BY_OBJ\t\t 109\r\n#define X509_F_X509_GET_PUBKEY_PARAMETERS\t\t 110\r\n#define X509_F_X509_LOAD_CERT_CRL_FILE\t\t\t 132\r\n#define X509_F_X509_LOAD_CERT_FILE\t\t\t 111\r\n#define X509_F_X509_LOAD_CRL_FILE\t\t\t 112\r\n#define X509_F_X509_NAME_ADD_ENTRY\t\t\t 113\r\n#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID\t\t 114\r\n#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT\t\t 131\r\n#define X509_F_X509_NAME_ENTRY_SET_OBJECT\t\t 115\r\n#define X509_F_X509_NAME_ONELINE\t\t\t 116\r\n#define X509_F_X509_NAME_PRINT\t\t\t\t 117\r\n#define X509_F_X509_PRINT_EX_FP\t\t\t\t 118\r\n#define X509_F_X509_PUBKEY_GET\t\t\t\t 119\r\n#define X509_F_X509_PUBKEY_SET\t\t\t\t 120\r\n#define X509_F_X509_REQ_CHECK_PRIVATE_KEY\t\t 144\r\n#define X509_F_X509_REQ_PRINT_EX\t\t\t 121\r\n#define X509_F_X509_REQ_PRINT_FP\t\t\t 122\r\n#define X509_F_X509_REQ_TO_X509\t\t\t\t 123\r\n#define X509_F_X509_STORE_ADD_CERT\t\t\t 124\r\n#define X509_F_X509_STORE_ADD_CRL\t\t\t 125\r\n#define X509_F_X509_STORE_CTX_GET1_ISSUER\t\t 146\r\n#define X509_F_X509_STORE_CTX_INIT\t\t\t 143\r\n#define X509_F_X509_STORE_CTX_NEW\t\t\t 142\r\n#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT\t\t 134\r\n#define X509_F_X509_TO_X509_REQ\t\t\t\t 126\r\n#define X509_F_X509_TRUST_ADD\t\t\t\t 133\r\n#define X509_F_X509_TRUST_SET\t\t\t\t 141\r\n#define X509_F_X509_VERIFY_CERT\t\t\t\t 127\r\n\r\n/* Reason codes. */\r\n#define X509_R_BAD_X509_FILETYPE\t\t\t 100\r\n#define X509_R_BASE64_DECODE_ERROR\t\t\t 118\r\n#define X509_R_CANT_CHECK_DH_KEY\t\t\t 114\r\n#define X509_R_CERT_ALREADY_IN_HASH_TABLE\t\t 101\r\n#define X509_R_ERR_ASN1_LIB\t\t\t\t 102\r\n#define X509_R_INVALID_DIRECTORY\t\t\t 113\r\n#define X509_R_INVALID_FIELD_NAME\t\t\t 119\r\n#define X509_R_INVALID_TRUST\t\t\t\t 123\r\n#define X509_R_KEY_TYPE_MISMATCH\t\t\t 115\r\n#define X509_R_KEY_VALUES_MISMATCH\t\t\t 116\r\n#define X509_R_LOADING_CERT_DIR\t\t\t\t 103\r\n#define X509_R_LOADING_DEFAULTS\t\t\t\t 104\r\n#define X509_R_METHOD_NOT_SUPPORTED\t\t\t 124\r\n#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY\t\t 105\r\n#define X509_R_PUBLIC_KEY_DECODE_ERROR\t\t\t 125\r\n#define X509_R_PUBLIC_KEY_ENCODE_ERROR\t\t\t 126\r\n#define X509_R_SHOULD_RETRY\t\t\t\t 106\r\n#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN\t 107\r\n#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY\t\t 108\r\n#define X509_R_UNKNOWN_KEY_TYPE\t\t\t\t 117\r\n#define X509_R_UNKNOWN_NID\t\t\t\t 109\r\n#define X509_R_UNKNOWN_PURPOSE_ID\t\t\t 121\r\n#define X509_R_UNKNOWN_TRUST_ID\t\t\t\t 120\r\n#define X509_R_UNSUPPORTED_ALGORITHM\t\t\t 111\r\n#define X509_R_WRONG_LOOKUP_TYPE\t\t\t 112\r\n#define X509_R_WRONG_TYPE\t\t\t\t 122\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/x509_vfy.h",
    "content": "/* crypto/x509/x509_vfy.h */\r\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r\n * All rights reserved.\r\n *\r\n * This package is an SSL implementation written\r\n * by Eric Young (eay@cryptsoft.com).\r\n * The implementation was written so as to conform with Netscapes SSL.\r\n * \r\n * This library is free for commercial and non-commercial use as long as\r\n * the following conditions are aheared to.  The following conditions\r\n * apply to all code found in this distribution, be it the RC4, RSA,\r\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r\n * included with this distribution is covered by the same copyright terms\r\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r\n * \r\n * Copyright remains Eric Young's, and as such any Copyright notices in\r\n * the code are not to be removed.\r\n * If this package is used in a product, Eric Young should be given attribution\r\n * as the author of the parts of the library used.\r\n * This can be in the form of a textual message at program startup or\r\n * in documentation (online or textual) provided with the package.\r\n * \r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n * 3. All advertising materials mentioning features or use of this software\r\n *    must display the following acknowledgement:\r\n *    \"This product includes cryptographic software written by\r\n *     Eric Young (eay@cryptsoft.com)\"\r\n *    The word 'cryptographic' can be left out if the rouines from the library\r\n *    being used are not cryptographic related :-).\r\n * 4. If you include any Windows specific code (or a derivative thereof) from \r\n *    the apps directory (application code) you must include an acknowledgement:\r\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\r\n * \r\n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r\n * SUCH DAMAGE.\r\n * \r\n * The licence and distribution terms for any publically available version or\r\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\r\n * copied and put under another distribution licence\r\n * [including the GNU Public Licence.]\r\n */\r\n\r\n#ifndef HEADER_X509_H\r\n#include <openssl/x509.h>\r\n/* openssl/x509.h ends up #include-ing this file at about the only\r\n * appropriate moment. */\r\n#endif\r\n\r\n#ifndef HEADER_X509_VFY_H\r\n#define HEADER_X509_VFY_H\r\n\r\n#include <openssl/opensslconf.h>\r\n#ifndef OPENSSL_NO_LHASH\r\n#include <openssl/lhash.h>\r\n#endif\r\n#include <openssl/bio.h>\r\n#include <openssl/crypto.h>\r\n#include <openssl/symhacks.h>\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#if 0\r\n/* Outer object */\r\ntypedef struct x509_hash_dir_st\r\n\t{\r\n\tint num_dirs;\r\n\tchar **dirs;\r\n\tint *dirs_type;\r\n\tint num_dirs_alloced;\r\n\t} X509_HASH_DIR_CTX;\r\n#endif\r\n\r\ntypedef struct x509_file_st\r\n\t{\r\n\tint num_paths;\t/* number of paths to files or directories */\r\n\tint num_alloced;\r\n\tchar **paths;\t/* the list of paths or directories */\r\n\tint *path_type;\r\n\t} X509_CERT_FILE_CTX;\r\n\r\n/*******************************/\r\n/*\r\nSSL_CTX -> X509_STORE    \r\n\t\t-> X509_LOOKUP\r\n\t\t\t->X509_LOOKUP_METHOD\r\n\t\t-> X509_LOOKUP\r\n\t\t\t->X509_LOOKUP_METHOD\r\n \r\nSSL\t-> X509_STORE_CTX\r\n\t\t->X509_STORE    \r\n\r\nThe X509_STORE holds the tables etc for verification stuff.\r\nA X509_STORE_CTX is used while validating a single certificate.\r\nThe X509_STORE has X509_LOOKUPs for looking up certs.\r\nThe X509_STORE then calls a function to actually verify the\r\ncertificate chain.\r\n*/\r\n\r\n#define X509_LU_RETRY\t\t-1\r\n#define X509_LU_FAIL\t\t0\r\n#define X509_LU_X509\t\t1\r\n#define X509_LU_CRL\t\t2\r\n#define X509_LU_PKEY\t\t3\r\n\r\ntypedef struct x509_object_st\r\n\t{\r\n\t/* one of the above types */\r\n\tint type;\r\n\tunion\t{\r\n\t\tchar *ptr;\r\n\t\tX509 *x509;\r\n\t\tX509_CRL *crl;\r\n\t\tEVP_PKEY *pkey;\r\n\t\t} data;\r\n\t} X509_OBJECT;\r\n\r\ntypedef struct x509_lookup_st X509_LOOKUP;\r\n\r\nDECLARE_STACK_OF(X509_LOOKUP)\r\nDECLARE_STACK_OF(X509_OBJECT)\r\n\r\n/* This is a static that defines the function interface */\r\ntypedef struct x509_lookup_method_st\r\n\t{\r\n\tconst char *name;\r\n\tint (*new_item)(X509_LOOKUP *ctx);\r\n\tvoid (*free)(X509_LOOKUP *ctx);\r\n\tint (*init)(X509_LOOKUP *ctx);\r\n\tint (*shutdown)(X509_LOOKUP *ctx);\r\n\tint (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,\r\n\t\t\tchar **ret);\r\n\tint (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,\r\n\t\t\t      X509_OBJECT *ret);\r\n\tint (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,\r\n\t\t\t\t    ASN1_INTEGER *serial,X509_OBJECT *ret);\r\n\tint (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,\r\n\t\t\t\t  unsigned char *bytes,int len,\r\n\t\t\t\t  X509_OBJECT *ret);\r\n\tint (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,\r\n\t\t\t    X509_OBJECT *ret);\r\n\t} X509_LOOKUP_METHOD;\r\n\r\n/* This structure hold all parameters associated with a verify operation\r\n * by including an X509_VERIFY_PARAM structure in related structures the\r\n * parameters used can be customized\r\n */\r\n\r\ntypedef struct X509_VERIFY_PARAM_st\r\n\t{\r\n\tchar *name;\r\n\ttime_t check_time;\t/* Time to use */\r\n\tunsigned long inh_flags; /* Inheritance flags */\r\n\tunsigned long flags;\t/* Various verify flags */\r\n\tint purpose;\t\t/* purpose to check untrusted certificates */\r\n\tint trust;\t\t/* trust setting to check */\r\n\tint depth;\t\t/* Verify depth */\r\n\tSTACK_OF(ASN1_OBJECT) *policies;\t/* Permissible policies */\r\n\t} X509_VERIFY_PARAM;\r\n\r\nDECLARE_STACK_OF(X509_VERIFY_PARAM)\r\n\r\n/* This is used to hold everything.  It is used for all certificate\r\n * validation.  Once we have a certificate chain, the 'verify'\r\n * function is then called to actually check the cert chain. */\r\nstruct x509_store_st\r\n\t{\r\n\t/* The following is a cache of trusted certs */\r\n\tint cache; \t/* if true, stash any hits */\r\n\tSTACK_OF(X509_OBJECT) *objs;\t/* Cache of all objects */\r\n\r\n\t/* These are external lookup methods */\r\n\tSTACK_OF(X509_LOOKUP) *get_cert_methods;\r\n\r\n\tX509_VERIFY_PARAM *param;\r\n\r\n\t/* Callbacks for various operations */\r\n\tint (*verify)(X509_STORE_CTX *ctx);\t/* called to verify a certificate */\r\n\tint (*verify_cb)(int ok,X509_STORE_CTX *ctx);\t/* error callback */\r\n\tint (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\t/* get issuers cert from ctx */\r\n\tint (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */\r\n\tint (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */\r\n\tint (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */\r\n\tint (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */\r\n\tint (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */\r\n\tSTACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);\r\n\tSTACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);\r\n\tint (*cleanup)(X509_STORE_CTX *ctx);\r\n\r\n\tCRYPTO_EX_DATA ex_data;\r\n\tint references;\r\n\t} /* X509_STORE */;\r\n\r\nint X509_STORE_set_depth(X509_STORE *store, int depth);\r\n\r\n#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))\r\n#define X509_STORE_set_verify_func(ctx,func)\t((ctx)->verify=(func))\r\n\r\n/* This is the functions plus an instance of the local variables. */\r\nstruct x509_lookup_st\r\n\t{\r\n\tint init;\t\t\t/* have we been started */\r\n\tint skip;\t\t\t/* don't use us. */\r\n\tX509_LOOKUP_METHOD *method;\t/* the functions */\r\n\tchar *method_data;\t\t/* method data */\r\n\r\n\tX509_STORE *store_ctx;\t/* who owns us */\r\n\t} /* X509_LOOKUP */;\r\n\r\n/* This is a used when verifying cert chains.  Since the\r\n * gathering of the cert chain can take some time (and have to be\r\n * 'retried', this needs to be kept and passed around. */\r\nstruct x509_store_ctx_st      /* X509_STORE_CTX */\r\n\t{\r\n\tX509_STORE *ctx;\r\n\tint current_method;\t/* used when looking up certs */\r\n\r\n\t/* The following are set by the caller */\r\n\tX509 *cert;\t\t/* The cert to check */\r\n\tSTACK_OF(X509) *untrusted;\t/* chain of X509s - untrusted - passed in */\r\n\tSTACK_OF(X509_CRL) *crls;\t/* set of CRLs passed in */\r\n\r\n\tX509_VERIFY_PARAM *param;\r\n\tvoid *other_ctx;\t/* Other info for use with get_issuer() */\r\n\r\n\t/* Callbacks for various operations */\r\n\tint (*verify)(X509_STORE_CTX *ctx);\t/* called to verify a certificate */\r\n\tint (*verify_cb)(int ok,X509_STORE_CTX *ctx);\t\t/* error callback */\r\n\tint (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\t/* get issuers cert from ctx */\r\n\tint (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */\r\n\tint (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */\r\n\tint (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */\r\n\tint (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */\r\n\tint (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */\r\n\tint (*check_policy)(X509_STORE_CTX *ctx);\r\n\tSTACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);\r\n\tSTACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);\r\n\tint (*cleanup)(X509_STORE_CTX *ctx);\r\n\r\n\t/* The following is built up */\r\n\tint valid;\t\t/* if 0, rebuild chain */\r\n\tint last_untrusted;\t/* index of last untrusted cert */\r\n\tSTACK_OF(X509) *chain; \t\t/* chain of X509s - built up and trusted */\r\n\tX509_POLICY_TREE *tree;\t/* Valid policy tree */\r\n\r\n\tint explicit_policy;\t/* Require explicit policy value */\r\n\r\n\t/* When something goes wrong, this is why */\r\n\tint error_depth;\r\n\tint error;\r\n\tX509 *current_cert;\r\n\tX509 *current_issuer;\t/* cert currently being tested as valid issuer */\r\n\tX509_CRL *current_crl;\t/* current CRL */\r\n\r\n\tint current_crl_score;  /* score of current CRL */\r\n\tunsigned int current_reasons;  /* Reason mask */\r\n\r\n\tX509_STORE_CTX *parent; /* For CRL path validation: parent context */\r\n\r\n\tCRYPTO_EX_DATA ex_data;\r\n\t} /* X509_STORE_CTX */;\r\n\r\nvoid X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);\r\n\r\n#define X509_STORE_CTX_set_app_data(ctx,data) \\\r\n\tX509_STORE_CTX_set_ex_data(ctx,0,data)\r\n#define X509_STORE_CTX_get_app_data(ctx) \\\r\n\tX509_STORE_CTX_get_ex_data(ctx,0)\r\n\r\n#define X509_L_FILE_LOAD\t1\r\n#define X509_L_ADD_DIR\t\t2\r\n\r\n#define X509_LOOKUP_load_file(x,name,type) \\\r\n\t\tX509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)\r\n\r\n#define X509_LOOKUP_add_dir(x,name,type) \\\r\n\t\tX509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)\r\n\r\n#define\t\tX509_V_OK\t\t\t\t\t0\r\n/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */\r\n\r\n#define\t\tX509_V_ERR_UNABLE_TO_GET_ISSUER_CERT\t\t2\r\n#define\t\tX509_V_ERR_UNABLE_TO_GET_CRL\t\t\t3\r\n#define\t\tX509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE\t4\r\n#define\t\tX509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE\t5\r\n#define\t\tX509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY\t6\r\n#define\t\tX509_V_ERR_CERT_SIGNATURE_FAILURE\t\t7\r\n#define\t\tX509_V_ERR_CRL_SIGNATURE_FAILURE\t\t8\r\n#define\t\tX509_V_ERR_CERT_NOT_YET_VALID\t\t\t9\r\n#define\t\tX509_V_ERR_CERT_HAS_EXPIRED\t\t\t10\r\n#define\t\tX509_V_ERR_CRL_NOT_YET_VALID\t\t\t11\r\n#define\t\tX509_V_ERR_CRL_HAS_EXPIRED\t\t\t12\r\n#define\t\tX509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD\t13\r\n#define\t\tX509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD\t14\r\n#define\t\tX509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD\t15\r\n#define\t\tX509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD\t16\r\n#define\t\tX509_V_ERR_OUT_OF_MEM\t\t\t\t17\r\n#define\t\tX509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT\t\t18\r\n#define\t\tX509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN\t\t19\r\n#define\t\tX509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY\t20\r\n#define\t\tX509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE\t21\r\n#define\t\tX509_V_ERR_CERT_CHAIN_TOO_LONG\t\t\t22\r\n#define\t\tX509_V_ERR_CERT_REVOKED\t\t\t\t23\r\n#define\t\tX509_V_ERR_INVALID_CA\t\t\t\t24\r\n#define\t\tX509_V_ERR_PATH_LENGTH_EXCEEDED\t\t\t25\r\n#define\t\tX509_V_ERR_INVALID_PURPOSE\t\t\t26\r\n#define\t\tX509_V_ERR_CERT_UNTRUSTED\t\t\t27\r\n#define\t\tX509_V_ERR_CERT_REJECTED\t\t\t28\r\n/* These are 'informational' when looking for issuer cert */\r\n#define\t\tX509_V_ERR_SUBJECT_ISSUER_MISMATCH\t\t29\r\n#define\t\tX509_V_ERR_AKID_SKID_MISMATCH\t\t\t30\r\n#define\t\tX509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH\t\t31\r\n#define\t\tX509_V_ERR_KEYUSAGE_NO_CERTSIGN\t\t\t32\r\n\r\n#define\t\tX509_V_ERR_UNABLE_TO_GET_CRL_ISSUER\t\t33\r\n#define\t\tX509_V_ERR_UNHANDLED_CRITICAL_EXTENSION\t\t34\r\n#define\t\tX509_V_ERR_KEYUSAGE_NO_CRL_SIGN\t\t\t35\r\n#define\t\tX509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION\t36\r\n#define\t\tX509_V_ERR_INVALID_NON_CA\t\t\t37\r\n#define\t\tX509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED\t\t38\r\n#define\t\tX509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE\t39\r\n#define\t\tX509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED\t40\r\n\r\n#define\t\tX509_V_ERR_INVALID_EXTENSION\t\t\t41\r\n#define\t\tX509_V_ERR_INVALID_POLICY_EXTENSION\t\t42\r\n#define\t\tX509_V_ERR_NO_EXPLICIT_POLICY\t\t\t43\r\n#define\t\tX509_V_ERR_DIFFERENT_CRL_SCOPE\t\t\t44\r\n#define\t\tX509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE\t45\r\n\r\n#define\t\tX509_V_ERR_UNNESTED_RESOURCE\t\t\t46\r\n\r\n#define\t\tX509_V_ERR_PERMITTED_VIOLATION\t\t\t47\r\n#define\t\tX509_V_ERR_EXCLUDED_VIOLATION\t\t\t48\r\n#define\t\tX509_V_ERR_SUBTREE_MINMAX\t\t\t49\r\n#define\t\tX509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE\t\t51\r\n#define\t\tX509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX\t52\r\n#define\t\tX509_V_ERR_UNSUPPORTED_NAME_SYNTAX\t\t53\r\n#define\t\tX509_V_ERR_CRL_PATH_VALIDATION_ERROR\t\t54\r\n\r\n/* The application is not happy */\r\n#define\t\tX509_V_ERR_APPLICATION_VERIFICATION\t\t50\r\n\r\n/* Certificate verify flags */\r\n\r\n/* Send issuer+subject checks to verify_cb */\r\n#define\tX509_V_FLAG_CB_ISSUER_CHECK\t\t0x1\r\n/* Use check time instead of current time */\r\n#define\tX509_V_FLAG_USE_CHECK_TIME\t\t0x2\r\n/* Lookup CRLs */\r\n#define\tX509_V_FLAG_CRL_CHECK\t\t\t0x4\r\n/* Lookup CRLs for whole chain */\r\n#define\tX509_V_FLAG_CRL_CHECK_ALL\t\t0x8\r\n/* Ignore unhandled critical extensions */\r\n#define\tX509_V_FLAG_IGNORE_CRITICAL\t\t0x10\r\n/* Disable workarounds for broken certificates */\r\n#define\tX509_V_FLAG_X509_STRICT\t\t\t0x20\r\n/* Enable proxy certificate validation */\r\n#define\tX509_V_FLAG_ALLOW_PROXY_CERTS\t\t0x40\r\n/* Enable policy checking */\r\n#define X509_V_FLAG_POLICY_CHECK\t\t0x80\r\n/* Policy variable require-explicit-policy */\r\n#define X509_V_FLAG_EXPLICIT_POLICY\t\t0x100\r\n/* Policy variable inhibit-any-policy */\r\n#define\tX509_V_FLAG_INHIBIT_ANY\t\t\t0x200\r\n/* Policy variable inhibit-policy-mapping */\r\n#define X509_V_FLAG_INHIBIT_MAP\t\t\t0x400\r\n/* Notify callback that policy is OK */\r\n#define X509_V_FLAG_NOTIFY_POLICY\t\t0x800\r\n/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */\r\n#define X509_V_FLAG_EXTENDED_CRL_SUPPORT\t0x1000\r\n/* Delta CRL support */\r\n#define X509_V_FLAG_USE_DELTAS\t\t\t0x2000\r\n/* Check selfsigned CA signature */\r\n#define X509_V_FLAG_CHECK_SS_SIGNATURE\t\t0x4000\r\n\r\n\r\n#define X509_VP_FLAG_DEFAULT\t\t\t0x1\r\n#define X509_VP_FLAG_OVERWRITE\t\t\t0x2\r\n#define X509_VP_FLAG_RESET_FLAGS\t\t0x4\r\n#define X509_VP_FLAG_LOCKED\t\t\t0x8\r\n#define X509_VP_FLAG_ONCE\t\t\t0x10\r\n\r\n/* Internal use: mask of policy related options */\r\n#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \\\r\n\t\t\t\t| X509_V_FLAG_EXPLICIT_POLICY \\\r\n\t\t\t\t| X509_V_FLAG_INHIBIT_ANY \\\r\n\t\t\t\t| X509_V_FLAG_INHIBIT_MAP)\r\n\r\nint X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,\r\n\t     X509_NAME *name);\r\nX509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);\r\nX509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);\r\nvoid X509_OBJECT_up_ref_count(X509_OBJECT *a);\r\nvoid X509_OBJECT_free_contents(X509_OBJECT *a);\r\nX509_STORE *X509_STORE_new(void );\r\nvoid X509_STORE_free(X509_STORE *v);\r\n\r\nSTACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);\r\nSTACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm);\r\nint X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);\r\nint X509_STORE_set_purpose(X509_STORE *ctx, int purpose);\r\nint X509_STORE_set_trust(X509_STORE *ctx, int trust);\r\nint X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);\r\n\r\nvoid X509_STORE_set_verify_cb(X509_STORE *ctx,\r\n\t\t\t\t  int (*verify_cb)(int, X509_STORE_CTX *));\r\n\r\nX509_STORE_CTX *X509_STORE_CTX_new(void);\r\n\r\nint X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\r\n\r\nvoid X509_STORE_CTX_free(X509_STORE_CTX *ctx);\r\nint X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,\r\n\t\t\t X509 *x509, STACK_OF(X509) *chain);\r\nvoid X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);\r\nvoid X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);\r\n\r\nX509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);\r\n\r\nX509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);\r\nX509_LOOKUP_METHOD *X509_LOOKUP_file(void);\r\n\r\nint X509_STORE_add_cert(X509_STORE *ctx, X509 *x);\r\nint X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);\r\n\r\nint X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,\r\n\tX509_OBJECT *ret);\r\n\r\nint X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,\r\n\tlong argl, char **ret);\r\n\r\n#ifndef OPENSSL_NO_STDIO\r\nint X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);\r\nint X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);\r\nint X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);\r\n#endif\r\n\r\n\r\nX509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);\r\nvoid X509_LOOKUP_free(X509_LOOKUP *ctx);\r\nint X509_LOOKUP_init(X509_LOOKUP *ctx);\r\nint X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,\r\n\tX509_OBJECT *ret);\r\nint X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,\r\n\tASN1_INTEGER *serial, X509_OBJECT *ret);\r\nint X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,\r\n\tunsigned char *bytes, int len, X509_OBJECT *ret);\r\nint X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,\r\n\tint len, X509_OBJECT *ret);\r\nint X509_LOOKUP_shutdown(X509_LOOKUP *ctx);\r\n\r\n#ifndef OPENSSL_NO_STDIO\r\nint\tX509_STORE_load_locations (X509_STORE *ctx,\r\n\t\tconst char *file, const char *dir);\r\nint\tX509_STORE_set_default_paths(X509_STORE *ctx);\r\n#endif\r\n\r\nint X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\r\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\r\nint\tX509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);\r\nvoid *\tX509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);\r\nint\tX509_STORE_CTX_get_error(X509_STORE_CTX *ctx);\r\nvoid\tX509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);\r\nint\tX509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);\r\nX509 *\tX509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);\r\nX509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);\r\nX509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);\r\nX509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx);\r\nSTACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);\r\nSTACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);\r\nvoid\tX509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);\r\nvoid\tX509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);\r\nvoid\tX509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);\r\nint X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);\r\nint X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);\r\nint X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,\r\n\t\t\t\tint purpose, int trust);\r\nvoid X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);\r\nvoid X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,\r\n\t\t\t\t\t\t\t\ttime_t t);\r\nvoid X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,\r\n\t\t\t\t  int (*verify_cb)(int, X509_STORE_CTX *));\r\n  \r\nX509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);\r\nint X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);\r\n\r\nX509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);\r\nvoid X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);\r\nint X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);\r\n\r\n/* X509_VERIFY_PARAM functions */\r\n\r\nX509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);\r\nvoid X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);\r\nint X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,\r\n\t\t\t\t\t\tconst X509_VERIFY_PARAM *from);\r\nint X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, \r\n\t\t\t\t\t\tconst X509_VERIFY_PARAM *from);\r\nint X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);\r\nint X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);\r\nint X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,\r\n\t\t\t\t\t\t\tunsigned long flags);\r\nunsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);\r\nint X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);\r\nint X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);\r\nvoid X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);\r\nvoid X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);\r\nint X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,\r\n\t\t\t\t\t\tASN1_OBJECT *policy);\r\nint X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, \r\n\t\t\t\t\tSTACK_OF(ASN1_OBJECT) *policies);\r\nint X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);\r\n\r\nint X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);\r\nconst X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);\r\nvoid X509_VERIFY_PARAM_table_cleanup(void);\r\n\r\nint X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,\r\n\t\t\tSTACK_OF(X509) *certs,\r\n\t\t\tSTACK_OF(ASN1_OBJECT) *policy_oids,\r\n\t\t\tunsigned int flags);\r\n\r\nvoid X509_policy_tree_free(X509_POLICY_TREE *tree);\r\n\r\nint X509_policy_tree_level_count(const X509_POLICY_TREE *tree);\r\nX509_POLICY_LEVEL *\r\n\tX509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);\r\n\r\nSTACK_OF(X509_POLICY_NODE) *\r\n\tX509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);\r\n\r\nSTACK_OF(X509_POLICY_NODE) *\r\n\tX509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);\r\n\r\nint X509_policy_level_node_count(X509_POLICY_LEVEL *level);\r\n\r\nX509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);\r\n\r\nconst ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);\r\n\r\nSTACK_OF(POLICYQUALINFO) *\r\n\tX509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);\r\nconst X509_POLICY_NODE *\r\n\tX509_policy_node_get0_parent(const X509_POLICY_NODE *node);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/include/openssl/x509v3.h",
    "content": "/* x509v3.h */\r\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\r\n * project 1999.\r\n */\r\n/* ====================================================================\r\n * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer. \r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in\r\n *    the documentation and/or other materials provided with the\r\n *    distribution.\r\n *\r\n * 3. All advertising materials mentioning features or use of this\r\n *    software must display the following acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\r\n *\r\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\r\n *    endorse or promote products derived from this software without\r\n *    prior written permission. For written permission, please contact\r\n *    licensing@OpenSSL.org.\r\n *\r\n * 5. Products derived from this software may not be called \"OpenSSL\"\r\n *    nor may \"OpenSSL\" appear in their names without prior written\r\n *    permission of the OpenSSL Project.\r\n *\r\n * 6. Redistributions of any form whatsoever must retain the following\r\n *    acknowledgment:\r\n *    \"This product includes software developed by the OpenSSL Project\r\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r\n * OF THE POSSIBILITY OF SUCH DAMAGE.\r\n * ====================================================================\r\n *\r\n * This product includes cryptographic software written by Eric Young\r\n * (eay@cryptsoft.com).  This product includes software written by Tim\r\n * Hudson (tjh@cryptsoft.com).\r\n *\r\n */\r\n#ifndef HEADER_X509V3_H\r\n#define HEADER_X509V3_H\r\n\r\n#include <openssl/bio.h>\r\n#include <openssl/x509.h>\r\n#include <openssl/conf.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n/* Forward reference */\r\nstruct v3_ext_method;\r\nstruct v3_ext_ctx;\r\n\r\n/* Useful typedefs */\r\n\r\ntypedef void * (*X509V3_EXT_NEW)(void);\r\ntypedef void (*X509V3_EXT_FREE)(void *);\r\ntypedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long);\r\ntypedef int (*X509V3_EXT_I2D)(void *, unsigned char **);\r\ntypedef STACK_OF(CONF_VALUE) *\r\n  (*X509V3_EXT_I2V)(const struct v3_ext_method *method, void *ext,\r\n\t\t    STACK_OF(CONF_VALUE) *extlist);\r\ntypedef void * (*X509V3_EXT_V2I)(const struct v3_ext_method *method,\r\n\t\t\t\t struct v3_ext_ctx *ctx,\r\n\t\t\t\t STACK_OF(CONF_VALUE) *values);\r\ntypedef char * (*X509V3_EXT_I2S)(const struct v3_ext_method *method, void *ext);\r\ntypedef void * (*X509V3_EXT_S2I)(const struct v3_ext_method *method,\r\n\t\t\t\t struct v3_ext_ctx *ctx, const char *str);\r\ntypedef int (*X509V3_EXT_I2R)(const struct v3_ext_method *method, void *ext,\r\n\t\t\t      BIO *out, int indent);\r\ntypedef void * (*X509V3_EXT_R2I)(const struct v3_ext_method *method,\r\n\t\t\t\t struct v3_ext_ctx *ctx, const char *str);\r\n\r\n/* V3 extension structure */\r\n\r\nstruct v3_ext_method {\r\nint ext_nid;\r\nint ext_flags;\r\n/* If this is set the following four fields are ignored */\r\nASN1_ITEM_EXP *it;\r\n/* Old style ASN1 calls */\r\nX509V3_EXT_NEW ext_new;\r\nX509V3_EXT_FREE ext_free;\r\nX509V3_EXT_D2I d2i;\r\nX509V3_EXT_I2D i2d;\r\n\r\n/* The following pair is used for string extensions */\r\nX509V3_EXT_I2S i2s;\r\nX509V3_EXT_S2I s2i;\r\n\r\n/* The following pair is used for multi-valued extensions */\r\nX509V3_EXT_I2V i2v;\r\nX509V3_EXT_V2I v2i;\r\n\r\n/* The following are used for raw extensions */\r\nX509V3_EXT_I2R i2r;\r\nX509V3_EXT_R2I r2i;\r\n\r\nvoid *usr_data;\t/* Any extension specific data */\r\n};\r\n\r\ntypedef struct X509V3_CONF_METHOD_st {\r\nchar * (*get_string)(void *db, char *section, char *value);\r\nSTACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section);\r\nvoid (*free_string)(void *db, char * string);\r\nvoid (*free_section)(void *db, STACK_OF(CONF_VALUE) *section);\r\n} X509V3_CONF_METHOD;\r\n\r\n/* Context specific info */\r\nstruct v3_ext_ctx {\r\n#define CTX_TEST 0x1\r\nint flags;\r\nX509 *issuer_cert;\r\nX509 *subject_cert;\r\nX509_REQ *subject_req;\r\nX509_CRL *crl;\r\nX509V3_CONF_METHOD *db_meth;\r\nvoid *db;\r\n/* Maybe more here */\r\n};\r\n\r\ntypedef struct v3_ext_method X509V3_EXT_METHOD;\r\n\r\nDECLARE_STACK_OF(X509V3_EXT_METHOD)\r\n\r\n/* ext_flags values */\r\n#define X509V3_EXT_DYNAMIC\t0x1\r\n#define X509V3_EXT_CTX_DEP\t0x2\r\n#define X509V3_EXT_MULTILINE\t0x4\r\n\r\ntypedef BIT_STRING_BITNAME ENUMERATED_NAMES;\r\n\r\ntypedef struct BASIC_CONSTRAINTS_st {\r\nint ca;\r\nASN1_INTEGER *pathlen;\r\n} BASIC_CONSTRAINTS;\r\n\r\n\r\ntypedef struct PKEY_USAGE_PERIOD_st {\r\nASN1_GENERALIZEDTIME *notBefore;\r\nASN1_GENERALIZEDTIME *notAfter;\r\n} PKEY_USAGE_PERIOD;\r\n\r\ntypedef struct otherName_st {\r\nASN1_OBJECT *type_id;\r\nASN1_TYPE *value;\r\n} OTHERNAME;\r\n\r\ntypedef struct EDIPartyName_st {\r\n\tASN1_STRING *nameAssigner;\r\n\tASN1_STRING *partyName;\r\n} EDIPARTYNAME;\r\n\r\ntypedef struct GENERAL_NAME_st {\r\n\r\n#define GEN_OTHERNAME\t0\r\n#define GEN_EMAIL\t1\r\n#define GEN_DNS\t\t2\r\n#define GEN_X400\t3\r\n#define GEN_DIRNAME\t4\r\n#define GEN_EDIPARTY\t5\r\n#define GEN_URI\t\t6\r\n#define GEN_IPADD\t7\r\n#define GEN_RID\t\t8\r\n\r\nint type;\r\nunion {\r\n\tchar *ptr;\r\n\tOTHERNAME *otherName; /* otherName */\r\n\tASN1_IA5STRING *rfc822Name;\r\n\tASN1_IA5STRING *dNSName;\r\n\tASN1_TYPE *x400Address;\r\n\tX509_NAME *directoryName;\r\n\tEDIPARTYNAME *ediPartyName;\r\n\tASN1_IA5STRING *uniformResourceIdentifier;\r\n\tASN1_OCTET_STRING *iPAddress;\r\n\tASN1_OBJECT *registeredID;\r\n\r\n\t/* Old names */\r\n\tASN1_OCTET_STRING *ip; /* iPAddress */\r\n\tX509_NAME *dirn;\t\t/* dirn */\r\n\tASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */\r\n\tASN1_OBJECT *rid; /* registeredID */\r\n\tASN1_TYPE *other; /* x400Address */\r\n} d;\r\n} GENERAL_NAME;\r\n\r\ntypedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;\r\n\r\ntypedef struct ACCESS_DESCRIPTION_st {\r\n\tASN1_OBJECT *method;\r\n\tGENERAL_NAME *location;\r\n} ACCESS_DESCRIPTION;\r\n\r\ntypedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;\r\n\r\ntypedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;\r\n\r\nDECLARE_STACK_OF(GENERAL_NAME)\r\nDECLARE_ASN1_SET_OF(GENERAL_NAME)\r\n\r\nDECLARE_STACK_OF(ACCESS_DESCRIPTION)\r\nDECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)\r\n\r\ntypedef struct DIST_POINT_NAME_st {\r\nint type;\r\nunion {\r\n\tGENERAL_NAMES *fullname;\r\n\tSTACK_OF(X509_NAME_ENTRY) *relativename;\r\n} name;\r\n/* If relativename then this contains the full distribution point name */\r\nX509_NAME *dpname;\r\n} DIST_POINT_NAME;\r\n/* All existing reasons */\r\n#define CRLDP_ALL_REASONS\t0x807f\r\n\r\n#define CRL_REASON_NONE\t\t\t\t-1\r\n#define CRL_REASON_UNSPECIFIED\t\t\t0\r\n#define CRL_REASON_KEY_COMPROMISE\t\t1\r\n#define CRL_REASON_CA_COMPROMISE\t\t2\r\n#define CRL_REASON_AFFILIATION_CHANGED\t\t3\r\n#define CRL_REASON_SUPERSEDED\t\t\t4\r\n#define CRL_REASON_CESSATION_OF_OPERATION\t5\r\n#define CRL_REASON_CERTIFICATE_HOLD\t\t6\r\n#define CRL_REASON_REMOVE_FROM_CRL\t\t8\r\n#define CRL_REASON_PRIVILEGE_WITHDRAWN\t\t9\r\n#define CRL_REASON_AA_COMPROMISE\t\t10\r\n\r\nstruct DIST_POINT_st {\r\nDIST_POINT_NAME\t*distpoint;\r\nASN1_BIT_STRING *reasons;\r\nGENERAL_NAMES *CRLissuer;\r\nint dp_reasons;\r\n};\r\n\r\ntypedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;\r\n\r\nDECLARE_STACK_OF(DIST_POINT)\r\nDECLARE_ASN1_SET_OF(DIST_POINT)\r\n\r\nstruct AUTHORITY_KEYID_st {\r\nASN1_OCTET_STRING *keyid;\r\nGENERAL_NAMES *issuer;\r\nASN1_INTEGER *serial;\r\n};\r\n\r\n/* Strong extranet structures */\r\n\r\ntypedef struct SXNET_ID_st {\r\n\tASN1_INTEGER *zone;\r\n\tASN1_OCTET_STRING *user;\r\n} SXNETID;\r\n\r\nDECLARE_STACK_OF(SXNETID)\r\nDECLARE_ASN1_SET_OF(SXNETID)\r\n\r\ntypedef struct SXNET_st {\r\n\tASN1_INTEGER *version;\r\n\tSTACK_OF(SXNETID) *ids;\r\n} SXNET;\r\n\r\ntypedef struct NOTICEREF_st {\r\n\tASN1_STRING *organization;\r\n\tSTACK_OF(ASN1_INTEGER) *noticenos;\r\n} NOTICEREF;\r\n\r\ntypedef struct USERNOTICE_st {\r\n\tNOTICEREF *noticeref;\r\n\tASN1_STRING *exptext;\r\n} USERNOTICE;\r\n\r\ntypedef struct POLICYQUALINFO_st {\r\n\tASN1_OBJECT *pqualid;\r\n\tunion {\r\n\t\tASN1_IA5STRING *cpsuri;\r\n\t\tUSERNOTICE *usernotice;\r\n\t\tASN1_TYPE *other;\r\n\t} d;\r\n} POLICYQUALINFO;\r\n\r\nDECLARE_STACK_OF(POLICYQUALINFO)\r\nDECLARE_ASN1_SET_OF(POLICYQUALINFO)\r\n\r\ntypedef struct POLICYINFO_st {\r\n\tASN1_OBJECT *policyid;\r\n\tSTACK_OF(POLICYQUALINFO) *qualifiers;\r\n} POLICYINFO;\r\n\r\ntypedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;\r\n\r\nDECLARE_STACK_OF(POLICYINFO)\r\nDECLARE_ASN1_SET_OF(POLICYINFO)\r\n\r\ntypedef struct POLICY_MAPPING_st {\r\n\tASN1_OBJECT *issuerDomainPolicy;\r\n\tASN1_OBJECT *subjectDomainPolicy;\r\n} POLICY_MAPPING;\r\n\r\nDECLARE_STACK_OF(POLICY_MAPPING)\r\n\r\ntypedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;\r\n\r\ntypedef struct GENERAL_SUBTREE_st {\r\n\tGENERAL_NAME *base;\r\n\tASN1_INTEGER *minimum;\r\n\tASN1_INTEGER *maximum;\r\n} GENERAL_SUBTREE;\r\n\r\nDECLARE_STACK_OF(GENERAL_SUBTREE)\r\n\r\nstruct NAME_CONSTRAINTS_st {\r\n\tSTACK_OF(GENERAL_SUBTREE) *permittedSubtrees;\r\n\tSTACK_OF(GENERAL_SUBTREE) *excludedSubtrees;\r\n};\r\n\r\ntypedef struct POLICY_CONSTRAINTS_st {\r\n\tASN1_INTEGER *requireExplicitPolicy;\r\n\tASN1_INTEGER *inhibitPolicyMapping;\r\n} POLICY_CONSTRAINTS;\r\n\r\n/* Proxy certificate structures, see RFC 3820 */\r\ntypedef struct PROXY_POLICY_st\r\n\t{\r\n\tASN1_OBJECT *policyLanguage;\r\n\tASN1_OCTET_STRING *policy;\r\n\t} PROXY_POLICY;\r\n\r\ntypedef struct PROXY_CERT_INFO_EXTENSION_st\r\n\t{\r\n\tASN1_INTEGER *pcPathLengthConstraint;\r\n\tPROXY_POLICY *proxyPolicy;\r\n\t} PROXY_CERT_INFO_EXTENSION;\r\n\r\nDECLARE_ASN1_FUNCTIONS(PROXY_POLICY)\r\nDECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)\r\n\r\nstruct ISSUING_DIST_POINT_st\r\n\t{\r\n\tDIST_POINT_NAME *distpoint;\r\n\tint onlyuser;\r\n\tint onlyCA;\r\n\tASN1_BIT_STRING *onlysomereasons;\r\n\tint indirectCRL;\r\n\tint onlyattr;\r\n\t};\r\n\r\n/* Values in idp_flags field */\r\n/* IDP present */\r\n#define\tIDP_PRESENT\t0x1\r\n/* IDP values inconsistent */\r\n#define IDP_INVALID\t0x2\r\n/* onlyuser true */\r\n#define\tIDP_ONLYUSER\t0x4\r\n/* onlyCA true */\r\n#define\tIDP_ONLYCA\t0x8\r\n/* onlyattr true */\r\n#define IDP_ONLYATTR\t0x10\r\n/* indirectCRL true */\r\n#define IDP_INDIRECT\t0x20\r\n/* onlysomereasons present */\r\n#define IDP_REASONS\t0x40\r\n\r\n#define X509V3_conf_err(val) ERR_add_error_data(6, \"section:\", val->section, \\\r\n\",name:\", val->name, \",value:\", val->value);\r\n\r\n#define X509V3_set_ctx_test(ctx) \\\r\n\t\t\tX509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)\r\n#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;\r\n\r\n#define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \\\r\n\t\t\t0,0,0,0, \\\r\n\t\t\t0,0, \\\r\n\t\t\t(X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \\\r\n\t\t\t(X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \\\r\n\t\t\tNULL, NULL, \\\r\n\t\t\ttable}\r\n\r\n#define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \\\r\n\t\t\t0,0,0,0, \\\r\n\t\t\t(X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \\\r\n\t\t\t(X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \\\r\n\t\t\t0,0,0,0, \\\r\n\t\t\tNULL}\r\n\r\n#define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\r\n\r\n\r\n/* X509_PURPOSE stuff */\r\n\r\n#define EXFLAG_BCONS\t\t0x1\r\n#define EXFLAG_KUSAGE\t\t0x2\r\n#define EXFLAG_XKUSAGE\t\t0x4\r\n#define EXFLAG_NSCERT\t\t0x8\r\n\r\n#define EXFLAG_CA\t\t0x10\r\n/* Really self issued not necessarily self signed */\r\n#define EXFLAG_SI\t\t0x20\r\n#define EXFLAG_SS\t\t0x20\r\n#define EXFLAG_V1\t\t0x40\r\n#define EXFLAG_INVALID\t\t0x80\r\n#define EXFLAG_SET\t\t0x100\r\n#define EXFLAG_CRITICAL\t\t0x200\r\n#define EXFLAG_PROXY\t\t0x400\r\n\r\n#define EXFLAG_INVALID_POLICY\t0x800\r\n#define EXFLAG_FRESHEST\t\t0x1000\r\n\r\n#define KU_DIGITAL_SIGNATURE\t0x0080\r\n#define KU_NON_REPUDIATION\t0x0040\r\n#define KU_KEY_ENCIPHERMENT\t0x0020\r\n#define KU_DATA_ENCIPHERMENT\t0x0010\r\n#define KU_KEY_AGREEMENT\t0x0008\r\n#define KU_KEY_CERT_SIGN\t0x0004\r\n#define KU_CRL_SIGN\t\t0x0002\r\n#define KU_ENCIPHER_ONLY\t0x0001\r\n#define KU_DECIPHER_ONLY\t0x8000\r\n\r\n#define NS_SSL_CLIENT\t\t0x80\r\n#define NS_SSL_SERVER\t\t0x40\r\n#define NS_SMIME\t\t0x20\r\n#define NS_OBJSIGN\t\t0x10\r\n#define NS_SSL_CA\t\t0x04\r\n#define NS_SMIME_CA\t\t0x02\r\n#define NS_OBJSIGN_CA\t\t0x01\r\n#define NS_ANY_CA\t\t(NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)\r\n\r\n#define XKU_SSL_SERVER\t\t0x1\t\r\n#define XKU_SSL_CLIENT\t\t0x2\r\n#define XKU_SMIME\t\t0x4\r\n#define XKU_CODE_SIGN\t\t0x8\r\n#define XKU_SGC\t\t\t0x10\r\n#define XKU_OCSP_SIGN\t\t0x20\r\n#define XKU_TIMESTAMP\t\t0x40\r\n#define XKU_DVCS\t\t0x80\r\n\r\n#define X509_PURPOSE_DYNAMIC\t0x1\r\n#define X509_PURPOSE_DYNAMIC_NAME\t0x2\r\n\r\ntypedef struct x509_purpose_st {\r\n\tint purpose;\r\n\tint trust;\t\t/* Default trust ID */\r\n\tint flags;\r\n\tint (*check_purpose)(const struct x509_purpose_st *,\r\n\t\t\t\tconst X509 *, int);\r\n\tchar *name;\r\n\tchar *sname;\r\n\tvoid *usr_data;\r\n} X509_PURPOSE;\r\n\r\n#define X509_PURPOSE_SSL_CLIENT\t\t1\r\n#define X509_PURPOSE_SSL_SERVER\t\t2\r\n#define X509_PURPOSE_NS_SSL_SERVER\t3\r\n#define X509_PURPOSE_SMIME_SIGN\t\t4\r\n#define X509_PURPOSE_SMIME_ENCRYPT\t5\r\n#define X509_PURPOSE_CRL_SIGN\t\t6\r\n#define X509_PURPOSE_ANY\t\t7\r\n#define X509_PURPOSE_OCSP_HELPER\t8\r\n#define X509_PURPOSE_TIMESTAMP_SIGN\t9\r\n\r\n#define X509_PURPOSE_MIN\t\t1\r\n#define X509_PURPOSE_MAX\t\t9\r\n\r\n/* Flags for X509V3_EXT_print() */\r\n\r\n#define X509V3_EXT_UNKNOWN_MASK\t\t(0xfL << 16)\r\n/* Return error for unknown extensions */\r\n#define X509V3_EXT_DEFAULT\t\t0\r\n/* Print error for unknown extensions */\r\n#define X509V3_EXT_ERROR_UNKNOWN\t(1L << 16)\r\n/* ASN1 parse unknown extensions */\r\n#define X509V3_EXT_PARSE_UNKNOWN\t(2L << 16)\r\n/* BIO_dump unknown extensions */\r\n#define X509V3_EXT_DUMP_UNKNOWN\t\t(3L << 16)\r\n\r\n/* Flags for X509V3_add1_i2d */\r\n\r\n#define X509V3_ADD_OP_MASK\t\t0xfL\r\n#define X509V3_ADD_DEFAULT\t\t0L\r\n#define X509V3_ADD_APPEND\t\t1L\r\n#define X509V3_ADD_REPLACE\t\t2L\r\n#define X509V3_ADD_REPLACE_EXISTING\t3L\r\n#define X509V3_ADD_KEEP_EXISTING\t4L\r\n#define X509V3_ADD_DELETE\t\t5L\r\n#define X509V3_ADD_SILENT\t\t0x10\r\n\r\nDECLARE_STACK_OF(X509_PURPOSE)\r\n\r\nDECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)\r\n\r\nDECLARE_ASN1_FUNCTIONS(SXNET)\r\nDECLARE_ASN1_FUNCTIONS(SXNETID)\r\n\r\nint SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); \r\nint SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); \r\nint SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); \r\n\r\nASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);\r\nASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);\r\nASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);\r\n\r\nDECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)\r\n\r\nDECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)\r\n\r\nDECLARE_ASN1_FUNCTIONS(GENERAL_NAME)\r\nGENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a);\r\nint GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b);\r\n\r\n\r\n\r\nASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,\r\n\t\t\t\tX509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);\r\nSTACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,\r\n\t\t\t\tASN1_BIT_STRING *bits,\r\n\t\t\t\tSTACK_OF(CONF_VALUE) *extlist);\r\n\r\nSTACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);\r\nint GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);\r\n\r\nDECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)\r\n\r\nSTACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,\r\n\t\tGENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);\r\nGENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,\r\n\t\t\t\t X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);\r\n\r\nDECLARE_ASN1_FUNCTIONS(OTHERNAME)\r\nDECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)\r\nint OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b);\r\nvoid GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value);\r\nvoid *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype);\r\nint GENERAL_NAME_set0_othername(GENERAL_NAME *gen,\r\n\t\t\t\tASN1_OBJECT *oid, ASN1_TYPE *value);\r\nint GENERAL_NAME_get0_otherName(GENERAL_NAME *gen, \r\n\t\t\t\tASN1_OBJECT **poid, ASN1_TYPE **pvalue);\r\n\r\nchar *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);\r\nASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str);\r\n\r\nDECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)\r\nint i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a);\r\n\r\nDECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)\r\nDECLARE_ASN1_FUNCTIONS(POLICYINFO)\r\nDECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)\r\nDECLARE_ASN1_FUNCTIONS(USERNOTICE)\r\nDECLARE_ASN1_FUNCTIONS(NOTICEREF)\r\n\r\nDECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)\r\nDECLARE_ASN1_FUNCTIONS(DIST_POINT)\r\nDECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)\r\nDECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT)\r\n\r\nint DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname);\r\n\r\nint NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc);\r\n\r\nDECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)\r\nDECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)\r\n\r\nDECLARE_ASN1_ITEM(POLICY_MAPPING)\r\nDECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)\r\nDECLARE_ASN1_ITEM(POLICY_MAPPINGS)\r\n\r\nDECLARE_ASN1_ITEM(GENERAL_SUBTREE)\r\nDECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)\r\n\r\nDECLARE_ASN1_ITEM(NAME_CONSTRAINTS)\r\nDECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)\r\n\r\nDECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)\r\nDECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)\r\n\r\nGENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,\r\n\t\t\t       const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,\r\n\t\t\t       int gen_type, char *value, int is_nc);\r\n\r\n#ifdef HEADER_CONF_H\r\nGENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,\r\n\t\t\t       CONF_VALUE *cnf);\r\nGENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,\r\n\t\t\t\t  const X509V3_EXT_METHOD *method,\r\n\t\t\t\t  X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);\r\nvoid X509V3_conf_free(CONF_VALUE *val);\r\n\r\nX509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value);\r\nX509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value);\r\nint X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk);\r\nint X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert);\r\nint X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);\r\nint X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);\r\n\r\nX509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,\r\n\t\t\t\t    int ext_nid, char *value);\r\nX509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,\r\n\t\t\t\tchar *name, char *value);\r\nint X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,\r\n\t\t\tchar *section, X509 *cert);\r\nint X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,\r\n\t\t\t    char *section, X509_REQ *req);\r\nint X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,\r\n\t\t\t    char *section, X509_CRL *crl);\r\n\r\nint X509V3_add_value_bool_nf(char *name, int asn1_bool,\r\n\t\t\t     STACK_OF(CONF_VALUE) **extlist);\r\nint X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);\r\nint X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);\r\nvoid X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);\r\nvoid X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash);\r\n#endif\r\n\r\nchar * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);\r\nSTACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section);\r\nvoid X509V3_string_free(X509V3_CTX *ctx, char *str);\r\nvoid X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);\r\nvoid X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,\r\n\t\t\t\t X509_REQ *req, X509_CRL *crl, int flags);\r\n\r\nint X509V3_add_value(const char *name, const char *value,\r\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\r\nint X509V3_add_value_uchar(const char *name, const unsigned char *value,\r\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\r\nint X509V3_add_value_bool(const char *name, int asn1_bool,\r\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\r\nint X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,\r\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\r\nchar * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);\r\nASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);\r\nchar * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);\r\nchar * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);\r\nint X509V3_EXT_add(X509V3_EXT_METHOD *ext);\r\nint X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);\r\nint X509V3_EXT_add_alias(int nid_to, int nid_from);\r\nvoid X509V3_EXT_cleanup(void);\r\n\r\nconst X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);\r\nconst X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);\r\nint X509V3_add_standard_extensions(void);\r\nSTACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);\r\nvoid *X509V3_EXT_d2i(X509_EXTENSION *ext);\r\nvoid *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx);\r\n\r\n\r\nX509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);\r\nint X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags);\r\n\r\nchar *hex_to_string(const unsigned char *buffer, long len);\r\nunsigned char *string_to_hex(const char *str, long *len);\r\nint name_cmp(const char *name, const char *cmp);\r\n\r\nvoid X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,\r\n\t\t\t\t\t\t\t\t int ml);\r\nint X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent);\r\nint X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);\r\n\r\nint X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);\r\n\r\nint X509_check_ca(X509 *x);\r\nint X509_check_purpose(X509 *x, int id, int ca);\r\nint X509_supported_extension(X509_EXTENSION *ex);\r\nint X509_PURPOSE_set(int *p, int purpose);\r\nint X509_check_issued(X509 *issuer, X509 *subject);\r\nint X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid);\r\nint X509_PURPOSE_get_count(void);\r\nX509_PURPOSE * X509_PURPOSE_get0(int idx);\r\nint X509_PURPOSE_get_by_sname(char *sname);\r\nint X509_PURPOSE_get_by_id(int id);\r\nint X509_PURPOSE_add(int id, int trust, int flags,\r\n\t\t\tint (*ck)(const X509_PURPOSE *, const X509 *, int),\r\n\t\t\t\tchar *name, char *sname, void *arg);\r\nchar *X509_PURPOSE_get0_name(X509_PURPOSE *xp);\r\nchar *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);\r\nint X509_PURPOSE_get_trust(X509_PURPOSE *xp);\r\nvoid X509_PURPOSE_cleanup(void);\r\nint X509_PURPOSE_get_id(X509_PURPOSE *);\r\n\r\nSTACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);\r\nSTACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x);\r\nvoid X509_email_free(STACK_OF(OPENSSL_STRING) *sk);\r\nSTACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x);\r\n\r\nASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);\r\nASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);\r\nint a2i_ipadd(unsigned char *ipout, const char *ipasc);\r\nint X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,\r\n\t\t\t\t\t\tunsigned long chtype);\r\n\r\nvoid X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);\r\nDECLARE_STACK_OF(X509_POLICY_NODE)\r\n\r\n#ifndef OPENSSL_NO_RFC3779\r\n\r\ntypedef struct ASRange_st {\r\n  ASN1_INTEGER *min, *max;\r\n} ASRange;\r\n\r\n#define\tASIdOrRange_id\t\t0\r\n#define\tASIdOrRange_range\t1\r\n\r\ntypedef struct ASIdOrRange_st {\r\n  int type;\r\n  union {\r\n    ASN1_INTEGER *id;\r\n    ASRange      *range;\r\n  } u;\r\n} ASIdOrRange;\r\n\r\ntypedef STACK_OF(ASIdOrRange) ASIdOrRanges;\r\nDECLARE_STACK_OF(ASIdOrRange)\r\n\r\n#define\tASIdentifierChoice_inherit\t\t0\r\n#define\tASIdentifierChoice_asIdsOrRanges\t1\r\n\r\ntypedef struct ASIdentifierChoice_st {\r\n  int type;\r\n  union {\r\n    ASN1_NULL    *inherit;\r\n    ASIdOrRanges *asIdsOrRanges;\r\n  } u;\r\n} ASIdentifierChoice;\r\n\r\ntypedef struct ASIdentifiers_st {\r\n  ASIdentifierChoice *asnum, *rdi;\r\n} ASIdentifiers;\r\n\r\nDECLARE_ASN1_FUNCTIONS(ASRange)\r\nDECLARE_ASN1_FUNCTIONS(ASIdOrRange)\r\nDECLARE_ASN1_FUNCTIONS(ASIdentifierChoice)\r\nDECLARE_ASN1_FUNCTIONS(ASIdentifiers)\r\n\r\n\r\ntypedef struct IPAddressRange_st {\r\n  ASN1_BIT_STRING\t*min, *max;\r\n} IPAddressRange;\r\n\r\n#define\tIPAddressOrRange_addressPrefix\t0\r\n#define\tIPAddressOrRange_addressRange\t1\r\n\r\ntypedef struct IPAddressOrRange_st {\r\n  int type;\r\n  union {\r\n    ASN1_BIT_STRING\t*addressPrefix;\r\n    IPAddressRange\t*addressRange;\r\n  } u;\r\n} IPAddressOrRange;\r\n\r\ntypedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;\r\nDECLARE_STACK_OF(IPAddressOrRange)\r\n\r\n#define\tIPAddressChoice_inherit\t\t\t0\r\n#define\tIPAddressChoice_addressesOrRanges\t1\r\n\r\ntypedef struct IPAddressChoice_st {\r\n  int type;\r\n  union {\r\n    ASN1_NULL\t\t*inherit;\r\n    IPAddressOrRanges\t*addressesOrRanges;\r\n  } u;\r\n} IPAddressChoice;\r\n\r\ntypedef struct IPAddressFamily_st {\r\n  ASN1_OCTET_STRING\t*addressFamily;\r\n  IPAddressChoice\t*ipAddressChoice;\r\n} IPAddressFamily;\r\n\r\ntypedef STACK_OF(IPAddressFamily) IPAddrBlocks;\r\nDECLARE_STACK_OF(IPAddressFamily)\r\n\r\nDECLARE_ASN1_FUNCTIONS(IPAddressRange)\r\nDECLARE_ASN1_FUNCTIONS(IPAddressOrRange)\r\nDECLARE_ASN1_FUNCTIONS(IPAddressChoice)\r\nDECLARE_ASN1_FUNCTIONS(IPAddressFamily)\r\n\r\n/*\r\n * API tag for elements of the ASIdentifer SEQUENCE.\r\n */\r\n#define\tV3_ASID_ASNUM\t0\r\n#define\tV3_ASID_RDI\t1\r\n\r\n/*\r\n * AFI values, assigned by IANA.  It'd be nice to make the AFI\r\n * handling code totally generic, but there are too many little things\r\n * that would need to be defined for other address families for it to\r\n * be worth the trouble.\r\n */\r\n#define\tIANA_AFI_IPV4\t1\r\n#define\tIANA_AFI_IPV6\t2\r\n\r\n/*\r\n * Utilities to construct and extract values from RFC3779 extensions,\r\n * since some of the encodings (particularly for IP address prefixes\r\n * and ranges) are a bit tedious to work with directly.\r\n */\r\nint v3_asid_add_inherit(ASIdentifiers *asid, int which);\r\nint v3_asid_add_id_or_range(ASIdentifiers *asid, int which,\r\n\t\t\t    ASN1_INTEGER *min, ASN1_INTEGER *max);\r\nint v3_addr_add_inherit(IPAddrBlocks *addr,\r\n\t\t\tconst unsigned afi, const unsigned *safi);\r\nint v3_addr_add_prefix(IPAddrBlocks *addr,\r\n\t\t       const unsigned afi, const unsigned *safi,\r\n\t\t       unsigned char *a, const int prefixlen);\r\nint v3_addr_add_range(IPAddrBlocks *addr,\r\n\t\t      const unsigned afi, const unsigned *safi,\r\n\t\t      unsigned char *min, unsigned char *max);\r\nunsigned v3_addr_get_afi(const IPAddressFamily *f);\r\nint v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,\r\n\t\t      unsigned char *min, unsigned char *max,\r\n\t\t      const int length);\r\n\r\n/*\r\n * Canonical forms.\r\n */\r\nint v3_asid_is_canonical(ASIdentifiers *asid);\r\nint v3_addr_is_canonical(IPAddrBlocks *addr);\r\nint v3_asid_canonize(ASIdentifiers *asid);\r\nint v3_addr_canonize(IPAddrBlocks *addr);\r\n\r\n/*\r\n * Tests for inheritance and containment.\r\n */\r\nint v3_asid_inherits(ASIdentifiers *asid);\r\nint v3_addr_inherits(IPAddrBlocks *addr);\r\nint v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b);\r\nint v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);\r\n\r\n/*\r\n * Check whether RFC 3779 extensions nest properly in chains.\r\n */\r\nint v3_asid_validate_path(X509_STORE_CTX *);\r\nint v3_addr_validate_path(X509_STORE_CTX *);\r\nint v3_asid_validate_resource_set(STACK_OF(X509) *chain,\r\n\t\t\t\t  ASIdentifiers *ext,\r\n\t\t\t\t  int allow_inheritance);\r\nint v3_addr_validate_resource_set(STACK_OF(X509) *chain,\r\n\t\t\t\t  IPAddrBlocks *ext,\r\n\t\t\t\t  int allow_inheritance);\r\n\r\n#endif /* OPENSSL_NO_RFC3779 */\r\n\r\n/* BEGIN ERROR CODES */\r\n/* The following lines are auto generated by the script mkerr.pl. Any changes\r\n * made after this point may be overwritten when the script is next run.\r\n */\r\nvoid ERR_load_X509V3_strings(void);\r\n\r\n/* Error codes for the X509V3 functions. */\r\n\r\n/* Function codes. */\r\n#define X509V3_F_A2I_GENERAL_NAME\t\t\t 164\r\n#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE\t\t 161\r\n#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL\t 162\r\n#define X509V3_F_COPY_EMAIL\t\t\t\t 122\r\n#define X509V3_F_COPY_ISSUER\t\t\t\t 123\r\n#define X509V3_F_DO_DIRNAME\t\t\t\t 144\r\n#define X509V3_F_DO_EXT_CONF\t\t\t\t 124\r\n#define X509V3_F_DO_EXT_I2D\t\t\t\t 135\r\n#define X509V3_F_DO_EXT_NCONF\t\t\t\t 151\r\n#define X509V3_F_DO_I2V_NAME_CONSTRAINTS\t\t 148\r\n#define X509V3_F_GNAMES_FROM_SECTNAME\t\t\t 156\r\n#define X509V3_F_HEX_TO_STRING\t\t\t\t 111\r\n#define X509V3_F_I2S_ASN1_ENUMERATED\t\t\t 121\r\n#define X509V3_F_I2S_ASN1_IA5STRING\t\t\t 149\r\n#define X509V3_F_I2S_ASN1_INTEGER\t\t\t 120\r\n#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS\t\t 138\r\n#define X509V3_F_NOTICE_SECTION\t\t\t\t 132\r\n#define X509V3_F_NREF_NOS\t\t\t\t 133\r\n#define X509V3_F_POLICY_SECTION\t\t\t\t 131\r\n#define X509V3_F_PROCESS_PCI_VALUE\t\t\t 150\r\n#define X509V3_F_R2I_CERTPOL\t\t\t\t 130\r\n#define X509V3_F_R2I_PCI\t\t\t\t 155\r\n#define X509V3_F_S2I_ASN1_IA5STRING\t\t\t 100\r\n#define X509V3_F_S2I_ASN1_INTEGER\t\t\t 108\r\n#define X509V3_F_S2I_ASN1_OCTET_STRING\t\t\t 112\r\n#define X509V3_F_S2I_ASN1_SKEY_ID\t\t\t 114\r\n#define X509V3_F_S2I_SKEY_ID\t\t\t\t 115\r\n#define X509V3_F_SET_DIST_POINT_NAME\t\t\t 158\r\n#define X509V3_F_STRING_TO_HEX\t\t\t\t 113\r\n#define X509V3_F_SXNET_ADD_ID_ASC\t\t\t 125\r\n#define X509V3_F_SXNET_ADD_ID_INTEGER\t\t\t 126\r\n#define X509V3_F_SXNET_ADD_ID_ULONG\t\t\t 127\r\n#define X509V3_F_SXNET_GET_ID_ASC\t\t\t 128\r\n#define X509V3_F_SXNET_GET_ID_ULONG\t\t\t 129\r\n#define X509V3_F_V2I_ASIDENTIFIERS\t\t\t 163\r\n#define X509V3_F_V2I_ASN1_BIT_STRING\t\t\t 101\r\n#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS\t\t 139\r\n#define X509V3_F_V2I_AUTHORITY_KEYID\t\t\t 119\r\n#define X509V3_F_V2I_BASIC_CONSTRAINTS\t\t\t 102\r\n#define X509V3_F_V2I_CRLD\t\t\t\t 134\r\n#define X509V3_F_V2I_EXTENDED_KEY_USAGE\t\t\t 103\r\n#define X509V3_F_V2I_GENERAL_NAMES\t\t\t 118\r\n#define X509V3_F_V2I_GENERAL_NAME_EX\t\t\t 117\r\n#define X509V3_F_V2I_IDP\t\t\t\t 157\r\n#define X509V3_F_V2I_IPADDRBLOCKS\t\t\t 159\r\n#define X509V3_F_V2I_ISSUER_ALT\t\t\t\t 153\r\n#define X509V3_F_V2I_NAME_CONSTRAINTS\t\t\t 147\r\n#define X509V3_F_V2I_POLICY_CONSTRAINTS\t\t\t 146\r\n#define X509V3_F_V2I_POLICY_MAPPINGS\t\t\t 145\r\n#define X509V3_F_V2I_SUBJECT_ALT\t\t\t 154\r\n#define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL\t\t 160\r\n#define X509V3_F_V3_GENERIC_EXTENSION\t\t\t 116\r\n#define X509V3_F_X509V3_ADD1_I2D\t\t\t 140\r\n#define X509V3_F_X509V3_ADD_VALUE\t\t\t 105\r\n#define X509V3_F_X509V3_EXT_ADD\t\t\t\t 104\r\n#define X509V3_F_X509V3_EXT_ADD_ALIAS\t\t\t 106\r\n#define X509V3_F_X509V3_EXT_CONF\t\t\t 107\r\n#define X509V3_F_X509V3_EXT_I2D\t\t\t\t 136\r\n#define X509V3_F_X509V3_EXT_NCONF\t\t\t 152\r\n#define X509V3_F_X509V3_GET_SECTION\t\t\t 142\r\n#define X509V3_F_X509V3_GET_STRING\t\t\t 143\r\n#define X509V3_F_X509V3_GET_VALUE_BOOL\t\t\t 110\r\n#define X509V3_F_X509V3_PARSE_LIST\t\t\t 109\r\n#define X509V3_F_X509_PURPOSE_ADD\t\t\t 137\r\n#define X509V3_F_X509_PURPOSE_SET\t\t\t 141\r\n\r\n/* Reason codes. */\r\n#define X509V3_R_BAD_IP_ADDRESS\t\t\t\t 118\r\n#define X509V3_R_BAD_OBJECT\t\t\t\t 119\r\n#define X509V3_R_BN_DEC2BN_ERROR\t\t\t 100\r\n#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR\t\t 101\r\n#define X509V3_R_DIRNAME_ERROR\t\t\t\t 149\r\n#define X509V3_R_DISTPOINT_ALREADY_SET\t\t\t 160\r\n#define X509V3_R_DUPLICATE_ZONE_ID\t\t\t 133\r\n#define X509V3_R_ERROR_CONVERTING_ZONE\t\t\t 131\r\n#define X509V3_R_ERROR_CREATING_EXTENSION\t\t 144\r\n#define X509V3_R_ERROR_IN_EXTENSION\t\t\t 128\r\n#define X509V3_R_EXPECTED_A_SECTION_NAME\t\t 137\r\n#define X509V3_R_EXTENSION_EXISTS\t\t\t 145\r\n#define X509V3_R_EXTENSION_NAME_ERROR\t\t\t 115\r\n#define X509V3_R_EXTENSION_NOT_FOUND\t\t\t 102\r\n#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED\t 103\r\n#define X509V3_R_EXTENSION_VALUE_ERROR\t\t\t 116\r\n#define X509V3_R_ILLEGAL_EMPTY_EXTENSION\t\t 151\r\n#define X509V3_R_ILLEGAL_HEX_DIGIT\t\t\t 113\r\n#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG\t\t 152\r\n#define X509V3_R_INVALID_MULTIPLE_RDNS\t\t\t 161\r\n#define X509V3_R_INVALID_ASNUMBER\t\t\t 162\r\n#define X509V3_R_INVALID_ASRANGE\t\t\t 163\r\n#define X509V3_R_INVALID_BOOLEAN_STRING\t\t\t 104\r\n#define X509V3_R_INVALID_EXTENSION_STRING\t\t 105\r\n#define X509V3_R_INVALID_INHERITANCE\t\t\t 165\r\n#define X509V3_R_INVALID_IPADDRESS\t\t\t 166\r\n#define X509V3_R_INVALID_NAME\t\t\t\t 106\r\n#define X509V3_R_INVALID_NULL_ARGUMENT\t\t\t 107\r\n#define X509V3_R_INVALID_NULL_NAME\t\t\t 108\r\n#define X509V3_R_INVALID_NULL_VALUE\t\t\t 109\r\n#define X509V3_R_INVALID_NUMBER\t\t\t\t 140\r\n#define X509V3_R_INVALID_NUMBERS\t\t\t 141\r\n#define X509V3_R_INVALID_OBJECT_IDENTIFIER\t\t 110\r\n#define X509V3_R_INVALID_OPTION\t\t\t\t 138\r\n#define X509V3_R_INVALID_POLICY_IDENTIFIER\t\t 134\r\n#define X509V3_R_INVALID_PROXY_POLICY_SETTING\t\t 153\r\n#define X509V3_R_INVALID_PURPOSE\t\t\t 146\r\n#define X509V3_R_INVALID_SAFI\t\t\t\t 164\r\n#define X509V3_R_INVALID_SECTION\t\t\t 135\r\n#define X509V3_R_INVALID_SYNTAX\t\t\t\t 143\r\n#define X509V3_R_ISSUER_DECODE_ERROR\t\t\t 126\r\n#define X509V3_R_MISSING_VALUE\t\t\t\t 124\r\n#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS\t\t 142\r\n#define X509V3_R_NO_CONFIG_DATABASE\t\t\t 136\r\n#define X509V3_R_NO_ISSUER_CERTIFICATE\t\t\t 121\r\n#define X509V3_R_NO_ISSUER_DETAILS\t\t\t 127\r\n#define X509V3_R_NO_POLICY_IDENTIFIER\t\t\t 139\r\n#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED\t 154\r\n#define X509V3_R_NO_PUBLIC_KEY\t\t\t\t 114\r\n#define X509V3_R_NO_SUBJECT_DETAILS\t\t\t 125\r\n#define X509V3_R_ODD_NUMBER_OF_DIGITS\t\t\t 112\r\n#define X509V3_R_OPERATION_NOT_DEFINED\t\t\t 148\r\n#define X509V3_R_OTHERNAME_ERROR\t\t\t 147\r\n#define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED\t 155\r\n#define X509V3_R_POLICY_PATH_LENGTH\t\t\t 156\r\n#define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED\t 157\r\n#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED\t 158\r\n#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159\r\n#define X509V3_R_SECTION_NOT_FOUND\t\t\t 150\r\n#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS\t\t 122\r\n#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID\t\t 123\r\n#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT\t\t 111\r\n#define X509V3_R_UNKNOWN_EXTENSION\t\t\t 129\r\n#define X509V3_R_UNKNOWN_EXTENSION_NAME\t\t\t 130\r\n#define X509V3_R_UNKNOWN_OPTION\t\t\t\t 120\r\n#define X509V3_R_UNSUPPORTED_OPTION\t\t\t 117\r\n#define X509V3_R_UNSUPPORTED_TYPE\t\t\t 167\r\n#define X509V3_R_USER_TOO_LONG\t\t\t\t 132\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/Win32/openssl/ssl/openssl.cnf",
    "content": "#\r\n# OpenSSL example configuration file.\r\n# This is mostly being used for generation of certificate requests.\r\n#\r\n\r\n# This definition stops the following lines choking if HOME isn't\r\n# defined.\r\nHOME\t\t\t= .\r\nRANDFILE\t\t= $ENV::HOME/.rnd\r\n\r\n# Extra OBJECT IDENTIFIER info:\r\n#oid_file\t\t= $ENV::HOME/.oid\r\noid_section\t\t= new_oids\r\n\r\n# To use this configuration file with the \"-extfile\" option of the\r\n# \"openssl x509\" utility, name here the section containing the\r\n# X.509v3 extensions to use:\r\n# extensions\t\t= \r\n# (Alternatively, use a configuration file that has only\r\n# X.509v3 extensions in its main [= default] section.)\r\n\r\n[ new_oids ]\r\n\r\n# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.\r\n# Add a simple OID like this:\r\n# testoid1=1.2.3.4\r\n# Or use config file substitution like this:\r\n# testoid2=${testoid1}.5.6\r\n\r\n# Policies used by the TSA examples.\r\ntsa_policy1 = 1.2.3.4.1\r\ntsa_policy2 = 1.2.3.4.5.6\r\ntsa_policy3 = 1.2.3.4.5.7\r\n\r\n####################################################################\r\n[ ca ]\r\ndefault_ca\t= CA_default\t\t# The default ca section\r\n\r\n####################################################################\r\n[ CA_default ]\r\n\r\ndir\t\t= ./demoCA\t\t# Where everything is kept\r\ncerts\t\t= $dir/certs\t\t# Where the issued certs are kept\r\ncrl_dir\t\t= $dir/crl\t\t# Where the issued crl are kept\r\ndatabase\t= $dir/index.txt\t# database index file.\r\n#unique_subject\t= no\t\t\t# Set to 'no' to allow creation of\r\n\t\t\t\t\t# several ctificates with same subject.\r\nnew_certs_dir\t= $dir/newcerts\t\t# default place for new certs.\r\n\r\ncertificate\t= $dir/cacert.pem \t# The CA certificate\r\nserial\t\t= $dir/serial \t\t# The current serial number\r\ncrlnumber\t= $dir/crlnumber\t# the current crl number\r\n\t\t\t\t\t# must be commented out to leave a V1 CRL\r\ncrl\t\t= $dir/crl.pem \t\t# The current CRL\r\nprivate_key\t= $dir/private/cakey.pem# The private key\r\nRANDFILE\t= $dir/private/.rand\t# private random number file\r\n\r\nx509_extensions\t= usr_cert\t\t# The extentions to add to the cert\r\n\r\n# Comment out the following two lines for the \"traditional\"\r\n# (and highly broken) format.\r\nname_opt \t= ca_default\t\t# Subject Name options\r\ncert_opt \t= ca_default\t\t# Certificate field options\r\n\r\n# Extension copying option: use with caution.\r\n# copy_extensions = copy\r\n\r\n# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs\r\n# so this is commented out by default to leave a V1 CRL.\r\n# crlnumber must also be commented out to leave a V1 CRL.\r\n# crl_extensions\t= crl_ext\r\n\r\ndefault_days\t= 365\t\t\t# how long to certify for\r\ndefault_crl_days= 30\t\t\t# how long before next CRL\r\ndefault_md\t= default\t\t# use public key default MD\r\npreserve\t= no\t\t\t# keep passed DN ordering\r\n\r\n# A few difference way of specifying how similar the request should look\r\n# For type CA, the listed attributes must be the same, and the optional\r\n# and supplied fields are just that :-)\r\npolicy\t\t= policy_match\r\n\r\n# For the CA policy\r\n[ policy_match ]\r\ncountryName\t\t= match\r\nstateOrProvinceName\t= match\r\norganizationName\t= match\r\norganizationalUnitName\t= optional\r\ncommonName\t\t= supplied\r\nemailAddress\t\t= optional\r\n\r\n# For the 'anything' policy\r\n# At this point in time, you must list all acceptable 'object'\r\n# types.\r\n[ policy_anything ]\r\ncountryName\t\t= optional\r\nstateOrProvinceName\t= optional\r\nlocalityName\t\t= optional\r\norganizationName\t= optional\r\norganizationalUnitName\t= optional\r\ncommonName\t\t= supplied\r\nemailAddress\t\t= optional\r\n\r\n####################################################################\r\n[ req ]\r\ndefault_bits\t\t= 1024\r\ndefault_keyfile \t= privkey.pem\r\ndistinguished_name\t= req_distinguished_name\r\nattributes\t\t= req_attributes\r\nx509_extensions\t= v3_ca\t# The extentions to add to the self signed cert\r\n\r\n# Passwords for private keys if not present they will be prompted for\r\n# input_password = secret\r\n# output_password = secret\r\n\r\n# This sets a mask for permitted string types. There are several options. \r\n# default: PrintableString, T61String, BMPString.\r\n# pkix\t : PrintableString, BMPString (PKIX recommendation before 2004)\r\n# utf8only: only UTF8Strings (PKIX recommendation after 2004).\r\n# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).\r\n# MASK:XXXX a literal mask value.\r\n# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.\r\nstring_mask = utf8only\r\n\r\n# req_extensions = v3_req # The extensions to add to a certificate request\r\n\r\n[ req_distinguished_name ]\r\ncountryName\t\t\t= Country Name (2 letter code)\r\ncountryName_default\t\t= AU\r\ncountryName_min\t\t\t= 2\r\ncountryName_max\t\t\t= 2\r\n\r\nstateOrProvinceName\t\t= State or Province Name (full name)\r\nstateOrProvinceName_default\t= Some-State\r\n\r\nlocalityName\t\t\t= Locality Name (eg, city)\r\n\r\n0.organizationName\t\t= Organization Name (eg, company)\r\n0.organizationName_default\t= Internet Widgits Pty Ltd\r\n\r\n# we can do this but it is not needed normally :-)\r\n#1.organizationName\t\t= Second Organization Name (eg, company)\r\n#1.organizationName_default\t= World Wide Web Pty Ltd\r\n\r\norganizationalUnitName\t\t= Organizational Unit Name (eg, section)\r\n#organizationalUnitName_default\t=\r\n\r\ncommonName\t\t\t= Common Name (e.g. server FQDN or YOUR name)\r\ncommonName_max\t\t\t= 64\r\n\r\nemailAddress\t\t\t= Email Address\r\nemailAddress_max\t\t= 64\r\n\r\n# SET-ex3\t\t\t= SET extension number 3\r\n\r\n[ req_attributes ]\r\nchallengePassword\t\t= A challenge password\r\nchallengePassword_min\t\t= 4\r\nchallengePassword_max\t\t= 20\r\n\r\nunstructuredName\t\t= An optional company name\r\n\r\n[ usr_cert ]\r\n\r\n# These extensions are added when 'ca' signs a request.\r\n\r\n# This goes against PKIX guidelines but some CAs do it and some software\r\n# requires this to avoid interpreting an end user certificate as a CA.\r\n\r\nbasicConstraints=CA:FALSE\r\n\r\n# Here are some examples of the usage of nsCertType. If it is omitted\r\n# the certificate can be used for anything *except* object signing.\r\n\r\n# This is OK for an SSL server.\r\n# nsCertType\t\t\t= server\r\n\r\n# For an object signing certificate this would be used.\r\n# nsCertType = objsign\r\n\r\n# For normal client use this is typical\r\n# nsCertType = client, email\r\n\r\n# and for everything including object signing:\r\n# nsCertType = client, email, objsign\r\n\r\n# This is typical in keyUsage for a client certificate.\r\n# keyUsage = nonRepudiation, digitalSignature, keyEncipherment\r\n\r\n# This will be displayed in Netscape's comment listbox.\r\nnsComment\t\t\t= \"OpenSSL Generated Certificate\"\r\n\r\n# PKIX recommendations harmless if included in all certificates.\r\nsubjectKeyIdentifier=hash\r\nauthorityKeyIdentifier=keyid,issuer\r\n\r\n# This stuff is for subjectAltName and issuerAltname.\r\n# Import the email address.\r\n# subjectAltName=email:copy\r\n# An alternative to produce certificates that aren't\r\n# deprecated according to PKIX.\r\n# subjectAltName=email:move\r\n\r\n# Copy subject details\r\n# issuerAltName=issuer:copy\r\n\r\n#nsCaRevocationUrl\t\t= http://www.domain.dom/ca-crl.pem\r\n#nsBaseUrl\r\n#nsRevocationUrl\r\n#nsRenewalUrl\r\n#nsCaPolicyUrl\r\n#nsSslServerName\r\n\r\n# This is required for TSA certificates.\r\n# extendedKeyUsage = critical,timeStamping\r\n\r\n[ v3_req ]\r\n\r\n# Extensions to add to a certificate request\r\n\r\nbasicConstraints = CA:FALSE\r\nkeyUsage = nonRepudiation, digitalSignature, keyEncipherment\r\n\r\n[ v3_ca ]\r\n\r\n\r\n# Extensions for a typical CA\r\n\r\n\r\n# PKIX recommendation.\r\n\r\nsubjectKeyIdentifier=hash\r\n\r\nauthorityKeyIdentifier=keyid:always,issuer\r\n\r\n# This is what PKIX recommends but some broken software chokes on critical\r\n# extensions.\r\n#basicConstraints = critical,CA:true\r\n# So we do this instead.\r\nbasicConstraints = CA:true\r\n\r\n# Key usage: this is typical for a CA certificate. However since it will\r\n# prevent it being used as an test self-signed certificate it is best\r\n# left out by default.\r\n# keyUsage = cRLSign, keyCertSign\r\n\r\n# Some might want this also\r\n# nsCertType = sslCA, emailCA\r\n\r\n# Include email address in subject alt name: another PKIX recommendation\r\n# subjectAltName=email:copy\r\n# Copy issuer details\r\n# issuerAltName=issuer:copy\r\n\r\n# DER hex encoding of an extension: beware experts only!\r\n# obj=DER:02:03\r\n# Where 'obj' is a standard or added object\r\n# You can even override a supported extension:\r\n# basicConstraints= critical, DER:30:03:01:01:FF\r\n\r\n[ crl_ext ]\r\n\r\n# CRL extensions.\r\n# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.\r\n\r\n# issuerAltName=issuer:copy\r\nauthorityKeyIdentifier=keyid:always\r\n\r\n[ proxy_cert_ext ]\r\n# These extensions should be added when creating a proxy certificate\r\n\r\n# This goes against PKIX guidelines but some CAs do it and some software\r\n# requires this to avoid interpreting an end user certificate as a CA.\r\n\r\nbasicConstraints=CA:FALSE\r\n\r\n# Here are some examples of the usage of nsCertType. If it is omitted\r\n# the certificate can be used for anything *except* object signing.\r\n\r\n# This is OK for an SSL server.\r\n# nsCertType\t\t\t= server\r\n\r\n# For an object signing certificate this would be used.\r\n# nsCertType = objsign\r\n\r\n# For normal client use this is typical\r\n# nsCertType = client, email\r\n\r\n# and for everything including object signing:\r\n# nsCertType = client, email, objsign\r\n\r\n# This is typical in keyUsage for a client certificate.\r\n# keyUsage = nonRepudiation, digitalSignature, keyEncipherment\r\n\r\n# This will be displayed in Netscape's comment listbox.\r\nnsComment\t\t\t= \"OpenSSL Generated Certificate\"\r\n\r\n# PKIX recommendations harmless if included in all certificates.\r\nsubjectKeyIdentifier=hash\r\nauthorityKeyIdentifier=keyid,issuer\r\n\r\n# This stuff is for subjectAltName and issuerAltname.\r\n# Import the email address.\r\n# subjectAltName=email:copy\r\n# An alternative to produce certificates that aren't\r\n# deprecated according to PKIX.\r\n# subjectAltName=email:move\r\n\r\n# Copy subject details\r\n# issuerAltName=issuer:copy\r\n\r\n#nsCaRevocationUrl\t\t= http://www.domain.dom/ca-crl.pem\r\n#nsBaseUrl\r\n#nsRevocationUrl\r\n#nsRenewalUrl\r\n#nsCaPolicyUrl\r\n#nsSslServerName\r\n\r\n# This really needs to be in place for it to be a proxy certificate.\r\nproxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo\r\n\r\n####################################################################\r\n[ tsa ]\r\n\r\ndefault_tsa = tsa_config1\t# the default TSA section\r\n\r\n[ tsa_config1 ]\r\n\r\n# These are used by the TSA reply generation only.\r\ndir\t\t= ./demoCA\t\t# TSA root directory\r\nserial\t\t= $dir/tsaserial\t# The current serial number (mandatory)\r\ncrypto_device\t= builtin\t\t# OpenSSL engine to use for signing\r\nsigner_cert\t= $dir/tsacert.pem \t# The TSA signing certificate\r\n\t\t\t\t\t# (optional)\r\ncerts\t\t= $dir/cacert.pem\t# Certificate chain to include in reply\r\n\t\t\t\t\t# (optional)\r\nsigner_key\t= $dir/private/tsakey.pem # The TSA private key (optional)\r\n\r\ndefault_policy\t= tsa_policy1\t\t# Policy if request did not specify it\r\n\t\t\t\t\t# (optional)\r\nother_policies\t= tsa_policy2, tsa_policy3\t# acceptable policies (optional)\r\ndigests\t\t= md5, sha1\t\t# Acceptable message digests (mandatory)\r\naccuracy\t= secs:1, millisecs:500, microsecs:100\t# (optional)\r\nclock_precision_digits  = 0\t# number of digits after dot. (optional)\r\nordering\t\t= yes\t# Is ordering defined for timestamps?\r\n\t\t\t\t# (optional, default: no)\r\ntsa_name\t\t= yes\t# Must the TSA name be included in the reply?\r\n\t\t\t\t# (optional, default: no)\r\ness_cert_id_chain\t= no\t# Must the ESS cert id chain be included?\r\n\t\t\t\t# (optional, default: no)\r\n"
  },
  {
    "path": "Engine/porting/Win32/res.rc",
    "content": "PLAYGROUND ICON DISCARDABLE \"Playground.ico\"\r\n"
  },
  {
    "path": "Engine/porting/Win32/stdafx.cpp",
    "content": "// stdafx.cpp : source file that includes just the standard includes\r\n// GameLibraryWin32.pch will be the pre-compiled header\r\n// stdafx.obj will contain the pre-compiled type information\r\n\r\n#include \"stdafx.h\"\r\n\r\n// TODO: reference any additional headers you need in STDAFX.H\r\n// and not in this file\r\n"
  },
  {
    "path": "Engine/porting/Win32/stdafx.h",
    "content": "// stdafx.h : include file for standard system include files,\r\n// or project specific include files that are used frequently, but\r\n// are changed infrequently\r\n//\r\n\r\n#pragma once\r\n\r\n#include \"targetver.h\"\r\n\r\n#include <stdio.h>\r\n#include <tchar.h>\r\n\r\n\r\n\r\n// TODO: reference additional headers your program requires here\r\n"
  },
  {
    "path": "Engine/porting/Win32/targetver.h",
    "content": "#pragma once\r\n\r\n// Including SDKDDKVer.h defines the highest available Windows platform.\r\n\r\n// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and\r\n// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.\r\n\r\n#include <SDKDDKVer.h>\r\n"
  },
  {
    "path": "Engine/porting/Win32/zlib/include/zconf.h",
    "content": "/* zconf.h -- configuration of the zlib compression library\r\n * Copyright (C) 1995-2012 Jean-loup Gailly.\r\n * For conditions of distribution and use, see copyright notice in zlib.h\r\n */\r\n\r\n/* @(#) $Id$ */\r\n\r\n#ifndef ZCONF_H\r\n#define ZCONF_H\r\n\r\n/*\r\n * If you *really* need a unique prefix for all types and library functions,\r\n * compile with -DZ_PREFIX. The \"standard\" zlib should be compiled without it.\r\n * Even better than compiling with -DZ_PREFIX would be to use configure to set\r\n * this permanently in zconf.h using \"./configure --zprefix\".\r\n */\r\n#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */\r\n#  define Z_PREFIX_SET\r\n\r\n/* all linked symbols */\r\n#  define _dist_code            z__dist_code\r\n#  define _length_code          z__length_code\r\n#  define _tr_align             z__tr_align\r\n#  define _tr_flush_block       z__tr_flush_block\r\n#  define _tr_init              z__tr_init\r\n#  define _tr_stored_block      z__tr_stored_block\r\n#  define _tr_tally             z__tr_tally\r\n#  define adler32               z_adler32\r\n#  define adler32_combine       z_adler32_combine\r\n#  define adler32_combine64     z_adler32_combine64\r\n#  ifndef Z_SOLO\r\n#    define compress              z_compress\r\n#    define compress2             z_compress2\r\n#    define compressBound         z_compressBound\r\n#  endif\r\n#  define crc32                 z_crc32\r\n#  define crc32_combine         z_crc32_combine\r\n#  define crc32_combine64       z_crc32_combine64\r\n#  define deflate               z_deflate\r\n#  define deflateBound          z_deflateBound\r\n#  define deflateCopy           z_deflateCopy\r\n#  define deflateEnd            z_deflateEnd\r\n#  define deflateInit2_         z_deflateInit2_\r\n#  define deflateInit_          z_deflateInit_\r\n#  define deflateParams         z_deflateParams\r\n#  define deflatePending        z_deflatePending\r\n#  define deflatePrime          z_deflatePrime\r\n#  define deflateReset          z_deflateReset\r\n#  define deflateResetKeep      z_deflateResetKeep\r\n#  define deflateSetDictionary  z_deflateSetDictionary\r\n#  define deflateSetHeader      z_deflateSetHeader\r\n#  define deflateTune           z_deflateTune\r\n#  define deflate_copyright     z_deflate_copyright\r\n#  define get_crc_table         z_get_crc_table\r\n#  ifndef Z_SOLO\r\n#    define gz_error              z_gz_error\r\n#    define gz_intmax             z_gz_intmax\r\n#    define gz_strwinerror        z_gz_strwinerror\r\n#    define gzbuffer              z_gzbuffer\r\n#    define gzclearerr            z_gzclearerr\r\n#    define gzclose               z_gzclose\r\n#    define gzclose_r             z_gzclose_r\r\n#    define gzclose_w             z_gzclose_w\r\n#    define gzdirect              z_gzdirect\r\n#    define gzdopen               z_gzdopen\r\n#    define gzeof                 z_gzeof\r\n#    define gzerror               z_gzerror\r\n#    define gzflush               z_gzflush\r\n#    define gzgetc                z_gzgetc\r\n#    define gzgetc_               z_gzgetc_\r\n#    define gzgets                z_gzgets\r\n#    define gzoffset              z_gzoffset\r\n#    define gzoffset64            z_gzoffset64\r\n#    define gzopen                z_gzopen\r\n#    define gzopen64              z_gzopen64\r\n#    ifdef _WIN32\r\n#      define gzopen_w              z_gzopen_w\r\n#    endif\r\n#    define gzprintf              z_gzprintf\r\n#    define gzputc                z_gzputc\r\n#    define gzputs                z_gzputs\r\n#    define gzread                z_gzread\r\n#    define gzrewind              z_gzrewind\r\n#    define gzseek                z_gzseek\r\n#    define gzseek64              z_gzseek64\r\n#    define gzsetparams           z_gzsetparams\r\n#    define gztell                z_gztell\r\n#    define gztell64              z_gztell64\r\n#    define gzungetc              z_gzungetc\r\n#    define gzwrite               z_gzwrite\r\n#  endif\r\n#  define inflate               z_inflate\r\n#  define inflateBack           z_inflateBack\r\n#  define inflateBackEnd        z_inflateBackEnd\r\n#  define inflateBackInit_      z_inflateBackInit_\r\n#  define inflateCopy           z_inflateCopy\r\n#  define inflateEnd            z_inflateEnd\r\n#  define inflateGetHeader      z_inflateGetHeader\r\n#  define inflateInit2_         z_inflateInit2_\r\n#  define inflateInit_          z_inflateInit_\r\n#  define inflateMark           z_inflateMark\r\n#  define inflatePrime          z_inflatePrime\r\n#  define inflateReset          z_inflateReset\r\n#  define inflateReset2         z_inflateReset2\r\n#  define inflateSetDictionary  z_inflateSetDictionary\r\n#  define inflateSync           z_inflateSync\r\n#  define inflateSyncPoint      z_inflateSyncPoint\r\n#  define inflateUndermine      z_inflateUndermine\r\n#  define inflateResetKeep      z_inflateResetKeep\r\n#  define inflate_copyright     z_inflate_copyright\r\n#  define inflate_fast          z_inflate_fast\r\n#  define inflate_table         z_inflate_table\r\n#  ifndef Z_SOLO\r\n#    define uncompress            z_uncompress\r\n#  endif\r\n#  define zError                z_zError\r\n#  ifndef Z_SOLO\r\n#    define zcalloc               z_zcalloc\r\n#    define zcfree                z_zcfree\r\n#  endif\r\n#  define zlibCompileFlags      z_zlibCompileFlags\r\n#  define zlibVersion           z_zlibVersion\r\n\r\n/* all zlib typedefs in zlib.h and zconf.h */\r\n#  define Byte                  z_Byte\r\n#  define Bytef                 z_Bytef\r\n#  define alloc_func            z_alloc_func\r\n#  define charf                 z_charf\r\n#  define free_func             z_free_func\r\n#  ifndef Z_SOLO\r\n#    define gzFile                z_gzFile\r\n#  endif\r\n#  define gz_header             z_gz_header\r\n#  define gz_headerp            z_gz_headerp\r\n#  define in_func               z_in_func\r\n#  define intf                  z_intf\r\n#  define out_func              z_out_func\r\n#  define uInt                  z_uInt\r\n#  define uIntf                 z_uIntf\r\n#  define uLong                 z_uLong\r\n#  define uLongf                z_uLongf\r\n#  define voidp                 z_voidp\r\n#  define voidpc                z_voidpc\r\n#  define voidpf                z_voidpf\r\n\r\n/* all zlib structs in zlib.h and zconf.h */\r\n#  define gz_header_s           z_gz_header_s\r\n#  define internal_state        z_internal_state\r\n\r\n#endif\r\n\r\n#if defined(__MSDOS__) && !defined(MSDOS)\r\n#  define MSDOS\r\n#endif\r\n#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)\r\n#  define OS2\r\n#endif\r\n#if defined(_WINDOWS) && !defined(WINDOWS)\r\n#  define WINDOWS\r\n#endif\r\n#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)\r\n#  ifndef WIN32\r\n#    define WIN32\r\n#  endif\r\n#endif\r\n#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)\r\n#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)\r\n#    ifndef SYS16BIT\r\n#      define SYS16BIT\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n/*\r\n * Compile with -DMAXSEG_64K if the alloc function cannot allocate more\r\n * than 64k bytes at a time (needed on systems with 16-bit int).\r\n */\r\n#ifdef SYS16BIT\r\n#  define MAXSEG_64K\r\n#endif\r\n#ifdef MSDOS\r\n#  define UNALIGNED_OK\r\n#endif\r\n\r\n#ifdef __STDC_VERSION__\r\n#  ifndef STDC\r\n#    define STDC\r\n#  endif\r\n#  if __STDC_VERSION__ >= 199901L\r\n#    ifndef STDC99\r\n#      define STDC99\r\n#    endif\r\n#  endif\r\n#endif\r\n#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))\r\n#  define STDC\r\n#endif\r\n#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))\r\n#  define STDC\r\n#endif\r\n#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))\r\n#  define STDC\r\n#endif\r\n#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))\r\n#  define STDC\r\n#endif\r\n\r\n#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */\r\n#  define STDC\r\n#endif\r\n\r\n#ifndef STDC\r\n#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */\r\n#    define const       /* note: need a more gentle solution here */\r\n#  endif\r\n#endif\r\n\r\n#if defined(ZLIB_CONST) && !defined(z_const)\r\n#  define z_const const\r\n#else\r\n#  define z_const\r\n#endif\r\n\r\n/* Some Mac compilers merge all .h files incorrectly: */\r\n#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)\r\n#  define NO_DUMMY_DECL\r\n#endif\r\n\r\n/* Maximum value for memLevel in deflateInit2 */\r\n#ifndef MAX_MEM_LEVEL\r\n#  ifdef MAXSEG_64K\r\n#    define MAX_MEM_LEVEL 8\r\n#  else\r\n#    define MAX_MEM_LEVEL 9\r\n#  endif\r\n#endif\r\n\r\n/* Maximum value for windowBits in deflateInit2 and inflateInit2.\r\n * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files\r\n * created by gzip. (Files created by minigzip can still be extracted by\r\n * gzip.)\r\n */\r\n#ifndef MAX_WBITS\r\n#  define MAX_WBITS   15 /* 32K LZ77 window */\r\n#endif\r\n\r\n/* The memory requirements for deflate are (in bytes):\r\n            (1 << (windowBits+2)) +  (1 << (memLevel+9))\r\n that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)\r\n plus a few kilobytes for small objects. For example, if you want to reduce\r\n the default memory requirements from 256K to 128K, compile with\r\n     make CFLAGS=\"-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7\"\r\n Of course this will generally degrade compression (there's no free lunch).\r\n\r\n   The memory requirements for inflate are (in bytes) 1 << windowBits\r\n that is, 32K for windowBits=15 (default value) plus a few kilobytes\r\n for small objects.\r\n*/\r\n\r\n                        /* Type declarations */\r\n\r\n#ifndef OF /* function prototypes */\r\n#  ifdef STDC\r\n#    define OF(args)  args\r\n#  else\r\n#    define OF(args)  ()\r\n#  endif\r\n#endif\r\n\r\n#ifndef Z_ARG /* function prototypes for stdarg */\r\n#  if defined(STDC) || defined(Z_HAVE_STDARG_H)\r\n#    define Z_ARG(args)  args\r\n#  else\r\n#    define Z_ARG(args)  ()\r\n#  endif\r\n#endif\r\n\r\n/* The following definitions for FAR are needed only for MSDOS mixed\r\n * model programming (small or medium model with some far allocations).\r\n * This was tested only with MSC; for other MSDOS compilers you may have\r\n * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,\r\n * just define FAR to be empty.\r\n */\r\n#ifdef SYS16BIT\r\n#  if defined(M_I86SM) || defined(M_I86MM)\r\n     /* MSC small or medium model */\r\n#    define SMALL_MEDIUM\r\n#    ifdef _MSC_VER\r\n#      define FAR _far\r\n#    else\r\n#      define FAR far\r\n#    endif\r\n#  endif\r\n#  if (defined(__SMALL__) || defined(__MEDIUM__))\r\n     /* Turbo C small or medium model */\r\n#    define SMALL_MEDIUM\r\n#    ifdef __BORLANDC__\r\n#      define FAR _far\r\n#    else\r\n#      define FAR far\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#if defined(WINDOWS) || defined(WIN32)\r\n   /* If building or using zlib as a DLL, define ZLIB_DLL.\r\n    * This is not mandatory, but it offers a little performance increase.\r\n    */\r\n#  ifdef ZLIB_DLL\r\n#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))\r\n#      ifdef ZLIB_INTERNAL\r\n#        define ZEXTERN extern __declspec(dllexport)\r\n#      else\r\n#        define ZEXTERN extern __declspec(dllimport)\r\n#      endif\r\n#    endif\r\n#  endif  /* ZLIB_DLL */\r\n   /* If building or using zlib with the WINAPI/WINAPIV calling convention,\r\n    * define ZLIB_WINAPI.\r\n    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.\r\n    */\r\n#  ifdef ZLIB_WINAPI\r\n#    ifdef FAR\r\n#      undef FAR\r\n#    endif\r\n#    include <windows.h>\r\n     /* No need for _export, use ZLIB.DEF instead. */\r\n     /* For complete Windows compatibility, use WINAPI, not __stdcall. */\r\n#    define ZEXPORT WINAPI\r\n#    ifdef WIN32\r\n#      define ZEXPORTVA WINAPIV\r\n#    else\r\n#      define ZEXPORTVA FAR CDECL\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#if defined (__BEOS__)\r\n#  ifdef ZLIB_DLL\r\n#    ifdef ZLIB_INTERNAL\r\n#      define ZEXPORT   __declspec(dllexport)\r\n#      define ZEXPORTVA __declspec(dllexport)\r\n#    else\r\n#      define ZEXPORT   __declspec(dllimport)\r\n#      define ZEXPORTVA __declspec(dllimport)\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#ifndef ZEXTERN\r\n#  define ZEXTERN extern\r\n#endif\r\n#ifndef ZEXPORT\r\n#  define ZEXPORT\r\n#endif\r\n#ifndef ZEXPORTVA\r\n#  define ZEXPORTVA\r\n#endif\r\n\r\n#ifndef FAR\r\n#  define FAR\r\n#endif\r\n\r\n#if !defined(__MACTYPES__)\r\ntypedef unsigned char  Byte;  /* 8 bits */\r\n#endif\r\ntypedef unsigned int   uInt;  /* 16 bits or more */\r\ntypedef unsigned long  uLong; /* 32 bits or more */\r\n\r\n#ifdef SMALL_MEDIUM\r\n   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */\r\n#  define Bytef Byte FAR\r\n#else\r\n   typedef Byte  FAR Bytef;\r\n#endif\r\ntypedef char  FAR charf;\r\ntypedef int   FAR intf;\r\ntypedef uInt  FAR uIntf;\r\ntypedef uLong FAR uLongf;\r\n\r\n#ifdef STDC\r\n   typedef void const *voidpc;\r\n   typedef void FAR   *voidpf;\r\n   typedef void       *voidp;\r\n#else\r\n   typedef Byte const *voidpc;\r\n   typedef Byte FAR   *voidpf;\r\n   typedef Byte       *voidp;\r\n#endif\r\n\r\n/* ./configure may #define Z_U4 here */\r\n\r\n#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)\r\n#  include <limits.h>\r\n#  if (UINT_MAX == 0xffffffffUL)\r\n#    define Z_U4 unsigned\r\n#  else\r\n#    if (ULONG_MAX == 0xffffffffUL)\r\n#      define Z_U4 unsigned long\r\n#    else\r\n#      if (USHRT_MAX == 0xffffffffUL)\r\n#        define Z_U4 unsigned short\r\n#      endif\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#ifdef Z_U4\r\n   typedef Z_U4 z_crc_t;\r\n#else\r\n   typedef unsigned long z_crc_t;\r\n#endif\r\n\r\n#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */\r\n#  define Z_HAVE_UNISTD_H\r\n#endif\r\n\r\n#ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */\r\n#  define Z_HAVE_STDARG_H\r\n#endif\r\n\r\n#ifdef STDC\r\n#  ifndef Z_SOLO\r\n#    include <sys/types.h>      /* for off_t */\r\n#  endif\r\n#endif\r\n\r\n#ifdef _WIN32\r\n#  include <stddef.h>           /* for wchar_t */\r\n#endif\r\n\r\n/* a little trick to accommodate both \"#define _LARGEFILE64_SOURCE\" and\r\n * \"#define _LARGEFILE64_SOURCE 1\" as requesting 64-bit operations, (even\r\n * though the former does not conform to the LFS document), but considering\r\n * both \"#undef _LARGEFILE64_SOURCE\" and \"#define _LARGEFILE64_SOURCE 0\" as\r\n * equivalently requesting no 64-bit operations\r\n */\r\n#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1\r\n#  undef _LARGEFILE64_SOURCE\r\n#endif\r\n\r\n#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)\r\n#  define Z_HAVE_UNISTD_H\r\n#endif\r\n#ifndef Z_SOLO\r\n#  if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE)\r\n#    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */\r\n#    ifdef VMS\r\n#      include <unixio.h>       /* for off_t */\r\n#    endif\r\n#    ifndef z_off_t\r\n#      define z_off_t off_t\r\n#    endif\r\n#  endif\r\n#endif\r\n\r\n#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0\r\n#  define Z_LFS64\r\n#endif\r\n\r\n#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)\r\n#  define Z_LARGE64\r\n#endif\r\n\r\n#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)\r\n#  define Z_WANT64\r\n#endif\r\n\r\n#if !defined(SEEK_SET) && !defined(Z_SOLO)\r\n#  define SEEK_SET        0       /* Seek from beginning of file.  */\r\n#  define SEEK_CUR        1       /* Seek from current position.  */\r\n#  define SEEK_END        2       /* Set file pointer to EOF plus \"offset\" */\r\n#endif\r\n\r\n#ifndef z_off_t\r\n#  define z_off_t long\r\n#endif\r\n\r\n#if !defined(_WIN32) && defined(Z_LARGE64)\r\n#  define z_off64_t off64_t\r\n#else\r\n#  if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)\r\n#    define z_off64_t __int64\r\n#  else\r\n#    define z_off64_t z_off_t\r\n#  endif\r\n#endif\r\n\r\n/* MVS linker does not support external names larger than 8 bytes */\r\n#if defined(__MVS__)\r\n  #pragma map(deflateInit_,\"DEIN\")\r\n  #pragma map(deflateInit2_,\"DEIN2\")\r\n  #pragma map(deflateEnd,\"DEEND\")\r\n  #pragma map(deflateBound,\"DEBND\")\r\n  #pragma map(inflateInit_,\"ININ\")\r\n  #pragma map(inflateInit2_,\"ININ2\")\r\n  #pragma map(inflateEnd,\"INEND\")\r\n  #pragma map(inflateSync,\"INSY\")\r\n  #pragma map(inflateSetDictionary,\"INSEDI\")\r\n  #pragma map(compressBound,\"CMBND\")\r\n  #pragma map(inflate_table,\"INTABL\")\r\n  #pragma map(inflate_fast,\"INFA\")\r\n  #pragma map(inflate_copyright,\"INCOPY\")\r\n#endif\r\n\r\n#endif /* ZCONF_H */\r\n"
  },
  {
    "path": "Engine/porting/Win32/zlib/include/zlib.h",
    "content": "/* zlib.h -- interface of the 'zlib' general purpose compression library\r\n  version 1.2.7, May 2nd, 2012\r\n\r\n  Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler\r\n\r\n  This software is provided 'as-is', without any express or implied\r\n  warranty.  In no event will the authors be held liable for any damages\r\n  arising from the use of this software.\r\n\r\n  Permission is granted to anyone to use this software for any purpose,\r\n  including commercial applications, and to alter it and redistribute it\r\n  freely, subject to the following restrictions:\r\n\r\n  1. The origin of this software must not be misrepresented; you must not\r\n     claim that you wrote the original software. If you use this software\r\n     in a product, an acknowledgment in the product documentation would be\r\n     appreciated but is not required.\r\n  2. Altered source versions must be plainly marked as such, and must not be\r\n     misrepresented as being the original software.\r\n  3. This notice may not be removed or altered from any source distribution.\r\n\r\n  Jean-loup Gailly        Mark Adler\r\n  jloup@gzip.org          madler@alumni.caltech.edu\r\n\r\n\r\n  The data format used by the zlib library is described by RFCs (Request for\r\n  Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950\r\n  (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).\r\n*/\r\n\r\n#ifndef ZLIB_H\r\n#define ZLIB_H\r\n\r\n#include \"zconf.h\"\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define ZLIB_VERSION \"1.2.7\"\r\n#define ZLIB_VERNUM 0x1270\r\n#define ZLIB_VER_MAJOR 1\r\n#define ZLIB_VER_MINOR 2\r\n#define ZLIB_VER_REVISION 7\r\n#define ZLIB_VER_SUBREVISION 0\r\n\r\n/*\r\n    The 'zlib' compression library provides in-memory compression and\r\n  decompression functions, including integrity checks of the uncompressed data.\r\n  This version of the library supports only one compression method (deflation)\r\n  but other algorithms will be added later and will have the same stream\r\n  interface.\r\n\r\n    Compression can be done in a single step if the buffers are large enough,\r\n  or can be done by repeated calls of the compression function.  In the latter\r\n  case, the application must provide more input and/or consume the output\r\n  (providing more output space) before each call.\r\n\r\n    The compressed data format used by default by the in-memory functions is\r\n  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped\r\n  around a deflate stream, which is itself documented in RFC 1951.\r\n\r\n    The library also supports reading and writing files in gzip (.gz) format\r\n  with an interface similar to that of stdio using the functions that start\r\n  with \"gz\".  The gzip format is different from the zlib format.  gzip is a\r\n  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.\r\n\r\n    This library can optionally read and write gzip streams in memory as well.\r\n\r\n    The zlib format was designed to be compact and fast for use in memory\r\n  and on communications channels.  The gzip format was designed for single-\r\n  file compression on file systems, has a larger header than zlib to maintain\r\n  directory information, and uses a different, slower check method than zlib.\r\n\r\n    The library does not install any signal handler.  The decoder checks\r\n  the consistency of the compressed data, so the library should never crash\r\n  even in case of corrupted input.\r\n*/\r\n\r\ntypedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));\r\ntypedef void   (*free_func)  OF((voidpf opaque, voidpf address));\r\n\r\nstruct internal_state;\r\n\r\ntypedef struct z_stream_s {\r\n    z_const Bytef *next_in;     /* next input byte */\r\n    uInt     avail_in;  /* number of bytes available at next_in */\r\n    uLong    total_in;  /* total number of input bytes read so far */\r\n\r\n    Bytef    *next_out; /* next output byte should be put there */\r\n    uInt     avail_out; /* remaining free space at next_out */\r\n    uLong    total_out; /* total number of bytes output so far */\r\n\r\n    z_const char *msg;  /* last error message, NULL if no error */\r\n    struct internal_state FAR *state; /* not visible by applications */\r\n\r\n    alloc_func zalloc;  /* used to allocate the internal state */\r\n    free_func  zfree;   /* used to free the internal state */\r\n    voidpf     opaque;  /* private data object passed to zalloc and zfree */\r\n\r\n    int     data_type;  /* best guess about the data type: binary or text */\r\n    uLong   adler;      /* adler32 value of the uncompressed data */\r\n    uLong   reserved;   /* reserved for future use */\r\n} z_stream;\r\n\r\ntypedef z_stream FAR *z_streamp;\r\n\r\n/*\r\n     gzip header information passed to and from zlib routines.  See RFC 1952\r\n  for more details on the meanings of these fields.\r\n*/\r\ntypedef struct gz_header_s {\r\n    int     text;       /* true if compressed data believed to be text */\r\n    uLong   time;       /* modification time */\r\n    int     xflags;     /* extra flags (not used when writing a gzip file) */\r\n    int     os;         /* operating system */\r\n    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */\r\n    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */\r\n    uInt    extra_max;  /* space at extra (only when reading header) */\r\n    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */\r\n    uInt    name_max;   /* space at name (only when reading header) */\r\n    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */\r\n    uInt    comm_max;   /* space at comment (only when reading header) */\r\n    int     hcrc;       /* true if there was or will be a header crc */\r\n    int     done;       /* true when done reading gzip header (not used\r\n                           when writing a gzip file) */\r\n} gz_header;\r\n\r\ntypedef gz_header FAR *gz_headerp;\r\n\r\n/*\r\n     The application must update next_in and avail_in when avail_in has dropped\r\n   to zero.  It must update next_out and avail_out when avail_out has dropped\r\n   to zero.  The application must initialize zalloc, zfree and opaque before\r\n   calling the init function.  All other fields are set by the compression\r\n   library and must not be updated by the application.\r\n\r\n     The opaque value provided by the application will be passed as the first\r\n   parameter for calls of zalloc and zfree.  This can be useful for custom\r\n   memory management.  The compression library attaches no meaning to the\r\n   opaque value.\r\n\r\n     zalloc must return Z_NULL if there is not enough memory for the object.\r\n   If zlib is used in a multi-threaded application, zalloc and zfree must be\r\n   thread safe.\r\n\r\n     On 16-bit systems, the functions zalloc and zfree must be able to allocate\r\n   exactly 65536 bytes, but will not be required to allocate more than this if\r\n   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers\r\n   returned by zalloc for objects of exactly 65536 bytes *must* have their\r\n   offset normalized to zero.  The default allocation function provided by this\r\n   library ensures this (see zutil.c).  To reduce memory requirements and avoid\r\n   any allocation of 64K objects, at the expense of compression ratio, compile\r\n   the library with -DMAX_WBITS=14 (see zconf.h).\r\n\r\n     The fields total_in and total_out can be used for statistics or progress\r\n   reports.  After compression, total_in holds the total size of the\r\n   uncompressed data and may be saved for use in the decompressor (particularly\r\n   if the decompressor wants to decompress everything in a single step).\r\n*/\r\n\r\n                        /* constants */\r\n\r\n#define Z_NO_FLUSH      0\r\n#define Z_PARTIAL_FLUSH 1\r\n#define Z_SYNC_FLUSH    2\r\n#define Z_FULL_FLUSH    3\r\n#define Z_FINISH        4\r\n#define Z_BLOCK         5\r\n#define Z_TREES         6\r\n/* Allowed flush values; see deflate() and inflate() below for details */\r\n\r\n#define Z_OK            0\r\n#define Z_STREAM_END    1\r\n#define Z_NEED_DICT     2\r\n#define Z_ERRNO        (-1)\r\n#define Z_STREAM_ERROR (-2)\r\n#define Z_DATA_ERROR   (-3)\r\n#define Z_MEM_ERROR    (-4)\r\n#define Z_BUF_ERROR    (-5)\r\n#define Z_VERSION_ERROR (-6)\r\n/* Return codes for the compression/decompression functions. Negative values\r\n * are errors, positive values are used for special but normal events.\r\n */\r\n\r\n#define Z_NO_COMPRESSION         0\r\n#define Z_BEST_SPEED             1\r\n#define Z_BEST_COMPRESSION       9\r\n#define Z_DEFAULT_COMPRESSION  (-1)\r\n/* compression levels */\r\n\r\n#define Z_FILTERED            1\r\n#define Z_HUFFMAN_ONLY        2\r\n#define Z_RLE                 3\r\n#define Z_FIXED               4\r\n#define Z_DEFAULT_STRATEGY    0\r\n/* compression strategy; see deflateInit2() below for details */\r\n\r\n#define Z_BINARY   0\r\n#define Z_TEXT     1\r\n#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */\r\n#define Z_UNKNOWN  2\r\n/* Possible values of the data_type field (though see inflate()) */\r\n\r\n#define Z_DEFLATED   8\r\n/* The deflate compression method (the only one supported in this version) */\r\n\r\n#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */\r\n\r\n#define zlib_version zlibVersion()\r\n/* for compatibility with versions < 1.0.2 */\r\n\r\n\r\n                        /* basic functions */\r\n\r\nZEXTERN const char * ZEXPORT zlibVersion OF((void));\r\n/* The application can compare zlibVersion and ZLIB_VERSION for consistency.\r\n   If the first character differs, the library code actually used is not\r\n   compatible with the zlib.h header file used by the application.  This check\r\n   is automatically made by deflateInit and inflateInit.\r\n */\r\n\r\n/*\r\nZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));\r\n\r\n     Initializes the internal stream state for compression.  The fields\r\n   zalloc, zfree and opaque must be initialized before by the caller.  If\r\n   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default\r\n   allocation functions.\r\n\r\n     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:\r\n   1 gives best speed, 9 gives best compression, 0 gives no compression at all\r\n   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION\r\n   requests a default compromise between speed and compression (currently\r\n   equivalent to level 6).\r\n\r\n     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_STREAM_ERROR if level is not a valid compression level, or\r\n   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible\r\n   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null\r\n   if there is no error message.  deflateInit does not perform any compression:\r\n   this will be done by deflate().\r\n*/\r\n\r\n\r\nZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));\r\n/*\r\n    deflate compresses as much data as possible, and stops when the input\r\n  buffer becomes empty or the output buffer becomes full.  It may introduce\r\n  some output latency (reading input without producing any output) except when\r\n  forced to flush.\r\n\r\n    The detailed semantics are as follows.  deflate performs one or both of the\r\n  following actions:\r\n\r\n  - Compress more input starting at next_in and update next_in and avail_in\r\n    accordingly.  If not all input can be processed (because there is not\r\n    enough room in the output buffer), next_in and avail_in are updated and\r\n    processing will resume at this point for the next call of deflate().\r\n\r\n  - Provide more output starting at next_out and update next_out and avail_out\r\n    accordingly.  This action is forced if the parameter flush is non zero.\r\n    Forcing flush frequently degrades the compression ratio, so this parameter\r\n    should be set only when necessary (in interactive applications).  Some\r\n    output may be provided even if flush is not set.\r\n\r\n    Before the call of deflate(), the application should ensure that at least\r\n  one of the actions is possible, by providing more input and/or consuming more\r\n  output, and updating avail_in or avail_out accordingly; avail_out should\r\n  never be zero before the call.  The application can consume the compressed\r\n  output when it wants, for example when the output buffer is full (avail_out\r\n  == 0), or after each call of deflate().  If deflate returns Z_OK and with\r\n  zero avail_out, it must be called again after making room in the output\r\n  buffer because there might be more output pending.\r\n\r\n    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to\r\n  decide how much data to accumulate before producing output, in order to\r\n  maximize compression.\r\n\r\n    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is\r\n  flushed to the output buffer and the output is aligned on a byte boundary, so\r\n  that the decompressor can get all input data available so far.  (In\r\n  particular avail_in is zero after the call if enough output space has been\r\n  provided before the call.) Flushing may degrade compression for some\r\n  compression algorithms and so it should be used only when necessary.  This\r\n  completes the current deflate block and follows it with an empty stored block\r\n  that is three bits plus filler bits to the next byte, followed by four bytes\r\n  (00 00 ff ff).\r\n\r\n    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the\r\n  output buffer, but the output is not aligned to a byte boundary.  All of the\r\n  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.\r\n  This completes the current deflate block and follows it with an empty fixed\r\n  codes block that is 10 bits long.  This assures that enough bytes are output\r\n  in order for the decompressor to finish the block before the empty fixed code\r\n  block.\r\n\r\n    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as\r\n  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to\r\n  seven bits of the current block are held to be written as the next byte after\r\n  the next deflate block is completed.  In this case, the decompressor may not\r\n  be provided enough bits at this point in order to complete decompression of\r\n  the data provided so far to the compressor.  It may need to wait for the next\r\n  block to be emitted.  This is for advanced applications that need to control\r\n  the emission of deflate blocks.\r\n\r\n    If flush is set to Z_FULL_FLUSH, all output is flushed as with\r\n  Z_SYNC_FLUSH, and the compression state is reset so that decompression can\r\n  restart from this point if previous compressed data has been damaged or if\r\n  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade\r\n  compression.\r\n\r\n    If deflate returns with avail_out == 0, this function must be called again\r\n  with the same value of the flush parameter and more output space (updated\r\n  avail_out), until the flush is complete (deflate returns with non-zero\r\n  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that\r\n  avail_out is greater than six to avoid repeated flush markers due to\r\n  avail_out == 0 on return.\r\n\r\n    If the parameter flush is set to Z_FINISH, pending input is processed,\r\n  pending output is flushed and deflate returns with Z_STREAM_END if there was\r\n  enough output space; if deflate returns with Z_OK, this function must be\r\n  called again with Z_FINISH and more output space (updated avail_out) but no\r\n  more input data, until it returns with Z_STREAM_END or an error.  After\r\n  deflate has returned Z_STREAM_END, the only possible operations on the stream\r\n  are deflateReset or deflateEnd.\r\n\r\n    Z_FINISH can be used immediately after deflateInit if all the compression\r\n  is to be done in a single step.  In this case, avail_out must be at least the\r\n  value returned by deflateBound (see below).  Then deflate is guaranteed to\r\n  return Z_STREAM_END.  If not enough output space is provided, deflate will\r\n  not return Z_STREAM_END, and it must be called again as described above.\r\n\r\n    deflate() sets strm->adler to the adler32 checksum of all input read\r\n  so far (that is, total_in bytes).\r\n\r\n    deflate() may update strm->data_type if it can make a good guess about\r\n  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered\r\n  binary.  This field is only for information purposes and does not affect the\r\n  compression algorithm in any manner.\r\n\r\n    deflate() returns Z_OK if some progress has been made (more input\r\n  processed or more output produced), Z_STREAM_END if all input has been\r\n  consumed and all output has been produced (only when flush is set to\r\n  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example\r\n  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible\r\n  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not\r\n  fatal, and deflate() can be called again with more input and more output\r\n  space to continue compressing.\r\n*/\r\n\r\n\r\nZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));\r\n/*\r\n     All dynamically allocated data structures for this stream are freed.\r\n   This function discards any unprocessed input and does not flush any pending\r\n   output.\r\n\r\n     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the\r\n   stream state was inconsistent, Z_DATA_ERROR if the stream was freed\r\n   prematurely (some input or output was discarded).  In the error case, msg\r\n   may be set but then points to a static string (which must not be\r\n   deallocated).\r\n*/\r\n\r\n\r\n/*\r\nZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));\r\n\r\n     Initializes the internal stream state for decompression.  The fields\r\n   next_in, avail_in, zalloc, zfree and opaque must be initialized before by\r\n   the caller.  If next_in is not Z_NULL and avail_in is large enough (the\r\n   exact value depends on the compression method), inflateInit determines the\r\n   compression method from the zlib header and allocates all data structures\r\n   accordingly; otherwise the allocation will be deferred to the first call of\r\n   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to\r\n   use default allocation functions.\r\n\r\n     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\r\n   version assumed by the caller, or Z_STREAM_ERROR if the parameters are\r\n   invalid, such as a null pointer to the structure.  msg is set to null if\r\n   there is no error message.  inflateInit does not perform any decompression\r\n   apart from possibly reading the zlib header if present: actual decompression\r\n   will be done by inflate().  (So next_in and avail_in may be modified, but\r\n   next_out and avail_out are unused and unchanged.) The current implementation\r\n   of inflateInit() does not process any header information -- that is deferred\r\n   until inflate() is called.\r\n*/\r\n\r\n\r\nZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));\r\n/*\r\n    inflate decompresses as much data as possible, and stops when the input\r\n  buffer becomes empty or the output buffer becomes full.  It may introduce\r\n  some output latency (reading input without producing any output) except when\r\n  forced to flush.\r\n\r\n  The detailed semantics are as follows.  inflate performs one or both of the\r\n  following actions:\r\n\r\n  - Decompress more input starting at next_in and update next_in and avail_in\r\n    accordingly.  If not all input can be processed (because there is not\r\n    enough room in the output buffer), next_in is updated and processing will\r\n    resume at this point for the next call of inflate().\r\n\r\n  - Provide more output starting at next_out and update next_out and avail_out\r\n    accordingly.  inflate() provides as much output as possible, until there is\r\n    no more input data or no more space in the output buffer (see below about\r\n    the flush parameter).\r\n\r\n    Before the call of inflate(), the application should ensure that at least\r\n  one of the actions is possible, by providing more input and/or consuming more\r\n  output, and updating the next_* and avail_* values accordingly.  The\r\n  application can consume the uncompressed output when it wants, for example\r\n  when the output buffer is full (avail_out == 0), or after each call of\r\n  inflate().  If inflate returns Z_OK and with zero avail_out, it must be\r\n  called again after making room in the output buffer because there might be\r\n  more output pending.\r\n\r\n    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,\r\n  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much\r\n  output as possible to the output buffer.  Z_BLOCK requests that inflate()\r\n  stop if and when it gets to the next deflate block boundary.  When decoding\r\n  the zlib or gzip format, this will cause inflate() to return immediately\r\n  after the header and before the first block.  When doing a raw inflate,\r\n  inflate() will go ahead and process the first block, and will return when it\r\n  gets to the end of that block, or when it runs out of data.\r\n\r\n    The Z_BLOCK option assists in appending to or combining deflate streams.\r\n  Also to assist in this, on return inflate() will set strm->data_type to the\r\n  number of unused bits in the last byte taken from strm->next_in, plus 64 if\r\n  inflate() is currently decoding the last block in the deflate stream, plus\r\n  128 if inflate() returned immediately after decoding an end-of-block code or\r\n  decoding the complete header up to just before the first byte of the deflate\r\n  stream.  The end-of-block will not be indicated until all of the uncompressed\r\n  data from that block has been written to strm->next_out.  The number of\r\n  unused bits may in general be greater than seven, except when bit 7 of\r\n  data_type is set, in which case the number of unused bits will be less than\r\n  eight.  data_type is set as noted here every time inflate() returns for all\r\n  flush options, and so can be used to determine the amount of currently\r\n  consumed input in bits.\r\n\r\n    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the\r\n  end of each deflate block header is reached, before any actual data in that\r\n  block is decoded.  This allows the caller to determine the length of the\r\n  deflate block header for later use in random access within a deflate block.\r\n  256 is added to the value of strm->data_type when inflate() returns\r\n  immediately after reaching the end of the deflate block header.\r\n\r\n    inflate() should normally be called until it returns Z_STREAM_END or an\r\n  error.  However if all decompression is to be performed in a single step (a\r\n  single call of inflate), the parameter flush should be set to Z_FINISH.  In\r\n  this case all pending input is processed and all pending output is flushed;\r\n  avail_out must be large enough to hold all of the uncompressed data for the\r\n  operation to complete.  (The size of the uncompressed data may have been\r\n  saved by the compressor for this purpose.) The use of Z_FINISH is not\r\n  required to perform an inflation in one step.  However it may be used to\r\n  inform inflate that a faster approach can be used for the single inflate()\r\n  call.  Z_FINISH also informs inflate to not maintain a sliding window if the\r\n  stream completes, which reduces inflate's memory footprint.  If the stream\r\n  does not complete, either because not all of the stream is provided or not\r\n  enough output space is provided, then a sliding window will be allocated and\r\n  inflate() can be called again to continue the operation as if Z_NO_FLUSH had\r\n  been used.\r\n\r\n     In this implementation, inflate() always flushes as much output as\r\n  possible to the output buffer, and always uses the faster approach on the\r\n  first call.  So the effects of the flush parameter in this implementation are\r\n  on the return value of inflate() as noted below, when inflate() returns early\r\n  when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of\r\n  memory for a sliding window when Z_FINISH is used.\r\n\r\n     If a preset dictionary is needed after this call (see inflateSetDictionary\r\n  below), inflate sets strm->adler to the Adler-32 checksum of the dictionary\r\n  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets\r\n  strm->adler to the Adler-32 checksum of all output produced so far (that is,\r\n  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described\r\n  below.  At the end of the stream, inflate() checks that its computed adler32\r\n  checksum is equal to that saved by the compressor and returns Z_STREAM_END\r\n  only if the checksum is correct.\r\n\r\n    inflate() can decompress and check either zlib-wrapped or gzip-wrapped\r\n  deflate data.  The header type is detected automatically, if requested when\r\n  initializing with inflateInit2().  Any information contained in the gzip\r\n  header is not retained, so applications that need that information should\r\n  instead use raw inflate, see inflateInit2() below, or inflateBack() and\r\n  perform their own processing of the gzip header and trailer.  When processing\r\n  gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output\r\n  producted so far.  The CRC-32 is checked against the gzip trailer.\r\n\r\n    inflate() returns Z_OK if some progress has been made (more input processed\r\n  or more output produced), Z_STREAM_END if the end of the compressed data has\r\n  been reached and all uncompressed output has been produced, Z_NEED_DICT if a\r\n  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was\r\n  corrupted (input stream not conforming to the zlib format or incorrect check\r\n  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example\r\n  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,\r\n  Z_BUF_ERROR if no progress is possible or if there was not enough room in the\r\n  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and\r\n  inflate() can be called again with more input and more output space to\r\n  continue decompressing.  If Z_DATA_ERROR is returned, the application may\r\n  then call inflateSync() to look for a good compression block if a partial\r\n  recovery of the data is desired.\r\n*/\r\n\r\n\r\nZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));\r\n/*\r\n     All dynamically allocated data structures for this stream are freed.\r\n   This function discards any unprocessed input and does not flush any pending\r\n   output.\r\n\r\n     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state\r\n   was inconsistent.  In the error case, msg may be set but then points to a\r\n   static string (which must not be deallocated).\r\n*/\r\n\r\n\r\n                        /* Advanced functions */\r\n\r\n/*\r\n    The following functions are needed only in some special applications.\r\n*/\r\n\r\n/*\r\nZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,\r\n                                     int  level,\r\n                                     int  method,\r\n                                     int  windowBits,\r\n                                     int  memLevel,\r\n                                     int  strategy));\r\n\r\n     This is another version of deflateInit with more compression options.  The\r\n   fields next_in, zalloc, zfree and opaque must be initialized before by the\r\n   caller.\r\n\r\n     The method parameter is the compression method.  It must be Z_DEFLATED in\r\n   this version of the library.\r\n\r\n     The windowBits parameter is the base two logarithm of the window size\r\n   (the size of the history buffer).  It should be in the range 8..15 for this\r\n   version of the library.  Larger values of this parameter result in better\r\n   compression at the expense of memory usage.  The default value is 15 if\r\n   deflateInit is used instead.\r\n\r\n     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits\r\n   determines the window size.  deflate() will then generate raw deflate data\r\n   with no zlib header or trailer, and will not compute an adler32 check value.\r\n\r\n     windowBits can also be greater than 15 for optional gzip encoding.  Add\r\n   16 to windowBits to write a simple gzip header and trailer around the\r\n   compressed data instead of a zlib wrapper.  The gzip header will have no\r\n   file name, no extra data, no comment, no modification time (set to zero), no\r\n   header crc, and the operating system will be set to 255 (unknown).  If a\r\n   gzip stream is being written, strm->adler is a crc32 instead of an adler32.\r\n\r\n     The memLevel parameter specifies how much memory should be allocated\r\n   for the internal compression state.  memLevel=1 uses minimum memory but is\r\n   slow and reduces compression ratio; memLevel=9 uses maximum memory for\r\n   optimal speed.  The default value is 8.  See zconf.h for total memory usage\r\n   as a function of windowBits and memLevel.\r\n\r\n     The strategy parameter is used to tune the compression algorithm.  Use the\r\n   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a\r\n   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no\r\n   string match), or Z_RLE to limit match distances to one (run-length\r\n   encoding).  Filtered data consists mostly of small values with a somewhat\r\n   random distribution.  In this case, the compression algorithm is tuned to\r\n   compress them better.  The effect of Z_FILTERED is to force more Huffman\r\n   coding and less string matching; it is somewhat intermediate between\r\n   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as\r\n   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The\r\n   strategy parameter only affects the compression ratio but not the\r\n   correctness of the compressed output even if it is not set appropriately.\r\n   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler\r\n   decoder for special applications.\r\n\r\n     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid\r\n   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is\r\n   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is\r\n   set to null if there is no error message.  deflateInit2 does not perform any\r\n   compression: this will be done by deflate().\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,\r\n                                             const Bytef *dictionary,\r\n                                             uInt  dictLength));\r\n/*\r\n     Initializes the compression dictionary from the given byte sequence\r\n   without producing any compressed output.  When using the zlib format, this\r\n   function must be called immediately after deflateInit, deflateInit2 or\r\n   deflateReset, and before any call of deflate.  When doing raw deflate, this\r\n   function must be called either before any call of deflate, or immediately\r\n   after the completion of a deflate block, i.e. after all input has been\r\n   consumed and all output has been delivered when using any of the flush\r\n   options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH.  The\r\n   compressor and decompressor must use exactly the same dictionary (see\r\n   inflateSetDictionary).\r\n\r\n     The dictionary should consist of strings (byte sequences) that are likely\r\n   to be encountered later in the data to be compressed, with the most commonly\r\n   used strings preferably put towards the end of the dictionary.  Using a\r\n   dictionary is most useful when the data to be compressed is short and can be\r\n   predicted with good accuracy; the data can then be compressed better than\r\n   with the default empty dictionary.\r\n\r\n     Depending on the size of the compression data structures selected by\r\n   deflateInit or deflateInit2, a part of the dictionary may in effect be\r\n   discarded, for example if the dictionary is larger than the window size\r\n   provided in deflateInit or deflateInit2.  Thus the strings most likely to be\r\n   useful should be put at the end of the dictionary, not at the front.  In\r\n   addition, the current implementation of deflate will use at most the window\r\n   size minus 262 bytes of the provided dictionary.\r\n\r\n     Upon return of this function, strm->adler is set to the adler32 value\r\n   of the dictionary; the decompressor may later use this value to determine\r\n   which dictionary has been used by the compressor.  (The adler32 value\r\n   applies to the whole dictionary even if only a subset of the dictionary is\r\n   actually used by the compressor.) If a raw deflate was requested, then the\r\n   adler32 value is not computed and strm->adler is not set.\r\n\r\n     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a\r\n   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is\r\n   inconsistent (for example if deflate has already been called for this stream\r\n   or if not at a block boundary for raw deflate).  deflateSetDictionary does\r\n   not perform any compression: this will be done by deflate().\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,\r\n                                    z_streamp source));\r\n/*\r\n     Sets the destination stream as a complete copy of the source stream.\r\n\r\n     This function can be useful when several compression strategies will be\r\n   tried, for example when there are several ways of pre-processing the input\r\n   data with a filter.  The streams that will be discarded should then be freed\r\n   by calling deflateEnd.  Note that deflateCopy duplicates the internal\r\n   compression state which can be quite large, so this strategy is slow and can\r\n   consume lots of memory.\r\n\r\n     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\r\n   (such as zalloc being Z_NULL).  msg is left unchanged in both source and\r\n   destination.\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));\r\n/*\r\n     This function is equivalent to deflateEnd followed by deflateInit,\r\n   but does not free and reallocate all the internal compression state.  The\r\n   stream will keep the same compression level and any other attributes that\r\n   may have been set by deflateInit2.\r\n\r\n     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent (such as zalloc or state being Z_NULL).\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,\r\n                                      int level,\r\n                                      int strategy));\r\n/*\r\n     Dynamically update the compression level and compression strategy.  The\r\n   interpretation of level and strategy is as in deflateInit2.  This can be\r\n   used to switch between compression and straight copy of the input data, or\r\n   to switch to a different kind of input data requiring a different strategy.\r\n   If the compression level is changed, the input available so far is\r\n   compressed with the old level (and may be flushed); the new level will take\r\n   effect only at the next call of deflate().\r\n\r\n     Before the call of deflateParams, the stream state must be set as for\r\n   a call of deflate(), since the currently available input may have to be\r\n   compressed and flushed.  In particular, strm->avail_out must be non-zero.\r\n\r\n     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source\r\n   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if\r\n   strm->avail_out was zero.\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,\r\n                                    int good_length,\r\n                                    int max_lazy,\r\n                                    int nice_length,\r\n                                    int max_chain));\r\n/*\r\n     Fine tune deflate's internal compression parameters.  This should only be\r\n   used by someone who understands the algorithm used by zlib's deflate for\r\n   searching for the best matching string, and even then only by the most\r\n   fanatic optimizer trying to squeeze out the last compressed bit for their\r\n   specific input data.  Read the deflate.c source code for the meaning of the\r\n   max_lazy, good_length, nice_length, and max_chain parameters.\r\n\r\n     deflateTune() can be called after deflateInit() or deflateInit2(), and\r\n   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.\r\n */\r\n\r\nZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,\r\n                                       uLong sourceLen));\r\n/*\r\n     deflateBound() returns an upper bound on the compressed size after\r\n   deflation of sourceLen bytes.  It must be called after deflateInit() or\r\n   deflateInit2(), and after deflateSetHeader(), if used.  This would be used\r\n   to allocate an output buffer for deflation in a single pass, and so would be\r\n   called before deflate().  If that first deflate() call is provided the\r\n   sourceLen input bytes, an output buffer allocated to the size returned by\r\n   deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed\r\n   to return Z_STREAM_END.  Note that it is possible for the compressed size to\r\n   be larger than the value returned by deflateBound() if flush options other\r\n   than Z_FINISH or Z_NO_FLUSH are used.\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,\r\n                                       unsigned *pending,\r\n                                       int *bits));\r\n/*\r\n     deflatePending() returns the number of bytes and bits of output that have\r\n   been generated, but not yet provided in the available output.  The bytes not\r\n   provided would be due to the available output space having being consumed.\r\n   The number of bits of output not provided are between 0 and 7, where they\r\n   await more bits to join them in order to fill out a full byte.  If pending\r\n   or bits are Z_NULL, then those values are not set.\r\n\r\n     deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent.\r\n */\r\n\r\nZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,\r\n                                     int bits,\r\n                                     int value));\r\n/*\r\n     deflatePrime() inserts bits in the deflate output stream.  The intent\r\n   is that this function is used to start off the deflate output with the bits\r\n   leftover from a previous deflate stream when appending to it.  As such, this\r\n   function can only be used for raw deflate, and must be used before the first\r\n   deflate() call after a deflateInit2() or deflateReset().  bits must be less\r\n   than or equal to 16, and that many of the least significant bits of value\r\n   will be inserted in the output.\r\n\r\n     deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough\r\n   room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the\r\n   source stream state was inconsistent.\r\n*/\r\n\r\nZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,\r\n                                         gz_headerp head));\r\n/*\r\n     deflateSetHeader() provides gzip header information for when a gzip\r\n   stream is requested by deflateInit2().  deflateSetHeader() may be called\r\n   after deflateInit2() or deflateReset() and before the first call of\r\n   deflate().  The text, time, os, extra field, name, and comment information\r\n   in the provided gz_header structure are written to the gzip header (xflag is\r\n   ignored -- the extra flags are set according to the compression level).  The\r\n   caller must assure that, if not Z_NULL, name and comment are terminated with\r\n   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are\r\n   available there.  If hcrc is true, a gzip header crc is included.  Note that\r\n   the current versions of the command-line version of gzip (up through version\r\n   1.3.x) do not support header crc's, and will report that it is a \"multi-part\r\n   gzip file\" and give up.\r\n\r\n     If deflateSetHeader is not used, the default gzip header has text false,\r\n   the time set to zero, and os set to 255, with no extra, name, or comment\r\n   fields.  The gzip header is returned to the default state by deflateReset().\r\n\r\n     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent.\r\n*/\r\n\r\n/*\r\nZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,\r\n                                     int  windowBits));\r\n\r\n     This is another version of inflateInit with an extra parameter.  The\r\n   fields next_in, avail_in, zalloc, zfree and opaque must be initialized\r\n   before by the caller.\r\n\r\n     The windowBits parameter is the base two logarithm of the maximum window\r\n   size (the size of the history buffer).  It should be in the range 8..15 for\r\n   this version of the library.  The default value is 15 if inflateInit is used\r\n   instead.  windowBits must be greater than or equal to the windowBits value\r\n   provided to deflateInit2() while compressing, or it must be equal to 15 if\r\n   deflateInit2() was not used.  If a compressed stream with a larger window\r\n   size is given as input, inflate() will return with the error code\r\n   Z_DATA_ERROR instead of trying to allocate a larger window.\r\n\r\n     windowBits can also be zero to request that inflate use the window size in\r\n   the zlib header of the compressed stream.\r\n\r\n     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits\r\n   determines the window size.  inflate() will then process raw deflate data,\r\n   not looking for a zlib or gzip header, not generating a check value, and not\r\n   looking for any check values for comparison at the end of the stream.  This\r\n   is for use with other formats that use the deflate compressed data format\r\n   such as zip.  Those formats provide their own check values.  If a custom\r\n   format is developed using the raw deflate format for compressed data, it is\r\n   recommended that a check value such as an adler32 or a crc32 be applied to\r\n   the uncompressed data as is done in the zlib, gzip, and zip formats.  For\r\n   most applications, the zlib format should be used as is.  Note that comments\r\n   above on the use in deflateInit2() applies to the magnitude of windowBits.\r\n\r\n     windowBits can also be greater than 15 for optional gzip decoding.  Add\r\n   32 to windowBits to enable zlib and gzip decoding with automatic header\r\n   detection, or add 16 to decode only the gzip format (the zlib format will\r\n   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a\r\n   crc32 instead of an adler32.\r\n\r\n     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\r\n   version assumed by the caller, or Z_STREAM_ERROR if the parameters are\r\n   invalid, such as a null pointer to the structure.  msg is set to null if\r\n   there is no error message.  inflateInit2 does not perform any decompression\r\n   apart from possibly reading the zlib header if present: actual decompression\r\n   will be done by inflate().  (So next_in and avail_in may be modified, but\r\n   next_out and avail_out are unused and unchanged.) The current implementation\r\n   of inflateInit2() does not process any header information -- that is\r\n   deferred until inflate() is called.\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,\r\n                                             const Bytef *dictionary,\r\n                                             uInt  dictLength));\r\n/*\r\n     Initializes the decompression dictionary from the given uncompressed byte\r\n   sequence.  This function must be called immediately after a call of inflate,\r\n   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor\r\n   can be determined from the adler32 value returned by that call of inflate.\r\n   The compressor and decompressor must use exactly the same dictionary (see\r\n   deflateSetDictionary).  For raw inflate, this function can be called at any\r\n   time to set the dictionary.  If the provided dictionary is smaller than the\r\n   window and there is already data in the window, then the provided dictionary\r\n   will amend what's there.  The application must insure that the dictionary\r\n   that was used for compression is provided.\r\n\r\n     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a\r\n   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is\r\n   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the\r\n   expected one (incorrect adler32 value).  inflateSetDictionary does not\r\n   perform any decompression: this will be done by subsequent calls of\r\n   inflate().\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));\r\n/*\r\n     Skips invalid compressed data until a possible full flush point (see above\r\n   for the description of deflate with Z_FULL_FLUSH) can be found, or until all\r\n   available input is skipped.  No output is provided.\r\n\r\n     inflateSync searches for a 00 00 FF FF pattern in the compressed data.\r\n   All full flush points have this pattern, but not all occurences of this\r\n   pattern are full flush points.\r\n\r\n     inflateSync returns Z_OK if a possible full flush point has been found,\r\n   Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point\r\n   has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.\r\n   In the success case, the application may save the current current value of\r\n   total_in which indicates where valid compressed data was found.  In the\r\n   error case, the application may repeatedly call inflateSync, providing more\r\n   input each time, until success or end of the input data.\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,\r\n                                    z_streamp source));\r\n/*\r\n     Sets the destination stream as a complete copy of the source stream.\r\n\r\n     This function can be useful when randomly accessing a large stream.  The\r\n   first pass through the stream can periodically record the inflate state,\r\n   allowing restarting inflate at those points when randomly accessing the\r\n   stream.\r\n\r\n     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\r\n   (such as zalloc being Z_NULL).  msg is left unchanged in both source and\r\n   destination.\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));\r\n/*\r\n     This function is equivalent to inflateEnd followed by inflateInit,\r\n   but does not free and reallocate all the internal decompression state.  The\r\n   stream will keep attributes that may have been set by inflateInit2.\r\n\r\n     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent (such as zalloc or state being Z_NULL).\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,\r\n                                      int windowBits));\r\n/*\r\n     This function is the same as inflateReset, but it also permits changing\r\n   the wrap and window size requests.  The windowBits parameter is interpreted\r\n   the same as it is for inflateInit2.\r\n\r\n     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent (such as zalloc or state being Z_NULL), or if\r\n   the windowBits parameter is invalid.\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,\r\n                                     int bits,\r\n                                     int value));\r\n/*\r\n     This function inserts bits in the inflate input stream.  The intent is\r\n   that this function is used to start inflating at a bit position in the\r\n   middle of a byte.  The provided bits will be used before any bytes are used\r\n   from next_in.  This function should only be used with raw inflate, and\r\n   should be used before the first inflate() call after inflateInit2() or\r\n   inflateReset().  bits must be less than or equal to 16, and that many of the\r\n   least significant bits of value will be inserted in the input.\r\n\r\n     If bits is negative, then the input stream bit buffer is emptied.  Then\r\n   inflatePrime() can be called again to put bits in the buffer.  This is used\r\n   to clear out bits leftover after feeding inflate a block description prior\r\n   to feeding inflate codes.\r\n\r\n     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent.\r\n*/\r\n\r\nZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));\r\n/*\r\n     This function returns two values, one in the lower 16 bits of the return\r\n   value, and the other in the remaining upper bits, obtained by shifting the\r\n   return value down 16 bits.  If the upper value is -1 and the lower value is\r\n   zero, then inflate() is currently decoding information outside of a block.\r\n   If the upper value is -1 and the lower value is non-zero, then inflate is in\r\n   the middle of a stored block, with the lower value equaling the number of\r\n   bytes from the input remaining to copy.  If the upper value is not -1, then\r\n   it is the number of bits back from the current bit position in the input of\r\n   the code (literal or length/distance pair) currently being processed.  In\r\n   that case the lower value is the number of bytes already emitted for that\r\n   code.\r\n\r\n     A code is being processed if inflate is waiting for more input to complete\r\n   decoding of the code, or if it has completed decoding but is waiting for\r\n   more output space to write the literal or match data.\r\n\r\n     inflateMark() is used to mark locations in the input data for random\r\n   access, which may be at bit positions, and to note those cases where the\r\n   output of a code may span boundaries of random access blocks.  The current\r\n   location in the input stream can be determined from avail_in and data_type\r\n   as noted in the description for the Z_BLOCK flush parameter for inflate.\r\n\r\n     inflateMark returns the value noted above or -1 << 16 if the provided\r\n   source stream state was inconsistent.\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,\r\n                                         gz_headerp head));\r\n/*\r\n     inflateGetHeader() requests that gzip header information be stored in the\r\n   provided gz_header structure.  inflateGetHeader() may be called after\r\n   inflateInit2() or inflateReset(), and before the first call of inflate().\r\n   As inflate() processes the gzip stream, head->done is zero until the header\r\n   is completed, at which time head->done is set to one.  If a zlib stream is\r\n   being decoded, then head->done is set to -1 to indicate that there will be\r\n   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be\r\n   used to force inflate() to return immediately after header processing is\r\n   complete and before any actual data is decompressed.\r\n\r\n     The text, time, xflags, and os fields are filled in with the gzip header\r\n   contents.  hcrc is set to true if there is a header CRC.  (The header CRC\r\n   was valid if done is set to one.) If extra is not Z_NULL, then extra_max\r\n   contains the maximum number of bytes to write to extra.  Once done is true,\r\n   extra_len contains the actual extra field length, and extra contains the\r\n   extra field, or that field truncated if extra_max is less than extra_len.\r\n   If name is not Z_NULL, then up to name_max characters are written there,\r\n   terminated with a zero unless the length is greater than name_max.  If\r\n   comment is not Z_NULL, then up to comm_max characters are written there,\r\n   terminated with a zero unless the length is greater than comm_max.  When any\r\n   of extra, name, or comment are not Z_NULL and the respective field is not\r\n   present in the header, then that field is set to Z_NULL to signal its\r\n   absence.  This allows the use of deflateSetHeader() with the returned\r\n   structure to duplicate the header.  However if those fields are set to\r\n   allocated memory, then the application will need to save those pointers\r\n   elsewhere so that they can be eventually freed.\r\n\r\n     If inflateGetHeader is not used, then the header information is simply\r\n   discarded.  The header is always checked for validity, including the header\r\n   CRC if present.  inflateReset() will reset the process to discard the header\r\n   information.  The application would need to call inflateGetHeader() again to\r\n   retrieve the header from the next gzip stream.\r\n\r\n     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source\r\n   stream state was inconsistent.\r\n*/\r\n\r\n/*\r\nZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,\r\n                                        unsigned char FAR *window));\r\n\r\n     Initialize the internal stream state for decompression using inflateBack()\r\n   calls.  The fields zalloc, zfree and opaque in strm must be initialized\r\n   before the call.  If zalloc and zfree are Z_NULL, then the default library-\r\n   derived memory allocation routines are used.  windowBits is the base two\r\n   logarithm of the window size, in the range 8..15.  window is a caller\r\n   supplied buffer of that size.  Except for special applications where it is\r\n   assured that deflate was used with small window sizes, windowBits must be 15\r\n   and a 32K byte window must be supplied to be able to decompress general\r\n   deflate streams.\r\n\r\n     See inflateBack() for the usage of these routines.\r\n\r\n     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of\r\n   the parameters are invalid, Z_MEM_ERROR if the internal state could not be\r\n   allocated, or Z_VERSION_ERROR if the version of the library does not match\r\n   the version of the header file.\r\n*/\r\n\r\ntypedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));\r\ntypedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));\r\n\r\nZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,\r\n                                    in_func in, void FAR *in_desc,\r\n                                    out_func out, void FAR *out_desc));\r\n/*\r\n     inflateBack() does a raw inflate with a single call using a call-back\r\n   interface for input and output.  This is more efficient than inflate() for\r\n   file i/o applications in that it avoids copying between the output and the\r\n   sliding window by simply making the window itself the output buffer.  This\r\n   function trusts the application to not change the output buffer passed by\r\n   the output function, at least until inflateBack() returns.\r\n\r\n     inflateBackInit() must be called first to allocate the internal state\r\n   and to initialize the state with the user-provided window buffer.\r\n   inflateBack() may then be used multiple times to inflate a complete, raw\r\n   deflate stream with each call.  inflateBackEnd() is then called to free the\r\n   allocated state.\r\n\r\n     A raw deflate stream is one with no zlib or gzip header or trailer.\r\n   This routine would normally be used in a utility that reads zip or gzip\r\n   files and writes out uncompressed files.  The utility would decode the\r\n   header and process the trailer on its own, hence this routine expects only\r\n   the raw deflate stream to decompress.  This is different from the normal\r\n   behavior of inflate(), which expects either a zlib or gzip header and\r\n   trailer around the deflate stream.\r\n\r\n     inflateBack() uses two subroutines supplied by the caller that are then\r\n   called by inflateBack() for input and output.  inflateBack() calls those\r\n   routines until it reads a complete deflate stream and writes out all of the\r\n   uncompressed data, or until it encounters an error.  The function's\r\n   parameters and return types are defined above in the in_func and out_func\r\n   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the\r\n   number of bytes of provided input, and a pointer to that input in buf.  If\r\n   there is no input available, in() must return zero--buf is ignored in that\r\n   case--and inflateBack() will return a buffer error.  inflateBack() will call\r\n   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()\r\n   should return zero on success, or non-zero on failure.  If out() returns\r\n   non-zero, inflateBack() will return with an error.  Neither in() nor out()\r\n   are permitted to change the contents of the window provided to\r\n   inflateBackInit(), which is also the buffer that out() uses to write from.\r\n   The length written by out() will be at most the window size.  Any non-zero\r\n   amount of input may be provided by in().\r\n\r\n     For convenience, inflateBack() can be provided input on the first call by\r\n   setting strm->next_in and strm->avail_in.  If that input is exhausted, then\r\n   in() will be called.  Therefore strm->next_in must be initialized before\r\n   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called\r\n   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in\r\n   must also be initialized, and then if strm->avail_in is not zero, input will\r\n   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].\r\n\r\n     The in_desc and out_desc parameters of inflateBack() is passed as the\r\n   first parameter of in() and out() respectively when they are called.  These\r\n   descriptors can be optionally used to pass any information that the caller-\r\n   supplied in() and out() functions need to do their job.\r\n\r\n     On return, inflateBack() will set strm->next_in and strm->avail_in to\r\n   pass back any unused input that was provided by the last in() call.  The\r\n   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR\r\n   if in() or out() returned an error, Z_DATA_ERROR if there was a format error\r\n   in the deflate stream (in which case strm->msg is set to indicate the nature\r\n   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.\r\n   In the case of Z_BUF_ERROR, an input or output error can be distinguished\r\n   using strm->next_in which will be Z_NULL only if in() returned an error.  If\r\n   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning\r\n   non-zero.  (in() will always be called before out(), so strm->next_in is\r\n   assured to be defined if out() returns non-zero.) Note that inflateBack()\r\n   cannot return Z_OK.\r\n*/\r\n\r\nZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));\r\n/*\r\n     All memory allocated by inflateBackInit() is freed.\r\n\r\n     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream\r\n   state was inconsistent.\r\n*/\r\n\r\nZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));\r\n/* Return flags indicating compile-time options.\r\n\r\n    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:\r\n     1.0: size of uInt\r\n     3.2: size of uLong\r\n     5.4: size of voidpf (pointer)\r\n     7.6: size of z_off_t\r\n\r\n    Compiler, assembler, and debug options:\r\n     8: DEBUG\r\n     9: ASMV or ASMINF -- use ASM code\r\n     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention\r\n     11: 0 (reserved)\r\n\r\n    One-time table building (smaller code, but not thread-safe if true):\r\n     12: BUILDFIXED -- build static block decoding tables when needed\r\n     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed\r\n     14,15: 0 (reserved)\r\n\r\n    Library content (indicates missing functionality):\r\n     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking\r\n                          deflate code when not needed)\r\n     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect\r\n                    and decode gzip streams (to avoid linking crc code)\r\n     18-19: 0 (reserved)\r\n\r\n    Operation variations (changes in library functionality):\r\n     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate\r\n     21: FASTEST -- deflate algorithm with only one, lowest compression level\r\n     22,23: 0 (reserved)\r\n\r\n    The sprintf variant used by gzprintf (zero is best):\r\n     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format\r\n     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!\r\n     26: 0 = returns value, 1 = void -- 1 means inferred string length returned\r\n\r\n    Remainder:\r\n     27-31: 0 (reserved)\r\n */\r\n\r\n#ifndef Z_SOLO\r\n\r\n                        /* utility functions */\r\n\r\n/*\r\n     The following utility functions are implemented on top of the basic\r\n   stream-oriented functions.  To simplify the interface, some default options\r\n   are assumed (compression level and memory usage, standard memory allocation\r\n   functions).  The source code of these utility functions can be modified if\r\n   you need special options.\r\n*/\r\n\r\nZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,\r\n                                 const Bytef *source, uLong sourceLen));\r\n/*\r\n     Compresses the source buffer into the destination buffer.  sourceLen is\r\n   the byte length of the source buffer.  Upon entry, destLen is the total size\r\n   of the destination buffer, which must be at least the value returned by\r\n   compressBound(sourceLen).  Upon exit, destLen is the actual size of the\r\n   compressed buffer.\r\n\r\n     compress returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\r\n   buffer.\r\n*/\r\n\r\nZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,\r\n                                  const Bytef *source, uLong sourceLen,\r\n                                  int level));\r\n/*\r\n     Compresses the source buffer into the destination buffer.  The level\r\n   parameter has the same meaning as in deflateInit.  sourceLen is the byte\r\n   length of the source buffer.  Upon entry, destLen is the total size of the\r\n   destination buffer, which must be at least the value returned by\r\n   compressBound(sourceLen).  Upon exit, destLen is the actual size of the\r\n   compressed buffer.\r\n\r\n     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\r\n   memory, Z_BUF_ERROR if there was not enough room in the output buffer,\r\n   Z_STREAM_ERROR if the level parameter is invalid.\r\n*/\r\n\r\nZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));\r\n/*\r\n     compressBound() returns an upper bound on the compressed size after\r\n   compress() or compress2() on sourceLen bytes.  It would be used before a\r\n   compress() or compress2() call to allocate the destination buffer.\r\n*/\r\n\r\nZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,\r\n                                   const Bytef *source, uLong sourceLen));\r\n/*\r\n     Decompresses the source buffer into the destination buffer.  sourceLen is\r\n   the byte length of the source buffer.  Upon entry, destLen is the total size\r\n   of the destination buffer, which must be large enough to hold the entire\r\n   uncompressed data.  (The size of the uncompressed data must have been saved\r\n   previously by the compressor and transmitted to the decompressor by some\r\n   mechanism outside the scope of this compression library.) Upon exit, destLen\r\n   is the actual size of the uncompressed buffer.\r\n\r\n     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\r\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\r\n   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.  In\r\n   the case where there is not enough room, uncompress() will fill the output\r\n   buffer with the uncompressed data up to that point.\r\n*/\r\n\r\n                        /* gzip file access functions */\r\n\r\n/*\r\n     This library supports reading and writing files in gzip (.gz) format with\r\n   an interface similar to that of stdio, using the functions that start with\r\n   \"gz\".  The gzip format is different from the zlib format.  gzip is a gzip\r\n   wrapper, documented in RFC 1952, wrapped around a deflate stream.\r\n*/\r\n\r\ntypedef struct gzFile_s *gzFile;    /* semi-opaque gzip file descriptor */\r\n\r\n/*\r\nZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));\r\n\r\n     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as\r\n   in fopen (\"rb\" or \"wb\") but can also include a compression level (\"wb9\") or\r\n   a strategy: 'f' for filtered data as in \"wb6f\", 'h' for Huffman-only\r\n   compression as in \"wb1h\", 'R' for run-length encoding as in \"wb1R\", or 'F'\r\n   for fixed code compression as in \"wb9F\".  (See the description of\r\n   deflateInit2 for more information about the strategy parameter.)  'T' will\r\n   request transparent writing or appending with no compression and not using\r\n   the gzip format.\r\n\r\n     \"a\" can be used instead of \"w\" to request that the gzip stream that will\r\n   be written be appended to the file.  \"+\" will result in an error, since\r\n   reading and writing to the same gzip file is not supported.  The addition of\r\n   \"x\" when writing will create the file exclusively, which fails if the file\r\n   already exists.  On systems that support it, the addition of \"e\" when\r\n   reading or writing will set the flag to close the file on an execve() call.\r\n\r\n     These functions, as well as gzip, will read and decode a sequence of gzip\r\n   streams in a file.  The append function of gzopen() can be used to create\r\n   such a file.  (Also see gzflush() for another way to do this.)  When\r\n   appending, gzopen does not test whether the file begins with a gzip stream,\r\n   nor does it look for the end of the gzip streams to begin appending.  gzopen\r\n   will simply append a gzip stream to the existing file.\r\n\r\n     gzopen can be used to read a file which is not in gzip format; in this\r\n   case gzread will directly read from the file without decompression.  When\r\n   reading, this will be detected automatically by looking for the magic two-\r\n   byte gzip header.\r\n\r\n     gzopen returns NULL if the file could not be opened, if there was\r\n   insufficient memory to allocate the gzFile state, or if an invalid mode was\r\n   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).\r\n   errno can be checked to determine if the reason gzopen failed was that the\r\n   file could not be opened.\r\n*/\r\n\r\nZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));\r\n/*\r\n     gzdopen associates a gzFile with the file descriptor fd.  File descriptors\r\n   are obtained from calls like open, dup, creat, pipe or fileno (if the file\r\n   has been previously opened with fopen).  The mode parameter is as in gzopen.\r\n\r\n     The next call of gzclose on the returned gzFile will also close the file\r\n   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor\r\n   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,\r\n   mode);.  The duplicated descriptor should be saved to avoid a leak, since\r\n   gzdopen does not close fd if it fails.  If you are using fileno() to get the\r\n   file descriptor from a FILE *, then you will have to use dup() to avoid\r\n   double-close()ing the file descriptor.  Both gzclose() and fclose() will\r\n   close the associated file descriptor, so they need to have different file\r\n   descriptors.\r\n\r\n     gzdopen returns NULL if there was insufficient memory to allocate the\r\n   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not\r\n   provided, or '+' was provided), or if fd is -1.  The file descriptor is not\r\n   used until the next gz* read, write, seek, or close operation, so gzdopen\r\n   will not detect if fd is invalid (unless fd is -1).\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));\r\n/*\r\n     Set the internal buffer size used by this library's functions.  The\r\n   default buffer size is 8192 bytes.  This function must be called after\r\n   gzopen() or gzdopen(), and before any other calls that read or write the\r\n   file.  The buffer memory allocation is always deferred to the first read or\r\n   write.  Two buffers are allocated, either both of the specified size when\r\n   writing, or one of the specified size and the other twice that size when\r\n   reading.  A larger buffer size of, for example, 64K or 128K bytes will\r\n   noticeably increase the speed of decompression (reading).\r\n\r\n     The new buffer size also affects the maximum length for gzprintf().\r\n\r\n     gzbuffer() returns 0 on success, or -1 on failure, such as being called\r\n   too late.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));\r\n/*\r\n     Dynamically update the compression level or strategy.  See the description\r\n   of deflateInit2 for the meaning of these parameters.\r\n\r\n     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not\r\n   opened for writing.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));\r\n/*\r\n     Reads the given number of uncompressed bytes from the compressed file.  If\r\n   the input file is not in gzip format, gzread copies the given number of\r\n   bytes into the buffer directly from the file.\r\n\r\n     After reaching the end of a gzip stream in the input, gzread will continue\r\n   to read, looking for another gzip stream.  Any number of gzip streams may be\r\n   concatenated in the input file, and will all be decompressed by gzread().\r\n   If something other than a gzip stream is encountered after a gzip stream,\r\n   that remaining trailing garbage is ignored (and no error is returned).\r\n\r\n     gzread can be used to read a gzip file that is being concurrently written.\r\n   Upon reaching the end of the input, gzread will return with the available\r\n   data.  If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then\r\n   gzclearerr can be used to clear the end of file indicator in order to permit\r\n   gzread to be tried again.  Z_OK indicates that a gzip stream was completed\r\n   on the last gzread.  Z_BUF_ERROR indicates that the input file ended in the\r\n   middle of a gzip stream.  Note that gzread does not return -1 in the event\r\n   of an incomplete gzip stream.  This error is deferred until gzclose(), which\r\n   will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip\r\n   stream.  Alternatively, gzerror can be used before gzclose to detect this\r\n   case.\r\n\r\n     gzread returns the number of uncompressed bytes actually read, less than\r\n   len for end of file, or -1 for error.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzwrite OF((gzFile file,\r\n                                voidpc buf, unsigned len));\r\n/*\r\n     Writes the given number of uncompressed bytes into the compressed file.\r\n   gzwrite returns the number of uncompressed bytes written or 0 in case of\r\n   error.\r\n*/\r\n\r\nZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));\r\n/*\r\n     Converts, formats, and writes the arguments to the compressed file under\r\n   control of the format string, as in fprintf.  gzprintf returns the number of\r\n   uncompressed bytes actually written, or 0 in case of error.  The number of\r\n   uncompressed bytes written is limited to 8191, or one less than the buffer\r\n   size given to gzbuffer().  The caller should assure that this limit is not\r\n   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with\r\n   nothing written.  In this case, there may also be a buffer overflow with\r\n   unpredictable consequences, which is possible only if zlib was compiled with\r\n   the insecure functions sprintf() or vsprintf() because the secure snprintf()\r\n   or vsnprintf() functions were not available.  This can be determined using\r\n   zlibCompileFlags().\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));\r\n/*\r\n     Writes the given null-terminated string to the compressed file, excluding\r\n   the terminating null character.\r\n\r\n     gzputs returns the number of characters written, or -1 in case of error.\r\n*/\r\n\r\nZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));\r\n/*\r\n     Reads bytes from the compressed file until len-1 characters are read, or a\r\n   newline character is read and transferred to buf, or an end-of-file\r\n   condition is encountered.  If any characters are read or if len == 1, the\r\n   string is terminated with a null character.  If no characters are read due\r\n   to an end-of-file or len < 1, then the buffer is left untouched.\r\n\r\n     gzgets returns buf which is a null-terminated string, or it returns NULL\r\n   for end-of-file or in case of error.  If there was an error, the contents at\r\n   buf are indeterminate.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));\r\n/*\r\n     Writes c, converted to an unsigned char, into the compressed file.  gzputc\r\n   returns the value that was written, or -1 in case of error.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzgetc OF((gzFile file));\r\n/*\r\n     Reads one byte from the compressed file.  gzgetc returns this byte or -1\r\n   in case of end of file or error.  This is implemented as a macro for speed.\r\n   As such, it does not do all of the checking the other functions do.  I.e.\r\n   it does not check to see if file is NULL, nor whether the structure file\r\n   points to has been clobbered or not.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));\r\n/*\r\n     Push one character back onto the stream to be read as the first character\r\n   on the next read.  At least one character of push-back is allowed.\r\n   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will\r\n   fail if c is -1, and may fail if a character has been pushed but not read\r\n   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the\r\n   output buffer size of pushed characters is allowed.  (See gzbuffer above.)\r\n   The pushed character will be discarded if the stream is repositioned with\r\n   gzseek() or gzrewind().\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));\r\n/*\r\n     Flushes all pending output into the compressed file.  The parameter flush\r\n   is as in the deflate() function.  The return value is the zlib error number\r\n   (see function gzerror below).  gzflush is only permitted when writing.\r\n\r\n     If the flush parameter is Z_FINISH, the remaining data is written and the\r\n   gzip stream is completed in the output.  If gzwrite() is called again, a new\r\n   gzip stream will be started in the output.  gzread() is able to read such\r\n   concatented gzip streams.\r\n\r\n     gzflush should be called only when strictly necessary because it will\r\n   degrade compression if called too often.\r\n*/\r\n\r\n/*\r\nZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,\r\n                                   z_off_t offset, int whence));\r\n\r\n     Sets the starting position for the next gzread or gzwrite on the given\r\n   compressed file.  The offset represents a number of bytes in the\r\n   uncompressed data stream.  The whence parameter is defined as in lseek(2);\r\n   the value SEEK_END is not supported.\r\n\r\n     If the file is opened for reading, this function is emulated but can be\r\n   extremely slow.  If the file is opened for writing, only forward seeks are\r\n   supported; gzseek then compresses a sequence of zeroes up to the new\r\n   starting position.\r\n\r\n     gzseek returns the resulting offset location as measured in bytes from\r\n   the beginning of the uncompressed stream, or -1 in case of error, in\r\n   particular if the file is opened for writing and the new starting position\r\n   would be before the current position.\r\n*/\r\n\r\nZEXTERN int ZEXPORT    gzrewind OF((gzFile file));\r\n/*\r\n     Rewinds the given file. This function is supported only for reading.\r\n\r\n     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)\r\n*/\r\n\r\n/*\r\nZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));\r\n\r\n     Returns the starting position for the next gzread or gzwrite on the given\r\n   compressed file.  This position represents a number of bytes in the\r\n   uncompressed data stream, and is zero when starting, even if appending or\r\n   reading a gzip stream from the middle of a file using gzdopen().\r\n\r\n     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)\r\n*/\r\n\r\n/*\r\nZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));\r\n\r\n     Returns the current offset in the file being read or written.  This offset\r\n   includes the count of bytes that precede the gzip stream, for example when\r\n   appending or when using gzdopen() for reading.  When reading, the offset\r\n   does not include as yet unused buffered input.  This information can be used\r\n   for a progress indicator.  On error, gzoffset() returns -1.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzeof OF((gzFile file));\r\n/*\r\n     Returns true (1) if the end-of-file indicator has been set while reading,\r\n   false (0) otherwise.  Note that the end-of-file indicator is set only if the\r\n   read tried to go past the end of the input, but came up short.  Therefore,\r\n   just like feof(), gzeof() may return false even if there is no more data to\r\n   read, in the event that the last read request was for the exact number of\r\n   bytes remaining in the input file.  This will happen if the input file size\r\n   is an exact multiple of the buffer size.\r\n\r\n     If gzeof() returns true, then the read functions will return no more data,\r\n   unless the end-of-file indicator is reset by gzclearerr() and the input file\r\n   has grown since the previous end of file was detected.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzdirect OF((gzFile file));\r\n/*\r\n     Returns true (1) if file is being copied directly while reading, or false\r\n   (0) if file is a gzip stream being decompressed.\r\n\r\n     If the input file is empty, gzdirect() will return true, since the input\r\n   does not contain a gzip stream.\r\n\r\n     If gzdirect() is used immediately after gzopen() or gzdopen() it will\r\n   cause buffers to be allocated to allow reading the file to determine if it\r\n   is a gzip file.  Therefore if gzbuffer() is used, it should be called before\r\n   gzdirect().\r\n\r\n     When writing, gzdirect() returns true (1) if transparent writing was\r\n   requested (\"wT\" for the gzopen() mode), or false (0) otherwise.  (Note:\r\n   gzdirect() is not needed when writing.  Transparent writing must be\r\n   explicitly requested, so the application already knows the answer.  When\r\n   linking statically, using gzdirect() will include all of the zlib code for\r\n   gzip file reading and decompression, which may not be desired.)\r\n*/\r\n\r\nZEXTERN int ZEXPORT    gzclose OF((gzFile file));\r\n/*\r\n     Flushes all pending output if necessary, closes the compressed file and\r\n   deallocates the (de)compression state.  Note that once file is closed, you\r\n   cannot call gzerror with file, since its structures have been deallocated.\r\n   gzclose must not be called more than once on the same file, just as free\r\n   must not be called more than once on the same allocation.\r\n\r\n     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a\r\n   file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the\r\n   last read ended in the middle of a gzip stream, or Z_OK on success.\r\n*/\r\n\r\nZEXTERN int ZEXPORT gzclose_r OF((gzFile file));\r\nZEXTERN int ZEXPORT gzclose_w OF((gzFile file));\r\n/*\r\n     Same as gzclose(), but gzclose_r() is only for use when reading, and\r\n   gzclose_w() is only for use when writing or appending.  The advantage to\r\n   using these instead of gzclose() is that they avoid linking in zlib\r\n   compression or decompression code that is not used when only reading or only\r\n   writing respectively.  If gzclose() is used, then both compression and\r\n   decompression code will be included the application when linking to a static\r\n   zlib library.\r\n*/\r\n\r\nZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));\r\n/*\r\n     Returns the error message for the last error which occurred on the given\r\n   compressed file.  errnum is set to zlib error number.  If an error occurred\r\n   in the file system and not in the compression library, errnum is set to\r\n   Z_ERRNO and the application may consult errno to get the exact error code.\r\n\r\n     The application must not modify the returned string.  Future calls to\r\n   this function may invalidate the previously returned string.  If file is\r\n   closed, then the string previously returned by gzerror will no longer be\r\n   available.\r\n\r\n     gzerror() should be used to distinguish errors from end-of-file for those\r\n   functions above that do not distinguish those cases in their return values.\r\n*/\r\n\r\nZEXTERN void ZEXPORT gzclearerr OF((gzFile file));\r\n/*\r\n     Clears the error and end-of-file flags for file.  This is analogous to the\r\n   clearerr() function in stdio.  This is useful for continuing to read a gzip\r\n   file that is being written concurrently.\r\n*/\r\n\r\n#endif /* !Z_SOLO */\r\n\r\n                        /* checksum functions */\r\n\r\n/*\r\n     These functions are not related to compression but are exported\r\n   anyway because they might be useful in applications using the compression\r\n   library.\r\n*/\r\n\r\nZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));\r\n/*\r\n     Update a running Adler-32 checksum with the bytes buf[0..len-1] and\r\n   return the updated checksum.  If buf is Z_NULL, this function returns the\r\n   required initial value for the checksum.\r\n\r\n     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed\r\n   much faster.\r\n\r\n   Usage example:\r\n\r\n     uLong adler = adler32(0L, Z_NULL, 0);\r\n\r\n     while (read_buffer(buffer, length) != EOF) {\r\n       adler = adler32(adler, buffer, length);\r\n     }\r\n     if (adler != original_adler) error();\r\n*/\r\n\r\n/*\r\nZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,\r\n                                          z_off_t len2));\r\n\r\n     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1\r\n   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for\r\n   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of\r\n   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.  Note\r\n   that the z_off_t type (like off_t) is a signed integer.  If len2 is\r\n   negative, the result has no meaning or utility.\r\n*/\r\n\r\nZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));\r\n/*\r\n     Update a running CRC-32 with the bytes buf[0..len-1] and return the\r\n   updated CRC-32.  If buf is Z_NULL, this function returns the required\r\n   initial value for the crc.  Pre- and post-conditioning (one's complement) is\r\n   performed within this function so it shouldn't be done by the application.\r\n\r\n   Usage example:\r\n\r\n     uLong crc = crc32(0L, Z_NULL, 0);\r\n\r\n     while (read_buffer(buffer, length) != EOF) {\r\n       crc = crc32(crc, buffer, length);\r\n     }\r\n     if (crc != original_crc) error();\r\n*/\r\n\r\n/*\r\nZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));\r\n\r\n     Combine two CRC-32 check values into one.  For two sequences of bytes,\r\n   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were\r\n   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32\r\n   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and\r\n   len2.\r\n*/\r\n\r\n\r\n                        /* various hacks, don't look :) */\r\n\r\n/* deflateInit and inflateInit are macros to allow checking the zlib version\r\n * and the compiler's view of z_stream:\r\n */\r\nZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,\r\n                                     const char *version, int stream_size));\r\nZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,\r\n                                     const char *version, int stream_size));\r\nZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,\r\n                                      int windowBits, int memLevel,\r\n                                      int strategy, const char *version,\r\n                                      int stream_size));\r\nZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,\r\n                                      const char *version, int stream_size));\r\nZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,\r\n                                         unsigned char FAR *window,\r\n                                         const char *version,\r\n                                         int stream_size));\r\n#define deflateInit(strm, level) \\\r\n        deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))\r\n#define inflateInit(strm) \\\r\n        inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))\r\n#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \\\r\n        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\\\r\n                      (strategy), ZLIB_VERSION, (int)sizeof(z_stream))\r\n#define inflateInit2(strm, windowBits) \\\r\n        inflateInit2_((strm), (windowBits), ZLIB_VERSION, \\\r\n                      (int)sizeof(z_stream))\r\n#define inflateBackInit(strm, windowBits, window) \\\r\n        inflateBackInit_((strm), (windowBits), (window), \\\r\n                      ZLIB_VERSION, (int)sizeof(z_stream))\r\n\r\n#ifndef Z_SOLO\r\n\r\n/* gzgetc() macro and its supporting function and exposed data structure.  Note\r\n * that the real internal state is much larger than the exposed structure.\r\n * This abbreviated structure exposes just enough for the gzgetc() macro.  The\r\n * user should not mess with these exposed elements, since their names or\r\n * behavior could change in the future, perhaps even capriciously.  They can\r\n * only be used by the gzgetc() macro.  You have been warned.\r\n */\r\nstruct gzFile_s {\r\n    unsigned have;\r\n    unsigned char *next;\r\n    z_off64_t pos;\r\n};\r\nZEXTERN int ZEXPORT gzgetc_ OF((gzFile file));  /* backward compatibility */\r\n#ifdef Z_PREFIX_SET\r\n#  undef z_gzgetc\r\n#  define z_gzgetc(g) \\\r\n          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))\r\n#else\r\n#  define gzgetc(g) \\\r\n          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))\r\n#endif\r\n\r\n/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or\r\n * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if\r\n * both are true, the application gets the *64 functions, and the regular\r\n * functions are changed to 64 bits) -- in case these are set on systems\r\n * without large file support, _LFS64_LARGEFILE must also be true\r\n */\r\n#ifdef Z_LARGE64\r\n   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));\r\n   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));\r\n   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));\r\n   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));\r\n   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));\r\n   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));\r\n#endif\r\n\r\n#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)\r\n#  ifdef Z_PREFIX_SET\r\n#    define z_gzopen z_gzopen64\r\n#    define z_gzseek z_gzseek64\r\n#    define z_gztell z_gztell64\r\n#    define z_gzoffset z_gzoffset64\r\n#    define z_adler32_combine z_adler32_combine64\r\n#    define z_crc32_combine z_crc32_combine64\r\n#  else\r\n#    define gzopen gzopen64\r\n#    define gzseek gzseek64\r\n#    define gztell gztell64\r\n#    define gzoffset gzoffset64\r\n#    define adler32_combine adler32_combine64\r\n#    define crc32_combine crc32_combine64\r\n#  endif\r\n#  ifndef Z_LARGE64\r\n     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));\r\n     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));\r\n     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));\r\n     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));\r\n     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));\r\n     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));\r\n#  endif\r\n#else\r\n   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));\r\n   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));\r\n   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));\r\n   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));\r\n   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));\r\n   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));\r\n#endif\r\n\r\n#else /* Z_SOLO */\r\n\r\n   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));\r\n   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));\r\n\r\n#endif /* !Z_SOLO */\r\n\r\n/* hack for buggy compilers */\r\n#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)\r\n    struct internal_state {int dummy;};\r\n#endif\r\n\r\n/* undocumented functions */\r\nZEXTERN const char   * ZEXPORT zError           OF((int));\r\nZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));\r\nZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table    OF((void));\r\nZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));\r\nZEXTERN int            ZEXPORT inflateResetKeep OF((z_streamp));\r\nZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));\r\n#if defined(_WIN32) && !defined(Z_SOLO)\r\nZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,\r\n                                            const char *mode));\r\n#endif\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* ZLIB_H */\r\n"
  },
  {
    "path": "Engine/porting/dirent.c",
    "content": "/*\r\n\r\n    Implementation of POSIX directory browsing functions and types for Win32.\r\n\r\n    Author:  Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)\r\n    History: Created March 1997. Updated June 2003 and July 2012.\r\n    Rights:  See end of file.\r\n\r\n*/\r\n\r\n#ifdef _WIN32\r\n\r\n#include <dirent.h>\r\n#include <errno.h>\r\n#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\ntypedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */\r\n\r\nstruct DIR\r\n{\r\n    handle_type         handle; /* -1 for failed rewind */\r\n    struct _finddata_t  info;\r\n    struct dirent       result; /* d_name null iff first time */\r\n    char                *name;  /* null-terminated char string */\r\n};\r\n\r\nDIR *opendir(const char *name)\r\n{\r\n    DIR *dir = 0;\r\n\r\n    if(name && name[0])\r\n    {\r\n        size_t base_length = strlen(name);\r\n        const char *all = /* search pattern must end with suitable wildcard */\r\n            strchr(\"/\\\\\", name[base_length - 1]) ? \"*\" : \"/*\";\r\n\r\n        if((dir = (DIR *) malloc(sizeof *dir)) != 0 &&\r\n           (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0)\r\n        {\r\n            strcat(strcpy(dir->name, name), all);\r\n\r\n            if((dir->handle =\r\n                (handle_type) _findfirst(dir->name, &dir->info)) != -1)\r\n            {\r\n                dir->result.d_name = 0;\r\n            }\r\n            else /* rollback */\r\n            {\r\n                free(dir->name);\r\n                free(dir);\r\n                dir = 0;\r\n            }\r\n        }\r\n        else /* rollback */\r\n        {\r\n            free(dir);\r\n            dir   = 0;\r\n            errno = ENOMEM;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        errno = EINVAL;\r\n    }\r\n\r\n    return dir;\r\n}\r\n\r\nint closedir(DIR *dir)\r\n{\r\n    int result = -1;\r\n\r\n    if(dir)\r\n    {\r\n        if(dir->handle != -1)\r\n        {\r\n            result = _findclose(dir->handle);\r\n        }\r\n\r\n        free(dir->name);\r\n        free(dir);\r\n    }\r\n\r\n    if(result == -1) /* map all errors to EBADF */\r\n    {\r\n        errno = EBADF;\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nstruct dirent *readdir(DIR *dir)\r\n{\r\n    struct dirent *result = 0;\r\n\r\n    if(dir && dir->handle != -1)\r\n    {\r\n        if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)\r\n        {\r\n            result         = &dir->result;\r\n            result->d_name = dir->info.name;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        errno = EBADF;\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nvoid rewinddir(DIR *dir)\r\n{\r\n    if(dir && dir->handle != -1)\r\n    {\r\n        _findclose(dir->handle);\r\n        dir->handle = (handle_type) _findfirst(dir->name, &dir->info);\r\n        dir->result.d_name = 0;\r\n    }\r\n    else\r\n    {\r\n        errno = EBADF;\r\n    }\r\n}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n/*\r\n\r\n    Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.\r\n\r\n    Permission to use, copy, modify, and distribute this software and its\r\n    documentation for any purpose is hereby granted without fee, provided\r\n    that this copyright and permissions notice appear in all copies and\r\n    derivatives.\r\n    \r\n    This software is supplied \"as is\" without express or implied warranty.\r\n\r\n    But that said, if there are any problems please get in touch.\r\n\r\n*/\r\n\r\n#endif // Win32\r\n"
  },
  {
    "path": "Engine/porting/dirent.h",
    "content": "#ifndef DIRENT_INCLUDED\r\n#define DIRENT_INCLUDED\r\n\r\n/*\r\n\r\n    Declaration of POSIX directory browsing functions and types for Win32.\r\n\r\n    Author:  Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)\r\n    History: Created March 1997. Updated June 2003.\r\n    Rights:  See end of file.\r\n    \r\n*/\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\ntypedef struct DIR DIR;\r\n\r\nstruct dirent\r\n{\r\n    char *d_name;\r\n};\r\n\r\nDIR           *opendir(const char *);\r\nint           closedir(DIR *);\r\nstruct dirent *readdir(DIR *);\r\nvoid          rewinddir(DIR *);\r\n\r\n/*\r\n\r\n    Copyright Kevlin Henney, 1997, 2003. All rights reserved.\r\n\r\n    Permission to use, copy, modify, and distribute this software and its\r\n    documentation for any purpose is hereby granted without fee, provided\r\n    that this copyright and permissions notice appear in all copies and\r\n    derivatives.\r\n    \r\n    This software is supplied \"as is\" without express or implied warranty.\r\n\r\n    But that said, if there are any problems please get in touch.\r\n\r\n*/\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/AppDelegate.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  AppDelegate.m\r\n//  GameEngine\r\n//\r\n//\r\n#import <UIKit/UIApplication.h>\r\n#import \"AppDelegate.h\"\r\n\r\n#import \"ViewController.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CiOSSysResource.h\"\r\n#include \"CiOSAudioManager.h\"\r\n\r\n@implementation AppDelegate\r\n\r\n@synthesize window = _window;\r\n@synthesize viewController = _viewController;\r\n\r\n- (void)dealloc\r\n{\r\n    [_window release];\r\n    [_viewController release];\r\n    [super dealloc];\r\n}\r\n\r\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\r\n{\r\n    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];\r\n    // Override point for customization after application launch.\r\n    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {\r\n        self.viewController = [[[ViewController alloc] initWithNibName:@\"ViewController_iPhone\" bundle:nil] autorelease];\r\n    } else {\r\n        self.viewController = [[[ViewController alloc] initWithNibName:@\"ViewController_iPad\" bundle:nil] autorelease];\r\n    }\r\n    self.window.rootViewController = self.viewController;\r\n    [self.window makeKeyAndVisible];\r\n\r\n    return YES;\r\n}\r\n\r\n- (void)applicationWillResignActive:(UIApplication *)application\r\n{\r\n    /*\r\n     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.\r\n     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.\r\n     */\r\n    [_viewController stopAnimation];\r\n    CiOSAudioManager::GetInstance().AudioDidResignActive();\r\n    if(CPFInterface::getInstance().isClient()) {\r\n        IClientRequest& client = CPFInterface::getInstance().client();\r\n        client.controlEvent(IClientRequest::E_PAUSE, 0, 0, 0, 0, 0);\r\n        client.frameFlip(1);    // 1フレーム分まわす。経過時間は 1[ms] という扱い。\r\n        CiOSAudioManager::GetInstance().Exec(); // サウンドの毎フレーム処理\r\n    }\r\n}\r\n\r\n- (void)applicationDidEnterBackground:(UIApplication *)application\r\n{\r\n    /*\r\n     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. \r\n     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.\r\n     */\r\n    /* バックグラウンドにいく */\r\n    CiOSAudioManager::GetInstance().AudioDidEnterBackground();\r\n    [_viewController clearUITouches];\r\n    [_viewController stopAnimation];\r\n    [_viewController viewRecovery]; // \r\n}\r\n\r\n- (void)applicationWillEnterForeground:(UIApplication *)application\r\n{\r\n    /*\r\n     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.\r\n     */\r\n    /* フォアグラウンドに戻ってくる */\r\n    CiOSAudioManager::GetInstance().AudioDidEnterForeground();\r\n    [_viewController startAnimation];\r\n    [_viewController viewRecovery];\r\n}\r\n\r\n- (void)applicationDidBecomeActive:(UIApplication *)application\r\n{\r\n    /*\r\n     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.\r\n     */\r\n    CiOSAudioManager::GetInstance().AudioDidBecomeActive();\r\n    [_viewController startAnimation];\r\n    if(CPFInterface::getInstance().isClient()) {\r\n        CPFInterface::getInstance().client().controlEvent(IClientRequest::E_RESUME, 0, 0, 0, 0, 0);\r\n    }\r\n}\r\n\r\n- (void)applicationWillTerminate:(UIApplication *)application\r\n{\r\n    /*\r\n     Called when the application is about to terminate.\r\n     Save data if appropriate.\r\n     See also applicationDidEnterBackground:.\r\n     */\r\n    // ゲーム終了処理を呼ぶ\r\n//    CPFInterface::getInstance().client().finishGame();\r\n    // make sure idleTimerDisabled is resetted\r\n    [UIApplication sharedApplication].idleTimerDisabled = NO;\r\n}\r\n\r\n- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken\r\n{\r\n    NSUInteger len = [devToken length];\r\n    const void * devTokenBytes = (len > 0) ? [devToken bytes] : 0;\r\n  \r\n    CiOSSysResource& sysRes = CiOSSysResource::getInstance();\r\n        \r\n    if(devTokenBytes) {\r\n        sysRes.setDevID(devTokenBytes);\r\n    } else {\r\n        sysRes.failedDevID();\r\n    }\r\n}\r\n\r\n- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)error\r\n{\r\n    NSLog(@\"Error in registration. Error: %@\", error);\r\n    CiOSSysResource& sysRes = CiOSSysResource::getInstance();\r\n    sysRes.failedDevID();\r\n}\r\n@end\r\n\r\n"
  },
  {
    "path": "Engine/porting/iOS/CSockReadStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockReadStream.cpp\r\n//\r\n//\r\n#include <sys/types.h>\r\n#include <sys/socket.h>\r\n#include <netinet/in.h>\r\n#include <arpa/inet.h>\r\n#include <fcntl.h>\r\n#include <sys/ioctl.h>\r\n#include <netdb.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <errno.h>\r\n#include <iostream>\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CSockReadStream.h\"\r\n#include \"CSockWriteStream.h\"\r\n\r\n\r\nCSockReadStream::CSockReadStream() : m_writeStream(0), m_eStat(NORMAL), m_fd(0), m_lastPos(0), m_getPos(0) {}\r\nCSockReadStream::~CSockReadStream()\r\n{\r\n    // 生成時に作成した書き込み用ストリームオブジェクトを破棄\r\n    if(m_writeStream) delete m_writeStream;\r\n    // 破棄時にソケットをクローズする\r\n    if(m_fd) close(m_fd);    \r\n}\r\n\r\n/*!\r\n ¥param  hostname   IPアドレス表記またはFQDN表記のホスト指定\r\n ¥param  port       接続する TCP/IP の port 番号\r\n\r\n ¥return 接続成功ならば true, 失敗すれば false\r\n */\r\nint\r\nCSockReadStream::sock_connect(const char *hostname, int port)\r\n{\r\n    int dstSocket;\r\n    struct sockaddr_in dstAddr;\r\n\r\n    m_fd = 0;\r\n    memset(&dstAddr, 0, sizeof(dstAddr));\r\n    dstAddr.sin_port = htons(port);\r\n    dstAddr.sin_family = AF_INET;\r\n    dstAddr.sin_addr.s_addr = inet_addr(hostname);\r\n\r\n    if(dstAddr.sin_addr.s_addr == 0xffffffff) {\r\n        struct hostent *host;\r\n        host = gethostbyname(hostname);\r\n        if(!host) return -1;\r\n        dstAddr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0];\r\n    }\r\n    dstSocket = socket(AF_INET, SOCK_STREAM, 0);\r\n\r\n    // SIGPIPEシグナルの設定\r\n    int errVal = 1;\r\n    if( 0 > setsockopt(dstSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&errVal, sizeof(errVal)) )\r\n    {\r\n        CPFInterface::getInstance().platform().logging(\"[socket] err setsockopt errno:%d\", errVal);\r\n        return -1;\r\n    }\r\n    \r\n    // 接続\r\n    if(0 > connect(dstSocket, (struct sockaddr *)&dstAddr, sizeof(dstAddr))) {\r\n        close(dstSocket);\r\n        return -1;\r\n    }\r\n    // 取得したディスクリプタは、ノンブロックモードにて運用する。\r\n    int flags = fcntl(dstSocket, F_GETFL, 0);\r\n    fcntl(dstSocket, F_SETFL, flags | O_NONBLOCK);\r\n\r\n    return dstSocket;\r\n}\r\n\r\nbool\r\nCSockReadStream::setStatus()\r\n{\r\n    switch(errno)\r\n    {\r\n        default:\r\n            m_eStat = CLOSED;\r\n            if(m_fd > 0) {\r\n                close(m_fd);\r\n                m_fd = 0;\r\n            }\r\n            CPFInterface::getInstance().platform().logging(\"errno = %d\", errno);\r\n            break;\r\n        case EAGAIN:\r\n            m_eStat = NOT_AVAILABLE;\r\n//            CPFInterface::getInstance().platform().logging(\"errno = EAGAIN\");\r\n            break;\r\n        case ETIMEDOUT:\r\n            m_eStat = CLOSED;\r\n            if(m_fd > 0) {\r\n                close(m_fd);\r\n                m_fd = 0;\r\n            }\r\n            CPFInterface::getInstance().platform().logging(\"errno = ETIMEDOUT\");\r\n            break;\r\n        case ENOTCONN:\r\n            m_eStat = NOT_CONNECT;\r\n            if(m_fd > 0) {\r\n                close(m_fd);\r\n                m_fd = 0;\r\n            }\r\n            CPFInterface::getInstance().platform().logging(\"errno = ENOTCONN\");\r\n            break;\r\n    }\r\n    return false;   // 必ず false を返す\r\n}\r\n/*!\r\n ¥return  リングバッファ読み込みが正常終了していれば true, 失敗ならば false\r\n \r\n 受信データをリングバッファに蓄積します。\r\n */\r\nbool\r\nCSockReadStream::readRingBuf()\r\n{\r\n    if((m_lastPos > m_getPos) && (m_lastPos < READ_BUFSIZ)) {\r\n        int result = read(m_fd, m_readBuf + m_lastPos, READ_BUFSIZ - m_lastPos);\r\n        if(result < 0) return false;\r\n        m_lastPos += result;\r\n    }\r\n    if((m_lastPos == READ_BUFSIZ) && (m_getPos > 0)) {\r\n        int result = read(m_fd, m_readBuf, m_getPos);\r\n        if(result < 0) return false;\r\n        if(result > 0) m_lastPos = result;\r\n    } else if(m_lastPos < m_getPos) {\r\n        int result = read(m_fd, m_readBuf + m_lastPos, m_getPos - m_lastPos);\r\n        if(result < 0) return false;\r\n        m_lastPos += result;\r\n    } else if(m_getPos == 0 && m_lastPos == 0) {\r\n        // バッファが完全に空の状態\r\n        int result = read(m_fd, m_readBuf, READ_BUFSIZ);\r\n        if(result < 0) return false;\r\n        m_lastPos += result;\r\n    }\r\n    // m_lastPos == m_getPos && m_lastPos > 0 はバッファがいっぱい\r\n    // m_lastPos == READ_BUFSIZE && m_getPos == 0 も同様\r\n    return true;\r\n}\r\n\r\n\r\n/*!\r\n ¥param buf     データを受け取るバッファ\r\n ¥param size    要求サイズ\r\n\r\n 読み込みバッファを経由して、指定サイズのデータを取得する。\r\n ネットワークの読み込みが追いつかない場合、読み込みポインタが更新されない。\r\n */\r\nbool\r\nCSockReadStream::requestData(unsigned char * buf, size_t reqSize)\r\n{\r\n    // 最初にステータスを NORMAL にする。途中で問題があれば書きかわる。\r\n    // 正常系を通れば問題なくNORMALを維持できる。\r\n    m_eStat = NORMAL;\r\n\r\n    // リングバッファへの読み込みを試みる。\r\n    if(!readRingBuf()) {\r\n        setStatus();\r\n    }\r\n    \r\n    // リングバッファの残りサイズが要求サイズ以上であるか確認し、サイズが足りなければ false を返す。\r\n    size_t leftSize = left_size();\r\n    if(!reqSize || leftSize < reqSize) {\r\n        // m_eStat = NOT_AVAILABLE;\r\n        return false;\r\n    }\r\n    // リングバッファから指定のバッファに指定サイズを転送する\r\n    int rdsiz = ((READ_BUFSIZ - m_getPos) >= reqSize) ? reqSize : (READ_BUFSIZ - m_getPos);\r\n    memcpy(buf, m_readBuf + m_getPos, rdsiz);\r\n    m_getPos += rdsiz;\r\n    if(m_getPos == READ_BUFSIZ) {\r\n        m_getPos = 0;\r\n        if(m_lastPos == READ_BUFSIZ) m_lastPos = 0;\r\n    }\r\n    if(0 < (reqSize - rdsiz)) {\r\n        memcpy(buf + rdsiz, m_readBuf, reqSize - rdsiz);\r\n        m_getPos += reqSize - rdsiz;\r\n    }\r\n\r\n    // 読み込み済みデータに追いついたら、一旦バッファを仕切り直す。\r\n    if(m_lastPos == m_getPos) m_lastPos = m_getPos = 0;\r\n    \r\n    return true;\r\n}\r\n\r\nCSockReadStream *\r\nCSockReadStream::openStream(const char * sockName)\r\n{\r\n    char * strHost = 0;\r\n    char * strPort = 0;\r\n    CSockReadStream * pStream = 0;\r\n    try {\r\n        pStream = new CSockReadStream();\r\n        if(!pStream)\r\n        {\r\n            return 0;\r\n        }\r\n\r\n        // 渡されたホスト:portを分解する\r\n        for(int i = 0; sockName[i]; i++) {\r\n            if(sockName[i] == ':') {\r\n                strHost = new char [ i + 1 ];\r\n                strncpy(strHost, sockName, i);\r\n                strHost[i] = 0;\r\n                int plen = strlen(sockName + i + 1);\r\n                strPort = new char [ plen + 1 ];\r\n                strcpy(strPort, sockName + i + 1);\r\n                break;\r\n            }\r\n        }\r\n        if(!strHost || !strPort) {\r\n            // 与えられた名称の書式が不正\r\n            pStream->m_eStat = NOT_FOUND;\r\n\t\t\tif( strPort )\tdelete [] strPort;\r\n\t\t\tif( strHost )\tdelete [] strHost;\r\n            return pStream;\r\n        }\r\n\r\n        // port を数値に変換する。\r\n        // 数列であることを確認。\r\n        for(int i = 0; strPort[i]; i++) {\r\n            if(strPort[i] < '0' || strPort[i] > '9') {\r\n                // 数字以外が含まれている場合は接続先指定として不正\r\n                pStream->m_eStat = NOT_FOUND;\r\n\t\t\t\tif( strPort )\tdelete [] strPort;\r\n\t\t\t\tif( strHost )\tdelete [] strHost;\r\n                return pStream;\r\n            }\r\n        }\r\n        // 特に問題ないので、port を数値に変換する\r\n        int port = atoi(strPort);\r\n\r\n        // 接続を試みる\r\n        int fd = pStream->sock_connect(strHost, port);\r\n        if(fd < 0) {\r\n            // 接続に失敗した場合\r\n            pStream->m_eStat = NOT_FOUND;\r\n\t\t\tif( strPort )\tdelete [] strPort;\r\n\t\t\tif( strHost )\tdelete [] strHost;\r\n            return pStream;\r\n        }\r\n        pStream->m_fd = fd;\r\n        // 同時に書き込み用クラスを生成\r\n        pStream->m_writeStream = new CSockWriteStream(*pStream);\r\n\r\n        pStream->m_eStat = NORMAL;\r\n        \r\n    } catch(std::bad_alloc& ex) {\r\n\t\tif( strPort )\tdelete [] strPort;\r\n\t\tif( strHost )\tdelete [] strHost;\r\n        delete pStream;\r\n        return 0;\r\n    }\r\n    \r\n\tif( strPort )\tdelete [] strPort;\r\n\tif( strHost )\tdelete [] strHost;\r\n    return pStream;\r\n}\r\n\r\n\r\ns32  \r\nCSockReadStream::getSize()\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!readRingBuf()) {\r\n        setStatus();\r\n//      return 0;\r\n    }\r\n    size_t leftSize = left_size();\r\n    return (s32)leftSize;\r\n}\r\ns32\r\nCSockReadStream::getPosition()\r\n{\r\n    // ネットワークソケットは位置を取得できない\r\n    return 0;\r\n}\r\n\r\n/*\r\n ネットワークストリームの場合、全ての読み込みメソッドにおいて\r\n *必ずしも読み込みが成功するわけではない* ことに注意する必要がある。\r\n 相手ホストがデータを送信していない場合、たとえ8bitのデータでも読み込みに失敗することがある。\r\n \r\n readBlock() 以外は読み込みの成否を返すようには出来ていないため、\r\n 実行後に必ず getStatus() でステータスを確認し、NOT_AVAILABLE である場合は\r\n 戻り値に意味が無いものとして破棄する必要がある。\r\n*/\r\n\r\nu8\r\nCSockReadStream::readU8()\r\n{\r\n    u8 buf;\r\n    if(!requestData(&buf, 1))return 0xff;\r\n    return buf;\r\n}\r\n\r\n\r\nu16\r\nCSockReadStream::readU16()\r\n{\r\n    u8 buf[2];\r\n    if(!requestData(buf, 2))return 0xffff;\r\n    return (u16)buf[0] << 8 | (u16)buf[1];\r\n}\r\n\r\nu32\r\nCSockReadStream::readU32()\r\n{\r\n    u8 buf[4];\r\n    if(!requestData(buf, 4)) return 0xffff;\r\n    return ((u32)buf[0] << 24) | ((u32)buf[1] << 16) | ((u32)buf[2] << 8) | (u32)buf[3];\r\n    \r\n}\r\nfloat\r\nCSockReadStream::readFloat()\r\n{\r\n    float buf;\r\n    if(!requestData((unsigned char *)&buf, sizeof(float))) return -6e24;\r\n    return buf;\r\n}\r\n\r\n/*!\r\n 指定サイズ読み込み失敗時に読み込み位置を更新しないリングバッファ方式のため、\r\n byteSize にはリングバッファのサイズ以上を指定できない。\r\n */\r\nbool\r\nCSockReadStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n    if(!requestData((unsigned char *)buffer, byteSize)) return false;\r\n    return true;\r\n}\r\n\r\nCSockReadStream::ESTATUS\r\nCSockReadStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\n// この Stream から書き込み(送出)可能なストリームを生成する\r\nIWriteStream *\r\nCSockReadStream::getWriteStream()\r\n{\r\n    return m_writeStream;\r\n}\r\n\r\nint\r\nCSockReadStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n    // リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\r\n    if(!requestData((unsigned char *)pBufferU16, items * sizeof(u16))) return 0;\r\n    \r\n    // iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\r\n\r\n    return items;\r\n}\r\n\r\nint\r\nCSockReadStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n    // リングバッファに指定サイズを要求するので、全て取得できるか、全く取れないかのどちらかになる。\r\n    if(!requestData((unsigned char *)pBufferU32, items * sizeof(u32))) return 0;\r\n    \r\n    // iOS および Android/ARM では元から big endian なのでバイトオーダー入れ替えは発生しない。\r\n    \r\n    return items;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CSockWriteStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockWriteStream.cpp\r\n//\r\n//\r\n\r\n#include <iostream>\r\n#include \"CSockWriteStream.h\"\r\n#include \"CSockReadStream.h\"\r\n\r\n\r\n// CSockWriteStream は、CSockReadStream が CSockReadStream::create() によって\r\n// 生成されたタイミングで作られる、書き込み(送出)用インタフェースとなるクラス。\r\n// socket は基本的に書き込み可能なストリームなので、必ず生成され、内部的に保持される。\r\nCSockWriteStream::CSockWriteStream(CSockReadStream& rdStream) : m_fd(rdStream.m_fd), m_eStat(NORMAL){}\r\nCSockWriteStream::~CSockWriteStream() {}\r\n\r\nbool\r\nCSockWriteStream::sendData(unsigned char *buffer, size_t sndSize)\r\n{\r\n    // ひとまず、送出についてはその場で与えられたブロック全てを送出し終わるまで続ける形で実装する。\r\n    // ゲームで使う上で問題が生じたら、それはそれで考える。\r\n    size_t pos = 0;\r\n    do {\r\n        int result = write(m_fd, buffer + pos, sndSize - pos);\r\n        if(result < 0) return false;\r\n        pos += result;\r\n    } while(pos < sndSize);\r\n    return true;\r\n}\r\n\r\nCSockWriteStream::ESTATUS\r\nCSockWriteStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\ns32\r\nCSockWriteStream::getPosition()\r\n{\r\n    return 0;   // socket は位置の取得ができない\r\n}\r\nvoid\r\nCSockWriteStream::writeU8(u8 value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData(&value, 1)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }\r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU16(u16 value)\r\n{\r\n    unsigned char buf[2];\r\n    \r\n    // big endian\r\n    buf[0] = (value >> 8) & 0xff;\r\n    buf[1] = value & 0xff;\r\n    \r\n    m_eStat = NORMAL;\r\n    if(!sendData(buf, 2)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeU32(u32 value)\r\n{\r\n    unsigned char buf[4];\r\n    \r\n    // big endian\r\n    buf[0] = (value >> 24) & 0xff;\r\n    buf[1] = (value >> 16) & 0xff;\r\n    buf[2] = (value >> 8) & 0xff;\r\n    buf[3] = value & 0xff;\r\n    \r\n    m_eStat = NORMAL;\r\n    if(!sendData(buf, 4)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeFloat(float value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData((unsigned char *)&value, sizeof(float))) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }    \r\n}\r\n\r\nvoid\r\nCSockWriteStream::writeBlock(void* buffer, u32 byteSize)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(!sendData((unsigned char *)buffer, byteSize)) {\r\n        m_eStat = CAN_NOT_WRITE;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSAudio.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSAudio.cpp\r\n//\r\n//\r\n\r\n/*\r\n iOS の API をたたくので、Objective-C++ で実装される。\r\n */\r\n#import <UIKit/UIKit.h>\r\n#import <GLKit/GLKit.h>\r\n\r\n#include <iostream>\r\n#import <mach/mach_time.h>\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"iOSFileLocation.h\"\r\n#include \"CiOSPathConv.h\"\r\n#include \"CiOSAudio.h\"\r\n#include \"CiOSReadFileStream.h\"\r\n#include \"CiOSPlatform.h\"\r\n\r\n// #define DEBUG_AUDIO\r\n\r\n// 論理トップレベルディレクトリと、物理ディレクトリパスの対応を行うテーブル。\r\nconst CiOSAudio::LOCLIST CiOSAudio::m_toplevel[3] = {\r\n    { \"external/\",  PATH_EXTERN  },   // インストール後、更新の対象となる可変ファイル\r\n    { \"install/\",   PATH_INSTALL },   // インストール時に配置される固定ファイル\r\n    { 0, 0 }\r\n};\r\n\r\ncAudioFadeParam* cAudioFadeParam::s_fadeParamList = NULL;\r\nvoid*            cAudioFadeParam::s_fadeParamThread = NULL;\r\n\r\n// フェードパラメータクラス\r\ncAudioFadeParam::cAudioFadeParam()\r\n: m_fadeCnt(0)\r\n, m_startVol(0.0f)\r\n, m_endVol(0.0f)\r\n, m_fadeRatio(1.0f)\r\n, m_nowFadeInterType(INTER_TYPE_NONE)\r\n, m_nowFadeType(FADE_TYPE_NONE)\r\n, m_fadeMiliSec(0)\r\n, m_bfade(false)\r\n, m_prevmseq(0)\r\n, m_pAudio(NULL)\r\n, m_pSession(NULL)\r\n, m_prev(NULL)\r\n, m_next(NULL)\r\n{\r\n    attach();\r\n}\r\n\r\ncAudioFadeParam::~cAudioFadeParam()\r\n{\r\n    detach();\r\n}\r\n\r\nvoid cAudioFadeParam::attach()\r\n{\r\n    if( s_fadeParamList == NULL )\r\n    {\r\n        s_fadeParamList = this;\r\n    }\r\n    else\r\n    {\r\n        // 先頭と入れ替え\r\n        m_next = s_fadeParamList;\r\n        s_fadeParamList->m_prev = this;\r\n        s_fadeParamList = this;\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::detach()\r\n{\r\n    if( m_pAudio != NULL || m_pSession != NULL ) {\r\n        return;\r\n    }\r\n    \r\n    if( m_next && m_prev )\r\n    {\r\n        m_next->m_prev = m_prev;\r\n        m_prev->m_next = m_next;\r\n    }\r\n    else if( m_prev )\r\n    {\r\n        // 前方のみがいるつまりは自身は末尾\r\n        m_prev->m_next = NULL;\r\n    }\r\n    else if( m_next )\r\n    {\r\n        // 後方のみがいるつまりは自身は先頭\r\n        m_next->m_prev = NULL;\r\n        s_fadeParamList = m_next;\r\n    }\r\n    else\r\n    {\r\n        // 自身のみ\r\n        s_fadeParamList = NULL;\r\n    }\r\n    \r\n    m_next = NULL;\r\n    m_prev = NULL;\r\n}\r\n\r\nvoid cAudioFadeParam::exec()\r\n{\r\n    if( m_pAudio == NULL && m_pSession == NULL ) return;\r\n    \r\n    s64 nowSeq = 0;\r\n    \r\n    if( (m_bfade == false) && (m_nowFadeType != FADE_TYPE_NONE) )\r\n    {\r\n        m_bfade = true;\r\n        if( m_pAudio ) {\r\n            m_prevmseq = m_pAudio->tell();\r\n        } else if( m_pSession ) {\r\n            m_prevmseq = m_pSession->tell();\r\n        }\r\n\t\t#ifdef DEBUG_AUDIO\r\n        CPFInterface::getInstance().platform().logging(\"[sound] bgm[%p] se[%p]: fade start!\", m_pAudio, m_pSession);\r\n\t\t#endif\r\n    }\r\n    if( m_bfade )\r\n    {\r\n        if( m_pAudio ) {\r\n            nowSeq = m_pAudio->tell();\r\n        } else if( m_pSession ) {\r\n            nowSeq = m_pSession->tell();\r\n        }\r\n        \r\n        // フェードカウントインクリメント\r\n        m_fadeCnt += (nowSeq - m_prevmseq);\r\n        if( m_fadeCnt >= m_fadeMiliSec ) {\r\n            m_fadeCnt = m_fadeMiliSec;\r\n        } else if (m_fadeCnt < 0) {\r\n\t\t\tm_fadeCnt = 0;\r\n\t\t}\r\n        \r\n        // 係数計算\r\n        if( m_fadeCnt >= 0 )\r\n        {\r\n            m_fadeRatio = m_startVol + ((m_endVol - m_startVol) * ((float)m_fadeCnt / (float)m_fadeMiliSec));\r\n            if( m_fadeRatio < 0.0f ) {\r\n                m_fadeRatio = 0.0f;\r\n            } else if( m_fadeRatio > 1.0f ) {\r\n                m_fadeRatio = 1.0f;\r\n            }\r\n        }\r\n        \r\n        // サウンドに大して設定\r\n        if( m_pAudio ) {\r\n            m_pAudio->setFadeRatio(m_fadeRatio);\r\n        } else if( m_pSession ) {\r\n            m_pSession->setFadeRatio(m_fadeRatio);\r\n        }\r\n        \r\n        // フェード終了の確認\r\n        if( m_fadeCnt >= m_fadeMiliSec )\r\n        {\r\n            m_fadeCnt = m_fadeMiliSec;\r\n            m_bfade = false;\r\n            \r\n            if( m_nowFadeType == FADE_TYPE_STOP )\r\n            {\r\n                if( m_pAudio )\r\n                {\r\n                    m_pAudio->stop();\r\n                }\r\n                else if( m_pSession )\r\n                {\r\n                    m_pSession->stop();\r\n                    m_pSession->checkSessionStoped();\r\n                }\r\n            }\r\n            else if( m_nowFadeType == FADE_TYPE_PAUSE )\r\n            {\r\n                if( m_pAudio ) {\r\n                    m_pAudio->pause();\r\n                } else if( m_pSession ) {\r\n                    //m_pSession->stop(); // SEは現在ポーズの概念が無い\r\n                }\r\n            }\r\n            \r\n            if( m_pAudio )\r\n            {\r\n                cAudioFadeParam::Remove(m_pAudio);\r\n            }\r\n            else if( m_pSession )\r\n            {\r\n                cAudioFadeParam::Remove(m_pSession);\r\n            }\r\n            m_nowFadeType = FADE_TYPE_NONE;\r\n        }\r\n        \r\n        if( m_pAudio ) {\r\n            m_prevmseq = m_pAudio->tell();\r\n        } else if( m_pSession ) {\r\n            m_prevmseq = m_pSession->tell();\r\n        }\r\n    }\r\n}\r\n\r\nbool cAudioFadeParam::setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVolume)\r\n{\r\n    if( _msec <= 0 || _fadeType >= FADE_TYPE_NUM || _fadeType <= FADE_TYPE_NONE )\r\n    {\r\n        // フェードしないため初期化\r\n        m_nowFadeType = INTER_TYPE_NONE;\r\n        m_nowFadeType = FADE_TYPE_NONE;\r\n        m_endVol = 0.0f;\r\n        m_fadeCnt = 0;\r\n        //m_fadeRatio = 1.0f;\r\n        m_fadeMiliSec = 0;\r\n        m_bfade = false;\r\n        m_prevmseq = 0;\r\n        return true;\r\n    }\r\n    \r\n    m_fadeCnt = 0;\r\n    m_endVol = _tgtVol;\r\n    m_nowFadeType = _fadeType;\r\n    m_nowFadeInterType = _interType;\r\n    switch( _fadeType )\r\n    {\r\n        case FADE_TYPE_PLAY:\r\n        case FADE_TYPE_RESUME:\r\n            m_startVol = _startVolume;\r\n            m_fadeRatio = _startVolume;\r\n            break;\r\n                \r\n        case FADE_TYPE_STOP:\r\n        case FADE_TYPE_PAUSE:\r\n        case FADE_TYPE_PLAYING:\r\n            if( m_pAudio ) {\r\n                m_startVol = m_pAudio->getFadeRatio();\r\n            } else {\r\n                m_startVol = m_pSession->getFadeRatio();\r\n            }\r\n            m_fadeRatio = m_startVol;\r\n            break;\r\n    }\r\n    m_fadeMiliSec = _msec;\r\n    m_bfade = false;\r\n    m_prevmseq = 0;\r\n    return true;\r\n}\r\n\r\n/*\r\n    @brief  サウンドのフェードパラメータの初期処理(スレッドの作成など)\r\n */\r\nvoid cAudioFadeParam::AudioFadeParamInit()\r\n{\r\n    // フェード管理用のスレッド作成\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    if( s_fadeParamThread == NULL ) {\r\n        s_fadeParamThread = pForm.createThread(ThreadAudioFadeParam, NULL);\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::AudioFadeParamExit()\r\n{\r\n    // フェード管理用のスレッド破棄\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    if( s_fadeParamThread != NULL )\r\n    {\r\n        pForm.deleteThread(s_fadeParamThread);\r\n        s_fadeParamThread = NULL;\r\n    }\r\n    \r\n    cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n    while( pfadeParam )\r\n    {\r\n        cAudioFadeParam* pNext = pfadeParam->m_next;\r\n        pfadeParam->detach();\r\n        delete pfadeParam;\r\n        \r\n        pfadeParam = pNext;\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::SetFadeParam(CiOSAudio * _audio, CiOSAudioSession * _settion, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType, float _startVolume)\r\n{\r\n    // 現在の設定がある場合は上書き\r\n    bool bFind = false;\r\n\r\n    cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n    while( pfadeParam )\r\n    {\r\n        cAudioFadeParam * pNext = pfadeParam->m_next;\r\n        if( pfadeParam->m_pAudio == _audio && _audio != NULL )\r\n        {\r\n            pfadeParam->setFadeParam(_fadeType, _tgtVol, _msec, _interType, _startVolume);\r\n            bFind = true;\r\n            break;\r\n        }\r\n        else if( pfadeParam->m_pSession == _settion && _settion != NULL )\r\n        {\r\n            pfadeParam->setFadeParam(_fadeType, _tgtVol, _msec, _interType, _startVolume);\r\n            bFind = true;\r\n            break;\r\n        }\r\n        pfadeParam = pNext;\r\n    }\r\n    \r\n    // 見つからなかった場合は新規で作成\r\n    if( bFind == false )\r\n    {\r\n        cAudioFadeParam * pNew = new cAudioFadeParam;\r\n        pNew->m_pAudio = _audio;\r\n        pNew->m_pSession = _settion;\r\n        pNew->setFadeParam(_fadeType, _tgtVol, _msec, _interType, _startVolume);\r\n    }\r\n}\r\n\r\nvoid cAudioFadeParam::Remove(void * _audio)\r\n{\r\n    if( _audio == NULL ) return;\r\n    \r\n    cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n    while( pfadeParam )\r\n    {\r\n        // 先頭で次の要素を保持しておく\r\n        cAudioFadeParam* pNext = pfadeParam->m_next;\r\n        \r\n        if( pfadeParam->m_pAudio == _audio ) {\r\n            pfadeParam->m_pAudio = NULL;\r\n\t\t\t#ifdef DEBUG_AUDIO\r\n            CPFInterface::getInstance().platform().logging(\"[sound] bgm[%p] se[%p]: fade end!\", _audio, NULL );\r\n\t\t\t#endif\r\n        }\r\n        if( pfadeParam->m_pSession == _audio ) {\r\n            pfadeParam->m_pSession = NULL;\r\n\t\t\t#ifdef DEBUG_AUDIO\r\n            CPFInterface::getInstance().platform().logging(\"[sound] bgm[%p] se[%p]: fade end!\", NULL, _audio );\r\n\t\t\t#endif\r\n        }\r\n        \r\n        pfadeParam = pNext;\r\n    }\r\n}\r\n\r\ns32 cAudioFadeParam::ThreadAudioFadeParam(void * hThread, void * data)\r\n{\r\n    while( 1 )\r\n    {\r\n        cAudioFadeParam * pfadeParam = s_fadeParamList;\r\n        while( pfadeParam )\r\n        {\r\n            cAudioFadeParam* pNext = pfadeParam->m_next;\r\n            pfadeParam->exec();\r\n            pfadeParam = pNext;\r\n        }\r\n        \r\n        pfadeParam = s_fadeParamList;\r\n        while( pfadeParam )\r\n        {\r\n            cAudioFadeParam* pNext = pfadeParam->m_next;\r\n            \r\n            // デタッチ\r\n            if( pfadeParam->m_pAudio == NULL && pfadeParam->m_pSession == NULL )\r\n            {\r\n                delete pfadeParam;\r\n                pfadeParam = NULL;\r\n            }\r\n            \r\n            pfadeParam = pNext;\r\n        }\r\n        [NSThread sleepForTimeInterval:0.016]; // sleep\r\n    }\r\n    \r\n    return 0; // 終了\r\n}\r\n\r\n// iOSオーディオクラス\r\nCiOSAudio::CiOSAudio()\r\n: m_bActive(false)\r\n, m_soundPath(0)\r\n, m_preLoad(false)\r\n, m_queue(0)\r\n, m_bInit(false)\r\n, m_luaPause(false)\r\n, m_volume(1.0f)\r\n, m_pan(0.0f)\r\n, m_step(STEP_WAIT)\r\n, m_begin(0), m_end(0)\r\n, m_fadeRatio(1.0f)\r\n, m_ASPD(NULL)\r\n, m_interruptionType(CiOSAudioManager::eINTERRUPTION_TYPE_NONE)\r\n{\r\n}\r\n\r\nCiOSAudio::~CiOSAudio()\r\n{\r\n    closeAudio();\r\n}\r\n\r\nbool\r\nCiOSAudio::openAudio(const char * path, CiOSPlatform * platform)\r\n{\r\n    closeAudio(); // 既に開いている場合は一旦閉じる\r\n    \r\n    m_platform = platform;\r\n    CiOSPathConv& pathconv = CiOSPathConv::getInstance();\r\n    m_soundPath = pathconv.fullpath(path, \".mp3\");\r\n    m_nowPlayTime = 0;\r\n    m_startPackNum = 0;\r\n    m_step = STEP_WAIT;\r\n    m_buf_level = 1;\r\n    m_last_delta = 0;\r\n    m_fadeRatio = 1.0f;\r\n    m_volume = 1.0f;\r\n    m_luaPause = false;\r\n\r\n    // fullpath が出来ている。\r\n    m_bActive = (m_soundPath) ? true : false;\r\n    float rad = M_PI / 4.0f;\r\n    m_panL = sin(rad);\r\n    m_panR = cos(rad);\r\n    m_bInit = false;\r\n    \r\n    if( m_bActive )\r\n    {\r\n        // サウンドデータ解析\r\n        if( GetSoundAnalysisData(m_soundPath, &m_soundAnalysisData) )\r\n        {\r\n        }\r\n    }\r\n    \r\n    return m_bActive;\r\n}\r\n\r\nbool\r\nCiOSAudio::loadMem()\r\n{\r\n    if(!m_bActive) return false;\r\n    if(m_preLoad) return true;\t// 2012.12.06  同じ処理を複数回しないように追加\r\n    m_preLoad = true;\r\n    \r\n    // SEとしてメモリ上にロードしておく\r\n    initSE();\r\n    return true;\r\n}\r\n\r\nvoid\r\nCiOSAudio::play(s32 _msec, float _tgtVol, float _startVolume)\r\n{\r\n    if(!m_bActive) return;\r\n\r\n    // 一時停止中は再生再開\r\n    if(m_step == STEP_PAUSE) {\r\n        resume(_msec, _tgtVol);\r\n        return;\r\n    }\r\n    \r\n    // SEの場合\r\n    if(m_preLoad)\r\n    {\r\n        playSE(_msec, _tgtVol, _startVolume);\r\n        return;\r\n    }\r\n    \r\n    // ここはなにやってるの？\r\n    /*\r\n    if(m_step == STEP_PAUSE) {\r\n        m_nowPlayTime = 0;\r\n        m_startPackNum = 0;\r\n        resume(_msec, _tgtVol);\r\n        return true;\r\n    }\r\n     */\r\n    \r\n    if(m_step != STEP_WAIT) return;\r\n\r\n    if(!m_bInit)\r\n    {\r\n        // BGMとして設定されている場合\r\n        initBGM();  // ロードして再生準備\r\n        m_bInit = true;\r\n        m_last_delta = 0;\r\n    }\r\n    m_nowPlayTime = 0;\r\n    m_startPackNum = 0;\r\n    m_pauseTime = 0;\r\n    m_fadeRatio = _startVolume;\r\n    playBGM();  // 再生を開始する\r\n    if( _msec > 0 && (_tgtVol != _startVolume) ) {\r\n        cAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_PLAY, _tgtVol, _msec, _startVolume);\r\n    }\r\n    OSStatus err = AudioQueueStart(m_queue, 0);\r\n    /*\r\n    if( err != kAudioSessionNoError )\r\n    {\r\n        CiOSAudioManager::GetInstance().AudioSessionInit();\r\n        while( AudioQueueStart(m_queue, 0) != kAudioSessionNoError ) {\r\n            CiOSAudioManager::GetInstance().AudioSessionInit();\r\n        }\r\n    }\r\n     */\r\n    \r\n    m_step = STEP_PLAY;\r\n    return;\r\n}\r\n\r\nvoid\r\nCiOSAudio::updateVolume()\r\n{\r\n    if(m_preLoad) {\r\n        // SEの場合\r\n        float rad = (1.0f - m_pan) * M_PI / 4.0f;\r\n        m_panL = sin(rad);\r\n        m_panR = cos(rad);\r\n        CiOSAudioSession * pSession = m_begin;\r\n        while(pSession)\r\n        {\r\n            CiOSAudioSession * next = pSession->m_next;\r\n            pSession->m_volume = m_volume;          // seボリューム設定\r\n            pSession->setFadeRatio(m_fadeRatio);    // フェード係数設定\r\n            pSession = next;\r\n        }\r\n    } else {\r\n        // BGMの場合\r\n        OSStatus err = noErr;\r\n        float master = m_platform->getMasterVolume(false);\r\n        AudioQueueParameterValue vol = (AudioQueueParameterValue)(m_volume * master * m_fadeRatio);\r\n        // volが1.0より大きい場合にAudioQueueSetParameterで音量を設定したときにアサーションが起きてしまう、\r\n        // そもそも音量は1.0以上大きくなっても音量が1.0より大きくなる訳ではないので丸めてしまう。\r\n        if( vol > 1.0f ) {\r\n            vol  = 1.0f;\r\n        }\r\n        if( m_queue )\r\n        {\r\n            err = AudioQueueSetParameter(m_queue, kAudioQueueParam_Volume, vol);\r\n            klb_assert(!err, \"Sound volume error.\");\r\n\r\n            // BGMの場合\r\n            err = noErr;\r\n            AudioQueueParameterValue vpan = (AudioQueueParameterValue)m_pan;\r\n            err = AudioQueueSetParameter(m_queue, kAudioQueueParam_Pan, vpan);\r\n            klb_assert(!err, \"Sound pan error. err code[%d]\", (int)err);\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::checkSessionStoped()\r\n{\r\n    CiOSAudioSession * pSession = m_begin;\r\n    bool bEnd = true;\r\n    while(pSession)\r\n    {\r\n        CiOSAudioSession * next = pSession->m_next;\r\n        if( pSession->isPlaying() == true )\r\n        {\r\n            bEnd = false;\r\n            break;\r\n        }\r\n        pSession = next;\r\n    }\r\n    if( bEnd )\r\n    {\r\n        m_nowPlayTime = 0;\r\n        m_pauseTime = 0;\r\n        m_step = STEP_WAIT;\r\n    }\r\n}\r\n\r\n/*!\r\n    @brief  再生終了のSEを削除\r\n */\r\nvoid CiOSAudio::audioSessionCleanup()\r\n{\r\n    // SEの終了を監視し終わっている物は削除\r\n    cleanup();\r\n}\r\n\r\n\r\nvoid\r\nCiOSAudio::setVolume(float volume)\r\n{\r\n    m_volume = volume;\r\n    updateVolume();\r\n}\r\n\r\nvoid\r\nCiOSAudio::setPan(float pan)\r\n{\r\n    m_pan = pan;\r\n    updateVolume();\r\n}\r\n\r\nvoid\r\nCiOSAudio::cleanup()\r\n{\r\n    CiOSAudioSession * pSession = m_begin;\r\n    while(pSession) {\r\n        CiOSAudioSession * next = pSession->m_next;\r\n        if(!pSession->isPlaying())\r\n        {\r\n            cAudioFadeParam::Remove(pSession);\r\n            delete pSession;\r\n        }\r\n        pSession = next;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::stop(s32 _msec, float _tgtVol)\r\n{\r\n    if(!m_bActive) return;\r\n\r\n    // SEの再生が終了してるものに関しては止める必要も無いので削除\r\n    cleanup();\r\n    \r\n    if( _msec <= 0 )\r\n    {\r\n        // 即時停止\r\n        if(m_preLoad)\r\n        {\r\n            // SEの停止\r\n            CiOSAudioSession * pSession = m_begin;\r\n            while(pSession)\r\n            {\r\n                CiOSAudioSession * next = pSession->m_next;\r\n                cAudioFadeParam::Remove(pSession);\r\n                delete pSession;\r\n                pSession = next;\r\n            }\r\n            m_nowPlayTime = 0;\r\n            m_pauseTime = 0;\r\n            m_step = STEP_WAIT;\r\n        }\r\n        else\r\n        {\r\n            // BGMの停止\r\n            cAudioFadeParam::Remove(this);\r\n            AudioQueueStop(m_queue, true);\r\n            AudioQueueDisposeTimeline(m_queue, m_TlineRef);\r\n            m_nowPlayTime = 0;\r\n            m_startPackNum = 0;\r\n            m_pauseTime = 0;\r\n            m_step = STEP_WAIT;\r\n\r\n        }\r\n    }\r\n    else\r\n    {\r\n        // フェード\r\n        if(m_preLoad)\r\n        {\r\n            // SEの停止\r\n            CiOSAudioSession * pSession = m_begin;\r\n            while(pSession)\r\n            {\r\n                CiOSAudioSession * next = pSession->m_next;\r\n                cAudioFadeParam::SetFadeParam(NULL, pSession, cAudioFadeParam::FADE_TYPE_STOP, _tgtVol, _msec, 0.0f);\r\n                pSession = next;\r\n            }\r\n        }\r\n        else\r\n        {\r\n            // BGMの停止\r\n            cAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_STOP, _tgtVol, _msec, 0.0f);\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::closeAudio()\r\n{\r\n    if(!m_bActive) return;\r\n\r\n    if(m_preLoad) {\r\n        // SEの停止\r\n        // このSEの全セッションを破棄\r\n        CiOSAudioSession * pSession = m_begin;\r\n        while(pSession)\r\n        {\r\n            CiOSAudioSession * next = pSession->m_next;\r\n            cAudioFadeParam::Remove(pSession);\r\n            delete pSession;\r\n            pSession = next;\r\n        }\r\n        for(int i = 0; i < m_ASBD.mChannelsPerFrame; i++) {\r\n            delete [] m_playBuffer[i];\r\n        }\r\n        delete [] m_playBuffer;\r\n    } else {\r\n        // BGMの破棄\r\n        cAudioFadeParam::Remove(this);\r\n        AudioQueueStop(m_queue, true);\r\n        AudioQueueDispose(m_queue, true);\r\n        AudioQueueDisposeTimeline(m_queue, m_TlineRef);\r\n        AudioFileClose(m_audioID);\r\n        m_queue = 0;\r\n    }\r\n    // open前に戻す\r\n    m_bActive = false;\r\n    m_preLoad = false;\r\n    m_bInit = false;\r\n    if( m_soundPath )\r\n    {\r\n        delete [] m_soundPath;\r\n        m_soundPath = 0;\r\n    }\r\n    if( m_ASPD )\r\n    {\r\n        delete [] m_ASPD;\r\n        m_ASPD = NULL;\r\n    }\r\n\t\r\n\tm_encFile.release();\r\n}\r\n\r\n// SEは同時に複数再生され、どれを止めればよいかわからないため、BGMに対してのみ有効。\r\nvoid\r\nCiOSAudio::pause(s32 _msec, float _tgtVol)\r\n{\r\n    if(m_step == STEP_PLAY)\r\n    {\r\n        if( m_preLoad )\r\n        {\r\n            // SEの場合現状何をポーズさせるか不明なのでスルー\r\n            CiOSAudioSession * pSession = m_begin;\r\n            while(pSession)\r\n            {\r\n                CiOSAudioSession * next = pSession->m_next;\r\n                pSession->pause();\r\n                pSession = next;\r\n            }\r\n            m_step = STEP_PAUSE;\r\n        }\r\n        else\r\n        {\r\n            // BGMのポーズ\r\n            if( _msec <= 0.0f )\r\n            {\r\n                m_pauseTime = m_startPackNum;\r\n                cAudioFadeParam::Remove(this);\r\n                \r\n                //AudioQueuePause(m_queue);\r\n                // 停止前に現在の再生時間を取得\r\n                m_nowPlayTime = tell();\r\n                AudioQueueStop(m_queue, true);\r\n                \r\n                m_bSeeked = false;\r\n                m_step = STEP_PAUSE;\r\n                #ifdef DEBUG_AUDIO\r\n                CiOSPlatform::getInstance()->logging(\"[Audio] pause Audio!\");\r\n                #endif\r\n\r\n            }\r\n            else\r\n            {\r\n                cAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_PAUSE, _tgtVol, _msec, 1.0f/*_startVolume*/);\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::resume(s32 _msec, float _tgtVol)\r\n{\r\n    if(m_step == STEP_PAUSE)\r\n    {\r\n        if( m_preLoad )\r\n        {\r\n            // SEの場合ポーズが現状できないので一時停止解除もスルー\r\n            CiOSAudioSession * pSession = m_begin;\r\n            while(pSession)\r\n            {\r\n                CiOSAudioSession * next = pSession->m_next;\r\n                pSession->resume();\r\n                pSession = next;\r\n            }\r\n            m_step = STEP_PLAY;\r\n        }\r\n        else\r\n        {\r\n            // BGMの一時停止解除\r\n/*\r\n            AudioQueueStop(m_queue, false);\r\n            m_startPackNum = m_pauseTime;\r\n            m_nowPlayTime = (s32)(m_startPackNum * m_ASBD.mFramesPerPacket * (UInt64)1000 / m_ASBD.mSampleRate);\r\n */\r\n            uint64_t tval = mach_absolute_time();\r\n            mach_timebase_info_data_t base;\r\n            mach_timebase_info(&base);\r\n            uint64_t now_time = (s64)((tval * base.numer) / base.denom);\r\n            m_tval = now_time - m_last_delta;\r\n            \r\n            // 再生再開前に読み出し開始位置を再設定して初期バッファ再度読み込み\r\n            m_startPackNum = m_nowPlayTime * m_ASBD.mSampleRate / (m_ASBD.mFramesPerPacket * 1000);\r\n            for(int i = 0; i < BUF_COUNT; i++) {\r\n                queueCallback(this, m_queue, m_qBuf[ i ]);\r\n            }\r\n            AudioQueueStart(m_queue, 0);\r\n            \r\n\t\t\t#ifdef DEBUG_AUDIO\r\n            CiOSPlatform::getInstance()->logging(\"[Audio] resume Audio!\");\r\n\t\t\t#endif\r\n            /*\r\n            if( err != kAudioSessionNoError )\r\n            {\r\n                CiOSAudioManager::GetInstance().AudioSessionInit();\r\n                while( AudioQueueStart(m_queue, 0) != kAudioSessionNoError ) {\r\n                    CiOSAudioManager::GetInstance().AudioSessionInit();\r\n                }\r\n            }\r\n             */\r\n            if( _msec > 0.0f ) {\r\n                cAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_RESUME, _tgtVol, _msec, 0.0f/*_startVolume*/);\r\n            }\r\n            m_step = STEP_PLAY;\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::seek(s32 millisec)\r\n{\r\n    // if(!m_bInit) return;\r\n    UInt64 milli = millisec;\r\n    if(!m_bInit) {\r\n        play();\r\n        pause();\r\n    }\r\n    if(m_step == STEP_PLAY) {\r\n        AudioQueuePause(m_queue);\r\n    }\r\n\r\n    AudioQueueFlush(m_queue);\r\n    m_startPackNum = milli * m_ASBD.mSampleRate / (m_ASBD.mFramesPerPacket * 1000);\r\n    m_nowPlayTime = (s32)(m_startPackNum * m_ASBD.mFramesPerPacket * (UInt64)1000 / m_ASBD.mSampleRate);\r\n    \r\n    if(!m_bSeeked) {\r\n        AudioQueueStop(m_queue, 0);\r\n        m_bSeeked = true;\r\n    }\r\n    if(m_step == STEP_PLAY) {\r\n        AudioQueueStart(m_queue, 0);\r\n        m_bSeeked = false;\r\n    }\r\n}\r\n\r\ns32\r\nCiOSAudio::tell()\r\n{\r\n    if( m_step == STEP_WAIT || m_step == STEP_PAUSE ) {\r\n        return m_nowPlayTime;\r\n//        return 0;\r\n    }\r\n    AudioTimeStamp outTime;\r\n    AudioQueueGetCurrentTime(m_queue, m_TlineRef, &outTime, 0);\r\n    s32 playtime = outTime.mSampleTime * 1000 / m_ASBD.mSampleRate;\r\n    if( playtime < 0 ) {\r\n        playtime = 0;\r\n    }\r\n    return m_nowPlayTime + playtime;\r\n /*\r\n    if(m_step == STEP_PLAY) {\r\n        uint64_t tval = mach_absolute_time();\r\n        mach_timebase_info_data_t base;\r\n        mach_timebase_info(&base);\r\n        uint64_t delta = (s64)((tval * base.numer) / base.denom) - m_tval;\r\n        m_last_delta = (delta / 1000000);\r\n    }\r\n    return m_nowPlayTime + m_last_delta;\r\n  */\r\n}\r\n\r\ns32\r\nCiOSAudio::totalPlayTime()\r\n{\r\n    return m_soundAnalysisData.m_totalTime;\r\n}\r\n\r\nvoid\r\nCiOSAudio::setFadeParam(float _tgtVol, u32 _msec)\r\n{\r\n    if( m_preLoad )\r\n    {\r\n        cleanup(); // SE再生してない物は破棄\r\n        CiOSAudioSession * pSession = m_begin;\r\n        while(pSession)\r\n        {\r\n            CiOSAudioSession * next = pSession->m_next;\r\n            cAudioFadeParam::SetFadeParam(NULL, pSession, cAudioFadeParam::FADE_TYPE_PLAYING, _tgtVol, _msec);\r\n            pSession = next;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        if( m_step == STEP_PLAY ) {\r\n            cAudioFadeParam::SetFadeParam(this, NULL, cAudioFadeParam::FADE_TYPE_PLAYING, _tgtVol, _msec);\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::setFadeRatio(float _fadeRatio)\r\n{\r\n    m_fadeRatio = _fadeRatio;\r\n    updateVolume();\r\n}\r\n\r\ns32\r\nCiOSAudio::getState()\r\n{\r\n    s32 state = IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\r\n    switch( m_step )\r\n    {\r\n        case STEP_PLAY:\r\n            state = IClientRequest::E_SOUND_STATE_PLAY;\r\n            break;\r\n        case STEP_PAUSE:\r\n            state = IClientRequest::E_SOUND_STATE_PAUSE;\r\n            break;\r\n        case STEP_WAIT:\r\n            state = IClientRequest::E_SOUND_STATE_STOP;\r\n            break;\r\n    }\r\n    return state;\r\n}\r\n\r\n\r\nAudioFileMemory::AudioFileMemory()\r\n: m_decrypter()\r\n, m_decryptBuffer( NULL )\r\n, m_dataLength(0)\r\n{\r\n}\r\n\r\nbool AudioFileMemory::loadFile(const char* url) {\r\n\t//\r\n\t// Open File, Get Size and setup decryption.\r\n\t//\r\n\tbool res\t= false;\r\n\tm_decryptBuffer\t= NULL;\r\n\tFILE* pFile = fopen(url,\"rb\");\r\n\tif (pFile) {\r\n\t\tu8 hdr[4];\r\n\t\tfread(hdr, 1,4,pFile);\r\n\t\t\r\n\t\tu32 hasHeader = decryptSetup( (u8*)url , hdr );\r\n\r\n\t\t// get Size\r\n\t\tfseek(pFile, 0, SEEK_END);\r\n\t\tm_dataLength = ftell(pFile) - (hasHeader*4);\r\n\t\tfseek(pFile, (hasHeader*4), SEEK_SET);\r\n\t\t\r\n\t\t// Alloc buffer\r\n\t\tm_decryptBuffer = new u8[m_dataLength];\r\n\t\t\r\n\t\tif (m_decryptBuffer) {\r\n\t\t\t//\r\n\t\t\t// Read & Decrypt\r\n\t\t\t//\r\n\t\t\tu32 count = fread(m_decryptBuffer, 1, m_dataLength, pFile);\r\n\t\t\tdecrypt(m_decryptBuffer, count);\r\n\t\t\tres = true;\r\n\t\t}\r\n\t\t\r\n\t\t// Complete\r\n\t\tfclose(pFile); \r\n\t}\r\n\t\r\n\tif ((res == false) && m_decryptBuffer) {\r\n\t\trelease();\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nvoid AudioFileMemory::release() {\r\n\tdelete m_decryptBuffer;\r\n\tm_decryptBuffer = NULL;\r\n}\r\n\r\nOSStatus AudioFileReadProc(void *inClientData, SInt64 inPosition, UInt32 requestCount, void *buffer, UInt32 *actualCount)\r\n{\r\n    // check parameters\r\n    if (!inClientData || !buffer || !actualCount) {\r\n        return EINVAL;\r\n    }\r\n     \r\n    AudioFileMemory *audioFileMemory = (AudioFileMemory *)inClientData;\r\n\r\n\t// [OPTION] Use FILE* and use fread instead of preload.\r\n         \r\n    // make sure position is within bounds\r\n    if (inPosition < 0 || inPosition >= audioFileMemory->m_dataLength) {\r\n        *actualCount = 0; \r\n        return noErr;\r\n    }\r\n     \r\n    // see if we need to cap requested length\r\n    *actualCount = requestCount;\r\n    SInt64 endPosition = inPosition + requestCount;\r\n    if (endPosition >= audioFileMemory->m_dataLength) {\r\n        *actualCount = requestCount - (endPosition - audioFileMemory->m_dataLength);\r\n    }\r\n     \r\n    memcpy(buffer, audioFileMemory->m_decryptBuffer + inPosition, *actualCount);\r\n\t// [OPTION] Can decrypt here instead of preload.\r\n\t// --> Need to recompute the decrypt key for given position.\r\n    return noErr;\r\n}\r\n \r\nSInt64 AudioFileGetSizeProc(void *inClientData) {\r\n    if (!inClientData) {\r\n        return EINVAL;\r\n    }\r\n     \r\n    AudioFileMemory *audioFileMemory = (AudioFileMemory *)inClientData;\r\n    return audioFileMemory->m_dataLength;\r\n}\r\n \r\nAudioFileTypeID GetAudioFileTypeId(CFURLRef inFileURL)\r\n{\r\n    return kAudioFileMP3Type;\r\n}\r\n\r\nvoid\r\nCiOSAudio::initBGM()\r\n{\r\n    if(m_bActive)\r\n    {\r\n        OSStatus err = noErr;\r\n\t\tm_encFile.loadFile(m_soundPath);\r\n\t\terr = AudioFileOpenWithCallbacks(&m_encFile,\r\n\t\t\t\t\t\t\t\t\t\tAudioFileReadProc,\r\n\t\t\t\t\t\t\t\t\t\tNULL,\t// Write\r\n\t\t\t\t\t\t\t\t\t\tAudioFileGetSizeProc,\r\n\t\t\t\t\t\t\t\t\t\tNULL,\t// Set Size\r\n\t\t\t\t\t\t\t\t\t\tkAudioFileMP3Type, &m_audioID\r\n\t\t);\r\n\t\t\r\n        if (!err)\r\n        {\r\n            UInt32 size = sizeof(m_ASBD);\r\n            err = AudioFileGetProperty(m_audioID, kAudioFilePropertyDataFormat, &size, &m_ASBD);\r\n            klb_assert(!err && m_ASBD.mFormatID == kAudioFormatMPEGLayer3, \"format not support.\");\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudio::playBGM()\r\n{\r\n    // BGMとしてロードされている場合\r\n    // 実態としてはアクセス用のパスを作ったところで終わっているので、\r\n    // そのパスの音声を再生するAVAudioPlayerクラスを作成する。\r\n    OSStatus err = noErr;\r\n    err = AudioQueueNewOutput(&m_ASBD, CiOSAudio::queueCallback, this, CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &m_queue);\r\n    \r\n    float master = m_platform->getMasterVolume(false);\r\n    AudioQueueParameterValue vol = (AudioQueueParameterValue)(master * m_volume * m_fadeRatio);\r\n    err = AudioQueueSetParameter(m_queue, kAudioQueueParam_Volume, vol);\r\n    \r\n    UInt32 size = sizeof(m_maxPacketSize);\r\n    err = AudioFileGetProperty(m_audioID, kAudioFilePropertyPacketSizeUpperBound, &size, &m_maxPacketSize);\r\n    \r\n    //\r\n    UInt32 codecPolicy = kAudioQueueHardwareCodecPolicy_PreferSoftware;\r\n    size = sizeof(codecPolicy);\r\n    err = AudioQueueSetProperty(m_queue, kAudioQueueProperty_HardwareCodecPolicy, &codecPolicy, size);\r\n    \r\n    // m_numPacketPerTime = m_ASBD.mSampleRate / (m_ASBD.mFramesPerPacket * 12);\r\n    \r\n    // できるだけ高い精度で再生時刻を取得するため、m_numPacketPerTime を強制的に 1 として扱う\r\n    // 1パケット中に含まれるPCMフレーム数は m_ASBD.mFramesPerPacket にあり、1パケットあたりの経過時間の累計で\r\n    // 現在時刻を算出できる。\r\n    switch (m_buf_level) {\r\n        case 0:\r\n            m_numPacketPerTime = 1;\r\n            break;\r\n        case 1:\r\n            m_numPacketPerTime = m_ASBD.mFramesPerPacket;\r\n            break;\r\n        case 2:\r\n            m_numPacketPerTime = m_ASBD.mFramesPerPacket * 2;\r\n            break;\r\n        default:\r\n            break;\r\n    }\r\n    // m_numPacketPerTime = 1;\r\n    \r\n    AudioQueueCreateTimeline(m_queue, &m_TlineRef);\r\n    \r\n    if( m_ASPD ) {\r\n        delete [] m_ASPD;\r\n    }\r\n    m_ASPD = new AudioStreamPacketDescription [ (int)m_numPacketPerTime ];\r\n    UInt32 bufSize = m_numPacketPerTime * m_maxPacketSize;\r\n    \r\n    for(int i = 0; i < 3; i++) {\r\n        err = AudioQueueAllocateBuffer(m_queue, bufSize, &(m_qBuf[i]));\r\n        if(err) {\r\n            klb_assert(!err, \"queue allocation error.\");\r\n        }\r\n        queueCallback(this, m_queue, m_qBuf[ i ]);\r\n    }\r\n    \r\n    // 音量更新\r\n    updateVolume();\r\n}\r\n\t\t\t\t\r\nvoid\r\nCiOSAudio::initSE()\r\n{\r\n    if(!m_bActive) return;\r\n\r\n    NSString * nspath = [NSString stringWithUTF8String:m_soundPath];\r\n    m_soundURL = [NSURL fileURLWithPath:nspath];\r\n    OSStatus err = noErr;\r\n\r\n\t// Old code : err = ExtAudioFileOpenURL((CFURLRef)m_soundURL, &m_extAudioID);\r\n\tm_encFile.loadFile(m_soundPath);\r\n\terr = AudioFileOpenWithCallbacks(&m_encFile,\r\n\t\t\t\t\t\t\t\t\tAudioFileReadProc,\r\n\t\t\t\t\t\t\t\t\tNULL,\t// Write\r\n\t\t\t\t\t\t\t\t\tAudioFileGetSizeProc,\r\n\t\t\t\t\t\t\t\t\tNULL,\t// Set Size\r\n\t\t\t\t\t\t\t\t\tkAudioFileMP3Type, &m_audioID\r\n\t);\r\n\t\r\n    klb_assert(err == noErr, \"could not open SE file.\");\r\n\t\r\n\terr = ExtAudioFileWrapAudioFileID (\r\n\t\tm_audioID,\r\n\t\tfalse,\r\n\t\t&m_extAudioID\r\n\t);\r\n\t\r\n    klb_assert(err == noErr, \"could not open SE file.\");\r\n\t\r\n    UInt32 size = sizeof(m_ASBD);\r\n    err = ExtAudioFileGetProperty(m_extAudioID, kExtAudioFileProperty_FileDataFormat, &size, &m_ASBD);\r\n    klb_assert(err == noErr && m_ASBD.mFormatID == kAudioFormatMPEGLayer3, \"format not support.\");\r\n    //m_volume = 1.0f;\r\n    \r\n    //m_clientFormat.mSampleRate        = 44100.0;\r\n    m_clientFormat.mSampleRate        = m_ASBD.mSampleRate;     // 2012/12/04 サンプリングレートが固定値で44100で入力されていたのが間違い、これだとサンプリングレートが44100以外の音声が途切れたりしてしまう。\r\n    m_clientFormat.mFormatID          = kAudioFormatLinearPCM;\r\n    m_clientFormat.mFormatFlags       = kAudioFormatFlagsAudioUnitCanonical;\r\n    m_clientFormat.mChannelsPerFrame  = m_ASBD.mChannelsPerFrame;\r\n    m_clientFormat.mBytesPerFrame     = sizeof(AudioUnitSampleType);\r\n    m_clientFormat.mBytesPerPacket    = sizeof(AudioUnitSampleType);\r\n    m_clientFormat.mFramesPerPacket   = 1;\r\n    m_clientFormat.mBitsPerChannel    = 8 * sizeof(AudioUnitSampleType);\r\n    m_clientFormat.mReserved          = 0;\r\n\r\n    // フォーマットの取得\r\n    err = ExtAudioFileSetProperty(m_extAudioID, kExtAudioFileProperty_ClientDataFormat, sizeof(AudioStreamBasicDescription), &m_clientFormat);\r\n    klb_assert(!err, \"could not open SE file.\");\r\n\r\n    // バッファサイズの取得\r\n    size = sizeof(SInt64);\r\n    err = ExtAudioFileGetProperty(m_extAudioID, kExtAudioFileProperty_FileLengthFrames, &size, &m_totalFrames);\r\n    klb_assert(!err, \"could not open SE file.\");\r\n\r\n    // バッファの確保等\r\n    m_playBuffer = new AudioUnitSampleType * [ m_ASBD.mChannelsPerFrame ];\r\n    for(int i = 0; i < m_ASBD.mChannelsPerFrame; i++) {\r\n        m_playBuffer[i] = new AudioUnitSampleType [ m_totalFrames ];\r\n    }\r\n\r\n    AudioBufferList * bufList = (AudioBufferList *)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer) * (m_ASBD.mChannelsPerFrame - 1));\r\n    bufList->mNumberBuffers = m_ASBD.mChannelsPerFrame;\r\n    for(int i = 0; i < m_ASBD.mChannelsPerFrame; i++) {\r\n        bufList->mBuffers[i].mNumberChannels = 1;\r\n        bufList->mBuffers[i].mDataByteSize = sizeof(AudioUnitSampleType) * m_totalFrames;\r\n        bufList->mBuffers[i].mData = m_playBuffer[i];\r\n    }\r\n\r\n    UInt32 readFrameSize = m_totalFrames;\r\n    err = ExtAudioFileRead(m_extAudioID, &readFrameSize, bufList);\r\n    klb_assert(!err, \"could not open SE file.\");\r\n    \r\n    ExtAudioFileDispose(m_extAudioID);\r\n    free(bufList);\r\n    \r\n    /*    \r\n    m_isDone = false;\r\n    AudioComponentDescription cd;\r\n    cd.componentType            = kAudioUnitType_Output;\r\n    cd.componentSubType         = kAudioUnitSubType_RemoteIO;\r\n    cd.componentManufacturer    = kAudioUnitManufacturer_Apple;\r\n    cd.componentFlags           = 0;\r\n    cd.componentFlagsMask       = 0;\r\n    AudioComponent component = AudioComponentFindNext(0, &cd);\r\n    AudioComponentInstanceNew(component, &m_audioUnit);\r\n    AudioUnitInitialize(m_audioUnit);\r\n    \r\n    \r\n    AURenderCallbackStruct callbackStruct;\r\n    callbackStruct.inputProc = CiOSAudio::renderCallback;\r\n    callbackStruct.inputProcRefCon = this;\r\n    \r\n    AudioUnitSetProperty(m_audioUnit,\r\n                         kAudioUnitProperty_SetRenderCallback,\r\n                         kAudioUnitScope_Input,\r\n                         0,\r\n                         &callbackStruct,\r\n                         sizeof(AURenderCallbackStruct));\r\n    \r\n    AudioUnitSetProperty(m_audioUnit,\r\n                         kAudioUnitProperty_StreamFormat,\r\n                         kAudioUnitScope_Input,\r\n                         0,\r\n                         &m_clientFormat,\r\n                         sizeof(AudioStreamBasicDescription));\r\n*/\r\n}\r\n\r\nvoid\r\nCiOSAudio::playSE(s32 _msec, float _tgtVol, float _startVolume)\r\n{\r\n    cleanup();  // 既に再生が終了しているSEセッションを破棄する\r\n    CiOSAudioSession * pSession = new CiOSAudioSession(this);\r\n    if( _msec > 0 && (_tgtVol != _startVolume) ) {\r\n        cAudioFadeParam::SetFadeParam(NULL, pSession, cAudioFadeParam::FADE_TYPE_PLAY, _tgtVol, _msec, _startVolume);\r\n    }\r\n    m_step = STEP_PLAY;\r\n\tm_fadeRatio = _startVolume;\r\n    updateVolume();\r\n    pSession->play();\r\n}\r\n\r\nvoid\r\nCiOSAudio::sendQueue(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)\r\n{\r\n    \r\n    OSStatus err = noErr;\r\n    float master = m_platform->getMasterVolume(false);\r\n    AudioQueueParameterValue vol = (AudioQueueParameterValue)(master * m_volume * m_fadeRatio);\r\n    err = AudioQueueSetParameter(inAQ, kAudioQueueParam_Volume, vol);\r\n\r\n    // NSLog(@\"sendQueue(%d)\", (int)m_startPackNum);\r\n    UInt32 numBytes = 0;\r\n    UInt32 numPackets = m_numPacketPerTime;\r\n    err = AudioFileReadPackets(m_audioID, NO, &numBytes, m_ASPD, m_startPackNum, &numPackets, inBuffer->mAudioData);\r\n    // klb_assert(numBytes > 0, \"no audio data.\");\r\n\r\n    if(numPackets <= 0) {\r\n        // ループ処理\r\n        numBytes = 0;\r\n        numPackets = m_numPacketPerTime;\r\n        m_startPackNum = 0;\r\n\r\n        err = AudioFileReadPackets(m_audioID, NO, &numBytes, m_ASPD, m_startPackNum, &numPackets, inBuffer->mAudioData);\r\n    }\r\n    inBuffer->mAudioDataByteSize = numBytes;\r\n    err = AudioQueueEnqueueBuffer(inAQ, inBuffer, numPackets, m_ASPD);\r\n    // klb_assert(err != noErr, \"error: AudioQueueDataByteSize\");\r\n \r\n    // 現在時刻を算出し、保管しておく。\r\n\r\n    //m_nowPlayTime = (s32)(m_startPackNum * m_ASBD.mFramesPerPacket * (UInt64)1000 / m_ASBD.mSampleRate);\r\n    m_startPackNum += numPackets;\r\n\r\n    /*\r\n    uint64_t tval = mach_absolute_time();\r\n    mach_timebase_info_data_t base;\r\n    mach_timebase_info(&base);\r\n    \r\n    m_tval = (s64)((tval * base.numer) / base.denom);\r\n    m_last_delta = 0;\r\n     */\r\n}\r\n\r\n\r\nvoid\r\nCiOSAudio::queueCallback(void * inUserData, \r\n                         AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)\r\n{\r\n    CiOSAudio * pAudio = (CiOSAudio *)inUserData;\r\n    pAudio->sendQueue(inAQ, inBuffer);\r\n}\r\n\r\n\r\n// 個々の発音セッションクラス\r\nCiOSAudioSession::CiOSAudioSession(CiOSAudio * audio)\r\n: m_audio(audio)\r\n, m_prev(0)\r\n, m_next(0)\r\n, m_isPause(false)\r\n{\r\n    // 自身を指定されたデータの親クラスに登録する\r\n    m_prev = m_audio->m_end;\r\n    if(m_prev) {\r\n        m_prev->m_next = this;\r\n    } else {\r\n        m_audio->m_begin = this;\r\n    }\r\n    m_audio->m_end = this;\r\n\r\n    init();\r\n}\r\n\r\nCiOSAudioSession::~CiOSAudioSession()\r\n{\r\n    m_isDone = true;\r\n    m_isPlaying = false;\r\n    cAudioFadeParam::Remove(this);\r\n    AudioOutputUnitStop(m_audioUnit);\r\n    AudioUnitUninitialize(m_audioUnit);\r\n    AudioComponentInstanceDispose(m_audioUnit);\r\n    \r\n    // 自身を親から削除する\r\n    if(m_prev) {\r\n        m_prev->m_next = m_next;\r\n    } else {\r\n        m_audio->m_begin = m_next;\r\n    }\r\n    if(m_next) {\r\n        m_next->m_prev = m_prev;\r\n    } else {\r\n        m_audio->m_end = m_prev;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::init()\r\n{\r\n    m_currentFrame = 0;\r\n    m_isDone = false;\r\n    m_isPlaying = false;\r\n    m_isPause = false;\r\n    \r\n    m_volume = m_audio->m_volume;\r\n    m_panL = m_audio->m_panL;\r\n    m_panR = m_audio->m_panR;\r\n    \r\n    m_fadeRatio = 1.0f;\r\n\r\n    AudioComponentDescription cd;\r\n    cd.componentType            = kAudioUnitType_Output;\r\n    cd.componentSubType         = kAudioUnitSubType_RemoteIO;\r\n    cd.componentManufacturer    = kAudioUnitManufacturer_Apple;\r\n    cd.componentFlags           = 0;\r\n    cd.componentFlagsMask       = 0;\r\n    AudioComponent component = AudioComponentFindNext(0, &cd);\r\n    AudioComponentInstanceNew(component, &m_audioUnit);\r\n    AudioUnitInitialize(m_audioUnit);\r\n    \r\n    \r\n    AURenderCallbackStruct callbackStruct;\r\n    callbackStruct.inputProc = CiOSAudioSession::renderCallback;\r\n    callbackStruct.inputProcRefCon = this;\r\n    \r\n    AudioUnitSetProperty(m_audioUnit,\r\n                         kAudioUnitProperty_SetRenderCallback,\r\n                         kAudioUnitScope_Input,\r\n                         0,\r\n                         &callbackStruct,\r\n                         sizeof(AURenderCallbackStruct));\r\n    \r\n    AudioUnitSetProperty(m_audioUnit,\r\n                         kAudioUnitProperty_StreamFormat,\r\n                         kAudioUnitScope_Input,\r\n                         0,\r\n                         &m_audio->m_clientFormat,\r\n                         sizeof(AudioStreamBasicDescription));\r\n    \r\n    AudioOutputUnitStart(m_audioUnit);\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::play()\r\n{\r\n    m_isDone = false;\r\n    m_currentFrame = 0;\r\n    m_isPlaying = true;\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::stop()\r\n{\r\n    //AudioOutputUnitStop(m_audioUnit);\r\n    m_isDone = true;\r\n    m_isPlaying = false;\r\n    cAudioFadeParam::Remove(this);\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::pause()\r\n{\r\n    //m_isDone = true;\r\n    m_isPause = true;\r\n    cAudioFadeParam::Remove(this);\r\n    //m_isPlaying = false;\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::resume()\r\n{\r\n    //m_isPlaying = true;\r\n    m_isPause = false;\r\n}\r\n\r\ns64\r\nCiOSAudioSession::tell()\r\n{\r\n    s64 ret = 0;\r\n    \r\n    if( m_currentFrame != 0 ) {\r\n        ret = (m_currentFrame * 1000) / m_audio->m_clientFormat.mSampleRate;\r\n    }\r\n    return ret;\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::checkSessionStoped()\r\n{\r\n    if( m_audio ) {\r\n        m_audio->checkSessionStoped();\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSAudioSession::setFadeRatio(float _fadeRatio)\r\n{\r\n    m_fadeRatio = _fadeRatio;\r\n}\r\n\r\nOSStatus\r\nCiOSAudioSession::callbackSE(AudioUnitRenderActionFlags * ioActionFlags,\r\n                      const AudioTimeStamp * inTimeStamp,\r\n                      UInt32 inBusNumber,\r\n                      UInt32 inNumberFrames,\r\n                      AudioBufferList * ioData)\r\n{\r\n    int indexR = (m_audio->m_ASBD.mChannelsPerFrame == 2) ? 1 : 0;\r\n    AudioUnitSampleType * outL = (AudioUnitSampleType *)ioData->mBuffers[0].mData;\r\n    AudioUnitSampleType * outR = (AudioUnitSampleType *)ioData->mBuffers[indexR].mData;\r\n    \r\n    // ポーズ中or末尾まで再生終了してる時はバッファに0を書き込み\r\n    if( m_isDone || m_isPause )\r\n    {\r\n        for(int i = 0; i < inNumberFrames; i++) {\r\n            *outL++ = *outR++ = 0;\r\n        }\r\n        return noErr;\r\n    }\r\n    // 左右の音量にかける係数を求める。\r\n    // 設定されているボリュームと、パン位置によって決まる。\r\n    // 使われるボリューム/パンの値は、セッションの再生開始時の値であり、その後変更されても影響を受けない。\r\n    float master = m_audio->m_platform->getMasterVolume(true);    // マスターボリュームを取得\r\n    float nL = master * m_volume * m_panL * m_fadeRatio;\r\n    float nR = master * m_volume * m_panR * m_fadeRatio;\r\n    \r\n    // 丸め\r\n    if( nL > 1.0f ) {\r\n        nL = 1.0f;\r\n    }\r\n    if( nR > 1.0f ) {\r\n        nR = 1.0f;\r\n    }\r\n    \r\n    UInt32 left = (m_isDone) ? 0 : (m_audio->m_totalFrames - m_currentFrame);\r\n    UInt32 fnum = (left > inNumberFrames) ? inNumberFrames : left;\r\n    UInt32 right = inNumberFrames - fnum;\r\n    \r\n    for(int i = 0; i < fnum; i++) {\r\n        *outL++ = nL * m_audio->m_playBuffer[0][m_currentFrame];\r\n        *outR++ = nR * m_audio->m_playBuffer[indexR][m_currentFrame++];\r\n    }\r\n    for(int i = 0; i < right; i++) {\r\n        *outL++ = *outR++ = 0;\r\n    }\r\n    if( m_currentFrame == m_audio->m_totalFrames ||\r\n        tell() >= m_audio->m_soundAnalysisData.m_totalTime )\r\n    {\r\n        m_isDone = true;\r\n        m_isPlaying = false;\r\n        cAudioFadeParam::Remove(this);\r\n        checkSessionStoped();\r\n    }\r\n    return noErr;\r\n}\r\n\r\n\r\nOSStatus\r\nCiOSAudioSession::renderCallback(void * inRefCon,\r\n                                   AudioUnitRenderActionFlags * ioActionFlags,\r\n                                   const AudioTimeStamp * inTimeStamp,\r\n                                   UInt32 inBusNumber,\r\n                                   UInt32 inNumberFrames,\r\n                                   AudioBufferList * ioData)\r\n{\r\n    CiOSAudioSession * audio = (CiOSAudioSession *)inRefCon;\r\n    return audio->callbackSE(ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSAudioManager.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSAudioManager.cpp\r\n//\r\n//\r\n\r\n#include \"CiOSAudioManager.h\"\r\n\r\n// #define DEBUG_AUDIO\r\n\r\n// インスタンス\r\nCiOSAudioManager CiOSAudioManager::m_instance;\r\n\r\n// 割り込み処理関数\r\nstatic void AudioInterruptionCallBack( void* _userData, UInt32 _state )\r\n{\r\n    if( _userData == NULL ) return;\r\n    CiOSAudioManager* pSndMng = (CiOSAudioManager*)_userData;\r\n    // IPlatformRequest *pform = CiOSPlatform::getInstance();\r\n    \r\n    // 割り込み開始\r\n    if( _state == kAudioSessionBeginInterruption )\r\n    {\r\n\t\t#ifdef DEBUG_AUDIO\r\n        if( pform ) pform->logging(\"[AudioManager] begin interruption!\");\r\n\t\t#endif\r\n        pSndMng->AudioBeginInterruption();\r\n    }\r\n    \r\n    // 割り込み終了\r\n    if( _state == kAudioSessionEndInterruption )\r\n    {\r\n\t\t#ifdef DEBUG_AUDIO\r\n        if( pform ) pform->logging(\"[AudioManager] end interruption!\");\r\n\t\t#endif\r\n        pSndMng->AudioEndInterruption();\r\n    }\r\n}\r\n\r\n/*!\r\n @brief  コンストラクタ\r\n */\r\nCiOSAudioManager::CiOSAudioManager()\r\n: m_masterVol_se(1.0f)\r\n, m_masterVol_bgm(1.0f)\r\n, m_multiProcessType(IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT)\r\n, m_bSEOff(false)\r\n, m_bBGMOff(false)\r\n, m_bPauseOnInterruption(true)\r\n{\r\n}\r\n\r\n/*!\r\n @brief  デストラクタ\r\n */\r\nCiOSAudioManager::~CiOSAudioManager()\r\n{\r\n}\r\n\r\n/*!\r\n @brief  初期化処理\r\n @param[in]  void\r\n @return     bool    true:正常, false:異常\r\n */\r\nbool CiOSAudioManager::Initialize( void )\r\n{\r\n    // AudioSessionの初期化\r\n    AudioSessionInit();\r\n    \r\n    // フェード管理機構の初期化\r\n    cAudioFadeParam::AudioFadeParamInit();\r\n    \r\n    // IOバッファサイズの設定\r\n    Float64 sampleRate;\r\n    UInt32 size = sizeof(sampleRate);\r\n    OSStatus err;\r\n    err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate, &size, &sampleRate);\r\n    klb_assert(!err, \"can not get Hardware SampleRate.\");\r\n    \r\n    Float32 duration = (Float32)IOS_HARDWARE_IO_BUFFER_SIZE / sampleRate; // iOSシステムデフォルトは(1024/sampleRate)\r\n    err = AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, sizeof(duration), &duration);\r\n    klb_assert(!err, \"can not set Hardware SampleRate.\");\r\n    \r\n    m_bInit = true;\r\n    return true;\r\n}\r\n\r\n/*!\r\n @brief  初期化処理\r\n @param[in]  void\r\n @return     bool    true:正常, false:異常\r\n */\r\nbool CiOSAudioManager::Termination( void )\r\n{\r\n    // フェード管理機構の終了処理\r\n    cAudioFadeParam::AudioFadeParamExit();\r\n    \r\n    return true;\r\n}\r\n\r\n/*!\r\n @brief  サウンドハンドル作成\r\n @param[in]  const char* _url    サウンドファイルパス\r\n @return     void*               サウンドハンドル\r\n */\r\nvoid* CiOSAudioManager::CreateAudioHandle( const char* _url, CiOSPlatform* _platform )\r\n{\r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        // 使用中の物はスキップ\r\n        if( m_audio[i].isActive() ) {\r\n            continue;\r\n        }\r\n        \r\n        bool bRes = m_audio[i].openAudio( _url, _platform );\r\n        return (bRes) ? ((void*)&m_audio[i]) : NULL;\r\n    }\r\n    // 空のスロットが見つからなかった\r\n    return NULL;\r\n}\r\n\r\n/*!\r\n @brief  AudioSessionの初期化\r\n @param[in]  void\r\n @return     bool    true:正常, false:異常\r\n */\r\nbool CiOSAudioManager::AudioSessionInit( void )\r\n{\r\n    OSStatus err = errSecSuccess;\r\n    err = AudioSessionInitialize( NULL, NULL, AudioInterruptionCallBack, this );\r\n    if( err != kAudioSessionNoError ) {\r\n        //return false;\r\n    }\r\n \r\n    // AudioSessionSetProprety\r\n    AudioSessionPropertySetting();\r\n    \r\n    AudioSessionSetActive( true );\r\n    \r\n    return true;\r\n}\r\n\r\n//! AudioSessionプロパティの設定\r\nbool CiOSAudioManager::AudioSessionPropertySetting( void )\r\n{\r\n    // サウンドとミュージックの並行処理の設定\r\n    UInt32 category = kAudioSessionCategory_AmbientSound;\r\n    // IPlatformRequest *pform = CiOSPlatform::getInstance();\r\n    switch( m_multiProcessType )\r\n    {\r\n        case IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:\r\n            category = kAudioSessionCategory_SoloAmbientSound;\r\n\t\t\t#ifdef DEBUG_AUDIO\r\n\t\t\tif( pform ) pform->logging(\"[AudioManager] multi process:music_cut\");\r\n\t\t\t#endif\r\n            break;\r\n        case IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:\r\n            category = kAudioSessionCategory_AmbientSound;\r\n\t\t\t#ifdef DEBUG_AUDIO\r\n            if( pform ) pform->logging(\"[AudioManager] multi process:sound_cut\");\r\n\t\t\t#endif\r\n            break;\r\n        case IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT:\r\n            category = kAudioSessionCategory_AmbientSound;\r\n\t\t\t#ifdef DEBUG_AUDIO\r\n            if( pform ) pform->logging(\"[AudioManager] multi process:sound_bgm_cut\");\r\n\t\t\t#endif\r\n            break;\r\n    }\r\n    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), &category);\r\n\r\n    // マスターボリュームON/OFF設定\r\n    chackAudioMasterVolume();\r\n    \r\n    AudioSessionSetActive( true );\r\n    \r\n    return true;\r\n}\r\n\r\n/*!\r\n @brief  割り込み開始処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::AudioBeginInterruption( void )\r\n{\r\n    /*\r\n    // ポーズ処理をエンジン側で制御しないのでリターン\r\n    if( getPauseOnInterruption() == false ) return;\r\n\r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() &&\r\n           (m_audio[i].getState() == IClientRequest::E_SOUND_STATE_PLAY) &&\r\n           (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_NONE) )\r\n        {\r\n            // サウンドを停止し割り込みフラグをたてる\r\n            m_audio[i].pause();\r\n            m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_CALLING);\r\n        }\r\n    }\r\n     */\r\n}\r\n\r\n/*!\r\n @brief  割り込み終了処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::AudioEndInterruption( void )\r\n{\r\n    /*\r\n    AudioSessionSetActive( true );\r\n    \r\n    // 電話などの割り込み復帰後にSessionが無効化されるのでSessionを再設定\r\n    AudioSessionInit();\r\n    \r\n    // マスターボリュームON/OFF設定\r\n    chackAudioMasterVolume();\r\n    \r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() && (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_CALLING) )\r\n        {\r\n            // 割り込みフラグがたっている物に限り再生を再開\r\n            if( !m_audio[i].getLuaPause() ) {\r\n                m_audio[i].resume();\r\n            }\r\n            m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_NONE);\r\n        }\r\n    }\r\n     */\r\n}\r\n\r\n/*!\r\n @brief  非アクティブになる瞬間の処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::AudioDidResignActive( void )\r\n{\r\n    // ポーズ処理をエンジン側で制御しないのでリターン\r\n    if( getPauseOnInterruption() == false ) return;\r\n\r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() &&\r\n           (m_audio[i].getState() == IClientRequest::E_SOUND_STATE_PLAY) &&\r\n           (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_NONE) )\r\n        {\r\n            // サウンドを停止し割り込みフラグをたてる\r\n            m_audio[i].pause();\r\n            m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_RESIGN_ACTIVE);\r\n        }\r\n    }\r\n}\r\n\r\n/*!\r\n @brief  アクティブに戻る瞬間の処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::AudioDidBecomeActive( void )\r\n{\r\n    AudioSessionSetActive( true );\r\n    \r\n    // マスターボリュームON/OFF設定\r\n    chackAudioMasterVolume();\r\n    \r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() && (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_RESIGN_ACTIVE) )\r\n        {\r\n            // 割り込みフラグがたっている物に限り再生を再開\r\n            if( !m_audio[i].getLuaPause() ) {\r\n                m_audio[i].resume();\r\n            }\r\n            m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_NONE);\r\n        }\r\n    }\r\n}\r\n\r\n/*!\r\n @brief  バックグラウンドに行く瞬間の処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::AudioDidEnterBackground( void )\r\n{\r\n    /*\r\n    // ポーズ処理をエンジン側で制御しないのでリターン\r\n    if( getPauseOnInterruption() == false ) return;\r\n\r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() &&\r\n           (m_audio[i].getState() == IClientRequest::E_SOUND_STATE_PLAY) &&\r\n           (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_NONE) )\r\n        {\r\n            // サウンドを停止し割り込みフラグをたてる\r\n            m_audio[i].pause();\r\n            m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_ENTER_BACKGROUND);\r\n        }\r\n    }\r\n     */\r\n}\r\n\r\n/*!\r\n @brief  バックグラウンドから戻る際の処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::AudioDidEnterForeground( void )\r\n{\r\n    /*\r\n    AudioSessionSetActive( true );\r\n    \r\n    // マスターボリュームON/OFF設定\r\n    chackAudioMasterVolume();\r\n    \r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() && (m_audio[i].getInterruptionType() == eINTERRUPTION_TYPE_ENTER_BACKGROUND) )\r\n        {\r\n            // 割り込みフラグがたっている物に限り再生を再開\r\n            if( !m_audio[i].getLuaPause() ) {\r\n                m_audio[i].resume();\r\n            }\r\n            m_audio[i].setInterruptionType(eINTERRUPTION_TYPE_NONE);\r\n        }\r\n    }\r\n     */\r\n}\r\n\r\n/*!\r\n @brief  サウンドとミュージックの並行処理タイプ\r\n @param[in]  s32\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::SetAudioMultiProcessType( s32 _type )\r\n{\r\n    m_multiProcessType = _type;\r\n    \r\n    // AudioSession再設定\r\n    AudioSessionInit();\r\n\r\n    // ボリュームの再設定\r\n    for( int i=0; i<SND_SLOT; ++i )\r\n    {\r\n        if( m_audio[i].isActive() ) {\r\n            m_audio[i].updateVolume();\r\n        }\r\n    }\r\n}\r\n\r\n/*!\r\n @brief  SEのマスターボリューム設定\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::SetSEMasterVolume( float _vol )\r\n{\r\n    if( _vol < 0.0f ) {\r\n        _vol = 0.0f;\r\n    } else if( _vol > 1.0f ) {\r\n        _vol = 1.0f;\r\n    }\r\n    m_masterVol_se = _vol;\r\n}\r\n\r\n//! iPodミュージックプレーヤーの再生状態取得\r\n/*!\r\n @brief  iPodミュージックの再生状態の取得\r\n @param[in]  void\r\n @return     bool   true:再生中, false:未再生\r\n */\r\nbool CiOSAudioManager::isMusicPlayerPlaying( void )\r\n{\r\n    // IPlatformRequest *pform = CiOSPlatform::getInstance();\r\n    MPMusicPlaybackState ipodState = [[MPMusicPlayerController iPodMusicPlayer] playbackState];\r\n    // MPMusicPlaybackState appliState = [[MPMusicPlayerController applicationMusicPlayer] playbackState];\r\n    \r\n    //MPMediaItem *ipodMusicItem = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];\r\n    //MPMediaItem *appliMusicItem = [[MPMusicPlayerController applicationMusicPlayer] nowPlayingItem];\r\n    //if( pform ) pform->logging(\"[AudioManager] musioc ipod:%p\", ipodMusicItem);\r\n    //if( pform ) pform->logging(\"[AudioManager] musioc appli:%p\", appliMusicItem);\r\n\t#ifdef DEBUG_AUDIO\r\n    if( pform ) pform->logging(\"[AudioManager] musioc state:%d\", ipodState);\r\n    if( pform ) pform->logging(\"[AudioManager] appli state:%d\", appliState);\r\n\t#endif\r\n    if( ipodState != MPMusicPlaybackStatePlaying )\r\n    //if( ipodState == MPMusicPlaybackStateStopped || ipodState == MPMusicPlaybackStatePaused )\r\n    //if( appliState == MPMusicPlaybackStateStopped || appliState == MPMusicPlaybackStatePaused )\r\n    {\r\n        // 停止中・一時停止中\r\n\t\t#ifdef DEBUG_AUDIO\r\n        if( pform ) pform->logging(\"[AudioManager] musioc play:false\");\r\n\t\t#endif\r\n        return false;\r\n    }\r\n\t#ifdef DEBUG_AUDIO\r\n    if( pform ) pform->logging(\"[AudioManager] musioc play:true\");\r\n\t#endif\r\n    return true;\r\n    \r\n    /*\r\n    UInt32 playing;\r\n    UInt32 propertySize = sizeof(playing);\r\n    \r\n    AudioSessionGetProperty( kAudioSessionProperty_OtherAudioIsPlaying, &propertySize, &playing );\r\n    \r\n    if( playing != 0 ) {\r\n        if( pform ) pform->logging(\"[AudioManager] musioc play:true\");\r\n        return true;\r\n    }\r\n    if( pform ) pform->logging(\"[AudioManager] musioc play:false\");\r\n    return false;\r\n     */\r\n}\r\n\r\n/*!\r\n @brief  BGMのマスターボリューム設定\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::SetBGMMasterVolume( float _vol )\r\n{\r\n    if( _vol < 0.0f ) {\r\n        _vol = 0.0f;\r\n    } else if( _vol > 1.0f ) {\r\n        _vol = 1.0f;\r\n    }\r\n    m_masterVol_bgm = _vol;\r\n}\r\n\r\n/*!\r\n @brief  SEのマスターボリューム取得\r\n @param[in]  void\r\n @return     float  SEマスターボリューム(0.0f〜1.0f)\r\n */\r\nfloat CiOSAudioManager::GetSEMasterVolume( void )\r\n{\r\n    // SEオフの状態なのでマスターを常に０でリターン\r\n    if( m_bSEOff ) {\r\n        return 0.0f;\r\n    }\r\n    return m_masterVol_se;\r\n}\r\n\r\n/*!\r\n @brief  BGMのマスターボリューム取得\r\n @param[in]  void\r\n @return     float  BGMマスターボリューム(0.0f〜1.0f)\r\n */\r\nfloat CiOSAudioManager::GetBGMMasterVolume( void )\r\n{\r\n    // BGMオフの状態なのでマスターを常に０でリターン\r\n    if( m_bBGMOff ) {\r\n        return 0.0f;\r\n    }\r\n    return m_masterVol_bgm;\r\n}\r\n\r\n/*!\r\n @brief  サウンドの音量更新\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::UpdateVolume( void )\r\n{\r\n    for( int i=0; i<SND_SLOT; ++i ) {\r\n        if( m_audio[i].isActive() ) m_audio[i].updateVolume();\r\n    }\r\n}\r\n\r\n/*!\r\n @brief 現在の設定によりマスターボリュームのON/OFF\r\n @param[in] void\r\n @return    void\r\n */\r\nvoid CiOSAudioManager::chackAudioMasterVolume( void )\r\n{\r\n    switch( m_multiProcessType )\r\n    {\r\n        case IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:    // iPodミュージックを無効\r\n            m_bSEOff = false;\r\n            m_bBGMOff = false;\r\n            break;\r\n        case IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:    // ゲームサウンドを無効\r\n            m_bSEOff = true;\r\n            m_bBGMOff = true;\r\n            if( isMusicPlayerPlaying() == false )\r\n            {\r\n                m_bSEOff = false;\r\n                m_bBGMOff = false;\r\n            }\r\n            break;\r\n        case IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT: // ゲームのBGMサウンドのみ無効\r\n            m_bSEOff = false;\r\n            m_bBGMOff = true;\r\n            if( isMusicPlayerPlaying() == false ) {\r\n                m_bBGMOff = false;\r\n            }\r\n            break;\r\n    }\r\n    UpdateVolume();\r\n}\r\n\r\n/*!\r\n @brief  毎フレーム行う処理\r\n @param[in]  void\r\n @return     void\r\n */\r\nvoid CiOSAudioManager::Exec( void )\r\n{\r\n    for( int i=0; i<SND_SLOT; ++i ) {\r\n        if( m_audio[i].isActive() ) m_audio[i].audioSessionCleanup();\r\n    }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSHttpStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSHttpStream.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CiOSHttpStream_h\r\n#define CiOSHttpStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CiOSHttpStream : public IReadStream\r\n{\r\nprivate:\r\n    CiOSHttpStream();\r\npublic:\r\n    virtual ~CiOSHttpStream();\r\n\r\n    static CiOSHttpStream * openStream(const char * path, const char * home);\r\n    static CiOSHttpStream * openAssets(const char * path, const char * home);\r\n\r\n    s32 getSize();\r\n    s32 getPosition();\r\n    u8  readU8();\r\n    u16 readU16();\r\n    u32 readU32();\r\n    float readFloat();\r\n    bool readBlock(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus();\r\n    \r\n    int readU16Arr(u16 * pBufferU16, int items);\r\n    int readU32Arr(u32 * pBufferU32, int items);\r\n\r\n    IWriteStream * getWriteStream();\r\nprivate:\r\n    const char  *   m_fullpath;\r\n    ESTATUS         m_eStat;\r\n\r\n    const u8    *   m_bufHTTP;\r\n    u32             m_bufLen;\r\n    u32             m_pos;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSHttpStream.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSHttpStream.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#include \"CiOSHttpStream.h\"\r\n\r\nCiOSHttpStream::CiOSHttpStream() : m_fullpath(0), m_bufHTTP(0) {}\r\nCiOSHttpStream::~CiOSHttpStream()\r\n{\r\n    delete [] m_bufHTTP;\r\n    delete [] m_fullpath;\r\n}\r\n\r\nCiOSHttpStream *\r\nCiOSHttpStream::openStream(const char *path, const char *home)\r\n{\r\n    CiOSHttpStream * pStream = 0;\r\n    pStream = new CiOSHttpStream();\r\n    \r\n    if(!pStream) {\r\n        return 0;\r\n    }\r\n    pStream->m_fullpath = 0;\r\n    char * buf = new char [ strlen(path) + 1 ];\r\n    if(!buf) {\r\n        pStream->m_eStat = NOT_FOUND;\r\n        return pStream;\r\n    }\r\n    strcpy(buf, path);\r\n    pStream->m_fullpath = (const char *)buf;\r\n    // HTTP/HTTPSアクセスでリソースを取得する\r\n    \r\n        \r\n}"
  },
  {
    "path": "Engine/porting/iOS/CiOSMovieView.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSMovieView.mm\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#import \"CiOSMovieView.h\"\r\n#include \"CiOSWidget.h\"\r\n@implementation CiOSMovieView\r\n\r\n+ (Class)layerClass\r\n{\r\n    return [AVPlayerLayer class];\r\n}\r\n\r\n- (void)playerItemDidReachEnd:(NSNotification *)notification\r\n{\r\n    AVPlayerItem * p = [notification object];\r\n    CiOSMovieWidget * pWidget = CiOSMovieWidget::getWidget(p);\r\n    \r\n    if(!pWidget) return;\r\n    pWidget->setStatus(1);  // 終了ステータスを書き込む\r\n    // movie play end\r\n}\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSPathConv.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  iOSPathConv.cpp\r\n//\r\n//\r\n#include <sys/stat.h>\r\n#include <errno.h>\r\n#include \"CiOSPathConv.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n\r\nCiOSPathConv::CiOSPathConv() : m_build(false), m_external(0), m_install(0) {}\r\nCiOSPathConv::~CiOSPathConv() {\r\n    delete [] m_external;\r\n    delete [] m_install;\r\n}\r\n\r\nCiOSPathConv&\r\nCiOSPathConv::getInstance()\r\n{\r\n    static CiOSPathConv instance;\r\n    return instance;\r\n}\r\n\r\nconst char *\r\nCiOSPathConv::makePath(const char * path, const char * suffix, const char * base)\r\n{\r\n    int extlen = (suffix) ? strlen(suffix) : 0;\r\n    int len = strlen(path) + strlen(base) + extlen + 2;\r\n    char * buf = new char [ len ];\r\n    strcpy(buf, base);\r\n    //strcat(buf, \"/\");\r\n    strcat(buf, path);\r\n    if(suffix) strcat(buf, suffix);\r\n    //CPFInterface::getInstance().platform().logging(\"fullpath: %s\", buf);\r\n    return (const char *)buf;\r\n}\r\n\r\nbool\r\nCiOSPathConv::checkExists(const char * path)\r\n{\r\n    bool bResult = true;\r\n    struct stat st;\r\n    int iRes = stat(path, &st);\r\n    if((iRes != 0) && (errno == ENOENT)) bResult = false;\r\n    return bResult;\r\n}\r\n\r\nconst char *\r\nCiOSPathConv::fullpath(const char * url, const char * suffix, bool * isReadOnly)\r\n{\r\n    build();\r\n    if (isReadOnly) { *isReadOnly = true; }\r\n\r\n    // assets が指定されている場合、まずは external から探し、\r\n    // 見つからなければ install から探す。どちらもなければ 0 を返す。\r\n    if (!strncmp(url, \"asset://\", 8)) {\r\n        const char * path;\r\n        path = makePath(url + 8, suffix, m_external);\r\n        if(checkExists(path)) {\r\n            if (isReadOnly) { *isReadOnly = false; }\r\n            return path;\r\n        }\r\n        delete [] path;\r\n        \r\n        path = makePath(url + 8, suffix, m_install);\r\n        if(checkExists(path)) return path;\r\n        delete [] path;\r\n        \r\n        // ファイルが見つからなかったのでログを出しとく\r\n        CPFInterface::getInstance().platform().logging(\"[file]: not found '%s%s'\", url, suffix);\r\n        \r\n        return 0;\r\n    }\r\n\r\n    if (!strncmp(url, \"external/\", 9)) {\r\n        if (isReadOnly) { *isReadOnly = false; }\r\n        return makePath(url + 9, suffix, m_external);\r\n    }\r\n    if (!strncmp(url, \"install/\", 8)) return makePath(url + 8, suffix, m_install);\r\n    return 0;\r\n}\r\n\r\nvoid\r\nCiOSPathConv::create_external()\r\n{\r\n    // file://external を作る\r\n    NSString * nshome = NSHomeDirectory();\r\n    const char * home = [nshome UTF8String];\r\n    int length = strlen(home) + strlen(PATH_EXTERN);\r\n    char * buf = new char [length + 1];\r\n    strcpy(buf, home);\r\n    strcat(buf, PATH_EXTERN);\r\n    m_external = (const char *)buf;\r\n\tif (mkdir(m_external, 0755) == 0)\r\n    {\r\n        CPFInterface::getInstance().platform().excludePathFromBackup(m_external);\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSPathConv::create_install()\r\n{\r\n    // file://install を作る\r\n    NSString * nshome = [[NSBundle mainBundle] bundlePath] ;\r\n    const char * home = [nshome UTF8String];\r\n    int length = strlen(home) + strlen(PATH_INSTALL);\r\n    char * buf = new char [length + 1];\r\n    strcpy(buf, home);\r\n    strcat(buf, PATH_INSTALL);\r\n    m_install = (const char *)buf;\r\n}\r\n\r\nvoid\r\nCiOSPathConv::build()\r\n{\r\n    if(m_build) return;\r\n    create_install();\r\n    create_external();\r\n    m_build = true;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSPlatform.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSPlatform.cpp\r\n//\r\n//\r\n#include <iostream>\r\n#include <pthread.h>\r\n#include <time.h>\r\n#include <sys/param.h>\r\n#include <sys/mount.h>\r\n#import <mach/mach_time.h>\r\n#import <CommonCrypto/CommonDigest.h>\r\n#import <Security/Security.h>\r\n#import <StoreKit/StoreKit.h>\r\n#import <sys/xattr.h>\r\n#import <sys/types.h>\r\n#import <sys/sysctl.h>\r\n\r\n#include \"RenderingFramework.h\"\r\n#include \"CiOSPlatform.h\"\r\n#include \"CiOSReadFileStream.h\"\r\n#include \"CSockReadStream.h\"\r\n#include \"CiOSAudio.h\"\r\n#include \"CiOSPathConv.h\"\r\n#include \"CiOSWidget.h\"\r\n#include \"CiOSSysResource.h\"\r\n#include \"CiOSTmpFile.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBJsonItem.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CiOSAudioManager.h\"\r\n#include \"FontRendering.h\"\r\n\r\n#define IDENTIFIER \r\n\r\nCiOSPlatform * CiOSPlatform::m_instance = 0;\r\n\r\n\r\n// フォント対応表。抽象化されたaliasと、実際iOSに渡すフォント名の対応をとる。\r\nCiOSFont::FONTLIST CiOSFont::ms_fontlist[] = {\r\n\t// alias        iOS-name\r\n\t{ \"Georgia\",    \"Georgia\" },\r\n\t{ 0, 0 }\r\n};\r\n\r\nCiOSFont::CiOSFont(int size, const char * fontName)\r\n{\r\n\tfloat truesize = size * 5.0f / 6.0f;\r\n\tfloat scale = CiOSPlatform::getInstance()->m_scale;\r\n\r\n\tfor(int i = 0; fontName && ms_fontlist[i].alias; i++) {\r\n\t\tif(!strcmp(ms_fontlist[i].alias, fontName)) {\r\n\t\t\tm_fontname = ms_fontlist[i].fontname;\r\n\t\t\tNSString * ns_fontname = [NSString stringWithUTF8String:m_fontname];\r\n\t\t\tm_tFont = [UIFont fontWithName:ns_fontname size:truesize];\r\n\t\t\tm_tFontScaled = [UIFont fontWithName:ns_fontname size:(truesize / scale)];\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\t// 該当するものがなければシステムフォント\r\n\tm_fontname = 0;\r\n\tm_tFont = [UIFont systemFontOfSize:truesize];\r\n\tm_tFontScaled = [UIFont systemFontOfSize:(truesize / scale)];\r\n}\r\nCiOSFont::~CiOSFont() {}\r\n\r\n\r\n\r\nCiOSPlatform::CiOSPlatform(UIViewController<UIAlertViewDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver> * pViewController, EAGLView * pView, float scale)\r\n: m_pViewController(pViewController), m_pView(pView), m_scale(scale)\r\n{\r\n    //-----機種取得\r\n    size_t size;\r\n    sysctlbyname(\"hw.machine\", NULL, &size, NULL, 0);\r\n    char* machine = static_cast<char*>(malloc(size));\r\n    sysctlbyname(\"hw.machine\", machine, &size, NULL, 0);\r\n    /*\r\n     Possible values:\r\n     \"i386\" = iPhone Simulator\r\n     \"iPhone1,1\" = iPhone 1G\r\n     \"iPhone1,2\" = iPhone 3G\r\n     \"iPhone2,1\" = iPhone 3GS\r\n     \"iPhone3,1\" = iPhone 4\r\n     \"iPod1,1\" = iPod touch 1G\r\n     \"iPod2,1\" = iPod touch 2G\r\n     \"iPod3,1\" = iPod touch 3G\r\n     \"iPod4,1\" = iPod touch 4G\r\n     */\r\n    //NSString *platform = [NSString stringWithCString: machine ];\r\n    // ,->_ に整形\r\n    NSString *tmpPlatform = [NSString stringWithCString: machine encoding:NSUTF8StringEncoding];\r\n    NSString *platform = [tmpPlatform stringByReplacingOccurrencesOfString:@\",\" withString:@\"_\"];\r\n    free(machine);\r\n    //-----\r\n    \r\n\tNSString * modelname = [[UIDevice currentDevice] model];\r\n\tNSArray * aOsVersions = [[[UIDevice currentDevice]systemVersion] componentsSeparatedByString:@\".\"];\r\n\tNSInteger iOsVersionMajor = [[aOsVersions objectAtIndex:0] intValue];\r\n\tNSInteger iOsVersionMinor = [[aOsVersions objectAtIndex:1] intValue];\r\n\tNSString * tzname = [[NSTimeZone systemTimeZone] abbreviation];\r\n\tsprintf(m_platform, \"iOS;%s %s %d.%d;%s\",\r\n            [platform UTF8String],\r\n\t\t\t[modelname UTF8String],\r\n\t\t\t(int)iOsVersionMajor,\r\n\t\t\t(int)iOsVersionMinor,\r\n\t\t\t[tzname UTF8String]);\r\n\tm_instance = this;\r\n}\r\nCiOSPlatform::~CiOSPlatform() {\r\n\tm_instance = 0;\r\n}\r\n\r\n\r\n\tCiOSPlatform *\r\nCiOSPlatform::getInstance()\r\n{\r\n\treturn m_instance;\r\n}\r\n\r\nbool CiOSPlatform::useEncryption() {\r\n\treturn true;\r\n}\r\n\r\ns64\r\nCiOSPlatform::nanotime()\r\n{\r\n\tuint64_t tval = mach_absolute_time();\r\n\tmach_timebase_info_data_t base;\r\n\tmach_timebase_info(&base);\r\n\r\n\treturn (s64)((tval * base.numer) / base.denom);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...)\r\n{\r\n#ifdef DEBUG\r\n#ifndef DEBUG_PRINT_OFF\r\n\tNSString * nsformat = [NSString stringWithUTF8String:format];\r\n\r\n\t// format済み文字列を生成\r\n\tva_list ap;\r\n\tva_start(ap, format);\r\n\tif (![nsformat hasSuffix: @\"\\n\"]) {\r\n\t\tnsformat = [nsformat stringByAppendingString: @\"\\n\"];\r\n\t}\r\n\tNSString *body = [[NSString alloc] initWithFormat:nsformat arguments:ap];\r\n\tNSLog(@\"%s\",[body UTF8String]);\r\n\t[body release];\r\n\tva_end(ap);\r\n\r\n#endif // #ifndef DEBUG_PRINT_ON\r\n#endif // #ifdef DEBUG\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::logging(const char * format, ...)\r\n{\r\n#ifdef DEBUG\r\n#ifndef DEBUG_PRINT_OFF\r\n\tNSString * nsformat = [NSString stringWithUTF8String:format];\r\n\r\n\t// format済み文字列を生成\r\n\tva_list ap;\r\n\tva_start(ap, format);\r\n\tif (![nsformat hasSuffix: @\"\\n\"]) {\r\n\t\tnsformat = [nsformat stringByAppendingString: @\"\\n\"];\r\n\t}\r\n\tNSString *body = [[NSString alloc] initWithFormat:nsformat arguments:ap];\r\n\tNSLog(@\"%s\",[body UTF8String]);\r\n\t[body release];\r\n\tva_end(ap);\r\n\r\n#endif // #ifndef DEBUG_PRINT_ON\r\n#endif // #ifdef DEBUG\r\n}\r\n\r\nconst char* CiOSPlatform::getBundleVersion() {\r\n    return [[[NSBundle mainBundle] objectForInfoDictionaryKey: @\"CFBundleVersion\"] cStringUsingEncoding:NSUTF8StringEncoding];\r\n}\r\n\r\n\tITmpFile *\r\nCiOSPlatform::openTmpFile(const char * tmpPath)\r\n{\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(tmpPath, target, len)) {\r\n\t\t// 平成24年11月27日(火)\r\n\t\t// CiOSTmpFileのファイルパスの解決の仕方が'file://'を抜いた状態で解釈するため、\r\n\t\t// CiOSTmpFileへ渡すファイルパスのprefixを'file://'分進めて渡しています。\r\n\t\ttmpPath = tmpPath + 7;\r\n\t\tCiOSTmpFile * pTmpFile = new CiOSTmpFile(tmpPath);\r\n\t\tif(!pTmpFile->isReady()) {\r\n\t\t\tdelete pTmpFile;\r\n\t\t\tpTmpFile = 0;\r\n\t\t}\r\n\t\treturn pTmpFile;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n#include \"FileDelete.h\"\r\n\r\nconst char* getFullNativePath(const char* path) {\r\n\treturn CiOSPathConv::getInstance().fullpath(path + 7);\r\n}\r\n\r\nbool\r\nCiOSPlatform::removeFileOrFolder(const char* filePath) {\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(filePath, target, len)) {\r\n\t\treturn deleteFiles(filePath);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid removeTmpFileNative(const char* filePath) {\r\n\tremove(filePath);\r\n}\r\n\r\nvoid\r\nCiOSPlatform::removeTmpFile(const char *tmpPath)\r\n{\r\n\tconst char * target = \"file://external/\";\r\n\tint len = strlen(target);\r\n\tif(!strncmp(tmpPath, target, len)) {\r\n\t\tconst char * fullpath = CiOSPathConv::getInstance().fullpath(tmpPath + 7);\r\n\t\tremove(fullpath);\r\n\t\tdelete [] fullpath;\r\n\t}\r\n}\r\n\r\nu32\r\nCiOSPlatform::getFreeSpaceExternalKB() {\r\n    struct statfs diskInfo;\r\n    int ret = statfs(CiOSPathConv::getInstance().fullpath(\"external/\"), &diskInfo);\r\n    if (ret != 0) {\r\n        // return 0 for safety in case of fetch error just the same as Android version\r\n        return 0;\r\n    }\r\n    // calculate free space in KB available to non-superusers\r\n    unsigned long long freeKB = (diskInfo.f_bavail * diskInfo.f_bsize) >> 10;\r\n    if (freeKB & ~0xFFFFFF) {\r\n        return 0xFFFFFF;\r\n    }\r\n    return (u32)freeKB;\r\n}\r\n\r\nu32\r\nCiOSPlatform::getPhysicalMemKB() {\r\n\t//\r\n\t// IOS Physical Memory\r\n\t//\r\n\tsize_t length;\r\n\tint mib[6];\r\n\tint result;\r\n\r\n\tmib[0] = CTL_HW;\r\n\tmib[1] = HW_PHYSMEM;\r\n\tlength = sizeof(result);\r\n\tif (sysctl(mib, 2, &result, &length, NULL, 0) < 0) {\r\n\t\t// If reading fails, return 0\r\n\t\tresult = 0;\r\n\t} else {\r\n\t\tresult >>= 10;\r\n\t}\r\n\treturn (u32)result;\r\n}\r\n\r\nvoid\r\nCiOSPlatform::excludePathFromBackup(const char * fullpath)\r\n{\r\n    NSString *sysVer = [[UIDevice currentDevice] systemVersion];\r\n    if ([sysVer compare:@\"5.1\" options:NSNumericSearch] != NSOrderedAscending)\r\n    {\r\n        // version>=5.1\r\n        NSError *error = nil;\r\n        NSURL *targetUrl = [NSURL fileURLWithPath:[NSString stringWithUTF8String:(fullpath)]];\r\n        [targetUrl setResourceValue: [NSNumber numberWithBool: YES]\r\n                             forKey: NSURLIsExcludedFromBackupKey\r\n                              error: &error];\r\n    }\r\n    else if ([sysVer compare:@\"5.0.1\"] == NSOrderedSame)\r\n    {\r\n        // version=5.0.1\r\n        const char *attrName = \"com.apple.MobileBackup\";\r\n        u_int8_t attrValue = 1;\r\n        \r\n        // could be better to use fileSystemRepresentation for multi-bytes string\r\n        setxattr(fullpath, attrName, &attrValue, sizeof(attrValue), 0, 0);\r\n    }\r\n    else\r\n    {\r\n        // version<=5.0\r\n        // no support for exclusion\r\n    }\r\n}\r\n\tIReadStream *\r\nCiOSPlatform::openReadStream(const char *pathname, bool decrypt)\r\n{\r\n\t// ファイル名の scheme で、どのファイルを開くべきかが決まる。\r\n\tif(!strncmp(pathname, \"file://\", 7)) {\r\n\t\t// ファクトリには scheme を除いたパスが渡される。\r\n\t\tCiOSReadFileStream * pRds = CiOSReadFileStream::openStream(pathname + 7, 0);\r\n\t\tif (decrypt) { pRds->decryptSetup((const u8*)pathname + 7); }\r\n\t\treturn pRds;\r\n\t}\r\n\t// scheme が asset であれば、作るのは CiOSReadFileStream だが、EXTERN -> INSTALL の順で検索する。\r\n\tif(!strncmp(pathname, \"asset://\", 8)) {\r\n\t\tCiOSReadFileStream * pRds = CiOSReadFileStream::openAssets(pathname, 0);\r\n\t\tif (decrypt) { pRds->decryptSetup((const u8*)pathname + 8); }\r\n\t\treturn pRds;\r\n\t}\r\n\r\n\tif(!strncmp(pathname, \"socket://\", 9)) {\r\n\t\tCSockReadStream * pRds = CSockReadStream::openStream(pathname + 9);\r\n\t\treturn pRds;\r\n\t}\r\n\tif(!strncmp(pathname, \"http:\", 5)) {\r\n\t\treturn 0;\r\n\t}\r\n\tif(!strncmp(pathname, \"https:\", 6)) {\r\n\t\treturn 0;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n\tvoid *\r\nCiOSPlatform::loadAudio(const char * url, bool is_se)\r\n{\r\n\treturn CiOSAudioManager::GetInstance().CreateAudioHandle( url, this );\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::preLoad(void *handle)\r\n{\r\n\tif(!handle) return false;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\treturn audio->loadMem();\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::setBufSize(void *handle, int level)\r\n{\r\n\tif(!handle) return false;\r\n\tCiOSAudio * audio = (CiOSAudio *)handle;\r\n\treturn audio->setBufSize(level);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::playAudio(void *handle, s32 _msec, float _tgtVol, float _startVol)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\taudio->play(_msec, _tgtVol, _startVol);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::stopAudio(void *handle, s32 _msec, float _tgtVol)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\taudio->stop(_msec, _tgtVol);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::setMasterVolume(float volume, bool SEmode)\r\n{\r\n\tif(SEmode) {\r\n\t\tCiOSAudioManager::GetInstance().SetSEMasterVolume(volume);\r\n\t} else {\r\n\t\tCiOSAudioManager::GetInstance().SetBGMMasterVolume(volume);\r\n\t}\r\n\tCiOSAudioManager::GetInstance().UpdateVolume();\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::setAudioVolume(void *handle, float volume)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio *)handle;\r\n\taudio->setVolume(volume);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::setAudioPan(void *handle, float pan)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio *)handle;\r\n\taudio->setPan(pan);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::releaseAudio(void *handle)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\taudio->closeAudio();\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::pauseAudio(void * handle, s32 _msec, float _tgtVol)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\taudio->pause(_msec, _tgtVol);\r\n    audio->setLuaPause(true);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::resumeAudio(void * handle, s32 _msec, float _tgtVol)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\taudio->resume(_msec, _tgtVol);\r\n    audio->setLuaPause(false);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::seekAudio(void * handle, s32 millisec)\r\n{\r\n\tif(!handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\taudio->seek(millisec);\r\n}\r\n\r\n\ts32\r\nCiOSPlatform::tellAudio(void * handle)\r\n{\r\n\tif(!handle) return 0;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\treturn audio->tell();\r\n}\r\n\r\n\ts32\r\nCiOSPlatform::totalTimeAudio(void * handle)\r\n{\r\n\tif(!handle) return 0;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\treturn audio->totalPlayTime();\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::setFadeParam(void * _handle, float _tgtVol, u32 _msec)\r\n{\r\n\tif(!_handle) return;\r\n\tCiOSAudio * audio = (CiOSAudio*)_handle;\r\n\taudio->setFadeParam(_tgtVol, _msec);\r\n}\r\n\r\n\ts32\r\nCiOSPlatform::getState(void * handle)\r\n{\r\n\tif(!handle) return 0;\r\n\tCiOSAudio * audio = (CiOSAudio*)handle;\r\n\treturn audio->getState();\r\n}\r\n\r\n//! サウンドとミュージックの並行処理タイプ設定\r\n\tvoid\r\nCiOSPlatform::setAudioMultiProcessType( s32 _processType )\r\n{\r\n\tswitch( _processType )\r\n\t{\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT:\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT:\r\n\t\tcase IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT:\r\n\t\t\tCiOSAudioManager::GetInstance().SetAudioMultiProcessType(_processType);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*!\r\n    @brief  サウンドの割り込み処理をエンジン側で制御するかどうか\r\n    @param[in]  bool _bPauseOnInterruption\r\n    @return     void\r\n */\r\nvoid CiOSPlatform::setPauseOnInterruption(bool _bPauseOnInterruption)\r\n{\r\n    CiOSAudioManager::GetInstance().setPauseOnInterruption(_bPauseOnInterruption);\r\n}\r\n\r\n/*!\r\n    @brief  経過時間を取得(sec)\r\n    @param[in]  void\r\n    @return     s64     経過時間(sec)\r\n */\r\ns64 CiOSPlatform::getElapsedTime(void)\r\n{\r\n    struct timeval boottime;\r\n    \r\n    int mib[2] = {CTL_KERN, KERN_BOOTTIME};\r\n    size_t size = sizeof(boottime);\r\n    time_t now;\r\n    time_t uptime = 0;\r\n    (void)time(&now);\r\n    \r\n    if( (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1) && (boottime.tv_sec != 0) )\r\n    {\r\n        uptime = now - boottime.tv_sec;\r\n    }\r\n    return uptime;\r\n}\r\n\r\nbool CiOSPlatform::registerFont(const char* logicalName, const char* physFile, bool default_) {\r\n\treturn FontObject::registerFont(logicalName, physFile, default_);\r\n}\r\n\r\n\tvoid *\r\nCiOSPlatform::getFont(int size, const char * fontName, float* pAscent)\r\n{\r\n    FontObject* pFont = FontObject::createFont(fontName, size);\r\n    if (pFont) {\r\n        if (pAscent) {\r\n            *pAscent = pFont->getAscent();\r\n        }\r\n    }\r\n    return pFont;\r\n}\r\n\r\n\tvoid *\r\nCiOSPlatform::getFontSystem(int size, const char * fontName)\r\n{\r\n\tCiOSFont * pFont = new CiOSFont(size, fontName);\r\n\treturn (void *)pFont;\r\n}\r\n \r\n\tvoid\r\nCiOSPlatform::deleteFont(void * pFont)\r\n{\r\n\tFontObject::destroyFont((FontObject*)pFont);\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::deleteFontSystem(void * pFont)\r\n{\r\n\tCiOSFont * p_pFont = (CiOSFont *)pFont;\r\n\tdelete p_pFont;\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::renderText(const char *utf8String, void *pFont, u32 color,\r\n\t\tu16 width, u16 height, u8 *pBuffer8888, \r\n\t\ts16 stride, s16 base_x, s16 base_y, bool use4444)\r\n{\r\n    FontObject* pObjFont = (FontObject*)pFont;\r\n    if (pObjFont) {\r\n        pObjFont->renderText(base_x, base_y, utf8String, pBuffer8888, color, width, height, stride, use4444);\r\n    }\r\n\treturn true;\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo)\r\n{\r\n    FontObject* pF = (FontObject*)pFont;\r\n    if (pF) {\r\n        pF->getTextInfo(utf8String, pReturnInfo);\r\n    } else {\r\n        pReturnInfo->ascent    = 0.0f;\r\n        pReturnInfo->descent  = 0.0f;\r\n        pReturnInfo->bottom    = 0.0f;\r\n        pReturnInfo->top    = 0.0f;\r\n        pReturnInfo->width    = 0.0f;\r\n        pReturnInfo->height    = 0.0f;\r\n    }\r\n    return true;\r\n}\r\n\r\n\tvoid *\r\nCiOSPlatform::getGLExtension(const char * ext)\r\n{\r\n\treturn 0;\r\n}\r\n\r\nconst char *\r\nCiOSPlatform::getFullPath(const char *assetPath, bool * isReadOnly)\r\n{\r\n    CiOSPathConv& pathconv = CiOSPathConv::getInstance();\r\n    \r\n    // ファイル名の scheme で、どのファイルを開くべきかが決まる。\r\n    if(!strncmp(assetPath, \"file://\", 7)) {\r\n        return pathconv.fullpath(assetPath + 7, 0, isReadOnly);\r\n    }\r\n    // scheme が asset であれば、作るのは CiOSReadFileStream だが、EXTERN -> INSTALL の順で検索する。\r\n    if(!strncmp(assetPath, \"asset://\", 8)) {\r\n        return pathconv.fullpath(assetPath, 0, isReadOnly);\r\n    }\r\n    return 0;\r\n}\r\n\r\n\tconst char *\r\nCiOSPlatform::getPlatform()\r\n{\r\n\treturn (const char *)m_platform;\r\n}\r\n\r\n//! OSコントロールの生成と破棄\r\n\tIWidget *\r\nCiOSPlatform::createControl(IWidget::CONTROL type, int id, const char * caption,\r\n\t\tint x, int y, int width, int height, ...)\r\n{\r\n\tIWidget * pRetWidget = 0;\r\n\tva_list ap;\r\n\tva_start(ap, height);\r\n\tswitch (type) {\r\n\t\tcase IWidget::TEXTBOX:\r\n\t\tcase IWidget::PASSWDBOX:\r\n\t\t\t{\r\n\t\t\t\tint maxlen = va_arg(ap, int);\r\n\t\t\t\tCiOSTextWidget * pWidget = new CiOSTextWidget(this, maxlen);\r\n\t\t\t\tbool result = pWidget->create(type, id, caption, x, y, width, height);\r\n\t\t\t\tif(!result) {\r\n\t\t\t\t\tdelete pWidget;\r\n\t\t\t\t\tpWidget = 0;\r\n\t\t\t\t}\r\n\t\t\t\tpRetWidget = pWidget;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\tcase IWidget::WEBVIEW:\r\n\t\tcase IWidget::WEBNOJUMP:\r\n\t\t\t{\r\n\t\t\t\t// WebView の場合、規定のパラメータ以外にAuthorized Header の token と region のデータがつく。\r\n\t\t\t\tconst char * token  = va_arg(ap, const char *);\r\n\t\t\t\tconst char * region = va_arg(ap, const char *);\r\n\t\t\t\tconst char * client = va_arg(ap, const char *);\r\n\t\t\t\tconst char * cKey   = va_arg(ap, const char *);\r\n\t\t\t\tconst char * appID  = va_arg(ap, const char *);\r\n\t\t\t\tconst char * userID = va_arg(ap, const char *);\r\n\r\n\t\t\t\tCiOSWebWidget * pWidget = new CiOSWebWidget(this);\r\n\t\t\t\tbool result = pWidget->create(type, id, caption, x, y, width, height,\r\n\t\t\t\t\t\ttoken, region, client, cKey, appID, userID);\r\n\t\t\t\tif(!result) {\r\n\t\t\t\t\tdelete pWidget;\r\n\t\t\t\t\tpWidget = 0;\r\n\t\t\t\t}\r\n\t\t\t\tpRetWidget = pWidget;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\tcase IWidget::MOVIEPLAYER:\r\n\t\t\t{\r\n\t\t\t\tCiOSMovieWidget * pWidget = new CiOSMovieWidget(this);\r\n\t\t\t\tbool result = pWidget->create(type, id, caption, x, y, width, height);\r\n\t\t\t\tif(!result) {\r\n\t\t\t\t\tdelete pWidget;\r\n\t\t\t\t\tpWidget = 0;\r\n\t\t\t\t}\r\n\t\t\t\tpRetWidget = pWidget;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\tcase IWidget::BGMOVIEPLAYER:\r\n\t\t\t{\r\n\t\t\t\tCiOSMovieWidget * pWidget = new CiOSMovieWidget(this);\r\n\t\t\t\tbool result = pWidget->create(type, id, caption, x, y, width, height);\r\n\t\t\t\tif(!result) {\r\n\t\t\t\t\tdelete pWidget;\r\n\t\t\t\t\tpWidget = 0;\r\n\t\t\t\t}\r\n\t\t\t\tpRetWidget = pWidget;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\tcase IWidget::ACTIVITYINDICATOR:\r\n\t\t\t{\r\n\t\t\t\tCiOSActivityIndicator * pWidget = new CiOSActivityIndicator(this);\r\n\t\t\t\tbool result = pWidget->create(type, id, caption, x, y, width, height);\r\n\t\t\t\tif(!result) {\r\n\t\t\t\t\tdelete pWidget;\r\n\t\t\t\t\tpWidget = 0;\r\n\t\t\t\t}\r\n\t\t\t\tpRetWidget = pWidget;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\tdefault:\r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t}\r\n\tva_end(ap);\r\n\treturn pRetWidget;\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::destroyControl(IWidget * pWidget)\r\n{\r\n\tdelete pWidget;\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::callApplication(IPlatformRequest::APP_TYPE type, ...)\r\n{\r\n    bool result = true;\r\n    va_list ap;\r\n    va_start(ap, type);\r\n\r\n    switch (type) {\r\n        case IPlatformRequest::APP_MAIL:\r\n            {\r\n                //UTF8に変換しないと日本語で化ける 2013-3-5 inada-s\r\n                NSString *addr    = [NSString stringWithCString: va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\r\n                NSString *subject = [NSString stringWithCString: va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\r\n                NSString *body    = [NSString stringWithCString: va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\r\n\r\n                NSString *url = [[NSString alloc]initWithFormat:@\"mailto:%@?subject=%@&body=%@\", addr, subject, body];\r\n                url = [[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]stringByReplacingOccurrencesOfString:@\"+\" withString:@\"%2B%\"];\r\n                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];\r\n            }\r\n            break;\r\n        case IPlatformRequest::APP_BROWSER:\r\n            {\r\n                NSString *urlString = [NSString stringWithCString: va_arg(ap, const char *) encoding:NSUTF8StringEncoding];\r\n                NSURL *url = [NSURL URLWithString:urlString];\r\n                [[UIApplication sharedApplication] openURL:url];\r\n            }\r\n            break;\r\n        case IPlatformRequest::APP_UPDATE:\r\n            {\r\n                const char * search_key = va_arg(ap, const char *);\r\n                NSString * url_str = [NSString stringWithFormat:@\"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=%s&mt=8\", search_key];\r\n                NSURL *url = [NSURL URLWithString:url_str];\r\n                [[UIApplication sharedApplication] openURL:url];\r\n            }\r\n            break;\r\n        default:\r\n            result = false;\r\n            break;\r\n    }\r\n    va_end(ap);\r\n    return result;\r\n}\r\n\r\nvoid *\r\nCiOSPlatform::ThreadProc(void * data)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)data;\r\n\tif(!(pThread->result = setjmp(pThread->jmp))) {\r\n\t\tpThread->result = (pThread->thread_func)(pThread, pThread->data);\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n\tvoid *\r\nCiOSPlatform::createThread(s32 (*thread_func)(void *, void *), void *data)\r\n{\r\n\tPF_THREAD * thread = new PF_THREAD;\r\n\tif (!thread) return 0;\r\n\tthread->data = data;\r\n\tthread->thread_func = thread_func;\r\n\tthread->result = 0;\r\n\tpthread_create(&(thread->id), 0, ThreadProc, thread);\r\n\treturn thread;\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::exitThread(void *hThread, s32 status)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tlongjmp(pThread->jmp, status);\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::watchThread(void *hThread, s32 *status)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tif(pthread_kill(pThread->id, 0) != ESRCH) {\r\n\t\t// スレッドが終了していない\r\n\t\treturn true;\r\n\t}\r\n\t// スレッドは終了しているので、終了コードを *status に返す\r\n\t*status = pThread->result;\r\n\treturn false;   // 終了している\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::deleteThread(void * hThread)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tpthread_join(pThread->id, 0);\r\n\tdelete pThread;\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::breakThread(void * hThread)\r\n{\r\n\tPF_THREAD * pThread = (PF_THREAD *)hThread;\r\n\tpthread_kill(pThread->id, SIGKILL);\r\n}\r\n\r\n\tint\r\nCiOSPlatform::genUserID(char * retBuf, int maxlen)\r\n{\r\n\tNSString *uuidString = nil;\r\n\tCFUUIDRef uuid = CFUUIDCreate(0);\r\n\tif(uuid) {\r\n\t\tuuidString = (NSString *)CFUUIDCreateString(0, uuid);\r\n\t\tCFRelease(uuid);\r\n\t}\r\n\tconst char * cstrUUID = [uuidString UTF8String];\r\n\tint i;\r\n\tfor(i = 0; i < maxlen - 1 && cstrUUID[i]; i++) {\r\n\t\tretBuf[i] = cstrUUID[i];\r\n\t}\r\n\tretBuf[i] = 0;\r\n\tif( uuidString ) [uuidString release];\t// 2012.12.12  解放処理追加\r\n\treturn i;\r\n}\r\n\r\n\tint\r\nCiOSPlatform::genUserPW(const char * salt, char * retbuf, int maxlen)\r\n{\r\n\tchar buf[1024];\r\n\ttime_t tm;\r\n\tint rnd = rand();\r\n\ttime(&tm);\r\n\r\n\tsprintf(buf, \"%d.%ld.%s\", rnd, tm, salt);\r\n\treturn sha512(buf, retbuf, maxlen);\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::readyDevID()\r\n{\r\n\tCiOSSysResource& sysRes = CiOSSysResource::getInstance();\r\n\treturn sysRes.isReceived();\r\n}\r\n\r\n\tint\r\nCiOSPlatform::getDevID(char * retBuf, int maxlen)\r\n{\r\n\tCiOSSysResource& sysRes = CiOSSysResource::getInstance();\r\n\tif(sysRes.isReceived() && sysRes.isSucceed()) {\r\n\t\treturn sysRes.getDevID(retBuf, maxlen);\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::setKeyChain(const char * service_name, const char * key, const char * value)\r\n{\r\n\tbool result = true;\r\n\tint len = strlen(value);\r\n\tNSString * service = [NSString stringWithUTF8String:service_name];\r\n\tNSString * nskey = [NSString stringWithUTF8String:key];\r\n\r\n\tNSMutableDictionary * attributes = nil;\r\n\tNSMutableDictionary * query = [NSMutableDictionary dictionary];\r\n\tNSData * valueData = [NSData dataWithBytes:value length:len];   \r\n\r\n\t[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\r\n\t[query setObject:(id)nskey forKey:(id)kSecAttrAccount];\r\n\t[query setObject:service forKey:(id)kSecAttrService];    \r\n\r\n\tOSStatus err = SecItemCopyMatching((CFDictionaryRef)query, 0);\r\n\tif(err == noErr) {\r\n\t\t// update Item\r\n\t\tattributes = [NSMutableDictionary dictionary];\r\n\t\t[attributes setObject:valueData forKey:(id)kSecValueData];\r\n\t\t[attributes setObject:[NSDate date] forKey:(id)kSecAttrModificationDate];\r\n\t\terr = SecItemUpdate((CFDictionaryRef)query, (CFDictionaryRef)attributes);\r\n\t\tif(err != noErr) {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t} else if(err == errSecItemNotFound) {\r\n\t\t// new Item\r\n\t\tattributes = [NSMutableDictionary dictionary];\r\n\t\t[attributes setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\r\n\t\t[attributes setObject:(id)nskey forKey:(id)kSecAttrAccount];\r\n\t\t[attributes setObject:service forKey:(id)kSecAttrService];\r\n\t\t[attributes setObject:valueData forKey:(id)kSecValueData];\r\n\r\n\t\terr = SecItemAdd((CFDictionaryRef)attributes, 0);\r\n\t\tif(err != noErr) {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t} else {\r\n\t\tresult = false;\r\n\t}\r\n\treturn result;    \r\n}\r\n\r\n\tint\r\nCiOSPlatform::getKeyChain(const char * service_name, const char * key, char * retBuf, int maxlen)\r\n{\r\n\tNSString * service = [NSString stringWithUTF8String:service_name];\r\n\tNSString * nskey = [NSString stringWithUTF8String:key];\r\n\r\n\tNSMutableDictionary * query = [NSMutableDictionary dictionary];\r\n\r\n\t[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\r\n\t[query setObject:(id)nskey forKey:(id)kSecAttrAccount];\r\n\t[query setObject:service forKey:(id)kSecAttrService];    \r\n\t[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];\r\n\r\n\tNSData * valueData = nil;\r\n\tOSStatus err = SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&valueData);\r\n\tint i = 0;\r\n\tif(err == noErr) {\r\n\t\tNSString * ns_value = [[[NSString alloc] initWithData:valueData encoding:NSUTF8StringEncoding] autorelease];\r\n\t\tconst char * value = [ns_value UTF8String];\r\n\t\tfor(i = 0; i < maxlen - 1 && value[i]; i++) retBuf[i] = value[i];\r\n\t\tretBuf[i] = 0;\r\n\t}\r\n\r\n\t// 2012.12.11  解放追加\r\n\tif( valueData ) [valueData release];\r\n\r\n\treturn i;\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::delKeyChain(const char * service_name, const char * key)\r\n{\r\n\tbool result = true;\r\n\tNSString * service = [NSString stringWithUTF8String:service_name];\r\n\tNSString * nskey = [NSString stringWithUTF8String:key];\r\n\r\n\tNSMutableDictionary * attributes = nil;\r\n\tNSMutableDictionary * query = [NSMutableDictionary dictionary];\r\n\r\n\t[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];\r\n\t[query setObject:(id)nskey forKey:(id)kSecAttrAccount];\r\n\t[query setObject:service forKey:(id)kSecAttrService];    \r\n\r\n\tOSStatus err = SecItemCopyMatching((CFDictionaryRef)query, 0);\r\n\tif(err == noErr) {\r\n\t\t// update Item\r\n\t\tattributes = [NSMutableDictionary dictionary];\r\n\t\t[attributes setObject:[NSDate date] forKey:(id)kSecAttrModificationDate];\r\n\t\terr = SecItemDelete((CFDictionaryRef)query);\r\n\t\tif(err != noErr) {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t}\r\n\treturn result;    \r\n\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::setSecureDataID(const char * service_name, const char * user_id)\r\n{\r\n\treturn setKeyChain(service_name, \"user_id\", user_id);\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::setSecureDataPW(const char * service_name, const char * passwd)\r\n{\r\n\treturn setKeyChain(service_name, \"passwd\", passwd);\r\n}\r\n\r\n\tint\r\nCiOSPlatform::getSecureDataID(const char * service_name, char * retBuf, int maxlen)\r\n{\r\n\treturn getKeyChain(service_name, \"user_id\", retBuf, maxlen);\r\n}\r\n\r\n\tint\r\nCiOSPlatform::getSecureDataPW(const char * service_name, char * retBuf, int maxlen)\r\n{\r\n\treturn getKeyChain(service_name, \"passwd\", retBuf, maxlen);\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::delSecureDataID(const char *service_name)\r\n{\r\n\treturn delKeyChain(service_name, \"user_id\");\r\n}\r\n\r\n\tbool\r\nCiOSPlatform::delSecureDataPW(const char *service_name)\r\n{\r\n\treturn delKeyChain(service_name, \"passwd\");\r\n}\r\n\r\n\tint\r\nCiOSPlatform::sha512(const char * string, char * buf, int maxlen)\r\n{\r\n\tint len = strlen(string);\r\n\tNSData * data = [NSData dataWithBytes:string length:len];\r\n\tuint8_t digest[CC_SHA512_DIGEST_LENGTH];\r\n\tCC_SHA512(data.bytes, data.length, digest);\r\n\tNSMutableString * output = [NSMutableString stringWithCapacity:CC_SHA512_DIGEST_LENGTH * 2];\r\n\tfor(int i = 0; i < CC_SHA512_DIGEST_LENGTH; i++) {\r\n\t\t[output appendFormat:@\"%02x\",digest[i]];\r\n\t}\r\n\r\n\tconst char * passwd = [output UTF8String];\r\n\tint i;\r\n\tfor(i = 0; i < maxlen - 1 && passwd[i]; i++) {\r\n\t\tbuf[i] = passwd[i];\r\n\t}\r\n\tbuf[i] = 0;\r\n\treturn i;\r\n}\r\n\r\n\r\n\tvoid\r\nCiOSPlatform::initStoreTransactionObserver(void)\r\n{\r\n\t[[SKPaymentQueue defaultQueue] addTransactionObserver: m_pViewController];\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::releaseStoreTransactionObserver(void)\r\n{\r\n\t[[SKPaymentQueue defaultQueue] removeTransactionObserver: m_pViewController];\r\n}\r\n\tvoid\r\nCiOSPlatform::buyStoreItems(const char *item_id)\r\n{\r\n\t// item-id が item_id に const char * の配列としてnumで指定された数だけ渡されている。\r\n\tNSSet * set = [NSSet set];\r\n    \r\n    const char * utf8_id = item_id;\r\n\r\n    NSString * str_id = [NSString stringWithUTF8String:utf8_id];\r\n    set = [set setByAddingObject:str_id];\r\n    \r\n\tSKProductsRequest * productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:set];\r\n\tproductsRequest.delegate = m_pViewController;\r\n\t[productsRequest start];\r\n\r\n\tm_storeState.m_mode = STORE_BUY_PRODUCTS;\r\n\tm_storeState.m_count = 1;\r\n\tm_storeState.m_currency = false;\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::finishStoreTransaction(const char * receipt)\r\n{\r\n\t[(ViewController *)m_pViewController finishStoreTransaction:[NSString stringWithFormat:@\"%s\", receipt]];\r\n}\r\n\r\n\tvoid\r\nCiOSPlatform::getStoreProducts(const char* json, bool currency_mode)\r\n{\r\n\t// item-id が item_id に const char * の配列としてnumで指定された数だけ渡されている。\r\n\tNSSet* set = [NSSet set];\r\n\tCKLBJsonItem* root = CKLBJsonItem::ReadJsonData(json,\r\n\t\t\tstrlen(json));\r\n\tint product_count = 0;\r\n\tif (root)\r\n\t{\r\n\t\tCKLBJsonItem* child = root->child();\r\n\t\twhile (child)\r\n\t\t{\r\n\t\t\tconst char* utf8_id = child->getString();\r\n\t\t\tif (utf8_id)\r\n\t\t\t{\r\n\t\t\t\tNSString* str_id = [NSString stringWithUTF8String:utf8_id];\r\n\t\t\t\tset = [set setByAddingObject:str_id];\r\n\t\t\t\t++product_count;\r\n\t\t\t}\r\n\t\t\tchild = child->next();\r\n\t\t}\r\n\t}\r\n\r\n\tSKProductsRequest * productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:set];\r\n\tproductsRequest.delegate = m_pViewController;\r\n\t[productsRequest start];\r\n\r\n\tm_storeState.m_mode = STORE_GET_PRODUCTS;\r\n\tm_storeState.m_count = product_count;\r\n\tm_storeState.m_currency = currency_mode;\r\n}\r\n\r\n\r\nfloat CiOSPlatform::getMasterVolume(bool SEmode) const\r\n{\r\n\tif( SEmode ) {\r\n\t\treturn CiOSAudioManager::GetInstance().GetSEMasterVolume();\r\n\t} else {\r\n\t\treturn CiOSAudioManager::GetInstance().GetBGMMasterVolume();\r\n\r\n\t}\r\n\treturn 1.0f;\r\n}\r\n\r\n\r\n\tvoid\r\nCiOSPlatform::responseStoreKitProducts(SKProductsResponse* response, ViewController* viewController)\r\n{\r\n\t// 購入なのか、リストが欲しいだけなのかによって処理分離.\r\n\t// 購入の場合は、トランザクションを貼ってpaymentの処理へ移行.\r\n\t// リスト取得の場合はリストをLuaに渡しcallbackを起動する.\r\n\tif (m_storeState.m_mode == STORE_GET_PRODUCTS)\r\n\t{\r\n\r\n\t\t// 平成24年12月4日(火)\r\n\t\t// 言い訳。時間がない。- ->ちょっと整理 \r\n\t\t/*\r\n\t\t   [{\"id\":\"id\",\"title\":\"title\",\"description:\"description\",\"price\":\"price\"},{\"id\":\"id\",\"title\":\"title\",\"description:\"description\",\"price\":\"price\"},...]\r\n\r\n\t\t */\r\n\t\t// utf8\r\n\t\tif (m_storeState.m_count <= 0){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\r\n\t\t//NSMutableArray *contents = [NSMutableArray array];\r\n\t\tNSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];\r\n\t\t[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];\r\n\r\n\t\tif (m_storeState.m_currency)\r\n\t\t{\r\n\t\t\t[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];\r\n\t\t}\r\n\r\n\t\tNSMutableString *jsonString = [NSMutableString stringWithString:@\"[\"];\r\n\t\tint idx = 0;\r\n\t\tfor (SKProduct* product in response.products) {\r\n\t\t\tif (idx > 0) {\r\n\t\t\t\t[jsonString appendString:@\",\"];\r\n\t\t\t}\r\n\t\t\t++idx;\r\n\t\t\t[numberFormatter setLocale:product.priceLocale];\r\n\r\n\t\t\tNSString *identifier = product.productIdentifier;\r\n\t\t\tNSString *title = product.localizedTitle;\r\n\t\t\tNSString *description = product.description;\r\n\t\t\tNSString *price = [numberFormatter stringFromNumber:product.price];\r\n\t\t\tNSString *entry = [NSString stringWithFormat:@\"{\\\"id\\\":\\\"%@\\\",\\\"title\\\":\\\"%@\\\",\\\"description\\\":\\\"%@\\\",\\\"price\\\":\\\"%@\\\"}\", identifier, title, description, price];\r\n\t\t\t[jsonString appendString:entry];\r\n\t\t}\r\n\r\n\t\t[numberFormatter release];\r\n\r\n\t\t[jsonString appendString:@\"]\"];\r\n\r\n\t\tNSData * json = [jsonString dataUsingEncoding:NSUTF8StringEncoding];\r\n#ifdef DEBUG\r\n\t\tCPFInterface::getInstance().platform().logging(\"%@\",jsonString);\r\n#endif\r\n\t\tIClientRequest& cli = CPFInterface::getInstance().client();\r\n\t\tcli.controlEvent(IClientRequest::E_STORE_GET_PRODUCTS,\r\n\t\t\t\t0,\r\n\t\t\t\tjson.length + 1,\r\n\t\t\t\t(void *)[jsonString cStringUsingEncoding:NSUTF8StringEncoding],\r\n\t\t\t\t0,\r\n\t\t\t\t0);\r\n\r\n#ifdef USE_EXTERNAL_SDK_LOVELIVE\r\n\t\t[SDKWrapper onGetProducts:response];\r\n#endif\r\n\t}\r\n\telse if (m_storeState.m_mode == STORE_BUY_PRODUCTS)\r\n\t{\r\n\t\t// 購入処理開始\r\n\t\tfor(SKProduct * product in response.products) {\r\n\t\t\tSKPayment * payment = [SKPayment paymentWithProduct:product];\r\n\t\t\t[[SKPaymentQueue defaultQueue] addPayment:payment];\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid*\tCiOSPlatform::allocMutex\t()\r\n{\r\n\tpthread_mutex_t* pSection = new pthread_mutex_t();\r\n\tif (pSection) {\r\n\t\tif (pthread_mutex_init(pSection, NULL)) {\r\n\t\t\tdelete pSection;\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n\treturn pSection;\r\n}\r\n\r\nvoid\tCiOSPlatform::freeMutex\t\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tpthread_mutex_t* pSection = (pthread_mutex_t*)mutex;\t\r\n\t\tpthread_mutex_destroy(pSection); // Error handling useless here.\r\n\t\tdelete pSection;\r\n\t}\r\n}\r\n\r\nvoid\tCiOSPlatform::mutexLock\t\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tpthread_mutex_t* pSection = (pthread_mutex_t*)mutex;\r\n\t\tpthread_mutex_lock(pSection);\r\n\t}\r\n}\r\n\r\nvoid\tCiOSPlatform::mutexUnlock\t(void* mutex)\r\n{\r\n\tif (mutex) {\r\n\t\tpthread_mutex_t* pSection = (pthread_mutex_t*)mutex;\r\n\t\tpthread_mutex_unlock(pSection);\r\n\t}\r\n}\r\n\r\nstruct EventMutex {\r\n\tpthread_mutex_t\t\tmutex;\r\n\tpthread_cond_t\t\tcond;\r\n};\r\n\r\nvoid*\tCiOSPlatform::allocEventLock()\r\n{\r\n\tEventMutex* pEvent = new EventMutex();\r\n\tif (pEvent) {\r\n\t\tbool err = false;\r\n\t\tif (pthread_mutex_init(&pEvent->mutex, NULL) == 0) {\r\n\t\t\tif (pthread_cond_init(&pEvent->cond, NULL) == 0) {\r\n\t\t\t\t// Do nothing.\r\n\t\t\t} else {\r\n\t\t\t\tpthread_mutex_destroy(&pEvent->mutex);\r\n\t\t\t\terr = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\terr = true;\r\n\t\t}\r\n\t\t\r\n\t\tif (err) {\r\n\t\t\tdelete pEvent;\r\n\t\t\tpEvent = NULL;\r\n\t\t}\r\n\t}\r\n\treturn pEvent;\r\n}\r\n\r\nvoid\tCiOSPlatform::freeEventLock\t(void* lock)\r\n{\r\n\tEventMutex* pEvent = (EventMutex*)lock;\r\n\tif (pEvent) {\r\n\t\tpthread_mutex_destroy\t(&pEvent->mutex);\r\n\t\tpthread_cond_destroy\t(&pEvent->cond);\t\t\r\n\t}\r\n}\r\n\r\nvoid\tCiOSPlatform::eventSleep(void* lock)\r\n{\r\n\tEventMutex* pEvent = (EventMutex*)lock;\r\n\tif (pEvent) {\r\n\t\t// Own mutex [Lock]\r\n\t\tpthread_mutex_lock\t\t(&pEvent->mutex);\r\n\t\t// [Unlock] and go to [Sleep], atomically.\r\n\t\tpthread_cond_wait\t\t(&pEvent->cond, &pEvent->mutex);\r\n\t\t// [Lock] on wake up.\r\n\t\t\r\n\t\t// [Unlock] again.\r\n\t\tpthread_mutex_unlock\t(&pEvent->mutex);\r\n\t}\r\n}\r\n\r\nvoid\tCiOSPlatform::eventWakeup(void* lock)\r\n{\r\n\tEventMutex* pEvent = (EventMutex*)lock;\r\n\tif (pEvent) {\r\n\t\t// Own mutex [Lock]\r\n\t\tpthread_mutex_lock\t\t(&pEvent->mutex);\r\n\t\r\n\t\tpthread_cond_broadcast\t(&pEvent->cond);\r\n\r\n\t\t// [Unlock] again.\r\n\t\tpthread_mutex_unlock\t(&pEvent->mutex);\r\n\t}\r\n}\r\n\r\nvoid\tCiOSPlatform::forbidSleep(bool is_forbidden)\r\n{\r\n    [UIApplication sharedApplication].idleTimerDisabled = is_forbidden;\r\n}\r\n\r\nvoid*\t\tCiOSPlatform::ifopen\t(const char* name, const char* mode) {\r\n\treturn fopen(name, mode);\r\n}\r\n\r\nvoid\t\tCiOSPlatform::ifclose\t(void* file) {\r\n    if (file) {\r\n        fclose((FILE*)file);\r\n    }\r\n}\r\n\r\nint\t\t\tCiOSPlatform::ifseek\t(void* file, long int offset, int origin) {\r\n\treturn fseek((FILE*)file,offset,origin);\r\n}\r\n\r\nu32\t\t\tCiOSPlatform::ifread\t(void* ptr, u32 size, u32 count, void* file ) {\r\n\treturn fread(ptr, size, count, (FILE*)file);\r\n}\r\n\r\nu32\t\t\tCiOSPlatform::ifwrite\t(const void * ptr, u32 size, u32 count, void* file) {\r\n\treturn fwrite(ptr, size, count, (FILE*)file);\r\n}\r\n\r\nint\t\t\tCiOSPlatform::ifflush\t(void* file) {\r\n\treturn fflush((FILE*)file);\r\n}\r\n\r\nlong int\tCiOSPlatform::iftell\t(void* file) {\r\n\treturn ftell((FILE*)file);\r\n}\r\n\r\nbool CiOSPlatform::icreateEmptyFile(const char* name) {\r\n\tFILE* f = fopen(name,\"a\");\r\n\tif (f) {\r\n\t\tfclose(f);\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSReadFileStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSReadFileStream.cpp\r\n//\r\n//\r\n#include <errno.h>\r\n#include <fcntl.h>\r\n#include <sys/types.h> \r\n#include <sys/stat.h> \r\n#include <unistd.h>\r\n#include <iostream>\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"iOSFileLocation.h\"\r\n#include \"CiOSPathConv.h\"\r\n#include \"CiOSReadFileStream.h\"\r\n#include \"CiOSWriteFileStream.h\"\r\n\r\n#ifdef DEBUG_MEMORY\r\nCiOSReadFileStream * CiOSReadFileStream::ms_pBegin = 0;\r\nCiOSReadFileStream * CiOSReadFileStream::ms_pEnd;\r\n#endif\r\n\r\n// 論理トップレベルディレクトリと、物理ディレクトリパスの対応を行うテーブル。\r\nconst CiOSReadFileStream::LOCLIST CiOSReadFileStream::m_toplevel[3] = {\r\n    { \"external/\",  1, false},   // インストール後、更新の対象となる可変ファイル\r\n    { \"install/\",   0, true },   // インストール時に配置される固定ファイル\r\n    { 0, 0}\r\n};\r\n\r\nCiOSReadFileStream::CiOSReadFileStream()\r\n: m_bReadOnly(true)\r\n, m_fd(-1)\r\n, m_fp(0)\r\n, m_eStat(CLOSED)\r\n, m_fullpath(0)\r\n, m_writeStream(0)\r\n, m_decrypter()\r\n#ifdef DEBUG_MEMORY\r\n, m_pPrev(0), m_pNext(0)\r\n#endif\r\n{\r\n#ifdef DEBUG_MEMORY\r\n    m_pPrev = ms_pEnd;\r\n    if(ms_pEnd) ms_pEnd->m_pNext = this;\r\n    ms_pEnd = this;\r\n    if(!ms_pBegin) ms_pBegin = this;\r\n#endif\r\n}\r\n\r\nCiOSReadFileStream::~CiOSReadFileStream()\r\n{\r\n    if(m_fp) fclose(m_fp);\r\n    if(m_fd > 0) close(m_fd);\r\n    m_fd = -1;\r\n    m_eStat = CLOSED;\r\n    \r\n    delete [] m_fullpath;\r\n#ifdef DEBUG_MEMORY\r\n    if(m_pPrev) {\r\n        m_pPrev->m_pNext = m_pNext;\r\n    } else {\r\n        ms_pBegin = m_pNext;\r\n    }\r\n    if(m_pNext) {\r\n        m_pNext->m_pPrev = m_pPrev;\r\n    } else {\r\n        ms_pEnd = m_pPrev;\r\n    }\r\n#endif\r\n}\r\n\r\n\r\nCiOSReadFileStream *\r\nCiOSReadFileStream::openStream(const char * path, const char * home)\r\n{\r\n    CiOSReadFileStream * pStream = 0;\r\n    try {\r\n        pStream = new CiOSReadFileStream();\r\n        if(!pStream) {\r\n            return 0;\r\n        }\r\n        \r\n        pStream->m_fullpath = 0;\r\n        \r\n        CiOSPathConv& pathconv = CiOSPathConv::getInstance();\r\n        pStream->m_fullpath = pathconv.fullpath(path);\r\n\r\n        if(!pStream->m_fullpath) {\r\n            // ファイルセグメントが指定されていない\r\n            pStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        \r\n        // 物理パスができたので、ファイルをオープンする。\r\n        pStream->m_fd = open(pStream->m_fullpath, O_RDONLY);\r\n        if(pStream->m_fd < 0) {\r\n            // オープンに失敗\r\n            pStream->m_eStat = NOT_FOUND;\r\n#ifdef DEBUG_MEMORY\r\n            CPFInterface& pfif = CPFInterface::getInstance();\r\n            CiOSReadFileStream * p = ms_pBegin;\r\n            while(p) {\r\n                pfif.platform().logging(\"not closed stream: %s\", p->m_fullpath);\r\n                p = p->m_pNext;\r\n            }\r\n            pfif.platform().logging(\"errno = %d\", errno);\r\n#endif\r\n//          klb_assertAlways(\"could not open.\");\r\n            return pStream;\r\n        }\r\n        // fopen 系関数を使うために fdopen で m_fp も作っておく\r\n        pStream->m_fp = fdopen(pStream->m_fd, \"rb\");\r\n        if(!pStream->m_fp) {\r\n            close(pStream->m_fd);\r\n            pStream->m_fd = -1;\r\n            pStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        \r\n        // オープンに成功したので正常終了ステータスにする。\r\n        pStream->m_eStat = NORMAL;\r\n        return pStream;\r\n        \r\n    } catch(std::bad_alloc& ex) {\r\n        delete pStream;\r\n        return 0;\r\n    }\r\n}\r\n\r\nCiOSReadFileStream *\r\nCiOSReadFileStream::openAssets(const char * path, const char * home)\r\n{\r\n    return openStream(path, home);\r\n#if 0\r\n    CiOSReadFileStream * pStream = 0;\r\n    try {\r\n        pStream = new CiOSReadFileStream();\r\n        if(!pStream) {\r\n            return 0;\r\n        }\r\n        pStream->m_fullpath = 0;\r\n\r\n        CiOSPathConv& pathconv = CiOSPathConv::getInstance();\r\n        pStream->m_fullpath = pathconv.fullpath(path);\r\n\r\n        if(!pStream->m_fullpath) {\r\n            // ファイルが見つからなかった\r\n            pStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        // 物理パスができたので、ファイルをオープンする。\r\n        pStream->m_fd = open(pStream->m_fullpath, O_RDONLY);\r\n        if(pStream->m_fd < 0) {\r\n            // オープンに失敗\r\n            pStream->m_eStat = NOT_FOUND;\r\n#ifdef DEBUG_MEMORY\r\n            CPFInterface& pfif = CPFInterface::getInstance();\r\n            CiOSReadFileStream * p = ms_pBegin;\r\n            while(p) {\r\n                pfif.platform().logging(\"not closed stream: %s\", p->m_fullpath);\r\n                p = p->m_pNext;\r\n            }\r\n            pfif.platform().logging(\"errno = %d\", errno);\r\n#endif\r\n            return pStream;\r\n        }\r\n\r\n        // fopen 系関数を使うために fdopen で m_fp も作っておく\r\n        pStream->m_fp = fdopen(pStream->m_fd, \"rb\");\r\n        if(!pStream->m_fp) {\r\n            close(pStream->m_fd);\r\n            pStream->m_fd = -1;\r\n            pStream->m_eStat = NOT_FOUND;\r\n            return pStream;\r\n        }\r\n        \r\n        // オープンに成功したので正常終了ステータスにする。\r\n        pStream->m_decrypter.decryptSetup((const u8*)pStream->m_fullpath);\r\n        pStream->m_eStat = NORMAL;\r\n        return pStream;\r\n        \r\n    } catch(std::bad_alloc& ex) {\r\n        delete pStream;\r\n        return 0;\r\n    }\r\n#endif\r\n}\r\n\r\ns32 \r\nCiOSReadFileStream::getSize()\r\n{\r\n    struct stat file_stats;\r\n    if(fstat(m_fd, &file_stats) < 0) {\r\n        return -1;\r\n    }\r\n\r\n\treturn file_stats.st_size - (m_decrypter.m_useNew ? 4 : 0);\r\n}\r\n\r\ns32\r\nCiOSReadFileStream::getPosition()\r\n{\r\n    return (s32)(ftell(m_fp) - (m_decrypter.m_useNew ? 4 : 0));\r\n}\r\n\r\nu8       \r\nCiOSReadFileStream::readU8()\r\n{\r\n    // とりあえず動かすため、fgetc() で実装する。\r\n\tu8 val = fgetc(m_fp);\r\n    m_decrypter.decryptBlck(&val, 1);\r\n\treturn (u8)val;\r\n}\r\n\r\nu16      \r\nCiOSReadFileStream::readU16()\r\n{\r\n    u8 buf[2];\r\n    if(1 == fread(buf, 2, 1, m_fp)) {\r\n        m_decrypter.decryptBlck(buf, 2);\r\n        u16 ret = ((u16)buf[0] << 8) | (u16)buf[1];\r\n        return ret;\r\n    }\r\n    return 0;\r\n}\r\n\r\nu32      \r\nCiOSReadFileStream::readU32()\r\n{\r\n    u8 buf[4];\r\n    if(1 == fread(buf, 4, 1, m_fp)) {\r\n        m_decrypter.decryptBlck(buf, 4);\r\n        u32 ret = ((u32)buf[0] << 24) | ((u16)buf[1] <<16) | ((u16)buf[2] << 8) | (u16)buf[3];\r\n        return ret;\r\n    }\r\n    return 0;\r\n}\r\n\r\nfloat    \r\nCiOSReadFileStream::readFloat()\r\n{\r\n    float f;\r\n    if(1 == fread(&f, sizeof(float), 1, m_fp)) {\r\n        m_decrypter.decryptBlck(&f, sizeof(float));\r\n        return f;\r\n    }\r\n    return 0.0f;\r\n}\r\n\r\nbool     \r\nCiOSReadFileStream::readBlock(void * buffer, u32 byteSize)\r\n{\r\n    u32 cnt;\r\n    \r\n    cnt = fread(buffer, 1, byteSize, m_fp);\r\n    m_decrypter.decryptBlck(buffer, cnt);\r\n    return (cnt == byteSize) ? true : false;\r\n}\r\n\r\nIReadStream::ESTATUS  \r\nCiOSReadFileStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\nIWriteStream *  \r\nCiOSReadFileStream::getWriteStream()\r\n{\r\n    if(m_bReadOnly) return 0;   // m_bReadOnly が true の場合は read only 領域へのストリームなので、WriteStreamを返さない。\r\n    if(!m_writeStream) m_writeStream = new CiOSWriteFileStream(*this);\r\n    return m_writeStream;\r\n}\r\n\r\nint\r\nCiOSReadFileStream::readU16arr(u16 *pBufferU16, int items)\r\n{\r\n    int cnt = fread(pBufferU16, sizeof(u16), items, m_fp);\r\n    m_decrypter.decryptBlck(pBufferU16, sizeof(u16) * cnt);\r\n\r\n    // iOS と Android/ARM では元々big endian なので、バイトオーダーの入れ替えは特に不要。\r\n    // Windows 環境ではこれを使用して読む必要が生じるため、互換のために用意する。\r\n    return cnt;\r\n}\r\n\r\nint\r\nCiOSReadFileStream::readU32arr(u32 *pBufferU32, int items)\r\n{\r\n    int cnt = fread(pBufferU32, sizeof(u32), items, m_fp);    \r\n    m_decrypter.decryptBlck(pBufferU32, sizeof(u32) * cnt);\r\n\r\n\t// iOS と Android/ARM では元々big endian なので、バイトオーダーの入れ替えは特に不要。\r\n    // Windows 環境ではこれを使用して読む必要が生じるため、互換のために用意する。\r\n    return cnt;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSSysResource.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSSysResource.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <UIKit/UIApplication.h>\r\n#import <SystemConfiguration/SCNetworkReachability.h>\r\n#include <iostream>\r\n#include \"CiOSSysResource.h\"\r\n#define PUSH_NOTIFICATION_TIMEOUT (10.0f)\r\n\r\n;\r\nCiOSSysResource::CiOSSysResource() : m_size_devId(0), m_devId_received(false) {}\r\nCiOSSysResource::~CiOSSysResource() {}\r\n\r\nCiOSSysResource&\r\nCiOSSysResource::getInstance()\r\n{\r\n    static CiOSSysResource instance;\r\n    return instance;\r\n}\r\n\r\nvoid\r\nCiOSSysResource::requestDevID()\r\n{\r\n    m_devId_received = false;\r\n    UIRemoteNotificationType types = (UIRemoteNotificationType)((int)UIRemoteNotificationTypeBadge |\r\n                                                                (int)UIRemoteNotificationTypeSound |\r\n                                                                (int)UIRemoteNotificationTypeAlert);\r\n    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:types];\r\n\t// avoid iOS 7's \"no delegate called when user doesn't permit us push notification alerts\" issue\r\n    [NSTimer scheduledTimerWithTimeInterval:PUSH_NOTIFICATION_TIMEOUT\r\n                                     target:[NSBlockOperation blockOperationWithBlock:^{ failedDevID(); }]\r\n                                   selector:@selector(main)\r\n                                   userInfo:nil\r\n                                    repeats:NO];\r\n}\r\n\r\nbool\r\nCiOSSysResource::failedDevID()\r\n{\r\n    // don't overwrite devID unless \"received\" flag is false (i.e. resetted by re-running requestDevID())\r\n    if (m_devId_received) {\r\n        return false;\r\n    }\r\n    m_devId_received = true;\r\n    m_devId_succeed = false;\r\n    return false;\r\n}\r\n\r\nbool\r\nCiOSSysResource::setDevID(const void * devToken)\r\n{\r\n    // don't overwrite devID unless \"received\" flag is false (i.e. resetted by re-running requestDevID())\r\n    if (m_devId_received) {\r\n        return false;\r\n    }\r\n    unsigned char * ptr = (unsigned char *)devToken;\r\n    for(int i = 0; i < 32; i++) {\r\n        m_devId[i] = ptr[i];\r\n    }\r\n    m_size_devId = 32;\r\n    m_devId_received = true;\r\n    m_devId_succeed = true;\r\n    return true;\r\n}\r\n\r\nint\r\nCiOSSysResource::getDevID(char * retBuf, int maxlen)\r\n{\r\n    char * ptr = retBuf;\r\n    for(int i = 0; i < 32 && i * 2 + 2 < maxlen; i++) {\r\n        sprintf(ptr, \"%02x\", (int)m_devId[i]);\r\n        ptr += strlen(ptr);\r\n    }\r\n    return strlen(retBuf);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSTextView.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSTextView.mm\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#import \"CiOSTextView.h\"\r\n\r\n#define CIOS_TEXTVIEW_TAG   (999)\r\n\r\n@implementation CiOSTextView\r\n\r\n@synthesize m_pFontName;\r\n@synthesize m_placeHolder;\r\n@synthesize m_placeHolderColor;\r\n@synthesize textAlignment=textAlignment_;\r\n\r\n- (id)init\r\n{\r\n    self = [super init];\r\n    \r\n    if( self != nil )\r\n    {\r\n        self.m_placeHolderColor = [UIColor grayColor]; // 初期値灰色\r\n    }\r\n    \r\n    return self;\r\n}\r\n\r\n- (void)dealloc\r\n{\r\n    [m_placeHolder release];\r\n    m_placeHolder = nil;\r\n    \r\n    [m_placeHolderColor release];\r\n    m_placeHolderColor = nil;\r\n    \r\n    [super dealloc];\r\n}\r\n\r\n- (void)awakeFromNib\r\n{\r\n    [super awakeFromNib];\r\n    [self setPlaceHolderString:m_placeHolder];\r\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changedPlaceHolder:) name:UITextViewTextDidChangeNotification object:nil];\r\n}\r\n\r\n- (id)initWithFrame:(CGRect)frame\r\n{\r\n    if( (self = [super initWithFrame:frame]) )\r\n    {\r\n        // UITextViewで上寄せが上端まで行かないためマージンをマイナスで設定(-8は固定値だけどフォントによっては違うかも)\r\n        self.contentInset = UIEdgeInsetsMake(-8,0,0,0);\r\n        \r\n        [self setPlaceHolderString:m_placeHolder];\r\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changedPlaceHolder:) name:UITextViewTextDidChangeNotification object:nil];\r\n    }\r\n    return self;\r\n}\r\n\r\n- (void)setText:(NSString *)text\r\n{\r\n    [super setText:text];\r\n    [self changedPlaceHolder:nil];\r\n}\r\n\r\nfloat rectMargin = 8.0f;\r\n- (void)drawRect:(CGRect)rect\r\n{\r\n    if([[self text] length] == 0 && [[self m_placeHolder] length] > 0)\r\n    {\r\n        [m_placeHolderColor set];\r\n        [m_placeHolder drawInRect:CGRectMake(rectMargin,\r\n                                             rectMargin,\r\n                                             self.frame.size.width - (rectMargin * 2),\r\n                                             self.frame.size.height - (rectMargin * 2))\r\n                         withFont:self.font\r\n                    lineBreakMode:UILineBreakModeClip\r\n                        alignment:self.textAlignment];\r\n    }\r\n    \r\n    // 表示\r\n    [super drawRect:rect];\r\n}\r\n\r\n- (void)setFont:(UIFont*)font\r\n{\r\n    [super setFont:font];\r\n    \r\n    /*\r\n    // フォントサイズをもとにマージンサイズを調べる\r\n    CGFloat size = [self.font lineHeight];\r\n    self.contentInset = UIEdgeInsetsMake(-8,0,0,0);\r\n    CGFloat size = [self.font lineHeight];\r\n     */\r\n    \r\n    return;\r\n}\r\n\r\n/*\r\n    @brief  プレースホルダの表示切り替え\r\n */\r\n- (void)changedPlaceHolder:(NSNotification*)_notfication\r\n{\r\n    // プレースホルダの文字列が無ければreturn\r\n    if( [[self m_placeHolder] length] == 0 ) {\r\n        return;\r\n    }\r\n    \r\n    // 再描画\r\n    [self setNeedsDisplay];\r\n}\r\n\r\n/*\r\n    @brief  プレースホルダ文字列設定\r\n */\r\n- (void)setPlaceHolderString:(NSString*)_string\r\n{    \r\n    // プレースホルダの文字が以前と同じならそもそも設定の必要なし\r\n    if( [_string isEqual:m_placeHolder] ) {\r\n        return;\r\n    }\r\n\r\n    [m_placeHolder release];\r\n    m_placeHolder = [_string retain];\r\n}\r\n\r\n@end\r\n\r\n\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSTmpFile.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSTmpFile.cpp\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n#include <unistd.h>\r\n#include <fcntl.h>\r\n#include \"CiOSPathConv.h\"\r\n#include \"CiOSTmpFile.h\"\r\n#include \"CPFInterface.h\"\r\n\r\nCiOSTmpFile::CiOSTmpFile(const char * path) : m_fullpath(0)\r\n{\r\n    m_fullpath = CiOSPathConv::getInstance().fullpath(path);\r\n    // 平成24年11月27日(火)\r\n    // ファイルが存在しない場合に該当ファイルが生成されない事への対応と\r\n    // 権限の付与を行いました。\r\n    m_fd = open(m_fullpath, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);\r\n    CPFInterface::getInstance().platform().excludePathFromBackup(m_fullpath);\r\n}\r\n\r\nCiOSTmpFile::~CiOSTmpFile()\r\n{\r\n    if(m_fd > 0) {\r\n        close(m_fd);\r\n    }\r\n    delete [] m_fullpath;\r\n}\r\n\r\nsize_t\r\nCiOSTmpFile::writeTmp(void *ptr, size_t size)\r\n{\r\n    return write(m_fd, ptr, size);\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSWidget.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWidget.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#include <iostream>\r\n#include \"CiOSWidget.h\"\r\n#include \"CiOSPlatform.h\"\r\n#import <UIKit/UIKit.h>\r\n#import \"CiOSWebView.h\"\r\n#include \"CiOSPathConv.h\"\r\n#import <CoreMedia/CoreMedia.h>\r\n\r\nCiOSWidget::CiOSWidget(CiOSPlatform * pParent)\r\n: m_x(0)\r\n, m_y(0)\r\n, m_width(0)\r\n, m_height(0)\r\n, m_pPlatform(pParent)\r\n{\r\n    m_scale = m_pPlatform->getScale();\r\n}\r\nCiOSWidget::~CiOSWidget() {}\r\n\r\nvoid\r\nCiOSWidget::cmd(int cmd, ...) {}\r\n\r\nint\r\nCiOSWidget::status() { return 0; }\r\n\r\nbool\r\nCiOSWidget::init(int id, int x, int y, int width, int height)\r\n{\r\n    m_id = id;\r\n    m_x = x;\r\n    m_y = y;\r\n    m_width = width;\r\n    m_height = height;\r\n    set_move(m_x, m_y, m_width, m_height);\r\n    return true;\r\n}\r\n\r\nvoid\r\nCiOSWidget::move(int x, int y)\r\n{\r\n    m_x = x;\r\n    m_y = y;\r\n    set_move(m_x, m_y, m_width, m_height);\r\n}\r\n\r\nvoid\r\nCiOSWidget::resize(int width, int height)\r\n{\r\n    m_width = width;\r\n    m_height = height;\r\n    set_move(m_x, m_y, m_width, m_height);\r\n}\r\n\r\n\r\nCiOSTextWidget * CiOSTextWidget::ms_begin = 0;\r\nCiOSTextWidget * CiOSTextWidget::ms_end = 0; \r\n\r\nCiOSTextWidget::CiOSTextWidget(CiOSPlatform * pParent, int maxlen)\r\n: CiOSWidget(pParent)\r\n, m_pTextBox(0)\r\n, m_pTextView(0)\r\n, m_prev(0)\r\n, m_next(0)\r\n, m_touched(false)\r\n, m_bVisible(true)\r\n, m_maxlen(maxlen)\r\n, m_chartype(TXCH_7BIT_ASCII | TXCH_UTF8)\r\n, m_consoleType(E_CONSOLE_TYPE_UITEXTVIEW)\r\n, m_alignType(UITextAlignmentLeft)\r\n{\r\n    m_cols[0] = 0xffffffff;\r\n    m_cols[1] = 0xff000000;\r\n    m_cols[2] = 0xffffffff;\r\n    m_cols[3] = 0xff000000;\r\n    \r\n    m_prev = ms_end;\r\n    if(m_prev) {\r\n        m_prev->m_next = this;\r\n    } else {\r\n        ms_begin = this;\r\n    }\r\n    ms_end = this;\r\n    \r\n}\r\nCiOSTextWidget::~CiOSTextWidget()\r\n{\r\n    if(m_prev) {\r\n        m_prev->m_next = m_next;\r\n    } else {\r\n        ms_begin = m_next;\r\n    }\r\n    if(m_next) {\r\n        m_next->m_prev = m_prev;\r\n    } else {\r\n        ms_end = m_prev;\r\n    }\r\n    if(m_pTextBox) {\r\n        [m_pTextBox resignFirstResponder];\r\n        [m_pTextBox removeFromSuperview];\r\n    }\r\n    if(m_pTextView) {\r\n        [m_pTextView resignFirstResponder];\r\n        [m_pTextView removeFromSuperview];\r\n    }\r\n}\r\n\r\n// テキストフィールドを検索してWidgetを取得\r\nCiOSTextWidget *\r\nCiOSTextWidget::searchWidgetField(UITextField *pTextBox)\r\n{\r\n    CiOSTextWidget * pWidget = ms_begin;\r\n    while(pWidget) {\r\n        if(pWidget->m_pTextBox == pTextBox) break;\r\n        pWidget = pWidget->m_next;\r\n    }\r\n    return pWidget;\r\n}\r\n\r\n// テキストビューを検索してWidgetを取得\r\nCiOSTextWidget *\r\nCiOSTextWidget::searchWidgetView(UITextView * pTextView)\r\n{\r\n    CiOSTextWidget * pWidget = ms_begin;\r\n    while(pWidget) {\r\n        if(pWidget->m_pTextView == pTextView) break;\r\n        pWidget = pWidget->m_next;\r\n    }\r\n    return pWidget;\r\n}\r\n\r\nvoid\r\nCiOSTextWidget::setAllVisible(bool visible)\r\n{\r\n    CiOSTextWidget * pWidget = ms_begin;\r\n    while(pWidget) {\r\n        pWidget->m_pTextBox.hidden = (visible && pWidget->m_bVisible) ? NO : YES;\r\n        pWidget->m_pTextView.hidden = (visible && pWidget->m_bVisible) ? NO : YES;\r\n        pWidget = pWidget->m_next;\r\n    }\r\n}\r\n\r\n\r\nUIFont *\r\nCiOSTextWidget::getFont()\r\n{\r\n    return (!m_pFont) ? [UIFont systemFontOfSize:16] : m_pFont->getFontScaled();\r\n}\r\nconst char *\r\nCiOSTextWidget::getFontName()\r\n{\r\n    return (!m_pFont) ? 0 : m_pFont->getFontname();\r\n}\r\n\r\nbool\r\nCiOSTextWidget::create(CONTROL type, int id,\r\n                     const char *caption, int x, int y, int width, int height)\r\n{\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            createTextView(type, caption);\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            createTextField(type, caption);\r\n            break;\r\n    }\r\n\r\n    return init(id, x, y, width, height);\r\n}\r\n\r\nint\r\nCiOSTextWidget::getTextLength()\r\n{\r\n    const char * pstr = NULL;\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            pstr = [m_pTextView.text UTF8String];\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            pstr = [m_pTextBox.text UTF8String];\r\n            break;\r\n    }\r\n    return strlen(pstr);\r\n}\r\n\r\nbool\r\nCiOSTextWidget::getText(char * pBuf, int maxlen)\r\n{\r\n    const char * pstr = NULL;\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            pstr = [m_pTextView.text UTF8String];\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            pstr = [m_pTextBox.text UTF8String];\r\n            break;\r\n    }\r\n    int len = strlen(pstr);\r\n    if(len >= maxlen) len = maxlen - 1;\r\n    strncpy(pBuf, pstr, len);\r\n    pBuf[len] = 0;\r\n    return true;\r\n}\r\n\r\nbool\r\nCiOSTextWidget::setText(const char * string)\r\n{\r\n    NSString *str = [[[NSString alloc] initWithUTF8String:string] autorelease];\t// 2012.12.11  autorelease追加\r\n    m_pTextView.text = str;\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            m_pTextView.text = str;\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            m_pTextBox.text = str;\r\n            break;\r\n    }\r\n    return true;\r\n}\r\n\r\nvoid\r\nCiOSTextWidget::visible(bool bVisible)\r\n{\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            m_pTextView.hidden = (bVisible) ? NO : YES;\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            m_pTextBox.hidden = (bVisible) ? NO : YES;\r\n            break;\r\n    }\r\n    m_bVisible = bVisible;\r\n}\r\n\r\nvoid\r\nCiOSTextWidget::enable(bool bEnable)\r\n{\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            //m_pTextView.enabled = (bEnable) ? YES : NO;\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            m_pTextBox.enabled = (bEnable) ? YES : NO;\r\n            break;\r\n    }\r\n}\r\n\r\n// テキストフィールド版を作成\r\nbool\r\nCiOSTextWidget::createTextField(CONTROL _type, const char *_caption)\r\n{\r\n    EAGLView * pView = getPlatform().getView();\r\n    \r\n    switch(_type)\r\n    {\r\n        default:\r\n            return false;\r\n        case IWidget::TEXTBOX:\r\n            m_pTextBox = [[[UITextField alloc] init] autorelease];\r\n            m_pTextBox.text = [NSString stringWithUTF8String:_caption];\r\n            m_pTextBox.borderStyle = UITextBorderStyleRoundedRect;\r\n            m_pFont = 0;\r\n            m_pTextBox.font = [UIFont systemFontOfSize:16];\r\n            m_pTextBox.keyboardType = UIKeyboardTypeDefault;\r\n            m_pTextBox.returnKeyType = UIReturnKeyDone;\r\n            m_pTextBox.clearButtonMode = UITextFieldViewModeWhileEditing; // クリアボタン\r\n            m_pTextBox.delegate = pView;\r\n            break;\r\n        case IWidget::PASSWDBOX:\r\n            m_pTextBox = [[[UITextField alloc] init] autorelease];\r\n            m_pTextBox.text = [NSString stringWithUTF8String:_caption];\r\n            m_pTextBox.secureTextEntry = YES;\r\n            m_pTextBox.borderStyle = UITextBorderStyleRoundedRect;\r\n            m_pFont = 0;\r\n            m_pTextBox.font = [UIFont systemFontOfSize:16];\r\n            m_pTextBox.keyboardType = UIKeyboardTypeDefault;\r\n            m_pTextBox.returnKeyType = UIReturnKeyDone;\r\n            m_pTextBox.clearButtonMode = UITextFieldViewModeWhileEditing; // クリアボタン\r\n            m_pTextBox.delegate = pView;\r\n            break;\r\n    }\r\n    \r\n    [m_pTextBox addTarget:pView action:@selector(textTouchDown:)\r\n    forControlEvents:UIControlEventTouchDown];\r\n     \r\n    [m_pTextBox addTarget:pView action:@selector(textTouchDown:)\r\n    forControlEvents:UIControlEventEditingDidBegin];\r\n     \r\n    [m_pTextBox addTarget:pView action:@selector(textTouchUp:)\r\n    forControlEvents:UIControlEventEditingDidEnd];\r\n     \r\n    [m_pTextBox addTarget:pView action:@selector(textTouchUp:)\r\n    forControlEvents:UIControlEventTouchDragInside];\r\n    \r\n    set_color();\r\n    \r\n    [pView addSubview:m_pTextBox];\r\n    \r\n    return true;\r\n}\r\n\r\n// テキストビュー版を作成\r\nbool\r\nCiOSTextWidget::createTextView(CONTROL _type, const char *_caption)\r\n{\r\n    EAGLView * pView = getPlatform().getView();\r\n    \r\n    switch(_type)\r\n    {\r\n        default:\r\n            return false;\r\n        case IWidget::TEXTBOX:            \r\n//            m_pTextView = [[[UITextView alloc] init] autorelease];\r\n            m_pTextView = [[[CiOSTextView alloc] init] autorelease];\r\n            m_pTextView.text = [NSString stringWithUTF8String:_caption];\r\n            //m_pTextView.borderStyle = UITextBorderStyleRoundedRect;\r\n            m_pTextView.layer.borderWidth = 1.0f;\r\n            m_pTextView.layer.cornerRadius = 8.0f;\r\n            m_pFont = 0;\r\n            m_pTextView.font = [UIFont systemFontOfSize:16];\r\n            m_pTextView.keyboardType = UIKeyboardTypeDefault;\r\n            m_pTextView.returnKeyType = UIReturnKeyDone;\r\n            m_pTextView.delegate = pView;\r\n            break;\r\n        case IWidget::PASSWDBOX:            \r\n//            m_pTextView = [[[UITextView alloc] init] autorelease];\r\n            m_pTextView = [[[CiOSTextView alloc] init] autorelease];\r\n            m_pTextView.text = [NSString stringWithUTF8String:_caption];\r\n            m_pTextView.secureTextEntry = YES;\r\n            //m_pTextView.borderStyle = UITextBorderStyleRoundedRect;\r\n            m_pTextView.layer.borderWidth = 1.0f;\r\n            m_pTextView.layer.cornerRadius = 8.0f;\r\n            m_pFont = 0;\r\n            m_pTextView.font = [UIFont systemFontOfSize:16];\r\n            m_pTextView.keyboardType = UIKeyboardTypeDefault;\r\n            m_pTextView.returnKeyType = UIReturnKeyDone;\r\n            m_pTextView.delegate = pView;\r\n            break;\r\n    }\r\n    \r\n    set_color();\r\n    \r\n    [pView addSubview:m_pTextView];\r\n    \r\n    return true;\r\n}\r\n\r\nvoid\r\nCiOSTextWidget::set_move(int x, int y, int width, int height)\r\n{\r\n    float scale = getScale();\r\n    \r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            m_pTextView.frame = CGRectMake(x / scale,\r\n                                           y / scale,\r\n                                           width /scale,\r\n                                           height / scale);\r\n            break;\r\n            \r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            m_pTextBox.frame = CGRectMake(x / scale,\r\n                                          y / scale,\r\n                                          width /scale,\r\n                                          height / scale);\r\n            break;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSTextWidget::cmd(int cmd, ...)\r\n{\r\n    va_list ap;\r\n    va_start(ap, cmd);\r\n    \r\n    switch(cmd)\r\n    {\r\n        case TX_PLACEHOLDER:\r\n        {\r\n            // プレースホルダに文字設定\r\n            const char * placeholder = va_arg(ap, const char *);\r\n            if( m_consoleType == E_CONSOLE_TYPE_UITEXTFIELD ) {\r\n                m_pTextBox.placeholder = [NSString stringWithUTF8String:placeholder];\r\n            } else if( m_consoleType == E_CONSOLE_TYPE_UITEXTVIEW ) {\r\n                [m_pTextView setPlaceHolderString:[NSString stringWithUTF8String:placeholder]];\r\n            }\r\n            break;\r\n        }\r\n        case TX_FONT:\r\n        {\r\n            CiOSFont * pFont = (CiOSFont *)va_arg(ap, void *);\r\n            m_pFont = pFont;\r\n            if( m_consoleType == E_CONSOLE_TYPE_UITEXTFIELD ) {\r\n                m_pTextBox.font = m_pFont->getFontScaled();\r\n            } else if( m_consoleType == E_CONSOLE_TYPE_UITEXTVIEW ) {\r\n                m_pTextView.font = m_pFont->getFontScaled();\r\n            }\r\n            break;\r\n        }\r\n        case TX_MAXLEN:\r\n        {\r\n            int maxlen = va_arg(ap, int);\r\n            m_maxlen = maxlen;\r\n            break;\r\n        }\r\n        case TX_CHARTYPE:\r\n        {\r\n            int chartype = va_arg(ap, int);\r\n            m_chartype = chartype;\r\n            break;\r\n        }\r\n        case TX_ALIGNMENTTYPE:\r\n        {\r\n            // テキストのアライメント設定\r\n            int alignType = va_arg(ap, int);\r\n            switch( alignType )\r\n            {\r\n                case TX_ALIGN_LEFT:\r\n                    m_alignType = NSTextAlignmentLeft;\r\n                    break;\r\n                case TX_ALIGN_CENTER:\r\n                    m_alignType = NSTextAlignmentCenter;\r\n                    break;\r\n                case TX_ALIGN_RIGHT:\r\n                    m_alignType = NSTextAlignmentRight;\r\n                    break;\r\n            }\r\n            if( m_consoleType == E_CONSOLE_TYPE_UITEXTFIELD ) {\r\n                m_pTextBox.textAlignment = m_alignType;\r\n            } else if( m_consoleType == E_CONSOLE_TYPE_UITEXTVIEW ) {\r\n                m_pTextView.textAlignment = m_alignType;\r\n            }\r\n            break;\r\n        }\r\n        default:\r\n        {\r\n            unsigned int color = va_arg(ap, unsigned int);\r\n            switch (cmd)\r\n            {\r\n                case TX_BGCOLOR_NORMAL: m_cols[0] = color; break;\r\n                case TX_FGCOLOR_NORMAL: m_cols[1] = color; break;\r\n                case TX_BGCOLOR_TOUCH:  m_cols[2] = color; break;\r\n                case TX_FGCOLOR_TOUCH:  m_cols[3] = color; break;\r\n            }\r\n            set_color();    // カラー設定\r\n            break;\r\n        }\r\n    }\r\n    \r\n    va_end(ap);\r\n}\r\n\r\nvoid\r\nCiOSTextWidget::set_color()\r\n{\r\n    int base = (m_touched) ? 2 : 0;\r\n    unsigned int bg = m_cols[base];\r\n    unsigned int fg = m_cols[base + 1];\r\n    int i;\r\n    float bcol[4], fcol[4];\r\n               \r\n    // background の設定\r\n    for(i = 0; i < 4; i++) {\r\n        bcol[i] = ((bg >> (8 * i))& 0xff) / 255.0f;\r\n        fcol[i] = ((fg >> (8 * i))& 0xff) / 255.0f;\r\n    }\r\n    UIColor * uibg = [UIColor colorWithRed:bcol[2] green:bcol[1] blue:bcol[0] alpha:bcol[3]];\r\n    UIColor * uifg = [UIColor colorWithRed:fcol[2] green:fcol[1] blue:fcol[0] alpha:fcol[3]];\r\n\r\n    switch( m_consoleType )\r\n    {\r\n        case E_CONSOLE_TYPE_UITEXTVIEW:\r\n            m_pTextView.backgroundColor = uibg;\r\n            m_pTextView.textColor = uifg;\r\n            break;\r\n        case E_CONSOLE_TYPE_UITEXTFIELD:\r\n            m_pTextBox.backgroundColor = uibg;\r\n            m_pTextBox.textColor = uifg;\r\n            break;\r\n    }\r\n}\r\n\r\n\r\nCiOSWebWidget * CiOSWebWidget::ms_begin = 0;\r\nCiOSWebWidget * CiOSWebWidget::ms_end = 0; \r\n\r\n\r\nCiOSWebWidget::CiOSWebWidget(CiOSPlatform * pParent)\r\n    : CiOSWidget(pParent), m_pWebView(0), m_pNowURL(0), m_bgalpha(0), m_bgcolor(0xffffff), m_next(0), m_prev(0)\r\n{\r\n    m_prev = ms_end;\r\n    if(m_prev) {\r\n        m_prev->m_next = this;\r\n    } else {\r\n        ms_begin = this;\r\n    }\r\n    ms_end = this;\r\n}\r\n\r\nCiOSWebWidget::~CiOSWebWidget()\r\n{\r\n    if(m_prev) {\r\n        m_prev->m_next = m_next;\r\n    } else {\r\n        ms_begin = m_next;\r\n    }\r\n    if(m_next) {\r\n        m_next->m_prev = m_prev;\r\n    } else {\r\n        ms_end = m_prev;\r\n    }\r\n    \r\n    if( m_pNowURL ) delete [] m_pNowURL;\t// 2012.12.11  解放漏れ修正\r\n    \r\n    if(m_pWebView) {\r\n        [m_pWebView removeFromSuperview];\r\n    }\r\n}\r\n\r\nCiOSWebWidget *\r\nCiOSWebWidget::searchWidget(UIWebView *pWebView)\r\n{\r\n    CiOSWebWidget * pWidget = ms_begin;\r\n    while(pWidget) {\r\n        if(pWidget->m_pWebView == pWebView) break;\r\n        pWidget = pWidget->m_next;\r\n    }\r\n    return pWidget;\r\n}\r\n\r\nbool\r\nCiOSWebWidget::create(CONTROL type, int id,\r\n                      const char *caption, int x, int y, int width, int height,\r\n                      const char * token,\r\n                      const char * region,\r\n                      const char * client,\r\n                      const char * consumerKey,\r\n                      const char * applicationId,\r\n                      const char * userID)\r\n{\r\n    EAGLView * pView = getPlatform().getView();\r\n    switch(type)\r\n    {\r\n        default:\r\n            return false;\r\n        case IWidget::WEBVIEW:\r\n            m_bJump = true;\r\n            break;\r\n\r\n        case IWidget::WEBNOJUMP:\r\n            m_bJump = false;\r\n            break;\r\n    }\r\n    m_bFirst = true;\r\n    m_pWebView = [[[CiOSWebView alloc] init] autorelease];\r\n    \r\n    const char * pform = CPFInterface::getInstance().platform().getPlatform();\r\n    \r\n    [m_pWebView setCustomHeaders:token:region:client:consumerKey:applicationId:userID:pform];\r\n    \r\n//    setText(caption);\t// 2012.12.11  下でもやっているんのでコメントアウト\r\n    set_bgcolor();\r\n    m_pWebView.delegate = pView;\r\n    m_pWebView.scalesPageToFit = YES;\r\n    m_pWebView.autoresizingMask = UIViewAutoresizingFlexibleWidth;\r\n    \r\n    m_pWebView.opaque = NO;             // 不透明をNO状態にすることで透過が可能\r\n    \r\n    ((UIScrollView *)[[m_pWebView subviews] objectAtIndex:0]).bounces = NO;\r\n    [pView addSubview:m_pWebView];\r\n    bool result = init(id, x, y, width, height);\r\n    return setText(caption) && result;\r\n}\r\n\r\nint\r\nCiOSWebWidget::getTextLength()\r\n{\r\n    const char * pstr = m_pNowURL;\r\n    return strlen(pstr);\r\n}\r\n\r\nbool\r\nCiOSWebWidget::getText(char * pBuf, int maxlen)\r\n{\r\n    const char * pstr = m_pNowURL;\r\n    int len = strlen(pstr);\r\n    if(len >= maxlen) len = maxlen - 1;\r\n    strncpy(pBuf, pstr, len);\r\n    pBuf[len] = 0;\r\n    return true;\r\n}\r\n\r\nbool\r\nCiOSWebWidget::setText(const char * string)\r\n{\r\n    NSURL * url = [[NSURL alloc] initWithString:[NSString stringWithUTF8String:string]];\r\n    NSURLRequest * req = [[NSURLRequest alloc] initWithURL:url];\r\n    [m_pWebView loadRequest:req];\r\n    [req release];\r\n    [url release];\r\n\r\n    char * buf = new char [ strlen(string) + 1 ];\r\n    strcpy(buf, string);\r\n    if(m_pNowURL) delete [] m_pNowURL;\r\n    m_pNowURL = buf;\r\n    return true;\r\n}\r\n\r\nvoid\r\nCiOSWebWidget::set_bgcolor()\r\n{\r\n    int i = 0;\r\n    unsigned int color = (m_bgalpha << 24) | m_bgcolor;\r\n    float bgColor[4];\r\n    \r\n    for( i=0; i<4; ++i ) {\r\n        bgColor[i] = ((color >> (8 * i)) & 0xff) / 255.0f;\r\n    }\r\n    \r\n    UIColor * uibg = [UIColor colorWithRed:bgColor[2] green:bgColor[1] blue:bgColor[0] alpha:bgColor[3]];\r\n    m_pWebView.backgroundColor = uibg;\r\n}\r\n\r\nvoid\r\nCiOSWebWidget::visible(bool bVisible)\r\n{\r\n    m_pWebView.hidden = (bVisible) ? NO : YES;\r\n}\r\n\r\nvoid\r\nCiOSWebWidget::enable(bool bEnable)\r\n{\r\n}\r\n\r\nvoid\r\nCiOSWebWidget::set_move(int x, int y, int width, int height)\r\n{\r\n    float scale = getScale();\r\n    m_pWebView.frame = CGRectMake(x / scale,\r\n                                  y / scale,\r\n                                  width /scale,\r\n                                  height / scale);\r\n}\r\n\r\nvoid\r\nCiOSWebWidget::cmd(int cmd, ...)\r\n{\r\n    va_list ap;\r\n    va_start(ap, cmd);\r\n    switch (cmd) {\r\n        case WEB_SET_SCALESPAGETOFIT:\r\n        {\r\n            int pagetofit = va_arg(ap, int);\r\n            m_pWebView.scalesPageToFit = (pagetofit) ? YES : NO;\r\n            break;\r\n        }\r\n            \r\n        case WEB_BGCOLOR_NORMAL:    // WebViewの背景色の設定\r\n        {\r\n            unsigned int bgalpha = va_arg(ap, unsigned int);\r\n            unsigned int bgcolor = va_arg(ap, unsigned int);\r\n            \r\n            m_bgalpha = bgalpha;\r\n            m_bgcolor = bgcolor;\r\n            set_bgcolor();\r\n            break;\r\n        }\r\n        default:\r\n            break;\r\n    }\r\n}\r\n\r\n\r\nCiOSMovieWidget * CiOSMovieWidget::ms_begin = 0;\r\nCiOSMovieWidget * CiOSMovieWidget::ms_end = 0; \r\n\r\nCiOSMovieWidget::CiOSMovieWidget(CiOSPlatform * pParent)\r\n: CiOSWidget(pParent), m_next(0), m_prev(0), m_pNowPATH(0), m_pMovieView(0), m_status(0)\r\n{\r\n    m_prev = ms_end;\r\n    if(m_prev) {\r\n        m_prev->m_next = this;\r\n    } else {\r\n        ms_begin = this;\r\n    }\r\n    ms_end = this;\r\n}\r\n\r\nCiOSMovieWidget::~CiOSMovieWidget()\r\n{\r\n    if(m_prev) {\r\n        m_prev->m_next = m_next;\r\n    } else {\r\n        ms_begin = m_next;\r\n    }\r\n    if(m_next) {\r\n        m_next->m_prev = m_prev;\r\n    } else {\r\n        ms_end = m_prev;\r\n    }\r\n    \r\n    if( m_pNowPATH ) delete [] m_pNowPATH;\t// 2012.12.11  解放漏れ修正\r\n    \r\n    if(m_pMovieView) {\r\n        // イベント削除\r\n        EAGLView * pView = getPlatform().getView();\r\n        [[NSNotificationCenter defaultCenter]\r\n         removeObserver:pView\r\n         name:MPMoviePlayerPlaybackDidFinishNotification\r\n         object:m_pMovieView];\r\n\r\n        // 背景ムービーだとViewが破棄されないため、AVPlayerを破棄する\r\n        AVPlayerLayer * playerLayer = (AVPlayerLayer *)m_pMovieView.layer;\r\n        // AVPlayer * player = playerLayer.player;\r\n        playerLayer.player = nil;\r\n        \r\n        if(m_type == IWidget::MOVIEPLAYER) {\r\n            [m_pMovieView removeFromSuperview];\r\n        }\r\n    }\r\n}\r\n\r\nbool\r\nCiOSMovieWidget::create(CONTROL type, int id,\r\n                      const char *caption, int x, int y, int width, int height)\r\n{\r\n    \r\n    EAGLView * pView = getPlatform().getView();\r\n    switch(type)\r\n    {\r\n        default:\r\n            return false;\r\n        case IWidget::MOVIEPLAYER:\r\n            m_pMovieView = [[[CiOSMovieView alloc] init] autorelease];            \r\n            [pView addSubview:m_pMovieView];\r\n            break;\r\n        case IWidget::BGMOVIEPLAYER:\r\n            m_pMovieView = (CiOSMovieView *)pView.superview; // GLviewの親がその背後に配置されている\r\n            break;\r\n    }\r\n//    setText(caption);\t// 2012.12.11  下でもやっているんのでコメントアウト\r\n    m_type = type;\r\n    bool result = init(id, x, y, width, height);\r\n    return setText(caption) && result;\r\n}\r\n\r\nint\r\nCiOSMovieWidget::getTextLength()\r\n{\r\n    const char * pstr = m_pNowPATH;\r\n    return strlen(pstr);\r\n}\r\n\r\nbool\r\nCiOSMovieWidget::getText(char * pBuf, int maxlen)\r\n{\r\n    const char * pstr = m_pNowPATH;\r\n    int len = strlen(pstr);\r\n    if(len >= maxlen) len = maxlen - 1;\r\n    strncpy(pBuf, pstr, len);\r\n    pBuf[len] = 0;\r\n    return true;\r\n}\r\n\r\nbool\r\nCiOSMovieWidget::setText(const char * string)\r\n{\r\n    int len = strlen(string);\r\n    char * buf = new char [ len + 1 ];\r\n    if(!buf) return false;\r\n\r\n    strcpy(buf, string);    \r\n    if(m_pNowPATH) delete [] m_pNowPATH;\r\n    m_pNowPATH = (const char *)buf;\r\n\r\n    CiOSPathConv& pathconv = CiOSPathConv::getInstance();\r\n    const char * path = pathconv.fullpath(m_pNowPATH);\r\n\r\n    if( path )\r\n    {\r\n        NSString * urlpath = [NSString stringWithUTF8String:path];\r\n        //[@\"file://\" stringByAppendingString:[NSString stringWithUTF8String:path]];\r\n        NSURL * url = [[NSURL alloc] initFileURLWithPath:urlpath];\r\n    \r\n        AVPlayerItem * playerItem = [AVPlayerItem playerItemWithURL:url];\r\n        //AVPlayer * player = [AVPlayer playerWithURL:url];\r\n        AVPlayer * player = [AVPlayer playerWithPlayerItem: playerItem];\r\n        AVPlayerLayer * playerLayer = (AVPlayerLayer *)m_pMovieView.layer;\r\n        playerLayer.player = player;\r\n\r\n    \r\n        [[NSNotificationCenter defaultCenter] addObserver:m_pMovieView selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[player currentItem]];\r\n    \r\n        // 2012.12.11  解放漏れ修正\r\n        if( path ) delete path;\r\n        [url release];\r\n    }\r\n    else\r\n    {\r\n        // Movieファイルが見つからないのでエラー\r\n        return false;\r\n    }\r\n    \r\n    return true;\r\n}\r\n\r\nvoid\r\nCiOSMovieWidget::visible(bool bVisible)\r\n{\r\n    m_pMovieView.hidden = (bVisible) ? NO : YES;    \r\n}\r\n\r\nvoid\r\nCiOSMovieWidget::enable(bool bEnable)\r\n{\r\n}\r\n\r\nvoid\r\nCiOSMovieWidget::set_move(int x, int y, int width, int height)\r\n{\r\n    if(m_type == IWidget::BGMOVIEPLAYER) return;\r\n    float scale = getScale();\r\n    m_pMovieView.frame = CGRectMake(x / scale,\r\n                                    y / scale,\r\n                                    width /scale,\r\n                                    height / scale);\r\n}\r\n\r\nvoid\r\nCiOSMovieWidget::cmd(int cmd, ...)\r\n{\r\n#if 1\r\n    AVPlayerLayer * playerlayer = (AVPlayerLayer *)m_pMovieView.layer;\r\n    AVPlayer * player = playerlayer.player;\r\n#endif\r\n    switch(cmd)\r\n    {\r\n        case MV_STOP:\r\n        {\r\n            [player pause];\r\n        }\r\n            break;\r\n        case MV_PLAY:\r\n        {\r\n            m_status = 0;\r\n            [player seekToTime:kCMTimeZero];\r\n            [player play];\r\n        }\r\n            break;\r\n        case MV_PAUSE:\r\n        {\r\n            [player pause];\r\n        }\r\n            break;\r\n        case MV_RESUME:\r\n        {\r\n            [player play];\r\n        }\r\n            break;\r\n    }\r\n}\r\n\r\nint\r\nCiOSMovieWidget::status()\r\n{\r\n    return m_status;\r\n}\r\n\r\nCiOSMovieWidget *\r\nCiOSMovieWidget::getWidget(void * p)\r\n{\r\n    CiOSMovieWidget * pWidget = ms_begin;\r\n    while(pWidget) {\r\n        AVPlayerLayer * playerlayer = (AVPlayerLayer *)pWidget->m_pMovieView.layer;\r\n        AVPlayer * player = playerlayer.player;\r\n        if([player currentItem] == p) break;\r\n        pWidget = pWidget->m_next;\r\n    }\r\n    return pWidget;\r\n}\r\n\r\nCiOSActivityIndicator   *   CiOSActivityIndicator::ms_begin = 0;\r\nCiOSActivityIndicator   *   CiOSActivityIndicator::ms_end   = 0;\r\n\r\nCiOSActivityIndicator::CiOSActivityIndicator(CiOSPlatform * pParent)\r\n: CiOSWidget(pParent), m_prev(0), m_next(0)\r\n{\r\n    m_prev = ms_end;\r\n    if(m_prev) {\r\n        m_prev->m_next = this;\r\n    } else {\r\n        ms_begin = this;\r\n    }\r\n    ms_end = this;\r\n}\r\n\r\nCiOSActivityIndicator::~CiOSActivityIndicator()\r\n{\r\n    if(m_prev) {\r\n        m_prev->m_next = m_next;\r\n    } else {\r\n        ms_begin = m_next;\r\n    }\r\n    if(m_next) {\r\n        m_next->m_prev = m_prev;\r\n    } else {\r\n        ms_end = m_prev;\r\n    }\r\n    if(m_pActView) {\r\n        [m_pActView removeFromSuperview];\r\n    }\r\n}\r\n\r\nbool\r\nCiOSActivityIndicator::create(CONTROL type, int id,\r\n                       const char *caption, int x, int y, int width, int height)\r\n{\r\n    \r\n    EAGLView * pView = getPlatform().getView();\r\n    \r\n    // キーボードの上につけるViewを生成\r\n    /*\r\n     UIView * accessoryView = [[[UIView alloc] init] autorelease];\r\n     accessoryView.backgroundColor = [UIColor whiteColor];\r\n     UITextField * tmpField = [[[UITextField alloc] init] autorelease];\r\n     //[accessoryView addSubview:tmpField];\r\n     accessoryView.frame = CGRectMake(0.0, 0.0, 960.0, 100);\r\n     [tmpField sizeToFit];\r\n     */\r\n    switch(type)\r\n    {\r\n        default:\r\n            return false;\r\n        case IWidget::ACTIVITYINDICATOR:\r\n            m_pActView = [[[UIActivityIndicatorView alloc] init] autorelease];\r\n            m_pActView.hidesWhenStopped = NO;\r\n            m_pActView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;\r\n            m_size = 21.0f;\r\n            break;\r\n    }\r\n    \r\n    [pView addSubview:m_pActView];\r\n    \r\n    return init(id, x, y, width, height);\r\n}\r\n\r\nvoid\r\nCiOSActivityIndicator::set_move(int x, int y, int width, int height)\r\n{\r\n    float version = [[[UIDevice currentDevice] systemVersion] floatValue];\r\n    float scale = getScale();\r\n    m_pActView.frame = CGRectMake(x / scale,\r\n                                  y / scale,\r\n                                  width /scale,\r\n                                  height / scale);\r\n    if(version >= 5) {\r\n        // iOS 5.0以降\r\n        float base = (m_width > m_height) ? m_height : m_width;\r\n        float ind_scale = base / (scale * m_size);\r\n        if(ind_scale > 0) [m_pActView setTransform:CGAffineTransformMakeScale(ind_scale, ind_scale)];\r\n\r\n        //[m_pActView.layer setValue:[NSNumber numberWithFloat:ind_scale] forKeyPath:@\"transform.scale\"];\r\n    }\r\n}\r\n\r\n\r\nint\r\nCiOSActivityIndicator::getTextLength()\r\n{\r\n    return 0;\r\n}\r\n\r\nbool\r\nCiOSActivityIndicator::getText(char * pBuf, int maxlen)\r\n{\r\n    if(maxlen > 0) *pBuf = 0;  // length 0;\r\n    return true;\r\n}\r\nbool\r\nCiOSActivityIndicator::setText(const char * string)\r\n{\r\n    return false;\r\n}\r\n\r\nvoid\r\nCiOSActivityIndicator::visible(bool bVisible)\r\n{\r\n    m_pActView.hidden = (bVisible) ? NO : YES;\r\n    m_bVisible = bVisible;\r\n}\r\n    \r\nvoid\r\nCiOSActivityIndicator::enable(bool bEnable)\r\n{\r\n}\r\n\r\nvoid\r\nCiOSActivityIndicator::cmd(int cmd, ...)\r\n{\r\n    va_list ap;\r\n    va_start(ap, cmd);\r\n    switch(cmd)\r\n    {\r\n        default: break;\r\n        case ACT_STARTANIM: [m_pActView startAnimating];    break;\r\n        case ACT_STOPANIM:  [m_pActView stopAnimating];     break;\r\n        case ACT_SET_STYLE:\r\n        {\r\n            int style = va_arg(ap, int);\r\n            m_size = 21.0f;\r\n            switch(style)\r\n            {\r\n                case 0:\r\n                {\r\n                    m_pActView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;\r\n                    break;\r\n                }\r\n                case 1:\r\n                {\r\n                    m_pActView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;\r\n                    break;\r\n                }\r\n                case 2:\r\n                {\r\n                    m_pActView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;\r\n                    m_size = 36.0f;\r\n                    break;\r\n                }\r\n            }\r\n            float version = [[[UIDevice currentDevice] systemVersion] floatValue];\r\n            if(version > 5) {\r\n                float scale = getScale();\r\n                float base = (m_width > m_height) ? m_height : m_width;\r\n                float ind_scale = base / (scale * m_size);\r\n                if(ind_scale > 0)[m_pActView setTransform:CGAffineTransformMakeScale(ind_scale, ind_scale)];\r\n                //[m_pActView.layer setValue:[NSNumber numberWithFloat:ind_scale] forKeyPath:@\"transform.scale\"];\r\n            }\r\n            break;\r\n        }\r\n    }\r\n    va_end(ap);\r\n}\r\nint\r\nCiOSActivityIndicator::status()\r\n{\r\n    BOOL isAnim = [m_pActView isAnimating];\r\n    return isAnim ? 1 : 0;\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/CiOSWriteFileStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWriteFileStream.cpp\r\n//\r\n//\r\n#include <fcntl.h>\r\n#include <sys/types.h> \r\n#include <sys/stat.h> \r\n#include <unistd.h>\r\n#include <iostream>\r\n\r\n#include \"CiOSWriteFileStream.h\"\r\n#include \"CiOSReadFileStream.h\"\r\n\r\n\r\nCiOSWriteFileStream::CiOSWriteFileStream(CiOSReadFileStream& rdStream) : m_fd(-1), m_fp(0), m_eStat(CLOSED)\r\n{\r\n    if(rdStream.m_fp && rdStream.m_eStat == IReadStream::NORMAL) {\r\n        fclose(rdStream.m_fp);\r\n        rdStream.m_fp = 0;\r\n        rdStream.m_fd = -1;\r\n    }\r\n    \r\n    if(0 > (m_fd = open(rdStream.m_fullpath, O_CREAT|O_RDWR))) return;\r\n    m_fp = fdopen(m_fd, \"r+b\");\r\n    if(!m_fp) {\r\n        close(m_fd);\r\n        m_fd = -1;\r\n        return;\r\n    }\r\n    rdStream.m_fd = m_fd;\r\n    rdStream.m_fp = m_fp;    \r\n    m_eStat = NORMAL;\r\n}\r\n\r\n// 必ず ReadStream 経由で破棄されるため、こちらではクローズしない\r\nCiOSWriteFileStream::~CiOSWriteFileStream() {}\r\n\r\nIWriteStream::ESTATUS\r\nCiOSWriteFileStream::getStatus()\r\n{\r\n    return m_eStat;\r\n}\r\n\r\ns32\r\nCiOSWriteFileStream::getPosition()\r\n{\r\n    m_eStat = NORMAL;\r\n    return ftell(m_fp);\r\n}\r\n\r\nvoid\r\nCiOSWriteFileStream::writeU8(u8 value)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(EOF == fputc(value, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSWriteFileStream::writeU16(u16 value)\r\n{\r\n    u8 arr[2];\r\n    m_eStat = NORMAL;\r\n    arr[0] = (value >> 8) & 0xff;\r\n    arr[1] = value & 0xff;\r\n    if(1 > fwrite(arr, 2, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSWriteFileStream::writeU32(u32 value)\r\n{\r\n    u8 arr[4];\r\n    m_eStat = NORMAL;\r\n    arr[0] = (value >> 24) & 0xff;\r\n    arr[1] = (value >> 16) & 0xff;\r\n    arr[2] = (value >> 8) & 0xff;\r\n    arr[3] = value & 0xff;\r\n    if(1 > fwrite(arr, 4, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSWriteFileStream::writeFloat(float fval)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(1 > fwrite(&fval, sizeof(float), 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n\r\nvoid\r\nCiOSWriteFileStream::writeBlock(void* buffer, u32 byteSize)\r\n{\r\n    m_eStat = NORMAL;\r\n    if(1 > fwrite(buffer, byteSize, 1, m_fp)) {\r\n        m_eStat = NOT_AVAILABLE;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/EAGLView.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  EAGLView.m\r\n//\r\n//  based on Hello Triangle sample created by Dan Ginsburg on 6/13/09.\r\n//\r\n\r\n#import <QuartzCore/QuartzCore.h>\r\n#import <OpenGLES/EAGLDrawable.h>\r\n#import <AVFoundation/AVFoundation.h>\r\n#import \"EAGLView.h\"\r\n#include <OpenGLES/ES2/gl.h>\r\n\r\n#import \"BaseType.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CiOSPlatform.h\"\r\n#include <sys/time.h>\r\n#include \"CiOSSysResource.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n\r\n// A class extension to declare private methods\r\n@interface EAGLView ()\r\n\r\n@property (nonatomic, retain) EAGLContext *context;\r\n@property (nonatomic, assign) NSTimer *animationTimer;\r\n\r\n- (BOOL) createFramebuffer;\r\n- (void) destroyFramebuffer;\r\n\r\n@end\r\n\r\n\r\n@implementation EAGLView\r\n\r\n@synthesize context;\r\n@synthesize animationTimer;\r\n@synthesize animationInterval;\r\n\r\nstatic float _mainScreenScale = -1.0f;\r\n\r\n// You must implement this method\r\n+ (Class)layerClass {\r\n    return [CAEAGLLayer class];\r\n}\r\n\r\n+ (float)getScaleFactor {\r\n    // 物理サイズを変動させる事は無い作りになっているので、キャッシュしておく\r\n    if (_mainScreenScale < 0.0f) {\r\n        CGFloat scale = 1.0f;\r\n        if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {\r\n            // iPhone/iPod Retinaの場合は従来通りの挙動にする\r\n            scale = [UIScreen mainScreen].scale;\r\n        } else{\r\n            // iPad Retinaモデルでの拡大処理によるGPU負荷を下げるために、xibのサイズ以上はOS制御のアクセラレータに任せる\r\n            // タッチ領域との整合性を取るために、scaleの値を使う各所で同じ処理を行う\r\n            scale = MIN([UIScreen mainScreen].scale, 1.0);\r\n        }\r\n        _mainScreenScale = (float)scale;\r\n    }\r\n\r\n    return _mainScreenScale;\r\n}\r\n\r\n//The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:\r\n- (id)initWithCoder:(NSCoder*)coder {\r\n    \r\n    if ((self = [super initWithCoder:coder])) {\r\n        // Get the layer\r\n        CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;\r\n\r\n        eaglLayer.contentsScale = [EAGLView getScaleFactor];\r\n\r\n        eaglLayer.opaque = IS_OPAQUE_VIEW;\r\n        eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:\r\n                                        [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking,\r\n                                        kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];\r\n#ifdef OPENGL2\r\n        context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];\r\n#else\r\n        context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];\r\n#endif\r\n        if([context API] == kEAGLRenderingAPIOpenGLES2) {\r\n            NSLog(@\"API OpenGL ES 2.0\");\r\n        } else {\r\n            NSLog(@\"API OpenGL ES 1.1\");\r\n        }\r\n        if (!context || ![EAGLContext setCurrentContext:context]) {\r\n            [self release];\r\n            return nil;\r\n        }\r\n        \r\n        self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.0];\r\n        self.multipleTouchEnabled = YES;\r\n        self.userInteractionEnabled = YES;\r\n        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];\r\n        [[NSNotificationCenter defaultCenter] addObserver:self\r\n                                                 selector:@selector(onRotation:)\r\n                                                     name:UIDeviceOrientationDidChangeNotification\r\n                                                   object:nil];    \r\n\r\n        [[NSNotificationCenter defaultCenter] addObserver:self\r\n                                                 selector:@selector(keyboardDidShow:)\r\n                                                     name:UIKeyboardWillShowNotification\r\n                                                   object:nil];\r\n\r\n        [[NSNotificationCenter defaultCenter] addObserver:self\r\n                                                 selector:@selector(keyboardDidHide:)\r\n                                                     name:UIKeyboardWillHideNotification \r\n                                                   object:nil];\r\n        self.animationInterval = 1.0 / 60.0;\r\n        isInitiated = false;\r\n        {\r\n            struct timeval tv;\r\n            gettimeofday(&tv, NULL);\r\n            timePrev = tv.tv_sec * 1000 + tv.tv_usec / 1000;\r\n        }\r\n        for(int i = 0; i < CKLBTouchEventUIMgr::MAX_TOUCH_POINT; i++) {\r\n            pTouch[i] = 0;\r\n        }\r\n#if ( DEBUG == 1 )\r\n        for(int i = 0; i < FPS_AVERAGE; i++) {\r\n            fpsArray[i] = timePrev;\r\n        }\r\n        fpsCnt = 0;\r\n#endif\r\n\t\ttouch_alloc_cursor = 0;\r\n    }\r\n    return self;\r\n}\r\n\r\n- (void)onRotation:(NSNotification *)notification {\r\n    UIDeviceOrientation orientation = [[notification object] orientation];\r\n    if (orientation == UIDeviceOrientationLandscapeLeft) {\r\n        \r\n    }\r\n    else if (orientation == UIDeviceOrientationLandscapeRight) {\r\n        \r\n    }\r\n    else if (orientation == UIDeviceOrientationPortrait) {\r\n        \r\n    }\r\n    orientation = UIDeviceOrientationLandscapeLeft;\r\n}\r\n\r\n- (void)drawView {    \r\n    [EAGLContext setCurrentContext:context];\r\n    glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer);\r\n\r\n//    if(bContinue) {\r\n        // frame の更新を呼び出す\r\n        {\r\n            struct timeval tv;\r\n            gettimeofday(&tv, NULL);\r\n            timeInt = tv.tv_sec * 1000 + tv.tv_usec / 1000;\r\n        }\r\n        int deltaT = (timePrev) ? (timeInt - timePrev) : 1 ;   // 前回フレームからの経過時間\r\n        timePrev = timeInt;\r\n\r\n        // glViewport(0, 0, self.frame.size.width, self.frame.size.height);\r\n        // プラットフォームインタフェースのreferenceを取得\r\n        bContinue = (Boolean)CPFInterface::getInstance().client().frameFlip(deltaT);\r\n    \r\n        // サウンドの毎フレーム処理\r\n        CiOSAudioManager::GetInstance().Exec();\r\n //   }\r\n    \r\n#if ( DEBUG == 1 )\r\n    fpsArray[fpsCnt] = 1000.0 / deltaT;\r\n    fpsCnt++;\r\n    if( fpsCnt >= FPS_AVERAGE )\r\n    {\r\n        NSTimeInterval sum = 0.0;\r\n        for(int i = 0; i < FPS_AVERAGE; i++) {\r\n            sum += fpsArray[i];\r\n        }\r\n        sum = sum / FPS_AVERAGE;\r\n//        NSLog(@\"FPS:(%f)\", sum);\r\n        fpsCnt = 0;\r\n    }\r\n#endif\r\n    \r\n    glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);\r\n    [context presentRenderbuffer:GL_RENDERBUFFER];\r\n}\r\n\r\n\r\n- (void)layoutSubviews {\r\n    [EAGLContext setCurrentContext:context];\r\n    [self destroyFramebuffer];\r\n    [self createFramebuffer];\r\n//    [self Init];    // iOS ではフレームバッファ等を作った後でなければシェーダの作成に失敗するらしい。\r\n    \r\n    NSBundle* mainBundle;\r\n    mainBundle = [NSBundle mainBundle];\r\n    \r\n    if(!isInitiated) {\r\n        CiOSSysResource& sysRes = CiOSSysResource::getInstance();\r\n        sysRes.requestDevID();\r\n        \r\n        // ゲーム初期化シーケンス\r\n        // 起動関数を呼ぶ前に、インタフェースにStrategyを登録する必要がある。\r\n        CiOSPlatform * pPlatform = new CiOSPlatform(viewCtrl, self, [EAGLView getScaleFactor]);\r\n        CPFInterface& pfif = CPFInterface::getInstance();\r\n        pfif.setPlatformRequest(pPlatform);\r\n        \r\n        // サウンド関係の初期化\r\n        CiOSAudioManager::GetInstance().Initialize();\r\n    \r\n        // 起動関数を呼ぶ\r\n        GameSetup();    // ゲーム起動関数。この中で CPFStrategy インスタンスの生成と登録を行う。\r\n        pfif.client().setScreenInfo(false, backingWidth, backingHeight);\r\n        pfif.client().setFilePath(/* mainBundle.bundlePath.UTF8String */ 0);      // CGame由来\r\n        pfif.client().initGame();\r\n        \r\n        // FPS設定\r\n//        NSTimeInterval fps = pfif.client().getFrameTime() / 1000.0f;\r\n//        [self setAnimationInterval:fps];\r\n        \r\n        isInitiated = true;\r\n        bContinue = TRUE;\r\n    }\r\n    [self drawView];\r\n}\r\n\r\n\r\n- (BOOL)createFramebuffer {\r\n    \r\n    glGenFramebuffers(1, &viewFramebuffer);\r\n    glGenRenderbuffers(1, &viewRenderbuffer);\r\n    \r\n    glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer);\r\n    glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);\r\n    [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)self.layer];\r\n    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, viewRenderbuffer);\r\n    \r\n    glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &backingWidth);\r\n    glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &backingHeight);\r\n    \r\n    if (USE_DEPTH_BUFFER) {\r\n        glGenRenderbuffers(1, &depthRenderbuffer);\r\n        glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);\r\n        glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, backingWidth, backingHeight);\r\n        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);\r\n    }\r\n    \r\n    if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {\r\n        NSLog(@\"failed to make complete framebuffer object %x\", glCheckFramebufferStatus(GL_FRAMEBUFFER));\r\n        return NO;\r\n    }\r\n\r\n    return YES;\r\n}\r\n\r\n\r\n- (void)destroyFramebuffer {\r\n    \r\n    glDeleteFramebuffers(1, &viewFramebuffer);\r\n    viewFramebuffer = 0;\r\n    glDeleteRenderbuffers(1, &viewRenderbuffer);\r\n    viewRenderbuffer = 0;\r\n    \r\n    if(depthRenderbuffer) {\r\n        glDeleteRenderbuffers(1, &depthRenderbuffer);\r\n        depthRenderbuffer = 0;\r\n    }\r\n}\r\n\r\n- (int) getTouchID:(UITouch *)touch :(Boolean)is_alloc {\r\n    int i;\r\n\tif (touch) {\r\n\t\t// 既に割りてられていたら、そのIDを返す\r\n\t\tfor(i = 0; i < CKLBTouchEventUIMgr::MAX_TOUCH_POINT; i++) {\r\n\t\t\tif(pTouch[i] == touch) return i;\r\n\t\t}\r\n\t\tif(is_alloc) {\r\n\t\t\t// 割り当てられていなければ、開いている場所のIDを返す\r\n\t\t\tfor(i = 0; i < CKLBTouchEventUIMgr::MAX_TOUCH_POINT; i++) {\r\n\t\t\t\tint cursor = (i + touch_alloc_cursor) % CKLBTouchEventUIMgr::MAX_TOUCH_POINT;\r\n\t\t\t\tif (pTouch[cursor] == 0) {\r\n\t\t\t\t\ttouch_alloc_cursor = (cursor + 1) % CKLBTouchEventUIMgr::MAX_TOUCH_POINT;\r\n\t\t\t\t\treturn cursor;\r\n\t\t\t\t}\r\n            }\r\n        }\r\n    }\r\n    // 割当に失敗\r\n    return -1;\r\n}\r\n\r\n- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    // use just first instance\r\n    for (UITouch *touch in touches) {\r\n        unsigned int id = [self getTouchID:touch:true];\r\n\t\t// 割当不可能な場合は無視 ( < 0 || >= MaxTouch with unsigned)\r\n        if(id >= CKLBTouchEventUIMgr::MAX_TOUCH_POINT)\r\n        {\r\n            CPFInterface::getInstance().platform().logging(\"!!! touchesBegan : i>=MAX_TOUCH\");\r\n            continue;\r\n        }\r\n        pTouch[id] = touch;\r\n        CGPoint location = [touch locationInView:self];\r\n        CPFInterface::getInstance().client().inputPoint(id, IClientRequest::I_CLICK,\r\n\t\t\tlocation.x * [EAGLView getScaleFactor],\r\n\t\t\tlocation.y * [EAGLView getScaleFactor]);\r\n    }\r\n}\r\n\r\n- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    // use just first instance\r\n    for (UITouch *touch in touches) {\r\n        unsigned int id = [self getTouchID:touch:false];\r\n\t\t// 割当不可能な場合は無視 ( < 0 || >= MaxTouch with unsigned)\r\n        if(id >= CKLBTouchEventUIMgr::MAX_TOUCH_POINT)\r\n        {\r\n            CPFInterface::getInstance().platform().logging(\"!!! touchesMoved : i>=MAX_TOUCH\");\r\n            continue;\r\n        }\r\n        CGPoint location = [touch locationInView:self];\r\n\t\tCPFInterface::getInstance().client().inputPoint(id, IClientRequest::I_DRAG,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.x * [EAGLView getScaleFactor],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.y * [EAGLView getScaleFactor]);\r\n    }\r\n}\r\n\r\n- (void)releaseTouch:(unsigned int)id :(const char *)caller\r\n{\r\n\tif(id >= CKLBTouchEventUIMgr::MAX_TOUCH_POINT) {\r\n\t\tCPFInterface::getInstance().platform().logging(\"!!! %s : (i=%du)>=MAX_TOUCH \", caller, id);\r\n\t\treturn;\r\n\t}\r\n\r\n\tUITouch * touch = pTouch[id];\r\n\r\n\tif(!touch) return;\r\n\r\n\tCGPoint location = [touch locationInView:self];\r\n\r\n\tCPFInterface::getInstance().client().inputPoint(id, IClientRequest::I_RELEASE,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.x * [EAGLView getScaleFactor],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.y * [EAGLView getScaleFactor]);\r\n\tpTouch[id] = 0;\r\n}\r\n\r\n- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    for (UITouch *touch in touches) {\r\n        unsigned int id = [self getTouchID:touch:false];\r\n\t\t[self releaseTouch:id:\"touchesEnded\"];\r\n    }\r\n}\r\n\r\n- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    for (UITouch *touch in touches) {\r\n        unsigned int id = [self getTouchID:touch:false];\r\n\t\t[self releaseTouch:id:\"touchesCancelled\"];\r\n    }\r\n}\r\n\r\n- (void)clearUITouches {\r\n\t// 全てのタッチがキャンセルされたことをクライアントに通知する\r\n\t// lua側がタッチIDのステートをハンドリングしてる場合、ここで通知しないと浮いてしまうため\r\n\tfor(int i = 0; i < CKLBTouchEventUIMgr::MAX_TOUCH_POINT; i++) {\r\n\t\tif (pTouch[i] != 0) {\r\n\t\t\t[self releaseTouch:i:\"clearUiTouches\"];\r\n\t\t}\r\n\t}\r\n    memset(pTouch,\r\n           0,\r\n           sizeof(UITouch*) * CKLBTouchEventUIMgr::MAX_TOUCH_POINT);\r\n}\r\n\r\n- (void)startAnimation {\r\n    \r\n    self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];\r\n}\r\n\r\n\r\n- (void)stopAnimation {\r\n    self.animationTimer = nil;\r\n}\r\n\r\n\r\n- (void)setAnimationTimer:(NSTimer *)newTimer {\r\n    [animationTimer invalidate];\r\n    animationTimer = newTimer;\r\n}\r\n\r\n\r\n- (void)setAnimationInterval:(NSTimeInterval)interval {\r\n    \r\n    animationInterval = interval;\r\n    if (animationTimer) {\r\n        [self stopAnimation];\r\n        [self startAnimation];\r\n    }\r\n}\r\n\r\n\r\n- (void)dealloc {\r\n    \r\n    [self stopAnimation];\r\n    \r\n    CPFInterface::getInstance().client().finishGame();\r\n    \r\n    // サウンド関係の終了\r\n    CiOSAudioManager::GetInstance().Termination();\r\n    \r\n    if ([EAGLContext currentContext] == context) {\r\n        [EAGLContext setCurrentContext:nil];\r\n    }\r\n    \r\n    [context release];  \r\n    [super dealloc];\r\n}\r\n\r\n// WebViewによるロードが失敗した\r\n- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {\r\n    \r\n    CPFInterface::getInstance().platform().logging(\">>>>>>>>> [web view] didFailLoadWithError %@\", error);\r\n    \r\n    // URL更新がキャンセルされた際にもエラーとなる...なのでキャンセルはエラーとせずスルーするように変更 2013.3.8\r\n    if( [error code] == NSURLErrorCancelled ) return;\r\n    \r\n    // 対象となるWidgetを検索する\r\n    CiOSWebWidget * pWidget = CiOSWebWidget::searchWidget(webView);\r\n    // native call の処理を記述。\r\n    CPFInterface::getInstance().client().controlEvent(IClientRequest::E_FAILEDLOADWEB, pWidget, 0, 0, 0, 0);\r\n}\r\n\r\n// WebViewによるロードが開始された\r\n- (void)webViewDidStartLoad:(UIWebView*)webView {\r\n    // 対象となるWidgetを検索する\r\n    CiOSWebWidget * pWidget = CiOSWebWidget::searchWidget(webView);\r\n    // native call の処理を記述。\r\n    CPFInterface::getInstance().client().controlEvent(IClientRequest::E_DIDSTARTLOADWEB, pWidget, 0, 0, 0, 0);\r\n    CPFInterface::getInstance().platform().logging(\">>>>>>>>> [web view] webViewDidStartLoad\");\r\n}\r\n\r\n// WebViewによるロードが終わった\r\n- (void)webViewDidFinishLoad:(UIWebView*)webView {\r\n    // 対象となるWidgetを検索する\r\n    CiOSWebWidget * pWidget = CiOSWebWidget::searchWidget(webView);\r\n    // native call の処理を記述。\r\n    CPFInterface::getInstance().client().controlEvent(IClientRequest::E_DIDLOADENDWEB, pWidget, 0, 0, 0, 0);\r\n    CPFInterface::getInstance().platform().logging(\">>>>>>>>> [web view] webViewDidFinishLoad\");\r\n}\r\n\r\n- (BOOL)webView:(UIWebView *)webView\r\n        shouldStartLoadWithRequest:(NSURLRequest *)request\r\n        navigationType:(UIWebViewNavigationType)navigationType {\r\n    // ページ内遷移でカスタムヘッダが削られる事があるので、\r\n    // 無い場合は付け足して投げ直す\r\n    // 出展: http://www.nomadplanet.fr/2010/09/custom-http-headers-for-every-request-made-in-uiwebviews/\r\n    if ([webView respondsToSelector:@selector(hasCustomHeaders:)] &&\r\n        ![webView hasCustomHeaders:request]) {\r\n        \r\n        [webView loadRequest:request];\r\n        return NO;\r\n    }\r\n\r\n    // 対象となるWidgetを検索する\r\n    CiOSWebWidget * pWidget = CiOSWebWidget::searchWidget(webView);\r\n    NSString * requestString = [[request URL] absoluteString];\r\n\r\n    if([requestString rangeOfString:@\"native://\"].location == NSNotFound) {\r\n        // 通常の遷移の場合\r\n        bool ret = (pWidget->getJump()) ? YES : NO;\r\n        //pWidget->setFirst(); // 初回シグナルとジャンプフラグを見てるけど初回シグナルそもそも見る必要ない？\r\n        if( ret==YES )\r\n        {\r\n            // linkへ飛ぶ時にloadRequestをしてやる必要がある\r\n            if(navigationType == UIWebViewNavigationTypeLinkClicked)\r\n            {\r\n                [webView loadRequest:request];\r\n            }\r\n        }\r\n        return ret;\r\n    }\r\n\r\n    // 要求された request String を、Widget の TmpString として記録する\r\n    const char * keyString = [requestString UTF8String];\r\n    pWidget->setTmpString(keyString + strlen(\"native://\"));\r\n    \r\n    // native call の処理を記述。\r\n    CPFInterface::getInstance().client().controlEvent(IClientRequest::E_URLJUMP, pWidget, 0, 0, 0, 0);\r\n\r\n    // native call の時は遷移先が無いので NO を返す\r\n    return NO;\r\n}\r\n\r\n- (void)setTimePrev:(CFTimeInterval)value\r\n{\r\n    timePrev = value;\r\n}\r\n\r\n- (void)setViewController:(UIViewController<UIAlertViewDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver> *)viewController {\r\n    viewCtrl = viewController;\r\n}\r\n\r\n- (void)textTouchDown:(id)sender {\r\n    UITextField *theField = (UITextField *)sender;\r\n    CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetField(theField);\r\n    if(pWidget) pWidget->setTouch(true);    // TouchDown\r\n    \r\n    UITextView *theView = (UITextView *)sender;\r\n    pWidget = CiOSTextWidget::searchWidgetView(theView);\r\n    if(pWidget) pWidget->setTouch(true);    // TouchDown\r\n}\r\n\r\n- (void)textTouchUp:(id)sender {\r\n    UITextField *theField = (UITextField *)sender;\r\n    CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetField(theField);\r\n    if(pWidget) pWidget->setTouch(false);    // TouchUp\r\n    \r\n    UITextView *theView = (UITextView *)sender;\r\n    pWidget = CiOSTextWidget::searchWidgetView(theView);\r\n    if(pWidget) pWidget->setTouch(false);    // TouchUp\r\n}\r\n\r\n// テキストフィールドを編集する直後に呼ばれる\r\n- (void)textFieldDidBeginEditing:(UITextField *)textField {\r\n    targetTextField = textField;\r\n}\r\n\r\n// テキストフィールドが編集終了する直後に呼ばれる\r\n- (void)textFieldDidEndEditing:(UITextField *)textField {\r\n    CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetField(textField);\r\n    CiOSTextWidget::setAllVisible(true);\r\n    if(pWidget) {\r\n        textField.font = pWidget->getFont();\r\n        pWidget->size_recovery();\r\n    }\r\n    targetTextField = nil;\r\n}\r\n\r\n- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {\r\n    CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetField(textField);\r\n    int maxlen = pWidget->getMax();\r\n    NSMutableString * text = [[ textField.text mutableCopy] autorelease];\r\n    [text replaceCharactersInRange:range withString:string];\r\n    const char * utf8string = [string UTF8String];\r\n\r\n    // 基本的に7bitASCIIは常に許可するが、IWidget::TXCH_UTF8が0の場合は最上位bitが1の文字が含まれていないことをチェックする\r\n    int chartype = pWidget->getCharType();\r\n    if(!(chartype & IWidget::TXCH_UTF8)) {\r\n        for (const char * ptr = utf8string; *ptr; ptr++) {\r\n            if(*ptr & 0x80) return NO;\r\n        }\r\n    }\r\n   \r\n    return (!maxlen) || ([text length] <= maxlen);\r\n}\r\n\r\n// textfieldでdoneが入力されたらキーボードを終了\r\n- (BOOL)textFieldShouldReturn:(UITextField *)textField {\r\n    [textField resignFirstResponder];\r\n    return YES;\r\n}\r\n\r\n// 編集終了時に呼ばれる\r\n- (void)textViewDidEndEditing: (UITextView*) textView {\r\n    // pause解除\r\n    CPFInterface::getInstance().client().pauseGame(false);\r\n}\r\n\r\n// テキストビューを編集する直後に呼ばれれる\r\n-(BOOL)textViewShouldBeginEditing:(UITextView*)textView {\r\n    targetTextView = textView;\r\n    return YES;\r\n}\r\n\r\n// テキストビューが編集終了する直後に呼ばれる\r\n-(BOOL)textViewShouldEndEditing:(UITextView*)textView {\r\n    CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetView(textView);\r\n    CiOSTextWidget::setAllVisible(true);\r\n    if(pWidget) {\r\n        //textView.font = pWidget->getFont();\r\n        const char * c_fontname = pWidget->getFontName();\r\n        NSString * fontname = (c_fontname) ? [[NSString alloc] initWithUTF8String:c_fontname] : nil;\r\n        if(targetTextField)\r\n        {\r\n            if( pWidget->getFont() ) {\r\n                targetTextField.font = pWidget->getFont();\r\n            } else {\r\n                targetTextField.font = (fontname) ? [UIFont fontWithName:fontname size:16] : [UIFont systemFontOfSize:16];\r\n            }\r\n        }\r\n        else if( targetTextView )\r\n        {\r\n            if( pWidget->getFont() ) {\r\n                targetTextView.font = pWidget->getFont();\r\n            } else {\r\n                targetTextView.font = (fontname) ? [UIFont fontWithName:fontname size:16] : [UIFont systemFontOfSize:16];\r\n            }\r\n        }\r\n        pWidget->size_recovery();\r\n    }\r\n    targetTextView = nil;\r\n    return YES;\r\n}\r\n\r\n- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {\r\n    CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetView(textView);\r\n    int maxlen = pWidget->getMax();\r\n    NSMutableString * string = [[ textView.text mutableCopy] autorelease];\r\n    [string replaceCharactersInRange:range withString:text];\r\n    const char * utf8string = [text UTF8String];\r\n    \r\n    // 基本的に7bitASCIIは常に許可するが、IWidget::TXCH_UTF8が0の場合は最上位bitが1の文字が含まれていないことをチェックする\r\n    int chartype = pWidget->getCharType();\r\n    if(!(chartype & IWidget::TXCH_UTF8)) {\r\n        for (const char * ptr = utf8string; *ptr; ptr++) {\r\n            if(*ptr & 0x80) return NO;\r\n        }\r\n    }\r\n    \r\n    // textviewで改行コードが入力された場合はキーボードを終了\r\n    if ([text isEqualToString:@\"\\n\"]) {\r\n        [textView resignFirstResponder];\r\n        return NO;\r\n    }\r\n    \r\n    return (!maxlen) || ([string length] <= maxlen);\r\n}\r\n\r\n// 編集終了時に呼ばれる\r\n// サードパーティがTextViewのdelegateを再登録した場合はtextViewDidEndEditingが呼ばれない事があるので、\r\n// 通知センターでもポーズを解除する。\r\n- (void)keyboardDidHide:(NSNotification*)note {\r\n    CPFInterface::getInstance().client().pauseGame(false);\r\n}\r\n\r\n- (void)keyboardDidShow:(NSNotification*)note {\r\n    // pause開始\r\n    CPFInterface::getInstance().client().pauseGame(true);\r\n    keyboardFrameEnd = [[note.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];\r\n    if(targetTextField)\r\n    {\r\n        // テキストフィールドの場合\r\n        CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetField(targetTextField);\r\n        CiOSTextWidget::setAllVisible(false);\r\n        targetTextField.hidden = NO;\r\n\r\n        float scale = [EAGLView getScaleFactor];\r\n        const char * c_fontname = pWidget->getFontName();\r\n        NSString * fontname = (c_fontname) ? [[NSString alloc] initWithUTF8String:c_fontname] : nil;\r\n        targetTextField.font = (fontname) ? [UIFont fontWithName:fontname size:32] : [UIFont systemFontOfSize:32];\r\n        // 本来なら回転をみるべきだが・・・キーボードって画面の半部以上占領しないはず(あくまではず)なのでちっちゃい方を画面サイズから引く\r\n        CGFloat min = (keyboardFrameEnd.size.width > keyboardFrameEnd.size.height) ? keyboardFrameEnd.size.height : keyboardFrameEnd.size.width;\r\n        targetTextField.frame = CGRectMake(0,\r\n                                           0,\r\n                                           (backingWidth / scale),\r\n                                           (backingHeight / scale) - min);\r\n    }\r\n    else if(targetTextView)\r\n    {\r\n        // テキストビューの場合\r\n        CiOSTextWidget * pWidget = CiOSTextWidget::searchWidgetView(targetTextView);\r\n        CiOSTextWidget::setAllVisible(false);\r\n        targetTextView.hidden = NO;\r\n        \r\n        float scale = [EAGLView getScaleFactor];\r\n        const char * c_fontname = pWidget->getFontName();\r\n        NSString * fontname = (c_fontname) ? [[NSString alloc] initWithUTF8String:c_fontname] : nil;\r\n        targetTextView.font = (fontname) ? [UIFont fontWithName:fontname size:32] : [UIFont systemFontOfSize:32];\r\n        // 本来なら回転をみるべきだが・・・キーボードって画面の半部以上占領しないはず(あくまではず)なのでちっちゃい方を画面サイズから引く\r\n        CGFloat min = (keyboardFrameEnd.size.width > keyboardFrameEnd.size.height) ? keyboardFrameEnd.size.height : keyboardFrameEnd.size.width;\r\n        targetTextView.frame = CGRectMake(0,\r\n                                          0,\r\n                                          (backingWidth / scale),\r\n                                          (backingHeight / scale) - min);\r\n    }\r\n}\r\n\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/NSData+Base64.m",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  NSData+Base64.m\r\n//  base64\r\n//\r\n//  Created by Matt Gallagher on 2009/06/03.\r\n//  Copyright 2009 Matt Gallagher. All rights reserved.\r\n//\r\n//  This software is provided 'as-is', without any express or implied\r\n//  warranty. In no event will the authors be held liable for any damages\r\n//  arising from the use of this software. Permission is granted to anyone to\r\n//  use this software for any purpose, including commercial applications, and to\r\n//  alter it and redistribute it freely, subject to the following restrictions:\r\n//\r\n//  1. The origin of this software must not be misrepresented; you must not\r\n//     claim that you wrote the original software. If you use this software\r\n//     in a product, an acknowledgment in the product documentation would be\r\n//     appreciated but is not required.\r\n//  2. Altered source versions must be plainly marked as such, and must not be\r\n//     misrepresented as being the original software.\r\n//  3. This notice may not be removed or altered from any source\r\n//     distribution.\r\n//\r\n\r\n#import \"NSData+Base64.h\"\r\n\r\n//\r\n// Mapping from 6 bit pattern to ASCII character.\r\n//\r\nstatic unsigned char base64EncodeLookup[65] =\r\n\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n\r\n//\r\n// Definition for \"masked-out\" areas of the base64DecodeLookup mapping\r\n//\r\n#define xx 65\r\n\r\n//\r\n// Mapping from ASCII character to 6 bit pattern.\r\n//\r\nstatic unsigned char base64DecodeLookup[256] =\r\n{\r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63, \r\n    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx, \r\n    xx,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, \r\n    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx, \r\n    xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, \r\n    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, \r\n};\r\n\r\n//\r\n// Fundamental sizes of the binary and base64 encode/decode units in bytes\r\n//\r\n#define BINARY_UNIT_SIZE 3\r\n#define BASE64_UNIT_SIZE 4\r\n\r\n//\r\n// NewBase64Decode\r\n//\r\n// Decodes the base64 ASCII string in the inputBuffer to a newly malloced\r\n// output buffer.\r\n//\r\n//  inputBuffer - the source ASCII string for the decode\r\n//\tlength - the length of the string or -1 (to specify strlen should be used)\r\n//\toutputLength - if not-NULL, on output will contain the decoded length\r\n//\r\n// returns the decoded buffer. Must be free'd by caller. Length is given by\r\n//\toutputLength.\r\n//\r\nvoid *NewBase64Decode(\r\n\tconst char *inputBuffer,\r\n\tsize_t length,\r\n\tsize_t *outputLength)\r\n{\r\n\tif (length == -1)\r\n\t{\r\n\t\tlength = strlen(inputBuffer);\r\n\t}\r\n\t\r\n\tsize_t outputBufferSize =\r\n\t\t((length+BASE64_UNIT_SIZE-1) / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE;\r\n\tunsigned char *outputBuffer = (unsigned char *)malloc(outputBufferSize);\r\n\t\r\n\tsize_t i = 0;\r\n\tsize_t j = 0;\r\n\twhile (i < length)\r\n\t{\r\n\t\t//\r\n\t\t// Accumulate 4 valid characters (ignore everything else)\r\n\t\t//\r\n\t\tunsigned char accumulated[BASE64_UNIT_SIZE];\r\n\t\tsize_t accumulateIndex = 0;\r\n\t\twhile (i < length)\r\n\t\t{\r\n\t\t\tunsigned char decode = base64DecodeLookup[inputBuffer[i++]];\r\n\t\t\tif (decode != xx)\r\n\t\t\t{\r\n\t\t\t\taccumulated[accumulateIndex] = decode;\r\n\t\t\t\taccumulateIndex++;\r\n\t\t\t\t\r\n\t\t\t\tif (accumulateIndex == BASE64_UNIT_SIZE)\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\t// Store the 6 bits from each of the 4 characters as 3 bytes\r\n\t\t//\r\n\t\t// (Uses improved bounds checking suggested by Alexandre Colucci)\r\n\t\t//\r\n\t\tif(accumulateIndex >= 2)  \r\n\t\t\toutputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4);  \r\n\t\tif(accumulateIndex >= 3)  \r\n\t\t\toutputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2);  \r\n\t\tif(accumulateIndex >= 4)  \r\n\t\t\toutputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3];\r\n\t\tj += accumulateIndex - 1;\r\n\t}\r\n\t\r\n\tif (outputLength)\r\n\t{\r\n\t\t*outputLength = j;\r\n\t}\r\n\treturn outputBuffer;\r\n}\r\n\r\n//\r\n// NewBase64Encode\r\n//\r\n// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced\r\n// output buffer.\r\n//\r\n//  inputBuffer - the source data for the encode\r\n//\tlength - the length of the input in bytes\r\n//  separateLines - if zero, no CR/LF characters will be added. Otherwise\r\n//\t\ta CR/LF pair will be added every 64 encoded chars.\r\n//\toutputLength - if not-NULL, on output will contain the encoded length\r\n//\t\t(not including terminating 0 char)\r\n//\r\n// returns the encoded buffer. Must be free'd by caller. Length is given by\r\n//\toutputLength.\r\n//\r\nchar *NewBase64Encode(\r\n\tconst void *buffer,\r\n\tsize_t length,\r\n\tbool separateLines,\r\n\tsize_t *outputLength)\r\n{\r\n\tconst unsigned char *inputBuffer = (const unsigned char *)buffer;\r\n\t\r\n\t#define MAX_NUM_PADDING_CHARS 2\r\n\t#define OUTPUT_LINE_LENGTH 64\r\n\t#define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE)\r\n\t#define CR_LF_SIZE 2\r\n\t\r\n\t//\r\n\t// Byte accurate calculation of final buffer size\r\n\t//\r\n\tsize_t outputBufferSize =\r\n\t\t\t((length / BINARY_UNIT_SIZE)\r\n\t\t\t\t+ ((length % BINARY_UNIT_SIZE) ? 1 : 0))\r\n\t\t\t\t\t* BASE64_UNIT_SIZE;\r\n\tif (separateLines)\r\n\t{\r\n\t\toutputBufferSize +=\r\n\t\t\t(outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE;\r\n\t}\r\n\t\r\n\t//\r\n\t// Include space for a terminating zero\r\n\t//\r\n\toutputBufferSize += 1;\r\n\r\n\t//\r\n\t// Allocate the output buffer\r\n\t//\r\n\tchar *outputBuffer = (char *)malloc(outputBufferSize);\r\n\tif (!outputBuffer)\r\n\t{\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\tsize_t i = 0;\r\n\tsize_t j = 0;\r\n\tconst size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length;\r\n\tsize_t lineEnd = lineLength;\r\n\t\r\n\twhile (true)\r\n\t{\r\n\t\tif (lineEnd > length)\r\n\t\t{\r\n\t\t\tlineEnd = length;\r\n\t\t}\r\n\r\n\t\tfor (; i + BINARY_UNIT_SIZE - 1 < lineEnd; i += BINARY_UNIT_SIZE)\r\n\t\t{\r\n\t\t\t//\r\n\t\t\t// Inner loop: turn 48 bytes into 64 base64 characters\r\n\t\t\t//\r\n\t\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];\r\n\t\t\toutputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4)\r\n\t\t\t\t| ((inputBuffer[i + 1] & 0xF0) >> 4)];\r\n\t\t\toutputBuffer[j++] = base64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2)\r\n\t\t\t\t| ((inputBuffer[i + 2] & 0xC0) >> 6)];\r\n\t\t\toutputBuffer[j++] = base64EncodeLookup[inputBuffer[i + 2] & 0x3F];\r\n\t\t}\r\n\t\t\r\n\t\tif (lineEnd == length)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\t// Add the newline\r\n\t\t//\r\n\t\toutputBuffer[j++] = '\\r';\r\n\t\toutputBuffer[j++] = '\\n';\r\n\t\tlineEnd += lineLength;\r\n\t}\r\n\t\r\n\tif (i + 1 < length)\r\n\t{\r\n\t\t//\r\n\t\t// Handle the single '=' case\r\n\t\t//\r\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];\r\n\t\toutputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4)\r\n\t\t\t| ((inputBuffer[i + 1] & 0xF0) >> 4)];\r\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2];\r\n\t\toutputBuffer[j++] =\t'=';\r\n\t}\r\n\telse if (i < length)\r\n\t{\r\n\t\t//\r\n\t\t// Handle the double '=' case\r\n\t\t//\r\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];\r\n\t\toutputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0x03) << 4];\r\n\t\toutputBuffer[j++] = '=';\r\n\t\toutputBuffer[j++] = '=';\r\n\t}\r\n\toutputBuffer[j] = 0;\r\n\t\r\n\t//\r\n\t// Set the output length and return the buffer\r\n\t//\r\n\tif (outputLength)\r\n\t{\r\n\t\t*outputLength = j;\r\n\t}\r\n\treturn outputBuffer;\r\n}\r\n\r\n@implementation NSData (Base64)\r\n\r\n//\r\n// dataFromBase64String:\r\n//\r\n// Creates an NSData object containing the base64 decoded representation of\r\n// the base64 string 'aString'\r\n//\r\n// Parameters:\r\n//    aString - the base64 string to decode\r\n//\r\n// returns the autoreleased NSData representation of the base64 string\r\n//\r\n+ (NSData *)dataFromBase64String:(NSString *)aString\r\n{\r\n\tNSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding];\r\n\tsize_t outputLength;\r\n\tvoid *outputBuffer = NewBase64Decode([data bytes], [data length], &outputLength);\r\n\tNSData *result = [NSData dataWithBytes:outputBuffer length:outputLength];\r\n\tfree(outputBuffer);\r\n\treturn result;\r\n}\r\n\r\n//\r\n// base64EncodedString\r\n//\r\n// Creates an NSString object that contains the base 64 encoding of the\r\n// receiver's data. Lines are broken at 64 characters long.\r\n//\r\n// returns an autoreleased NSString being the base 64 representation of the\r\n//\treceiver.\r\n//\r\n- (NSString *)base64EncodedString\r\n{\r\n\tsize_t outputLength;\r\n\tchar *outputBuffer =\r\n\t\tNewBase64Encode([self bytes], [self length], true, &outputLength);\r\n\t\r\n\tNSString *result =\r\n\t\t[[[NSString alloc]\r\n\t\t\tinitWithBytes:outputBuffer\r\n\t\t\tlength:outputLength\r\n\t\t\tencoding:NSASCIIStringEncoding]\r\n\t\tautorelease];\r\n\tfree(outputBuffer);\r\n\treturn result;\r\n}\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/ViewController.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  ViewController.m\r\n//  GameEngine\r\n//\r\n//\r\n;\r\n#import \"ViewController.h\"\r\n#import \"NSData+Base64.h\"\r\n#include \"CPFInterface.h\"\r\n#import \"CiOSPlatform.h\"\r\n#import \"EAGLView.h\"\r\n\r\n#ifdef USE_EXTERNAL_SDK_LOVELIVE\r\n#import \"SDKWrapper.h\"\r\n#endif\r\n\r\n@implementation ViewController\r\n\r\n- (void)didReceiveMemoryWarning\r\n{\r\n    [super didReceiveMemoryWarning];\r\n    // Release any cached data, images, etc that aren't in use.\r\n}\r\n\r\nNSMutableDictionary* transactionDict =[NSMutableDictionary dictionary];\r\n#pragma mark - View lifecycle\r\n\r\n// 回転を検出した際に呼び出される\r\n- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration\r\n{\r\n    CPFInterface& pfif = CPFInterface::getInstance();\r\n    if(!pfif.isClient()) return;\r\n    CGRect f = self.view.frame;\r\n    // Retina対応で描画領域をxibに合わせる処理に合わせてここでも変更\r\n    int width = f.size.width * [EAGLView getScaleFactor];\r\n    int height = f.size.height * [EAGLView getScaleFactor];\r\n    // 縦位置か横位置かを検出\r\n    if(UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {\r\n        // 縦位置\r\n        pfif.client().changeScreenInfo(IClientRequest::LEFT_TOP, width, height);\r\n    } else {\r\n        // 横位置\r\n        pfif.client().changeScreenInfo(IClientRequest::LEFT_TOP, height, width);        \r\n    }\r\n}\r\n\r\n- (void)viewDidLoad\r\n{\r\n    [super viewDidLoad];\r\n    \r\n    if(![SKPaymentQueue canMakePayments]) {\r\n        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@\"課金制限\"\r\n                                                         message:@\"設定によりアプリ内課金が制限されています。\"\r\n                                                        delegate:nil\r\n                                               cancelButtonTitle:nil\r\n                                               otherButtonTitles:@\"OK\", nil];\r\n        [alert show];\r\n        [alert release];\r\n    }\r\n        \r\n    [UIApplication sharedApplication].statusBarHidden = YES;\r\n    [self.view setFrame:[[UIScreen mainScreen] bounds]];\r\n    self.view.contentScaleFactor = [EAGLView getScaleFactor];\r\n    [viewGL startAnimation];\r\n    [viewGL setViewController:self];\r\n\r\n\t// Do any additional setup after loading the view, typically from a nib.\r\n#ifdef USE_EXTERNAL_SDK_LOVELIVE\r\n    [SDKWrapper onLoad];\r\n#endif\r\n}\r\n- (void)viewDidUnload\r\n{\r\n    [viewGL stopAnimation];\r\n//    [self setViewBase:nil];\r\n    [super viewDidUnload];\r\n    // Release any retained subviews of the main view.\r\n    // e.g. self.myOutlet = nil;\r\n}\r\n\r\n- (void)viewWillAppear:(BOOL)animated\r\n{\r\n    [super viewWillAppear:animated];\r\n}\r\n\r\n- (void)viewDidAppear:(BOOL)animated\r\n{\r\n    [super viewDidAppear:animated];\r\n}\r\n\r\n- (void)viewWillDisappear:(BOOL)animated\r\n{\r\n\t[super viewWillDisappear:animated];\r\n}\r\n\r\n- (void)viewDidDisappear:(BOOL)animated\r\n{\r\n\t[super viewDidDisappear:animated];\r\n}\r\n\r\n// 実際ローテーションされた場合に呼び出される。\r\n- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation\r\n{\r\n    IClientRequest::SCRMODE mode;\r\n\r\n    switch(interfaceOrientation)\r\n    {\r\n        case UIInterfaceOrientationPortrait:\r\n        case UIInterfaceOrientationPortraitUpsideDown:\r\n            mode = IClientRequest::PORTRAIT;\r\n            break;\r\n        case UIInterfaceOrientationLandscapeLeft:\r\n        case UIInterfaceOrientationLandscapeRight:\r\n            mode = IClientRequest::LANDSCAPE;\r\n            break;\r\n    }\r\n\r\n    CPFInterface& pfif = CPFInterface::getInstance();\r\n    //if(!pfif.isClient()) {\r\n        return (mode == IClientRequest::LANDSCAPE) ? YES : NO;\r\n    //}\r\n    return pfif.client().reportScreenRotation(IClientRequest::LEFT_TOP, mode) ? YES : NO;\r\n}\r\n\r\n- (void)viewRecovery\r\n{\r\n    [viewGL setTimePrev:0];\r\n}\r\n\r\n- (void)stopAnimation\r\n{\r\n    [viewGL stopAnimation];\r\n}\r\n\r\n- (void)startAnimation\r\n{\r\n    [viewGL startAnimation];\r\n}\r\n\r\n-(void)clearUITouches\r\n{\r\n    [viewGL clearUITouches];\r\n}\r\n\r\n- (void)dealloc {\r\n    [viewBase release];\r\n    [super dealloc];\r\n}\r\n\r\n- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {\r\n  if([response.invalidProductIdentifiers count] > 0)\r\n    {\r\n      // アイテムIDが不正\r\n      IClientRequest& cli = CPFInterface::getInstance().client();\r\n      for (NSString* product_id in response.invalidProductIdentifiers)\r\n        {\r\n          const char* utf8_id = [product_id UTF8String];\r\n          if (!utf8_id)\r\n            {\r\n              utf8_id = \"\";\r\n            }\r\n          size_t len = strlen(utf8_id) + 1;\r\n          cli.controlEvent(IClientRequest::E_STORE_BAD_ITEMID,\r\n                           0,\r\n                           len,\r\n                           (void*)utf8_id,\r\n                           0,\r\n                           0);\r\n          CPFInterface::getInstance().platform().logging(\"[store] invalid item id: %s.\",\r\n                                                         utf8_id);\r\n        }\r\n    }\r\n\r\n  // Platformを取得して処理を振り分ける.\r\n  CiOSPlatform* Platform(CiOSPlatform::getInstance());\r\n  if (Platform)\r\n    {\r\n      Platform->responseStoreKitProducts(response, self);\r\n    }\r\n}\r\n\r\n- (void)finishStoreTransaction:(NSString *)receipt\r\n{\r\n\tSKPaymentTransaction * transaction = [transactionDict objectForKey:receipt];\r\n    if (transaction) {\r\n        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];\r\n    \r\n        [transactionDict removeObjectForKey:receipt];\r\n    \r\n#ifdef USE_EXTERNAL_SDK_LOVELIVE\r\n        [SDKWrapper onPayment:transaction];\r\n#endif\r\n    } else {\r\n      /* oh hell.. we are doomed */\r\n    }\r\n}\r\n\r\n- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions: (NSArray *)transactions {\r\n  @synchronized(self) {\r\n    [[NSUserDefaults standardUserDefaults] setBool: NO\r\n                                             forKey:@\"PaymentTransactionBool\"];\r\n    [[NSUserDefaults standardUserDefaults] synchronize];\r\n  }\r\n}\r\n\r\n- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {\r\n    \r\n    IClientRequest& cli = CPFInterface::getInstance().client();\r\n    \r\n    for(SKPaymentTransaction * transaction in transactions) {\r\n        NSString * productId = transaction.payment.productIdentifier;\r\n        const char * utf8_id = [productId UTF8String];\r\n        size_t len = strlen(utf8_id) + 1;\r\n\r\n        switch (transaction.transactionState) {\r\n            case SKPaymentTransactionStatePurchasing: {\r\n              // 購入処理中\r\n              @synchronized(self){\r\n                [[NSUserDefaults standardUserDefaults] setBool:YES\r\n                                                        forKey:@\"PaymentTransactionBool\"];\r\n                [[NSUserDefaults standardUserDefaults] synchronize];\r\n              }\r\n                cli.controlEvent(IClientRequest::E_STORE_PURCHASHING, 0, len, (void *)utf8_id, 0, 0);\r\n                break;\r\n            }\r\n            case SKPaymentTransactionStatePurchased: {\r\n                // 購入処理成功\r\n                \r\n                // レシート情報を取得する\r\n                NSString * receipt = [transaction.transactionReceipt base64EncodedString];\r\n                const char * utf8_receipt = [receipt UTF8String];\r\n                size_t len_receipt = strlen(utf8_receipt) + 1;\r\n                \r\n                cli.controlEvent(IClientRequest::E_STORE_PURCHASHED, 0,\r\n                                 len, (void *)utf8_id, len_receipt, (void *)utf8_receipt);\r\n\r\n                [transactionDict setObject:transaction forKey:[NSString stringWithFormat:@\"%s\", utf8_receipt]];\r\n                break;\r\n            }\r\n            case SKPaymentTransactionStateFailed: {\r\n              // 購入処理エラーもしくはキャンセル\r\n              switch ([transaction.error code])\r\n                {\r\n                case SKErrorUnknown:\r\n                  {\r\n                  }\r\n                  break;\r\n                case SKErrorClientInvalid:\r\n                  {\r\n                  }\r\n                  break;\r\n                case SKErrorPaymentCancelled:\r\n                  {\r\n                  }\r\n                  break;\r\n                case SKErrorPaymentInvalid:\r\n                  {\r\n                  }\r\n                  break;\r\n                case SKErrorPaymentNotAllowed:\r\n                  {\r\n                  }\r\n                  break;\r\n                case SKErrorStoreProductNotAvailable:\r\n                  {\r\n                  }\r\n                  break;\r\n                default:\r\n                  {\r\n                  }\r\n                  break;\r\n                }\r\n                cli.controlEvent(IClientRequest::E_STORE_FAILED, 0, len, (void *)utf8_id, 0, 0);\r\n                [queue finishTransaction:transaction];\r\n                break;\r\n            }\r\n            case SKPaymentTransactionStateRestored: {\r\n                // アイテムのリストア(購入済みアイテムの再付与(再インストール等で最6初から持っている状態にすべき、など)完了\r\n                cli.controlEvent(IClientRequest::E_STORE_RESTORE, 0, len, (void *)utf8_id, 0, 0);\r\n                [queue finishTransaction:transaction];\r\n                break;\r\n            }\r\n            default: break; // unreachable\r\n        }\r\n    }\r\n}\r\n\r\n- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {\r\n    // リストア失敗\r\n    IClientRequest& cli = CPFInterface::getInstance().client();\r\n    cli.controlEvent(IClientRequest::E_STORE_RESTORE_FAILED, 0, 0, 0, 0, 0);\r\n}\r\n\r\n- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {\r\n    // 全リストア終了\r\n    IClientRequest& cli = CPFInterface::getInstance().client();\r\n    cli.controlEvent(IClientRequest::E_STORE_RESTORE_COMPLETED, 0, 0, 0, 0, 0);\r\n}\r\n\r\n- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {\r\n    abort();\r\n}\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/assert.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"assert.h\"\r\n#include <stdio.h>\r\n#include <stdarg.h>\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CiOSPlatform.h\"\r\n\r\nextern \"C\" {\r\nvoid assertFunction(int line, const char* file, const char* msg,...) {\r\n\tva_list\targp;\r\n\tchar pszBuf [1024];\r\n\r\n\tva_start(argp, msg);\r\n\tvsprintf( pszBuf, msg, argp);\r\n\tva_end(argp);\r\n\r\n    char alertBuf[4096];\r\n    sprintf(alertBuf, \"Assert l.%i in %s : %s\", line, file, pszBuf);\r\n    NSString * alert_msg = [NSString stringWithCString:alertBuf encoding:NSUTF8StringEncoding];\r\n\r\n\tNSLog(@\"%s\", alertBuf); \r\n    \r\n    CiOSPlatform * pPlatform = CiOSPlatform::getInstance();\r\n    \r\n    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@\"Assertion\"\r\n                                                     message:alert_msg\r\n                                                    delegate:pPlatform->m_pViewController\r\n                                           cancelButtonTitle:@\"abort\"\r\n                                           otherButtonTitles: nil];\r\n    [alert show];\r\n    [alert release];\r\n    \r\n}\r\n    \r\nvoid msgBox(char * log) {\r\n\r\n}\r\n}\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/curl.h",
    "content": "#ifndef __CURL_CURL_H\r\n#define __CURL_CURL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * If you have libcurl problems, all docs and details are found here:\r\n *   http://curl.haxx.se/libcurl/\r\n *\r\n * curl-library mailing list subscription and unsubscription web interface:\r\n *   http://cool.haxx.se/mailman/listinfo/curl-library/\r\n */\r\n\r\n#include \"curlver.h\"         /* libcurl version defines   */\r\n#include \"curlbuild.h\"       /* libcurl build definitions */\r\n#include \"curlrules.h\"       /* libcurl rules enforcement */\r\n\r\n/*\r\n * Define WIN32 when build target is Win32 API\r\n */\r\n\r\n#if (defined(_WIN32) || defined(__WIN32__)) && \\\r\n     !defined(WIN32) && !defined(__SYMBIAN32__)\r\n#define WIN32\r\n#endif\r\n\r\n#include <stdio.h>\r\n#include <limits.h>\r\n\r\n#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)\r\n/* Needed for __FreeBSD_version symbol definition */\r\n#include <osreldate.h>\r\n#endif\r\n\r\n/* The include stuff here below is mainly for time_t! */\r\n#include <sys/types.h>\r\n#include <time.h>\r\n\r\n#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)\r\n#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))\r\n/* The check above prevents the winsock2 inclusion if winsock.h already was\r\n   included, since they can't co-exist without problems */\r\n#include <winsock2.h>\r\n#include <ws2tcpip.h>\r\n#endif\r\n#endif\r\n\r\n/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish\r\n   libc5-based Linux systems. Only include it on systems that are known to\r\n   require it! */\r\n#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \\\r\n    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \\\r\n    defined(ANDROID) || defined(__ANDROID__) || \\\r\n   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(_WIN32_WCE)\r\n#include <sys/socket.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)\r\n#include <sys/time.h>\r\n#endif\r\n\r\n#ifdef __BEOS__\r\n#include <support/SupportDefs.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURL;\r\n\r\n/*\r\n * Decorate exportable functions for Win32 and Symbian OS DLL linking.\r\n * This avoids using a .def file for building libcurl.dll.\r\n */\r\n#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \\\r\n     !defined(CURL_STATICLIB)\r\n#if defined(BUILDING_LIBCURL)\r\n#define CURL_EXTERN  __declspec(dllexport)\r\n#else\r\n#define CURL_EXTERN  __declspec(dllimport)\r\n#endif\r\n#else\r\n\r\n#ifdef CURL_HIDDEN_SYMBOLS\r\n/*\r\n * This definition is used to make external definitions visible in the\r\n * shared library when symbols are hidden by default.  It makes no\r\n * difference when compiling applications whether this is set or not,\r\n * only when compiling the library.\r\n */\r\n#define CURL_EXTERN CURL_EXTERN_SYMBOL\r\n#else\r\n#define CURL_EXTERN\r\n#endif\r\n#endif\r\n\r\n#ifndef curl_socket_typedef\r\n/* socket typedef */\r\n#if defined(WIN32) && !defined(__LWIP_OPT_H__)\r\ntypedef SOCKET curl_socket_t;\r\n#define CURL_SOCKET_BAD INVALID_SOCKET\r\n#else\r\ntypedef int curl_socket_t;\r\n#define CURL_SOCKET_BAD -1\r\n#endif\r\n#define curl_socket_typedef\r\n#endif /* curl_socket_typedef */\r\n\r\nstruct curl_httppost {\r\n  struct curl_httppost *next;       /* next entry in the list */\r\n  char *name;                       /* pointer to allocated name */\r\n  long namelength;                  /* length of name length */\r\n  char *contents;                   /* pointer to allocated data contents */\r\n  long contentslength;              /* length of contents field */\r\n  char *buffer;                     /* pointer to allocated buffer contents */\r\n  long bufferlength;                /* length of buffer field */\r\n  char *contenttype;                /* Content-Type */\r\n  struct curl_slist* contentheader; /* list of extra headers for this form */\r\n  struct curl_httppost *more;       /* if one field name has more than one\r\n                                       file, this link should link to following\r\n                                       files */\r\n  long flags;                       /* as defined below */\r\n#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */\r\n#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */\r\n#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */\r\n#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */\r\n#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the\r\n                                       regular read callback to get the data\r\n                                       and pass the given pointer as custom\r\n                                       pointer */\r\n\r\n  char *showfilename;               /* The file name to show. If not set, the\r\n                                       actual file name will be used (if this\r\n                                       is a file part) */\r\n  void *userp;                      /* custom pointer used for\r\n                                       HTTPPOST_CALLBACK posts */\r\n};\r\n\r\ntypedef int (*curl_progress_callback)(void *clientp,\r\n                                      double dltotal,\r\n                                      double dlnow,\r\n                                      double ultotal,\r\n                                      double ulnow);\r\n\r\n#ifndef CURL_MAX_WRITE_SIZE\r\n  /* Tests have proven that 20K is a very bad buffer size for uploads on\r\n     Windows, while 16K for some odd reason performed a lot better.\r\n     We do the ifndef check to allow this value to easier be changed at build\r\n     time for those who feel adventurous. The practical minimum is about\r\n     400 bytes since libcurl uses a buffer of this size as a scratch area\r\n     (unrelated to network send operations). */\r\n#define CURL_MAX_WRITE_SIZE 16384\r\n#endif\r\n\r\n#ifndef CURL_MAX_HTTP_HEADER\r\n/* The only reason to have a max limit for this is to avoid the risk of a bad\r\n   server feeding libcurl with a never-ending header that will cause reallocs\r\n   infinitely */\r\n#define CURL_MAX_HTTP_HEADER (100*1024)\r\n#endif\r\n\r\n/* This is a magic return code for the write callback that, when returned,\r\n   will signal libcurl to pause receiving on the current transfer. */\r\n#define CURL_WRITEFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_write_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *outstream);\r\n\r\n\r\n\r\n/* enumeration of file types */\r\ntypedef enum {\r\n  CURLFILETYPE_FILE = 0,\r\n  CURLFILETYPE_DIRECTORY,\r\n  CURLFILETYPE_SYMLINK,\r\n  CURLFILETYPE_DEVICE_BLOCK,\r\n  CURLFILETYPE_DEVICE_CHAR,\r\n  CURLFILETYPE_NAMEDPIPE,\r\n  CURLFILETYPE_SOCKET,\r\n  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */\r\n\r\n  CURLFILETYPE_UNKNOWN /* should never occur */\r\n} curlfiletype;\r\n\r\n#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)\r\n#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)\r\n#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)\r\n#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)\r\n#define CURLFINFOFLAG_KNOWN_UID         (1<<4)\r\n#define CURLFINFOFLAG_KNOWN_GID         (1<<5)\r\n#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)\r\n#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)\r\n\r\n/* Content of this structure depends on information which is known and is\r\n   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man\r\n   page for callbacks returning this structure -- some fields are mandatory,\r\n   some others are optional. The FLAG field has special meaning. */\r\nstruct curl_fileinfo {\r\n  char *filename;\r\n  curlfiletype filetype;\r\n  time_t time;\r\n  unsigned int perm;\r\n  int uid;\r\n  int gid;\r\n  curl_off_t size;\r\n  long int hardlinks;\r\n\r\n  struct {\r\n    /* If some of these fields is not NULL, it is a pointer to b_data. */\r\n    char *time;\r\n    char *perm;\r\n    char *user;\r\n    char *group;\r\n    char *target; /* pointer to the target filename of a symlink */\r\n  } strings;\r\n\r\n  unsigned int flags;\r\n\r\n  /* used internally */\r\n  char * b_data;\r\n  size_t b_size;\r\n  size_t b_used;\r\n};\r\n\r\n/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */\r\n#define CURL_CHUNK_BGN_FUNC_OK      0\r\n#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */\r\n#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */\r\n\r\n/* if splitting of data transfer is enabled, this callback is called before\r\n   download of an individual chunk started. Note that parameter \"remains\" works\r\n   only for FTP wildcard downloading (for now), otherwise is not used */\r\ntypedef long (*curl_chunk_bgn_callback)(const void *transfer_info,\r\n                                        void *ptr,\r\n                                        int remains);\r\n\r\n/* return codes for CURLOPT_CHUNK_END_FUNCTION */\r\n#define CURL_CHUNK_END_FUNC_OK      0\r\n#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */\r\n\r\n/* If splitting of data transfer is enabled this callback is called after\r\n   download of an individual chunk finished.\r\n   Note! After this callback was set then it have to be called FOR ALL chunks.\r\n   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.\r\n   This is the reason why we don't need \"transfer_info\" parameter in this\r\n   callback and we are not interested in \"remains\" parameter too. */\r\ntypedef long (*curl_chunk_end_callback)(void *ptr);\r\n\r\n/* return codes for FNMATCHFUNCTION */\r\n#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */\r\n#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */\r\n#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */\r\n\r\n/* callback type for wildcard downloading pattern matching. If the\r\n   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */\r\ntypedef int (*curl_fnmatch_callback)(void *ptr,\r\n                                     const char *pattern,\r\n                                     const char *string);\r\n\r\n/* These are the return codes for the seek callbacks */\r\n#define CURL_SEEKFUNC_OK       0\r\n#define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */\r\n#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so\r\n                                    libcurl might try other means instead */\r\ntypedef int (*curl_seek_callback)(void *instream,\r\n                                  curl_off_t offset,\r\n                                  int origin); /* 'whence' */\r\n\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to immediately abort the current transfer. */\r\n#define CURL_READFUNC_ABORT 0x10000000\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to pause sending data on the current transfer. */\r\n#define CURL_READFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_read_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *instream);\r\n\r\ntypedef enum  {\r\n  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */\r\n  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */\r\n  CURLSOCKTYPE_LAST    /* never use */\r\n} curlsocktype;\r\n\r\n/* The return code from the sockopt_callback can signal information back\r\n   to libcurl: */\r\n#define CURL_SOCKOPT_OK 0\r\n#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return\r\n                                CURLE_ABORTED_BY_CALLBACK */\r\n#define CURL_SOCKOPT_ALREADY_CONNECTED 2\r\n\r\ntypedef int (*curl_sockopt_callback)(void *clientp,\r\n                                     curl_socket_t curlfd,\r\n                                     curlsocktype purpose);\r\n\r\nstruct curl_sockaddr {\r\n  int family;\r\n  int socktype;\r\n  int protocol;\r\n  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it\r\n                           turned really ugly and painful on the systems that\r\n                           lack this type */\r\n  struct sockaddr addr;\r\n};\r\n\r\ntypedef curl_socket_t\r\n(*curl_opensocket_callback)(void *clientp,\r\n                            curlsocktype purpose,\r\n                            struct curl_sockaddr *address);\r\n\r\ntypedef int\r\n(*curl_closesocket_callback)(void *clientp, curl_socket_t item);\r\n\r\ntypedef enum {\r\n  CURLIOE_OK,            /* I/O operation successful */\r\n  CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */\r\n  CURLIOE_FAILRESTART,   /* failed to restart the read */\r\n  CURLIOE_LAST           /* never use */\r\n} curlioerr;\r\n\r\ntypedef enum  {\r\n  CURLIOCMD_NOP,         /* no operation */\r\n  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */\r\n  CURLIOCMD_LAST         /* never use */\r\n} curliocmd;\r\n\r\ntypedef curlioerr (*curl_ioctl_callback)(CURL *handle,\r\n                                         int cmd,\r\n                                         void *clientp);\r\n\r\n/*\r\n * The following typedef's are signatures of malloc, free, realloc, strdup and\r\n * calloc respectively.  Function pointers of these types can be passed to the\r\n * curl_global_init_mem() function to set user defined memory management\r\n * callback routines.\r\n */\r\ntypedef void *(*curl_malloc_callback)(size_t size);\r\ntypedef void (*curl_free_callback)(void *ptr);\r\ntypedef void *(*curl_realloc_callback)(void *ptr, size_t size);\r\ntypedef char *(*curl_strdup_callback)(const char *str);\r\ntypedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);\r\n\r\n/* the kind of data that is passed to information_callback*/\r\ntypedef enum {\r\n  CURLINFO_TEXT = 0,\r\n  CURLINFO_HEADER_IN,    /* 1 */\r\n  CURLINFO_HEADER_OUT,   /* 2 */\r\n  CURLINFO_DATA_IN,      /* 3 */\r\n  CURLINFO_DATA_OUT,     /* 4 */\r\n  CURLINFO_SSL_DATA_IN,  /* 5 */\r\n  CURLINFO_SSL_DATA_OUT, /* 6 */\r\n  CURLINFO_END\r\n} curl_infotype;\r\n\r\ntypedef int (*curl_debug_callback)\r\n       (CURL *handle,      /* the handle/transfer this concerns */\r\n        curl_infotype type, /* what kind of data */\r\n        char *data,        /* points to the data */\r\n        size_t size,       /* size of the data pointed to */\r\n        void *userptr);    /* whatever the user please */\r\n\r\n/* All possible error codes from all sorts of curl functions. Future versions\r\n   may return other values, stay prepared.\r\n\r\n   Always add new return codes last. Never *EVER* remove any. The return\r\n   codes must remain the same!\r\n */\r\n\r\ntypedef enum {\r\n  CURLE_OK = 0,\r\n  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */\r\n  CURLE_FAILED_INIT,             /* 2 */\r\n  CURLE_URL_MALFORMAT,           /* 3 */\r\n  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for\r\n                                    7.17.0, reused in April 2011 for 7.21.5] */\r\n  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */\r\n  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */\r\n  CURLE_COULDNT_CONNECT,         /* 7 */\r\n  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */\r\n  CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server\r\n                                    due to lack of access - when login fails\r\n                                    this is not returned. */\r\n  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for\r\n                                    7.15.4, reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */\r\n  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server\r\n                                    [was obsoleted in August 2007 for 7.17.0,\r\n                                    reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */\r\n  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */\r\n  CURLE_FTP_CANT_GET_HOST,       /* 15 */\r\n  CURLE_OBSOLETE16,              /* 16 - NOT USED */\r\n  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */\r\n  CURLE_PARTIAL_FILE,            /* 18 */\r\n  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */\r\n  CURLE_OBSOLETE20,              /* 20 - NOT USED */\r\n  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */\r\n  CURLE_HTTP_RETURNED_ERROR,     /* 22 */\r\n  CURLE_WRITE_ERROR,             /* 23 */\r\n  CURLE_OBSOLETE24,              /* 24 - NOT USED */\r\n  CURLE_UPLOAD_FAILED,           /* 25 - failed upload \"command\" */\r\n  CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */\r\n  CURLE_OUT_OF_MEMORY,           /* 27 */\r\n  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error\r\n           instead of a memory allocation error if CURL_DOES_CONVERSIONS\r\n           is defined\r\n  */\r\n  CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */\r\n  CURLE_OBSOLETE29,              /* 29 - NOT USED */\r\n  CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */\r\n  CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */\r\n  CURLE_OBSOLETE32,              /* 32 - NOT USED */\r\n  CURLE_RANGE_ERROR,             /* 33 - RANGE \"command\" didn't work */\r\n  CURLE_HTTP_POST_ERROR,         /* 34 */\r\n  CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */\r\n  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */\r\n  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */\r\n  CURLE_LDAP_CANNOT_BIND,        /* 38 */\r\n  CURLE_LDAP_SEARCH_FAILED,      /* 39 */\r\n  CURLE_OBSOLETE40,              /* 40 - NOT USED */\r\n  CURLE_FUNCTION_NOT_FOUND,      /* 41 */\r\n  CURLE_ABORTED_BY_CALLBACK,     /* 42 */\r\n  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */\r\n  CURLE_OBSOLETE44,              /* 44 - NOT USED */\r\n  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */\r\n  CURLE_OBSOLETE46,              /* 46 - NOT USED */\r\n  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */\r\n  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */\r\n  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */\r\n  CURLE_OBSOLETE50,              /* 50 - NOT USED */\r\n  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint\r\n                                     wasn't verified fine */\r\n  CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */\r\n  CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */\r\n  CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as\r\n                                    default */\r\n  CURLE_SEND_ERROR,              /* 55 - failed sending network data */\r\n  CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */\r\n  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */\r\n  CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */\r\n  CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */\r\n  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */\r\n  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */\r\n  CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */\r\n  CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */\r\n  CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */\r\n  CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind\r\n                                    that failed */\r\n  CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */\r\n  CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not\r\n                                    accepted and we failed to login */\r\n  CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */\r\n  CURLE_TFTP_PERM,               /* 69 - permission problem on server */\r\n  CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */\r\n  CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */\r\n  CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */\r\n  CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */\r\n  CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */\r\n  CURLE_CONV_FAILED,             /* 75 - conversion failed */\r\n  CURLE_CONV_REQD,               /* 76 - caller must register conversion\r\n                                    callbacks using curl_easy_setopt options\r\n                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,\r\n                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and\r\n                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */\r\n  CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing\r\n                                    or wrong format */\r\n  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */\r\n  CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat\r\n                                    generic so the error message will be of\r\n                                    interest when this has happened */\r\n\r\n  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL\r\n                                    connection */\r\n  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,\r\n                                    wait till it's ready and try again (Added\r\n                                    in 7.18.2) */\r\n  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or\r\n                                    wrong format (Added in 7.19.0) */\r\n  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in\r\n                                    7.19.0) */\r\n  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */\r\n  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */\r\n  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */\r\n  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */\r\n  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */\r\n  CURL_LAST /* never use! */\r\n} CURLcode;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Previously obsoletes error codes re-used in 7.24.0 */\r\n#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED\r\n#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT\r\n\r\n/*  compatibility with older names */\r\n#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING\r\n\r\n/* The following were added in 7.21.5, April 2011 */\r\n#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION\r\n\r\n/* The following were added in 7.17.1 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION\r\n\r\n/* The following were added in 7.17.0 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */\r\n#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46\r\n#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44\r\n#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10\r\n#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16\r\n#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32\r\n#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29\r\n#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12\r\n#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20\r\n#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40\r\n#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24\r\n#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57\r\n#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN\r\n\r\n#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED\r\n#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE\r\n#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR\r\n#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL\r\n#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS\r\n#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR\r\n#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT\r\n\r\n#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR\r\n#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED\r\n#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED\r\n\r\n#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE\r\n#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME\r\n\r\n/* This was the error code 50 in 7.7.3 and a few earlier versions, this\r\n   is no longer used by libcurl but is instead #defined here only to not\r\n   make programs break */\r\n#define CURLE_ALREADY_COMPLETE 99999\r\n\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* This prototype applies to all conversion callbacks */\r\ntypedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);\r\n\r\ntypedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */\r\n                                          void *ssl_ctx, /* actually an\r\n                                                            OpenSSL SSL_CTX */\r\n                                          void *userptr);\r\n\r\ntypedef enum {\r\n  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use\r\n                           CONNECT HTTP/1.1 */\r\n  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT\r\n                               HTTP/1.0  */\r\n  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already\r\n                           in 7.10 */\r\n  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */\r\n  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */\r\n  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the\r\n                                   host name rather than the IP address. added\r\n                                   in 7.18.0 */\r\n} curl_proxytype;  /* this enum was added in 7.10 */\r\n\r\n/*\r\n * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:\r\n *\r\n * CURLAUTH_NONE         - No HTTP authentication\r\n * CURLAUTH_BASIC        - HTTP Basic authentication (default)\r\n * CURLAUTH_DIGEST       - HTTP Digest authentication\r\n * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication\r\n * CURLAUTH_NTLM         - HTTP NTLM authentication\r\n * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour\r\n * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper\r\n * CURLAUTH_ONLY         - Use together with a single other type to force no\r\n *                         authentication or just that single type\r\n * CURLAUTH_ANY          - All fine types set\r\n * CURLAUTH_ANYSAFE      - All fine types except Basic\r\n */\r\n\r\n#define CURLAUTH_NONE         ((unsigned long)0)\r\n#define CURLAUTH_BASIC        (((unsigned long)1)<<0)\r\n#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)\r\n#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)\r\n#define CURLAUTH_NTLM         (((unsigned long)1)<<3)\r\n#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)\r\n#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)\r\n#define CURLAUTH_ONLY         (((unsigned long)1)<<31)\r\n#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)\r\n#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))\r\n\r\n#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */\r\n#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */\r\n#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */\r\n#define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */\r\n#define CURLSSH_AUTH_HOST      (1<<2) /* host key files */\r\n#define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */\r\n#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */\r\n#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY\r\n\r\n#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */\r\n#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */\r\n#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */\r\n\r\n#define CURL_ERROR_SIZE 256\r\n\r\nstruct curl_khkey {\r\n  const char *key; /* points to a zero-terminated string encoded with base64\r\n                      if len is zero, otherwise to the \"raw\" data */\r\n  size_t len;\r\n  enum type {\r\n    CURLKHTYPE_UNKNOWN,\r\n    CURLKHTYPE_RSA1,\r\n    CURLKHTYPE_RSA,\r\n    CURLKHTYPE_DSS\r\n  } keytype;\r\n};\r\n\r\n/* this is the set of return values expected from the curl_sshkeycallback\r\n   callback */\r\nenum curl_khstat {\r\n  CURLKHSTAT_FINE_ADD_TO_FILE,\r\n  CURLKHSTAT_FINE,\r\n  CURLKHSTAT_REJECT, /* reject the connection, return an error */\r\n  CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so\r\n                        this causes a CURLE_DEFER error but otherwise the\r\n                        connection will be left intact etc */\r\n  CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */\r\n};\r\n\r\n/* this is the set of status codes pass in to the callback */\r\nenum curl_khmatch {\r\n  CURLKHMATCH_OK,       /* match */\r\n  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */\r\n  CURLKHMATCH_MISSING,  /* no matching host/key found */\r\n  CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */\r\n};\r\n\r\ntypedef int\r\n  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */\r\n                          const struct curl_khkey *knownkey, /* known */\r\n                          const struct curl_khkey *foundkey, /* found */\r\n                          enum curl_khmatch, /* libcurl's view on the keys */\r\n                          void *clientp); /* custom pointer passed from app */\r\n\r\n/* parameter for the CURLOPT_USE_SSL option */\r\ntypedef enum {\r\n  CURLUSESSL_NONE,    /* do not attempt to use SSL */\r\n  CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */\r\n  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */\r\n  CURLUSESSL_ALL,     /* SSL for all communication or fail */\r\n  CURLUSESSL_LAST     /* not an option, never use */\r\n} curl_usessl;\r\n\r\n/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */\r\n\r\n/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the\r\n   name of improving interoperability with older servers. Some SSL libraries\r\n   have introduced work-arounds for this flaw but those work-arounds sometimes\r\n   make the SSL communication fail. To regain functionality with those broken\r\n   servers, a user can this way allow the vulnerability back. */\r\n#define CURLSSLOPT_ALLOW_BEAST (1<<0)\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n#define CURLFTPSSL_NONE CURLUSESSL_NONE\r\n#define CURLFTPSSL_TRY CURLUSESSL_TRY\r\n#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL\r\n#define CURLFTPSSL_ALL CURLUSESSL_ALL\r\n#define CURLFTPSSL_LAST CURLUSESSL_LAST\r\n#define curl_ftpssl curl_usessl\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* parameter for the CURLOPT_FTP_SSL_CCC option */\r\ntypedef enum {\r\n  CURLFTPSSL_CCC_NONE,    /* do not send CCC */\r\n  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */\r\n  CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */\r\n  CURLFTPSSL_CCC_LAST     /* not an option, never use */\r\n} curl_ftpccc;\r\n\r\n/* parameter for the CURLOPT_FTPSSLAUTH option */\r\ntypedef enum {\r\n  CURLFTPAUTH_DEFAULT, /* let libcurl decide */\r\n  CURLFTPAUTH_SSL,     /* use \"AUTH SSL\" */\r\n  CURLFTPAUTH_TLS,     /* use \"AUTH TLS\" */\r\n  CURLFTPAUTH_LAST /* not an option, never use */\r\n} curl_ftpauth;\r\n\r\n/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */\r\ntypedef enum {\r\n  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */\r\n  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD\r\n                               again if MKD succeeded, for SFTP this does\r\n                               similar magic */\r\n  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD\r\n                               again even if MKD failed! */\r\n  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */\r\n} curl_ftpcreatedir;\r\n\r\n/* parameter for the CURLOPT_FTP_FILEMETHOD option */\r\ntypedef enum {\r\n  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */\r\n  CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */\r\n  CURLFTPMETHOD_NOCWD,     /* no CWD at all */\r\n  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */\r\n  CURLFTPMETHOD_LAST       /* not an option, never use */\r\n} curl_ftpmethod;\r\n\r\n/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */\r\n#define CURLPROTO_HTTP   (1<<0)\r\n#define CURLPROTO_HTTPS  (1<<1)\r\n#define CURLPROTO_FTP    (1<<2)\r\n#define CURLPROTO_FTPS   (1<<3)\r\n#define CURLPROTO_SCP    (1<<4)\r\n#define CURLPROTO_SFTP   (1<<5)\r\n#define CURLPROTO_TELNET (1<<6)\r\n#define CURLPROTO_LDAP   (1<<7)\r\n#define CURLPROTO_LDAPS  (1<<8)\r\n#define CURLPROTO_DICT   (1<<9)\r\n#define CURLPROTO_FILE   (1<<10)\r\n#define CURLPROTO_TFTP   (1<<11)\r\n#define CURLPROTO_IMAP   (1<<12)\r\n#define CURLPROTO_IMAPS  (1<<13)\r\n#define CURLPROTO_POP3   (1<<14)\r\n#define CURLPROTO_POP3S  (1<<15)\r\n#define CURLPROTO_SMTP   (1<<16)\r\n#define CURLPROTO_SMTPS  (1<<17)\r\n#define CURLPROTO_RTSP   (1<<18)\r\n#define CURLPROTO_RTMP   (1<<19)\r\n#define CURLPROTO_RTMPT  (1<<20)\r\n#define CURLPROTO_RTMPE  (1<<21)\r\n#define CURLPROTO_RTMPTE (1<<22)\r\n#define CURLPROTO_RTMPS  (1<<23)\r\n#define CURLPROTO_RTMPTS (1<<24)\r\n#define CURLPROTO_GOPHER (1<<25)\r\n#define CURLPROTO_ALL    (~0) /* enable everything */\r\n\r\n/* long may be 32 or 64 bits, but we should never depend on anything else\r\n   but 32 */\r\n#define CURLOPTTYPE_LONG          0\r\n#define CURLOPTTYPE_OBJECTPOINT   10000\r\n#define CURLOPTTYPE_FUNCTIONPOINT 20000\r\n#define CURLOPTTYPE_OFF_T         30000\r\n\r\n/* name is uppercase CURLOPT_<name>,\r\n   type is one of the defined CURLOPTTYPE_<type>\r\n   number is unique identifier */\r\n#ifdef CINIT\r\n#undef CINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLOPT_/**/name = type + number\r\n#endif\r\n\r\n/*\r\n * This macro-mania below setups the CURLOPT_[what] enum, to be used with\r\n * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]\r\n * word.\r\n */\r\n\r\ntypedef enum {\r\n  /* This is the FILE * or void * the regular output should be written to. */\r\n  CINIT(FILE, OBJECTPOINT, 1),\r\n\r\n  /* The full URL to get/put */\r\n  CINIT(URL,  OBJECTPOINT, 2),\r\n\r\n  /* Port number to connect to, if other than default. */\r\n  CINIT(PORT, LONG, 3),\r\n\r\n  /* Name of proxy to use. */\r\n  CINIT(PROXY, OBJECTPOINT, 4),\r\n\r\n  /* \"name:password\" to use when fetching. */\r\n  CINIT(USERPWD, OBJECTPOINT, 5),\r\n\r\n  /* \"name:password\" to use with proxy. */\r\n  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),\r\n\r\n  /* Range to get, specified as an ASCII string. */\r\n  CINIT(RANGE, OBJECTPOINT, 7),\r\n\r\n  /* not used */\r\n\r\n  /* Specified file stream to upload from (use as input): */\r\n  CINIT(INFILE, OBJECTPOINT, 9),\r\n\r\n  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE\r\n   * bytes big. If this is not used, error messages go to stderr instead: */\r\n  CINIT(ERRORBUFFER, OBJECTPOINT, 10),\r\n\r\n  /* Function that will be called to store the output (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),\r\n\r\n  /* Function that will be called to read the input (instead of fread). The\r\n   * parameters will use fread() syntax, make sure to follow them. */\r\n  CINIT(READFUNCTION, FUNCTIONPOINT, 12),\r\n\r\n  /* Time-out the read operation after this amount of seconds */\r\n  CINIT(TIMEOUT, LONG, 13),\r\n\r\n  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about\r\n   * how large the file being sent really is. That allows better error\r\n   * checking and better verifies that the upload was successful. -1 means\r\n   * unknown size.\r\n   *\r\n   * For large file support, there is also a _LARGE version of the key\r\n   * which takes an off_t type, allowing platforms with larger off_t\r\n   * sizes to handle larger files.  See below for INFILESIZE_LARGE.\r\n   */\r\n  CINIT(INFILESIZE, LONG, 14),\r\n\r\n  /* POST static input fields. */\r\n  CINIT(POSTFIELDS, OBJECTPOINT, 15),\r\n\r\n  /* Set the referrer page (needed by some CGIs) */\r\n  CINIT(REFERER, OBJECTPOINT, 16),\r\n\r\n  /* Set the FTP PORT string (interface name, named or numerical IP address)\r\n     Use i.e '-' to use default address. */\r\n  CINIT(FTPPORT, OBJECTPOINT, 17),\r\n\r\n  /* Set the User-Agent string (examined by some CGIs) */\r\n  CINIT(USERAGENT, OBJECTPOINT, 18),\r\n\r\n  /* If the download receives less than \"low speed limit\" bytes/second\r\n   * during \"low speed time\" seconds, the operations is aborted.\r\n   * You could i.e if you have a pretty high speed connection, abort if\r\n   * it is less than 2000 bytes/sec during 20 seconds.\r\n   */\r\n\r\n  /* Set the \"low speed limit\" */\r\n  CINIT(LOW_SPEED_LIMIT, LONG, 19),\r\n\r\n  /* Set the \"low speed time\" */\r\n  CINIT(LOW_SPEED_TIME, LONG, 20),\r\n\r\n  /* Set the continuation offset.\r\n   *\r\n   * Note there is also a _LARGE version of this key which uses\r\n   * off_t types, allowing for large file offsets on platforms which\r\n   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.\r\n   */\r\n  CINIT(RESUME_FROM, LONG, 21),\r\n\r\n  /* Set cookie in request: */\r\n  CINIT(COOKIE, OBJECTPOINT, 22),\r\n\r\n  /* This points to a linked list of headers, struct curl_slist kind */\r\n  CINIT(HTTPHEADER, OBJECTPOINT, 23),\r\n\r\n  /* This points to a linked list of post entries, struct curl_httppost */\r\n  CINIT(HTTPPOST, OBJECTPOINT, 24),\r\n\r\n  /* name of the file keeping your private SSL-certificate */\r\n  CINIT(SSLCERT, OBJECTPOINT, 25),\r\n\r\n  /* password for the SSL or SSH private key */\r\n  CINIT(KEYPASSWD, OBJECTPOINT, 26),\r\n\r\n  /* send TYPE parameter? */\r\n  CINIT(CRLF, LONG, 27),\r\n\r\n  /* send linked-list of QUOTE commands */\r\n  CINIT(QUOTE, OBJECTPOINT, 28),\r\n\r\n  /* send FILE * or void * to store headers to, if you use a callback it\r\n     is simply passed to the callback unmodified */\r\n  CINIT(WRITEHEADER, OBJECTPOINT, 29),\r\n\r\n  /* point to a file to read the initial cookies from, also enables\r\n     \"cookie awareness\" */\r\n  CINIT(COOKIEFILE, OBJECTPOINT, 31),\r\n\r\n  /* What version to specifically try to use.\r\n     See CURL_SSLVERSION defines below. */\r\n  CINIT(SSLVERSION, LONG, 32),\r\n\r\n  /* What kind of HTTP time condition to use, see defines */\r\n  CINIT(TIMECONDITION, LONG, 33),\r\n\r\n  /* Time to use with the above condition. Specified in number of seconds\r\n     since 1 Jan 1970 */\r\n  CINIT(TIMEVALUE, LONG, 34),\r\n\r\n  /* 35 = OBSOLETE */\r\n\r\n  /* Custom request, for customizing the get command like\r\n     HTTP: DELETE, TRACE and others\r\n     FTP: to use a different list command\r\n     */\r\n  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),\r\n\r\n  /* HTTP request, for odd commands like DELETE, TRACE and others */\r\n  CINIT(STDERR, OBJECTPOINT, 37),\r\n\r\n  /* 38 is not used */\r\n\r\n  /* send linked-list of post-transfer QUOTE commands */\r\n  CINIT(POSTQUOTE, OBJECTPOINT, 39),\r\n\r\n  CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */\r\n\r\n  CINIT(VERBOSE, LONG, 41),      /* talk a lot */\r\n  CINIT(HEADER, LONG, 42),       /* throw the header out too */\r\n  CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */\r\n  CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */\r\n  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */\r\n  CINIT(UPLOAD, LONG, 46),       /* this is an upload */\r\n  CINIT(POST, LONG, 47),         /* HTTP POST method */\r\n  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */\r\n\r\n  CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */\r\n\r\n  /* Specify whether to read the user+password from the .netrc or the URL.\r\n   * This must be one of the CURL_NETRC_* enums below. */\r\n  CINIT(NETRC, LONG, 51),\r\n\r\n  CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */\r\n\r\n  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */\r\n  CINIT(PUT, LONG, 54),          /* HTTP PUT */\r\n\r\n  /* 55 = OBSOLETE */\r\n\r\n  /* Function that will be called instead of the internal progress display\r\n   * function. This function should be defined as the curl_progress_callback\r\n   * prototype defines. */\r\n  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),\r\n\r\n  /* Data passed to the progress callback */\r\n  CINIT(PROGRESSDATA, OBJECTPOINT, 57),\r\n\r\n  /* We want the referrer field set automatically when following locations */\r\n  CINIT(AUTOREFERER, LONG, 58),\r\n\r\n  /* Port of the proxy, can be set in the proxy string as well with:\r\n     \"[host]:[port]\" */\r\n  CINIT(PROXYPORT, LONG, 59),\r\n\r\n  /* size of the POST input data, if strlen() is not good to use */\r\n  CINIT(POSTFIELDSIZE, LONG, 60),\r\n\r\n  /* tunnel non-http operations through a HTTP proxy */\r\n  CINIT(HTTPPROXYTUNNEL, LONG, 61),\r\n\r\n  /* Set the interface string to use as outgoing network interface */\r\n  CINIT(INTERFACE, OBJECTPOINT, 62),\r\n\r\n  /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This\r\n   * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string\r\n   * is set but doesn't match one of these, 'private' will be used.  */\r\n  CINIT(KRBLEVEL, OBJECTPOINT, 63),\r\n\r\n  /* Set if we should verify the peer in ssl handshake, set 1 to verify. */\r\n  CINIT(SSL_VERIFYPEER, LONG, 64),\r\n\r\n  /* The CApath or CAfile used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAINFO, OBJECTPOINT, 65),\r\n\r\n  /* 66 = OBSOLETE */\r\n  /* 67 = OBSOLETE */\r\n\r\n  /* Maximum number of http redirects to follow */\r\n  CINIT(MAXREDIRS, LONG, 68),\r\n\r\n  /* Pass a long set to 1 to get the date of the requested document (if\r\n     possible)! Pass a zero to shut it off. */\r\n  CINIT(FILETIME, LONG, 69),\r\n\r\n  /* This points to a linked list of telnet options */\r\n  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),\r\n\r\n  /* Max amount of cached alive connections */\r\n  CINIT(MAXCONNECTS, LONG, 71),\r\n\r\n  CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */\r\n\r\n  /* 73 = OBSOLETE */\r\n\r\n  /* Set to explicitly use a new connection for the upcoming transfer.\r\n     Do not use this unless you're absolutely sure of this, as it makes the\r\n     operation slower and is less friendly for the network. */\r\n  CINIT(FRESH_CONNECT, LONG, 74),\r\n\r\n  /* Set to explicitly forbid the upcoming transfer's connection to be re-used\r\n     when done. Do not use this unless you're absolutely sure of this, as it\r\n     makes the operation slower and is less friendly for the network. */\r\n  CINIT(FORBID_REUSE, LONG, 75),\r\n\r\n  /* Set to a file name that contains random data for libcurl to use to\r\n     seed the random engine when doing SSL connects. */\r\n  CINIT(RANDOM_FILE, OBJECTPOINT, 76),\r\n\r\n  /* Set to the Entropy Gathering Daemon socket pathname */\r\n  CINIT(EGDSOCKET, OBJECTPOINT, 77),\r\n\r\n  /* Time-out connect operations after this amount of seconds, if connects are\r\n     OK within this time, then fine... This only aborts the connect phase. */\r\n  CINIT(CONNECTTIMEOUT, LONG, 78),\r\n\r\n  /* Function that will be called to store headers (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),\r\n\r\n  /* Set this to force the HTTP request to get back to GET. Only really usable\r\n     if POST, PUT or a custom request have been used first.\r\n   */\r\n  CINIT(HTTPGET, LONG, 80),\r\n\r\n  /* Set if we should verify the Common name from the peer certificate in ssl\r\n   * handshake, set 1 to check existence, 2 to ensure that it matches the\r\n   * provided hostname. */\r\n  CINIT(SSL_VERIFYHOST, LONG, 81),\r\n\r\n  /* Specify which file name to write all known cookies in after completed\r\n     operation. Set file name to \"-\" (dash) to make it go to stdout. */\r\n  CINIT(COOKIEJAR, OBJECTPOINT, 82),\r\n\r\n  /* Specify which SSL ciphers to use */\r\n  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),\r\n\r\n  /* Specify which HTTP version to use! This must be set to one of the\r\n     CURL_HTTP_VERSION* enums set below. */\r\n  CINIT(HTTP_VERSION, LONG, 84),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPSV command. By\r\n     default, that one will always be attempted before the more traditional\r\n     PASV command. */\r\n  CINIT(FTP_USE_EPSV, LONG, 85),\r\n\r\n  /* type of the file keeping your SSL-certificate (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),\r\n\r\n  /* name of the file keeping your private SSL-key */\r\n  CINIT(SSLKEY, OBJECTPOINT, 87),\r\n\r\n  /* type of the file keeping your private SSL-key (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),\r\n\r\n  /* crypto engine for the SSL-sub system */\r\n  CINIT(SSLENGINE, OBJECTPOINT, 89),\r\n\r\n  /* set the crypto engine for the SSL-sub system as default\r\n     the param has no meaning...\r\n   */\r\n  CINIT(SSLENGINE_DEFAULT, LONG, 90),\r\n\r\n  /* Non-zero value means to use the global dns cache */\r\n  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */\r\n\r\n  /* DNS cache timeout */\r\n  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),\r\n\r\n  /* send linked-list of pre-transfer QUOTE commands */\r\n  CINIT(PREQUOTE, OBJECTPOINT, 93),\r\n\r\n  /* set the debug function */\r\n  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),\r\n\r\n  /* set the data for the debug function */\r\n  CINIT(DEBUGDATA, OBJECTPOINT, 95),\r\n\r\n  /* mark this as start of a cookie session */\r\n  CINIT(COOKIESESSION, LONG, 96),\r\n\r\n  /* The CApath directory used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAPATH, OBJECTPOINT, 97),\r\n\r\n  /* Instruct libcurl to use a smaller receive buffer */\r\n  CINIT(BUFFERSIZE, LONG, 98),\r\n\r\n  /* Instruct libcurl to not use any signal/alarm handlers, even when using\r\n     timeouts. This option is useful for multi-threaded applications.\r\n     See libcurl-the-guide for more background information. */\r\n  CINIT(NOSIGNAL, LONG, 99),\r\n\r\n  /* Provide a CURLShare for mutexing non-ts data */\r\n  CINIT(SHARE, OBJECTPOINT, 100),\r\n\r\n  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),\r\n     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */\r\n  CINIT(PROXYTYPE, LONG, 101),\r\n\r\n  /* Set the Accept-Encoding string. Use this to tell a server you would like\r\n     the response to be compressed. Before 7.21.6, this was known as\r\n     CURLOPT_ENCODING */\r\n  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),\r\n\r\n  /* Set pointer to private data */\r\n  CINIT(PRIVATE, OBJECTPOINT, 103),\r\n\r\n  /* Set aliases for HTTP 200 in the HTTP Response header */\r\n  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),\r\n\r\n  /* Continue to send authentication (user+password) when following locations,\r\n     even when hostname changed. This can potentially send off the name\r\n     and password to whatever host the server decides. */\r\n  CINIT(UNRESTRICTED_AUTH, LONG, 105),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPRT command (\r\n     it also disables the LPRT attempt). By default, those ones will always be\r\n     attempted before the good old traditional PORT command. */\r\n  CINIT(FTP_USE_EPRT, LONG, 106),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_USERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(HTTPAUTH, LONG, 107),\r\n\r\n  /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx\r\n     in second argument. The function must be matching the\r\n     curl_ssl_ctx_callback proto. */\r\n  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),\r\n\r\n  /* Set the userdata for the ssl context callback function's third\r\n     argument */\r\n  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),\r\n\r\n  /* FTP Option that causes missing dirs to be created on the remote server.\r\n     In 7.19.4 we introduced the convenience enums for this option using the\r\n     CURLFTP_CREATE_DIR prefix.\r\n  */\r\n  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(PROXYAUTH, LONG, 111),\r\n\r\n  /* FTP option that changes the timeout, in seconds, associated with\r\n     getting a response.  This is different from transfer timeout time and\r\n     essentially places a demand on the FTP server to acknowledge commands\r\n     in a timely manner. */\r\n  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),\r\n#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT\r\n\r\n  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to\r\n     tell libcurl to resolve names to those IP versions only. This only has\r\n     affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */\r\n  CINIT(IPRESOLVE, LONG, 113),\r\n\r\n  /* Set this option to limit the size of a file that will be downloaded from\r\n     an HTTP or FTP server.\r\n\r\n     Note there is also _LARGE version which adds large file support for\r\n     platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */\r\n  CINIT(MAXFILESIZE, LONG, 114),\r\n\r\n  /* See the comment for INFILESIZE above, but in short, specifies\r\n   * the size of the file being uploaded.  -1 means unknown.\r\n   */\r\n  CINIT(INFILESIZE_LARGE, OFF_T, 115),\r\n\r\n  /* Sets the continuation offset.  There is also a LONG version of this;\r\n   * look above for RESUME_FROM.\r\n   */\r\n  CINIT(RESUME_FROM_LARGE, OFF_T, 116),\r\n\r\n  /* Sets the maximum size of data that will be downloaded from\r\n   * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.\r\n   */\r\n  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),\r\n\r\n  /* Set this option to the file name of your .netrc file you want libcurl\r\n     to parse (using the CURLOPT_NETRC option). If not set, libcurl will do\r\n     a poor attempt to find the user's home directory and check for a .netrc\r\n     file in there. */\r\n  CINIT(NETRC_FILE, OBJECTPOINT, 118),\r\n\r\n  /* Enable SSL/TLS for FTP, pick one of:\r\n     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise\r\n     CURLUSESSL_CONTROL - SSL for the control connection or fail\r\n     CURLUSESSL_ALL     - SSL for all communication or fail\r\n  */\r\n  CINIT(USE_SSL, LONG, 119),\r\n\r\n  /* The _LARGE version of the standard POSTFIELDSIZE option */\r\n  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),\r\n\r\n  /* Enable/disable the TCP Nagle algorithm */\r\n  CINIT(TCP_NODELAY, LONG, 121),\r\n\r\n  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 123 OBSOLETE. Gone in 7.16.0 */\r\n  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 127 OBSOLETE. Gone in 7.16.0 */\r\n  /* 128 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option\r\n     can be used to change libcurl's default action which is to first try\r\n     \"AUTH SSL\" and then \"AUTH TLS\" in this order, and proceed when a OK\r\n     response has been received.\r\n\r\n     Available parameters are:\r\n     CURLFTPAUTH_DEFAULT - let libcurl decide\r\n     CURLFTPAUTH_SSL     - try \"AUTH SSL\" first, then TLS\r\n     CURLFTPAUTH_TLS     - try \"AUTH TLS\" first, then SSL\r\n  */\r\n  CINIT(FTPSSLAUTH, LONG, 129),\r\n\r\n  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),\r\n  CINIT(IOCTLDATA, OBJECTPOINT, 131),\r\n\r\n  /* 132 OBSOLETE. Gone in 7.16.0 */\r\n  /* 133 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* zero terminated string for pass on to the FTP server when asked for\r\n     \"account\" info */\r\n  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),\r\n\r\n  /* feed cookies into cookie engine */\r\n  CINIT(COOKIELIST, OBJECTPOINT, 135),\r\n\r\n  /* ignore Content-Length */\r\n  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),\r\n\r\n  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server\r\n     response. Typically used for FTP-SSL purposes but is not restricted to\r\n     that. libcurl will then instead use the same IP address it used for the\r\n     control connection. */\r\n  CINIT(FTP_SKIP_PASV_IP, LONG, 137),\r\n\r\n  /* Select \"file method\" to use when doing FTP, see the curl_ftpmethod\r\n     above. */\r\n  CINIT(FTP_FILEMETHOD, LONG, 138),\r\n\r\n  /* Local port number to bind the socket to */\r\n  CINIT(LOCALPORT, LONG, 139),\r\n\r\n  /* Number of ports to try, including the first one set with LOCALPORT.\r\n     Thus, setting it to 1 will make no additional attempts but the first.\r\n  */\r\n  CINIT(LOCALPORTRANGE, LONG, 140),\r\n\r\n  /* no transfer, set up connection and let application use the socket by\r\n     extracting it with CURLINFO_LASTSOCKET */\r\n  CINIT(CONNECT_ONLY, LONG, 141),\r\n\r\n  /* Function that will be called to convert from the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),\r\n\r\n  /* Function that will be called to convert to the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),\r\n\r\n  /* Function that will be called to convert from UTF8\r\n     (instead of using the iconv calls in libcurl)\r\n     Note that this is used only for SSL certificate processing */\r\n  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),\r\n\r\n  /* if the connection proceeds too quickly then need to slow it down */\r\n  /* limit-rate: maximum number of bytes per second to send or receive */\r\n  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),\r\n  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),\r\n\r\n  /* Pointer to command string to send if USER/PASS fails. */\r\n  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),\r\n\r\n  /* callback function for setting socket options */\r\n  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),\r\n  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),\r\n\r\n  /* set to 0 to disable session ID re-use for this transfer, default is\r\n     enabled (== 1) */\r\n  CINIT(SSL_SESSIONID_CACHE, LONG, 150),\r\n\r\n  /* allowed SSH authentication methods */\r\n  CINIT(SSH_AUTH_TYPES, LONG, 151),\r\n\r\n  /* Used by scp/sftp to do public/private key authentication */\r\n  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),\r\n  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),\r\n\r\n  /* Send CCC (Clear Command Channel) after authentication */\r\n  CINIT(FTP_SSL_CCC, LONG, 154),\r\n\r\n  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */\r\n  CINIT(TIMEOUT_MS, LONG, 155),\r\n  CINIT(CONNECTTIMEOUT_MS, LONG, 156),\r\n\r\n  /* set to zero to disable the libcurl's decoding and thus pass the raw body\r\n     data to the application even when it is encoded/compressed */\r\n  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),\r\n  CINIT(HTTP_CONTENT_DECODING, LONG, 158),\r\n\r\n  /* Permission used when creating new files and directories on the remote\r\n     server for protocols that support it, SFTP/SCP/FILE */\r\n  CINIT(NEW_FILE_PERMS, LONG, 159),\r\n  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),\r\n\r\n  /* Set the behaviour of POST when redirecting. Values must be set to one\r\n     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */\r\n  CINIT(POSTREDIR, LONG, 161),\r\n\r\n  /* used by scp/sftp to verify the host's public key */\r\n  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),\r\n\r\n  /* Callback function for opening socket (instead of socket(2)). Optionally,\r\n     callback is able change the address or refuse to connect returning\r\n     CURL_SOCKET_BAD.  The callback should have type\r\n     curl_opensocket_callback */\r\n  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),\r\n  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),\r\n\r\n  /* POST volatile input fields. */\r\n  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),\r\n\r\n  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */\r\n  CINIT(PROXY_TRANSFER_MODE, LONG, 166),\r\n\r\n  /* Callback function for seeking in the input stream */\r\n  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),\r\n  CINIT(SEEKDATA, OBJECTPOINT, 168),\r\n\r\n  /* CRL file */\r\n  CINIT(CRLFILE, OBJECTPOINT, 169),\r\n\r\n  /* Issuer certificate */\r\n  CINIT(ISSUERCERT, OBJECTPOINT, 170),\r\n\r\n  /* (IPv6) Address scope */\r\n  CINIT(ADDRESS_SCOPE, LONG, 171),\r\n\r\n  /* Collect certificate chain info and allow it to get retrievable with\r\n     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only\r\n     working with OpenSSL-powered builds. */\r\n  CINIT(CERTINFO, LONG, 172),\r\n\r\n  /* \"name\" and \"pwd\" to use when fetching. */\r\n  CINIT(USERNAME, OBJECTPOINT, 173),\r\n  CINIT(PASSWORD, OBJECTPOINT, 174),\r\n\r\n    /* \"name\" and \"pwd\" to use with Proxy when fetching. */\r\n  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),\r\n  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),\r\n\r\n  /* Comma separated list of hostnames defining no-proxy zones. These should\r\n     match both hostnames directly, and hostnames within a domain. For\r\n     example, local.com will match local.com and www.local.com, but NOT\r\n     notlocal.com or www.notlocal.com. For compatibility with other\r\n     implementations of this, .local.com will be considered to be the same as\r\n     local.com. A single * is the only valid wildcard, and effectively\r\n     disables the use of proxy. */\r\n  CINIT(NOPROXY, OBJECTPOINT, 177),\r\n\r\n  /* block size for TFTP transfers */\r\n  CINIT(TFTP_BLKSIZE, LONG, 178),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),\r\n\r\n  /* set the bitmask for the protocols that are allowed to be used for the\r\n     transfer, which thus helps the app which takes URLs from users or other\r\n     external inputs and want to restrict what protocol(s) to deal\r\n     with. Defaults to CURLPROTO_ALL. */\r\n  CINIT(PROTOCOLS, LONG, 181),\r\n\r\n  /* set the bitmask for the protocols that libcurl is allowed to follow to,\r\n     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs\r\n     to be set in both bitmasks to be allowed to get redirected to. Defaults\r\n     to all protocols except FILE and SCP. */\r\n  CINIT(REDIR_PROTOCOLS, LONG, 182),\r\n\r\n  /* set the SSH knownhost file name to use */\r\n  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),\r\n\r\n  /* set the SSH host key callback, must point to a curl_sshkeycallback\r\n     function */\r\n  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),\r\n\r\n  /* set the SSH host key callback custom pointer */\r\n  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),\r\n\r\n  /* set the SMTP mail originator */\r\n  CINIT(MAIL_FROM, OBJECTPOINT, 186),\r\n\r\n  /* set the SMTP mail receiver(s) */\r\n  CINIT(MAIL_RCPT, OBJECTPOINT, 187),\r\n\r\n  /* FTP: send PRET before PASV */\r\n  CINIT(FTP_USE_PRET, LONG, 188),\r\n\r\n  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */\r\n  CINIT(RTSP_REQUEST, LONG, 189),\r\n\r\n  /* The RTSP session identifier */\r\n  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),\r\n\r\n  /* The RTSP stream URI */\r\n  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),\r\n\r\n  /* The Transport: header to use in RTSP requests */\r\n  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),\r\n\r\n  /* Manually initialize the client RTSP CSeq for this handle */\r\n  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),\r\n\r\n  /* Manually initialize the server RTSP CSeq for this handle */\r\n  CINIT(RTSP_SERVER_CSEQ, LONG, 194),\r\n\r\n  /* The stream to pass to INTERLEAVEFUNCTION. */\r\n  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),\r\n\r\n  /* Let the application define a custom write method for RTP data */\r\n  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),\r\n\r\n  /* Turn on wildcard matching */\r\n  CINIT(WILDCARDMATCH, LONG, 197),\r\n\r\n  /* Directory matching callback called before downloading of an\r\n     individual file (chunk) started */\r\n  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),\r\n\r\n  /* Directory matching callback called after the file (chunk)\r\n     was downloaded, or skipped */\r\n  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),\r\n\r\n  /* Change match (fnmatch-like) callback for wildcard matching */\r\n  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),\r\n\r\n  /* Let the application define custom chunk data pointer */\r\n  CINIT(CHUNK_DATA, OBJECTPOINT, 201),\r\n\r\n  /* FNMATCH_FUNCTION user pointer */\r\n  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),\r\n\r\n  /* send linked-list of name:port:address sets */\r\n  CINIT(RESOLVE, OBJECTPOINT, 203),\r\n\r\n  /* Set a username for authenticated TLS */\r\n  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),\r\n\r\n  /* Set a password for authenticated TLS */\r\n  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),\r\n\r\n  /* Set authentication type for authenticated TLS */\r\n  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),\r\n\r\n  /* Set to 1 to enable the \"TE:\" header in HTTP requests to ask for\r\n     compressed transfer-encoded responses. Set to 0 to disable the use of TE:\r\n     in outgoing requests. The current default is 0, but it might change in a\r\n     future libcurl release.\r\n\r\n     libcurl will ask for the compressed methods it knows of, and if that\r\n     isn't any, it will not ask for transfer-encoding at all even if this\r\n     option is set to 1.\r\n\r\n  */\r\n  CINIT(TRANSFER_ENCODING, LONG, 207),\r\n\r\n  /* Callback function for closing socket (instead of close(2)). The callback\r\n     should have type curl_closesocket_callback */\r\n  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),\r\n  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),\r\n\r\n  /* allow GSSAPI credential delegation */\r\n  CINIT(GSSAPI_DELEGATION, LONG, 210),\r\n\r\n  /* Set the name servers to use for DNS resolution */\r\n  CINIT(DNS_SERVERS, OBJECTPOINT, 211),\r\n\r\n  /* Time-out accept operations (currently for FTP only) after this amount\r\n     of miliseconds. */\r\n  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),\r\n\r\n  /* Set TCP keepalive */\r\n  CINIT(TCP_KEEPALIVE, LONG, 213),\r\n\r\n  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */\r\n  CINIT(TCP_KEEPIDLE, LONG, 214),\r\n  CINIT(TCP_KEEPINTVL, LONG, 215),\r\n\r\n  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */\r\n  CINIT(SSL_OPTIONS, LONG, 216),\r\n\r\n  /* set the SMTP auth originator */\r\n  CINIT(MAIL_AUTH, OBJECTPOINT, 217),\r\n\r\n  CURLOPT_LASTENTRY /* the last unused */\r\n} CURLoption;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2011 */\r\n\r\n/* This was added in version 7.19.1 */\r\n#define CURLOPT_POST301 CURLOPT_POSTREDIR\r\n\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n/* The following were added in 7.17.0 */\r\n#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_FTPAPPEND CURLOPT_APPEND\r\n#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY\r\n#define CURLOPT_FTP_SSL CURLOPT_USE_SSL\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL\r\n\r\n#else\r\n/* This is set if CURL_NO_OLDIES is defined at compile-time */\r\n#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */\r\n#endif\r\n\r\n\r\n  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host\r\n     name resolves addresses using more than one IP protocol version, this\r\n     option might be handy to force libcurl to use a specific IP version. */\r\n#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP\r\n                                     versions that your system allows */\r\n#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */\r\n#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */\r\n\r\n  /* three convenient \"aliases\" that follow the name scheme better */\r\n#define CURLOPT_WRITEDATA CURLOPT_FILE\r\n#define CURLOPT_READDATA  CURLOPT_INFILE\r\n#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER\r\n#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER\r\n\r\n  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */\r\nenum {\r\n  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd\r\n                             like the library to choose the best possible\r\n                             for us! */\r\n  CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */\r\n  CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */\r\n\r\n  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */\r\n};\r\n\r\n/*\r\n * Public API enums for RTSP requests\r\n */\r\nenum {\r\n    CURL_RTSPREQ_NONE, /* first in list */\r\n    CURL_RTSPREQ_OPTIONS,\r\n    CURL_RTSPREQ_DESCRIBE,\r\n    CURL_RTSPREQ_ANNOUNCE,\r\n    CURL_RTSPREQ_SETUP,\r\n    CURL_RTSPREQ_PLAY,\r\n    CURL_RTSPREQ_PAUSE,\r\n    CURL_RTSPREQ_TEARDOWN,\r\n    CURL_RTSPREQ_GET_PARAMETER,\r\n    CURL_RTSPREQ_SET_PARAMETER,\r\n    CURL_RTSPREQ_RECORD,\r\n    CURL_RTSPREQ_RECEIVE,\r\n    CURL_RTSPREQ_LAST /* last in list */\r\n};\r\n\r\n  /* These enums are for use with the CURLOPT_NETRC option. */\r\nenum CURL_NETRC_OPTION {\r\n  CURL_NETRC_IGNORED,     /* The .netrc will never be read.\r\n                           * This is the default. */\r\n  CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred\r\n                           * to one in the .netrc. */\r\n  CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.\r\n                           * Unless one is set programmatically, the .netrc\r\n                           * will be queried. */\r\n  CURL_NETRC_LAST\r\n};\r\n\r\nenum {\r\n  CURL_SSLVERSION_DEFAULT,\r\n  CURL_SSLVERSION_TLSv1,\r\n  CURL_SSLVERSION_SSLv2,\r\n  CURL_SSLVERSION_SSLv3,\r\n\r\n  CURL_SSLVERSION_LAST /* never use, keep last */\r\n};\r\n\r\nenum CURL_TLSAUTH {\r\n  CURL_TLSAUTH_NONE,\r\n  CURL_TLSAUTH_SRP,\r\n  CURL_TLSAUTH_LAST /* never use, keep last */\r\n};\r\n\r\n/* symbols to use with CURLOPT_POSTREDIR.\r\n   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303\r\n   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302\r\n   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */\r\n\r\n#define CURL_REDIR_GET_ALL  0\r\n#define CURL_REDIR_POST_301 1\r\n#define CURL_REDIR_POST_302 2\r\n#define CURL_REDIR_POST_303 4\r\n#define CURL_REDIR_POST_ALL \\\r\n    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)\r\n\r\ntypedef enum {\r\n  CURL_TIMECOND_NONE,\r\n\r\n  CURL_TIMECOND_IFMODSINCE,\r\n  CURL_TIMECOND_IFUNMODSINCE,\r\n  CURL_TIMECOND_LASTMOD,\r\n\r\n  CURL_TIMECOND_LAST\r\n} curl_TimeCond;\r\n\r\n\r\n/* curl_strequal() and curl_strnequal() are subject for removal in a future\r\n   libcurl, see lib/README.curlx for details */\r\nCURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);\r\nCURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);\r\n\r\n/* name is uppercase CURLFORM_<name> */\r\n#ifdef CFINIT\r\n#undef CFINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CFINIT(name) CURLFORM_ ## name\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define CFINIT(name) CURLFORM_/**/name\r\n#endif\r\n\r\ntypedef enum {\r\n  CFINIT(NOTHING),        /********* the first one is unused ************/\r\n\r\n  /*  */\r\n  CFINIT(COPYNAME),\r\n  CFINIT(PTRNAME),\r\n  CFINIT(NAMELENGTH),\r\n  CFINIT(COPYCONTENTS),\r\n  CFINIT(PTRCONTENTS),\r\n  CFINIT(CONTENTSLENGTH),\r\n  CFINIT(FILECONTENT),\r\n  CFINIT(ARRAY),\r\n  CFINIT(OBSOLETE),\r\n  CFINIT(FILE),\r\n\r\n  CFINIT(BUFFER),\r\n  CFINIT(BUFFERPTR),\r\n  CFINIT(BUFFERLENGTH),\r\n\r\n  CFINIT(CONTENTTYPE),\r\n  CFINIT(CONTENTHEADER),\r\n  CFINIT(FILENAME),\r\n  CFINIT(END),\r\n  CFINIT(OBSOLETE2),\r\n\r\n  CFINIT(STREAM),\r\n\r\n  CURLFORM_LASTENTRY /* the last unused */\r\n} CURLformoption;\r\n\r\n#undef CFINIT /* done */\r\n\r\n/* structure to be used as parameter for CURLFORM_ARRAY */\r\nstruct curl_forms {\r\n  CURLformoption option;\r\n  const char     *value;\r\n};\r\n\r\n/* use this for multipart formpost building */\r\n/* Returns code for curl_formadd()\r\n *\r\n * Returns:\r\n * CURL_FORMADD_OK             on success\r\n * CURL_FORMADD_MEMORY         if the FormInfo allocation fails\r\n * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form\r\n * CURL_FORMADD_NULL           if a null pointer was given for a char\r\n * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed\r\n * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used\r\n * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)\r\n * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated\r\n * CURL_FORMADD_MEMORY         if some allocation for string copying failed.\r\n * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array\r\n *\r\n ***************************************************************************/\r\ntypedef enum {\r\n  CURL_FORMADD_OK, /* first, no error */\r\n\r\n  CURL_FORMADD_MEMORY,\r\n  CURL_FORMADD_OPTION_TWICE,\r\n  CURL_FORMADD_NULL,\r\n  CURL_FORMADD_UNKNOWN_OPTION,\r\n  CURL_FORMADD_INCOMPLETE,\r\n  CURL_FORMADD_ILLEGAL_ARRAY,\r\n  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */\r\n\r\n  CURL_FORMADD_LAST /* last */\r\n} CURLFORMcode;\r\n\r\n/*\r\n * NAME curl_formadd()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Pretty advanced function for building multi-part formposts. Each invoke\r\n * adds one part that together construct a full post. Then use\r\n * CURLOPT_HTTPPOST to send it off to libcurl.\r\n */\r\nCURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,\r\n                                      struct curl_httppost **last_post,\r\n                                      ...);\r\n\r\n/*\r\n * callback function for curl_formget()\r\n * The void *arg pointer will be the one passed as second argument to\r\n *   curl_formget().\r\n * The character buffer passed to it must not be freed.\r\n * Should return the buffer length passed to it as the argument \"len\" on\r\n *   success.\r\n */\r\ntypedef size_t (*curl_formget_callback)(void *arg, const char *buf,\r\n                                        size_t len);\r\n\r\n/*\r\n * NAME curl_formget()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Serialize a curl_httppost struct built with curl_formadd().\r\n * Accepts a void pointer as second argument which will be passed to\r\n * the curl_formget_callback function.\r\n * Returns 0 on success.\r\n */\r\nCURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,\r\n                             curl_formget_callback append);\r\n/*\r\n * NAME curl_formfree()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Free a multipart formpost previously built with curl_formadd().\r\n */\r\nCURL_EXTERN void curl_formfree(struct curl_httppost *form);\r\n\r\n/*\r\n * NAME curl_getenv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a malloc()'ed string that MUST be curl_free()ed after usage is\r\n * complete. DEPRECATED - see lib/README.curlx\r\n */\r\nCURL_EXTERN char *curl_getenv(const char *variable);\r\n\r\n/*\r\n * NAME curl_version()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a static ascii string of the libcurl version.\r\n */\r\nCURL_EXTERN char *curl_version(void);\r\n\r\n/*\r\n * NAME curl_easy_escape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Escapes URL strings (converts all letters consider illegal in URLs to their\r\n * %XX versions). This function returns a new allocated string or NULL if an\r\n * error occurred.\r\n */\r\nCURL_EXTERN char *curl_easy_escape(CURL *handle,\r\n                                   const char *string,\r\n                                   int length);\r\n\r\n/* the previous version: */\r\nCURL_EXTERN char *curl_escape(const char *string,\r\n                              int length);\r\n\r\n\r\n/*\r\n * NAME curl_easy_unescape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Unescapes URL encoding in strings (converts all %XX codes to their 8bit\r\n * versions). This function returns a new allocated string or NULL if an error\r\n * occurred.\r\n * Conversion Note: On non-ASCII platforms the ASCII %XX codes are\r\n * converted into the host encoding.\r\n */\r\nCURL_EXTERN char *curl_easy_unescape(CURL *handle,\r\n                                     const char *string,\r\n                                     int length,\r\n                                     int *outlength);\r\n\r\n/* the previous version */\r\nCURL_EXTERN char *curl_unescape(const char *string,\r\n                                int length);\r\n\r\n/*\r\n * NAME curl_free()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Provided for de-allocation in the same translation unit that did the\r\n * allocation. Added in libcurl 7.10\r\n */\r\nCURL_EXTERN void curl_free(void *p);\r\n\r\n/*\r\n * NAME curl_global_init()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() should be invoked exactly once for each application that\r\n * uses libcurl and before any call of other libcurl functions.\r\n *\r\n * This function is not thread-safe!\r\n */\r\nCURL_EXTERN CURLcode curl_global_init(long flags);\r\n\r\n/*\r\n * NAME curl_global_init_mem()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() or curl_global_init_mem() should be invoked exactly once\r\n * for each application that uses libcurl.  This function can be used to\r\n * initialize libcurl and set user defined memory management callback\r\n * functions.  Users can implement memory management routines to check for\r\n * memory leaks, check for mis-use of the curl library etc.  User registered\r\n * callback routines with be invoked by this library instead of the system\r\n * memory management routines like malloc, free etc.\r\n */\r\nCURL_EXTERN CURLcode curl_global_init_mem(long flags,\r\n                                          curl_malloc_callback m,\r\n                                          curl_free_callback f,\r\n                                          curl_realloc_callback r,\r\n                                          curl_strdup_callback s,\r\n                                          curl_calloc_callback c);\r\n\r\n/*\r\n * NAME curl_global_cleanup()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_cleanup() should be invoked exactly once for each application\r\n * that uses libcurl\r\n */\r\nCURL_EXTERN void curl_global_cleanup(void);\r\n\r\n/* linked-list structure for the CURLOPT_QUOTE option (and other) */\r\nstruct curl_slist {\r\n  char *data;\r\n  struct curl_slist *next;\r\n};\r\n\r\n/*\r\n * NAME curl_slist_append()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Appends a string to a linked list. If no list exists, it will be created\r\n * first. Returns the new list, after appending.\r\n */\r\nCURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,\r\n                                                 const char *);\r\n\r\n/*\r\n * NAME curl_slist_free_all()\r\n *\r\n * DESCRIPTION\r\n *\r\n * free a previously built curl_slist.\r\n */\r\nCURL_EXTERN void curl_slist_free_all(struct curl_slist *);\r\n\r\n/*\r\n * NAME curl_getdate()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns the time, in seconds since 1 Jan 1970 of the time string given in\r\n * the first argument. The time argument in the second parameter is unused\r\n * and should be set to NULL.\r\n */\r\nCURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);\r\n\r\n/* info about the certificate chain, only for OpenSSL builds. Asked\r\n   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */\r\nstruct curl_certinfo {\r\n  int num_of_certs;             /* number of certificates with information */\r\n  struct curl_slist **certinfo; /* for each index in this array, there's a\r\n                                   linked list with textual information in the\r\n                                   format \"name: value\" */\r\n};\r\n\r\n#define CURLINFO_STRING   0x100000\r\n#define CURLINFO_LONG     0x200000\r\n#define CURLINFO_DOUBLE   0x300000\r\n#define CURLINFO_SLIST    0x400000\r\n#define CURLINFO_MASK     0x0fffff\r\n#define CURLINFO_TYPEMASK 0xf00000\r\n\r\ntypedef enum {\r\n  CURLINFO_NONE, /* first, never use this */\r\n  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,\r\n  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,\r\n  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,\r\n  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,\r\n  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,\r\n  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,\r\n  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,\r\n  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,\r\n  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,\r\n  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,\r\n  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,\r\n  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,\r\n  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,\r\n  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,\r\n  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,\r\n  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,\r\n  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,\r\n  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,\r\n  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,\r\n  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,\r\n  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,\r\n  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,\r\n  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,\r\n  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,\r\n  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,\r\n  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,\r\n  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,\r\n  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,\r\n  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,\r\n  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,\r\n  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,\r\n  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,\r\n  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,\r\n  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,\r\n  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,\r\n  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,\r\n  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,\r\n  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,\r\n  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,\r\n  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,\r\n  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,\r\n  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,\r\n  /* Fill in new entries below here! */\r\n\r\n  CURLINFO_LASTONE          = 42\r\n} CURLINFO;\r\n\r\n/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as\r\n   CURLINFO_HTTP_CODE */\r\n#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE\r\n\r\ntypedef enum {\r\n  CURLCLOSEPOLICY_NONE, /* first, never use this */\r\n\r\n  CURLCLOSEPOLICY_OLDEST,\r\n  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,\r\n  CURLCLOSEPOLICY_LEAST_TRAFFIC,\r\n  CURLCLOSEPOLICY_SLOWEST,\r\n  CURLCLOSEPOLICY_CALLBACK,\r\n\r\n  CURLCLOSEPOLICY_LAST /* last, never use this */\r\n} curl_closepolicy;\r\n\r\n#define CURL_GLOBAL_SSL (1<<0)\r\n#define CURL_GLOBAL_WIN32 (1<<1)\r\n#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)\r\n#define CURL_GLOBAL_NOTHING 0\r\n#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL\r\n\r\n\r\n/*****************************************************************************\r\n * Setup defines, protos etc for the sharing stuff.\r\n */\r\n\r\n/* Different data locks for a single share */\r\ntypedef enum {\r\n  CURL_LOCK_DATA_NONE = 0,\r\n  /*  CURL_LOCK_DATA_SHARE is used internally to say that\r\n   *  the locking is just made to change the internal state of the share\r\n   *  itself.\r\n   */\r\n  CURL_LOCK_DATA_SHARE,\r\n  CURL_LOCK_DATA_COOKIE,\r\n  CURL_LOCK_DATA_DNS,\r\n  CURL_LOCK_DATA_SSL_SESSION,\r\n  CURL_LOCK_DATA_CONNECT,\r\n  CURL_LOCK_DATA_LAST\r\n} curl_lock_data;\r\n\r\n/* Different lock access types */\r\ntypedef enum {\r\n  CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */\r\n  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */\r\n  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */\r\n  CURL_LOCK_ACCESS_LAST        /* never use */\r\n} curl_lock_access;\r\n\r\ntypedef void (*curl_lock_function)(CURL *handle,\r\n                                   curl_lock_data data,\r\n                                   curl_lock_access locktype,\r\n                                   void *userptr);\r\ntypedef void (*curl_unlock_function)(CURL *handle,\r\n                                     curl_lock_data data,\r\n                                     void *userptr);\r\n\r\ntypedef void CURLSH;\r\n\r\ntypedef enum {\r\n  CURLSHE_OK,  /* all is fine */\r\n  CURLSHE_BAD_OPTION, /* 1 */\r\n  CURLSHE_IN_USE,     /* 2 */\r\n  CURLSHE_INVALID,    /* 3 */\r\n  CURLSHE_NOMEM,      /* 4 out of memory */\r\n  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */\r\n  CURLSHE_LAST        /* never use */\r\n} CURLSHcode;\r\n\r\ntypedef enum {\r\n  CURLSHOPT_NONE,  /* don't use */\r\n  CURLSHOPT_SHARE,   /* specify a data type to share */\r\n  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */\r\n  CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */\r\n  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */\r\n  CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock\r\n                           callback functions */\r\n  CURLSHOPT_LAST  /* never use */\r\n} CURLSHoption;\r\n\r\nCURL_EXTERN CURLSH *curl_share_init(void);\r\nCURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);\r\nCURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);\r\n\r\n/****************************************************************************\r\n * Structures for querying information about the curl library at runtime.\r\n */\r\n\r\ntypedef enum {\r\n  CURLVERSION_FIRST,\r\n  CURLVERSION_SECOND,\r\n  CURLVERSION_THIRD,\r\n  CURLVERSION_FOURTH,\r\n  CURLVERSION_LAST /* never actually use this */\r\n} CURLversion;\r\n\r\n/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by\r\n   basically all programs ever that want to get version information. It is\r\n   meant to be a built-in version number for what kind of struct the caller\r\n   expects. If the struct ever changes, we redefine the NOW to another enum\r\n   from above. */\r\n#define CURLVERSION_NOW CURLVERSION_FOURTH\r\n\r\ntypedef struct {\r\n  CURLversion age;          /* age of the returned struct */\r\n  const char *version;      /* LIBCURL_VERSION */\r\n  unsigned int version_num; /* LIBCURL_VERSION_NUM */\r\n  const char *host;         /* OS/host/cpu/machine when configured */\r\n  int features;             /* bitmask, see defines below */\r\n  const char *ssl_version;  /* human readable string */\r\n  long ssl_version_num;     /* not used anymore, always 0 */\r\n  const char *libz_version; /* human readable string */\r\n  /* protocols is terminated by an entry with a NULL protoname */\r\n  const char * const *protocols;\r\n\r\n  /* The fields below this were added in CURLVERSION_SECOND */\r\n  const char *ares;\r\n  int ares_num;\r\n\r\n  /* This field was added in CURLVERSION_THIRD */\r\n  const char *libidn;\r\n\r\n  /* These field were added in CURLVERSION_FOURTH */\r\n\r\n  /* Same as '_libiconv_version' if built with HAVE_ICONV */\r\n  int iconv_ver_num;\r\n\r\n  const char *libssh_version; /* human readable string */\r\n\r\n} curl_version_info_data;\r\n\r\n#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */\r\n#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */\r\n#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */\r\n#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */\r\n#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */\r\n#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */\r\n#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */\r\n#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */\r\n#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */\r\n#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */\r\n#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */\r\n#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */\r\n#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */\r\n#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */\r\n#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */\r\n#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM delegating to winbind helper */\r\n\r\n /*\r\n * NAME curl_version_info()\r\n *\r\n * DESCRIPTION\r\n *\r\n * This function returns a pointer to a static copy of the version info\r\n * struct. See above.\r\n */\r\nCURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);\r\n\r\n/*\r\n * NAME curl_easy_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_strerror function may be used to turn a CURLcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_easy_strerror(CURLcode);\r\n\r\n/*\r\n * NAME curl_share_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_share_strerror function may be used to turn a CURLSHcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_share_strerror(CURLSHcode);\r\n\r\n/*\r\n * NAME curl_easy_pause()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_pause function pauses or unpauses transfers. Select the new\r\n * state by setting the bitmask, use the convenience defines below.\r\n *\r\n */\r\nCURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);\r\n\r\n#define CURLPAUSE_RECV      (1<<0)\r\n#define CURLPAUSE_RECV_CONT (0)\r\n\r\n#define CURLPAUSE_SEND      (1<<2)\r\n#define CURLPAUSE_SEND_CONT (0)\r\n\r\n#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)\r\n#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n/* unfortunately, the easy.h and multi.h include files need options and info\r\n  stuff before they can be included! */\r\n#include \"easy.h\" /* nothing in curl is fun without the easy stuff */\r\n#include \"multi.h\"\r\n\r\n/* the typechecker doesn't work in C++ (yet) */\r\n#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \\\r\n    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \\\r\n    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)\r\n#include \"typecheck-gcc.h\"\r\n#else\r\n#if defined(__STDC__) && (__STDC__ >= 1)\r\n/* This preprocessor magic that replaces a call with the exact same call is\r\n   only done to make sure application authors pass exactly three arguments\r\n   to these functions. */\r\n#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)\r\n#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n#endif /* __STDC__ >= 1 */\r\n#endif /* gcc >= 4.3 && !__cplusplus */\r\n\r\n#endif /* __CURL_CURL_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/curlbuild.h",
    "content": "/* include/curl/curlbuild.h.  Generated from curlbuild.h.in by configure.  */\r\n#ifndef __CURL_CURLBUILD_H\r\n#define __CURL_CURLBUILD_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * If you think that something actually needs to be changed, adjusted\r\n * or fixed in this file, then, report it on the libcurl development\r\n * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * This header file shall only export symbols which are 'curl' or 'CURL'\r\n * prefixed, otherwise public name space would be polluted.\r\n *\r\n * NOTE 2:\r\n * -------\r\n *\r\n * Right now you might be staring at file include/curl/curlbuild.h.in or\r\n * at file include/curl/curlbuild.h, this is due to the following reason:\r\n *\r\n * On systems capable of running the configure script, the configure process\r\n * will overwrite the distributed include/curl/curlbuild.h file with one that\r\n * is suitable and specific to the library being configured and built, which\r\n * is generated from the include/curl/curlbuild.h.in template file.\r\n *\r\n */\r\n\r\n/* ================================================================ */\r\n/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */\r\n/* ================================================================ */\r\n\r\n#ifdef CURL_SIZEOF_LONG\r\n#error \"CURL_SIZEOF_LONG shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#error \"CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#error \"CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_OFF_T\r\n#error \"CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_T\r\n#error \"CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_TU\r\n#error \"CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_OFF_T\r\n#error \"CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_OFF_T\r\n#error \"CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_T\r\n#error \"CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_TU\r\n#error \"CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n/* ================================================================ */\r\n/*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */\r\n/* ================================================================ */\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file ws2tcpip.h must be included by the external interface. */\r\n/* #undef CURL_PULL_WS2TCPIP_H */\r\n#ifdef CURL_PULL_WS2TCPIP_H\r\n#  ifndef WIN32_LEAN_AND_MEAN\r\n#    define WIN32_LEAN_AND_MEAN\r\n#  endif\r\n#  include <windows.h>\r\n#  include <winsock2.h>\r\n#  include <ws2tcpip.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system   */\r\n/* header file sys/types.h must be included by the external interface. */\r\n#define CURL_PULL_SYS_TYPES_H 1\r\n#ifdef CURL_PULL_SYS_TYPES_H\r\n#  include <sys/types.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system */\r\n/* header file stdint.h must be included by the external interface.  */\r\n#define CURL_PULL_STDINT_H 1\r\n#ifdef CURL_PULL_STDINT_H\r\n#  include <stdint.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file inttypes.h must be included by the external interface. */\r\n#define CURL_PULL_INTTYPES_H 1\r\n#ifdef CURL_PULL_INTTYPES_H\r\n#  include <inttypes.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system    */\r\n/* header file sys/socket.h must be included by the external interface. */\r\n#define CURL_PULL_SYS_SOCKET_H 1\r\n#ifdef CURL_PULL_SYS_SOCKET_H\r\n#  include <sys/socket.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file sys/poll.h must be included by the external interface. */\r\n/* #undef CURL_PULL_SYS_POLL_H */\r\n#ifdef CURL_PULL_SYS_POLL_H\r\n#  include <sys/poll.h>\r\n#endif\r\n\r\n/* The size of `long', as computed by sizeof. */\r\n#define CURL_SIZEOF_LONG 4\r\n\r\n/* Integral data type used for curl_socklen_t. */\r\n#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n\r\n/* The size of `curl_socklen_t', as computed by sizeof. */\r\n#define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n/* Data type definition of curl_socklen_t. */\r\ntypedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;\r\n\r\n/* Signed integral data type used for curl_off_t. */\r\n#define CURL_TYPEOF_CURL_OFF_T int64_t\r\n\r\n/* Data type definition of curl_off_t. */\r\ntypedef CURL_TYPEOF_CURL_OFF_T curl_off_t;\r\n\r\n/* curl_off_t formatting string directive without \"%\" conversion specifier. */\r\n#define CURL_FORMAT_CURL_OFF_T \"lld\"\r\n\r\n/* unsigned curl_off_t formatting string without \"%\" conversion specifier. */\r\n#define CURL_FORMAT_CURL_OFF_TU \"llu\"\r\n\r\n/* curl_off_t formatting string directive with \"%\" conversion specifier. */\r\n#define CURL_FORMAT_OFF_T \"%lld\"\r\n\r\n/* The size of `curl_off_t', as computed by sizeof. */\r\n#define CURL_SIZEOF_CURL_OFF_T 8\r\n\r\n/* curl_off_t constant suffix. */\r\n#define CURL_SUFFIX_CURL_OFF_T LL\r\n\r\n/* unsigned curl_off_t constant suffix. */\r\n#define CURL_SUFFIX_CURL_OFF_TU ULL\r\n\r\n#endif /* __CURL_CURLBUILD_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/curlrules.h",
    "content": "#ifndef __CURL_CURLRULES_H\r\n#define __CURL_CURLRULES_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*                    COMPILE TIME SANITY CHECKS                    */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * All checks done in this file are intentionally placed in a public\r\n * header file which is pulled by curl/curl.h when an application is\r\n * being built using an already built libcurl library. Additionally\r\n * this file is also included and used when building the library.\r\n *\r\n * If compilation fails on this file it is certainly sure that the\r\n * problem is elsewhere. It could be a problem in the curlbuild.h\r\n * header file, or simply that you are using different compilation\r\n * settings than those used to build the library.\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * Do not deactivate any check, these are done to make sure that the\r\n * library is properly built and used.\r\n *\r\n * You can find further help on the libcurl development mailing list:\r\n * http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * NOTE 2\r\n * ------\r\n *\r\n * Some of the following compile time checks are based on the fact\r\n * that the dimension of a constant array can not be a negative one.\r\n * In this way if the compile time verification fails, the compilation\r\n * will fail issuing an error. The error description wording is compiler\r\n * dependent but it will be quite similar to one of the following:\r\n *\r\n *   \"negative subscript or subscript is too large\"\r\n *   \"array must have at least one element\"\r\n *   \"-1 is an illegal array size\"\r\n *   \"size of array is negative\"\r\n *\r\n * If you are building an application which tries to use an already\r\n * built libcurl library and you are getting this kind of errors on\r\n * this file, it is a clear indication that there is a mismatch between\r\n * how the library was built and how you are trying to use it for your\r\n * application. Your already compiled or binary library provider is the\r\n * only one who can give you the details you need to properly use it.\r\n */\r\n\r\n/*\r\n * Verify that some macros are actually defined.\r\n */\r\n\r\n#ifndef CURL_SIZEOF_LONG\r\n#  error \"CURL_SIZEOF_LONG definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_OFF_T\r\n#  error \"CURL_TYPEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_T\r\n#  error \"CURL_FORMAT_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_TU\r\n#  error \"CURL_FORMAT_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_OFF_T\r\n#  error \"CURL_FORMAT_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_OFF_T\r\n#  error \"CURL_SIZEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_T\r\n#  error \"CURL_SUFFIX_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_TU\r\n#  error \"CURL_SUFFIX_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n/*\r\n * Macros private to this header file.\r\n */\r\n\r\n#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1\r\n\r\n#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1\r\n\r\n/*\r\n * Verify that the size previously defined and expected for long\r\n * is the same as the one reported by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_01__\r\n    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_off_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_02__\r\n    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_off_t as reported\r\n * by sizeof() is greater or equal than the one reported for long\r\n * for the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_03__\r\n    [CurlchkszGE(curl_off_t, long)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_socklen_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_04__\r\n    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_socklen_t as reported\r\n * by sizeof() is greater or equal than the one reported for int for\r\n * the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_05__\r\n    [CurlchkszGE(curl_socklen_t, int)];\r\n\r\n/* ================================================================ */\r\n/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */\r\n/* ================================================================ */\r\n\r\n/*\r\n * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow\r\n * these to be visible and exported by the external libcurl interface API,\r\n * while also making them visible to the library internals, simply including\r\n * curl_setup.h, without actually needing to include curl.h internally.\r\n * If some day this section would grow big enough, all this should be moved\r\n * to its own header file.\r\n */\r\n\r\n/*\r\n * Figure out if we can use the ## preprocessor operator, which is supported\r\n * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__\r\n * or  __cplusplus so we need to carefully check for them too.\r\n */\r\n\r\n#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \\\r\n  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \\\r\n  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \\\r\n  defined(__ILEC400__)\r\n  /* This compiler is believed to have an ISO compatible preprocessor */\r\n#define CURL_ISOCPP\r\n#else\r\n  /* This compiler is believed NOT to have an ISO compatible preprocessor */\r\n#undef CURL_ISOCPP\r\n#endif\r\n\r\n/*\r\n * Macros for minimum-width signed and unsigned curl_off_t integer constants.\r\n */\r\n\r\n#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)\r\n#  define __CURL_OFF_T_C_HLPR2(x) x\r\n#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)\r\n#else\r\n#  ifdef CURL_ISOCPP\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix\r\n#  else\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix\r\n#  endif\r\n#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)\r\n#endif\r\n\r\n/*\r\n * Get rid of macros private to this header file.\r\n */\r\n\r\n#undef CurlchkszEQ\r\n#undef CurlchkszGE\r\n\r\n/*\r\n * Get rid of macros not intended to exist beyond this point.\r\n */\r\n\r\n#undef CURL_PULL_WS2TCPIP_H\r\n#undef CURL_PULL_SYS_TYPES_H\r\n#undef CURL_PULL_SYS_SOCKET_H\r\n#undef CURL_PULL_SYS_POLL_H\r\n#undef CURL_PULL_STDINT_H\r\n#undef CURL_PULL_INTTYPES_H\r\n\r\n#undef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#undef CURL_TYPEOF_CURL_OFF_T\r\n\r\n#ifdef CURL_NO_OLDIES\r\n#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */\r\n#endif\r\n\r\n#endif /* __CURL_CURLRULES_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/curlver.h",
    "content": "#ifndef __CURL_CURLVER_H\r\n#define __CURL_CURLVER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* This header file contains nothing but libcurl version info, generated by\r\n   a script at release-time. This was made its own header file in 7.11.2 */\r\n\r\n/* This is the global package copyright */\r\n#define LIBCURL_COPYRIGHT \"1996 - 2013 Daniel Stenberg, <daniel@haxx.se>.\"\r\n\r\n/* This is the version number of the libcurl package from which this header\r\n   file origins: */\r\n#define LIBCURL_VERSION \"7.29.0\"\r\n\r\n/* The numeric version number is also available \"in parts\" by using these\r\n   defines: */\r\n#define LIBCURL_VERSION_MAJOR 7\r\n#define LIBCURL_VERSION_MINOR 29\r\n#define LIBCURL_VERSION_PATCH 0\r\n\r\n/* This is the numeric version of the libcurl version number, meant for easier\r\n   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will\r\n   always follow this syntax:\r\n\r\n         0xXXYYZZ\r\n\r\n   Where XX, YY and ZZ are the main version, release and patch numbers in\r\n   hexadecimal (using 8 bits each). All three numbers are always represented\r\n   using two digits.  1.2 would appear as \"0x010200\" while version 9.11.7\r\n   appears as \"0x090b07\".\r\n\r\n   This 6-digit (24 bits) hexadecimal number does not show pre-release number,\r\n   and it is always a greater number in a more recent release. It makes\r\n   comparisons with greater than and less than work.\r\n*/\r\n#define LIBCURL_VERSION_NUM 0x071d00\r\n\r\n/*\r\n * This is the date and time when the full source package was created. The\r\n * timestamp is not stored in git, as the timestamp is properly set in the\r\n * tarballs by the maketgz script.\r\n *\r\n * The format of the date should follow this template:\r\n *\r\n * \"Mon Feb 12 11:35:33 UTC 2007\"\r\n */\r\n#define LIBCURL_TIMESTAMP \"Wed Feb  6 10:13:08 UTC 2013\"\r\n\r\n#endif /* __CURL_CURLVER_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/easy.h",
    "content": "#ifndef __CURL_EASY_H\r\n#define __CURL_EASY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN CURL *curl_easy_init(void);\r\nCURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);\r\nCURL_EXTERN CURLcode curl_easy_perform(CURL *curl);\r\nCURL_EXTERN void curl_easy_cleanup(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_getinfo()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Request internal information from the curl session with this function.  The\r\n * third argument MUST be a pointer to a long, a pointer to a char * or a\r\n * pointer to a double (as the documentation describes elsewhere).  The data\r\n * pointed to will be filled in accordingly and can be relied upon only if the\r\n * function returns CURLE_OK.  This function is intended to get used *AFTER* a\r\n * performed transfer, all results from this function are undefined until the\r\n * transfer is completed.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);\r\n\r\n\r\n/*\r\n * NAME curl_easy_duphandle()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Creates a new curl session handle with the same options set for the handle\r\n * passed in. Duplicating a handle could only be a matter of cloning data and\r\n * options, internal state info and things like persistent connections cannot\r\n * be transferred. It is useful in multithreaded applications when you can run\r\n * curl_easy_duphandle() for each new thread to avoid a series of identical\r\n * curl_easy_setopt() invokes in every thread.\r\n */\r\nCURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_reset()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Re-initializes a CURL handle to the default values. This puts back the\r\n * handle to the same state as it was in when it was just created.\r\n *\r\n * It does keep: live connections, the Session ID cache, the DNS cache and the\r\n * cookies.\r\n */\r\nCURL_EXTERN void curl_easy_reset(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_recv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Receives data from the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,\r\n                                    size_t *n);\r\n\r\n/*\r\n * NAME curl_easy_send()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Sends data over the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,\r\n                                    size_t buflen, size_t *n);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/mprintf.h",
    "content": "#ifndef __CURL_MPRINTF_H\r\n#define __CURL_MPRINTF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <stdarg.h>\r\n#include <stdio.h> /* needed for FILE */\r\n\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN int curl_mprintf(const char *format, ...);\r\nCURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);\r\nCURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);\r\nCURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,\r\n                               const char *format, ...);\r\nCURL_EXTERN int curl_mvprintf(const char *format, va_list args);\r\nCURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,\r\n                                const char *format, va_list args);\r\nCURL_EXTERN char *curl_maprintf(const char *format, ...);\r\nCURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);\r\n\r\n#ifdef _MPRINTF_REPLACE\r\n# undef printf\r\n# undef fprintf\r\n# undef sprintf\r\n# undef vsprintf\r\n# undef snprintf\r\n# undef vprintf\r\n# undef vfprintf\r\n# undef vsnprintf\r\n# undef aprintf\r\n# undef vaprintf\r\n# define printf curl_mprintf\r\n# define fprintf curl_mfprintf\r\n#ifdef CURLDEBUG\r\n/* When built with CURLDEBUG we define away the sprintf() functions since we\r\n   don't want internal code to be using them */\r\n# define sprintf sprintf_was_used\r\n# define vsprintf vsprintf_was_used\r\n#else\r\n# define sprintf curl_msprintf\r\n# define vsprintf curl_mvsprintf\r\n#endif\r\n# define snprintf curl_msnprintf\r\n# define vprintf curl_mvprintf\r\n# define vfprintf curl_mvfprintf\r\n# define vsnprintf curl_mvsnprintf\r\n# define aprintf curl_maprintf\r\n# define vaprintf curl_mvaprintf\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* __CURL_MPRINTF_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/multi.h",
    "content": "#ifndef __CURL_MULTI_H\r\n#define __CURL_MULTI_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n  This is an \"external\" header file. Don't give away any internals here!\r\n\r\n  GOALS\r\n\r\n  o Enable a \"pull\" interface. The application that uses libcurl decides where\r\n    and when to ask libcurl to get/send data.\r\n\r\n  o Enable multiple simultaneous transfers in the same thread without making it\r\n    complicated for the application.\r\n\r\n  o Enable the application to select() on its own file descriptors and curl's\r\n    file descriptors simultaneous easily.\r\n\r\n*/\r\n\r\n/*\r\n * This header file should not really need to include \"curl.h\" since curl.h\r\n * itself includes this file and we expect user applications to do #include\r\n * <curl/curl.h> without the need for especially including multi.h.\r\n *\r\n * For some reason we added this include here at one point, and rather than to\r\n * break existing (wrongly written) libcurl applications, we leave it as-is\r\n * but with this warning attached.\r\n */\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURLM;\r\n\r\ntypedef enum {\r\n  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or\r\n                                    curl_multi_socket*() soon */\r\n  CURLM_OK,\r\n  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */\r\n  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */\r\n  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */\r\n  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */\r\n  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */\r\n  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */\r\n  CURLM_LAST\r\n} CURLMcode;\r\n\r\n/* just to make code nicer when using curl_multi_socket() you can now check\r\n   for CURLM_CALL_MULTI_SOCKET too in the same style it works for\r\n   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */\r\n#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM\r\n\r\ntypedef enum {\r\n  CURLMSG_NONE, /* first, not used */\r\n  CURLMSG_DONE, /* This easy handle has completed. 'result' contains\r\n                   the CURLcode of the transfer */\r\n  CURLMSG_LAST /* last, not used */\r\n} CURLMSG;\r\n\r\nstruct CURLMsg {\r\n  CURLMSG msg;       /* what this message means */\r\n  CURL *easy_handle; /* the handle it concerns */\r\n  union {\r\n    void *whatever;    /* message-specific data */\r\n    CURLcode result;   /* return code for transfer */\r\n  } data;\r\n};\r\ntypedef struct CURLMsg CURLMsg;\r\n\r\n/* Based on poll(2) structure and values.\r\n * We don't use pollfd and POLL* constants explicitly\r\n * to cover platforms without poll(). */\r\n#define CURL_WAIT_POLLIN    0x0001\r\n#define CURL_WAIT_POLLPRI   0x0002\r\n#define CURL_WAIT_POLLOUT   0x0004\r\n\r\nstruct curl_waitfd {\r\n  curl_socket_t fd;\r\n  short events;\r\n  short revents; /* not supported yet */\r\n};\r\n\r\n/*\r\n * Name:    curl_multi_init()\r\n *\r\n * Desc:    inititalize multi-style curl usage\r\n *\r\n * Returns: a new CURLM handle to use in all 'curl_multi' functions.\r\n */\r\nCURL_EXTERN CURLM *curl_multi_init(void);\r\n\r\n/*\r\n * Name:    curl_multi_add_handle()\r\n *\r\n * Desc:    add a standard curl handle to the multi stack\r\n *\r\n * Returns: CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,\r\n                                            CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_remove_handle()\r\n  *\r\n  * Desc:    removes a curl handle from the multi stack again\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,\r\n                                               CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_fdset()\r\n  *\r\n  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or\r\n  *          poll() on. We want curl_multi_perform() called as soon as one of\r\n  *          them are ready.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,\r\n                                       fd_set *read_fd_set,\r\n                                       fd_set *write_fd_set,\r\n                                       fd_set *exc_fd_set,\r\n                                       int *max_fd);\r\n\r\n/*\r\n * Name:     curl_multi_wait()\r\n *\r\n * Desc:     Poll on all fds within a CURLM set as well as any\r\n *           additional fds passed to the function.\r\n *\r\n * Returns:  CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,\r\n                                      struct curl_waitfd extra_fds[],\r\n                                      unsigned int extra_nfds,\r\n                                      int timeout_ms,\r\n                                      int *ret);\r\n\r\n /*\r\n  * Name:    curl_multi_perform()\r\n  *\r\n  * Desc:    When the app thinks there's data available for curl it calls this\r\n  *          function to read/write whatever there is right now. This returns\r\n  *          as soon as the reads and writes are done. This function does not\r\n  *          require that there actually is data available for reading or that\r\n  *          data can be written, it can be called just in case. It returns\r\n  *          the number of handles that still transfer data in the second\r\n  *          argument's integer-pointer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code. *NOTE* that this only\r\n  *          returns errors etc regarding the whole multi stack. There might\r\n  *          still have occurred problems on invidual transfers even when this\r\n  *          returns OK.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,\r\n                                         int *running_handles);\r\n\r\n /*\r\n  * Name:    curl_multi_cleanup()\r\n  *\r\n  * Desc:    Cleans up and removes a whole multi stack. It does not free or\r\n  *          touch any individual easy handles in any way. We need to define\r\n  *          in what state those handles will be if this function is called\r\n  *          in the middle of a transfer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);\r\n\r\n/*\r\n * Name:    curl_multi_info_read()\r\n *\r\n * Desc:    Ask the multi handle if there's any messages/informationals from\r\n *          the individual transfers. Messages include informationals such as\r\n *          error code from the transfer or just the fact that a transfer is\r\n *          completed. More details on these should be written down as well.\r\n *\r\n *          Repeated calls to this function will return a new struct each\r\n *          time, until a special \"end of msgs\" struct is returned as a signal\r\n *          that there is no more to get at this point.\r\n *\r\n *          The data the returned pointer points to will not survive calling\r\n *          curl_multi_cleanup().\r\n *\r\n *          The 'CURLMsg' struct is meant to be very simple and only contain\r\n *          very basic informations. If more involved information is wanted,\r\n *          we will provide the particular \"transfer handle\" in that struct\r\n *          and that should/could/would be used in subsequent\r\n *          curl_easy_getinfo() calls (or similar). The point being that we\r\n *          must never expose complex structs to applications, as then we'll\r\n *          undoubtably get backwards compatibility problems in the future.\r\n *\r\n * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out\r\n *          of structs. It also writes the number of messages left in the\r\n *          queue (after this read) in the integer the second argument points\r\n *          to.\r\n */\r\nCURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,\r\n                                          int *msgs_in_queue);\r\n\r\n/*\r\n * Name:    curl_multi_strerror()\r\n *\r\n * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode\r\n *          value into the equivalent human readable error string.  This is\r\n *          useful for printing meaningful error messages.\r\n *\r\n * Returns: A pointer to a zero-terminated error message.\r\n */\r\nCURL_EXTERN const char *curl_multi_strerror(CURLMcode);\r\n\r\n/*\r\n * Name:    curl_multi_socket() and\r\n *          curl_multi_socket_all()\r\n *\r\n * Desc:    An alternative version of curl_multi_perform() that allows the\r\n *          application to pass in one of the file descriptors that have been\r\n *          detected to have \"action\" on them and let libcurl perform.\r\n *          See man page for details.\r\n */\r\n#define CURL_POLL_NONE   0\r\n#define CURL_POLL_IN     1\r\n#define CURL_POLL_OUT    2\r\n#define CURL_POLL_INOUT  3\r\n#define CURL_POLL_REMOVE 4\r\n\r\n#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD\r\n\r\n#define CURL_CSELECT_IN   0x01\r\n#define CURL_CSELECT_OUT  0x02\r\n#define CURL_CSELECT_ERR  0x04\r\n\r\ntypedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */\r\n                                    curl_socket_t s, /* socket */\r\n                                    int what,        /* see above */\r\n                                    void *userp,     /* private callback\r\n                                                        pointer */\r\n                                    void *socketp);  /* private socket\r\n                                                        pointer */\r\n/*\r\n * Name:    curl_multi_timer_callback\r\n *\r\n * Desc:    Called by libcurl whenever the library detects a change in the\r\n *          maximum number of milliseconds the app is allowed to wait before\r\n *          curl_multi_socket() or curl_multi_perform() must be called\r\n *          (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: The callback should return zero.\r\n */\r\ntypedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */\r\n                                         long timeout_ms, /* see above */\r\n                                         void *userp);    /* private callback\r\n                                                             pointer */\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,\r\n                                        int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,\r\n                                               curl_socket_t s,\r\n                                               int ev_bitmask,\r\n                                               int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,\r\n                                            int *running_handles);\r\n\r\n#ifndef CURL_ALLOW_OLD_MULTI_SOCKET\r\n/* This macro below was added in 7.16.3 to push users who recompile to use\r\n   the new curl_multi_socket_action() instead of the old curl_multi_socket()\r\n*/\r\n#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)\r\n#endif\r\n\r\n/*\r\n * Name:    curl_multi_timeout()\r\n *\r\n * Desc:    Returns the maximum number of milliseconds the app is allowed to\r\n *          wait before curl_multi_socket() or curl_multi_perform() must be\r\n *          called (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,\r\n                                         long *milliseconds);\r\n\r\n#undef CINIT /* re-using the same name as in curl.h */\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLMOPT_/**/name = type + number\r\n#endif\r\n\r\ntypedef enum {\r\n  /* This is the socket callback function pointer */\r\n  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),\r\n\r\n  /* This is the argument passed to the socket callback */\r\n  CINIT(SOCKETDATA, OBJECTPOINT, 2),\r\n\r\n    /* set to 1 to enable pipelining for this multi handle */\r\n  CINIT(PIPELINING, LONG, 3),\r\n\r\n   /* This is the timer callback function pointer */\r\n  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),\r\n\r\n  /* This is the argument passed to the timer callback */\r\n  CINIT(TIMERDATA, OBJECTPOINT, 5),\r\n\r\n  /* maximum number of entries in the connection cache */\r\n  CINIT(MAXCONNECTS, LONG, 6),\r\n\r\n  CURLMOPT_LASTENTRY /* the last unused */\r\n} CURLMoption;\r\n\r\n\r\n/*\r\n * Name:    curl_multi_setopt()\r\n *\r\n * Desc:    Sets options for the multi handle.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,\r\n                                        CURLMoption option, ...);\r\n\r\n\r\n/*\r\n * Name:    curl_multi_assign()\r\n *\r\n * Desc:    This function sets an association in the multi handle between the\r\n *          given socket and a private pointer of the application. This is\r\n *          (only) useful for curl_multi_socket uses.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,\r\n                                        curl_socket_t sockfd, void *sockp);\r\n\r\n#ifdef __cplusplus\r\n} /* end of extern \"C\" */\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/stdcheaders.h",
    "content": "#ifndef __STDC_HEADERS_H\r\n#define __STDC_HEADERS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <sys/types.h>\r\n\r\nsize_t fread (void *, size_t, size_t, FILE *);\r\nsize_t fwrite (const void *, size_t, size_t, FILE *);\r\n\r\nint strcasecmp(const char *, const char *);\r\nint strncasecmp(const char *, const char *, size_t);\r\n\r\n#endif /* __STDC_HEADERS_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-appstore/include/typecheck-gcc.h",
    "content": "#ifndef __CURL_TYPECHECK_GCC_H\r\n#define __CURL_TYPECHECK_GCC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* wraps curl_easy_setopt() with typechecking */\r\n\r\n/* To add a new kind of warning, add an\r\n *   if(_curl_is_sometype_option(_curl_opt))\r\n *     if(!_curl_is_sometype(value))\r\n *       _curl_easy_setopt_err_sometype();\r\n * block and define _curl_is_sometype_option, _curl_is_sometype and\r\n * _curl_easy_setopt_err_sometype below\r\n *\r\n * NOTE: We use two nested 'if' statements here instead of the && operator, in\r\n *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x\r\n *       when compiling with -Wlogical-op.\r\n *\r\n * To add an option that uses the same type as an existing option, you'll just\r\n * need to extend the appropriate _curl_*_option macro\r\n */\r\n#define curl_easy_setopt(handle, option, value)                               \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (option) _curl_opt = option;                                     \\\r\n  if(__builtin_constant_p(_curl_opt)) {                                       \\\r\n    if(_curl_is_long_option(_curl_opt))                                       \\\r\n      if(!_curl_is_long(value))                                               \\\r\n        _curl_easy_setopt_err_long();                                         \\\r\n    if(_curl_is_off_t_option(_curl_opt))                                      \\\r\n      if(!_curl_is_off_t(value))                                              \\\r\n        _curl_easy_setopt_err_curl_off_t();                                   \\\r\n    if(_curl_is_string_option(_curl_opt))                                     \\\r\n      if(!_curl_is_string(value))                                             \\\r\n        _curl_easy_setopt_err_string();                                       \\\r\n    if(_curl_is_write_cb_option(_curl_opt))                                   \\\r\n      if(!_curl_is_write_cb(value))                                           \\\r\n        _curl_easy_setopt_err_write_callback();                               \\\r\n    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \\\r\n      if(!_curl_is_read_cb(value))                                            \\\r\n        _curl_easy_setopt_err_read_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \\\r\n      if(!_curl_is_ioctl_cb(value))                                           \\\r\n        _curl_easy_setopt_err_ioctl_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \\\r\n      if(!_curl_is_sockopt_cb(value))                                         \\\r\n        _curl_easy_setopt_err_sockopt_cb();                                   \\\r\n    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \\\r\n      if(!_curl_is_opensocket_cb(value))                                      \\\r\n        _curl_easy_setopt_err_opensocket_cb();                                \\\r\n    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \\\r\n      if(!_curl_is_progress_cb(value))                                        \\\r\n        _curl_easy_setopt_err_progress_cb();                                  \\\r\n    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \\\r\n      if(!_curl_is_debug_cb(value))                                           \\\r\n        _curl_easy_setopt_err_debug_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \\\r\n      if(!_curl_is_ssl_ctx_cb(value))                                         \\\r\n        _curl_easy_setopt_err_ssl_ctx_cb();                                   \\\r\n    if(_curl_is_conv_cb_option(_curl_opt))                                    \\\r\n      if(!_curl_is_conv_cb(value))                                            \\\r\n        _curl_easy_setopt_err_conv_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \\\r\n      if(!_curl_is_seek_cb(value))                                            \\\r\n        _curl_easy_setopt_err_seek_cb();                                      \\\r\n    if(_curl_is_cb_data_option(_curl_opt))                                    \\\r\n      if(!_curl_is_cb_data(value))                                            \\\r\n        _curl_easy_setopt_err_cb_data();                                      \\\r\n    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \\\r\n      if(!_curl_is_error_buffer(value))                                       \\\r\n        _curl_easy_setopt_err_error_buffer();                                 \\\r\n    if((_curl_opt) == CURLOPT_STDERR)                                         \\\r\n      if(!_curl_is_FILE(value))                                               \\\r\n        _curl_easy_setopt_err_FILE();                                         \\\r\n    if(_curl_is_postfields_option(_curl_opt))                                 \\\r\n      if(!_curl_is_postfields(value))                                         \\\r\n        _curl_easy_setopt_err_postfields();                                   \\\r\n    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \\\r\n      if(!_curl_is_arr((value), struct curl_httppost))                        \\\r\n        _curl_easy_setopt_err_curl_httpost();                                 \\\r\n    if(_curl_is_slist_option(_curl_opt))                                      \\\r\n      if(!_curl_is_arr((value), struct curl_slist))                           \\\r\n        _curl_easy_setopt_err_curl_slist();                                   \\\r\n    if((_curl_opt) == CURLOPT_SHARE)                                          \\\r\n      if(!_curl_is_ptr((value), CURLSH))                                      \\\r\n        _curl_easy_setopt_err_CURLSH();                                       \\\r\n  }                                                                           \\\r\n  curl_easy_setopt(handle, _curl_opt, value);                                 \\\r\n})\r\n\r\n/* wraps curl_easy_getinfo() with typechecking */\r\n/* FIXME: don't allow const pointers */\r\n#define curl_easy_getinfo(handle, info, arg)                                  \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (info) _curl_info = info;                                        \\\r\n  if(__builtin_constant_p(_curl_info)) {                                      \\\r\n    if(_curl_is_string_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), char *))                                        \\\r\n        _curl_easy_getinfo_err_string();                                      \\\r\n    if(_curl_is_long_info(_curl_info))                                        \\\r\n      if(!_curl_is_arr((arg), long))                                          \\\r\n        _curl_easy_getinfo_err_long();                                        \\\r\n    if(_curl_is_double_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), double))                                        \\\r\n        _curl_easy_getinfo_err_double();                                      \\\r\n    if(_curl_is_slist_info(_curl_info))                                       \\\r\n      if(!_curl_is_arr((arg), struct curl_slist *))                           \\\r\n        _curl_easy_getinfo_err_curl_slist();                                  \\\r\n  }                                                                           \\\r\n  curl_easy_getinfo(handle, _curl_info, arg);                                 \\\r\n})\r\n\r\n/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),\r\n * for now just make sure that the functions are called with three\r\n * arguments\r\n */\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n\r\n\r\n/* the actual warnings, triggered by calling the _curl_easy_setopt_err*\r\n * functions */\r\n\r\n/* To define a new warning, use _CURL_WARNING(identifier, \"message\") */\r\n#define _CURL_WARNING(id, message)                                            \\\r\n  static void __attribute__((__warning__(message)))                           \\\r\n  __attribute__((__unused__)) __attribute__((__noinline__))                   \\\r\n  id(void) { __asm__(\"\"); }\r\n\r\n_CURL_WARNING(_curl_easy_setopt_err_long,\r\n  \"curl_easy_setopt expects a long argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,\r\n  \"curl_easy_setopt expects a curl_off_t argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_string,\r\n              \"curl_easy_setopt expects a \"\r\n              \"string (char* or char[]) argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_write_callback,\r\n  \"curl_easy_setopt expects a curl_write_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_read_cb,\r\n  \"curl_easy_setopt expects a curl_read_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,\r\n  \"curl_easy_setopt expects a curl_ioctl_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,\r\n  \"curl_easy_setopt expects a curl_sockopt_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,\r\n              \"curl_easy_setopt expects a \"\r\n              \"curl_opensocket_callback argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_progress_cb,\r\n  \"curl_easy_setopt expects a curl_progress_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_debug_cb,\r\n  \"curl_easy_setopt expects a curl_debug_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,\r\n  \"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_conv_cb,\r\n  \"curl_easy_setopt expects a curl_conv_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_seek_cb,\r\n  \"curl_easy_setopt expects a curl_seek_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_cb_data,\r\n              \"curl_easy_setopt expects a \"\r\n              \"private data pointer as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_error_buffer,\r\n              \"curl_easy_setopt expects a \"\r\n              \"char buffer of CURL_ERROR_SIZE as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_FILE,\r\n  \"curl_easy_setopt expects a FILE* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_postfields,\r\n  \"curl_easy_setopt expects a void* or char* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,\r\n  \"curl_easy_setopt expects a struct curl_httppost* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_slist,\r\n  \"curl_easy_setopt expects a struct curl_slist* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_CURLSH,\r\n  \"curl_easy_setopt expects a CURLSH* argument for this option\")\r\n\r\n_CURL_WARNING(_curl_easy_getinfo_err_string,\r\n  \"curl_easy_getinfo expects a pointer to char * for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_long,\r\n  \"curl_easy_getinfo expects a pointer to long for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_double,\r\n  \"curl_easy_getinfo expects a pointer to double for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,\r\n  \"curl_easy_getinfo expects a pointer to struct curl_slist * for this info\")\r\n\r\n/* groups of curl_easy_setops options that take the same type of argument */\r\n\r\n/* To add a new option to one of the groups, just add\r\n *   (option) == CURLOPT_SOMETHING\r\n * to the or-expression. If the option takes a long or curl_off_t, you don't\r\n * have to do anything\r\n */\r\n\r\n/* evaluates to true if option takes a long argument */\r\n#define _curl_is_long_option(option)                                          \\\r\n  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)\r\n\r\n#define _curl_is_off_t_option(option)                                         \\\r\n  ((option) > CURLOPTTYPE_OFF_T)\r\n\r\n/* evaluates to true if option takes a char* argument */\r\n#define _curl_is_string_option(option)                                        \\\r\n  ((option) == CURLOPT_URL ||                                                 \\\r\n   (option) == CURLOPT_PROXY ||                                               \\\r\n   (option) == CURLOPT_INTERFACE ||                                           \\\r\n   (option) == CURLOPT_NETRC_FILE ||                                          \\\r\n   (option) == CURLOPT_USERPWD ||                                             \\\r\n   (option) == CURLOPT_USERNAME ||                                            \\\r\n   (option) == CURLOPT_PASSWORD ||                                            \\\r\n   (option) == CURLOPT_PROXYUSERPWD ||                                        \\\r\n   (option) == CURLOPT_PROXYUSERNAME ||                                       \\\r\n   (option) == CURLOPT_PROXYPASSWORD ||                                       \\\r\n   (option) == CURLOPT_NOPROXY ||                                             \\\r\n   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \\\r\n   (option) == CURLOPT_REFERER ||                                             \\\r\n   (option) == CURLOPT_USERAGENT ||                                           \\\r\n   (option) == CURLOPT_COOKIE ||                                              \\\r\n   (option) == CURLOPT_COOKIEFILE ||                                          \\\r\n   (option) == CURLOPT_COOKIEJAR ||                                           \\\r\n   (option) == CURLOPT_COOKIELIST ||                                          \\\r\n   (option) == CURLOPT_FTPPORT ||                                             \\\r\n   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \\\r\n   (option) == CURLOPT_FTP_ACCOUNT ||                                         \\\r\n   (option) == CURLOPT_RANGE ||                                               \\\r\n   (option) == CURLOPT_CUSTOMREQUEST ||                                       \\\r\n   (option) == CURLOPT_SSLCERT ||                                             \\\r\n   (option) == CURLOPT_SSLCERTTYPE ||                                         \\\r\n   (option) == CURLOPT_SSLKEY ||                                              \\\r\n   (option) == CURLOPT_SSLKEYTYPE ||                                          \\\r\n   (option) == CURLOPT_KEYPASSWD ||                                           \\\r\n   (option) == CURLOPT_SSLENGINE ||                                           \\\r\n   (option) == CURLOPT_CAINFO ||                                              \\\r\n   (option) == CURLOPT_CAPATH ||                                              \\\r\n   (option) == CURLOPT_RANDOM_FILE ||                                         \\\r\n   (option) == CURLOPT_EGDSOCKET ||                                           \\\r\n   (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \\\r\n   (option) == CURLOPT_KRBLEVEL ||                                            \\\r\n   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \\\r\n   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \\\r\n   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \\\r\n   (option) == CURLOPT_CRLFILE ||                                             \\\r\n   (option) == CURLOPT_ISSUERCERT ||                                          \\\r\n   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \\\r\n   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \\\r\n   (option) == CURLOPT_MAIL_FROM ||                                           \\\r\n   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \\\r\n   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \\\r\n   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a curl_write_callback argument */\r\n#define _curl_is_write_cb_option(option)                                      \\\r\n  ((option) == CURLOPT_HEADERFUNCTION ||                                      \\\r\n   (option) == CURLOPT_WRITEFUNCTION)\r\n\r\n/* evaluates to true if option takes a curl_conv_callback argument */\r\n#define _curl_is_conv_cb_option(option)                                       \\\r\n  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \\\r\n   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \\\r\n   (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)\r\n\r\n/* evaluates to true if option takes a data argument to pass to a callback */\r\n#define _curl_is_cb_data_option(option)                                       \\\r\n  ((option) == CURLOPT_WRITEDATA ||                                           \\\r\n   (option) == CURLOPT_READDATA ||                                            \\\r\n   (option) == CURLOPT_IOCTLDATA ||                                           \\\r\n   (option) == CURLOPT_SOCKOPTDATA ||                                         \\\r\n   (option) == CURLOPT_OPENSOCKETDATA ||                                      \\\r\n   (option) == CURLOPT_PROGRESSDATA ||                                        \\\r\n   (option) == CURLOPT_WRITEHEADER ||                                         \\\r\n   (option) == CURLOPT_DEBUGDATA ||                                           \\\r\n   (option) == CURLOPT_SSL_CTX_DATA ||                                        \\\r\n   (option) == CURLOPT_SEEKDATA ||                                            \\\r\n   (option) == CURLOPT_PRIVATE ||                                             \\\r\n   (option) == CURLOPT_SSH_KEYDATA ||                                         \\\r\n   (option) == CURLOPT_INTERLEAVEDATA ||                                      \\\r\n   (option) == CURLOPT_CHUNK_DATA ||                                          \\\r\n   (option) == CURLOPT_FNMATCH_DATA ||                                        \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a POST data argument (void* or char*) */\r\n#define _curl_is_postfields_option(option)                                    \\\r\n  ((option) == CURLOPT_POSTFIELDS ||                                          \\\r\n   (option) == CURLOPT_COPYPOSTFIELDS ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a struct curl_slist * argument */\r\n#define _curl_is_slist_option(option)                                         \\\r\n  ((option) == CURLOPT_HTTPHEADER ||                                          \\\r\n   (option) == CURLOPT_HTTP200ALIASES ||                                      \\\r\n   (option) == CURLOPT_QUOTE ||                                               \\\r\n   (option) == CURLOPT_POSTQUOTE ||                                           \\\r\n   (option) == CURLOPT_PREQUOTE ||                                            \\\r\n   (option) == CURLOPT_TELNETOPTIONS ||                                       \\\r\n   (option) == CURLOPT_MAIL_RCPT ||                                           \\\r\n   0)\r\n\r\n/* groups of curl_easy_getinfo infos that take the same type of argument */\r\n\r\n/* evaluates to true if info expects a pointer to char * argument */\r\n#define _curl_is_string_info(info)                                            \\\r\n  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)\r\n\r\n/* evaluates to true if info expects a pointer to long argument */\r\n#define _curl_is_long_info(info)                                              \\\r\n  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)\r\n\r\n/* evaluates to true if info expects a pointer to double argument */\r\n#define _curl_is_double_info(info)                                            \\\r\n  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)\r\n\r\n/* true if info expects a pointer to struct curl_slist * argument */\r\n#define _curl_is_slist_info(info)                                             \\\r\n  (CURLINFO_SLIST < (info))\r\n\r\n\r\n/* typecheck helpers -- check whether given expression has requested type*/\r\n\r\n/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,\r\n * otherwise define a new macro. Search for __builtin_types_compatible_p\r\n * in the GCC manual.\r\n * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is\r\n * the actual expression passed to the curl_easy_setopt macro. This\r\n * means that you can only apply the sizeof and __typeof__ operators, no\r\n * == or whatsoever.\r\n */\r\n\r\n/* XXX: should evaluate to true iff expr is a pointer */\r\n#define _curl_is_any_ptr(expr)                                                \\\r\n  (sizeof(expr) == sizeof(void*))\r\n\r\n/* evaluates to true if expr is NULL */\r\n/* XXX: must not evaluate expr, so this check is not accurate */\r\n#define _curl_is_NULL(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))\r\n\r\n/* evaluates to true if expr is type*, const type* or NULL */\r\n#define _curl_is_ptr(expr, type)                                              \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), const type *))\r\n\r\n/* evaluates to true if expr is one of type[], type*, NULL or const type* */\r\n#define _curl_is_arr(expr, type)                                              \\\r\n  (_curl_is_ptr((expr), type) ||                                              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type []))\r\n\r\n/* evaluates to true if expr is a string */\r\n#define _curl_is_string(expr)                                                 \\\r\n  (_curl_is_arr((expr), char) ||                                              \\\r\n   _curl_is_arr((expr), signed char) ||                                       \\\r\n   _curl_is_arr((expr), unsigned char))\r\n\r\n/* evaluates to true if expr is a long (no matter the signedness)\r\n * XXX: for now, int is also accepted (and therefore short and char, which\r\n * are promoted to int when passed to a variadic function) */\r\n#define _curl_is_long(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \\\r\n   __builtin_types_compatible_p(__typeof__(expr), int) ||                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed int) ||              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned int) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), short) ||                   \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed short) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned short) ||          \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed char) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned char))\r\n\r\n/* evaluates to true if expr is of type curl_off_t */\r\n#define _curl_is_off_t(expr)                                                  \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))\r\n\r\n/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */\r\n/* XXX: also check size of an char[] array? */\r\n#define _curl_is_error_buffer(expr)                                           \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char[]))\r\n\r\n/* evaluates to true if expr is of type (const) void* or (const) FILE* */\r\n#if 0\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_ptr((expr), FILE))\r\n#else /* be less strict */\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  _curl_is_any_ptr(expr)\r\n#endif\r\n\r\n/* evaluates to true if expr is of type FILE* */\r\n#define _curl_is_FILE(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), FILE *))\r\n\r\n/* evaluates to true if expr can be passed as POST data (void* or char*) */\r\n#define _curl_is_postfields(expr)                                             \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_arr((expr), char))\r\n\r\n/* FIXME: the whole callback checking is messy...\r\n * The idea is to tolerate char vs. void and const vs. not const\r\n * pointers in arguments at least\r\n */\r\n/* helper: __builtin_types_compatible_p distinguishes between functions and\r\n * function pointers, hide it */\r\n#define _curl_callback_compatible(func, type)                                 \\\r\n  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(func), type*))\r\n\r\n/* evaluates to true if expr is of type curl_read_callback or \"similar\" */\r\n#define _curl_is_read_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback6))\r\ntypedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_write_callback or \"similar\" */\r\n#define _curl_is_write_cb(expr)                                               \\\r\n  (_curl_is_read_cb(expr) ||                                            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_write_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback6))\r\ntypedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback2)(const char *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback5)(const void *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_ioctl_callback or \"similar\" */\r\n#define _curl_is_ioctl_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback4))\r\ntypedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);\r\ntypedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);\r\ntypedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);\r\ntypedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);\r\n\r\n/* evaluates to true if expr is of type curl_sockopt_callback or \"similar\" */\r\n#define _curl_is_sockopt_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback2))\r\ntypedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);\r\ntypedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,\r\n                                      curlsocktype);\r\n\r\n/* evaluates to true if expr is of type curl_opensocket_callback or\r\n   \"similar\" */\r\n#define _curl_is_opensocket_cb(expr)                                    \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback4))\r\ntypedef curl_socket_t (_curl_opensocket_callback1)\r\n  (void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback2)\r\n  (void *, curlsocktype, const struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback3)\r\n  (const void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback4)\r\n  (const void *, curlsocktype, const struct curl_sockaddr *);\r\n\r\n/* evaluates to true if expr is of type curl_progress_callback or \"similar\" */\r\n#define _curl_is_progress_cb(expr)                                      \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback2))\r\ntypedef int (_curl_progress_callback1)(void *,\r\n    double, double, double, double);\r\ntypedef int (_curl_progress_callback2)(const void *,\r\n    double, double, double, double);\r\n\r\n/* evaluates to true if expr is of type curl_debug_callback or \"similar\" */\r\n#define _curl_is_debug_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback8))\r\ntypedef int (_curl_debug_callback1) (CURL *,\r\n    curl_infotype, char *, size_t, void *);\r\ntypedef int (_curl_debug_callback2) (CURL *,\r\n    curl_infotype, char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback3) (CURL *,\r\n    curl_infotype, const char *, size_t, void *);\r\ntypedef int (_curl_debug_callback4) (CURL *,\r\n    curl_infotype, const char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback5) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback6) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback7) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback8) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, const void *);\r\n\r\n/* evaluates to true if expr is of type curl_ssl_ctx_callback or \"similar\" */\r\n/* this is getting even messier... */\r\n#define _curl_is_ssl_ctx_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))\r\ntypedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);\r\n#ifdef HEADER_SSL_H\r\n/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX\r\n * this will of course break if we're included before OpenSSL headers...\r\n */\r\ntypedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,\r\n                                           const void *);\r\n#else\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;\r\n#endif\r\n\r\n/* evaluates to true if expr is of type curl_conv_callback or \"similar\" */\r\n#define _curl_is_conv_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback4))\r\ntypedef CURLcode (*_curl_conv_callback1)(char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback3)(void *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);\r\n\r\n/* evaluates to true if expr is of type curl_seek_callback or \"similar\" */\r\n#define _curl_is_seek_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback2))\r\ntypedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);\r\ntypedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);\r\n\r\n\r\n#endif /* __CURL_TYPECHECK_GCC_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/curl.h",
    "content": "#ifndef __CURL_CURL_H\r\n#define __CURL_CURL_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/*\r\n * If you have libcurl problems, all docs and details are found here:\r\n *   http://curl.haxx.se/libcurl/\r\n *\r\n * curl-library mailing list subscription and unsubscription web interface:\r\n *   http://cool.haxx.se/mailman/listinfo/curl-library/\r\n */\r\n\r\n#include \"curlver.h\"         /* libcurl version defines   */\r\n#include \"curlbuild.h\"       /* libcurl build definitions */\r\n#include \"curlrules.h\"       /* libcurl rules enforcement */\r\n\r\n/*\r\n * Define WIN32 when build target is Win32 API\r\n */\r\n\r\n#if (defined(_WIN32) || defined(__WIN32__)) && \\\r\n     !defined(WIN32) && !defined(__SYMBIAN32__)\r\n#define WIN32\r\n#endif\r\n\r\n#include <stdio.h>\r\n#include <limits.h>\r\n\r\n#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)\r\n/* Needed for __FreeBSD_version symbol definition */\r\n#include <osreldate.h>\r\n#endif\r\n\r\n/* The include stuff here below is mainly for time_t! */\r\n#include <sys/types.h>\r\n#include <time.h>\r\n\r\n#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)\r\n#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))\r\n/* The check above prevents the winsock2 inclusion if winsock.h already was\r\n   included, since they can't co-exist without problems */\r\n#include <winsock2.h>\r\n#include <ws2tcpip.h>\r\n#endif\r\n#endif\r\n\r\n/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish\r\n   libc5-based Linux systems. Only include it on systems that are known to\r\n   require it! */\r\n#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \\\r\n    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \\\r\n    defined(ANDROID) || defined(__ANDROID__) || \\\r\n   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))\r\n#include <sys/select.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(_WIN32_WCE)\r\n#include <sys/socket.h>\r\n#endif\r\n\r\n#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)\r\n#include <sys/time.h>\r\n#endif\r\n\r\n#ifdef __BEOS__\r\n#include <support/SupportDefs.h>\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURL;\r\n\r\n/*\r\n * Decorate exportable functions for Win32 and Symbian OS DLL linking.\r\n * This avoids using a .def file for building libcurl.dll.\r\n */\r\n#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \\\r\n     !defined(CURL_STATICLIB)\r\n#if defined(BUILDING_LIBCURL)\r\n#define CURL_EXTERN  __declspec(dllexport)\r\n#else\r\n#define CURL_EXTERN  __declspec(dllimport)\r\n#endif\r\n#else\r\n\r\n#ifdef CURL_HIDDEN_SYMBOLS\r\n/*\r\n * This definition is used to make external definitions visible in the\r\n * shared library when symbols are hidden by default.  It makes no\r\n * difference when compiling applications whether this is set or not,\r\n * only when compiling the library.\r\n */\r\n#define CURL_EXTERN CURL_EXTERN_SYMBOL\r\n#else\r\n#define CURL_EXTERN\r\n#endif\r\n#endif\r\n\r\n#ifndef curl_socket_typedef\r\n/* socket typedef */\r\n#if defined(WIN32) && !defined(__LWIP_OPT_H__)\r\ntypedef SOCKET curl_socket_t;\r\n#define CURL_SOCKET_BAD INVALID_SOCKET\r\n#else\r\ntypedef int curl_socket_t;\r\n#define CURL_SOCKET_BAD -1\r\n#endif\r\n#define curl_socket_typedef\r\n#endif /* curl_socket_typedef */\r\n\r\nstruct curl_httppost {\r\n  struct curl_httppost *next;       /* next entry in the list */\r\n  char *name;                       /* pointer to allocated name */\r\n  long namelength;                  /* length of name length */\r\n  char *contents;                   /* pointer to allocated data contents */\r\n  long contentslength;              /* length of contents field */\r\n  char *buffer;                     /* pointer to allocated buffer contents */\r\n  long bufferlength;                /* length of buffer field */\r\n  char *contenttype;                /* Content-Type */\r\n  struct curl_slist* contentheader; /* list of extra headers for this form */\r\n  struct curl_httppost *more;       /* if one field name has more than one\r\n                                       file, this link should link to following\r\n                                       files */\r\n  long flags;                       /* as defined below */\r\n#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */\r\n#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */\r\n#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer\r\n                                       do not free in formfree */\r\n#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */\r\n#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */\r\n#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the\r\n                                       regular read callback to get the data\r\n                                       and pass the given pointer as custom\r\n                                       pointer */\r\n\r\n  char *showfilename;               /* The file name to show. If not set, the\r\n                                       actual file name will be used (if this\r\n                                       is a file part) */\r\n  void *userp;                      /* custom pointer used for\r\n                                       HTTPPOST_CALLBACK posts */\r\n};\r\n\r\ntypedef int (*curl_progress_callback)(void *clientp,\r\n                                      double dltotal,\r\n                                      double dlnow,\r\n                                      double ultotal,\r\n                                      double ulnow);\r\n\r\n#ifndef CURL_MAX_WRITE_SIZE\r\n  /* Tests have proven that 20K is a very bad buffer size for uploads on\r\n     Windows, while 16K for some odd reason performed a lot better.\r\n     We do the ifndef check to allow this value to easier be changed at build\r\n     time for those who feel adventurous. The practical minimum is about\r\n     400 bytes since libcurl uses a buffer of this size as a scratch area\r\n     (unrelated to network send operations). */\r\n#define CURL_MAX_WRITE_SIZE 16384\r\n#endif\r\n\r\n#ifndef CURL_MAX_HTTP_HEADER\r\n/* The only reason to have a max limit for this is to avoid the risk of a bad\r\n   server feeding libcurl with a never-ending header that will cause reallocs\r\n   infinitely */\r\n#define CURL_MAX_HTTP_HEADER (100*1024)\r\n#endif\r\n\r\n/* This is a magic return code for the write callback that, when returned,\r\n   will signal libcurl to pause receiving on the current transfer. */\r\n#define CURL_WRITEFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_write_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *outstream);\r\n\r\n\r\n\r\n/* enumeration of file types */\r\ntypedef enum {\r\n  CURLFILETYPE_FILE = 0,\r\n  CURLFILETYPE_DIRECTORY,\r\n  CURLFILETYPE_SYMLINK,\r\n  CURLFILETYPE_DEVICE_BLOCK,\r\n  CURLFILETYPE_DEVICE_CHAR,\r\n  CURLFILETYPE_NAMEDPIPE,\r\n  CURLFILETYPE_SOCKET,\r\n  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */\r\n\r\n  CURLFILETYPE_UNKNOWN /* should never occur */\r\n} curlfiletype;\r\n\r\n#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)\r\n#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)\r\n#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)\r\n#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)\r\n#define CURLFINFOFLAG_KNOWN_UID         (1<<4)\r\n#define CURLFINFOFLAG_KNOWN_GID         (1<<5)\r\n#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)\r\n#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)\r\n\r\n/* Content of this structure depends on information which is known and is\r\n   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man\r\n   page for callbacks returning this structure -- some fields are mandatory,\r\n   some others are optional. The FLAG field has special meaning. */\r\nstruct curl_fileinfo {\r\n  char *filename;\r\n  curlfiletype filetype;\r\n  time_t time;\r\n  unsigned int perm;\r\n  int uid;\r\n  int gid;\r\n  curl_off_t size;\r\n  long int hardlinks;\r\n\r\n  struct {\r\n    /* If some of these fields is not NULL, it is a pointer to b_data. */\r\n    char *time;\r\n    char *perm;\r\n    char *user;\r\n    char *group;\r\n    char *target; /* pointer to the target filename of a symlink */\r\n  } strings;\r\n\r\n  unsigned int flags;\r\n\r\n  /* used internally */\r\n  char * b_data;\r\n  size_t b_size;\r\n  size_t b_used;\r\n};\r\n\r\n/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */\r\n#define CURL_CHUNK_BGN_FUNC_OK      0\r\n#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */\r\n#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */\r\n\r\n/* if splitting of data transfer is enabled, this callback is called before\r\n   download of an individual chunk started. Note that parameter \"remains\" works\r\n   only for FTP wildcard downloading (for now), otherwise is not used */\r\ntypedef long (*curl_chunk_bgn_callback)(const void *transfer_info,\r\n                                        void *ptr,\r\n                                        int remains);\r\n\r\n/* return codes for CURLOPT_CHUNK_END_FUNCTION */\r\n#define CURL_CHUNK_END_FUNC_OK      0\r\n#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */\r\n\r\n/* If splitting of data transfer is enabled this callback is called after\r\n   download of an individual chunk finished.\r\n   Note! After this callback was set then it have to be called FOR ALL chunks.\r\n   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.\r\n   This is the reason why we don't need \"transfer_info\" parameter in this\r\n   callback and we are not interested in \"remains\" parameter too. */\r\ntypedef long (*curl_chunk_end_callback)(void *ptr);\r\n\r\n/* return codes for FNMATCHFUNCTION */\r\n#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */\r\n#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */\r\n#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */\r\n\r\n/* callback type for wildcard downloading pattern matching. If the\r\n   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */\r\ntypedef int (*curl_fnmatch_callback)(void *ptr,\r\n                                     const char *pattern,\r\n                                     const char *string);\r\n\r\n/* These are the return codes for the seek callbacks */\r\n#define CURL_SEEKFUNC_OK       0\r\n#define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */\r\n#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so\r\n                                    libcurl might try other means instead */\r\ntypedef int (*curl_seek_callback)(void *instream,\r\n                                  curl_off_t offset,\r\n                                  int origin); /* 'whence' */\r\n\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to immediately abort the current transfer. */\r\n#define CURL_READFUNC_ABORT 0x10000000\r\n/* This is a return code for the read callback that, when returned, will\r\n   signal libcurl to pause sending data on the current transfer. */\r\n#define CURL_READFUNC_PAUSE 0x10000001\r\n\r\ntypedef size_t (*curl_read_callback)(char *buffer,\r\n                                      size_t size,\r\n                                      size_t nitems,\r\n                                      void *instream);\r\n\r\ntypedef enum  {\r\n  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */\r\n  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */\r\n  CURLSOCKTYPE_LAST    /* never use */\r\n} curlsocktype;\r\n\r\n/* The return code from the sockopt_callback can signal information back\r\n   to libcurl: */\r\n#define CURL_SOCKOPT_OK 0\r\n#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return\r\n                                CURLE_ABORTED_BY_CALLBACK */\r\n#define CURL_SOCKOPT_ALREADY_CONNECTED 2\r\n\r\ntypedef int (*curl_sockopt_callback)(void *clientp,\r\n                                     curl_socket_t curlfd,\r\n                                     curlsocktype purpose);\r\n\r\nstruct curl_sockaddr {\r\n  int family;\r\n  int socktype;\r\n  int protocol;\r\n  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it\r\n                           turned really ugly and painful on the systems that\r\n                           lack this type */\r\n  struct sockaddr addr;\r\n};\r\n\r\ntypedef curl_socket_t\r\n(*curl_opensocket_callback)(void *clientp,\r\n                            curlsocktype purpose,\r\n                            struct curl_sockaddr *address);\r\n\r\ntypedef int\r\n(*curl_closesocket_callback)(void *clientp, curl_socket_t item);\r\n\r\ntypedef enum {\r\n  CURLIOE_OK,            /* I/O operation successful */\r\n  CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */\r\n  CURLIOE_FAILRESTART,   /* failed to restart the read */\r\n  CURLIOE_LAST           /* never use */\r\n} curlioerr;\r\n\r\ntypedef enum  {\r\n  CURLIOCMD_NOP,         /* no operation */\r\n  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */\r\n  CURLIOCMD_LAST         /* never use */\r\n} curliocmd;\r\n\r\ntypedef curlioerr (*curl_ioctl_callback)(CURL *handle,\r\n                                         int cmd,\r\n                                         void *clientp);\r\n\r\n/*\r\n * The following typedef's are signatures of malloc, free, realloc, strdup and\r\n * calloc respectively.  Function pointers of these types can be passed to the\r\n * curl_global_init_mem() function to set user defined memory management\r\n * callback routines.\r\n */\r\ntypedef void *(*curl_malloc_callback)(size_t size);\r\ntypedef void (*curl_free_callback)(void *ptr);\r\ntypedef void *(*curl_realloc_callback)(void *ptr, size_t size);\r\ntypedef char *(*curl_strdup_callback)(const char *str);\r\ntypedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);\r\n\r\n/* the kind of data that is passed to information_callback*/\r\ntypedef enum {\r\n  CURLINFO_TEXT = 0,\r\n  CURLINFO_HEADER_IN,    /* 1 */\r\n  CURLINFO_HEADER_OUT,   /* 2 */\r\n  CURLINFO_DATA_IN,      /* 3 */\r\n  CURLINFO_DATA_OUT,     /* 4 */\r\n  CURLINFO_SSL_DATA_IN,  /* 5 */\r\n  CURLINFO_SSL_DATA_OUT, /* 6 */\r\n  CURLINFO_END\r\n} curl_infotype;\r\n\r\ntypedef int (*curl_debug_callback)\r\n       (CURL *handle,      /* the handle/transfer this concerns */\r\n        curl_infotype type, /* what kind of data */\r\n        char *data,        /* points to the data */\r\n        size_t size,       /* size of the data pointed to */\r\n        void *userptr);    /* whatever the user please */\r\n\r\n/* All possible error codes from all sorts of curl functions. Future versions\r\n   may return other values, stay prepared.\r\n\r\n   Always add new return codes last. Never *EVER* remove any. The return\r\n   codes must remain the same!\r\n */\r\n\r\ntypedef enum {\r\n  CURLE_OK = 0,\r\n  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */\r\n  CURLE_FAILED_INIT,             /* 2 */\r\n  CURLE_URL_MALFORMAT,           /* 3 */\r\n  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for\r\n                                    7.17.0, reused in April 2011 for 7.21.5] */\r\n  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */\r\n  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */\r\n  CURLE_COULDNT_CONNECT,         /* 7 */\r\n  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */\r\n  CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server\r\n                                    due to lack of access - when login fails\r\n                                    this is not returned. */\r\n  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for\r\n                                    7.15.4, reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */\r\n  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server\r\n                                    [was obsoleted in August 2007 for 7.17.0,\r\n                                    reused in Dec 2011 for 7.24.0]*/\r\n  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */\r\n  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */\r\n  CURLE_FTP_CANT_GET_HOST,       /* 15 */\r\n  CURLE_OBSOLETE16,              /* 16 - NOT USED */\r\n  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */\r\n  CURLE_PARTIAL_FILE,            /* 18 */\r\n  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */\r\n  CURLE_OBSOLETE20,              /* 20 - NOT USED */\r\n  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */\r\n  CURLE_HTTP_RETURNED_ERROR,     /* 22 */\r\n  CURLE_WRITE_ERROR,             /* 23 */\r\n  CURLE_OBSOLETE24,              /* 24 - NOT USED */\r\n  CURLE_UPLOAD_FAILED,           /* 25 - failed upload \"command\" */\r\n  CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */\r\n  CURLE_OUT_OF_MEMORY,           /* 27 */\r\n  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error\r\n           instead of a memory allocation error if CURL_DOES_CONVERSIONS\r\n           is defined\r\n  */\r\n  CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */\r\n  CURLE_OBSOLETE29,              /* 29 - NOT USED */\r\n  CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */\r\n  CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */\r\n  CURLE_OBSOLETE32,              /* 32 - NOT USED */\r\n  CURLE_RANGE_ERROR,             /* 33 - RANGE \"command\" didn't work */\r\n  CURLE_HTTP_POST_ERROR,         /* 34 */\r\n  CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */\r\n  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */\r\n  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */\r\n  CURLE_LDAP_CANNOT_BIND,        /* 38 */\r\n  CURLE_LDAP_SEARCH_FAILED,      /* 39 */\r\n  CURLE_OBSOLETE40,              /* 40 - NOT USED */\r\n  CURLE_FUNCTION_NOT_FOUND,      /* 41 */\r\n  CURLE_ABORTED_BY_CALLBACK,     /* 42 */\r\n  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */\r\n  CURLE_OBSOLETE44,              /* 44 - NOT USED */\r\n  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */\r\n  CURLE_OBSOLETE46,              /* 46 - NOT USED */\r\n  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */\r\n  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */\r\n  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */\r\n  CURLE_OBSOLETE50,              /* 50 - NOT USED */\r\n  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint\r\n                                     wasn't verified fine */\r\n  CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */\r\n  CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */\r\n  CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as\r\n                                    default */\r\n  CURLE_SEND_ERROR,              /* 55 - failed sending network data */\r\n  CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */\r\n  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */\r\n  CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */\r\n  CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */\r\n  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */\r\n  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */\r\n  CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */\r\n  CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */\r\n  CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */\r\n  CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind\r\n                                    that failed */\r\n  CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */\r\n  CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not\r\n                                    accepted and we failed to login */\r\n  CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */\r\n  CURLE_TFTP_PERM,               /* 69 - permission problem on server */\r\n  CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */\r\n  CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */\r\n  CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */\r\n  CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */\r\n  CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */\r\n  CURLE_CONV_FAILED,             /* 75 - conversion failed */\r\n  CURLE_CONV_REQD,               /* 76 - caller must register conversion\r\n                                    callbacks using curl_easy_setopt options\r\n                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,\r\n                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and\r\n                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */\r\n  CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing\r\n                                    or wrong format */\r\n  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */\r\n  CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat\r\n                                    generic so the error message will be of\r\n                                    interest when this has happened */\r\n\r\n  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL\r\n                                    connection */\r\n  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,\r\n                                    wait till it's ready and try again (Added\r\n                                    in 7.18.2) */\r\n  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or\r\n                                    wrong format (Added in 7.19.0) */\r\n  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in\r\n                                    7.19.0) */\r\n  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */\r\n  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */\r\n  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */\r\n  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */\r\n  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */\r\n  CURL_LAST /* never use! */\r\n} CURLcode;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Previously obsoletes error codes re-used in 7.24.0 */\r\n#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED\r\n#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT\r\n\r\n/*  compatibility with older names */\r\n#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING\r\n\r\n/* The following were added in 7.21.5, April 2011 */\r\n#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION\r\n\r\n/* The following were added in 7.17.1 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION\r\n\r\n/* The following were added in 7.17.0 */\r\n/* These are scheduled to disappear by 2009 */\r\n#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */\r\n#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46\r\n#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44\r\n#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10\r\n#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16\r\n#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32\r\n#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29\r\n#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12\r\n#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20\r\n#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40\r\n#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24\r\n#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57\r\n#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN\r\n\r\n#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED\r\n#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE\r\n#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR\r\n#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL\r\n#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS\r\n#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR\r\n#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT\r\n\r\n#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR\r\n#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED\r\n#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED\r\n\r\n#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE\r\n#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME\r\n\r\n/* This was the error code 50 in 7.7.3 and a few earlier versions, this\r\n   is no longer used by libcurl but is instead #defined here only to not\r\n   make programs break */\r\n#define CURLE_ALREADY_COMPLETE 99999\r\n\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* This prototype applies to all conversion callbacks */\r\ntypedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);\r\n\r\ntypedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */\r\n                                          void *ssl_ctx, /* actually an\r\n                                                            OpenSSL SSL_CTX */\r\n                                          void *userptr);\r\n\r\ntypedef enum {\r\n  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use\r\n                           CONNECT HTTP/1.1 */\r\n  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT\r\n                               HTTP/1.0  */\r\n  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already\r\n                           in 7.10 */\r\n  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */\r\n  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */\r\n  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the\r\n                                   host name rather than the IP address. added\r\n                                   in 7.18.0 */\r\n} curl_proxytype;  /* this enum was added in 7.10 */\r\n\r\n/*\r\n * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:\r\n *\r\n * CURLAUTH_NONE         - No HTTP authentication\r\n * CURLAUTH_BASIC        - HTTP Basic authentication (default)\r\n * CURLAUTH_DIGEST       - HTTP Digest authentication\r\n * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication\r\n * CURLAUTH_NTLM         - HTTP NTLM authentication\r\n * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour\r\n * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper\r\n * CURLAUTH_ONLY         - Use together with a single other type to force no\r\n *                         authentication or just that single type\r\n * CURLAUTH_ANY          - All fine types set\r\n * CURLAUTH_ANYSAFE      - All fine types except Basic\r\n */\r\n\r\n#define CURLAUTH_NONE         ((unsigned long)0)\r\n#define CURLAUTH_BASIC        (((unsigned long)1)<<0)\r\n#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)\r\n#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)\r\n#define CURLAUTH_NTLM         (((unsigned long)1)<<3)\r\n#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)\r\n#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)\r\n#define CURLAUTH_ONLY         (((unsigned long)1)<<31)\r\n#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)\r\n#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))\r\n\r\n#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */\r\n#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */\r\n#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */\r\n#define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */\r\n#define CURLSSH_AUTH_HOST      (1<<2) /* host key files */\r\n#define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */\r\n#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */\r\n#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY\r\n\r\n#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */\r\n#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */\r\n#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */\r\n\r\n#define CURL_ERROR_SIZE 256\r\n\r\nstruct curl_khkey {\r\n  const char *key; /* points to a zero-terminated string encoded with base64\r\n                      if len is zero, otherwise to the \"raw\" data */\r\n  size_t len;\r\n  enum type {\r\n    CURLKHTYPE_UNKNOWN,\r\n    CURLKHTYPE_RSA1,\r\n    CURLKHTYPE_RSA,\r\n    CURLKHTYPE_DSS\r\n  } keytype;\r\n};\r\n\r\n/* this is the set of return values expected from the curl_sshkeycallback\r\n   callback */\r\nenum curl_khstat {\r\n  CURLKHSTAT_FINE_ADD_TO_FILE,\r\n  CURLKHSTAT_FINE,\r\n  CURLKHSTAT_REJECT, /* reject the connection, return an error */\r\n  CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so\r\n                        this causes a CURLE_DEFER error but otherwise the\r\n                        connection will be left intact etc */\r\n  CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */\r\n};\r\n\r\n/* this is the set of status codes pass in to the callback */\r\nenum curl_khmatch {\r\n  CURLKHMATCH_OK,       /* match */\r\n  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */\r\n  CURLKHMATCH_MISSING,  /* no matching host/key found */\r\n  CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */\r\n};\r\n\r\ntypedef int\r\n  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */\r\n                          const struct curl_khkey *knownkey, /* known */\r\n                          const struct curl_khkey *foundkey, /* found */\r\n                          enum curl_khmatch, /* libcurl's view on the keys */\r\n                          void *clientp); /* custom pointer passed from app */\r\n\r\n/* parameter for the CURLOPT_USE_SSL option */\r\ntypedef enum {\r\n  CURLUSESSL_NONE,    /* do not attempt to use SSL */\r\n  CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */\r\n  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */\r\n  CURLUSESSL_ALL,     /* SSL for all communication or fail */\r\n  CURLUSESSL_LAST     /* not an option, never use */\r\n} curl_usessl;\r\n\r\n/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */\r\n\r\n/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the\r\n   name of improving interoperability with older servers. Some SSL libraries\r\n   have introduced work-arounds for this flaw but those work-arounds sometimes\r\n   make the SSL communication fail. To regain functionality with those broken\r\n   servers, a user can this way allow the vulnerability back. */\r\n#define CURLSSLOPT_ALLOW_BEAST (1<<0)\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n#define CURLFTPSSL_NONE CURLUSESSL_NONE\r\n#define CURLFTPSSL_TRY CURLUSESSL_TRY\r\n#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL\r\n#define CURLFTPSSL_ALL CURLUSESSL_ALL\r\n#define CURLFTPSSL_LAST CURLUSESSL_LAST\r\n#define curl_ftpssl curl_usessl\r\n#endif /*!CURL_NO_OLDIES*/\r\n\r\n/* parameter for the CURLOPT_FTP_SSL_CCC option */\r\ntypedef enum {\r\n  CURLFTPSSL_CCC_NONE,    /* do not send CCC */\r\n  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */\r\n  CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */\r\n  CURLFTPSSL_CCC_LAST     /* not an option, never use */\r\n} curl_ftpccc;\r\n\r\n/* parameter for the CURLOPT_FTPSSLAUTH option */\r\ntypedef enum {\r\n  CURLFTPAUTH_DEFAULT, /* let libcurl decide */\r\n  CURLFTPAUTH_SSL,     /* use \"AUTH SSL\" */\r\n  CURLFTPAUTH_TLS,     /* use \"AUTH TLS\" */\r\n  CURLFTPAUTH_LAST /* not an option, never use */\r\n} curl_ftpauth;\r\n\r\n/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */\r\ntypedef enum {\r\n  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */\r\n  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD\r\n                               again if MKD succeeded, for SFTP this does\r\n                               similar magic */\r\n  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD\r\n                               again even if MKD failed! */\r\n  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */\r\n} curl_ftpcreatedir;\r\n\r\n/* parameter for the CURLOPT_FTP_FILEMETHOD option */\r\ntypedef enum {\r\n  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */\r\n  CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */\r\n  CURLFTPMETHOD_NOCWD,     /* no CWD at all */\r\n  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */\r\n  CURLFTPMETHOD_LAST       /* not an option, never use */\r\n} curl_ftpmethod;\r\n\r\n/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */\r\n#define CURLPROTO_HTTP   (1<<0)\r\n#define CURLPROTO_HTTPS  (1<<1)\r\n#define CURLPROTO_FTP    (1<<2)\r\n#define CURLPROTO_FTPS   (1<<3)\r\n#define CURLPROTO_SCP    (1<<4)\r\n#define CURLPROTO_SFTP   (1<<5)\r\n#define CURLPROTO_TELNET (1<<6)\r\n#define CURLPROTO_LDAP   (1<<7)\r\n#define CURLPROTO_LDAPS  (1<<8)\r\n#define CURLPROTO_DICT   (1<<9)\r\n#define CURLPROTO_FILE   (1<<10)\r\n#define CURLPROTO_TFTP   (1<<11)\r\n#define CURLPROTO_IMAP   (1<<12)\r\n#define CURLPROTO_IMAPS  (1<<13)\r\n#define CURLPROTO_POP3   (1<<14)\r\n#define CURLPROTO_POP3S  (1<<15)\r\n#define CURLPROTO_SMTP   (1<<16)\r\n#define CURLPROTO_SMTPS  (1<<17)\r\n#define CURLPROTO_RTSP   (1<<18)\r\n#define CURLPROTO_RTMP   (1<<19)\r\n#define CURLPROTO_RTMPT  (1<<20)\r\n#define CURLPROTO_RTMPE  (1<<21)\r\n#define CURLPROTO_RTMPTE (1<<22)\r\n#define CURLPROTO_RTMPS  (1<<23)\r\n#define CURLPROTO_RTMPTS (1<<24)\r\n#define CURLPROTO_GOPHER (1<<25)\r\n#define CURLPROTO_ALL    (~0) /* enable everything */\r\n\r\n/* long may be 32 or 64 bits, but we should never depend on anything else\r\n   but 32 */\r\n#define CURLOPTTYPE_LONG          0\r\n#define CURLOPTTYPE_OBJECTPOINT   10000\r\n#define CURLOPTTYPE_FUNCTIONPOINT 20000\r\n#define CURLOPTTYPE_OFF_T         30000\r\n\r\n/* name is uppercase CURLOPT_<name>,\r\n   type is one of the defined CURLOPTTYPE_<type>\r\n   number is unique identifier */\r\n#ifdef CINIT\r\n#undef CINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLOPT_/**/name = type + number\r\n#endif\r\n\r\n/*\r\n * This macro-mania below setups the CURLOPT_[what] enum, to be used with\r\n * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]\r\n * word.\r\n */\r\n\r\ntypedef enum {\r\n  /* This is the FILE * or void * the regular output should be written to. */\r\n  CINIT(FILE, OBJECTPOINT, 1),\r\n\r\n  /* The full URL to get/put */\r\n  CINIT(URL,  OBJECTPOINT, 2),\r\n\r\n  /* Port number to connect to, if other than default. */\r\n  CINIT(PORT, LONG, 3),\r\n\r\n  /* Name of proxy to use. */\r\n  CINIT(PROXY, OBJECTPOINT, 4),\r\n\r\n  /* \"name:password\" to use when fetching. */\r\n  CINIT(USERPWD, OBJECTPOINT, 5),\r\n\r\n  /* \"name:password\" to use with proxy. */\r\n  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),\r\n\r\n  /* Range to get, specified as an ASCII string. */\r\n  CINIT(RANGE, OBJECTPOINT, 7),\r\n\r\n  /* not used */\r\n\r\n  /* Specified file stream to upload from (use as input): */\r\n  CINIT(INFILE, OBJECTPOINT, 9),\r\n\r\n  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE\r\n   * bytes big. If this is not used, error messages go to stderr instead: */\r\n  CINIT(ERRORBUFFER, OBJECTPOINT, 10),\r\n\r\n  /* Function that will be called to store the output (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),\r\n\r\n  /* Function that will be called to read the input (instead of fread). The\r\n   * parameters will use fread() syntax, make sure to follow them. */\r\n  CINIT(READFUNCTION, FUNCTIONPOINT, 12),\r\n\r\n  /* Time-out the read operation after this amount of seconds */\r\n  CINIT(TIMEOUT, LONG, 13),\r\n\r\n  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about\r\n   * how large the file being sent really is. That allows better error\r\n   * checking and better verifies that the upload was successful. -1 means\r\n   * unknown size.\r\n   *\r\n   * For large file support, there is also a _LARGE version of the key\r\n   * which takes an off_t type, allowing platforms with larger off_t\r\n   * sizes to handle larger files.  See below for INFILESIZE_LARGE.\r\n   */\r\n  CINIT(INFILESIZE, LONG, 14),\r\n\r\n  /* POST static input fields. */\r\n  CINIT(POSTFIELDS, OBJECTPOINT, 15),\r\n\r\n  /* Set the referrer page (needed by some CGIs) */\r\n  CINIT(REFERER, OBJECTPOINT, 16),\r\n\r\n  /* Set the FTP PORT string (interface name, named or numerical IP address)\r\n     Use i.e '-' to use default address. */\r\n  CINIT(FTPPORT, OBJECTPOINT, 17),\r\n\r\n  /* Set the User-Agent string (examined by some CGIs) */\r\n  CINIT(USERAGENT, OBJECTPOINT, 18),\r\n\r\n  /* If the download receives less than \"low speed limit\" bytes/second\r\n   * during \"low speed time\" seconds, the operations is aborted.\r\n   * You could i.e if you have a pretty high speed connection, abort if\r\n   * it is less than 2000 bytes/sec during 20 seconds.\r\n   */\r\n\r\n  /* Set the \"low speed limit\" */\r\n  CINIT(LOW_SPEED_LIMIT, LONG, 19),\r\n\r\n  /* Set the \"low speed time\" */\r\n  CINIT(LOW_SPEED_TIME, LONG, 20),\r\n\r\n  /* Set the continuation offset.\r\n   *\r\n   * Note there is also a _LARGE version of this key which uses\r\n   * off_t types, allowing for large file offsets on platforms which\r\n   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.\r\n   */\r\n  CINIT(RESUME_FROM, LONG, 21),\r\n\r\n  /* Set cookie in request: */\r\n  CINIT(COOKIE, OBJECTPOINT, 22),\r\n\r\n  /* This points to a linked list of headers, struct curl_slist kind */\r\n  CINIT(HTTPHEADER, OBJECTPOINT, 23),\r\n\r\n  /* This points to a linked list of post entries, struct curl_httppost */\r\n  CINIT(HTTPPOST, OBJECTPOINT, 24),\r\n\r\n  /* name of the file keeping your private SSL-certificate */\r\n  CINIT(SSLCERT, OBJECTPOINT, 25),\r\n\r\n  /* password for the SSL or SSH private key */\r\n  CINIT(KEYPASSWD, OBJECTPOINT, 26),\r\n\r\n  /* send TYPE parameter? */\r\n  CINIT(CRLF, LONG, 27),\r\n\r\n  /* send linked-list of QUOTE commands */\r\n  CINIT(QUOTE, OBJECTPOINT, 28),\r\n\r\n  /* send FILE * or void * to store headers to, if you use a callback it\r\n     is simply passed to the callback unmodified */\r\n  CINIT(WRITEHEADER, OBJECTPOINT, 29),\r\n\r\n  /* point to a file to read the initial cookies from, also enables\r\n     \"cookie awareness\" */\r\n  CINIT(COOKIEFILE, OBJECTPOINT, 31),\r\n\r\n  /* What version to specifically try to use.\r\n     See CURL_SSLVERSION defines below. */\r\n  CINIT(SSLVERSION, LONG, 32),\r\n\r\n  /* What kind of HTTP time condition to use, see defines */\r\n  CINIT(TIMECONDITION, LONG, 33),\r\n\r\n  /* Time to use with the above condition. Specified in number of seconds\r\n     since 1 Jan 1970 */\r\n  CINIT(TIMEVALUE, LONG, 34),\r\n\r\n  /* 35 = OBSOLETE */\r\n\r\n  /* Custom request, for customizing the get command like\r\n     HTTP: DELETE, TRACE and others\r\n     FTP: to use a different list command\r\n     */\r\n  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),\r\n\r\n  /* HTTP request, for odd commands like DELETE, TRACE and others */\r\n  CINIT(STDERR, OBJECTPOINT, 37),\r\n\r\n  /* 38 is not used */\r\n\r\n  /* send linked-list of post-transfer QUOTE commands */\r\n  CINIT(POSTQUOTE, OBJECTPOINT, 39),\r\n\r\n  CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */\r\n\r\n  CINIT(VERBOSE, LONG, 41),      /* talk a lot */\r\n  CINIT(HEADER, LONG, 42),       /* throw the header out too */\r\n  CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */\r\n  CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */\r\n  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */\r\n  CINIT(UPLOAD, LONG, 46),       /* this is an upload */\r\n  CINIT(POST, LONG, 47),         /* HTTP POST method */\r\n  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */\r\n\r\n  CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */\r\n\r\n  /* Specify whether to read the user+password from the .netrc or the URL.\r\n   * This must be one of the CURL_NETRC_* enums below. */\r\n  CINIT(NETRC, LONG, 51),\r\n\r\n  CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */\r\n\r\n  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */\r\n  CINIT(PUT, LONG, 54),          /* HTTP PUT */\r\n\r\n  /* 55 = OBSOLETE */\r\n\r\n  /* Function that will be called instead of the internal progress display\r\n   * function. This function should be defined as the curl_progress_callback\r\n   * prototype defines. */\r\n  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),\r\n\r\n  /* Data passed to the progress callback */\r\n  CINIT(PROGRESSDATA, OBJECTPOINT, 57),\r\n\r\n  /* We want the referrer field set automatically when following locations */\r\n  CINIT(AUTOREFERER, LONG, 58),\r\n\r\n  /* Port of the proxy, can be set in the proxy string as well with:\r\n     \"[host]:[port]\" */\r\n  CINIT(PROXYPORT, LONG, 59),\r\n\r\n  /* size of the POST input data, if strlen() is not good to use */\r\n  CINIT(POSTFIELDSIZE, LONG, 60),\r\n\r\n  /* tunnel non-http operations through a HTTP proxy */\r\n  CINIT(HTTPPROXYTUNNEL, LONG, 61),\r\n\r\n  /* Set the interface string to use as outgoing network interface */\r\n  CINIT(INTERFACE, OBJECTPOINT, 62),\r\n\r\n  /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This\r\n   * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string\r\n   * is set but doesn't match one of these, 'private' will be used.  */\r\n  CINIT(KRBLEVEL, OBJECTPOINT, 63),\r\n\r\n  /* Set if we should verify the peer in ssl handshake, set 1 to verify. */\r\n  CINIT(SSL_VERIFYPEER, LONG, 64),\r\n\r\n  /* The CApath or CAfile used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAINFO, OBJECTPOINT, 65),\r\n\r\n  /* 66 = OBSOLETE */\r\n  /* 67 = OBSOLETE */\r\n\r\n  /* Maximum number of http redirects to follow */\r\n  CINIT(MAXREDIRS, LONG, 68),\r\n\r\n  /* Pass a long set to 1 to get the date of the requested document (if\r\n     possible)! Pass a zero to shut it off. */\r\n  CINIT(FILETIME, LONG, 69),\r\n\r\n  /* This points to a linked list of telnet options */\r\n  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),\r\n\r\n  /* Max amount of cached alive connections */\r\n  CINIT(MAXCONNECTS, LONG, 71),\r\n\r\n  CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */\r\n\r\n  /* 73 = OBSOLETE */\r\n\r\n  /* Set to explicitly use a new connection for the upcoming transfer.\r\n     Do not use this unless you're absolutely sure of this, as it makes the\r\n     operation slower and is less friendly for the network. */\r\n  CINIT(FRESH_CONNECT, LONG, 74),\r\n\r\n  /* Set to explicitly forbid the upcoming transfer's connection to be re-used\r\n     when done. Do not use this unless you're absolutely sure of this, as it\r\n     makes the operation slower and is less friendly for the network. */\r\n  CINIT(FORBID_REUSE, LONG, 75),\r\n\r\n  /* Set to a file name that contains random data for libcurl to use to\r\n     seed the random engine when doing SSL connects. */\r\n  CINIT(RANDOM_FILE, OBJECTPOINT, 76),\r\n\r\n  /* Set to the Entropy Gathering Daemon socket pathname */\r\n  CINIT(EGDSOCKET, OBJECTPOINT, 77),\r\n\r\n  /* Time-out connect operations after this amount of seconds, if connects are\r\n     OK within this time, then fine... This only aborts the connect phase. */\r\n  CINIT(CONNECTTIMEOUT, LONG, 78),\r\n\r\n  /* Function that will be called to store headers (instead of fwrite). The\r\n   * parameters will use fwrite() syntax, make sure to follow them. */\r\n  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),\r\n\r\n  /* Set this to force the HTTP request to get back to GET. Only really usable\r\n     if POST, PUT or a custom request have been used first.\r\n   */\r\n  CINIT(HTTPGET, LONG, 80),\r\n\r\n  /* Set if we should verify the Common name from the peer certificate in ssl\r\n   * handshake, set 1 to check existence, 2 to ensure that it matches the\r\n   * provided hostname. */\r\n  CINIT(SSL_VERIFYHOST, LONG, 81),\r\n\r\n  /* Specify which file name to write all known cookies in after completed\r\n     operation. Set file name to \"-\" (dash) to make it go to stdout. */\r\n  CINIT(COOKIEJAR, OBJECTPOINT, 82),\r\n\r\n  /* Specify which SSL ciphers to use */\r\n  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),\r\n\r\n  /* Specify which HTTP version to use! This must be set to one of the\r\n     CURL_HTTP_VERSION* enums set below. */\r\n  CINIT(HTTP_VERSION, LONG, 84),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPSV command. By\r\n     default, that one will always be attempted before the more traditional\r\n     PASV command. */\r\n  CINIT(FTP_USE_EPSV, LONG, 85),\r\n\r\n  /* type of the file keeping your SSL-certificate (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),\r\n\r\n  /* name of the file keeping your private SSL-key */\r\n  CINIT(SSLKEY, OBJECTPOINT, 87),\r\n\r\n  /* type of the file keeping your private SSL-key (\"DER\", \"PEM\", \"ENG\") */\r\n  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),\r\n\r\n  /* crypto engine for the SSL-sub system */\r\n  CINIT(SSLENGINE, OBJECTPOINT, 89),\r\n\r\n  /* set the crypto engine for the SSL-sub system as default\r\n     the param has no meaning...\r\n   */\r\n  CINIT(SSLENGINE_DEFAULT, LONG, 90),\r\n\r\n  /* Non-zero value means to use the global dns cache */\r\n  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */\r\n\r\n  /* DNS cache timeout */\r\n  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),\r\n\r\n  /* send linked-list of pre-transfer QUOTE commands */\r\n  CINIT(PREQUOTE, OBJECTPOINT, 93),\r\n\r\n  /* set the debug function */\r\n  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),\r\n\r\n  /* set the data for the debug function */\r\n  CINIT(DEBUGDATA, OBJECTPOINT, 95),\r\n\r\n  /* mark this as start of a cookie session */\r\n  CINIT(COOKIESESSION, LONG, 96),\r\n\r\n  /* The CApath directory used to validate the peer certificate\r\n     this option is used only if SSL_VERIFYPEER is true */\r\n  CINIT(CAPATH, OBJECTPOINT, 97),\r\n\r\n  /* Instruct libcurl to use a smaller receive buffer */\r\n  CINIT(BUFFERSIZE, LONG, 98),\r\n\r\n  /* Instruct libcurl to not use any signal/alarm handlers, even when using\r\n     timeouts. This option is useful for multi-threaded applications.\r\n     See libcurl-the-guide for more background information. */\r\n  CINIT(NOSIGNAL, LONG, 99),\r\n\r\n  /* Provide a CURLShare for mutexing non-ts data */\r\n  CINIT(SHARE, OBJECTPOINT, 100),\r\n\r\n  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),\r\n     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */\r\n  CINIT(PROXYTYPE, LONG, 101),\r\n\r\n  /* Set the Accept-Encoding string. Use this to tell a server you would like\r\n     the response to be compressed. Before 7.21.6, this was known as\r\n     CURLOPT_ENCODING */\r\n  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),\r\n\r\n  /* Set pointer to private data */\r\n  CINIT(PRIVATE, OBJECTPOINT, 103),\r\n\r\n  /* Set aliases for HTTP 200 in the HTTP Response header */\r\n  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),\r\n\r\n  /* Continue to send authentication (user+password) when following locations,\r\n     even when hostname changed. This can potentially send off the name\r\n     and password to whatever host the server decides. */\r\n  CINIT(UNRESTRICTED_AUTH, LONG, 105),\r\n\r\n  /* Specifically switch on or off the FTP engine's use of the EPRT command (\r\n     it also disables the LPRT attempt). By default, those ones will always be\r\n     attempted before the good old traditional PORT command. */\r\n  CINIT(FTP_USE_EPRT, LONG, 106),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_USERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(HTTPAUTH, LONG, 107),\r\n\r\n  /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx\r\n     in second argument. The function must be matching the\r\n     curl_ssl_ctx_callback proto. */\r\n  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),\r\n\r\n  /* Set the userdata for the ssl context callback function's third\r\n     argument */\r\n  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),\r\n\r\n  /* FTP Option that causes missing dirs to be created on the remote server.\r\n     In 7.19.4 we introduced the convenience enums for this option using the\r\n     CURLFTP_CREATE_DIR prefix.\r\n  */\r\n  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),\r\n\r\n  /* Set this to a bitmask value to enable the particular authentications\r\n     methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.\r\n     Note that setting multiple bits may cause extra network round-trips. */\r\n  CINIT(PROXYAUTH, LONG, 111),\r\n\r\n  /* FTP option that changes the timeout, in seconds, associated with\r\n     getting a response.  This is different from transfer timeout time and\r\n     essentially places a demand on the FTP server to acknowledge commands\r\n     in a timely manner. */\r\n  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),\r\n#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT\r\n\r\n  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to\r\n     tell libcurl to resolve names to those IP versions only. This only has\r\n     affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */\r\n  CINIT(IPRESOLVE, LONG, 113),\r\n\r\n  /* Set this option to limit the size of a file that will be downloaded from\r\n     an HTTP or FTP server.\r\n\r\n     Note there is also _LARGE version which adds large file support for\r\n     platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */\r\n  CINIT(MAXFILESIZE, LONG, 114),\r\n\r\n  /* See the comment for INFILESIZE above, but in short, specifies\r\n   * the size of the file being uploaded.  -1 means unknown.\r\n   */\r\n  CINIT(INFILESIZE_LARGE, OFF_T, 115),\r\n\r\n  /* Sets the continuation offset.  There is also a LONG version of this;\r\n   * look above for RESUME_FROM.\r\n   */\r\n  CINIT(RESUME_FROM_LARGE, OFF_T, 116),\r\n\r\n  /* Sets the maximum size of data that will be downloaded from\r\n   * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.\r\n   */\r\n  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),\r\n\r\n  /* Set this option to the file name of your .netrc file you want libcurl\r\n     to parse (using the CURLOPT_NETRC option). If not set, libcurl will do\r\n     a poor attempt to find the user's home directory and check for a .netrc\r\n     file in there. */\r\n  CINIT(NETRC_FILE, OBJECTPOINT, 118),\r\n\r\n  /* Enable SSL/TLS for FTP, pick one of:\r\n     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise\r\n     CURLUSESSL_CONTROL - SSL for the control connection or fail\r\n     CURLUSESSL_ALL     - SSL for all communication or fail\r\n  */\r\n  CINIT(USE_SSL, LONG, 119),\r\n\r\n  /* The _LARGE version of the standard POSTFIELDSIZE option */\r\n  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),\r\n\r\n  /* Enable/disable the TCP Nagle algorithm */\r\n  CINIT(TCP_NODELAY, LONG, 121),\r\n\r\n  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 123 OBSOLETE. Gone in 7.16.0 */\r\n  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */\r\n  /* 127 OBSOLETE. Gone in 7.16.0 */\r\n  /* 128 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option\r\n     can be used to change libcurl's default action which is to first try\r\n     \"AUTH SSL\" and then \"AUTH TLS\" in this order, and proceed when a OK\r\n     response has been received.\r\n\r\n     Available parameters are:\r\n     CURLFTPAUTH_DEFAULT - let libcurl decide\r\n     CURLFTPAUTH_SSL     - try \"AUTH SSL\" first, then TLS\r\n     CURLFTPAUTH_TLS     - try \"AUTH TLS\" first, then SSL\r\n  */\r\n  CINIT(FTPSSLAUTH, LONG, 129),\r\n\r\n  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),\r\n  CINIT(IOCTLDATA, OBJECTPOINT, 131),\r\n\r\n  /* 132 OBSOLETE. Gone in 7.16.0 */\r\n  /* 133 OBSOLETE. Gone in 7.16.0 */\r\n\r\n  /* zero terminated string for pass on to the FTP server when asked for\r\n     \"account\" info */\r\n  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),\r\n\r\n  /* feed cookies into cookie engine */\r\n  CINIT(COOKIELIST, OBJECTPOINT, 135),\r\n\r\n  /* ignore Content-Length */\r\n  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),\r\n\r\n  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server\r\n     response. Typically used for FTP-SSL purposes but is not restricted to\r\n     that. libcurl will then instead use the same IP address it used for the\r\n     control connection. */\r\n  CINIT(FTP_SKIP_PASV_IP, LONG, 137),\r\n\r\n  /* Select \"file method\" to use when doing FTP, see the curl_ftpmethod\r\n     above. */\r\n  CINIT(FTP_FILEMETHOD, LONG, 138),\r\n\r\n  /* Local port number to bind the socket to */\r\n  CINIT(LOCALPORT, LONG, 139),\r\n\r\n  /* Number of ports to try, including the first one set with LOCALPORT.\r\n     Thus, setting it to 1 will make no additional attempts but the first.\r\n  */\r\n  CINIT(LOCALPORTRANGE, LONG, 140),\r\n\r\n  /* no transfer, set up connection and let application use the socket by\r\n     extracting it with CURLINFO_LASTSOCKET */\r\n  CINIT(CONNECT_ONLY, LONG, 141),\r\n\r\n  /* Function that will be called to convert from the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),\r\n\r\n  /* Function that will be called to convert to the\r\n     network encoding (instead of using the iconv calls in libcurl) */\r\n  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),\r\n\r\n  /* Function that will be called to convert from UTF8\r\n     (instead of using the iconv calls in libcurl)\r\n     Note that this is used only for SSL certificate processing */\r\n  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),\r\n\r\n  /* if the connection proceeds too quickly then need to slow it down */\r\n  /* limit-rate: maximum number of bytes per second to send or receive */\r\n  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),\r\n  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),\r\n\r\n  /* Pointer to command string to send if USER/PASS fails. */\r\n  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),\r\n\r\n  /* callback function for setting socket options */\r\n  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),\r\n  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),\r\n\r\n  /* set to 0 to disable session ID re-use for this transfer, default is\r\n     enabled (== 1) */\r\n  CINIT(SSL_SESSIONID_CACHE, LONG, 150),\r\n\r\n  /* allowed SSH authentication methods */\r\n  CINIT(SSH_AUTH_TYPES, LONG, 151),\r\n\r\n  /* Used by scp/sftp to do public/private key authentication */\r\n  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),\r\n  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),\r\n\r\n  /* Send CCC (Clear Command Channel) after authentication */\r\n  CINIT(FTP_SSL_CCC, LONG, 154),\r\n\r\n  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */\r\n  CINIT(TIMEOUT_MS, LONG, 155),\r\n  CINIT(CONNECTTIMEOUT_MS, LONG, 156),\r\n\r\n  /* set to zero to disable the libcurl's decoding and thus pass the raw body\r\n     data to the application even when it is encoded/compressed */\r\n  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),\r\n  CINIT(HTTP_CONTENT_DECODING, LONG, 158),\r\n\r\n  /* Permission used when creating new files and directories on the remote\r\n     server for protocols that support it, SFTP/SCP/FILE */\r\n  CINIT(NEW_FILE_PERMS, LONG, 159),\r\n  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),\r\n\r\n  /* Set the behaviour of POST when redirecting. Values must be set to one\r\n     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */\r\n  CINIT(POSTREDIR, LONG, 161),\r\n\r\n  /* used by scp/sftp to verify the host's public key */\r\n  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),\r\n\r\n  /* Callback function for opening socket (instead of socket(2)). Optionally,\r\n     callback is able change the address or refuse to connect returning\r\n     CURL_SOCKET_BAD.  The callback should have type\r\n     curl_opensocket_callback */\r\n  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),\r\n  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),\r\n\r\n  /* POST volatile input fields. */\r\n  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),\r\n\r\n  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */\r\n  CINIT(PROXY_TRANSFER_MODE, LONG, 166),\r\n\r\n  /* Callback function for seeking in the input stream */\r\n  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),\r\n  CINIT(SEEKDATA, OBJECTPOINT, 168),\r\n\r\n  /* CRL file */\r\n  CINIT(CRLFILE, OBJECTPOINT, 169),\r\n\r\n  /* Issuer certificate */\r\n  CINIT(ISSUERCERT, OBJECTPOINT, 170),\r\n\r\n  /* (IPv6) Address scope */\r\n  CINIT(ADDRESS_SCOPE, LONG, 171),\r\n\r\n  /* Collect certificate chain info and allow it to get retrievable with\r\n     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only\r\n     working with OpenSSL-powered builds. */\r\n  CINIT(CERTINFO, LONG, 172),\r\n\r\n  /* \"name\" and \"pwd\" to use when fetching. */\r\n  CINIT(USERNAME, OBJECTPOINT, 173),\r\n  CINIT(PASSWORD, OBJECTPOINT, 174),\r\n\r\n    /* \"name\" and \"pwd\" to use with Proxy when fetching. */\r\n  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),\r\n  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),\r\n\r\n  /* Comma separated list of hostnames defining no-proxy zones. These should\r\n     match both hostnames directly, and hostnames within a domain. For\r\n     example, local.com will match local.com and www.local.com, but NOT\r\n     notlocal.com or www.notlocal.com. For compatibility with other\r\n     implementations of this, .local.com will be considered to be the same as\r\n     local.com. A single * is the only valid wildcard, and effectively\r\n     disables the use of proxy. */\r\n  CINIT(NOPROXY, OBJECTPOINT, 177),\r\n\r\n  /* block size for TFTP transfers */\r\n  CINIT(TFTP_BLKSIZE, LONG, 178),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),\r\n\r\n  /* Socks Service */\r\n  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),\r\n\r\n  /* set the bitmask for the protocols that are allowed to be used for the\r\n     transfer, which thus helps the app which takes URLs from users or other\r\n     external inputs and want to restrict what protocol(s) to deal\r\n     with. Defaults to CURLPROTO_ALL. */\r\n  CINIT(PROTOCOLS, LONG, 181),\r\n\r\n  /* set the bitmask for the protocols that libcurl is allowed to follow to,\r\n     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs\r\n     to be set in both bitmasks to be allowed to get redirected to. Defaults\r\n     to all protocols except FILE and SCP. */\r\n  CINIT(REDIR_PROTOCOLS, LONG, 182),\r\n\r\n  /* set the SSH knownhost file name to use */\r\n  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),\r\n\r\n  /* set the SSH host key callback, must point to a curl_sshkeycallback\r\n     function */\r\n  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),\r\n\r\n  /* set the SSH host key callback custom pointer */\r\n  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),\r\n\r\n  /* set the SMTP mail originator */\r\n  CINIT(MAIL_FROM, OBJECTPOINT, 186),\r\n\r\n  /* set the SMTP mail receiver(s) */\r\n  CINIT(MAIL_RCPT, OBJECTPOINT, 187),\r\n\r\n  /* FTP: send PRET before PASV */\r\n  CINIT(FTP_USE_PRET, LONG, 188),\r\n\r\n  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */\r\n  CINIT(RTSP_REQUEST, LONG, 189),\r\n\r\n  /* The RTSP session identifier */\r\n  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),\r\n\r\n  /* The RTSP stream URI */\r\n  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),\r\n\r\n  /* The Transport: header to use in RTSP requests */\r\n  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),\r\n\r\n  /* Manually initialize the client RTSP CSeq for this handle */\r\n  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),\r\n\r\n  /* Manually initialize the server RTSP CSeq for this handle */\r\n  CINIT(RTSP_SERVER_CSEQ, LONG, 194),\r\n\r\n  /* The stream to pass to INTERLEAVEFUNCTION. */\r\n  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),\r\n\r\n  /* Let the application define a custom write method for RTP data */\r\n  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),\r\n\r\n  /* Turn on wildcard matching */\r\n  CINIT(WILDCARDMATCH, LONG, 197),\r\n\r\n  /* Directory matching callback called before downloading of an\r\n     individual file (chunk) started */\r\n  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),\r\n\r\n  /* Directory matching callback called after the file (chunk)\r\n     was downloaded, or skipped */\r\n  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),\r\n\r\n  /* Change match (fnmatch-like) callback for wildcard matching */\r\n  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),\r\n\r\n  /* Let the application define custom chunk data pointer */\r\n  CINIT(CHUNK_DATA, OBJECTPOINT, 201),\r\n\r\n  /* FNMATCH_FUNCTION user pointer */\r\n  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),\r\n\r\n  /* send linked-list of name:port:address sets */\r\n  CINIT(RESOLVE, OBJECTPOINT, 203),\r\n\r\n  /* Set a username for authenticated TLS */\r\n  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),\r\n\r\n  /* Set a password for authenticated TLS */\r\n  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),\r\n\r\n  /* Set authentication type for authenticated TLS */\r\n  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),\r\n\r\n  /* Set to 1 to enable the \"TE:\" header in HTTP requests to ask for\r\n     compressed transfer-encoded responses. Set to 0 to disable the use of TE:\r\n     in outgoing requests. The current default is 0, but it might change in a\r\n     future libcurl release.\r\n\r\n     libcurl will ask for the compressed methods it knows of, and if that\r\n     isn't any, it will not ask for transfer-encoding at all even if this\r\n     option is set to 1.\r\n\r\n  */\r\n  CINIT(TRANSFER_ENCODING, LONG, 207),\r\n\r\n  /* Callback function for closing socket (instead of close(2)). The callback\r\n     should have type curl_closesocket_callback */\r\n  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),\r\n  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),\r\n\r\n  /* allow GSSAPI credential delegation */\r\n  CINIT(GSSAPI_DELEGATION, LONG, 210),\r\n\r\n  /* Set the name servers to use for DNS resolution */\r\n  CINIT(DNS_SERVERS, OBJECTPOINT, 211),\r\n\r\n  /* Time-out accept operations (currently for FTP only) after this amount\r\n     of miliseconds. */\r\n  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),\r\n\r\n  /* Set TCP keepalive */\r\n  CINIT(TCP_KEEPALIVE, LONG, 213),\r\n\r\n  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */\r\n  CINIT(TCP_KEEPIDLE, LONG, 214),\r\n  CINIT(TCP_KEEPINTVL, LONG, 215),\r\n\r\n  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */\r\n  CINIT(SSL_OPTIONS, LONG, 216),\r\n\r\n  /* set the SMTP auth originator */\r\n  CINIT(MAIL_AUTH, OBJECTPOINT, 217),\r\n\r\n  CURLOPT_LASTENTRY /* the last unused */\r\n} CURLoption;\r\n\r\n#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all\r\n                          the obsolete stuff removed! */\r\n\r\n/* Backwards compatibility with older names */\r\n/* These are scheduled to disappear by 2011 */\r\n\r\n/* This was added in version 7.19.1 */\r\n#define CURLOPT_POST301 CURLOPT_POSTREDIR\r\n\r\n/* These are scheduled to disappear by 2009 */\r\n\r\n/* The following were added in 7.17.0 */\r\n#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_FTPAPPEND CURLOPT_APPEND\r\n#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY\r\n#define CURLOPT_FTP_SSL CURLOPT_USE_SSL\r\n\r\n/* The following were added earlier */\r\n\r\n#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD\r\n#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL\r\n\r\n#else\r\n/* This is set if CURL_NO_OLDIES is defined at compile-time */\r\n#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */\r\n#endif\r\n\r\n\r\n  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host\r\n     name resolves addresses using more than one IP protocol version, this\r\n     option might be handy to force libcurl to use a specific IP version. */\r\n#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP\r\n                                     versions that your system allows */\r\n#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */\r\n#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */\r\n\r\n  /* three convenient \"aliases\" that follow the name scheme better */\r\n#define CURLOPT_WRITEDATA CURLOPT_FILE\r\n#define CURLOPT_READDATA  CURLOPT_INFILE\r\n#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER\r\n#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER\r\n\r\n  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */\r\nenum {\r\n  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd\r\n                             like the library to choose the best possible\r\n                             for us! */\r\n  CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */\r\n  CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */\r\n\r\n  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */\r\n};\r\n\r\n/*\r\n * Public API enums for RTSP requests\r\n */\r\nenum {\r\n    CURL_RTSPREQ_NONE, /* first in list */\r\n    CURL_RTSPREQ_OPTIONS,\r\n    CURL_RTSPREQ_DESCRIBE,\r\n    CURL_RTSPREQ_ANNOUNCE,\r\n    CURL_RTSPREQ_SETUP,\r\n    CURL_RTSPREQ_PLAY,\r\n    CURL_RTSPREQ_PAUSE,\r\n    CURL_RTSPREQ_TEARDOWN,\r\n    CURL_RTSPREQ_GET_PARAMETER,\r\n    CURL_RTSPREQ_SET_PARAMETER,\r\n    CURL_RTSPREQ_RECORD,\r\n    CURL_RTSPREQ_RECEIVE,\r\n    CURL_RTSPREQ_LAST /* last in list */\r\n};\r\n\r\n  /* These enums are for use with the CURLOPT_NETRC option. */\r\nenum CURL_NETRC_OPTION {\r\n  CURL_NETRC_IGNORED,     /* The .netrc will never be read.\r\n                           * This is the default. */\r\n  CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred\r\n                           * to one in the .netrc. */\r\n  CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.\r\n                           * Unless one is set programmatically, the .netrc\r\n                           * will be queried. */\r\n  CURL_NETRC_LAST\r\n};\r\n\r\nenum {\r\n  CURL_SSLVERSION_DEFAULT,\r\n  CURL_SSLVERSION_TLSv1,\r\n  CURL_SSLVERSION_SSLv2,\r\n  CURL_SSLVERSION_SSLv3,\r\n\r\n  CURL_SSLVERSION_LAST /* never use, keep last */\r\n};\r\n\r\nenum CURL_TLSAUTH {\r\n  CURL_TLSAUTH_NONE,\r\n  CURL_TLSAUTH_SRP,\r\n  CURL_TLSAUTH_LAST /* never use, keep last */\r\n};\r\n\r\n/* symbols to use with CURLOPT_POSTREDIR.\r\n   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303\r\n   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302\r\n   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */\r\n\r\n#define CURL_REDIR_GET_ALL  0\r\n#define CURL_REDIR_POST_301 1\r\n#define CURL_REDIR_POST_302 2\r\n#define CURL_REDIR_POST_303 4\r\n#define CURL_REDIR_POST_ALL \\\r\n    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)\r\n\r\ntypedef enum {\r\n  CURL_TIMECOND_NONE,\r\n\r\n  CURL_TIMECOND_IFMODSINCE,\r\n  CURL_TIMECOND_IFUNMODSINCE,\r\n  CURL_TIMECOND_LASTMOD,\r\n\r\n  CURL_TIMECOND_LAST\r\n} curl_TimeCond;\r\n\r\n\r\n/* curl_strequal() and curl_strnequal() are subject for removal in a future\r\n   libcurl, see lib/README.curlx for details */\r\nCURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);\r\nCURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);\r\n\r\n/* name is uppercase CURLFORM_<name> */\r\n#ifdef CFINIT\r\n#undef CFINIT\r\n#endif\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CFINIT(name) CURLFORM_ ## name\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define CFINIT(name) CURLFORM_/**/name\r\n#endif\r\n\r\ntypedef enum {\r\n  CFINIT(NOTHING),        /********* the first one is unused ************/\r\n\r\n  /*  */\r\n  CFINIT(COPYNAME),\r\n  CFINIT(PTRNAME),\r\n  CFINIT(NAMELENGTH),\r\n  CFINIT(COPYCONTENTS),\r\n  CFINIT(PTRCONTENTS),\r\n  CFINIT(CONTENTSLENGTH),\r\n  CFINIT(FILECONTENT),\r\n  CFINIT(ARRAY),\r\n  CFINIT(OBSOLETE),\r\n  CFINIT(FILE),\r\n\r\n  CFINIT(BUFFER),\r\n  CFINIT(BUFFERPTR),\r\n  CFINIT(BUFFERLENGTH),\r\n\r\n  CFINIT(CONTENTTYPE),\r\n  CFINIT(CONTENTHEADER),\r\n  CFINIT(FILENAME),\r\n  CFINIT(END),\r\n  CFINIT(OBSOLETE2),\r\n\r\n  CFINIT(STREAM),\r\n\r\n  CURLFORM_LASTENTRY /* the last unused */\r\n} CURLformoption;\r\n\r\n#undef CFINIT /* done */\r\n\r\n/* structure to be used as parameter for CURLFORM_ARRAY */\r\nstruct curl_forms {\r\n  CURLformoption option;\r\n  const char     *value;\r\n};\r\n\r\n/* use this for multipart formpost building */\r\n/* Returns code for curl_formadd()\r\n *\r\n * Returns:\r\n * CURL_FORMADD_OK             on success\r\n * CURL_FORMADD_MEMORY         if the FormInfo allocation fails\r\n * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form\r\n * CURL_FORMADD_NULL           if a null pointer was given for a char\r\n * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed\r\n * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used\r\n * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)\r\n * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated\r\n * CURL_FORMADD_MEMORY         if some allocation for string copying failed.\r\n * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array\r\n *\r\n ***************************************************************************/\r\ntypedef enum {\r\n  CURL_FORMADD_OK, /* first, no error */\r\n\r\n  CURL_FORMADD_MEMORY,\r\n  CURL_FORMADD_OPTION_TWICE,\r\n  CURL_FORMADD_NULL,\r\n  CURL_FORMADD_UNKNOWN_OPTION,\r\n  CURL_FORMADD_INCOMPLETE,\r\n  CURL_FORMADD_ILLEGAL_ARRAY,\r\n  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */\r\n\r\n  CURL_FORMADD_LAST /* last */\r\n} CURLFORMcode;\r\n\r\n/*\r\n * NAME curl_formadd()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Pretty advanced function for building multi-part formposts. Each invoke\r\n * adds one part that together construct a full post. Then use\r\n * CURLOPT_HTTPPOST to send it off to libcurl.\r\n */\r\nCURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,\r\n                                      struct curl_httppost **last_post,\r\n                                      ...);\r\n\r\n/*\r\n * callback function for curl_formget()\r\n * The void *arg pointer will be the one passed as second argument to\r\n *   curl_formget().\r\n * The character buffer passed to it must not be freed.\r\n * Should return the buffer length passed to it as the argument \"len\" on\r\n *   success.\r\n */\r\ntypedef size_t (*curl_formget_callback)(void *arg, const char *buf,\r\n                                        size_t len);\r\n\r\n/*\r\n * NAME curl_formget()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Serialize a curl_httppost struct built with curl_formadd().\r\n * Accepts a void pointer as second argument which will be passed to\r\n * the curl_formget_callback function.\r\n * Returns 0 on success.\r\n */\r\nCURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,\r\n                             curl_formget_callback append);\r\n/*\r\n * NAME curl_formfree()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Free a multipart formpost previously built with curl_formadd().\r\n */\r\nCURL_EXTERN void curl_formfree(struct curl_httppost *form);\r\n\r\n/*\r\n * NAME curl_getenv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a malloc()'ed string that MUST be curl_free()ed after usage is\r\n * complete. DEPRECATED - see lib/README.curlx\r\n */\r\nCURL_EXTERN char *curl_getenv(const char *variable);\r\n\r\n/*\r\n * NAME curl_version()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns a static ascii string of the libcurl version.\r\n */\r\nCURL_EXTERN char *curl_version(void);\r\n\r\n/*\r\n * NAME curl_easy_escape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Escapes URL strings (converts all letters consider illegal in URLs to their\r\n * %XX versions). This function returns a new allocated string or NULL if an\r\n * error occurred.\r\n */\r\nCURL_EXTERN char *curl_easy_escape(CURL *handle,\r\n                                   const char *string,\r\n                                   int length);\r\n\r\n/* the previous version: */\r\nCURL_EXTERN char *curl_escape(const char *string,\r\n                              int length);\r\n\r\n\r\n/*\r\n * NAME curl_easy_unescape()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Unescapes URL encoding in strings (converts all %XX codes to their 8bit\r\n * versions). This function returns a new allocated string or NULL if an error\r\n * occurred.\r\n * Conversion Note: On non-ASCII platforms the ASCII %XX codes are\r\n * converted into the host encoding.\r\n */\r\nCURL_EXTERN char *curl_easy_unescape(CURL *handle,\r\n                                     const char *string,\r\n                                     int length,\r\n                                     int *outlength);\r\n\r\n/* the previous version */\r\nCURL_EXTERN char *curl_unescape(const char *string,\r\n                                int length);\r\n\r\n/*\r\n * NAME curl_free()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Provided for de-allocation in the same translation unit that did the\r\n * allocation. Added in libcurl 7.10\r\n */\r\nCURL_EXTERN void curl_free(void *p);\r\n\r\n/*\r\n * NAME curl_global_init()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() should be invoked exactly once for each application that\r\n * uses libcurl and before any call of other libcurl functions.\r\n *\r\n * This function is not thread-safe!\r\n */\r\nCURL_EXTERN CURLcode curl_global_init(long flags);\r\n\r\n/*\r\n * NAME curl_global_init_mem()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_init() or curl_global_init_mem() should be invoked exactly once\r\n * for each application that uses libcurl.  This function can be used to\r\n * initialize libcurl and set user defined memory management callback\r\n * functions.  Users can implement memory management routines to check for\r\n * memory leaks, check for mis-use of the curl library etc.  User registered\r\n * callback routines with be invoked by this library instead of the system\r\n * memory management routines like malloc, free etc.\r\n */\r\nCURL_EXTERN CURLcode curl_global_init_mem(long flags,\r\n                                          curl_malloc_callback m,\r\n                                          curl_free_callback f,\r\n                                          curl_realloc_callback r,\r\n                                          curl_strdup_callback s,\r\n                                          curl_calloc_callback c);\r\n\r\n/*\r\n * NAME curl_global_cleanup()\r\n *\r\n * DESCRIPTION\r\n *\r\n * curl_global_cleanup() should be invoked exactly once for each application\r\n * that uses libcurl\r\n */\r\nCURL_EXTERN void curl_global_cleanup(void);\r\n\r\n/* linked-list structure for the CURLOPT_QUOTE option (and other) */\r\nstruct curl_slist {\r\n  char *data;\r\n  struct curl_slist *next;\r\n};\r\n\r\n/*\r\n * NAME curl_slist_append()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Appends a string to a linked list. If no list exists, it will be created\r\n * first. Returns the new list, after appending.\r\n */\r\nCURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,\r\n                                                 const char *);\r\n\r\n/*\r\n * NAME curl_slist_free_all()\r\n *\r\n * DESCRIPTION\r\n *\r\n * free a previously built curl_slist.\r\n */\r\nCURL_EXTERN void curl_slist_free_all(struct curl_slist *);\r\n\r\n/*\r\n * NAME curl_getdate()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Returns the time, in seconds since 1 Jan 1970 of the time string given in\r\n * the first argument. The time argument in the second parameter is unused\r\n * and should be set to NULL.\r\n */\r\nCURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);\r\n\r\n/* info about the certificate chain, only for OpenSSL builds. Asked\r\n   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */\r\nstruct curl_certinfo {\r\n  int num_of_certs;             /* number of certificates with information */\r\n  struct curl_slist **certinfo; /* for each index in this array, there's a\r\n                                   linked list with textual information in the\r\n                                   format \"name: value\" */\r\n};\r\n\r\n#define CURLINFO_STRING   0x100000\r\n#define CURLINFO_LONG     0x200000\r\n#define CURLINFO_DOUBLE   0x300000\r\n#define CURLINFO_SLIST    0x400000\r\n#define CURLINFO_MASK     0x0fffff\r\n#define CURLINFO_TYPEMASK 0xf00000\r\n\r\ntypedef enum {\r\n  CURLINFO_NONE, /* first, never use this */\r\n  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,\r\n  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,\r\n  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,\r\n  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,\r\n  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,\r\n  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,\r\n  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,\r\n  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,\r\n  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,\r\n  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,\r\n  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,\r\n  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,\r\n  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,\r\n  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,\r\n  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,\r\n  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,\r\n  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,\r\n  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,\r\n  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,\r\n  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,\r\n  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,\r\n  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,\r\n  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,\r\n  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,\r\n  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,\r\n  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,\r\n  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,\r\n  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,\r\n  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,\r\n  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,\r\n  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,\r\n  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,\r\n  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,\r\n  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,\r\n  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,\r\n  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,\r\n  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,\r\n  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,\r\n  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,\r\n  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,\r\n  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,\r\n  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,\r\n  /* Fill in new entries below here! */\r\n\r\n  CURLINFO_LASTONE          = 42\r\n} CURLINFO;\r\n\r\n/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as\r\n   CURLINFO_HTTP_CODE */\r\n#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE\r\n\r\ntypedef enum {\r\n  CURLCLOSEPOLICY_NONE, /* first, never use this */\r\n\r\n  CURLCLOSEPOLICY_OLDEST,\r\n  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,\r\n  CURLCLOSEPOLICY_LEAST_TRAFFIC,\r\n  CURLCLOSEPOLICY_SLOWEST,\r\n  CURLCLOSEPOLICY_CALLBACK,\r\n\r\n  CURLCLOSEPOLICY_LAST /* last, never use this */\r\n} curl_closepolicy;\r\n\r\n#define CURL_GLOBAL_SSL (1<<0)\r\n#define CURL_GLOBAL_WIN32 (1<<1)\r\n#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)\r\n#define CURL_GLOBAL_NOTHING 0\r\n#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL\r\n\r\n\r\n/*****************************************************************************\r\n * Setup defines, protos etc for the sharing stuff.\r\n */\r\n\r\n/* Different data locks for a single share */\r\ntypedef enum {\r\n  CURL_LOCK_DATA_NONE = 0,\r\n  /*  CURL_LOCK_DATA_SHARE is used internally to say that\r\n   *  the locking is just made to change the internal state of the share\r\n   *  itself.\r\n   */\r\n  CURL_LOCK_DATA_SHARE,\r\n  CURL_LOCK_DATA_COOKIE,\r\n  CURL_LOCK_DATA_DNS,\r\n  CURL_LOCK_DATA_SSL_SESSION,\r\n  CURL_LOCK_DATA_CONNECT,\r\n  CURL_LOCK_DATA_LAST\r\n} curl_lock_data;\r\n\r\n/* Different lock access types */\r\ntypedef enum {\r\n  CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */\r\n  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */\r\n  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */\r\n  CURL_LOCK_ACCESS_LAST        /* never use */\r\n} curl_lock_access;\r\n\r\ntypedef void (*curl_lock_function)(CURL *handle,\r\n                                   curl_lock_data data,\r\n                                   curl_lock_access locktype,\r\n                                   void *userptr);\r\ntypedef void (*curl_unlock_function)(CURL *handle,\r\n                                     curl_lock_data data,\r\n                                     void *userptr);\r\n\r\ntypedef void CURLSH;\r\n\r\ntypedef enum {\r\n  CURLSHE_OK,  /* all is fine */\r\n  CURLSHE_BAD_OPTION, /* 1 */\r\n  CURLSHE_IN_USE,     /* 2 */\r\n  CURLSHE_INVALID,    /* 3 */\r\n  CURLSHE_NOMEM,      /* 4 out of memory */\r\n  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */\r\n  CURLSHE_LAST        /* never use */\r\n} CURLSHcode;\r\n\r\ntypedef enum {\r\n  CURLSHOPT_NONE,  /* don't use */\r\n  CURLSHOPT_SHARE,   /* specify a data type to share */\r\n  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */\r\n  CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */\r\n  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */\r\n  CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock\r\n                           callback functions */\r\n  CURLSHOPT_LAST  /* never use */\r\n} CURLSHoption;\r\n\r\nCURL_EXTERN CURLSH *curl_share_init(void);\r\nCURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);\r\nCURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);\r\n\r\n/****************************************************************************\r\n * Structures for querying information about the curl library at runtime.\r\n */\r\n\r\ntypedef enum {\r\n  CURLVERSION_FIRST,\r\n  CURLVERSION_SECOND,\r\n  CURLVERSION_THIRD,\r\n  CURLVERSION_FOURTH,\r\n  CURLVERSION_LAST /* never actually use this */\r\n} CURLversion;\r\n\r\n/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by\r\n   basically all programs ever that want to get version information. It is\r\n   meant to be a built-in version number for what kind of struct the caller\r\n   expects. If the struct ever changes, we redefine the NOW to another enum\r\n   from above. */\r\n#define CURLVERSION_NOW CURLVERSION_FOURTH\r\n\r\ntypedef struct {\r\n  CURLversion age;          /* age of the returned struct */\r\n  const char *version;      /* LIBCURL_VERSION */\r\n  unsigned int version_num; /* LIBCURL_VERSION_NUM */\r\n  const char *host;         /* OS/host/cpu/machine when configured */\r\n  int features;             /* bitmask, see defines below */\r\n  const char *ssl_version;  /* human readable string */\r\n  long ssl_version_num;     /* not used anymore, always 0 */\r\n  const char *libz_version; /* human readable string */\r\n  /* protocols is terminated by an entry with a NULL protoname */\r\n  const char * const *protocols;\r\n\r\n  /* The fields below this were added in CURLVERSION_SECOND */\r\n  const char *ares;\r\n  int ares_num;\r\n\r\n  /* This field was added in CURLVERSION_THIRD */\r\n  const char *libidn;\r\n\r\n  /* These field were added in CURLVERSION_FOURTH */\r\n\r\n  /* Same as '_libiconv_version' if built with HAVE_ICONV */\r\n  int iconv_ver_num;\r\n\r\n  const char *libssh_version; /* human readable string */\r\n\r\n} curl_version_info_data;\r\n\r\n#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */\r\n#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */\r\n#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */\r\n#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */\r\n#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */\r\n#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */\r\n#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */\r\n#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */\r\n#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */\r\n#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */\r\n#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */\r\n#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */\r\n#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */\r\n#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */\r\n#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */\r\n#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM delegating to winbind helper */\r\n\r\n /*\r\n * NAME curl_version_info()\r\n *\r\n * DESCRIPTION\r\n *\r\n * This function returns a pointer to a static copy of the version info\r\n * struct. See above.\r\n */\r\nCURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);\r\n\r\n/*\r\n * NAME curl_easy_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_strerror function may be used to turn a CURLcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_easy_strerror(CURLcode);\r\n\r\n/*\r\n * NAME curl_share_strerror()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_share_strerror function may be used to turn a CURLSHcode value\r\n * into the equivalent human readable error string.  This is useful\r\n * for printing meaningful error messages.\r\n */\r\nCURL_EXTERN const char *curl_share_strerror(CURLSHcode);\r\n\r\n/*\r\n * NAME curl_easy_pause()\r\n *\r\n * DESCRIPTION\r\n *\r\n * The curl_easy_pause function pauses or unpauses transfers. Select the new\r\n * state by setting the bitmask, use the convenience defines below.\r\n *\r\n */\r\nCURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);\r\n\r\n#define CURLPAUSE_RECV      (1<<0)\r\n#define CURLPAUSE_RECV_CONT (0)\r\n\r\n#define CURLPAUSE_SEND      (1<<2)\r\n#define CURLPAUSE_SEND_CONT (0)\r\n\r\n#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)\r\n#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n/* unfortunately, the easy.h and multi.h include files need options and info\r\n  stuff before they can be included! */\r\n#include \"easy.h\" /* nothing in curl is fun without the easy stuff */\r\n#include \"multi.h\"\r\n\r\n/* the typechecker doesn't work in C++ (yet) */\r\n#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \\\r\n    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \\\r\n    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)\r\n#include \"typecheck-gcc.h\"\r\n#else\r\n#if defined(__STDC__) && (__STDC__ >= 1)\r\n/* This preprocessor magic that replaces a call with the exact same call is\r\n   only done to make sure application authors pass exactly three arguments\r\n   to these functions. */\r\n#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)\r\n#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n#endif /* __STDC__ >= 1 */\r\n#endif /* gcc >= 4.3 && !__cplusplus */\r\n\r\n#endif /* __CURL_CURL_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/curlbuild.h",
    "content": "/* include/curl/curlbuild.h.  Generated from curlbuild.h.in by configure.  */\r\n#ifndef __CURL_CURLBUILD_H\r\n#define __CURL_CURLBUILD_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * If you think that something actually needs to be changed, adjusted\r\n * or fixed in this file, then, report it on the libcurl development\r\n * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * This header file shall only export symbols which are 'curl' or 'CURL'\r\n * prefixed, otherwise public name space would be polluted.\r\n *\r\n * NOTE 2:\r\n * -------\r\n *\r\n * Right now you might be staring at file include/curl/curlbuild.h.in or\r\n * at file include/curl/curlbuild.h, this is due to the following reason:\r\n *\r\n * On systems capable of running the configure script, the configure process\r\n * will overwrite the distributed include/curl/curlbuild.h file with one that\r\n * is suitable and specific to the library being configured and built, which\r\n * is generated from the include/curl/curlbuild.h.in template file.\r\n *\r\n */\r\n\r\n/* ================================================================ */\r\n/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */\r\n/* ================================================================ */\r\n\r\n#ifdef CURL_SIZEOF_LONG\r\n#error \"CURL_SIZEOF_LONG shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#error \"CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#error \"CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_TYPEOF_CURL_OFF_T\r\n#error \"CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_T\r\n#error \"CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_CURL_OFF_TU\r\n#error \"CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n#ifdef CURL_FORMAT_OFF_T\r\n#error \"CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SIZEOF_CURL_OFF_T\r\n#error \"CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_T\r\n#error \"CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined\r\n#endif\r\n\r\n#ifdef CURL_SUFFIX_CURL_OFF_TU\r\n#error \"CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined\r\n#endif\r\n\r\n/* ================================================================ */\r\n/*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */\r\n/* ================================================================ */\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file ws2tcpip.h must be included by the external interface. */\r\n/* #undef CURL_PULL_WS2TCPIP_H */\r\n#ifdef CURL_PULL_WS2TCPIP_H\r\n#  ifndef WIN32_LEAN_AND_MEAN\r\n#    define WIN32_LEAN_AND_MEAN\r\n#  endif\r\n#  include <windows.h>\r\n#  include <winsock2.h>\r\n#  include <ws2tcpip.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system   */\r\n/* header file sys/types.h must be included by the external interface. */\r\n#define CURL_PULL_SYS_TYPES_H 1\r\n#ifdef CURL_PULL_SYS_TYPES_H\r\n#  include <sys/types.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system */\r\n/* header file stdint.h must be included by the external interface.  */\r\n#define CURL_PULL_STDINT_H 1\r\n#ifdef CURL_PULL_STDINT_H\r\n#  include <stdint.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file inttypes.h must be included by the external interface. */\r\n#define CURL_PULL_INTTYPES_H 1\r\n#ifdef CURL_PULL_INTTYPES_H\r\n#  include <inttypes.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system    */\r\n/* header file sys/socket.h must be included by the external interface. */\r\n#define CURL_PULL_SYS_SOCKET_H 1\r\n#ifdef CURL_PULL_SYS_SOCKET_H\r\n#  include <sys/socket.h>\r\n#endif\r\n\r\n/* Configure process defines this to 1 when it finds out that system  */\r\n/* header file sys/poll.h must be included by the external interface. */\r\n/* #undef CURL_PULL_SYS_POLL_H */\r\n#ifdef CURL_PULL_SYS_POLL_H\r\n#  include <sys/poll.h>\r\n#endif\r\n\r\n/* The size of `long', as computed by sizeof. */\r\n#define CURL_SIZEOF_LONG 4\r\n\r\n/* Integral data type used for curl_socklen_t. */\r\n#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t\r\n\r\n/* The size of `curl_socklen_t', as computed by sizeof. */\r\n#define CURL_SIZEOF_CURL_SOCKLEN_T 4\r\n\r\n/* Data type definition of curl_socklen_t. */\r\ntypedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;\r\n\r\n/* Signed integral data type used for curl_off_t. */\r\n#define CURL_TYPEOF_CURL_OFF_T int64_t\r\n\r\n/* Data type definition of curl_off_t. */\r\ntypedef CURL_TYPEOF_CURL_OFF_T curl_off_t;\r\n\r\n/* curl_off_t formatting string directive without \"%\" conversion specifier. */\r\n#define CURL_FORMAT_CURL_OFF_T \"lld\"\r\n\r\n/* unsigned curl_off_t formatting string without \"%\" conversion specifier. */\r\n#define CURL_FORMAT_CURL_OFF_TU \"llu\"\r\n\r\n/* curl_off_t formatting string directive with \"%\" conversion specifier. */\r\n#define CURL_FORMAT_OFF_T \"%lld\"\r\n\r\n/* The size of `curl_off_t', as computed by sizeof. */\r\n#define CURL_SIZEOF_CURL_OFF_T 8\r\n\r\n/* curl_off_t constant suffix. */\r\n#define CURL_SUFFIX_CURL_OFF_T LL\r\n\r\n/* unsigned curl_off_t constant suffix. */\r\n#define CURL_SUFFIX_CURL_OFF_TU ULL\r\n\r\n#endif /* __CURL_CURLBUILD_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/curlrules.h",
    "content": "#ifndef __CURL_CURLRULES_H\r\n#define __CURL_CURLRULES_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* ================================================================ */\r\n/*                    COMPILE TIME SANITY CHECKS                    */\r\n/* ================================================================ */\r\n\r\n/*\r\n * NOTE 1:\r\n * -------\r\n *\r\n * All checks done in this file are intentionally placed in a public\r\n * header file which is pulled by curl/curl.h when an application is\r\n * being built using an already built libcurl library. Additionally\r\n * this file is also included and used when building the library.\r\n *\r\n * If compilation fails on this file it is certainly sure that the\r\n * problem is elsewhere. It could be a problem in the curlbuild.h\r\n * header file, or simply that you are using different compilation\r\n * settings than those used to build the library.\r\n *\r\n * Nothing in this file is intended to be modified or adjusted by the\r\n * curl library user nor by the curl library builder.\r\n *\r\n * Do not deactivate any check, these are done to make sure that the\r\n * library is properly built and used.\r\n *\r\n * You can find further help on the libcurl development mailing list:\r\n * http://cool.haxx.se/mailman/listinfo/curl-library/\r\n *\r\n * NOTE 2\r\n * ------\r\n *\r\n * Some of the following compile time checks are based on the fact\r\n * that the dimension of a constant array can not be a negative one.\r\n * In this way if the compile time verification fails, the compilation\r\n * will fail issuing an error. The error description wording is compiler\r\n * dependent but it will be quite similar to one of the following:\r\n *\r\n *   \"negative subscript or subscript is too large\"\r\n *   \"array must have at least one element\"\r\n *   \"-1 is an illegal array size\"\r\n *   \"size of array is negative\"\r\n *\r\n * If you are building an application which tries to use an already\r\n * built libcurl library and you are getting this kind of errors on\r\n * this file, it is a clear indication that there is a mismatch between\r\n * how the library was built and how you are trying to use it for your\r\n * application. Your already compiled or binary library provider is the\r\n * only one who can give you the details you need to properly use it.\r\n */\r\n\r\n/*\r\n * Verify that some macros are actually defined.\r\n */\r\n\r\n#ifndef CURL_SIZEOF_LONG\r\n#  error \"CURL_SIZEOF_LONG definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_SOCKLEN_T\r\n#  error \"CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_TYPEOF_CURL_OFF_T\r\n#  error \"CURL_TYPEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_T\r\n#  error \"CURL_FORMAT_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_CURL_OFF_TU\r\n#  error \"CURL_FORMAT_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n#ifndef CURL_FORMAT_OFF_T\r\n#  error \"CURL_FORMAT_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SIZEOF_CURL_OFF_T\r\n#  error \"CURL_SIZEOF_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_T\r\n#  error \"CURL_SUFFIX_CURL_OFF_T definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing\r\n#endif\r\n\r\n#ifndef CURL_SUFFIX_CURL_OFF_TU\r\n#  error \"CURL_SUFFIX_CURL_OFF_TU definition is missing!\"\r\n   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing\r\n#endif\r\n\r\n/*\r\n * Macros private to this header file.\r\n */\r\n\r\n#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1\r\n\r\n#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1\r\n\r\n/*\r\n * Verify that the size previously defined and expected for long\r\n * is the same as the one reported by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_01__\r\n    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_off_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_02__\r\n    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_off_t as reported\r\n * by sizeof() is greater or equal than the one reported for long\r\n * for the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_03__\r\n    [CurlchkszGE(curl_off_t, long)];\r\n\r\n/*\r\n * Verify that the size previously defined and expected for\r\n * curl_socklen_t is actually the the same as the one reported\r\n * by sizeof() at compile time.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_04__\r\n    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];\r\n\r\n/*\r\n * Verify at compile time that the size of curl_socklen_t as reported\r\n * by sizeof() is greater or equal than the one reported for int for\r\n * the current compilation.\r\n */\r\n\r\ntypedef char\r\n  __curl_rule_05__\r\n    [CurlchkszGE(curl_socklen_t, int)];\r\n\r\n/* ================================================================ */\r\n/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */\r\n/* ================================================================ */\r\n\r\n/*\r\n * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow\r\n * these to be visible and exported by the external libcurl interface API,\r\n * while also making them visible to the library internals, simply including\r\n * curl_setup.h, without actually needing to include curl.h internally.\r\n * If some day this section would grow big enough, all this should be moved\r\n * to its own header file.\r\n */\r\n\r\n/*\r\n * Figure out if we can use the ## preprocessor operator, which is supported\r\n * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__\r\n * or  __cplusplus so we need to carefully check for them too.\r\n */\r\n\r\n#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \\\r\n  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \\\r\n  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \\\r\n  defined(__ILEC400__)\r\n  /* This compiler is believed to have an ISO compatible preprocessor */\r\n#define CURL_ISOCPP\r\n#else\r\n  /* This compiler is believed NOT to have an ISO compatible preprocessor */\r\n#undef CURL_ISOCPP\r\n#endif\r\n\r\n/*\r\n * Macros for minimum-width signed and unsigned curl_off_t integer constants.\r\n */\r\n\r\n#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)\r\n#  define __CURL_OFF_T_C_HLPR2(x) x\r\n#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \\\r\n                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)\r\n#else\r\n#  ifdef CURL_ISOCPP\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix\r\n#  else\r\n#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix\r\n#  endif\r\n#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)\r\n#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)\r\n#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)\r\n#endif\r\n\r\n/*\r\n * Get rid of macros private to this header file.\r\n */\r\n\r\n#undef CurlchkszEQ\r\n#undef CurlchkszGE\r\n\r\n/*\r\n * Get rid of macros not intended to exist beyond this point.\r\n */\r\n\r\n#undef CURL_PULL_WS2TCPIP_H\r\n#undef CURL_PULL_SYS_TYPES_H\r\n#undef CURL_PULL_SYS_SOCKET_H\r\n#undef CURL_PULL_SYS_POLL_H\r\n#undef CURL_PULL_STDINT_H\r\n#undef CURL_PULL_INTTYPES_H\r\n\r\n#undef CURL_TYPEOF_CURL_SOCKLEN_T\r\n#undef CURL_TYPEOF_CURL_OFF_T\r\n\r\n#ifdef CURL_NO_OLDIES\r\n#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */\r\n#endif\r\n\r\n#endif /* __CURL_CURLRULES_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/curlver.h",
    "content": "#ifndef __CURL_CURLVER_H\r\n#define __CURL_CURLVER_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* This header file contains nothing but libcurl version info, generated by\r\n   a script at release-time. This was made its own header file in 7.11.2 */\r\n\r\n/* This is the global package copyright */\r\n#define LIBCURL_COPYRIGHT \"1996 - 2013 Daniel Stenberg, <daniel@haxx.se>.\"\r\n\r\n/* This is the version number of the libcurl package from which this header\r\n   file origins: */\r\n#define LIBCURL_VERSION \"7.29.0\"\r\n\r\n/* The numeric version number is also available \"in parts\" by using these\r\n   defines: */\r\n#define LIBCURL_VERSION_MAJOR 7\r\n#define LIBCURL_VERSION_MINOR 29\r\n#define LIBCURL_VERSION_PATCH 0\r\n\r\n/* This is the numeric version of the libcurl version number, meant for easier\r\n   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will\r\n   always follow this syntax:\r\n\r\n         0xXXYYZZ\r\n\r\n   Where XX, YY and ZZ are the main version, release and patch numbers in\r\n   hexadecimal (using 8 bits each). All three numbers are always represented\r\n   using two digits.  1.2 would appear as \"0x010200\" while version 9.11.7\r\n   appears as \"0x090b07\".\r\n\r\n   This 6-digit (24 bits) hexadecimal number does not show pre-release number,\r\n   and it is always a greater number in a more recent release. It makes\r\n   comparisons with greater than and less than work.\r\n*/\r\n#define LIBCURL_VERSION_NUM 0x071d00\r\n\r\n/*\r\n * This is the date and time when the full source package was created. The\r\n * timestamp is not stored in git, as the timestamp is properly set in the\r\n * tarballs by the maketgz script.\r\n *\r\n * The format of the date should follow this template:\r\n *\r\n * \"Mon Feb 12 11:35:33 UTC 2007\"\r\n */\r\n#define LIBCURL_TIMESTAMP \"Wed Feb  6 10:13:08 UTC 2013\"\r\n\r\n#endif /* __CURL_CURLVER_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/easy.h",
    "content": "#ifndef __CURL_EASY_H\r\n#define __CURL_EASY_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN CURL *curl_easy_init(void);\r\nCURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);\r\nCURL_EXTERN CURLcode curl_easy_perform(CURL *curl);\r\nCURL_EXTERN void curl_easy_cleanup(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_getinfo()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Request internal information from the curl session with this function.  The\r\n * third argument MUST be a pointer to a long, a pointer to a char * or a\r\n * pointer to a double (as the documentation describes elsewhere).  The data\r\n * pointed to will be filled in accordingly and can be relied upon only if the\r\n * function returns CURLE_OK.  This function is intended to get used *AFTER* a\r\n * performed transfer, all results from this function are undefined until the\r\n * transfer is completed.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);\r\n\r\n\r\n/*\r\n * NAME curl_easy_duphandle()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Creates a new curl session handle with the same options set for the handle\r\n * passed in. Duplicating a handle could only be a matter of cloning data and\r\n * options, internal state info and things like persistent connections cannot\r\n * be transferred. It is useful in multithreaded applications when you can run\r\n * curl_easy_duphandle() for each new thread to avoid a series of identical\r\n * curl_easy_setopt() invokes in every thread.\r\n */\r\nCURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_reset()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Re-initializes a CURL handle to the default values. This puts back the\r\n * handle to the same state as it was in when it was just created.\r\n *\r\n * It does keep: live connections, the Session ID cache, the DNS cache and the\r\n * cookies.\r\n */\r\nCURL_EXTERN void curl_easy_reset(CURL *curl);\r\n\r\n/*\r\n * NAME curl_easy_recv()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Receives data from the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,\r\n                                    size_t *n);\r\n\r\n/*\r\n * NAME curl_easy_send()\r\n *\r\n * DESCRIPTION\r\n *\r\n * Sends data over the connected socket. Use after successful\r\n * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.\r\n */\r\nCURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,\r\n                                    size_t buflen, size_t *n);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/mprintf.h",
    "content": "#ifndef __CURL_MPRINTF_H\r\n#define __CURL_MPRINTF_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <stdarg.h>\r\n#include <stdio.h> /* needed for FILE */\r\n\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nCURL_EXTERN int curl_mprintf(const char *format, ...);\r\nCURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);\r\nCURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);\r\nCURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,\r\n                               const char *format, ...);\r\nCURL_EXTERN int curl_mvprintf(const char *format, va_list args);\r\nCURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);\r\nCURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,\r\n                                const char *format, va_list args);\r\nCURL_EXTERN char *curl_maprintf(const char *format, ...);\r\nCURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);\r\n\r\n#ifdef _MPRINTF_REPLACE\r\n# undef printf\r\n# undef fprintf\r\n# undef sprintf\r\n# undef vsprintf\r\n# undef snprintf\r\n# undef vprintf\r\n# undef vfprintf\r\n# undef vsnprintf\r\n# undef aprintf\r\n# undef vaprintf\r\n# define printf curl_mprintf\r\n# define fprintf curl_mfprintf\r\n#ifdef CURLDEBUG\r\n/* When built with CURLDEBUG we define away the sprintf() functions since we\r\n   don't want internal code to be using them */\r\n# define sprintf sprintf_was_used\r\n# define vsprintf vsprintf_was_used\r\n#else\r\n# define sprintf curl_msprintf\r\n# define vsprintf curl_mvsprintf\r\n#endif\r\n# define snprintf curl_msnprintf\r\n# define vprintf curl_mvprintf\r\n# define vfprintf curl_mvfprintf\r\n# define vsnprintf curl_mvsnprintf\r\n# define aprintf curl_maprintf\r\n# define vaprintf curl_mvaprintf\r\n#endif\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif /* __CURL_MPRINTF_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/multi.h",
    "content": "#ifndef __CURL_MULTI_H\r\n#define __CURL_MULTI_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n/*\r\n  This is an \"external\" header file. Don't give away any internals here!\r\n\r\n  GOALS\r\n\r\n  o Enable a \"pull\" interface. The application that uses libcurl decides where\r\n    and when to ask libcurl to get/send data.\r\n\r\n  o Enable multiple simultaneous transfers in the same thread without making it\r\n    complicated for the application.\r\n\r\n  o Enable the application to select() on its own file descriptors and curl's\r\n    file descriptors simultaneous easily.\r\n\r\n*/\r\n\r\n/*\r\n * This header file should not really need to include \"curl.h\" since curl.h\r\n * itself includes this file and we expect user applications to do #include\r\n * <curl/curl.h> without the need for especially including multi.h.\r\n *\r\n * For some reason we added this include here at one point, and rather than to\r\n * break existing (wrongly written) libcurl applications, we leave it as-is\r\n * but with this warning attached.\r\n */\r\n#include \"curl.h\"\r\n\r\n#ifdef  __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\ntypedef void CURLM;\r\n\r\ntypedef enum {\r\n  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or\r\n                                    curl_multi_socket*() soon */\r\n  CURLM_OK,\r\n  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */\r\n  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */\r\n  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */\r\n  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */\r\n  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */\r\n  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */\r\n  CURLM_LAST\r\n} CURLMcode;\r\n\r\n/* just to make code nicer when using curl_multi_socket() you can now check\r\n   for CURLM_CALL_MULTI_SOCKET too in the same style it works for\r\n   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */\r\n#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM\r\n\r\ntypedef enum {\r\n  CURLMSG_NONE, /* first, not used */\r\n  CURLMSG_DONE, /* This easy handle has completed. 'result' contains\r\n                   the CURLcode of the transfer */\r\n  CURLMSG_LAST /* last, not used */\r\n} CURLMSG;\r\n\r\nstruct CURLMsg {\r\n  CURLMSG msg;       /* what this message means */\r\n  CURL *easy_handle; /* the handle it concerns */\r\n  union {\r\n    void *whatever;    /* message-specific data */\r\n    CURLcode result;   /* return code for transfer */\r\n  } data;\r\n};\r\ntypedef struct CURLMsg CURLMsg;\r\n\r\n/* Based on poll(2) structure and values.\r\n * We don't use pollfd and POLL* constants explicitly\r\n * to cover platforms without poll(). */\r\n#define CURL_WAIT_POLLIN    0x0001\r\n#define CURL_WAIT_POLLPRI   0x0002\r\n#define CURL_WAIT_POLLOUT   0x0004\r\n\r\nstruct curl_waitfd {\r\n  curl_socket_t fd;\r\n  short events;\r\n  short revents; /* not supported yet */\r\n};\r\n\r\n/*\r\n * Name:    curl_multi_init()\r\n *\r\n * Desc:    inititalize multi-style curl usage\r\n *\r\n * Returns: a new CURLM handle to use in all 'curl_multi' functions.\r\n */\r\nCURL_EXTERN CURLM *curl_multi_init(void);\r\n\r\n/*\r\n * Name:    curl_multi_add_handle()\r\n *\r\n * Desc:    add a standard curl handle to the multi stack\r\n *\r\n * Returns: CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,\r\n                                            CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_remove_handle()\r\n  *\r\n  * Desc:    removes a curl handle from the multi stack again\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,\r\n                                               CURL *curl_handle);\r\n\r\n /*\r\n  * Name:    curl_multi_fdset()\r\n  *\r\n  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or\r\n  *          poll() on. We want curl_multi_perform() called as soon as one of\r\n  *          them are ready.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,\r\n                                       fd_set *read_fd_set,\r\n                                       fd_set *write_fd_set,\r\n                                       fd_set *exc_fd_set,\r\n                                       int *max_fd);\r\n\r\n/*\r\n * Name:     curl_multi_wait()\r\n *\r\n * Desc:     Poll on all fds within a CURLM set as well as any\r\n *           additional fds passed to the function.\r\n *\r\n * Returns:  CURLMcode type, general multi error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,\r\n                                      struct curl_waitfd extra_fds[],\r\n                                      unsigned int extra_nfds,\r\n                                      int timeout_ms,\r\n                                      int *ret);\r\n\r\n /*\r\n  * Name:    curl_multi_perform()\r\n  *\r\n  * Desc:    When the app thinks there's data available for curl it calls this\r\n  *          function to read/write whatever there is right now. This returns\r\n  *          as soon as the reads and writes are done. This function does not\r\n  *          require that there actually is data available for reading or that\r\n  *          data can be written, it can be called just in case. It returns\r\n  *          the number of handles that still transfer data in the second\r\n  *          argument's integer-pointer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code. *NOTE* that this only\r\n  *          returns errors etc regarding the whole multi stack. There might\r\n  *          still have occurred problems on invidual transfers even when this\r\n  *          returns OK.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,\r\n                                         int *running_handles);\r\n\r\n /*\r\n  * Name:    curl_multi_cleanup()\r\n  *\r\n  * Desc:    Cleans up and removes a whole multi stack. It does not free or\r\n  *          touch any individual easy handles in any way. We need to define\r\n  *          in what state those handles will be if this function is called\r\n  *          in the middle of a transfer.\r\n  *\r\n  * Returns: CURLMcode type, general multi error code.\r\n  */\r\nCURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);\r\n\r\n/*\r\n * Name:    curl_multi_info_read()\r\n *\r\n * Desc:    Ask the multi handle if there's any messages/informationals from\r\n *          the individual transfers. Messages include informationals such as\r\n *          error code from the transfer or just the fact that a transfer is\r\n *          completed. More details on these should be written down as well.\r\n *\r\n *          Repeated calls to this function will return a new struct each\r\n *          time, until a special \"end of msgs\" struct is returned as a signal\r\n *          that there is no more to get at this point.\r\n *\r\n *          The data the returned pointer points to will not survive calling\r\n *          curl_multi_cleanup().\r\n *\r\n *          The 'CURLMsg' struct is meant to be very simple and only contain\r\n *          very basic informations. If more involved information is wanted,\r\n *          we will provide the particular \"transfer handle\" in that struct\r\n *          and that should/could/would be used in subsequent\r\n *          curl_easy_getinfo() calls (or similar). The point being that we\r\n *          must never expose complex structs to applications, as then we'll\r\n *          undoubtably get backwards compatibility problems in the future.\r\n *\r\n * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out\r\n *          of structs. It also writes the number of messages left in the\r\n *          queue (after this read) in the integer the second argument points\r\n *          to.\r\n */\r\nCURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,\r\n                                          int *msgs_in_queue);\r\n\r\n/*\r\n * Name:    curl_multi_strerror()\r\n *\r\n * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode\r\n *          value into the equivalent human readable error string.  This is\r\n *          useful for printing meaningful error messages.\r\n *\r\n * Returns: A pointer to a zero-terminated error message.\r\n */\r\nCURL_EXTERN const char *curl_multi_strerror(CURLMcode);\r\n\r\n/*\r\n * Name:    curl_multi_socket() and\r\n *          curl_multi_socket_all()\r\n *\r\n * Desc:    An alternative version of curl_multi_perform() that allows the\r\n *          application to pass in one of the file descriptors that have been\r\n *          detected to have \"action\" on them and let libcurl perform.\r\n *          See man page for details.\r\n */\r\n#define CURL_POLL_NONE   0\r\n#define CURL_POLL_IN     1\r\n#define CURL_POLL_OUT    2\r\n#define CURL_POLL_INOUT  3\r\n#define CURL_POLL_REMOVE 4\r\n\r\n#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD\r\n\r\n#define CURL_CSELECT_IN   0x01\r\n#define CURL_CSELECT_OUT  0x02\r\n#define CURL_CSELECT_ERR  0x04\r\n\r\ntypedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */\r\n                                    curl_socket_t s, /* socket */\r\n                                    int what,        /* see above */\r\n                                    void *userp,     /* private callback\r\n                                                        pointer */\r\n                                    void *socketp);  /* private socket\r\n                                                        pointer */\r\n/*\r\n * Name:    curl_multi_timer_callback\r\n *\r\n * Desc:    Called by libcurl whenever the library detects a change in the\r\n *          maximum number of milliseconds the app is allowed to wait before\r\n *          curl_multi_socket() or curl_multi_perform() must be called\r\n *          (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: The callback should return zero.\r\n */\r\ntypedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */\r\n                                         long timeout_ms, /* see above */\r\n                                         void *userp);    /* private callback\r\n                                                             pointer */\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,\r\n                                        int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,\r\n                                               curl_socket_t s,\r\n                                               int ev_bitmask,\r\n                                               int *running_handles);\r\n\r\nCURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,\r\n                                            int *running_handles);\r\n\r\n#ifndef CURL_ALLOW_OLD_MULTI_SOCKET\r\n/* This macro below was added in 7.16.3 to push users who recompile to use\r\n   the new curl_multi_socket_action() instead of the old curl_multi_socket()\r\n*/\r\n#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)\r\n#endif\r\n\r\n/*\r\n * Name:    curl_multi_timeout()\r\n *\r\n * Desc:    Returns the maximum number of milliseconds the app is allowed to\r\n *          wait before curl_multi_socket() or curl_multi_perform() must be\r\n *          called (to allow libcurl's timed events to take place).\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,\r\n                                         long *milliseconds);\r\n\r\n#undef CINIT /* re-using the same name as in curl.h */\r\n\r\n#ifdef CURL_ISOCPP\r\n#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num\r\n#else\r\n/* The macro \"##\" is ISO C, we assume pre-ISO C doesn't support it. */\r\n#define LONG          CURLOPTTYPE_LONG\r\n#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT\r\n#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT\r\n#define OFF_T         CURLOPTTYPE_OFF_T\r\n#define CINIT(name,type,number) CURLMOPT_/**/name = type + number\r\n#endif\r\n\r\ntypedef enum {\r\n  /* This is the socket callback function pointer */\r\n  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),\r\n\r\n  /* This is the argument passed to the socket callback */\r\n  CINIT(SOCKETDATA, OBJECTPOINT, 2),\r\n\r\n    /* set to 1 to enable pipelining for this multi handle */\r\n  CINIT(PIPELINING, LONG, 3),\r\n\r\n   /* This is the timer callback function pointer */\r\n  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),\r\n\r\n  /* This is the argument passed to the timer callback */\r\n  CINIT(TIMERDATA, OBJECTPOINT, 5),\r\n\r\n  /* maximum number of entries in the connection cache */\r\n  CINIT(MAXCONNECTS, LONG, 6),\r\n\r\n  CURLMOPT_LASTENTRY /* the last unused */\r\n} CURLMoption;\r\n\r\n\r\n/*\r\n * Name:    curl_multi_setopt()\r\n *\r\n * Desc:    Sets options for the multi handle.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,\r\n                                        CURLMoption option, ...);\r\n\r\n\r\n/*\r\n * Name:    curl_multi_assign()\r\n *\r\n * Desc:    This function sets an association in the multi handle between the\r\n *          given socket and a private pointer of the application. This is\r\n *          (only) useful for curl_multi_socket uses.\r\n *\r\n * Returns: CURLM error code.\r\n */\r\nCURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,\r\n                                        curl_socket_t sockfd, void *sockp);\r\n\r\n#ifdef __cplusplus\r\n} /* end of extern \"C\" */\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/stdcheaders.h",
    "content": "#ifndef __STDC_HEADERS_H\r\n#define __STDC_HEADERS_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n#include <sys/types.h>\r\n\r\nsize_t fread (void *, size_t, size_t, FILE *);\r\nsize_t fwrite (const void *, size_t, size_t, FILE *);\r\n\r\nint strcasecmp(const char *, const char *);\r\nint strncasecmp(const char *, const char *, size_t);\r\n\r\n#endif /* __STDC_HEADERS_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/curl/ios-dev/include/typecheck-gcc.h",
    "content": "#ifndef __CURL_TYPECHECK_GCC_H\r\n#define __CURL_TYPECHECK_GCC_H\r\n/***************************************************************************\r\n *                                  _   _ ____  _\r\n *  Project                     ___| | | |  _ \\| |\r\n *                             / __| | | | |_) | |\r\n *                            | (__| |_| |  _ <| |___\r\n *                             \\___|\\___/|_| \\_\\_____|\r\n *\r\n * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.\r\n *\r\n * This software is licensed as described in the file COPYING, which\r\n * you should have received as part of this distribution. The terms\r\n * are also available at http://curl.haxx.se/docs/copyright.html.\r\n *\r\n * You may opt to use, copy, modify, merge, publish, distribute and/or sell\r\n * copies of the Software, and permit persons to whom the Software is\r\n * furnished to do so, under the terms of the COPYING file.\r\n *\r\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\r\n * KIND, either express or implied.\r\n *\r\n ***************************************************************************/\r\n\r\n/* wraps curl_easy_setopt() with typechecking */\r\n\r\n/* To add a new kind of warning, add an\r\n *   if(_curl_is_sometype_option(_curl_opt))\r\n *     if(!_curl_is_sometype(value))\r\n *       _curl_easy_setopt_err_sometype();\r\n * block and define _curl_is_sometype_option, _curl_is_sometype and\r\n * _curl_easy_setopt_err_sometype below\r\n *\r\n * NOTE: We use two nested 'if' statements here instead of the && operator, in\r\n *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x\r\n *       when compiling with -Wlogical-op.\r\n *\r\n * To add an option that uses the same type as an existing option, you'll just\r\n * need to extend the appropriate _curl_*_option macro\r\n */\r\n#define curl_easy_setopt(handle, option, value)                               \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (option) _curl_opt = option;                                     \\\r\n  if(__builtin_constant_p(_curl_opt)) {                                       \\\r\n    if(_curl_is_long_option(_curl_opt))                                       \\\r\n      if(!_curl_is_long(value))                                               \\\r\n        _curl_easy_setopt_err_long();                                         \\\r\n    if(_curl_is_off_t_option(_curl_opt))                                      \\\r\n      if(!_curl_is_off_t(value))                                              \\\r\n        _curl_easy_setopt_err_curl_off_t();                                   \\\r\n    if(_curl_is_string_option(_curl_opt))                                     \\\r\n      if(!_curl_is_string(value))                                             \\\r\n        _curl_easy_setopt_err_string();                                       \\\r\n    if(_curl_is_write_cb_option(_curl_opt))                                   \\\r\n      if(!_curl_is_write_cb(value))                                           \\\r\n        _curl_easy_setopt_err_write_callback();                               \\\r\n    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \\\r\n      if(!_curl_is_read_cb(value))                                            \\\r\n        _curl_easy_setopt_err_read_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \\\r\n      if(!_curl_is_ioctl_cb(value))                                           \\\r\n        _curl_easy_setopt_err_ioctl_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \\\r\n      if(!_curl_is_sockopt_cb(value))                                         \\\r\n        _curl_easy_setopt_err_sockopt_cb();                                   \\\r\n    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \\\r\n      if(!_curl_is_opensocket_cb(value))                                      \\\r\n        _curl_easy_setopt_err_opensocket_cb();                                \\\r\n    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \\\r\n      if(!_curl_is_progress_cb(value))                                        \\\r\n        _curl_easy_setopt_err_progress_cb();                                  \\\r\n    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \\\r\n      if(!_curl_is_debug_cb(value))                                           \\\r\n        _curl_easy_setopt_err_debug_cb();                                     \\\r\n    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \\\r\n      if(!_curl_is_ssl_ctx_cb(value))                                         \\\r\n        _curl_easy_setopt_err_ssl_ctx_cb();                                   \\\r\n    if(_curl_is_conv_cb_option(_curl_opt))                                    \\\r\n      if(!_curl_is_conv_cb(value))                                            \\\r\n        _curl_easy_setopt_err_conv_cb();                                      \\\r\n    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \\\r\n      if(!_curl_is_seek_cb(value))                                            \\\r\n        _curl_easy_setopt_err_seek_cb();                                      \\\r\n    if(_curl_is_cb_data_option(_curl_opt))                                    \\\r\n      if(!_curl_is_cb_data(value))                                            \\\r\n        _curl_easy_setopt_err_cb_data();                                      \\\r\n    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \\\r\n      if(!_curl_is_error_buffer(value))                                       \\\r\n        _curl_easy_setopt_err_error_buffer();                                 \\\r\n    if((_curl_opt) == CURLOPT_STDERR)                                         \\\r\n      if(!_curl_is_FILE(value))                                               \\\r\n        _curl_easy_setopt_err_FILE();                                         \\\r\n    if(_curl_is_postfields_option(_curl_opt))                                 \\\r\n      if(!_curl_is_postfields(value))                                         \\\r\n        _curl_easy_setopt_err_postfields();                                   \\\r\n    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \\\r\n      if(!_curl_is_arr((value), struct curl_httppost))                        \\\r\n        _curl_easy_setopt_err_curl_httpost();                                 \\\r\n    if(_curl_is_slist_option(_curl_opt))                                      \\\r\n      if(!_curl_is_arr((value), struct curl_slist))                           \\\r\n        _curl_easy_setopt_err_curl_slist();                                   \\\r\n    if((_curl_opt) == CURLOPT_SHARE)                                          \\\r\n      if(!_curl_is_ptr((value), CURLSH))                                      \\\r\n        _curl_easy_setopt_err_CURLSH();                                       \\\r\n  }                                                                           \\\r\n  curl_easy_setopt(handle, _curl_opt, value);                                 \\\r\n})\r\n\r\n/* wraps curl_easy_getinfo() with typechecking */\r\n/* FIXME: don't allow const pointers */\r\n#define curl_easy_getinfo(handle, info, arg)                                  \\\r\n__extension__ ({                                                              \\\r\n  __typeof__ (info) _curl_info = info;                                        \\\r\n  if(__builtin_constant_p(_curl_info)) {                                      \\\r\n    if(_curl_is_string_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), char *))                                        \\\r\n        _curl_easy_getinfo_err_string();                                      \\\r\n    if(_curl_is_long_info(_curl_info))                                        \\\r\n      if(!_curl_is_arr((arg), long))                                          \\\r\n        _curl_easy_getinfo_err_long();                                        \\\r\n    if(_curl_is_double_info(_curl_info))                                      \\\r\n      if(!_curl_is_arr((arg), double))                                        \\\r\n        _curl_easy_getinfo_err_double();                                      \\\r\n    if(_curl_is_slist_info(_curl_info))                                       \\\r\n      if(!_curl_is_arr((arg), struct curl_slist *))                           \\\r\n        _curl_easy_getinfo_err_curl_slist();                                  \\\r\n  }                                                                           \\\r\n  curl_easy_getinfo(handle, _curl_info, arg);                                 \\\r\n})\r\n\r\n/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),\r\n * for now just make sure that the functions are called with three\r\n * arguments\r\n */\r\n#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)\r\n#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)\r\n\r\n\r\n/* the actual warnings, triggered by calling the _curl_easy_setopt_err*\r\n * functions */\r\n\r\n/* To define a new warning, use _CURL_WARNING(identifier, \"message\") */\r\n#define _CURL_WARNING(id, message)                                            \\\r\n  static void __attribute__((__warning__(message)))                           \\\r\n  __attribute__((__unused__)) __attribute__((__noinline__))                   \\\r\n  id(void) { __asm__(\"\"); }\r\n\r\n_CURL_WARNING(_curl_easy_setopt_err_long,\r\n  \"curl_easy_setopt expects a long argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,\r\n  \"curl_easy_setopt expects a curl_off_t argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_string,\r\n              \"curl_easy_setopt expects a \"\r\n              \"string (char* or char[]) argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_write_callback,\r\n  \"curl_easy_setopt expects a curl_write_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_read_cb,\r\n  \"curl_easy_setopt expects a curl_read_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,\r\n  \"curl_easy_setopt expects a curl_ioctl_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,\r\n  \"curl_easy_setopt expects a curl_sockopt_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,\r\n              \"curl_easy_setopt expects a \"\r\n              \"curl_opensocket_callback argument for this option\"\r\n  )\r\n_CURL_WARNING(_curl_easy_setopt_err_progress_cb,\r\n  \"curl_easy_setopt expects a curl_progress_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_debug_cb,\r\n  \"curl_easy_setopt expects a curl_debug_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,\r\n  \"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_conv_cb,\r\n  \"curl_easy_setopt expects a curl_conv_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_seek_cb,\r\n  \"curl_easy_setopt expects a curl_seek_callback argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_cb_data,\r\n              \"curl_easy_setopt expects a \"\r\n              \"private data pointer as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_error_buffer,\r\n              \"curl_easy_setopt expects a \"\r\n              \"char buffer of CURL_ERROR_SIZE as argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_FILE,\r\n  \"curl_easy_setopt expects a FILE* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_postfields,\r\n  \"curl_easy_setopt expects a void* or char* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,\r\n  \"curl_easy_setopt expects a struct curl_httppost* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_curl_slist,\r\n  \"curl_easy_setopt expects a struct curl_slist* argument for this option\")\r\n_CURL_WARNING(_curl_easy_setopt_err_CURLSH,\r\n  \"curl_easy_setopt expects a CURLSH* argument for this option\")\r\n\r\n_CURL_WARNING(_curl_easy_getinfo_err_string,\r\n  \"curl_easy_getinfo expects a pointer to char * for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_long,\r\n  \"curl_easy_getinfo expects a pointer to long for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_double,\r\n  \"curl_easy_getinfo expects a pointer to double for this info\")\r\n_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,\r\n  \"curl_easy_getinfo expects a pointer to struct curl_slist * for this info\")\r\n\r\n/* groups of curl_easy_setops options that take the same type of argument */\r\n\r\n/* To add a new option to one of the groups, just add\r\n *   (option) == CURLOPT_SOMETHING\r\n * to the or-expression. If the option takes a long or curl_off_t, you don't\r\n * have to do anything\r\n */\r\n\r\n/* evaluates to true if option takes a long argument */\r\n#define _curl_is_long_option(option)                                          \\\r\n  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)\r\n\r\n#define _curl_is_off_t_option(option)                                         \\\r\n  ((option) > CURLOPTTYPE_OFF_T)\r\n\r\n/* evaluates to true if option takes a char* argument */\r\n#define _curl_is_string_option(option)                                        \\\r\n  ((option) == CURLOPT_URL ||                                                 \\\r\n   (option) == CURLOPT_PROXY ||                                               \\\r\n   (option) == CURLOPT_INTERFACE ||                                           \\\r\n   (option) == CURLOPT_NETRC_FILE ||                                          \\\r\n   (option) == CURLOPT_USERPWD ||                                             \\\r\n   (option) == CURLOPT_USERNAME ||                                            \\\r\n   (option) == CURLOPT_PASSWORD ||                                            \\\r\n   (option) == CURLOPT_PROXYUSERPWD ||                                        \\\r\n   (option) == CURLOPT_PROXYUSERNAME ||                                       \\\r\n   (option) == CURLOPT_PROXYPASSWORD ||                                       \\\r\n   (option) == CURLOPT_NOPROXY ||                                             \\\r\n   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \\\r\n   (option) == CURLOPT_REFERER ||                                             \\\r\n   (option) == CURLOPT_USERAGENT ||                                           \\\r\n   (option) == CURLOPT_COOKIE ||                                              \\\r\n   (option) == CURLOPT_COOKIEFILE ||                                          \\\r\n   (option) == CURLOPT_COOKIEJAR ||                                           \\\r\n   (option) == CURLOPT_COOKIELIST ||                                          \\\r\n   (option) == CURLOPT_FTPPORT ||                                             \\\r\n   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \\\r\n   (option) == CURLOPT_FTP_ACCOUNT ||                                         \\\r\n   (option) == CURLOPT_RANGE ||                                               \\\r\n   (option) == CURLOPT_CUSTOMREQUEST ||                                       \\\r\n   (option) == CURLOPT_SSLCERT ||                                             \\\r\n   (option) == CURLOPT_SSLCERTTYPE ||                                         \\\r\n   (option) == CURLOPT_SSLKEY ||                                              \\\r\n   (option) == CURLOPT_SSLKEYTYPE ||                                          \\\r\n   (option) == CURLOPT_KEYPASSWD ||                                           \\\r\n   (option) == CURLOPT_SSLENGINE ||                                           \\\r\n   (option) == CURLOPT_CAINFO ||                                              \\\r\n   (option) == CURLOPT_CAPATH ||                                              \\\r\n   (option) == CURLOPT_RANDOM_FILE ||                                         \\\r\n   (option) == CURLOPT_EGDSOCKET ||                                           \\\r\n   (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \\\r\n   (option) == CURLOPT_KRBLEVEL ||                                            \\\r\n   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \\\r\n   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \\\r\n   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \\\r\n   (option) == CURLOPT_CRLFILE ||                                             \\\r\n   (option) == CURLOPT_ISSUERCERT ||                                          \\\r\n   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \\\r\n   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \\\r\n   (option) == CURLOPT_MAIL_FROM ||                                           \\\r\n   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \\\r\n   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \\\r\n   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a curl_write_callback argument */\r\n#define _curl_is_write_cb_option(option)                                      \\\r\n  ((option) == CURLOPT_HEADERFUNCTION ||                                      \\\r\n   (option) == CURLOPT_WRITEFUNCTION)\r\n\r\n/* evaluates to true if option takes a curl_conv_callback argument */\r\n#define _curl_is_conv_cb_option(option)                                       \\\r\n  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \\\r\n   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \\\r\n   (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)\r\n\r\n/* evaluates to true if option takes a data argument to pass to a callback */\r\n#define _curl_is_cb_data_option(option)                                       \\\r\n  ((option) == CURLOPT_WRITEDATA ||                                           \\\r\n   (option) == CURLOPT_READDATA ||                                            \\\r\n   (option) == CURLOPT_IOCTLDATA ||                                           \\\r\n   (option) == CURLOPT_SOCKOPTDATA ||                                         \\\r\n   (option) == CURLOPT_OPENSOCKETDATA ||                                      \\\r\n   (option) == CURLOPT_PROGRESSDATA ||                                        \\\r\n   (option) == CURLOPT_WRITEHEADER ||                                         \\\r\n   (option) == CURLOPT_DEBUGDATA ||                                           \\\r\n   (option) == CURLOPT_SSL_CTX_DATA ||                                        \\\r\n   (option) == CURLOPT_SEEKDATA ||                                            \\\r\n   (option) == CURLOPT_PRIVATE ||                                             \\\r\n   (option) == CURLOPT_SSH_KEYDATA ||                                         \\\r\n   (option) == CURLOPT_INTERLEAVEDATA ||                                      \\\r\n   (option) == CURLOPT_CHUNK_DATA ||                                          \\\r\n   (option) == CURLOPT_FNMATCH_DATA ||                                        \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a POST data argument (void* or char*) */\r\n#define _curl_is_postfields_option(option)                                    \\\r\n  ((option) == CURLOPT_POSTFIELDS ||                                          \\\r\n   (option) == CURLOPT_COPYPOSTFIELDS ||                                      \\\r\n   0)\r\n\r\n/* evaluates to true if option takes a struct curl_slist * argument */\r\n#define _curl_is_slist_option(option)                                         \\\r\n  ((option) == CURLOPT_HTTPHEADER ||                                          \\\r\n   (option) == CURLOPT_HTTP200ALIASES ||                                      \\\r\n   (option) == CURLOPT_QUOTE ||                                               \\\r\n   (option) == CURLOPT_POSTQUOTE ||                                           \\\r\n   (option) == CURLOPT_PREQUOTE ||                                            \\\r\n   (option) == CURLOPT_TELNETOPTIONS ||                                       \\\r\n   (option) == CURLOPT_MAIL_RCPT ||                                           \\\r\n   0)\r\n\r\n/* groups of curl_easy_getinfo infos that take the same type of argument */\r\n\r\n/* evaluates to true if info expects a pointer to char * argument */\r\n#define _curl_is_string_info(info)                                            \\\r\n  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)\r\n\r\n/* evaluates to true if info expects a pointer to long argument */\r\n#define _curl_is_long_info(info)                                              \\\r\n  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)\r\n\r\n/* evaluates to true if info expects a pointer to double argument */\r\n#define _curl_is_double_info(info)                                            \\\r\n  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)\r\n\r\n/* true if info expects a pointer to struct curl_slist * argument */\r\n#define _curl_is_slist_info(info)                                             \\\r\n  (CURLINFO_SLIST < (info))\r\n\r\n\r\n/* typecheck helpers -- check whether given expression has requested type*/\r\n\r\n/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,\r\n * otherwise define a new macro. Search for __builtin_types_compatible_p\r\n * in the GCC manual.\r\n * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is\r\n * the actual expression passed to the curl_easy_setopt macro. This\r\n * means that you can only apply the sizeof and __typeof__ operators, no\r\n * == or whatsoever.\r\n */\r\n\r\n/* XXX: should evaluate to true iff expr is a pointer */\r\n#define _curl_is_any_ptr(expr)                                                \\\r\n  (sizeof(expr) == sizeof(void*))\r\n\r\n/* evaluates to true if expr is NULL */\r\n/* XXX: must not evaluate expr, so this check is not accurate */\r\n#define _curl_is_NULL(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))\r\n\r\n/* evaluates to true if expr is type*, const type* or NULL */\r\n#define _curl_is_ptr(expr, type)                                              \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), const type *))\r\n\r\n/* evaluates to true if expr is one of type[], type*, NULL or const type* */\r\n#define _curl_is_arr(expr, type)                                              \\\r\n  (_curl_is_ptr((expr), type) ||                                              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), type []))\r\n\r\n/* evaluates to true if expr is a string */\r\n#define _curl_is_string(expr)                                                 \\\r\n  (_curl_is_arr((expr), char) ||                                              \\\r\n   _curl_is_arr((expr), signed char) ||                                       \\\r\n   _curl_is_arr((expr), unsigned char))\r\n\r\n/* evaluates to true if expr is a long (no matter the signedness)\r\n * XXX: for now, int is also accepted (and therefore short and char, which\r\n * are promoted to int when passed to a variadic function) */\r\n#define _curl_is_long(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \\\r\n   __builtin_types_compatible_p(__typeof__(expr), int) ||                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed int) ||              \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned int) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), short) ||                   \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed short) ||            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned short) ||          \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(expr), signed char) ||             \\\r\n   __builtin_types_compatible_p(__typeof__(expr), unsigned char))\r\n\r\n/* evaluates to true if expr is of type curl_off_t */\r\n#define _curl_is_off_t(expr)                                                  \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))\r\n\r\n/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */\r\n/* XXX: also check size of an char[] array? */\r\n#define _curl_is_error_buffer(expr)                                           \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \\\r\n   __builtin_types_compatible_p(__typeof__(expr), char[]))\r\n\r\n/* evaluates to true if expr is of type (const) void* or (const) FILE* */\r\n#if 0\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_ptr((expr), FILE))\r\n#else /* be less strict */\r\n#define _curl_is_cb_data(expr)                                                \\\r\n  _curl_is_any_ptr(expr)\r\n#endif\r\n\r\n/* evaluates to true if expr is of type FILE* */\r\n#define _curl_is_FILE(expr)                                                   \\\r\n  (__builtin_types_compatible_p(__typeof__(expr), FILE *))\r\n\r\n/* evaluates to true if expr can be passed as POST data (void* or char*) */\r\n#define _curl_is_postfields(expr)                                             \\\r\n  (_curl_is_ptr((expr), void) ||                                              \\\r\n   _curl_is_arr((expr), char))\r\n\r\n/* FIXME: the whole callback checking is messy...\r\n * The idea is to tolerate char vs. void and const vs. not const\r\n * pointers in arguments at least\r\n */\r\n/* helper: __builtin_types_compatible_p distinguishes between functions and\r\n * function pointers, hide it */\r\n#define _curl_callback_compatible(func, type)                                 \\\r\n  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \\\r\n   __builtin_types_compatible_p(__typeof__(func), type*))\r\n\r\n/* evaluates to true if expr is of type curl_read_callback or \"similar\" */\r\n#define _curl_is_read_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_read_callback6))\r\ntypedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);\r\ntypedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_write_callback or \"similar\" */\r\n#define _curl_is_write_cb(expr)                                               \\\r\n  (_curl_is_read_cb(expr) ||                                            \\\r\n   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_write_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_write_callback6))\r\ntypedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback2)(const char *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);\r\ntypedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);\r\ntypedef size_t (_curl_write_callback5)(const void *, size_t, size_t,\r\n                                       const void*);\r\ntypedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);\r\n\r\n/* evaluates to true if expr is of type curl_ioctl_callback or \"similar\" */\r\n#define _curl_is_ioctl_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_ioctl_callback4))\r\ntypedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);\r\ntypedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);\r\ntypedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);\r\ntypedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);\r\n\r\n/* evaluates to true if expr is of type curl_sockopt_callback or \"similar\" */\r\n#define _curl_is_sockopt_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_sockopt_callback2))\r\ntypedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);\r\ntypedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,\r\n                                      curlsocktype);\r\n\r\n/* evaluates to true if expr is of type curl_opensocket_callback or\r\n   \"similar\" */\r\n#define _curl_is_opensocket_cb(expr)                                    \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \\\r\n   _curl_callback_compatible((expr), _curl_opensocket_callback4))\r\ntypedef curl_socket_t (_curl_opensocket_callback1)\r\n  (void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback2)\r\n  (void *, curlsocktype, const struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback3)\r\n  (const void *, curlsocktype, struct curl_sockaddr *);\r\ntypedef curl_socket_t (_curl_opensocket_callback4)\r\n  (const void *, curlsocktype, const struct curl_sockaddr *);\r\n\r\n/* evaluates to true if expr is of type curl_progress_callback or \"similar\" */\r\n#define _curl_is_progress_cb(expr)                                      \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \\\r\n   _curl_callback_compatible((expr), _curl_progress_callback2))\r\ntypedef int (_curl_progress_callback1)(void *,\r\n    double, double, double, double);\r\ntypedef int (_curl_progress_callback2)(const void *,\r\n    double, double, double, double);\r\n\r\n/* evaluates to true if expr is of type curl_debug_callback or \"similar\" */\r\n#define _curl_is_debug_cb(expr)                                         \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \\\r\n   _curl_callback_compatible((expr), _curl_debug_callback8))\r\ntypedef int (_curl_debug_callback1) (CURL *,\r\n    curl_infotype, char *, size_t, void *);\r\ntypedef int (_curl_debug_callback2) (CURL *,\r\n    curl_infotype, char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback3) (CURL *,\r\n    curl_infotype, const char *, size_t, void *);\r\ntypedef int (_curl_debug_callback4) (CURL *,\r\n    curl_infotype, const char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback5) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback6) (CURL *,\r\n    curl_infotype, unsigned char *, size_t, const void *);\r\ntypedef int (_curl_debug_callback7) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, void *);\r\ntypedef int (_curl_debug_callback8) (CURL *,\r\n    curl_infotype, const unsigned char *, size_t, const void *);\r\n\r\n/* evaluates to true if expr is of type curl_ssl_ctx_callback or \"similar\" */\r\n/* this is getting even messier... */\r\n#define _curl_is_ssl_ctx_cb(expr)                                       \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \\\r\n   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))\r\ntypedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);\r\n#ifdef HEADER_SSL_H\r\n/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX\r\n * this will of course break if we're included before OpenSSL headers...\r\n */\r\ntypedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);\r\ntypedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,\r\n                                           const void *);\r\n#else\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;\r\ntypedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;\r\n#endif\r\n\r\n/* evaluates to true if expr is of type curl_conv_callback or \"similar\" */\r\n#define _curl_is_conv_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_conv_callback4))\r\ntypedef CURLcode (*_curl_conv_callback1)(char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback3)(void *, size_t length);\r\ntypedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);\r\n\r\n/* evaluates to true if expr is of type curl_seek_callback or \"similar\" */\r\n#define _curl_is_seek_cb(expr)                                          \\\r\n  (_curl_is_NULL(expr) ||                                                     \\\r\n   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \\\r\n   _curl_callback_compatible((expr), _curl_seek_callback2))\r\ntypedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);\r\ntypedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);\r\n\r\n\r\n#endif /* __CURL_TYPECHECK_GCC_H */\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/AppDelegate.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  AppDelegate.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#import <UIKit/UIKit.h>\r\n\r\n@class ViewController;\r\n\r\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\r\n\r\n@property (strong, nonatomic) UIWindow *window;\r\n\r\n@property (strong, nonatomic) ViewController *viewController;\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CSockReadStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockReadStream.h\r\n//\r\n//\r\n\r\n#ifndef CSockReadStream_h\r\n#define CSockReadStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CSockWriteStream;\r\n\r\n// ファイルアクセスクラス実装\r\nclass CSockReadStream : public IReadStream\r\n{\r\n    friend class CSockWriteStream;\r\nprivate:\r\n    enum {\r\n        READ_BUFSIZ = 4096\r\n    };\r\n    // ファクトリとなるクラスメソッド以外で勝手に new はできない\r\n    CSockReadStream();\r\n\r\npublic:\r\n    // delete はできる。\r\n    virtual ~CSockReadStream();\r\n\r\n    // 指定されたIPアドレスまたはFQDNとPORTで CSockReadStream インスタンスを作り、そのポインタを返す。\r\n    // このクラスメソッドはプラットフォーム側のために用意され、ゲーム側では IReadStream のポインタとして\r\n    // 扱われるため、このメソッドを扱うことは出来ない(可能ではあるが推奨されない)\r\n    static CSockReadStream * openStream(const char * path);\r\n    \r\n\r\n    s32     getSize();\r\n    s32     getPosition();\r\n    u8      readU8();\r\n    u16     readU16();\r\n    u32     readU32();\r\n    float   readFloat();\r\n    bool    readBlock(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus();\r\n    \r\n    int     readU16arr(u16 * pBufferU16, int items);\r\n    int     readU32arr(u32 * pBufferU32, int items);\r\n    \r\n    \r\n    IWriteStream * getWriteStream();\r\nprivate:\r\n    int     sock_connect(const char * hostname, int port);\r\n    bool    readRingBuf();\r\n    bool    requestData(unsigned char * buf, size_t size);\r\n    bool    setStatus();\r\n    \r\n    inline size_t left_size() {\r\n        size_t leftSize = 0;\r\n        if(m_lastPos > m_getPos) {\r\n            leftSize = m_lastPos - m_getPos;\r\n        } else if(m_lastPos < m_getPos) {\r\n            leftSize = m_lastPos + READ_BUFSIZ - m_getPos;\r\n        } else {\r\n            if(m_lastPos) {\r\n                leftSize = READ_BUFSIZ;\r\n            }\r\n        }\r\n        return leftSize;\r\n    }\r\nprivate:\r\n    ESTATUS     m_eStat;\r\n    int         m_fd;\r\n    \r\n    // 読み込みバッファ: 受信データは一度このバッファを経由する。\r\n    u8          m_readBuf[ READ_BUFSIZ ];\r\n    int         m_lastPos;  // データ終端\r\n    int         m_getPos;   // データ始端\r\n\r\n    // 同じ fd を使用して送出に使用される CSockWriteStream のポインタ\r\n    CSockWriteStream    *   m_writeStream;\r\n};\r\n\r\n\r\n#endif // CSockReadStream_h\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CSockWriteStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CSockWriteStream.h\r\n//\r\n//\r\n\r\n#ifndef CSockWriteStream_h\r\n#define CSockWriteStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CSockReadStream;\r\n\r\n// ファイルアクセスクラス実装\r\nclass CSockWriteStream : public IWriteStream\r\n{\r\n    friend class CSockReadStream;\r\nprivate:\r\n    CSockWriteStream(CSockReadStream& rdStream);\r\n    virtual ~CSockWriteStream();\r\n    \r\n    bool    sendData(unsigned char * buffer, size_t sndSize);\r\npublic:\t\r\n\tESTATUS\tgetStatus\t();\r\n\ts32\t\tgetPosition\t();\r\n\tvoid\twriteU8\t\t(u8 value);\t// Use cast to support s8\r\n\tvoid\twriteU16\t(u16 value);\t// Use cast to support s16\r\n\tvoid\twriteU32\t(u32 value);\t// Use cast to support s32\r\n\tvoid\twriteFloat\t(float);\r\n\tvoid\twriteBlock\t(void* buffer, u32 byteSize);\r\n\r\nprivate:\r\n    int         m_fd;\r\n    ESTATUS     m_eStat;\r\n};\r\n\r\n#endif // CSockWriteStream_h\r\n\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSAudio.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSAudio.h\r\n//\r\n//\r\n\r\n#ifndef CiOSAudio_h\r\n#define CiOSAudio_h\r\n\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <GLKit/GLKit.h>\r\n#import <mach/time_value.h>\r\n#import <Foundation/Foundation.h>\r\n#import <AudioToolbox/AudioToolbox.h>\r\n#import <AudioToolbox/ExtendedAudioFile.h>\r\n#import <AudioToolbox/AudioFile.h>\r\n#include \"CSoundAnalysis.h\"\r\n#include \"encryptFile.h\"\r\n\r\nclass CiOSPlatform;\r\nclass CiOSAudio;\r\nclass CiOSAudioSession;\r\n\r\n\r\nclass cAudioFadeParam\r\n{\r\n    friend class CiOSAudio;\r\n    friend class CiOSAudioSession;\r\npublic:\r\n    cAudioFadeParam();\r\n    virtual ~cAudioFadeParam();\r\n\r\n    void attach();\r\n    void detach();\r\n    void exec();\r\n    bool setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType=INTER_TYPE_LINEAR, float _startVolume=1.0f);\r\n \r\n    static void AudioFadeParamInit();\r\n    static void AudioFadeParamExit();\r\n    static void SetFadeParam(CiOSAudio * _audio, CiOSAudioSession * _settion, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType=INTER_TYPE_LINEAR, float _startVolume=0.0f);\r\n    static void Remove(void * _audio);\r\n\tstatic s32 ThreadAudioFadeParam(void * hThread, void * data);\r\npublic:\r\n    // フェード関係のパラメータ\r\n    enum FADE_TYPE\r\n    {\r\n        FADE_TYPE_NONE = 0,\r\n        FADE_TYPE_PLAY,         //!< fade in\r\n        FADE_TYPE_STOP,         //!< fade out\r\n        FADE_TYPE_PAUSE,        //!< fade out\r\n        FADE_TYPE_RESUME,       //!< fade in\r\n        FADE_TYPE_PLAYING,      //!< fade\r\n        \r\n        FADE_TYPE_NUM,\r\n    };\r\n    \r\n    enum INTER_TYPE\r\n    {\r\n        INTER_TYPE_NONE = 0,\r\n        INTER_TYPE_LINEAR,         //!< Linear\r\n        \r\n        INTER_TYPE_NUM,\r\n    };\r\n    \r\nprivate:\r\n    s32                 m_fadeCnt;          //!< フェードカウント(ミリ秒)\r\n    float               m_startVol;         //!< フェード開始のボリューム値(0.0f~1.0f)\r\n    float               m_endVol;           //!< フェード終了のボリューム値(0.0f~1.0f)\r\n    float               m_fadeRatio;        //!< フェード割合(0.0f〜1.0f)\r\n    s32                 m_fadeMiliSec;      //!< フェードに要する時間(ミリ秒)\r\n    s16                 m_nowFadeInterType; //!< 現在のフェード補間タイプ\r\n    s16                 m_nowFadeType;      //!< 現在のフェードタイプ\r\n    bool                m_bfade;            //!< フェード中？\r\n    s64                 m_prevmseq;         //!< 前回の再生時間\r\n    \r\n    CiOSAudio*          m_pAudio;           //!< 対象者\r\n    CiOSAudioSession*   m_pSession;         //!< 対象者\r\n    \r\n    cAudioFadeParam*    m_prev; //!< 前のフェードパラメータ\r\n    cAudioFadeParam*    m_next; //!< 次のフェードパラメータ\r\n    \r\n    static cAudioFadeParam* s_fadeParamList;\r\n    static void*            s_fadeParamThread;\r\n};\r\n\r\nclass CiOSAudioSession\r\n{\r\n    friend class CiOSAudio;\r\nprivate:\r\n    CiOSAudioSession(CiOSAudio * pAudio);\r\n    virtual ~CiOSAudioSession();\r\n    \r\n    void init();\r\npublic:\r\n    void play();\r\n    void stop();\r\n    void pause();\r\n    void resume();\r\n    s64 tell();\r\n    void checkSessionStoped();\r\n    inline bool isPlaying() { return m_isPlaying; }\r\n    inline bool isPause() { return m_isPause; }\r\n    \r\n    inline float getFadeRatio(void) { return m_fadeRatio; }\r\n    void setFadeRatio(float _fadeRatio);\r\nprivate:\r\n    CiOSAudioSession    *   m_prev;\r\n    CiOSAudioSession    *   m_next;\r\n\r\n    CiOSAudio   *       m_audio;\r\n    AudioUnit           m_audioUnit;\r\n  \r\n    SInt64              m_currentFrame; //!< 現在の再生フレーム\r\n    bool                m_isDone;       //!< 再生終了？\r\n    bool                m_isPlaying;    //!< 再生中？\r\n    bool                m_isPause;      //!< pause中？\r\n    \r\n    float               m_volume;       //!< ボリューム(0.0f~1.0f)\r\n    float               m_panL;         //!< 左ボリューム\r\n    float               m_panR;         //!< 右ボリューム\r\n    \r\n    float               m_fadeRatio;\r\n\r\n    OSStatus callbackSE(AudioUnitRenderActionFlags * ioActionFlags,\r\n                        const AudioTimeStamp * inTimeStamp,\r\n                        UInt32 inBusNumber,\r\n                        UInt32 inNumberFrames,\r\n                        AudioBufferList * ioData);\r\n    \r\n    static OSStatus renderCallback(void * inRefCon, AudioUnitRenderActionFlags * ioActionFlags,\r\n                                   const AudioTimeStamp * inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList * ioData);\r\n};\r\n\r\nclass AudioFileMemory\r\n{\r\npublic:\r\n\tAudioFileMemory();\r\n    ~AudioFileMemory() {}\r\n\t\r\npublic:\r\n\tu8*\t\t\t\tm_decryptBuffer;\r\n\tu32\t\t\t\tm_dataLength;\r\n\r\npublic:\r\n\tbool\t\t\tloadFile\t\t(const char* url);\r\n\tvoid\t\t\trelease\t\t\t();\r\n    \r\nprivate:\r\n    CDecryptBaseClass m_decrypter;\r\n    inline void decrypt(void* ptr, u32 length) {\r\n        m_decrypter.decryptBlck(ptr, length);\r\n    }\r\n\tinline u32 decryptSetup(const u8* ptr, const u8* hdr) {\r\n        return m_decrypter.decryptSetup(ptr, hdr);\r\n    }\r\n};\r\n\r\nclass CiOSAudio\r\n{\r\n    friend class CiOSAudioSession;\r\nprivate:\r\n    typedef struct {\r\n        const char * top;\r\n        const char * phisical;    \r\n    } LOCLIST;\r\n    static const LOCLIST m_toplevel[];\r\n    \r\npublic:\r\n    CiOSAudio();\r\n    virtual ~CiOSAudio();\r\n\r\n    bool openAudio(const char * path, CiOSPlatform * platform);\r\n    bool loadMem(); // オンメモリ化\r\n    \r\n    inline void setLuaPause(bool _bLuaPause) { m_luaPause = _bLuaPause; }\r\n    inline bool getLuaPause(void) { return m_luaPause; }\r\n    \r\n    void play(s32 _msec=0, float _tgtVol=1.0f, float _startVol=1.0f);\r\n    void stop(s32 _msec=0, float _tgtVol=0.0f);\r\n    void pause(s32 _msec=0, float _tgtVol=0.0f);\r\n    void resume(s32 _msec=0, float _tgtVol=1.0f);\r\n    void seek(s32 millisec);\r\n    s32 tell();\r\n    s32 totalPlayTime();\r\n    \r\n    void setFadeParam(float _tgtVol, u32 _msec);\r\n    inline float getFadeRatio(void) { return m_fadeRatio; }\r\n    void setFadeRatio(float _fadeRatio);\r\n    s32 getState();\r\n    \r\n    void closeAudio();\r\n    \r\n    void setVolume(float volume);\r\n    inline float getVolume() { return m_volume; }\r\n    void setPan(float pan);\r\n    inline float getPan() { return m_pan; }\r\n    \r\n    inline bool isActive() { return m_bActive; }\r\n    inline int getInterruptionType() { return m_interruptionType; }\r\n    inline void setInterruptionType( int _interruptionType ) { m_interruptionType = _interruptionType; }\r\n\r\n    inline bool setBufSize(int level) {\r\n        if(level < 0 || level > 2) return false;\r\n        m_buf_level = level;\r\n        return true;\r\n    }\r\n    void updateVolume();\r\n    void checkSessionStoped();\r\n    void audioSessionCleanup();\r\n\r\nprivate:\r\n\r\n    enum {\r\n        BUF_COUNT = 3\r\n    };\r\n    enum {\r\n        STEP_WAIT,\r\n        STEP_PLAY,\r\n        STEP_PAUSE\r\n    };\r\n    const char                      *   m_soundPath;\r\n    // char                         *   m_soundFullpath;\r\n    bool                                m_bActive;\r\n    bool                                m_preLoad;\r\n    bool                                m_bInit;\r\n    bool                                m_bSeeked;\r\n    int                                 m_interruptionType;    //!< サウンドの割り込みタイプ\r\n    bool                                m_luaPause;\r\n\r\n    int                                 m_buf_level;\r\n    int                                 m_step;\r\n\r\n    NSURL                           *   m_soundURL;\r\n    AudioFileID                         m_audioID;\r\n    AudioStreamBasicDescription         m_ASBD;\r\n    AudioStreamPacketDescription    *   m_ASPD;\r\n    AudioQueueRef                       m_queue;\r\n    AudioQueueBufferRef                 m_qBuf[ BUF_COUNT ];\r\n    AudioQueueTimelineRef               m_TlineRef;\r\n    \r\n    int                                 m_bufIndex;\r\n    \r\n    UInt64                              m_numPacketPerTime;\r\n    UInt32                              m_maxPacketSize;    \r\n    SInt64                              m_startPackNum;\r\n    SInt64                              m_pauseTime;\r\n    s32                                 m_nowPlayTime;  // BGMの現在再生時刻\r\n    uint64_t                            m_tval;\r\n    uint64_t                            m_last_delta;\r\n\r\n    \r\n    float                               m_volume;\r\n    float                               m_pan;\r\n    float                               m_panR;\r\n    float                               m_panL;\r\n    \r\n    float                               m_fadeRatio;\r\n    sSoundAnalysisData                  m_soundAnalysisData;\r\n    \r\n    ExtAudioFileRef                     m_extAudioID;\r\n    AudioStreamBasicDescription         m_clientFormat;\r\n    SInt64                              m_totalFrames;\r\n    \r\n    AudioUnitSampleType             **  m_playBuffer;\r\n    \r\n    CiOSAudioSession                *   m_begin;\r\n    CiOSAudioSession                *   m_end;\r\n  \r\n    CiOSPlatform                    *   m_platform;\r\n\tAudioFileMemory\t\t\t\t\t\tm_encFile;\r\nprivate:\r\n    \r\n    void initBGM();\r\n    void playBGM();\r\n    void initSE();\r\n    void playSE(s32 _msec=0, float _tgtVol=1.0f, float _startVol=1.0f);\r\n    \r\n    void cleanup();\r\n\r\n    void sendQueue(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer);\r\n\r\n    static void queueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer);\r\n};\r\n\r\n#endif // CiOSAudio_h\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSAudioManager.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSAudioManager.h\r\n//\r\n//\r\n\r\n#ifndef CiOSAudioManager_h\r\n#define CiOSAudioManager_h\r\n\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <GLKit/GLKit.h>\r\n#import <mach/time_value.h>\r\n#import <Foundation/Foundation.h>\r\n#import <AudioToolbox/AudioToolbox.h>\r\n#import <AudioToolbox/ExtendedAudioFile.h>\r\n#import <AudioToolbox/AudioFile.h>\r\n\r\n#import \"CiOSPlatform.h\"\r\n#import \"CiOSAudio.h\"\r\n\r\n#define IOS_HARDWARE_IO_BUFFER_SIZE     ( 256 ) // IOバッファサイズ(最小128の最大1024くらいまでの2の乗数倍の値推奨)\r\n\r\nclass CiOSAudioManager\r\n{\r\npublic:\r\n    // サウンドの割り込みタイプ\r\n    enum eINTERRUPTION_TYPE\r\n    {\r\n        eINTERRUPTION_TYPE_NONE = -1,\r\n        \r\n        eINTERRUPTION_TYPE_CALLING = 0,         //!< 電話、Siriなどの割り込み\r\n        eINTERRUPTION_TYPE_RESIGN_ACTIVE,       //!< ホームボタンダブルタップなどによる非アクティブ状態\r\n        eINTERRUPTION_TYPE_ENTER_BACKGROUND,    //!< ホームボタンなどによるアプリがバックグラウンドにある状態\r\n        \r\n        eINTERRUPTION_TYPE_MAX\r\n    };\r\n    \r\nprivate:\r\n    CiOSAudioManager();\r\n    virtual ~CiOSAudioManager();\r\n    const CiOSAudioManager& operator = (const CiOSAudioManager& _manager) { return *this; }\r\n    \r\npublic:\r\n    //! インスタンスの取得\r\n    static CiOSAudioManager& GetInstance( void ) { return m_instance; }\r\n    \r\n    //! 初期化処理\r\n    bool Initialize( void );\r\n    \r\n    //! 終了処理\r\n    bool Termination( void );\r\n    \r\n    //! サウンドハンドル作成\r\n    void* CreateAudioHandle( const char* _url, CiOSPlatform* _platform );\r\n    \r\n    //! AudioSessionの初期化\r\n    bool AudioSessionInit( void );\r\n    \r\n    //! AudioSessionプロパティの設定\r\n    bool AudioSessionPropertySetting( void );\r\n    \r\n    //! 割り込み開始処理\r\n    void AudioBeginInterruption( void );\r\n    \r\n    //! 割り込み終了処理\r\n    void AudioEndInterruption( void );\r\n    \r\n    //! 非アクティブになる瞬間の処理\r\n    void AudioDidResignActive( void );\r\n    \r\n    //! アクティブに戻る瞬間の処理\r\n    void AudioDidBecomeActive( void );\r\n    \r\n    //! バックグラウンドに行く瞬間の処理\r\n    void AudioDidEnterBackground( void );\r\n    \r\n    //! バックグラウンドから戻る際の処理\r\n    void AudioDidEnterForeground( void );\r\n    \r\n    //! サウンドとミュージックの並行処理タイプ\r\n    void SetAudioMultiProcessType( s32 _type );\r\n    inline s32 GetAudioMultiProcessType( void ) { return m_multiProcessType; }\r\n    \r\n    //! サウンドの割り込み処理をエンジン側で制御するかどうか\r\n    inline void setPauseOnInterruption( bool _bPauseOnInterruption ) { m_bPauseOnInterruption = _bPauseOnInterruption; }\r\n    inline bool getPauseOnInterruption( void ) { return m_bPauseOnInterruption; }\r\n    \r\n    //! iPodミュージックプレーヤーの再生状態取得\r\n    bool isMusicPlayerPlaying( void );\r\n    \r\n    //! 音量設定\r\n    void SetSEMasterVolume( float _vol );\r\n    void SetBGMMasterVolume( float _vol );\r\n    float GetSEMasterVolume( void );\r\n    float GetBGMMasterVolume( void );\r\n    void UpdateVolume( void );\r\n    \r\n    //! 現在の設定によりマスターボリュームのON/OFF\r\n    void chackAudioMasterVolume( void );\r\n    \r\n    //! 毎フレーム行う処理\r\n    void Exec( void );\r\n\r\nprivate:\r\n    static CiOSAudioManager m_instance;\r\n    \r\nprivate:\r\n    enum {\r\n        SND_SLOT = 256     // サウンドスロット数\r\n    };\r\n    CiOSAudio   m_audio[SND_SLOT];\r\n    \r\n    // サウンドとミュージックの並行処理タイプ\r\n    s32         m_multiProcessType;\r\n    \r\n    // ボリューム関係\r\n    float       m_masterVol_se;     //!< SEのマスターボリューム\r\n    float       m_masterVol_bgm;    //!< BGMのマスターボリューム\r\n    \r\n    // サウンドのON/OFF\r\n    bool        m_bSEOff;           //!< SE\r\n    bool        m_bBGMOff;          //!< BGM\r\n    \r\n    //\r\n    bool        m_bInit;            //!< 初期化フラグ\r\n    \r\n    bool        m_bPauseOnInterruption; //!< サウンドのPauseをエンジン側で制御するかどうか\r\n};\r\n\r\n#endif // CiOSAudioManager_h\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSMovieView.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSMovieView.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CiOSMovieView_h\r\n#define CiOSMovieView_h\r\n\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <AVFoundation/AVFoundation.h>\r\n\r\n@interface CiOSMovieView : UIView {\r\n    \r\n}\r\n\r\n@end\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSPathConv.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  iOSPathConv.h\r\n//\r\n//\r\n\r\n#ifndef CiOSPathConv_h\r\n#define CiOSPathConv_h\r\n\r\n#include \"iOSFileLocation.h\"\r\n\r\nclass CiOSPathConv\r\n{\r\nprivate:\r\n    CiOSPathConv();\r\n    virtual ~CiOSPathConv();\r\n\r\npublic:\r\n    static CiOSPathConv& getInstance();\r\n    \r\n    const char * fullpath(const char * url, const char * suffix = 0, bool * isReadOnly = NULL);\r\n    \r\n    const char * install() { build(); return m_install; }\r\n    const char * external() { build(); return m_external; }\r\n\r\nprivate:\r\n    const char * makePath(const char * path, const char * suffix, const char * base);\r\n    bool checkExists(const char * path);\r\n\r\n    void build();\r\n    void create_external();\r\n    void create_install();\r\n\r\nprivate:\r\n    bool                m_build;\r\n    const char      *   m_external;\r\n    const char      *   m_install;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSPlatform.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n  ¥brief     iOS 用プラットフォーム側インタフェースクラス\r\n  ¥file      CiOSPlatform.h\r\n  */\r\n#ifndef CiOSPlatform_h\r\n#define CiOSPlatform_h\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <StoreKit/StoreKit.h>\r\n#import \"ViewController.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"FileSystem.h\"\r\n#include \"CiOSAudioManager.h\"\r\n#include \"CiOSWidget.h\"\r\n#include \"EAGLView.h\"\r\n\r\nclass CiOSFont\r\n{\r\npublic:\r\n\tCiOSFont(int size, const char * fontName = 0);\r\n\tvirtual ~CiOSFont();\r\n\r\n\tinline UIFont * getFont() { return m_tFont; }\r\n\tinline UIFont * getFontScaled() { return m_tFontScaled; }\r\n\tinline const char * getFontname() { return m_fontname; }\r\nprivate:\r\n\tUIFont  *   m_tFont;\r\n\tUIFont  *   m_tFontScaled;\r\n\tconst char *  m_fontname;\r\n\r\n\tstatic struct FONTLIST {\r\n\t\tconst char * alias;\r\n\t\tconst char * fontname;\r\n\t} ms_fontlist[];\r\n};\r\n\r\nclass CiOSPlatform : public IPlatformRequest\r\n{\r\n\tfriend class CiOSWidget;\r\n\tfriend class CiOSTextWidget;\r\n\tfriend class CiOSFont;\r\n\tfriend void assertFunction(int line, const char* file, const char* msg,...);\r\n\r\npublic:\r\n\tCiOSPlatform(UIViewController<UIAlertViewDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver> * pViewController, EAGLView * pView, float scale);\r\n    virtual ~CiOSPlatform();\r\n\r\n    void detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...);\r\n    void logging(const char * format, ...);\r\n\r\n    // バンドルバージョン取得\r\n    const char* getBundleVersion();\r\n    \r\n\t//! Use Encryption for disk I/O\r\n\tvirtual bool useEncryption();    \r\n\r\n    s64 nanotime();\r\n    \r\n    // ファイルシステム\r\n    IReadStream * openReadStream(const char * filename, bool decrypt);\r\n    \r\n    ITmpFile * openTmpFile(const char * tmpPath);\r\n    void removeTmpFile(const char * tmpPath);\r\n\tvirtual bool removeFileOrFolder\t (const char * filePath);\r\n\tvirtual u32 getFreeSpaceExternalKB();\r\n\tvirtual u32 getPhysicalMemKB\t ();\r\n\tvoid excludePathFromBackup(const char * fullpath);\r\n\r\n\tvirtual void*\t\tifopen\t(const char* name, const char* mode);\r\n\tvirtual void\t\tifclose\t(void* file);\r\n\tvirtual int\t\t\tifseek\t(void* file, long int offset, int origin);\r\n\tvirtual u32\t\t\tifread\t(void* ptr, u32 size, u32 count, void* file );\r\n\tvirtual u32\t\t\tifwrite\t(const void * ptr, u32 size, u32 count, void* file);\r\n\tvirtual int\t\t\tifflush\t(void* file);\r\n\tvirtual long int\tiftell\t(void* file);\r\n\tvirtual bool\t\ticreateEmptyFile(const char* name);\r\n\r\n    // サウンド系\r\n    void * loadAudio(const char * url, bool is_se = false);\r\n    bool   preLoad(void * handle);\r\n    bool   setBufSize(void * handle, int level);\r\n    void   playAudio(void * handle, s32 _msec=0, float _tgtVol=1.0f, float _startVol=0.0f);\r\n    void   stopAudio(void * handle, s32 _msec=0, float _tgtVol=0.0f);\r\n    void   setMasterVolume(float volume, bool SEmode);\r\n    void   setAudioVolume(void * handle, float volume);\r\n    void   setAudioPan(void * handle, float pan);\r\n    void   releaseAudio(void * handle);\r\n    \r\n    void pauseAudio(void * handle, s32 _msec=0, float _tgtVol=0.0f);\r\n    void resumeAudio(void * handle, s32 _msec=0, float _tgtVol=1.0f);\r\n    void seekAudio(void * handle, s32 millisec);\r\n    s32  tellAudio(void * handle);\r\n    s32  totalTimeAudio(void * handle);\r\n    void setFadeParam(void * _handle, float _tgtVol, u32 _msec);\r\n\r\n    s32  getState(void * handle);\r\n    \r\n    //! サウンドとミュージックの並行処理タイプ設定\r\n    void setAudioMultiProcessType( s32 _processType );\r\n    \r\n    //! サウンドの割り込み処理をエンジン側で制御するかどうか\r\n    void setPauseOnInterruption(bool _bPauseOnInterruption);\r\n    \r\n    //! 経過時間を取得(sec)\r\n    s64 getElapsedTime(void);\r\n\r\n    //! フォント取得\r\n\tbool registerFont(const char* logicalName, const char* physFile, bool default_);\r\n    void * getFont(int size, const char * fontName = 0, float* pAscent = NULL);\r\n    void * getFontSystem(int size, const char * fontName = 0);\r\n\r\n    //! フォント破棄\r\n    void deleteFont(void * pFont);\r\n    void deleteFontSystem(void * pFont);\r\n\r\n    //! フォントテクスチャ描画\r\n    bool renderText(const char* utf8String, void * pFont, u32 color,    //!< 描画する文字列とフォントの指定\r\n                    u16 width, u16 height, u8 * pBuffer8888,            //!< 描画対象とするテクスチャバッファとそのピクセルサイズ\r\n                    s16 stride, s16 base_x, s16 base_y, bool use4444);  //!< baseline起点とするテクスチャ内の位置\r\n    // フォントテクスチャ描画情報\r\n    bool getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo);\r\n    \r\n    void * getGLExtension(const char * ext);\r\n\r\n    // 環境上でのフルパス取得\r\n    const char * getFullPath(const char * assetPath, bool * isReadOnly);\r\n  \r\n    //! 動作環境情報文字列を返す。\r\n\tconst char * getPlatform();\r\n\r\n\t//! OSコントロールの生成と破棄\r\n\tIWidget * createControl(IWidget::CONTROL type, int id,\r\n\t\t\tconst char * caption, int x, int y, int width, int height, ...);\r\n\tvoid destroyControl(IWidget * pControl);\r\n\r\n\tbool callApplication(APP_TYPE type, ... );\r\n\r\n\tvoid * createThread(s32 (*thread_func)(void * hThread, void * data), void * data);\r\n\tvoid exitThread(void * hThread, s32 status);\r\n\tbool watchThread(void * hThread, s32 * status);\r\n\tvoid deleteThread(void * hThread);\r\n\tvoid breakThread(void * hThread);\r\n\r\n\tint genUserID(char * retBuf, int maxlen);\r\n\tint genUserPW(const char * salt, char * retBuf, int maxlen);\r\n\r\n\tbool readyDevID();\r\n\tint getDevID(char * retBuf, int maxlen);\r\n\r\n\tbool setSecureDataID(const char * service_name, const char * user_id);\r\n\tbool setSecureDataPW(const char * service_name, const char * pw);\r\n\tint getSecureDataID(const char * service_name, char * retBuf, int maxlen);\r\n\tint getSecureDataPW(const char * service_name, char * retBuf, int maxlen);\r\n\r\n\tbool delSecureDataID(const char * service_name);\r\n\tbool delSecureDataPW(const char * service_name);\r\n\r\n\tvoid initStoreTransactionObserver(void);\r\n\tvoid releaseStoreTransactionObserver(void);\r\n\tvoid buyStoreItems(const char * item_id);\r\n\tvoid getStoreProducts(const char* json, bool currency_mode);\r\n\tvoid finishStoreTransaction(const char *receipt);\r\n\r\n\tvoid responseStoreKitProducts(SKProductsResponse* response, ViewController* viewController);\r\n\r\n\tinline EAGLView * getView() const { return m_pView; }\r\n\tinline float getScale() const { return m_scale; }\r\n\tfloat getMasterVolume(bool SEmode) const;\r\n\r\n\tstatic CiOSPlatform * getInstance();\r\n\r\n\tvirtual void*\tallocMutex\t\t();\r\n\tvirtual void\tfreeMutex\t\t(void* mutex);\r\n\tvirtual void\tmutexLock\t\t(void* mutex);\r\n\tvirtual void\tmutexUnlock\t\t(void* mutex);\r\n\r\n\tvirtual void*\tallocEventLock\t();\r\n\tvirtual void\tfreeEventLock\t(void* lock);\r\n\tvirtual void\teventSleep\t\t(void* lock);\r\n\tvirtual void\teventWakeup\t\t(void* lock);\r\n\t\r\n\tvoid\tstartAlertDialog( const char* title , const char* message ){};\r\n\r\n\tvoid\tforbidSleep\t\t(bool is_forbidden);\r\n\r\nprivate:\r\n\tstruct PF_THREAD {\r\n\t\tjmp_buf   jmp;\r\n\t\tpthread_t id;\r\n\t\ts32 (*thread_func)(void *, void *);\r\n\t\tvoid * data;\r\n\t\ts32 result;\r\n\t};\r\n\tstatic void * ThreadProc(void * data);\r\n\r\n\tbool setKeyChain(const char * service_name, const char * key, const char * value);\r\n\tint getKeyChain(const char * service_name, const char * key, char * retBuf, int maxlen);\r\n\tbool delKeyChain(const char * service_name, const char * key);\r\n\r\n\tint sha512(const char * string, char * buf, int maxlen);\r\n\r\n\tUIViewController<SKProductsRequestDelegate,SKPaymentTransactionObserver>    *   m_pViewController;\r\n\tEAGLView            *   m_pView;\r\n\tfloat                   m_scale;\r\n\r\n\tenum {\r\n\t\tSTORE_NONE,\r\n\t\tSTORE_BUY_PRODUCTS,\r\n\t\tSTORE_GET_PRODUCTS\r\n\t};\r\n\tstruct StoreState\r\n\t{\r\n\t\tint m_mode;\r\n\t\tint m_count;\r\n\t\tbool m_currency;\r\n\t\tconst char* m_callback;\r\n\t} m_storeState;\r\n\r\n\tchar                    m_platform[256];\r\n\r\n\tstatic CiOSPlatform *   m_instance;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSReadFileStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSReadFileStream.h\r\n//\r\n//\r\n\r\n#ifndef CiOSReadFileStream_h\r\n#define CiOSReadFileStream_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n#include \"encryptFile.h\"\r\n\r\nclass CiOSWriteFileStream;\r\n\r\n// ファイルアクセスクラス実装\r\nclass CiOSReadFileStream : public IReadStream\r\n{\r\n    friend class CiOSWriteFileStream;\r\nprivate:\r\n    typedef struct {\r\n        const char * top;\r\n        int          loc;       // 0 で　install, 1 で external\r\n        bool         readonly;  // true の場合、その領域には書き込めない\r\n    } LOCLIST;\r\n    static const LOCLIST m_toplevel[];\r\n    \r\n    // ファクトリとなるクラスメソッド以外で勝手に new はできない\r\n    CiOSReadFileStream();\r\n    \r\n\tinline void decrypt(void* ptr, u32 length) {\r\n        m_decrypter.decryptBlck(ptr, length);\r\n    }\r\npublic:\r\n    // delete はできる。\r\n    virtual ~CiOSReadFileStream();\r\n\tinline u32 decryptSetup(const u8* ptr) {\r\n        u8 hdr[4];\r\n        hdr[0] = 0;\r\n        hdr[1] = 0;\r\n        hdr[2] = 0;\r\n        hdr[3] = 0;\r\n\r\n\t\tif (m_fp) {\r\n\t\t\tfread(hdr, 1, 4, m_fp); \r\n\t\t}\r\n\r\n        u32 res = m_decrypter.decryptSetup(ptr, hdr);\r\n        if (res == 0) {\r\n\t\t\tif (m_fp) {\r\n\t\t\t\tfseek(m_fp, 0, SEEK_SET);\r\n\t\t\t}\r\n        }\r\n        return res;\r\n    }\r\n    \r\n    // 指定されたパスで CiOSReadStream インスタンスを作り、そのポインタを返す。\r\n    static CiOSReadFileStream * openStream(const char * path, const char * home);\r\n    \r\n    // 指定されたパス名称を EXTERN -> INSTALL の順に検索し、先に見つかった方でCiOSReadStreamインスタンスを作る。\r\n    static CiOSReadFileStream * openAssets(const char * path, const char * home);\r\n    \r\n    s32     getSize();\r\n    s32     getPosition();\r\n    u8      readU8();\r\n    u16     readU16();\r\n    u32     readU32();\r\n    float   readFloat();\r\n    bool    readBlock(void * buffer, u32 byteSize);\r\n    ESTATUS getStatus();\r\n    \r\n    int     readU16arr(u16 * pBufferU16, int items);\r\n    int     readU32arr(u32 * PBufferU32, int items);\r\n    \r\n    IWriteStream * getWriteStream();\r\n\r\nprivate:\r\n    CDecryptBaseClass   m_decrypter;\r\n    \r\n    const char* m_fullpath; //!< オープン後は基本不要だが、ファイルの物理的フルパス文字列\r\n    ESTATUS     m_eStat;\r\n    FILE      * m_fp;\r\n    int         m_fd;\r\n    bool        m_bReadOnly;    // true のときは read only なので、CiOSWriteStreamを返さない。\r\n    CiOSWriteFileStream * m_writeStream;\r\n    \r\n#ifdef DEBUG_MEMORY\r\n    CiOSReadFileStream  *   m_pPrev;\r\n    CiOSReadFileStream  *   m_pNext;\r\n    \r\n    static CiOSReadFileStream * ms_pBegin;\r\n    static CiOSReadFileStream * ms_pEnd;\r\n#endif\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSSysResource.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSSysResource.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CiOSSysResource_h\r\n#define CiOSSysResource_h\r\n\r\nclass CiOSSysResource\r\n{\r\nprivate:\r\n    CiOSSysResource();\r\n    virtual ~CiOSSysResource();\r\npublic:\r\n    static CiOSSysResource& getInstance();\r\n\r\n    void requestDevID();\r\n    bool failedDevID();\r\n    bool setDevID(const void * devToken);\r\n    int getDevID(char * retBuf, int maxlen);\r\n\r\n    inline bool isReceived() { return m_devId_received; }\r\n    inline bool isSucceed() { return m_devId_succeed; }\r\n\r\nprivate:\r\n    unsigned char       m_devId[32];\r\n    int                 m_size_devId;\r\n    bool                m_devId_received;\r\n    bool                m_devId_succeed;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSTextView.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSTextView.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CiOSTextView_h\r\n#define CiOSTextView_h\r\n\r\n#import <UIKit/UIKit.h>\r\n\r\n@interface CiOSTextView : UITextView\r\n{\r\n    NSString    *   m_pFontName;        // フォント名\r\n    NSString    *   m_placeHolder;      // プレースホルダ文字列\r\n    UIColor     *   m_placeHolderColor; // プレースホルダカラー\r\n    NSTextAlignment textAlignment_; // label alignment\r\n}\r\n\r\n@property (nonatomic, retain) NSString  * m_pFontName;\r\n@property (nonatomic, retain) NSString  * m_placeHolder;\r\n@property (nonatomic, retain) UIColor   * m_placeHolderColor;\r\n@property (nonatomic) NSTextAlignment textAlignment;\r\n\r\n- (id)init;\r\n- (void)dealloc;\r\n- (void)awakeFromNib;\r\n- (id)initWithFrame:(CGRect)frame;\r\n- (void)setText:(NSString *)text;\r\n- (void)drawRect:(CGRect)rect;\r\n- (void)setFont:(UIFont*)font;\r\n\r\n// 文字の入力数を確認しプレースホルダの機能を仕様\r\n- (void)changedPlaceHolder:(NSNotification*)_notfication;\r\n\r\n// プレースホルダの文字列を設定\r\n- (void)setPlaceHolderString:(NSString *)_string;\r\n\r\n@end\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSTmpFile.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSTmpFile.h\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#ifndef CiOSTmpFile_h\r\n#define CiOSTmpFile_h\r\n\r\n#include <iostream>\r\n#include \"ITmpFile.h\"\r\n\r\nclass CiOSTmpFile : public ITmpFile\r\n{\r\npublic:\r\n    CiOSTmpFile(const char * tmpPath);\r\n    virtual ~CiOSTmpFile();\r\n\r\n    size_t writeTmp(void * ptr, size_t size);\r\n    inline bool isReady() { return (m_fd > 0) ? true : false; }\r\nprivate:\r\n    const char     *    m_fullpath;\r\n    int                 m_fd;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSWebView.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWebView.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CiOSWebView_h\r\n#define CiOSWebView_h\r\n\r\n#import <UIKit/UIKit.h>\r\n\r\n@interface CiOSWebView : UIWebView {\r\n\r\n@private\r\n    NSString * m_token;\r\n    NSString * m_region;\r\n    NSString * m_client;\r\n    NSString * m_cKey;\r\n    NSString * m_appID;\r\n    NSString * m_userID;\r\n    \r\n    NSString * m_os;\r\n    NSString * m_version;\r\n    NSString * m_timezone;\r\n}\r\n\r\n- (void)setCustomHeaders:(const char *)token :(const char *)region :(const char *)client :(const char *)consumerKey :(const char *)applicationId :(const char *)userId :(const char *)env;\r\n- (BOOL)hasCustomHeaders:(NSURLRequest *)request;\r\n\r\n@end\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSWebView.mm",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWebView.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#import \"CiOSWebView.h\"\r\n\r\nstatic int nonceSeed = 0;\r\n\r\n@implementation CiOSWebView\r\n\r\n\r\n- (void)setCustomHeaders:(const char *)token :(const char *)region :(const char *)client :(const char *)consumerKey :(const char *)applicationId :(const char *)userId :(const char *)env\r\n{\r\n    [m_token release];\r\n    [m_region release];\r\n    [m_client release];\r\n    [m_cKey release];\r\n    [m_appID release];\r\n    [m_userID release];\r\n    [m_os release];\r\n    [m_version release];\r\n    [m_timezone release];\r\n\r\n    if(token) m_token = [[NSString stringWithUTF8String:token] retain];\r\n    if(region) m_region = [[NSString stringWithUTF8String:region] retain];\r\n    if(client) m_client = [[NSString stringWithUTF8String:client] retain];\r\n    if(consumerKey) m_cKey = [[NSString stringWithUTF8String:consumerKey] retain];\r\n    if(applicationId) m_appID = [[NSString stringWithUTF8String:applicationId] retain];\r\n    if(userId) m_userID = [[NSString stringWithUTF8String:userId] retain];\r\n    \r\n    NSString * nsenv = [NSString stringWithUTF8String:env];\r\n    NSArray * arr = [nsenv componentsSeparatedByString:@\";\"];\r\n    m_os = [[arr objectAtIndex:0] retain];\r\n    m_version = [[arr objectAtIndex:1] retain];\r\n    m_timezone = [[arr objectAtIndex:2] retain];\r\n}\r\n\r\n- (BOOL)hasCustomHeaders:(NSURLRequest *)request\r\n{\r\n    NSDictionary *headers = [request allHTTPHeaderFields];\r\n\r\n    for(NSString *key in [headers allKeys]) {\r\n        if([[key lowercaseString] isEqualToString:@\"os\"]) {\r\n            return YES;\r\n        }\r\n    }\r\n\r\n    return NO;\r\n}\r\n\r\n- (void)loadRequest:(NSURLRequest *)request\r\n{\r\n    NSMutableURLRequest * mutableRequest = (NSMutableURLRequest *)[request mutableCopy];\r\n\r\n    if(m_client) [mutableRequest setValue:m_client forHTTPHeaderField:@\"Client-Version\"];\r\n    if(m_version) [mutableRequest setValue:m_version forHTTPHeaderField:@\"OS-Version\"];\r\n    if(m_os) [mutableRequest setValue:m_os forHTTPHeaderField:@\"OS\"];\r\n    if(m_timezone) [mutableRequest setValue:m_timezone forHTTPHeaderField:@\"Time-Zone\"];\r\n    if(m_region) [mutableRequest setValue:m_region forHTTPHeaderField:@\"Region\"];\r\n    [mutableRequest setValue:@\"straightforward\" forHTTPHeaderField:@\"API-Model\"];\r\n    if(m_appID) [mutableRequest setValue:m_appID forHTTPHeaderField:@\"Application-ID\"];\r\n    if(m_userID) [mutableRequest setValue:m_userID forHTTPHeaderField:@\"User-ID\"];\r\n\ttime_t now;\r\n\ttime(&now);\r\n\r\n    NSString * auth = [NSString stringWithFormat:@\"consumerKey=%@&token=%@&version=1.1&timeStamp=%ld&nonce=WV%d\", m_cKey, m_token, now, nonceSeed];\r\n    nonceSeed++;\r\n    [mutableRequest setValue:auth forHTTPHeaderField:@\"Authorize\"];\r\n    \r\n    [super loadRequest:mutableRequest];\r\n}\r\n\r\n- (void)dealloc\r\n{\r\n    [m_token release];\r\n    [m_region release];\r\n    [m_client release];\r\n    [m_cKey release];\r\n    [m_appID release];\r\n    [m_userID release];\r\n    [m_os release];\r\n    [m_version release];\r\n    [m_timezone release];\r\n    \r\n    [super dealloc];\r\n}\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSWidget.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWidget.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CiOSWidget_h\r\n#define CiOSWidget_h\r\n\r\n#import <MediaPlayer/MediaPlayer.h>\r\n#import <UIKit/UIKit.h>\r\n#include \"CiOSPlatform.h\"\r\n#import \"CiOSWebView.h\"\r\n#import \"CiOSMovieView.h\"\r\n#import \"CiOSTextView.h\"\r\n#include \"OSWidget.h\"\r\n\r\nclass CiOSFont;\r\nclass CiOSPlatform;\r\n\r\n// iOS用の基本形\r\nclass CiOSWidget : public IWidget\r\n{\r\nprotected:\r\n    CiOSWidget(CiOSPlatform * pParent);\r\n    virtual ~CiOSWidget();\r\n\r\npublic:\r\n    bool init(int id, int x, int y, int width, int height);\r\n\r\n\tvoid move(int x, int y);\r\n\tvoid resize(int width, int height);\r\n\tvirtual void visible(bool bVisible) = 0;\r\n\tvirtual void enable(bool bEnable) = 0;\r\n    \r\n    virtual void cmd(int cmd, ...);\r\n    virtual int status();\r\n\r\n    inline void size_recovery() {\r\n        set_move(m_x, m_y, m_width, m_height);\r\n    }\r\nprotected:\r\n    inline CiOSPlatform& getPlatform() const { return *m_pPlatform; }\r\n    inline float getScale() const { return m_scale; }\r\n\r\n    virtual void set_move(int x, int y, int width, int height) = 0;\r\nprotected:\r\n    float               m_scale;\r\n    int                 m_x;\r\n    int                 m_y;\r\n    int                 m_width;\r\n    int                 m_height;\r\n    \r\n    int                 m_id;\r\n    CiOSPlatform    *   m_pPlatform;\r\n};\r\n\r\n// iOSテキスト入力\r\nclass CiOSTextWidget : public CiOSWidget\r\n{\r\n    friend class CiOSPlatform;\r\nprivate:\r\n    CiOSTextWidget(CiOSPlatform * pParent, int maxlen = 0);\r\n    virtual ~CiOSTextWidget();\r\npublic:\r\n\r\n    bool create(CONTROL type, int id,\r\n                const char * caption, int x, int y, int width, int height);\r\n    \r\n \tint getTextLength();\r\n    int getTextMaxLength() { return m_maxlen; }\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\tvoid visible(bool bVisible);\r\n\tvoid enable(bool bEnable);\r\n\r\n    void cmd(int cmd, ...);\r\n\r\n    // 指定された UITextField を持つ CiOSTextWidget を検索する\r\n    static CiOSTextWidget * searchWidgetField(UITextField *pTextBox);\r\n    static CiOSTextWidget * searchWidgetView(UITextView * pTextView);\r\n    // 全ての CiOSTextWidget の visible を設定する\r\n    static void setAllVisible(bool visible);\r\n    inline void setTouch(bool bTouch) {\r\n        m_touched = bTouch;\r\n        set_color();\r\n    }\r\n    \r\n    inline int getMax() { return m_maxlen; }\r\n    inline int getCharType() { return m_chartype; }\r\n    const char * getFontName();\r\n    UIFont * getFont();\r\n    \r\nprivate:\r\n    bool createTextField(CONTROL _type, const char *_caption);\r\n    bool createTextView(CONTROL _type, const char *_caption);\r\n    \r\n    void set_move(int x, int y, int width, int height);\r\n    void set_color();\r\n   \r\n    CiOSFont                *   m_pFont;\r\n    NSString                *   m_nsFontname;\r\n    UITextField             *   m_pTextBox;\r\n    CiOSTextView            *   m_pTextView;\r\n\r\n    CiOSTextWidget          *   m_prev;\r\n    CiOSTextWidget          *   m_next;\r\n    \r\n    bool                        m_bVisible;\r\n    bool                        m_touched;\r\n    unsigned int                m_cols[4];\r\n    int                         m_maxlen;\r\n    int                         m_chartype;\r\n    int                         m_alignType;\r\n    \r\n    enum E_CONSOLE_TYPE\r\n    {\r\n        E_CONSOLE_TYPE_UITEXTVIEW = 0,\r\n        E_CONSOLE_TYPE_UITEXTFIELD = 1,\r\n    };\r\n    int                         m_consoleType;  // UITextFieldかUITextViewのタイプ(今は固定でUITextViewにしておく)\r\n\r\n    static CiOSTextWidget   *   ms_begin;\r\n    static CiOSTextWidget   *   ms_end;\r\n};\r\n\r\n// iOS WebView\r\nclass CiOSWebWidget : public CiOSWidget\r\n{\r\n    friend class CiOSPlatform;\r\nprivate:\r\n    CiOSWebWidget(CiOSPlatform * pParent);\r\n    virtual ~CiOSWebWidget();\r\npublic:\r\n    bool create(CONTROL type, int id,\r\n                const char * caption, int x, int y, int width, int height,\r\n                const char * token, const char * region, const char * client,\r\n                const char * consumerKey, const char * applicationId, const char * userID);\r\n\r\n \tint getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\tvoid visible(bool bVisible);\r\n\tvoid enable(bool bEnable);\r\n    \r\n    void cmd(int cmd, ...);\r\n    \r\n    inline bool getJump() const { return m_bJump || m_bFirst; }\r\n    inline void setFirst() { m_bFirst = false; }\r\n    \r\n    // 指定された UIWebView を持つ CiOSWebWidget を検索\r\n    static CiOSWebWidget * searchWidget(UIWebView * pWebView);\r\n\r\nprivate:\r\n    void set_move(int x, int y, int width, int height);\r\n    void set_bgcolor();\r\n    \r\n    bool              m_bJump;\r\n    bool              m_bFirst;\r\n    const char    *   m_pNowURL;\r\n    CiOSWebView   *   m_pWebView;\r\n    \r\n    char              m_bufURL[1024];\r\n    unsigned int      m_bgalpha;        // 背景色のアルファ値\r\n    unsigned int      m_bgcolor;        // 背景色\r\n\r\n    CiOSWebWidget           *   m_prev;\r\n    CiOSWebWidget           *   m_next;\r\n    \r\n    static CiOSWebWidget    *   ms_begin;\r\n    static CiOSWebWidget    *   ms_end;\r\n};\r\n\r\nclass CiOSMovieWidget : public CiOSWidget\r\n{\r\n    friend class CiOSPlatform;\r\nprivate:\r\n    CiOSMovieWidget(CiOSPlatform * pParent);\r\n    virtual ~CiOSMovieWidget();\r\npublic:\r\n    bool create(CONTROL type, int id,\r\n                const char * caption, int x, int y, int width, int height);\r\n    \r\n    int getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\tvoid visible(bool bVisible);\r\n\tvoid enable(bool bEnable);\r\n    \r\n    void cmd(int cmd, ...);\r\n    int status();\r\n    \r\n    inline void setStatus(int stat) { m_status = stat; }\r\n    \r\n    static CiOSMovieWidget * getWidget(void * p);\r\n\r\nprivate:\r\n    void set_move(int x, int y, int width, int height);\r\n   \r\n    CONTROL                     m_type;\r\n\r\n    const char              *   m_pNowPATH;\r\n    CiOSMovieView           *   m_pMovieView;\r\n    \r\n    int                         m_status;\r\n    CiOSMovieWidget         *   m_prev;\r\n    CiOSMovieWidget         *   m_next;\r\n    \r\n    static CiOSMovieWidget  *   ms_begin;\r\n    static CiOSMovieWidget  *   ms_end;\r\n};\r\n\r\nclass CiOSActivityIndicator : public CiOSWidget\r\n{\r\n    friend class CiOSPlatform;\r\nprivate:\r\n    CiOSActivityIndicator(CiOSPlatform * pParent);\r\n    virtual ~CiOSActivityIndicator();\r\npublic:\r\n    bool create(CONTROL type, int id,\r\n                const char * caption, int x, int y, int width, int height);\r\n    \r\n    int getTextLength();\r\n\tbool getText(char * pBuf, int maxlen);\r\n\tbool setText(const char * string);\r\n\tvoid visible(bool bVisible);\r\n\tvoid enable(bool bEnable);\r\n    \r\n    void cmd(int cmd, ...);\r\n    int status();\r\n\r\nprivate:\r\n    void set_move(int x, int y, int width, int height);\r\n    \r\n    UIActivityIndicatorView         *   m_pActView;\r\n    \r\n    bool                                m_bVisible;\r\n    int                                 m_status;\r\n    float                               m_size;\r\n\r\n    CiOSActivityIndicator           *   m_prev;\r\n    CiOSActivityIndicator           *   m_next;\r\n    \r\n    static CiOSActivityIndicator    *   ms_begin;\r\n    static CiOSActivityIndicator    *   ms_end;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/CiOSWriteFileStream.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CiOSWriteFileStream.h\r\n//\r\n//\r\n\r\n#ifndef CiOSWriteFileStream_h\r\n#define CiOSWriteFileStream_h\r\n\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CiOSReadFileStream;\r\n\r\nclass CiOSWriteFileStream : public IWriteStream\r\n{\r\n    friend class CiOSReadFileStream;\r\nprivate:\r\n    CiOSWriteFileStream(CiOSReadFileStream& rdStream);\r\n    virtual ~CiOSWriteFileStream();\r\n    \r\npublic:\r\n    ESTATUS\tgetStatus();\r\n\ts32\tgetPosition();\r\n\tvoid writeU8(u8 value);\t// Use cast to support s8\r\n\tvoid writeU16(u16 value);\t// Use cast to support s16\r\n\tvoid writeU32(u32 value);\t// Use cast to support s32\r\n\tvoid writeFloat(float);\r\n\tvoid writeBlock(void* buffer, u32 byteSize);\r\n    \r\nprivate:\r\n    int         m_fd;\r\n    FILE    *   m_fp;\r\n    \r\n    ESTATUS     m_eStat;\r\n};\r\n\r\n#endif // CiOSWriteFileStream_h\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/EAGLView.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  EAGLView.h\r\n//\r\n//  Base Created by Dan Ginsburg on 6/13/09.\r\n//\r\n\r\n// #define OPENGL2\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <GLKit/GLKit.h>\r\n#import <StoreKit/StoreKit.h>\r\n#import <OpenGLES/EAGL.h>\r\n#import <AVFoundation/AVFoundation.h>\r\n\r\n#if defined(__APPLE__)\r\n#ifdef OPENGL2\r\n#import <OpenGLES/ES2/gl.h>\r\n#import <OpenGLES/ES2/glext.h>\r\n#else\r\n#import <OpenGLES/ES1/gl.h>\r\n#import <OpenGLES/ES1/glext.h>\r\n#endif\r\n#else\r\n#ifdef OPENGL2\r\n#include \"GLES2/gl2.h\"\r\n#else\r\n#include \"GLES/gl.h\"\r\n#endif\r\n#endif\r\n#import \"CKLBTouchEventUI.h\"\r\n#define FPS_AVERAGE ( 5 )   // FPS計測用\r\n#define USE_DEPTH_BUFFER ( 1 ) // whether enable depth buffer or not\r\n#define IS_OPAQUE_VIEW ( NO ) // whether base view is opaque or not (ObjC bool style; i.e. YES / NO)\r\n\r\n/*\r\nThis class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.\r\nThe view content is basically an EAGL surface you render your OpenGL scene into.\r\nNote that setting the view non-opaque will only work if the EAGL surface has an alpha channel.\r\n*/\r\n@interface EAGLView : UIView<UITextFieldDelegate, UITextViewDelegate, UIWebViewDelegate> {\r\n    \r\n@private\r\n    /* The pixel dimensions of the backbuffer */\r\n    GLint backingWidth;\r\n    GLint backingHeight;\r\n    \r\n    EAGLContext *context;\r\n    \r\n    /* OpenGL names for the renderbuffer and framebuffers used to render to this view */\r\n    GLuint viewRenderbuffer, viewFramebuffer;\r\n    \r\n    /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */\r\n    GLuint depthRenderbuffer;\r\n    GLuint program;\r\n\r\n    NSTimer *animationTimer;\r\n    NSTimeInterval animationInterval;\r\n    CFTimeInterval timePrev;\r\n    CFTimeInterval timeInt;\r\n    int frame;\r\n\tint touch_alloc_cursor;\r\n\r\n#if ( DEBUG == 1 )\r\n    CFTimeInterval fpsArray[ FPS_AVERAGE ]; // FPS計測時に平均を出すための保存配列\r\n    int fpsCnt;                             // FPS値を保存する配列のインデックス\r\n#endif\r\n    \r\n    // マルチタッチのUITouch割当を\r\n    UITouch * pTouch[ CKLBTouchEventUIMgr::MAX_TOUCH_POINT ];  // 押されたポイントごとにインスタンスが作られる\r\n\r\n\t// CGame game;\r\n    Boolean isInitiated;\r\n    \r\n    // キーボードのサイズ\r\n    CGRect keyboardFrameEnd;\r\n    UITextField * targetTextField;\r\n    UITextView  * targetTextView;\r\n    \r\n    Boolean bContinue;\r\n    UIViewController<UIAlertViewDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver>   *   viewCtrl;\r\n}\r\n\r\n@property NSTimeInterval animationInterval;\r\n\r\n- (void)startAnimation;\r\n- (void)stopAnimation;\r\n- (void)drawView;\r\n- (void)setTimePrev:(CFTimeInterval)value;\r\n- (void)setViewController:(UIViewController<SKProductsRequestDelegate> *)viewController;\r\n- (void)textTouchDown:(id)sender;\r\n- (void)textTouchUp:(id)sender;\r\n\r\n- (void)clearUITouches;\r\n- (void)releaseTouch:(unsigned int)id :(const char*)caller;\r\n\r\n+ (float)getScaleFactor;\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/GLcommon.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  GLcommon.h\r\n//\r\n//\r\n\r\n#ifndef GLcommon_h\r\n#define GLcommon_h\r\n\r\n#include <OpenGLES/ES2/gl.h>\r\n#include <OpenGLES/ES2/glext.h>\r\n\r\n//#include \"ApplicationFramework.h\"\r\n//#include \"RenderingFramework.h\"\r\n\r\n\r\n#endif // GLcommon_h\r\n\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/KLBPlatformMetrics.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLBPlatformMetrics_h\r\n#define KLBPlatformMetrics_h\r\n\r\n#include \"KLBPlatformMetricsCommon.h\"\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/NSData+Base64.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  NSData+Base64.h\r\n//  base64\r\n//\r\n//  Created by Matt Gallagher on 2009/06/03.\r\n//  Copyright 2009 Matt Gallagher. All rights reserved.\r\n//\r\n//  This software is provided 'as-is', without any express or implied\r\n//  warranty. In no event will the authors be held liable for any damages\r\n//  arising from the use of this software. Permission is granted to anyone to\r\n//  use this software for any purpose, including commercial applications, and to\r\n//  alter it and redistribute it freely, subject to the following restrictions:\r\n//\r\n//  1. The origin of this software must not be misrepresented; you must not\r\n//     claim that you wrote the original software. If you use this software\r\n//     in a product, an acknowledgment in the product documentation would be\r\n//     appreciated but is not required.\r\n//  2. Altered source versions must be plainly marked as such, and must not be\r\n//     misrepresented as being the original software.\r\n//  3. This notice may not be removed or altered from any source\r\n//     distribution.\r\n//\r\n\r\n#import <Foundation/Foundation.h>\r\n\r\nvoid *NewBase64Decode(\r\n\tconst char *inputBuffer,\r\n\tsize_t length,\r\n\tsize_t *outputLength);\r\n\r\nchar *NewBase64Encode(\r\n\tconst void *inputBuffer,\r\n\tsize_t length,\r\n\tbool separateLines,\r\n\tsize_t *outputLength);\r\n\r\n@interface NSData (Base64)\r\n\r\n+ (NSData *)dataFromBase64String:(NSString *)aString;\r\n- (NSString *)base64EncodedString;\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/ViewController.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  ViewController.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#import <UIKit/UIKit.h>\r\n#import <StoreKit/StoreKit.h>\r\n#import \"EAGLView.h\"\r\n#import \"CiOSMovieView.h\"\r\n\r\n@interface ViewController : UIViewController<UIAlertViewDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver> {\r\n    IBOutlet UIView * viewBG;\r\n    IBOutlet CiOSMovieView * viewBase;\r\n    IBOutlet EAGLView * viewGL;\r\n}\r\n\r\n\r\n\r\n- (void)viewRecovery;\r\n- (void)stopAnimation;\r\n- (void)startAnimation;\r\n- (void)finishStoreTransaction:(NSString *)receipt;\r\n- (void)clearUITouches;\r\n\r\n\r\n\r\n@end\r\n"
  },
  {
    "path": "Engine/porting/iOS/include/iOSFileLocation.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  iOSFileLocation.h\r\n//\r\n//\r\n\r\n#ifndef iOSFileLocation_h\r\n#define iOSFileLocation_h\r\n\r\n#define PATH_EXTERN     \"/Library/Application Support/\"\r\n#define PATH_INSTALL    \"/\"\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/AppDelegate.h",
    "content": "@class ViewController;\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\n\n@property (strong, nonatomic) UIWindow *window;\n\n@property (strong, nonatomic) ViewController *viewController;\n\n@end\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/ArrayAllocator.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __ARRAY_ALLOCATOR_KLB_H_\r\n#define __ARRAY_ALLOCATOR_KLB_H_\r\n\r\n#include \"BaseType.h\"\r\n\r\ntemplate <class T>\r\nclass ArrayAllocator {\r\nprotected:\r\n\tstruct ArrayItem {\r\n\tpublic:\r\n\t\tArrayItem () {}\r\n\t\t~ArrayItem() {}\r\n\r\n\t\tT \tentry;\r\n\t\tu16\tnext;\r\n\t\tu16 prev;\r\n\t};\r\nprivate:\r\n\tstruct AllocatorContext {\r\n\t\tAllocatorContext*\tm_next;\r\n\t\tArrayItem*\t\t\tm_array;\r\n\t\tu32\t\t\t\t\tm_allocated;\r\n\t\tu32\t\t\t\t\tm_arrayCount;\r\n\t\tu32\t\t\t\t\tm_freeList;\r\n\t\tu32\t\t\t\t\tm_usedList;\r\n\r\n\t\tT* allocEntry() {\r\n\t\t\tif (m_freeList == NULL_IDX) {\r\n\t\t\t\tklb_assertAlways(\"Allocator Full\");\r\n\t\t\t\treturn NULL;\r\n\t\t\t} else {\r\n\t\t\t\tm_allocated++;\r\n\r\n\t\t\t\tu16 newItem = m_freeList;\r\n\t\t\r\n\t\t\t\t// Remove from free list.\r\n\t\t\t\tm_freeList\t= m_array[newItem].next;\r\n\t\t\t\tif (m_freeList != NULL_IDX) {\tm_array[m_freeList].prev = NULL_IDX;\t}\r\n\t\t\r\n\t\t\t\t// Add to used list.\r\n\t\t\t\tm_array[newItem].next = m_usedList;\r\n\t\t\t\tm_array[newItem].prev = NULL_IDX;\r\n\t\t\t\tif (m_usedList != NULL_IDX) {\tm_array[m_usedList].prev = newItem;\t\t}\r\n\t\t\t\tm_usedList = newItem;\r\n\t\t\t\treturn &m_array[newItem].entry;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvoid freeEntry(T* entry) {\r\n\t\t\tif (!entry)\t{ return ;}\t// Safe delete\r\n\t\t\tArrayItem* pItem = (ArrayItem*)entry;\r\n\t\r\n\t\t\tm_allocated--;\r\n\r\n\t\t\t//\r\n\t\t\t// Remove from active list\r\n\t\t\t//\r\n\t\t\tif (pItem->prev != NULL_IDX) {\r\n\t\t\t\tm_array[pItem->prev].next = pItem->next;\r\n\t\t\t} else {\r\n\t\t\t\tm_usedList = pItem->next;\r\n\t\t\t}\r\n\t\r\n\t\t\tif (pItem->next != NULL_IDX) {\r\n\t\t\t\tm_array[pItem->next].prev = pItem->prev;\r\n\t\t\t}\r\n\t\r\n\t\t\t//\r\n\t\t\t// Add to free list\r\n\t\t\t//\r\n\t\t\tu16 idx = pItem - m_array;\r\n\t\t\tif (m_freeList != NULL_IDX) {\r\n\t\t\t\tm_array[m_freeList].prev = idx;\r\n\t\t\t}\r\n\t\r\n\t\t\tpItem->next = m_freeList;\r\n\t\t\tpItem->prev = NULL_IDX;\r\n\r\n\t\t\t// Position.\r\n\t\t\tm_freeList = idx;\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tAllocatorContext m_defaultSlot;\r\n\tu16\t\t\t\t m_extendSize;\r\npublic:\r\n\tArrayAllocator()\r\n\t{\r\n\t\tm_defaultSlot.m_next\t\t= NULL;\r\n\t\tm_defaultSlot.m_array\t\t= NULL;\r\n\t\tm_defaultSlot.m_freeList\t= NULL_IDX;\r\n\t\tm_defaultSlot.m_usedList\t= NULL_IDX;\r\n\t\tm_defaultSlot.m_arrayCount\t= 0;\r\n\t}\r\n\r\n\t~ArrayAllocator()\r\n\t{\r\n\t\trelease();\r\n\t}\r\n\t\r\n\tbool addSlot(u32 entryCount, AllocatorContext* pSlot) {\r\n\t\tpSlot->m_array = (ArrayItem*)KLBNEWA(u8, entryCount*sizeof(ArrayItem));\r\n\t\tif (pSlot->m_array) {\r\n\t\t\tpSlot->m_arrayCount  = entryCount;\r\n\t\t\tpSlot->m_allocated\t = 0;\r\n\r\n\t\t\tfor (u32 n=0; n < entryCount; n++) {\r\n\t\t\t\tpSlot->m_array[n].next = n+1;\r\n\t\t\t\tpSlot->m_array[n].prev = n-1;\r\n\t\t\t}\r\n\t\t\r\n\t\t\tpSlot->m_array[0].prev\t\t\t\t= NULL_IDX;\r\n\t\t\tpSlot->m_array[entryCount-1].next\t= NULL_IDX;\r\n\t\t\tpSlot->m_freeList\t\t\t\t\t= 0;\r\n\t\t\tpSlot->m_usedList\t\t\t\t\t= NULL_IDX;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tbool init(u16 entryCount) {\r\n\t\tm_extendSize = entryCount / 3;\r\n\t\treturn addSlot(entryCount, &m_defaultSlot);\r\n\t}\r\n\r\n\tvoid release() {\r\n\t\tAllocatorContext* pContext = &m_defaultSlot;\r\n\t\twhile (pContext) {\r\n\t\t\tKLBDELETEA((u8*)pContext->m_array);\r\n\t\t\tpContext->m_array = NULL;\r\n\t\t\tpContext = pContext->m_next;\r\n\t\t}\r\n\r\n\t\t// Destroy sub slot struct.\r\n\t\tpContext = m_defaultSlot.m_next;\r\n\t\twhile (pContext) {\r\n\t\t\tAllocatorContext* pNext = pContext->m_next;\r\n\t\t\tKLBDELETE(pContext);\r\n\t\t\tpContext = pNext;\r\n\t\t}\r\n\t}\r\n\t\r\n\tT* allocEntry() {\r\n\t\t// 1. Find first slot with free item\r\n\t\tAllocatorContext* pContext\t\t= &m_defaultSlot;\r\n\t\tAllocatorContext* pPrevContext\t= NULL;\r\n\t\twhile (pContext) {\r\n\t\t\tif (pContext->m_freeList != NULL_IDX) {\r\n\t\t\t\treturn pContext->allocEntry();\r\n\t\t\t}\r\n\t\t\tpPrevContext = pContext;\r\n\t\t\tpContext = pContext->m_next;\r\n\t\t}\r\n\t\t\r\n\t\t// 2. If none found, create new lost and allocated item.\r\n\t\tpPrevContext->m_next = KLBNEW(AllocatorContext);\r\n\t\tif (pPrevContext->m_next) {\r\n\t\t\tpContext = pPrevContext->m_next;\r\n\t\t\tif (addSlot(m_extendSize, pContext)) {\r\n\t\t\t\treturn pContext->allocEntry();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\tvoid freeEntry(T* entry) {\r\n\t\t// 1.Find from which slot it has been allocated.\r\n\t\tAllocatorContext* pContext\t\t= &m_defaultSlot;\r\n\t\tAllocatorContext* pPrevContext\t= NULL;\r\n\t\twhile (pContext) {\r\n\t\t\tArrayItem*\tstart = pContext->m_array;\r\n\t\t\tArrayItem*  end   = &start[pContext->m_arrayCount];\r\n\t\t\tif (((void*)entry >= (void*)start) && ((void*)entry < (void*)end)) {\r\n\t\t\t\t// Found slot\r\n\t\t\t\tpContext->freeEntry(entry);\r\n\t\t\t\t// 2.If counter reach zero AND is NOT default slot, remove from list and destroy slot.\r\n\t\t\t\tif ((pContext->m_allocated == 0) && (pContext != &m_defaultSlot)) {\r\n\t\t\t\t\t// Remove from slot list\r\n\t\t\t\t\tpPrevContext->m_next = pContext->m_next;\r\n\t\t\t\t\t// Remove array\r\n\t\t\t\t\tKLBDELETEA((u8*)pContext->m_array);\r\n\t\t\t\t\t// Remove slot\r\n\t\t\t\t\tKLBDELETE(pContext);\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tpPrevContext\t= pContext;\r\n\t\t\tpContext\t\t= pContext->m_next;\r\n\t\t}\r\n\r\n\t}\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/AudioAsset.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __KLB_AUDIO_ASSET__\r\n#define __KLB_AUDIO_ASSET__\r\n\r\n#include \"CKLBAsset.h\"\r\n\r\n/*!\r\n* \\class CKLBAudioAsset\r\n* \\brief Audio Asset Class\r\n* \r\n* Wrapper for audio object given by porting layer.\r\n*/\r\nclass CKLBAudioAsset : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual u32\t\t\tgetClassID\t()\t\t{ return CLS_ASSETAUDIO; }\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_AUDIO;    }\r\n\r\n\tCKLBAudioAsset();\r\n\t~CKLBAudioAsset();\r\n\r\n\tbool init\t(const char* url);\r\n\tbool preLoad();\r\n\tvoid play\t(float volume = 1.0f);\r\n\tvoid stop\t();\r\n\tvoid release();\r\nprivate:\r\n\tchar*\tm_resName;\r\n\tvoid*\tm_handle;\r\n};\r\n\r\n/*!\r\n* \\class KLBAudioAssetPlugin\r\n* \\brief Audio Asset Plugin Class\r\n* \r\n* KLBAudioAssetPlugin is in charge of loading CKLBAudioAsset.\r\n*/\r\nclass KLBAudioAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBAudioAssetPlugin();\r\n\t~KLBAudioAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID\t\t()\t\t\t\t{ return CHUNK_TAG('A','U','D','I'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader\t\t()\t\t\t\t{ return 'A';\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension\t()\t\t\t\t{ return \".audio\"; }\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset\t\t(u8* stream, u32 streamSize);\r\n\tvirtual CKLBAbstractAsset*\tloadByFileName\t(const char* fileName);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/BaseType.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Common type, inside porting layer ===\r\n//\r\n\r\n#ifndef __KLB_BASE_TYPE__\r\n#define __KLB_BASE_TYPE__\r\n\r\n#ifdef _WIN32\r\n#pragma warning(disable:4996)\r\n#endif\r\n\r\n//\r\n// Base type definition.\r\n//\r\ntypedef unsigned int\tu32;\r\ntypedef int\t\t\t\ts32;\r\ntypedef unsigned short\tu16;\r\ntypedef short\t\t\ts16;\r\ntypedef unsigned char\tu8;\r\ntypedef char\t\t\ts8;\r\ntypedef u16\t\t\t\tunichar;\r\ntypedef long long int\ts64;\r\ntypedef long long unsigned int u64;\r\n\r\n#ifndef NULL\r\n\t#define\tNULL\t\t\t(0)\r\n#endif\r\n\r\n#define NULL_IDX\t\t\t(0xFFFF)\r\n\r\n// TODO RP : Move the lower definition to an internal .h file.\r\n//\r\n// Class ID.\r\n//\r\n\r\n// Special Array wrapper class\r\n#define CLS_KLBARRAY\t\t\t(0x80000000)\r\n// Native array\r\n#define CLS_ARRAYOF\t\t\t\t(0x40000000)\r\n#define CLS_PUBLIC\t\t\t\t(0x20000000)\r\n#define CLS_PRIVATEPROTECTED\t(0x10000000)\r\n#define CLS_READONLY\t\t\t(0x08000000)\r\n\r\n//\r\n// Group bit.\r\n//\r\n#define CLS_BASETYPE\t\t\t(0x00000000)\r\n#define CLS_KLBENGINECLASS\t\t(0x00010000)\r\n#define CLS_KLBASSETCLASS\t\t(0x00020000)\r\n#define CLS_KLBUICORECLASS\t\t(0x00040000)\r\n#define CLS_KLBUSERTASK\t\t\t(0x00080000)\r\n#define CLS_USERCUSTOM\t\t\t(0x00100000)\r\n#define CLS_USERCUSTOMTASK\t\t(CLS_USERCUSTOM | CLS_KLBUSERTASK)\r\n#define CLS_NONVISUALTASK\t\t(0x00200000)\r\n\r\n// 4,8\r\n#define CLS_UNIQUEID\t\t\t(0x000FFFFF)\r\n\r\n//\r\n// Base Type\r\n//\r\n#define CLS_U32\t\t\t\t(1 | CLS_BASETYPE)\r\n#define CLS_S32\t\t\t\t(2 | CLS_BASETYPE)\r\n#define CLS_U16\t\t\t\t(3 | CLS_BASETYPE)\r\n#define CLS_S16\t\t\t\t(4 | CLS_BASETYPE)\r\n#define CLS_U8\t\t\t\t(5 | CLS_BASETYPE)\r\n#define CLS_S8\t\t\t\t(6 | CLS_BASETYPE)\r\n#define CLS_BOOL\t\t\t(9 | CLS_BASETYPE)\r\n#define CLS_FLOAT\t\t\t(7 | CLS_BASETYPE)\r\n#define CLS_PTR\t\t\t\t(8 | CLS_BASETYPE)\r\n#define CLS_CSTRING\t\t\t(10| CLS_BASETYPE)\r\n#define CLS_COLOR\t\t\t(11| CLS_BASETYPE)\r\n\r\n//\r\n// Engine\r\n//\r\n#define CLS_KLBOBJECT\t\t(1 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBNODE\t\t\t(2 | CLS_KLBENGINECLASS)\r\n// Node based\r\n\r\n#define CLS_KLBUIELEMENT\t(3 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n#define CLS_KLBUISELECTABLE\t(4 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n#define CLS_KLBUICONTAINER\t(5 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n\r\n#define CLS_GAMEUNIT\t\t(6 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBSWFMOVIE\t\t(7 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBSPLINENODE\t(8 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBNODEMAP\t\t(9 | CLS_KLBENGINECLASS)\r\n#define CLS_KLBSCORENODE\t(10| CLS_KLBENGINECLASS)\r\n\r\n#define CLS_KLBTASKTOUCHPAD\t(12| CLS_KLBENGINECLASS | CLS_NONVISUALTASK)\r\n#define CLS_KLBTASKSCRIPT\t(13| CLS_KLBENGINECLASS | CLS_NONVISUALTASK)\r\n#define CLS_KLBTASKDRAW\t\t(14| CLS_KLBENGINECLASS | CLS_NONVISUALTASK)\r\n#define CLS_KLBTASKGENERIC\t(15| CLS_KLBUSERTASK    | CLS_NONVISUALTASK)\r\n#define CLS_KLBLUAPROPTASK  (16| CLS_KLBENGINECLASS)\r\n#define CLS_KLBTASKUIEVENT\t(17| CLS_KLBENGINECLASS)\r\n#define CLS_KLBTASKOSCTRLEVENT (18|CLS_KLBENGINECLASS)\r\n\r\n// UITasks based\r\n#define CLS_KLBUIPROGRESS\t(20| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISCORE\t\t(21| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIVIRTUALDOC\t(22| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBCELLANIMNODE\t(23| CLS_KLBENGINECLASS)\r\n\r\n// UITasks based\r\n#define CLS_KLBUICELLANIM   (24| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISWFPLAYER  (25| CLS_KLBUSERTASK)\r\n#define CLS_KLBUITOUCHPAD   (26| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIMAPTASK\t(27| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIFORM\t\t(28| CLS_KLBUSERTASK)\r\n\r\n// Node based\r\n#define CLS_KLBTEXTEDIT\t\t(29| CLS_KLBENGINECLASS)\r\n#define CLS_KLBWEBVIEW\t\t(30| CLS_KLBENGINECLASS)\r\n#define CLS_GAMEUNITBASE\t(31| CLS_KLBENGINECLASS)\r\n#define CLS_KLBLABEL\t\t(32| CLS_KLBENGINECLASS)\r\n\r\n// UITasks based\r\n#define CLB_KLBUISCROLLBAR\t(33| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBMOVIENODE\t\t(34| CLS_KLBENGINECLASS)\r\n#define CLS_KLBINTERVALTIMER\t(35| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBUICANVAS\t\t\t(36| CLS_KLBUSERTASK)\r\n#define CLS_KLBUICONTROL\t\t(37| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIDBGLABEL\t\t(38| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIDRAGICON\t\t(39| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIFREEVERTITEM\t(40| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIGROUP\t\t\t(41| CLS_KLBUSERTASK)\r\n#define CLS_KLBUILABEL\t\t\t(42| CLS_KLBUSERTASK)\r\n#define CLS_KLBUILIST\t\t\t(43| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIMOVIEPLAYER\t(44| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIMULTIIMGITEM\t(45| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIPIECHART\t\t(46| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIPOLYLINE\t\t(47| CLS_KLBUSERTASK)\r\n#define CLS_KLBUIRUBBERBAND\t\t(48| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISCALE9\t\t\t(49| CLS_KLBUSERTASK)\r\n#define CLS_KLBUISIMPLEITEM\t\t(50| CLS_KLBUSERTASK)\r\n#define CLS_KLBUITEXTINPUT\t\t(51| CLS_KLBUSERTASK)\r\n\r\n// export objects\r\n#define CLS_KLBBINARRAY     (52| CLS_KLBENGINECLASS)\r\n#define CLS_KLBLUADB        (53| CLS_KLBENGINECLASS)\r\n#define CLS_KLBDATASET      (54| CLS_KLBENGINECLASS)\r\n#define CLS_KLBNODEVIRTUALDOC\t(55 | CLS_KLBENGINECLASS | CLS_KLBUICORECLASS)\r\n#define CLS_KLBFONTOBJ\t\t(56| CLS_KLBENGINECLASS)\r\n#define CLS_KLBSOUNDOBJ\t\t(57| CLS_KLBENGINECLASS)\r\n#define CLS_KLBMATRIXOBJ\t(58| CLS_KLBENGINECLASS)\r\n#define CLS_KLBVECTOROBJ\t(59| CLS_KLBENGINECLASS)\r\n\r\n#define CLS_KLBUNITTASK\t\t(60| CLS_KLBUSERTASK)\r\n#define CLS_KLBMAPGROUP\t\t(61| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBSTORESERVICE\t(62| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBNETAPI\t\t(63| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBPAUSECTRL\t(64| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBLIFECTRL\t\t(65| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBAIDRIVERTASK\t(67| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBWORDLTASK\t(68| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBUIWEBVIEW\t(69| CLS_KLBUSERTASK)\r\n\r\n#define CLS_KLBAPPPROP\t\t(70| CLS_KLBENGINECLASS)\r\n\r\n#define CLS_KLBACTIVITYINDICATORNODE    (71| CLS_KLBENGINECLASS)    // CKLBActivityIndicatorNode\r\n#define CLS_KLBUIACTIVITYINDICATOR      (72| CLS_KLBUSERTASK)    // CKLBUIActivityIndicator\r\n\r\n#define CLS_KLBUIVARIABLEITEM\t\t\t(73| CLS_KLBUSERTASK)\r\n#define CLS_KLBUICLIP\t\t\t\t\t(74| CLS_KLBUSERTASK)\r\n#define CLS_KLBAPPUPDATE\t\t\t\t(75| CLS_KLBENGINECLASS)\r\n#define CLS_KLBASYNCLOADER\t\t\t\t(76| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBGCTASK\t\t\t\t\t(77| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBAPPUPDATEZIP\t\t\t\t(78| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n#define CLS_KLBASYNCFILECOPY\t\t\t(79| CLS_KLBUSERTASK | CLS_NONVISUALTASK)\r\n\r\n#define CLS_KLBUIBUTTON\t\t(80| CLS_KLBUSERTASK)\r\n#define CLS_KLBPACKERCTRL\t(81| CLS_KLBENGINECLASS)\r\n\r\n//\r\n// Engine Assets\r\n//\r\n#define CLS_ASSETBASE\t\t(0 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETTEXTURE\t(1 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETIMAGE\t\t(2 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETAUDIO\t\t(3 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETFLASH\t\t(4 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETANIMSPLINE\t(5 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETMAP\t\t(6 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETCELLANIM\t(7 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETCOMPOSITE\t(8 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETNODEANIM\t(9 | CLS_KLBASSETCLASS)\r\n#define CLS_ASSETAI\t\t\t(10| CLS_KLBASSETCLASS)\r\n\r\n\r\n#ifdef DEBUG_MEMORY\r\n\r\n\t// #define INTERNAL_MEMORY_STARVING\r\n\r\n\t#include \"DebugAlloc.h\"\r\n\t#include \"DebugTracker.h\"\r\n\t\r\n\t#define KLBNEW(a)\t\t\t\t(a*)CTracker::logNew(new a(),sizeof(a),__LINE__,__FILE__)\r\n\t#define KLBNEWA(a,b)\t\t\t(a*)CTracker::logNew(new a[(b)],sizeof(a)*(b),__LINE__,__FILE__)\r\n\t#define KLBNEWC(a,b)\t\t\t(a*)CTracker::logNew(new a b,sizeof(a), __LINE__,__FILE__)\r\n\t#define KLBMALLOC(a)\t\t\tCTracker::logNew(malloc(a),(a),__LINE__,__FILE__)\r\n\r\n\t#define KLBDELETE(a)\t\t\tdo { if( (a)!=NULL ){ CTracker::logDelete((void *)(a),__LINE__,__FILE__); delete a; } } while (0)\r\n\t#define KLBDELETEA(a)\t\t\tdo { if( (a)!=NULL ){ CTracker::logDelete((void *)(a),__LINE__, __FILE__); delete [] a; } } while (0)\r\n\t#define KLBFREE(a)\t\t\t\tdo { if( (a)!=NULL ){ CTracker::logDelete((void *)(a),__LINE__,__FILE__); free(a); a=NULL; } } while (0)\r\n#else\r\n    #define KLBNEW(a)\t\t\t\tnew a()\r\n    #define KLBNEWA(a,b)\t\t\tnew a[(b)]\r\n    #define KLBNEWC(a,b)\t\t\tnew a b\r\n    #define KLBMALLOC(a)\t\t\tmalloc(a)\r\n\r\n    #define KLBDELETE(a)\t\t\tdo { if( (a)!=NULL ){ delete a; } } while (0)\r\n    #define KLBDELETEA(a)           do { if( (a)!=NULL ){ delete [] a; } } while (0)\r\n    #define KLBFREE(a)\t\t\t\tdo { if( (a)!=NULL ){ free(a); a=NULL; } } while (0)\r\n#endif\r\n\r\n#include \"assert_klb.h\"\r\n\r\n// #define _CRTDBG_MAP_ALLOC\r\n// #include <stdlib.h>\r\n// #include <crtdbg.h>\r\n\r\n#include <stdio.h>\r\n\r\n// Heap checking (via crtdbg) is windows-only, so use it cautiously\r\n#ifdef _WIN32\r\n  #include <crtdbg.h>\r\n  #define\t\tCHECKMEM()\t\t\tklb_assert(_CrtCheckMemory(),\"Heap Corrupted\")\r\n#else\r\n  #define\t\tCHECKMEM()\t\t\t;\r\n#endif\r\n#define TASKCLID(a)\t\t\t\t\t{ CKLBTask* pTsk = CKLBTaskMgr::getInstance().getCurrentTask(); u32 clID = pTsk ? pTsk->getClassID() : 0; klb_assert(clID != (a),\"Task Found\"); }\r\n#define ISCLID(a)\t\t\t\t\t(CKLBTaskMgr::getInstance().getCurrentTask() ? ((CKLBTaskMgr::getInstance().getCurrentTask()->getClassID()) == a) : (0 == a)))\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tvoid checkVirtualDocState();\r\n\tvoid dumpVirtualDocState(void* lookupObj);\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBAction.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Structure used for transmitting events inside the game ===\r\n//\r\n//\r\n\r\n#ifndef __KLB_ACTION__\r\n#define __KLB_ACTION__\r\n\r\n#include \"CKLBObject.h\"\r\n\r\nenum ACTION_TYPE {\r\n\tACTION_UNDEF\t\t\t= 0,\r\n\tACTION_PUSH\t\t\t\t= 1,\r\n\tACTION_RELEASE\t\t\t= 2,\t// Param 0 : Ok, 1 : Cancel\r\n\tACTION_CLICK\t\t\t= 3,\r\n\tACTION_CHANGE\t\t\t= 4,\t// 1 : Select, 0 : Unselect\r\n\tACTION_CLOSE\t\t\t= 5,\r\n\tACTION_ENDANIM\t\t\t= 6,\r\n\tACTION_FOCUS\t\t\t= 7,\r\n\tACTION_STATECHANGE\t\t= 8,\r\n\tACTION_CUSTOM\t\t\t= 0x10\r\n};\r\n\r\n/**\r\n\tAction is an event class used by the application\r\n\tfor transmitting events / asynchronously perform function call.\r\n */\r\nclass CKLBAction {\r\npublic:\r\n\t/**\r\n\t\t- Key Event\r\n\t\t- Touch Event\r\n\t\t- UI event forwarding\t(close, focus, etc...)\r\n\t\t- Custom Game event forwarding\t(attack, move, etc...)\r\n\t */\r\n\tu32\t\t\t\tm_actionType;\r\n\tu32\t\t\t\tm_timeOffset;\r\n\ts32\t\t\t\tm_parameter;\r\n\tCKLBObject*\t\tm_pSource;\r\n\tCKLBObject*\t\tm_pTarget;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBActivityIndicatorNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBActivityIndicatorNode.h\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#ifndef CKLBActivityIndicatorNode_h\r\n#define CKLBActivityIndicatorNode_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBActivityIndicatorNode\r\n* \\brief Activity Indicator Specializec Node Class\r\n* \r\n* \r\n*/\r\nclass CKLBActivityIndicatorNode : public CKLBUIElement\r\n{\r\npublic:\r\n\tCKLBActivityIndicatorNode (int show_type);\r\n\t~CKLBActivityIndicatorNode();\r\n    \r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBACTIVITYINDICATORNODE; }\r\n    \r\n\t// KLBNode::\r\n\tvirtual\r\n\tvoid\trecomputeCustom\t\t();\r\n    \r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n    \r\n\tvirtual bool isSelectable   ()          { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n    \r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n    \r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t        { return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t        { return m_height;\t}\r\n    \r\n    inline IWidget * getWidget  () const    { return nativeInputItem; }\r\n    \r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n    \r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual\r\n\tvoid\taddRender\t\t\t();\r\n\tvirtual\r\n\tvoid\tremoveRender\t\t();\r\n    \r\n\tIWidget * nativeInputItem;\r\n\tu32\t\tm_width;\r\n\tu32\t\tm_height;\r\n\ts32\t\tm_tx;\r\n\ts32\t\tm_ty;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBAppProperty.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBAppProperty_h\r\n#define CKLBAppProperty_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n\r\n\r\nclass CKLBAppProperty\r\n{\r\nprivate:\r\n\tCKLBAppProperty();\r\n\tvirtual ~CKLBAppProperty();\r\npublic:\r\n\tenum PIDX {\r\n\t\tSCRN_TYPE\t= 0,\t// Screen Type (LANDSCAPE or PORTRAIT or -1)\r\n\r\n\t\tPIDX_MAX\r\n\t};\r\n\r\n\tstatic CKLBAppProperty& getInstance();\r\n\r\n\tint  getValue(PIDX idx);\r\n\tbool setValue(PIDX idx, int value);\r\n\r\nprivate:\r\n\tint\t\tm_value[ PIDX_MAX ];\r\n};\r\n\r\nclass CKLBAppScriptIF : public IFactory\r\n{\r\npublic:\r\n\tCKLBAppScriptIF(const char * funcname, u32 classID, DEFCMD * arrCmdItem);\r\n\tvirtual ~CKLBAppScriptIF();\r\n\r\n\tstatic int setValue(lua_State * L);\r\n};\r\n\r\n#endif // CKLBAppProperty_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBAsset.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Asset Management System ===\r\n//\r\n//\r\n\r\n#ifndef __CKLB_ASSET__\r\n#define __CKLB_ASSET__\r\n\r\n#include \"RenderingFramework.h\"\r\n#include \"CKLBAction.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CKLBAssetManager;\r\n\r\n/* Create a 32 bit chunk header with FOUR letters*/\r\n#define\tCHUNK_TAG(a,b,c,d)\t\t((a<<24)|(b<<16)|(c<<8)|(d))\r\n\r\n#define HAS_CREATENODE\t\t\t(0x80)\r\nenum ASSET_TYPE {\r\n\tASSET_UIFORM\t\t\t= 0,\r\n\tASSET_ACTIONHANDLER\t\t= 1,\r\n\tASSET_SWFMOVIE\t\t\t= 2 | HAS_CREATENODE,\r\n\tASSET_VISUALRULES\t\t= 3,\r\n\tASSET_PROPERTYRULES\t\t= 4,\r\n\tASSET_IMAGE\t\t\t\t= 5 | HAS_CREATENODE,\r\n\tASSET_TEXTURE\t\t\t= 6,\r\n\tASSET_ANIMATIONSPLINE\t= 7 | HAS_CREATENODE,\r\n\tASSET_AUDIO\t\t\t\t= 8,\r\n\tASSET_MAP\t\t\t\t= 9 | HAS_CREATENODE,\r\n\tASSET_CELLANIM\t\t\t=10 | HAS_CREATENODE,\r\n\tASSET_COMPOSITE\t\t\t=11 | HAS_CREATENODE,\r\n\tASSET_NODEANIM\t\t\t=12 | HAS_CREATENODE,\r\n\tASSET_AI\t\t\t\t=13\r\n};\r\n\r\nstruct ASSET_ATTRIB {\r\n\r\n\tu8\tattribID;\r\n\tu8\ttype;\r\n\r\n\tunion u {\r\n\t\tconst char*\tstr;\r\n\t\ts32\t\t\tvalue;\r\n\t\tfloat\t\tfvalue;\r\n\t} v;\r\n\r\n\t// --- Use z as first char for IDE reason ---\r\n\r\n\t// ====\r\n\tstatic const int\tzK0_RECT\t\t= 0;\r\n\r\n\tstatic const int\tzK1_SC_LEFT\t\t= 1;\r\n\tstatic const int\tzK1_SC_MIDDLE\t= 2;\r\n\tstatic const int\tzK1_SC_RIGHT\t= 3;\r\n\tstatic const int\tzK1_SC_HASBITMAP= 4;\r\n\tstatic const int\tzK1_SC_ISVERTICAL=12;\r\n\r\n\tstatic const int\tzK2_S9_LEFT\t\t= 5;\r\n\tstatic const int\tzK2_S9_MIDDLEX\t= 6;\r\n\tstatic const int\tzK2_S9_RIGHT\t= 7;\r\n\tstatic const int\tzK2_S9_TOP\t\t= 8;\r\n\tstatic const int\tzK2_S9_MIDDLEY\t= 9;\r\n\tstatic const int\tzK2_S9_BOTTOM\t= 10;\r\n\r\n\tstatic const int\tz3DMODEL\t\t= 11;\r\n\tstatic const int\tzK3_OFFSET\t\t= 13;\r\n\r\n\tstatic const int\tzK4_STRETCH_OR_SCALE\t= 14;\r\n\t// last used zK4_STRETCH_OR_SCALE, is Next free is 15. Please update if changes.\r\n\r\n\t// ====\r\n\tstatic const int\tzATTRIB_INT\t\t= 0;\r\n\tstatic const int\tzATTRIB_FLOAT\t= 1;\r\n\tstatic const int\tzATTRIB_STRING\t= 2;\r\n};\r\n\r\n/*!\r\n* \\class CKLBAbstractAsset\r\n* \\brief Abstract Asset Class\r\n* \r\n* Generic basic asset, owns the reference counting mecanism.\r\n* Root class for all asset definition.\r\n*/\r\nclass CKLBAbstractAsset : public CKLBObject {\r\n\tfriend class CKLBAssetManager;\r\n\tfriend class CKLBDebuggerContext;\r\npublic:\r\n\tCKLBAbstractAsset();\r\n\t~CKLBAbstractAsset();\r\n\r\n\tvirtual\tASSET_TYPE\tgetAssetType() = 0;\r\n\r\n\t/* NO DICO\r\n\tvirtual bool\tinclude\t(const char* name);*/\r\n\tvirtual void unloadRessource() { } /* Do nothing by default */\r\n\r\n\tvirtual void onRegisterSubAsset\t\t()\t{ /* Do nothing */ }\r\n\tvirtual void onUnregisterSubAsset\t()\t{ /* Do nothing */ }\r\n\r\n\tvoid\t\t\tincrementRefCount\t\t();\r\n\tbool\t\t\tdecrementRefCount\t\t();\r\n\r\n\tinline\r\n\tu16\t\t\t\tgetRefCount\t\t\t\t()  { return m_refCount; }\r\n\r\n\tinline\t\r\n\tu16\t\t\t\tgetAssetID\t\t\t\t()\t{ return m_assetID; }\r\n\t\r\n\tbool\t\t\tsetNameDirect\t\t\t(const char* name);\r\n\r\n\tinline\r\n\tconst char*\t\tgetName\t\t\t\t\t()\t{ return m_pName; }\r\nprotected:\r\n\tconst\r\n\tchar*\t\t\t\tm_pName;\t\t/* Used by debugger    */\r\n\tconst\r\n\tchar*\t\t\t\tm_pNameBuff;\r\n\tconst\r\n\tchar*\t\t\t\tm_fileSource;\r\n\tu16\t\t\t\t\tm_assetID;\t\t/* Runtime decided ID */\r\n\tu16\t\t\t\t\tm_refCount;\r\n\tbool\t\t\t\tm_marked;\r\nprotected:\r\n\tchar*\tallocateName\t\t(void* ptr, u32 size);\r\n};\r\n\r\nclass CKLBNode;\r\n\r\n/*!\r\n* \\class CKLBAsset\r\n* \\brief Asset Class\r\n* \r\n* A CKLBAsset can create a part of the scene graph when instancing.\r\n*/\r\nclass CKLBAsset : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 /*priorityBase*/ = 0)\t= 0;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIAsset\r\n* \\brief UIAsset Class\r\n* \r\n* Generates an instance of UI Form from asset definition.\r\n*/\r\nclass CKLBUIAsset : public CKLBAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_UIFORM; }\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 priorityBase = 0);\r\n};\r\n\r\n/*!\r\n* \\class CKLBSplineAnimationAsset\r\n* \\brief Spline Animation Asset Class\r\n* \r\n* Generates an instance of a node modified by an animation spline.\r\n*/\r\nclass CKLBSplineAnimationAsset : public CKLBAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_ANIMATIONSPLINE; }\r\n\tvirtual u32\t\t\tgetClassID\t()\t\t{ return CLS_ASSETANIMSPLINE;   }\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 /*priorityBase*/ = 0)\t\t{ return NULL; }\r\n};\r\n\r\n/*!\r\n* \\class CKLBVisualRule\r\n* \\brief Visual Rule Class\r\n* \r\n* Visual Rules are assets part of game units.\r\n* Visual Rule definition loaded by ressource manager.\r\n* Property Change\t->\t\tVisual Change\r\n* State Change\t\t->\t\tVisual Change\r\n*/\r\nclass CKLBVisualRule : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_VISUALRULES; }\r\n\tu16\t\t\t\tm_solvedPropertIndex;\r\n\tCKLBVisualRule*\tm_pNextInTemplate;\r\n};\r\n\r\n/*!\r\n* \\class CKLBActionRule\r\n* \\brief Action Rule Class\r\n* \r\n* Action Rules are assets part of game units.\r\n*/\r\nclass CKLBActionRule : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_PROPERTYRULES; }\r\n\tCKLBActionRule*\tm_pNextInTemplate;\r\n};\r\n\r\n/*!\r\n* \\class CKLBActionHandler\r\n* \\brief Action Handler Class\r\n* \r\n* Action Handler are function definition of event handler.\r\n* - Used by game unit.\r\n* - Used by UI components as event handler.\r\n*/\r\nclass CKLBActionHandler : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_ACTIONHANDLER; }\r\n\tu32\t\t\t\t\tm_actionType;\r\n\tCKLBActionHandler*\tm_pNextInTemplate;\r\n\tvirtual\t\tbool\thandler(CKLBAction* pAction) = 0;\r\n};\r\n\r\n/*!\r\n* \\class IKLBAssetPlugin\r\n* \\brief Asset Plugin Class\r\n* \r\n* Base Interface for asset loaders.\r\n* All asset loaders implement this interface to handle new_ asset format.\r\n*/\r\nclass IKLBAssetPlugin {\r\n\tfriend class CKLBAssetManager;\r\npublic:\r\n\tvirtual\tu8\t\t\t\t\tcharHeader()\t\t\t\t\t\t\t\t= 0;\r\n\tvirtual u32\t\t\t\t\tgetChunkID()\t\t\t\t\t\t\t\t= 0;\r\n\tvirtual const char*\t\t\tfileExtension()\t\t\t\t\t\t\t\t= 0;\r\n\t\t\tvoid\t\t\t\tsetReloadingAsset(CKLBAbstractAsset* pAsset) {\r\n\t\t\t\tm_pReloadAsset = pAsset;\r\n\t\t\t}\r\n\tvirtual void\t\t\t\tsetCurrentFileName(const char* currentFileName) { } /* Do nothing by default */\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize)\t\t= 0;\r\n\tvirtual CKLBAbstractAsset*\tloadByFileName(const char* /*fileName*/)\t{ /* Do nothing */ return NULL; }\r\nprotected:\r\n\tIKLBAssetPlugin();\r\n\tvirtual ~IKLBAssetPlugin();\r\n\tCKLBAbstractAsset*\tm_pReloadAsset;\r\nprivate:\r\n\tIKLBAssetPlugin*\tm_pNext;\r\n};\r\n\r\nclass Dictionnary;\r\nclass CKLBTextureAsset;\r\n\r\n/*!\r\n* \\class CKLBAssetManager\r\n* \\brief Asset Manager Class\r\n* \r\n* Supports all assets instance life cycle, and asset loader plugin.\r\n*/\r\nclass CKLBAssetManager {\r\npublic:\r\n\t//\r\n\t// Async Loading related stuff...\r\n\t//\r\n\tstruct SAsset {\r\n\t\tconst char*\t\t\tname;\r\n\t\tCKLBAbstractAsset*\tasset;\r\n\t\tbool\t\t\t\tloadingStarted;\r\n\t\tbool\t\t\t\tloadingComplete;\r\n\t\tbool\t\t\t\tchecked;\r\n\t\tbool\t\t\t\tadded;\r\n\r\n\t\t// Information to fill.\r\n\t\tvolatile bool\t\tprocessByMainThread;\r\n\t\tCKLBTextureAsset*\tpTexAsset;\r\n\t\tGLenum\t\t\t\tpixelFormat;\r\n\t\tCKLBOGLWrapper::TEX_CHANNEL\t\r\n\t\t\t\t\t\t\tchannel;\r\n\t\tu32\t\t\t\t\topt;\r\n\t\tu32\t\t\t\t\ttextureSize;\r\n\t};\r\nprivate:\r\n\tvolatile\tbool\tm_ThreadWait;\r\n\tvolatile\tbool\tm_AsyncMode;\r\n\tSAsset*\tm_currAsset;\r\npublic:\r\n\tbool isAsyncLoading\t\t\t();\r\n\tvoid setAsyncLoading\t\t(bool mode);\r\n\tvoid setCurrentAsyncAsset\t(CKLBAssetManager::SAsset* asset);\r\n\tSAsset* getCurrentAsyncAsset();\r\n\tvoid setMainThreadTexture\t(CKLBTextureAsset* pTexAsset, GLenum pixelFormat, CKLBOGLWrapper::TEX_CHANNEL channel, u32 opt, u32 textureSize);\r\n\r\n\tinline\r\n\tstatic CKLBAssetManager& getInstance() {\r\n\t\tstatic CKLBAssetManager instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release() {\tgetInstance()._release();\t}\r\n\r\n\tvoid\tdump\t\t\t\t();\r\n\r\n\t//\r\n\t// Asset definition file.\r\n\t//\t- Texture\r\n\t//\t- \r\n\t//\r\n\tvoid\t\tregisterAssetPlugIn\t(IKLBAssetPlugin* plugin);\r\n\tvoid\t\tregisterAsset\t\t(CKLBAbstractAsset* pAsset);\r\n\r\n\tinline IKLBAssetPlugin* \r\n\t\t\t\tgetPlugin\t\t\t(u8 charCode) { return m_arrayByCharCode[charCode]; }\r\n\r\n\tvoid\t\tfreeAsset\t\t\t(u16 assetID);\r\n\r\n\tinline\r\n\tCKLBAbstractAsset*\t\t\r\n\t\t\t\tgetAsset\t\t\t(u16 assetID) {\r\n\t\t\t\t\tklb_assert((assetID < m_maxAssetEntry), \"invalid asset ID\");\r\n\t\t\t\t\tklb_assert(this->m_assetRecord[assetID].m_isFree == false, \"already free\");\r\n\t\t\t\t\treturn this->m_assetRecord[assetID].m_pAsset;\r\n\t\t\t\t}\r\n\r\n\tu16\t\t\tgetAssetIDFromName\t(const char* name, char plugin, u32 retryCounter = 0);\r\n\tconst char*\tgetAssetNameFromID\t(u16 assetID);\r\n\t\r\n\t// TOO Slow, and not used for now.\r\n\t// u16\t\t\tgetAssetCount\t\t();\r\n\t// u16\t\t\tgetAssetIDFromIndex\t(u16 index);\r\n\t//\r\n\t// Asset replacement system\r\n\t//\r\n\tvoid\t\tassetReplaceMarking\t\t\t(u16 assetID);\r\n\tbool\t\tassetReplaceNameMatch\t\t(CKLBAbstractAsset* oldAsset, CKLBAbstractAsset* newAsset);\r\n\tbool\t\tisReplaceMarked\t\t\t\t(u16 assetID);\r\n\tvoid\t\trollBackMarking\t\t\t\t(u16 assetID);\r\n\tvoid\t\tassetReplaceFinishDeletion\t(u16 assetID);\r\n\r\n\t// TODO public for the time beeing (See CKLBLuaLibDATA)\r\n\tbool\t\tloadAssetStream\t\t\t\t(IReadStream* pStream, CKLBAbstractAsset** ppAsset, IKLBAssetPlugin* plugIn = NULL, bool useAsync = false);\r\nprivate:\r\n\tvoid\t\tcheckAsync\t\t\t\t\t(bool asyncMode);\r\npublic:\r\n\tvoid\t\tunloadAsset\t\t\t\t\t();\r\n\tvoid\t\trestoreAsset\t\t\t\t();\r\n\r\n\tCKLBAbstractAsset* \r\n\t\t\t\tloadAssetByFileName\t(const char* fileName, IKLBAssetPlugin* plugin = NULL, bool noStream = false, bool useAsync = false);\r\n\tvoid\t\taddSearchSubEntry\t(CKLBAbstractAsset* pAsset, const char* name);\r\n\tvoid\t\tremoveSearchEntry\t(const char* name);\r\n\r\n\t/**\r\n\t\tThis function does the real loading AND allocation of memory block in asset manager\r\n\t\tFor this reason, it should not be accessible to anybody but only from public \"loadAsset\" function\r\n\t\tin this class.\r\n\t */\r\n\tbool\t\tloadAsset\t\t\t(u8* stream, u32 streamSize, CKLBAbstractAsset** ppAsset, IKLBAssetPlugin* plugIn = NULL, bool useAsync = false);\r\n\r\n\tbool\t\tinit\t\t\t\t(u32 maxAssetEntry, u32 dicoNodeMax);\t// 2012.12.11  Reboot時に明示皁E��呼ぶ為に外へ出しました\r\nprivate:\r\n\r\n\t// OPTIMIZE RP : can optimize with this union between : pAsset vs prev/next\r\n\tstruct SAssetEntry {\r\n\t\tCKLBAbstractAsset*\tm_pAsset;\r\n\t\tbool\t\t\t\tm_isFree;\r\n\r\n\t\tu16\t\t\t\t\tm_prev;\r\n\t\tu16\t\t\t\t\tm_next;\r\n\t};\r\n\r\n\tvoid\t\taddSearchEntry\t\t(CKLBAbstractAsset* pAsset);\r\n\tu16\t\t\tsearchEntry\t\t\t(const char* name);\r\n\t\r\n\tIKLBAssetPlugin*\tm_pAssetDecoders;\r\n\tIKLBAssetPlugin*\tm_arrayByCharCode[256];\r\n\tSAssetEntry*\t\tm_assetRecord;\r\n\tu32\t\t\t\t\tm_maxAssetEntry;\r\n\tu16\t\t\t\t\tm_freeList;\r\n\tbool\t\t\t\tm_bIsInit;\r\n\tbool\t\t\t\tm_unloaded;\r\n\tDictionnary*\t\tm_dictionnary;\r\n\tconst char*\t\t\tm_currentLoadingFile;\r\n\r\n\tCKLBAssetManager\t\t(CKLBAssetManager const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t\t(CKLBAssetManager const&);\t\t// Dont implement.\r\n\r\n\tu16\t\tallocateAssetSlot\t(CKLBAbstractAsset* pAsset);\r\n\tCKLBAbstractAsset* freeAssetSlot\t\t(u16 index);\r\n\r\n\r\n\tCKLBAssetManager();\r\n\t~CKLBAssetManager();\r\n\tvoid _release();\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBAsyncFilecopy.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBAsyncFilecopy_h\r\n#define CKLBAsyncFilecopy_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBAsyncFilecopy\r\n* \\brief Asynchronus File Copy Task class\r\n* \r\n* File copy may be a long operation to process.\r\n* In order to lighten the process cost for the game, it can be done\r\n* by another thread through a CKLBAsyncFilecopy object.\r\n* To load a resource in an asynchronous way, see CKLBAsyncLoader.\r\n*/\r\nclass CKLBAsyncFilecopy : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBAsyncFilecopy>;\r\nprivate:\r\n\tCKLBAsyncFilecopy();\r\n\tvirtual ~CKLBAsyncFilecopy();\r\n\r\n\tbool init(CKLBTask* pParentTask, const char* sourceFile, const char* destFile, const char* callback);\r\npublic:\r\n\tstatic CKLBAsyncFilecopy* create(CKLBTask* pParentTask, const char* sourceFile, const char* destFile, const char* callback);\r\n\r\n\tbool\t\tinitScript\t\t(CLuaState& lua);\r\n\r\n\tvoid\t\texecute\t\t\t(u32 deltaT);\r\n\tvoid\t\tdie\t\t\t\t();\r\n\r\n\tvirtual u32 getClassID\t\t();\r\n\r\n\tinline u32 getProcessCount\t()\t\t{ return m_done;\t}\r\n\tinline u32 getError\t\t\t()\t\t{ return m_error;\t}\r\n\r\nprivate:\r\n\tstatic s32 ThreadLoader(void * hThread, void * data);\r\n\tconst char *\t\t\t\tm_callback;\r\n\tconst char *\t\t\t\tm_fileNameSrc;\r\n\tconst char *\t\t\t\tm_fileNameDst;\r\n\tvoid*\t\t\t\t\t\tm_thread;\r\n\tu32\t\t\t\t\t\t\tm_done;\r\n\tu32\t\t\t\t\t\t\tm_doneSize;\r\n\tu32\t\t\t\t\t\t\tm_checkSize;\r\n\tu32\t\t\t\t\t\t\tm_error;\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBAsyncFilecopy_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBAsyncLoader.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBAsyncLoader_h\r\n#define CKLBAsyncLoader_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBAsyncLoader\r\n* \\brief Asynchronus Loader Task class\r\n* \r\n* Loading resources can be a long task for the Game and make it long to load some scenes.\r\n* In order to be able to keep on processing the Game Logic while loading resources, \r\n* CKLBAsyncLoader has been implemented.\r\n* It allows the Engine to load resources through another thread.\r\n* \r\n* To copy a file in an asynchronous way, see CKLBAsyncLoader.\r\n*/\r\nclass CKLBAsyncLoader : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBAsyncLoader>;\r\nprivate:\r\n\tCKLBAsyncLoader();\r\n\tvirtual ~CKLBAsyncLoader();\r\n\r\n\tbool init(CKLBTask* pParentTask, const char** assets, u32 count, u32 datasetID, const char* callback);\r\npublic:\r\n\tstatic CKLBAsyncLoader* create(CKLBTask* pParentTask, const char** assets, u32 count, u32 datasetID, const char* callback);\r\n\r\n\tbool\t\tinitScript\t\t(CLuaState& lua);\r\n\r\n\tvoid\t\texecute\t\t\t(u32 deltaT);\r\n\tvoid\t\tdie\t\t\t\t();\r\n\r\n\tvirtual u32 getClassID\t\t();\r\n\r\n\tinline u32\tgetTotalCount\t()\t\t{ return m_count;\t}\r\n\r\n\tinline u32\tgetProcessCount\t()\t{ return m_done;\t}\r\n\r\nprivate:\r\n\tstatic s32 ThreadLoader(void * hThread, void * data);\r\n\tCKLBAssetManager::SAsset*\tm_pAssets;\r\n\tvolatile bool\t\t\t\tm_alive;\r\n\tconst char\t*\t\t\t\tm_callback;\r\n\tCKLBDataSet *\t\t\t\tm_pDataSet;\r\n\tvoid*\t\t\t\t\t\tm_thread;\r\n\tu32\t\t\t\t\t\t\tm_done;\r\n\tu32\t\t\t\t\t\t\tm_lastdone;\r\n\tu32\t\t\t\t\t\t\tm_error;\r\n\tu32\t\t\t\t\t\t\tm_count;\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBIntervalTimer_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBBinArray.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBBinArray_h\r\n#define CKLBBinArray_h\r\n\r\n#include <stdio.h>\r\n#include \"BaseType.h\"\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBBinArray : public CKLBObjectScriptable\r\n{\r\npublic:\r\n\tCKLBBinArray();\r\n\tvirtual ~CKLBBinArray();\r\n\r\n\tu32 getClassID();\r\n\r\n\tstatic void removeAll();\r\n\tstatic bool dumpAll();\r\n\r\n\tbool loadAsset(const char * path);\r\n\r\n\tinline size_t getSize() const { return m_size; }\r\n\tinline u8 getByte(int offset) { return *(m_pBuf + offset); }\r\n\tinline u16 getWordLE(int offset) {\r\n\t\tu16 val = *(m_pBuf + offset);\r\n\t\tval |= (u16)*(m_pBuf + offset + 1) << 8;\r\n\t\treturn val;\r\n\t}\r\n\tinline u32 getLongLE(int offset) {\r\n\t\tu32 val = *(m_pBuf + offset);\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 8;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 16;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 24;\r\n\t\treturn val;\r\n\t}\r\n\r\n\tinline u16 getWordBE(int offset) {\r\n\t\tu16 val = (u16)*(m_pBuf + offset) << 8;\r\n\t\tval |= *(m_pBuf + offset + 1);\r\n\t\treturn val;\r\n\t}\r\n\tinline u32 getLongBE(int offset) {\r\n\t\tu32 val = (u32)*(m_pBuf + offset) << 24;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 16;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 8;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1);\r\n\t\treturn val;\r\n\t}\r\n\r\nprivate:\r\n\tconst char\t*\tm_name;\r\n\tsize_t\t\t\tm_size;\r\n\tu8\t\t\t*\tm_pBuf;\r\n\r\n\r\n\tCKLBBinArray\t*\tm_prev;\r\n\tCKLBBinArray\t*\tm_next;\r\n\r\n\tstatic CKLBBinArray\t*\tms_begin;\r\n\tstatic CKLBBinArray\t*\tms_end;\r\n};\r\n\r\n#endif // CKLBBinArray_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBCanvasSprite.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_CANVAS_SPRITE__\r\n#define __CKLB_CANVAS_SPRITE__\r\n\r\n#include \"CKLBRendering.h\"\r\n\r\nclass CKLBCanvasSprite : public CKLBSprite {\r\npublic:\r\n\tCKLBCanvasSprite();\r\n\t~CKLBCanvasSprite();\r\n\r\n\tbool setupCanvas\t(u32 vertexCount, u32 indexCount);\r\n\tvoid setupTexture\t(CKLBTextureAsset* pTexture);\r\n\r\n\tinline\r\n\tbool isFreeze\t\t()\t{ return m_freeze; }\r\n\tvoid freeze\t\t\t(bool freeze);\r\n\tbool clear\t\t\t();\r\n\tbool drawImage\t\t(float x, float y, CKLBImageAsset* pImage, u32 color);\r\n\tbool drawScale\t\t(float x, float y, float scale, CKLBImageAsset* pImage, u32 color);\r\n\tbool drawImageClip\t(float x, float y, CKLBImageAsset* pImage, float percW, float percH, u32 color);\r\n\tbool fillRect\t\t(float x, float y, float w, float h, u32 color);\r\n\r\n\tvoid startDynamicSection\t(u32 section);\r\n\tvoid endDynamicSection\t\t(u32 section);\r\n\tvoid dynamicSectionTranslate(u32 section, float x, float y);\r\n\tvoid dynamicSectionColor\t(u32 section, u32 color);\r\n\r\n\tvoid setFillUV\t\t\t\t(float u, float v);\r\nprotected:\r\n\t#define MAX_SECTION\t\t(10)\r\n\tstruct SECTION {\r\n\t\tu16\t\tlengthFloat;\r\n\t\tu16\t\tstart;\r\n\t\tbool\tstarted;\r\n\t};\r\n\r\n\tSECTION\tm_dynSection[10];\r\n\tvoid doUVAndColor\t(CKLBImageAsset* pImage, u32 color, u16 vCount, u16 iCount);\r\n\r\n\tCKLBImageAsset _internalImg;\r\n\tu32*\tm_pLocalColors;\r\n\r\n\tfloat\tm_fillU;\r\n\tfloat\tm_fillV;\r\n\tu32*\tm_pFillColors;\r\n\tfloat*\tm_pFillVertex;\r\n\tfloat*\tm_pFillUV;\r\n\tu16*\tm_pFillIndex;\r\n\tbool\tm_freeze;\r\n};\r\n\r\n#endif // __CKLB_CANVAS_SPRITE__\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDataHandler.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __KLB_DATAHANDLER__\r\n#define __KLB_DATAHANDLER__\r\n\r\n#include \"BaseType.h\"\r\n#include \"CKLBTask.h\"\r\n\r\nclass CKLBDataSet;\r\n\r\nclass CKLBDataHandler {\r\n\tfriend class CKLBDataSet;\r\npublic:\r\n\tstatic bool\t\tinit\t\t\t(u16 handlerCount);\r\n\tstatic void\t\trelease\t\t\t();\r\n\r\n\tstatic \r\n\tCKLBDataSet*\tcreateSet\t\t(u32 userDebugID);\r\n\r\n\tstatic void\t\tdestroySet\t\t(CKLBDataSet* set);\r\n\tstatic void\t\tclearAllSet\t\t();\r\n\tstatic void\t\tdumpDataSet\t\t();\r\n\r\n\tstatic u16\t\tallocateHandle\t();\r\n\tstatic void\t\tsetPointer\t\t(u16 handle, void* ptr);\r\n\tstatic void\t\treleaseHandle\t(u16 handle);\r\n\tstatic u16\t\tallocateHandle\t(void* ptr);\r\n\r\n\tstatic void*\tgetPointer\t\t(u16 handle);\r\nprivate:\r\n\tstatic u32\t\ts_maxHandler;\r\n};\r\n\r\nclass CKLBDataSet : public CKLBObjectScriptable {\r\n\tfriend class CKLBDataHandler;\r\nprivate:\r\n\r\n\tCKLBDataSet\t\t\t\t();\r\n\t~CKLBDataSet\t\t\t();\r\n\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tbool\tlock\t\t\t\t(CKLBTask * pTask);\r\n\tvoid\tunlock\t\t\t\t();\r\n\tu16\t\tallocateHandle\t\t(void* ptr,  char* name);\r\n\tu16\t\tgetHandleFromName\t(char* name);\r\n\t\r\n\tinline\t\r\n\tvoid*\tgetPointer\t\t\t(u16 handle) {\r\n\t\treturn CKLBDataHandler::getPointer(handle);\r\n\t}\r\n\r\nprivate:\r\n\tstruct Handle {\r\n\t\tHandle* next;\r\n\t\tu32 handle;\r\n\t\tchar* name;\r\n\t};\r\n\r\n\tstruct TaskWrapper {\r\n\t\tTaskWrapper*\tm_pNext;\r\n\t\tvoid*\t\t\tptrTask;\r\n\t};\r\n\r\n\tbool\taddTask\t\t\t\t(void* ptrTask);\r\n\tvoid\tremoveTask\t\t\t(void* ptrTask);\r\n\tHandle*\taddHandle\t\t\t(u16 handle, char* name);\r\n\r\n\tCKLBDataSet*\tm_next;\r\n\tHandle*\t\t\tm_listHandle;\r\n\tTaskWrapper*\tm_listTask;\r\n\tu32\t\t\t\tm_userID;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDatabase.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// Wrapper around SQL Lite\r\n//\r\n\r\n#ifndef __KLB_DATABASE__\r\n#define __KLB_DATABASE__\r\n\r\n#include \"sqlite3.h\"\r\n#include \"BaseType.h\"\r\n\r\n/**\r\n\tDatabase Singleton.\r\n */\r\nclass CKLBDatabase {\r\npublic:\r\n\tinline\r\n\tstatic CKLBDatabase& getInstance() {\r\n\t\tstatic CKLBDatabase instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release\t\t()\t{ getInstance()._release();\t}\r\n\r\n\tbool\tinit\t\t\t(const char* dbFile, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);\r\n\r\n\ts32\t\tlookup\t\t\t(const char* table, const char* resultField, const char* className, const char* filterField, s32 filterValue);\r\n\r\n\tint\t\tcallBack\t\t(int colNum,char** columnText,char** columnName);\r\nprivate:\r\n\tsqlite3*\tm_dataBase;\r\n\tbool\t\tm_pragmaJournal;\r\n\tchar*\t\tm_lastDB;\r\n\ts32\t\t\tm_result;\r\n\t\r\n\tCKLBDatabase\t\t\t(CKLBDatabase const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t\t(CKLBDatabase const&);\t\t// Dont implement.\r\n\r\n\tbool\trunStatement\t(const char* SQLStatement);\r\n\r\n\tvoid\tinit\t\t\t();\r\n\r\n\tCKLBDatabase ();\r\n\t~CKLBDatabase();\r\n\tvoid _release();\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDebugMenu.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBDebugMenu_h\r\n#define CKLBDebugMenu_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n#define DBG_FONTSIZE 32\r\n#define DBG_FONTNAME \"fixed\"\r\n\r\n\r\nstruct DBG_MENU {\r\n\tconst char * caption;\r\n\tconst char * key;\r\n\tenum MODE {\r\n\t\tM_SWITCH,\t// ON/OFF\r\n\t\tM_NUMBER,\t// 数値\r\n\t\tM_SELECT,\t// 選択メニュー\r\n\t};\r\n\tMODE\t\t\tmode;\r\n\tint\t\t\t\tmin;\r\n\tint\t\t\t\tmax;\r\n\tint\t\t\t\tvalue;\r\n\tconst char **\titems;\r\n};\r\n\r\nclass CKLBDebugMenu;\r\n\r\n/*!\r\n* \\class CKLBDebugSign\r\n* \\brief \r\n* Internal task created by CKLBDebugMenu for controlling the appearance or disappearance of debug menu.\r\n* It detect a specific sign made by moving the finger on the screen.\r\n*\r\n* 1x          x3\r\n*   xx      xx  x\r\n*     xx  xx    x\r\n*       xx      x\r\n*     xx  xx    x\r\n*   xx      xx  x\r\n* 4x          x2\r\n*\r\n* Following the 1,2,3,4 order.\r\n*\r\n*/\r\nclass CKLBDebugSign : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBDebugSign();\r\n\tvirtual ~CKLBDebugSign();\r\npublic:\r\n\tstatic CKLBDebugSign * create(CKLBDebugMenu * pMenu);\r\n\r\n\tbool init(CKLBDebugMenu * pMenu);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\nprivate:\r\n\tint checkPoint(int x, int y);\r\n\r\n\tCKLBDebugMenu\t*\tm_pMenu;\r\n\r\n\tint\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\tm_cmdStep;\r\n\tint\t\t\t\t\tm_cmdID;\r\n};\r\n\r\n/*!\r\n* \\class CKLBDebugMenu\r\n* \\brief Debug Menu\r\n* \r\n* CKLBDebugMenu allows to create a debug menu task for your game.\r\n* Several items can be used in the Menu : \r\n* - Switch between 2 values.\r\n* - Numbers.\r\n* - Select between several values.\r\n*\r\n* Compile option DEBUG_MENU must be set to be able to use it.\r\n*/\r\nclass CKLBDebugMenu : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBDebugMenu();\r\n\tvirtual ~CKLBDebugMenu();\r\npublic:\r\n\tstatic CKLBDebugMenu * create();\r\n\r\n\tbool init   ();\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tvoid menu_switch    (bool bSwitch);\r\n\r\nprivate:\r\n\tvoid execute_active (u32 deltaT);\r\n\r\nprivate:\r\n\tenum STATE {\r\n\t\tE_WAIT,\r\n\t\tE_ACTIVE\r\n\t};\r\n\tSTATE\t\t\tm_state;\t// 現在の状態\r\n\tint\t\t\t\tm_step;\r\n\r\n\tstruct PAD {\r\n\t\tbool\tenable;\r\n\t\tint\t\tx, y;\t// TAP位置\r\n\t};\r\n\tint\t\t\t\tm_dispY;\r\n\tPAD\t\t\t\tm_pad[CKLBTouchEventUIMgr::MAX_TOUCH_POINT];\r\n};\r\n\r\nclass CKLBDebugResource\r\n{\r\nprivate:\r\n\tCKLBDebugResource();\r\n\tvirtual ~CKLBDebugResource();\r\npublic:\r\n\tstatic CKLBDebugResource& getInstance();\r\n\r\n\tvoid    init   ();\r\n\tvoid    clear  ();\r\n\r\n\tvoid    release();\r\n\r\n\tvoid    addDebugItem    (const char * caption, const char * key, DBG_MENU * pItem);\r\n\r\n\tvoid    dispEnable      (bool enable);\r\n\tbool    tapItem         (int x, int y);\r\n\r\n\tvoid    setGroupLua     (const char * caption, const char * key, CLuaState& lua);\r\n\tvoid    removeGroup     (const char * key);\r\n\r\n\tvoid    createLuaTable  (CLuaState& lua);\r\n\r\n\tvoid    setCallback     (const char * callback);\r\n\tvoid    finishReport    ();\r\n\r\n\tint     setScroll       (int dispY) {\r\n\t\tif(dispY > m_lastY - m_scrnHeight) dispY = m_lastY - m_scrnHeight;\r\n\t\tif(dispY < 0) dispY = 0;\r\n\t\tm_dispY = -dispY;\r\n\t\tm_pNode->setTranslate(0, (float)m_dispY);\r\n\t\treturn dispY;\r\n\t}\r\n\tinline void setBright   (float bright) {\r\n\t\tSColorVector vec;\r\n\t\tfor(int i = 0; i < 3; i++) vec.m_vector[i] = bright;\r\n\t\tm_pNode->setColorMatrix(vec);\r\n\t}\r\nprivate:\r\n\tCKLBNode *  addLabel    (int x, int y, const char * label, int * width, int * height);\r\n\tCKLBNodeVirtualDocument * createLabelItem(const char * label, int * width, int * height);\r\n\r\n\tCKLBNode\t*\tm_pNode;\r\n\r\n\tstruct SWITCH {\r\n\t\tCKLBNode\t*\tlabel;\r\n\t\tCKLBNode\t*\tpNode;\r\n\t\tunion {\r\n\t\t\tCKLBNodeVirtualDocument * pVDoc;\r\n\t\t\tCKLBUITextBox\t\t\t* pText;\r\n\t\t} obj;\r\n\r\n\t\tDBG_MENU::MODE\tmode;\r\n\t\tint\t\t\t\tmin;\t// MODEがM_NUMBERのときのみ有効\r\n\t\tint\t\t\t\tmax;\t// 最大値\r\n\t\tint\t\t\t\tval;\t// 現在の値\r\n\t\tconst char\t*\tkey;\t// Lua配列化する際のキー文字列\r\n\t\tconst char **\tdisp;\t// 表示値(M_SWITCH/M_SELECTのときに使用、M_NUMBERでは0)\r\n\t\tstruct {\r\n\t\t\tint x, y;\r\n\t\t\tint w, h;\r\n\t\t} rect;\t\t\t\t\t// switch/select で使用するhitboxの相対位置とサイズ\r\n\t};\r\n\r\n\tstruct GROUP {\r\n\t\tGROUP\t\t*\tprev;\r\n\t\tGROUP\t\t*\tnext;\r\n\r\n\t\tconst char\t*\tkey;\r\n\t\tCKLBNode\t*\tnode;\t// グループラベルのnode\r\n\t\tint\t\t\t\tcnt;\t// 項目数\r\n\t\tSWITCH\t\t*\tmenu;\t// 1項目あたりの領域\r\n\t};\r\n\r\n\tGROUP\t\t*\tm_begin;\r\n\tGROUP\t\t*\tm_end;\r\n\r\n\tint\t\t\t\tm_dispY;\t// スクロール用\r\n\r\n\tint\t\t\t\tm_lastY;\t// 項目追加用\r\n\tu32\t\t\t\tm_order;\r\n\r\n\tint\t\t\t\tm_exitWidth;\r\n\tint\t\t\t\tm_exitHeight;\r\n\r\n\tint\t\t\t\tm_scrnHeight;\r\n\r\n\tconst char\t*\tm_callback;\r\n\r\n\tu8\t\t\t\tm_format;\r\n\r\n\tstatic const char * ms_labelSwitch[];\r\n};\r\n\r\n#endif // CKLBDebugMenu_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDebugger.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Debugger System ===\r\n//\r\n//\r\n\r\n#ifndef __KLB_DEBUGGER__\r\n#define __KLB_DEBUGGER__\r\n\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBDebuggerContext;\r\nclass IKLBDebuggerCommunicator;\r\n\r\nclass CKLBDebuggerContext:public CKLBContext {\r\npublic:\r\n\tCKLBDebuggerContext(u32 size);\r\n\t~CKLBDebuggerContext();\r\n\r\n\t/**\r\n\t\tAvailable command for the debugger.\r\n\t */\r\n\tenum COMMAND_TYPE {\r\n\t\tGET_ALL_OBJECT\t\t= 0x01,\r\n\t\tGET_TYPE\t\t\t= 0x02,\r\n\t\tGET_PROPCOUNT\t\t= 0x03,\r\n\t\tGET_VALUE\t\t\t= 0x04,\r\n\t\tGET_CLASSNAME\t\t= 0x05,\r\n\t\tGET_PROPNAME\t\t= 0x06,\r\n\t\tSET_VALUE\t\t\t= 0x07,\r\n\t\tSCREEN_SHOT\t\t\t= 0x08,\r\n\t\tSET_ASSET\t\t\t= 0x09,\r\n\t\tGET_PROPID\t\t\t= 0x0A,\r\n\t\tGET_FORMAT\t\t\t= 0x0B,\r\n\t\t\r\n\t\t// 0xC,0xD,0xE,0xF,0x10,0x11,0x12 free to use.\r\n\r\n\t\tQUERY_GAMESTOP\t\t= 0x13,\r\n\t\tQUERY_GAMESTART\t\t= 0x14,\r\n\t};\r\n\r\n\t/**\r\n\t\tPossible error code return instead of size to the remote device.\r\n\t */\r\n\tenum ERROR_TYPE {\r\n\t\tERR_NOERROR\t\t\t= 0,\t\t\t//\tNo error, replace with correct size during transport.\r\n\t\tERR_PROCESS\t\t\t= 0xCAFEDE00,\t// \tImpossible to process.\r\n\t\tERR_INTERNAL\t\t= 0xCAFEDE01,\t//\tInternal Error.\r\n\t\tERR_ALLOCATION\t\t= 0xCAFEDE02,\t//\tAllocation error.\r\n\t\tERR_INVALIDREQ\t\t= 0xCAFEDE03,\t//\tMalformed command or parameter.\r\n\t};\r\n\t\r\n\tenum CLASS_GROUP {\r\n\t\tCLSGRP_GAME\t\t\t= 0x00000000,\r\n\t\tCLSGRP_ENGINE\t\t= 0x40000000,\r\n\t\tCLSGRP_BASIC\t\t= 0x80000000,\r\n\t\tCLSGRP_BASICPTR\t\t= 0x81000000,\r\n\t\tCLSGRP_NULL\t\t\t= 0xFFFFFFFF\r\n\t};\r\n\r\npublic:\r\n\tvoid setupReceiver\t\t\t(IKLBDebuggerCommunicator* pCommunicator);\r\n\tvoid receiveCommand\t\t\t(u32 commandID, COMMAND_TYPE commandType, u8* data, u32 dataSize);\r\n\r\nprivate:\r\n\tIKLBDebuggerCommunicator*\tm_pCommunicator;\r\n\t\r\n\tvoid returnResultString\t\t(u32 commandID, const char* string);\r\n\tvoid returnResult4\t\t\t(u32 commandID, u32 value);\r\n\tvoid returnResult12\t\t\t(u32 commandID, u32 classID, void* value);\r\n\tvoid errResult\t\t\t\t(u32 commandID, ERROR_TYPE error);\r\n};\r\n\t\r\nclass IKLBDebuggerCommunicator {\r\npublic:\r\n\t/**\r\n\t\tCalled by debugger when assigning the interface.\r\n\t */\r\n\tvirtual void assignDebugger\t(CKLBDebuggerContext* pDebugger) = 0;\r\n\r\n\t/**\r\n\t\tCalled by debugger to request memory for communicator to transmit result.\r\n\t\tCommunicator can free the memory once data is transmitted.\r\n\t\t\r\n\t\tNote : In case of allocation failure, the debugger will NOT call sendResult\r\n\t\t\t\tThus, a failure in allocate result should return an error message to the remote device waiting for results.\r\n\t */\r\n\tvirtual u8* allocateResult\t(u32 commandID, u32 size) = 0;\r\n\r\n\t/**\r\n\t\tCalled by debugger once data is setup and successfull.\r\n\t */\r\n\tvirtual void sendResult\t\t(u32 commandID, CKLBDebuggerContext::ERROR_TYPE err) = 0;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDeviceKeyEvent.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBDeviceKeyEvent.h\r\n//\r\n\r\n#ifndef CKLBDeviceKeyEvent_h\r\n#define CKLBDeviceKeyEvent_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n// #define\tLOG_EVENT\r\n\r\ntypedef struct {\r\n    typedef enum {\r\n        PRESS = 1,\r\n        RELEASE = 2,\r\n        CLICK = 3\r\n    } TYPE;\r\n\r\n    TYPE    type;\r\n    int     id;\r\n\tvoid\t* locker;\t// 入力の使用者\r\n} DEVICE_KEY_ITEM;\r\n\r\nclass CKLBDeviceKeyEventQueue\r\n{\r\nprivate:\r\n    CKLBDeviceKeyEventQueue();\r\n    ~CKLBDeviceKeyEventQueue();\r\npublic:\r\n    static CKLBDeviceKeyEventQueue& getInstance();\r\n\r\n    // キューに入力アイテムを追加(システム側からアイテムを追加する際に使用)\r\n    void addQueue(int keyId, char eventType);\r\n    \r\n    // キューの取得限界を現在の点に固定\r\n    inline void fixLimit() {\r\n        m_read = m_begin;\r\n        m_begin = m_rec;\r\n    }\r\n\r\n    // キューの参照点を読み出し先頭に指定する\r\n    void startItem() {\r\n        m_get = m_read;\r\n    }\r\n\r\n\tinline void setProcessing(bool process) {\r\n\t\tm_bDoingProcess = process;\r\n\t}\r\n    \r\n    // キューのアイテムを参照する\r\n    const DEVICE_KEY_ITEM * getItem() {\r\n\t\tconst DEVICE_KEY_ITEM * ret;\r\n\t\tif(m_get == m_begin) return 0;  // no further event queued\r\n\t\tret = m_itemQueue + m_get;\r\n\t    m_get = ++m_get % QUEUE_SIZE;\r\n\t\t\r\n        return ret;\r\n    }\r\n\r\nprivate:\r\n\tbool\t\t\tm_bDoingProcess;\r\n    \r\n    int             m_begin;        // 記録先頭\r\n    int             m_rec;          // 記録点\r\n    int             m_read;         // 読み出し先頭\r\n    int             m_get;          // 取得点\r\n    \r\n    enum {\r\n        QUEUE_SIZE = 64\r\n    };\r\n    \r\n    DEVICE_KEY_ITEM    m_itemQueue[ QUEUE_SIZE ];\r\n};\r\n\r\n/*!\r\n* \\class CKLBDeviceKeyEvent\r\n* \\brief Touch Pad Events handler class\r\n* \r\n* CKLBDeviceKeyEvent is similar to CKLBOSCtrlEvent, but only handles Touch Pad events.\r\n* It owns a queue of Touch Pad events.\r\n* This task is instanciated once when the game starts.\r\n*/\r\nclass CKLBDeviceKeyEvent : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBDeviceKeyEvent();\r\n    virtual ~CKLBDeviceKeyEvent();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n    static CKLBDeviceKeyEvent * create();\r\n\r\n    void execute(u32 deltaT);\r\n    void die();\r\n\r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDragCallbackIF.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBDragCallbackIF_h\r\n#define CKLBDragCallbackIF_h\r\n\r\n#include \"CKLBTouchPad.h\"\r\n\r\nclass CKLBDragCallbackIF\r\n{\r\npublic:\r\n\tCKLBDragCallbackIF(const char * funcname);\r\n\tvirtual ~CKLBDragCallbackIF();\r\n\r\n\tvirtual void callback(PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y) = 0;\r\n\r\nprotected:\r\n\tvoid execCallback(void * id, PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y);\r\n\r\nprivate:\r\n\tconst char\t*\tm_funcname;\r\n};\r\n\r\n#endif // CKLBUIDragCallback_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBDrawTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBDrawTask_h\r\n#define CKLBDrawTask_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBRendering.h\"\r\n#include \"CKLBNode.h\"\r\n\r\n\r\nclass CKLBDrawResource\r\n{\r\nprivate:\r\n\tCKLBDrawResource();\r\n\tvirtual ~CKLBDrawResource();\r\n\r\npublic:\r\n\tstatic CKLBDrawResource& getInstance();\r\n\r\n\tinline const int width      () const { return m_width;      }\r\n\tinline const int height     () const { return m_height;     }\r\n\r\n\tinline const int vp_width   () const { return m_vp_width;   }\r\n\tinline const int vp_height  () const { return m_vp_height;  }\r\n\r\n\tinline const int ox         () const { return m_ox;         }\r\n\tinline const int oy         () const { return m_oy;         }\r\n\r\n\tbool initResource(bool rotation, int width, int height);\r\n\tvoid freeResource();\r\n\r\n\tvoid setBorderless(bool hasNoBorder);\r\n\r\n\tinline\r\n\tbool hasBorder() { return m_hasBorder; }\r\n\tbool setLogicalResolution(int width, int height, float * other_matrix = 0);\r\n\r\n\tinline void convPointing(int x, int y, int& cx, int& cy) {\r\n\t\tcx = (int)((x - m_ox) / m_scale);\r\n\t\tcy = (int)((y - m_oy) / m_scale);\r\n\t}\r\n\r\n\t// 論理座標系上の長さを物理座標系上の長さに変換する\r\n\tinline float toPhisical(float logical) { return logical * m_scale; }\r\n\r\n\t// 物理座標系上の長さを論理座標系上の長さに変換する\r\n\tinline float toLogical(float phisical) { return phisical / m_scale; }\r\n\r\n\t// 論理座標を物理デバイス座標に変換する(OSコントロールの位置変換等に使用)\r\n\tinline void toPhisicalPosition(int lx, int ly, int& px, int& py) {\r\n\t\tpx = (int)(lx * m_scale) + m_ox;\r\n\t\tpy = (int)(ly * m_scale) + m_oy;\r\n\t}\r\n\t// 論理座標系上のサイズを物理デバイス座標系上のサイズに変換する\r\n\tinline void toPhisicalSize(int lw, int lh, int& pw, int& ph) {\r\n\t\tpw = (int)(lw * m_scale);\r\n\t\tph = (int)(lh * m_scale);\r\n\t}\r\n\r\n    void changeProjectionMatrix(float * matrix, int width, int height);\r\n    \r\n\tinline CKLBNode * getRoot() { return m_gpRootNode; }\r\n    \r\n\tinline void performAnimationUpdate(u32 deltaT) {\r\n\t\tCKLBSystem::performAnimationUpdate(deltaT); \r\n\t}\r\n\r\n\tinline void recompute() {\r\n\t\tm_gpRootNode->recompute();\r\n\t}\r\n\r\n\tinline void draw() {\r\n\t\tCKLBRenderingManager::getInstance().draw();\r\n\t}\r\n\r\n\tbool setClearColor(float r, float g, float b, float a);\r\n\r\n    // ビューポートの再設定(Android版でバックグラウンドから復帰した時に使用)\r\n    void ResetViewport(void);\r\n    \r\n\tbool allowLog\t();\r\n\tvoid setLog\t\t(bool activate);\r\n\r\n\tu32 incrementFrame();\r\n\r\nprivate:\r\n\tbool\t\tm_hasBorder;\r\n\tbool\t\tm_allowLog;\r\n\tu32\t\t\tm_frameCount;\r\n\tint\t\t\tm_phisical_width;\r\n\tint\t\t\tm_phisical_height;\r\n\tint\t\t\tm_width;\r\n\tint\t\t\tm_height;\r\n\tint\t\t\tm_ox;\r\n\tint\t\t\tm_oy;\r\n\tint\t\t\tm_vp_width;\r\n\tint\t\t\tm_vp_height;\r\n\tfloat\t\tm_scale;\t// 論理解像度に対する物理画面の倍率\r\n\tfloat\t\tm_scaleX;\r\n\tfloat\t\tm_scaleY;\r\n\tCKLBNode*\tm_gpRootNode;\r\n};\r\n\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\nclass CKLBDrawTask_recompute;\r\nclass CKLBDrawTask_draw;\r\n#endif\r\n\r\n\r\n/*!\r\n* \\class CKLBDrawTask\r\n* \\brief Draw Task class.\r\n* \r\n* CKLBDrawTask is in charge of drawing the game resources each frame.\r\n* It is instancied only once and draws all the resources in one and only one draw call.\r\n* This task is instancied when the game starts and dies when it stops.\r\n*/\r\nclass CKLBDrawTask : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBDrawTask();\r\n\tvirtual ~CKLBDrawTask();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n\tstatic CKLBDrawTask * create(bool rotate, int width, int height);\r\n\r\n\tvoid execute    (u32 deltaT);\r\n\r\n\tvoid die        ();\r\n\r\n\tu32 getClassID  ();\r\n\r\nprivate:\r\n\tbool init(bool rotate, int width, int height);\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tCKLBDrawTask_recompute\t*\tm_recompute;\r\n\tCKLBDrawTask_draw\t\t*\tm_draw;\r\n#endif\r\n};\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\r\nclass CKLBDrawTask_recompute : public CKLBTask\r\n{\r\n\tfriend class CKLBDrawTask;\r\nprivate:\r\n\tCKLBDrawTask_recompute();\r\n\tvirtual ~CKLBDrawTask_recompute();\r\n\tbool init(CKLBDrawTask * pParent);\r\npublic:\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n};\r\n\r\nclass CKLBDrawTask_draw : public CKLBTask\r\n{\r\n\tfriend class CKLBDrawTask;\r\nprivate:\r\n\tCKLBDrawTask_draw();\r\n\tvirtual ~CKLBDrawTask_draw();\r\n\tbool init(CKLBDrawTask * pParent);\r\npublic:\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n};\r\n\r\n\r\n#endif // DEBUG_PERFORMANCE\r\n\r\n#endif // CKLBDrawTask_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBFormGroup.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBFormGroup_h\r\n#define CKLBFormGroup_h\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\nclass CKLBFormGroup\r\n{\r\nprivate:\r\n\tCKLBFormGroup();\r\n\tvirtual ~CKLBFormGroup();\r\npublic:\r\n\tstatic CKLBFormGroup& getInstance();\r\n\r\n\tvoid release();\r\n\r\n\tbool addForm(SFormCtrlList * list, const char * group_name);\r\n\tbool delForm(SFormCtrlList * list);\r\n\r\n\tinline bool isExclusive(SFormCtrlList * list) {\r\n\t\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\t\tbool grpEx = (pGrp) ? true : false;\r\n\t\treturn list->bExclusive || grpEx;\r\n\t}\r\n\r\n\tinline bool isWorking(SFormCtrlList * list, void * locker = NULL) {\r\n\t\tif(list->bExclusive && list->bWorking) return true;\r\n\t\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\t\tif(pGrp && pGrp->working) {\r\n\t\t\tif(!locker || locker != pGrp->locker) return true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tinline void setWorking(SFormCtrlList * list, bool working, void * locker = NULL) {\r\n\t\tif(list->bExclusive) list->bWorking = working;\r\n\t\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\t\tif(pGrp) {\r\n\t\t\tpGrp->working = working;\r\n\t\t\tpGrp->locker = (working) ? locker : NULL;\r\n\t\t\tpGrp->worker = (working) ? list   : NULL;\r\n\t\t}\r\n\t}\r\n\r\nprivate:\r\n\tstruct GROUP {\r\n\t\tGROUP\t\t*\tprev;\r\n\t\tGROUP\t\t*\tnext;\r\n\r\n\t\t// グループの持つ属性\r\n\t\tconst char\t*\tname;\r\n\t\tbool\t\t\texclusive;\t// 排他制御(trueで排他)\r\n\t\tbool\t\t\tworking;\t// 操作中\r\n\t\tvoid\t\t*\tlocker;\t\t// ロックした者の識別子(ポインタ)\r\n\r\n\t\tSFormCtrlList\t*\tworker;\r\n\r\n\t\t// グループ所属のコントロールリスト構造体リスト(「リスト」が多くてめんどくさい)\r\n\t\tSFormCtrlList\t*\tbegin;\r\n\t\tSFormCtrlList\t*\tend;\r\n\t};\r\n\r\n\tGROUP * searchGroup(const char * group_name);\r\n\tGROUP * createGroup(const char * group_name);\r\n\tvoid    checkGroup(GROUP * pGrp);\r\n\r\n\tGROUP\t\t*\tm_begin;\r\n\tGROUP\t\t*\tm_end;\r\n};\r\n\r\n#endif // CKLBFormGroup_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBFormIF.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBFormIF_h\r\n#define CKLBFormIF_h\r\n\r\n#include \"CLuaState.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*\r\n\tUI_Form や UI_List の UPDATE_NODE コマンド用サブコマンド解釈クラス\r\n */\r\nclass CKLBFormIF\r\n{\r\npublic:\r\n\tenum {\r\n\t\t// 標準ノードサブコマンド\r\n\t\tFORM_NODE_POINTER,\t\t// ノードポインタ取得\r\n\t\tFORM_NODE_RECURSIVE,\t// ノード再帰処理\r\n\t\tFORM_NODE_TRANS,\t\t// 位置指定\r\n\t\tFORM_NODE_SCALE,\t\t// 倍率指定(x, y)\r\n\t\tFORM_NODE_ROT,\t\t\t// 回転角指定(deg)\r\n\t\tFORM_NODE_COLOR,\t\t// RGBA指定\r\n\t\tFORM_NODE_VISIBLE,\t\t// 表示/非表示指定\r\n\t\tFORM_NODE_ORDER,\t\t// プライオリティ\r\n\t\tFORM_NODE_GET_ORDER,\t// プライオリティ取得\r\n\t\tFORM_NODE_TASK,\t\t\t// 対応するUIタスク取得\r\n\r\n\r\n\t\t// CKLBUIElement 対象コマンド\r\n\t\tFORM_UIE_SET_ENABLED,\t// 有効/無効\r\n\t\tFORM_UIE_GET_ENABLED,\t\r\n\t\tFORM_UIE_SET_ASSET,\t\t// assetを変更\r\n\r\n\t\t// CKLBUISelectable 対象コマンド\r\n\t\tFORM_UIS_SET_CLICK,\t\t\t// クリック反応領域を再設定\r\n\t\tFORM_UIS_SET_STICK,\t\t\t// checkbox の状態を設定する\r\n\t\tFORM_UIS_SET_RADIO,\r\n\t\tFORM_UIS_GET_STICK,\t\t\t// checkbox の状態を取得する\r\n\t\tFORM_UIS_SET_CALLBACK,\r\n\r\n\t\t// CKLBUIContainer 対象コマンド\r\n\t\tFORM_CONT_VIEWOFFSET,\t\t// View offset\r\n\t\tFORM_CONT_GET_RADIO_VALUE,\r\n\r\n\t\t// CKLBUITextBox 対象コマンド\r\n\t\tFORM_TEXT_SET,\r\n\t\tFORM_TEXT_GET,\r\n\r\n\t\t// CKLBUIWebView 対象コマンド\r\n\t\tFORM_WEB_SET_URI,\r\n\t\tFORM_WEB_GET_URI,\r\n\r\n\t\t// CKLBLabelNode 対象コマンド\r\n\t\tFORM_LBL_SET_TEXT,\t\t// ラベルのテキスト変更\r\n\t\tFORM_LBL_GET_TEXT,\t\t// ラベルのテキスト取得\r\n\t};\r\n\r\n\tCKLBFormIF(CKLBTask * pOwner = 0);\r\n\tvirtual ~CKLBFormIF();\r\n\r\n\tbool isExistNode        (CKLBNode * pParent, const char * name);\r\n\tint  updateNode         (CLuaState& lua, int argc, int base, CKLBNode * pParent, int nodeIndex, int subcmd, void * item = NULL, int index = 0);\r\n\tvoid removeAssetByHandle(void * item);\r\nprivate:\r\n\tbool updateStandardNode (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUIElement    (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUISelectable (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUIContainer  (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUITextEdit   (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUIWebView    (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateLabelNode    (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\nprivate:\r\n\tCKLBAsset * updateAsset (CLuaState& lua, CKLBUIElement * pElement, const char * name, CKLBUIElement::ASSET_TYPE mode, void * item);\r\n\r\n\tbool nodeRecursive      (CLuaState& lua, const char * funcname, CKLBNode * pNode, int index = 0, int level = 0);\r\n\r\n\t// SET_ASSET コマンドによって差し替えた asset は、\r\n\t// refCount を管理するため、独自にハンドルを保持する必要がある。\r\n\tstruct FORM_ASSET {\r\n\t\tFORM_ASSET\t\t\t\t*\tprev;\r\n\t\tFORM_ASSET\t\t\t\t*\tnext;\r\n\r\n\t\tvoid\t\t\t\t\t*\titem;\t// そのassetを設定したアイテム(Listの場合)\r\n\t\tCKLBUIElement\t\t\t*\tnode;\t// 対象ノード\r\n\t\tCKLBAsset\t\t\t\t*\tasset;\t// 現在の保持asset\r\n\t\tu32\t\t\t\t\t\t\thandle;\t// 上記 asset の保持 handle\r\n\t\tCKLBUIElement::ASSET_TYPE\tmode;\t// 指定モード\r\n\t};\r\n\r\n\tFORM_ASSET\t\t*\tm_begin;\r\n\tFORM_ASSET\t\t*\tm_end;\r\n\r\n\tCKLBTask\t\t*\tm_pOwner;\r\n};\r\n\r\n#endif // CKLBFormIF_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBGameApplication.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBClientBase.h\r\n//  GameEngine\r\n//\r\n#ifndef CKLBGameApplication_h\r\n#define CKLBGameApplication_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBAssetManager;\r\n\r\nclass CKLBGameApplication : public IClientRequest\r\n{\r\npublic:\r\n    CKLBGameApplication();\r\n    virtual ~CKLBGameApplication();\r\n\r\n\tvoid setInitParam\t(u32 param, void* complexSetup);\r\n\tbool initGame\t\t();\r\n\tvoid finishGame\t\t();\r\n    \r\n\tbool setScreenInfo\t(bool rotate, int width, int height);\r\n\tbool setFilePath\t(const char * strPath);\r\n    \r\n\tvirtual \r\n\tbool executeCommand\t(const char* command);\r\n\tvoid reboot\t\t\t();\r\n\r\n    void resetViewport\t();\r\n\r\n\tvirtual FILE* getShellOutput();\r\n\tvirtual void  setShellOutput(FILE* stream);\r\n\r\nprotected:\r\n\tstruct AllocationSize {\r\n\t\t/* Maximum number of single unique node inside dictionnary*/\r\n\t\tu32\t\tdictionnaryNodePoolSize;\r\n\t\t/* Maximum number of handler associated with ressources*/\r\n\t\tu32\t\thandlerPoolSize;\r\n\t\t/* Maximum number of ui parts for all loaded form assets */\r\n\t\tu32\t\tformTemplateNodeCount;\r\n\t\t/* Maximum number of real asset (texture, form, audio sound) loaded at the same time*/\r\n\t\tu32\t\tmaxAssetCount;\r\n\t};\r\n\t\r\n\tvirtual void pauseGame\t\t\t\t(bool pause);\r\n\r\n\tvirtual void setupAllocation\t\t(AllocationSize* pStruct);\r\n\tvirtual int  getPhysicalScreenWidth\t();\r\n\tvirtual int  getPhysicalScreenHeight();\r\n\r\n    // デフォルトでは標準のシステムタスクを起動する。\r\n    virtual bool callInitialTasks(int width, int height);\r\n\r\n\t// その他初期化処理\r\n\tvirtual bool initOther();\r\n\r\n    // デフォルトでは全方向許可\r\n    virtual bool reportScreenRotation(ORIGIN origin, SCRMODE mode);        \r\n    // デフォルトでは縦横いずれでも全画面使用\r\n    virtual void changeScreenMatrix(ORIGIN origin, int width, int height);\r\n    \r\n    \r\n    \r\n    // ポインティングデバイスによる入力(物理座標)\r\n    virtual void inputPoint(int id, IClientRequest::INPUT_TYPE type, int x, int y);\r\n    \r\n    virtual void inputDeviceKey(int keyId, char eventType);\r\n\r\n    // その他OSコントロールによるイベント通知\r\n    virtual void controlEvent(EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\t\t\t\t\t\tsize_t datasize1, void * pData1,\r\n\t\t\t\t\t\t\t\tsize_t datasize2, void * pData2);\r\n    \r\n    // デフォルトでは常に論理的左上を原点とする\r\n    virtual void changePointingMatrix(ORIGIN origin, int width, int height);\r\n    \r\n    \r\n    bool\tframeFlip\t\t\t(u32 deltaT);\r\n\ts32\t\tgetFrameTime\t\t();\r\n\tvoid\tsetFrameTime\t\t(s32 time);\r\n    void\tchangeScreenInfo\t(ORIGIN origin, int width, int height);\r\n    bool\tinitSystem\t\t\t(AllocationSize* pSizes);\r\n    virtual \r\n\tbool\tinitLocalSystem\t\t(CKLBAssetManager& mgrAsset);\r\n\tvirtual \r\n\tvoid\tlocalFinish\t\t\t();\r\n    \r\n\tint\t\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\t\tm_frameTime;\r\n    IClientRequest::ORIGIN  m_origin;\r\n\tbool\t\t\t\t\tm_useDefaultDB;\r\n\tbool\t\t\t\t\tm_useDefaultFont;\r\n    bool                    m_updateRotation;\r\n\tbool\t\t\t\t\tm_reboot;\r\n\tconst char\t\t\t*\tm_bootFile;\r\n\tFILE*\t\t\t\t\tm_outStream;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBGenericTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CGenericTask.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CKLBGenericTask_h\r\n#define CKLBGenericTask_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBGenericTask\r\n* \\brief Generic Task Class\r\n* \r\n* CKLBGenericTask is the most generic class of the Engine that can be used\r\n* for scripting purpose.\r\n* It is just made to execute some script code every frame.\r\n*/\r\nclass CKLBGenericTask : public CKLBLuaPropTask\r\n{\r\nprivate:\r\n\tbool init(CKLBTask* pTask, CKLBTask::TASK_PHASE phase, const char * name_exec, const char * name_die, const char * arr_index);\r\npublic:\r\n\tstatic CKLBGenericTask* create(CKLBTask* pParentTask, CKLBTask::TASK_PHASE phase, const char * name_exec, const char * name_die, const char * arr_index);\r\n    CKLBGenericTask();\r\n    virtual ~CKLBGenericTask();\r\n\r\n    bool\tinitScript\t\t(CLuaState& lua);\r\n    int\t\tcommandScript\t(CLuaState& lua);\r\n\r\n    void\texecute\t\t\t(u32 deltaT);\r\n    void\tdie\t\t\t\t();\r\n\r\n\tu32\t\tgetClassID\t\t();\r\nprivate:\r\n\r\n    const char  *   m_luaFuncExec;\r\n    const char  *   m_luaFuncDie;\r\n    const char  *   m_ArrayIndex;\r\n};\r\n\r\n#endif // CKLBGenericTask_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBHTTPInterface.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBHTTPInterface_h\r\n#define CKLBHTTPInterface_h\r\n\r\n#include \"CPFInterface.h\"\r\n#include <string.h>\r\n\r\n#define USER_AGENT \"UserAgent\"\r\n\r\n// SocketStream を利用して、HTTP/1.1 による通信を行う。\r\n// オンメモリ読み込みのほか、ダウンロード読み込み対応。\r\n\r\n#define USE_NEW_CURL_WRAPPER\r\n\r\n#ifdef USE_NEW_CURL_WRAPPER\r\nclass ConnectionEntry;\r\n\r\n/*!\r\n* \\class CKLBHTTPInterface\r\n* \\brief HTTP Interface Class\r\n* \r\n* \r\n*/\r\nclass CKLBHTTPInterface\r\n{\r\n\tfriend class ConnectionEntry;\r\nprivate:\r\n\tCKLBHTTPInterface();\r\n\tvirtual ~CKLBHTTPInterface();\r\npublic:\r\n\tvoid reuse();\r\n\r\n\t// 追加HTTPヘッダの指定\r\n\tbool setHeader(const char ** headers);\r\n\r\n\t// 指定フォーム値のURLencode\r\n\tchar * setForm(const char ** postForm);\r\n\r\n\t// GET発行\r\n\tbool httpGET(const char * url, bool isProxy);\r\n\r\n\t// POST発行\r\n\tbool httpPOST(const char * url, bool isProxy);\r\n\r\n\t// ダウンロード保存パス名を指定し、ダウンロードモードでの動作を開始する。\r\n\t// NULL指定で通常のオンメモリモードでの動作に戻る\r\n\tbool setDownload(const char * path);\r\n\r\n\t// 受信ステータス\r\n\tbool httpRECV();\r\n\r\n\t// 現在の受信サイズ\r\n\ts64 getSize();\r\n\tinline s64 getDwnldSize()\t{ return m_receivedSize; }\r\n\r\n\t// 受信リソースの取得\r\n\tu8 * getRecvResource();\r\n\r\n    // httpのstate取得 2013.2.13  追加\r\n\tint getHttpState();\r\n\r\n\tbool isMaintenance()\t\t\t\t\t\t\t\t\t\t{ return this->m_maintenance; }\r\n\tbool hasHeader(const char* header, const char** value);\r\nprivate:\r\n\tvoid clear();\r\n\tvoid init ();\r\n\r\n\tstatic s32\tHTTPConnectionThread(void * hThread, void * data);\r\n\tstatic int\tprogress_func\t\t(void* ctx, double t, double d, double ultotal, double ulnow);\r\n\tstatic size_t write_func\t\t(char *ptr, size_t size, size_t nmemb, void *userdata); \r\n\tstatic size_t headerReceive_func(void *ptr, size_t size, size_t nmemb, void *userdata);\r\n\r\n\tvoid\t\tprogress(u64 total, u64 download);\r\n\tsize_t\t\twrite\t(char *ptr, size_t size, size_t nmemb);\r\n\tvoid\t\tdownload();\r\n\r\n\t// HTTP Error Code\r\n\tint\t\t\tm_errorCode;\r\n\tint\t\t\tm_tmpErrorCode;\r\n\tbool\t\tm_bDataComplete;\r\n\tbool\t\tm_bDownload;\r\n\tbool\t\tm_bothFileAndMem;\r\n\tbool\t\tm_post;\r\n\tbool\t\tm_maintenance;\r\n\tconst char*\tm_url;\r\n\tvoid*\t\tm_pCurl;\r\n\tconst char*\tm_pServerVersion;\r\n\r\n\tITmpFile*\tm_pTmpFile;\r\n\ts64\t\t\tm_receivedSize;\r\n\ts64\t\t\tm_writeIndex;\r\n\tu8*\t\t\tm_receivedData;\r\n\tu8*\t\t\tm_buffer;\r\n\tvoid*\t\tm_thread;\r\npublic:\r\n\tvolatile u32 m_threadStop;\r\nprivate:\r\n\tbool\t\tm_stopThread;\r\n\r\n\t// 追加HTTPヘッダ\r\n\tconst char*\tm_headers;\r\n\tconst char** m_headerEntry;\r\n\tconst char** m_postForm;\r\n\tu32*\t\tm_headerEntryLen;\r\n\tu32\t\t\tm_hdrlen;\r\n\tu32\t\t\tm_headerEntryCount;\r\npublic:\r\n\tstatic\t\tbool initHTTPLib();\r\n\tstatic\t\tvoid releaseHTTPLib();\r\n};\r\n\r\n#else\r\n\r\nclass CKLBHTTPInterface\r\n{\r\npublic:\r\n\tCKLBHTTPInterface();\r\n\tvirtual ~CKLBHTTPInterface();\r\n\r\n\t// 追加HTTPヘッダの指定\r\n\tbool setHeader(const char ** headers);\r\n\r\n\t// 指定フォーム値のURLencode\r\n\tchar * URLencode(char * retbuf, int maxlen, const char ** postForm);\r\n\r\n\t// GET発行\r\n\tinline bool httpGET(const char * url, bool isProxy) {\r\n\t\treturn httpMethod(\"GET\", \"\", url, isProxy, 0);\r\n\t}\r\n\r\n\t// POST発行\r\n\tinline bool httpPOST(const char * url, bool isProxy, const char * encodedForm) {\r\n\t\tchar buf[1024];\r\n\t\tint postLen = strlen(encodedForm);\r\n\t\tsprintf(buf,\r\n                \"Content-type: application/x-www-form-urlencoded; charset=UTF-8\\r\\n\"\r\n                \"Content-Length: %d\\r\\n\", postLen);\r\n\t\treturn httpMethod(\"POST\", buf, url, isProxy, encodedForm);\r\n\t}\r\n\r\n\t// ダウンロード保存パス名を指定し、ダウンロードモードでの動作を開始する。\r\n\t// NULL指定で通常のオンメモリモードでの動作に戻る\r\n\tbool setDownload(const char * path);\r\n\r\n\t// 受信ステータス\r\n\tbool httpRECV();\r\n\r\n\t// 現在の受信サイズ\r\n\tinline s64 getSize\t\t()\t{ return m_rdSize;\t\t}\r\n\tinline s64 getDwnldSize\t()\t{ return m_recv_size;\t}\r\n\t// 受信リソースの取得\r\n\tinline u8 * getRecvResource() {\r\n\t\tif(!m_b_finished) return 0;\t// まだ受信が終わっていない場合\r\n\t\treturn m_http_recv;\r\n\t}\r\n\r\n    // httpのstate取得 2013.2.13  追加\r\n    inline int getHttpState\t()\t{ return m_http_state; }\r\n\r\nprivate:\r\n\t// 受信情報のクリア\r\n\tinline void crearRecvResource() {\r\n\t\tKLBDELETEA(m_http_recv);\r\n\t\tm_buf_size = 0;\r\n\t\tm_recv_size = 0;\r\n\t\tm_b_finished = false;\r\n\t}\r\n    \r\n    // connect thread用\r\n    inline void\t\t\tsetSocket\t\t(IReadStream* _pSpcket) { m_pSocket = _pSpcket; }\r\n    inline const char*\tgetConnectName\t(void)\t\t{ return m_pConnectName;\t\t}\r\n\t// JOINTでのbodySize計算用に\r\n\tinline void\t\t\tSetBodySize\t\t(int _set)\t{ m_test_body_length = _set;\t}\r\n\tinline void\t\t\tAddBodySize\t\t(int _add)\t{ m_test_body_length += _add;\t}\r\n\tinline int\t\t\tGetBodySize\t\t(void)\t\t{ return m_test_body_length;\t}\r\n\r\n\tbool httpMethod(const char * method, const char * method_hdr, \r\n\t\t\t\t\tconst char * url, bool isProxy, const char * body);\r\n\tbool httpMethod_AfterConnect(void); // 上記関数内の処理をconnect終了後の処理と分割\r\n\r\n\tbool url_parse(const char * url);\r\n\r\n\tbool cmp_header(char * ptr, const char * str, size_t len);\r\n\r\n\t// Transfer-Encoding: chunked か否かを判定\r\n\tbool get_format(char * buf, bool * chunked, u64 * length);\r\n\r\n\t// chunkサイズを取得。\r\n\tchar * get_chunk_size(char * buf, size_t len, size_t * chunk_size);\r\n\tint    find_crlf(const char * ptr, int len);\r\n\r\n\t// 送出中処理\r\n\tinline void sending() {\r\n\t\tm_pWRSock->writeBlock((void *)m_bufSend, m_sizeSend);\r\n\t}\r\n\r\n\r\n\tbool\t\t\t\tm_proxy;\r\n\tconst char\t\t*\tm_proxy_host;\r\n\tint\t\t\t\t\tm_proxy_port;\r\n\r\n\tconst char\t\t*\tm_url;\r\n\tconst char\t\t*\tm_host;\r\n\tconst char\t\t*\tm_path;\r\n\tint\t\t\t\t\tm_port;\r\n\r\n\t// 追加HTTPヘッダ\r\n\tconst char\t\t*\tm_headers;\r\n\tint\t\t\t\t\tm_hdrlen;\r\n\r\n\tIReadStream\t\t*\tm_pSocket;\r\n\tIWriteStream\t*\tm_pWRSock;\r\n\r\n\tconst char\t\t*\tm_bufSend;\r\n\tint\t\t\t\t\tm_sizeSend;\r\n\r\n\t// 取得したリソース(コマンド実行結果)\r\n\ts64\t\t\t\t\tm_rdSize;\r\n\tvoid\t\t\t*\tm_hThread;\r\n\tu8\t\t\t\t*\tm_http_recv;\r\n\tsize_t\t\t\t\tm_buf_size;\t\t// 確保ずみバッファのサイズ\r\n\tsize_t\t\t\t\tm_recv_size;\t// 受信済みサイズ\r\n\tsize_t\t\t\t\tm_total_size;\t// header + body のサイズ\r\n\tsize_t\t\t\t\tm_rightsize;\t// 現在の受信単位で読むべきサイズ\r\n\tint\t\t\t\t\tm_sThreadSig;\t// Thread を終了させる値\r\n\tbool\t\t\t\tm_chunked;\t\t// 送信形式が chunked であればtrueになる。\r\n\tbool\t\t\t\tm_b_finished;\t// 読み終わりフラグ\r\n\r\n\tbool\t\t\t\tm_bDownload;\t// ダウンロード読み込みモードフラグ\r\n\tITmpFile\t\t*\tm_pTmpFile;\t\t// ダウンロード先テンポラリ\r\n\r\n    size_t              m_read_size;    // readBrockで読み込んでいるサイズの残り\r\n    size_t              m_header_size;  // ヘッダーサイズ\r\n    u64                 m_notchunk_length;  // chunkで無い場合のデータサイズ\r\n    char*               m_pReadNow;     // 現在の見ている場所\r\n    bool                m_bChunkDebug;\r\n    int                 m_http_state;   // httpヘッダーのstate保存用 2013.2.13 追加\r\n    int                 m_test_body_length;\t// JOINTでのbodySize計算用に\r\n\r\n    // connect thread用\r\n    const char* m_pConnectName;\r\n    const char* m_pMethod;\r\n    const char* m_pMethod_header;\r\n    const char* m_pBody;\r\n    bool        m_bIsProxy;\r\n    \r\n    \r\n\tstruct CHUNK {\r\n\t\tCHUNK\t*\tprev;\r\n\t\tCHUNK\t*\tnext;\r\n\t\tsize_t\t\tsize;\r\n\t};\r\n\tCHUNK\t\t\t*\tm_begin;\r\n\tCHUNK\t\t\t*\tm_end;\r\n\r\n\tCHUNK * create_chunk(size_t size);\r\n\tvoid remove_chunk(CHUNK * pChunk);\r\n\tinline void remove_last_chunk() { remove_chunk(m_end); }\r\n\tvoid read_finish(void);\r\n\r\n\tu8\t\t\t\t\tm_tmpBuf[1025];\r\n\tsize_t\t\t\t\tm_tmpsize;\r\n\ttypedef enum {\r\n        E_CONNECT_WAITING,  // SocketのConnect待ち\r\n\t\tE_SENDING,\t// Request送出中\r\n\t\tE_STARTUP,\t// 開始\r\n\r\n\t\tE_RDHDR,\t// HTTPヘッダ読み込み中 →ヘッダのみの処理にする\r\n\r\n\t\tE_RD_BODY_NOT_CHUNKED,  // chunkでは無いデータの場合\r\n\t\tE_RD_BODY_CHUNKED,      // chunkデータの場合\r\n\r\n\r\n\t\t// 単品bodyの場合\r\n\t\tE_RDBODY,\t// リソース本体読み込み中\r\n\r\n\t\t// Transfer-Encoding: chunked の場合\r\n\t\tE_RDCHUNK,\t// チャンク読み込み中\r\n\t\tE_NEXTCHUNK,// 次のチャンク読み込み待ち\r\n\r\n\t\tE_END\t\t// 読み込み終了\r\n\t} STEP;\r\n\r\n\tSTEP\t\t\t\tm_eStep;\r\n\r\n\tenum {\r\n\t\tHEADER_BUF_SIZE\t\t\t=\t8192,\r\n\t\tBLOCK_SIZE\t\t\t\t=\t4096,\r\n\t\tMAX_BLOCK_IN_FRAME\t\t=\t8,\r\n\r\n\t\tALLOC_SIZE\t\t\t\t=\t1024,\r\n\r\n\t\tRETRY\t\t\t\t\t= 8,\r\n\t};\r\n\r\n\tstatic s32 ThreadSEND\t(void * hThread, void * data);\r\n\tstatic s32 ThreadHTTP\t(void * hThread, void * data);\r\n\tstatic s32 ThreadJOINT\t(void * hThread, void * data);\r\n\tstatic s32 ThreadCONNECT(void * hThread, void * data);\r\npublic:\r\n\tstatic bool initHTTPLib\t\t();\r\n\tstatic void releaseHTTPLib\t();\r\n};\r\n#endif // Selection CURL lib.\r\n\r\n#endif // CKLBHTTPInterface_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBIntervalTimer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBIntervalTimer_h\r\n#define CKLBIntervalTimer_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBIntervalTimer\r\n* \\brief Timer Task Class\r\n* \r\n* CKLBIntervalTimer is a basic timer class.\r\n* It makes a call to the callback function when the timer reached the defined time limit.\r\n* It can make this call just once and then die or be in a repeat mode and reset itself\r\n* every time it reaches the defined time limit.\r\n*/\r\nclass CKLBIntervalTimer : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBIntervalTimer>;\r\nprivate:\r\n\tCKLBIntervalTimer();\r\n\tvirtual ~CKLBIntervalTimer();\r\n\r\n\tbool init(CKLBTask* pTask, u32 timerID, u32 interval, bool repeat,const char* callback, u8 mode, bool killIfUpdate);\r\npublic:\r\n\tstatic CKLBIntervalTimer* create(CKLBTask* pParentTask, u32 timerID, u32 interval, bool repeat,const char* callback, u8 mode = 0, bool killIfUpdate = true);\r\n\r\n\tbool initScript(CLuaState& lua);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\n\tinline u32\tgetTimerID\t()\t\t\t\t{\treturn m_timerID;\t}\r\n\tinline void\tsetTimerID\t(u32 id)\t\t{\tm_timerID = id;\t\t}\r\n\r\n\tinline bool\tgetRepeat\t()\t\t\t\t{\treturn m_repeat;\t}\r\n\tinline void\tsetRepeat\t(bool value)\t{\r\n\t\tm_countup = 0;\r\n\t\tm_repeat = value;\t\r\n\t}\r\n\r\n\tinline u32\tgetInterval\t()\t\t\t\t{\treturn m_interval;\t}\r\n\tinline void\tsetInterval\t(u32 value)\t\t{\r\n\t\tm_countup = 0;\r\n\t\tm_interval = value;\r\n\t}\r\n\r\n\tinline u8\tgetMode\t\t()\t\t\t\t{\treturn m_mode;\t\t}\r\n\r\n\tu32\t\t\tgetClassID\t();\r\n\r\nprivate:\r\n\r\n\tconst char\t*\tm_callback;\r\n\r\n\tu32\t\t\t\tm_timerID;\r\n\tu32\t\t\t\tm_interval;\r\n\tu32\t\t\t\tm_countup;\r\n\tu8\t\t\t\tm_mode;\r\n\tbool\t\t\tm_repeat;\r\n\tbool\t\t\tm_killIfUpdate;\r\n\r\n\tstatic\tPROP_V2\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBIntervalTimer_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBJsonItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBJsonItem_h\r\n#define CKLBJsonItem_h\r\n\r\n#include <stdlib.h>\r\n#include \"BaseType.h\"\r\n\r\n/*!\r\n* \\class CKLBJsonItem\r\n* \\brief JSON Item Class\r\n* \r\n* \r\n*/\r\nclass CKLBJsonItem\r\n{\r\npublic:\r\n\tCKLBJsonItem(CKLBJsonItem * pParent);\r\n\tvirtual ~CKLBJsonItem();\r\n\r\n\t// キー取得\r\n\tinline const char * key() const { return m_key; }\r\n\r\n\tbool setKey(const char * keyname);\r\n\r\n\t// データ型種別\r\n\ttypedef enum {\r\n\t\tJ_NULL,\r\n\t\tJ_BOOLEAN,\r\n\t\tJ_INT,\r\n\t\tJ_DOUBLE,\r\n\t\tJ_STRING,\r\n\t\tJ_MAP,\t\t\t// { 〜 } mapにはkeyが無い場合がある。\r\n\t\tJ_ARRAY,\t\t// [ 〜 ] arrayにはkeyがある。\r\n\t} JSON_TYPE;\r\n\r\n\t// map と array は Json 的には異なるが、このデータでは同様に階層構造で扱う。\r\n\r\n\tinline const JSON_TYPE getType() const { return m_type; }\r\n\r\n\tstatic CKLBJsonItem * ReadJsonData(const char * json_string, u32 json_size = 0);\r\n\r\n\tinline CKLBJsonItem * next\t() { return m_next;\t\t\t}\r\n\tinline CKLBJsonItem * prev\t() { return m_prev;\t\t\t}\r\n\tinline CKLBJsonItem * child\t() { return m_child_begin;\t}\r\n\tinline CKLBJsonItem * parent() { return m_pParent;\t\t}\r\n\r\n\tinline bool getBool\t() const { return m_value.b;\t\t}\r\n\tinline int  getInt\t() const { return (int)getInt64();\t}\r\n\tinline s64  getInt64() const {\r\n\t\tif(m_type == J_INT) return m_value.i;\r\n\t\tif(m_type == J_DOUBLE) return (s64)m_value.d;\r\n\t\tif(m_type == J_STRING) {\r\n\t\t\ts64 val = 0;\r\n\t\t\tconst char * p = m_value.s;\r\n\t\t\ts64 sign = 1LL;\r\n\t\t\tif(*p == '-') {\r\n\t\t\t\tsign = -1LL;\r\n\t\t\t\tp++;\r\n\t\t\t}\r\n\t\t\twhile(int c = *p++) {\r\n\t\t\t\tval = val * 10LL + (s64)(c - '0');\r\n\t\t\t}\r\n\t\t\tval = val * sign;\r\n\t\t\treturn val;\r\n\t\t}\r\n\t\treturn 0LL;\r\n\t}\r\n\tinline double getDouble() const {\r\n\t\tif(m_type == J_DOUBLE) return m_value.d;\r\n\t\tif(m_type == J_INT) return (double)m_value.i;\r\n\t\tif(m_type == J_STRING) {\r\n\t\t\tdouble val;\r\n\t\t\tsscanf(m_value.s, \"%lf\", &val);\r\n\t\t\treturn val;\r\n\t\t}\r\n\t\treturn 0.0;\r\n\t}\r\n\tinline const char * getString() const { return m_value.s; }\r\n\r\n\tCKLBJsonItem * searchChild(const char * key);\r\n\r\nprivate:\r\n\tCKLBJsonItem\t*\tm_pParent;\t// 親アイテム\r\n\r\n\tCKLBJsonItem\t*\tm_child_begin;\t// 子アイテム\r\n\tCKLBJsonItem\t*\tm_child_end;\r\n\r\n\tCKLBJsonItem\t*\tm_prev;\t\t// 兄弟(前)\r\n\tCKLBJsonItem\t*\tm_next;\t\t// 兄弟(次)\r\n\r\n\tconst char\t\t*\tm_key;\t\t// キー(名前)\r\n\r\nprivate:\r\n\r\n\tunion VAR {\r\n\t\tbool\t\t\tb;\r\n\t\ts64\t\t\t\ti;\r\n\t\tdouble\t\t\td;\r\n\t\tconst char\t*\ts;\r\n\t} m_value;\r\n\r\n\tJSON_TYPE\t\tm_type;\r\n\r\n\ttypedef struct {\r\n\t\tCKLBJsonItem\t*\tpParent;\r\n\t\tCKLBJsonItem\t*\tpCurrent;\r\n\t\tCKLBJsonItem\t*\tpFirst;\r\n\t} JSON_State;\r\n\r\n\tstatic int read_null\t\t(void * ctx);\r\n\tstatic int read_boolean\t\t(void * ctx, int boolean);\r\n\tstatic int read_int\t\t\t(void * ctx, long long integerVal);\r\n\tstatic int read_double\t\t(void * ctx, double doubleVal);\r\n\tstatic int read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_start_map\t(void * ctx, unsigned int size);  \r\n\tstatic int read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_end_map\t\t(void * ctx);\r\n\tstatic int read_start_array\t(void * ctx, unsigned int size);\r\n\tstatic int read_end_array\t(void * ctx);\r\n};\r\n\r\n\r\n#endif // CKLBJsonItem_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLabelNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_LABELNODE__\r\n#define __CKLB_LABELNODE__\r\n\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n\r\n/*!\r\n* \\class CKLBLabelNode\r\n* \\brief Text Specialized Node Class\r\n* \r\n* CKLBLabelNode is a text specialized Node for Scene Graph.\r\n* It provides methods to modify the apparence of the text label.\r\n*/\r\nclass CKLBLabelNode : public CKLBUIElement {\r\npublic:\r\n\tCKLBLabelNode(int fontsize, const char * fontname = 0, const char * text = 0);\r\n\t~CKLBLabelNode();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBLABEL; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\t\t\r\n\tvoid\trecomputeCustom\t\t();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\t// virtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   ()  { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tlock\t\t\t(bool stop);\r\n\tvoid\t\tsetAlign\t\t(u32 align);\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n\r\n\tvoid\t\tsetTextColor\t(u32 color);\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n\tbool\t\tsetFont\t\t\t(int fontsize, const char * fontname);   \r\n\r\n\tvoid\t\tsetUseTextSize\t(bool autoSize);\r\n\tvoid\t\tsetPriority\t\t(u32 renderPriority);\r\n\r\n\tvoid\t\tforceRefresh\t()  { m_pLabel->forceRefresh(); }\r\n\r\n\tstatic bool setDefaultFont  (const char * fontname = 0);\r\n\tstatic void release         ();\r\n\r\nprotected:\r\n\t// virtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\t// virtual void\taddRender\t\t\t();\r\n\t// virtual void\tremoveRender\t\t();\r\n\r\n\tconst char * m_fontname;\r\n\tint          m_fontsize;\r\n\tCKLBNodeVirtualDocument\t*\tm_pLabel;\r\n\r\n\tu32\t\tm_width;\r\n\tu32\t\tm_height;\r\n\r\n\tu32\t\tm_color;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n\r\n\tu32\t\tm_align;\r\n\tfloat\tm_tx;\r\n\tfloat\tm_ty;\r\n\tfloat\tm_alignX;\r\n\tfloat\tm_alignY;\r\n\tu8\t\tm_format;\r\n\tbool\tm_lock;\r\n\tbool\tm_changed;\r\n\tbool\tm_useTextSize;\r\n\r\nprivate:\r\n\r\n\tvoid updateLabel();\r\n\r\n\tstatic const char * ms_default_font;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLanguageDatabase.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLBLanguageDatabase_h__\r\n#define __CKLBLanguageDatabase_h__\r\n\r\n#include \"Dictionnary.h\"\r\n#include \"sqlite3.h\"\r\n\r\nclass CKLBLanguageDatabase {\r\npublic:\r\n\tstatic CKLBLanguageDatabase& getInstance() {\r\n\t\tstatic CKLBLanguageDatabase instance;\r\n\t\treturn instance;\r\n\t}\r\n\t\r\n\tstatic void release() {\tgetInstance()._release();\t}\r\n\t\r\n\tbool\tinit\t\t\t();\r\n\tbool\taddString\t\t(const char* id, const char* string);\r\n\tvoid\tremoveString\t(const char* id);\r\n\tconst char*\tgetString\t(const char* id);\r\n\r\n\tbool\tsetupDB\t\t\t(const char* dbFile,\r\n\t\t\t\t\t\t\t const char* tableName, \r\n\t\t\t\t\t\t\t const char* keyField, \r\n\t\t\t\t\t\t\t const char* valueField,\r\n\t\t\t\t\t\t\t const char* groupField\r\n\t\t\t\t\t\t\t );\r\n\r\n\tbool\tpreLoadGroup\t(const char* groupID);\r\n\r\nprivate:\r\n\t/* C like callback with object context for SQLite */\r\n\tstatic\r\n\tint\t\t\tcallbackFct\t\t\t(void* ctx,int colNum,char** columnText,char** columnName);\r\n\r\n\t/* Callback to object */\r\n\tint\t\t\tcallBack\t\t\t(int /*colNum*/,char** columnText,char** /*columnName*/);\r\n\r\n\tconst char*\tloadStringFromDB\t(const char* id);\r\n\tbool\t\trunStatement\t\t(const char* SQLStatement);\r\n\r\n\tsqlite3*\t\tm_db;\r\n\tconst char*\t\tm_tableName;\r\n\tconst char*\t\tm_fieldValue;\r\n\tconst char*\t\tm_fieldGroup;\r\n\tconst char*\t\tm_fieldKey;\r\n\tDictionnary*\tm_dictionnary;\r\n\t\r\n\tCKLBLanguageDatabase ();\r\n\t~CKLBLanguageDatabase();\r\n\tvoid _release();\r\n\t\r\n\tstatic void callbackDictionnary(const void* this_, const void* ptrToDelete);\r\n};\r\n\r\n#endif // \r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLibRegistrator.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLibRegistrator_h\r\n#define CKLBLibRegistrator_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n#define\t\tMAX_ELEM\t(10)\r\n\r\nclass CKLBLibRegistrator\r\n{\r\npublic:\r\n\tstruct LIBREGISTSTRUCT {\r\n\t\tconst char* name;\r\n\t\tu32 classID;\r\n\t\tLIBREGISTSTRUCT* next;\r\n\t};\r\n\r\n\tstatic \r\n\tCKLBLibRegistrator*\t\tgetInstance\t\t();\r\n\tLIBREGISTSTRUCT*\t\tadd\t\t\t\t(const char* name, u32 classID);\r\n\tu32\t\t\t\t\t\tgetClassID\t\t(const char* funcName);\r\n\r\nprivate:\r\n\tint\t\t\t\t\t\t\tm_count;\r\n\tLIBREGISTSTRUCT\t\t\t\tm_list[MAX_ELEM];\r\n\r\n\tCKLBLibRegistrator ();\r\n\t~CKLBLibRegistrator();\r\n};\r\n\r\n#endif"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLifeCtrlTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLifeCtrlTask_h\r\n#define CKLBLifeCtrlTask_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n\r\n/*!\r\n* \\class CKLBLifeCtrlTask\r\n* \\brief Life Control Task\r\n* \r\n* CKLBLifeCtrlTask is a Task made for controlling the life of another Task\r\n* of the Engine. \r\n* CKLBLifeCtrlTask has 2 mods : TIME and FRAME.\r\n* A Task can be linked with an instance of CKLBLifeCtrlTask. In that case, the \r\n* CKLBLifeCtrlTask will kill the Task after X milliseconds or frames.\r\n*/\r\nclass CKLBLifeCtrlTask : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBLifeCtrlTask>;\r\nprivate:\r\n\tCKLBLifeCtrlTask();\r\n\tvirtual ~CKLBLifeCtrlTask();\r\n\r\n\tbool init(CKLBTask* pTask, u32 mode, u32 limit);\r\npublic:\r\n\tstatic CKLBLifeCtrlTask* create(CKLBTask* pParentTask, u32 mode, u32 limit);\r\n\r\n\tbool\tinitScript\t\t(CLuaState& lua);\r\n\tint\t\tcommandScript\t(CLuaState& lua);\r\n\r\n\tinline void setTime(u32 mode, u32 unit) {\r\n\t\tm_count = 0;\r\n\t\tm_limit\t= unit;\r\n\t\tm_mode\t= mode;\r\n\t}\r\n\r\n\tinline void link(CKLBTask* taskToKill) {\r\n\t\tm_bLinked\t= (taskToKill != NULL);\r\n\t\tm_taskLink  =  taskToKill;\r\n\t}\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\nprivate:\r\n\tbool\t\t\tm_bLinked;\r\n\tCKLBTask*\t\tm_taskLink;\r\n\tint\t\t\t\tm_mode;\r\n\tu32\t\t\t\tm_limit;\r\n\tu32\t\t\t\tm_count;\r\n};\r\n\t\r\n\r\n#endif // CKLBIntervalTask_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaConst.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaConst_h\r\n#define CKLBLuaConst_h\r\n\r\n#include \"CLuaState.h\"\r\n\r\nclass CKLBLuaConst\r\n{\r\npublic:\r\n\tstruct ITEM {\r\n\t\tconst char * name;\r\n\t\tint value;\r\n\t};\r\n\tstatic void removeLuaConst(CLuaState& lua, const char * grpName);\r\n\r\n\tstatic int setLuaConst(CLuaState& lua, const char * grpName, int num, ITEM * items);\r\n\r\n\tstatic int setLuaConstBy2Lists(CLuaState& lua, const char * grpName,\r\n\t\t\t\t\t\t\t\t\tint nums, const char ** nameList, int * valueList);\r\n\tstatic int setLuaConstBy2Lists(CLuaState& lua, const char * grpName,\r\n\t\t\t\t\t\t\t\t\tint nums, const char ** nameList);\r\n};\r\n/*\r\n　【使用例】\r\n\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tCKLBLuaConst::ITEM list[] = {\r\n\t\t{ \"str\", 1 },\r\n\t\t{ \"int\", 20 },\r\n\t\t{ \"dex\", 300 }\r\n\t};\r\n\tCKLBLuaConst::setLuaConst(lua, \"PARAM\", 3, items);\r\n\r\n\t上記のコードで、Lua側に\r\n\r\n\tPARAM.str = 1\r\n\tPARAM.int = 20\r\n\tPARAM.dex = 300\r\n\r\n\tの定数が定義されます。あるいは、\r\n\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tconst char * nameList[] = { \"str\", \"int\", \"dex\" };\r\n\tint valueList[] = { 1, 20, 300 };\r\n\tCKLBLuaConst::setLuaConstBy2Lists(lua, \"PARAM\", 3, nameList, valueList);\r\n\r\n\tでも同様です。\r\n*/\r\n#endif // CKLBLuaConst_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaDB.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaDB_h\r\n#define CKLBLuaDB_h\r\n#include \"sqlite3.h\"\r\n//#include \"sqlite3ext.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBLuaDB : public CKLBObjectScriptable\r\n{\r\npublic:\r\n\tCKLBLuaDB();\r\n\tCKLBLuaDB(const char * db_asset, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);\r\n\tvirtual ~CKLBLuaDB();\r\n\r\n\tu32 getClassID();\r\n\r\n\tinline bool state() {\r\n\t\treturn (m_db) ? true : false;\r\n\t}\r\n\r\n\tbool setName(const char * name);\r\n\r\n\t// DBファイルのオープン: 現在オープンしているDBがあれば、一旦クローズして再オープン\r\n\tbool open(const char * db_asset, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);\r\n\r\n\t// DBファイルのクローズ\r\n\tbool close();\r\n\r\n\t// SQLの実行。selectionがある場合、その内容をLuaテーブルとしてスタックに積む\r\n\tint query(CLuaState * lua, const char * sql);\r\n\tconst char** query(const char* query); // lua-free.\r\n\r\n\t// 現在生成されているCKLBLuaDB全てをクローズする\r\n\tstatic void closeAll();\r\n\r\n\t// 現在生成されているCKLBLuaDB全てをダンプする\r\n\tstatic bool dumpAll();\r\n\r\nprivate:\r\n\tvoid add_link();\r\n\tvoid remove_link();\r\n\r\n\tconst char\t\t*\tm_name;\r\n\tbool\t\t\t\tm_pragmaJournal;\r\n\r\n\tsqlite3\t\t\t*\tm_db;\r\n\tCLuaState\t\t*\tm_pLua;\r\n\tint\t\t\t\t\tm_idx;\r\n\r\n\tCKLBLuaDB\t\t*\tm_prev;\r\n\tCKLBLuaDB\t\t*\tm_next;\r\n\r\n\tstatic int row_callback\t\t\t(void* ctx,int colNum,char** columnText,char** columnName);\r\n\tstatic int row_callback_luaFree\t(void* ctx,int colNum,char** columnText,char** columnName);\r\n\r\n\tstatic\tCKLBLuaDB\t*\tms_begin;\r\n\tstatic\tCKLBLuaDB\t*\tms_end;\r\n};\r\n\r\n\r\n#endif // CKLBLuaDB_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaEnv.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaEnv.h\r\n//\r\n\r\n#ifndef CKLBLuaEnv_h\r\n#define CKLBLuaEnv_h\r\n\r\n#include \"lua.hpp\"\r\n#include \"CLuaState.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n\r\nclass CKLBLuaEnv\r\n{\r\nprivate:\r\n    CKLBLuaEnv();\r\n    ~CKLBLuaEnv();\r\n    \r\npublic:\r\n    static CKLBLuaEnv& getInstance();\r\n    \r\n    bool setupLuaEnv\t\t();\r\n    void finishLuaEnv\t\t();\r\n\r\n\t// 定数定義を動作中に行う\r\n\tbool defineInt\t\t\t(const char * defName, int value);\r\n\tbool defineNum\t\t\t(const char * defName, float value);\r\n\tbool defineString\t\t(const char * defName, const char * string);\r\n\r\n    bool loadScript\t\t\t(const char * scriptName);\r\n    void execScript\t\t\t(int deltaT);\r\n\r\n\tbool sysLoad\t\t\t(const char * script_name);\r\n\tbool intoMaintenance\t();\r\n\tbool exitMaintenance\t();\r\n\r\n    void errMsg\t\t\t\t(const char * str);\r\n    \r\n    static int load\t\t\t(lua_State * L);\r\n    static int isLoading\t(lua_State * L);\r\n    static int command\t\t(lua_State * L);\r\n    static int logging\t\t(lua_State * L);\r\n    static int exitGame\t\t(lua_State * L);\r\n\tstatic int includefile\t(lua_State * L);\r\n    static int systemInfo\t(lua_State * L);\r\n\tstatic int reboot\t\t(lua_State * L);\r\n\tstatic int setGCRatio\t(lua_State * L);\r\n\r\n\t// Script additional operator functions.\r\n    static int bitOR\t\t(lua_State * L);\r\n    static int bitAND\t\t(lua_State * L);\r\n\r\n    inline const char * nowFile\t() const { return m_nowFile; }\r\n\r\n\tinline CLuaState&\tgetState() const { return *m_state; }\r\n\r\n\tstatic void cmdLogging\t\t(const char* msg);\r\n\tstatic void cmdExit\t\t\t();\r\n\tstatic void cmdSystemInfo\t(int* width, int* height);\r\n\r\nprivate:\r\n\tstatic IReadStream * openScript(const char * scriptUrl);\r\n\r\n\tu32\t\t\t\tm_lowGC;\r\n\tu32\t\t\t\tm_highGC;\r\n\tu32\t\t\t\tm_collect;\r\n\r\n    lua_State   *   m_L;\r\n\tCLuaState\t*\tm_state;\r\n    const char  *   m_nowFile;\r\n\r\n\tbool\t\t\tm_leave;\r\n\tbool\t\t\tm_sysLoadEnable;\r\n    \r\n    bool            m_bLoadScript;\r\n    const char  *   m_nextLoadScript;\r\n\tint\t\t\t\tm_loadReserveFrame;\r\n\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibAPP.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibAPP_h\r\n#define CKLBLuaLibAPP_h\r\n\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibAPP : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibAPP();\r\npublic:\r\n\tCKLBLuaLibAPP(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibAPP();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int luaCallApplication\t(lua_State * L);\r\n\tstatic int luaGetPhysicalMem\t(lua_State * L);\r\npublic: // Lua-free\r\n\tstatic bool callApplication(IPlatformRequest::APP_TYPE type, const char* addr, const char* subject, const char* body);\r\n};\r\n\r\n\r\n\r\n#endif // CKLBLuaLibAPP_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibASSET.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibASSET_h\r\n#define CKLBLuaLibASSET_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibASSET : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibASSET();\r\npublic:\r\n\tCKLBLuaLibASSET(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibASSET();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic void cmdGetImageSize\t(const char* asset_name, s32* pReturnWidth, s32* pReturnHeight);\r\n\tstatic void cmdGetBoundSize\t(const char* asset_name, float* pReturnWidth, float* pReturnHeight);\r\n\tstatic void cmdGetAssetInfo\t(const char* asset_name, s32* pReturnImgWidth, s32* pReturnImgHeight, float* pReturnBoundWidth, float* pReturnBoundHeight);\r\nprivate:\r\n\tstatic s32\tluaGetImageSize\t\t(lua_State * L);\r\n\tstatic s32\tluaGetBoundSize\t\t(lua_State * L);\r\n\tstatic s32\tluaGetAssetInfo\t\t(lua_State * L);\r\n\tstatic s32\tluaDelExternal\t\t(lua_State * L);\r\n\tstatic s32\tluaGetExternalFree\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibASSET_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibBIN.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibBIN_h\r\n#define CKLBLuaLibBIN_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBBinArray.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibBIN : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibBIN();\r\n\r\n\tstatic int bin_open\t\t(lua_State * L);\r\n\tstatic int bin_close\t(lua_State * L);\r\n\tstatic int bin_peek\t\t(lua_State * L);\r\n    static int bin_peek_u16\t(lua_State * L);\r\n    static int bin_peek_u32\t(lua_State * L);\r\n\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibBIN(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibBIN();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n\tvoid destroyResources\t();\r\n\tbool dumpObjects\t\t(IPlatformRequest& pForm);\r\n\r\n\t// -- lua free\r\n\tstatic CKLBBinArray* bin_open(const char* bin_asset);\r\n\tstatic void bin_close\t(CKLBBinArray* pBIN);\r\n\tstatic bool bin_peek\t(CKLBBinArray* pBIN, int offset, s32* out_value);\r\n\tstatic bool bin_peek_u16(CKLBBinArray* pBIN, int offset, u32* out_value, bool f_bigendian);\r\n\tstatic bool bin_peek_u32(CKLBBinArray* pBIN, int offset, u32* out_value, bool f_bigendian);\r\n};\r\n\r\n#endif // CKLBLuaLibBIN_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibCONV.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibCONV_h\r\n#define CKLBLuaLibCONV_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibCONV : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibCONV();\r\npublic:\r\n\tCKLBLuaLibCONV(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibCONV();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int lua2json\t\t(lua_State * L);\r\n\tstatic int json2lua\t\t(lua_State * L);\r\n\tstatic int jsonfile2lua\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibCONV_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibDATA.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibDATA_h\r\n#define CKLBLuaLibDATA_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBDataSet;\r\n\r\nclass CKLBLuaLibDATA : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibDATA();\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibDATA(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibDATA();\r\n\r\n\tvoid addLibrary();\r\n\tvoid destroyResources();\r\n\r\n\tstatic CKLBDataSet* cmdCreateData\t(u32 dataSetID);\r\n\tstatic bool\t\t\tcmdRegistData\t(CKLBDataSet * pDataSet, const char* name_asset, const char* name_data, u32* pReturnHandle);\r\n\tinline static void\tcmdDelete\t\t(CKLBDataSet * pDataSet) {\r\n\t\tif(pDataSet) {\r\n\t\t\tCKLBDataHandler::destroySet(pDataSet);\r\n\t\t}\r\n\t}\r\n\r\nprivate:\r\n\tstatic int createData\t(lua_State * L);\r\n\tstatic int registData\t(lua_State * L);\r\n\tstatic int registTable\t(lua_State * L);\r\n\tstatic int deleteData\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibDATA_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibDB.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibDB_h\r\n#define CKLBLuaLibDB_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLuaDB.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibDB : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibDB();\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibDB\t\t\t(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibDB\t();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n\tvoid destroyResources\t();\r\n\tbool dumpObjects\t\t(IPlatformRequest& pForm);\r\n\r\n\t// lua-free\r\n\tstatic CKLBLuaDB*\tdbopen\t(const char* db_asset, bool b_write, bool b_create);\r\n\tstatic void\t\t\tdbclose\t(CKLBLuaDB* pDB);\r\nprivate:\r\n\r\n\tstatic int dbopen\t\t(lua_State * L);\r\n\tstatic int dbclose\t\t(lua_State * L);\r\n\tstatic int dbcloseAll\t(lua_State * L);\r\n\tstatic int dbquery\t\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibDB_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibDEBUG.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibDEBUG_h\r\n#define CKLBLuaLibDEBUG_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBDebugMenu.h\"\r\n\r\nclass CKLBLuaLibDEBUG : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibDEBUG();\r\npublic:\r\n\tCKLBLuaLibDEBUG(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibDEBUG();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic DBG_MENU*\ts_arrMenu;\r\n\tstatic u32\t\t\ts_maxCount;\r\n\tstatic u32\t\t\ts_idx;\r\n\tstatic const char*  s_caption;\r\n\tstatic const char*  s_key;\r\n\r\n\tstatic void startMenu\t(u32 maxCount, const char * caption, const char * key);\r\n\tstatic void addItem\t\t(u32 mode, const char* caption, const char* key, s32 min, s32 max, s32 value, const char** items, u32 itemsCount);\r\n\tstatic void endMenu\t\t();\r\n\tstatic void removeMenu\t(const char * key);\r\nprivate:\r\n\tstatic int luaDBGSetCallback\t(lua_State * L);\r\n\tstatic int luaDBGSetMenu\t\t(lua_State * L);\r\n\tstatic int luaDBGRemoveMenu\t\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibDEBUG_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibENG.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibENG_h\r\n#define CKLBLuaLibENG_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBTask.h\"\r\n\r\nclass CKLBLuaLibENG : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibENG();\r\npublic:\r\n\tCKLBLuaLibENG(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibENG();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic bool\t\t\tisRelease\t\t();\r\n\tstatic const char*\tgetPlatform\t\t();\r\n\tstatic void\t\t\tgetNanoTime\t\t(s32* milli, s32* nano);\r\n\tstatic void\t\t\tstartNanoTime\t(int idx);\r\n\tstatic void\t\t\tendNanoTime\t\t(int idx, s32* milli, s32* nano);\r\n\tinline\r\n\tstatic u32\t\t\tgetFrameID\t\t() {\r\n\t\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\t\treturn mgr.getFrameID();\r\n\t}\r\n\r\n\r\nprivate:\r\n    static int luaGetAppVersion (lua_State * L);\r\n\tstatic int luaGetPlatform\t(lua_State * L);\r\n\tstatic int luaIsRelease\t\t(lua_State * L);\r\n\tstatic int luaGetNanoTime\t(lua_State * L);\r\n\tstatic int luaStartNanoTime\t(lua_State * L);\r\n\tstatic int luaEndNanoTime\t(lua_State * L);\r\n\tstatic int luaGetFrameID\t(lua_State * L);\r\n    static int luaGetElapsedTime(lua_State * L);\r\n    static int luaForbidSleep   (lua_State * L);\r\n\tenum {\r\n\t\tSCRIPT_TIMER_COUNT = 10,\r\n\t};\r\n\r\n\tstatic s64  ms_timers[SCRIPT_TIMER_COUNT];\r\n};\r\n\r\n#endif // CKLBLuaLibENG_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibFONT.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibFONT_h\r\n#define CKLBLuaLibFONT_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibFONT : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibFONT();\r\npublic:\r\n\tstruct FONTOBJ : public CKLBObjectScriptable {\r\n\t\tFONTOBJ\t*\tprev;\r\n\t\tFONTOBJ\t*\tnext;\r\n\t\tint\t\t\tsize;\r\n\t\tvoid\t*\tfont;\r\n\r\n\t\tu32 getClassID();\r\n\t};\r\n\tstatic FONTOBJ * create_font(int size, const char * fontname);\r\n\r\n\tCKLBLuaLibFONT(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibFONT();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n\tvoid destroyResources\t();\r\n\tbool dumpObjects\t\t(IPlatformRequest& pForm);\r\n\r\n\tstatic void remove_font\t\t(FONTOBJ * fontobj);\r\n\tstatic void cmdGetTextInfo\t(const char* str, void* font, STextInfo* pReturnInfo) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.getTextInfo(str, font, pReturnInfo);\r\n\t}\r\nprivate:\r\n\r\n\tstatic int remove_all_font\t();\r\n\r\n\tstatic int luaFontLoad\t\t(lua_State * L);\r\n\tstatic int luaFontCreate\t(lua_State * L);\r\n\tstatic int luaFontRelease\t(lua_State * L);\r\n\tstatic int luaGetTextInfo\t(lua_State * L);\r\n\tstatic int luaSetDefaultLabelFont(lua_State * L);\r\n\r\n\tstatic FONTOBJ\t*\tms_begin;\r\n\tstatic FONTOBJ\t*\tms_end;\r\n\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibFONT_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibGL.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibGL_h\r\n#define CKLBLuaLibGL_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nclass CKLBLuaLibGL : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibGL();\r\npublic:\r\n\tCKLBLuaLibGL(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibGL();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int luaGLSetResolution\t\t(lua_State * L);\r\n\tstatic int luaGLClearColor\t\t\t(lua_State * L);\r\n\tstatic int luaGLUseImageOffset\t\t(lua_State * L);\r\n\tstatic int luaGetGuardBand\t\t\t(lua_State * L);\r\n\tstatic int luaSetGuardBand\t\t\t(lua_State * L);\r\n\tstatic int luaGLCreateScreenAsset\t(lua_State * L);\r\n\tstatic int luaGLDoScreenShot\t\t(lua_State * L);\r\n\tstatic int luaGLFreeScreenShot\t\t(lua_State * L);\r\n\tstatic int luaGLGetHorizontalBorder\t(lua_State * L);\r\n\tstatic int luaGLGetVerticalBorder\t(lua_State * L);\r\n\tstatic int luaGLSetQuarter\t\t\t(lua_State * L);\r\n\tstatic int luaGLReloadTexture\t\t(lua_State * L);\r\n\tstatic int luaGLUnloadTexture\t\t(lua_State * L);\r\n\r\n\t\r\n\t\t\r\npublic:\r\n\tinline static bool GLClearColor(float r, float g, float b, float a) {\r\n\t\treturn CKLBDrawResource::getInstance().setClearColor(r, g, b, a);\r\n\t}\r\n\r\n\tinline static void GLSetResolution(int width, int height) {\r\n\t\tCKLBDrawResource::getInstance().setLogicalResolution(width, height);\r\n\t}\r\n\r\n\tinline static void SGGetGuardBand(float* leftBorder, float* rightBorder, float* topBorder, float* bottomBorder) {\r\n\t\t*leftBorder\t\t= CKLBNode::s_fLeftBorder;\r\n\t\t*rightBorder\t= CKLBNode::s_fRightBorder;\r\n\t\t*topBorder\t\t= CKLBNode::s_fTopBorder;\r\n\t\t*bottomBorder\t= CKLBNode::s_fBottomBorder;\r\n\t}\r\n\tinline static void SGSetGuardBand(float  leftBorder, float  rightBorder, float  topBorder, float  bottomBorder) {\r\n\t\tCKLBNode::s_fLeftBorder\t\t= leftBorder;\r\n\t\tCKLBNode::s_fRightBorder\t= rightBorder;\r\n\t\tCKLBNode::s_fTopBorder\t\t= topBorder;\r\n\t\tCKLBNode::s_fBottomBorder\t= bottomBorder;\r\n\t}\r\n\r\n\tstatic bool GLCreateScreenAsset\t(const char* name);\r\n\tstatic bool GLDoScreenShot\t\t(const char* name);\r\n\tstatic void GLFreeScreenAsset\t(const char* name);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibGL_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibHASH.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibHASH_h\r\n#define CKLBLuaLibHASH_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibHASH : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibHASH();\r\npublic:\r\n\tCKLBLuaLibHASH(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibHASH();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int luaHashSha1(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibHASH_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibKEY.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaLibKEY.h\r\n//  GameEngine\r\n//\r\n\r\n#ifndef CKLBLuaLibKEY_h\r\n#define CKLBLuaLibKEY_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibKEY : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibKEY();\r\npublic:\r\n    \r\n\tCKLBLuaLibKEY(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibKEY();\r\n    \r\n\tvoid addLibrary();\r\n\r\n\tinline static \r\n\tint genUserID(char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().genUserID(buf, bufSize);\r\n\t}\r\n\r\n\tinline static\r\n\tint genUserPW(const char* user_id, char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().genUserPW(user_id, buf, bufSize);\r\n\t}\r\n\r\n\tinline static \r\n\tbool setSecureID(const char* service_name, const char* user_id) {\r\n\t\treturn CPFInterface::getInstance().platform().setSecureDataID(service_name, user_id);\r\n\t}\r\n\r\n\tinline static\r\n\tbool setSecurePW(const char* service_name, const char* passwd) {\r\n\t\treturn CPFInterface::getInstance().platform().setSecureDataPW(service_name, passwd);\r\n\t}\r\n\r\n\tinline static\r\n\tint getSecureID(const char* service_name, char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().getSecureDataID(service_name, buf, bufSize);\r\n\t}\r\n\r\n\tinline static \r\n\tint getSecurePW(const char* service_name, char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().getSecureDataPW(service_name, buf, bufSize);\r\n\t}\r\n    \r\n\tinline static\r\n\tbool delSecureID(const char * service_name) {\r\n\t\treturn CPFInterface::getInstance().platform().delSecureDataID(service_name);\r\n\t}\r\n\r\n\tinline static\r\n\tbool delSecurePW(const char * service_name) {\r\n\t\treturn CPFInterface::getInstance().platform().delSecureDataPW(service_name);\r\n\t}\r\n\r\nprivate:\r\n    static int luaGenUserID\t\t(lua_State * L);\r\n    static int luaGenUserPW\t\t(lua_State * L);\r\n\r\n    static int luaSetKeyChainID\t(lua_State * L);\r\n    static int luaSetKeyChainPW\t(lua_State * L);\r\n\r\n    static int luaGetKeyChainID\t(lua_State * L);\r\n    static int luaGetKeyChainPW\t(lua_State * L);\r\n\r\n\tstatic int luaDelKeyChainID\t(lua_State * L);\r\n\tstatic int luaDelKeyChainPW\t(lua_State * L);\r\n};\r\n\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibLANG.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibLANG_h\r\n#define CKLBLuaLibLANG_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLanguageDatabase.h\"\r\n\r\nclass CKLBLuaLibLANG : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibLANG();\r\npublic:\r\n\tCKLBLuaLibLANG(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibLANG();\r\n\r\n\tvoid addLibrary();\r\n\t\r\n\tinline static\r\n\tbool addString(const char* id, const char* str) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().addString(id, str);\r\n\t}\r\n\r\n\tinline static\r\n\tconst char* getString(const char* id) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().getString(id);\r\n\t}\r\n\t\r\n\tinline static\r\n\tvoid removeString(const char* id) {\r\n\t\tCKLBLanguageDatabase& ldb = CKLBLanguageDatabase::getInstance();\r\n\t\tldb.removeString(id);\r\n\t}\r\n\r\n\tinline static\r\n\tbool useDB(const char* dbFile, const char* table, const char* keyF, const char* valueF, const char* groupF) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().setupDB(dbFile, table, keyF, valueF, groupF);\r\n\t}\r\n\r\n\tinline static\r\n\tbool loadGroup(const char* groupId) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().preLoadGroup(groupId);\r\n\t}\r\n\r\nprivate:\r\n\tstatic int luaAddString\t\t(lua_State * L);\r\n\tstatic int luaGetString\t\t(lua_State * L);\r\n\tstatic int luaRemoveString\t(lua_State * L);\r\n\tstatic int luaUseDB\t\t\t(lua_State * L);\r\n\tstatic int luaLoadGroup\t\t(lua_State * L);\r\n};\r\n\r\n#endif // CKLBLiaLibUI_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibMatrix.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibMatrix_h\r\n#define CKLBLuaLibMatrix_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBObject.h\"\r\n\r\n\r\nclass CKLBLuaLibMatrix : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibMatrix();\r\npublic:\r\n\tCKLBLuaLibMatrix(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibMatrix();\r\n\r\n\tvoid addLibrary();\r\n\tvoid destroyResources();\r\n\tbool dumpObjects(IPlatformRequest& pForm);\r\n\r\n\tstruct MATRIX {\r\n\t\tMATRIX\t*\tprev;\r\n\t\tMATRIX\t*\tnext;\r\n\r\n\t\tconst char * name;\r\n\r\n\t\tfloat m[16];\r\n\r\n\t};\r\n\t\r\n\tstruct VECTOR {\r\n\t\tfloat v[4];\r\n\t};\r\n\r\n\t// Luaスタック最上位のLuaテーブルを、内部のmatrixとして取得する\r\n\tstatic void getMatrix(CLuaState& lua, MATRIX * ret);\r\n\r\n\t// MATRIXをLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void setMatrix(CLuaState& lua, MATRIX * mat);\r\n\r\n\t// 単品のvectorを取得する\r\n\tstatic void getVector(CLuaState& lua, VECTOR * vec);\r\n\r\n\t// 単品のvectorをLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void setVector(CLuaState& lua, VECTOR * vec);\r\n\r\n\t// Luaスタック最上位のLuaテーブルをvector配列とみなし、vectorの数を取得する\r\n\tstatic int getVectorNums(CLuaState& lua);\r\n\r\n\t// Luaスタック最上位のLuaテーブルを内部のvector配列として取得する\r\n\tstatic void getVectorArray(CLuaState& lua, VECTOR * vec, int nums);\r\n\r\n\t// VECTOR配列をLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void setVectorArray(CLuaState& lua, VECTOR * vec, int nums);\r\n\r\n\t// vector単品に matrix をかける\r\n\tstatic void mulMatVector(VECTOR * ret, VECTOR * arr, MATRIX * mat);\r\n\r\n\t// vector 配列に matrix をかける\r\n\tstatic void mulMatVecArray(int num, VECTOR * ret, VECTOR * arr, MATRIX * mat);\r\n\r\n\t// matrixの乗算\r\n\tstatic void mulMatrix(MATRIX * ans, MATRIX * a, MATRIX * b); \r\n\r\n\t// inverce matrix に変換する\r\n\tstatic bool inverseMatrix(MATRIX * mat);\r\n\r\nprivate:\r\n\tstatic int luaSetMatrixName\t\t(lua_State * L);\r\n\tstatic int luaCreateMatrix\t\t(lua_State * L);\r\n\tstatic int luaDeleteMatrix\t\t(lua_State * L);\r\n\tstatic int luaRevertMatrix\t\t(lua_State * L);\r\n\tstatic int luaCopyMatrix\t\t(lua_State * L);\r\n\tstatic int luaInverseMatrix\t\t(lua_State * L);\r\n\tstatic int luaOverwriteMatrix\t(lua_State * L);\r\n\tstatic int luaDeleteAllMatrix\t(lua_State * L);\r\n\r\n\tstatic int luaMulMatrix\t\t\t(lua_State * L);\r\n\tstatic int luaMulMatVecArray\t(lua_State * L);\r\n\tstatic int luaMulMatVector\t\t(lua_State * L);\r\n\tstatic int luaTransposedMatrix\t(lua_State * L);\r\n\r\n\tstatic MATRIX * newMatrix\t\t();\r\n\tstatic void\t\tdelMatrix\t\t(MATRIX * pMat);\r\n\tstatic int\t\tdelAllMatrix\t();\r\n\tstatic MATRIX * getMatPointer\t(CLuaState& lua, int index);\r\n\r\n\t// 生成されたmatrix objectはすべてlinkとして\r\n\tstatic MATRIX\t*\tm_pBegin;\r\n\tstatic MATRIX\t*\tm_pEnd;\r\n\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibMatrix_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibRES.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibRES_h\r\n#define CKLBLuaLibRES_h\r\n\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBRendering.h\"\r\n#include \"CKLBTexturePacker.h\"\r\n#include \"CKLBUITask.h\"\r\n\r\nclass CKLBLuaLibRES : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibRES();\r\npublic:\r\n\tCKLBLuaLibRES(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibRES();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic void dumpSceneGraph(const void* ptr);\r\n\r\n\tinline \r\n\tstatic void dumpRendering(bool detailed) {\r\n\t\tif(detailed) {\r\n\t\t\tCKLBRenderingManager::getInstance().dump(0xFFFFFFFF);\r\n\t\t}\r\n\t\tCKLBRenderingManager::getInstance().dumpMetrics();\r\n\t}\r\n\r\n\tinline\r\n\tstatic void dumpAssets() {\r\n\t\tCKLBAssetManager::getInstance().dump();\r\n\t}\r\n\r\n\tinline \r\n\tstatic void dumpDataSet() {\r\n\t\tCKLBDataHandler::dumpDataSet();\r\n\t}\r\n\r\n\tinline\r\n\tstatic void dumpTexturePacker(bool detailed) {\r\n\t\tTexturePacker::getInstance().dump(detailed);\r\n\t}\r\n\r\n\tstatic void dumpGeometryCost(bool detailed);\r\n\r\n\r\nprivate:\r\n\tstatic int luaRESDumpTaskList\t\t(lua_State * L);\r\n\tstatic int luaRESDumpSceneGraph\t\t(lua_State * L);\r\n\tstatic int luaRESDumpRendering\t\t(lua_State * L);\r\n\tstatic int luaRESDumpAssets\t\t\t(lua_State * L);\r\n\tstatic int luaRESDumpDataSet\t\t(lua_State * L);\r\n\tstatic int luaRESDumpTexturePacker\t(lua_State * L);\r\n\tstatic int luaRESDumpGeometryCost\t(lua_State * L);\r\n\tstatic int luaRESDumpRenderCost\t\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibRES_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibSOUND.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibSOUND_h\r\n#define CKLBLuaLibSOUND_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibSOUND : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibSOUND();\r\npublic:\r\n\tCKLBLuaLibSOUND(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibSOUND();\r\n\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\n\r\n\tvoid addLibrary();\r\n\tvoid destroyResources();\r\n\tbool dumpObjects(IPlatformRequest& pForm);\r\n\tstatic void s_dumpObjects();\r\n\r\n\tstruct SOUND : public CKLBObjectScriptable {\r\n\t\tu32 getClassID();\r\n\r\n\t\tSOUND\t*\tprev;\r\n\t\tSOUND\t*\tnext;\r\n\r\n\t\tvoid\t*\thSND;\t// サウンドハンドル\r\n\t\tconst char * name;\r\n\t};\r\n\t\r\n\tinline\r\n\tstatic SOUND* cmdSoundOpen(const char* snd_asset, bool f_bgm) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tSOUND * pSnd = createSound(snd_asset, !f_bgm);\r\n\t\tif(!f_bgm) pForm.preLoad(pSnd->hSND);\t// SEモードの場合はオンメモリ状態にしておく\r\n\t\treturn pSnd;\r\n\t}\r\n\r\n\tstatic int removeSoundAll();\r\n\r\n\tinline\r\n\tstatic void cmdSoundPlay(SOUND* pSnd, u32 fade_msec, float tgtVol, float globalVol) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\t// 与えられたポインタが無効であれば何もしない\r\n\t\tfloat startVol = (fade_msec > 0.0f) ? (0.0f) : (1.0f);\r\n\t\tif(checkSoundExist(pSnd)) pForm.playAudio(pSnd->hSND, fade_msec, tgtVol * globalVol, startVol * globalVol);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundStop(SOUND* pSnd, u32 fade_msec, float tgtVol) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.stopAudio(pSnd->hSND, fade_msec, tgtVol);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundVolume(SOUND* pSnd, float volume) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.setAudioVolume(pSnd->hSND, volume);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundPan(SOUND* pSnd, float pan) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.setAudioPan(pSnd->hSND, pan);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundPause(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.pauseAudio(pSnd->hSND);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundResume(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.resumeAudio(pSnd->hSND);\r\n\t}\r\n\r\n\tinline \r\n\tstatic void cmdSoundSeek(SOUND* pSnd, s32 millisec) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.seekAudio(pSnd->hSND, millisec);\r\n\t}\r\n\r\n\tinline\r\n\tstatic s32  cmdSoundTell(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\ts32 millisec = 0;\r\n\t\tif(checkSoundExist(pSnd)) millisec = pForm.tellAudio(pSnd->hSND);\r\n\t\treturn millisec;\r\n\t}\r\n\r\n\tinline\r\n\tstatic s32  cmdSoundState(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\ts32 state = 0;\r\n\t\tif(checkSoundExist(pSnd)) {\r\n\t\t\t// ハンドルが見つかったのでステータスを返す\r\n\t\t\tstate = pForm.getState(pSnd->hSND);\r\n\t\t} else {\r\n\t\t\t// ハンドルが見つからない\r\n\t\t\tstate = IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\r\n\t\t}\r\n\t\treturn state;\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdVolumeBGM(float volume) {\r\n\t\tCPFInterface::getInstance().platform().setMasterVolume(volume, false);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdVolumeSE(float volume) { \r\n\t\tCPFInterface::getInstance().platform().setMasterVolume(volume, true);\r\n\t}\r\n\r\n\tstatic void removeSound(SOUND * pSnd);\r\n\r\n\tinline\r\n\tstatic s32 cmdGetLength(SOUND * pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\ts32 length = -1;\r\n\t\tif(checkSoundExist(pSnd)) {\r\n\t\t\tlength = pForm.totalTimeAudio(pSnd->hSND);\r\n\t\t}\r\n\t\treturn length;\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSetFade(SOUND * pSnd, s32 millisec, float tgtVol) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.setFadeParam(pSnd->hSND, tgtVol, millisec);\r\n\t}\r\n\t\r\n\tinline\r\n\tstatic bool cmdSoundSetBufSize(SOUND* pSnd, s32 value) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\treturn pForm.setBufSize(pSnd->hSND, value);\r\n\t}\r\n\r\n\tinline\r\n\tstatic float getFormGlobalVolume() {\r\n\t\treturn s_formGlobalVolume;\r\n\t}\r\nprivate:\r\n\tstatic SOUND * createSound(const char * snd_asset, bool is_se);\r\n\r\n\r\n\tstatic int luaGetLength\t\t(lua_State * L);\r\n\tstatic int luaSoundOpen\t\t(lua_State * L);\r\n    static int luaSetBufSize\t(lua_State * L);\r\n\tstatic int luaSoundClose\t(lua_State * L);\r\n\tstatic int luaSoundCloseAll\t(lua_State * L);\r\n\r\n\tstatic int luaSoundPlay\t\t(lua_State * L);\r\n\tstatic int luaSoundStop\t\t(lua_State * L);\r\n    static int luaSoundVolume\t(lua_State * L);\r\n    static int luaSoundPan\t\t(lua_State * L);\r\n\tstatic int luaVolumeBGM\t\t(lua_State * L);\r\n\tstatic int luaVolumeSE\t\t(lua_State * L);\r\n\tstatic int luaVolumeFormSE\t(lua_State * L);\r\n    static int luaSoundPause\t(lua_State * L);\r\n    static int luaSoundResume\t(lua_State * L);\r\n    static int luaSoundSeek\t\t(lua_State * L);\r\n    static int luaSoundTell\t\t(lua_State * L);\r\n    \r\n    static int luaSoundState\t(lua_State * L);\r\n    static int luaSoundSetFade\t(lua_State * L);\r\n\r\n    static int luaSoundSetMultiProcessType\t(lua_State * L);\r\n    static int luaSoundPauseOnInterruption  (lua_State * L);\r\n    \r\n    static bool checkSoundExist\t(SOUND * pSnd);\r\nprivate:\r\n\r\n\r\n\tstatic float\t\ts_formGlobalVolume;\r\n\tstatic SOUND\t*\tms_begin;\r\n\tstatic SOUND\t*\tms_end;\r\n};\r\n\r\n\r\n#endif // CKLBLuaLIbSOUND_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibTASK.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibTASK_h\r\n#define CKLBLuaLibTASK_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibTASK : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibTASK();\r\npublic:\r\n\tCKLBLuaLibTASK(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibTASK();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\r\n\tstatic int getProperty\t\t(lua_State * L);\r\n\tstatic int setProperty\t\t(lua_State * L);\r\n\tstatic int killTask\t\t\t(lua_State * L);\r\n\tstatic int isKill\t\t\t(lua_State * L);\r\n\tstatic int registerKill\t\t(lua_State * L);\r\n\tstatic int setStageTask\t\t(lua_State * L);\r\n\tstatic int clearStageTask\t(lua_State * L);\r\n\tstatic int setPause\t\t\t(lua_State * L);\r\n\tstatic int setManagerPause\t(lua_State * L);\r\n};\r\n\r\n#endif // CKLBLuaLIbTASK_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaLibUI.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibUI_h\r\n#define CKLBLuaLibUI_h\r\n\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibUI : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibUI();\r\npublic:\r\n\tCKLBLuaLibUI(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibUI();\r\n\r\n\tvoid addLibrary();\r\nprivate:\r\n\tstatic int luaCalcPosition(lua_State * L);\r\npublic:\r\n\tstatic void calcPosition(float x, float y, float w, float h, int mask, float* out_rx, float* out_ry);\r\n};\r\n\r\n#endif // CKLBLiaLibUI_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaPropTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaPropTask_h\r\n#define CKLBLuaPropTask_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nclass CKLBLuaPropTask;\r\ntypedef void (CKLBLuaPropTask::*setBoolT)\t\t(bool);\r\ntypedef void (CKLBLuaPropTask::*setIntT)\t\t(s32);\r\ntypedef void (CKLBLuaPropTask::*setUintT)\t\t(u32);\r\ntypedef void (CKLBLuaPropTask::*setFloatT)\t\t(float);\r\ntypedef void (CKLBLuaPropTask::*setStrT)\t\t(const char*);\r\ntypedef void (CKLBLuaPropTask::*setPtrT)\t\t(void*);\r\ntypedef void (CKLBLuaPropTask::*setGenIntT)\t\t(u32, s32);\r\n\r\ntypedef bool (CKLBLuaPropTask::*getBoolT)\t\t(void);\r\ntypedef s32  (CKLBLuaPropTask::*getIntT)\t\t(void);\r\ntypedef u32  (CKLBLuaPropTask::*getUintT)\t\t(void);\r\ntypedef float (CKLBLuaPropTask::*getFloatT)\t\t(void);\r\ntypedef const char* (CKLBLuaPropTask::*getStrT)\t(void);\r\ntypedef void* (CKLBLuaPropTask::*getPtrT)\t\t(void);\r\ntypedef s32 (CKLBLuaPropTask::*getGenIntT)\t\t(u32);\r\n\r\ntemplate <typename T, size_t N>\r\ninline\r\nsize_t SizeOfArray( const T(&)[ N ] )\r\n{\r\n  return N;\r\n}\r\n\r\ntypedef enum {\r\n\tNIL,\r\n\tBOOLEANT,\r\n\tINTEGER,\r\n\tUINTEGER = INTEGER,\r\n\tNUMERIC,\r\n\tSTRING,\r\n\tPOINTER,\r\n\tDYNAMIC_INT,\r\n\r\n\tTYPE_MASK\t= 0x0F,\r\n\tREAD_ONLY\t= 0x10,\r\n\r\n\tR_INTEGER\t= INTEGER  | READ_ONLY,\r\n\tR_UINTEGER  = UINTEGER | READ_ONLY,\r\n\tR_STRING    = STRING   | READ_ONLY,\r\n\tR_BOOLEANT  = BOOLEANT | READ_ONLY,\r\n\tR_NUMERIC   = NUMERIC  | READ_ONLY,\r\n\tR_POINTER\t= POINTER  | READ_ONLY,\r\n} PROPTYPE;\r\n\r\n/*!\r\n* \\class CKLBLuaPropTask\r\n* \\brief Lua Prop Task class\r\n* \r\n* CKLBLuaPropTask is a CKLBLuaTask with properties (int, uint, float, string, bool, pointers).\r\n* These properties can be read and/or written by the scripting part of the game,\r\n* depending on their declaration.\r\n* It is an abstract class for every class in the Engine using properties.\r\n*/\r\nclass CKLBLuaPropTask : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBLuaEnv;\r\npublic:\r\n    u32 getClassID();\r\n\tCKLBLuaPropTask();\r\n\tvirtual ~CKLBLuaPropTask();\r\n\r\n    virtual TASKTYPE getTaskType();\r\n\r\n\tvirtual bool initScript(CLuaState& lua) = 0;\r\n\r\n\t// CKLBLuaTask にあったデフォルトの\r\n\t// virtual int commandScript(CLuaState& lua);\r\n\t// は、そのまま使えるし、オーバーライドしてもよい。\r\n\tvirtual void execute(u32 deltaT) = 0;\r\n\tvirtual void die() = 0;\r\n\r\n\tstruct PROP {\r\n\t\tconst char * name;\t\t// プロパティインデックス\r\n\t\tPROPTYPE\t type;\t\t// プロパティの型\r\n\t\tunion {\r\n\t\t\tbool\t\tb;\t\t// boolean\r\n\t\t\ts32\t\t\ti;\t\t// integer\r\n\t\t\tfloat\t\tn;\t\t// real (float)\r\n\t\t\tchar\t*\ts;\t\t// string\r\n\t\t\tvoid\t*\tp;\t\t// pointer (userlightdata)\r\n\t\t} value;\r\n\t\tbool\t\tchecked;\r\n\t};\r\n\r\n\tstruct PROP_V2 {\r\n\t\tconst char * name;\t\t// property index\r\n\t\tPROPTYPE\t type;\t\t// property type\r\n\t\tunion {\r\n\t\t\tsetBoolT\tb;\r\n\t\t\tsetIntT\t\ti;\r\n\t\t\tsetUintT\tui;\r\n\t\t\tsetFloatT\tf;\r\n\t\t\tsetStrT\t\ts;\r\n\t\t\tsetPtrT\t\tp;\r\n\t\t\tsetGenIntT\tg;\r\n\t\t} setter;\r\n\t\tunion {\r\n\t\t\tgetBoolT\tb;\r\n\t\t\tgetIntT\t\ti;\r\n\t\t\tgetUintT\tui;\r\n\t\t\tgetFloatT\tf;\r\n\t\t\tgetStrT\t\ts;\r\n\t\t\tgetPtrT\t\tp;\r\n\t\t\tgetGenIntT\tg;\r\n\t\t} getter;\r\n\t\tsize_t\t\t\toffset;\r\n\t\t/*\r\n\t\tunion {\r\n\t\t\tbool\t\tb;\t\t// boolean\r\n\t\t\ts32\t\t\ti;\t\t// integer\r\n\t\t\tfloat\t\tn;\t\t// real (float)\r\n\t\t\tchar\t*\ts;\t\t// string\r\n\t\t\tvoid\t*\tp;\t\t// pointer (userlightdata)\r\n\t\t} value;*/\r\n\t\tbool\t\tchecked;\r\n\t};\r\n\r\n\r\n\t// 保持すべきプロパティ領域を登録する。\r\n\t// 内部で生成された配列領域のインデックスは、\r\n\t// names 配列で与えられた順番と一致することが保証される。\r\n\tbool setupPropertyList(const char * names[], u32 length = 0);\r\n\r\n\t// 設定済みのプロパティリストを破棄せず、\r\n\t// 与えられたプロパティリストを追加する。\r\n\tbool addPropertyList(const char * names[]);\r\n\r\n\t// プロパティ名から内部配列のインデックスを得る。\r\n\tint findProperty(const char * name);\r\n\r\n\t// 値を設定する(idx は findProperty()で返される値)\r\n\tvoid setNil(int idx);\r\n\tvoid setBool(int idx, bool val);\r\n\tvoid setInt(int idx, int val);\r\n\tvoid setNum(int idx, float val);\r\n\tbool setStr(int idx, const char * val);\r\n\tbool setMem(int idx, const char * val, u32 size );\r\n\r\n\t// 型を取得する\r\n\tinline PROPTYPE getType(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn m_arrProp[idx].type; \r\n\t}\r\n\r\n\t// 値を取得する\r\n\tinline bool isNil(int idx) { \r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== NIL); \r\n\t}\r\n\tinline bool getBool(int idx) { \r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== BOOLEANT) ? m_arrProp[idx].value.b : false; \r\n\t}\r\n\tinline int  getInt(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== INTEGER)\r\n\t\t\t? m_arrProp[idx].value.i\r\n\t\t\t: (((m_arrProp[idx].type & TYPE_MASK) == NUMERIC) ? (int)m_arrProp[idx].value.n : 0);\r\n\t}\r\n\tinline float getNum(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK) == NUMERIC)\r\n\t\t\t? m_arrProp[idx].value.n\r\n\t\t\t: (((m_arrProp[idx].type & TYPE_MASK) == INTEGER) ? (float)m_arrProp[idx].value.i : 0.0f);\r\n\t}\r\n\tinline const char * getStr(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== STRING) ? m_arrProp[idx].value.s : 0; \r\n\t}\r\n\r\n\tinline void setUpdateFlag\t()\t\t\t{ m_bUpdateByScript = true;  }\r\n\tinline void clearUpdateFlag\t()\t\t\t{ m_bUpdateByScript = false; }\r\n\tinline bool getUpdateFlag\t() const\t{ return m_bUpdateByScript;  }\r\n\tinline int\tgetPropertyCount() const\t{ return m_cntProp;\t\t\t }\r\n\r\n\t// Lua の配列と内部プロパティをやり取りするメソッド\r\n\tint getPropertyByScript(lua_State * L);\r\n\tint setPropertyByScript(lua_State * L);\r\n\r\n\tinline int isNewScriptModel() { return m_newScriptModel; }\r\n\r\nprotected:\r\n\tbool\t\t\tm_newScriptModel;\r\n\r\n    // スクリプトからのプロパティ取得直前に行う処理があれば、このmethodに実装する\r\n    virtual void preGetProp();\r\n    \r\n    // スクリプトからのプロパティ設定直後に行う処理があれば、このmethodに実装する。\r\n    virtual void afterSetProp();\r\n\r\nprivate:\r\n\tbool\t\t\tm_bUpdateByScript;\r\n\tint\t\t\t\tm_cntProp;\t\t// プロパティ総数\r\n\tPROP\t\t*\tm_arrProp;\t\t// プロパティ配列\r\n\tPROP_V2\t\t*\tm_arrPropV2;\t// プロパティ配列\r\n};\r\n\r\n\r\n#endif // CKLBLuaPropTask_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaScript.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaScript.h\r\n//\r\n\r\n#ifndef CKLBLuaScript_h\r\n#define CKLBLuaScript_h\r\n\r\n#include \"CLuaState.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBTask.h\"\r\n\r\n\r\n/*!\r\n* \\class CKLBLuaScript\r\n* \\brief Lua Script loading class.\r\n* \r\n* CKLBLuaScript is used to load and execute some Lua script from an URL.\r\n*/\r\nclass CKLBLuaScript : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBLuaScript ();\r\n    ~CKLBLuaScript();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n    static CKLBLuaScript * create(const char * bootScriptURL);\r\n\r\n    void execute(u32 deltaT);\r\n    void die    ();\r\n\r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBLuaTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaTask.h\r\n//\r\n\r\n#ifndef CKLBLuaTask_h\r\n#define CKLBLuaTask_h\r\n\r\n#include \"lua.hpp\"\r\n#include \"CKLBTask.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n/*!\r\n* \\class CKLBLuaTask\r\n* \\brief Lua Task class.\r\n* \r\n* CKLBLuaTask is the abstract root class for every task \r\n* that can be created from a script command.\r\n* It defines some virtual methods and some generic callbacks.\r\n*\r\n* CKLBLuaTask objects can interact with the scripting langage\r\n* throught methods/commands calls depending on the scripting langage.\r\n*/\r\nclass CKLBLuaTask : public CKLBTask\r\n{\r\npublic:\r\n    CKLBLuaTask();\r\n    virtual ~CKLBLuaTask();\r\n\r\n   \r\n    virtual CKLBTask::TASKTYPE getTaskType();\r\n\r\n    virtual void execute(u32 deltaT) = 0;\r\n    virtual void die() = 0;\r\n    \r\n    // lua script によって起動された際の初期化メソッド。\r\n    // 初期化に成功したら regist() の戻り値を返すこと。\r\n    // 失敗した場合は false を返す。\r\n    virtual bool initScript(CLuaState& lua) = 0;\r\n    \r\n    // lua script から動作中に送られるコマンドの受付メソッド。\r\n    // コマンドを必要としないタスクもあるので、デフォルトでは何もしない処理が実装されている。\r\n    // lua script に対する戻り値を持つこともできる。\r\n    // CLuaState のメソッドで戻り値を lua スタックに積み、戻り値の数を返すこと。\r\n    // 戻り値が無い場合は 0 を返す。\r\n    virtual int commandScript(CLuaState& lua);\r\n\r\n\tvoid setKillCallback\t(const char* cbFuncName);\r\n\tvoid performKillCallback();\r\n\r\n\tbool setStrC\t\t\t(const char*& dest, const char* src);\r\nprivate:\r\n\tconst char*\tm_cbFuncName;\r\n};\r\n\r\n#ifdef DEBUG_RT_CHECK\r\n#define CHECKTASK(pTask)\t\t{ if(!CKLBTaskMgr::getInstance().isExistTask(pTask)) CKLBScriptEnv::getInstance().error(\"The canceled TASK was specified.:%p\", pTask); }\r\n#define CHECKTASKNULLOK(pTask)\t{ if(pTask) { if (!CKLBTaskMgr::getInstance().isExistTask(pTask)) { klb_assertAlways(\"Parent task does not exist yet.\"); } } }\r\n#else\r\n#define CHECKTASK(pTask)\r\n#define CHECKTASKNULLOK(pTask)\r\n#endif\r\n\r\nclass IFactory\r\n{\r\npublic:\r\n    IFactory();\r\n    virtual ~IFactory();\r\n    static bool\t\t\tregistLuaFunctions\t(lua_State * L);\r\n\tstatic u32\t\t\tgetClassID\t\t\t(const char* luaFuncName, bool assertIfNotFound = true);\r\n\tstatic const char*\tgetClassName\t\t(u32 classID);\r\n\r\n\ttypedef struct {\r\n\t\tconst char * name;\r\n\t\tint\t\t\t cmd;\r\n\t} DEFCMD;\r\n\r\nprotected:\r\n    void addLink(const char * luaFuncName, int (*func)(lua_State * L), DEFCMD * arrCmdItem, u32 classID);\r\n\r\nprivate:\r\n    static IFactory *\tm_begin;\r\n    IFactory\t\t*   m_pNext;\r\n    const char\t\t*   m_funcName;\r\n\tconst DEFCMD\t*\tm_arrCmdItem;\r\n\tu32\t\t\t\t\tm_classID;\r\n\tint (*m_luaFunc)(lua_State * L);\r\n};\r\n\r\ntemplate <class T>\r\nclass CKLBTaskFactory : public IFactory\r\n{\r\npublic:\r\n\tCKLBTaskFactory(const char * luaFuncName, u32 classID, DEFCMD * arrCmdItem = 0) {\r\n\t\taddLink(luaFuncName, CKLBTaskFactory<T>::createFactory, arrCmdItem, classID);\r\n\t}\r\n    ~CKLBTaskFactory() {}\r\n\r\n    static int createFactory(lua_State * L) {\r\n        CLuaState lua(L);\r\n#ifdef INTERNAL_BENCH\r\n\t\ts64 startCreate = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n        T * pTask = KLBNEW(T);\r\n \r\n        bool bResult = false;\r\n        if(pTask) {\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(pTask);\r\n\t\t    bResult = pTask->initScript(lua);\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(NULL);\r\n#ifdef INTERNAL_BENCH\r\n\t\tlogTime('T', CPFInterface::getInstance().platform().nanotime() - startCreate, pTask->getClassID());\r\n#endif\r\n        }\r\n        if(bResult) {\r\n\t\t\tlua.retPointer(pTask);\r\n\t\t} else {\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(pTask);\r\n            KLBDELETE(pTask);\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(NULL);\r\n\t\t\tlua.retBoolean(false);\r\n\t\t}\r\n        return 1;\r\n    }\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBModalStack.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBModalStack_h\r\n#define CKLBModalStack_h\r\n\r\nclass CKLBModalStack\r\n{\r\npublic:\r\n\tCKLBModalStack(bool bModal = false, bool bUrgent = false);\r\n\tvirtual ~CKLBModalStack();\r\n\r\n\tinline bool isUrgent() const { return m_bUrgent; }\r\n\tinline bool isModal () const { return m_bModal;  }\r\n\tinline bool isEnable() const { return m_bEnable; }\r\n\r\n\tinline bool setModal(bool bModal, bool bUrgent = false) {\r\n\t\tm_bModal  = bModal;\r\n\t\tm_bUrgent = bUrgent;\r\n        if(m_bUrgent) { m_bModal = true; }\r\n\t\treturn m_bModal;\r\n\t}\r\n\t \r\n\tinline bool setEnable(bool bEnable) {\r\n\t\tm_bEnable = bEnable;\r\n\t\treturn m_bEnable;\r\n\t}\r\n\r\n\tvoid push   ();\r\n\tvoid pop    ();\r\n\tvoid remove ();\r\n\r\nprivate:\r\n\t\r\n\tbool\t\t\t\t\t\tm_bEnable;\r\n\r\n\tbool\t\t\t\t\t\tm_bModal;\r\n\tbool\t\t\t\t\t\tm_bUrgent;\r\n\r\n\tCKLBModalStack\t\t\t*\tm_prev;\r\n\tCKLBModalStack\t\t\t*\tm_next;\r\n\r\n\tstatic CKLBModalStack\t*\tms_begin;\r\n\tstatic CKLBModalStack\t*\tms_end;\r\n};\r\n\r\n\r\n#endif // CKLBModalStack_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBMovieNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_MOVIENODE__\r\n#define __CKLB_MOVIENODE__\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBMovieNode\r\n* \\brief Movie Specialized Node Class\r\n* \r\n* CKLBMovieNode is a specilized Node for movie management.\r\n* It takes care of the graphic operations that can be processed\r\n* on a movie asset.\r\n*/\r\nclass CKLBMovieNode : public CKLBUIElement {\r\npublic:\r\n\tCKLBMovieNode(const char * path, bool background = false);\r\n\t~CKLBMovieNode();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBMOVIENODE; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\t\t\r\n\tvoid\trecomputeCustom\t\t();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   ()  { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n    \r\n    void        command         (IWidget::MOVIECMD cmd);\r\n\r\n    inline IWidget * getWidget  () const { return nativeInputItem; }\r\n    \r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender      ();\r\n\tvirtual void removeRender   ();\r\n\r\n\tIWidget *   nativeInputItem;\r\n\tu32         m_width;\r\n\tu32         m_height;\r\n\ts32         m_tx;\r\n\ts32         m_ty;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBNetAPI.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBNetAPI_h\r\n#define CKLBNetAPI_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBHTTPInterface.h\"\r\n#include \"CKLBJsonItem.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"MultithreadedNetwork.h\"\r\n\r\n// regionを指定しなかった場合のデフォルトregion値(ISO 3166-1)\r\n#define DEFAULT_REGION \"840\"    // 北米アメリカ合衆国\r\n\r\n//// 指定しそうなデフォルト値をコメントアウトして書いておく。\r\n// #define DEFAULT_REGION \"392\"    // 日本\r\n\r\n\r\nenum {\r\n\t// メッセージ値定義\r\n\tNETAPIMSG_CONNECTION_CANCELED\t= -999,\t// セッションはキャンセルされた\r\n\tNETAPIMSG_CONNECTION_FAILED\t\t= -500,\t// 接続に失敗した\r\n\tRESERVED\t\t\t\t\t\t= -1,\t// サーバにアクセスできない/サーバからのパケットを解釈できない\r\n\tNETAPIMSG_SERVER_TIMEOUT\t\t= -2,\t// サーバとの通信がタイムアウトした\r\n\tNETAPIMSG_SERVER_ERROR\t\t\t= 0,\r\n\tNETAPIMSG_REQUEST_SUCCESS\t\t= 1,\t// リクエスト成功ステータス\r\n};\r\n\r\n// Native側からAPIタスクにコマンドを発行するためのsingleton.\r\n// \r\nclass CKLBNetAPI;\r\n\r\n/*!\r\n* \\class CKLBNetAPI\r\n* \\brief Net API class.\r\n* \r\n* CKLBNetAPI is responsible Network communications.\r\n*/\r\nclass CKLBNetAPI : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBNetAPI>;\r\nprivate:\r\n\tCKLBNetAPI();\r\n\tvirtual ~CKLBNetAPI();\r\n\r\n\tbool init(\tCKLBTask* pTask, \r\n\t\t\t\tconst char * callback);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBNetAPI* create(\tCKLBTask* pParentTask, \r\n\t\t\t\t\t\t\t\tconst char * callback);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\n\tbool initScript(CLuaState& lua);\r\n\tint commandScript(CLuaState& lua);\r\nprivate:\r\n\tCKLBHTTPInterface*\t\tm_http;\t\t// そのセッションで使用されている接続\r\n\tu32\t\t\t\t\t\tm_timeout;\t// タイムアウト時間\r\n\tu32\t\t\t\t\t\tm_timestart;\r\n\tu32\t\t\t\t\t\tm_http_header_length;\r\n\tbool\t\t\t\t\tm_canceled;\t// セッションがキャンセルされると true になる\r\n\tCKLBJsonItem*\t\t\tm_pRoot;\r\n\r\n\t// スクリプトコールバック用\r\n\tconst char\t\t\t*\tm_callback;\t// Lua callback function\r\n\r\n\t// HTTP通信で追加するヘッダの配列\r\n\tconst char\t\t\t**\tm_http_header_array;\r\n\r\nprivate:\r\n\tvoid freeHeader();\r\n\tvoid freeJSonResult();\r\n\r\n\tbool lua_callback(int msg, int status, CKLBJsonItem * pRoot);\r\n\r\n\tCKLBJsonItem * getJsonTree(const char * json_string, u32 dataLen);\r\n\tbool get_token(CKLBJsonItem * pRoot);\r\n\r\npublic:\r\n\tbool cancel\t\t();\r\n};\r\n\r\n#endif // CKLBNetAPI_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBNetAPIKeyChain.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBNetAPIKeyChain.h\r\n//  GameEngine\r\n//\r\n\r\n#ifndef CKLBNetAPIKeyChain_h\r\n#define CKLBNetAPIKeyChain_h\r\n\r\n#include \"CKLBUtility.h\"\r\n\r\n/*!\r\n* \\class CKLBNetAPIKeyChain\r\n* \\brief Net API Key Chain Class\r\n* \r\n* \r\n*/\r\nclass CKLBNetAPIKeyChain\r\n{\r\nprivate:\r\n    CKLBNetAPIKeyChain();\r\n    virtual ~CKLBNetAPIKeyChain();\r\npublic:\r\n    static CKLBNetAPIKeyChain& getInstance();\r\n\tvoid release();\r\n\r\n    inline const char * setToken(const char * token) {\r\n        KLBDELETEA(m_token);\r\n\t\tif (token) {\r\n\t        m_token = CKLBUtility::copyString(token);\r\n\t\t} else {\r\n\t\t\tm_token = NULL;\r\n\t\t}\r\n        return m_token;\r\n    }\r\n    \r\n    inline const char * setRegion(const char * region) {\r\n        KLBDELETEA(m_region);\r\n\t\tif (region) {\r\n\t        m_region = CKLBUtility::copyString(region);\r\n\t\t} else {\r\n\t\t\tm_region = NULL;\r\n\t\t}\r\n        return m_region;\r\n    }\r\n    \r\n    inline const char * setClient(const char * client) {\r\n        KLBDELETEA(m_client);\r\n\t\tif (client) {\r\n\t        m_client = CKLBUtility::copyString(client);\r\n\t\t} else {\r\n\t\t\tm_client = NULL;\r\n\t\t}\r\n        return m_client;\r\n    }\r\n    \r\n    inline const char * setConsumernKey(const char * cKey) {\r\n        KLBDELETEA(m_cKey);\r\n\t\tif (cKey) {\r\n\t        m_cKey = CKLBUtility::copyString(cKey);\r\n\t\t} else {\r\n\t\t\tm_cKey = NULL;\r\n\t\t}\r\n        return m_cKey;\r\n    }\r\n\r\n    inline const char * setAppID(const char * appID) {\r\n        KLBDELETEA(m_appID);\r\n\t\tif (appID) {\r\n\t        m_appID = CKLBUtility::copyString(appID);\r\n\t\t} else {\r\n\t\t\tm_appID = NULL;\r\n\t\t}\r\n        return m_appID;\r\n    }\r\n\r\n\tinline const char * setUserID(const char * userID) {\r\n\t\tKLBDELETEA(m_userID);\r\n\t\tif (userID) {\r\n\t\t\tm_userID = CKLBUtility::copyString(userID);\r\n\t\t} else {\r\n\t\t\tm_userID = NULL;\r\n\t\t}\r\n\t\treturn m_userID;\r\n\t}\r\n    \r\n    inline const char * getToken\t\t() const { return m_token;\t}\r\n    inline const char * getRegion\t\t() const { return m_region; }\r\n    inline const char * getClient\t\t() const { return m_client; }\r\n    inline const char * getConsumerKey\t() const { return m_cKey;\t}\r\n    inline const char * getAppID\t\t() const { return m_appID;\t}\r\n\tinline const char * getUserID\t\t() const { return m_userID; }\r\n\r\n\tinline int genCmdNumID(char * retBuf, const char * body, time_t timeStamp, int serial) {\r\n\t\tsprintf(retBuf, \"%s-%s.%d.%d\",\r\n\t\t\t\tbody, m_token,\r\n\t\t\t\t(int)timeStamp, serial);\r\n\t\tint len = strlen(retBuf);\r\n\t\treturn len;\r\n\t}\r\n\r\nprivate:\r\n    const char      *   m_token;    // Authorized Token\r\n    const char      *   m_region;   // region\r\n    const char      *   m_client;   // client version\r\n    const char      *   m_cKey;     // consumerKey\r\n    const char      *   m_appID;    // Application ID\r\n\tconst char\t\t*\tm_userID;\t// User-ID\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === 2D Scene Graph ===\r\n//\r\n/*\r\n\tMemo about FLAGS\r\n\t\r\n\tA: RenderCommand Flags (All Sprite)\r\n\t------------------------------------\r\n\tm_uiStatus\r\n\t\tFLAG_XYUPDATE\t\t: Set  in Phase 2.1\r\n\t\tFLAG_COLORUPDATE\t: Set  in Phase 2.3 but uselessly set in many sprite setup.\r\n\t\tFLAG_UVUPDATE\t\t: Used in Phase 2.2 : => __Set in phase 0__ !\r\n\t\tFLAG_BUFFERSHIFT\t: When item \r\n\t\t\r\n\t\t\r\n\tB: Node Flags\r\n\t------------------------------------\r\n\t\tMATRIX_CHANGE\t\t: Set when matrix       changes or sprite recomputation.\r\n\t\tCMATRIX_CHANGE\t\t: Set when color vector changes or sprite recomputation.\r\n\t\tMARKED\t\t\t\t: Sub Node has changed.\r\n\r\n\tC: Phases\r\n\t------------------------------------\r\n\tPhase 0 : [Modification : user code modify tree or geometry and perform marking]\r\n\r\n\tPhase 1 : Modify Matrix / Tree Marking\r\n\t\t-> MATRIX_CHANGE / CMATRIX_CHANGE / MARKED flags are consumed.\r\n\t\t-> FLAG_UVUPDATE is used.\r\n\r\n\tPhase 2 : Apply  Transform\r\n\t\t2.1\tPre  XY -> Post XY\t\t\t\t: Transform coordinate from source image to sprite buffer.\r\n\t\t\t\t\t\t\t\t\t\t\t  FLAG_XYUPDATE Set.\r\n\r\n\t\t2.2\tCopy UV \t\t\t\t\t\t: FLAG_UVUPDATE used, copy UV to sprite buffer.\r\n\t\t\r\n\t\t2.3 Apply Color if CMATRIX_CHANGE\t: FLAG_COLORUPDATE update when color is applied.\r\n\r\n\tPhase 3 : Batch Render Call\t\t\t:\r\n\t\t- Copy or Skip based on flags\tFLAG_UVUPDATE, FLAG_XYUPDATE, FLAG_COLORUPDATE.\r\n\t\t- If FLAG_BUFFERSHIFT, all upper flags are forced to TRUE and copy is forced.\r\n\t\t\r\n\tD: What to do - Uses Cases\r\n\t------------------------------------\r\n\t- Add Sprite to node\t\t\t\t: owner node::markUpMatrix()\r\n\t- Sprite Geometry changed\t\t\t: owner node::markUpMatrix()\r\n\t- Sprite UV       changed\t\t\t: FLAG_UVUPDATE + owner node::markUpMatrix()\r\n\t\t\t\t\t\t\t\t\t\t  --> Lot of waste for just an UV copy in the end.\r\n\t- Sprite Color    changed\t\t\t: owner node::markUpColor()\r\n\t- Sprite Topology changed (ie vertex count change):\r\n\t\t\t\t\t\t\t\t\t\t: FLAG_BUFFERSHIFT set \r\n\t\t\t\t\t\t\t\t\t\t+ FLAG_UVUPDATE\r\n\t\t\t\t\t\t\t\t\t\t+ owner node::markUpMatrixColor() (MATRIX_CHANGE | CMATRIX_CHANGE)\r\n\t- Sprite Added to render list\t\t: FLAG_BUFFERSHIFT set\r\n\t- Sprite Removed from render list\t: FLAG_BUFFERSHIFT on next rendering item.\r\n\t- Matrix transform has changed\t\t: owner node::markUpMatrix()\r\n\t- Matrix color transform changed\t: owner node::markUpColor()\r\n\r\n\tE: Notes\r\n\t------------------------------------\r\n\t- Added a RENDER_CHANGE flag instead of markUpMatrix -> markUpRender()\r\n\t\tShould have a RENDER_CHANGE_GEO, RENDER_CHANGE_COLOR, RENDER_CHANGE_UV\r\n\t\t-> Avoid matrix and sub matrix recomputation.\r\n\r\n*/\r\n\r\n#ifndef __NODE_BASE__\r\n#define __NODE_BASE__\r\n\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBRendering.h\"\r\n\r\n\r\n#define _USE_MATH_DEFINES\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\nclass CKLBNode;\r\nclass CKLBUITask;\r\n\r\n/*!\r\n* \\class CKLBSystem\r\n* \\brief Node System Class\r\n* \r\n* CKLBSystem provides static methods to manage the Animation Node List.\r\n* It allows to separate the Node System from the rest of the Game Engine.\r\n*/\r\nclass CKLBSystem {\r\npublic:\r\n\tstatic void\t\t\tremoveFromAnimation\t\t(CKLBNode* pNode);\r\n\tstatic void\t\t\taddToAnimation\t\t\t(CKLBNode* pNode);\r\n\tstatic CKLBNode*\tgetAnimationNodeList\t();\r\n\tstatic void\t\t\tperformAnimationUpdate\t(u32 milliSecDelta);\r\n};\r\n\r\n//\r\n// Matrix Types\r\n//\r\n\r\n// Identity (color or coordinate matrix)\r\n#define MATRIX_ID\t\t\t\t(0)\r\n// Translation\r\n#define MATRIX_T\t\t\t\t(1)\r\n// Translation + Scale\r\n#define MATRIX_TS\t\t\t\t(2)\r\n// Translation + General\r\n#define MATRIX_TG\t\t\t\t(3)\r\n// Color\r\n#define MATRIX_COL\t\t\t\t(4)\r\n\r\n//\r\n// Matrix Indexes\r\n//\r\n#define MAT_A\t\t\t\t\t(0)\r\n#define MAT_B\t\t\t\t\t(1)\r\n#define MAT_C\t\t\t\t\t(2)\r\n#define MAT_D\t\t\t\t\t(3)\r\n#define MAT_TX\t\t\t\t\t(4)\r\n#define MAT_TY\t\t\t\t\t(5)\r\n\r\nstruct SMatrix2D {\r\n\tu8\t\tm_type;\t// T, TS, TG, Identity\r\n\tfloat\tm_matrix[6];\r\n\r\n\tSMatrix2D();\r\n};\r\n\r\nstruct SColorVector {\r\n\tu8\t\tm_type;\t// color / identity\r\n\tfloat\tm_vector[4];\r\n\tSColorVector();\r\n};\r\n\r\nclass CKLBController;\r\n\r\n/**\r\n\t\r\n */\r\n\r\n/*!\r\n* \\class CKLBNode\r\n* \\brief Scene Graphe Node Root Class\r\n* \r\n* CKLBNode is the root class for the Scene Graph.\r\n* Every Element of the Scene Graph is a CKLBNode or a derivated class.\r\n* Each CKLBNode owns a list of render objects to apply the transformations to.\r\n* The transformations are defined by matrices also owned by the CKLBNode.\r\n*\r\n* A CKLBNode can be linked with a CKLBUITask and in that case, they will point\r\n* each other. Moreover, the CKLBNode will be protected from destruction untill \r\n* the CKLBUITask is destroyed.\r\n* \r\n* Important points about the Scene Graph System :\r\n* - add/remove do also add/remove to the animation and rendering if associated \r\n*\tbit or object are set.\r\n* - add takes in account the fact that upper node of new_ node is visible to perform \r\n*\tthe modification in animation and rendering.\r\n* - node destruction also destroy all the sub system and includes render object associated.\r\n*/\r\nclass CKLBNode : public CKLBObject {\r\n\tfriend class CKLBSWFPlayer;\r\n\tfriend class CKLBSystem;\r\npublic:\r\n\tstatic float\ts_fLeftBorder;\r\n\tstatic float\ts_fRightBorder;\r\n\tstatic float\ts_fTopBorder;\r\n\tstatic float\ts_fBottomBorder;\r\n\r\n\tbool\t\tsetName\t\t\t\t(const char * name);\r\n\tCKLBNode*\tsearch\t\t\t\t(const char* name);\r\n\tCKLBNode*\tsearchFirstByTypeID\t(u32 typeID);\r\n\r\n\tinline const char * getName() const { return m_name; }\r\n\r\n\tCKLBNode();\r\n\tvirtual ~CKLBNode();\r\n\r\n\tvirtual\r\n\tCKLBNode*\tclone\t\t\t\t(CKLBNode* newItem, CKLBNode* parent, CKLBNode* brother, bool transferSpriteOwnership);\r\n\r\n\tinline\r\n\tvoid\t\tsetUITask\t\t\t(CKLBUITask* ptr) { m_uitask = ptr;\t}\r\n\r\n\tinline\r\n\tvoid\t\tresetAsInternalNode\t()\t{ m_bInternalNode = false; }\r\n\r\n\tinline\r\n\tbool\t\tisInternalNode\t\t()\t{ return m_bInternalNode; }\r\n\r\n\tinline\r\n\tCKLBUITask* getUITask\t\t\t()\t{ return m_uitask;\t\t}\r\n\r\n\tvirtual u32\tgetClassID\t\t\t()\t{ return CLS_KLBNODE;\t}\r\n\r\n\tvoid\t\tkickAnimation\t\t(const char* animName,u32* refCounterPtr, bool doBlend);\r\n\tvoid\t\tskipAnimation\t\t(const char* animName);\r\n\r\n\tvoid\t\tasRoot\t\t\t\t()\t{\tm_status = 0;\t// No upper invisible.\r\n\t\t\t\t\t\t\t\t\t\t\tm_pColorMatrix\t\t= &m_colorMatrix;\r\n\t\t\t\t\t\t\t\t\t\t\tm_useParentColor\t= false;\t\t\t} \r\n\r\n\tvoid\t\tdump\t\t\t\t(u32 level, u32 dumpMask = 0);\r\n\r\n\tvoid\t\tremoveNode\t\t\t(CKLBNode* pChild);\r\n\tvoid\t\taddNode\t\t\t\t(CKLBNode* pChild, u16 layer = 0);\r\n\r\n\tinline\r\n\tCKLBNode*\tgetNextAnimation\t()\t{ return m_pAnimationNext; }\r\n\r\n\tvirtual\r\n\tvoid\t\tanimate\t\t\t\t(u32 deltaTimeMilli)\t{ deltaTimeMilli = deltaTimeMilli; /*avoid warning*/ /* Default implementation do nothing */ }\r\n\r\n\tvoid\t\trecompute\t\t\t();\r\n\r\n\tvirtual\t\t\r\n\tvoid\t\trecomputeCustom\t\t()\t{ /* Do nothing default*/ }\r\n\r\n\tvirtual\r\n\tvoid\t\tsetPriority\t\t\t(u32 order);\r\n\r\n\tvoid\t\tsetPriorityL\t\t(u32 order);\r\n\r\n\tvirtual\r\n\tu32\t\t\tgetPriority\t\t\t();\r\n\r\n\tvoid\t\tmarkUpTree\t\t\t();\r\n\r\n\tinline\t\t\r\n\tvoid\t\tmarkUpRender\t\t() {\tm_status |= RENDER_CHANGE;\tmarkUpTree();\t}\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpMatrix\t\t() {\tm_status |= MATRIX_CHANGE;\tmarkUpTree();\t}\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpCustom\t\t() {\tm_status |= CUSTOM_CHANGE;\tmarkUpTree();\t}\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpColor\t\t\t() {\tm_status |= CMATRIX_CHANGE; markUpTree();   }\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpMatrixAndColor() {\tm_status |= MATRIX_CHANGE | CMATRIX_CHANGE; markUpTree(); }\r\n\r\n\tvoid\t\tsetVisible\t\t\t(bool isVisible);\r\n\t\r\n\tinline \r\n\tbool\t\tisVisible\t\t\t()\t{ return (m_status & (INVISIBLE_UPPER | INVISIBLE)) == 0; }\r\n\r\n\tinline\r\n\tCKLBNode*\tgetChild\t\t\t()\t{ return m_pChild;\t}\r\n\r\n\tinline\r\n\tCKLBNode*\tgetBrother\t\t\t()\t{ return m_pBrother; }\r\n\r\n\tinline\r\n\tCKLBNode*\tgetParent\t\t\t()\t{ return m_parent;\t}\r\n\r\n\tinline\r\n\tu16\t\t\tgetLayer\t\t\t()\t{ return m_layer;\t}\r\n\r\n\tvoid\t\tsetRender\t\t\t(CKLBRenderCommand* pRender, u32 index = 0);\r\n\r\n\tvoid\t\tsetRenderOnDestroy\t(bool delete_) { this->m_deleteRender = delete_; }\r\n\r\n\tCKLBNode*\tsearchCommand\t\t(CKLBRenderCommand* comm);\r\n\r\n\tinline\r\n\tCKLBRenderCommand*\tgetRender\t(u32 index = 0)\t{\r\n\t\tklb_assert(index < m_renderCount, \"invalid render index\");\r\n\t\treturn m_pRender[index];\r\n\t}\r\n\r\n\tvoid\t\tsetTranslate\t\t(float x, float y)\t{\r\n\t\tif ((x != m_matrix.m_matrix[MAT_TX]) || (y != m_matrix.m_matrix[MAT_TY])) {\r\n\t\t\tm_status |= MATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\t\t\tm_matrix.m_matrix[MAT_TX] = x;\r\n\t\t\tm_matrix.m_matrix[MAT_TY] = y;\r\n\t\t\tif (m_matrix.m_type == MATRIX_ID) {\r\n\t\t\t\tm_matrix.m_type = MATRIX_T;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvoid\t\tsetRotation\t\t\t(float deg) {\r\n\t\tfloat rot = (deg * ((float)((M_PI) / 180.0)));\r\n\t\tif (rot != m_rot) {\r\n\t\t\tm_rot = rot;\r\n\t\t\trecMatrix();\r\n\t\t}\r\n\t}\r\n\r\n\tvoid\t\tsetScale\t\t\t(float scaleX, float scaleY) {\r\n\t\tif ((m_scaleX != scaleX) || (m_scaleY != scaleY)) {\r\n\t\t\tm_scaleX\t= scaleX;\r\n\t\t\tm_scaleY\t= scaleY;\r\n\t\t\trecMatrix();\r\n\t\t}\r\n\t}\r\n\r\n\tvoid\t\tsetScaleRotation\t(float scaleX, float scaleY, float deg) {\r\n\t\tfloat rot = (deg * ((float)((M_PI) / 180.0)));\r\n\t\tif ((m_scaleX != scaleX) || (m_scaleY != scaleY) || (rot != m_rot)) {\r\n\t\t\tm_scaleX\t= scaleX;\r\n\t\t\tm_scaleY\t= scaleY;\r\n\t\t\tm_rot = rot;\r\n\t\t\trecMatrix();\r\n\t\t}\r\n\t}\r\n\r\n\t#define _epsilon\t\t(0.00001f)\r\n\r\n\tvoid\t\trecMatrix\t\t\t() {\r\n\t\tif (fabs(m_rot) < _epsilon) {\r\n\t\t\tm_status |= MATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\t\t\tm_matrix.m_matrix[MAT_A] = m_scaleX;\r\n\t\t\tm_matrix.m_matrix[MAT_D] = m_scaleY;\r\n\t\t\tm_matrix.m_matrix[MAT_B] = 0.0f;\r\n\t\t\tm_matrix.m_matrix[MAT_C] = 0.0f;\r\n\t\t\tif (m_matrix.m_type < MATRIX_TS) {\r\n\t\t\t\tm_matrix.m_type = MATRIX_TS;\r\n\t\t\t} else {\r\n\t\t\t\tif ((m_scaleX <= (1.0f+_epsilon)) && (m_scaleX >= (1.0f-_epsilon)) && (m_scaleY >= (1.0f-_epsilon)) && (m_scaleY <= (1.0f+_epsilon))) {\r\n\t\t\t\t\tm_matrix.m_type = MATRIX_T;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tm_status |= MATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\r\n\t\t\tfloat cosT = cos(m_rot);\r\n\t\t\tfloat sinT = sin(m_rot);\r\n\r\n\t\t\tm_matrix.m_matrix[MAT_A] =   cosT  * m_scaleX;\r\n\t\t\tm_matrix.m_matrix[MAT_B] = (-sinT) * m_scaleY;\t// or X / Y ?\r\n\r\n\t\t\tm_matrix.m_matrix[MAT_C] =   sinT  * m_scaleX;\r\n\t\t\tm_matrix.m_matrix[MAT_D] =   cosT  * m_scaleY;\r\n\r\n\t\t\tm_matrix.m_type = MATRIX_TG;\r\n\t\t}\r\n\t}\r\n\r\n\tfloat*\t\tsetMatrix\t\t\t() {\r\n\t\tm_status |= MATRIX_CHANGE;\r\n\t\tm_matrix.m_type = MATRIX_TG;\r\n\t\tmarkUpTree();\r\n\t\treturn m_matrix.m_matrix;\r\n\t}\r\n\r\n\tinline\tvoid getColorMatrix\t\t(SColorVector& color) {\r\n\t\tcolor = this->m_localColorMatrix;\r\n\t}\r\n\r\n\tvoid\t\tsetColorMatrix\t\t(SColorVector color) {\r\n\t\tm_status |= CMATRIX_CHANGE;\r\n\t\tm_localColorMatrix = color;\r\n\r\n\t\tif (\t(m_localColorMatrix.m_vector[0] != 1.0f) || \r\n\t\t\t\t(m_localColorMatrix.m_vector[1] != 1.0f) || \r\n\t\t\t\t(m_localColorMatrix.m_vector[2] != 1.0f) || \r\n\t\t\t\t(m_localColorMatrix.m_vector[3] != 1.0f) ) {\r\n\t\t\tm_pColorMatrix\t\t= &m_colorMatrix;\r\n\t\t\tm_useParentColor\t= false;\r\n\t\t} else {\r\n\t\t\tm_pColorMatrix\t\t= this->m_parent->m_pColorMatrix;\r\n\t\t\tm_useParentColor\t= true;\r\n\t\t}\r\n\r\n\t\tmarkUpTree();\r\n\t}\r\n\r\n\tinline void applyColor(CKLBRenderCommand* pRender) {\r\n\t\tconst float* pVec = m_pColorMatrix->m_vector;\r\n\t\tpRender->setColor(pVec);\r\n\t}\r\n\r\n\tinline float getScaleX      ()\t{ return m_scaleX;\t}\r\n\tinline float getScaleY      ()\t{ return m_scaleY;\t}\r\n\tinline float getRotation    ()\t{ return m_rot;\t\t}\r\n\tinline float getTranslateX  ()\t{ return m_matrix.m_matrix[MAT_TX]; }\r\n\tinline float getTranslateY  ()\t{ return m_matrix.m_matrix[MAT_TY]; }\r\n\r\n\tbool\tsetRenderSlotCount\t(u32 slot);\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tstatic u32\ts_vertexRecomputeCount;\r\n\tstatic u32\ts_matrixRecomputeCount;\r\n\tstatic u32  s_colorRecomputeCount;\r\n#endif\r\nprotected:\r\n\r\n\t// Should be visible from friend class.... but it is not !\r\n\tenum FLAGS_STATE {\r\n\t\t//\r\n\t\t// Change Flags\r\n\t\t//\r\n\t\tMATRIX_CHANGE\t= 0x0001,\r\n\t\tCMATRIX_CHANGE\t= 0x0002,\r\n\t\tCUSTOM_CHANGE\t= 0x0004,\r\n\t\tRENDER_CHANGE\t= 0x0008,\r\n\t\tANY_CHANGE\t\t= MATRIX_CHANGE | CMATRIX_CHANGE | CUSTOM_CHANGE | RENDER_CHANGE,\t// Force all recomputation\r\n\t\tMARKED\t\t\t= 0x0010,\r\n\t\t// 0x0020\t\t: Free\r\n\t\t// 0x0040\t\t: Free\r\n\r\n\t\t//\r\n\t\t// State Flags\r\n\t\t//\r\n\t\tINVISIBLE\t\t= 0x0100,\r\n\t\tINVISIBLE_UPPER\t= 0x0200,\r\n\r\n\t\t//\r\n\t\t// Various flags.\r\n\t\t//\r\n\t\tUNSET\t\t\t= 0x2000,\t// Used for recursion param\r\n\t\tUI_TYPE\t\t\t= 0x0080,\t// Exit just casting purpose.\r\n\t\tANIMATED\t\t= 0x4000\r\n\t};\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t//   Tree Management.\r\n\t// ------------------------------------------------------------------------\r\nprotected:\r\n\r\n\t// TODO LATER RP : Node can support its own render surface.\r\n\r\n\t//\r\n\t// Tree Management\r\n\t//\r\n\tCKLBNode*\r\n\t\t\tgetNode\t\t\t\t(u16 layer);\r\n\tvoid\tupdateMatrices\t\t();\r\n\tvoid\tclearSubTree\t\t();\r\n\r\n\tvoid\tvisibleUpperRecursive();\r\n\tvoid\tinvisibleUpperRecursive();\r\n\r\n\r\n\tvirtual\r\n\tvoid\tvisibleSelf\t\t\t();\r\n\r\n\tvirtual\r\n\tvoid\tinvisibleSelf\t\t();\r\n\r\n\tvirtual\r\n\tvoid\taddRender\t\t();\r\n\r\n\tvirtual\r\n\tvoid\tremoveRender\t();\r\n\r\n\tvoid\tsetRenderRef(CKLBRenderCommand* pRender, u32 indexRender);\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t//\tAnimation Management.\r\n\t// ------------------------------------------------------------------------\r\npublic:\t// Public for now...\r\n\t// Inside Animation Update\r\n\tinline bool\t\t\tisAnimating()\t\t{ return m_isAnimated; }\r\n\t// Animation Complete or not\r\n\tinline bool\t\t\tisStillAnimating()\t{ return (m_status & ANIMATED) ? true : false; }\r\n\r\nprotected:\r\n\tvoid\t\t\t\treleaseSlots();\r\n\r\n// Refactored for more compact class.\r\npublic:\t\tSMatrix2D \t\t\tm_matrix;\r\npublic:\t\tSMatrix2D\t\t\tm_composedMatrix;\r\npublic:\t\tSColorVector\t\tm_colorMatrix;\r\npublic:\t\tSColorVector\t\tm_localColorMatrix;\r\n\r\nprotected:\tconst char*\t\t\tm_name;\t\t\t// form name\r\nprotected:\tCKLBUITask*\t\t\tm_uitask;\r\nprotected:\tCKLBNode*\t\t\tm_pChild;\r\nprotected:\tCKLBNode*\t\t\tm_pBrother;\r\nprotected:\tCKLBNode*\t\t\tm_parent;\r\n\r\nprotected:\tCKLBNode*\t\t\tm_pAnimationNext;\r\nprotected:\tCKLBNode*\t\t\tm_pAnimationPrev;\r\n\r\npublic:\t\tSColorVector*\t\tm_pColorMatrix;\r\nprotected:\tCKLBRenderCommand**\tm_pRender;\r\nprotected:\tCKLBRenderCommand*\tm_renderSlot;\r\n\r\npublic:\t\tfloat\t\t\t\tm_rot;\r\npublic:\t\tfloat\t\t\t\tm_scaleX;\r\npublic:\t\tfloat\t\t\t\tm_scaleY;\r\nprotected:\tu32\t\t\t\t\tm_renderCount;\r\n\r\nprotected:\tu16\t\t\t\t\tm_groupID;\r\npublic:\t\tu16\t\t\t\t\tm_status;\r\nprotected:\tu16\t\t\t\t\tm_layer;\r\n\t// Was necessary in flash and necessary for flash leaf too.\r\n\t// Can reuse in other systems. \r\npublic:\t\tu16\t\t\t\t\tm_movieID;\r\npublic:\t\tu16\t\t\t\t\tm_updateFrame;\r\nprivate:\tu16\t\t\t\t\tm_nameLength;\r\n\r\nprotected:\tbool\t\t\t\tm_isAnimated;\r\nprotected:\tbool\t\t\t\tm_deleteRender;\r\nprotected:\tbool\t\t\t\tm_bInternalNode;\r\npublic:\t\tbool\t\t\t\tm_useParentColor;\r\nprotected:  bool\t\t\t\tm_reject;\r\n\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBNodeAnimPack.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBNodeAnimPack_h\r\n#define CKLBNodeAnimPack_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBNode.h\"\r\n\r\n\r\n// アニメーションノードを持たせるためのパッケージ\r\nclass CKLBNodeAnimPack\r\n{\r\npublic:\r\n\tCKLBNodeAnimPack();\r\n\tvirtual ~CKLBNodeAnimPack();\r\n\r\n\tbool                setCallback(const char * callback);\r\n\tinline const char * getCallback() { return m_callback; }\r\n\r\n\tbool skipAnim   (CKLBNode * pNode, const char * name);\r\n\tbool kickAnim   (CKLBNode * pNode, const char * name, bool doBlend, int id = 0, bool kill = false);\r\n\r\n\tbool kickEnter  (CKLBNode * pNode);\r\n\tbool kickLeave  (CKLBNode * pNode);\r\n\r\n\tvoid watchFinishedAnim(CKLBLuaTask * pTask);\r\n\r\n\tint getAnimCounter(const char * name);\r\n\r\nprivate:\r\n\tstruct ANIMCOUNT {\r\n\t\tANIMCOUNT\t*\tprev;\r\n\t\tANIMCOUNT\t*\tnext;\r\n\t\tCKLBNode\t*\tnode;\t// コマンド発行ノード\r\n\t\tconst char\t*\tname;\t// アニメーションラベル\r\n\t\tint\t\t\t\tid;\t\t// 実行時に与えられたID値\r\n\t\tbool\t\t\tkill;\t// アニメーション終了時、タスクにkill発行\r\n\t\tu32\t\t\t\tcount;\t// アニメーションノード数のrefCount\r\n\t};\r\n\r\n\tANIMCOUNT\t\t*\tm_begin;\r\n\tANIMCOUNT\t\t*\tm_end;\r\n\r\n\tconst char\t\t*\tm_callback;\r\n\r\n\tbool\t\t\t\tm_enterBlend;\r\n\r\n\tstatic const char * ms_labelEnter;\r\n\tstatic const char * ms_labelLeave;\r\n};\r\n\r\n#endif // CKLBNodeAnimPack_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBNodeVirtualDocument.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLBVIRTUALDOCUMENTNODE__\r\n#define __CKLBVIRTUALDOCUMENTNODE__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"string.h\"\r\n\r\nenum ECOMMAND {\r\n\tDRAWLINE,\r\n\tDRAWRECT,\r\n\tFILLRECT,\r\n\tFILLRECTFORCE,\r\n\tDRAWIMAGE,\r\n\tDRAWIMAGETILED,\r\n\tDRAWTEXT,\r\n};\r\n\r\nstruct SDrawCommand {\r\n\t// SDrawCommand*\tnext; /* Not used for now */\r\n\t// Can add other pointer later on to more optimized data structure.\r\n\tvoid*\t\t\tptr;\t// Image or string buffer\r\n\tvoid*\t\t\ttxt;\t// text to display inside string buffer\r\n\ts16\t\t\t\ty0;\r\n\ts16 \t\t\tx0;\r\n\ts16 \t\t\ty1;\r\n\ts16 \t\t\tx1;\r\n\ts16\t\t\t\tsdx;\r\n\ts16\t\t\t\tsdy;\r\n\ts16\t\t\t\tsx0;\r\n\ts16\t\t\t\tsy0;\r\n\tu32\t\t\t\tcolor;\r\n\tECOMMAND\t\tcommand;\r\n\tu8\t\t\t\tfntIdx;\r\n\tbool\t\t\tswap;\r\n};\r\n\r\nstruct RenderContext {\r\n\tu32* pBuffer;\r\n\ts32  stride;\r\n\ts32\tclipX0;\r\n\ts32\tclipY0;\r\n\ts32 clipX1;\r\n\ts32 clipY1;\r\n\ts32 offsetX;\r\n\ts32 offsetY;\r\n\ts32 targetWidth;\r\n\ts32 targetHeight;\r\n\tu8\tformat;\r\n\r\n\tvoid translate\t(s32 offsetX, s32 offsetY) {\r\n\t\tthis->offsetX = offsetX;\r\n\t\tthis->offsetY = offsetY;\r\n\t}\r\n\r\n\tvoid setClip\t(s32 x0, s32 y0, s32 x1, s32 y1);\t\t\t\t//Only command in buffer space (no translate)\r\n\tvoid drawLine\t(s32 x0, s32 y0, s32 x1, s32 y1, u32 color);\r\n\tvoid drawRect\t(s32 x0, s32 y0, s32 x1, s32 y1, u32 color);\r\n\tvoid fillRect\t(s32 x0, s32 y0, s32 x1, s32 y1, u32 color, bool forceFill);\r\n\tvoid drawText\t(s32 x , s32 y , char* string  , u32 color, void* font, bool docMode);\r\n\tvoid drawImage\t(s32 x , s32 y , SDrawCommand* img  , u8  alpha);\r\nprivate:\r\n\tvoid setPixelClip\t\t(s32 x1, s32 y1, u32 color);\r\n\tvoid setPixelClip4444\t(s32 x1, s32 y1, u16 color);\r\n};\r\n\r\n// Just for FORMAT_8 / FORMAT_8888 constant.\r\n#include \"CKLBTexturePacker.h\"\r\n\r\n/*!\r\n* \\class CKLBNodeVirtualDocument\r\n* \\brief Virtual Doument Specilized Node Class\r\n* \r\n* CKLBNodeVirtualDocumentis in charge of the graphic operations\r\n* on a Virtual Document.\r\n*/\r\nclass CKLBNodeVirtualDocument : public CKLBNode {\r\npublic:\r\n\t/*\r\n\tstatic const int\tVDFORMAT_8\t\t\t= FORMAT_8;\t\t// Not supported yet.\r\n\tstatic const int\tVDFORMAT_8888\t\t= FORMAT_8888;\r\n\tstatic const int\tVDFORMAT_4444\t\t= FORMAT_4444;\r\n\t*/\r\n\r\n\tCKLBNodeVirtualDocument();\r\n\t~CKLBNodeVirtualDocument();\r\n\r\n\tu32 getClassID() { return CLS_KLBNODEVIRTUALDOC; }\r\n\r\n\tvoid\tsetFont\t\t\t(u8 index, const char* fontName, u16 fontSize);\r\n\tvoid\tsetDocumentSize\t(u32 width, u32 height, bool scrollVertical = true);\r\n\tbool\tsetViewPortSize\t(u32 width, u32 height, float alignOffsetX, float alignOffsetY, u32 priority, bool doScroll);\r\n\tvoid\tsetViewPortPos\t(s32 x,     s32 y);\r\n\tbool\tcreateDocument\t(u16 maxCommandCount, u8 format);\r\n\tvoid\tfreeDocument\t();\r\n\tvoid\tfreeFont\t\t();\r\n\r\n\tvoid\tlockDocument\t();\r\n\tvoid\tunlockDocument\t();\r\n\tvoid\temptyDocument\t();\r\n\r\n\tvoid\tclear\t\t\t(u32 fillColor);\r\n\tvoid\tdrawLine\t\t(s16 x0, s16 y0, s16 x1,    s16 y1,     u32 color);\r\n\tvoid\tdrawRect\t\t(s16 x0, s16 y0, u16 width, u16 height, u32 color);\r\n\tvoid\tfillRect\t\t(s16 x0, s16 y0, u16 width, u16 height, u32 color, bool fill = false);\r\n\tvoid\tdrawImage\t\t(s16 x0, s16 y0, CKLBImageAsset* img, u8 alpha);\r\n\tvoid\tdrawTileImage\t(s16 x0, s16 y0, u16 width, u16 height, CKLBImageAsset* img, u8 alpha);\r\n\tvoid\tdrawText\t\t(s16 x0, s16 y0, const char* string, u32 color, u8 fontIndex,\r\n\t\t\t\t\t\t\t u8 align_mode = 0, s16 align_width = 0\t// addhook parameters.\r\n\t\t\t\t\t\t\t );\r\n\r\n\ts32\t\tgetViewPortPosX\t()\t{ return m_posX; }\r\n\ts32\t\tgetViewPortPosY\t()\t{ return m_posY; }\r\n\r\n\tvoid\tcheck();\r\n\r\n\tvoid\tsetPriority(u32 renderPriority);\r\n\r\n\tvoid\tforceRefresh\t();\r\nprotected:\r\n\tstatic\r\n\tvoid\tdocTextureCompaction(void* ctx, u16 oldsurface, u16 newSurface);\r\n\r\n\tvoid\tclearRessources\t(bool freeSurface, bool freeFonts);\r\n\tvoid\trenderDocument\t();\r\n\tvoid\tsetVertex\t\t(CKLBDynSprite* pSpr, u32 idx4, float x0, float y0, float u, float v);\r\n\tvoid\tsetTargetSurface(u8 index, s32 offsetX, s32 offsetY);\r\n\tvoid\tupdateDynSprites(u8 index);\r\n\r\n\r\n\tfloat\t\t\tm_alignOffsetX;\r\n\tfloat\t\t\tm_alignOffsetY;\r\n\ts32\t\t\t\tm_posX;\r\n\ts32\t\t\t\tm_posY;\r\n\tSDrawCommand*\tm_commandArray;\r\n\tu16\t\t\t\tm_commandMaxCount;\r\n\tu16\t\t\t\tm_CurrentCommand;\r\n\r\n\tstruct VDOCDRAW {\r\n\t\tCKLBDynSprite\t*\ttile;\t\t\t\t// 描画用スプライト\r\n\t\tfloat\t\t\t\tupV;\r\n\t\tfloat\t\t\t\tbottomV;\r\n\t\tfloat\t\t\t\tleftU;\r\n\t\tfloat\t\t\t\trightU;\r\n\r\n\t\tfloat\t\t\t\tstepU;\r\n\t\tfloat\t\t\t\tstepV;\r\n\t\tu32\t\t\t\t*\tsoftwareBufTile;\t// 対応するソフトウェアバッファ\r\n\t\tu16\t\t\t\t\tsurf_handle;\t\t// 対応するsurfaceのハンドル\r\n\t\tu8\t\t\t\t\tformat;\r\n\t};\r\n\r\n\tVDOCDRAW\t\tm_drawarea[2];\r\n\r\n\t/*\r\n\t// m_drawarea[] は、以前のバージョンにおける下記メンバを置き換えるものとなる。\r\n\r\n\tu16\t\t\t\tm_surfA;\r\n\tu16\t\t\t\tm_surfB;\r\n\tu32*\t\t\tm_softwareBufferTile[2];\t// ViewPort x 2\r\n\tCKLBDynSprite*\tm_tile\t\t[2];\r\n\tfloat\t\t\tupV\t\t\t[2];\r\n\tfloat\t\t\tbottomV\t\t[2];\r\n\tfloat\t\t\tleftU\t\t[2];\r\n\tfloat\t\t\trightU\t\t[2];\r\n\t// u32\t\t\tm_textureX\t[2];\r\n\t// u32\t\t\tm_textureY\t[2];\r\n\r\n\t// 2 tiles inside SAME texture : u v step are the same.\r\n\tfloat\t\t\tstepU\t\t[2];\r\n\tfloat\t\t\tstepV\t\t[2];\r\n\t*/\r\n\tbool\t\t\tm_isVertical;\r\n\tbool\t\t\tm_bScroll;\r\n\r\n\tCTexture*\t\tm_texture;\r\n\t\r\n\tu32\t\t\t\tm_bgColor;\r\n\r\n\tSTextInfo\t\tfontInfo\t[5];\r\n\tvoid*\t\t\tfont\t\t[5];\r\n\r\n\t// 2 tiles inside SAME texture : u v step are the same.\r\n\r\n\tu32\t\t\t\tm_viewPortHeight;\r\n\tu32\t\t\t\tm_viewPortWidth;\r\n\ts16\t\t\t\tm_currTile;\r\n\ts16\t\t\t\tm_prevTile;\r\n\ts16\t\t\t\tm_scroll;\r\n\ts16\t\t\t\tm_prevScroll;\r\n\tu8\t\t\t\tm_currBuff;\r\n\tu8\t\t\t\tm_up;\r\n\tu8\t\t\t\tm_format;\r\n\tbool\t\t\tm_bDisplay;\r\n\r\n\tbool\t\t\tm_bHasChanged;\r\n\r\n\ts32\t\t\t\tm_tileXStart;\r\n\ts32\t\t\t\tm_tileYStart;\r\n\ts32\t\t\t\tm_tileXEnd;\r\n\ts32\t\t\t\tm_tileYEnd;\r\n\ts32\t\t\t\tm_documentWidth;\r\n\ts32\t\t\t\tm_documentHeight;\r\n\r\n\tRenderContext\trenderContext;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBOSCtrlEvent.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBOSCtrlEvent.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CKLBOSCtrlEvent_h\r\n#define CKLBOSCtrlEvent_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"OSWidget.h\"\r\n\r\nstruct OSCTRL {\r\n\tIClientRequest::EVENT_TYPE\t\ttype;\r\n\tIWidget\t\t\t\t\t\t*\twidget;\r\n\r\n\tu32\t\t\t\t\t\t\t\tsize1;\r\n\tvoid\t\t\t\t\t\t*\tdata1;\r\n\r\n\tu32\t\t\t\t\t\t\t\tsize2;\r\n\tvoid\t\t\t\t\t\t*\tdata2;\r\n};\r\n\r\nclass CKLBOSCtrlQueue\r\n{\r\nprivate:\r\n    CKLBOSCtrlQueue();\r\n    virtual ~CKLBOSCtrlQueue();\r\npublic:\r\n    static CKLBOSCtrlQueue& getInstance();\r\n\r\n    void addQueue(IClientRequest::EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\t\t\tu32 datasize1 = 0, void * pData1 = NULL,\r\n\t\t\t\t\tu32 datasize2 = 0, void * pData2 = NULL);\r\n\r\n    // キューの取得限界を現在の点に固定\r\n    inline void fixLimit() {\r\n        m_read  = m_begin;\r\n        m_begin = m_rec;\r\n\t\tm_optIdx = 1 - m_optIdx;\t\t\t// 書き込み側 index の表裏を入れ替える\r\n\t\tm_optData[m_optIdx].topidx = 0;\t\t// 書き込み先頭を初期化\r\n    }\r\n    \r\n    // キューの参照点を読み出し先頭に指定する\r\n    void startItem() {\r\n        m_get = m_read;\r\n    }\r\n    \r\n    // 特定のWidgetに関連したキューのアイテムを取得する\r\n    const OSCTRL * getItem(IWidget * pWidget) {\r\n\t\tconst OSCTRL * ret;\r\n\t\tdo {\r\n\t\t\tif(m_get == m_begin) return 0;  // これ以上読んではいけない\r\n\t\t\tret = m_ctrl + m_get;\r\n\t        m_get = ++m_get % MAX_EVENT;\r\n\t\t} while(ret->widget != pWidget);\t// 異なるWidgetに対するものであればスキップする\r\n        return ret;\r\n    }\r\n\r\nprivate:\r\n\tvoid * allocData(u32 size, void * pData, u32& retsize);\r\n\r\n    enum {\r\n        MAX_EVENT   = 1024,\r\n\t\tMAX_DATALEN = 4096 * 32,\r\n    };\r\n    int             m_begin;        // 記録先頭\r\n    int             m_rec;          // 記録点\r\n    int             m_read;         // 読み出し先頭\r\n    int             m_get;          // 取得点\r\n    \r\n\r\n    OSCTRL          m_ctrl[ MAX_EVENT ];\r\n\r\n\tstruct OPTDATA {\r\n\t\tint\t\ttopidx;\r\n\t\tchar\tstrbuf[ MAX_DATALEN ];\r\n\t};\r\n\r\n\tint\t\t\t\tm_optIdx;\r\n\tOPTDATA\t\t\tm_optData[2];\r\n};\r\n\r\n\r\n/*!\r\n* \\class CKLBOSCtrlEvent\r\n* \\brief OS Control Event Task class.\r\n* \r\n* CKLBOSCtrlEvent is the class in charge of handling the OS events.\r\n* Each frame it allows some events to be visible for the Engine.\r\n*/\r\nclass CKLBOSCtrlEvent : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBOSCtrlEvent();\r\n    virtual ~CKLBOSCtrlEvent();\r\n    \r\n\tbool onPause(bool bPause);\r\n    \r\npublic:\r\n    static CKLBOSCtrlEvent * create();\r\n    \r\n    void execute(u32 deltaT);\r\n    void die    ();\r\n    \r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif // CKLBOSCtrlEvent_h\r\n\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBObject.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Base System for object reflection mecanism, allocation ===\r\n//\r\n//\r\n\r\n#ifndef __KLB_OBJECT_BASE__\r\n#define __KLB_OBJECT_BASE__\r\n\r\n\r\n#include \"BaseType.h\"\r\n\r\nclass CKLBStream;\r\nclass CKLBObject;\r\n\r\nclass CKLBContext {\r\n\t// Perform allocation.\r\n\tfriend class CKLBObject;\r\npublic:\r\n\tCKLBContext\t\t();\r\n\t~CKLBContext\t();\r\n\r\n\tstatic\t\t\t\r\n\tCKLBContext*\tgetContext\t\t();\r\n\t\r\nprotected:\r\n\tvoid*\t\t\tallocate\t\t(unsigned int numByte);\r\n\tvoid\t\t\tdisallocate\t\t(void* ptr);\r\n};\r\n\r\nclass CKLBObject {\r\n\tfriend class CKLBStream;\r\n\tfriend class CKLBContext;\r\npublic:\r\n\tCKLBObject():\r\n\t  m_msgListener(NULL)\t{ }\r\n\r\n\tvirtual ~CKLBObject()\t{ /* Do nothing by default */ }\r\n\r\n\tvoid* operator new( size_t num_bytes) {\r\n\t\treturn CKLBContext::getContext()->allocate(num_bytes);\r\n    }\r\n\r\n\tvoid operator delete(void* ptr) {\r\n\t\tif (ptr) {\r\n\t\t\tCKLBContext::getContext()->disallocate(ptr);\r\n\t\t}\r\n    }\r\n\r\n\tvirtual u32 getClassID() = 0;\r\n\r\n\tvirtual void replaceAsset\t(void* ptrAssetOld, void* ptr) {\r\n\t\tptrAssetOld = ptrAssetOld;\r\n\t\tptr = ptr;\r\n\t\t/* Do nothing */ \r\n\t}\r\n\r\n\tvirtual void receiveMsg\t\t(CKLBObject* emitter, u32 msgID, u32 msgParam)\t{ \r\n\t\t/* Do nothing by default */ \r\n\t\temitter = emitter;\r\n\t\tmsgID = msgID;\r\n\t\tmsgParam = msgParam;\r\n\t}\r\nprotected:\r\n\tCKLBObject*\t\tm_msgListener;\r\n\r\n\tinline\r\n\tvoid MsgRegister(CKLBObject* listener)\t{\r\n\t\tklb_assert(!m_msgListener, \"low level message listener already used by somebody else %8x\", m_msgListener);\r\n\t\tm_msgListener = listener;\r\n\t}\t\r\n};\r\n\r\n#ifndef _NULLHANDLER\r\n#define _NULLHANDLER 0xFFFFFFFF\r\n#endif\r\n\r\nclass CKLBObjectScriptable : public CKLBObject {\r\nprivate:\r\n\tu32\t\tm_handle;\r\n\r\npublic:\r\n\tCKLBObjectScriptable\t(unsigned int handle = _NULLHANDLER);\r\n\t~CKLBObjectScriptable\t();\r\n\r\n\tinline\r\n\tvoid setScriptHandle\t(u32 handle)\t\t{ m_handle = handle;\t}\r\n\tinline\r\n\tu32  getScriptHandle\t()\t\t\t\t\t{ return m_handle;\t\t}\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBPauseCtrl.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBPauseCtrl_h\r\n#define CKLBPauseCtrl_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n\r\n/*!\r\n* \\class CKLBPauseCtrl\r\n* \\brief Pause Control Task class\r\n* \r\n* CKLBPauseCtrl allows to add control to a class when you pause and/or resume it, \r\n* as it is not provided by default in a CKLBTask.\r\n* You can register callbacks that will be called when pausing and resuming the Task.\r\n*/\r\nclass CKLBPauseCtrl : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBPauseCtrl>;\r\nprivate:\r\n\tCKLBPauseCtrl();\r\n\tvirtual ~CKLBPauseCtrl();\r\n\r\n\tbool init(CKLBTask* pTask, const char* pause, const char* resume);\r\npublic:\r\n\tstatic CKLBPauseCtrl* create(CKLBTask* pParentTask, const char* pause, const char* resume);\r\n\r\n\tbool initScript\t(CLuaState& lua);\r\n\r\n\tvoid execute\t(u32 deltaT);\r\n\tvoid die\t\t();\r\n\r\nprivate:\r\n\tconst char *\tm_callbackPause;\r\n\tconst char *\tm_callbackResume;\r\n};\r\n\r\n\r\n#endif // CKLBPauseCtrl_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBPropertyBag.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CLB_PROPERTY_BAG\r\n#define __CLB_PROPERTY_BAG\r\n\r\n#include \"BaseType.h\"\r\n\r\n#define MAX_PROP_BUFFER_COUNT\t(2000)\r\n#define STRING_BUFFER_SIZE\t\t(2000)\r\n#define MAX_PROPERTYBAG_COUNT\t(100)\r\n\r\nclass CKLBPropertyBag {\r\npublic:\r\n\tstatic CKLBPropertyBag*\t\tgetPropertyBag\t\t();\r\n\tstatic void \t\t\t\treleasePropertyBag\t(CKLBPropertyBag* pBag);\r\n\t\r\n\tbool\tinit();\r\n\t\r\n\tvoid \tsetPropertyInt\t\t(const char* name, s32 value);\r\n\tvoid\tsetPropertyBool\t\t(const char* name, bool value);\r\n\tvoid\tsetPropertyFloat\t(const char* name, float value);\r\n\tvoid\tsetPropertyString\t(const char* name, const char* value);\r\n\t\r\n\tu32\t\tgetFieldType\t\t(const char* name);\r\n\ts32\t\tgetPropertyInt\t\t(const char* name);\r\n\tbool\tgetPropertyBool\t\t(const char* name);\r\n\tfloat\tgetPropertyFloat\t(const char* name);\r\n\tconst char*\r\n\t\t\tgetPropertyString\t(const char* name);\r\n\t\r\n\ts32\t\tgetIndex(const char* name);\r\nprivate:\r\n\tCKLBPropertyBag();\r\n\t~CKLBPropertyBag();\r\n\t\r\n\tvoid appendProperty();\r\n\tconst char*\tallocateName(const char* originalName, int addlen = 0);\r\n\t\r\n\tstruct _v {\r\n\t\tunion v {\r\n\t\t\tfloat \t\t\tf;\r\n\t\t\ts32\t\t\t\ti;\r\n\t\t\tconst char*\t\ts;\r\n\t\t\tbool\t\t\tb;\r\n\t\t} v;\r\n\t\tconst char* name;\r\n\t};\r\n\t\r\n\t_v*\t\t\tm_propertyValues;\r\n\tu8*\t\t\tm_propertyTypes;\r\n\tu8\t\t\tm_propertyCount;\r\n\tu8\t\t\tm_propertyMax;\t\t// Current buffer size by maximum number of properties.\r\n\tbool\t\tm_free;\r\n\r\n\tCKLBPropertyBag\t\t*\tm_prev;\r\n\tCKLBPropertyBag\t\t*\tm_next;\r\n\r\n\r\n\r\n\tstatic void compact();\r\n/*\r\n\tstatic CKLBPropertyBag \tbags\t\t\t[MAX_PROPERTYBAG_COUNT];\r\n\tstatic _v \t\t\t\tproperties\t\t[MAX_PROP_BUFFER_COUNT];\r\n\tstatic u8\t\t\t\tpropertyTypes\t[MAX_PROP_BUFFER_COUNT];\r\n\tstatic char\t\t\t\tstrings\t\t\t[STRING_BUFFER_SIZE];\r\n\r\n\tstatic u32\t\t\t\tpropAlloc;\r\n\tstatic u32\t\t\t\tbagAlloc;\r\n\tstatic u32\t\t\t\tstringAlloc;\r\n\tstatic bool\t\t\t\tdeletionFlag;\r\n\t*/\r\n\r\n\tstatic CKLBPropertyBag\t*\tms_begin;\r\n\tstatic CKLBPropertyBag\t*\tms_end;\r\n\r\n\tenum {\r\n\t\tPROPERTY_BLOCK_COUNT = 10\r\n\t};\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBRendering.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Rendering System ===\r\n//\r\n//\r\n\r\n#ifndef __CKLB_RENDERING__\r\n#define __CKLB_RENDERING__\r\n\r\n#include \"CKLBAsset.h\"\r\n#include \"TextureManagement.h\"\r\n#include \"RenderingFramework.h\"\r\n\r\nenum RENDERCOMMAND_TYPE {\r\n\tRENDERCOMMAND_SPRITE\t\t\t\t= 0x001,\r\n\tRENDERCOMMAND_CHANGERENDERSTATE\t\t= 0x002,\r\n\tRENDERCOMMAND_CHANGETARGET\t\t\t= 0x004,\r\n\tRENDERCOMMAND_EXECUTECOMMAND\t\t= 0x008,\r\n\tRENDERCOMMAND_SETSHADER\t\t\t\t= 0x010,\r\n\tRENDERCOMMAND_CLEARCOLOR\t\t\t= 0x020,\r\n\tRENDERCOMMAND_CLEARDEPTH\t\t\t= 0x040,\r\n\tRENDERCOMMAND_CLEARSTENCIL\t\t\t= 0x080,\r\n\tRENDERCOMMAND_3D\t\t\t\t\t= 0x100,\r\n\tRENDERCOMMAND_UNSETSHADER\t\t\t= 0x200,\r\n\tRENDERCOMMAND_DEPTHRANGE\t\t\t= 0x400,\r\n\tRENDERCOMMAND_IGNORE\t\t\t\t= 0x800,\r\n};\r\n\r\n// Buffer length have changed\r\n#define FLAG_BUFFERSHIFT\t\t\t\t(0x01)\r\n#define FLAG_XYUPDATE\t\t\t\t\t(0x02)\r\n#define FLAG_COLORUPDATE\t\t\t\t(0x04)\r\n#define FLAG_UVUPDATE\t\t\t\t\t(0x08)\r\n#define FLAG_IGNORERENDER\t\t\t\t(0x10)\r\n\r\n#define VERTEX_SIZE\t\t\t\t\t\t(4)\r\n#define VERTEX_U_IDX\t\t\t\t\t(VERTEX_SIZE - 2)\r\n#define VERTEX_V_IDX\t\t\t\t\t(VERTEX_SIZE - 1)\r\n\r\nclass CKLBRenderingManager;\r\n\r\nclass CKLBRenderCommand {\r\n\tfriend class CKLBRenderingManager;\r\n\tfriend class CKLBNode;\r\npublic:\r\n\tCKLBRenderCommand();\r\n\tvirtual ~CKLBRenderCommand  ()\t{ /* Do nothing */ }\r\n\r\n\tvirtual\t\r\n    void applyNode\t\t(CKLBNode* pNode)\t{ /*Do nothing by default*/pNode = pNode; /*avoid warning*/ }\r\n\t\r\n\tvoid changeOrder\t(CKLBRenderingManager& pRdr, u32 newOrder);\r\n\r\n\tinline\t\r\n    u32 getOrder        ()\t        { return m_uiOrder; }\r\n\r\n\tbool setLocalColor  (u32 color)\t{\r\n\t\t\t\tif (color != m_uiLocalColor) {\r\n\t\t\t\t\tm_uiLocalColor = color;\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\tinline \r\n    bool isInRenderList ()\t\t\t{ return ((this->m_pNext != NULL) || (this->m_pPrev != NULL));\t}\r\n\tinline \r\n    u32\tgetLocalColor   ()\t\t\t{ return m_uiLocalColor; }\r\n\r\nprotected:\r\n\tinline\r\n\tvoid incrementCount()\t\t\t{ m_uiRefCount++; }\r\n\r\n\tinline\r\n\tu8 decrementCount()\t\t\t\t{ if (m_uiRefCount > 0) { return --m_uiRefCount; } else { return 0; } }\r\n\r\n\tvirtual\tvoid setColor\t\t(const float* /*pVec*/)\t{ /*Do nothing by default*/ }\r\n\tCKLBRenderCommand*\tm_pAllocPrev;\r\n\tCKLBRenderCommand*\tm_pAllocNext;\r\n\tCKLBRenderCommand*\tm_pPrev;\r\n\tCKLBRenderCommand*\tm_pNext;\r\n\tu32\t\t\t\t\tm_uiOrder;\r\n\ts32\t\t\t\t\tm_renderOffset;\r\n\tu32\t\t\t\t\tm_uiLocalColor;\r\n\tu16\t\t\t\t\tm_commandType;\r\n\tu8\t\t\t\t\tm_uiStatus;\r\n\tu8\t\t\t\t\tm_uiRefCount;\r\n\tbool\t\t\t\tignore;\r\n};\r\n\r\nclass CKLBRenderState : public CKLBRenderCommand {\r\n\tfriend class CKLBRenderingManager;\r\n\tfriend class CKLBNode;\r\npublic:\r\n\tCKLBRenderState();\r\n\tvirtual ~CKLBRenderState();\r\n\t\r\n\tvirtual\tvoid\t\tapplyNode\t\t(CKLBNode* pNode);\r\n\t\r\n\tinline\r\n\tSRenderState*\t\tgetState\t\t()\t\t\t\t\t\t\t\t\t{ return &internalState;\t}\r\n\r\n\tinline\r\n\tCShaderInstance*\tgetShader\t\t()\t\t\t\t\t\t\t\t\t{ return pShaderInstance;\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\tCKLBRenderCommand*\tsetJump\t\t\t(CKLBRenderCommand*\tjump)\t\t\t{ this->jump = jump;\t\treturn this->jump;  }\r\n\tCKLBRenderCommand*\tsetReturn\t\t(CKLBRenderCommand*\treturn_)\t\t{ this->end\t = return_;\t\treturn this->end;   }\r\n\tvoid\t\t\t\texecuteCommand\t();\r\n\tvoid\t\t\t\tsetUse\t\t\t(bool useRenderState, bool useCommand, CShaderInstance* pShaderInstance);\r\n\tvoid\t\t\t\tsetClearColor\t(bool active, float r, float g, float b, float alpha);\r\n\tvoid\t\t\t\tsetClearDepth\t(bool active, float depth);\r\n\tvoid\t\t\t\tsetDepthRange\t(float startRange, float endRange);\r\n\tvoid\t\t\t\tsetClearStencil\t(bool active, u32 value);\r\n\tvoid\t\t\t\tsetScissor\t\t(bool active, s32 x = 0, s32 y = 0, s32 w = 0, s32 h = 0);\r\n    inline\r\n\tfloat*\t\t\t\tgetPostScissor\t()\t                                { return m_scissorPost;     }\r\nprotected:\r\n\tCKLBRenderCommand*\tjump;\r\n\tCKLBRenderCommand*\tend;\r\n\tCShaderInstance*\tpShaderInstance;\r\n\r\n\tvoid\t\t\t\tsetupShaderParams\t();\r\n\r\n\tfloat\t\t\t\tm_scissor\t\t[4];\r\n\tfloat\t\t\t\tm_scissorPost\t[4];\r\n\r\n\tGLint\t\t\t\tm_stencilClear;\r\n\tfloat\t\t\t    m_depthClear;\r\n\tfloat\t\t\t    m_colorClearRed;\r\n\tfloat\t\t\t    m_colorClearGreen;\r\n\tfloat\t\t\t    m_colorClearBlue;\r\n\tfloat\t\t\t    m_colorClearAlpha;\r\n\tfloat\t\t\t    m_depthStart;\r\n\tfloat\t\t\t    m_depthEnd;\r\n\r\n\tSRenderState internalState;\r\n};\r\n\r\nclass CTextureUsage;\r\nclass CKLBRenderCommand;\r\n\r\nclass CKLBSprite : public CKLBRenderCommand {\r\n\tfriend class CKLBRenderingManager;\r\npublic:\r\n\tCTextureUsage*\t\t\tm_pTexture;\r\n\tCTextureUsage*\t\t\tm_pMaskTexture;\r\n\tCKLBImageAsset*\t\t\tm_pImageAsset;\r\n\r\n\t// Cached pointer from Image Asset\r\n\tfloat*\t\t\t\tm_pVertex;\r\n\tfloat*\t\t\t\tm_pVertexMaskUV;\r\n\tu16*\t\t\t\tm_pIndex;\r\n\tu32*\t\t\t\tm_pColors;\r\n\r\n\t/**\r\n\t\tTriangle count\t\t= vertex count - 2.\r\n\t\tIndex buffer count\t= Triangle count * 3\r\n\t */\r\n\tu16\t\t\t\t\tm_uiVertexCount;\r\n\tu16\t\t\t\t\tm_uiIndexCount;\r\n\r\n\tvirtual\t\tvoid\tapplyNode\t\t(CKLBNode* pNode);\r\n\r\n\tbool\t\tclicked\t\t    (float u, float v);\r\n\r\n\t// Special version for 2D maps.\r\n\tvoid\t\tapplyNode\t    (CKLBNode* pNode, float tx, float ty);\r\n\r\n\tvoid\t\tswitchImage\t    (CKLBImageAsset* pImage);\r\n\tvoid\t\tsetMask\t\t    (CKLBImageAsset* pMask);\r\n\tvoid\t\tsetRenderState\t(SRenderState* pState) { m_pState = pState; }\r\n\tvoid\t\tsetClickID\t    (u32 id);\r\nprotected:\r\n\tvirtual\tvoid setColor\t\t(const float* vec4);\r\n\r\nprotected:\r\n\tSRenderState*\t\tm_pState;\r\n\tu32\t\t\t\t\tm_uiColor;\r\n\tu32\t\t\t\t\tm_click;\r\n\r\n\tu16\t\t\t\t\tm_uiMaxVertexCount;\r\n\tu16\t\t\t\t\tm_uiMaxIndexCount;\r\n\tu8\t\t\t\t\tm_bAllocated;\r\n\t//\r\n\t// Only CKLBRenderManager can construct sprites.\r\n\t//\r\nprotected:\r\n\tCKLBSprite();\r\n\tvirtual ~CKLBSprite();\r\n};\r\n\r\nclass CKLBSprite4_6 : public CKLBSprite {\r\n\tfriend class CKLBRenderingManager;\r\npublic:\r\n\tCKLBSprite4_6();\r\n\t~CKLBSprite4_6();\r\nprivate:\r\n\tfloat\tm_pBuffer[(VERTEX_SIZE+1)*4];\t// 4 vertex XYUV-Color\r\n};\r\n\r\nclass CKLBDynSprite : public CKLBSprite {\r\npublic:\r\n\tstatic const int\tMARK_CHANGE_XY\t= FLAG_XYUPDATE;\r\n\tstatic const int\tMARK_CHANGE_UV\t= FLAG_UVUPDATE;\r\n\r\n\tCKLBDynSprite();\r\n\t~CKLBDynSprite();\r\n\r\n\tbool\tsetTriangleCount(u16 vertexCount, u16 indexCount);\r\n\tvoid\tsetVertexXY\t\t(u32 index, float x, float y);\r\n\tvoid\tsetVertexUV\t\t(u32 index, float u, float v);\r\n\tvoid\tsetVertexColor\t(CKLBNode* owner, u32 index, u32 color);\r\n\tbool\timportXYUV\t\t(CKLBImageAsset* pImage);\r\n\tvoid\tsetTexture\t\t(CKLBImageAsset* pImage);\r\n\tvoid\tsetTexture\t\t(CTextureUsage*\tpUsage);\r\n\tvoid\tsetVICount\t\t(u32 vertexCount, u32 indexCount);\r\n\r\n\tvirtual\tvoid setColor\t\t(const float* vec4);\r\n\r\n\tinline void\t\tmark                (u32 mask)\t{ m_uiStatus |= mask; }\r\n\tinline float*\tgetSrcUVBuffer      ()\t        { return _internalImg.getUVBuffer();\t}\r\n\tinline float*\tgetSrcXYBuffer      ()\t        { return _internalImg.getXYBuffer();\t}\r\n\tinline u16*\t\tgetSrcIndexBuffer   ()\t        { return _internalImg.getIndexBuffer();\t}\r\nprotected:\r\n\tCKLBImageAsset _internalImg;\r\n\tu32*\tm_pLocalColors;\r\n};\r\n\r\nclass CKLBSpriteScale9 : public CKLBDynSprite {\r\npublic:\r\n\tCKLBSpriteScale9();\r\n\t~CKLBSpriteScale9();\r\n\tvoid\tsetWidth\t\t(s32 width);\r\n\tvoid\tsetHeight\t\t(s32 height);\r\n\r\n\tvoid\tuseImage\t\t(CKLBImageAsset* pImage);\r\nprotected:\r\n\tCKLBImageAsset* m_pOriginalImage;\r\n\tfloat\t\t\tm_fRight;\r\n\tfloat\t\t\tm_fBottom;\r\n\ts16\t\t\t\tm_width;\r\n\ts16\t\t\t\tm_height;\r\n\ts16\t\t\t\tm_left;\r\n\ts16\t\t\t\tm_right;\r\n\ts16\t\t\t\tm_middleX;\r\n\ts16\t\t\t\tm_top;\r\n\ts16\t\t\t\tm_bottom;\r\n\ts16\t\t\t\tm_middleY;\r\n\r\n\r\n\tvoid\trecomputeVertex\t(u32 mode);\r\n};\r\n\r\nclass CKLBPolyline : public CKLBDynSprite {\r\npublic:\r\n\tCKLBPolyline();\r\n\t~CKLBPolyline();\r\n\r\n\tbool setMaxPointCount\t(u32 ptsCount);\r\n\tvoid setPointCount\t\t(u32 ptsCount);\r\n\tvoid setPoint\t\t\t(u32 idx, float x, float y);\r\n\tvoid setColor\t\t\t(u32 color);\r\nprotected:\r\n\tvoid recomputeSegment\t(u32 idxSegment);\r\n\r\n\tu16\t\tm_maxPts;\r\n\tfloat*\tm_points;\r\nprivate:\r\n\tvoid release();\r\n};\r\n\r\nclass CKLBCanvasSprite;\r\nclass CIndexBuffer;\r\nclass CBuffer;\r\n\r\nclass CKLBRenderingManager {\r\npublic:\r\n\tinline\r\n\tstatic CKLBRenderingManager& getInstance() {\r\n\t\tstatic CKLBRenderingManager instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release() {\tgetInstance()._release();\t}\r\n\r\n\tbool\t\tsetup(u16 maxVertexCount, u16 maxIndexCount);\r\n\r\n\t// Rendering Allocation.\r\n\tCKLBSprite*         allocateCommandSprite\t    (CKLBImageAsset* pImage, u32 priority = 0);\r\n\tCKLBSprite*         allocateCommandSprite\t    (u16 maxVertexCount, u16 maxIndexcount, u32 priority = 0);\r\n\tCKLBDynSprite*      allocateCommandDynSprite    (u16 vertexCount, u16 indexCount, u32 priority = 0);\r\n\tCKLBCanvasSprite*   allocateCommandCanvasSprite (u32 vertexCount, u32 indexCount, u32 priority = 0);\r\n\tCKLBRenderState*\tallocateCommandState\t    ();\r\n\tCKLBPolyline*       allocateCommandPolyline\t    (u16 maxPointCount, u32 priority);\r\n\r\n\tvoid\t\treleaseCommand\t\t\t(CKLBRenderCommand* pCommand);\r\n\r\n\tvoid\t\tremoveFromRendering\t\t(CKLBRenderCommand* pRender);\r\n\tvoid\t\taddToRendering\t\t\t(CKLBRenderCommand* pRender, u32 uiOrder);\r\n\r\n\t// Rendering.\r\n\tvoid\t\tenableRange\t\t\t\t(u32 start, u32 end, bool active);\r\n\tvoid\t\tdraw\t\t\t\t\t();\r\n\tvoid\t\tdrawOverdraw\t\t\t();\r\n\r\n\tCKLBRenderCommand*\r\n\t\t\t\tdrawClick\t\t\t\t(u32 x, u32 y);\r\n\tvoid\t\tdump\t\t\t\t\t(u32 mask);\r\n\tvoid\t\tdumpMetrics\t\t\t\t();\r\nSRenderState*\tgetTextState\t\t\t()\t        { return &textState; }\r\n\tvoid\t\tsetRenderMode\t\t\t(u32 mode);\r\n\r\n\tvoid\t\trenderOverdraw\t\t\t(u32 mode)\t{ m_bRenderOverDraw = mode; }\r\n\r\n\t//======================================================================================\r\n\t//  Shader support\r\n\t//======================================================================================\r\nprivate:\r\n\tu32\t\t\tm_bRenderOverDraw;\r\n\r\n\tstruct S_SHADERDEF {\r\n\t\tCShaderSet*\t\t\tm_definition;\r\n\t\tCShader*\t\t\tm_pixelShader;\r\n\t\tu8*\t\t\t\t\tm_paramList;\r\n\t};\r\n\r\n\tstruct S_SHADERINSTANCE {\r\n\t\tS_SHADERINSTANCE*\tm_pNext;\r\n\t\tCShaderInstance*\tm_pInstanceShader;\r\n\t\tu32\t\t\t\t\tm_min;\r\n\t\tu32\t\t\t\t\tm_max;\r\n\t\tu8*\t\t\t\t\tm_paramList;\r\n\t};\r\n\r\n\t#define SHADER_DEF_MAX\t\t(20)\r\n\t\r\n\tS_SHADERDEF\t\t\tm_shaderDef[SHADER_DEF_MAX];\r\n\tu8\t\t\t\t\tm_stackParam[1000];\r\n\tu8*\t\t\t\t\tm_stackParamFiller;\r\n\tS_SHADERINSTANCE*\tm_shaderInstanceList;\t// TODO : set NULL at start, delete all when free rendering manager.\r\n\r\n\tCShaderInstance*\tm_stackShader\t[10];\r\n\tu32\t\t\t\t\tm_stackShaderIdx;\r\n\tbool\t\t\t\tm_coloring;\r\n\r\nprotected:\r\n\tvoid initShaderSystem\t\t();\r\n\tvoid destroyShaderSystem\t();\r\n\tvoid completeParameter\t\t();\r\npublic:\r\n\tvoid stackParameter\t\t\t(const char* name, u8 type, QUALITY_TYPE quality);\r\n\tu32  createShaderDefinition\t(const char* shaderCode);\r\n\tvoid destroyShaderDefinition(u32 shaderDefinition);\r\n\t\r\n\tvoid* instanceShader\t\t(u32 shaderDefinition, u32 startRange, u32 endRange);\r\n\tvoid removeShader\t\t\t(void* instanceShader);\r\n\t\r\n\tvoid setShaderParamI\t\t(void* instanceShader, const char* name, GLint* value);\r\n\tvoid setShaderParamF\t\t(void* instanceShader, const char* name, GLfloat* value);\r\n\tvoid setShaderParamTexture\t(void* instanceShader, const char* name, CTextureUsage* value);\r\n\t//======================================================================================\r\n\t//  /Shader support\r\n\t//======================================================================================\r\n\r\nprivate:\r\n\tCKLBRenderingManager\t();\r\n\t~CKLBRenderingManager\t();\r\n\tvoid\t\t_release\t();\r\n\r\n\tCKLBRenderingManager\t(CKLBRenderingManager const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t\t(CKLBRenderingManager const&);\t\t// Dont implement.\r\n\r\n\r\n\tvoid emitDrawCall\t\t(u16*\tpIndexCounter,\r\n\t\t\t\t\t\t\t u16*\toffsetIndex,\r\n\t\t\t\t\t\t\t u16*\toffsetVertex,\r\n\t\t\t\t\t\t\t u16\toffsetVertexHead,\r\n\t\t\t\t\t\t\t CTextureUsage*\tpTextureUsage,\r\n\t\t\t\t\t\t\t CTextureUsage* pMask);\r\n\tCKLBRenderCommand\t\tm_innerWatchDog;\r\n\tCKLBRenderCommand*\t\tm_pListStart;\r\n\tCKLBRenderCommand*\t\tm_pRenderWatchDog;\r\n\tCKLBRenderCommand*\t\tm_pRenderLastModify;\r\n\tCKLBRenderCommand*\t\tm_pAllocatedSpriteList;\r\n\tCIndexBuffer*\t\t\tm_pIdxBuffer;\r\n\tCBuffer*\t\t\t\tm_pVerBuffer;\r\n\tCBuffer*\t\t\t\tm_pColBuffer;\r\n\tSRenderState\t\t\tstate;\r\n\tSRenderState\t\t\ttextState;\r\n\tSRenderState*\t\t\tm_pCurrState;\r\n\r\n\tCShader*\t\t\t\tm_pVShader;\r\n\tCShader*\t\t\t\tm_pPShader;\r\n\tCShaderSet*\t\t\t\tm_pShaderSet;\r\n\tCShaderInstance*\t\tm_pShaderInstance;\r\n\tCShaderInstance*\t\tm_pCurrShader;\r\n\tCTextureUsage*\t\t\tm_pTextureUsage;\r\n\r\n\tu32\t\tm_renderMode;\r\n\tu32\t\tm_callMode;\r\n\tbool\tm_useTextures;\r\n\tbool\tm_useColor;\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tu32 m_vertexCount;\r\n\tu32 m_indexCount;\r\n\tu32 m_spriteCount;\r\n\tu32 m_renderStateChange;\r\n\tu32 m_textureChange;\r\n\tu32 m_totalTransferSize;\r\n\tu32 m_memCopySize;\r\n\tu32 m_drawCall;\r\n\ts64 m_drawTime;\r\n#endif\r\n\r\n};\r\n\r\nvoid useOffsetForImages(bool use);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBSWFPlayer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Flash File support ===\r\n//\r\n//\r\n\r\n#ifndef __SWF_PLAYER__\r\n#define __SWF_PLAYER__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBAsset.h\"\r\n\r\n// Null index, null offset\r\n#define MAIN_MOVIE_IDX\t\t\t(0xFFFE)\r\n\r\n//\r\n// Movie instruction type\r\n//\r\n#define SHOW_FRAME\t\t\t\t(0)\r\n#define PLACE_OBJECT\t\t\t(1)\r\n#define REMOVE_OBJECT\t\t\t(2)\r\n#define PLAY_SOUND\t\t\t\t(3)\r\n#define PLACE_OBJECT_CLIP\t\t(4)\r\n\r\n#define SKIP_SHOW\t\t\t\t(4)\r\n\r\n//\r\n// Structure index\r\n//\r\n#define SIZE_MOVIE_INFO\t\t\t(4)\r\n\r\n#define CODE_NAMEINDEX\t\t\t(0)\r\n\r\n// Index for normal movies\r\n// & Static Images.\r\n\r\n// FrameCount = 0xFFFF : Image asset\r\n// FrameCount = 0x8FFE : Shape\r\n#define CODE_FRAMECOUNT\t\t\t(1)\r\n#define CODE_STARTINDEX\t\t\t(2)\r\n#define CODE_OFFSETX\t\t\t(2)\r\n#define CODE_ENDINDEX\t\t\t(3)\r\n#define CODE_OFFSETY\t\t\t(3)\r\n\r\n#define CODE_SHAPE_DEF_INDEX\t(2)\r\n\r\n//\r\n// m_isDisplaying modes\r\n//\r\n#define STOPPED\t\t\t\t\t(0)\r\n#define PLAYING\t\t\t\t\t(1)\r\n#define STOP_TARGET\t\t\t\t(2)\r\n\r\n//\r\n// Show Frame flow type\r\n//\r\n#define STOP_INSTRUCTION\t\t(0)\r\n#define GOTO_AND_PLAY\t\t\t(1)\r\n#define GOTO_AND_STOP\t\t\t(2)\r\n#define SHOW_FRAME_ONLY\t\t\t(0xFFFF)\r\n\r\ntypedef unsigned int u32;\r\ntypedef unsigned short int u16;\r\ntypedef unsigned char u8;\r\ntypedef u16* u16p;\r\n\r\n// --------------------------------------------------------------------------------\r\n// Player & Related Classes Definition\r\n// --------------------------------------------------------------------------------\r\n\r\nclass SWFPlayer;\r\nclass CKLBSWFMovie;\r\nclass CKLBSWFAsset;\r\nclass SWFBitmap;\r\n\r\n/*!\r\n* \\class CKLBSWFMovie\r\n* \\brief SWF Movie Specialized Node\r\n* \r\n* CKLBSWFMovie is a specialized Node for Flash Movies.\r\n* It provides basic control methods for a Flash Movie.\r\n*/\r\nclass CKLBSWFMovie : public CKLBNode {\r\n\tfriend class CKLBSWFAsset;\r\npublic:\r\n\tCKLBSWFMovie(CKLBSWFAsset* pPlayer, CKLBNode* pParent, u16 layer);\r\n\tvirtual ~CKLBSWFMovie();\r\n\r\n\tvirtual\r\n\tCKLBNode*\tclone\t\t\t\t(CKLBNode* newItem, CKLBNode* parent, CKLBNode* brother, bool transferSpriteOwnership);\r\n\r\n\tinline \r\n\tfloat\t\t\tgetVolumeSE\t\t\t()\t{ return m_volume; }\r\n\tvoid\t\t\tsetVolumeSE\t\t\t(float volume);\r\n\r\n\tvirtual\r\n\tvoid\t\t\tsetPriority\t\t\t(u32 order);\r\n\tu16\t\t\t\tfindCodeFrame\t\t(char* label, u16* pFrameNum);\r\n\tvoid\t\t\tgotoFrame\t\t\t(u16 frame);\r\n\tvoid\t\t\tsetPlay\t\t\t\t(bool play) {\r\n\t\tif (play != m_playMode) {\r\n\t\t\tm_playMode = play;\r\n\t\t\tif (play) {\r\n\t\t\t\tm_isPlaying\t\t\t= m_isPlayingBackup;\r\n\t\t\t} else {\r\n\t\t\t\tm_isPlayingBackup\t= m_isPlaying;\r\n\t\t\t\tm_isPlaying = STOPPED;\r\n\t\t\t}\r\n\r\n\t\t\tCKLBNode* pNode = this->m_pChild;\r\n\t\t\twhile (pNode) {\r\n\t\t\t\tif (pNode->getClassID() == CLS_KLBSWFMOVIE) {\r\n\t\t\t\t\t((CKLBSWFMovie*)pNode)->setPlay(play);\r\n\t\t\t\t}\r\n\t\t\t\tpNode = ((CKLBSWFMovie*)pNode)->m_pBrother; // Stupid C++ protected spec.\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tvirtual u32\t\tgetClassID\t\t\t()\t{ return CLS_KLBSWFMOVIE; }\r\n\r\n\tinline\r\n\tCKLBSWFAsset*\tgetPlayer\t\t\t()\t{ return m_player; }\r\n\r\n\tinline\r\n\tvoid\t\t\tsetListener\t\t\t(CKLBObject* listener) { MsgRegister(listener); }\r\n\r\n\tinline\r\n\tu16\t\t\t\tgetFrameRate\t\t()\t{ return m_msPerFrame; }\r\n\tvoid\t\t\tsetFrameRate\t\t(u16 milliSecPerFrame) {\r\n\t\tif (milliSecPerFrame) {\r\n\t\t\tsetPlay(true);\r\n\t\t\tm_msPerFrame = milliSecPerFrame;\r\n\t\t} else {\r\n\t\t\tsetPlay(false);\r\n\t\t}\r\n\t}\r\n\r\n\ts8\t\t\t\treplaceAsTemplate\t(const char** pArrayString, u32 entryCount);\r\n\r\nprotected:\r\n\r\n\tCKLBSWFAsset*\tm_player;\r\n\tCKLBSWFMovie*\tm_flashRoot;\r\n\r\n\tfloat\t\t\tm_volume;\r\n\tu32\t\t\t\tm_renderOffset;\r\n\tu32\t\t\t\tm_localTime;\r\n\tu32\t\t\t\tm_movieStartCode;\t// Movie definition index IN MOVIE DATA STREAM ( NOT INDEX OF MOVIE ITSELF IN ARRAY )\r\n\tu32\t\t\t\tm_movieCode;\r\n\tu32\t\t\t\tm_movieEndCode;\r\n\tu32\t\t\t\tm_bitBuf;\r\n\tu16\t\t\t\tm_bitPos;\r\n\tu16\t\t\t\tm_uiFrame;\r\n\tu16\t\t\t\tm_msPerFrame;\r\n\tu16\t\t\t\tm_updateFrame;\r\n\tu8\t\t\t\tm_isPlaying;\r\n\tu8\t\t\t\tm_isPlayingBackup;\r\n\tCKLBImageAsset**\tm_aBitmapLoaded;\r\n\ts32*\t\t\tm_convTable;\r\n\tconst char**\tm_nameTable;\r\n\r\n\tbool\t\t\tm_firstFrame;\r\n\tbool\t\t\tm_rebuildSort;\r\n\tbool\t\t\tm_isFlashRoot;\r\n\tbool\t\t\tm_disableJump;\r\n\tbool\t\t\tm_playMode;\r\n\tbool\t\t\tm_supportCaching;\r\n\r\n\tvirtual\r\n\tvoid\t\t\tanimate\t\t\t\t(u32 deltaTimeMilli);\r\n\tvoid\t\t\tnextFrame\t\t\t(u16 frame);\r\n\r\n\tvoid\t\t\tInitBits\t\t\t();\r\n\ts32\t\t\t\tGetSBits\t\t\t(s32 n);\r\n\tu32\t\t\t\tGetBits\t\t\t\t(s32 n);\r\n\r\n\tCKLBImageAsset*\tgetImage\t\t\t(u16 movieID);\r\n\r\nprivate:\r\n\tvoid\t\t\tfreeTables\t\t\t();\r\n\tCKLBNode*\t\taddMovie\t\t\t(u16 movieID, u16 layer);\r\n\tvoid\t\t\tremoveMovie\t\t\t(CKLBNode* pNode);\r\n\tu16\t\t\t\tfindCodeFrame\t\t(u16 frame);\r\n\tvoid\t\t\trebuildSort\t\t\t();\r\n\tvoid\t\t\trebuildRecurse\t\t(CKLBNode* pNode, u32* pIndex, CKLBRenderingManager& pRdr);\r\n\tvoid\t\t\tsetFlashRoot\t\t();\r\n};\r\n\r\nstruct SShape;\r\nstruct SSound;\r\n\r\n/*!\r\n* \\class CKLBSWFAsset\r\n* \\brief Flash Asset Class\r\n* \r\n* Generates an SWF instance from SWF Movie definition.\r\n* This is an asset that stores exported Flash movies from our converter.\r\n* It contains animation information, link to needed images or sound assets and movie structure.\r\n* Various information about label, movie length is also stored.\r\n*/\r\nclass CKLBSWFAsset : public CKLBAsset {\r\n\tfriend class CKLBNodeSWF;\r\n\tfriend class CKLBSWFMovie;\r\npublic:\r\n\tvirtual u32\t\tgetClassID()\t\t{ return CLS_ASSETFLASH; }\r\n\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t{ return ASSET_SWFMOVIE; }\r\n\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 priorityBase = 0);\r\n\t\r\n\tCKLBSWFAsset();\r\n\t~CKLBSWFAsset();\r\n\r\n\tinline\r\n\tchar*\t\tgetConstantString\t(u16 stringIndex) {\r\n\t\tklb_assert(stringIndex < m_uiStringCount, \"Invalid index\");\r\n\t\tklb_assert(m_aConstants, \"No constant\");\r\n\t\treturn m_aConstants[stringIndex];\r\n\t}\r\n\r\n\tinline\r\n\tvoid\t\tsetFrameRate\t\t(u16 milliSecPerFrame) {\r\n\t\tm_msPerFrame = milliSecPerFrame;\r\n\t}\r\n\r\n\tbool\t\tLoadData\t\t\t(u8* pData);\r\n\tCKLBSWFAsset* \r\n\t\t\t\tfindMovieAsset\t\t(char* name);\r\n\tvoid\t\tsetVolumeSE\t\t\t(float volume);\r\n\r\n\tCKLBNode*\taddMovieA\t\t\t(char* name, u16 layer, SMatrix2D* m, CKLBNode* root, const char** templateInfo, u32 pairCount);\r\n\tCKLBNode*\taddMovieB\t\t\t(u16 movieID, u16 layer, SMatrix2D* m, CKLBNode* root, const char** templateInfo, u32 pairCount);\r\n\r\n\tu32\t\t\tgetResourceList\t\t(u32 arraySize, const char** arrayOfString);\r\nprivate:\r\n\tvoid cacheSceneGraph\t\t\t(CKLBSWFMovie* node, u16 frame);\r\n\tbool hasCache\t\t\t\t\t(CKLBSWFMovie* node, u16 frame);\r\n\tvoid restoreSceneGraph\t\t\t(CKLBSWFMovie* node, u16 frame);\r\n\r\n\tCKLBNode*\tfindNode\t\t\t(char* name);\r\n\tu16\t\t\tfindMovie\t\t\t(char* name);\r\n\r\n\tCKLBSWFAsset*\tm_parentSWF;\r\n\r\n\t// Animation frame rate : number of millisecond per frame.\r\n\tu16\t\tm_msPerFrame;\r\n\t\r\n\t//-------------------------------------\r\n\t// Constant Pool.\r\n\tu16\t\t\tm_uiStringCount;\r\n\tu16\t\t\tm_uiTotalCharsCount;\r\n\tchar**\t\tm_aConstants;\r\n\tchar*\t\tm_aChars;\r\n\r\n\t//-------------------------------------\r\n\t// Matrix Information.\r\n\tu16\t\t\tm_uiMatrixCount;\r\n\r\n\t//-------------------------------------\r\n\t// Movie ID when referencing parent.\r\n\tu16\t\t\tm_refMovieID;\r\n\r\n\t//-------------------------------------\r\n\t// Shape Related\r\n\tu16\t\t\tm_uiShapeCount;\r\n\tu32\t\t\tm_uiIndexTotal;\r\n\tu16*\t\tm_pIndex;\r\n\tSShape*\t\tm_shapes;\r\n\r\n\t//-------------------------------------\r\n\t// Audio Related\r\n\tu16\t\t\tm_uiSoundCount;\r\n\tSSound*\t\tm_sounds;\r\n\r\n\t// Array of object : avoid multiple object --> Faster for scripting.\r\n\t// same as : Matrix*\tm_aMatrixArray;\r\n\tfloat*\t\tm_aMatrixData;\r\n\tu8*\t\t\tm_aMatrixType;\r\n\tu32*\t\tm_aMatrixDataIndex;\t// Note : can optimize one indirection with float* computed once.\r\n\r\n\t//-------------------------------------\r\n\t// Stream Information\r\n\tu32*\t\tm_aStreamInstruction;\r\n\tu32\t\t\tm_aStreamSize;\r\n\r\n\t//-------------------------------------\r\n\t// Movie Information\r\n\tu16\t\t\t\t\t\tm_uiMovieCount;\r\n\t\r\n\tstruct SCacheEntry {\r\n\t\tSCacheEntry*\tm_next;\r\n\t\tCKLBSWFMovie*\tm_cacheNode;\r\n\t\tu16\t\t\t\tm_cacheFrame;\r\n\t};\r\n\r\n\tSCacheEntry**\t\t\tm_alistCacheEntries;\r\n\tu32*\t\t\t\t\tm_aMovieInfo; // Array of [movie count * 8] entries.\r\n\tCKLBSWFAsset*\t\t\tm_subAssets;\r\n\tCKLBImageAsset**\t\tm_aBitmapLoaded;\r\n\tbool\t\t\t\t\tm_isMaster;\r\n};\r\n\r\n/*!\r\n* \\class KLBFlashAssetPlugin\r\n* \\brief Flash Asset Plugin Class\r\n* \r\n* KLBFlashAssetPlugin is in charge of loading Flash Assets.\r\n*/\r\nclass KLBFlashAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBFlashAssetPlugin();\r\n\t~KLBFlashAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID()\t\t\t\t\t{ return CHUNK_TAG('F','L','S','H'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader()\t\t\t\t\t{ return 'F';\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension()\t\t\t\t\t{ return \".flsh\"; }\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize);\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBScoreNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//\r\n\r\n#ifndef __SCORE_NODE__\r\n#define __SCORE_NODE__\r\n\r\n#include \"CKLBSplineNode.h\"\r\n\r\n/**\r\n\t- Animate previous character\r\n\t- Animate next character\r\n\t- Animate node itself\r\n */\r\n\r\n/*!\r\n* \\class CKLBScoreNode\r\n* \\brief Score Specialized Node Class\r\n* \r\n* CKLBScoreNode is in charge of animating a Score.\r\n* First, it animates the previous digit.\r\n* The is animates the next digt.\r\n* Finnaly, it animates the node itself.\r\n*/\r\nclass CKLBScoreNode : public CKLBNode {\r\npublic:\r\n\tCKLBScoreNode\t\t\t\t\t\t();\r\n\tvirtual ~CKLBScoreNode\t\t\t\t();\r\n\r\n\tbool init\t\t\t\t\t\t\t(\tu32\t\t\t\t\t\tbasePriority,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\t\t\t\t\toldNumberPriorityOffset,\r\n\t\t\t\t\t\t\t\t\t\t\tCKLBImageAsset* \t\tchar0_9[10],\r\n\t\t\t\t\t\t\t\t\t\t\ts32 \t\t\t\t\tstepX,\r\n\t\t\t\t\t\t\t\t\t\t\ts32 \t\t\t\t\tstepY,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 \t\t\t\t\tscore_length,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\t\t\t\t\tfillWithZero,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\t\t\t\t\tanimAll);\r\n\r\n\tvoid setDot\t\t\t\t\t\t\t(\tCKLBImageAsset*\t\t\tdotAsset, s32 width, s32 height );\r\n\r\n\tvoid setAnimationInternal\t\t\t(\tbool\tisNew,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\tmilliSecondsPlayTime,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\ttimeShift,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\tonlyChange,\r\n\t\t\t\t\t\t\t\t\t\t\tu32\t\ttype,\r\n\t\t\t\t\t\t\t\t\t\t\tu32\t\taffected,\r\n\t\t\t\t\t\t\t\t\t\t\tconst float* arrayParam);\r\n\r\n\tvoid setEnterAnimation\t\t\t\t(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam);\r\n\tvoid setExitAnimation\t\t\t\t(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam);\r\n\tvoid setScore\t\t\t\t\t\t(u32 value, bool animFirstTime);\r\n\tvoid setScoreFloat\t\t\t\t\t(float value, u32 dotPosition, bool animFirstTime);\r\n\tvoid update\t\t\t\t\t\t\t();\r\n\tinline u32\t\tgetScore\t\t\t()\t{ return m_uiScore; }\r\n\tvirtual u32\t\tgetClassID\t\t\t()\t{ return CLS_KLBSCORENODE; }\r\n\r\n\tvirtual\tvoid\tsetPriority\t\t\t(u32 order);\r\nprivate:\r\n\tvoid setDotActive\t\t\t\t\t(u32 position);\r\n\tvoid setScoreInternal\t\t\t\t(u32 value, bool animFirstTime);\r\n\tvoid reAssignAnim\t\t\t\t\t(u32 idx);\r\n\r\n\t#define __SCORE_LEN_MAX__\t(10)\r\n\tCKLBImageAsset*\t\t\tm_font\t\t\t[11];\r\n\tCKLBSplineNode*\t\t\tm_scoreOldNode\t[__SCORE_LEN_MAX__];\r\n\tCKLBSplineNode*\t\t\tm_scoreNewNode\t[__SCORE_LEN_MAX__];\r\n\r\n\tCKLBSprite*\t\t\t\tm_dotSprite;\r\n\tCKLBNode*\t\t\t\tm_dotNode;\r\n\tfloat\t\t\t\t\tm_widthDot;\r\n\tfloat\t\t\t\t\tm_heightDot;\r\n\r\n\tstruct AnimInfo {\r\n\t\ts32 m_milliSecondsPlayTime;\r\n\t\ts32 m_timeShift;\r\n\t\tu32 m_type;\r\n\t\tfloat m_Anim[16];\t\t\r\n\t\tu32 m_affected;\r\n\t\tbool m_hasAnim;\r\n\t};\r\n\r\n\tAnimInfo\t\t\t\tm_animInfo[2];\r\n\r\n\ts32\t\t\t\t\t\tm_stepX;\r\n\ts32\t\t\t\t\t\tm_stepY;\r\n\tu32\t\t\t\t\t\tm_uiScore;\r\n\ts32\t\t\t\t\t\tm_oldNumberPriorityOffset;\r\n\tu8\t\t\t\t\t\tm_oldScore\t\t[__SCORE_LEN_MAX__];\r\n\tu8\t\t\t\t\t\tm_default;\r\n\tu8\t\t\t\t\t\tm_scoreLength;\r\n\tu8\t\t\t\t\t\tm_DotPosition;\r\n\tu8\t\t\t\t\t\tm_prevDotPosition;\r\n\tbool\t\t\t\t\tm_newAnimated;\r\n\tbool\t\t\t\t\tm_oldAnimated;\r\n\tbool\t\t\t\t\tm_animAll;\r\n\tbool\t\t\t\t\tm_bScoreChange;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBScrMgrDefault.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrMgrDefault_h\r\n#define CKLBScrMgrDefault_h\r\n\r\n#include \"IMgrEntry.h\"\r\n\r\nclass CKLBScrMgrDefaultFactory : public IMgrEntry\r\n{\r\npublic:\r\n\tCKLBScrMgrDefaultFactory(const char * name);\r\n\tvirtual ~CKLBScrMgrDefaultFactory();\r\n\r\n\tCKLBScrollMgr * createManager(int argc, int args[]);\r\n\tCKLBScrollMgr * createManagerByProperty(CKLBPropertyBag * pProp);\r\n\r\n\tenum {\r\n\t\tDEFAULT_DELAY = 10\r\n\t};\r\n};\r\n\r\nclass CKLBScrMgrDefault : public CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrMgrDefault(int delay);\r\n\tvirtual ~CKLBScrMgrDefault();\r\n\r\n\tvirtual void setMargin      (int top, int bottom);\r\n\tvirtual void setInitial     (int pos);\r\n\tvirtual void setPosition    (int pos, int dir);\r\n\tvirtual int  getPosition    ();\r\n\tvirtual int  getBarPosition ();\r\n\tvirtual void execute        (u32 deltaT);\r\n\tvirtual bool stillScrolling ();\r\nprivate:\r\n\tfloat\t\tm_speed;\r\n\tfloat\t\tm_posTarget;\r\n\tfloat\t\tm_posNow;\r\n\tint\t\t\tm_delay;\r\n\tint\t\t\tm_mvDir;\r\n};\r\n\r\n\r\n#endif // CKLBScrMgrDefault_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBScrMgrPage.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrMgrPage_h\r\n#define CKLBScrMgrPage_h\r\n\r\n#include \"IMgrEntry.h\"\r\n\r\nclass CKLBScrMgrPageFactory : public IMgrEntry\r\n{\r\npublic:\r\n\tCKLBScrMgrPageFactory(const char * name);\r\n\tvirtual ~CKLBScrMgrPageFactory();\r\n\r\n\tCKLBScrollMgr * createManager(int argc, int args[]);\r\n\tCKLBScrollMgr * createManagerByProperty(CKLBPropertyBag * pProp);\r\n\r\n\tenum {\r\n\t\tDEFAULT_DELAY = 10\r\n\t};\r\n};\r\n\r\nclass CKLBScrMgrPage : public CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrMgrPage(int pagesize, int delay, int offset);\r\n\tvirtual ~CKLBScrMgrPage();\r\n\r\n\tvirtual void setMargin      (int top, int bottom);\r\n\tvirtual void setInitial     (int pos);\r\n\tvirtual void setPosition    (int pos, int dir);\r\n\tvirtual int  getPosition    ();\r\n\tvirtual int  getBarPosition ();\r\n\tvirtual void execute        (u32 deltaT);\r\n\tvirtual bool stillScrolling ();\r\nprivate:\r\n\tint\t\t\tm_pagesize;\t\t// ページサイズ\r\n\tint\t\t\tm_delay;\t\t// ディレイ\r\n\tint\t\t\tm_offset;\r\n\r\n\tfloat\t\tm_speed;\r\n\tfloat\t\tm_posTarget;\t// スクロール目標\r\n\tfloat\t\tm_posNow;\t\t// 現在位置\r\n\tint\t\t\tm_mvDir;\t\t// 移動方向\r\n\tint\t\t\tm_margin_top;\r\n\tint\t\t\tm_margin_bottom;\r\n\r\n\tbool\t\tm_initial;\r\n};\r\n\r\n\r\n#endif // CKLBScrMgrPage_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBScrMgrSolid.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrMgrSolid_h\r\n#define CKLBScrMgrSolid_h\r\n\r\n#include \"IMgrEntry.h\"\r\n\r\nclass CKLBScrMgrSolidFactory : public IMgrEntry\r\n{\r\npublic:\r\n\tCKLBScrMgrSolidFactory(const char * name);\r\n\tvirtual ~CKLBScrMgrSolidFactory();\r\n\r\n\tCKLBScrollMgr * createManager(int argc, int args[]);\r\n\tCKLBScrollMgr * createManagerByProperty(CKLBPropertyBag * pProp);\r\n};\r\n\r\nclass CKLBScrMgrSolid : public CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrMgrSolid();\r\n\tvirtual ~CKLBScrMgrSolid();\r\n\r\n\tvirtual void setMargin      (int top, int bottom);\r\n\tvirtual void setInitial     (int pos);\r\n\tvirtual void setPosition    (int pos, int dir);\r\n\tvirtual int  getPosition    ();\r\n\tvirtual int  getBarPosition ();\r\n\tvirtual void execute        (u32 deltaT);\r\n\tvirtual bool stillScrolling ();\r\nprivate:\r\n\tint\t\t    m_pos;\r\n};\r\n\r\n\r\n#endif // CKLBScrMgrSolid_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBScriptEnv.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __SCRIPT_ENV_\r\n#define __SCRIPT_ENV_\r\n\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBJsonItem;\t// Ptr Param for callback.\r\n\r\nclass CKLBScriptEnv\r\n{\r\nprotected:\r\n    CKLBScriptEnv();\r\n    ~CKLBScriptEnv();\r\n\r\npublic:\r\n    static CKLBScriptEnv& getInstance();\r\n    \r\n\tu32*\t\t\tgetCallCounter\t();\r\n\tu32*\t\t\tgetErrorReader\t();\r\n\tconst char*\t\tgetErrorString\t();\r\n\tvoid\t\t\tresetError\t\t();\r\n\r\n\tbool boot\t\t\t(const char* bootScriptURL);\r\n    bool setupScriptEnv\t();\r\n    void finishScriptEnv();\r\n\r\n    void error\t\t\t(const char * str, ...);\r\n\tvoid errMsg\t\t\t(const char* str);\r\npublic:\r\n\tvoid destroy\t\t\t\t\t(unsigned int handle);\r\n\r\n\tvoid call_onDie\t\t\t\t\t(const char* funcNAme, CKLBObjectScriptable* obj);\r\n\r\n\t// Generic Task\r\n\tvoid call_genTaskExecute\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 deltaT, const char* arrayIndex);\r\n\tvoid call_genTaskDie\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* arrayIndex);\r\n\r\n\t// Timer Task\r\n\tvoid call_intervalTimerExecute\t(const char* funcName, CKLBObjectScriptable* obj, u32 timerID);\r\n\r\n\tvoid call_asyncFileCopy\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 perc, u32 size);\r\n\tvoid call_asyncLoader\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 loaded, u32 total);\r\n\r\n\t// Web Area Task\r\n\tvoid call_webTask\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* url);\r\n\r\n\t// CKLBPauseCtrl\r\n\tvoid call_pause\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\tvoid call_resume\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// CKLBStoreService\r\n\tvoid call_storeEvent\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* itemID, const char* param2);\r\n\t\r\n\t// Sinc VM for Unit\r\n\tvoid call_fromSincVM\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id, s32 param);\r\n\t\r\n\t// Virtual Doc\r\n\tvoid call_eventVirtualDoc\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 param1, s32 param2, s32 param3, s32 param4);\r\n\t\r\n\t// Touch Pad\r\n\tvoid call_touchPadCSharp\t\t(CKLBObjectScriptable* obj, u32 m_execount, u32 type, u32 id, s32 x, s32 y);\r\n\tvoid call_touchPad\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\t\r\n\t// Device buttons\r\n\tvoid call_button\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// CKLBUITextInput\r\n\tvoid call_textInput\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* txt, u32 id);\r\n\t\r\n\t// Selectable Element\r\n\tvoid call_eventSelectable\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* name, s32 type, s32 param);\r\n\t\r\n\t// Swf Player\r\n\tvoid call_eventSwf\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* label);\r\n\t// UI List\r\n\tvoid call_eventUIListDynamic\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemID);\r\n\tvoid call_eventUIList\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemCnt, s32 listLength, s32 pos);\r\n\t// TODO : pb with NULL funcName != behavior before call.\r\n\tvoid call_eventUIListDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 param1, s32 param2);\r\n\r\n\t// UI Control\r\n\tvoid call_eventDragIF\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY);\r\n\tvoid call_eventUIControlDrag\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY);\r\n\tvoid call_eventUIControlPinch\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, float pinch, float rot);\r\n\tvoid call_eventUIControlClick\t(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y);\r\n\tvoid call_eventUIControlDblClick(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y);\r\n\tvoid call_eventUIControlLongTap\t(const char* funcName, CKLBObjectScriptable* obj,  u32 time, s32 x, s32 y);\r\n\t\r\n\t// UI Drag Icon\r\n\tvoid call_eventDragIcon\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 dragX, s32 dragY);\r\n\t\r\n\t// UI Movie\r\n\tvoid call_eventMovie\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// UI Cell Anim\r\n\tvoid call_eventCellAnim\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\t\r\n\t// UI Canvas\r\n\tvoid call_canvasOnDraw\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// UI Node Pack Anim\r\n\tvoid call_eventNodeAnimPack\t\t(const char* funcName, CKLBObjectScriptable* obj, const char * name, u32 id);\r\n\t\r\n\t// UI Touch Event UI\r\n\tvoid call_eventUITouchEvent\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 dx, s32 dy);\r\n\r\n\t// CKLBDebugMenu\r\n\tvoid call_eventDebugItem\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id);\r\n\t\r\n\t// UI Scroll Bar / UI List task\r\n\tvoid call_eventScrollBar\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 pos);\r\n\tvoid call_eventScrollBarStop\t(const char* funcName, CKLBObjectScriptable* obj, s32 pos);\r\n\r\n\t// World Task\r\n\tvoid call_eventWorld\t\t\t(const char* funcName, CKLBObjectScriptable* obj, s32 serial, s32 msg, s32 status);\r\n\r\n\tvoid call_eventUpdateDownload\t(const char* funcName, CKLBObjectScriptable* obj, double progress, const char* progressStr);\r\n\tvoid call_eventUpdateZIP\t\t(const char* funcName, CKLBObjectScriptable* obj, int progress, int total);\r\n\tvoid call_eventUpdateComplete\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\tvoid call_eventUpdateError\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// NetAPI\r\n\tbool call_netAPI_callback\t\t(const char* funcName, CKLBObjectScriptable* obj, int uniq, int msg, int status, CKLBJsonItem * pRoot);\r\n\tvoid call_netAPI_versionUp\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* clientVer, const char* serverVer);\r\n\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBScrollBarIF.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrollBarIF_h\r\n#define CKLBScrollBarIF_h\r\n\r\n\r\n#include \"CLuaState.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n//! スクロールマネージャインタフェース\r\nclass CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrollMgr();\r\n\tvirtual ~CKLBScrollMgr();\r\n\r\n\tvoid setMaxPosition (int max);\r\n\tvoid setLoopArea    (int lenLoop = 0);\r\n\r\n\t// callbackの設定\r\n\tbool setCallback    (void * pData, const char * funcname);\r\n\r\n\t// 引数として位置を与え callback を呼び出す\r\n\tvoid execCallback   (int pos);\r\n\r\n\tinline void initPos (int pos) {\r\n\t\tsetInitial(pos);\r\n\t}\r\n\t\r\n\tinline void setPos  (int pos, int dir) {\r\n\t\tsetPosition(pos, dir);\r\n\t}\r\n\r\n\tinline int  getNowPos() {\r\n\t\tfloat pos = (float)getPosition();\r\n\t\treturn (int)loopRound(pos);\r\n\t}\r\n\tinline int  getNowBar() {\r\n\t\tfloat pos = (float)getBarPosition();\r\n\t\tpos = loopRound(pos);\r\n\t\tif(pos > (float)m_maxPos) pos = (float)m_maxPos;\r\n\t\treturn (int)pos;\r\n\t}\r\n\r\n\tvirtual void setMargin      (int top, int bottom)   = 0;\r\n\tvirtual void setInitial     (int pos)               = 0; \r\n\tvirtual void setPosition    (int pos, int dir)      = 0;\r\n\tvirtual int  getPosition    ()                      = 0;\r\n\tvirtual int  getBarPosition ()                      = 0;\r\n\tvirtual void execute        (u32 deltaT)            = 0;\r\n\tvirtual bool stillScrolling ()                      = 0;\r\nprotected:\r\n\tfloat loopRound(float pos);\r\n\r\n\tint\t\t\t\tm_maxPos;\r\n\tint\t\t\t\tm_lenLoop;\r\n\r\n\tvoid\t\t*\tm_data;\t\t\t// data pointer for callback.\r\n\tconst char\t*\tm_callback;\t\t// callback function name\r\n\tint\t\t\t\tm_precallPos;\r\n};\r\n\r\n\r\n//! スクロールバーインタフェース\r\n/*!\r\n\t\r\n*/\r\nclass CKLBScrollBarIF\r\n{\r\npublic:\r\n\tenum {\r\n\t\tSCROLLBAR_DRAG\t\t= 0,\r\n\t\tSCROLLBAR_RELEASE\t= 1,\r\n\t\tSCROLLBAR_STOPPED\t= 2,\t// Use for C# callback of CKLBScrollMgr::execCallback\r\n\t};\r\n\r\n\tCKLBScrollBarIF(CKLBLuaTask * pOwner = 0);\r\n\tvirtual ~CKLBScrollBarIF();\r\n\r\n\tvoid setScrollMgr(CKLBScrollMgr * mgr);\r\n\tinline bool setScrMgrCallback(void * pData, const char * funcname) {\r\n\t\tbool bResult = false;\r\n\t\tif(m_pScrMgr) {\r\n\t\t\tbResult = m_pScrMgr->setCallback(pData, funcname);\r\n\t\t}\r\n\t\treturn bResult;\r\n\t}\r\n\r\n\tinline bool isScrolling() {\r\n\t\tif (m_pScrMgr) {\r\n\t\t\treturn m_pScrMgr->stillScrolling();\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tbool init(\r\n\t\tCKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos, const char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode = false);\r\n\r\n\tvoid die                ();\r\n\r\n\tvoid setSliderSize      (s32 value);\r\n\tvoid setSliderSizeMin   (s32 value);\r\n\tvoid setColorMode       (u32 mode, u32 color);\r\n\tu32  getColorMode       (u32 mode);\r\n\tvoid setMode            (u32 mode);\r\n\tvoid setTouchActive     (bool active);\r\n\r\n\tinline void setOverScroll   (bool overscroll)   { m_overScroll = overscroll; }\r\n\tinline void setShortHide    (bool shortHide)    { m_bShortHide = shortHide;  }\r\n\r\n\tinline void setVisible      (bool visible) {\r\n\t\tm_visible = visible;\r\n\t\tif(m_pNode) {\r\n\t\t\ts32  size = m_vertical ? m_height : m_width;\r\n\t\t\tif(m_slider_size >= size && m_bShortHide) visible = false;\r\n\t\t\tm_pNode->setVisible(visible);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setEnable       (bool enable)       { m_enable = enable; }\r\n\r\n\tinline void setVertical     (bool vertical) {\r\n\t\tif (vertical != m_vertical) {\r\n\t\t\tm_vertical = vertical;\r\n\t\t\tm_bCmdUpdate = true;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setWidth        (s32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_bCmdUpdate = false;\r\n\t\t\tm_width = width;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setHeight       (s32 height) {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_bCmdUpdate = false;\r\n\t\t\tm_height = height;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setOrder        (u32 order) {\r\n\t\tif (m_order != order) {\r\n\t\t\tm_order = order;\r\n\t\t\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\t\t\tm_pDynSprite->changeOrder(pRdrMgr, order);\r\n\t\t}\r\n\t}\r\n\r\n\tvoid setMaxPosition (int max);\r\n\tvoid setMinPosition (int min);\r\n\tvoid setLoopArea    (int min, int max);\r\n\tvoid setInitial     (int pos);\r\n\tvoid setPosition    (int pos, int dir = 0);\t// dir = スクロール方向指定\r\n\tvoid setMargin      (int top, int bottom);\r\n\tvoid setCtrlStatus  (bool status);\r\n\tint getPosition     ();\r\n\tint getBarPosition  ();\r\n\r\n\tinline int getMinPosition   () { return m_minPos; }\r\n\tinline int getMaxPosition   () { return m_maxPos; }\r\n\r\n\tinline int getSliderSize    () { return m_slider_size;      }\r\n\tinline int getSliderSizeMin () { return m_slider_min_size;  }\r\n\r\n\tinline bool getTouchActive  () { return m_active; }\r\n\r\n\tvoid execute(u32 deltaT);\r\n\r\nprivate:\r\n\tvoid procUserCtrl   ();\r\n\tvoid updateDisplay  ();\r\n\tvoid recompute      ();\r\n\r\nprivate:\r\n\tCKLBScrollMgr\t*\tm_pScrMgr;\r\n\tint\t\t\t\t\tm_maxPos;\r\n\tint\t\t\t\t\tm_minPos;\r\n\r\n\tint\t\t\t\t\tm_minLoop;\r\n\tint\t\t\t\t\tm_maxLoop;\r\n\r\n\tint\t\t\t\t\tm_lastPos;\r\n\tint\t\t\t\t\tm_barPos;\r\n\tint\t\t\t\t\tm_prePos;\r\n\r\n\tint\t\t\t\t\tm_margin_top;\r\n\tint\t\t\t\t\tm_margin_bottom;\r\n\tu32\t\t\t\t\tm_order;\r\n\r\n\tbool\t\t\t\tm_visible;\r\n\tbool\t\t\t\tm_enable;\r\n\tbool\t\t\t\tm_overScroll;\r\n\tbool\t\t\t\tm_bShortHide;\r\n\r\n\ttypedef enum {\r\n\t\tS_WAIT,\t\t\t\t//!< 待機中\r\n\t\tS_DRAG,\t\t\t\t//!< ドラッグ中\r\n\t\tS_DRAG_IGNORE,\t\t//!< Sliderではないところのドラッグ\r\n\t} STATE;\r\n\r\n\r\n\t// 以下描画情報\r\n\tstruct {\r\n\t\tfloat\tx, y;\r\n\t\tfloat\tu, v;\r\n\t} m_vertices[12];\r\n\r\n\tCKLBLuaTask\t\t*\tm_pOwner;\t\t// オーナーとなるタスクのポインタ\r\n\tCKLBImageAsset\t*\tm_pTex;\r\n\r\n\r\n\tCKLBNode\t\t*\tm_pBaseNode;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tSMatrix2D\t\t\tm_invTransf;\r\n\r\n\tu32\t\t\t\t\tm_texHandle;\r\n\tu8\t\t\t\t\tm_mode;\r\n\tbool\t\t\t\tm_first;\r\n\r\n\ts32\t\t\t\t\tbMiddle;\r\n\ts32\t\t\t\t\tbLeft;\r\n\ts32\t\t\t\t\tbRight;\r\n\ts32\t\t\t\t\tbTotal;\r\n\ts32\t\t\t\t\tm_dragStartPos;\r\n\r\n\tu32\t\t\t\t\tm_state;\r\n\tfloat\t\t\t\tm_ofs_x;\r\n\tfloat\t\t\t\tm_ofs_y;\r\n\tint\t\t\t\t\tm_tid;\r\n\r\n\tbool\t\t\t\tbitmapHasBoth;\r\n\r\n\r\n\tint\t\t\t\t\tm_x, m_y;\r\n\tint\t\t\t\t\tm_width, m_height;\r\n\tbool\t\t\t\tm_vertical;\r\n\r\n\tu32\t\t\t\t\tm_col_normal;\r\n\tu32\t\t\t\t\tm_col_select;\r\n\r\n\ts32\t\t\t\t\tm_slider_min_size;\r\n\ts32\t\t\t\t\tm_slider_size;\r\n\r\n\tbool\t\t\t\tm_active;\r\n\r\n\tbool\t\t\t\tm_bCmdUpdate;\r\n\r\n\tbool\t\t\t\tm_bReady;\r\n\r\n\tbool\t\t\t\tm_hide_mode;\r\n\tbool\t\t\t\tm_hide;\t\t\t// hide処理中ならtrue\r\n\tu32\t\t\t\t\tm_timeHide;\t\t// 表示を隠すまでの時間カウント\r\n\r\n\tconst char *\t\tm_callback;\r\n\tstatic const u16\tms_indices[];\r\n};\r\n\r\n\r\n#endif // CKLBScrollBarIF_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBSplineNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//\r\n\r\n#ifndef __SPLINE_PLAYER__\r\n#define __SPLINE_PLAYER__\r\n\r\n#include \"CKLBNode.h\"\r\n\r\n/*!\r\n* \\class CKLBSplineNode\r\n* \\brief Spline Node Class\r\n* \r\n* CKLBSplineNode gives the possibility to easily associate a Spline Animation \r\n* with an UITask.\r\n*/\r\nclass CKLBSplineNode : public CKLBNode {\r\npublic:\r\n\tstatic const u32 ANM_X_COORD_0\t\t\t= 1<<1;\r\n\tstatic const u32 ANM_Y_COORD_1\t\t\t= 1<<2;\r\n\tstatic const u32 ANM_SCALE_COORD_2\t\t= 1<<3;\r\n\tstatic const u32 ANM_R_COLOR_3\t\t\t= 1<<4;\r\n\tstatic const u32 ANM_G_COLOR_4\t\t\t= 1<<5;\r\n\tstatic const u32 ANM_B_COLOR_5\t\t\t= 1<<6;\r\n\tstatic const u32 ANM_A_COLOR_6\t\t\t= 1<<7;\r\n\tstatic const u32 ANM_SCALEX_COORD_7\t\t= 1<<8;\r\n\tstatic const u32 ANM_SCALEY_COORD_8\t\t= 1<<9;\r\n\tstatic const u32 ANM_ROTATION_COORD_9\t= 1<<10;\r\n\r\n\tstatic const u32 ANM_PING_PONG\t\t\t= 0x10000000;\r\n\tstatic const u32 ANM_LOOPBIT\t\t\t= 0x20000000;\r\n\tstatic const u32 ANM_REMOVESCENE\t\t= 0x40000000;\r\n\r\n\tstatic const u32 MODIFY_X\t\t\t\t= 0;\r\n\tstatic const u32 MODIFY_Y\t\t\t\t= 1;\r\n\tstatic const u32 MODIFY_SCALE\t\t\t= 2;\r\n\tstatic const u32 MODIFY_R\t\t\t\t= 3;\r\n\tstatic const u32 MODIFY_G\t\t\t\t= 4;\r\n\tstatic const u32 MODIFY_B\t\t\t\t= 5;\r\n\tstatic const u32 MODIFY_A\t\t\t\t= 6;\r\n\tstatic const u32 MODIFY_ROT\t\t\t\t= 7;\r\n\tstatic const u32 MODIFY_PRIORITY\t\t= 8;\r\n\tstatic const u32 MODIFY_LAYOUT\t\t\t= 9; // Used in UI List only.\r\n\tstatic const u32 MODIFY_TOTALCOUNT\t\t= MODIFY_LAYOUT + 1;\r\n\r\n\tstatic const u32 ANM_LINEAR\t\t\t\t= 1;\r\n\tstatic const u32 ANM_SWING\t\t\t\t= 2;\r\n\tstatic const u32 ANM_EASEINQUAD\t\t\t= 3;\r\n\tstatic const u32 ANM_EASEOUTQUAD\t\t= 4;\r\n\tstatic const u32 ANM_EASEINOUTQUAD\t\t= 5;\r\n\tstatic const u32 ANM_EASEINCUBIC\t\t= 6;\r\n\tstatic const u32 ANM_EASEOUTCUBIC\t\t= 7;\r\n\tstatic const u32 ANM_EASEINOUTCUBIC\t\t= 8;\r\n\tstatic const u32 ANM_EASEINQUART\t\t= 9;\r\n\tstatic const u32 ANM_EASEINBACK\t\t\t= 27;\r\n\tstatic const u32 ANM_EASEOUTBACK\t\t= 28;\r\n\tstatic const u32 ANM_EASEINOUTBACK\t\t= 29;\r\n\r\n\tCKLBSplineNode\t\t\t\t\t\t();\r\n\tvirtual ~CKLBSplineNode\t\t\t\t();\r\n\r\n\tvoid\t\t\tsetCounter\t\t\t(u32* refCounterPtr);\r\n\tvoid\t\t\tplay\t\t\t\t();\r\n\tvoid\t\t\tstop\t\t\t\t();\r\n\tvoid\t\t\tendAnimation\t\t(s32* keys);\r\n\r\n\tvoid\t\t\tsetAnimation\t\t(s32 milliSecondsPlayTime, s32 timeShift, u32 type, s32* keys, u32 keycount, u32 affected, float* arrayParam);\r\n\r\n\tbool\t\t\tsetParamCount\t\t(u8 splineCount, u8 maxKeyCount);\r\n\tvoid\t\t\tsetTarget\t\t\t(u8 splineIndex, u8 targetParameter);\r\n\tvoid\t\t\taddKeys\t\t\t\t(u8 splineIndex, u32 time, s16 value);\r\n\tvoid\t\t\taddKeysFixed\t\t(u8 splineIndex, u32 time, s32 fixed16Value);\r\n\tvoid\t\t\tgenerateAnimation\t();\r\n\r\n\tvirtual\r\n\tvoid\t\t\tanimate\t\t\t\t(u32 deltaTimeMilli);\r\n\r\n\tvirtual u32\t\tgetClassID\t\t\t()\t{ return CLS_KLBSPLINENODE; }\r\n\r\n\tvoid\t\t\tsetTag\t\t\t\t(void* tag) { m_tag = tag; }\t\r\n\tvoid*\t\t\tgetTag\t\t\t\t()\t{ return m_tag; }\r\n\r\nprivate:\r\n\tvoid\t\t\tcleanSplines();\r\n\r\n\ts32 \t\t\tinterpolateKey\t\t(s32 interpolation, s32* vectorData);\r\n\ts32*\t\t\tm_aKeyVector;\r\n\tfloat\t\t\tm_base[18];\r\n\r\n\ts32\t\t\t\tm_startTime;\r\n\r\n\tu32\t\t\t\tm_applyMask;\r\n\ts32\t\t\t\tm_timeMultiplier;\r\n\ts32\t\t\t\tm_uiLooptime;\r\n\r\n\ts32\t\t\t\tm_uiLocalTime;\r\n\r\n\ts32\t\t\t\tm_uiTotalKeyCount;\r\n\ts32\t\t\t\tm_uiLastLocalTime;\r\n\r\n\tu32*\t\t\tm_refCounter;\r\n\r\n\tu8*\t\t\t\tm_target;\r\n\ts32*\t\t\tm_allKeys;\r\n\tu32*\t\t\tm_splinesKeyCount;\r\n//\ts32*\t\t\tm_splineLocalTime;\r\n\tu16*\t\t\tm_splineLastKey;\r\n\ts32**\t\t\tm_splines;\r\n\tvoid*\t\t\tm_tag;\r\n\ts32\t\t\t\tm_uiTotalTime;\r\n\tu32\t\t\t\tm_uiMaxKeyCount;\r\n\tu32\t\t\t\tm_uiSplineCount;\r\n\r\n\tu16\t\t\t\tm_uiLastKey;\r\n\tu8\t\t\t\tm_mode;\r\n\tbool\t\t\tm_loop;\r\n\tbool\t\t\tm_pingpong;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBSprite3D.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_SPRITE3D__\r\n#define __CKLB_SPRITE3D__\r\n\r\n#include \"CKLBRendering.h\"\r\n\r\nclass CKLBSprite3D : public CKLBSprite {\r\npublic:\r\n\tvoid switchImage\t\t(CKLBImageAsset* pImage);\r\n\tvoid set3DMatrix\t\t(float* matrix3d);\r\n\tvoid use2DSceneGraph\t(bool use);\r\n\tvoid draw\t\t\t\t();\r\n\r\n\t// Inheritance.\r\n\tvirtual\tvoid applyNode(CKLBNode* pNode);\r\nprotected:\r\n\tCKLBSprite3D ();\r\n\t~CKLBSprite3D();\r\nprivate:\r\n\tfloat\t\t\tm_matrixLocal[16];\r\n\tfloat\t\t\tm_matrixTransform[16];\r\n\tCIndexBuffer*\tm_pIdxBuff;\r\n\tCBuffer*\t\tm_pBuff;\r\n\tbool\t\t\tm_bUse2DSceneGraph;\r\n\tbool\t\t\tm_recompute;\r\n\r\n\tstatic CShader*\t\t\t\ts_pVShader;\r\n\tstatic CShader*\t\t\t\ts_pPShader;\r\n\tstatic CShaderSet*\t\t\ts_pShaderSet;\r\n\tstatic CShaderInstance*\t\ts_pShaderInstance;\r\n\tstatic SRenderState\t\t\ts_3Dstate;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBStoreService.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBStoreService.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CKLBStoreService_h\r\n#define CKLBStoreService_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n/*!\r\n* \\class CKLBStoreService\r\n* \\brief Store Service Task class.\r\n* \r\n* CKLBStoreService is responsible for the different interactions with the Application Store,\r\n* as getting the products list or buying items.\r\n* This task is platform independant as it uses IPlatformRequest to process its requests.\r\n*/\r\nclass CKLBStoreService : public CKLBLuaTask\r\n{\r\n    friend class CKLBTaskFactory<CKLBStoreService>;\r\nprivate:\r\n    CKLBStoreService();\r\n    virtual ~CKLBStoreService();\r\n\tbool init(const char* callback);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBStoreService* create(const char* callback);\r\n\r\n    bool\tinitScript\t\t(CLuaState& lua);\r\n    int\t\tcommandScript\t(CLuaState& lua);\r\n    \r\n    void\texecute\t\t\t(u32 deltaT);\r\n    void\tdie\t\t\t\t();\r\n    \r\n\tvoid\tbuyItems\t\t(const char* item) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.buyStoreItems(item);\r\n\t}\r\n\r\n\tinline void getProducts(const char* json, bool currency) { CPFInterface::getInstance().platform().getStoreProducts(json, currency); }\r\n\r\nprivate:\r\n    int cbStoreFailed\t\t\t(const OSCTRL * item);\r\n    int cbStorePurchashed\t\t(const OSCTRL * item);\r\n    int cbStorePurchashing\t\t(const OSCTRL * item);\r\n    int cbStoreRestore\t\t\t(const OSCTRL * item);\r\n    int cbStoreRestoreCompleted\t(const OSCTRL * item);\r\n    int cbStoreRestoreFailed\t(const OSCTRL * item);\r\n    int cbStoreGetProducts\t\t(const OSCTRL * item);\r\n    \r\n\tinline void execCallback(IClientRequest::EVENT_TYPE status, const char * itemId = \"\", const char * data = \"\") {\r\n\t\tif(m_callback) CKLBScriptEnv::getInstance().call_storeEvent(m_callback, this, status, itemId, data);\r\n\t}\r\n \r\nprivate:\r\n    const char          *   m_callback;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n    \\brief  Root Task Class (CKLBTask) and Task Manager (CLKBTaskMgr) definition\r\n    \\file   CKLBTask.h\r\n  */\r\n#ifndef CKLBTask_h\r\n#define CKLBTask_h\r\n\r\n#include <string.h>\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBTask;\r\nclass CKLBTaskMgr;\r\n\r\nclass CKLBRegistedTaskList\r\n{\r\npublic:\r\n\tCKLBRegistedTaskList();\r\n\tvirtual ~CKLBRegistedTaskList();\r\n\r\n\tvoid addTask(CKLBTask * pTask);\r\n\tvoid killTaskList(bool kill_task = true);\r\n\r\nprivate:\r\n\tstruct TASKITEM {\r\n\t\tTASKITEM\t*\tprev;\r\n\t\tTASKITEM\t*\tnext;\r\n\r\n\t\tCKLBTask\t*\tpTask;\r\n\t};\r\n\r\n\tTASKITEM\t*\tm_begin;\r\n\tTASKITEM\t*\tm_end;\r\n};\r\n\r\n\r\nstruct TASK_LIST {\r\n    CKLBTask * begin;\r\n    CKLBTask * end;\r\n};\r\n\r\n// Change Task Execution Flag because order changed.\r\n#define\tREFRESH_A\t\t\tsetStatusFlag(0x1)\r\n#define CHANGE_A\t\t\tgetStatusFlag(0x1)\r\n#define RESET_A\t\t\t\tresetStatusFlag(0x1)\r\n\r\n// Change Task Execution Flag because geometry related property changed\r\n#define REFRESH_B\t\t\tsetStatusFlag(0x2)\r\n#define CHANGE_B\t\t\tgetStatusFlag(0x2)\r\n#define RESET_B\t\t\t\tresetStatusFlag(0x2)\r\n\r\n// Change Task Execution Flag because animation is active.\r\n#define REFRESH_C\t\t\tsetStatusFlag(0x4)\r\n#define CHANGE_C\t\t\tgetStatusFlag(0x4)\r\n#define RESET_C\t\t\t\tresetStatusFlag(0x4)\r\n\r\n// Change Task Execution Flag because animation is active.\r\n#define REFRESH_D\t\t\tsetStatusFlag(0x8)\r\n#define CHANGE_D\t\t\tgetStatusFlag(0x8)\r\n#define RESET_D\t\t\t\tresetStatusFlag(0x8)\r\n\r\n// Change Task Execution Flag because animation is active.\r\n#define REFRESH_E\t\t\tsetStatusFlag(0x10)\r\n#define CHANGE_E\t\t\tgetStatusFlag(0x10)\r\n#define RESET_E\t\t\t\tresetStatusFlag(0x10)\r\n\r\n//! ゲームタスククラス\r\n/*!\r\n  ゲーム中のすべての処理はフレーム単位で行われ、それぞれの処理単位は「タスク」と呼ばれるクラスで管理されます。\r\n 「フレーム単位で実行される処理」は、すべて「タスク」として実装することで、\r\n  ゲームプログラムは一貫性が保たれ、またシンプルなものになります。\r\n\r\n  CKLBTask はゲーム中のすべてのタスクの基底クラスとなり、実装されたタスククラスのインスタンスを\r\n  タスクマネージャに登録することで、ゲーム中の処理として実行されるようになります。\r\n  */\r\n\r\n/*!\r\n* \\class CKLBTask\r\n* \\brief Engine Root Task class\r\n* \r\n* The Game Engine is based on a frame-by-frame processing.\r\n* Each unit processed each frame is managed by the class CKLBTask.\r\n* CKLBTask is the base class for all the tasks of the engine.\r\n* By registering a task in the TaskManager it will be run as a process in the game.\r\n*/\r\nclass CKLBTask : public CKLBObjectScriptable\r\n{\r\n    friend class CKLBTaskMgr;\r\npublic:\r\n    \r\n    typedef enum {\r\n        TASK_SIMPLE,\r\n        TASK_LUA_BASIC,\r\n        TASK_LUA_PROPERTY,\r\n        TASK_LUA_UI\r\n    } TASKTYPE;\r\n\r\n    virtual TASKTYPE getTaskType();\r\n\r\n\r\n    //! タスク登録フェーズ値定義\r\n    /*!\r\n     タスクシステムにはTASK_PHASEに定義された複数のフェーズがあり、\r\n     なおかつそれぞれのフェーズに対応するタスクの実行リストを持ちます。\r\n     \r\n     登録されているタスクは必ず P_BEGIN から P_END 方向に向かって、\r\n     それぞれの実行フェーズに対応する実行リストに登録されているタスクが登録順に実行されます。\r\n     \r\n     - 要点\r\n        -# 異なるフェーズに登録されたタスク間における実行順は、登録順に関わらず必ずフェーズ順になることが保証される。\r\n        -# 同じフェーズに登録されたタスク間における実行順は、必ず登録順になることが保証されている。\r\n        .\r\n     .\r\n     \r\n     通常のゲームタスクは P_PREV, P_NORMAL, P_AFTER に登録するタスクとして作成します。\r\n     この内、ほとんどのものは P_NORMAL として作るべきであり、「必ず先に処理すべきもの」\r\n     「必ず後に処理すべきもの」のために P_PREV, P_AFTER が用意されています。\r\n     \r\n     これらのフェーズは通常のゲーム進行に伴うフェーズであるため、タスクマネージャが「ポーズ状態」に\r\n     されている状態ではフレーム処理(execute()の呼び出し)が行われません。\r\n     \r\n     これら以外は特殊な用途を持つフェーズであるため、原則そのフェーズに登録すべきタスク以外は登録するべきではありません。\r\n     */\r\n    typedef enum {\r\n        P_BEGIN \t= 0,\t\t//!< フレーム開始時の処理。描画エンジンのリフレッシュ処理等はこのフェーズに登録。\r\n\r\n        P_INPUT \t= 1,        //!< ユーザ操作の取得など\r\n        P_IMPORTANT = 2,        //!< ポーズ・フリーズ中でも走らなければならないタスク\r\n#ifdef DEBUG_MENU\r\n\t\tP_DBGSIGN \t= 3,\t\t//!< デバッグコマンド受付\r\n\t\tP_DBGMENU \t= 4,\t\t//!< デバッグメニュー処理\r\n#endif\r\n\r\n\t\tP_UIPREV \t= 5,\t\t//!< 標準UIパーツより先に処理するUIフェーズ\r\n\r\n\t\tP_SCRIPT \t= 6,       //!< スクリプト的な処理タスクはこのフェーズに登録\r\n\r\n\t\tP_UIPROC \t= 7,\t\t//!< UIパーツの処理を行うフェーズ\r\n\t\tP_UIAFTER \t= 8,\t\t//!< 他のUIパーツを子タスクとして使用するUIタスク用のフェーズ\r\n\r\n        P_MENU \t\t= 9,         //!< メニューフェーズ: メニュー処理タスクはこのフェーズに登録。ポーズ中でも実行される。\r\n\r\n        // P_PREV, P_NORMAL, P_AFTER はポーズ中実行されない。\r\n        P_PREV \t\t= 10,         //!< (ポーズ中停止)通常タスク以前に処理しなければならないもの\r\n        P_NORMAL \t= 11,      //!< (ポーズ中停止)通常のタスクはここで処理\r\n        P_AFTER \t= 12,       //!< (ポーズ中停止)通常のタスクが終わった後に処理しなければならないもの\r\n\t\tP_JUDGE \t= 13,       //!< ゲーム中の判定など\r\n\r\n        P_DRAW \t\t= 14,        //!< 描画処理をキックするタスク等はここに登録\r\n        P_GC\t\t= 15,\r\n        P_END \t\t= 16,         //!< 描画キック後に行う処理があればここに登録\r\n\r\n        P_MAX \t\t= 17          //!< フェーズ総数\r\n    } TASK_PHASE;\r\n\r\npublic:\r\n    //! 破棄指令\r\n    /*!\r\n        タスクに破棄指令を出します。\r\n        破棄指令が出されたフレームの最後に die() が呼び出され、タスクのインスタンスが破棄されます。\r\n        タスクが他のタスクと親子関係を持つ場合、子として登録されているタスク全てに対し、再帰的に kill() が呼び出されます。\r\n     */\r\n    void kill();\r\n\r\n\t//! 一時停止指令\r\n\t/*!\r\n\t\tタスクに一時停止指令を出します。\r\n\t\tbPause がtrue で一時停止、falseで解除になります。\r\n\t*/\r\n\tvoid setPause(bool bPause, bool bRecursive = true);\r\n\r\n\tvoid interposeTimer(CKLBTask* pTimer);\r\n\r\n\tvirtual u32 getClassID();\r\nprotected:\r\n    //! コンストラクタ\r\n    /*!\r\n     派生させて使うためのクラスなので、protected になっています。\r\n     */\r\n    CKLBTask();\r\n\r\n    //! デストラクタ\r\n    virtual ~CKLBTask();\r\n\r\n    //! 破棄時の処理\r\n    /*!\r\n     タスクが扱うリソースは、タスク破棄の際に解放される必要があります。\r\n     タスク初期化時に生成/確保されたリソースの破棄処理は、die() の中で実装します。\r\n\r\n     die() は、そのフレームにおけるすべてのタスクのフレーム処理が終わった後に呼び出されます。\r\n     */\r\n    virtual void die();\r\n \r\n    //! フレーム処理実行\r\n    /*!\r\n     \\param deltaT  直前のフレームからの経過時間(単位: [ms])\r\n\r\n     毎フレーム行う処理を部品化するものがタスクの役割です。そのタスクがフレーム中に行うべき処理は execute() の中で実装します。\r\n     フレーム中で処理を止めると、以後のタスクの処理ができないので注意してください。\r\n     */\r\n    virtual void execute(u32 deltaT);\r\n\r\n    //! 初期化時に使用する実行リストへの登録\r\n    /*!\r\n     \\param pParent     親タスクインスタンスのポインタ\r\n     \\param ePhase      タスクを登録する実行フェーズ値\r\n     \r\n     タスクインスタンスをタスクマネージャの実行リストに登録します。\r\n     この登録を行わなければタスクは実行されないため、必ずタスク初期化処理の中で呼び出し、\r\n     実行リストへの登録を行う必要があります。\r\n     \r\n     タスクの実行リストへの登録は、タスクインスタンスの生成が完了していない状態で行うべきではありません。\r\n     このため、コンストラクタ内やメンバの初期化が完了していない状態で呼び出すことは避けてください。\r\n     \r\n     また、pParent として指定される親タスクは、生成が完了し実行リストへの登録が完了しているタスクである必要があります。\r\n     regist() が実行されていないタスクインスタンスのポインタを pParent に指定することは避けてください。\r\n     */\r\n    bool regist(CKLBTask * pParent = 0, TASK_PHASE ePhase = P_NORMAL);\r\n\r\n\tinline CKLBTask * getParent() const { return m_pParent; }\r\n\r\nprotected:\r\n    void child(CKLBTask * pChild);\r\n\tvirtual bool onPause(bool bPause);\r\n\r\n\tinline\r\n\tvoid setStatusFlag\t(u8 mask)\t{\tklb_assert(mask<64,\"Bit 0..5 only are usable\"); m_activeStatus |=mask; }\r\n\r\n\tinline\r\n\tvoid resetStatusFlag(u8 mask)\t{\tklb_assert(mask<64,\"Bit 0..5 only are usable\"); m_activeStatus &=~mask; }\r\n\r\n\tinline\r\n\tu8\t getStatusFlag\t(u8 mask)\t{\treturn m_activeStatus & mask; }\r\n\r\n\tvoid setNotAlwaysActive()\t\t{\tm_activeStatus &= ~ALWAYS_ACTIVE; }\r\nprivate:\r\n    // 実行関連情報(std::list<...>が使えない場合を想定し、ポインタで実装)\r\n    TASK_PHASE       m_ePhase;     // 自身の実行フェーズ\r\n    // タスク間の親子関連情報\r\n    CKLBTask       * m_pParent;    // 親タスクへのポインタ\r\n\r\n    // 子タスクへのリストを持つ\r\n    TASK_LIST m_lstChild;\r\n \r\n    // 実行リスト用のリンク\r\n    CKLBTask       * m_pExePrev;   // 実行フェーズリスト中の前のタスク\r\n    CKLBTask       * m_pExeNext;   // 実行フェーズリスト中の次のタスク\r\n\r\n    // 兄弟タスクへのリンク\r\n    CKLBTask       * m_pBrsPrev;\r\n\r\n    CKLBTask       * m_pBrsNext;\r\n\r\n    // 死ぬときのタスクリスト用リンク\r\n    CKLBTask       * m_pRmvPrev;\r\n    CKLBTask       * m_pRmvNext;\r\n    \r\n\r\n    // ステージタスクとして登録された際のリンク\r\n    CKLBTask       * m_pStgPrev;\r\n    CKLBTask       * m_pStgNext;\r\n\r\n\tstatic const s8\tALWAYS_ACTIVE\t= 1<<6;\r\n\ts8\t\t\t\tm_activeStatus;\r\n};\r\n\r\n//! タスクマネージャクラス\r\n/*!\r\n タスクマネージャクラスは、CKLBTask から派生したインスタンスを登録し、\r\n 実行、管理を行う機能を持つSingletonクラスです。\r\n \r\n タスクの実行リストを持ち、登録されている CKLBTask の execute() を順次呼び出すことで\r\n 1フレーム分全体の処理を行うのは CKLBTaskMgr の役割です。\r\n ゲーム中において動作している全タスク\r\n */\r\nclass CKLBTaskMgr\r\n{\r\n    friend class CKLBTask;\r\nprivate:\r\n    CKLBTaskMgr();\r\n    virtual ~CKLBTaskMgr();\r\npublic:\r\n    //! インスタンス取得\r\n    /*!\r\n     \\return CKLBTaskMgr インスタンスの参照\r\n     \r\n     CKLBTaskMgr のインスタンスへの参照を取得する。\r\n     */\r\n    static CKLBTaskMgr& getInstance();\r\n\r\n\t//! Dump list of instanciated tasks.\r\n\tvoid dump();\r\n\r\n\t//! クリア処理\r\n\t/*!\r\n\t 登録されているすべてのタスクを破棄する。\r\n\t 終了処理に使用。\r\n\t */\r\n\tvoid clearTaskList();\r\n\r\n    //! ステージタスク登録\r\n    /*!\r\n     指定されたタスクをステージタスクとして登録する。\r\n     */\r\n    void registStageTask(CKLBTask * pTask);\r\n\r\n    //! ステージタスククリア処理\r\n    /*!\r\n     ステージタスクとして登録されているタスクを全て破棄予約する。\r\n     ステージ間の切り替えで使用。ステージタスク以外は破棄しない。\r\n     */\r\n    void clearStageTask();\r\n\r\n\t//! タスクポインタ有効確認\r\n\t/*!\r\n\t 指定されたタスクポインタが、実行リスト中に存在しているかを確認する。\r\n\t デバッグ用機能なので、リリース版では無効化されるべき。\r\n\t*/\r\n\tbool isExistTask(CKLBTask * pTask);\r\n\r\n\t//! 登録されるタスクを記録するCKLBRegistedTaskListを指定する\r\n\t/*!\r\n\t 0 が指定されたら登録タスクの記録を行わない\r\n\t */\r\n\tinline void setRegistedTaskList(CKLBRegistedTaskList * pRegList = 0) {\r\n\t\tm_pRegList = pRegList;\r\n\t}\r\n\r\n\r\n    //! 1フレーム分の処理実行\r\n    /*!\r\n     \\param deltaT  直前のフレームからの経過時間(単位[ms])\r\n     \r\n     実行リストに登録されている全 CKLBTask派生クラスのexecute()を呼び出し、1フレーム分の処理を行う。\r\n     そのフレーム中に削除が指定されたタスクおよびその子タスクについては、すべての execute() を呼び出し終わった後に\r\n     die() を呼び出し、インスタンスを削除する。\r\n     */\r\n    bool execute(u32 deltaT);\r\n\r\n    //! ポーズ状態を指定する\r\n    /*!\r\n     \\param bPause  ポーズ状態\r\n     \r\n     タスクマネージャのポーズ状態を指定します。\r\n     bPause が true のときポーズ状態、false のとき通常実行状態になります。\r\n\r\n     ポーズ状態では、CKLBTaskMgr::execute() を呼び出しても P_PREV,P_NORMAL,P_AFTER, P_JUDGE フェーズの\r\n     タスクについては execute() が呼び出されなくなります。\r\n     */\r\n    inline bool setPause(bool bPause) { return m_bPause = bPause; }\r\n\r\n    //! ポーズ状態の取得\r\n    /*!\r\n     \\return 現在のポーズ状態\r\n     \r\n     タスクマネージャのポーズ状態を取得します。\r\n     ポーズ状態については setPause() の解説も参照してください。\r\n     */\r\n    inline bool getPause() { return m_bPause; }\r\n\r\n\tinline bool isKilling() const { return m_bKilling; }\r\n\r\n#ifdef DEBUG_MENU\r\n\t//! デバッグ用全停止指令\r\n\t/*!\r\n\t\ttrueを与えることで、P_UIPREVからP_JUDGEまでの入力とデバッグ、描画を除いた\r\n\t\tすべてのフェーズの実行を一時停止します。\r\n\t\tfalseで解除されます。\r\n\t*/\r\n\tbool setDbgPause(bool bPause) { return m_bDbgPause = bPause; }\r\n#endif\r\n\r\n    //! Exit\r\n    /*!\r\n    　タスクマネージャにExitフラグを立てます。\r\n     そのフレーム以降execute()はfalseを返すようになります。\r\n     この値は、フレーム駆動システム側にによってゲーム終了の指示として扱われます。\r\n     */\r\n    inline void\t\t\tsetExit\t\t\t()\t\t\t\t\t{ m_bExit = false; }\r\n\r\n    inline CKLBTask *\tgetCurrentTask\t()\t\t\t\t\t{ return m_currentTask; }\r\n    \r\n    inline void\t\t\tsetCurrentTask\t(CKLBTask * pTask)\t{ m_currentTask = pTask; }\r\n\r\n\tinline u32\t\t\tgetFrameID\t\t() const\t\t\t{ return m_frameId; }\r\n\r\n\t//! 指定されたタスクがすでに削除予約されているか否かを返す\r\n\tbool is_remove(CKLBTask * pTask);\r\n\r\n\tinline void setFreeze\t(bool bFreeze)\t{ m_bFreeze = bFreeze;\t}\r\n\tinline bool getFreeze\t()\t\t\t\t{ return m_bFreeze;\t\t}\r\n\r\n\tinline s64 getStartTime\t()\t\t\t\t{ return m_startTime;\t}\r\n\tinline s64 getScriptTime()\t\t\t\t{ return m_scriptTime;\t}\r\n\r\nprivate:\r\n    //! タスクを指定されたフェーズの実行リストに登録する\r\n    bool regist(CKLBTask::TASK_PHASE ePhase, CKLBTask * pTask);\r\n    \r\n    //! 指定されたタスクを削除予約する。\r\n    bool remove(CKLBTask * pTask);\r\n\r\n\t//! 削除リストに登録されているタスクを順に削除する\r\n\tvoid remove_killlist();\r\n\r\nprivate:\r\n    CKLBTask    *   m_currentTask;\r\n\r\n    TASK_LIST       m_lstTask[ CKLBTask::P_MAX ];\r\n    TASK_LIST       m_lstRemove;\r\n    \r\n    TASK_LIST       m_lstStage;\r\n\r\n\t// フレームID。毎フレーム値が更新される。同じフレームでは同じ値になる。\r\n\tu32\t\t\t\tm_frameId;\r\n\r\n    // Exitフラグ。ゲーム終了指示が出された際に true になる。\r\n    bool            m_bExit;\r\n\r\n    // ポーズ状態\r\n    bool            m_bPause;     // ポーズ状態。true の時はポーズ状態として、P_PREV, P_NORMAL, P_AFTER をスキップする。\r\n\r\n\t// kill処理中フラグ\r\n\tbool\t\t\tm_bKilling;\t  // kill中は true。それ以外は false\r\n\r\n\t//\r\n\ts64\t\t\t\tm_startTime;\r\n\ts64\t\t\t\tm_scriptTime;\r\n\r\n\t// タスクリスト記録\r\n\tCKLBRegistedTaskList\t*\tm_pRegList;\r\n\r\n#ifdef DEBUG_MENU\r\n\tbool\t\t\tm_bDbgPause;\r\n#endif\r\n\r\n    // true にされたフレームの最後に、ステージタスクとして登録されている全タスクを破棄対象とする。\r\n    bool            m_bStageClear;\r\n\tbool\t\t\tm_bFreeze;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBTextInputNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_UITEXTBOX__\r\n#define __CKLB_UITEXTBOX__\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBUITextBox\r\n* \\brief Text Box Specialized Node Class\r\n* \r\n* CKLBUITextBox is a UITextBox specialized Node.\r\n* It provides methodss to manage a TextBox.\r\n*/\r\nclass CKLBUITextBox : public CKLBUIElement {\r\npublic:\r\n\tCKLBUITextBox(bool isPassword, int maxlen = 0);\r\n\t~CKLBUITextBox();\r\n\r\n\t// KLBObject::\r\n\tvirtual u32\t getClassID     ()\t\t\t\t\t{ return CLS_KLBTEXTEDIT; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\tvoid recomputeCustom();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   ()  { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n    \r\n    void        setFont         (const char* fontname, float fontsize);\r\n    void        setPlaceHolder  (const char* placeholder);\r\n    void        setAlign        (IWidget::TEXTALIGNMENTTYPE _alignType);\r\n    void        setMaxlen       (int maxlen);\r\n\tint\t\t\tgetMaxlen\t\t();\r\n    void        setCharType     (IWidget::TEXTCHARTYPE chartype);\r\n    void        setColor        (bool bTouch, u32 foreground, u32 background);\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n\r\n    inline IWidget * getWidget  () const { return nativeInputItem; }\r\n    \r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender      ();\r\n\tvirtual void removeRender   ();\r\n\r\n\tIWidget *   nativeInputItem;\r\n    void    *   m_pFont;\r\n\tu32\t\t    m_width;\r\n\tu32\t\t    m_height;\r\n\ts32\t\t    m_tx;\r\n\ts32\t\t    m_ty;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBTextTempBuffer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLBTEXTTEMPBUFFER_H__\r\n#define __CKLBTEXTTEMPBUFFER_H__\r\n\r\n#include \"BaseType.h\"\r\n\r\nclass CKLBTextTempBuffer {\r\npublic:\r\n\tstatic u32\tgetBufferSurface()\t\t{ return m_surfaceSize;\t}\r\n\tstatic u8*\tgetBuffer\t\t()\t\t{ return m_pBuffer;\t\t}\r\n\r\n\tstatic bool\tallocatorBuffer\t(u32 width, u32 height, u32 pixSize);\r\n\tstatic u8*\treallocateBuffer(u32 width, u32 height, u32 pixSize);\r\n\tstatic void\tfreeBuffer\t\t();\r\nprivate:\r\n\tstatic\tu8*\tm_pBuffer;\r\n\tstatic\tu32 m_surfaceSize;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBTexturePacker.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __TEXTURE_PACKER__\r\n#define __TEXTURE_PACKER__\r\n\r\n#include \"BaseType.h\"\r\n#include \"CKLBRendering.h\"\r\n\r\n// If defined, allocated buffer are filled with color for debugging.\r\n// #define INTERNAL_FILL_WITH_COLOR_TEXPACKER\r\n\r\nclass TexturePackerOnce;\r\n\r\ntypedef void (*compact)(void* ctx, u16 surfaceID, u16 newSurfaceID);\r\n\r\n#define FORMAT_8888\t\t(4)\r\n#define FORMAT_4444\t\t(2)\r\n#define FORMAT_8\t\t(1)\r\n\r\n#define STARTUP_FORMAT\t(FORMAT_8888)\r\n\r\nclass CKLBLuaLibPackerControl;\r\n\r\nclass TexturePacker {\r\n\tfriend class TexturePackerOnce;\r\n\tfriend class CKLBLuaLibPackerControl;\r\npublic:\r\n\tinline\r\n\tstatic u8 getCurrentModeTexture() {\r\n\t\treturn s_currentTextureMode;\r\n\t}\r\n\r\n\tinline\r\n\tstatic TexturePacker& getInstance() {\r\n\t\tstatic TexturePacker instance;\r\n\t\treturn instance;\r\n\t}\r\n\r\n\tbool init\t\t\t\t(u16 width,\t\t\tu16 height, u16 format);\r\n\tvoid release\t\t\t();\r\n\tvoid dump\t\t\t\t(bool detail);\r\n\tvoid refreshTextures\t();\r\n\tvoid unloadSurface\t\t();\r\n\tvoid reloadSurfaces\t\t();\r\n\r\n\tu16  allocateSurface\t(CKLBSprite* spr,\tu16 w,\t\tu16 h\t, void* ptrOwner, compact cbCompaction);\r\n\tu16\t reallocateSurface\t(u16 surface,\t\tu16 w,\t\tu16 h\t);\r\n\tvoid releaseSurface\t\t(u16 surface);\r\n\tvoid getSurfaceInfo\t\t(u16 surface,\t\tu32*& pixel, float& u0, float& v0, float& u1, float& v1, float& stepU, float& stepV);\r\n\tCTextureUsage*\r\n\t\t getTextureUsage\t(u16 surface);\r\n\tu16\t getSurfaceStride\t()\t{ return m_width;\t\t\t}\r\n\tvoid updateTexture\t\t(u16 surface);\r\n\tvoid setFormat\t\t\t(u16 format);\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tvoid scan\t\t\t\t(void* ctx);\r\n\tvoid setCurrentDelete\t(void* ptr);\r\n#endif\r\n\r\nprivate:\r\n\tu16\t useOtherAlloc\t\t(CKLBSprite* spr,\tu16 w,\t\tu16 h\t, void* ptrOwner,compact cbCompaction);\r\n\tTexturePackerOnce*\r\n\t\t allocateAllocator\t(u16 w, u16 h);\r\n\tbool notInIgnoreList\t(TexturePackerOnce* pack);\r\n\tvoid removeIgnoreList\t(TexturePackerOnce* pack);\r\n\tvoid addIgnoreList\t\t(TexturePackerOnce* pack);\r\n\r\n\t// Maximum 4 bit on 16 bit index.\r\n\t#define MAX_TEXTURES\t(16)\r\n\tu16\t\t\t\t\tm_currFormat;\r\n\tu16\t\t\t\t\tm_width;\r\n\tu16\t\t\t\t\tm_height;\r\n\tu16\t\t\t\t\tm_update;\r\n\t// Mode 8888, 4444, 8\r\n\tTexturePackerOnce*\tm_lastUsedPacker\t[5];\r\n\tTexturePackerOnce*\tm_allocatedPacker\t[MAX_TEXTURES];\r\n\r\n\tTexturePackerOnce*\tignore\t\t\t\t[MAX_TEXTURES];\r\n\tu8\t\t\t\t\tignoreCount;\r\n\r\n\tstatic\r\n\tu8\t\t\t\t\ts_currentTextureMode;\r\n};\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibPackerControl : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibPackerControl();\r\n\r\n\tstatic int use8888Texture(lua_State * L);\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibPackerControl(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibPackerControl();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n};\r\n\r\n#endif \t// ifndef __TEXTURE_PACKER__\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBTouchEventUI.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBTouchEventUI_h\r\n#define CKLBTouchEventUI_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBUISystem.h\"\r\n\r\nclass CKLBTouchEventUIMgr\r\n{\r\n\tfriend class CKLBUISystem;\r\nprivate:\r\n\tCKLBTouchEventUIMgr();\r\n\tvirtual ~CKLBTouchEventUIMgr();\r\n\r\npublic:\r\n\tstatic CKLBTouchEventUIMgr& getInstance();\r\n\r\n\tvoid processUI      ();\r\n\tvoid resetSelectable(CKLBUISelectable * pSelectable);\r\n\r\n\tvoid registForm     (SFormCtrlList * pList);\r\n\tvoid removeForm     (SFormCtrlList * pList);\r\n\tSFormCtrlList * searchCtrl(CKLBUISelectable * pCtrl);\r\n\r\n\tenum {\r\n\t\tMAX_TOUCH_POINT = 10,\r\n\t\tMV_BORDER = 20\t// TAPからこのpixel数以上DRAGしたら、クリック操作ではないと判断\r\n\t};\r\nprivate:\r\n\t// 現在稼働中のフォームごとに、各フォームのコントロールリストが登録される。\r\n\tSFormCtrlList\t\t*\tm_pFormBegin;\r\n\r\n\tCKLBUISelectable\t*\tm_pTarget[ MAX_TOUCH_POINT ];\r\n\tstruct {\r\n\t\tint x;\r\n\t\tint y;\r\n\t} m_tapPos[ MAX_TOUCH_POINT ];\r\n};\r\n\r\n\r\n/*!\r\n* \\class CKLBTouchEventUITask\r\n* \\brief Touch Event handler task class.\r\n* \r\n* CKLBTouchEventUITask is in charge of handling the various touch events \r\n* of the game and redistribute it to the right item. \r\n* Forms can be registered in order to be able to process some actions \r\n* on Touch Pad events.\r\n* This task is instanciated when the game starts.\r\n*/\r\nclass CKLBTouchEventUITask : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBTouchEventUITask();\r\n\tvirtual ~CKLBTouchEventUITask();\r\n\r\npublic:\r\n\tstatic CKLBTouchEventUITask * create();\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tu32 getClassID();\r\n\r\nprivate:\r\n\tbool init();\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBTouchPad.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBTouchPad.h\r\n//\r\n\r\n#ifndef CKLBTouchPad_h\r\n#define CKLBTouchPad_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n// #define\tLOG_EVENT\r\n\r\ntypedef struct {\r\n    typedef enum {\r\n        TAP,\r\n        DRAG,\r\n        RELEASE,\r\n\t\tCANCEL\r\n    } TYPE;\r\n\r\n    TYPE    type;\r\n    int     id;     // 入力点ID(multi touch 対応)\r\n    int     x;\r\n    int     y;\r\n\tvoid\t* locker;\t// 入力の使用者\r\n} PAD_ITEM;\r\n\r\n// タッチパッドキュークラス。\r\n// 基本的に、本体を正位置に構えた状態での座標のみを提供する。\r\n// 本体を回転させて使う際の座標変換は、各ゲームの責任において行うものとする。\r\nclass CKLBTouchPadQueue\r\n{\r\nprivate:\r\n    CKLBTouchPadQueue();\r\n    ~CKLBTouchPadQueue();\r\npublic:\r\n    static CKLBTouchPadQueue& getInstance();\r\n\r\n    // キューに入力アイテムを追加(システム側からアイテムを追加する際に使用)\r\n    void addQueue(int id, IClientRequest::INPUT_TYPE type, int x, int y);\r\n    \r\n    // 座標変換マトリクスを設定する\r\n    void setConvertMatrix(float * matrix);\r\n    \r\n    // キューの取得限界を現在の点に固定\r\n    inline void fixLimit() {\r\n        m_read = m_begin;\r\n        m_begin = m_rec;\r\n    }\r\n\r\n    // キューの参照点を読み出し先頭に指定する\r\n    void startItem() {\r\n        m_get = m_read;\r\n    }\r\n\r\n\tinline void setProcessing(bool process) {\r\n\t\tm_bDoingProcess = process;\r\n\t}\r\n    \r\n    // キューのアイテムを参照する\r\n    const PAD_ITEM * getItem(bool bAll = false) {\r\n\t\tconst PAD_ITEM * ret;\r\n\t\tdo {\r\n\t\t\tif(m_get == m_begin) return 0;  // これ以上読んではいけない\r\n\t\t\tret = m_itemQueue + m_get;\r\n\t        m_get = ++m_get % QUEUE_SIZE;\r\n\t\t} while(!bAll && ret->locker);\t// 既に使用済アイテムであれば次を読む(bAll == false の場合)\r\n\t\t\r\n\t\t// bAll が true の場合、マークされたイベントであっても取得する。\r\n        return ret;\r\n    }\r\n\r\n\t// アイテムに使用済みマークをつける。\r\n\tinline bool useItem(const PAD_ITEM * item, void * pUser) {\r\n\t\tif(item->locker) return false;\r\n\t\tPAD_ITEM * val = (PAD_ITEM *)item;\r\n\t\tval->locker = pUser;\r\n\t\treturn true;\r\n\t}\r\n\r\n\tvoid setIgnoreOutside(bool ignore) {\r\n\t\tm_ignoreOutScreen\t= ignore;\r\n\t\tm_maskIgnoreFinger\t= 0; // Reset all fingers.\r\n\t}\r\n\r\nprivate:\r\n\tbool\t\t\tm_bDoingProcess;\r\n    float           m_matrix[6];    // 座標変換マトリクス\r\n    \r\n    int             m_begin;        // 記録先頭\r\n    int             m_rec;          // 記録点\r\n    int             m_read;         // 読み出し先頭\r\n    int             m_get;          // 取得点\r\n\tu32\t\t\t\tm_maskIgnoreFinger;\r\n\tbool\t\t\tm_ignoreOutScreen;\r\n    \r\n    enum {\r\n        QUEUE_SIZE = 1024\r\n    };\r\n    \r\n    PAD_ITEM    m_itemQueue[ QUEUE_SIZE ];\r\n};\r\n\r\n/*!\r\n* \\class CKLBTouchPad\r\n* \\brief Touch Pad Events handler class\r\n* \r\n* CKLBTouchPad is similar to CKLBOSCtrlEvent, but only handles Touch Pad events.\r\n* It owns a queue of Touch Pad events.\r\n* This task is instanciated once when the game starts.\r\n*/\r\nclass CKLBTouchPad : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBTouchPad();\r\n    virtual ~CKLBTouchPad();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n    static CKLBTouchPad * create();\r\n\r\n    void execute(u32 deltaT);\r\n    void die();\r\n\r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIActivityIndicator.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBUIActivityIndicator.h\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#ifndef CKLBUIActivityIndicator_h\r\n#define CKLBUIActivityIndicator_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"OSWidget.h\"\r\n#include \"CKLBActivityIndicatorNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIActivityIndicator\r\n* \\brief UI Activity Indicator Task Class\r\n* This task display an OS native \"busy\" indicator to show that the device is busy doing some work.\r\n* As an example, when application is connecting or transfering data with the server.\r\n*/\r\nclass CKLBUIActivityIndicator : public CKLBUITask\r\n{\r\n    friend class CKLBTaskFactory<CKLBUIActivityIndicator>;\r\nprivate:\r\n    CKLBUIActivityIndicator();\r\n    virtual ~CKLBUIActivityIndicator();\r\npublic:\r\n    u32 getClassID();\r\n    \r\n\tstatic CKLBUIActivityIndicator * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                                            int show_type,\r\n                                            float x, float y, float width, float height,\r\n                                            int widget_id = 0);\r\n    \r\n\tbool initUI     (CLuaState& lua);\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n    \r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\nprivate:\r\n    \r\n    bool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              int show_type,\r\n              float x, float y, float width, float height,\r\n              int widget_id);\r\n    \r\n\tbool initCore(int show_type,\r\n                  float x, float y, float width, float height,\r\n                  int widget_id);\r\n\r\nprivate:\r\n    CKLBActivityIndicatorNode   *   m_pActivityIndicator;\r\n\tint                             m_ID;\r\n    \r\n\tstatic const char           *   ms_propItems[];\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUICanvas.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUICanvas_h\r\n#define CKLBUICanvas_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBCanvasSprite.h\"\r\n\r\n/*!\r\n* \\class CKLBUICanvas\r\n* \\brief Canvas Task Class\r\n* \r\n* CKLBUICanvas regroups various images to draw Canvas\r\n* The different assets must be in the same texture.\r\n*/\r\nclass CKLBUICanvas : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUICanvas>;\r\nprivate:\r\n\tCKLBUICanvas();\r\n\tvirtual ~CKLBUICanvas();\r\n\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUICanvas * create(CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback);\r\n\t\r\n\tbool init\t\t    (CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback);\r\n\tbool initCore\t    (u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback);\r\n\r\n\tbool initUI\t\t    (CLuaState& lua);\r\n\tint commandUI\t    (CLuaState& lua, int argc, int cmd);\r\n\r\n\tbool addAsset\t\t(const char* asset);\r\n\tvoid setTiledRect\t(u32 width, u32 height, const char* asset, u32 alpha);\r\n\tvoid freeze\t\t\t(bool freeze);\r\n\tvoid execute\t\t(u32 deltaT);\r\n\tvoid dieUI\t\t\t();\r\n\r\n\t\r\n\tinline virtual void setOrder    (u32 order) {\r\n\t\tif(order != m_order) {\r\n\t\t\tm_pCanvas->changeOrder(CKLBRenderingManager::getInstance(),order);\r\n\t\t\tm_order = order;\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32  getOrder    ()                      { return m_order;                   }\r\n\r\n\tinline u32          getIdxMax   ()\t\t\t\t\t\t{ return m_maxAssetCount;           }\r\n\r\n\tinline void         setCallBack (const char* callback)\t{ setStrC(m_callback, callback);\t}\r\n\tinline const char*  getCallBack ()\t\t\t\t        { return m_callback;\t\t        }\r\n\r\n\tinline void         setFreeze   (bool val) {\r\n\t\tif (!val) {\r\n\t\t\tREFRESH_A;\r\n\t\t} else {\r\n\t\t\tRESET_A;\r\n\t\t}\r\n\t\tm_pCanvas->freeze(val);\r\n\t}\r\n\r\n\tinline void drawImage           (float x, float y, u32 idx, u32 color) {\r\n\t\tCKLBImageAsset* pAsset;\r\n\t\tif (idx >= m_assetCount) {\r\n\t\t\tpAsset = NULL;\r\n\t\t} else {\r\n\t\t\tpAsset = m_assets[idx];\r\n\t\t}\r\n\r\n\t\tm_pCanvas->drawImage(\r\n\t\t\tx,\t\t\t// X \r\n\t\t\ty,\t\t\t// Y\r\n\t\t\tpAsset,\t\t// Asset Index\r\n\t\t\tcolor\r\n\t\t);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\t\r\n\tinline void drawImageScale      (float x, float y, float scale, u32 idx, u32 color) {\r\n\t\tCKLBImageAsset* pAsset;\r\n\t\tif (idx >= m_assetCount) {\r\n\t\t\tpAsset = NULL;\r\n\t\t} else {\r\n\t\t\tpAsset = m_assets[idx];\r\n\t\t}\r\n\r\n\t\tm_pCanvas->drawScale(\r\n\t\t\tx,y,scale,\r\n\t\t\tpAsset,\t\t// Asset Index\r\n\t\t\tcolor\r\n\t\t);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void fillRect            (float x, float y, float w, float h, u32 color) {\r\n\t\tm_pCanvas->fillRect(x,y,w,h,color);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void startDynamicSection (u32 idx)\t{\tm_pCanvas->startDynamicSection(idx);\t}\r\n\tinline void endDynamicSection   (u32 idx)\t{\tm_pCanvas->endDynamicSection(idx);\t\t}\r\n\t\r\n\tinline void dynamicSectionTranslate(u32 idx, float deltaX, float deltaY) {\r\n\t\tm_pCanvas->dynamicSectionTranslate(idx, deltaX, deltaY);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void dynamicSectionColor(u32 idx, u32 color) {\r\n\t\tm_pCanvas->dynamicSectionColor(idx, color);\r\n\t\tgetNode()->markUpColor();\r\n\t}\r\n\r\nprivate:\r\n\tCKLBCanvasSprite*\tm_pCanvas;\r\n\tCKLBTextureAsset*\tm_texture;\r\n\tCKLBImageAsset**\tm_assets;\r\n\tu32\t\t\t\t\tm_handle;\r\n\tu32\t\t\t\t\tm_assetCount;\r\n\tu32\t\t\t\t\tm_maxAssetCount;\r\n\r\n\tu32\t\t\t\t\tm_order;\r\n\tconst char*\t\t\tm_callback;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n\r\n\tvoid setTiledRect\t(u32 width, u32 height, u32 idx, u32 alpha);\r\n};\r\n\r\n#endif // CKLBCanvas_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIClip.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIClip_h\r\n#define CKLBUIClip_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIClip\r\n* \\brief Clip Task Class\r\n* \r\n* CKLBUIClip creates a Task clipping the screen for the required area.\r\n* Sub tasks outside the clipping area will not be drawn.\r\n*/\r\nclass CKLBUIClip : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIClip>;\r\nprivate:\r\n\tCKLBUIClip();\r\n\tvirtual ~CKLBUIClip();\r\n\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tstatic CKLBUIClip * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\t\t\t\t\tfloat x, float y, float clip_width, float clip_height);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getOrder() { return m_uiOrder;\t}\r\n\tinline void\tsetOrder(u32 order) {\r\n\t\tif (order != m_uiOrder) {\r\n\t\t\tm_uiOrder = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getWidth() { return m_fWidth; }\r\n\tinline void\t setWidth(float width) {\r\n\t\tif (width != m_fWidth) {\r\n\t\t\tm_fWidth = width;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getHeight() { return m_fHeight; }\r\n\tinline void\t setHeight(float height) {\r\n\t\tif (height != m_fHeight) {\r\n\t\t\tm_fHeight = height;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getMaxOdr() { return m_uiMaxOdr;\t}\r\n\tinline void\tsetMaxOdr(u32 maxodr) {\r\n\t\tif (maxodr != m_uiMaxOdr) {\r\n\t\t\tm_uiMaxOdr = maxodr;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setPosition(float x, float y) {\r\n\t\tsetX(x);\r\n\t\tsetY(y);\r\n\t\tgetNode()->setTranslate(x, y);\r\n\t\tREFRESH_A;\r\n\t}\r\n\r\n\tinline void setSize(float width, float height) {\r\n\t\tm_fWidth  = width;\r\n\t\tm_fHeight = height;\r\n\t\tREFRESH_A;\r\n\t}\r\n\r\nprivate:\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              u32 base_order, u32 max_order,\r\n              float x, float y, float clip_width, float clip_height);\r\n\r\n\tbool initCore(u32 base_order, u32 max_order,\r\n\t\t\t\t  float x, float y, float clip_width, float clip_height);\r\n\r\n\tbool setClip(u32 orderBegin, u32 orderEnd,\r\n\t\t\t\t s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\r\n\t// clip情報\r\n\tint\t\t\t\t\t\tm_basePriority;\t// クリッピング基点プライオリティ\r\n\tint\t\t\t\t\t\tm_endPriority;\t// クリッピング終了プライオリティ\r\n\r\n\tu32\t\t\t\t\t\tm_uiOrder;\r\n\tfloat\t\t\t\t\tm_fWidth;\r\n\tfloat\t\t\t\t\tm_fHeight;\r\n\tu32\t\t\t\t\t\tm_uiMaxOdr;\r\n\r\n\tfloat\t\t\t\t\tm_clipX;\r\n\tfloat\t\t\t\t\tm_clipY;\r\n\tint\t\t\t\t\t\tm_clipWidth;\r\n\tint\t\t\t\t\t\tm_clipHeight;\r\n\r\n\tvoid\t\t\t\t*\tm_clipHandle;\r\n\tstatic PROP_V2\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIClip_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIControl.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIControl_h\r\n#define CKLBUIControl_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\n/*!\r\n* \\class CKLBUIControl\r\n* \\brief UI Control Task class.\r\n* \r\n* CKLBUIControl is a high level Touch Pad Events handler.\r\n* Events (Tap, Drag, Release) are interpreted into higher level events such as \r\n* Click, Double Click, Drag, Long Tap, Pinch).\r\n* It provides a few callbacks that are called when some actions are processed.\r\n* Events can be masked to select only the ones you want.\r\n*/\r\nclass CKLBUIControl : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIControl>;\r\nprivate:\r\n\tCKLBUIControl();\r\n\tvirtual ~CKLBUIControl();\r\n\r\n\tbool init(CKLBTask* pTask, const char* onClick, const char* onDrag);\r\npublic:\r\n\tstatic CKLBUIControl* create(CKLBTask* pParentTask, const char* onClick, const char* onDrag);\r\n\r\n\tu32 getClassID();\r\n\r\n\tbool initScript  (CLuaState& lua);\r\n\tint commandScript(CLuaState& lua);\r\n\r\n\tinline void setMask\t\t\t(u16 mask)\t\t\t\t\t{ m_callbackMask = mask;\t\t\t\t}\r\n\tinline void setOnPinch\t\t(const char* onPinch)\t\t{ setStrC(m_onPinch, onPinch);\t\t\t}\r\n\tinline void setOnDblClick\t(const char* onDblClick)\t{ setStrC(m_onDblClick, onDblClick);\t}\r\n\tinline void setOnLongTap\t(const char* onLongTap)\t\t{ setStrC(m_onLongTap, onLongTap);\t\t}\r\n\tinline void setOnEventRaw\t(const char* onRawEvent)\t{ setStrC(m_onEventRaw, onRawEvent);\t}\r\n\tinline bool setGroup\t\t(const char* group_name)\t{\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\treturn fGrp.addForm(&m_ctrlList, group_name);\r\n\t}\r\n\r\n\tinline void lock            (bool lock_mode)            {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\tfGrp.setWorking(&m_ctrlList, lock_mode, this);\r\n\t}\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tenum {\r\n\t\tMASK_CLICK     = 0x0001,\t// クリックcallbackを禁止する\r\n\t\tMASK_DRAG      = 0x0002,\t// ドラッグcallbackを禁止する\r\n\t\tMASK_PINCH     = 0x0004,\t// ピンチイン/アウト/ローテーションcallbackを禁止する\r\n\t\tMASK_DBLCLICK  = 0x0008,\t// ダブルクリックcallbackを禁止する\r\n\t\tMASK_LONGTAP   = 0x0010\t\t// ロングタップcallbackを禁止する\r\n\t};\r\nprivate:\r\n\tinline void setGetAll(bool b) { m_bAll = b; }\r\n\r\n\tvoid calc_distance(float * dist, float * angle);\r\n\r\n\tenum {\r\n\t\tPOINT_NUMS = 2,\r\n        CALIB = 16,\r\n        CLICKTIME = 300\r\n\t};\r\n\r\n\r\n\t// 操作が始まったとき、タップされた位置(第一ポイントのみ)\r\n\ts32\t\t\tm_tapX;\r\n\ts32\t\t\tm_tapY;\r\n\r\n\t// タップ位置からドラッグされた差分位置(ドラッグ操作用)\r\n\ts32\t\t\tm_moveX;\r\n\ts32\t\t\tm_moveY;\r\n\r\n    // タップ時から動いた最大距離の絶対値\r\n    s32         m_maxX;\r\n    s32         m_maxY;\r\n\r\n\t// それぞれの操作点座標\r\n\ts32\t\t\tm_posX[ POINT_NUMS ];\r\n\ts32\t\t\tm_posY[ POINT_NUMS ];\r\n\tfloat\t\tm_orgLen;\t// 最初に2点タップされた時点の、2点間の距離\r\n    float       m_orgAngle; // 最初に2点タップされた時点の、2点間を結ぶ線分の角度\r\n\t// 操作中フラグ\r\n\t// TAPでtrue\r\n\t// DRAG/RELEASEが来てもtrueでなければ自身への操作として受け付けない\r\n\t// RELEASE時にfalseになる。\r\n\tbool\t\tm_bAll;\r\n\tbool\t\tm_bControl;\t// 何らかの操作中にtrueとなる\r\n\tint\t\t\tm_id[ POINT_NUMS ];\t// 操作ID(マルチタッチ用)2点までを認識する\r\n\tbool\t\tm_f_move[ POINT_NUMS ];\t// 閾値以上移動したらtrue\r\n\tint\t\t\tm_tcnt[ POINT_NUMS ];\r\n\tint\t\t\tm_usePt;\t// 操作に使用しているポイントの数(最大2)\r\n    \r\n    bool        m_bClick;   // クリック成立\r\n    s32         m_clickX;   // クリック成立時の座標\r\n    s32         m_clickY;   // クリック成立時の座標\r\n    u32         m_timeCnt;  // クリック成立からの経過時間\r\n    \r\n\tSFormCtrlList\tm_ctrlList;\t\t// UI_Form / UI_List と同様のグループ制御を行うためのメンバ\r\n\tCKLBModalStack\tm_modalStack;\r\n\tbool\t\t\tm_bModalEnable;\r\n\r\n\tint\t\t\t\tm_lastClick;\t// 最後にクリックイベントを発生させたフレーム\r\n\r\n\tu16\t\t\t\tm_callbackMask;\t// コールバックマスク\r\n\r\n\tconst char\t*\tm_onClick;      // クリック時のコールバック\r\n\tconst char\t*\tm_onDrag;       // ドラッグ自のコールバック\r\n\tconst char\t*\tm_onPinch;      // ピンチ操作のコールバック\r\n    const char  *   m_onDblClick;   // ダブルクリック時のコールバック\r\n\tconst char\t*\tm_onLongTap;\t// ロングタップ(長押し)時のコールバック\r\n\tconst char  *   m_onEventRaw;\t// Low Level Raw event.\r\n};\r\n\r\n#endif // CKLBMapControl_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIDebugItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIDebugItem_h\r\n#define CKLBUIDebugItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n\r\n/*!\r\n* \\class CKLBUIDebugItem\r\n* \\brief Debug Item Task Class\r\n* \r\n* CKLBUIDebugItem allows to display debug purpose items in the Game.\r\n* A few properties (such as text, color, etc.) can be modified in runtime \r\n* and used for debugging.\r\n*/\r\nclass CKLBUIDebugItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIDebugItem>;\r\nprivate:\r\n\tCKLBUIDebugItem();\r\n\tvirtual ~CKLBUIDebugItem();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, const char* callback,u32 id);\r\n\tbool initCore(u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, const char* callback,u32 id);\r\npublic:\r\n\tstatic CKLBUIDebugItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, const char* callback,u32 id);\r\n\tu32 getClassID  ();\r\n\tbool initUI     (CLuaState& lua);\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tinline virtual void setOrder    (u32 order)\t\t    { m_order = order; m_update = true; }\r\n\tinline virtual u32 getOrder     ()\t\t\t\t    { return m_order;\t}\r\n\r\n\tinline void         setAlpha    (u32 alpha)\t\t    { m_alpha = alpha; m_update = true;\t}\r\n\tinline u32          getAlpha    ()\t\t\t\t    { return m_alpha;\t}\r\n\r\n\tinline void         setU24Color (u32 color)\t        { m_color = color; m_update = true;\t}\r\n\tinline u32          getU24Color ()\t\t\t        { return m_color;\t}\r\n\r\n\tinline void         setColor    (u32 color)\t\t    { m_alpha = color >> 24; m_color = color & 0xFFFFFF; m_update = true; }\r\n\tinline u32          getColor    ()\t\t\t\t    { return (m_alpha << 24) | m_color; }\r\n\r\n\tinline void         setFont     (const char* font)\t{ setStrC(m_font, font); m_update = true;\t}\r\n\tinline const char*  getFont     ()\t\t\t        { return m_font; }\r\n\r\n\tinline void         setSize     (u32 size)\t\t    { m_size = size; m_update = true;\t}\r\n\tinline u32          getSize     ()\t\t\t\t    { return m_size; }\r\n\r\n\tinline void         setText     (const char* text)\t{ setStrC(m_text, text); m_update = true;\t}\r\n\tinline const char*  getText     ()\t\t\t        { return m_text; }\r\n\r\nprivate:\r\n\tu32\t\t\t\t\t\t\tm_order;\r\n\tu8\t\t\t\t\t\t\tm_format;\r\n\tu8\t\t\t\t\t\t\tm_alpha;\r\n\tu32\t\t\t\t\t\t\tm_color;\r\n\tconst char*\t\t\t\t\tm_font;\r\n\tconst char*\t\t\t\t\tm_text;\r\n\tu32\t\t\t\t\t\t\tm_size;\r\n\r\n\tbool setup_node();\r\n\t// 現在は VDocで仮実装しておく。\r\n\tCKLBNodeVirtualDocument\t*\tm_pLabel;\r\n\tbool\t\t\t\t\t\tm_update;\r\n\r\n\tSTextInfo\t\t\t\t\tm_txinfo;\r\n\tconst char\t\t\t\t*\tm_callback;\r\n\tint\t\t\t\t\t\t\tm_ID;\r\n\r\n\tint\t\t\t\t\t\t\tm_padId;\r\n\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIDebugItem_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIDragIcon.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIDragIcon_h\r\n#define CKLBUIDragIcon_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\n/*!\r\n* \\class CKLBUIDragIcon\r\n* \\brief Drag Icon Task Class\r\n* \r\n* CKLBUIDragIcon allows to create a Task owning an image and answering the Drag Events.\r\n* The image can be scalled and/or moved while draging.\r\n* A specific drag area can also be defined to limitate the DragIcon possible received events.\r\n*/\r\nclass CKLBUIDragIcon : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIDragIcon>;\r\nprivate:\r\n\tCKLBUIDragIcon();\r\n\tvirtual ~CKLBUIDragIcon();\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\ttypedef struct {\r\n\t\ts32 x;\r\n\t\ts32 y;\r\n\t\ts32 width;\r\n\t\ts32 height;\r\n\t} AREA;\r\n\r\n\tstatic CKLBUIDragIcon * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\tu32 order, float x, float y, AREA * tap_area,\r\n\t\t\t\t\t\t\t\t\tconst char * asset, const char * drag_asset,\r\n\t\t\t\t\t\t\t\t\ts32 drag_order_offset, float drag_alpha, \r\n\t\t\t\t\t\t\t\t\tfloat center_x, float center_y, \r\n\t\t\t\t\t\t\t\t\tconst char * callback, u32 flags = 0);\r\n\r\n\tbool initUI (CLuaState& lua);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline void setEnable(bool enable) {\r\n\t\tif(m_enable != enable) {\r\n\t\t\t// 現在と異なる状態を設定した場合、\r\n\t\t\t// 許可/不許可にかかわらず一旦操作をリセットする\r\n\t\t\tm_state  = S_WAIT;\r\n\t\t\tm_enable = enable;\r\n\t\t\tif(enable) {\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t} else {\r\n\t\t\t\tRESET_A;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfloat\t\t\tm_dragScaleX;\r\n\tfloat\t\t\tm_dragScaleY;\r\n\tu32\t\t\t\tm_flags;\r\n\tu32\t\t\t\tm_order;\r\n\tconst char *\tm_callBack;\r\n\tconst char *\tm_dragAsset;\r\n\tconst char *\tm_asset;\r\n\r\n\tinline u32\t        getOrder    ()\t\t\t\t\t\t{\treturn m_order;\t\t\t}\r\n\tinline const char*  getAsset    ()\t\t\t\t\t    {\treturn m_asset;\t\t\t}\r\n\tinline const char*  getDrag     ()\t\t\t\t\t    {\treturn m_dragAsset;\t\t}\r\n\tinline u32\t        getFlags    ()\t\t\t\t\t\t{\treturn m_flags;\t\t\t}\r\n\tinline void         setFlags    (u32 flag)\t\t\t\t{\tm_flags = flag;\t\t\t}\r\n\tinline void         setCallBack (const char* callback)\t{\tsetStrC(m_callBack, callback);\t}\r\n\tinline const char*  getCallBack ()\t\t\t\t        {\treturn m_callBack;\t\t}\r\n\tinline bool         getEnable   ()\t\t\t\t\t\t{\treturn m_enable;\t\t}\r\n\r\n\tinline void         setDragScaleX(float scale)\t\t\t{\t\r\n\t\tm_dragScaleX = scale;\r\n\t\tm_pDragNode->setScale(m_dragScaleX, m_dragScaleY);\r\n\t}\r\n\tinline float        getDragScaleX()\t\t\t\t\t    {\treturn m_dragScaleX;\t}\r\n\r\n\tinline void         setDragScaleY(float scale)\t\t\t{\t\r\n\t\tm_dragScaleY = scale;\t\r\n\t\tm_pDragNode->setScale(m_dragScaleX, m_dragScaleY);\r\n\t}\r\n\tinline float        getDragScaleY()\t\t\t\t\t    {\treturn m_dragScaleY;\t}\r\n\r\n\tinline void         setDragArea(AREA area)\t\t\t\t{\tm_clip = area;\t\t\t}\r\n\r\nprivate:\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 order, float x, float y, AREA * tap_area,\r\n\t\t\t\tconst char * asset, const char * drag_asset,\r\n\t\t\t\ts32 drag_order_offset, float drag_alpha, \r\n\t\t\t\tfloat center_x, float center_y, \r\n\t\t\t\tconst char * callback, u32 flags = 0);\r\n\r\n\tbool initCore(\r\n\t\t\t\t\tu32 order, float x, float y, AREA * tap_area,\r\n\t\t\t\t\tconst char * asset, const char * drag_asset,\r\n\t\t\t\t\ts32 drag_order_offset, float drag_alpha, \r\n\t\t\t\t\tfloat center_x, float center_y, \r\n\t\t\t\t\tconst char * callback, u32 flags = 0);\r\n\r\n\ttypedef enum {\r\n\t\tS_WAIT,\t//!< 待機中\r\n\t\tS_DRAG,\t//!< ドラッグ中\r\n\t} STATE;\r\n\r\n\r\n\tbool\t\tis_tap      (int x, int y);\r\n\tbool\t\tget_area    (CLuaState& lua, int argp, AREA& area);\r\n\tbool\t\tdrag_clip   (s32 drx, s32 dry, s32 * x, s32 * y);\r\n\r\n\tAREA\t\t\t\t\tm_clip;\t\t// ドラッグ可能範囲\r\n\tAREA\t\t\t\t\tm_area;\t\t// アイコン操作エリア\r\n\r\n\t// 相対座標から絶対座標を求めるためのオフセット位置\r\n\tint\t\t\t\t\t\tm_ofs_x;\r\n\tint\t\t\t\t\t\tm_ofs_y;\r\n\r\n\t// ドラッグ中表示される半透明アイコンの中心位置(タップ位置に相当する部分)\r\n\tfloat\t\t\t\t\tm_center_x;\r\n\tfloat\t\t\t\t\tm_center_y;\r\n\r\n\tint\t\t\t\t\t\tm_tid;\t\t// 操作に使用されるポイントのID\r\n\tSTATE\t\t\t\t\tm_state;\r\n\r\n\tbool\t\t\t\t\tm_enable;\t\t\t// false の間は操作を許可しない。\r\n\t//bool\t\t\t\t\tm_bModalEnable;\t\t// モーダルスタックによる許可状態\r\n\r\n\tCKLBNode\t\t\t*\tm_pIconNode;\t// アイコンとしての表示\r\n\tCKLBNode\t\t\t*\tm_pDragNode;\t// ドラッグ中指についてくる表示\r\n\r\n\tu32\t\t\t\t\t\tm_iconHandle;\r\n\tu32\t\t\t\t\t\tm_dragHandle;\r\n\r\n\tCKLBModalStack\t\t\tm_modalStack;\t// モーダルスタック\r\n\r\n\tstatic\tPROP_V2\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIDragIcon_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIForm.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIForm_h\r\n#define CKLBUIForm_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeAnimPack.h\"\r\n#include \"CKLBFormIF.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\n/*!\r\n* \\class CKLBUIForm\r\n* \\brief Form Task Class\r\n* \r\n* CKLBUIForm is designed to manage forms in the Game.\r\n* It allows to manage a whole form (composed of several sub elements) very easily.\r\n*/\r\nclass CKLBUIForm : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIForm>;\r\nprivate:\r\n\tCKLBUIForm();\r\n\tvirtual ~CKLBUIForm();\r\n\r\n\tbool init(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, bool bAssetFile, const char* asset, bool bExclusive, bool modal, bool urgent);\r\n\tbool initCore(u32 order, float x, float y, bool bAssetFile, const char* asset, u32 size, bool bExclusive, bool modal, bool urgent);\r\n\r\npublic:\r\n\tstatic CKLBUIForm* create(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, bool bAssetFile, const char* asset, bool bExclusive, bool modal, bool urgent);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tu32 getClassID();\r\n\r\n\t// Read only\r\n\tinline const char*  getAsset    ()\t\t\t\t    { return m_asset;\t\t\t}\r\n\r\n\t// Read Only\r\n\tinline \r\n\tvirtual u32         getOrder    ()\t\t\t\t\t{ return m_order;\t\t\t}\r\n\r\n\tinline bool         getExclusive()\t\t\t\t\t{ return m_bExclusive;\t\t}\r\n\tinline void         setExclusive(bool exclusive)\t{ m_bExclusive = exclusive; }\r\n\t\r\n\t// Read Only\r\n\tinline bool         getAssetFile()\t\t\t\t\t{ return m_bAssetFile;\t\t}\r\n\r\n\t/* Read only\r\n\tinline\r\n\tvoid setAssetFile(bool fileAsset)\t\t\t{ m_bAssetFile = fileAsset; }\r\n\t*/\r\n\r\n\tinline void setEnable       (bool isEnable)\t\t            {\r\n\t\tm_bEnable = isEnable;\r\n\t\tCKLBUISelectable * pItem;\r\n\t\tfor(pItem = m_ctrlList.pBegin; pItem; pItem = pItem->getNextSelectable()) {\r\n\t\t\tpItem->setEnabled(isEnable);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void inputEnable     (bool bEnable)\t\t\t\t\t{ \r\n\t\tm_bInputEnable = bEnable;\r\n\t\tm_ctrlList.bEnable = m_bEnable && m_bInputEnable;\t// モーダル状態との複合になる。\r\n\t}\r\n\r\n\tinline bool setAnimCallback (const char* callback)\t\t        { return m_animpack.setCallback(callback);\t\t}\r\n\r\n\tinline bool animation       (const char* animname, bool blend)  { return m_animpack.kickAnim(getNode(), animname, blend);\t}\r\n\r\n\tinline bool animEnter       ()\t\t\t\t\t\t\t\t\t{ return m_animpack.kickEnter(getNode());\t\t}\r\n\r\n\tinline bool animLeave       ()\t\t\t\t\t\t\t\t\t{ return m_animpack.kickLeave(getNode());\t\t}\r\n\r\n\tinline bool isAnim          (const char* name)\t\t\t\t\t{\r\n\t\tint cnt = m_animpack.getAnimCounter(name);\r\n\t\treturn (cnt > 0);\r\n\t}\r\n\r\n\tinline bool skipAnim        (const char* name)\t\t\t\t\t{ return m_animpack.skipAnim(getNode(), name);\t}\r\n\r\n\tinline bool setGroup        (const char* group_name)\t\t\t{ return CKLBFormGroup::getInstance().addForm(&m_ctrlList, group_name);\t}\r\n\r\n\tinline bool existNode       (const char* name)\t\t\t\t\t{ return m_formIF.isExistNode(getNode(), name);\t}\r\n\r\n\tvoid\t\tsetGlobalVolume (float volume);\r\nprotected:\r\n\tu32\t\t\tm_order;\r\n\tconst char* m_asset;\r\n\tbool\t\tm_bAssetFile;\r\n\tbool\t\tm_bExclusive;\r\nprivate:\r\n\tvoid         setGlobalVolume_r  (CKLBNode* pNode, float volume);\r\n\tbool         setFormEnable      (bool bEnable);\r\n\tvirtual void setVisible         (bool visible);\r\n\r\n\tCKLBNode\t\t*\tm_pFormNode;\r\n\tSFormCtrlList\t\tm_ctrlList;\r\n\tu32\t\t\t\t\tm_handle;\r\n\r\n\tCKLBNodeAnimPack\tm_animpack;\t\t// ポインタではないので注意\r\n\r\n\tCKLBFormIF\t\t\tm_formIF;\r\n\tCKLBModalStack\t\tm_modalStack;\r\n\r\n\tbool\t\t\t\tm_bEnable;\t\t// これまでのモーダルenable\r\n\tbool\t\t\t\tm_bInputEnable;\t// これまでの InputEnable\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIForm_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIFreeVertItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIFreeVertItem_h\r\n#define CKLBUIFreeVertItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIFreeVertItem\r\n* \\brief Free Vertex Item Task Class\r\n* \r\n* CKLBUIFreeVertItem can display image like CKLBUISimpleItem.\r\n* However, it is possible to modify the UV, Colors and coordinate for each vertex.\r\n* It is usefull also to just display a filled area with a given RGBA color, or gradient display \r\n* without texture at all.\r\n*/\r\nclass CKLBUIFreeVertItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIFreeVertItem>;\r\nprivate:\r\n\tCKLBUIFreeVertItem();\r\n\tvirtual ~CKLBUIFreeVertItem();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset, float* vertices);\r\n\tbool initCore(u32 order, float x, float y, const char* asset, float* vertices);\r\npublic:\r\n\tu32 getClassID();\r\n\tstatic CKLBUIFreeVertItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset, float* vertices);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline virtual u32 getOrder() {\treturn m_order; }\r\n\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif (m_order != order) {\r\n\t\t\tgetNode()->setPriority(order);\r\n\t\t\tm_order = order;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getAsset() { return m_asset; }\r\n\r\n\tinline void setVertCol(int idx, u32 argb) {\r\n\t\tm_arrColor[idx] = argb;\r\n\t\tassignVertColors();\r\n\t}\r\n\r\n\tvoid setVertColors\t(u32* colors);\r\n\tvoid setVertUV\t\t(float* uv);\r\n\tvoid setVertXY\t\t(float* coord);\r\n\r\nprivate:\r\n\tu32         m_order;\r\n\tconst char* m_asset;\r\n\r\n\tbool setVertColors  (CLuaState& lua);\r\n\tbool setVertices    (CLuaState& lua, float* tmpDest = NULL);\t// Lua配列から頂点座標値を取り込んでおく\r\n\tvoid setUV          (CKLBImageAsset * pTex);\t                // テクスチャからUV値を取り込んでおく\r\n\tbool setArrUV       (CLuaState& lua);\t\t                    // Lua配列からUV値を取り込んでおく\r\n\r\n\tvoid setVertColors  ();\r\n\tvoid setVertices    ();     // 頂点座標値配列から、座標値を設定する\r\n\tvoid setUV          ();\t    // UV値配列から、UV値を設定する。\r\n\r\nprivate:\r\n\tinline void assignVertColors() {\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tu32 col;\r\n\t\t\tu32 color = m_arrColor[i];\r\n\t\t\tu8* pCol = (u8*)&col;\r\n\t\t\t// Memory order cast to 'col'\r\n\t\t\tpCol[0] = color >> 16;\t// R\r\n\t\t\tpCol[1] = color >> 8;\t// G\r\n\t\t\tpCol[2] = color;\t\t// B\r\n\t\t\tpCol[3] = color >> 24;  // A\r\n\r\n\t\t\tm_pDynSprite->setVertexColor(getNode(),i, col);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void assignVertices() {\r\n\t\t// 4頂点分の座標値が頂点配列に格納されているので、\r\n\t\t// それをDynSpriteに設定する。\r\n\r\n\t\t//\r\n\t\t// Patch coordinate to fit screen if we are in bordeless mode.\r\n\t\t//\r\n\t\tint w = CKLBDrawResource::getInstance().width ();\r\n\t\tint h = CKLBDrawResource::getInstance().height();\r\n\r\n\t\tif (\r\n\t\t\t(((int)m_arrVert[0]) == 0) &&\r\n\t\t\t(((int)m_arrVert[1]) == 0) &&\r\n\t\t\t(((int)m_arrVert[2]) == w) &&\r\n\t\t\t(((int)m_arrVert[3]) == 0) &&\r\n\t\t\t(((int)m_arrVert[4]) == w) &&\r\n\t\t\t(((int)m_arrVert[5]) == h) &&\r\n\t\t\t(((int)m_arrVert[6]) == 0) &&\r\n\t\t\t(((int)m_arrVert[7]) == h)\r\n\t\t   )\r\n\t\t{\r\n\t\t\tfloat oxf = CKLBDrawResource::getInstance().ox();\r\n\t\t\tfloat oyf = CKLBDrawResource::getInstance().oy();\r\n\t\t\tm_arrVert[0] -= oxf;\r\n\t\t\tm_arrVert[1] -= oyf;\r\n\t\t\tm_arrVert[2] += oxf;\r\n\t\t\tm_arrVert[3] -= oyf;\r\n\t\t\tm_arrVert[4] += oxf;\r\n\t\t\tm_arrVert[5] += oyf;\r\n\t\t\tm_arrVert[6] -= oxf;\r\n\t\t\tm_arrVert[7] += oyf;\r\n\t\t}\r\n\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tm_pDynSprite->setVertexXY(i, m_arrVert[i*2], m_arrVert[(i*2) + 1]);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void assignUV()\r\n\t{\r\n\t\t// 4頂点分の座標値が頂点配列に格納されているので、\r\n\t\t// それをDynSpriteに設定する。\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tm_pDynSprite->setVertexUV(i, m_arrUV[i*2], m_arrUV[(i*2) + 1]);\r\n\t\t}\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\r\n\tCKLBImageAsset\t*\tm_pTex;\r\n\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\r\n\tu32\t\t\t\t\tm_handle;\r\n\r\n\tfloat\t\t\t\tm_arrVert[8];\r\n\tfloat\t\t\t\tm_arrUV[8];\r\n\tfloat\t\t\t\tm_arrOriginalUV[8];\r\n\tu32\t\t\t\t\tm_arrColor[4];\r\n\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\tstatic const u16\tms_indices[];\r\n\r\n\t// プロパティのインデックス\r\n};\r\n\r\n#endif // CKLBUIFormVertItem_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIGroup.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIGroup_h\r\n#define CKLBUIGroup_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBNodeAnimPack.h\"\r\n\r\n/*!\r\n* \\class CKLBUIGroup\r\n* \\brief Group Task Class\r\n* \r\n* CKLBUIGroup allows to easily manage UITasks groups.\r\n* With CKLBUIGroup you can anim or skip the anim of a whole group of tasks \r\n* at the same time with a single command.\r\n*/\r\nclass CKLBUIGroup : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIGroup>;\r\nprivate:\r\n\tCKLBUIGroup();\r\n\tvirtual ~CKLBUIGroup();\r\n\r\n\tbool init(CKLBUITask* parent, CKLBNode* pNode, float x, float y);\r\n\tbool initCore(float x, float y);\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUIGroup* create(CKLBUITask* parent, CKLBNode* pNode, float x, float y);\r\n\tbool initUI     (CLuaState& lua);\r\n\tint  commandUI  (CLuaState& lua, int argc, int cmd);\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tinline bool setAnimCallback\t(const char* callback)\t\t\t{ return m_animpack.setCallback(callback);\t\t\t\t}\r\n\tinline bool setAnimation\t(const char* name, bool blend)\t{ return m_animpack.kickAnim(getNode(), name, blend);\t}\r\n\tinline bool skipAnim\t\t(const char* name)\t\t\t\t{ return m_animpack.skipAnim(getNode(), name);\t\t\t}\r\n\tinline bool isAnim\t\t\t(const char* name)\t\t\t\t{ return name ? (m_animpack.getAnimCounter(name) > 0) : false; }\r\n\r\n\tCKLBNodeAnimPack\tm_animpack;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIGroup_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUILabel.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUILabel_h\r\n#define CKLBUILabel_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBLabelNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUILabel\r\n* \\brief Label Task Class\r\n* \r\n* CKLBUILabel is a basic text label task.\r\n*/\r\nclass CKLBUILabel : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUILabel>;\r\nprivate:\r\n\tCKLBUILabel();\r\n\tvirtual ~CKLBUILabel();\r\n\r\n\tbool init(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align);\r\n\tbool initCore(u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align);\r\npublic:\r\n\tstatic CKLBUILabel* create(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align);\r\n\tvirtual u32 getClassID();\r\n\r\n\tbool initUI (CLuaState& lua);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline virtual u32 getOrder()\t{ return m_order;\t}\r\n\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif (order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getAlign()\t{ return m_align;\t}\r\n\r\n\tinline void setAlign(u32 align) {\r\n\t\tif (align != m_align) {\r\n\t\t\tm_align  = align;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setText(const char* txt) {\r\n\t\tif (txt) {\r\n\t\t\tif ((!m_text) || (strcmp(txt,m_text)!=0)) {\r\n\t\t\t\tsetStrC(m_text, txt);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_text) {\r\n\t\t\t\tsetStrC(m_text, txt);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getText()\t\t{ return m_text;\t}\r\n\r\n\tinline void setAlpha(u32 alpha)\t\t{ \r\n\t\tif(alpha != m_alpha) {\r\n\t\t\tm_alpha = alpha;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline u32 getAlpha()\t\t\t\t{ return m_alpha;\t}\r\n\r\n\tinline void setU24Color(u32 color)\t{ \r\n\t\tif(color != m_color) {\r\n\t\t\tm_color = color;\t\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline u32 getU24Color()\t\t\t{ return m_color;\t}\r\n\r\n\tinline void setColor(u32 color) {\r\n\t\tu32 alpha = color>>24;\r\n\t\tu32 col\t  = color & 0xFFFFFF;\r\n\t\tif (alpha != m_alpha) {\r\n\t\t\tm_alpha = alpha;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\r\n\t\tif (col != m_color) {\r\n\t\t\tm_color = col;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getColor()\t{ return m_color | (m_alpha<<24);\t}\r\n\r\n\tinline void setFont(const char* font) {\r\n\t\tif (font) {\r\n\t\t\tif ((!m_font) || (strcmp(font,m_font)!=0)) {\r\n\t\t\t\tsetStrC(m_font, font);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_font) {\r\n\t\t\t\tsetStrC(m_font, font);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getFont()\t\t{ return m_font; }\r\n\r\n\tinline void setFontSize(u32 size) {\r\n\t\tif (size != m_size) {\r\n\t\t\tm_size = size;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getFontSize() { return m_size; }\r\n\r\n\tinline void setPosition(float x, float y) {\r\n\t\tsetX(x);\r\n\t\tsetY(y);\r\n\t\tREFRESH_A;\r\n\t}\r\n\r\nprivate:\r\n\tu32\t\t\tm_align;\r\n\tu32\t\t\tm_color;\r\n\tu32\t\t\tm_size;\r\n\tu32\t\t\tm_order;\r\n\tconst char* m_font;\r\n\tconst char* m_text;\r\n\tu8\t\t\tm_alpha;\r\n\r\n\tbool setup_node();\r\n\t\r\n\t// 現在は VDocで仮実装しておく。\r\n\tCKLBLabelNode\t\t\t*\tm_pLabel;\r\n\tbool\t\t\t\t\t\tm_update;\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUILabel_h\r\n\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIList.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIList_h\r\n#define CKLBUIList_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeAnimPack.h\"\r\n#include \"CKLBFormIF.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"DataSet_JSonDB.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBPropertyBag.h\"\r\n#include \"CKLBDragCallbackIF.h\"\r\n\r\nclass CKLBUIList;\r\n\r\nclass CKLBListDrag : public CKLBDragCallbackIF\r\n{\r\npublic:\r\n\tCKLBListDrag(CKLBUIList * parent, const char * funcname);\r\n\tvirtual ~CKLBListDrag();\r\n\tvoid callback(PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y);\r\n\r\nprivate:\r\n\tCKLBUIList\t\t*\tm_pParent;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIList\r\n* \\brief List Task Class\r\n* \r\n* CKLBUIList allows to create and manage lists of items.\r\n* It comes with its own scrollbar.\r\n* Items can be added dynamically and managed easily through\r\n* the several developped APIs.\r\n* \r\n*/\r\nclass CKLBUIList : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIList>;\r\n\tfriend class CKLBListDrag;\r\nprivate:\r\n\tCKLBUIList();\r\n\tvirtual ~CKLBUIList();\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tenum {\r\n\t\tLIST_FLAG_BOTTOM = 0x00000001,\t// アイテムを並べる基準点を、水平リストならばクリッピングの下端、\r\n\t\t\t\t\t\t\t\t\t\t// 垂直リストならばクリッピングの右端に変更する\r\n\r\n\t\tLIST_FLAG_MODAL  = 0x00000002,\t// リスト全体をモーダルコントロールとして表示する\r\n\t};\r\n\r\n\t// アイテム保持モード定数\r\n\tenum {\r\n\t\tLIST_ITEM_NORMAL,\r\n\t\tLIST_ITEM_DYNAMIC,\r\n\t\tLIST_ITEM_FLYWEIGHT,\r\n\t};\r\n\r\n\r\n\r\n\tstatic CKLBUIList * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\t\t\t\t\tfloat x, float y, float clip_width, float clip_height,\r\n\t\t\t\t\t\t\t\tint default_line_step, bool vertical = true,\r\n\t\t\t\t\t\t\t\tconst char * callback = NULL, u32 optional_flags = 0);\r\n\r\n\tbool initUI     (CLuaState& lua);\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tinline void setLoop(bool bLoop) {\r\n\t\tif(m_bLoop != bLoop) {\r\n\t\t\tm_posUpdate  = true;\r\n\t\t\tm_itemUpdate = true;\r\n\t\t\tm_scrBar.setOverScroll(bLoop || !m_chklimit);\r\n\t\t}\r\n\t\tm_bLoop = bLoop;\t\r\n\t}\r\n\r\n\tbool setItemMode(int mode, const char * dynamicCallback = NULL);\r\n\r\n\tbool useScrollBar(u32 order, bool side, int lineWeight,\r\n\t\t\t\t\t\tconst char * image, int min_slider_size,\r\n\t\t\t\t\t\tconst char * callback,\r\n\t\t\t\t\t\tu32 colorNormal, u32 colorSelect, bool active, bool hide_mode = false, bool short_hide = true);\r\n\r\n\tbool useScrollBarByProperty(CKLBPropertyBag * pProp, u32 priorityOffset);\r\n\r\n\tbool selectScrollMgr(const char * manager_name, int argc = 0, int * params = NULL);\r\n\tbool selectScrollMgrByProperty(CKLBPropertyBag * pProp);\r\n\r\n\r\n\tvoid setSplineLayout(float* array_, u32 setupBitmask, u32 curveLengthPixel);\r\n\r\nprivate:\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\tfloat x, float y, float clip_width, float clip_height,\r\n\t\t\t\tint default_line_step, bool vertical,\r\n\t\t\t\tconst char * callback, u32 optional_flags);\r\n\r\n\tbool initCore(\r\n\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\tfloat x, float y, float clip_width, float clip_height,\r\n\t\t\t\tint default_line_step, bool vertical,\r\n\t\t\t\tconst char * callback, u32 optional_flags);\r\n\r\npublic:\r\n\tvirtual void setVisible         (bool visible);\r\n\r\n\tinline u32\tgetWidth\t\t\t()\t\t\t\t\t{ return m_width;\t\t\t}\r\n\tinline u32\tgetHeight\t\t\t()\t\t\t\t\t{ return m_height;\t\t\t}\r\n\tinline int\tgetStepX\t\t\t()\t\t\t\t\t{ return m_stepX;\t\t\t}\r\n\tinline int\tgetStepY\t\t\t()\t\t\t\t\t{ return m_stepY;\t\t\t}\r\n\tinline u32\tgetOrder\t\t\t()\t\t\t\t\t{ return m_basePriority;\t}\r\n\tinline u32\tgetMaxOrder\t\t\t()\t\t\t\t\t{ return m_endPriority;\t\t}\r\n\tinline bool getVertical\t\t\t()\t\t\t\t\t{ return m_vertical;\t\t}\r\n\tinline u32\tgetItems\t\t\t()\t\t\t\t\t{ return m_itemCnt;\t\t\t}\r\n\tinline s32\tgetMarginTop\t\t()\t\t\t\t\t{ return m_marginTop;\t\t}\r\n\tinline s32\tgetMarginBottom\t\t()\t\t\t\t\t{ return m_marginBottom;\t}\r\n\tinline bool getDefaultScroll\t()\t\t\t\t\t{ return m_defScroll;\t\t}\r\n\t\r\n\tinline void setWidth\t\t\t(u32 width)\t\t\t{ \r\n\t\tif(m_width != width || m_clipWidth != width) {\r\n\t\t\tm_width = width;\r\n\t\t\tm_clipWidth = width;\r\n\t\t\tREFRESH_A;\r\n\t\t} \r\n\t}\r\n\tinline void setHeight\t\t\t(u32 height)\t\t{ \r\n\t\tif(m_height != height || m_clipHeight != height) {\r\n\t\t\tm_height = height;\t\r\n\t\t\tm_clipHeight = height;\t\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setStepX\t\t\t(int x)\t\t\t\t{ \r\n\t\tif(m_stepX != x) {\r\n\t\t\tm_stepX = x;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setStepY\t\t\t(int y)\t\t\t\t{ \r\n\t\tif(m_stepY != y) {\r\n\t\t\tm_stepY = y;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setOrder\t\t\t(u32 order)\t\t\t{ \r\n\t\tif(m_basePriority != order) {\r\n\t\t\tm_basePriority = order;\t\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setMaxOrder\t\t\t(u32 order)\t\t\t{ \r\n\t\tif(m_endPriority != order) {\r\n\t\t\tm_endPriority = order;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setVertical\t\t\t(bool vertical)\t\t{ \r\n\t\tif(m_vertical != vertical) {\r\n\t\t\tm_vertical = vertical;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setMarginTop\t\t(s32 top)\t\t\t{\r\n\t\tif (m_marginTop != top) {\r\n\t\t\tm_marginTop = top;\r\n\t\t\tREFRESH_A;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\tinline void setMarginBottom\t\t(s32 bottom)\t\t{\r\n\t\tif (m_marginBottom != bottom) {\r\n\t\t\tm_marginBottom = bottom;\r\n\t\t\tREFRESH_A;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\tinline void setDefaultScroll\t(bool scroll)\t\t{ \r\n\t\tif(m_defScroll != scroll) {\r\n\t\t\tm_defScroll = scroll;\t\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\r\n\tvoid setDragRect    (s32 left, s32 top, s32 right, s32 bottom);\r\n\r\n\tint  cmdItemAdd     (CLuaState& lua, int argc);\r\n\tbool cmdItemAdd     (const char* assetName);\r\n\tbool cmdItemAdd     (const char* assetName, int step, int id = -1);\r\n\tint  cmdItemInsert  (CLuaState& lua, int argc);\r\n\tbool cmdItemInsert  (const char* assetName, int idx);\r\n\tbool cmdItemInsert  (const char* assetName, int idx, int step, int id);\r\n\tbool cmdItemRemove  (int idx);\r\n\tvoid cmdItemMove    (int src, int dst);\r\n\tint  cmdItemRemoveSelection (CLuaState& lua, int argc);\r\n\tbool cmdItemRemoveSelection (int* idxList, u32 nbItems);\r\n\r\n\tvoid cmdFWModeConfig(int itemStep, int maxItems);\r\n\tvoid cmdFWItemAdd   (/* TODO */);\r\n\tvoid cmdFWItemInsert(/* TODO */);\r\n\r\n\tvoid cmdSetMargin   (int top, int bottom);\r\n\tbool cmdSetItemMode (int mode, const char* dynamicCallback);\r\n\r\n\tbool cmdAddRecords  (int insIdx, const char* tpform, u32 sizeTemplate, const char* dbrecs, u32 sizeDBRec, int step);\r\n\r\n\tint  cmdSetPosition (int pos, int dir);\r\n\tint  cmdSetInitial  (int);\r\n\tint cmdSetDragRect  (CLuaState& lua, int argc);\r\n\tint  cmdGetPosition ();\r\n\r\n\tvoid cmdSetItemID   (int index, int id);\r\n\tint  cmdSearchID    (int id);\r\n\r\n\tvoid cmdSetItemPos  (int mode, int idx, int offset);\r\n\r\n\tvoid cmdChangeStep  (int index, int step);\r\n\r\n\tvoid cmdSetLimitClip(bool chklimit, const char* limitCallback);\r\n\tint  cmdGetLimit    ();\r\n\tbool cmdSetLimitArea(int limitArea);\r\n\r\n\tbool cmdExistNode   (int index, const char* name);\r\n\tint  cmdUpdateNode  (CLuaState& lua, int argc);\r\n\tvoid cmdInputEnable (bool enable);\r\n\r\n\tvoid cmdAnimCallback    (const char* callback);\r\n\tbool cmdAnimationItem   (int index, const char* name, bool blend);\r\n\tbool cmdAnimationAll    (const char* name, bool blend);\r\n\tbool cmdItemAnimSkip    (int index, const char* name);\r\n\tbool cmdAllAnimSkip     (const char* name);\r\n\r\n\tbool cmdSelectScrMgr    (const char* name, int* params, int nb);\r\n\tbool cmdScrMgrCallback  (const char* callback);\r\n\tvoid cmdSetGroup        (const char* group_name);\r\n\tvoid cmdSetClip         (u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\tint  cmdGetItemCount    (CLuaState& lua, int argc);\r\n\tint  cmdGetItemForm     (CLuaState& lua, int argc);\r\n\r\n\tint  setPosition        (int pos);\r\n\tvoid updateEnable       ();\r\n\r\nprivate:\r\n\tu32                     m_width;\r\n\tu32                     m_height;\r\n\ts32                     m_marginTop;\r\n\ts32                     m_marginBottom;\r\n\tbool                    m_defScroll;\r\n\r\n\tCKLBNodeAnimPack\t\tm_animpack;\t\t// アニメーションパッケージ\r\n\tCKLBFormIF\t\t\t\tm_formIF;\t\t// Formパッケージ\r\n\tCKLBModalStack\t\t\tm_modalStack;\t// モーダルスタックパッケージ\r\n\r\n\t// リスト自体の操作許可情報\r\n\tbool\t\t\t\t\tm_bModalEnable;\r\n\r\n\t// clip情報\r\n\tu32\t\t\t\t\t\tm_basePriority;\t// クリッピング基点プライオリティ\r\n\tu32\t\t\t\t\t\tm_endPriority;\t// クリッピング終了プライオリティ\r\n\r\n\tfloat\t\t\t\t\tm_clipX;\r\n\tfloat\t\t\t\t\tm_clipY;\r\n\tint\t\t\t\t\t\tm_clipWidth;\r\n\tint\t\t\t\t\t\tm_clipHeight;\r\n\r\n\t// list配置情報\r\n\tbool\t\t\t\t\tm_vertical;\t\t// 縦配置フラグ(true:縦スクロール/false:横スクロール)\r\n\tbool\t\t\t\t\tm_chklimit;\t\t// 上限/下限制約をつける\r\n\tbool\t\t\t\t\tm_touchenable;\t// 入力取得許可/禁止\r\n\r\n\tint\t\t\t\t\t\tm_stepX;\t\t// 横方向のアイテム原点間隔(縦配置のときは0)\r\n\tint\t\t\t\t\t\tm_stepY;\t\t// 縦方向のアイテム原点間隔(横配置のときは0)\r\n\r\n\tint\t\t\t\t\t\tm_listLength;\t// リストの長さ\r\n\tint\t\t\t\t\t\tm_flags;\t\t// 動作オプションフラグ\r\n\r\n\t// Listの親ノード\r\n\t// 全てのアイテムは、このノードの下にぶらさがる。\r\n\tCKLBNode\t\t\t*\tm_pCtrlNode;\r\n\tint\t\t\t\t\t\tm_ctrlX;\r\n\tint\t\t\t\t\t\tm_ctrlY;\r\n\r\n\tvoid*\t\t\t\t\tm_clipHandle;\r\n\r\n\tfloat*\t\t\t\t\tm_layoutTable;\r\n\r\n\tfloat*\t\t\t\t\tm_layoutTableXY;\r\n\tfloat*\t\t\t\t\tm_layoutTableScale;\r\n\tfloat*\t\t\t\t\tm_layoutTableRotation;\r\n\tfloat*\t\t\t\t\tm_layoutTableAlpha;\r\n\tfloat*\t\t\t\t\tm_layoutTableRGB;\r\n\tfloat*\t\t\t\t\tm_layoutTablePriority;\r\n\tfloat*\t\t\t\t\tm_layoutTableLayout;\r\n\r\n\tu32\t\t\t\t\t\tm_curveLength;\r\n\tu16\t\t\t\t\t\tm_layoutInterlaceSize;\r\n\r\n\tconst char\t\t\t*\tm_pGroupName;\r\n\r\n\tstruct LISTITEM {\r\n\r\n\t\tLISTITEM\t\t*\tprev;\t// 前の項目\r\n\t\tLISTITEM\t\t*\tnext;\t// 次の項目\r\n\r\n\t\tbool\t\t\t\tenable;\t// 項目操作の許可禁止\r\n\r\n\t\tconst char\t\t*\tjsonp;\t// dynamic モードで使用。アイテム生成フォームのJSON\r\n\t\tu32\t\t\t\t\tjsonlen;\r\n\r\n\t\tCKLBNode\t\t*\tform;\t// 項目フォームのノード\r\n\t\tu32\t\t\t\t\thandle;\t// フォームアセットのハンドル\r\n\r\n\t\tSFormCtrlList\t\tctrl;\t// コントロールリスト\r\n\r\n\t\tint\t\t\t\t\tstep;\t// 項目の占有する幅\r\n\t\tint\t\t\t\t\tpos;\t// アイテムが現在存在する場所\r\n\t\tint\t\t\t\t\tindex;\t// アイテムのindex\r\n\t\tint\t\t\t\t\tid;\t\t// アイテムに与えられたID\r\n\r\n\t\t// このアイテムで起動されたタスクの一覧\r\n\t\tCKLBRegistedTaskList\ttaskList;\r\n\r\n\t\tLISTITEM()\r\n\t\t\t: prev  (NULL)\r\n            , next  (NULL)\r\n            , enable(false)\r\n            , jsonp (NULL)\r\n            , jsonlen   (0)\r\n            , form  (NULL)\r\n            , handle(0)\r\n            , ctrl  ()\r\n            , step  (0)\r\n            , pos   (0)\r\n            , index (0)\r\n            , id    (0)\r\n            , taskList  ()\r\n\t\t{}\r\n\t};\r\n\r\n\tLISTITEM\t\t*\tm_lstBegin;\r\n\tLISTITEM\t\t*\tm_lstEnd;\r\n\r\n\tLISTITEM\t\t*\tm_killBegin;\r\n\tLISTITEM\t\t*\tm_killEnd;\r\n\r\n\tint\t\t\t\t\tm_itemCnt;\t\t\t// 登録アイテム数\r\n\tint\t\t\t\t\tm_scrollPos;\t\t// スクロール位置\r\n\tbool\t\t\t\tm_enableEvents;\r\n\tbool\t\t\t\tm_force;\r\n\r\n\tint\t\t\t\t\tm_scrOffset;\t\t// スクロール位置オフセット\r\n\tint\t\t\t\t\tm_clipSize;\t\t\t// クリップサイズ\r\n\r\n\tbool\t\t\t\tm_itemUpdate;\t\t// アイテム更新フラグ\r\n\tbool\t\t\t\tm_posUpdate;\t\t// 表示位置更新フラグ\r\n\r\n\tbool\t\t\t\tm_bLoop;\t\t\t// ループ動作モード\r\n\r\n\tCKLBListDrag\t*\tm_dragCallback;\t\t// ドラッグ時のコールバック関数名\r\n\tconst char\t\t*\tm_limitCallback;\t// 終端ページ入りコールバック関数名\r\n\tbool\t\t\t\tm_limitCalled;\t\t// 既に終端コールバックを呼んだか否か\r\n\tint\t\t\t\t\tm_limitAreaSize;\t// 両端超過コールバックを呼びだす領域のサイズ\r\n\r\n\tconst char\t\t*\tm_dynamicCallback;\t// ダイナミックモードでアイテムの再生が終了した後に呼び出すコールバック\r\n\r\n\tint\t\t\t\t\tm_dragID;\r\n\tint\t\t\t\t\tm_dragX;\r\n\tint\t\t\t\t\tm_dragY;\r\n\ts32\t\t\t\t\tm_leftDrag;\r\n\ts32\t\t\t\t\tm_rightDrag;\r\n\ts32\t\t\t\t\tm_topDrag;\r\n\ts32\t\t\t\t\tm_bottomDrag;\r\n\ts32\t\t\t\t\tm_dragDistance;\r\n\r\n\tCKLBScrollBarIF\t\tm_scrBar;\t\t\t// スクロールバー\r\n\r\n\t// デフォルトスクロールで使用する。\r\n\tint\t\t\t\t\tm_defaultPrePos;\r\n\tint\t\t\t\t\tm_defaultDragPos;\r\n\tbool\t\t\t\tm_bTaped;\r\n\r\n\t// アイテム保持モード\r\n\tint\t\t\t\t\tm_itemMode;\r\n\r\n\tstruct FLYWEIGHT {\r\n\t\tint\t\t\tmaxitems;\t// 最大保持アイテム数\r\n\t\tint\t\t\titemstep;\t// \r\n\t};\r\n\tFLYWEIGHT\t\t\tm_flyweight;\r\n\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\r\n\r\nprivate:\r\n\tvoid        updateIndex ();\r\n\r\n\tbool        setClip     (u32 orderBegin, u32 orderEnd,\r\n\t\t\t\t\t         s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\r\n\tbool        resetClip   (u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight, bool forceClip);\r\n\r\n\tLISTITEM *  create_item (const char * json, u32 jsonLen, int id = -1, CKLBCompositeAsset * pAsset = NULL, IDataSource * pSource = NULL);\r\n\tvoid        delete_item (LISTITEM * pItem, bool kill_child = true);\r\n\r\n\tbool        load_itemform   (LISTITEM * pItem, const char * json, u32 jsonLen, CKLBCompositeAsset * pOrgAsset = NULL, IDataSource * pSource = NULL);\r\n\tbool        unload_itemform (LISTITEM * pItem, bool kill_child = true);\r\n\t\r\n\tinline void set_item_id (LISTITEM * pItem, int id = -1) { pItem->id = id; }\r\n\r\n\tint         get_item_index_by_id(int id);\r\n\r\n\tLISTITEM *  getItemByID (int id);\r\n\r\n\tLISTITEM *  getItemByIndex(int index);\r\n\r\n\t// 指定されたLuaスタック上のパラメータをJSON文字列に変換する\r\n\tconst char * toJSON(CLuaState& lua, int index, u32& size);\r\n\r\n\t// 指定されたLuaスタック上のパラメータを元に、テーブルにぶら下げるアイテムツリーを生成する。\r\n\tbool itemInsertUniversal(LISTITEM * posItem, int step, CLuaState& lua, int index, int id = -1);\r\n\r\n\t// JSONをもとにアイテムツリーを作り、\r\n\t// posItem とその直前のアイテムの間に挟む\r\n\tbool itemInsert(LISTITEM * posItem, int step, const char * json, u32 jsonLen, int id = -1,\r\n\t\t\t\t\tCKLBCompositeAsset * pAsset = 0, IDataSource * pSource = 0);\r\n\r\n\t// 指定されたアイテムを削除し、間を詰める\r\n\tvoid itemDelete(LISTITEM * posItem);\r\n\r\n\t// 削除予約されたアイテムインスタンスをすべて削除する\r\n\tvoid itemCleanUp(bool kill_child = true);\r\n\r\n\t// アイテムを挿入/破棄した後の処理として、各アイテムの配置を再計算する。\r\n\tvoid itemRealloc();\r\n\r\n\t// 直線型リストの表示位置再設定\r\n\tvoid setStraightPosition();\r\n\r\n\t// スプライン型リストの表示位置再設定\r\n\tvoid setSplinePosition();\r\n\r\n\t// タッチパッドイベント処理\r\n\tvoid touchpadEvent();\r\n\r\n\t\r\n\ts32 fromScreenDistanceToSplineDistance(s32 posPixelSpace);\r\n\r\n\t// Interpolation from spline lookup table for vec1,vec2,vec3\r\n\tvoid interpolate1(float* array_, float sub, float& res);\r\n\tvoid interpolate2(float* array_, float sub, float& resA, float& resB);\r\n\tvoid interpolate3(float* array_, float sub, float& resA, float& resB, float& resC);\r\n\r\n\t// デフォルトスクロール処理\r\n\tstatic void defaultScroll(void * pData, PAD_ITEM::TYPE type, int dragX, int dragY, int mvX, int mvY);\r\n\r\npublic:\r\n\tbool itemAddInsert(LISTITEM * posItem, const char* assetName, int step, int id);\r\n\t\r\n\tstatic const char * toJSON(const char* param, u32& size);\r\n};\r\n\r\n\r\n#endif // CKLBUIList_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIMoviePlayer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIMoviePlayer_h\r\n#define CKLBUIMoviePlayer_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBMovieNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIMoviePlayer\r\n* \\brief Movie Player Task Class\r\n* \r\n* CKLBUIMoviePlayer is used to play movies into the Game.\r\n* It provides a few APIs to manage the movie display and some\r\n* playing option (play, stop, pause, resume).\r\n* The task is platform independant as it uses a CKLBMovieNode which\r\n* uses itself an implementation of IWidget that is platform specific.\r\n*\r\n* /!\\ CKLBUIMoviePlayer does NOT work on Windows at the moment.\r\n*/\r\nclass CKLBUIMoviePlayer : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIMoviePlayer>;\r\nprivate:\r\n\tCKLBUIMoviePlayer();\r\n\tvirtual ~CKLBUIMoviePlayer();\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUIMoviePlayer * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                                      bool mode, float x, float y,\r\n                                      float width, float height,\r\n                                      const char * url, const char * callback);\r\n    \r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n    \r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline void setWidth(u32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_width = width;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinline u32  getWidth() {\r\n\t\treturn m_width;\r\n\t}\r\n\r\n\tinline void setHeight(u32 height) {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_height = height;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getHeight() {\r\n\t\treturn m_height;\r\n\t}\r\n\r\n\tinline void setText(const char* text) {\r\n\t\tif (text) {\r\n\t\t\tif (CKLBUtility::safe_strcmp(text, m_url)!=0) {\r\n\t\t\t\tsetStrC(m_url,text);\r\n\t\t\t\tREFRESH_B;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (CKLBUtility::safe_strcmp(\"\", m_url)!=0) {\r\n\t\t\t\tsetStrC(m_url,\"\");\r\n\t\t\t\tREFRESH_B;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tinline const char* getText() { return m_url; }\r\n\r\n\tinline void moviePlay   ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_PLAY);   }\r\n\tinline void movieStop   ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_STOP);   }\r\n\tinline void moviePause  ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_PAUSE);  }\r\n\tinline void movieResume ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_RESUME); }\r\n\r\nprivate:\r\n\tu32\t        m_width;\r\n\tu32         m_height;\r\n\tconst char* m_url;\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              bool mode, float x, float y,\r\n              float width, float height,\r\n              const char * url, const char * callback);\r\n    \r\n\tbool initCore(bool mode, float x, float y,\r\n                  float width, float height,\r\n                  const char * url, const char * callback);\r\n    \r\n\tCKLBMovieNode\t*\tm_pMovieNode;\r\n    \r\n    const char      *   m_cmdCallback;\r\n    \r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIMoviePlayer_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIMultiImgItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIMultiImgItem_h\r\n#define CKLBUIMultiImgItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\nstruct IMGITEM {\r\n\tu32\t\t\t\thandle;\r\n\tCKLBSprite*\t\tsprite;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIMultiImgItem\r\n* \\brief Multi Images Item Task Class\r\n* \r\n* CKLBUIMultiImgItem is used to regroup some images into one Task.\r\n* One image only is displayed every frame, but the active image can be changed\r\n* at any moment through provided APIs.\r\n*/\r\nclass CKLBUIMultiImgItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIMultiImgItem>;\r\nprivate:\r\n\tCKLBUIMultiImgItem();\r\n\tvirtual ~CKLBUIMultiImgItem();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\tbool initCore(u32 order,float x,float y, u32 index, IMGITEM* pIndexes, u32 max);\r\npublic:\r\n\tu32 getClassID();\r\n\tstatic CKLBUIMultiImgItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getIndexMax() { return m_idxMax; }\r\n\tinline void setIndexMax(u32 index) {\r\n\t\tif (index != m_idxMax) {\r\n\t\t\tm_idxMax = index;\r\n\t\t\tif(m_idxImg > m_idxMax) {\r\n\t\t\t\tm_idxImg = m_idxMax;\r\n\t\t\t}\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32 getOrder() { return m_order; }\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif(order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getIndex() { return m_idxImg; }\r\n\tinline void setIndex(u32 index) {\r\n\t\tif(index != m_idxImg) {\r\n\t\t\tm_idxImg = (index <= m_idxMax) ? index : m_idxMax;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tbool changeAssets(const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\r\nprotected:\r\n\tIMGITEM\t\t*\tm_items;\t// イメージの情報\r\n\r\n\tbool getImgList(CLuaState& lua, IMGITEM* items, u32 max);\r\nprivate:\r\n\r\n\tu32\t\t\t\tm_idxMax;\r\n\tu32\t\t\t\tm_cntImg;\t// 与えられたイメージの数\r\n\tu32\t\t\t\tm_idxImg;\t// 現在表示されているイメージのindex\r\n\tu32\t\t\t\tm_order;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBMultiImgItem_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIPieChart.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIPieChart_h\r\n#define CKLBUIPieChart_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIPieChart\r\n* \\brief Pie Chart Task Class\r\n* \r\n* CKLBUIPieChart allows to create dynamic Pie Charts.\r\n*/\r\nclass CKLBUIPieChart : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIPieChart>;\r\nprivate:\r\n\tCKLBUIPieChart();\r\n\tvirtual ~CKLBUIPieChart();\r\n\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUIPieChart * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t                           u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t   const char * asset, float start, float end,\r\n\t\t\t\t\t\t\t\t   int anim = 0, float initial = 0.0f);\r\n\r\n\tbool initUI(CLuaState& lua);\r\n\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline void  setStart(float start) {\r\n\t\tif (start != m_start) {\r\n\t\t\tm_start = start;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline float getStart() { return m_start; }\r\n\r\n\tinline void  setEnd(float end) {\r\n\t\tif (end != m_end) {\r\n\t\t\tm_end = end;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline float getEnd()   { return m_end; }\r\n\r\n\tinline void setValue(float value) {\r\n\t\tif (value != m_value) {\r\n\t\t\tm_value = value;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline float getValue()\t{ return m_value;\t}\r\n\r\n\tinline s32 getAnim()    { return m_anim;\t}\r\n\r\n\tinline \r\n\tvirtual u32 getOrder()\t{ return m_order;\t}\r\n\r\n\tbool changeAsset(const char* asset);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\nprivate:\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              u32 order, float x, float y, float width, float height,\r\n\t\t\t  const char * asset, float start, float end, int anim = 0, float initial = 0.0f);\r\n\r\n\tbool initCore(u32 order,\r\n\t\t\t\t  float x, float y, float width, float height, \r\n\t\t\t\t  const char * asset, float start, float end, int anim = 0, float initial = 0.0f);\r\n\r\n\r\n\tvoid setVertices(float value);\r\n\tvoid getPoint   (int idx, float n, float& x, float &y, float& u, float& v);\r\n\r\n\r\n\t// テクスチャ情報\r\n\tu32\t\t\t\t\tm_texHandle;\r\n\tCKLBImageAsset\t*\tm_pImgAsset;\r\n\ts32\t\t\t\t\tm_texWidth;\r\n\ts32\t\t\t\t\tm_texHeight;\r\n\r\n\t// ダイナミックスプライト\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\r\n\t// アニメーション情報\r\n\tbool\t\t\t\tm_bAnim;\r\n\tint\t\t\t\t\tm_iTimeCnt;\r\n\tfloat\t\t\t\tm_nowRate;\r\n\tfloat\t\t\t\tm_prevRate;\r\n\r\n\tfloat\t\t\t\tm_start;\r\n\tfloat\t\t\t\tm_end;\r\n\tfloat\t\t\t\tm_value;\r\n\ts32\t\t\t\t\tm_anim;\r\n\tu32\t\t\t\t\tm_order;\r\n\r\n\r\n\t// 頂点情報\r\n\tstruct VERTMAP {\r\n\t\tfloat x, y;\r\n\t\tfloat u, v;\r\n\t};\r\n\t\r\n\t\r\n\tVERTMAP\t\t\t\t    m_vertices[ 17 ];\r\n\r\n\tstatic const VERTMAP \tms_vertMaster[];\r\n\tstatic const int \t\tms_idxMaster[8][3];\r\n\tstatic PROP_V2\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIPieChart_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIPolyline.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIPolyline_h\r\n#define CKLBUIPolyline_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIPolyline\r\n* \\brief Polyline Task Class\r\n* \r\n* CKLBUIPolyline allows to create Polylines.\r\n*/\r\nclass CKLBUIPolyline : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIPolyline>;\r\nprivate:\r\n\tCKLBUIPolyline();\r\n\tvirtual ~CKLBUIPolyline();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, u32 maxPoint);\r\n\tbool initCore(u32 order, u32 maxPoint);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBUIPolyline* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, u32 maxPoint);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32 getMaxPoint()\t\t{ return m_maxpointcount;\t}\r\n\tinline void setMaxPoint(u32 maxpointcount) {\r\n\t\tif (m_maxpointcount != maxpointcount) {\r\n\t\t\tm_maxpointcount = maxpointcount;\r\n\t\t\tm_pPolyline->setMaxPointCount(maxpointcount);\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32 getOrder()\t{ return m_order;\t\t\t}\r\n\r\n\tinline u32\tgetPointCount()\t\t{ return m_pointCount;\t\t}\r\n\tinline void setPointCount(u32 pointcount) {\r\n\t\tm_pointCount = pointcount;\r\n\t\tm_pPolyline->setPointCount(pointcount);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void setPoint(u32 idx, float x, float y) {\r\n\t\tm_pPolyline->setPoint(idx, x, y);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline u32\tgetColor()\t\t\t{ return m_color;\t\t\t}\r\n\tinline void setColor(u32 color) {\r\n\t\tm_color = color;\r\n\t\tm_pPolyline->setColor(color);\r\n\t\tgetNode()->markUpColor();\r\n\t}\r\n\r\nprivate:\r\n\r\n\tCKLBPolyline\t*\tm_pPolyline;\r\n\r\n\tu32\t\t\t\t\tm_maxpointcount;\r\n\tu32\t\t\t\t\tm_pointCount;\r\n\tu32\t\t\t\t\tm_order;\r\n\tu32\t\t\t\t\tm_color;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIPolyline_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIProgressBar.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIProgressBar_h\r\n#define CKLBUIProgressBar_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIProgressBar\r\n* \\brief Progress Bar Task Class\r\n* \r\n* CKLBUIProgressBar allows to create dynamic Progress Bars.\r\n*/\r\nclass CKLBUIProgressBar : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIProgressBar>;\r\nprivate:\r\n\tCKLBUIProgressBar();\r\n\tvirtual ~CKLBUIProgressBar();\r\npublic:\r\n\t// プロパティのインデックス\r\n\tenum PROP_ID{\r\n\t\tP_WIDTH,\r\n\t\tP_HEIGHT,\r\n\t\tP_ORDER,\r\n\t\tP_VERT,\r\n\t\tP_ANIM,\r\n\t\tP_START,\r\n\t\tP_END_POS,\r\n\t\tP_IMG_EMPTY,\r\n\t\tP_IMG_FULL,\r\n\t\tP_VALUE,\r\n\t\tP_IMG_FILTER,\r\n\t\tP_FILTER_VISIBLE,\r\n\t\tP_FILTER_COLOR,\r\n\t};\r\n\r\n\tstatic CKLBUIProgressBar *\r\n\t\tcreate(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\tu32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\tconst char * full_image, const char * empty_image,\r\n\t\t\t\t\t\t\ts32 start_pix = -1, s32 end_pix = -1, int anim = 0, bool vert = false,\r\n\t\t\t\t\t\t\tconst char * barfilter_image = NULL);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tbool setFilterAnim(bool bFilterAnim, u32 col1, u32 col2, u32 freq);\r\n\t\r\n\t// A : Perform animation\r\n\t// B : Perform geometry\r\n\r\n\tinline u32  getOrder()\t\t\t\t{ return m_uiOrder;\t\t}\r\n\tinline void\tsetOrder(u32 order)\t\t{\r\n\t\tif (order != m_uiOrder) {\r\n\t\t\tm_uiOrder = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getWidth()\t\t\t\t{ return m_fWidth;\t\t}\r\n\tinline void\t setWidth(float width)\t{\r\n\t\tif (width != m_fWidth) {\r\n\t\t\tif(!m_isVertical) {\r\n\t\t\t\tif(m_startPixelF <= m_endPixelF) {\r\n\t\t\t\t\tm_endPixelF += width - m_fWidth;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_startPixelF += width - m_fWidth;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_fWidth = width;\r\n\t\t\tREFRESH_D;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getHeight()             { return m_fHeight;\t\t}\r\n\tinline void\t setHeight(float height) {\r\n\t\tif (height != m_fHeight) {\r\n\t\t\tif(m_isVertical) {\r\n\t\t\t\tif(m_startPixelF <= m_endPixelF) {\r\n\t\t\t\t\tm_endPixelF += height - m_fHeight;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_startPixelF += height - m_fHeight;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_fHeight = height;\r\n\t\t\tREFRESH_D;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool\tgetVertical()\t\t\t    { return m_isVertical;\t}\r\n\tinline void\tsetVertical(bool vertical)  {\r\n\t\tif (m_isVertical != vertical) {\r\n\t\t\tm_isVertical = vertical;\r\n\t\t\tREFRESH_D;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetAnimTime()\t\t\t{ return m_anim_length; }\r\n\tinline void\tsetAnimTime(u32 time)\t{\r\n\t\tif (time != m_anim_length) {\r\n\t\t\tm_anim_length = time;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getStart()\t\t\t\t{ return m_fStart;\t\t}\r\n\tinline void\t setStart(float start)\t{\r\n\t\tif (start != m_fStart) {\r\n\t\t\tm_fStart = start;\r\n\t\t\tm_fNormValue = (m_fValue - m_fStart) / (m_fEnd - m_fStart); \r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getEnd()\t\t\t\t{ return m_fEnd;\t\t}\r\n\tinline void\t setEnd(float end)\t\t{\r\n\t\tif (end != m_fEnd) {\r\n\t\t\tm_fEnd = end;\r\n\t\t\tm_fNormValue = (m_fValue - m_fStart) / (m_fEnd - m_fStart); \r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getImgEmpty()\t{ return m_emptyImage;\t}\r\n\tinline void         setImgEmpty(const char* empty_image)\t{ \r\n\t\tsetStrC(m_emptyImage, empty_image); \r\n\t\tsetImg(true, empty_image); \r\n\t}\r\n\r\n\tinline const char*  getImgFull()\t{ return m_fullImage;\t}\r\n\tinline void         setImgFull(const char* full_image)\t\t{ \r\n\t\tsetStrC(m_fullImage, full_image); \r\n\t\tsetImg(false, full_image); \r\n\t}\r\n\r\n\tinline float getValue()\t\t\t\t{ return m_fValue;\t\t}\r\n\tinline void\t setValue(float value)\t{\r\n\t\tif (value != m_fValue) {\r\n\t\t\tm_fValue = value;\r\n\t\t\tm_fNormValue = (value - m_fStart) / (m_fEnd - m_fStart); \r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getValueNormalized()\t{ return m_fNormValue;\t}\r\n\t\r\n\tinline const char*  getImgFilter()\t{ return m_filterImage; }\r\n\tinline void         setImgFilter(const char* img_filter)\t{ setStrC(m_filterImage, img_filter); /*TODO*/ }\r\n\r\n\tinline bool getFilterVisible()\t\t{ return m_bFilterSW;\t}\r\n\tvoid        setFilterVisible(bool visible);\r\n\r\n\tinline u32\tgetFilterColor()\t\t{ return m_FilterCol; }\r\n\tvoid        setFilterColor(u32 argb);\r\n\r\n\tinline void reset()\t{\r\n\t\tsetValue(m_fStart);\r\n\t\tm_iTimeCnt = 0;\r\n\t\tm_nowRate = m_prevRate = m_fStart;\r\n\t\tm_lastValue = m_fStart;\r\n\t\tsetBorder(m_fStart);\r\n\t}\r\n\r\n\tu32 getClassID();\r\nprivate:\r\n\tbool setImg(bool isEmpty, const char* imageName);\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 order, float x, float y, float width, float height,\r\n\t\t\t\tconst char * full_image, const char * empty_image,\r\n\t\t\t\ts32 start_pix, s32 end_pix, int anim, bool vert,\r\n\t\t\t\tconst char * barfilter_image);\r\n\r\n\tbool initCore(  u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\tconst char * full_image, const char * empty_image,\r\n\t\t\t\t\ts32 start_pix, s32 end_pix, int anim, bool vert,\r\n\t\t\t\t\tconst char * barfilter_image);\r\n\r\n\tvoid setBorder\t\t\t\t\t(float value);\r\n\tvoid setupProgressBarConstant\t();\r\n\r\n\tenum {\r\n\t\tE_full,\r\n\t\tE_empty,\r\n\t\tE_filter,\r\n\t};\r\n\tCKLBImageAsset\t*\tm_pTex[3];\t\t// [0]full / [1]empty / [2]filter\r\n\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\r\n\tCKLBTextureAsset *\tm_pTexAsset;\r\n\tu32\t\t\t\t\tm_texHandle;\r\n\tu32\t\t\t\t\tm_uiOrder;\r\n\tfloat\t\t\t\tm_fWidth;\r\n\tfloat\t\t\t\tm_fHeight;\r\n\tu32\t\t\t\t\tm_anim_length;\r\n\tfloat\t\t\t\tm_fStart;\r\n\tfloat\t\t\t\tm_fEnd;\r\n\tfloat\t\t\t\tm_startPixelF;\r\n\tfloat\t\t\t\tm_endPixelF;\r\n\tfloat\t\t\t\tm_fValue;\r\n\tfloat\t\t\t\tm_fNormValue;\r\n\tbool\t\t\t\tm_isVertical;\r\n\r\n\tfloat\t\t\t\tm_lastValue;\r\n\tfloat\t\t\t\tm_prevRate;\r\n\tu32\t\t\t\t\tm_iTimeCnt;\t\t// アニメ用タイムカウンタ\r\n\tfloat\t\t\t\tm_nowRate;\t\t// アニメーション中の表示レート\r\n\t//GG//bool\t\t\tm_bAnim;\t\t// アニメーション中のフラグ\r\n\tu8\t\t\t\t\tm_idx_a;\r\n\tu8\t\t\t\t\tm_idx_b;\r\n\tu8\t\t\t\t\tm_idx_c;\t\t// filter用\r\n\r\n\tint\t\t\t\t\tm_vertices;\t\t// 頂点の数\r\n\tint\t\t\t\t\tm_indices;\t\t// インデックスの数\r\n\t\r\n\r\n\tbool\t\t\t\tm_bFilterSW;\t// フィルタ表示の ON/OFF\r\n\tu32\t\t\t\t\tm_FilterCol;\t// フィルタ用RGBA値\r\n\tfloat\t\t\t\tm_filterXY[8];\t// フィルタ表示用頂点\r\n\r\n\tbool\t\t\t\tm_bColAnim;\t\t\t// フィルタカラーアニメーション有効\r\n\tu32\t\t\t\t\tm_animfreq;\t\t\t// RGBAアニメーションの周期([ms])\r\n\tu32\t\t\t\t\tm_animcol[2];\t\t// RGBAアニメーションで補間する二つのカラー\r\n\tu32\t\t\t\t\tm_animTime;\t\t\t// タイムカウンタ\r\n\r\n\tbool\t\t\t\tm_bCmdUpdate;\r\n\r\n\tconst char\t\t*\tm_emptyImage;\r\n\tconst char\t\t*\tm_fullImage;\r\n\tconst char\t\t*\tm_filterImage;\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\tstatic const u16\tms_indices[];\r\n};\r\n\r\n#endif // CKLBUIProgressBar_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIRubberBand.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIRubberBand_h\r\n#define CKLBUIRubberBand_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIRubberBand\r\n* \\brief Rubber Band Task Class\r\n* \r\n* CKLBUIRubberBand allows to create dynamic Rubber Bands.\r\n*/\r\nclass CKLBUIRubberBand : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIRubberBand>;\r\nprivate:\r\n\tCKLBUIRubberBand();\r\n\tvirtual ~CKLBUIRubberBand();\r\n\r\n\tbool initCore(\tu32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\n\r\n\tbool init(\tCKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\npublic:\r\n\tu32 getClassID();\r\n\tstatic CKLBUIRubberBand* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\t\t\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline float getOriginX ()\t\t\t{ return m_originX;\t\t}\r\n\tinline void  setOriginX (float x)\t{ m_originX = x;\t\t}\r\n\r\n\tinline float getOriginY ()\t\t\t{ return m_originY;\t\t}\r\n\tinline void  setOriginY (float y)\t{ m_originY = y;\t\t}\r\n\r\n\tinline void  setPointX  (float x)\t{ m_x = x;\t\t\t\t}\r\n\tinline float getPointX  ()\t\t\t{ return m_x;\t\t\t}\r\n\r\n\tinline void  setPointY  (float y)\t{ m_y = y;\t\t\t\t}\r\n\tinline float getPointY  ()\t\t\t{ return m_y;\t\t\t}\r\n\r\n\tinline void  setFAnim   (bool fAnim){ m_fAnim = fAnim;\t\t}\r\n\tinline bool\t getFAnim   ()\t\t\t{ return m_fAnim;\t\t}\r\n\r\n\tinline void  setFAnimRT (bool fAnim){ m_fAnimRT = fAnim;\t}\r\n\tinline bool\t getFAnimRT ()\t\t\t{ return m_fAnimRT;\t\t}\r\n\r\n\tinline void  setAnimTime(u32 time)\t{ m_animTime = time;\t}\r\n\tinline u32   getAnimTime()\t\t\t{ return m_animTime;\t}\r\n\r\n\tinline virtual u32 getOrder         () { return m_order;        }\r\n\tinline const char* getAssetOrigin   () { return m_assetOrigin;  }\r\n\tinline const char* getAssetJoint    () { return m_assetJoint;   }\r\n\tinline const char* getAssetPoint    () { return m_assetPoint;   }\r\n\r\n\tinline bool setOrder(u32 order_origin, u32 order_joint, u32 order_point) {\r\n\t\tm_pOriginNode->setPriority(order_origin);\r\n\t\tm_pPointNode->setPriority(order_point);\r\n\t\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\t\tm_pJointNode[i]->setPriority(order_joint);\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\nprivate:\r\n\tu32\t\t    m_order;\r\n\tfloat\t    m_originX;\r\n\tfloat\t    m_originY;\r\n\tfloat\t    m_x;\r\n\tfloat\t    m_y;\r\n\tconst char*\tm_assetOrigin;\r\n\tconst char* m_assetJoint;\r\n\tconst char* m_assetPoint;\r\n\r\n\tCKLBNode\t\t*\tm_pOriginNode;\t\t// 起点となるスプライト(角度に合わせ回転する)\r\n\tCKLBNode\t\t*\tm_pPointNode;\t\t// 先端のスプライト(角度に合わせ回転する)\r\n\tCKLBNode\t\t**\tm_pJointNode;\t\t// 節となるスプライト(回転しない)\r\n\r\n\tCKLBDynSprite\t*\tm_sprOrigin;\t\t// 起点用\r\n\tCKLBDynSprite\t*\tm_sprPoint;\t\t\t// 先端用\r\n\tCKLBDynSprite\t**\tm_sprJoint;\t\t\t// 節用\r\n\r\n\tstruct POINT {\r\n\t\tfloat x;\r\n\t\tfloat y;\r\n\t};\r\n\tint\t\t\t\t\tm_cntOrigin;\r\n\tPOINT\t\t\t*\tm_vertOrigin;\r\n\r\n\tint\t\t\t\t\tm_cntPoint;\r\n\tPOINT\t\t\t*\tm_vertPoint;\r\n\r\n\tint\t\t\t\t\tm_cntJoint;\r\n\tPOINT\t\t\t*\tm_vertJoint;\r\n\r\n\tu32\t\t\t\t\tm_handle_origin;\t// 起点テクスチャのハンドル\r\n\tu32\t\t\t\t\tm_handle_point;\t\t// 先端テクスチャのハンドル\r\n\tu32\t\t\t\t\tm_handle_joint;\t\t// 節テクスチャのハンドル\r\n\r\n\tCKLBImageAsset\t*\tm_img_origin;\r\n\tCKLBImageAsset\t*\tm_img_point;\r\n\tCKLBImageAsset\t*\tm_img_joint;\r\n\r\n\tbool\t\t\t\tm_rot_origin;\r\n\tbool\t\t\t\tm_rot_joint;\r\n\tbool\t\t\t\tm_rot_point;\r\n\r\n\tint\t\t\t\t\tm_reso;\t\t\t\t// 分割数\r\n\r\n\tbool\t\t\t\tm_fAnim;\t\t\t// アニメーションの有無\r\n\tbool\t\t\t\tm_fAnimRT;\t\t\t// 時間指定のリアルタイムフラグ(false = フレーム指定)\r\n\tu32\t\t\t\t\tm_animTime;\t\t\t// アニメーション時間(1ループ)\r\n\tu32\t\t\t\t\tm_animCount;\t\t// 経過時間カウント\r\n\r\n\r\n\tPOINT\t\t\t\tm_origin;\r\n\tPOINT\t\t\t\tm_point;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n\tstatic float\t\tms_norot_mat[4];\r\nprivate:\r\n\tCKLBDynSprite * create_rotSprite(CKLBNode * node, u32 order, CKLBImageAsset * asset,\r\n\t\t\t\t\t\t\t\t\t int * vertCnt, POINT ** arrVert);\r\n\tvoid rot_vertex(CKLBDynSprite * dynSpr, CKLBImageAsset * pAsset, int cntVert, POINT * pbuf, float * mat);\r\n};\r\n\r\n#endif // CKLBUIRubberBand_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUISWFPlayer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUISWFPlayer_h\r\n#define CKLBUISWFPlayer_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBSWFPlayer.h\"\r\n\r\n/*!\r\n* \\class CKLBUISWFPlayer\r\n* \\brief SWF Player Task Class\r\n* \r\n* CKLBUISWFPlayer is a Flash Player that can read and display our SWFAssets.\r\n*/\r\nclass CKLBUISWFPlayer : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUISWFPlayer>;\r\nprotected:\r\n\tCKLBUISWFPlayer();\r\n\tvirtual ~CKLBUISWFPlayer();\r\npublic:\r\n\tstatic CKLBUISWFPlayer * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t            u32 order, float x, float y, const char * asset,\r\n\t\t\t\t\t\t            const char * movie_name, const char * complete_callback,\r\n\t\t\t\t\t\t            const char ** replace_list, int asset_cnt);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n    u32 getClassID();\r\n\r\n\tinline bool getPlay() { return m_play; }\r\n    inline void setPlay(bool play) {\r\n\t\tif (m_play != play) {\r\n\t\t\tm_play = play;\r\n\t\t\tm_pSWFNode->setPlay(play);\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getOrder()\t\t\t{ return m_order;\t\t}\r\n    inline void setOrder(u32 order) {\r\n\t\tif (order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getCallBack()\t                    { return m_callBack;\t         }\r\n    inline void         setCallBack(const char* callBack)   { setStrC(m_callBack, callBack); }\r\n\t\r\n\tinline const char* getAsset()\t\t{ return m_asset;\t\t}\r\n\r\n\tinline const char* getMovieName()\t{ return m_movieName;\t}\r\n\r\n\tinline void gotoFrame(const char* label) {\r\n\t\tu16 fnum;\r\n\t\tm_pSWFNode->findCodeFrame((char *)label, &fnum);\r\n\t\tm_pSWFNode->gotoFrame(fnum);\r\n\t\tif (fnum == NULL_IDX) {\r\n\t\t\t\tDEBUG_PRINT(\"[SCRIPT] Flash GOTOFRAME %s not found.\", label);\r\n\t\t}\r\n\t}\r\n\r\n\tinline u16\tgetFrameRate()\t\t\t{ return 1000/m_pSWFNode->getFrameRate();\t\t}\r\n\tinline void setFrameRate(u32 fps)\t{ m_pSWFNode->setFrameRate((u16)(1000/fps));\t}\r\n\r\n\tinline bool isAnimating()\t\t\t{ return m_pSWFNode->isStillAnimating();\t\t}\r\n\r\n\tinline void setFrameRateScale(float scale) {\r\n\t\tfloat rate = (float)m_defaultRate * scale;\r\n\t\tm_pSWFNode->setFrameRate((u16)rate);\r\n\t}\r\n\r\n\tinline float getVolume()\t\t\t\t{ return m_pSWFNode->getVolumeSE();\t}\r\n\tinline void  setVolume(float volume)\t{ m_pSWFNode->setVolumeSE(volume);\t}\r\n\r\nprivate:\r\n\r\n\tconst char*\tm_callBack;\r\n\tconst char* m_movieName;\r\n\tconst char* m_asset;\r\n\tu32\t\t\tm_order;\r\n\tbool\t\tm_play;\r\n\r\n\tCKLBSWFMovie\t\t*\tm_pSWFNode;\r\n\r\n\tstruct LABEL {\r\n\t\tLABEL\t   * next;\r\n\r\n\t\tconst char * label;\r\n\t\tconst char * callback;\r\n\t\tu16\t\t\t index;\r\n\t};\r\n\r\n\tLABEL\t\t\t*\tm_beginLabel;\r\n\tu32\t\t\t\t\tm_flashHandle;\r\n\r\n\tu16\t\t\t\t\tm_defaultRate;\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n\r\n\tenum {\r\n\t\tREPLACE_BLOCK = 10\r\n\t};\r\n\r\n\tvoid receiveMsg\t(CKLBObject* emitter, u32 msgID, u32 msgParam);\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t  u32 order, float x, float y, const char * asset,\r\n\t\t\t  const char * movie_name, const char * complete_callback,\r\n\t\t\t  const char ** replace_list = NULL, int asset_cnt = 0);\r\n\r\n\tbool initCore(  u32 order,\r\n\t\t\t\t\tfloat x, float y, const char * asset,\r\n\t\t\t\t\tconst char * movie_name, const char * complete_callback,\r\n\t\t\t\t\tconst char ** asset_list = NULL, int replace_cnt = 0);\r\n\r\n\tconst char **   replaceAssets       (CLuaState& lua, int pos, int * retcnt);\r\n\tbool            removeReplaceList   (const char ** list, int cnt);\r\n\tvoid            reachFrame          (const char* label, const char* callBack);\r\n\r\n};\r\n\r\n\r\n\r\n#endif // CKLBUISWFPlayer_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIScale9.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIScale9_h\r\n#define CKLBUIScale9_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIScale9\r\n* \\brief Scale 9 Task CLass\r\n* \r\n* CKLBUIScale9 is designed to manage assets cut in 9 parts.\r\n* 4 for corners, 4 for borders and 1 for the center.\r\n*/\r\nclass CKLBUIScale9 : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIScale9>;\r\nprivate:\r\n\tCKLBUIScale9();\r\n\tvirtual ~CKLBUIScale9();\r\nprotected:\r\n\tenum PROP_ID{\r\n\t\tPR_ORDER /*= PRG_LAST_UITASK  <-- Support in FUTURE changes */,\r\n\t\tPR_WIDTH,\r\n\t\tPR_HEIGHT,\r\n\t\tPR_ASSET,\r\n\t\tPR_LAST_UISCALE9\r\n\t};\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBUIScale9 * create(CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, s32 width, s32 height, const char* SCALE9Asset);\r\n\t\r\n\tbool init\t\t(CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, s32 width, s32 height, const char* SCALE9Asset);\r\n\tbool initCore\t(u32 order, float x, float y, s32 width, s32 height, const char* SCALE9Asset);\r\n\r\n\tbool initUI\t\t(CLuaState& lua);\r\n\tint commandUI\t(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute\t(u32 deltaT);\r\n\tvoid dieUI\t\t();\r\n\r\n\tinline void setWidth(s32 width) {\r\n\t\tif(m_width != width) {\r\n\t\t\tm_scale9->setWidth(width);\r\n\t\t\tm_width = width;\r\n\t\t\tgetNode()->markUpMatrix();\r\n\t\t}\r\n\t}\r\n\tinline s32 getWidth() { return m_width; }\r\n\r\n\tinline void setHeight(s32 height) {\r\n\t\tif(m_height != height) {\r\n\t\t\tm_scale9->setHeight(height);\r\n\t\t\tm_height = height;\r\n\t\t\tgetNode()->markUpMatrix();\r\n\t\t}\r\n\t}\r\n\tinline s32 getHeight() { return m_height; }\r\n\r\n\tinline void setOrder(u32 order) {\r\n\t\tif(order != m_order) {\r\n\t\t\tm_scale9->changeOrder(CKLBRenderingManager::getInstance(),order);\r\n\t\t\tm_order = order;\r\n\t\t}\r\n\t}\r\n\tinline u32 getOrder() { return m_order; }\r\n\r\n\tinline const char* getAsset() { return m_asset; }\r\n\r\n\tbool setAsset\t(const char* asset);\r\n\r\nprivate:\r\n\tu32\t\t\t\t\tm_handle;\r\n\tCKLBTextureAsset*\tm_texture;\r\n\tconst char*\t\t\tm_asset;\r\n\tCKLBSpriteScale9*\tm_scale9;\r\n\t\r\n\tbool\t\t\t    m_bInit;\r\n\tu32\t\t\t\t    m_order;\r\n\ts32\t\t\t\t    m_width;\r\n\ts32\t\t\t\t    m_height;\r\n\r\n\tstatic PROP_V2\t\t\tms_propItems[];\r\n\r\n\t/* FUTURE property handling.\r\n\tstatic\r\n\tconst char *\ts_Scale9NameStatic\t\t[PR_LAST_UISCALE9];\r\n\tVALUE\t\t\tm_Scale9PropValue\t\t[PR_LAST_UISCALE9];\r\n\tPROPTYPE\t\tm_Scale9PropType\t\t[PR_LAST_UISCALE9];\r\n\tbool\t\t\tm_Scale9PropChecked\t\t[PR_LAST_UISCALE9];\r\n\t*/\r\n};\r\n\r\n#endif // CKLBUIScale9_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIScore.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIScore_h\r\n#define CKLBUIScore_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBScoreNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIScore\r\n* \\brief Score Task Class\r\n* \r\n* CKLBUIScore is designed for managing Score.\r\n* It handles 10 assets, one for each digit and uses it to display a score.\r\n* It also manages the animation going with the two different scores transitions.\r\n*/\r\nclass CKLBUIScore : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIScore>;\r\nprivate:\r\n\tCKLBUIScore();\r\n\tvirtual ~CKLBUIScore();\r\npublic:\r\n\t// プロパティのインデックス\r\n\tenum PROP_ID{\r\n\t\tPR_ORDER,\r\n\t\tPR_ODOFF,\r\n\t\tPR_STEP_X,\r\n\t\tPR_STEP_Y,\r\n\t\tPR_COLS,\r\n\t\tPR_FILLZERO,\r\n\t\tPR_ANIM,\r\n\t\tPR_VALUE,\r\n\t\tPR_ALIGN,\r\n\t\tPR_COUNTCLIP,\r\n\r\n\r\n\t\tPR_TEX_0,\r\n\t\tPR_TEX_1,\r\n\t\tPR_TEX_2,\r\n\t\tPR_TEX_3,\r\n\t\tPR_TEX_4,\r\n\t\tPR_TEX_5,\r\n\t\tPR_TEX_6,\r\n\t\tPR_TEX_7,\r\n\t\tPR_TEX_8,\r\n\t\tPR_TEX_9,\r\n\t};\r\n\r\n\tenum {\r\n\t\t// 以下の値を変更する場合は CompositeManagement.cpp 等、\r\n\t\t// 外部のツールから与えられる値との間で整合を取ること。\r\n\t\tALIGN_RIGHT  = 0,\r\n\t\tALIGN_CENTER = 1,\r\n\t\tALIGN_LEFT   = 2,\r\n\t};\r\n\r\n\tstatic CKLBUIScore * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\tu32 order, s32 order_offset,\r\n\t\t\t\t\t\t\t\tfloat x, float y, const char ** tex_table,\r\n\t\t\t\t\t\t\t\tfloat stepX, float stepY, int column, \r\n\t\t\t\t\t\t\t\tbool fillzero, bool anim_flags, u32 align = ALIGN_RIGHT,\r\n\t\t\t\t\t\t\t\tbool countclip = false);\r\n\tbool initUI     (CLuaState& lua);\r\n\tu32 getClassID  ();\r\n\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline u32\tgetValue()\t\t\t\t{ return m_value;\t\t}\r\n\tinline void setValue(u32 value)     {\r\n\t\tif (value != m_value) {\r\n\t\t\tm_value = value;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getValueFloat()\t\t\t{ return m_value;\t\t}\r\n\tinline void setValueFloat(float value, u32 prec)\t{\r\n\t\tif ((value != m_fValue) || (prec != m_fPrec)) {\r\n\t\t\tm_fValue = value;\r\n\t\t\tm_fPrec  = prec;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinline u32\tgetOrder()\t\t\t\t{ return m_order;\t\t}\r\n\tinline void setOrder(u32 order)\t\t{\r\n\t\tif(order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetOrderOffset()\t\t{ return m_orderOffset;\t}\r\n\r\n\tinline s32\tgetStepX()\t\t\t\t{ return m_stepX;\t\t}\r\n\tinline void setStepX(s32 stepX)\t\t{\r\n\t\tif(stepX != m_stepX) {\r\n\t\t\tm_stepX = stepX;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32\tgetStepY()\t\t\t\t{ return m_stepY;\t\t}\r\n\tinline void setStepY(s32 stepY)\t\t{\r\n\t\tif(stepY != m_stepY) {\r\n\t\t\tm_stepY = stepY;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetColumn()\t\t\t\t{ return m_column;\t\t}\r\n\tinline void setColumn(u32 cols)\t\t{\r\n\t\tif(cols != m_column) {\r\n\t\t\tm_column = cols;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getFillZero()\t\t\t{ return m_bFillZero;\t}\r\n\tinline void setFillZero(bool fZero)\t{\r\n\t\tif(fZero != m_bFillZero) {\r\n\t\t\tm_bFillZero = fZero;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getAnim()\t\t\t\t{ return m_anim;\t\t}\r\n\r\n\tinline u32\tgetAlign()\t\t\t\t{ return m_align;\t\t}\r\n\tinline void setAlign(u32 align)\t\t{\r\n\t\tif(align != m_align) {\r\n\t\t\tm_align = align;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getCountClip()\t\t\t{ return m_bCountClip;\t}\r\n\tinline void setCountClip(bool b)\t{\r\n\t\tif(b != m_bCountClip) {\r\n\t\t\tm_bCountClip = b;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinline const char*\tgetTex0     ()  { return m_asset[0]; }\r\n\tinline const char*\tgetTex1     ()  { return m_asset[1]; }\r\n\tinline const char*\tgetTex2     ()  { return m_asset[2]; }\r\n\tinline const char*\tgetTex3     ()  { return m_asset[3]; }\r\n\tinline const char*\tgetTex4     ()  { return m_asset[4]; }\r\n\tinline const char*\tgetTex5     ()  { return m_asset[5]; }\r\n\tinline const char*\tgetTex6     ()  { return m_asset[6]; }\r\n\tinline const char*\tgetTex7     ()  { return m_asset[7]; }\r\n\tinline const char*  getTex8     ()  { return m_asset[8]; }\r\n\tinline const char*  getTex9     ()  { return m_asset[9]; }\r\n\tinline const char** getTextures ()  { return m_asset; \t }\r\n\r\n\tvoid setDot(const char* dotAsset, s32 width, s32 height);\r\n\tconst char* getDot();\r\n\r\n\tinline void setEnterAnimation(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam) {\r\n\t\tm_pScoreNode->setEnterAnimation(milliSecondsPlayTime, timeShift, onlyChange, type, affected, arrayParam);\r\n\t}\r\n\r\n\tinline void setExitAnimation(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam) {\r\n\t\tm_pScoreNode->setExitAnimation(milliSecondsPlayTime, timeShift, onlyChange, type, affected, arrayParam);\r\n\t}\r\nprivate:\r\n\r\nbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\tu32 order, s32 order_offset, float x, float y, \r\n\t\t\t\t\tconst char ** tex_table, float stepX, float stepY, int column, \r\n\t\t\t\t\tbool fillzero, bool anim_flag, u32 align, bool countclip);\r\n\tbool initCore(  u32 order, s32 order_offset, float x, float y, \r\n\t\t\t\t\tconst char ** tex_table, float stepX, float stepY, int column, \r\n\t\t\t\t\tbool fillzero, bool anim_flag, u32 align, bool countclip);\r\n\r\n\tint countColumn(u32 value);\r\n\r\n\tu32\t\tm_value;\r\n\tfloat\tm_fValue;\r\n\ts32\t\tm_dotStepX;\r\n\ts32\t\tm_dotStepY;\r\n\tu32\t\tm_order;\r\n\tu32\t\tm_orderOffset;\r\n\ts32\t\tm_stepX;\r\n\ts32\t\tm_stepY;\r\n\tu32\t\tm_column;\r\n\tu32\t\tm_align;\r\n\tbool\tm_bFillZero;\r\n\tbool\tm_anim;\r\n\tbool\tm_bScoreUpdate;\r\n\tbool\tm_bCountClip;\r\n\tu8\t\tm_fPrec;\r\n\r\n\tconst char *        m_asset[10];\r\n\r\n\tCKLBScoreNode\t*\tm_pScoreNode;\r\n\tCKLBImageAsset\t*\tm_numTex[10];\r\n\tu32\t\t\t\t\tm_handle;\r\n\r\n\tint\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\tm_height;\r\n\r\n\tint\t\t\t\t\tm_maxvalue;\r\n\t\r\n\tstatic PROP_V2 \t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIScore_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIScrollBar.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIScrollBar_h\r\n#define CKLBUIScrollBar_h\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"IMgrEntry.h\"\r\n\r\n/*!\r\n* \\class CKLBUIScrollBar\r\n* \\brief Scroll Bar Task Class\r\n* \r\n* CKLBUIScrollBar allows to create and manage a Scroll Bar.\r\n* The Scroll Bar action into the Game can be defined through a callback.\r\n*/\r\nclass CKLBUIScrollBar : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIScrollBar>;\r\nprivate:\r\n\tCKLBUIScrollBar();\r\n\tvirtual ~CKLBUIScrollBar();\r\npublic:\r\n\t// プロパティのインデックス\r\n\tenum PROP_ID{\r\n\t\tP_WIDTH,\r\n\t\tP_HEIGHT,\r\n\t\tP_ORDER,\r\n\t\tP_VERT,\r\n\r\n\t\tP_IMAGE,\r\n\t\tP_MIN,\r\n\t\tP_MAX,\r\n\t\tP_POS,\r\n\r\n\t\tP_SLIDER_SIZE,\r\n\t\tP_SLIDER_MIN_SIZE,\r\n\t\r\n\t\tP_CALLBACK,\r\n\t\tP_TOUCH_ACTIVE,\r\n\t\tP_ALPHA_NORMAL,\r\n\t\tP_ALPHA_SELECT,\r\n\t\tP_COLOR_NORMAL,\r\n\t\tP_COLOR_SELECT,\r\n\t};\r\n\r\n\tstatic CKLBUIScrollBar * create(\r\n\t\tCKLBUITask * pParent, CKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos,\r\n\t\tconst char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode = false);\r\n\r\n\tbool initUI(CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI();\r\n\t\r\n\tu32 getClassID();\r\n\r\n\tinline s32\tgetMin          ()          { return m_min;             }\r\n\tinline s32\tgetMax          ()          { return m_max;             }\r\n\tinline s32\tgetPos          ()          { return m_pos;\t            }\r\n\tinline s32\tgetSliderSize   ()          { return m_sliderSize;      }\r\n\tinline s32\tgetSliderSizeMin()          { return m_sliderSizeMin;   }\r\n\tinline bool getTouchActive  ()          { return m_bTouchActive;    }\r\n\tinline u32\tgetColorMode    (u32 mode)  { return m_scrBar.getColorMode(mode); }\r\n\tinline u32\tgetOrder        ()\t\t    { return m_order;           }\r\n\tinline s32\tgetWidth        ()\t\t    { return m_width;           }\r\n\tinline s32\tgetHeight       ()\t\t    { return m_height;          }\r\n\tinline bool getVertical     ()\t\t    { return m_vert;            }\r\n\tinline u32\tgetAlphaNormal  ()\t\t    { return m_alphaNormal;     }\r\n\tinline u32\tgetAlphaSelect  ()\t\t    { return m_alphaSelect;     }\r\n\tinline u32\tgetColorNormal  ()\t\t    { return m_colorNormal;     }\r\n\tinline u32\tgetColorSelect  ()\t\t    { return m_colorSelect;     }\r\n\tinline const char* getImage ()\t\t    { return m_image;           }\r\n\tinline const char* getCallBack()\t    { return m_callback;        }\r\n\tinline u32\tgetMode         ()\t\t    { return m_mode;            }\r\n\r\n\tvoid setMin\t(s32 value);\r\n\tvoid setMax\t(s32 value);\r\n\tvoid setPos\t(s32 value);\r\n\r\n\tinline void setSliderSize\t(s32 value)\t\t\t\t{ m_scrBar.setSliderSize(value);\tm_sliderSize = m_scrBar.getSliderSize();\t\t}\r\n\tinline void setSliderSizeMin(s32 value)\t\t\t\t{ m_scrBar.setSliderSizeMin(value); m_sliderSizeMin = m_scrBar.getSliderSizeMin();\t}\r\n\tinline void setTouchActive\t(bool active)\t\t\t{ m_active = active; m_scrBar.setTouchActive(active);\t}\r\n\tinline void setMode\t\t\t(u32 mode)\t\t\t\t{ m_mode = mode;\t m_scrBar.setMode(mode);\t\t\t}\r\n\tinline void setVertical\t\t(bool vertical)\t\t\t{ m_vert = vertical; m_scrBar.setVertical(vertical);\t}\r\n\tinline void setAlphaNormal\t(u32 alpha)\t\t\t\t{ m_alphaNormal = (u8)alpha; m_scrBar.setColorMode(0,(m_alphaNormal<<24) | m_colorNormal);\t}\r\n\tinline void setAlphaSelect\t(u32 alpha)\t\t\t\t{ m_alphaSelect = (u8)alpha; m_scrBar.setColorMode(1,(m_alphaSelect<<24) | m_colorSelect);\t}\r\n\tinline void setColorNormal\t(u32 colorRGB)\t\t\t{ m_colorNormal = colorRGB;  m_scrBar.setColorMode(0,(m_alphaNormal<<24) | m_colorNormal);\t}\r\n\tinline void setColorSelect\t(u32 colorRGB)\t\t\t{ m_colorSelect = colorRGB;  m_scrBar.setColorMode(1,(m_alphaSelect<<24) | m_colorSelect);\t}\r\n\tinline void setWidth\t\t(s32 width)\t\t\t\t{ m_width  = width;\t m_scrBar.setWidth(width);\t\t}\r\n\tinline void setHeight\t\t(s32 height)\t\t\t{ m_height = height; m_scrBar.setHeight(height);\t}\r\n\tinline void setOrder\t\t(u32 order)\t\t\t\t{ m_order  = order;\t m_scrBar.setOrder(order);\t\t}\r\n\tinline bool\tselectScrMgr\t(const char* name, int len, int* args) {\r\n\t\tCKLBScrollMgr * pMgr = IMgrEntry::getMgrByArray(name, len, args); \r\n\t\tif(pMgr) m_scrBar.setScrollMgr(pMgr);\r\n\t\treturn ((pMgr != NULL) ? true:false);\r\n\t}\r\n\r\n\tvoid setColorMode\t\t\t(u32 mode, u32 color);\r\nprotected:\r\n\r\n\ts32\t\t    m_min;\r\n\ts32\t\t    m_max;\r\n\ts32\t\t    m_pos;\r\n\ts32\t\t    m_sliderSize;\r\n\ts32\t\t    m_sliderSizeMin;\r\n\tbool\t    m_bTouchActive;\r\n\ts32\t\t    m_width;\r\n\ts32\t\t    m_height;\t\r\n\tu32\t\t    m_order;\r\n\tbool\t    m_vert;\r\n\r\n\tconst char*\tm_image;\r\n\r\n\tconst char* m_callback;\r\n\r\n\tu32\t\t    m_mode;\r\n\tu32\t\t    m_colorNormal;\r\n\tu32\t\t    m_colorSelect;\r\n\tbool\t    m_active;\r\n\tu8\t\t    m_alphaNormal;\r\n\tu8\t\t    m_alphaSelect;\r\n\r\nprivate:\r\n\tvoid recompute\t();\r\n\r\n\tbool init(\r\n\t\tCKLBUITask * pParent, CKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos,\r\n\t\tconst char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode);\r\n\r\n\tbool initCore(\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos,\r\n\t\tconst char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode);\r\n\r\n\r\n\tint\t\t\t\t\tm_minPos;\r\n\tCKLBModalStack\t\tm_modalStack;\t// モーダルスタック\r\n\tCKLBScrollBarIF\t\tm_scrBar;\t\t// ScrollBarインタフェース\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIScrollBar_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUISimpleItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUISimpleItem_h\r\n#define CKLBUISimpleItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUISimpleItem\r\n* \\brief Simple Item task Class\r\n* \r\n* CKLBUISimpleItem is a simple Image.\r\n*/\r\nclass CKLBUISimpleItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUISimpleItem>;\r\nprivate:\r\n\tCKLBUISimpleItem();\r\n\tvirtual ~CKLBUISimpleItem();\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset);\r\n\tbool initCore(u32 order, float x, float y, const char* asset);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBUISimpleItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset);\r\n\tbool initUI (CLuaState& lua);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif (order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tm_pNode->setPriority(m_order);\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32  getOrder() { return m_order; }\r\n\tinline const char*\tgetAsset() { return m_asset; }\r\n\r\nprivate:\r\n\tu32\t\t\t\tm_order;\r\n\tconst char*\t\tm_asset;\r\n\tu32\t\t\t\tm_handle;\r\n\tCKLBNode\t*\tm_pNode;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUISimpleItem_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUISystem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === UI System derived from scene graph ===\r\n//\r\n\r\n#ifndef __KLB_UISYSTEM__\r\n#define __KLB_UISYSTEM__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBTouchPad.h\"\r\n\r\n#include \"CKLBDragCallbackIF.h\"\r\n\r\nclass CKLBUIContainer;\r\nclass CKLBUISelectable;\r\nclass CKLBUISystem;\r\n\r\n/**\r\n\tEach element will use a TouchSurface\r\n */\r\nstruct STouchSurface {\r\n\tfriend class CKLBUISystem;\r\npublic:\r\n\t// Direct link to transform matrix in screen space.\r\n\tSMatrix2D*\t\t\ttransform;\r\n\t\r\n\t// Coordinate setup by user\r\n\t// x,y,w,h\r\n\tfloat\t\t\t\tbeforeTransform[4];\r\n\r\n\t// x0,y0,x1,y1\r\n\tfloat\t\t\t\tafterTransform[4];\t// Coordinate post-transform.\r\n\r\n\tu16\t\t\t\t\tsurfaceIndex;\r\n\tu32\t\t\t\t\ttouchSurfacePriorityEquiv;\t\t\t\t\t\r\n\tbool\t\t\t\tisUpToDate;\t\t\t// Bit telling that user has modified the selection space OR matrix has been changed.\r\n};\r\n\r\nstruct SClipRecord {\r\n\tCKLBRenderState*\tpClipStartState;\r\n\tCKLBRenderState*\tpClipEndState;\r\n};\r\n\r\n#define UI_SYS_MAXCLIP_ARRAY\t\t(16)\r\nstruct SFormCtrlList;\r\n\r\n/*!\r\n* \\class CKLBUISystem\r\n* \\brief UISystem Class\r\n* \r\n* CKLBUISystem provides static methods to manage screen area using STouchSurface.\r\n* It can be used to create/release touch surfaces and clips.\r\n*/\r\nclass CKLBUISystem {\r\npublic:\r\n\tstatic CKLBUISelectable*\thitTest\t\t\t\t(float screenX, float screenY);\r\n\tstatic CKLBUISelectable*\tcreateTouchSurface\t(CKLBUISelectable*\tpSource , u32 priority);\r\n\tstatic void\t\t\t\t\treleaseTouchSurface\t(CKLBUISelectable*\tpSurface);\r\n\tstatic void\t\t\t\t\treleaseAll          ();\r\n\tstatic void\t\t\t\t\tsetFormList\t\t\t(SFormCtrlList * pList);\r\n\tstatic void*\t\t\t\tregisterClip\t\t(CKLBRenderState* startClip, CKLBRenderState* endClip);\r\n\tstatic void\t\t\t\t\tunregisterClip\t\t(void* clipHandle);\r\nprivate:\r\n\tstatic bool\t\t\t\t\tcheckRange\t\t\t(CKLBRenderState* startClip, CKLBRenderState* endClip);\r\n\r\n\tstatic SFormCtrlList*\t\ts_formList;\r\n\tstatic SClipRecord*\t\t\ts_clip_array[UI_SYS_MAXCLIP_ARRAY];\r\n\tstatic u16\t\t\t\t\ts_clip_arraySize;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIElement\r\n* \\brief Element Node Class\r\n* \r\n* CKLBUIElement is the most basic UI Node as it directly inherits CKLBNode.\r\n* It adds Assets and asset management methods to the CKLBNode.\r\n* A CKLBUIElement supports multiple assets association in order to change\r\n* the asset if the CKLBUIElement is enable or not.\r\n*/\r\nclass CKLBUIElement : public CKLBNode {\r\npublic:\r\n\tenum UI_STATE {\r\n\t\tNORMAL,\r\n\t\tDISABLED,\r\n\t\tFOCUSED,\r\n\t\tDOWN,\r\n\t\tNOT_ON_SCREEN\r\n\t};\r\n\r\n\tenum ASSET_TYPE {\r\n\t\tNORMAL_ASSET\t\t= NORMAL,\r\n\t\tDISABLED_ASSET\t\t= DISABLED,\r\n\t\tFOCUSED_ASSET\t\t= FOCUSED,\r\n\t\tPUSHED_ASSET\t\t= DOWN\r\n\t};\r\n\r\n\tCKLBUIElement();\r\n\t~CKLBUIElement();\r\n\r\n\tvoid\tstoreDoRefLock\t\t(bool doRefCounting)\t{ m_bDoRefCount = doRefCounting; }\r\n\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t    { return CLS_KLBUIELEMENT; }\r\n\r\n\tvoid\tsetLeft\t\t\t\t(s32 coordinateX);\r\n\tvoid\tsetTop\t\t\t\t(s32 coordinateY);\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\tbool\t     isEnabled\t\t();\r\n\r\n\tvirtual\tbool isSelectable\t()\t\t{ return false; }\r\n\tvirtual bool isContainer\t()\t\t{ return false; }\r\n\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\r\n\tCKLBUIContainer* getParentUI();\r\n\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\tregisterHandler\t\t(CKLBActionHandler* pActionHandler);\r\n\tvoid\tclearHandlers\t\t();\r\n\r\n\tvoid\tsetScriptable\t\t(CKLBObjectScriptable* pScriptable);\r\n\r\n\tvirtual void setPriority\t(u32 renderPriority) {\r\n\t\tif (renderPriority != m_renderPrio) {\r\n\t\t\tm_renderPrio = renderPriority;\r\n\t\t\tCKLBNode::setPriority(m_renderPrio);\r\n\t\t\tif (m_currentAssetTree) {\r\n\t\t\t\tm_currentAssetTree->setPriority(m_renderPrio);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvirtual u32\tgetPriority\t\t() {\r\n\t\treturn m_renderPrio;\r\n\t}\r\n\r\n\tbool\tsendEvent\t\t\t(ACTION_TYPE type, u32 param);\t// Should be protected but access issue.\r\nprotected:\r\n\tvirtual void visibleSelf\t();\r\n\t\r\n\tvirtual void invisibleSelf  ();\r\n\t\r\n\tvoid\tresetAsset\t\t\t(CKLBAsset** ppOldAsset, CKLBNode** ppOldNode, CKLBAsset* newAsset);\r\n\r\n\tbool\tprocessListener\t\t(CKLBAction* pAction);\r\n\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\tvoid releaseAsset\t\t\t(CKLBAsset* pAsset);\r\n\tvoid switchTo\t\t\t\t(UI_STATE newState);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender\t\t();\r\n\tvirtual void removeRender\t();\r\n\r\n\tCKLBAsset*\t\t\tm_currentAsset;\r\n\tCKLBNode*\t\t\tm_currentAssetTree;\r\n\tCKLBActionHandler*\tm_pActionHandlerList;\r\n\r\n\tCKLBAsset*\t\t\tm_pNormal;\r\n\tCKLBNode*\t\t\tm_pNormalTree;\r\n\r\n\tCKLBAsset*\t\t\tm_pDisabled;\r\n\tCKLBNode*\t\t\tm_pDisabledTree;\r\n\r\n\tCKLBObjectScriptable*\r\n\t\t\t\t\t\tm_scriptable;\r\n\r\n\tu32\t\t\t\t\tm_renderPrio;\r\n\tu32\t\t\t\t\tm_listenerMask;\r\n\tUI_STATE\t\t\tm_UIState;\r\n\tbool\t\t\t\tm_bEnabled;\r\n\tbool\t\t\t\tm_bUpperEnabled;\r\n\tbool\t\t\t\tm_bDoRefCount;\r\n\tconst char*\t\t\tm_luaFunc;\t\t// callback Lua function\r\n\r\nprivate:\r\n\tCKLBAction\t\t\tm_localAction;\r\n};\r\n\r\nclass CKLBAudioAsset;\r\n\r\n/*!\r\n* \\class CKLBUISelectable\r\n* \\brief Selectable Node Class\r\n* \r\n* CKLBUISelectable represents a selectable item Node.\r\n* A STouchSurface is allocated for each CKLBUISelectable and represents the \r\n* screen area associated with the object.\r\n*/\r\nclass CKLBUISelectable : public CKLBUIElement {\r\n\tfriend class CKLBUIElement;\r\n\tfriend struct SFormCtrlList;\r\n\tfriend class CKLBUISystem;\r\npublic:\r\n\tCKLBUISelectable();\r\n\t~CKLBUISelectable();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBUISELECTABLE; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\t\t\r\n\tvoid\t\trecomputeCustom\t();\r\n\r\n\t// KLBUIElement::\r\n\tvirtual\r\n\tbool\tisSelectable\t\t()\t\t{ return true; }\r\n\tvirtual\r\n\tvoid\tsetEnabled\t\t\t(bool isEnabled);\r\n\tvirtual\r\n\tvoid\tsetAsset\t\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\r\n\tvoid\tsetAudio\t\t\t(CKLBAudioAsset* pAudioAsset, u32 mode, float volume, bool bOwner = false);\r\n\tvoid\tsetMultiplyVolume\t(u32 mode, float factorVolume);\r\n\r\n\tvirtual\r\n\tbool\tprocessAction\t\t(CKLBAction* pAction);\r\n\r\n\tbool\tinit\t\t\t\t(u32 priority);\r\n\r\n\t//\r\n\t// Define rectangle for reaction to touch screen.\r\n\t//\r\n\tvoid\tsetClickLeft\t\t(s32 coordinateX);\r\n\tvoid\tsetClickWidth\t\t(u32 width);\r\n\tvoid\tsetClickTop\t\t\t(s32 coordinateY);\r\n\tvoid\tsetClickHeight\t\t(u32 height);\r\n\r\n\tvoid\tsetModalResult\t\t(u32 modalResult);\r\n\r\n\t//\r\n\t//\tWhen clicked, stay down after release or up again (=Check box / down button)\r\n\t//\r\n\tvoid\tsetStick\t\t\t(bool isStickable);\r\n\tbool\tisStickable\t\t\t()\t\t\t\t{ return m_bStick;\t}\r\n\tvoid\tsetSticked\t\t\t(bool isSticked);\r\n\tbool\tisSticked\t\t\t()\t\t\t\t{ return m_bDown;\t}\r\n\r\n\t//\r\n\t//\tWhen clicked, all other stickable are modified / reset to unstick.\r\n\t// 0 : Not radio, 1..n : Radio ID.\r\n\tvoid\tsetRadio\t\t\t(u32 radioID);\r\n\tu32\t\tgetRadioID\t\t\t()\t\t\t\t{ return m_radioID; }\r\n\r\n\r\n\tbool\tsetLuaFunction(const char * funcname);\r\n\r\n\tinline\r\n\tCKLBUISelectable*\tgetNextSelectable() { return m_pNextSelectable; }\r\nprotected:\r\n\tvoid\tresetSticked\t\t(CKLBUIElement* pElement);\r\n\tvoid\tsetStickedRecurse\t(CKLBNode* pNode);\r\n\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\tCKLBUISelectable*\tm_pNextSelectable;\r\n\r\n\tCKLBAsset*\tm_pFocus;\r\n\tCKLBNode*\tm_pFocusTree;\r\n\tCKLBAsset*\tm_pPushed;\r\n\tCKLBNode*\tm_pPushedTree;\r\n\tCKLBAudioAsset*\tm_pDownAudio;\r\n\tCKLBAudioAsset* m_pUpAudio;\r\n\tfloat\t\tm_pDownVolumeOriginal;\r\n\tfloat\t\tm_pUpVolumeOriginal;\r\n    float       m_pDownVolumeFactor;\r\n    float       m_pUpVolumeFactor;\r\n\tfloat\t\tm_pDownVolume;\r\n\tfloat\t\tm_pUpVolume;\r\n\tbool\t\tm_bOwnerDownAudio;\r\n\tbool\t\tm_bOwnerUpAudio;\r\n\r\n\tu32\t\t\tm_modalResult;\r\n\tu32\t\t\tm_radioID;\r\npublic:\r\n\tu16\t\t\tm_groupID;\r\nprotected:\r\n\tSTouchSurface\tm_touchSurface;\r\n\r\n\tbool\tm_bStick;\t\t// Stay down even if current state is \"up\".\r\n\tbool\tm_bDown;\t\t// Current State.\r\n\tbool\tm_bLocked;\t\t// Used for canceling an event. (drag)\r\n\tint\t\tm_lastClick;\t// last click frameID\r\n\r\n\tvoid setStickedInternal(bool isSticked);\r\n};\r\n\r\nstruct SFormCtrlList {\r\n\tSFormCtrlList\t\t*\tnext;\r\n\tCKLBUISelectable\t*\tpBegin;\r\n\r\n\tvoid\t\t\t\t*\tpGroup;\t\t// Formが所属するグループのポインタ\r\n\tSFormCtrlList\t\t*\tpGrpPrev;\t// グループ内リンク用\r\n\tSFormCtrlList\t\t*\tpGrpNext;\t// グループ内リンク用\r\n\r\n\tbool\t\t\t\t\tbExclusive;\r\n\tbool\t\t\t\t\tbWorking;\r\n\tbool\t\t\t\t\tbEnable;\r\n\r\n\tSFormCtrlList(void)\r\n\t\t: next      (NULL)\r\n        , pBegin    (NULL)\r\n        , pGroup    (NULL)\r\n        , pGrpPrev  (NULL)\r\n        , pGrpNext  (NULL)\r\n        , bExclusive(false)\r\n        , bWorking  (false)\r\n        , bEnable   (false)\r\n\t{}\r\n\r\n\tCKLBDragCallbackIF\t*\tpCallbackIF;\r\n\tvoid (*nativeCallback)(void * pData, PAD_ITEM::TYPE type, int dragX, int dragY, int mvX, int mvY);\r\n\tCKLBObjectScriptable*\tpID;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIContainer\r\n* \\brief Container Node Class\r\n* \r\n* CKLBUIContainer allows to regroup sub items and manage them like one.\r\n*/\r\nclass CKLBUIContainer : public CKLBUIElement {\r\npublic:\r\n\tCKLBUIContainer ();\r\n\t~CKLBUIContainer();\r\n\r\n\tbool\tinit\t\t\t\t();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t{ return CLS_KLBUICONTAINER; }\r\n\r\n\t// KLBUIElement::\r\n\tvirtual\r\n\tbool\tisContainer\t\t\t()\t\t{ return true; }\r\n\tvirtual\r\n\tvoid\tsetEnabled\t\t\t(bool isEnabled);\r\n\r\n\tCKLBUIElement* getChildUI\t(bool external = false);\r\n\r\n\tvoid\tsetViewOffsetX\t\t(s32 scrollX);\r\n\tvoid\tsetViewOffsetY\t\t(s32 scrollY);\r\n\r\n\tinline\r\n\ts32\t\tgetViewOffsetX\t\t() { return (s32)m_innerNode->m_matrix.m_matrix[4]; }\r\n\tinline\r\n\ts32\t\tgetViewOffsetY\t\t() { return (s32)m_innerNode->m_matrix.m_matrix[5]; }\r\n\r\n\t//\r\n\t// Allow to connect sub UI component to the container.\r\n\t//\r\n\tvoid\taddElement\t\t\t(CKLBUIElement*\tpElement, bool external = false);\r\n\tvoid\tremoveElement\t\t(CKLBUIElement* pElement, bool external = false);\r\n\r\n\t//\r\n\t// Allow to find the active radio button inside the container.\r\n\t//\r\n\tu32\t\tgetRadioValue\t\t();\r\n\r\n\tvoid\tshowModal\t\t\t(CKLBNode* pNode);\r\n\r\n\tinline\r\n\tCKLBNode*\tgetInnerNode\t()\t{ return m_innerNode; }\r\n\r\n\tinline\r\n\tvoid\t\tsetClipHandle\t(void* clipHandle) { m_clipHandle = clipHandle; }\r\n\r\nprotected:\r\n\tvirtual \r\n    void        setUpperEnabled (bool isEnabled);\r\n\tu32\t\t\tgetRadioValueRecurse\t(CKLBNode* pNode);\r\n\r\nprivate:\r\n\tCKLBNode*\tm_innerNode;\r\n\tCKLBNode*\tm_outerNode;\r\n\tvoid*\t\tm_clipHandle;\r\n\r\n\tu32\t\t\tm_viewPortWidth;\r\n\tu32\t\t\tm_viewPortHeight;\r\n\ts32\t\t\tm_viewScrollX;\r\n\ts32\t\t\tm_viewScrollY;\r\n\tbool\t\tm_bAsModal;\t// Just to avoid compile error.\r\npublic:\r\n\tbool\t\tisModal() { return m_bAsModal; }\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUITask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUITask_h\r\n#define CKLBUITask_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n#include \"CKLBSplineNode.h\"\r\n\r\n#define\tUI_BASE_PROP \\\r\n\t{\t\"alpha\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUITask::setAlpha,\t\t(getBoolT)&CKLBUITask::getAlpha,\t\t0\t},\\\r\n\t{\t\"color\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUITask::setColor,\t\t(getBoolT)&CKLBUITask::getColor,\t\t0\t},\\\r\n\t{\t\"scaleX\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setScaleX,\t\t(getBoolT)&CKLBUITask::getScaleX,\t\t0\t},\\\r\n\t{\t\"scaleY\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setScaleY,\t\t(getBoolT)&CKLBUITask::getScaleY,\t\t0\t},\\\r\n\t{\t\"rot\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setRotation,\t\t(getBoolT)&CKLBUITask::getRotation,\t\t0\t},\\\r\n\t{\t\"x\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setX,\t\t\t(getBoolT)&CKLBUITask::getX,\t\t\t0\t},\\\r\n\t{\t\"y\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setY,\t\t\t(getBoolT)&CKLBUITask::getY,\t\t\t0\t},\\\r\n\t{\t\"visible\",\t\t\tBOOLEANT,\t(setBoolT)&CKLBUITask::setVisible,\t\t(getBoolT)&CKLBUITask::getVisible,\t\t0\t}\r\n\r\n#define UI_BASE_PROPCOUNT\t(8)\r\n\r\n/*!\r\n* \\class CKLBUITask\r\n* \\brief UI Task Class.\r\n* \r\n* CKLBUITask is the root class for every UI Task Classes in the Engine.\r\n* It defines some properties helpful for every subclasses (such as\r\n* alpha, color, scale, rotation, position, visibility).\r\n*\r\n* Each UITask is linked with a Node of the SceneGraph to be rendered.\r\n* Both objects point each other.\r\n*\r\n* You can also attach to a CKLBUITask some spline animations.\r\n*/\r\nclass CKLBUITask : public CKLBLuaPropTask\r\n{\r\nprotected:\r\n\tCKLBUITask(TASK_PHASE phase = P_UIPROC);\r\n\tvirtual ~CKLBUITask();\r\npublic:\r\n\tbool initScript\t\t(CLuaState& lua);\r\n\tvoid die\t\t\t();\r\n\tint  commandScript\t(CLuaState& lua);\r\n\tvirtual TASKTYPE getTaskType();\r\n\r\n\tinline CKLBNode * getNode() { return m_pUINode; }\r\n\r\n\tinline void setOtherParent(CKLBTask * pTask) { m_pRegParent = pTask; }\r\n\r\n\t// Generic Command: Common for all UI Tasks.\r\n\tenum {\r\n\t\tUI_GENERIC_BASE = 0x10000,\r\n\r\n\t\tUI_GENERIC_NODE_RECONNECT = UI_GENERIC_BASE,\r\n\t\tUI_GENERIC_SET_NAME,\r\n\t\tUI_GENERIC_ANIM_SET_SPLINE,\r\n\t\tUI_GENERIC_ANIM_PLAY,\r\n\t\tUI_GENERIC_ANIM_STOP,\r\n\t\tUI_GENERIC_IS_ANIM,\r\n\r\n\t\tUI_GENERIC_SET_COLOR,\r\n\t\tUI_GENERIC_SET_SCALE,\r\n\t\tUI_GENERIC_SET_ROT,\r\n\t\tUI_GENERIC_SET_VISIBLE,\r\n\r\n\t\tSPL_VALUE_INT = 0,\r\n\t\tSPL_VALUE_NUM = 1\r\n\t};\r\n\r\n\tinline\r\n\tbool getVisible()\t{ return m_visible; }\r\n\r\n\tinline virtual\r\n\tvoid setVisible(bool visible) {\r\n\t\tif(m_newScriptModel) {\r\n\t\t\tif(m_visible != visible) {\r\n\t\t\t\tm_visible = visible;\r\n\t\t\t\tm_pUINode->setVisible(visible);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tm_pUINode->setVisible(visible);\r\n\t\t\tsetGenBool(PRG_VISIBLE, visible);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void  setGenBool(int idx, bool val)\t{ setBool(idx + m_beginIndex, val);\t\t\t\t\t\t}\r\n\tinline void  setGenNum(int idx, float val)\t{ setNum(idx + m_beginIndex, val);\t\t\t\t\t\t}\r\n\tbool\t\t reconnect(const char* nodeName);\r\n\r\n\tinline void  setScaleX(float scale)\t\t{ m_pUINode->setScale(scale, m_pUINode->getScaleY());\t\t}\r\n\tinline float getScaleX()\t\t\t\t{ return m_pUINode->getScaleX();\t\t\t\t\t\t\t}\r\n\r\n\tinline void  setScaleY(float scale)\t\t{ m_pUINode->setScale(m_pUINode->getScaleX(), scale);\t\t}\r\n\tinline float getScaleY()\t\t\t\t{ return m_pUINode->getScaleY();\t\t\t\t\t\t\t}\r\n\r\n\tinline void  setX(float x)\t\t\t\t{ m_pUINode->setTranslate(x,m_pUINode->getTranslateY());\t}\r\n\tinline float getX()\t\t\t\t\t\t{ return m_pUINode->getTranslateX();\t\t\t\t\t\t}\r\n\r\n\tinline void  setY(float y)\t\t\t\t{ m_pUINode->setTranslate(m_pUINode->getTranslateX(),y);\t}\r\n\tinline float getY()\t\t\t\t\t\t{ return m_pUINode->getTranslateY();\t\t\t\t\t\t}\r\n\r\n\tinline void  setRotation(float rot)\t\t{ m_pUINode->setRotation(rot);\t\t\t\t\t\t\t\t}\r\n\tinline float getRotation()\t\t\t\t{ return m_pUINode->getRotation();\t\t\t\t\t\t\t}\r\n\r\n\tinline bool\tsetParamCount(u32 splineCount, u32 maxKeyCount) \r\n\t{ return m_pUINode->setParamCount(splineCount, maxKeyCount); }\r\n\r\n\tinline void setTarget(u32 splineIndex, u32 targetParameter) \r\n\t{ m_pUINode->setTarget(splineIndex,targetParameter); }\r\n\r\n\tinline void addKeys(u32 splineIndex, u32 time, s32 value) \r\n\t{ m_pUINode->addKeys(splineIndex, time, value); }\r\n\r\n\tinline void addKeysFixed(u32 splineIndex, u32 time, s32 fixed16Value) \r\n\t{ m_pUINode->addKeysFixed(splineIndex, time, fixed16Value); }\r\n\r\n\tinline void generateAnimation() \r\n\t{ m_pUINode->generateAnimation(); }\r\n\r\n\tvoid setColor(u32 color);\r\n\tu32  getColor();\r\n\tvoid setAlpha(u32 alpha);\r\n\tu32  getAlpha();\r\n\r\n\tinline void setArgb(u32 alpha, u32 color) {\r\n\t\tsetAlpha(alpha);\r\n\t\tsetColor(color);\r\n\t}\r\n\tinline void setArgb(u32 argb) {\r\n\t\tu32 color = argb & 0x00ffffff;\r\n\t\tu32 alpha = (argb >> 24) & 0xff;\r\n\t\tsetAlpha(alpha);\r\n\t\tsetColor(color);\r\n\t}\r\n\tinline u32  getArgb()\t\t\t\t\t{ return getAlpha()<<24 | getColor();\t}\r\n\r\n\tvirtual u32  getOrder()\t\t\t\t\t{ return 0;\t\t\t\t\t\t\t\t}\r\n\tvirtual void setOrder(u32 /*order*/)\t{ /* Do nothing */\t\t\t\t\t\t}\r\n\r\n\tinline bool isAnim()\t\t\t\t\t{ return m_pUINode->isAnimating();\t\t}\r\n\r\n\tinline void play()\t\t\t\t\t\t{ m_pUINode->play();\t\t\t\t\t}\r\n\tinline void stop()\t\t\t\t\t\t{ m_pUINode->stop();\t\t\t\t\t}\r\n\tinline void setInnerUpdate()\t\t\t{\tm_bInnerUpdate = true;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetUpdateFlag();\t\t\t\t\t}\r\n\r\nprotected:\r\n\tinline bool  getGenBool\t(int idx)\t\t{ return getBool(idx + m_beginIndex);\t}\r\n\tinline float getGenNum\t(int idx)\t\t{ return getNum(idx + m_beginIndex);\t}\r\n\tinline void  setInitPos\t(float x, float y) {\r\n\t\tm_initX = x;\r\n\t\tm_initY = y;\r\n\t}\r\n\tinline void  set_phase\t(TASK_PHASE phase = P_NORMAL) { m_phase = phase; }\r\n\tvirtual bool initUI\t\t(CLuaState& lua) = 0;\r\n\tvirtual int  commandUI\t(CLuaState& lua, int argc, int cmd);\r\n\tvirtual void execute\t(u32 deltaT) = 0;\r\n\tvirtual void dieUI\t\t() = 0;\r\n\r\n\tbool updateUIProperty();\r\n\r\n\tbool setupNode();\r\n\tbool registUI(CKLBUITask * pParent, bool result, CKLBTask * pRegParent = 0);\r\n\r\n\tenum {\r\n\t\tPRG_ALPHA,\r\n\t\tPRG_COLOR,\r\n\t\tPRG_SCALE_X,\r\n\t\tPRG_SCALE_Y,\r\n\t\tPRG_ROT,\r\n\t\tPRG_X,\r\n\t\tPRG_Y,\r\n\t\tPRG_VISIBLE,\r\n\t};\r\n\r\n\tCKLBSplineNode\t*\tm_pUINode;\r\nprivate:\r\n\tbool setGenericProperty\t();\r\n\tbool setSplineAnim\t\t(CLuaState& lua, int pos);\r\n\tint  getSplineKeyCount\t(CLuaState& lua, int pos);\r\n\tbool setSplineAnimTarget(CLuaState& lua, int pos, int spline_index, int max_key_count);\r\n\r\n\tTASK_PHASE\t\t\tm_phase;\r\n\r\n\r\n\tint\t\t\t\t\tm_beginIndex;\t// UI property start index\r\n\r\n\tfloat\t\t\t\tm_initX;\r\n\tfloat\t\t\t\tm_initY;\r\n\tu32\t\t\t\t\tm_color;\r\n\tu32\t\t\t\t\tm_alpha;\r\n\tbool\t\t\t\tm_visible;\r\n\r\n\tbool\t\t\t\tm_bInnerUpdate;\r\n\r\n\tCKLBTask\t\t*\tm_pRegParent;\r\n\r\n\tstatic const char\t*\tms_propList[];\r\n};\r\n\r\n#endif // CKLBUITask_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUITextInput.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUITextBox_h\r\n#define CKLBUITextBox_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUITextInput\r\n* \\brief Text Input Task Class\r\n* \r\n* CKLBUITextInput is a UITask managing text inputs.\r\n* In addition to providing desing and display APIs, it also provides some control ones \r\n* such as a maximum length control.\r\n*/\r\nclass CKLBUITextInput : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUITextInput>;\r\nprivate:\r\n\tCKLBUITextInput();\r\n\tvirtual ~CKLBUITextInput();\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tstatic CKLBUITextInput * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\tbool passwdmode,\r\n\t\t\t\t\t\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t\tconst char * default_text,\r\n\t\t\t\t\t\t\t\t\tconst char * on_change_callback,\r\n\t\t\t\t\t\t\t\t\tint widget_id, int maxlen, u32 chartype);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getWidth()\t\t\t\t\t{ return m_width;\t}\r\n\tinline void setWidth(u32 width)\t\t\t{\r\n\t\t// m_widthは変更なしだが、textBoxのwidthが初期値の場合があるためどちらもみるように変更  2013/03/25   //\r\n\t\tif (m_width != width || m_pTextBox->getWidth() != width) {\r\n\t\t\tm_width = width;\r\n\t\t\tm_pTextBox->setWidth(width);\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getHeight()\t\t\t\t\t{ return m_height;\t}\r\n\tinline void setHeight(u32 height)\t\t{\r\n\t\t// m_heightは変更なしだが、textBoxのheightが初期値の場合があるためどちらもみるように変更  2013/03/25   //\r\n\t\tif (m_height != height || m_pTextBox->getHeight() != height) {\r\n\t\t\tm_height = height;\r\n\t\t\tm_pTextBox->setHeight(height);\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getText()\t\t\t        { return m_pTextBox->getText();\t\t}\r\n\tinline void         setText(const char* text)\t{\r\n\t\tsetStrC(m_text, text);\r\n\t\tm_pTextBox->setText(text);\r\n\t}\r\n\r\n\tinline void setPlaceHolder(const char * placeholder) { m_pTextBox->setPlaceHolder(placeholder); }\r\n\r\n\tinline int\tgetMaxLen()\t\t\t\t\t{ return m_pTextBox->getMaxlen();\t}\r\n\tinline void setMaxLen(int maxLen)\t\t{ m_pTextBox->setMaxlen(maxLen);\t}\r\n\r\n\tinline void setCharType(u32 charType)\t{ m_pTextBox->setCharType((IWidget::TEXTCHARTYPE)charType); }\r\n\r\n\tinline s32\tgetCharCount()\t\t\t\t{ return CKLBUtility::charCountUtf8(m_pTextBox->getText()); }\r\n\r\n\tinline void setColor(bool bTouch, u32 fg_rgb, u32 bg_rgb) {\r\n\t\tfg_rgb |= 0xff000000;\r\n        bg_rgb |= 0xff000000;\r\n\t\tm_pTextBox->setColor(bTouch, fg_rgb, bg_rgb);\r\n\t}\r\n\r\n\tinline void setFont(const char* fontName, float fontSize) { m_pTextBox->setFont(fontName, fontSize); }\r\n    \r\n    inline void setAlign(int _alignType) { if(!m_pTextBox) return; m_pTextBox->setAlign((IWidget::TEXTALIGNMENTTYPE)_alignType); }\r\n\r\nprivate:\r\n\tbool init(  CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tbool passwdmode,\r\n\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\tconst char * default_text,\r\n\t\t\t\tconst char * on_change_callback,\r\n\t\t\t\tint widget_id, int maxlen, u32 chartype);\r\n\r\n\tbool initCore(\tbool passwdmode,\r\n\t\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\t\tconst char * default_text,\r\n\t\t\t\t\tconst char * on_change_callback,\r\n\t\t\t\t\tint widget_id, int maxlen, u32 chartype);\r\n\r\n\tconst char*\t\t\tm_text;\r\n\tCKLBUITextBox\t*\tm_pTextBox;\r\n\tconst char\t\t*\tm_callback;\r\n\tu32\t\t\t\t\tm_width;\r\n\tu32\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\tm_ID;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUITextBox_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUITouchPad.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUITouchPad_h\r\n#define CKLBUITouchPad_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBFormGroup.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\n/*!\r\n* \\class CKLBUITouchPad\r\n* \\brief UI Touch Pad Task class.\r\n* \r\n* CKLBUITouchPad is a simple low level Touch Pad Events handler.\r\n* It provides a few callbacks that are called when some actions are processed\r\n* (Only Tap, Drag and Release).\r\n* For a higher level Touch Pad Events handling, see UIControl.\r\n*/\r\nclass CKLBUITouchPad : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUITouchPad>;\r\nprotected:\r\n\tCKLBUITouchPad();\r\n\tvirtual ~CKLBUITouchPad();\r\n\r\npublic:\r\n\tstatic CKLBUITouchPad* create(CKLBTask* pParentTask, const char * funcName, bool modal);\r\n\tbool init(CKLBTask* pTask, const char* funcName, bool modal);\r\n\r\n\tbool    initScript      (CLuaState& lua);\r\n\tint     commandScript   (CLuaState& lua);\r\n\r\n\tinline bool setGroup    (const char* group_name) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\treturn fGrp.addForm(&m_ctrlList, group_name);\r\n\t}\r\n\r\n\tinline void lock        (bool lock_mode) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\tfGrp.setWorking(&m_ctrlList, lock_mode, this);\t// locker を指定することで、自分がかけたlockは無視できる\r\n\t}\r\n\r\n\tinline void setGetAll   (bool b) { m_bAll = b; }\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n    u32 getClassID();\r\n\r\nprivate:\r\n\tconst char *        m_luaFunc;\r\n\r\n\t// グループ化用\r\n\tSFormCtrlList\t\tm_ctrlList;\r\n\tCKLBModalStack\t\tm_modalStack;\r\n\r\n\tbool\t\t\t\tm_modal;\r\n\tbool\t\t\t\tm_bAll;\r\n\r\n\tint m_execount;\r\n};\r\n\r\n#endif // CKLBUITouchPad_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIVariableItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIVariableItem_h\r\n#define CKLBUIVariableItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIVariableItem\r\n* \\brief Variable Item Task Class\r\n* \r\n* CKLBUIVariableItem is nearly similar to CKLBUISimpleItem.\r\n* However, it is possible to modify the UV on the texture \r\n* or to change the asset associated to an instance of CKLBUIVariableItem.\r\n* It also support multitexturing using the second texture as a mask (multiply)\r\n*/\r\nclass CKLBUIVariableItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIVariableItem>;\r\nprivate:\r\n\tCKLBUIVariableItem();\r\n\tvirtual ~CKLBUIVariableItem();\r\n\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tstatic CKLBUIVariableItem * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\t   u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t\t   const char * asset);\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t  u32 order, float x, float y, float width, float height, const char * asset);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getOrder() { return m_order; }\r\n\tinline void setOrder(u32 order) { \r\n\t\tif(m_order != order) {\r\n\t\t\tm_order = order;\r\n\t\t\tm_pDynSprite->changeOrder(CKLBRenderingManager::getInstance(), m_order);\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getAsset() { return m_asset; }\r\n\r\n\tinline float getWidth() { return m_width; }\r\n\tinline void  setWidth(float width) {\r\n\t\tif(m_width != width) {\r\n\t\t\tm_width = width;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getHeight() { return m_height; }\r\n\tinline void  setHeight(float height) {\r\n\t\tif(m_height != height) {\r\n\t\t\tm_height = height; \r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tvoid changeUV(float x, float y, float width, float height);\r\n\r\n\tinline bool changeAsset(const char* asset) {\r\n\t\tbool bResult = setAsset(asset);\r\n\t\tm_pNode->markUpMatrix();\r\n\t\treturn bResult;\r\n\t}\r\n\r\n\tbool setMaskAsset(const char* asset);\r\n\r\nprivate:\r\n\tbool initCore(u32 order, float x, float y, float width, float height, const char * asset);\r\n\r\n\tvoid createArrVert(float width, float height);\r\n\t\r\n\tvoid getUV      (CKLBImageAsset * pTex);\t\t// テクスチャからUV値を取り込んでおく\r\n\tvoid getSize    (CKLBImageAsset * pTex);\t    // テクスチャからオリジナルサイズを取得する。\r\n\tbool setAsset   (const char * asset);\r\nprivate:\r\n\tCKLBImageAsset\t*\tm_pTex;\r\n\tu32\t\t\t\t\tm_handle;\r\n\tCKLBImageAsset\t*\tm_pMaskTex;\r\n\tu32\t\t\t\t\tm_Maskhandle;\r\n\r\n\tconst char\t\t*\tm_asset;\r\n\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\r\n\tfloat\t\t\t\tm_width;\r\n\tfloat\t\t\t\tm_height;\r\n\r\n\tfloat\t\t\t\tm_arrUV_intern[8];\r\n\tfloat\t\t\t\tm_arrOriginalUV_intern[8];\r\n\tfloat\t\t\t\tm_arrVert_intern[8];\r\n\r\n\t// 元画像のサイズ\r\n\tfloat\t\t\t\tm_org_width;\r\n\tfloat\t\t\t\tm_org_height;\r\n\r\n\tu32\t\t\t\t\tm_order;\r\n\tu32\t\t\t\t\tm_vCount;\r\n\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\r\n\t// プロパティのインデックス\r\n};\r\n\r\n\r\n#endif // CKLBUIVariableItem_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIVirtualDoc.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIVirtualDoc_h\r\n#define CKLBUIVirtualDoc_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\n/*!\r\n* \\class CKLBUIVirtualDoc\r\n* \\brief Virtual Document Task Class\r\n* \r\n* CKLBUIVirtualDoc creates and allows to manage a Virtual Document.\r\n* A Virtual Document allows to manage the rendering of an area of the screen.\r\n* Several items can be associated to it, such as text, lines or images.\r\n*/\r\nclass CKLBUIVirtualDoc : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIVirtualDoc>;\r\nprivate:\r\n\tCKLBUIVirtualDoc();\r\n\tvirtual ~CKLBUIVirtualDoc();\r\npublic:\r\n\tstatic CKLBUIVirtualDoc * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\t u32 order, float x, float y,\r\n\t\t\t\t\t\t\t\t\t u32 doc_width, u32 doc_height, \r\n\t\t\t\t\t\t\t\t\t u32 view_width, u32 view_height,\r\n\t\t\t\t\t\t\t\t\t u32 max_command_nums, bool vertical,\r\n\t\t\t\t\t\t\t\t\t const char * callback = NULL);\r\n\tbool initUI     (CLuaState& lua);\r\n\tu32  getClassID ();\r\n\tint  commandUI  (CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tvoid checkDocumentSize();\r\n\r\n\tinline void clear(u32 color) \r\n\t{ m_pDocNode->clear(color); }\r\n\r\n\tinline void setFont(u32 idx, const char* fontName, u32 fontSize) \r\n\t{ m_pDocNode->setFont(idx, fontName, fontSize); }\r\n\r\n\tinline void setViewPortPos(s32 x, s32 y) \r\n\t{ m_viewPosX = x; m_viewPosY = y; m_pDocNode->setViewPortPos(x, y); }\r\n\r\n\tinline void drawLine(s32 x0, s32 y0, s32 x1, s32 y1, u32 color)\r\n\t{ m_pDocNode->drawLine(x0, y0, x1, y1, color); }\r\n\r\n\tinline void drawImage(s32 x0, s32 y0, const char* image, u32 alpha) \r\n\t{\tCKLBImageAsset * pImage = loadImage(image);\r\n\t\tm_pDocNode->drawImage(x0, y0, pImage, alpha);\t}\r\n\r\n\tinline void fillRect(s32 x0, s32 y0, u32 width, u32 height, u32 color, bool fill)\r\n\t{\tm_pDocNode->fillRect(x0, y0, width, height, color,fill); }\r\n\r\n\tinline void drawText(s32 x0, s32 y0, const char* str, u32 color, u32 fontidx)\r\n\t{\tm_pDocNode->drawText(x0, y0, str, color, fontidx, (u8)m_align, (s16)m_align_width); REFRESH_B; }\r\n\r\n\tinline void startDocument()\t\t\t{ m_pDocNode->emptyDocument(); m_pDocNode->lockDocument();\t}\r\n\tinline void endDocument  ()\t\t\t{ m_pDocNode->unlockDocument();\t}\r\n\r\n\tinline u32  getCommandMax()\t\t\t{ return m_commandMax; }\r\n\tinline void setCommandMax(u32 command) {\r\n\t\tif (command != m_commandMax) {\r\n\t\t\tm_commandMax = command;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getDocHeight()\t\t\t{ return m_height; }\r\n\tinline void setDocHeight(u32 height) {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_height = height;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getDocWidth()\t\t\t{ return m_width;\t}\r\n\tinline void setDocWidth(u32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_width = width;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getVertical()\t\t\t{ return m_vertical; }\r\n\tinline void setVertical(bool vertical) {\r\n\t\tif (vertical != m_vertical) {\r\n\t\t\tm_vertical = vertical;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32  getViewHeight()\t\t\t\t{ return m_viewHeight; }\r\n\tinline void setViewHeight(s32 height)\t{\r\n\t\tif (height != m_viewHeight) {\r\n\t\t\tm_viewHeight = height;\r\n\t\t\tREFRESH_C;\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32  getViewWidth()\t\t\t{ return m_viewWidth; }\r\n\tinline void setViewWidth(s32 width) {\r\n\t\tif (width != m_viewWidth) {\r\n\t\t\tm_viewWidth = width;\r\n\t\t\tREFRESH_C;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetOrder\t()\t\t\t{\treturn m_order; }\r\n\tinline void setOrder\t(u32 order)\t{\r\n\t\tif (m_order != order) {\r\n\t\t\tm_order = order;\r\n\t\t\tm_pDocNode->setPriority(order);\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getCallBack()\t\t\t\t        { return m_callBack;\t\t\t}\r\n\tinline void         setCallBack(const char* callBack)\t{ REFRESH_E; setStrC(m_callBack, callBack);}\r\n\r\n\tinline void         setAlign(u8 align, int alignWidth)  { m_align = align; m_align_width = alignWidth; }\r\n\r\nprivate:\r\n\tvoid forceRefresh();\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 order, float x, float y,\r\n\t\t\t\tu32 doc_width, u32 doc_height, \r\n\t\t\t\tu32 view_width, u32 view_height,\r\n\t\t\t\tu32 max_command_nums, bool vertical, const char * callback);\r\n\r\n\tbool initCore(\r\n\t\t\t\tu32 order, float x, float y,\r\n\t\t\t\tu32 doc_width, u32 doc_height, \r\n\t\t\t\tu32 view_width, u32 view_height,\r\n\t\t\t\tu32 max_command_nums, bool vertical, const char * callback);\r\n\r\n\tCKLBImageAsset * loadImage(const char * image);\r\n\tvoid destroyImages();\r\n\tvoid touchPadEvent();\r\n\r\n\tu32\t\t    m_order;\r\n\tu32\t\t    m_commandMax;\r\n\tu32\t\t    m_height;\r\n\tu32\t\t    m_width;\r\n\tu32\t\t    m_viewWidth;\r\n\tu32\t\t    m_viewHeight;\r\n\tu32\t\t    m_counter;\r\n\tconst char*\tm_callBack;\r\n\ts32         m_viewPosX;\r\n\ts32         m_viewPosY;\r\n\tu8\t\t\tm_format;\r\n\r\n\tbool\t    m_vertical;\r\n\tbool\t    m_forceRefreshMode;\r\n\r\n\tstruct VDIMG {\r\n\r\n\t\tVDIMG\t\t\t*\tprev;\r\n\t\tVDIMG\t\t\t*\tnext;\r\n\r\n\t\tCKLBImageAsset\t*\tpImage;\r\n\t\tu32\t\t\t\t\thandle;\r\n\t};\r\n\tVDIMG\t\t\t\t\t*\tm_imgBegin;\r\n\tVDIMG\t\t\t\t\t*\tm_imgEnd;\r\n\r\n\tint\t\t\t\t\t\t\tm_dragID;\r\n\tint\t\t\t\t\t\t\tm_dragX;\r\n\tint\t\t\t\t\t\t\tm_dragY;\r\n\r\n\tu8\t\t\t\t\t\t\tm_align;\r\n\tint\t\t\t\t\t\t\tm_align_width;\r\n\r\n\tCKLBNodeVirtualDocument\t*\tm_pDocNode;\r\n\tCKLBModalStack\t\t\t\tm_modalStack;\t// モーダルスタックパッケージ\r\n\r\n\tstatic PROP_V2\t\t\t\tms_propItems[];\r\n\r\n};\r\n\r\n\r\n#endif // CKLBUIVirtualDoc_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUIWebArea.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIWebArea_h\r\n#define CKLBUIWebArea_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBWebViewNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIWebArea\r\n* \\brief Web Area Task Class\r\n* \r\n* CKLBUIWebArea is used to create a web viewer area.\r\n*/\r\nclass CKLBUIWebArea : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIWebArea>;\r\nprivate:\r\n\tCKLBUIWebArea();\r\n\tvirtual ~CKLBUIWebArea();\r\npublic:\r\n\tstatic CKLBUIWebArea * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\tbool mode, float x, float y,\r\n\t\t\t\t\t\t\t\t\tfloat width, float height,\r\n\t\t\t\t\t\t\t\t\tconst char * url, const char * callback);\r\n\r\n\tu32 getClassID  ();\r\n\tbool initUI     (CLuaState& lua);\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline s32  getWidth()          { return m_width; }\r\n\tinline void setWidth(s32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_width = width;\r\n\t\t\tm_pWebView->setWidth(width);\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32  getHeight()             { return m_height; }\r\n\tinline void setHeight(s32 height)   {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_height = height;\r\n\t\t\tm_pWebView->setHeight(height);\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getText()                   {\treturn m_text; }\r\n\tinline void         setText(const char* text)   {\r\n\t\tsetStrC(m_text, text);\r\n\t\tm_pWebView->setText(text);\r\n\t}\r\n\t\r\n\tinline void setScalesPageToFit(bool b)\t\t\t{ m_pWebView->setScalesPageToFit(b);\t}\r\n\r\n\tinline void setBgColor(u32 alpha, u32 color)\t{ m_pWebView->setBgColor(alpha, color); }\r\n\r\nprivate:\r\n\tconst char*\tm_text;\r\n\ts32\t\t\tm_width;\r\n\ts32\t\t\tm_height;\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t  bool mode, float x, float y,\r\n\t\t\t  float width, float height,\r\n\t\t\t  const char * url, const char * callback);\r\n\r\n\tbool initCore(\r\n\t\t\t\tbool mode, float x, float y,\r\n\t\t\t\tfloat width, float height,\r\n\t\t\t\tconst char * url, const char * callback);\r\n\r\n\tCKLBUIWebView\t*\tm_pWebView;\r\n\r\n    const char      *   m_cmdCallback;\r\n    \r\n\tstatic PROP_V2      ms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIWebArea_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUpdate.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUpdate_h\r\n#define CKLBUpdate_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBHTTPInterface.h\"\r\n#include \"CUnZip.h\"\r\n#include \"ILuaFuncLib.h\"\r\n#include \"MultithreadedNetwork.h\"\r\n\r\n/*!\r\n* \\class CKLBLuaLibUPDATE\r\n* \\brief Lua Lib Update Class\r\n* \r\n* \r\n*/\r\nclass CKLBLuaLibUPDATE : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibUPDATE();\r\npublic:\r\n\tCKLBLuaLibUPDATE(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibUPDATE();\r\n\r\n\tvoid addLibrary();\r\nprivate:\r\n\tstatic int luaUpdateHasLock\t\t(lua_State * L);\r\n\tstatic int luaUpdateKillLock\t(lua_State * L);\r\n};\r\n\r\nclass CUpdateUnZip : public CUnZip\r\n{\r\nprotected:\r\n\tbool afterExtract(const char * extract_path, bool isDirectory, size_t size);\r\npublic:\r\n\tCUpdateUnZip(const char * zipPath);\r\n\tvirtual ~CUpdateUnZip();\r\n};\r\n\r\n/*!\r\n* \\class CKLBUpdate\r\n* \\brief Updater Task class.\r\n* \r\n* CKLBUpdate is used to update files.\r\n* It downloads it from a specified URL and unzips it.\r\n* Specific callbacks can be registered to be called after different steps\r\n* such as the end of the dowload step, the unzipping step or when the whole \r\n* process is over.\r\n*/\r\nclass CKLBUpdate : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUpdate>;\r\nprotected:\r\n\tCKLBUpdate();\r\n\tvirtual ~CKLBUpdate();\r\npublic:\r\n\tvirtual u32  getClassID\t();\r\n\tvirtual bool initScript\t(CLuaState& lua);\r\n\r\n\tvoid execute\t\t\t(u32 deltaT);\r\n\tvoid die\t\t\t\t();\r\n\r\n\tstatic bool lockExist\t();\r\nprotected:\r\n\tvoid exec_init_download\t(u32 deltaT);\r\n\tvoid exec_download\t\t(u32 deltaT);\r\n\tvoid exec_init_unzip\t(u32 deltaT);\r\n\tvoid exec_unzip\t\t\t(u32 deltaT);\r\n\tvoid exec_complete\t\t(u32 deltaT);\r\n\tvoid exec_finish\t\t(u32 deltaT);\r\n\r\n\tbool isUpdating\t\t\t();\r\n\tvoid cleanUpdate\t\t(const char* tmpFile);\r\n\tbool saveUpdate\t\t\t();\r\n\r\n\t\t   s32\t\t\t\t\tworkThread\t\t\t();\r\n\tstatic s32\t\t\t\t\tthreadFunc\t\t\t(void* pThread, void* data);\r\n\r\nprotected:\r\n\tCKLBHTTPInterface\t*\tm_httpIF;\r\n\tCUpdateUnZip\t\t*\tm_unzip;\r\n\r\n\tenum STEP {\r\n\t\tS_INIT_DL,\t\t// ダウンロード初期化\r\n\t\tS_DOWNLOAD,\t\t// ダウンロード中\r\n\t\tS_INIT_UNZIP,\t// ZIP展開初期化\r\n\t\tS_UNZIP,\t\t// ZIP展開中\r\n\t\tS_COMPLETE,\t\t// Ensure that zip is fully unzipped\r\n\t\tS_FINISHED,\t\t// 完了\r\n\t};\r\n\r\n\tconst char\t\t\t*\tm_callbackDL;\r\n\tconst char\t\t\t*\tm_callbackZIP;\r\n\tconst char\t\t\t*\tm_callbackFinish;\r\n\tconst char\t\t\t*\tm_callbackError;\r\n\t\r\n\tvoid*\t\t\t\t\tm_thread;\r\n\tconst char\t\t\t*\tm_outPath;\r\n\tconst char\t\t\t*\tm_tmpPath;\r\n\tconst char\t\t\t*\tm_zipURL;\r\n\ts64\t\t\t\t\t\tm_zipSize;\r\n\tfloat\t\t\t\t\tm_maxProgress;\r\n\r\n\tvolatile\r\n\tSTEP\t\t\t\t\tm_eStep;\t\t// 進行ステップ\r\n\tbool\t\t\t\t\tm_extracting;\t// 展開中\r\n\r\n\ts64\t\t\t\t\t\tm_dlSize;\t// ダウンロード終了サイズ\r\n\tint\t\t\t\t\t\tm_zipEntry;\t// zip内のエントリ数\r\n};\r\n\r\n/*!\r\n* \\class CKLBUpdateZip\r\n* \\brief Updater through Zip Task class.\r\n* \r\n* CKLBUpdateZip works the same way as CKLBUpdate but only unzips a file already downloaded.\r\n*/\r\nclass CKLBUpdateZip : public CKLBUpdate\r\n{\r\npublic:\r\n\tCKLBUpdateZip();\r\n\tvirtual ~CKLBUpdateZip();\r\n\r\npublic:\r\n\tvirtual u32  getClassID();\r\n\tvirtual bool initScript(CLuaState& lua);\r\n};\r\n\r\n#endif // CKLBUpdate_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBUtility.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUtility_h\r\n#define CKLBUtility_h\r\n\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBJsonItem.h\"\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\t#define INTERNAL_BENCH\r\n#endif\r\n\r\n#ifdef INTERNAL_BENCH\r\n\tvoid logDo\t\t\t();\r\n\tvoid logTime\t\t(char type, s64 time, u32 classID);\r\n\tvoid logTimeDump\t();\r\n\tvoid logStartTime\t();\r\n\tvoid logEndTime\t\t(char type, const char* name);\r\n#else\r\n\t#define logStartTime()\t\t;\r\n\t#define logEndTime(a,b)\t\t;\r\n#endif\r\n\r\nclass CKLBUtility\r\n{\r\npublic:\r\n\r\n\t/* Return the closest upper 2^n value */\r\n\tstatic u32 nearest2Pow(u32 v);\r\n\r\n\tstatic char * URLencode(char * retbuf, int maxlen, const char ** postForm);\r\n\r\n\t// 指定されたCKLBNodeが、直前のフレームで描画された画面座標(絶対位置)を取得する\r\n\tstatic void getNodePosition\t\t(CKLBNode * pNode, float * x, float * y);\r\n\r\n\t// Get Inverse matrix from node.\r\n\tstatic void getNodeInverseMatrix(CKLBNode * pNode, SMatrix2D& result);\r\n\r\n\t// Compute transform.\r\n\tstatic void transform(SMatrix2D* pMatrix, float x, float y, float& resx, float& resy);\r\n\r\n\t// Allow to use NULL.\r\n\tstatic int safe_strcmp(const char* a, const char* b);\r\n\r\n\t// 文字列をコピーする:メモリトラッキング対応。取得した文字列は KLBDELETEA() で破棄\r\n\tstatic const char * copyString(const char * string);\r\n\r\n\t// Allocate and copy a memory block.\r\n\tstatic const char * copyMem(const char* buff, u32 size);\r\n\r\n\t// 64bit整数を数列文字列に変換する(printf系が対応していない環境が存在することを想定)\r\n\tstatic char * numString64(char * buf, u64 value);\r\n\r\n\t// 数列文字列を s64 に変換する\r\n\tstatic s64 stringNum64(const char * buf);\r\n\r\n\t// Return the number of character inside a UTF8 string.\r\n\tstatic s32 charCountUtf8(const char *string);\r\n\r\n\t// 指定された文字列がnullであれば\"null\"という文字列を、そうでなければ\"\"で囲んだ形の文字列を返す\r\n\tstatic char * quoated(const char * string);\r\n\r\n\t// 文字列を指定文字で分割し、文字列の配列として返す。各文字列と、全体の配列はKLBDELETEA()で破棄\r\n\tstatic const char ** splitString(const char * string, int delim);\r\n\r\n\t// splitString() で得られた分割文字列配列を破棄する。\r\n\tstatic void deleteSplitString(const char ** split_arr);\r\n\r\n\t// asset をメモリバッファ上からロードし、ハンドル登録も行う。loadAssetと異なり一段しか読まない(imagなどには使えない)\r\n\tstatic CKLBAsset * readAsset(u8 * stream, u32 streamSize,u32 * handle, IKLBAssetPlugin * plugIn = NULL);\r\n\r\n\t// asset のロード(ハンドル登録も行う)\r\n\tstatic CKLBAsset * loadAsset(const char * asset, u32 * handle, IKLBAssetPlugin* plugIn = NULL, bool bSimple = false);\r\n\r\n\t// loadAsset に失敗したらScriptのレベルでエラーを出す\r\n\tstatic CKLBAsset * loadAssetScript(const char * asset, u32 * handle, IKLBAssetPlugin* plugIn = NULL, bool bSimple = false);\r\n\r\n\t// asset をロードし、ノードを生成する(同時にハンドル登録も行う)\r\n\tstatic CKLBNode * createNode(const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn = NULL);\r\n\r\n\t// createNode() に失敗したらScriptのレベルでエラーを出す\r\n\tstatic CKLBNode * createNodeScript(const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn = NULL);\r\n\r\n\t// Composite asset が親タスクのポインタを必要とするので、Composite専用\r\n\tstatic CKLBNode * createCompositeNodeScript(CKLBUITask * pTask, const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn = NULL);\r\n\r\n\t// createNode()で得られたノードとハンドルを破棄する\r\n\tstatic void deleteNode(CKLBNode * pNode, u32 handle);\r\n\r\n\tstruct JSON_REPLACE {\r\n\t\tconst char * key;\r\n\t\tconst char * value;\r\n\t};\r\n\r\n\t// Luaのスタックに積まれたテーブルをJSON文字列に変換する\r\n\tstatic const char * lua2json(CLuaState& lua, u32& streamSize, JSON_REPLACE * arrReplace = NULL);\r\n\r\n\t// Luaのスタックに積まれたテーブルをBJSONに変換する\r\n\tstatic const char * lua2BJson(CLuaState& lua, u32& streamSize, JSON_REPLACE * arrReplace = NULL);\r\n\r\n\t// JSON文字列をLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void json2lua(CLuaState& lua, const char * json, u32 json_size = 0);\r\n\r\n\t// CKLBJsonItem のツリーをLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void jsonItem2lua(CLuaState& lua, CKLBJsonItem * pRoot);\r\n\r\n\t// SQLite\r\nprivate:\r\n\r\n\t// Utility用定数\r\n\tenum {\r\n\t\tJSON_BLOCK_SIZE = 64,\r\n\t\tJSON_POOL_SIZE = 100\r\n\t};\r\n\r\n\tstruct CPENTRY {\r\n\t\tconst char* string;\r\n\t\tint\t\t\tsize;\r\n\t};\r\n\r\n\tstruct JSON_BUF {\r\n\t\tchar\t*\tbuf;\t// 生成先バッファのポインタ\r\n\t\tint\t\t\tmax;\t// 生成先バッファの現在のサイズ\r\n\t\tint\t\t\tidx;\t// 生成先バッファの成長点index\r\n\r\n\t\tbool add\t(const char * msg);\r\n\t\tbool addU8\t(u8 value);\r\n\t\tbool addPool(const char* str,int& index);\r\n\t\tbool addU32\t(u32 value);\r\n\r\n\t\tJSON_REPLACE * arr_replace;\r\n\t\tCPENTRY\tpoolEntries[JSON_POOL_SIZE];\r\n\t\tu32\t\tpoolCount;\r\n\t\tu32\t\tpoolSize;\r\n\t};\r\n\tstatic bool lua2json_rec\t(CLuaState& lua, JSON_BUF * jsonBuf);\r\n\tstatic bool lua2BJson_rec\t(CLuaState& lua, JSON_BUF * jsonBuf);\r\n\r\n\tstatic void json2lua_rec\t(CLuaState& lua, CKLBJsonItem * pItem);\r\n\tstatic const char * escape\t(const char * string);\r\n};\r\n\r\n#endif // CKLBUtility_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CKLBWebViewNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_UIWEBVIEW__\r\n#define __CKLB_UIWEBVIEW__\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBUIWebView\r\n* \\brief UI Web View Specialized Node Class\r\n* \r\n* CKLBUIWebView provides methods to manage a Web Viewer.\r\n*/\r\nclass CKLBUIWebView : public CKLBUIElement {\r\npublic:\r\n\tCKLBUIWebView(bool isPageJump, const char * initialURL = NULL,\r\n                  const char * token = NULL, const char * region = NULL, const char * client = NULL,\r\n                  const char * consumerKey = NULL, const char * applicationID = NULL, const char * userID = NULL);\r\n\t~CKLBUIWebView();\r\n\r\n\t// KLBObject::\r\n\tvirtual u32\tgetClassID\t    ()\t\t\t\t\t{ return CLS_KLBWEBVIEW; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\tvoid recomputeCustom();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   () { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n    \r\n    void        setScalesPageToFit(bool scalesPageToFit) {\r\n        nativeInputItem->cmd(IWidget::WEB_SET_SCALESPAGETOFIT, scalesPageToFit);\r\n    }\r\n    \r\n    void        setBgColor      (u32 bgalpha, u32 bgcolor);\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n    \r\n    inline IWidget *   getWidget() const { return nativeInputItem; }\r\n\r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender\t\t();\r\n\tvirtual void removeRender\t();\r\n\r\n\tIWidget *   nativeInputItem;\r\n\tu32\t\t    m_width;\r\n\tu32\t\t    m_height;\r\n\ts32\t\t    m_tx;\r\n\ts32\t\t    m_ty;\r\n    u32         m_bgcolor;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CLuaState.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CLuaState.h\r\n//\r\n\r\n#ifndef CLuaState_h\r\n#define CLuaState_h\r\n\r\n#include \"lua.hpp\"\r\n#include \"CPFInterface.h\"\r\nclass CLuaState\r\n{\r\n\tfriend class CKLBScriptEnv;\r\n\tfriend class CKLBLuaEnv;\r\npublic:\r\n    CLuaState(lua_State * L);\r\n    virtual ~CLuaState();\r\n    \r\n    // 引数の数を取得\r\n    inline int numArgs() {\r\n        return lua_gettop(m_L);\r\n    }\r\n    \r\n    // 引数取得メソッド\r\n\tinline bool isNil\t(int pos) { return lua_isnil(m_L, pos)\t\t? true : false; }\r\n\tinline bool isNum\t(int pos) { return lua_isnumber(m_L, pos)\t? true : false; }\r\n\tinline bool isString(int pos) { return lua_isstring(m_L, pos)\t? true : false; }\r\n\tinline bool isTable\t(int pos) { return lua_istable(m_L, pos)\t? true : false; }\r\n\r\n    inline bool getBool(int pos) {\r\n        if(!lua_isboolean(m_L, pos)) {\r\n            // boolean と解釈できない\r\n            errorMsg(\"boolean\", pos);            \r\n            return false;\r\n        }\r\n        return (lua_toboolean(m_L, pos)) ? true : false;\r\n    }\r\n    inline bool getBoolean(int pos) {\r\n        if(!lua_isboolean(m_L, pos)) {\r\n            // boolean と解釈できない\r\n            errorMsg(\"boolean\", pos);            \r\n            return false;\r\n        }\r\n        return (lua_toboolean(m_L, pos)) ? true : false;\r\n    }\r\n    inline int  getInt(int pos) {\r\n        lua_Integer ret;\r\n\t\tif(!lua_isnumber(m_L, pos)) {\r\n            // 数値ではない\r\n            errorMsg(\"integer\", pos);\r\n            return 0;\r\n        }\r\n        ret = lua_tointeger(m_L, pos);\r\n        return (int)ret;\r\n    }\r\n    inline float getFloat(int pos) {\r\n        lua_Number ret;\r\n\t\tif(!lua_isnumber(m_L, pos)) {\r\n            // 数値ではない\r\n            errorMsg(\"float\", pos);\r\n            return 0.0;\r\n        }\r\n        ret = lua_tonumber(m_L, pos);\r\n        return (float)ret;\r\n    }\r\n    inline double getDouble(int pos) {\r\n        lua_Number ret;\r\n\t\tif(!lua_isnumber(m_L, pos)) {\r\n            // 数値ではない\r\n            errorMsg(\"double\", pos);\r\n            return 0.0;\r\n        }\r\n        ret = lua_tonumber(m_L, pos);\r\n        return (double)ret;\r\n    }\r\n    inline const char * getString(int pos) {\r\n        if(!lua_isstring(m_L, pos)) {\r\n            // 文字列ではない\r\n            errorMsg(\"string\", pos);\r\n            return 0;\r\n        }\r\n        const char * ret = lua_tostring(m_L, pos);\r\n        return ret;\r\n    }\r\n    inline const void * getPointer(int pos) {\r\n        if(!lua_islightuserdata(m_L, pos)) {\r\n            // ポインタとは解釈できない\r\n            errorMsg(\"internal object\", pos);\r\n            return 0;\r\n        }\r\n        const void * ret = lua_topointer(m_L, pos);\r\n        return ret;\r\n    }\r\n    inline const char * getTable(int pos) {\r\n        if(!lua_istable(m_L, pos)) {\r\n            // ポインタとは解釈できない\r\n            errorMsg(\"TABLE\", pos);\r\n            return 0;\r\n        }\r\n        const char * ret = lua_tostring(m_L, pos);\r\n        return ret;\r\n    }\r\n\r\n    // 戻り値を返すための関数\r\n    inline void retNil\t\t()\t\t\t\t\t{ lua_pushnil(m_L);\t\t\t\t\t\t\t}\r\n    inline void retBool     (bool val)\t\t\t{ lua_pushboolean(m_L, (val) ? 1 : 0);\t\t}\r\n    inline void retBoolean\t(bool val)\t\t\t{ lua_pushboolean(m_L, (val) ? 1 : 0);\t\t}\r\n    inline void retInt\t\t(int val)\t\t\t{ lua_pushinteger(m_L, (lua_Integer)val);\t}\r\n    inline void retFloat\t(float val)\t\t\t{ lua_pushnumber(m_L, (lua_Number)val);\t\t}\r\n    inline void retDouble\t(double val)\t\t{ lua_pushnumber(m_L, (lua_Number)val);\t\t}\r\n    inline void retString\t(const char * val)\t{ lua_pushstring(m_L, val);\t\t\t\t\t}\r\n    inline void retPointer\t(void * ptr)\t\t{ lua_pushlightuserdata(m_L, ptr);\t\t\t}\r\n    inline void retGlobal\t(const char * val)\t{ lua_getglobal(m_L, val);\t\t\t\t\t}\r\n\r\n\tinline void retValue\t(int pos)\t\t\t{ lua_pushvalue(m_L, pos);\t\t\t\t\t}\r\n\r\n\tinline void tableNew\t()\t\t\t\t\t{ lua_newtable(m_L);\t\t\t\t\t\t}\r\n\tinline void tableSet\t(int pos = -3)\t\t{ lua_settable(m_L, pos);\t\t\t\t\t}\r\n\tinline void tableGet\t(int pos = -2)\t\t{ lua_gettable(m_L, pos);\t\t\t\t\t}\r\n\tinline int  tableNext\t(int pos = -2)\t\t{ return lua_next(m_L, pos);\t\t\t\t}\r\n\tinline void pop\t\t\t(int num)\t\t\t{ lua_pop(m_L, num);\t\t\t\t\t\t}\r\n\tinline void setGlobal\t(const char * name) { lua_setglobal(m_L, name);\t\t\t\t\t}\r\n\tinline void getGlobal\t(const char * name) { lua_getglobal(m_L, name);\t\t\t\t\t}\r\n\tinline int  getType\t\t(int pos = -1)\t\t{ return lua_type(m_L, pos);\t\t\t\t}\r\n\r\n    // 現在実行されている行番号とファイル名を得る\r\n\tconst char * getScriptName();\r\n\r\n    inline int getNumLine() {\r\n        lua_Debug dbg;\r\n        if(lua_getstack(m_L, 1, &dbg)) {\r\n            lua_getinfo(m_L, \"Sl\", &dbg);\r\n        }\r\n        return dbg.currentline;\r\n    }\r\n\r\n\r\nprotected:\r\n    // Lua 側の関数を呼び出すメソッド\r\n    // 呼び出す際の引数の数と型を、argform で文字列として指定する。\r\n    // B:boolean / I:integer / N:number / S:string / P:lightuserdata\r\n    // 例)\r\n    //  lua.callback(\"CallBackFunc\", \"PIIBS\", pTask, 100, 200, true, \"return\");\r\n    //\r\n\tvirtual bool callback\t\t\t(const char * func, const char * argform, ...);\r\n\tvirtual bool call_luafunction\t(int retnum, const char * func, const char * argform, va_list ap);\r\n\tvirtual bool retcall\t\t\t(int retnum, const char * func, const char * argform, ...);\r\n\tvirtual bool call\t\t\t\t(int args,   const char * func, int nresults = 0);\r\nprivate:\r\n\tint error\t\t(const char * fmt, ...); // Only from CKLBScriptEnv\r\n    void errorMsg\t(const char * type_name, int argnum);\r\n    \r\n    lua_State       *   m_L;\r\n};\r\n\r\nclass CLua_Only_State : public CLuaState {\r\nprivate:\t\r\n\tCLua_Only_State(lua_State * L) : CLuaState(L) {}; // declared to avoid warnings\r\npublic:\r\n\tbool callback\t\t\t(const char * func, const char * argform, ...);\r\n\tbool call_luafunction\t(int retnum, const char * func, const char * argform, va_list ap);\r\n\tbool retcall\t\t\t(int retnum, const char * func, const char * argform, ...);\r\n\tbool call\t\t\t\t(int args,   const char * func, int nresults = 0);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CPFInterface.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n  \\brief ポーティングレイヤインタフェース CPFInterface と、使用されるインタフェースクラス IClientRequest / iPlatformRequest\r\n  \\file  CPFInterface.h\r\n\r\n  ゲームの起動から実行、ゲーム側からのプラットフォーム機能利用までを含めた、ポーティングレイヤインタフェース。\r\n  ゲームの実行シーケンスは、\r\n\r\n  -# CPFInterface::setPlatformRequest() / IPlatformRequest実装をCPFInterfaceに登録\r\n  -# GameSetup() / ゲーム側スタートアップ関数呼び出し\r\n  -# GameSetup()内: CPFInterface::setClientRequest() / IClientRequest実装をCPFInterfaceに登録\r\n  .\r\n  -# CPFInterface::client().setScreenInfo() / 画面サイズをゲームに通知\r\n  -# CPFInterface::client().setFilePath() / データアクセスパスをゲームに通知\r\n  -# CPFInterface::client().initGame() / ゲーム初期化処理の呼び出し\r\n  .\r\n  となり、プラットフォーム側の実装はこの呼び出し順が保証されなければならない。\r\n  また、ゲーム側もこの順で実行されることを前提として実装される必要がある。\r\n\r\n  以上の起動シーケンスが終了した後, CPFInterFace::client().frameFlip() が毎フレームが呼び出される。\r\n  */\r\n#ifndef CPFInterface_h\r\n#define CPFInterface_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n#include \"OSWidget.h\"\r\n#include \"ITmpFile.h\"\r\n\r\n\r\ntypedef struct {\r\n\tfloat   width;\r\n\tfloat   height;\r\n\tfloat   ascent;\r\n\tfloat   descent;\r\n\tfloat   top;\r\n\tfloat   bottom;\r\n} STextInfo;\r\n\r\n\r\n//! ゲーム側設定関数\r\n/*\r\n   \\return ゲーム側設定の成否\r\n\r\n   C++関数。ゲームタイトル側で実装されるべき起動初期化関数。\r\n   ポーティング層は、CPFInterface のメソッドを呼び出すのに先駆け、必ずこの関数を呼ぶこと。\r\n\r\n   ゲーム(マルチプラットフォーム側)では、実装したIClientRequest派生クラスをこの関数の中で CPFInterface に登録する。\r\n   */\r\nbool GameSetup(void);\r\n\r\n//! ゲーム側インタフェースクラス\r\n/*!\r\n  プラットフォーム側から呼び出される処理をゲーム側で実装するためのインタフェース。\r\n  ゲーム(マルチプラットフォーム側)で内容を実装。\r\n  プラットフォーム側は、\r\n\r\n  -# setScreenInfo()\r\n  -# setFilePath()\r\n  -# initGame()\r\n\r\n  の順で呼び出してゲームの初期化を行い、毎フレーム frameFlip()を呼び出してゲームの実行を行うように実装される。\r\n  */\r\nclass IClientRequest\r\n{\r\npublic:\r\n\tstatic const int\tENGINE_USE_DEFAULTDB\t= 0x1;\r\n\tstatic const int\tENGINE_USE_DEFAULTFONT\t= 0x2;\r\n\r\n\tenum INPUT_TYPE {\r\n\t\tI_CLICK,    //!< マウスのクリック、タッチパネルのタップ動作\r\n\t\tI_DRAG,     //!< ドラッグ動作\r\n\t\tI_RELEASE,  //!< リリース動作(離す)\r\n\t\tI_CANCEL\t//!< Cancel event\r\n\t};\r\n\r\n\tenum EVENT_TYPE {\r\n\t\tE_PAUSE,\t\t// プロセスがポーズ状態になった\r\n\t\tE_RESUME,\t\t// プロセスがレジュームされた\r\n\t\tE_TEXTCHANGE,   // TextBox の文字列が変更された\r\n\t\tE_URLJUMP,      // Webのコマンドリンクが指定された\r\n\r\n\t\tE_DIDSTARTLOADWEB,  // Webのロードが開始された\r\n\t\tE_DIDLOADENDWEB,\t// Webのロードが終了した\r\n\t\tE_FAILEDLOADWEB,    // Webのロードが失敗した\r\n\r\n\t\tE_STORE_BAD_ITEMID,         // アイテムIDが無効\r\n\t\tE_STORE_PURCHASHING,        // 購入処理中\r\n\t\tE_STORE_PURCHASHED,         // 購入処理終了\r\n\t\tE_STORE_FAILED,             // 購入処理失敗\r\n\r\n\t\tE_STORE_RESTORE,            // リストア終了\r\n\t\tE_STORE_RESTORE_FAILED,     // リストア失敗\r\n\t\tE_STORE_RESTORE_COMPLETED,  // 全リストア終了\r\n\r\n\t\tE_STORE_GET_PRODUCTS, // ProductListの取得.\r\n\r\n\t\t// サウンドステータス\r\n\t\tE_SOUND_STATE_PLAY,             // サウンド再生中\r\n\t\tE_SOUND_STATE_STOP,             // サウンド停止中\r\n\t\tE_SOUND_STATE_PAUSE,            // サウンド一時停止中\r\n\t\tE_SOUND_STATE_INVALID_HANDLE,   // サウンドハンドル無効\r\n\r\n\t\t// サウンドのミュージックとの並行処理タイプlua定数\r\n\t\tE_SOUND_MULTIPROCESS_MUSIC_CUT,     // ゲームサウンドが再生される際に、iPodミュージックを停止\r\n\t\tE_SOUND_MULTIPROCESS_SOUND_CUT,     // iPodミュージックが再生されている際に、ゲーム中のサウンドを全カット\r\n\t\tE_SOUND_MULTIPROCESS_SOUND_BGM_CUT, // iPodミュージックが再生されている際に、ゲーム中のBGMサウンドを全カット\r\n\t};\r\n\r\n\tstatic const u32 KEY_BACK = 0x00000001;\r\n\tstatic const u32 KEY_MENU = 0x00000002;\r\n\r\n\tstatic const char KEYEVENT_PRESS = 0x01;\r\n\tstatic const char KEYEVENT_RELEASE = 0x02;\r\n\tstatic const char KEYEVENT_CLICK = 0x03;\r\n\tIClientRequest();\r\n\tvirtual ~IClientRequest();\r\n\r\n\t\r\n\t//! ゲーム初期化処理\r\n\t/*!\r\n\t\tSend parameters from OS launch application to engine.\r\n\t\tWe keep the design generic as option and parameters could vary based\r\n\t\ton version of the engine.\r\n\t  */\r\n\tvirtual void setInitParam(u32 param, void* complexSetup) = 0;\r\n\r\n\t//! ゲーム初期化処理\r\n\t/*!\r\n\t  ゲームの初期化処理を記述。\r\n\t  描画やスクリプトエンジンのようなシステムタスクの起動や、各種初期値の指定など、ゲームの初期化を行う。\r\n\t  */\r\n\tvirtual bool initGame() = 0;\r\n\r\n\t//! ゲーム終了処理\r\n\t/*!\r\n\t  ゲーム起動中に確保されたリソースをすべて破棄する。\r\n\t  アプリケーション終了のタイミングでプラットフォーム側から呼び出される。\r\n\t  */\r\n\tvirtual void finishGame() = 0;\r\n\r\n\t//! 画面情報通知\r\n\t/*!\r\n\t  \\param orientationFlip   横(False)・立て(True)画面\r\n\t  \\param width             水平方向の解像度\r\n\t  \\param height            垂直方向の解像度\r\n\r\n\t  プラットフォーム側から、使用可能な画面解像度についての情報が通知される際に呼び出される。\r\n\t  通知された情報はシステム側で保持する必要がある。\r\n\t  */\r\n\tvirtual bool setScreenInfo(bool orientationFlip, int width, int height) = 0;\r\n\r\n\t//! データアクセスパス\r\n\t/*!\r\n\t  \\param pStr  パス文字列\r\n\r\n\t  ゲームが利用するデータのアクセスに必要なパス文字列が渡される。\r\n\t  プラットフォームによって該当する文字列データが無い場合、動作に影響を与えない文字列が渡される。\r\n\t  */\r\n\tvirtual bool setFilePath(const char * pStr) = 0;\r\n\r\n\t//! フレーム更新\r\n\t/*!\r\n\t  \\param　dTime  直前のフレームからの経過時間(単位 [ms])\r\n\r\n\t  毎フレームの更新タイミングで呼び出される。\r\n\t  この中でフレーム処理(CKLBTaskMgr.execute()等)を呼び出すことでゲームが動作する。\r\n\t  */\r\n\tvirtual bool frameFlip(u32 dTime) = 0;\r\n\r\n\t/**\r\n\t  ゲームのフレームレートを決まる。\r\n\t  一フレーム当たりのミニマムの実行時間を設定する。\r\n\t  Defaultは16ms (1000 / 16 = 62fps)\r\n\t  */\r\n\tvirtual s32  getFrameTime() = 0;\r\n\tvirtual void setFrameTime(s32 time) = 0;\r\n\r\n\t//! ポインティングデバイス入力\r\n\t/*!\r\n\t  \\param  id     入力されたポイントのID\r\n\t  \\param  type   入力のタイプ\r\n\t  \\param  x      入力があった座標\r\n\t  \\param  y      入力があった座標\r\n\r\n\t  マウスやタッチパネルなど、ポインティングデバイスによる入力があった際に、プラットフォームレイヤから呼び出される。\r\n\t  これらの入力はフレーム駆動と非同期に行われるため、ゲーム側はこれを適切に処理しなければならない。\r\n\t  */\r\n\tvirtual void inputPoint(int id, INPUT_TYPE type, int x, int y) = 0;\r\n\r\n\t//! input by device buttons\r\n\t/*!\r\n\t  \\param keyId\t\tdevice key ID\r\n\t  \\param eventType\tinput event type\r\n\t */\r\n\tvirtual void inputDeviceKey(int keyId, char eventType) = 0;\r\n\r\n\t/*!\r\n\t  OSにより生成されたコントロールからのイベント等が通知される。TextBoxの文字列変更や、特殊URLジャンプなど。\r\n\t  */\r\n\tvirtual void controlEvent(EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\tsize_t datasize1, void * pData1, size_t datasize2, void * pData2) = 0;\r\n\r\n\ttypedef enum {\r\n\t\tLEFT_TOP,\t\t// 原点は左上(反時計廻りに0°)\r\n\t\tLEFT_BOTTOM,\t// 原点は左下(反時計廻りに90°)\r\n\t\tRIGHT_BOTTOM,\t// 原点は右下(反時計廻りに180°)\r\n\t\tRIGHT_TOP\t\t// 原点は右上(反時計廻りに270°)\r\n\t} ORIGIN;\r\n\r\n\ttypedef enum {\r\n\t\tPORTRAIT,\t\t// 縦長の画面\r\n\t\tLANDSCAPE\t\t// 横長の画面\r\n\t} SCRMODE;\r\n\r\n\t//! 画面ローテーション通知\r\n\t/*!\r\n\t  \\param origin\t新たな原点\r\n\t  \\param mode\t\t新たな画面の縦横方向\r\n\r\n\t  \\return その画面ローテーションを許可する場合はtrue, 禁止の場合はfalse\r\n\r\n\t  プラットフォームレイヤから、端末の回転を通知し、回転動作の可否を問い合わせるために呼び出されます。\r\n\t  回転動作を許可する際は true を、禁止する場合は false を返します。\r\n\r\n\t  基本的には新たな画面比率が縦長か横長かだけを通知します。\r\n\t  具体的な画面サイズは、許可されて回転動作が完了した後、changeScreenInfo()で通知されます。\r\n\t  */\r\n\tvirtual bool reportScreenRotation(ORIGIN origin, SCRMODE mode) = 0;\r\n\r\n\r\n\t//! 画面比率変更通知\r\n\t/*!\r\n\t  \\param origin\t新たな原点の位置\r\n\t  \\param width\torigin が 0 のときの画面幅\r\n\t  \\param height\torigin が 0 のときの画面高\r\n\t  回転動作の終了後に確定した、新たな画面の向きと、向きが 0 のときの幅/高さを通知します。\r\n\r\n\t  もともと回転に対応しており、GL側が回転後の上下を把握して設定を変更する環境の場合は、\r\n\t  幅、高さだけが更新されて通知されます。\r\n\t  */\r\n\tvirtual void changeScreenInfo(ORIGIN origin, int width, int height) = 0;\r\n\r\n\t//! ゲームリブート\r\n\t/*!\r\n\t  ゲームを最初から実行しなおします。\r\n\t  */\r\n\tvirtual void reboot\t\t\t() = 0;\r\n\r\n\tvirtual bool executeCommand\t(const char* command) = 0;\r\n\r\n\tvirtual void resetViewport\t() = 0;\r\n\r\n\tvirtual int  getPhysicalScreenWidth\t() = 0;\r\n\tvirtual int  getPhysicalScreenHeight() = 0;\r\n\tvirtual void pauseGame\t\t(bool pause) = 0;\r\n\r\n\tvirtual FILE* getShellOutput() = 0;\r\n\tvirtual void  setShellOutput(FILE* file) = 0;\r\n};\r\n\r\n//! プラットフォーム側インタフェースクラス\r\n/*!\r\n  ゲームから呼び出すことで使用されるプラットフォーム側の機能を、\r\n  プラットフォーム側で実装するためのインタフェースクラス。\r\n  */\r\nclass IPlatformRequest\r\n{\r\npublic:\r\n\tIPlatformRequest();\r\n\tvirtual ~IPlatformRequest();\r\n\r\n\tvirtual bool useEncryption() = 0;\r\n\r\n    // ゲーム側からプラットフォーム機能を呼び出す必要があるインタフェースは、\r\n    // こちらにそのインタフェースメソッドを実装する。呼び出しのタイミングは、ゲーム側の実装に依存する。\r\n\r\n\t//! 各プラットフォーム側デバッグ出力など\r\n\t/*!\r\n\t  \\param  format   printf形式のフォーマット文字列\r\n\r\n\t  指定された引数を printf 形式として、それぞれのプラットフォーム依存のデバッグ出力として出力する。\r\n\t  ゲーム側で実装された klb_assert マクロなどは、最終的にこのメソッドを使って出力される。\r\n\t  */\r\n\tvirtual void detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...) = 0;\r\n\tvirtual void logging(const char * format, ...) = 0;\r\n    \r\n    // バンドルバージョン取得\r\n    virtual const char* getBundleVersion() = 0;\r\n\r\n\t//! ナノ秒時刻取得\r\n\t/*!\r\n\t  ナノ秒単位の時刻を取得します。\r\n\t  取得される時刻の EPOCH は環境によって異なりますが、返される値の差分で経過時間を計測することができます。\r\n\t  */\r\n\tvirtual  s64 nanotime() = 0;\r\n\r\n\t//! 読み込みストリーム要求\r\n\t/*!\r\n\t  \\param fileName    要求する読み込みストリームの仮想パス\r\n\t  \\return アクセス対象となるストリームインスタンスのポインタ。ストリームのオープンに失敗した場合は 0\r\n\r\n\t  ファイルやネットワーク、Webなど、データ読み込み対象となるストリームを開きます。\r\n\t  プラットフォーム間の差異を吸収するため、全てのプラットフォームにおいて共通の仮想パス表記が用いられます。\r\n\r\n\t  <scheme>:<location>\r\n\r\n\t  <scheme>は、ストリームの種類を表します。\r\n\r\n\t  - file\r\n\t  - ファイルを対象とします。<location>はファイルセグメントと、各セグメント内でのパスとなります。\r\n\r\n\t  例) file://external/savedata.dat\r\n\t  　file://install/MAP_0001.dat\r\n\t  　file://asset/assetdata.dat\r\n\r\n\t  scheme が file:// の場合、一段目はファイルセグメントになります。install は読み出しのみが許可される\r\n\t  システムデータ、external は読み書き可能なファイルです。asset が指定された場合、対象のファイルを\r\n\t  external から探し、見つからなければ install を探しにいきます。install ファイルに問題が見つかった場合など、\r\n\t  修正パッチの配布に利用されることが想定されます。\r\n\t  .\r\n\t  - sock\r\n\t  - ソケットを対象とします。<location>は対象ホストのIPアドレスまたはFQDNとポートになります。\r\n\t  例) sock://192.168.0.1:5432\r\n\t  　sock://www.apple.com:80\r\n\t  .\r\n\t  - http/https\r\n\t  - HTTPまたはHTTPSによるリソースを対象とします。<location>はURIの scheme を除いたものとなります。\r\n\t  つまり、通常のURIを記述すれば、そのまま対象のリソースをアクセスできます。\r\n\r\n\t  例) http://www.google.co.jp/\r\n\t  .\r\n\t  */\r\n\tvirtual IReadStream* openReadStream(const char* fileName, bool decrypt) = 0;\r\n\r\n\r\n\tvirtual ITmpFile *\topenTmpFile\t\t\t\t(const char * filePath) = 0;\r\n\tvirtual void\t\tremoveTmpFile\t\t\t(const char * filePath) = 0;\r\n\tvirtual bool\t\tremoveFileOrFolder\t\t(const char * filePath) = 0;\r\n    virtual void\t\texcludePathFromBackup\t(const char * path)\t\t= 0;\r\n\tvirtual u32\t\t\tgetFreeSpaceExternalKB\t() = 0;\r\n\tvirtual u32\t\t\tgetPhysicalMemKB\t\t() = 0;\r\n\r\n\tvirtual void*\t\tifopen\t(const char* name, const char* mode) = 0;\r\n\tvirtual void\t\tifclose\t(void* file) = 0;\r\n\tvirtual int\t\t\tifseek\t(void* file, long int offset, int origin) = 0;\r\n\tvirtual u32\t\t\tifread\t(void* ptr, u32 size, u32 count, void* file ) = 0;\r\n\tvirtual u32\t\t\tifwrite\t(const void * ptr, u32 size, u32 count, void* file) = 0;\r\n\tvirtual int\t\t\tifflush\t(void* file) = 0;\r\n\tvirtual long int\tiftell\t(void* file) = 0;\r\n\tvirtual bool\t\ticreateEmptyFile(const char* name) = 0;\r\n\r\n    //! オーディオデータのロード\r\n    /*!\r\n     \\param url     ロードするオーディオデータの所在(suffix除く)\r\n     \\return        アクセス用ハンドル(void 型ポインタ)\r\n     \r\n     指定されたオーディオデータをオープンし再生の準備をした上、アクセス用のポインタをハンドルとして取得します。\r\n     オーディオのファイル形式はプラットフォームに依存するため、urlにはsuffix(もしくは拡張子)無しのパスを指定します。\r\n     また、同じ理由でゲームエンジン側からは直接オーディオデータそのものを参照することはできません\r\n\r\n     オーディオデータはプラットフォーム側が管理し、その管理領域にアクセスするためのポインタのみが返されます。\r\n     ポインタの先で示される領域の実装についてはプラットフォーム側に依存し、ゲーム側でその実装に依存するコードを書くことは推奨されません。\r\n     */\r\n    virtual void*   loadAudio(const char* url, bool is_se = false) = 0;\r\n    \r\n    //! オーディオデータのオンメモリ化\r\n    /*!\r\n     \\param handle  loadAudio() で取得されたオーディオデータ管理領域\r\n     \\return オンメモリ化が正常終了した場合は true, 失敗した場合は false\r\n     \r\n     指定されたオーディオデータをメモリ上に展開し、即時再生できるようにします。\r\n     ゲーム中のSEなどは短い上に頻繁に再生されるデータですが、これらをストレージから読みながら再生すると\r\n     再生開始まで時間がかかることがあります。こうしたSEデータをあらかじめメモリ上に展開し、\r\n     いつでも即時再生できるよう準備するために使用されます。\r\n     */\r\n    virtual bool    preLoad(void* handle) = 0;\r\n    \r\n    \r\n    //! BGMオーディオデータのバッファサイズ指定\r\n    /*!\r\n     \\param handle  loadAudio() で取得されたオーディオデータ管理領域\r\n     \\param level   バッファサイズ指定。0(小) 〜 2(大) で指定。\r\n     \\return オンメモリ化が正常終了した場合は true, 失敗した場合は false\r\n \r\n     指定されたオーディオデータをBGMとして再生する際の、再生バッファサイズを大中小の3段階で選びます。\r\n     指定されたサイズが具体的にどのように用いられるかはプラットフォームによって異なります。\r\n     これを指定しない場合のデフォルトバッファサイズは 1(中)と同等でなければなりません。\r\n     */\r\n    virtual bool    setBufSize(void * handle, int level) = 0;\r\n    \r\n    //! オーディオデータの再生\r\n    /*!\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n\r\n     handleで指定されたオーディオデータの再生を開始します。\r\n     */\r\n    virtual void    playAudio(void* handle, s32 _msec=0, float _tgtVol=1.0f, float _startVol=1.0f) = 0;\r\n    \r\n    //! 再生中オーディオ再生の停止\r\n    /*!\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     \r\n     handleで指定されたオーディオデータが現在再生中の場合、そのデータの再生を停止します。\r\n     再生中でなければ何もしません。\r\n     */\r\n    virtual void    stopAudio(void* handle, s32 _msec=0, float _tgtVol=0.0f) = 0;\r\n\r\n    \r\n    //! オーディオ全体のボリューム設定\r\n    /*!\r\n     \\param volume ボリューム値。0.0f〜1.0fの間で指定。\r\n     \\param SEmode falseでBGM全体のボリューム設定。trueでSE全体のボリューム設定。\r\n     \r\n     BGMあるいはSE全体のレベルでボリュームを設定する。\r\n     実際の再生ボリュームは、このAPIで設定したボリューム値に、各オーディオデータ個別のボリューム値を掛けた値となる。\r\n     \r\n     SEmode が false の場合はBGMに対するボリューム設定となり、\r\n     個別のオーディオデータのうちpreLoad()でオンメモリ化されていないもののみが影響を受けます。\r\n     \r\n     SEmode が true の場合、SEに対するボリューム設定となり、\r\n     preLoad() でオンメモリ化されたオーディオデータのみが影響を受けます。\r\n     */\r\n    virtual void    setMasterVolume(float volume, bool SEmode) = 0;\r\n    \r\n    \r\n    //! 各オーディオハンドル単位のボリューム設定\r\n    /*!\r\n     */\r\n    virtual void    setAudioVolume(void * handle, float volume) = 0;\r\n    \r\n    //! オーディオのパン設定\r\n    virtual void    setAudioPan(void * handle, float pan) = 0;\r\n\r\n    \r\n    //! オーディオデータの解放\r\n    /*!\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータを解放します。\r\n     */\r\n    virtual void    releaseAudio(void* handle) = 0;\r\n\r\n    //! オーディオ一時停止\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータ再生を一時停止します。\r\n     */\r\n    virtual void pauseAudio(void * handle, s32 _msec=0, float _tgtVol=0.0f) = 0;\r\n    \r\n    //! オーディオ再生再開\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータが一時停止しているときに再生を再開します。\r\n     */\r\n    virtual void resumeAudio(void * handle, s32 _msec=0, float _tgtVol=1.0f) = 0;\r\n\r\n    //! オーディオ再生時刻移動\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータが一時停止しているときに再生を再開します。\r\n     */\r\n    virtual void seekAudio(void * handle, s32 millisec) = 0;\r\n\r\n    \r\n    //! オーディオ再生時刻取得\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータにおける現在の再生位置時刻をミリ秒単位で取得します。\r\n     ただし、環境によって取得できる時刻の分解能は異なり、原則「再生系によって検知された最新の時刻」を返します。\r\n     */\r\n    virtual s32  tellAudio(void * handle) = 0;\r\n    \r\n    \r\n    //! オーディオ合計演奏取得\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータにおける現在の合計演奏時間をミリ秒単位で取得します。\r\n     */\r\n    virtual s32  totalTimeAudio(void * handle) = 0;\r\n    \r\n    //! オーディオステータス取得\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータの状態を取得します。\r\n     */\r\n    virtual s32  getState(void * handle) = 0;\r\n    \r\n    //! オーディオにフェードステータスを設定\r\n    /*\r\n     \\param _handle     loadAudio()で取得されたオーディオデータ管理領域\r\n     \\param _tgtVol     目標のフェード値(0.0f~1.0f)\r\n     \\param _msec       フェードにかかる時間(ミリ秒)\r\n     handleで指定された、現在ロードされているオーディオデータにフェード処理を追加\r\n     */\r\n    virtual void setFadeParam(void * _handle, float _tgtVol, u32 _msec) = 0;\r\n    \r\n    //! サウンドとミュージックの並行処理タイプ設定\r\n    virtual void setAudioMultiProcessType( s32 _processType ) = 0;\r\n    \r\n    //! サウンドの割り込み処理をOSに依存するかどうか\r\n    virtual void setPauseOnInterruption(bool _bPauseOnInterruption) = 0;\r\n    \r\n    //! OS起動からの経過時間を取得\r\n    virtual s64 getElapsedTime( void ) = 0;\r\n    \r\n\tvirtual\tbool registerFont(const char* logicalName, const char* physFile, bool default_) = 0;\r\n\r\n    //! フォントオブジェクト取得\r\n    virtual void * getFont(int size, const char * fontName = 0, float* pAscent = NULL) = 0;\r\n    \r\n    //! フォントオブジェクト破棄\r\n    virtual void deleteFont(void * pFont) = 0;\r\n\r\n\t//! フォントオブジェクト取得\r\n    virtual void * getFontSystem(int size, const char * fontName = 0) = 0;\r\n    \r\n    //! フォントオブジェクト破棄\r\n    virtual void deleteFontSystem(void * pFont) = 0;\r\n    \r\n    //! フォントテクスチャ描画\r\n    virtual bool renderText(const char* utf8String, void * pFont, u32 color,    //!< 描画する文字列とフォントの指定\r\n                            u16 width, u16 height, u8 * pBuffer8888,            //!< 描画対象とするテクスチャバッファとそのピクセルサイズ\r\n                            s16 stride, s16 base_x, s16 base_y, bool use4444 = false) = 0;            //!< baseline起点とするテクスチャ内の位置\r\n\r\n    virtual bool getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo) = 0;\r\n\r\n\r\n\t//! 指定アセットパスを各プラットフォーム上のフルパスに変換した文字列を返す。\r\n\t// 返された文字列は、別途 delete [] で削除の必要がある。\r\n\tvirtual const char * getFullPath(const char * assetPath, bool* isReadOnly=NULL) = 0;\r\n\r\n\t//! 動作環境情報文字列を返す。\r\n\tvirtual const char * getPlatform() = 0;\r\n\r\n\t//! eglGetProcAddress() 相当の処理を行う\r\n\tvirtual void * getGLExtension(const char * ext) = 0;\r\n\r\n\t//! OS機能によるコントロール配置\r\n\t/*!\r\n\t  \\param type\t\t生成するコントロールのタイプ\r\n\t  \\param id\t\tコントロールに与えるID\r\n\t  \\param caption\tコントロールに与えるcaption値\r\n\t  \\param x\t\tコントロールを配置する位置\r\n\t  \\param y\t\tコントロールを配置する位置\r\n\t  \\param width\tコントロールのサイズ\r\n\t  \\param height\tコントロールのサイズ\r\n\r\n\t  OS機能を利用してコントロールを生成します。\r\n\t  指定された位置やサイズは最大限努力はされますが、\r\n\t  指定された位置/サイズと完全に合致しないことがあります。\r\n\t  */\r\n\tvirtual IWidget * createControl(IWidget::CONTROL type, int id,\r\n\t\t\tconst char * caption, int x, int y, int width, int height, ...) = 0;\r\n\r\n\t//! OS機能によるコントロールの破棄\r\n\t/*!\r\n\t  \\param pControl createControl()の戻り値として返されたcontrolハンドルとなるポインタ\r\n\r\n\t  createControl()で生成したコントロールを破棄します。\r\n\t  */\r\n\tvirtual void destroyControl(IWidget * pControl) = 0;\r\n\r\n\r\n\tenum APP_TYPE {\r\n\t\tAPP_MAIL,\r\n\t\tAPP_BROWSER,\r\n\t\tAPP_UPDATE,\t\t// アプリケーションのアップデートが可能なアプリ(iOSならAppStore)\r\n\t};\r\n\r\n\t//! OSアプリケーションの起動\r\n\t/*!\r\n\t  \\param type 起動するアプリケーションのタイプ。実際に何が起動されるかはプラットフォーム依存だが、そのタイプを適切にこなせるものである必要がある。\r\n\r\n\t  createControl()で生成したコントロールを破棄します。\r\n\t  */\r\n\tvirtual bool callApplication(APP_TYPE type, ... ) = 0;\r\n\r\n\r\n\t//! スレッド起動\r\n\t/*!\r\n\r\n*/\r\n\tvirtual void *\tcreateThread\t(s32 (*thread_func)(void * hThread, void * data), void * data) = 0;\r\n\tvirtual void\texitThread\t\t(void * hThread, s32 status)   = 0;\r\n\tvirtual bool\twatchThread\t\t(void * hThread, s32 * status) = 0;\r\n\tvirtual void\tdeleteThread\t(void * hThread) = 0;\r\n\tvirtual void\tbreakThread\t\t(void * hThread) = 0;\r\n\r\n\tvirtual int\t\tgenUserID\t\t(char * retBuf, int maxlen) = 0;\r\n\tvirtual int\t\tgenUserPW\t\t(const char * salt, char * retBuf, int maxlen) = 0;\r\n\r\n\tvirtual bool\treadyDevID\t\t() = 0;\r\n\tvirtual int\t\tgetDevID\t\t(char * retBuf, int maxlen) = 0;\r\n\tvirtual bool\tsetSecureDataID\t(const char * service_name, const char * user_id)\t\t= 0;\r\n\tvirtual bool\tsetSecureDataPW\t(const char * service_name, const char * passwd)\t\t= 0;\r\n\tvirtual int\t\tgetSecureDataID\t(const char * service_name, char * retBuf, int maxlen)  = 0;\r\n\tvirtual int\t\tgetSecureDataPW\t(const char * service_name, char * retBuf, int maxlen)  = 0;\r\n\tvirtual bool\tdelSecureDataID\t(const char * service_name) = 0;\r\n\tvirtual bool\tdelSecureDataPW\t(const char * service_name) = 0;\r\n\r\n\t//! ストア機能\r\n\t//! トランザクション監視開始\r\n\tvirtual void initStoreTransactionObserver() = 0;\r\n\t//! トランザクション監視終了\r\n\tvirtual void releaseStoreTransactionObserver() = 0;\r\n\t//! 購入要求: アイテムIDと、その数を渡す\r\n\tvirtual void buyStoreItems(const char * item_id) = 0;\r\n\t//! プロダクトリスト取得要求: アイテムIDの配列とその数、及びcurrency表示にするかの判定とcallbackを渡す.\r\n\tvirtual void getStoreProducts(const char* json, bool currency_mode) = 0;\r\n\t//! サーバー通信後にトランザクションを閉じて購入処理を確定させる。\r\n\tvirtual void finishStoreTransaction(const char* receipt) = 0;\r\n\r\n\tvirtual void*\tallocMutex\t\t() = 0;\r\n\tvirtual void\tfreeMutex\t\t(void* mutex) = 0;\r\n\tvirtual void\tmutexLock\t\t(void* mutex) = 0;\r\n\tvirtual void\tmutexUnlock\t\t(void* mutex) = 0;\r\n\r\n\tvirtual void*\tallocEventLock\t() = 0;\r\n\tvirtual void\tfreeEventLock\t(void* lock) = 0;\r\n\tvirtual void\teventSleep\t\t(void* lock) = 0;\r\n\tvirtual void\teventWakeup\t\t(void* lock) = 0;\r\n\t\r\n\tvirtual void\tstartAlertDialog( const char* title , const char* message ) = 0;\r\n\r\n\tvirtual void\tforbidSleep\t\t(bool is_forbidden) = 0;\r\n};\r\n\r\n#ifdef DEBUG\r\n# \r\n# define DEBUG_PRINT(...) CPFInterface::getInstance().platform().detailedLogging(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)\r\n#else\r\n# define DEBUG_PRINT(...) \r\n#endif\r\n\r\n//!\r\n/*!\r\n  プラットフォーム側とゲーム側のインタフェースとなる Singleton.\r\n  両者のやり取りは必ず CPFInterface インスタンスを介して行われる。\r\n\r\n  初期化シーケンス:\r\n  -# CPFInterface::setPlatformRequest() / IPlatformRequest実装をCPFInterfaceに登録\r\n  -# GameSetup() / ゲーム側スタートアップ関数呼び出し\r\n  -# GameSetup()内: CPFInterface::setClientRequest() / IClientRequest実装をCPFInterfaceに登録\r\n  .\r\n  -# CPFInterface::client().setScreenInfo() / 画面サイズをゲームに通知\r\n  -# CPFInterface::client().setFilePath() / データアクセスパスをゲームに通知\r\n  -# CPFInterface::client().initGame() / ゲーム初期化処理の呼び出し\r\n  .\r\n  また、ゲームの実行は毎フレームプラットフォーム側から CPFInterface::client.flipFrame()を呼び出すことで行われる。\r\n  */\r\nclass CPFInterface\r\n{\r\nprivate:\r\n\tstatic CPFInterface * instance;\r\n\tIClientRequest * m_pClient;\r\n\tIPlatformRequest * m_pPlatform;\r\nprivate:\r\n\tCPFInterface();\r\n\tvirtual ~CPFInterface();\r\npublic:\r\n\r\n\t//! インスタンス取得\r\n\t/*!\r\n\t  \\return Singletonインスタンスへの参照\r\n\r\n\t  Singletonインスタンスへの参照を取得する。\r\n\t  ゲーム側、プラットフォーム側いずれでも使用される。\r\n\t  */\r\n\tstatic CPFInterface& getInstance();\r\n\r\n\t//! ゲーム側インタフェースの登録\r\n\t/*!\r\n\t  \\param pClient  クライアント側インタフェースのポインタ\r\n\r\n\t  プラットフォーム側からゲーム側をコールする際に使用されるインタフェースを登録する。\r\n\t  IClientRequest(Client側Strategy)を受け取り設定する\r\n\t  */\r\n\tvoid setClientRequest(IClientRequest * pClient) {\r\n\t\tm_pClient = pClient;\r\n\t}\r\n\r\n\t//! プラットフォーム側インタフェースの登録\r\n\t/*!\r\n\t  \\param pPlatform  プラットフォーム側インタフェースのポインタ\r\n\r\n\t  ゲーム側からプラットフォーム側をコールする際に使用されるインタフェースを登録する。\r\n\t  IPlatformRequest(Platform側Strategy)を受け取り設定する\r\n\t  */\r\n\tvoid setPlatformRequest(IPlatformRequest * pPlatform) {\r\n\t\tm_pPlatform = pPlatform;\r\n\t}\r\n\r\n\t//! ゲーム側インタフェースの参照取得\r\n\t/*!\r\n\t  \\return ゲーム側インタフェースへの参照\r\n\r\n\t  ゲーム側から指定されたインタフェースへの参照を取得する。\r\n\t  */\r\n\tinline IClientRequest& client() {\r\n\t\treturn *m_pClient;\r\n\t}\r\n\r\n\t//! プラットフォーム側インタフェースの参照取得\r\n\t/*!\r\n\t  \\return プラットフォーム側インタフェースへの参照\r\n\r\n\t  プラットフォーム側から指定されたインタフェースへの参照を取得する。\r\n\t  */\r\n\tinline IPlatformRequest& platform() {\r\n\t\treturn *m_pPlatform;\r\n\t}\r\n\r\n\t//! エンディアン確認\r\n\t/*!\r\n\t  \\return  ビッグエンディアンのときは true, リトルエンディアンのときは false\r\n\t  実行環境のエンディアンを調査する。\r\n\t  */\r\n\tbool isBigEndian();\r\n\r\n\tinline bool isClient\t() const { return (m_pClient != 0);\t\t}\r\n\tinline bool isPlatform\t() const { return (m_pPlatform != 0);\t}\r\n};\r\n\r\n#endif // CPFInterface_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CSampleProjectEntrance.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CSampleProjectEntrance_h\r\n#define CSampleProjectEntrance_h\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBGameApplication.h\"\r\n\r\nclass CSampleProjectEntrance : public CKLBGameApplication\r\n{\r\nprivate:\r\n\tCSampleProjectEntrance();\r\n\tvirtual ~CSampleProjectEntrance();\r\npublic:\r\n    static CSampleProjectEntrance * getInstance();\r\n\r\nprivate:\r\n\tbool initLocalSystem(CKLBAssetManager& mgrAsset);\r\n\tvoid localFinish();\r\n};\r\n\r\n#endif // CSampleProjectEntrance_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CSockReadStream.h",
    "content": "#ifndef CSockReadStream_h\n#define CSockReadStream_h\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n\nclass CSockWriteStream;\n\n// ファイルアクセスクラス実装\nclass CSockReadStream : public IReadStream\n{\n\tfriend class CSockWriteStream;\nprivate:\n\tenum {\n\t\tREAD_BUFSIZ = 4096\n\t};\n\t// ファクトリとなるクラスメソッド以外で勝手に new はできない\n\tCSockReadStream();\n    \npublic:\n\t// delete はできる。\n\tvirtual ~CSockReadStream();\n    \n\t// 指定されたIPアドレスまたはFQDNとPORTで CSockReadStream インスタンスを作り、そのポインタを返す。\n\t// このクラスメソッドはプラットフォーム側のために用意され、ゲーム側では IReadStream のポインタとして\n\t// 扱われるため、このメソッドを扱うことは出来ない(可能ではあるが推奨されない)\n\tstatic CSockReadStream *openStream(const char *path);\n    \n    \n\ts32 getSize();\n\ts32 getPosition();\n\tu8 readU8();\n\tu16 readU16();\n\tu32 readU32();\n\tfloat readFloat();\n\tbool readBlock(void *buffer, u32 byteSize);\n\tESTATUS getStatus();\n    \n\tint readU16arr(u16 *pBufferU16, int items);\n\tint readU32arr(u32 *pBufferU32, int items);\n    \n    \n\tIWriteStream *getWriteStream();\n    \nprivate:\n\tint sock_connect(const char *hostname, int port);\n\tbool readRingBuf();\n\tbool requestData(unsigned char *buf, size_t size);\n\tbool setStatus();\n    \n\tinline size_t left_size() {\n\t\tsize_t leftSize = 0;\n\t\tif (m_lastPos > m_getPos) {\n\t\t\tleftSize = m_lastPos - m_getPos;\n\t\t}\n\t\telse if (m_lastPos < m_getPos) {\n\t\t\tleftSize = m_lastPos + READ_BUFSIZ - m_getPos;\n\t\t}\n\t\telse {\n\t\t\tif (m_lastPos) {\n\t\t\t\tleftSize = READ_BUFSIZ;\n\t\t\t}\n\t\t}\n\t\treturn leftSize;\n\t}\n    \nprivate:\n\tESTATUS m_eStat;\n\tint m_fd;\n    \n\t// 読み込みバッファ: 受信データは一度このバッファを経由する。\n\tu8 m_readBuf[READ_BUFSIZ];\n\tint m_lastPos;          // データ終端\n\tint m_getPos;           // データ始端\n    \n\t// 同じ fd を使用して送出に使用される CSockWriteStream のポインタ\n\tCSockWriteStream *m_writeStream;\n};\n\n\n#endif // CSockReadStream_h\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CSockWriteStream.h",
    "content": "#ifndef CSockWriteStream_h\n#define CSockWriteStream_h\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n\nclass CSockReadStream;\n\n// ファイルアクセスクラス実装\nclass CSockWriteStream : public IWriteStream\n{\n\tfriend class CSockReadStream;\nprivate:\n\tCSockWriteStream(CSockReadStream & rdStream);\n\tvirtual ~CSockWriteStream();\n    \n\tbool sendData(unsigned char *buffer, size_t sndSize);\n    \npublic:\n\tESTATUS getStatus();\n\ts32 getPosition();\n\tvoid writeU8(u8 value);         // Use cast to support s8\n\tvoid writeU16(u16 value);           // Use cast to support s16\n\tvoid writeU32(u32 value);           // Use cast to support s32\n\tvoid writeFloat(float);\n\tvoid writeBlock(void *buffer, u32 byteSize);\n    \nprivate:\n\tint m_fd;\n\tESTATUS m_eStat;\n};\n\n#endif // CSockWriteStream_h\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CSoundAnalysis.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n @file      CSoundAnalysis.h\r\n @brief     サウンドファイルの解析など\r\n*/\r\n\r\n#ifndef __SOUND_ANALYSIS_H__\r\n#define __SOUND_ANALYSIS_H__\r\n\r\n#include \"BaseType.h\"\r\n\r\n/*\r\n @enum  eBITRATE_TYPE\r\n */\r\nenum eBITRATE_TYPE\r\n{\r\n    eBITRATE_TYPE_NONE = -1,\r\n    \r\n    eBITRATE_TYPE_VBR = 0,  // 可変ビットレート\r\n    eBITRATE_TYPE_CBR,      // 固定ビットレート\r\n    eBITRATE_TYPE_ABR,      // 平均ビットレート\r\n    \r\n    eBITRATE_TYPE_MAX,\r\n};\r\n\r\n/*\r\n @struct sSoundAnalysisData\r\n */\r\ntypedef struct strSoundAnalysisData\r\n{\r\n    eBITRATE_TYPE   m_bitRateType;  //!< ビットレートのタイプ(固定,可変,平均)\r\n    s16             m_bitRate;      //!< ビットレート(単位:kbps)\r\n    u16             m_samplingRate; //!< サンプリングレート(単位:kHz)\r\n    s32             m_totalFrame;   //!< サウンドの再生フレーム数\r\n    s64             m_totalTime;    //!< サウンドの再生時間(ミリ秒)\r\n} sSoundAnalysisData;\r\n\r\n\r\n/*\r\n @brief  サウンドファイルのいろいろな情報を取得\r\n @param[in]     const char* _path          サウンドファイル名\r\n @param[out]    sSoundAnalysisData* _data  指定サウンドファイルのいろいろな情報格納用\r\n @return        void\r\n */\r\nbool GetSoundAnalysisData( const char* _path, sSoundAnalysisData* _data );\r\n\r\n/*\r\n @brief  サウンドファイルの演奏時間を取得\r\n @param[in]  const char* _path   サウンドファイル名\r\n @return     u32                 指定のサウンドファイルの演奏時間\r\n */\r\nu32 GetSoundTotalTime( const char* _path );\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CSoundAnalysisMP3.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n @file      CSoundAnalysisMP3.h\r\n @brief     MP3形式のサウンドファイルの解析など\r\n */\r\n\r\n#ifndef __SOUND_ANALYSIS_MP3_H__\r\n#define __SOUND_ANALYSIS_MP3_H__\r\n\r\n#include \"CSoundAnalysis.h\"\r\n\r\n/*\r\n @brief  mp3形式のサウンドファイル解析\r\n @param[in] const char* _path                   サウンドファイルのパス\r\n @param[in] sSoundAnalysisData* _analysisData   サウンドファイルの解析結果渡す用\r\n @return    bool    true:解析完了, false:解析失敗\r\n */\r\nbool SoundAnalysis_MP3( const char* _path, sSoundAnalysisData* _analysisData );\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CUnZip.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CUnZip_h\r\n#define CUnZip_h\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n\r\n#include \"zlib.h\"\r\n#include \"unzip.h\"\r\n#pragma comment(lib, \"zlib.lib\")\r\n\r\n#include \"BaseType.h\"\r\n#include \"ITmpFile.h\"\r\n\r\n/*!\r\n* \\class CUnZip\r\n* \\brief UnZip Class\r\n* \r\n* \r\n*/\r\nclass CUnZip\r\n{\r\npublic:\r\n\tCUnZip();\r\n\tCUnZip(const char * zip_path);\r\n\tvirtual ~CUnZip();\r\n\r\n\tbool Open(const char * zip_path);\r\n\r\n\tinline bool getStatus() {\r\n\t\treturn m_bReady;\r\n\t}\r\n\tinline unsigned long numEntry() { return m_globalInfo.number_entry; }\r\n\tbool readCurrentFileInfo();\r\n\tbool extractCurrentFile\t(const char * extract_root);\r\n\tbool isFinishExtract\t();\r\n\tbool gotoNextFile\t\t();\r\n\r\n\tinline int getFinishedEntry() { return m_finished_entry; }\r\n\r\n\t// 展開処理\r\n\tbool unCompress(const char * extract_root);\r\n\r\nprotected:\r\n\t// ファイル個別の展開が終了したときに、そのファイルのパス名と展開サイズを引数として呼び出される。\r\n\tvirtual bool afterExtract(const char * extract_path, bool isDirectory, size_t size);\r\n\r\nprivate:\r\n\tbool\tmake_directory\t\t\t(const char * dir_name);\r\n\tbool\tCreateDirectoryReflex\t(const char * strPath);\r\n\tbool\tIsFileExist\t\t\t\t(const char * strFilename);\r\n\r\n\ts32\t\tThreadExtract\t\t\t(void * hThread, void * data);\r\n\r\n\tstatic s32 ThreadExtractEntry\t(void * hThread, void * data);\r\n\r\n\r\n\tunzFile\t\t\tm_hUnzip;\r\n\tunz_global_info\tm_globalInfo;\r\n    unz_file_info\tm_fileInfo;\r\n\tchar\t\t\tm_currentPath[512];\r\n\tint\t\t\t\tm_lenPath;\r\n\r\n\tITmpFile\t*\tm_wrfile;\r\n\tunsigned long\tm_dwSizeWrite;\r\n\r\n\tchar\t\t*\tm_targetPath;\r\n\tbool\t\t\tm_extractFinish;\r\n\tvoid\t\t*\tm_hThread;\r\n\r\n\tint\t\t\t\tm_finished_entry;\r\n\r\n\tbool\t\t\tm_bReady;\r\n\r\n\tenum {\r\n\t\tBUF_SIZE = 8192\r\n\t};\r\n};\r\n\r\n\r\n#endif // CUnZip_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSAudio.h",
    "content": "#ifndef CiOSAudio_h\n#define CiOSAudio_h\n\n\n#import <GLKit/GLKit.h>\n#import <mach/time_value.h>\n#import <Foundation/Foundation.h>\n#import <AudioToolbox/AudioToolbox.h>\n#import <AudioToolbox/ExtendedAudioFile.h>\n#import <AudioToolbox/AudioFile.h>\n#include \"CSoundAnalysis.h\"\n#include \"encryptFile.h\"\n\nclass CiOSPlatform;\nclass CiOSAudio;\nclass CiOSAudioSession;\n\n\nclass cAudioFadeParam\n{\n\tfriend class CiOSAudio;\n\tfriend class CiOSAudioSession;\npublic:\n\tcAudioFadeParam();\n\tvirtual ~cAudioFadeParam();\n    \n\tvoid attach();\n\tvoid detach();\n\tvoid exec();\n\tbool setFadeParam(s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType = INTER_TYPE_LINEAR, float _startVolume = 1.0f);\n    \n\tstatic void AudioFadeParamInit();\n\tstatic void AudioFadeParamExit();\n\tstatic void SetFadeParam(CiOSAudio *_audio, CiOSAudioSession *_settion, s16 _fadeType, float _tgtVol, u32 _msec, s16 _interType = INTER_TYPE_LINEAR, float _startVolume = 0.0f);\n\tstatic void Remove(void *_audio);\n\tstatic s32 ThreadAudioFadeParam(void *hThread, void *data);\n    \npublic:\n\t// フェード関係のパラメータ\n\tenum FADE_TYPE {\n\t\tFADE_TYPE_NONE = 0,\n\t\tFADE_TYPE_PLAY,         //!< fade in\n\t\tFADE_TYPE_STOP,         //!< fade out\n\t\tFADE_TYPE_PAUSE,        //!< fade out\n\t\tFADE_TYPE_RESUME,       //!< fade in\n\t\tFADE_TYPE_PLAYING,      //!< fade\n        \n\t\tFADE_TYPE_NUM,\n\t};\n    \n\tenum INTER_TYPE {\n\t\tINTER_TYPE_NONE = 0,\n\t\tINTER_TYPE_LINEAR,         //!< Linear\n        \n\t\tINTER_TYPE_NUM,\n\t};\n    \nprivate:\n\ts32 m_fadeCnt;                          //!< フェードカウント(ミリ秒)\n\tfloat m_startVol;                       //!< フェード開始のボリューム値(0.0f~1.0f)\n\tfloat m_endVol;                         //!< フェード終了のボリューム値(0.0f~1.0f)\n\tfloat m_fadeRatio;                      //!< フェード割合(0.0f〜1.0f)\n\ts32 m_fadeMiliSec;                      //!< フェードに要する時間(ミリ秒)\n\ts16 m_nowFadeInterType;                 //!< 現在のフェード補間タイプ\n\ts16 m_nowFadeType;                      //!< 現在のフェードタイプ\n\tbool m_bfade;                           //!< フェード中？\n\ts64 m_prevmseq;                         //!< 前回の再生時間\n    \n\tCiOSAudio *m_pAudio;                    //!< 対象者\n\tCiOSAudioSession *m_pSession;           //!< 対象者\n    \n\tcAudioFadeParam *m_prev;    //!< 前のフェードパラメータ\n\tcAudioFadeParam *m_next;    //!< 次のフェードパラメータ\n    \n\tstatic cAudioFadeParam *s_fadeParamList;\n\tstatic void *s_fadeParamThread;\n};\n\nclass CiOSAudioSession\n{\n\tfriend class CiOSAudio;\nprivate:\n\tCiOSAudioSession(CiOSAudio * pAudio);\n\tvirtual ~CiOSAudioSession();\n    \n\tvoid init();\n    \npublic:\n\tvoid play();\n\tvoid stop();\n\tvoid pause();\n\tvoid resume();\n\ts64 tell();\n\tvoid checkSessionStoped();\n    \n\tinline bool isPlaying() {\n\t\treturn m_isPlaying;\n\t}\n    \n\tinline bool isPause() {\n\t\treturn m_isPause;\n\t}\n    \n\tinline float getFadeRatio(void) {\n\t\treturn m_fadeRatio;\n\t}\n    \n\tvoid setFadeRatio(float _fadeRatio);\n    \nprivate:\n\tCiOSAudioSession *m_prev;\n\tCiOSAudioSession *m_next;\n    \n\tCiOSAudio *m_audio;\n\tAudioUnit m_audioUnit;\n    \n\tSInt64 m_currentFrame;              //!< 現在の再生フレーム\n\tbool m_isDone;                      //!< 再生終了？\n\tbool m_isPlaying;                   //!< 再生中？\n\tbool m_isPause;                     //!< pause中？\n    \n\tfloat m_volume;                     //!< ボリューム(0.0f~1.0f)\n\tfloat m_panL;                       //!< 左ボリューム\n\tfloat m_panR;                       //!< 右ボリューム\n    \n\tfloat m_fadeRatio;\n    \n\tOSStatus callbackSE(AudioUnitRenderActionFlags *ioActionFlags,\n\t                    const AudioTimeStamp *      inTimeStamp,\n\t                    UInt32                      inBusNumber,\n\t                    UInt32                      inNumberFrames,\n\t                    AudioBufferList *           ioData);\n    \n\tstatic OSStatus renderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,\n\t                               const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData);\n};\n\nclass AudioFileMemory\n{\npublic:\n\tAudioFileMemory();\n\t~AudioFileMemory()\n\t{\n\t}\n    \npublic:\n\tu8 *m_decryptBuffer;\n\tu32 m_dataLength;\n    \npublic:\n\tbool loadFile(const char *url);\n\tvoid release();\n    \nprivate:\n\tCDecryptBaseClass m_decrypter;\n\tinline void decrypt(void *ptr, u32 length) {\n\t\tm_decrypter.decryptBlck(ptr, length);\n\t}\n    \n\tinline u32 decryptSetup(const u8 *ptr, const u8 *hdr) {\n\t\treturn m_decrypter.decryptSetup(ptr, hdr);\n\t}\n};\n\nclass CiOSAudio\n{\n\tfriend class CiOSAudioSession;\nprivate:\n\ttypedef struct {\n\t\tconst char *top;\n\t\tconst char *phisical;\n\t} LOCLIST;\n\tstatic const LOCLIST m_toplevel[];\n    \npublic:\n\tCiOSAudio();\n\tvirtual ~CiOSAudio();\n    \n\tbool openAudio(const char *path, CiOSPlatform *platform);\n\tbool loadMem(); // オンメモリ化\n    \n\tinline void setLuaPause(bool _bLuaPause) {\n\t\tm_luaPause = _bLuaPause;\n\t}\n    \n\tinline bool getLuaPause(void) {\n\t\treturn m_luaPause;\n\t}\n    \n\tvoid play(s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 1.0f);\n\tvoid stop(s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid pause(s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid resume(s32 _msec = 0, float _tgtVol = 1.0f);\n\tvoid seek(s32 millisec);\n\ts32 tell();\n\ts32 totalPlayTime();\n    \n\tvoid setFadeParam(float _tgtVol, u32 _msec);\n    \n\tinline float getFadeRatio(void) {\n\t\treturn m_fadeRatio;\n\t}\n    \n\tvoid setFadeRatio(float _fadeRatio);\n\ts32 getState();\n    \n\tvoid closeAudio();\n    \n\tvoid setVolume(float volume);\n    \n\tinline float getVolume() {\n\t\treturn m_volume;\n\t}\n    \n\tvoid setPan(float pan);\n    \n\tinline float getPan() {\n\t\treturn m_pan;\n\t}\n    \n\tinline bool isActive() {\n\t\treturn m_bActive;\n\t}\n    \n\tinline int getInterruptionType() {\n\t\treturn m_interruptionType;\n\t}\n    \n\tinline void setInterruptionType(int _interruptionType) {\n\t\tm_interruptionType = _interruptionType;\n\t}\n    \n\tinline bool setBufSize(int level) {\n\t\tif (level < 0 || level > 2) return false;\n\t\tm_buf_level = level;\n\t\treturn true;\n\t}\n    \n\tvoid updateVolume();\n\tvoid checkSessionStoped();\n\tvoid audioSessionCleanup();\n    \nprivate:\n\tenum {\n\t\tBUF_COUNT = 3\n\t};\n\tenum {\n\t\tSTEP_WAIT,\n\t\tSTEP_PLAY,\n\t\tSTEP_PAUSE\n\t};\n\tconst char *m_soundPath;\n\t// char                         *   m_soundFullpath;\n\tbool m_bActive;\n\tbool m_preLoad;\n\tbool m_bInit;\n\tbool m_bSeeked;\n\tint m_interruptionType;                                    //!< サウンドの割り込みタイプ\n\tbool m_luaPause;\n    \n\tint m_buf_level;\n\tint m_step;\n    \n\tNSURL *m_soundURL;\n\tAudioFileID m_audioID;\n\tAudioStreamBasicDescription m_ASBD;\n\tAudioStreamPacketDescription *m_ASPD;\n\tAudioQueueRef m_queue;\n\tAudioQueueBufferRef m_qBuf[BUF_COUNT];\n\tAudioQueueTimelineRef m_TlineRef;\n    \n\tint m_bufIndex;\n    \n\tUInt64 m_numPacketPerTime;\n\tUInt32 m_maxPacketSize;\n\tSInt64 m_startPackNum;\n\tSInt64 m_pauseTime;\n\ts32 m_nowPlayTime;                                  // BGMの現在再生時刻\n\tuint64_t m_tval;\n\tuint64_t m_last_delta;\n    \n    \n\tfloat m_volume;\n\tfloat m_pan;\n\tfloat m_panR;\n\tfloat m_panL;\n    \n\tfloat m_fadeRatio;\n\tsSoundAnalysisData m_soundAnalysisData;\n    \n\tExtAudioFileRef m_extAudioID;\n\tAudioStreamBasicDescription m_clientFormat;\n\tSInt64 m_totalFrames;\n    \n\tAudioUnitSampleType **m_playBuffer;\n    \n\tCiOSAudioSession *m_begin;\n\tCiOSAudioSession *m_end;\n    \n\tCiOSPlatform *m_platform;\n\tAudioFileMemory m_encFile;\nprivate:\n\tvoid initBGM();\n\tvoid playBGM();\n\tvoid initSE();\n\tvoid playSE(s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 1.0f);\n    \n\tvoid cleanup();\n    \n\tvoid sendQueue(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer);\n    \n\tstatic void queueCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer);\n};\n\n#endif // CiOSAudio_h\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSAudioManager.h",
    "content": "#ifndef CiOSAudioManager_h\n#define CiOSAudioManager_h\n\n\n#import <GLKit/GLKit.h>\n#import <mach/time_value.h>\n#import <Foundation/Foundation.h>\n#import <AudioToolbox/AudioToolbox.h>\n#import <AudioToolbox/ExtendedAudioFile.h>\n#import <AudioToolbox/AudioFile.h>\n\n#import \"CiOSPlatform.h\"\n#import \"CiOSAudio.h\"\n\n#define IOS_HARDWARE_IO_BUFFER_SIZE     (256)   // IOバッファサイズ(最小128の最大1024くらいまでの2の乗数倍の値推奨)\n\nclass CiOSAudioManager\n{\npublic:\n\t// サウンドの割り込みタイプ\n\tenum eINTERRUPTION_TYPE {\n\t\teINTERRUPTION_TYPE_NONE = -1,\n        \n\t\teINTERRUPTION_TYPE_CALLING = 0,         //!< 電話、Siriなどの割り込み\n\t\teINTERRUPTION_TYPE_RESIGN_ACTIVE,       //!< ホームボタンダブルタップなどによる非アクティブ状態\n\t\teINTERRUPTION_TYPE_ENTER_BACKGROUND,    //!< ホームボタンなどによるアプリがバックグラウンドにある状態\n        \n\t\teINTERRUPTION_TYPE_MAX\n\t};\n    \nprivate:\n\tCiOSAudioManager();\n\tvirtual ~CiOSAudioManager();\n\tconst CiOSAudioManager& operator = (const CiOSAudioManager &_manager) { return *this; }\n    \npublic:\n\t//! インスタンスの取得\n\tstatic CiOSAudioManager& GetInstance(void) {\n\t\treturn m_instance;\n\t}\n    \n\t//! 初期化処理\n\tbool Initialize(void);\n    \n\t//! 終了処理\n\tbool Termination(void);\n    \n\t//! サウンドハンドル作成\n\tvoid *CreateAudioHandle(const char *_url, CiOSPlatform *_platform);\n    \n\t//! AudioSessionの初期化\n\tbool AudioSessionInit(void);\n    \n\t//! AudioSessionプロパティの設定\n\tbool AudioSessionPropertySetting(void);\n    \n\t//! 割り込み開始処理\n\tvoid AudioBeginInterruption(void);\n    \n\t//! 割り込み終了処理\n\tvoid AudioEndInterruption(void);\n    \n\t//! 非アクティブになる瞬間の処理\n\tvoid AudioDidResignActive(void);\n    \n\t//! アクティブに戻る瞬間の処理\n\tvoid AudioDidBecomeActive(void);\n    \n\t//! バックグラウンドに行く瞬間の処理\n\tvoid AudioDidEnterBackground(void);\n    \n\t//! バックグラウンドから戻る際の処理\n\tvoid AudioDidEnterForeground(void);\n    \n\t//! サウンドとミュージックの並行処理タイプ\n\tvoid SetAudioMultiProcessType(s32 _type);\n    \n\tinline s32 GetAudioMultiProcessType(void) {\n\t\treturn m_multiProcessType;\n\t}\n    \n\t//! サウンドの割り込み処理をエンジン側で制御するかどうか\n\tinline void setPauseOnInterruption(bool _bPauseOnInterruption) {\n\t\tm_bPauseOnInterruption = _bPauseOnInterruption;\n\t}\n    \n\tinline bool getPauseOnInterruption(void) {\n\t\treturn m_bPauseOnInterruption;\n\t}\n    \n\t//! iPodミュージックプレーヤーの再生状態取得\n\tbool isMusicPlayerPlaying(void);\n    \n\t//! 音量設定\n\tvoid SetSEMasterVolume(float _vol);\n\tvoid SetBGMMasterVolume(float _vol);\n\tfloat GetSEMasterVolume(void);\n\tfloat GetBGMMasterVolume(void);\n\tvoid UpdateVolume(void);\n    \n\t//! 現在の設定によりマスターボリュームのON/OFF\n\tvoid chackAudioMasterVolume(void);\n    \n\t//! 毎フレーム行う処理\n\tvoid Exec(void);\n    \nprivate:\n\tstatic CiOSAudioManager m_instance;\n    \nprivate:\n\tenum {\n\t\tSND_SLOT = 256     // サウンドスロット数\n\t};\n\tCiOSAudio m_audio[SND_SLOT];\n    \n\t// サウンドとミュージックの並行処理タイプ\n\ts32 m_multiProcessType;\n    \n\t// ボリューム関係\n\tfloat m_masterVol_se;           //!< SEのマスターボリューム\n\tfloat m_masterVol_bgm;          //!< BGMのマスターボリューム\n    \n\t// サウンドのON/OFF\n\tbool m_bSEOff;                  //!< SE\n\tbool m_bBGMOff;                 //!< BGM\n    \n\t//\n\tbool m_bInit;                   //!< 初期化フラグ\n    \n\tbool m_bPauseOnInterruption;        //!< サウンドのPauseをエンジン側で制御するかどうか\n};\n\n#endif // CiOSAudioManager_h\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSMovieView.h",
    "content": "#ifndef CiOSMovieView_h\n#define CiOSMovieView_h\n\n\n#import <AVFoundation/AVFoundation.h>\n\n@interface CiOSMovieView {\n}\n\n@end\n\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSPathConv.h",
    "content": "#ifndef CiOSPathConv_h\n#define CiOSPathConv_h\n\n#include \"iOSFileLocation.h\"\n\nclass CiOSPathConv\n{\nprivate:\n\tCiOSPathConv();\n\tvirtual ~CiOSPathConv();\n    \npublic:\n\tstatic CiOSPathConv& getInstance();\n    \n\tconst char *fullpath(const char *url, const char *suffix = 0, bool *isReadOnly = NULL);\n    \n\tconst char *install() {\n\t\tbuild(); return m_install;\n\t}\n    \n\tconst char *external() {\n\t\tbuild(); return m_external;\n\t}\n    \nprivate:\n\tconst char *makePath(const char *path, const char *suffix, const char *base);\n\tbool checkExists(const char *path);\n    \n\tvoid build();\n\tvoid create_external();\n\tvoid create_install();\n    \nprivate:\n\tbool m_build;\n\tconst char *m_external;\n\tconst char *m_install;\n};\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSPlatform.h",
    "content": "/*!\n ¥brief     iOS 用プラットフォーム側インタフェースクラス\n ¥file      CiOSPlatform.h\n ¥author    Yoshihito Kira\n */\n#ifndef CiOSPlatform_h\n#define CiOSPlatform_h\n\n#import <StoreKit/StoreKit.h>\n#import \"ViewController.h\"\n#include \"CPFInterface.h\"\n#include \"FileSystem.h\"\n#include \"CiOSAudioManager.h\"\n#include \"CiOSWidget.h\"\n#include \"EAGLView.h\"\n\nclass CiOSPlatform : public IPlatformRequest\n{\n\tfriend class CiOSWidget;\n\tfriend class CiOSTextWidget;\n\tfriend class CiOSFont;\n\tfriend void assertFunction(int line, const char *file, const char *msg, ...);\n    \npublic:\n\tCiOSPlatform(EAGLView * pView, float scale);\n\tvirtual ~CiOSPlatform();\n    \n\tvoid detailedLogging(const char *basefile, const char *functionName, int lineNo, const char *format, ...);\n\tvoid logging(const char *format, ...);\n    \n\tconst char *getBundleVersion();\n    \n\t//! Use Encryption for disk I/O\n\tvirtual bool useEncryption();\n    \n\ts64 nanotime();\n    \n\t// ファイルシステム\n\tIReadStream *openReadStream(const char *filename, bool decrypt);\n    \n\tITmpFile *openTmpFile(const char *tmpPath);\n\tvoid removeTmpFile(const char *tmpPath);\n\tvirtual bool removeFileOrFolder(const char *filePath);\n\tvirtual u32 getFreeSpaceExternalKB();\n\tvirtual u32 getPhysicalMemKB();\n\tvoid excludePathFromBackup(const char *fullpath);\n    \n\tvirtual void *ifopen(const char *name, const char *mode);\n\tvirtual void ifclose(void *file);\n\tvirtual int ifseek(void *file, long int offset, int origin);\n\tvirtual u32 ifread(void *ptr, u32 size, u32 count, void *file);\n\tvirtual u32 ifwrite(const void *ptr, u32 size, u32 count, void *file);\n\tvirtual int ifflush(void *file);\n\tvirtual long int iftell(void *file);\n\tvirtual bool icreateEmptyFile(const char *name);\n    \n\t// サウンド系\n\tvoid *loadAudio(const char *url, bool is_se = false);\n\tbool preLoad(void *handle);\n\tbool setBufSize(void *handle, int level);\n\tvoid playAudio(void *handle, s32 _msec = 0, float _tgtVol = 1.0f, float _startVol = 0.0f);\n\tvoid stopAudio(void *handle, s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid setMasterVolume(float volume, bool SEmode);\n\tvoid setAudioVolume(void *handle, float volume);\n\tvoid setAudioPan(void *handle, float pan);\n\tvoid releaseAudio(void *handle);\n    \n\tvoid pauseAudio(void *handle, s32 _msec = 0, float _tgtVol = 0.0f);\n\tvoid resumeAudio(void *handle, s32 _msec = 0, float _tgtVol = 1.0f);\n\tvoid seekAudio(void *handle, s32 millisec);\n\ts32 tellAudio(void *handle);\n\ts32 totalTimeAudio(void *handle);\n\tvoid setFadeParam(void *_handle, float _tgtVol, u32 _msec);\n    \n\ts32 getState(void *handle);\n    \n\t//! サウンドとミュージックの並行処理タイプ設定\n\tvoid setAudioMultiProcessType(s32 _processType);\n    \n\t//! サウンドの割り込み処理をエンジン側で制御するかどうか\n\tvoid setPauseOnInterruption(bool _bPauseOnInterruption);\n    \n\t//! 経過時間を取得(sec)\n\ts64 getElapsedTime(void);\n    \n\t//! フォント取得\n\tbool registerFont(const char *logicalName, const char *physFile, bool default_);\n\tvoid *getFont(int size, const char *fontName = 0, float *pAscent = NULL);\n\tvoid *getFontSystem(int size, const char *fontName = 0);\n    \n\t//! フォント破棄\n\tvoid deleteFont(void *pFont);\n\tvoid deleteFontSystem(void *pFont);\n    \n\t//! フォントテクスチャ描画\n\tbool renderText(const char *utf8String, void *pFont, u32 color,     //!< 描画する文字列とフォントの指定\n\t                u16 width, u16 height, u8 *pBuffer8888,             //!< 描画対象とするテクスチャバッファとそのピクセルサイズ\n\t                s16 stride, s16 base_x, s16 base_y, bool use4444);                //!< baseline起点とするテクスチャ内の位置\n    \n\t// フォントテクスチャ描画情報\n\tbool getTextInfo(const char *utf8String, void *pFont, STextInfo *pReturnInfo);\n    \n\tvoid *getGLExtension(const char *ext);\n    \n\t// 環境上でのフルパス取得\n\tconst char *getFullPath(const char *assetPath, bool *isReadOnly);\n    \n\t//! 動作環境情報文字列を返す。\n\tconst char *getPlatform();\n    \n\t//! OSコントロールの生成と破棄\n\tIWidget *createControl(IWidget::CONTROL type, int id,\n\t                       const char *caption, int x, int y, int width, int height, ...);\n\tvoid destroyControl(IWidget *pControl);\n    \n\tbool callApplication(APP_TYPE type, ...);\n    \n\tvoid *createThread(s32 (*thread_func)(void *hThread, void *data), void *data);\n\tvoid exitThread(void *hThread, s32 status);\n\tbool watchThread(void *hThread, s32 *status);\n\tvoid deleteThread(void *hThread);\n\tvoid breakThread(void *hThread);\n    \n\tint genUserID(char *retBuf, int maxlen);\n\tint genUserPW(const char *salt, char *retBuf, int maxlen);\n    \n\tbool readyDevID();\n\tint getDevID(char *retBuf, int maxlen);\n    \n\tbool setSecureDataID(const char *service_name, const char *user_id);\n\tbool setSecureDataPW(const char *service_name, const char *pw);\n\tint getSecureDataID(const char *service_name, char *retBuf, int maxlen);\n\tint getSecureDataPW(const char *service_name, char *retBuf, int maxlen);\n    \n\tbool delSecureDataID(const char *service_name);\n\tbool delSecureDataPW(const char *service_name);\n    \n\tvoid initStoreTransactionObserver(void);\n\tvoid releaseStoreTransactionObserver(void);\n\tvoid buyStoreItems(const char *item_id);\n\tvoid getStoreProducts(const char *json, bool currency_mode);\n\tvoid finishStoreTransaction(const char *receipt);\n    \n\tinline EAGLView *getView() const {\n\t\treturn m_pView;\n\t}\n    \n\tinline float getScale() const {\n\t\treturn m_scale;\n\t}\n    \n\tfloat getMasterVolume(bool SEmode) const;\n    \n\tstatic CiOSPlatform *getInstance();\n    \n\tvirtual void *allocMutex();\n\tvirtual void freeMutex(void *mutex);\n\tvirtual void mutexLock(void *mutex);\n\tvirtual void mutexUnlock(void *mutex);\n    \n\tvirtual void *allocEventLock();\n\tvirtual void freeEventLock(void *lock);\n\tvirtual void eventSleep(void *lock);\n\tvirtual void eventWakeup(void *lock);\n    \n\tvoid startAlertDialog(const char *title, const char *message) {\n\t}\n    \n\tvoid forbidSleep(bool is_forbidden);\n    \nprivate:\n\tstruct PF_THREAD {\n\t\tjmp_buf jmp;\n\t\tpthread_t id;\n\t\ts32 (*thread_func)(void *, void *);\n\t\tvoid *data;\n\t\ts32 result;\n\t};\n\tstatic void *ThreadProc(void *data);\n    \n\tbool setKeyChain(const char *service_name, const char *key, const char *value);\n\tint getKeyChain(const char *service_name, const char *key, char *retBuf, int maxlen);\n\tbool delKeyChain(const char *service_name, const char *key);\n    \n\tint sha512(const char *string, char *buf, int maxlen);\n    \n\tEAGLView *m_pView;\n\tfloat m_scale;\n    \n\tenum {\n\t\tSTORE_NONE,\n\t\tSTORE_BUY_PRODUCTS,\n\t\tSTORE_GET_PRODUCTS\n\t};\n\tstruct StoreState\n\t{\n\t\tint m_mode;\n\t\tint m_count;\n\t\tbool m_currency;\n\t\tconst char *m_callback;\n\t} m_storeState;\n    \n\tchar m_platform[256];\n    \n\tstatic CiOSPlatform *m_instance;\n};\n\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSReadFileStream.h",
    "content": "#ifndef CiOSReadFileStream_h\n#define CiOSReadFileStream_h\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n#include \"encryptFile.h\"\n\nclass CiOSWriteFileStream;\n\n// ファイルアクセスクラス実装\nclass CiOSReadFileStream : public IReadStream\n{\n\tfriend class CiOSWriteFileStream;\nprivate:\n\ttypedef struct {\n\t\tconst char *top;\n\t\tint loc;                // 0 で　install, 1 で external\n\t\tbool readonly;          // true の場合、その領域には書き込めない\n\t} LOCLIST;\n\tstatic const LOCLIST m_toplevel[];\n    \n\t// ファクトリとなるクラスメソッド以外で勝手に new はできない\n\tCiOSReadFileStream();\n    \n\tinline void decrypt(void *ptr, u32 length) {\n\t\tm_decrypter.decryptBlck(ptr, length);\n\t}\n    \npublic:\n\t// delete はできる。\n\tvirtual ~CiOSReadFileStream();\n\tinline u32 decryptSetup(const u8 *ptr) {\n\t\tu8 hdr[4];\n\t\thdr[0] = 0;\n\t\thdr[1] = 0;\n\t\thdr[2] = 0;\n\t\thdr[3] = 0;\n        \n\t\tif (m_fp) {\n\t\t\tfread(hdr, 1, 4, m_fp);\n\t\t}\n        \n\t\tu32 res = m_decrypter.decryptSetup(ptr, hdr);\n\t\tif (res == 0) {\n\t\t\tif (m_fp) {\n\t\t\t\tfseek(m_fp, 0, SEEK_SET);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n    \n\t// 指定されたパスで CiOSReadStream インスタンスを作り、そのポインタを返す。\n\tstatic CiOSReadFileStream *openStream(const char *path, const char *home);\n    \n\t// 指定されたパス名称を EXTERN -> INSTALL の順に検索し、先に見つかった方でCiOSReadStreamインスタンスを作る。\n\tstatic CiOSReadFileStream *openAssets(const char *path, const char *home);\n    \n\ts32 getSize();\n\ts32 getPosition();\n\tu8 readU8();\n\tu16 readU16();\n\tu32 readU32();\n\tfloat readFloat();\n\tbool readBlock(void *buffer, u32 byteSize);\n\tESTATUS getStatus();\n    \n\tint readU16arr(u16 *pBufferU16, int items);\n\tint readU32arr(u32 *PBufferU32, int items);\n    \n\tIWriteStream *getWriteStream();\n    \nprivate:\n\tCDecryptBaseClass m_decrypter;\n    \n\tconst char *m_fullpath; //!< オープン後は基本不要だが、ファイルの物理的フルパス文字列\n\tESTATUS m_eStat;\n\tFILE *m_fp;\n\tint m_fd;\n\tbool m_bReadOnly;           // true のときは read only なので、CiOSWriteStreamを返さない。\n\tCiOSWriteFileStream *m_writeStream;\n    \n#ifdef DEBUG_MEMORY\n\tCiOSReadFileStream *m_pPrev;\n\tCiOSReadFileStream *m_pNext;\n    \n\tstatic CiOSReadFileStream *ms_pBegin;\n\tstatic CiOSReadFileStream *ms_pEnd;\n#endif\n};\n\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSSysResource.h",
    "content": "#ifndef CiOSSysResource_h\n#define CiOSSysResource_h\n\nclass CiOSSysResource\n{\nprivate:\n\tCiOSSysResource();\n\tvirtual ~CiOSSysResource();\npublic:\n\tstatic CiOSSysResource& getInstance();\n    \n\tvoid requestDevID();\n\tbool failedDevID();\n\tbool setDevID(const void *devToken);\n\tint getDevID(char *retBuf, int maxlen);\n    \n\tinline bool isReceived() {\n\t\treturn m_devId_received;\n\t}\n    \n\tinline bool isSucceed() {\n\t\treturn m_devId_succeed;\n\t}\n    \nprivate:\n\tunsigned char m_devId[32];\n\tint m_size_devId;\n\tbool m_devId_received;\n\tbool m_devId_succeed;\n};\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSTextView.h",
    "content": "#ifndef CiOSTextView_h\n#define CiOSTextView_h\n\n@interface CiOSTextView\n{\n\tNSString *m_pFontName;              // フォント名\n\tNSString *m_placeHolder;            // プレースホルダ文字列\n}\n\n@property (nonatomic, retain) NSString *m_pFontName;\n@property (nonatomic, retain) NSString *m_placeHolder;\n\n- (id)init;\n- (void)dealloc;\n- (void)awakeFromNib;\n- (id)initWithFrame:(CGRect)frame;\n- (void)setText:(NSString *)text;\n- (void)drawRect:(CGRect)rect;\n\n// 文字の入力数を確認しプレースホルダの機能を仕様\n- (void)changedPlaceHolder:(NSNotification *)_notfication;\n\n// プレースホルダの文字列を設定\n- (void)setPlaceHolderString:(NSString *)_string;\n\n@end\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSTmpFile.h",
    "content": "#ifndef CiOSTmpFile_h\n#define CiOSTmpFile_h\n\n#include <iostream>\n#include \"ITmpFile.h\"\n\nclass CiOSTmpFile : public ITmpFile\n{\npublic:\n\tCiOSTmpFile(const char *tmpPath);\n\tvirtual ~CiOSTmpFile();\n    \n\tsize_t writeTmp(void *ptr, size_t size);\n    \n\tinline bool isReady() {\n\t\treturn (m_fd > 0) ? true : false;\n\t}\n    \nprivate:\n\tconst char *m_fullpath;\n\tint m_fd;\n};\n\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSWebView.h",
    "content": "#ifndef CiOSWebView_h\n#define CiOSWebView_h\n\n@interface CiOSWebView {\n@private\n\tNSString *m_token;\n\tNSString *m_region;\n\tNSString *m_client;\n\tNSString *m_cKey;\n\tNSString *m_appID;\n\tNSString *m_userID;\n    \n\tNSString *m_os;\n\tNSString *m_version;\n\tNSString *m_timezone;\n}\n\n- (void)setCustomHeaders:(const char *)token:(const char *)region:(const char *)client:(const char *)consumerKey:(const char *)applicationId:(const char *)userId:(const char *)env;\n\n@end\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSWidget.h",
    "content": "#ifndef CiOSWidget_h\n#define CiOSWidget_h\n\n#include \"CiOSPlatform.h\"\n#import \"CiOSWebView.h\"\n#import \"CiOSMovieView.h\"\n#import \"CiOSTextView.h\"\n#include \"OSWidget.h\"\n\nclass CiOSFont;\nclass CiOSPlatform;\n\n// iOS用の基本形\nclass CiOSWidget : public IWidget\n{\nprotected:\n\tCiOSWidget(CiOSPlatform * pParent);\n\tvirtual ~CiOSWidget();\n    \npublic:\n\tbool init(int id, int x, int y, int width, int height);\n    \n\tvoid move(int x, int y);\n\tvoid resize(int width, int height);\n\tvirtual void visible(bool bVisible) = 0;\n\tvirtual void enable(bool bEnable) = 0;\n    \n\tvirtual void cmd(int cmd, ...);\n\tvirtual int status();\n    \n\tinline void size_recovery() {\n\t\tset_move(m_x, m_y, m_width, m_height);\n\t}\n    \nprotected:\n\tinline CiOSPlatform& getPlatform() const {\n\t\treturn *m_pPlatform;\n\t}\n    \n\tinline float getScale() const {\n\t\treturn m_scale;\n\t}\n    \n\tvirtual void set_move(int x, int y, int width, int height) = 0;\n    \nprotected:\n\tfloat m_scale;\n\tint m_x;\n\tint m_y;\n\tint m_width;\n\tint m_height;\n    \n\tint m_id;\n\tCiOSPlatform *m_pPlatform;\n};\n\n// iOS WebView\nclass CiOSWebWidget : public CiOSWidget\n{\n\tfriend class CiOSPlatform;\nprivate:\n\tCiOSWebWidget(CiOSPlatform * pParent);\n\tvirtual ~CiOSWebWidget();\npublic:\n\tbool create(CONTROL type, int id,\n\t            const char *caption, int x, int y, int width, int height,\n\t            const char *token, const char *region, const char *client,\n\t            const char *consumerKey, const char *applicationId, const char *userID);\n    \n\tint getTextLength();\n\tbool getText(char *pBuf, int maxlen);\n\tbool setText(const char *string);\n\tvoid visible(bool bVisible);\n\tvoid enable(bool bEnable);\n    \n\tvoid cmd(int cmd, ...);\n    \n\tinline bool getJump() const {\n\t\treturn m_bJump || m_bFirst;\n\t}\n    \n\tinline void setFirst() {\n\t\tm_bFirst = false;\n\t}\n    \nprivate:\n\tvoid set_move(int x, int y, int width, int height);\n\tvoid set_bgcolor();\n    \n\tbool m_bJump;\n\tbool m_bFirst;\n\tconst char *m_pNowURL;\n\tCiOSWebView *m_pWebView;\n    \n\tchar m_bufURL[1024];\n\tunsigned int m_bgalpha;             // 背景色のアルファ値\n\tunsigned int m_bgcolor;             // 背景色\n    \n\tCiOSWebWidget *m_prev;\n\tCiOSWebWidget *m_next;\n    \n\tstatic CiOSWebWidget *ms_begin;\n\tstatic CiOSWebWidget *ms_end;\n};\n\nclass CiOSMovieWidget : public CiOSWidget\n{\n\tfriend class CiOSPlatform;\nprivate:\n\tCiOSMovieWidget(CiOSPlatform * pParent);\n\tvirtual ~CiOSMovieWidget();\npublic:\n\tbool create(CONTROL type, int id,\n\t            const char *caption, int x, int y, int width, int height);\n    \n\tint getTextLength();\n\tbool getText(char *pBuf, int maxlen);\n\tbool setText(const char *string);\n\tvoid visible(bool bVisible);\n\tvoid enable(bool bEnable);\n    \n\tvoid cmd(int cmd, ...);\n\tint status();\n    \n\tinline void setStatus(int stat) {\n\t\tm_status = stat;\n\t}\n    \n\tstatic CiOSMovieWidget *getWidget(void *p);\n    \nprivate:\n\tvoid set_move(int x, int y, int width, int height);\n    \n\tCONTROL m_type;\n    \n\tconst char *m_pNowPATH;\n\tCiOSMovieView *m_pMovieView;\n    \n\tint m_status;\n\tCiOSMovieWidget *m_prev;\n\tCiOSMovieWidget *m_next;\n    \n\tstatic CiOSMovieWidget *ms_begin;\n\tstatic CiOSMovieWidget *ms_end;\n};\n\nclass CiOSActivityIndicator : public CiOSWidget\n{\n\tfriend class CiOSPlatform;\nprivate:\n\tCiOSActivityIndicator(CiOSPlatform * pParent);\n\tvirtual ~CiOSActivityIndicator();\npublic:\n\tbool create(CONTROL type, int id,\n\t            const char *caption, int x, int y, int width, int height);\n    \n\tint getTextLength();\n\tbool getText(char *pBuf, int maxlen);\n\tbool setText(const char *string);\n\tvoid visible(bool bVisible);\n\tvoid enable(bool bEnable);\n    \n\tvoid cmd(int cmd, ...);\n\tint status();\n    \nprivate:\n\tvoid set_move(int x, int y, int width, int height);\n    \n\tbool m_bVisible;\n\tint m_status;\n\tfloat m_size;\n    \n\tCiOSActivityIndicator *m_prev;\n\tCiOSActivityIndicator *m_next;\n    \n\tstatic CiOSActivityIndicator *ms_begin;\n\tstatic CiOSActivityIndicator *ms_end;\n};\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CiOSWriteFileStream.h",
    "content": "#ifndef CiOSWriteFileStream_h\n#define CiOSWriteFileStream_h\n\n\n#include \"BaseType.h\"\n#include \"FileSystem.h\"\n\nclass CiOSReadFileStream;\n\nclass CiOSWriteFileStream : public IWriteStream\n{\n\tfriend class CiOSReadFileStream;\nprivate:\n\tCiOSWriteFileStream(CiOSReadFileStream & rdStream);\n\tvirtual ~CiOSWriteFileStream();\n    \npublic:\n\tESTATUS getStatus();\n\ts32 getPosition();\n\tvoid writeU8(u8 value); // Use cast to support s8\n\tvoid writeU16(u16 value);   // Use cast to support s16\n\tvoid writeU32(u32 value);   // Use cast to support s32\n\tvoid writeFloat(float);\n\tvoid writeBlock(void *buffer, u32 byteSize);\n    \nprivate:\n\tint m_fd;\n\tFILE *m_fp;\n    \n\tESTATUS m_eStat;\n};\n\n#endif // CiOSWriteFileStream_h\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/CompositeManagement.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __COMPOSITE_MGT__\r\n#define __COMPOSITE_MGT__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"DataSet.h\"\r\n\r\nclass CKLBInnerDef;\r\nclass CKLBAnimInfo;\r\n\r\n#define\tTMP_COMPOSITE_ASSET_STR_BUFFSIZE\t(10000)\r\n\r\n/*!\r\n* \\class CKLBCompositeAsset\r\n* \\brief Composite Asset Class\r\n* \r\n* CKLBCompositeAsset is an asset defining a \"Form\". \r\n* A Form is basically a tree of visual tasks and components.\r\n* It allows to create a scene formed with tasks and UI objects without having to \r\n* heavily rely on scripting. \r\n* Instead, a loader performs object creation and property setup.\r\n*/\r\nclass CKLBCompositeAsset : public CKLBAsset {\r\n\tfriend class CKLBCompositeAssetPlugin;\r\n\tfriend class CKLBInnerDef;\r\n\tfriend class CKLBAnimInfo;\r\npublic:\r\n\tCKLBCompositeAsset\t();\r\n\t~CKLBCompositeAsset\t();\r\n\r\n\tvoid\t\t\t\tsetGroupID(u16 groupID)\t\r\n\t\t\t\t\t\t\t\t\t\t\t{\tm_groupID = groupID;\t}\r\n\tvirtual u32\t\t\tgetClassID()\t\t{ return CLS_ASSETCOMPOSITE; }\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 priorityBase = 0);\r\n\tCKLBNode*\t\t\tcreateSubTree(CKLBUITask* pParentTask, u32 priorityBase = 0); \r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_COMPOSITE; }\r\n\r\n\tvoid setRecord(IDataSource* source, IDataRecord record);\r\n\r\n\tvoid* parserCtx;\r\n\r\n\tinline s16 get_width() const { return m_width; }\r\n\tinline s16 get_height() const { return m_height; }\r\n\r\n\tenum FIELD_ENUM {\r\n\t\tX_FIELD,\r\n\t\tY_FIELD,\r\n\t\tSX_FIELD,\r\n\t\tSY_FIELD,\r\n\t\tSW_FIELD,\r\n\t\tSH_FIELD,\r\n\t\tLAYOUT_INFO_FIELD,\r\n\t\tLW_FIELD,\r\n\t\tLH_FIELD,\r\n\t\tCLASS_FIELD,\r\n\t\tON_CLICK,\r\n\t\tASSET_FIELD,\r\n\t\tASSET_DISABLED_FIELD,\r\n\t\tASSET_FOCUS_FIELD,\r\n\t\tASSET_PUSH_FIELD,\r\n\t\tASSET_4,\r\n\t\tASSET_5,\r\n\t\tASSET_6,\r\n\t\tASSET_7,\r\n\t\tASSET_8,\r\n\t\tASSET_9,\r\n\t\tSUB_FIELD,\r\n\t\tPRIORITY_FIELD,\r\n\t\tRADIO_FIELD,\r\n\t\tNAME_FIELD,\r\n\t\tTEXT_FIELD,\r\n\t\tID,\r\n\t\tCLIPX,\r\n\t\tCLIPY,\r\n\t\tCLIPW,\r\n\t\tCLIPH,\r\n\t\tCLIPSTART,\r\n\t\tCLIPEND,\r\n\t\tFONT_SIZE_FIELD,\r\n\t\tFONT_NAME_FIELD,\r\n\t\tCOLOR_FIELD,\r\n\t\tWIDTH_FIELD,\r\n\t\tHEIGHT_FIELD,\r\n\t\tANIM_TYPE,\t\t// Str\r\n\t\tANIM_EASING,\r\n\t\tANIM_LENGTH,\r\n\t\tANIM_SHIFT,\r\n\t\tANIM_FROMX,\r\n\t\tANIM_TOX,\r\n\t\tANIM_FROMY,\r\n\t\tANIM_TOY,\r\n\t\tANIM_FROMSCALE,\t// Float\r\n\t\tANIM_TOSCALE,\t// Float\r\n\t\tANIM_FROMALPHA,\r\n\t\tANIM_TOALPHA,\r\n\t\tANIM_FROMCOLOR,\r\n\t\tANIM_TOCOLOR,\r\n\t\tSTATES_FIELD,\r\n\t\tXSCALE_FIELD,\r\n\t\tYSCALE_FIELD,\r\n\t\tROTATION_FIELD,\r\n\t\tANIM_LOOP,\r\n\t\tANIM_PINGPONG,\r\n\t\tANIM_DATA,\r\n\t\tANIM_FROMSCALE_X,\t// Float\r\n\t\tANIM_TOSCALE_X,\t\t// Float\r\n\t\tANIM_FROMSCALE_Y,\t// Float\r\n\t\tANIM_TOSCALE_Y,\t\t// Float\r\n\t\tANIM_FROM_ROTATION,\r\n\t\tANIM_TO_ROTATION,\r\n\t\tVALUE_FIELD,\r\n\t\tCALLBACK_FIELD,\r\n\t\tORIENTATION_FIELD,\r\n\t\tALIGN_FIELD,\r\n\t\tASSET_0_FIELD,\r\n\t\tASSET_1_FIELD,\r\n\t\tPRIORITY_OFFSET_FIELD,\r\n\t\tSTART_PIX_FIELD,\r\n\t\tEND_PIX_FIELD,\r\n\t\tANIM_TIME_FIELD,\r\n\t\tDRAG_ALPHA_FIELD,\r\n\t\tCENTER_X_FIELD,\r\n\t\tCENTER_Y_FIELD,\r\n\t\tFLAG_0_FIELD,\r\n\t\tFLAG_1_FIELD,\r\n\t\tINT_0_FIELD,\r\n\t\tINT_1_FIELD,\r\n\t\tINT_2_FIELD,\r\n\t\tINT_3_FIELD,\r\n\t\tINT_4_FIELD,\r\n\t\tINT_5_FIELD,\r\n\t\tURL_FIELD,\r\n\t\tALLOW_NAVIGATION_FIELD,\r\n\t\tPRIO_OFFSET_FIELD,\r\n\t\tCENTERX_FIELD,\r\n\t\tCENTERY_FIELD,\r\n\t\tBASEINVISIBLE_FIELD,\r\n\t\tSTEPX_FIELD,\r\n\t\tSTEPY_FIELD,\r\n\t\tNUMBERCOUNT_FIELD,\r\n\t\tFILLZERO_FIELD,\r\n\t\tANIMATE_FIELD,\r\n\t\tSOUNDUP_FIELD,\r\n\t\tSOUNDDOWN_FIELD,\r\n\t\tENABLE_FIELD,\r\n\t\tSTARTANGLE_FIELD,\r\n\t\tENDANGLE_FIELD,\r\n\t\tMINVALUE,\r\n\t\tMAXVALUE,\r\n\t\tMINSLIDERSIZE,\r\n\t\tSLIDERSIZE,\r\n\t\tSELECTCOLOR,\r\n\t\tMAXVERTEX,\r\n\t\tMAXINDEX,\r\n\t\tSPLINE_MASK,\r\n\t\tSPLINE_COUNT,\r\n\t\tSPLINE_ARRAY,\r\n\t\tSPLINE_LENGTH,\r\n\t\tGENERIC_FIELD,\r\n\t\tISPASSWORD_FIELD,\r\n\t\tVARCLIP_FIELD,\r\n\t\tCOUNTCLIP_FIELD,\r\n\t\tPLACEHOLDER_FIELD,\r\n\t\tVISIBLE_FIELD,\r\n\t\tMAXLENGTH,\r\n\t\tCHARTYPE,\r\n\t\tVOL_AUDIO_UP,\r\n\t\tVOL_AUDIO_DOWN,\r\n\t};\r\nprivate:\r\n\tbool init();\r\n\tbool createSubTreeRecursive(u16 groupID, CKLBUITask* pParentTask, CKLBNode* parent, CKLBInnerDef* parentTemplate, u32 priorityOffset);\r\n\r\n\tvoid setupNode(CKLBInnerDef* templateDef, CKLBNode* node);\r\n\tvoid setupTask(CKLBInnerDef* templateDef, CKLBUITask* tsk);\r\n\r\n\tstruct STRINGENTRY {\r\n\t\tSTRINGENTRY();\r\n\t\t~STRINGENTRY();\r\n\r\n\t\tSTRINGENTRY*\t\tnext;\r\n\t\tCKLBAsset*\t\t\tassetCache;\r\n\t\tchar*\t\t\t\tstring;\r\n\t};\r\n\r\n\tSTRINGENTRY*\tm_allocatedString;\r\n\r\n\tu16\t\t\tm_groupID;\r\n\t//\r\n\t// Parser Stuff.\r\n\t//\r\n\tu16\t\t\tm_parserField;\r\n\tchar*\t\tallocateString(const unsigned char* string, u32 strLen, bool* err);\r\n\t\r\n\tSTRINGENTRY* registerString(const char* string, u32 strLen, bool* err);\r\n\r\nprivate:\r\n\t// UI and composite with 32 levels are good enough.\r\n\t#define MAX_STACK_DEPTH\t\t\t\t(32)\r\n\tfloat*\t\t\tm_currArraySpline;\r\n\tIDataSource*\tm_pSource;\r\n\tIDataRecord\t\tm_record;\r\n\tCKLBInnerDef*\tm_pCurrInnerDef;\r\n\tCKLBAnimInfo*\tm_pCurrAnim;\r\n\tCKLBInnerDef*\tm_pParent;\r\n\tCKLBInnerDef*\tm_root;\r\n\tCKLBNode*\t\tm_rootParent;\r\n\tCKLBInnerDef*\tm_parentStack\t[MAX_STACK_DEPTH];\r\n\tu32\t\t\t\tm_basePriority;\r\n\ts16\t\t\t\tm_width;\r\n\ts16\t\t\t\tm_height;\r\n\tu16\t\t\t\tm_parent;\r\n\tu8\t\t\t\tm_recCount;\r\n\tu8\t\t\t\tmode;\r\n\tbool\t\t\tm_bTreeMode;\r\n\tbool\t\t\tm_bLowRes;\r\n\r\n\t//\r\n\t// Parser Call back.\r\n\t//\r\n\tint readStartMap\t(unsigned int size);\r\n\tint readNull\t\t();\r\n\tint readBoolean\t\t(int boolean);\r\n\tint readInt\t\t\t(long long integerVal);\r\n\tint readDouble\t\t(double doubleVal);\r\n\tint readString\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readMapKey\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readEndMap\t\t();\r\n\tint readStartArray\t(unsigned int size);\r\n\tint readEndArray\t();\r\n\r\n\tstatic int read_start_map\t(void * ctx, unsigned int size);\r\n\tstatic int read_null\t\t(void * ctx);\r\n\tstatic int read_boolean\t\t(void * ctx, int boolean);\r\n\tstatic int read_int\t\t\t(void * ctx, long long integerVal);\r\n\tstatic int read_double\t\t(void * ctx, double doubleVal);\r\n\tstatic int read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_end_map\t\t(void * ctx);\r\n\tstatic int read_start_array\t(void * ctx, unsigned int size);\r\n\tstatic int read_end_array\t(void * ctx);\r\n\r\nprivate:\r\n\t//\r\n\t// Buffer for asset string name during loading.\r\n\t//\r\n\r\n\tvoid\t\t\tresetTmpBuff\t();\r\n\tconst char*\t\taddAssetPrefix\t(const char* prefixLessAsset);\r\n\tconst char*\t\tformatI\t\t\t(s32 i);\r\n\tconst char*\t\tformatB\t\t\t(bool i);\r\n\tconst char*\t\tformatF\t\t\t(float f);\r\n\tconst char*\t\taddString\t\t(const char* source, u32 len);\r\n\tconst char*\t\tfilterDB\t\t(const char* input, bool* filtered = NULL);\r\n\tfloat\t\t\tfilterDBFloat\t(CKLBCompositeAsset::STRINGENTRY* input, float original);\r\n\ts32\t\t\t\tfilterDBInt\t\t(CKLBCompositeAsset::STRINGENTRY* input, s32 original);\r\n\r\n\tstatic char\t\ttmpBuff[TMP_COMPOSITE_ASSET_STR_BUFFSIZE];\r\n\tstatic char*\tptrBuff;\r\n};\r\n\r\nclass CKLBCompositeAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tCKLBCompositeAssetPlugin();\r\n\t~CKLBCompositeAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID()\t\t\t\t{ return CHUNK_TAG('C','O','M','P'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader()\t\t\t\t{ return 'P';\t\t}\r\n\tvirtual const char*\t\t\tfileExtension()\t\t\t\t{ return \".json\"; \t}\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize);\r\n};\r\n\r\n//\r\n// Class holding tree definition.\r\n//\r\n\r\n#define MAX_HANDLER\t\t\t(2)\r\n#define MAX_ASSETS\t\t\t(10)\r\n\r\nclass CKLBAnimInfo;\r\nclass CKLBPropertyBag;\r\n\r\nclass CKLBInnerDefManager {\r\npublic:\r\n\tstatic bool initManager(int size);\r\n\tstatic void releaseManager();\r\n};\r\n\r\nclass CKLBInnerDef {\r\npublic:\r\n\tCKLBInnerDef();\r\n\t~CKLBInnerDef();\r\n\t\r\n\tstatic void* operator new\t\t(size_t size); \r\n\tstatic void  operator delete\t(void *p);\r\n\r\n\tCKLBAnimInfo*\tfindAnimation(const char* animName);\r\n\r\n\tCKLBInnerDef*\tnext;\r\n\tCKLBInnerDef*\tsub;\r\n\tCKLBAnimInfo*\tanim;\r\n\tCKLBPropertyBag*\tpropertyBag;\r\n\r\n\tfloat x;\r\n\tfloat y;\r\n\tfloat xscale;\r\n\tfloat yscale;\r\n\tfloat rotation;\r\n\t\r\n\tu32\tlayoutInfo;\r\n\tu32 priority;\r\n\ts32 value;\r\n\ts32\tradioID;\r\n\t\r\n\tCKLBCompositeAsset::STRINGENTRY*\tfontName;\r\n\tu32\tcolor;\r\n\r\n\tCKLBCompositeAsset::STRINGENTRY*\thandler\t[MAX_HANDLER];\r\n\tCKLBCompositeAsset::STRINGENTRY*\tassets\t[MAX_ASSETS];\r\n\r\n\tCKLBCompositeAsset::STRINGENTRY*\tname;\r\n\tCKLBCompositeAsset::STRINGENTRY*\ttext;\r\n\tCKLBCompositeAsset::STRINGENTRY*\tplaceholder;\r\n\tu32 priorityClipStart;\r\n\tu32 priorityClipEnd;\r\n\tu32 id;\r\n\r\n\tfloat*\tspline;\r\n\tCKLBCompositeAsset::STRINGENTRY*\tdbField[4];\r\n\tu32\tvariable[10];\r\n\r\n\ts16\tlw;\r\n\ts16\tlh;\r\n\tu16\tclassID;\r\n\ts16\tsx;\r\n\ts16\tsy;\r\n\ts16\tsh;\r\n\ts16\tsw;\r\n\tu16 fontSize;\r\n\ts16 clipx;\r\n\ts16 clipy;\r\n\ts16 clipw;\r\n\ts16 cliph;\r\n\ts16\twidth;\r\n\ts16 height;\r\n\tu16\tsplineMask;\r\n\tu16\tsplineCount;\r\n\tu16\tsplineLength;\r\n\tu8\tsplineVectorSize;\r\n\tu8\tvolAudioUp;\r\n\tu8\tvolAudioDown;\r\n\r\n\tu8\tflag[4];\r\n\tbool\tvisible;\r\n};\r\n\r\nclass CKLBAnimInfo {\r\npublic:\r\n\tCKLBAnimInfo();\r\n\t~CKLBAnimInfo();\r\n\r\n\tCKLBAnimInfo*\tm_next;\r\n\ts32*\tdata;\r\n\r\n\tCKLBCompositeAsset::STRINGENTRY*\tmode;\r\n\r\n\tfloat\tfromScaleX;\r\n\tfloat\ttoScaleX;\r\n\tfloat\tfromScaleY;\r\n\tfloat\ttoScaleY;\r\n\tfloat\tfromRotation;\r\n\tfloat\ttoRotation;\r\n\r\n\tu16\t\tdataSize;\r\n\tu16\t\tcurrSize;\r\n\r\n\tu16\t\tlength;\r\n\ts16\t\ttimeShift;\r\n\r\n\ts16\t\tfromX;\r\n\ts16\t\ttoX;\r\n\r\n\ts16\t\tfromY;\r\n\ts16\t\ttoY;\r\n\r\n\r\n\tu8\t\tfromAlpha;\r\n\tu8\t\ttoAlpha;\r\n\r\n\tu8\t\tfromR;\r\n\tu8\t\ttoR;\r\n\r\n\tu8\t\tfromG;\r\n\tu8\t\ttoG;\r\n\r\n\tu8\t\tfromB;\r\n\tu8\t\ttoB;\r\n\r\n\tu8\t\tspline;\r\n\tu8\t\tmodeID;\r\n\r\n\tu8\t\tloop;\r\n\tu8\t\tpingpong;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/DataSet.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef INCLUDE_DATASET_H\r\n#define INCLUDE_DATASET_H\r\n\r\n#include \"BaseType.h\"\r\n\r\nenum EMOVECODE {\r\n\tMOVE_SUCCEED,\r\n\tMOVE_EOF,\r\n\tMOVE_UNFETCH,\r\n};\r\n\r\ntypedef void*\tIDataRecord;\r\n\r\nclass IDataSource {\r\npublic:\r\n\tstatic const int\tTYPE_INT\t= 0;\r\n\tstatic const int\tTYPE_STR\t= 1;\r\n\tstatic const int\tTYPE_BOOL\t= 2;\r\n\tstatic const int\tTYPE_FLOAT\t= 3;\r\n\tstatic const int\tTYPE_NIL\t= 4;\r\n\tstatic const int\tTYPE_BLOB\t= 5;\r\n\t\r\n\tstatic\tIDataSource*\t\r\n\t\t\t\t\t\tdoQuery\t\t\t\t\t(const char* query);\r\n\tstatic\tvoid\t\treleaseQuery\t\t\t(IDataSource* pQuery);\r\n\t\r\n\t// -1 : Dynamic.\r\n\tvirtual\ts32\t\t\tgetTotalRecordCount\t\t() = 0;\r\n\t\r\n\t// Record loaded until now.\r\n\tvirtual s32\t\t\tgetCurrentRecordCount\t() = 0;\r\n\t\r\n\t// Request record if UNFETCH\r\n\tvirtual bool\t\tfetchRecords\t\t\t(u32 count) = 0;\r\n\t// Result of fetching (polling from user)\r\n\tvirtual bool\t\treceivedUpdate\t\t\t() = 0;\r\n\t\r\n\tvirtual\tEMOVECODE\tmoveTo\t\t\t\t\t(u32 record) = 0;\r\n\tvirtual\tEMOVECODE\tmoveNext\t\t\t\t() = 0;\r\n\tvirtual\tEMOVECODE\tmovePrevious\t\t\t() = 0;\r\n\r\n\tvirtual\tIDataRecord getRecord\t\t\t\t() = 0;\r\n\t\r\n\tvirtual u32\t\t\tgetFieldCount\t\t\t() = 0;\r\n\tvirtual\tconst char*\tgetFieldName\t\t\t(u32 index, u32& length) = 0;\r\n\tvirtual u32\t\t\tgetFieldType\t\t\t(u32 index) = 0;\r\n\tvirtual u32\t\t\tgetFieldIndex\t\t\t(const char* fieldName) = 0;\r\n\r\n\t// Access to one record.\r\n\tvirtual\ts32\t\t\tgetAsInt\t\t\t\t(IDataRecord rec, u32 index) = 0;\r\n\tvirtual const char*\tgetAsString\t\t\t\t(IDataRecord rec, u32 index, u32& length) = 0;\r\n\tvirtual bool\t\tgetAsBool\t\t\t\t(IDataRecord rec, u32 index) = 0;\r\n\tvirtual float\t\tgetAsFloat\t\t\t\t(IDataRecord rec, u32 index) = 0;\r\n    \r\n    virtual ~IDataSource() {};\r\n};\r\n\r\n#endif // INCLUDE_DATASET_H\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/DataSet_JSonDB.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef DataSet_JSonDB_h\r\n#define DataSet_JSonDB_h\r\n\r\n#include \"../../libs/JSonParser/api/yajl_parse.h\"\r\n#include \"../../libs/JSonParser/api/yajl_gen.h\"\r\n\r\n#include \"DataSet.h\"\r\n\r\nstruct Field {\r\n\tunion {\r\n\t\tfloat\tf;\r\n\t\ts32\t\ti;\r\n\t\ts32\t\tstr;\t// Strinf offset index.\r\n\t\tbool\tb;\r\n\t} v;\r\n};\r\n\r\nstruct RecordListHeader {\r\n\tRecordListHeader*\tpNextRecord;\r\n\tField*\t\t\t\tfields;\r\n};\r\n\r\nclass JSonDB : IDataSource {\r\n\t#define MAX_FIELD_PER_RECORD\t(64)\r\npublic:\r\n\tstatic\r\n\tIDataSource*\t\topenDB\t\t\t\t\t(const u8* source, u32 sourceLength);\r\n\r\n\tstatic\r\n\tvoid\t\t\t\tcloseDB\t\t\t\t\t(IDataSource* pSrc);\r\n\r\n\tvirtual\ts32\t\t\tgetTotalRecordCount\t\t();\r\n\tvirtual s32\t\t\tgetCurrentRecordCount\t();\r\n\tvirtual bool\t\tfetchRecords\t\t\t(u32 count);\r\n\tvirtual bool\t\treceivedUpdate\t\t\t();\r\n\r\n\tvirtual\tEMOVECODE\tmoveTo\t\t\t\t\t(u32 record);\r\n\tvirtual\tEMOVECODE\tmoveNext\t\t\t\t();\r\n\tvirtual\tEMOVECODE\tmovePrevious\t\t\t();\r\n\r\n\tvirtual\tIDataRecord getRecord\t\t\t\t();\r\n\tvirtual u32\t\t\tgetFieldCount\t\t\t();\r\n\tvirtual\tconst char*\tgetFieldName\t\t\t(u32 index, u32& len);\r\n\tvirtual u32\t\t\tgetFieldType\t\t\t(u32 index);\r\n\tvirtual u32\t\t\tgetFieldIndex\t\t\t(const char* fieldName);\r\n\r\n\tvirtual\ts32\t\t\tgetAsInt\t\t\t\t(IDataRecord rec, u32 index);\r\n\tvirtual const char*\tgetAsString\t\t\t\t(IDataRecord rec, u32 index, u32& len);\r\n\tvirtual bool\t\tgetAsBool\t\t\t\t(IDataRecord rec, u32 index);\r\n\tvirtual float\t\tgetAsFloat\t\t\t\t(IDataRecord rec, u32 index);\r\nprotected:\r\n\tbool readDBInternal\t(const u8* source, u32 sourceLength);\r\nprivate:\r\n\tJSonDB();\r\n\t~JSonDB();\r\n\r\n\t//\r\n\t// Parser Call back.\r\n\t//\r\n\tint readStartMap\t(unsigned int size);\r\n\tint readNull\t\t();\r\n\tint readBoolean\t\t(int boolean);\r\n\tint readInt\t\t\t(long long integerVal);\r\n\tint readDouble\t\t(double doubleVal);\r\n\tint readString\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readMapKey\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readEndMap\t\t();\r\n\tint readStartArray\t(unsigned int size);\r\n\tint readEndArray\t();\r\n\r\n\tstatic int read_start_map\t(void * ctx, unsigned int size);\r\n\tstatic int read_null\t\t(void * ctx);\r\n\tstatic int read_boolean\t\t(void * ctx, int boolean);\r\n\tstatic int read_int\t\t\t(void * ctx, long long integerVal);\r\n\tstatic int read_double\t\t(void * ctx, double doubleVal);\r\n\tstatic int read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_end_map\t\t(void * ctx);\r\n\tstatic int read_start_array\t(void * ctx, unsigned int size);\r\n\tstatic int read_end_array\t(void * ctx);\r\n\r\n\r\n\t//\r\n\t// Record setup inner.\r\n\t//\r\n\ts32  getFieldID\t\t(const unsigned char* str, s32 strLen);\r\n\ts32\t addField\t\t(const unsigned char* str, s32 strLen);\r\n\tvoid setFieldType\t(s32 field, u8 type);\r\n\tbool allocateRecord\t();\r\n\tvoid copyFromTempToRecord();\r\n\tvoid setInt\t\t\t(s32 idx, s32 value);\r\n\tvoid setFloat\t\t(s32 idx, float value);\r\n\tvoid setString\t\t(s32 idx, const unsigned char* str, s32 strLen);\r\n\tvoid setBool\t\t(s32 idx, s32 value);\r\n\tvoid clean\t\t\t();\r\n\r\nprivate:\r\n\tEMOVECODE\tm_res;\r\n\r\n\t#define DB_MAX_STRING_POOL_SIZE\t(1000)\r\n\r\n\tchar\t\t\t\tm_stringBuffer[DB_MAX_STRING_POOL_SIZE];\t// Field Name only, 1 KB should be enough\r\n\tu32\t\t\t\t\tm_stringAlloc;\r\n\r\n\tu8\t\t\t\t\tm_fieldType[64];\t// Limit to 64 field per record.\r\n\tu16\t\t\t\t\tm_fieldName[64];\r\n\tRecordListHeader\tm_baseRecordHeader;\r\n\tField\t\t\t\tm_field[64];\r\n\tRecordListHeader*\tm_currRecord;\t\t// Current parser record.\r\n\tRecordListHeader*\tm_startRecord;\r\n\tRecordListHeader*\tm_recordPtr;\t\t// Current navigation record.\r\n\r\n\tchar*\t\t\t\tmStringRecordBuffer;\r\n\tu32\t\t\t\t\tmStringRecordCount;\r\n\tu32\t\t\t\t\tm_StringRecordBufferSize;\r\n\r\n\ts32 m_entryIdx;\t\t\t// Current Field\r\n\tu32 m_record;\t\t\t// Record Count\r\n\tu32 m_recordEntry;\t\t// Field Count\r\n\tu32 m_mapCnt;\t\t\t// Parser Map Nest Counter\r\n\tu32 m_arrayCnt;\t\t\t// Parser Array Nest Count\r\n\tu32 m_currRecIdx;\t\t// Current navigation record index.\r\n\tyajl_handle parserCtx;\t// Parser context pointer for callback.\r\n};\r\n\r\n#endif // DataSet_JSonDB_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/DebugAlloc.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef DebugAlloc_h\r\n#define DebugAlloc_h\r\n#include <stdlib.h>\r\n\r\nvoid * operator new(size_t size);\r\nvoid * operator new[](size_t size);\r\n\r\nvoid operator delete(void * ptr);\r\nvoid operator delete[](void * ptr);\r\n\r\nclass CMemDebug\r\n{\r\npublic:\r\n\tinline static void setFailNums\t\t(int nums)\t\t{ m_numFail = nums;  }\r\n\tinline static void setFailCounter\t(int count = 0) { m_cntFail = count; }\r\n\r\n\tinline static bool isFail() {\r\n\t\tif(!m_numFail) return false;\r\n\t\tif(m_cntFail + 1 >= m_numFail) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tm_cntFail++;\r\n\t\treturn false;\r\n\t}\r\nprivate:\r\n\tstatic int\t\tm_cntFail;\r\n\tstatic int\t\tm_numFail;\r\n};\r\n#endif // DebugAlloc_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/DebugTracker.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __DEBUG_SYSTEM__\r\n#define __DEBUG_SYSTEM__\r\n#include <stdlib.h>\r\n#include \"FileSystem.h\"\r\n\r\nclass CKLBTask;\r\n\r\nclass CTracker\r\n{\r\npublic:\r\n    static void  Init\t\t\t(const char * target, bool retry = false);\r\n    static void  End\t\t\t();\r\n    \r\n    static void  updateFrame\t();\r\n\r\n\tstatic void  setStateName\t(char* newState);\r\n\tstatic void* logNew\t\t\t(void* ptr, size_t size, int line, const char* file);\r\n\tstatic void* logDelete\t\t(void* ptr, int line, const char* file);\r\nprivate:\r\n    enum {\r\n        CMD_END     = 1,\r\n\r\n        CMD_ALLOC   = 2,\r\n        CMD_FREE    = 3,\r\n        CMD_SRCID   = 4,\r\n        CMD_TASKTIME= 5,    // タスクの所要時間\r\n        CMD_TASKID  = 6,    // タスクIDの新規追加\r\n\t\tCMD_FRAME\t= 7,\r\n\r\n\t\tQUERY_SRCID\t\t= 0x11,\t// パフォーマンスモニタからのコマンド: SRCID の値から、ソース/行番号を得る\r\n\t\tQUERY_TASKID\t= 0x12,\t// パフォーマンスモニタからのコマンド: TASKIDの値からタスクラベルを得る\r\n\r\n\t\tQUERY_GAMESTOP\t= 0x13,\r\n\t\tQUERY_GAMESTART\t= 0x14,\r\n\r\n\t\tACK_GAMESTOP\t= 0x23,\r\n\t\tACK_GAMESTART\t= 0x24,\r\n    };\r\n\r\n    typedef struct srcList {\r\n        struct srcList * p_next;\r\n        const char * srcName;\r\n        int    sid;\r\n    } srcList;\r\n\tstatic bool\t\t\tsendSrcID\t(srcList * src);\r\n\tstatic srcList *\tsearchSrcID\t(u16 srcID);\r\n\tstatic int\t\t\tgetSrcID\t(const char * srcName);\r\n\r\n\tstatic srcList *\tm_begin;\r\n    static int          m_nextId;\r\n    static int          ms_numCounter;\r\n\r\n    \r\n    typedef struct taskList {\r\n        struct taskList * p_next;\r\n        const char * taskName;\r\n        int     tid;\r\n    } taskList;\r\n\tstatic bool\t\t\tsendTaskID\t(taskList * task);\r\n\tstatic taskList *\tsearchTaskID(u16 taskID);\r\n    static int\t\t\tgetTaskID\t(const char * taskName);\r\n\r\n    static taskList *\tm_taskbegin;\r\n    static int          m_taskId;\r\n    static int          ms_taskCounter;\r\n\r\n\tstatic void writeBlock(u8* buf, u32 length);\r\n\r\n    static inline void setArrU32(u8 * p, u32 v) {\r\n        p[0] = (v >> 24) & 0xff;\r\n        p[1] = (v >> 16) & 0xff;\r\n        p[2] = (v >> 8) & 0xff;\r\n        p[3] = v & 0xff;\r\n    }\r\n\r\n    static inline void setArrU16(u8 * p, u16 v) {\r\n        p[0] = (v >> 8) & 0xff;\r\n        p[1] = v & 0xff;\r\n    }\r\n\r\n    static IReadStream *\tms_pSockR;\r\n    static IWriteStream *\tms_pSockW;\r\n\r\n\r\n\tstatic bool\t\t\t\tm_initialized;\r\n\tstatic bool\t\t\t\tm_retry;\r\n\tstatic const char *\t\tm_targethost;\r\n\tstatic int\t\t\t\tm_retrycount;\r\n\r\n    static int\t\t\t\tms_numFrame;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/Dictionnary.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLB_DICTIONNARY_H\r\n#define KLB_DICTIONNARY_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"ArrayAllocator.h\"\r\n\r\nclass Dictionnary;\r\n\r\nclass CharEntry {\r\n\tfriend class Dictionnary;\r\npublic:\r\n\tstatic void* operator new\t\t(size_t size, ArrayAllocator<CharEntry>* pAlloc); \r\n\tstatic void  operator delete\t(void *p,\t  ArrayAllocator<CharEntry>* pAlloc);\r\n\r\n\tCharEntry\t\t\t();\r\n\tCharEntry\t\t\t(Dictionnary* pOwner, char c, const void* value);\r\n\tCharEntry\t\t\t(Dictionnary* pOwner);\r\n\r\n\tvoid clear\t\t\t();\r\n\tbool findChildChar\t(CharEntry** pEntry, char c);\r\n\tvoid insertChild\t(CharEntry* pEntryBefore, CharEntry* pEntry);\r\n\tvoid removeChild\t(CharEntry* pEntry);\r\n\t\r\nprotected:\r\n\tCharEntry*\t\t\tm_next;\r\n\tCharEntry*\t\t\tm_child;\r\n\tDictionnary*\t\tm_pOwner;\r\npublic:\r\n\tconst void*\t\t\tm_value;\r\n\tu8\t\t\t\t\tm_childCount;\r\n\tchar\t\t\t\tm_char;\r\n};\r\n\r\ntypedef\tvoid\t(*cbDicoDelete)(const void* ctx, const void* ptr);\r\n\r\nclass Dictionnary {\r\n\tfriend class CharEntry;\r\npublic:\r\n\tDictionnary\t\t\t();\r\n\tDictionnary\t\t\t(const void* ctx, cbDicoDelete ptrFct);\r\n\tvirtual ~Dictionnary();\r\n\t\r\n\tbool init\t\t\t(u16 dicoSize);\r\n\tvoid dump\t\t\t();\r\n\tconst void* find\t(const char* string);\r\n\tvoid add\t\t\t(const char* string, const void* value);\r\n\tvoid remove\t\t\t(const char* string);\r\n\tvoid clear\t\t\t();\r\n\tvoid setOwnerCallback(const void* callBackContext, cbDicoDelete ptrFct);\r\nprivate:\r\n\tvoid removeRecursive(CharEntry* pNode, const char* curr, bool* pDel);\r\n\tvoid dump\t\t\t(CharEntry* pNode, int level, bool fitLine);\r\n\r\n\tArrayAllocator<CharEntry>\t\r\n\t\t\t\t\t\tallocator;\r\n\tCharEntry*\t\t\tm_pRoot;\r\n\tcbDicoDelete\t\tm_pCBDelete;\r\n\tconst void*\t\t\tm_pCBContext;\r\n};\r\n\r\n#endif // KLB_DICTIONNARY_H\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/EAGLView.h",
    "content": "// #define OPENGL2\n\n#import <GLKit/GLKit.h>\n#import <StoreKit/StoreKit.h>\n#import <AVFoundation/AVFoundation.h>\n\n//#import \"CuttingGame.h\"\n\n#define MAX_TOUCH 20     // 最大タッチ数\n#define FPS_AVERAGE (5)     // FPS計測用\n\n/*\n This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.\n The view content is basically an EAGL surface you render your OpenGL scene into.\n Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.\n */\n@interface EAGLView {\n@private\n\t/* The pixel dimensions of the backbuffer */\n\tGLint backingWidth;\n\tGLint backingHeight;\n    \n\t/* OpenGL names for the renderbuffer and framebuffers used to render to this view */\n\tGLuint viewRenderbuffer, viewFramebuffer;\n    \n\t/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */\n\tGLuint depthRenderbuffer;\n\tGLuint program;\n    \n\tNSTimer *animationTimer;\n\tNSTimeInterval animationInterval;\n\tCFTimeInterval timePrev;\n\tCFTimeInterval timeInt;\n\tint frame;\n    \n#if (DEBUG == 1)\n\tCFTimeInterval fpsArray[FPS_AVERAGE];   // FPS計測時に平均を出すための保存配列\n\tint fpsCnt;                             // FPS値を保存する配列のインデックス\n#endif\n    \n\t// CGame game;\n\tBoolean isInitiated;\n    \n\t// キーボードのサイズ\n\tCGRect keyboardFrameEnd;\n    \n\tBoolean bContinue;\n}\n\n@property NSTimeInterval animationInterval;\n\n- (void)startAnimation;\n- (void)stopAnimation;\n- (void)drawView;\n- (void)setTimePrev:(CFTimeInterval)value;\n- (void)textTouchDown:(id)sender;\n- (void)textTouchUp:(id)sender;\n\n- (void)clearUITouches;\n\n@end\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/FileDelete.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _KLB_FILE_DELETE_\r\n#define _KLB_FILE_DELETE_\r\n\r\n#include <dirent.h>\r\n\r\n#include \"CPFInterface.h\"\r\n\r\nbool deleteFiles(const char* path);\r\nconst char* getFullNativePath(const char* path);\r\nvoid removeTmpFileNative(const char* filePath);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/FileSystem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __FILE_SYSTEM_KLB__\r\n#define __FILE_SYSTEM_KLB__\r\n\r\nclass IWriteStream;\r\n\r\n/*!\r\n* \\class IReadStream\r\n* \\brief Read Stream Interface\r\n* \r\n* IReadStream defines an Interface for Read Stream classes.\r\n* It provides methods for file decryption.\r\n* Read data can either be u8, u16, u32, float or blocks.\r\n*/\r\nclass IReadStream {\r\npublic:\r\n\tenum ESTATUS {\r\n\t\tNOT_FOUND,\t\t// Failed open\r\n\t\tNORMAL,\t\t\t// Open success\r\n\t\tNOT_AVAILABLE,\t// Killed during read\r\n        NOT_CONNECT,\r\n\t\tCLOSED\t\t\t// File close\r\n\t};\r\n\r\n\tvirtual ~IReadStream() { }\r\n\t\r\n\tvirtual\t\ts32\t\tgetSize\t\t()\t= 0;\t// -1 : Undefined, >= 0 file size\r\n\tvirtual\t\ts32\t\tgetPosition\t()\t= 0;\r\n\tvirtual \tu8\t\treadU8\t\t() \t= 0;\t// Use cast to support s8\r\n\tvirtual\t\tu16\t\treadU16\t\t()\t= 0;\t// Use cast to support s16\r\n\tvirtual\t\tu32\t\treadU32\t\t()\t= 0;\t// Use cast to support s32\r\n    \r\n    virtual     int     readU16arr  (u16 * pBufferU16, int items) = 0;\r\n    virtual     int     readU32arr  (u32 * pBufferU32, int items) = 0;\r\n    \r\n\tvirtual\t\tfloat\treadFloat\t()\t= 0;\t//\r\n\tvirtual\t\tbool\treadBlock\t(void* buffer, u32 byteSize)\t= 0;\r\n\tvirtual\t\tESTATUS\tgetStatus\t()\t= 0;\r\n\t\r\n\t// Socket specialized\r\n\tvirtual\t\tIWriteStream* getWriteStream()  = 0;\r\n};\r\n\r\n/*!\r\n* \\class IWriteStream\r\n* \\brief Write Stream Interface\r\n* \r\n* IWriteStream defines an Interface for Write Stream classes.\r\n* It provides methods for file encryption.\r\n* Written data can either be u8, u16, u32, float or blocks.\r\n*/\r\nclass IWriteStream {\r\npublic:\r\n\tenum ESTATUS {\r\n\t\t// TODO WRITE Status...\r\n        CAN_NOT_WRITE,\r\n        NORMAL,\r\n        NOT_AVAILABLE,\r\n        CLOSED\r\n\t};\r\n\r\n\tvirtual ~IWriteStream() { }\r\n\t\r\n\tvirtual\t\tESTATUS\tgetStatus\t()\t\t\t= 0;\r\n\tvirtual\t\ts32\t\tgetPosition\t()\t\t\t= 0;\r\n\tvirtual \tvoid\twriteU8\t\t(u8 value) \t= 0;\t// Use cast to support s8\r\n\tvirtual\t\tvoid\twriteU16\t(u16 value)\t= 0;\t// Use cast to support s16\r\n\tvirtual\t\tvoid\twriteU32\t(u32 value)\t= 0;\t// Use cast to support s32\r\n\tvirtual\t\tvoid\twriteFloat\t(float)\t\t= 0;\r\n\tvirtual\t\tvoid\twriteBlock\t(void* buffer, u32 byteSize)\t= 0;\r\n};\r\n\r\nenum WRITE_MODE {\r\n\tCREATE_FILE\t= 1,\r\n};\r\n\r\nIReadStream* \topenReadStream\t\t(char* path);\r\nIWriteStream*\topenWriteStream\t\t(char* path, WRITE_MODE writeMode); \r\nvoid\t\t\tcloseReadStream\t\t(IReadStream* \tpReadStream);\r\nvoid\t\t\tcloseWriteStream\t(IWriteStream*\tpWriteStream);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/FontRendering.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef H_FNT_RENDERING_KLB_\r\n#define H_FNT_RENDERING_KLB_\r\n\r\n#include \"CPFInterface.h\"\r\n#include <stdio.h>\r\n#include <string.h>\r\n\r\n// assume POSIX / Linux\r\n#ifndef _WIN32\r\n# include <strings.h>\r\n# define stricmp(s1, s2) strcasecmp(s1, s2)\r\n#endif\r\n\r\n#include <ft2build.h>\r\n#include FT_FREETYPE_H\r\n\r\n// ==========================================================================================\r\n//   Definitions\r\n// ==========================================================================================\r\nstruct CharDictionnary;\r\nstruct CharCache;\r\nstruct MemoryBlock;\r\nclass  FntDebug;\r\nnamespace FontSystem {\r\n\tvoid reboot();\r\n};\r\n\r\nstruct FontObject {\r\n\tfriend class FntDebug;\r\n\tfriend struct CharDictionnary;\r\n\tfriend struct CharCache;\r\npublic:\r\n\tstatic bool\tregisterFont(const char* logicalName, const char* physicalFont, bool asDefault);\r\n\tstatic FontObject* createFont(const char* fontName, u32 size);\r\n\tstatic void destroyFont(FontObject* pFont, bool force = false);\r\n\tstatic void releaseFontSystem();\r\n\t\r\n\tFT_GlyphSlot renderChar(u32 unicode);\r\n\tvoid renderText\t(s32 x, s32 y, const char* text, u8* greyBuffer, u32 colorARGB8888, u32 buffWidth, u32 buffHeight, s32 strideByte, bool use4444);\r\n\tvoid getTextInfo(const char* text, STextInfo* result);\r\n\tfloat getAscent();\r\n\r\n\tstatic void test();\r\n\t\r\nprivate:\r\n\tFontObject();\r\n\t~FontObject();\r\n\t\r\n\tstatic FontObject*  s_list;\r\n\tstatic bool\t\t\ts_init;\r\n\tstatic FT_Library\ts_library;\r\n\r\n\tFontObject*\tm_prev;\r\n\tFontObject* m_next;\r\n\t\r\n\tFT_Face\t\tm_face;\r\n\tu32\t\t\tm_lenName;\r\n\tu32 \t\tm_size;\r\n\tu32\t\t\tm_refCount;\r\n\tu16\t\t\tm_dicoStart;\r\n\tFT_Bool\t\tm_hasKerning;\r\n\tconst char*\tm_name;\r\n\r\n\tstruct FONTALIAS {\r\n\t\tconst char * logicalName;\r\n\t\tconst char * physicalName;\r\n\t\tbool\t\t isDefault;\r\n\t};\r\n\r\n\tstatic FONTALIAS\tg_fonts[5];\r\n\tstatic u32\t\t\tg_fontInstalled;\r\n\r\n\tstatic const char* getFileFromFontName(const char* fontName, char* tmpBuffer);\r\n};\r\n\r\n#define CHAR_CACHE_SIZE\t(512)\r\n\r\nstruct CharCache {\r\n\tfriend class FntDebug;\r\n\tfriend struct CharDictionnary;\r\n\tfriend struct FontObject;\r\npublic:\r\n\tstatic CharCache* createEntry(u32 uniCode, u16* outIndex, FontObject* pFont);\r\n\t\r\n\tstatic void test();\r\n\tstatic void reboot() {\r\n\t\ts_cacheStart\t= 0xFFFF;\r\n\t\ts_cacheEnd\t\t= 0;\r\n\t\ts_allocCounter\t= 0;\r\n\t}\r\n\r\n\tu8* m_ptr;\r\n\tFontObject* m_pFontObj;\r\nprivate:\r\n\tu32 m_unicode;\r\npublic:\r\n\ts32 m_offsetX;\r\n\ts32\tm_offsetY;\r\nprivate:\r\n\tu16\tm_next;\r\n\tu16 m_prev;\r\npublic:\r\n\tu16 m_blockIndex;\r\n\tu16\tm_blockCharIndex;\r\n\tu16 m_tblOffset;\r\n\t// ---- Rendering box\r\n\tu8  m_width;\r\n\tu8  m_height;\r\n\ts8  m_advanceX;\r\n\ts8  m_advanceY;\r\n\t// ------------------\r\nprivate:\r\n\tCharCache();\r\n\t~CharCache();\r\n\r\n\tstatic u16 s_cacheStart;\r\n\tstatic u16 s_cacheEnd;\r\n\tstatic CharCache s_cacheArray[CHAR_CACHE_SIZE];\r\n\tstatic u16 s_allocCounter;\r\n};\r\n\r\nstruct CharDictionnary {\r\n\tfriend struct FontObject;\r\n\tfriend class FntDebug;\r\npublic:\r\n\tstatic CharCache* getChar(u32 uniCode, FontObject* pFont);\r\n\tstatic void\tremoveDicoEntry(u16 startEntry, u32 unicode);\r\n\tstatic void destroyTree(u16 entry, u16 depth);\r\n\tstatic void removeEntry(u16 entry);\r\n\r\n\tstatic void reboot() {\r\n\t\ts_freeList = s_usedList = 0xFFFF;\r\n\t}\r\n\tstatic void test();\r\nprivate:\r\n\tCharDictionnary();\r\n\r\n\tstatic const u32 DICO_ELEMENT_COUNT = 1000;\r\n\tstatic CharCache*\tfindEntry(FontObject* pFont,u32 uniCode);\r\n\tstatic CharCache*\tcreateEntry(FontObject* pFont, u32 uniCode);\r\n\tstatic u16\t\t\tcreateDicoEntry();\r\n\tstatic u16\t\t\tremoveDicoEntryRec(u16 entry, u32 depth, u32 unicode, u16 startEntry);\r\n\r\n\tstatic CharDictionnary\ts_dicoArray[DICO_ELEMENT_COUNT];\r\n\tstatic u16\t\t\t\ts_freeList;\r\n\tstatic u16\t\t\t\ts_usedList;\r\n\r\n\tu16\t\t\tm_next;\t\t\t// 2\r\n\tu16\t\t\tm_prev;\t\t\t// 2\r\n\tu16\t\t\tm_idxTbl[16];\t// 8 byte\r\n};\r\n\r\n#define\tMB_BLOCK_ITEM_SIZE\t(64*64)\r\n\r\nstruct MemoryBlock {\r\n\tfriend class FntDebug;\r\n\r\n\tstatic void test();\r\n\tstatic void reboot();\r\n\tstatic void freeBlock(u16 blockID, u16 subID);\r\n\tstatic bool allocBlock(u16* returnBlock, u16* returnSubID, u8** ppData);\r\nprivate:\r\n\tstatic MemoryBlock*\ts_blockList;\r\n\tstatic u16\t\t\ts_blockCounter;\r\n\r\n\tMemoryBlock*\tm_next;\r\n\tu16\t\t\t\tm_id;\r\n\tu32\t\t\t\tm_allocFlag;\r\n\tu32\t\t\t\tpartSize;\r\n\t// Aligned by partSize.\r\n\tu8\t\t\t\tm_mem[32*MB_BLOCK_ITEM_SIZE];\r\n};\r\n\r\n#endif // H_FNT_RENDERING_KLB_\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/GLcommon.h",
    "content": "#ifndef GLcommon_h\n#define GLcommon_h\n\n#include <OpenGLES/ES2/gl.h>\n#include <OpenGLES/ES2/glext.h>\n\n//#include \"ApplicationFramework.h\"\n//#include \"RenderingFramework.h\"\n\n\n#endif // GLcommon_h\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/ILuaFuncLib.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef ILuaFuncLib_h\r\n#define ILuaFuncLib_h\r\n\r\n#include \"CLuaState.h\"\r\n\r\nclass ILuaFuncLib\r\n{\r\npublic:\r\n\ttypedef struct {\r\n\t\tconst char * name;\r\n\t\tint\t\t\t cmd;\r\n\t} DEFCONST;\r\n\r\n\tILuaFuncLib();\r\n\tILuaFuncLib(DEFCONST * arrCmdItem);\r\n\tvirtual ~ILuaFuncLib();\r\n\r\n\tvirtual bool exist\t\t\t\t();\r\n\r\n\tstatic\tbool registAllLibs\t\t(lua_State * L);\r\n\tstatic\tvoid destroyAllResources();\r\n\r\n\tvoid addFunction(const char * luaFuncName, int (*func)(lua_State * L));\r\nprotected:\r\n\r\n\t// 関数追加処理を記述する\r\n\tvirtual void addLibrary() = 0;\r\n\r\n\t// その関数群で確保したリソースに残りがあればすべて破棄する\r\n\tvirtual void destroyResources();\r\n\r\n\t// その関数群で生成したオブジェクトをダンプする必要があればダンプする\r\n\tvirtual bool dumpObjects(IPlatformRequest& pForm);\r\n\r\nprivate:\r\n    void addLink\t(DEFCONST * arrCmdItem);\r\n\tvoid registLib\t(lua_State * L);\r\n\tvoid registConst();\r\n\r\n\tstatic int luaDumpObjects(lua_State * L);\r\n\r\n    static ILuaFuncLib\t*\tm_begin;\r\n\tstatic ILuaFuncLib\t*\tm_end;\r\n\r\n\tILuaFuncLib\t\t\t*\tm_pPrev;\r\n    ILuaFuncLib\t\t\t*   m_pNext;\r\n\tDEFCONST\t\t\t*\tm_arrCmdItem;\r\n\tlua_State\t\t\t*\tm_L;\r\n};\r\n\r\n#endif // ILuaFunkLib_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/IMgrEntry.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLibScrollMgr_h\r\n#define CKLBLibScrollMgr_h\r\n\r\n#include \"klb_vararg.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"CKLBPropertyBag.h\"\r\n\r\nclass CKLBLibScrollMgr;\r\n\r\nclass IMgrEntry\r\n{\r\n\tfriend class CKLBLibScrollMgr;\r\npublic:\r\n\tIMgrEntry(const char * label);\r\n\tvirtual ~IMgrEntry();\r\n\r\n\tstatic CKLBScrollMgr * getMgr           (const char * name, int argc = 0, ...);\r\n\tstatic CKLBScrollMgr * getMgrByArray    (const char * name, int argc = 0, int args[] = NULL);\r\n\tstatic CKLBScrollMgr * getMgrByProperty (CKLBPropertyBag * pProp);\r\n\r\n\tvirtual bool exist();\r\n\r\nprotected:\r\n\tvirtual CKLBScrollMgr * createManager           (int argc, int args[])      = 0;\r\n\tvirtual CKLBScrollMgr * createManagerByProperty (CKLBPropertyBag * pProp)   = 0;\r\n\r\nprivate:\r\n\tstatic IMgrEntry * search(const char * name);\r\n\r\n\tconst char\t*\tm_name;\r\n\r\n\tIMgrEntry\t*\tm_prev;\r\n\tIMgrEntry\t*\tm_next;\r\n\r\n\tstatic IMgrEntry\t*\tms_begin;\r\n\tstatic IMgrEntry\t*\tms_end;\r\n};\r\n\r\n#endif // CKLBLibScrollMgr_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/ITmpFile.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef ITmpFile_h\r\n#define ITmpFile_h\r\n\r\n#include <sys/types.h>\r\n\r\nclass ITmpFile\r\n{\r\npublic:\r\n\tITmpFile();\r\n\tvirtual ~ITmpFile();\r\n\r\n\t// writing\r\n\tvirtual size_t writeTmp(void * ptr, size_t size) = 0;\r\n};\r\n\r\n#endif // ITmpFile_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/KLBPlatformMetrics.h",
    "content": "#ifndef KLBPlatformMetrics_h\n#define KLBPlatformMetrics_h\n\n#include \"KLBPlatformMetricsCommon.h\"\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/KLBPlatformMetricsCommon.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLBPlatformMetricsCommon_h\r\n#define KLBPlatformMetricsCommon_h\r\n\r\n// WARNING: this file should never included directly from Engine, nor from Porting layer.\r\n// You should always include \"KLBPlatformMetrics.h\" instead.\r\n\r\n// CPU usage measurement type constants\r\n// bits layout: abbbbbbbcccccccc\r\n//              a\t\t\t\t\t: begin/end flag; 0=begin, 1=end\r\n//               bbbbbbb\t\t\t: task type flag\r\n//                      cccccccc\t: subtask type flag\r\n#define TASKTYPE_BEGIN\t\t\t\t(0x0000)\r\n#define TASKTYPE_END\t\t\t\t(0x8000)\r\n#define TASKTYPE_LUA\t\t\t\t(0x0100)\r\n#define TASKTYPE_LUA_LOAD\t\t\t((TASKTYPE_LUA) | 0x01)\r\n#define TASKTYPE_LUA_EXEC\t\t\t((TASKTYPE_LUA) | 0x02)\r\n#define TASKTYPE_LUA_GC\t\t\t\t((TASKTYPE_LUA) | 0x03)\r\n#define TASKTYPE_TEX\t\t\t\t(0x0200)\r\n#define TASKTYPE_TEX_LOAD\t\t\t((TASKTYPE_TEX) | 0x10)\r\n#define TASKTYPE_TEX_LOAD_INFLATE\t((TASKTYPE_TEX_LOAD) | 0x1)\r\n#define TASKTYPE_TEX_LOAD_LOWCONV\t((TASKTYPE_TEX_LOAD) | 0x2)\r\n#define TASKTYPE_TEX_LOAD_OGL\t\t((TASKTYPE_TEX_LOAD) | 0x3)\r\n#define TASKTYPE_TEX_UPLOAD\t\t\t((TASKTYPE_TEX) | 0x20)\r\n#define TASKTYPE_SOUND\t\t\t\t(0x0300)\r\n#define TASKTYPE_SOUND_DECODE\t\t((TASKTYPE_SOUND) | 0x01)\r\n#define TASKTYPE_DRAW\t\t\t\t(0x0400)\r\n#define TASKTYPE_DRAW_ANIMATION\t\t((TASKTYPE_DRAW) | 0x10)\r\n\r\n// default (empty) macros. should be overridden using #undef inside platforms' \"KLBPlatformMetrics.h\".\r\n#define REPORT_METRICS(msg) \r\n#define MEASURE_THREAD_CPU_BEGIN(type) \r\n#define MEASURE_THREAD_CPU_END(type) \r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/Message.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __MICRO_MSG_KLB_OBJECT_\r\n#define __MICRO_MSG_KLB_OBJECT_\r\n\r\n// Used by :\r\n// - Animation Node\t\t\tparam:time millisecond\r\n// - SWF Node\t\t\t\tparam:frame number\r\n// - Cell Animation Node\tparam:frame number\r\n//\r\n#define\t\tANIMATION_COMPLETE\t\t(1)\r\n\r\n// Used by :\r\n// - SWF Node\t\t\t\tparam:label index\r\n#define\t\tLABEL_REACHED\t\t\t(2)\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/MultithreadedNetwork.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef MULTITHREADED_NETWORK_KLB\r\n#define MULTITHREADED_NETWORK_KLB\r\n\r\n#include \"CKLBHTTPInterface.h\"\r\n\r\n#define LOCK(a)\t\t\t\t\tCPFInterface::getInstance().platform().mutexLock(a)\r\n#define UNLOCK(a)\t\t\t\tCPFInterface::getInstance().platform().mutexUnlock(a)\r\n#define ALLOC_LOCK()\t\t\tCPFInterface::getInstance().platform().allocMutex()\r\n#define FREE_LOCK(a)\t\t\tCPFInterface::getInstance().platform().freeMutex(a)\r\n#define ALLOCEVENT_LOCK()\t\tCPFInterface::getInstance().platform().allocEventLock()\r\n#define FREEEVENT_LOCK(a)\t\tCPFInterface::getInstance().platform().freeEventLock(a)\r\n#define CREATE_THREAD(a,b)\t\tCPFInterface::getInstance().platform().createThread(a, b)\r\n#define FREE_THREAD(a)\t\t\tCPFInterface::getInstance().platform().deleteThread(a)\r\n#define WAKE_THREAD(a)\t\t\tCPFInterface::getInstance().platform().eventWakeup(a)\r\n#define SLEEP_THREAD(a)\t\t\tCPFInterface::getInstance().platform().eventSleep(a)\r\n\r\n/*!\r\n* \\class ConnectionEntry\r\n* \\brief Connection Entry Class\r\n* \r\n* \r\n*/\r\nclass ConnectionEntry {\r\npublic:\r\n\tConnectionEntry();\r\n\t~ConnectionEntry();\r\n\tConnectionEntry*\tm_pNext;\r\n\tCKLBHTTPInterface\tm_oConnection;\r\n\tbool\t\t\t\tm_kill;\r\n};\r\n\r\n/*!\r\n* \\class NetworkManager\r\n* \\brief Network Manager\r\n* \r\n* \r\n*/\r\nclass NetworkManager {\r\npublic:\r\n\tstatic bool \t\t\t\tstartNetworkManager\t();\r\n\tstatic void \t\t\t\tstopNetworkManager\t();\r\n\tstatic CKLBHTTPInterface*\tcreateConnection\t();\r\n\tstatic void\t\t\t\t\treleaseConnection\t(CKLBHTTPInterface* connection);\r\nprivate:\r\n\t\t   s32\t\t\t\t\tworkThread\t\t\t();\r\n\tstatic s32\t\t\t\t\tthreadFunc\t\t\t(void* pThread, void* data);\r\n\tstatic NetworkManager\t\ts_manager;\r\n\t\r\n\tNetworkManager();\r\n\t~NetworkManager();\r\n\t\r\n\tvoid* \t\t\t\tm_lock;\r\n\tvoid*\t\t\t\tm_eventLock;\r\n\tConnectionEntry*\tm_entries;\r\n\tvolatile u32\t\tm_killCount;\r\n\tConnectionEntry*\tm_killEntries[200];\r\n\tbool\t\t\t\tm_bShutDown;\r\n\tvoid*\t\t\t\tm_thread;\r\n\t\r\n\tvolatile\r\n\tbool\t\t\t\tm_bShutDownComplete;\r\n\t\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/NSData+Base64.h",
    "content": "//\n//  NSData+Base64.h\n//  base64\n//\n//  Created by Matt Gallagher on 2009/06/03.\n//  Copyright 2009 Matt Gallagher. All rights reserved.\n//\n//  This software is provided 'as-is', without any express or implied\n//  warranty. In no event will the authors be held liable for any damages\n//  arising from the use of this software. Permission is granted to anyone to\n//  use this software for any purpose, including commercial applications, and to\n//  alter it and redistribute it freely, subject to the following restrictions:\n//\n//  1. The origin of this software must not be misrepresented; you must not\n//     claim that you wrote the original software. If you use this software\n//     in a product, an acknowledgment in the product documentation would be\n//     appreciated but is not required.\n//  2. Altered source versions must be plainly marked as such, and must not be\n//     misrepresented as being the original software.\n//  3. This notice may not be removed or altered from any source\n//     distribution.\n//\n\n#import <Foundation/Foundation.h>\n\nvoid *NewBase64Decode(const char *inputBuffer,\n                      size_t      length,\n                      size_t *    outputLength);\n\nchar *NewBase64Encode(const void *inputBuffer,\n                      size_t      length,\n                      bool        separateLines,\n                      size_t *    outputLength);\n\n@interface NSData (Base64)\n\n+ (NSData *)dataFromBase64String:(NSString *)aString;\n- (NSString *)base64EncodedString;\n\n@end\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/NSGLView.h",
    "content": "/*\n File: NSGLView.h\n Abstract:\n The NSGLView class creates an OpenGL context and delegates to the OpenGLRenderer class for creating and drawing the shaders.\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#import <Cocoa/Cocoa.h>\n#import <QuartzCore/CVDisplayLink.h>\n\n#import \"modelUtil.h\"\n#import \"imageUtil.h\"\n\n@interface NSGLView : NSOpenGLView {\n\tCVDisplayLinkRef displayLink;\n}\n\n@end\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/NodeAnimationAsset.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __SPLINEANIM_ASSET__\r\n#define __SPLINEANIM_ASSET__\r\n\r\n#include \"CKLBSplineNode.h\"\r\nclass KLBBlendAnimationAssetPlugin;\r\n\r\nclass CKLBNodeAnimationAsset : public CKLBAsset {\r\n\tfriend class CKLBAnimationNode;\r\n\tfriend class KLBBlendAnimationAssetPlugin;\r\npublic:\r\n\tCKLBNodeAnimationAsset();\r\n\t~CKLBNodeAnimationAsset();\r\n\r\n\tvirtual CKLBNode*\tcreateSubTree\t(u32 priority = 0);\r\n\tvirtual u32\t\t\tgetClassID\t\t()\t\t{ return CLS_ASSETNODEANIM;\t}\r\n\tvirtual\tASSET_TYPE\tgetAssetType\t()\t\t{ return ASSET_NODEANIM;\t}\r\nprotected:\r\n\tCKLBNodeAnimationAsset* load(u8* stream, u32 streamSize);\r\n\r\n\ts32\t\t\t\t\tm_length;\r\n\ts32\t\t\t\t\tm_timeShift;\r\n\tu16\t\t\t\t\tm_type;\r\n\tu32\t\t\t\t\tm_mask;\r\n\tfloat\t\t\t\tm_param[16];\r\n};\r\n\r\n/*!\r\n* \\class KLBBlendAnimationAssetPlugin\r\n* \\brief Blend Animation Asset Plugin\r\n* \r\n* KLBBlendAnimationAssetPlugin is in charge of loading CKLBNodeAnimationAsset.\r\n*/\r\nclass KLBBlendAnimationAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBBlendAnimationAssetPlugin();\r\n\t~KLBBlendAnimationAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID\t\t()\t\t\t{ return CHUNK_TAG('A','N','I','M');\t}\r\n\tvirtual\tu8\t\t\t\t\tcharHeader\t\t()\t\t\t{ return 'a';\t\t\t\t\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension\t()\t\t\t{ return \".anim\";\t\t\t\t\t\t}\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset\t\t(u8* stream, u32 streamSize);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/OSWidget.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef OSWidget_h\r\n#define OSWidget_h\r\n\r\n#include <string.h>\r\n\r\nclass IWidget\r\n{\r\npublic:\r\n\tenum CONTROL {\r\n\t\tTEXTBOX,\r\n\t\tPASSWDBOX,\r\n        WEBVIEW,\r\n        WEBNOJUMP,\r\n        MOVIEPLAYER,\r\n        BGMOVIEPLAYER,\r\n        ACTIVITYINDICATOR,\r\n\t};\r\n    \r\n\t// TEXTBOX で生成された Widget の操作コマンド(cmd()に渡して使用)\r\n\tenum TEXTCMD{\r\n        TX_FONT,            // フォントおよびサイズ指定\r\n\t\tTX_PLACEHOLDER,\t\t// プレースホルダ設定\r\n        TX_MAXLEN,          // 最大長設定\r\n        TX_CHARTYPE,        // 有効文字種設定(TEXTCHARTYPEの論理和で指定)\r\n\r\n\t\tTX_BGCOLOR_NORMAL,\t// 通常時の背景色\r\n\t\tTX_FGCOLOR_NORMAL,\t// 通常時の前景色\r\n\r\n\t\tTX_BGCOLOR_TOUCH,\t// 触れた時の背景色\r\n\t\tTX_FGCOLOR_TOUCH,\t// 触れた時の前景色\r\n        \r\n        TX_ALIGNMENTTYPE,   // テキストのアライメントタイプ\r\n\t};\r\n    \r\n    enum TEXTALIGNMENTTYPE {\r\n        TX_ALIGN_LEFT = 0,     // 左揃え\r\n        TX_ALIGN_CENTER,       // 中央揃え\r\n        TX_ALIGN_RIGHT,        // 右揃え\r\n    };\r\n\r\n\tenum TEXTCHARTYPE {\r\n\t\tTXCH_7BIT_ASCII = 0x0001,\t// 7bit ASCII を許可\r\n\t\tTXCH_UTF8       = 0x0002,\t// 最上位bitが1の文字を許可\r\n\r\n\t\t// それ以外の文字種を追加する際は 0x0004, 0x0008…と、bitmaskを追加する形で。\r\n\t};\r\n\r\n    // WEBVIEW で生成された Widget の操作コマンド(cmd()に渡して使用)\r\n    typedef enum {\r\n        WEB_SET_SCALESPAGETOFIT,\t// iOSの UIWebViewにおける scalePageToFit プロパティ設定\r\n        WEB_BGCOLOR_NORMAL,\t\t\t// webviewの背景色\r\n    } WEBCMD;\r\n    \r\n    \r\n    // MOVIEPLAYER で生成された Widget の操作コマンド(cmd()に渡して使用)\r\n    enum MOVIECMD{\r\n        MV_STOP,\t\t\t\t\t// 動画再生停止\r\n        MV_PLAY,\t\t\t\t\t// 動画再生\r\n        MV_PAUSE,\t\t\t\t\t// 動画一時停止\r\n        MV_RESUME,\t\t\t\t\t// 動画再生再開\r\n    };\r\n\r\n\t// 動画再生ステータス(現在未使用)\r\n    enum MOVIESTAT {\r\n        MV_FINISHED,\t\t\t\t// 動画再生終了\r\n    };\r\n    \r\n    // ACTIVITYINDICATOR　用コマンドと定数\r\n    enum ACTIVITYINDICATORCMD {\r\n        ACT_STARTANIM,\t\t\t\t// アニメーション開始\r\n        ACT_STOPANIM,\t\t\t\t// アニメーション停止\r\n        ACT_SET_STYLE,\t\t\t\t// ActivityIndicatorの種類指定(定数ACTITYPEで指定)\r\n    };\r\n    \r\n    enum ACTITYPE {\r\n        ACTI_TYPE_WHITE,\t\t\t// white\r\n        ACTI_TYPE_GRAY,\t\t\t\t// gray\r\n        ACTI_TYPE_WHITELARGE,\t\t// whitelarge\r\n    };\r\n    \r\n\tvirtual ~IWidget();\r\n\r\n\tvirtual int  getTextLength() = 0;\r\n\tvirtual int  getTextMaxLength() { return 0; } // Default implementation for all classes.\r\n\tvirtual bool getText(char * pBuf, int maxlen) = 0;\r\n\tvirtual bool setText(const char * string) = 0;\r\n\tvirtual void move(int x, int y) = 0;\r\n\tvirtual void resize(int width, int height) = 0;\r\n\tvirtual void visible(bool bVisible) = 0;\r\n\tvirtual void enable(bool bEnable) = 0;\r\n    \r\n    virtual void cmd(int cmd, ...) = 0;\r\n    virtual int status() = 0;\r\n    \r\n    inline void setTmpString(const char * string) { strcpy(m_buf, string); }\r\n    inline const char * getTmpString() const { return (const char *)m_buf; }\r\nprivate:\r\n    char        m_buf[1024];\r\n};\r\n\r\n#endif // OSWidget_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/OpenGLRenderer.h",
    "content": "/*\n File: OpenGLRenderer.h\n Abstract:\n The OpenGLRenderer class creates and draws objects.\n Most of the code is OS independent.\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#include \"glUtil.h\"\n\n@interface OpenGLRenderer : NSObject {\n\tGLuint m_defaultFBOName;\n}\n\n- (id)initWithDefaultFBO:(GLuint)defaultFBOName;\n- (void)resizeWithWidth:(GLuint)width AndHeight:(GLuint)height;\n- (void)render;\n- (void)dealloc;\n\n@end\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/RenderingFramework.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __GL_WRAPPER__\r\n#define __GL_WRAPPER__\r\n\r\n#include \"BaseType.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"glWrapper.h\"\r\n\r\n// #include \"icontrollable.h\"\r\n\r\n#define null\t\t(0)\r\n\r\n#define S_UNIFORM\t(0x0001)\r\n#define S_ATTRIBUTE\t(0x0002)\r\n#define S_CONSTANT\t(0x0003)\r\n\r\n#define\tS_INT\t\t(0x0010)\r\n#define S_FLOAT\t\t(0x0020)\r\n#define S_MATRIX\t(0x0030)\r\n\r\n#define S_SIZE1\t\t(0x0100)\r\n#define\tS_SIZE2\t\t(0x0200)\r\n#define S_SIZE3\t\t(0x0300)\r\n#define S_SIZE4\t\t(0x0400)\r\n\r\n#include \"assert_klb.h\"\r\n\r\n#define\tklb_assertm(s)\t\tklb_assertAlways(s)\r\n#define klb_assertc(c,s)\tklb_assert((int)(c),(s))\r\n\r\nclass CBuffer;\r\n\r\n//\r\n// Shader\r\n//\r\nstruct SParam;\r\nclass CShader;\r\nclass CShaderInstance;\r\nclass CShaderSet;\r\n\r\n//\r\n// Texture\r\n//\r\nclass CTextureBase;\r\nclass CTexture;\r\nclass CSubTexture;\r\nclass CTextureUsage;\r\n\r\n//\r\n// Main Manager\r\n//\r\nclass CKLBOGLWrapper;\r\n\r\n#define UNDEFINED_BOOL\t\t(2)\r\n#define TRUE_BOOL_U8\t\t(1)\r\n#define FALSE_BOOL_U8\t\t(0)\r\n\r\nenum DATA_TYPE {\r\n\tVEC1I\t\t= 0,\r\n\tVEC1F\t\t= 1,\r\n\tVEC2\t\t= 2,\r\n\tVEC3\t\t= 3,\r\n\tVEC4\t\t= 4,\r\n\tMMAT2\t\t= 5,\r\n\tMMAT3\t\t= 6,\r\n\tMMAT4\t\t= 7,\r\n\tTEX2D\t\t= 8,\r\n\tVEC4BYTE\t= 9,\r\n\t// --- 10,11,12,13,14,15 --- format are free.\r\n\t//\r\n\t// MSB 4 BIT IS BITMASK.\r\n\t//\r\n\tVERTEX\t\t= 0x00,\r\n\tCOLOR\t\t= 0x10,\r\n\tTEXTURE\t\t= 0x20,\r\n\tNORM\t\t= 0x30,\r\n\tEND_LIST\t= 0xFF\r\n};\r\n\r\nenum QUALITY_TYPE {\r\n\tLOWP\t\t= 1,\r\n\tMEDP\t\t= 2,\r\n\tHIGHP\t\t= 3\r\n};\r\n\r\nstruct SVertexEntry {\r\npublic:\r\n\ts32\t\t\t\tvertexInfoID;\r\n\ts32\t\t\t\toffset;\r\n\tbool\t\t\tisVBO;\r\n\tu8\t\t\t\ttype;\r\nprivate:\r\n\t// TODO.\r\n};\r\n\r\nstruct SParam {\r\npublic:\r\n\tconst char*\t\tname;\r\n\tbool\t\t\tisUniform;\r\n\ts32\t\t\t\tvertexORuniformID;\r\n\tu8\t\t\t\tdType;\r\n};\r\n\r\n// Able to use loader directly from code.\r\ns32 TGALoad( const char *fileName, char **buffer, s32 *width, s32 *height, bool load, bool swapXY);\r\n\r\n// Shader : \"name\" + type (Uniform/vertex + Format) + vertexLocationID\r\nclass CIndexBuffer {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tvoid\t\t\toverrideBuffer\t(u32 indexCount, u16* buffer);\r\n\tvoid\t\t\tload\t\t\t(short* pIndex, s32 startIndex, s32 count);\t\r\n\tshort*\t\t\tupdateStart\t\t(s32 startIndexIncluded);\r\n\tvoid\t\t\tupdateComplete\t(s32 endIndexExcluded);\r\n\tvoid\t\t\tsetDrawOffset\t(s32 index);\r\nprivate:\r\n\tCIndexBuffer*\tpNext;\r\n\tshort*\t\t\tptrBuffer;\t\t// Dynamic buffer.\r\n\tbool\t\t\tfromOutside;\r\n\r\n\tGLuint\t\t\tvboID;\r\n\r\n\tu16\t\t\t\toffsetDraw;\r\n\tshort\t\t\tVBOModifyStart;\r\n\tshort\t\t\tVBOModifyEnd;\r\n\tbool\t\t\tisVBO;\r\n\tbool\t\t\tVBOModified;\r\n\tbool\t\t\tVBOModifying;\r\n\r\n\tvoid\t\t\tcommitVBO\t\t();\r\n\r\n\tCIndexBuffer();\r\n\t~CIndexBuffer();\r\n};\r\n\r\nclass CBuffer {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tvoid\t\t\toverrideBuffer\t(u32 vertexCount, float* buffer); \r\n\tvoid\t\t\tload\t\t\t(float* vertexArrayStart, s32 vertexSize, s32 vertexInfoID, s32 startVertex, s32 count);\t\r\n\tfloat*\t\t\tupdateStart\t\t(s32 vertexInfoID, s32 startVertexIncluded, u16* stride, void* internalPtr = NULL); \r\n\tvoid\t\t\tupdateComplete\t(s32 endVertexExcluded);\r\n\tvoid\t\t\tsetDrawOffset\t(s32 index);\r\nprivate:\r\n\tCBuffer*\t\tpNext;\r\n\tfloat*\t\t\tptrBuffer;\t\t// Dynamic buffer.\r\n\tfloat*\t\t\tvboLocalCopy;\t// Dynamic local buffer.\r\n\tGLuint\t\t\tvboID;\r\n\r\n\tSVertexEntry*\tstructure;\r\n\tshort\t\t\tVBOModifyStart;\r\n\tshort\t\t\tVBOModifyEnd;\r\n\ts32\t\t\t\toffsetDrawVBO;\r\n\ts32\t\t\t\toffsetDrawDyn;\r\n\tu8\t\t\t\tstrideVBO;\r\n\tu8\t\t\t\tstrideDyn;\r\n\tu8\t\t\t\tvboCount;\r\n\tu8\t\t\t\tdynCount;\r\n\tbool\t\t\tVBOModified;\r\n\tbool\t\t\tVBOModifying;\r\n\tbool\t\t\tfromOutside;\r\n\tvoid\t\t\tcommitVBO\t\t();\r\n\r\n\tCBuffer();\r\n\t~CBuffer();\r\n};\r\n\r\n// #############################################################################\r\n//\r\n//   \r\n//    SHADER MANAGEMENT\r\n//\r\n//\r\n// #############################################################################\r\n\r\nclass CShader {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CShaderInstance;\r\n\tfriend class CShaderSet;\r\npublic:\r\n\t// Do nothing.\r\nprivate:\r\n\tstruct SInternalParam {\r\n\t\tSParam\t\t\tparam;\r\n\t//\ts32\t\t\t\tlocationID;\r\n\t};\r\n\r\n\tCShader*\t\tpNext;\r\n\tSInternalParam*\tarrayParam;\t\t\t// One Array, shared in two.\r\n\tGLuint\t\t\tshaderObj;\r\n\tu8\t\t\t\tcountUniform;\r\n\tu8\t\t\t\tcountStreamInfo;\r\n\tu8\t\t\t\trefCount;\r\n\r\n\tbool\t\t\tenableTexture;\r\n\tbool\t\t\tenableColor;\r\n\r\n\t// Invisible, only through factory.\r\n\tCShader();\r\n\t~CShader();\r\n};\r\n\r\nclass CShaderInstance {\r\n\tfriend class CShaderSet;\r\n\tfriend class CShader;\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tenum SHADER {\r\n\t\tVERTEX_SHADER = 0,\r\n\t\tPIXEL_SHADER  = 1\r\n\t};\r\n\r\n\tvoid\t\t\tsetUniformTexture\t\t(SHADER type, s32 uniformID, CTextureUsage*\tpTextureUsage);\r\n\tvoid\t\t\tsetUniformI\t\t\t\t(SHADER type, s32 uniformID, GLint* values  );\r\n\tvoid\t\t\tsetUniformF\t\t\t\t(SHADER type, s32 uniformID, GLfloat* values);\r\n\tvoid\t\t\tsetConstantifyVertex\t(s32 vertexID, GLfloat* values);\r\n\tvoid\t\t\tunConstantifyVertex\t\t(s32 vertexID);\r\n\r\nprivate:\r\n\tunion Float_I32\t{\r\n\t\tfloat\tf;\r\n\t\ts32\t\ti;\r\n\t};\r\n\r\n\tstruct SInternalParam {\r\n\t\tCTextureUsage*\tpTexture;\t\t// Store pointer become ID change at runtime.\r\n\t\tFloat_I32\t\tvalues[16];\t\t// Can store up to 4x4 matrices.\t\r\n\t\ts32\t\t\t\tvertexInfoID;\r\n\t\tu8\t\t\t\tisConstantifiedOrUniform;\r\n\t\tu8\t\t\t\tdType;\r\n\t};\r\n\r\n\tSInternalParam*\tparamArrayUniformPixelShader;\r\n\tSInternalParam*\tparamArrayUniformVertexShader;\r\n\tSInternalParam* paramArrayVertexVertexShader;\r\n\tCShaderSet*\t\tm_pShaderSet;\r\n\tCShaderInstance*\tpNext;\r\n\r\n\tbool\t\t\tenableTexture;\r\n\tbool\t\t\tenableColor;\r\n\r\n\t// Invisible, only through factory.\r\n\tCShaderInstance();\r\n\t~CShaderInstance();\r\n};\r\n\r\nclass CShaderSet {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CShaderInstance;\r\n\tfriend class CShader;\r\npublic:\r\n\tCShader*\t\t\tvertexShader;\r\n\tCShader*\t\t\tpixelShader;\r\n\r\n\tCShaderInstance*\tcreateInstance();\r\n\tvoid\t\t\t\treleaseInstance(CShaderInstance* pInstance);\r\nprivate:\r\n\tCShaderInstance*\tpInstances;\r\n\tCShaderSet*\t\t\tpNext;\r\n\tCKLBOGLWrapper*\t\tpMgr;\r\n\ts32*\t\t\t\tlocationArray;\r\n\tGLuint\t\t\t\tprogramObj;\r\n\r\n\tbool\t\t\t\tenableTexture;\r\n\tbool\t\t\t\tenableColor;\r\n\r\n\tvoid\t\t\t\treleaseAllInstances();\r\n\r\n\tCShaderSet();\r\n\t~CShaderSet();\r\n};\r\n\r\nclass CRenderState {\r\n\t// Z Buffer on / off / READ / WRITE / Z VALUE\r\n\t// Stencil\r\n\t// Blend operator setup\r\n};\r\n\r\nclass CImageBuffer {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CFrame;\r\npublic:\r\n\t// Publicly do nothing.\r\nprivate:\r\n\tCImageBuffer();\r\n\t~CImageBuffer();\r\n\t\r\n\tvoid incrementRefCount();\r\n\tvoid decrementRefCount();\r\n\r\n\tCImageBuffer* next;\t\r\n\tGLuint\tbuffer;\r\n\ts32\t\twidth;\r\n\ts32\t\theight;\r\n\tGLenum\tinternalFormat;\r\n\tu8\t\trefCounter;\r\n};\r\n\r\nclass CFrame {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tbool setColorBuffer\t\t(CImageBuffer*\tpBuffer);\r\n\tbool setColorBuffer\t\t(CTexture*\t\tpTexture, u32 mipLevel);\r\n\tbool setDepthBuffer\t\t(CImageBuffer*\tpBuffer);\r\n\tbool setDepthBuffer\t\t(CTexture*\t\tpTexture, u32 mipLevel);\r\n\tbool setStencilBuffer\t(CImageBuffer*\tpBuffer);\r\n\t\r\n\tbool use(bool check);\t// Allow user to verify that setup is correct, else return always true.\r\nprivate:\r\n\tCFrame();\r\n\t~CFrame();\r\n\r\n\tCFrame*\t\t\tnext;\r\n\tCImageBuffer*\tpColBufferBuf;\r\n\tCTexture*\t\tpColBufferTex;\r\n\tCImageBuffer*\tpDepthBufferBuf;\r\n\tCTexture*\t\tpDepthBufferTex;\r\n\tCImageBuffer*\tpStencilBufferBuf;\r\n\r\n\tGLuint\tcolorBuff;\r\n\tGLuint\tdepthBuff;\r\n\tGLuint\tstencilBuff;\r\n\r\n\tGLuint\tframeBuffID;\r\n};\r\n\r\n// #############################################################################\r\n//\r\n//   \r\n//    TEXTURE MANAGEMENT\r\n//\r\n//\r\n// #############################################################################\r\n\r\nclass CTextureUsage {\r\n\tfriend class CTextureBase;\r\n\tfriend class CTexture;\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tenum SAMPLING {\r\n\t\tNEAREST = 0,\r\n\t\tLINEAR  = 1,\r\n\t\tBLEND_IFMIPMAP_BIT = 0x2 \r\n\t};\r\n\r\n\tenum WRAPPING {\r\n\t\tREPEAT\t\t\t= 0,\r\n\t\tCLAMP_TO_EDGE\t= 1\r\n\t\t// MIRRORED\t\t= 2 Not available on OpenGL 2.0 AND 1.1\r\n\t};\r\n\r\n\tvoid\t\t\tinit\t\t\t\t(CTextureBase* pTexture);\r\n\r\n\tvoid \t\t\tactivate\t\t\t(s32 sampler);\r\n\t\r\n\t// \r\n\tvoid\t\t\tsetSampling\t\t\t(SAMPLING minmode, SAMPLING magmode);\r\n\tvoid \t\t\tsetWrapping\t\t\t(WRAPPING U_mode, WRAPPING V_mode);\r\n\r\n\t// Lots of people need to find a texture based on usage ptr, put as public for now.\r\n\tCTextureBase*\t\tpTexture;\r\nprivate:\r\n\tGLenum\tminSampling;\r\n\tGLenum\tmaxSampling;\r\n\tGLenum\tuMode;\r\n\tGLenum\tvMode;\r\n\tbool\tsamplingSetupDone;\r\n\r\n\tCKLBOGLWrapper*\tpMgr;\r\n\tCTextureUsage*\t\tpNext;\r\n\r\n\tCTextureUsage();\r\n\t~CTextureUsage();\r\n};\r\n\r\nclass CTextureBase {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CTextureUsage;\r\n\tfriend class CTexture;\r\n\tfriend class CSubTexture;\r\n\tfriend class CFontTexture;\r\npublic:\r\n\tenum UVCOMPUTE_MODE {\r\n\t\tTOP_LEFT\t\t= 0,\r\n\t\tCENTROID\t\t= 1\r\n\t};\r\n\r\n\tu32\tisAlpha\t(float u,float v);\r\n\r\n\tinline\r\n\ts32 \t\t\tgetWidth\t\t\t\t()\t\t\t\t\t\t\t\t\t{ return width; \t}\r\n\tinline\r\n\ts32 \t\t\tgetHeight\t\t\t\t()\t\t\t\t\t\t\t\t\t{ return height;\t}\r\n\t\r\n\tCTextureUsage*\tcreateUsage\t\t\t\t();\r\n\tvoid \t\t\treleaseUsage\t\t\t(CTextureUsage* pUsage);\r\n\r\n\tCSubTexture*\tsetSubAtlas\t\t\t\t(bool asFont, s32 x, s32 y, s32 width, s32 height);\r\n\tvoid\t\t\treleaseSubTexture\t\t(CSubTexture* pSubTex);\r\n\tbool\t\t\tupdateTexture\t\t\t(s32 x, s32 y, s32 width, s32 height, void* data, s32 dataSize);\r\n\tvoid\t\t\tupdateTextureFromFrame\t(u32 mipLevel, s32 dstX, s32 dstY, s32 srcX, s32 srcY, s32 srcW, s32 srcH);\r\n\tvoid\t\t\tconvertPixelToRenderUV\t(s32 x, s32 y, UVCOMPUTE_MODE sampling, float* u, float* v);\r\n\tvoid\t\t\tconvertLocalUVToRenderUV(float lu, float lv, float* u, float *v);\r\n\tvoid\t\t\tassignSWAlphaBuffer\t\t(u8* buffer);\r\n\tu8*\t\t\t\tgetSWAlphaBuffer\t\t()\t{ return pSWAlphaMap ; }\r\n\r\n\t// To allow user to get main texture easily.\r\n\tCTexture*\t\tpMaster;\r\nprivate:\r\n\t// In absolute top parent coordinate system\r\n\ts32\t\t\t\tx;\r\n\ts32\t\t\t\ty;\r\n\r\n\ts32\t\t\t\twidth;\r\n\ts32\t\t\t\theight;\r\n\ts32\t\t\t\tusageCount;\r\n\tu8*\t\t\t\tpSWAlphaMap;\r\n\r\n\tCKLBOGLWrapper*\tpMgr;\r\n\r\n\tCTextureUsage\tusageList;\r\n\r\n\t// Atlas feature.\r\n\tCTextureBase*\tpParent;\r\n\tCTextureBase*\tpChild;\r\n\tCTextureBase*\tpBrother;\r\n\r\n\tCTextureBase();\r\n\t~CTextureBase();\r\n\r\n\tvoid \t\t\treleaseUsage\t\t();\r\n\tvoid\t\t\treleaseSubTextures\t();\r\n};\r\n\r\nclass CTexture : public CTextureBase {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CTextureUsage;\r\n\tfriend class CTextureBase;\r\n\tfriend class CFontTexture;\r\n\tfriend class CFrame;\r\npublic:\r\n\tvoid\t\t\tmakeEmptyShell\t\t\t();\r\n\tGLuint\t\t\tactiveTexture;\t\r\nprivate:\r\n\tGLuint\t\t\tgetWorkingTexture() {\r\n\t\tif (pMaster->isDoubleBuffered) {\r\n\t\t\treturn (pMaster->activeTexture == pMaster->texture) ? pMaster->textureDoubleBuff : pMaster->texture; \r\n\t\t} else {\r\n\t\t\treturn pMaster->texture;\r\n\t\t}\r\n\t}\r\n\r\n\tfloat\t\t\tUPerPixel;\r\n\tfloat\t\t\tVPerPixel;\r\n\t\r\n\tCTexture*\t\tpNext;\r\n\tbool\t\t\tisDoubleBuffered;\r\n\tbool\t\t\tisMipmapped;\r\n\tbool\t\t\tisCompressed;\r\n\tbool\t\t\tis3D;\r\n\ts32\t\t\t\tframe;\r\n\r\n\t// Open GL side\r\n\tGLenum\t\t\tformat;\r\n\tGLint\t\t\tchannels;\r\n\r\n\tGLuint\t\t\ttexture;\r\n\tGLuint\t\t\ttextureDoubleBuff;\r\n\r\n\tCTexture ();\r\n\t~CTexture();\r\n};\r\n\r\nclass CFontTexture;\r\n\r\nclass CSubTexture : public CTextureBase {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CTexture;\r\n#ifndef __GNUC__\r\n\tfriend class CSubTexture;\r\n#endif\r\n\tfriend class CTextureBase;\r\n\tfriend class CFontTexture;\r\n\t// No member, no function for now.\r\nprivate:\r\n\tCSubTexture();\r\n\t~CSubTexture();\r\n};\r\n\r\nclass CFontTexture : public CSubTexture {\r\n\tfriend class CTextureBase;\r\npublic:\r\n\tvoid setup\t\t\t(s32 fixedSize);\r\n\tbool setupCharCount\t(u16 charCount);\r\n\r\n\tvoid registerChar\t(unichar c, s32 variableSize);\r\n\tvoid registerChar\t(unichar c, u32 x, u32 y, u32 w, u32 h, bool rot = false, u8 marginTopLeft = 0, u8 marginBottomRight = 0);\r\n\tvoid getChar\t\t(unichar c, float* u0, float* u1, float* v0, float* v1, float* w, float* h);\r\nprivate:\r\n\ts32\t\t\t\tfixedSize;\r\n\ts32\t\t\t\tcurrX;\r\n\ts32\t\t\t\tcurrY;\r\n\tfloat*\t\t\tu0u1v0v1;\r\n\tu32*\t\t\twh;\r\n\r\n\tCFontTexture();\r\n\t~CFontTexture();\r\n};\r\n\r\nstruct USampler {\r\n\tGLuint\ttexture;\r\n};\r\n\r\n// #############################################################################\r\n//\r\n//   \r\n//    MAIN SYSTEM\r\n//\r\n//\r\n// #############################################################################\r\nstruct SRenderState {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tSRenderState();\r\n\r\n\tenum RENDER_MODE {\r\n\t\tONLY_COLOR,\r\n\t\tONLY_TEXTURE,\r\n\t\tTEXTURE_MUL_COLOR,\r\n\t\tES2_BRIGHTNESS,\r\n\t\tES2_COLORIZE,\r\n\t\tES2_SATURATE,\r\n\t\tES2_RAMP,\r\n\t\tES2_TONE,\r\n\t\tES2_MOSAIC\r\n\t};\r\n\r\n\tenum BLEND_MODE {\r\n\t\tNO_ALPHA,\r\n\t\tALPHA,\r\n\t\tADDITIVE,\r\n\t\tADDITIVE_ALPHA\r\n\t};\r\n\r\n\tenum BLEND_DST {\r\n\t\tD_ONE\t\t\t\t\t\t= GL_ONE,\r\n\t\tD_SRC_COLOR\t\t\t\t\t= GL_SRC_COLOR,\r\n\t\tD_ONE_MINUS_SRC_COLOR\t\t= GL_ONE_MINUS_SRC_COLOR,\r\n\t\tD_SRC_ALPHA\t\t\t\t\t= GL_SRC_ALPHA,\r\n\t\tD_ONE_MINUS_SRC_ALPHA\t\t= GL_ONE_MINUS_SRC_ALPHA,\r\n\t\tD_DST_ALPHA\t\t\t\t\t= GL_DST_ALPHA,\r\n\t\tD_ONE_MINUS_DST_ALPHA\t\t= GL_ONE_MINUS_DST_ALPHA\r\n\t};\r\n\r\n\tenum BLEND_SRC {\r\n\t\tS_ZERO\t\t\t\t\t\t= GL_ZERO,\r\n\t\tS_ONE\t\t\t\t\t\t= GL_ONE,\r\n\t\tS_DST_COLOR\t\t\t\t\t= GL_DST_COLOR,\r\n\t\tS_ONE_MINUS_DST_COLOR\t\t= GL_ONE_MINUS_DST_COLOR,\r\n\t\tS_SRC_ALPHA_SATURATE\t\t= GL_SRC_ALPHA_SATURATE,\r\n\t\tS_SRC_ALPHA\t\t\t\t\t= GL_SRC_ALPHA,\r\n\t\tS_ONE_MINUS_SRC_ALPHA\t\t= GL_ONE_MINUS_SRC_ALPHA,\r\n\t\tS_DST_ALPHA\t\t\t\t\t= GL_DST_ALPHA,\r\n\t\tS_ONE_MINUS_DST_ALPHA\t\t= GL_ONE_MINUS_DST_ALPHA\r\n\t};\r\n\r\n\tenum DEPTH_OP {\r\n\t\tLESS\t= GL_LESS,\r\n\t\tGREATER\t= GL_GREATER,\r\n\t\tLEQUAL\t= GL_LEQUAL,\r\n\t\tGEQUAL\t= GL_GEQUAL,\r\n\t\tEQUAL\t= GL_EQUAL,\r\n\t\tNOTEQUAL= GL_NOTEQUAL,\r\n\t\tALWAYS\t= GL_ALWAYS,\r\n\t\tNEVER\t= GL_NEVER\r\n\t};\r\n\r\n\tenum STENCIL_OP {\r\n\t\tKEEP\t= GL_KEEP,\r\n\t\tZERO\t= GL_ZERO,\r\n\t\tREPLACE\t= GL_REPLACE,\r\n\t\tINCR\t= GL_INCR,\r\n\t\tDECR\t= GL_DECR,\r\n#ifdef OPENGL2\r\n\t\tINCR_WRAP = GL_INCR_WRAP,\r\n\t\tDECR_WRAP = GL_DECR_WRAP,\r\n#endif\r\n\t\tINVERT\t  = GL_INVERT\r\n\t};\r\n\r\n\tenum BLEND_OP {\r\n\t\tADD\t\t= 0,\r\n#ifdef OPENGL2\r\n\t\tSUB\t\t= 1,\r\n\t\tREVSUB\t= 2\r\n#endif\r\n\t};\r\n\r\n\tvoid setTextMode\t\t(bool active);\r\n\tvoid setBlend\t\t\t(BLEND_MODE mode);\r\n\tvoid setBlendAdvance\t(BLEND_SRC src, BLEND_DST dst, BLEND_OP src_op_dst);\r\n\tvoid setDepthState\t\t(bool write, bool test, DEPTH_OP op);\r\n\r\n\tvoid setStencilTestCW\t(u32 readMask, u32 refValue, DEPTH_OP compare_op); \r\n\tvoid setStencilTestCCW\t(u32 readMask, u32 refValue, DEPTH_OP compare_op); \r\n\r\n\tvoid setStencilWriteCW\t(u32 writeMask, STENCIL_OP opFailStencil, STENCIL_OP opFailZ, STENCIL_OP opSucceed);\r\n\tvoid setStencilWriteCCW\t(u32 writeMask, STENCIL_OP opFailStencil, STENCIL_OP opFailZ, STENCIL_OP opSucceed);\r\n\r\n\tvoid enableAlphaTest\t(float value, DEPTH_OP compare_op);\r\n\tvoid disableAlphaTest\t();\r\n\r\n\tvoid enableScissor\t\t(s32 x, s32 y, s32 w, s32 h);\r\n\tvoid disableScissor\t\t();\r\n\r\n\tvoid dump\t\t\t\t();\r\npublic:\r\n\tbool\t\tchanged;\r\n\r\n\t// Scissor\t(ability for external recomputation : public)\r\n\tGLint\t\tscX;\r\n\tGLint\t\tscY;\r\n\tGLsizei\t\tscW;\r\n\tGLsizei\t\tscH;\r\n\tu8\t\t\tbEnableScissor;\r\n\r\nprivate:\r\n\t// Blending\r\n\tu8\t\t\tblendEnable;\r\n\tGLenum\t\tblendSrcFactor;\r\n\tGLenum\t\tblendDstFactor;\r\n\tu8\t\t\tblendOp;\r\n\r\n\t// Depth\r\n\tu8\t\t\tdepthWriteEnable;\r\n\tu8\t\t\tdepthTestEnable;\r\n\tGLenum\t\tdepthFunction;\r\n\t\r\n\t// Custom text mode\r\n\tu8\t\t\ttextMode;\r\n\r\n\t// Alpha Test\r\n\tu8\t\t\talphaTestEnable;\r\n\tGLenum\t\talphaFunction;\r\n\tfloat\t\talphaValue;\r\n\r\n\t//\r\n\t// Stencil Read\r\n\t//\r\n\tu16\t\t\tstReadMaskCW;\r\n\tu16\t\t\tstReadMaskCCW;\r\n\tu16\t\t\tstRefValueCW;\r\n\tu16\t\t\tstRefValueCCW;\r\n\tDEPTH_OP\tstRefOpCW;\r\n\tDEPTH_OP\tstRefOpCCW;\r\n\r\n\t//\r\n\t// Stencil Write\r\n\t//\r\n\tu16\t\t\tstWriteMaskCW;\r\n\tu16\t\t\tstWriteMaskCCW;\r\n\tSTENCIL_OP\tstWriteFailS_StencilOP_CW;\r\n\tSTENCIL_OP\tstWriteFailZ_StencilOP_CW;\r\n\tSTENCIL_OP\tstWriteSuccZ_StencilOP_CW;\r\n\tSTENCIL_OP\tstWriteFailS_StencilOP_CCW;\r\n\tSTENCIL_OP\tstWriteFailZ_StencilOP_CCW;\r\n\tSTENCIL_OP\tstWriteSuccZ_StencilOP_CCW;\r\n};\r\n\r\nclass CKLBOGLWrapper {\r\n\tfriend class CTextureUsage;\r\npublic:\r\n\tinline\r\n\tstatic CKLBOGLWrapper& getInstance() {\r\n\t\tstatic CKLBOGLWrapper instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release() {\r\n\t\tgetInstance()._release();\r\n\t}\r\n\r\n\t// Texture.\r\n\tenum TEX_OPTION {\r\n\t\tTEX_NONE\t\t\t\t\t= 0,\r\n\t\tTEX_OPT_DOUBLEBUFFERED_BIT\t= 0x1,\r\n\t\tTEX_OPT_MIPMAP_BIT\t\t\t= 0x2,\r\n\t\tTEX_OPT_COMPRESSED_BIT\t\t= 0x4,\r\n\t\tTEX_OPT_3D\t\t\t\t\t= 0x8\r\n\t};\r\n\r\n\tenum TEX_CHANNEL {\r\n\t\tALPHA\t\t\t= 1,\r\n\t\tRGB\t\t\t\t= 3,\r\n\t\tRGBA\t\t\t= 4,\r\n\t\tLUMINANCE\t\t= 0,\r\n\t\tLUMINANCE_ALPHA\t= 2\r\n\t};\r\n\r\n\tenum SHADER_TYPE {\r\n\t\tVERTEX_SHADER\t= 0,\r\n\t\tPIXEL_SHADER\t= 1\r\n\t};\r\n\r\n\tbool\t\t\tinit(float displayMatrix[6]);\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t// Buffers.\r\n\t//\r\n\r\n\ts32\t\t\t\tgetFrame()\t\t\t{ return frame; }\r\n\tvoid\t\t\tendFrame();\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t// Rendering.\r\n\t//\r\n\r\n\tvoid\t\t\tresetSampler\t\t(s32 sampler);\r\n\tvoid\t\t\tapplyState(SRenderState* pState);\r\n\tvoid\t\t\tdraw(\r\n\t\t\t\t\t\t\t\tGLenum\t\t\t\tmode,\r\n\t\t\t\t\t\t\t\tCShaderInstance*\tinstance,\r\n\t\t\t\t\t\t\t\tCBuffer**\t\t\tpBuffer,\r\n\t\t\t\t\t\t\t\tu32\t\t\t\t\tbufferCount,\r\n\t\t\t\t\t\t\t\tCIndexBuffer*\t\tpIndexBuffer,\r\n\t\t\t\t\t\t\t\tCTextureUsage**\t\tarray_pTexture,\r\n\t\t\t\t\t\t\t\ts32*\t\t\t\tuniformID,\r\n\t\t\t\t\t\t\t\ts32\t\t\t\t\tindexCount);\r\n\r\n\tvoid\t\t\tsetRenderFrame(CFrame* pFrame = 0);\r\n\t\r\n\t\r\n\t// ------------------------------------------------------------------------\r\n\t// Object Allocation / Management\r\n\t//\r\n\r\n\tCTexture*\t\tloadTGA\t\t\t\t(const char* filename, u32 pixFormat, s32* rw = null, s32* rh = null, bool load = true, bool swapXY = false, CTexture* res = null, int x = 0, int y = 0, TEX_OPTION option = TEX_NONE);\r\n\tCTexture*\t\tloadCompress\t\t(const char* filename, u32 pixFormat, u32 w, u32 h, TEX_OPTION option = TEX_NONE);\r\n\r\n\t// 0 : Color\r\n\t// 1 : Depth\r\n\t// 2 : Stencil\r\n\tCImageBuffer*\tcreateImageBuffer\t(s32 width, s32 height, GLenum internalformat);\r\n\tvoid\t\t\treleaseImageBuffer\t(CImageBuffer* imageBuffer);\r\n\r\n\tbool\t\t\tsupportFrame\t\t();\r\n\tbool\t\t\tsupport3DTexture\t();\r\n\r\n\tCFrame*\t\t\tcreateFrame\t\t\t();\r\n\tvoid\t\t\treleaseFrame\t\t(CFrame* pFrame);\r\n\r\n\tbool\t\t\tcopyScreenRGB888\t(u32 srcx, u32 srcy, u32 width,u32 height,u8* buffer);\r\n\r\n\tCTexture*\t\tcreateTexture\t\t(s32 width, s32 height, GLenum pixelFormat, TEX_CHANNEL channelCount,void* data, s32 dataLength = 0, TEX_OPTION option = TEX_NONE, s32 depth = 0, CTexture* reload = NULL);\r\n\tvoid\t\t\treleaseTexture\t\t(CTexture* texture);\r\n\t\r\n\t// Shaders.\r\n\tCShader*\t\tcreateShader\t\t(SRenderState::RENDER_MODE, SHADER_TYPE type, const SParam* listParam);\r\n\tCShader*\t\tcreateShader\t\t(const char* source, SHADER_TYPE type, const SParam* listParam);\r\n\tvoid\t\t\treleaseShader\t\t(CShader* pShader);\r\n\r\n\t// Rendering Shader.\r\n\tCShaderSet*\t\tcreateShaderSet\t\t(CShader* pVertexShader, CShader* pPixelShader);\r\n\tvoid\t\t\treleaseShaderSet\t(CShaderSet* pFullShader);\r\n\r\n\tCBuffer*\t\tcreateVertexBuffer\t(s32 vertexCount, const SVertexEntry* listComponent, void* usingOutsideBuffer = NULL);\r\n\tvoid\t\t\treleaseVertexBuffer\t(CBuffer* pBuffer);\r\n\r\n\tCIndexBuffer*\tcreateIndexBuffer\t(s32 indexCount, bool asVBO, void* usingOutsideBuffer = NULL);\r\n\tvoid\t\t\treleaseIndexBuffer\t(CIndexBuffer* pBuffer);\r\n\r\n\tvoid\t\t\tassignSampler\t\t(CTextureUsage* pTextureInstance, s32 sampler);\r\nprivate:\r\n\tCKLBOGLWrapper\t();\r\n\t~CKLBOGLWrapper\t();\r\n\tvoid _release\t();\r\n\r\n\tCKLBOGLWrapper\t(CKLBOGLWrapper const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t(CKLBOGLWrapper const&);\t\t// Dont implement.\r\n\r\n\tconst char*\t\tpatch\t\t\t\t(const char* shader, const char* glslTransform);\r\n\r\n\tGLuint\t\t\tarrayBufferID;\r\n\tvoid\t\t\t_glBindBuffer\t\t(GLuint id);\r\n\r\n\tUSampler\t\tsamplerUnit[4];\r\n\ts32\t\t\t\tframe;\r\n\r\n\tGLfloat\t\t\tdisplayMatrix2D[16];\r\n\r\n\tCTexture*\t\tm_pTextureList;\r\n\tCShader*\t\tshaderList;\r\n\tCShaderSet*\t\tshaderSetList;\r\n\tCBuffer*\t\tbufferList;\r\n\tCIndexBuffer*\tindexBufferList;\r\n\tCImageBuffer*\timgBufferList;\r\n\tCFrame*\t\t\tframeList;\r\n\r\n\tSRenderState\trState;\r\n\tSRenderState*\tm_pLastState;\r\n\tCShaderInstance*\r\n\t\t\t\t\tm_lastShaderInstance;\r\n\tGLuint\t\t\tlastElementArrayBuffer;\r\n\tu8\t\t\t\tenableColor;\r\n\tu8\t\t\t\tenableTexture;\r\n\r\n#ifdef OPENGL2\r\n\tchar shaderPatchArray[1000];\r\n#endif\r\n\tvoid*\t\t\t_glTexImage3DOES;\r\n\tvoid*\t\t\t_glTexSubImage3DOES;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/TextureManagement.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __TEXTURE_MGT__\r\n#define __TEXTURE_MGT__\r\n\r\n#include \"CKLBAsset.h\"\r\n\r\nclass KLBTextureAssetPlugin;\r\n\r\nclass CTexture;\r\nclass CTextureUsage;\r\nclass CKLBImageAsset;\r\n\r\n/*!\r\n* \\class CKLBTextureAsset\r\n* \\brief Texture Asset Class\r\n* \r\n* Texture asset is a texture that describes a 2D texture uploaded to the GPU.\r\n* Inside a texture asset file, we also store a list of 2D models.\r\n* A 2D model is a list vertices and related indexes for rendering triangles. \r\n*/\r\nclass CKLBTextureAsset : public CKLBAbstractAsset {\r\n\tfriend class KLBTextureAssetPlugin;\r\npublic:\r\n\r\n\tCKLBTextureAsset();\r\n\t~CKLBTextureAsset();\r\n\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t{ return ASSET_TEXTURE;\t\t}\r\n\tvirtual u32\t\t\tgetClassID\t()\t{ return CLS_ASSETTEXTURE;  }\r\n\r\n\t/* NO DICO\r\n\tvirtual bool\tinclude\t\t\t\t(const char* name);*/\r\n\tvirtual void unloadRessource();\r\n\r\n\tvirtual void onRegisterSubAsset\t\t();\r\n\tvirtual void onUnregisterSubAsset\t();\r\n\r\n\tCKLBImageAsset*\t\tgetImage\t\t(const char* fileName);\r\n\r\n\tu16\t\t\t\t\tm_width;\r\n\tu16\t\t\t\t\tm_height;\r\n\tu16\t\t\t\t\tm_type;\r\n\tu32\t\t\t\t\tm_totalVertexCount;\r\n\tu32\t\t\t\t\tm_totalIndexCount;\r\n\tu16\t\t\t\t\tm_imageCount;\r\n\tvoid*\t\t\t\tm_bitmap;\r\n\tu16*\t\t\t\tm_indexBufferTotal;\r\n\tfloat*\t\t\t\tm_floatBufferTotal;\r\n\tCTexture*\t\t\tm_pTexture;\r\n\tCTextureUsage*\t\tm_pTextureUsage;\r\n\tCKLBImageAsset**\tm_pImages;\r\n\tu8*\t\t\t\t\tm_softTexture;\r\n\tu8\t\t\t\t\tm_bytePerPix;\r\n};\r\n\r\nstruct SKLBRect {\r\npublic:\r\n\ts16\tm_iLeft;\r\n\ts16 m_iRight;\r\n\ts16 m_iTop;\r\n\ts16 m_iBottom;\r\n\r\n\tinline\r\n\ts32 getWidth() {\treturn m_iRight - m_iLeft; }\r\n\r\n\tinline\r\n\ts32 getHeight() {\treturn m_iBottom - m_iTop; }\r\n};\r\n\r\n/*!\r\n* \\class CKLBImageAsset\r\n* \\brief Image Asset Class\r\n* \r\n* CKLBImageAsset is a basic asset for image rendering.\r\n* It uses a CKLBTextureAsset.\r\n* There are also various attributes that are stored within an image asset.\r\n*/\r\nclass CKLBImageAsset : public CKLBAsset {\r\n\tfriend class KLBTextureAssetPlugin;\r\npublic:\r\n\tstatic const u8\t\tIS_STANDARD_RECT\t= 0x1;\r\n\tstatic const u8\t\tIS_SCALE9\t\t\t= 0x2;\r\n\tstatic const u8\t\tIS_SCROLLBARTYPE\t= 0x4;\r\n\tstatic const u8\t\tIS_3DMODEL\t\t\t= 0x8;\r\n\r\n\tstatic CKLBNode*\tcreateSprite\t(\tu32 textureHandle,\r\n\t\t\t\t\t\t\t\t\t\t\tconst char* imageName,\r\n\t\t\t\t\t\t\t\t\t\t\tCKLBNode* pParentNode,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 renderPriority);\r\n\r\n\tCKLBImageAsset();\r\n\t~CKLBImageAsset();\r\n\r\n\tvirtual CKLBNode*\tcreateSubTree\t(u32 priorityBase = 0);\r\n\tvirtual u32\t\t\tgetClassID\t\t()\t\t{ return CLS_ASSETIMAGE;\t}\r\n\tvirtual\tASSET_TYPE\tgetAssetType\t()\t\t{ return ASSET_IMAGE;\t\t}\r\n\r\n\tinline\r\n\tu32\t\t\t\t\tgetVertexCount\t()\t\t{ return m_uiVertexCount;\t}\r\n\r\n\tinline\r\n\tu32\t\t\t\t\tgetIndexCount\t()\t\t{ return m_uiIndexCount;\t}\r\n\r\n\tCKLBTextureAsset*\tgetTexture\t\t()\t\t{ return m_pTextureAsset;\t}\t\r\n\r\n\tinline\r\n\tSKLBRect*\t\t\tgetSize\t\t\t()\t\t{ return &m_imageSize;\t\t}\r\n\r\n\tvoid\t\t\t\tsetSubImage\t\t(u32 width, u32 height, u32 offX, u32 offY);\r\n\tCKLBImageAsset*\t\tfindSub\t\t\t(u32 index);\r\n\r\n\tvoid\t\t\t\taddSubImage\t\t(CKLBImageAsset* pImage);\r\n\r\n\t/** Warning : the asset pointer is not managed and becomes the responsability of the owner. */\r\n\tCKLBImageAsset*\t\tgetSubImage\t\t(u32 index, CKLBImageAsset* replaceAsset = NULL);\r\n\r\n\tvoid\t\t\t\tgetCenter\t\t(s32& cx, s32& cy);\r\n\tCKLBImageAsset*\t\tgetAsTopLeftImage(s32 offX, s32 offY);\r\n\r\n\tinline\r\n\tu16*\t\t\t\tgetIndexBuffer\t()\t{ return m_pIndex;\t\t}\r\n\r\n\tinline\r\n\tfloat*\t\t\t\tgetUVBuffer\t\t()\t{ return m_pUVCoord;\t}\r\n\r\n\tinline\r\n\tfloat*\t\t\t\tgetXYBuffer\t\t()\t{ return m_pXYCoord;\t}\r\n\r\n\tvoid\t\t\t\tgetXY(u32 vertexIndex, float* pX, float* pY);\r\n\tvoid\t\t\t\tgetUV(u32 vertexIndex, float* pU, float* pV);\r\n\r\n\tbool\t\t\t\tgetAttribute(u8 attribID, s32& attribValue);\r\n\tbool\t\t\t\tgetAttribute(u8 attribID, float& attribValue);\r\n\tbool\t\t\t\tgetAttribute(u8 attribID, const char*& attribValue);\r\n\r\n\tinline u8\t\t\thasStandardAttribute(u8 mask)\t{ return m_usageType & mask; }\r\npublic:\r\n\tASSET_ATTRIB*\t\tm_attribList;\r\n\r\n\tu16*\t\t\t\tm_pIndex;\r\n\tfloat*\t\t\t\tm_pUVCoord;\r\n\tfloat*\t\t\t\tm_pXYCoord;\r\n\r\n\tCKLBTextureAsset*\tm_pTextureAsset;\r\n\r\n\tCKLBImageAsset*\t\tm_subTiles;\r\n\tCKLBImageAsset*\t\tm_nextSubTile;\r\n\r\n\tSKLBRect\t\t\tm_imageSize;\t// Original image size\r\n\tfloat\t\t\t\tm_boundWidth;\r\n\tfloat\t\t\t\tm_boundHeight;\r\n\ts32\t\t\t\t\tm_renderOffset;\r\n\r\n\ts16\t\t\t\t\tm_subIndex;\r\n\r\n\ts16\t\t\t\t\tm_iCenterX;\r\n\ts16\t\t\t\t\tm_iCenterY;\r\n\r\n\tu16\t\t\t\t\tm_uiVertexCount;\r\n\tu16\t\t\t\t\tm_uiIndexCount;\r\n\r\n\r\n\tu16\t\t\t\t\tm_attribMask;\r\n\tu16\t\t\t\t\tm_attribCount;\r\n\tu16\t\t\t\t\tm_tileWidth;\r\n\tu16\t\t\t\t\tm_tileHeight;\r\n\tu16\t\t\t\t\tm_tileOffX;\r\n\tu16\t\t\t\t\tm_tileOffY;\r\n\tu16\t\t\t\t\tm_tileCount;\r\n\tu16\t\t\t\t\tm_uiSubTileCount;\r\n\tu8\t\t\t\t\tm_usageType;\r\n\tbool\t\t\t\tm_bAllocatedOutsideTexture;\r\nprivate:\r\n\tCKLBImageAsset*\t\tm_topLeftImage;\r\n};\r\n\r\nenum E_TEXTURELOADINGMODE {\r\n\tTEX_LOAD_GPU,\r\n\tTEX_LOAD_CPU,\r\n\tTEX_LOAD_GPUCPU\r\n};\r\n\r\n/*!\r\n* \\class KLBTextureAssetPlugin\r\n* \\brief Texture Asset Plugin Class\r\n* \r\n* Plugin responsible for loading texture and images inside texture.\r\n* See CKLBTextureAsset and CKLBImageAsset.\r\n*/\r\nclass KLBTextureAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBTextureAssetPlugin();\r\n\t~KLBTextureAssetPlugin();\r\n\r\n\tvoid\tsetLoadingMode(E_TEXTURELOADINGMODE mode);\r\n\tu8*\t\tcreateSoftTexture\t(\ts32 width, \r\n\t\t\t\t\t\t\t\t\ts32 height, \r\n\t\t\t\t\t\t\t\t\tu32 pixelFormat, \r\n\t\t\t\t\t\t\t\t\tu8 channelCount, \r\n\t\t\t\t\t\t\t\t\tvoid* data );\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID\t\t()\t\t\t{ return CHUNK_TAG('T','E','X','B'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader\t\t()\t\t\t{ return 'T';\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension\t()\t\t\t{ return \".texb\"; }\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize);\r\n\tvirtual void\t\t\t\tsetCurrentFileName(const char* currentFileName) {\r\n\t\tm_currentFile = currentFileName;\r\n\t}\r\n\r\n\tvoid\t\t\t\tsetBuffers\t\t(CKLBTextureAsset*\tpTextureAsset, float* uvBuffer, float* xyBuffer, u16* indexBuffer);\r\n\tCKLBImageAsset*\t\tloadImage\t\t(u8* stream, u32 streamSize, CKLBImageAsset* pReload);\r\n\tvoid\t\t\t\tsetQuarterTexture(bool activate) {\r\n\t\tm_useQuarterTexture = activate;\r\n\t}\r\nprivate:\r\n\tfloat*\t\t\t\tm_pUVBuffer;\r\n\tfloat*\t\t\t\tm_pXYBuffer;\r\n\tfloat*\t\t\t\tm_pLastLoadedUV;\r\n\tu16*\t\t\t\tm_pLastLoadedIndex;\r\n\tu16*\t\t\t\tm_pIndexBuffer;\r\n\tCKLBTextureAsset*\tm_pTextureAsset;\r\n\tconst char*\t\t\tm_currentFile;\r\n\tbool\t\t\t\tm_loadHardware;\r\n\tbool\t\t\t\tm_loadSoftware;\r\n\tbool\t\t\t\tm_useQuarterTexture;\r\n};\r\n\r\nbool createScreenAsset\t(const char* name, u32 orgWidthI, u32 orgHeightI);\r\nbool doScreenShot\t\t(const char* name, u32 srcx, u32 srcy, u32 width, u32 height, u32 dstx, u32 dsty);\r\nvoid freeScreenAsset\t(const char* name);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/ViewController.h",
    "content": "#import <StoreKit/StoreKit.h>\n#import \"EAGLView.h\"\n#import \"CiOSMovieView.h\"\n\n@interface ViewController {\n\tIBOutlet CiOSMovieView *viewBase;\n\tIBOutlet EAGLView *viewGL;\n}\n\n\n\n- (void)viewRecovery;\n- (void)stopAnimation;\n- (void)startAnimation;\n- (void)finishStoreTransaction:(NSString *)receipt;\n- (void)clearUITouches;\n\n\n\n@end\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/assert_klb.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __ASSERT_SYSTEM__\r\n#define __ASSERT_SYSTEM__\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n//#ifdef assert\r\n//#error \"Already using standard C Assert\"\r\n//#endif\r\n//#undef assert\r\n\tvoid assertFunction(int line, const char* file, const char* msg,...);\r\n#ifdef _WIN32\r\n#define klb_assert(cond,msg,...)\t\tif (!(cond)) { assertFunction(__LINE__, __FILE__, msg, __VA_ARGS__); }\r\n#define klb_assertNull(cond, msg, ...)\t;\r\n#define klb_assertAlways(msg,...)\t\t{ assertFunction(__LINE__, __FILE__, msg, __VA_ARGS__); }\r\n#else\r\n#if (DEBUG == 1)\r\n#define klb_assert(cond,msg...)\t\t\tif(!(cond)) { assertFunction(__LINE__, __FILE__, msg); }\r\n#define klb_assertNull(cond, msg, ...)\t;\r\n#define klb_assertAlways(msg...)\t\t{ assertFunction(__LINE__, __FILE__, msg); }\r\n#else\r\n#define klb_assert(cond,msg...)\t\t\t;\r\n#define klb_assertNull(cond, msg, ...)\t;\r\n#define klb_assertAlways(msg...)\t\t;\r\n#endif\r\n#endif\r\n\r\nvoid msgBox(char* msg);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/encryptFile.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef H_HEADER_PROTECT_ENCRYPTFILE_H\r\n#define H_HEADER_PROTECT_ENCRYPTFILE_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"encryptUserContext.h\"\r\n\r\n/*!\r\n    @class  DecryptBaseClass\r\n    @brief  複合化基礎クラス\r\n */\r\nclass CDecryptBaseClass {\r\npublic:\r\n\tSUserStruct\tm_userCtx;\r\n\tbool\t\tm_decrypt;\r\n\tbool\t\tm_useNew;\r\nprivate:\r\n\tvoid\t\tdecrypt(void* ptr, u32 length);\r\npublic:\r\n\tCDecryptBaseClass();\r\n\tinline void decryptBlck(void* ptr, u32 length) {\r\n\t\tif (m_decrypt) { decrypt(ptr, length); }\r\n\t}\r\n\r\n\tu32\t\t\tdecryptSetup(const u8* ptr, const u8* hdr);\r\n\tvoid\t\tgotoOffset\t(u32 offset);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/glUtil.h",
    "content": "/*\n File: glUtil.h\n Abstract:\n Includes the appropriate OpenGL headers (depending on whether this\n is built for iOS or OSX) and provides some API utility functions\n \n Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __GL_UTIL_H__\n#define __GL_UTIL_H__\n\n#if ESSENTIAL_GL_PRACTICES_IOS\n\n#import <OpenGLES/ES2/gl.h>\n#import <OpenGLES/ES2/glext.h>\n\n#else\n\n#import <OpenGL/OpenGL.h>\n\n// OpenGL 3.2 is only supported on MacOS X Lion and later\n// CGL_VERSION_1_3 is defined as 1 on MacOS X Lion and later\n#if CGL_VERSION_1_3\n// Set to 0 to run on the Legacy OpenGL Profile\n#define ESSENTIAL_GL_PRACTICES_SUPPORT_GL3 1\n#else\n#define ESSENTIAL_GL_PRACTICES_SUPPORT_GL3 0\n#endif //!CGL_VERSION_1_3\n\n#if ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n#import <OpenGL/gl3.h>\n#else\n#import <OpenGL/gl.h>\n#endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n\n#endif // !ESSENTIAL_GL_PRACTICES_IOS\n\n\n//The name of the VertexArrayObject are slightly different in\n// OpenGLES, OpenGL Core Profile, and OpenGL Legacy\n// The arguments are exactly the same across these APIs however\n#if ESSENTIAL_GL_PRACTICES_IOS\n#define glBindVertexArray glBindVertexArrayOES\n#define glGenVertexArrays glGenVertexArraysOES\n#define glDeleteVertexArrays glDeleteVertexArraysOES\n#else\n#if ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n#define glBindVertexArray glBindVertexArray\n#define glGenVertexArrays glGenVertexArrays\n#define glGenerateMipmap glGenerateMipmap\n#define glDeleteVertexArrays glDeleteVertexArrays\n#else\n#define glBindVertexArray glBindVertexArrayAPPLE\n#define glGenVertexArrays glGenVertexArraysAPPLE\n#define glGenerateMipmap glGenerateMipmapEXT\n#define glDeleteVertexArrays glDeleteVertexArraysAPPLE\n#endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3\n#endif //!ESSENTIAL_GL_PRACTICES_IOS\n\nstatic inline const char *GetGLErrorString(GLenum error) {\n\tconst char *str;\n\tswitch (error) {\n\t\tcase GL_NO_ERROR:\n\t\t\tstr = \"GL_NO_ERROR\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_ENUM:\n\t\t\tstr = \"GL_INVALID_ENUM\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_VALUE:\n\t\t\tstr = \"GL_INVALID_VALUE\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_OPERATION:\n\t\t\tstr = \"GL_INVALID_OPERATION\";\n\t\t\tbreak;\n            \n#if defined __gl_h_ || defined __gl3_h_\n\t\tcase GL_OUT_OF_MEMORY:\n\t\t\tstr = \"GL_OUT_OF_MEMORY\";\n\t\t\tbreak;\n            \n\t\tcase GL_INVALID_FRAMEBUFFER_OPERATION:\n\t\t\tstr = \"GL_INVALID_FRAMEBUFFER_OPERATION\";\n\t\t\tbreak;\n            \n#endif\n#if defined __gl_h_\n\t\tcase GL_STACK_OVERFLOW:\n\t\t\tstr = \"GL_STACK_OVERFLOW\";\n\t\t\tbreak;\n            \n\t\tcase GL_STACK_UNDERFLOW:\n\t\t\tstr = \"GL_STACK_UNDERFLOW\";\n\t\t\tbreak;\n            \n\t\tcase GL_TABLE_TOO_LARGE:\n\t\t\tstr = \"GL_TABLE_TOO_LARGE\";\n\t\t\tbreak;\n            \n#endif\n\t\tdefault:\n\t\t\tstr = \"(ERROR: Unknown Error Enum)\";\n\t\t\tbreak;\n\t}\n\treturn str;\n}\n\n#endif // __GL_UTIL_H__\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/glWrapper.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __GL_API_DEBUG_WRAPPER__\r\n#define __GL_API_DEBUG_WRAPPER__\r\n\r\n// #define USE_DEBUG_WRAPPER\r\n\r\n// ---------------------------------------------------------------------------------------\r\n//\r\n//  No OpenGLES wrapper (1.x & 2.0)\r\n//\r\n// ---------------------------------------------------------------------------------------\r\n#ifndef USE_DEBUG_WRAPPER\r\n\t#if defined(__APPLE__)\r\n        #include \"TargetConditionals.h\"\r\n\t\t#if TARGET_OS_IPHONE // iOS devices or iOS Simulator\r\n\t\t\t#ifdef OPENGL2\r\n\t\t\t#import <OpenGLES/ES2/gl.h>\r\n\t\t\t#import <OpenGLES/ES2/glext.h>\r\n\t\t\t#else\r\n\t\t\t#import <OpenGLES/ES1/gl.h>\r\n\t\t\t#import <OpenGLES/ES1/glext.h>\r\n\t\t\t#endif\r\n\t\t#else // Mac OS X\r\n\t\t\t// #include \"glew.h\"\r\n\t\t\t#include <GLUT/glut.h>\r\n\t\t\t#include <OpenGL/gl.h>\r\n            #include <OpenGL/glext.h>\r\n\t\t\t#define STD_OPENGL\r\n\t\t#endif\r\n\t#else\r\n\t\t#ifdef OPENGL2\r\n\t\t#include \"GLES2/gl2.h\"\r\n\t\t#include \"GLES2/gl2ext.h\"\r\n\t\t// The header file which is not in the Android environment.\r\n\t\t// #include \"GLES2/gl2extimg.h\"\r\n\t\t#else\r\n\t\t\t#ifdef _WIN32\r\n\t\t\t\t#include <windows.h>\r\n\t\t\t\t#include \"glew.h\"\r\n\t\t\t\t#include \"glut.h\"\r\n\t\t\t\t#include <gl/GL.h>\r\n\t\t\t\t#include \"glext.h\"\r\n\t\t\t\t#define STD_OPENGL\r\n\t\t\t#else\r\n\t\t\t\t#include \"GLES/gl.h\"\r\n\t\t\t#endif\r\n\t\t#endif\r\n\t#endif\r\n\r\n\t#ifndef OPENGL2\r\n\t// Available only in Common profile\r\n\t#define dglAlphaFunc glAlphaFunc\r\n\t#define dglClearColor   glClearColor \r\n\t#define dglClearDepthf   glClearDepthf \r\n\t#define dglClipPlanef   glClipPlanef \r\n\t#define dglColor4f   glColor4f \r\n\t#define dglDepthRangef   glDepthRangef \r\n\t#define dglFogf   glFogf \r\n\t#define dglFogfv   glFogfv \r\n\t#define dglFrustumf   glFrustumf \r\n\t#define dglGetClipPlanef   glGetClipPlanef \r\n\t#define dglGetFloatv   glGetFloatv \r\n\t#define dglGetLightfv   glGetLightfv \r\n\t#define dglGetMaterialfv   glGetMaterialfv \r\n\t#define dglGetTexEnvfv   glGetTexEnvfv \r\n\t#define dglGetTexParameterfv   glGetTexParameterfv \r\n\t#define dglLightModelf   glLightModelf \r\n\t#define dglLightModelfv   glLightModelfv \r\n\t#define dglLightf   glLightf \r\n\t#define dglLightfv   glLightfv \r\n\t#define dglLineWidth   glLineWidth \r\n\t#define dglLoadMatrixf   glLoadMatrixf \r\n\t#define dglMaterialf   glMaterialf \r\n\t#define dglMaterialfv   glMaterialfv \r\n\t#define dglMultMatrixf   glMultMatrixf \r\n\t#define dglMultiTexCoord4f   glMultiTexCoord4f \r\n\t#define dglNormal3f   glNormal3f \r\n\t#define dglOrthof   glOrthof \r\n\t#define dglPointParameterf   glPointParameterf \r\n\t#define dglPointParameterfv   glPointParameterfv \r\n\t#define dglPointSize   glPointSize \r\n\t#define dglPolygonOffset   glPolygonOffset \r\n\t#define dglRotatef   glRotatef \r\n\t#define dglScalef   glScalef \r\n\t#define dglTexEnvf   glTexEnvf \r\n\t#define dglTexEnvfv   glTexEnvfv \r\n\t#define dglTexParameterf   glTexParameterf \r\n\t#define dglTexParameterfv   glTexParameterfv \r\n\t#define dglTranslatef   glTranslatef \r\n\r\n\t// Available in both Common and Common-Lite profiles\r\n\t#define dglActiveTexture   glActiveTexture \r\n\t#define dglAlphaFuncx   glAlphaFuncx \r\n\t#define dglBindBuffer   glBindBuffer \r\n\t#define dglBindTexture   glBindTexture \r\n\t#define dglBlendFunc   glBlendFunc \r\n\t#define dglBufferData   glBufferData \r\n\t#define dglBufferSubData   glBufferSubData \r\n\t#define dglClear   glClear \r\n\t#define dglClearColorx   glClearColorx \r\n\t#define dglClearDepthx   glClearDepthx \r\n\t#define dglClearStencil   glClearStencil \r\n\t#define dglClientActiveTexture   glClientActiveTexture \r\n\t#define dglClipPlanex   glClipPlanex \r\n\t#define dglColor4ub   glColor4ub \r\n\t#define dglColor4x   glColor4x \r\n\t#define dglColorMask   glColorMask \r\n\t#define dglColorPointer   glColorPointer \r\n\t#define dglCompressedTexImage2D   glCompressedTexImage2D \r\n\t#define dglCompressedTexSubImage2D   glCompressedTexSubImage2D \r\n\t#define dglCopyTexImage2D   glCopyTexImage2D \r\n\t#define dglCopyTexSubImage2D   glCopyTexSubImage2D \r\n\t#define dglCullFace   glCullFace \r\n\t#define dglDeleteBuffers   glDeleteBuffers \r\n\t#define dglDeleteTextures   glDeleteTextures \r\n\t#define dglDepthFunc   glDepthFunc \r\n\t#define dglDepthMask   glDepthMask \r\n\t#define dglDepthRangex   glDepthRangex \r\n\t#define dglDisable   glDisable \r\n\t#define dglDisableClientState   glDisableClientState \r\n\t#define dglDrawArrays   glDrawArrays \r\n\t#define dglDrawElements   glDrawElements \r\n\t#define dglEnable   glEnable \r\n\t#define dglEnableClientState   glEnableClientState \r\n\t#define dglFinish   glFinish \r\n\t#define dglFlush   glFlush \r\n\t#define dglFogx   glFogx \r\n\t#define dglFogxv   glFogxv \r\n\t#define dglFrontFace   glFrontFace \r\n\t#define dglFrustumx   glFrustumx \r\n\t#define dglGetBooleanv   glGetBooleanv \r\n\t#define dglGetBufferParameteriv   glGetBufferParameteriv \r\n\t#define dglGetClipPlanex   glGetClipPlanex \r\n\t#define dglGenBuffers   glGenBuffers \r\n\t#define dglGenTextures   glGenTextures \r\n\t#define dglGetError   glGetError \r\n\t#define dglGetFixedv   glGetFixedv \r\n\t#define dglGetIntegerv   glGetIntegerv \r\n\t#define dglGetLightxv   glGetLightxv \r\n\t#define dglGetMaterialxv   glGetMaterialxv \r\n\t#define dglGetPointerv   glGetPointerv \r\n\t#define dglGetString   glGetString \r\n\t#define dglGetTexEnviv   glGetTexEnviv \r\n\t#define dglGetTexEnvxv   glGetTexEnvxv \r\n\t#define dglGetTexParameteriv   glGetTexParameteriv \r\n\t#define dglGetTexParameterxv   glGetTexParameterxv \r\n\t#define dglHint   glHint \r\n\t#define dglIsBuffer   glIsBuffer \r\n\t#define dglIsEnabled   glIsEnabled \r\n\t#define dglIsTexture   glIsTexture \r\n\t#define dglLightModelx   glLightModelx \r\n\t#define dglLightModelxv   glLightModelxv \r\n\t#define dglLightx   glLightx \r\n\t#define dglLightxv   glLightxv \r\n\t#define dglLineWidthx   glLineWidthx \r\n\t#define dglLoadIdentity   glLoadIdentity \r\n\t#define dglLoadMatrixx   glLoadMatrixx \r\n\t#define dglLogicOp   glLogicOp \r\n\t#define dglMaterialx   glMaterialx \r\n\t#define dglMaterialxv   glMaterialxv \r\n\t#define dglMatrixMode   glMatrixMode \r\n\t#define dglMultMatrixx   glMultMatrixx \r\n\t#define dglMultiTexCoord4x   glMultiTexCoord4x \r\n\t#define dglNormal3x   glNormal3x \r\n\t#define dglNormalPointer   glNormalPointer \r\n\t#define dglOrthox   glOrthox \r\n\t#define dglPixelStorei   glPixelStorei \r\n\t#define dglPointParameterx   glPointParameterx \r\n\t#define dglPointParameterxv   glPointParameterxv \r\n\t#define dglPointSizex   glPointSizex \r\n\t#define dglPolygonOffsetx   glPolygonOffsetx \r\n\t#define dglPopMatrix   glPopMatrix \r\n\t#define dglPushMatrix   glPushMatrix \r\n\t#define dglReadPixels   glReadPixels \r\n\t#define dglRotatex   glRotatex \r\n\t#define dglSampleCoverage   glSampleCoverage \r\n\t#define dglSampleCoveragex   glSampleCoveragex \r\n\t#define dglScalex   glScalex \r\n\t#define dglScissor   glScissor \r\n\t#define dglShadeModel   glShadeModel \r\n\t#define dglStencilFunc   glStencilFunc \r\n\t#define dglStencilMask   glStencilMask \r\n\t#define dglStencilOp   glStencilOp \r\n\t#define dglTexCoordPointer   glTexCoordPointer \r\n\t#define dglTexEnvi   glTexEnvi \r\n\t#define dglTexEnvx   glTexEnvx \r\n\t#define dglTexEnviv   glTexEnviv \r\n\t#define dglTexEnvxv   glTexEnvxv \r\n\t#define dglTexImage2D   glTexImage2D \r\n\t#define dglTexParameteri   glTexParameteri \r\n\t#define dglTexParameterx   glTexParameterx \r\n\t#define dglTexParameteriv   glTexParameteriv \r\n\t#define dglTexParameterxv   glTexParameterxv \r\n\t#define dglTexSubImage2D   glTexSubImage2D \r\n\t#define dglTranslatex   glTranslatex \r\n\t#define dglVertexPointer   glVertexPointer \r\n\t#define dglViewport   glViewport \r\n\r\n\t#else\r\n\r\n\t#define dglActiveTexture  glActiveTexture \r\n\t#define dglAttachShader  glAttachShader \r\n\t#define dglBindAttribLocation  glBindAttribLocation \r\n\t#define dglBindBuffer  glBindBuffer \r\n\t#define dglBindFramebuffer  glBindFramebuffer \r\n\t#define dglBindRenderbuffer  glBindRenderbuffer \r\n\t#define dglBindTexture  glBindTexture \r\n\t#define dglBlendColor  glBlendColor \r\n\t#define dglBlendEquation  glBlendEquation \r\n\t#define dglBlendEquationSeparate  glBlendEquationSeparate \r\n\t#define dglBlendFunc  glBlendFunc \r\n\t#define dglBlendFuncSeparate  glBlendFuncSeparate \r\n\t#define dglBufferData  glBufferData \r\n\t#define dglBufferSubData  glBufferSubData \r\n\t#define dglCheckFramebufferStatus  glCheckFramebufferStatus \r\n\t#define dglClear  glClear \r\n\t#define dglClearColor  glClearColor \r\n\t#define dglClearDepthf  glClearDepthf \r\n\t#define dglClearStencil  glClearStencil \r\n\t#define dglColorMask  glColorMask \r\n\t#define dglCompileShader  glCompileShader \r\n\t#define dglCompressedTexImage2D  glCompressedTexImage2D \r\n\t#define dglCompressedTexSubImage2D  glCompressedTexSubImage2D \r\n\t#define dglCopyTexImage2D  glCopyTexImage2D \r\n\t#define dglCopyTexSubImage2D  glCopyTexSubImage2D \r\n\t#define dglCreateProgram  glCreateProgram \r\n\t#define dglCreateShader  glCreateShader \r\n\t#define dglCullFace  glCullFace \r\n\t#define dglDeleteBuffers  glDeleteBuffers \r\n\t#define dglDeleteFramebuffers  glDeleteFramebuffers \r\n\t#define dglDeleteProgram  glDeleteProgram \r\n\t#define dglDeleteRenderbuffers  glDeleteRenderbuffers \r\n\t#define dglDeleteShader  glDeleteShader \r\n\t#define dglDeleteTextures  glDeleteTextures \r\n\t#define dglDepthFunc  glDepthFunc \r\n\t#define dglDepthMask  glDepthMask \r\n\t#define dglDepthRangef  glDepthRangef \r\n\t#define dglDetachShader  glDetachShader \r\n\t#define dglDisable  glDisable \r\n\t#define dglDisableVertexAttribArray  glDisableVertexAttribArray \r\n\t#define dglDrawArrays  glDrawArrays \r\n\t#define dglDrawElements  glDrawElements \r\n\t#define dglEnable  glEnable \r\n\t#define dglEnableVertexAttribArray  glEnableVertexAttribArray \r\n\t#define dglFinish  glFinish \r\n\t#define dglFlush  glFlush \r\n\t#define dglFramebufferRenderbuffer  glFramebufferRenderbuffer \r\n\t#define dglFramebufferTexture2D  glFramebufferTexture2D \r\n\t#define dglFrontFace  glFrontFace \r\n\t#define dglGenBuffers  glGenBuffers \r\n\t#define dglGenerateMipmap  glGenerateMipmap \r\n\t#define dglGenFramebuffers  glGenFramebuffers \r\n\t#define dglGenRenderbuffers  glGenRenderbuffers \r\n\t#define dglGenTextures  glGenTextures \r\n\t#define dglGetActiveAttrib  glGetActiveAttrib \r\n\t#define dglGetActiveUniform  glGetActiveUniform \r\n\t#define dglGetAttachedShaders  glGetAttachedShaders \r\n\t#define dglGetAttribLocation  glGetAttribLocation \r\n\t#define dglGetBooleanv  glGetBooleanv \r\n\t#define dglGetBufferParameteriv  glGetBufferParameteriv \r\n\t#define dglGetError  glGetError \r\n\t#define dglGetFloatv  glGetFloatv \r\n\t#define dglGetFramebufferAttachmentParameteriv  glGetFramebufferAttachmentParameteriv \r\n\t#define dglGetIntegerv  glGetIntegerv \r\n\t#define dglGetProgramiv  glGetProgramiv \r\n\t#define dglGetProgramInfoLog  glGetProgramInfoLog \r\n\t#define dglGetRenderbufferParameteriv  glGetRenderbufferParameteriv \r\n\t#define dglGetShaderiv  glGetShaderiv \r\n\t#define dglGetShaderInfoLog  glGetShaderInfoLog \r\n\t#define dglGetShaderPrecisionFormat  glGetShaderPrecisionFormat \r\n\t#define dglGetShaderSource  glGetShaderSource \r\n\t#define dglGetString  glGetString \r\n\t#define dglGetTexParameterfv  glGetTexParameterfv \r\n\t#define dglGetTexParameteriv  glGetTexParameteriv \r\n\t#define dglGetUniformfv  glGetUniformfv \r\n\t#define dglGetUniformiv  glGetUniformiv \r\n\t#define dglGetUniformLocation  glGetUniformLocation \r\n\t#define dglGetVertexAttribfv  glGetVertexAttribfv \r\n\t#define dglGetVertexAttribiv  glGetVertexAttribiv \r\n\t#define dglGetVertexAttribPointerv  glGetVertexAttribPointerv \r\n\t#define dglHint  glHint \r\n\t#define dglIsBuffer  glIsBuffer \r\n\t#define dglIsEnabled  glIsEnabled \r\n\t#define dglIsFramebuffer  glIsFramebuffer \r\n\t#define dglIsProgram  glIsProgram \r\n\t#define dglIsRenderbuffer  glIsRenderbuffer \r\n\t#define dglIsShader  glIsShader \r\n\t#define dglIsTexture  glIsTexture \r\n\t#define dglLineWidth  glLineWidth \r\n\t#define dglLinkProgram  glLinkProgram \r\n\t#define dglPixelStorei  glPixelStorei \r\n\t#define dglPolygonOffset  glPolygonOffset \r\n\t#define dglReadPixels  glReadPixels \r\n\t#define dglReleaseShaderCompiler  glReleaseShaderCompiler \r\n\t#define dglRenderbufferStorage  glRenderbufferStorage \r\n\t#define dglSampleCoverage  glSampleCoverage \r\n\t#define dglScissor  glScissor \r\n\t#define dglShaderBinary  glShaderBinary \r\n\t#define dglShaderSource  glShaderSource \r\n\t#define dglStencilFunc  glStencilFunc \r\n\t#define dglStencilFuncSeparate  glStencilFuncSeparate \r\n\t#define dglStencilMask  glStencilMask \r\n\t#define dglStencilMaskSeparate  glStencilMaskSeparate \r\n\t#define dglStencilOp  glStencilOp \r\n\t#define dglStencilOpSeparate  glStencilOpSeparate \r\n\t#define dglTexImage2D  glTexImage2D \r\n\t#define dglTexParameterf  glTexParameterf \r\n\t#define dglTexParameterfv  glTexParameterfv \r\n\t#define dglTexParameteri  glTexParameteri \r\n\t#define dglTexParameteriv  glTexParameteriv \r\n\t#define dglTexSubImage2D  glTexSubImage2D \r\n\t#define dglUniform1f  glUniform1f \r\n\t#define dglUniform1fv  glUniform1fv \r\n\t#define dglUniform1i  glUniform1i \r\n\t#define dglUniform1iv  glUniform1iv \r\n\t#define dglUniform2f  glUniform2f \r\n\t#define dglUniform2fv  glUniform2fv \r\n\t#define dglUniform2i  glUniform2i \r\n\t#define dglUniform2iv  glUniform2iv \r\n\t#define dglUniform3f  glUniform3f \r\n\t#define dglUniform3fv  glUniform3fv \r\n\t#define dglUniform3i  glUniform3i \r\n\t#define dglUniform3iv  glUniform3iv \r\n\t#define dglUniform4f  glUniform4f \r\n\t#define dglUniform4fv  glUniform4fv \r\n\t#define dglUniform4i  glUniform4i \r\n\t#define dglUniform4iv  glUniform4iv \r\n\t#define dglUniformMatrix2fv  glUniformMatrix2fv \r\n\t#define dglUniformMatrix3fv  glUniformMatrix3fv \r\n\t#define dglUniformMatrix4fv  glUniformMatrix4fv \r\n\t#define dglUseProgram  glUseProgram \r\n\t#define dglValidateProgram  glValidateProgram \r\n\t#define dglVertexAttrib1f  glVertexAttrib1f \r\n\t#define dglVertexAttrib1fv  glVertexAttrib1fv \r\n\t#define dglVertexAttrib2f  glVertexAttrib2f \r\n\t#define dglVertexAttrib2fv  glVertexAttrib2fv \r\n\t#define dglVertexAttrib3f  glVertexAttrib3f \r\n\t#define dglVertexAttrib3fv  glVertexAttrib3fv \r\n\t#define dglVertexAttrib4f  glVertexAttrib4f \r\n\t#define dglVertexAttrib4fv  glVertexAttrib4fv \r\n\t#define dglVertexAttribPointer  glVertexAttribPointer \r\n\t#define dglViewport  glViewport \r\n#endif\r\n\r\n#else\r\n\t// ---------------------------------------------------------------------------------------\r\n\t//\r\n\t//  With OpenGLES wrapper (1.x & 2.0)\r\n\t//\r\n\t// ---------------------------------------------------------------------------------------\r\n\t#ifndef OPENGL2\r\n\t// Wrapper OpenGL 1.x\r\n\r\n\t// Available only in Common profile\r\n\tvoid dglAlphaFunc (GLenum func, GLclampf ref);\r\n\tvoid dglClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\tvoid dglClearDepthf (GLclampf depth);\r\n\tvoid dglClipPlanef (GLenum plane, const GLfloat *equation);\r\n\tvoid dglColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\n\tvoid dglDepthRangef (GLclampf zNear, GLclampf zFar);\r\n\tvoid dglFogf (GLenum pname, GLfloat param);\r\n\tvoid dglFogfv (GLenum pname, const GLfloat *params);\r\n\tvoid dglFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);\r\n\tvoid dglGetClipPlanef (GLenum pname, GLfloat eqn[4]);\r\n\tvoid dglGetFloatv (GLenum pname, GLfloat *params);\r\n\tvoid dglGetLightfv (GLenum light, GLenum pname, GLfloat *params);\r\n\tvoid dglGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);\r\n\tvoid dglGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);\r\n\tvoid dglGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\n\tvoid dglLightModelf (GLenum pname, GLfloat param);\r\n\tvoid dglLightModelfv (GLenum pname, const GLfloat *params);\r\n\tvoid dglLightf (GLenum light, GLenum pname, GLfloat param);\r\n\tvoid dglLightfv (GLenum light, GLenum pname, const GLfloat *params);\r\n\tvoid dglLineWidth (GLfloat width);\r\n\tvoid dglLoadMatrixf (const GLfloat *m);\r\n\tvoid dglMaterialf (GLenum face, GLenum pname, GLfloat param);\r\n\tvoid dglMaterialfv (GLenum face, GLenum pname, const GLfloat *params);\r\n\tvoid dglMultMatrixf (const GLfloat *m);\r\n\tvoid dglMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\n\tvoid dglNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);\r\n\tvoid dglOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);\r\n\tvoid dglPointParameterf (GLenum pname, GLfloat param);\r\n\tvoid dglPointParameterfv (GLenum pname, const GLfloat *params);\r\n\tvoid dglPointSize (GLfloat size);\r\n\tvoid dglPolygonOffset (GLfloat factor, GLfloat units);\r\n\tvoid dglRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglScalef (GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglTexEnvf (GLenum target, GLenum pname, GLfloat param);\r\n\tvoid dglTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);\r\n\tvoid dglTexParameterf (GLenum target, GLenum pname, GLfloat param);\r\n\tvoid dglTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);\r\n\tvoid dglTranslatef (GLfloat x, GLfloat y, GLfloat z);\r\n\r\n\t// Available in both Common and Common-Lite profiles\r\n\tvoid dglActiveTexture (GLenum texture);\r\n\tvoid dglAlphaFuncx (GLenum func, GLclampx ref);\r\n\tvoid dglBindBuffer (GLenum target, GLuint buffer);\r\n\tvoid dglBindTexture (GLenum target, GLuint texture);\r\n\tvoid dglBlendFunc (GLenum sfactor, GLenum dfactor);\r\n\tvoid dglBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);\r\n\tvoid dglBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);\r\n\tvoid dglClear (GLbitfield mask);\r\n\tvoid dglClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);\r\n\tvoid dglClearDepthx (GLclampx depth);\r\n\tvoid dglClearStencil (GLint s);\r\n\tvoid dglClientActiveTexture (GLenum texture);\r\n\tvoid dglClipPlanex (GLenum plane, const GLfixed *equation);\r\n\tvoid dglColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\r\n\tvoid dglColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\n\tvoid dglColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\n\tvoid dglColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\n\tvoid dglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\n\tvoid dglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\n\tvoid dglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tvoid dglCullFace (GLenum mode);\r\n\tvoid dglDeleteBuffers (GLsizei n, const GLuint *buffers);\r\n\tvoid dglDeleteTextures (GLsizei n, const GLuint *textures);\r\n\tvoid dglDepthFunc (GLenum func);\r\n\tvoid dglDepthMask (GLboolean flag);\r\n\tvoid dglDepthRangex (GLclampx zNear, GLclampx zFar);\r\n\tvoid dglDisable (GLenum cap);\r\n\tvoid dglDisableClientState (GLenum array);\r\n\tvoid dglDrawArrays (GLenum mode, GLint first, GLsizei count);\r\n\tvoid dglDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);\r\n\tvoid dglEnable (GLenum cap);\r\n\tvoid dglEnableClientState (GLenum array);\r\n\tvoid dglFinish (void);\r\n\tvoid dglFlush (void);\r\n\tvoid dglFogx (GLenum pname, GLfixed param);\r\n\tvoid dglFogxv (GLenum pname, const GLfixed *params);\r\n\tvoid dglFrontFace (GLenum mode);\r\n\tvoid dglFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);\r\n\tvoid dglGetBooleanv (GLenum pname, GLboolean *params);\r\n\tvoid dglGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);\r\n\tvoid dglGetClipPlanex (GLenum pname, GLfixed eqn[4]);\r\n\tvoid dglGenBuffers (GLsizei n, GLuint *buffers);\r\n\tvoid dglGenTextures (GLsizei n, GLuint *textures);\r\n\tGLenum dglGetError (void);\r\n\tvoid dglGetFixedv (GLenum pname, GLfixed *params);\r\n\tvoid dglGetIntegerv (GLenum pname, GLint *params);\r\n\tvoid dglGetLightxv (GLenum light, GLenum pname, GLfixed *params);\r\n\tvoid dglGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);\r\n\tvoid dglGetPointerv (GLenum pname, void **params);\r\n\tconst GLubyte * dglGetString (GLenum name);\r\n\tvoid dglGetTexEnviv (GLenum env, GLenum pname, GLint *params);\r\n\tvoid dglGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);\r\n\tvoid dglGetTexParameteriv (GLenum target, GLenum pname, GLint *params);\r\n\tvoid dglGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);\r\n\tvoid dglHint (GLenum target, GLenum mode);\r\n\tGLboolean dglIsBuffer (GLuint buffer);\r\n\tGLboolean dglIsEnabled (GLenum cap);\r\n\tGLboolean dglIsTexture (GLuint texture);\r\n\tvoid dglLightModelx (GLenum pname, GLfixed param);\r\n\tvoid dglLightModelxv (GLenum pname, const GLfixed *params);\r\n\tvoid dglLightx (GLenum light, GLenum pname, GLfixed param);\r\n\tvoid dglLightxv (GLenum light, GLenum pname, const GLfixed *params);\r\n\tvoid dglLineWidthx (GLfixed width);\r\n\tvoid dglLoadIdentity (void);\r\n\tvoid dglLoadMatrixx (const GLfixed *m);\r\n\tvoid dglLogicOp (GLenum opcode);\r\n\tvoid dglMaterialx (GLenum face, GLenum pname, GLfixed param);\r\n\tvoid dglMaterialxv (GLenum face, GLenum pname, const GLfixed *params);\r\n\tvoid dglMatrixMode (GLenum mode);\r\n\tvoid dglMultMatrixx (const GLfixed *m);\r\n\tvoid dglMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);\r\n\tvoid dglNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);\r\n\tvoid dglNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);\r\n\tvoid dglPixelStorei (GLenum pname, GLint param);\r\n\tvoid dglPointParameterx (GLenum pname, GLfixed param);\r\n\tvoid dglPointParameterxv (GLenum pname, const GLfixed *params);\r\n\tvoid dglPointSizex (GLfixed size);\r\n\tvoid dglPolygonOffsetx (GLfixed factor, GLfixed units);\r\n\tvoid dglPopMatrix (void);\r\n\tvoid dglPushMatrix (void);\r\n\tvoid dglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);\r\n\tvoid dglRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);\r\n\tvoid dglSampleCoverage (GLclampf value, GLboolean invert);\r\n\tvoid dglSampleCoveragex (GLclampx value, GLboolean invert);\r\n\tvoid dglScalex (GLfixed x, GLfixed y, GLfixed z);\r\n\tvoid dglScissor (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tvoid dglShadeModel (GLenum mode);\r\n\tvoid dglStencilFunc (GLenum func, GLint ref, GLuint mask);\r\n\tvoid dglStencilMask (GLuint mask);\r\n\tvoid dglStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\r\n\tvoid dglTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglTexEnvi (GLenum target, GLenum pname, GLint param);\r\n\tvoid dglTexEnvx (GLenum target, GLenum pname, GLfixed param);\r\n\tvoid dglTexEnviv (GLenum target, GLenum pname, const GLint *params);\r\n\tvoid dglTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);\r\n\tvoid dglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\n\tvoid dglTexParameteri (GLenum target, GLenum pname, GLint param);\r\n\tvoid dglTexParameterx (GLenum target, GLenum pname, GLfixed param);\r\n\tvoid dglTexParameteriv (GLenum target, GLenum pname, const GLint *params);\r\n\tvoid dglTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);\r\n\tvoid dglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\n\tvoid dglTranslatex (GLfixed x, GLfixed y, GLfixed z);\r\n\tvoid dglVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglViewport (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\t\r\n\t#else\r\n\t\r\n\tvoid dglActiveTexture (GLenum texture);\r\n\tvoid dglAttachShader (GLuint program, GLuint shader);\r\n\tvoid dglBindAttribLocation (GLuint program, GLuint index, const GLchar* name);\r\n\tvoid dglBindBuffer (GLenum target, GLuint buffer);\r\n\tvoid dglBindFramebuffer (GLenum target, GLuint framebuffer);\r\n\tvoid dglBindRenderbuffer (GLenum target, GLuint renderbuffer);\r\n\tvoid dglBindTexture (GLenum target, GLuint texture);\r\n\tvoid dglBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\tvoid dglBlendEquation ( GLenum mode );\r\n\tvoid dglBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);\r\n\tvoid dglBlendFunc (GLenum sfactor, GLenum dfactor);\r\n\tvoid dglBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n\tvoid dglBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);\r\n\tvoid dglBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);\r\n\tGLenum dglCheckFramebufferStatus (GLenum target);\r\n\tvoid dglClear (GLbitfield mask);\r\n\tvoid dglClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\tvoid dglClearDepthf (GLclampf depth);\r\n\tvoid dglClearStencil (GLint s);\r\n\tvoid dglColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\n\tvoid dglCompileShader (GLuint shader);\r\n\tvoid dglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);\r\n\tvoid dglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);\r\n\tvoid dglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\n\tvoid dglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tGLuint dglCreateProgram (void);\r\n\tGLuint dglCreateShader (GLenum type);\r\n\tvoid dglCullFace (GLenum mode);\r\n\tvoid dglDeleteBuffers (GLsizei n, const GLuint* buffers);\r\n\tvoid dglDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);\r\n\tvoid dglDeleteProgram (GLuint program);\r\n\tvoid dglDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);\r\n\tvoid dglDeleteShader (GLuint shader);\r\n\tvoid dglDeleteTextures (GLsizei n, const GLuint* textures);\r\n\tvoid dglDepthFunc (GLenum func);\r\n\tvoid dglDepthMask (GLboolean flag);\r\n\tvoid dglDepthRangef (GLclampf zNear, GLclampf zFar);\r\n\tvoid dglDetachShader (GLuint program, GLuint shader);\r\n\tvoid dglDisable (GLenum cap);\r\n\tvoid dglDisableVertexAttribArray (GLuint index);\r\n\tvoid dglDrawArrays (GLenum mode, GLint first, GLsizei count);\r\n\tvoid dglDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);\r\n\tvoid dglEnable (GLenum cap);\r\n\tvoid dglEnableVertexAttribArray (GLuint index);\r\n\tvoid dglFinish (void);\r\n\tvoid dglFlush (void);\r\n\tvoid dglFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\n\tvoid dglFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\n\tvoid dglFrontFace (GLenum mode);\r\n\tvoid dglGenBuffers (GLsizei n, GLuint* buffers);\r\n\tvoid dglGenerateMipmap (GLenum target);\r\n\tvoid dglGenFramebuffers (GLsizei n, GLuint* framebuffers);\r\n\tvoid dglGenRenderbuffers (GLsizei n, GLuint* renderbuffers);\r\n\tvoid dglGenTextures (GLsizei n, GLuint* textures);\r\n\tvoid dglGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\n\tvoid dglGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\n\tvoid dglGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);\r\n\tint  glGetAttribLocation (GLuint program, const GLchar* name);\r\n\tvoid dglGetBooleanv (GLenum pname, GLboolean* params);\r\n\tvoid dglGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);\r\n\tGLenum dglGetError (void);\r\n\tvoid dglGetFloatv (GLenum pname, GLfloat* params);\r\n\tvoid dglGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);\r\n\tvoid dglGetIntegerv (GLenum pname, GLint* params);\r\n\tvoid dglGetProgramiv (GLuint program, GLenum pname, GLint* params);\r\n\tvoid dglGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);\r\n\tvoid dglGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);\r\n\tvoid dglGetShaderiv (GLuint shader, GLenum pname, GLint* params);\r\n\tvoid dglGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);\r\n\tvoid dglGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);\r\n\tvoid dglGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);\r\n\tconst GLubyte* glGetString (GLenum name);\r\n\tvoid dglGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);\r\n\tvoid dglGetTexParameteriv (GLenum target, GLenum pname, GLint* params);\r\n\tvoid dglGetUniformfv (GLuint program, GLint location, GLfloat* params);\r\n\tvoid dglGetUniformiv (GLuint program, GLint location, GLint* params);\r\n\tint  glGetUniformLocation (GLuint program, const GLchar* name);\r\n\tvoid dglGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);\r\n\tvoid dglGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);\r\n\tvoid dglGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);\r\n\tvoid dglHint (GLenum target, GLenum mode);\r\n\tGLboolean dglIsBuffer (GLuint buffer);\r\n\tGLboolean dglIsEnabled (GLenum cap);\r\n\tGLboolean dglIsFramebuffer (GLuint framebuffer);\r\n\tGLboolean dglIsProgram (GLuint program);\r\n\tGLboolean dglIsRenderbuffer (GLuint renderbuffer);\r\n\tGLboolean dglIsShader (GLuint shader);\r\n\tGLboolean dglIsTexture (GLuint texture);\r\n\tvoid dglLineWidth (GLfloat width);\r\n\tvoid dglLinkProgram (GLuint program);\r\n\tvoid dglPixelStorei (GLenum pname, GLint param);\r\n\tvoid dglPolygonOffset (GLfloat factor, GLfloat units);\r\n\tvoid dglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);\r\n\tvoid dglReleaseShaderCompiler (void);\r\n\tvoid dglRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\n\tvoid dglSampleCoverage (GLclampf value, GLboolean invert);\r\n\tvoid dglScissor (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tvoid dglShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);\r\n\tvoid dglShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);\r\n\tvoid dglStencilFunc (GLenum func, GLint ref, GLuint mask);\r\n\tvoid dglStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);\r\n\tvoid dglStencilMask (GLuint mask);\r\n\tvoid dglStencilMaskSeparate (GLenum face, GLuint mask);\r\n\tvoid dglStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\r\n\tvoid dglStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);\r\n\tvoid dglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);\r\n\tvoid dglTexParameterf (GLenum target, GLenum pname, GLfloat param);\r\n\tvoid dglTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);\r\n\tvoid dglTexParameteri (GLenum target, GLenum pname, GLint param);\r\n\tvoid dglTexParameteriv (GLenum target, GLenum pname, const GLint* params);\r\n\tvoid dglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);\r\n\tvoid dglUniform1f (GLint location, GLfloat x);\r\n\tvoid dglUniform1fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform1i (GLint location, GLint x);\r\n\tvoid dglUniform1iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniform2f (GLint location, GLfloat x, GLfloat y);\r\n\tvoid dglUniform2fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform2i (GLint location, GLint x, GLint y);\r\n\tvoid dglUniform2iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglUniform3fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform3i (GLint location, GLint x, GLint y, GLint z);\r\n\tvoid dglUniform3iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\n\tvoid dglUniform4fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);\r\n\tvoid dglUniform4iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\n\tvoid dglUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\n\tvoid dglUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\n\tvoid dglUseProgram (GLuint program);\r\n\tvoid dglValidateProgram (GLuint program);\r\n\tvoid dglVertexAttrib1f (GLuint indx, GLfloat x);\r\n\tvoid dglVertexAttrib1fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);\r\n\tvoid dglVertexAttrib2fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglVertexAttrib3fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\n\tvoid dglVertexAttrib4fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);\r\n\tvoid dglViewport (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\t\r\n\t#endif\r\n\r\n#endif\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/iOSFileLocation.h",
    "content": "#ifndef iOSFileLocation_h\n#define iOSFileLocation_h\n\n#define PATH_EXTERN     \"/Library/Application Support/\"\n#define PATH_INSTALL    \"/Contents/Resources/\"\n\n#endif\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/imageUtil.h",
    "content": "/*\n     File: imageUtil.h\n Abstract: \n Functions for loading an image files for textures.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __IMAGE_UTIL_H__\n#define __IMAGE_UTIL_H__\n\n#include \"glUtil.h\"\n\ntypedef struct demoImageRec\n{\n\tGLubyte* data;\n\t\n\tGLsizei size;\n\t\n\tGLuint width;\n\tGLuint height;\n\tGLenum format;\n\tGLenum type;\n\t\n\tGLuint rowByteSize;\n\t\n} demoImage;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n    \ndemoImage* imgLoadImage(const char* filepathname, int flipVertical);\n\nvoid imgDestroyImage(demoImage* image);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif //__IMAGE_UTIL_H__\n\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/klb_vararg.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef klb_vararg_h\r\n#define klb_vararg_h\r\n\r\n#include <stdarg.h>\r\n\r\n#endif // klb_vararg_h\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/matrixUtil.h",
    "content": "/*\n     File: matrixUtil.h\n Abstract: \n Functions for performing matrix math.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __MATRIX_UTIL_H__\n#define __MATRIX_UTIL_H__\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// Matrix is a column major floating point array\n\n// All matrices are 4x4 by unless the mtx3x3 prefix is specified in the function name\n\n// [ 0 4  8 12 ]\n// [ 1 5  9 13 ]\n// [ 2 6 10 14 ]\n// [ 3 7 11 15 ]\n\n// MTX = LeftHandSideMatrix * RightHandSideMatrix\nvoid mtxMultiply(float* ret, const float* lhs, const float* rhs);\n\n// MTX = IdentityMatrix\nvoid mtxLoadIdentity(float* mtx);\n\n// MTX = Transpos(SRC)\nvoid mtxTranspose(float* mtx, const float* src);\n\n// MTX = src^-1\nvoid mtxInvert(float* mtx, const float* src);\n\n// MTX = PerspectiveProjectionMatrix\nvoid mtxLoadPerspective(float* mtx, float fov, float aspect, float nearZ, float farZ);\n\n// MTX = OrthographicProjectionMatrix\nvoid mtxLoadOrthographic(float* mtx,\n\t\t\t\t\t\t\t\tfloat left, float right, \n\t\t\t\t\t\t\t\tfloat bottom, float top, \n\t\t\t\t\t\t\t\tfloat nearZ, float farZ);\n\n// MTX = ObliqueProjectionMatrix(src, clipPlane)\nvoid mtxModifyObliqueProjection(float* mtx, const float* src, const float* plane);\n\n// MTX = TranlationMatrix\nvoid mtxLoadTranslate(float* mtx, float xTrans, float yTrans, float zTrans);\n\n// MTX = ScaleMatrix\nvoid mtxLoadScale(float* mtx, float xScale, float yScale, float zScale);\n\n// MTX = RotateXYZMatrix\nvoid mtxLoadRotate(float*mtx, float deg, float xAxis, float , float zAxis);\n\n// MTX = RotateXMatrix\nvoid mtxLoadRotateX(float* mtx, float deg);\n\n// MTX = RotateYMatrix\nvoid mtxLoadRotateY(float* mtx, float deg);\n\n// MTX = RotateZMatrix\nvoid mtxLoadRotateZ(float* mtx, float deg);\n\n// MTX = MTX * TranslationMatrix - Similar to glTranslate\nvoid mtxTranslateApply(float* mtx, float xTrans, float yTrans, float zTrans);\n\n// MTX = MTX * ScaleMatrix - Similar to glScale\nvoid mtxScaleApply(float* mtx, float xScale, float yScale, float zScale);\n\n// MTX = MTX * RotateXYZMatrix - Similar to glRotate\nvoid mtxRotateApply(float* mtx, float deg, float xAxis, float yAxis, float zAxis);\n\n// MTX = MTX * RotateXMatrix\nvoid mtxRotateXApply(float* mtx, float rad);\n\n// MTX = MTX * RotateYMatrix\nvoid mtxRotateYApply(float* mtx, float rad);\n\n// MTX = MTX * RotateZMatrix\nvoid mtxRotateZApply(float* mtx, float rad);\n\n// MTX = TranslationMatrix * MTX\nvoid mtxTranslateMatrix(float* mtx, float xTrans, float yTrans, float zTrans);\n\n// MTX = ScaleMatrix * MTX\nvoid mtxScaleMatrix(float* mtx, float xScale, float yScale, float zScale);\n\n// MTX = RotateXYZMatrix * MTX\nvoid mtxRotateMatrix(float* mtx, float rad, float xAxis, float yAxis, float zAxis);\n\n// MTX = RotateXMatrix * MTX\nvoid mtxRotateXMatrix(float* mtx, float rad);\n\n// MTX = RotateYMatrix * MTX\nvoid mtxRotateYMatrix(float* mtx, float rad);\n\n// MTX = RotateZMatrix * MTX\nvoid mtxRotateZMatrix(float* mtx, float rad);\n\n// 3x3 MTX = 3x3 IdendityMatrix\nvoid mtx3x3LoadIdentity(float* mtx);\n\n\n// 3x3 MTX = 3x3 LHS x 3x3 RHS\nvoid mtx3x3Multiply(float* mtx, const float* lhs, const float* rhs);\n\n\n// 3x3 MTX = TopLeft of MTX \nvoid mtx3x3FromTopLeftOf4x4(float* mtx, const float* src);\n\n// 3x3 MTX = Transpose(3x3 SRC)\nvoid mtx3x3Transpose(float* mtx, const float* src);\n\n// 3x3 MTX = 3x3 SRC^-1\nvoid mtx3x3Invert(float* mtx, const float* src);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif //__MATRIX_UTIL_H__\n\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/mem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _MEM_MACRO_KLB_\r\n#define _MEM_MACRO_KLB_\r\n\r\n// Memcpy / Memset / strlen\r\n#include \"string.h\"\r\n\r\n//\r\n// \"Slow\" implementation for now.\r\n//\r\n#define\tmemcpy32\tmemcpy\r\n#define memcpy16\tmemcpy\r\n#define memset16(dst, val, size)\t{ u16 v = (u16)(val); u16* ptrStart = (u16*)(dst); u16* ptrEnd = &ptrStart[(size)>>1]; while (ptrStart != ptrEnd) { *ptrStart++ = v; } }\r\n#define memset32(dst, val, size)\t{ u32 v = (u32)(val); u32* ptrStart = (u32*)(dst); u32* ptrEnd = &ptrStart[(size)>>2]; while (ptrStart != ptrEnd) { *ptrStart++ = v; } }\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/modelUtil.h",
    "content": "/*\n     File: modelUtil.h\n Abstract: \n Functions for loading a model file for vertex arrays.  The model file \n format used is a simple \"binary blob\" invented for the purpose of \n this sample code.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __MODEL_UTIL_H__\n#define __MODEL_UTIL_H__\n\n#include \"glUtil.h\"\n\ntypedef struct demoModelRec\n{\n\tGLuint numVertcies;\n\t\n\tGLubyte *positions;\n\tGLenum positionType;\n\tGLuint positionSize;\n\tGLsizei positionArraySize;\n\t\n\tGLubyte *texcoords;\n\tGLenum texcoordType;\n\tGLuint texcoordSize;\n\tGLsizei texcoordArraySize;\n\t\n\tGLubyte *normals;\n\tGLenum normalType;\n\tGLuint normalSize;\n\tGLsizei normalArraySize;\n\t\t\n\tGLubyte *elements;\n\tGLenum elementType;\n\tGLuint numElements;\n\tGLsizei elementArraySize;\n\t\t\n\tGLenum primType;\n\t\n} demoModel;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ndemoModel* mdlLoadModel(const char* filepathname);\n\ndemoModel* mdlLoadQuadModel();\n\nvoid mdlDestroyModel(demoModel* model);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif //__MODEL_UTIL_H__\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/sourceUtil.h",
    "content": "/*\n     File: sourceUtil.h\n Abstract: \n Functions for loading source files for shaders.\n \n  Version: 1.6\n \n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\n Inc. (\"Apple\") in consideration of your agreement to the following\n terms, and your use, installation, modification or redistribution of\n this Apple software constitutes acceptance of these terms.  If you do\n not agree with these terms, please do not use, install, modify or\n redistribute this Apple software.\n \n In consideration of your agreement to abide by the following terms, and\n subject to these terms, Apple grants you a personal, non-exclusive\n license, under Apple's copyrights in this original Apple software (the\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\n Software, with or without modifications, in source and/or binary forms;\n provided that if you redistribute the Apple Software in its entirety and\n without modifications, you must retain this notice and the following\n text and disclaimers in all such redistributions of the Apple Software.\n Neither the name, trademarks, service marks or logos of Apple Inc. may\n be used to endorse or promote products derived from the Apple Software\n without specific prior written permission from Apple.  Except as\n expressly stated in this notice, no other rights or licenses, express or\n implied, are granted by Apple herein, including but not limited to any\n patent rights that may be infringed by your derivative works or by other\n works in which the Apple Software may be incorporated.\n \n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\n \n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n \n Copyright (C) 2012 Apple Inc. All Rights Reserved.\n \n */\n\n#ifndef __SOURCE_UTIL_H__\n#define __SOURCE_UTIL_H__\n\n#include \"glUtil.h\"\n\ntypedef struct demoSourceRec\n{\n\tGLchar* string;\n\t\n\tGLsizei byteSize;\n\t\n\tGLenum shaderType; // Vertex or Fragment\n\t\n} demoSource;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ndemoSource* srcLoadSource(const char* filepathname);\n\nvoid srcDestroySource(demoSource* source);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // __SOURCE_UTIL_H__\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Headers/vectorUtil.h",
    "content": "/*\r\n     File: vectorUtil.h\r\n Abstract: \r\n Functions for performing vector math.\r\n \r\n  Version: 1.6\r\n \r\n Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple\r\n Inc. (\"Apple\") in consideration of your agreement to the following\r\n terms, and your use, installation, modification or redistribution of\r\n this Apple software constitutes acceptance of these terms.  If you do\r\n not agree with these terms, please do not use, install, modify or\r\n redistribute this Apple software.\r\n \r\n In consideration of your agreement to abide by the following terms, and\r\n subject to these terms, Apple grants you a personal, non-exclusive\r\n license, under Apple's copyrights in this original Apple software (the\r\n \"Apple Software\"), to use, reproduce, modify and redistribute the Apple\r\n Software, with or without modifications, in source and/or binary forms;\r\n provided that if you redistribute the Apple Software in its entirety and\r\n without modifications, you must retain this notice and the following\r\n text and disclaimers in all such redistributions of the Apple Software.\r\n Neither the name, trademarks, service marks or logos of Apple Inc. may\r\n be used to endorse or promote products derived from the Apple Software\r\n without specific prior written permission from Apple.  Except as\r\n expressly stated in this notice, no other rights or licenses, express or\r\n implied, are granted by Apple herein, including but not limited to any\r\n patent rights that may be infringed by your derivative works or by other\r\n works in which the Apple Software may be incorporated.\r\n \r\n The Apple Software is provided by Apple on an \"AS IS\" basis.  APPLE\r\n MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION\r\n THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS\r\n FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND\r\n OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\r\n \r\n IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL\r\n OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,\r\n MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED\r\n AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),\r\n STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE\r\n POSSIBILITY OF SUCH DAMAGE.\r\n \r\n Copyright (C) 2012 Apple Inc. All Rights Reserved.\r\n \r\n */\r\n\r\n#ifndef __VECTOR_UTIL_H__\r\n#define __VECTOR_UTIL_H__\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n// A Vector is floating point array with either 3 or 4 components\r\n// functions with the vec4 prefix require 4 elements in the array\r\n// functions with vec3 prefix require only 3 elements in the array\r\n\r\n// Subtracts one 4D vector to another\r\nvoid vec4Add(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Subtracts one 4D vector from another\r\nvoid vec4Subtract(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Multiplys one 4D vector by another\r\nvoid vec4Multiply(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Divides one 4D vector by another\r\nvoid vec4Divide(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Subtracts one 4D vector to another\r\nvoid vec3Add(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Subtracts one 4D vector from another\r\nvoid vec3Subtract(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Multiplys one 4D vector by another\r\nvoid vec3Multiply(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Divides one 4D vector by another\r\nvoid vec3Divide(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Calculates the Cross Product of a 3D vector\r\nvoid vec3CrossProduct(float* vec, const float* lhs, const float* rhs);\r\n\r\n// Normalizes a 3D vector\r\nvoid vec3Normalize(float* vec, const float* src);\r\n\r\n// Returns the Dot Product of 2 3D vectors\r\nfloat vec3DotProduct(const float* lhs, const float* rhs);\r\n\r\n// Returns the Dot Product of 2 4D vectors\r\nfloat vec4DotProduct(const float* lhs, const float* rhs);\r\n\r\n// Returns the length of a 3D vector \r\n// (i.e the distance of a point from the origin)\r\nfloat vec3Length(const float* vec);\r\n\r\n// Returns the distance between two 3D points\r\nfloat vec3Distance(const float* pointA, const float* pointB);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif //__VECTOR_UTIL_H__\r\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Resources/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>BuildMachineOSBuild</key>\n\t<string>13A2093</string>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>PlaygroundOSS</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.klab.PlaygroundOSS</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>PlaygroundOSS</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>DTCompiler</key>\n\t<string>com.apple.compilers.llvm.clang.1_0</string>\n\t<key>DTPlatformBuild</key>\n\t<string>5A2053</string>\n\t<key>DTPlatformVersion</key>\n\t<string>GM</string>\n\t<key>DTSDKBuild</key>\n\t<string>13A595</string>\n\t<key>DTSDKName</key>\n\t<string>macosx10.9</string>\n\t<key>DTXcode</key>\n\t<string>0501</string>\n\t<key>DTXcodeBuild</key>\n\t<string>5A2053</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2013 KLab Inc. All rights reserved.</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Engine/prebuilt/OSX/PlaygroundOSS.framework/Resources/Playground-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.klab.${PRODUCT_NAME:rfc1034identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSMinimumSystemVersion</key>\n\t<string>${MACOSX_DEPLOYMENT_TARGET}</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2013年 KLab Inc. All rights reserved.</string>\n\t<key>NSMainNibFile</key>\n\t<string>MainMenu</string>\n\t<key>NSPrincipalClass</key>\n\t<string>NSApplication</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Engine/source/Animation/CKLBNodeVirtualDocument.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n\r\n#include \"CKLBTexturePacker.h\"\r\nTexturePacker& mgrPacker = TexturePacker::getInstance();\r\n\r\nstatic u32 convertARGB32_RGBA8(u32 argb) {\r\n\tu32 dst;\r\n\tu8* pDst = (u8*)&dst;\r\n\tpDst[0]  = argb>>16;    // R\r\n\tpDst[1]  = argb>>8;     // G\r\n\tpDst[2]  = argb;        // B\r\n\tpDst[3]  = argb>>24;    // A\r\n\treturn dst;\r\n}\r\n\r\n// RGBA8 32 bit encoded\r\nu16 getTo4444(u32 color) {\r\n\tu8* pCol = (u8*)&color;\r\n\r\n\t// Base color.\r\n\tu16 col\t= \t      ((pCol[2]     ) & 0x00F0)\t\t// Blue\r\n\t\t\t\t\t| ((pCol[1] << 4) & 0x0F00)\t\t// Green\r\n\t\t\t\t\t| ((pCol[0] << 8) & 0xF000)\t\t// Red\r\n\t\t\t\t\t| ((pCol[3] >> 4))\t\t\t\t// Alpha\r\n\t\t\t\t\t;\r\n\treturn col;\r\n}\r\n\r\nvoid RenderContext::setClip\t(s32 x0, s32 y0, s32 x1, s32 y1) {\r\n\tif (x0 < 0)\t\t\t\t{ x0 = 0; }\r\n\tif (y0 < 0)\t\t\t\t{ y0 = 0; }\r\n\tif (x1 > targetWidth)\t{ x1 = targetWidth;\t\t}\r\n\tif (y1 > targetHeight)\t{ y1 = targetHeight;\t}\r\n\r\n\tclipX0 = x0;\r\n\tclipY0 = y0;\r\n\tclipX1 = x1;\r\n\tclipY1 = y1;\r\n}\r\n\r\nvoid RenderContext::setPixelClip(s32 x1, s32 y1, u32 color) {\r\n\tif ((x1 < clipX0) || (y1 < clipY0) || (x1 >= clipX1) || (y1 >= clipY1)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tu8* pCol = (u8*)&color;\r\n\tif (pCol[3] != 255) {\r\n\t\tint alpha\t= pCol[3]; alpha += alpha>>7;\t\t// 0..256\r\n\t\tint nalpha\t= 256 - alpha;\t\t\t\t\t\t// 256..0\r\n\r\n\t\tint cb\t\t= alpha * pCol[0];\r\n\t\tint cg\t\t= alpha * pCol[1];\r\n\t\tint cr\t\t= alpha * pCol[2];\r\n\t\tint ca\t\t= alpha * pCol[3];\r\n\r\n\t\tu32* pBuf = &pBuffer[x1 + (stride * y1)];\r\n\t\tu8* p8Buf = (u8*)pBuf;\r\n\r\n\t\tint b = ((p8Buf[0] * nalpha) + cb)>>8;\r\n\t\tint g = ((p8Buf[1] * nalpha) + cg)>>8;\r\n\t\tint r = ((p8Buf[2] * nalpha) + cr)>>8;\r\n\t\tint ar= ((p8Buf[3] * nalpha) + ca)>>8; // Do NOT use scale (255 vs 256)\r\n\r\n\t\tp8Buf\t[0] = b;  // B\r\n\t\tp8Buf\t[1] = g;  // G\r\n\t\tp8Buf\t[2] = r;  // R\r\n\t\tp8Buf\t[3] = ar; // A\r\n\t} else {\r\n\t\tpBuffer[x1 + (stride * y1)] = color;\r\n\t}\r\n}\r\n\r\nvoid RenderContext::setPixelClip4444(s32 x1, s32 y1, u16 color) {\r\n\tif ((x1 < clipX0) || (y1 < clipY0) || (x1 >= clipX1) || (y1 >= clipY1)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tint alpha = color >> 12;\r\n\tif (alpha != 0xF) {\r\n\t\t\talpha  += alpha>>3;\t\t\t\t\t\t\t// 0..16\r\n\t\tint nalpha\t= 16 - alpha;\t\t\t\t\t\t// 16..0\r\n\r\n\t\t// 4.4 precision\r\n\t\tint cb\t\t= alpha * (color & 0x00F0);\r\n\t\tint cg\t\t= alpha * (color & 0x0F00);\r\n\t\tint cr\t\t= alpha * (color & 0xF000);\r\n\t\tint ca\t\t= alpha * (color & 0x000F);\r\n\r\n\t\tu16* pBuf = &((u16*)pBuffer)[x1 + (stride * y1)];\r\n\t\tu16  col = *pBuf;\r\n\r\n\t\tint b = (((col & 0x00F0) * nalpha) + cb)>>4;\r\n\t\tint g = (((col & 0x0F00) * nalpha) + cg)>>4;\r\n\t\tint r = (((col & 0xF000) * nalpha) + cr)>>4;\r\n\t\tint ar= (((col & 0x000F) * nalpha) + ca)>>4; // Do NOT use scale (255 vs 256)\r\n\r\n\t\t*pBuf++ = (r & 0xF000) | (g & 0x0F00) | (b & 0x00F0) | (ar & 0x000F);\r\n\t} else {\r\n\t\t((u16*)pBuffer)[x1 + (stride * y1)] = color;\r\n\t}\r\n}\r\n\r\nvoid RenderContext::drawLine(s32 x1, s32 y1, s32 x2, s32 y2, u32 color) {\r\n\tx2 -= offsetX;\r\n\tx1 -= offsetX;\r\n\ty2 -= offsetY;\r\n\ty1 -= offsetY;\r\n\r\n\ts32 d, dx, dy, delta, xincr, x, y;\r\n\r\n\tdx = x2 - x1; if (dx < 0) { dx = -dx; }\r\n\tdy = y2 - y1; if (dy < 0) { dy = -dy; }\r\n\r\n\ts32 inv = (dx >= dy);\r\n\tif (inv) {\r\n\t\t// Swap X and Y\r\n\t\tx = x1; x1 = y1; y1 = x;\r\n\t\tx = x2; x2 = y2; y2 = x;\r\n\t}\r\n\t\r\n\tif (y1 > y2) {\r\n\t\tx = x1; x1 = x2; x2 = x;\r\n\t\ty = y1; y1 = y2; y2 = y;\r\n\t}\r\n\r\n\txincr = x2 > x1 ? 1 : -1;\r\n\tdy = y2 - y1;\r\n\tdx = x2 - x1;\r\n\tif (dx < 0) { dx = -dx; }\r\n\tdelta = 2 * dx;\r\n\td = delta - dy;\r\n\r\n\tx = x1;\r\n\r\n\tif (format == 4) {\r\n\t\tfor (y = y1; y <= y2; ++y) {\r\n\t\t\tif (inv) {\r\n\t\t\t\tsetPixelClip(y, x, color);\r\n\t\t\t} else {\r\n\t\t\t\tsetPixelClip(x, y, color);\r\n\t\t\t}\r\n\t\t\r\n\t\t\td += delta;\r\n\t\t\tif (d >= 0) {\r\n\t\t\t\tx += xincr;\r\n\t\t\t\td -= (dy<<1);\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tu16 color16 = getTo4444(color);\r\n\r\n\t\tfor (y = y1; y <= y2; ++y) {\r\n\t\t\tif (inv) {\r\n\t\t\t\tsetPixelClip4444(y, x, color16);\r\n\t\t\t} else {\r\n\t\t\t\tsetPixelClip4444(x, y, color16);\r\n\t\t\t}\r\n\t\t\r\n\t\t\td += delta;\r\n\t\t\tif (d >= 0) {\r\n\t\t\t\tx += xincr;\r\n\t\t\t\td -= (dy<<1);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid RenderContext::drawRect(s32 x0, s32 y0, s32 x1, s32 y1, u32 color) {\r\n\t// Offset done internally.\r\n\tdrawLine(x0,y0,x1,y0,color);\r\n\tdrawLine(x1,y0,x1,y1,color);\r\n\tdrawLine(x1,y1,x0,y1,color);\r\n\tdrawLine(x0,y1,x0,y0,color);\r\n}\r\n\r\nvoid RenderContext::fillRect(s32 x0, s32 y0, s32 x1, s32 y1, u32 color, bool forceFill) {\r\n\tx0 -= offsetX;\r\n\tx1 -= offsetX;\r\n\ty0 -= offsetY;\r\n\ty1 -= offsetY;\r\n\r\n\tif (x0 < clipX0)\t{ x0 = clipX0; }\r\n\tif (y0 < clipY0)\t{ y0 = clipY0; }\r\n\tif (x1 > clipX1)\t{ x1 = clipX1; }\r\n\tif (y1 > clipY1)\t{ y1 = clipY1; }\r\n\r\n\tif (((color>>24) == 255) || (forceFill)) {\r\n\t\t//\r\n\t\t// OPTIMIZE : use fully ptr, avoid x,y increment, use memcpy32.\r\n\t\t//\r\n\t\tif (format == 4) {\r\n\t\t\tu32* pBuf = &pBuffer[x0 + (stride * y0)];\r\n\r\n\t\t\ts32 startX0 = x0;\r\n\t\t\twhile (y0 < y1) {\r\n\t\t\t\tx0 = startX0;\r\n\t\t\t\twhile (x0 < x1) {\r\n\t\t\t\t\t*pBuf++ = color;\r\n\t\t\t\t\tx0++;\r\n\t\t\t\t}\r\n\t\t\t\tpBuf += stride - (x1 - startX0);\t// Delta Stride.\r\n\t\t\t\ty0++;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tu16* pBuf = (u16*)&(((u8*)pBuffer)[x0 + (stride * format * y0)]);\r\n\r\n\t\t\tu16 color16 = getTo4444(color);\r\n\r\n\t\t\ts32 startX0 = x0;\r\n\t\t\twhile (y0 < y1) {\r\n\t\t\t\tx0 = startX0;\r\n\t\t\t\twhile (x0 < x1) {\r\n\t\t\t\t\t*pBuf++ = color16;\r\n\t\t\t\t\tx0++;\r\n\t\t\t\t}\r\n\t\t\t\tpBuf += stride - (x1 - startX0);\t// Delta Stride.\r\n\t\t\t\ty0++;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\r\n\t\t//\r\n\t\t// color is 8 Bit RGBA\r\n\t\t//\r\n\t\tu8* pCol\t= (u8*)&color;\r\n\r\n\t\t//\r\n\t\t// PreAlpha\r\n\t\t//\r\n\t\tint alpha\t= pCol[3]; alpha += alpha>>7;\t\t// 0..256\r\n\t\tint nalpha\t= 256 - alpha;\t\t\t\t\t\t// 256..0\r\n\r\n\t\tint cb\t\t= alpha * pCol[0];\r\n\t\tint cg\t\t= alpha * pCol[1];\r\n\t\tint cr\t\t= alpha * pCol[2];\r\n\t\tint ca\t\t= alpha * pCol[3];\r\n\r\n\t\t//\r\n\t\t// Dst is also RGBA\r\n\t\t//\r\n\t\tif (format == 4) {\r\n\t\t\tu32* pBuf = &pBuffer[x0 + (stride * y0)];\r\n\r\n\t\t\ts32 startX0 = x0;\r\n\t\t\twhile (y0 < y1) {\r\n\t\t\t\tx0 = startX0;\r\n\t\t\t\twhile (x0 < x1) {\r\n\t\t\t\t\tu8* p8Buf = (u8*)pBuf;\r\n\r\n\t\t\t\t\tint b = ((p8Buf[0] * nalpha) + cb)>>8;\r\n\t\t\t\t\tint g = ((p8Buf[1] * nalpha) + cg)>>8;\r\n\t\t\t\t\tint r = ((p8Buf[2] * nalpha) + cr)>>8;\r\n\t\t\t\t\tint ar= ((p8Buf[3] * nalpha) + ca)>>8; // Do NOT use scale (255 vs 256)\r\n\r\n\t\t\t\t\tp8Buf\t[0] = b;  // B\r\n\t\t\t\t\tp8Buf\t[1] = g;  // G\r\n\t\t\t\t\tp8Buf\t[2] = r;  // R\r\n\t\t\t\t\tp8Buf\t[3] = ar; // A\r\n\r\n\t\t\t\t\tpBuf++;\r\n\t\t\t\t\tx0++;\r\n\t\t\t\t}\r\n\t\t\t\tpBuf += stride - (x1 - startX0);\t// Delta Stride.\r\n\t\t\t\ty0++;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tu16* pBuf = (u16*)&(((u8*)pBuffer)[x0 + (stride * format * y0)]);\r\n\r\n\t\t\t// 8.8 -> 4.8 precision, then at correct place for addition\r\n\t\t\tcb >>= 4; cb <<= 4;\r\n\t\t\tcg >>= 4; cg <<= 8;\r\n\t\t\tcr >>= 4; cr <<= 12;\r\n\t\t\tca >>= 4; // ca <<= 0;\r\n\r\n\t\t\ts32 startX0 = x0;\r\n\t\t\twhile (y0 < y1) {\r\n\t\t\t\tx0 = startX0;\r\n\t\t\t\twhile (x0 < x1) {\r\n\t\t\t\t\tu16  col = *pBuf;\r\n\r\n\t\t\t\t\tint b = (((col & 0x00F0) * nalpha) + cb)>>8;\r\n\t\t\t\t\tint g = (((col & 0x0F00) * nalpha) + cg)>>8;\r\n\t\t\t\t\tint r = (((col & 0xF000) * nalpha) + cr)>>8;\r\n\t\t\t\t\tint ar= (((col & 0x000F) * nalpha) + ca)>>8; // Do NOT use scale (255 vs 256)\r\n\r\n\t\t\t\t\t*pBuf++ = (r & 0xF000) | (g & 0x0F00) | (b & 0x00F0) | (ar & 0x000F);\r\n\t\t\t\t\tx0++;\r\n\t\t\t\t}\r\n\t\t\t\tpBuf += stride - (x1 - startX0);\t// Delta Stride in pixel\r\n\t\t\t\ty0++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#include \"CKLBTextTempBuffer.h\"\r\n\r\n// #define INTERNAL_FILL_WITH_COLOR_TEXPACKER\r\n#ifdef INTERNAL_FILL_WITH_COLOR_TEXPACKER\r\n\r\nstatic u32 colorcount = 0;\r\nu32 getTestColor() {\r\n\tcolorcount = (colorcount+1) & 0xF;\r\n\r\n\tu32 colorFill = 0x80FFFFFF;\r\n\r\n\tswitch (colorcount) {\r\n\tcase 0:\tcolorFill = 0xFF00FF00; // Green\r\n\t\tbreak;\r\n\tcase 1:\tcolorFill = 0xFFFF0000; // Red\r\n\t\tbreak;\r\n\tcase 2:\tcolorFill = 0xFF0000FF; // Blue\r\n\t\tbreak;\r\n\tcase 3:\tcolorFill = 0xFFFF00FF; // Magenta\r\n\t\tbreak;\r\n\tcase 4:\tcolorFill = 0xFF00FFFF; // Yellow\r\n\t\tbreak;\r\n\tcase 5:\tcolorFill = 0xFFFFFF00; // Cyan\r\n\t\tbreak;\r\n\r\n\tcase 6:\tcolorFill = 0xFF80FF80;\r\n\t\tbreak;\r\n\tcase 7:\tcolorFill = 0xFFFF8080;\r\n\t\tbreak;\r\n\tcase 8:\tcolorFill = 0xFF8080FF;\r\n\t\tbreak;\r\n\tcase 9:\tcolorFill = 0xFFFF80FF;\r\n\t\tbreak;\r\n\tcase 10:colorFill = 0xFF80FFFF;\r\n\t\tbreak;\r\n\tcase 11:colorFill = 0xFFFFFF80;\r\n\t\tbreak;\r\n\r\n\tcase 12:colorFill = 0xFF80FF00;\r\n\t\tbreak;\r\n\tcase 13:colorFill = 0xFFFF8000;\r\n\t\tbreak;\r\n\tcase 14:colorFill = 0xFF0080FF;\r\n\t\tbreak;\r\n\tcase 15:colorFill = 0xFFFF0080;\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn colorFill;\r\n}\r\n#endif\r\n\r\nvoid RenderContext::drawText(s32 x , s32 y , char* string  , u32 color, void* font, bool docMode) {\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\r\n\tx -= offsetX;\r\n\ty -= offsetY;\r\n\r\n\t//\r\n\t// 1. Reset Tmp Buffer\r\n\t//\r\n\tif (!docMode) {\r\n\t\tmemset(pBuffer, 0, this->stride * format * this->targetHeight);\r\n\t}\r\n\r\n\t//\r\n\t// 2. Render text\r\n\t//\r\n\tplatform.renderText(\tstring,\r\n\t\t\t\t\t\t\tfont,\r\n\t\t\t\t\t\t\tcolor,\r\n\t\t\t\t\t\t\tthis->targetWidth,\r\n\t\t\t\t\t\t\tthis->targetHeight,\r\n\t\t\t\t\t\t\t(u8*)pBuffer,\r\n\t\t\t\t\t\t\tthis->stride * format,\t// Byte stride\r\n\t\t\t\t\t\t\tx,\r\n\t\t\t\t\t\t\ty,\r\n\t\t\t\t\t\t\t(format != 4));\r\n}\r\n\r\nvoid RenderContext::drawImage(s32 x , s32 y , SDrawCommand* pCommand  , u8 alpha) {\r\n\tCKLBImageAsset* pImg = (CKLBImageAsset*)pCommand->ptr;\r\n\r\n\tx -= offsetX;\r\n\ty -= offsetY;\r\n\r\n\t// Screen Space size\r\n\ts32 sdx = pCommand->x1 - pCommand->x0;\r\n\ts32 sdy = pCommand->y1 - pCommand->y0;\r\n\t// Screen Image Corner\r\n\ts32 x0 = x;\r\n\ts32 y0 = y;\r\n\ts32 x1 = x+sdx;\r\n\ts32 y1 = y+sdy;\r\n\t// Texture Space Top Left\r\n\ts32 texX\t= pCommand->sx0;\r\n\ts32 texY\t= pCommand->sy0;\r\n\r\n\t// Completly outside : skip\r\n\tif ((pImg == NULL) || (x1 <= clipX0) || (y1 <= clipY0) || (x0 >= clipX1) || (y0 >= clipY1)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Fully inside or partially clipped.\r\n\ts32 delta;\r\n\r\n\t//\r\n\t// Top Left Corner Test\r\n\t//\r\n\r\n\tdelta = x0 - clipX0;\r\n\t// Shorten width  ?\r\n\tif (delta < 0)\t{\tsdx += delta;\r\n\t\t\t\t\t\t// Left corner in texture space\r\n\t\t\t\t\t\tif (pCommand->swap) { texY -= delta; } else { texX -= delta; }\r\n\t\t\t\t\t\tx0 = clipX0;\r\n\t\t\t\t\t}\r\n\t// Shorten height ?\r\n\tdelta = y0 - clipY0;\r\n\tif (delta < 0)\t{\tsdy += delta;\tx0 = clipX0;\t\r\n\t\t\t\t\t\t// Left corner in texture space\r\n\t\t\t\t\t\tif (pCommand->swap) { texX -= delta; } else { texY -= delta; }\r\n\t\t\t\t\t}\r\n\r\n\t//\r\n\t// Bottom Right Corner Test\r\n\t//\r\n\r\n\tdelta = clipX1 - x1;\r\n\t// Shorten width  ?\r\n\tif (delta < 0) { sdx += delta; }\r\n\t// Shorten height ?\r\n\tdelta = clipY1 - y1;\r\n\tif (delta < 0) { sdy += delta; }\r\n\r\n\tu8* pix\t\t= pImg->m_pTextureAsset->m_softTexture;\r\n\ts32 lstride\t= pImg->m_pTextureAsset->m_width;\r\n\r\n\tpix = &pix[(texX + (texY * lstride)) * 4];\r\n\r\n\tlstride *= 4;\r\n\r\n\t//\r\n\t// === Draw ===\r\n\t//\r\n\tu8* pBuf = (u8*)&pBuffer[x0 + (stride * y0)];\r\n\r\n\ts32 jmpStrideBuf = (stride - sdx) * 4;\r\n\ts32 jmpStrideHoriz;\r\n\ts32 jmpStrideVert;\r\n\r\n\tif (pCommand->swap) {\r\n\t\tjmpStrideHoriz\t= lstride;\r\n\t\tjmpStrideVert\t= (lstride * (-sdx)) + 4; // Roll back Y pixel in texture space, advance +1 pixel\r\n\t} else {\r\n\t\tjmpStrideHoriz\t= 4;\r\n\t\tjmpStrideVert\t= lstride - (sdx * 4);\r\n\t}\r\n\r\n\tint galpha\t\t= alpha + (alpha>>7);\t\t// 0..256\r\n\t// int gnalpha\t\t= 256 - galpha;\t\t\t\t// 256..0\r\n\r\n\tif (format == 4) {\r\n\t\tfor (int y=0; y < sdy; y++) {\r\n\t\t\tfor (int x=0; x < sdx; x++) {\r\n\t\t\t\t// 0..255 Alpha\r\n\t\t\t\tint ca\t\t= (galpha * pix[3] >> 8);\t// Pixel Alpha * Global Alpha\r\n\t\t\t\tint alpha\t= ca + (ca >> 7);\r\n\t\t\t\tint nAlpha  = 256 - alpha;\r\n\r\n\t\t\t\tpBuf[0] = ((pBuf[0] * nAlpha) + (alpha * pix[0])) >> 8; // R\r\n\t\t\t\tpBuf[1] = ((pBuf[1] * nAlpha) + (alpha * pix[1])) >> 8; // G\r\n\t\t\t\tpBuf[2] = ((pBuf[2] * nAlpha) + (alpha * pix[2])) >> 8; // B\r\n\t\t\t\tpBuf[3] = ((pBuf[3] * nAlpha) + (alpha * pix[3])) >> 8; // A\r\n\r\n\t\t\t\tpBuf+=4;\r\n\t\t\t\tpix += jmpStrideHoriz;\r\n\t\t\t}\r\n\t\t\tpBuf += jmpStrideBuf;\r\n\t\t\tpix  += jmpStrideVert;\r\n\t\t}\r\n\t} else {\r\n\t\tklb_assertAlways(\"IMAGE RENDER NOT SUPPORTED in 4444 for virtual doc\");\r\n\t}\r\n}\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\r\nstruct VirtualDocElement {\r\n\tstatic VirtualDocElement* getDocElement(CKLBNodeVirtualDocument* pDoc);\r\n\tVirtualDocElement*\t\t\tpNext;\r\n\tCKLBNodeVirtualDocument*\tpDoc;\r\n};\r\n\r\nVirtualDocElement*\tgDocumentList = NULL;\r\nCKLBNodeVirtualDocument*\tpIgnore\t= NULL;\r\n\r\nvoid setIgnoreVirtualDoc(CKLBNodeVirtualDocument* pDoc) {\r\n\tpIgnore = pDoc;\t\r\n}\r\n\r\nVirtualDocElement* VirtualDocElement::getDocElement(CKLBNodeVirtualDocument* pDoc) {\r\n\tVirtualDocElement* pElem = new VirtualDocElement();\r\n\tpElem->pDoc = pDoc;\r\n\tpElem->pNext= NULL;\r\n\treturn pElem;\r\n}\r\n\r\nvoid registerVirtualDoc(CKLBNodeVirtualDocument* pDoc) {\r\n\tVirtualDocElement* pNewElem = VirtualDocElement::getDocElement(pDoc);\r\n\tif (pNewElem) {\r\n\t\tpNewElem->pNext\t= gDocumentList;\r\n\t\tgDocumentList\t= pNewElem;\r\n\t} else {\r\n\t\tklb_assertAlways(\"allo failure\");\r\n\t}\r\n}\r\n\r\nvoid unregisterVirtualDoc(CKLBNodeVirtualDocument* pDoc) {\r\n\tVirtualDocElement* pElem = gDocumentList;\r\n\tVirtualDocElement* pPrev = NULL;\r\n\r\n\twhile (pElem) {\r\n\t\tif (pElem->pDoc == pDoc) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tpPrev = pElem;\r\n\t\tpElem = pElem->pNext;\r\n\t}\r\n\r\n\tif (pElem) {\r\n\t\tif (pPrev == NULL) {\r\n\t\t\tgDocumentList = pElem->pNext;\r\n\t\t} else {\r\n\t\t\tpPrev->pNext  = pElem->pNext;\r\n\t\t}\r\n\t\tdelete pElem;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Item not found : already removed from list\");\r\n\t}\r\n}\r\n\r\nvoid checkVirtualDocState() {\r\n\tVirtualDocElement* pElem = gDocumentList;\r\n\twhile (pElem) {\r\n\t\tif (pElem->pDoc != pIgnore) {\r\n\t\t\tpElem->pDoc->check();\r\n\t\t}\r\n\t\tpElem = pElem->pNext;\r\n\t}\r\n}\r\n\r\nvoid dumpVirtualDocState(void* pDoc) {\r\n\tprintf(\"=== Dump Virtual Doc List ===\\n\");\r\n\tVirtualDocElement* pElem = gDocumentList;\r\n\twhile (pElem) {\r\n\t\tif (pElem->pDoc == pDoc) {\r\n\t\t\tprintf(\"Obj : %8X FOUND !!! \\n\", pElem->pDoc);\r\n\t\t} else {\r\n\t\t\tprintf(\"Obj : %8X\\n\", pElem->pDoc);\r\n\t\t}\r\n\t\tpElem = pElem->pNext;\r\n\t}\r\n\tprintf(\"=== End Dump ===\\n\");\r\n}\r\n\r\n#endif\r\n\r\nCKLBNodeVirtualDocument::CKLBNodeVirtualDocument()\r\n:m_commandArray\t\t(NULL)\r\n,m_commandMaxCount\t(0)\r\n,m_CurrentCommand\t(0)\r\n,m_isVertical\t\t(false)\r\n,m_bgColor\t\t\t(0x00000000)\r\n,m_viewPortHeight\t(0)\r\n,m_viewPortWidth\t(0)\r\n,m_currTile\t\t\t(0)\r\n,m_prevTile\t\t\t(0x7FFF)\r\n,m_scroll\t\t\t(0)\r\n,m_prevScroll\t\t(1)\r\n,m_bDisplay\t\t\t(true)\r\n,m_tileXStart\t\t(0)\r\n,m_tileYStart\t\t(0)\r\n,m_tileXEnd\t\t\t(0)\r\n,m_tileYEnd\t\t\t(0)\r\n,m_documentWidth\t(0)\r\n,m_documentHeight\t(0)\r\n,m_posX\t\t\t\t(0)\r\n,m_posY\t\t\t\t(0)\r\n,m_bScroll\t\t\t(false)\r\n//,m_surfA\t\t\t(NULL_IDX)\r\n//,m_surfB\t\t\t(NULL_IDX)\r\n,m_bHasChanged\t\t(false)\r\n{\r\n\tm_deleteRender = false; // Force own management of sprite on destruction.\r\n\tfor(int i = 0; i < 2; i++) {\r\n\t\tm_drawarea[i].tile = NULL;\r\n\t\tm_drawarea[i].softwareBufTile = NULL;\r\n\t\tm_drawarea[i].surf_handle = NULL_IDX;\r\n\t}\r\n\t/*\r\n\tm_softwareBufferTile[0] = NULL;\r\n\tm_softwareBufferTile[1] = NULL;\r\n\tm_tile\t\t\t\t[0] = NULL;\r\n\tm_tile\t\t\t\t[1] = NULL;\r\n\t*/\r\n\tfor (int n = 0; n < 5; n++) {\r\n\t\tfont[n] = NULL;\r\n\t}\r\n\r\n\tm_format = TexturePacker::getCurrentModeTexture();\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tregisterVirtualDoc(this);\r\n#endif\r\n}\r\n\r\nCKLBNodeVirtualDocument::~CKLBNodeVirtualDocument() {\r\n\tclearRessources(true, true);\r\n\tfreeDocument();\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tunregisterVirtualDoc(this);\r\n\tmgrPacker.scan(this);\r\n#endif\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::clearRessources(bool freeSurface, bool freeFonts) {\r\n\tif (freeSurface) {\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\t\tmgrPacker.setCurrentDelete(this);\r\n#endif\r\n\t\tfor(int i = 0; i < 2; i++) {\r\n\t\t\tif(m_drawarea[i].surf_handle != NULL_IDX) {\r\n\t\t\t\tmgrPacker.releaseSurface(m_drawarea[i].surf_handle);\r\n\t\t\t}\r\n\t\t\tm_drawarea[i].surf_handle = NULL_IDX;\r\n\t\t\tm_drawarea[i].softwareBufTile = NULL;\r\n\t\t}\r\n\t\t/*\r\n\t\tif (m_surfA != NULL_IDX) {\r\n\t\t\tmgrPacker.releaseSurface(m_surfA);\r\n\t\t}\r\n\r\n\t\tif (m_surfB != NULL_IDX) {\r\n\t\t\tmgrPacker.releaseSurface(m_surfB);\r\n\t\t}\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\t\tmgrPacker.setCurrentDelete(NULL);\r\n#endif\r\n\r\n\t\tm_surfA = NULL_IDX;\r\n\t\tm_surfB = NULL_IDX;\r\n\r\n\t\tm_softwareBufferTile[0] = NULL;\r\n\t\tm_softwareBufferTile[1] = NULL;\r\n\t\t*/\r\n\t}\r\n\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\tif(m_drawarea[0].tile) {\r\n\t\tsetRender(NULL, 0);\r\n\t\tpRdrMgr.releaseCommand(m_drawarea[0].tile);\r\n\t\tif(m_drawarea[1].tile != m_drawarea[0].tile) {\r\n\t\t\tsetRender(NULL,1);\r\n\t\t\tpRdrMgr.releaseCommand(m_drawarea[1].tile);\r\n\t\t}\r\n\t}\r\n\tm_drawarea[0].tile = NULL;\r\n\tm_drawarea[1].tile = NULL;\r\n/*\r\n\tif (m_tile[0]) {\r\n\t\tthis->setRender(NULL,0);\r\n\t\tpRdrMgr.releaseCommand(m_tile[0]);\r\n\t}\r\n\r\n\tif (m_tile[1] && m_tile[0] && (m_tile[1] != m_tile[0])) {\r\n\t\tthis->setRender(NULL,1);\r\n\t\tpRdrMgr.releaseCommand(m_tile[1]);\r\n\t}\r\n\r\n\tm_tile[1] = NULL;\r\n\tm_tile[0] = NULL;\r\n*/\r\n\tif(freeFonts) {\r\n\t\tfreeFont();\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::check() {\r\n\tklb_assert(m_drawarea[0].softwareBufTile, \"VIRTUAL DOC NOT FREED BUT SET TO NULL\");\r\n\tklb_assert(m_drawarea[0].tile,            \"VIRTUAL DOC NOT FREED BUT SET TO NULL\");\r\n\r\n/*\r\n\tif (m_softwareBufferTile[0] == 0) {\r\n\t\tklb_assertAlways(\"VIRTUAL DOC NOT FREED BUT SET TO NULL\");\r\n\t}\r\n\tif (m_tile[0]==0) {\r\n\t\tklb_assertAlways(\"VIRTUAL DOC NOT FREED BUT SET TO NULL\");\r\n\t}\r\n*/\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::docTextureCompaction(void* ctx, u16 oldsurface, u16 newSurface) {\r\n\tCKLBNodeVirtualDocument* pObj = (CKLBNodeVirtualDocument*)ctx;\r\n\r\n\t// klb_assert((_CrtCheckMemory() != 0), \"Heap Error !\");\r\n\tfor(int i = 0; i < 2; i++) {\r\n\t\tif(pObj->m_drawarea[i].surf_handle == oldsurface) {\r\n\t\t\tVDOCDRAW * pDraw = &(pObj->m_drawarea[i]);\r\n\t\t\tpDraw->surf_handle = newSurface;\r\n\r\n\t\t\tfloat u0;\r\n\t\t\tfloat v0;\r\n\t\t\tfloat u1;\r\n\t\t\tfloat v1;\r\n\t\t\tfloat stepU;\r\n\t\t\tfloat stepV;\r\n\t\t\tu32*  swBuff;\r\n\t\t\tmgrPacker.getSurfaceInfo(newSurface, swBuff, u0,v0,u1,v1,stepU,stepV);\r\n\r\n\t\t\tklb_assert(swBuff == pDraw->softwareBufTile, \"Consistency of the buffer cannot be taken. \");\r\n\r\n\t\t\tpDraw->leftU\t= u0;\r\n\t\t\tpDraw->upV\t\t= v0;\r\n\t\t\tpDraw->rightU\t= u1;\r\n\t\t\tpDraw->bottomV\t= v1;\r\n\t\t\tpDraw->stepU\t= stepU;\r\n\t\t\tpDraw->stepV\t= stepV;\r\n\r\n\t\t\tpDraw->tile->m_pTexture = mgrPacker.getTextureUsage(newSurface);\r\n\r\n\t\t\tpObj->updateDynSprites(i);\r\n\r\n\t\t\tpObj->markUpMatrix();\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n/*\r\n\tif (oldsurface == pObj->m_surfA) {\r\n\t\t// Update Object.\r\n\t\tpObj->m_surfA = newSurface;\r\n\t} else\r\n\tif (oldsurface == pObj->m_surfB) {\r\n\t\tpObj->m_surfB = newSurface;\r\n\t}\r\n\r\n\t// Get UV info\r\n\tfloat u0;\r\n\tfloat v0;\r\n\tfloat u1;\r\n\tfloat v1;\r\n\tfloat stepU;\r\n\tfloat stepV;\r\n\tu32*  swBuff;\r\n\r\n\tmgrPacker.getSurfaceInfo(newSurface, swBuff, u0,v0,u1,v1,stepU,stepV);\r\n\r\n\tint idx;\r\n\tif (pObj->m_softwareBufferTile[0] == swBuff) {\r\n\t\tidx = 0;\r\n\t} else if (pObj->m_softwareBufferTile[1] == swBuff) {\r\n\t\tidx = 1;\r\n\t} else {\r\n\t\tidx = 0;\r\n\t\tklb_assertAlways(\"Error\");\r\n\t}\r\n\r\n\t// pObj->m_softwareBufferTile[idx] = swBuff; <-- Buffer not reallocated\r\n\tpObj->leftU\t\t[idx] = u0;\r\n\tpObj->upV\t\t[idx] = v0;\r\n\tpObj->rightU\t[idx] = u1;\r\n\tpObj->bottomV\t[idx] = v1;\r\n\tpObj->stepU\t\t[idx] = stepU;\r\n\tpObj->stepV\t\t[idx] = stepV;\r\n\r\n\t// Update Vertex\r\n\tpObj->m_tile[idx]->m_pTexture = mgrPacker.getTextureUsage(newSurface);\r\n\tpObj->updateDynSprites(idx);\r\n\tpObj->markUpMatrix();\r\n\t*/\r\n\t\r\n}\r\n\r\nbool CKLBNodeVirtualDocument::setViewPortSize(u32 width, u32 height, float alignOffsetX, float alignOffsetY, u32 priority, bool doScroll) {\r\n\t/* TODO : This optimization was buggy, rolled back to old code, but should be looked at.\r\n\tif (!((width > m_viewPortWidth) || (height > m_viewPortHeight))) { \r\n\t\treturn true;\r\n\t}*/\r\n\r\n\tbool success = true;\r\n\tclearRessources(false,false);\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tsetIgnoreVirtualDoc(this);\r\n#endif\r\n\r\n\tm_viewPortHeight\t= height;\r\n\tm_viewPortWidth\t\t= width;\r\n\tif ((width == 0) || (height == 0)) {\r\n\t\t//m_bDisplay = true;\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_alignOffsetX = alignOffsetX;\r\n\tm_alignOffsetY = alignOffsetY;\r\n\r\n\t//\r\n\t// Allocate Dynamic sprite.\r\n\t//\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\tCKLBDynSprite* pSprA = pRdrMgr.allocateCommandDynSprite(2*3,2*3);\r\n\tCKLBDynSprite* pSprB = doScroll ? pRdrMgr.allocateCommandDynSprite(2*3,2*3) : pSprA;\r\n\r\n\tif (pSprA && pSprB) {\r\n\t\tm_drawarea[0].tile = pSprA;\r\n\t\tm_drawarea[1].tile = pSprB;\r\n\t\tif (this->setRenderSlotCount(2)) {\r\n\t\t\tthis->setRender(pSprA,0);\r\n\t\t\tpSprA->changeOrder(pRdrMgr, priority);\r\n\t\t\tif (doScroll) {\r\n\t\t\t\tthis->setRender(pSprB,1);\r\n\t\t\t\tpSprB->changeOrder(pRdrMgr, priority);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsuccess = false;\r\n\t\t}\r\n\t} else {\r\n\t\tsuccess = false;\r\n\t\tif (pSprA) {\tpRdrMgr.releaseCommand(pSprA);\t}\r\n\t\tif (pSprB) {\tpRdrMgr.releaseCommand(pSprB);\t}\r\n\t}\r\n\r\n\tu32 texW = width;\r\n\tu32 texH = height;\r\n\t\r\n\tmgrPacker.setFormat(m_format);\r\n\r\n\tif (m_drawarea[0].surf_handle == NULL_IDX) {\r\n\t\tm_drawarea[0].surf_handle = mgrPacker.allocateSurface(pSprA, texW, texH, this, docTextureCompaction);\r\n\t\t/* Special render state associated to text, not needed now.\r\n\t\tif (m_format == VDFORMAT_8) {\r\n\t\t\tpSprA->setRenderState(pRdrMgr->getTextState());\r\n\t\t} */\r\n\t} else {\r\n\t\tm_drawarea[0].surf_handle = mgrPacker.reallocateSurface(m_drawarea[0].surf_handle, texW, texH);\r\n\t}\r\n\r\n\tif (m_drawarea[0].surf_handle != NULL_IDX) {\r\n\t\t// Success.\r\n\t\tmgrPacker.getSurfaceInfo(m_drawarea[0].surf_handle,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].softwareBufTile,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].leftU,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].upV,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].rightU,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].bottomV,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].stepU,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].stepV);\r\n\t\tm_drawarea[0].format = m_format;\r\n\t}\r\n\r\n\tm_bScroll = doScroll;\r\n\r\n\tif (doScroll) {\r\n\t\tif (m_drawarea[1].surf_handle == NULL_IDX) {\r\n\t\t\tm_drawarea[1].surf_handle = mgrPacker.allocateSurface(pSprB, texW, texH, this, docTextureCompaction);\r\n\t\t\t/* Special render state associated to text, not needed now.\r\n\t\t\tif (m_format == VDFORMAT_8) {\r\n\t\t\t\t pSprB->setRenderState(pRdrMgr->getTextState());\r\n\t\t\t} */\r\n\t\t} else {\r\n\t\t\tm_drawarea[1].surf_handle = mgrPacker.reallocateSurface(m_drawarea[1].surf_handle, texW, texH);\r\n\t\t}\r\n\t\tm_drawarea[1].format = m_format;\r\n\r\n\t\tif (width < height) {\r\n\t\t\ttexW *= 2;\r\n\t\t} else {\r\n\t\t\ttexH *= 2;\r\n\t\t}\r\n\r\n\t\tif (m_drawarea[1].surf_handle == NULL_IDX) {\r\n\t\t\tsuccess = false;\r\n\t\t}\r\n\t} else {\r\n\t\tm_drawarea[1].surf_handle = NULL_IDX;\r\n\t}\r\n\r\n\tsuccess = success && (m_drawarea[0].surf_handle != NULL_IDX);\r\n\r\n\tif (success) {\r\n\t\tif (doScroll) {\r\n\t\t\tmgrPacker.getSurfaceInfo(m_drawarea[1].surf_handle,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].softwareBufTile,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].leftU,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].upV,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].rightU,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].bottomV,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].stepU,\r\n\t\t\t\t\t\t\t\t\t m_drawarea[1].stepV);\r\n\r\n\t\t} else {\r\n\t\t\tm_drawarea[1].softwareBufTile = m_drawarea[0].softwareBufTile;\r\n\t\t\tm_drawarea[1].stepU\t\t\t= m_drawarea[0].stepU;\r\n\t\t\tm_drawarea[1].stepV\t\t\t= m_drawarea[0].stepV;\r\n\t\t\tm_drawarea[1].leftU\t\t\t= m_drawarea[0].leftU;\r\n\t\t\tm_drawarea[1].upV\t\t\t= m_drawarea[0].upV;\r\n\t\t\tm_drawarea[1].rightU\t\t= m_drawarea[0].rightU;\r\n\t\t\tm_drawarea[1].bottomV\t\t= m_drawarea[0].bottomV;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// For now we allocate a seperate texture\r\n\t\t// But we could later on write a texture chunk allocator.\r\n\t\t//\r\n\t\t/*\r\n\t\tu32 realTexW = nearest2Pow(texW);\r\n\t\tu32 realTexH = nearest2Pow(texH);\r\n\t\t\r\n\t\tstepUPix = 1.0f / realTexW;\r\n\t\tstepVPix = 1.0f / realTexH;\r\n\r\n\t\t*/\r\n\r\n\t\t// this->m_textureX[0] = 0;\r\n\t\t// this->m_textureY[0] = 0;\r\n\r\n\t\t\r\n\t\tpSprA->m_pTexture = mgrPacker.getTextureUsage(m_drawarea[0].surf_handle);\r\n\t\tif (doScroll) {\r\n\t\t\tpSprB->m_pTexture = mgrPacker.getTextureUsage(m_drawarea[1].surf_handle);\r\n\t\t}\r\n\t}\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\t// Failed : free everything.\r\n\tsetIgnoreVirtualDoc(NULL);\r\n#endif\r\n\r\n\tif (!success) {\r\n\t\tclearRessources(true, false);\r\n\t}\r\n\r\n\tthis->renderContext.stride\t\t\t= m_viewPortWidth; // in pixel\r\n\tthis->renderContext.targetWidth\t\t= m_viewPortWidth;\r\n\tthis->renderContext.targetHeight\t= m_viewPortHeight;\r\n\r\n\tm_bHasChanged = true;\r\n\r\n\treturn success;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::setViewPortPos(s32 x, s32 y) {\r\n\tif ((m_viewPortWidth == 0) || (m_viewPortHeight == 0)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (x < 0) {\r\n\t\tx = 0;\r\n\t}\r\n\r\n\tif (y < 0) {\r\n\t\ty = 0;\r\n\t}\r\n\r\n\t// Non scrollable type -> Force no scroll.\r\n\tif (!m_bScroll) {\r\n\t\tx = 0;\r\n\t\ty = 0;\r\n\t}\r\n\r\n\tif (m_bDisplay) {\r\n\t\tif (!m_isVertical) {\r\n\t\t\tm_currTile\t= x / m_viewPortWidth;\r\n\t\t\tm_scroll\t= (x % m_viewPortWidth);\r\n\t\t} else {\r\n\t\t\tm_currTile\t= y / m_viewPortHeight;\r\n\t\t\tm_scroll\t= (y % m_viewPortHeight);\r\n\t\t}\r\n\t\tint currIdx = m_currTile & 1;\r\n\t\tm_up = currIdx;\r\n\r\n\t\t//printf(\"tile:%i pos:%i\\n\", m_currTile, m_scroll);\r\n\r\n\t\tm_posX = x;\r\n\t\tm_posY = y;\r\n\r\n\t\tif ((m_currTile != m_prevTile) || m_bHasChanged /* || (m_prevScroll != m_scroll) || (!m_bScroll) */) {\r\n\t\t\tif(m_bHasChanged) {\r\n\t\t\t\tm_bHasChanged = false;\r\n\t\t\t}\r\n\r\n\t\t\tif (m_bScroll) {\r\n\r\n\t\t\t\tif (m_currTile == m_prevTile + 1) {\r\n\t\t\t\t\t// Copy Next Tile to Curr Tile\r\n\t\t\t\t\tif (!m_isVertical) {\r\n\t\t\t\t\t\tsetTargetSurface(1-currIdx, (m_currTile + 1) * m_viewPortWidth, 0);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsetTargetSurface(1-currIdx, 0, (m_currTile + 1) * m_viewPortHeight);\r\n\t\t\t\t\t}\r\n\t\t\t\t\trenderDocument();\r\n\t\t\t\t} else\r\n\t\t\t\tif (m_currTile == m_prevTile - 1) {\r\n\t\t\t\t\t// Copy Curr Tile to Next Tile\r\n\t\t\t\t\tif (!m_isVertical) {\r\n\t\t\t\t\t\tsetTargetSurface(currIdx, m_currTile * m_viewPortWidth, 0);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsetTargetSurface(currIdx, 0, m_currTile * m_viewPortHeight);\r\n\t\t\t\t\t}\r\n\t\t\t\t\trenderDocument();\r\n\t\t\t\t} else /*if (m_currTile != m_prevTile)*/\t// Complete refresh both.\r\n\t\t\t\t{\r\n\t\t\t\t\t// Redraw Both tile.\r\n\t\t\t\t\tif (!m_isVertical) {\r\n\t\t\t\t\t\tsetTargetSurface(currIdx,  m_currTile      * m_viewPortWidth, 0);\r\n\t\t\t\t\t\trenderDocument();\r\n\t\t\t\t\t\tsetTargetSurface(1 - currIdx, (m_currTile + 1) * m_viewPortWidth, 0);\r\n\t\t\t\t\t\trenderDocument();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsetTargetSurface(currIdx, 0, m_currTile       * m_viewPortHeight);\r\n\t\t\t\t\t\trenderDocument();\r\n\t\t\t\t\t\tsetTargetSurface(1 - currIdx, 0, (m_currTile + 1) * m_viewPortHeight);\r\n\t\t\t\t\t\trenderDocument();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tsetTargetSurface(currIdx, 0, m_currTile       * m_viewPortHeight);\r\n\t\t\t\trenderDocument();\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Refresh only the XY and UV. Texture may NOT be updated.\r\n\t\tupdateDynSprites(currIdx);\r\n\t\tif (m_bScroll) {\r\n\t\t\tupdateDynSprites(1 - currIdx);\r\n\t\t}\r\n\t\tmarkUpMatrix();\t\t\t// Recompute geometry.\r\n\r\n\t\tm_prevTile\t\t= m_currTile;\r\n\t\tm_prevScroll\t= m_scroll;\r\n\t} else {\r\n\t\tklb_assertAlways( \"create document, CKLBNodeVirtualDocument::lock()/unlockDocument()\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::setDocumentSize\t(u32 width, u32 height, bool scrollVertical) {\r\n\tm_documentWidth\t\t= width;\r\n\tm_documentHeight\t= height;\r\n\tm_isVertical\t\t= scrollVertical;\r\n\tm_prevTile\t\t\t= 0x7fff;\r\n}\r\n\r\nbool CKLBNodeVirtualDocument::createDocument\t(u16 maxCommandCount, u8 format) {\r\n\tfreeDocument();\r\n\r\n\tm_commandArray\t\t= KLBNEWA(SDrawCommand,maxCommandCount);\r\n\tm_CurrentCommand\t= 0;\r\n\tm_format\t\t\t= format;\r\n\tif (m_commandArray) {\r\n\t\tm_commandMaxCount = maxCommandCount;\r\n\t\treturn true;\r\n\t} else {\r\n\t\tm_commandMaxCount = 0;\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::freeDocument\t\t() {\r\n\tif (m_commandArray) {\r\n\t\tfor (u32 n = 0; n < m_CurrentCommand; n++) {\r\n\t\t\tif (m_commandArray[n].command == DRAWTEXT) {\r\n\t\t\t\tif (m_commandArray[n].ptr) {\r\n\t\t\t\t\tKLBDELETEA((char *)(m_commandArray[n].ptr));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(m_commandArray);\r\n\t\tm_commandArray = NULL;\r\n\t}\r\n\tm_CurrentCommand\t= 0;\r\n\tm_bDisplay\t\t\t= true;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::freeFont() {\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\tfor (int n=0; n<5; n++) {\r\n\t\tif (font[n]) {\r\n\t\t\tplatform.deleteFont(font[n]);\r\n\t\t}\r\n\t\tfont[n] = NULL;\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::lockDocument() {\r\n\tklb_assert(m_bDisplay,\t\t\"Document is already locked\");\r\n\tklb_assert(m_commandArray,\t\"CKLBNodeVirtualDocument::createDocument not called.\");\r\n\r\n\t// Do nothing in our implementation.\r\n\tm_bDisplay = false;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::emptyDocument() {\r\n/*\r\n\t2012.11.29  \r\n\tm_CurrentCommand\t= 0;\r\n*/\r\n\tif (m_commandArray) {\r\n\t\tfor (u32 n = 0; n < m_CurrentCommand; n++) {\r\n\t\t\tif (m_commandArray[n].command == DRAWTEXT) {\r\n\t\t\t\tif (m_commandArray[n].ptr) {\r\n\t\t\t\t\tKLBDELETEA((char *)(m_commandArray[n].ptr));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tm_CurrentCommand = 0;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::unlockDocument() {\r\n\t// --> Optimize data structure in optimized version.\r\n\tm_bDisplay      = true;\r\n\tm_bHasChanged   = true;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::clear\t\t(u32 fillColor) {\r\n\tm_bgColor\t\t= convertARGB32_RGBA8(fillColor);\r\n\tm_bHasChanged   = true;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::drawLine\t\t(s16 x0, s16 y0, s16 x1,    s16 y1,     u32 color) {\r\n\tif (m_CurrentCommand < m_commandMaxCount) {\r\n\t\tSDrawCommand* drw = &m_commandArray[m_CurrentCommand++];\r\n\t\tdrw->x0\t\t\t= x0;\r\n\t\tdrw->x1\t\t\t= x1;\r\n\t\tdrw->y0\t\t\t= y0;\r\n\t\tdrw->y1\t\t\t= y1;\r\n\t\tdrw->color\t\t= convertARGB32_RGBA8(color);\r\n\t\tdrw->command\t= DRAWLINE;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Reached max command in virtual document\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::drawRect\t\t(s16 x0, s16 y0, u16 width, u16 height, u32 color) {\r\n\tif (m_CurrentCommand < m_commandMaxCount) {\r\n\t\tSDrawCommand* drw = &m_commandArray[m_CurrentCommand++];\r\n\t\tdrw->x0\t\t\t= x0;\r\n\t\tdrw->x1\t\t\t= x0 + width - 1;\r\n\t\tdrw->y0\t\t\t= y0;\r\n\t\tdrw->y1\t\t\t= y0 + height - 1;\r\n\t\tdrw->color\t\t= convertARGB32_RGBA8(color);\r\n\t\tdrw->command\t= DRAWRECT;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Reached max command in virtual document\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::fillRect\t\t(s16 x0, s16 y0, u16 width, u16 height, u32 color, bool fill) {\r\n\tif (m_CurrentCommand < m_commandMaxCount) {\r\n\t\tSDrawCommand* drw = &m_commandArray[m_CurrentCommand++];\r\n\t\tdrw->x0\t\t\t= x0;\r\n\t\tdrw->x1\t\t\t= x0 + width;\r\n\t\tdrw->y0\t\t\t= y0;\r\n\t\tdrw->y1\t\t\t= y0 + height;\r\n\t\tdrw->color\t\t= convertARGB32_RGBA8(color);\r\n\t\tif (fill) {\r\n\t\t\tdrw->command = FILLRECTFORCE;\t// Fill\r\n\t\t} else {\r\n\t\t\tdrw->command = FILLRECT;\t\t\t// Blend\r\n\t\t}\r\n\t} else {\r\n\t\tklb_assertAlways(\"Reached max command in virtual document\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::drawImage\t(s16 x0, s16 y0, CKLBImageAsset* img, u8 Alpha) {\r\n\tif (img->getVertexCount() == 4) {\r\n\t\tif (m_CurrentCommand < m_commandMaxCount) {\r\n\t\t\tSDrawCommand* drw = &m_commandArray[m_CurrentCommand++];\r\n\t\t\tdrw->x0\t\t\t= x0;\r\n\t\t\tdrw->y0\t\t\t= y0;\r\n\t\t\tdrw->ptr\t\t= img;\r\n\r\n\t\t\t//\r\n\t\t\t// Preprocess image once to extract all information for\r\n\t\t\t// software rasterization process.\r\n\t\t\t//\r\n\t\t\tCKLBTextureAsset* pAsset = img->getTexture();\r\n\t\t\tfloat fx0; float fy0;\r\n\t\t\tfloat fx1; float fy1;\r\n\t\t\timg->getXY(0,&fx0,&fy0);\r\n\t\t\timg->getXY(2,&fx1,&fy1);\r\n\t\t\tfor (int n=0; n < 4; n+=2) {\r\n\t\t\t\tfloat u; float v;\r\n\t\t\t\timg->getUV(n,&u,&v);\t\t\t// Read UV vertex 0 and vertex 2\r\n\t\t\t\ts32 px = pAsset->m_width  * u;\t\t// Get X,Y from UV\r\n\t\t\t\ts32 py = pAsset->m_height * v;\r\n\r\n\t\t\t\tif (n == 0) {\r\n\t\t\t\t\tdrw->sx0\t\t= px;\r\n\t\t\t\t\tdrw->sy0\t\t= py;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ts32 dx = (s32)(fx1-fx0);\r\n\t\t\t\t\ts32 dy = (s32)(fy1-fy0);\r\n\t\t\t\t\tdrw->x1\t\t\t= x0 + dx;\r\n\t\t\t\t\tdrw->y1\t\t\t= y0 + dy;\r\n\t\t\t\t\tdrw->sdx\t\t= px - drw->sx0;\r\n\t\t\t\t\tdrw->sdy\t\t= py - drw->sy0;\r\n\r\n\t\t\t\t\tif ((drw->sdx == dx) || (drw->sdy == dy)) {\r\n\t\t\t\t\t\t// Normal\r\n\t\t\t\t\t\tdrw->swap = false;\r\n\t\t\t\t\t} else if ((drw->sdy == dx) || (drw->sdx == dy)) {\r\n\t\t\t\t\t\t// Swap X,Y\r\n\t\t\t\t\t\tdrw->swap = true;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Error\r\n\t\t\t\t\t\tklb_assertAlways(\"Imcompatible Bitmap with 4 vertex\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tdrw->ptr\t\t= img;\r\n\t\t\tdrw->color\t\t= Alpha;\r\n\t\t\tdrw->command\t= DRAWIMAGE; \r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"Reached max command in virtual document\");\r\n\t\t}\r\n\t} else {\r\n\t\tklb_assertAlways(\"Image has more than 4 vertex\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::drawTileImage(s16 x0, s16 y0, u16 width, u16 height, CKLBImageAsset* img, u8 Alpha) {\r\n\tif (m_CurrentCommand < m_commandMaxCount) {\r\n\t\tSDrawCommand* drw = &m_commandArray[m_CurrentCommand++];\r\n\t\tdrw->x0\t\t\t= x0;\r\n\t\tdrw->x1\t\t\t= x0 + width;\t\t// NO -1\r\n\t\tdrw->y0\t\t\t= y0;\r\n\t\tdrw->y1\t\t\t= y0 + height;\t\t// NO -1\r\n\t\tdrw->ptr\t\t= img;\r\n\t\tdrw->color\t\t= Alpha;\r\n\t\tdrw->command\t= DRAWIMAGETILED;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Reached max command in virtual document\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::drawText\t\t(s16 x0, s16 y0, const char* string, u32 color, u8 fontIndex,\r\n\t\t\t\t\t\t\t\tu8 align_mode, s16 align_width\t// addhook parameters.\r\n\t\t\t\t\t\t\t\t) {\r\n\tklb_assert(fontIndex < 5, \"Maximum 5 fonts per document\");\r\n\tif (font[fontIndex]) {\r\n\t\tchar* start;\r\n\t\tconst char* origString = string;\r\n\t\tif (string != NULL) {\r\n\t\t\tu32 length = strlen(string) + 1;\r\n\t\t\tchar* newString = KLBNEWA(char, length);\r\n\t\t\tif (newString) {\r\n\t\t\t\tmemcpy(newString, string, length);\r\n\t\t\t\tstring = newString;\r\n\t\t\t\tstart  = newString;\r\n\r\n\t\t\t\t#define\tCR\t(0x0D)\r\n\t\t\t\t#define LF\t(0x0A)\r\n\r\n\t\t\t\tbool first = true;\r\n\r\n\t\t\t\tSTextInfo textInfo;\r\n\t\t\t\tCPFInterface::getInstance().platform().getTextInfo(string, font[fontIndex], &textInfo);\r\n\r\n\t\t\t\t// 1 line size.\r\n\t\t\t\tint heightF = textInfo.ascent - textInfo.descent;\r\n\r\n\t\t\t\tint lineY\t= 0;\r\n\t\t\t\tbool hadCR\t= false;\r\n\r\n\t\t\t\twhile (*start) {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t//\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif(*start == CR) {\r\n\t\t\t\t\t\t*start++ = 0;\r\n\t\t\t\t\t\tlineY += heightF;\r\n\t\t\t\t\t\thadCR = true;\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t} else if(*start == LF) {\r\n\t\t\t\t\t\t*start++ = 0;\r\n\t\t\t\t\t\tif(!hadCR) lineY += heightF;\r\n\t\t\t\t\t\thadCR = false;\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t} else if ((*start == '\\\\') && (start[1] == 'n')) {\r\n\t\t\t\t\t\t*start++ = 0;\r\n\t\t\t\t\t\t*start++ = 0;\r\n\t\t\t\t\t\tlineY += heightF;\r\n\t\t\t\t\t\thadCR = false;\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t} else if(*start) {\r\n\r\n\t\t\t\t\t\tchar * term;\r\n\t\t\t\t\t\tchar code = 0;\r\n\t\t\t\t\t\tfor(term = start; *term; term++) {\r\n\t\t\t\t\t\t\tif ((*term == CR) || (*term == LF) || ((*term=='\\\\') && (term[1]=='n'))) {\r\n\t\t\t\t\t\t\t\tcode\t= *term;\r\n\t\t\t\t\t\t\t\t*term\t= 0;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ((term[0]=='\\\\') && (term[1]=='\\\\')) {\r\n\t\t\t\t\t\t\t\tint strLen = strlen(term);\t\t// Number of char\r\n\t\t\t\t\t\t\t\tmemcpy(term, term+1, strLen);\t// convert \\ + \\ into a single \\ for display\r\n\t\t\t\t\t\t\t\tterm++;\t\t\t\t\t\t\t// skip \\ char\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t\tif (m_CurrentCommand < m_commandMaxCount) {\r\n\t\t\t\t\t\t\tSDrawCommand* drw = &m_commandArray[m_CurrentCommand++];\r\n\t\t\t\t\t\t\tCPFInterface::getInstance().platform().getTextInfo(start, font[fontIndex], &textInfo);\r\n\r\n                            //行末コードを書き戻\r\n\t\t\t\t\t\t\t// Because the processing of the CR/LF is needed once we process this block.\r\n\t\t\t\t\t\t\t*term = code;\r\n\r\n\t\t\t\t\t\t\tswitch(align_mode) {\r\n\t\t\t\t\t\t\tdefault:\tdrw->x0 = x0;\tbreak;\r\n\t\t\t\t\t\t\tcase 1:\t\tdrw->x0 = x0 + (align_width - (int)textInfo.width) / 2;\tbreak;\r\n\t\t\t\t\t\t\tcase 2:\t\tdrw->x0 = x0 + (align_width - (int)textInfo.width);\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tdrw->y0\t\t\t= y0 - (int)textInfo.ascent  + lineY;\r\n\t\t\t\t\t\t\tdrw->x1\t\t\t= x0 + (int)textInfo.width;\r\n\t\t\t\t\t\t\tdrw->y1\t\t\t= y0 - (int)textInfo.descent + lineY;\r\n\t\t\t\t\t\t\tdrw->ptr\t\t= first ? (void*)string : NULL;\r\n\t\t\t\t\t\t\tdrw->txt\t\t= start;\r\n\r\n\t\t\t\t\t\t\tdrw->color\t\t= color;\r\n\t\t\t\t\t\t\tdrw->command\t= DRAWTEXT;\r\n\t\t\t\t\t\t\tdrw->fntIdx\t\t= fontIndex;\r\n\t\t\t\t\t\t\thadCR = false;\r\n\t\t\t\t\t\t\tfirst = false;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tDEBUG_PRINT(\"With text : '%s', Reached max command in virtual document (done by multiline text, if using Label, please use only one line.\", origString);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Jump at the end of display char.\r\n\t\t\t\t\t\tstart = term;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// No draw instruction was generated.\r\n\t\t\t\tif (first) {\r\n\t\t\t\t\tKLBDELETEA(string);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tDEBUG_PRINT(\"Font undefined\");\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::setFont(u8 index, const char* fontName, u16 fontSize) {\r\n\tklb_assert(index < 5, \"Maximum 5 fonts per document\");\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\tif(font[index]) {\r\n\t\tplatform.deleteFont(font[index]);\r\n\t\tfont[index] = NULL;\r\n\t}\r\n\tfont[index] = platform.getFont(fontSize, fontName,&fontInfo[index].ascent);\r\n\tm_bHasChanged = true;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::setTargetSurface(u8 index, s32 offsetX, s32 offsetY) {\r\n\tm_currBuff\t\t= index;\r\n\tm_tileXStart\t= offsetX;\r\n\tm_tileYStart\t= offsetY;\r\n\tm_tileXEnd\t\t= offsetX + m_viewPortWidth;\r\n\tm_tileYEnd\t\t= offsetY + m_viewPortHeight;\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::setVertex(CKLBDynSprite* pSpr, u32 idx4, float x0, float y0, float u, float v) {\r\n\tx0 += m_alignOffsetX;\r\n\ty0 += m_alignOffsetY;\r\n\r\n\t// 012 345\r\n\tswitch (idx4) {\r\n\tcase 0:\r\n\t\tpSpr->setVertexXY(0, x0,y0);\r\n\t\tpSpr->setVertexUV(0, u ,v );\r\n\t\tbreak;\r\n\tcase 1:\r\n\t\tpSpr->setVertexXY(1, x0,y0);\r\n\t\tpSpr->setVertexUV(1, u ,v );\r\n\t\tpSpr->setVertexXY(3, x0,y0);\r\n\t\tpSpr->setVertexUV(3, u ,v );\r\n\t\tbreak;\r\n\tcase 2:\r\n\t\tpSpr->setVertexXY(4, x0,y0);\r\n\t\tpSpr->setVertexUV(4, u ,v );\r\n\t\tbreak;\r\n\tcase 3:\r\n\t\tpSpr->setVertexXY(2, x0,y0);\r\n\t\tpSpr->setVertexUV(2, u ,v );\r\n\t\tpSpr->setVertexXY(5, x0,y0);\r\n\t\tpSpr->setVertexUV(5, u ,v );\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::forceRefresh() {\r\n\tif (m_drawarea[0].surf_handle != NULL_IDX) {\r\n\t\t// Success.\r\n\t\tmgrPacker.getSurfaceInfo(m_drawarea[0].surf_handle,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].softwareBufTile,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].leftU,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].upV,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].rightU,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].bottomV,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].stepU,\r\n\t\t\t\t\t\t\t\t m_drawarea[0].stepV);\r\n\t\tupdateDynSprites(0);\r\n\t\tmgrPacker.updateTexture(m_drawarea[0].surf_handle);\r\n\t}\r\n\t\r\n\tif (m_drawarea[1].surf_handle != NULL_IDX) {\r\n\t\tmgrPacker.getSurfaceInfo(m_drawarea[1].surf_handle,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].softwareBufTile,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].leftU,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].upV,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].rightU,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].bottomV,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].stepU,\r\n\t\t\t\t\t\t\t\t\tm_drawarea[1].stepV);\r\n\r\n\t\tupdateDynSprites(1);\r\n\t\tmgrPacker.updateTexture(m_drawarea[1].surf_handle);\r\n\t}\r\n\t\r\n\tmarkUpMatrixAndColor();\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::renderDocument() {\r\n\t// klb_assert((_CrtCheckMemory() != 0), \"Heap Error !\");\r\n\r\n\tif (!m_bDisplay)\t{ return; }\r\n\r\n\r\n\tRenderContext* pCtx = &renderContext;\r\n\t// pCtx->pBuffer\t\t= m_softwareBufferTile[m_currBuff];\r\n\tpCtx->pBuffer\t\t= m_drawarea[m_currBuff].softwareBufTile;\r\n\tpCtx->offsetX\t\t= m_tileXStart;\r\n\tpCtx->offsetY\t\t= m_tileYStart;\r\n\tpCtx->format\t\t= m_drawarea[m_currBuff].format;\r\n\r\n\t// Clipping absolute buffer coordinate.\r\n\tpCtx->setClip\t(0, 0, m_viewPortWidth, m_viewPortHeight);\r\n\r\n\t// Force tile fill at current coordinate. (relative coordinate fill, different from absolute instruction)\r\n\tpCtx->fillRect\t(\tm_tileXStart,\r\n\t\t\t\t\t\tm_tileYStart,\r\n\t\t\t\t\t\tm_viewPortWidth  + m_tileXStart,\r\n\t\t\t\t\t\tm_viewPortHeight + m_tileYStart, m_bgColor, true);\r\n\r\n\t// Render at absolute coordinate.\r\n\tfor (u32 n = 0; n < m_CurrentCommand; n++) {\r\n\t\tSDrawCommand* pDCom = &m_commandArray[n];\r\n\t\ts16 x0, x1, y0, y1;\r\n\t\tif(pDCom->x0 <= pDCom->x1) { x0 = pDCom->x0; x1 = pDCom->x1; } else { x0 = pDCom->x1; x1 = pDCom->x0; }\r\n\t\tif(pDCom->y0 <= pDCom->y1) { y0 = pDCom->y0; y1 = pDCom->y1; } else { y0 = pDCom->y1; y1 = pDCom->y0; }\r\n\t\r\n\t\t// x0 <= x1, y0 < y1\r\n\t\tif (\r\n\t\t\t (x1 <=  m_tileXStart) || (x0 >= m_tileXEnd  )\r\n\t\t\t ||\r\n\t\t\t (y1 <=  m_tileYStart) || (y0 >= m_tileYEnd  )\r\n\t\t   )\r\n\t\t{\r\n\t\t\t// skip instruction.\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tswitch (m_commandArray[n].command) {\r\n\t\tdefault:\r\n\t\t\tklb_assertAlways(\"Unknow draw command.\");\r\n\t\t\tbreak;\r\n\t\tcase DRAWLINE:\tpCtx->drawLine\t(pDCom->x0,pDCom->y0, pDCom->x1, pDCom->y1, pDCom->color);\tbreak;\r\n\t\tcase DRAWRECT:\tpCtx->drawRect\t(pDCom->x0,pDCom->y0, pDCom->x1, pDCom->y1, pDCom->color);\tbreak;\r\n\t\tcase FILLRECT:\tpCtx->fillRect\t(pDCom->x0,pDCom->y0, pDCom->x1, pDCom->y1, pDCom->color, false); break;\r\n\t\tcase FILLRECTFORCE\r\n\t\t\t\t\t:\tpCtx->fillRect\t(pDCom->x0,pDCom->y0, pDCom->x1, pDCom->y1, pDCom->color, true); break;\r\n\t\tcase DRAWIMAGE: pCtx->drawImage\t(pDCom->x0,pDCom->y0, pDCom, pDCom->color);\tbreak;\r\n\t\tcase DRAWTEXT:\t{\r\n\t\t\t\ts32 ascent = (s32)this->fontInfo[pDCom->fntIdx].ascent;\r\n\t\t\t\tpCtx->drawText\t(pDCom->x0,pDCom->y0 + ascent, (char*)pDCom->txt   , pDCom->color, font[pDCom->fntIdx], m_bScroll);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DRAWIMAGETILED:\r\n\t\t\t{\r\n\t\t\t\t// Set clip.\r\n\t\t\t\tpCtx->setClip(pDCom->x0, pDCom->y0, pDCom->x1, pDCom->y1);\r\n\t\t\t\t\r\n\t\t\t\t// Draw Images\r\n\t\t\t\tfor (s32 y = 0; y < pDCom->y1; y += (pDCom->y1 - pDCom->y0)) {\r\n\t\t\t\t\tfor (s32 x = 0; x < pDCom->x1; x += (pDCom->x1 - pDCom->x0)) {\r\n\t\t\t\t\t\tpCtx->drawImage\t(x, y, pDCom, pDCom->color);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Restore clip\r\n\t\t\t\tpCtx->setClip(0,0,this->m_viewPortWidth,this->m_viewPortHeight);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tupdateDynSprites(0);\r\n\tupdateDynSprites(1);\r\n\tmgrPacker.updateTexture(m_drawarea[0].surf_handle);\r\n\tmgrPacker.updateTexture(m_drawarea[1].surf_handle);\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::updateDynSprites(u8 currBuff) {\r\n\tVDOCDRAW * pDraw = &m_drawarea[currBuff];\r\n\tCKLBDynSprite* pSpr = pDraw->tile;\r\n\r\n\tif (pSpr) {\r\n\t\tif (m_up == currBuff) {\r\n\t\t\t//\r\n\t\t\t// Up clipping.\r\n\t\t\t//\r\n\r\n\t\t\t//\r\n\t\t\t// 4 Vertex numbering\r\n\t\t\t//\r\n\t\t\t// 0--1 /////////////////////\r\n\t\t\t// |  | <----- Top is clipped\r\n\t\t\t// 3--2\r\n\t\t\t//\r\n\t\t\tif (m_isVertical) {\r\n\t\t\t\ts32\t\tremainV\t\t= m_viewPortHeight - m_scroll;\r\n\t\t\t\tfloat\tremainVF\t= (float)remainV;\r\n\t\t\t\tfloat\tvpWidthF\t= (float)m_viewPortWidth;\r\n\t\t\t\t//\r\n\t\t\t\t// Dyn Sprite has 6 vertex. which are equiv to :\r\n\t\t\t\t//\r\n\t\t\t\t// 0---1/3 /////////////////////\r\n\t\t\t\t// |    | <----- Top is clipped\r\n\t\t\t\t//5/2---4\r\n\r\n\t\t\t\tfloat clipV = pDraw->upV + (m_scroll * pDraw->stepV);\r\n\t\t\t\tsetVertex(pSpr,0, 0,\t\t0,\t\t\tpDraw->leftU,\t\tclipV);\r\n\t\t\t\tsetVertex(pSpr,1, vpWidthF,\t0,\t\t\tpDraw->rightU,\t\tclipV);\r\n\t\t\t\tsetVertex(pSpr,2, vpWidthF,\tremainVF,\tpDraw->rightU,\t\tpDraw->bottomV);\r\n\t\t\t\tsetVertex(pSpr,3, 0,\t\tremainVF,\tpDraw->leftU,\t\tpDraw->bottomV);\r\n\t\t\t} else {\r\n\t\t\t\t// 0----1.3\r\n\t\t\t\t// |//|  |\r\n\t\t\t\t// |//|  |\r\n\t\t\t\t//5.2----4\r\n\t\t\t\t//   /|\r\n\t\t\t\t//   /|\r\n\t\t\t\ts32\t\tremainH\t\t= m_viewPortWidth - m_scroll;\r\n\t\t\t\tfloat\tremainHF\t= (float)remainH;\r\n\t\t\t\tfloat\tvpHeightF\t= (float)m_viewPortHeight;\r\n\r\n\t\t\t\tfloat clipU = pDraw->leftU + (m_scroll * pDraw->stepU);\r\n\r\n\t\t\t\tsetVertex(pSpr,0, 0,\t\t0,\t\t\tclipU,\t\t\t\t\tpDraw->upV);\r\n\t\t\t\tsetVertex(pSpr,1, remainHF,\t0,\t\t\tpDraw->rightU,\t\t\tpDraw->upV);\r\n\t\t\t\tsetVertex(pSpr,2, remainHF,\tvpHeightF,\tpDraw->rightU,\t\t\tpDraw->bottomV);\r\n\t\t\t\tsetVertex(pSpr,3, 0,\t\tvpHeightF,\tclipU,\t\t\t\t\tpDraw->bottomV);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfloat\tvpWidthF\t= (float)m_viewPortWidth;\r\n\t\t\tfloat\tvpHeightF\t= (float)m_viewPortHeight;\r\n\t\t\t//\r\n\t\t\t// 0--1\r\n\t\t\t// |  | <----- Top is clipped\r\n\t\t\t// 3--2 /////////////////////\r\n\t\t\t//\r\n\t\t\tif (m_isVertical) {\r\n\t\t\t\tfloat\tvOffsetF\t= (float)(m_viewPortHeight - m_scroll);\r\n\t\t\t\ts32\t\tremainV\t\t= m_scroll;\r\n\t\t\t\tfloat\tremainVF\t= (float)remainV;\r\n\r\n\t\t\t\tfloat clipV = pDraw->upV + (remainVF * pDraw->stepV);\r\n\r\n\t\t\t\tsetVertex(pSpr,0, 0,\t\tvOffsetF,\t\t\t  pDraw->leftU,\t\tpDraw->upV);\r\n\t\t\t\tsetVertex(pSpr,1, vpWidthF,\tvOffsetF,\t\t\t  pDraw->rightU,\tpDraw->upV);\r\n\t\t\t\tsetVertex(pSpr,2, vpWidthF,\tvOffsetF + remainVF,  pDraw->rightU,\tclipV);\r\n\t\t\t\tsetVertex(pSpr,3, 0,\t\tvOffsetF + remainVF,  pDraw->leftU,\t\tclipV);\r\n\t\t\t} else {\r\n\t\t\t\tfloat\thOffsetF\t= (float)(m_viewPortWidth - m_scroll);\r\n\t\t\t\ts32\t\tremainH\t\t= m_scroll;\r\n\t\t\t\tfloat\tremainHF\t= (float)remainH;\r\n\r\n\t\t\t\tfloat clipU = pDraw->leftU + (remainH * pDraw->stepU);\r\n\r\n\t\t\t\tsetVertex(pSpr, 0, hOffsetF,\t\t\t0,\t\t\tpDraw->leftU,\tpDraw->upV);\r\n\t\t\t\tsetVertex(pSpr, 1, hOffsetF + remainHF,\t0,\t\t\tclipU,\t\t\tpDraw->upV);\r\n\t\t\t\tsetVertex(pSpr, 2, hOffsetF + remainHF,\tvpHeightF,\tclipU,\t\t\tpDraw->bottomV);\r\n\t\t\t\tsetVertex(pSpr, 3, hOffsetF,\t\t\tvpHeightF,\tpDraw->leftU,\tpDraw->bottomV);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpSpr->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY | FLAG_BUFFERSHIFT);\r\n\t}\r\n}\r\n\r\nvoid CKLBNodeVirtualDocument::setPriority(u32 renderPriority)\r\n{\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\tm_drawarea[0].tile->changeOrder(pRdrMgr, renderPriority);\r\n\tm_drawarea[1].tile->changeOrder(pRdrMgr, renderPriority);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBNodeVirtualDocument.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLBVIRTUALDOCUMENTNODE__\r\n#define __CKLBVIRTUALDOCUMENTNODE__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"string.h\"\r\n\r\nenum ECOMMAND {\r\n\tDRAWLINE,\r\n\tDRAWRECT,\r\n\tFILLRECT,\r\n\tFILLRECTFORCE,\r\n\tDRAWIMAGE,\r\n\tDRAWIMAGETILED,\r\n\tDRAWTEXT,\r\n};\r\n\r\nstruct SDrawCommand {\r\n\t// SDrawCommand*\tnext; /* Not used for now */\r\n\t// Can add other pointer later on to more optimized data structure.\r\n\tvoid*\t\t\tptr;\t// Image or string buffer\r\n\tvoid*\t\t\ttxt;\t// text to display inside string buffer\r\n\ts16\t\t\t\ty0;\r\n\ts16 \t\t\tx0;\r\n\ts16 \t\t\ty1;\r\n\ts16 \t\t\tx1;\r\n\ts16\t\t\t\tsdx;\r\n\ts16\t\t\t\tsdy;\r\n\ts16\t\t\t\tsx0;\r\n\ts16\t\t\t\tsy0;\r\n\tu32\t\t\t\tcolor;\r\n\tECOMMAND\t\tcommand;\r\n\tu8\t\t\t\tfntIdx;\r\n\tbool\t\t\tswap;\r\n};\r\n\r\nstruct RenderContext {\r\n\tu32* pBuffer;\r\n\ts32  stride;\r\n\ts32\tclipX0;\r\n\ts32\tclipY0;\r\n\ts32 clipX1;\r\n\ts32 clipY1;\r\n\ts32 offsetX;\r\n\ts32 offsetY;\r\n\ts32 targetWidth;\r\n\ts32 targetHeight;\r\n\tu8\tformat;\r\n\r\n\tvoid translate\t(s32 offsetX, s32 offsetY) {\r\n\t\tthis->offsetX = offsetX;\r\n\t\tthis->offsetY = offsetY;\r\n\t}\r\n\r\n\tvoid setClip\t(s32 x0, s32 y0, s32 x1, s32 y1);\t\t\t\t//Only command in buffer space (no translate)\r\n\tvoid drawLine\t(s32 x0, s32 y0, s32 x1, s32 y1, u32 color);\r\n\tvoid drawRect\t(s32 x0, s32 y0, s32 x1, s32 y1, u32 color);\r\n\tvoid fillRect\t(s32 x0, s32 y0, s32 x1, s32 y1, u32 color, bool forceFill);\r\n\tvoid drawText\t(s32 x , s32 y , char* string  , u32 color, void* font, bool docMode);\r\n\tvoid drawImage\t(s32 x , s32 y , SDrawCommand* img  , u8  alpha);\r\nprivate:\r\n\tvoid setPixelClip\t\t(s32 x1, s32 y1, u32 color);\r\n\tvoid setPixelClip4444\t(s32 x1, s32 y1, u16 color);\r\n};\r\n\r\n// Just for FORMAT_8 / FORMAT_8888 constant.\r\n#include \"CKLBTexturePacker.h\"\r\n\r\n/*!\r\n* \\class CKLBNodeVirtualDocument\r\n* \\brief Virtual Doument Specilized Node Class\r\n* \r\n* CKLBNodeVirtualDocumentis in charge of the graphic operations\r\n* on a Virtual Document.\r\n*/\r\nclass CKLBNodeVirtualDocument : public CKLBNode {\r\npublic:\r\n\t/*\r\n\tstatic const int\tVDFORMAT_8\t\t\t= FORMAT_8;\t\t// Not supported yet.\r\n\tstatic const int\tVDFORMAT_8888\t\t= FORMAT_8888;\r\n\tstatic const int\tVDFORMAT_4444\t\t= FORMAT_4444;\r\n\t*/\r\n\r\n\tCKLBNodeVirtualDocument();\r\n\t~CKLBNodeVirtualDocument();\r\n\r\n\tu32 getClassID() { return CLS_KLBNODEVIRTUALDOC; }\r\n\r\n\tvoid\tsetFont\t\t\t(u8 index, const char* fontName, u16 fontSize);\r\n\tvoid\tsetDocumentSize\t(u32 width, u32 height, bool scrollVertical = true);\r\n\tbool\tsetViewPortSize\t(u32 width, u32 height, float alignOffsetX, float alignOffsetY, u32 priority, bool doScroll);\r\n\tvoid\tsetViewPortPos\t(s32 x,     s32 y);\r\n\tbool\tcreateDocument\t(u16 maxCommandCount, u8 format);\r\n\tvoid\tfreeDocument\t();\r\n\tvoid\tfreeFont\t\t();\r\n\r\n\tvoid\tlockDocument\t();\r\n\tvoid\tunlockDocument\t();\r\n\tvoid\temptyDocument\t();\r\n\r\n\tvoid\tclear\t\t\t(u32 fillColor);\r\n\tvoid\tdrawLine\t\t(s16 x0, s16 y0, s16 x1,    s16 y1,     u32 color);\r\n\tvoid\tdrawRect\t\t(s16 x0, s16 y0, u16 width, u16 height, u32 color);\r\n\tvoid\tfillRect\t\t(s16 x0, s16 y0, u16 width, u16 height, u32 color, bool fill = false);\r\n\tvoid\tdrawImage\t\t(s16 x0, s16 y0, CKLBImageAsset* img, u8 alpha);\r\n\tvoid\tdrawTileImage\t(s16 x0, s16 y0, u16 width, u16 height, CKLBImageAsset* img, u8 alpha);\r\n\tvoid\tdrawText\t\t(s16 x0, s16 y0, const char* string, u32 color, u8 fontIndex,\r\n\t\t\t\t\t\t\t u8 align_mode = 0, s16 align_width = 0\t// addhook parameters.\r\n\t\t\t\t\t\t\t );\r\n\r\n\ts32\t\tgetViewPortPosX\t()\t{ return m_posX; }\r\n\ts32\t\tgetViewPortPosY\t()\t{ return m_posY; }\r\n\r\n\tvoid\tcheck();\r\n\r\n\tvoid\tsetPriority(u32 renderPriority);\r\n\r\n\tvoid\tforceRefresh\t();\r\nprotected:\r\n\tstatic\r\n\tvoid\tdocTextureCompaction(void* ctx, u16 oldsurface, u16 newSurface);\r\n\r\n\tvoid\tclearRessources\t(bool freeSurface, bool freeFonts);\r\n\tvoid\trenderDocument\t();\r\n\tvoid\tsetVertex\t\t(CKLBDynSprite* pSpr, u32 idx4, float x0, float y0, float u, float v);\r\n\tvoid\tsetTargetSurface(u8 index, s32 offsetX, s32 offsetY);\r\n\tvoid\tupdateDynSprites(u8 index);\r\n\r\n\r\n\tfloat\t\t\tm_alignOffsetX;\r\n\tfloat\t\t\tm_alignOffsetY;\r\n\ts32\t\t\t\tm_posX;\r\n\ts32\t\t\t\tm_posY;\r\n\tSDrawCommand*\tm_commandArray;\r\n\tu16\t\t\t\tm_commandMaxCount;\r\n\tu16\t\t\t\tm_CurrentCommand;\r\n\r\n\tstruct VDOCDRAW {\r\n\t\tCKLBDynSprite\t*\ttile;\t\t\t\t// 描画用スプライト\r\n\t\tfloat\t\t\t\tupV;\r\n\t\tfloat\t\t\t\tbottomV;\r\n\t\tfloat\t\t\t\tleftU;\r\n\t\tfloat\t\t\t\trightU;\r\n\r\n\t\tfloat\t\t\t\tstepU;\r\n\t\tfloat\t\t\t\tstepV;\r\n\t\tu32\t\t\t\t*\tsoftwareBufTile;\t// 対応するソフトウェアバッファ\r\n\t\tu16\t\t\t\t\tsurf_handle;\t\t// 対応するsurfaceのハンドル\r\n\t\tu8\t\t\t\t\tformat;\r\n\t};\r\n\r\n\tVDOCDRAW\t\tm_drawarea[2];\r\n\r\n\t/*\r\n\t// m_drawarea[] は、以前のバージョンにおける下記メンバを置き換えるものとなる。\r\n\r\n\tu16\t\t\t\tm_surfA;\r\n\tu16\t\t\t\tm_surfB;\r\n\tu32*\t\t\tm_softwareBufferTile[2];\t// ViewPort x 2\r\n\tCKLBDynSprite*\tm_tile\t\t[2];\r\n\tfloat\t\t\tupV\t\t\t[2];\r\n\tfloat\t\t\tbottomV\t\t[2];\r\n\tfloat\t\t\tleftU\t\t[2];\r\n\tfloat\t\t\trightU\t\t[2];\r\n\t// u32\t\t\tm_textureX\t[2];\r\n\t// u32\t\t\tm_textureY\t[2];\r\n\r\n\t// 2 tiles inside SAME texture : u v step are the same.\r\n\tfloat\t\t\tstepU\t\t[2];\r\n\tfloat\t\t\tstepV\t\t[2];\r\n\t*/\r\n\tbool\t\t\tm_isVertical;\r\n\tbool\t\t\tm_bScroll;\r\n\r\n\tCTexture*\t\tm_texture;\r\n\t\r\n\tu32\t\t\t\tm_bgColor;\r\n\r\n\tSTextInfo\t\tfontInfo\t[5];\r\n\tvoid*\t\t\tfont\t\t[5];\r\n\r\n\t// 2 tiles inside SAME texture : u v step are the same.\r\n\r\n\tu32\t\t\t\tm_viewPortHeight;\r\n\tu32\t\t\t\tm_viewPortWidth;\r\n\ts16\t\t\t\tm_currTile;\r\n\ts16\t\t\t\tm_prevTile;\r\n\ts16\t\t\t\tm_scroll;\r\n\ts16\t\t\t\tm_prevScroll;\r\n\tu8\t\t\t\tm_currBuff;\r\n\tu8\t\t\t\tm_up;\r\n\tu8\t\t\t\tm_format;\r\n\tbool\t\t\tm_bDisplay;\r\n\r\n\tbool\t\t\tm_bHasChanged;\r\n\r\n\ts32\t\t\t\tm_tileXStart;\r\n\ts32\t\t\t\tm_tileYStart;\r\n\ts32\t\t\t\tm_tileXEnd;\r\n\ts32\t\t\t\tm_tileYEnd;\r\n\ts32\t\t\t\tm_documentWidth;\r\n\ts32\t\t\t\tm_documentHeight;\r\n\r\n\tRenderContext\trenderContext;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBSWFPlayer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// PlayerCPP.cpp : Defines the entry point for the console application.\r\n//\r\n#include \"CKLBSWFPlayer.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBRendering.h\"\r\n#include \"mem.h\"\r\n#include \"Message.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n// ================================================================================\r\n//   Asset Plugin.\r\n// ================================================================================\r\n\r\nKLBFlashAssetPlugin::KLBFlashAssetPlugin()\r\n: IKLBAssetPlugin()\r\n{\r\n}\r\n\r\nKLBFlashAssetPlugin::~KLBFlashAssetPlugin() {\r\n}\r\n\r\n/*virtual*/\r\nCKLBAbstractAsset* KLBFlashAssetPlugin::loadAsset(u8* stream, u32 /*streamSize*/) {\r\n\t//\r\n\t// Create asset and forward to loader.\r\n\t//\r\n\tCKLBSWFAsset* pNewAsset = KLBNEW(CKLBSWFAsset);\r\n\r\n\tif (pNewAsset) {\r\n\t\tif( pNewAsset->LoadData(stream) ) {\r\n    \t\treturn pNewAsset;\r\n        } else {\r\n            KLBDELETE( pNewAsset );\r\n        }\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n\r\n// ================================================================================\r\n// Class Construction / Destruction.\r\n// ================================================================================\r\n\r\nstruct SShape {\r\n\tu16 shapeID;\r\n\tu16 styleCount;\r\n\tu16\tindexCount;\r\n\tu16 vertexCount;\r\n\tu8\tstyleType;\r\n\r\n\tu32\tindexBuffer;\r\n\tu32\tXYBuffer;\r\n\tu32 UVBuffer;\r\n\tu32 fillColor;\r\n\tCTexture*       texture;\r\n\tCTextureUsage*  textureUsage;\r\n};\r\n\r\nstruct SSound {\r\n\tvoid*\t\t\thandle;\r\n\tu32\t\t\t\tnameIdx;\r\n\tconst char*\t\tname;\r\n\r\n};\r\n\r\nCKLBSWFAsset::CKLBSWFAsset()\r\n:CKLBAsset()\r\n,m_aConstants\t\t\t(NULL)\r\n,m_aChars\t\t\t\t(NULL)\r\n,m_aMatrixData\t\t\t(NULL)\r\n,m_aMatrixType\t\t\t(NULL)\r\n,m_aMatrixDataIndex\t\t(NULL)\r\n,m_aStreamInstruction\t(NULL)\r\n,m_aMovieInfo\t\t\t(NULL)\r\n,m_alistCacheEntries\t(NULL)\r\n,m_parentSWF\t\t\t(NULL)\r\n,m_aBitmapLoaded\t\t(NULL)\r\n,m_subAssets\t\t\t(NULL)\r\n,m_pIndex\t\t\t\t(NULL)\r\n,m_shapes\t\t\t\t(NULL)\r\n,m_sounds\t\t\t\t(NULL)\r\n,m_isMaster\t\t\t\t(false)\r\n,m_msPerFrame\t\t\t(41)\t// around 24 fps default.\r\n,m_uiMovieCount\t\t\t(0)\t\r\n,m_uiShapeCount\t\t\t(0)\r\n,m_uiSoundCount\t\t\t(0)\r\n{\r\n}\r\n\r\nCKLBSWFAsset::~CKLBSWFAsset() {\r\n\tif (m_aConstants)\t\t\t{\tKLBDELETEA(m_aConstants);\t\t\tm_aConstants\t\t\t= NULL;\t}\r\n\tif (m_aChars)\t\t\t\t{\tKLBDELETEA(m_aChars);\t\t\t\tm_aChars\t\t\t\t= NULL;\t}\r\n\tif (m_aMatrixData)\t\t\t{\tKLBDELETEA(m_aMatrixData);\t\t\tm_aMatrixData\t\t\t= NULL;\t}\r\n\tif (m_aMatrixType)\t\t\t{\tKLBDELETEA(m_aMatrixType);\t\t\tm_aMatrixType\t\t\t= NULL;\t}\r\n\tif (m_aMatrixDataIndex)\t\t{\tKLBDELETEA(m_aMatrixDataIndex);\t    m_aMatrixDataIndex\t\t= NULL;\t}\r\n\tif (m_aStreamInstruction)\t{\tKLBDELETEA(m_aStreamInstruction);\tm_aStreamInstruction\t= NULL;\t}\r\n\tif (m_alistCacheEntries)\t{\t\r\n\t\tfor (u32 n=0; n < m_uiMovieCount; n++) {\r\n\t\t\tSCacheEntry* pList = m_alistCacheEntries[n];\r\n\t\t\twhile (pList) {\r\n\t\t\t\tSCacheEntry* pNext = pList->m_next;\r\n\t\t\t\t// Kill subtree\r\n\t\t\t\tKLBDELETE(pList->m_cacheNode);\r\n\t\t\t\t// Kill Entry\r\n\t\t\t\tKLBDELETE(pList);\r\n\t\t\t\tpList = pNext;\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(m_alistCacheEntries);\tm_alistCacheEntries\t\t= NULL; \r\n\t}\r\n\tif (m_aMovieInfo)\t\t\t{\tKLBDELETEA(m_aMovieInfo);\t\t\tm_aMovieInfo\t\t\t= NULL;\t}\r\n\tif (m_pIndex)\t\t\t\t{\tKLBDELETEA(m_pIndex);\t\t\t\tm_pIndex\t\t\t\t= NULL; }\r\n\tif (m_shapes)\t\t\t\t{\r\n\t\tCKLBOGLWrapper& pMgr\t= CKLBOGLWrapper::getInstance();\r\n\r\n\t\tfor (u32 n = 0; n < this->m_uiShapeCount; n++) {\r\n\t\t\tif (m_shapes[n].textureUsage) {\r\n\t\t\t\tm_shapes[n].texture->releaseUsage(m_shapes[n].textureUsage);\r\n\t\t\t}\r\n\r\n\t\t\tif (m_shapes[n].texture) {\r\n\t\t\t\tpMgr.releaseTexture(m_shapes[n].texture);\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(m_shapes);\t\t\t\t\r\n\t\tm_shapes = NULL; \r\n\t}\r\n\t\r\n\tif (m_sounds) {\r\n\t\tfor (u32 n = 0; n < this->m_uiSoundCount; n++) {\r\n\t\t\tCPFInterface::getInstance().platform().releaseAudio(m_sounds[n].handle);\r\n\t\t}\r\n\t\tKLBDELETEA(m_sounds);\r\n\t}\r\n\t\r\n\tif (m_isMaster) {\r\n\t\tCKLBSWFAsset* pList = m_subAssets;\r\n\t\twhile (pList) {\r\n\t\t\tCKLBSWFAsset* pListNext = pList->m_subAssets;\r\n\t\t\tKLBDELETE(pList);\r\n\t\t\tpList = pListNext;\r\n\t\t}\r\n\t}\r\n\r\n\tif (m_aBitmapLoaded) {\r\n\t\tfor (u32 n = 0; n < m_uiMovieCount; n++) {\r\n\t\t\tif (m_aBitmapLoaded[n]) {\r\n\t\t\t\tm_aBitmapLoaded[n]->getTexture()->decrementRefCount();\r\n\t\t\t\tm_aBitmapLoaded[n] = NULL;\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(m_aBitmapLoaded);\r\n\t\tm_aBitmapLoaded = NULL;\r\n\t}\r\n}\r\n\r\n// ================================================================================\r\n// Player Implementation\r\n// ================================================================================\r\n\r\n// ##########################################\r\n//\r\n//   Player\r\n//\r\n// ##########################################\r\n\r\n\r\n#define READU8P(p)\t(*p++)\r\n#define READU16P(p)\t((p[0]<<8)   | p[1]); p += 2\r\n#define READU32P(p)\t((p[0]<<24)  | (p[1]<<16) | (p[2]<<8) | p[3]); p += 4\r\n#define READFLP(p)\t(((p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3])/65536.0f); p += 4\r\n\r\n\r\nu32 globalTmpTable[64*64];\r\nu32 globalPalette[64];\r\n\r\nstatic const u8 ROMCircleLookup[64*64] = {\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,62,61,61,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,61,61,60,60,60,60,60,59,59,60,60,60,60,60,61,61,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,61,60,59,59,58,58,58,58,57,57,57,57,58,58,58,58,59,59,60,61,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,59,58,57,57,56,56,56,56,55,55,55,55,56,56,56,56,57,57,58,59,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,57,56,55,55,54,54,54,54,53,53,53,53,54,54,54,54,55,55,56,57,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,56,56,55,54,54,53,53,52,52,52,51,51,51,51,52,52,52,53,53,54,54,55,56,56,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,58,57,56,55,54,54,53,52,52,51,51,50,50,50,49,49,49,49,50,50,50,51,51,52,52,53,54,54,55,56,57,58,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,62,60,59,58,57,56,55,54,53,52,51,50,50,49,49,48,48,48,47,47,47,47,48,48,48,49,49,50,50,51,52,53,54,55,56,57,58,59,60,62,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,61,60,59,57,56,55,54,53,52,51,50,49,48,48,47,47,46,46,45,45,45,45,45,45,46,46,47,47,48,48,49,50,51,52,53,54,55,56,57,59,60,61,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,61,60,58,57,56,55,53,52,51,50,49,48,47,46,46,45,45,44,44,43,43,43,43,43,43,44,44,45,45,46,46,47,48,49,50,51,52,53,55,56,57,58,60,61,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,61,60,58,57,56,54,53,52,51,49,48,47,46,45,45,44,43,43,42,42,41,41,41,41,41,41,42,42,43,43,44,45,45,46,47,48,49,51,52,53,54,56,57,58,60,61,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,62,60,58,57,56,54,53,51,50,49,48,47,45,44,44,43,42,41,41,40,40,39,39,39,39,39,39,40,40,41,41,42,43,44,44,45,47,48,49,50,51,53,54,56,57,58,60,62,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,62,60,59,57,56,54,53,51,50,49,47,46,45,44,43,42,41,40,39,39,38,38,37,37,37,37,37,37,38,38,39,39,40,41,42,43,44,45,46,47,49,50,51,53,54,56,57,59,60,62,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,62,61,59,57,56,54,53,51,50,48,47,46,44,43,42,41,40,39,38,37,37,36,36,35,35,35,35,35,35,36,36,37,37,38,39,40,41,42,43,44,46,47,48,50,51,53,54,56,57,59,61,62,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,61,60,58,56,55,53,51,50,48,47,45,44,43,42,40,39,38,37,36,36,35,34,34,33,33,33,33,33,33,34,34,35,36,36,37,38,39,40,42,43,44,45,47,48,50,51,53,55,56,58,60,61,63,63,63,63,63,63,\r\n\t63,63,63,63,63,62,60,58,57,55,53,52,50,49,47,45,44,43,41,40,39,38,36,35,34,34,33,32,32,31,31,31,31,31,31,32,32,33,34,34,35,36,38,39,40,41,43,44,45,47,49,50,52,53,55,57,58,60,62,63,63,63,63,63,\r\n\t63,63,63,63,63,61,59,57,56,54,52,51,49,47,46,44,43,41,40,38,37,36,35,34,33,32,31,30,30,29,29,29,29,29,29,30,30,31,32,33,34,35,36,37,38,40,41,43,44,46,47,49,51,52,54,56,57,59,61,63,63,63,63,63,\r\n\t63,63,63,63,62,60,58,56,55,53,51,49,48,46,44,43,41,40,38,37,36,34,33,32,31,30,29,28,28,27,27,27,27,27,27,28,28,29,30,31,32,33,34,36,37,38,40,41,43,44,46,48,49,51,53,55,56,58,60,62,63,63,63,63,\r\n\t63,63,63,63,61,59,57,55,54,52,50,48,47,45,43,42,40,38,37,35,34,33,31,30,29,28,27,26,26,25,25,25,25,25,25,26,26,27,28,29,30,31,33,34,35,37,38,40,42,43,45,47,48,50,52,54,55,57,59,61,63,63,63,63,\r\n\t63,63,63,62,60,58,56,54,53,51,49,47,45,44,42,40,39,37,36,34,33,31,30,29,27,26,25,25,24,23,23,23,23,23,23,24,25,25,26,27,29,30,31,33,34,36,37,39,40,42,44,45,47,49,51,53,54,56,58,60,62,63,63,63,\r\n\t63,63,63,61,59,57,56,54,52,50,48,46,44,43,41,39,38,36,34,33,31,30,28,27,26,25,24,23,22,21,21,21,21,21,21,22,23,24,25,26,27,28,30,31,33,34,36,38,39,41,43,44,46,48,50,52,54,56,57,59,61,63,63,63,\r\n\t63,63,62,61,59,57,55,53,51,49,47,45,44,42,40,38,36,35,33,31,30,28,27,25,24,23,22,21,20,19,19,19,19,19,19,20,21,22,23,24,25,27,28,30,31,33,35,36,38,40,42,44,45,47,49,51,53,55,57,59,61,62,63,63,\r\n\t63,63,62,60,58,56,54,52,50,48,46,45,43,41,39,37,35,34,32,30,29,27,25,24,23,21,20,19,18,18,17,17,17,17,18,18,19,20,21,23,24,25,27,29,30,32,34,35,37,39,41,43,45,46,48,50,52,54,56,58,60,62,63,63,\r\n\t63,63,61,59,57,55,54,52,50,48,46,44,42,40,38,36,34,33,31,29,27,26,24,23,21,20,18,17,16,16,15,15,15,15,16,16,17,18,20,21,23,24,26,27,29,31,33,34,36,38,40,42,44,46,48,50,52,54,55,57,59,61,63,63,\r\n\t63,63,61,59,57,55,53,51,49,47,45,43,41,39,37,36,34,32,30,28,26,25,23,21,20,18,17,16,14,14,13,13,13,13,14,14,16,17,18,20,21,23,25,26,28,30,32,34,36,37,39,41,43,45,47,49,51,53,55,57,59,61,63,63,\r\n\t63,62,60,58,56,54,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,24,22,20,18,17,15,14,13,12,11,11,11,11,12,13,14,15,17,18,20,22,24,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,54,56,58,60,62,63,\r\n\t63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,25,23,21,19,17,16,14,12,11,10, 9, 9, 9, 9,10,11,12,14,16,17,19,21,23,25,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,\r\n\t63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,13,11,10, 8, 7, 7, 7, 7, 8,10,11,13,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,\r\n\t63,62,60,58,56,54,52,50,48,45,43,41,39,37,35,33,31,29,27,25,23,21,19,18,16,14,12,10, 8, 7, 5, 5, 5, 5, 7, 8,10,12,14,16,18,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,52,54,56,58,60,62,63,\r\n\t63,62,60,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 4, 3, 3, 4, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,60,62,63,\r\n\t63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,\r\n\t63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,\r\n\t63,62,60,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 4, 3, 3, 4, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,60,62,63,\r\n\t63,62,60,58,56,54,52,50,48,45,43,41,39,37,35,33,31,29,27,25,23,21,19,18,16,14,12,10, 8, 7, 5, 5, 5, 5, 7, 8,10,12,14,16,18,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,52,54,56,58,60,62,63,\r\n\t63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,13,11,10, 8, 7, 7, 7, 7, 8,10,11,13,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,\r\n\t63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,25,23,21,19,17,16,14,12,11,10, 9, 9, 9, 9,10,11,12,14,16,17,19,21,23,25,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,\r\n\t63,62,60,58,56,54,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,24,22,20,18,17,15,14,13,12,11,11,11,11,12,13,14,15,17,18,20,22,24,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,54,56,58,60,62,63,\r\n\t63,63,61,59,57,55,53,51,49,47,45,43,41,39,37,36,34,32,30,28,26,25,23,21,20,18,17,16,14,14,13,13,13,13,14,14,16,17,18,20,21,23,25,26,28,30,32,34,36,37,39,41,43,45,47,49,51,53,55,57,59,61,63,63,\r\n\t63,63,61,59,57,55,54,52,50,48,46,44,42,40,38,36,34,33,31,29,27,26,24,23,21,20,18,17,16,16,15,15,15,15,16,16,17,18,20,21,23,24,26,27,29,31,33,34,36,38,40,42,44,46,48,50,52,54,55,57,59,61,63,63,\r\n\t63,63,62,60,58,56,54,52,50,48,46,45,43,41,39,37,35,34,32,30,29,27,25,24,23,21,20,19,18,18,17,17,17,17,18,18,19,20,21,23,24,25,27,29,30,32,34,35,37,39,41,43,45,46,48,50,52,54,56,58,60,62,63,63,\r\n\t63,63,62,61,59,57,55,53,51,49,47,45,44,42,40,38,36,35,33,31,30,28,27,25,24,23,22,21,20,19,19,19,19,19,19,20,21,22,23,24,25,27,28,30,31,33,35,36,38,40,42,44,45,47,49,51,53,55,57,59,61,62,63,63,\r\n\t63,63,63,61,59,57,56,54,52,50,48,46,44,43,41,39,38,36,34,33,31,30,28,27,26,25,24,23,22,21,21,21,21,21,21,22,23,24,25,26,27,28,30,31,33,34,36,38,39,41,43,44,46,48,50,52,54,56,57,59,61,63,63,63,\r\n\t63,63,63,62,60,58,56,54,53,51,49,47,45,44,42,40,39,37,36,34,33,31,30,29,27,26,25,25,24,23,23,23,23,23,23,24,25,25,26,27,29,30,31,33,34,36,37,39,40,42,44,45,47,49,51,53,54,56,58,60,62,63,63,63,\r\n\t63,63,63,63,61,59,57,55,54,52,50,48,47,45,43,42,40,38,37,35,34,33,31,30,29,28,27,26,26,25,25,25,25,25,25,26,26,27,28,29,30,31,33,34,35,37,38,40,42,43,45,47,48,50,52,54,55,57,59,61,63,63,63,63,\r\n\t63,63,63,63,62,60,58,56,55,53,51,49,48,46,44,43,41,40,38,37,36,34,33,32,31,30,29,28,28,27,27,27,27,27,27,28,28,29,30,31,32,33,34,36,37,38,40,41,43,44,46,48,49,51,53,55,56,58,60,62,63,63,63,63,\r\n\t63,63,63,63,63,61,59,57,56,54,52,51,49,47,46,44,43,41,40,38,37,36,35,34,33,32,31,30,30,29,29,29,29,29,29,30,30,31,32,33,34,35,36,37,38,40,41,43,44,46,47,49,51,52,54,56,57,59,61,63,63,63,63,63,\r\n\t63,63,63,63,63,62,60,58,57,55,53,52,50,49,47,45,44,43,41,40,39,38,36,35,34,34,33,32,32,31,31,31,31,31,31,32,32,33,34,34,35,36,38,39,40,41,43,44,45,47,49,50,52,53,55,57,58,60,62,63,63,63,63,63,\r\n\t63,63,63,63,63,63,61,60,58,56,55,53,51,50,48,47,45,44,43,42,40,39,38,37,36,36,35,34,34,33,33,33,33,33,33,34,34,35,36,36,37,38,39,40,42,43,44,45,47,48,50,51,53,55,56,58,60,61,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,62,61,59,57,56,54,53,51,50,48,47,46,44,43,42,41,40,39,38,37,37,36,36,35,35,35,35,35,35,36,36,37,37,38,39,40,41,42,43,44,46,47,48,50,51,53,54,56,57,59,61,62,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,62,60,59,57,56,54,53,51,50,49,47,46,45,44,43,42,41,40,39,39,38,38,37,37,37,37,37,37,38,38,39,39,40,41,42,43,44,45,46,47,49,50,51,53,54,56,57,59,60,62,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,62,60,58,57,56,54,53,51,50,49,48,47,45,44,44,43,42,41,41,40,40,39,39,39,39,39,39,40,40,41,41,42,43,44,44,45,47,48,49,50,51,53,54,56,57,58,60,62,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,61,60,58,57,56,54,53,52,51,49,48,47,46,45,45,44,43,43,42,42,41,41,41,41,41,41,42,42,43,43,44,45,45,46,47,48,49,51,52,53,54,56,57,58,60,61,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,61,60,58,57,56,55,53,52,51,50,49,48,47,46,46,45,45,44,44,43,43,43,43,43,43,44,44,45,45,46,46,47,48,49,50,51,52,53,55,56,57,58,60,61,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,61,60,59,57,56,55,54,53,52,51,50,49,48,48,47,47,46,46,45,45,45,45,45,45,46,46,47,47,48,48,49,50,51,52,53,54,55,56,57,59,60,61,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,62,60,59,58,57,56,55,54,53,52,51,50,50,49,49,48,48,48,47,47,47,47,48,48,48,49,49,50,50,51,52,53,54,55,56,57,58,59,60,62,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,58,57,56,55,54,54,53,52,52,51,51,50,50,50,49,49,49,49,50,50,50,51,51,52,52,53,54,54,55,56,57,58,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,56,56,55,54,54,53,53,52,52,52,51,51,51,51,52,52,52,53,53,54,54,55,56,56,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,57,56,55,55,54,54,54,54,53,53,53,53,54,54,54,54,55,55,56,57,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,59,58,57,57,56,56,56,56,55,55,55,55,56,56,56,56,57,57,58,59,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,61,60,59,59,58,58,58,58,57,57,57,57,58,58,58,58,59,59,60,61,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,61,61,60,60,60,60,60,59,59,60,60,60,60,60,61,61,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,62,61,61,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n\t63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,\r\n};\r\n\r\nbool CKLBSWFAsset::LoadData(u8* pData) {\r\n\t// Asset Name\r\n\tint offset = READU16P(pData);\r\n\tthis->m_pName = allocateName(pData, offset);\r\n\r\n\t// Skip Name\r\n\tpData += offset;\r\n\r\n\tthis->m_msPerFrame\t\t\t= READU16P(pData);\r\n\r\n\t//\r\n\t// Create String Constant Pool.\r\n\t//\r\n\tthis->m_uiStringCount\t\t= READU16P(pData);\r\n\tthis->m_uiTotalCharsCount\t= READU16P(pData);\r\n\r\n\tif (this->m_uiStringCount == 0xFFFF) {\r\n\t\tm_uiSoundCount\t= READU16P(pData);\r\n\t\tif (m_uiSoundCount != 0) {\r\n\t\t\tm_sounds = KLBNEWA(SSound, m_uiSoundCount);\r\n\t\t\tif (m_sounds) {\r\n\t\t\t\tmemset(m_sounds, 0, m_uiSoundCount * sizeof(SSound));\r\n\t\t\t\tfor (u32 n=0; n < m_uiSoundCount; n++) {\r\n\t\t\t\t\tm_sounds[n].nameIdx = READU16P(pData);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// Total Index Buffer\r\n\t\tm_uiIndexTotal\t= READU32P(pData);\r\n\t\tm_pIndex\t\t= KLBNEWA(u16, m_uiIndexTotal);\r\n\t\tm_uiShapeCount\t= READU16P(pData);\r\n\r\n\t\tif (m_pIndex) {\r\n\t\t\t// Shape Extension\r\n//\t\t\tm_uiShapeCount\t= READU16P(pData);  // 2012.12.19 \r\n\t\t\tm_shapes\t\t= KLBNEWA(SShape,m_uiShapeCount);\r\n\t\t\tif (m_shapes) {\r\n\t\t\t\tCKLBOGLWrapper& pMgr\t= CKLBOGLWrapper::getInstance();\r\n\r\n\t\t\t\tfor (u16 n = 0; n < m_uiShapeCount; n++) {\r\n\t\t\t\t\tm_shapes[n].texture\t\t\t= NULL;\r\n\t\t\t\t\tm_shapes[n].textureUsage\t= NULL;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (u16 n = 0; n < m_uiShapeCount; n++) {\r\n\t\t\t\t\tm_shapes[n].shapeID\t\t= READU16P(pData);\r\n\t\t\t\t\tm_shapes[n].styleCount\t= READU16P(pData);\r\n\t\t\t\t\tklb_assert(m_shapes[n].styleCount == 1, \"Multiple style not supported yet\");\r\n\t\t\t\t\tfor (int m=0; m < m_shapes[n].styleCount; m++) {\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Support only one style for now.\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\tu32 idx = READU32P(pData);\r\n\t\t\t\t\t\tm_shapes[n].indexBuffer\t= idx;\r\n\t\t\t\t\t\tm_shapes[n].indexCount\t= READU16P(pData);\r\n\r\n\t\t\t\t\t\tu32 end = idx + m_shapes[n].indexCount;\r\n\t\t\t\t\t\twhile (idx < end) {\r\n\t\t\t\t\t\t\tm_pIndex[idx++] = READU16P(pData);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tm_shapes[n].vertexCount\t= READU16P(pData);\r\n\t\t\t\t\t\tm_shapes[n].XYBuffer\t= READU32P(pData);\r\n\t\t\t\t\t\tm_shapes[n].UVBuffer\t= READU32P(pData);\r\n\r\n\t\t\t\t\t\tm_shapes[n].styleType\t= READU8P(pData);\r\n\t\t\t\t\t\tm_shapes[n].texture\t\t= NULL;\r\n\r\n\t\t\t\t\t\tCTexture* pTexture;\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\tpublic const uint TYPE_FILL_COLOR = 1;\r\n\t\t\t\t\t\t\tpublic const uint  = 2;\r\n\t\t\t\t\t\t\tpublic const uint TYPE_RADIAL_GRAD = 3;\r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\t#define TYPE_BITMAP\t\t\t\t(0)\r\n\t\t\t\t\t\t#define TYPE_FILL_COLOR\t\t\t(1)\r\n\t\t\t\t\t\t#define TYPE_LINEAR_GRAD\t\t(2)\r\n\t\t\t\t\t\t#define TYPE_RADIAL_GRAD\t\t(3)\r\n\r\n\t\t\t\t\t\tswitch (m_shapes[n].styleType) {\r\n\t\t\t\t\t\tcase TYPE_LINEAR_GRAD:\r\n\t\t\t\t\t\t\t// Linear Gradient.\r\n\t\t\t\t\t\t\tpTexture = pMgr.createTexture(\t64, 1, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGL_UNSIGNED_BYTE, CKLBOGLWrapper::RGBA, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpData, 256,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tCKLBOGLWrapper::TEX_NONE);\r\n\t\t\t\t\t\t\tpData += 256;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase TYPE_RADIAL_GRAD:\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tu32* colPtr = globalPalette;\r\n\t\t\t\t\t\t\t\tmemcpy(colPtr, pData, 64*4);\t// Make sure that colPtr is 32 bit aligned. (casting to pData is dangerous -> unaligned)\r\n\r\n\t\t\t\t\t\t\t\tconst u8*  src = ROMCircleLookup;\r\n\t\t\t\t\t\t\t\tu32* dst = globalTmpTable;\r\n\t\t\t\t\t\t\t\tu32* end = &globalTmpTable[64*64];\r\n\t\t\t\t\t\t\t\twhile (dst < end) {\r\n\t\t\t\t\t\t\t\t\t*dst++ = colPtr[*src++];\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t// Radial Gradient.\r\n\t\t\t\t\t\t\t\tpTexture = pMgr.createTexture(\t64, 64, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGL_UNSIGNED_BYTE, CKLBOGLWrapper::RGBA, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglobalTmpTable, 64*64*4,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCKLBOGLWrapper::TEX_NONE);\r\n\t\t\t\t\t\t\t\tpData += 256;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase TYPE_FILL_COLOR:\r\n\t\t\t\t\t\t\tpTexture = NULL;\r\n\t\t\t\t\t\t\tm_shapes[n].fillColor = READU32P(pData);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tcase TYPE_BITMAP:\r\n\t\t\t\t\t\t\tpTexture = NULL;\r\n\t\t\t\t\t\t\tm_shapes[n].fillColor = 0xFFFFFFFF;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (pTexture) {\r\n\t\t\t\t\t\t\tm_shapes[n].texture = pTexture;\r\n\r\n\t\t\t\t\t\t\tCTextureUsage*\tpUsage = pTexture->createUsage();\r\n\t\t\t\t\t\t\tif (pUsage) {\r\n\t\t\t\t\t\t\t\tm_shapes[n].textureUsage = pUsage;\r\n\t\t\t\t\t\t\t\tpUsage->setWrapping(CTextureUsage::CLAMP_TO_EDGE, CTextureUsage::CLAMP_TO_EDGE);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// Do nothing.\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n//\t\t\t\treturn false;   // 2012.12.19  malloc(0)でNULLを返すと(m_uiIndexTotalが0)の場合ここでfalseを返すと動かないFlashが出てくる\r\n\t\t\t}\r\n\t\t} else {\r\n//\t\t\treturn false;       // 2012.12.19  malloc(0)でNULLを返すと(m_uiIndexTotalが0)の場合ここでfalseを返すと動かないFlashが出てくる\r\n\t\t}\r\n\t\t\r\n\t\tthis->m_uiStringCount = READU16P(pData);\r\n\t}\r\n\r\n\tthis->m_aConstants  = KLBNEWA(char*,m_uiStringCount);\r\n\tthis->m_aChars      = KLBNEWA(char,m_uiTotalCharsCount + m_uiStringCount);\r\n\r\n\tthis->m_isMaster    = true;\r\n\r\n\toffset = 0;\r\n\tif (m_aConstants && m_aChars) {\r\n\t\t//\r\n\t\t// Load String Constant Pool\r\n\t\t//\r\n\t\tfor (int n=0; n < m_uiStringCount; n++) {\r\n\t\t\tthis->m_aConstants[n] = &m_aChars[offset];\t// C Style unicode string, but size is coded before as pascal style.\r\n\t\t\tu16 length = READU16P(pData);\r\n\t\t\t// m_aChars[offset++] = length;\r\n\t\t\tfor (int m = 0; m < length; m++) {\r\n\t\t\t\tm_aChars[offset++] = READU8P(pData);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Matrix Array Stream\r\n\t\t//\r\n\t\tm_uiMatrixCount = READU32P(pData);\r\n\t\tu32 floatCount  = READU32P(pData);\r\n\r\n\t\tm_aMatrixData = KLBNEWA(float,floatCount);\r\n\r\n\t\tif (m_aMatrixData) {\r\n\t\t\t//\r\n\t\t\t// Load all floats\t(Used not only for matrices, but also shape XYUV)\r\n\t\t\t//\r\n\t\t\tfor (u32 n = 0; n < floatCount; n++) {\r\n\t\t\t\tthis->m_aMatrixData[n] = READFLP(pData);\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Matrix Array Indexes.\r\n\t\t\t//\r\n\t\t\tthis->m_aMatrixType         = KLBNEWA(u8,m_uiMatrixCount);\r\n\t\t\tthis->m_aMatrixDataIndex    = KLBNEWA(u32,m_uiMatrixCount);\r\n\r\n\t\t\t// Matrix Transform Type.\r\n\t\t\tif (m_aMatrixType && m_aMatrixDataIndex) {\r\n\t\t\t\tfor (u32 n = 0; n < m_uiMatrixCount; n++) {\r\n\t\t\t\t\tthis->m_aMatrixType[n]      = READU8P(pData);\r\n\t\t\t\t\tthis->m_aMatrixDataIndex[n] = READU32P(pData);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Instruction Stream\r\n\t\t\t//\r\n\t\t\tthis->m_aStreamSize\t        = READU32P(pData);\r\n\t\t\tthis->m_aStreamInstruction  = KLBNEWA(u32,m_aStreamSize);\r\n\r\n\t\t\tif (m_aStreamInstruction) {\r\n\t\t\t\tfor (u32 n = 0; n < m_aStreamSize; n++) {\r\n\t\t\t\t\tthis->m_aStreamInstruction[n] = READU32P(pData);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Movie Stream\r\n\t\t\t\t//\r\n\t\t\t\tm_uiMovieCount = READU16P(pData);\r\n\t\t\t\tint size = m_uiMovieCount * SIZE_MOVIE_INFO;\r\n\t\t\t\tm_aMovieInfo\t= KLBNEWA(u32,size);\r\n\t\t\t\tm_aBitmapLoaded\t= KLBNEWA(CKLBImageAsset*,m_uiMovieCount);\r\n\t\t\t\tm_alistCacheEntries\t= KLBNEWA(SCacheEntry*, m_aStreamSize);\r\n\r\n\t\t\t\tif (m_aMovieInfo && m_aBitmapLoaded && m_alistCacheEntries) {\r\n\t\t\t\t\tfor (int n = 0; n < size; n++) {\r\n\t\t\t\t\t\tm_aMovieInfo[n] = READU32P(pData);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Faster than init in loop.\r\n\t\t\t\t\tmemset32(m_aBitmapLoaded,\t\t0, m_uiMovieCount * sizeof(CKLBImageAsset*  )\t);\r\n\t\t\t\t\tmemset32(m_alistCacheEntries,\t0, m_uiMovieCount * sizeof(SCacheEntry*\t\t)\t);\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Create sub movies ressource automatically.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tfor (int n = 0; n < m_uiMovieCount; n++) {\r\n\r\n\t\t\t\t\t\t// For each movie, check against name in constant pool.\r\n\t\t\t\t\t\tint idx = m_aMovieInfo[(n * SIZE_MOVIE_INFO) + CODE_NAMEINDEX];\r\n\t\t\t\t\t\tif (idx != NULL_IDX) {\r\n\t\t\t\t\t\t\tif (m_aMovieInfo[(n * SIZE_MOVIE_INFO) + CODE_FRAMECOUNT] != NULL_IDX)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\tCKLBSWFAsset* pLinkAsset = KLBNEW(CKLBSWFAsset);\r\n\t\t\t\t\t\t\t\tif (pLinkAsset) {\r\n\t\t\t\t\t\t\t\t\tpLinkAsset->m_subAssets\t\t= m_subAssets;\r\n\t\t\t\t\t\t\t\t\tm_subAssets\t\t\t\t\t= pLinkAsset;\r\n\t\t\t\t\t\t\t\t\tpLinkAsset->m_pName\t\t\t= m_aConstants[idx];\r\n\t\t\t\t\t\t\t\t\tpLinkAsset->m_refMovieID\t= (u16)n; // Direct linking.\r\n\t\t\t\t\t\t\t\t\tpLinkAsset->m_uiMovieCount\t= 0;\t// Force replace asset to skip this sub asset.\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Resolve all Audio Asset.\r\n\t\t\t\t\tIPlatformRequest& plt = CPFInterface::getInstance().platform();\r\n\t\t\t\t\tfor (u32 n = 0; n < m_uiSoundCount; n++) {\r\n\t\t\t\t\t\tm_sounds[n].handle = plt.loadAudio(m_aConstants[m_sounds[n].nameIdx], true);\r\n\t\t\t\t\t\tplt.preLoad(m_sounds[n].handle);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nu16 CKLBSWFAsset::findMovie(char* name) {\r\n\tfor (u16 n = 0; n < this->m_uiMovieCount; n++) {\r\n\t\t// For each movie, check against name in constant pool.\r\n\t\tint idx = m_aMovieInfo[(n * SIZE_MOVIE_INFO) + CODE_NAMEINDEX];\r\n\t\tif (idx != NULL_IDX) {\r\n\t\t\tif (strcmp(name, &(m_aConstants[idx][1])) == 0) { // [1] : Skip Plugin ID.\r\n\t\t\t\treturn n;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn NULL_IDX;\r\n}\r\n\r\nCKLBSWFAsset* CKLBSWFAsset::findMovieAsset(char* name) {\r\n\tklb_assert(m_isMaster, \"Can not using findMovieAsset on a sub asset\");\r\n\t// OPTIMIZE : registration could register VALID name before EMPTY NAME to fasten up search (2 pass register)\r\n\tCKLBSWFAsset* pLinkAsset = m_subAssets;\r\n\twhile (pLinkAsset) {\r\n\t\tif (strcmp(name, pLinkAsset->m_pName) == 0) {\r\n\t\t\treturn pLinkAsset;\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBSWFAsset::setVolumeSE(float volume) {\r\n\tif (m_sounds) {\r\n\t\tfor (u32 n = 0; n< this->m_uiSoundCount; n++) {\r\n\t\t\tCPFInterface::getInstance().platform().setAudioVolume(m_sounds[n].handle, volume);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nstatic char* copyStr(const char* str) {\r\n\tu32 len = strlen(str);\r\n\tchar* buff = KLBNEWA(char, len+1);\r\n\tmemcpy(buff, str, len + 1);\r\n\treturn buff;\r\n}\r\n\r\ns8 CKLBSWFMovie::replaceAsTemplate(const char** pArrayString, u32 entryCount) {\r\n\tu32 stringCount = entryCount << 1;\r\n\tu32 movieCount\t= this->m_player->m_uiMovieCount;\r\n\ts8  res         = 0;\r\n\tfreeTables();\r\n\r\n\tm_aBitmapLoaded = KLBNEWA(CKLBImageAsset*, movieCount);\r\n\tm_convTable\t\t= KLBNEWA(s32, movieCount);\r\n\tm_nameTable\t\t= KLBNEWA(const char*, movieCount);\r\n\r\n\tif (m_aBitmapLoaded && m_convTable && m_nameTable) {\r\n\t\tfor (u32 n = 0; n < movieCount; n++) {\r\n\t\t\tm_convTable[n]\t\t= -1;\t// Unmapped\r\n\t\t\tm_nameTable[n]\t\t= NULL;\r\n\t\t\tm_aBitmapLoaded[n]\t= NULL;\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < movieCount; n++) {\r\n\t\t\tint cteId = m_player->m_aMovieInfo[ (n * SIZE_MOVIE_INFO) + CODE_NAMEINDEX];\r\n\t\t\tif (cteId != 0xFFFF) {\r\n\t\t\t\tchar* origStr = &m_player->m_aConstants[cteId][1];\r\n\t\t\t\tfor (u32 m = 0; m < stringCount; m += 2) {\r\n\t\t\t\t\tif (CKLBUtility::safe_strcmp(origStr,pArrayString[m])==0) {\r\n\t\t\t\t\t\tm_nameTable[n] = copyStr(pArrayString[m+1]);\r\n\t\t\t\t\t\tif (m_nameTable[n]) {\t// Protect in case of allocation failure.\r\n\t\t\t\t\t\t\tm_convTable[n] = 0;\r\n\t\t\t\t\t\t\tres++;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tklb_assertAlways(\"Allocation Failure\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tres = -1;\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\nu32 CKLBSWFAsset::getResourceList(u32 arraySize, const char** arrayOfString) {\r\n\tu32 res     = 0;\r\n\tu32 fill    = 0;\r\n\r\n\tfor (int n=0; n < this->m_uiMovieCount; n++) {\r\n\t\tint cteId = m_aMovieInfo[ (n * SIZE_MOVIE_INFO) + CODE_NAMEINDEX];\r\n\t\tif (cteId != NULL_IDX) {\r\n\t\t\tconst char* name;\r\n\t\t\tname = &(m_aConstants[cteId][1]);\r\n\t\t\tif (fill < arraySize) {\r\n\t\t\t\tarrayOfString[fill++] = name;\r\n\t\t\t}\r\n\t\t\tres++;\r\n\t\t}\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nCKLBImageAsset* CKLBSWFMovie::getImage(u16 movieID) {\r\n\tCKLBImageAsset** pBmpLoaded = m_aBitmapLoaded;\r\n\tif (pBmpLoaded == NULL) {\r\n\t\tpBmpLoaded = m_player->m_aBitmapLoaded;\r\n\t}\r\n\t\r\n\tif (pBmpLoaded[movieID] == NULL) {\r\n\t\tint cteId = m_player->m_aMovieInfo[ (movieID * SIZE_MOVIE_INFO) + CODE_NAMEINDEX];\r\n\t\tif (cteId != NULL_IDX) {\r\n\t\t\tCKLBAssetManager& pAssetMgr = CKLBAssetManager::getInstance();\r\n\t\t\tconst char* name;\r\n\t\t\t\r\n\t\t\ts32 offX = 0;\r\n\t\t\ts32 offY = 0;\r\n\r\n\t\t\tbool replace;\r\n\r\n\t\t\tconst char* origName = &(m_player->m_aConstants[cteId][1]);\r\n\t\t\tif (m_convTable && (m_convTable[movieID] != -1)) {\r\n\t\t\t\tname = m_nameTable[movieID];\r\n\t\t\t\tif (name == NULL) {\r\n\t\t\t\t\tname = origName;\r\n\t\t\t\t\treplace = false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Original Texture & Image -> Center coordinate.\r\n\t\t\t\t\t// If the original filename starts with a percent,\r\n\t\t\t\t\t// that means it's a template image that does not\r\n\t\t\t\t\t// exist on disk.\r\n\t\t\t\t\tif (origName[0] != '%') {\r\n\t\t\t\t\t\tu16 assetID = pAssetMgr.getAssetIDFromName(origName ,m_player->m_aConstants[cteId][0]); // char 0 = 'I'\r\n\t\t\t\t\t\tCKLBAbstractAsset* pAsset = pAssetMgr.getAsset(assetID);\r\n\t\t\t\t\t\tif (pAsset) {\r\n\t\t\t\t\t\t\tCKLBImageAsset* pImgOrig = ((CKLBTextureAsset*)pAsset)->getImage(origName);\r\n\t\t\t\t\t\t\tpImgOrig->getCenter(offX, offY);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\treplace = true;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tname    = &(m_player->m_aConstants[cteId][1]);\r\n\t\t\t\treplace = false;\r\n\t\t\t}\r\n\r\n\t\t\tu16 assetID = pAssetMgr.getAssetIDFromName(name,m_player->m_aConstants[cteId][0]); // char 0 = 'I'\r\n\t\t\tCKLBAbstractAsset* pAsset = pAssetMgr.getAsset(assetID);\r\n\t\t\tif (pAsset) {\r\n\t\t\t\tif (pAsset->getAssetType() == ASSET_TEXTURE) {\r\n\t\t\t\t\tCKLBImageAsset* pImgUsed = ((CKLBTextureAsset*)pAsset)->getImage(name);\r\n\t\t\t\t\tif (!replace) {\r\n\t\t\t\t\t\tpImgUsed->getCenter(offX, offY);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpBmpLoaded[movieID] = pImgUsed->getAsTopLeftImage(offX, offY);\r\n\t\t\t\t\tif (pBmpLoaded[movieID]) {\r\n\t\t\t\t\t\tpBmpLoaded[movieID]->getTexture()->incrementRefCount();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tklb_assertAlways( \"invalid resource type\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tDEBUG_PRINT(\"[Flash] Asset %s not found !!!!!\", name);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn pBmpLoaded[movieID];\r\n}\r\n\r\nCKLBNode* CKLBSWFAsset::addMovieA(char* name, u16 layer, SMatrix2D* m, CKLBNode* root, const char** templateTable, u32 pairCount) {\r\n\tu16 index;\r\n\tif (name == NULL) {\r\n\t\tindex = this->m_uiMovieCount-1;\r\n\t} else {\r\n\t\tindex = findMovie(name);\r\n\t}\r\n\r\n\tCKLBNode* newMovie = NULL;\r\n\tif (index != NULL_IDX) {\r\n\t\tnewMovie = addMovieB(index, layer, m, root, templateTable, pairCount);\t// Only called from UI SWF Player.\r\n\t}\r\n\treturn newMovie;\r\n}\r\n\r\nCKLBNode* CKLBSWFAsset::addMovieB(u16 movieID, u16 layer, SMatrix2D* m, CKLBNode* root, const char** convTable, u32 convCount) {\r\n\tCKLBNode* newMovie = NULL; // Fail by default.\r\n\tint movieIndex = movieID * SIZE_MOVIE_INFO;\r\n\tint type = m_aMovieInfo[ movieIndex + CODE_FRAMECOUNT];\r\n\r\n\tif (type < 32768) {\r\n\t\tCKLBSWFMovie* lMovie = KLBNEWC(CKLBSWFMovie,(this, root, layer));\r\n\r\n\t\tif (lMovie) {\r\n\t\t\t// Propagate link to top node (MUST BE SET JUST AFTER CONSTRUCTION)\r\n\t\t\tif (root) {\r\n\t\t\t\tlMovie->m_flashRoot = ((CKLBSWFMovie*)root)->m_flashRoot;\r\n\t\t\t} else {\r\n\t\t\t\tlMovie->setFlashRoot();\r\n\t\t\t}\r\n\r\n\t\t\tlMovie->m_movieStartCode= m_aMovieInfo[ movieIndex + CODE_STARTINDEX];\r\n\t\t\tlMovie->m_movieEndCode\t= m_aMovieInfo[ movieIndex + CODE_ENDINDEX];\r\n\t\t\tlMovie->m_movieCode\t\t= lMovie->m_movieStartCode + SKIP_SHOW; // Skip custom show frame \"0\"\r\n\t\t\tlMovie->m_uiFrame\t\t= 1;\r\n\t\t\tlMovie->m_isPlaying\t\t\t= PLAYING;\r\n\t\t\tlMovie->m_isPlayingBackup\t= PLAYING;\r\n\t\t\tlMovie->m_msPerFrame\t= m_msPerFrame;\r\n\r\n\t\t\tif (convTable) {\r\n\t\t\t\tlMovie->replaceAsTemplate(convTable, convCount);\r\n\t\t\t}\r\n\r\n\t\t\t// Force execution first frame.\r\n\t\t\tlMovie->nextFrame(1);\r\n\r\n\r\n\t\t}\r\n\r\n\t\tnewMovie = lMovie;\r\n\t} else {\r\n\t\t// 0xFFFF\r\n\t\tif (type == NULL_IDX) {\r\n\t\t\tCKLBImageAsset* pImg = ((CKLBSWFMovie*)root)->m_flashRoot->getImage(movieID);\r\n\t\t\tif (pImg) {\r\n\t\t\t\tCKLBSprite* pSpr;\r\n\r\n\t\t\t\ts32 ioffX\t\t= (s16)m_aMovieInfo[movieIndex + CODE_OFFSETX];\r\n\t\t\t\ts32 ioffY\t\t= (s16)m_aMovieInfo[movieIndex + CODE_OFFSETY];\r\n\r\n\t\t\t\t// Any value different from 0.\r\n\t\t\t\tif (ioffX || ioffY) {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Include offset in dynamic sprite.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tCKLBDynSprite* pSprite = CKLBRenderingManager::getInstance().allocateCommandDynSprite(pImg->getVertexCount(), pImg->getIndexCount());\r\n\r\n\t\t\t\t\t// Assign texture reference.\r\n\t\t\t\t\tpSprite->setTexture(pImg->getTexture()->m_pTextureUsage);\r\n\r\n\t\t\t\t\t// Copy UV.\r\n\t\t\t\t\tmemcpy(pSprite->getSrcUVBuffer(),pImg->getUVBuffer(), pImg->getVertexCount() * 2 * sizeof(float));\r\n\r\n\t\t\t\t\t// Copy Indexes.\r\n\t\t\t\t\tu16* pIdx = pSprite->getSrcIndexBuffer();\r\n\t\t\t\t\tmemcpy(pSprite->getSrcIndexBuffer(), pImg->getIndexBuffer(), pImg->getIndexCount() * sizeof(u16));\r\n\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Add translation directly in sprite information, avoiding intermediate nodes.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tfloat* coords\t= pSprite->getSrcXYBuffer();\r\n\t\t\t\t\tfloat offX\t\t= (float)((s16)m_aMovieInfo[movieIndex + CODE_OFFSETX]);\r\n\t\t\t\t\tfloat offY\t\t= (float)((s16)m_aMovieInfo[movieIndex + CODE_OFFSETY]);\r\n\t\t\t\t\tfloat* srcXY\t= pImg->getXYBuffer();\r\n\r\n\t\t\t\t\tfor (u32 n=0; n < pImg->getVertexCount(); n++) {\r\n\t\t\t\t\t\t*coords++ = *srcXY++ + offX;\r\n\t\t\t\t\t\t*coords++ = *srcXY++ + offY;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpSpr = pSprite;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpSpr = CKLBRenderingManager::getInstance().allocateCommandSprite(pImg);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBNode* pMovie\t= KLBNEW(CKLBNode);\r\n\t\t\t\tif (pMovie) {\r\n\t\t\t\t\tpMovie->setRender(pSpr);\r\n\t\t\t\t\tpMovie->setRenderOnDestroy(true);\r\n\t\t\t\t\tnewMovie = pMovie;\r\n\r\n\t\t\t\t\troot->addNode(pMovie, layer);\r\n\r\n\t\t\t\t\tpMovie->markUpMatrix();\r\n\r\n\t\t\t\t\t// Force top node to refresh.\r\n\t\t\t\t\t// OPTIMIZE : replacement from to another image could be done, no need to mark rebuild.\r\n\t\t\t\t\t((CKLBSWFMovie*)root)->m_flashRoot->m_rebuildSort = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// 0x8xxx : Shape\t(4096 shape max)\r\n\t\t\tif ((type & 0xF000) == 0x8000) {\r\n\t\t\t\tSShape* pShp = &m_shapes[type & 0xFFF];\r\n\t\t\t\tif (pShp) {\r\n\t\t\t\t\tCKLBNode* pMovie\t= KLBNEW(CKLBNode);\r\n\t\t\t\t\tCKLBDynSprite*\tpSprite = CKLBRenderingManager::getInstance().allocateCommandDynSprite(pShp->vertexCount, pShp->indexCount);\r\n\t\t\t\t\tif (pSprite && pMovie) {\r\n\t\t\t\t\t\troot->addNode(pMovie,layer);\r\n\t\t\t\t\t\tpMovie->setRenderOnDestroy(true);\r\n\r\n\t\t\t\t\t\t// Transfer Index Buffer\r\n\t\t\t\t\t\tu16* dst = pSprite->getSrcIndexBuffer();\r\n\t\t\t\t\t\tmemcpy(dst,&m_pIndex[pShp->indexBuffer],pShp->indexCount * sizeof(u16));\r\n\t\t\t\t\t\t// Transfer XY Coordinate\r\n\t\t\t\t\t\tmemcpy(pSprite->getSrcXYBuffer(), &m_aMatrixData[pShp->XYBuffer], pShp->vertexCount * 2 * sizeof(float));\r\n\t\t\t\t\t\t// Transfer UV Coordinate\r\n\t\t\t\t\t\tmemcpy(pSprite->getSrcUVBuffer(), &m_aMatrixData[pShp->UVBuffer], pShp->vertexCount * 2 * sizeof(float));\r\n\t\t\t\t\t\tpMovie->setRender(pSprite);\r\n\t\t\t\t\t\tpSprite->setTexture(pShp->textureUsage); // Use CTextureUsage directly !\r\n\t\t\t\t\t\tif (pShp->styleType == TYPE_FILL_COLOR) {\r\n\t\t\t\t\t\t\t// Optimize u32 -> float -> u32 color conv.\r\n\t\t\t\t\t\t\tu8* pCol = (u8*)&pShp->fillColor;\r\n\t\t\t\t\t\t\tfloat vec4[4];\r\n\t\t\t\t\t\t\tvec4[0]\t= (pCol[0] / 255.0f);\r\n\t\t\t\t\t\t\tvec4[1]\t= (pCol[1] / 255.0f);\r\n\t\t\t\t\t\t\tvec4[2]\t= (pCol[2] / 255.0f);\r\n\t\t\t\t\t\t\tvec4[3]\t= (pCol[3] / 255.0f);\r\n\r\n\t\t\t\t\t\t\tpSprite->setColor(vec4);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpSprite->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY);\r\n\t\t\t\t\t\t((CKLBSWFMovie*)root)->m_flashRoot->m_rebuildSort = true;\r\n\t\t\t\t\t\tnewMovie = pMovie;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tklb_assertAlways(\"Flash content refer to a shape undefined : most likely bitmap used directly without movie clip.\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t}\r\n\t\t// 0xFFFE : End Clip.\r\n\t\t\t//\r\n\t\t\t// Support other type of shape : End Clip / Shape\r\n\t\t\t//\r\n\t\t}\r\n\t}\r\n\r\n\tif (newMovie != NULL) {\r\n\t\tnewMovie->m_movieID = movieID;\r\n\t\tif (m != NULL) {\r\n\t\t\tfor (int n = 0; n < 5; n++) {\r\n\t\t\t\tnewMovie->m_matrix.m_matrix[n] = m->m_matrix[n];    // copy Array\r\n            }\r\n\t\t\tnewMovie->m_matrix.m_type = m->m_type;                  // copy type.\r\n\t\t\tnewMovie->markUpMatrix();\r\n\t\t}\r\n\r\n\t\t// Node added at construction already.\r\n\t\t\r\n\t\tnewMovie->m_useParentColor\t= true;\r\n\t}\r\n\treturn newMovie;\r\n}\r\n\r\nCKLBNode* CKLBSWFAsset::createSubTree(u32 priorityBase) {\r\n\tCKLBSWFMovie* pMov;\r\n\tif (this->m_parentSWF) {\r\n\t\t// Submovies.\r\n\t\tpMov = (CKLBSWFMovie*)m_parentSWF->addMovieB(this->m_refMovieID, 0, NULL, NULL, NULL, 0);\r\n\t} else {\r\n\t\t// Main timeline.\r\n\t\tpMov = (CKLBSWFMovie*)addMovieB(this->m_uiMovieCount-1, 0, NULL, NULL, NULL, 0);\r\n\t}\r\n\tif (pMov) { pMov->setPriority(priorityBase); }\r\n\treturn pMov;\r\n}\r\n\r\n// ##########################################\r\n//\r\n// --- Instance ---\r\n//\r\n// ##########################################\r\n\r\nCKLBSWFMovie::CKLBSWFMovie(CKLBSWFAsset* pPlayer, CKLBNode* pParent, u16 layer)\r\n: CKLBNode          ()\r\n, m_player          (pPlayer)\r\n, m_movieStartCode  (NULL_IDX)\r\n, m_movieCode       (NULL_IDX)\r\n, m_movieEndCode    (NULL_IDX)\r\n, m_uiFrame         (0)\r\n, m_localTime       (0)\r\n, m_renderOffset    (0)\r\n, m_isPlaying       (false)\r\n, m_firstFrame      (true)\r\n, m_updateFrame     (0)\r\n, m_isFlashRoot     (false)\r\n, m_flashRoot       (NULL)\r\n, m_rebuildSort     (true)\r\n, m_disableJump     (false)\r\n, m_aBitmapLoaded   (NULL)\r\n, m_convTable       (NULL)\r\n, m_nameTable       (NULL)\r\n, m_playMode        (true)\r\n, m_volume          (1.0f)\r\n, m_supportCaching\t(false)\r\n{\r\n\t// Is animated by factory design BEFORE ANY OPERATION.\r\n\tthis->m_status |= ANIMATED;\r\n\r\n\tCKLBSystem::addToAnimation(this);\r\n\r\n\t// Add to the scene graph tree.\r\n\tif (pParent != NULL) {\r\n\t\tpParent->addNode(this,layer);\r\n\t}\r\n}\r\n\r\nCKLBSWFMovie::~CKLBSWFMovie() {\r\n\tfreeTables();\r\n}\r\n\r\nvoid CKLBSWFMovie::freeTables() {\r\n\tif (m_aBitmapLoaded) {\r\n\t\tfor (u32 n = 0; n < m_player->m_uiMovieCount; n++) {\r\n\t\t\tif (m_aBitmapLoaded[n]) {\r\n\t\t\t\tm_aBitmapLoaded[n]->getTexture()->decrementRefCount();\r\n\t\t\t\tm_aBitmapLoaded[n] = NULL;\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(m_aBitmapLoaded);\r\n\t\tm_aBitmapLoaded = NULL;\r\n\t}\r\n\r\n\r\n\tif (m_convTable) {\r\n\t\tKLBDELETEA(m_convTable);\r\n\t\tm_convTable = NULL;\r\n\t}\r\n\r\n\tif (m_nameTable) {\r\n\t\tfor (u32 n = 0; n < m_player->m_uiMovieCount; n++) {\r\n\t\t\tKLBDELETEA(m_nameTable[n]);\r\n\t\t}\r\n\t\tKLBDELETEA(m_nameTable);\r\n\t\tm_nameTable = NULL;\r\n\t}\r\n}\r\n\r\nvoid CKLBSWFMovie::setVolumeSE(float volume) {\r\n\tm_volume = volume;\r\n\tm_player->setVolumeSE(volume);\r\n}\r\n\r\nvoid CKLBSWFMovie::setFlashRoot() {\r\n\tm_isFlashRoot\t= true;\r\n\tm_flashRoot\t\t= this;\r\n\tm_rebuildSort\t= true;\t\t\r\n}\r\n\r\nvoid CKLBSWFMovie::gotoFrame(u16 frame) {\r\n\tif (frame != NULL_IDX) {\r\n\t\t// m_movieCode = this->findCodeFrame(frame);\r\n\t\tm_disableJump = true;\r\n\r\n\r\n\t\t// Reset any stop instruction from the flash player state.\r\n\t\t// If player is still active : force to play\r\n\t\tif (m_playMode) {\r\n\t\t\tm_isPlaying = PLAYING;\r\n\t\t} else {\r\n\t\t// If player is inactive : force to play when the play() function is called.\r\n\t\t\tm_isPlayingBackup = PLAYING;\r\n\t\t}\r\n\r\n\t\tnextFrame(frame);\r\n\t\tm_disableJump = false;\r\n\t}\r\n}\r\n\r\nu16 CKLBSWFMovie::findCodeFrame(char* label, u16* pFrameNum) {\r\n\tu16 uiFrame     = 0;\r\n\tu32 movieCode   = m_movieStartCode;\r\n\r\n\tif (label) {\r\n\t\t//\r\n\t\t// \r\n\t\t// search failure return start frame : always a valid frame => Avoid a lot of test within the player runtime.\r\n\t\t//\r\n\t\twhile (movieCode < m_movieEndCode) {\r\n\t\t\tu16 val = m_player->m_aStreamInstruction[movieCode++];\r\n\t\t\tswitch (val) {\r\n\t\t\tcase SHOW_FRAME:\r\n\t\t\t\t{\r\n\t\t\t\t\tu16 lblIdx = m_player->m_aStreamInstruction[movieCode++]; // Label\r\n\t\t\t\t\tif (lblIdx != NULL_IDX) {\r\n\t\t\t\t\t\tif (CKLBUtility::safe_strcmp(this->m_player->m_aConstants[lblIdx], label) == 0) {\r\n\t\t\t\t\t\t\tif (pFrameNum) {\r\n\t\t\t\t\t\t\t\t*pFrameNum = uiFrame + 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn movieCode-2;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tmovieCode++;\r\n\t\t\t\tmovieCode++;\r\n\t\t\t\t\r\n\t\t\t\tuiFrame++;\r\n\r\n\t\t\t\tbreak;\r\n\t\t\tcase PLACE_OBJECT_CLIP:\r\n\t\t\t\t{\r\n\t\t\t\t\tmovieCode += 5;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase PLACE_OBJECT:\r\n\t\t\t\t{\r\n\t\t\t\t\tmovieCode += 4;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase REMOVE_OBJECT:\r\n\t\t\tcase PLAY_SOUND:\r\n\t\t\t\t{\r\n\t\t\t\t\tmovieCode++;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tif (val & 0x8000) {\r\n\t\t\t\t\tklb_assertAlways(\"Future Extension Invalid code\");\r\n\t\t\t\t\tif (val & 0x4000) {\r\n\t\t\t\t\t\tmovieCode += ((val >> 4) & 0x1F);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Do nothing : remove encode everything.\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tklb_assertAlways(\"Invalid code\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tklb_assertAlways( \"empty label search\");\r\n\t}\r\n\r\n\tif (pFrameNum) {\r\n\t\t*pFrameNum = NULL_IDX;\r\n\t}\r\n\treturn NULL_IDX;\r\n}\r\n\r\nu16 CKLBSWFMovie::findCodeFrame(u16 frame) {\r\n\tu16 uiFrame\t    = 0;\r\n\tu32 movieCode   = m_movieStartCode;\r\n\r\n\t//\r\n\t// \r\n\t// search failure return start frame : always a valid frame => Avoid a lot of test within the player runtime.\r\n\t//\r\n\twhile (uiFrame != frame) {\r\n\t\tif (movieCode < m_movieEndCode) {\r\n\t\t\tu16 val = m_player->m_aStreamInstruction[movieCode++];\r\n\t\t\tswitch (val) {\r\n\t\t\tcase SHOW_FRAME:\r\n\t\t\t\tmovieCode++;\t// Skip label\r\n\t\t\t\tmovieCode++;\r\n\t\t\t\tmovieCode++;\r\n\t\t\t\t\r\n\t\t\t\tuiFrame++;\r\n\r\n\t\t\t\tbreak;\r\n\t\t\tcase PLACE_OBJECT_CLIP:\r\n\t\t\t\t{\r\n\t\t\t\t\tmovieCode += 5;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase PLACE_OBJECT:\r\n\t\t\t\t{\r\n\t\t\t\t\tmovieCode += 4;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase REMOVE_OBJECT:\r\n\t\t\tcase PLAY_SOUND:\r\n\t\t\t\t{\r\n\t\t\t\t\tmovieCode++;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tif (val & 0x8000) {\r\n\t\t\t\t\tklb_assertAlways(\"Future Extension Invalid code\");\r\n\t\t\t\t\tif (val & 0x4000) {\r\n\t\t\t\t\t\tmovieCode += ((val >> 4) & 0x1F);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Do nothing : remove encode everything.\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tklb_assertAlways(\"Invalid code\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn m_movieStartCode + 4;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn movieCode - 4;\r\n}\r\n\r\n// Normal mode\r\n#define SWF_NORMAL\t\t\t(0)\r\n// Delay of one frame the object destruction (set m_firstFrame)\r\n#define SWF_GOTO_AND_PLAY\t(1)\r\n\r\nvoid CKLBSWFMovie::InitBits(void)\r\n{\r\n\t// Reset the bit position and buffer.\r\n\tm_bitPos = 0;\r\n\tm_bitBuf = 0;\r\n}\r\n\r\ns32 CKLBSWFMovie::GetSBits(s32 n)\r\n// Get n bits from the string with sign extension.\r\n{\r\n\t// Get the number as an unsigned value.\r\n\ts32 v = (s32) GetBits(n);\r\n\r\n\t// Is the number negative?\r\n\tif (v & (1L << (n - 1)))\r\n\t{\r\n\t\t// Yes. Extend the sign.\r\n\t\tv |= -1L << n;\r\n\t}\r\n\r\n\treturn v;\r\n}\r\n\r\nu32 CKLBSWFMovie::GetBits (s32 n)\r\n// Get n bits from the stream.\r\n{\r\n\tu32 v = 0;\r\n\r\n\twhile (true)\r\n\t{\r\n\t\ts32 s = n - m_bitPos;\r\n\t\tif (s > 0)\r\n\t\t{\r\n\t\t\t// Consume the entire buffer\r\n\t\t\tv |= m_bitBuf << s;\r\n\t\t\tn -= m_bitPos;\r\n\r\n\t\t\t// Get the next buffer\r\n\t\t\tm_bitBuf = m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\tm_bitPos = 16;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Consume a portion of the buffer\r\n\t\t\tv |= m_bitBuf >> -s;\r\n\t\t\tm_bitPos -= n;\r\n\t\t\tm_bitBuf &= 0xffff >> (16 - m_bitPos); // mask off the consumed bits\r\n\r\n\t\t\treturn v;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBSWFAsset::cacheSceneGraph(CKLBSWFMovie* node, u16 frame) {\r\n\tu16 movieID = node->m_movieID;\r\n\r\n\tif (hasCache(node, frame) == false) {\r\n\t\t// Add new entry.\r\n\t\tSCacheEntry* pNewEntry = KLBNEW(SCacheEntry);\r\n\t\tif (pNewEntry) {\r\n\t\t\tpNewEntry->m_next\t\t= m_alistCacheEntries[movieID];\r\n\t\t\tpNewEntry->m_cacheFrame\t= frame;\r\n\t\t\tm_alistCacheEntries[movieID] = pNewEntry;\r\n\r\n\t\t\t// Copy\r\n\t\t\tpNewEntry->m_cacheNode = (CKLBSWFMovie*)node->clone(NULL, NULL, NULL, true);\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t// Original\r\n\t\tnode->dump(0,0xFFFFFFFF);\r\n\t\t// Copy\r\n\t\tm_alistCacheEntries[movieID]->m_cacheNode->dump(0,0xFFFFFFFF);\r\n\t\t*/\r\n\t} // else already cached.\r\n}\r\n\r\n\r\nbool CKLBSWFAsset::hasCache(CKLBSWFMovie* node, u16 frame) {\r\n\tu16 movieID = node->m_movieID;\r\n\t\r\n\tSCacheEntry* pEntries = m_alistCacheEntries[movieID];\r\n\twhile (pEntries) {\r\n\t\tif (pEntries->m_cacheFrame == frame) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tpEntries = pEntries->m_next;\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nvoid CKLBSWFAsset::restoreSceneGraph(CKLBSWFMovie* node, u16 frame) {\r\n\tu16 movieID = node->m_movieID;\r\n\r\n\tSCacheEntry* pEntries = m_alistCacheEntries[movieID];\r\n\twhile (pEntries) {\r\n\t\tif (pEntries->m_cacheFrame == frame) {\r\n\t\t\t// CKLBNode* parent = node->getParent();\r\n\t\t\tCKLBNode* pNewTree = (CKLBSWFMovie*)pEntries->m_cacheNode->clone(NULL, NULL, NULL, false);\r\n\r\n\t\t\t// Remove old child and destroy\r\n\t\t\tCKLBNode* pChildren = node->getChild();\r\n\t\t\twhile (pChildren) {\r\n\t\t\t\tCKLBNode* pNextChild = pChildren->getBrother();\r\n\t\t\t\tnode->removeNode(pChildren);\r\n\t\t\t\tKLBDELETE(pChildren);\t\t// removeNode happens automatically.\r\n\t\t\t\tpChildren = pNextChild;\r\n\t\t\t}\r\n\r\n\t\t\t// Add each child\r\n\t\t\tpChildren = pNewTree->getChild();\r\n\t\t\twhile (pChildren) {\r\n\t\t\t\tCKLBNode* pNextChild = pChildren->getBrother();\r\n\t\t\t\tpNewTree->removeNode(pChildren);\r\n\t\t\t\tnode->addNode(pChildren,pChildren->getLayer());\r\n\t\t\t\tpChildren = pNextChild;\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t//\r\n\t\t\t//\r\n\r\n\t\t\t// Destroy cloned pNewTree emptied.\r\n\t\t\tCKLBSWFMovie* newMovie = (CKLBSWFMovie*)pNewTree;\r\n\t\t\tnode->m_flashRoot\t\t=\tnewMovie->m_flashRoot;\r\n\t\t\tnode->m_volume\t\t\t=\tnewMovie->m_volume;\r\n\t\t\tnode->m_renderOffset\t=\tnewMovie->m_renderOffset;\r\n\t\t\tnode->m_localTime\t\t=\tnewMovie->m_localTime;\r\n\t\t\tnode->m_movieStartCode\t=\tnewMovie->m_movieStartCode;\r\n\t\t\tnode->m_movieCode\t\t=\tnewMovie->m_movieCode;\r\n\t\t\tnode->m_movieEndCode\t=\tnewMovie->m_movieEndCode;\r\n\t\t\tnode->m_uiFrame\t\t\t=\tnewMovie->m_uiFrame;\r\n\t\t\tnode->m_msPerFrame\t\t=\tnewMovie->m_msPerFrame;\r\n\t\t\tnode->m_updateFrame\t\t=\tnewMovie->m_updateFrame;\r\n\t\t\tnode->m_isPlaying\t\t=\tnewMovie->m_isPlaying;\r\n\t\t\tnode->m_isPlayingBackup =\tnewMovie->m_isPlayingBackup;\r\n\r\n\t\t\tKLBDELETE(pNewTree);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpEntries = pEntries->m_next;\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nCKLBNode* CKLBSWFMovie::clone(CKLBNode* newItem, CKLBNode* parent, CKLBNode* brother, bool transferSpriteOwnership) {\r\n\tif (newItem == NULL) {\r\n\t\tnewItem = KLBNEWC(CKLBSWFMovie,(this->m_player, parent, this->m_layer));\r\n\t}\r\n\r\n\tif (newItem != NULL) {\r\n\t\t// We want the clone template to stay NON animated.\r\n\t\tif (transferSpriteOwnership) {\r\n\t\t\tCKLBSystem::removeFromAnimation(newItem);\r\n\t\t}\r\n\r\n\t\tCKLBNode::clone(newItem, parent, brother, transferSpriteOwnership);\r\n\r\n\t\tCKLBSWFMovie* newMovie = (CKLBSWFMovie*)newItem;\r\n\r\n\t\tnewMovie->m_flashRoot\t\t= m_flashRoot;\r\n\t\tnewMovie->m_volume\t\t\t= m_volume;\r\n\t\tnewMovie->m_renderOffset\t= m_renderOffset;\r\n\t\tnewMovie->m_localTime\t\t= m_localTime;\r\n\t\tnewMovie->m_movieStartCode\t= m_movieStartCode;\r\n\t\tnewMovie->m_movieCode\t\t= m_movieCode;\r\n\t\tnewMovie->m_movieEndCode\t= m_movieEndCode;\r\n\t\tnewMovie->m_uiFrame\t\t\t= m_uiFrame;\r\n\t\tnewMovie->m_msPerFrame\t\t= m_msPerFrame;\r\n\t\tnewMovie->m_updateFrame\t\t= m_updateFrame;\r\n\t\tnewMovie->m_isPlaying\t\t= m_isPlaying;\r\n\t\tnewMovie->m_isPlayingBackup = m_isPlayingBackup;\r\n\r\n\t\t// Flash root is the only one to own the arrays\r\n\t\t// And flash root is never going to be destroyed.\r\n\t\t// newMovie->m_aBitmapLoaded\t= m_aBitmapLoaded;\r\n\t\t// newMovie->m_convTable\t\t= m_convTable;\r\n\t\t// newMovie->m_nameTable\t\t= m_nameTable;\r\n\r\n\t\tnewMovie->m_firstFrame\t\t= m_firstFrame;\r\n\t\tnewMovie->m_rebuildSort\t\t= m_rebuildSort;\r\n\t\t// False always.\r\n\t\t// newMovie->m_isFlashRoot\t\t= m_isFlashRoot;\r\n\t\tnewMovie->m_disableJump\t\t= false;\r\n\t\tnewMovie->m_playMode\t\t= m_playMode;\r\n\t}\r\n\r\n\treturn newItem;\r\n}\r\n\r\nvoid CKLBSWFMovie::nextFrame(u16 frame) {\r\n\tint mode = SWF_NORMAL;\r\n\tif (m_isPlaying != STOPPED) {\r\n\t\tif ((frame < this->m_uiFrame) || (m_uiFrame == NULL_IDX)) {\t// May be able to optimize condition.\r\n\t\t\tm_uiFrame = 1;\r\n\t\t\t// clearSubTree();\r\n\t\t\tm_movieCode = this->m_movieStartCode + SKIP_SHOW;\r\n\t\t\tm_firstFrame = true;\r\n\t\t}\r\n\r\n\t\t// Just next frame\r\n\t\tif (frame == NULL_IDX) {\r\n\t\t\tframe = m_uiFrame+1;\r\n\t\t} else {\r\n\t\t\tframe++; // = Exit when we reach the beginning of the NEXT FRAME.\r\n\t\t}\r\n\r\n\t\tu16 lblCode = NULL_IDX;\r\n\r\n\t\twhile (m_uiFrame < frame) {\r\nnextInstruction:\r\n\t\t\tu16 val = m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\tif (val & 0x8000) {\t\t\t\t\t\t\t\t// Bit 15\r\n\t\t\t\tklb_assertAlways(\"Future Extension Invalid code\");\r\n\t\t\t\tif (val & 0x4000) {\t\t\t\t\t\t\t// Bit 14\r\n\t\t\t\t\t// 8..4\r\n\r\n\t\t\t\t\tInitBits();\r\n\t\t\t\r\n\t\t\t\t\tbool has8BitLayer\t= (val & 0x0002) != 0;\t\t// Bit  1\r\n\t\t\t\t\tu32 layer = GetBits((has8BitLayer) ? 8 : 16);\r\n\r\n\t\t\t\t\tCKLBNode* movie;\r\n\t\t\t\t\tmovie = getNode(layer);\r\n\t\t\t\r\n\t\t\t\t\t// \r\n\t\t\t\t\tbool hasObject\t\t= (val & 0x0008) != 0;\t\t// Bit  3\r\n\t\t\t\t\tif (hasObject) {\r\n\t\t\t\t\t\tbool has8BitID\t= (val & 0x0004) != 0;\t    // Bit  2\r\n\t\t\t\t\t\tu32 objId = GetBits((has8BitID) ? 8 : 16);\r\n\t\t\t\t\t\tif (movie != NULL) {\r\n\t\t\t\t\t\t\tif (movie->m_movieID != objId) {\r\n\t\t\t\t\t\t\t\tremoveMovie(movie);\r\n\t\t\t\t\t\t\t\tKLBDELETE(movie);\r\n\t\t\t\t\t\t\t\tmovie = NULL;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (movie == NULL) {\r\n\t\t\t\t\t\t\tmovie = addMovie(objId, layer); // Default matrix is set, update by place.\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t\tbool hasClipping\t= val & 0x0001;\t\t// Bit  0\r\n\t\t\t\t\tif (hasClipping) {\r\n\t\t\t\t\t\t// TODO Future clipping support.\r\n\t\t\t\t\t\t// u32 clipID = GetBits(16);\r\n\t\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t\tif (movie) {\r\n\t\t\t\t\t\tint read;\r\n\t\t\t\t\t\tbool hasTranslation = (val & 0x2000) != 0;\t\t// Bit 13\r\n\t\t\t\t\t\tbool hasScale       = (val & 0x1000) != 0;\t\t// Bit 12\r\n\t\t\t\t\t\tbool hasSkew\t\t= (val & 0x0800) != 0;\t\t// Bit 11\r\n\t\t\t\t\t\tif (hasTranslation | hasScale | hasSkew) {\r\n\t\t\t\t\t\t\tu8 type     = MATRIX_ID;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t#define A\t\t\t(0)\r\n\t\t\t\t\t\t\t#define B\t\t\t(1)\r\n\t\t\t\t\t\t\t#define C\t\t\t(2)\r\n\t\t\t\t\t\t\t#define D\t\t\t(3)\r\n\t\t\t\t\t\t\t#define TX\t\t\t(4)\r\n\t\t\t\t\t\t\t#define TY\t\t\t(5)\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tfloat* p = movie->m_matrix.m_matrix;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tp[A]\t\t= 1.0f;\r\n\t\t\t\t\t\t\tp[B]\t\t= 0.0f;\r\n\t\t\t\t\t\t\tp[C]\t\t= 0.0f;\r\n\t\t\t\t\t\t\tp[D]\t\t= 1.0f;\r\n\t\t\t\t\t\t\tp[TX]\t\t= 0.0f;\r\n\t\t\t\t\t\t\tp[TY]\t\t= 0.0f;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (hasTranslation) {\r\n\t\t\t\t\t\t\t\tread = GetBits(5);\r\n\t\t\t\t\t\t\t\tp[TX]\t= GetSBits(read) / 64.0f;\r\n\t\t\t\t\t\t\t\tp[TY]\t= GetSBits(read) / 64.0f;\r\n\t\t\t\t\t\t\t\ttype = MATRIX_T;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (hasScale) {\r\n\t\t\t\t\t\t\t\tread = GetBits(5);\r\n\t\t\t\t\t\t\t\tp[A]\t= GetSBits(read) / 65536.0f;\r\n\t\t\t\t\t\t\t\tp[D]\t= GetSBits(read) / 65536.0f;\r\n\t\t\t\t\t\t\t\ttype = MATRIX_TS;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (hasSkew) {\r\n\t\t\t\t\t\t\t\tread = GetBits(5);\r\n\t\t\t\t\t\t\t\tp[B]\t= GetSBits(read) / 65536.0f;\r\n\t\t\t\t\t\t\t\tp[C]\t= GetSBits(read) / 65536.0f;\r\n\t\t\t\t\t\t\t\ttype = MATRIX_TG;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tmovie->m_matrix.m_type = type;\r\n\t\t\t\t\t\t\tmovie->markUpMatrix();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\t\tbool hasColorAlpha\t= (val & 0x0400) != 0;\t\t// Bit 10\r\n\t\t\t\t\t\tbool hasColorRGB\t= (val & 0x0200) != 0;\t\t// Bit  9\r\n\t\t\t\t\t\tif (GetBits(1)) {\r\n\t\t\t\t\t\t\tfloat* p = movie->m_localColorMatrix.m_vector;\r\n\r\n\t\t\t\t\t\t\tread = GetBits(4);\r\n\r\n\t\t\t\t\t\t\t// RGB First\r\n\t\t\t\t\t\t\tif (hasColorRGB) {\r\n\t\t\t\t\t\t\t\tp[0]\t= GetBits(read) / 256.0f;\r\n\t\t\t\t\t\t\t\tp[1]\t= GetBits(read) / 256.0f;\r\n\t\t\t\t\t\t\t\tp[2]\t= GetBits(read) / 256.0f;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tp[0]    = 1.0f;\r\n\t\t\t\t\t\t\t\tp[1]    = 1.0f;\r\n\t\t\t\t\t\t\t\tp[2]    = 1.0f;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tp[3] = (hasColorAlpha) ? (GetBits(read) / 256.0f) : 1.0f;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tmovie->m_pColorMatrix\t= &movie->m_colorMatrix;\r\n\t\t\t\t\t\t\tmovie->m_useParentColor\t= false;\r\n\t\t\t\t\t\t\tmovie->markUpColor();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\t\tmovie->m_updateFrame = m_uiFrame;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tklb_assertAlways(\"Can not create / access movie.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Remove\r\n\t\t\t\t\t// \r\n\t\t\t\t\t// bool fit = val & 0x2000;\t\t// Bit 13\r\n\t\t\t\t\tu16 layer = val & 0x1FFF;\r\n\t\t\t\t\tCKLBNode*\tpNode\t= getNode(layer);\r\n\t\t\t\t\tremoveMovie(pNode);\r\n\t\t\t\t\tKLBDELETE(pNode);\r\n\t\t\t\t}\r\n\t\t\t\tgoto nextInstruction;\r\n\t\t\t} else {\r\n\t\t\t\tswitch (val) {\r\n\t\t\t\tcase SHOW_FRAME:\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Delay of ONE frame to destroy all movies.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif ((mode == SWF_GOTO_AND_PLAY) && (m_uiFrame == frame)) {\r\n\t\t\t\t\t\tm_firstFrame\t= true;\r\n\t\t\t\t\t\tmode = SWF_NORMAL;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Do nothing, end.\r\n\t\t\t\t\tlblCode = m_player->m_aStreamInstruction[m_movieCode++];\t// Label\r\n\r\n\t\t\t\t\tif (m_isPlaying == STOP_TARGET) {\r\n\t\t\t\t\t\tm_isPlaying = STOPPED;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tu16 type = m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tif (!m_disableJump) {\r\n\t\t\t\t\t\t\t// Stop instruction on this frame.\r\n\t\t\t\t\t\t\tif (type == STOP_INSTRUCTION) {\r\n\t\t\t\t\t\t\t\tthis->m_isPlaying = STOPPED;\r\n\t\t\t\t\t\t\t\tm_movieCode++;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tif ((type == GOTO_AND_STOP) || (type == GOTO_AND_PLAY)) {\r\n\t\t\t\t\t\t\t\t\tu16 frameTarget = m_player->m_aStreamInstruction[m_movieCode++] + 2;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif (m_supportCaching && m_player->hasCache(this, frameTarget)) {\r\n\t\t\t\t\t\t\t\t\t\tm_player->restoreSceneGraph(this, frameTarget);\r\n\t\t\t\t\t\t\t\t\t\tframe\t\t= frameTarget;\r\n\t\t\t\t\t\t\t\t\t\tm_uiFrame\t= frameTarget;\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tu16 newMovieCode = this->findCodeFrame(frameTarget);\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (newMovieCode < m_movieCode) {\r\n\t\t\t\t\t\t\t\t\t\t\t// For now, movie loops.\r\n\t\t\t\t\t\t\t\t\t\t\tm_movieCode\t\t= m_movieStartCode + SKIP_SHOW;\r\n\t\t\t\t\t\t\t\t\t\t\tm_uiFrame\t\t= 0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\tframe\t\t\t= frameTarget;\r\n\t\t\t\t\t\t\t\t\t\tmode\t\t\t= SWF_GOTO_AND_PLAY;\r\n\t\t\t\t\t\t\t\t\t\tm_disableJump\t= true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t// Freeze player once reached.\r\n\t\t\t\t\t\t\t\t\tif (type == GOTO_AND_STOP) {\r\n\t\t\t\t\t\t\t\t\t\tm_isPlaying = STOPPED;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tm_movieCode++;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tm_movieCode++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PLACE_OBJECT_CLIP:\r\n\t\t\t\tcase PLACE_OBJECT:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tu16 movieID\t\t\t= m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tu16 matrixIdx\t\t= m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tu16 matrixColIdx\t= m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tu16 layer\t\t\t= m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tu16 clipLayer;\r\n\r\n\t\t\t\t\t\tif (m_player->m_aStreamInstruction[m_movieCode-5] == PLACE_OBJECT_CLIP) {\r\n\t\t\t\t\t\t\tclipLayer\t\t= m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tCKLBNode* movie;\r\n\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Remove movie if replace\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\tmovie = getNode(layer);\r\n\t\t\t\t\t\tif (movieID != NULL_IDX) {\r\n\t\t\t\t\t\t\tif (movie != NULL) {\r\n\t\t\t\t\t\t\t\tif (movie->m_movieID != movieID) {\r\n\t\t\t\t\t\t\t\t\tremoveMovie(movie);\r\n\t\t\t\t\t\t\t\t\tKLBDELETE(movie);\r\n\t\t\t\t\t\t\t\t\tmovie = NULL;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (movie == NULL) {\r\n\t\t\t\t\t\t\t\tmovie = addMovie(movieID, layer); // Default matrix is set, update by place.\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tklb_assertNull(movie, \"Null pointer\");\r\n\r\n\t\t\t\t\t\tif (movie) {\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t// Setup matrix / color matrix, movie play etc...\r\n\t\t\t\t\t\t\t//\r\n\r\n\t\t\t\t\t\t\t#define A\t\t\t(0)\r\n\t\t\t\t\t\t\t#define B\t\t\t(1)\r\n\t\t\t\t\t\t\t#define C\t\t\t(2)\r\n\t\t\t\t\t\t\t#define D\t\t\t(3)\r\n\t\t\t\t\t\t\t#define TX\t\t\t(4)\r\n\t\t\t\t\t\t\t#define TY\t\t\t(5)\r\n\r\n\t\t\t\t\t\t\t// Marking for object destruction when owner movie loop.\r\n\t\t\t\t\t\t\tmovie->m_updateFrame = m_uiFrame;\r\n\t\t\t\t\t\t\tif (matrixIdx != NULL_IDX) {\r\n\t\t\t\t\t\t\t\tint idx = m_player->m_aMatrixDataIndex[matrixIdx];\r\n\t\t\t\t\t\t\t\tfloat* pFL = movie->m_matrix.m_matrix;\r\n\t\t\t\t\t\t\t\tswitch (m_player->m_aMatrixType[matrixIdx]) {\r\n\t\t\t\t\t\t\t\tcase MATRIX_TG:\r\n\t\t\t\t\t\t\t\t\t// Thru. no break.\r\n\t\t\t\t\t\t\t\t\tpFL[A]  = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[D]  = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[B]  = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[C]  = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\tcase MATRIX_T:\r\n\t\t\t\t\t\t\t\t\tpFL[TX] = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[TY] = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase MATRIX_TS:\r\n\t\t\t\t\t\t\t\t\tpFL[A]  = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[D]  = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[TX] = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[TY] = m_player->m_aMatrixData[idx++];\r\n\t\t\t\t\t\t\t\t\tpFL[B]  = 0.0f;\r\n\t\t\t\t\t\t\t\t\tpFL[C]  = 0.0f;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase MATRIX_COL:\r\n\t\t\t\t\t\t\t\t\t// N/A Here\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase MATRIX_ID:\r\n\t\t\t\t\t\t\t\t\tpFL[A]  = 1.0f;\r\n\t\t\t\t\t\t\t\t\tpFL[D]  = 1.0f;\r\n\t\t\t\t\t\t\t\t\tpFL[TX] = 0.0f;\r\n\t\t\t\t\t\t\t\t\tpFL[TY] = 0.0f;\r\n\t\t\t\t\t\t\t\t\tpFL[B]  = 0.0f;\r\n\t\t\t\t\t\t\t\t\tpFL[C]  = 0.0f;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t// Update type of local matrix.\r\n\t\t\t\t\t\t\t\tmovie->m_matrix.m_type = m_player->m_aMatrixType[matrixIdx];\r\n\r\n\t\t\t\t\t\t\t\t#undef A\r\n\t\t\t\t\t\t\t\t#undef B\r\n\t\t\t\t\t\t\t\t#undef C\r\n\t\t\t\t\t\t\t\t#undef D\r\n\t\t\t\t\t\t\t\t#undef TX\r\n\t\t\t\t\t\t\t\t#undef TY\r\n\r\n\t\t\t\t\t\t\t\tmovie->markUpMatrix();\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (matrixColIdx != NULL_IDX) {\r\n\t\t\t\t\t\t\t\tfloat* pFL = movie->m_localColorMatrix.m_vector;\r\n\t\t\t\t\t\t\t\tif (m_player->m_aMatrixType[matrixColIdx] == 0) {\r\n\t\t\t\t\t\t\t\t\t*pFL++  = 1.0f;\r\n\t\t\t\t\t\t\t\t\t*pFL++  = 1.0f;\r\n\t\t\t\t\t\t\t\t\t*pFL++  = 1.0f;\r\n\t\t\t\t\t\t\t\t\t*pFL++  = 1.0f;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tint idx = m_player->m_aMatrixDataIndex[matrixColIdx];\r\n\t\t\t\t\t\t\t\t\t*pFL++\t= m_player->m_aMatrixData[idx++];\t// R\r\n\t\t\t\t\t\t\t\t\t*pFL++\t= m_player->m_aMatrixData[idx++];\t// G\r\n\t\t\t\t\t\t\t\t\t*pFL++\t= m_player->m_aMatrixData[idx++];\t// B\r\n\t\t\t\t\t\t\t\t\t*pFL\t= m_player->m_aMatrixData[idx];\t\t// A\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tmovie->m_pColorMatrix\t= &movie->m_colorMatrix;\r\n\t\t\t\t\t\t\t\tmovie->m_useParentColor\t= false;\r\n\t\t\t\t\t\t\t\tmovie->markUpColor();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t\tgoto nextInstruction;\r\n\t\t\t\tcase REMOVE_OBJECT:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tu16 layer\t\t\t= m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tCKLBNode*\tpNode\t= getNode(layer);\r\n\t\t\t\t\t\tremoveMovie(pNode);\r\n\t\t\t\t\t\tKLBDELETE(pNode);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgoto nextInstruction;\r\n\t\t\t\tcase PLAY_SOUND:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tu8 sndId = (u8)m_player->m_aStreamInstruction[m_movieCode++];\r\n\t\t\t\t\t\tif (mode != SWF_GOTO_AND_PLAY) {\r\n\t\t\t\t\t\t\tCPFInterface::getInstance().platform().playAudio(m_player->m_sounds[sndId].handle);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgoto nextInstruction;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tklb_assertAlways(\"Invalid code\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (m_firstFrame) {\r\n\t\t\t\tm_firstFrame = false;\r\n\t\t\t\r\n\t\t\t\t//\r\n\t\t\t\t// Clean like crazy.\r\n\t\t\t\t//\r\n\t\t\t\tCKLBNode* pChild = m_pChild;\r\n\t\t\t\twhile (pChild) {\r\n\t\t\t\t\tCKLBNode* pChildNext = ((CKLBSWFMovie*)pChild)->m_pBrother;\r\n\t\t\t\t\tif (pChild->m_updateFrame != m_uiFrame) {\r\n\t\t\t\t\t\tthis->removeNode(pChild);\r\n\t\t\t\t\t\tKLBDELETE(pChild);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpChild = pChildNext;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tm_uiFrame++;\r\n\t\t}\r\n\r\n\r\n\t\tif (m_movieCode == m_movieEndCode) {\r\n\t\t\tu32 frameLast = m_uiFrame;\r\n\r\n\t\t\t// For now, movie loops.\r\n\t\t\tm_movieCode = m_movieStartCode + SKIP_SHOW;\r\n\t\t\tm_firstFrame = true;\r\n\r\n\t\t\t// Change value AFTER call back for user (may read the frame if API allows it)\r\n\t\t\tm_uiFrame\t= NULL_IDX; // Force player to restart from frame 0.\r\n\r\n\t\t\tif (m_msgListener) {\r\n\t\t\t\tm_msgListener->receiveMsg(this, ANIMATION_COMPLETE, frameLast);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_msgListener && (lblCode != NULL_IDX)) {\r\n\t\t\t\tm_msgListener->receiveMsg(this, LABEL_REACHED, lblCode);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (m_disableJump == true && m_supportCaching) {\r\n\t\t\tm_player->cacheSceneGraph(this, m_uiFrame);\r\n\t\t}\r\n\r\n\t\tm_disableJump = false;\r\n\t}\r\n}\r\n\r\n// -----------------------------------------------------------------\r\n//   Tree marking and update.\r\n/*virtual*/\r\nvoid CKLBSWFMovie::animate(u32 deltaTimeMilli) {\r\n\t//\r\n\t// 1. Execute movie\r\n\t// Note : same behavior as flash : all sub movies continue to \"play\".\r\n\t//\r\n\tif (m_movieCode != NULL_IDX) {\r\n\t\tm_localTime += deltaTimeMilli;\r\n\t\tif (m_localTime >= m_msPerFrame) {\r\n\t\t\t// m_localTime -= m_msPerFrame;  <-- Best Effort method, try to get back lost time.\r\n\t\t\tm_localTime = 0;\t// Do not accelerate if late, but no frame skip.\r\n\t\t\tnextFrame(NULL_IDX);\r\n\t\t}\r\n\t} else {\r\n\t\t// Movie is stopped, remove from animation.\r\n\t\tCKLBSystem::removeFromAnimation(this);\r\n\t}\r\n\r\n\tif (m_isFlashRoot && m_rebuildSort) {\r\n\t\trebuildSort();\r\n\t}\r\n}\r\n\r\nvoid CKLBSWFMovie::setPriority(u32 baseOrder) {\r\n\tthis->m_renderOffset = baseOrder;\r\n\tm_rebuildSort\t\t = true;\r\n}\r\n\r\nvoid CKLBSWFMovie::rebuildSort() {\r\n\tCKLBRenderingManager& pRdr = CKLBRenderingManager::getInstance();\r\n\r\n\tu32 renderOffset = this->m_renderOffset;\r\n\trebuildRecurse(this, &renderOffset, pRdr);\r\n\r\n\t// Sort finished.\r\n\tm_rebuildSort = false;\r\n}\r\n\r\nvoid CKLBSWFMovie::rebuildRecurse(CKLBNode* pNode, u32* pIndex, CKLBRenderingManager& pRdr) {\r\n\tCKLBSWFMovie* pBrother = (CKLBSWFMovie*)pNode;\r\n\twhile (pBrother) {\r\n\t\t//\r\n\t\t// Child first.\r\n\t\t//\r\n\t\tif (pBrother->m_pChild) {\r\n\t\t\trebuildRecurse(pBrother->m_pChild, pIndex, pRdr);\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Process node itself\r\n\t\t//\r\n\t\tfor (u32 n=0; n<pBrother->m_renderCount; n++) {\r\n\t\t\tCKLBRenderCommand* pRCommand = pBrother->m_pRender[n];\r\n\t\t\tif (pRCommand) {\r\n\t\t\t\t*pIndex = *pIndex + 1; // Increment global pointer.\r\n\t\t\t\tif (pRCommand->getOrder() != *pIndex) {\t// Optimization : if order did not change.\r\n\t\t\t\t\tpRCommand->changeOrder(pRdr, *pIndex);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpBrother = (CKLBSWFMovie*)pBrother->m_pBrother;\t// Cast to access ancestor protected.\r\n\t}\r\n}\r\n\r\nCKLBNode* CKLBSWFMovie::addMovie(u16 movieID, u16 layer) {\r\n\treturn m_player->addMovieB(movieID, layer, NULL, this, NULL, 0);\r\n}\r\n\r\nvoid CKLBSWFMovie::removeMovie(CKLBNode* pMovie) {\r\n\tthis->removeNode(pMovie);\r\n}\r\n\r\n// -----------------------------------------------------------------\r\n//   Perform Rendering.\r\n\r\n// ##########################################\r\n//\r\n//   Test Porting Layer Implementation.\r\n//\r\n// ##########################################\r\n\r\n// LATER RP : may need some API extension to free all sub movies also ?\r\n// LATER RP : may need some API to replace bitmaps already loaded, ...\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBSWFPlayer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Flash File support ===\r\n//\r\n//\r\n\r\n#ifndef __SWF_PLAYER__\r\n#define __SWF_PLAYER__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBAsset.h\"\r\n\r\n// Null index, null offset\r\n#define MAIN_MOVIE_IDX\t\t\t(0xFFFE)\r\n\r\n//\r\n// Movie instruction type\r\n//\r\n#define SHOW_FRAME\t\t\t\t(0)\r\n#define PLACE_OBJECT\t\t\t(1)\r\n#define REMOVE_OBJECT\t\t\t(2)\r\n#define PLAY_SOUND\t\t\t\t(3)\r\n#define PLACE_OBJECT_CLIP\t\t(4)\r\n\r\n#define SKIP_SHOW\t\t\t\t(4)\r\n\r\n//\r\n// Structure index\r\n//\r\n#define SIZE_MOVIE_INFO\t\t\t(4)\r\n\r\n#define CODE_NAMEINDEX\t\t\t(0)\r\n\r\n// Index for normal movies\r\n// & Static Images.\r\n\r\n// FrameCount = 0xFFFF : Image asset\r\n// FrameCount = 0x8FFE : Shape\r\n#define CODE_FRAMECOUNT\t\t\t(1)\r\n#define CODE_STARTINDEX\t\t\t(2)\r\n#define CODE_OFFSETX\t\t\t(2)\r\n#define CODE_ENDINDEX\t\t\t(3)\r\n#define CODE_OFFSETY\t\t\t(3)\r\n\r\n#define CODE_SHAPE_DEF_INDEX\t(2)\r\n\r\n//\r\n// m_isDisplaying modes\r\n//\r\n#define STOPPED\t\t\t\t\t(0)\r\n#define PLAYING\t\t\t\t\t(1)\r\n#define STOP_TARGET\t\t\t\t(2)\r\n\r\n//\r\n// Show Frame flow type\r\n//\r\n#define STOP_INSTRUCTION\t\t(0)\r\n#define GOTO_AND_PLAY\t\t\t(1)\r\n#define GOTO_AND_STOP\t\t\t(2)\r\n#define SHOW_FRAME_ONLY\t\t\t(0xFFFF)\r\n\r\ntypedef unsigned int u32;\r\ntypedef unsigned short int u16;\r\ntypedef unsigned char u8;\r\ntypedef u16* u16p;\r\n\r\n// --------------------------------------------------------------------------------\r\n// Player & Related Classes Definition\r\n// --------------------------------------------------------------------------------\r\n\r\nclass SWFPlayer;\r\nclass CKLBSWFMovie;\r\nclass CKLBSWFAsset;\r\nclass SWFBitmap;\r\n\r\n/*!\r\n* \\class CKLBSWFMovie\r\n* \\brief SWF Movie Specialized Node\r\n* \r\n* CKLBSWFMovie is a specialized Node for Flash Movies.\r\n* It provides basic control methods for a Flash Movie.\r\n*/\r\nclass CKLBSWFMovie : public CKLBNode {\r\n\tfriend class CKLBSWFAsset;\r\npublic:\r\n\tCKLBSWFMovie(CKLBSWFAsset* pPlayer, CKLBNode* pParent, u16 layer);\r\n\tvirtual ~CKLBSWFMovie();\r\n\r\n\tvirtual\r\n\tCKLBNode*\tclone\t\t\t\t(CKLBNode* newItem, CKLBNode* parent, CKLBNode* brother, bool transferSpriteOwnership);\r\n\r\n\tinline \r\n\tfloat\t\t\tgetVolumeSE\t\t\t()\t{ return m_volume; }\r\n\tvoid\t\t\tsetVolumeSE\t\t\t(float volume);\r\n\r\n\tvirtual\r\n\tvoid\t\t\tsetPriority\t\t\t(u32 order);\r\n\tu16\t\t\t\tfindCodeFrame\t\t(char* label, u16* pFrameNum);\r\n\tvoid\t\t\tgotoFrame\t\t\t(u16 frame);\r\n\tvoid\t\t\tsetPlay\t\t\t\t(bool play) {\r\n\t\tif (play != m_playMode) {\r\n\t\t\tm_playMode = play;\r\n\t\t\tif (play) {\r\n\t\t\t\tm_isPlaying\t\t\t= m_isPlayingBackup;\r\n\t\t\t} else {\r\n\t\t\t\tm_isPlayingBackup\t= m_isPlaying;\r\n\t\t\t\tm_isPlaying = STOPPED;\r\n\t\t\t}\r\n\r\n\t\t\tCKLBNode* pNode = this->m_pChild;\r\n\t\t\twhile (pNode) {\r\n\t\t\t\tif (pNode->getClassID() == CLS_KLBSWFMOVIE) {\r\n\t\t\t\t\t((CKLBSWFMovie*)pNode)->setPlay(play);\r\n\t\t\t\t}\r\n\t\t\t\tpNode = ((CKLBSWFMovie*)pNode)->m_pBrother; // Stupid C++ protected spec.\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tvirtual u32\t\tgetClassID\t\t\t()\t{ return CLS_KLBSWFMOVIE; }\r\n\r\n\tinline\r\n\tCKLBSWFAsset*\tgetPlayer\t\t\t()\t{ return m_player; }\r\n\r\n\tinline\r\n\tvoid\t\t\tsetListener\t\t\t(CKLBObject* listener) { MsgRegister(listener); }\r\n\r\n\tinline\r\n\tu16\t\t\t\tgetFrameRate\t\t()\t{ return m_msPerFrame; }\r\n\tvoid\t\t\tsetFrameRate\t\t(u16 milliSecPerFrame) {\r\n\t\tif (milliSecPerFrame) {\r\n\t\t\tsetPlay(true);\r\n\t\t\tm_msPerFrame = milliSecPerFrame;\r\n\t\t} else {\r\n\t\t\tsetPlay(false);\r\n\t\t}\r\n\t}\r\n\r\n\ts8\t\t\t\treplaceAsTemplate\t(const char** pArrayString, u32 entryCount);\r\n\r\nprotected:\r\n\r\n\tCKLBSWFAsset*\tm_player;\r\n\tCKLBSWFMovie*\tm_flashRoot;\r\n\r\n\tfloat\t\t\tm_volume;\r\n\tu32\t\t\t\tm_renderOffset;\r\n\tu32\t\t\t\tm_localTime;\r\n\tu32\t\t\t\tm_movieStartCode;\t// Movie definition index IN MOVIE DATA STREAM ( NOT INDEX OF MOVIE ITSELF IN ARRAY )\r\n\tu32\t\t\t\tm_movieCode;\r\n\tu32\t\t\t\tm_movieEndCode;\r\n\tu32\t\t\t\tm_bitBuf;\r\n\tu16\t\t\t\tm_bitPos;\r\n\tu16\t\t\t\tm_uiFrame;\r\n\tu16\t\t\t\tm_msPerFrame;\r\n\tu16\t\t\t\tm_updateFrame;\r\n\tu8\t\t\t\tm_isPlaying;\r\n\tu8\t\t\t\tm_isPlayingBackup;\r\n\tCKLBImageAsset**\tm_aBitmapLoaded;\r\n\ts32*\t\t\tm_convTable;\r\n\tconst char**\tm_nameTable;\r\n\r\n\tbool\t\t\tm_firstFrame;\r\n\tbool\t\t\tm_rebuildSort;\r\n\tbool\t\t\tm_isFlashRoot;\r\n\tbool\t\t\tm_disableJump;\r\n\tbool\t\t\tm_playMode;\r\n\tbool\t\t\tm_supportCaching;\r\n\r\n\tvirtual\r\n\tvoid\t\t\tanimate\t\t\t\t(u32 deltaTimeMilli);\r\n\tvoid\t\t\tnextFrame\t\t\t(u16 frame);\r\n\r\n\tvoid\t\t\tInitBits\t\t\t();\r\n\ts32\t\t\t\tGetSBits\t\t\t(s32 n);\r\n\tu32\t\t\t\tGetBits\t\t\t\t(s32 n);\r\n\r\n\tCKLBImageAsset*\tgetImage\t\t\t(u16 movieID);\r\n\r\nprivate:\r\n\tvoid\t\t\tfreeTables\t\t\t();\r\n\tCKLBNode*\t\taddMovie\t\t\t(u16 movieID, u16 layer);\r\n\tvoid\t\t\tremoveMovie\t\t\t(CKLBNode* pNode);\r\n\tu16\t\t\t\tfindCodeFrame\t\t(u16 frame);\r\n\tvoid\t\t\trebuildSort\t\t\t();\r\n\tvoid\t\t\trebuildRecurse\t\t(CKLBNode* pNode, u32* pIndex, CKLBRenderingManager& pRdr);\r\n\tvoid\t\t\tsetFlashRoot\t\t();\r\n};\r\n\r\nstruct SShape;\r\nstruct SSound;\r\n\r\n/*!\r\n* \\class CKLBSWFAsset\r\n* \\brief Flash Asset Class\r\n* \r\n* Generates an SWF instance from SWF Movie definition.\r\n* This is an asset that stores exported Flash movies from our converter.\r\n* It contains animation information, link to needed images or sound assets and movie structure.\r\n* Various information about label, movie length is also stored.\r\n*/\r\nclass CKLBSWFAsset : public CKLBAsset {\r\n\tfriend class CKLBNodeSWF;\r\n\tfriend class CKLBSWFMovie;\r\npublic:\r\n\tvirtual u32\t\tgetClassID()\t\t{ return CLS_ASSETFLASH; }\r\n\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t{ return ASSET_SWFMOVIE; }\r\n\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 priorityBase = 0);\r\n\t\r\n\tCKLBSWFAsset();\r\n\t~CKLBSWFAsset();\r\n\r\n\tinline\r\n\tchar*\t\tgetConstantString\t(u16 stringIndex) {\r\n\t\tklb_assert(stringIndex < m_uiStringCount, \"Invalid index\");\r\n\t\tklb_assert(m_aConstants, \"No constant\");\r\n\t\treturn m_aConstants[stringIndex];\r\n\t}\r\n\r\n\tinline\r\n\tvoid\t\tsetFrameRate\t\t(u16 milliSecPerFrame) {\r\n\t\tm_msPerFrame = milliSecPerFrame;\r\n\t}\r\n\r\n\tbool\t\tLoadData\t\t\t(u8* pData);\r\n\tCKLBSWFAsset* \r\n\t\t\t\tfindMovieAsset\t\t(char* name);\r\n\tvoid\t\tsetVolumeSE\t\t\t(float volume);\r\n\r\n\tCKLBNode*\taddMovieA\t\t\t(char* name, u16 layer, SMatrix2D* m, CKLBNode* root, const char** templateInfo, u32 pairCount);\r\n\tCKLBNode*\taddMovieB\t\t\t(u16 movieID, u16 layer, SMatrix2D* m, CKLBNode* root, const char** templateInfo, u32 pairCount);\r\n\r\n\tu32\t\t\tgetResourceList\t\t(u32 arraySize, const char** arrayOfString);\r\nprivate:\r\n\tvoid cacheSceneGraph\t\t\t(CKLBSWFMovie* node, u16 frame);\r\n\tbool hasCache\t\t\t\t\t(CKLBSWFMovie* node, u16 frame);\r\n\tvoid restoreSceneGraph\t\t\t(CKLBSWFMovie* node, u16 frame);\r\n\r\n\tCKLBNode*\tfindNode\t\t\t(char* name);\r\n\tu16\t\t\tfindMovie\t\t\t(char* name);\r\n\r\n\tCKLBSWFAsset*\tm_parentSWF;\r\n\r\n\t// Animation frame rate : number of millisecond per frame.\r\n\tu16\t\tm_msPerFrame;\r\n\t\r\n\t//-------------------------------------\r\n\t// Constant Pool.\r\n\tu16\t\t\tm_uiStringCount;\r\n\tu16\t\t\tm_uiTotalCharsCount;\r\n\tchar**\t\tm_aConstants;\r\n\tchar*\t\tm_aChars;\r\n\r\n\t//-------------------------------------\r\n\t// Matrix Information.\r\n\tu16\t\t\tm_uiMatrixCount;\r\n\r\n\t//-------------------------------------\r\n\t// Movie ID when referencing parent.\r\n\tu16\t\t\tm_refMovieID;\r\n\r\n\t//-------------------------------------\r\n\t// Shape Related\r\n\tu16\t\t\tm_uiShapeCount;\r\n\tu32\t\t\tm_uiIndexTotal;\r\n\tu16*\t\tm_pIndex;\r\n\tSShape*\t\tm_shapes;\r\n\r\n\t//-------------------------------------\r\n\t// Audio Related\r\n\tu16\t\t\tm_uiSoundCount;\r\n\tSSound*\t\tm_sounds;\r\n\r\n\t// Array of object : avoid multiple object --> Faster for scripting.\r\n\t// same as : Matrix*\tm_aMatrixArray;\r\n\tfloat*\t\tm_aMatrixData;\r\n\tu8*\t\t\tm_aMatrixType;\r\n\tu32*\t\tm_aMatrixDataIndex;\t// Note : can optimize one indirection with float* computed once.\r\n\r\n\t//-------------------------------------\r\n\t// Stream Information\r\n\tu32*\t\tm_aStreamInstruction;\r\n\tu32\t\t\tm_aStreamSize;\r\n\r\n\t//-------------------------------------\r\n\t// Movie Information\r\n\tu16\t\t\t\t\t\tm_uiMovieCount;\r\n\t\r\n\tstruct SCacheEntry {\r\n\t\tSCacheEntry*\tm_next;\r\n\t\tCKLBSWFMovie*\tm_cacheNode;\r\n\t\tu16\t\t\t\tm_cacheFrame;\r\n\t};\r\n\r\n\tSCacheEntry**\t\t\tm_alistCacheEntries;\r\n\tu32*\t\t\t\t\tm_aMovieInfo; // Array of [movie count * 8] entries.\r\n\tCKLBSWFAsset*\t\t\tm_subAssets;\r\n\tCKLBImageAsset**\t\tm_aBitmapLoaded;\r\n\tbool\t\t\t\t\tm_isMaster;\r\n};\r\n\r\n/*!\r\n* \\class KLBFlashAssetPlugin\r\n* \\brief Flash Asset Plugin Class\r\n* \r\n* KLBFlashAssetPlugin is in charge of loading Flash Assets.\r\n*/\r\nclass KLBFlashAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBFlashAssetPlugin();\r\n\t~KLBFlashAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID()\t\t\t\t\t{ return CHUNK_TAG('F','L','S','H'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader()\t\t\t\t\t{ return 'F';\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension()\t\t\t\t\t{ return \".flsh\"; }\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize);\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBScoreNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScoreNode.h\"\r\n#include \"mem.h\"\r\n\r\nCKLBScoreNode::CKLBScoreNode()\r\n:CKLBNode\t\t()\r\n,m_uiScore\t\t(0xFFFFFFFF)\r\n,m_newAnimated\t(false)\r\n,m_oldAnimated\t(false)\r\n,m_bScoreChange\t(true)\r\n,m_dotSprite\t(NULL)\r\n,m_dotNode\t\t(NULL)\r\n,m_widthDot\t\t(0)\r\n,m_heightDot\t(0)\r\n,m_DotPosition\t(0)\r\n,m_prevDotPosition\t(0)\r\n{\r\n\tm_deleteRender = false; // Force own management of sprite on destruction.\r\n\tmemset32(m_scoreOldNode, NULL, __SCORE_LEN_MAX__ * sizeof(void*));\r\n\tmemset32(m_scoreNewNode, NULL, __SCORE_LEN_MAX__ * sizeof(void*));\r\n\tmemset32(m_font\t\t   , NULL, 11 * sizeof(void*));\r\n\tm_animInfo[0].m_hasAnim = false;\r\n\tm_animInfo[1].m_hasAnim = false;\r\n}\r\n\r\nCKLBScoreNode::~CKLBScoreNode()\r\n{\r\n\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\tfor (int n=0; n < __SCORE_LEN_MAX__; n++) {\r\n\t\tif (m_scoreOldNode[n]) {\r\n\t\t\t// 1. Back up sprite.\r\n\t\t\tCKLBRenderCommand* pComm = m_scoreOldNode[n]->getRender();\r\n\t\t\tm_scoreOldNode[n]->setRender(NULL);\r\n\t\t\t// 2. Destroy node -> remove from render list if any.\r\n\t\t\tKLBDELETE(m_scoreOldNode[n]);\r\n\t\t\t// 3. Destroy sprite if any.\r\n\t\t\tif (pComm) { pMgr.releaseCommand(pComm); }\r\n\t\t}\r\n\t\tif (m_scoreNewNode[n]) {\r\n\t\t\t// Order important !\r\n\t\t\tCKLBRenderCommand* pComm = m_scoreNewNode[n]->getRender();\r\n\t\t\tm_scoreNewNode[n]->setRender(NULL);\r\n\t\t\tKLBDELETE(m_scoreNewNode[n]);\r\n\t\t\tif (pComm) { pMgr.releaseCommand(pComm); }\r\n\t\t}\r\n\t}\r\n\r\n\tif (m_dotNode) {\r\n\t\tm_dotNode->setRender(NULL);\r\n\t\tKLBDELETE(m_dotNode);\r\n\t}\r\n\r\n\tif (m_dotSprite) {\r\n\t\tpMgr.releaseCommand(m_dotSprite);\r\n\t}\r\n}\r\n\r\nvoid CKLBScoreNode::setDot(\tCKLBImageAsset* dotAsset, s32 width, s32 height ) {\r\n\tm_dotSprite->switchImage(dotAsset);\r\n\t\r\n\tm_widthDot = (float)width;\r\n\tm_heightDot= (float)height;\r\n\t\r\n\tm_dotNode->markUpMatrix();\r\n}\r\n\r\nvoid CKLBScoreNode::setDotActive(u32 position) {\r\n\tm_prevDotPosition = position;\r\n}\r\n\r\nvoid CKLBScoreNode::setScore(u32 value, bool animFirstTime) {\r\n\tsetDotActive(255); // Outside of range.\r\n\tsetScoreInternal(value, animFirstTime);\r\n}\r\n\r\nvoid CKLBScoreNode::setScoreFloat(float value, u32 dotPosition, bool animFirstTime) {\r\n\tstatic float s_multiplier[10] = {\r\n\t\t1.0f,\r\n\t\t10.0f,\r\n\t\t100.0f,\r\n\t\t1000.0f,\r\n\t\t10000.0f,\r\n\t\t100000.0f,\r\n\t\t1000000.0f,\r\n\t\t10000000.0f,\r\n\t\t100000000.0f,\r\n\t\t1000000000.0f,\r\n\t};\r\n\r\n\tif (dotPosition >= 9) {\r\n\t\tdotPosition = 9;\r\n\t}\r\n\r\n\tvalue *= s_multiplier[dotPosition];\r\n\t\r\n\tdotPosition = m_scoreLength - dotPosition;\r\n\r\n\t// Float to int\r\n\tu32 score = (u32)value;\r\n\tsetScoreInternal(score, animFirstTime);\r\n\tsetDotActive(dotPosition);\r\n}\r\n\r\n\r\nbool CKLBScoreNode::init(\tu32\t\t\t\t\t\tbasePriority,\r\n\t\t\t\t\t\t\ts32\t\t\t\t\t\toldNumberPriorityOffset,\r\n\t\t\t\t\t\t\tCKLBImageAsset*\t\t \tchar0_9[10],\r\n\t\t\t\t\t\t\ts32 \t\t\t\t\tstepX,\r\n\t\t\t\t\t\t\ts32 \t\t\t\t\tstepY,\r\n\t\t\t\t\t\t\tu32 \t\t\t\t\tscore_length,\r\n\t\t\t\t\t\t\tbool\t\t\t\t\tfillWithZero,\r\n\t\t\t\t\t\t\tbool\t\t\t\t\tanimAll) {\r\n\tbool res = true;\r\n\tm_animAll\t\t= animAll;\t\r\n\tm_default\t\t= (fillWithZero     ) ? 0 : 10;\r\n\tm_scoreLength\t= (score_length > 9 ) ? 9 : (score_length < 1 ? 1 : score_length);\r\n\tm_oldNumberPriorityOffset\t= oldNumberPriorityOffset;\r\n\tm_stepX\t\t\t= stepX;\r\n\tm_stepY\t\t\t= stepY;\r\n\r\n\tmemcpy32(m_font, char0_9, 10 * sizeof(CKLBImageAsset*));\r\n\r\n\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\r\n\tfor (int n = 0; n < __SCORE_LEN_MAX__; n++) {\r\n\t\tm_oldScore[n] = 30; // Only occurs the first time.\r\n\t}\r\n\r\n\tfor (int n = 0; n < m_scoreLength; n++) {\r\n\t\tfloat\tfStepX\t\t\t= (float)(n*m_stepX);\r\n\t\tfloat\tfStepY\t\t\t= (float)(n*m_stepY);\r\n\r\n\t\tm_scoreOldNode[n] = KLBNEW(CKLBSplineNode);\r\n\t\tm_scoreNewNode[n] = KLBNEW(CKLBSplineNode);\t\r\n\t\tCKLBSprite* pSpr0 = pMgr.allocateCommandSprite(4,6);\r\n\t\tCKLBSprite* pSpr1 = pMgr.allocateCommandSprite(4,6);\r\n\r\n\t\tif ((!m_scoreNewNode[n]) || (!m_scoreOldNode\t[n]) || (!pSpr0) || (!pSpr1)) {\r\n\t\t\tres = false; break;\r\n\t\t}\r\n\r\n\t\tm_scoreOldNode[n]->setRender(pSpr0);\r\n\t\tm_scoreNewNode[n]->setRender(pSpr1);\r\n\r\n\t\tm_scoreOldNode[n]->setTranslate(fStepX, fStepY);\r\n\r\n\t\t((CKLBSprite*)m_scoreOldNode[n]->getRender())->changeOrder(pMgr, basePriority + n + oldNumberPriorityOffset);\r\n\t\t((CKLBSprite*)m_scoreNewNode[n]->getRender())->changeOrder(pMgr, basePriority + n);\r\n\r\n\t\tm_scoreNewNode[n]->setTranslate(fStepX, fStepY);\r\n\t\tthis->addNode(m_scoreNewNode[n]);\r\n\r\n\t}\r\n\r\n\tm_dotSprite = pMgr.allocateCommandSprite(4,6);\r\n\tm_dotNode   = KLBNEW(CKLBNode);\r\n\tthis->addNode(m_dotNode);\r\n\r\n\treturn res && (m_dotSprite != NULL) && (m_dotNode != NULL);\r\n}\r\n\r\nvoid CKLBScoreNode::setPriority(u32 order)\r\n{\r\n\tCKLBRenderingManager& pRdr = CKLBRenderingManager::getInstance();\r\n\r\n\tfor (int n = 0; n < m_scoreLength; n++) {\r\n\t\t((CKLBSprite*)m_scoreOldNode[n]->getRender())->changeOrder(pRdr, order + n + m_oldNumberPriorityOffset);\r\n\t\t((CKLBSprite*)m_scoreNewNode[n]->getRender())->changeOrder(pRdr, order + n);\r\n\t}\r\n\tm_dotSprite->changeOrder(pRdr, order + m_DotPosition + m_oldNumberPriorityOffset);\r\n}\r\n\r\nvoid CKLBScoreNode::setAnimationInternal(\tbool\tisNew,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\tmilliSecondsPlayTime,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\ttimeShift,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\t/*onlyChange*/,\r\n\t\t\t\t\t\t\t\t\t\t\tu32\t\ttype,\r\n\t\t\t\t\t\t\t\t\t\t\tu32\t\taffected,\r\n\t\t\t\t\t\t\t\t\t\t\tconst float* arrayParam) {\r\n\tAnimInfo* pAnim = &m_animInfo[isNew ? 1 : 0];\r\n\tfloat* dst = pAnim->m_Anim;\r\n\tif (affected & CKLBSplineNode::ANM_X_COORD_0)\t\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\tif (affected & CKLBSplineNode::ANM_Y_COORD_1)\t\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\tif (affected & CKLBSplineNode::ANM_SCALE_COORD_2)\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\tif (affected & CKLBSplineNode::ANM_R_COLOR_3)\t\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\tif (affected & CKLBSplineNode::ANM_G_COLOR_4)\t\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\tif (affected & CKLBSplineNode::ANM_B_COLOR_5)\t\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\tif (affected & CKLBSplineNode::ANM_A_COLOR_6)\t\t{   *dst++ = *arrayParam++;  *dst++ = *arrayParam++; }\r\n\r\n\tpAnim->m_affected\t\t\t\t= affected;\r\n\tpAnim->m_milliSecondsPlayTime\t= milliSecondsPlayTime;\r\n\tpAnim->m_type\t\t\t\t\t= type;\r\n\tpAnim->m_timeShift\t\t\t\t= timeShift;\r\n\tpAnim->m_hasAnim\t\t\t\t= affected != 0;\r\n\treAssignAnim(isNew ? 1 : 0);\r\n}\r\n\r\nvoid CKLBScoreNode::reAssignAnim(u32 idx) {\r\n\tfloat localFloat[16];\r\n\r\n\tAnimInfo* pAnim = &m_animInfo[idx];\r\n\tif (pAnim->m_hasAnim) {\r\n\t\tCKLBSplineNode** pNodeArr = (idx != 0) ? m_scoreNewNode : m_scoreOldNode;\r\n\r\n\t\tconst float* backup = pAnim->m_Anim;\r\n\t\tmemcpy(localFloat, backup, sizeof(float)*16);\r\n\t\tfor (int n=0; n < m_scoreLength; n++) {\r\n\t\t\tfloat* backup = pAnim->m_Anim;\r\n\t\t\tfloat*\tdst             = localFloat;\r\n\t\t\tint\t\tm\t\t\t\t= m_scoreLength - n;\r\n\t\t\tint\t\ttimeShiftLocal\t= m*pAnim->m_timeShift;\r\n\r\n\t\t\tfloat   offsetX\t\t\t= ((n >= m_DotPosition) ? m_widthDot : 0.0f);\r\n\t\t\tfloat   offsetY\t\t\t= ((n >= m_DotPosition) ? m_heightDot: 0.0f);\r\n\r\n\t\t\tfloat\tfStepX\t\t\t= ((float)(n*m_stepX)) + offsetX;\r\n\t\t\tfloat\tfStepY\t\t\t= ((float)(n*m_stepY)) + offsetY;\r\n\r\n\t\t\tif (pAnim->m_affected & CKLBSplineNode::ANM_X_COORD_0)\t{   *dst++ = (*backup++) + fStepX;  *dst++ = (*backup++) + fStepX; }\r\n\t\t\tif (pAnim->m_affected & CKLBSplineNode::ANM_Y_COORD_1)\t{   *dst++ = (*backup++) + fStepY;  *dst++ = (*backup++) + fStepY; }\r\n\r\n\t\t\tpNodeArr[n]->setAnimation(pAnim->m_milliSecondsPlayTime, timeShiftLocal, pAnim->m_type, NULL, 0, pAnim->m_affected, localFloat);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n\tNo animation : affected = 0\r\n */\r\nvoid CKLBScoreNode::setEnterAnimation\t(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam)\r\n{\r\n\tif (!arrayParam) { affected = 0; }\r\n\r\n\t//\r\n\t// Enter animation : never remove.\r\n\t//\r\n\taffected &= ~CKLBSplineNode::ANM_REMOVESCENE;\r\n\r\n\tsetAnimationInternal(true, milliSecondsPlayTime, timeShift, onlyChange, type, affected, arrayParam);\r\n\r\n\tm_newAnimated = (affected != 0);\r\n}\r\n\r\nvoid CKLBScoreNode::setExitAnimation\t(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam)\r\n{\r\n\tif (!arrayParam) { affected = 0; }\r\n\r\n\tsetAnimationInternal(false, milliSecondsPlayTime, timeShift, onlyChange, type, affected | CKLBSplineNode::ANM_REMOVESCENE, arrayParam);\r\n\r\n\tm_oldAnimated = (affected != 0);\r\n}\r\n\r\nvoid CKLBScoreNode::setScoreInternal\t(u32 score, bool /*animFirstTime*/)\r\n{\r\n\tif (score != m_uiScore) {\t\r\n\t\tm_uiScore       = score;\r\n\t\tm_bScoreChange  = true;\r\n\t}\r\n}\r\n\r\nvoid CKLBScoreNode::update() {\r\n\tif (m_prevDotPosition != m_DotPosition) {\r\n\t\tm_DotPosition = m_prevDotPosition;\r\n\t\tif (m_DotPosition >= m_scoreLength) {\r\n\t\t\t\r\n\t\t\tm_dotNode->setRender(NULL,0);\r\n\r\n\t\t\treAssignAnim(0);\r\n\t\t\treAssignAnim(1);\r\n\r\n\t\t\tfor (int n = 0; n < m_scoreLength; n++) {\r\n\t\t\t\tfloat\tfStepX\t\t\t= (float)(n*m_stepX);\r\n\t\t\t\tfloat\tfStepY\t\t\t= (float)(n*m_stepY);\r\n\r\n\t\t\t\tm_scoreOldNode[n]->setTranslate(fStepX, fStepY);\r\n\t\t\t\tm_scoreNewNode[n]->setTranslate(fStepX, fStepY);\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t\tm_dotNode->setRender(m_dotSprite);\r\n\r\n\t\t\treAssignAnim(0);\r\n\t\t\treAssignAnim(1);\r\n\r\n\t\t\tfor (int n = 0; n < m_scoreLength; n++) {\r\n\t\t\t\tfloat offsetX = ((n >= m_DotPosition) ? m_widthDot : 0.0f);\r\n\t\t\t\tfloat offsetY = ((n >= m_DotPosition) ? m_heightDot : 0.0f);\r\n\r\n\t\t\t\tfloat\tfStepX\t\t\t= ((float)(n*m_stepX)) + offsetX;\r\n\t\t\t\tfloat\tfStepY\t\t\t= ((float)(n*m_stepY)) + offsetY;\r\n\r\n\t\t\t\tif (n == m_DotPosition) {\r\n\t\t\t\t\tm_dotNode->setTranslate(fStepX - offsetX, fStepY - offsetY);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tm_scoreOldNode[n]->setTranslate(fStepX, fStepY);\r\n\t\t\t\tm_scoreNewNode[n]->setTranslate(fStepX, fStepY);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (m_bScoreChange) {\r\n\t\tu32 score = m_uiScore;\r\n\t\tu8 newScore[10];\r\n\t\tm_bScoreChange = false;\r\n\t\t// Reset.\r\n\t\tnewScore[0 ] = 0;  //m_default; // 0fill���Ȃ��ꍇ�ł�A1���ڂ�0�͕\\������B\r\n\t\tnewScore[1 ] = m_default;\r\n\t\tnewScore[2 ] = m_default;\r\n\t\tnewScore[3 ] = m_default;\r\n\t\tnewScore[4 ] = m_default;\r\n\t\tnewScore[5 ] = m_default;\r\n\t\tnewScore[6 ] = m_default;\r\n\t\tnewScore[7 ] = m_default;\r\n\t\tnewScore[8 ] = m_default;\r\n\t\tnewScore[9 ] = m_default;\r\n\r\n\t\t// Convert int into units.\r\n\t\twhile (score >=1000000000) {\tscore -=1000000000;\tnewScore[9]++;\t}\r\n\t\twhile (score >= 100000000) {\tscore -= 100000000;\tnewScore[8]++;\t}\r\n\t\twhile (score >=  10000000) {\tscore -=  10000000;\tnewScore[7]++;\t}\r\n\t\twhile (score >=   1000000) {\tscore -=   1000000;\tnewScore[6]++;\t}\r\n\t\twhile (score >=    100000) {\tscore -=    100000;\tnewScore[5]++;\t}\r\n\t\twhile (score >=     10000) {\tscore -=     10000;\tnewScore[4]++;\t}\r\n\t\twhile (score >=      1000) {\tscore -=      1000;\tnewScore[3]++;\t}\r\n\t\twhile (score >=       100) {\tscore -=       100;\tnewScore[2]++;\t}\r\n\t\twhile (score >=        10) {\tscore -=        10;\tnewScore[1]++;\t}\r\n\t\twhile (score >=         1) {\tscore -=         1;\tnewScore[0]++;\t}\r\n\r\n\t\t//\r\n\t\t// Manage to handle that fill 0 with empty space works only for the BEGINNING of the score\r\n\t\t// ie : 000010000 -> ____10000\r\n\t\t//\r\n\t\tif (m_default != 0) {\r\n\t\t\tbool resetFill = false;\r\n\t\t\tfor (int n = m_scoreLength; n>=0; n--) {\r\n\t\t\t\tif (newScore[n] != 10) {\r\n\t\t\t\t\tresetFill = true;\r\n\t\t\t\t\tif (newScore[n] > 10) {\r\n\t\t\t\t\t\tnewScore[n] -= 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (n <= m_scoreLength - m_DotPosition) {\r\n\t\t\t\t\t\tresetFill = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (resetFill) {\r\n\t\t\t\t\t\tnewScore[n] = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Perform display switch.\r\n\t\t//\r\n\t\tfor (int n = 0; n < m_scoreLength; n++) {\r\n\t\t\t// From higher to lower.\r\n\t\t\tint m = ((m_scoreLength-1) - n);\r\n\t\t\tif ((m_oldScore[n] != newScore[n]) || m_animAll) {\r\n\t\t\t\t// New score graphic setup\r\n\t\t\t\tCKLBImageAsset* pAsset = m_font[newScore[n]];\r\n\r\n\t\t\t\t// ---- Atomic Operation ----\r\n\t\t\t\t((CKLBSprite*)m_scoreNewNode[m]->getRender())->switchImage(pAsset);\r\n\r\n\t\t\t\t// Changed only UV but node recompute use matrix changes.\r\n\t\t\t\tm_scoreNewNode[m]->markUpMatrixAndColor();\r\n\t\t\t\t// --------------------------\r\n\r\n\t\t\t\t// Set animation if needed.\r\n\t\t\t\tif (m_newAnimated) {\r\n\t\t\t\t\t// Set new font item.\r\n\t\t\t\t\tm_scoreNewNode[m]->play();\t// Reset time. (add to animation system is also done by the function)\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If old animation is needed.\r\n\t\t\t\tif (m_oldAnimated) {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Put back in scene graph if animation is already complete.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (m_scoreOldNode[m]->getParent() == NULL) {\r\n\t\t\t\t\t\tthis->addNode(m_scoreOldNode[m], 0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Assign bitmap\r\n\t\t\t\t\tCKLBImageAsset* pAsset = m_font[m_oldScore[n]];\r\n\t\t\t\t\t\r\n\t\t\t\t\t// ---- Atomic Operation ----\r\n\t\t\t\t\t((CKLBSprite*)m_scoreOldNode[m]->getRender())->switchImage(pAsset);\r\n\t\t\t\t\t// Changed only UV but node recompute use matrix changes.\r\n\t\t\t\t\tm_scoreOldNode[m]->markUpMatrixAndColor();\r\n\t\t\t\t\t// --------------------------\r\n\r\n\t\t\t\t\t// Restart animation.\r\n\t\t\t\t\tm_scoreOldNode[m]->play();\t// Reset time. (add to animation system is also done by the function)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_oldScore[n] = newScore[n];\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBScoreNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//\r\n\r\n#ifndef __SCORE_NODE__\r\n#define __SCORE_NODE__\r\n\r\n#include \"CKLBSplineNode.h\"\r\n\r\n/**\r\n\t- Animate previous character\r\n\t- Animate next character\r\n\t- Animate node itself\r\n */\r\n\r\n/*!\r\n* \\class CKLBScoreNode\r\n* \\brief Score Specialized Node Class\r\n* \r\n* CKLBScoreNode is in charge of animating a Score.\r\n* First, it animates the previous digit.\r\n* The is animates the next digt.\r\n* Finnaly, it animates the node itself.\r\n*/\r\nclass CKLBScoreNode : public CKLBNode {\r\npublic:\r\n\tCKLBScoreNode\t\t\t\t\t\t();\r\n\tvirtual ~CKLBScoreNode\t\t\t\t();\r\n\r\n\tbool init\t\t\t\t\t\t\t(\tu32\t\t\t\t\t\tbasePriority,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\t\t\t\t\toldNumberPriorityOffset,\r\n\t\t\t\t\t\t\t\t\t\t\tCKLBImageAsset* \t\tchar0_9[10],\r\n\t\t\t\t\t\t\t\t\t\t\ts32 \t\t\t\t\tstepX,\r\n\t\t\t\t\t\t\t\t\t\t\ts32 \t\t\t\t\tstepY,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 \t\t\t\t\tscore_length,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\t\t\t\t\tfillWithZero,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\t\t\t\t\tanimAll);\r\n\r\n\tvoid setDot\t\t\t\t\t\t\t(\tCKLBImageAsset*\t\t\tdotAsset, s32 width, s32 height );\r\n\r\n\tvoid setAnimationInternal\t\t\t(\tbool\tisNew,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\tmilliSecondsPlayTime,\r\n\t\t\t\t\t\t\t\t\t\t\ts32\t\ttimeShift,\r\n\t\t\t\t\t\t\t\t\t\t\tbool\tonlyChange,\r\n\t\t\t\t\t\t\t\t\t\t\tu32\t\ttype,\r\n\t\t\t\t\t\t\t\t\t\t\tu32\t\taffected,\r\n\t\t\t\t\t\t\t\t\t\t\tconst float* arrayParam);\r\n\r\n\tvoid setEnterAnimation\t\t\t\t(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam);\r\n\tvoid setExitAnimation\t\t\t\t(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam);\r\n\tvoid setScore\t\t\t\t\t\t(u32 value, bool animFirstTime);\r\n\tvoid setScoreFloat\t\t\t\t\t(float value, u32 dotPosition, bool animFirstTime);\r\n\tvoid update\t\t\t\t\t\t\t();\r\n\tinline u32\t\tgetScore\t\t\t()\t{ return m_uiScore; }\r\n\tvirtual u32\t\tgetClassID\t\t\t()\t{ return CLS_KLBSCORENODE; }\r\n\r\n\tvirtual\tvoid\tsetPriority\t\t\t(u32 order);\r\nprivate:\r\n\tvoid setDotActive\t\t\t\t\t(u32 position);\r\n\tvoid setScoreInternal\t\t\t\t(u32 value, bool animFirstTime);\r\n\tvoid reAssignAnim\t\t\t\t\t(u32 idx);\r\n\r\n\t#define __SCORE_LEN_MAX__\t(10)\r\n\tCKLBImageAsset*\t\t\tm_font\t\t\t[11];\r\n\tCKLBSplineNode*\t\t\tm_scoreOldNode\t[__SCORE_LEN_MAX__];\r\n\tCKLBSplineNode*\t\t\tm_scoreNewNode\t[__SCORE_LEN_MAX__];\r\n\r\n\tCKLBSprite*\t\t\t\tm_dotSprite;\r\n\tCKLBNode*\t\t\t\tm_dotNode;\r\n\tfloat\t\t\t\t\tm_widthDot;\r\n\tfloat\t\t\t\t\tm_heightDot;\r\n\r\n\tstruct AnimInfo {\r\n\t\ts32 m_milliSecondsPlayTime;\r\n\t\ts32 m_timeShift;\r\n\t\tu32 m_type;\r\n\t\tfloat m_Anim[16];\t\t\r\n\t\tu32 m_affected;\r\n\t\tbool m_hasAnim;\r\n\t};\r\n\r\n\tAnimInfo\t\t\t\tm_animInfo[2];\r\n\r\n\ts32\t\t\t\t\t\tm_stepX;\r\n\ts32\t\t\t\t\t\tm_stepY;\r\n\tu32\t\t\t\t\t\tm_uiScore;\r\n\ts32\t\t\t\t\t\tm_oldNumberPriorityOffset;\r\n\tu8\t\t\t\t\t\tm_oldScore\t\t[__SCORE_LEN_MAX__];\r\n\tu8\t\t\t\t\t\tm_default;\r\n\tu8\t\t\t\t\t\tm_scoreLength;\r\n\tu8\t\t\t\t\t\tm_DotPosition;\r\n\tu8\t\t\t\t\t\tm_prevDotPosition;\r\n\tbool\t\t\t\t\tm_newAnimated;\r\n\tbool\t\t\t\t\tm_oldAnimated;\r\n\tbool\t\t\t\t\tm_animAll;\r\n\tbool\t\t\t\t\tm_bScoreChange;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBSplineNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBSplineNode.h\"\r\n#include \"Message.h\"\r\n\r\n#define\t\tVECTORSIZE\t(4)\r\n\r\n// ##########################################\r\n//\r\n// --- Instance ---\r\n//\r\n// ##########################################\r\n\r\nCKLBSplineNode::CKLBSplineNode()\r\n: CKLBNode          ()\r\n, m_uiLocalTime     (0)\r\n, m_applyMask       (0)\r\n, m_uiLooptime      (16384)\r\n, m_timeMultiplier  (0)\r\n, m_aKeyVector      (NULL)\r\n, m_loop            (false)\r\n, m_uiTotalKeyCount (2)\r\n, m_uiLastLocalTime (0)\r\n, m_uiLastKey       (0)\r\n, m_uiSplineCount   (0)\r\n, m_allKeys         (NULL)\r\n, m_target          (NULL)\r\n, m_splines         (NULL)\r\n, m_splinesKeyCount (NULL)\r\n, m_splineLastKey   (NULL)\r\n, m_tag             (NULL)\r\n, m_refCounter      (NULL)\r\n, m_pingpong        (false)\r\n, m_startTime       (0)\r\n{\r\n\t// Is not animated UNTIL animation is set.\r\n\t// this->m_status |= ANIMATED;\r\n}\r\n\r\nCKLBSplineNode::~CKLBSplineNode() {\r\n\tcleanSplines();\r\n\r\n\t// If doing animation and ref counter linked.\r\n\t// Note : CKLBNode make Visible(false) -> remove from animation already done.\r\n\tif (m_refCounter) {\r\n\t\t*m_refCounter = *m_refCounter - 1;\r\n\t\tm_refCounter  = NULL;\r\n\t}\r\n}\r\n\r\n\r\nstatic s32 SplineTbl1[8] = {\r\n\t// ===============\r\n\t//   Sample Key : Linear (1)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t65536,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,\t-65536,\r\n};\r\n\r\nstatic s32 SplineTbl2[8] = {\r\n\t// ===============\r\n\t//   Sample Key : Swing (2)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t65536,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,\t    0,\r\n};\r\n\r\nstatic s32 SplineTbl3[8] = {\r\n\t// ===============\r\n\t//   Sample Key : easeInQuad (3)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t    0,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0, -65536,\r\n};\r\n\r\nstatic s32 SplineTbl4[8] = {\r\n\t// ===============\r\n\t//   Sample Key : easeOutQuad (4)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t 65536,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,      0,\r\n};\r\n\r\nstatic s32 SplineTbl5[8] = {\r\n\t// ===============\r\n\t//   Sample Key : easeInOutQuad (5)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t    0,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,      0,\r\n};\r\n\r\nstatic s32 SplineTbl6[8] = {\r\n\t// ===============\r\n\t//   Sample Key : easeInCubic (6)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t    0,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0, -128000,\r\n};\r\n\r\nstatic s32 SplineTbl7[8] = {\r\n\t// ===============\r\n\t//   Sample Key : easeOutQuad (7)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t 128000,\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,      0,\r\n};\r\n\r\n\t// ===============\r\n\t//   Sample Key : easeInOutQuad (8)\r\n\t// ===============\r\n\t//\r\n\t// Need Multi key\r\n\t//\r\n\r\nstatic s32 SplineTbl9[8] = {\r\n\t// ===============\r\n\t//   Sample Key : (9)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t    0,\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0, -192000,\r\n};\r\n\r\nstatic s32 SplineTbl27[8] = {\r\n\t// ===============\r\n\t//   Sample Key : (27)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t-32768,\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,  -192000,\r\n};\r\n\r\nstatic s32 SplineTbl28[8] = {\r\n\t// ===============\r\n\t//   Sample Key : (28)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t256000,\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,  0,\r\n};\r\n\r\n\t// ===============\r\n\t//   Sample Key : (29)\r\n\t// ===============\r\n\t/*\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t256000,\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,  0,\r\n\r\n\t\t//\r\n\t\t8192,   32768,  \r\n\t */\r\n\r\nstatic s32 SplineTbl29[8] = {\r\n\t// ===============\r\n\t//   Sample Key : (29)\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t-65536,\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t    0,  65536,\r\n};\r\n\r\n#define NB_SPLINE\t\t(32)\r\n/* unused\r\n static s32 SplineTbl[2*4*NB_SPLINE] = {\r\n\t// ===============\r\n\t//   Sample Key : Smooth\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t\t0,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t\t0,\t\t0,\r\n\t// ===============\r\n\t//   Sample Key : Overshoot\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t\t0,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t\t0,\t\t0,\r\n\t// ===============\r\n\t//   Sample Key : UnderOvershoot\r\n\t// ===============\r\n\t// Key 1\r\n\t\t// Time, Value, Right, Left\r\n\t\t\t0,\t\t0,\t\t0,\t\t0,\r\n\t// Key 2\r\n\t\t16384,\t65536,\t\t0,\t\t0,\r\n};\r\n*/\r\n\r\nvoid CKLBSplineNode::cleanSplines() {\r\n\tKLBDELETEA(m_allKeys);\r\n\tm_allKeys\t= NULL;\r\n\tKLBDELETEA(m_target);\r\n\tm_target\t= NULL;\r\n\tKLBDELETEA(m_splines);\r\n\tm_splines\t= NULL;\r\n\tKLBDELETEA(m_splinesKeyCount);\r\n\tm_splinesKeyCount = NULL;\r\n//\tKLBDELETEA(m_splineLocalTime);\r\n//\tm_splineLocalTime = NULL;\r\n\tKLBDELETEA(m_splineLastKey);\r\n\tm_splineLastKey = NULL;\r\n}\r\n\r\nbool CKLBSplineNode::setParamCount(u8 splineCount, u8 maxKeyCount) {\r\n\tm_uiTotalTime\t= 0;\r\n\tm_uiMaxKeyCount\t= maxKeyCount;\r\n\r\n\tstop();\r\n\tcleanSplines();\r\n\r\n\tm_allKeys\t\t= KLBNEWA(s32, maxKeyCount * splineCount * 4 * sizeof(s32));\t// Time, Left, Right, Value\r\n\tm_target\t\t= KLBNEWA(u8 , splineCount);\r\n\tm_splinesKeyCount= KLBNEWA(u32 , splineCount);\r\n\tm_splines\t\t= KLBNEWA(s32* , splineCount);\r\n//\tm_splineLocalTime= KLBNEWA(s32 , splineCount);\r\n\tm_splineLastKey\t= KLBNEWA(u16, splineCount);\r\n\r\n\tif (m_allKeys\t&& m_target \r\n\t\t\t\t\t&& m_splinesKeyCount \r\n\t\t\t\t\t&& m_splines \r\n\t\t\t\t\t// && m_splineLocalTime \r\n\t\t\t\t\t&& m_splineLastKey) {\r\n\t\tm_uiSplineCount\t= splineCount;\r\n\r\n\t\tfor (int n = 0; n < splineCount; n++) {\r\n\t\t\tm_splinesKeyCount[n]\t= 0;\r\n\t\t\tm_splines[n]\t\t\t= &m_allKeys[n * maxKeyCount * 4];\r\n\t\t\tm_target[n]\t\t\t\t= 0;\r\n\t\t\t// m_splineLocalTime[n]\t= 0;\r\n\t\t\tm_splineLastKey[n]\t\t= 0;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid CKLBSplineNode::setTarget(u8 splineIndex, u8 targetParameter) {\r\n\tklb_assert(splineIndex < m_uiSplineCount, \"Invalid index\");\r\n\r\n\t// Do not verify target used twice.\r\n\tm_target[splineIndex] = targetParameter;\r\n}\r\n\r\nvoid CKLBSplineNode::addKeys(u8 splineIndex, u32 time, s16 value) {\r\n\taddKeysFixed(splineIndex, time, ((s32)value) << 16);\r\n}\r\n\r\nvoid CKLBSplineNode::addKeysFixed(u8 splineIndex, u32 time, s32 fixedValue) {\r\n\tklb_assert(splineIndex < m_uiSplineCount, \"Invalid index\");\r\n\r\n\t// Find new key index and update key counter\r\n\tu32 idx = m_splinesKeyCount[splineIndex]++;\r\n\r\n\t// Get latest key memory storage\r\n\ts32* vector = m_splines[splineIndex];\t// Select spline\r\n\tvector = &vector[idx * 4];\t\t\t\t// Select vector in spline\r\n\r\n\t// Store time, value\r\n\tvector[0] = (s32)time;\r\n\tvector[1] = fixedValue;\r\n\tvector[2] = 0;\r\n\tvector[3] = 0;\r\n\r\n\tif (time > m_uiTotalTime) {\r\n\t\tm_uiTotalTime = time;\r\n\t}\r\n}\r\n\r\nvoid CKLBSplineNode::generateAnimation() {\r\n\t//\r\n\t// For now ignore mode and support only Catmull-Rom spline\r\n\t//\r\n\tfor (u32 spIdx = 0; spIdx < m_uiSplineCount; spIdx++) {\r\n\t\ts32* vector     = m_splines[spIdx];\r\n\t\tu32  keyCount   = m_splinesKeyCount[spIdx];\r\n\r\n\t\t// From 1..keyCount-2\r\n\t\tfor (u32 kIdx = 1; kIdx < keyCount-1; kIdx++) {\r\n\t\t\ts32 pm1\t\t= vector[((kIdx-1) * 4) + 1];\r\n\t\t\ts32 pp1\t\t= vector[((kIdx+1) * 4) + 1];\r\n\r\n\t\t\ts32 tangent\t= (pp1 - pm1) >> 1;\t// delta / 2\r\n\r\n\t\t\tvector[(kIdx * 4) + 2] = tangent;\r\n\t\t\tvector[(kIdx * 4) + 3] = tangent;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\tvector[0 + 2]\t\t\t\t\t= vector[6];\t\t\t\t\t// P0 Right tangent\r\n\t\tvector[(keyCount-1) * 4 + 3]\t= vector[(keyCount-2) * 4 + 2];\t// Pn Left  tangent\r\n\r\n\t}\r\n\tm_loop\t\t\t\t= false;\r\n\tm_timeMultiplier\t= 256;\r\n\tm_mode\t\t\t\t= 2;\r\n}\r\n\r\nvoid CKLBSplineNode::setAnimation(s32 milliSecondsPlayTime, s32 timeShift, u32 type, s32* keys, u32 keycount, u32 affected, float* arrayParam) {\r\n\tklb_assert(type <= NB_SPLINE, \"Wrong spline type index\");\r\n\r\n\tif (milliSecondsPlayTime == 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\ttimeShift\t\t\t= (timeShift * 16384) / milliSecondsPlayTime;\r\n\r\n\tm_uiLocalTime\t\t= timeShift;\r\n\tm_applyMask\t\t\t= affected;\r\n\tm_uiLooptime\t\t= 16384;\t// Use time dilation.\r\n\tm_timeMultiplier\t= ((16384<<8) / milliSecondsPlayTime);\r\n\r\n\tif (m_applyMask & ANM_X_COORD_0)\t\t{  m_base[0] = arrayParam[0];  m_base[1] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_Y_COORD_1)\t\t{  m_base[2] = arrayParam[0];  m_base[3] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_SCALE_COORD_2)\t{  m_base[4] = arrayParam[0];  m_base[5] = arrayParam[1] - arrayParam[0];\r\n\t\t\t\t\t\t\t\t\t\t\t   m_base[6] = arrayParam[2];  m_base[7] = arrayParam[3] - arrayParam[2]; arrayParam+=4; }\r\n\tif (m_applyMask & ANM_R_COLOR_3)\t\t{  m_base[8] = arrayParam[0];  m_base[9] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_G_COLOR_4)\t\t{ m_base[10] = arrayParam[0]; m_base[11] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_B_COLOR_5)\t\t{ m_base[12] = arrayParam[0]; m_base[13] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_A_COLOR_6)\t\t{ m_base[14] = arrayParam[0]; m_base[15] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_SCALEX_COORD_7)\t{  m_base[4] = arrayParam[0];  m_base[5] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_SCALEY_COORD_8)\t{  m_base[6] = arrayParam[0];  m_base[7] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }\r\n\tif (m_applyMask & ANM_ROTATION_COORD_9)\t{ m_base[16] = arrayParam[0]; m_base[17] = arrayParam[1] - arrayParam[0]; }\r\n\r\n\tm_loop\t\t\t= ((m_applyMask & ANM_LOOPBIT\t) != 0);\r\n\tm_pingpong\t    = ((m_applyMask & ANM_PING_PONG\t) != 0);\r\n\t\r\n\tswitch (type) {\r\n\tcase 0:\t\t\t\r\n\t\tm_aKeyVector        = keys;\r\n\t\tm_uiTotalKeyCount\t= keycount;\r\n\t\tif (keys == NULL) {\r\n\t\t\tm_uiSplineCount = 0;\t// Force node to do nothing.\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 1:\t\t\tm_aKeyVector = SplineTbl1;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 2:\t\t\tm_aKeyVector = SplineTbl2;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 3:\t\t\tm_aKeyVector = SplineTbl3;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 4:\t\t\tm_aKeyVector = SplineTbl4;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 5:\t\t\tm_aKeyVector = SplineTbl5;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 6:\t\t\tm_aKeyVector = SplineTbl6;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 7:\t\t\tm_aKeyVector = SplineTbl7;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 9:\t\t\tm_aKeyVector = SplineTbl9;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 27:\t\tm_aKeyVector = SplineTbl27;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 28:\t\tm_aKeyVector = SplineTbl28;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tcase 29:\t\tm_aKeyVector = SplineTbl29;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\tdefault:\t\tm_aKeyVector = SplineTbl1;\r\n\t\tm_uiTotalKeyCount\t= 2;\r\n\t\tbreak;\r\n\t}\r\n\r\n\tm_uiLastLocalTime\t= -timeShift;\r\n\tm_uiLastKey\t\t\t= 0;\r\n\tm_startTime\t\t\t= m_uiLastLocalTime;\r\n\tm_uiTotalTime\t\t= 16384;\r\n\tm_uiSplineCount\t\t= 1;\r\n\tm_mode\t\t\t\t= 1;\r\n}\r\n\r\nvoid CKLBSplineNode::endAnimation(s32* keys) {\r\n\tif ((keys == NULL) || (keys == m_aKeyVector)) {\r\n\t\tm_uiLastLocalTime\t= m_uiTotalTime;\r\n\t\tm_loop\t\t\t\t= false;\r\n\t}\r\n}\r\n\r\nvoid CKLBSplineNode::play() {\r\n\t// Reset counter.\r\n\tm_uiLocalTime\t\t= m_startTime;\r\n\tm_uiLastLocalTime\t= m_startTime;\r\n\tm_uiLastKey\t\t\t= 0;\r\n\r\n\tif (!this->isAnimating()) {\r\n\t\tthis->m_status |= ANIMATED;\r\n\t\tCKLBSystem::addToAnimation(this);\r\n\t}\r\n}\r\n\r\nvoid CKLBSplineNode::stop() {\r\n\tif (this->isAnimating()) {\r\n\t\tthis->m_status &= ~ANIMATED;\r\n\t\tCKLBSystem::removeFromAnimation(this);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBSplineNode::animate(u32 deltaTimeMilli) {\r\n\ts32 uiIdx;\r\n\r\n\ts32 uiDt;\r\n\t\r\n\t// Add delta to time\r\n\tm_uiLocalTime += (((s32)deltaTimeMilli * m_timeMultiplier)>>8);\r\n\r\n\t// If time is negative (offset) avoid modification the node as animation.\r\n\ts32 time = m_uiLocalTime;\r\n\tif (time < 0) {\r\n\t\ttime = 0;\r\n\t}\r\n\r\n\t// Perform each spline.\r\n\tfor (u32 n = 0; n < m_uiSplineCount; n++) {\r\n\t\ts32* pData;\r\n\t\ts32 uiMaxSize;\r\n\r\n\t\tif (m_mode == 1) {\r\n\t\t\tpData\t\t= m_aKeyVector;\r\n\t\t\tuiMaxSize\t= m_uiTotalKeyCount * VECTORSIZE;\r\n\t\t} else {\r\n\t\t\tpData\t\t= (s32*)m_splines[n];\r\n\t\t\tuiMaxSize\t= (m_splinesKeyCount[n] * VECTORSIZE);\r\n\t\t}\r\n\r\n\t\tif (time < m_uiLastLocalTime) {\r\n\t\t\t// First time, or time backward.\r\n\t\t\tuiIdx = VECTORSIZE;\r\n\t\t} else {\r\n\t\t\tif (m_mode == 1) {\r\n\t\t\t\tif (m_uiLastKey<VECTORSIZE) {\r\n\t\t\t\t\tm_uiLastKey = VECTORSIZE;\r\n\t\t\t\t}\r\n\t\t\t\tuiIdx = m_uiLastKey;\r\n\t\t\t} else {\r\n\t\t\t\tif (m_splineLastKey[n]<VECTORSIZE) {\r\n\t\t\t\t\tm_splineLastKey[n] = VECTORSIZE;\r\n\t\t\t\t}\r\n\t\t\t\tuiIdx = m_splineLastKey[n];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Find Start Key\r\n\t\t//\r\n\t\twhile ((uiIdx<uiMaxSize) && (pData[uiIdx] < (s32)time)) {\r\n\t\t\tuiIdx += VECTORSIZE;\r\n\t\t}\r\n\r\n\t\tbool isEnd = false;\r\n\r\n\t\tif (uiIdx>=uiMaxSize) {\r\n\t\t\tisEnd   = true;\r\n\t\t\tuiIdx   = uiMaxSize;\r\n\t\t}\r\n\r\n\t\tif (!isEnd) {\r\n\t\t\t// Compute the time % between 2 keys.\r\n\t\t\ts32 localTime\t= /*m_uiLocalTime < 0 ? 0 : */time;\r\n\t\t\ts32 delta\t\t= (pData[uiIdx] - pData[uiIdx-VECTORSIZE]);\r\n\t\t\tif (delta) {\r\n\t\t\t\tuiDt\t\t= ((localTime - pData[uiIdx-VECTORSIZE])<<9) / delta;\r\n\t\t\t} else {\r\n\t\t\t\tuiDt\t\t= 0;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tuiDt = 0;\r\n\t\t}\r\n\r\n\t\t// Go back to previous vector.\r\n\t\tuiIdx -= VECTORSIZE;\r\n\r\n\t\t// Save Last Key.\r\n\t\tif (m_mode == 1) {\r\n\t\t\tm_uiLastKey = uiIdx;\r\n\t\t} else {\r\n\t\t\tm_splineLastKey[n] = uiIdx;\r\n\t\t}\r\n\r\n\t\t// Go to first vector element.\r\n\t\tuiIdx++;\r\n\r\n\t\t//\r\n\t\t// Computation of vector and assignment to output.\r\n\t\t//\r\n\t\ts32 value    = interpolateKey(uiDt, &pData[uiIdx]);\r\n\t\tfloat fValue = value / 65535.0f;\r\n\r\n\t\tbool modColor = false;\r\n\r\n\t\tif (m_mode == 1) {\r\n\t\t\tbool modifCoord = ((m_applyMask & (ANM_X_COORD_0 | ANM_Y_COORD_1)) != 0); \r\n\t\t\tif (modifCoord) {\r\n\t\t\t\tfloat tx = (m_applyMask & ANM_X_COORD_0) ? m_base[0] + (m_base[1] * fValue) : this->m_matrix.m_matrix[MAT_TX];\r\n\t\t\t\tfloat ty = (m_applyMask & ANM_Y_COORD_1) ? m_base[2] + (m_base[3] * fValue) : this->m_matrix.m_matrix[MAT_TY];\r\n\r\n\t\t\t\tthis->setTranslate(tx,ty);\r\n\t\t\t}\r\n\r\n\t\t\tbool modifRot = (m_applyMask & ANM_ROTATION_COORD_9) != 0;\r\n\t\t\tif (m_applyMask & (ANM_SCALE_COORD_2 | ANM_SCALEX_COORD_7 | ANM_SCALEY_COORD_8)) {\r\n\t\t\t\tif (modifRot) {\r\n\t\t\t\t\tthis->setScaleRotation(\tm_base[4]  + (m_base[5]  * fValue),\r\n\t\t\t\t\t\t\t\t\t\t\tm_base[6]  + (m_base[7]  * fValue),\r\n\t\t\t\t\t\t\t\t\t\t\tm_base[16] + (m_base[17] * fValue)\r\n\t\t\t\t\t\t\t\t\t\t  );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis->setScale(\tm_base[4] + (m_base[5] * fValue),\r\n\t\t\t\t\t\t\t\t\tm_base[6] + (m_base[7] * fValue));\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (modifRot) {\r\n\t\t\t\t\tthis->setRotation(m_base[16] + (m_base[17] * fValue));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (m_applyMask & (ANM_R_COLOR_3 | ANM_G_COLOR_4 | ANM_B_COLOR_5 | ANM_A_COLOR_6)) \r\n\t\t\t{\r\n\t\t\t\tmodColor = true;\r\n\t\t\t\tif (m_applyMask & ANM_R_COLOR_3) { m_localColorMatrix.m_vector[0] = m_base[8 ] + (m_base[9 ] * fValue); }\r\n\t\t\t\tif (m_applyMask & ANM_G_COLOR_4) { m_localColorMatrix.m_vector[1] = m_base[10] + (m_base[11] * fValue); }\r\n\t\t\t\tif (m_applyMask & ANM_B_COLOR_5) { m_localColorMatrix.m_vector[2] = m_base[12] + (m_base[13] * fValue); }\r\n\t\t\t\tif (m_applyMask & ANM_A_COLOR_6) { m_localColorMatrix.m_vector[3] = m_base[14] + (m_base[15] * fValue); }\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\t\t\tswitch (m_target[n]) {\r\n\t\t\tcase MODIFY_X:\r\n\t\t\t\tthis->setTranslate(fValue,m_matrix.m_matrix[MAT_TY]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_Y:\r\n\t\t\t\tthis->setTranslate(m_matrix.m_matrix[MAT_TX],fValue);\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_SCALE:\r\n\t\t\t\tthis->setScale(fValue,fValue);\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_R:\r\n\t\t\t\tm_localColorMatrix.m_vector[0] = fValue;\r\n\t\t\t\tmodColor = true;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_G:\r\n\t\t\t\tm_localColorMatrix.m_vector[1] = fValue;\r\n\t\t\t\tmodColor = true;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_B:\r\n\t\t\t\tm_localColorMatrix.m_vector[2] = fValue;\r\n\t\t\t\tmodColor = true;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_A:\r\n\t\t\t\tm_localColorMatrix.m_vector[3] = fValue;\r\n\t\t\t\tmodColor = true;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MODIFY_ROT:\r\n\t\t\t\tthis->setRotation(fValue);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (modColor)\r\n\t\t{\r\n\t\t\tthis->m_status |= CMATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\r\n\t\t\tif (\t(m_localColorMatrix.m_vector[0] != 1.0f) || \r\n\t\t\t\t\t(m_localColorMatrix.m_vector[1] != 1.0f) || \r\n\t\t\t\t\t(m_localColorMatrix.m_vector[2] != 1.0f) || \r\n\t\t\t\t\t(m_localColorMatrix.m_vector[3] != 1.0f) ) {\r\n\t\t\t\tm_pColorMatrix\t\t= &m_colorMatrix;\r\n\t\t\t\tm_useParentColor\t= false;\r\n\t\t\t} else {\r\n\t\t\t\tm_pColorMatrix\t\t= this->m_parent->m_pColorMatrix;\r\n\t\t\t\tm_useParentColor\t= true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tm_uiLastLocalTime = m_uiLocalTime;\r\n\r\n\t// 1/ Animation Ends : loop = false, pingpong = false\r\n\t// 2/ \r\n\tbool terminate = false;\r\n\r\n\tif (m_loop) {\r\n\t\tif (m_uiLocalTime >= m_uiTotalTime) {\r\n\t\t\tif (m_pingpong) {\r\n\t\t\t\tm_timeMultiplier = -m_timeMultiplier;\r\n\t\t\t\tm_uiLocalTime = (m_uiTotalTime<<1) - m_uiLocalTime; \r\n\t\t\t} else {\r\n\t\t\t\tm_uiLocalTime -= m_uiTotalTime; // Loop\r\n\t\t\t}\r\n\t\t} else if ((m_pingpong) && (m_timeMultiplier < 0) && (time == 0)) {\r\n\t\t\tm_timeMultiplier = -m_timeMultiplier;\r\n\t\t\tm_uiLocalTime = -m_uiLocalTime;\r\n\t\t}\r\n\t} else {\r\n\t\tif (m_pingpong) {\r\n\t\t\tif ((m_timeMultiplier < 0) && (time == 0)) {\r\n\t\t\t\tterminate = true;\r\n\t\t\t} else\r\n\t\t\tif (m_uiLocalTime >= m_uiTotalTime) {\r\n\t\t\t\t// Go to negative direction.\r\n\t\t\t\tm_timeMultiplier = -m_timeMultiplier;\r\n\t\t\t\t// Local = Total - (Local - Total) = Total - Local + Total = 2*Total - Local\r\n\t\t\t\tm_uiLocalTime = (m_uiTotalTime<<1) - m_uiLocalTime; \r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_uiLocalTime >= m_uiTotalTime) {\r\n\t\t\t\tterminate = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (terminate) {\r\n\t\tif (m_refCounter) {\r\n\t\t\t*m_refCounter = *m_refCounter - 1;\r\n\t\t\tm_refCounter = NULL;\r\n\t\t}\r\n\r\n\t\tCKLBSystem::removeFromAnimation(this);\r\n\t\t// Trick : Avoid visible / unvisible to add/remove again to animation. Delete bit.\r\n\t\tthis->m_status &= ~ANIMATED;\r\n\r\n\t\tif (m_applyMask & ANM_REMOVESCENE) {\t// Before destruct in case both bit are set.\r\n\t\t\tthis->m_parent->removeNode(this);\r\n\t\t}\r\n\r\n\t\tif (m_msgListener) {\r\n\t\t\tm_msgListener->receiveMsg(this, ANIMATION_COMPLETE, m_uiLocalTime);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#define TBLRESOLUTIONBIT\t(15)\r\n\r\nstatic const u16 HermiteTbl[513*4] = {\r\n\t32768,\t0,\t\t0,\t\t0,\t \r\n\t32767,\t63,\t\t1,\t\t0,\t \r\n\t32766,\t127,\t2,\t\t0,\t \r\n\t32764,\t189,\t4,\t\t1,\t \r\n\t32762,\t252,\t6,\t\t1,\t \r\n\t32758,\t313,\t10,\t\t3,\t \r\n\t32754,\t375,\t14,\t\t4,\t \r\n\t32749,\t435,\t19,\t\t6,\t \r\n\t32744,\t496,\t24,\t\t7,\t \r\n\t32737,\t555,\t31,\t\t9,\t \r\n\t32730,\t615,\t38,\t\t12,\t \r\n\t32723,\t674,\t45,\t\t14,\t \r\n\t32714,\t732,\t54,\t\t17,\t \r\n\t32705,\t790,\t63,\t\t20,\t \r\n\t32695,\t847,\t73,\t\t23,\t \r\n\t32685,\t904,\t83,\t\t27,\t \r\n\t32674,\t961,\t94,\t\t31,\t \r\n\t32662,\t1016,\t106,\t34,\t \r\n\t32649,\t1072,\t119,\t39,\t \r\n\t32635,\t1127,\t133,\t43,\t \r\n\t32621,\t1181,\t147,\t48,\t \r\n\t32607,\t1236,\t161,\t52,\t \r\n\t32591,\t1289,\t177,\t57,\t \r\n\t32575,\t1342,\t193,\t63,\t \r\n\t32558,\t1395,\t210,\t68,\t \r\n\t32541,\t1447,\t227,\t74,\t \r\n\t32523,\t1499,\t245,\t80,\t \r\n\t32504,\t1550,\t264,\t86,\t \r\n\t32484,\t1601,\t284,\t92,\t \r\n\t32464,\t1651,\t304,\t99,\t \r\n\t32443,\t1701,\t325,\t105,\t\r\n\t32422,\t1751,\t346,\t112,\t\r\n\t32400,\t1800,\t368,\t120,\t\r\n\t32377,\t1848,\t391,\t127,\t\r\n\t32353,\t1896,\t415,\t134,\t\r\n\t32329,\t1944,\t439,\t142,\t\r\n\t32304,\t1991,\t464,\t150,\t\r\n\t32279,\t2038,\t489,\t158,\t\r\n\t32253,\t2084,\t515,\t167,\t\r\n\t32226,\t2130,\t542,\t175,\t\r\n\t32199,\t2175,\t569,\t184,\t\r\n\t32171,\t2220,\t597,\t193,\t\r\n\t32142,\t2265,\t626,\t202,\t\r\n\t32113,\t2309,\t655,\t211,\t\r\n\t32083,\t2352,\t685,\t221,\t\r\n\t32053,\t2395,\t715,\t230,\t\r\n\t32022,\t2438,\t746,\t240,\t\r\n\t31990,\t2481,\t778,\t250,\t\r\n\t31958,\t2523,\t810,\t261,\t\r\n\t31925,\t2564,\t843,\t271,\t\r\n\t31891,\t2605,\t877,\t281,\t\r\n\t31857,\t2646,\t911,\t292,\t\r\n\t31822,\t2686,\t946,\t303,\t\r\n\t31787,\t2726,\t981,\t314,\t\r\n\t31751,\t2765,\t1017,\t326,\t\r\n\t31714,\t2804,\t1054,\t337,\t\r\n\t31677,\t2842,\t1091,\t349,\t\r\n\t31640,\t2880,\t1128,\t360,\t\r\n\t31601,\t2918,\t1167,\t372,\t\r\n\t31562,\t2955,\t1206,\t384,\t\r\n\t31523,\t2992,\t1245,\t397,\t\r\n\t31483,\t3029,\t1285,\t409,\t\r\n\t31442,\t3065,\t1326,\t422,\t\r\n\t31401,\t3100,\t1367,\t435,\t\r\n\t31360,\t3136,\t1408,\t448,\t\r\n\t31317,\t3170,\t1451,\t461,\t\r\n\t31274,\t3205,\t1494,\t474,\t\r\n\t31231,\t3239,\t1537,\t487,\t\r\n\t31187,\t3272,\t1581,\t501,\t\r\n\t31143,\t3305,\t1625,\t514,\t\r\n\t31097,\t3338,\t1671,\t528,\t\r\n\t31052,\t3371,\t1716,\t542,\t\r\n\t31006,\t3403,\t1762,\t556,\t\r\n\t30959,\t3434,\t1809,\t571,\t\r\n\t30912,\t3465,\t1856,\t585,\t\r\n\t30864,\t3496,\t1904,\t600,\t\r\n\t30816,\t3527,\t1952,\t614,\t\r\n\t30767,\t3557,\t2001,\t629,\t\r\n\t30718,\t3586,\t2050,\t644,\t\r\n\t30668,\t3616,\t2100,\t659,\t\r\n\t30618,\t3645,\t2150,\t675,\t\r\n\t30567,\t3673,\t2201,\t690,\t\r\n\t30515,\t3701,\t2253,\t705,\t\r\n\t30463,\t3729,\t2305,\t721,\t\r\n\t30411,\t3756,\t2357,\t737,\t\r\n\t30358,\t3783,\t2410,\t753,\t\r\n\t30305,\t3810,\t2463,\t769,\t\r\n\t30251,\t3836,\t2517,\t785,\t\r\n\t30196,\t3862,\t2572,\t801,\t\r\n\t30141,\t3887,\t2627,\t818,\t\r\n\t30086,\t3912,\t2682,\t834,\t\r\n\t30030,\t3937,\t2738,\t851,\t\r\n\t29974,\t3962,\t2794,\t867,\t\r\n\t29917,\t3986,\t2851,\t884,\t\r\n\t29860,\t4009,\t2908,\t901,\t\r\n\t29802,\t4033,\t2966,\t918,\t\r\n\t29744,\t4056,\t3024,\t936,\t\r\n\t29685,\t4078,\t3083,\t953,\t\r\n\t29626,\t4100,\t3142,\t970,\t\r\n\t29566,\t4122,\t3202,\t988,\t\r\n\t29506,\t4144,\t3262,\t1005,\t\r\n\t29445,\t4165,\t3323,\t1023,\t\r\n\t29384,\t4186,\t3384,\t1041,\t\r\n\t29323,\t4206,\t3445,\t1059,\t\r\n\t29261,\t4226,\t3507,\t1077,\t\r\n\t29198,\t4246,\t3570,\t1095,\t\r\n\t29136,\t4265,\t3632,\t1113,\t\r\n\t29072,\t4284,\t3696,\t1132,\t\r\n\t29009,\t4303,\t3759,\t1150,\t\r\n\t28944,\t4321,\t3824,\t1168,\t\r\n\t28880,\t4339,\t3888,\t1187,\t\r\n\t28815,\t4357,\t3953,\t1206,\t\r\n\t28750,\t4375,\t4018,\t1225,\t\r\n\t28684,\t4392,\t4084,\t1243,\t\r\n\t28617,\t4408,\t4151,\t1262,\t\r\n\t28551,\t4425,\t4217,\t1281,\t\r\n\t28484,\t4441,\t4284,\t1300,\t\r\n\t28416,\t4456,\t4352,\t1320,\t\r\n\t28348,\t4472,\t4420,\t1339,\t\r\n\t28280,\t4487,\t4488,\t1358,\t\r\n\t28211,\t4501,\t4557,\t1378,\t\r\n\t28142,\t4516,\t4626,\t1397,\t\r\n\t28073,\t4530,\t4695,\t1417,\t\r\n\t28003,\t4544,\t4765,\t1436,\t\r\n\t27932,\t4557,\t4836,\t1456,\t\r\n\t27862,\t4570,\t4906,\t1476,\t\r\n\t27791,\t4583,\t4977,\t1496,\t\r\n\t27719,\t4595,\t5049,\t1516,\t\r\n\t27648,\t4608,\t5120,\t1536,\t\r\n\t27575,\t4619,\t5193,\t1556,\t\r\n\t27503,\t4631,\t5265,\t1576,\t\r\n\t27430,\t4642,\t5338,\t1596,\t\r\n\t27357,\t4653,\t5411,\t1616,\t\r\n\t27283,\t4664,\t5485,\t1636,\t\r\n\t27209,\t4674,\t5559,\t1657,\t\r\n\t27134,\t4684,\t5634,\t1677,\t\r\n\t27060,\t4694,\t5708,\t1697,\t\r\n\t26985,\t4703,\t5783,\t1718,\t\r\n\t26909,\t4712,\t5859,\t1738,\t\r\n\t26833,\t4721,\t5935,\t1759,\t\r\n\t26757,\t4729,\t6011,\t1780,\t\r\n\t26681,\t4738,\t6087,\t1800,\t\r\n\t26604,\t4746,\t6164,\t1821,\t\r\n\t26527,\t4753,\t6241,\t1842,\t\r\n\t26450,\t4761,\t6318,\t1863,\t\r\n\t26372,\t4768,\t6396,\t1883,\t\r\n\t26294,\t4774,\t6474,\t1904,\t\r\n\t26215,\t4781,\t6553,\t1925,\t\r\n\t26136,\t4787,\t6632,\t1946,\t\r\n\t26057,\t4793,\t6711,\t1967,\t\r\n\t25978,\t4798,\t6790,\t1988,\t\r\n\t25898,\t4804,\t6870,\t2009,\t\r\n\t25818,\t4809,\t6950,\t2030,\t\r\n\t25738,\t4814,\t7030,\t2051,\t\r\n\t25657,\t4818,\t7111,\t2072,\t\r\n\t25576,\t4822,\t7192,\t2093,\t\r\n\t25495,\t4826,\t7273,\t2115,\t\r\n\t25414,\t4830,\t7354,\t2136,\t\r\n\t25332,\t4833,\t7436,\t2157,\t\r\n\t25250,\t4837,\t7518,\t2178,\t\r\n\t25168,\t4840,\t7600,\t2200,\t\r\n\t25085,\t4842,\t7683,\t2221,\t\r\n\t25002,\t4844,\t7766,\t2242,\t\r\n\t24919,\t4847,\t7849,\t2263,\t\r\n\t24835,\t4848,\t7933,\t2285,\t\r\n\t24752,\t4850,\t8016,\t2306,\t\r\n\t24668,\t4851,\t8100,\t2327,\t\r\n\t24583,\t4852,\t8185,\t2349,\t\r\n\t24499,\t4853,\t8269,\t2370,\t\r\n\t24414,\t4854,\t8354,\t2391,\t\r\n\t24329,\t4854,\t8439,\t2413,\t\r\n\t24244,\t4854,\t8524,\t2434,\t\r\n\t24158,\t4854,\t8610,\t2455,\t\r\n\t24072,\t4853,\t8696,\t2477,\t\r\n\t23986,\t4853,\t8782,\t2498,\t\r\n\t23900,\t4852,\t8868,\t2519,\t\r\n\t23814,\t4851,\t8954,\t2541,\t\r\n\t23727,\t4849,\t9041,\t2562,\t\r\n\t23640,\t4847,\t9128,\t2583,\t\r\n\t23553,\t4845,\t9215,\t2604,\t\r\n\t23465,\t4843,\t9303,\t2626,\t\r\n\t23378,\t4841,\t9390,\t2647,\t\r\n\t23290,\t4838,\t9478,\t2668,\t\r\n\t23202,\t4835,\t9566,\t2689,\t\r\n\t23113,\t4832,\t9655,\t2711,\t\r\n\t23025,\t4829,\t9743,\t2732,\t\r\n\t22936,\t4826,\t9832,\t2753,\t\r\n\t22847,\t4822,\t9921,\t2774,\t\r\n\t22758,\t4818,\t10010,\t2795,\t\r\n\t22669,\t4814,\t10099,\t2816,\t\r\n\t22579,\t4809,\t10189,\t2837,\t\r\n\t22489,\t4804,\t10279,\t2858,\t\r\n\t22400,\t4800,\t10368,\t2880,\t\r\n\t22309,\t4794,\t10459,\t2900,\t\r\n\t22219,\t4789,\t10549,\t2921,\t\r\n\t22129,\t4784,\t10639,\t2942,\t\r\n\t22038,\t4778,\t10730,\t2963,\t\r\n\t21947,\t4772,\t10821,\t2984,\t\r\n\t21856,\t4766,\t10912,\t3005,\t\r\n\t21765,\t4759,\t11003,\t3026,\t\r\n\t21674,\t4753,\t11094,\t3046,\t\r\n\t21582,\t4746,\t11186,\t3067,\t\r\n\t21491,\t4739,\t11277,\t3088,\t\r\n\t21399,\t4732,\t11369,\t3108,\t\r\n\t21307,\t4724,\t11461,\t3129,\t\r\n\t21215,\t4717,\t11553,\t3149,\t\r\n\t21122,\t4709,\t11646,\t3170,\t\r\n\t21030,\t4701,\t11738,\t3190,\t\r\n\t20938,\t4693,\t11830,\t3211,\t\r\n\t20845,\t4684,\t11923,\t3231,\t\r\n\t20752,\t4675,\t12016,\t3251,\t\r\n\t20659,\t4667,\t12109,\t3271,\t\r\n\t20566,\t4658,\t12202,\t3291,\t\r\n\t20473,\t4649,\t12295,\t3311,\t\r\n\t20379,\t4639,\t12389,\t3331,\t\r\n\t20286,\t4630,\t12482,\t3351,\t\r\n\t20192,\t4620,\t12576,\t3371,\t\r\n\t20099,\t4610,\t12669,\t3391,\t\r\n\t20005,\t4600,\t12763,\t3411,\t\r\n\t19911,\t4590,\t12857,\t3430,\t\r\n\t19817,\t4579,\t12951,\t3450,\t\r\n\t19723,\t4568,\t13045,\t3469,\t\r\n\t19628,\t4558,\t13140,\t3489,\t\r\n\t19534,\t4547,\t13234,\t3508,\t\r\n\t19440,\t4536,\t13328,\t3528,\t\r\n\t19345,\t4524,\t13423,\t3547,\t\r\n\t19250,\t4513,\t13518,\t3566,\t\r\n\t19156,\t4501,\t13612,\t3585,\t\r\n\t19061,\t4489,\t13707,\t3604,\t\r\n\t18966,\t4477,\t13802,\t3623,\t\r\n\t18871,\t4465,\t13897,\t3642,\t\r\n\t18776,\t4453,\t13992,\t3660,\t\r\n\t18681,\t4440,\t14087,\t3679,\t\r\n\t18586,\t4427,\t14182,\t3697,\t\r\n\t18490,\t4415,\t14278,\t3716,\t\r\n\t18395,\t4402,\t14373,\t3734,\t\r\n\t18300,\t4389,\t14468,\t3752,\t\r\n\t18204,\t4375,\t14564,\t3771,\t\r\n\t18109,\t4362,\t14659,\t3789,\t\r\n\t18013,\t4348,\t14755,\t3807,\t\r\n\t17918,\t4335,\t14850,\t3825,\t\r\n\t17822,\t4321,\t14946,\t3842,\t\r\n\t17726,\t4307,\t15042,\t3860,\t\r\n\t17630,\t4292,\t15138,\t3877,\t\r\n\t17535,\t4278,\t15233,\t3895,\t\r\n\t17439,\t4264,\t15329,\t3912,\t\r\n\t17343,\t4249,\t15425,\t3929,\t\r\n\t17247,\t4234,\t15521,\t3947,\t\r\n\t17151,\t4219,\t15617,\t3964,\t\r\n\t17055,\t4204,\t15713,\t3981,\t\r\n\t16959,\t4189,\t15809,\t3997,\t\r\n\t16863,\t4174,\t15905,\t4014,\t\r\n\t16767,\t4158,\t16001,\t4031,\t\r\n\t16671,\t4143,\t16097,\t4047,\t\r\n\t16575,\t4127,\t16193,\t4063,\t\r\n\t16479,\t4111,\t16289,\t4079,\t\r\n\t16384,\t4096,\t16384,\t4096,\t\r\n\t16288,\t4079,\t16480,\t4111,\t\r\n\t16192,\t4063,\t16576,\t4127,\t\r\n\t16096,\t4047,\t16672,\t4143,\t\r\n\t16000,\t4031,\t16768,\t4158,\t\r\n\t15904,\t4014,\t16864,\t4174,\t\r\n\t15808,\t3997,\t16960,\t4189,\t\r\n\t15712,\t3981,\t17056,\t4204,\t\r\n\t15616,\t3964,\t17152,\t4219,\t\r\n\t15520,\t3947,\t17248,\t4234,\t\r\n\t15424,\t3929,\t17344,\t4249,\t\r\n\t15328,\t3912,\t17440,\t4264,\t\r\n\t15232,\t3895,\t17536,\t4278,\t\r\n\t15137,\t3877,\t17631,\t4292,\t\r\n\t15041,\t3860,\t17727,\t4307,\t\r\n\t14945,\t3842,\t17823,\t4321,\t\r\n\t14850,\t3825,\t17918,\t4335,\t\r\n\t14754,\t3807,\t18014,\t4348,\t\r\n\t14658,\t3789,\t18110,\t4362,\t\r\n\t14563,\t3771,\t18205,\t4375,\t\r\n\t14467,\t3752,\t18301,\t4389,\t\r\n\t14372,\t3734,\t18396,\t4402,\t\r\n\t14277,\t3716,\t18491,\t4415,\t\r\n\t14181,\t3697,\t18587,\t4427,\t\r\n\t14086,\t3679,\t18682,\t4440,\t\r\n\t13991,\t3660,\t18777,\t4453,\t\r\n\t13896,\t3642,\t18872,\t4465,\t\r\n\t13801,\t3623,\t18967,\t4477,\t\r\n\t13706,\t3604,\t19062,\t4489,\t\r\n\t13611,\t3585,\t19157,\t4501,\t\r\n\t13517,\t3566,\t19251,\t4513,\t\r\n\t13422,\t3547,\t19346,\t4524,\t\r\n\t13328,\t3528,\t19440,\t4536,\t\r\n\t13233,\t3508,\t19535,\t4547,\t\r\n\t13139,\t3489,\t19629,\t4558,\t\r\n\t13044,\t3469,\t19724,\t4568,\t\r\n\t12950,\t3450,\t19818,\t4579,\t\r\n\t12856,\t3430,\t19912,\t4590,\t\r\n\t12762,\t3411,\t20006,\t4600,\t\r\n\t12668,\t3391,\t20100,\t4610,\t\r\n\t12575,\t3371,\t20193,\t4620,\t\r\n\t12481,\t3351,\t20287,\t4630,\t\r\n\t12388,\t3331,\t20380,\t4639,\t\r\n\t12294,\t3311,\t20474,\t4649,\t\r\n\t12201,\t3291,\t20567,\t4658,\t\r\n\t12108,\t3271,\t20660,\t4667,\t\r\n\t12015,\t3251,\t20753,\t4675,\t\r\n\t11922,\t3231,\t20846,\t4684,\t\r\n\t11830,\t3211,\t20938,\t4693,\t\r\n\t11737,\t3190,\t21031,\t4701,\t\r\n\t11645,\t3170,\t21123,\t4709,\t\r\n\t11552,\t3149,\t21216,\t4717,\t\r\n\t11460,\t3129,\t21308,\t4724,\t\r\n\t11368,\t3108,\t21400,\t4732,\t\r\n\t11276,\t3088,\t21492,\t4739,\t\r\n\t11185,\t3067,\t21583,\t4746,\t\r\n\t11093,\t3046,\t21675,\t4753,\t\r\n\t11002,\t3026,\t21766,\t4759,\t\r\n\t10911,\t3005,\t21857,\t4766,\t\r\n\t10820,\t2984,\t21948,\t4772,\t\r\n\t10729,\t2963,\t22039,\t4778,\t\r\n\t10638,\t2942,\t22130,\t4784,\t\r\n\t10548,\t2921,\t22220,\t4789,\t\r\n\t10458,\t2900,\t22310,\t4794,\t\r\n\t10368,\t2880,\t22400,\t4800,\t\r\n\t10278,\t2858,\t22490,\t4804,\t\r\n\t10188,\t2837,\t22580,\t4809,\t\r\n\t10098,\t2816,\t22670,\t4814,\t\r\n\t10009,\t2795,\t22759,\t4818,\t\r\n\t9920,\t2774,\t22848,\t4822,\t\r\n\t9831,\t2753,\t22937,\t4826,\t\r\n\t9742,\t2732,\t23026,\t4829,\t\r\n\t9654,\t2711,\t23114,\t4832,\t\r\n\t9565,\t2689,\t23203,\t4835,\t\r\n\t9477,\t2668,\t23291,\t4838,\t\r\n\t9389,\t2647,\t23379,\t4841,\t\r\n\t9302,\t2626,\t23466,\t4843,\t\r\n\t9214,\t2604,\t23554,\t4845,\t\r\n\t9127,\t2583,\t23641,\t4847,\t\r\n\t9040,\t2562,\t23728,\t4849,\t\r\n\t8954,\t2541,\t23814,\t4851,\t\r\n\t8867,\t2519,\t23901,\t4852,\t\r\n\t8781,\t2498,\t23987,\t4853,\t\r\n\t8695,\t2477,\t24073,\t4853,\t\r\n\t8609,\t2455,\t24159,\t4854,\t\r\n\t8523,\t2434,\t24245,\t4854,\t\r\n\t8438,\t2413,\t24330,\t4854,\t\r\n\t8353,\t2391,\t24415,\t4854,\t\r\n\t8268,\t2370,\t24500,\t4853,\t\r\n\t8184,\t2349,\t24584,\t4852,\t\r\n\t8099,\t2327,\t24669,\t4851,\t\r\n\t8015,\t2306,\t24753,\t4850,\t\r\n\t7932,\t2285,\t24836,\t4848,\t\r\n\t7848,\t2263,\t24920,\t4847,\t\r\n\t7765,\t2242,\t25003,\t4844,\t\r\n\t7682,\t2221,\t25086,\t4842,\t\r\n\t7600,\t2200,\t25168,\t4840,\t\r\n\t7517,\t2178,\t25251,\t4837,\t\r\n\t7435,\t2157,\t25333,\t4833,\t\r\n\t7353,\t2136,\t25415,\t4830,\t\r\n\t7272,\t2115,\t25496,\t4826,\t\r\n\t7191,\t2093,\t25577,\t4822,\t\r\n\t7110,\t2072,\t25658,\t4818,\t\r\n\t7029,\t2051,\t25739,\t4814,\t\r\n\t6949,\t2030,\t25819,\t4809,\t\r\n\t6869,\t2009,\t25899,\t4804,\t\r\n\t6789,\t1988,\t25979,\t4798,\t\r\n\t6710,\t1967,\t26058,\t4793,\t\r\n\t6631,\t1946,\t26137,\t4787,\t\r\n\t6552,\t1925,\t26216,\t4781,\t\r\n\t6473,\t1904,\t26295,\t4774,\t\r\n\t6395,\t1883,\t26373,\t4768,\t\r\n\t6318,\t1863,\t26450,\t4761,\t\r\n\t6240,\t1842,\t26528,\t4753,\t\r\n\t6163,\t1821,\t26605,\t4746,\t\r\n\t6086,\t1800,\t26682,\t4738,\t\r\n\t6010,\t1780,\t26758,\t4729,\t\r\n\t5934,\t1759,\t26834,\t4721,\t\r\n\t5858,\t1738,\t26910,\t4712,\t\r\n\t5782,\t1718,\t26986,\t4703,\t\r\n\t5707,\t1697,\t27061,\t4694,\t\r\n\t5633,\t1677,\t27135,\t4684,\t\r\n\t5558,\t1657,\t27210,\t4674,\t\r\n\t5484,\t1636,\t27284,\t4664,\t\r\n\t5410,\t1616,\t27358,\t4653,\t\r\n\t5337,\t1596,\t27431,\t4642,\t\r\n\t5264,\t1576,\t27504,\t4631,\t\r\n\t5192,\t1556,\t27576,\t4619,\t\r\n\t5120,\t1536,\t27648,\t4608,\t\r\n\t5048,\t1516,\t27720,\t4595,\t\r\n\t4976,\t1496,\t27792,\t4583,\t\r\n\t4905,\t1476,\t27863,\t4570,\t\r\n\t4835,\t1456,\t27933,\t4557,\t\r\n\t4764,\t1436,\t28004,\t4544,\t\r\n\t4694,\t1417,\t28074,\t4530,\t\r\n\t4625,\t1397,\t28143,\t4516,\t\r\n\t4556,\t1378,\t28212,\t4501,\t\r\n\t4487,\t1358,\t28281,\t4487,\t\r\n\t4419,\t1339,\t28349,\t4472,\t\r\n\t4351,\t1320,\t28417,\t4456,\t\r\n\t4283,\t1300,\t28485,\t4441,\t\r\n\t4216,\t1281,\t28552,\t4425,\t\r\n\t4150,\t1262,\t28618,\t4408,\t\r\n\t4083,\t1243,\t28685,\t4392,\t\r\n\t4018,\t1225,\t28750,\t4375,\t\r\n\t3952,\t1206,\t28816,\t4357,\t\r\n\t3887,\t1187,\t28881,\t4339,\t\r\n\t3823,\t1168,\t28945,\t4321,\t\r\n\t3758,\t1150,\t29010,\t4303,\t\r\n\t3695,\t1132,\t29073,\t4284,\t\r\n\t3631,\t1113,\t29137,\t4265,\t\r\n\t3569,\t1095,\t29199,\t4246,\t\r\n\t3506,\t1077,\t29262,\t4226,\t\r\n\t3444,\t1059,\t29324,\t4206,\t\r\n\t3383,\t1041,\t29385,\t4186,\t\r\n\t3322,\t1023,\t29446,\t4165,\t\r\n\t3261,\t1005,\t29507,\t4144,\t\r\n\t3201,\t988,\t29567,\t4122,\t\r\n\t3141,\t970,\t29627,\t4100,\t\r\n\t3082,\t953,\t29686,\t4078,\t\r\n\t3024,\t936,\t29744,\t4056,\t\r\n\t2965,\t918,\t29803,\t4033,\t\r\n\t2907,\t901,\t29861,\t4009,\t\r\n\t2850,\t884,\t29918,\t3986,\t\r\n\t2793,\t867,\t29975,\t3962,\t\r\n\t2737,\t851,\t30031,\t3937,\t\r\n\t2681,\t834,\t30087,\t3912,\t\r\n\t2626,\t818,\t30142,\t3887,\t\r\n\t2571,\t801,\t30197,\t3862,\t\r\n\t2516,\t785,\t30252,\t3836,\t\r\n\t2462,\t769,\t30306,\t3810,\t\r\n\t2409,\t753,\t30359,\t3783,\t\r\n\t2356,\t737,\t30412,\t3756,\t\r\n\t2304,\t721,\t30464,\t3729,\t\r\n\t2252,\t705,\t30516,\t3701,\t\r\n\t2200,\t690,\t30568,\t3673,\t\r\n\t2150,\t675,\t30618,\t3645,\t\r\n\t2099,\t659,\t30669,\t3616,\t\r\n\t2049,\t644,\t30719,\t3586,\t\r\n\t2000,\t629,\t30768,\t3557,\t\r\n\t1951,\t614,\t30817,\t3527,\t\r\n\t1903,\t600,\t30865,\t3496,\t\r\n\t1855,\t585,\t30913,\t3465,\t\r\n\t1808,\t571,\t30960,\t3434,\t\r\n\t1761,\t556,\t31007,\t3403,\t\r\n\t1715,\t542,\t31053,\t3371,\t\r\n\t1670,\t528,\t31098,\t3338,\t\r\n\t1624,\t514,\t31144,\t3305,\t\r\n\t1580,\t501,\t31188,\t3272,\t\r\n\t1536,\t487,\t31232,\t3239,\t\r\n\t1493,\t474,\t31275,\t3205,\t\r\n\t1450,\t461,\t31318,\t3170,\t\r\n\t1408,\t448,\t31360,\t3136,\t\r\n\t1366,\t435,\t31402,\t3100,\t\r\n\t1325,\t422,\t31443,\t3065,\t\r\n\t1284,\t409,\t31484,\t3029,\t\r\n\t1244,\t397,\t31524,\t2992,\t\r\n\t1205,\t384,\t31563,\t2955,\t\r\n\t1166,\t372,\t31602,\t2918,\t\r\n\t1127,\t360,\t31641,\t2880,\t\r\n\t1090,\t349,\t31678,\t2842,\t\r\n\t1053,\t337,\t31715,\t2804,\t\r\n\t1016,\t326,\t31752,\t2765,\t\r\n\t980,\t314,\t31788,\t2726,\t\r\n\t945,\t303,\t31823,\t2686,\t\r\n\t910,\t292,\t31858,\t2646,\t\r\n\t876,\t281,\t31892,\t2605,\t\r\n\t842,\t271,\t31926,\t2564,\t\r\n\t810,\t261,\t31958,\t2523,\t\r\n\t777,\t250,\t31991,\t2481,\t\r\n\t745,\t240,\t32023,\t2438,\t\r\n\t714,\t230,\t32054,\t2395,\t\r\n\t684,\t221,\t32084,\t2352,\t\r\n\t654,\t211,\t32114,\t2309,\t\r\n\t625,\t202,\t32143,\t2265,\t\r\n\t596,\t193,\t32172,\t2220,\t\r\n\t568,\t184,\t32200,\t2175,\t\r\n\t541,\t175,\t32227,\t2130,\t\r\n\t514,\t167,\t32254,\t2084,\t\r\n\t488,\t158,\t32280,\t2038,\t\r\n\t463,\t150,\t32305,\t1991,\t\r\n\t438,\t142,\t32330,\t1944,\t\r\n\t414,\t134,\t32354,\t1896,\t\r\n\t390,\t127,\t32378,\t1848,\t\r\n\t368,\t120,\t32400,\t1800,\t\r\n\t345,\t112,\t32423,\t1751,\t\r\n\t324,\t105,\t32444,\t1701,\t\r\n\t303,\t99,\t\t32465,\t1651,\t\r\n\t283,\t92,\t\t32485,\t1601,\t\r\n\t263,\t86,\t\t32505,\t1550,\t\r\n\t244,\t80,\t\t32524,\t1499,\t\r\n\t226,\t74,\t\t32542,\t1447,\t\r\n\t209,\t68,\t\t32559,\t1395,\t\r\n\t192,\t63,\t\t32576,\t1342,\t\r\n\t176,\t57,\t\t32592,\t1289,\t\r\n\t160,\t52,\t\t32608,\t1236,\t\r\n\t146,\t48,\t\t32622,\t1181,\t\r\n\t132,\t43,\t\t32636,\t1127,\t\r\n\t118,\t39,\t\t32650,\t1072,\t\r\n\t105,\t34,\t\t32663,\t1016,\t\r\n\t94,\t\t31,\t\t32674,\t961,\t\r\n\t82,\t\t27,\t\t32686,\t904,\t\r\n\t72,\t\t23,\t\t32696,\t847,\t\r\n\t62,\t\t20,\t\t32706,\t790,\t\r\n\t53,\t\t17,\t\t32715,\t732,\t\r\n\t44,\t\t14,\t\t32724,\t674,\t\r\n\t37,\t\t12,\t\t32731,\t615,\t\r\n\t30,\t\t9,\t\t32738,\t555,\t\r\n\t23,\t\t7,\t\t32745,\t496,\t\r\n\t18,\t\t6,\t\t32750,\t435,\t\r\n\t13,\t\t4,\t\t32755,\t375,\t\r\n\t9,\t\t3,\t\t32759,\t313,\t\r\n\t5,\t\t1,\t\t32763,\t252,\t\r\n\t3,\t\t1,\t\t32765,\t189,\t\r\n\t1,\t\t0,\t\t32767,\t127,\r\n\t0,\t\t0,\t\t32768,\t63,\r\n\t0,\t\t0,\t\t32768,\t0,\r\n};\r\n\r\n//\r\n// Compute Core\r\n//\r\ns32 CKLBSplineNode::interpolateKey(s32 interpolation, s32* vectorData) {\r\n\t//\r\n\t// Compute Hermite Spline for each component of the vector.\r\n\t//\r\n\tconst u16* pTbl = &HermiteTbl[interpolation<<2];\r\n\t\r\n\ts32 p0 = vectorData[0];\r\n\ts32 p1 = vectorData[VECTORSIZE];\r\n\ts32 t0 = vectorData[1];\t\t\t\t\t// Start Tangent Current key.\r\n\ts32 t1 = vectorData[VECTORSIZE + 2];\t// End Tangent next key.\r\n\r\n\t// Value as is, Tangent as 16.16 format.\r\n\treturn ( ( (((s64)p0)*pTbl[0]) + ((((s64)t0)*pTbl[1])) + (((s64)p1)*pTbl[2]) + ((((s64)t1)*pTbl[3])) )>>TBLRESOLUTIONBIT);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBSplineNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//\r\n\r\n#ifndef __SPLINE_PLAYER__\r\n#define __SPLINE_PLAYER__\r\n\r\n#include \"CKLBNode.h\"\r\n\r\n/*!\r\n* \\class CKLBSplineNode\r\n* \\brief Spline Node Class\r\n* \r\n* CKLBSplineNode gives the possibility to easily associate a Spline Animation \r\n* with an UITask.\r\n*/\r\nclass CKLBSplineNode : public CKLBNode {\r\npublic:\r\n\tstatic const u32 ANM_X_COORD_0\t\t\t= 1<<1;\r\n\tstatic const u32 ANM_Y_COORD_1\t\t\t= 1<<2;\r\n\tstatic const u32 ANM_SCALE_COORD_2\t\t= 1<<3;\r\n\tstatic const u32 ANM_R_COLOR_3\t\t\t= 1<<4;\r\n\tstatic const u32 ANM_G_COLOR_4\t\t\t= 1<<5;\r\n\tstatic const u32 ANM_B_COLOR_5\t\t\t= 1<<6;\r\n\tstatic const u32 ANM_A_COLOR_6\t\t\t= 1<<7;\r\n\tstatic const u32 ANM_SCALEX_COORD_7\t\t= 1<<8;\r\n\tstatic const u32 ANM_SCALEY_COORD_8\t\t= 1<<9;\r\n\tstatic const u32 ANM_ROTATION_COORD_9\t= 1<<10;\r\n\r\n\tstatic const u32 ANM_PING_PONG\t\t\t= 0x10000000;\r\n\tstatic const u32 ANM_LOOPBIT\t\t\t= 0x20000000;\r\n\tstatic const u32 ANM_REMOVESCENE\t\t= 0x40000000;\r\n\r\n\tstatic const u32 MODIFY_X\t\t\t\t= 0;\r\n\tstatic const u32 MODIFY_Y\t\t\t\t= 1;\r\n\tstatic const u32 MODIFY_SCALE\t\t\t= 2;\r\n\tstatic const u32 MODIFY_R\t\t\t\t= 3;\r\n\tstatic const u32 MODIFY_G\t\t\t\t= 4;\r\n\tstatic const u32 MODIFY_B\t\t\t\t= 5;\r\n\tstatic const u32 MODIFY_A\t\t\t\t= 6;\r\n\tstatic const u32 MODIFY_ROT\t\t\t\t= 7;\r\n\tstatic const u32 MODIFY_PRIORITY\t\t= 8;\r\n\tstatic const u32 MODIFY_LAYOUT\t\t\t= 9; // Used in UI List only.\r\n\tstatic const u32 MODIFY_TOTALCOUNT\t\t= MODIFY_LAYOUT + 1;\r\n\r\n\tstatic const u32 ANM_LINEAR\t\t\t\t= 1;\r\n\tstatic const u32 ANM_SWING\t\t\t\t= 2;\r\n\tstatic const u32 ANM_EASEINQUAD\t\t\t= 3;\r\n\tstatic const u32 ANM_EASEOUTQUAD\t\t= 4;\r\n\tstatic const u32 ANM_EASEINOUTQUAD\t\t= 5;\r\n\tstatic const u32 ANM_EASEINCUBIC\t\t= 6;\r\n\tstatic const u32 ANM_EASEOUTCUBIC\t\t= 7;\r\n\tstatic const u32 ANM_EASEINOUTCUBIC\t\t= 8;\r\n\tstatic const u32 ANM_EASEINQUART\t\t= 9;\r\n\tstatic const u32 ANM_EASEINBACK\t\t\t= 27;\r\n\tstatic const u32 ANM_EASEOUTBACK\t\t= 28;\r\n\tstatic const u32 ANM_EASEINOUTBACK\t\t= 29;\r\n\r\n\tCKLBSplineNode\t\t\t\t\t\t();\r\n\tvirtual ~CKLBSplineNode\t\t\t\t();\r\n\r\n\tvoid\t\t\tsetCounter\t\t\t(u32* refCounterPtr);\r\n\tvoid\t\t\tplay\t\t\t\t();\r\n\tvoid\t\t\tstop\t\t\t\t();\r\n\tvoid\t\t\tendAnimation\t\t(s32* keys);\r\n\r\n\tvoid\t\t\tsetAnimation\t\t(s32 milliSecondsPlayTime, s32 timeShift, u32 type, s32* keys, u32 keycount, u32 affected, float* arrayParam);\r\n\r\n\tbool\t\t\tsetParamCount\t\t(u8 splineCount, u8 maxKeyCount);\r\n\tvoid\t\t\tsetTarget\t\t\t(u8 splineIndex, u8 targetParameter);\r\n\tvoid\t\t\taddKeys\t\t\t\t(u8 splineIndex, u32 time, s16 value);\r\n\tvoid\t\t\taddKeysFixed\t\t(u8 splineIndex, u32 time, s32 fixed16Value);\r\n\tvoid\t\t\tgenerateAnimation\t();\r\n\r\n\tvirtual\r\n\tvoid\t\t\tanimate\t\t\t\t(u32 deltaTimeMilli);\r\n\r\n\tvirtual u32\t\tgetClassID\t\t\t()\t{ return CLS_KLBSPLINENODE; }\r\n\r\n\tvoid\t\t\tsetTag\t\t\t\t(void* tag) { m_tag = tag; }\t\r\n\tvoid*\t\t\tgetTag\t\t\t\t()\t{ return m_tag; }\r\n\r\nprivate:\r\n\tvoid\t\t\tcleanSplines();\r\n\r\n\ts32 \t\t\tinterpolateKey\t\t(s32 interpolation, s32* vectorData);\r\n\ts32*\t\t\tm_aKeyVector;\r\n\tfloat\t\t\tm_base[18];\r\n\r\n\ts32\t\t\t\tm_startTime;\r\n\r\n\tu32\t\t\t\tm_applyMask;\r\n\ts32\t\t\t\tm_timeMultiplier;\r\n\ts32\t\t\t\tm_uiLooptime;\r\n\r\n\ts32\t\t\t\tm_uiLocalTime;\r\n\r\n\ts32\t\t\t\tm_uiTotalKeyCount;\r\n\ts32\t\t\t\tm_uiLastLocalTime;\r\n\r\n\tu32*\t\t\tm_refCounter;\r\n\r\n\tu8*\t\t\t\tm_target;\r\n\ts32*\t\t\tm_allKeys;\r\n\tu32*\t\t\tm_splinesKeyCount;\r\n//\ts32*\t\t\tm_splineLocalTime;\r\n\tu16*\t\t\tm_splineLastKey;\r\n\ts32**\t\t\tm_splines;\r\n\tvoid*\t\t\tm_tag;\r\n\ts32\t\t\t\tm_uiTotalTime;\r\n\tu32\t\t\t\tm_uiMaxKeyCount;\r\n\tu32\t\t\t\tm_uiSplineCount;\r\n\r\n\tu16\t\t\t\tm_uiLastKey;\r\n\tu8\t\t\t\tm_mode;\r\n\tbool\t\t\tm_loop;\r\n\tbool\t\t\tm_pingpong;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Animation/CKLBSystem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBNode.h\"\r\n\r\n//\r\n// Just some wrapping code to avoid dependancy between the game framework class and node system.\r\n//\r\n\r\nCKLBNode* gm_animatedList = NULL;\r\n\r\n/*static*/void CKLBSystem::removeFromAnimation\t(CKLBNode* pNode) {\r\n\tklb_assert(pNode,\"null pointer\");\r\n//\tklb_assert(((pNode->m_pAnimationNext != NULL) ||\r\n//\t\t\t(pNode->m_pAnimationPrev != NULL) || (gm_animatedList == pNode)), \"already removed from animation list\");\r\n\r\n\tklb_assert(pNode->isAnimating(), \"already removed\");\r\n\r\n\tpNode->m_isAnimated = false;\r\n\r\n\t//\r\n\t// Removed from animation.\r\n\t//\r\n\tif (pNode->m_pAnimationPrev) {\r\n\t\tpNode->m_pAnimationPrev->m_pAnimationNext\t= pNode->m_pAnimationNext;\r\n\t} else {\r\n\t\tgm_animatedList\t\t\t\t\t\t\t\t= pNode->m_pAnimationNext;\r\n\t}\r\n\r\n\tif (pNode->m_pAnimationNext) {\r\n\t\tpNode->m_pAnimationNext->m_pAnimationPrev = pNode->m_pAnimationPrev;\r\n\t}\r\n\r\n\t//\r\n\t// OPTIMIZE : Clean object optimize (remove setup) + assert in addToAnimation.\r\n\t//\r\n\tpNode->m_pAnimationNext = NULL;\r\n\tpNode->m_pAnimationPrev = NULL;\r\n}\r\n\r\n/*static*/void CKLBSystem::addToAnimation\t\t(CKLBNode* pNode) {\r\n\tklb_assert(pNode, \"null pointer\");\r\n\tklb_assert(!pNode->isAnimating(), \"already added\");\r\n\r\n\tpNode->m_isAnimated = true;\r\n\r\n//\tklb_assert(((pNode->m_pAnimationNext == NULL) &&\r\n//\t\t\t(pNode->m_pAnimationPrev == NULL)), \"alread in animation list\");\r\n\r\n\t// Head insertion, watch dog garantee pointer exists.\r\n\tpNode->m_pAnimationPrev\t\t\t\t= NULL;\r\n\tpNode->m_pAnimationNext\t\t\t\t= gm_animatedList;\r\n\tif (gm_animatedList != NULL) {\t// OPTIMIZE : Use watchdog instead, remove IF.\r\n\t\tgm_animatedList->m_pAnimationPrev\t= pNode;\r\n\t}\r\n\tgm_animatedList\t\t\t\t\t\t= pNode;\r\n}\r\n\r\n/*static*/CKLBNode* CKLBSystem::getAnimationNodeList() {\r\n\treturn gm_animatedList;\r\n}\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n/*static*/void CKLBSystem::performAnimationUpdate(u32 milliSecDelta) {\r\n\r\n\tCKLBNode* pNode = gm_animatedList;\r\n\t\r\n//\tint count = 0;\r\n//\tint countSWF = 0;\r\n//\ts64 start = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\twhile (pNode) {\r\n\t\tCKLBNode* pNextNode = pNode->m_pAnimationNext;\t// Delete can occur inside animate, backup next.\r\n\t\tpNode->animate(milliSecDelta);\r\n//\t\tif (pNode->getClassID() == CLS_KLBSWFMOVIE) {\r\n//\t\t\tcountSWF++;\r\n//\t\t}\r\n//\t\tcount++;\r\n\t\tpNode = pNextNode;\r\n\t}\r\n\r\n//\ts64 end = CPFInterface::getInstance().platform().nanotime();\r\n//\tend -= start;\r\n//\tend /= 1000; // To nano -> uSec\r\n//\tCPFInterface::getInstance().platform().logging(\"Anim : %i, Count : %i, SWF : %i\\n\",(s32)end, count, countSWF);\r\n}"
  },
  {
    "path": "Engine/source/Assets/AudioAsset.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"AudioAsset.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n// #######################################################\r\n//   Asset Instance\r\n// #######################################################\r\n\r\nCKLBAudioAsset::CKLBAudioAsset()\r\n: CKLBAbstractAsset ()\r\n, m_resName         (NULL)\r\n, m_handle          (NULL)\r\n{\r\n}\r\n\r\nCKLBAudioAsset::~CKLBAudioAsset()\r\n{\r\n\tif (m_handle) {\r\n\t\trelease();\r\n\t\tm_handle = NULL;\r\n\t}\r\n}\r\n\r\nbool CKLBAudioAsset::init(const char* url) {\r\n\tm_handle = CPFInterface::getInstance().platform().loadAudio(url, true);\r\n\treturn m_handle != NULL;\r\n}\r\n\r\nbool CKLBAudioAsset::preLoad() {\r\n\tklb_assert(m_handle, \"Audio data is not init()\");\r\n\treturn CPFInterface::getInstance().platform().preLoad(m_handle);\r\n}\r\n\r\nvoid CKLBAudioAsset::play(float volume) {\r\n\tklb_assert(m_handle, \"Audio data is not init()\");\r\n\tCPFInterface::getInstance().platform().playAudio(m_handle,10000000,volume,volume);\r\n}\r\n\r\nvoid CKLBAudioAsset::stop() {\r\n\tklb_assert(m_handle, \"Audio data is not init()\");\r\n\tCPFInterface::getInstance().platform().stopAudio(m_handle);\r\n}\r\n\r\nvoid CKLBAudioAsset::release() {\r\n\tklb_assert(m_handle, \"Audio data is not init()\");\r\n\tCPFInterface::getInstance().platform().releaseAudio(m_handle);\r\n}\r\n\r\n// #######################################################\r\n//   Asset Manager\r\n// #######################################################\r\n\r\nKLBAudioAssetPlugin::KLBAudioAssetPlugin():\r\n\tIKLBAssetPlugin\t()\r\n{\r\n}\r\n\r\nKLBAudioAssetPlugin::~KLBAudioAssetPlugin()\r\n{\r\n}\r\n\r\n/*virtual*/\r\nCKLBAbstractAsset*\tKLBAudioAssetPlugin::loadAsset(u8* /*stream*/, u32 /*streamSize*/) {\r\n\tklb_assertAlways(\"loadAsset not support with KLBAudioAssetPlugin, please use loadByFileName instead.\");\r\n\treturn NULL;\r\n}\r\n\r\n/*virtual*/\r\nCKLBAbstractAsset*\tKLBAudioAssetPlugin::loadByFileName(const char* url) {\r\n\tCKLBAudioAsset* pAudioAsset = KLBNEW(CKLBAudioAsset);\r\n\tif (pAudioAsset) {\r\n\t\tif (pAudioAsset->init(url)) {\r\n\t\t\treturn pAudioAsset;\r\n\t\t}\r\n\t\tKLBDELETE(pAudioAsset);\r\n\t}\r\n\treturn NULL;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Assets/AudioAsset.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __KLB_AUDIO_ASSET__\r\n#define __KLB_AUDIO_ASSET__\r\n\r\n#include \"CKLBAsset.h\"\r\n\r\n/*!\r\n* \\class CKLBAudioAsset\r\n* \\brief Audio Asset Class\r\n* \r\n* Wrapper for audio object given by porting layer.\r\n*/\r\nclass CKLBAudioAsset : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual u32\t\t\tgetClassID\t()\t\t{ return CLS_ASSETAUDIO; }\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_AUDIO;    }\r\n\r\n\tCKLBAudioAsset();\r\n\t~CKLBAudioAsset();\r\n\r\n\tbool init\t(const char* url);\r\n\tbool preLoad();\r\n\tvoid play\t(float volume = 1.0f);\r\n\tvoid stop\t();\r\n\tvoid release();\r\nprivate:\r\n\tchar*\tm_resName;\r\n\tvoid*\tm_handle;\r\n};\r\n\r\n/*!\r\n* \\class KLBAudioAssetPlugin\r\n* \\brief Audio Asset Plugin Class\r\n* \r\n* KLBAudioAssetPlugin is in charge of loading CKLBAudioAsset.\r\n*/\r\nclass KLBAudioAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBAudioAssetPlugin();\r\n\t~KLBAudioAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID\t\t()\t\t\t\t{ return CHUNK_TAG('A','U','D','I'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader\t\t()\t\t\t\t{ return 'A';\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension\t()\t\t\t\t{ return \".audio\"; }\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset\t\t(u8* stream, u32 streamSize);\r\n\tvirtual CKLBAbstractAsset*\tloadByFileName\t(const char* fileName);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Assets/CKLBAsset.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Asset Management System ===\r\n//\r\n//\r\n\r\n#ifndef __CKLB_ASSET__\r\n#define __CKLB_ASSET__\r\n\r\n#include \"RenderingFramework.h\"\r\n#include \"CKLBAction.h\"\r\n#include \"FileSystem.h\"\r\n\r\nclass CKLBAssetManager;\r\n\r\n/* Create a 32 bit chunk header with FOUR letters*/\r\n#define\tCHUNK_TAG(a,b,c,d)\t\t((a<<24)|(b<<16)|(c<<8)|(d))\r\n\r\n#define HAS_CREATENODE\t\t\t(0x80)\r\nenum ASSET_TYPE {\r\n\tASSET_UIFORM\t\t\t= 0,\r\n\tASSET_ACTIONHANDLER\t\t= 1,\r\n\tASSET_SWFMOVIE\t\t\t= 2 | HAS_CREATENODE,\r\n\tASSET_VISUALRULES\t\t= 3,\r\n\tASSET_PROPERTYRULES\t\t= 4,\r\n\tASSET_IMAGE\t\t\t\t= 5 | HAS_CREATENODE,\r\n\tASSET_TEXTURE\t\t\t= 6,\r\n\tASSET_ANIMATIONSPLINE\t= 7 | HAS_CREATENODE,\r\n\tASSET_AUDIO\t\t\t\t= 8,\r\n\tASSET_MAP\t\t\t\t= 9 | HAS_CREATENODE,\r\n\tASSET_CELLANIM\t\t\t=10 | HAS_CREATENODE,\r\n\tASSET_COMPOSITE\t\t\t=11 | HAS_CREATENODE,\r\n\tASSET_NODEANIM\t\t\t=12 | HAS_CREATENODE,\r\n\tASSET_AI\t\t\t\t=13\r\n};\r\n\r\nstruct ASSET_ATTRIB {\r\n\r\n\tu8\tattribID;\r\n\tu8\ttype;\r\n\r\n\tunion u {\r\n\t\tconst char*\tstr;\r\n\t\ts32\t\t\tvalue;\r\n\t\tfloat\t\tfvalue;\r\n\t} v;\r\n\r\n\t// --- Use z as first char for IDE reason ---\r\n\r\n\t// ====\r\n\tstatic const int\tzK0_RECT\t\t= 0;\r\n\r\n\tstatic const int\tzK1_SC_LEFT\t\t= 1;\r\n\tstatic const int\tzK1_SC_MIDDLE\t= 2;\r\n\tstatic const int\tzK1_SC_RIGHT\t= 3;\r\n\tstatic const int\tzK1_SC_HASBITMAP= 4;\r\n\tstatic const int\tzK1_SC_ISVERTICAL=12;\r\n\r\n\tstatic const int\tzK2_S9_LEFT\t\t= 5;\r\n\tstatic const int\tzK2_S9_MIDDLEX\t= 6;\r\n\tstatic const int\tzK2_S9_RIGHT\t= 7;\r\n\tstatic const int\tzK2_S9_TOP\t\t= 8;\r\n\tstatic const int\tzK2_S9_MIDDLEY\t= 9;\r\n\tstatic const int\tzK2_S9_BOTTOM\t= 10;\r\n\r\n\tstatic const int\tz3DMODEL\t\t= 11;\r\n\tstatic const int\tzK3_OFFSET\t\t= 13;\r\n\r\n\tstatic const int\tzK4_STRETCH_OR_SCALE\t= 14;\r\n\t// last used zK4_STRETCH_OR_SCALE, is Next free is 15. Please update if changes.\r\n\r\n\t// ====\r\n\tstatic const int\tzATTRIB_INT\t\t= 0;\r\n\tstatic const int\tzATTRIB_FLOAT\t= 1;\r\n\tstatic const int\tzATTRIB_STRING\t= 2;\r\n};\r\n\r\n/*!\r\n* \\class CKLBAbstractAsset\r\n* \\brief Abstract Asset Class\r\n* \r\n* Generic basic asset, owns the reference counting mecanism.\r\n* Root class for all asset definition.\r\n*/\r\nclass CKLBAbstractAsset : public CKLBObject {\r\n\tfriend class CKLBAssetManager;\r\n\tfriend class CKLBDebuggerContext;\r\npublic:\r\n\tCKLBAbstractAsset();\r\n\t~CKLBAbstractAsset();\r\n\r\n\tvirtual\tASSET_TYPE\tgetAssetType() = 0;\r\n\r\n\t/* NO DICO\r\n\tvirtual bool\tinclude\t(const char* name);*/\r\n\tvirtual void unloadRessource() { } /* Do nothing by default */\r\n\r\n\tvirtual void onRegisterSubAsset\t\t()\t{ /* Do nothing */ }\r\n\tvirtual void onUnregisterSubAsset\t()\t{ /* Do nothing */ }\r\n\r\n\tvoid\t\t\tincrementRefCount\t\t();\r\n\tbool\t\t\tdecrementRefCount\t\t();\r\n\r\n\tinline\r\n\tu16\t\t\t\tgetRefCount\t\t\t\t()  { return m_refCount; }\r\n\r\n\tinline\t\r\n\tu16\t\t\t\tgetAssetID\t\t\t\t()\t{ return m_assetID; }\r\n\t\r\n\tbool\t\t\tsetNameDirect\t\t\t(const char* name);\r\n\r\n\tinline\r\n\tconst char*\t\tgetName\t\t\t\t\t()\t{ return m_pName; }\r\nprotected:\r\n\tconst\r\n\tchar*\t\t\t\tm_pName;\t\t/* Used by debugger    */\r\n\tconst\r\n\tchar*\t\t\t\tm_pNameBuff;\r\n\tconst\r\n\tchar*\t\t\t\tm_fileSource;\r\n\tu16\t\t\t\t\tm_assetID;\t\t/* Runtime decided ID */\r\n\tu16\t\t\t\t\tm_refCount;\r\n\tbool\t\t\t\tm_marked;\r\nprotected:\r\n\tchar*\tallocateName\t\t(void* ptr, u32 size);\r\n};\r\n\r\nclass CKLBNode;\r\n\r\n/*!\r\n* \\class CKLBAsset\r\n* \\brief Asset Class\r\n* \r\n* A CKLBAsset can create a part of the scene graph when instancing.\r\n*/\r\nclass CKLBAsset : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 /*priorityBase*/ = 0)\t= 0;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIAsset\r\n* \\brief UIAsset Class\r\n* \r\n* Generates an instance of UI Form from asset definition.\r\n*/\r\nclass CKLBUIAsset : public CKLBAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_UIFORM; }\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 priorityBase = 0);\r\n};\r\n\r\n/*!\r\n* \\class CKLBSplineAnimationAsset\r\n* \\brief Spline Animation Asset Class\r\n* \r\n* Generates an instance of a node modified by an animation spline.\r\n*/\r\nclass CKLBSplineAnimationAsset : public CKLBAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_ANIMATIONSPLINE; }\r\n\tvirtual u32\t\t\tgetClassID\t()\t\t{ return CLS_ASSETANIMSPLINE;   }\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 /*priorityBase*/ = 0)\t\t{ return NULL; }\r\n};\r\n\r\n/*!\r\n* \\class CKLBVisualRule\r\n* \\brief Visual Rule Class\r\n* \r\n* Visual Rules are assets part of game units.\r\n* Visual Rule definition loaded by ressource manager.\r\n* Property Change\t->\t\tVisual Change\r\n* State Change\t\t->\t\tVisual Change\r\n*/\r\nclass CKLBVisualRule : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_VISUALRULES; }\r\n\tu16\t\t\t\tm_solvedPropertIndex;\r\n\tCKLBVisualRule*\tm_pNextInTemplate;\r\n};\r\n\r\n/*!\r\n* \\class CKLBActionRule\r\n* \\brief Action Rule Class\r\n* \r\n* Action Rules are assets part of game units.\r\n*/\r\nclass CKLBActionRule : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_PROPERTYRULES; }\r\n\tCKLBActionRule*\tm_pNextInTemplate;\r\n};\r\n\r\n/*!\r\n* \\class CKLBActionHandler\r\n* \\brief Action Handler Class\r\n* \r\n* Action Handler are function definition of event handler.\r\n* - Used by game unit.\r\n* - Used by UI components as event handler.\r\n*/\r\nclass CKLBActionHandler : public CKLBAbstractAsset {\r\npublic:\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_ACTIONHANDLER; }\r\n\tu32\t\t\t\t\tm_actionType;\r\n\tCKLBActionHandler*\tm_pNextInTemplate;\r\n\tvirtual\t\tbool\thandler(CKLBAction* pAction) = 0;\r\n};\r\n\r\n/*!\r\n* \\class IKLBAssetPlugin\r\n* \\brief Asset Plugin Class\r\n* \r\n* Base Interface for asset loaders.\r\n* All asset loaders implement this interface to handle new_ asset format.\r\n*/\r\nclass IKLBAssetPlugin {\r\n\tfriend class CKLBAssetManager;\r\npublic:\r\n\tvirtual\tu8\t\t\t\t\tcharHeader()\t\t\t\t\t\t\t\t= 0;\r\n\tvirtual u32\t\t\t\t\tgetChunkID()\t\t\t\t\t\t\t\t= 0;\r\n\tvirtual const char*\t\t\tfileExtension()\t\t\t\t\t\t\t\t= 0;\r\n\t\t\tvoid\t\t\t\tsetReloadingAsset(CKLBAbstractAsset* pAsset) {\r\n\t\t\t\tm_pReloadAsset = pAsset;\r\n\t\t\t}\r\n\tvirtual void\t\t\t\tsetCurrentFileName(const char* currentFileName) { } /* Do nothing by default */\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize)\t\t= 0;\r\n\tvirtual CKLBAbstractAsset*\tloadByFileName(const char* /*fileName*/)\t{ /* Do nothing */ return NULL; }\r\nprotected:\r\n\tIKLBAssetPlugin();\r\n\tvirtual ~IKLBAssetPlugin();\r\n\tCKLBAbstractAsset*\tm_pReloadAsset;\r\nprivate:\r\n\tIKLBAssetPlugin*\tm_pNext;\r\n};\r\n\r\nclass Dictionnary;\r\nclass CKLBTextureAsset;\r\n\r\n/*!\r\n* \\class CKLBAssetManager\r\n* \\brief Asset Manager Class\r\n* \r\n* Supports all assets instance life cycle, and asset loader plugin.\r\n*/\r\nclass CKLBAssetManager {\r\npublic:\r\n\t//\r\n\t// Async Loading related stuff...\r\n\t//\r\n\tstruct SAsset {\r\n\t\tconst char*\t\t\tname;\r\n\t\tCKLBAbstractAsset*\tasset;\r\n\t\tbool\t\t\t\tloadingStarted;\r\n\t\tbool\t\t\t\tloadingComplete;\r\n\t\tbool\t\t\t\tchecked;\r\n\t\tbool\t\t\t\tadded;\r\n\r\n\t\t// Information to fill.\r\n\t\tvolatile bool\t\tprocessByMainThread;\r\n\t\tCKLBTextureAsset*\tpTexAsset;\r\n\t\tGLenum\t\t\t\tpixelFormat;\r\n\t\tCKLBOGLWrapper::TEX_CHANNEL\t\r\n\t\t\t\t\t\t\tchannel;\r\n\t\tu32\t\t\t\t\topt;\r\n\t\tu32\t\t\t\t\ttextureSize;\r\n\t};\r\nprivate:\r\n\tvolatile\tbool\tm_ThreadWait;\r\n\tvolatile\tbool\tm_AsyncMode;\r\n\tSAsset*\tm_currAsset;\r\npublic:\r\n\tbool isAsyncLoading\t\t\t();\r\n\tvoid setAsyncLoading\t\t(bool mode);\r\n\tvoid setCurrentAsyncAsset\t(CKLBAssetManager::SAsset* asset);\r\n\tSAsset* getCurrentAsyncAsset();\r\n\tvoid setMainThreadTexture\t(CKLBTextureAsset* pTexAsset, GLenum pixelFormat, CKLBOGLWrapper::TEX_CHANNEL channel, u32 opt, u32 textureSize);\r\n\r\n\tinline\r\n\tstatic CKLBAssetManager& getInstance() {\r\n\t\tstatic CKLBAssetManager instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release() {\tgetInstance()._release();\t}\r\n\r\n\tvoid\tdump\t\t\t\t();\r\n\r\n\t//\r\n\t// Asset definition file.\r\n\t//\t- Texture\r\n\t//\t- \r\n\t//\r\n\tvoid\t\tregisterAssetPlugIn\t(IKLBAssetPlugin* plugin);\r\n\tvoid\t\tregisterAsset\t\t(CKLBAbstractAsset* pAsset);\r\n\r\n\tinline IKLBAssetPlugin* \r\n\t\t\t\tgetPlugin\t\t\t(u8 charCode) { return m_arrayByCharCode[charCode]; }\r\n\r\n\tvoid\t\tfreeAsset\t\t\t(u16 assetID);\r\n\r\n\tinline\r\n\tCKLBAbstractAsset*\t\t\r\n\t\t\t\tgetAsset\t\t\t(u16 assetID) {\r\n\t\t\t\t\tklb_assert((assetID < m_maxAssetEntry), \"invalid asset ID\");\r\n\t\t\t\t\tklb_assert(this->m_assetRecord[assetID].m_isFree == false, \"already free\");\r\n\t\t\t\t\treturn this->m_assetRecord[assetID].m_pAsset;\r\n\t\t\t\t}\r\n\r\n\tu16\t\t\tgetAssetIDFromName\t(const char* name, char plugin, u32 retryCounter = 0);\r\n\tconst char*\tgetAssetNameFromID\t(u16 assetID);\r\n\t\r\n\t// TOO Slow, and not used for now.\r\n\t// u16\t\t\tgetAssetCount\t\t();\r\n\t// u16\t\t\tgetAssetIDFromIndex\t(u16 index);\r\n\t//\r\n\t// Asset replacement system\r\n\t//\r\n\tvoid\t\tassetReplaceMarking\t\t\t(u16 assetID);\r\n\tbool\t\tassetReplaceNameMatch\t\t(CKLBAbstractAsset* oldAsset, CKLBAbstractAsset* newAsset);\r\n\tbool\t\tisReplaceMarked\t\t\t\t(u16 assetID);\r\n\tvoid\t\trollBackMarking\t\t\t\t(u16 assetID);\r\n\tvoid\t\tassetReplaceFinishDeletion\t(u16 assetID);\r\n\r\n\t// TODO public for the time beeing (See CKLBLuaLibDATA)\r\n\tbool\t\tloadAssetStream\t\t\t\t(IReadStream* pStream, CKLBAbstractAsset** ppAsset, IKLBAssetPlugin* plugIn = NULL, bool useAsync = false);\r\nprivate:\r\n\tvoid\t\tcheckAsync\t\t\t\t\t(bool asyncMode);\r\npublic:\r\n\tvoid\t\tunloadAsset\t\t\t\t\t();\r\n\tvoid\t\trestoreAsset\t\t\t\t();\r\n\r\n\tCKLBAbstractAsset* \r\n\t\t\t\tloadAssetByFileName\t(const char* fileName, IKLBAssetPlugin* plugin = NULL, bool noStream = false, bool useAsync = false);\r\n\tvoid\t\taddSearchSubEntry\t(CKLBAbstractAsset* pAsset, const char* name);\r\n\tvoid\t\tremoveSearchEntry\t(const char* name);\r\n\r\n\t/**\r\n\t\tThis function does the real loading AND allocation of memory block in asset manager\r\n\t\tFor this reason, it should not be accessible to anybody but only from public \"loadAsset\" function\r\n\t\tin this class.\r\n\t */\r\n\tbool\t\tloadAsset\t\t\t(u8* stream, u32 streamSize, CKLBAbstractAsset** ppAsset, IKLBAssetPlugin* plugIn = NULL, bool useAsync = false);\r\n\r\n\tbool\t\tinit\t\t\t\t(u32 maxAssetEntry, u32 dicoNodeMax);\t// 2012.12.11  Reboot時に明示皁E��呼ぶ為に外へ出しました\r\nprivate:\r\n\r\n\t// OPTIMIZE RP : can optimize with this union between : pAsset vs prev/next\r\n\tstruct SAssetEntry {\r\n\t\tCKLBAbstractAsset*\tm_pAsset;\r\n\t\tbool\t\t\t\tm_isFree;\r\n\r\n\t\tu16\t\t\t\t\tm_prev;\r\n\t\tu16\t\t\t\t\tm_next;\r\n\t};\r\n\r\n\tvoid\t\taddSearchEntry\t\t(CKLBAbstractAsset* pAsset);\r\n\tu16\t\t\tsearchEntry\t\t\t(const char* name);\r\n\t\r\n\tIKLBAssetPlugin*\tm_pAssetDecoders;\r\n\tIKLBAssetPlugin*\tm_arrayByCharCode[256];\r\n\tSAssetEntry*\t\tm_assetRecord;\r\n\tu32\t\t\t\t\tm_maxAssetEntry;\r\n\tu16\t\t\t\t\tm_freeList;\r\n\tbool\t\t\t\tm_bIsInit;\r\n\tbool\t\t\t\tm_unloaded;\r\n\tDictionnary*\t\tm_dictionnary;\r\n\tconst char*\t\t\tm_currentLoadingFile;\r\n\r\n\tCKLBAssetManager\t\t(CKLBAssetManager const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t\t(CKLBAssetManager const&);\t\t// Dont implement.\r\n\r\n\tu16\t\tallocateAssetSlot\t(CKLBAbstractAsset* pAsset);\r\n\tCKLBAbstractAsset* freeAssetSlot\t\t(u16 index);\r\n\r\n\r\n\tCKLBAssetManager();\r\n\t~CKLBAssetManager();\r\n\tvoid _release();\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Assets/CKLBAssetManager.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBAsset.h\"\r\n#include \"mem.h\"\r\n#include \"Dictionnary.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n// --------------------------------------------------------------\r\n//   Asset Manager\r\n// --------------------------------------------------------------\r\n\r\nCKLBAssetManager::CKLBAssetManager()\r\n: m_pAssetDecoders  \t(NULL)\r\n, m_bIsInit         \t(false)\r\n, m_freeList        \t(NULL_IDX)\r\n, m_dictionnary     \t(NULL)\r\n, m_AsyncMode       \t(false)\r\n, m_ThreadWait      \t(false)\r\n, m_currAsset       \t(NULL)\r\n, m_currentLoadingFile\t(NULL)\r\n, m_maxAssetEntry   \t(0)\r\n, m_unloaded\t\t\t(false)\r\n{\r\n\tmemset32(m_arrayByCharCode, NULL, 256*sizeof(IKLBAssetPlugin*));\r\n//\tinit();\t// 2012.12.11  Reboot時に通らない為、外で明示的に呼びます\r\n}\r\n\r\nCKLBAssetManager::~CKLBAssetManager() \r\n{\r\n\t_release();\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::_release() \r\n{\r\n\tIKLBAssetPlugin* pList = m_pAssetDecoders;\r\n\r\n\twhile (pList) {\r\n\t\tIKLBAssetPlugin* next = pList->m_pNext;\r\n\t\tKLBDELETE(pList);\r\n\t\tpList = next;\r\n\t}\r\n\r\n\tm_pAssetDecoders = NULL;\r\n\r\n\tif (m_assetRecord) {\r\n#if defined(DEBUG_MEMORY)\r\n\t\tfor (int n = 0; n < m_maxAssetEntry; n++) {\r\n\t\t\tif (m_assetRecord[n].m_isFree == false) {\r\n\t\t\t\tklb_assertAlways(\"Asset Leak : %s.\", m_assetRecord[n].m_pAsset->m_pName);\r\n\t\t\t}\r\n\t\t}\r\n#endif\r\n\t\tKLBDELETEA(m_assetRecord);\r\n\t\tm_assetRecord = NULL;\r\n\t}\r\n\r\n\tKLBDELETE(m_dictionnary);\r\n\tm_dictionnary = NULL;\r\n}\r\n\r\nbool \r\nCKLBAssetManager::init(u32 maxAssetEntry, u32 dicoNodeMax) \r\n{\r\n\tklb_assert(dicoNodeMax   < 0xFFFF,  \"Do not support more than 65534 nodes.\");\r\n\tklb_assert(maxAssetEntry < 0xFFFF,  \"Do not support more than 65534 assets.\");\r\n\r\n\tm_maxAssetEntry\t= maxAssetEntry;\r\n\tm_assetRecord\t= KLBNEWA(SAssetEntry,m_maxAssetEntry);\r\n\tm_bIsInit\t\t= m_assetRecord != NULL;\r\n\tif (m_assetRecord) {\r\n\t\tm_freeList\t= 0;\r\n\r\n\t\tfor (u32 n = 0; n < m_maxAssetEntry; n++) {\r\n\t\t\tm_assetRecord[n].m_next = n + 1;\r\n\t\t\tm_assetRecord[n].m_prev = n - 1;\r\n\t\t\tm_assetRecord[n].m_isFree = true;\r\n\t\t}\r\n\r\n\t\t// All entries are unused.\r\n\t\tm_assetRecord[0].m_prev\t\t\t\t\t= NULL_IDX;\r\n\t\tm_assetRecord[m_maxAssetEntry-1].m_next\t= NULL_IDX;\r\n\r\n\t\tm_dictionnary\t= KLBNEWC(Dictionnary,(NULL,NULL));\t// No callback, no callback context.\r\n\t\tif (m_dictionnary) {\r\n\t\t\treturn m_dictionnary->init(dicoNodeMax);\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::registerAssetPlugIn(IKLBAssetPlugin* plugin) \r\n{\r\n\tklb_assertNull(plugin, \"null pointer\");\r\n\tif (plugin) {\r\n\t\tplugin->m_pNext\t\t= this->m_pAssetDecoders;\r\n\t\tu8 charHeader = plugin->charHeader();\r\n\t\tklb_assert(charHeader, \"plugin char header is zero\");\r\n\t\tm_arrayByCharCode[charHeader] = plugin;\r\n\t\tm_pAssetDecoders\t= plugin;\r\n\t}\r\n}\r\n\r\nu16 \r\nCKLBAssetManager::allocateAssetSlot(CKLBAbstractAsset* pAsset) \r\n{\r\n\tu16 freeIndex = m_freeList;\r\n\tif (freeIndex != NULL_IDX) {\r\n\t\tm_freeList\t\t\t\t\t\t\t= m_assetRecord[freeIndex].m_next;\r\n\t\tm_assetRecord[m_freeList].m_prev\t= NULL_IDX;\t// Not necessary but cleaner.\r\n\r\n\t\tm_assetRecord[freeIndex].m_pAsset\t= pAsset;\r\n\t\tm_assetRecord[freeIndex].m_isFree\t= false;\r\n\t\tpAsset->m_assetID\t\t\t\t\t= freeIndex;\r\n\r\n\t\tthis->addSearchEntry(pAsset);\r\n\t\tpAsset->onRegisterSubAsset();\r\n\r\n\t\treturn freeIndex;\r\n\t} else {\r\n\t\tklb_assertAlways(\"ressource slot full\");\r\n\t\treturn NULL_IDX;\r\n\t}\r\n}\r\n\r\nCKLBAbstractAsset* \r\nCKLBAssetManager::freeAssetSlot(u16 index) \r\n{\r\n\tif (index != NULL_IDX) {\r\n\t\tklb_assert(m_assetRecord[index].m_isFree == false, \"already free\");\r\n\r\n\t\tCKLBAbstractAsset* pAsset = m_assetRecord[index].m_pAsset;\r\n\r\n\t\tthis->removeSearchEntry(pAsset->getName());\r\n\r\n\t\tpAsset->m_assetID\t= NULL_IDX;\r\n\t\tpAsset->onUnregisterSubAsset();\r\n\r\n\t\tm_assetRecord[index].m_prev\t\t\t= NULL_IDX;\r\n\t\tm_assetRecord[index].m_next\t\t\t= m_freeList;\r\n\t\tm_assetRecord[index].m_isFree\t\t= true;\r\n\t\tm_freeList\t\t\t\t\t\t\t= index;\r\n\t\treturn pAsset;\r\n\t} else {\r\n\t\t// Was not stored in a slot : sub assets.\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::registerAsset(CKLBAbstractAsset* pAsset) \r\n{\r\n\tklb_assert(pAsset, \"null pointer\");\r\n\tpAsset->m_assetID\t= allocateAssetSlot(pAsset);\r\n}\r\n\r\nbool \r\nCKLBAssetManager::isAsyncLoading() \r\n{\r\n\treturn m_AsyncMode;\t\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::setAsyncLoading(bool mode) \r\n{\r\n\tm_AsyncMode = mode;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::setCurrentAsyncAsset(CKLBAssetManager::SAsset* pCurrAsset) \r\n{\r\n\tm_currAsset = pCurrAsset;\r\n}\r\n\r\nCKLBAssetManager::SAsset* \r\nCKLBAssetManager::getCurrentAsyncAsset() \r\n{\r\n\treturn m_currAsset;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::setMainThreadTexture(CKLBTextureAsset* pTexAsset, GLenum pixelFormat, CKLBOGLWrapper::TEX_CHANNEL channel, u32 opt, u32 textureSize) \r\n{\r\n\tSAsset* pAss\t\t= getCurrentAsyncAsset();\r\n\tpAss->pTexAsset\t\t= pTexAsset;\r\n\tpAss->pixelFormat\t= pixelFormat;\r\n\tpAss->channel\t\t= channel;\r\n\tpAss->opt\t\t\t= opt;\r\n\tpAss->processByMainThread\t= false;\r\n\tpAss->textureSize\t= textureSize;\r\n\r\n\tm_ThreadWait = true;\r\n\twhile (pAss->processByMainThread == false) {\r\n\t\t// Thread Wait for Main Task...\r\n\t}\r\n\tm_ThreadWait = false;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::checkAsync(bool asyncMode) \r\n{\r\n\tif (asyncMode == m_AsyncMode) {\r\n\t\t//\r\n\t\t// Sync with Sync mode.\r\n\t\t// Async with Async mode.\r\n\t\t// Go through...\r\n\t\t//\r\n\t} else {\r\n\t\t// Trying to do a sync while async mode.\r\n\t\t// Trying to do an async mode while async not activated (never happens)\r\n\t\twhile (asyncMode != m_AsyncMode) {\r\n\t\t\t// Main thread is locked until thread finishes.\r\n\t\t\t// --> Possible deadlock here, allow unmatching loading if threadWait Flag activated\r\n\t\t\tif (m_ThreadWait == true) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#include \"CKLBTexturePacker.h\"\r\n\r\nvoid\r\nCKLBAssetManager::unloadAsset() {\r\n\tif (!m_unloaded) {\r\n\t\tm_unloaded = true;\r\n\t\tfor (int n=0; n < m_maxAssetEntry; n++) {\r\n\t\t\tif (!m_assetRecord[n].m_isFree) {\r\n\t\t\t\tif (m_assetRecord[n].m_pAsset) {\r\n\t\t\t\t\tm_assetRecord[n].m_pAsset->unloadRessource();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tTexturePacker::getInstance().unloadSurface();\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBAssetManager::restoreAsset() {\r\n\tif (m_unloaded) {\r\n\t\tm_unloaded = false;\r\n\t\tTexturePacker::getInstance().reloadSurfaces();\r\n\r\n\t\tfor (int n=0; n < m_maxAssetEntry; n++) {\r\n\t\t\tif (!m_assetRecord[n].m_isFree) {\r\n\t\t\t\tif (m_assetRecord[n].m_pAsset) {\r\n\t\t\t\t\tif (m_assetRecord[n].m_pAsset->m_fileSource) {\r\n\t\t\t\t\t\t// We have the file of the original data\r\n\t\t\t\t\t\t// TEXTURE ONLY for now.\r\n\t\t\t\t\t\t// So waste of search time here...\r\n\t\t\t\t\t\tIKLBAssetPlugin* plg = this->m_pAssetDecoders;\r\n\t\t\t\t\t\twhile (plg) {\r\n\t\t\t\t\t\t\tif (plg->charHeader() == 'T') {\r\n\t\t\t\t\t\t\t\t// Need to skip header also.\r\n\t\t\t\t\t\t\t\tplg->setReloadingAsset(m_assetRecord[n].m_pAsset);\r\n\r\n\t\t\t\t\t\t\t\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\t\t\t\t\t\t\t\tIReadStream * pReadStream = pfif.openReadStream(m_assetRecord[n].m_pAsset->m_fileSource, pfif.useEncryption());\r\n\r\n\t\t\t\t\t\t\t\tif (pReadStream && (pReadStream->getStatus() == IReadStream::NORMAL)) {\r\n\t\t\t\t\t\t\t\t\tint size = pReadStream->getSize() - pReadStream->getPosition();\r\n\t\t\t\t\t\t\t\t\tif (size) {\r\n\t\t\t\t\t\t\t\t\t\tsize -= 8;\r\n\t\t\t\t\t\t\t\t\t\tpReadStream->readU32(); // Ignore Header\r\n\t\t\t\t\t\t\t\t\t\tpReadStream->readU32(); // Ignore Size\r\n\t\t\t\t\t\t\t\t\t\tu8* pBuffer = KLBNEWA(u8,size);\r\n\t\t\t\t\t\t\t\t\t\tif (pBuffer) {\r\n\t\t\t\t\t\t\t\t\t\t\tif (pReadStream->readBlock(pBuffer, size)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tplg->loadAsset(pBuffer, size);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\tKLBDELETEA(pBuffer);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif (pReadStream) {\r\n\t\t\t\t\t\t\t\t\tdelete pReadStream;\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tplg->setReloadingAsset(NULL);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplg = plg->m_pNext;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nCKLBAbstractAsset*\r\nCKLBAssetManager::loadAssetByFileName(const char* fileName, IKLBAssetPlugin* plugin, bool noStream, bool asyncLoad) {\r\n\tcheckAsync(asyncLoad);\r\n\r\n\t// FileName to Abstract Asset Name\r\n\t// Search -> OK return asset\r\n\t// else openStream...\r\n\r\n\t// Asset loaded\r\n\tCKLBAbstractAsset* pAsset = NULL;\r\n\tif (strncmp(fileName, \"asset://\", 8) == 0) {\r\n\t\tconst char* url = &fileName[8];//\r\n\t\tu16 entry = this->searchEntry(url);\r\n\r\n\t\tif (entry == NULL_IDX) {\r\n\t\t\tif (noStream) {\r\n\t\t\t\tconst char* abstractName = CKLBUtility::copyString(url);\r\n\t\t\t\tif (abstractName) {\r\n\t\t\t\t\tpAsset = plugin->loadByFileName(fileName);\t// Audio only for now\r\n\t\t\t\t\tif (pAsset) {\r\n\t\t\t\t\t\t// \r\n\t\t\t\t\t\tpAsset->m_pNameBuff = abstractName;\r\n\t\t\t\t\t\tpAsset->m_pName\t\t= abstractName;\r\n\r\n\t\t\t\t\t\tallocateAssetSlot(pAsset);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t//\r\n\t\t\t\t// Plugin Based, stream loading.\r\n\t\t\t\t//\r\n\t\t\t\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\t\t\t\tm_currentLoadingFile = fileName;\r\n\t\t\t\tIReadStream * pStream = pfif.openReadStream(fileName, pfif.useEncryption());\r\n\t\t\t\tif(!pStream || pStream->getStatus() != IReadStream::NORMAL) {\r\n\t\t\t\t\tdelete pStream;\r\n\t\t\t\t\tm_currentLoadingFile = NULL;\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\tbool bResult = loadAssetStream(pStream, (CKLBAbstractAsset **)&pAsset, plugin, asyncLoad);\r\n\t\t\t\tm_currentLoadingFile = NULL;\r\n\t\t\t\tdelete pStream;\r\n\t\t\t\tif(!bResult || !pAsset) {\r\n\t\t\t\t\treturn NULL;\r\n\t\t\t\t}\r\n\t\t\t\treturn pAsset;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tpAsset = m_assetRecord[entry].m_pAsset;\r\n\t\t}\r\n\t} else {\r\n\t\t/*\r\n\t\t\tChanging that policy could generate trouble :\r\n\t\t\t\r\n\t\t\tTexture A (internal)\r\n\t\t\tTexture B (external)\r\n\t\t\tmay register some common 'abstract' asset name in the dictionnary with different images.\r\n\r\n\t\t\tAsset support loading in both system with priority on external and should fit all needs.\r\n\r\n\t\t */\r\n\t\tklb_assertAlways(\"Asset loader is not supporting other path than asset:// for now.\");\r\n\t}\r\n\r\n\treturn pAsset;\r\n}\r\n\r\nbool \r\nCKLBAssetManager::loadAssetStream(IReadStream* pReadStream, CKLBAbstractAsset** ppAsset, IKLBAssetPlugin* plugIn, bool useAsync) \r\n{\r\n\tcheckAsync(useAsync);\r\n\r\n\tbool res = false;\r\n\tif (ppAsset) {\r\n\t\t*ppAsset = NULL; // Reset first in case of error.\r\n\t}\r\n\t\r\n\tlogStartTime();\r\n\r\n\tif (pReadStream && (pReadStream->getStatus() == IReadStream::NORMAL)) {\r\n\t\tint size = pReadStream->getSize() - pReadStream->getPosition();\r\n\t\tif (size) {\r\n\t\t\tu8* pBuffer = KLBNEWA(u8,size);\r\n\t\t\tif (pBuffer) {\r\n\t\t\t\tif (pReadStream->readBlock(pBuffer, size)) {\r\n\t\t\t\t\tres = loadAsset(pBuffer, size, ppAsset, plugIn,useAsync);\r\n\t\t\t\t}\r\n\t\t\t\tKLBDELETEA(pBuffer);\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tklb_assertAlways(\"File not found or invalid stream\");\r\n\t}\r\n\r\n\tlogEndTime('A',(*ppAsset ? (*ppAsset)->getName() : NULL));\r\n\treturn res;\r\n};\r\n\r\nbool \r\nCKLBAssetManager::loadAsset(u8* stream, u32 streamSize, CKLBAbstractAsset** ppAsset, IKLBAssetPlugin* plugIn, bool useAsync) \r\n{\r\n\tcheckAsync(useAsync);\r\n\r\n\tbool noError = true;\r\n\tklb_assert(stream, \"null pointer\");\r\n\tklb_assert(streamSize >= 8, \"too small for asset\");\r\n\r\n\tu32 pluginType32 = (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\tif (pluginType32 == CHUNK_TAG('L','I','N','K')) {\r\n\t\tstream += 8;\r\n\t\t//\r\n\t\t// Load another ressource instead.\r\n\t\t//\r\n\r\n\t\tu16 id = getAssetIDFromName((char*)stream, 0, 1 /*Force to not try loading on failure*/);\r\n\t\tif (id == NULL_IDX) {\r\n\r\n\t\t\tchar fileName[500];\r\n\t\t\tsprintf(fileName, \"asset://%s\", stream);\t// C String.\r\n\t\t\tIPlatformRequest& pf = CPFInterface::getInstance().platform();\r\n\t\t\tm_currentLoadingFile = fileName;\r\n\t\t\tIReadStream* pStream = pf.openReadStream(fileName, pf.useEncryption());\r\n\t\t\tif (pStream) {\r\n\t\t\t\tbool result = loadAssetStream(pStream, ppAsset,0,useAsync);\r\n\t\t\t\tdelete pStream;\t// DO NOT USE KLBDELETE : platform use \"new\"\r\n\t\t\t\treturn result;\r\n\t\t\t} else {\r\n\t\t\t\tnoError = false;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Asset already exist : ID is not NULL_IDX\r\n\t\t\tif (ppAsset) {\r\n\t\t\t\t*ppAsset = this->getAsset(id);\r\n\t\t\t}\r\n\t\t}\r\n\t\tstreamSize = 0;\r\n\t} else {\r\n\t\tif (plugIn == NULL) {\r\n\t\t\t//\r\n\t\t\t// Parse list of chunks.\r\n\t\t\t//\r\n\t\t\twhile (streamSize >= 8) {\r\n\t\t\t\tpluginType32 = (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\tstream\t\t+= 4;\r\n\t\t\t\tstreamSize\t-= 4;\r\n\t\t\t\tu32 size\t = (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\tstream\t\t+= 4;\r\n\t\t\t\tstreamSize\t-= 4;\r\n\r\n\t\t\t\tIKLBAssetPlugin* plugIn = m_pAssetDecoders;\r\n\t\t\t\twhile (plugIn) {\r\n\t\t\t\t\tif (plugIn->getChunkID() == pluginType32) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tplugIn = plugIn->m_pNext;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tklb_assert(plugIn, \"plugin not found\");\r\n\t\t\t\tif (plugIn) {\r\n\t\t\t\t\tplugIn->setCurrentFileName(m_currentLoadingFile);\r\n\t\t\t\t\tu16 id = getAssetIDFromName((char*)stream, 0, 1 /*Force to not try loading on failure*/);\r\n\t\t\t\t\t// printf(\"LOAD TEXTURE : %s\\n\");\r\n\t\t\t\t\tCKLBAbstractAsset* pAsset = plugIn->loadAsset(stream, size);\r\n\t\t\t\t\tklb_assertNull(pAsset, \"could not load/allocate asset\");\r\n\t\t\t\t\tif (pAsset) {\r\n\t\t\t\t\t\tthis->registerAsset(pAsset);\r\n\t\t\t\t\t\t// printf(\"LOAD TEXTURE : %s [Slot %i]\\n\",m_currentLoadingFile, pAsset->getAssetID());\r\n\t\t\t\t\t\tif (ppAsset) {\r\n\t\t\t\t\t\t\t*ppAsset = pAsset;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tnoError = false;\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (streamSize >= size) {\r\n\t\t\t\t\tstreamSize -= size;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnoError = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tCKLBAbstractAsset* pAsset = plugIn->loadAsset(stream, streamSize);\r\n\t\t\tklb_assert(pAsset, \"could not load/allocate asset\");\r\n\t\t\tif (pAsset) {\r\n\t\t\t\tthis->registerAsset(pAsset);\r\n\t\t\t\tif (ppAsset) {\r\n\t\t\t\t\t*ppAsset = pAsset;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tnoError = false;\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\t// Direct loading, reset\r\n\t\t\tstreamSize = 0;\r\n\t\t}\r\n\r\n\t\tif (!noError) {\r\n\t\t\t// LATER RP : count the number of successfull asset in this stream.\r\n\t\t\t// As some resource have loaded anyway... keep running.\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tklb_assert((streamSize == 0), \"Chunk size does not match parsing, data remain at the end.\");\r\n\r\n\treturn noError;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::freeAsset(u16 assetID) \r\n{\r\n\tif (assetID != NULL_IDX) {\r\n\t\tCKLBAbstractAsset* pAsset = this->freeAssetSlot(assetID);\r\n\t\tKLBDELETE(pAsset);\t// Also free memory slot if any or reference count.\r\n\t}\r\n}\r\n\r\n// =========================================================================\r\n/* NO DICO\r\nbool CKLBAbstractAsset::include(const char* name)\r\n{\r\n\treturn (m_pName && (strcmp(name, m_pName) == 0));\r\n}*/\r\n\r\nvoid \r\nCKLBAssetManager::addSearchEntry(CKLBAbstractAsset* pAsset) \r\n{\r\n\tm_dictionnary->add(pAsset->getName(),pAsset);\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::addSearchSubEntry(CKLBAbstractAsset* pAsset, const char* name) \r\n{\r\n\tm_dictionnary->add(name, pAsset);\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::removeSearchEntry(const char* name) \r\n{\r\n\tm_dictionnary->remove(name);\r\n}\r\n\r\nu16 \r\nCKLBAssetManager::searchEntry(const char* name) \r\n{\r\n    /* DICO */\r\n\tconst void* ptr = m_dictionnary->find(name);\r\n\tCKLBAbstractAsset*\tm_pAsset = (CKLBAbstractAsset*)ptr;\r\n\treturn m_pAsset ? m_pAsset->getAssetID() : NULL_IDX;\r\n\t/* NO DICO\r\n\tint idx = 0;\r\n\twhile (idx < MAX_ASSET_ENTRY) {\r\n\t\tif (m_assetRecord[idx].m_isFree == false) {\r\n\t\t\tif (m_assetRecord[idx].m_pAsset->include(name)) {\r\n\t\t\t\treturn idx;\r\n\t\t\t}\r\n\t\t}\r\n\t\tidx++;\r\n\t}\r\n\treturn NULL_IDX;*/\r\n}\r\n\r\nu16 \r\nCKLBAssetManager::getAssetIDFromName(const char* name, char plugin, u32 retryCount) \r\n{\r\nretry:\r\n\t// Search all ressources for now.\r\n\t// if (plugin == 0) {\r\n\t\r\n\tu16 idx = this->searchEntry(name);\r\n\r\n\tif (idx != NULL_IDX) {\r\n\t\treturn idx;\r\n\t}\r\n\t// }\r\n\r\n\tif (retryCount == 0) {\r\n\t\t//\r\n\t\t// Load another ressource instead.\r\n\t\t//\r\n\t\tCKLBAbstractAsset* pAsset = NULL;\r\n\t\tchar fileName[500];\r\n\t\tIKLBAssetPlugin* plug = plugin ? getPlugin(plugin) : NULL;\r\n\t\tsprintf(fileName, \"asset://%s%s\", name, plug ? plug->fileExtension() : \"\");\r\n\t\tIPlatformRequest& pf = CPFInterface::getInstance().platform();\r\n\t\tIReadStream* pStream = pf.openReadStream(fileName, pf.useEncryption());\r\n\t\tif (pStream) {\r\n\t\t\tm_currentLoadingFile = fileName;\r\n\t\t\tif (loadAssetStream(pStream,&pAsset)) {\r\n\t\t\t\tdelete pStream;\t// Platform use new and not KLBNEW.\r\n\t\t\t\tif (pAsset == NULL) {\r\n\t\t\t\t\tretryCount++;\r\n\t\t\t\t\tgoto retry;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn pAsset->getAssetID();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdelete pStream; // Platform use new and not KLBNEW.\r\n\t\t}\r\n\t}\r\n\r\n\treturn NULL_IDX;\r\n}\r\n\r\nconst char* \r\nCKLBAssetManager::getAssetNameFromID(u16 assetID) \r\n{\r\n\tif (assetID < this->m_maxAssetEntry) {\r\n\t\tklb_assert(this->m_assetRecord[assetID].m_isFree == false, \"already free\");\r\n\t\treturn this->m_assetRecord[assetID].m_pAsset->m_pName;\r\n\t} else {\r\n\t\tklb_assertAlways( \"invalid assetID\");\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::assetReplaceMarking(u16 assetID) \r\n{\r\n\t// Just mark the asset.\r\n\tthis->m_assetRecord[assetID].m_pAsset->m_marked = true;\r\n}\r\n\r\nbool \r\nCKLBAssetManager::assetReplaceNameMatch(CKLBAbstractAsset* oldAsset, CKLBAbstractAsset* newAsset) \r\n{\r\n\tif (oldAsset->m_marked && !newAsset->m_marked) {\r\n\t\tif ((oldAsset->m_pName) && (newAsset->m_pName)) {\r\n\t\t\tif (strcmp(oldAsset->m_pName,newAsset->m_pName) == 0) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool \r\nCKLBAssetManager::isReplaceMarked(u16 assetID) \r\n{\r\n\treturn this->m_assetRecord[assetID].m_pAsset->m_marked;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::rollBackMarking(u16 assetID) \r\n{\r\n\tthis->m_assetRecord[assetID].m_pAsset->m_marked = false;\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::assetReplaceFinishDeletion(u16 assetID) \r\n{\r\n\tfreeAsset(assetID);\r\n}\r\n\r\n// --------------------------------------------------------------\r\n//   Abstract Asset\r\n// --------------------------------------------------------------\r\n\r\nCKLBAbstractAsset::CKLBAbstractAsset()\r\n: m_pName\t\t(NULL)\r\n, m_pNameBuff\t(NULL)\r\n, m_fileSource\t(NULL)\r\n, m_assetID\t\t(NULL_IDX)\r\n, m_refCount\t(0)\r\n, m_marked\t\t(false)\r\n{\r\n}\r\n\r\nCKLBAbstractAsset::~CKLBAbstractAsset()\r\n{\r\n\tKLBDELETEA(m_fileSource);\r\n\tif (m_pNameBuff) {\r\n\t\tKLBDELETEA(m_pNameBuff);\r\n\t\tm_pNameBuff = NULL;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBAbstractAsset::incrementRefCount() \r\n{\r\n\tm_refCount++;\r\n\tklb_assert((getAssetType() != ASSET_IMAGE),\"Image Asset should never be using ref count\");\r\n\t// printf(\"Inc %8X Type:%8X Cnt:%i\\n\", this, this->getAssetType(), m_refCount);\r\n}\r\n\r\nbool \r\nCKLBAbstractAsset::decrementRefCount() \r\n{\r\n\r\n\tif (m_refCount) {\r\n\t\tm_refCount--;\r\n\t}\r\n\r\n\t// printf(\"Dec %8X Type:%8X Cnt:%i\\n\", this, this->getAssetType(), m_refCount);\r\n\r\n\tif (m_refCount == 0) {\r\n\t\tklb_assert((getAssetType() != ASSET_IMAGE),\"Image Asset should never be using ref count\");\r\n\r\n\t\tCKLBAssetManager& pMgr = CKLBAssetManager::getInstance();\r\n\r\n\t\t// Autoremoved from list and deleted pointer.\r\n\t\tif (m_assetID != NULL_IDX) {\r\n\t\t\tpMgr.freeAsset(m_assetID);\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"CKLBAbstractAsset::decrementRefCount should never come here.\");\r\n\t\t\tKLBDELETE(this);\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nchar* \r\nCKLBAbstractAsset::allocateName(void* ptr, u32 size) \r\n{\r\n\tchar* buf = KLBNEWA(char, size + 1);\r\n\tif (buf) {\r\n\t\tmemcpy(buf,ptr,size + 1);\r\n\t\tthis->m_pNameBuff\t= buf;\r\n\t\treturn &buf[1];\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nbool \r\nCKLBAbstractAsset::setNameDirect(const char* name) \r\n{\r\n\tint size = strlen(name) + 1;\r\n\tchar* buf = KLBNEWA(char, size);\r\n\tif (buf) {\r\n\t\tmemcpy(buf,name,size);\r\n\t\tthis->m_pNameBuff\t= buf;\r\n\t\tthis->m_pName\t\t= buf;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n// --------------------------------------------------------------\r\n//   Asset Plugin\r\n// --------------------------------------------------------------\r\n\r\nIKLBAssetPlugin::IKLBAssetPlugin()\r\n: m_pNext\t\t\t(NULL)\r\n, m_pReloadAsset\t(NULL)\r\n{\r\n}\r\n\r\n/*virtual*/ IKLBAssetPlugin::~IKLBAssetPlugin() {\t\r\n}\r\n"
  },
  {
    "path": "Engine/source/Assets/CKLBPropertyBag.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBPropertyBag.h\"\r\n#include <string.h>\r\n\r\n/*\r\nu32 CKLBPropertyBag::propAlloc\t\t= 0;\r\nu32 CKLBPropertyBag::bagAlloc\t\t= 0;\r\nu32 CKLBPropertyBag::stringAlloc\t= 0;\r\nbool CKLBPropertyBag::deletionFlag\t= false;\r\n\r\n//\r\n// Global Array\r\n//\r\nCKLBPropertyBag\t\t\tCKLBPropertyBag::bags\t\t\t[MAX_PROPERTYBAG_COUNT];\r\nCKLBPropertyBag::_v\t\tCKLBPropertyBag::properties\t\t[MAX_PROP_BUFFER_COUNT];\r\nu8\t\t\t\t\t\tCKLBPropertyBag::propertyTypes\t[MAX_PROP_BUFFER_COUNT];\r\nchar\t\t\t\t\tCKLBPropertyBag::strings\t\t[STRING_BUFFER_SIZE];\r\n*/\r\nCKLBPropertyBag\t\t*\tCKLBPropertyBag::ms_begin = 0;\r\nCKLBPropertyBag\t\t*\tCKLBPropertyBag::ms_end   = 0;\r\n\r\n\r\nenum E_TYPE {\r\n\tUNDEFINED_TYPE\t= 0,\r\n\tINT_TYPE\t\t= 1,\r\n\tBOOL_TYPE\t\t= 2,\r\n\tFLOAT_TYPE\t\t= 3,\r\n\tSTRING_TYPE\t\t= 4,\r\n};\r\n\r\n/*static*/ CKLBPropertyBag*\tCKLBPropertyBag::getPropertyBag() {\r\n\treturn KLBNEW(CKLBPropertyBag);\r\n/*\r\n\t// 1. Perform compaction\r\n\tcompact();\r\n\r\n\t// 2. Allocate\r\n\tfor (u32 n=0; n < bagAlloc; n++) {\r\n\t\tif (bags[n].m_free) {\r\n\t\t\treturn &bags[n];\r\n\t\t}\r\n\t}\r\n\r\n\t// 3. Not found : Extend...\r\n\tif (bagAlloc < MAX_PROPERTYBAG_COUNT) {\r\n\t\t// ok\r\n\t\tbags[bagAlloc].m_free = true;\t\t\r\n\t\treturn &bags[bagAlloc++];\r\n\t} else {\r\n\t\t// Reach full end.\r\n\t\tklb_assertAlways(\"Property Bag Pool fully used.\");\r\n\t\treturn NULL;\r\n\t}\r\n*/\r\n}\r\n\r\n/*static*/ void CKLBPropertyBag::releasePropertyBag(CKLBPropertyBag* pBag) {\r\n\tKLBDELETE(pBag);\r\n/*\r\n\tpBag->m_free = true;\r\n\tdeletionFlag = true;\r\n*/\r\n}\r\n\t\r\nCKLBPropertyBag::CKLBPropertyBag()\r\n: m_prev            (NULL)\r\n, m_next            (NULL)\r\n, m_propertyValues  (NULL)\r\n, m_propertyTypes   (NULL)\r\n, m_propertyCount   (0)\r\n, m_propertyMax     (0)\r\n{\r\n\tm_prev = ms_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tms_begin = this;\r\n\t}\r\n\tms_end = this;\r\n}\r\n\r\nCKLBPropertyBag::~CKLBPropertyBag() {\r\n\r\n\t// プロパティの持つ名前(およびstringと一体になっている)を破棄\r\n\tfor(int i = 0; i < m_propertyCount; i++) {\r\n\t\tKLBDELETEA(m_propertyValues[i].name);\r\n\t}\r\n\tKLBDELETEA(m_propertyValues);\r\n\tKLBDELETEA(m_propertyTypes);\r\n\r\n\t// 自身をリンクから切り離す\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tms_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tms_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool CKLBPropertyBag::init() {\r\n\treturn true;\r\n/*\r\n\tbool res = true;\r\n\t\r\n\tthis->m_propertyValues\t= &properties\t\t[propAlloc];\r\n\tthis->m_propertyTypes\t= &propertyTypes\t[propAlloc];\r\n\tthis->m_propertyCount\t= 0;\r\n\tthis->m_free\t\t\t= !res;\r\n\treturn res;\r\n*/\r\n}\r\n\r\nconst char*\tCKLBPropertyBag::allocateName(const char* originalName, int addlen) {\r\n\tu32 len = strlen(originalName) + 1;\r\n\tchar * buf = KLBNEWA(char, len + addlen);\r\n\tmemcpy(buf, originalName, len);\r\n\treturn (const char *)buf;\r\n}\r\n\r\n/*static*/\r\nvoid CKLBPropertyBag::compact() {\r\n/*\r\n\t//\r\n\t// Do NOT compact PropertyBag array itself -> Pointer will change !\r\n\t//\r\n\r\n\tif (deletionFlag) {\r\n\t\tdeletionFlag = false;\r\n\t\t_v* packProp\t\t= properties;\r\n\t\tu8*\tpackPropType\t= propertyTypes;\r\n\t\tchar* packString\t= strings;\r\n\r\n\t\tfor (u32 n=0; n < bagAlloc; n++) {\r\n\t\t\tif (bags[n].m_free == false) {\r\n\t\t\t\tCKLBPropertyBag* pBag = &bags[n];\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Move properties.\r\n\t\t\t\t//\r\n\t\t\t\tif (pBag->m_propertyValues != packProp) {\r\n\t\t\t\t\tmemcpy(packProp, pBag->m_propertyValues, sizeof(_v) * pBag->m_propertyCount);\r\n\t\t\t\t\tmemcpy(packPropType, pBag->m_propertyTypes, sizeof(u8) * pBag->m_propertyCount);\r\n\t\t\t\t\tpBag->m_propertyValues\t= packProp;\r\n\t\t\t\t\tpBag->m_propertyTypes\t= packPropType;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpackProp\t\t+= pBag->m_propertyCount;\r\n\t\t\t\tpackPropType\t+= pBag->m_propertyCount;\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Move String name / value\r\n\t\t\t\t//\r\n\t\t\t\tfor (u32 m=0; m < pBag->m_propertyCount; m++) {\r\n\t\t\t\t\tconst char* str = pBag->m_propertyValues[m].name;\r\n\t\t\t\t\tu32 len = strlen(str) + 1;\r\n\r\n\t\t\t\t\tif (str != packString) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmemcpy(packString, str, len);\r\n\t\t\t\t\t\tpBag->m_propertyValues[m].name = packString;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpackString += len;\r\n\r\n\t\t\t\t\tif (pBag->m_propertyTypes[m] == STRING_TYPE) {\r\n\t\t\t\t\t\tstr = pBag->m_propertyValues[m].v.s;\r\n\t\t\t\t\t\tlen = strlen(str) + 1;\r\n\t\t\t\t\t\tif (pBag->m_propertyValues[m].name != packString)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tmemcpy(packString, str, len);\r\n\t\t\t\t\t\t\tpBag->m_propertyValues[m].v.s = packString;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpackString += len;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Compact string allocator.\r\n\t\tstringAlloc = packString - strings;\r\n\t\t// Compact prop allocator;\r\n\t\tpropAlloc\t= packProp - properties;\r\n\t}\r\n\t*/\r\n}\r\n\r\nvoid\r\nCKLBPropertyBag::appendProperty()\r\n{\r\n\tint cnt = m_propertyCount + 1;\r\n    if(cnt <= m_propertyMax) { return; }\r\n\r\n\tcnt = m_propertyMax + PROPERTY_BLOCK_COUNT;\r\n\t_v * tmpValues = KLBNEWA(_v, cnt);\r\n\tu8 * tmpTypes  = KLBNEWA(u8, cnt);\r\n\tif(m_propertyValues) {\r\n\t\tmemcpy(tmpValues, m_propertyValues, sizeof(_v) * m_propertyCount);\r\n\t\tmemcpy(tmpTypes , m_propertyTypes,  sizeof(u8) * m_propertyCount);\r\n\t\tKLBDELETEA(m_propertyValues);\r\n\t\tKLBDELETEA(m_propertyTypes);\r\n\t}\r\n\tm_propertyValues= tmpValues;\r\n\tm_propertyTypes = tmpTypes;\r\n\tm_propertyMax   = cnt;\r\n}\r\n\r\n\r\nvoid  CKLBPropertyBag::setPropertyInt(const char* name, s32 value) {\r\n\t// klb_assert(propAlloc < MAX_PROP_BUFFER_COUNT, \"No more space for properties\");\r\n\tappendProperty();\r\n\tm_propertyValues[m_propertyCount].name = allocateName(name);\r\n\tm_propertyValues[m_propertyCount].v.i  = value;\r\n\tm_propertyTypes[m_propertyCount]       = INT_TYPE;\r\n\tm_propertyCount++;\r\n}\r\n\r\nvoid CKLBPropertyBag::setPropertyBool(const char* name, bool value) {\r\n\t//klb_assert(propAlloc < MAX_PROP_BUFFER_COUNT, \"No more space for properties\");\r\n\tappendProperty();\r\n\tm_propertyValues[m_propertyCount].name = allocateName(name);\r\n\tm_propertyValues[m_propertyCount].v.b  = value;\r\n\tm_propertyTypes[m_propertyCount]       = BOOL_TYPE;\r\n\tm_propertyCount++;\r\n}\r\n\r\nvoid CKLBPropertyBag::setPropertyFloat(const char* name, float value) {\r\n\t//klb_assert(propAlloc < MAX_PROP_BUFFER_COUNT, \"No more space for properties\");\r\n\tappendProperty();\r\n\tm_propertyValues[m_propertyCount].name = allocateName(name);\r\n\tm_propertyValues[m_propertyCount].v.f  = value;\r\n\tm_propertyTypes[m_propertyCount]       = FLOAT_TYPE;\r\n\tm_propertyCount++;\r\n}\r\n\r\nvoid CKLBPropertyBag::setPropertyString(const char* name, const char* value) {\r\n\t//klb_assert(propAlloc < MAX_PROP_BUFFER_COUNT, \"No more space for properties\");\r\n\tappendProperty();\r\n\r\n\tint namelen  = strlen(name) + 1;\r\n\tint valuelen = strlen(value) + 1;\r\n\r\n\tconst char * vname = allocateName(name, valuelen);\r\n\tchar * vstring = (char *)vname + namelen;\r\n\tstrcpy(vstring, value);\r\n\r\n\tm_propertyValues[m_propertyCount].name = vname;\r\n\tm_propertyValues[m_propertyCount].v.s  = vstring;\r\n\tm_propertyTypes[m_propertyCount]       = STRING_TYPE;\r\n\tm_propertyCount++;\r\n}\r\n\r\ns32 CKLBPropertyBag::getIndex(const char* name) {\r\n\tfor(u32 n = 0; n < m_propertyCount; n++) {\r\n\t\tif (strcmp(name, m_propertyValues[n].name) == 0) {\r\n\t\t\treturn n;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn -1;\r\n}\r\n\r\nu32 CKLBPropertyBag::getFieldType(const char* name) {\r\n\ts32 idx = getIndex(name);\r\n\tif (idx != -1) {\r\n\t\treturn m_propertyTypes[idx];\r\n\t} else {\r\n\t\treturn UNDEFINED_TYPE;\r\n\t}\r\n}\r\n\r\ns32 CKLBPropertyBag::getPropertyInt(const char* name) {\r\n\ts32 idx = getIndex(name);\r\n\tif ((idx != -1) && (m_propertyTypes[idx] == INT_TYPE)) {\r\n\t\treturn m_propertyValues[idx].v.i;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Unknown property or non matching type %s\", name);\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\nbool CKLBPropertyBag::getPropertyBool(const char* name) {\r\n\ts32 idx = getIndex(name);\r\n\tif (idx != -1) {\r\n\t\tif (m_propertyTypes[idx] == BOOL_TYPE) {\r\n\t\t\treturn m_propertyValues[idx].v.b;\r\n\t\t} else if (m_propertyTypes[idx] == INT_TYPE) {\r\n\t\t\treturn m_propertyValues[idx].v.i ? true : false;\r\n\t\t}\r\n\t}\r\n\r\n\tklb_assertAlways(\"Unknown property or non matching type %s\", name);\r\n\treturn false;\r\n}\r\n\r\nfloat CKLBPropertyBag::getPropertyFloat(const char* name) {\r\n\ts32 idx = getIndex(name);\r\n\tif ((idx != -1) && (m_propertyTypes[idx] == BOOL_TYPE)) {\r\n\t\treturn m_propertyValues[idx].v.f;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Unknown property or non matching type %s\", name);\r\n\t\treturn 0.0f;\r\n\t}\r\n}\r\n\r\nconst char* CKLBPropertyBag::getPropertyString(const char* name) {\r\n\ts32 idx = getIndex(name);\r\n\tif ((idx != -1) && (m_propertyTypes[idx] == STRING_TYPE)) {\r\n\t\treturn m_propertyValues[idx].v.s;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Unknown property or non matching type %s\", name);\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Assets/CKLBPropertyBag.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CLB_PROPERTY_BAG\r\n#define __CLB_PROPERTY_BAG\r\n\r\n#include \"BaseType.h\"\r\n\r\n#define MAX_PROP_BUFFER_COUNT\t(2000)\r\n#define STRING_BUFFER_SIZE\t\t(2000)\r\n#define MAX_PROPERTYBAG_COUNT\t(100)\r\n\r\nclass CKLBPropertyBag {\r\npublic:\r\n\tstatic CKLBPropertyBag*\t\tgetPropertyBag\t\t();\r\n\tstatic void \t\t\t\treleasePropertyBag\t(CKLBPropertyBag* pBag);\r\n\t\r\n\tbool\tinit();\r\n\t\r\n\tvoid \tsetPropertyInt\t\t(const char* name, s32 value);\r\n\tvoid\tsetPropertyBool\t\t(const char* name, bool value);\r\n\tvoid\tsetPropertyFloat\t(const char* name, float value);\r\n\tvoid\tsetPropertyString\t(const char* name, const char* value);\r\n\t\r\n\tu32\t\tgetFieldType\t\t(const char* name);\r\n\ts32\t\tgetPropertyInt\t\t(const char* name);\r\n\tbool\tgetPropertyBool\t\t(const char* name);\r\n\tfloat\tgetPropertyFloat\t(const char* name);\r\n\tconst char*\r\n\t\t\tgetPropertyString\t(const char* name);\r\n\t\r\n\ts32\t\tgetIndex(const char* name);\r\nprivate:\r\n\tCKLBPropertyBag();\r\n\t~CKLBPropertyBag();\r\n\t\r\n\tvoid appendProperty();\r\n\tconst char*\tallocateName(const char* originalName, int addlen = 0);\r\n\t\r\n\tstruct _v {\r\n\t\tunion v {\r\n\t\t\tfloat \t\t\tf;\r\n\t\t\ts32\t\t\t\ti;\r\n\t\t\tconst char*\t\ts;\r\n\t\t\tbool\t\t\tb;\r\n\t\t} v;\r\n\t\tconst char* name;\r\n\t};\r\n\t\r\n\t_v*\t\t\tm_propertyValues;\r\n\tu8*\t\t\tm_propertyTypes;\r\n\tu8\t\t\tm_propertyCount;\r\n\tu8\t\t\tm_propertyMax;\t\t// Current buffer size by maximum number of properties.\r\n\tbool\t\tm_free;\r\n\r\n\tCKLBPropertyBag\t\t*\tm_prev;\r\n\tCKLBPropertyBag\t\t*\tm_next;\r\n\r\n\r\n\r\n\tstatic void compact();\r\n/*\r\n\tstatic CKLBPropertyBag \tbags\t\t\t[MAX_PROPERTYBAG_COUNT];\r\n\tstatic _v \t\t\t\tproperties\t\t[MAX_PROP_BUFFER_COUNT];\r\n\tstatic u8\t\t\t\tpropertyTypes\t[MAX_PROP_BUFFER_COUNT];\r\n\tstatic char\t\t\t\tstrings\t\t\t[STRING_BUFFER_SIZE];\r\n\r\n\tstatic u32\t\t\t\tpropAlloc;\r\n\tstatic u32\t\t\t\tbagAlloc;\r\n\tstatic u32\t\t\t\tstringAlloc;\r\n\tstatic bool\t\t\t\tdeletionFlag;\r\n\t*/\r\n\r\n\tstatic CKLBPropertyBag\t*\tms_begin;\r\n\tstatic CKLBPropertyBag\t*\tms_end;\r\n\r\n\tenum {\r\n\t\tPROPERTY_BLOCK_COUNT = 10\r\n\t};\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Assets/CKLBTexturePacker.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBTexturePacker.h\"\r\n#include \"ArrayAllocator.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n//\r\n// Flag to decide if we update the texture for each sub surface individually\r\n// or check a change flag just before rendering. (Compile option for now but wanted to avoid #define)\r\n// Some device on android did not react well to the fact of executing lots of texture change.\r\n// Because we use a prebuffer software texture, we use now twice the amount of memory in exchange.\r\n//\r\nconst bool g_useSWBuffer = true;\r\n\r\n/*static*/ u8 TexturePacker::s_currentTextureMode = STARTUP_FORMAT;\r\n\r\n// =====================================\r\n//\tPrivate Data Structure.\r\n// =====================================\r\nstruct PackNode {\r\n\tPackNode(ArrayAllocator<PackNode>* pAlloc);\r\n\t~PackNode();\r\n\t\r\n\tstatic void* operator new\t\t(size_t size, ArrayAllocator<PackNode>* pAlloc); \r\n\tstatic void  operator delete\t(void *p);\r\n \r\n\tPackNode*\tclone();\r\n\r\n\tArrayAllocator<PackNode>*\tallocCtx;\r\n\tPackNode*\tlft;\r\n\tPackNode*\trgt;\r\n\tu16 \t\tx;\r\n\tu16 \t\ty;\r\n\tu16 \t\tw;\r\n\tu16 \t\th;\r\n\tbool\t\tused;\r\n};\r\n\r\ntypedef\tArrayAllocator<PackNode>\tAllocNode;\r\n\r\n/*static*/ void* PackNode::operator new\t\t(size_t /*size*/, AllocNode* pAlloc)\r\n{\r\n\t// Ignore size, we are fixed size type here.\r\n\treturn pAlloc->allocEntry();\r\n}\r\n\r\n/*static*/ void  PackNode::operator delete\t(void *p)\r\n{\r\n\t((PackNode*)p)->allocCtx->freeEntry((PackNode*)p);\r\n}\r\n\r\nclass Packer {\r\npublic:\r\n\tPacker ();\r\n\t~Packer();\r\n\t\r\n\tvoid setSize\t\t\t(u16  width, u16  height);\r\n\tvoid getDimension\t\t(u16& width, u16& height);\r\n\tbool findCoord\t\t\t(u16 w, u16 h, u16& x, u16& y);\r\nprotected:\r\n\tu16 \t\tusedWidth;\r\n\tu16 \t\tusedHeight;\r\n\tPackNode*\troot;\r\n\tArrayAllocator<PackNode>\tallocator;\r\n\r\n\tbool findCoordRec\t\t(PackNode* node, u16 w, u16 h, u16& x, u16& y);\r\n};\r\n\r\nstruct SPixel {\r\n\tu8 r;\r\n\tu8 g;\r\n\tu8 b;\r\n\tu8 a;\r\n};\r\n\r\nstruct SSurface {\r\n\tcompact\t\tcbCompactFunc;\r\n\tvoid*\t\townerCtx;\r\n\tCKLBSprite*\tm_sprite;\r\n\tu8*\t\t\tswBuffer;\r\n\tu16\t\t\tw;\r\n\tu16\t\t\th;\r\n\tu16\t\t\talloc_w;\r\n\tu16\t\t\talloc_h;\r\n\r\n\tu16\t\t\tx;\r\n\tu16\t\t\ty;\r\n\t// bool\t\tflip;\r\n\t// bool\t\toldflip;\r\n\tbool\t\tfree;\r\n};\r\n\r\n// Maximum 2048 (12 bit on 16 bit index)\r\n#define SURFACE_MAX\t(1000)\r\n\r\n// One instance per texture.\r\nclass TexturePackerOnce {\r\n\tfriend class TexturePacker;\r\npublic:\r\n\tbool init\t\t\t\t(u16 width,\t\t\tu16 height, u16 mode);\r\n\tvoid reset\t\t\t\t();\r\n\tvoid release\t\t\t();\r\n\tvoid dump\t\t\t\t(bool detail);\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tvoid scan\t\t\t\t(void* ctx);\r\n#endif\r\n\r\n\tvoid unloadSurfaces\t\t();\r\n\tvoid reloadSurfaces\t\t();\r\n\tu16  allocateSurface\t(CKLBSprite* spr,\tu16 w,\t\tu16 h\t,void* ptrOwner,compact cbCompaction, TexturePackerOnce** ppRealAlloc);\r\n\tu16\t reallocateSurface\t(u16 surface,\t\tu16 w,\t\tu16 h\t,TexturePackerOnce** ppRealAlloc);\r\n\tvoid releaseSurface\t\t(u16 surface);\r\n\tvoid getSurfaceInfo\t\t(u16 surface,\t\tu32*& pixel, float& u0, float& v0, float& u1, float& v1, float& stepU, float& stepV);\r\n\tCTextureUsage*\r\n\t\t getTextureUsage\t()\t{ return m_textureUsage;\t}\r\n\tu16\t getSurfaceStride\t()\t{ return m_width;\t\t\t}\r\n\tCKLBSprite* getSprite\t(u16 surface)\t{ return m_surface[surface].m_sprite;\t\t}\r\n\tvoid*\t\tgetOwnerCtx\t(u16 surface)\t{ return m_surface[surface].ownerCtx;\t\t}\r\n\tcompact\t\tgetOwnerCB\t(u16 surface)\t{ return m_surface[surface].cbCompactFunc;\t}\r\n\tvoid updateTexture\t\t(u16 surface);\r\n\tu16\t\t\t\tmarker;\r\nprivate:\r\n\tPacker\t\t\tm_packer;\r\n\tu16\t\t\t\tm_width;\r\n\tu16\t\t\t\tm_height;\r\n\tCTexture*\t\tm_texture;\r\n\tCTextureUsage*\tm_textureUsage;\r\n\tu8*\t\t\t\tm_swBuffer;\r\n\tu32\t\t\t\tm_unit;\r\n\tu32\t\t\t\tm_format;\r\n\tu32\t\t\t\tm_totalSurface;\r\n\tu32\t\t\t\tm_freeSurface;\r\n\tu16\t\t\t\tm_startYChange;\r\n\tu16\t\t\t\tm_endYChange;\r\n\r\n\t// Global\r\n\tSSurface\tm_surface[SURFACE_MAX];\r\n\tu16\t\t\tm_surfaceCount;\r\n\tu16\t\t\tm_currFormat;\r\n\r\n\tbool simpleAllocInternal(CKLBSprite* spr, u16 x, u16 y, u16 w, u16 h, s16& found);\r\n\tvoid moveImage\t\t\t(u16 id);\r\n\tvoid refreshTexture\t\t();\r\n};\r\n\r\n\r\n// =====================================\r\n//\tPackNode\r\n// =====================================\r\n\r\nPackNode::PackNode(ArrayAllocator<PackNode>*\tallocCtx)\r\n: lft\t\t(NULL)\r\n, rgt\t\t(NULL)\r\n, allocCtx\t(allocCtx)\r\n, used\t\t(false)\r\n{\r\n}\r\n\r\nPackNode::~PackNode() {\r\n\t// Specific allocator, do NOT use KLBDELETE macro.\r\n\tdelete lft;\r\n\tdelete rgt;\r\n}\r\n\r\nPackNode* PackNode::clone() {\r\n\t// Specific allocator, do NOT use KLBNEW macro.\r\n\tPackNode* pNew = new(allocCtx) PackNode(allocCtx);\r\n\tif (pNew) {\r\n\t\tpNew->x = this->x;\r\n\t\tpNew->y = this->y;\r\n\t\tpNew->w = this->w;\r\n\t\tpNew->h = this->h;\r\n\t}\r\n\treturn pNew;\r\n}\r\n\r\n// =====================================\r\n//\tPacker\r\n// =====================================\r\n\r\nPacker::Packer() {\r\n\tif (allocator.init(SURFACE_MAX * 2)) {\r\n\t\troot = new(&allocator) PackNode(&allocator);\r\n\t\tsetSize\t(0, 0);\r\n\t}\r\n}\r\n\r\nPacker::~Packer() {\r\n\t// Do NOT use KLBDELETE for PackNode\r\n\tdelete root;\r\n}\r\n\r\nvoid Packer::setSize(u16 width, u16 height) {\r\n\troot->x\t= 0;\r\n\troot->y\t= 0;\r\n\troot->w\t= width;\r\n\troot->h\t= height;\r\n\t\r\n\tdelete root->lft;\r\n\tdelete root->rgt;\r\n\t\r\n\troot->lft\t= NULL;\r\n\troot->rgt\t= NULL;\r\n\t\r\n\tusedWidth\t= 0;\r\n\tusedHeight\t= 0;\r\n}\r\n\r\nvoid Packer::getDimension(u16& refWidth, u16& refHeight) {\r\n\trefWidth \t= usedWidth;\r\n\trefHeight\t= usedHeight;\r\n}\r\n\r\nbool Packer::findCoord\t(u16 w, u16 h, u16& x, u16& y) {\r\n\tif (findCoordRec(root, w, h, x, y)) {\r\n\t\tif (usedWidth  < (x + w)) \t{ usedWidth  = x + w; }\r\n\t\tif (usedHeight < (y + h))\t{ usedHeight = y + h; }\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool Packer::findCoordRec(PackNode* node, u16 w, u16 h, u16& x, u16& y) {\r\n\tif (node->lft) {\r\n\t\tif (findCoordRec(node->lft,w,h,x,y)) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn findCoordRec(node->rgt,w,h,x,y);\r\n\t\t}\r\n\t} else {\r\n\t\t// if already used or it's too big then return\r\n\t\tif (node->used || (w > node->w) || (h > node->h)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// if it fits perfectly then use this gap\r\n\t\tif ((w == node->w) && (h == node->h)) {\r\n\t\t\tnode->used\t= true;\r\n\t\t\tx \t\t\t= node->x;\r\n\t\t\ty \t\t\t= node->y;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\t// initialize the left and right leafs by clonning the current one\r\n\t\tnode->lft = node->clone();\r\n\t\tnode->rgt = node->clone();\r\n\t\t\r\n\t\t// checks if we partition in vertical or horizontal\r\n\t\tif ((node->w - w) > (node->h - h)) {\r\n\t\t\tnode->lft->w = w;\r\n\t\t\tnode->rgt->x = node->x + w;\r\n\t\t\tnode->rgt->w = node->w - w;\t\r\n\t\t} else {\r\n\t\t\tnode->lft->h = h;\r\n\t\t\tnode->rgt->y = node->y + h;\r\n\t\t\tnode->rgt->h = node->h - h;\t\t\t\t\t\t\t\r\n\t\t}\r\n\r\n\t\treturn findCoordRec(node->lft, w, h, x, y);\r\n\t}\r\n}\r\n\r\n\r\n// =====================================\r\n//\tTexturePackerOnce\r\n// =====================================\r\n\r\nbool TexturePackerOnce::init(u16 width, u16 height, u16 mode) {\r\n\tklb_assert((CKLBUtility::nearest2Pow(width ) == width ), \"invalid power of two size\");\r\n\tklb_assert((CKLBUtility::nearest2Pow(height) == height), \"invalid power of two size\");\r\n\r\n\tCKLBOGLWrapper::TEX_CHANNEL format;\r\n\tu32 unit;\r\n\tswitch (mode) {\r\n\tcase FORMAT_8888:\r\n\t\tformat\t= CKLBOGLWrapper::RGBA;\r\n\t\tunit\t= GL_UNSIGNED_BYTE;\r\n\t\tbreak;\r\n\tcase FORMAT_4444:\r\n\t\tformat\t= CKLBOGLWrapper::RGBA;\r\n\t\tunit\t= GL_UNSIGNED_SHORT_4_4_4_4;\r\n\t\tbreak;\r\n\tcase FORMAT_8:\r\n\t\tformat\t= CKLBOGLWrapper::LUMINANCE;\r\n\t\tunit\t= GL_UNSIGNED_BYTE;\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tformat\t= CKLBOGLWrapper::RGBA;\t// Just for compiler warning.\r\n\t\tunit\t= 0;\r\n\t\tklb_assertAlways(\"Invalid texture format for TexturePacker.\");\r\n\t}\r\n\r\n\tm_currFormat = mode;\r\n\r\n\tif (g_useSWBuffer) {\r\n\t\tm_swBuffer\t= KLBNEWA(u8, width * height * m_currFormat);\r\n\t}\r\n\tif ((m_swBuffer && g_useSWBuffer) || (g_useSWBuffer == false)) {\r\n\t\tCTexture* pTex\t= CKLBOGLWrapper::getInstance().createTexture(width, height, unit, format, NULL, 0, CKLBOGLWrapper::TEX_NONE);\r\n\t\tif (pTex) {\r\n\t\t\tm_unit\t\t\t= unit;\r\n\t\t\tm_format\t\t= format;\r\n\t\t\tm_startYChange\t= 0x4000;\r\n\t\t\tm_endYChange\t= 0;\r\n\t\t\tm_texture\t\t= pTex;\r\n\t\t\tm_textureUsage\t= pTex->createUsage();\r\n\t\t\tm_surfaceCount\t= 0;\r\n\t\t\tm_width\t\t\t= width;\r\n\t\t\tm_height\t\t= height;\r\n\r\n\t\t\treset();\r\n\r\n\t\t\treturn (m_textureUsage != NULL);\r\n\t\t}\r\n\t\tif (g_useSWBuffer) {\r\n\t\t\tKLBDELETEA(m_swBuffer);\r\n\t\t\tm_swBuffer = NULL;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid TexturePackerOnce::reset() {\r\n\tm_surfaceCount\t= 0;\r\n\tm_totalSurface\t= m_width * m_height;\r\n\tm_freeSurface\t= m_totalSurface;\r\n\tthis->m_packer.setSize(m_width,m_height);\r\n}\r\n\r\nvoid TexturePackerOnce::release() {\r\n\tfor (int n = 0 ; n < m_surfaceCount; n++) {\r\n\t\tKLBDELETEA(m_surface[n].swBuffer);\r\n\t}\r\n\r\n\tif (m_swBuffer && g_useSWBuffer) {\r\n\t\tKLBDELETEA(m_swBuffer);\r\n\t\tm_swBuffer = NULL;\r\n\t}\r\n\r\n\tif (m_textureUsage) {\r\n\t\tm_texture->releaseUsage(m_textureUsage);\r\n\t\tm_textureUsage = NULL;\r\n\t}\r\n\r\n\tif (m_texture) {\r\n\t\tCKLBOGLWrapper::getInstance().releaseTexture(m_texture);\r\n\t\tm_texture = NULL;\r\n\t}\r\n}\r\n\r\nvoid TexturePackerOnce::dump(bool detail) {\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\tfprintf(pFile, \"==== Surface Alloc %8lX Size W:%i, H:%i Byte/Pix: %i ====\\n\", reinterpret_cast<uintptr_t>(this), m_width, m_height, m_currFormat);\r\n\tu32 totalSurface\t= m_width * m_height;\r\n\tu32 usedSurface\t\t= 0;\r\n\tu32 allocSurface\t= 0;\r\n\tfor (int n = 0; n < m_surfaceCount; n++) {\r\n\t\tif (m_surface[n].free) {\r\n\t\t\tif (detail) { printf(\"! \"); }\r\n\t\t} else {\r\n\t\t\tif (detail) { printf(\"  \"); }\r\n\t\t\tallocSurface += m_surface[n].alloc_w * m_surface[n].alloc_h; \r\n\t\t\tusedSurface  += m_surface[n].w * m_surface[n].h; \r\n\t\t\tif (detail) {\r\n\t\t\t\t// writeSurface(&m_surface[n], n, this);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (detail) {\r\n\t\t\tfprintf(pFile, \"[%4i] AW:%4i(%4i) AH:%4i(%4i) X:%4i Y:%4i\\n\",\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tn,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].alloc_w,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].w,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].alloc_h,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].h,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].x,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].y);\r\n\t\t}\r\n\t}\r\n\r\n\tif (totalSurface) {\r\n\t\tfprintf(pFile, \" Total : %i(100%%) Allocated : %i (%f) Used : %i (%f)\\n\",\r\n\t\t\ttotalSurface,\r\n\t\t\tallocSurface,\r\n\t\t\t(allocSurface*100.0) / totalSurface,\r\n\t\t\tusedSurface,\r\n\t\t\t(usedSurface*100.0) / totalSurface\r\n\t\t);\r\n\t}\r\n\r\n\tfprintf(pFile, \"==== Surface Alloc End =====\\n\");\r\n}\r\n\r\n#define INTERNAL_DUMP_TEXPACKER\t\t\t/*dump(bool detail)*/;\r\n\r\nvoid TexturePacker::unloadSurface() {\r\n\tfor (int n=0; n<MAX_TEXTURES ; n++) {\r\n\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\tif (pCurr) {\r\n\t\t\tpCurr->unloadSurfaces();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid TexturePacker::reloadSurfaces() {\r\n\tfor (int n=0; n<MAX_TEXTURES ; n++) {\r\n\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\tif (pCurr) {\r\n\t\t\tpCurr->reloadSurfaces();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid TexturePackerOnce::unloadSurfaces() {\r\n\tthis->m_texture->makeEmptyShell();\r\n}\r\n\r\nvoid TexturePackerOnce::reloadSurfaces() {\r\n\t//\r\n\t// Allocate new texture\r\n\t//\r\n\tthis->m_texture\t= CKLBOGLWrapper::getInstance().createTexture(m_width, m_height, m_unit, (CKLBOGLWrapper::TEX_CHANNEL)m_format, NULL, 0, CKLBOGLWrapper::TEX_NONE,0,m_texture);\r\n\r\n\t//\r\n\t// Force SW -> texture\r\n\t//\r\n\tfor (u16 n=0; n < this->m_surfaceCount; n++) {\r\n\t\tif (m_surface[n].free == false) {\r\n\t\t\tmoveImage(n);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nu16 TexturePackerOnce::allocateSurface(CKLBSprite* spr, u16 w, u16 h, void* ptrOwner,compact cbCompaction, TexturePackerOnce** ppRealAlloc) {\r\n\tu16 x = 0;\r\n\tu16 y = 0;\r\n\t*ppRealAlloc = this;\r\n\ts16 foundIdx;\r\n\tif (simpleAllocInternal(spr,x,y,w,h, foundIdx)) {\r\n\r\n\t\t// Item allocate succeed.\r\n\t\tbool res;\r\n\t\tif (foundIdx < 0) {\r\n\t\t\tres = m_packer.findCoord(w+2,h+2,x,y);\r\n\t\t} else {\r\n\t\t\tx = m_surface[foundIdx].x-1; // Because we add + 1\r\n\t\t\ty = m_surface[foundIdx].y-1;\r\n\t\t\tres = true;\r\n\t\t}\r\n\r\n\t\tif (res) {\t// Add 1 pixel border around the buffer.\r\n\t\t\tu16 update = (foundIdx < 0) ? m_surfaceCount-1 : foundIdx;\r\n\t\t\t\r\n\t\t\t//\t[.] Partial update of texture to GPU only for new item.\r\n\t\t\t/*  Caller to main allocator does it.\r\n\t\t\t\t*ptrOwner = update | this->marker;\r\n\t\t\t */\r\n\t\t\tm_surface[update].x = x+1;\t// X and Y point to the correct binding in texture including border (allow correct UV get)\r\n\t\t\tm_surface[update].y = y+1;\r\n\t\t\tm_surface[update].cbCompactFunc = cbCompaction;\r\n\t\t\tm_surface[update].ownerCtx = ptrOwner;\r\n\t\t\tm_freeSurface\t-= (w+2) * (h+2);\r\n\t\t\tINTERNAL_DUMP_TEXPACKER;\r\n\t\t\treturn update;\r\n\t\t} else {\r\n\t\t\t// Item allocate FAILED.\r\n\t\t\tu16 originalCount = m_surfaceCount - 1;\r\n\t\t\t\r\n\t\t\t// Get just allocated buffer.\r\n\t\t\tu8* buffer = m_surface[m_surfaceCount-1].swBuffer;\r\n\t\t\tm_surface[m_surfaceCount-1].free\t\t= true; // Not necessary but cleaner.\r\n\r\n\t\t\t//\t[.] Clear packer tree.\r\n\t\t\tm_packer.setSize(m_width,m_height);\r\n\t\t\r\n\t\t\t//\t[.] For each already existing entry, register again\r\n\t\t\tu16 write = 0;\r\n\r\n\t\t\tTexturePacker& packer = TexturePacker::getInstance();\r\n\t\t\tpacker.addIgnoreList(this);\r\n\r\n\t\t\tm_freeSurface\t= m_totalSurface;\r\n\t\t\tbool hadFailure = false;\r\n\t\t\tfor (u16 n = 0; n < originalCount; n++) {\r\n\t\t\t\tSSurface* pSurf = &m_surface[n];\r\n\t\t\t\t\r\n\t\t\t\tif (!pSurf->free) {\r\n\t\t\t\t\tbool success = m_packer.findCoord(\tpSurf->w+2,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpSurf->h+2,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].x,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_surface[n].y);\r\n\t\t\t\t\tu16 newSurface;\r\n\t\t\t\t\tif (!success) {\r\n\t\t\t\t\t\t// CAN NOT RECOMPACT OLD ITEM --> Need to move to another texture.\r\n\t\t\t\t\t\tnewSurface = packer.useOtherAlloc(pSurf->m_sprite, pSurf->w, pSurf->h, pSurf->ownerCtx,pSurf->cbCompactFunc);\r\n\r\n\t\t\t\t\t\tif (newSurface == NULL_IDX) {\r\n\t\t\t\t\t\t\t// Not enough memory : can not escape from total failure.\r\n\t\t\t\t\t\t\t// Avoid leak.\r\n\t\t\t\t\t\t\tKLBDELETEA(buffer);\r\n\t\t\t\t\t\t\treturn NULL_IDX;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tu16 localSurface = newSurface & 0xFFF;\r\n\t\t\t\t\t\t\tTexturePackerOnce* pOtherTextureAllocator = packer.m_allocatedPacker[(newSurface & 0xF000) >> 12];\r\n\t\t\t\t\t\t\t*ppRealAlloc = pOtherTextureAllocator;\r\n\r\n\t\t\t\t\t\t\t// Get New Surface Definition.\r\n\t\t\t\t\t\t\tSSurface* pNewSurf = &pOtherTextureAllocator->m_surface[localSurface];\r\n\r\n\t\t\t\t\t\t\t// -> Free new buffer allocated for nothing.\r\n\t\t\t\t\t\t\tKLBDELETEA(pNewSurf->swBuffer);\r\n\t\t\t\t\t\t\t// -> Switch to old buffer = Preserve data.\r\n\t\t\t\t\t\t\tpNewSurf->swBuffer = pSurf->swBuffer;\r\n\r\n\t\t\t\t\t\t\t// Update target Texture with old software buffer.\r\n\t\t\t\t\t\t\tpOtherTextureAllocator->moveImage(localSurface);\r\n\t\t\t\t\t\t\tpNewSurf->cbCompactFunc(pNewSurf->ownerCtx, n | this->marker, newSurface);\r\n\r\n\t\t\t\t\t\t\t// Free old surface entry.\r\n\t\t\t\t\t\t\tpSurf->free\t\t= true;\r\n\t\t\t\t\t\t\tpSurf->swBuffer\t= NULL;\r\n\t\t\t\t\t\t\thadFailure = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Shift +1,+1 because our width and height is not W+2 and H+2\r\n\t\t\t\t\t\tm_surface[n].x++;\r\n\t\t\t\t\t\tm_surface[n].y++;\r\n\r\n\t\t\t\t\t\t// Perform compaction of freed items.\r\n\t\t\t\t\t\tm_surface[write] = m_surface[n];\r\n\r\n\t\t\t\t\t\tnewSurface = write | this->marker;\r\n\t\t\t\t\t\tm_surface[write].cbCompactFunc(m_surface[write].ownerCtx, n | this->marker, newSurface);\r\n\t\t\t\t\t\t// If a displacement in texture occurs, texture must be updated.\r\n\t\t\t\t\t\t// if ((m_surface[write].x != oldX) || (m_surface[write].y != oldY)) {\r\n\t\t\t\t\t\t\tmoveImage(write);\r\n\t\t\t\t\t\t// }\r\n\t\t\t\t\t\twrite++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tINTERNAL_DUMP_TEXPACKER;\r\n\r\n\t\t\t\t\tm_freeSurface\t-= (pSurf->alloc_w+2) * (pSurf->alloc_h+2);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tpacker.removeIgnoreList(this);\r\n\r\n\t\t\tm_surfaceCount = write; // All reallocate complete -> Restore count.\r\n\r\n\t\t\t// Update texture post compaction all textures even if new item may not fit in.\r\n\r\n\t\t\tif (m_packer.findCoord(w + 2,h + 2,x,y)) {\r\n\t\t\t\tINTERNAL_DUMP_TEXPACKER;\r\n\t\t\t\t//\t[.] Allocation succeed ? == Compaction succeeded.\r\n\t\t\t\r\n\t\t\t\t//\t[.] Setup & Render New item\r\n\t\t\t\t//      simpleAllocInternal(spr,x,y,w,h); <-- Not done, reuse buffer from previous call.\r\n\r\n\t\t\t\t*ppRealAlloc\t= this;\r\n\t\t\t\tSSurface* pSurf = &m_surface[m_surfaceCount++];\r\n\t\t\t\tpSurf->x\t\t= x+1;\r\n\t\t\t\tpSurf->y\t\t= y+1;\r\n\t\t\t\tpSurf->w\t\t= w;\r\n\t\t\t\tpSurf->h\t\t= h;\r\n\t\t\t\tpSurf->alloc_w\t= w;\r\n\t\t\t\tpSurf->alloc_h\t= h;\r\n\t\t\t\tpSurf->m_sprite\t= spr;\r\n\t\t\t\tpSurf->free\t\t= false;\r\n\t\t\t\tpSurf->swBuffer = buffer;\r\n\t\t\t\tpSurf->ownerCtx = ptrOwner;\r\n\t\t\t\tpSurf->cbCompactFunc = cbCompaction;\r\n\t\t\t\tm_freeSurface\t-= (w+2) * (h+2);\r\n\r\n\t\t\t\treturn m_surfaceCount - 1;\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// klb_assert((_CrtCheckMemory() != 0), \"Heap Error !\");\r\n\r\n\t\t\t\tKLBDELETEA(buffer);\r\n\t\t\t\t//\t[.] FAILED : this texture is full.\r\n\t\t\t\tdump(false);\r\n\r\n\t\t\t\t// klb_assert((_CrtCheckMemory() != 0), \"Heap Error !\");\r\n\t\t\t\t*ppRealAlloc = NULL;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tif (foundIdx < 0) {\r\n\t\t\tm_surfaceCount--;\r\n\t\t} else {\r\n\t\t\tm_surface[foundIdx].free = true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn NULL_IDX;\r\n}\r\n\r\nu16 TexturePackerOnce::reallocateSurface(u16 surface, u16 w, u16 h, TexturePackerOnce** ppRealAlloc) {\r\n\tSSurface* pSurf = &m_surface[surface];\r\n\tif ((h <= pSurf->alloc_h) && (w <= pSurf->alloc_w)) {\r\n\t\t// Surface just got smaller or the same : no reallocation at all.\r\n\r\n\t\t// ### TODO Clean differential to avoid garbage ###\r\n\r\n\t\tpSurf->h     = h;\r\n\t\tpSurf->w     = w;\r\n\t\t*ppRealAlloc = this;\r\n\r\n\t\treturn surface;\r\n\t} else {\r\n\t\t// Surface is bigger --> Need a new slot.\r\n\t\tu16 newSurface = allocateSurface(pSurf->m_sprite, w, h, pSurf->ownerCtx, pSurf->cbCompactFunc, ppRealAlloc);\r\n\t\tif (newSurface != NULL_IDX) {\r\n\t\t\tklb_assert(newSurface != surface,\"Conflict : reallocation use same surface.\");\r\n\t\t\t// And free the old slot.\r\n\t\t\treleaseSurface(surface);\r\n\t\t}\r\n\t\treturn newSurface;\r\n\t}\r\n}\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\nvoid* gGlobalDeleteCtx = NULL;\r\n\r\nvoid TexturePacker::setCurrentDelete(void* ptr) {\r\n\tgGlobalDeleteCtx = ptr;\r\n}\r\n#endif\r\n\r\nvoid TexturePackerOnce::releaseSurface(u16 surface) {\r\n\tif (surface != NULL_IDX) {\r\n\t\tklb_assert((surface < SURFACE_MAX), \"Texture Packer no more surface available\");\r\n\t\tSSurface* pSurf\t\t\t= &m_surface[surface];\r\n\t\tpSurf->free\t\t\t\t= true;\r\n\t\tm_freeSurface\t\t\t+= (pSurf->alloc_w+2) * (pSurf->alloc_h+2);\r\n\t\tKLBDELETEA(pSurf->swBuffer);\r\n\t\tpSurf->swBuffer\t\t\t= NULL;\r\n\t\tpSurf->cbCompactFunc\t= NULL;\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\t\tklb_assert(pSurf->ownerCtx == gGlobalDeleteCtx, \"Different !\");\r\n#endif\r\n\t\tpSurf->ownerCtx\t\t\t= NULL;\r\n\t\tpSurf->m_sprite\t\t\t= NULL;\r\n\t}\r\n}\r\n\r\nbool TexturePackerOnce::simpleAllocInternal(CKLBSprite* spr, u16 x, u16 y, u16 w, u16 h, s16& found) {\r\n\t//\t[.] Store Item\r\n\tklb_assert((m_surfaceCount < SURFACE_MAX), \"Texture Packer no more surface available\");\r\n\r\n\tfound = -1;\r\n\r\n\tfor (u32 n = 0; n < m_surfaceCount; n++) {\r\n\t\tSSurface* pSurf = &m_surface[n];\r\n\t\t// Could later modify to (surfaceW >= w) && (surfaceH >= h) && (w*h >= 80% of surface w*h)\r\n\t\t// 80%-100% reuse should be ok.\r\n\t\tif ((pSurf->free) && (pSurf->w == w) && (pSurf->h == h)) { \r\n\t\t\tfound = n;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tu16 idx;\r\n\tif (found < 0) {\r\n\t\tidx = m_surfaceCount++;\r\n\t} else {\r\n\t\tidx = found;\r\n\t}\r\n\r\n\tSSurface* pSurf = &m_surface[idx];\r\n\tif (found < 0) {\r\n\t\tpSurf->x\t\t= x;\r\n\t\tpSurf->y\t\t= y;\r\n\t}\r\n\t// pSurf->flip\t\t= false;\r\n\tpSurf->w\t\t= w;\r\n\tpSurf->h\t\t= h;\r\n\tpSurf->alloc_w\t= w;\r\n\tpSurf->alloc_h\t= h;\r\n\tpSurf->m_sprite\t= spr;\r\n\tpSurf->free\t\t= false;\r\n\tpSurf->swBuffer = KLBNEWA(u8, w * h * m_currFormat);\r\n\r\n\treturn (pSurf->swBuffer != NULL);\r\n}\r\n\r\n#include \"CKLBTextTempBuffer.h\"\r\n\r\nvoid TexturePackerOnce::moveImage(u16 id) {\r\n\t// For now does not support any rotation.\r\n\t// - Update the sprite.\r\n\tSSurface* pSurf = &m_surface[id];\r\n\r\n\tint yt   = pSurf->y - 1;\r\n\tint wt   = pSurf->w + 1;\r\n\tint wtp1 = wt + 1;\r\n\r\n\tif (g_useSWBuffer) {\r\n\t\t//\r\n\t\t// Update software buffer\r\n\t\t//\r\n\t\tu8* pSrc = pSurf->swBuffer;\r\n\t\tu8* pDst = &m_swBuffer[(pSurf->x + ((pSurf->y)*m_texture->getWidth())) * m_currFormat];\r\n\t\t// Fill upper line\r\n\t\tmemset(pDst - ((m_texture->getWidth()+1) * m_currFormat), 0, wtp1 * m_currFormat);\r\n\t\tfor (int y = 0; y < pSurf->h; y++) {\r\n\t\t\tmemcpy(pDst,pSrc,pSurf->w * m_currFormat);\r\n\t\t\t// Left Side\r\n\t\t\tif (m_currFormat == 4) {\r\n\t\t\t\tpDst[-4] = 0;\r\n\t\t\t\tpDst[-3] = 0;\r\n\t\t\t}\r\n\t\t\tpDst[-2] = 0;\r\n\t\t\tpDst[-1] = 0;\r\n\t\r\n\t\t\t// Right Side\r\n\t\t\tu8* tmp = &pDst[pSurf->w * m_currFormat];\r\n\t\t\tif (m_currFormat == 4) {\r\n\t\t\t\t*tmp++ = 0;\r\n\t\t\t\t*tmp++ = 0;\r\n\t\t\t}\r\n\t\t\t*tmp++ = 0;\r\n\t\t\t*tmp++ = 0;\r\n\t\r\n\t\t\tpSrc += pSurf->w * m_currFormat;\r\n\t\t\tpDst += m_texture->getWidth() * m_currFormat;\r\n\t\t}\r\n\t\t// Fill lower line\r\n\t\tmemset(pDst - m_currFormat, 0, wtp1 * m_currFormat);\r\n\t\r\n\t\tif (yt < m_startYChange)\t{\tm_startYChange = yt;\t}\r\n\t\tyt += pSurf->h + 2;\r\n\t\tif (yt > m_endYChange)\t\t{\tm_endYChange   = yt;\t}\r\n\t} else {\r\n\t\tint xt = pSurf->x - 1;\r\n\t\tint ht = pSurf->h + 1;\r\n\t\tint htp1 = ht + 1;\r\n\r\n\t\t// Top left rect at x,y\r\n\t\tu32 sz = pSurf->w > pSurf->h ? wtp1 : htp1;\r\n\t\tu8* ptrNull = CKLBTextTempBuffer::reallocateBuffer(sz,1,4);\r\n\t\tmemset(ptrNull, 0, sz * 4);\r\n\r\n\t\t// fill edges OUTSIDE the user texture.\r\n\t\tm_texture->updateTexture(xt, yt       , wtp1, 1, ptrNull, m_currFormat * htp1);\r\n\t\tm_texture->updateTexture(xt, yt + ht  , wtp1, 1, ptrNull, m_currFormat * htp1);\r\n\t\tm_texture->updateTexture(xt       , yt, 1, htp1, ptrNull, m_currFormat * wtp1);\r\n\t\tm_texture->updateTexture(xt + wt  , yt, 1, htp1, ptrNull, m_currFormat * wtp1);\r\n\r\n\t\tm_texture->updateTexture(\r\n\t\t\tpSurf->x,\r\n\t\t\tpSurf->y,\r\n\t\t\tpSurf->w,\r\n\t\t\tpSurf->h,\r\n\t\t\tpSurf->swBuffer,\r\n\t\t\tm_currFormat * pSurf->w * pSurf->h\r\n\t\t);\r\n\t}\r\n\r\n}\r\n/*\r\n#include \"CKLBTextTempBuffer.h\"\r\n\r\nvoid TexturePackerOnce::moveImage(u16 id) {\r\n\t// For now does not support any rotation.\r\n\t// - Update the sprite.\r\n\tSSurface* pSurf = &m_surface[id];\r\n\r\n\tu8* buff = CKLBTextTempBuffer::reallocateBuffer((pSurf->w + 2), (pSurf->h + 2), this->m_currFormat);\r\n\r\n\tmemset(buff, 0, (pSurf->w + 2) * (pSurf->h + 2) * this->m_currFormat);\r\n\r\n\tif (buff) {\r\n\t\t//\r\n\t\t// Copy with border set to \"0\"\r\n\t\t//\r\n\t\t//\r\n\t\t//\r\n\t\t//\t\t\t\t. is source buffer\r\n\t\t//\t\t\t\t@ is border we create inside the texture.\r\n\t\t//\r\n\t\t//\t\t@@@@@@@@@@@@@@\r\n\t\t//\t\t@............@\r\n\t\t//\t\t@............@\r\n\t\t//\t\t@............@\r\n\t\t//\t\t@............@\r\n\t\t//\t\t@............@\r\n\t\t//\t\t@@@@@@@@@@@@@@\r\n\t\t//\r\n\r\n\t\tu32 strideSrc  = pSurf->w * this->m_currFormat;\r\n\t\tu32 strideDest = strideSrc + (this->m_currFormat<<1);\t// + Left and right border\r\n\r\n\t\t// Fill Rect\r\n\t\tif (this->m_currFormat == 2) {\r\n\t\t\t#ifdef INTERNAL_FILL_WITH_COLOR_TEXPACKER\r\n\t\t\t\t#define FILL_COLOR_4444\t\t(0xF00F)\r\n\t\t\t#else\r\n\t\t\t\t#define FILL_COLOR_4444\t\t(0x0)\r\n\t\t\t#endif\r\n\t\t\t// Top edge\r\n\t\t\tu16* buffFill\t= (u16*)buff;\r\n\t\t\tu16* endBuffFill= &buffFill[(pSurf->w + 2)];\r\n\t\t\twhile (buffFill != endBuffFill) {\r\n\t\t\t\t*buffFill++ = FILL_COLOR_4444;\r\n\t\t\t}\r\n\r\n\t\t\t// Bottom edge\r\n\t\t\tbuffFill = (u16*)buff;\r\n\t\t\tbuffFill = &buffFill[(strideDest >> 1)*(pSurf->h+1)];\r\n\t\t\tendBuffFill= &buffFill[(pSurf->w + 2)];\r\n\t\t\twhile (buffFill != endBuffFill) {\r\n\t\t\t\t*buffFill++ = FILL_COLOR_4444;\r\n\t\t\t}\r\n\r\n\t\t\t// Left Edge\r\n\t\t\t// Right Edge\r\n\t\t\tbuffFill = (u16*)buff;\r\n\t\t\tbuffFill = &buffFill[(strideDest >> 1)];\r\n\t\t\tendBuffFill= &buffFill[(strideDest >> 1)*pSurf->h];\r\n\t\t\tu32 step = (strideDest >> 1);\r\n\t\t\twhile (buffFill != endBuffFill) {\r\n\t\t\t\tbuffFill[0]\t\t\t\t= FILL_COLOR_4444;\r\n\t\t\t\tbuffFill[pSurf->w+1]\t= FILL_COLOR_4444;\r\n\t\t\t\tbuffFill += step;\r\n\t\t\t}\r\n\r\n\t\t\t#undef FILL_COLOR_4444\r\n\r\n\t\t} else {\r\n\t\t\tklb_assert(this->m_currFormat == 4, \"INVALID PIXEL FORMAT\");\r\n\r\n\t\t\t#ifdef INTERNAL_FILL_WITH_COLOR_TEXPACKER\r\n\t\t\t\t#define FILL_COLOR_32\t\t(0xFF0000FF)\r\n\t\t\t#else\r\n\t\t\t\t#define FILL_COLOR_32\t\t(0)\r\n\t\t\t#endif\r\n\r\n\t\t\t// Top edge\r\n\t\t\tu32* buffFill\t= (u32*)buff;\r\n\t\t\tu32* endBuffFill= &buffFill[(pSurf->w + 2)];\r\n\t\t\twhile (buffFill != endBuffFill) {\r\n\t\t\t\t*buffFill++ = FILL_COLOR_32;\r\n\t\t\t}\r\n\r\n\t\t\t// Bottom edge\r\n\t\t\tu32 step = (strideDest >> 2);\r\n\t\t\tbuffFill = (u32*)buff;\r\n\t\t\tbuffFill = &buffFill[step*(pSurf->h+1)];\r\n\t\t\tendBuffFill= &buffFill[(pSurf->w + 2)];\r\n\t\t\twhile (buffFill != endBuffFill) {\r\n\t\t\t\t*buffFill++ = FILL_COLOR_32;\r\n\t\t\t}\r\n\r\n\t\t\t// Left Edge\r\n\t\t\t// Right Edge\r\n\t\t\tbuffFill = (u32*)buff;\r\n\t\t\tbuffFill = &buffFill[step];\r\n\t\t\tendBuffFill= &buffFill[step*pSurf->h];\r\n\t\t\twhile (buffFill != endBuffFill) {\r\n\t\t\t\tbuffFill[0]\t\t\t\t= FILL_COLOR_32;\r\n\t\t\t\tbuffFill[pSurf->w+1]\t= FILL_COLOR_32;\r\n\t\t\t\tbuffFill += step;\r\n\t\t\t}\r\n\r\n\t\t\t#undef FILL_COLOR_32\r\n\t\t}\r\n\r\n\t\t// Copy inside\r\n\t\tu8* buffFill\t= &buff[strideDest + this->m_currFormat];\r\n\t\tu8* buffSrc\t\t= pSurf->swBuffer;\r\n\r\n\t\tfor (int y=0; y < pSurf->h; y++) {\r\n\t\t\tmemcpy(buffFill, buffSrc, this->m_currFormat * pSurf->w);\r\n\t\t\tbuffFill += strideDest;\r\n\t\t\tbuffSrc  += strideSrc;\r\n\t\t}\r\n\r\n\t\t// Setup the buffer to include\r\n\t\tm_texture->updateTexture(\r\n\t\t\tpSurf->x - 1,\r\n\t\t\tpSurf->y - 1,\r\n\t\t\tpSurf->w + 2,\r\n\t\t\tpSurf->h + 2,\r\n\t\t\tbuff,\r\n\t\t\tm_currFormat * (pSurf->w+2) * (pSurf->h+2)\r\n\t\t);\r\n\t} else {\r\n\t\tklb_assertAlways(\"Allocation error\");\r\n\t}\r\n}\r\n*/\r\n\r\nvoid TexturePackerOnce::updateTexture(u16 surface) {\r\n\tmoveImage(surface);\r\n}\r\n\r\nvoid TexturePackerOnce::getSurfaceInfo(u16 surface, u32*& pixel, float& u0, float& v0, float& u1, float& v1, float &stepU, float &stepV) {\r\n\tklb_assert((surface < m_surfaceCount), \"Texture Packer no more surface available\");\r\n\tklb_assert((m_surface[surface].free == false), \"Error : Try to access freed object\");\r\n\tfloat w = ((float)this->m_width );\r\n\tfloat h = ((float)this->m_height);\r\n\r\n\tpixel\t= (u32*)m_surface[surface].swBuffer;\r\n\tu0\t\t= m_surface[surface].x / w;\r\n\tv0\t\t= m_surface[surface].y / h;\r\n\tu1\t\t= (m_surface[surface].x + m_surface[surface].w) / w;\r\n\tv1\t\t= (m_surface[surface].y + m_surface[surface].h) / h;\r\n\tstepU\t= 1.0f / w;\r\n\tstepV\t= 1.0f / h;\r\n}\r\n\r\nvoid TexturePackerOnce::refreshTexture() {\r\n\tint height = m_endYChange - m_startYChange;\r\n\tm_texture->updateTexture(\r\n\t\t0,\r\n\t\tm_startYChange,\r\n\t\tm_texture->getWidth(),\r\n\t\theight,\r\n\t\t&m_swBuffer[m_startYChange * m_texture->getWidth() * m_currFormat],\r\n\t\tm_texture->getWidth() * height * m_currFormat);\r\n\r\n\tm_startYChange\t= 0x4000;\r\n\tm_endYChange\t= 0;\r\n}\r\n\r\nvoid TexturePacker::refreshTextures() {\r\n\tif (g_useSWBuffer == false) { return; }\r\n\r\n\tfor (int n = 0; n < MAX_TEXTURES ; n++) {\r\n\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\tif (pCurr && (pCurr->m_startYChange < pCurr->m_endYChange)) {\r\n\t\t\tpCurr->refreshTexture();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// =====================================\r\n//\tTexturePacker\r\n// =====================================\r\n\r\nbool TexturePacker::init(u16 width, u16 height, u16 defaultFormat) {\r\n\tklb_assert(CKLBUtility::nearest2Pow(width)  == width , \"Not a power of 2.\");\r\n\tklb_assert(CKLBUtility::nearest2Pow(height) == height, \"Not a power of 2.\");\r\n\r\n\tfor (int n = 0; n < MAX_TEXTURES; n++) {\r\n\t\tm_allocatedPacker[n] = NULL;\r\n\t}\r\n\r\n\tm_currFormat\t= defaultFormat;\r\n\r\n\tm_lastUsedPacker[FORMAT_8888] = NULL;\r\n\tm_lastUsedPacker[FORMAT_4444] = NULL;\r\n\tm_lastUsedPacker[FORMAT_8\t] = NULL;\r\n\r\n\tm_width\t\t= width;\r\n\tm_height\t= height;\r\n\tm_update\t= NULL_IDX;\r\n\tignoreCount\t= 0;\r\n\r\n\tm_allocatedPacker[0] = KLBNEW(TexturePackerOnce);\r\n\tif (m_allocatedPacker[0] && m_allocatedPacker[0]->init(width,height, m_currFormat)) {\r\n\t\tm_lastUsedPacker[m_currFormat]\t= m_allocatedPacker[0];\r\n\t\tm_allocatedPacker[0]->marker = 0;\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid TexturePacker::release() {\r\n\tfor (int n = 0; n < MAX_TEXTURES; n++) {\r\n\t\tif (m_allocatedPacker[n]) {\r\n\t\t\tm_allocatedPacker[n]->release();\r\n\t\t\tKLBDELETE(m_allocatedPacker[n]);\r\n\t\t\tm_allocatedPacker[n] = NULL;\r\n\t\t}\r\n\t}\r\n\r\n\tm_lastUsedPacker[FORMAT_8888] = NULL;\r\n\tm_lastUsedPacker[FORMAT_4444] = NULL;\r\n\tm_lastUsedPacker[FORMAT_8\t] = NULL;\r\n}\r\n\r\nvoid TexturePacker::dump(bool detail) {\r\n\tfor (int n = 0; n < MAX_TEXTURES; n++) {\r\n\t\tif (m_allocatedPacker[n]) {\r\n\t\t\tm_allocatedPacker[n]->dump(detail);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nTexturePackerOnce* TexturePacker::allocateAllocator(u16 w, u16 h) {\r\n\tfor (int n = 0; n < MAX_TEXTURES; n++) {\r\n\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\tif (!pCurr) {\r\n\t\t\t// Create new surface.\r\n\t\t\tTexturePackerOnce* pNew = KLBNEW(TexturePackerOnce);\r\n\t\t\tif (pNew) {\r\n\t\t\t\tpNew->marker = (u16)(n << 12);\r\n\r\n\t\t\t\tu32 sw = m_width;\r\n\t\t\t\tu32 sh = m_height;\r\n\r\n\t\t\t\tif ((w > sw) || (h > sh)) {\r\n\t\t\t\t\tsw = CKLBUtility::nearest2Pow(w);\r\n\t\t\t\t\tsh = CKLBUtility::nearest2Pow(h);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pNew && pNew->init((u16)sw, (u16)sh, m_currFormat)) {\r\n\t\t\t\t\tm_allocatedPacker[n] = pNew; \r\n\t\t\t\t\treturn pNew;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tKLBDELETE(pNew);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nu32 globalCount = 0;\r\n\r\nu16  TexturePacker::allocateSurface(CKLBSprite* spr, u16 w, u16 h, void* ptrOwner,compact cbCompaction) {\r\n\tklb_assert(w <= m_width , \"Can never allocate surface wider than texture\" );\r\n\tklb_assert(h <= m_height, \"Can never allocate surface higher than texture\");\r\n\r\n\ts64 startTime = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\tif (m_lastUsedPacker[m_currFormat] == NULL) {\r\n\t\tm_lastUsedPacker[m_currFormat] = allocateAllocator(w,h);\t// Allocate (no default mean none available)\r\n\t\tif (!m_lastUsedPacker[m_currFormat]) {\r\n\t\t\treturn NULL_IDX;\t// Critical Failure !!! : can not reallocate old items.\r\n\t\t}\r\n\t}\r\n\r\n\tTexturePackerOnce* pOnce = NULL;\r\n\tu16 surface = m_lastUsedPacker[m_currFormat]->allocateSurface(spr, w, h, ptrOwner, cbCompaction, &pOnce);\r\n\tif (surface != NULL_IDX) {\r\n\t\tklb_assert(pOnce, \"null pointer\");\r\n\t\tm_update = surface | pOnce->marker;\r\n\t\tklb_assert((m_update & 0xFFF) < pOnce->m_surfaceCount, \"Error.\");\r\n\t} else {\r\n\t\taddIgnoreList(m_lastUsedPacker[m_currFormat]);\r\n\t\tm_update = useOtherAlloc(spr, w, h, ptrOwner, cbCompaction);\r\n\t\tremoveIgnoreList(m_lastUsedPacker[m_currFormat]);\r\n\t\tklb_assert(m_update != NULL_IDX, \"Allocation did not work. Can not allocate\");\r\n\t}\r\n\r\n\ts64 endTime = CPFInterface::getInstance().platform().nanotime();\r\n\tfloat time  = ((endTime - startTime) / 1000000.0f);\r\n\tif (time > 1.0f) {\t// More than 1 ms.\r\n\t\tDEBUG_PRINT(\"2D Texture Packer : %5.2f ms\",time);\r\n\t}\r\n\r\n\treturn m_update;\r\n}\r\n\r\nbool TexturePacker::notInIgnoreList(TexturePackerOnce* pack) {\r\n\tfor (int n = 0; n < ignoreCount; n++) {\r\n\t\tif (pack == ignore[n]) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid TexturePacker::addIgnoreList(TexturePackerOnce* pack) {\r\n\t// Check if not in list already.\r\n\tfor (int n = 0; n < ignoreCount; n++) {\r\n\t\tif (pack == ignore[n]) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t// Add new item to the list.\r\n\tignore[ignoreCount++] = pack;\r\n}\r\n\r\nvoid TexturePacker::removeIgnoreList(TexturePackerOnce* pack) {\r\n\tint n;\r\n\tfor (n = 0; n < ignoreCount; n++) {\r\n\t\tif (pack == ignore[n]) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tfor (; n < ignoreCount-1; n++) {\r\n\t\tignore[n] = ignore[n+1];\r\n\t}\r\n\tignoreCount--;\r\n}\r\n\r\nu16 TexturePacker::useOtherAlloc(CKLBSprite* spr, u16 w, u16 h, void* ptrOwner,compact cbCompaction) {\r\n\t// 1. Try to find allocator supporting new allocated size.\r\n\tTexturePackerOnce* pRealAlloc = NULL;\r\n\tu16 surface;\r\n\tu32 max\t\t\t\t\t\t\t= w*h;\t// Search only bigger than this.\r\n\tfor (int n = 0; n<MAX_TEXTURES ; n++) {\r\n\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\tif (pCurr && (notInIgnoreList(pCurr)) && (pCurr->m_currFormat == m_currFormat)) {\r\n\t\t\tif (pCurr->m_freeSurface > max) {\r\n\t\t\t\tsurface = pCurr->allocateSurface(spr, w, h, ptrOwner, cbCompaction, &pRealAlloc);\r\n\t\t\t\tif (surface != NULL_IDX) {\r\n\t\t\t\t\tm_lastUsedPacker[m_currFormat] = pRealAlloc;\r\n\t\t\t\t\treturn surface | pRealAlloc->marker;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// 2. If fail, allocate new surface\r\n\tTexturePackerOnce* pOnce = allocateAllocator(w, h);\r\n\tif (pOnce) {\r\n\t\tsurface = pOnce->allocateSurface(spr, w, h, ptrOwner, cbCompaction, &pRealAlloc);\r\n\t\t// If valid allocation switch to new allocator as default.\r\n\t\tif (surface != NULL_IDX) {\r\n\t\t\tm_lastUsedPacker[m_currFormat] = pRealAlloc;\r\n\t\t\tsurface |= pRealAlloc->marker;\r\n\t\t}\r\n\t\treturn surface;\r\n\t} else {\r\n\t\treturn NULL_IDX;\r\n\t}\r\n}\r\n\r\nu16\t TexturePacker::reallocateSurface(u16 surface, u16 w, u16 h) {\r\n\tklb_assert(w <= m_width , \"Can never allocate surface wider than texture\" );\r\n\tklb_assert(h <= m_height, \"Can never allocate surface higher than texture\");\r\n\r\n\tTexturePackerOnce* pRealAlloc;\r\n\tu16 nsurface = m_allocatedPacker[surface>>12]->reallocateSurface(surface & 0xFFF, w,h,&pRealAlloc);\r\n\tif (nsurface != NULL_IDX) {\r\n\t\tklb_assert(pRealAlloc, \"null pointer\");\r\n\t\tm_update = nsurface | pRealAlloc->marker;\r\n\t\tklb_assert((m_update & 0xFFF) < pRealAlloc->m_surfaceCount, \"Error.\");\r\n\t} else {\r\n\t\tu16 surfID = surface & 0xFFF;\r\n\t\tCKLBSprite* pSpr\t= m_allocatedPacker[surface>>12]->getSprite  (surfID);\r\n\t\tvoid*\t\tpRef\t= m_allocatedPacker[surface>>12]->getOwnerCtx(surfID);\r\n\t\tcompact\t\tcbCompaction = m_allocatedPacker[surface>>12]->getOwnerCB(surfID);\r\n\t\tnsurface = useOtherAlloc(pSpr, w, h, pRef, cbCompaction);\r\n\t\tif (nsurface != NULL_IDX) {\r\n\t\t\tklb_assert((nsurface & 0xFFF) < m_lastUsedPacker[nsurface>>12]->m_surfaceCount, \"Error.\");\r\n\t\t\t// Free old surface if successfull.\r\n\t\t\tm_allocatedPacker[surface>>12]->releaseSurface(surface);\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"Allocation did not work. Can not allocate\");\r\n\t\t}\r\n\t\tm_update = nsurface;\r\n\t}\r\n\t\r\n\treturn m_update;\r\n}\r\n\r\nvoid TexturePacker::releaseSurface(u16 surface) {\r\n\tTexturePackerOnce* pPack = m_allocatedPacker[surface>>12];\r\n\tpPack->releaseSurface(surface & 0xFFF);\r\n\r\n\t// Free full surface when empty.\r\n\tif (pPack->m_freeSurface == pPack->m_totalSurface) {\r\n\t\tif ((surface>>12) != 0) {\r\n\t\t\tif (m_lastUsedPacker[pPack->m_currFormat] == m_allocatedPacker[surface>>12]) {\r\n\t\t\t\tu32 freeSurface = 0;\r\n\t\t\t\tTexturePackerOnce* result = NULL;\r\n\t\t\t\t// Search any texture allocator of same format around with maximal free surface\r\n\t\t\t\tfor (int n = 0; n<MAX_TEXTURES ; n++) {\r\n\t\t\t\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\t\t\t\tif (pCurr && (pCurr != pPack) && (pCurr->m_currFormat == pPack->m_currFormat)) {\r\n\t\t\t\t\t\tif (pCurr->m_freeSurface > freeSurface) {\r\n\t\t\t\t\t\t\tfreeSurface = pCurr->m_freeSurface;\r\n\t\t\t\t\t\t\tresult = pCurr;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If not found, none available.\r\n\t\t\t\tm_lastUsedPacker[pPack->m_currFormat] = result;\r\n\t\t\t}\r\n\r\n\t\t\tpPack->release();\r\n\t\t\tKLBDELETE(pPack);\r\n\r\n\t\t\tm_allocatedPacker[surface>>12] = NULL;\r\n\t\t} else {\r\n\t\t\t// Do not free texture 0, just clean list.\r\n\t\t\tpPack->reset();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid TexturePacker::getSurfaceInfo(u16 surface, u32*& pixel, float& u0, float& v0, float& u1, float& v1, float& stepU, float& stepV) {\r\n\tklb_assert(surface != NULL_IDX, \"Error\");\r\n\tm_allocatedPacker[surface>>12]->getSurfaceInfo(surface & 0xFFF, pixel, u0, v0, u1, v1, stepU, stepV);\r\n}\r\n\r\nCTextureUsage* TexturePacker::getTextureUsage(u16 surface) {\r\n\treturn m_allocatedPacker[surface>>12]->getTextureUsage();\r\n}\r\n\r\nvoid TexturePacker::updateTexture(u16 texture) {\r\n\tif (texture != NULL_IDX) {\r\n\t\tm_allocatedPacker[texture>>12]->updateTexture(texture & 0xFFF);\r\n\t}\r\n}\r\n\r\nvoid TexturePacker::setFormat(u16 format) {\r\n\tm_currFormat = format;\r\n}\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\r\nvoid TexturePackerOnce::scan(void* ctx) {\r\n\tfor (int n = 0; n<m_surfaceCount; n++) {\r\n\t\tif (m_surface[n].free) {\r\n\t\t\tklb_assert(m_surface[n].ownerCtx == NULL, \"Should be cleaned by current logic\");\r\n\t\t} else {\r\n\t\t\tklb_assert(m_surface[n].ownerCtx != ctx , \"Should not own ref anymore !\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid TexturePacker::scan(void* ctx) {\r\n\tfor (int n = 0; n<MAX_TEXTURES ; n++) {\r\n\t\tTexturePackerOnce* pCurr\t= m_allocatedPacker[n];\r\n\t\tif (pCurr) {\r\n\t\t\tpCurr->scan(ctx);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#endif\r\n\r\nstatic CKLBLuaLibPackerControl libdef(0);\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* CKLBLuaLibPackerControl::ms_libRegStruct = CKLBLibRegistrator::getInstance()->add(\"LibPackerControl\", CLS_KLBPACKERCTRL);\r\n\r\nCKLBLuaLibPackerControl::CKLBLuaLibPackerControl(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibPackerControl::~CKLBLuaLibPackerControl()\r\n{\r\n}\r\n\r\n// Lua�֐��̒ǉ�\r\nvoid\r\nCKLBLuaLibPackerControl::addLibrary()\r\n{\r\n\taddFunction(\"ENG_use8888texture\", CKLBLuaLibPackerControl::use8888Texture);\r\n}\r\n\r\nint\r\nCKLBLuaLibPackerControl::use8888Texture(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\t\r\n\tbool active8888 = lua.getBool(1);\r\n\r\n\tif (active8888) {\r\n\t\tTexturePacker::s_currentTextureMode = FORMAT_8888;\r\n\t} else {\r\n\t\tTexturePacker::s_currentTextureMode = FORMAT_4444;\r\n\t}\r\n\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Assets/CKLBTexturePacker.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __TEXTURE_PACKER__\r\n#define __TEXTURE_PACKER__\r\n\r\n#include \"BaseType.h\"\r\n#include \"CKLBRendering.h\"\r\n\r\n// If defined, allocated buffer are filled with color for debugging.\r\n// #define INTERNAL_FILL_WITH_COLOR_TEXPACKER\r\n\r\nclass TexturePackerOnce;\r\n\r\ntypedef void (*compact)(void* ctx, u16 surfaceID, u16 newSurfaceID);\r\n\r\n#define FORMAT_8888\t\t(4)\r\n#define FORMAT_4444\t\t(2)\r\n#define FORMAT_8\t\t(1)\r\n\r\n#define STARTUP_FORMAT\t(FORMAT_8888)\r\n\r\nclass CKLBLuaLibPackerControl;\r\n\r\nclass TexturePacker {\r\n\tfriend class TexturePackerOnce;\r\n\tfriend class CKLBLuaLibPackerControl;\r\npublic:\r\n\tinline\r\n\tstatic u8 getCurrentModeTexture() {\r\n\t\treturn s_currentTextureMode;\r\n\t}\r\n\r\n\tinline\r\n\tstatic TexturePacker& getInstance() {\r\n\t\tstatic TexturePacker instance;\r\n\t\treturn instance;\r\n\t}\r\n\r\n\tbool init\t\t\t\t(u16 width,\t\t\tu16 height, u16 format);\r\n\tvoid release\t\t\t();\r\n\tvoid dump\t\t\t\t(bool detail);\r\n\tvoid refreshTextures\t();\r\n\tvoid unloadSurface\t\t();\r\n\tvoid reloadSurfaces\t\t();\r\n\r\n\tu16  allocateSurface\t(CKLBSprite* spr,\tu16 w,\t\tu16 h\t, void* ptrOwner, compact cbCompaction);\r\n\tu16\t reallocateSurface\t(u16 surface,\t\tu16 w,\t\tu16 h\t);\r\n\tvoid releaseSurface\t\t(u16 surface);\r\n\tvoid getSurfaceInfo\t\t(u16 surface,\t\tu32*& pixel, float& u0, float& v0, float& u1, float& v1, float& stepU, float& stepV);\r\n\tCTextureUsage*\r\n\t\t getTextureUsage\t(u16 surface);\r\n\tu16\t getSurfaceStride\t()\t{ return m_width;\t\t\t}\r\n\tvoid updateTexture\t\t(u16 surface);\r\n\tvoid setFormat\t\t\t(u16 format);\r\n\r\n#ifdef DEBUG_TEXTURE_PACKER\r\n\tvoid scan\t\t\t\t(void* ctx);\r\n\tvoid setCurrentDelete\t(void* ptr);\r\n#endif\r\n\r\nprivate:\r\n\tu16\t useOtherAlloc\t\t(CKLBSprite* spr,\tu16 w,\t\tu16 h\t, void* ptrOwner,compact cbCompaction);\r\n\tTexturePackerOnce*\r\n\t\t allocateAllocator\t(u16 w, u16 h);\r\n\tbool notInIgnoreList\t(TexturePackerOnce* pack);\r\n\tvoid removeIgnoreList\t(TexturePackerOnce* pack);\r\n\tvoid addIgnoreList\t\t(TexturePackerOnce* pack);\r\n\r\n\t// Maximum 4 bit on 16 bit index.\r\n\t#define MAX_TEXTURES\t(16)\r\n\tu16\t\t\t\t\tm_currFormat;\r\n\tu16\t\t\t\t\tm_width;\r\n\tu16\t\t\t\t\tm_height;\r\n\tu16\t\t\t\t\tm_update;\r\n\t// Mode 8888, 4444, 8\r\n\tTexturePackerOnce*\tm_lastUsedPacker\t[5];\r\n\tTexturePackerOnce*\tm_allocatedPacker\t[MAX_TEXTURES];\r\n\r\n\tTexturePackerOnce*\tignore\t\t\t\t[MAX_TEXTURES];\r\n\tu8\t\t\t\t\tignoreCount;\r\n\r\n\tstatic\r\n\tu8\t\t\t\t\ts_currentTextureMode;\r\n};\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibPackerControl : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibPackerControl();\r\n\r\n\tstatic int use8888Texture(lua_State * L);\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibPackerControl(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibPackerControl();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n};\r\n\r\n#endif \t// ifndef __TEXTURE_PACKER__\r\n"
  },
  {
    "path": "Engine/source/Assets/CompositeManagement.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include \"CompositeManagement.h\"\r\n#include \"mem.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n#include \"CKLBLabelNode.h\"\r\n#include \"CKLBSplineNode.h\"\r\n#include \"AudioAsset.h\"\r\n#include \"CKLBUITextInput.h\"\r\n#include \"CKLBUIVariableItem.h\"\r\n#include \"CKLBPropertyBag.h\"\r\n#include \"CKLBSplineNode.h\"\r\n#include \"CKLBUIGroup.h\"\r\n#include \"CKLBLuaLibSOUND.h\"\r\n\r\n// === Scroll Bar Parameters\r\n#define VAR_MIN\t\t\t\t\t\t(0)\r\n#define VAR_MAX\t\t\t\t\t\t(1)\r\n#define VAR_SLIDERSIZE\t\t\t\t(2)\r\n#define VAR_MIN_SLIDERSIZE\t\t\t(3)\r\n#define VAR_SELECTCOLOR\t\t\t\t(4)\r\n\r\n#define DB_VAR_MIN\t\t\t\t\t(0)\r\n#define DB_VAR_MAX\t\t\t\t\t(1)\r\n\r\n// Progress bar / ScrollBar\r\n#define DB_VAL_VALUE\t\t\t\t(2)\r\n// =========================================\r\n\r\n// === Canvas Parameters\r\n#define VAR_MAXVERTEX\t\t\t\t(0)\r\n#define VAR_MAXINDEX\t\t\t\t(1)\r\n// =========================================\r\n\r\n#define DB_VAR_STARTANGLE\t\t\t(0)\r\n#define DB_VAR_ENDANGLE\t\t\t\t(1)\r\n\r\n#define DB_VAR_ENABLE\t\t\t\t(0)\r\n#define DB_VAR_CHECKED\t\t\t\t(1)\r\n#define DB_VAL_COLOR\t\t\t\t(3)\r\n\r\n/*\r\n{\r\n\tx\r\n\ty\r\n\tsx\r\n\tsy\r\n\tlw\r\n\tlh\r\n\tlayoutInfo\r\n\tclassID\r\n\tsh\r\n\tsw\r\n\tpriority\r\n\t\r\n\t\"class\"\r\n\t\"on*\"\t\r\n\t\"default\"/\"select\"/\"disable\"/\"focus\"\r\n\t\r\n\t\"sub\" : [\r\n\t]\r\n}*/\r\n\r\nenum {\r\n\tNORMAL_ASSET\t\t= 0,\r\n\tDISABLE_ASSET\t\t= 1,\r\n\tFOCUS_ASSET\t\t\t= 2,\r\n\tPUSH_ASSET\t\t\t= 3,\r\n\tASSET4\t\t\t\t= 4,\r\n\tASSET5\t\t\t\t= 5,\r\n\tASSET6\t\t\t\t= 6,\r\n\tASSET7\t\t\t\t= 7,\r\n\tASSET8\t\t\t\t= 8,\r\n\tASSET9\t\t\t\t= 9,\r\n\t____END_ASSET\t\t= 10,\r\n\r\n\tDOWNAUDIO_ASSET\t\t= 8,\r\n\tUPAUDIO_ASSET\t\t= 9,\r\n};\r\n\r\nenum {\r\n\tNONE_CLASSID\t\t= 0,\r\n\tBUTTON_CLASSID\t\t= 1,\r\n\tCHECK_CLASSID\t\t= 2,\r\n\tCONTAINER_CLASSID\t= 3,\r\n\tLABEL_CLASSID\t\t= 4,\r\n\tTEXTBOX_CLASSID\t\t= 5,\r\n\tANIMNODE_CLASSID\t= 6,\r\n\tWEBVIEW_CLASSID\t\t= 7,\r\n\tVIRTUALDOC_CLASSID\t= 8,\r\n\tSCORE_CLASSID\t\t= 9,\r\n\tPROGRESSBAR_CLASSID\t= 10,\r\n\tDRAGICON_CLASSID\t= 11,\r\n\tLIST_CLASSID\t\t= 12,\r\n\tPIECHART_CLASSID\t= 13,\r\n\tSCROLLBAR_CLASSID\t= 14,\r\n\tCANVAS_CLASSID\t\t= 15,\r\n\tSCALE9_CLASSID\t\t= 16,\r\n\tVARITEM_CLASSID\t\t= 17,\r\n\tGROUP_CLASSID\t\t= 18,\r\n\tTILEDCANVAS_CLASSID\t= 19,\r\n};\r\n\r\n#include \"../../libs/JSonParser/api/yajl_parse.h\"\r\n#include \"../../libs/JSonParser/api/yajl_gen.h\"\r\n\r\nCKLBAnimInfo::CKLBAnimInfo()\r\n:mode\t\t(NULL)\r\n,modeID\t\t(0)\r\n,m_next\t\t(NULL)\r\n,data\t\t(NULL)\r\n,spline\t\t(1)\r\n,loop\t\t(0)\r\n,pingpong\t(0)\r\n,fromX\t\t(0)\r\n,toX\t\t(0)\r\n,fromY\t\t(0)\r\n,toY\t\t(0)\r\n\r\n,fromScaleX\t(1.0f)\r\n,toScaleX\t(1.0f)\r\n,fromScaleY\t(1.0f)\r\n,toScaleY\t(1.0f)\r\n,fromRotation\t(0.0f)\r\n,toRotation\t\t(0.0f)\r\n\r\n,fromAlpha\t(255)\r\n,toAlpha\t(255)\r\n\r\n,fromR\t\t(255)\r\n,toR\t\t(255)\r\n\r\n,fromG\t\t(255)\r\n,toG\t\t(255)\r\n\r\n,fromB\t\t(255)\r\n,toB\t\t(255)\r\n{\r\n}\r\n\r\nCKLBAnimInfo::~CKLBAnimInfo() {\r\n\tKLBDELETEA(data);\r\n}\r\n\r\n#include \"ArrayAllocator.h\"\r\n\r\nArrayAllocator<CKLBInnerDef> gInnerDefAlloc;\r\n\r\n/*static*/ bool CKLBInnerDefManager::initManager(int size) {\r\n\treturn gInnerDefAlloc.init(size);\r\n}\r\n\r\n/*static*/ void CKLBInnerDefManager::releaseManager() {\r\n\tgInnerDefAlloc.release();\r\n}\r\n\r\n/*static*/ void* CKLBInnerDef::operator new\t\t(size_t /*size*/)\r\n{\r\n\t// Ignore size, we are fixed size type here.\r\n\treturn gInnerDefAlloc.allocEntry();\r\n}\r\n\r\n/*static*/ void CKLBInnerDef::operator delete\t(void *p)\r\n{\r\n\tgInnerDefAlloc.freeEntry((CKLBInnerDef*)p);\r\n}\r\n\r\nCKLBInnerDef::CKLBInnerDef()\r\n:next\t\t(NULL)\r\n,sub\t\t(NULL)\r\n,classID\t(NONE_CLASSID)\r\n,radioID\t(-1)\r\n,name\t\t(0)\r\n,text\t\t(NULL)\r\n,placeholder(NULL)\r\n,fontName\t(NULL)\r\n,color\t\t(0xFFFFFFFF)\r\n,fontSize\t(15)\r\n,clipw\t\t(0)\r\n,cliph\t\t(0)\r\n,width\t\t(0)\r\n,height\t\t(0)\r\n,id\t\t\t(0)\r\n,anim\t\t(NULL)\r\n,xscale\t\t(1.0f)\r\n,yscale\t\t(1.0f)\r\n,rotation\t(0.0f)\r\n,value\t\t(0)\r\n,priority\t(0)\r\n,spline\t\t(NULL)\r\n,propertyBag(NULL)\r\n,visible\t(true)\r\n,volAudioDown\t(100)\r\n,volAudioUp\t\t(100)\r\n{\r\n\tfor (u32 n = 0; n < MAX_HANDLER; n++) {\r\n\t\thandler[n] = NULL;\r\n\t}\r\n\r\n\tfor (u32 n = 0; n < ____END_ASSET ; n++) {\r\n\t\tassets[n] = NULL;\r\n\t}\r\n\r\n\tflag[0] = 0;\r\n\tflag[1] = 0;\r\n\tflag[2] = 1;\r\n\tflag[3] = 1;\r\n\t\r\n\tdbField[0] = NULL;\r\n\tdbField[1] = NULL;\r\n\tdbField[2] = NULL;\r\n\tdbField[3] = NULL;\r\n}\r\n\r\nCKLBInnerDef::~CKLBInnerDef() {\r\n\t//\r\n\t// Free assets.\r\n\t//\r\n\t/* All Entries are stored in the main CKLBComposite \"string\" list : Free occurs there.\r\n\tfor (int n=0; n < ____END_ASSET; n++) {\r\n\t\tif (assets[n]) {\r\n\t\t\tif (assets[n]->assetCache) {\r\n\t\t\t\tassets[n]->assetCache->decrementRefCount();\r\n\t\t\t}\r\n\t\t}\r\n\t} */\r\n\t\r\n\t// Spline info.\r\n\tKLBDELETEA(spline);\r\n\r\n\t// Free all linked definition.\r\n\tCKLBAnimInfo* pInfo = this->anim;\r\n\twhile (pInfo) {\r\n\t\tCKLBAnimInfo* pN = pInfo->m_next;\r\n\t\tKLBDELETE(pInfo);\r\n\t\tpInfo = pN;\r\n\t}\r\n\r\n\t// Free all sub definitions.\r\n\tCKLBInnerDef* p = this->sub;\r\n\twhile (p) {\r\n\t\tCKLBInnerDef* pN = p->next;\r\n\t\tKLBDELETE(p);\r\n\t\tp = pN;\r\n\t}\r\n}\r\n\r\n// ------------------- Plugin / Loader ------------------\r\n\r\n/*virtual*/\r\nCKLBAbstractAsset*\tCKLBCompositeAssetPlugin::loadAsset(u8* stream, u32 streamSize) {\r\n\tstatic yajl_callbacks callbacks = {  \r\n\t\tCKLBCompositeAsset::read_null,  \r\n\t\tCKLBCompositeAsset::read_boolean,  \r\n\t\tCKLBCompositeAsset::read_int,  \r\n\t\tCKLBCompositeAsset::read_double,  \r\n\t\tnull,  \r\n\t\tCKLBCompositeAsset::read_string,  \r\n\t\tCKLBCompositeAsset::read_start_map,  \r\n\t\tCKLBCompositeAsset::read_map_key,  \r\n\t\tCKLBCompositeAsset::read_end_map,  \r\n\t\tCKLBCompositeAsset::read_start_array,  \r\n\t\tCKLBCompositeAsset::read_end_array\r\n\t};\r\n\r\n    yajl_handle hand;\r\n    /* generator config */  \r\n//    yajl_gen g;\t\t\t\t// My Context. 2012.12.05  \r\n    yajl_status stat;  \r\n  \r\n//    g = yajl_gen_alloc(NULL);\t// 2012.12.05  \r\n\r\n\tCKLBCompositeAsset* pNewAsset = KLBNEW(CKLBCompositeAsset);\r\n\r\n\tif (pNewAsset->init()) {\r\n\t\t/* ok.  open file.  let's read and parse */  \r\n\t\thand = yajl_alloc(&callbacks, NULL, pNewAsset);  \r\n\t\tif (hand) {\r\n\t\t\t/* and let's allow comments by default */  \r\n\t\t\tyajl_config(hand, yajl_allow_comments, 1);\r\n\r\n\t\t\tpNewAsset->parserCtx = hand;\r\n\r\n\t\t\tstat = yajl_parse(hand, stream, streamSize);\r\n\t\r\n\t\t\tif (stat == yajl_status_ok) {\r\n\t\t\t\tstat = yajl_complete_parse(hand);\r\n\t\t\t\tif (stat == yajl_status_ok) {\r\n\t\t\t\t\tyajl_free(hand);\r\n\r\n\t\t\t\t\t// Force implementation mistake to make NULL ptr error. This variable should NOT be used.\r\n\t\t\t\t\tpNewAsset->m_pCurrInnerDef = NULL;\r\n\r\n\t\t\t\t\treturn pNewAsset;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tyajl_free(hand);\r\n\t\t}\r\n\t} else {\r\n\t\tKLBDELETE(pNewAsset);\r\n\t}\r\n\r\n\treturn null;\r\n}\r\n\r\nCKLBCompositeAssetPlugin::CKLBCompositeAssetPlugin()\r\n: IKLBAssetPlugin()\r\n{\r\n\t// Do nothing.\r\n}\r\n\r\nCKLBCompositeAssetPlugin::~CKLBCompositeAssetPlugin() {\r\n\t// Do nothing.\r\n}\r\n\r\n// ------------------- Asset ------------------\r\n\r\n/*static*/ int CKLBCompositeAsset::read_start_map\t(void * ctx, unsigned int size)\r\n{ return ((CKLBCompositeAsset*)ctx)->readStartMap(size); }\r\n/*static*/ int CKLBCompositeAsset::read_null\t\t(void * ctx)\r\n{ return ((CKLBCompositeAsset*)ctx)->readNull(); }\r\n/*static*/ int CKLBCompositeAsset::read_boolean\t\t(void * ctx, int boolean)\r\n{ return ((CKLBCompositeAsset*)ctx)->readBoolean(boolean); }\r\n/*static*/ int CKLBCompositeAsset::read_int\t\t\t(void * ctx, long long integerVal)\r\n{ return ((CKLBCompositeAsset*)ctx)->readInt(integerVal); }\r\n/*static*/ int CKLBCompositeAsset::read_double\t\t(void * ctx, double doubleVal)\r\n{ return ((CKLBCompositeAsset*)ctx)->readDouble(doubleVal); }\r\n/*static*/ int CKLBCompositeAsset::read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool)\r\n{ return ((CKLBCompositeAsset*)ctx)->readString(stringVal, stringLen, cte_pool); }\r\n/*static*/ int CKLBCompositeAsset::read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool)\r\n{ return ((CKLBCompositeAsset*)ctx)->readMapKey(stringVal, stringLen, cte_pool); }\r\n/*static*/ int CKLBCompositeAsset::read_end_map\t\t(void * ctx)\r\n{ return ((CKLBCompositeAsset*)ctx)->readEndMap(); }\r\n/*static*/ int CKLBCompositeAsset::read_start_array\t(void * ctx, unsigned int size)\r\n{ return ((CKLBCompositeAsset*)ctx)->readStartArray(size); }\r\n/*static*/ int CKLBCompositeAsset::read_end_array\t(void * ctx)\r\n{ return ((CKLBCompositeAsset*)ctx)->readEndArray(); }\r\n\r\n#define STANDARD_PARSER_MODE\t(0)\r\n#define GENERIC_MODE\t\t\t(1)\r\n\r\nCKLBCompositeAsset::CKLBCompositeAsset()\r\n:m_allocatedString\t(NULL)\r\n,m_pCurrInnerDef\t(NULL)\r\n,m_pParent\t\t\t(NULL)\r\n,m_parent\t\t\t(0)\r\n,m_root\t\t\t\t(NULL)\r\n,m_rootParent\t\t(NULL)\r\n,m_recCount\t\t\t(0)\r\n,m_bTreeMode\t\t(true)\r\n,m_groupID\t\t\t(0)\r\n,m_pSource\t\t\t(NULL)\r\n,m_width\t\t\t(-1)\r\n,m_height\t\t\t(-1)\r\n,mode\t\t\t\t(STANDARD_PARSER_MODE)\r\n{\r\n\tm_parentStack[0] = NULL;\r\n\tm_bLowRes = CPFInterface::getInstance().client().getPhysicalScreenHeight() < 480;\r\n}\r\n\r\nCKLBCompositeAsset::~CKLBCompositeAsset() {\r\n\tif (m_allocatedString) {\r\n\t\tSTRINGENTRY* parse = m_allocatedString;\r\n\t\twhile (parse) {\r\n\t\t\tSTRINGENTRY* parseNext = parse->next;\r\n\r\n\t\t\t// String is freed by EACH user. We just delete the container list.\r\n\t\t\tKLBDELETE(parse);\r\n\r\n\t\t\tparse = parseNext;\r\n\t\t}\r\n\t\tm_allocatedString = NULL;\r\n\t}\r\n\r\n\tif (m_rootParent) {\r\n\t\tKLBDELETE(m_rootParent);\r\n\t}\r\n\r\n\tif (m_root) {\r\n\t\tKLBDELETE(m_root);\r\n\t}\r\n\r\n\t// Do not need to free or check.\r\n\t// STRINGENTRY*\thandler\t[MAX_HANDLER];\r\n\t// STRINGENTRY*\tassets\t[MAX_ASSETS];\r\n}\r\n\r\nbool CKLBCompositeAsset::init() {\r\n\tm_rootParent = KLBNEW(CKLBNode);\r\n\treturn (m_rootParent != NULL);\r\n}\r\n\r\nCKLBCompositeAsset::STRINGENTRY::STRINGENTRY()\r\n:next\t\t(NULL)\r\n,string\t\t(NULL)\r\n,assetCache\t(NULL) \r\n{\r\n}\r\n\r\nCKLBCompositeAsset::STRINGENTRY::~STRINGENTRY() {\r\n\tif (string)\t{ KLBFREE(string); string = NULL; }\r\n\r\n\tif (assetCache) {\r\n\t\tif (assetCache->getAssetType() != ASSET_IMAGE) {\r\n\t\t\tassetCache->decrementRefCount();\r\n\t\t} else {\r\n\t\t\t((CKLBImageAsset*)assetCache)->getTexture()->decrementRefCount();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nCKLBCompositeAsset::STRINGENTRY* CKLBCompositeAsset::registerString(const char* string, u32 strLen, bool* err) {\r\n\t*err = false;\r\n\tif (strLen && string) {\r\n\t\tSTRINGENTRY* parse = m_allocatedString;\r\n\t\twhile (parse) {\r\n\t\t\tif (strcmp(parse->string, string) == 0) {\r\n\t\t\t\treturn parse;\r\n\t\t\t}\r\n\t\t\tparse = parse->next;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Create if not found.\r\n\t\t//\r\n\t\tSTRINGENTRY* pNew = KLBNEW(STRINGENTRY);\r\n\t\tchar* pNewStr = (char*)KLBMALLOC(strLen+1);\r\n\r\n\t\tif (pNew && pNewStr) {\r\n\t\t\tpNew->next = m_allocatedString;\r\n\t\t\tm_allocatedString = pNew;\r\n\t\t\tpNew->string = pNewStr;\r\n\t\t\tmemcpy(pNewStr, string, strLen);\r\n\t\t\tpNewStr[strLen] = 0; // C String close.\r\n\t\t\treturn pNew;\r\n\t\t}\r\n\t\tif (pNew) { KLBDELETE(pNew); }\r\n\t\t*err = true;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nchar*\tCKLBCompositeAsset::allocateString(const unsigned char* string, u32 strLen, bool* err) {\r\n\t*err = false;\r\n\tif (strLen && string) {\r\n\t\tSTRINGENTRY* pNew = KLBNEW(STRINGENTRY);\r\n\t\tchar* pNewStr = (char*)KLBMALLOC(strLen+1);\r\n\r\n\t\tif (pNew && pNewStr) {\r\n\t\t\tpNew->next = m_allocatedString;\r\n\t\t\tm_allocatedString = pNew;\r\n\t\t\tpNew->string = pNewStr;\r\n\t\t\tmemcpy(pNewStr, string, strLen);\r\n\t\t\tpNewStr[strLen] = 0; // C String close.\r\n\t\t\treturn pNewStr;\r\n\t\t}\r\n\t\t\r\n\t\t*err = true;\r\n\t\tif (pNew) { KLBDELETE(pNew); }\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nint CKLBCompositeAsset::readNull() {\r\n    return 1;\r\n}\r\n  \r\nint CKLBCompositeAsset::readBoolean(int boolean) {\r\n\tswitch (m_parserField) {\r\n\tcase VISIBLE_FIELD:\r\n\t\tm_pCurrInnerDef->visible = boolean ? true : false;\r\n\t\tbreak;\r\n\tcase GENERIC_FIELD:\r\n\t\tm_pCurrInnerDef->propertyBag->setPropertyBool(tmpBuff, boolean ? true:false);\r\n\t\tbreak;\r\n\t}\r\n\treturn 1;  \r\n}  \r\n\r\nint CKLBCompositeAsset::readInt(long long integerVal) \r\n{\r\n\tswitch(m_parserField) {\r\n\tcase ID:\r\n\t\tm_pCurrInnerDef->id\t\t = (u32)integerVal;\r\n\t\tbreak;\r\n\tcase CLIPX:\r\n\t\tm_pCurrInnerDef->clipx\t = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase CLIPY:\r\n\t\tm_pCurrInnerDef->clipy\t = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase CLIPW:\r\n\t\tm_pCurrInnerDef->clipw\t = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase CLIPH:\r\n\t\tm_pCurrInnerDef->cliph\t = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase CLIPSTART:\r\n\t\tm_pCurrInnerDef->priorityClipStart = (u32)integerVal;\r\n\t\tbreak;\r\n\tcase CLIPEND:\r\n\t\tm_pCurrInnerDef->priorityClipEnd = (u32)integerVal;\r\n\t\tbreak;\r\n\tcase RADIO_FIELD:\r\n\t\tm_pCurrInnerDef->radioID = (s32)integerVal;\r\n\t\tbreak;\r\n\tcase PRIORITY_FIELD:\r\n\t\tm_pCurrInnerDef->priority = (u32)integerVal;\t\r\n\t\tbreak;\r\n\tcase X_FIELD:\r\n\t\tm_pCurrInnerDef->x = (float)(m_bLowRes ? ((integerVal>>1)<<1) : integerVal);\r\n\t\tbreak;\r\n\tcase Y_FIELD:\t\r\n\t\tm_pCurrInnerDef->y = (float)(m_bLowRes ? ((integerVal>>1)<<1) : integerVal);\r\n\t\tbreak;\r\n\tcase SX_FIELD:\t\r\n\t\tm_pCurrInnerDef->sx = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase SY_FIELD:\t\r\n\t\tm_pCurrInnerDef->sy = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase SW_FIELD:\t\r\n\t\tm_pCurrInnerDef->sw = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase SH_FIELD:\t\r\n\t\tm_pCurrInnerDef->sh = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase LAYOUT_INFO_FIELD:\t\r\n\t\tm_pCurrInnerDef->layoutInfo = (u32)integerVal;\r\n\t\tbreak;\r\n\tcase LW_FIELD:\r\n\t\tm_pCurrInnerDef->lw = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase LH_FIELD:\r\n\t\tm_pCurrInnerDef->lh = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase FONT_SIZE_FIELD:\r\n\t\tm_pCurrInnerDef->fontSize = (u16)integerVal;\r\n\t\tbreak;\r\n\tcase COLOR_FIELD:\r\n\t\tm_pCurrInnerDef->color = (u32)integerVal;\r\n\t\tbreak;\r\n\tcase WIDTH_FIELD:\r\n\t\tif (m_root != m_pCurrInnerDef) {\r\n\t\t\tm_pCurrInnerDef->width\t= (s16)integerVal;\r\n\t\t} else {\r\n\t\t\tm_width = (s16)integerVal;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase HEIGHT_FIELD:\r\n\t\tif (m_root != m_pCurrInnerDef) {\r\n\t\t\tm_pCurrInnerDef->height\t= (s16)integerVal;\r\n\t\t} else {\r\n\t\t\tm_height = (s16)integerVal;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase XSCALE_FIELD:\r\n\tcase STARTANGLE_FIELD:\r\n\t\tm_pCurrInnerDef->xscale = (float)integerVal;\r\n\t\tbreak;\r\n\tcase YSCALE_FIELD:\r\n\tcase ENDANGLE_FIELD:\r\n\t\tm_pCurrInnerDef->yscale = (float)integerVal;\r\n\t\tbreak;\r\n\tcase ROTATION_FIELD:\r\n\t\tm_pCurrInnerDef->rotation = (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_EASING:\r\n\t\tm_pCurrAnim->spline = (u8)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_LENGTH:\r\n\t\tm_pCurrAnim->length = (u16)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_SHIFT:\r\n\t\tm_pCurrAnim->timeShift = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROMX:\r\n\t\tm_pCurrAnim->fromX\t= (s16)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOX:\r\n\t\tm_pCurrAnim->toX\t= (s16)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROMY:\r\n\t\tm_pCurrAnim->fromY\t= (s16)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOY:\r\n\t\tm_pCurrAnim->toY\t= (s16)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROMALPHA:\r\n\t\tm_pCurrAnim->fromAlpha = (u8)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOALPHA:\r\n\t\tm_pCurrAnim->toAlpha = (u8)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROMCOLOR:\r\n\t\tm_pCurrAnim->fromR = (integerVal>>16) & 0xFF;\r\n\t\tm_pCurrAnim->fromG = (integerVal>>8)  & 0xFF;\r\n\t\tm_pCurrAnim->fromB = (integerVal)     & 0xFF;\r\n\t\tbreak;\r\n\tcase ANIM_TOCOLOR:\r\n\t\tm_pCurrAnim->toR = (integerVal>>16) & 0xFF;\r\n\t\tm_pCurrAnim->toG = (integerVal>>8)  & 0xFF;\r\n\t\tm_pCurrAnim->toB = (integerVal)     & 0xFF;\r\n\t\tbreak;\r\n\tcase ANIM_FROMSCALE:\r\n\t\tm_pCurrAnim->fromScaleX = (float)integerVal;\r\n\t\tm_pCurrAnim->fromScaleY = m_pCurrAnim->fromScaleX;\r\n\t\tbreak;\r\n\tcase ANIM_TOSCALE:\r\n\t\tm_pCurrAnim->toScaleX = (float)integerVal;\r\n\t\tm_pCurrAnim->toScaleY = m_pCurrAnim->toScaleX;\r\n\t\tbreak;\r\n\tcase ANIM_FROMSCALE_X:\r\n\t\tm_pCurrAnim->fromScaleX = (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROMSCALE_Y:\r\n\t\tm_pCurrAnim->fromScaleY = (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOSCALE_X:\r\n\t\tm_pCurrAnim->toScaleX = (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOSCALE_Y:\r\n\t\tm_pCurrAnim->toScaleY = (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROM_ROTATION:\r\n\t\tm_pCurrAnim->fromRotation\t= (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_TO_ROTATION:\r\n\t\tm_pCurrAnim->toRotation\t\t= (float)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_LOOP:\r\n\t\tm_pCurrAnim->loop\t= (u8)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_PINGPONG:\r\n\t\tm_pCurrAnim->pingpong = (u8)integerVal;\r\n\t\tbreak;\r\n\tcase ANIM_DATA:\r\n\t\tif (m_pCurrAnim->data == NULL) {\r\n\t\t\tintegerVal *= 4; // Key count into integer count\r\n\t\t\tm_pCurrAnim->data\t\t= KLBNEWA(s32, (u32)integerVal);\r\n\t\t\tm_pCurrAnim->dataSize\t= (u16)integerVal;\r\n\t\t\tm_pCurrAnim->currSize\t= 0;\r\n\t\t\tm_pCurrAnim->spline\t\t= 0; // Custom\r\n\t\t} else {\r\n\t\t\tif (m_pCurrAnim->currSize < m_pCurrAnim->dataSize) {\r\n\t\t\t\tm_pCurrAnim->data[m_pCurrAnim->currSize++] = (s32)integerVal;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase ORIENTATION_FIELD:\r\n\t\t// Reuse SX to reduce memory usage.\r\n\t\t// orientation\r\n\t\tm_pCurrInnerDef->sx = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase INT_0_FIELD:\r\n\t\t// Reuse sw to reduce memory usage :\r\n\t\t// - docWidth\r\n\t\tm_pCurrInnerDef->sw = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase INT_1_FIELD:\r\n\t\t// Reuse sh to reduce memory usage :\r\n\t\t// - docHeight\r\n\t\tm_pCurrInnerDef->sh = (s16)integerVal;\r\n\t\tbreak;\r\n\tcase INT_2_FIELD:\r\n\t\t// Reuse radioID to reduce memory usage :\r\n\t\t// - maxCommand Count\r\n\t\tm_pCurrInnerDef->radioID = (s32)integerVal;\r\n\t\tbreak;\r\n\tcase FLAG_0_FIELD:\r\n\tcase ALIGN_FIELD:\r\n\tcase BASEINVISIBLE_FIELD:\r\n\tcase ISPASSWORD_FIELD:\r\n\tcase VARCLIP_FIELD:\r\n\t\t// allow navigation\t\t\t(webview)\r\n\t\t// base invisible\t\t\t(ui drag)\r\n\t\t// align\t\t\t\t\t(button/checkbox)\r\n\t\tm_pCurrInnerDef->flag[0]\t\t\t= (u8)integerVal;\r\n\t\tbreak;\r\n\tcase FILLZERO_FIELD:\r\n\t\tm_pCurrInnerDef->flag[2]\t\t\t= (u8)integerVal;\r\n\t\tbreak;\r\n\tcase ANIMATE_FIELD:\r\n\t\tm_pCurrInnerDef->flag[1]\t\t\t= (u8)integerVal;\r\n\t\tbreak;\r\n\tcase COUNTCLIP_FIELD:\r\n\t\tm_pCurrInnerDef->flag[3]\t\t\t= 1 - (u8)integerVal;\t// default\r\n\t\tbreak;\r\n\tcase VALUE_FIELD:\r\n\t\tm_pCurrInnerDef->value\t\t\t\t= (s32)integerVal;\r\n\t\tbreak;\r\n\tcase PRIO_OFFSET_FIELD:\r\n\t\tm_pCurrInnerDef->priorityClipStart\t= (u32)integerVal;\t\t// reuse field\r\n\t\tbreak;\r\n\tcase DRAG_ALPHA_FIELD:\r\n\t\tm_pCurrInnerDef->rotation\t\t\t= (((float)integerVal) / 255.0f);\t\t// reuse field\r\n\t\tbreak;\r\n\tcase CENTERX_FIELD:\r\n\t\tm_pCurrInnerDef->clipx\t\t\t\t= (s16)integerVal;\t// reuse field\r\n\t\tbreak;\r\n\tcase CENTERY_FIELD:\r\n\t\tm_pCurrInnerDef->clipy\t\t\t\t= (s16)integerVal;\t// reuse field\r\n\t\tbreak;\r\n\tcase START_PIX_FIELD:\r\n\t\tm_pCurrInnerDef->clipw\t\t\t\t= (s16)integerVal;\t// reuse field\r\n\t\tbreak;\r\n\tcase END_PIX_FIELD:\r\n\t\tm_pCurrInnerDef->cliph\t\t\t\t= (s16)integerVal;\t// reuse field\r\n\t\tbreak;\r\n\tcase ANIM_TIME_FIELD:\r\n\tcase NUMBERCOUNT_FIELD:\r\n\t\tm_pCurrInnerDef->radioID\t\t\t= (s32)integerVal;\t\t// reuse field\r\n\t\tbreak;\r\n\tcase STEPX_FIELD:\r\n\t\tm_pCurrInnerDef->sx\t\t\t\t\t= (s16)integerVal;\r\n\t\tbreak;\r\n\tcase STEPY_FIELD:\r\n\t\tm_pCurrInnerDef->sy\t\t\t\t\t= (s16)integerVal;\r\n\t\tbreak;\r\n\tcase ENABLE_FIELD:\r\n\t\tm_pCurrInnerDef->flag[2]\t\t\t= (u8)integerVal;\r\n\t\tbreak;\r\n\r\n\tcase MINVALUE:\r\n\t\tm_pCurrInnerDef->variable[VAR_MIN]\t\t\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase MAXVALUE:\r\n\t\tm_pCurrInnerDef->variable[VAR_MAX]\t\t\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase SLIDERSIZE:\r\n\t\tm_pCurrInnerDef->variable[VAR_SLIDERSIZE]\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase MINSLIDERSIZE:\r\n\t\tm_pCurrInnerDef->variable[VAR_MIN_SLIDERSIZE]\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase SELECTCOLOR:\r\n\t\tm_pCurrInnerDef->variable[VAR_SELECTCOLOR]\t= (u32)integerVal;\r\n\t\tbreak;\r\n\r\n\tcase MAXVERTEX:\r\n\t\tm_pCurrInnerDef->variable[VAR_MAXVERTEX]\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase MAXINDEX:\r\n\t\tm_pCurrInnerDef->variable[VAR_MAXINDEX]\t\t= (u32)integerVal;\r\n\t\tbreak;\r\n\r\n\tcase SPLINE_COUNT:\r\n\t\tm_pCurrInnerDef->splineCount = (u16)integerVal;\r\n\t\tbreak;\r\n\tcase SPLINE_LENGTH:\r\n\t\tm_pCurrInnerDef->splineLength = (u16)integerVal;\r\n\t\tbreak;\r\n\tcase SPLINE_MASK:\r\n\t\tm_pCurrInnerDef->splineMask\t\t\t= ((u16)integerVal) | 3; // Always X&Y\r\n\t\t{\r\n\t\t\tu8 size = 0;\r\n\t\t\tfor (int n=0; n < CKLBSplineNode::MODIFY_TOTALCOUNT; n++) {\r\n\t\t\t\tif ((m_pCurrInnerDef->splineMask) & (1<<n)) {\r\n\t\t\t\t\tsize += ((n == (CKLBSplineNode::MODIFY_SCALE)) ? 4 : 2);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_pCurrInnerDef->splineVectorSize\t= size;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase SPLINE_ARRAY:\r\n\t\t*m_currArraySpline++\t\t= (float)integerVal;\r\n\t\tbreak;\r\n\tcase GENERIC_FIELD:\r\n\t\tm_pCurrInnerDef->propertyBag->setPropertyInt(tmpBuff, (s32)integerVal);\r\n\t\tbreak;\r\n\tcase VISIBLE_FIELD:\r\n\t\tm_pCurrInnerDef->visible = integerVal ? true : false;\r\n\t\tbreak;\r\n\tcase MAXLENGTH:\r\n\t\tm_pCurrInnerDef->clipw\t\t\t\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase CHARTYPE:\r\n\t\tm_pCurrInnerDef->cliph\t\t\t\t= (u32)integerVal;\r\n\t\tbreak;\r\n\tcase VOL_AUDIO_UP:\r\n\t\tm_pCurrInnerDef->volAudioUp\t\t\t= (u8)integerVal;\r\n\t\tbreak;\r\n\tcase VOL_AUDIO_DOWN:\r\n\t\tm_pCurrInnerDef->volAudioDown\t\t= (u8)integerVal;\r\n\t}\r\n    return 1;\r\n}  \r\n  \r\nint CKLBCompositeAsset::readDouble(double doubleVal)  \r\n{\t\r\n\t// do nothing here.\r\n\tswitch (m_parserField) {\r\n\tcase ANIM_FROMSCALE:\r\n\t\tm_pCurrAnim->fromScaleX = (float)doubleVal;\r\n\t\tm_pCurrAnim->fromScaleY = m_pCurrAnim->fromScaleX;\r\n\t\tbreak;\r\n\tcase ANIM_TOSCALE:\r\n\t\tm_pCurrAnim->toScaleX       = (float)doubleVal;\r\n\t\tm_pCurrAnim->toScaleY       = m_pCurrAnim->toScaleX;\r\n\t\tbreak;\r\n\tcase ANIM_FROMSCALE_X:\r\n\t\tm_pCurrAnim->fromScaleX     = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROMSCALE_Y:\r\n\t\tm_pCurrAnim->fromScaleY     = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOSCALE_X:\r\n\t\tm_pCurrAnim->toScaleX       = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase ANIM_TOSCALE_Y:\r\n\t\tm_pCurrAnim->toScaleY       = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase XSCALE_FIELD:\r\n\tcase STARTANGLE_FIELD:\r\n\t\tm_pCurrInnerDef->xscale     = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase YSCALE_FIELD:\r\n\tcase ENDANGLE_FIELD:\r\n\t\tm_pCurrInnerDef->yscale     = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase ROTATION_FIELD:\r\n\t\tm_pCurrInnerDef->rotation   = (float)doubleVal;\r\n\t\tbreak;\r\n\tcase ANIM_FROM_ROTATION:\r\n\t\tm_pCurrAnim->fromRotation\t= (float)doubleVal;\r\n\t\tbreak;\r\n\tcase ANIM_TO_ROTATION:\r\n\t\tm_pCurrAnim->toRotation\t\t= (float)doubleVal;\r\n\t\tbreak;\r\n\tcase DRAG_ALPHA_FIELD:\r\n\t\tm_pCurrInnerDef->rotation\t= (float)doubleVal;\t\t// reuse field\r\n\t\tbreak;\r\n\tcase SPLINE_ARRAY:\r\n\t\t*m_currArraySpline++\t\t= (float)doubleVal;\r\n\t\tbreak;\r\n\tcase GENERIC_FIELD:\r\n\t\tm_pCurrInnerDef->propertyBag->setPropertyFloat(tmpBuff, (float)doubleVal);\r\n\t\tbreak;\r\n\t}\r\n\treturn 1;  \r\n}  \r\n  \r\nint CKLBCompositeAsset::readString(const unsigned char * stringVal, size_t stringLen, int /*cte_pool*/)  \r\n{\r\n\tbool err = false;\r\n\tswitch (m_parserField) {\r\n\tcase CLASS_FIELD:\r\n\t\tif (strncmp(\"button\", (const char*)stringVal,(sizeof(\"button\")-1))==0) {\r\n\t\t\tm_pCurrInnerDef->classID = BUTTON_CLASSID;\r\n\t\t} else\r\n\t\tif (strncmp(\"checkbox\", (const char*)stringVal,(sizeof(\"checkbox\")-1))==0) {\r\n\t\t\tm_pCurrInnerDef->classID = CHECK_CLASSID;\r\n\t\t} else\r\n\t\tif (strncmp(\"container\", (const char*)stringVal,(sizeof(\"container\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = CONTAINER_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"label\", (const char*)stringVal, (sizeof(\"label\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = LABEL_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"animnode\", (const char*)stringVal, (sizeof(\"animnode\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = ANIMNODE_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"textbox\", (const char*)stringVal, (sizeof(\"textbox\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = TEXTBOX_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"task_webview\", (const char*)stringVal, (sizeof(\"task_webview\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = WEBVIEW_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"task_virtualdoc\", (const char*)stringVal, (sizeof(\"task_virtualdoc\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = VIRTUALDOC_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"task_score\", (const char*)stringVal, (sizeof(\"task_score\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = SCORE_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"task_progressbar\", (const char*)stringVal, (sizeof(\"task_progressbar\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = PROGRESSBAR_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"task_group\", (const char *)stringVal, (sizeof(\"task_group\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = GROUP_CLASSID;\r\n\t\t} else\r\n\t\tif (strncmp(\"task_dragicon\", (const char*)stringVal, (sizeof(\"task_dragicon\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = DRAGICON_CLASSID;\r\n\t\t} else \r\n\t\tif (strncmp(\"task_list\", (const char*)stringVal, (sizeof(\"task_list\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = LIST_CLASSID;\r\n\t\t} else\r\n\t\tif (strncmp(\"task_piechart\", (const char*)stringVal, (sizeof(\"task_piechart\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = PIECHART_CLASSID; \r\n\t\t} else \r\n\t\tif (strncmp(\"task_canvas\", (const char*)stringVal, (sizeof(\"task_canvas\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = CANVAS_CLASSID; \r\n\t\t} else \r\n\t\tif (strncmp(\"task_scrollbar\", (const char*)stringVal, (sizeof(\"task_scrollbar\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = SCROLLBAR_CLASSID; \r\n\t\t} else \r\n\t\tif (strncmp(\"task_scale9\", (const char*)stringVal, (sizeof(\"task_scale9\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = SCALE9_CLASSID; \r\n\t\t} else\r\n\t\tif (strncmp(\"task_varitem\", (const char *)stringVal, (sizeof(\"task_varitem\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = VARITEM_CLASSID;\r\n\t\t} else\r\n\t\tif (strncmp(\"task_tiledcanvas\", (const char*)stringVal, (sizeof(\"task_tiledcanvas\")-1)) == 0) {\r\n\t\t\tm_pCurrInnerDef->classID = TILEDCANVAS_CLASSID; \r\n\t\t}\r\n\t\t\t\r\n\t\tbreak;\r\n\tcase TEXT_FIELD:\r\n\t\tm_pCurrInnerDef->text           = this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase PLACEHOLDER_FIELD:\r\n\t\tm_pCurrInnerDef->placeholder    = this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ON_CLICK:\r\n\t\tm_pCurrInnerDef->handler[0]     = this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ASSET_FIELD:\r\n\t\tm_pCurrInnerDef->assets[NORMAL_ASSET]\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ASSET_DISABLED_FIELD:\r\n\t\tm_pCurrInnerDef->assets[DISABLE_ASSET]\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ASSET_FOCUS_FIELD:\r\n\t\tm_pCurrInnerDef->assets[FOCUS_ASSET]\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ASSET_PUSH_FIELD:\r\n\t\tm_pCurrInnerDef->assets[PUSH_ASSET]\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ASSET_4:\r\n\tcase ASSET_5:\r\n\tcase ASSET_6:\r\n\tcase ASSET_7:\r\n\tcase ASSET_8:\r\n\tcase ASSET_9:\r\n\t\tm_pCurrInnerDef->assets[m_parserField - ASSET_FIELD] = this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase NAME_FIELD:\r\n\t\tm_pCurrInnerDef->name\t\t\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase FONT_NAME_FIELD:\r\n\t\tm_pCurrInnerDef->fontName\t\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ANIM_TYPE:\r\n\t\tm_pCurrAnim->mode\t\t\t\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase CALLBACK_FIELD:\r\n\t\t// Use same space as onclick\r\n\t\tm_pCurrInnerDef->handler[0] = this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase URL_FIELD:\r\n\t\tm_pCurrInnerDef->handler[1] = this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase SOUNDUP_FIELD:\r\n\t\tm_pCurrInnerDef->assets[UPAUDIO_ASSET]\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase SOUNDDOWN_FIELD:\r\n\t\tm_pCurrInnerDef->assets[DOWNAUDIO_ASSET]\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\r\n\tcase STARTANGLE_FIELD:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAR_STARTANGLE]\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ENDANGLE_FIELD:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAR_ENDANGLE]\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase ENABLE_FIELD:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAR_ENABLE]\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase MINVALUE:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAR_MIN]\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase MAXVALUE:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAR_MAX]\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase VALUE_FIELD:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAL_VALUE]\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase COLOR_FIELD:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAL_COLOR]\t\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase FLAG_0_FIELD:\r\n\t\tm_pCurrInnerDef->dbField[DB_VAR_CHECKED]\t\t= this->registerString((const char*)stringVal, stringLen, &err);\r\n\t\tbreak;\r\n\tcase GENERIC_FIELD:\r\n\t\tu32 prevBuffLen = strlen(tmpBuff) + 2;\r\n\t\tmemcpy(&tmpBuff[prevBuffLen], stringVal, stringLen);\r\n\t\ttmpBuff[prevBuffLen + stringLen] = 0; // Close C String.\r\n\t\tm_pCurrInnerDef->propertyBag->setPropertyString(tmpBuff, &tmpBuff[prevBuffLen]);\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif (err) {\r\n\t\treturn 0;\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\n#define sizet(a)\t((sizeof(a)-1))\r\n\r\nstruct key_name_value {\r\n  const char *name;\r\n  int size;\r\n  int value;\r\n};\r\n\r\nstatic const key_name_value keywords1[] = {\r\n\t// Size 1\r\n\t{\"x\",(sizeof(\"x\")-1),CKLBCompositeAsset::X_FIELD},\r\n\t{\"y\",(sizeof(\"y\")-1),CKLBCompositeAsset::Y_FIELD}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywords2[] = {\r\n\t// Size 2\r\n\t{\"id\",(sizeof(\"id\")-1),CKLBCompositeAsset::ID},\r\n\t{\"lh\",(sizeof(\"lh\")-1),CKLBCompositeAsset::LH_FIELD},\r\n\t{\"lw\",(sizeof(\"lw\")-1),CKLBCompositeAsset::LW_FIELD},\r\n\t{\"sh\",(sizeof(\"sh\")-1),CKLBCompositeAsset::SH_FIELD},\r\n\t{\"sw\",(sizeof(\"sw\")-1),CKLBCompositeAsset::SW_FIELD},\r\n\t{\"sx\",(sizeof(\"sx\")-1),CKLBCompositeAsset::SX_FIELD},\r\n\t{\"sy\",(sizeof(\"sy\")-1),CKLBCompositeAsset::SY_FIELD}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywords3[] = {\r\n\t// Size 3\r\n\t{\"sub\",(sizeof(\"sub\")-1),CKLBCompositeAsset::SUB_FIELD},\r\n\t{\"tox\",(sizeof(\"tox\")-1),CKLBCompositeAsset::ANIM_TOX},\r\n\t{\"toy\",(sizeof(\"toy\")-1),CKLBCompositeAsset::ANIM_TOY},\r\n\t{\"url\",(sizeof(\"url\")-1),CKLBCompositeAsset::URL_FIELD}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywords4[] = {\r\n\t// Size 4\r\n\t{\"loop\",(sizeof(\"loop\")-1),CKLBCompositeAsset::ANIM_LOOP},\r\n\t{\"name\",(sizeof(\"name\")-1),CKLBCompositeAsset::NAME_FIELD},\r\n\t{\"text\",(sizeof(\"text\")-1),CKLBCompositeAsset::TEXT_FIELD},\r\n\t{\"type\",(sizeof(\"type\")-1),CKLBCompositeAsset::ANIM_TYPE}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywords5[] = {\r\n\t// Size 5\r\n\t{\"align\",(sizeof(\"align\")-1),CKLBCompositeAsset::ALIGN_FIELD},\r\n\t{\"class\",(sizeof(\"class\")-1),CKLBCompositeAsset::CLASS_FIELD},\r\n\t{\"cliph\",(sizeof(\"cliph\")-1),CKLBCompositeAsset::CLIPH},\r\n\t{\"clipw\",(sizeof(\"clipw\")-1),CKLBCompositeAsset::CLIPW},\r\n\t{\"clipx\",(sizeof(\"clipx\")-1),CKLBCompositeAsset::CLIPX},\r\n\t{\"clipy\",(sizeof(\"clipy\")-1),CKLBCompositeAsset::CLIPY},\r\n\t{\"color\",(sizeof(\"color\")-1),CKLBCompositeAsset::COLOR_FIELD},\r\n\t{\"focus\",(sizeof(\"focus\")-1),CKLBCompositeAsset::ASSET_FOCUS_FIELD},\r\n\t{\"fromx\",(sizeof(\"fromx\")-1),CKLBCompositeAsset::ANIM_FROMX},\r\n\t{\"fromy\",(sizeof(\"fromy\")-1),CKLBCompositeAsset::ANIM_FROMY},\r\n\t{\"radio\",(sizeof(\"radio\")-1),CKLBCompositeAsset::RADIO_FIELD},\r\n\t{\"stepx\",(sizeof(\"stepx\")-1),CKLBCompositeAsset::STEPX_FIELD},\r\n\t{\"stepy\",(sizeof(\"stepy\")-1),CKLBCompositeAsset::STEPY_FIELD},\r\n\t{\"value\",(sizeof(\"value\")-1),CKLBCompositeAsset::VALUE_FIELD},\r\n\t{\"width\",(sizeof(\"width\")-1),CKLBCompositeAsset::WIDTH_FIELD}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywords6[] = {\r\n\t// Size 6\r\n\t{\"asset0\",(sizeof(\"asset0\")-1),CKLBCompositeAsset::ASSET_FIELD + 0},\r\n\t{\"asset1\",(sizeof(\"asset1\")-1),CKLBCompositeAsset::ASSET_FIELD + 1},\r\n\t{\"asset2\",(sizeof(\"asset2\")-1),CKLBCompositeAsset::ASSET_FIELD + 2},\r\n\t{\"asset3\",(sizeof(\"asset3\")-1),CKLBCompositeAsset::ASSET_FIELD + 3},\r\n\t{\"asset4\",(sizeof(\"asset4\")-1),CKLBCompositeAsset::ASSET_FIELD + 4},\r\n\t{\"asset5\",(sizeof(\"asset5\")-1),CKLBCompositeAsset::ASSET_FIELD + 5},\r\n\t{\"asset6\",(sizeof(\"asset6\")-1),CKLBCompositeAsset::ASSET_FIELD + 6},\r\n\t{\"asset7\",(sizeof(\"asset7\")-1),CKLBCompositeAsset::ASSET_FIELD + 7},\r\n\t{\"asset8\",(sizeof(\"asset8\")-1),CKLBCompositeAsset::ASSET_FIELD + 8},\r\n\t{\"asset9\",(sizeof(\"asset9\")-1),CKLBCompositeAsset::ASSET_FIELD + 9},\r\n\t{\"easing\",(sizeof(\"easing\")-1),CKLBCompositeAsset::ANIM_EASING},\r\n\t{\"enable\",(sizeof(\"enable\")-1),CKLBCompositeAsset::ENABLE_FIELD},\r\n\t{\"height\",(sizeof(\"height\")-1),CKLBCompositeAsset::HEIGHT_FIELD},\r\n/* ???? */\r\n\t{\"layout\",(sizeof(\"layout\")-1),CKLBCompositeAsset::LAYOUT_INFO_FIELD},\r\n\t{\"length\",(sizeof(\"length\")-1),CKLBCompositeAsset::ANIM_LENGTH},\r\n\t{\"select\",(sizeof(\"select\")-1),CKLBCompositeAsset::ASSET_PUSH_FIELD},\r\n\t{\"states\",(sizeof(\"states\")-1),CKLBCompositeAsset::STATES_FIELD},\r\n\t{\"xscale\",(sizeof(\"xscale\")-1),CKLBCompositeAsset::XSCALE_FIELD},\r\n\t{\"yscale\",(sizeof(\"yscale\")-1),CKLBCompositeAsset::YSCALE_FIELD}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywords7[] = {\r\n\t// Size 7\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n\t{\"animate\",(sizeof(\"animate\")-1),CKLBCompositeAsset::ANIMATE_FIELD},\r\n\t{\"centerx\",(sizeof(\"centerx\")-1),CKLBCompositeAsset::CENTERX_FIELD},\r\n\t{\"centery\",(sizeof(\"centery\")-1),CKLBCompositeAsset::CENTERY_FIELD},\r\n\t{\"checked\",(sizeof(\"checked\")-1),CKLBCompositeAsset::FLAG_0_FIELD},\r\n\t{\"clipend\",(sizeof(\"clipend\")-1),CKLBCompositeAsset::CLIPEND},\r\n\t{\"default\",(sizeof(\"default\")-1),CKLBCompositeAsset::ASSET_FIELD},\r\n\t{\"disable\",(sizeof(\"disable\")-1),CKLBCompositeAsset::ASSET_DISABLED_FIELD},\r\n\t{\"onclick\",(sizeof(\"onclick\")-1),CKLBCompositeAsset::ON_CLICK},\r\n\t{\"soundup\",(sizeof(\"soundup\")-1),CKLBCompositeAsset::SOUNDUP_FIELD},\r\n\t{\"toalpha\",(sizeof(\"toalpha\")-1),CKLBCompositeAsset::ANIM_TOALPHA},\r\n\t{\"tocolor\",(sizeof(\"tocolor\")-1),CKLBCompositeAsset::ANIM_TOCOLOR},\r\n\t{\"toscale\",(sizeof(\"toscale\")-1),CKLBCompositeAsset::ANIM_TOSCALE},\r\n\t{\"varclip\",(sizeof(\"varclip\")-1),CKLBCompositeAsset::VARCLIP_FIELD},\r\n\t{\"visible\",(sizeof(\"visible\")-1),CKLBCompositeAsset::VISIBLE_FIELD}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const key_name_value keywordsOther[] = {\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n\t{\"allownavigation\",(sizeof(\"allownavigation\")-1),CKLBCompositeAsset::FLAG_0_FIELD},\r\n\t{\"animtime\",(sizeof(\"animtime\")-1),CKLBCompositeAsset::ANIM_TIME_FIELD},\r\n\t{\"arrownavigation\",(sizeof(\"arrownavigation\")-1),CKLBCompositeAsset::FLAG_0_FIELD},\r\n\t{\"baseinvisible\",(sizeof(\"baseinvisible\")-1),CKLBCompositeAsset::BASEINVISIBLE_FIELD},\r\n\t{\"callback\",(sizeof(\"callback\")-1),CKLBCompositeAsset::CALLBACK_FIELD},\r\n\t{\"chartype\",(sizeof(\"chartype\")-1),CKLBCompositeAsset::CHARTYPE},\r\n\t{\"clipimage\",(sizeof(\"clipimage\")-1),CKLBCompositeAsset::ASSET_DISABLED_FIELD},\r\n\t{\"clipstart\",(sizeof(\"clipstart\")-1),CKLBCompositeAsset::CLIPSTART},\r\n\t{\"countclip\",(sizeof(\"countclip\")-1),CKLBCompositeAsset::COUNTCLIP_FIELD},\r\n\t{\"docheight\",(sizeof(\"docheight\")-1),CKLBCompositeAsset::INT_1_FIELD},\r\n\t{\"docwidth\",(sizeof(\"docwidth\")-1),CKLBCompositeAsset::INT_0_FIELD},\r\n\t{\"dragalpha\",(sizeof(\"dragalpha\")-1),CKLBCompositeAsset::DRAG_ALPHA_FIELD},\r\n\t{\"endangle\",(sizeof(\"endangle\")-1),CKLBCompositeAsset::ENDANGLE_FIELD},\r\n\t{\"endpixel\",(sizeof(\"endpixel\")-1),CKLBCompositeAsset::END_PIX_FIELD},\r\n\t{\"fillzero\",(sizeof(\"fillzero\")-1),CKLBCompositeAsset::FILLZERO_FIELD},\r\n\t{\"fontname\",(sizeof(\"fontname\")-1),CKLBCompositeAsset::FONT_NAME_FIELD},\r\n\t{\"fontsize\",(sizeof(\"fontsize\")-1),CKLBCompositeAsset::FONT_SIZE_FIELD},\r\n\t{\"fromalpha\",(sizeof(\"fromalpha\")-1),CKLBCompositeAsset::ANIM_FROMALPHA},\r\n\t{\"fromcolor\",(sizeof(\"fromcolor\")-1),CKLBCompositeAsset::ANIM_FROMCOLOR},\r\n\t{\"fromrotation\",(sizeof(\"fromrotation\")-1),CKLBCompositeAsset::ANIM_FROM_ROTATION},\r\n\t{\"fromscale\",(sizeof(\"fromscale\")-1),CKLBCompositeAsset::ANIM_FROMSCALE},\r\n\t{\"fromscalex\",(sizeof(\"fromscalex\")-1),CKLBCompositeAsset::ANIM_FROMSCALE_X},\r\n\t{\"fromscaley\",(sizeof(\"fromscaley\")-1),CKLBCompositeAsset::ANIM_FROMSCALE_Y},\r\n\t{\"maxcommandcount\",(sizeof(\"maxcommandcount\")-1),CKLBCompositeAsset::INT_2_FIELD},\r\n\t{\"maxindex\",(sizeof(\"maxindex\")-1),CKLBCompositeAsset::MAXINDEX},\r\n\t{\"maxlength\",(sizeof(\"maxlength\")-1),CKLBCompositeAsset::MAXLENGTH},\r\n\t{\"maxvalue\",(sizeof(\"maxvalue\")-1),CKLBCompositeAsset::MAXVALUE},\r\n\t{\"maxvertex\",(sizeof(\"maxvertex\")-1),CKLBCompositeAsset::MAXVERTEX},\r\n\t{\"minslidersize\",(sizeof(\"minslidersize\")-1),CKLBCompositeAsset::MINSLIDERSIZE},\r\n\t{\"minvalue\",(sizeof(\"minvalue\")-1),CKLBCompositeAsset::MINVALUE},\r\n\t{\"numbercount\",(sizeof(\"numbercount\")-1),CKLBCompositeAsset::NUMBERCOUNT_FIELD},\r\n\t{\"orientation\",(sizeof(\"orientation\")-1),CKLBCompositeAsset::ORIENTATION_FIELD},\r\n\t{\"passwordmode\",(sizeof(\"passwordmode\")-1),CKLBCompositeAsset::ISPASSWORD_FIELD},\r\n\t{\"pingpong\",(sizeof(\"pingpong\")-1),CKLBCompositeAsset::ANIM_PINGPONG},\r\n\t{\"placeholder\",(sizeof(\"placeholder\")-1),CKLBCompositeAsset::PLACEHOLDER_FIELD},\r\n\t{\"priority\",(sizeof(\"priority\")-1),CKLBCompositeAsset::PRIORITY_FIELD},\r\n\t{\"priorityoffset\",(sizeof(\"priorityoffset\")-1),CKLBCompositeAsset::PRIO_OFFSET_FIELD},\r\n\t{\"rotation\",(sizeof(\"rotation\")-1),CKLBCompositeAsset::ROTATION_FIELD},\r\n\t{\"scrollbar\",(sizeof(\"scrollbar\")-1),CKLBCompositeAsset::GENERIC_FIELD},\r\n\t{\"selectcolor\",(sizeof(\"selectcolor\")-1),CKLBCompositeAsset::SELECTCOLOR},\r\n\t{\"slidersize\",(sizeof(\"slidersize\")-1),CKLBCompositeAsset::SLIDERSIZE},\r\n\t{\"sounddown\",(sizeof(\"sounddown\")-1),CKLBCompositeAsset::SOUNDDOWN_FIELD},\r\n\t{\"sounddownvolume\",(sizeof(\"sounddownvolume\")-1),CKLBCompositeAsset::VOL_AUDIO_DOWN},\r\n\t{\"soundupvolume\",(sizeof(\"soundupvolume\")-1),CKLBCompositeAsset::VOL_AUDIO_UP},\r\n\t{\"splinecount\",(sizeof(\"splinecount\")-1),CKLBCompositeAsset::SPLINE_COUNT},\r\n\t{\"splinedata\",(sizeof(\"splinedata\")-1),CKLBCompositeAsset::SPLINE_ARRAY},\r\n\t{\"splinelength\",(sizeof(\"splinelength\")-1),CKLBCompositeAsset::SPLINE_LENGTH},\r\n\t{\"splinemask\",(sizeof(\"splinemask\")-1),CKLBCompositeAsset::SPLINE_MASK},\r\n\t{\"startangle\",(sizeof(\"startangle\")-1),CKLBCompositeAsset::STARTANGLE_FIELD},\r\n\t{\"startpixel\",(sizeof(\"startpixel\")-1),CKLBCompositeAsset::START_PIX_FIELD},\r\n\t{\"timeshift\",(sizeof(\"timeshift\")-1),CKLBCompositeAsset::ANIM_SHIFT},\r\n\t{\"torotation\",(sizeof(\"torotation\")-1),CKLBCompositeAsset::ANIM_TO_ROTATION},\r\n\t{\"toscalex\",(sizeof(\"toscalex\")-1),CKLBCompositeAsset::ANIM_TOSCALE_X},\r\n\t{\"toscaley\",(sizeof(\"toscaley\")-1),CKLBCompositeAsset::ANIM_TOSCALE_Y}\r\n\t//\r\n\t// KEEP LIST IN ORDER !!! UPDATE USING EXCEL, NOT MANUALLY !!!!\r\n\t// Update using EXCEL \r\n\t//\r\n};\r\n\r\nstatic const int keyWordCount[9] = {\r\n\t0, // No array of size 0\r\n\tsizeof(keywords1) / sizeof(key_name_value),\r\n\tsizeof(keywords2) / sizeof(key_name_value),\r\n\tsizeof(keywords3) / sizeof(key_name_value),\r\n\tsizeof(keywords4) / sizeof(key_name_value),\r\n\tsizeof(keywords5) / sizeof(key_name_value),\r\n\tsizeof(keywords6) / sizeof(key_name_value),\r\n\tsizeof(keywords7) / sizeof(key_name_value),\r\n\tsizeof(keywordsOther) / sizeof(key_name_value),\r\n};\r\n\r\nstatic u32 bin_search(const key_name_value* searchArray, const unsigned char *key, u32 start, u32 finish)\r\n{\r\n\tif (start >= finish) {\r\n\t\tklb_assertAlways(\"Invalid Key\");\r\n\t\treturn 0xFFFFFFFF;\r\n\t} else {\r\n\t\tu32 mid = (start+finish)/2;\r\n\t\tint cmp = strcmp((const char*)key,searchArray[mid].name);\r\n\t\tif (cmp == 0) {\r\n\t\t\treturn searchArray[mid].value;\r\n\t\t} else if (cmp < 0) {\r\n\t\t\treturn bin_search(searchArray, key,start,mid);\r\n\t\t} else {\r\n\t\t\treturn bin_search(searchArray, key,mid+1,finish);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nstatic u32 Composite_keySearch(const char* buff, u32 stringLen) {\r\n\tint num_keywords;\r\n\tconst key_name_value* keywords;\r\n\tint keyLen = stringLen;\r\n\r\n\tswitch (keyLen) {\r\n\tcase 1:\tkeywords = keywords1;   break;\r\n\tcase 2:\tkeywords = keywords2;\tbreak;\r\n\tcase 3:\tkeywords = keywords3;\tbreak;\r\n\tcase 4:\tkeywords = keywords4;\tbreak;\r\n\tcase 5:\tkeywords = keywords5;\tbreak;\r\n\tcase 6:\tkeywords = keywords6;\tbreak;\r\n\tcase 7:\tkeywords = keywords7;\tbreak;\r\n\tdefault: \r\n\t\tkeywords = keywordsOther;\t\r\n\t\tkeyLen = 8;\r\n\t\tbreak;\r\n\t}\r\n\r\n\tnum_keywords = keyWordCount[keyLen];\r\n\r\n\treturn bin_search(keywords,(const unsigned char*)buff,0,num_keywords);\r\n}\r\n\r\n/*static*/\r\nint CKLBCompositeAsset::readMapKey(const unsigned char * stringVal, size_t stringLen, int cte_pool)  \r\n{\r\n\tif (mode == GENERIC_MODE) {\r\n\t\tm_parserField\t= GENERIC_FIELD;\r\n\t\tklb_assert(stringLen < TMP_COMPOSITE_ASSET_STR_BUFFSIZE, \"Map Key name is too long\");\r\n\t\tmemcpy(tmpBuff, stringVal, stringLen);\r\n\t\ttmpBuff[stringLen] = 0;// Close C string.\r\n\t\treturn 1;\r\n\t}\r\n\r\n\t//\r\n\tm_parserField = 0xFFFF; // Undefined\r\n\r\n\r\n\tif (cte_pool > -1) {\r\n\t\tint id = bjson_getCPCacheID((yajl_handle)this->parserCtx, cte_pool);\r\n\t\tif (id != -1) {\r\n\t\t\tm_parserField = (u16)id;\r\n\t\t\tif (id == STATES_FIELD) {\r\n\t\t\t\tm_bTreeMode = false;\r\n\t\t\t}\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t// Tmp C string\r\n\tchar buff[100];\r\n\tmemcpy(buff,stringVal,stringLen);\r\n\tbuff[stringLen] = 0;\r\n\r\n\tm_parserField = Composite_keySearch(buff, stringLen);\r\n\t// printf(\"Keyword : %s (%i)\", buff,m_parserField);\r\n\r\n\tif (m_parserField == STATES_FIELD) {\r\n\t\tm_bTreeMode = false;\r\n\t}\r\n\t\r\n\tif (cte_pool > -1) {\r\n\t\tbjson_setCPCacheID((yajl_handle)this->parserCtx, cte_pool, m_parserField);\r\n\t}\r\n\r\n\treturn (m_parserField != 0xFFFF);\r\n}\r\n  \r\nint CKLBCompositeAsset::readStartMap(unsigned int /*size*/) {\r\n\tif (m_bTreeMode) {\r\n\t\tif (m_parserField == GENERIC_FIELD) {\r\n\t\t\tm_pCurrInnerDef->propertyBag = CKLBPropertyBag::getPropertyBag();\r\n\t\t\tif (m_pCurrInnerDef->propertyBag) {\r\n\t\t\t\tmode = GENERIC_MODE;\r\n\t\t\t} else {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tCKLBInnerDef* pNext = KLBNEW(CKLBInnerDef);\r\n\t\t\tif (!m_pParent) {\r\n\t\t\t\t// root\r\n\t\t\t\tm_root = pNext;\r\n\t\t\t} else {\r\n\t\t\t\tif (m_pParent->sub) {\r\n\t\t\t\t\t// Add at the end of list.\r\n\t\t\t\t\tm_pCurrInnerDef->next = pNext;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpNext->next\t\t= m_pParent->sub; \r\n\t\t\t\t\tm_pParent->sub\t= pNext;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tm_pCurrInnerDef = pNext;\r\n\t\t}\r\n\t} else {\r\n\t\tCKLBAnimInfo* pNext = KLBNEW(CKLBAnimInfo);\r\n\t\tpNext->m_next = m_pCurrInnerDef->anim;\r\n\t\tm_pCurrInnerDef->anim = pNext;\r\n\t\tm_pCurrAnim = pNext;\r\n\t}\r\n\treturn 1;\r\n}\r\n  \r\nint CKLBCompositeAsset::readEndMap()  \r\n{\r\n\tif (m_parserField == GENERIC_FIELD) {\r\n\t\tmode = STANDARD_PARSER_MODE;\r\n\t\tm_parserField = 0xFFFF;\t// undefined.\r\n\t}\r\n\t// Do nothing.\r\n\treturn 1;  \r\n}\r\n\r\nint CKLBCompositeAsset::readStartArray(unsigned int /*size*/)\r\n{\t// 0 always null\r\n\t// 1 has ptr\r\n\tif (m_bTreeMode) {\r\n\t\tif (m_parserField == SPLINE_ARRAY) {\r\n\t\t\tm_currArraySpline\t\t\t= KLBNEWA(float, m_pCurrInnerDef->splineVectorSize * m_pCurrInnerDef->splineCount);\r\n\t\t\tm_pCurrInnerDef->spline\t\t= m_currArraySpline;\r\n\t\t\tif (!m_currArraySpline) {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tklb_assert(m_parent < MAX_STACK_DEPTH, \"Reached Maximum Stack Depth for UI Form (%i)\", MAX_STACK_DEPTH);\r\n\t\t\tm_pParent\t\t\t\t\t= m_pCurrInnerDef;\r\n\t\t\tm_parentStack[++m_parent]\t= m_pCurrInnerDef;\r\n\t\t}\r\n\t} else {\r\n\t\t// Do nothing\r\n\t\tif (m_parserField == ANIM_EASING) {\r\n\t\t\tm_parserField = ANIM_DATA;\r\n\t\t}\r\n\t}\r\n\r\n\treturn 1;\r\n}\r\n  \r\n/*static*/ \r\nint CKLBCompositeAsset::readEndArray()  {\r\n\tif (!m_bTreeMode) {\r\n\t\tif (m_parserField == ANIM_DATA) {\r\n\t\t\t// Do nothing\r\n\t\t} else {\r\n\t\t\tm_bTreeMode = true;\r\n\t\t}\r\n\t} else {\r\n\t\tif (m_parserField != SPLINE_ARRAY) {\r\n\t\t\tm_pCurrInnerDef = m_parentStack[m_parent--];\r\n\t\t\tm_pParent\t= m_parentStack[m_parent];\r\n\t\t}\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\n/*virtual*/\r\nCKLBNode* CKLBCompositeAsset::createSubTree(u32 /*priorityBase*/) {\r\n\tklb_assertAlways(\"[DEPRECATED] Generate method for tree creation is not available anymore\");\r\n\treturn NULL;\r\n}\r\n\r\n\r\nCKLBNode* CKLBCompositeAsset::createSubTree(CKLBUITask* pParentTask,u32 priorityBase) {\r\n\t// Node have priority set into data stream.\r\n\tif ((m_recCount == 0) && m_rootParent && m_root && createSubTreeRecursive(m_groupID, pParentTask, m_rootParent, m_root, priorityBase)) {\r\n\t\tm_recCount = 0;\r\n\t\treturn m_rootParent->getChild();\t\t\t\r\n\t} else {\r\n\t\tCKLBNode* pChild = m_rootParent->getChild();\r\n\r\n\t\t// Destruct half build tree.\r\n\t\tKLBDELETE(pChild);\r\n\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nCKLBAnimInfo* CKLBInnerDef::findAnimation(const char* animName) {\r\n\tCKLBAnimInfo* pInfo = this->anim;\r\n\twhile (pInfo) {\r\n\t\tif ((pInfo->mode) && (pInfo->mode->string) && CKLBUtility::safe_strcmp(pInfo->mode->string, animName)==0) {\r\n\t\t\treturn pInfo;\r\n\t\t}\r\n\t\tpInfo = pInfo->m_next;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBSplineNode::setCounter(u32* refCounterPtr) {\r\n\tif (m_refCounter) {\r\n\t\t*m_refCounter = (*m_refCounter) - 1;\r\n\t}\r\n\tm_refCounter = refCounterPtr;\r\n}\r\n\r\nvoid CKLBNode::skipAnimation(const char* animName) {\r\n\tif (this->getClassID() == CLS_KLBSPLINENODE) {\r\n\t\tCKLBSplineNode* pAnim = (CKLBSplineNode*)this;\r\n\t\tvoid* pTag = pAnim->getTag();\r\n\t\tif (pTag) {\r\n\t\t\t//\r\n\t\t\tCKLBInnerDef* temp = (CKLBInnerDef*)pTag;\r\n\t\t\tCKLBAnimInfo* animData = NULL;\r\n\t\t\tif (animName) {\r\n\t\t\t\tanimData = temp->findAnimation(animName);\r\n\t\t\t\tif (animData) {\r\n\t\t\t\t\tpAnim->endAnimation(animData->data);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tCKLBNode* pParse = this->m_pChild;\r\n\twhile (pParse) {\r\n\t\tpParse->skipAnimation(animName);\r\n\t\tpParse = pParse->m_pBrother;\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::kickAnimation(const char* animName,u32* refCounterPtr, bool doBlend) {\r\n\t//\r\n\t// Is animated node with given animation name setup ?\r\n\t//\r\n\tif (this->getClassID() == CLS_KLBSPLINENODE) {\r\n\t\tCKLBSplineNode* pAnim = (CKLBSplineNode*)this;\r\n\t\tvoid* pTag = pAnim->getTag();\r\n\t\tif (pTag) {\r\n\t\t\t//\r\n\t\t\tCKLBInnerDef* temp = (CKLBInnerDef*)pTag;\r\n\t\t\tCKLBAnimInfo* animData = temp->findAnimation(animName);\r\n\t\t\tif (animData) {\r\n\t\t\t\tu32 mask = 0;\r\n\t\t\t\tfloat params[18];\r\n\t\t\t\tfloat src;\r\n\t\t\t\tfloat dst;\r\n\t\t\t\tfloat* fill = params;\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Yes : Setup animation here.\r\n\t\t\t\t//\r\n\r\n\t\t\t\tsrc = (doBlend) ? pAnim->m_matrix.m_matrix[MAT_TX] : animData->fromX;\r\n\t\t\t\tdst = animData->toX;\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_X_COORD_0;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? pAnim->m_matrix.m_matrix[MAT_TY] : animData->fromY;\r\n\t\t\t\tdst = animData->toY;\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_Y_COORD_1;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? m_localColorMatrix.m_vector[0] : (animData->fromR / 255.0f);\r\n\t\t\t\tdst = (animData->toR / 255.0f);\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_R_COLOR_3;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? m_localColorMatrix.m_vector[1] : (animData->fromG / 255.0f);\r\n\t\t\t\tdst = (animData->toG / 255.0f);\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_G_COLOR_4;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? m_localColorMatrix.m_vector[2] : (animData->fromB / 255.0f);\r\n\t\t\t\tdst = (animData->toB / 255.0f);\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_B_COLOR_5;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? m_localColorMatrix.m_vector[3] : (animData->fromAlpha / 255.0f);\r\n\t\t\t\tdst = (animData->toAlpha / 255.0f);\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_A_COLOR_6;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? pAnim->getScaleX() : animData->fromScaleX;\r\n\t\t\t\tdst = animData->toScaleX;\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_SCALEX_COORD_7;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? pAnim->getScaleY() : animData->fromScaleY;\r\n\t\t\t\tdst = animData->toScaleY;\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_SCALEY_COORD_8;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsrc = (doBlend) ? pAnim->getRotation() : animData->fromRotation;\r\n\t\t\t\tdst = animData->toRotation;\r\n\r\n\t\t\t\tif ((src != dst) || (!doBlend)) {\r\n\t\t\t\t\tmask |= CKLBSplineNode::ANM_ROTATION_COORD_9;\r\n\t\t\t\t\t*fill++ = src;\r\n\t\t\t\t\t*fill++ = dst;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//\r\n\t\t\t\tpAnim->setAnimation(\tanimData->length,\r\n\t\t\t\t\t\t\t\t\t\tanimData->timeShift,\r\n\t\t\t\t\t\t\t\t\t\tanimData->spline,\r\n\t\t\t\t\t\t\t\t\t\tanimData->data,\r\n\t\t\t\t\t\t\t\t\t\tanimData->dataSize >> 2,\r\n\t\t\t\t\t\t\t\t\t\tmask | (animData->loop ? CKLBSplineNode::ANM_LOOPBIT : 0) | (animData->pingpong ? CKLBSplineNode::ANM_PING_PONG : 0), params);\r\n\t\t\t\tpAnim->play();\r\n\r\n\t\t\t\tif (refCounterPtr) {\r\n\t\t\t\t\t// Increment ref counter\r\n\t\t\t\t\t*refCounterPtr = *refCounterPtr + 1;\r\n\t\t\t\t\tpAnim->setCounter(refCounterPtr);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tCKLBNode* pParse = this->m_pChild;\r\n\twhile (pParse) {\r\n\t\tpParse->kickAnimation(animName, refCounterPtr, doBlend);\r\n\t\tpParse = pParse->m_pBrother;\r\n\t}\r\n}\r\n\r\n#include \"CKLBUIWebArea.h\"\r\n#include \"CKLBUIScore.h\"\r\n#include \"CKLBUIProgressBar.h\"\r\n#include \"CKLBUIDragIcon.h\"\r\n#include \"CKLBUIVirtualDoc.h\"\r\n#include \"CKLBUIList.h\"\r\n#include \"CKLBUIPieChart.h\"\r\n#include \"CKLBUIScrollBar.h\"\r\n#include \"CKLBUICanvas.h\"\r\n#include \"CKLBUIScale9.h\"\r\n\r\n/*static*/char\t\tCKLBCompositeAsset::tmpBuff[TMP_COMPOSITE_ASSET_STR_BUFFSIZE];\r\n/*static*/char*\t\tCKLBCompositeAsset::ptrBuff;\r\n\r\nvoid CKLBCompositeAsset::resetTmpBuff() {\r\n\tptrBuff = &tmpBuff[0];\r\n}\r\n\r\nconst char* CKLBCompositeAsset::addAssetPrefix(const char* prefixLessAsset) {\r\n\tconst char* d = ptrBuff;\r\n\tconst char* assetPreFix = \"asset://\"; // 8 char \r\n\tmemcpy(ptrBuff,assetPreFix,8);\r\n\tptrBuff += 8;\r\n\tint len = strlen(prefixLessAsset) + 1; // include 0.\r\n\tmemcpy(ptrBuff,prefixLessAsset, len);\r\n\tptrBuff += len;\r\n\r\n\tklb_assert((ptrBuff <= &tmpBuff[TMP_COMPOSITE_ASSET_STR_BUFFSIZE]), \"Temp composite string buffer overflow\");\r\n\treturn d;\r\n}\r\n\r\nconst char* CKLBCompositeAsset::formatI(s32 i) {\r\n\tconst char* pRes = ptrBuff;\r\n\tsprintf(ptrBuff,\"%i\",i);\r\n\tint len = strlen(ptrBuff);\r\n\tptrBuff += len + 1;\r\n\treturn pRes;\r\n}\r\n\r\nconst char* CKLBCompositeAsset::formatB(bool b) {\r\n\tif (b) {\r\n\t\treturn \"true\";\r\n\t} else {\r\n\t\treturn \"false\";\r\n\t}\r\n}\r\n\r\nconst char* CKLBCompositeAsset::formatF(float f) {\r\n\tconst char* pRes = ptrBuff;\r\n\tsprintf(ptrBuff,\"%f\",f);\r\n\tint len = strlen(ptrBuff);\r\n\tptrBuff += len + 1;\r\n\treturn pRes;\r\n}\r\n\r\nconst char* CKLBCompositeAsset::addString(const char* source, u32 len) {\r\n\tconst char* res = ptrBuff;\r\n\tmemcpy(ptrBuff,source,len);\r\n\tptrBuff[len] = 0;\r\n\tptrBuff += len + 1;\r\n\treturn res;\r\n}\r\n\r\ns32 CKLBCompositeAsset::filterDBInt(CKLBCompositeAsset::STRINGENTRY* input, s32 original) {\r\n\tif (input && ((*(input->string)) == '$')) {\r\n\t\tint idx = m_pSource->getFieldIndex(&input->string[1]);\r\n\t\tif (idx >= 0) {\r\n\t\t\tswitch (m_pSource->getFieldType(idx)) {\r\n\t\t\tcase IDataSource::TYPE_INT:\r\n\t\t\t\treturn m_pSource->getAsInt(m_record, idx);\r\n\t\t\tdefault:\r\n\t\t\t\tklb_assertAlways(\"Invalid Record Field Type.\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"DB Field Name %s not found.\", input);\r\n\t\t}\r\n\t} else {\r\n\t\treturn original;\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n\r\nfloat CKLBCompositeAsset::filterDBFloat(CKLBCompositeAsset::STRINGENTRY* input, float original) {\r\n\tif (input && ((*(input->string)) == '$')) {\r\n\t\tint idx = m_pSource->getFieldIndex(&input->string[1]);\r\n\t\tif (idx >= 0) {\r\n\t\t\tswitch (m_pSource->getFieldType(idx)) {\r\n\t\t\tcase IDataSource::TYPE_FLOAT:\r\n\t\t\t\treturn m_pSource->getAsFloat(m_record, idx);\r\n\t\t\tdefault:\r\n\t\t\t\tklb_assertAlways(\"Invalid Record Field Type.\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"DB Field Name %s not found.\", input);\r\n\t\t}\r\n\t} else {\r\n\t\treturn original;\r\n\t}\r\n\treturn 0.0f;\r\n}\r\n\r\nconst char* CKLBCompositeAsset::filterDB(const char* input, bool* filtered) {\r\n\tif (input && m_pSource && (input[0] == '$')) {\r\n\t\tif (filtered) {\r\n\t\t\t*filtered = true;\r\n\t\t}\r\n\t\tinput++;\r\n\t\tint idx = m_pSource->getFieldIndex(input);\r\n\t\tif (idx >= 0) {\r\n\t\t\tswitch (m_pSource->getFieldType(idx)) {\r\n\t\t\tcase IDataSource::TYPE_INT:\r\n\t\t\t\treturn formatI(m_pSource->getAsInt(m_record, idx));\r\n\t\t\tcase IDataSource::TYPE_BOOL:\r\n\t\t\t\treturn formatB(m_pSource->getAsBool(m_record, idx));\r\n\t\t\tcase IDataSource::TYPE_FLOAT:\r\n\t\t\t\treturn formatF(m_pSource->getAsBool(m_record, idx));\r\n\t\t\tcase IDataSource::TYPE_STR:\r\n\t\t\t\t{\r\n\t\t\t\t\tu32 len;\r\n\t\t\t\t\tconst char* pStr = m_pSource->getAsString(m_record, idx, len);\r\n\t\t\t\t\treturn addString(pStr, len);\r\n\t\t\t\t}\r\n\t\t\tcase IDataSource::TYPE_NIL:\r\n\t\t\tcase IDataSource::TYPE_BLOB:\r\n\t\t\t\treturn NULL;\r\n\t\t\tdefault:\r\n\t\t\t\tklb_assertAlways(\"Invalid Record Field Type.\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Use $ string to show failure.\r\n\t\t\tinput--;\r\n\t\t}\r\n\t}\r\n\r\n\treturn input;\r\n}\r\n\r\n\r\nvoid CKLBCompositeAsset::setRecord(IDataSource* pSource, IDataRecord pRecord) {\r\n\tm_record\t= pRecord;\r\n\tm_pSource\t= pSource;\r\n}\r\n\r\nvoid CKLBCompositeAsset::setupTask(CKLBInnerDef* templateDef, CKLBUITask* tsk) {\r\n\tif (tsk) {\r\n\t\ttsk->setVisible(templateDef->visible);\r\n\t\tif (templateDef->name) {\r\n\t\t\ttsk->getNode()->setName(templateDef->name->string);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBCompositeAsset::setupNode(CKLBInnerDef* templateDef, CKLBNode* node) {\r\n\tif (node) {\r\n\t\tnode->setVisible(templateDef->visible);\r\n\t\tif (templateDef->name) {\r\n\t\t\tnode->setName(templateDef->name->string);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nbool CKLBCompositeAsset::createSubTreeRecursive(u16 groupID, CKLBUITask* pParentTask, CKLBNode* parent, CKLBInnerDef* templateDef, u32 priorityOffset) {\r\n\tbool res\t\t\t\t\t= true; // Success by default.\r\n\tCKLBNode* pNode\t\t\t\t= NULL;\r\n\tCKLBAssetManager& pAssetMgr = CKLBAssetManager::getInstance();\r\n\tCKLBAsset* pAsset[____END_ASSET];\r\n\r\n\t// Flag to avoid composite refering to itself.\r\n\tm_recCount = 1;\r\n\r\n\tfor (int n=0; n < ____END_ASSET; n++) {\r\n\t\tpAsset[n] = NULL;\r\n\t\tif (templateDef->assets[n]) {\r\n\t\t\tbool filtered = false;\r\n\t\t\tpAsset[n] = templateDef->assets[n]->assetCache;\r\n\t\t\tif (pAsset[n] == NULL) {\r\n\t\t\t\tif ((n < DOWNAUDIO_ASSET) || (templateDef->classID == SCORE_CLASSID)) {\r\n\t\t\t\t\tconst char* name = filterDB(templateDef->assets[n]->string,&filtered);\r\n\t\t\t\t\tu16 assetID = pAssetMgr.getAssetIDFromName(name,0);\r\n\t\t\t\t\tCKLBAbstractAsset* lAsset = pAssetMgr.getAsset(assetID);\r\n\t\t\t\t\tif (lAsset && (lAsset->getAssetType() == ASSET_TEXTURE)) {\r\n\t\t\t\t\t\t// Extract Image from texture.\r\n\t\t\t\t\t\tif (!filtered) {\r\n\t\t\t\t\t\t\tlAsset->incrementRefCount();\t// Later we increment image but we do not care.\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tlAsset = ((CKLBTextureAsset*)lAsset)->getImage(name);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (lAsset && (lAsset->getAssetType() & HAS_CREATENODE)) {\r\n\t\t\t\t\t\tpAsset[n] = (CKLBAsset*)lAsset;\r\n\t\t\t\t\t\tif ((lAsset->getAssetType() != ASSET_IMAGE) && (!filtered)) {\r\n\t\t\t\t\t\t\tpAsset[n]->incrementRefCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!filtered) {\r\n\t\t\t\t\t\t\ttemplateDef->assets[n]->assetCache = pAsset[n];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (n >= DOWNAUDIO_ASSET) {\r\n\t\t\t\t\tresetTmpBuff();\r\n\t\t\t\t\tCKLBAbstractAsset* lAsset = pAssetMgr.loadAssetByFileName(addAssetPrefix(filterDB(templateDef->assets[n]->string,&filtered)), pAssetMgr.getPlugin('A'), true);\r\n\t\t\t\t\tif (lAsset && (lAsset->getAssetType() == ASSET_AUDIO)) {\r\n\t\t\t\t\t\tCKLBAudioAsset* pAudio = (CKLBAudioAsset*)lAsset;\r\n\t\t\t\t\t\tif (!pAudio->preLoad()) {\r\n\t\t\t\t\t\t\tklb_assertAlways(\"Failed preloading audio\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!filtered) {\r\n\t\t\t\t\t\t\tlAsset->incrementRefCount();\t// Later we increment image but we do not care.\r\n\t\t\t\t\t\t\ttemplateDef->assets[n]->assetCache = (CKLBAsset*)lAsset;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpAsset[n] = (CKLBAsset*)lAsset;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tu32 newPrio = priorityOffset + templateDef->priority;\r\n\r\n\tklb_assert(\r\n\t\t   ((((s64)priorityOffset + (s64)templateDef->priority)>>32) != 0)\r\n\t\t|| ((((s64)priorityOffset + (s64)templateDef->priority)>>32) != -1), \"Overflow or underflow\");\r\n\r\n\tresetTmpBuff();\r\n\r\n\tbool execNodeSetup = true;\r\n\tif (templateDef->classID != NONE_CLASSID) {\r\n\r\n\t\tswitch (templateDef->classID) {\r\n\t\tcase WEBVIEW_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char* url = NULL;\r\n\t\t\t\tconst char* cb  = NULL;\r\n\r\n\t\t\t\tif (templateDef->handler[1]) {\r\n\t\t\t\t\turl = filterDB(templateDef->handler[1]->string);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (templateDef->handler[0]) {\r\n\t\t\t\t\tcb\t= templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUIWebArea* tsk = CKLBUIWebArea::create(\r\n\t\t\t\t\tpParentTask, \r\n\t\t\t\t\tparent,\r\n\t\t\t\t\ttemplateDef->flag[0] ? true : false,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width,\r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\turl,\t// URL\r\n\t\t\t\t\tcb\t\t// Call back.\r\n\t\t\t\t);\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\r\n\t\t\t\tpNode = NULL;\r\n\r\n\t\t\t\t/*\tAllow sub system to be created.\r\n\t\t\t\t\t----------------------------------\r\n\r\n\t\t\t\t\tpNode = lNode;\r\n\t\t\t\t\tpParentTask = tsk;\r\n\t\t\t\t */\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase VIRTUALDOC_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char* cb  = NULL;\r\n\r\n\t\t\t\tif (templateDef->handler[0]) {\r\n\t\t\t\t\tcb\t= templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUIVirtualDoc* tsk = CKLBUIVirtualDoc::create(\r\n\t\t\t\t\tpParentTask,\r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tnewPrio, //templateDef->priority,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->sw,\r\n\t\t\t\t\ttemplateDef->sh,\r\n\t\t\t\t\ttemplateDef->width,\r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\ttemplateDef->radioID,\t\t\t// MAX COMMAND, memory reuse !\r\n\t\t\t\t\ttemplateDef->sx ? true : false,\t// Vertical/Horizontal, memory reuse !\r\n\t\t\t\t\tcb\r\n\t\t\t\t);\r\n\r\n\r\n\t\t\t\t//const char * fontName  = (templateDef->fontName) ? templateDef->fontName->string\t: 0; // \"default\";\r\n\t\t\t\t//const char * labelText = (templateDef->text)     ? templateDef->text->string\t\t: \"\";\r\n\r\n\t\t\t\t/*\r\n\t\t\t\tif (templateDef->text != 0) {\r\n\t\t\t\t\ttsk->startDocument();\r\n\t\t\t\t\ttsk->setFont(0, fontName , templateDef->fontSize);\r\n\t\t\t\t\ttsk->drawText(0, 0, filterDB(labelText), filterDBInt(templateDef->dbField[DB_VAL_COLOR], templateDef->color), 0);\r\n\t\t\t\t\ttsk->endDocument();\r\n\t\t\t\t} */\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase SCORE_CLASSID:\r\n\t\t\t{\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\t\t\t\tconst char *\ttex_table[10];\r\n\t\t\t\tfor (int n = 0; n < 10; n++) {\r\n\t\t\t\t\ttex_table[n] = addAssetPrefix(templateDef->assets[n]->string);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUIScore* tsk = CKLBUIScore::create(\r\n\t\t\t\t\tpParentTask,\r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tnewPrio, //templateDef->priority,\r\n\t\t\t\t\ttemplateDef->priorityClipStart,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttex_table,\r\n\t\t\t\t\ttemplateDef->sx,\r\n\t\t\t\t\ttemplateDef->sy,\r\n\t\t\t\t\ttemplateDef->radioID, \r\n\t\t\t\t\ttemplateDef->flag[2] ? true : false,\r\n\t\t\t\t\ttemplateDef->flag[1] ? true : false,\r\n\t\t\t\t\ttemplateDef->flag[0],\t// align\r\n\t\t\t\t\t(1 - templateDef->flag[3]) ? true : false\t// countclip (0:true / 1:false)\r\n\t\t\t\t);\r\n\r\n\t\t\t\ttsk->setValue(templateDef->value);\r\n\t\t\t\ttsk->setColor(filterDBInt(templateDef->dbField[DB_VAL_COLOR], templateDef->color));\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PROGRESSBAR_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUIProgressBar* tsk = CKLBUIProgressBar::create(\r\n\t\t\t\t\tpParentTask,\r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tnewPrio, // templateDef->priority,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width,\r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\ttemplateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL,\r\n\t\t\t\t\ttemplateDef->assets[1] ? addAssetPrefix(filterDB(templateDef->assets[1]->string)) : NULL,\r\n\t\t\t\t\ttemplateDef->clipw,\r\n\t\t\t\t\ttemplateDef->cliph,\r\n\t\t\t\t\ttemplateDef->radioID <= 0 ? 0 : templateDef->radioID,\r\n\t\t\t\t\ttemplateDef->sx ? true : false\r\n\t\t\t\t);\r\n\r\n\t\t\t\ttsk->setValue((filterDBInt(templateDef->dbField[DB_VAL_VALUE], templateDef->value) / 100.0f));\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase SCROLLBAR_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char* cb  = NULL;\r\n\r\n\t\t\t\tif (templateDef->handler[0]) {\r\n\t\t\t\t\tcb\t= templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUIScrollBar* tsk = CKLBUIScrollBar::create(pParentTask,parent,newPrio,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width,\r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\tfilterDBInt(templateDef->dbField[DB_VAR_MIN],   templateDef->variable[VAR_MIN]),\r\n\t\t\t\t\tfilterDBInt(templateDef->dbField[DB_VAR_MAX],   templateDef->variable[VAR_MAX]),\r\n\t\t\t\t\tfilterDBInt(templateDef->dbField[DB_VAL_VALUE], templateDef->value),\t\t\t//pos\r\n\t\t\t\t\ttemplateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL,\r\n\t\t\t\t\t\r\n\t\t\t\t\ttemplateDef->variable[VAR_SLIDERSIZE],\r\n\t\t\t\t\ttemplateDef->variable[VAR_MIN_SLIDERSIZE],\r\n\t\t\t\t\tcb,\r\n\t\t\t\t\tfilterDBInt(templateDef->dbField[DB_VAL_COLOR], templateDef->color),\r\n\t\t\t\t\ttemplateDef->variable[VAR_SELECTCOLOR],\r\n\t\t\t\t\ttemplateDef->sx ? true : false,\t\t\t\t\t// Vertical/Horizontal\r\n\t\t\t\t\ttemplateDef->flag[2] ? true : false\r\n\t\t\t\t);\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres\t  = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CANVAS_CLASSID:\r\n\t\tcase TILEDCANVAS_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char* cb  = NULL;\r\n\r\n\t\t\t\tif (templateDef->handler[0]) {\r\n\t\t\t\t\tcb\t= templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUICanvas* tsk = CKLBUICanvas::create(pParentTask,parent,newPrio,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->variable[VAR_MAXVERTEX],\r\n\t\t\t\t\ttemplateDef->variable[VAR_MAXINDEX],\r\n\t\t\t\t\tcb\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (templateDef->classID == TILEDCANVAS_CLASSID) {\r\n\t\t\t\t\ttsk->setTiledRect((u32)templateDef->width, (u32)templateDef->height, templateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL, (u32)0xFF);\r\n\t\t\t\t\ttsk->freeze(true);\r\n\t\t\t\t}\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres\t  = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase SCALE9_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUIScale9* tsk = CKLBUIScale9::create(\r\n\t\t\t\t\tpParentTask,parent,newPrio,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width,\r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\ttemplateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL\r\n\t\t\t\t);\r\n\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres\t  = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DRAGICON_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char* cb = NULL;\r\n\r\n\t\t\t\tif (templateDef->handler[0]) {\r\n\t\t\t\t\tcb\t= templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUIDragIcon::AREA\ttapArea;\r\n\r\n\t\t\t\tresetTmpBuff();\r\n\r\n\t\t\t\ttapArea.x\t\t= templateDef->sx;\r\n\t\t\t\ttapArea.y\t\t= templateDef->sy;\r\n\t\t\t\ttapArea.width\t= templateDef->sw;\r\n\t\t\t\ttapArea.height\t= templateDef->sh;\r\n\r\n\t\t\t\tCKLBUIDragIcon* tsk = CKLBUIDragIcon::create(\r\n\t\t\t\t\tpParentTask,\r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tnewPrio, // templateDef->priority,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\t&tapArea,\r\n\t\t\t\t\ttemplateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL,\r\n\t\t\t\t\ttemplateDef->assets[1] ? addAssetPrefix(filterDB(templateDef->assets[1]->string)) : NULL,\r\n\t\t\t\t\ttemplateDef->priorityClipStart,\r\n\t\t\t\t\ttemplateDef->rotation,\r\n\t\t\t\t\ttemplateDef->clipx,\r\n\t\t\t\t\ttemplateDef->clipy, \r\n\t\t\t\t\tcb,\r\n\t\t\t\t\ttemplateDef->flag[0]\r\n\t\t\t\t);\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase LIST_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char* cb = NULL;\r\n\r\n\t\t\t\tif (templateDef->handler[0]) {\r\n\t\t\t\t\tcb\t= templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUIList * tsk = CKLBUIList::create(\r\n\t\t\t\t\tpParentTask, \r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tpriorityOffset + templateDef->priority, \r\n\t\t\t\t\tpriorityOffset + templateDef->priorityClipEnd,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->clipw, \r\n\t\t\t\t\ttemplateDef->cliph,\r\n\t\t\t\t\t((templateDef->sx == 1) ?\r\n\t\t\t\t\t\ttemplateDef->height : templateDef->width), \r\n\t\t\t\t\ttemplateDef->sx ? true : false,\t\t// Vertical/Horizontal\r\n\t\t\t\t\tcb,\t\t\t\t\t\t\t\t\t//  \r\n\t\t\t\t\ttemplateDef->flag[0] ? CKLBUIList::LIST_FLAG_BOTTOM : 0\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (templateDef->spline) {\r\n\t\t\t\t\ttsk->setSplineLayout(templateDef->spline, templateDef->splineMask, templateDef->splineLength);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tif(tsk && templateDef->propertyBag) {\r\n\t\t\t\t\tCKLBPropertyBag * pProp = templateDef->propertyBag;\r\n\t\t\t\t\ttsk->selectScrollMgrByProperty(pProp);\r\n\r\n\t\t\t\t\tif(pProp->getPropertyBool(\"use_scrollBar\")) {\r\n\t\t\t\t\t\ttsk->useScrollBarByProperty(pProp, priorityOffset);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\t\t\t\tpNode   = NULL;\r\n\t\t\t\tres     = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase PIECHART_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUIPieChart * tsk = CKLBUIPieChart::create(\r\n\t\t\t\t\tpParentTask, \r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tnewPrio, \r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width, \r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\ttemplateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL,\r\n\t\t\t\t\tfilterDBFloat(templateDef->dbField[DB_VAR_STARTANGLE], templateDef->xscale), // Start use xscale to save memory.\r\n\t\t\t\t\tfilterDBFloat(templateDef->dbField[DB_VAR_ENDANGLE], templateDef->yscale),\t // End use yscale to save memory.\r\n\t\t\t\t\t(templateDef->radioID <= 0) ? 0 : templateDef->radioID,\r\n\t\t\t\t\tfilterDBInt(templateDef->dbField[DB_VAL_VALUE], templateDef->value) / 100.0f\r\n\t\t\t\t);\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase VARITEM_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUIVariableItem * tsk = CKLBUIVariableItem::create(\r\n\t\t\t\t\tpParentTask, \r\n\t\t\t\t\tparent,\r\n\t\t\t\t\tnewPrio,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width, \r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\ttemplateDef->assets[0] ? addAssetPrefix(filterDB(templateDef->assets[0]->string)) : NULL\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\tif(tsk && templateDef->flag[0]) {\r\n\t\t\t\t\ttsk->changeUV(\ttemplateDef->clipx,\r\n\t\t\t\t\t\t\t\t\ttemplateDef->clipy,\r\n\t\t\t\t\t\t\t\t\ttemplateDef->clipw,\r\n\t\t\t\t\t\t\t\t\ttemplateDef->cliph);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase GROUP_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUIGroup * tsk = CKLBUIGroup::create(\r\n\t\t\t\t\tpParentTask, \r\n\t\t\t\t\tparent,\r\n\t\t\t\t\t/*newPrio,*/ // Guillaume :  Order is not used anymore in Group\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y);\r\n\r\n\t\t\t\tsetupTask(templateDef,tsk);\r\n\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ANIMNODE_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBSplineNode* pNewNode = KLBNEW(CKLBSplineNode);\r\n\t\t\t\tif (pNewNode) {\r\n\t\t\t\t\tparent->addNode(pNewNode);\r\n\t\t\t\t\tpNode = pNewNode;\r\n\t\t\t\t\tpNewNode->setTag(templateDef);\r\n\t\t\t\t\tpNewNode->setTranslate(templateDef->x,templateDef->y);\r\n\t\t\t\t\tpNewNode->setScaleRotation(templateDef->xscale, templateDef->yscale,templateDef->rotation);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase TEXTBOX_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char * placeholder = (templateDef->placeholder) ? templateDef->placeholder->string : 0;\r\n\t\t\t\tint maxlen = templateDef->clipw;\r\n\t\t\t\tint chartype = (templateDef->cliph) ? templateDef->cliph : (IWidget::TXCH_7BIT_ASCII | IWidget::TXCH_UTF8);\r\n\r\n\t\t\t\tconst char* txt = NULL;\r\n\t\t\t\tif (templateDef->text) {\r\n\t\t\t\t\ttxt = filterDB(templateDef->text->string);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst char* handler = NULL;\r\n\t\t\t\tif(templateDef->handler[0]) {\r\n\t\t\t\t\thandler = templateDef->handler[0]->string;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tCKLBUITextInput* tsk = CKLBUITextInput::create(pParentTask,parent,\r\n\t\t\t\t\ttemplateDef->flag[0] ? true : false,\r\n\t\t\t\t\ttemplateDef->x,\r\n\t\t\t\t\ttemplateDef->y,\r\n\t\t\t\t\ttemplateDef->width,\r\n\t\t\t\t\ttemplateDef->height,\r\n\t\t\t\t\ttxt,\r\n\t\t\t\t\thandler,\r\n\t\t\t\t\ttemplateDef->id,\r\n\t\t\t\t\tmaxlen,\r\n\t\t\t\t\tchartype\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (tsk) {\r\n\t\t\t\t\tif(templateDef->name) {\r\n\t\t\t\t\t\ttsk->getNode()->setName(templateDef->name->string);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(placeholder) {\r\n\t\t\t\t\t\ttsk->setPlaceHolder(placeholder);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tsetupTask(templateDef,tsk);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Do not authorize creation of sub node for now.\r\n\t\t\t\tpNode = NULL;\r\n\t\t\t\tres = (tsk != NULL);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase LABEL_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tconst char * fontname  = (templateDef->fontName) ? templateDef->fontName->string\t: 0; // \"default\";\r\n\t\t\t\tconst char * labelText = (templateDef->text)     ? templateDef->text->string\t\t: \"\";\r\n\t\t\t\tCKLBLabelNode * pNewNode = KLBNEWC(CKLBLabelNode,(templateDef->fontSize, fontname, filterDB(labelText)));\r\n\r\n\t\t\t\tif (pNewNode) {\r\n\t\t\t\t\tpNewNode->resetAsInternalNode();\r\n\t\t\t\t\tparent->addNode(pNewNode);\r\n\r\n\t\t\t\t\tpNewNode->setUseTextSize(false);\r\n\t\t\t\t\tpNewNode->lock(true);\r\n\t\t\t\t\tpNewNode->setPriority(newPrio);\r\n\t\t\t\t\tpNewNode->setTextColor(filterDBInt(templateDef->dbField[DB_VAL_COLOR], templateDef->color));\r\n\t\t\t\t\tpNewNode->setWidth(templateDef->width);\r\n\t\t\t\t\tpNewNode->setHeight(templateDef->height);\r\n\t\t\t\t\tpNewNode->setAlign(templateDef->flag[0]);\r\n\r\n\t\t\t\t\tpNewNode->setTranslate(templateDef->x,templateDef->y);\r\n\t\t\t\t\tpNewNode->setScaleRotation(templateDef->xscale, templateDef->yscale,templateDef->rotation);\r\n\t\t\t\t\tpNewNode->lock(false);\r\n\t\t\t\t\tpNode = pNewNode;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BUTTON_CLASSID:\r\n\t\tcase CHECK_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUISelectable* pElement = KLBNEW(CKLBUISelectable);\r\n\t\t\t\tif (pElement && pElement->init(newPrio)) {\r\n\t\t\t\t\tpElement->setPriority(newPrio);\r\n\t\t\t\t\tif (templateDef->classID == CHECK_CLASSID) {\r\n\t\t\t\t\t\tpElement->setStick(true);\r\n\t\t\t\t\t\tif (templateDef->radioID != -1) {\r\n\t\t\t\t\t\t\tpElement->setRadio(templateDef->radioID);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tparent->addNode(pElement, 0);\r\n\t\t\t\t\tpElement->setScriptable(pParentTask);\r\n\t\t\t\t\tpElement->setTranslate(templateDef->x,templateDef->y);\t// Related to container issue.\r\n\t\t\t\t\tpElement->setScaleRotation(templateDef->xscale, templateDef->yscale,templateDef->rotation);\r\n\r\n\t\t\t\t\tpElement->setClickLeft\t(templateDef->sx);\r\n\t\t\t\t\tpElement->setClickTop\t(templateDef->sy);\r\n\t\t\t\t\tpElement->setClickWidth\t(templateDef->sw);\r\n\t\t\t\t\tpElement->setClickHeight(templateDef->sh);\r\n\r\n\t\t\t\t\tpElement->setAsset(pAsset[NORMAL_ASSET ],\tCKLBUIElement::NORMAL_ASSET\t\t);\r\n\t\t\t\t\tpElement->setAsset(pAsset[DISABLE_ASSET],\tCKLBUIElement::DISABLED_ASSET\t);\r\n\t\t\t\t\tpElement->setAsset(pAsset[FOCUS_ASSET  ],\tCKLBUIElement::FOCUSED_ASSET\t);\r\n\t\t\t\t\tpElement->setAsset(pAsset[PUSH_ASSET   ],\tCKLBUIElement::PUSHED_ASSET\t\t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tpElement->setAudio((CKLBAudioAsset*)pAsset[DOWNAUDIO_ASSET], 0, (templateDef->volAudioDown / 100.0f));\r\n\t\t\t\t\tpElement->setAudio((CKLBAudioAsset*)pAsset[UPAUDIO_ASSET  ], 1, (templateDef->volAudioUp   / 100.0f));\r\n                    \r\n                    pElement->setMultiplyVolume( 0, CKLBLuaLibSOUND::getFormGlobalVolume() );\r\n                    pElement->setMultiplyVolume( 1, CKLBLuaLibSOUND::getFormGlobalVolume() );\r\n\r\n\t\t\t\t\tpElement->setSticked(filterDBInt(templateDef->dbField[DB_VAR_CHECKED], templateDef->flag[0]) ? true : false);\r\n\t\t\t\t\t\r\n\t\t\t\t\tpElement->setEnabled(filterDBInt(templateDef->dbField[DB_VAR_ENABLE], templateDef->flag[2]) ? true : false);\r\n\t\t\t\t\tpElement->m_groupID = groupID;\r\n\r\n\t\t\t\t\t// Lua handler function\r\n\t\t\t\t\tif(templateDef->handler[0]) {\r\n\t\t\t\t\t\tpElement->setLuaFunction(templateDef->handler[0]->string);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpNode = pElement;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tKLBDELETE(pElement);\r\n\t\t\t\t\tres = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CONTAINER_CLASSID:\r\n\t\t\t{\r\n\t\t\t\tCKLBUIContainer* pCont = KLBNEW(CKLBUIContainer);\r\n\t\t\t\tif (pCont && pCont->init()) {\r\n\t\t\t\t\tpCont->setScriptable(pParentTask);\r\n\t\t\t\t\tpCont->setPriority(newPrio);\r\n\t\t\t\t\tpCont->setScaleRotation(templateDef->xscale, templateDef->yscale,templateDef->rotation);\r\n\t\t\t\t\tparent->addNode(pCont, 0);\r\n\t\t\t\t\tpCont->setTranslate(templateDef->x,templateDef->y);\r\n\t\t\t\t\tpCont->setAsset(pAsset[NORMAL_ASSET ],\tCKLBUIElement::NORMAL_ASSET\t\t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tpNode = pCont->getInnerNode();\r\n\r\n\t\t\t\t\tif (templateDef->cliph && templateDef->clipw) {\r\n\t\t\t\t\t\tif (templateDef->priorityClipStart != templateDef->priorityClipEnd) {\r\n\t\t\t\t\t\t\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\t\t\t\t\t\t\tCKLBRenderState* pClipStart = pMgr.allocateCommandState();\r\n\t\t\t\t\t\t\tCKLBRenderState* pClipEnd = pMgr.allocateCommandState();\r\n\r\n\t\t\t\t\t\t\tpClipStart->changeOrder(pMgr, templateDef->priorityClipStart + priorityOffset);\r\n\t\t\t\t\t\t\tpClipEnd->changeOrder(pMgr, templateDef->priorityClipEnd + priorityOffset);\r\n\r\n\t\t\t\t\t\t\tif (!templateDef->assets[DISABLE_ASSET]) {\r\n\t\t\t\t\t\t\t\tif (pNode->setRenderSlotCount(2) && pClipStart && pClipEnd) {\r\n\r\n\t\t\t\t\t\t\t\t\tklb_assert(\r\n\t\t\t\t\t\t\t\t\t\t   ((((s64)priorityOffset + (s64)templateDef->priorityClipStart)>>32) != 0)\r\n\t\t\t\t\t\t\t\t\t\t|| ((((s64)priorityOffset + (s64)templateDef->priorityClipStart)>>32) != -1), \"Overflow or underflow\");\r\n\r\n\t\t\t\t\t\t\t\t\tklb_assert(\r\n\t\t\t\t\t\t\t\t\t\t   ((((s64)priorityOffset + (s64)templateDef->priorityClipEnd)>>32) != 0)\r\n\t\t\t\t\t\t\t\t\t\t|| ((((s64)priorityOffset + (s64)templateDef->priorityClipEnd)>>32) != -1), \"Overflow or underflow\");\r\n\r\n\t\t\t\t\t\t\t\t\tpClipStart->setUse\t(true,false,null);\r\n\t\t\t\t\t\t\t\t\tpClipEnd->setUse\t(true,false,null);\r\n\r\n\t\t\t\t\t\t\t\t\tpClipStart->setScissor(true, templateDef->clipx,templateDef->clipy,templateDef->clipw,templateDef->cliph);\r\n\t\t\t\t\t\t\t\t\tpClipEnd->setScissor(false);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tpNode->setRender(pClipStart,0);\r\n\t\t\t\t\t\t\t\t\tpNode->setRender(pClipEnd  ,1);\r\n\r\n\t\t\t\t\t\t\t\t\tpCont->setClipHandle(CKLBUISystem::registerClip(pClipStart, pClipEnd));\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tklb_assertAlways(\"Failed allocation\");\r\n\t\t\t\t\t\t\t\t\tif (pClipEnd)\t{ pMgr.releaseCommand(pClipEnd);\t}\r\n\t\t\t\t\t\t\t\t\tif (pClipStart) { pMgr.releaseCommand(pClipStart);\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// Sprite\r\n\t\t\t\t\t\t\t\tCKLBDynSprite* pRenderMask = pMgr.allocateCommandDynSprite(6,6, templateDef->priorityClipStart + priorityOffset+1);\r\n\t\t\t\t\t\t\t\tCKLBRenderState* pDoMasking  = pMgr.allocateCommandState();\r\n\r\n\t\t\t\t\t\t\t\tif (pNode->setRenderSlotCount(3) && pClipStart && pClipEnd && pRenderMask && pDoMasking) {\r\n\t\t\t\t\t\t\t\t\t// Base + 1 \r\n\t\t\t\t\t\t\t\t\t// pRenderMask\r\n\t\t\t\t\t\t\t\t\t// Base + 2\r\n\t\t\t\t\t\t\t\t\tpDoMasking->changeOrder\t(pMgr, templateDef->priorityClipStart + priorityOffset + 2);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\t// 1. Start Clipping\r\n\t\t\t\t\t\t\t\t\t//\r\n\r\n\t\t\t\t\t\t\t\t\t// Clear Z Buffer with 1.0\r\n\t\t\t\t\t\t\t\t\tpClipStart->setUse(true,true,null);\t// Assign new state and execute clear command.\r\n\t\t\t\t\t\t\t\t\t// Setup the clear command.\r\n\t\t\t\t\t\t\t\t\tpClipStart->setClearDepth(true, 1.0f);\r\n\t\t\t\t\t\t\t\t\tpClipStart->setDepthRange(0.0f, 1.0f);\r\n\r\n\t\t\t\t\t\t\t\t\tSRenderState* pState = pClipStart->getState();\r\n\t\t\t\t\t\t\t\t\t// Set Z Write Always\r\n\t\t\t\t\t\t\t\t\tpState->setDepthState(true,true,SRenderState::ALWAYS);\r\n\t\t\t\t\t\t\t\t\t// [Opt] Alpha Test\r\n\t\t\t\t\t\t\t\t\t// pState->enableAlphaTest(value,SRenderState::GEQUAL);\r\n\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\t// 2. Render Mask\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\tpRenderMask->importXYUV\t((CKLBImageAsset*)pAsset[DISABLE_ASSET]);\r\n\t\t\t\t\t\t\t\t\t//u16* pIdx = pRenderMask->getSrcIndexBuffer();\r\n\t\t\t\t\t\t\t\t\tpRenderMask->setVertexXY(0, 0.0f              , 0.0f);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tpRenderMask->setVertexXY(1, templateDef->clipw, 0.0f);\r\n\t\t\t\t\t\t\t\t\tpRenderMask->setVertexXY(3, templateDef->clipw, 0.0f);\r\n\r\n\t\t\t\t\t\t\t\t\tpRenderMask->setVertexXY(4, templateDef->clipw, templateDef->cliph);\r\n\r\n\t\t\t\t\t\t\t\t\tpRenderMask->setVertexXY(2, 0.0f              , templateDef->cliph);\r\n\t\t\t\t\t\t\t\t\tpRenderMask->setVertexXY(5, 0.0f              , templateDef->cliph);\r\n\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\t// 3. Enable Depth Test, Disable Z Write, [Opt Alpha Test Disable]\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\tpState = pDoMasking->getState();\r\n\t\t\t\t\t\t\t\t\tpDoMasking->setUse(true,true,null); // Use render state.\r\n\t\t\t\t\t\t\t\t\tpDoMasking->setDepthRange(0.5f, 1.0f);\r\n\t\t\t\t\t\t\t\t\t// Draw only pixel <= 0.0f\r\n\t\t\t\t\t\t\t\t\tpState->setDepthState(false, true, SRenderState::GEQUAL);\r\n\t\t\t\t\t\t\t\t\t// [Opt] pState->disableAlphaTest();\r\n\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\t// 4. Disable Depth Test\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t\tpClipEnd->setUse(true,false,null);\r\n\t\t\t\t\t\t\t\t\tpState = pClipEnd->getState();\r\n\t\t\t\t\t\t\t\t\tpState->setDepthState(false, false, SRenderState::ALWAYS);\r\n\r\n\t\t\t\t\t\t\t\t\tpNode->setRender(pClipStart ,0);\r\n\t\t\t\t\t\t\t\t\tpCont->setRender(pRenderMask,0); // Transform is upper node.\r\n\t\t\t\t\t\t\t\t\tpNode->setRender(pDoMasking ,1);\r\n\t\t\t\t\t\t\t\t\tpNode->setRender(pClipEnd   ,2);\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tklb_assertAlways(\"Failed allocation\");\r\n\t\t\t\t\t\t\t\t\tif (pClipEnd)\t{ pMgr.releaseCommand(pClipEnd);\t}\r\n\t\t\t\t\t\t\t\t\tif (pClipStart) { pMgr.releaseCommand(pClipStart);\t}\r\n\t\t\t\t\t\t\t\t\tif (pDoMasking) { pMgr.releaseCommand(pDoMasking);\t}\r\n\t\t\t\t\t\t\t\t\tif (pRenderMask){ pMgr.releaseCommand(pRenderMask);\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tsetupNode(templateDef, pCont);\r\n\t\t\t\t\texecNodeSetup  = false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tKLBDELETE(pCont);\r\n\t\t\t\t\tres = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t} else {\r\n\t\t//\r\n\t\t// Composite any\r\n\t\t//\r\n\t\tif (pAsset[NORMAL_ASSET]) {\r\n\t\t\tpNode = pAsset[NORMAL_ASSET]->createSubTree(newPrio);\r\n\t\t} else {\r\n\t\t\t// No Asset & No Class = simple node\r\n\t\t\tpNode = KLBNEW(CKLBNode);\r\n\t\t}\r\n\r\n\t\tpNode->resetAsInternalNode();\r\n\r\n\t\t// Recursively create the composite.\r\n\t\tif (pNode) {\r\n\t\t\tpNode->setTranslate(templateDef->x, templateDef->y);\r\n\t\t\tpNode->setScaleRotation(templateDef->xscale, templateDef->yscale,templateDef->rotation);\r\n\t\t\tparent->addNode(pNode);\r\n\t\t} else {\r\n\t\t\tres = false;\r\n\t\t}\r\n\t}\r\n\r\n\t// Object name\r\n\tif (execNodeSetup) {\r\n\t\tsetupNode(templateDef, pNode);\r\n\t}\r\n\r\n\tif(templateDef->propertyBag) {\r\n\t\tCKLBPropertyBag::releasePropertyBag(templateDef->propertyBag);\r\n\t\ttemplateDef->propertyBag = 0;\r\n\t}\r\n\r\n\tif (res && pNode) {\r\n\t\tCKLBInnerDef* subList = templateDef->sub;\r\n\t\twhile (subList) {\r\n\t\t\tres &= createSubTreeRecursive(groupID, pParentTask, pNode, subList, priorityOffset);\r\n\t\t\tsubList = subList->next;\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\tif (!res) {\r\n\t\t// Do nothing : top destruction will destroy all nodes.\t\t\r\n\t}*/\r\n\r\n\treturn res;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Assets/CompositeManagement.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __COMPOSITE_MGT__\r\n#define __COMPOSITE_MGT__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"DataSet.h\"\r\n\r\nclass CKLBInnerDef;\r\nclass CKLBAnimInfo;\r\n\r\n#define\tTMP_COMPOSITE_ASSET_STR_BUFFSIZE\t(10000)\r\n\r\n/*!\r\n* \\class CKLBCompositeAsset\r\n* \\brief Composite Asset Class\r\n* \r\n* CKLBCompositeAsset is an asset defining a \"Form\". \r\n* A Form is basically a tree of visual tasks and components.\r\n* It allows to create a scene formed with tasks and UI objects without having to \r\n* heavily rely on scripting. \r\n* Instead, a loader performs object creation and property setup.\r\n*/\r\nclass CKLBCompositeAsset : public CKLBAsset {\r\n\tfriend class CKLBCompositeAssetPlugin;\r\n\tfriend class CKLBInnerDef;\r\n\tfriend class CKLBAnimInfo;\r\npublic:\r\n\tCKLBCompositeAsset\t();\r\n\t~CKLBCompositeAsset\t();\r\n\r\n\tvoid\t\t\t\tsetGroupID(u16 groupID)\t\r\n\t\t\t\t\t\t\t\t\t\t\t{\tm_groupID = groupID;\t}\r\n\tvirtual u32\t\t\tgetClassID()\t\t{ return CLS_ASSETCOMPOSITE; }\r\n\tvirtual CKLBNode*\tcreateSubTree(u32 priorityBase = 0);\r\n\tCKLBNode*\t\t\tcreateSubTree(CKLBUITask* pParentTask, u32 priorityBase = 0); \r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t\t{ return ASSET_COMPOSITE; }\r\n\r\n\tvoid setRecord(IDataSource* source, IDataRecord record);\r\n\r\n\tvoid* parserCtx;\r\n\r\n\tinline s16 get_width() const { return m_width; }\r\n\tinline s16 get_height() const { return m_height; }\r\n\r\n\tenum FIELD_ENUM {\r\n\t\tX_FIELD,\r\n\t\tY_FIELD,\r\n\t\tSX_FIELD,\r\n\t\tSY_FIELD,\r\n\t\tSW_FIELD,\r\n\t\tSH_FIELD,\r\n\t\tLAYOUT_INFO_FIELD,\r\n\t\tLW_FIELD,\r\n\t\tLH_FIELD,\r\n\t\tCLASS_FIELD,\r\n\t\tON_CLICK,\r\n\t\tASSET_FIELD,\r\n\t\tASSET_DISABLED_FIELD,\r\n\t\tASSET_FOCUS_FIELD,\r\n\t\tASSET_PUSH_FIELD,\r\n\t\tASSET_4,\r\n\t\tASSET_5,\r\n\t\tASSET_6,\r\n\t\tASSET_7,\r\n\t\tASSET_8,\r\n\t\tASSET_9,\r\n\t\tSUB_FIELD,\r\n\t\tPRIORITY_FIELD,\r\n\t\tRADIO_FIELD,\r\n\t\tNAME_FIELD,\r\n\t\tTEXT_FIELD,\r\n\t\tID,\r\n\t\tCLIPX,\r\n\t\tCLIPY,\r\n\t\tCLIPW,\r\n\t\tCLIPH,\r\n\t\tCLIPSTART,\r\n\t\tCLIPEND,\r\n\t\tFONT_SIZE_FIELD,\r\n\t\tFONT_NAME_FIELD,\r\n\t\tCOLOR_FIELD,\r\n\t\tWIDTH_FIELD,\r\n\t\tHEIGHT_FIELD,\r\n\t\tANIM_TYPE,\t\t// Str\r\n\t\tANIM_EASING,\r\n\t\tANIM_LENGTH,\r\n\t\tANIM_SHIFT,\r\n\t\tANIM_FROMX,\r\n\t\tANIM_TOX,\r\n\t\tANIM_FROMY,\r\n\t\tANIM_TOY,\r\n\t\tANIM_FROMSCALE,\t// Float\r\n\t\tANIM_TOSCALE,\t// Float\r\n\t\tANIM_FROMALPHA,\r\n\t\tANIM_TOALPHA,\r\n\t\tANIM_FROMCOLOR,\r\n\t\tANIM_TOCOLOR,\r\n\t\tSTATES_FIELD,\r\n\t\tXSCALE_FIELD,\r\n\t\tYSCALE_FIELD,\r\n\t\tROTATION_FIELD,\r\n\t\tANIM_LOOP,\r\n\t\tANIM_PINGPONG,\r\n\t\tANIM_DATA,\r\n\t\tANIM_FROMSCALE_X,\t// Float\r\n\t\tANIM_TOSCALE_X,\t\t// Float\r\n\t\tANIM_FROMSCALE_Y,\t// Float\r\n\t\tANIM_TOSCALE_Y,\t\t// Float\r\n\t\tANIM_FROM_ROTATION,\r\n\t\tANIM_TO_ROTATION,\r\n\t\tVALUE_FIELD,\r\n\t\tCALLBACK_FIELD,\r\n\t\tORIENTATION_FIELD,\r\n\t\tALIGN_FIELD,\r\n\t\tASSET_0_FIELD,\r\n\t\tASSET_1_FIELD,\r\n\t\tPRIORITY_OFFSET_FIELD,\r\n\t\tSTART_PIX_FIELD,\r\n\t\tEND_PIX_FIELD,\r\n\t\tANIM_TIME_FIELD,\r\n\t\tDRAG_ALPHA_FIELD,\r\n\t\tCENTER_X_FIELD,\r\n\t\tCENTER_Y_FIELD,\r\n\t\tFLAG_0_FIELD,\r\n\t\tFLAG_1_FIELD,\r\n\t\tINT_0_FIELD,\r\n\t\tINT_1_FIELD,\r\n\t\tINT_2_FIELD,\r\n\t\tINT_3_FIELD,\r\n\t\tINT_4_FIELD,\r\n\t\tINT_5_FIELD,\r\n\t\tURL_FIELD,\r\n\t\tALLOW_NAVIGATION_FIELD,\r\n\t\tPRIO_OFFSET_FIELD,\r\n\t\tCENTERX_FIELD,\r\n\t\tCENTERY_FIELD,\r\n\t\tBASEINVISIBLE_FIELD,\r\n\t\tSTEPX_FIELD,\r\n\t\tSTEPY_FIELD,\r\n\t\tNUMBERCOUNT_FIELD,\r\n\t\tFILLZERO_FIELD,\r\n\t\tANIMATE_FIELD,\r\n\t\tSOUNDUP_FIELD,\r\n\t\tSOUNDDOWN_FIELD,\r\n\t\tENABLE_FIELD,\r\n\t\tSTARTANGLE_FIELD,\r\n\t\tENDANGLE_FIELD,\r\n\t\tMINVALUE,\r\n\t\tMAXVALUE,\r\n\t\tMINSLIDERSIZE,\r\n\t\tSLIDERSIZE,\r\n\t\tSELECTCOLOR,\r\n\t\tMAXVERTEX,\r\n\t\tMAXINDEX,\r\n\t\tSPLINE_MASK,\r\n\t\tSPLINE_COUNT,\r\n\t\tSPLINE_ARRAY,\r\n\t\tSPLINE_LENGTH,\r\n\t\tGENERIC_FIELD,\r\n\t\tISPASSWORD_FIELD,\r\n\t\tVARCLIP_FIELD,\r\n\t\tCOUNTCLIP_FIELD,\r\n\t\tPLACEHOLDER_FIELD,\r\n\t\tVISIBLE_FIELD,\r\n\t\tMAXLENGTH,\r\n\t\tCHARTYPE,\r\n\t\tVOL_AUDIO_UP,\r\n\t\tVOL_AUDIO_DOWN,\r\n\t};\r\nprivate:\r\n\tbool init();\r\n\tbool createSubTreeRecursive(u16 groupID, CKLBUITask* pParentTask, CKLBNode* parent, CKLBInnerDef* parentTemplate, u32 priorityOffset);\r\n\r\n\tvoid setupNode(CKLBInnerDef* templateDef, CKLBNode* node);\r\n\tvoid setupTask(CKLBInnerDef* templateDef, CKLBUITask* tsk);\r\n\r\n\tstruct STRINGENTRY {\r\n\t\tSTRINGENTRY();\r\n\t\t~STRINGENTRY();\r\n\r\n\t\tSTRINGENTRY*\t\tnext;\r\n\t\tCKLBAsset*\t\t\tassetCache;\r\n\t\tchar*\t\t\t\tstring;\r\n\t};\r\n\r\n\tSTRINGENTRY*\tm_allocatedString;\r\n\r\n\tu16\t\t\tm_groupID;\r\n\t//\r\n\t// Parser Stuff.\r\n\t//\r\n\tu16\t\t\tm_parserField;\r\n\tchar*\t\tallocateString(const unsigned char* string, u32 strLen, bool* err);\r\n\t\r\n\tSTRINGENTRY* registerString(const char* string, u32 strLen, bool* err);\r\n\r\nprivate:\r\n\t// UI and composite with 32 levels are good enough.\r\n\t#define MAX_STACK_DEPTH\t\t\t\t(32)\r\n\tfloat*\t\t\tm_currArraySpline;\r\n\tIDataSource*\tm_pSource;\r\n\tIDataRecord\t\tm_record;\r\n\tCKLBInnerDef*\tm_pCurrInnerDef;\r\n\tCKLBAnimInfo*\tm_pCurrAnim;\r\n\tCKLBInnerDef*\tm_pParent;\r\n\tCKLBInnerDef*\tm_root;\r\n\tCKLBNode*\t\tm_rootParent;\r\n\tCKLBInnerDef*\tm_parentStack\t[MAX_STACK_DEPTH];\r\n\tu32\t\t\t\tm_basePriority;\r\n\ts16\t\t\t\tm_width;\r\n\ts16\t\t\t\tm_height;\r\n\tu16\t\t\t\tm_parent;\r\n\tu8\t\t\t\tm_recCount;\r\n\tu8\t\t\t\tmode;\r\n\tbool\t\t\tm_bTreeMode;\r\n\tbool\t\t\tm_bLowRes;\r\n\r\n\t//\r\n\t// Parser Call back.\r\n\t//\r\n\tint readStartMap\t(unsigned int size);\r\n\tint readNull\t\t();\r\n\tint readBoolean\t\t(int boolean);\r\n\tint readInt\t\t\t(long long integerVal);\r\n\tint readDouble\t\t(double doubleVal);\r\n\tint readString\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readMapKey\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readEndMap\t\t();\r\n\tint readStartArray\t(unsigned int size);\r\n\tint readEndArray\t();\r\n\r\n\tstatic int read_start_map\t(void * ctx, unsigned int size);\r\n\tstatic int read_null\t\t(void * ctx);\r\n\tstatic int read_boolean\t\t(void * ctx, int boolean);\r\n\tstatic int read_int\t\t\t(void * ctx, long long integerVal);\r\n\tstatic int read_double\t\t(void * ctx, double doubleVal);\r\n\tstatic int read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_end_map\t\t(void * ctx);\r\n\tstatic int read_start_array\t(void * ctx, unsigned int size);\r\n\tstatic int read_end_array\t(void * ctx);\r\n\r\nprivate:\r\n\t//\r\n\t// Buffer for asset string name during loading.\r\n\t//\r\n\r\n\tvoid\t\t\tresetTmpBuff\t();\r\n\tconst char*\t\taddAssetPrefix\t(const char* prefixLessAsset);\r\n\tconst char*\t\tformatI\t\t\t(s32 i);\r\n\tconst char*\t\tformatB\t\t\t(bool i);\r\n\tconst char*\t\tformatF\t\t\t(float f);\r\n\tconst char*\t\taddString\t\t(const char* source, u32 len);\r\n\tconst char*\t\tfilterDB\t\t(const char* input, bool* filtered = NULL);\r\n\tfloat\t\t\tfilterDBFloat\t(CKLBCompositeAsset::STRINGENTRY* input, float original);\r\n\ts32\t\t\t\tfilterDBInt\t\t(CKLBCompositeAsset::STRINGENTRY* input, s32 original);\r\n\r\n\tstatic char\t\ttmpBuff[TMP_COMPOSITE_ASSET_STR_BUFFSIZE];\r\n\tstatic char*\tptrBuff;\r\n};\r\n\r\nclass CKLBCompositeAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tCKLBCompositeAssetPlugin();\r\n\t~CKLBCompositeAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID()\t\t\t\t{ return CHUNK_TAG('C','O','M','P'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader()\t\t\t\t{ return 'P';\t\t}\r\n\tvirtual const char*\t\t\tfileExtension()\t\t\t\t{ return \".json\"; \t}\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize);\r\n};\r\n\r\n//\r\n// Class holding tree definition.\r\n//\r\n\r\n#define MAX_HANDLER\t\t\t(2)\r\n#define MAX_ASSETS\t\t\t(10)\r\n\r\nclass CKLBAnimInfo;\r\nclass CKLBPropertyBag;\r\n\r\nclass CKLBInnerDefManager {\r\npublic:\r\n\tstatic bool initManager(int size);\r\n\tstatic void releaseManager();\r\n};\r\n\r\nclass CKLBInnerDef {\r\npublic:\r\n\tCKLBInnerDef();\r\n\t~CKLBInnerDef();\r\n\t\r\n\tstatic void* operator new\t\t(size_t size); \r\n\tstatic void  operator delete\t(void *p);\r\n\r\n\tCKLBAnimInfo*\tfindAnimation(const char* animName);\r\n\r\n\tCKLBInnerDef*\tnext;\r\n\tCKLBInnerDef*\tsub;\r\n\tCKLBAnimInfo*\tanim;\r\n\tCKLBPropertyBag*\tpropertyBag;\r\n\r\n\tfloat x;\r\n\tfloat y;\r\n\tfloat xscale;\r\n\tfloat yscale;\r\n\tfloat rotation;\r\n\t\r\n\tu32\tlayoutInfo;\r\n\tu32 priority;\r\n\ts32 value;\r\n\ts32\tradioID;\r\n\t\r\n\tCKLBCompositeAsset::STRINGENTRY*\tfontName;\r\n\tu32\tcolor;\r\n\r\n\tCKLBCompositeAsset::STRINGENTRY*\thandler\t[MAX_HANDLER];\r\n\tCKLBCompositeAsset::STRINGENTRY*\tassets\t[MAX_ASSETS];\r\n\r\n\tCKLBCompositeAsset::STRINGENTRY*\tname;\r\n\tCKLBCompositeAsset::STRINGENTRY*\ttext;\r\n\tCKLBCompositeAsset::STRINGENTRY*\tplaceholder;\r\n\tu32 priorityClipStart;\r\n\tu32 priorityClipEnd;\r\n\tu32 id;\r\n\r\n\tfloat*\tspline;\r\n\tCKLBCompositeAsset::STRINGENTRY*\tdbField[4];\r\n\tu32\tvariable[10];\r\n\r\n\ts16\tlw;\r\n\ts16\tlh;\r\n\tu16\tclassID;\r\n\ts16\tsx;\r\n\ts16\tsy;\r\n\ts16\tsh;\r\n\ts16\tsw;\r\n\tu16 fontSize;\r\n\ts16 clipx;\r\n\ts16 clipy;\r\n\ts16 clipw;\r\n\ts16 cliph;\r\n\ts16\twidth;\r\n\ts16 height;\r\n\tu16\tsplineMask;\r\n\tu16\tsplineCount;\r\n\tu16\tsplineLength;\r\n\tu8\tsplineVectorSize;\r\n\tu8\tvolAudioUp;\r\n\tu8\tvolAudioDown;\r\n\r\n\tu8\tflag[4];\r\n\tbool\tvisible;\r\n};\r\n\r\nclass CKLBAnimInfo {\r\npublic:\r\n\tCKLBAnimInfo();\r\n\t~CKLBAnimInfo();\r\n\r\n\tCKLBAnimInfo*\tm_next;\r\n\ts32*\tdata;\r\n\r\n\tCKLBCompositeAsset::STRINGENTRY*\tmode;\r\n\r\n\tfloat\tfromScaleX;\r\n\tfloat\ttoScaleX;\r\n\tfloat\tfromScaleY;\r\n\tfloat\ttoScaleY;\r\n\tfloat\tfromRotation;\r\n\tfloat\ttoRotation;\r\n\r\n\tu16\t\tdataSize;\r\n\tu16\t\tcurrSize;\r\n\r\n\tu16\t\tlength;\r\n\ts16\t\ttimeShift;\r\n\r\n\ts16\t\tfromX;\r\n\ts16\t\ttoX;\r\n\r\n\ts16\t\tfromY;\r\n\ts16\t\ttoY;\r\n\r\n\r\n\tu8\t\tfromAlpha;\r\n\tu8\t\ttoAlpha;\r\n\r\n\tu8\t\tfromR;\r\n\tu8\t\ttoR;\r\n\r\n\tu8\t\tfromG;\r\n\tu8\t\ttoG;\r\n\r\n\tu8\t\tfromB;\r\n\tu8\t\ttoB;\r\n\r\n\tu8\t\tspline;\r\n\tu8\t\tmodeID;\r\n\r\n\tu8\t\tloop;\r\n\tu8\t\tpingpong;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Assets/NodeAnimationAsset.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"NodeAnimationAsset.h\"\r\n\r\nCKLBNodeAnimationAsset::CKLBNodeAnimationAsset()\r\n:CKLBAsset\t\t()\r\n{\r\n\t// Nothing to do.\r\n}\r\n\r\nCKLBNodeAnimationAsset::~CKLBNodeAnimationAsset() {\r\n\t// Nothing to do.\r\n}\r\n\r\nCKLBNode* CKLBNodeAnimationAsset::createSubTree(u32 /*priority*/) {\r\n\tCKLBSplineNode* pNode = KLBNEW(CKLBSplineNode);\r\n\tif (pNode) {\r\n\t\tpNode->setAnimation(this->m_length,\r\n\t\t\t\t\t\t\tthis->m_timeShift,\r\n\t\t\t\t\t\t\tthis->m_type ? this->m_type : 1,\r\n\t\t\t\t\t\t\tNULL,\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\tthis->m_mask,\r\n\t\t\t\t\t\t\tthis->m_param);\r\n\t}\r\n\treturn pNode;\r\n}\r\n\r\nKLBBlendAnimationAssetPlugin::KLBBlendAnimationAssetPlugin() {\r\n\t// Do nothing.\r\n}\r\n\r\nKLBBlendAnimationAssetPlugin::~KLBBlendAnimationAssetPlugin() {\r\n\t// Do nothing.\r\n}\r\n\r\nCKLBNodeAnimationAsset* CKLBNodeAnimationAsset::load(u8* stream, u32 /*streamSize*/) {\r\n\tm_type\t\t= (stream[0]<<8) + stream[1];\r\n\tm_length\t= (stream[2]<<24) | (stream[3] << 16) | (stream[4] << 8) | (stream[5]);\r\n\tm_timeShift\t= (stream[6]<<24) | (stream[7] << 16) | (stream[8] << 8) | (stream[9]);\r\n\tstream += 10;\r\n\tm_mask\t\t= (stream[0]<<24) | (stream[1] << 16) | (stream[2] << 8) | (stream[3]);\r\n\tstream += 4;\r\n\tint count = *stream++;\r\n\tfor (int n = 0; n<count; n++) {\r\n\t\t// 16.16 fixed -> float\r\n\t\tm_param[n] = ((stream[0]<<24) | (stream[1] << 16) | (stream[2] << 8) | (stream[3])) / 65536.0f;\r\n\t\tstream += 4;\r\n\t}\r\n\treturn this;\r\n}\r\n\r\nCKLBAbstractAsset* KLBBlendAnimationAssetPlugin::loadAsset(u8* stream, u32 streamSize) {\r\n\tCKLBNodeAnimationAsset* pNewAsset = KLBNEW(CKLBNodeAnimationAsset);\r\n\tif (pNewAsset) {\r\n\t\tif (pNewAsset->load(stream, streamSize)) {\r\n\t\t\t// OK\r\n\t\t\treturn pNewAsset;\r\n\t\t}\r\n\t\tKLBDELETE(pNewAsset); // Fail\r\n\t}\r\n\treturn NULL;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Assets/NodeAnimationAsset.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __SPLINEANIM_ASSET__\r\n#define __SPLINEANIM_ASSET__\r\n\r\n#include \"CKLBSplineNode.h\"\r\nclass KLBBlendAnimationAssetPlugin;\r\n\r\nclass CKLBNodeAnimationAsset : public CKLBAsset {\r\n\tfriend class CKLBAnimationNode;\r\n\tfriend class KLBBlendAnimationAssetPlugin;\r\npublic:\r\n\tCKLBNodeAnimationAsset();\r\n\t~CKLBNodeAnimationAsset();\r\n\r\n\tvirtual CKLBNode*\tcreateSubTree\t(u32 priority = 0);\r\n\tvirtual u32\t\t\tgetClassID\t\t()\t\t{ return CLS_ASSETNODEANIM;\t}\r\n\tvirtual\tASSET_TYPE\tgetAssetType\t()\t\t{ return ASSET_NODEANIM;\t}\r\nprotected:\r\n\tCKLBNodeAnimationAsset* load(u8* stream, u32 streamSize);\r\n\r\n\ts32\t\t\t\t\tm_length;\r\n\ts32\t\t\t\t\tm_timeShift;\r\n\tu16\t\t\t\t\tm_type;\r\n\tu32\t\t\t\t\tm_mask;\r\n\tfloat\t\t\t\tm_param[16];\r\n};\r\n\r\n/*!\r\n* \\class KLBBlendAnimationAssetPlugin\r\n* \\brief Blend Animation Asset Plugin\r\n* \r\n* KLBBlendAnimationAssetPlugin is in charge of loading CKLBNodeAnimationAsset.\r\n*/\r\nclass KLBBlendAnimationAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBBlendAnimationAssetPlugin();\r\n\t~KLBBlendAnimationAssetPlugin();\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID\t\t()\t\t\t{ return CHUNK_TAG('A','N','I','M');\t}\r\n\tvirtual\tu8\t\t\t\t\tcharHeader\t\t()\t\t\t{ return 'a';\t\t\t\t\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension\t()\t\t\t{ return \".anim\";\t\t\t\t\t\t}\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset\t\t(u8* stream, u32 streamSize);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Assets/TextureManagement.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"TextureManagement.h\"\r\n#include \"RenderingFramework.h\"\r\n#include \"mem.h\"\r\n#include \"zlib.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n\r\n/*\r\n * Here is the header of the ETC1 decoder part taken out from the \r\n * rg_etc1 library, we took only the decoder part out.\r\n *\r\n * The original project code can be found at :\r\n * http://code.google.com/p/rg-etc1/\r\n * The implementation and license detail is at the end of the file.\r\n *\r\n// Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com>\r\n// Please see ZLIB license at the end of this file.\r\n */\r\n\r\nnamespace rg_etc1\r\n{\r\n   // Unpacks an 8-byte ETC1 compressed block to a block of 4x4 32bpp RGBA pixels.\r\n   // Returns false if the block is invalid. Invalid blocks will still be unpacked with clamping.\r\n   // This function is thread safe, and does not dynamically allocate any memory.\r\n   // If preserve_alpha is true, the alpha channel of the destination pixels will not be overwritten. Otherwise, alpha will be set to 255.\r\n   bool unpack_etc1_block(const void *pETC1_block, unsigned int* pDst_pixels_rgba, bool preserve_alpha = false);\r\n} // namespace rg_etc1\r\n\r\nu32 gTextureAllocSW = 0;\r\nu32 gTextureAllocHW = 0;\r\n\r\n// Prototypes\r\nvoid processImage8888(u32 /*pixelCount*/, u32 lineWidth, u32 height, u8* buffer);\r\nvoid processImage565(u32 pixelCount, u32 lineWidth, u32 height, u8* buffer);\r\nvoid processImage4444(u32 pixelCount, u32 lineWidth, u32 height, u8* buffer);\r\nvoid processImage5551(u32 pixelCount, u32 lineWidth, u32 height, u8* buffer);\r\nCKLBAbstractAsset* createTexture(u32 orgWidthI, u32 orgHeightI, const char* name);\r\n\r\nCKLBTextureAsset::CKLBTextureAsset()\r\n: CKLBAbstractAsset ()\r\n, m_indexBufferTotal(NULL)\r\n, m_floatBufferTotal(NULL)\r\n, m_pTexture        (NULL)\r\n, m_pTextureUsage   (NULL)\r\n, m_pImages         (NULL)\r\n, m_softTexture     (NULL)\r\n, m_imageCount      (0)\r\n, m_bytePerPix\t\t(0)\r\n, m_width\t\t\t(0)\r\n, m_height\t\t\t(0)\r\n{\r\n}\r\n\r\nCKLBTextureAsset::~CKLBTextureAsset()\r\n{\r\n\tif (m_pImages) { \r\n\t\tfor (u32 n = 0; n < m_imageCount; n++) {\r\n\t\t\tif (m_pImages[n]) {\r\n\t\t\t\tKLBDELETE(m_pImages[n]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(m_pImages);\r\n\t}\r\n\r\n\tif (m_indexBufferTotal)\t{ KLBDELETE(m_indexBufferTotal); }\r\n\tif (m_floatBufferTotal)\t{ KLBDELETE(m_floatBufferTotal); }\r\n\r\n\tCKLBOGLWrapper& pMgr = CKLBOGLWrapper::getInstance();\r\n\r\n\tif (m_pTexture) {\r\n\t\tgTextureAllocHW -= this->m_width * this->m_height * m_bytePerPix;\r\n\t\tif (m_pTextureUsage) {\r\n\t\t\tm_pTexture->releaseUsage\t(m_pTextureUsage);\r\n\t\t}\r\n\t\tpMgr.releaseTexture\t\t(m_pTexture);\r\n\t\tm_pTexture = NULL;\r\n\t}\r\n\r\n\tif (m_softTexture) {\r\n\t\tKLBDELETEA(m_softTexture);\r\n\t\tgTextureAllocSW -= this->m_width * this->m_height * 4;\r\n\t\tm_softTexture = NULL;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBTextureAsset::unloadRessource() {\r\n\tif (m_pTexture) {\r\n\t\tm_pTexture->makeEmptyShell();\r\n\t}\r\n\r\n\tgTextureAllocHW -= this->m_width * this->m_height * m_bytePerPix;\r\n\r\n\t// Release software texture.\r\n\tif (m_softTexture) {\r\n\t\tKLBDELETEA(m_softTexture);\r\n\t\tgTextureAllocSW -= this->m_width * this->m_height * 4;\r\n\t\tm_softTexture = NULL;\r\n\t}\r\n}\r\n\r\nCKLBImageAsset* \r\nCKLBTextureAsset::getImage(const char* fileName) \r\n{\r\n\t// TODO OPTIMIZE : binary search instead of stupid search.\r\n\t// Tool will garantee that image are ordered correctly.\r\n\tif (fileName) {\r\n\t\tfor (u32 n = 0; n < m_imageCount; n++) {\r\n\t\t\tif (strcmp(fileName,m_pImages[n]->getName()) == 0) {\r\n\t\t\t\treturn m_pImages[n];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid \r\nCKLBTextureAsset::onRegisterSubAsset() \r\n{ \r\n\t//\r\n\t// Register all sub images as asset search.\r\n\t//\r\n\tCKLBAssetManager& pAMgr = CKLBAssetManager::getInstance();\r\n\tfor (u32 n = 0; n < m_imageCount; n++) {\r\n\t\tpAMgr.addSearchSubEntry(this, m_pImages[n]->getName());\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBAssetManager::dump() \r\n{\r\n\tif (m_assetRecord) {\r\n\t\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\r\n\t\tint totalSize = 0;\r\n\t\tfor (u32 n = 0; n < this->m_maxAssetEntry; n++) {\r\n\t\t\t\r\n\t\t\tif (!m_assetRecord[n].m_isFree) {\r\n\t\t\t\tCKLBAbstractAsset* pAsset = m_assetRecord[n].m_pAsset;\r\n\r\n\t\t\t\t// Display self name\r\n\t\t\t\tfprintf(pFile, \"[%4i] %s\",n, pAsset->getName());\r\n\t\t\t\t\r\n\t\t\t\t// display type\r\n\t\t\t\tswitch (pAsset->getClassID()) {\r\n\t\t\t\tcase CLS_ASSETBASE:\r\n\t\t\t\t\tfprintf(pFile, \" Base Asset?\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETTEXTURE:\r\n\t\t\t\t\tfprintf(pFile, \" Texture Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETIMAGE:\r\n\t\t\t\t\tfprintf(pFile, \" Image Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETAUDIO:\r\n\t\t\t\t\tfprintf(pFile, \" Audio Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETFLASH:\r\n\t\t\t\t\tfprintf(pFile, \" Flash Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETANIMSPLINE:\r\n\t\t\t\t\tfprintf(pFile, \" Spline Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETMAP:\r\n\t\t\t\t\tfprintf(pFile, \" Map Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETCELLANIM:\r\n\t\t\t\t\tfprintf(pFile, \" Cell Anim Asset\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETCOMPOSITE:\r\n\t\t\t\t\tfprintf(pFile, \" UI Form\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CLS_ASSETNODEANIM:\r\n\t\t\t\t\tfprintf(pFile, \" Node Anim\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tfprintf(pFile, \" Unknown\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pAsset->getClassID() == CLS_ASSETTEXTURE) {\r\n\t\t\t\t\tCKLBTextureAsset* p = (CKLBTextureAsset*)pAsset;\r\n\r\n\t\t\t\t\tint size = (p->m_bytePerPix * p->m_width * p->m_height) >> 10;\r\n\t\t\t\t\ttotalSize += size;\r\n\t\t\t\t\tfprintf(pFile, \" @%p W:%4i H:%4i MEM:%4iKB\\n\",pAsset, p->m_width, p->m_height, size);\r\n\t\t\t\t\tfor (int m = 0; m < p->m_imageCount; m++) {\r\n\t\t\t\t\t\tfprintf(pFile, \"\\t%s\\n\", p->m_pImages[m]->getName());\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfprintf(pFile, \" @%p\\n\",pAsset);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfprintf(pFile, \"TOTAL TEXTURE SIZE : %08i KB\\n\", totalSize);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBTextureAsset::onUnregisterSubAsset() \r\n{\r\n\t//\r\n\t// Register all sub images as asset search.\r\n\t//\r\n\tCKLBAssetManager& pAMgr = CKLBAssetManager::getInstance();\r\n\tfor (u32 n = 0; n < m_imageCount; n++) {\r\n\t\tpAMgr.removeSearchEntry(m_pImages[n]->getName());\r\n\t}\r\n}\r\n\r\n/* NO DICO\r\nbool CKLBTextureAsset::include(const char* name) {\r\n\tif (!CKLBAbstractAsset::include(name)) {\r\n\t\treturn (getImage(name) != NULL);\r\n\t}\r\n\treturn true;\r\n}*/\r\n\r\nCKLBImageAsset::CKLBImageAsset()\r\n: CKLBAsset         ()\r\n, m_pUVCoord        (NULL)\r\n, m_pXYCoord        (NULL)\r\n, m_pIndex          (NULL)\r\n, m_pTextureAsset   (NULL)\r\n, m_subIndex        (-1)\r\n, m_subTiles        (NULL)\r\n, m_nextSubTile     (NULL)\r\n, m_attribList      (NULL)\r\n, m_attribCount     (0)\r\n, m_usageType       (0)\r\n, m_topLeftImage    (NULL)\r\n, m_renderOffset    (0)\r\n, m_bAllocatedOutsideTexture(false)\r\n{\r\n}\r\n\r\nCKLBImageAsset::~CKLBImageAsset() \r\n{\r\n\tif (m_subTiles) {\r\n\t\tCKLBImageAsset* pImgParse = m_subTiles;\r\n\t\twhile (pImgParse) {\r\n\t\t\tCKLBImageAsset* pImgParseNext = pImgParse->m_nextSubTile;\r\n\t\t\tKLBDELETE(pImgParse);\r\n\t\t\tpImgParse = pImgParseNext;\r\n\t\t}\r\n\t}\r\n\r\n\tif (m_attribCount) {\r\n\t\tfor (int n = 0; n < m_attribCount;n++) {\r\n\t\t\tif (m_attribList[n].type == ASSET_ATTRIB::zATTRIB_STRING) {\r\n\t\t\t\tKLBDELETEA(m_attribList[n].v.str);\r\n\t\t\t}\r\n\t\t}\r\n\t\tm_attribCount = 0;\r\n\t}\r\n\r\n\tKLBDELETEA(m_attribList);\r\n\r\n\tKLBDELETE(m_topLeftImage);\r\n\r\n\tif (m_bAllocatedOutsideTexture) {\r\n\t\tKLBDELETEA(m_pXYCoord);\r\n\t\t// Use the same array with offset from beginning, NEVER DELETE\r\n\t\t// KLBDELETEA(m_pUVCoord);\r\n\t\t// KLBDELETEA(m_pIndex\t);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBImageAsset::getCenter(s32& cx, s32& cy) \r\n{\r\n\tcx = this->m_iCenterX;\r\n\tcy = this->m_iCenterY;\r\n}\r\n\r\nCKLBImageAsset* \r\nCKLBImageAsset::getAsTopLeftImage(s32 offX, s32 offY) \r\n{\r\n\tif ((offX == 0) && (offY == 0)) {\r\n\t\treturn this;\r\n\t} else {\r\n\t\tif (!this->m_topLeftImage) {\r\n\t\t\tm_topLeftImage\t= KLBNEW(CKLBImageAsset); // Fake for now.\r\n\t\t\tfloat* pArrayXY\t= KLBNEWA(float, this->getVertexCount()*2);\r\n\t\t\tif (m_topLeftImage && pArrayXY) {\r\n\t\t\t\t\r\n\t\t\t\t// Avoid double delete.\r\n\t\t\t\tm_topLeftImage->m_subTiles\t\t= NULL;\r\n\t\t\t\tm_topLeftImage->m_attribCount\t= 0;\r\n\t\t\t\tm_topLeftImage->m_attribList\t= NULL;\r\n\t\t\t\tm_topLeftImage->m_topLeftImage\t= NULL;\r\n\t\t\t\tm_topLeftImage->m_iCenterX\t\t= 0;\r\n\t\t\t\tm_topLeftImage->m_iCenterY\t\t= 0;\r\n\r\n\t\t\t\t// Setup new XY coordinate.\r\n\t\t\t\tm_topLeftImage->m_bAllocatedOutsideTexture = true;\r\n\t\t\t\tm_topLeftImage->m_pXYCoord\t\t= pArrayXY;\r\n\t\t\t\t\r\n\t\t\t\tm_topLeftImage->m_pUVCoord\t\t= this->m_pUVCoord;\r\n\t\t\t\tm_topLeftImage->m_pIndex\t\t= this->m_pIndex;\r\n\t\t\t\tm_topLeftImage->m_pTextureAsset\t= this->m_pTextureAsset;\r\n\t\t\t\tm_topLeftImage->m_subIndex\t\t= this->m_subIndex;\r\n\t\t\t\tm_topLeftImage->m_subTiles\t\t= this->m_subTiles;\r\n\t\t\t\tm_topLeftImage->m_nextSubTile\t= this->m_nextSubTile;\r\n\t\t\t\tm_topLeftImage->m_uiVertexCount\t= this->m_uiVertexCount;\r\n\t\t\t\tm_topLeftImage->m_uiIndexCount\t= this->m_uiIndexCount;\r\n\t\t\t\tm_topLeftImage->m_imageSize\t\t= this->m_imageSize;\t// Original image size\r\n\t\t\t\tm_topLeftImage->m_boundWidth\t= this->m_boundWidth;\r\n\t\t\t\tm_topLeftImage->m_boundHeight\t= this->m_boundHeight;\r\n\r\n\t\t\t\tfor (u32 n=0; n < this->getVertexCount()*2; n += 2) {\r\n\t\t\t\t\tpArrayXY[n  ]\t= this->m_pXYCoord[n  ] + offX;\r\n\t\t\t\t\tpArrayXY[n+1]\t= this->m_pXYCoord[n+1] + offY;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tKLBDELETE(m_topLeftImage);\r\n\t\t\t\tm_topLeftImage = NULL;\r\n\t\t\t\tKLBDELETEA(pArrayXY);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn m_topLeftImage;\r\n\t}\r\n}\r\n\r\nbool \r\nCKLBImageAsset::getAttribute(u8 attribID, s32& attribValue) \r\n{\r\n\tfor (int n = 0; n < m_attribCount; n++) {\r\n\t\tif (this->m_attribList[n].attribID == attribID) {\r\n\t\t\tif (this->m_attribList[n].type == ASSET_ATTRIB::zATTRIB_INT) {\r\n\t\t\t\tattribValue = m_attribList[n].v.value;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool \r\nCKLBImageAsset::getAttribute(u8 attribID, float& attribValue) \r\n{\r\n\tfor (int n = 0; n < m_attribCount; n++) {\r\n\t\tif (this->m_attribList[n].attribID == attribID) {\r\n\t\t\tif (this->m_attribList[n].type == ASSET_ATTRIB::zATTRIB_FLOAT) {\r\n\t\t\t\tattribValue = m_attribList[n].v.fvalue;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool \r\nCKLBImageAsset::getAttribute(u8 attribID, const char*& attribValue) \r\n{\r\n\tfor (int n = 0; n < m_attribCount; n++) {\r\n\t\tif (this->m_attribList[n].attribID == attribID) {\r\n\t\t\tif (this->m_attribList[n].type == ASSET_ATTRIB::zATTRIB_STRING) {\r\n\t\t\t\tattribValue = m_attribList[n].v.str;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBImageAsset::getXY(u32 vertexIndex, float* pX, float* pY) \r\n{\r\n\tklb_assert(pX && pY, \"null pointer\");\r\n\tklb_assert(vertexIndex < m_uiVertexCount , \"invalid index\");\r\n\tif (vertexIndex < m_uiVertexCount) {\r\n\t\tvertexIndex *= 2;\r\n\t\t*pX = m_pXYCoord[vertexIndex++];\r\n\t\t*pY = m_pXYCoord[vertexIndex  ];\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBImageAsset::getUV(u32 vertexIndex, float* pU, float* pV) \r\n{\r\n\tklb_assert(pU && pV, \"null pointer\");\r\n\tklb_assert(vertexIndex < m_uiVertexCount , \"invalid index\");\r\n\tif (vertexIndex < m_uiVertexCount) {\r\n\t\tvertexIndex *= 2;\r\n\t\t*pU = m_pUVCoord[vertexIndex++];\r\n\t\t*pV = m_pUVCoord[vertexIndex  ];\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBImageAsset::setSubImage(u32 width, u32 height, u32 offX, u32 offY) \r\n{\r\n\tthis->m_tileWidth\t= width;\r\n\tthis->m_tileHeight\t= height;\r\n\tthis->m_tileOffX\t= offX;\r\n\tthis->m_tileOffY\t= offY;\r\n\tthis->m_tileCount\t= this->m_imageSize.getWidth() / m_tileWidth;\r\n\tif (m_tileCount == 0) {\r\n\t\tm_tileCount = 1;\r\n\t}\r\n}\r\n\r\nCKLBImageAsset* \r\nCKLBImageAsset::findSub(u32 index) \r\n{\r\n\tCKLBImageAsset* pAsset = this->m_subTiles;\r\n\twhile (pAsset) {\r\n\t\tif (pAsset->m_subIndex == index) {\r\n\t\t\treturn pAsset;\r\n\t\t}\r\n\t\tpAsset = pAsset->m_nextSubTile;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid \r\nCKLBImageAsset::addSubImage(CKLBImageAsset* pImage) \r\n{\r\n\t// add to link list.\r\n\tpImage->m_nextSubTile = this->m_subTiles;\r\n\tthis->m_subTiles\t= pImage;\r\n}\r\n\r\nCKLBImageAsset*\tCKLBImageAsset::getSubImage(u32 index, CKLBImageAsset* pAsset) {\r\n\tif (m_uiSubTileCount != 1) {\r\n\t\tklb_assertAlways(\"TODO implement\");\r\n\t} else {\r\n\t\tif (m_uiIndexCount == 6 && m_uiVertexCount == 4) {\r\n\t\t\tbool doAlloc = (!pAsset);\r\n\t\t\tif (doAlloc) {\r\n\t\t\t\tpAsset = findSub(index); \r\n\t\t\t\tif (!pAsset) {\r\n\t\t\t\t\tpAsset = KLBNEW(CKLBImageAsset);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn pAsset;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tklb_assertAlways(\"FORBIDDEN FOR NOW\");\r\n\t\t\t\treturn NULL;\r\n\t\t\t}\r\n\r\n\t\t\tif (pAsset) {\r\n\t\t\t\tthis->addSubImage(pAsset);\r\n\t\t\t\t// pAsset->m_assetID\t\t= CKLBAssetManager::getInstance()->allocateAssetSlot(pAsset);\r\n\t\t\t\tpAsset->m_pTextureAsset\t= this->m_pTextureAsset;\r\n\t\t\t\tpAsset->m_pName\t\t\t= this->m_pName;\r\n\t\t\t\tpAsset->m_subIndex\t\t= index;\r\n\r\n\r\n\t\t\t\tpAsset->m_bAllocatedOutsideTexture\t= true;\r\n\r\n\t\t\t\tif (doAlloc) {\r\n\t\t\t\t\tpAsset->m_pXYCoord\t= KLBNEWA(float,(8*2) + 3);\r\n\t\t\t\t\tpAsset->m_pUVCoord\t= &pAsset->m_pXYCoord[8]; \r\n\t\t\t\t\tpAsset->m_pIndex\t= (u16*)(&pAsset->m_pUVCoord[8]);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pAsset->m_pXYCoord) {\r\n\t\t\t\t\tu32 tY = index / m_tileCount;\r\n\t\t\t\t\tu32 tX = index - (tY * m_tileCount);\r\n\t\t\t\t\tfloat fWidth\t= this->m_pXYCoord[2] - this->m_pXYCoord[0];\r\n\t\t\t\t\tfloat fHeight\t= this->m_pXYCoord[5] - this->m_pXYCoord[1];\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Index\r\n\t\t\t\t\t//\r\n\t\t\t\t\tpAsset->m_pIndex[0]\t= 0;\r\n\t\t\t\t\tpAsset->m_pIndex[1]\t= 1;\r\n\t\t\t\t\tpAsset->m_pIndex[2]\t= 3;\r\n\t\t\t\t\tpAsset->m_pIndex[3]\t= 1;\r\n\t\t\t\t\tpAsset->m_pIndex[4]\t= 2;\r\n\t\t\t\t\tpAsset->m_pIndex[5]\t= 3;\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Coordinate subtile.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tpAsset->m_pXYCoord[0] = (float)m_tileOffX;\r\n\t\t\t\t\tpAsset->m_pXYCoord[1] = (float)m_tileOffY;\r\n\r\n\t\t\t\t\tpAsset->m_pXYCoord[2] = (float)(m_tileOffX + m_tileWidth);\r\n\t\t\t\t\tpAsset->m_pXYCoord[3] = (float)m_tileOffY;\r\n\r\n\t\t\t\t\tpAsset->m_pXYCoord[4] = pAsset->m_pXYCoord[2];\r\n\t\t\t\t\tpAsset->m_pXYCoord[5] = (float)(m_tileOffY + m_tileHeight);\r\n\r\n\t\t\t\t\tpAsset->m_pXYCoord[6] = (float)m_tileOffX;\r\n\t\t\t\t\tpAsset->m_pXYCoord[7] = pAsset->m_pXYCoord[5];\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// UV SubTile\r\n\t\t\t\t\t//\r\n\t\t\t\t\tfloat UPixStep\t    = (this->m_pUVCoord[2] - this->m_pUVCoord[0]) / fWidth;\r\n\t\t\t\t\tfloat VPixStep\t    = (this->m_pUVCoord[5] - this->m_pUVCoord[1]) / fHeight;\r\n\t\t\t\t\tfloat UStep\t\t    = UPixStep * m_tileWidth ;\r\n\t\t\t\t\tfloat VStep\t\t    = VPixStep * m_tileHeight;\r\n\t\t\t\t\tfloat UStepOffset   = UStep * m_tileOffX;\r\n\t\t\t\t\tfloat VStepOffset   = VStep * m_tileOffY;\r\n\t\t\t\t\tfloat U0            = this->m_pUVCoord[0] + (UStep * tX) + UStepOffset;\r\n\t\t\t\t\tfloat V0            = this->m_pUVCoord[1] + (VStep * tY) + VStepOffset;\r\n\t\t\t\t\tfloat U1            = U0 + UStep;\r\n\t\t\t\t\tfloat V1            = V0 + VStep;\r\n\r\n\t\t\t\t\tpAsset->m_pUVCoord[0] = U0;\r\n\t\t\t\t\tpAsset->m_pUVCoord[1] = V0;\r\n\t\t\t\t\tpAsset->m_pUVCoord[2] = U1;\r\n\t\t\t\t\tpAsset->m_pUVCoord[3] = V0;\r\n\t\t\t\t\tpAsset->m_pUVCoord[4] = U1;\r\n\t\t\t\t\tpAsset->m_pUVCoord[5] = V1;\r\n\t\t\t\t\tpAsset->m_pUVCoord[6] = U0;\r\n\t\t\t\t\tpAsset->m_pUVCoord[7] = V1;\r\n\r\n\t\t\t\t\tpAsset->m_iCenterX = 0;\r\n\t\t\t\t\tpAsset->m_iCenterY = 0;\r\n\t\t\t\t\tpAsset->m_uiVertexCount\t= 4;\r\n\t\t\t\t\tpAsset->m_uiIndexCount  = 6;\r\n\r\n\t\t\t\t\tpAsset->m_imageSize.m_iTop\t\t= 0;\r\n\t\t\t\t\tpAsset->m_imageSize.m_iBottom\t= m_tileHeight;\r\n\t\t\t\t\tpAsset->m_imageSize.m_iLeft\t\t= 0;\r\n\t\t\t\t\tpAsset->m_imageSize.m_iRight\t= m_tileWidth;\r\n\t\t\t\t\tpAsset->m_boundWidth\t\t\t= m_tileWidth;\r\n\t\t\t\t\tpAsset->m_boundHeight\t\t\t= m_tileHeight;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Delete all sub systems too.\r\n\t\t\t\t\tKLBDELETE(pAsset);\r\n\t\t\t\t\tpAsset = NULL;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn pAsset;\r\n\t\t}\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nCKLBImageAsset* \r\nKLBTextureAssetPlugin::loadImage(u8* stream, u32 /*streamSize*/, CKLBImageAsset* pReload) \r\n{\r\n\t//\r\n\t// u8  Vertex Count\r\n\t// u8  Index  Count\r\n\t// u16\tcenter X\r\n\t// u16\tcenter Y\r\n\t//\r\n\t// Vertex Count\t--> Convert into UV and XY\r\n\t// u32 X\t\t\r\n\t// u32 Y\r\n\t// Index Count\r\n\t// u8  Index\r\n\tCKLBImageAsset* pNewAssetI = m_pReloadAsset ? pReload : KLBNEW(CKLBImageAsset);\r\n\tif (pNewAssetI) {\r\n\t\t// Str Length including zero and padding.\r\n\t\tu16 length = (stream[0] << 8) | stream[1];\r\n\t\tstream += 2;\r\n\t\r\n\t\t// Name\r\n\t\t// + [pad]\r\n\t\tif (!m_pReloadAsset)\r\n\t\tpNewAssetI->m_pName\t= pNewAssetI->allocateName(stream, length);\r\n\r\n\t\tif (!pNewAssetI->m_pName) {\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tstream += length;\r\n\r\n\t\tpNewAssetI->m_uiSubTileCount\t= (stream[0] << 8) | stream[1];\r\n\t\tstream += 2;\r\n\r\n\t\tbool is3dModel\t\t= false;\r\n\t\tbool loadUVIndex\t= true;\r\n\t\tbool compactUV\t\t= false;\r\n\t\tif (pNewAssetI->m_uiSubTileCount == 0xFFFE) {\r\n\t\t\tcompactUV = true;\r\n\t\t}\r\n\r\n\t\tu32 patchCoordinateModeFromAttribute = 0;\r\n\t\tif (pNewAssetI->m_uiSubTileCount == 0xFFFF) {\r\n\t\t\t// Extension with attribute.\r\n\r\n\t\t\t// Attribute count.\r\n\t\t\tu32 attribCount = (stream[0]<<8) | stream[1]; stream += 2;\r\n\t\t\tpNewAssetI->m_attribCount = attribCount;\r\n\t\t\t\r\n\t\t\tif (!m_pReloadAsset)\r\n\t\t\tpNewAssetI->m_attribList = KLBNEWA(ASSET_ATTRIB,attribCount);\r\n\r\n\t\t\tif (pNewAssetI->m_attribList) {\r\n\t\t\t\tASSET_ATTRIB* pAtt = pNewAssetI->m_attribList;\r\n\t\t\t\tfor (u32 n=0; n<attribCount; n++) {\r\n\t\t\t\t\tpAtt[n].type\t\t= ASSET_ATTRIB::zATTRIB_INT;\t// Default in case of error.\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (u32 n=0; n<attribCount; n++) {\r\n\t\t\t\t\t// Key ID + Type + Value\r\n\t\t\t\t\tu8 key\t= *stream++;\r\n\t\t\t\t\tu8 type = *stream++;\r\n\t\t\t\t\tpAtt[n].attribID\t= key;\r\n\t\t\t\t\tpAtt[n].type\t\t= type;\r\n\r\n\t\t\t\t\tif (key == ASSET_ATTRIB::zK0_RECT) {\r\n\t\t\t\t\t\t// Standard Rect\r\n\t\t\t\t\t\tpNewAssetI->m_usageType |= CKLBImageAsset::IS_STANDARD_RECT;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (key == ASSET_ATTRIB::zK1_SC_LEFT) {\r\n\t\t\t\t\t\t// Scroll Bar\r\n\t\t\t\t\t\tpNewAssetI->m_usageType |= CKLBImageAsset::IS_SCROLLBARTYPE;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (key == ASSET_ATTRIB::zK2_S9_LEFT) {\r\n\t\t\t\t\t\t// Slice 9\r\n\t\t\t\t\t\tpNewAssetI->m_usageType |= CKLBImageAsset::IS_SCALE9;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (key == ASSET_ATTRIB::z3DMODEL) {\r\n\t\t\t\t\t\tpNewAssetI->m_usageType |= CKLBImageAsset::IS_3DMODEL;\r\n\t\t\t\t\t\tis3dModel = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tswitch (type) {\r\n\t\t\t\t\tcase ASSET_ATTRIB::zATTRIB_INT:\r\n\t\t\t\t\tcase ASSET_ATTRIB::zATTRIB_FLOAT:\r\n\t\t\t\t\t\tpAtt[n].v.value\t= (stream[0]<<24) | (stream[1]<<16) | (stream[2]<<8) | (stream[3]);\r\n\t\t\t\t\t\tif (is3dModel) {\r\n\t\t\t\t\t\t\tloadUVIndex = (pAtt[n].v.value & 0x80000000) ? true : false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (key == ASSET_ATTRIB::zK4_STRETCH_OR_SCALE) {\r\n\t\t\t\t\t\t\tpatchCoordinateModeFromAttribute = pAtt[n].v.value;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tstream += 4;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase ASSET_ATTRIB::zATTRIB_STRING:\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tu8 argLen = (stream[0]<<8) | stream[1];\r\n\t\t\t\t\t\t\tstream += 2;\r\n\t\t\t\t\t\t\tif (argLen) {\r\n\t\t\t\t\t\t\t\tchar* p\t= KLBNEWA(char,argLen);\r\n\t\t\t\t\t\t\t\tif (p) {\r\n\t\t\t\t\t\t\t\t\tpAtt[n].v.str = p;\r\n\t\t\t\t\t\t\t\t\tmemcpy(p, stream, argLen);\r\n\t\t\t\t\t\t\t\t\tstream += argLen;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tklb_assertAlways(\"Memory alloc fail.\");\r\n\t\t\t\t\t\t\t\t\treturn NULL;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tpAtt[n].v.str\t= NULL;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tklb_assertAlways(\"Invalid Image Attribute Type\");\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (key == ASSET_ATTRIB::zK3_OFFSET) {\r\n\t\t\t\t\t\tpNewAssetI->m_renderOffset = pAtt[n].v.value;\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\treturn NULL;\r\n\t\t\t}\r\n\r\n\t\t\tpNewAssetI->m_uiSubTileCount = (stream[0] << 8) | stream[1];\r\n\t\t\tstream += 2;\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < pNewAssetI->m_uiSubTileCount; n++) {\r\n\t\t\tCKLBImageAsset* pNewAsset;\r\n\t\t\tif (pNewAssetI->m_uiSubTileCount == 1) {\r\n\t\t\t\tpNewAsset = pNewAssetI;\r\n\t\t\t} else {\r\n\t\t\t\tpNewAsset = KLBNEW(CKLBImageAsset);\r\n\t\t\t}\r\n\r\n\t\t\tif (!pNewAsset) {\r\n\t\t\t\treturn NULL;\r\n\t\t\t}\r\n\r\n\t\t\tif (is3dModel) {\r\n\t\t\t\tpNewAsset->m_uiVertexCount  = (stream[0] << 8) | stream[1]; stream += 2;\r\n\t\t\t\tpNewAsset->m_uiIndexCount\t= (stream[0] << 8) | stream[1]; stream += 2;\r\n\t\t\t} else {\r\n\t\t\t\tpNewAsset->m_uiVertexCount\t= *stream++;\r\n\t\t\t\tpNewAsset->m_uiIndexCount\t= *stream++;\r\n\t\t\t}\r\n\r\n\t\t\tpNewAsset->m_imageSize.m_iRight\t = (stream[0] << 8) | stream[1]; stream += 2;\r\n\t\t\tpNewAsset->m_imageSize.m_iBottom = (stream[0] << 8) | stream[1]; stream += 2;\r\n\r\n\t\t\t// Decide to use information from image info (tool) when standard rect AND borderless mode.\r\n\t\t\tu32 patchCoordinateMode = 0;\r\n\t\t\tif (pNewAssetI->m_usageType & CKLBImageAsset::IS_STANDARD_RECT) {\r\n\t\t\t\tif (CKLBDrawResource::getInstance().hasBorder() == false) {\r\n\t\t\t\t\tpatchCoordinateMode = patchCoordinateModeFromAttribute;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tpNewAsset->m_imageSize.m_iLeft\t= 0;\r\n\t\t\tpNewAsset->m_imageSize.m_iTop\t= 0;\r\n\r\n\t\t\tpNewAsset->m_iCenterX\t= (s16)((stream[0] << 8) | stream[1]); stream += 2;\r\n\t\t\tpNewAsset->m_iCenterY\t= (s16)((stream[0] << 8) | stream[1]); stream += 2;\r\n\r\n\t\t\tfloat cx = pNewAsset->m_iCenterX;\r\n\t\t\tfloat cy = pNewAsset->m_iCenterY;\r\n\r\n\t\t\tif (m_pUVBuffer && m_pXYBuffer && m_pIndexBuffer) {\r\n\t\t\t\tpNewAsset->m_pUVCoord\t= this->m_pUVBuffer;\r\n\t\t\t\tpNewAsset->m_pXYCoord\t= this->m_pXYBuffer;\r\n\t\t\t\tpNewAsset->m_pIndex\t\t= this->m_pIndexBuffer;\r\n\t\t\t} else {\r\n\t\t\t\t// find a way to get this->m_pTextureAsset if to implement.\r\n\t\t\t\tklb_assertAlways( \"stand alone loading not implemented : should create array and implement asset destructor.\");\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewAsset->m_pUVCoord\t&&\r\n\t\t\t\tpNewAsset->m_pXYCoord\t&&\r\n\t\t\t\tpNewAsset->m_pIndex\t \t&&\r\n\t\t\t\tthis->m_pTextureAsset) {\r\n\r\n\t\t\t\tpNewAsset->m_pTextureAsset\t= this->m_pTextureAsset;\t// For Rendering.\r\n\r\n\t\t\t\tfloat minX = 9999.0f;\r\n\t\t\t\tfloat minY = 9999.0f;\r\n\t\t\t\tfloat maxX = -9999.0f;\r\n\t\t\t\tfloat maxY = -9999.0f;\r\n\r\n\t\t\t\tint idxVert = 0;\r\n\t\t\t\tint stepVert;\r\n\t\t\t\tif (is3dModel) {\r\n\t\t\t\t\tstepVert = 3;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstepVert = 2;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int n=0; n < pNewAsset->m_uiVertexCount; n++) {\r\n\t\t\t\t\t// XY Coordinates in screen space.\r\n\t\t\t\t\tu32 val\t= (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\t\tfloat x = (val / 65536.0f) - cx;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[idxVert  ] = x;\r\n\t\t\t\t\tstream\t+= 4;\r\n\r\n\t\t\t\t\tval\t\t= (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\t\tfloat y = (val / 65536.0f) - cy;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[idxVert+1] = y;\r\n\t\t\t\t\tstream\t+= 4;\r\n\r\n\t\t\t\t\tif (is3dModel) {\r\n\t\t\t\t\t\tval\t\t= (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\t\t\tfloat z = (val / 65536.0f);\r\n\t\t\t\t\t\tpNewAsset->m_pXYCoord[idxVert+2] = z;\r\n\t\t\t\t\t\tstream\t+= 4;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (x < minX) { minX = x; }\r\n\t\t\t\t\t\tif (x > maxX) { maxX = x; }\r\n\r\n\t\t\t\t\t\tif (y < minY) { minY = y; }\r\n\t\t\t\t\t\tif (y > maxY) { maxY = y; }\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tidxVert\t+= stepVert;\r\n\r\n\t\t\t\t\tif (loadUVIndex) {\r\n\t\t\t\t\t\tif (compactUV) {\r\n\t\t\t\t\t\t\t// UV Coordinates in texture\r\n\t\t\t\t\t\t\tval\t\t= (stream[0] << 8) | (stream[1]);\r\n\t\t\t\t\t\t\tpNewAsset->m_pUVCoord[(n * 2)  ] = (val / 32768.0f);\r\n\t\t\t\t\t\t\tstream\t+= 2;\r\n\r\n\t\t\t\t\t\t\tval\t\t= (stream[0] << 8) | (stream[1]);\r\n\t\t\t\t\t\t\tpNewAsset->m_pUVCoord[(n * 2)+1] = (val / 32768.0f);\r\n\t\t\t\t\t\t\tstream\t+= 2;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// UV Coordinates in texture\r\n\t\t\t\t\t\t\tval\t\t= (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\t\t\t\tpNewAsset->m_pUVCoord[(n * 2)  ] = (val / 65536.0f);\r\n\t\t\t\t\t\t\tstream\t+= 4;\r\n\r\n\t\t\t\t\t\t\tval\t\t= (stream[0] << 24) | (stream[1] << 16) | (stream[2] << 8) | stream[3];\r\n\t\t\t\t\t\t\tpNewAsset->m_pUVCoord[(n * 2)+1] = (val / 65536.0f);\r\n\t\t\t\t\t\t\tstream\t+= 4;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (patchCoordinateMode == 1) {\r\n\t\t\t\t\tint deltaX = CKLBDrawResource::getInstance().ox();\r\n\t\t\t\t\tint deltaY = CKLBDrawResource::getInstance().oy();\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[0] -= deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[1] -= deltaY;\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[2] += deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[3] -= deltaY;\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[4] += deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[5] += deltaY;\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[6] -= deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[7] += deltaY;\r\n\t\t\t\t} else if (patchCoordinateMode == 2) {\r\n\t\t\t\t\tint deltaX = CKLBDrawResource::getInstance().ox();\r\n\t\t\t\t\tint deltaY = CKLBDrawResource::getInstance().oy();\r\n\t\t\t\t\tif (deltaX) {\r\n\t\t\t\t\t\tfloat purcX = deltaX / (float)CKLBDrawResource::getInstance().width();\r\n\t\t\t\t\t\tdeltaY = purcX * CKLBDrawResource::getInstance().height();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tfloat purcY = deltaY / (float)CKLBDrawResource::getInstance().height();\r\n\t\t\t\t\t\tdeltaX = purcY * CKLBDrawResource::getInstance().width();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[0] -= deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[1] -= deltaY;\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[2] += deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[3] -= deltaY;\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[4] += deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[5] += deltaY;\r\n\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[6] -= deltaX;\r\n\t\t\t\t\tpNewAsset->m_pXYCoord[7] += deltaY;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (loadUVIndex) {\r\n\t\t\t\t\tfor (int n = 0; n < pNewAsset->m_uiIndexCount; n++) {\r\n\t\t\t\t\t\tpNewAsset->m_pIndex[n] = *stream++;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis->m_pLastLoadedUV\t\t= pNewAsset->m_pUVCoord;\r\n\t\t\t\t\tthis->m_pLastLoadedIndex\t= pNewAsset->m_pIndex;\r\n\t\t\t\t\tthis->m_pUVBuffer\t\t\t+= (pNewAsset->m_uiVertexCount * 2);\r\n\t\t\t\t\tthis->m_pIndexBuffer\t\t+= pNewAsset->m_uiIndexCount;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis->m_pUVBuffer\t\t\t= this->m_pLastLoadedUV;\r\n\t\t\t\t\tthis->m_pIndexBuffer\t\t= this->m_pLastLoadedIndex;\r\n\t\t\t\t}\r\n\t\t\t\tthis->m_pXYBuffer\t\t\t+= (pNewAsset->m_uiVertexCount * stepVert);\r\n\r\n\t\t\t\tpNewAsset->m_boundWidth\t\t= maxX - minX;\r\n\t\t\t\tpNewAsset->m_boundHeight\t= maxY - minY;\r\n\t\t\t\treturn pNewAsset;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tklb_assertNull(0,\"allocation failure.\");\r\n\treturn NULL;\r\n}\r\n\r\n/**\r\n\tTrick function to allow sharing buffer for all images into texture\r\n\tand not using multiple allocation.\r\n */\r\nvoid \r\nKLBTextureAssetPlugin::setBuffers(CKLBTextureAsset*\tpTextureAsset, float* uvBuffer, float* xyBuffer, u16* indexBuffer) \r\n{\r\n\tm_pUVBuffer\t\t= uvBuffer;\r\n\tm_pXYBuffer\t\t= xyBuffer;\r\n\tm_pIndexBuffer\t= indexBuffer;\r\n\tm_pTextureAsset\t= pTextureAsset;\r\n}\r\n\r\n// ---------------------------------------------------------------------------------------------\r\n//   Texture.\r\n// ---------------------------------------------------------------------------------------------\r\n\r\nKLBTextureAssetPlugin::KLBTextureAssetPlugin()\r\n: IKLBAssetPlugin   ()\r\n, m_pUVBuffer       (NULL)\r\n, m_pXYBuffer       (NULL)\r\n, m_pIndexBuffer    (NULL)\r\n, m_pTextureAsset   (NULL)\r\n, m_loadHardware    (true)\r\n, m_loadSoftware    (false)\r\n, m_useQuarterTexture(false)\r\n{\r\n}\r\n\r\nKLBTextureAssetPlugin::~KLBTextureAssetPlugin() \r\n{\r\n}\r\n\r\nvoid\r\nKLBTextureAssetPlugin::setLoadingMode(E_TEXTURELOADINGMODE mode) \r\n{\r\n\tswitch (mode) {\r\n\tcase TEX_LOAD_GPU:\r\n\t\tm_loadHardware = true;\r\n\t\tm_loadSoftware = false;\r\n\t\tbreak;\r\n\tcase TEX_LOAD_CPU:\r\n\t\tm_loadHardware = false;\r\n\t\tm_loadSoftware = true;\r\n\t\tbreak;\r\n\tcase TEX_LOAD_GPUCPU:\r\n\t\tm_loadHardware = true;\r\n\t\tm_loadSoftware = true;\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nu8* \r\nKLBTextureAssetPlugin::createSoftTexture(s32 width, s32 height, u32 pixelFormat, u8 channelCount, void* data) \r\n{\r\n\tu8* buffer = KLBNEWA(u8, width * height * 4);\r\n\tu8* retBuf = buffer;\r\n\r\n\tif (buffer) {\r\n\t\t// Setup default alpha\r\n\t\tu8 alpha = 255;\r\n\r\n\t\tswitch (pixelFormat) {\r\n\t\tcase GL_UNSIGNED_SHORT_5_6_5:\r\n\t\t\t{\r\n\t\t\t\t// GL_RGB\r\n\t\t\t\tu16* src = (u16*)data;\r\n\t\t\t\tfor (int y = 0 ; y < height; y++) {\r\n\t\t\t\t\tfor (int x = 0 ; x < width ; x++) {\r\n\t\t\t\t\t\t// RGBA\r\n\t\t\t\t\t\tu8 tmp = (*src & 0xF800)>>8;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 5);\t// Full 5->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x07E0) >> 3;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 6);\t// Full 6->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x001F) << 3;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 5);\t// Full 5->8 Bit conv\r\n\t\t\t\t\t\t*buffer++ = alpha;\r\n\t\t\t\t\t\tsrc++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase GL_UNSIGNED_SHORT_5_5_5_1:\r\n\t\t\t{\r\n\t\t\t\tu16* src = (u16*)data;\r\n\t\t\t\tfor (int y = 0 ; y < height; y++) {\r\n\t\t\t\t\tfor (int x = 0 ; x < width ; x++) {\r\n\t\t\t\t\t\t// RGBA\r\n\t\t\t\t\t\tu8 tmp = (*src & 0xF800)>>8;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 5);\t// Full 5->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x07C0) >> 3;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 5);\t// Full 5->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x003E) << 2;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 5);\t// Full 5->8 Bit conv\r\n\t\t\t\t\t\t*buffer++ = ((s8)((*src & 1)<<7))>>7;\t// Full 1->8 Bit conv\r\n\t\t\t\t\t\tsrc++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase GL_UNSIGNED_SHORT_4_4_4_4:\r\n\t\t\t{\r\n\t\t\t\tu16* src = (u16*)data;\r\n\t\t\t\tfor (int y = 0 ; y < height; y++) {\r\n\t\t\t\t\tfor (int x = 0 ; x < width ; x++) {\r\n\t\t\t\t\t\t// RGBA\r\n\t\t\t\t\t\tu8 tmp = (*src & 0xF000)>>8;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 4);\t// Full 4->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x0F00) >> 4;\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 4);\t// Full 4->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x00F0);\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp >> 4);\t// Full 4->8 Bit conv\r\n\t\t\t\t\t\ttmp = (*src & 0x000F);\r\n\t\t\t\t\t\t*buffer++ = tmp | (tmp << 4);\t// Full 4->8 Bit conv\r\n\t\t\t\t\t\tsrc++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\t// Byte\r\n\t\t\tswitch (channelCount) {\r\n\t\t\tcase 1:\r\n\t\t\tcase 2:\r\n\t\t\t\tklb_assertAlways(\"Those texture mode are not supported\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\t{\r\n\t\t\t\t\tu8* src = (u8*)data;\r\n\t\t\t\t\tfor (int y = 0 ; y < height; y++) {\r\n\t\t\t\t\t\tfor (int x = 0 ; x < width ; x++) {\r\n\t\t\t\t\t\t\t*buffer++ = *src++;\r\n\t\t\t\t\t\t\t*buffer++ = *src++;\r\n\t\t\t\t\t\t\t*buffer++ = *src++;\r\n\t\t\t\t\t\t\t*buffer++ = 255;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\t{\r\n\t\t\t\t\tmemcpy(buffer, data, width * height * 4);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn retBuf;\r\n}\r\n\r\nvoid \r\nprocessImage8888(u32 /*pixelCount*/, u32 lineWidth, u32 height, u8* buffer) \r\n{\r\n\tu32* line1 = (u32*)buffer;\r\n\tu32* line2 = &(((u32*)buffer)[lineWidth]);\r\n\tu8* dst = buffer;\r\n\tfor (u32 y = 0; y < (height >> 1); y++) {\r\n\t\tu8* pix1 = (u8*)line1;\r\n\t\tu8* pix2 = (u8*)line2;\r\n\t\tfor (u32 x=0; x < (lineWidth >> 1); x++) {\r\n\t\t\tu32 sum;\r\n\t\t\tsum = (pix1[0] + pix1[4] + pix2[0] + pix2[4])>>2;\r\n\t\t\t*dst++ = sum;\r\n\t\t\tsum = (pix1[1] + pix1[5] + pix2[1] + pix2[5])>>2;\r\n\t\t\t*dst++ = sum;\r\n\t\t\tsum = (pix1[2] + pix1[6] + pix2[2] + pix2[6])>>2;\r\n\t\t\t*dst++ = sum;\r\n\t\t\tsum = (pix1[3] + pix1[7] + pix2[3] + pix2[7])>>2;\r\n\t\t\t*dst++ = sum;\r\n\r\n\t\t\tpix1 += 8;\r\n\t\t\tpix2 += 8;\r\n\t\t}\r\n\t\t// Skip 2 lines.\r\n\t\tline1 += lineWidth << 1;\r\n\t\tline2 += lineWidth << 1;\r\n\t}\t\r\n}\r\n\r\nvoid \r\nprocessImage565(u32 pixelCount, u32 lineWidth, u32 height, u8* buffer) \r\n{\r\n\tu16* pSrc\t= (u16*)buffer;\r\n\tu32* pDst\t= (u32*)pSrc;\r\n\tu16* pDst16\t= pSrc;\r\n\r\n\t//\r\n\t// Horizontal pass.\r\n\t//\r\n#define R_B\t\t(0xF81F)\r\n#define _G_\t\t(0x07E0)\r\n#define SHIFTNEXT\t(16)\r\n\tfor (u32 n = 0; n < (pixelCount>>1); n++) {\r\n\t\tu32 pix1\t= *pSrc++;\r\n\t\tu32 pix2\t= *pSrc++;\r\n\t\t*pDst++ = (((pix1 & _G_) << SHIFTNEXT) | (pix1 & R_B)) + (((pix2 & _G_) << SHIFTNEXT) | (pix2 & R_B));\r\n\t}\r\n\r\n\t//\r\n\t// Vertical Pass + Mixing into correct.\r\n\t//\r\n\tu32* line1 = (u32*)buffer;\r\n\tu32* line2 = &(((u32*)buffer)[lineWidth>>1]);\r\n\tpDst16 = (u16*)buffer;\r\n\tfor (u32 y = 0; y < (height >> 1); y++) {\r\n\t\tfor (u32 x=0; x < (lineWidth >> 1); x++) {\r\n\t\t\tu32 pix\t\t= (((*line1++) + (*line2++))) >> 2;\r\n\t\t\t*pDst16++\t= ((pix & (_G_ << SHIFTNEXT)) >> SHIFTNEXT) | (pix & R_B);\r\n\t\t}\r\n\t\t// Skip 2 lines.\r\n\t\tline1 += lineWidth>>1;\r\n\t\tline2 += lineWidth>>1;\r\n\t}\r\n#undef\tR_B\r\n#undef  _G_\r\n#undef SHIFTNEXT\r\n}\r\n\r\nvoid \r\nprocessImage4444(u32 pixelCount, u32 lineWidth, u32 height, u8* buffer) \r\n{\r\n\t// 8 Bit\r\n\tu16* pSrc\t= (u16*)buffer;\r\n\tu32* pDst\t= (u32*)pSrc;\r\n\tu16* pDst16\t= pSrc;\r\n\r\n\t//\r\n\t// Horizontal pass.\r\n\t//\r\n#define _R_B\t(0x0F0F)\r\n#define A_G_\t(0xF0F0)\r\n#define SHIFTNEXT\t(16 - 2)\r\n\tfor (u32 n = 0; n < (pixelCount>>1); n++) {\r\n\t\tu32 pix1\t= *pSrc++;\r\n\t\tu32 pix2\t= *pSrc++;\r\n\t\t*pDst++ = (((pix1 & A_G_) << SHIFTNEXT) | (pix1 & _R_B)) + (((pix2 & A_G_) << SHIFTNEXT) | (pix2 & _R_B));\r\n\t}\r\n\r\n\t//\r\n\t// Vertical Pass + Mixing into correct.\r\n\t//\r\n\tu32* line1 = (u32*)buffer;\r\n\tu32* line2 = &(((u32*)buffer)[lineWidth>>1]);\r\n\tpDst16 = (u16*)buffer;\r\n\tfor (u32 y = 0; y < (height >> 1); y++) {\r\n\t\tfor (u32 x=0; x < (lineWidth >> 1); x++) {\r\n\t\t\tu32 pix\t\t= (((*line1++) + (*line2++))) >> 2;\r\n\t\t\t*pDst16++\t= ((pix & (A_G_ << SHIFTNEXT)) >> SHIFTNEXT) | (pix & _R_B);\r\n\t\t}\r\n\t\t// Skip 2 lines.\r\n\t\tline1 += lineWidth>>1;\r\n\t\tline2 += lineWidth>>1;\r\n\t}\r\n#undef\t_R_B\r\n#undef  A_G_\r\n#undef  SHIFTNEXT\r\n}\r\n\r\nvoid \r\nprocessImage5551(u32 pixelCount, u32 lineWidth, u32 height, u8* buffer) \r\n{\r\n\t// 8 Bit\r\n\tu16* pSrc\t= (u16*)buffer;\r\n\tu32* pDst\t= (u32*)pSrc;\r\n\tu16* pDst16\t= pSrc;\r\n\r\n\t//\r\n\t// Horizontal pass.\r\n\t//\r\n\t// rrrrr ggggg bbbbb a\r\n\t// 00000 11111 00000 1\r\n\t// 0000.0111.1100.0001\t0x07C1\r\n\r\n\t// 11111 00000 11111 0\r\n\t// 1111.1000.0011.1110\r\n\r\n\t//\t1111.1000.0011.1110|0000.0111.1100.0001\r\n\r\n#define _R_B\t(0x07C1)\r\n#define A_G_\t(0xF83E)\r\n#define SHIFTNEXT\t(16 - 2)\r\n\tfor (u32 n = 0; n < (pixelCount>>1); n++) {\r\n\t\tu32 pix1\t= *pSrc++;\r\n\t\tu32 pix2\t= *pSrc++;\r\n\t\t*pDst++ = (((pix1 & A_G_) << SHIFTNEXT) | (pix1 & _R_B)) + (((pix2 & A_G_) << SHIFTNEXT) | (pix2 & _R_B));\r\n\t}\r\n\r\n\t//\r\n\t// Vertical Pass + Mixing into correct.\r\n\t//\r\n\tu32* line1 = (u32*)buffer;\r\n\tu32* line2 = &(((u32*)buffer)[lineWidth>>1]);\r\n\tpDst16 = (u16*)buffer;\r\n\tfor (u32 y = 0; y < (height >> 1); y++) {\r\n\t\tfor (u32 x=0; x < (lineWidth >> 1); x++) {\r\n\t\t\tu32 pix\t\t= (((*line1++) + (*line2++))) >> 2;\r\n\t\t\t*pDst16++\t= ((pix & (A_G_ << SHIFTNEXT)) >> SHIFTNEXT) | (pix & _R_B);\r\n\t\t}\r\n\t\t// Skip 2 lines.\r\n\t\tline1 += lineWidth>>1;\r\n\t\tline2 += lineWidth>>1;\r\n\t}\r\n#undef\t_R_B\r\n#undef  A_G_\r\n#undef  SHIFTNEXT\r\n}\r\n\r\n/*virtual*/\r\nCKLBAbstractAsset* \r\nKLBTextureAssetPlugin::loadAsset(u8* stream, u32 streamSize) \r\n{\r\n\tCKLBTextureAsset* pNewAsset = m_pReloadAsset ? ((CKLBTextureAsset*)m_pReloadAsset) : KLBNEW(CKLBTextureAsset);\r\n\r\n\tif (pNewAsset) {\r\n\t\tu8* streamStart = stream;\r\n\r\n\t\t// Str Length including zero and padding.\r\n\t\tu16 length = (stream[0] << 8) | stream[1];\r\n\t\tstream += 2;\r\n\t\r\n\t\tif (!m_pReloadAsset)\r\n\t\tpNewAsset->m_fileSource = CKLBUtility::copyString(this->m_currentFile);\r\n\r\n\t\t// + [pad]\r\n\t\tif (!m_pReloadAsset)\r\n\t\tpNewAsset->m_pName\t\t= pNewAsset->allocateName(stream, length);\r\n\t\tstream += length;\r\n\r\n\t\t//\r\n\t\t// Width\t\t2 byte\r\n\t\t// Height\t\t2 byte\r\n\t\t// Type\t\t\t2 byte\r\n\t\t// totalVertexCount 2/6 byte\r\n\t\t// totalIndexCount\t2/6 byte\r\n\t\t// ImageCount\t2 byte\r\n\t\t//\r\n\r\n\t\tpNewAsset->m_width\t\t\t\t= (stream[0]<<8) | stream[1]; stream += 2;\r\n\t\tpNewAsset->m_height\t\t\t\t= (stream[0]<<8) | stream[1]; stream += 2;\r\n\t\tpNewAsset->m_type\t\t\t\t= (stream[0]<<8) | stream[1]; stream += 2;\r\n\t\tpNewAsset->m_totalVertexCount\t= (stream[0]<<8) | stream[1]; stream += 2;\r\n\r\n\t\tif (pNewAsset->m_totalVertexCount == 0xFFFF) {\r\n\t\t\tpNewAsset->m_totalVertexCount\t= (stream[0]<<24) | (stream[1]<<16) | (stream[2]<<8) | stream[3]; stream += 4;\r\n\t\t}\r\n\t\tpNewAsset->m_totalIndexCount\t= (stream[0]<<8) | stream[1]; stream += 2;\r\n\t\tif (pNewAsset->m_totalIndexCount == 0xFFFF) {\r\n\t\t\tpNewAsset->m_totalIndexCount\t= (stream[0]<<24) | (stream[1]<<16) | (stream[2]<<8) | stream[3]; stream += 4;\r\n\t\t}\r\n\t\tpNewAsset->m_imageCount\t\t\t= (stream[0]<<8) | stream[1]; stream += 2;\r\n\r\n\t\tint uvOffset;\r\n\t\tif (pNewAsset->m_type & 0x8000) {\r\n\t\t\tuvOffset = (stream[0]<<24) | (stream[1]<<16) | (stream[2]<<8) | stream[3]; stream += 4;\r\n\t\t} else {\r\n\t\t\tuvOffset = pNewAsset->m_totalVertexCount * 2;\r\n\t\t\tpNewAsset->m_totalVertexCount *= 4;\r\n\t\t}\r\n\r\n\t\tif (!m_pReloadAsset) {\r\n\t\tpNewAsset->m_floatBufferTotal\t= KLBNEWA(float\t\t\t\t,pNewAsset->m_totalVertexCount\t\t);\r\n\t\tpNewAsset->m_indexBufferTotal\t= KLBNEWA(u16\t\t\t\t,pNewAsset->m_totalIndexCount\t\t);\t// UV and X,Y\r\n\t\tpNewAsset->m_pImages\t\t\t= KLBNEWA(CKLBImageAsset*\t,pNewAsset->m_imageCount\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (pNewAsset->m_floatBufferTotal && pNewAsset->m_indexBufferTotal && pNewAsset->m_pImages && pNewAsset->m_pName) {\r\n\t\t\t//\r\n\t\t\t// Trick here : texture loader directly embed the image loading process\r\n\t\t\t// and allocate the buffers for the image objects.\r\n\t\t\t// --> Special API are added to the Image plugin to do so.\r\n\t\t\t//\r\n\t\t\t\r\n\t\t\tsetBuffers(\r\n\t\t\t\tpNewAsset,\r\n\t\t\t\tpNewAsset->m_floatBufferTotal,\t\t\t\t\t\t\t\t\t\t// UV Storage\r\n\t\t\t\t&pNewAsset->m_floatBufferTotal[uvOffset],\t// XY Storage\r\n\t\t\t\tpNewAsset->m_indexBufferTotal);\r\n\r\n\t\t\tfor (u16 n = 0; n < pNewAsset->m_imageCount; n++) {\r\n\t\t\t\t//\r\n\t\t\t\t// Stream size\r\n\t\t\t\t//\r\n\t\t\t\tstream += 4;\t// Skip [TIMG]/[3DM_]\r\n\t\t\t\tu32 size = (stream[0]<<8) | stream[1]; stream += 2;\r\n\t\t\t\tif (size == 0xFFFF) {\r\n\t\t\t\t\tsize = (stream[0]<<24) | (stream[1]<<16) | (stream[2]<<8) | stream[3]; stream += 4;\r\n\t\t\t\t}\r\n\t\t\r\n\t\t\t\tCKLBImageAsset* pImg = loadImage(stream, size, pNewAsset->m_pImages[n]);\r\n\t\t\t\tpNewAsset->m_pImages[n] = pImg;\r\n\r\n\t\t\t\tif (pNewAsset->m_pImages[n] == NULL) {\r\n\t\t\t\t\treturn NULL;\r\n\t\t\t\t}\r\n\t\t\t\tstream += size;\r\n\t\t\t}\r\n\r\n\t\t\t// + [pad] : 4 byte aligned texture.\r\n\t\t\t// Default for uncompressed stream.\r\n\t\t\tpNewAsset->m_bitmap\t\t\t\t= &stream[0];\r\n\t\t\t\r\n\t\t\t// Texture size is all the data remaining (FullDataSize - AlreadyReadDataSize )\r\n\t\t\tu32 textureSize = streamSize - (stream - streamStart);\r\n\t\t\tbool hardCompression = false;\r\n\r\n\t\t\tGLenum pixelFormat;\r\n\t\t\tCKLBOGLWrapper::TEX_CHANNEL channelCount;\r\n\r\n\t\t\t// 0 ALPHA | 1 LUMA | 2 LUMALPHA | 3 RGB | 4 RGBA\t// Bit 0..2\r\n\t\t\t// COMPRESS (3) | DOUBLE_BUFF (5) | MIPMAP (4)\t\t// Bit 3,4,5\r\n\t\t\t// 0 565 | 1 5551 | 2 4444 | 3 8\t\t\t\t\t// Bit 6..7\r\n\r\n\t\t\tswitch (pNewAsset->m_type & 0x7) {\r\n\t\t\tcase 0:\r\n\t\t\t\tchannelCount = CKLBOGLWrapper::ALPHA;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\tchannelCount = CKLBOGLWrapper::LUMINANCE;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tchannelCount = CKLBOGLWrapper::LUMINANCE_ALPHA;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tchannelCount = CKLBOGLWrapper::RGB;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\tdefault:\r\n\t\t\t\tchannelCount = CKLBOGLWrapper::RGBA;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tint bytePerPix;\r\n\t\t\tint hasClick;\r\n\r\n\t\t\tswitch ((pNewAsset->m_type>>6) & 0x3) {\r\n\t\t\tcase 0:\r\n\t\t\t\tpixelFormat = GL_UNSIGNED_SHORT_5_6_5;\r\n\t\t\t\tbytePerPix\t= 2;\r\n\t\t\t\thasClick\t= 0;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\tpixelFormat = GL_UNSIGNED_SHORT_5_5_5_1;\r\n\t\t\t\tbytePerPix\t= 2;\r\n\t\t\t\thasClick\t= 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tpixelFormat = GL_UNSIGNED_SHORT_4_4_4_4;\r\n\t\t\t\tbytePerPix\t= 2;\r\n\t\t\t\thasClick\t= 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\tdefault:\t// Avoid warning.\r\n\t\t\t\tpixelFormat = GL_UNSIGNED_BYTE;\r\n\t\t\t\tbytePerPix\t= 1 * (channelCount ? channelCount : 1); // Luminance is 1 byte.\r\n\t\t\t\thasClick\t= 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tu32 opt = CKLBOGLWrapper::TEX_NONE;\r\n\t\t\tu32 compressType = 0;\r\n\t\t\tif (pNewAsset->m_type & (1<<3)) {\r\n\t\t\t\tcompressType = (stream[0]<<24) | (stream[1]<<16) | (stream[2]<<8) | stream[3]; stream += 4;\r\n\r\n\t\t\t\t// Extension to be supported, read 4 more byte to find out.\r\n\t\t\t\tif (compressType == 0) {\r\n\t\t\t\t\t/* textureSize = zlib stream */\r\n\t\t\t\t\tu32 outputSize = bytePerPix * pNewAsset->m_width * pNewAsset->m_height;\r\n\t\t\t\t\tpNewAsset->m_bitmap\t\t\t\t= KLBNEWA(u8, outputSize);\r\n\r\n\t\t\t\t\tif (pNewAsset->m_bitmap) {\r\n\t\t\t\t\t\tu8* in = &stream[0];\r\n\t\t\t\t\t\t// textureSize = compressed stream Size.\r\n\t\t\t\t\t\tint ret;\r\n\t\t\t\t\t\tz_stream strm;\r\n\r\n\t\t\t\t\t\t/* allocate deflate state */\r\n\t\t\t\t\t\tstrm.zalloc     = Z_NULL;\r\n\t\t\t\t\t\tstrm.zfree      = Z_NULL;\r\n\t\t\t\t\t\tstrm.opaque     = Z_NULL;\r\n\t\t\t\t\t\tstrm.avail_in   = 0;\r\n\t\t\t\t\t\tstrm.next_in    = Z_NULL;\r\n\t\t\t\t\t\tret = inflateInit(&strm);\r\n\t\t\t\t\t\tif (ret != Z_OK) {\r\n\t\t\t\t\t\t\tKLBDELETEA((u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\t\tpNewAsset->m_bitmap = NULL;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Number of byte available in the stream for decompression.\r\n\t\t\t\t\t\tstrm.avail_in = textureSize; \r\n\t\t\t\t\t\t// Input stream setup\r\n\t\t\t\t\t\tstrm.next_in  = in;\r\n\r\n\t\t\t\t\t\t// Number of byte available in the output buffer for decompression.\r\n\t\t\t\t\t\tstrm.avail_out = outputSize;\r\n\t\t\t\t\t\t// Target Buffer for decompression.\r\n\t\t\t\t\t\tstrm.next_out  = (u8*)pNewAsset->m_bitmap;\r\n\r\n\t\t\t\t\t\t//---------------------------------\r\n\t\t\t\t\t\t// Decompress me !\r\n\t\t\t\t\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_TEX_LOAD_INFLATE);\r\n\t\t\t\t\t\tret = inflate(&strm, Z_NO_FLUSH);\r\n\t\t\t\t\t\tMEASURE_THREAD_CPU_END(TASKTYPE_TEX_LOAD_INFLATE);\r\n\t\t\t\t\t\tif ((ret != Z_OK) && (ret != Z_STREAM_END)) {\r\n\t\t\t\t\t\t\tKLBDELETEA((u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\t\tpNewAsset->m_bitmap = NULL;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//---------------------------------\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// Job complete, end.\r\n\t\t\t\t\t\t// do not care about end result \r\n\t\t\t\t\t\t// because all the free possible have been made.\r\n\t\t\t\t\t\tret = inflateEnd(&strm);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Support for later extension PVRTC, ETC1, ETC2, ...\r\n\t\t\t\t\t//\r\n\t\t\t\t\thardCompression = true;\r\n\t\t\t\t\topt |= CKLBOGLWrapper::TEX_OPT_COMPRESSED_BIT;\r\n\t\t\t\t\t// pixelFormat\tsetup\r\n\t\t\t\t\t// channelCount\tsetup\r\n\t\t\t\t\t// Stream shifted by 4 byte (compress type)\r\n\r\n\t\t\t\t\tchar *exts = (char *)glGetString(GL_EXTENSIONS);\r\n\r\n\t\t\t\t\t// Prefer to put the strcmp AFTER the equality check to avoid useless string compare.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// === GL_IMG_texture_compression_pvrtc group ===\r\n\t\t\t\t\t//\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG\r\n\t\t\t\t\tif ((compressType == GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG) && strstr(exts, \"GL_IMG_texture_compression_pvrtc\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG\r\n\t\t\t\t\tif ((compressType == GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG) && strstr(exts, \"GL_IMG_texture_compression_pvrtc\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\r\n\t\t\t\t\tif ((compressType == GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG) && strstr(exts, \"GL_IMG_texture_compression_pvrtc\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG\r\n\t\t\t\t\tif ((compressType == GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG) && strstr(exts, \"GL_IMG_texture_compression_pvrtc\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// === GL_IMG_texture_compression_pvrtc2 group ===\r\n\t\t\t\t\t//\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG\r\n\t\t\t\t\tif ((compressType == GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG) && strstr(exts, \"GL_IMG_texture_compression_pvrtc2\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG\r\n\t\t\t\t\tif ((compressType == GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG) && strstr(exts, \"GL_IMG_texture_compression_pvrtc2\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// === GL_OES_compressed_ETC1_RGB8_texture group ===\r\n\t\t\t\t\t//\r\n\t\t\t\t\t#ifdef GL_ETC1_RGB8_OES\r\n\t\t\t\t\tif ((compressType == GL_ETC1_RGB8_OES) && strstr(exts, \"GL_OES_compressed_ETC1_RGB8_texture\")) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// === ETC2 is mandatory and there is not EXTENSIONS ===\r\n\t\t\t\t\t//\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGB8_ETC2\r\n\t\t\t\t\tif (compressType == GL_COMPRESSED_RGB8_ETC2) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t#ifdef GL_COMPRESSED_RGBA8_ETC2_EAC\r\n\t\t\t\t\tif (compressType == GL_COMPRESSED_RGBA8_ETC2_EAC) {\r\n\t\t\t\t\t\t// OK.\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t#endif\r\n\r\n\t\t\t\t\tif (true) {\r\n\t\t\t\t\t\tif (compressType == 0x8D64 /*GL_ETC1_RGB8_OES*/) {\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t// SW decoder called.\r\n\t\t\t\t\t\t\t//\r\n\r\n\t\t\t\t\t\t\t// Reset HW compression bits\r\n\t\t\t\t\t\t\thardCompression = false;\r\n\t\t\t\t\t\t\tcompressType = 0;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tpixelFormat = GL_UNSIGNED_BYTE;\r\n\t\t\t\t\t\t\tbytePerPix  = 4;\r\n\r\n\t\t\t\t\t\t\topt &= ~CKLBOGLWrapper::TEX_OPT_COMPRESSED_BIT;\r\n\t\t\t\t\t\t\tu32 outputSize = bytePerPix * pNewAsset->m_width * pNewAsset->m_height;\r\n\t\t\t\t\t\t\tpNewAsset->m_bitmap\t\t\t\t= KLBNEWA(u8, outputSize);\r\n\r\n\t\t\t\t\t\t\tif (pNewAsset->m_bitmap) {\r\n\r\n\t\t\t\t\t\t\t\t/* From Khronos Specs\r\n\t\t\t\t\t\t\t\t\tFirst block in mem  Second block in mem\r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- .... .... .... ....  --> u direction\r\n\t\t\t\t\t\t\t\t\t|a1  |e1  |i1  |m1  |a2  :e2  :i2  :m2  :\r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |    :    :    :    : \r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- .... .... .... ....\r\n\t\t\t\t\t\t\t\t\t|b1  |f1  |j1  |n1  |b2  :f2  :j2  :n2  : \r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |    :    :    :    : \r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- .... .... .... ....\r\n\t\t\t\t\t\t\t\t\t|c1  |g1  |k1  |o1  |c2  :g2  :k2  :o2  : \r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |    :    :    :    : \r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- .... .... .... ....\r\n\t\t\t\t\t\t\t\t\t|d1  |h1  |l1  |p1  |d2  :h2  :l2  :p2  : \r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |    :    :    :    : \r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t:a3  :e3  :i3  :m3  |a4  |e4  |i4  |m4  |\r\n\t\t\t\t\t\t\t\t\t:    :    :    :    |    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t .... .... .... .... ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t:b3  :f3  :j3  :n3  |b4  |f4  |j4  |n4  |\r\n\t\t\t\t\t\t\t\t\t:    :    :    :    |    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t .... .... .... .... ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t:c3  :g3  :k3  :o3  |c4  |g4  |k4  |o4  |\r\n\t\t\t\t\t\t\t\t\t:    :    :    :    |    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t .... .... .... .... ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t:d3  :h3  :l3  :p3  |d4  |h4  |l4  |p4  |\r\n\t\t\t\t\t\t\t\t\t:    :    :    :    |    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t .... .... .... .... ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t| Third block in mem  Fourth block in mem\r\n\t\t\t\t\t\t\t\t\tv\r\n\t\t\t\t\t\t\t\t\tv direction\r\n\r\n\t\t\t\t\t\t\t\t\tAdd figure 3.9.1: Pixel layout for a ETC1 compressed block:\r\n\r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t|a   |e   |i   |m   |\r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t|b   |f   |j   |n   |\r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t|c   |g   |k   |o   |\r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t\t|d   |h   |l   |p   |\r\n\t\t\t\t\t\t\t\t\t|    |    |    |    |\r\n\t\t\t\t\t\t\t\t\t ---- ---- ---- ---- \r\n\t\t\t\t\t\t\t\t*/\r\n\r\n\t\t\t\t\t\t\t\t// Horizontal block first then vertical lines\r\n\t\t\t\t\t\t\t\tu8* pSrcStream = &stream[0];\r\n\t\t\t\t\t\t\t\tu8* pDstStream = (u8*)pNewAsset->m_bitmap;\r\n\t\t\t\t\t\t\t\tu32 rgbaOut[16];\r\n\t\t\t\t\t\t\t\tfor (int y=0; y < pNewAsset->m_height>>2; y++) {\r\n\t\t\t\t\t\t\t\t\tu32* writePix = (u32*)pDstStream; \r\n\t\t\t\t\t\t\t\t\tfor (int x=0; x < pNewAsset->m_width>>2; x++) {\r\n\t\t\t\t\t\t\t\t\t\trg_etc1::unpack_etc1_block(pSrcStream, (u32*)rgbaOut,false);\r\n\t\t\t\t\t\t\t\t\t\tpSrcStream += 8; // Next 64 bit chunk.\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix[0] = rgbaOut[0];\r\n\t\t\t\t\t\t\t\t\t\twritePix[1] = rgbaOut[1];\r\n\t\t\t\t\t\t\t\t\t\twritePix[2] = rgbaOut[2];\r\n\t\t\t\t\t\t\t\t\t\twritePix[3] = rgbaOut[3];\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix += pNewAsset->m_width;\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix[0] = rgbaOut[4];\r\n\t\t\t\t\t\t\t\t\t\twritePix[1] = rgbaOut[5];\r\n\t\t\t\t\t\t\t\t\t\twritePix[2] = rgbaOut[6];\r\n\t\t\t\t\t\t\t\t\t\twritePix[3] = rgbaOut[7];\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix += pNewAsset->m_width;\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix[0] = rgbaOut[8];\r\n\t\t\t\t\t\t\t\t\t\twritePix[1] = rgbaOut[9];\r\n\t\t\t\t\t\t\t\t\t\twritePix[2] = rgbaOut[10];\r\n\t\t\t\t\t\t\t\t\t\twritePix[3] = rgbaOut[11];\r\n\t\t\t\t\t\t\t\t\t\twritePix += pNewAsset->m_width;\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix[0] = rgbaOut[12];\r\n\t\t\t\t\t\t\t\t\t\twritePix[1] = rgbaOut[13];\r\n\t\t\t\t\t\t\t\t\t\twritePix[2] = rgbaOut[14];\r\n\t\t\t\t\t\t\t\t\t\twritePix[3] = rgbaOut[15];\r\n\r\n\t\t\t\t\t\t\t\t\t\twritePix -= pNewAsset->m_width * 3; // Rollback at top\r\n\t\t\t\t\t\t\t\t\t\twritePix += 4;\t\t\t\t\t\t// Next block on the line\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tpDstStream += 4 * 4 * pNewAsset->m_width; // RGBA * Width * 4 pixel height\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tklb_assertAlways(\"COMPRESSED TEXTURE FORMAT %8X NOT SUPPORTED ON THIS PLATFORM\",compressType);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (compressType != 0) {\r\n\t\t\t\t\t\tpixelFormat = compressType;\r\n\t\t\t\t\t\tpNewAsset->m_bitmap\t\t\t\t= &stream[0];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewAsset->m_type & (1<<4)) {\r\n\t\t\t\topt |= CKLBOGLWrapper::TEX_OPT_MIPMAP_BIT;\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewAsset->m_type & (1<<5)) {\r\n\t\t\t\topt |= CKLBOGLWrapper::TEX_OPT_DOUBLEBUFFERED_BIT;\r\n\t\t\t}\r\n\r\n\t\t\tCKLBOGLWrapper& pMgr = CKLBOGLWrapper::getInstance();\r\n\r\n\t\t\tif (pNewAsset->m_bitmap) {\r\n\t\t\t\t//\r\n\t\t\t\t// Texture creation may fail, but asset is considered as loaded\r\n\t\t\t\t//\r\n\t\t\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_TEX_LOAD_LOWCONV);\r\n\t\t\t\tbool lowRes = (CPFInterface::getInstance().client().getPhysicalScreenHeight() < 480) || m_useQuarterTexture;\r\n\t\t\t\tif (lowRes && (compressType == 0)) {\r\n\t\t\t\t\tswitch (pixelFormat) {\r\n\t\t\t\t\tcase GL_UNSIGNED_SHORT_5_6_5:\r\n\t\t\t\t\t\tprocessImage565(\r\n\t\t\t\t\t\t\tpNewAsset->m_width * pNewAsset->m_height,\r\n\t\t\t\t\t\t\tpNewAsset->m_width,\r\n\t\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\t\t(u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase GL_UNSIGNED_SHORT_5_5_5_1:\r\n\t\t\t\t\t\tprocessImage5551(\r\n\t\t\t\t\t\t\tpNewAsset->m_width * pNewAsset->m_height,\r\n\t\t\t\t\t\t\tpNewAsset->m_width,\r\n\t\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\t\t(u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase GL_UNSIGNED_SHORT_4_4_4_4:\r\n\t\t\t\t\t\tprocessImage4444(\r\n\t\t\t\t\t\t\tpNewAsset->m_width * pNewAsset->m_height,\r\n\t\t\t\t\t\t\tpNewAsset->m_width,\r\n\t\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\t\t(u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase GL_UNSIGNED_BYTE:\r\n\t\t\t\t\t\tprocessImage8888(\r\n\t\t\t\t\t\t\tpNewAsset->m_width * pNewAsset->m_height,\r\n\t\t\t\t\t\t\tpNewAsset->m_width,\r\n\t\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\t\t(u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpNewAsset->m_width  >>= 1;\r\n\t\t\t\t\tpNewAsset->m_height >>= 1;\r\n\t\t\t\t\ttextureSize >>= 2;\r\n\t\t\t\t}\r\n\t\t\t\tMEASURE_THREAD_CPU_END(TASKTYPE_TEX_LOAD_LOWCONV);\r\n\r\n\t\t\t\tif (this->m_loadHardware) {\r\n\t\t\t\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_TEX_LOAD_OGL);\r\n\t\t\t\t\tif (CKLBAssetManager::getInstance().isAsyncLoading() == false) {\r\n\t\t\t\t\t\tpNewAsset->m_bytePerPix\t= bytePerPix;\r\n\t\t\t\t\t\tpNewAsset->m_pTexture\t= pMgr.createTexture(pNewAsset->m_width,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t pNewAsset->m_height,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t pixelFormat,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t channelCount,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t pNewAsset->m_bitmap,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t textureSize,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (CKLBOGLWrapper::TEX_OPTION)opt,0,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (!m_pReloadAsset) ? NULL : pNewAsset->m_pTexture);\r\n\t\t\t\t\t\t// Sync loading.\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Async loading, but main thread need to perform the openGL call.\r\n\t\t\t\t\t\tCKLBAssetManager::getInstance().setMainThreadTexture(pNewAsset, pixelFormat, channelCount, opt, textureSize);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (pNewAsset->m_pTexture) {\r\n\t\t\t\t\t\tgTextureAllocHW += pNewAsset->m_width * pNewAsset->m_height * bytePerPix;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tMEASURE_THREAD_CPU_END(TASKTYPE_TEX_LOAD_OGL);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpNewAsset->m_pTexture = NULL;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Compute Mip Map for clicking alpha info.\r\n\t\t\t\t//\r\n\t\t\t\tif (hasClick) {\r\n\t\t\t\t\t#define TILE_WIDTH_BIT\t\t(3)\r\n\t\t\t\t\t#define TILE_WIDTH\t\t\t(1<<TILE_WIDTH_BIT)\r\n\r\n\t\t\t\t\t// 1 Bit bitmap of Width/8, Height/8\r\n\t\t\t\t\tint size\t\t= ((pNewAsset->m_width>>TILE_WIDTH_BIT) * (pNewAsset->m_height>>TILE_WIDTH_BIT)) >> 3;\r\n\r\n\t\t\t\t\tu8* clickMap\t= m_pReloadAsset ? pNewAsset->m_pTexture->getSWAlphaBuffer() : KLBNEWA(u8, size);\r\n\t\t\t\t\tint bit;\r\n\t\t\t\t\tint shift;\r\n\t\t\t\t\tint byte;\r\n\t\t\t\t\tif (clickMap) {\r\n\t\t\t\t\tmemset(clickMap, 0, size);\r\n\r\n\t\t\t\t\tu16 fakeNum = 0x00FF;\r\n\t\t\t\t\tu8* tstPtr\t= (u8*)&fakeNum;\r\n\t\t\t\t\tint byteVal\t= (tstPtr[0] == 0xFF) ? 0 : 1;\t// Support for big-endian/little-endian portability.\r\n\r\n\t\t\t\t\tswitch ((pNewAsset->m_type>>6) & 0x3) {\r\n\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\t// GL_UNSIGNED_SHORT_5_5_5_1;\r\n\t\t\t\t\t\tbit   = 1;\r\n\t\t\t\t\t\tshift = 0;\r\n\t\t\t\t\t\tbyte  = byteVal;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t// GL_UNSIGNED_SHORT_4_4_4_4;\r\n\t\t\t\t\t\tbit   = 0x08;\r\n\t\t\t\t\t\tshift = 3;\r\n\t\t\t\t\t\tbyte  = byteVal;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 3:\r\n\t\t\t\t\tdefault:\t// Avoid warning.\r\n\t\t\t\t\t\t// 8888\r\n\t\t\t\t\t\tbit   = 0x80;\r\n\t\t\t\t\t\tshift = 7;\r\n\t\t\t\t\t\tbyte  = 3;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Shift ptr to point to correct alpha byte right away.\r\n\t\t\t\t\tu8* ptr = &(((u8*)pNewAsset->m_bitmap)[byte]);\r\n\r\n\t\t\t\t\t// Shift ptr sampling to point at 4, 4\r\n\t\t\t\t\tptr += (pNewAsset->m_width * bytePerPix * (TILE_WIDTH>>1)) + (bytePerPix * (TILE_WIDTH>>1));\r\n\r\n\t\t\t\t\tu8* clickPtr = clickMap;\r\n\r\n\t\t\t\t\tint posBit = 0;\r\n\t\t\t\t\tint stepTile  = (bytePerPix * TILE_WIDTH);\r\n\t\t\t\t\t// cheap trick : read pixel 4,4 of each 8x8 tile\r\n\t\t\t\t\tfor (int y=0; y < pNewAsset->m_height; y+=TILE_WIDTH) {\r\n\t\t\t\t\t\tu8* ptrScan\t\t= ptr;\r\n\t\t\t\t\t\tu8* ptrScanEnd\t= ptrScan + (pNewAsset->m_width * bytePerPix);\r\n\t\t\t\t\t\tu8  val\t\t\t= 0;\r\n\t\t\t\t\t\twhile (ptrScan < ptrScanEnd) {\r\n\t\t\t\t\t\t\t// Read Alpha -> put at bit 0 -> put at correct bit in current byte of target buffer.\r\n\t\t\t\t\t\t\tu8 streamBit = ((posBit++)&7);\r\n\t\t\t\t\t\t\tval   |= ((*ptrScan & bit)>>shift) << streamBit;\r\n\t\t\t\t\t\t\tif (streamBit == 7) {\r\n\t\t\t\t\t\t\t\t*clickPtr++ = val;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tptrScan\t\t+= stepTile;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tptr += (pNewAsset->m_width * stepTile);\t// Skip 8 lines\r\n\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpNewAsset->m_pTexture->assignSWAlphaBuffer(clickMap);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this->m_loadSoftware) {\r\n\t\t\t\t\tpNewAsset->m_softTexture = createSoftTexture(\r\n\t\t\t\t\t\tpNewAsset->m_width,\r\n\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\tpixelFormat,\r\n\t\t\t\t\t\tchannelCount,\r\n\t\t\t\t\t\tpNewAsset->m_bitmap);\r\n\t\t\t\t\tif (pNewAsset->m_softTexture) {\r\n\t\t\t\t\t\tgTextureAllocSW += pNewAsset->m_width * pNewAsset->m_height * 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpNewAsset->m_softTexture = NULL;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pNewAsset->m_pTexture) {\r\n\t\t\t\t\tpNewAsset->m_pTextureUsage = pNewAsset->m_pTexture->createUsage();\t\t\t\t\r\n\t\t\t\t\t// pNewAsset->m_pTextureUsage->setSampling(\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpNewAsset->m_pTextureUsage = NULL;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Stream was compressed ?\r\n\t\t\t//\r\n\t\t\tif (pNewAsset->m_type & (1<<3)) {\r\n\t\t\t\t// Free Uncompressed source buffer.\r\n\t\t\t\tif (pNewAsset->m_bitmap) {\r\n\t\t\t\t\tif (hardCompression == false) {\r\n\t\t\t\t\t\tKLBDELETEA((u8*)pNewAsset->m_bitmap);\r\n\t\t\t\t\t\tpNewAsset->m_bitmap = NULL;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Allocation error, failure.\r\n\t\t\t\t\tKLBDELETE(pNewAsset);\r\n\t\t\t\t\tpNewAsset = NULL;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn pNewAsset;\r\n\t\t}\r\n\r\n\t\tklb_assertNull(0, \"Allocation issue\");\r\n\t\tKLBDELETE(pNewAsset);\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n#include \"CKLBNode.h\"\r\n\r\n/*virtual*/\r\nCKLBNode* \r\nCKLBImageAsset::createSubTree(u32 priorityBase) \r\n{\r\n\tCKLBNode*\tpNode\t= KLBNEW(CKLBNode);\r\n\tCKLBSprite*\tpRender\t= CKLBRenderingManager::getInstance().allocateCommandSprite(this,priorityBase);\r\n\tif (pNode && pRender) {\r\n\t\tpNode->setRender(pRender);\r\n\t\treturn pNode;\r\n\t}\r\n\tif (pNode) { KLBDELETE(pNode); }\r\n\treturn NULL;\r\n}\r\n\r\n#include \"CKLBDataHandler.h\"\r\n\r\n/*static*/ \r\nCKLBNode* \r\nCKLBImageAsset::createSprite(\tu32 textureHandle,\r\n\t\t\t\t\t\t\t\tconst char* imageName,\r\n\t\t\t\t\t\t\t\tCKLBNode* pParentNode,\r\n\t\t\t\t\t\t\t\tu32 renderPriority) \r\n{\r\n\tklb_assert(textureHandle,\t\"Valid Handle is required\");\r\n\tklb_assert(pParentNode,\t\t\"Requires valid parent node\");\r\n\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\tCKLBNode* pNode = KLBNEW(CKLBNode);\r\n\r\n\tif (pNode) {\r\n\t\tklb_assert(pParentNode,\t\t\"Requires valid parent node\");\r\n\r\n\t\tCKLBImageAsset* pImg = ((CKLBTextureAsset*)CKLBDataHandler::getPointer(textureHandle))->getImage(imageName);\r\n\t\tif (pImg) {\r\n\t\t\tCKLBSprite*\tpRender\t= pRdrMgr.allocateCommandSprite(pImg);\r\n\t\t\tif (pRender) {\r\n\t\t\t\tpRender->changeOrder(pRdrMgr, renderPriority);\r\n\t\t\t\tpNode->setRender(pRender);\r\n\t\t\t\tpNode->setRenderOnDestroy(true);\r\n\t\t\t\tpParentNode->addNode(pNode, 0);\r\n\t\t\t\tpParentNode->markUpMatrix();\r\n\t\t\t\treturn pNode;\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETE(pNode);\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n// 1. createTexture.\r\n// 2. Register Asset. (Name in dictionnary, slot, etc...)\r\n// 3. Do screenshot feature\r\nCKLBAbstractAsset* \r\ncreateTexture(u32 orgWidthI, u32 orgHeightI, const char* name) \r\n{\r\n\tCKLBTextureAsset* pNewAsset = KLBNEW(CKLBTextureAsset);\r\n\r\n\tif (pNewAsset && name) {\r\n\t\tu32 widthI\t= CKLBUtility::nearest2Pow(orgWidthI );\r\n\t\tu32 heightI = CKLBUtility::nearest2Pow(orgHeightI);\r\n\r\n\t\t// Name\r\n\t\t// + [pad]\r\n\t\tif (pNewAsset) {\r\n\t\t\tpNewAsset->setNameDirect(name);\r\n\r\n\t\t\tpNewAsset->m_width\t\t\t\t= orgWidthI;\r\n\t\t\tpNewAsset->m_height\t\t\t\t= orgHeightI;\r\n\t\t\tpNewAsset->m_type\t\t\t\t= 3;\r\n\t\t\tpNewAsset->m_totalVertexCount\t= 4;\r\n\t\t\tpNewAsset->m_totalIndexCount\t= 6;\r\n\t\t\tpNewAsset->m_imageCount\t\t\t= 1;\r\n\r\n\t\t\tpNewAsset->m_floatBufferTotal\t= KLBNEWA(float\t\t\t\t, pNewAsset->m_totalVertexCount*4\t);  // XYUV\r\n\t\t\tpNewAsset->m_indexBufferTotal\t= KLBNEWA(u16\t\t\t\t, pNewAsset->m_totalIndexCount\t\t);\r\n\t\t\tpNewAsset->m_pImages\t\t\t= KLBNEWA(CKLBImageAsset*\t, pNewAsset->m_imageCount\t\t\t);\r\n\r\n\t\t\tGLenum pixelFormat;\r\n\t\t\tCKLBOGLWrapper::TEX_CHANNEL channelCount;\r\n\t\t\tchannelCount\t\t\t\t\t= CKLBOGLWrapper::RGB;\r\n\t\t\tpixelFormat\t\t\t\t\t\t= GL_UNSIGNED_BYTE;\r\n\r\n\t\t\tint bytePerPix;\r\n\t\t\tbytePerPix\t\t\t\t\t\t= 1 * (channelCount ? channelCount : 1); // Luminance is 1 byte.\r\n\t\t\tCKLBOGLWrapper& pMgr\t\t\t= CKLBOGLWrapper::getInstance();\r\n\t\t\tint textureSize\t\t\t\t\t= widthI * heightI * bytePerPix;\r\n\r\n\t\t\t//\r\n\t\t\t// Texture creation may fail, but asset is considered as loaded\r\n\t\t\t//\r\n\t\t\tpNewAsset->m_bytePerPix\t\t\t= bytePerPix;\r\n\t\t\tpNewAsset->m_pTexture\t\t\t= pMgr.createTexture(\tpNewAsset->m_width,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpixelFormat,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchannelCount,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tNULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextureSize,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(CKLBOGLWrapper::TEX_OPTION)0);\r\n\r\n\t\t\tif (pNewAsset->m_pTexture) {\r\n\t\t\t\tgTextureAllocHW += textureSize;\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewAsset->m_floatBufferTotal && pNewAsset->m_indexBufferTotal && pNewAsset->m_pImages && pNewAsset->getName()) {\r\n\t\t\t\tCKLBImageAsset* pNewAssetI = KLBNEW(CKLBImageAsset);\r\n\t\t\t\tpNewAsset->m_pImages[0] = pNewAssetI;\r\n\t\t\t\tif (pNewAssetI) {\r\n\t\t\t\t\tklb_assert(strlen(name) < 250, \"Name for screenshot name is too long\");\r\n\r\n\t\t\t\t\t// + [pad]\r\n\t\t\t\t\tchar buff[256];\r\n\t\t\t\t\tsprintf(buff,\"%s.imag\",name);\r\n\r\n\t\t\t\t\tpNewAssetI->setNameDirect(buff);\r\n\t\t\t\t\tpNewAssetI->m_uiSubTileCount\t\t= 1;\r\n\t\t\t\t\tpNewAssetI->m_usageType             |= CKLBImageAsset::IS_STANDARD_RECT;\r\n\r\n\t\t\t\t\tpNewAssetI->m_uiVertexCount\t\t\t= 4;\r\n\t\t\t\t\tpNewAssetI->m_uiIndexCount\t\t\t= 6;\r\n\r\n\t\t\t\t\tpNewAssetI->m_imageSize.m_iRight\t= orgWidthI;\r\n\t\t\t\t\tpNewAssetI->m_imageSize.m_iBottom\t= orgHeightI;\r\n\t\t\t\t\tpNewAssetI->m_imageSize.m_iLeft\t\t= 0;\r\n\t\t\t\t\tpNewAssetI->m_imageSize.m_iTop\t\t= 0;\r\n\r\n\t\t\t\t\tpNewAssetI->m_iCenterX\t\t\t\t= 0;\r\n\t\t\t\t\tpNewAssetI->m_iCenterY\t\t\t\t= 0;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord\t\t\t\t= pNewAsset->m_floatBufferTotal;\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord\t\t\t\t= &pNewAsset->m_floatBufferTotal[8];\r\n\t\t\t\t\tpNewAssetI->m_pIndex\t\t\t\t= pNewAsset->m_indexBufferTotal;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pTextureAsset\t\t\t= pNewAsset;\r\n\r\n\t\t\t\t\tfloat orgWidth\t= orgWidthI;\r\n\t\t\t\t\tfloat orgHeight\t= orgHeightI;\r\n\t\t\t\t\t/*\r\n\t\t\t\t\tfloat ratioU\t= orgWidth  / widthI;\r\n\t\t\t\t\tfloat ratioV\t= orgHeight / heightI;\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tfloat startV\t= 1.0f;\r\n\t\t\t\t\tfloat endV\t\t= 0.0f;\r\n\r\n\t\t\t\t\tfloat startU\t= 0.0f;\r\n\t\t\t\t\tfloat endU\t\t= 1.0f;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[0]\t\t\t= 0.0f;\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[1]\t\t\t= 0.0f;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[2]\t\t\t= orgWidth;\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[3]\t\t\t= 0.0f;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[4]\t\t\t= orgWidth;\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[5]\t\t\t= orgHeight;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[6]\t\t\t= 0.0f;\r\n\t\t\t\t\tpNewAssetI->m_pXYCoord[7]\t\t\t= orgHeight;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[0]\t\t\t= startU;\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[1]\t\t\t= startV;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[2]\t\t\t= endU;\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[3]\t\t\t= startV;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[4]\t\t\t= endU;\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[5]\t\t\t= endV;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[6]\t\t\t= startU;\r\n\t\t\t\t\tpNewAssetI->m_pUVCoord[7]\t\t\t= endV;\r\n\r\n\r\n\t\t\t\t\tpNewAssetI->m_pIndex[0]\t\t\t\t= 0;\r\n\t\t\t\t\tpNewAssetI->m_pIndex[1]\t\t\t\t= 1;\r\n\t\t\t\t\tpNewAssetI->m_pIndex[2]\t\t\t\t= 3;\r\n\r\n\t\t\t\t\tpNewAssetI->m_pIndex[3]\t\t\t\t= 1;\r\n\t\t\t\t\tpNewAssetI->m_pIndex[4]\t\t\t\t= 2;\r\n\t\t\t\t\tpNewAssetI->m_pIndex[5]\t\t\t\t= 3;\r\n\r\n\t\t\t\t\tpNewAssetI->m_boundWidth\t\t\t= orgWidthI;\r\n\t\t\t\t\tpNewAssetI->m_boundHeight\t\t\t= orgHeightI;\r\n\r\n\t\t\t\t\tpNewAsset->m_pTextureUsage\t\t\t= pNewAsset->m_pTexture->createUsage();\r\n\r\n\t\t\t\t\treturn pNewAsset;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETE(pNewAsset);\r\n\t}\r\n\r\n\tklb_assertNull(0, \"allocation failure.\");\r\n\treturn NULL;\r\n}\r\n\r\nbool \r\ncreateScreenAsset(const char* name, u32 orgWidthI, u32 orgHeightI) \r\n{\r\n\tCKLBAbstractAsset* pAsset = createTexture(orgWidthI, orgHeightI, name);\r\n\tif (pAsset) {\r\n\t\tCKLBAssetManager::getInstance().registerAsset(pAsset);\r\n\t\tif (pAsset->getAssetID() != NULL_IDX) {\r\n\t\t\tpAsset->incrementRefCount();\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tKLBDELETE(pAsset);\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nbool \r\ndoScreenShot(const char* name, u32 srcx, u32 srcy, u32 width, u32 height, u32 dstx, u32 dsty) \r\n{\r\n\tCKLBAssetManager& mgr = CKLBAssetManager::getInstance();\r\n\tu16 idx = mgr.getAssetIDFromName(name,(char)NULL,1);\r\n\tif (idx != NULL_IDX) {\r\n\t\tCKLBTextureAsset* pNewAsset\t= (CKLBTextureAsset*)mgr.getAsset(idx);\r\n\t\tu8* buffer\t\t\t\t\t= NULL;\r\n\t\tu32 bufferSize\t\t\t\t= width * height * 3;\t// RGB888 per pixel\r\n\t\tCKLBOGLWrapper& pMgr\t\t= CKLBOGLWrapper::getInstance();\r\n\r\n\t\tbuffer = KLBNEWA(u8, bufferSize);\r\n\t\tif (buffer) {\r\n\t\t\tif (pMgr.copyScreenRGB888(srcx,srcy,width,height,buffer)) {\r\n\t\t\t\tif (pNewAsset->m_pTexture->updateTexture(dstx,dsty,width,height,buffer,bufferSize)) {\r\n\t\t\t\t\tKLBDELETEA(buffer);\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tKLBDELETEA(buffer);\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nfreeScreenAsset(const char* name) \r\n{\r\n\tCKLBAssetManager& mgr = CKLBAssetManager::getInstance();\r\n\tu16 idx = mgr.getAssetIDFromName(name,(char)NULL,1);\r\n\tif (idx != NULL_IDX) {\r\n\t\tCKLBTextureAsset* pNewAsset\t= (CKLBTextureAsset*)mgr.getAsset(idx);\r\n\t\tpNewAsset->decrementRefCount();\r\n\t}\r\n}\r\n\r\n/*\r\n * Here is the implementation of the ETC1 decoder part taken out from the \r\n * rg_etc1 library, we took only the decoder part out.\r\n *\r\n * The original project code can be found at :\r\n * http://code.google.com/p/rg-etc1/\r\n */\r\n//------------------------------------------------------------------------------\r\n//\r\n// rg_etc1 uses the ZLIB license:\r\n// http://opensource.org/licenses/Zlib\r\n//\r\n// Copyright (c) 2012 Rich Geldreich\r\n//\r\n// This software is provided 'as-is', without any express or implied\r\n// warranty.  In no event will the authors be held liable for any damages\r\n// arising from the use of this software.\r\n//\r\n// Permission is granted to anyone to use this software for any purpose,\r\n// including commercial applications, and to alter it and redistribute it\r\n// freely, subject to the following restrictions:\r\n//\r\n// 1. The origin of this software must not be misrepresented; you must not\r\n// claim that you wrote the original software. If you use this software\r\n// in a product, an acknowledgment in the product documentation would be\r\n// appreciated but is not required.\r\n//\r\n// 2. Altered source versions must be plainly marked as such, and must not be\r\n// misrepresented as being the original software.\r\n//\r\n// 3. This notice may not be removed or altered from any source distribution.\r\n//\r\n//------------------------------------------------------------------------------\r\n\r\n// File: rg_etc1.cpp - Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com>\r\n// Please see ZLIB license at the end of rg_etc1.h.\r\n//\r\n// For more information Ericsson Texture Compression (ETC/ETC1), see:\r\n// http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt\r\n//\r\n// v1.04 - 5/15/14 - Fix signed vs. unsigned subtraction problem (noticed when compiled with gcc) in pack_etc1_block_init(). \r\n//         This issue would cause an assert when this func. was called in debug. (Note this module was developed/testing with MSVC, \r\n//         I still need to test it throughly when compiled with gcc.)\r\n//\r\n// v1.03 - 5/12/13 - Initial public release\r\n#include <stdlib.h>\r\n#include <memory.h>\r\n#include <assert.h>\r\n//#include <stdio.h>\r\n#include <math.h>\r\n\r\n#pragma warning (disable: 4201) //  nonstandard extension used : nameless struct/union\r\n\r\n#if defined(_DEBUG) || defined(DEBUG)\r\n#define RG_ETC1_BUILD_DEBUG\r\n#endif\r\n\r\n#define RG_ETC1_ASSERT assert\r\n\r\nnamespace rg_etc1\r\n{\r\n   typedef unsigned char uint8;\r\n   typedef unsigned short uint16;\r\n   typedef unsigned int uint;\r\n   typedef unsigned int uint32;\r\n   typedef long long int64;\r\n   typedef unsigned long long uint64;\r\n\r\n   const uint32 cUINT32_MAX = 0xFFFFFFFFU;\r\n   const uint64 cUINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64;\r\n   \r\n   template<typename T> inline T minimum(T a, T b) { return (a < b) ? a : b; }\r\n   template<typename T> inline T clamp(T value, T low, T high) { return (value < low) ? low : ((value > high) ? high : value); }\r\n\r\n   enum eNoClamp { cNoClamp };\r\n\r\n   struct color_quad_u8\r\n   {\r\n      static inline int clamp(int v) { if (v & 0xFFFFFF00U) v = (~(static_cast<int>(v) >> 31)) & 0xFF; return v; }\r\n\r\n      struct component_traits { enum { cSigned = false, cFloat = false, cMin = 0U, cMax = 255U }; };\r\n\r\n   public:\r\n      typedef unsigned char component_t;\r\n      typedef int parameter_t;\r\n\r\n      enum { cNumComps = 4 };\r\n\r\n      union\r\n      {\r\n         struct\r\n         {\r\n            component_t r;\r\n            component_t g;\r\n            component_t b;\r\n            component_t a;\r\n         };\r\n\r\n         component_t c[cNumComps];\r\n\r\n         uint32 m_u32;\r\n      };\r\n\r\n      inline color_quad_u8()\r\n      {\r\n      }\r\n\r\n      inline color_quad_u8(const color_quad_u8& other) : m_u32(other.m_u32)\r\n      {\r\n      }\r\n\r\n      explicit inline color_quad_u8(parameter_t y, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         set(y, alpha);\r\n      }\r\n\r\n      inline color_quad_u8(parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         set(red, green, blue, alpha);\r\n      }\r\n\r\n      explicit inline color_quad_u8(eNoClamp, parameter_t y, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         set_noclamp_y_alpha(y, alpha);\r\n      }\r\n\r\n      inline color_quad_u8(eNoClamp, parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         set_noclamp_rgba(red, green, blue, alpha);\r\n      }\r\n\r\n      inline void clear()\r\n      {\r\n         m_u32 = 0;\r\n      }\r\n\r\n      inline color_quad_u8& operator= (const color_quad_u8& other)\r\n      {\r\n         m_u32 = other.m_u32;\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& set_rgb(const color_quad_u8& other)\r\n      {\r\n         r = other.r;\r\n         g = other.g;\r\n         b = other.b;\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& operator= (parameter_t y)\r\n      {\r\n         set(y, component_traits::cMax);\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& set(parameter_t y, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         y = clamp(y);\r\n         alpha = clamp(alpha);\r\n         r = static_cast<component_t>(y);\r\n         g = static_cast<component_t>(y);\r\n         b = static_cast<component_t>(y);\r\n         a = static_cast<component_t>(alpha);\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& set_noclamp_y_alpha(parameter_t y, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         RG_ETC1_ASSERT( (y >= component_traits::cMin) && (y <= component_traits::cMax) );\r\n         RG_ETC1_ASSERT( (alpha >= component_traits::cMin) && (alpha <= component_traits::cMax) );\r\n\r\n         r = static_cast<component_t>(y);\r\n         g = static_cast<component_t>(y);\r\n         b = static_cast<component_t>(y);\r\n         a = static_cast<component_t>(alpha);\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& set(parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha = component_traits::cMax)\r\n      {\r\n         r = static_cast<component_t>(clamp(red));\r\n         g = static_cast<component_t>(clamp(green));\r\n         b = static_cast<component_t>(clamp(blue));\r\n         a = static_cast<component_t>(clamp(alpha));\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& set_noclamp_rgba(parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha)\r\n      {\r\n         RG_ETC1_ASSERT( (red >= component_traits::cMin) && (red <= component_traits::cMax) );\r\n         RG_ETC1_ASSERT( (green >= component_traits::cMin) && (green <= component_traits::cMax) );\r\n         RG_ETC1_ASSERT( (blue >= component_traits::cMin) && (blue <= component_traits::cMax) );\r\n         RG_ETC1_ASSERT( (alpha >= component_traits::cMin) && (alpha <= component_traits::cMax) );\r\n\r\n         r = static_cast<component_t>(red);\r\n         g = static_cast<component_t>(green);\r\n         b = static_cast<component_t>(blue);\r\n         a = static_cast<component_t>(alpha);\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& set_noclamp_rgb(parameter_t red, parameter_t green, parameter_t blue)\r\n      {\r\n         RG_ETC1_ASSERT( (red >= component_traits::cMin) && (red <= component_traits::cMax) );\r\n         RG_ETC1_ASSERT( (green >= component_traits::cMin) && (green <= component_traits::cMax) );\r\n         RG_ETC1_ASSERT( (blue >= component_traits::cMin) && (blue <= component_traits::cMax) );\r\n\r\n         r = static_cast<component_t>(red);\r\n         g = static_cast<component_t>(green);\r\n         b = static_cast<component_t>(blue);\r\n         return *this;\r\n      }\r\n\r\n      static inline parameter_t get_min_comp() { return component_traits::cMin; }\r\n      static inline parameter_t get_max_comp() { return component_traits::cMax; }\r\n      static inline bool get_comps_are_signed() { return component_traits::cSigned; }\r\n\r\n      inline component_t operator[] (uint i) const { RG_ETC1_ASSERT(i < cNumComps); return c[i]; }\r\n      inline component_t& operator[] (uint i) { RG_ETC1_ASSERT(i < cNumComps); return c[i]; }\r\n\r\n      inline color_quad_u8& set_component(uint i, parameter_t f)\r\n      {\r\n         RG_ETC1_ASSERT(i < cNumComps);\r\n\r\n         c[i] = static_cast<component_t>(clamp(f));\r\n\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& clamp(const color_quad_u8& l, const color_quad_u8& h)\r\n      {\r\n         for (uint i = 0; i < cNumComps; i++)\r\n            c[i] = static_cast<component_t>(rg_etc1::clamp<parameter_t>(c[i], l[i], h[i]));\r\n         return *this;\r\n      }\r\n\r\n      inline color_quad_u8& clamp(parameter_t l, parameter_t h)\r\n      {\r\n         for (uint i = 0; i < cNumComps; i++)\r\n            c[i] = static_cast<component_t>(rg_etc1::clamp<parameter_t>(c[i], l, h));\r\n         return *this;\r\n      }\r\n\r\n   }; // class color_quad_u8\r\n\r\n   enum etc_constants\r\n   {\r\n      cETC1BytesPerBlock = 8U,\r\n\r\n      cETC1SelectorBits = 2U,\r\n      cETC1SelectorValues = 1U << cETC1SelectorBits,\r\n      cETC1SelectorMask = cETC1SelectorValues - 1U,\r\n\r\n      cETC1BlockShift = 2U,\r\n      cETC1BlockSize = 1U << cETC1BlockShift,\r\n\r\n      cETC1LSBSelectorIndicesBitOffset = 0,\r\n      cETC1MSBSelectorIndicesBitOffset = 16,\r\n\r\n      cETC1FlipBitOffset = 32,\r\n      cETC1DiffBitOffset = 33,\r\n\r\n      cETC1IntenModifierNumBits = 3,\r\n      cETC1IntenModifierValues = 1 << cETC1IntenModifierNumBits,\r\n      cETC1RightIntenModifierTableBitOffset = 34,\r\n      cETC1LeftIntenModifierTableBitOffset = 37,\r\n\r\n      // Base+Delta encoding (5 bit bases, 3 bit delta)\r\n      cETC1BaseColorCompNumBits = 5,\r\n      cETC1BaseColorCompMax = 1 << cETC1BaseColorCompNumBits,\r\n\r\n      cETC1DeltaColorCompNumBits = 3,\r\n      cETC1DeltaColorComp = 1 << cETC1DeltaColorCompNumBits,\r\n      cETC1DeltaColorCompMax = 1 << cETC1DeltaColorCompNumBits,\r\n\r\n      cETC1BaseColor5RBitOffset = 59,\r\n      cETC1BaseColor5GBitOffset = 51,\r\n      cETC1BaseColor5BBitOffset = 43,\r\n\r\n      cETC1DeltaColor3RBitOffset = 56,\r\n      cETC1DeltaColor3GBitOffset = 48,\r\n      cETC1DeltaColor3BBitOffset = 40,\r\n\r\n      cETC1AbsColor4R1BitOffset = 60,\r\n      cETC1AbsColor4G1BitOffset = 52,\r\n      cETC1AbsColor4B1BitOffset = 44,\r\n\r\n      cETC1AbsColor4R2BitOffset = 56,\r\n      cETC1AbsColor4G2BitOffset = 48,\r\n      cETC1AbsColor4B2BitOffset = 40,\r\n\r\n      // Delta3:\r\n      // 0   1   2   3   4   5   6   7\r\n      // 000 001 010 011 100 101 110 111\r\n      // 0   1   2   3   -4  -3  -2  -1\r\n   };\r\n   \r\n   static uint8 g_quant5_tab[256+16];\r\n\r\n   static const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues] = \r\n   { \r\n      { -8,  -2,   2,   8 }, { -17,  -5,  5,  17 }, { -29,  -9,   9,  29 }, {  -42, -13, 13,  42 }, \r\n      { -60, -18, 18,  60 }, { -80, -24, 24,  80 }, { -106, -33, 33, 106 }, { -183, -47, 47, 183 } \r\n   };\r\n\r\n   static const uint8 g_etc1_to_selector_index[cETC1SelectorValues] = { 2, 3, 1, 0 };\r\n      \r\n   struct etc1_block\r\n   {\r\n      // big endian uint64:\r\n      // bit ofs:  56  48  40  32  24  16   8   0\r\n      // byte ofs: b0, b1, b2, b3, b4, b5, b6, b7 \r\n      union \r\n      {\r\n         uint64 m_uint64;\r\n         uint8 m_bytes[8];\r\n      };\r\n\r\n      uint8 m_low_color[2];\r\n      uint8 m_high_color[2];\r\n\r\n      enum { cNumSelectorBytes = 4 };\r\n      uint8 m_selectors[cNumSelectorBytes];\r\n\r\n      inline uint get_byte_bits(uint ofs, uint num) const\r\n      {\r\n         RG_ETC1_ASSERT((ofs + num) <= 64U);\r\n         RG_ETC1_ASSERT(num && (num <= 8U));\r\n         RG_ETC1_ASSERT((ofs >> 3) == ((ofs + num - 1) >> 3));\r\n         const uint byte_ofs = 7 - (ofs >> 3);\r\n         const uint byte_bit_ofs = ofs & 7;\r\n         return (m_bytes[byte_ofs] >> byte_bit_ofs) & ((1 << num) - 1);\r\n      }\r\n\r\n      // false = left/right subblocks\r\n      // true = upper/lower subblocks\r\n      inline bool get_flip_bit() const \r\n      {\r\n         return (m_bytes[3] & 1) != 0;\r\n      }   \r\n\r\n      inline bool get_diff_bit() const\r\n      {\r\n         return (m_bytes[3] & 2) != 0;\r\n      }\r\n\r\n      // Returns intensity modifier table (0-7) used by subblock subblock_id.\r\n      // subblock_id=0 left/top (CW 1), 1=right/bottom (CW 2)\r\n      inline uint get_inten_table(uint subblock_id) const\r\n      {\r\n         RG_ETC1_ASSERT(subblock_id < 2);\r\n         const uint ofs = subblock_id ? 2 : 5;\r\n         return (m_bytes[3] >> ofs) & 7;\r\n      }\r\n\r\n      // Returned selector value ranges from 0-3 and is a direct index into g_etc1_inten_tables.\r\n      inline uint get_selector(uint x, uint y) const\r\n      {\r\n         RG_ETC1_ASSERT((x | y) < 4);\r\n\r\n         const uint bit_index = x * 4 + y;\r\n         const uint byte_bit_ofs = bit_index & 7;\r\n         const uint8 *p = &m_bytes[7 - (bit_index >> 3)];\r\n         const uint lsb = (p[0] >> byte_bit_ofs) & 1;\r\n         const uint msb = (p[-2] >> byte_bit_ofs) & 1;\r\n         const uint val = lsb | (msb << 1);\r\n\r\n         return g_etc1_to_selector_index[val];\r\n      }\r\n\r\n      inline uint16 get_base4_color(uint idx) const\r\n      {\r\n         uint r, g, b;\r\n         if (idx)\r\n         {\r\n            r = get_byte_bits(cETC1AbsColor4R2BitOffset, 4);\r\n            g = get_byte_bits(cETC1AbsColor4G2BitOffset, 4);\r\n            b = get_byte_bits(cETC1AbsColor4B2BitOffset, 4);\r\n         }\r\n         else\r\n         {\r\n            r = get_byte_bits(cETC1AbsColor4R1BitOffset, 4);\r\n            g = get_byte_bits(cETC1AbsColor4G1BitOffset, 4);\r\n            b = get_byte_bits(cETC1AbsColor4B1BitOffset, 4);\r\n         }\r\n         return static_cast<uint16>(b | (g << 4U) | (r << 8U));\r\n      }\r\n\r\n      inline uint16 get_base5_color() const\r\n      {\r\n         const uint r = get_byte_bits(cETC1BaseColor5RBitOffset, 5);\r\n         const uint g = get_byte_bits(cETC1BaseColor5GBitOffset, 5);\r\n         const uint b = get_byte_bits(cETC1BaseColor5BBitOffset, 5);\r\n         return static_cast<uint16>(b | (g << 5U) | (r << 10U));\r\n      }\r\n\r\n      inline uint16 get_delta3_color() const\r\n      {\r\n         const uint r = get_byte_bits(cETC1DeltaColor3RBitOffset, 3);\r\n         const uint g = get_byte_bits(cETC1DeltaColor3GBitOffset, 3);\r\n         const uint b = get_byte_bits(cETC1DeltaColor3BBitOffset, 3);\r\n         return static_cast<uint16>(b | (g << 3U) | (r << 6U));\r\n      }\r\n\r\n      static color_quad_u8 unpack_color5(uint16 packed_color5, bool scaled, uint alpha = 255U);\r\n      static void unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color, bool scaled);\r\n\r\n      static bool unpack_color5(color_quad_u8& result, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha = 255U);\r\n      static bool unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha = 255U);\r\n\r\n      // Results range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax)\r\n      static void unpack_delta3(int& r, int& g, int& b, uint16 packed_delta3);\r\n\r\n      static color_quad_u8 unpack_color4(uint16 packed_color4, bool scaled, uint alpha = 255U);\r\n      static void unpack_color4(uint& r, uint& g, uint& b, uint16 packed_color4, bool scaled);\r\n\r\n      // subblock colors\r\n      static void get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint table_idx);\r\n      static bool get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint16 packed_delta3, uint table_idx);\r\n      static void get_abs_subblock_colors(color_quad_u8* pDst, uint16 packed_color4, uint table_idx);\r\n\r\n      static inline void unscaled_to_scaled_color(color_quad_u8& dst, const color_quad_u8& src, bool color4)\r\n      {\r\n         if (color4)\r\n         {\r\n            dst.r = src.r | (src.r << 4);\r\n            dst.g = src.g | (src.g << 4);\r\n            dst.b = src.b | (src.b << 4);\r\n         }\r\n         else\r\n         {\r\n            dst.r = (src.r >> 2) | (src.r << 3);\r\n            dst.g = (src.g >> 2) | (src.g << 3);\r\n            dst.b = (src.b >> 2) | (src.b << 3);\r\n         }\r\n         dst.a = src.a;\r\n      }\r\n   };\r\n\r\n#undef RG_ETC1_GET_KEY\r\n#undef RG_ETC1_GET_KEY_FROM_INDEX\r\n\r\n   color_quad_u8 etc1_block::unpack_color5(uint16 packed_color5, bool scaled, uint alpha)\r\n   {\r\n      uint b = packed_color5 & 31U;\r\n      uint g = (packed_color5 >> 5U) & 31U;\r\n      uint r = (packed_color5 >> 10U) & 31U;\r\n\r\n      if (scaled)\r\n      {\r\n         b = (b << 3U) | (b >> 2U);\r\n         g = (g << 3U) | (g >> 2U);\r\n         r = (r << 3U) | (r >> 2U);\r\n      }\r\n\r\n      return color_quad_u8(cNoClamp, r, g, b, rg_etc1::minimum(alpha, 255U));\r\n   }\r\n\r\n   void etc1_block::unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, bool scaled)\r\n   {\r\n      color_quad_u8 c(unpack_color5(packed_color5, scaled, 0));\r\n      r = c.r;\r\n      g = c.g;\r\n      b = c.b;\r\n   }\r\n\r\n   bool etc1_block::unpack_color5(color_quad_u8& result, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha)\r\n   {\r\n      int dc_r, dc_g, dc_b;\r\n      unpack_delta3(dc_r, dc_g, dc_b, packed_delta3);\r\n      \r\n      int b = (packed_color5 & 31U) + dc_b;\r\n      int g = ((packed_color5 >> 5U) & 31U) + dc_g;\r\n      int r = ((packed_color5 >> 10U) & 31U) + dc_r;\r\n\r\n      bool success = true;\r\n      if (static_cast<uint>(r | g | b) > 31U)\r\n      {\r\n         success = false;\r\n         r = rg_etc1::clamp<int>(r, 0, 31);\r\n         g = rg_etc1::clamp<int>(g, 0, 31);\r\n         b = rg_etc1::clamp<int>(b, 0, 31);\r\n      }\r\n\r\n      if (scaled)\r\n      {\r\n         b = (b << 3U) | (b >> 2U);\r\n         g = (g << 3U) | (g >> 2U);\r\n         r = (r << 3U) | (r >> 2U);\r\n      }\r\n\r\n      result.set_noclamp_rgba(r, g, b, rg_etc1::minimum(alpha, 255U));\r\n      return success;\r\n   }\r\n\r\n   bool etc1_block::unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha)\r\n   {\r\n      color_quad_u8 result;\r\n      const bool success = unpack_color5(result, packed_color5, packed_delta3, scaled, alpha);\r\n      r = result.r;\r\n      g = result.g;\r\n      b = result.b;\r\n      return success;\r\n   }\r\n     \r\n   void etc1_block::unpack_delta3(int& r, int& g, int& b, uint16 packed_delta3)\r\n   {\r\n      r = (packed_delta3 >> 6) & 7;\r\n      g = (packed_delta3 >> 3) & 7;\r\n      b = packed_delta3 & 7;\r\n      if (r >= 4) r -= 8;\r\n      if (g >= 4) g -= 8;\r\n      if (b >= 4) b -= 8;\r\n   }\r\n\r\n   color_quad_u8 etc1_block::unpack_color4(uint16 packed_color4, bool scaled, uint alpha)\r\n   {\r\n      uint b = packed_color4 & 15U;\r\n      uint g = (packed_color4 >> 4U) & 15U;\r\n      uint r = (packed_color4 >> 8U) & 15U;\r\n\r\n      if (scaled)\r\n      {\r\n         b = (b << 4U) | b;\r\n         g = (g << 4U) | g;\r\n         r = (r << 4U) | r;\r\n      }\r\n\r\n      return color_quad_u8(cNoClamp, r, g, b, rg_etc1::minimum(alpha, 255U));\r\n   }\r\n   \r\n   void etc1_block::unpack_color4(uint& r, uint& g, uint& b, uint16 packed_color4, bool scaled)\r\n   {\r\n      color_quad_u8 c(unpack_color4(packed_color4, scaled, 0));\r\n      r = c.r;\r\n      g = c.g;\r\n      b = c.b;\r\n   }\r\n\r\n   void etc1_block::get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint table_idx)\r\n   {\r\n      RG_ETC1_ASSERT(table_idx < cETC1IntenModifierValues);\r\n      const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];\r\n\r\n      uint r, g, b;\r\n      unpack_color5(r, g, b, packed_color5, true);\r\n\r\n      const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);\r\n\r\n      const int y0 = pInten_modifer_table[0];\r\n      pDst[0].set(ir + y0, ig + y0, ib + y0);\r\n\r\n      const int y1 = pInten_modifer_table[1];\r\n      pDst[1].set(ir + y1, ig + y1, ib + y1);\r\n\r\n      const int y2 = pInten_modifer_table[2];\r\n      pDst[2].set(ir + y2, ig + y2, ib + y2);\r\n\r\n      const int y3 = pInten_modifer_table[3];\r\n      pDst[3].set(ir + y3, ig + y3, ib + y3);\r\n   }\r\n   \r\n   bool etc1_block::get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint16 packed_delta3, uint table_idx)\r\n   {\r\n      RG_ETC1_ASSERT(table_idx < cETC1IntenModifierValues);\r\n      const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];\r\n\r\n      uint r, g, b;\r\n      bool success = unpack_color5(r, g, b, packed_color5, packed_delta3, true);\r\n\r\n      const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);\r\n\r\n      const int y0 = pInten_modifer_table[0];\r\n      pDst[0].set(ir + y0, ig + y0, ib + y0);\r\n\r\n      const int y1 = pInten_modifer_table[1];\r\n      pDst[1].set(ir + y1, ig + y1, ib + y1);\r\n\r\n      const int y2 = pInten_modifer_table[2];\r\n      pDst[2].set(ir + y2, ig + y2, ib + y2);\r\n\r\n      const int y3 = pInten_modifer_table[3];\r\n      pDst[3].set(ir + y3, ig + y3, ib + y3);\r\n\r\n      return success;\r\n   }\r\n   \r\n   void etc1_block::get_abs_subblock_colors(color_quad_u8* pDst, uint16 packed_color4, uint table_idx)\r\n   {\r\n      RG_ETC1_ASSERT(table_idx < cETC1IntenModifierValues);\r\n      const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];\r\n\r\n      uint r, g, b;\r\n      unpack_color4(r, g, b, packed_color4, true);\r\n      \r\n      const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);\r\n\r\n      const int y0 = pInten_modifer_table[0];\r\n      pDst[0].set(ir + y0, ig + y0, ib + y0);\r\n      \r\n      const int y1 = pInten_modifer_table[1];\r\n      pDst[1].set(ir + y1, ig + y1, ib + y1);\r\n\r\n      const int y2 = pInten_modifer_table[2];\r\n      pDst[2].set(ir + y2, ig + y2, ib + y2);\r\n\r\n      const int y3 = pInten_modifer_table[3];\r\n      pDst[3].set(ir + y3, ig + y3, ib + y3);\r\n   }\r\n      \r\n   bool unpack_etc1_block(const void* pETC1_block, unsigned int* pDst_pixels_rgba, bool preserve_alpha)\r\n   {\r\n      color_quad_u8* pDst = reinterpret_cast<color_quad_u8*>(pDst_pixels_rgba);\r\n      const etc1_block& block = *static_cast<const etc1_block*>(pETC1_block);\r\n\r\n      const bool diff_flag = block.get_diff_bit();\r\n      const bool flip_flag = block.get_flip_bit();\r\n      const uint table_index0 = block.get_inten_table(0);\r\n      const uint table_index1 = block.get_inten_table(1);\r\n\r\n      color_quad_u8 subblock_colors0[4];\r\n      color_quad_u8 subblock_colors1[4];\r\n      bool success = true;\r\n\r\n      if (diff_flag)\r\n      {\r\n         const uint16 base_color5 = block.get_base5_color();\r\n         const uint16 delta_color3 = block.get_delta3_color();\r\n         etc1_block::get_diff_subblock_colors(subblock_colors0, base_color5, table_index0);\r\n            \r\n         if (!etc1_block::get_diff_subblock_colors(subblock_colors1, base_color5, delta_color3, table_index1))\r\n            success = false;\r\n      }\r\n      else\r\n      {\r\n         const uint16 base_color4_0 = block.get_base4_color(0);\r\n         etc1_block::get_abs_subblock_colors(subblock_colors0, base_color4_0, table_index0);\r\n\r\n         const uint16 base_color4_1 = block.get_base4_color(1);\r\n         etc1_block::get_abs_subblock_colors(subblock_colors1, base_color4_1, table_index1);\r\n      }\r\n\r\n      if (preserve_alpha)\r\n      {\r\n         if (flip_flag)\r\n         {\r\n            for (uint y = 0; y < 2; y++)\r\n            {\r\n               pDst[0].set_rgb(subblock_colors0[block.get_selector(0, y)]);\r\n               pDst[1].set_rgb(subblock_colors0[block.get_selector(1, y)]);\r\n               pDst[2].set_rgb(subblock_colors0[block.get_selector(2, y)]);\r\n               pDst[3].set_rgb(subblock_colors0[block.get_selector(3, y)]);\r\n               pDst += 4;\r\n            }\r\n\r\n            for (uint y = 2; y < 4; y++)\r\n            {\r\n               pDst[0].set_rgb(subblock_colors1[block.get_selector(0, y)]);\r\n               pDst[1].set_rgb(subblock_colors1[block.get_selector(1, y)]);\r\n               pDst[2].set_rgb(subblock_colors1[block.get_selector(2, y)]);\r\n               pDst[3].set_rgb(subblock_colors1[block.get_selector(3, y)]);\r\n               pDst += 4;\r\n            }\r\n         }\r\n         else\r\n         {\r\n            for (uint y = 0; y < 4; y++)\r\n            {\r\n               pDst[0].set_rgb(subblock_colors0[block.get_selector(0, y)]);\r\n               pDst[1].set_rgb(subblock_colors0[block.get_selector(1, y)]);\r\n               pDst[2].set_rgb(subblock_colors1[block.get_selector(2, y)]);\r\n               pDst[3].set_rgb(subblock_colors1[block.get_selector(3, y)]);\r\n               pDst += 4;\r\n            }\r\n         }\r\n      }\r\n      else \r\n      {\r\n         if (flip_flag)\r\n         {\r\n            // 0000\r\n            // 0000\r\n            // 1111\r\n            // 1111\r\n            for (uint y = 0; y < 2; y++)\r\n            {\r\n               pDst[0] = subblock_colors0[block.get_selector(0, y)];\r\n               pDst[1] = subblock_colors0[block.get_selector(1, y)];\r\n               pDst[2] = subblock_colors0[block.get_selector(2, y)];\r\n               pDst[3] = subblock_colors0[block.get_selector(3, y)];\r\n               pDst += 4;\r\n            }\r\n\r\n            for (uint y = 2; y < 4; y++)\r\n            {\r\n               pDst[0] = subblock_colors1[block.get_selector(0, y)];\r\n               pDst[1] = subblock_colors1[block.get_selector(1, y)];\r\n               pDst[2] = subblock_colors1[block.get_selector(2, y)];\r\n               pDst[3] = subblock_colors1[block.get_selector(3, y)];\r\n               pDst += 4;\r\n            }\r\n         }\r\n         else\r\n         {\r\n            // 0011\r\n            // 0011\r\n            // 0011\r\n            // 0011\r\n            for (uint y = 0; y < 4; y++)\r\n            {\r\n               pDst[0] = subblock_colors0[block.get_selector(0, y)];\r\n               pDst[1] = subblock_colors0[block.get_selector(1, y)];\r\n               pDst[2] = subblock_colors1[block.get_selector(2, y)];\r\n               pDst[3] = subblock_colors1[block.get_selector(3, y)];\r\n               pDst += 4;\r\n            }\r\n         }\r\n      }\r\n      \r\n      return success;\r\n   }\r\n         \r\n} // namespace rg_etc1\r\n"
  },
  {
    "path": "Engine/source/Assets/TextureManagement.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __TEXTURE_MGT__\r\n#define __TEXTURE_MGT__\r\n\r\n#include \"CKLBAsset.h\"\r\n\r\nclass KLBTextureAssetPlugin;\r\n\r\nclass CTexture;\r\nclass CTextureUsage;\r\nclass CKLBImageAsset;\r\n\r\n/*!\r\n* \\class CKLBTextureAsset\r\n* \\brief Texture Asset Class\r\n* \r\n* Texture asset is a texture that describes a 2D texture uploaded to the GPU.\r\n* Inside a texture asset file, we also store a list of 2D models.\r\n* A 2D model is a list vertices and related indexes for rendering triangles. \r\n*/\r\nclass CKLBTextureAsset : public CKLBAbstractAsset {\r\n\tfriend class KLBTextureAssetPlugin;\r\npublic:\r\n\r\n\tCKLBTextureAsset();\r\n\t~CKLBTextureAsset();\r\n\r\n\tvirtual\tASSET_TYPE\tgetAssetType()\t{ return ASSET_TEXTURE;\t\t}\r\n\tvirtual u32\t\t\tgetClassID\t()\t{ return CLS_ASSETTEXTURE;  }\r\n\r\n\t/* NO DICO\r\n\tvirtual bool\tinclude\t\t\t\t(const char* name);*/\r\n\tvirtual void unloadRessource();\r\n\r\n\tvirtual void onRegisterSubAsset\t\t();\r\n\tvirtual void onUnregisterSubAsset\t();\r\n\r\n\tCKLBImageAsset*\t\tgetImage\t\t(const char* fileName);\r\n\r\n\tu16\t\t\t\t\tm_width;\r\n\tu16\t\t\t\t\tm_height;\r\n\tu16\t\t\t\t\tm_type;\r\n\tu32\t\t\t\t\tm_totalVertexCount;\r\n\tu32\t\t\t\t\tm_totalIndexCount;\r\n\tu16\t\t\t\t\tm_imageCount;\r\n\tvoid*\t\t\t\tm_bitmap;\r\n\tu16*\t\t\t\tm_indexBufferTotal;\r\n\tfloat*\t\t\t\tm_floatBufferTotal;\r\n\tCTexture*\t\t\tm_pTexture;\r\n\tCTextureUsage*\t\tm_pTextureUsage;\r\n\tCKLBImageAsset**\tm_pImages;\r\n\tu8*\t\t\t\t\tm_softTexture;\r\n\tu8\t\t\t\t\tm_bytePerPix;\r\n};\r\n\r\nstruct SKLBRect {\r\npublic:\r\n\ts16\tm_iLeft;\r\n\ts16 m_iRight;\r\n\ts16 m_iTop;\r\n\ts16 m_iBottom;\r\n\r\n\tinline\r\n\ts32 getWidth() {\treturn m_iRight - m_iLeft; }\r\n\r\n\tinline\r\n\ts32 getHeight() {\treturn m_iBottom - m_iTop; }\r\n};\r\n\r\n/*!\r\n* \\class CKLBImageAsset\r\n* \\brief Image Asset Class\r\n* \r\n* CKLBImageAsset is a basic asset for image rendering.\r\n* It uses a CKLBTextureAsset.\r\n* There are also various attributes that are stored within an image asset.\r\n*/\r\nclass CKLBImageAsset : public CKLBAsset {\r\n\tfriend class KLBTextureAssetPlugin;\r\npublic:\r\n\tstatic const u8\t\tIS_STANDARD_RECT\t= 0x1;\r\n\tstatic const u8\t\tIS_SCALE9\t\t\t= 0x2;\r\n\tstatic const u8\t\tIS_SCROLLBARTYPE\t= 0x4;\r\n\tstatic const u8\t\tIS_3DMODEL\t\t\t= 0x8;\r\n\r\n\tstatic CKLBNode*\tcreateSprite\t(\tu32 textureHandle,\r\n\t\t\t\t\t\t\t\t\t\t\tconst char* imageName,\r\n\t\t\t\t\t\t\t\t\t\t\tCKLBNode* pParentNode,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 renderPriority);\r\n\r\n\tCKLBImageAsset();\r\n\t~CKLBImageAsset();\r\n\r\n\tvirtual CKLBNode*\tcreateSubTree\t(u32 priorityBase = 0);\r\n\tvirtual u32\t\t\tgetClassID\t\t()\t\t{ return CLS_ASSETIMAGE;\t}\r\n\tvirtual\tASSET_TYPE\tgetAssetType\t()\t\t{ return ASSET_IMAGE;\t\t}\r\n\r\n\tinline\r\n\tu32\t\t\t\t\tgetVertexCount\t()\t\t{ return m_uiVertexCount;\t}\r\n\r\n\tinline\r\n\tu32\t\t\t\t\tgetIndexCount\t()\t\t{ return m_uiIndexCount;\t}\r\n\r\n\tCKLBTextureAsset*\tgetTexture\t\t()\t\t{ return m_pTextureAsset;\t}\t\r\n\r\n\tinline\r\n\tSKLBRect*\t\t\tgetSize\t\t\t()\t\t{ return &m_imageSize;\t\t}\r\n\r\n\tvoid\t\t\t\tsetSubImage\t\t(u32 width, u32 height, u32 offX, u32 offY);\r\n\tCKLBImageAsset*\t\tfindSub\t\t\t(u32 index);\r\n\r\n\tvoid\t\t\t\taddSubImage\t\t(CKLBImageAsset* pImage);\r\n\r\n\t/** Warning : the asset pointer is not managed and becomes the responsability of the owner. */\r\n\tCKLBImageAsset*\t\tgetSubImage\t\t(u32 index, CKLBImageAsset* replaceAsset = NULL);\r\n\r\n\tvoid\t\t\t\tgetCenter\t\t(s32& cx, s32& cy);\r\n\tCKLBImageAsset*\t\tgetAsTopLeftImage(s32 offX, s32 offY);\r\n\r\n\tinline\r\n\tu16*\t\t\t\tgetIndexBuffer\t()\t{ return m_pIndex;\t\t}\r\n\r\n\tinline\r\n\tfloat*\t\t\t\tgetUVBuffer\t\t()\t{ return m_pUVCoord;\t}\r\n\r\n\tinline\r\n\tfloat*\t\t\t\tgetXYBuffer\t\t()\t{ return m_pXYCoord;\t}\r\n\r\n\tvoid\t\t\t\tgetXY(u32 vertexIndex, float* pX, float* pY);\r\n\tvoid\t\t\t\tgetUV(u32 vertexIndex, float* pU, float* pV);\r\n\r\n\tbool\t\t\t\tgetAttribute(u8 attribID, s32& attribValue);\r\n\tbool\t\t\t\tgetAttribute(u8 attribID, float& attribValue);\r\n\tbool\t\t\t\tgetAttribute(u8 attribID, const char*& attribValue);\r\n\r\n\tinline u8\t\t\thasStandardAttribute(u8 mask)\t{ return m_usageType & mask; }\r\npublic:\r\n\tASSET_ATTRIB*\t\tm_attribList;\r\n\r\n\tu16*\t\t\t\tm_pIndex;\r\n\tfloat*\t\t\t\tm_pUVCoord;\r\n\tfloat*\t\t\t\tm_pXYCoord;\r\n\r\n\tCKLBTextureAsset*\tm_pTextureAsset;\r\n\r\n\tCKLBImageAsset*\t\tm_subTiles;\r\n\tCKLBImageAsset*\t\tm_nextSubTile;\r\n\r\n\tSKLBRect\t\t\tm_imageSize;\t// Original image size\r\n\tfloat\t\t\t\tm_boundWidth;\r\n\tfloat\t\t\t\tm_boundHeight;\r\n\ts32\t\t\t\t\tm_renderOffset;\r\n\r\n\ts16\t\t\t\t\tm_subIndex;\r\n\r\n\ts16\t\t\t\t\tm_iCenterX;\r\n\ts16\t\t\t\t\tm_iCenterY;\r\n\r\n\tu16\t\t\t\t\tm_uiVertexCount;\r\n\tu16\t\t\t\t\tm_uiIndexCount;\r\n\r\n\r\n\tu16\t\t\t\t\tm_attribMask;\r\n\tu16\t\t\t\t\tm_attribCount;\r\n\tu16\t\t\t\t\tm_tileWidth;\r\n\tu16\t\t\t\t\tm_tileHeight;\r\n\tu16\t\t\t\t\tm_tileOffX;\r\n\tu16\t\t\t\t\tm_tileOffY;\r\n\tu16\t\t\t\t\tm_tileCount;\r\n\tu16\t\t\t\t\tm_uiSubTileCount;\r\n\tu8\t\t\t\t\tm_usageType;\r\n\tbool\t\t\t\tm_bAllocatedOutsideTexture;\r\nprivate:\r\n\tCKLBImageAsset*\t\tm_topLeftImage;\r\n};\r\n\r\nenum E_TEXTURELOADINGMODE {\r\n\tTEX_LOAD_GPU,\r\n\tTEX_LOAD_CPU,\r\n\tTEX_LOAD_GPUCPU\r\n};\r\n\r\n/*!\r\n* \\class KLBTextureAssetPlugin\r\n* \\brief Texture Asset Plugin Class\r\n* \r\n* Plugin responsible for loading texture and images inside texture.\r\n* See CKLBTextureAsset and CKLBImageAsset.\r\n*/\r\nclass KLBTextureAssetPlugin : public IKLBAssetPlugin {\r\npublic:\r\n\tKLBTextureAssetPlugin();\r\n\t~KLBTextureAssetPlugin();\r\n\r\n\tvoid\tsetLoadingMode(E_TEXTURELOADINGMODE mode);\r\n\tu8*\t\tcreateSoftTexture\t(\ts32 width, \r\n\t\t\t\t\t\t\t\t\ts32 height, \r\n\t\t\t\t\t\t\t\t\tu32 pixelFormat, \r\n\t\t\t\t\t\t\t\t\tu8 channelCount, \r\n\t\t\t\t\t\t\t\t\tvoid* data );\r\n\r\n\tvirtual u32\t\t\t\t\tgetChunkID\t\t()\t\t\t{ return CHUNK_TAG('T','E','X','B'); }\r\n\tvirtual\tu8\t\t\t\t\tcharHeader\t\t()\t\t\t{ return 'T';\t\t\t}\r\n\tvirtual const char*\t\t\tfileExtension\t()\t\t\t{ return \".texb\"; }\r\n\r\n\tvirtual CKLBAbstractAsset*\tloadAsset(u8* stream, u32 streamSize);\r\n\tvirtual void\t\t\t\tsetCurrentFileName(const char* currentFileName) {\r\n\t\tm_currentFile = currentFileName;\r\n\t}\r\n\r\n\tvoid\t\t\t\tsetBuffers\t\t(CKLBTextureAsset*\tpTextureAsset, float* uvBuffer, float* xyBuffer, u16* indexBuffer);\r\n\tCKLBImageAsset*\t\tloadImage\t\t(u8* stream, u32 streamSize, CKLBImageAsset* pReload);\r\n\tvoid\t\t\t\tsetQuarterTexture(bool activate) {\r\n\t\tm_useQuarterTexture = activate;\r\n\t}\r\nprivate:\r\n\tfloat*\t\t\t\tm_pUVBuffer;\r\n\tfloat*\t\t\t\tm_pXYBuffer;\r\n\tfloat*\t\t\t\tm_pLastLoadedUV;\r\n\tu16*\t\t\t\tm_pLastLoadedIndex;\r\n\tu16*\t\t\t\tm_pIndexBuffer;\r\n\tCKLBTextureAsset*\tm_pTextureAsset;\r\n\tconst char*\t\t\tm_currentFile;\r\n\tbool\t\t\t\tm_loadHardware;\r\n\tbool\t\t\t\tm_loadSoftware;\r\n\tbool\t\t\t\tm_useQuarterTexture;\r\n};\r\n\r\nbool createScreenAsset\t(const char* name, u32 orgWidthI, u32 orgHeightI);\r\nbool doScreenShot\t\t(const char* name, u32 srcx, u32 srcy, u32 width, u32 height, u32 dstx, u32 dsty);\r\nvoid freeScreenAsset\t(const char* name);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/ArrayAllocator.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __ARRAY_ALLOCATOR_KLB_H_\r\n#define __ARRAY_ALLOCATOR_KLB_H_\r\n\r\n#include \"BaseType.h\"\r\n\r\ntemplate <class T>\r\nclass ArrayAllocator {\r\nprotected:\r\n\tstruct ArrayItem {\r\n\tpublic:\r\n\t\tArrayItem () {}\r\n\t\t~ArrayItem() {}\r\n\r\n\t\tT \tentry;\r\n\t\tu16\tnext;\r\n\t\tu16 prev;\r\n\t};\r\nprivate:\r\n\tstruct AllocatorContext {\r\n\t\tAllocatorContext*\tm_next;\r\n\t\tArrayItem*\t\t\tm_array;\r\n\t\tu32\t\t\t\t\tm_allocated;\r\n\t\tu32\t\t\t\t\tm_arrayCount;\r\n\t\tu32\t\t\t\t\tm_freeList;\r\n\t\tu32\t\t\t\t\tm_usedList;\r\n\r\n\t\tT* allocEntry() {\r\n\t\t\tif (m_freeList == NULL_IDX) {\r\n\t\t\t\tklb_assertAlways(\"Allocator Full\");\r\n\t\t\t\treturn NULL;\r\n\t\t\t} else {\r\n\t\t\t\tm_allocated++;\r\n\r\n\t\t\t\tu16 newItem = m_freeList;\r\n\t\t\r\n\t\t\t\t// Remove from free list.\r\n\t\t\t\tm_freeList\t= m_array[newItem].next;\r\n\t\t\t\tif (m_freeList != NULL_IDX) {\tm_array[m_freeList].prev = NULL_IDX;\t}\r\n\t\t\r\n\t\t\t\t// Add to used list.\r\n\t\t\t\tm_array[newItem].next = m_usedList;\r\n\t\t\t\tm_array[newItem].prev = NULL_IDX;\r\n\t\t\t\tif (m_usedList != NULL_IDX) {\tm_array[m_usedList].prev = newItem;\t\t}\r\n\t\t\t\tm_usedList = newItem;\r\n\t\t\t\treturn &m_array[newItem].entry;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvoid freeEntry(T* entry) {\r\n\t\t\tif (!entry)\t{ return ;}\t// Safe delete\r\n\t\t\tArrayItem* pItem = (ArrayItem*)entry;\r\n\t\r\n\t\t\tm_allocated--;\r\n\r\n\t\t\t//\r\n\t\t\t// Remove from active list\r\n\t\t\t//\r\n\t\t\tif (pItem->prev != NULL_IDX) {\r\n\t\t\t\tm_array[pItem->prev].next = pItem->next;\r\n\t\t\t} else {\r\n\t\t\t\tm_usedList = pItem->next;\r\n\t\t\t}\r\n\t\r\n\t\t\tif (pItem->next != NULL_IDX) {\r\n\t\t\t\tm_array[pItem->next].prev = pItem->prev;\r\n\t\t\t}\r\n\t\r\n\t\t\t//\r\n\t\t\t// Add to free list\r\n\t\t\t//\r\n\t\t\tu16 idx = pItem - m_array;\r\n\t\t\tif (m_freeList != NULL_IDX) {\r\n\t\t\t\tm_array[m_freeList].prev = idx;\r\n\t\t\t}\r\n\t\r\n\t\t\tpItem->next = m_freeList;\r\n\t\t\tpItem->prev = NULL_IDX;\r\n\r\n\t\t\t// Position.\r\n\t\t\tm_freeList = idx;\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tAllocatorContext m_defaultSlot;\r\n\tu16\t\t\t\t m_extendSize;\r\npublic:\r\n\tArrayAllocator()\r\n\t{\r\n\t\tm_defaultSlot.m_next\t\t= NULL;\r\n\t\tm_defaultSlot.m_array\t\t= NULL;\r\n\t\tm_defaultSlot.m_freeList\t= NULL_IDX;\r\n\t\tm_defaultSlot.m_usedList\t= NULL_IDX;\r\n\t\tm_defaultSlot.m_arrayCount\t= 0;\r\n\t}\r\n\r\n\t~ArrayAllocator()\r\n\t{\r\n\t\trelease();\r\n\t}\r\n\t\r\n\tbool addSlot(u32 entryCount, AllocatorContext* pSlot) {\r\n\t\tpSlot->m_array = (ArrayItem*)KLBNEWA(u8, entryCount*sizeof(ArrayItem));\r\n\t\tif (pSlot->m_array) {\r\n\t\t\tpSlot->m_arrayCount  = entryCount;\r\n\t\t\tpSlot->m_allocated\t = 0;\r\n\r\n\t\t\tfor (u32 n=0; n < entryCount; n++) {\r\n\t\t\t\tpSlot->m_array[n].next = n+1;\r\n\t\t\t\tpSlot->m_array[n].prev = n-1;\r\n\t\t\t}\r\n\t\t\r\n\t\t\tpSlot->m_array[0].prev\t\t\t\t= NULL_IDX;\r\n\t\t\tpSlot->m_array[entryCount-1].next\t= NULL_IDX;\r\n\t\t\tpSlot->m_freeList\t\t\t\t\t= 0;\r\n\t\t\tpSlot->m_usedList\t\t\t\t\t= NULL_IDX;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tbool init(u16 entryCount) {\r\n\t\tm_extendSize = entryCount / 3;\r\n\t\treturn addSlot(entryCount, &m_defaultSlot);\r\n\t}\r\n\r\n\tvoid release() {\r\n\t\tAllocatorContext* pContext = &m_defaultSlot;\r\n\t\twhile (pContext) {\r\n\t\t\tKLBDELETEA((u8*)pContext->m_array);\r\n\t\t\tpContext->m_array = NULL;\r\n\t\t\tpContext = pContext->m_next;\r\n\t\t}\r\n\r\n\t\t// Destroy sub slot struct.\r\n\t\tpContext = m_defaultSlot.m_next;\r\n\t\twhile (pContext) {\r\n\t\t\tAllocatorContext* pNext = pContext->m_next;\r\n\t\t\tKLBDELETE(pContext);\r\n\t\t\tpContext = pNext;\r\n\t\t}\r\n\t}\r\n\t\r\n\tT* allocEntry() {\r\n\t\t// 1. Find first slot with free item\r\n\t\tAllocatorContext* pContext\t\t= &m_defaultSlot;\r\n\t\tAllocatorContext* pPrevContext\t= NULL;\r\n\t\twhile (pContext) {\r\n\t\t\tif (pContext->m_freeList != NULL_IDX) {\r\n\t\t\t\treturn pContext->allocEntry();\r\n\t\t\t}\r\n\t\t\tpPrevContext = pContext;\r\n\t\t\tpContext = pContext->m_next;\r\n\t\t}\r\n\t\t\r\n\t\t// 2. If none found, create new lost and allocated item.\r\n\t\tpPrevContext->m_next = KLBNEW(AllocatorContext);\r\n\t\tif (pPrevContext->m_next) {\r\n\t\t\tpContext = pPrevContext->m_next;\r\n\t\t\tif (addSlot(m_extendSize, pContext)) {\r\n\t\t\t\treturn pContext->allocEntry();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\tvoid freeEntry(T* entry) {\r\n\t\t// 1.Find from which slot it has been allocated.\r\n\t\tAllocatorContext* pContext\t\t= &m_defaultSlot;\r\n\t\tAllocatorContext* pPrevContext\t= NULL;\r\n\t\twhile (pContext) {\r\n\t\t\tArrayItem*\tstart = pContext->m_array;\r\n\t\t\tArrayItem*  end   = &start[pContext->m_arrayCount];\r\n\t\t\tif (((void*)entry >= (void*)start) && ((void*)entry < (void*)end)) {\r\n\t\t\t\t// Found slot\r\n\t\t\t\tpContext->freeEntry(entry);\r\n\t\t\t\t// 2.If counter reach zero AND is NOT default slot, remove from list and destroy slot.\r\n\t\t\t\tif ((pContext->m_allocated == 0) && (pContext != &m_defaultSlot)) {\r\n\t\t\t\t\t// Remove from slot list\r\n\t\t\t\t\tpPrevContext->m_next = pContext->m_next;\r\n\t\t\t\t\t// Remove array\r\n\t\t\t\t\tKLBDELETEA((u8*)pContext->m_array);\r\n\t\t\t\t\t// Remove slot\r\n\t\t\t\t\tKLBDELETE(pContext);\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tpPrevContext\t= pContext;\r\n\t\t\tpContext\t\t= pContext->m_next;\r\n\t\t}\r\n\r\n\t}\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAction.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Structure used for transmitting events inside the game ===\r\n//\r\n//\r\n\r\n#ifndef __KLB_ACTION__\r\n#define __KLB_ACTION__\r\n\r\n#include \"CKLBObject.h\"\r\n\r\nenum ACTION_TYPE {\r\n\tACTION_UNDEF\t\t\t= 0,\r\n\tACTION_PUSH\t\t\t\t= 1,\r\n\tACTION_RELEASE\t\t\t= 2,\t// Param 0 : Ok, 1 : Cancel\r\n\tACTION_CLICK\t\t\t= 3,\r\n\tACTION_CHANGE\t\t\t= 4,\t// 1 : Select, 0 : Unselect\r\n\tACTION_CLOSE\t\t\t= 5,\r\n\tACTION_ENDANIM\t\t\t= 6,\r\n\tACTION_FOCUS\t\t\t= 7,\r\n\tACTION_STATECHANGE\t\t= 8,\r\n\tACTION_CUSTOM\t\t\t= 0x10\r\n};\r\n\r\n/**\r\n\tAction is an event class used by the application\r\n\tfor transmitting events / asynchronously perform function call.\r\n */\r\nclass CKLBAction {\r\npublic:\r\n\t/**\r\n\t\t- Key Event\r\n\t\t- Touch Event\r\n\t\t- UI event forwarding\t(close, focus, etc...)\r\n\t\t- Custom Game event forwarding\t(attack, move, etc...)\r\n\t */\r\n\tu32\t\t\t\tm_actionType;\r\n\tu32\t\t\t\tm_timeOffset;\r\n\ts32\t\t\t\tm_parameter;\r\n\tCKLBObject*\t\tm_pSource;\r\n\tCKLBObject*\t\tm_pTarget;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAppProperty.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBAppProperty.h\"\r\n#include \"CPFInterface.h\"\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t// プロパティインデックス値\r\n\t{ \"APP_SCRN_TYPE\", (int)CKLBAppProperty::SCRN_TYPE },\t// 画面の使い方\r\n\r\n\t// プロパティに与える値: APP_SCRN_TYPE 用\r\n\t{ \"LANDSCAPE\",\tIClientRequest::LANDSCAPE },\r\n\t{ \"PORTRAIT\",\tIClientRequest::PORTRAIT },\r\n\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBAppScriptIF factory(\"APP_Property\", CLS_KLBAPPPROP, cmd);\r\n\r\n\r\nCKLBAppProperty::CKLBAppProperty()\r\n{\r\n\tfor(int i = 0; i < PIDX_MAX; i++) { \r\n        m_value[i] = -1;\r\n    }\r\n}\r\n\r\nCKLBAppProperty::~CKLBAppProperty() {}\r\n\r\nCKLBAppProperty&\r\nCKLBAppProperty::getInstance()\r\n{\r\n\tstatic CKLBAppProperty instance;\r\n\treturn instance;\r\n}\r\n\r\nint\r\nCKLBAppProperty::getValue(PIDX idx)\r\n{\r\n\treturn m_value[ idx ];\r\n}\r\n\r\nbool\r\nCKLBAppProperty::setValue(PIDX idx, int value)\r\n{\r\n\tif(idx < 0 || idx >= PIDX_MAX) return false;\r\n\tm_value[idx] = value;\r\n\treturn true;\r\n}\r\n\r\n\r\nCKLBAppScriptIF::CKLBAppScriptIF(const char * funcname, u32 classID, DEFCMD * arrCmdItem)\r\n{\r\n\taddLink(funcname, setValue, arrCmdItem, classID);\r\n}\r\n\r\nCKLBAppScriptIF::~CKLBAppScriptIF() {}\r\n\r\nint\r\nCKLBAppScriptIF::setValue(lua_State * L)\r\n{\r\n\tCKLBAppProperty::PIDX pidx = (CKLBAppProperty::PIDX)lua_tointeger(L, 1);\r\n\tint value = lua_tointeger(L, 2);\r\n\r\n\tint result = CKLBAppProperty::getInstance().setValue(pidx, value);\r\n\r\n\tlua_pushboolean(L, result);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAppProperty.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBAppProperty_h\r\n#define CKLBAppProperty_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n\r\n\r\nclass CKLBAppProperty\r\n{\r\nprivate:\r\n\tCKLBAppProperty();\r\n\tvirtual ~CKLBAppProperty();\r\npublic:\r\n\tenum PIDX {\r\n\t\tSCRN_TYPE\t= 0,\t// Screen Type (LANDSCAPE or PORTRAIT or -1)\r\n\r\n\t\tPIDX_MAX\r\n\t};\r\n\r\n\tstatic CKLBAppProperty& getInstance();\r\n\r\n\tint  getValue(PIDX idx);\r\n\tbool setValue(PIDX idx, int value);\r\n\r\nprivate:\r\n\tint\t\tm_value[ PIDX_MAX ];\r\n};\r\n\r\nclass CKLBAppScriptIF : public IFactory\r\n{\r\npublic:\r\n\tCKLBAppScriptIF(const char * funcname, u32 classID, DEFCMD * arrCmdItem);\r\n\tvirtual ~CKLBAppScriptIF();\r\n\r\n\tstatic int setValue(lua_State * L);\r\n};\r\n\r\n#endif // CKLBAppProperty_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAsyncFilecopy.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBAsyncFilecopy.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n;\r\nstatic CKLBTaskFactory<CKLBAsyncFilecopy> factory(\"UTIL_AsyncFilecopy\", CLS_KLBASYNCFILECOPY);\r\n\r\n#define NO_ERROR\t\t\t(0)\r\n#define ERROR_SETUP\t\t\t(1)\r\n#define ERROR_DURINGCOPY\t(2)\r\n\r\n#define ERROR_SRCFILEERR\t(0x10)\r\n#define ERROR_DSTFILEERR\t(0x20)\r\n#define ERROR_NAMING\t\t(0x30)\r\n\r\nCKLBAsyncFilecopy::CKLBAsyncFilecopy() \r\n:CKLBLuaPropTask\t()\r\n,m_callback\t\t\t(NULL)\r\n,m_thread\t\t\t(NULL)\r\n,m_fileNameSrc\t\t(NULL)\r\n,m_fileNameDst\t\t(NULL)\r\n,m_done\t\t\t\t(0)\r\n,m_error\t\t\t(NO_ERROR)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBAsyncFilecopy::~CKLBAsyncFilecopy() {\r\n}\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBAsyncFilecopy::ms_propItems[] = {\r\n\t{\t\"progress\",\tR_UINTEGER,\tNULL,\t(getBoolT)&CKLBAsyncFilecopy::getProcessCount,\t0\t},\r\n\t{\t\"error\",\tR_UINTEGER,\tNULL,\t(getBoolT)&CKLBAsyncFilecopy::getError,\t\t\t0\t},\r\n};\r\n\r\nenum {\r\n\tARG_FILENAMESRC = 1,\r\n\tARG_FILENAMEDST,\r\n\tARG_CALLBACK,\t\t            // Function name for callback\r\n\tARG_REQUIRE\t\t= ARG_CALLBACK,\t\r\n\tARG_NUMS\t\t= ARG_CALLBACK\r\n};\r\n\r\nu32\r\nCKLBAsyncFilecopy::getClassID()\r\n{\r\n\treturn CLS_KLBASYNCFILECOPY;\r\n}\r\n\r\nconst char* \r\nextractName(const char* fullpath) {\r\n\tu32 buffLen\t= strlen((const char*)fullpath);\r\n\ts32 len\t\t= buffLen-1;\r\n\r\n\t// Start from end rollback to start.\r\n\twhile (len >= 0) {\r\n\t\tif ((fullpath[len] == '/') || (fullpath[len] == '\\\\')) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tlen--;\r\n\t}\r\n\tlen++; // Start from next char : skip '/' or previous char (len < 0)\r\n\r\n\tfullpath = &fullpath[len];\r\n\treturn fullpath;\r\n}\r\n\r\n/*static*/\r\ns32 \r\nCKLBAsyncFilecopy::ThreadLoader(void * /* hThread */, void * data)\r\n{\r\n\tCKLBAsyncFilecopy* p\t\t\t= (CKLBAsyncFilecopy*)data;\r\n\r\n\tu8 block[4096];\t// 4 KB Page\r\n\t\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\t\r\n\t// Open Source\r\n\tIReadStream* pSrc\t= NULL;\r\n\tif (p->m_fileNameSrc) {\r\n\t\tpSrc = pfif.openReadStream(p->m_fileNameSrc, pfif.useEncryption());\r\n\t}\r\n\r\n\t// Create Tmp\r\n\tITmpFile* pDest\t\t= NULL;\r\n\tif (p->m_fileNameDst) {\r\n\t\t// Force deletion if file exist.\r\n\t\tpfif.removeTmpFile(p->m_fileNameDst);\r\n\t\t// Create new file.\r\n\t\tpDest = pfif.openTmpFile(p->m_fileNameDst);\r\n\t}\r\n\t\r\n\tif (pSrc && (pSrc->getStatus() == IReadStream::NORMAL) && pDest && (p->m_error == 0)) {\r\n\t\t// Success both ?\r\n\t\tp->m_doneSize\t= 0;\r\n\t\tp->m_done\t\t= 0;\r\n\r\n\t\tu32 toCopy = pSrc->getSize();\r\n\t\tu32 fullSize = toCopy;\r\n\t\t\r\n\t\twhile (toCopy) {\r\n\t\t\tu32 size;\r\n\r\n\t\t\tif (toCopy >= 4096) {\r\n\t\t\t\tsize = 4096;\r\n\t\t\t\ttoCopy -= size;\r\n\t\t\t} else {\r\n\t\t\t\tsize = toCopy;\r\n\t\t\t\ttoCopy = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tbool readOK\t\t= pSrc->readBlock(block, size);\r\n\t\t\tu32  writeSize\t= pDest->writeTmp(block, size);\r\n\t\t\t\r\n\t\t\tif (readOK && (writeSize == size)) { \r\n\t\t\t\tp->m_doneSize += size;\r\n\t\t\t\tp->m_done = (p->m_doneSize * 100) / fullSize;\r\n\t\t\t} else {\r\n\t\t\t\ttoCopy = 0;\r\n\t\t\t\tp->m_error |= ERROR_DURINGCOPY;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (p->m_error & ERROR_DURINGCOPY) {\r\n\t\t\tpfif.removeTmpFile(p->m_fileNameDst);\r\n\t\t}\r\n\t} else {\r\n\t\tp->m_error |= ERROR_SETUP;\t\r\n\t\tif (!pSrc) {\r\n\t\t\tp->m_error |= ERROR_SRCFILEERR;\r\n\t\t} else if (pSrc->getStatus() != IReadStream::NORMAL) {\r\n\t\t\tp->m_error |= ERROR_SRCFILEERR;\r\n\t\t}\r\n\t\t\r\n\t\tif (!pDest) {\r\n\t\t\tp->m_error |= ERROR_DSTFILEERR;\r\n\t\t}\r\n\t}\r\n\r\n\tif (pSrc)\t{ delete pSrc;  }\r\n\tif (pDest)\t{ delete pDest; }\r\n\r\n\treturn 0;\r\n}\r\n\r\nCKLBAsyncFilecopy*\r\nCKLBAsyncFilecopy::create(CKLBTask* pParentTask, const char* filesource, const char* filedest, const char* callback) {\r\n\tCKLBAsyncFilecopy* pTask = KLBNEW(CKLBAsyncFilecopy);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, filesource, filedest, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBAsyncFilecopy::init(CKLBTask* pTask, const char* filesource, const char* filedest, const char* callback) {\r\n\tsetStrC(m_callback,callback);\r\n\r\n\tif(!m_callback) return false;\r\n\r\n\t// Properties definition\r\n\tif(!setupPropertyList((const char**)CKLBAsyncFilecopy::ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_done\t= 0;\r\n\tm_error\t= 0;\r\n\r\n\t// Error setup :\r\n\t// - Dest or src are null ?\r\n\tconst char* nameDst = NULL;\r\n\tif (filedest) {\r\n\t\tnameDst = extractName(filedest);\r\n\t}\r\n\r\n\tconst char* nameSrc = NULL;\r\n\tif (filesource) {\r\n\t\tnameSrc = extractName(filesource);\r\n\t}\r\n\r\n\tif (!nameDst) {\r\n\t\tm_fileNameDst = NULL;\r\n\t\tm_error\t\t|= ERROR_SETUP | ERROR_NAMING | ERROR_DSTFILEERR;\r\n\t} else if (!nameSrc) {\r\n\t\tm_fileNameDst = NULL;\r\n\t\tm_error\t\t|= ERROR_SETUP | ERROR_NAMING | ERROR_SRCFILEERR;\r\n\t} else {\r\n\t\tif ((strcmp(nameSrc, nameDst) == 0) \r\n\t\t\t&& (strncmp(filesource, \"file://install/\" , 15) == 0)\r\n\t\t\t&& (strncmp(filedest  , \"file://external/\", 16) == 0)) {\r\n\t\t\tm_fileNameSrc = CKLBUtility::copyString(filesource);\r\n\t\t\tm_fileNameDst = CKLBUtility::copyString(filedest);\r\n\t\t} else {\r\n\t\t\tm_error |= ERROR_SETUP | ERROR_NAMING;\r\n\t\t}\r\n\t}\r\n\t\r\n\tm_thread = CPFInterface::getInstance().platform().createThread(ThreadLoader,this);\r\n\tif (!m_thread) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn regist(pTask, P_UIPREV);\r\n}\r\n\r\nbool\r\nCKLBAsyncFilecopy::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tconst char * callback       = lua.getString(ARG_CALLBACK);\r\n\tconst char * srcfilename    = lua.getString(ARG_FILENAMESRC);\r\n\tconst char * dstfilename    = lua.getString(ARG_FILENAMEDST);\r\n\r\n\treturn init(this, srcfilename, dstfilename, callback);\r\n}\r\n\r\nvoid\r\nCKLBAsyncFilecopy::die()\r\n{\r\n\tKLBDELETEA(m_callback);\r\n\tKLBDELETEA(m_fileNameSrc);\r\n\tKLBDELETEA(m_fileNameDst);\r\n}\r\n\r\nvoid\r\nCKLBAsyncFilecopy::execute(u32 /*deltaT*/)\r\n{\r\n\tif (m_checkSize != m_doneSize) {\r\n\t\tm_checkSize = m_doneSize;\r\n\t\tCKLBScriptEnv::getInstance().call_asyncFileCopy(m_callback,this,m_done,m_doneSize);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAsyncFilecopy.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBAsyncFilecopy_h\r\n#define CKLBAsyncFilecopy_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBAsyncFilecopy\r\n* \\brief Asynchronus File Copy Task class\r\n* \r\n* File copy may be a long operation to process.\r\n* In order to lighten the process cost for the game, it can be done\r\n* by another thread through a CKLBAsyncFilecopy object.\r\n* To load a resource in an asynchronous way, see CKLBAsyncLoader.\r\n*/\r\nclass CKLBAsyncFilecopy : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBAsyncFilecopy>;\r\nprivate:\r\n\tCKLBAsyncFilecopy();\r\n\tvirtual ~CKLBAsyncFilecopy();\r\n\r\n\tbool init(CKLBTask* pParentTask, const char* sourceFile, const char* destFile, const char* callback);\r\npublic:\r\n\tstatic CKLBAsyncFilecopy* create(CKLBTask* pParentTask, const char* sourceFile, const char* destFile, const char* callback);\r\n\r\n\tbool\t\tinitScript\t\t(CLuaState& lua);\r\n\r\n\tvoid\t\texecute\t\t\t(u32 deltaT);\r\n\tvoid\t\tdie\t\t\t\t();\r\n\r\n\tvirtual u32 getClassID\t\t();\r\n\r\n\tinline u32 getProcessCount\t()\t\t{ return m_done;\t}\r\n\tinline u32 getError\t\t\t()\t\t{ return m_error;\t}\r\n\r\nprivate:\r\n\tstatic s32 ThreadLoader(void * hThread, void * data);\r\n\tconst char *\t\t\t\tm_callback;\r\n\tconst char *\t\t\t\tm_fileNameSrc;\r\n\tconst char *\t\t\t\tm_fileNameDst;\r\n\tvoid*\t\t\t\t\t\tm_thread;\r\n\tu32\t\t\t\t\t\t\tm_done;\r\n\tu32\t\t\t\t\t\t\tm_doneSize;\r\n\tu32\t\t\t\t\t\t\tm_checkSize;\r\n\tu32\t\t\t\t\t\t\tm_error;\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBAsyncFilecopy_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAsyncLoader.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBAsyncLoader.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n;\r\nstatic CKLBTaskFactory<CKLBAsyncLoader> factory(\"UTIL_AsyncLoader\", CLS_KLBASYNCLOADER);\r\n\r\nstatic volatile int gAsyncCount = 0;\r\n\r\nCKLBAsyncLoader::CKLBAsyncLoader() \r\n:CKLBLuaPropTask\t()\r\n,m_callback\t\t\t(NULL)\r\n,m_pDataSet\t\t\t(NULL)\r\n,m_pAssets\t\t\t(NULL)\r\n,m_thread\t\t\t(NULL)\r\n{\r\n\tgAsyncCount++;\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBAsyncLoader::~CKLBAsyncLoader() {\r\n\tgAsyncCount--;\r\n}\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBAsyncLoader::ms_propItems[] = {\r\n\t{\t\"totalcount\",\tR_UINTEGER,\tNULL,\t(getBoolT)&CKLBAsyncLoader::getTotalCount,\t0\t},\r\n\t{\t\"processcount\",\tR_UINTEGER,\tNULL,\t(getBoolT)&CKLBAsyncLoader::getProcessCount,0\t}\r\n};\r\n\r\nenum {\r\n\tARG_DATASETID = 1,\r\n\tARG_ASSET_LIST,\r\n\tARG_CALLBACK,\t\t            // Function name for callback\r\n\tARG_REQUIRE\t\t= ARG_CALLBACK,\t\r\n\tARG_NUMS\t\t= ARG_CALLBACK\r\n};\r\n\r\nu32\r\nCKLBAsyncLoader::getClassID()\r\n{\r\n\treturn CLS_KLBASYNCLOADER;\r\n}\r\n\r\n/*static*/\r\ns32 \r\nCKLBAsyncLoader::ThreadLoader(void * /* hThread */, void * data)\r\n{\r\n\tCKLBAsyncLoader* p\t\t\t\t= (CKLBAsyncLoader*)data;\r\n\tCKLBAssetManager::SAsset* pList\t= p->m_pAssets;\r\n\tint count\t\t\t\t\t\t= p->m_count;\r\n\r\n\tint n = 0;\r\n\twhile (n < count) {\r\n\t\tpList[n].loadingStarted = true;\r\n\t\tCKLBAssetManager::getInstance().setCurrentAsyncAsset(&pList[n]);\t// Loader can fill information.\r\n\t\tpList[n].asset = CKLBAssetManager::getInstance().loadAssetByFileName(pList[n].name, 0, false, true);\r\n\t\tpList[n].loadingComplete = true;\r\n\t\tn++;\r\n\t}\r\n\r\n\tp->m_alive = false;\r\n\treturn 0;\r\n}\r\n\r\nCKLBAsyncLoader*\r\nCKLBAsyncLoader::create(CKLBTask* pParentTask, const char** assets, u32 count, u32 datasetID, const char* callback) {\r\n\tCKLBAsyncLoader* pTask = KLBNEW(CKLBAsyncLoader);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, assets, count, datasetID, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBAsyncLoader::init(CKLBTask* pTask, const char** assets, u32 count, u32 datasetID, const char* callback) {\r\n\t// Can not create more than ONE async loader at a time.\r\n\tif (gAsyncCount > 1) { return false; }\r\n\r\n\tsetStrC(m_callback,callback);\r\n\r\n    if(!m_callback) { return false; }\r\n\r\n\t// Properties definition\r\n\tif(!setupPropertyList((const char**)CKLBAsyncLoader::ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_alive     = true;\r\n\tm_count\t    = count;\r\n\tm_done\t    = 0;\r\n\tm_lastdone  = 0;\r\n\r\n\tm_error     = 0;\r\n\tm_pDataSet  = CKLBDataHandler::createSet(datasetID);\r\n\tif (!m_pDataSet) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_pAssets = KLBNEWA(CKLBAssetManager::SAsset,count * sizeof(CKLBAssetManager::SAsset));\r\n\tfor (u32 n = 0; n < count; n++) {\r\n\t\tCKLBAssetManager::SAsset* asset = &m_pAssets[n];\r\n\t\tasset->name\t\t\t\t= CKLBUtility::copyString(assets[n]);\r\n\t\tasset->asset\t\t\t= NULL;\r\n\t\tasset->checked\t\t\t= false;\r\n\t\tasset->loadingComplete\t= false;\r\n\t\tasset->loadingStarted\t= false;\r\n\t\tasset->added\t\t\t= false;\r\n\r\n\t\tasset->processByMainThread\t\r\n\t\t\t\t\t\t\t\t= true;\t// Mark as not waiting anything.\r\n\t\tasset->pTexAsset\t\t= NULL;\r\n\t}\r\n\r\n\tCKLBAssetManager::getInstance().setAsyncLoading(true);\r\n\r\n\tm_thread = CPFInterface::getInstance().platform().createThread(ThreadLoader,this);\r\n\tif (!m_thread) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn regist(pTask, P_UIPREV);\r\n}\r\n\r\nbool\r\nCKLBAsyncLoader::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tconst char * callback\t= lua.getString(ARG_CALLBACK);\r\n\tu32 datasetID\t\t\t= lua.getInt(ARG_DATASETID);\r\n\r\n\t// Get the asset list\r\n\tlua.retValue(ARG_ASSET_LIST);\r\n\r\n\t// Count the number of elements\r\n\tint max = 0;\r\n\tlua.retNil();\r\n\r\n\t// Read indexes and count entries.\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint idx = lua.getInt(-1);\r\n\t\tif(max < idx) max = idx;\r\n\t\tlua.pop(2);\r\n\t}\r\n\r\n\tconst char** items = KLBNEWA(const char*, max);\r\n\tif(!items) return false;\r\n\r\n\t// Reset all handle to NULL\r\n\tfor (int idx = 0; idx < max; idx++) {\r\n\t\titems[idx] = NULL;\r\n\t}\r\n\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint idx = lua.getInt(-1) - 1;\r\n\t\tconst char * name = lua.getString(-2);\r\n\t\tlua.pop(2);\r\n\r\n\t\titems[idx] = name;\r\n\t}\r\n\r\n\treturn init(NULL, items, max, datasetID,callback);\r\n}\r\n\r\nvoid\r\nCKLBAsyncLoader::die()\r\n{\r\n\tKLBDELETEA(m_callback);\r\n}\r\n\r\nvoid\r\nCKLBAsyncLoader::execute(u32 /*deltaT*/)\r\n{\r\n\tbool alive = m_alive; // Copy here only ! Because of thread, do NOT read directly m_alive after.\r\n\r\n\t//\r\n\t// Check list, validate current % done.\r\n\t//\r\n\tCKLBAssetManager::SAsset* pList = m_pAssets;\r\n\tu32 n = 0;\r\n\tm_error\t\t= 0;\r\n\tm_done\t\t= 0;\r\n\tm_lastdone\t= 0;\r\n\r\n\twhile (n < m_count) {\r\n\t\t//\r\n\t\t// Is there also texture waiting for OpenGL upload ?\r\n\t\t//\r\n\t\tif (pList->loadingComplete) {\r\n\t\t\tif (pList->added == false) {\r\n\t\t\t\tpList->added = true;\r\n\t\t\t\tm_done++;\r\n\t\t\t\tif (pList->asset) {\r\n\t\t\t\t\tu16 handle = m_pDataSet->allocateHandle(pList->asset, NULL);\r\n\t\t\t\t\tif (handle == 0) {\r\n\t\t\t\t\t\tm_error++;\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_error++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (pList->processByMainThread == false) {\r\n\t\t\tCKLBTextureAsset* pNewAsset = pList->pTexAsset;\r\n\t\t\tCKLBOGLWrapper&\t\tpOGLMgr\t\t\t= CKLBOGLWrapper::getInstance();\r\n\t\t\tpNewAsset->m_pTexture\t= pOGLMgr.createTexture(pNewAsset->m_width,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpNewAsset->m_height,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpList->pixelFormat,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpList->channel,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpNewAsset->m_bitmap,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpList->textureSize,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(CKLBOGLWrapper::TEX_OPTION)pList->opt);\t\t\t\t\r\n\t\t\tpList->processByMainThread\t= true;\r\n\t\t}\r\n\t\tpList++;\r\n\t\tn++;\r\n\t}\r\n\r\n\tif (m_done != m_lastdone) {\r\n\t\tm_lastdone = m_done;\r\n\t\tCKLBScriptEnv::getInstance().call_asyncLoader(m_callback,this,m_done,m_count);\r\n\t}\r\n\r\n\tif (!alive) {\r\n\t\t// Thread is dead, all texture have been processed -> Die.\r\n\t\tCPFInterface::getInstance().platform().deleteThread(m_thread);\r\n\t\tm_thread = NULL;\r\n\t\tCKLBAssetManager::getInstance().setAsyncLoading(false);\r\n\t\tkill();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBAsyncLoader.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBAsyncLoader_h\r\n#define CKLBAsyncLoader_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBAsyncLoader\r\n* \\brief Asynchronus Loader Task class\r\n* \r\n* Loading resources can be a long task for the Game and make it long to load some scenes.\r\n* In order to be able to keep on processing the Game Logic while loading resources, \r\n* CKLBAsyncLoader has been implemented.\r\n* It allows the Engine to load resources through another thread.\r\n* \r\n* To copy a file in an asynchronous way, see CKLBAsyncLoader.\r\n*/\r\nclass CKLBAsyncLoader : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBAsyncLoader>;\r\nprivate:\r\n\tCKLBAsyncLoader();\r\n\tvirtual ~CKLBAsyncLoader();\r\n\r\n\tbool init(CKLBTask* pParentTask, const char** assets, u32 count, u32 datasetID, const char* callback);\r\npublic:\r\n\tstatic CKLBAsyncLoader* create(CKLBTask* pParentTask, const char** assets, u32 count, u32 datasetID, const char* callback);\r\n\r\n\tbool\t\tinitScript\t\t(CLuaState& lua);\r\n\r\n\tvoid\t\texecute\t\t\t(u32 deltaT);\r\n\tvoid\t\tdie\t\t\t\t();\r\n\r\n\tvirtual u32 getClassID\t\t();\r\n\r\n\tinline u32\tgetTotalCount\t()\t\t{ return m_count;\t}\r\n\r\n\tinline u32\tgetProcessCount\t()\t{ return m_done;\t}\r\n\r\nprivate:\r\n\tstatic s32 ThreadLoader(void * hThread, void * data);\r\n\tCKLBAssetManager::SAsset*\tm_pAssets;\r\n\tvolatile bool\t\t\t\tm_alive;\r\n\tconst char\t*\t\t\t\tm_callback;\r\n\tCKLBDataSet *\t\t\t\tm_pDataSet;\r\n\tvoid*\t\t\t\t\t\tm_thread;\r\n\tu32\t\t\t\t\t\t\tm_done;\r\n\tu32\t\t\t\t\t\t\tm_lastdone;\r\n\tu32\t\t\t\t\t\t\tm_error;\r\n\tu32\t\t\t\t\t\t\tm_count;\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBIntervalTimer_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBBinArray.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBBinArray.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\nCKLBBinArray\t*\tCKLBBinArray::ms_begin\t= 0;\r\nCKLBBinArray\t*\tCKLBBinArray::ms_end\t= 0;\r\n\r\nCKLBBinArray::CKLBBinArray() : m_size(0), m_pBuf(0), m_prev(0), m_next(0), m_name(0)\r\n{\r\n\tm_prev = ms_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tms_begin = this;\r\n\t}\r\n\tms_end = this;\r\n}\r\n\r\nCKLBBinArray::~CKLBBinArray()\r\n{\r\n\tKLBDELETEA(m_pBuf);\r\n\tKLBDELETEA(m_name);\r\n\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tms_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tms_end = m_prev;\r\n\t}\r\n}\r\n\r\nu32\r\nCKLBBinArray::getClassID()\r\n{\r\n\treturn CLS_KLBBINARRAY;\r\n}\r\n\r\n\r\nvoid\r\nCKLBBinArray::removeAll()\r\n{\r\n\tCKLBBinArray * pBIN = ms_begin;\r\n\twhile(pBIN) {\r\n\t\tCKLBBinArray * pNXT = pBIN->m_next;\r\n\t\tKLBDELETE(pNXT);\r\n\t\tpBIN = pNXT;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBBinArray::dumpAll()\r\n{\r\n\tbool bResult = false;\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tCKLBBinArray * pBIN = ms_begin;\r\n\twhile(pBIN) {\r\n\t\tpForm.logging(\"[BIN]<%p>: %s\", pBIN, pBIN->m_name);\r\n\t\tpBIN = pBIN->m_next;\r\n\t\tbResult = true;\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBBinArray::loadAsset(const char * path)\r\n{\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\tIReadStream * pStream = pfif.openReadStream(path, pfif.useEncryption());\r\n\tif(!pStream || pStream->getStatus() != IReadStream::NORMAL) {\r\n\t\tdelete pStream;\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsize_t size = pStream->getSize();\r\n\tu8 * pBuf = KLBNEWA(u8, size);\r\n\tif(!pBuf) {\r\n\t\tdelete pStream;\r\n\t\treturn false;\r\n\t}\r\n\tpStream->readBlock(pBuf, size);\r\n\tdelete pStream;\r\n\r\n\tm_size = size;\r\n\tm_pBuf = pBuf;\r\n\tm_name = CKLBUtility::copyString(path);\t// �p�X�𖼏̂ɂ���\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBBinArray.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBBinArray_h\r\n#define CKLBBinArray_h\r\n\r\n#include <stdio.h>\r\n#include \"BaseType.h\"\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBBinArray : public CKLBObjectScriptable\r\n{\r\npublic:\r\n\tCKLBBinArray();\r\n\tvirtual ~CKLBBinArray();\r\n\r\n\tu32 getClassID();\r\n\r\n\tstatic void removeAll();\r\n\tstatic bool dumpAll();\r\n\r\n\tbool loadAsset(const char * path);\r\n\r\n\tinline size_t getSize() const { return m_size; }\r\n\tinline u8 getByte(int offset) { return *(m_pBuf + offset); }\r\n\tinline u16 getWordLE(int offset) {\r\n\t\tu16 val = *(m_pBuf + offset);\r\n\t\tval |= (u16)*(m_pBuf + offset + 1) << 8;\r\n\t\treturn val;\r\n\t}\r\n\tinline u32 getLongLE(int offset) {\r\n\t\tu32 val = *(m_pBuf + offset);\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 8;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 16;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 24;\r\n\t\treturn val;\r\n\t}\r\n\r\n\tinline u16 getWordBE(int offset) {\r\n\t\tu16 val = (u16)*(m_pBuf + offset) << 8;\r\n\t\tval |= *(m_pBuf + offset + 1);\r\n\t\treturn val;\r\n\t}\r\n\tinline u32 getLongBE(int offset) {\r\n\t\tu32 val = (u32)*(m_pBuf + offset) << 24;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 16;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1) << 8;\r\n\t\tval |= (u32)*(m_pBuf + offset + 1);\r\n\t\treturn val;\r\n\t}\r\n\r\nprivate:\r\n\tconst char\t*\tm_name;\r\n\tsize_t\t\t\tm_size;\r\n\tu8\t\t\t*\tm_pBuf;\r\n\r\n\r\n\tCKLBBinArray\t*\tm_prev;\r\n\tCKLBBinArray\t*\tm_next;\r\n\r\n\tstatic CKLBBinArray\t*\tms_begin;\r\n\tstatic CKLBBinArray\t*\tms_end;\r\n};\r\n\r\n#endif // CKLBBinArray_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBContext.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBObject.h\"\r\n\r\n#include <stdlib.h>\r\n#include \"mem.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n#define EXTENSION_STEP\t\t(8192)\r\n\r\nCKLBContext gContext;\r\n\r\nCKLBContext* CKLBContext::getContext() {\r\n\treturn &gContext;\r\n}\r\n\r\nCKLBContext::CKLBContext()\r\n{\r\n}\r\n\r\nCKLBContext::~CKLBContext() {\r\n}\r\n\r\n//\r\n// Do not use MALLOC / FREE macro here.\r\n// Those functions are used by NEW DELETE and already wrapped.\r\n//\r\nvoid* CKLBContext::allocate(unsigned int numByte) {\r\n\r\n#ifdef INTERNAL_MEMORY_STARVING\r\n    if(CMemDebug::isFail()) { return NULL; }\r\n#endif\r\n\tvoid* ptr = malloc(numByte);\r\n\tif (ptr) {\r\n\t\treturn ptr;//(void *)((ALLOCHDR*)ptr + 1);\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBContext::disallocate(void* ptr) {\r\n    // ALLOCHDR * apt = (ALLOCHDR *)ptr - 1;\r\n\t// free(apt);\r\n\tfree(ptr);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBDataHandler.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBAsset.h\"\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"mem.h\"\r\n\r\n// =====================================================================\r\n//   General Handler data set.\r\n// =====================================================================\r\n\r\nCKLBAbstractAsset**\ttempArray\t= NULL;\r\nu16*\t\t\t\tnext\t\t= NULL;\r\nu16*\t\t\t\tprev\t\t= NULL;\r\nu16\t\t\t\t\tm_freeList\t= 0;\r\nu16\t\t\t\t\tm_usedList\t= 0;\r\nCKLBDataSet*\t\tg_dataSet\t= NULL;\r\nu32 CKLBDataHandler::s_maxHandler\t= 0;\r\n\r\nbool \r\nCKLBDataHandler::init(u16 handleCount) {\r\n\tif (handleCount) {\r\n\t\ttempArray\t= KLBNEWA(CKLBAbstractAsset*,\thandleCount);\r\n\t\tnext\t\t= KLBNEWA(u16,\t\t\t\t\thandleCount);\r\n\t\tprev\t\t= KLBNEWA(u16,\t\t\t\t\thandleCount);\r\n\t\tif (tempArray && next && prev) {\r\n\t\t\tmemset32(tempArray,NULL, handleCount * sizeof(CKLBAbstractAsset*));\r\n\r\n\t\t\tfor (u32 n=1; n < handleCount; n++) {\r\n\t\t\t\tnext[n]\t\t\t= n+1;\r\n\t\t\t\tprev[n]\t\t\t= n-1;\r\n\t\t\t}\r\n\r\n\t\t\tprev[1]\t\t\t\t= 0;\r\n\t\t\tnext[handleCount-1] = 0;\r\n\r\n\t\t\tnext[0]\t\t\t\t= 0;\r\n\t\t\tprev[0]\t\t\t\t= 0;\r\n\t\t\ttempArray[0]\t\t= NULL;\r\n\r\n\t\t\tm_freeList\t\t\t= 1;\r\n\t\t\tm_usedList\t\t\t= 0;\r\n\t\t\ts_maxHandler\t\t= handleCount;\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\trelease();\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBDataHandler::release() {\r\n\tclearAllSet();\r\n\r\n\tif (tempArray)\t{ KLBDELETEA(tempArray); tempArray  = NULL; }\r\n\tif (next)\t\t{ KLBDELETEA(next);      next       = NULL; }\r\n\tif (prev)\t\t{ KLBDELETEA(prev);      prev       = NULL; }\r\n\r\n\tklb_assert(m_usedList == 0, \"still allocated handle\");\r\n\tklb_assert(g_dataSet  == NULL, \"still allocated data set %i\", g_dataSet->m_userID);\r\n\r\n}\r\n\r\nu16 \r\nCKLBDataHandler::allocateHandle() {\r\n\tu16 handle = m_freeList;\r\n\tklb_assert(handle, \"No free handle available !!!\");\r\n\tif (handle) {\r\n\t\tm_freeList = next[m_freeList];\r\n\r\n\t\tif (m_usedList) {\r\n\t\t\tklb_assert(m_usedList < s_maxHandler, \"Invalid Index\");\r\n\t\t\tprev[m_usedList] = handle;\r\n\t\t}\r\n\r\n\t\tnext[handle] = m_usedList;\r\n\t\tprev[handle] = 0;\r\n\t\tm_usedList\t = handle;\r\n\t}\r\n\treturn handle;\r\n}\r\n\r\nvoid \r\nCKLBDataHandler::releaseHandle(u16 handle) {\r\n\tif (handle) {\r\n\t\tklb_assert(handle < s_maxHandler, \"Invalid Index\");\r\n\r\n\t\t//\r\n\t\t// Remove from active list.\r\n\t\t//\r\n\t\tif (next[handle]) {\r\n\t\t\tklb_assert(next[handle] < s_maxHandler, \"Invalid Index\");\r\n\t\t\tprev[next[handle]]\t= prev[handle];\r\n\t\t}\r\n\r\n\t\tif (prev[handle]) {\r\n\t\t\tklb_assert(prev[handle] < s_maxHandler, \"Invalid Index\");\r\n\t\t\tnext[prev[handle]]\t= next[handle];\r\n\t\t} else {\r\n\t\t\tm_usedList\t\t\t= next[handle];\r\n\t\t}\r\n\r\n\t\tif (tempArray[handle]) {\r\n\t\t\ttempArray[handle]->decrementRefCount();\r\n\t\t\ttempArray[handle] = NULL;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Add to free list.\r\n\t\t//\r\n\t\tnext[handle] = m_freeList;\r\n\t\tprev[handle] = 0;\r\n\t\tm_freeList\t = handle;\r\n\t\tif (m_freeList) {\r\n\t\t\tklb_assert(m_freeList < s_maxHandler, \"Invalid Index\");\r\n\t\t\tprev[m_freeList] = handle;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nu16 \r\nCKLBDataHandler::allocateHandle(void* ptr) {\r\n\tu16 handle = allocateHandle();\r\n\tif (handle) {\r\n\t\tklb_assert(handle < s_maxHandler, \"Invalid Index\");\r\n\r\n\t\ttempArray[handle] = (CKLBAbstractAsset*)ptr;\r\n\t\tif (ptr) {\r\n\t\t\ttempArray[handle]->incrementRefCount();\r\n\t\t}\r\n\t}\r\n\treturn handle;\r\n}\r\n\r\nvoid \r\nCKLBDataHandler::setPointer(u16 handle, void* ptr) {\r\n\tif (handle) {\r\n\t\tklb_assert(handle < s_maxHandler, \"Invalid Index\");\r\n\r\n\t\tif (tempArray[handle]) {\r\n\t\t\ttempArray[handle]->decrementRefCount();\r\n\t\t}\r\n\r\n\t\ttempArray[handle] = (CKLBAbstractAsset*)ptr;\r\n\r\n\t\tif (ptr) {\r\n\t\t\ttempArray[handle]->incrementRefCount();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid* \r\nCKLBDataHandler::getPointer(u16 handle) {\r\n\tklb_assert(handle < s_maxHandler, \"Invalid Index\");\r\n\treturn tempArray[handle];\r\n}\r\n\r\nvoid \r\nCKLBDataHandler::dumpDataSet() {\r\n\tCKLBDataSet* pSet = g_dataSet;\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\tfprintf(pFile,\"\\n==== Global Data Set (lock list) Start ===\\n\");\r\n\tint count = 0;\r\n\twhile (pSet) {\r\n\t\tfprintf(pFile,\"[List %i]\\n\",count++);\r\n\t\tCKLBDataSet::Handle* pHandle = pSet->m_listHandle;\r\n\t\twhile (pHandle) {\r\n\t\t\tu32 handle = pHandle->handle;\r\n\t\t\tCKLBAbstractAsset* pAsset = (CKLBAbstractAsset*)getPointer(handle);\r\n\t\t\tfprintf(pFile,\"Handle[%i] %s (Cnt:%i)\\n\", handle, pHandle->name,pAsset->getRefCount());\r\n\r\n\t\t\tpHandle = pHandle->next;\r\n\t\t}\r\n\t\tpSet = pSet->m_next;\r\n\t}\r\n\tfprintf(pFile,\"\\n==== Global Data Set End ===\\n\");\r\n}\r\n\r\nvoid \r\nCKLBDataHandler::clearAllSet() {\r\n\twhile (g_dataSet) {\r\n\t\t// g_dataSet is updated inside the destroy.\r\n\t\tdestroySet(g_dataSet);\r\n\t}\r\n}\r\n\r\nCKLBDataSet* \r\nCKLBDataHandler::createSet(u32 setUserID) {\r\n\tCKLBDataSet* pDataSet = KLBNEW(CKLBDataSet);\r\n\tif (pDataSet) {\r\n\t\tpDataSet->m_next\t= g_dataSet;\r\n\t\tpDataSet->m_userID\t= setUserID;\r\n\t\tg_dataSet\t\t\t= pDataSet;\r\n\t}\r\n\treturn pDataSet;\r\n}\r\n\r\nvoid \r\nCKLBDataHandler::destroySet(CKLBDataSet* set) {\r\n\tif (set) {\r\n\t\tCKLBDataSet* curr = g_dataSet;\r\n\t\tCKLBDataSet* prev = NULL;\r\n\r\n\t\twhile (curr) {\r\n\t\t\tif (curr == set) {\r\n\t\t\t\t// Remove from link list.\r\n\t\t\t\tif (prev == NULL) {\r\n\t\t\t\t\tg_dataSet = curr->m_next;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprev->m_next\t= curr->m_next;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tKLBDELETE(set);\r\n\r\n\t\t\t\treturn; // Exit the function\r\n\t\t\t}\r\n\t\t\tprev = curr;\r\n\t\t\tcurr = curr->m_next;\r\n\t\t}\r\n\r\n\t\tklb_assertAlways(\"Try to delete a set that is already deleted !\");\r\n\t} else {\r\n\t\tklb_assertAlways(\"Can not destroy null data set.\");\r\n\t}\r\n}\r\n\r\n\r\n// =====================================================================\r\n//   Handler data set.\r\n// =====================================================================\r\n\r\nCKLBDataSet::CKLBDataSet()\r\n: m_listHandle\t(NULL)\r\n, m_next\t\t(NULL)\r\n, m_listTask\t(NULL)\r\n{\r\n}\r\n\r\nCKLBDataSet::~CKLBDataSet() {\r\n\tHandle* pHandle = m_listHandle;\r\n\twhile (pHandle) {\r\n\t\tHandle* pHandleNext = pHandle->next;\r\n\t\t//\r\n\t\tCKLBDataHandler::releaseHandle(pHandle->handle);\r\n\t\tKLBDELETEA(pHandle->name);\r\n\t\tKLBDELETE(pHandle);\r\n\t\t//\r\n\t\tpHandle = pHandleNext;\r\n\t}\r\n\tm_listHandle = NULL;\r\n\r\n\tklb_assert(!m_listTask, \"List Task should be empty.\");\r\n\tTaskWrapper* pTask = m_listTask;\r\n\twhile (pTask) {\r\n\t\tTaskWrapper* pNTask = pTask->m_pNext;\r\n\t\tKLBDELETE(pTask);\r\n\t\tpTask = pNTask;\r\n\t}\r\n\tm_listTask = NULL;\r\n}\r\n\r\nu32 \r\nCKLBDataSet::getClassID()\r\n{\r\n\treturn CLS_KLBDATASET;\r\n}\r\n\r\n\r\nu16 \r\nCKLBDataSet::allocateHandle(void* ptr, char* /*name*/) {\r\n\tu16 handle = 0;\r\n\tif (/*name &&*/ ptr) {\r\n//\t\tu32 strLen = strlen(name) + 1;\r\n//\t\tchar* newName = (char*)KLBNEWA(char*,strLen);\r\n//\t\tif (newName) {\r\n//\t\t\tmemcpy(newName, name, strLen);\r\n\t\t\thandle = CKLBDataHandler::allocateHandle(ptr);\r\n\t\t\tif (handle) {\r\n\t\t\t\taddHandle(handle , NULL/*newName*/);\r\n//\t\t\t} else {\r\n//\t\t\t\tKLBDELETEA(newName);\r\n\t\t\t}\r\n//\t\t}\r\n\t} else {\r\n\t\tklb_assertNull(0,\"can not store null pointer\");\r\n\t}\r\n\treturn handle;\r\n}\r\n\r\n/*\r\nu16 \r\nCKLBDataSet::getHandleFromName(char* name) {\r\n\tif (name) {\r\n\t\tHandle* pHandle = m_listHandle;\r\n\t\twhile (pHandle) {\r\n\t\t\tif (strcmp(name, pHandle->name)==0) {\r\n\t\t\t\treturn pHandle->handle;\r\n\t\t\t}\r\n\t\t\tpHandle = pHandle->next;\r\n\t\t}\r\n\t}\r\n\tklb_assertNull(0, \"return null handle\");\r\n\treturn 0;\r\n}*/\r\n\r\nCKLBDataSet::Handle* \r\nCKLBDataSet::addHandle(u16 handle, char* name) {\r\n\tHandle* newHandle = KLBNEW(Handle);\r\n\tif (newHandle) {\r\n\t\tnewHandle->handle\t= handle;\r\n\t\tnewHandle->name\t\t= name;\r\n\r\n\t\tnewHandle->next     = m_listHandle;\r\n\t\tm_listHandle\t    = newHandle;\r\n\t}\r\n\treturn newHandle;\r\n}\r\n\r\nbool \r\nCKLBDataSet::addTask(void* ptrTask) {\r\n\tTaskWrapper* newTaskWrapper = KLBNEW(TaskWrapper);\r\n\tif (newTaskWrapper) {\r\n\t\tnewTaskWrapper->ptrTask\t= ptrTask;\r\n\t\tnewTaskWrapper->m_pNext = m_listTask;\r\n\t\tm_listTask\t= newTaskWrapper;\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBDataSet::removeTask(void* ptrTask) {\r\n\tif (ptrTask) {\r\n\t\tTaskWrapper* curr = m_listTask;\r\n\t\tTaskWrapper* prev = NULL;\r\n\r\n\t\twhile (curr) {\r\n\t\t\tif (curr->ptrTask == ptrTask) {\r\n\t\t\t\t// Remove from link list.\r\n\t\t\t\tif (prev == NULL) {\r\n\t\t\t\t\tm_listTask\t\t= curr->m_pNext;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprev->m_pNext\t= curr->m_pNext;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tKLBDELETE(curr);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tprev = curr;\r\n\t\t\tcurr = curr->m_pNext;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nbool \r\nCKLBDataSet::lock(CKLBTask * pTask) {\r\n\treturn addTask(pTask);\r\n}\r\n\r\nvoid \r\nCKLBDataSet::unlock() {\r\n\tremoveTask(CKLBTaskMgr::getInstance().getCurrentTask());\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBDataHandler.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __KLB_DATAHANDLER__\r\n#define __KLB_DATAHANDLER__\r\n\r\n#include \"BaseType.h\"\r\n#include \"CKLBTask.h\"\r\n\r\nclass CKLBDataSet;\r\n\r\nclass CKLBDataHandler {\r\n\tfriend class CKLBDataSet;\r\npublic:\r\n\tstatic bool\t\tinit\t\t\t(u16 handlerCount);\r\n\tstatic void\t\trelease\t\t\t();\r\n\r\n\tstatic \r\n\tCKLBDataSet*\tcreateSet\t\t(u32 userDebugID);\r\n\r\n\tstatic void\t\tdestroySet\t\t(CKLBDataSet* set);\r\n\tstatic void\t\tclearAllSet\t\t();\r\n\tstatic void\t\tdumpDataSet\t\t();\r\n\r\n\tstatic u16\t\tallocateHandle\t();\r\n\tstatic void\t\tsetPointer\t\t(u16 handle, void* ptr);\r\n\tstatic void\t\treleaseHandle\t(u16 handle);\r\n\tstatic u16\t\tallocateHandle\t(void* ptr);\r\n\r\n\tstatic void*\tgetPointer\t\t(u16 handle);\r\nprivate:\r\n\tstatic u32\t\ts_maxHandler;\r\n};\r\n\r\nclass CKLBDataSet : public CKLBObjectScriptable {\r\n\tfriend class CKLBDataHandler;\r\nprivate:\r\n\r\n\tCKLBDataSet\t\t\t\t();\r\n\t~CKLBDataSet\t\t\t();\r\n\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tbool\tlock\t\t\t\t(CKLBTask * pTask);\r\n\tvoid\tunlock\t\t\t\t();\r\n\tu16\t\tallocateHandle\t\t(void* ptr,  char* name);\r\n\tu16\t\tgetHandleFromName\t(char* name);\r\n\t\r\n\tinline\t\r\n\tvoid*\tgetPointer\t\t\t(u16 handle) {\r\n\t\treturn CKLBDataHandler::getPointer(handle);\r\n\t}\r\n\r\nprivate:\r\n\tstruct Handle {\r\n\t\tHandle* next;\r\n\t\tu32 handle;\r\n\t\tchar* name;\r\n\t};\r\n\r\n\tstruct TaskWrapper {\r\n\t\tTaskWrapper*\tm_pNext;\r\n\t\tvoid*\t\t\tptrTask;\r\n\t};\r\n\r\n\tbool\taddTask\t\t\t\t(void* ptrTask);\r\n\tvoid\tremoveTask\t\t\t(void* ptrTask);\r\n\tHandle*\taddHandle\t\t\t(u16 handle, char* name);\r\n\r\n\tCKLBDataSet*\tm_next;\r\n\tHandle*\t\t\tm_listHandle;\r\n\tTaskWrapper*\tm_listTask;\r\n\tu32\t\t\t\tm_userID;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBDebugger.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <string.h>\r\n#include \"CKLBDebugger.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBTask.h\"\r\n\r\n// ----------------------------\r\n//   Local helper function\r\n// ----------------------------\r\n\r\nstatic void writeU32(u8* pDst, u32 value) {\r\n\tpDst[0] = value >> 24;\r\n\tpDst[1] = value >> 16;\r\n\tpDst[2] = value >> 8;\r\n\tpDst[3] = value;\r\n}\r\n\r\n\r\nstatic u32 readU32(u8** ppSrc) {\r\n\tu8* pSrc\t= *ppSrc;\r\n\tu32 value\t= (pSrc[0] << 24) | (pSrc[1]<<16) | (pSrc[2]<<8) | (pSrc[3]);\r\n\t*ppSrc\t\t= &pSrc[4];\r\n\treturn value;\r\n}\r\n\r\n// ----------------------------\r\n//   Debugger Implementation\r\n// ----------------------------\r\n\r\nCKLBDebuggerContext::CKLBDebuggerContext(u32 /*size*/)\r\n: CKLBContext       ()\r\n, m_pCommunicator   (NULL)\r\n{\r\n}\r\n\r\nCKLBDebuggerContext::~CKLBDebuggerContext() {\r\n}\r\n\r\nvoid CKLBDebuggerContext::setupReceiver(IKLBDebuggerCommunicator* pCommunicator) {\r\n\tklb_assert(pCommunicator, \"NULL POINTER\");\r\n\tm_pCommunicator = pCommunicator;\r\n\tpCommunicator->assignDebugger(this);\r\n}\r\n\r\nvoid CKLBDebuggerContext::receiveCommand(u32 /*commandID*/, COMMAND_TYPE /*commandType*/, u8* /*data*/, u32 /*dataSize*/) {\r\n\tklb_assert(m_pCommunicator, \"Call setupReceiver first.\");\r\n\r\n\t//switch (commandType) {\r\n\t// case xxxx:\r\n\t//\tif (dataSize == 0) {\r\n\t//\t\treturnResult12(commandID, sizeof(void*), (void*)0x00000001);\r\n\t//\tor\tm_pCommunicator->sendResult(commandID, ERR_NOERROR);\r\n\t//\t} else {\r\n\t//\t\terrResult(commandID, ERR_INVALIDREQ);\r\n\t//\t}\r\n\t//\tbreak;\r\n\t//}\r\n}\r\n\r\nvoid CKLBDebuggerContext::returnResult4(u32 commandID, u32 value) {\r\n\tu8* pRes = m_pCommunicator->allocateResult(commandID, 4);\r\n\tif (pRes) {\r\n\t\twriteU32(pRes, value);\r\n\t\tm_pCommunicator->sendResult(commandID, ERR_NOERROR);\r\n\t} else {\r\n\t\tm_pCommunicator->sendResult(commandID, ERR_ALLOCATION);\r\n\t}\r\n}\r\n\r\nvoid CKLBDebuggerContext::returnResultString(u32 commandID, const char* string) {\r\n\tint length = strlen(string) + 1;\r\n\tu8* pRes = m_pCommunicator->allocateResult(commandID, 4 + length);\r\n\tif (pRes) {\r\n\t\twriteU32(pRes, length); pRes += 4;\r\n\t\tmemcpy(pRes, string, length); pRes += length;\t// Src is 0 at end also.\r\n\t\tm_pCommunicator->sendResult(commandID, ERR_NOERROR);\r\n\t} else {\r\n\t\tm_pCommunicator->sendResult(commandID, ERR_ALLOCATION);\r\n\t}\r\n}\r\n\r\nvoid CKLBDebuggerContext::returnResult12(u32 commandID, u32 classID, void* value) {\r\n\tu8* pRes = m_pCommunicator->allocateResult(commandID, 12);\r\n\tif (pRes) {\r\n\t\twriteU32(pRes, classID); pRes += 4;\r\n\t\t// Clear buffer\r\n\t\tmemset(pRes, 0, 8);\r\n\t\t// Copy of pointer size.\r\n\t\tmemcpy(pRes, &value, sizeof(void*));\r\n\t\tm_pCommunicator->sendResult(commandID, ERR_NOERROR);\r\n\t} else {\r\n\t\tm_pCommunicator->sendResult(commandID, ERR_ALLOCATION);\r\n\t}\r\n}\r\n\r\nvoid CKLBDebuggerContext::errResult(u32 commandID, ERROR_TYPE error) {\r\n\tu8* pRes = m_pCommunicator->allocateResult(commandID, 0);\t\t// TODO : should have a system : not failed alloc for error return.\r\n\tif (pRes) {\r\n\t\t// Return error.\r\n\t\tm_pCommunicator->sendResult(commandID, error);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBDebugger.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Debugger System ===\r\n//\r\n//\r\n\r\n#ifndef __KLB_DEBUGGER__\r\n#define __KLB_DEBUGGER__\r\n\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBDebuggerContext;\r\nclass IKLBDebuggerCommunicator;\r\n\r\nclass CKLBDebuggerContext:public CKLBContext {\r\npublic:\r\n\tCKLBDebuggerContext(u32 size);\r\n\t~CKLBDebuggerContext();\r\n\r\n\t/**\r\n\t\tAvailable command for the debugger.\r\n\t */\r\n\tenum COMMAND_TYPE {\r\n\t\tGET_ALL_OBJECT\t\t= 0x01,\r\n\t\tGET_TYPE\t\t\t= 0x02,\r\n\t\tGET_PROPCOUNT\t\t= 0x03,\r\n\t\tGET_VALUE\t\t\t= 0x04,\r\n\t\tGET_CLASSNAME\t\t= 0x05,\r\n\t\tGET_PROPNAME\t\t= 0x06,\r\n\t\tSET_VALUE\t\t\t= 0x07,\r\n\t\tSCREEN_SHOT\t\t\t= 0x08,\r\n\t\tSET_ASSET\t\t\t= 0x09,\r\n\t\tGET_PROPID\t\t\t= 0x0A,\r\n\t\tGET_FORMAT\t\t\t= 0x0B,\r\n\t\t\r\n\t\t// 0xC,0xD,0xE,0xF,0x10,0x11,0x12 free to use.\r\n\r\n\t\tQUERY_GAMESTOP\t\t= 0x13,\r\n\t\tQUERY_GAMESTART\t\t= 0x14,\r\n\t};\r\n\r\n\t/**\r\n\t\tPossible error code return instead of size to the remote device.\r\n\t */\r\n\tenum ERROR_TYPE {\r\n\t\tERR_NOERROR\t\t\t= 0,\t\t\t//\tNo error, replace with correct size during transport.\r\n\t\tERR_PROCESS\t\t\t= 0xCAFEDE00,\t// \tImpossible to process.\r\n\t\tERR_INTERNAL\t\t= 0xCAFEDE01,\t//\tInternal Error.\r\n\t\tERR_ALLOCATION\t\t= 0xCAFEDE02,\t//\tAllocation error.\r\n\t\tERR_INVALIDREQ\t\t= 0xCAFEDE03,\t//\tMalformed command or parameter.\r\n\t};\r\n\t\r\n\tenum CLASS_GROUP {\r\n\t\tCLSGRP_GAME\t\t\t= 0x00000000,\r\n\t\tCLSGRP_ENGINE\t\t= 0x40000000,\r\n\t\tCLSGRP_BASIC\t\t= 0x80000000,\r\n\t\tCLSGRP_BASICPTR\t\t= 0x81000000,\r\n\t\tCLSGRP_NULL\t\t\t= 0xFFFFFFFF\r\n\t};\r\n\r\npublic:\r\n\tvoid setupReceiver\t\t\t(IKLBDebuggerCommunicator* pCommunicator);\r\n\tvoid receiveCommand\t\t\t(u32 commandID, COMMAND_TYPE commandType, u8* data, u32 dataSize);\r\n\r\nprivate:\r\n\tIKLBDebuggerCommunicator*\tm_pCommunicator;\r\n\t\r\n\tvoid returnResultString\t\t(u32 commandID, const char* string);\r\n\tvoid returnResult4\t\t\t(u32 commandID, u32 value);\r\n\tvoid returnResult12\t\t\t(u32 commandID, u32 classID, void* value);\r\n\tvoid errResult\t\t\t\t(u32 commandID, ERROR_TYPE error);\r\n};\r\n\t\r\nclass IKLBDebuggerCommunicator {\r\npublic:\r\n\t/**\r\n\t\tCalled by debugger when assigning the interface.\r\n\t */\r\n\tvirtual void assignDebugger\t(CKLBDebuggerContext* pDebugger) = 0;\r\n\r\n\t/**\r\n\t\tCalled by debugger to request memory for communicator to transmit result.\r\n\t\tCommunicator can free the memory once data is transmitted.\r\n\t\t\r\n\t\tNote : In case of allocation failure, the debugger will NOT call sendResult\r\n\t\t\t\tThus, a failure in allocate result should return an error message to the remote device waiting for results.\r\n\t */\r\n\tvirtual u8* allocateResult\t(u32 commandID, u32 size) = 0;\r\n\r\n\t/**\r\n\t\tCalled by debugger once data is setup and successfull.\r\n\t */\r\n\tvirtual void sendResult\t\t(u32 commandID, CKLBDebuggerContext::ERROR_TYPE err) = 0;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBGameApplication.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBGameApplication.cpp\r\n//  GameEngine\r\n//\r\n//\r\n#include <stdlib.h>\r\n#include \"CKLBGameApplication.h\"\r\n\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBDeviceKeyEvent.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n#include \"CKLBLuaScript.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n#include \"CKLBLabelNode.h\"\r\n#include \"MultithreadedNetwork.h\"\r\n\r\n#ifdef DEBUG_MENU\r\n#include \"CKLBDebugMenu.h\"\r\n#endif\r\n\r\n#if defined (DEBUG_MEMORY)\r\n#include \"DebugTracker.h\"\r\n#endif\r\n\r\n// asset manager\r\n#include \"CKLBSWFPlayer.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"NodeAnimationAsset.h\"\r\n#include \"CKLBDatabase.h\"\r\n#include \"CKLBAppProperty.h\"\r\n#include \"AudioAsset.h\"\r\n#include \"CKLBTexturePacker.h\"\r\n#include \"CKLBNetAPIKeyChain.h\"\r\n#include \"CKLBFormGroup.h\"\r\n#include \"CKLBLanguageDatabase.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"CKLBHTTPInterface.h\"\r\n\r\n// Global Text rendering buffer.\r\n#include \"CKLBTextTempBuffer.h\"\r\n\r\nCKLBGameApplication::CKLBGameApplication()\r\n: IClientRequest    ()\r\n, m_bootFile        (NULL)\r\n, m_reboot          (false)\r\n, m_frameTime       (16)\r\n, m_outStream       (NULL)\r\n, m_useDefaultDB    (false)\r\n, m_useDefaultFont  (true)\r\n{\r\n}\r\n\r\nCKLBGameApplication::~CKLBGameApplication() \r\n{\r\n\tif(m_bootFile ) KLBDELETEA(m_bootFile);\t// 2012.12.12  finidhGame内でコメントアウトした物をここへ移動\r\n#if defined (DEBUG_MEMORY)\r\n\tCTracker::End();\r\n#endif\r\n\t// _CrtDumpMemoryLeaks();\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBGameApplication::pauseGame(bool pause) \r\n{\r\n\tCKLBTaskMgr::getInstance().setFreeze(pause);\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBGameApplication::setInitParam(u32 param, void* /*complexSetup*/) \r\n{\r\n\tm_useDefaultDB\t= (param & ENGINE_USE_DEFAULTDB)\t!= 0;\r\n\tm_useDefaultFont= (param & ENGINE_USE_DEFAULTFONT)\t!= 0;\r\n}\r\n\r\nbool\r\nCKLBGameApplication::setScreenInfo(bool /*rotate*/,int width, int height)\r\n{\r\n\t// phisical screen info\r\n\tm_width = width;\r\n\tm_height = height;\r\n\treturn true;\r\n}\r\n\r\n/*virtual*/\r\nint \r\nCKLBGameApplication::getPhysicalScreenWidth() \r\n{\r\n\treturn m_width;\r\n}\r\n\r\n/*virtual*/\r\nint \r\nCKLBGameApplication::getPhysicalScreenHeight() \r\n{\r\n\treturn m_height;\r\n}\r\n\r\nbool\r\nCKLBGameApplication::setFilePath(const char * strPath)\r\n{\r\n\tint len = (!strPath) ? 0 : strlen(strPath);\r\n\tconst char * ptr = (!len) ? \"start.lua\" : strPath;\r\n\tlen = strlen(ptr) + sizeof(\"file://install/\");\r\n\tchar * buf = KLBNEWA(char, len + 1);\r\n\tsprintf(buf, \"file://install/%s\", ptr);\r\n\tm_bootFile = (const char *)buf;\r\n    return true;\r\n}\r\n\r\nbool\r\nCKLBGameApplication::initGame()\r\n{\r\n\tbool res = true;\r\n#if defined (DEBUG_MEMORY)\r\n\tCTracker::Init(\"socket://127.0.0.1:6542\",true);\r\n#endif\r\n\r\n\tAllocationSize allocSize;\r\n\tallocSize.dictionnaryNodePoolSize\t= 15000;\r\n\tallocSize.handlerPoolSize\t\t\t= 10000;\r\n\tallocSize.maxAssetCount\t\t\t\t= 1000;\r\n\tallocSize.formTemplateNodeCount\t\t= 10000;\r\n\r\n\tthis->setupAllocation(&allocSize);\r\n\r\n\tsrand(3920567);\r\n\tif (res) {  res &= CKLBInnerDefManager::initManager(allocSize.formTemplateNodeCount); }\r\n\r\n\tif (res) {\tres &= CKLBTextTempBuffer::allocatorBuffer(200, 40, 4); } // Before InitialTasks !\r\n\tif (res) {\tres &= initSystem(&allocSize);\t}\r\n\tif (res) {\tres &= initOther();\t\t}\r\n\tif (res) {  res &= CKLBDataHandler::init(allocSize.handlerPoolSize); }\r\n\tif (res) {  res &= CKLBHTTPInterface::initHTTPLib(); }\r\n\tif (res) {  res &= NetworkManager::startNetworkManager(); }\r\n\r\n\tif (res) {  res &= CKLBDatabase::getInstance().init(m_useDefaultDB ? \"file://install/gamedb.db\" : NULL,SQLITE_OPEN_READONLY); }\r\n\tif (res) {  res &= CKLBScriptEnv::getInstance().setupScriptEnv(); }\r\n\t// Init database\r\n\tif (res) {\tres &= CKLBLanguageDatabase::getInstance().init();\t}\r\n\t// タスクの立ち上げはすべての初期化が終わった後\r\n\tif (res) {\tres &= callInitialTasks(m_width, m_height);\t}\r\n    m_updateRotation = false;\r\n\treturn res;\r\n}\r\n\r\nbool\r\nCKLBGameApplication::frameFlip(u32 deltaT)\r\n{\r\n    if(m_updateRotation) {\r\n        m_updateRotation = false;\r\n\r\n        // changePointingMatrix(m_origin, m_width, m_height);\r\n        // changeScreenMatrix(m_origin, m_width, m_height);\r\n    }\r\n\tbool bContinue = CKLBTaskMgr::getInstance().execute(deltaT);\r\n\tif(m_reboot) {\r\n\t\tfinishGame();\r\n\t\tinitGame();\r\n\t\tm_reboot = false;\r\n\t}\r\n\treturn bContinue;\r\n}\r\n\r\ns32 \r\nCKLBGameApplication::getFrameTime() \r\n{\r\n\treturn m_frameTime;\r\n}\r\n\r\nvoid \r\nCKLBGameApplication::setFrameTime(s32 time) \r\n{\r\n\tm_frameTime = time;\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::inputPoint(int id, IClientRequest::INPUT_TYPE type, int x, int y)\r\n{\r\n\tint cx, cy;\r\n\tCKLBDrawResource::getInstance().convPointing(x, y, cx, cy);\t// 座標をスケーリング率で変換\r\n\tCKLBTouchPadQueue::getInstance().addQueue(id, type, cx, cy);\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::inputDeviceKey(int keyId, char eventType)\r\n{\r\n    CKLBDeviceKeyEventQueue::getInstance().addQueue(keyId, eventType);\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::controlEvent(EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\t\t\t\t\t\t\tsize_t datasize1, void * pData1, size_t datasize2, void * pData2)\r\n{\r\n    CKLBOSCtrlQueue::getInstance().addQueue(type, pWidget, datasize1, pData1, datasize2, pData2);\r\n}\r\n\r\nbool\r\nCKLBGameApplication::initLocalSystem(CKLBAssetManager& /*mgrAsset*/)\r\n{\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBGameApplication::initSystem(AllocationSize* pSizes)\r\n{\r\n\t//\r\n\t// 1. Load Asset (normally request from other asset should kick.\r\n\t//\r\n\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\tpAssetManager.init(pSizes->maxAssetCount, pSizes->dictionnaryNodePoolSize);\t// 2012.12.11  コンストラクタから外して明示的に行うように(Reboot時に呼ばれない為)\r\n    \r\n\tTexturePacker& p = TexturePacker::getInstance();\r\n\tif (!p.init(2048,512,STARTUP_FORMAT)) { // If change needed, please modify the STARTUP_FORMAT define, not the code here.\r\n\t\treturn false;\r\n\t}\r\n\r\n\t//\r\n\t// OPTIMIZE TRICK : Should order the plugin registration from the least used to the most used.\r\n\t//\r\n\r\n\tCKLBCompositeAssetPlugin*\r\n\t\t\t\t\t\t\tpCompositePlugin= KLBNEW(CKLBCompositeAssetPlugin);\r\n\tKLBTextureAssetPlugin*\tpTexturePlugin\t= KLBNEW(KLBTextureAssetPlugin);\r\n\tKLBFlashAssetPlugin*\tpFlashPlugin\t= KLBNEW(KLBFlashAssetPlugin);\r\n\tKLBBlendAnimationAssetPlugin*\r\n\t\t\t\t\t\t\tpNodeAnimPlugin\t= KLBNEW(KLBBlendAnimationAssetPlugin);\r\n\tKLBAudioAssetPlugin*\tpAudioPlugin\t= KLBNEW(KLBAudioAssetPlugin);\r\n\r\n\tif (pTexturePlugin && pFlashPlugin && pAudioPlugin) {\r\n\t\tpAssetManager.registerAssetPlugIn(pNodeAnimPlugin);\r\n\t\tpAssetManager.registerAssetPlugIn(pAudioPlugin);\r\n\t\tpAssetManager.registerAssetPlugIn(pFlashPlugin);\r\n\t\tpAssetManager.registerAssetPlugIn(pCompositePlugin);\t// Form as second.\r\n\t\tpAssetManager.registerAssetPlugIn(pTexturePlugin);\t\t// Register last because most used.\r\n\t\treturn initLocalSystem(pAssetManager);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBGameApplication::callInitialTasks(int width, int height)\r\n{\r\n\tbool res;\r\n\r\n\tres  = (CKLBDrawTask::create(true, width, height) != NULL);\r\n\tres &= (CKLBTouchPad::create() != NULL);\r\n\tres &= (CKLBDeviceKeyEvent::create() != NULL);\r\n    res &= (CKLBOSCtrlEvent::create() != NULL);\r\n\tres &= (CKLBTouchEventUITask::create() != NULL);\r\n#ifdef DEBUG_MENU\r\n    //\r\n    // Was initialized in CKLBDebugMenu::Create but\r\n    // wanted to be able to load font in LUA first\r\n    // Before creating the menu.\r\n    //\r\n\tCKLBDebugResource& dbgRes = CKLBDebugResource::getInstance();\r\n\tdbgRes.init();\r\n#endif\r\n\r\n\tres &= (CKLBScriptEnv::getInstance().boot(m_bootFile) != false);\r\n\r\n#ifdef DEBUG_MENU\r\n\tif (m_useDefaultFont) {\r\n\t\tres &= (CKLBDebugMenu::create() != NULL);\r\n\t}\r\n#endif\r\n    return res;\r\n}\r\n \r\nbool\r\nCKLBGameApplication::initOther()\r\n{\r\n\treturn true;\r\n}\r\n\r\n\r\nvoid\r\nCKLBGameApplication::changePointingMatrix(ORIGIN origin, int width, int height)\r\n{\r\n\t/*\r\n\t\t引数のwidth/height は向きが0のときの幅/高さであるため、\r\n        90/270度の場合は値を入れ替えて扱う必要がある。\r\n\t*/\r\n    float pad_matrix[4][6] = {\r\n        // 0[deg]\r\n        {   1.0f,   0.0f,   0.0f,\r\n            0.0f,   1.0f,   0.0f },\r\n        \r\n        // 90[deg]\r\n        {   0.0f,   1.0f,  (float)height,\r\n\t\t\t-1.0f,   0.0f, 0.0f },\r\n        \r\n        // 180[deg]\r\n        {   -1.0f,  0.0f,   (float)width,\r\n            0.0f,   -1.0f,  (float)height },\r\n        \r\n        //270[deg]\r\n        {   0.0f,   1.0f,   (float)height,\r\n            -1.0f,  0.0f,   0.0f },\r\n    };\r\n    CKLBTouchPadQueue::getInstance().setConvertMatrix(pad_matrix[origin]);    \r\n}\r\n\r\nvoid\r\nCKLBGameApplication::changeScreenMatrix(ORIGIN origin, int width, int height)\r\n{\r\n    GLfloat proj_matrix[4][16] = {\r\n        // 0[deg]\r\n        {   (2.0f/width),       0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n            0.0f,               (-2.0f/height),         0.0f,\t0.0f,\r\n            0.0f,               0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n            -1.0f,              1.0f,\t\t\t\t\t1.0f,\t1.0f, },\r\n        \r\n        // 90[deg]\r\n        {   0.0f,               (2.0f/height),\t\t\t0.0f,\t0.0f,\r\n            (2.0f/width),       0.0f,                   0.0f,\t0.0f,\r\n            0.0f,               0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n            -1.0f,              -1.0f,\t\t\t\t\t1.0f,\t1.0f, },\r\n        \r\n        // 180[deg]\r\n        {   (-2.0f/width),      0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n            0.0f,               (2.0f/height),          0.0f,\t0.0f,\r\n            0.0f,               0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n            1.0f,               -1.0f,\t\t\t\t\t1.0f,\t1.0f, },\r\n        \r\n        // 270[deg]\r\n        {   0.0f,               (-2.0f/height),         0.0f,\t0.0f,\r\n            (-2.0f/width),      0.0f,                   0.0f,\t0.0f,\r\n            0.0f,               0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n            1.0f,               1.0f,\t\t\t\t\t1.0f,\t1.0f, },\r\n    };\r\n    CKLBDrawResource::getInstance().changeProjectionMatrix(proj_matrix[origin], width, height);\r\n}\r\n\r\nbool\r\nCKLBGameApplication::reportScreenRotation(ORIGIN /*origin*/, SCRMODE mode)\r\n{\r\n\tint value = CKLBAppProperty::getInstance().getValue(CKLBAppProperty::SCRN_TYPE);\r\n    if(value < 0) { return true; }  // 設定されていなければどっちでもいい\r\n\r\n\t// 設定されている値であればtrue, 違えば false\r\n\treturn (mode == (SCRMODE)value);\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::changeScreenInfo(ORIGIN origin, int width, int height)\r\n{\r\n    // request from other therad. \r\n    m_width = width;\r\n    m_height = height;\r\n    m_origin = origin;\r\n    m_updateRotation = true;\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::localFinish()\r\n{\r\n\t// empty\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBGameApplication::setupAllocation(AllocationSize* /*pStruct*/) \r\n{\r\n\t//\r\n\t// Default implementation does not and do not modify the parameters\r\n\t//\r\n\t// DO NOT MODIFY.\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::finishGame()\r\n{\r\n#ifdef DEBUG_MENU\r\n\tCKLBDebugResource::getInstance().release();\r\n#endif\r\n\r\n    CKLBTaskMgr::getInstance().clearTaskList();\r\n\r\n\tNetworkManager::stopNetworkManager();\r\n\tCKLBHTTPInterface::releaseHTTPLib();\r\n\r\n\t// project local system finish.\r\n\tlocalFinish();\r\n\r\n\r\n\r\n\tCKLBFormGroup::getInstance().release();\r\n\tCKLBLuaEnv::getInstance().finishLuaEnv();\r\n\r\n\tCKLBLabelNode::release();\r\n\r\n\t// Free DB Object if allocated.\r\n\tCKLBDatabase::getInstance().release();\r\n\r\n\tCKLBLanguageDatabase::getInstance().release();\r\n\r\n\t// Free Temporary global buffer.\r\n\tCKLBTextTempBuffer::freeBuffer();\r\n\r\n\tCKLBNetAPIKeyChain::getInstance().release();\r\n\r\n\t// Free all singleton in OUR desired order.\r\n\t// (final empty destruction of course done by CRT)\r\n\tTexturePacker::getInstance().release(); // Release Texture BEFORE Rendering Mgr\r\n\tCKLBRenderingManager::getInstance().release();\r\n\tCKLBAssetManager::getInstance().release();\r\n\tCKLBDataHandler::release();\r\n\tCKLBInnerDefManager::releaseManager();\r\n\r\n\t// KLBDELETEA(m_bootFile);\tm_bootFile = NULL; // 2012.12.11  コメントアウト(Reboot時に再生成されない為)\r\n\tCKLBScriptEnv::getInstance().finishScriptEnv();\r\n}\r\n\r\nvoid\r\nCKLBGameApplication::reboot()\r\n{\r\n\tm_reboot = true;\r\n}\r\n\r\n\r\nvoid\r\nCKLBGameApplication::resetViewport()\r\n{\r\n  CKLBDrawResource::getInstance().ResetViewport();\r\n}\r\n\r\nFILE* \r\nCKLBGameApplication::getShellOutput() \r\n{\r\n\tif (m_outStream) {\r\n\t\treturn m_outStream;\r\n\t} else {\r\n\t\treturn stdout;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBGameApplication::setShellOutput(FILE* stream) \r\n{\r\n\tm_outStream = stream;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBGameApplication.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBClientBase.h\r\n//  GameEngine\r\n//\r\n#ifndef CKLBGameApplication_h\r\n#define CKLBGameApplication_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBAssetManager;\r\n\r\nclass CKLBGameApplication : public IClientRequest\r\n{\r\npublic:\r\n    CKLBGameApplication();\r\n    virtual ~CKLBGameApplication();\r\n\r\n\tvoid setInitParam\t(u32 param, void* complexSetup);\r\n\tbool initGame\t\t();\r\n\tvoid finishGame\t\t();\r\n    \r\n\tbool setScreenInfo\t(bool rotate, int width, int height);\r\n\tbool setFilePath\t(const char * strPath);\r\n    \r\n\tvirtual \r\n\tbool executeCommand\t(const char* command);\r\n\tvoid reboot\t\t\t();\r\n\r\n    void resetViewport\t();\r\n\r\n\tvirtual FILE* getShellOutput();\r\n\tvirtual void  setShellOutput(FILE* stream);\r\n\r\nprotected:\r\n\tstruct AllocationSize {\r\n\t\t/* Maximum number of single unique node inside dictionnary*/\r\n\t\tu32\t\tdictionnaryNodePoolSize;\r\n\t\t/* Maximum number of handler associated with ressources*/\r\n\t\tu32\t\thandlerPoolSize;\r\n\t\t/* Maximum number of ui parts for all loaded form assets */\r\n\t\tu32\t\tformTemplateNodeCount;\r\n\t\t/* Maximum number of real asset (texture, form, audio sound) loaded at the same time*/\r\n\t\tu32\t\tmaxAssetCount;\r\n\t};\r\n\t\r\n\tvirtual void pauseGame\t\t\t\t(bool pause);\r\n\r\n\tvirtual void setupAllocation\t\t(AllocationSize* pStruct);\r\n\tvirtual int  getPhysicalScreenWidth\t();\r\n\tvirtual int  getPhysicalScreenHeight();\r\n\r\n    // デフォルトでは標準のシステムタスクを起動する。\r\n    virtual bool callInitialTasks(int width, int height);\r\n\r\n\t// その他初期化処理\r\n\tvirtual bool initOther();\r\n\r\n    // デフォルトでは全方向許可\r\n    virtual bool reportScreenRotation(ORIGIN origin, SCRMODE mode);        \r\n    // デフォルトでは縦横いずれでも全画面使用\r\n    virtual void changeScreenMatrix(ORIGIN origin, int width, int height);\r\n    \r\n    \r\n    \r\n    // ポインティングデバイスによる入力(物理座標)\r\n    virtual void inputPoint(int id, IClientRequest::INPUT_TYPE type, int x, int y);\r\n    \r\n    virtual void inputDeviceKey(int keyId, char eventType);\r\n\r\n    // その他OSコントロールによるイベント通知\r\n    virtual void controlEvent(EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\t\t\t\t\t\tsize_t datasize1, void * pData1,\r\n\t\t\t\t\t\t\t\tsize_t datasize2, void * pData2);\r\n    \r\n    // デフォルトでは常に論理的左上を原点とする\r\n    virtual void changePointingMatrix(ORIGIN origin, int width, int height);\r\n    \r\n    \r\n    bool\tframeFlip\t\t\t(u32 deltaT);\r\n\ts32\t\tgetFrameTime\t\t();\r\n\tvoid\tsetFrameTime\t\t(s32 time);\r\n    void\tchangeScreenInfo\t(ORIGIN origin, int width, int height);\r\n    bool\tinitSystem\t\t\t(AllocationSize* pSizes);\r\n    virtual \r\n\tbool\tinitLocalSystem\t\t(CKLBAssetManager& mgrAsset);\r\n\tvirtual \r\n\tvoid\tlocalFinish\t\t\t();\r\n    \r\n\tint\t\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\t\tm_frameTime;\r\n    IClientRequest::ORIGIN  m_origin;\r\n\tbool\t\t\t\t\tm_useDefaultDB;\r\n\tbool\t\t\t\t\tm_useDefaultFont;\r\n    bool                    m_updateRotation;\r\n\tbool\t\t\t\t\tm_reboot;\r\n\tconst char\t\t\t*\tm_bootFile;\r\n\tFILE*\t\t\t\t\tm_outStream;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBGameApplicationDebugModule.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBGameApplication.h\"\r\n\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBTexturePacker.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBLuaLibSOUND.h\"\r\n\r\nstatic void parseBuffer(char* command, char** args, int* argc) {\r\n\tchar*\tparse\t\t= command;\r\n\tbool\temptySpace\t= true;\r\n\tint\t\targRes\t\t= 0;\r\n\r\n\twhile (*parse != 0) {\r\n\t\tif (*parse <= 32) {\r\n\t\t\t// Invisible\r\n\t\t\t*parse = 0;\r\n\t\t\temptySpace = true;\r\n\t\t} else {\r\n\t\t\t// Char\r\n\t\t\tif (emptySpace == true) {\r\n\t\t\t\t// Transition\r\n\t\t\t\targs[argRes++] = parse;\r\n\t\t\t}\r\n\t\t\temptySpace = false;\r\n\t\t}\r\n\t\tparse++;\r\n\t}\r\n\t*argc = argRes;\r\n}\r\n\r\nbool CKLBGameApplication::executeCommand(const char* command) {\r\n\tchar\tcommandL[1000];\r\n\tchar*\tcommArgs[10];\r\n\tint\t\targCount;\r\n\r\n\tbool\tresult = false;\r\n\t// Copy string\r\n\tint l = strlen(command);\r\n\tmemcpy(commandL, command, l+1);\r\n\t\r\n\t// Make sure previous stuff is cleaned.\r\n\tprintf(\"\\n\");\r\n\r\n\t// Cut Buffer.\r\n\tparseBuffer(commandL, commArgs, &argCount);\r\n\t\r\n\tif (argCount >= 1) {\r\n\t\tif (strcmp(\"HELP\", commArgs[0]) == 0) {\r\n\t\t\tprintf(\"\\n---- Debug Shell Help-----\\n\");\r\n\t\t\tprintf(\"DUMP SCENE\\n\");\r\n\t\t\tprintf(\"\\tDump all the scene graph, including type, name, linked task\\n\\n\");\r\n\t\t\tprintf(\"DUMP PACKER [DETAIL]\\n\");\r\n\t\t\tprintf(\"\\tDump texture packer surfaces : position, size, state, buffer type\\n\\n\");\r\n\t\t\tprintf(\"DUMP ASSET\\n\");\r\n\t\t\tprintf(\"\\tDump the list of asset registered in the asset dictionnary. Asset created from dynamic Json are not listed (forms)\\n\\n\");\r\n\t\t\tprintf(\"DUMP RENDER [DETAIL]\\n\");\r\n\t\t\tprintf(\"\\tDump the list of render command : type, order, vertex/index count\\n\\n\");\r\n\t\t\tprintf(\"DUMP TASKS\\n\");\r\n\t\t\tprintf(\"\\tDump the list of tasks instances.\\n\");\r\n\t\t\tprintf(\"LOG RENDER\\n\");\r\n\t\t\tprintf(\"LOG SYSLOAD\\n\");\r\n\t\t\tprintf(\"\\tLog execution time of next sysload command\\n\\n\");\r\n\t\t\tprintf(\"DUMP SYSLOAD\\n\");\r\n\t\t\tprintf(\"\\tDump the execution time for the sysload command logged.\\n\\n\");\r\n\t\t\tprintf(\"HELP\\n\");\r\n\t\t\tprintf(\"\\tThis help.\\n\\n\");\r\n\r\n\t\t\tprintf(\"lt script\\n\");\r\n\t\t\tprintf(\"\\tToggle display execution time for the script section.(CB included ?)\\n\\n\");\r\n\r\n\t\t\tprintf(\"lt render\\n\");\r\n\t\t\tprintf(\"\\tToggle display execution time for scene graph update and rendering batch.\\n\\n\");\r\n\r\n\t\t\tprintf(\"lt frame\\n\");\r\n\t\t\tprintf(\"\\tToggle display execution time for the whole frame.\\n\\n\");\r\n\r\n\t\t\tprintf(\"Note : to disable 'lt' command disable if called again.\\n\\n\");\r\n\t\t\tresult = true;\r\n\t\t} else\r\n\t\t/* if (strcmp(\"g\", commArgs[0]) == 0) {\r\n\t\t\tif (argCount == 2) {\r\n\t\t\t\tint l = strlen(commArgs[1]);\r\n\t\t\t\tchar* pEnd = &((commArgs[1])[l]);\r\n\t\t\t\tlong val =  strtol((const char*)commArgs[1],&pEnd,16);\r\n\t\t\t\tvoid* p = (void*)val;\r\n\t\t\t\t\r\n\t\t\t\tif (CKLBTaskMgr::getInstance().isExistTask((CKLBTask*)p)) {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (argCount == 3) {\r\n\t\t\t\r\n\t\t\t}\r\n\t\t} else */\r\n\t\tif (strcmp(\"STOP\", commArgs[0]) == 0) {\r\n\t\t\tthis->pauseGame(true);\r\n\t\t\tresult = true;\r\n\t\t} else\r\n\t\tif (strcmp(\"RENDER\", commArgs[0]) == 0) {\r\n\t\t\tif (argCount >= 2) {\r\n\t\t\t\tif (strcmp(\"NORMAL\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBRenderingManager::getInstance().renderOverdraw(0);\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"OVERDRAW\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBRenderingManager::getInstance().renderOverdraw(1);\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"BATCH\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBRenderingManager::getInstance().renderOverdraw(2);\r\n\t\t\t\t}\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t} else\r\n\t\tif (strcmp(\"UNLOAD\", commArgs[0])==0) {\r\n\t\t\tCKLBAssetManager::getInstance().unloadAsset();\r\n\t\t\tresult = true;\r\n\t\t} else\r\n\t\tif (strcmp(\"RELOAD\", commArgs[0])==0) {\r\n\t\t\tCKLBAssetManager::getInstance().restoreAsset();\r\n\t\t\tresult = true;\r\n\t\t} else\t\tif (strcmp(\"PLAY\", commArgs[0]) == 0) {\r\n\t\t\tthis->pauseGame(false);\r\n\t\t\tresult = true;\r\n\t\t} else\r\n\t\tif (strcmp(\"DUMP\", commArgs[0]) == 0) {\r\n\t\t\tif (argCount >= 2) {\r\n\t\t\t\tif (strcmp(\"SCENE\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\t\t\t\t\tres.getRoot()->dump(0, 0xFFFFFFFF);\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"TASKS\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBTaskMgr::getInstance().dump();\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"PACKER\", commArgs[1]) == 0) {\r\n\t\t\t\t\tTexturePacker::getInstance().dump(argCount == 3);\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"ASSET\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBAssetManager::getInstance().dump();\r\n\t\t\t\t\tCKLBLuaLibSOUND::s_dumpObjects();\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"RENDER\", commArgs[1]) == 0) {\r\n\t\t\t\t\tif (argCount == 3) {\r\n\t\t\t\t\t\tCKLBRenderingManager::getInstance().dump(0xFFFFFFFF);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tCKLBRenderingManager::getInstance().dumpMetrics();\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"DATASET\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBDataHandler::dumpDataSet();\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"SYSLOAD\", commArgs[1]) == 0) {\r\n#ifdef INTERNAL_BENCH\r\n\t\t\t\t\tlogTimeDump();\r\n#else\r\n\t\t\t\t\tprintf(\"Please recompile the engine with INTERNAL_BENCH defined. (CKLBLuaTask.h)\\n\");\r\n#endif\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else\r\n\t\tif (strcmp(\"LOG\", commArgs[0]) == 0) {\r\n\t\t\tif (argCount >= 2) {\r\n\t\t\t\tif (strcmp(\"FRAME\", commArgs[1]) == 0) {\r\n\t\t\t\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t\t\t\t\tdraw.setLog(!draw.allowLog());\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t} else\r\n\t\t\t\tif (strcmp(\"SYSLOAD\", commArgs[1]) == 0) {\r\n#ifdef INTERNAL_BENCH\r\n\t\t\t\t\tlogDo();\r\n#else\r\n\t\t\t\t\tprintf(\"Please recompile the engine with INTERNAL_BENCH defined. (CKLBLuaTask.h)\\n\");\r\n#endif\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else\r\n\t\tif (strcmp(\"ENABLE\", commArgs[0]) == 0) {\r\n\t\t\tif (argCount >= 2) {\r\n\t\t\t\tif (strcmp(\"RENDER\", commArgs[1]) == 0) {\r\n\t\t\t\t\tif (argCount >= 4) {\r\n\t\t\t\t\t\tu32 start = atoi(commArgs[2]);\r\n\t\t\t\t\t\tu32 end   = atoi(commArgs[3]);\r\n\t\t\t\t\t\tCKLBRenderingManager::getInstance().enableRange(start,end,true);\r\n\t\t\t\t\t\tresult = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else\r\n\t\tif (strcmp(\"DISABLE\", commArgs[0]) == 0) {\r\n\t\t\tif (argCount >= 2) {\r\n\t\t\t\tif (strcmp(\"RENDER\", commArgs[1]) == 0) {\r\n\t\t\t\t\tif (argCount >= 4) {\r\n\t\t\t\t\t\tu32 start = atoi(commArgs[2]);\r\n\t\t\t\t\t\tu32 end   = atoi(commArgs[3]);\r\n\t\t\t\t\t\tCKLBRenderingManager::getInstance().enableRange(start,end,false);\r\n\t\t\t\t\t\tresult = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!result) {\r\n\t\tprintf(\"[Shell] Invalid command : '%s', please try 'help'\\n\", command); \r\n\t}\r\n\treturn result;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBGenericTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBGenericTask.cpp\r\n//  GameEngine\r\n//\r\n//\r\n#include <string.h>\r\n#include \"CKLBGenericTask.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tGENERIC_STOP_EXECUTE\t= 0,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"GENERIC_STOP_EXECUTE\",\t\tGENERIC_STOP_EXECUTE\t\t},\r\n\r\n\t// Enum\r\n\t{\"TASK_P_MENU\",\t\tCKLBTask::P_MENU   },\r\n\r\n\t{\"TASK_P_PREV\",\t\tCKLBTask::P_PREV   },\r\n\t{\"TASK_P_NORMAL\",\tCKLBTask::P_NORMAL },\r\n\t{\"TASK_P_AFTER\",\tCKLBTask::P_AFTER  },\r\n\t{\"TASK_P_JUDGE\",\tCKLBTask::P_JUDGE  },\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBGenericTask> factory(\"TASK_Generic\", CLS_KLBTASKGENERIC, cmd);\r\n\r\nenum {\r\n    ARGS_EXEC       = 1,\r\n    ARGS_DIE,\r\n    ARGS_ARRAY,\r\n\r\n\tARGS_PHASE,\r\n\tARGS_PARENT,\r\n\r\n    ARGS_REQUIRE    = ARGS_ARRAY,\r\n    ARGS_MAX        = ARGS_PARENT\r\n};\r\n\r\nCKLBGenericTask::CKLBGenericTask()\r\n: CKLBLuaPropTask\t()\r\n, m_luaFuncExec\t\t(NULL)\r\n, m_luaFuncDie\t\t(NULL)\r\n, m_ArrayIndex\t\t(NULL)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBGenericTask::~CKLBGenericTask() \r\n{\r\n\tKLBDELETEA(m_luaFuncExec);\r\n    KLBDELETEA(m_luaFuncDie);\r\n    KLBDELETEA(m_ArrayIndex);\r\n}\r\n\r\nbool \r\nCKLBGenericTask::init(CKLBTask* pTask, CKLBTask::TASK_PHASE phase, const char * name_exec, const char * name_die, const char * arr_index)\r\n{\r\n\tm_luaFuncExec = CKLBUtility::copyString(name_exec);\r\n\tm_luaFuncDie  = CKLBUtility::copyString(name_die);\r\n\tm_ArrayIndex  = CKLBUtility::copyString(arr_index);\r\n\r\n    if(!m_luaFuncExec || !m_luaFuncDie || !m_ArrayIndex) {\r\n        KLBDELETEA(m_luaFuncExec);\r\n        KLBDELETEA(m_luaFuncDie);\r\n        KLBDELETEA(m_ArrayIndex);\r\n        return false;\r\n    }\r\n    bool result = regist(pTask, phase);\r\n    if(!result) {\r\n        KLBDELETEA(m_luaFuncExec);\r\n        KLBDELETEA(m_luaFuncDie);\r\n        KLBDELETEA(m_ArrayIndex);\r\n    }\r\n    return result;\r\n}\r\n\r\nCKLBGenericTask* \r\nCKLBGenericTask::create(CKLBTask* pParentTask, CKLBTask::TASK_PHASE phase, const char * name_exec, const char * name_die, const char * arr_index)\r\n{\r\n\tCKLBGenericTask* pTask = KLBNEW(CKLBGenericTask);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, phase, name_exec, name_die, arr_index)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBGenericTask::initScript(CLuaState &lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARGS_REQUIRE || argc > ARGS_MAX) {\r\n        return false;\r\n    }\r\n\r\n    const char * name_exec = lua.getString(ARGS_EXEC);\r\n    const char * name_die  = lua.getString(ARGS_DIE);\r\n    const char * arr_index = lua.getString(ARGS_ARRAY);\r\n\tCKLBTask::TASK_PHASE phase = (CKLBTask::TASK_PHASE)((argc >= ARGS_PHASE) ? lua.getInt(ARGS_PHASE) : P_NORMAL);\r\n\tCKLBTask * pParent = (argc >= ARGS_PARENT) ? (CKLBTask *)lua.getPointer(ARGS_PARENT) : NULL;\r\n\r\n\treturn init(pParent, phase, name_exec, name_die, arr_index);\r\n}\r\n\r\nvoid\r\nCKLBGenericTask::execute(u32 deltaT)\r\n{\r\n\tif (m_luaFuncExec) {\r\n\t\tCKLBScriptEnv::getInstance().call_genTaskExecute(m_luaFuncExec, this, deltaT, m_ArrayIndex);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBGenericTask::die()\r\n{\r\n\tCKLBScriptEnv::getInstance().call_genTaskDie(m_luaFuncDie, this, m_ArrayIndex);\r\n\r\n\tKLBDELETEA(m_luaFuncExec); m_luaFuncExec = NULL;\r\n    KLBDELETEA(m_luaFuncDie);  m_luaFuncDie  = NULL;\r\n    KLBDELETEA(m_ArrayIndex);  m_ArrayIndex  = NULL;\r\n}\r\n\r\nint \r\nCKLBGenericTask::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint cmd = lua.getInt(2);\r\n\tint ret = 1;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase GENERIC_STOP_EXECUTE:\r\n\t\t{\r\n\t\t\tKLBDELETEA(m_luaFuncExec); m_luaFuncExec = NULL;\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nu32\r\nCKLBGenericTask::getClassID()\r\n{\r\n\treturn CLS_KLBTASKGENERIC;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBGenericTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CGenericTask.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CKLBGenericTask_h\r\n#define CKLBGenericTask_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBGenericTask\r\n* \\brief Generic Task Class\r\n* \r\n* CKLBGenericTask is the most generic class of the Engine that can be used\r\n* for scripting purpose.\r\n* It is just made to execute some script code every frame.\r\n*/\r\nclass CKLBGenericTask : public CKLBLuaPropTask\r\n{\r\nprivate:\r\n\tbool init(CKLBTask* pTask, CKLBTask::TASK_PHASE phase, const char * name_exec, const char * name_die, const char * arr_index);\r\npublic:\r\n\tstatic CKLBGenericTask* create(CKLBTask* pParentTask, CKLBTask::TASK_PHASE phase, const char * name_exec, const char * name_die, const char * arr_index);\r\n    CKLBGenericTask();\r\n    virtual ~CKLBGenericTask();\r\n\r\n    bool\tinitScript\t\t(CLuaState& lua);\r\n    int\t\tcommandScript\t(CLuaState& lua);\r\n\r\n    void\texecute\t\t\t(u32 deltaT);\r\n    void\tdie\t\t\t\t();\r\n\r\n\tu32\t\tgetClassID\t\t();\r\nprivate:\r\n\r\n    const char  *   m_luaFuncExec;\r\n    const char  *   m_luaFuncDie;\r\n    const char  *   m_ArrayIndex;\r\n};\r\n\r\n#endif // CKLBGenericTask_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBIntervalTimer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBIntervalTimer.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n;\r\n\r\nenum {\r\n\tINTERVALTIMER_TIME = 0,\r\n\tINTERVALTIMER_FRAME\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBIntervalTimer> factory(\"UTIL_IntervalTimer\", CLS_KLBINTERVALTIMER);\r\n\r\nCKLBIntervalTimer::CKLBIntervalTimer() \r\n:CKLBLuaPropTask\t()\r\n,m_callback\t\t\t(NULL) \r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBIntervalTimer::~CKLBIntervalTimer() {}\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBIntervalTimer::ms_propItems[] = {\r\n\t{\t\"timer_id\",\t\tUINTEGER,\t(setBoolT)&CKLBIntervalTimer::setTimerID,\t(getBoolT)&CKLBIntervalTimer::getTimerID,\t0\t},\r\n\t{\t\"interval\",\t\tUINTEGER,\t(setBoolT)&CKLBIntervalTimer::setInterval,\t(getBoolT)&CKLBIntervalTimer::getInterval,\t0\t},\r\n\t{\t\"is_repeating\",\tBOOLEANT,\t(setBoolT)&CKLBIntervalTimer::setRepeat,\t(getBoolT)&CKLBIntervalTimer::getRepeat,\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_TIMER_ID = 1,\t// callbackの引数に与えらえるタイマーID\r\n\tARG_CALLBACK,\t\t// callbackに使用する関数名称\r\n\tARG_INTERVAL,\t\t// 起動後にcallbackを呼ぶまでの時間(ミリ秒)\r\n\tARG_REPEAT,\t\t\t// デフォルトではfalse\r\n\t\t\t\t\t\t// falseでは一回callbackを呼び出した後、タスクは自殺する。\r\n\t\t\t\t\t\t// true の場合、ARG_INTERVAL間隔でcallbackを呼び出す。\r\n\tARG_PARENT,\r\n\tARG_REQUIRE = ARG_INTERVAL,\t\r\n\tARG_NUMS    = ARG_PARENT\r\n};\r\n\r\nu32\r\nCKLBIntervalTimer::getClassID()\r\n{\r\n\treturn CLS_KLBINTERVALTIMER;\r\n}\r\n\r\nCKLBIntervalTimer*\r\nCKLBIntervalTimer::create(CKLBTask* pParentTask, u32 timerID, u32 interval, bool repeat, const char* callback, u8 mode, bool killIfUpdate) {\r\n\tCKLBIntervalTimer* pTask = KLBNEW(CKLBIntervalTimer);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, timerID, interval, repeat, callback, mode, killIfUpdate)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBIntervalTimer::init(CKLBTask* pTask, u32 timerID, u32 interval, bool repeat, const char* callback, u8 mode, bool killIfUpdate) {\r\n\tsetStrC(m_callback,callback);\r\n\r\n\tif(!m_callback) return false;\r\n\r\n\t// Properties definition\r\n\tif(!setupPropertyList((const char**)CKLBIntervalTimer::ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 引数取り込み\r\n\tsetTimerID\t(timerID);\r\n\tsetInterval\t(interval);\r\n\tsetRepeat\t(repeat);\r\n\tm_mode\t\t\t= mode;\r\n\tm_killIfUpdate\t= killIfUpdate;\r\n\r\n\tm_countup = 0;\r\n\r\n\treturn regist(pTask, P_UIPREV);\r\n}\r\n\r\nbool\r\nCKLBIntervalTimer::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tconst char * callback = lua.getString(ARG_CALLBACK);\r\n\tbool b_repeat = (argc >= ARG_REPEAT) ? lua.getBool(ARG_REPEAT) : false;\r\n\tCKLBTask* pParent = NULL;\r\n\tif (argc >= ARG_PARENT) { pParent = (CKLBTask*)lua.getPointer(ARG_PARENT); }\r\n\treturn init(pParent, lua.getInt(ARG_TIMER_ID),lua.getInt(ARG_INTERVAL), b_repeat, callback, INTERVALTIMER_TIME, true);\r\n}\r\n\r\nvoid\r\nCKLBIntervalTimer::die()\r\n{\r\n\tKLBDELETEA(m_callback);\r\n}\r\n\r\nvoid\r\nCKLBIntervalTimer::execute(u32 deltaT)\r\n{\r\n\tswitch(m_mode) {\r\n\t\tcase INTERVALTIMER_TIME\t: m_countup += deltaT;\tbreak;\r\n\t\tcase INTERVALTIMER_FRAME: m_countup++;\t\t\tbreak;\r\n\t}\r\n\t\r\n\tif(m_countup >= m_interval) {\r\n\t\tm_countup -= m_interval;\r\n\t\tu32 oldCountUp = m_countup;\r\n\r\n\t\tCKLBScriptEnv::getInstance().call_intervalTimerExecute(m_callback, this, m_timerID);\r\n\r\n\t\t// REPEATがfalseであれば、callbackを呼んだ後に自殺する。\r\n\t\tif(!m_repeat) {\r\n\t\t\tif(m_killIfUpdate) {\r\n\t\t\t\tkill();\r\n\t\t\t} else {\r\n\t\t\t\tif(oldCountUp == m_countup) {\r\n\t\t\t\t\tkill();\r\n\t\t\t\t}\r\n\t\t\t}\r\n        }\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBIntervalTimer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBIntervalTimer_h\r\n#define CKLBIntervalTimer_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBIntervalTimer\r\n* \\brief Timer Task Class\r\n* \r\n* CKLBIntervalTimer is a basic timer class.\r\n* It makes a call to the callback function when the timer reached the defined time limit.\r\n* It can make this call just once and then die or be in a repeat mode and reset itself\r\n* every time it reaches the defined time limit.\r\n*/\r\nclass CKLBIntervalTimer : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBIntervalTimer>;\r\nprivate:\r\n\tCKLBIntervalTimer();\r\n\tvirtual ~CKLBIntervalTimer();\r\n\r\n\tbool init(CKLBTask* pTask, u32 timerID, u32 interval, bool repeat,const char* callback, u8 mode, bool killIfUpdate);\r\npublic:\r\n\tstatic CKLBIntervalTimer* create(CKLBTask* pParentTask, u32 timerID, u32 interval, bool repeat,const char* callback, u8 mode = 0, bool killIfUpdate = true);\r\n\r\n\tbool initScript(CLuaState& lua);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\n\tinline u32\tgetTimerID\t()\t\t\t\t{\treturn m_timerID;\t}\r\n\tinline void\tsetTimerID\t(u32 id)\t\t{\tm_timerID = id;\t\t}\r\n\r\n\tinline bool\tgetRepeat\t()\t\t\t\t{\treturn m_repeat;\t}\r\n\tinline void\tsetRepeat\t(bool value)\t{\r\n\t\tm_countup = 0;\r\n\t\tm_repeat = value;\t\r\n\t}\r\n\r\n\tinline u32\tgetInterval\t()\t\t\t\t{\treturn m_interval;\t}\r\n\tinline void\tsetInterval\t(u32 value)\t\t{\r\n\t\tm_countup = 0;\r\n\t\tm_interval = value;\r\n\t}\r\n\r\n\tinline u8\tgetMode\t\t()\t\t\t\t{\treturn m_mode;\t\t}\r\n\r\n\tu32\t\t\tgetClassID\t();\r\n\r\nprivate:\r\n\r\n\tconst char\t*\tm_callback;\r\n\r\n\tu32\t\t\t\tm_timerID;\r\n\tu32\t\t\t\tm_interval;\r\n\tu32\t\t\t\tm_countup;\r\n\tu8\t\t\t\tm_mode;\r\n\tbool\t\t\tm_repeat;\r\n\tbool\t\t\tm_killIfUpdate;\r\n\r\n\tstatic\tPROP_V2\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBIntervalTimer_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLibRegistrator.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nCKLBLibRegistrator::CKLBLibRegistrator()\r\n:m_count\t(0)\r\n{\r\n}\r\n\r\nCKLBLibRegistrator::~CKLBLibRegistrator() \r\n{\r\n}\r\n\r\nCKLBLibRegistrator* \r\nCKLBLibRegistrator::getInstance() \r\n{\r\n\tstatic CKLBLibRegistrator reg;\r\n\treturn &reg;\r\n}\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* \r\nCKLBLibRegistrator::add(const char* name, u32 classID) \r\n{\r\n\tklb_assert(m_count < MAX_ELEM, \"Reached maximum allocation space for lib registrator\");\r\n\tLIBREGISTSTRUCT\t*\t\tnew_element = &m_list[m_count++];\r\n\tnew_element->name\t\t= name;\r\n\tnew_element->classID\t= classID;\r\n\treturn new_element;\r\n}\r\n\r\nu32 \r\nCKLBLibRegistrator::getClassID(const char* funcName) \r\n{\r\n\tint n = 0;\r\n\twhile (n < m_count) {\r\n\t\tLIBREGISTSTRUCT\t* pLibReg = &m_list[n];\r\n\r\n\t\tif (CKLBUtility::safe_strcmp(pLibReg->name,funcName)==0) {\r\n\t\t\treturn pLibReg->classID;\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\treturn 0;\r\n}"
  },
  {
    "path": "Engine/source/Core/CKLBLibRegistrator.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLibRegistrator_h\r\n#define CKLBLibRegistrator_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n#define\t\tMAX_ELEM\t(10)\r\n\r\nclass CKLBLibRegistrator\r\n{\r\npublic:\r\n\tstruct LIBREGISTSTRUCT {\r\n\t\tconst char* name;\r\n\t\tu32 classID;\r\n\t\tLIBREGISTSTRUCT* next;\r\n\t};\r\n\r\n\tstatic \r\n\tCKLBLibRegistrator*\t\tgetInstance\t\t();\r\n\tLIBREGISTSTRUCT*\t\tadd\t\t\t\t(const char* name, u32 classID);\r\n\tu32\t\t\t\t\t\tgetClassID\t\t(const char* funcName);\r\n\r\nprivate:\r\n\tint\t\t\t\t\t\t\tm_count;\r\n\tLIBREGISTSTRUCT\t\t\t\tm_list[MAX_ELEM];\r\n\r\n\tCKLBLibRegistrator ();\r\n\t~CKLBLibRegistrator();\r\n};\r\n\r\n#endif"
  },
  {
    "path": "Engine/source/Core/CKLBLifeCtrlTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLifeCtrlTask.h\"\r\n\r\nenum {\r\n\tLIFECTRL_ADD_CHILD,\r\n\r\n\tLIFECTRL_TIME,\r\n\tLIFECTRL_FRAME,\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"LIFECTRL_ADD_CHILD\",\tLIFECTRL_ADD_CHILD },\r\n\t{ \"LIFECTRL_TIME\",\t\tLIFECTRL_TIME },\r\n\t{ \"LIFECTRL_FRAME\",\t\tLIFECTRL_FRAME },\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBLifeCtrlTask> factory(\"LIFECtrl\", CLS_KLBLIFECTRL, cmd);\r\n\r\nCKLBLifeCtrlTask::CKLBLifeCtrlTask()\r\n: CKLBLuaTask\t()\r\n, m_bLinked\t\t(false)\r\n, m_taskLink\t(NULL) \r\n{\r\n}\r\n\r\nCKLBLifeCtrlTask::~CKLBLifeCtrlTask() \r\n{\r\n}\r\n\r\nCKLBLifeCtrlTask* \r\nCKLBLifeCtrlTask::create(CKLBTask* pParentTask, u32 mode, u32 limit) {\r\n\tCKLBLifeCtrlTask* pTask = KLBNEW(CKLBLifeCtrlTask);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, mode, limit)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool CKLBLifeCtrlTask::init(CKLBTask* pTask, u32 mode, u32 limit) {\r\n\tm_count\t= 0;\r\n\tm_mode\t= mode;\r\n\tm_limit = limit;\r\n\r\n\treturn regist(pTask);\r\n}\r\n\r\nbool\r\nCKLBLifeCtrlTask::initScript(CLuaState& lua)\r\n{\r\n\treturn init(NULL,lua.getInt(1),lua.getInt(2));\r\n}\r\n\r\nint\r\nCKLBLifeCtrlTask::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint cmd = lua.getInt(2);\r\n\tint ret = 1;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LIFECTRL_ADD_CHILD:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tCKLBTask * pTask = (CKLBTask *)lua.getPointer(3);\r\n\t\t\tchild(pTask);\t// 自身の子として登録\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n\r\nvoid\r\nCKLBLifeCtrlTask::execute(u32 deltaT)\r\n{\r\n\tswitch(m_mode)\r\n\t{\r\n\tcase LIFECTRL_TIME:\tm_count += deltaT;\tbreak;\r\n\tcase LIFECTRL_FRAME: m_count++;\t\t\tbreak;\r\n\t}\r\n\t// カウンタが指定されたリミットに達していたら、自殺する。\r\n\t// 自殺と同時に子として追加されていたタスクは道連れになる。\r\n\tif(m_count >= m_limit) {\r\n\t\tkill();\r\n\t\tif (m_bLinked) {\r\n\t\t\tm_taskLink->kill();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBLifeCtrlTask::die()\r\n{\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLifeCtrlTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLifeCtrlTask_h\r\n#define CKLBLifeCtrlTask_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n\r\n/*!\r\n* \\class CKLBLifeCtrlTask\r\n* \\brief Life Control Task\r\n* \r\n* CKLBLifeCtrlTask is a Task made for controlling the life of another Task\r\n* of the Engine. \r\n* CKLBLifeCtrlTask has 2 mods : TIME and FRAME.\r\n* A Task can be linked with an instance of CKLBLifeCtrlTask. In that case, the \r\n* CKLBLifeCtrlTask will kill the Task after X milliseconds or frames.\r\n*/\r\nclass CKLBLifeCtrlTask : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBLifeCtrlTask>;\r\nprivate:\r\n\tCKLBLifeCtrlTask();\r\n\tvirtual ~CKLBLifeCtrlTask();\r\n\r\n\tbool init(CKLBTask* pTask, u32 mode, u32 limit);\r\npublic:\r\n\tstatic CKLBLifeCtrlTask* create(CKLBTask* pParentTask, u32 mode, u32 limit);\r\n\r\n\tbool\tinitScript\t\t(CLuaState& lua);\r\n\tint\t\tcommandScript\t(CLuaState& lua);\r\n\r\n\tinline void setTime(u32 mode, u32 unit) {\r\n\t\tm_count = 0;\r\n\t\tm_limit\t= unit;\r\n\t\tm_mode\t= mode;\r\n\t}\r\n\r\n\tinline void link(CKLBTask* taskToKill) {\r\n\t\tm_bLinked\t= (taskToKill != NULL);\r\n\t\tm_taskLink  =  taskToKill;\r\n\t}\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\nprivate:\r\n\tbool\t\t\tm_bLinked;\r\n\tCKLBTask*\t\tm_taskLink;\r\n\tint\t\t\t\tm_mode;\r\n\tu32\t\t\t\tm_limit;\r\n\tu32\t\t\t\tm_count;\r\n};\r\n\t\r\n\r\n#endif // CKLBIntervalTask_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLuaEnv.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaEnv.cpp\r\n//\r\n#include <typeinfo>\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBLuaTask.h\"\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLuaPropTask.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n#ifdef _WIN32\r\n#include <Windows.h>\r\n\r\n#ifdef DEBUG_LUAEDIT\r\n#include \"RemoteDebugger.hpp\"\r\n#pragma comment(lib, \"rdbglua52dll.lib\")\r\n#else\r\n#pragma comment(lib, \"lua52.lib\")\r\n#endif\r\n\r\n#endif\r\n;\r\n\r\nCKLBLuaEnv::CKLBLuaEnv()\r\n: m_L               (NULL)\r\n, m_nowFile         (NULL)\r\n, m_state           (NULL)\r\n, m_bLoadScript     (false)\r\n, m_nextLoadScript  (NULL)\r\n, m_sysLoadEnable   (true)\r\n, m_lowGC           (1)\r\n, m_highGC          (1000)\r\n, m_collect         (0)\r\n{\r\n}\r\n\r\nCKLBLuaEnv::~CKLBLuaEnv()\r\n{\r\n    finishLuaEnv();\r\n}\r\n\r\nCKLBLuaEnv&\r\nCKLBLuaEnv::getInstance()\r\n{\r\n    static CKLBLuaEnv instance;\r\n    return instance;\r\n}\r\n\r\nvoid\r\nCKLBLuaEnv::finishLuaEnv()\r\n{\r\n    KLBDELETE(m_state);             m_state = NULL;\r\n    KLBDELETEA(m_nextLoadScript);   m_nextLoadScript = NULL;\r\n    KLBDELETEA(m_nowFile);          m_nowFile = NULL;\r\n\r\n\t// Lua環境を破棄する前に、ILuaFuncLib によって生成されたリソースの破棄を行う。\r\n\tILuaFuncLib::destroyAllResources();\r\n\r\n    if(m_L) {\r\n#ifdef DEBUG_LUAEDIT\r\n\t\tStopLuaEditRemoteDebugger();\r\n#endif\r\n\t\tlua_close(m_L);\r\n\t\tm_L = NULL;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBLuaEnv::defineInt(const char * defName, int value)\r\n{\r\n\t// 指定された名称のグローバルラベルがすでに存在していればエラーを出す。\r\n\tlua_getglobal(m_L, defName);\r\n\tif(!lua_isnil(m_L, -1)) {\r\n\t\tlua_pop(m_L, 1);\r\n\t\t// 指定されたグローバルラベルがnilではないということは、\r\n\t\t// 同名で値が定義済みであるため、エラーを出す。\r\n\t\treturn false;\r\n\t}\r\n\tlua_pop(m_L, 1);\r\n\tlua_pushinteger(m_L, value);\r\n\tlua_setglobal(m_L, defName);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBLuaEnv::defineNum(const char * defName, float value)\r\n{\r\n\t// 指定された名称のグローバルラベルがすでに存在していればエラーを出す。\r\n\tlua_getglobal(m_L, defName);\r\n\tif(!lua_isnil(m_L, -1)) {\r\n\t\tlua_pop(m_L, 1);\r\n\t\t// 指定されたグローバルラベルがnilではないということは、\r\n\t\t// 同名で値が定義済みであるため、エラーを出す。\r\n\t\treturn false;\r\n\t}\r\n\tlua_pop(m_L, 1);\r\n\tlua_pushnumber(m_L, value);\r\n\tlua_setglobal(m_L, defName);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBLuaEnv::defineString(const char * defName, const char * string)\r\n{\r\n\t// 指定された名称のグローバルラベルがすでに存在していればエラーを出す。\r\n\tlua_getglobal(m_L, defName);\r\n\tif(!lua_isnil(m_L, -1)) {\r\n\t\tlua_pop(m_L, 1);\r\n\t\t// 指定されたグローバルラベルがnilではないということは、\r\n\t\t// 同名で値が定義済みであるため、エラーを出す。\r\n\t\treturn false;\r\n\t}\r\n\tlua_pop(m_L, 1);\r\n\tlua_pushstring(m_L, string);\r\n\tlua_setglobal(m_L, defName);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBLuaEnv::setupLuaEnv()\r\n{\r\n\tm_L = luaL_newstate();\r\n\tif(!m_L) return false;\r\n\r\n\tif(lua_checkstack(m_L, 200) == 0) {\r\n\t\tklb_assertAlways(\"can not setup lua stack.\");\r\n\t\treturn false;\r\n\t}\r\n#ifdef DEBUG_LUAEDIT\r\n\tStartLuaEditRemoteDebugger(22001, m_L);\r\n\tSleep(1000);\r\n#endif\r\n\r\n\tm_state = KLBNEWC(CLuaState, (m_L));\r\n    if(!m_state) {\r\n        lua_close(m_L);\r\n        return false;\r\n    }\r\n\r\n    // ライブラリをフルセット読み込む\r\n    luaL_openlibs(m_L);\r\n    \r\n\t// 全てに先駆けて、NULL を定義する\r\n\tlua_pushlightuserdata(m_L, 0);\r\n\tlua_setglobal(m_L, \"NULL\");\r\n\r\n    // ファクトリが生成されている全てのタスクに対し、起動関数を登録する\r\n    IFactory::registLuaFunctions(m_L);\r\n\r\n\t// 別途定義されたLua関数ライブラリを登録する\r\n\tILuaFuncLib::registAllLibs(m_L);\r\n    \r\n\t// システム関数の定義\r\n    lua_register(m_L, \"sysLoad\"\t\t\t,CKLBLuaEnv::load\t\t);\r\n\tlua_register(m_L, \"isSysLoading\"\t,CKLBLuaEnv::isLoading\t);\r\n    lua_register(m_L, \"sysCommand\"\t\t,CKLBLuaEnv::command\t);\r\n    lua_register(m_L, \"syslog\"\t\t\t,CKLBLuaEnv::logging\t);\r\n    lua_register(m_L, \"sysExit\"\t\t\t,CKLBLuaEnv::exitGame\t);\r\n\tlua_register(m_L, \"include\"\t\t\t,CKLBLuaEnv::includefile);\r\n    lua_register(m_L, \"sysInfo\"\t\t\t,CKLBLuaEnv::systemInfo\t);\r\n\tlua_register(m_L, \"sysReboot\"\t\t,CKLBLuaEnv::reboot\t\t);\r\n\tlua_register(m_L, \"sysGCRatio\"\t\t,CKLBLuaEnv::setGCRatio\t);\r\n\r\n    // ビットごとのAND/OR演算子がLuaにはないので、フラグ値計算用に関数を用意しておく。\r\n    lua_register(m_L, \"bitOR\"\t\t\t,CKLBLuaEnv::bitOR\t\t);\r\n    lua_register(m_L, \"bitAND\"\t\t\t,CKLBLuaEnv::bitAND\t\t);\r\n\r\n\t// ***********************\r\n\t// 注意\r\n\t// ***********************\r\n\t// 以前ここで定義されていたLua関数のうち、機能がカテゴリ的に分類できるものは、\r\n    // 実装がそれぞれ LuaLib 以下のモジュールに移動されました。\r\n\t// Lua script から見た際に使える関数の種類や呼び出し方に変更はありません。\r\n\t//\r\n\t// CKLBLuaLibTASK\tタスク操作ライブラリ\r\n\t// CKLBLuaLibDATA\tデータセット関連ライブラリ\r\n\t// CKLBLuaLibDB\t\tSQLite用DBアクセスライブラリ\r\n\t// CKLBLuaLibCONV\tJson<->Luaを中心としたデータ変換ライブラリ\r\n\t// CKLBLuaLibBIN\tバイナリファイルライブラリ\r\n\t//\r\n#ifdef DEBUG_LUAEDIT\r\n\tStartLuaEditRemoteDebugger(22001, m_L);\r\n#endif\r\n\r\n    return true;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::setGCRatio(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    CKLBLuaEnv& env = CKLBLuaEnv::getInstance();\r\n    int argc = lua.numArgs();\r\n    if(argc == 2) {\r\n\t\tenv.m_lowGC\t\t= lua.getInt(1); \r\n\t\tenv.m_highGC\t= lua.getInt(2);\r\n\t}\r\n\tlua.retBool(argc == 2);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::reboot(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tbool bResult = false;\r\n\tif(lua.numArgs() == 0) {\r\n\t\tbResult = true;\r\n\t\tCPFInterface::getInstance().client().reboot();\r\n\t    CKLBLuaEnv& LuaEnv(CKLBLuaEnv::getInstance());\r\n\t    if (LuaEnv.m_sysLoadEnable == false) {\r\n\t        LuaEnv.m_sysLoadEnable = true; // こうする事でメンテナンス中に制御可能になれるはず.\r\n\t    }\r\n\t}\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::load(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    CKLBLuaEnv& env = CKLBLuaEnv::getInstance();\r\n    int argc = lua.numArgs();\r\n    if(1 > argc) {\r\n        env.errMsg(\"URL not given to sysLoad() function.\");\r\n        return 0;\r\n    }\r\n    if(1 < argc) {\r\n        env.errMsg(\"too many argument to sysLoad() function.\");\r\n        return 0;\r\n    }\r\n\r\n\tklb_assert(!env.m_nextLoadScript, \"sysLoad() It is already called.\" ); \r\n\r\n    const char * scriptUrl = lua.getString(1);\r\n\tbool bResult = false;\r\n    if(scriptUrl) {\r\n\t\tbResult = env.sysLoad(scriptUrl);\r\n\t}\r\n\tlua.retBoolean(bResult);\r\n    return 1;\r\n}\r\n\r\nint \r\nCKLBLuaEnv::isLoading(lua_State* L) {\r\n\tCLuaState lua(L);\r\n\tCKLBLuaEnv& env = CKLBLuaEnv::getInstance();\r\n\tlua.retBoolean(env.m_nextLoadScript != NULL);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::command(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    CKLBLuaEnv& env = CKLBLuaEnv::getInstance();\r\n    int argc = lua.numArgs();\r\n\r\n    if(1 > argc) {\r\n        env.errMsg(\"Target TASK not given to sysCommand() function.\");\r\n        return 0;\r\n    }\r\n    CKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n    if(!pTask) return 0;\r\n\tCHECKTASK(pTask);\r\n\r\n#ifdef INTERNAL_BENCH\r\n\ts64 startCommand = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n\tCKLBTaskMgr::getInstance().setCurrentTask(pTask);\r\n\tint res = pTask->commandScript(lua);\r\n\tCKLBTaskMgr::getInstance().setCurrentTask(NULL);\r\n#ifdef INTERNAL_BENCH\r\n\tlogTime('F', CPFInterface::getInstance().platform().nanotime() - startCommand, pTask->getClassID());\r\n#endif\r\n\treturn res;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::logging(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    CKLBLuaEnv& env = CKLBLuaEnv::getInstance();\r\n    int argc = lua.numArgs();\r\n    \r\n    if(1 > argc) {\r\n        env.errMsg(\"string not given to echo() function.\");\r\n        return 0;\r\n    }\r\n    if(1 < argc) {\r\n        env.errMsg(\"too many argument to sysLog() function.\");\r\n        return 0;\r\n    }\r\n    const char * msg = lua.getString(1);\r\n\r\n\tcmdLogging(msg);\r\n\t\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::exitGame(lua_State * /* L */)\r\n{\r\n    // 終了フラグセット\r\n    CKLBTaskMgr::getInstance().setExit();\r\n    return 0;\r\n}\r\n\r\n\r\nint\r\nCKLBLuaEnv::bitOR(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    int val = 0;\r\n    for(int i = 1; i <= argc; i++) {\r\n        val |= lua.getInt(i);\r\n    }\r\n    lua.retInt(val);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::bitAND(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    int val = 0xffffffff;\r\n    for(int i = 1; i <= argc; i++) {\r\n        val &= lua.getInt(i);\r\n    }\r\n    if(argc == 0) val = 0;\r\n    lua.retInt(val);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaEnv::systemInfo(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    CKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\r\n    lua.tableNew();\r\n    \r\n    lua.retString(\"width\");\r\n    lua.retInt(res.width());\r\n    lua.tableSet();\r\n\r\n    lua.retString(\"height\");\r\n    lua.retInt(res.height());\r\n    lua.tableSet();\r\n\r\n    // 上記以外にシステム情報として取りたい値があれば、\r\n    // 同様に名称、値の順にスタックに積み、lua.tableSet();\r\n\r\n    // スタック上に残る唯一の値であるテーブルが戻り値となる。\r\n    \r\n    return 1;\r\n}\r\n\r\nIReadStream *\r\nCKLBLuaEnv::openScript(const char * scriptUrl)\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tIReadStream * pRds = 0;\r\n\r\n#ifdef COMPILED_LUA\r\n\tchar * script_path = (char *)CKLBUtility::copyString(scriptUrl);\r\n\tchar * ext = strstr(script_path, \".lua\");\r\n\tif(ext) {\r\n\t\tstrcpy(ext, \".lc\");\r\n\t} else {\r\n\t\tKLBDELETEA(script_path);\r\n\t\tscript_path = NULL;\r\n\t}\r\n\r\n\t// 中間コードバイナリ名でのオープンを試みる(.lc)\r\n\tpRds = pForm.openReadStream(script_path);\r\n\tKLBDELETEA(script_path);\t// パス名は用済み\r\n\r\n\tif(pRds && pRds->getStatus() == IReadStream::NORMAL) {\r\n\t\treturn pRds;\r\n\t}\r\n\t// オープンに失敗している場合\r\n\tdelete pRds;\r\n#endif\r\n\r\n\t// 元の名前でのオープンを試みる(.lua)\r\n\tpRds = pForm.openReadStream(scriptUrl, pForm.useEncryption());\r\n\tif (pRds == NULL || pRds->getStatus() != IReadStream::NORMAL) {\r\n\t\tdelete pRds;\r\n\t\tDEBUG_PRINT(\"SCRIPT ERROR: script not found. : %s\", scriptUrl);\r\n\t\tklb_assertAlways(\"SCRIPT ERROR: script not found. : %s\", scriptUrl);\r\n\t\treturn NULL;\t// オープンに失敗したら必ずNULLが返る\r\n\t}\r\n\r\n\treturn pRds;\r\n}\r\n\r\n#ifdef INTERNAL_BENCH\r\nstruct BENCH_RECORD {\r\n\ts64\t\ttime;\r\n\tu32\t\tclassID;\r\n\tchar\ttype;\r\n\tconst char*\tname;\r\n};\r\nBENCH_RECORD\tgBenchArray[10000];\r\nint\t\t\t\tgBenchFill;\r\nbool\t\t\tgBenchLog = true;\r\n\r\nvoid logDo() {\r\n\tgBenchLog = true;\r\n}\r\n\r\ns64 gLastTime;\r\n\r\nvoid logStartTime() {\r\n\tgLastTime = CPFInterface::getInstance().platform().nanotime();\r\n}\r\n\r\nvoid logEndTime(char type, const char* name) {\r\n\tif (gBenchFill < 10000) {\r\n\t\ts64 deltaT = CPFInterface::getInstance().platform().nanotime() - gLastTime;\r\n\t\tgBenchArray[gBenchFill].classID = 0;\r\n\t\tgBenchArray[gBenchFill].type    = type;\r\n\t\tgBenchArray[gBenchFill].name    = name;\r\n\t\tgBenchArray[gBenchFill++].time  = deltaT;\r\n\t}\r\n}\r\n\r\nvoid logTime(char type, s64 time, u32 classID) {\r\n\tif (gBenchLog) {\r\n\tif (gBenchFill < 10000) {\r\n\t\tgBenchArray[gBenchFill].classID = classID;\r\n\t\tgBenchArray[gBenchFill].type = type;\r\n\t\tgBenchArray[gBenchFill++].time = time;\r\n\t}\r\n\t}\r\n}\r\n\r\nvoid logTimeDump() {\r\n\tDEBUG_PRINT(\"===========================================================\");\r\n\tDEBUG_PRINT(\"====          Benchmark execution setup function       ====\");\r\n\tDEBUG_PRINT(\"===========================================================\");\r\n\tDEBUG_PRINT(\"\");\r\n\tDEBUG_PRINT(\"[C]:Compile     [L]:Load   [S]:Setup Time [P]:Pure Lua time\");\r\n\tDEBUG_PRINT(\"[T]:Create Task [F]:Command Task [A] Asset Load\");\r\n\r\n\tDEBUG_PRINT(\"[L] Time:%f mS\", ((gBenchArray[0].time / 1000) / 1000.0f));\r\n\tDEBUG_PRINT(\"[C] Time:%f mS\", ((gBenchArray[1].time / 1000) / 1000.0f));\r\n\tDEBUG_PRINT(\"[S] Time:%f mS\", ((gBenchArray[2].time / 1000) / 1000.0f));\r\n\tDEBUG_PRINT(\"[P] Time:%f mS\", ((gBenchArray[3].time / 1000) / 1000.0f));\r\n\tfor (int n=4; n < gBenchFill; n++) {\r\n\t\tconst char* name    = IFactory::getClassName(gBenchArray[n].classID);\r\n\t\tconst char* tab     = \"\";\r\n\t\tconst char* assName = \"\";\r\n\t\tif (gBenchArray[n].type == 'A') { \r\n            tab = \"  \"; \r\n            if (gBenchArray[n].name) { assName = gBenchArray[n].name; } \r\n        }\r\n\t\tDEBUG_PRINT(\"%s[%c] Time:%f mS ClassName:%s [%s]\", tab, gBenchArray[n].type, ((gBenchArray[n].time / 1000) / 1000.0f),  name ? name : \"---\", assName);\r\n\t}\r\n\tgBenchFill = 0;\r\n}\r\n#endif\r\n\r\nbool\r\nCKLBLuaEnv::loadScript(const char *scriptUrl)\r\n{\r\n    static int callcount = 0;\r\n    callcount++;\r\n#ifdef INTERNAL_BENCH\r\n\ts64 loadTime = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n#ifndef DEBUG_LUAEDIT\r\n\r\n    IReadStream * pRds = openScript(scriptUrl);\r\n    if(!pRds) { return false; }\r\n/*\r\n\tCPFInterface::getInstance().platform().openReadStream(scriptUrl);\r\n\tif (pRds == NULL || pRds->getStatus() != IReadStream::NORMAL) {\r\n\t    if(pRds->getStatus() != IReadStream::NORMAL) {\r\n\t        delete pRds;\r\n\t\t\tDEBUG_PRINT(\"SCRIPT ERROR: script not found. : %s\", scriptUrl);\r\n\t\t\tklb_assertAlways(\"SCRIPT ERROR: script not found. : %s\", scriptUrl);\r\n\t    }\r\n\t\treturn false;\r\n\t}\r\n*/\r\n\tsize_t ssize = pRds->getSize();\r\n    u8 * buf = KLBNEWA(u8,ssize + 1);\r\n\tif(!buf) {\r\n        delete pRds;\r\n        return false;\r\n    }\r\n\r\n    // 最後まで読む\r\n    int ret = pRds->readBlock(buf, ssize);\r\n    delete pRds;\r\n\tbuf[ ssize ] = 0;\r\n    if(ret == 0) { return false; }\r\n    \r\n    \r\n\t#ifdef INTERNAL_BENCH\r\n\ts64 compileTime = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n\r\n    int result = luaL_loadbuffer(m_L, (const char *)buf, ssize, scriptUrl);\r\n\tKLBDELETEA(buf);\r\n#else\r\n\tconst char * path = CPFInterface::getInstance().platform().getFullPath(scriptUrl);\r\n\tDEBUG_PRINT(\"[SCRIPT] load: %s\", path);\r\n\r\n\t#ifdef INTERNAL_BENCH\r\n\ts64 compileTime = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n\r\n\tint result = luaL_loadfile(m_L, path);\r\n\tdelete [] path;\r\n#endif\r\n    if(result) {\r\n\t\tconst char * errmsg = lua_tostring(m_L, -1);\t// エラーメッセージ取得\r\n\t\tchar buf[1024];\r\n\t\tswitch(result)\r\n        {\r\n            case LUA_ERRSYNTAX: {\r\n                sprintf(buf, \"SYNTAX ERROR: %s\", errmsg);\r\n                break;\r\n            }\r\n            case LUA_ERRMEM: {\r\n                sprintf(buf, \"MEMORY ERROR: %s\", errmsg);\r\n                break;\r\n\t\t\t}\r\n\t\t\tcase LUA_ERRFILE: {\r\n                sprintf(buf, \"I/O ERROR: %s\", errmsg);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tdefault:\r\n                sprintf(buf, \"INTERNAL ERROR: %s\", errmsg);\r\n\t\t\t\tbreak;\r\n        }\r\n\t\terrMsg(buf);\r\n\t\tklb_assertAlways(\"SCRIPT ERROR: %s\", buf);\r\n        return false;\r\n    }\r\n    \r\n\tm_leave = false;\r\n\r\n#ifdef INTERNAL_BENCH\r\n\ts64 startSetup = CPFInterface::getInstance().platform().nanotime();\r\n\tif (gBenchLog) {\r\n\t\tgBenchFill = 4;\r\n\t}\r\n#endif\r\n\r\n    //　グローバル域を実行\r\n\tresult = lua_pcall(m_L, 0, 0, 0);\r\n\r\n\tif(result) {\r\n    \tconst char * msg = NULL;\r\n        \r\n    \tswitch(result)\r\n    \t{\r\n            default:            msg = \"unknown error: %s (%s)\";             break;\r\n            case LUA_ERRRUN:    msg = \"runtime error: %s (%s)\";             break;\r\n            case LUA_ERRMEM:    msg = \"memory allocation error: %s (%s)\";   break;\r\n            case LUA_ERRERR:    msg = \"error in error: %s (%s)\";            break;\r\n    \t}\r\n        // 呼び出しエラー: 指定の関数呼び出しに失敗\r\n        char buf[1024];\r\n\t\tconst char * errmsg = lua_tostring(m_L, -1);\r\n        sprintf(buf, msg, errmsg, scriptUrl);\r\n        errMsg(buf);\r\n\t\tklb_assertAlways(\"%s\", buf);\r\n        return false;\r\n    }\r\n\r\n\tconst char * namebuf = CKLBUtility::copyString(scriptUrl);\r\n    if(namebuf) {\r\n        if(m_nowFile) { KLBDELETEA(m_nowFile); }\r\n        m_nowFile = namebuf;\r\n    }\r\n\r\n    m_state->callback(\"setup\", NULL);  // setup 関数を呼ぶ\r\n#ifdef INTERNAL_BENCH\r\n\ts64 endSetup   = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\tif (gBenchLog) {\r\n\t\tgBenchArray[0].time = compileTime - loadTime;\r\n\t\tgBenchArray[1].time = startSetup - compileTime;\r\n\t\tgBenchArray[2].time = endSetup - startSetup;\r\n\t\ts64 sum = 0;\r\n\t\tfor (int n = 4; n < gBenchFill; n++) {\r\n\t\t\tsum += gBenchArray[n].time;\r\n\t\t}\r\n\t\tgBenchArray[3].time = gBenchArray[2].time - sum;\r\n\t\t// gBenchLog = false;\r\n\t\tlogTimeDump();\r\n\t}\r\n\r\n#endif\r\n\r\n    return true;\r\n}\r\n\r\nvoid\r\nCKLBLuaEnv::execScript(int deltaT)\r\n{\r\n\tbool skip = false;\r\n\r\n\t// 前回のフレームで新しいスクリプトのロードが指定されていたら、ここで現在のスクリプトと入れ替える。\r\n    if(m_bLoadScript) {\r\n\t\tint fid = CKLBTaskMgr::getInstance().getFrameID();\r\n\t\t// 予約が行われた時点のフレームから更新されていれば、実際のロードを行う。\r\n\t\t// このチェックを行わないと、予約が P_SCRIPT フェーズより以前に行われている場合\r\n\t\t// 同フレームでロードが発生してしまうため、必ずフレームの更新が行われていることを\r\n\t\t// 条件とする。\r\n\t\tif(fid != m_loadReserveFrame) {\r\n\t\t\tconst char * loadname = m_nextLoadScript;\r\n\t\t\tm_nextLoadScript = NULL;\r\n\t\t\tm_bLoadScript    = false;\r\n\t\t\t// 内部で sysLoad が呼ばれたら再びm_nextLoadScriptとm_bLoadScriptが設定されるが、\r\n\t\t\t// 今回分についてはもはや問題ではない。\r\n\t\t\tloadScript(loadname);\r\n\t\t\tKLBDELETEA(loadname);\r\n\t\t} else {\r\n\t\t\t// Still in the same frame as sysload was executed ('leave' already executed)\r\n\t\t\t// Skip 'execute'\r\n\t\t\tskip = true;\r\n\t\t}\r\n    }\r\n\r\n    // 現在のスクリプトの execute 関数を呼び出す\r\n\tif (!skip) {\r\n\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_LUA_EXEC);\r\n\t\tm_state->callback(\"execute\", \"I\", deltaT);\r\n\t\tMEASURE_THREAD_CPU_END(TASKTYPE_LUA_EXEC);\r\n\t}\r\n\r\n    // ガベージコレクタを走らせる\r\n\tm_collect += m_lowGC;\r\n\tif (m_collect >= m_highGC) {\r\n\t\tm_collect -= m_highGC;\r\n\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_LUA_GC);\r\n\t\tlua_gc(m_L, LUA_GCCOLLECT, 0);\r\n\t\tMEASURE_THREAD_CPU_END(TASKTYPE_LUA_GC);\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBLuaEnv::sysLoad(const char * scriptUrl)\r\n{\r\n    if(!m_sysLoadEnable) { return false; }\r\n    if(!scriptUrl)       { return false; }  // ファイル名が文字列ではない\r\n\r\n    // ここまできたら、ロードすべきスクリプトが確定しているため、\r\n    // コマンドを保存する。次回execute()の実行直前に新しいスクリプトがロードされる。\r\n    char * url = KLBNEWA(char, strlen(scriptUrl) + 1 );\r\n    if(!url) { return false; }\r\n\t\r\n    strcpy(url, scriptUrl);\r\n    m_nextLoadScript = (const char *)url;\r\n    m_bLoadScript    = true;\r\n\r\n\t// 予約を行ったフレームIDを記録する。\r\n\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\tm_loadReserveFrame = mgr.getFrameID();\r\n\r\n    // この場でleaveを呼ぶ\r\n\tif(!m_leave) {\r\n\t\tm_leave = true;\r\n\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_LUA_EXEC);\r\n\t    m_state->callback(\"leave\", \"\");\r\n\t\tMEASURE_THREAD_CPU_END(TASKTYPE_LUA_EXEC);\r\n\t}\r\n    return true;\r\n}\r\n\r\n// メンテナンスモードに突入\r\nbool\r\nCKLBLuaEnv::intoMaintenance()\r\n{\r\n\t// 既にメンテナンスモードであれば何もしない\r\n    if(!m_sysLoadEnable) { return true; }\r\n\r\n\t// 必ずこのpathのスクリプトになる\r\n\tsysLoad(\"asset://Maintenance.lua\");\r\n\t// ロード予約ができた。以降、sysLoad()の呼び出しによる再設定を禁止\r\n\tm_sysLoadEnable = false;\r\n\treturn true;\r\n}\r\n\r\n// メンテナンスモード解除\r\nbool\r\nCKLBLuaEnv::exitMaintenance()\r\n{\r\n\tm_sysLoadEnable = true;\r\n\tCPFInterface::getInstance().client().reboot();\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBLuaEnv::errMsg(const char *str)\r\n{\r\n    lua_Debug dbg;\r\n    if(lua_getstack(m_L, 1, &dbg)) {\r\n        lua_getinfo(m_L, \"Sl\", &dbg);\r\n    }\r\n    // int lnum = dbg.currentline;\r\n    DEBUG_PRINT(\"SCRIPT ERROR/ %s\", str);\r\n}\r\n\r\nint\r\nCKLBLuaEnv::includefile(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tconst char * modname = lua.getString(1);\r\n#ifndef DEBUG_LUAEDIT\r\n\tIReadStream * pStream = openScript(modname);\r\n\tif(!pStream) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\t/*\r\n\tIReadStream * pStream;\r\n\tpStream = CPFInterface::getInstance().platform().openReadStream(modname);\r\n\tif(!pStream || pStream->getStatus() != IReadStream::NORMAL) {\r\n\t\tdelete pStream;\r\n\t\tDEBUG_PRINT(\"SCRIPT ERROR: script not found. : %s\", modname);\r\n\t\tklb_assertAlways(\"SCRIPT ERROR: script not found. : %s\", modname);\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\t*/\r\n\tu32 fsize = pStream->getSize();\r\n\tu8 * pool = KLBNEWA(u8, fsize + 1);\r\n\tpStream->readBlock(pool, fsize);\r\n\tpool[fsize] = 0;\r\n\tdelete pStream;\r\n\r\n\t// バッファ pool の内容をチャンク modname として読み込む\r\n\tint result = luaL_loadbuffer(L, (const char *)pool, fsize, modname);\r\n\tKLBDELETEA(pool);\r\n#else\r\n\tconst char * path = CPFInterface::getInstance().platform().getFullPath(modname);\r\n\tDEBUG_PRINT(\"[SCRIPT] include: %s\", path);\r\n\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_LUA_LOAD);\r\n\tint result = luaL_loadfile(L, path);\r\n\tMEASURE_THREAD_CPU_END(TASKTYPE_LUA_LOAD);\r\n\tdelete [] path;\r\n#endif\r\n    if(result) {\r\n\t\tconst char * errmsg = lua_tostring(L, -1);\t// エラーメッセージ取得\r\n\t\tchar buf[1024];\r\n\t\tswitch(result)\r\n        {\r\n            case LUA_ERRSYNTAX: {\r\n                sprintf(buf, \"SYNTAX ERROR: %s\", errmsg);\r\n                break;\r\n            }\r\n            case LUA_ERRMEM: {\r\n                sprintf(buf, \"MEMORY ERROR: %s\", errmsg);\r\n                break;\r\n\t\t\t}\r\n\t\t\tcase LUA_ERRFILE: {\r\n                sprintf(buf, \"I/O ERROR: %s\", errmsg);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tdefault:\r\n                sprintf(buf, \"INTERNAL ERROR: %s\", errmsg);\r\n\t\t\t\tbreak;\r\n        }\r\n\t\tgetInstance().errMsg(buf);\r\n\t\tklb_assertAlways(\"SCRIPT ERROR: %s\", buf);\r\n\t\tlua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    \r\n    //　グローバル域を実行\r\n\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_LUA_EXEC);\r\n\tresult = lua_pcall(L, 0, 0, 0);\r\n\tMEASURE_THREAD_CPU_END(TASKTYPE_LUA_EXEC);\r\n\tbool bRet = true;\r\n\tif(result) {\r\n    \tconst char * msg = NULL;\r\n        \r\n    \tswitch(result)\r\n    \t{\r\n            default:            msg = \"unknown error: %s (%s)\";             break;\r\n            case LUA_ERRRUN:    msg = \"runtime error: %s (%s)\";             break;\r\n            case LUA_ERRMEM:    msg = \"memory allocation error: %s (%s)\";   break;\r\n            case LUA_ERRERR:    msg = \"error in error: %s (%s)\";            break;\r\n    \t}\r\n        // 呼び出しエラー: 指定の関数呼び出しに失敗\r\n        char buf[1024];\r\n\t\tconst char * errmsg = lua.getString(-1);\r\n        sprintf(buf, msg, errmsg, \"[SYS]include\");\r\n        CKLBLuaEnv::getInstance().errMsg(buf);\r\n\t\tklb_assertAlways(\"%s\", buf);\r\n\t\tbRet = false;\r\n    }\r\n\r\n\tlua.retBoolean(bRet);\r\n\treturn 1;\r\n}\r\n\r\nvoid \r\nCKLBLuaEnv::cmdLogging(const char* msg)\r\n{\r\n\t// script から256byte以上の文字列が渡されることがあるので、\r\n\t// porting layer の最低要件制約にひっかからないよう255byte単位に区切って出力する。\r\n\t// ただし、platformのlogging実装によっては、\r\n\t//\r\n\t// - 出力がつながらないことがある\r\n\t// - 多バイト文字の途中で分断されてしまった挙句つながらないと、文字化けの恐れがある\r\n\t//\r\n\t// ので、「きれいに出力される」ことは保証できない。\r\n\tchar buf[256];\r\n\tconst char * ptr;\r\n\tint len = strlen(msg);\r\n\tptr = msg;\r\n\twhile(len > 255) {\r\n\t\tstrncpy(buf, ptr, 255);\r\n\t\tbuf[255] = 0;\r\n\t\tDEBUG_PRINT(\"%s\", (const char *)buf);\r\n\t\tptr += 255;\r\n\t\tlen -= 255;\r\n\t}\r\n\tif(strlen(ptr) > 0) {\r\n\t\tDEBUG_PRINT(\"%s\", ptr);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBLuaEnv::cmdSystemInfo(int* width, int* height)\r\n{\r\n    CKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n    *width  = res.width();\r\n    *height = res.height();\r\n}\r\n\r\nvoid \r\nCKLBLuaEnv::cmdExit()\r\n{ \r\n\tCKLBTaskMgr::getInstance().setExit(); \r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLuaEnv.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaEnv.h\r\n//\r\n\r\n#ifndef CKLBLuaEnv_h\r\n#define CKLBLuaEnv_h\r\n\r\n#include \"lua.hpp\"\r\n#include \"CLuaState.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n\r\nclass CKLBLuaEnv\r\n{\r\nprivate:\r\n    CKLBLuaEnv();\r\n    ~CKLBLuaEnv();\r\n    \r\npublic:\r\n    static CKLBLuaEnv& getInstance();\r\n    \r\n    bool setupLuaEnv\t\t();\r\n    void finishLuaEnv\t\t();\r\n\r\n\t// 定数定義を動作中に行う\r\n\tbool defineInt\t\t\t(const char * defName, int value);\r\n\tbool defineNum\t\t\t(const char * defName, float value);\r\n\tbool defineString\t\t(const char * defName, const char * string);\r\n\r\n    bool loadScript\t\t\t(const char * scriptName);\r\n    void execScript\t\t\t(int deltaT);\r\n\r\n\tbool sysLoad\t\t\t(const char * script_name);\r\n\tbool intoMaintenance\t();\r\n\tbool exitMaintenance\t();\r\n\r\n    void errMsg\t\t\t\t(const char * str);\r\n    \r\n    static int load\t\t\t(lua_State * L);\r\n    static int isLoading\t(lua_State * L);\r\n    static int command\t\t(lua_State * L);\r\n    static int logging\t\t(lua_State * L);\r\n    static int exitGame\t\t(lua_State * L);\r\n\tstatic int includefile\t(lua_State * L);\r\n    static int systemInfo\t(lua_State * L);\r\n\tstatic int reboot\t\t(lua_State * L);\r\n\tstatic int setGCRatio\t(lua_State * L);\r\n\r\n\t// Script additional operator functions.\r\n    static int bitOR\t\t(lua_State * L);\r\n    static int bitAND\t\t(lua_State * L);\r\n\r\n    inline const char * nowFile\t() const { return m_nowFile; }\r\n\r\n\tinline CLuaState&\tgetState() const { return *m_state; }\r\n\r\n\tstatic void cmdLogging\t\t(const char* msg);\r\n\tstatic void cmdExit\t\t\t();\r\n\tstatic void cmdSystemInfo\t(int* width, int* height);\r\n\r\nprivate:\r\n\tstatic IReadStream * openScript(const char * scriptUrl);\r\n\r\n\tu32\t\t\t\tm_lowGC;\r\n\tu32\t\t\t\tm_highGC;\r\n\tu32\t\t\t\tm_collect;\r\n\r\n    lua_State   *   m_L;\r\n\tCLuaState\t*\tm_state;\r\n    const char  *   m_nowFile;\r\n\r\n\tbool\t\t\tm_leave;\r\n\tbool\t\t\tm_sysLoadEnable;\r\n    \r\n    bool            m_bLoadScript;\r\n    const char  *   m_nextLoadScript;\r\n\tint\t\t\t\tm_loadReserveFrame;\r\n\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLuaPropTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaPropTask.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nCKLBLuaPropTask::CKLBLuaPropTask()\r\n: CKLBLuaTask   ()\r\n, m_cntProp     (0)\r\n, m_arrProp     (NULL)\r\n, m_bUpdateByScript (false)\r\n, m_newScriptModel  (false) \r\n{\r\n}\r\n\r\nCKLBLuaPropTask::~CKLBLuaPropTask()\r\n{\r\n\t// 必ず破棄時にプロパティ領域を破棄する。\r\n\tif(m_arrProp) {\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n\t\t\tKLBDELETEA(m_arrProp[i].name);\r\n            if(m_arrProp[i].type == STRING) { KLBDELETEA (m_arrProp[i].value.s); }\r\n\t\t}\r\n\t}\r\n\tKLBDELETEA(m_arrProp);\r\n}\r\n\r\nCKLBTask::TASKTYPE\r\nCKLBLuaPropTask::getTaskType()\r\n{\r\n    return TASK_LUA_PROPERTY;\r\n}\r\n\r\nu32\r\nCKLBLuaPropTask::getClassID()\r\n{\r\n    return CLS_KLBLUAPROPTASK;\r\n}\r\n\r\nbool\r\nCKLBLuaPropTask::setupPropertyList(const char * name[], u32 length)\r\n{\r\n\tif (m_newScriptModel) {\r\n\t\tm_arrPropV2\t\t= (PROP_V2*)name;\r\n\t\tm_cntProp\t\t= length;\r\n\t\treturn true;\r\n\t} else {\r\n\t\t// 要素の数を数える\r\n\t\tint cnt = 0;\r\n        while(name[cnt]) { cnt++; }\r\n\r\n\t\tPROP * arr = KLBNEWA( PROP, cnt );\r\n        if(!arr) { return false; }\r\n\r\n\t\tfor(int i = 0; i < cnt; i++) {\r\n\t\t\tarr[i].name = CKLBUtility::copyString(name[i]);\r\n\t\t\tarr[i].type = INTEGER;\r\n\t\t\tarr[i].value.i = 0;\r\n\t\t}\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n\t\t\tKLBDELETEA(m_arrProp[i].name);\r\n\t\t}\r\n\t\tKLBDELETEA(m_arrProp);\r\n\t\tm_cntProp = cnt;\r\n\t\tm_arrProp = arr;\r\n\t\treturn true;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBLuaPropTask::addPropertyList(const char * name[])\r\n{\r\n\tint cnt = 0;\r\n\twhile(name[cnt]) cnt++;\r\n\r\n\t// 追加分のポインタバッファを作る\r\n\tPROP * arr = KLBNEWA(PROP, cnt + m_cntProp);\r\n    if(!arr) { return false; }\r\n\tfor(int i = 0; i < m_cntProp; i++) {\r\n\t\tarr[i] = m_arrProp[i];\t// 既存プロパティをコピー\r\n\t}\r\n\tfor(int i = 0; i < cnt; i++) {\r\n\t\tarr[i + m_cntProp].name = CKLBUtility::copyString(name[i]);\r\n\t\tarr[i + m_cntProp].type = INTEGER;\r\n\t\tarr[i + m_cntProp].value.i = 0;\r\n\t}\r\n\tKLBDELETEA(m_arrProp);\r\n\tm_cntProp += cnt;\r\n\tm_arrProp = arr;\r\n\treturn true;\r\n}\r\n\r\nint\r\nCKLBLuaPropTask::findProperty(const char * name)\r\n{\r\n\tif (m_newScriptModel) {\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n            if(!strcmp(name, m_arrPropV2[i].name)) { return i; }\r\n\t\t}\r\n\t} else {\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n            if(!strcmp(name, m_arrProp[i].name)) { return i; }\r\n\t\t}\r\n\t}\r\n\treturn -1;\r\n}\r\n\r\nvoid\r\nCKLBLuaPropTask::preGetProp() {}\r\n\r\n// C -> lua (lua から見て \"get\")\r\nint\r\nCKLBLuaPropTask::getPropertyByScript(lua_State * L)\r\n{\r\n    // 前処理があれば実行する\r\n    preGetProp();\r\n    \r\n\t// luaから配列として取得できるよう戻り値を作る。\r\n\tlua_newtable(L);\r\n\r\n\tif (m_newScriptModel) {\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n\t\t\tPROP_V2* prop = &m_arrPropV2[i];\r\n\t\t\tlua_pushstring(L, prop->name);\r\n\t\t\tswitch(prop->type)\r\n\t\t\t{\r\n\t\t\tcase NIL:\t\tlua_pushnil(L); break;\r\n\t\t\tcase R_BOOLEANT:\r\n\t\t\tcase BOOLEANT:\t\r\n\t\t\t\t{\r\n\t\t\t\t\tbool v;\r\n\t\t\t\t\tif (prop->getter.b) {\r\n\t\t\t\t\t\tgetBoolT fct = prop->getter.b;\r\n\t\t\t\t\t\tv = (*this.*fct)();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmemcpy(&v,&(((u8*)this)[prop->offset]),sizeof(bool));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlua_pushboolean(L, v ? 1 : 0); \r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase R_INTEGER:\r\n\t\t\tcase INTEGER:\t\r\n\t\t\t\t{\r\n\t\t\t\t\ts32 i;\r\n\t\t\t\t\tif (prop->getter.i) {\r\n\t\t\t\t\t\tgetIntT fct = prop->getter.i;\r\n\t\t\t\t\t\ti = (*this.*fct)();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmemcpy(&i,&(((u8*)this)[prop->offset]),sizeof(s32));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlua_pushinteger(L, i); \r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase R_NUMERIC:\r\n\t\t\tcase NUMERIC:\r\n\t\t\t\t{\r\n\t\t\t\t\tfloat f;\r\n\t\t\t\t\tif (prop->getter.f) {\r\n\t\t\t\t\t\tgetFloatT fct = prop->getter.f;\r\n\t\t\t\t\t\tf = (*this.*fct)();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmemcpy(&f,&(((u8*)this)[prop->offset]),sizeof(float));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlua_pushnumber(L, f);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase R_STRING:\r\n\t\t\tcase STRING:\r\n\t\t\t\t{\r\n\t\t\t\t\tconst char* s;\r\n\t\t\t\t\tif (prop->getter.s) {\r\n\t\t\t\t\t\tgetStrT fct = prop->getter.s;\r\n\t\t\t\t\t\ts = (*this.*fct)();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmemcpy(&s,&(((u8*)this)[prop->offset]),sizeof(const char*));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlua_pushstring(L, s);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase R_POINTER:\r\n\t\t\tcase POINTER:   \r\n\t\t\t\t{\r\n\t\t\t\t\tvoid* p;\r\n\t\t\t\t\tif (prop->getter.p) {\r\n\t\t\t\t\t\tgetPtrT fct = prop->getter.p;\r\n\t\t\t\t\t\tp = (*this.*fct)();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmemcpy(&p,&(((u8*)this)[prop->offset]),sizeof(void*));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlua_pushlightuserdata(L, p);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase DYNAMIC_INT:\r\n\t\t\t\t{\r\n\t\t\t\t\ts32 i;\r\n\t\t\t\t\tif (prop->getter.g) {\r\n\t\t\t\t\t\tgetGenIntT fct = prop->getter.g;\r\n\t\t\t\t\t\ti = (*this.*fct)(prop->offset);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tklb_assertAlways(\"Dynamic type always work with getter/setter\");\r\n\t\t\t\t\t\ti = 0; // Compiler Warning\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlua_pushinteger(L, i); \r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tklb_assertAlways(\"Unknown property type\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua_settable(L, -3);\r\n\t\t}\r\n\t} else {\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n\t\t\tlua_pushstring(L, m_arrProp[i].name);\r\n\t\t\tswitch(m_arrProp[i].type)\r\n\t\t\t{\r\n\t\t\tcase NIL:\t\tlua_pushnil(L);                                         break;\r\n\t\t\tcase BOOLEANT:\tlua_pushboolean (L, (m_arrProp[i].value.b) ? 1 : 0);    break;\r\n\t\t\tcase INTEGER:\tlua_pushinteger (L, m_arrProp[i].value.i);              break;\r\n\t\t\tcase NUMERIC:\tlua_pushnumber  (L, m_arrProp[i].value.n);              break;\r\n\t\t\tcase STRING:\tlua_pushstring  (L, m_arrProp[i].value.s);              break;\r\n\t\t\tcase POINTER:   lua_pushlightuserdata(L, m_arrProp[i].value.p);         break;\r\n            \r\n            case DYNAMIC_INT:   /* not handled */ break;\r\n            case TYPE_MASK:     /* not handled */ break;\r\n            case READ_ONLY:     /* not handled */ break;\r\n            case R_BOOLEANT:    /* not handled */ break;\r\n            case R_INTEGER:     /* not handled */ break;\r\n            case R_NUMERIC:     /* not handled */ break;\r\n            case R_STRING:      /* not handled */ break;\r\n            case R_POINTER:     /* not handled */ break;\r\n\t\t\t}\r\n\t\t\tlua_settable(L, -3);\r\n\t\t}\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nvoid\r\nCKLBLuaPropTask::afterSetProp() \r\n{\r\n}\r\n\r\n// lua -> C (lua から見て \"set\")\r\nint\r\nCKLBLuaPropTask::setPropertyByScript(lua_State * L)\r\n{\r\n\tif(lua_gettop(L) != 2) {\t\r\n\t\tlua_pushboolean(L, 0);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tif (m_newScriptModel) {\r\n\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n            m_arrPropV2[i].checked = false;\r\n        }\r\n\r\n\t\tlua_pushvalue(L, 2);\r\n\t\tlua_pushnil(L);\r\n\t\twhile(0 != lua_next(L, -2)) {\r\n\t\t\tlua_pushvalue(L, -2);\r\n\t\t\tconst char *    key     = lua_tostring(L, -1);\t// key\r\n\t\t\tPROP_V2 *       prop    = NULL;\r\n\r\n\t\t\t// keyから対応する領域を検索\r\n\t\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n                if(m_arrPropV2[i].checked) { continue; }\r\n\t\t\t\tif(!strcmp(m_arrPropV2[i].name, key)) {\r\n\t\t\t\t\tprop = &m_arrPropV2[i];\r\n\t\t\t\t\tprop->checked = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Lua配列の key の値が、プロパティとして定義されている key の中に無い値だったとき\r\n\t\t\tif(!prop) {\r\n\t\t\t\tCKLBScriptEnv::getInstance().error(\"unknown property \\\"%s\\\"\", key);\r\n\t\t\t}\r\n\r\n\t\t\tswitch (prop->type) {\r\n\t\t\tcase NIL:\r\n\t\t\t\tklb_assertAlways(\"Should not be a property type\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase BOOLEANT:\r\n\t\t\t\t{\r\n\t\t\t\t\tbool v = lua_toboolean(L,-2) ? true : false;\r\n\t\t\t\t\tklb_assert(prop->setter.b != NULL, \"Must have setter !\");\r\n\t\t\t\t\tsetBoolT fct = prop->setter.b;\r\n\t\t\t\t\t(*this.*fct)(v);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase INTEGER:\r\n\t\t\t\t{\r\n\t\t\t\t\ts32 i = lua_tointeger(L, -2);\r\n\t\t\t\t\tklb_assert(prop->setter.i != NULL, \"Must have setter !\");\r\n\t\t\t\t\tsetIntT fct = prop->setter.i;\r\n\t\t\t\t\t(*this.*fct)(i);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase NUMERIC:\r\n\t\t\t\t{\r\n\t\t\t\t\tfloat f = (float)lua_tonumber(L, -2);\r\n\t\t\t\t\tklb_assert(prop->setter.f != NULL, \"Must have setter !\");\r\n\t\t\t\t\tsetFloatT fct = prop->setter.f;\r\n\t\t\t\t\t(*this.*fct)(f);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase STRING:\r\n\t\t\t\t{\r\n\t\t\t\t\tconst char* str = lua_tostring(L, -2);\r\n\t\t\t\t\tklb_assert(prop->setter.s != NULL, \"Must have setter !\");\r\n\t\t\t\t\tsetStrT fct = prop->setter.s;\r\n\t\t\t\t\t(*this.*fct)(str);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase POINTER:\r\n\t\t\t\t{\r\n\t\t\t\t\tvoid* ptr = (void *)lua_touserdata(L, -2);\r\n\t\t\t\t\tklb_assert(prop->setter.s != NULL, \"Must have setter !\");\r\n\t\t\t\t\tsetPtrT fct = prop->setter.p;\r\n\t\t\t\t\t(*this.*fct)(ptr);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase DYNAMIC_INT:\r\n\t\t\t\t{\r\n\t\t\t\t\ts32 i = lua_tointeger(L, -2);\r\n\t\t\t\t\tsetGenIntT fct = prop->setter.g;\r\n\t\t\t\t\t(*this.*fct)((u32)prop->offset ,i);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase R_INTEGER:\r\n\t\t\t// Same value case R_UINTEGER:\r\n\t\t\tcase R_STRING:\r\n\t\t\tcase R_BOOLEANT:\r\n\t\t\tcase R_NUMERIC:\r\n\t\t\tcase R_POINTER:\r\n\t\t\t\t{\r\n\t\t\t\t\t// klb_assertAlways(\"Read only property %s\", prop->name);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tklb_assertAlways(\"Unknown property type\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua_pop(L, 2);\r\n\t\t}\r\n\t} else {\r\n        for(int i = 0; i < m_cntProp; i++) { m_arrProp[i].checked = false; }\r\n\r\n\t\tlua_pushvalue(L, 2);\r\n\t\tlua_pushnil(L);\r\n\t\twhile(0 != lua_next(L, -2)) {\r\n\t\t\tlua_pushvalue(L, -2);\r\n\t\t\tconst char *    key     = lua_tostring(L, -1);\t// key\r\n\t\t\tPROP *          prop    = NULL;\r\n\r\n\t\t\t// keyから対応する領域を検索\r\n\t\t\tfor(int i = 0; i < m_cntProp; i++) {\r\n\t\t\t\tif(m_arrProp[i].checked) continue;\r\n\t\t\t\tif(!strcmp(m_arrProp[i].name, key)) {\r\n\t\t\t\t\tprop = &m_arrProp[i];\r\n\t\t\t\t\tprop->checked = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Lua配列の key の値が、プロパティとして定義されている key の中に無い値だったとき\r\n\t\t\tif(!prop) {\r\n\t\t\t\tCKLBScriptEnv::getInstance().error(\"unknown property \\\"%s\\\"\", key);\r\n\t\t\t}\r\n\t\t\tswitch(lua_type(L, -2))\r\n\t\t\t{\r\n\t\t\tcase LUA_TNIL:\r\n\t\t\t\tprop->type = NIL;\r\n\t\t\t\tbreak;\r\n\t\t\tcase LUA_TNUMBER:\r\n\t\t\t\t{\r\n\t\t\t\t\tint val_i = lua_tointeger(L, -2);\r\n\t\t\t\t\tfloat val_f = (float)lua_tonumber(L, -2);\r\n\t\t\t\t\tif((float)val_i == val_f) {\r\n\t\t\t\t\t\tprop->type = INTEGER;\r\n\t\t\t\t\t\tprop->value.i = val_i;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprop->type = NUMERIC;\r\n\t\t\t\t\t\tprop->value.n = val_f;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase LUA_TBOOLEAN:\r\n\t\t\t\tprop->type = BOOLEANT;\r\n\t\t\t\tprop->value.b = (0 != lua_toboolean(L, -2));\r\n\t\t\t\tbreak;\r\n\t\t\tcase LUA_TSTRING: \r\n\t\t\t\t{\r\n\t\t\t\t\tconst char * str = lua_tostring(L, -2);\r\n\t\t\t\t\tprop->type = STRING;\r\n\t\t\t\t\tif( prop->value.s ) KLBDELETEA( prop->value.s );\t// 2012.11.29  リークの可能性があったので修正\r\n\t\t\t\t\tprop->value.s = (char *)CKLBUtility::copyString(str);\r\n\t\t\t\t\tif(!prop->value.s) prop->type = NIL;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase LUA_TLIGHTUSERDATA:\r\n\t\t\t\tprop->type = POINTER;\r\n\t\t\t\tprop->value.p = (void *)lua_touserdata(L, -2);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tlua_pop(L, 2);\r\n\t\t}\r\n\t}\r\n\r\n\tlua_pop(L, 1);\r\n\r\n\t// スクリプトから更新されたので、フラグをセットする\r\n\tm_bUpdateByScript = true;\r\n    \r\n    // 後処理があれば実行する\r\n    afterSetProp();\r\n\r\n\t// lua に対する戻り値は無し。\r\n\treturn 0;\r\n}\r\n\r\nvoid\r\nCKLBLuaPropTask::setNil(int idx)\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n    if(m_arrProp[idx].type == STRING) { KLBDELETEA(m_arrProp[idx].value.s); }\r\n\tm_arrProp[idx].type     = NIL;\r\n\tm_arrProp[idx].value.p  = NULL;\r\n}\r\n\r\nvoid\r\nCKLBLuaPropTask::setBool(int idx, bool val)\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n    if(m_arrProp[idx].type == STRING) { KLBDELETEA(m_arrProp[idx].value.s); }\r\n\tm_arrProp[idx].type     = BOOLEANT;\r\n\tm_arrProp[idx].value.b  = val;\r\n}\r\n\r\nvoid\r\nCKLBLuaPropTask::setInt(int idx, int val)\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n    if(m_arrProp[idx].type == STRING) { KLBDELETEA(m_arrProp[idx].value.s); }\r\n\tm_arrProp[idx].type     = INTEGER;\r\n\tm_arrProp[idx].value.i  = val;\r\n}\r\n\r\nvoid\r\nCKLBLuaPropTask::setNum(int idx, float val)\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n    if(m_arrProp[idx].type == STRING) { KLBDELETEA(m_arrProp[idx].value.s); }\r\n\tm_arrProp[idx].type     = NUMERIC;\r\n\tm_arrProp[idx].value.n  = val;\r\n} \r\n\r\nbool\r\nCKLBLuaPropTask::setStr(int idx, const char * val)\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\r\n\tconst char * str = (val) ? CKLBUtility::copyString(val) : NULL;\r\n\tif(val && !str) return false;\r\n    if(m_arrProp[idx].type == STRING) { KLBDELETEA(m_arrProp[idx].value.s); }\r\n\tm_arrProp[idx].type     = STRING;\r\n\tm_arrProp[idx].value.s  = (char *)str;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBLuaPropTask::setMem(int idx, const char * val, u32 size )\r\n{\r\n\tconst char * str = (val) ? CKLBUtility::copyMem(val,size) : NULL;\r\n\tif(val && !str) return false;\r\n    if(m_arrProp[idx].type == STRING) { KLBDELETEA(m_arrProp[idx].value.s); }\r\n\tm_arrProp[idx].type     = STRING;\r\n\tm_arrProp[idx].value.s  = (char *)str;\r\n\treturn true;\r\n}"
  },
  {
    "path": "Engine/source/Core/CKLBLuaPropTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaPropTask_h\r\n#define CKLBLuaPropTask_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nclass CKLBLuaPropTask;\r\ntypedef void (CKLBLuaPropTask::*setBoolT)\t\t(bool);\r\ntypedef void (CKLBLuaPropTask::*setIntT)\t\t(s32);\r\ntypedef void (CKLBLuaPropTask::*setUintT)\t\t(u32);\r\ntypedef void (CKLBLuaPropTask::*setFloatT)\t\t(float);\r\ntypedef void (CKLBLuaPropTask::*setStrT)\t\t(const char*);\r\ntypedef void (CKLBLuaPropTask::*setPtrT)\t\t(void*);\r\ntypedef void (CKLBLuaPropTask::*setGenIntT)\t\t(u32, s32);\r\n\r\ntypedef bool (CKLBLuaPropTask::*getBoolT)\t\t(void);\r\ntypedef s32  (CKLBLuaPropTask::*getIntT)\t\t(void);\r\ntypedef u32  (CKLBLuaPropTask::*getUintT)\t\t(void);\r\ntypedef float (CKLBLuaPropTask::*getFloatT)\t\t(void);\r\ntypedef const char* (CKLBLuaPropTask::*getStrT)\t(void);\r\ntypedef void* (CKLBLuaPropTask::*getPtrT)\t\t(void);\r\ntypedef s32 (CKLBLuaPropTask::*getGenIntT)\t\t(u32);\r\n\r\ntemplate <typename T, size_t N>\r\ninline\r\nsize_t SizeOfArray( const T(&)[ N ] )\r\n{\r\n  return N;\r\n}\r\n\r\ntypedef enum {\r\n\tNIL,\r\n\tBOOLEANT,\r\n\tINTEGER,\r\n\tUINTEGER = INTEGER,\r\n\tNUMERIC,\r\n\tSTRING,\r\n\tPOINTER,\r\n\tDYNAMIC_INT,\r\n\r\n\tTYPE_MASK\t= 0x0F,\r\n\tREAD_ONLY\t= 0x10,\r\n\r\n\tR_INTEGER\t= INTEGER  | READ_ONLY,\r\n\tR_UINTEGER  = UINTEGER | READ_ONLY,\r\n\tR_STRING    = STRING   | READ_ONLY,\r\n\tR_BOOLEANT  = BOOLEANT | READ_ONLY,\r\n\tR_NUMERIC   = NUMERIC  | READ_ONLY,\r\n\tR_POINTER\t= POINTER  | READ_ONLY,\r\n} PROPTYPE;\r\n\r\n/*!\r\n* \\class CKLBLuaPropTask\r\n* \\brief Lua Prop Task class\r\n* \r\n* CKLBLuaPropTask is a CKLBLuaTask with properties (int, uint, float, string, bool, pointers).\r\n* These properties can be read and/or written by the scripting part of the game,\r\n* depending on their declaration.\r\n* It is an abstract class for every class in the Engine using properties.\r\n*/\r\nclass CKLBLuaPropTask : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBLuaEnv;\r\npublic:\r\n    u32 getClassID();\r\n\tCKLBLuaPropTask();\r\n\tvirtual ~CKLBLuaPropTask();\r\n\r\n    virtual TASKTYPE getTaskType();\r\n\r\n\tvirtual bool initScript(CLuaState& lua) = 0;\r\n\r\n\t// CKLBLuaTask にあったデフォルトの\r\n\t// virtual int commandScript(CLuaState& lua);\r\n\t// は、そのまま使えるし、オーバーライドしてもよい。\r\n\tvirtual void execute(u32 deltaT) = 0;\r\n\tvirtual void die() = 0;\r\n\r\n\tstruct PROP {\r\n\t\tconst char * name;\t\t// プロパティインデックス\r\n\t\tPROPTYPE\t type;\t\t// プロパティの型\r\n\t\tunion {\r\n\t\t\tbool\t\tb;\t\t// boolean\r\n\t\t\ts32\t\t\ti;\t\t// integer\r\n\t\t\tfloat\t\tn;\t\t// real (float)\r\n\t\t\tchar\t*\ts;\t\t// string\r\n\t\t\tvoid\t*\tp;\t\t// pointer (userlightdata)\r\n\t\t} value;\r\n\t\tbool\t\tchecked;\r\n\t};\r\n\r\n\tstruct PROP_V2 {\r\n\t\tconst char * name;\t\t// property index\r\n\t\tPROPTYPE\t type;\t\t// property type\r\n\t\tunion {\r\n\t\t\tsetBoolT\tb;\r\n\t\t\tsetIntT\t\ti;\r\n\t\t\tsetUintT\tui;\r\n\t\t\tsetFloatT\tf;\r\n\t\t\tsetStrT\t\ts;\r\n\t\t\tsetPtrT\t\tp;\r\n\t\t\tsetGenIntT\tg;\r\n\t\t} setter;\r\n\t\tunion {\r\n\t\t\tgetBoolT\tb;\r\n\t\t\tgetIntT\t\ti;\r\n\t\t\tgetUintT\tui;\r\n\t\t\tgetFloatT\tf;\r\n\t\t\tgetStrT\t\ts;\r\n\t\t\tgetPtrT\t\tp;\r\n\t\t\tgetGenIntT\tg;\r\n\t\t} getter;\r\n\t\tsize_t\t\t\toffset;\r\n\t\t/*\r\n\t\tunion {\r\n\t\t\tbool\t\tb;\t\t// boolean\r\n\t\t\ts32\t\t\ti;\t\t// integer\r\n\t\t\tfloat\t\tn;\t\t// real (float)\r\n\t\t\tchar\t*\ts;\t\t// string\r\n\t\t\tvoid\t*\tp;\t\t// pointer (userlightdata)\r\n\t\t} value;*/\r\n\t\tbool\t\tchecked;\r\n\t};\r\n\r\n\r\n\t// 保持すべきプロパティ領域を登録する。\r\n\t// 内部で生成された配列領域のインデックスは、\r\n\t// names 配列で与えられた順番と一致することが保証される。\r\n\tbool setupPropertyList(const char * names[], u32 length = 0);\r\n\r\n\t// 設定済みのプロパティリストを破棄せず、\r\n\t// 与えられたプロパティリストを追加する。\r\n\tbool addPropertyList(const char * names[]);\r\n\r\n\t// プロパティ名から内部配列のインデックスを得る。\r\n\tint findProperty(const char * name);\r\n\r\n\t// 値を設定する(idx は findProperty()で返される値)\r\n\tvoid setNil(int idx);\r\n\tvoid setBool(int idx, bool val);\r\n\tvoid setInt(int idx, int val);\r\n\tvoid setNum(int idx, float val);\r\n\tbool setStr(int idx, const char * val);\r\n\tbool setMem(int idx, const char * val, u32 size );\r\n\r\n\t// 型を取得する\r\n\tinline PROPTYPE getType(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn m_arrProp[idx].type; \r\n\t}\r\n\r\n\t// 値を取得する\r\n\tinline bool isNil(int idx) { \r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== NIL); \r\n\t}\r\n\tinline bool getBool(int idx) { \r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== BOOLEANT) ? m_arrProp[idx].value.b : false; \r\n\t}\r\n\tinline int  getInt(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== INTEGER)\r\n\t\t\t? m_arrProp[idx].value.i\r\n\t\t\t: (((m_arrProp[idx].type & TYPE_MASK) == NUMERIC) ? (int)m_arrProp[idx].value.n : 0);\r\n\t}\r\n\tinline float getNum(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK) == NUMERIC)\r\n\t\t\t? m_arrProp[idx].value.n\r\n\t\t\t: (((m_arrProp[idx].type & TYPE_MASK) == INTEGER) ? (float)m_arrProp[idx].value.i : 0.0f);\r\n\t}\r\n\tinline const char * getStr(int idx) {\r\n\t\tklb_assert(!m_newScriptModel, \"Old Scripting model only\");\r\n\t\treturn ((m_arrProp[idx].type & TYPE_MASK)== STRING) ? m_arrProp[idx].value.s : 0; \r\n\t}\r\n\r\n\tinline void setUpdateFlag\t()\t\t\t{ m_bUpdateByScript = true;  }\r\n\tinline void clearUpdateFlag\t()\t\t\t{ m_bUpdateByScript = false; }\r\n\tinline bool getUpdateFlag\t() const\t{ return m_bUpdateByScript;  }\r\n\tinline int\tgetPropertyCount() const\t{ return m_cntProp;\t\t\t }\r\n\r\n\t// Lua の配列と内部プロパティをやり取りするメソッド\r\n\tint getPropertyByScript(lua_State * L);\r\n\tint setPropertyByScript(lua_State * L);\r\n\r\n\tinline int isNewScriptModel() { return m_newScriptModel; }\r\n\r\nprotected:\r\n\tbool\t\t\tm_newScriptModel;\r\n\r\n    // スクリプトからのプロパティ取得直前に行う処理があれば、このmethodに実装する\r\n    virtual void preGetProp();\r\n    \r\n    // スクリプトからのプロパティ設定直後に行う処理があれば、このmethodに実装する。\r\n    virtual void afterSetProp();\r\n\r\nprivate:\r\n\tbool\t\t\tm_bUpdateByScript;\r\n\tint\t\t\t\tm_cntProp;\t\t// プロパティ総数\r\n\tPROP\t\t*\tm_arrProp;\t\t// プロパティ配列\r\n\tPROP_V2\t\t*\tm_arrPropV2;\t// プロパティ配列\r\n};\r\n\r\n\r\n#endif // CKLBLuaPropTask_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLuaTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaTask.cpp\r\n//\r\n\r\n#include \"CKLBLuaTask.h\"\r\n\r\nCKLBLuaTask::CKLBLuaTask() \r\n: CKLBTask      ()\r\n, m_cbFuncName\t(NULL)\r\n{\r\n}\r\n\r\nCKLBLuaTask::~CKLBLuaTask() {\r\n\tsetKillCallback(NULL);\t// Free string.\r\n}\r\n\r\nCKLBTask::TASKTYPE\r\nCKLBLuaTask::getTaskType()\r\n{\r\n    return TASK_LUA_BASIC;\r\n}\r\n\r\nint\r\nCKLBLuaTask::commandScript(CLuaState& /*lua*/)\r\n{\r\n    return 0;\r\n}\r\n\r\nvoid \r\nCKLBLuaTask::setKillCallback(const char* cbFuncName) {\r\n\tKLBDELETEA(m_cbFuncName);\r\n\tif (cbFuncName) {\r\n\t\tm_cbFuncName = CKLBUtility::copyString(cbFuncName);\r\n\t} else {\r\n\t\tm_cbFuncName = NULL;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBLuaTask::performKillCallback() {\r\n\tif (m_cbFuncName) {\r\n\t\tCKLBScriptEnv::getInstance().call_onDie(m_cbFuncName, this);\r\n\t\tKLBDELETEA(m_cbFuncName);\r\n\t\tm_cbFuncName = NULL;\r\n\t}\r\n}\r\n\r\n\r\nIFactory * IFactory::m_begin = NULL;\r\n\r\nIFactory::IFactory () {}\r\nIFactory::~IFactory() {}\r\n\r\nvoid\r\nIFactory::addLink(const char * luaFuncName, int (*luaFunc)(lua_State * L), DEFCMD * arrCmdItem, u32 classID) {\r\n    m_funcName      = luaFuncName;\r\n    m_luaFunc       = luaFunc;\r\n    m_arrCmdItem    = arrCmdItem;\r\n    m_classID       = classID;\r\n    m_pNext         = m_begin;\r\n    m_begin         = this;\r\n}\r\n\r\nu32 \r\nIFactory::getClassID(const char* luaFuncName, bool assertIfNotFound) {\r\n\tIFactory* pFactory = m_begin;\r\n\twhile (pFactory) {\r\n\t\tif (strcmp(pFactory->m_funcName,luaFuncName)==0) {\r\n\t\t\treturn pFactory->m_classID;\r\n\t\t}\r\n\t\tpFactory = pFactory->m_pNext;\r\n\t}\r\n\r\n\tklb_assert(!assertIfNotFound, \"Can not find class ID from name %s\", luaFuncName);\r\n\treturn 0;\r\n}\r\n\r\nconst char* \r\nIFactory::getClassName(u32 classID) {\r\n\tIFactory* pFactory = m_begin;\r\n\twhile (pFactory) {\r\n\t\tif (pFactory->m_classID == classID) {\r\n\t\t\treturn pFactory->m_funcName;\r\n\t\t}\r\n\t\tpFactory = pFactory->m_pNext;\r\n\t}\r\n\r\n\t// klb_assertAlways(\"Can not find name from class ID %8x\", classID);\r\n\treturn NULL;\r\n}\r\n\r\nbool\r\nIFactory::registLuaFunctions(lua_State *L)\r\n{\r\n    IFactory * pFactory = m_begin;\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\tpfif.logging(\"<<<supported task list>>>\");\r\n    while(pFactory) {\r\n\t\t// 生成用関数を指定の名称で登録する。\r\n        lua_register(L, pFactory->m_funcName, pFactory->m_luaFunc);\r\n\t\tpfif.logging(\"  [task] %s\", pFactory->m_funcName);\r\n\r\n\t\t// 指定されたコマンド値を、指定された名称で登録する\r\n\t\tfor(const DEFCMD * pCmd = pFactory->m_arrCmdItem; pCmd && pCmd->name ; pCmd++) {\r\n\t\t\t// 指定された名称のグローバルラベルがすでに存在していればエラーを出す。\r\n\t\t\tlua_getglobal(L, pCmd->name);\r\n\t\t\tif(!lua_isnil(L, -1)) {\r\n\t\t\t\tlua_pop(L, 1);\r\n\t\t\t\t// 指定されたグローバルラベルがnilではないということは、\r\n\t\t\t\t// 同名で値が定義済みであるため、エラーを出す。\r\n\t\t\t\tpfif.logging(\"[TASK REGISTRATION ERROR] %s it is redefined.\\n\", pCmd->name);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tlua_pop(L, 1);\r\n\t\t\tlua_pushinteger(L, pCmd->cmd);\r\n\t\t\tlua_setglobal(L, pCmd->name);\r\n\t\t\tpfif.logging(\"\\t\\t[def] %s = %d\", pCmd->name, pCmd->cmd);\r\n\t\t}\r\n        pFactory = pFactory->m_pNext;\r\n    }\r\n    return true;\r\n}\r\n\r\nbool\r\nCKLBLuaTask::setStrC(const char*& dst, const char * val)\r\n{\r\n\tconst char * str;\r\n\tif (val) {\r\n\t\tstr = CKLBUtility::copyString(val);\r\n        if (!str) { return false; }\r\n        if (dst)  { KLBDELETEA(dst); }\r\n\t} else {\r\n\t\tstr = NULL;\r\n\t}\r\n\tdst = str;\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBLuaTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaTask.h\r\n//\r\n\r\n#ifndef CKLBLuaTask_h\r\n#define CKLBLuaTask_h\r\n\r\n#include \"lua.hpp\"\r\n#include \"CKLBTask.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n/*!\r\n* \\class CKLBLuaTask\r\n* \\brief Lua Task class.\r\n* \r\n* CKLBLuaTask is the abstract root class for every task \r\n* that can be created from a script command.\r\n* It defines some virtual methods and some generic callbacks.\r\n*\r\n* CKLBLuaTask objects can interact with the scripting langage\r\n* throught methods/commands calls depending on the scripting langage.\r\n*/\r\nclass CKLBLuaTask : public CKLBTask\r\n{\r\npublic:\r\n    CKLBLuaTask();\r\n    virtual ~CKLBLuaTask();\r\n\r\n   \r\n    virtual CKLBTask::TASKTYPE getTaskType();\r\n\r\n    virtual void execute(u32 deltaT) = 0;\r\n    virtual void die() = 0;\r\n    \r\n    // lua script によって起動された際の初期化メソッド。\r\n    // 初期化に成功したら regist() の戻り値を返すこと。\r\n    // 失敗した場合は false を返す。\r\n    virtual bool initScript(CLuaState& lua) = 0;\r\n    \r\n    // lua script から動作中に送られるコマンドの受付メソッド。\r\n    // コマンドを必要としないタスクもあるので、デフォルトでは何もしない処理が実装されている。\r\n    // lua script に対する戻り値を持つこともできる。\r\n    // CLuaState のメソッドで戻り値を lua スタックに積み、戻り値の数を返すこと。\r\n    // 戻り値が無い場合は 0 を返す。\r\n    virtual int commandScript(CLuaState& lua);\r\n\r\n\tvoid setKillCallback\t(const char* cbFuncName);\r\n\tvoid performKillCallback();\r\n\r\n\tbool setStrC\t\t\t(const char*& dest, const char* src);\r\nprivate:\r\n\tconst char*\tm_cbFuncName;\r\n};\r\n\r\n#ifdef DEBUG_RT_CHECK\r\n#define CHECKTASK(pTask)\t\t{ if(!CKLBTaskMgr::getInstance().isExistTask(pTask)) CKLBScriptEnv::getInstance().error(\"The canceled TASK was specified.:%p\", pTask); }\r\n#define CHECKTASKNULLOK(pTask)\t{ if(pTask) { if (!CKLBTaskMgr::getInstance().isExistTask(pTask)) { klb_assertAlways(\"Parent task does not exist yet.\"); } } }\r\n#else\r\n#define CHECKTASK(pTask)\r\n#define CHECKTASKNULLOK(pTask)\r\n#endif\r\n\r\nclass IFactory\r\n{\r\npublic:\r\n    IFactory();\r\n    virtual ~IFactory();\r\n    static bool\t\t\tregistLuaFunctions\t(lua_State * L);\r\n\tstatic u32\t\t\tgetClassID\t\t\t(const char* luaFuncName, bool assertIfNotFound = true);\r\n\tstatic const char*\tgetClassName\t\t(u32 classID);\r\n\r\n\ttypedef struct {\r\n\t\tconst char * name;\r\n\t\tint\t\t\t cmd;\r\n\t} DEFCMD;\r\n\r\nprotected:\r\n    void addLink(const char * luaFuncName, int (*func)(lua_State * L), DEFCMD * arrCmdItem, u32 classID);\r\n\r\nprivate:\r\n    static IFactory *\tm_begin;\r\n    IFactory\t\t*   m_pNext;\r\n    const char\t\t*   m_funcName;\r\n\tconst DEFCMD\t*\tm_arrCmdItem;\r\n\tu32\t\t\t\t\tm_classID;\r\n\tint (*m_luaFunc)(lua_State * L);\r\n};\r\n\r\ntemplate <class T>\r\nclass CKLBTaskFactory : public IFactory\r\n{\r\npublic:\r\n\tCKLBTaskFactory(const char * luaFuncName, u32 classID, DEFCMD * arrCmdItem = 0) {\r\n\t\taddLink(luaFuncName, CKLBTaskFactory<T>::createFactory, arrCmdItem, classID);\r\n\t}\r\n    ~CKLBTaskFactory() {}\r\n\r\n    static int createFactory(lua_State * L) {\r\n        CLuaState lua(L);\r\n#ifdef INTERNAL_BENCH\r\n\t\ts64 startCreate = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n        T * pTask = KLBNEW(T);\r\n \r\n        bool bResult = false;\r\n        if(pTask) {\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(pTask);\r\n\t\t    bResult = pTask->initScript(lua);\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(NULL);\r\n#ifdef INTERNAL_BENCH\r\n\t\tlogTime('T', CPFInterface::getInstance().platform().nanotime() - startCreate, pTask->getClassID());\r\n#endif\r\n        }\r\n        if(bResult) {\r\n\t\t\tlua.retPointer(pTask);\r\n\t\t} else {\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(pTask);\r\n            KLBDELETE(pTask);\r\n\t\t\tCKLBTaskMgr::getInstance().setCurrentTask(NULL);\r\n\t\t\tlua.retBoolean(false);\r\n\t\t}\r\n        return 1;\r\n    }\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBObject.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\nCKLBObjectScriptable::CKLBObjectScriptable(unsigned int handle) \r\n: m_handle(handle) \r\n{ \r\n}\r\n\r\nCKLBObjectScriptable::~CKLBObjectScriptable() \r\n{\r\n\tif(m_handle != _NULLHANDLER) {\r\n\t\tCKLBScriptEnv::getInstance().destroy(m_handle);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBObject.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Base System for object reflection mecanism, allocation ===\r\n//\r\n//\r\n\r\n#ifndef __KLB_OBJECT_BASE__\r\n#define __KLB_OBJECT_BASE__\r\n\r\n\r\n#include \"BaseType.h\"\r\n\r\nclass CKLBStream;\r\nclass CKLBObject;\r\n\r\nclass CKLBContext {\r\n\t// Perform allocation.\r\n\tfriend class CKLBObject;\r\npublic:\r\n\tCKLBContext\t\t();\r\n\t~CKLBContext\t();\r\n\r\n\tstatic\t\t\t\r\n\tCKLBContext*\tgetContext\t\t();\r\n\t\r\nprotected:\r\n\tvoid*\t\t\tallocate\t\t(unsigned int numByte);\r\n\tvoid\t\t\tdisallocate\t\t(void* ptr);\r\n};\r\n\r\nclass CKLBObject {\r\n\tfriend class CKLBStream;\r\n\tfriend class CKLBContext;\r\npublic:\r\n\tCKLBObject():\r\n\t  m_msgListener(NULL)\t{ }\r\n\r\n\tvirtual ~CKLBObject()\t{ /* Do nothing by default */ }\r\n\r\n\tvoid* operator new( size_t num_bytes) {\r\n\t\treturn CKLBContext::getContext()->allocate(num_bytes);\r\n    }\r\n\r\n\tvoid operator delete(void* ptr) {\r\n\t\tif (ptr) {\r\n\t\t\tCKLBContext::getContext()->disallocate(ptr);\r\n\t\t}\r\n    }\r\n\r\n\tvirtual u32 getClassID() = 0;\r\n\r\n\tvirtual void replaceAsset\t(void* ptrAssetOld, void* ptr) {\r\n\t\tptrAssetOld = ptrAssetOld;\r\n\t\tptr = ptr;\r\n\t\t/* Do nothing */ \r\n\t}\r\n\r\n\tvirtual void receiveMsg\t\t(CKLBObject* emitter, u32 msgID, u32 msgParam)\t{ \r\n\t\t/* Do nothing by default */ \r\n\t\temitter = emitter;\r\n\t\tmsgID = msgID;\r\n\t\tmsgParam = msgParam;\r\n\t}\r\nprotected:\r\n\tCKLBObject*\t\tm_msgListener;\r\n\r\n\tinline\r\n\tvoid MsgRegister(CKLBObject* listener)\t{\r\n\t\tklb_assert(!m_msgListener, \"low level message listener already used by somebody else %8x\", m_msgListener);\r\n\t\tm_msgListener = listener;\r\n\t}\t\r\n};\r\n\r\n#ifndef _NULLHANDLER\r\n#define _NULLHANDLER 0xFFFFFFFF\r\n#endif\r\n\r\nclass CKLBObjectScriptable : public CKLBObject {\r\nprivate:\r\n\tu32\t\tm_handle;\r\n\r\npublic:\r\n\tCKLBObjectScriptable\t(unsigned int handle = _NULLHANDLER);\r\n\t~CKLBObjectScriptable\t();\r\n\r\n\tinline\r\n\tvoid setScriptHandle\t(u32 handle)\t\t{ m_handle = handle;\t}\r\n\tinline\r\n\tu32  getScriptHandle\t()\t\t\t\t\t{ return m_handle;\t\t}\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBPauseCtrl.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBPauseCtrl.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\nstatic CKLBTaskFactory<CKLBPauseCtrl> factory(\"PAUSECtrl\", CLS_KLBPAUSECTRL);\r\n\r\nCKLBPauseCtrl::CKLBPauseCtrl()\r\n: CKLBLuaTask() \r\n{\r\n}\r\n\r\nCKLBPauseCtrl::~CKLBPauseCtrl() \r\n{\r\n}\r\n\r\nCKLBPauseCtrl* \r\nCKLBPauseCtrl::create(CKLBTask* pParentTask, const char* pause, const char* resume) {\r\n\tCKLBPauseCtrl* pTask = KLBNEW(CKLBPauseCtrl);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, pause,resume)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool CKLBPauseCtrl::init(CKLBTask* pTask, const char* pause, const char* resume) {\r\n\tm_callbackPause  = (pause)  ? CKLBUtility::copyString(pause)  : NULL;\r\n\tm_callbackResume = (resume) ? CKLBUtility::copyString(resume) : NULL;\r\n\r\n\treturn regist(pTask, P_NORMAL);\r\n}\r\n\r\nbool\r\nCKLBPauseCtrl::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\treturn false;\r\n\t}\r\n\tconst char * pause  = (lua.isNil(1)) ? NULL : lua.getString(1);\r\n\tconst char * resume = (lua.isNil(2)) ? NULL : lua.getString(2);\r\n\t\r\n\treturn init(NULL, pause, resume);\r\n}\r\n\r\nvoid\r\nCKLBPauseCtrl::die()\r\n{\r\n\tKLBDELETEA(m_callbackPause);\r\n\tKLBDELETEA(m_callbackResume);\r\n}\r\n\r\nvoid\r\nCKLBPauseCtrl::execute(u32 /*deltaT*/)\r\n{\r\n\tCKLBOSCtrlQueue& osq = CKLBOSCtrlQueue::getInstance();\r\n\tconst OSCTRL *  item = NULL;\r\n\tosq.startItem();\r\n\r\n\twhile(NULL != (item = osq.getItem(0))) {\r\n\t\tswitch(item->type)\r\n\t\t{\r\n\t\tdefault: break;\r\n\t\tcase IClientRequest::E_PAUSE:\tif(m_callbackPause)\t\tCKLBScriptEnv::getInstance().call_pause\t(m_callbackPause,  this);\tbreak;\r\n\t\tcase IClientRequest::E_RESUME:\tif(m_callbackResume)\tCKLBScriptEnv::getInstance().call_resume(m_callbackResume, this);\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBPauseCtrl.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBPauseCtrl_h\r\n#define CKLBPauseCtrl_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n\r\n/*!\r\n* \\class CKLBPauseCtrl\r\n* \\brief Pause Control Task class\r\n* \r\n* CKLBPauseCtrl allows to add control to a class when you pause and/or resume it, \r\n* as it is not provided by default in a CKLBTask.\r\n* You can register callbacks that will be called when pausing and resuming the Task.\r\n*/\r\nclass CKLBPauseCtrl : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBPauseCtrl>;\r\nprivate:\r\n\tCKLBPauseCtrl();\r\n\tvirtual ~CKLBPauseCtrl();\r\n\r\n\tbool init(CKLBTask* pTask, const char* pause, const char* resume);\r\npublic:\r\n\tstatic CKLBPauseCtrl* create(CKLBTask* pParentTask, const char* pause, const char* resume);\r\n\r\n\tbool initScript\t(CLuaState& lua);\r\n\r\n\tvoid execute\t(u32 deltaT);\r\n\tvoid die\t\t();\r\n\r\nprivate:\r\n\tconst char *\tm_callbackPause;\r\n\tconst char *\tm_callbackResume;\r\n};\r\n\r\n\r\n#endif // CKLBPauseCtrl_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBScriptEnv.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __SCRIPT_ENV_\r\n#define __SCRIPT_ENV_\r\n\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBJsonItem;\t// Ptr Param for callback.\r\n\r\nclass CKLBScriptEnv\r\n{\r\nprotected:\r\n    CKLBScriptEnv();\r\n    ~CKLBScriptEnv();\r\n\r\npublic:\r\n    static CKLBScriptEnv& getInstance();\r\n    \r\n\tu32*\t\t\tgetCallCounter\t();\r\n\tu32*\t\t\tgetErrorReader\t();\r\n\tconst char*\t\tgetErrorString\t();\r\n\tvoid\t\t\tresetError\t\t();\r\n\r\n\tbool boot\t\t\t(const char* bootScriptURL);\r\n    bool setupScriptEnv\t();\r\n    void finishScriptEnv();\r\n\r\n    void error\t\t\t(const char * str, ...);\r\n\tvoid errMsg\t\t\t(const char* str);\r\npublic:\r\n\tvoid destroy\t\t\t\t\t(unsigned int handle);\r\n\r\n\tvoid call_onDie\t\t\t\t\t(const char* funcNAme, CKLBObjectScriptable* obj);\r\n\r\n\t// Generic Task\r\n\tvoid call_genTaskExecute\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 deltaT, const char* arrayIndex);\r\n\tvoid call_genTaskDie\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* arrayIndex);\r\n\r\n\t// Timer Task\r\n\tvoid call_intervalTimerExecute\t(const char* funcName, CKLBObjectScriptable* obj, u32 timerID);\r\n\r\n\tvoid call_asyncFileCopy\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 perc, u32 size);\r\n\tvoid call_asyncLoader\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 loaded, u32 total);\r\n\r\n\t// Web Area Task\r\n\tvoid call_webTask\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* url);\r\n\r\n\t// CKLBPauseCtrl\r\n\tvoid call_pause\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\tvoid call_resume\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// CKLBStoreService\r\n\tvoid call_storeEvent\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* itemID, const char* param2);\r\n\t\r\n\t// Sinc VM for Unit\r\n\tvoid call_fromSincVM\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id, s32 param);\r\n\t\r\n\t// Virtual Doc\r\n\tvoid call_eventVirtualDoc\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 param1, s32 param2, s32 param3, s32 param4);\r\n\t\r\n\t// Touch Pad\r\n\tvoid call_touchPadCSharp\t\t(CKLBObjectScriptable* obj, u32 m_execount, u32 type, u32 id, s32 x, s32 y);\r\n\tvoid call_touchPad\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\t\r\n\t// Device buttons\r\n\tvoid call_button\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// CKLBUITextInput\r\n\tvoid call_textInput\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* txt, u32 id);\r\n\t\r\n\t// Selectable Element\r\n\tvoid call_eventSelectable\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* name, s32 type, s32 param);\r\n\t\r\n\t// Swf Player\r\n\tvoid call_eventSwf\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* label);\r\n\t// UI List\r\n\tvoid call_eventUIListDynamic\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemID);\r\n\tvoid call_eventUIList\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemCnt, s32 listLength, s32 pos);\r\n\t// TODO : pb with NULL funcName != behavior before call.\r\n\tvoid call_eventUIListDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 param1, s32 param2);\r\n\r\n\t// UI Control\r\n\tvoid call_eventDragIF\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY);\r\n\tvoid call_eventUIControlDrag\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY);\r\n\tvoid call_eventUIControlPinch\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, float pinch, float rot);\r\n\tvoid call_eventUIControlClick\t(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y);\r\n\tvoid call_eventUIControlDblClick(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y);\r\n\tvoid call_eventUIControlLongTap\t(const char* funcName, CKLBObjectScriptable* obj,  u32 time, s32 x, s32 y);\r\n\t\r\n\t// UI Drag Icon\r\n\tvoid call_eventDragIcon\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 dragX, s32 dragY);\r\n\t\r\n\t// UI Movie\r\n\tvoid call_eventMovie\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// UI Cell Anim\r\n\tvoid call_eventCellAnim\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\t\r\n\t// UI Canvas\r\n\tvoid call_canvasOnDraw\t\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// UI Node Pack Anim\r\n\tvoid call_eventNodeAnimPack\t\t(const char* funcName, CKLBObjectScriptable* obj, const char * name, u32 id);\r\n\t\r\n\t// UI Touch Event UI\r\n\tvoid call_eventUITouchEvent\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 dx, s32 dy);\r\n\r\n\t// CKLBDebugMenu\r\n\tvoid call_eventDebugItem\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id);\r\n\t\r\n\t// UI Scroll Bar / UI List task\r\n\tvoid call_eventScrollBar\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 pos);\r\n\tvoid call_eventScrollBarStop\t(const char* funcName, CKLBObjectScriptable* obj, s32 pos);\r\n\r\n\t// World Task\r\n\tvoid call_eventWorld\t\t\t(const char* funcName, CKLBObjectScriptable* obj, s32 serial, s32 msg, s32 status);\r\n\r\n\tvoid call_eventUpdateDownload\t(const char* funcName, CKLBObjectScriptable* obj, double progress, const char* progressStr);\r\n\tvoid call_eventUpdateZIP\t\t(const char* funcName, CKLBObjectScriptable* obj, int progress, int total);\r\n\tvoid call_eventUpdateComplete\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\tvoid call_eventUpdateError\t\t(const char* funcName, CKLBObjectScriptable* obj);\r\n\r\n\t// NetAPI\r\n\tbool call_netAPI_callback\t\t(const char* funcName, CKLBObjectScriptable* obj, int uniq, int msg, int status, CKLBJsonItem * pRoot);\r\n\tvoid call_netAPI_versionUp\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* clientVer, const char* serverVer);\r\n\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBStream.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBObject.h\"\r\n\r\n// ---- Write ----\r\nvoid CKLBStream::writePtr(CKLBObject* ptr) {\r\n\tu32 id = CKLBContext::getContext()->getInstanceID(ptr);\r\n\tstream.write(reinterpret_cast<char *>(&id),sizeof(u32));\r\n}\r\n\r\nvoid CKLBStream::writeU8(u32 value) {\r\n\tassert(value >= 256,                            \"too big value\");\r\n\tstream.write(reinterpret_cast<char *>(&value),sizeof(u8));\r\n}\r\n\r\nvoid CKLBStream::writeS8(s32 value) {\r\n\tassert(((value >= -128) && (value < 128)),\t\t\"too big value\");\r\n\tstream.write(reinterpret_cast<char *>(&value),sizeof(s8));\r\n}\r\n\r\nvoid CKLBStream::writeU16(u32 value) {\r\n\tassert(value >= 65536,\t\t\t\t\t\t\t\"too big value\");\r\n\tstream.write(reinterpret_cast<char *>(&value),sizeof(u16));\r\n}\r\n\r\nvoid CKLBStream::writeS16(s32 value) {\r\n\tassert(((value >= -32768) && (value < 32768)),\t\"too big value\");\r\n\tstream.write(reinterpret_cast<char *>(&value),sizeof(s16));\r\n}\r\n\r\nvoid CKLBStream::writeU32(u32 value) {\r\n\tstream.write(reinterpret_cast<char *>(&value),sizeof(u32));\r\n}\r\n\r\nvoid CKLBStream::writeS32(s32 value) {\r\n\tstream.write(reinterpret_cast<char *>(&value),sizeof(s32));\r\n}\r\n\r\nvoid CKLBStream::writeBool(bool value) {\r\n\twriteU8(value ? 1 : 0);\r\n}\r\n\r\n// ---- Read ----\r\nCKLBObject* CKLBStream::readPtr() {\r\n\tu32 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(32));\r\n\treturn CKLBContext::getContext()->getPointer(val);\r\n}\r\n\r\nu8 CKLBStream::readU8() {\r\n\tu8 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(u8));\r\n\treturn val;\r\n}\r\n\r\ns8 CKLBStream::readS8() {\r\n\ts8 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(s8));\r\n\treturn val;\r\n}\r\n\r\nu16 CKLBStream::readU16() {\r\n\tu16 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(u16));\r\n\treturn val;\r\n}\r\n\r\ns16 CKLBStream::readS16() {\r\n\ts16 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(s16));\r\n\treturn val;\r\n}\r\n\r\nu32 CKLBStream::readU32() {\r\n\tu32 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(u32));\r\n\treturn val;\r\n}\r\n\r\ns32 CKLBStream::readS32() {\r\n\ts32 val;\r\n\tstream.read(reinterpret_cast<char *>(&val),sizeof(s32));\r\n\treturn val;\r\n}\r\n\r\nbool CKLBStream::readBool() {\r\n\treturn (readU8() != 0);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBTask.cpp\r\n//  Base Task Class and Task Manager Implementation\r\n//\r\n//\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CPFInterface.h\"\r\n;\r\n\r\n\r\nCKLBRegistedTaskList::CKLBRegistedTaskList()\r\n: m_begin   (NULL)\r\n, m_end     (NULL)\r\n{\r\n}\r\n\r\nCKLBRegistedTaskList::~CKLBRegistedTaskList()\r\n{\r\n}\r\n\r\nvoid\r\nCKLBRegistedTaskList::addTask(CKLBTask * pTask)\r\n{\r\n\tTASKITEM * pItem = KLBNEW(TASKITEM);\r\n\tpItem->pTask    = pTask;\r\n\tpItem->next     = NULL;\r\n\tpItem->prev     = m_end;\r\n\tif(pItem->prev) {\r\n\t\tpItem->prev->next = pItem;\r\n\t} else {\r\n\t\tm_begin = pItem;\r\n\t}\r\n\tm_end = pItem;\r\n}\r\n\r\nvoid\r\nCKLBRegistedTaskList::killTaskList(bool kill_child)\r\n{\r\n\tTASKITEM * pItem = m_begin;\r\n\twhile(pItem) {\r\n\t\tTASKITEM * next = pItem->next;\r\n\t\tif(kill_child) {\r\n            pItem->pTask->kill();\r\n        }\r\n\t\tKLBDELETE(pItem);\r\n\t\tpItem = next;\r\n\t}\r\n\tm_begin = m_end = NULL;\r\n}\r\n\r\nCKLBTask::CKLBTask()\r\n: m_pExePrev    (NULL)\r\n, m_pExeNext    (NULL)\r\n, m_pBrsPrev    (NULL)\r\n, m_pBrsNext    (NULL)\r\n, m_pRmvPrev    (NULL)\r\n, m_pRmvNext    (NULL)\r\n, m_pStgPrev    (NULL)\r\n, m_pStgNext    (NULL)\r\n, m_pParent     (NULL)\r\n, m_ePhase      (P_MAX)\r\n, m_activeStatus(ALWAYS_ACTIVE)\r\n{\r\n    m_lstChild.begin = m_lstChild.end = 0;\r\n}\r\n\r\nCKLBTask::~CKLBTask()\r\n{\r\n}\r\n\r\n// 後始末methodとフレームmethodは、デフォルトだと何もしない。\r\nvoid \r\nCKLBTask::die() \r\n{\r\n}\r\n\r\nvoid \r\nCKLBTask::execute(u32 /*deltaT*/) \r\n{\r\n}\r\n\r\n// pause状態を指定する\r\nvoid\r\nCKLBTask::setPause(bool bPause, bool bRecursive)\r\n{\r\n\t#define ON_PAUSE\t(1<<7)\r\n\t// 自身のpause状態を指定する\r\n\tif (onPause(bPause)) {\r\n\t\tm_activeStatus |= ON_PAUSE;\r\n\t} else {\r\n\t\tm_activeStatus &= ~ON_PAUSE;\r\n\t}\r\n\t#undef ON_PAUSE\r\n\r\n    if(!bRecursive) { return; }\r\n\r\n\t// bRecursiveがtrueで子タスクがある場合は、子タスクにもPause状態を指定する\r\n\tfor(CKLBTask * pTask = m_lstChild.begin; pTask; pTask = pTask->m_pBrsNext) {\r\n\t\tpTask->setPause(bPause, bRecursive);\r\n\t}\r\n}\r\n\r\nbool \r\nCKLBTask::onPause(bool bPause) \r\n{ \r\n    return bPause; \r\n}\r\n\r\nCKLBTask::TASKTYPE\r\nCKLBTask::getTaskType()\r\n{\r\n    return TASK_SIMPLE;\r\n}\r\n\r\nu32\r\nCKLBTask::getClassID()\r\n{\r\n\treturn CLS_KLBUSERTASK;\r\n}\r\n\r\nbool\r\nCKLBTask::regist(CKLBTask * pParent, TASK_PHASE ePhase)\r\n{\r\n\t// TODO when we have modified Task construction with a link list of \"prenew\".\r\n\t// CHECKTASKNULLOK(pParent);\r\n\r\n    if(pParent) pParent->child(this); // 親が指定されていれば親子関係を結ぶ\r\n    CKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n    return mgr.regist(ePhase, this);   // 実行リストへの登録\r\n}\r\n\r\n// 親子関係を結ぶ\r\nvoid\r\nCKLBTask::child(CKLBTask * pChild)\r\n{\r\n    pChild->m_pParent   = this;\r\n    pChild->m_pBrsPrev  = m_lstChild.end;\r\n    pChild->m_pBrsNext  = NULL;\r\n    if(m_lstChild.end)      { m_lstChild.end->m_pBrsNext = pChild; }\r\n    if(!m_lstChild.begin)   { m_lstChild.begin = pChild; }\r\n    m_lstChild.end = pChild;\r\n}\r\n\r\n// 自身を殺す\r\nvoid\r\nCKLBTask::kill()\r\n{\r\n    CKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\r\n\t// 破棄フェーズ中でkill()を呼んではいけない。\r\n\tklb_assert(!mgr.isKilling(), \"Don't call kill() in die(). \");\r\n\r\n    // 自身の子全員に対し Kill を実行する。\r\n    CKLBTask * pChild = m_lstChild.begin;\r\n    while(pChild) {\r\n        CKLBTask * pNext = pChild->m_pBrsNext;\r\n        pChild->kill();\r\n        pChild = pNext;\r\n    }\r\n\r\n\tif (this->getTaskType() != TASK_SIMPLE) {\r\n\t\tCKLBLuaTask* luaTask = (CKLBLuaTask*)this;\r\n\t\tluaTask->performKillCallback();\r\n\t}\r\n\r\n    // 自身をタスクマネージャの削除リストに追加\r\n    mgr.remove(this);\r\n\r\n    // これで、フレーム終了時にこのタスクのインスタンスは削除される。\r\n}\r\n\r\n\r\n//----------------------\r\n// ここよりタスクマネージャ\r\n// ---------------------\r\nCKLBTaskMgr::CKLBTaskMgr()\r\n: m_bPause      (false)\r\n, m_bExit       (true)\r\n, m_bStageClear (false)\r\n, m_frameId     (0)\r\n, m_pRegList    (NULL)\r\n, m_currentTask (NULL)\r\n, m_bKilling    (false)\r\n#ifdef DEBUG_MENU\r\n, m_bDbgPause   (false)\r\n#endif\r\n#if defined(DEBUG_MEMORY)\r\n, m_bFreeze     (false)\r\n#endif\r\n{\r\n    int i;\r\n    for(i = 0; i < CKLBTask::P_MAX; i++) {\r\n        m_lstTask[i].begin = m_lstTask[i].end = NULL;\r\n    }\r\n    m_lstRemove.begin = m_lstRemove.end = NULL;\r\n    m_lstStage.begin  = m_lstStage.end  = NULL;\r\n}\r\n\r\nCKLBTaskMgr::~CKLBTaskMgr() \r\n{\r\n}\r\n\r\nCKLBTaskMgr&\r\nCKLBTaskMgr::getInstance()\r\n{\r\n    static CKLBTaskMgr instance;\r\n    return instance;\r\n}\r\n\r\nbool\r\nCKLBTaskMgr::regist(CKLBTask::TASK_PHASE ePhase, CKLBTask * pTask)\r\n{\r\n    // 実行リストへの追加\r\n    pTask->m_ePhase     = ePhase;\r\n    pTask->m_pExePrev   = m_lstTask[ePhase].end;\r\n    pTask->m_pExeNext   = NULL;\r\n    if(m_lstTask[ePhase].end)    { m_lstTask[ePhase].end->m_pExeNext = pTask; }\r\n    if(!m_lstTask[ePhase].begin) { m_lstTask[ePhase].begin = pTask; }\r\n    m_lstTask[ePhase].end = pTask;\r\n\r\n\t// 起動タスクリスト記録の必要があれば記録する\r\n    if(m_pRegList) { m_pRegList->addTask(pTask); }\r\n\r\n    return true;\r\n}\r\n\r\n// 登録されている全タスクを破棄する。\r\n// おもに client クラスから呼び出される。タスクから呼んではならない。\r\nvoid\r\nCKLBTaskMgr::clearTaskList()\r\n{\r\n    int i;\r\n    CKLBTask * pTask;\r\n\tCKLBTask * pNext;\r\n\r\n\t// タスクが親子関係を持っていることがあるので、\r\n\t// 全フェーズのタスクに対し、まずはkill()を発行する。\r\n\t// これにより、削除リストは必ず子→親の順番に登録される。\r\n\t//\r\n\t// - kill() は、既に削除リストに登録されているタスクを二重登録することはない。\r\n\t// - kill() は、指定されたタスクの子を再帰的に検索し、ツリーの末端から削除リストに登録する。\r\n\t//\r\n\t// 以上の特徴により、必ず子から親に向けて削除されるリストが出来上がる。\r\n\tfor(i = 0; i < CKLBTask::P_MAX; i++) {\r\n\t\tpTask = m_lstTask[i].begin;\r\n\t\twhile(pTask) {\r\n\t\t\tpNext = pTask->m_pExeNext;\r\n            pTask->kill();\r\n\t\t\tpTask = pNext;\r\n        }\r\n    }\r\n\r\n\t// 削除リストに登録されたタスクを、登録順に削除する。\r\n\t// 必ず子→親の順番にリストが作成されている。\r\n\tremove_killlist();\r\n\r\n\tfor(i = 0; i < CKLBTask::P_MAX; i++) {\r\n\t\t// should not be necessary as each task will update the links.\r\n\t\tm_lstTask[i].end\t= NULL;\r\n\t\tm_lstTask[i].begin\t= NULL;\r\n    }\r\n}\r\n\r\n// 指定されたタスクをステージタスク登録する\r\nvoid\r\nCKLBTaskMgr::registStageTask(CKLBTask *pTask)\r\n{\r\n\t// 既にステージタスクとして登録されていたら登録せずに帰る。\r\n\tif(pTask->m_pStgPrev || pTask->m_pStgNext || \r\n        (m_lstStage.begin == pTask) || (m_lstStage.end == pTask)) { return; }\r\n\r\n    // ステージタスクリストへの追加\r\n    pTask->m_pStgPrev = m_lstStage.end;\r\n    pTask->m_pStgNext = NULL;\r\n    if(pTask->m_pStgPrev) {\r\n\t\tpTask->m_pStgPrev->m_pStgNext = pTask;\r\n\t} else {\r\n\t\tm_lstStage.begin = pTask;\r\n\t}\r\n    m_lstStage.end = pTask;\r\n}\r\n\r\n// ステージタスクとして登録されている全てのタスクを破棄予約する。\r\nvoid\r\nCKLBTaskMgr::clearStageTask()\r\n{\r\n\t//CKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\r\n\t// 破棄フェーズ中でclearStageTask()を呼んではいけない。\r\n\tklb_assert(!m_bKilling, \"Don't call clearStageTask() in die(). \");\r\n\r\n    m_bStageClear = true;\r\n}\r\n\r\nbool\r\nCKLBTaskMgr::isExistTask(CKLBTask * pTask)\r\n{\r\n    int i;\r\n\tbool bResult = false;\r\n    CKLBTask * pItem;\r\n    for(i = 0; i < CKLBTask::P_MAX; i++) {\r\n        for(pItem = m_lstTask[i].begin; pItem; pItem = pItem->m_pExeNext) {\r\n\t\t\tif(pItem == pTask) {\r\n\t\t\t\tbResult = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(bResult) break;\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBTaskMgr::is_remove(CKLBTask * pTask)\r\n{\r\n\t// 指定されたポインタが、実行リストのどこにも登録されていなければ\r\n\t// 破棄ずみの領域を再度破棄しようとしている可能性がある。\r\n\tbool bResult = isExistTask(pTask);\r\n\tklb_assert(bResult, \"unknow task pointer !\");\r\n\r\n\t// 既に削除リストに登録されている場合\r\n    if(pTask->m_pRmvNext || pTask->m_pRmvPrev) { return true; }\r\n    if(m_lstRemove.begin == pTask || m_lstRemove.end == pTask) { return true; }\r\n\r\n\t// まだ削除予約はされていない\r\n\treturn false;\r\n}\r\n\r\nbool\r\nCKLBTaskMgr::remove(CKLBTask * pTask)\r\n{\r\n\t// 既に削除リストに登録されている場合は何もしない\r\n\tif(is_remove(pTask)) return true;\r\n\r\n\t// 削除リストへの追加\r\n    pTask->m_pRmvPrev = m_lstRemove.end;\r\n    pTask->m_pRmvNext = NULL;\r\n    if(m_lstRemove.end)     { m_lstRemove.end->m_pRmvNext = pTask; }\r\n    if(!m_lstRemove.begin)  { m_lstRemove.begin = pTask; }\r\n    m_lstRemove.end = pTask;\r\n    \r\n    // これが呼ばれる時点では実行リストからの削除は行わない\r\n    return true;\r\n}\r\n\r\nvoid\r\nCKLBTaskMgr::remove_killlist()\r\n{\r\n\tm_bKilling = true;\r\n\r\n    CKLBTask * pNext;\r\n    CKLBTask * pTask = m_lstRemove.begin;\r\n    while(pTask) {\r\n        pNext = pTask->m_pRmvNext;\r\n\r\n        // タスクが独自に握っているリソースの解放処理を行う。\r\n        m_currentTask = pTask;\r\n        pTask->die();\r\n\r\n        // 実行リストから削除する\r\n        if(pTask->m_pExePrev) {\r\n            pTask->m_pExePrev->m_pExeNext = pTask->m_pExeNext;\r\n        } else {\r\n            m_lstTask[pTask->m_ePhase].begin = pTask->m_pExeNext;\r\n        }\r\n        if(pTask->m_pExeNext) {\r\n            pTask->m_pExeNext->m_pExePrev = pTask->m_pExePrev;\r\n        } else {\r\n            m_lstTask[pTask->m_ePhase].end = pTask->m_pExePrev;\r\n        }\r\n        pTask->m_pExeNext = pTask->m_pExePrev = 0;\r\n        // 実行リストからの削除完了\r\n        \r\n        // 親や兄弟から登録を抹消する\r\n        if(pTask->m_pBrsPrev) {\r\n            pTask->m_pBrsPrev->m_pBrsNext = pTask->m_pBrsNext;\r\n        } else {\r\n            // リスト先頭なので、親から削除\r\n            if(pTask->m_pParent) {\r\n                // 親タスクがある場合のみ必要。親タスクがない場合は、兄弟もいない\r\n                pTask->m_pParent->m_lstChild.begin = pTask->m_pBrsNext;\r\n            }\r\n        }\r\n        if(pTask->m_pBrsNext) {\r\n            pTask->m_pBrsNext->m_pBrsPrev = pTask->m_pBrsPrev;\r\n        } else {\r\n            // リスト終端なので、親から削除\r\n            if(pTask->m_pParent) {\r\n                // 親タスクがある場合のみ処理が必要。親タスクが無い場合は兄弟もいない。\r\n                pTask->m_pParent->m_lstChild.end = pTask->m_pBrsPrev;\r\n            }\r\n        }\r\n        pTask->m_pBrsNext = pTask->m_pBrsPrev = NULL;\r\n        pTask->m_pParent  = NULL;\r\n        // 親兄弟との縁切り完了。\r\n        \r\n        if(pTask->m_pStgPrev) {\r\n            pTask->m_pStgPrev->m_pStgNext = pTask->m_pStgNext;\r\n        } else {\r\n            if(m_lstStage.begin == pTask) m_lstStage.begin = pTask->m_pStgNext;\r\n        }\r\n        if(pTask->m_pStgNext) {\r\n            pTask->m_pStgNext->m_pStgPrev = pTask->m_pStgPrev;\r\n        } else {\r\n            if(m_lstStage.end == pTask) m_lstStage.end = pTask->m_pStgPrev;            \r\n        }\r\n        \r\n        // \r\n        // インスタンスを破棄\r\n        KLBDELETE(pTask);\r\n        pTask = NULL;\r\n\r\n        pTask = pNext;\r\n    }\r\n    m_currentTask = NULL;\r\n\r\n\tm_bKilling = false;\r\n\r\n\t// 2013.02.28  executeの最初でしか初期化されない->reboot時に前のが残ったままなので、ここでも初期化処理を入れておく\r\n\tm_lstRemove.begin = m_lstRemove.end = NULL;\r\n}\r\n\r\nvoid\r\nCKLBTaskMgr::dump() {\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\tfprintf(pFile,\"==== Task Instances List ====\\n\");\r\n\tint count = 0;\r\n    for(int i = 0; i < CKLBTask::P_MAX; i++) {\r\n        for(CKLBTask* pTask = m_lstTask[i].begin; pTask; pTask = pTask->m_pExeNext) {\r\n\t\t\tfprintf(pFile,\"[T%4i] Phase : %i Task : %8lX [%s] Type:%s\\n\",\r\n\t\t\t\tcount++,\r\n\t\t\t\ti,\r\n\t\t\t\treinterpret_cast<uintptr_t>(pTask),\r\n\t\t\t\t(pTask->m_activeStatus > 0) ? \"ACTIVE\" : \"SLEEP \",\r\n\t\t\t\tIFactory::getClassName(pTask->getClassID())\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tfprintf(pFile,\"==== Task Instances List (%i Tasks) ====\\n\",count);\r\n}\r\n\r\nbool\r\nCKLBTaskMgr::execute(u32 deltaT)\r\n{\r\n    // すべてのタスクを呼び出す前に、削除リストを初期化する。\r\n    m_lstRemove.begin = m_lstRemove.end = NULL;\r\n    \r\n\t// フレームID更新: 16bit の値が毎フレーム変わる。\r\n\tm_frameId = (++m_frameId) & 0xffff;\r\n\r\n    // 全タスク呼び出し\r\n    int i;\r\n    CKLBTask * pTask;\r\n\tm_startTime = CPFInterface::getInstance().platform().nanotime();\r\n\ts64 scriptTime;\r\n\t// s64 lastTime = time;\r\n\t// s64 execTime[30];\r\n\r\n    for(i = 0; i < CKLBTask::P_MAX; i++) {\r\n\r\n#ifdef DEBUG_MENU\r\n\t\t// デバッグモード用。デバッグモードが使うフェーズ以外すべてを停止させる。\r\n\t\tif (m_bDbgPause &&(i > CKLBTask::P_DBGMENU && i < CKLBTask::P_DRAW)) continue;\r\n#endif\r\n\t\t// ポーズ中であれば、P_PREV - P_JUDGE はスキップする。\r\n        if (m_bPause && (i >= CKLBTask::P_PREV && i < CKLBTask::P_DRAW)) continue;\r\n        // フリーズ中(pauseGame)はINPUT系と、それに準ずる重要タスク以外はスキップする\r\n\t\tif (m_bFreeze && (i > CKLBTask::P_IMPORTANT && i < CKLBTask::P_DRAW)) continue;\r\n#ifdef DEBUG_PERFORMANCE\r\n\t\tif (i == CKLBTask::P_SCRIPT) {\r\n\t\t\tscriptTime = CPFInterface::getInstance().platform().nanotime();\r\n\t\t}\r\n#else\r\n        scriptTime = 0;\r\n#endif\r\n\r\n        for(pTask = m_lstTask[i].begin; pTask; pTask = pTask->m_pExeNext) {\r\n            m_currentTask = pTask;\r\n\t\t\t// taskCount++;\r\n\r\n            // 開始時刻の取得\r\n#ifdef DEBUG_PERFORMANCE\r\n            s64 ntbegin = CPFInterface::getInstance().platform().nanotime();\r\n#endif\r\n\r\n            \r\n            // ポーズ状態になければexecute()を実行。\r\n\t\t\t// If 1xxxxxxx\t: Sleeping\r\n\t\t\t// If 00000000  : Active but nothing to do : same as 1xxxxxxx\r\n\t\t\t// If 0???????  : Execute\r\n\t\t\tif(pTask->m_activeStatus > 0) {\r\n\t\t\t\tpTask->execute(deltaT);\r\n\t\t\t}\r\n\r\n            // 終了時刻の取得\r\n#ifdef DEBUG_PERFORMANCE\r\n            s64 ntend = CPFInterface::getInstance().platform().nanotime();\r\n\t\t\tif (((ntend - ntbegin)/1000000) >= 3000) {\r\n\t\t\t\tDEBUG_PRINT(\"Task ClassID[%i] '%s' takes %i millisec to execute\",pTask->getClassID(),IFactory::getClassName(pTask->getClassID()),(int)((ntend - ntbegin)/1000000));\r\n\t\t\t}\r\n#endif\r\n        }\r\n\r\n\t\t// execTime[i] = CPFInterface::getInstance().platform().nanotime() - time;\r\n#ifdef DEBUG_PERFORMANCE\r\n\t\tif (i == CKLBTask::P_SCRIPT) {\r\n\t\t\tm_scriptTime = CPFInterface::getInstance().platform().nanotime() - scriptTime;\r\n\t\t}\r\n#else\r\n        m_scriptTime = 0;\r\n#endif\r\n    }\r\n\t// printf(\"\\n\");\r\n\r\n    // ステージタスク破棄コマンドが出ていたら、ステージタスクを破棄対象に加える\r\n    if(m_bStageClear) {\r\n        for(pTask = m_lstStage.begin; pTask; pTask = pTask->m_pStgNext) {\r\n            pTask->kill();  // 削除リストに追加(親子関係を加味してkill()で登録)\r\n        }\r\n        m_bStageClear = false;\r\n    }\r\n        \r\n    // 削除リストに登録済みのタスクを実行リストから削除し、インスタンスを delete する。\r\n\tremove_killlist();\r\n    \r\n#if defined (DEBUG_MEMORY)\r\n    // トラッキングのフレームを更新\r\n    CTracker::updateFrame();\r\n#endif\r\n\r\n\tm_currentTask = NULL;\r\n    \r\n    return m_bExit;\r\n}\r\n\r\nvoid\r\nCKLBTask::interposeTimer(CKLBTask* pTimer) {\r\n\tif(pTimer) {\r\n\t\tpTimer->m_pParent\t= m_pParent;\r\n\t\tpTimer->m_pBrsPrev\t= NULL;\r\n\t\tpTimer->m_pBrsNext\t= NULL;\r\n\t\tpTimer->m_lstChild.begin\t= this;\t\r\n\t\tpTimer->m_lstChild.end\t\t= this;\t\r\n\t\r\n\t\tm_pParent\t= pTimer;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n    \\brief  Root Task Class (CKLBTask) and Task Manager (CLKBTaskMgr) definition\r\n    \\file   CKLBTask.h\r\n  */\r\n#ifndef CKLBTask_h\r\n#define CKLBTask_h\r\n\r\n#include <string.h>\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBTask;\r\nclass CKLBTaskMgr;\r\n\r\nclass CKLBRegistedTaskList\r\n{\r\npublic:\r\n\tCKLBRegistedTaskList();\r\n\tvirtual ~CKLBRegistedTaskList();\r\n\r\n\tvoid addTask(CKLBTask * pTask);\r\n\tvoid killTaskList(bool kill_task = true);\r\n\r\nprivate:\r\n\tstruct TASKITEM {\r\n\t\tTASKITEM\t*\tprev;\r\n\t\tTASKITEM\t*\tnext;\r\n\r\n\t\tCKLBTask\t*\tpTask;\r\n\t};\r\n\r\n\tTASKITEM\t*\tm_begin;\r\n\tTASKITEM\t*\tm_end;\r\n};\r\n\r\n\r\nstruct TASK_LIST {\r\n    CKLBTask * begin;\r\n    CKLBTask * end;\r\n};\r\n\r\n// Change Task Execution Flag because order changed.\r\n#define\tREFRESH_A\t\t\tsetStatusFlag(0x1)\r\n#define CHANGE_A\t\t\tgetStatusFlag(0x1)\r\n#define RESET_A\t\t\t\tresetStatusFlag(0x1)\r\n\r\n// Change Task Execution Flag because geometry related property changed\r\n#define REFRESH_B\t\t\tsetStatusFlag(0x2)\r\n#define CHANGE_B\t\t\tgetStatusFlag(0x2)\r\n#define RESET_B\t\t\t\tresetStatusFlag(0x2)\r\n\r\n// Change Task Execution Flag because animation is active.\r\n#define REFRESH_C\t\t\tsetStatusFlag(0x4)\r\n#define CHANGE_C\t\t\tgetStatusFlag(0x4)\r\n#define RESET_C\t\t\t\tresetStatusFlag(0x4)\r\n\r\n// Change Task Execution Flag because animation is active.\r\n#define REFRESH_D\t\t\tsetStatusFlag(0x8)\r\n#define CHANGE_D\t\t\tgetStatusFlag(0x8)\r\n#define RESET_D\t\t\t\tresetStatusFlag(0x8)\r\n\r\n// Change Task Execution Flag because animation is active.\r\n#define REFRESH_E\t\t\tsetStatusFlag(0x10)\r\n#define CHANGE_E\t\t\tgetStatusFlag(0x10)\r\n#define RESET_E\t\t\t\tresetStatusFlag(0x10)\r\n\r\n//! ゲームタスククラス\r\n/*!\r\n  ゲーム中のすべての処理はフレーム単位で行われ、それぞれの処理単位は「タスク」と呼ばれるクラスで管理されます。\r\n 「フレーム単位で実行される処理」は、すべて「タスク」として実装することで、\r\n  ゲームプログラムは一貫性が保たれ、またシンプルなものになります。\r\n\r\n  CKLBTask はゲーム中のすべてのタスクの基底クラスとなり、実装されたタスククラスのインスタンスを\r\n  タスクマネージャに登録することで、ゲーム中の処理として実行されるようになります。\r\n  */\r\n\r\n/*!\r\n* \\class CKLBTask\r\n* \\brief Engine Root Task class\r\n* \r\n* The Game Engine is based on a frame-by-frame processing.\r\n* Each unit processed each frame is managed by the class CKLBTask.\r\n* CKLBTask is the base class for all the tasks of the engine.\r\n* By registering a task in the TaskManager it will be run as a process in the game.\r\n*/\r\nclass CKLBTask : public CKLBObjectScriptable\r\n{\r\n    friend class CKLBTaskMgr;\r\npublic:\r\n    \r\n    typedef enum {\r\n        TASK_SIMPLE,\r\n        TASK_LUA_BASIC,\r\n        TASK_LUA_PROPERTY,\r\n        TASK_LUA_UI\r\n    } TASKTYPE;\r\n\r\n    virtual TASKTYPE getTaskType();\r\n\r\n\r\n    //! タスク登録フェーズ値定義\r\n    /*!\r\n     タスクシステムにはTASK_PHASEに定義された複数のフェーズがあり、\r\n     なおかつそれぞれのフェーズに対応するタスクの実行リストを持ちます。\r\n     \r\n     登録されているタスクは必ず P_BEGIN から P_END 方向に向かって、\r\n     それぞれの実行フェーズに対応する実行リストに登録されているタスクが登録順に実行されます。\r\n     \r\n     - 要点\r\n        -# 異なるフェーズに登録されたタスク間における実行順は、登録順に関わらず必ずフェーズ順になることが保証される。\r\n        -# 同じフェーズに登録されたタスク間における実行順は、必ず登録順になることが保証されている。\r\n        .\r\n     .\r\n     \r\n     通常のゲームタスクは P_PREV, P_NORMAL, P_AFTER に登録するタスクとして作成します。\r\n     この内、ほとんどのものは P_NORMAL として作るべきであり、「必ず先に処理すべきもの」\r\n     「必ず後に処理すべきもの」のために P_PREV, P_AFTER が用意されています。\r\n     \r\n     これらのフェーズは通常のゲーム進行に伴うフェーズであるため、タスクマネージャが「ポーズ状態」に\r\n     されている状態ではフレーム処理(execute()の呼び出し)が行われません。\r\n     \r\n     これら以外は特殊な用途を持つフェーズであるため、原則そのフェーズに登録すべきタスク以外は登録するべきではありません。\r\n     */\r\n    typedef enum {\r\n        P_BEGIN \t= 0,\t\t//!< フレーム開始時の処理。描画エンジンのリフレッシュ処理等はこのフェーズに登録。\r\n\r\n        P_INPUT \t= 1,        //!< ユーザ操作の取得など\r\n        P_IMPORTANT = 2,        //!< ポーズ・フリーズ中でも走らなければならないタスク\r\n#ifdef DEBUG_MENU\r\n\t\tP_DBGSIGN \t= 3,\t\t//!< デバッグコマンド受付\r\n\t\tP_DBGMENU \t= 4,\t\t//!< デバッグメニュー処理\r\n#endif\r\n\r\n\t\tP_UIPREV \t= 5,\t\t//!< 標準UIパーツより先に処理するUIフェーズ\r\n\r\n\t\tP_SCRIPT \t= 6,       //!< スクリプト的な処理タスクはこのフェーズに登録\r\n\r\n\t\tP_UIPROC \t= 7,\t\t//!< UIパーツの処理を行うフェーズ\r\n\t\tP_UIAFTER \t= 8,\t\t//!< 他のUIパーツを子タスクとして使用するUIタスク用のフェーズ\r\n\r\n        P_MENU \t\t= 9,         //!< メニューフェーズ: メニュー処理タスクはこのフェーズに登録。ポーズ中でも実行される。\r\n\r\n        // P_PREV, P_NORMAL, P_AFTER はポーズ中実行されない。\r\n        P_PREV \t\t= 10,         //!< (ポーズ中停止)通常タスク以前に処理しなければならないもの\r\n        P_NORMAL \t= 11,      //!< (ポーズ中停止)通常のタスクはここで処理\r\n        P_AFTER \t= 12,       //!< (ポーズ中停止)通常のタスクが終わった後に処理しなければならないもの\r\n\t\tP_JUDGE \t= 13,       //!< ゲーム中の判定など\r\n\r\n        P_DRAW \t\t= 14,        //!< 描画処理をキックするタスク等はここに登録\r\n        P_GC\t\t= 15,\r\n        P_END \t\t= 16,         //!< 描画キック後に行う処理があればここに登録\r\n\r\n        P_MAX \t\t= 17          //!< フェーズ総数\r\n    } TASK_PHASE;\r\n\r\npublic:\r\n    //! 破棄指令\r\n    /*!\r\n        タスクに破棄指令を出します。\r\n        破棄指令が出されたフレームの最後に die() が呼び出され、タスクのインスタンスが破棄されます。\r\n        タスクが他のタスクと親子関係を持つ場合、子として登録されているタスク全てに対し、再帰的に kill() が呼び出されます。\r\n     */\r\n    void kill();\r\n\r\n\t//! 一時停止指令\r\n\t/*!\r\n\t\tタスクに一時停止指令を出します。\r\n\t\tbPause がtrue で一時停止、falseで解除になります。\r\n\t*/\r\n\tvoid setPause(bool bPause, bool bRecursive = true);\r\n\r\n\tvoid interposeTimer(CKLBTask* pTimer);\r\n\r\n\tvirtual u32 getClassID();\r\nprotected:\r\n    //! コンストラクタ\r\n    /*!\r\n     派生させて使うためのクラスなので、protected になっています。\r\n     */\r\n    CKLBTask();\r\n\r\n    //! デストラクタ\r\n    virtual ~CKLBTask();\r\n\r\n    //! 破棄時の処理\r\n    /*!\r\n     タスクが扱うリソースは、タスク破棄の際に解放される必要があります。\r\n     タスク初期化時に生成/確保されたリソースの破棄処理は、die() の中で実装します。\r\n\r\n     die() は、そのフレームにおけるすべてのタスクのフレーム処理が終わった後に呼び出されます。\r\n     */\r\n    virtual void die();\r\n \r\n    //! フレーム処理実行\r\n    /*!\r\n     \\param deltaT  直前のフレームからの経過時間(単位: [ms])\r\n\r\n     毎フレーム行う処理を部品化するものがタスクの役割です。そのタスクがフレーム中に行うべき処理は execute() の中で実装します。\r\n     フレーム中で処理を止めると、以後のタスクの処理ができないので注意してください。\r\n     */\r\n    virtual void execute(u32 deltaT);\r\n\r\n    //! 初期化時に使用する実行リストへの登録\r\n    /*!\r\n     \\param pParent     親タスクインスタンスのポインタ\r\n     \\param ePhase      タスクを登録する実行フェーズ値\r\n     \r\n     タスクインスタンスをタスクマネージャの実行リストに登録します。\r\n     この登録を行わなければタスクは実行されないため、必ずタスク初期化処理の中で呼び出し、\r\n     実行リストへの登録を行う必要があります。\r\n     \r\n     タスクの実行リストへの登録は、タスクインスタンスの生成が完了していない状態で行うべきではありません。\r\n     このため、コンストラクタ内やメンバの初期化が完了していない状態で呼び出すことは避けてください。\r\n     \r\n     また、pParent として指定される親タスクは、生成が完了し実行リストへの登録が完了しているタスクである必要があります。\r\n     regist() が実行されていないタスクインスタンスのポインタを pParent に指定することは避けてください。\r\n     */\r\n    bool regist(CKLBTask * pParent = 0, TASK_PHASE ePhase = P_NORMAL);\r\n\r\n\tinline CKLBTask * getParent() const { return m_pParent; }\r\n\r\nprotected:\r\n    void child(CKLBTask * pChild);\r\n\tvirtual bool onPause(bool bPause);\r\n\r\n\tinline\r\n\tvoid setStatusFlag\t(u8 mask)\t{\tklb_assert(mask<64,\"Bit 0..5 only are usable\"); m_activeStatus |=mask; }\r\n\r\n\tinline\r\n\tvoid resetStatusFlag(u8 mask)\t{\tklb_assert(mask<64,\"Bit 0..5 only are usable\"); m_activeStatus &=~mask; }\r\n\r\n\tinline\r\n\tu8\t getStatusFlag\t(u8 mask)\t{\treturn m_activeStatus & mask; }\r\n\r\n\tvoid setNotAlwaysActive()\t\t{\tm_activeStatus &= ~ALWAYS_ACTIVE; }\r\nprivate:\r\n    // 実行関連情報(std::list<...>が使えない場合を想定し、ポインタで実装)\r\n    TASK_PHASE       m_ePhase;     // 自身の実行フェーズ\r\n    // タスク間の親子関連情報\r\n    CKLBTask       * m_pParent;    // 親タスクへのポインタ\r\n\r\n    // 子タスクへのリストを持つ\r\n    TASK_LIST m_lstChild;\r\n \r\n    // 実行リスト用のリンク\r\n    CKLBTask       * m_pExePrev;   // 実行フェーズリスト中の前のタスク\r\n    CKLBTask       * m_pExeNext;   // 実行フェーズリスト中の次のタスク\r\n\r\n    // 兄弟タスクへのリンク\r\n    CKLBTask       * m_pBrsPrev;\r\n\r\n    CKLBTask       * m_pBrsNext;\r\n\r\n    // 死ぬときのタスクリスト用リンク\r\n    CKLBTask       * m_pRmvPrev;\r\n    CKLBTask       * m_pRmvNext;\r\n    \r\n\r\n    // ステージタスクとして登録された際のリンク\r\n    CKLBTask       * m_pStgPrev;\r\n    CKLBTask       * m_pStgNext;\r\n\r\n\tstatic const s8\tALWAYS_ACTIVE\t= 1<<6;\r\n\ts8\t\t\t\tm_activeStatus;\r\n};\r\n\r\n//! タスクマネージャクラス\r\n/*!\r\n タスクマネージャクラスは、CKLBTask から派生したインスタンスを登録し、\r\n 実行、管理を行う機能を持つSingletonクラスです。\r\n \r\n タスクの実行リストを持ち、登録されている CKLBTask の execute() を順次呼び出すことで\r\n 1フレーム分全体の処理を行うのは CKLBTaskMgr の役割です。\r\n ゲーム中において動作している全タスク\r\n */\r\nclass CKLBTaskMgr\r\n{\r\n    friend class CKLBTask;\r\nprivate:\r\n    CKLBTaskMgr();\r\n    virtual ~CKLBTaskMgr();\r\npublic:\r\n    //! インスタンス取得\r\n    /*!\r\n     \\return CKLBTaskMgr インスタンスの参照\r\n     \r\n     CKLBTaskMgr のインスタンスへの参照を取得する。\r\n     */\r\n    static CKLBTaskMgr& getInstance();\r\n\r\n\t//! Dump list of instanciated tasks.\r\n\tvoid dump();\r\n\r\n\t//! クリア処理\r\n\t/*!\r\n\t 登録されているすべてのタスクを破棄する。\r\n\t 終了処理に使用。\r\n\t */\r\n\tvoid clearTaskList();\r\n\r\n    //! ステージタスク登録\r\n    /*!\r\n     指定されたタスクをステージタスクとして登録する。\r\n     */\r\n    void registStageTask(CKLBTask * pTask);\r\n\r\n    //! ステージタスククリア処理\r\n    /*!\r\n     ステージタスクとして登録されているタスクを全て破棄予約する。\r\n     ステージ間の切り替えで使用。ステージタスク以外は破棄しない。\r\n     */\r\n    void clearStageTask();\r\n\r\n\t//! タスクポインタ有効確認\r\n\t/*!\r\n\t 指定されたタスクポインタが、実行リスト中に存在しているかを確認する。\r\n\t デバッグ用機能なので、リリース版では無効化されるべき。\r\n\t*/\r\n\tbool isExistTask(CKLBTask * pTask);\r\n\r\n\t//! 登録されるタスクを記録するCKLBRegistedTaskListを指定する\r\n\t/*!\r\n\t 0 が指定されたら登録タスクの記録を行わない\r\n\t */\r\n\tinline void setRegistedTaskList(CKLBRegistedTaskList * pRegList = 0) {\r\n\t\tm_pRegList = pRegList;\r\n\t}\r\n\r\n\r\n    //! 1フレーム分の処理実行\r\n    /*!\r\n     \\param deltaT  直前のフレームからの経過時間(単位[ms])\r\n     \r\n     実行リストに登録されている全 CKLBTask派生クラスのexecute()を呼び出し、1フレーム分の処理を行う。\r\n     そのフレーム中に削除が指定されたタスクおよびその子タスクについては、すべての execute() を呼び出し終わった後に\r\n     die() を呼び出し、インスタンスを削除する。\r\n     */\r\n    bool execute(u32 deltaT);\r\n\r\n    //! ポーズ状態を指定する\r\n    /*!\r\n     \\param bPause  ポーズ状態\r\n     \r\n     タスクマネージャのポーズ状態を指定します。\r\n     bPause が true のときポーズ状態、false のとき通常実行状態になります。\r\n\r\n     ポーズ状態では、CKLBTaskMgr::execute() を呼び出しても P_PREV,P_NORMAL,P_AFTER, P_JUDGE フェーズの\r\n     タスクについては execute() が呼び出されなくなります。\r\n     */\r\n    inline bool setPause(bool bPause) { return m_bPause = bPause; }\r\n\r\n    //! ポーズ状態の取得\r\n    /*!\r\n     \\return 現在のポーズ状態\r\n     \r\n     タスクマネージャのポーズ状態を取得します。\r\n     ポーズ状態については setPause() の解説も参照してください。\r\n     */\r\n    inline bool getPause() { return m_bPause; }\r\n\r\n\tinline bool isKilling() const { return m_bKilling; }\r\n\r\n#ifdef DEBUG_MENU\r\n\t//! デバッグ用全停止指令\r\n\t/*!\r\n\t\ttrueを与えることで、P_UIPREVからP_JUDGEまでの入力とデバッグ、描画を除いた\r\n\t\tすべてのフェーズの実行を一時停止します。\r\n\t\tfalseで解除されます。\r\n\t*/\r\n\tbool setDbgPause(bool bPause) { return m_bDbgPause = bPause; }\r\n#endif\r\n\r\n    //! Exit\r\n    /*!\r\n    　タスクマネージャにExitフラグを立てます。\r\n     そのフレーム以降execute()はfalseを返すようになります。\r\n     この値は、フレーム駆動システム側にによってゲーム終了の指示として扱われます。\r\n     */\r\n    inline void\t\t\tsetExit\t\t\t()\t\t\t\t\t{ m_bExit = false; }\r\n\r\n    inline CKLBTask *\tgetCurrentTask\t()\t\t\t\t\t{ return m_currentTask; }\r\n    \r\n    inline void\t\t\tsetCurrentTask\t(CKLBTask * pTask)\t{ m_currentTask = pTask; }\r\n\r\n\tinline u32\t\t\tgetFrameID\t\t() const\t\t\t{ return m_frameId; }\r\n\r\n\t//! 指定されたタスクがすでに削除予約されているか否かを返す\r\n\tbool is_remove(CKLBTask * pTask);\r\n\r\n\tinline void setFreeze\t(bool bFreeze)\t{ m_bFreeze = bFreeze;\t}\r\n\tinline bool getFreeze\t()\t\t\t\t{ return m_bFreeze;\t\t}\r\n\r\n\tinline s64 getStartTime\t()\t\t\t\t{ return m_startTime;\t}\r\n\tinline s64 getScriptTime()\t\t\t\t{ return m_scriptTime;\t}\r\n\r\nprivate:\r\n    //! タスクを指定されたフェーズの実行リストに登録する\r\n    bool regist(CKLBTask::TASK_PHASE ePhase, CKLBTask * pTask);\r\n    \r\n    //! 指定されたタスクを削除予約する。\r\n    bool remove(CKLBTask * pTask);\r\n\r\n\t//! 削除リストに登録されているタスクを順に削除する\r\n\tvoid remove_killlist();\r\n\r\nprivate:\r\n    CKLBTask    *   m_currentTask;\r\n\r\n    TASK_LIST       m_lstTask[ CKLBTask::P_MAX ];\r\n    TASK_LIST       m_lstRemove;\r\n    \r\n    TASK_LIST       m_lstStage;\r\n\r\n\t// フレームID。毎フレーム値が更新される。同じフレームでは同じ値になる。\r\n\tu32\t\t\t\tm_frameId;\r\n\r\n    // Exitフラグ。ゲーム終了指示が出された際に true になる。\r\n    bool            m_bExit;\r\n\r\n    // ポーズ状態\r\n    bool            m_bPause;     // ポーズ状態。true の時はポーズ状態として、P_PREV, P_NORMAL, P_AFTER をスキップする。\r\n\r\n\t// kill処理中フラグ\r\n\tbool\t\t\tm_bKilling;\t  // kill中は true。それ以外は false\r\n\r\n\t//\r\n\ts64\t\t\t\tm_startTime;\r\n\ts64\t\t\t\tm_scriptTime;\r\n\r\n\t// タスクリスト記録\r\n\tCKLBRegistedTaskList\t*\tm_pRegList;\r\n\r\n#ifdef DEBUG_MENU\r\n\tbool\t\t\tm_bDbgPause;\r\n#endif\r\n\r\n    // true にされたフレームの最後に、ステージタスクとして登録されている全タスクを破棄対象とする。\r\n    bool            m_bStageClear;\r\n\tbool\t\t\tm_bFreeze;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBTextTempBuffer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBTextTempBuffer.h\"\r\n\r\nu8* CKLBTextTempBuffer::m_pBuffer\t\t= NULL;\r\nu32 CKLBTextTempBuffer::m_surfaceSize\t= 0;\r\n\r\n/*static*/ \r\nbool \r\nCKLBTextTempBuffer::allocatorBuffer(u32 width, u32 height, u32 pixSize) \r\n{\r\n\tfreeBuffer();\r\n\tm_surfaceSize\t= width * height * pixSize;\r\n\tm_pBuffer\t\t= KLBNEWA(u8, m_surfaceSize);\r\n\tif (!m_pBuffer) {\r\n\t\tm_surfaceSize = 0;\r\n\t}\r\n\treturn (m_pBuffer != NULL);\r\n}\r\n\r\n/*static*/ \r\nu8*\t\r\nCKLBTextTempBuffer::reallocateBuffer(u32 width, u32 height, u32 pixSize) \r\n{\r\n\tif ((width * pixSize * height) <= m_surfaceSize) {\r\n\t\treturn m_pBuffer;\r\n\t}\r\n\r\n\tif (m_pBuffer) {\r\n\t\tKLBDELETEA(m_pBuffer);\r\n\t\tm_pBuffer\t\t= NULL;\r\n\t\tm_surfaceSize\t= 0;\r\n\t}\r\n\r\n\tallocatorBuffer(width, height, pixSize);\r\n\treturn m_pBuffer;\r\n}\r\n\r\n/*static*/ \r\nvoid\t\r\nCKLBTextTempBuffer::freeBuffer() \r\n{\r\n\tKLBDELETEA(m_pBuffer);\r\n\tm_pBuffer = NULL;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBTextTempBuffer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLBTEXTTEMPBUFFER_H__\r\n#define __CKLBTEXTTEMPBUFFER_H__\r\n\r\n#include \"BaseType.h\"\r\n\r\nclass CKLBTextTempBuffer {\r\npublic:\r\n\tstatic u32\tgetBufferSurface()\t\t{ return m_surfaceSize;\t}\r\n\tstatic u8*\tgetBuffer\t\t()\t\t{ return m_pBuffer;\t\t}\r\n\r\n\tstatic bool\tallocatorBuffer\t(u32 width, u32 height, u32 pixSize);\r\n\tstatic u8*\treallocateBuffer(u32 width, u32 height, u32 pixSize);\r\n\tstatic void\tfreeBuffer\t\t();\r\nprivate:\r\n\tstatic\tu8*\tm_pBuffer;\r\n\tstatic\tu32 m_surfaceSize;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBUITask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\n//\r\n// すべてのUIタスクが持つプロパティのリスト\r\n// Note : keep the order because of CKLBFormIF.cpp::updateStandardNode(...)\r\n//\r\nconst char\t*\tCKLBUITask::ms_propList[] = {\r\n\t\"alpha\",\t// Keep COLOR after ALPHA !\r\n\t\"color\",\r\n\t\"scaleX\",\t// Keep SCALEY after SCALEX !\r\n\t\"scaleY\",\r\n\t\"rot\",\r\n\t\"x\",\t\t// Keep Y after X\r\n\t\"y\",\r\n\t\"visible\",\r\n\t0\r\n};\r\n\r\nCKLBUITask::CKLBUITask(TASK_PHASE phase)\r\n: CKLBLuaPropTask()\r\n, m_phase       (phase)\r\n, m_initX       (0.0f)\r\n, m_initY       (0.0f)\r\n, m_pRegParent  (NULL)\r\n, m_visible     (true)\r\n{\r\n}\r\n\r\nCKLBUITask::~CKLBUITask() \r\n{\r\n}\r\n\r\nCKLBTask::TASKTYPE\r\nCKLBUITask::getTaskType()\r\n{\r\n    return TASK_LUA_UI;\r\n}\r\n\r\nbool\r\nCKLBUITask::setupNode()\r\n{\r\n\tm_pUINode = KLBNEW(CKLBSplineNode);\r\n    if(!m_pUINode) { return false; }\r\n\tm_pUINode->setUITask(this);\r\n\tm_pUINode->resetAsInternalNode();\r\n\tm_pUINode->setName(\"CKLBUITask Node\");\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUITask::registUI(CKLBUITask * pParent, bool result, CKLBTask * pRegParent)\r\n{\r\n\t// UIタスクの親が pParentで指定されている場合、別の非UIタスクを pRegParent に指定することはできない。\r\n\t// pParent が 0 の場合、pRegParent が 0 でなければそちらが親タスクとして使用される。\r\n\tklb_assert((pParent && !pRegParent) || (!pParent), \"double parent assign.\");\r\n\r\n\tif(!result) {\r\n\t\tKLBDELETE(m_pUINode);\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// UIタスクすべてが持つべきプロパティを追加する。\r\n\tif (!m_newScriptModel) {\r\n\t\tm_beginIndex = getPropertyCount();\r\n\t\tif(!addPropertyList(ms_propList)) {\r\n\t\t\tKLBDELETE(m_pUINode);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// デフォルト値を設定しておく\r\n\t\tsetInt(PRG_ALPHA    + m_beginIndex, 0xff);\r\n\t\tsetInt(PRG_COLOR    + m_beginIndex, 0x00ffffff);\r\n\t\tsetNum(PRG_SCALE_X  + m_beginIndex, 1.0f);\r\n\t\tsetNum(PRG_SCALE_Y  + m_beginIndex, 1.0f);\r\n\t\tsetNum(PRG_ROT      + m_beginIndex, 0.0f);\r\n\t\tsetNum(PRG_X        + m_beginIndex, m_initX);\r\n\t\tsetNum(PRG_Y        + m_beginIndex, m_initY);\r\n\t\tsetBool(PRG_VISIBLE + m_beginIndex, true);\r\n\t} else {\r\n\t\tm_beginIndex = 0;\r\n\t\t// デフォルト値を設定しておく\r\n\t\tm_alpha = 0xff;\r\n\t\tm_color = 0x00ffffff;\r\n\t\tsetVisible(m_visible);\r\n\t}\r\n\r\n\t// 初期化が成功し、なおかつ親UIがある場合、親UIのノードに自身のノードを追加する。\r\n\tif (pParent && (pParent->getClassID() & CLS_NONVISUALTASK)) {\r\n\t\tpParent = NULL;\r\n\t}\r\n\r\n\tif(pParent) {\r\n\t\tpParent->getNode()->addNode(m_pUINode);\r\n\t} else {\r\n\t\t// 親タスクが指定されていない場合は、Root直下につなぐ。\r\n\t\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\t\tres.getRoot()->addNode(m_pUINode);\r\n\t}\r\n\r\n\tif (!m_newScriptModel) {\r\n\t\t// 親が決まったのでプロパティ値を反映させる\r\n\t\tsetGenericProperty();\t// プロパティ値を反映させる\r\n\t} else {\r\n\t\tsetColor(m_color);\r\n\t\tsetAlpha(m_alpha);\r\n\t\t// m_pUINode->setVisible(true);\r\n\t\tm_pUINode->setTranslate(m_initX, m_initY);\r\n\t\tm_pUINode->markUpMatrix();\r\n\t}\r\n\tm_bInnerUpdate = false;\r\n\r\n\t// UIタスク以外の親を指定する場合、pParent == 0 かつ pRegParent != 0 となっている。\r\n\tCKLBTask * pFinalParent = (pParent) ? pParent : pRegParent;\r\n\r\n\t// 親UIタスクの子として自身を登録し、初期化終了。\r\n\tbool bResult = regist(pFinalParent, m_phase);\r\n    if(!bResult) {\r\n        KLBDELETE(m_pUINode);\r\n    }\r\n    return bResult;\r\n}\r\n\r\nbool\r\nCKLBUITask::initScript(CLuaState& lua)\r\n{\r\n\t// 最低一つはパラメータが必要(親タスクのポインタあるいは0)\r\n    if(lua.numArgs() < 1) { return false; }\r\n\tCKLBUITask * pParent = (lua.isNil(1)) ? NULL : (CKLBUITask *)lua.getPointer(1);\r\n\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initUI(lua);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\treturn registUI(pParent, bResult, m_pRegParent);\r\n}\r\n\r\nvoid\r\nCKLBUITask::die()\r\n{\r\n\tdieUI();\r\n\tKLBDELETE(m_pUINode);\r\n}\r\n\r\nvoid CKLBUITask::setColor(u32 color) {\r\n\tm_color = (color & 0x00ffffff);\r\n\t\r\n\tSColorVector cvec;\r\n\tcvec.m_type = 0;\r\n\tcvec.m_vector[0] = (float)((color >> 16) & 0xff) / 255.0f;\r\n\tcvec.m_vector[1] = (float)((color >> 8 ) & 0xff) / 255.0f;\r\n\tcvec.m_vector[2] = (float)((color >> 0 ) & 0xff) / 255.0f;\r\n\tcvec.m_vector[3] = (float)m_alpha / 255.0f;\r\n\r\n\tm_pUINode->setColorMatrix(cvec);\r\n}\r\n\r\nu32 CKLBUITask::getColor() {\r\n\tu32 r = (u32)(m_pUINode->m_localColorMatrix.m_vector[0] * 255.0);\r\n\tu32 g = (u32)(m_pUINode->m_localColorMatrix.m_vector[1] * 255.0);\r\n\tu32 b = (u32)(m_pUINode->m_localColorMatrix.m_vector[2] * 255.0);\r\n\treturn (r<<16) | (g<<8) | b;\r\n}\r\n\r\nvoid CKLBUITask::setAlpha(u32 alpha) {\r\n\tm_alpha = (alpha & 0xff);\r\n\tSColorVector cvec;\r\n\tcvec.m_type = 0;\r\n\tcvec.m_vector[0] = (float)((m_color >> 16) & 0xff) / 255.0f;\r\n\tcvec.m_vector[1] = (float)((m_color >> 8 ) & 0xff) / 255.0f;\r\n\tcvec.m_vector[2] = (float)((m_color >> 0 ) & 0xff) / 255.0f;\r\n\tcvec.m_vector[3] = (float)m_alpha / 255.0f;\r\n\r\n\tm_pUINode->setColorMatrix(cvec);\r\n}\r\n\r\nu32 CKLBUITask::getAlpha() {\r\n\treturn (u32)(m_pUINode->m_localColorMatrix.m_vector[3] * 255.0);\r\n}\r\n\r\nbool CKLBUITask::reconnect(const char* nodeName) {\r\n\t// まず、自身に親がいるか否かを調べる。\r\n\t// 親がいなければエラー、親がUIタスクでなくてもエラー。\r\n\tCKLBTask * pParent = getParent();\r\n\tif (!pParent || pParent->getTaskType() != TASK_LUA_UI) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// UIタスクの親がいるなら、その親の持つノードから名前で検索する\r\n\tCKLBUITask * pUIParent  = (CKLBUITask *)pParent;\r\n\tCKLBNode * pParentNode  = pUIParent->getNode();\r\n\tCKLBNode * pMyBaseNode  = this->getNode();\r\n\tCKLBNode * pNode        = pParentNode->search(nodeName);\r\n\r\n\t// 該当するノードが見つからなければエラー\r\n\tif (!pNode) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 該当するノードが見つかったので、接続を付け替える。\r\n\tpParentNode->removeNode(pMyBaseNode);\r\n\tpNode->addNode(pMyBaseNode);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUITask::updateUIProperty()\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Never called by new scripting model\");\r\n\r\n\tbool bAnim = m_pUINode->isAnimating();\r\n\tif(bAnim) {\r\n\t\t// アニメーション中なので、\r\n\t\t// アニメーションによって変動するパラメータをプロパティに反映する\r\n\t\tfloat rot = m_pUINode->getRotation();\r\n\t\tfloat scaleX = m_pUINode->getScaleX();\r\n\t\tfloat scaleY = m_pUINode->getScaleY();\r\n\t\t// 座標情報\r\n\t\tfloat x = m_pUINode->m_matrix.m_matrix[MAT_TX];\r\n\t\tfloat y = m_pUINode->m_matrix.m_matrix[MAT_TX];\r\n\t\t// 色情報\r\n\t\tSColorVector &vec = m_pUINode->m_localColorMatrix;\r\n\t\tu32 color = 0;\r\n\t\tu32 alpha =  (u32)(vec.m_vector[3] * 255.0);\r\n\t\tfor(int i = 0; i < 3; i++) {\r\n\t\t\tcolor |= (u32)(vec.m_vector[i] * 255.0) << (i * 8);\r\n\t\t}\t\t\r\n\t\tsetNum(PRG_X        + m_beginIndex, x);\r\n\t\tsetNum(PRG_Y        + m_beginIndex, y);\r\n\t\tsetNum(PRG_SCALE_X  + m_beginIndex, scaleX);\r\n\t\tsetNum(PRG_SCALE_Y  + m_beginIndex, scaleY);\r\n\t\tsetNum(PRG_ROT      + m_beginIndex, rot);\r\n\t\tsetNum(PRG_COLOR    + m_beginIndex, color);\r\n\t\tsetNum(PRG_ALPHA    + m_beginIndex, alpha);\r\n\t}\r\n\t// その上で操作されたプロパティがある場合は、その値で上書きする。\r\n\t// (アニメーション中はあまり意味がないとは思われる)\r\n\tif(!getUpdateFlag() && !m_bInnerUpdate) return false;\r\n\tm_bInnerUpdate = false;\r\n\treturn setGenericProperty();\r\n}\r\n\r\nbool\r\nCKLBUITask::setGenericProperty()\r\n{\r\n\tklb_assert(!m_newScriptModel, \"Never called by new scripting model\");\r\n\r\n\tu32 alpha = getInt(PRG_ALPHA + m_beginIndex);\r\n\tu32 color = getInt(PRG_COLOR + m_beginIndex);\r\n\tfloat scaleX = getNum(PRG_SCALE_X + m_beginIndex);\r\n\tfloat scaleY = getNum(PRG_SCALE_Y + m_beginIndex);\r\n\tfloat x      = getNum(PRG_X       + m_beginIndex);\r\n\tfloat y      = getNum(PRG_Y       + m_beginIndex);\r\n\tfloat rot    = getNum(PRG_ROT     + m_beginIndex);\r\n\r\n\tSColorVector cvec;\r\n\tcvec.m_type = 0;\r\n\tfor(int i = 0; i < 3; i++) {\r\n\t\tint col = 0xff & (color >> (16 - 8 * i));\r\n\t\tcvec.m_vector[i] = (float)(col) / 255.0f;\r\n\t}\r\n\tcvec.m_vector[3] = (float)alpha / 255.0f;\r\n\tbool visible = getBool(PRG_VISIBLE + m_beginIndex);\r\n\tm_pUINode->setColorMatrix(cvec);\r\n\tm_pUINode->setScale(scaleX, scaleY);\r\n\tm_pUINode->setTranslate(x, y);\r\n\tm_pUINode->setVisible(visible);\r\n\tm_pUINode->setRotation(rot);\r\n\r\n\treturn true;\r\n}\r\n\r\nint\r\nCKLBUITask::commandUI(CLuaState& lua, int /*argc*/, int /*cmd*/)\r\n{\r\n\tlua.retBoolean(false);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBUITask::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint cmd = lua.getInt(2);\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\tret = commandUI(lua, argc, cmd);\r\n\t\tbreak;\r\n\tcase UI_GENERIC_NODE_RECONNECT:\r\n\t\t{\r\n\t\t\t// 親タスクの持つ基点ノードから名前による検索を行い、\r\n\t\t\t// 見つかれば自身を接続するノードを、親タスクの起点ノードからそのノードに切り替える。\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// まず、自身に親がいるか否かを調べる。\r\n\t\t\t// 親がいなければエラー、親がUIタスクでなくてもエラー。\r\n\t\t\tCKLBTask * pParent = getParent();\r\n\t\t\tif(!pParent || pParent->getTaskType() != TASK_LUA_UI) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// UIタスクの親がいるなら、その親の持つノードから名前で検索する\r\n\t\t\tCKLBUITask * pUIParent = (CKLBUITask *)pParent;\r\n\t\t\tconst char * node_name = lua.getString(3);\r\n\t\t\tCKLBNode * pParentNode = pUIParent->getNode();\r\n\t\t\tCKLBNode * pMyBaseNode = this->getNode();\r\n\t\t\tCKLBNode * pNode = pParentNode->search(node_name);\r\n\r\n\t\t\t// 該当するノードが見つからなければエラー\r\n\t\t\tif(!pNode) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// 該当するノードが見つかったので、接続を付け替える。\r\n\t\t\tpParentNode->removeNode(pMyBaseNode);\r\n\t\t\tpNode->addNode(pMyBaseNode);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_SET_NAME:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tCKLBNode * pNode = getNode();\r\n\t\t\t\tif(!pNode->getName()) {\r\n\t\t\t\t\tconst char * name = lua.getString(3);\r\n\t\t\t\t\tbResult = pNode->setName(name);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_ANIM_SET_SPLINE:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool result = setSplineAnim(lua, 3);\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_ANIM_PLAY:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tm_pUINode->play();\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_ANIM_STOP:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tm_pUINode->stop();\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_IS_ANIM:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tresult = m_pUINode->isAnimating();\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_SET_COLOR:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\tu32 alpha = lua.getInt(3);\r\n\t\t\t\tu32 rgb = lua.getInt(4);\r\n\t\t\t\tif (!m_newScriptModel) {\r\n\t\t\t\t\tsetInt(PRG_ALPHA + m_beginIndex, alpha);\r\n\t\t\t\t\tsetInt(PRG_COLOR + m_beginIndex, rgb);\r\n\t\t\t\t}\r\n\t\t\t\tsetAlpha(alpha);\r\n\t\t\t\tsetColor(rgb);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_SET_SCALE:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\tfloat scaleX = lua.getFloat(3);\r\n\t\t\t\tfloat scaleY = lua.getFloat(4);\r\n\t\t\t\tif (!m_newScriptModel) {\r\n\t\t\t\t\tsetNum(PRG_SCALE_X + m_beginIndex, scaleX);\r\n\t\t\t\t\tsetNum(PRG_SCALE_Y + m_beginIndex, scaleY);\r\n\t\t\t\t}\r\n\t\t\t\tsetScaleX(scaleX);\r\n\t\t\t\tsetScaleY(scaleY);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_SET_ROT:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tfloat rot = lua.getFloat(3);\r\n\t\t\t\tif (!m_newScriptModel) {\r\n\t\t\t\t\tsetNum(PRG_ROT + m_beginIndex, rot);\r\n\t\t\t\t}\r\n\t\t\t\tsetRotation(rot);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GENERIC_SET_VISIBLE:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tbool visible = lua.getBool(3);\r\n\t\t\t\tif (!m_newScriptModel) {\r\n\t\t\t\t\tsetBool(PRG_VISIBLE + m_beginIndex, visible);\r\n\t\t\t\t}\r\n\t\t\t\tsetVisible(visible);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nbool\r\nCKLBUITask::setSplineAnim(CLuaState& lua, int pos)\r\n{\r\n\tbool result = true;\r\n\r\n\tm_pUINode->stop();\r\n\t// path-1: spline数と、最大のkey数を得る。\r\n\tint spline = 0;\r\n\tint max_key_count = 0;\r\n\tlua.retValue(pos);\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tspline++;\t// スプライン数\r\n\t\tint num = getSplineKeyCount(lua, -1);\r\n        if(num > max_key_count) { max_key_count = num; }\r\n\t\tlua.pop(1);\r\n\t}\r\n\r\n\t// node にスプライン数、最大キー数を登録する\r\n\tm_pUINode->setParamCount(spline, max_key_count);\r\n\r\n\t// path-2: splineを登録する\r\n\tint spline_index = 0;\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\t// スタックのトップにメンバのテーブルが積まれている。\r\n\t\t// これは一つのターゲット分に相当する。\r\n\t\tresult &= setSplineAnimTarget(lua, -1, spline_index, max_key_count);\r\n\t\tspline_index++;\r\n\t\tlua.pop(1);\r\n\t}\r\n\tlua.pop(1);\r\n\r\n\tm_pUINode->generateAnimation();\r\n\r\n\treturn result;\r\n}\r\n\r\nint\r\nCKLBUITask::getSplineKeyCount(CLuaState& lua, int /*pos*/)\r\n{\r\n\tint count = 0;\r\n\r\n\tlua.retString(\"keys\");\r\n\tlua.tableGet();\r\n\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tcount++;\r\n\t\tlua.pop(1);\r\n\t}\r\n\tlua.pop(1);\r\n\treturn count;\r\n}\r\n\r\nbool\r\nCKLBUITask::setSplineAnimTarget(CLuaState& lua, int /*pos*/, int spline_index, int max_key_count)\r\n{\r\n\tbool result = true;\r\n\r\n\t// target を取得\r\n\tlua.retString(\"target\");\r\n\tlua.tableGet();\r\n\tu32 target = lua.getInt(-1);\r\n\tlua.pop(1);\r\n\r\n\t// ターゲットを設定\r\n\tm_pUINode->setTarget(spline_index, target);\r\n\r\n\t// 値のモードを取得。無ければ SPL_VALUE_INT と同じ動作。\r\n\tlua.retString(\"mode\");\r\n\tlua.tableGet();\r\n\tu32 mode = (lua.isNil(-1)) ? SPL_VALUE_INT : lua.getInt(-1);\r\n\tlua.pop(1);\r\n\r\n\t// spline のキーを登録する。\r\n\tlua.retString(\"keys\");\r\n\tlua.tableGet();\r\n\tfor(int i = 1; i <= max_key_count; i++) {\r\n\t\tlua.retInt(i);\t// 数値indexをスタックに積む\r\n\t\tlua.tableGet();\r\n\t\tif(lua.isNil(-1)) {\r\n\t\t\tlua.pop(1);\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// key テーブルの1要素となるテーブルがスタックトップにある\r\n\t\tlua.retInt(1);\r\n\t\tlua.tableGet();\r\n\t\tu32 v_time = lua.getInt(-1);\r\n\t\tlua.pop(1);\r\n\r\n\t\tlua.retInt(2);\r\n\t\tlua.tableGet();\r\n\t\tif(mode == SPL_VALUE_INT) {\r\n\t\t\ts16 value = lua.getInt(-1); \r\n\t\t\tm_pUINode->addKeys(spline_index, v_time, value);\r\n\t\t} else {\r\n\t\t\tdouble f_value = lua.getFloat(-1);\r\n\t\t\ts32 value = (s32)(f_value * 65536.0);\t// fixed\r\n\t\t\tm_pUINode->addKeysFixed(spline_index, v_time, value);\r\n\t\t}\r\n\t\tlua.pop(2);\r\n\t}\r\n\tlua.pop(1);\r\n\r\n\treturn result;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBUITask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUITask_h\r\n#define CKLBUITask_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n#include \"CKLBSplineNode.h\"\r\n\r\n#define\tUI_BASE_PROP \\\r\n\t{\t\"alpha\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUITask::setAlpha,\t\t(getBoolT)&CKLBUITask::getAlpha,\t\t0\t},\\\r\n\t{\t\"color\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUITask::setColor,\t\t(getBoolT)&CKLBUITask::getColor,\t\t0\t},\\\r\n\t{\t\"scaleX\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setScaleX,\t\t(getBoolT)&CKLBUITask::getScaleX,\t\t0\t},\\\r\n\t{\t\"scaleY\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setScaleY,\t\t(getBoolT)&CKLBUITask::getScaleY,\t\t0\t},\\\r\n\t{\t\"rot\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setRotation,\t\t(getBoolT)&CKLBUITask::getRotation,\t\t0\t},\\\r\n\t{\t\"x\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setX,\t\t\t(getBoolT)&CKLBUITask::getX,\t\t\t0\t},\\\r\n\t{\t\"y\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUITask::setY,\t\t\t(getBoolT)&CKLBUITask::getY,\t\t\t0\t},\\\r\n\t{\t\"visible\",\t\t\tBOOLEANT,\t(setBoolT)&CKLBUITask::setVisible,\t\t(getBoolT)&CKLBUITask::getVisible,\t\t0\t}\r\n\r\n#define UI_BASE_PROPCOUNT\t(8)\r\n\r\n/*!\r\n* \\class CKLBUITask\r\n* \\brief UI Task Class.\r\n* \r\n* CKLBUITask is the root class for every UI Task Classes in the Engine.\r\n* It defines some properties helpful for every subclasses (such as\r\n* alpha, color, scale, rotation, position, visibility).\r\n*\r\n* Each UITask is linked with a Node of the SceneGraph to be rendered.\r\n* Both objects point each other.\r\n*\r\n* You can also attach to a CKLBUITask some spline animations.\r\n*/\r\nclass CKLBUITask : public CKLBLuaPropTask\r\n{\r\nprotected:\r\n\tCKLBUITask(TASK_PHASE phase = P_UIPROC);\r\n\tvirtual ~CKLBUITask();\r\npublic:\r\n\tbool initScript\t\t(CLuaState& lua);\r\n\tvoid die\t\t\t();\r\n\tint  commandScript\t(CLuaState& lua);\r\n\tvirtual TASKTYPE getTaskType();\r\n\r\n\tinline CKLBNode * getNode() { return m_pUINode; }\r\n\r\n\tinline void setOtherParent(CKLBTask * pTask) { m_pRegParent = pTask; }\r\n\r\n\t// Generic Command: Common for all UI Tasks.\r\n\tenum {\r\n\t\tUI_GENERIC_BASE = 0x10000,\r\n\r\n\t\tUI_GENERIC_NODE_RECONNECT = UI_GENERIC_BASE,\r\n\t\tUI_GENERIC_SET_NAME,\r\n\t\tUI_GENERIC_ANIM_SET_SPLINE,\r\n\t\tUI_GENERIC_ANIM_PLAY,\r\n\t\tUI_GENERIC_ANIM_STOP,\r\n\t\tUI_GENERIC_IS_ANIM,\r\n\r\n\t\tUI_GENERIC_SET_COLOR,\r\n\t\tUI_GENERIC_SET_SCALE,\r\n\t\tUI_GENERIC_SET_ROT,\r\n\t\tUI_GENERIC_SET_VISIBLE,\r\n\r\n\t\tSPL_VALUE_INT = 0,\r\n\t\tSPL_VALUE_NUM = 1\r\n\t};\r\n\r\n\tinline\r\n\tbool getVisible()\t{ return m_visible; }\r\n\r\n\tinline virtual\r\n\tvoid setVisible(bool visible) {\r\n\t\tif(m_newScriptModel) {\r\n\t\t\tif(m_visible != visible) {\r\n\t\t\t\tm_visible = visible;\r\n\t\t\t\tm_pUINode->setVisible(visible);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tm_pUINode->setVisible(visible);\r\n\t\t\tsetGenBool(PRG_VISIBLE, visible);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void  setGenBool(int idx, bool val)\t{ setBool(idx + m_beginIndex, val);\t\t\t\t\t\t}\r\n\tinline void  setGenNum(int idx, float val)\t{ setNum(idx + m_beginIndex, val);\t\t\t\t\t\t}\r\n\tbool\t\t reconnect(const char* nodeName);\r\n\r\n\tinline void  setScaleX(float scale)\t\t{ m_pUINode->setScale(scale, m_pUINode->getScaleY());\t\t}\r\n\tinline float getScaleX()\t\t\t\t{ return m_pUINode->getScaleX();\t\t\t\t\t\t\t}\r\n\r\n\tinline void  setScaleY(float scale)\t\t{ m_pUINode->setScale(m_pUINode->getScaleX(), scale);\t\t}\r\n\tinline float getScaleY()\t\t\t\t{ return m_pUINode->getScaleY();\t\t\t\t\t\t\t}\r\n\r\n\tinline void  setX(float x)\t\t\t\t{ m_pUINode->setTranslate(x,m_pUINode->getTranslateY());\t}\r\n\tinline float getX()\t\t\t\t\t\t{ return m_pUINode->getTranslateX();\t\t\t\t\t\t}\r\n\r\n\tinline void  setY(float y)\t\t\t\t{ m_pUINode->setTranslate(m_pUINode->getTranslateX(),y);\t}\r\n\tinline float getY()\t\t\t\t\t\t{ return m_pUINode->getTranslateY();\t\t\t\t\t\t}\r\n\r\n\tinline void  setRotation(float rot)\t\t{ m_pUINode->setRotation(rot);\t\t\t\t\t\t\t\t}\r\n\tinline float getRotation()\t\t\t\t{ return m_pUINode->getRotation();\t\t\t\t\t\t\t}\r\n\r\n\tinline bool\tsetParamCount(u32 splineCount, u32 maxKeyCount) \r\n\t{ return m_pUINode->setParamCount(splineCount, maxKeyCount); }\r\n\r\n\tinline void setTarget(u32 splineIndex, u32 targetParameter) \r\n\t{ m_pUINode->setTarget(splineIndex,targetParameter); }\r\n\r\n\tinline void addKeys(u32 splineIndex, u32 time, s32 value) \r\n\t{ m_pUINode->addKeys(splineIndex, time, value); }\r\n\r\n\tinline void addKeysFixed(u32 splineIndex, u32 time, s32 fixed16Value) \r\n\t{ m_pUINode->addKeysFixed(splineIndex, time, fixed16Value); }\r\n\r\n\tinline void generateAnimation() \r\n\t{ m_pUINode->generateAnimation(); }\r\n\r\n\tvoid setColor(u32 color);\r\n\tu32  getColor();\r\n\tvoid setAlpha(u32 alpha);\r\n\tu32  getAlpha();\r\n\r\n\tinline void setArgb(u32 alpha, u32 color) {\r\n\t\tsetAlpha(alpha);\r\n\t\tsetColor(color);\r\n\t}\r\n\tinline void setArgb(u32 argb) {\r\n\t\tu32 color = argb & 0x00ffffff;\r\n\t\tu32 alpha = (argb >> 24) & 0xff;\r\n\t\tsetAlpha(alpha);\r\n\t\tsetColor(color);\r\n\t}\r\n\tinline u32  getArgb()\t\t\t\t\t{ return getAlpha()<<24 | getColor();\t}\r\n\r\n\tvirtual u32  getOrder()\t\t\t\t\t{ return 0;\t\t\t\t\t\t\t\t}\r\n\tvirtual void setOrder(u32 /*order*/)\t{ /* Do nothing */\t\t\t\t\t\t}\r\n\r\n\tinline bool isAnim()\t\t\t\t\t{ return m_pUINode->isAnimating();\t\t}\r\n\r\n\tinline void play()\t\t\t\t\t\t{ m_pUINode->play();\t\t\t\t\t}\r\n\tinline void stop()\t\t\t\t\t\t{ m_pUINode->stop();\t\t\t\t\t}\r\n\tinline void setInnerUpdate()\t\t\t{\tm_bInnerUpdate = true;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetUpdateFlag();\t\t\t\t\t}\r\n\r\nprotected:\r\n\tinline bool  getGenBool\t(int idx)\t\t{ return getBool(idx + m_beginIndex);\t}\r\n\tinline float getGenNum\t(int idx)\t\t{ return getNum(idx + m_beginIndex);\t}\r\n\tinline void  setInitPos\t(float x, float y) {\r\n\t\tm_initX = x;\r\n\t\tm_initY = y;\r\n\t}\r\n\tinline void  set_phase\t(TASK_PHASE phase = P_NORMAL) { m_phase = phase; }\r\n\tvirtual bool initUI\t\t(CLuaState& lua) = 0;\r\n\tvirtual int  commandUI\t(CLuaState& lua, int argc, int cmd);\r\n\tvirtual void execute\t(u32 deltaT) = 0;\r\n\tvirtual void dieUI\t\t() = 0;\r\n\r\n\tbool updateUIProperty();\r\n\r\n\tbool setupNode();\r\n\tbool registUI(CKLBUITask * pParent, bool result, CKLBTask * pRegParent = 0);\r\n\r\n\tenum {\r\n\t\tPRG_ALPHA,\r\n\t\tPRG_COLOR,\r\n\t\tPRG_SCALE_X,\r\n\t\tPRG_SCALE_Y,\r\n\t\tPRG_ROT,\r\n\t\tPRG_X,\r\n\t\tPRG_Y,\r\n\t\tPRG_VISIBLE,\r\n\t};\r\n\r\n\tCKLBSplineNode\t*\tm_pUINode;\r\nprivate:\r\n\tbool setGenericProperty\t();\r\n\tbool setSplineAnim\t\t(CLuaState& lua, int pos);\r\n\tint  getSplineKeyCount\t(CLuaState& lua, int pos);\r\n\tbool setSplineAnimTarget(CLuaState& lua, int pos, int spline_index, int max_key_count);\r\n\r\n\tTASK_PHASE\t\t\tm_phase;\r\n\r\n\r\n\tint\t\t\t\t\tm_beginIndex;\t// UI property start index\r\n\r\n\tfloat\t\t\t\tm_initX;\r\n\tfloat\t\t\t\tm_initY;\r\n\tu32\t\t\t\t\tm_color;\r\n\tu32\t\t\t\t\tm_alpha;\r\n\tbool\t\t\t\tm_visible;\r\n\r\n\tbool\t\t\t\tm_bInnerUpdate;\r\n\r\n\tCKLBTask\t\t*\tm_pRegParent;\r\n\r\n\tstatic const char\t*\tms_propList[];\r\n};\r\n\r\n#endif // CKLBUITask_h\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBUtility.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n#include \"CKLBWebViewNode.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include <string.h>\r\n\r\nvoid\r\nCKLBUtility::getNodePosition(CKLBNode * pNode, float * x, float * y)\r\n{\r\n\t*x = pNode->m_composedMatrix.m_matrix[ MAT_TX ];\r\n\t*y = pNode->m_composedMatrix.m_matrix[ MAT_TY ];\r\n}\r\n\r\nvoid\r\nCKLBUtility::getNodeInverseMatrix(CKLBNode* pNode, SMatrix2D& result) {\r\n\t/*\r\n\r\n\tdetA\t= ad - cb\r\n\r\n\tMatrix\r\n\tA' \t=  d / detA\r\n\tB' \t= -b / detA\r\n\tC' \t= -c / detA\r\n\tD' \t=  a / detA\r\n\tTX'\t= (b*ty - tx*d) / detA\r\n\tTY'\t= (tx*c - a*ty) / detA\r\n\r\n\t*/\r\n\r\n\tfloat* mat = pNode->m_composedMatrix.m_matrix;\r\n\tfloat invDetA = 1.0f / ((mat[MAT_A] * mat[MAT_D]) - (mat[MAT_C] * mat[MAT_B])); \r\n\r\n\tresult.m_matrix[MAT_A] =  mat[MAT_D] * invDetA;\r\n\tresult.m_matrix[MAT_B] =(-mat[MAT_B])* invDetA;\r\n\tresult.m_matrix[MAT_C] =(-mat[MAT_C])* invDetA;\r\n\tresult.m_matrix[MAT_D] =  mat[MAT_A] * invDetA;\r\n\r\n\tresult.m_matrix[MAT_TX] = ((mat[MAT_B]*mat[MAT_TY]) - (mat[MAT_D]*mat[MAT_TX])) * invDetA;\r\n\tresult.m_matrix[MAT_TY] = ((mat[MAT_C]*mat[MAT_TX]) - (mat[MAT_A]*mat[MAT_TY])) * invDetA;\r\n\r\n\tresult.m_type = MATRIX_TG;\r\n}\r\n\r\nvoid\r\nCKLBUtility::transform(SMatrix2D* pMatrix, float x, float y, float& resx, float& resy) {\r\n\tresx = (pMatrix->m_matrix[MAT_A] * x) + (pMatrix->m_matrix[MAT_B] * y) + pMatrix->m_matrix[MAT_TX];\r\n\tresy = (pMatrix->m_matrix[MAT_C] * x) + (pMatrix->m_matrix[MAT_D] * y) + pMatrix->m_matrix[MAT_TY];\r\n}\r\n\r\ns32 CKLBUtility::charCountUtf8(const char *s)\r\n{\r\n\t// Using this code, added null string support.\r\n\t// http://porg.es/blog/counting-characters-in-utf-8-strings-is-faster\r\n\t//\r\n\t// This one seems nicer\r\n\t// but didnt had time to make sure it is correct, as it is more complex\r\n\t// : http://www.daemonology.net/blog/2008-06-05-faster-utf8-strlen.html\r\n\t// Saved the gem in case the URL disappear.\r\n\t/**\r\n\t\t#define ONEMASK ((size_t)(-1) / 0xFF)\r\n\r\n\t\tstatic size_t\r\n\t\tcp_strlen_utf8(const char * _s)\r\n\t\t{\r\n\t\t\tconst char * s;\r\n\t\t\tsize_t count = 0;\r\n\t\t\tsize_t u;\r\n\t\t\tunsigned char b;\r\n\r\n\t\t\t// Handle any initial misaligned bytes.\r\n\t\t\tfor (s = _s; (uintptr_t)(s) & (sizeof(size_t) - 1); s++) {\r\n\t\t\t\tb = *s;\r\n\r\n\t\t\t\t// Exit if we hit a zero byte.\r\n\t\t\t\tif (b == '\\0')\r\n\t\t\t\t\tgoto done;\r\n\r\n\t\t\t\t// Is this byte NOT the first byte of a character?\r\n\t\t\t\tcount += (b >> 7) & ((~b) >> 6);\r\n\t\t\t}\r\n\r\n\t\t\t// Handle complete blocks.\r\n\t\t\tfor (; ; s += sizeof(size_t)) {\r\n\t\t\t\t// Prefetch 256 bytes ahead.\r\n\t\t\t\t// __builtin_prefetch(&s[256], 0, 0);\r\n\r\n\t\t\t\t// Grab 4 or 8 bytes of UTF-8 data.\r\n\t\t\t\tu = *(size_t *)(s);\r\n\r\n\t\t\t\t// Exit the loop if there are any zero bytes.\r\n\t\t\t\tif ((u - ONEMASK) & (~u) & (ONEMASK * 0x80))\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// Count bytes which are NOT the first byte of a character.\r\n\t\t\t\tu = ((u & (ONEMASK * 0x80)) >> 7) & ((~u) >> 6);\r\n\t\t\t\tcount += (u * ONEMASK) >> ((sizeof(size_t) - 1) * 8);\r\n\t\t\t}\r\n\r\n\t\t\t// Take care of any left-over bytes.\r\n\t\t\tfor (; ; s++) {\r\n\t\t\t\tb = *s;\r\n\r\n\t\t\t\t// Exit if we hit a zero byte.\r\n\t\t\t\tif (b == '\\0')\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// Is this byte NOT the first byte of a character?\r\n\t\t\t\tcount += (b >> 7) & ((~b) >> 6);\r\n\t\t\t}\r\n\r\n\t\tdone:\r\n\t\t\treturn ((s - _s) - count);\r\n\t\t}\r\n\t */\r\n\r\n\r\n    s32 count = 0;\r\n\tif (s) {\r\n\t\ts32 i = 0;\r\n\t\ts32 iBefore = 0;\r\n\r\n\t\twhile (s[i] > 0)\r\n\t\t\t\tascii:  i++;\r\n \r\n\t\tcount += i-iBefore;\r\n\t\twhile (s[i])\r\n\t\t{\r\n\t\t\t\tif (s[i] > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t\tiBefore = i;\r\n\t\t\t\t\t\tgoto ascii;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\tswitch (0xF0 & s[i])\r\n\t\t\t\t{\r\n\t\t\t\t\t\tcase 0xE0: i += 3; break;\r\n\t\t\t\t\t\tcase 0xF0: i += 4; break;\r\n\t\t\t\t\t\tdefault:   i += 2; break;\r\n\t\t\t\t}\r\n\t\t\t\t++count;\r\n\t\t}\r\n\t}\r\n    return count;\r\n}\r\n\r\nu32 \r\nCKLBUtility::nearest2Pow(u32 v) {\r\n    v--;\r\n    v |= v >> 1;\r\n    v |= v >> 2;\r\n    v |= v >> 4;\r\n    v |= v >> 8;\r\n    v |= v >> 16;\r\n    v++;\r\n    return v;\r\n}\r\n\r\nint\r\nCKLBUtility::safe_strcmp(const char* a, const char* b) \r\n{\r\n\t// Same string, same null : OK\r\n\tif (a == b) {\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tif (a && b) {\r\n\t\t// Both valid pointer\r\n\t\treturn strcmp(a,b);\r\n\t} else {\r\n\t\t// One of the pointer is null.\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\nconst char *\r\nCKLBUtility::copyString(const char * string)\r\n{\r\n\tklb_assert(string, \"copy string is NULL.\");\r\n\tchar * buf = KLBNEWA(char, strlen(string) + 1);\r\n    if(!buf) { return NULL; }\r\n\tstrcpy(buf, string);\r\n\treturn (const char *)buf;\r\n}\r\n\r\nconst char *\r\nCKLBUtility::copyMem(const char * src, u32 size)\r\n{\r\n\tchar * buf = KLBNEWA(char, size);\r\n    if(!buf) { return NULL; }\r\n\tmemcpy(buf, src, size);\r\n\treturn (const char *)buf;\r\n}\r\n\r\nchar *\r\nCKLBUtility::numString64(char * buf, u64 value)\r\n{\r\n\tu64 v = 1000000000000000000ULL;\r\n\tchar * ptr = buf;\r\n\twhile(v > 0) {\r\n\t\tint num = value / v;\r\n\t\tvalue = value % v;\r\n\t\tv = v / 10LL;\r\n\t\tif(num || ptr > buf) *ptr++ = num + '0';\r\n\t}\r\n\tif(ptr == buf) *ptr++ = '0';\r\n\t*ptr = 0;\r\n\treturn buf;\r\n}\r\n\r\ns64\r\nCKLBUtility::stringNum64(const char * string)\r\n{\r\n\ts64 sign = 1;\r\n\ts64 val = 0;\r\n\tconst char * p = string;\r\n\twhile(*p) {\r\n\t\tif(p == string && *p == '-') {\r\n\t\t\tsign = -1;\r\n\t\t\tp++;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tval = val * 10LL;\r\n\t\tval += *p - '0';\r\n\t\tp++;\r\n\t}\r\n\tval = val * sign;\r\n\treturn val;\r\n}\r\n\r\nchar *\r\nCKLBUtility::quoated(const char * string)\r\n{\r\n\tint size = (!string) ? 5 : (strlen(string) + 3);\r\n\tchar * buf = KLBNEWA(char, size);\r\n    if(!buf) { return NULL; }\r\n\tif(!string) {\r\n\t\tstrcpy(buf, \"null\");\r\n\t} else {\r\n\t\tsprintf(buf, \"\\\"%s\\\"\", string);\r\n\t}\r\n\treturn buf;\r\n}\r\n\r\n\r\nconst char **\r\nCKLBUtility::splitString(const char * string, int delim)\r\n{\r\n\t// pass-1: delim で分割される総数を得る\r\n\tint cnt = 1;\r\n\tfor(const char * ptr = string; *ptr; ptr++) {\r\n\t\tif(*ptr == delim) cnt++;\r\n\t}\r\n\r\n\t// 外枠の配列生成\r\n\tconst char ** arr = KLBNEWA(const char *, cnt + 1);\r\n\tarr[cnt] = 0;\t// 終端は NULL\r\n\r\n\tconst char * ptr = string;\r\n\tfor(int i = 0; i < cnt; i++) {\r\n\t\tint len = 0;\r\n        while(ptr[len] && ptr[len] != delim) { len++; }\r\n\t\tchar * buf = KLBNEWA(char, len + 1);\r\n\t\tstrncpy(buf, ptr, len);\r\n\t\tbuf[len] = 0;\r\n\t\tarr[i] = (const char *)buf;\r\n\t\tptr += len;\r\n\t\tif(*ptr == delim) ptr++;\r\n\t}\r\n\r\n\treturn arr;\r\n}\r\n\r\nvoid\r\nCKLBUtility::deleteSplitString(const char ** split_arr)\r\n{\r\n\tfor(int i = 0; split_arr[i]; i++) {\r\n\t\tconst char * str = split_arr[i];\r\n\t\tKLBDELETEA(str);\r\n\t}\r\n\tKLBDELETEA(split_arr);\r\n}\r\n\r\nCKLBAsset *\r\nCKLBUtility::loadAssetScript(const char * asset, u32 * handle, IKLBAssetPlugin* plugIn, bool bSimple)\r\n{\r\n\tCKLBAsset * pAsset = loadAsset(asset, handle, plugIn, bSimple);\r\n\tif(!pAsset) {\r\n\t\tCKLBScriptEnv::getInstance().error(\"could not load asset: %s\", asset);\r\n\t}\r\n\treturn pAsset;\r\n}\r\n\r\nCKLBAsset *\r\nCKLBUtility::readAsset(u8 * stream, u32 streamSize, u32 * handle, IKLBAssetPlugin * plugIn)\r\n{\r\n\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\tCKLBAsset * pAsset;\r\n\tbool bResult = pAssetManager.loadAsset(stream, streamSize, (CKLBAbstractAsset **)&pAsset, plugIn);\r\n    if(!bResult || !pAsset) { return NULL; }\r\n\r\n\t*handle = CKLBDataHandler::allocateHandle(pAsset);\r\n\treturn pAsset;\r\n}\r\n\r\nCKLBAsset *\r\nCKLBUtility::loadAsset(const char * asset, u32 * handle, IKLBAssetPlugin* plugIn, bool bSimple)\r\n{\r\n\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\t// CPFInterface& pfif = CPFInterface::getInstance();\r\n\tCKLBAsset * pAsset;\r\n\r\n\tpAsset = (CKLBAsset *)pAssetManager.loadAssetByFileName(asset, plugIn);\r\n\r\n\tif(!pAsset) {\r\n\t\treturn NULL;\r\n\t}\r\n\tif (handle) {\r\n\t\t*handle = CKLBDataHandler::allocateHandle(pAsset);\r\n\t}\r\n\r\n\t// bSimple が true のときは、texture であっても image の取得を行わない。\r\n\t// あくまで texture のみを必要とするケースもある。\r\n\tif(!bSimple && (pAsset->getAssetType() == ASSET_TEXTURE)) {\r\n\t\t// 画像asset名を与えると、帰ってくるのは texture asset であるため、\r\n\t\t// 改めてその中から画像 asset を取得する処理が必要となる。\r\n\r\n\t\t// 直接引数で与えられるasset名は、asset://foo.bar や file://install/foo.bar のように、\r\n\t\t// scheme がついているため、scheme に相当する部分を除去した名称(パス含む)を使用する。\r\n\t\tconst char * scheme_pattern[] = {\r\n\t\t\t\"file://install/\",\r\n\t\t\t\"file://external/\",\r\n\t\t\t\"asset://\",\r\n\t\t\t0\r\n\t\t};\r\n\t\tconst char * name = NULL;\r\n\t\tfor(int i = 0; scheme_pattern[i]; i++) {\r\n\t\t\tconst char * pattern = scheme_pattern[i];\r\n\t\t\tint len = strlen(pattern);\r\n\t\t\tif(!strncmp(asset, pattern, len)) {\r\n\t\t\t\tname = asset + len;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!name) {\r\n\t\t\tif (handle) { CKLBDataHandler::releaseHandle(*handle); }\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tpAsset = ((CKLBTextureAsset*)pAsset)->getImage(name);\r\n\t\tif(!pAsset) {\r\n\t\t\tif (handle) { CKLBDataHandler::releaseHandle(*handle); }\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n\treturn pAsset;\r\n}\r\n\r\nCKLBNode *\r\nCKLBUtility::createNode(const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn)\r\n{\r\n\tCKLBAsset * pAsset = loadAsset(asset, handle, plugIn);\r\n    if(!pAsset) { return NULL; }\r\n\tCKLBNode * pNode = pAsset->createSubTree(order);\r\n\treturn pNode;\r\n}\r\n\r\nCKLBNode *\r\nCKLBUtility::createNodeScript(const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn)\r\n{\r\n\tCKLBAsset * pAsset = loadAssetScript(asset, handle, plugIn);\r\n\tif(!pAsset) { return NULL; }\r\n\tCKLBNode * pNode = pAsset->createSubTree(order);\r\n\tif(!pNode) {\r\n\t\tCKLBScriptEnv::getInstance().error(\"Node create failed. [asset: %s ]\", asset);\r\n\t}\r\n\treturn pNode;\r\n}\r\n\r\nCKLBNode *\r\nCKLBUtility::createCompositeNodeScript(CKLBUITask * pTask, const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn)\r\n{\r\n\tCKLBAsset * pAsset = loadAssetScript(asset, handle, plugIn);\r\n\tif(!pAsset) { return NULL; }\r\n\tCKLBNode * pNode = ((CKLBCompositeAsset *)pAsset)->createSubTree(pTask, order);\r\n\r\n\tif(!pNode) {\r\n\t\tCKLBScriptEnv::getInstance().error(\"Node create failed. [asset: %s ]\", asset);\r\n\t}\r\n\treturn pNode;\r\n}\r\n\r\n\r\nvoid\r\nCKLBUtility::deleteNode(CKLBNode * pNode, u32 handle)\r\n{\r\n\tKLBDELETE(pNode);\r\n\tCKLBDataHandler::releaseHandle(handle);\r\n}\r\n\r\nconst char *\r\nCKLBUtility::lua2json(CLuaState&lua, u32& streamSize, JSON_REPLACE * arrReplace)\r\n{\r\n\tJSON_BUF jsonBuf;\t// 1 KB on stack.\r\n\tjsonBuf.max = JSON_BLOCK_SIZE;\r\n\tjsonBuf.buf = KLBNEWA(char, jsonBuf.max);\r\n\tif(!jsonBuf.buf) { return NULL; }\r\n\tjsonBuf.idx\t\t\t= 0;\r\n\tjsonBuf.poolCount\t= 0;\r\n\tjsonBuf.poolSize\t= 0;\r\n\tjsonBuf.arr_replace = arrReplace;\r\n\r\n\tbool bResult = lua2json_rec(lua, &jsonBuf);\r\n\tif(!bResult) {\r\n\t\tKLBDELETEA(jsonBuf.buf);\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\t// End of string.\r\n\tstreamSize = jsonBuf.idx;\r\n\treturn (const char *)jsonBuf.buf;\r\n}\r\n\r\nconst char *\r\nCKLBUtility::escape(const char * string)\r\n{\r\n\tint len = strlen(string);\r\n\tchar * buf = KLBNEWA(char, len * 2 + 1);\r\n\tchar * ptr = buf;\r\n\tfor(int i = 0; string[i]; i++) {\r\n\t\tswitch(string[i])\r\n\t\t{\r\n\t\tdefault:\r\n\t\t\t*ptr++ = string[i];\r\n\t\t\tbreak;\r\n\t\tcase '\"':\r\n\t\tcase '\\\\':\r\n\t\tcase '/':\r\n\t\t\t*ptr++ = '\\\\';\r\n\t\t\t*ptr++ = string[i];\r\n\t\t\tbreak;\r\n\t\tcase '\\t':\r\n\t\t\t*ptr++ = '\\\\';\r\n\t\t\t*ptr++ = 't';\r\n\t\t\tbreak;\r\n\t\tcase '\\n':\r\n\t\t\t*ptr++ = '\\\\';\r\n\t\t\t*ptr++ = 'n';\r\n\t\t\tbreak;\r\n\t\tcase '\\r':\r\n\t\t\t*ptr++ = '\\\\';\r\n\t\t\t*ptr++ = 'r';\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t*ptr = 0;\r\n\treturn (const char *)buf;\r\n}\r\n\r\nbool\r\nCKLBUtility::JSON_BUF::add(const char * msg)\r\n{\r\n\tint len = strlen(msg);\r\n\r\n\t// 現在のバッファが足りないなら、足りるようになるまで追加する\r\n\t\r\n\twhile(idx + len >= max) {\r\n\t\tint size = max + (JSON_BLOCK_SIZE*2);\r\n\t\tchar * n_buf = KLBNEWA(char, size);\r\n        if(!n_buf) { return false; }\r\n\t\tmemcpy(n_buf, buf, idx);\r\n\t\tKLBDELETEA(buf);\r\n\t\tbuf = n_buf;\r\n\t\tmax = size;\r\n\t}\r\n\tstrcpy(buf + idx, msg);\r\n\tidx += len;\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUtility::JSON_BUF::addU8(u8 byte)\r\n{\r\n\t// 現在のバッファが足りないなら、足りるようになるまで追加する\r\n\twhile(idx + 1 >= max) {\r\n\t\tint size = max + (JSON_BLOCK_SIZE*2);\r\n\t\tchar * n_buf = KLBNEWA(char, size);\r\n        if(!n_buf) { return false; }\r\n\t\tmemcpy(n_buf, buf, idx);\r\n\t\tKLBDELETEA(buf);\r\n\t\tbuf = n_buf;\r\n\t\tmax = size;\r\n\t}\r\n\tbuf[idx++] = byte;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUtility::JSON_BUF::addPool(const char* str, int& idx) \r\n{\r\n\tint strL = strlen(str);\r\n\tu32 cnt = 0;\r\n\twhile (cnt < poolCount) {\r\n\t\tif (poolEntries[cnt].size == strL) {\r\n\t\t\tif (strcmp(str,poolEntries[cnt].string) == 0) {\r\n\t\t\t\tidx = cnt;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcnt++;\r\n\t}\r\n\r\n\t// Add new entry.\r\n\tpoolEntries[poolCount].size = strL;\r\n\tpoolEntries[poolCount].string = str;\r\n\tidx = poolCount++;\r\n\tklb_assert(poolCount < 100, \"Max Reached\");\r\n\tpoolSize += strL;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUtility::JSON_BUF::addU32(u32 value) \r\n{\r\n\t// 現在のバッファが足りないなら、足りるようになるまで追加する\r\n\twhile(idx + 4 >= max) {\r\n\t\tint size = max + (JSON_BLOCK_SIZE*2);\r\n\t\tchar * n_buf = KLBNEWA(char, size);\r\n        if(!n_buf) { return false; }\r\n\t\tmemcpy(n_buf, buf, idx);\r\n\t\tKLBDELETEA(buf);\r\n\t\tbuf = n_buf;\r\n\t\tmax = size;\r\n\t}\r\n\r\n\tbuf[idx++] = (value >> 24);\r\n\tbuf[idx++] = (value >> 16);\r\n\tbuf[idx++] = (value >> 8 );\r\n\tbuf[idx++] = (value      );\r\n\treturn true;\r\n}\r\n\r\n#include \"../../libs/JSonParser/api/yajl_parse.h\"\r\n\r\nconst char *\r\nCKLBUtility::lua2BJson(CLuaState&lua, u32& streamSize, JSON_REPLACE * arrReplace)\r\n{\r\n\tJSON_BUF jsonBuf;\t// 1 KB on stack.\r\n\tjsonBuf.max = JSON_BLOCK_SIZE * 2;\r\n\tjsonBuf.buf = KLBNEWA(char, jsonBuf.max);\r\n    if(!jsonBuf.buf) { return NULL; }\r\n\tjsonBuf.idx\t\t\t= 0;\r\n\tjsonBuf.poolCount\t= 0;\r\n\tjsonBuf.poolSize\t= 0;\r\n\tjsonBuf.arr_replace = arrReplace;\r\n\r\n\tbool bResult = lua2BJson_rec(lua, &jsonBuf);\r\n\tbResult = jsonBuf.addU8(BJSN_END) && bResult;\r\n\tif(!bResult) {\r\n\t\tKLBDELETEA(jsonBuf.buf);\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tu32 headerAndCP = (2 + 4 + 4 + (4 * jsonBuf.poolCount) + jsonBuf.poolSize); // Pool size include size with zero.\r\n\tu8* block = KLBNEWA(u8, jsonBuf.idx + headerAndCP);\r\n\tif (block) {\r\n\t\tmemcpy(&block[headerAndCP],jsonBuf.buf,jsonBuf.idx);\r\n\r\n\t\t// Header\r\n\t\tblock[0] = 0xFF;\r\n\t\tblock[1] = 0xFF;\r\n\r\n\t\t// Count\r\n\t\tblock[2] = jsonBuf.poolCount >> 24;\r\n\t\tblock[3] = jsonBuf.poolCount >> 16;\r\n\t\tblock[4] = jsonBuf.poolCount >>  8;\r\n\t\tblock[5] = jsonBuf.poolCount;\r\n\r\n\t\t// String Buf Size\r\n\t\tblock[6] = jsonBuf.poolSize >> 24;\r\n\t\tblock[7] = jsonBuf.poolSize >> 16;\r\n\t\tblock[8] = jsonBuf.poolSize >>  8;\r\n\t\tblock[9] = jsonBuf.poolSize;\r\n\r\n\t\tu8* wrt = &block[10];\r\n\t\tfor (u32 n=0; n < jsonBuf.poolCount; n++) {\r\n\t\t\t// Size\r\n\t\t\tu32 size = jsonBuf.poolEntries[n].size;\r\n\t\t\twrt[0] = size >> 24;\r\n\t\t\twrt[1] = size >> 16;\r\n\t\t\twrt[2] = size >>  8;\r\n\t\t\twrt[3] = size;\r\n\r\n\t\t\tmemcpy(&wrt[4], jsonBuf.poolEntries[n].string, size);\r\n\t\t\twrt += size + 4;\r\n\t\t}\r\n\r\n\t\tKLBDELETEA(jsonBuf.buf);\r\n\t} else {\r\n\t\tKLBDELETEA(jsonBuf.buf);\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\tjsonBuf.buf = (char*)block;\r\n\tjsonBuf.idx += headerAndCP;\r\n\r\n\t// End of BJson stream.\r\n\tstreamSize = jsonBuf.idx;\r\n\treturn (const char *)jsonBuf.buf;\r\n}\r\n\r\n/*static*/\r\nbool\r\nCKLBUtility::lua2BJson_rec(CLuaState& lua, JSON_BUF * jsonBuf)\r\n{\r\n\tswitch(lua.getType(-1))\r\n\t{\r\n\tdefault:\r\n\t\treturn false;\r\n\t\tbreak;\r\n\tcase LUA_TNIL:\r\n\t\t{\r\n\t\t\treturn jsonBuf->addU8(BJSN_CTE_NULL);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TLIGHTUSERDATA:\r\n\t\t{\r\n\t\t\tconst void * p = lua.getPointer(-1);\r\n\t\t\tif(!p) {\r\n\t\t\t\treturn jsonBuf->addU8(BJSN_CTE_NULL);\r\n\t\t\t} \r\n\t\t\tchar buf[64];\r\n\t\t\tsprintf(buf, \"%p\", p);\r\n\t\t\tbool bResult  = jsonBuf->addU8(BJSN_STRING_DIRECT);\r\n\t\t\tbResult = bResult && jsonBuf->addU32(strlen(buf));\r\n\t\t\tbResult = bResult && jsonBuf->add(buf);\r\n\t\t\treturn bResult;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TNUMBER:\r\n\t\t{\r\n\t\t\tchar buf[64];\r\n\t\t\t// 整数か実数か判定\r\n\t\t\tint num_i = lua.getInt(-1);\r\n\t\t\tdouble num_f = lua.getDouble(-1);\r\n\r\n\t\t\tdouble sub = fabs((double)num_i - num_f);\r\n\t\t\tbool result;\r\n\t\t\tif(sub < 0.00001) {\t// 整数扱い\r\n\t\t\t\tsprintf(buf, \"%d\", num_i);\r\n\t\t\t\tresult  = jsonBuf->addU8(BJSN_NUMBER_I32);\r\n\t\t\t\tresult &= jsonBuf->addU32(num_i);\r\n\t\t\t} else {\t\t\t\t\t// 実数扱い\r\n\t\t\t\tsprintf(buf, \"%f\", (float)num_f);\r\n\t\t\t\tfloat f = (float)num_f;\r\n\t\t\t\tint* pI = (int*)&f;\r\n\t\t\t\tresult  = jsonBuf->addU8(BJSN_NUMBER_FLT);\r\n\t\t\t\tresult &= jsonBuf->addU32(*pI);\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TBOOLEAN:\r\n\t\t{\r\n\t\t\tbool b = lua.getBool(-1);\r\n\t\t\treturn jsonBuf->addU8((b) ? BJSN_CTE_TRUE:BJSN_CTE_FALSE);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TSTRING:\r\n\t\t{\r\n\t\t\tconst char * string = lua.getString(-1);\r\n\t\t\t//\r\n\t\t\t// DO NOT ESCAPE ENCODE THE STRING in BJSON !\r\n\t\t\t// --> Encode is made only inside std Json because Json itself is a string.\r\n\t\t\t// const char * escape_string = escape(string);\r\n\t\t\t//\r\n\t\t\t// int len = 0;\r\n\t\t\tbool bResult;\r\n\t\t\tbResult = jsonBuf->addU8(BJSN_STRING_DIRECT);\r\n\t\t\tbResult = bResult && jsonBuf->addU32(strlen(string));\r\n\t\t\tbResult = bResult && jsonBuf->add(string);\r\n\t\t\treturn bResult;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TTABLE:\r\n\t\t{\r\n\t\t\t// Lua table は JSON的に2種類の使用方法(map/array)があるため、\r\n\t\t\t// PASS-1: 登場した table がどちらの扱いになるかを確認する\r\n\t\t\t// PASS-2: 判定結果の方法で巡回する\r\n\r\n\t\t\t// PASS-1: 文字列index付きの値があるか確認する\r\n\r\n\t\t\tint min, max;\r\n\t\t\tbool bMap = false;\r\n\t\t\tmin = -1;\r\n\t\t\tmax = 0;\r\n\t\t\tbool bArrResult = true;\r\n\r\n\t\t\tlua.retNil();\r\n\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\tlua.retValue(-2);\r\n\r\n\t\t\t\t// この段階で、(-1) = index, (-2) = 値\r\n\r\n\t\t\t\t// 数値index配列の場合は array 扱い\r\n\t\t\t\tif(lua.isNum(-1)) {\r\n\t\t\t\t\tint idx = lua.getInt(-1);\r\n                    if(min < 0 || idx < min) { min = idx; }\r\n                    if(max < idx)            { max = idx; }\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbMap = true;\r\n\t\t\t\t}\r\n\t\t\t\tlua.pop(2);\r\n\t\t\t\tif(bMap) {\r\n\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t\tbreak;\t// 結果が出たので PASS-2 へ\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// PASS-2: bMap の値によって、この配列をmapまたはarrayとして取り扱う。\r\n\t\t\tif(bMap) {\r\n\t\t\t\t// Map として扱う\r\n\t\t\t\tbArrResult = jsonBuf->addU8(BJSN_OPEN_OBJ);\r\n\t\t\t\tbArrResult = jsonBuf->addU32(0xFFFFFFFF) && bArrResult;\r\n\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\t\t// キーを出力\r\n\t\t\t\t\tlua.retValue(-2);\r\n\r\n\t\t\t\t\t// IT/KEY/VAL/KEYCOPY\r\n\t\t\t\t\tconst char * key = lua.getString(-1);\r\n\t\t\t\t\tbArrResult = jsonBuf->addU8(BJSN_MEMBER) && bArrResult;\r\n\t\t\t\t\tint idx;\r\n\t\t\t\t\tbArrResult = jsonBuf->addPool(key, idx) && bArrResult;\r\n\t\t\t\t\tbArrResult = jsonBuf->addU32(idx) && bArrResult;\r\n\r\n\t\t\t\t\tlua.pop(1);\r\n\r\n\t\t\t\t\t// 実際の Luaテーブル値を値として出力する前に、\r\n\t\t\t\t\t// JSON_REPLACEの配列を確認し、値を置き換えるべきキーは\r\n\t\t\t\t\t// 指定された値で置き換える。\r\n\t\t\t\t\tbool bReplaced = false;\r\n\t\t\t\t\tif(jsonBuf->arr_replace) {\r\n\t\t\t\t\t\tfor(int i = 0; jsonBuf->arr_replace[i].key; i++) {\r\n\t\t\t\t\t\t\tif(!strcmp(key, jsonBuf->arr_replace[i].key)) {\r\n\t\t\t\t\t\t\t\tbArrResult = jsonBuf->add(jsonBuf->arr_replace[i].value) && bArrResult;\r\n\r\n\t\t\t\t\t\t\t\tbArrResult  = jsonBuf->addU8(BJSN_STRING_DIRECT);\r\n\t\t\t\t\t\t\t\tbArrResult &= jsonBuf->addU32(strlen(jsonBuf->arr_replace[i].value));\r\n\t\t\t\t\t\t\t\tbArrResult &= jsonBuf->add(jsonBuf->arr_replace[i].value);\r\n\r\n\t\t\t\t\t\t\t\tbReplaced = true;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(!bReplaced) {\r\n\t\t\t\t\t\t// 値を出力する\r\n\t\t\t\t\t\tbArrResult = lua2BJson_rec(lua, jsonBuf) && bArrResult;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t}\r\n//\t\t\t\tlua.pop(1);\t// 巡回用indexを取り除く\r\n\r\n\t\t\t\tbArrResult = jsonBuf->addU8(BJSN_CLOSE_OBJ) && bArrResult;\r\n\r\n\t\t\t} else {\r\n\t\t\t\t// Array の扱い\r\n\t\t\t\t// lua.tableNext() による巡回はindexの順が保障されないので、\r\n\t\t\t\t// 取得した min ～ max にかけて値を取得し、出力する。\r\n\r\n\t\t\t\tbArrResult  = jsonBuf->addU8(BJSN_OPEN_ARR) && bArrResult;\r\n\t\t\t\tbArrResult &= jsonBuf->addU32(0xFFFFFFFF);\r\n\t\t\t\tbArrResult &= jsonBuf->addU32(0xFFFFFFFF); // Mask\r\n\r\n\t\t\t\tif(min != -1 || max) {\r\n\t\t\t\t\tfor(int i = min; i <= max; i++) {\r\n\t\t\t\t\t\tlua.retInt(i);\r\n\t\r\n\t\t\t\t\t\tlua.tableGet();\r\n\t\t\r\n\t\t\t\t\t\t// 値を出力する\r\n\t\t\t\t\t\tbArrResult = lua2BJson_rec(lua, jsonBuf) && bArrResult;\r\n\r\n\t\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbArrResult = jsonBuf->addU8(BJSN_CLOSE_ARR) && bArrResult;\r\n\t\t\t}\r\n\t\t\treturn bArrResult;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\t//return false;\t// Dead code.\r\n}\r\n\r\nbool\r\nCKLBUtility::lua2json_rec(CLuaState& lua, JSON_BUF * jsonBuf)\r\n{\r\n\tswitch(lua.getType(-1))\r\n\t{\r\n\tdefault:\r\n\t\treturn false;\r\n\t\tbreak;\r\n\tcase LUA_TNIL:\r\n\t\t{\r\n\t\t\tconst char * msg = \"null\";\r\n\t\t\treturn jsonBuf->add(msg);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TLIGHTUSERDATA:\r\n\t\t{\r\n\t\t\tconst void * p = lua.getPointer(-1);\r\n\t\t\tif(!p) {\r\n\t\t\t\tconst char * msg = \"null\";\r\n\t\t\t\treturn jsonBuf->add(msg);\r\n\t\t\t} \r\n\t\t\tchar buf[64];\r\n\t\t\tsprintf(buf, \"%p\", p);\r\n\t\t\treturn jsonBuf->add(buf);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TNUMBER:\r\n\t\t{\r\n\t\t\tchar buf[64];\r\n\t\t\t// 整数か実数か判定\r\n\t\t\tint     num_i   = lua.getInt(-1);\r\n\t\t\tdouble  num_f   = lua.getDouble(-1);\r\n\t\t\tdouble  sub     = fabs((double)num_i - num_f);\r\n\t\t\tif(sub < 0.00001) {\t// 整数扱い\r\n\t\t\t\tsprintf(buf, \"%d\", num_i);\r\n\t\t\t} else {\t\t\t\t\t// 実数扱い\r\n\t\t\t\tsprintf(buf, \"%f\", (float)num_f);\r\n\t\t\t}\r\n\t\t\treturn jsonBuf->add(buf);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TBOOLEAN:\r\n\t\t{\r\n\t\t\tbool b = lua.getBool(-1);\r\n\t\t\treturn jsonBuf->add((b) ? \"true\":\"false\");\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TSTRING:\r\n\t\t{\r\n\t\t\tconst char * string = lua.getString(-1);\r\n\t\t\tbool bResult = jsonBuf->add(\"\\\"\");\r\n\t\t\tconst char * escape_string = escape(string);\r\n\t\t\tbResult = jsonBuf->add(escape_string) && bResult;\r\n\t\t\tKLBDELETEA(escape_string);\r\n\t\t\treturn  jsonBuf->add(\"\\\"\") && bResult;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LUA_TTABLE:\r\n\t\t{\r\n\t\t\t// Lua table は JSON的に2種類の使用方法(map/array)があるため、\r\n\t\t\t// PASS-1: 登場した table がどちらの扱いになるかを確認する\r\n\t\t\t// PASS-2: 判定結果の方法で巡回する\r\n\r\n\t\t\t// PASS-1: 文字列index付きの値があるか確認する\r\n\r\n\t\t\tint min, max;\r\n\t\t\tbool bMap = false;\r\n\t\t\tmin = -1;\r\n\t\t\tmax = 0;\r\n\t\t\tbool bArrResult = true;\r\n\r\n\t\t\tlua.retNil();\r\n\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\tlua.retValue(-2);\r\n\r\n\t\t\t\t// この段階で、(-1) = index, (-2) = 値\r\n\r\n\t\t\t\t// 数値index配列の場合は array 扱い\r\n\t\t\t\tif(lua.isNum(-1)) {\r\n\t\t\t\t\tint idx = lua.getInt(-1);\r\n                    if(min < 0 || idx < min) { min = idx; }\r\n                    if(max < idx)            { max = idx; }\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbMap = true;\r\n\t\t\t\t}\r\n\t\t\t\tlua.pop(2);\r\n\t\t\t\tif(bMap) {\r\n\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t\tbreak;\t// 結果が出たので PASS-2 へ\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// PASS-2: bMap の値によって、この配列をmapまたはarrayとして取り扱う。\r\n\t\t\tif(bMap) {\r\n\t\t\t\t// Map として扱う\r\n\t\t\t\tjsonBuf->add(\"{\");\r\n\r\n\t\t\t\tbool bFirst = false;\r\n\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\twhile(lua.tableNext()) {\r\n\r\n\t\t\t\t\t// 2番目以降の項目であれば、前の値との区切りとして ','を入れる\r\n\t\t\t\t\tif(bFirst) {\r\n\t\t\t\t\t\tbArrResult = jsonBuf->add(\",\") && bArrResult;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbFirst = true;\r\n\r\n\t\t\t\t\t// キーを出力\r\n\t\t\t\t\tlua.retValue(-2);\r\n\r\n\t\t\t\t\t// IT/KEY/VAL/KEYCOPY\r\n\t\t\t\t\tconst char * key = lua.getString(-1);\r\n\t\t\t\t\tbArrResult = jsonBuf->add(\"\\\"\") && bArrResult;\r\n\t\t\t\t\tbArrResult = jsonBuf->add(key) && bArrResult;\r\n\t\t\t\t\tbArrResult = jsonBuf->add(\"\\\":\") && bArrResult;\r\n\r\n\t\t\t\t\tlua.pop(1);\r\n\r\n\t\t\t\t\t// 実際の Luaテーブル値を値として出力する前に、\r\n\t\t\t\t\t// JSON_REPLACEの配列を確認し、値を置き換えるべきキーは\r\n\t\t\t\t\t// 指定された値で置き換える。\r\n\t\t\t\t\tbool bReplaced = false;\r\n\t\t\t\t\tif(jsonBuf->arr_replace) {\r\n\t\t\t\t\t\tfor(int i = 0; jsonBuf->arr_replace[i].key; i++) {\r\n\t\t\t\t\t\t\tif(!strcmp(key, jsonBuf->arr_replace[i].key)) {\r\n\t\t\t\t\t\t\t\tbArrResult = jsonBuf->add(jsonBuf->arr_replace[i].value) && bArrResult;\r\n\t\t\t\t\t\t\t\tbReplaced = true;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(!bReplaced) {\r\n\t\t\t\t\t\t// 値を出力する\r\n\t\t\t\t\t\tbArrResult = lua2json_rec(lua, jsonBuf) && bArrResult;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t}\r\n//\t\t\t\tlua.pop(1);\t// 巡回用indexを取り除く\r\n\r\n\t\t\t\tbArrResult = jsonBuf->add(\"}\") && bArrResult;\r\n\r\n\t\t\t} else {\r\n\t\t\t\t// Array の扱い\r\n\t\t\t\t// lua.tableNext() による巡回はindexの順が保障されないので、\r\n\t\t\t\t// 取得した min ～ max にかけて値を取得し、出力する。\r\n\r\n\t\t\t\tbArrResult = jsonBuf->add(\"[\") && bArrResult;\r\n\r\n\t\t\t\tbool bFirst = false;\r\n\t\t\t\t\r\n\t\t\t\tif(min != -1 || max) {\r\n\t\t\t\t\tfor(int i = min; i <= max; i++) {\r\n\t\t\t\t\t\tlua.retInt(i);\r\n\t\r\n\t\t\t\t\t\t// 2番目以降の項目であれば、前の値との区切りとして ','を入れる\r\n\t\t\t\t\t\tif(bFirst) jsonBuf->add(\",\");\r\n\t\t\t\t\t\tbFirst = true;\r\n\r\n\t\t\t\t\t\tlua.tableGet();\r\n\t\t\r\n\t\t\t\t\t\t// 値を出力する\r\n\t\t\t\t\t\tbArrResult = lua2json_rec(lua, jsonBuf) && bArrResult;\r\n\r\n\t\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbArrResult = jsonBuf->add(\"]\") && bArrResult;\r\n\t\t\t}\r\n\t\t\treturn bArrResult;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\t//return false; // Dead code\r\n}\r\n\r\n// JSON文字列をLuaテーブルに変換し、Luaスタックに積む\r\nvoid\r\nCKLBUtility::json2lua(CLuaState& lua, const char * json, u32 json_size)\r\n{\r\n\tCKLBJsonItem * pRoot = CKLBJsonItem::ReadJsonData(json, json_size);\r\n\tjsonItem2lua(lua, pRoot);\r\n\tKLBDELETE(pRoot);\r\n}\r\n\r\n// CKLBJsonItemのツリーをLuaテーブルに変換し、Luaスタックに積む\r\nvoid\r\nCKLBUtility::jsonItem2lua(CLuaState& lua, CKLBJsonItem * pRoot)\r\n{\r\n\tif (pRoot) {\r\n\t\tjson2lua_rec(lua, pRoot);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUtility::json2lua_rec(CLuaState& lua, CKLBJsonItem * pItem)\r\n{\r\n\tswitch(pItem->getType())\r\n\t{\r\n\tcase CKLBJsonItem::J_MAP:\t// 文字列indexの連想配列\r\n\t\t{\r\n\t\t\tlua.tableNew();\r\n\t\t\tCKLBJsonItem * child = pItem->child();\r\n\t\t\twhile(child) {\r\n\t\t\t\tlua.retString(child->key());\r\n\t\t\t\tjson2lua_rec(lua, child);\r\n\t\t\t\tlua.tableSet();\r\n\t\t\t\tchild = child->next();\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CKLBJsonItem::J_ARRAY:\t// 数値indexの連想配列\r\n\t\t{\r\n\t\t\tlua.tableNew();\r\n\t\t\tCKLBJsonItem * child = pItem->child();\r\n\t\t\tint index = 1;\r\n\t\t\twhile(child) {\r\n\t\t\t\tlua.retInt(index);\r\n\t\t\t\tjson2lua_rec(lua, child);\r\n\t\t\t\tlua.tableSet();\r\n\t\t\t\tchild = child->next();\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CKLBJsonItem::J_BOOLEAN:\r\n\t\t{\r\n\t\t\tlua.retBoolean(pItem->getBool());\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CKLBJsonItem::J_INT:\r\n\t\t{\r\n\t\t\tlua.retInt(pItem->getInt());\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CKLBJsonItem::J_DOUBLE:\r\n\t\t{\r\n\t\t\tlua.retDouble(pItem->getDouble());\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CKLBJsonItem::J_STRING:\r\n\t\t{\r\n\t\t\tlua.retString(pItem->getString());\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CKLBJsonItem::J_NULL:\r\n\t\t{\r\n\t\t\tlua.retPointer(0);\r\n//\t\t\tlua.retNil();\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*static*/\r\nchar * \r\nCKLBUtility::URLencode(char * retbuf, int maxlen, const char ** postForm)\r\n{\r\n\t// 指定された postForm から、POST文字列を生成する。\r\n\t// postForm は URLencodeされておらず、個々の項目が連結されていない状態。\r\n\tchar * basebuf = retbuf;\r\n\tint now_size = maxlen;\r\n\r\n    if(!basebuf) { return NULL; } \r\n\r\n\tchar * ptr = basebuf;\r\n\tfor(int i = 0; postForm[i]; i++) {\r\n\t\tconst char * formItem = postForm[i];\r\n\r\n\t\tif(i > 0) {\r\n\t\t\t*ptr++ = '&';\r\n\t\t\tif(ptr - basebuf >= now_size - 1) {\r\n\t\t\t\t// バッファが与えられている場合はエラー終了\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(const char * src = formItem; *src; src++) {\r\n\t\t\tint reqsize = 1;\r\n\t\t\tchar tmpbuf[10];\r\n\t\t\tconst char * data = NULL;\r\n\t\t\tif(('0'<= *src && *src <= '9') ||\r\n\t\t\t\t('a'<= *src && *src <= 'z') ||\r\n\t\t\t\t('A'<= *src && *src <= 'Z') ||\r\n\t\t\t\t*src == '_' || *src == '-' ||\r\n\t\t\t\t*src == '.' || *src == '*' || *src == '=') {\r\n\t\r\n\t\t\t\t// そのままいける文字\r\n\t\t\t\tdata = src;\r\n\t\t\t} else if(*src == ' ') {\r\n\r\n\t\t\t\t// 空白の置き換え\r\n\t\t\t\tdata = \"+\";\r\n\r\n\t\t\t} else {\r\n\t\t\t\treqsize = 3;\r\n\t\t\t\tsprintf(tmpbuf, \"%%%02x\", (int)*(unsigned char *)src);\r\n\t\t\t\tdata = (const char *)tmpbuf;\r\n\t\t\t}\r\n\t\t\tif((ptr + reqsize) - basebuf >= now_size - 1) {\r\n\t\t\t\t// バッファが与えられている場合はエラー終了\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\tmemcpy(ptr, data, reqsize);\r\n\t\t\tptr += reqsize;\r\n\t\t}\r\n\t}\r\n\t*ptr = 0;\r\n\treturn basebuf;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CKLBUtility.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUtility_h\r\n#define CKLBUtility_h\r\n\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBJsonItem.h\"\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\t#define INTERNAL_BENCH\r\n#endif\r\n\r\n#ifdef INTERNAL_BENCH\r\n\tvoid logDo\t\t\t();\r\n\tvoid logTime\t\t(char type, s64 time, u32 classID);\r\n\tvoid logTimeDump\t();\r\n\tvoid logStartTime\t();\r\n\tvoid logEndTime\t\t(char type, const char* name);\r\n#else\r\n\t#define logStartTime()\t\t;\r\n\t#define logEndTime(a,b)\t\t;\r\n#endif\r\n\r\nclass CKLBUtility\r\n{\r\npublic:\r\n\r\n\t/* Return the closest upper 2^n value */\r\n\tstatic u32 nearest2Pow(u32 v);\r\n\r\n\tstatic char * URLencode(char * retbuf, int maxlen, const char ** postForm);\r\n\r\n\t// 指定されたCKLBNodeが、直前のフレームで描画された画面座標(絶対位置)を取得する\r\n\tstatic void getNodePosition\t\t(CKLBNode * pNode, float * x, float * y);\r\n\r\n\t// Get Inverse matrix from node.\r\n\tstatic void getNodeInverseMatrix(CKLBNode * pNode, SMatrix2D& result);\r\n\r\n\t// Compute transform.\r\n\tstatic void transform(SMatrix2D* pMatrix, float x, float y, float& resx, float& resy);\r\n\r\n\t// Allow to use NULL.\r\n\tstatic int safe_strcmp(const char* a, const char* b);\r\n\r\n\t// 文字列をコピーする:メモリトラッキング対応。取得した文字列は KLBDELETEA() で破棄\r\n\tstatic const char * copyString(const char * string);\r\n\r\n\t// Allocate and copy a memory block.\r\n\tstatic const char * copyMem(const char* buff, u32 size);\r\n\r\n\t// 64bit整数を数列文字列に変換する(printf系が対応していない環境が存在することを想定)\r\n\tstatic char * numString64(char * buf, u64 value);\r\n\r\n\t// 数列文字列を s64 に変換する\r\n\tstatic s64 stringNum64(const char * buf);\r\n\r\n\t// Return the number of character inside a UTF8 string.\r\n\tstatic s32 charCountUtf8(const char *string);\r\n\r\n\t// 指定された文字列がnullであれば\"null\"という文字列を、そうでなければ\"\"で囲んだ形の文字列を返す\r\n\tstatic char * quoated(const char * string);\r\n\r\n\t// 文字列を指定文字で分割し、文字列の配列として返す。各文字列と、全体の配列はKLBDELETEA()で破棄\r\n\tstatic const char ** splitString(const char * string, int delim);\r\n\r\n\t// splitString() で得られた分割文字列配列を破棄する。\r\n\tstatic void deleteSplitString(const char ** split_arr);\r\n\r\n\t// asset をメモリバッファ上からロードし、ハンドル登録も行う。loadAssetと異なり一段しか読まない(imagなどには使えない)\r\n\tstatic CKLBAsset * readAsset(u8 * stream, u32 streamSize,u32 * handle, IKLBAssetPlugin * plugIn = NULL);\r\n\r\n\t// asset のロード(ハンドル登録も行う)\r\n\tstatic CKLBAsset * loadAsset(const char * asset, u32 * handle, IKLBAssetPlugin* plugIn = NULL, bool bSimple = false);\r\n\r\n\t// loadAsset に失敗したらScriptのレベルでエラーを出す\r\n\tstatic CKLBAsset * loadAssetScript(const char * asset, u32 * handle, IKLBAssetPlugin* plugIn = NULL, bool bSimple = false);\r\n\r\n\t// asset をロードし、ノードを生成する(同時にハンドル登録も行う)\r\n\tstatic CKLBNode * createNode(const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn = NULL);\r\n\r\n\t// createNode() に失敗したらScriptのレベルでエラーを出す\r\n\tstatic CKLBNode * createNodeScript(const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn = NULL);\r\n\r\n\t// Composite asset が親タスクのポインタを必要とするので、Composite専用\r\n\tstatic CKLBNode * createCompositeNodeScript(CKLBUITask * pTask, const char * asset, u32 order, u32 * handle, IKLBAssetPlugin* plugIn = NULL);\r\n\r\n\t// createNode()で得られたノードとハンドルを破棄する\r\n\tstatic void deleteNode(CKLBNode * pNode, u32 handle);\r\n\r\n\tstruct JSON_REPLACE {\r\n\t\tconst char * key;\r\n\t\tconst char * value;\r\n\t};\r\n\r\n\t// Luaのスタックに積まれたテーブルをJSON文字列に変換する\r\n\tstatic const char * lua2json(CLuaState& lua, u32& streamSize, JSON_REPLACE * arrReplace = NULL);\r\n\r\n\t// Luaのスタックに積まれたテーブルをBJSONに変換する\r\n\tstatic const char * lua2BJson(CLuaState& lua, u32& streamSize, JSON_REPLACE * arrReplace = NULL);\r\n\r\n\t// JSON文字列をLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void json2lua(CLuaState& lua, const char * json, u32 json_size = 0);\r\n\r\n\t// CKLBJsonItem のツリーをLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void jsonItem2lua(CLuaState& lua, CKLBJsonItem * pRoot);\r\n\r\n\t// SQLite\r\nprivate:\r\n\r\n\t// Utility用定数\r\n\tenum {\r\n\t\tJSON_BLOCK_SIZE = 64,\r\n\t\tJSON_POOL_SIZE = 100\r\n\t};\r\n\r\n\tstruct CPENTRY {\r\n\t\tconst char* string;\r\n\t\tint\t\t\tsize;\r\n\t};\r\n\r\n\tstruct JSON_BUF {\r\n\t\tchar\t*\tbuf;\t// 生成先バッファのポインタ\r\n\t\tint\t\t\tmax;\t// 生成先バッファの現在のサイズ\r\n\t\tint\t\t\tidx;\t// 生成先バッファの成長点index\r\n\r\n\t\tbool add\t(const char * msg);\r\n\t\tbool addU8\t(u8 value);\r\n\t\tbool addPool(const char* str,int& index);\r\n\t\tbool addU32\t(u32 value);\r\n\r\n\t\tJSON_REPLACE * arr_replace;\r\n\t\tCPENTRY\tpoolEntries[JSON_POOL_SIZE];\r\n\t\tu32\t\tpoolCount;\r\n\t\tu32\t\tpoolSize;\r\n\t};\r\n\tstatic bool lua2json_rec\t(CLuaState& lua, JSON_BUF * jsonBuf);\r\n\tstatic bool lua2BJson_rec\t(CLuaState& lua, JSON_BUF * jsonBuf);\r\n\r\n\tstatic void json2lua_rec\t(CLuaState& lua, CKLBJsonItem * pItem);\r\n\tstatic const char * escape\t(const char * string);\r\n};\r\n\r\n#endif // CKLBUtility_h\r\n"
  },
  {
    "path": "Engine/source/Core/CLuaState.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CLuaState.cpp\r\n//\r\n#include <stdio.h>\r\n#include \"klb_vararg.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\nnamespace\r\n{\r\n\r\nint\r\ntraceback(lua_State* L)\r\n{\r\n  const char* message = lua_tostring(L, 1);\r\n  if (message)\r\n    {\r\n      luaL_traceback(L, L, message, 1);\r\n    }\r\n  else if (!lua_isnoneornil(L, 1))\r\n    {\r\n      if(!luaL_callmeta(L, 1, \"__tostring\"))\r\n        {\r\n          lua_pushliteral(L, \"(noeror message)\");\r\n        }\r\n    }\r\n\r\n  return 1;\r\n}\r\n\r\n} // noname namespace\r\n\r\nCLuaState::CLuaState(lua_State * L) \r\n: m_L(L) \r\n{\r\n}\r\n\r\nCLuaState::~CLuaState() \r\n{\r\n}\r\n\r\nconst char *\r\nCLuaState::getScriptName()\r\n{\r\n    return CKLBLuaEnv::getInstance().nowFile();\r\n}\r\n\r\nvoid\r\nCLuaState::errorMsg(const char *type_name, int argnum)\r\n{\r\n    char buf[128];\r\n    sprintf(buf, \"invalid argment type (arg:%d is not %s.)\", argnum, type_name);\r\n    //CKLBLuaEnv::getInstance().errMsg(buf);\r\n    error(\"%s\", buf);\r\n}\r\n\r\nbool\r\nCLuaState::callback(const char * func, const char * argform, ...)\r\n{\r\n\tva_list ap;\r\n\tva_start(ap, argform);\r\n\tbool result = call_luafunction(0, func, argform, ap);\r\n\tva_end(ap);\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCLuaState::retcall(int retnum, const char * func, const char * argform, ...)\r\n{\r\n\tva_list ap;\r\n\tva_start(ap, argform);\r\n\tbool result = call_luafunction(retnum, func, argform, ap);\r\n\tva_end(ap);\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCLuaState::call_luafunction(int retnum, const char *func, const char *argform, va_list ap)\r\n{\r\n    // lua関数の名称をスタックに積む\r\n    lua_getglobal(m_L, func);\r\n\r\n    int count = 0;\r\n        \r\n    // 引数をスタックに積む\r\n    if(argform) {\r\n        for(const char * sp = argform; *sp; sp++) {\r\n            switch(*sp)\r\n            {\r\n                case 'B': {\r\n                    int b = va_arg(ap, int);\r\n                    retBoolean((b) ? true : false);\r\n                    count++;\r\n                    break;\r\n                }\r\n                case 'I': {\r\n                    int i = va_arg(ap, int);\r\n                    retInt(i);\r\n                    count++;\r\n                    break;\r\n                }\r\n                case 'N': {\r\n                    double d = va_arg(ap, double);\r\n                    retDouble(d);\r\n                    count++;\r\n                    break;\r\n                }\r\n                case 'S':{\r\n                    const char * str = va_arg(ap, const char *);\r\n\t\t\t\t\tretString(str);\r\n                    count++;\r\n                    break;\r\n                }\r\n                case 'P':{\r\n                    void * p = va_arg(ap, void *);\r\n                    retPointer(p);\r\n                    count++;\r\n                    break;\r\n                }\r\n                case 'G': {\r\n                    const char * p = va_arg(ap, const char *);\r\n                    retGlobal(p);\r\n                    count++;\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n    }\r\n\treturn call(count, func, retnum);\r\n}\r\n\r\nbool\r\nCLuaState::call(int args, const char * func, int nresults)\r\n{\r\n    // call stackを取れるようにtraceback函数をpushしpcallの第四引数を修正.\r\n    int base = lua_gettop(m_L) - args;\r\n    lua_pushcfunction(m_L, traceback);\r\n    lua_insert(m_L, base);\r\n    int result = lua_pcall(m_L, args, nresults, base);\r\n    lua_remove(m_L, base);\r\n\r\n    if(result) {\r\n    \tconst char * msg = NULL;\r\n        \r\n    \tswitch(result)\r\n    \t{\r\n            default:            msg = \"unknown error: %s (%s)\";             break;\r\n            case LUA_ERRRUN:    msg = \"runtime error: %s (%s)\";             break;\r\n            case LUA_ERRMEM:    msg = \"memory allocation error: %s (%s)\";   break;\r\n            case LUA_ERRERR:    msg = \"error in error: %s (%s)\";            break;\r\n    \t}\r\n        // 呼び出しエラー: 指定の関数呼び出しに失敗\r\n\t\tconst char * errmsg = getString(-1);\r\n        int buff_len = strlen(msg) + strlen(errmsg) + strlen(func) + 1;\r\n        char* buffer = KLBNEWA(char, buff_len);\r\n#if defined(_WIN32)\r\n        sprintf_s(buffer, buff_len, msg, errmsg, func);\r\n#else\r\n        snprintf(buffer, buff_len, msg, errmsg, func);\r\n#endif // #if defined(_WIN32)\r\n        CKLBLuaEnv::getInstance().errMsg(buffer);\r\n\t\tklb_assertAlways(\"%s\", buffer);\r\n        KLBDELETEA(buffer); // assert発生するとここまで来ない予感はする.\r\n        return false;\r\n    }\r\n    return true;\r\n}\r\n\r\nint\r\nCLuaState::error(const char * fmt, ...)\r\n{\r\n\tva_list ap;\r\n\tva_start(ap, fmt);\r\n\tchar msg[1024];\r\n\tvsprintf(msg, fmt, ap);\r\n\tva_end(ap);\r\n\r\n\treturn luaL_error(m_L, msg);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/CLuaState.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CLuaState.h\r\n//\r\n\r\n#ifndef CLuaState_h\r\n#define CLuaState_h\r\n\r\n#include \"lua.hpp\"\r\n#include \"CPFInterface.h\"\r\nclass CLuaState\r\n{\r\n\tfriend class CKLBScriptEnv;\r\n\tfriend class CKLBLuaEnv;\r\npublic:\r\n    CLuaState(lua_State * L);\r\n    virtual ~CLuaState();\r\n    \r\n    // 引数の数を取得\r\n    inline int numArgs() {\r\n        return lua_gettop(m_L);\r\n    }\r\n    \r\n    // 引数取得メソッド\r\n\tinline bool isNil\t(int pos) { return lua_isnil(m_L, pos)\t\t? true : false; }\r\n\tinline bool isNum\t(int pos) { return lua_isnumber(m_L, pos)\t? true : false; }\r\n\tinline bool isString(int pos) { return lua_isstring(m_L, pos)\t? true : false; }\r\n\tinline bool isTable\t(int pos) { return lua_istable(m_L, pos)\t? true : false; }\r\n\r\n    inline bool getBool(int pos) {\r\n        if(!lua_isboolean(m_L, pos)) {\r\n            // boolean と解釈できない\r\n            errorMsg(\"boolean\", pos);            \r\n            return false;\r\n        }\r\n        return (lua_toboolean(m_L, pos)) ? true : false;\r\n    }\r\n    inline bool getBoolean(int pos) {\r\n        if(!lua_isboolean(m_L, pos)) {\r\n            // boolean と解釈できない\r\n            errorMsg(\"boolean\", pos);            \r\n            return false;\r\n        }\r\n        return (lua_toboolean(m_L, pos)) ? true : false;\r\n    }\r\n    inline int  getInt(int pos) {\r\n        lua_Integer ret;\r\n\t\tif(!lua_isnumber(m_L, pos)) {\r\n            // 数値ではない\r\n            errorMsg(\"integer\", pos);\r\n            return 0;\r\n        }\r\n        ret = lua_tointeger(m_L, pos);\r\n        return (int)ret;\r\n    }\r\n    inline float getFloat(int pos) {\r\n        lua_Number ret;\r\n\t\tif(!lua_isnumber(m_L, pos)) {\r\n            // 数値ではない\r\n            errorMsg(\"float\", pos);\r\n            return 0.0;\r\n        }\r\n        ret = lua_tonumber(m_L, pos);\r\n        return (float)ret;\r\n    }\r\n    inline double getDouble(int pos) {\r\n        lua_Number ret;\r\n\t\tif(!lua_isnumber(m_L, pos)) {\r\n            // 数値ではない\r\n            errorMsg(\"double\", pos);\r\n            return 0.0;\r\n        }\r\n        ret = lua_tonumber(m_L, pos);\r\n        return (double)ret;\r\n    }\r\n    inline const char * getString(int pos) {\r\n        if(!lua_isstring(m_L, pos)) {\r\n            // 文字列ではない\r\n            errorMsg(\"string\", pos);\r\n            return 0;\r\n        }\r\n        const char * ret = lua_tostring(m_L, pos);\r\n        return ret;\r\n    }\r\n    inline const void * getPointer(int pos) {\r\n        if(!lua_islightuserdata(m_L, pos)) {\r\n            // ポインタとは解釈できない\r\n            errorMsg(\"internal object\", pos);\r\n            return 0;\r\n        }\r\n        const void * ret = lua_topointer(m_L, pos);\r\n        return ret;\r\n    }\r\n    inline const char * getTable(int pos) {\r\n        if(!lua_istable(m_L, pos)) {\r\n            // ポインタとは解釈できない\r\n            errorMsg(\"TABLE\", pos);\r\n            return 0;\r\n        }\r\n        const char * ret = lua_tostring(m_L, pos);\r\n        return ret;\r\n    }\r\n\r\n    // 戻り値を返すための関数\r\n    inline void retNil\t\t()\t\t\t\t\t{ lua_pushnil(m_L);\t\t\t\t\t\t\t}\r\n    inline void retBool     (bool val)\t\t\t{ lua_pushboolean(m_L, (val) ? 1 : 0);\t\t}\r\n    inline void retBoolean\t(bool val)\t\t\t{ lua_pushboolean(m_L, (val) ? 1 : 0);\t\t}\r\n    inline void retInt\t\t(int val)\t\t\t{ lua_pushinteger(m_L, (lua_Integer)val);\t}\r\n    inline void retFloat\t(float val)\t\t\t{ lua_pushnumber(m_L, (lua_Number)val);\t\t}\r\n    inline void retDouble\t(double val)\t\t{ lua_pushnumber(m_L, (lua_Number)val);\t\t}\r\n    inline void retString\t(const char * val)\t{ lua_pushstring(m_L, val);\t\t\t\t\t}\r\n    inline void retPointer\t(void * ptr)\t\t{ lua_pushlightuserdata(m_L, ptr);\t\t\t}\r\n    inline void retGlobal\t(const char * val)\t{ lua_getglobal(m_L, val);\t\t\t\t\t}\r\n\r\n\tinline void retValue\t(int pos)\t\t\t{ lua_pushvalue(m_L, pos);\t\t\t\t\t}\r\n\r\n\tinline void tableNew\t()\t\t\t\t\t{ lua_newtable(m_L);\t\t\t\t\t\t}\r\n\tinline void tableSet\t(int pos = -3)\t\t{ lua_settable(m_L, pos);\t\t\t\t\t}\r\n\tinline void tableGet\t(int pos = -2)\t\t{ lua_gettable(m_L, pos);\t\t\t\t\t}\r\n\tinline int  tableNext\t(int pos = -2)\t\t{ return lua_next(m_L, pos);\t\t\t\t}\r\n\tinline void pop\t\t\t(int num)\t\t\t{ lua_pop(m_L, num);\t\t\t\t\t\t}\r\n\tinline void setGlobal\t(const char * name) { lua_setglobal(m_L, name);\t\t\t\t\t}\r\n\tinline void getGlobal\t(const char * name) { lua_getglobal(m_L, name);\t\t\t\t\t}\r\n\tinline int  getType\t\t(int pos = -1)\t\t{ return lua_type(m_L, pos);\t\t\t\t}\r\n\r\n    // 現在実行されている行番号とファイル名を得る\r\n\tconst char * getScriptName();\r\n\r\n    inline int getNumLine() {\r\n        lua_Debug dbg;\r\n        if(lua_getstack(m_L, 1, &dbg)) {\r\n            lua_getinfo(m_L, \"Sl\", &dbg);\r\n        }\r\n        return dbg.currentline;\r\n    }\r\n\r\n\r\nprotected:\r\n    // Lua 側の関数を呼び出すメソッド\r\n    // 呼び出す際の引数の数と型を、argform で文字列として指定する。\r\n    // B:boolean / I:integer / N:number / S:string / P:lightuserdata\r\n    // 例)\r\n    //  lua.callback(\"CallBackFunc\", \"PIIBS\", pTask, 100, 200, true, \"return\");\r\n    //\r\n\tvirtual bool callback\t\t\t(const char * func, const char * argform, ...);\r\n\tvirtual bool call_luafunction\t(int retnum, const char * func, const char * argform, va_list ap);\r\n\tvirtual bool retcall\t\t\t(int retnum, const char * func, const char * argform, ...);\r\n\tvirtual bool call\t\t\t\t(int args,   const char * func, int nresults = 0);\r\nprivate:\r\n\tint error\t\t(const char * fmt, ...); // Only from CKLBScriptEnv\r\n    void errorMsg\t(const char * type_name, int argnum);\r\n    \r\n    lua_State       *   m_L;\r\n};\r\n\r\nclass CLua_Only_State : public CLuaState {\r\nprivate:\t\r\n\tCLua_Only_State(lua_State * L) : CLuaState(L) {}; // declared to avoid warnings\r\npublic:\r\n\tbool callback\t\t\t(const char * func, const char * argform, ...);\r\n\tbool call_luafunction\t(int retnum, const char * func, const char * argform, va_list ap);\r\n\tbool retcall\t\t\t(int retnum, const char * func, const char * argform, ...);\r\n\tbool call\t\t\t\t(int args,   const char * func, int nresults = 0);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/CPFInterface.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  platformhandler.cpp\r\n//\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"OSWidget.h\"\r\n;\r\n\r\nIWidget::~IWidget() {}\r\n\r\nIClientRequest::IClientRequest() {}\r\nIClientRequest::~IClientRequest() {}\r\n\r\nIPlatformRequest::IPlatformRequest() {}\r\nIPlatformRequest::~IPlatformRequest() {}\r\n\r\nCPFInterface * CPFInterface::instance = NULL;\r\n\r\n// CPFInterface は登録された CPFStrategy の method を呼び出すだけなので、\r\n// Singleton 以外の部分については inline 定義される。\r\nCPFInterface::CPFInterface()\r\n: m_pClient     (NULL)\r\n, m_pPlatform   (NULL) \r\n{\r\n}\r\n\r\nCPFInterface::~CPFInterface() \r\n{\r\n}\r\n\r\nCPFInterface&\r\nCPFInterface::getInstance() {\r\n    /*\r\n    static CPFInterface instance;\r\n    return instance;\r\n     */\r\n    if(!instance) {\r\n        instance = new CPFInterface();\r\n    }\r\n    return *instance;\r\n}\r\n\r\n\r\nbool\r\nCPFInterface::isBigEndian()\r\n{\r\n    u16     num = 0x7700;\r\n    char *  ptr = (char *)&num;\r\n    return (*ptr == 0x77);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/DebugAlloc.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdlib.h>\r\n//#include <malloc.h>\r\n//#include <Windows.h>\r\n\r\n#include \"BaseType.h\"\r\n#include \"DebugAlloc.h\"\r\n\r\nint\tCMemDebug::m_cntFail = 0;\r\nint\tCMemDebug::m_numFail = 0;\r\n\r\nvoid * \r\noperator new(size_t size)\r\n{\r\n    void* ret = NULL;\r\n#ifdef INTERNAL_MEMORY_STARVING\r\n    if(CMemDebug::isFail()) { return ret; }\r\n#endif\r\n\r\n    if( size <= 0 ) { return ret; }\r\n\r\n\tret = malloc(size);\r\n\tklb_assert(ret, \"memory allocation failed.\");\r\n\treturn ret;\r\n}\r\n\r\nvoid * \r\noperator new[](size_t size)\r\n{\r\n    void* ret = NULL;\r\n#ifdef INTERNAL_MEMORY_STARVING\r\n    if(CMemDebug::isFail()) { return ret; }\r\n#endif\r\n\r\n    if( size <= 0 ) { return ret; }\r\n\r\n    ret = malloc(size);\r\n\tklb_assert(ret, \"memory allocation failed.\");\r\n\treturn ret;\r\n}\r\n\r\nvoid \r\noperator delete(void * ptr)\r\n{\r\n    free(ptr);\r\n}\r\n\r\nvoid \r\noperator delete[](void * ptr)\r\n{\r\n\tfree(ptr);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/DebugAlloc.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef DebugAlloc_h\r\n#define DebugAlloc_h\r\n#include <stdlib.h>\r\n\r\nvoid * operator new(size_t size);\r\nvoid * operator new[](size_t size);\r\n\r\nvoid operator delete(void * ptr);\r\nvoid operator delete[](void * ptr);\r\n\r\nclass CMemDebug\r\n{\r\npublic:\r\n\tinline static void setFailNums\t\t(int nums)\t\t{ m_numFail = nums;  }\r\n\tinline static void setFailCounter\t(int count = 0) { m_cntFail = count; }\r\n\r\n\tinline static bool isFail() {\r\n\t\tif(!m_numFail) return false;\r\n\t\tif(m_cntFail + 1 >= m_numFail) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tm_cntFail++;\r\n\t\treturn false;\r\n\t}\r\nprivate:\r\n\tstatic int\t\tm_cntFail;\r\n\tstatic int\t\tm_numFail;\r\n};\r\n#endif // DebugAlloc_h\r\n"
  },
  {
    "path": "Engine/source/Core/DebugTracker.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdio.h>\r\n#include <string.h>\r\n#ifndef _WIN32\r\n#include <unistd.h>\r\n#else\r\n#include <Windows.h>\r\ntypedef unsigned __int32 uint32_t;\r\n#endif\r\n\r\n#include \"BaseType.h\"\r\n#include \"DebugTracker.h\"\r\n#include \"FileSystem.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBLuaTask.h\"\r\n\r\n// BOMtest\r\nbool                    CTracker::m_initialized     = false;\r\nbool                    CTracker::m_retry           = false;\r\nconst char          *   CTracker::m_targethost      = NULL;\r\nint                     CTracker::m_retrycount      = 0;\r\n\r\nIReadStream         *   CTracker::ms_pSockR         = NULL;\r\nIWriteStream        *   CTracker::ms_pSockW         = NULL; // 出力先socket\r\nCTracker::srcList   *   CTracker::m_begin           = NULL; // sourceIdリスト先頭\r\nint                     CTracker::m_nextId          = 0;    // 次に新規発行するsourceIdの値\r\n\r\nCTracker::taskList  *   CTracker::m_taskbegin       = NULL; // sourceIdリスト先頭\r\nint                     CTracker::m_taskId          = 0;    // 次に新規発行するsourceIdの値\r\n\r\nint                     CTracker::ms_numFrame       = 0;\r\nint                     CTracker::ms_numCounter     = 0;\r\nint                     CTracker::ms_taskCounter    = 0;\r\n\r\n\r\nvoid CTracker::writeBlock(u8* buf, u32 length) {\r\n\tif (ms_pSockW) {\r\n\t\tif (ms_pSockW->getStatus() == IWriteStream::NORMAL) {\r\n\t\t\tms_pSockW->writeBlock(buf, length);\r\n\t\t} else {\r\n\t\t\tdelete ms_pSockR;\r\n\r\n\t\t\tms_pSockW = NULL;\r\n\t\t\tms_pSockR = NULL;\r\n\r\n\t\t\tm_initialized = false;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// 指定項目のソースIDを通知する\r\nbool\r\nCTracker::sendSrcID(srcList * src)\r\n{\r\n\tbool bResult = true;\r\n    if(ms_pSockW) {\r\n        u8 buf[256];\r\n\t\tint length = strlen(src->srcName) + 3;\r\n        buf[0] = CMD_SRCID;    // SourceID send\r\n        buf[1] = src->sid >> 8;\r\n        buf[2] = src->sid & 0xff;\r\n        strcpy((char*)(buf + 3), src->srcName);\r\n        buf[ length ] = 0;\r\n\t\twriteBlock(buf, length + 1);\r\n    }\r\n\treturn bResult;\r\n}\r\n\r\n// 指定項目のタスクIDを通知する\r\nbool\r\nCTracker::sendTaskID(taskList * task)\r\n{\r\n\tbool bResult = true;\r\n\r\n    // 新タスク追加を通知(コネクションが成立していれば)\r\n    if(ms_pSockW) {\r\n        u8 buf[256];\r\n        int length = strlen(task->taskName) + 3;\r\n        buf[0] = CMD_TASKID;    // SourceID send\r\n        buf[1] = task->tid >> 8;\r\n        buf[2] = task->tid & 0xff;\r\n        strcpy((char*)(buf + 3), task->taskName);\r\n        buf[ length ] = 0;\r\n\t\twriteBlock(buf, length + 1);\r\n    }\r\n\treturn bResult;\r\n}\r\n\r\n\r\n// ソースIDから該当するソースID項目を検索し取得する\r\nCTracker::srcList *\r\nCTracker::searchSrcID(u16 srcID)\r\n{\r\n    srcList * pIt = m_begin;\r\n    while(pIt) {\r\n\t\tif(pIt->sid == srcID) {\r\n            return pIt;\r\n        }\r\n        pIt = pIt->p_next;\r\n    }\r\n\treturn NULL;\r\n}\r\n\r\n// タスクIDから該当するタスクID項目を検索し取得する\r\nCTracker::taskList *\r\nCTracker::searchTaskID(u16 taskID)\r\n{\r\n    taskList * pIt = m_taskbegin;\r\n    while(pIt) {\r\n\t\tif(pIt->tid == taskID) {\r\n            return pIt;\r\n        }\r\n        pIt = pIt->p_next;\r\n    }\r\n\treturn NULL;\r\n}\r\n\r\nint\r\nCTracker::getSrcID(const char *srcName)\r\n{\r\n    srcList * pIt = m_begin;\r\n    while(pIt) {\r\n        if(!strcmp(srcName, pIt->srcName)) {\r\n            return pIt->sid;\r\n        }\r\n        pIt = pIt->p_next;\r\n    }\r\n    // 見つからなかった\r\n    pIt          = new srcList;\r\n    pIt->srcName = srcName;\r\n    pIt->sid     = ++m_nextId;\r\n    pIt->p_next  = m_begin;\r\n    m_begin      = pIt;\r\n    \r\n\tsendSrcID(pIt);\r\n\r\n\treturn pIt->sid;\r\n}\r\n\r\nvoid\r\nCTracker::Init(const char * target, bool retry)\r\n{\r\n\tm_retrycount = 0;\r\n\tm_retry      = retry;\r\n    ms_pSockR    = CPFInterface::getInstance().platform().openReadStream(target, false);\r\n\tif(ms_pSockR->getStatus() != IReadStream::NORMAL) {\r\n\t\t// 接続に問題がある\r\n\r\n\t\t// ストリームを破棄\r\n\t\tdelete ms_pSockR;\r\n\t\tms_pSockR = NULL;\r\n\r\n\t\tif(!m_targethost) {\r\n\t\t\tchar * buf = new char [ strlen(target) + 1 ];\r\n\t\t\tstrcpy(buf, target);\r\n\t\t\tm_targethost = (const char *)buf;\r\n\t\t}\r\n\t\tm_initialized = false;\t// 初期化されていない\r\n\t\treturn;\r\n\t}\r\n\r\n    if(ms_pSockR) ms_pSockW = ms_pSockR->getWriteStream();\r\n    if(m_begin) {\r\n        srcList * pIt;\r\n        srcList * nxt;\r\n        \r\n        pIt = m_begin;\r\n        while(pIt) {\r\n            nxt = pIt->p_next;\r\n            delete pIt;\r\n            pIt = nxt;\r\n        }\r\n    }\r\n    m_begin     = NULL;\r\n    m_nextId    = 0;\r\n    ms_numFrame = 0;\r\n    ms_numCounter = 0;\r\n\tm_initialized = true;\r\n}\r\n\r\nvoid\r\nCTracker::End()\r\n{\r\n    srcList * pIt;\r\n    srcList * nxt;\r\n    \r\n    pIt = m_begin;\r\n    while(pIt) {\r\n        nxt = pIt->p_next;\r\n        delete pIt;\r\n        pIt = nxt;\r\n    }\r\n\r\n\ttaskList * pTIt;\r\n\ttaskList * tnxt;\r\n    pTIt = m_taskbegin;\r\n    while(pIt) {\r\n        tnxt = pTIt->p_next;\r\n\t\tdelete[] pTIt->taskName;\r\n        delete pTIt;\r\n        pTIt = tnxt;\r\n    }\r\n\r\n\tif(ms_pSockW) ms_pSockW->writeU8(CMD_END);\r\n#ifndef _WIN32\r\n\tsleep(1000);  // waiting for client receive CMD_END.\r\n#else\r\n\tSleep(1000);\r\n#endif\r\n    delete ms_pSockR;\r\n    m_initialized = false;\r\n\tm_retrycount = 0;\r\n//    CPFInterface::getInstance().platform().closeWriteStream(ms_pSockW);\r\n//    CPFInterface::getInstance().platform().closeReadStream(ms_pSockR);\r\n}\r\n\r\nvoid\r\nCTracker::updateFrame()\r\n{\r\n\t// 接続が成立していなければ、再接続を試みる。\r\n\tif(m_retry && !m_initialized && m_targethost) {\r\n\t\tif(++m_retrycount < 60) return; \r\n\r\n\t\tInit(m_targethost, m_retry);\r\n\t}\r\n\r\n\tif(!m_initialized) return;\r\n    ms_taskCounter = 0;\r\n    ms_numFrame++;\r\n\r\n\t// モニタからのコマンドがあれば処理する。\r\n\t{\r\n\t\tu8 cmdbuf[3];\r\n\t\tbool bResult;\r\n\r\n\t\tsrcList dummySrc;\r\n\t\tdummySrc.p_next  = NULL;\r\n\t\tdummySrc.srcName = \"[ERROR] unknown srcID\";\r\n\r\n\t\ttaskList dummyTask;\r\n\t\tdummyTask.p_next  = NULL;\r\n\t\tdummyTask.taskName = \"[ERROR] unknown taskID\";\r\n\r\n\t\t// コマンドが到着している回数だけ処理する\r\n\t\twhile((bResult = ms_pSockR->readBlock((void *)cmdbuf, 3))) {\r\n\t\t\tu8 cmd = cmdbuf[0];\r\n\t\t\tu16 id = ((u16)cmdbuf[1] << 8) | (u16)cmdbuf[2];\r\n\t\t\tswitch(cmd)\r\n\t\t\t{\r\n\t\t\tcase QUERY_SRCID:\r\n\t\t\t\t{\r\n\t\t\t\t\tdummySrc.sid = id;\r\n\t\t\t\t\tsrcList * pSrc = searchSrcID(id);\r\n\t\t\t\t\tif(!pSrc) pSrc = &dummySrc;\r\n\t\t\t\t\tsendSrcID(pSrc);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase QUERY_TASKID:\r\n\t\t\t\t{\r\n\t\t\t\t\tdummyTask.tid = id;\r\n\r\n\t\t\t\t\ttaskList * pTask = searchTaskID(id);\r\n\t\t\t\t\tif(!pTask) pTask = &dummyTask;\r\n\t\t\t\t\tsendTaskID(pTask);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase QUERY_GAMESTOP:\r\n\t\t\t\t{\r\n\t\t\t\t\t// does not support command anymore.\r\n\t\t\t\t\tklb_assertAlways(\"Not supported by engine anymore\");\r\n\t\t\t\t\tms_pSockW->writeU8(ACK_GAMESTOP);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase QUERY_GAMESTART:\r\n\t\t\t\t{\r\n\t\t\t\t\t// does not support command anymore.\r\n\t\t\t\t\tklb_assertAlways(\"Not supported by engine anymore\");\r\n\t\t\t\t\tms_pSockW->writeU8(ACK_GAMESTART);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// New Frame.\r\n\tu8 buf[5];\r\n    buf[0] = CMD_FRAME;\r\n    setArrU32(buf + 1, (u32)ms_numFrame);\r\n\twriteBlock(buf, 5);\r\n}\r\n\r\n\r\nvoid *\r\nCTracker::logNew(void* ptr, size_t size, int line, const char* file)\r\n{\r\n\tif (ptr) {\r\n\t\tu8 buf[25];\r\n\t\tint id = getSrcID(file);\r\n    \r\n\t\tbuf[0] = CMD_ALLOC;\r\n\t\tsetArrU32(buf + 1, static_cast<uint32_t>(reinterpret_cast<uintptr_t>(ptr)));\r\n\t\tsetArrU32(buf + 5, (u32)size);\r\n\t\tsetArrU32(buf + 9, ms_numFrame);  // frame\r\n\t\tsetArrU32(buf + 13, ms_numCounter); // counter\r\n\t\tsetArrU16(buf + 17, (u16)line); // line\r\n\t\tsetArrU16(buf + 19, (u16)id);   // sourceID\r\n\t\tCKLBTask* pTask = CKLBTaskMgr::getInstance().getCurrentTask();\r\n\t\tu32 classID = pTask ? pTask->getClassID() : 0;\r\n\t\tsetArrU32(buf + 21, classID);\r\n\t\twriteBlock(buf, 25);\r\n\r\n\t\tms_numCounter++;    \r\n\t\t// printf(\"Alloc:%p s:%i l.%i in %s %8x %s \\n\",ptr,size,line,file,classID, classID ? IFactory::getClassName(classID) : NULL);\r\n\t}\r\n\treturn ptr;\r\n}\r\n\r\nvoid *\r\nCTracker::logDelete(void* ptr, int line, const char* file)\r\n{\r\n\tif (ptr) {\r\n\t\tu8 buf[21];\r\n\t\tint id = getSrcID(file);\r\n    \r\n\t\tbuf[0] = CMD_FREE;\r\n\t\tsetArrU32(buf + 1, static_cast<uint32_t>(reinterpret_cast<uintptr_t>(ptr)));\r\n\t\tsetArrU32(buf + 5, ms_numFrame);  // frame\r\n\t\tsetArrU32(buf + 9, ms_numCounter); // counter\r\n\t\tsetArrU16(buf + 13, (u16)line); // line\r\n\t\tsetArrU16(buf + 15, (u16)id);   // sourceID\r\n\t\tCKLBTask* pTask = CKLBTaskMgr::getInstance().getCurrentTask();\r\n\t\tu32 classID = pTask ? pTask->getClassID() : 0;\r\n\t\tsetArrU32(buf + 17, classID);\r\n\t\twriteBlock(buf, 21);\r\n    \r\n\t\tms_numCounter++;\r\n\t\t// printf(\"Delete:%p l.%i in %s (Class %8x %s)\\n\",ptr,line,file,classID, classID ? IFactory::getClassName(classID) : NULL);\r\n\t}\r\n    \r\n\treturn ptr;\r\n}\r\n\r\nint\r\nCTracker::getTaskID(const char * taskName)\r\n{\r\n    taskList * pIt = m_taskbegin;\r\n    while(pIt) {\r\n        if(!strcmp(taskName, pIt->taskName)) {\r\n            return pIt->tid;\r\n        }\r\n        pIt = pIt->p_next;\r\n    }\r\n    // 見つからなかった\r\n    pIt = new taskList;\r\n\tchar * buf = new char [ strlen(taskName) + 1 ];\r\n\tstrcpy(buf, taskName);\r\n    pIt->taskName = (const char *)buf;\r\n    pIt->tid    = ++m_taskId;\r\n    pIt->p_next = m_taskbegin;\r\n    m_taskbegin = pIt;\r\n    \r\n\tsendTaskID(pIt);\r\n\r\n    return pIt->tid;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/DebugTracker.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __DEBUG_SYSTEM__\r\n#define __DEBUG_SYSTEM__\r\n#include <stdlib.h>\r\n#include \"FileSystem.h\"\r\n\r\nclass CKLBTask;\r\n\r\nclass CTracker\r\n{\r\npublic:\r\n    static void  Init\t\t\t(const char * target, bool retry = false);\r\n    static void  End\t\t\t();\r\n    \r\n    static void  updateFrame\t();\r\n\r\n\tstatic void  setStateName\t(char* newState);\r\n\tstatic void* logNew\t\t\t(void* ptr, size_t size, int line, const char* file);\r\n\tstatic void* logDelete\t\t(void* ptr, int line, const char* file);\r\nprivate:\r\n    enum {\r\n        CMD_END     = 1,\r\n\r\n        CMD_ALLOC   = 2,\r\n        CMD_FREE    = 3,\r\n        CMD_SRCID   = 4,\r\n        CMD_TASKTIME= 5,    // タスクの所要時間\r\n        CMD_TASKID  = 6,    // タスクIDの新規追加\r\n\t\tCMD_FRAME\t= 7,\r\n\r\n\t\tQUERY_SRCID\t\t= 0x11,\t// パフォーマンスモニタからのコマンド: SRCID の値から、ソース/行番号を得る\r\n\t\tQUERY_TASKID\t= 0x12,\t// パフォーマンスモニタからのコマンド: TASKIDの値からタスクラベルを得る\r\n\r\n\t\tQUERY_GAMESTOP\t= 0x13,\r\n\t\tQUERY_GAMESTART\t= 0x14,\r\n\r\n\t\tACK_GAMESTOP\t= 0x23,\r\n\t\tACK_GAMESTART\t= 0x24,\r\n    };\r\n\r\n    typedef struct srcList {\r\n        struct srcList * p_next;\r\n        const char * srcName;\r\n        int    sid;\r\n    } srcList;\r\n\tstatic bool\t\t\tsendSrcID\t(srcList * src);\r\n\tstatic srcList *\tsearchSrcID\t(u16 srcID);\r\n\tstatic int\t\t\tgetSrcID\t(const char * srcName);\r\n\r\n\tstatic srcList *\tm_begin;\r\n    static int          m_nextId;\r\n    static int          ms_numCounter;\r\n\r\n    \r\n    typedef struct taskList {\r\n        struct taskList * p_next;\r\n        const char * taskName;\r\n        int     tid;\r\n    } taskList;\r\n\tstatic bool\t\t\tsendTaskID\t(taskList * task);\r\n\tstatic taskList *\tsearchTaskID(u16 taskID);\r\n    static int\t\t\tgetTaskID\t(const char * taskName);\r\n\r\n    static taskList *\tm_taskbegin;\r\n    static int          m_taskId;\r\n    static int          ms_taskCounter;\r\n\r\n\tstatic void writeBlock(u8* buf, u32 length);\r\n\r\n    static inline void setArrU32(u8 * p, u32 v) {\r\n        p[0] = (v >> 24) & 0xff;\r\n        p[1] = (v >> 16) & 0xff;\r\n        p[2] = (v >> 8) & 0xff;\r\n        p[3] = v & 0xff;\r\n    }\r\n\r\n    static inline void setArrU16(u8 * p, u16 v) {\r\n        p[0] = (v >> 8) & 0xff;\r\n        p[1] = v & 0xff;\r\n    }\r\n\r\n    static IReadStream *\tms_pSockR;\r\n    static IWriteStream *\tms_pSockW;\r\n\r\n\r\n\tstatic bool\t\t\t\tm_initialized;\r\n\tstatic bool\t\t\t\tm_retry;\r\n\tstatic const char *\t\tm_targethost;\r\n\tstatic int\t\t\t\tm_retrycount;\r\n\r\n    static int\t\t\t\tms_numFrame;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/Dictionnary.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"Dictionnary.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n// =========================================================================\r\n//    Symbol Cache 1 Char Entry\r\n// =========================================================================\r\n\r\nCharEntry::CharEntry() \r\n{\r\n}\r\n\r\nCharEntry::CharEntry(Dictionnary* pOwner, char c, const void* value)\r\n: m_next        (NULL)\r\n, m_child       (NULL)\r\n, m_pOwner      (pOwner)\r\n, m_value       (value)\r\n, m_char        (c)\r\n, m_childCount  (0)\r\n{\r\n}\r\n\r\nCharEntry::CharEntry(Dictionnary* pOwner)\r\n: m_next        (NULL)\r\n, m_child       (NULL)\r\n, m_pOwner      (pOwner)\r\n, m_value       (NULL)\r\n, m_char        (0)\r\n, m_childCount  (0)\r\n{\r\n}\r\n\r\n/*static*/\r\nvoid* \r\nCharEntry::operator new(size_t /*size*/, ArrayAllocator<CharEntry>* pAlloc)\r\n{\r\n\t// Ignore size, we are fixed size type here.\r\n\treturn pAlloc->allocEntry();\r\n}\r\n\r\n/*static*/\r\nvoid \r\nCharEntry::operator delete(void *p, ArrayAllocator<CharEntry>* pAlloc)\r\n{\r\n\tpAlloc->freeEntry((CharEntry*)p);\r\n}\r\n\r\nvoid \r\nCharEntry::clear() \r\n{\r\n\tif (m_pOwner->m_pCBDelete && m_value) {\r\n\t\tm_pOwner->m_pCBDelete(m_pOwner->m_pCBContext, m_value);\r\n\t\tm_value = NULL;\r\n\t}\r\n\r\n\tCharEntry* parse = m_child;\r\n\twhile (parse) {\r\n\t\tCharEntry* next = parse->m_next;\r\n\t\t\r\n\t\t// Specific allocator, do NOT use KLBDELETE macro.\r\n\r\n\t\t// Free subtree.\r\n\t\tparse->clear();\r\n\r\n\t\t// Free only itself.\r\n\t\toperator delete (parse, &m_pOwner->allocator);\r\n\t\tparse = next;\r\n\t}\r\n\r\n\tm_childCount\t= 0;\r\n\tm_child\t\t\t= NULL;\r\n}\r\n\r\nbool \r\nCharEntry::findChildChar\t(CharEntry** pEntry, char c) \r\n{\r\n\tCharEntry* start = this->m_child;\r\n\tCharEntry* last  = NULL;\r\n\twhile (start && (start->m_char < c)) {\r\n\t\tlast  = start;\r\n\t\tstart = start->m_next;\r\n\t}\r\n\t\r\n\tif (start) {\r\n\t\tif (start->m_char != c) {\r\n\t\t\t// no entry or last entry with < c\r\n\t\t\t*pEntry = last;\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\t// Entry is == c\r\n\t\t\t*pEntry = start;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t} else {\r\n\t\t// no entry or last entry with < c\r\n\t\t*pEntry = last;\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid \r\nCharEntry::insertChild(CharEntry* pEntryBefore, CharEntry* pEntry) \r\n{\r\n\tif (pEntryBefore != NULL) {\r\n\t\t//\r\n\t\tpEntry->m_next \t\t\t= pEntryBefore->m_next;\r\n\t\tpEntryBefore->m_next\t= pEntry;\r\n\t} else {\r\n\t\t//\r\n\t\tpEntry->m_next \t\t\t= this->m_child;\r\n\t\tthis->m_child\t\t\t= pEntry;\r\n\t}\r\n\tm_childCount++;\r\n}\r\n\r\nvoid \r\nCharEntry::removeChild(CharEntry* pEntry) \r\n{\r\n\tCharEntry* pParse \t= this->m_child;\r\n\tCharEntry* last  \t= NULL;\r\n\twhile (pParse) {\r\n\t\tif (pParse == pEntry) {\r\n\t\t\tif (last) {\r\n\t\t\t\tlast->m_next = pParse->m_next; \r\n\t\t\t} else {\r\n\t\t\t\tthis->m_child = pParse->m_next;\r\n\t\t\t}\r\n\t\t\tm_childCount--;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlast = pParse;\r\n\t\tpParse = pParse->m_next;\r\n\t}\r\n}\r\n\r\n// =========================================================================\r\nDictionnary::Dictionnary()\r\n: m_pCBDelete   (NULL)\r\n, m_pCBContext  (NULL)\r\n, m_pRoot       (NULL)\r\n{\r\n}\r\n\r\nDictionnary::Dictionnary(const void* callBackContext, cbDicoDelete ptrFct)\r\n: m_pCBDelete   (ptrFct)\r\n, m_pCBContext  (callBackContext)\r\n, m_pRoot       (NULL)\r\n{\r\n}\r\n\r\nbool \r\nDictionnary::init(u16 dicoSize) \r\n{\r\n\tif (allocator.init(dicoSize)) {\r\n\t\tm_pRoot = new (&allocator) CharEntry(this);\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nDictionnary::~Dictionnary() \r\n{\r\n\tallocator.freeEntry(m_pRoot);\r\n}\r\n\r\nvoid \r\nDictionnary::setOwnerCallback(const void* callBackContext, cbDicoDelete ptrFct)\r\n{\r\n\tm_pCBDelete\t\t= ptrFct;\r\n\tm_pCBContext\t= callBackContext;\r\n}\r\n\r\nconst void* \r\nDictionnary::find(const char* string) \r\n{\r\n\tCharEntry* pNavigation = m_pRoot;\r\n\t// printf(\"Find : %s\\n\",string);\r\n\twhile (*string != 0) {\r\n\t\tCharEntry* nextItem;\r\n\t\tbool res = pNavigation->findChildChar(&nextItem, *string);\r\n\t\tif (res) {\r\n\t\t\t// Character found, new child item found... continue.\r\n\t\t\tstring++;\r\n\t\t\tpNavigation = nextItem;\r\n\t\t} else {\r\n\t\t\t// printf(\"NOT Found : %s\\n\", string);\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t}\r\n\t\r\n\t// printf(\"Found : %s\\n\", string);\r\n\treturn pNavigation->m_value;\r\n}\r\n\r\nvoid \r\nDictionnary::add(const char* string, const void* value) \r\n{\r\n\tif (string != NULL) {\r\n\t\t// DEBUG_PRINT(\"Add : %s\\n\",string);\r\n\t\tCharEntry* pNavigation = m_pRoot;\r\n\t\twhile (*string != 0) {\r\n\t\t\tCharEntry* nextItem;\r\n\t\t\tbool res = pNavigation->findChildChar(&nextItem, *string);\r\n\t\t\tif (res) {\r\n\t\t\t\t// Character found, new child item found... continue.\r\n\t\t\t\tpNavigation = nextItem;\r\n\t\t\t} else {\r\n\t\t\t\tCharEntry* createItem = new(&allocator) CharEntry(this, *string, (string[1] == 0) ? value : NULL);\r\n\r\n\t\t\t\t// Character not found : Create and insert\r\n\t\t\t\tpNavigation->insertChild(nextItem, createItem);\r\n\t\t\t\tpNavigation = createItem;\r\n\t\t\t}\r\n\t\t\tstring++;\r\n\t\t}\r\n\t\t// dump();\r\n\t}\r\n}\r\n\r\nvoid \r\nDictionnary::clear() \r\n{\r\n\tif (m_pRoot) {\r\n\t\tm_pRoot->clear();\r\n\t}\r\n}\r\n\r\nvoid \r\nDictionnary::remove(const char* string) \r\n{\r\n\tif (string != NULL) {\r\n\t\t// DEBUG_PRINT(\"Remove : %s\\n\",string);\r\n\t\tbool del = true;\r\n\t\tremoveRecursive(m_pRoot, string, &del);\r\n\t\t// dump();\r\n\t\t/*\r\n\t\twhile (*string != 0) {\r\n\t\t\tCharEntry* nextItem;\r\n\t\t\tbool res = pNavigation->findChildChar(&nextItem, *string);\r\n\t\t\tif (res) {\r\n\t\t\t\tif (nextItem->m_childCount == 1) {\r\n\t\t\t\t\t// Delete entry only.\r\n\t\t\t\t\tpNavigation->removeChild(nextItem);\r\n\t\t\t\t\t// Delete sub tree.\r\n\t\t\t\t\tKLBDELETE(nextItem);\r\n\t\t\t\t\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}*/\r\n\t}\r\n}\r\n\r\nvoid \r\nDictionnary::removeRecursive(CharEntry* pNode, const char* curr, bool* pDel) \r\n{\r\n\tCharEntry* nextItem;\r\n\r\n\tbool res = pNode->findChildChar(&nextItem, *curr);\r\n\tif (res) {\r\n\t\tremoveRecursive(nextItem, &curr[1],pDel);\r\n\t\tif (nextItem->m_childCount == 0) {\r\n\t\t\tif (*pDel) {\r\n\t\t\t\tpNode->removeChild(nextItem);\r\n\t\t\t\tallocator.freeEntry(nextItem); // Direct call to allocator, do NOT delete\r\n\t\t\t\tif (m_pCBDelete && pNode->m_value) {\r\n\t\t\t\t\tm_pCBDelete(m_pCBContext, pNode->m_value);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t*pDel = false;\r\n\t\t}\r\n\t} else {\r\n\t\t// ===============\r\n\t\t// Multiple texture can have same image sub symbol. --> Multiple delete on the same symbol can occur.\r\n\t\t// So assert is commented out.\r\n\t\t//\r\n\t\t// klb_assert((*curr==0),\"Symbol not found for deletion\");\r\n\t\t// ===============\r\n\t}\r\n}\r\n\r\nvoid Dictionnary::dump() {\r\n\tprintf(\"==== Start Dico dump ====\\n\");\r\n\tdump(m_pRoot, 0, false);\r\n\tprintf(\"\\n==== End Dico dump ====\\n\");\r\n}\r\n\r\nvoid Dictionnary::dump(CharEntry* pNode, int level, bool fitLine) {\r\n\tif (fitLine) {\r\n\t\tfor (int n = 0; n < level; n++) {\r\n\t\t\tprintf(\" \");\r\n\t\t}\r\n\t}\r\n\tfitLine = false;\r\n\r\n\tprintf(\"%c\",pNode->m_char);\r\n\tlevel++;\r\n\tCharEntry* pC = pNode->m_child;\r\n\twhile (pC) {\r\n\t\tdump(pC, level, fitLine);\r\n\t\tpC = pC->m_next;\r\n\t\tif (pC) {\r\n\t\t\tfitLine = true;\r\n\t\t\tprintf(\"\\n\");\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Core/Dictionnary.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLB_DICTIONNARY_H\r\n#define KLB_DICTIONNARY_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"ArrayAllocator.h\"\r\n\r\nclass Dictionnary;\r\n\r\nclass CharEntry {\r\n\tfriend class Dictionnary;\r\npublic:\r\n\tstatic void* operator new\t\t(size_t size, ArrayAllocator<CharEntry>* pAlloc); \r\n\tstatic void  operator delete\t(void *p,\t  ArrayAllocator<CharEntry>* pAlloc);\r\n\r\n\tCharEntry\t\t\t();\r\n\tCharEntry\t\t\t(Dictionnary* pOwner, char c, const void* value);\r\n\tCharEntry\t\t\t(Dictionnary* pOwner);\r\n\r\n\tvoid clear\t\t\t();\r\n\tbool findChildChar\t(CharEntry** pEntry, char c);\r\n\tvoid insertChild\t(CharEntry* pEntryBefore, CharEntry* pEntry);\r\n\tvoid removeChild\t(CharEntry* pEntry);\r\n\t\r\nprotected:\r\n\tCharEntry*\t\t\tm_next;\r\n\tCharEntry*\t\t\tm_child;\r\n\tDictionnary*\t\tm_pOwner;\r\npublic:\r\n\tconst void*\t\t\tm_value;\r\n\tu8\t\t\t\t\tm_childCount;\r\n\tchar\t\t\t\tm_char;\r\n};\r\n\r\ntypedef\tvoid\t(*cbDicoDelete)(const void* ctx, const void* ptr);\r\n\r\nclass Dictionnary {\r\n\tfriend class CharEntry;\r\npublic:\r\n\tDictionnary\t\t\t();\r\n\tDictionnary\t\t\t(const void* ctx, cbDicoDelete ptrFct);\r\n\tvirtual ~Dictionnary();\r\n\t\r\n\tbool init\t\t\t(u16 dicoSize);\r\n\tvoid dump\t\t\t();\r\n\tconst void* find\t(const char* string);\r\n\tvoid add\t\t\t(const char* string, const void* value);\r\n\tvoid remove\t\t\t(const char* string);\r\n\tvoid clear\t\t\t();\r\n\tvoid setOwnerCallback(const void* callBackContext, cbDicoDelete ptrFct);\r\nprivate:\r\n\tvoid removeRecursive(CharEntry* pNode, const char* curr, bool* pDel);\r\n\tvoid dump\t\t\t(CharEntry* pNode, int level, bool fitLine);\r\n\r\n\tArrayAllocator<CharEntry>\t\r\n\t\t\t\t\t\tallocator;\r\n\tCharEntry*\t\t\tm_pRoot;\r\n\tcbDicoDelete\t\tm_pCBDelete;\r\n\tconst void*\t\t\tm_pCBContext;\r\n};\r\n\r\n#endif // KLB_DICTIONNARY_H\r\n"
  },
  {
    "path": "Engine/source/Core/ITmpFile.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"ITmpFile.h\"\r\n\r\nITmpFile::ITmpFile() {}\r\nITmpFile::~ITmpFile() {}\r\n"
  },
  {
    "path": "Engine/source/Core/Message.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __MICRO_MSG_KLB_OBJECT_\r\n#define __MICRO_MSG_KLB_OBJECT_\r\n\r\n// Used by :\r\n// - Animation Node\t\t\tparam:time millisecond\r\n// - SWF Node\t\t\t\tparam:frame number\r\n// - Cell Animation Node\tparam:frame number\r\n//\r\n#define\t\tANIMATION_COMPLETE\t\t(1)\r\n\r\n// Used by :\r\n// - SWF Node\t\t\t\tparam:label index\r\n#define\t\tLABEL_REACHED\t\t\t(2)\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Core/encryptFile.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// ---------------------------------------------------------------\r\n#include <string.h>\r\n#include \"encryptFile.h\"\r\n\r\n/*!\r\n    @brief  コンストラクタ\r\n */\r\nCDecryptBaseClass::CDecryptBaseClass()\r\n: m_decrypt\t(false)\r\n, m_useNew\t(false)\r\n{\r\n\t// User context.\r\n\t// m_userCtx.members = initValue\r\n}\r\n\r\n/*!\r\n    @brief  複合化\r\n    @param[in]  void* ptr       暗号化されたデータ\r\n    @param[in]  u32 length      データの長さ\r\n    @return     void\r\n */\r\nvoid CDecryptBaseClass::decrypt(void* ptr, u32 length) {\r\n\t// \"Transparent\" encryption : do nothing.\r\n}\r\n\r\n/*!\r\n    @brief  複合化準備\r\n    @param[in]  const u8* ptr   ファイルパス\r\n    @return     void\r\n */\r\nu32 CDecryptBaseClass::decryptSetup(const u8* ptr, const u8* hdr) {\r\n\t// m_userCtx.m_rot\t= 0;\r\n\t// if (hdr[0] == MAGIC_BYTE0 && hdr[2] == MAGIC_BYTE1 && hdr[3] == MAGIC_BYTE2 && hdr[3] == MAGIC_BYTE3) {\r\n\t// \t\tm_useNew = true;\r\n\t// } else {\r\n\t\t\tm_useNew = false;\r\n\t// }\r\n\tm_decrypt\t= true;\r\n    //m_decrypt = false;\r\n\treturn m_useNew ? 1 : 0;\r\n}\r\n\r\nvoid CDecryptBaseClass::gotoOffset(u32 offset) {\r\n\t// Recompute and update your encryption context if we jump at a certain position into the encrypted stream.\r\n\t// gotoOffset is ALWAYS called BEFORE decrypt if a jump in the decoding stream occurs.\r\n}\r\n"
  },
  {
    "path": "Engine/source/Database/CKLBDatabase.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include \"CKLBDatabase.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"encryptFile.h\"\r\n\r\n// Get a private global symbol owning all the file systems of SQLite.\r\nextern \"C\" {\r\n\tsqlite3_vfs*\tgVfsList;\r\n}\r\n\r\n// Global Table of IO Methods for encrypted SQLite.\r\nsqlite3_io_methods\t\tgSQLiteEncryptIO;\r\nint\t\t\t\t\t\tgBaseSizeOsFile;\r\nbool\t\t\t\t\tgInitOnce = true;\r\nint (*gOpenDefaultSQLite)\t(sqlite3_vfs*, const char *zName, sqlite3_file*,int flags, int *pOutFlags);\r\n\r\n#define\tgetFileDecrypt(a)\t\t\t(WrapperFileDecrypt*)(&(((unsigned char*)a)[gBaseSizeOsFile]))\r\n\r\nstruct WrapperFileDecrypt {\r\n\t// Decrypt\r\n\t// File ptr\r\n\t// + Key, decrypt flag, ...\r\n\tCDecryptBaseClass\tm_decrypt;\r\n\tint\t\t\t\t\tm_size;\r\n\tvoid*\t\t\t\tm_file;\r\n\tbool\t\t\t\tm_no_op;\r\n\tint\t\t\t\t\tm_hasHeader;\r\n};\r\n\r\n// === SQLite OS Methods ===\r\nint fEncryptOpen\t\t\t\t\t(sqlite3_vfs*, const char *zName, sqlite3_file*, int flags, int *pOutFlags);\r\n\r\n// === SQLite IO Methods ===\r\nint fEncryptClose\t\t\t\t\t(sqlite3_file*);\r\nint fEncryptRead\t\t\t\t\t(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);\r\nint fEncryptWrite\t\t\t\t\t(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);\r\nint fEncryptTruncate\t\t\t\t(sqlite3_file*, sqlite3_int64 size);\r\nint fEncryptSync\t\t\t\t\t(sqlite3_file*, int flags);\r\nint fEncryptFileSize\t\t\t\t(sqlite3_file*, sqlite3_int64 *pSize);\r\nint fEncryptLock\t\t\t\t\t(sqlite3_file*, int);\r\nint fEncryptUnlock\t\t\t\t\t(sqlite3_file*, int);\r\nint fEncryptCheckReservedLock\t\t(sqlite3_file*, int *pResOut);\r\nint fEncryptFileControl\t\t\t\t(sqlite3_file*, int op, void *pArg);\r\nint fEncryptSectorSize\t\t\t\t(sqlite3_file*);\r\nint fEncryptDeviceCharacteristics\t(sqlite3_file*);\r\nint fEncryptShmMap\t\t\t\t\t(sqlite3_file*, int iPg, int pgsz, int, void volatile**);\r\nint fEncryptShmLock\t\t\t\t\t(sqlite3_file*, int offset, int n, int flags);\r\nvoid \r\n\tfEncryptShmBarrier\t\t\t\t(sqlite3_file*);\r\nint fEncryptShmUnmap\t\t\t\t(sqlite3_file*, int deleteFlag);\r\n\r\nint fEncryptClose\t\t\t\t\t(sqlite3_file* file)\r\n{\r\n\tWrapperFileDecrypt* fileDecrypt = getFileDecrypt(file);\r\n\tif (!fileDecrypt->m_no_op) {\r\n\t\tCPFInterface::getInstance().platform().ifclose(fileDecrypt->m_file);\r\n\t}\r\n\r\n\t// SQLITE_IOERR_CLOSE\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptRead\t\t\t\t\t(sqlite3_file* file, void* buff, int iAmt, sqlite3_int64 iOfst)\r\n{\r\n\tWrapperFileDecrypt* fileDecrypt = getFileDecrypt(file);\r\n\r\n\tif (!fileDecrypt->m_no_op) {\r\n\t\tfileDecrypt->m_decrypt.gotoOffset((u32)iOfst);\r\n\r\n\t\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\t\tpltf.ifseek(fileDecrypt->m_file, (long)(iOfst + (fileDecrypt->m_hasHeader * 4)), SEEK_SET);\r\n\t\tu32 readSize = pltf.ifread(buff, 1, iAmt, fileDecrypt->m_file);\r\n\r\n\t\tfileDecrypt->m_decrypt.decryptBlck(buff, readSize);\r\n\r\n\t\tif (readSize < iAmt) {\r\n\t\t\t/* Unread parts of the buffer must be zero-filled */\r\n\t\t\tmemset(&((char*)buff)[readSize], 0, iAmt-readSize);\r\n\t\t\treturn SQLITE_IOERR_SHORT_READ;\r\n\t\t}\r\n\r\n\t\t// printf(\"fEncryptRead Amount[%i] Offset[%i] \\n\", iAmt, iOfst);\r\n\t} else {\r\n\t\t// No op for read.\r\n\t\treturn SQLITE_IOERR;\r\n\t}\r\n\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptWrite\t\t\t\t\t(sqlite3_file* file, const void* data, int iAmt, sqlite3_int64 iOfst)\r\n{\r\n\tWrapperFileDecrypt* fileDecrypt = getFileDecrypt(file);\r\n\r\n\tif (!fileDecrypt->m_no_op) {\r\n\t\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\t\tint err = pltf.ifseek(fileDecrypt->m_file, (long)(iOfst + (fileDecrypt->m_hasHeader*4)), SEEK_SET);\r\n\r\n\t\tif (!err) {\r\n\t\t\tif (iAmt != 0) {\r\n\t\t\t\t// Recompute key at offset.\r\n\t\t\t\tfileDecrypt->m_decrypt.gotoOffset((u32)iOfst);\r\n\r\n\t\t\t\t// Allocate encrypted buffer\r\n\t\t\t\tu8* buff = (u8*)malloc(iAmt);\r\n\r\n\t\t\t\tif (buff) {\r\n\t\t\t\t\t// Copy original buffer\r\n\t\t\t\t\tmemcpy(buff,data,iAmt);\r\n\t\t\t\t\t// Encrypt Buffer. (NOTE : could optimize memcpy by having a SOURCE AND DEST BUFFER)\r\n\t\t\t\t\tfileDecrypt->m_decrypt.decryptBlck(buff, iAmt);\r\n\t\t\t\t\tpltf.ifwrite(buff, 1, iAmt, fileDecrypt->m_file);\t\t\r\n\t\t\t\t\tpltf.ifflush(fileDecrypt->m_file);\r\n\t\t\t\t\tfree(buff);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn SQLITE_ERROR;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn SQLITE_OK;\r\n\t\t}\r\n\t\treturn SQLITE_ERROR;\r\n\t} else {\r\n\t\treturn SQLITE_OK;\r\n\t}\r\n}\r\n\r\nint fEncryptTruncate\t\t\t\t(sqlite3_file* /*file*/, sqlite3_int64 /*size*/)\r\n{\r\n\twhile (1) {\tprintf(\"Unsupported\"); }\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptSync\t\t\t\t\t(sqlite3_file* /*file*/, int /*flags*/) \r\n{\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptFileSize\t\t\t\t(sqlite3_file* file, sqlite3_int64 *pSize)\r\n{\r\n\tif (pSize) {\r\n\t\tWrapperFileDecrypt* fileDecrypt = getFileDecrypt(file);\r\n\t\tif (!fileDecrypt->m_no_op) {\r\n\t\t\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\t\t\tint err = pltf.ifseek(fileDecrypt->m_file, 0, SEEK_END);\r\n\t\t\tif (err == 0) {\r\n\t\t\t\t*pSize = pltf.iftell(fileDecrypt->m_file) - (fileDecrypt->m_hasHeader * 4);\r\n\t\t\t} else {\r\n\t\t\t\treturn SQLITE_ERROR;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t*pSize = 0;\r\n\t\t}\r\n\t\t// printf(\"fEncryptFileSize %i \\n\", *pSize);\r\n\t}\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptLock\t\t\t\t\t(sqlite3_file* /*file*/, int /*lock*/)\r\n{\r\n\t// WrapperFileDecrypt* fileDecrypt = (WrapperFileDecrypt*)file;\r\n\t// printf(\"fEncryptLock %i \\n\", lock);\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptUnlock\t\t\t\t\t(sqlite3_file* /*file*/, int /*unlock*/)\r\n{\r\n\t// WrapperFileDecrypt* fileDecrypt = (WrapperFileDecrypt*)file;\r\n\t// printf(\"fEncryptUnLock %i \\n\", unlock);\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptCheckReservedLock\t\t(sqlite3_file* /*file*/, int* /*pResOut*/)\r\n{\r\n\t// WrapperFileDecrypt* fileDecrypt = (WrapperFileDecrypt*)file;\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptFileControl\t\t\t\t(sqlite3_file* /*file*/, int /*op*/, void* /*pArg*/)\r\n{\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptSectorSize\t\t\t\t(sqlite3_file* /*file*/)\r\n{\r\n\treturn 4096; // = SQLITE_DEFAULT_SECTOR_SIZE internal value.\r\n}\r\n\r\nint fEncryptDeviceCharacteristics\t(sqlite3_file* /*file*/)\r\n{\r\n\t// printf(\"fEncryptDeviceCharacteristics %8X\\n\", SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | SQLITE_IOCAP_POWERSAFE_OVERWRITE);\r\n\treturn SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | SQLITE_IOCAP_POWERSAFE_OVERWRITE;\r\n}\r\n\r\nint fEncryptShmMap\t\t\t\t\t(sqlite3_file*, int /*iPg*/, int /*pgsz*/, int, void volatile**)\r\n{\r\n\twhile (1) {\tprintf(\"Unsupported Memory Mapped Files\"); }\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptShmLock\t\t\t\t\t(sqlite3_file*, int /*offset*/, int /*n*/, int /*flags*/)\r\n{\r\n\twhile (1) {\tprintf(\"Unsupported Memory Mapped Files\"); }\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nvoid fEncryptShmBarrier\t\t\t\t(sqlite3_file*)\r\n{\r\n\twhile (1) {\tprintf(\"Unsupported Memory Mapped Files\"); }\r\n\t// Do nothing.\r\n}\r\n\r\nint fEncryptShmUnmap\t\t\t\t(sqlite3_file*, int /*deleteFlag*/)\r\n{\r\n\twhile (1) {\tprintf(\"Unsupported Memory Mapped Files\"); }\r\n\treturn SQLITE_OK;\r\n}\r\n\r\nint fEncryptOpen\t\t\t\t\t(sqlite3_vfs* vfs, const char *zName, sqlite3_file* file, int flags, int *pOutFlags) {\r\n\tWrapperFileDecrypt* fileDecrypt = getFileDecrypt(file);\r\n\r\n\tu32\t\t\tdwFlagsAndAttributes = 0;\r\n\tu32\t\t\tdwCreationDisposition;\r\n\tu32\t\t\tdwDesiredAccess;\r\n\tu32\t\t\tdwShareMode;\r\n\t// void *\t\tzConverted;              /* Filename in OS encoding */\r\n\tconst char*\tzUtf8Name\t= zName; /* Filename in UTF-8 encoding */\r\n\tint\t\t\tisExclusive = (flags & SQLITE_OPEN_EXCLUSIVE);\r\n\tint\t\t\tisDelete\t= (flags & SQLITE_OPEN_DELETEONCLOSE);\r\n\tint\t\t\tisCreate\t= (flags & SQLITE_OPEN_CREATE);\r\n\tint\t\t\tisReadonly\t= (flags & SQLITE_OPEN_READONLY);\r\n\tint\t\t\tisReadWrite\t= (flags & SQLITE_OPEN_READWRITE);\r\n\r\n\tint\t\t\teType       = flags & 0xFFFFFF00;  /* Type of file to open */\r\n\r\n\tint\t\t\tisOpenJournal = (isCreate && (\t   eType == SQLITE_OPEN_MASTER_JOURNAL \r\n\t\t\t\t\t\t\t\t\t\t\t\t|| eType == SQLITE_OPEN_MAIN_JOURNAL \r\n\t\t\t\t\t\t\t\t\t\t\t\t|| eType == SQLITE_OPEN_TEMP_JOURNAL\r\n\t\t\t\t\t\t\t\t\t\t\t\t|| eType == SQLITE_OPEN_SUBJOURNAL\r\n\t\t\t\t\t\t\t\t\t\t\t\t|| eType == SQLITE_OPEN_WAL\r\n\t\t\t\t\t\t\t\t\t\t\t\t));\r\n\r\n\tif (isOpenJournal) {\r\n\t\t// No-Operation\r\n\t\tfileDecrypt->m_no_op\t= true;\r\n\t\tfileDecrypt->m_file\t\t= (void*)0xFFFFFFFF;\r\n\t\t// return SQLITE_OK;\r\n\t\treturn SQLITE_ERROR;\r\n\t} else {\r\n\t\tfileDecrypt->m_no_op\t= false;\r\n\t}\r\n\r\n\t/* Check the following statements are true: \r\n\t**\r\n\t**   (a) Exactly one of the READWRITE and READONLY flags must be set, and \r\n\t**   (b) if CREATE is set, then READWRITE must also be set, and\r\n\t**   (c) if EXCLUSIVE is set, then CREATE must also be set.\r\n\t**   (d) if DELETEONCLOSE is set, then CREATE must also be set.\r\n\t*/\r\n\tklb_assert((isReadonly == 0 || isReadWrite==0) && (isReadWrite || isReadonly), \"SQLite Encrypt Wrapper\");\r\n\tklb_assert(isCreate == 0    || isReadWrite, \"SQLite Encrypt Wrapper\");\r\n\tklb_assert(isExclusive == 0 || isCreate,    \"SQLite Encrypt Wrapper\");\r\n\tklb_assert(isDelete == 0    || isCreate,    \"SQLite Encrypt Wrapper\");\r\n\r\n\t/* The main DB, main journal, WAL file and master journal are never \r\n\t** automatically deleted. Nor are they ever temporary files.  */\r\n\tklb_assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB ,        \"SQLite Encrypt Wrapper\");\r\n\tklb_assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL ,   \"SQLite Encrypt Wrapper\");\r\n\tklb_assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL , \"SQLite Encrypt Wrapper\");\r\n\tklb_assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL ,            \"SQLite Encrypt Wrapper\");\r\n\r\n\t/* Assert that the upper layer has set one of the \"file-type\" flags. */\r\n\tklb_assert( eType==SQLITE_OPEN_MAIN_DB  || eType==SQLITE_OPEN_TEMP_DB \r\n\t\t\t\t\t\t\t\t\t\t\t|| eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL \r\n\t\t\t\t\t\t\t\t\t\t\t|| eType==SQLITE_OPEN_SUBJOURNAL   || eType==SQLITE_OPEN_MASTER_JOURNAL \r\n\t\t\t\t\t\t\t\t\t\t\t|| eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL, \"SQLite Encrypt Wrapper\"\r\n\t);\r\n\r\n\t/* If the second argument to this function is NULL, generate a \r\n\t** temporary file name to use \r\n\t*/\r\n\tif( !zUtf8Name ){\r\n\t\tklb_assertAlways(\"Not supported\");\r\n\t\t/*\r\n\t\trc = getTempname(MAX_PATH+2, zTmpname);\r\n\t\tif( rc!=SQLITE_OK ){\r\n\t\treturn rc;\r\n\t\t}\r\n\t\tzUtf8Name = zTmpname;\r\n\t\t*/\r\n\t}\r\n\r\n\t/* Database filenames are double-zero terminated if they are not\r\n\t** URIs with parameters.  Hence, they can always be passed into\r\n\t** sqlite3_uri_parameter().\r\n\t*/\r\n\tklb_assert( (eType!=SQLITE_OPEN_MAIN_DB) || (flags & SQLITE_OPEN_URI) ||\r\n\t\t\t\tzUtf8Name[strlen(zUtf8Name)+1]==0, \"SQLite Encrypt Wrapper\" );\r\n\r\n\t/* Convert the filename to the system encoding. */\r\n\t/* Not used\r\n\tzConverted = convertUtf8Filename(zUtf8Name);\r\n\tif( zConverted==0 ){\r\n\treturn SQLITE_IOERR_NOMEM;\r\n\t} */\r\n\r\n#define GENERIC_READ\t\t(0x1)\r\n#define GENERIC_WRITE\t\t(0x2)\r\n\r\n#define CREATE_NEW\t\t\t\t\t(0x001)\r\n#define OPEN_ALWAYS\t\t\t\t\t(0x002)\r\n#define OPEN_EXISTING\t\t\t\t(0x004)\r\n#define FILE_SHARE_READ\t\t\t\t(0x008)\r\n#define FILE_SHARE_WRITE\t\t\t(0x010)\r\n#define FILE_ATTRIBUTE_TEMPORARY\t(0x020)\r\n#define FILE_ATTRIBUTE_NORMAL\t\t(0x040)\r\n#define FILE_ATTRIBUTE_HIDDEN\t\t(0x080)\r\n#define FILE_FLAG_DELETE_ON_CLOSE\t(0x100)\r\n\r\n\tif( isReadWrite ){\r\n\t\tdwDesiredAccess = GENERIC_READ | GENERIC_WRITE;\r\n\t}else{\r\n\t\tdwDesiredAccess = GENERIC_READ;\r\n\t}\r\n\r\n\t/* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is \r\n\t** created. SQLite doesn't use it to indicate \"exclusive access\" \r\n\t** as it is usually understood.\r\n\t*/\r\n\tif( isExclusive ){\r\n\t\t/* Creates a new file, only if it does not already exist. */\r\n\t\t/* If the file exists, it fails. */\r\n\t\tdwCreationDisposition = CREATE_NEW;\r\n\t}else if( isCreate ){\r\n\t\t/* Open existing file, or create if it doesn't exist */\r\n\t\tdwCreationDisposition = OPEN_ALWAYS;\r\n\t}else{\r\n\t\t/* Opens a file, only if it exists. */\r\n\t\tdwCreationDisposition = OPEN_EXISTING;\r\n\t}\r\n\r\n\tdwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;\r\n\r\n\tif( isDelete ) {\r\n\t#if SQLITE_OS_WINCE\r\n\t\tdwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN;\r\n\t\tisTemp = 1;\r\n\t#else\r\n\t\tdwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY\r\n\t\t| FILE_ATTRIBUTE_HIDDEN\r\n\t\t| FILE_FLAG_DELETE_ON_CLOSE;\r\n\t#endif\r\n\t}else{\r\n\t\tdwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;\r\n\t}\r\n\r\n\t/** Setup of wrapper for file system in all cases **/\r\n\t// Also call the original open.\r\n\t// Decided to DO NOT call the gOpenDefaultSQLite(vfs, zName, file, flags, pOutFlags);\r\n\tfile->pMethods = &gSQLiteEncryptIO; // Patch here because table is patch in original Open.\r\n\t// TODO enable decrypt : \r\n\tconst char* openMode;\r\n\tif (isReadonly) {\r\n\t\topenMode = \"rb\";\r\n\t} else {\r\n\t\topenMode = \"r+b\";\r\n\t}\r\n\r\n\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\tvoid* f = pltf.ifopen(zName, openMode);\t// Read and write possible, but must exist.\r\n\t\r\n\tif (f) {\r\n\t\tfileDecrypt->m_file\t= f;\r\n\t\tu8 header[4];\r\n\t\theader[0] = 0;\r\n\t\theader[1] = 0;\r\n\t\theader[2] = 0;\r\n\t\theader[3] = 0;\r\n\t\tpltf.ifread(header,1,4,f);\r\n\t\tfileDecrypt->m_hasHeader = fileDecrypt->m_decrypt.decryptSetup((const u8*)zName, header);\r\n\r\n\t\tpltf.ifseek(f, 0, SEEK_END);\r\n\t\tfileDecrypt->m_size = pltf.iftell(f) - (fileDecrypt->m_hasHeader*4);\r\n\t\tpltf.ifseek(f, (fileDecrypt->m_hasHeader*4), SEEK_SET);\r\n\r\n\t\treturn SQLITE_OK;\r\n\t} else {\r\n\t\tif (isCreate && (!isReadonly)) {\r\n\t\t\t// Force empty file creation\r\n\t\t\tif (pltf.icreateEmptyFile(zName)) {\r\n\t\t\t\t// Call back itself with a working empty file.\r\n\t\t\t\treturn fEncryptOpen(vfs, zName, file, flags, pOutFlags);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn SQLITE_ERROR;\r\n}\r\n\r\nstatic bool initEncryptedVFS() {\r\n\t// 1. Need initialize first to init vfsList global variable containing the default fileSystem.\r\n\tif ((sqlite3_initialize() == SQLITE_OK) && gInitOnce) {\r\n\t\tgInitOnce = false;\r\n\t\t// 2. Init Struct with all function pointers.\r\n\t\tgSQLiteEncryptIO.iVersion\t\t\t\t\t= 2;\r\n\t\tgSQLiteEncryptIO.xClose\t\t\t\t\t\t= fEncryptClose;\r\n\t\tgSQLiteEncryptIO.xRead\t\t\t\t\t\t= fEncryptRead;\r\n\t\tgSQLiteEncryptIO.xWrite\t\t\t\t\t\t= fEncryptWrite;\r\n\t\tgSQLiteEncryptIO.xTruncate\t\t\t\t\t= fEncryptTruncate;\r\n\t\tgSQLiteEncryptIO.xSync\t\t\t\t\t\t= fEncryptSync;\r\n\t\tgSQLiteEncryptIO.xFileSize\t\t\t\t\t= fEncryptFileSize;\r\n\t\tgSQLiteEncryptIO.xLock\t\t\t\t\t\t= fEncryptLock;\r\n\t\tgSQLiteEncryptIO.xUnlock\t\t\t\t\t= fEncryptUnlock;\r\n\t\tgSQLiteEncryptIO.xCheckReservedLock\t\t\t= fEncryptCheckReservedLock;\r\n\t\tgSQLiteEncryptIO.xFileControl\t\t\t\t= fEncryptFileControl;\r\n\t\tgSQLiteEncryptIO.xSectorSize\t\t\t\t= fEncryptSectorSize;\r\n\t\tgSQLiteEncryptIO.xDeviceCharacteristics\t\t= fEncryptDeviceCharacteristics;\r\n\t\tgSQLiteEncryptIO.xShmMap\t\t\t\t\t= fEncryptShmMap;\r\n\t\tgSQLiteEncryptIO.xShmLock\t\t\t\t\t= fEncryptShmLock;\r\n\t\tgSQLiteEncryptIO.xShmBarrier\t\t\t\t= fEncryptShmBarrier;\r\n\t\tgSQLiteEncryptIO.xShmUnmap\t\t\t\t\t= fEncryptShmUnmap;\r\n\r\n\t\tgVfsList = getVFSList();\r\n\r\n\t\t// 2.1 Patch the fileSystem xOpen function with custom function that wraps sqlist3_file*\r\n\t\tgOpenDefaultSQLite\t= gVfsList->xOpen;\r\n\t\tgVfsList->xOpen\t\t= fEncryptOpen;\r\n\t\t// 2.2 Patch the fileSystem vfs->szOsFile, add our own structure. (need to keep original because we wrap open)\r\n\t\tgBaseSizeOsFile\t\t= (gVfsList->szOsFile + 7) & 0xFFFFFFF8;\t// Align 8 byte.\r\n\t\tgVfsList->szOsFile\t= ((gBaseSizeOsFile + sizeof(WrapperFileDecrypt)) + 7) & 0xFFFFFFF8;\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nstatic int callbackFct (void* ctx,int colNum,char** columnText,char** columnName) {\r\n\treturn ((CKLBDatabase*)ctx)->callBack(colNum,columnText,columnName);\r\n}\r\n\r\nbool CKLBDatabase::init(const char* dbFile, int flags) {\r\n\t// At least initialize the encryption module for DBs, even without default DB.\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\tif (platform.useEncryption()) {\r\n\t\tinitEncryptedVFS();\r\n\t}\r\n\r\n\tif ((dbFile == NULL) || (m_dataBase && m_lastDB && strcmp(m_lastDB,dbFile) == 0)) {\r\n\t\t// Database is already known and was last open.\r\n\t\treturn true;\r\n\t}\r\n\r\n\t// Else release old Database and old name\r\n\t_release();\r\n\tint size = strlen(dbFile);\r\n\tm_lastDB = KLBNEWA(char, size+1);\r\n\r\n\tif (m_lastDB) {\r\n\t\t// New name set\r\n\t\tmemcpy(m_lastDB, dbFile, size);\r\n\t\tm_lastDB[size] = 0;\r\n\r\n\t\t// Convert Logical path to OS Dependant path\r\n\t\tconst char* fullPath = platform.getFullPath(dbFile);\r\n\r\n\t\t//int rc = sqlite3_open(fullPath, &m_dataBase);\r\n\t\tint rc = sqlite3_open_v2(fullPath, &m_dataBase, flags, NULL);\r\n\t\tdelete[] fullPath;\r\n\r\n\t\tif (rc) {\r\n\t\t\tklb_assertAlways(\"Can not open db %s\", dbFile);\r\n\t\t\t_release();\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tchar * errMsg;\r\n\t\tm_pragmaJournal = true;\r\n\t\trc = sqlite3_exec(m_dataBase, \"PRAGMA journal_mode = OFF;\", callbackFct, this, &errMsg);\r\n\t\tm_pragmaJournal = false;\r\n\r\n\t\tif (rc) {\r\n\t\t\tklb_assertAlways(\"Impossible to disable journal\");\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid CKLBDatabase::_release() {\r\n\tif (m_dataBase) {\r\n\t\tsqlite3_close(m_dataBase);\r\n\t\tm_dataBase = NULL;\r\n\t}\r\n\tKLBDELETEA(m_lastDB);\r\n\tm_lastDB = NULL;\r\n}\r\n\r\nint CKLBDatabase::callBack(int /*colNum*/,char** columnText,char** /*columnName*/) {\r\n\tif (!m_pragmaJournal) {\r\n\t\tif (columnText[0]) {\r\n\t\t\tm_result = atoi(columnText[0]);\r\n\t\t} else {\r\n\t\t\tm_result = 0;\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\ns32 CKLBDatabase::lookup(const char* table, const char* resultField, const char* className, const char* filterField, s32 filterValue) {\r\n\tchar buffer[512];\r\n\r\n\tm_result = 0xDEADBEEF;\r\n\r\n\tif (className) {\r\n\t\tif (filterField) {\r\n\t\t\tsprintf(buffer, \"SELECT %s FROM %s WHERE %s=%i AND class='%s';\",resultField,table,filterField,filterValue,className);\r\n\t\t} else {\r\n\t\t\tsprintf(buffer, \"SELECT %s FROM %s WHERE class='%s';\",resultField,table,className); \r\n\t\t}\r\n\t} else {\r\n\t\tif (filterField) {\r\n\t\t\tsprintf(buffer, \"SELECT %s FROM %s WHERE %s=%i;\",resultField,table,filterField,filterValue); \r\n\t\t} else {\r\n\t\t\tsprintf(buffer, \"SELECT %s FROM %s;\",resultField,table /*,className */);\r\n\t\t}\r\n\t}\r\n\r\n\tif (runStatement(buffer)) {\r\n\t\treturn m_result;\r\n\t} else {\r\n\t\tklb_assertAlways(\"lookup DB failure\");\r\n\t\treturn 0;\t// 0 on failure.\r\n\t}\r\n}\r\n\r\nbool CKLBDatabase::runStatement(const char* SQLStatement) {\r\n\tchar* errMsg;\r\n\tif (m_dataBase) {\r\n\t\tint rc = sqlite3_exec(m_dataBase, SQLStatement, callbackFct, this, &errMsg);\r\n\t\tif (rc!=SQLITE_OK) {\r\n\t\t\tklb_assertAlways(\"DB Error : %s\", errMsg);\r\n\t\t\tsqlite3_free(errMsg);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t} else {\r\n\t\tklb_assertAlways(\"DB Not open\");\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nCKLBDatabase::CKLBDatabase()\r\n:m_dataBase\t\t(NULL)\r\n,m_lastDB\t\t(NULL)\r\n{\r\n}\r\n\r\nCKLBDatabase::~CKLBDatabase() {\r\n\t_release();\r\n}\r\n"
  },
  {
    "path": "Engine/source/Database/CKLBDatabase.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// Wrapper around SQL Lite\r\n//\r\n\r\n#ifndef __KLB_DATABASE__\r\n#define __KLB_DATABASE__\r\n\r\n#include \"sqlite3.h\"\r\n#include \"BaseType.h\"\r\n\r\n/**\r\n\tDatabase Singleton.\r\n */\r\nclass CKLBDatabase {\r\npublic:\r\n\tinline\r\n\tstatic CKLBDatabase& getInstance() {\r\n\t\tstatic CKLBDatabase instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release\t\t()\t{ getInstance()._release();\t}\r\n\r\n\tbool\tinit\t\t\t(const char* dbFile, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);\r\n\r\n\ts32\t\tlookup\t\t\t(const char* table, const char* resultField, const char* className, const char* filterField, s32 filterValue);\r\n\r\n\tint\t\tcallBack\t\t(int colNum,char** columnText,char** columnName);\r\nprivate:\r\n\tsqlite3*\tm_dataBase;\r\n\tbool\t\tm_pragmaJournal;\r\n\tchar*\t\tm_lastDB;\r\n\ts32\t\t\tm_result;\r\n\t\r\n\tCKLBDatabase\t\t\t(CKLBDatabase const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t\t(CKLBDatabase const&);\t\t// Dont implement.\r\n\r\n\tbool\trunStatement\t(const char* SQLStatement);\r\n\r\n\tvoid\tinit\t\t\t();\r\n\r\n\tCKLBDatabase ();\r\n\t~CKLBDatabase();\r\n\tvoid _release();\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Database/CKLBLanguageDatabase.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLanguageDatabase.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nbool CKLBLanguageDatabase::addString(const char* id, const char* string) {\r\n\tconst char* newstr = CKLBUtility::copyString(string);\r\n\tif (newstr) {\r\n\t\tm_dictionnary->add(id, newstr);\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid CKLBLanguageDatabase::removeString(const char* id) {\r\n\tconst char * string = (const char*)m_dictionnary->find(id);\r\n\tif(string) {\r\n\t\tm_dictionnary->remove(id);\r\n\t\tKLBDELETEA(string);\r\n\t}\r\n}\r\n\r\nconst char* CKLBLanguageDatabase::loadStringFromDB(const char* id) {\r\n\tif (m_db) {\r\n\t\t// 1. SQL Load\r\n\t\t// 2. Add to dictionnary : done in callback\r\n\t\t// 3. Return loaded value.\r\n\t\tchar buffer[512];\r\n\t\tsprintf(buffer, \"SELECT %s,%s FROM %s WHERE %s='%s';\", m_fieldKey, m_fieldValue, m_tableName, m_fieldKey, id);\r\n\r\n\t\tif (runStatement(buffer)) {\r\n\t\t\treturn (const char*)m_dictionnary->find(id);\r\n\t\t} else {\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nbool CKLBLanguageDatabase::preLoadGroup(const char* groupID) {\r\n\tchar buffer[512];\r\n\r\n\tif (groupID && m_fieldGroup) {\r\n\t\t// Load a Group.\r\n\t\tsprintf(buffer, \"SELECT %s,%s FROM %s WHERE %s='%s';\", m_fieldKey, m_fieldValue, m_tableName, m_fieldGroup, groupID);\r\n\t} else {\r\n\t\t// Load complete table.\r\n\t\tsprintf(buffer, \"SELECT %s,%s FROM %s;\", m_fieldKey, m_fieldValue, m_tableName);\r\n\t}\r\n\r\n\tif (m_fieldGroup && runStatement(buffer)) {\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool CKLBLanguageDatabase::setupDB(const char* dbFile, const char* tableName, const char* keyField, const char* valueField, const char* groupField)\r\n{\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\tconst char* fullPath = platform.getFullPath(dbFile);\r\n\r\n\t//int rc = sqlite3_open(fullPath, &m_dataBase);\r\n\tint rc = sqlite3_open_v2(fullPath, &m_db, SQLITE_OPEN_READONLY, NULL);\r\n\tdelete[] fullPath;\r\n\r\n\tif (rc) {\r\n\t\t_release();\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_tableName\t\t= CKLBUtility::copyString(tableName);\r\n\tm_fieldValue\t= CKLBUtility::copyString(valueField);\r\n\tm_fieldKey\t\t= CKLBUtility::copyString(keyField);\r\n\r\n\tif (groupField) {\r\n\t\tm_fieldGroup\t= CKLBUtility::copyString(groupField);\r\n\t}\r\n\r\n\treturn (m_tableName!=NULL) && (m_fieldValue!=NULL) && (m_fieldKey!=NULL) && ((groupField!=NULL) ? (m_fieldGroup!=NULL) : true);\r\n}\r\n\r\n\r\n/**\r\n * Call back from SQLite for each record when loading language records.\r\n * -> Callback transfered to C++ callback.\r\n */\r\nint CKLBLanguageDatabase::callbackFct (void* ctx,int colNum,char** columnText,char** columnName) {\r\n\treturn ((CKLBLanguageDatabase*)ctx)->callBack(colNum,columnText,columnName);\r\n}\r\n\r\nint CKLBLanguageDatabase::callBack(int /*colNum*/,char** columnText,char** /*columnName*/) {\r\n\tif (columnText[0]) {\r\n\t\t// If each entry is valid. Add to the DB.\r\n\t\tconst char* newstr = CKLBUtility::copyString(columnText[1]);\r\n\t\tif (newstr) {\r\n\t\t\tm_dictionnary->add(columnText[0],newstr);\r\n\t\t} else {\r\n\t\t\treturn 1; // Error.\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nbool CKLBLanguageDatabase::runStatement(const char* SQLStatement) {\r\n\tchar* errMsg;\r\n\tif (m_db) {\r\n\t\tint rc = sqlite3_exec(m_db, SQLStatement, CKLBLanguageDatabase::callbackFct, this, &errMsg);\r\n\t\tif (rc!=SQLITE_OK) {\r\n\t\t\tklb_assertAlways(\"DB Error : %s\", errMsg);\r\n\t\t\tsqlite3_free(errMsg);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t} else {\r\n\t\tklb_assertAlways(\"DB Not open\");\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nconst char*\tCKLBLanguageDatabase::getString(const char* id) {\r\n\tif (id) {\r\n\t\tif (id[0] == '#') {\r\n\t\t\tconst char* old = id;\r\n\t\t\tid = (const char*)m_dictionnary->find(&id[1]);\r\n\t\t\tif (!id) {\r\n\t\t\t\tid = loadStringFromDB(&old[1]);\r\n\t\t\t\tif (!id) {\r\n\t\t\t\t\t// Asked for removal because assert popup during game.\r\n\t\t\t\t\t// klb_assertAlways(\"%s is not in Language database.\",old);\r\n\t\t\t\t\tid = old;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn id;\r\n}\r\n\r\nCKLBLanguageDatabase::CKLBLanguageDatabase()\r\n: m_db          (NULL)\r\n, m_tableName   (NULL)\r\n, m_fieldValue  (NULL)\r\n, m_fieldGroup  (NULL)\r\n, m_fieldKey    (NULL) \r\n, m_dictionnary (NULL)\r\n{\r\n\t// Do nothing.\r\n}\r\n\r\nbool CKLBLanguageDatabase::init() {\r\n\tm_dictionnary = KLBNEW(Dictionnary);\r\n\tif (m_dictionnary) {\r\n\t\tm_dictionnary->setOwnerCallback(this, callbackDictionnary);\r\n\t\tif (m_dictionnary->init(3000)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nCKLBLanguageDatabase::~CKLBLanguageDatabase() {\r\n\t// Dictionnary destroyed automatically.\r\n}\r\n\r\nvoid CKLBLanguageDatabase::callbackDictionnary(const void* /*this_*/, const void* ptrToDelete) {\r\n\t// Dico Entry Name String.\r\n\tKLBDELETEA((const char *)ptrToDelete);\t\r\n}\r\n\r\nvoid CKLBLanguageDatabase::_release() {\r\n\tif (m_dictionnary) {\r\n\t\tm_dictionnary->clear();\r\n\t}\r\n\r\n\tif (m_db) {\r\n\t\tsqlite3_close(m_db);\r\n\t\tm_db = NULL;\r\n\t}\r\n\r\n\tKLBDELETEA(m_tableName);\r\n\tKLBDELETEA(m_fieldValue);\r\n\tKLBDELETEA(m_fieldGroup);\r\n\tKLBDELETEA(m_fieldKey);\r\n\tKLBDELETE(m_dictionnary);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Database/CKLBLanguageDatabase.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLBLanguageDatabase_h__\r\n#define __CKLBLanguageDatabase_h__\r\n\r\n#include \"Dictionnary.h\"\r\n#include \"sqlite3.h\"\r\n\r\nclass CKLBLanguageDatabase {\r\npublic:\r\n\tstatic CKLBLanguageDatabase& getInstance() {\r\n\t\tstatic CKLBLanguageDatabase instance;\r\n\t\treturn instance;\r\n\t}\r\n\t\r\n\tstatic void release() {\tgetInstance()._release();\t}\r\n\t\r\n\tbool\tinit\t\t\t();\r\n\tbool\taddString\t\t(const char* id, const char* string);\r\n\tvoid\tremoveString\t(const char* id);\r\n\tconst char*\tgetString\t(const char* id);\r\n\r\n\tbool\tsetupDB\t\t\t(const char* dbFile,\r\n\t\t\t\t\t\t\t const char* tableName, \r\n\t\t\t\t\t\t\t const char* keyField, \r\n\t\t\t\t\t\t\t const char* valueField,\r\n\t\t\t\t\t\t\t const char* groupField\r\n\t\t\t\t\t\t\t );\r\n\r\n\tbool\tpreLoadGroup\t(const char* groupID);\r\n\r\nprivate:\r\n\t/* C like callback with object context for SQLite */\r\n\tstatic\r\n\tint\t\t\tcallbackFct\t\t\t(void* ctx,int colNum,char** columnText,char** columnName);\r\n\r\n\t/* Callback to object */\r\n\tint\t\t\tcallBack\t\t\t(int /*colNum*/,char** columnText,char** /*columnName*/);\r\n\r\n\tconst char*\tloadStringFromDB\t(const char* id);\r\n\tbool\t\trunStatement\t\t(const char* SQLStatement);\r\n\r\n\tsqlite3*\t\tm_db;\r\n\tconst char*\t\tm_tableName;\r\n\tconst char*\t\tm_fieldValue;\r\n\tconst char*\t\tm_fieldGroup;\r\n\tconst char*\t\tm_fieldKey;\r\n\tDictionnary*\tm_dictionnary;\r\n\t\r\n\tCKLBLanguageDatabase ();\r\n\t~CKLBLanguageDatabase();\r\n\tvoid _release();\r\n\t\r\n\tstatic void callbackDictionnary(const void* this_, const void* ptrToDelete);\r\n};\r\n\r\n#endif // \r\n"
  },
  {
    "path": "Engine/source/Database/CKLBLuaDB.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaDB.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nCKLBLuaDB\t*\tCKLBLuaDB::ms_begin = NULL;\r\nCKLBLuaDB\t*\tCKLBLuaDB::ms_end\t= NULL;\r\n\r\n\r\nCKLBLuaDB::CKLBLuaDB() \r\n: m_name(NULL)\r\n, m_db\t(NULL)\r\n, m_pLua(NULL)\r\n, m_idx\t(0)\r\n, m_prev(NULL)\r\n, m_next(NULL)\r\n{\r\n\tadd_link();\r\n}\r\n\r\nCKLBLuaDB::CKLBLuaDB(const char * db_asset, int flags) \r\n: m_name(NULL)\r\n, m_db\t(NULL)\r\n, m_pLua(NULL)\r\n, m_idx\t(0)\r\n, m_prev(NULL)\r\n, m_next(NULL)\r\n{\r\n\tadd_link();\r\n\topen(db_asset, flags);\r\n}\r\n\r\nCKLBLuaDB::~CKLBLuaDB()\r\n{\r\n\tclose();\r\n\tremove_link();\r\n\tKLBDELETEA(m_name);\r\n}\r\n\r\nu32\r\nCKLBLuaDB::getClassID()\r\n{\r\n\treturn CLS_KLBLUADB;\r\n}\r\n\r\n\r\nvoid\r\nCKLBLuaDB::add_link()\r\n{\r\n\tm_prev = ms_end;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tms_begin = this;\r\n\t}\r\n\tms_end = this;\r\n}\r\n\r\nvoid\r\nCKLBLuaDB::remove_link()\r\n{\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tms_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tms_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBLuaDB::setName(const char * name)\r\n{\r\n\tKLBDELETEA(m_name);\r\n\tm_name = NULL;\r\n\tif(name) {\r\n\t\tint len = strlen(name);\r\n\t\tchar * buf = KLBNEWA(char, len + 1);\r\n        if(!buf) { return false; }\r\n\t\tstrcpy(buf, name);\r\n\t\tm_name = (const char *)buf;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBLuaDB::open(const char * db_asset, int flags)\r\n{\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\tbool isReadOnly;\r\n\tconst char* fullpath = platform.getFullPath(db_asset,&isReadOnly);\r\n\r\n\t//\r\n\tif (isReadOnly && (flags & SQLITE_OPEN_READONLY) == 0) {\r\n\t\tklb_assertAlways(\"DB Write Enabled on Read Only file system.\");\r\n\t}\r\n\r\n\tif (!isReadOnly) {\r\n\t\tflags |= SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE;\r\n\t\tflags &= ~SQLITE_OPEN_READONLY;\r\n\t}\r\n\r\n\t// create が指定されていない場合、対象のDBファイルが見つからなければその時点でエラー\r\n\t/*\r\n\tif(!(flags & SQLITE_OPEN_CREATE)) {\r\n\t\tklb_assert(fullpath, \"DB file not found: %s\", db_asset);\r\n\t\treturn false;\r\n\t}*/\r\n\r\n\t// int rc = sqlite3_open(fullpath, &m_db);\r\n\tint rc = sqlite3_open_v2(fullpath, &m_db, flags, NULL);\r\n    if (!isReadOnly) {\r\n        CPFInterface::getInstance().platform().excludePathFromBackup(fullpath);\r\n    }\r\n\t\r\n\tdelete[] fullpath;\r\n\tif (rc) {\r\n\t\tklb_assertAlways(\"Can not open db %s\", db_asset);\r\n\t\tclose();\r\n\t\treturn false;\r\n\t}\r\n\r\n\tchar * errMsg;\r\n\tm_pragmaJournal = true;\r\n\trc = sqlite3_exec(m_db, \"PRAGMA journal_mode = OFF;\", CKLBLuaDB::row_callback, this, &errMsg);\r\n\tm_pragmaJournal = false;\r\n\r\n\tif (rc) {\r\n\t\tplatform.logging(\"Impossible to disable journal\");\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBLuaDB::close()\r\n{\r\n\tif (m_db) {\r\n\t\tsqlite3_close(m_db);\r\n\t\tm_db = NULL;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nint\r\nCKLBLuaDB::query(CLuaState * plua, const char * query)\r\n{\r\n\tCLuaState& lua = *plua;\r\n\tchar * errMsg;\r\n\tif(!m_db) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tm_pLua = plua;\r\n\tm_idx = 1;\r\n\r\n\tlua.retBoolean(true);\t// 成功前提でtrueを積んでおく\r\n\tlua.tableNew();\t// 親テーブルをスタック上に積んでおく\r\n\tint rc = sqlite3_exec(m_db, query, CKLBLuaDB::row_callback, this, &errMsg);\r\n\r\n\tif (rc != SQLITE_OK) {\r\n\t\t// 一応出力コンソールにログは出しておく。\r\n\t\tDEBUG_PRINT(\"[SQLite]%s\", errMsg);\r\n\r\n\t\t// lua.error(errMsg);\t// Luaでエラーを出すとscriptが中断されるので、エラーメッセージは基本出さない\r\n\t\tsqlite3_free(errMsg);\r\n\t\tlua.pop(2);\t\t// 積んでしまったテーブルをスタックから除去\r\n\t\tlua.retBoolean(false);\t// 第一戻り値としてfalseを積む\r\n\t\tlua.retInt(rc);\t// 第二戻り値としてエラーコードを積む\r\n\t\treturn 2;\r\n\t}\r\n\r\n\treturn 2;\r\n}\r\n\r\nconst char**\r\nCKLBLuaDB::query(const char* query) \r\n{\r\n\tif(!m_db) { return NULL; }\r\n\r\n\tchar * errMsg;\r\n\tm_idx = 1;\r\n\r\n\tint rc = sqlite3_exec(m_db, query, CKLBLuaDB::row_callback_luaFree, this, &errMsg);\r\n\t\r\n\tif (rc != SQLITE_OK) {\r\n\t\tDEBUG_PRINT(\"[SQLite]%s\", errMsg);\r\n\t\tsqlite3_free(errMsg);\r\n\t}\r\n\r\n\treturn (const char**)m_pLua;\r\n}\r\n\r\nint\r\nCKLBLuaDB::row_callback(void* ctx, int colNum, char** columnText, char** columnName)\r\n{\r\n\tCKLBLuaDB * pLDB = (CKLBLuaDB *)ctx;\r\n\tif (!pLDB->m_pragmaJournal) {\r\n\t\tCLuaState& lua = *(pLDB->m_pLua);\r\n\r\n\t\t// row になるtableのキーをスタックに積む\r\n\t\tlua.retInt(pLDB->m_idx);\r\n\t\tlua.tableNew();\t// rowになるテーブルをスタック上に新しく作る\r\n\r\n\t\tfor(int i = 0; i < colNum; i++) {\r\n\t\t\tlua.retString(columnName[i]);\t// keyの値\r\n\t\t\tlua.retString(columnText[i]);\t// valueの値\r\n\t\t\tlua.tableSet();\t\t\t\t\t// その二つをテーブルに格納\r\n\t\t}\r\n\r\n\t\tlua.tableSet();\t// テーブルを親テーブルに格納\r\n\r\n\t\tpLDB->m_idx++;\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaDB::row_callback_luaFree(void* ctx, int colNum, char** columnText, char** columnName)\r\n{\r\n\tCKLBLuaDB * pLDB = (CKLBLuaDB *)ctx;\r\n\tif (!pLDB->m_pragmaJournal) {\r\n\t\tconst char** strArr = KLBNEWA(const char*, colNum*2 + 1);\r\n\r\n\t\tstrArr[0] = (const char*)colNum;\r\n\t\tu32 idx = 1;\r\n\t\tfor(int i = 0; i < colNum; ++i) {\r\n\t\t\tstrArr[idx++] =\t(columnName[i])\t? CKLBUtility::copyString(columnName[i]) : NULL;\t// keyの値\r\n\t\t\tstrArr[idx++] =\t(columnText[i])\t? CKLBUtility::copyString(columnText[i]) : NULL;\t// valueの値\r\n\t\t}\r\n\r\n\t\tpLDB->m_pLua = (CLuaState *)strArr;\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n\r\nvoid\r\nCKLBLuaDB::closeAll()\r\n{\r\n\tCKLBLuaDB * pDB = ms_begin;\r\n\twhile(pDB) {\r\n\t\tCKLBLuaDB * pNXT = pDB->m_next;\r\n\t\tKLBDELETE(pDB);\r\n\t\tpDB = pNXT;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBLuaDB::dumpAll()\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tbool bResult = false;\r\n\tCKLBLuaDB * pDB = ms_begin;\r\n\twhile(pDB) {\r\n\t\tpForm.logging(\"[DB]<%p>:%s\", pDB, (pDB->m_name) ? pDB->m_name : \"(no name)\");\r\n\t\tbResult = true;\r\n\t\tpDB = pDB->m_next;\r\n\t}\r\n\treturn bResult;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Database/CKLBLuaDB.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaDB_h\r\n#define CKLBLuaDB_h\r\n#include \"sqlite3.h\"\r\n//#include \"sqlite3ext.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBObject.h\"\r\n\r\nclass CKLBLuaDB : public CKLBObjectScriptable\r\n{\r\npublic:\r\n\tCKLBLuaDB();\r\n\tCKLBLuaDB(const char * db_asset, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);\r\n\tvirtual ~CKLBLuaDB();\r\n\r\n\tu32 getClassID();\r\n\r\n\tinline bool state() {\r\n\t\treturn (m_db) ? true : false;\r\n\t}\r\n\r\n\tbool setName(const char * name);\r\n\r\n\t// DBファイルのオープン: 現在オープンしているDBがあれば、一旦クローズして再オープン\r\n\tbool open(const char * db_asset, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);\r\n\r\n\t// DBファイルのクローズ\r\n\tbool close();\r\n\r\n\t// SQLの実行。selectionがある場合、その内容をLuaテーブルとしてスタックに積む\r\n\tint query(CLuaState * lua, const char * sql);\r\n\tconst char** query(const char* query); // lua-free.\r\n\r\n\t// 現在生成されているCKLBLuaDB全てをクローズする\r\n\tstatic void closeAll();\r\n\r\n\t// 現在生成されているCKLBLuaDB全てをダンプする\r\n\tstatic bool dumpAll();\r\n\r\nprivate:\r\n\tvoid add_link();\r\n\tvoid remove_link();\r\n\r\n\tconst char\t\t*\tm_name;\r\n\tbool\t\t\t\tm_pragmaJournal;\r\n\r\n\tsqlite3\t\t\t*\tm_db;\r\n\tCLuaState\t\t*\tm_pLua;\r\n\tint\t\t\t\t\tm_idx;\r\n\r\n\tCKLBLuaDB\t\t*\tm_prev;\r\n\tCKLBLuaDB\t\t*\tm_next;\r\n\r\n\tstatic int row_callback\t\t\t(void* ctx,int colNum,char** columnText,char** columnName);\r\n\tstatic int row_callback_luaFree\t(void* ctx,int colNum,char** columnText,char** columnName);\r\n\r\n\tstatic\tCKLBLuaDB\t*\tms_begin;\r\n\tstatic\tCKLBLuaDB\t*\tms_end;\r\n};\r\n\r\n\r\n#endif // CKLBLuaDB_h\r\n"
  },
  {
    "path": "Engine/source/Database/DataSet.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef INCLUDE_DATASET_H\r\n#define INCLUDE_DATASET_H\r\n\r\n#include \"BaseType.h\"\r\n\r\nenum EMOVECODE {\r\n\tMOVE_SUCCEED,\r\n\tMOVE_EOF,\r\n\tMOVE_UNFETCH,\r\n};\r\n\r\ntypedef void*\tIDataRecord;\r\n\r\nclass IDataSource {\r\npublic:\r\n\tstatic const int\tTYPE_INT\t= 0;\r\n\tstatic const int\tTYPE_STR\t= 1;\r\n\tstatic const int\tTYPE_BOOL\t= 2;\r\n\tstatic const int\tTYPE_FLOAT\t= 3;\r\n\tstatic const int\tTYPE_NIL\t= 4;\r\n\tstatic const int\tTYPE_BLOB\t= 5;\r\n\t\r\n\tstatic\tIDataSource*\t\r\n\t\t\t\t\t\tdoQuery\t\t\t\t\t(const char* query);\r\n\tstatic\tvoid\t\treleaseQuery\t\t\t(IDataSource* pQuery);\r\n\t\r\n\t// -1 : Dynamic.\r\n\tvirtual\ts32\t\t\tgetTotalRecordCount\t\t() = 0;\r\n\t\r\n\t// Record loaded until now.\r\n\tvirtual s32\t\t\tgetCurrentRecordCount\t() = 0;\r\n\t\r\n\t// Request record if UNFETCH\r\n\tvirtual bool\t\tfetchRecords\t\t\t(u32 count) = 0;\r\n\t// Result of fetching (polling from user)\r\n\tvirtual bool\t\treceivedUpdate\t\t\t() = 0;\r\n\t\r\n\tvirtual\tEMOVECODE\tmoveTo\t\t\t\t\t(u32 record) = 0;\r\n\tvirtual\tEMOVECODE\tmoveNext\t\t\t\t() = 0;\r\n\tvirtual\tEMOVECODE\tmovePrevious\t\t\t() = 0;\r\n\r\n\tvirtual\tIDataRecord getRecord\t\t\t\t() = 0;\r\n\t\r\n\tvirtual u32\t\t\tgetFieldCount\t\t\t() = 0;\r\n\tvirtual\tconst char*\tgetFieldName\t\t\t(u32 index, u32& length) = 0;\r\n\tvirtual u32\t\t\tgetFieldType\t\t\t(u32 index) = 0;\r\n\tvirtual u32\t\t\tgetFieldIndex\t\t\t(const char* fieldName) = 0;\r\n\r\n\t// Access to one record.\r\n\tvirtual\ts32\t\t\tgetAsInt\t\t\t\t(IDataRecord rec, u32 index) = 0;\r\n\tvirtual const char*\tgetAsString\t\t\t\t(IDataRecord rec, u32 index, u32& length) = 0;\r\n\tvirtual bool\t\tgetAsBool\t\t\t\t(IDataRecord rec, u32 index) = 0;\r\n\tvirtual float\t\tgetAsFloat\t\t\t\t(IDataRecord rec, u32 index) = 0;\r\n    \r\n    virtual ~IDataSource() {};\r\n};\r\n\r\n#endif // INCLUDE_DATASET_H\r\n"
  },
  {
    "path": "Engine/source/Database/DataSet_JSonDB.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <math.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n\r\n#include \"DataSet_JSonDB.h\"\r\n\r\nJSonDB::JSonDB()\r\n:m_startRecord\t\t\t(NULL)\r\n,mStringRecordBuffer\t(NULL)\r\n{\r\n}\r\n\r\nJSonDB::~JSonDB() {\r\n\tclean();\r\n}\r\n\r\nvoid JSonDB::clean() {\r\n\tRecordListHeader* pRecord = m_startRecord;\r\n\twhile (pRecord) {\r\n\t\tRecordListHeader* pNextRecord = pRecord->pNextRecord;\r\n\t\tKLBDELETE(pRecord->fields);\r\n\t\tKLBDELETE(pRecord);\r\n\t\tpRecord = pNextRecord;\r\n\t}\r\n\tm_startRecord = NULL;\r\n\r\n\tKLBDELETEA(mStringRecordBuffer);\r\n\tmStringRecordBuffer = NULL;\r\n}\r\n\r\n/*static*/ int JSonDB::read_start_map\t\t(void * ctx, unsigned int size)\r\n{ return ((JSonDB*)ctx)->readStartMap(size); }\r\n/*static*/ int JSonDB::read_null\t\t\t(void * ctx)\r\n{ return ((JSonDB*)ctx)->readNull(); }\r\n/*static*/ int JSonDB::read_boolean\t\t\t(void * ctx, int boolean)\r\n{ return ((JSonDB*)ctx)->readBoolean(boolean); }\r\n/*static*/ int JSonDB::read_int\t\t\t\t(void * ctx, long long integerVal)\r\n{ return ((JSonDB*)ctx)->readInt(integerVal); }\r\n/*static*/ int JSonDB::read_double\t\t\t(void * ctx, double doubleVal)\r\n{ return ((JSonDB*)ctx)->readDouble(doubleVal); }\r\n/*static*/ int JSonDB::read_string\t\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool)\r\n{ return ((JSonDB*)ctx)->readString(stringVal, stringLen,cte_pool); }\r\n/*static*/ int JSonDB::read_map_key\t\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool)\r\n{ return ((JSonDB*)ctx)->readMapKey(stringVal, stringLen,cte_pool); }\r\n/*static*/ int JSonDB::read_end_map\t\t\t(void * ctx)\r\n{ return ((JSonDB*)ctx)->readEndMap(); }\r\n/*static*/ int JSonDB::read_start_array\t\t(void * ctx, unsigned int size)\r\n{ return ((JSonDB*)ctx)->readStartArray(size); }\r\n/*static*/ int JSonDB::read_end_array\t\t(void * ctx)\r\n{ return ((JSonDB*)ctx)->readEndArray(); }\r\n\r\n/*static*/\r\nIDataSource* JSonDB::openDB(const u8* source, u32 sourceLength) {\r\n\tJSonDB* newDB = KLBNEW(JSonDB);\r\n\tif (!newDB->readDBInternal(source, sourceLength)) {\r\n\t\tKLBDELETE(newDB);\r\n\t\tnewDB = NULL;\r\n\t}\r\n\treturn newDB;\r\n}\r\n\r\n\r\nbool JSonDB::readDBInternal(const u8* source, u32 sourceLength) {\r\n\tbool res = false;\r\n\tm_baseRecordHeader.fields\t\t= &m_field[0];\r\n\tm_baseRecordHeader.pNextRecord\t= NULL;\r\n\tm_arrayCnt\t\t= 0;\r\n\tm_record\t\t= 0;\r\n\tm_recordEntry\t= 0;\r\n\tm_stringAlloc\t= 0;\r\n\tm_startRecord\t= NULL;\r\n\tm_currRecIdx\t= 0;\r\n\tm_mapCnt\t\t= 0;\r\n\tm_res\t\t\t= MOVE_UNFETCH;\r\n\r\n\tmStringRecordBuffer\t= KLBNEWA(char, sourceLength);\r\n\tmStringRecordCount  = 0;\r\n\tm_StringRecordBufferSize = sourceLength;\r\n\r\n\tif (mStringRecordBuffer) {\r\n\t\tstatic yajl_callbacks callbacks = {  \r\n\t\t\tJSonDB::read_null,  \r\n\t\t\tJSonDB::read_boolean,  \r\n\t\t\tJSonDB::read_int,  \r\n\t\t\tJSonDB::read_double,  \r\n\t\t\tNULL,  \r\n\t\t\tJSonDB::read_string,  \r\n\t\t\tJSonDB::read_start_map,  \r\n\t\t\tJSonDB::read_map_key,  \r\n\t\t\tJSonDB::read_end_map,  \r\n\t\t\tJSonDB::read_start_array,  \r\n\t\t\tJSonDB::read_end_array\r\n\t\t};\r\n\r\n\t\tmemcpy(mStringRecordBuffer, source, sourceLength);\r\n\t\tyajl_handle hand;\r\n\t\t/* generator config */  \r\n//\t\tyajl_gen g;\t\t\t\t// My Context. 2012.12.06  使用していなかったのでコメントアウト\r\n\t\tyajl_status stat;  \r\n  \r\n//\t\tg = yajl_gen_alloc(NULL); // 2012.12.06  使用していなかったのでコメントアウト\r\n\r\n\t\t/* ok.  open file.  let's read and parse */  \r\n\t\thand = yajl_alloc(&callbacks, NULL, this);\r\n\t\tif (hand) {\r\n\t\t\tthis->parserCtx = hand;\r\n\r\n\t\t\t/* and let's allow comments by default */  \r\n\t\t\tyajl_config(hand, yajl_allow_comments, 1);\r\n\r\n\t\t\tstat = yajl_parse(hand, (const unsigned char*)mStringRecordBuffer, sourceLength);\r\n\r\n\t\t\tif (stat == yajl_status_ok) {\r\n\t\t\t\tstat = yajl_complete_parse(hand);\r\n\t\t\t\tif (stat == yajl_status_ok) {\r\n\t\t\t\t\tres = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!res) {\r\n\t\tclean();\r\n\t}\r\n\tm_recordPtr\t\t= m_startRecord;\r\n\treturn res;\r\n}\r\n\r\nint JSonDB::readNull()  \r\n{\r\n\tif (m_record == 1) {\r\n\t\t// Set data type to entry -> String for null, only type tolerated as we do not tolerate sub object / array for now.\r\n\t\tsetFieldType(m_entryIdx, TYPE_STR);\r\n\t}\r\n\tsetString(m_entryIdx, NULL, 0);\r\n    return 1;\r\n}\r\n  \r\nint JSonDB::readBoolean(int boolean)  \r\n{\r\n\tif (m_record == 1) {\r\n\t\t// Set data type to entry.\r\n\t\tsetFieldType(m_entryIdx, TYPE_BOOL);\r\n\t}\r\n\r\n\tsetBool(m_entryIdx, boolean);\r\n\treturn 1;  \r\n}  \r\n\r\nint JSonDB::readInt(long long integerVal)  \r\n{\r\n\tif (m_record == 1) {\r\n\t\t// Set data type to entry.\r\n\t\tsetFieldType(m_entryIdx, TYPE_INT);\r\n\t}\r\n\r\n\tsetInt(m_entryIdx, (s32)integerVal);\r\n    return 1;\r\n}\r\n  \r\nint JSonDB::readDouble(double doubleVal)  \r\n{\t\r\n\tif (m_record == 1) {\r\n\t\t// Set data type to entry.\r\n\t\tsetFieldType(m_entryIdx, TYPE_FLOAT);\r\n\t}\r\n\r\n\tsetFloat(m_entryIdx, (float)doubleVal);\r\n\treturn 1;\r\n}\r\n  \r\nint JSonDB::readString(const unsigned char * stringVal, size_t stringLen, int /*cte_pool*/)  \r\n{\r\n\tif (m_record == 1) {\r\n\t\t// Set data type to entry.\r\n\t\tsetFieldType(m_entryIdx, TYPE_STR);\r\n\t}\r\n\r\n\tsetString(m_entryIdx, stringVal, stringLen);\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nint JSonDB::readMapKey(const unsigned char * stringVal, size_t stringLen, int cte_pool)  \r\n{\r\n\tif (m_record == 1) {\r\n\t\tif (m_recordEntry < MAX_FIELD_PER_RECORD) {\r\n\t\t\t// Store name and index.\r\n\t\t\tm_entryIdx = addField(stringVal, stringLen);\r\n\t\t\tm_recordEntry++;\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"Limit is 64 field / record\");\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t} else {\r\n\t\tif (cte_pool > -1) {\r\n\t\t\tint id = bjson_getCPCacheID((yajl_handle)this->parserCtx, cte_pool);\r\n\t\t\tif (id != -1) {\r\n\t\t\t\tm_entryIdx = id;\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// remap key to index.\r\n\t\tm_entryIdx = getFieldID(stringVal, stringLen);\r\n\t\tif (m_entryIdx == -1) {\r\n\t\t\tklb_assertAlways(\"Record structure changed between records.\");\r\n\t\t}\r\n\r\n\t\tif (cte_pool > -1) {\r\n\t\t\tbjson_setCPCacheID((yajl_handle)this->parserCtx, cte_pool, m_entryIdx);\r\n\t\t}\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nint JSonDB::readStartMap(unsigned int /*size*/) {\r\n\tif (m_mapCnt == 0) {\r\n\t\tif (allocateRecord()) {\r\n\t\t\tm_record++;\r\n\t\t} else {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nint JSonDB::readEndMap()  \r\n{\r\n\tif (m_record == 1) {\r\n\t\tif (!allocateRecord()) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tcopyFromTempToRecord();\r\n\t\tm_startRecord = m_currRecord;\r\n\t}\r\n\treturn 1;  \r\n}\r\n\r\nint JSonDB::readStartArray(unsigned int /*size*/)\r\n{\r\n\tif (m_arrayCnt == 0) {\r\n\t\t// First level\r\n\t} else {\r\n\t\tklb_assertAlways(\"Do not support nested arrays in DB for now\");\r\n\t}\r\n\tm_arrayCnt++;\r\n\treturn 1;\r\n}\r\n\r\n/*static*/ \r\nint JSonDB::readEndArray()  {\r\n\tm_arrayCnt--;\r\n\treturn 1;\r\n}\r\n\r\ns32\t JSonDB::addField(const unsigned char* str, s32 strLen) {\r\n\tklb_assert((m_stringAlloc + strLen+1) < DB_MAX_STRING_POOL_SIZE, \"Field Name String pool too small.\");\r\n\tmemcpy(&m_stringBuffer[m_stringAlloc], str, strLen);\r\n\tm_fieldName[m_recordEntry] = (u16)m_stringAlloc;\r\n\tm_stringBuffer[m_stringAlloc + strLen] = 0; // End string.\r\n\tm_stringAlloc += strLen + 1;\r\n\treturn m_recordEntry;\r\n}\r\n\r\nvoid JSonDB::setFieldType\t(s32 field, u8 type) {\r\n\tklb_assert(((u32)field) < MAX_FIELD_PER_RECORD, \"Invalid field index\");\r\n\tm_fieldType[field] = type;\r\n}\r\n\r\nbool JSonDB::allocateRecord\t() {\r\n\tif (m_record != 0) {\r\n\t\tRecordListHeader* pRecord = (RecordListHeader*)KLBNEWA(u8, sizeof(RecordListHeader) + 4 + (m_recordEntry * sizeof(Field)));\r\n\t\tif (pRecord) {\r\n\t\t\t// Init new record.\r\n\t\t\tpRecord->pNextRecord\t= NULL;\r\n\t\t\tpRecord->fields\t\t\t= (Field*)&pRecord[1];\t// Trick : use field after record header in memory.\r\n\r\n\t\t\t// Connect to link list and go to next element.\r\n\t\t\tm_currRecord->pNextRecord\t= pRecord;\r\n\t\t\tm_currRecord\t\t\t\t= pRecord;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t} else {\r\n\t\tm_currRecord = &m_baseRecordHeader;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid JSonDB::copyFromTempToRecord() {\r\n\t// Move data to first allocated record\r\n\tmemcpy(m_currRecord->fields, this->m_field,m_recordEntry * sizeof(Field));\r\n}\r\n\r\nvoid JSonDB::setInt\t\t\t(s32 idx, s32 value) {\r\n\tklb_assert(m_fieldType[idx]==TYPE_INT,\"Type does not match\");\r\n\tklb_assert(((u32)idx) < m_recordEntry, \"Field index out of range\");\r\n\tm_currRecord->fields[idx].v.i = value;\r\n}\r\n\r\nvoid JSonDB::setFloat\t\t(s32 idx, float value) {\r\n\tklb_assert(m_fieldType[idx]==TYPE_FLOAT,\"Type does not match\");\r\n\tklb_assert(((u32)idx) < m_recordEntry, \"Field index out of range\");\r\n\tm_currRecord->fields[idx].v.f = value;\r\n}\r\n\r\nvoid JSonDB::setBool\t\t(s32 idx, s32 value) {\r\n\tklb_assert(m_fieldType[idx]==TYPE_BOOL,\"Type does not match\");\r\n\tklb_assert(((u32)idx) < m_recordEntry, \"Field index out of range\");\r\n\tm_currRecord->fields[idx].v.b = value ? true : false;\r\n}\r\n\r\ns32 JSonDB::getTotalRecordCount\t\t() {\r\n\treturn m_record;\r\n}\r\n\r\ns32 JSonDB::getCurrentRecordCount\t() {\r\n\treturn m_record;\r\n}\r\n\r\nbool JSonDB::fetchRecords\t\t\t(u32 /*count*/) {\r\n\t// All fetched\r\n\treturn true;\r\n}\r\n\r\nbool JSonDB::receivedUpdate\t\t\t() {\r\n\t// Data always available\r\n\treturn true;\r\n}\r\n\r\nconst char*\tJSonDB::getFieldName(u32 index, u32& len) {\r\n\tklb_assert(index < m_recordEntry, \"Field index out of range\");\r\n\tlen = strlen(&m_stringBuffer[m_fieldName[index]]);\r\n\treturn &m_stringBuffer[m_fieldName[index]];\r\n}\r\n\r\ns32 JSonDB::getFieldID(const unsigned char* str, s32 strLen) {\r\n\tklb_assert((m_stringAlloc + strLen+1) < DB_MAX_STRING_POOL_SIZE, \"Field Name String pool too small for temp usage.\");\r\n\r\n\t// Copy and create temp string (do NOT modify m_stringAlloc : no allocation really done)\r\n\tmemcpy(&m_stringBuffer[m_stringAlloc], str, strLen);\r\n\tm_stringBuffer[m_stringAlloc + strLen] = 0; // End string.\r\n\r\n\treturn this->getFieldIndex(&m_stringBuffer[m_stringAlloc]);\r\n}\r\n\r\nvoid JSonDB::setString\t\t(s32 idx, const unsigned char* str, s32 strLen) { \r\n\tklb_assert(m_fieldType[idx]==TYPE_STR,\"Type does not match\");\r\n\tklb_assert(((u32)idx) < m_recordEntry, \"Field index out of range\");\r\n\tklb_assert((mStringRecordCount+strLen) < m_StringRecordBufferSize, \"String buffer full\");\r\n\r\n\tif (str && strLen) {\r\n\t\tmemcpy(&mStringRecordBuffer[mStringRecordCount], str, strLen);\r\n\t\tmStringRecordBuffer[mStringRecordCount + strLen] = 0; // End string.\r\n\r\n\t\tm_currRecord->fields[idx].v.str = mStringRecordCount;\r\n\t\tmStringRecordCount += strLen + 1;\r\n\t} else {\r\n\t\tm_currRecord->fields[idx].v.str = -1;\r\n\t}\r\n}\r\n\r\nconst char*\tJSonDB::getAsString\t(IDataRecord rec, u32 index, u32& len) {\r\n\tklb_assert(m_fieldType[index]==TYPE_STR,\"Type does not match\");\r\n\tklb_assert(index < m_recordEntry, \"Field index out of range\");\r\n\tRecordListHeader* pRecord = (RecordListHeader*)rec;\r\n\tconst char* res;\r\n\tif (pRecord->fields[index].v.str != -1) {\r\n\t\tres = &mStringRecordBuffer[pRecord->fields[index].v.str];\r\n\t\tlen = strlen(res);\r\n\t} else {\r\n\t\tres = NULL;\r\n\t\tlen = 0;\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nEMOVECODE JSonDB::moveTo(u32 rec) {\r\n\tRecordListHeader* p = m_startRecord;\r\n\tu32 counter = 0;\r\n\twhile (p) {\r\n\t\tif (counter == rec) {\r\n\t\t\tm_res\t\t\t= MOVE_SUCCEED;\r\n\t\t\tm_recordPtr\t\t= p;\r\n\t\t\tm_currRecIdx\t= rec;\r\n\t\t\treturn m_res;\r\n\t\t}\r\n\t}\r\n\r\n\tm_res\t\t= MOVE_EOF;\r\n\tm_recordPtr = p;\r\n\tm_currRecIdx= m_record;\r\n\treturn m_res;\r\n}\r\n\r\nEMOVECODE JSonDB::moveNext() {\r\n\tif (m_currRecIdx < m_record) {\r\n\t\tm_currRecIdx++;\r\n\t\tm_recordPtr = m_recordPtr->pNextRecord;\r\n\t} else {\r\n\t\tm_recordPtr = NULL;\r\n\t}\r\n\r\n\tm_res = (m_recordPtr != NULL) ? MOVE_SUCCEED : MOVE_EOF;\r\n\treturn m_res;\r\n}\r\n\r\nEMOVECODE JSonDB::movePrevious() {\r\n\tif (m_currRecIdx > 0) {\r\n\t\tm_currRecIdx--;\r\n\t\tmoveTo(m_currRecIdx);\r\n\t} else {\r\n\t\tm_recordPtr = NULL;\r\n\t}\r\n\tm_res = (m_recordPtr != NULL) ? MOVE_SUCCEED : MOVE_EOF;\r\n\treturn m_res;\r\n}\r\n\r\nIDataRecord JSonDB::getRecord() {\r\n\tif (m_res == MOVE_SUCCEED) {\r\n\t\treturn (IDataRecord)m_recordPtr;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nu32\tJSonDB::getFieldCount() {\r\n\treturn this->m_recordEntry;\r\n}\r\n\r\nu32\tJSonDB::getFieldType(u32 index) {\r\n\tklb_assert(((u32)index) < MAX_FIELD_PER_RECORD, \"Invalid field index\");\r\n\treturn m_fieldType[index];\r\n}\r\n\r\nu32\tJSonDB::getFieldIndex(const char* fieldName) {\r\n\tfor (u32 idx = 0; idx < m_recordEntry; idx++) {\r\n\t\tif (strcmp(fieldName, &this->m_stringBuffer[m_fieldName[idx]]) == 0) {\r\n\t\t\treturn idx;\r\n\t\t}\r\n\t}\r\n\treturn 0xFFFFFFFF;\r\n}\r\n\r\ns32\tJSonDB::getAsInt\t\t(IDataRecord rec, u32 index) {\r\n\tklb_assert(m_fieldType[index]==TYPE_INT,\"Type does not match\");\r\n\tklb_assert(index < m_recordEntry, \"Field index out of range\");\r\n\tRecordListHeader* pRecord = (RecordListHeader*)rec;\r\n\treturn pRecord->fields[index].v.i;\r\n}\r\n\r\nbool JSonDB::getAsBool\t\t(IDataRecord rec, u32 index) {\r\n\tklb_assert(m_fieldType[index]==TYPE_BOOL,\"Type does not match\");\r\n\tklb_assert(index < m_recordEntry, \"Field index out of range\");\r\n\tRecordListHeader* pRecord = (RecordListHeader*)rec;\r\n\treturn pRecord->fields[index].v.b;\r\n}\r\n\r\nfloat JSonDB::getAsFloat\t(IDataRecord rec, u32 index) {\r\n\tklb_assert(m_fieldType[index]==TYPE_FLOAT,\"Type does not match\");\r\n\tklb_assert(index < m_recordEntry, \"Field index out of range\");\r\n\tRecordListHeader* pRecord = (RecordListHeader*)rec;\r\n\treturn pRecord->fields[index].v.f;\r\n}\r\n\r\n/*\r\nstatic const char* testStr = \"[ { \\\"hello\\\": 1, \\\"valuebool\\\": true, \\\"nilfield\\\": null, \\\"strfield\\\": \\\"hello world\\\" }, { \\\"hello\\\": 2, \\\"valuebool\\\": false, \\\"nilfield\\\": \\\"string guys\\\", \\\"strfield\\\": \\\"hello world 2\\\" } ]\";\r\n\r\nclass DInitializer {\r\npublic:\r\n\tDInitializer();\r\n};\r\n\r\n// Global variable force constructor exec.\r\nDInitializer _gInit;\r\n\r\nDInitializer::DInitializer() {\r\n\tIDataSource* pDBObj = JSonDB::openDB((const u8*)testStr, strlen(testStr));\r\n}\r\n*/\r\n"
  },
  {
    "path": "Engine/source/Database/DataSet_JSonDB.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef DataSet_JSonDB_h\r\n#define DataSet_JSonDB_h\r\n\r\n#include \"../../libs/JSonParser/api/yajl_parse.h\"\r\n#include \"../../libs/JSonParser/api/yajl_gen.h\"\r\n\r\n#include \"DataSet.h\"\r\n\r\nstruct Field {\r\n\tunion {\r\n\t\tfloat\tf;\r\n\t\ts32\t\ti;\r\n\t\ts32\t\tstr;\t// Strinf offset index.\r\n\t\tbool\tb;\r\n\t} v;\r\n};\r\n\r\nstruct RecordListHeader {\r\n\tRecordListHeader*\tpNextRecord;\r\n\tField*\t\t\t\tfields;\r\n};\r\n\r\nclass JSonDB : IDataSource {\r\n\t#define MAX_FIELD_PER_RECORD\t(64)\r\npublic:\r\n\tstatic\r\n\tIDataSource*\t\topenDB\t\t\t\t\t(const u8* source, u32 sourceLength);\r\n\r\n\tstatic\r\n\tvoid\t\t\t\tcloseDB\t\t\t\t\t(IDataSource* pSrc);\r\n\r\n\tvirtual\ts32\t\t\tgetTotalRecordCount\t\t();\r\n\tvirtual s32\t\t\tgetCurrentRecordCount\t();\r\n\tvirtual bool\t\tfetchRecords\t\t\t(u32 count);\r\n\tvirtual bool\t\treceivedUpdate\t\t\t();\r\n\r\n\tvirtual\tEMOVECODE\tmoveTo\t\t\t\t\t(u32 record);\r\n\tvirtual\tEMOVECODE\tmoveNext\t\t\t\t();\r\n\tvirtual\tEMOVECODE\tmovePrevious\t\t\t();\r\n\r\n\tvirtual\tIDataRecord getRecord\t\t\t\t();\r\n\tvirtual u32\t\t\tgetFieldCount\t\t\t();\r\n\tvirtual\tconst char*\tgetFieldName\t\t\t(u32 index, u32& len);\r\n\tvirtual u32\t\t\tgetFieldType\t\t\t(u32 index);\r\n\tvirtual u32\t\t\tgetFieldIndex\t\t\t(const char* fieldName);\r\n\r\n\tvirtual\ts32\t\t\tgetAsInt\t\t\t\t(IDataRecord rec, u32 index);\r\n\tvirtual const char*\tgetAsString\t\t\t\t(IDataRecord rec, u32 index, u32& len);\r\n\tvirtual bool\t\tgetAsBool\t\t\t\t(IDataRecord rec, u32 index);\r\n\tvirtual float\t\tgetAsFloat\t\t\t\t(IDataRecord rec, u32 index);\r\nprotected:\r\n\tbool readDBInternal\t(const u8* source, u32 sourceLength);\r\nprivate:\r\n\tJSonDB();\r\n\t~JSonDB();\r\n\r\n\t//\r\n\t// Parser Call back.\r\n\t//\r\n\tint readStartMap\t(unsigned int size);\r\n\tint readNull\t\t();\r\n\tint readBoolean\t\t(int boolean);\r\n\tint readInt\t\t\t(long long integerVal);\r\n\tint readDouble\t\t(double doubleVal);\r\n\tint readString\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readMapKey\t\t(const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tint readEndMap\t\t();\r\n\tint readStartArray\t(unsigned int size);\r\n\tint readEndArray\t();\r\n\r\n\tstatic int read_start_map\t(void * ctx, unsigned int size);\r\n\tstatic int read_null\t\t(void * ctx);\r\n\tstatic int read_boolean\t\t(void * ctx, int boolean);\r\n\tstatic int read_int\t\t\t(void * ctx, long long integerVal);\r\n\tstatic int read_double\t\t(void * ctx, double doubleVal);\r\n\tstatic int read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_end_map\t\t(void * ctx);\r\n\tstatic int read_start_array\t(void * ctx, unsigned int size);\r\n\tstatic int read_end_array\t(void * ctx);\r\n\r\n\r\n\t//\r\n\t// Record setup inner.\r\n\t//\r\n\ts32  getFieldID\t\t(const unsigned char* str, s32 strLen);\r\n\ts32\t addField\t\t(const unsigned char* str, s32 strLen);\r\n\tvoid setFieldType\t(s32 field, u8 type);\r\n\tbool allocateRecord\t();\r\n\tvoid copyFromTempToRecord();\r\n\tvoid setInt\t\t\t(s32 idx, s32 value);\r\n\tvoid setFloat\t\t(s32 idx, float value);\r\n\tvoid setString\t\t(s32 idx, const unsigned char* str, s32 strLen);\r\n\tvoid setBool\t\t(s32 idx, s32 value);\r\n\tvoid clean\t\t\t();\r\n\r\nprivate:\r\n\tEMOVECODE\tm_res;\r\n\r\n\t#define DB_MAX_STRING_POOL_SIZE\t(1000)\r\n\r\n\tchar\t\t\t\tm_stringBuffer[DB_MAX_STRING_POOL_SIZE];\t// Field Name only, 1 KB should be enough\r\n\tu32\t\t\t\t\tm_stringAlloc;\r\n\r\n\tu8\t\t\t\t\tm_fieldType[64];\t// Limit to 64 field per record.\r\n\tu16\t\t\t\t\tm_fieldName[64];\r\n\tRecordListHeader\tm_baseRecordHeader;\r\n\tField\t\t\t\tm_field[64];\r\n\tRecordListHeader*\tm_currRecord;\t\t// Current parser record.\r\n\tRecordListHeader*\tm_startRecord;\r\n\tRecordListHeader*\tm_recordPtr;\t\t// Current navigation record.\r\n\r\n\tchar*\t\t\t\tmStringRecordBuffer;\r\n\tu32\t\t\t\t\tmStringRecordCount;\r\n\tu32\t\t\t\t\tm_StringRecordBufferSize;\r\n\r\n\ts32 m_entryIdx;\t\t\t// Current Field\r\n\tu32 m_record;\t\t\t// Record Count\r\n\tu32 m_recordEntry;\t\t// Field Count\r\n\tu32 m_mapCnt;\t\t\t// Parser Map Nest Counter\r\n\tu32 m_arrayCnt;\t\t\t// Parser Array Nest Count\r\n\tu32 m_currRecIdx;\t\t// Current navigation record index.\r\n\tyajl_handle parserCtx;\t// Parser context pointer for callback.\r\n};\r\n\r\n#endif // DataSet_JSonDB_h\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBHTTPInterface.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBHTTPInterface.h\"\r\n#include \"CKLBUtility.h\"\r\n#include <string.h>\r\n#include <ctype.h>\r\n;\r\n\r\n#ifdef USE_NEW_CURL_WRAPPER\r\n\r\n#include \"curl.h\"\r\n\r\n// Prototypes\r\nint strncmpi(const char* str1, const char* str2, int len);\r\n\r\n// static\r\nbool CKLBHTTPInterface::initHTTPLib()\r\n{\r\n\treturn curl_global_init(CURL_GLOBAL_ALL) == CURLE_OK;\r\n}\r\n\r\n// static\r\nvoid CKLBHTTPInterface::releaseHTTPLib() {\r\n\tcurl_global_cleanup();\r\n}\r\n\r\n//_______________________________________________________________________\r\n//  Thread\r\n//_______________________________________________________________________\r\n\r\n// static\r\ns32 CKLBHTTPInterface::HTTPConnectionThread(void * /*hThread*/, void * data) \r\n{\r\n\t((CKLBHTTPInterface*)data)->download();\r\n\treturn 1;\r\n}\r\n\r\nvoid CKLBHTTPInterface::download() {\r\n\tm_threadStop = 0;\r\n\tm_pCurl      = curl_easy_init();\r\n\tif(m_pCurl)\r\n\t{\r\n\t\tcurl_slist* headerlist = NULL;\r\n\t\tif (m_post) {\r\n\t\t\theaderlist = curl_slist_append(headerlist, \"Expect:\");\r\n\t\t}\r\n\r\n\t\tfor (u32 n = 0; n < m_headerEntryCount; n++) {\r\n\t\t\t// printf(\"Hdr : %s\\n\",m_headerEntry[n]);\r\n\t\t\theaderlist = curl_slist_append(headerlist, m_headerEntry[n]);\r\n\t\t}\r\n\r\n\t\tcurl_httppost* formpost = NULL;\r\n\t\tcurl_httppost* lastptr  = NULL;\r\n\t\tif (m_post && m_postForm) {\r\n\t\t\tfor(u32 i = 0; m_postForm[i]; i++) {\r\n\t\t\t\tchar * formItem = (char*)m_postForm[i]; // We need to put back as writable.\r\n\r\n\t\t\t\t// split into two strings.\r\n\t\t\t\t// Search for first \"=\" and patch with 0.\r\n\t\t\t\tchar * ptr = formItem;\r\n\t\t\t\twhile (*ptr != 0 && *ptr != '=') { ptr++; }\r\n\r\n\t\t\t\tif (*ptr != 0) {\r\n\t\t\t\t\t*ptr = 0;\r\n\t\t\t\t\t// printf(\"Form : %s = %s\\n\",formItem,&ptr[1]);\r\n\t\t\t\t\tcurl_formadd(\r\n\t\t\t\t\t\t&formpost,\r\n\t\t\t\t\t\t&lastptr,\r\n\t\t\t\t\t\tCURLFORM_COPYNAME, formItem,\r\n\t\t\t\t\t\tCURLFORM_CONTENTSLENGTH, strlen(&ptr[1]),\r\n\t\t\t\t\t\tCURLFORM_COPYCONTENTS, &ptr[1],\r\n\t\t\t\t\t\tCURLFORM_END\r\n\t\t\t\t\t);\r\n\t\t\t\t\t// Restore array in case of reuse...\r\n\t\t\t\t\t*ptr = '=';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_HTTPHEADER, headerlist);\r\n\t\tif (m_post) {\r\n\t\t\tcurl_easy_setopt(m_pCurl, CURLOPT_HTTPPOST, formpost);\r\n\t\t}\r\n\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_URL,\t\t\t\tm_url\t\t\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_WRITEDATA,\t\t(void*)this\t\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_WRITEFUNCTION,\twrite_func\t\t);\r\n//\t\tcurl_easy_setopt(m_pCurl, CURLOPT_READFUNCTION,\t\tmy_read_func\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_NOPROGRESS,\t\t0L\t\t\t\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_NOSIGNAL,\t\t\t1\t\t\t\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_PROGRESSFUNCTION,\tprogress_func\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_PROGRESSDATA,\t\t(void*)this\t\t);\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_WRITEHEADER,\t\t(void*)this\t\t);\r\n \t\tcurl_easy_setopt(m_pCurl, CURLOPT_HEADERFUNCTION,\theaderReceive_func);\r\n#ifndef _WIN32\r\n\t\tcurl_easy_setopt(m_pCurl, CURLOPT_ACCEPT_ENCODING,\t\"gzip,deflate\");\r\n#endif\r\n\t\tCURLcode res = curl_easy_perform(m_pCurl);\r\n\t\tif (res == CURLE_OK) {\r\n\t\t\tcurl_easy_getinfo (m_pCurl, CURLINFO_RESPONSE_CODE, &m_errorCode);\r\n\t\t\t// WARNING : IN THAT ORDER, because of multithreading, flag set LAST, after everything else.\r\n\t\t\tm_receivedData\t= m_buffer;\r\n\t\t\tm_receivedSize\t= m_writeIndex;\r\n\t\t\tm_bDataComplete = true;\r\n\t\t} else {\r\n\t\t\t// printf(\"HTTP FAIL\\n\");\r\n\t\t\t\r\n\t\t\t// In some cases, the server cut the connection, resulting in a CURL error\r\n\t\t\t// But there is 0 byte of data and the error code is valid.\r\n\t\t\t// In this case, we allow the upper layer to consider returning a safe error code.\r\n\t\t\tif ((this->m_receivedSize == 0) && (\r\n\t\t\t\t((m_tmpErrorCode >= 500) && (m_tmpErrorCode <= 599)) || (m_tmpErrorCode == 204)\r\n\t\t\t\t)) {\r\n\t\t\t\tm_errorCode = m_tmpErrorCode;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (formpost) {\r\n\t\t\tcurl_formfree(formpost);\r\n\t\t}\r\n\r\n\t\tif (headerlist) {\r\n\t\t\tcurl_slist_free_all(headerlist);\r\n\t\t}\r\n\r\n\t\t// always cleanup\r\n\t\tcurl_easy_cleanup(m_pCurl);\r\n\t\tm_pCurl = NULL;\r\n\r\n\t\tif (m_bDownload) {\r\n\t\t\t// Close file anyway\r\n\t\t\tif (m_pTmpFile) {\r\n\t\t\t\tdelete m_pTmpFile; // No macro, get alloc from porting layer.\r\n\t\t\t\tm_pTmpFile = NULL;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tm_threadStop = 1;\r\n}\r\n\r\nint strncmpi(const char* str1, const char* str2, int len) {\r\n\twhile ((*str1 != 0) && (*str2 != 0) && (tolower(*str1++)) == (tolower(*str2++)) && (len-- != 0)) {\r\n\t}\r\n\r\n\tif ((len == 0) || ((*str1 == 0) && (*str2 == 0))) {\r\n\t\treturn 0;\r\n\t} else {\r\n\t\tstr1--;\r\n\t\tstr2--;\r\n\t\treturn tolower(*str1) < tolower(*str2) ? -1 : +1; \r\n\t}\r\n}\r\n\r\n// static\r\nsize_t CKLBHTTPInterface::headerReceive_func( void *ptr, size_t size, size_t nmemb, void *userdata) {\r\n\tu32 totalSize = size * nmemb;\r\n\tconst char* data = (const char*)ptr;\r\n\tif (strncmpi(\"Maintenance:\", data, 12/*Maintenance: 1*/) == 0) {\r\n\t\tdata+=12; // Skip Maintenance\r\n\t\twhile ((*data != '\\r') && (*data != '\\n') && (*data != 0)) {\r\n\t\t\tif (*data == '1') {\r\n\t\t\t\t((CKLBHTTPInterface*)userdata)->m_maintenance = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tdata++;\r\n\t\t}\r\n\t}\r\n\r\n\tif (strncmpi(\"Status: \",data, 8/*Status: */)==0) {\r\n\t\tint code = 0;\r\n\t\twhile ((*data >= '0') && (*data <= '9')) {\r\n\t\t\tcode = (code * 10) + (*data);\r\n\t\t\tdata++;\r\n\t\t}\r\n\t\t((CKLBHTTPInterface*)userdata)->m_tmpErrorCode = code;\r\n\t}\r\n\r\n\tif (strncmpi(\"Server-Version:\", data, 15/*Server-Version*/) == 0) {\r\n\t\tu32 lineSize = size * nmemb;\t// Full Size\r\n\t\tlineSize -= 15;\t\t\t\t\t// Remove Server-Version\r\n\t\tdata += 15;\r\n\t\t\r\n\t\t// skip : and space before and after\r\n\t\twhile (*data == ' ') {\r\n\t\t\tdata++;\r\n\t\t\tlineSize--;\r\n\t\t}\r\n\r\n\t\tchar* mem =\t(char*)CKLBUtility::copyMem(data, lineSize + 1);\r\n\t\tif (mem) {\r\n\t\t\tmem[lineSize] = 0;\r\n\t\t\t((CKLBHTTPInterface*)userdata)->m_pServerVersion = mem;\r\n\t\t\t// IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\t\t// pForm.logging(\"HTTPInterface::get Server-Version %s %8X\",mem);\r\n\r\n\t\t}\r\n\t}\r\n\tif (!((CKLBHTTPInterface*)userdata)->m_stopThread) {\r\n\t\treturn totalSize;\r\n\t} else {\r\n\t\treturn 0xFFFFFFFF;\r\n\t}\r\n}\r\n\r\nbool CKLBHTTPInterface::hasHeader(const char* header, const char** value) {\r\n\tif (strcmp(\"Server-Version\", header) == 0) {\r\n\t\t// IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\t// pForm.logging(\"HTTPInterface::hasHeader %s %8X\",header,m_pServerVersion);\r\n\t\tif (value) {\r\n\t\t\t// pForm.logging(\"Value:%s\",m_pServerVersion);\r\n\t\t\t*value = m_pServerVersion;\r\n\t\t}\r\n\t\treturn (m_pServerVersion != NULL);\r\n\t} else {\r\n\t\tklb_assertAlways(\"Does not support other header for now than 'Server-Version'\");\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\n\r\n// static\r\nint CKLBHTTPInterface::progress_func(\tvoid* ctx, \r\n\t\t\t\t\t\t\t\t\t\tdouble total,\t\t// dltotal\r\n\t\t\t\t\t\t\t\t\t\tdouble dl,\t\t\t// dlnow\r\n\t\t\t\t\t\t\t\t\t\tdouble /*ultotal*/,\t\r\n\t\t\t\t\t\t\t\t\t\tdouble /*ulnow*/)\r\n{\r\n\tu64 uiTotal = (u64)total;\r\n\tu64 uiDownl = (u64)dl;\r\n\t((CKLBHTTPInterface*)ctx)->progress(uiTotal, uiDownl);\r\n\tif (!((CKLBHTTPInterface*)ctx)->m_stopThread) {\r\n\t\treturn 0;\r\n\t} else {\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\nvoid CKLBHTTPInterface::progress(u64 /*total*/, u64 download) {\r\n\tm_receivedSize = download;\r\n}\r\n\r\n// static\r\nsize_t CKLBHTTPInterface::write_func(char *ptr, size_t size, size_t nmemb, void *userdata)\r\n{\r\n\treturn ((CKLBHTTPInterface*)userdata)->write(ptr, size, nmemb);\r\n}\r\n\r\nsize_t CKLBHTTPInterface::write(char* ptr, size_t size, size_t nmemb)\r\n{\r\n\tbool noErr = false;\r\n\r\n\tu64 blockSize   = size * nmemb;\r\n\tu64 oldByteSize = m_writeIndex;\r\n\tu64 newByteSize = oldByteSize + blockSize;\t// Optimize with fixed size allocation ?\r\n\r\n\tif (m_pTmpFile && (m_bothFileAndMem == false)) {\r\n\t\tif (m_pTmpFile->writeTmp(ptr, blockSize) == blockSize) {\r\n\t\t\tnoErr = true;\r\n\t\t}\r\n\t} else {\r\n\t\tu8* pNewBuff = KLBNEWA(u8, newByteSize);\r\n\t\tif (pNewBuff) {\r\n\t\t\tif (m_buffer) {\r\n\t\t\t\tmemcpy(pNewBuff, m_buffer, oldByteSize);\r\n\t\t\t\tKLBDELETEA(m_buffer);\r\n\t\t\t}\r\n\t\t\tmemcpy(&pNewBuff[oldByteSize],\tptr, blockSize);\r\n\t\t\tm_buffer\t\t= pNewBuff;\r\n\t\t\tm_writeIndex\t= newByteSize;\r\n\t\t\tif (m_pTmpFile) {\r\n\t\t\t\tif (m_pTmpFile->writeTmp(ptr, blockSize) == blockSize) {\r\n\t\t\t\t\tnoErr = true;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tnoErr = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (noErr) {\r\n\t\treturn blockSize;\r\n\t} else {\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\n//_______________________________________________________________________\r\n//  Object\r\n//_______________________________________________________________________\r\n\r\nCKLBHTTPInterface::CKLBHTTPInterface()\r\n: m_errorCode       (-1)\r\n, m_bDataComplete   (false)\r\n, m_bDownload       (false)\r\n, m_pTmpFile        (NULL)\r\n, m_receivedSize    (0)\r\n, m_writeIndex      (0)\r\n, m_receivedData    (NULL)\r\n, m_thread          (NULL)\r\n, m_buffer          (NULL)\r\n, m_bothFileAndMem  (true)\r\n, m_headers         (NULL)\r\n, m_headerEntry     (NULL)\r\n, m_headerEntryLen  (NULL)\r\n, m_hdrlen          (0)\r\n, m_headerEntryCount(0)\r\n, m_post            (false)\r\n, m_url             (NULL)\r\n, m_pCurl           (NULL)\r\n, m_postForm        (NULL)\r\n, m_pServerVersion  (NULL)\r\n, m_maintenance     (false)\r\n, m_threadStop      (0)\r\n, m_stopThread      (false)\r\n, m_tmpErrorCode    (-1)\r\n{\r\n\tinit();\r\n}\r\n\r\n// virtual\r\nCKLBHTTPInterface::~CKLBHTTPInterface()\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\t// True : thread still working\r\n\tbool result = false;\r\n \tif (m_thread) {\r\n\t\tint status;\r\n\t\tresult = pForm.watchThread(m_thread, &status);\r\n\t\tm_stopThread = true;\r\n\t\twhile (m_threadStop == 0) {\r\n\t\t}\r\n\t}\r\n\r\n\t// May use result here...\r\n\r\n\tif (m_thread) {\r\n\t\tpForm.deleteThread(m_thread);\r\n\t\tm_thread = NULL;\r\n\t}\r\n\r\n\t/* NEVER DO THAT, thread may be still alive.\r\n\tif (m_pCurl) {\r\n\t\tcurl_easy_cleanup(m_pCurl);\t\r\n\t\tm_pCurl = NULL;\r\n\t} */\r\n\r\n\tclear();\r\n}\r\n\r\n// 追加HTTPヘッダの持\r\nbool CKLBHTTPInterface::setHeader(const char ** headers)\r\n{\r\n\tm_headerEntryCount = 0;\r\n\twhile (headers[m_headerEntryCount++]) { }\r\n\tm_headerEntryCount--;\r\n\r\n\tif (m_headerEntryCount) {\r\n\t\tm_headerEntry\t\t= KLBNEWA(const char*, m_headerEntryCount);\r\n\t\tm_headerEntryLen\t= KLBNEWA(u32, m_headerEntryCount);\r\n        if ((!m_headerEntry) || (!m_headerEntryLen)) { return false; }\r\n\r\n\t\tint len = 1;\t// 終端コードサイズは先に設宁E\r\n\t\tfor(int i = 0; headers[i]; i++) {\r\n\t\t\tm_headerEntryLen[i] = strlen(headers[i]);\r\n\t\t\tlen += m_headerEntryLen[i] + 2;\r\n\t\t}\r\n\r\n\t\tchar * buf = KLBNEWA(char, len);\r\n\t\tif(!buf) return false;\r\n\r\n\t\tKLBDELETEA(m_headers);\r\n\r\n\t\tm_headers = buf;\r\n\r\n\t\tfor(int i = 0; headers[i]; i++) {\r\n\t\t\tlen = m_headerEntryLen[i];\r\n\t\t\tstrcpy(buf, headers[i]);\r\n\t\t\tm_headerEntry[i] = buf;\r\n\t\t\tbuf += len;\r\n//\t\t\tstrcpy(buf, \"\\r\\n\"); Replace the chars by end of string.\r\n\t\t\t*buf++ = 0;\r\n\t\t}\r\n\t\t*buf = 0;\r\n\r\n\t\tm_hdrlen = buf - m_headers;\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\n// 持フォーム値のURLencode\r\nchar * CKLBHTTPInterface::setForm(const char ** postForm)\r\n{\r\n\t// DEBUG_PRINT(\"HTTPInterface::setForm\");\r\n\r\n\t// 持されpostForm から、POST斁を生成する\r\n\t// postForm は URLencodeされておらず個頁が連結されて態\r\n\t/*\r\n\tchar * basebuf = retbuf;\r\n\tif(!basebuf) return NULL;\r\n\t*/\r\n\r\n\tu32 i = 0;\r\n\twhile (postForm[i++]) { }\r\n\r\n\tm_postForm = KLBNEWA(const char*, i);\r\n\r\n\tif (m_postForm) {\r\n\t\tfor(u32 n = 0; postForm[n]; n++) {\r\n\t\t\tconst char * formItem = postForm[n];\r\n\t\t\tm_postForm[n] = CKLBUtility::copyString(formItem);\r\n\t\t}\r\n\t\tm_postForm[i-1] = NULL;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBHTTPInterface::reuse() {\r\n\t// DEBUG_PRINT(\"HTTPInterface::reuse\");\r\n\tclear();\r\n\tinit();\r\n}\r\n\r\nvoid CKLBHTTPInterface::init() {\r\n\tm_errorCode         = -1;\r\n\tm_bDataComplete\t    = false;\r\n\tm_bDownload         = false;\r\n\tm_pTmpFile          = NULL;\r\n\tm_receivedSize      = 0;\r\n\tm_writeIndex        = 0;\r\n\tm_receivedData      = NULL;\r\n\tm_thread            = NULL;\r\n\tm_buffer            = NULL;\r\n\tm_bothFileAndMem    = true;\r\n\tm_headers           = NULL;\r\n\tm_headerEntry       = NULL;\r\n\tm_headerEntryLen    = NULL;\r\n\tm_hdrlen            = 0;\r\n\tm_headerEntryCount  = 0;\r\n\tm_post              = false;\r\n\tm_url               = NULL;\r\n\tm_pCurl             = NULL;\r\n\tm_postForm          = NULL;\r\n\tm_pServerVersion    = NULL;\r\n\tm_maintenance       = false;\r\n\tm_threadStop        = 0;\r\n\tm_stopThread        = false;\r\n}\r\n\r\nvoid CKLBHTTPInterface::clear() {\r\n\t// Force file closing if necessary.\r\n\tdelete m_pTmpFile;\r\n\tm_pTmpFile = NULL;\r\n\r\n\tKLBDELETEA(m_url);\r\n\tKLBDELETEA(m_buffer);\r\n\tKLBDELETEA(m_headers);\r\n\tKLBDELETEA(m_headerEntry);\r\n\tKLBDELETEA(m_headerEntryLen);\r\n\tKLBDELETEA(m_pServerVersion);\r\n\r\n\tif (m_postForm) {\r\n\t\tu32 i = 0;\r\n\t\twhile (m_postForm[i]) {\r\n\t\t\tKLBDELETEA(m_postForm[i]);\r\n\t\t\ti++;\r\n\t\t}\r\n\t\tKLBDELETEA(m_postForm);\r\n\t\tm_postForm = NULL;\r\n\t}\r\n\r\n\tm_url\t\t\t\t= NULL;\r\n\tm_buffer\t\t\t= NULL;\r\n\tm_headers\t\t\t= NULL;\r\n\tm_headerEntry\t\t= NULL;\r\n\tm_headerEntryLen\t= NULL;\r\n\tm_pServerVersion\t= NULL;\r\n\r\n\tinit();\r\n}\r\n\r\n// GET発衁\r\nbool CKLBHTTPInterface::httpGET(const char * url, bool isProxy)\r\n{\r\n\tklb_assert(isProxy==false,\"Proxy Not supported\");\r\n\r\n\tm_post\t= false;\r\n\tKLBDELETEA(m_url);\r\n\tm_url = CKLBUtility::copyString(url);\r\n\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t//pForm.logging(\"HTTPInterface::httpGET\");\r\n\tm_thread = pForm.createThread(CKLBHTTPInterface::HTTPConnectionThread, this);\r\n\treturn (m_thread != NULL);\r\n}\r\n\r\n// POST発衁\r\nbool CKLBHTTPInterface::httpPOST(const char * url, bool isProxy)\r\n{\r\n\tklb_assert(isProxy==false,\"Proxy Not supported\");\r\n\r\n\tm_post = true;\r\n\tKLBDELETEA(m_url);\r\n\tm_url = CKLBUtility::copyString(url);\r\n\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t// pForm.logging(\"HTTPInterface::httpPost\");\r\n\tm_thread = pForm.createThread(CKLBHTTPInterface::HTTPConnectionThread, this);\r\n\treturn (m_thread != NULL);\r\n}\r\n\r\n// ダウンロード保存パス名を持し、ダウンロードモードでの動作を開始する\r\n// NULL持で通常のオンメモリモードでの動作に戻めE\r\nbool CKLBHTTPInterface::setDownload(const char * path) \r\n{\r\n\tm_bDownload = false;\r\n\tif(path) {\r\n\t\t// ダウンロードファイル名 file://external/ 以下パスで与えられねばならな\r\n\t\tm_pTmpFile = CPFInterface::getInstance().platform().openTmpFile(path);\r\n\t\tif(m_pTmpFile) {\r\n\t\t\tm_bDownload = true;\r\n\t\t}\r\n\t}\r\n\treturn m_bDownload; \r\n}\r\n\r\n// 受信リソースの取征\r\nu8* CKLBHTTPInterface::getRecvResource() {\r\n\treturn m_receivedData;\r\n}\r\n\r\n// 現在の受信サイズ\r\ns64 CKLBHTTPInterface::getSize()\r\n{\r\n\treturn m_receivedSize;\r\n}\r\n\r\n// 受信スチEタス\r\nbool CKLBHTTPInterface::httpRECV()\r\n{\r\n\treturn m_bDataComplete;\r\n}\r\n\r\n// httpのstate取征2013.2.13  追加\r\nint CKLBHTTPInterface::getHttpState()\r\n{\r\n\treturn m_errorCode;\r\n}\r\n\r\n#else\r\n\r\nCKLBHTTPInterface::CKLBHTTPInterface()\r\n: m_url         (NULL)\r\n, m_host        (NULL)\r\n, m_path        (NULL)\r\n, m_port        (0)\r\n, m_headers     (NULL)\r\n, m_hdrlen      (0)\r\n, m_pSocket     (NULL)\r\n, m_pWRSock     (NULL)\r\n, m_http_recv   (NULL)\r\n, m_proxy_host  (NULL)\r\n, m_begin       (NULL)\r\n, m_end         (NULL)\r\n, m_sThreadSig  (0)\r\n, m_hThread     (NULL)\r\n, m_bufSend     (NULL)\r\n, m_sizeSend    (0)\r\n, m_bDownload   (false)\r\n, m_chunked     (false)\r\n, m_pTmpFile    (NULL)\r\n, m_http_state  (0)\r\n, m_pConnectName(NULL)\r\n, m_pMethod     (NULL)\r\n, m_pMethod_header  (NULL)\r\n, m_pBody       (NULL)\r\n, m_bIsProxy    (false)\r\n, m_test_body_length(0)\r\n{\r\n}\r\n\r\nCKLBHTTPInterface::~CKLBHTTPInterface()\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tif(m_hThread) {\r\n\t\t// pForm.breakThread(m_hThread);\t// 走ってスレチを中断させる\r\n\t\tm_sThreadSig = 1;\r\n\t\ts32 status;\r\n        while(pForm.watchThread(m_hThread, &status)) { status = 0; }\r\n\t\tpForm.deleteThread(m_hThread);\t// スレチを破棁E\r\n\t\tm_hThread = NULL;\r\n\t}\r\n\r\n\t//delete m_pWRSock;\r\n\tdelete m_pSocket;\t// socketを閉じる\r\n\r\n\tif(m_begin || m_end) {\r\n\t\t// chunk読み取り中なので、それらのバッファをすべて解放する\r\n\t\tCHUNK * pChunk = m_begin;\r\n\t\twhile(pChunk) {\r\n\t\t\tCHUNK * pNext = pChunk->next;\r\n\t\t\tKLBDELETEA(pChunk);\r\n\t\t\tpChunk = pNext;\r\n\t\t}\r\n\t\tm_begin = m_end = NULL;\r\n\t} else {\r\n\t\t// 読み取り中でなければ、m_http_recv が唯一のバッファを握って\r\n\t\tKLBDELETEA(m_http_recv);\r\n\t}\r\n\r\n\t// 送中は送バッファを握ってので解放\r\n\tif(m_bufSend) {\r\n\t\tKLBDELETEA(m_bufSend);\r\n\t\tm_bufSend  = NULL;\r\n\t\tm_sizeSend = 0;\r\n\t}\r\n\tKLBDELETEA(m_url);\r\n\tKLBDELETEA(m_host);\r\n\tKLBDELETEA(m_path);\r\n\tKLBDELETEA(m_proxy_host);\r\n\tKLBDELETEA(m_headers);\r\n\r\n    if( m_pConnectName ) {\r\n        KLBDELETEA( m_pConnectName );\r\n        m_pConnectName = NULL;\r\n    }\r\n    if( m_pBody ) {\r\n        KLBDELETEA( m_pBody );\r\n        m_pBody = NULL;\r\n    }\r\n    if( m_pMethod_header ) {\r\n        KLBDELETEA( m_pMethod_header );\r\n        m_pMethod_header = NULL;\r\n    }\r\n    if( m_pMethod ) {\r\n        KLBDELETEA( m_pMethod );\r\n        m_pMethod = NULL;\r\n    }\r\n\tif (m_pTmpFile) {\r\n\t\tdelete m_pTmpFile;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::url_parse(const char * url)\r\n{\r\n\t// 元URL保孁\r\n\tKLBDELETEA(m_url);\r\n\tm_url = CKLBUtility::copyString(url);\r\n\r\n\t// hostとportを得る\r\n\tconst char * ptr;\r\n\tif(!strncmp(\"http://\", url, 7)) {\r\n\t\tm_port = 80;\r\n\t\tptr = url + 7;\r\n\t} else if(!strncmp(\"https://\", url, 8)) {\r\n\t\t//TODO\r\n\t\treturn false;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tint last;\r\n\tfor(last = 0; ptr[last]; last++) {\r\n\t\tif(ptr[last] == '/' || ptr[last] == ':') break;\r\n\t}\r\n\tchar * buf = KLBNEWA(char, last + 1);\r\n\tstrncpy(buf, ptr, last);\r\n\tbuf[last] = 0;\r\n\tKLBDELETEA(m_host);\r\n\tm_host = (const char *)buf;\r\n\r\n\tif(ptr[last] == ':') {\t// port が指定されて\r\n\t\tlast++;\r\n\t\tm_port = 0;\r\n\t\twhile(ptr[last] && ptr[last] != '/') {\r\n\t\t\tif(ptr[last] < '0' || ptr[last] > '9') return false;\r\n\t\t\tm_port = m_port * 10 + ptr[last] - '0';\r\n\t\t\tlast++;\r\n\t\t}\r\n\t}\r\n\r\n\t//if(ptr[last] != 0) last++;\r\n\t// 2012.11.28  解放せずに次のを作り出すでここで解放\r\n\tif( m_path ) {\r\n\t\tKLBDELETEA( m_path );\r\n\t}\r\n\tm_path = CKLBUtility::copyString(ptr + last);\r\n\r\n    if(m_host && m_path && m_url) { return true; }\r\n\treturn false;\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::setHeader(const char ** headers)\r\n{\r\n\tint len = 1;\t// 終端コードサイズは先に設宁\r\n\tfor(int i = 0; headers[i]; i++) {\r\n\t\tlen += strlen(headers[i]) + 2;\r\n\t}\r\n\tchar * buf = KLBNEWA(char, len);\r\n    if(!buf) { return false; }\r\n\r\n\tKLBDELETEA(m_headers);\r\n\r\n\tm_headers = buf;\r\n\r\n\tfor(int i = 0; headers[i]; i++) {\r\n\t\tlen = strlen(headers[i]);\r\n\t\tstrcpy(buf, headers[i]);\r\n\t\tbuf += len;\r\n\t\tstrcpy(buf, \"\\r\\n\");\r\n\t\tbuf += 2;\r\n\t}\r\n\t*buf = 0;\r\n\r\n\tm_hdrlen = strlen(m_headers);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::setDownload(const char * path)\r\n{\r\n\tm_bDownload = false;\r\n\tif(path) {\r\n\t\t// ダウンロードファイル名 file://external/ 以下パスで与えられねばならな\r\n\t\tm_pTmpFile = CPFInterface::getInstance().platform().openTmpFile(path);\r\n\t\tif(m_pTmpFile) {\r\n\t\t\tm_bDownload = true;\r\n\t\t}\r\n\t} else {\r\n\t\tm_bDownload = false;\r\n\t}\r\n\treturn m_bDownload; \r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::httpRECV()\r\n{\r\n\tif(m_b_finished) {\r\n        // DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> Finished !\");\r\n\t\treturn true;\r\n\t}\r\n\tif(!m_pSocket) return false;\r\n\r\n    switch( m_eStep )\r\n    {\r\n    //-------------------------------------------\r\n    // チEタ送信\r\n    case E_CONNECT_WAITING:\r\n        {\r\n            DEBUG_PRINT(\"--- E_CONNECT_WAITING ---\");\r\n            // スレチ実行征\r\n            s32 status;\r\n            IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n            bool result = false;\r\n            result = pForm.watchThread( m_hThread , &status );\r\n            if( result ) { break; }\r\n            \r\n            // スレチ実行が終亁てぁばrequestの出力完亁\r\n            pForm.deleteThread( m_hThread );\r\n            m_hThread = NULL;\r\n            \r\n            DEBUG_PRINT(\"--- E_CONNECT_WAITING END---\");\r\n            // Connect後処琁する < 中でm_eStepを移させて\r\n            httpMethod_AfterConnect();\r\n        }\r\n        break;\r\n    //-------------------------------------------\r\n    // チEタ送信\r\n    case E_SENDING:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_SENDING\");\r\n            s32 status;\r\n            IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n            bool result = false;\r\n            result = pForm.watchThread( m_hThread , &status );\r\n            if( result ) break;\r\n\r\n            // スレチ実行が終亁てぁばrequestの出力完亁\r\n            pForm.deleteThread( m_hThread );\r\n            m_hThread = NULL;\r\n\r\n            // 送EチEタバッファを破棁め\r\n            KLBDELETEA(m_bufSend);\r\n            m_bufSend  = NULL;\r\n            m_sizeSend = 0;\r\n\r\n            // response征に入め\r\n            m_eStep = E_STARTUP;\r\n        }\r\n        // break; // こ呼び出しかめEresponse 征に入るため、意図皁breakを行わな\r\n    case E_STARTUP:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_STARTUP\");\r\n            m_begin = m_end = NULL;\r\n\r\n            m_eStep         = E_RDHDR;\r\n\r\n            m_read_size     = 0;\r\n            m_recv_size     = 0;\r\n            m_header_size   = 0;\r\n            m_pReadNow      = NULL;\r\n\r\n            m_bChunkDebug   = false;\r\n\r\n            // ヘッダーのchunkを作る\r\n            create_chunk(HEADER_BUF_SIZE);\r\n\r\n        }\r\n    //-------------------------------------------\r\n    // こままヘッダーの処琁\r\n    case E_RDHDR:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RDHDR\");\r\n            // ヘッダーサイズの初期匁E\r\n            m_header_size = 0;\r\n\r\n            // ヘッダを読み、下記惁を得る\r\n            // Content-Length\t\tチEタ自体全体サイズ\r\n            // Transfer-Encoding\t送信形式が chunked であるか否\r\n            s32 size = m_pSocket->getSize();\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RDHDR Size : %i\", size);\r\n            if(!size) {\r\n                break;\r\n            }\r\n\r\n            // m_http_recvへsize刁み込む\r\n            if(HEADER_BUF_SIZE - m_recv_size < (u32)size) { \r\n                size = HEADER_BUF_SIZE - m_recv_size;\r\n            }\r\n            if(!m_pSocket->readBlock(m_http_recv, size)) {\r\n                break;\r\n            }\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RDHDR Read Block : %i\", size);\r\n            m_read_size  = size;\r\n            m_recv_size += size;\r\n\r\n            // ヘッダを読み終わったかの検査(空行を見つけてぁ)\r\n            bool find = false;\r\n            for(size_t pos = 0; pos <= m_recv_size - 4; pos++) {\r\n                if(m_http_recv[pos] != '\\r') { continue; }\r\n\r\n                if(!strncmp((const char *)m_http_recv + pos, \"\\r\\n\\r\\n\", 4)) {\r\n                    find = true;\r\n                    break;\r\n                }\r\n            }\r\n            if(!find) {\r\n                break;\r\n            }\r\n\r\n            // ヘッダ終端を見つけてぁらチを解析する\r\n            // ヘッダからbodyの長さと chunked か否かを得る\r\n            m_chunked = false;\r\n            m_notchunk_length = 0;\r\n            get_format((char *)m_http_recv, &m_chunked, &m_notchunk_length);\r\n\r\n            // 現在の読み込み場所をチー空行まで進める\r\n            m_pReadNow  = strstr( (char*)m_http_recv , \"\\r\\n\\r\\n\" );\r\n            m_pReadNow += 4;    // 空行進める\r\n\r\n            m_header_size = m_pReadNow - (char*)m_http_recv;\r\n            m_read_size -= m_header_size;   // ヘッダー刁ら\r\n\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RDHDR Header Size : %i\", m_header_size);\r\n\r\n            // 1つ目のchunkはヘッダー部刁Eみで終亁せる\r\n            m_end->size = m_header_size;\r\n\r\n            // 次のスチプへ\r\n            if(!m_chunked) {\r\n                m_eStep = E_RD_BODY_NOT_CHUNKED;\r\n            } else {\r\n                m_eStep = E_RD_BODY_CHUNKED;\r\n            }\r\n        }\r\n        break;\r\n\r\n    //-------------------------------------------\r\n    // chunkで無ぁ合読み込み\r\n    case E_RD_BODY_NOT_CHUNKED:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_BODY_NOT_CHUNKED\");\r\n            // こ場合チEタのサイズは全体からチー部刁引いたサイズ\r\n            int chunk_size = m_notchunk_length;\r\n\r\n            // chunkを作る\r\n            create_chunk( chunk_size );\r\n\t\t\tm_rdSize = chunk_size;\t// 20130222 \r\n\r\n            // 読み込んだ残りをchunkへコピする\r\n            int copy_size = chunk_size;\r\n            if( copy_size >= m_read_size ) {\r\n                // コピするサイズが読み込んでぁサイズよりも大きい場合続きを読み込まなぁぁな\r\n                copy_size = m_read_size;\r\n                m_eStep = E_RDBODY;\r\n            }\r\n            \r\n            // chunkへコピする\r\n            memcpy( m_http_recv , m_pReadNow , copy_size );\r\n            m_read_size -= copy_size;\r\n            m_recv_size += copy_size;\r\n\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_BODY_NOT_CHUNKED %i %i \", m_read_size, m_recv_size);\r\n\r\n\r\n            // 次のスチプへ行かなぁ合終亁E\r\n            if( m_eStep != E_RDBODY ) {\r\n                // 既にbodyの読み込みが終亁てぁため、終亁ェーズに入る\r\n                //m_rdSize = m_recv_size;\t// 20130222 　コメントアウチE\r\n                if(m_bDownload) {\r\n                    // そbody刁チポラリに書き\r\n                    m_pTmpFile->writeTmp(m_http_recv, m_recv_size);\r\n                    // 最後 chink を破棁めEヘッダのchunkのみが残される)\r\n                    remove_last_chunk();\r\n                }\r\n                read_finish();\r\n\r\n\t\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_BODY_NOT_CHUNKED break\");\r\n                break;\r\n            }\r\n\r\n            // 残りを読み込むスレチ関数を仕掛ける\r\n            IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n            m_hThread = pForm.createThread(CKLBHTTPInterface::ThreadHTTP, this);\r\n        }\r\n        break;\r\n\r\n    //-------------------------------------------\r\n    // body の残り読み込み中\r\n    case E_RDBODY:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_BODY\");\r\n            s32 status;\r\n            IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n            bool result = pForm.watchThread(m_hThread, &status);\r\n            if(result) { break; }\r\n            pForm.deleteThread(m_hThread);\r\n            m_hThread = NULL;\r\n            // スレチが終亁てぁば、結琁行い終亁せる\r\n            if(m_bDownload) {\r\n                // 最後 chunk を破棁ることによりチchunkのみが残される\r\n                // ダウンロードモードではヘッダのみをオンメモリで扱\r\n                remove_last_chunk();\r\n            }\r\n            read_finish();\r\n        }\r\n        break;\r\n\r\n    //-------------------------------------------\r\n    // chunkの場合チEタ読み込み\r\n    case E_RD_BODY_CHUNKED:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_BODY_CHUNKED\");\r\n            // chunkに書き込むべきサイズを取得すめ\r\n            // チEタの残りのサイズ刁れめE\r\n            char* body = get_chunk_size(m_pReadNow, m_read_size, &m_rightsize);\r\n            // ここでまず判定すめE\r\n            if(!body) {\r\n                // 最初 chunk サイズが取得できず、response が異常であるため\r\n                // ここで受信冁を完結させる\r\n                read_finish();\r\n                // klb_assertAlways(\"could not get chunk size.\");\r\n\t\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_BODY_CHUNKED break\");\r\n                break;\t// 最初chunkサイズが取得できなかっ\r\n            }\r\n            m_read_size -= (body-m_pReadNow);   // chunkサイズ刁E改行\r\n            m_pReadNow = body;\r\n\r\n            // chunkを作る\r\n            create_chunk( m_rightsize );\r\n\t\t\tm_rdSize += m_rightsize;\t// 20130222 \r\n\r\n            // 読み込んだ残りをchunkへコピする\r\n            int copy_size = m_rightsize;\r\n            if( copy_size > m_read_size ) {\r\n                // コピするサイズが読み込んでサイズよりも大きい場合続きを読み込まなぁぁな\r\n                copy_size = m_read_size;\r\n                m_eStep = E_RDCHUNK;\r\n            }\r\n\r\n            // chunkへコピ\r\n            memcpy(m_http_recv, m_pReadNow, copy_size );\r\n            m_recv_size += copy_size;\r\n            m_read_size -= copy_size;\r\n\r\n            // 次のスチプへ行く\r\n            if( m_eStep == E_RDCHUNK ) {\r\n                // 残りを読み込むスレチ関数を仕掛ける\r\n                IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n                m_hThread = pForm.createThread(CKLBHTTPInterface::ThreadHTTP, this);\r\n            } else {\r\n                m_pReadNow += copy_size;\r\n                m_pReadNow += 2;    // 改行\r\n                m_read_size-=2;     // 改行\r\n                // 次のchunkがあるか調べめEこStepの先頭へ戻め\r\n                m_eStep = E_RD_BODY_CHUNKED;\r\n                m_bChunkDebug = true;\r\n            }\r\n        }\r\n        break;\r\n\r\n    //-------------------------------------------\r\n    // chunk時残りチEタ読み込み\r\n    case E_RDCHUNK:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_RD_CHUNK\");\r\n            s32 status;\r\n            IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n            bool result = pForm.watchThread(m_hThread, &status);\r\n            if(result) break;\t// thread は実行中\r\n\r\n            // thread の実行が終亁て\r\n            // ダウンロードモードであれば、そのthreadで読み込み中であったchunk冁はファイルに追加されて\r\n            pForm.deleteThread(m_hThread);\t// thread 破棁\r\n            m_hThread = 0;\r\n            m_tmpsize = 0;\r\n\r\n            if(m_bDownload) {\r\n                // ダウンロードモードではヘッダchunk以外をオンメモリで扱わなぁめ\r\n                // 今琁終わった最後chunkは不要となるため破棁\r\n                remove_last_chunk();\r\n            }\r\n\r\n            m_eStep = E_NEXTCHUNK;\r\n            // thread を殺し、次のchunkのサイズを得る\r\n        }\r\n\r\n    //-------------------------------------------\r\n    // chunk時残りチEタ読み込み\r\n    case E_NEXTCHUNK:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_NEXTCHUNK\");\r\n            int retry = 0;\r\n            // 次の1024byte以冁改行があるかどぁ調べめ\r\n            do {\r\n                m_read_size = m_pSocket->getSize();\r\n                if(!m_read_size) {\r\n                    if(retry < RETRY) {\r\n                        retry++;\r\n                        continue;\r\n                    } else {\r\n                        retry = RETRY;\r\n                        DEBUG_PRINT(\"recv timedout\");\r\n                    }\r\n                }\r\n\r\n                if(m_read_size + m_tmpsize > 1024) { \r\n                    m_read_size = 1024 - m_tmpsize;\r\n                }\r\n                if(!m_pSocket->readBlock(m_tmpBuf + m_tmpsize, m_read_size)) {\r\n                    if(retry < RETRY) {\r\n                        retry++;\r\n                        continue;\r\n                    } else {\r\n                        retry = RETRY;\r\n                        DEBUG_PRINT(\"recv timedout\");\r\n                    }\r\n                }\r\n                m_tmpsize += m_read_size;\r\n                // chunk のサイズを得るためにここまでのサイズは不要\r\n                if(m_tmpsize >= 1024) {\r\n                    break;\r\n                }\r\n            } while(m_tmpsize < 2 || find_crlf((char *)m_tmpBuf + 2, m_tmpsize - 2) < 0);\r\n\r\n            // 次のchunkを探\r\n            bool loop_count  = 0;\r\n            // 改行を見つける\r\n            while(!strncmp((const char *)m_tmpBuf, \"\\r\\n\", 2)) {\r\n                loop_count++;\r\n\r\n                // 現在のバッファ中に改行があれば、そこまで進める\r\n                size_t pos = 2;\r\n                while( pos<m_tmpsize && (char)m_tmpBuf[pos]!='\\r') { pos++; }\r\n                if(pos < m_tmpsize && !strncmp((const char *)m_tmpBuf + pos, \"\\r\\n\", 2)) \r\n                {// 改行が見つかっ\r\n\r\n\t\t\t\t\t// 改行まで読んだので、m_tmpBuf には次のchunk size がある\r\n\t\t\t\t\tsize_t size = 0;\r\n\t\t\t\t\tfor(int i = 2; i < (int)pos; i++) {\r\n\t\t\t\t\t\tsize = size * 16;\r\n\t\t\t\t\t\tint c = tolower((int)m_tmpBuf[i]);\r\n\t\t\t\t\t\tif(c >= '0' && c <= '9') size += c - '0';\r\n\t\t\t\t\t\tif(c >= 'a' && c <= 'f') size += c - 'a' + 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tDEBUG_PRINT(\"chunk: size = %08lx (%ld)\", size, size);\r\n\t\t\t\t\tif(size == 0) {\r\n\t\t\t\t\t\t// 全てのchunkを読み終わったで、終亁ェーズに移行\r\n\t\t\t\t\t\tread_finish();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// サイズ刁chunkを確俁E\r\n\t\t\t\t\t/* CHUNK * pChunk = */ create_chunk(size);\r\n\t\t\t\t\tm_rdSize += size;\t// 20130222 \r\n\r\n\t\t\t\t\t// バッファに既に読み込んでぁchunk刁あれば頭にコピする\r\n\t\t\t\t\tint read_size = m_tmpsize - (pos + 2);\r\n\t\t\t\t\tsize_t copysize = (read_size > size) ? size : read_size;\r\n\t\t\t\t\tif(copysize > 0) {\r\n\t\t\t\t\t\tmemcpy(m_http_recv, m_tmpBuf + pos + 2, copysize);\r\n\t\t\t\t\t\tm_recv_size = copysize;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(m_bDownload) {\r\n\t\t\t\t\t\t// そbody刁チポラリに書き\r\n\t\t\t\t\t\tm_pTmpFile->writeTmp(m_http_recv, m_recv_size);\r\n\t\t\t\t\t\t// 最後 chink を破棁めEヘッダのchunkのみが残される)\r\n\t\t\t\t\t\tremove_last_chunk();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// こ時点でchunkのサイズが終亁てしまったら、その次から次のchunk惁が始まって\r\n\t\t\t\t\t// (大抵はそこで終わめ\r\n\t\t\t\t\tif(read_size > copysize) {\r\n\t\t\t\t\t\tm_tmpsize = read_size - copysize;\r\n\t\t\t\t\t\tmemcpy(m_tmpBuf, m_tmpBuf + pos + 2 + copysize, m_tmpsize);\r\n\t\t\t\t\t\t// 平戁E5年2朁E9日(火)\r\n\t\t\t\t\t\t// CKLBHTTPInterface::ThreadHTTP冁行われるべき琁行われなでここで意図皁加算す\r\n\t\t\t\t\t\t//m_rdSize += m_recv_size; //20130222  コメントアウチ\r\n\r\n\t\t\t\t\t\t// 続きを読む\r\n\t\t\t\t\t\tdo {\r\n\t\t\t\t\t\t\tint size = m_pSocket->getSize();\r\n\r\n\t\t\t\t\t\t\tif(!size) {\r\n\t\t\t\t\t\t\t\tif(retry < RETRY) {\r\n\t\t\t\t\t\t\t\t\tretry++;\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tretry = RETRY;\r\n\t\t\t\t\t\t\t\t\tDEBUG_PRINT(\"recv timedout\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(size + m_tmpsize > 1024) { \r\n                                size = 1024 - m_tmpsize;\r\n                            }\r\n\t\t\t\t\t\t\tif(!m_pSocket->readBlock(m_tmpBuf + m_tmpsize, size)) {\r\n\t\t\t\t\t\t\t\tif(retry < RETRY) {\r\n\t\t\t\t\t\t\t\t\tretry++;\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tretry = RETRY;\r\n\t\t\t\t\t\t\t\t\tDEBUG_PRINT(\"recv timedout\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tm_tmpsize += size;\r\n\t\t\t\t\t\t\t// chunk のサイズを得るためにここまでのサイズは不要\r\n                            if(m_tmpsize >= 1024) { break; }\r\n\t\t\t\t\t\t} while(m_tmpsize < 2 || find_crlf((char *)m_tmpBuf + 2, m_tmpsize - 2) < 0);\r\n\t\t\t\t\t\t// 新たな先頭から次のサイズを読み込む(ためE)\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// 続きをthreadに読ませる\r\n\t\t\t\t\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\t\t\t\t\tm_hThread = pForm.createThread(CKLBHTTPInterface::ThreadHTTP, this);\r\n\t\t\t\t\t\tm_eStep = E_RDCHUNK;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n                }\r\n\r\n            }\r\n\t\t\tif(!loop_count) {\r\n\r\n\t\t\t\tm_tmpBuf[m_tmpsize] = 0;\r\n\t\t\t\t// chunkフォーマットが異常なので、現在までの受信冁でレスポンスを完結させる\r\n\t\t\t\tread_finish();\r\n\t\t\t\t// klb_assertAlways(\"bad chunk format.\");\r\n\t\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_NEXTCHUNK break\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n//            printf( \">>>>> read_size : %d \\n\",m_read_size );\r\n        }\r\n        break;\r\n\r\n    //-------------------------------------------\r\n    // bodyの読み込みが終亁\r\n    case E_END:\r\n        {\r\n\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_END\");\r\n            s32 status;\r\n            IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n            bool result = pForm.watchThread(m_hThread, &status);\r\n            if(result) {\r\n\t\t\t\t// DEBUG_PRINT(\"CKLBHTTPInterface::httpRECV -> E_END break\");\r\n\t\t\t\tbreak;\t// thread は実行中\r\n\t\t\t}\r\n\r\n            pForm.deleteThread(m_hThread);\r\n            m_hThread = NULL;\r\n\r\n            // スレチが終亁てぁば、chunkの連結が終亁たとぁこと\r\n\r\n            // 連結が終亁たで全chunkバッファを破棁る\r\n            CHUNK * pChunk = m_begin;\r\n            while(pChunk)\r\n            {\r\n                CHUNK * next = pChunk->next;\r\n                KLBDELETEA(((u8 *)pChunk));\r\n                pChunk = next;\r\n            }\r\n            m_begin = m_end = NULL;\r\n\r\n            // ダウンロードモード場合、終亁同時にチポラリをクローズする\r\n            if(m_bDownload)\r\n            {\r\n                delete m_pTmpFile;\r\n                m_pTmpFile  = NULL;\r\n                m_bDownload = false;\r\n            }\r\n\r\n            delete m_pSocket;\r\n            m_pSocket    = NULL;\r\n            m_pWRSock    = NULL;\r\n            m_b_finished = true;\r\n        }\r\n        break;\r\n    }\r\n\r\n    return false;\r\n}\r\n\r\nint\r\nCKLBHTTPInterface::find_crlf(const char * ptr, int len)\r\n{\r\n\tfor(int i = 0; i < len - 2; i++) {\r\n\t\tif(ptr[i] != '\\r') continue;\r\n\t\tif(!strncmp(\"\\r\\n\", ptr + i, 2)) return i;\r\n\t}\r\n\treturn -1;\r\n}\r\n\r\nvoid\r\nCKLBHTTPInterface::read_finish()\r\n{\r\n\t// DEBUG_PRINT(\"=== read_finish ===\");\r\n\t// 全てのchunkが読み終わってぁので、繋いで一つのバッファにする\r\n\t// pass-1: 生すべき単一バッファのサイズを求める\r\n\tCHUNK * pChunk  = m_begin;\r\n\tsize_t  size    = 0;\r\n\twhile(pChunk) {\r\n\t\tsize += pChunk->size;\r\n\t\tpChunk = pChunk->next;\r\n\t}\r\n\tu8 * pNewBuf = KLBNEWA(u8, size + 1);\r\n\r\n\tm_http_recv = pNewBuf;\r\n\tm_recv_size = 0;\r\n\tm_eStep = E_END;\r\n\r\n\t// 読み込んだchunk bufferの冁を連結する琁別スレチで行わせる\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tm_hThread = pForm.createThread(CKLBHTTPInterface::ThreadJOINT, this);\r\n\r\n    m_bChunkDebug = false;\r\n\t// DEBUG_PRINT(\"=== /read_finish ===\");\r\n}\r\n\r\nvoid\r\nCKLBHTTPInterface::remove_chunk(CHUNK * pChunk)\r\n{\r\n\t// DEBUG_PRINT(\"=== remove_chunk ===\");\r\n\t// DEBUG_PRINT(\"=== Size : %i\", pChunk->size);\r\n\tif(pChunk->prev) {\r\n\t\tpChunk->prev->next = pChunk->next;\r\n\t} else {\r\n\t\tm_begin = pChunk->next;\r\n\t}\r\n\tif(pChunk->next) {\r\n\t\tpChunk->next->prev = pChunk->prev;\r\n\t} else {\r\n\t\tm_end = pChunk->prev;\r\n\t}\r\n\tKLBDELETE(pChunk);\r\n\t// DEBUG_PRINT(\"=== /remove_chunk ===\");\r\n}\r\n\r\nCKLBHTTPInterface::CHUNK *\r\nCKLBHTTPInterface::create_chunk(size_t size)\r\n{\r\n\tCHUNK * pChunk = (CHUNK *)KLBNEWA(u8, sizeof(CHUNK) + size + 1);\r\n\tklb_assert(pChunk, \"could not alloc chunk buffer(HTTP)\");\r\n    if(!pChunk) { return NULL; }\r\n\r\n\tpChunk->size = size;\r\n\tpChunk->prev = m_end;\r\n\tpChunk->next = NULL;\r\n\tif(pChunk->prev) {\r\n\t\tpChunk->prev->next = pChunk;\r\n\t} else {\r\n\t\tm_begin = pChunk;\r\n\t}\r\n\tm_end       = pChunk;\r\n\tm_http_recv = (u8 *)&pChunk[1];\r\n\tm_recv_size = 0;\r\n\t// DEBUG_PRINT(\"=== /createchunk %i ===\", size);\r\n\treturn pChunk;\r\n}\r\n\r\ns32\r\nCKLBHTTPInterface::ThreadJOINT(void * /* hThread */, void * data)\r\n{\r\n\tCKLBHTTPInterface * pHTTP = (CKLBHTTPInterface *)data;\r\n\r\n\tpHTTP->SetBodySize(0);\r\n\r\n\tCHUNK * pChunk = pHTTP->m_begin;\r\n\tsize_t pos = 0;\r\n\twhile(pChunk) {\r\n\t\tif(pHTTP->m_sThreadSig) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tmemcpy(pHTTP->m_http_recv + pos, &pChunk[1], pChunk->size);\r\n        if( pos > 0 ) { pHTTP->AddBodySize( pChunk->size ); }\r\n\t\tpos += pChunk->size;\r\n\t\tpChunk = pChunk->next;\r\n\t}\r\n\tpHTTP->m_http_recv[pos] = 0; // 斁として閉じめ\r\n\r\n\treturn 0;\r\n}\r\n\r\ns32\r\nCKLBHTTPInterface::ThreadSEND(void * /* hThread */, void * data)\r\n{\r\n\tCKLBHTTPInterface * pHTTP = (CKLBHTTPInterface *)data;\r\n\tpHTTP->sending();\r\n\treturn 0;\r\n}\r\n\r\ns32\r\nCKLBHTTPInterface::ThreadHTTP(void * /* hThread */, void * data)\r\n{\r\n\tCKLBHTTPInterface * pHTTP = (CKLBHTTPInterface *)data;\r\n\r\n\twhile(pHTTP->m_recv_size < pHTTP->m_end->size) {\r\n\t\tif(pHTTP->m_sThreadSig) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tsize_t size = pHTTP->m_pSocket->getSize();\r\n\t\tif(size > pHTTP->m_end->size - pHTTP->m_recv_size) {\r\n\t\t\tsize = pHTTP->m_end->size - pHTTP->m_recv_size;\r\n\t\t}\r\n\t\tif(!pHTTP->m_pSocket->readBlock(pHTTP->m_http_recv + pHTTP->m_recv_size, size)) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tpHTTP->m_recv_size += size;\r\n\t}\r\n\r\n\t*(pHTTP->m_http_recv + pHTTP->m_recv_size) = 0;\r\n\r\n    // トタル読み込みサイズを更新\r\n\t//pHTTP->m_rdSize += pHTTP->m_recv_size;\t// 20130222  コメントアウチ\r\n\r\n    // そセチョンがダウンロードモードであるなら\r\n\t// pHTTP->m_http_recv から pHTTP->m_recv_size 刁チポラリに書き込む\r\n\tif(pHTTP->m_bDownload) {\r\n\t\tpHTTP->m_pTmpFile->writeTmp(pHTTP->m_http_recv, pHTTP->m_recv_size);\r\n\t}\r\n\r\n\t// 読み終わったでスレチを終亁る\r\n\treturn 0;\r\n}\r\n\r\ns32\r\nCKLBHTTPInterface::ThreadCONNECT(void * /* hThread */, void * data)\r\n{\r\n\tCKLBHTTPInterface * pHTTP = (CKLBHTTPInterface *)data;\r\n\tpHTTP->setSocket( CPFInterface::getInstance().platform().openReadStream( pHTTP->getConnectName() , false) );\r\n\treturn 0;\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::cmp_header(char * ptr, const char * str, size_t len)\r\n{\r\n\tfor(size_t i = 0; i < len && str[i]; i++) {\r\n\t\tif(!ptr[i]) return false;\r\n\t\tif(tolower(ptr[i]) != tolower(str[i])) return false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nchar *\r\nCKLBHTTPInterface::get_chunk_size(char * buf, size_t len, size_t * size)\r\n{\r\n\t*size = 0;\r\n\tsize_t pos;\r\n\tfor(pos = 0; !isspace(buf[pos]) && pos < len; pos++) {\r\n\t\tint c = tolower(buf[pos]);\r\n\t\t*size = *size * 16;\r\n\t\tif(c >= '0' && c <= '9') {\r\n\t\t\t*size += c - '0';\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif(c >= 'a' && c <= 'f') {\r\n\t\t\t*size += c - 'a' + 10;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t// 不正な斁E\r\n\t\treturn NULL;\r\n\t}\r\n\t// バッファ終端にたどり着ぁ場合、値の有効性が疑わしで取得失敗\r\n    if(pos == len)      { return NULL; }\r\n\t// そ直後が改行であることが確認できなぁ合ポインタが胡散臭で取得失敗扱\r\n    if(len - pos < 2)   { return NULL; }\r\n\r\n\t// 値が取得でき、その直後が改行であることが確認できたら取得功、それ以外失敗\r\n    if(strncmp(buf + pos, \"\\r\\n\", 2)) { return NULL; }\r\n\r\n\treturn buf + pos + 2;\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::get_format(char * buf, bool * f_chunked, u64 * length)\r\n{\r\n\tbool finish = false;\r\n\tchar * recv = buf;\r\n\tsize_t pos  = 0;\r\n\tconst char *    c_length    = \"content-length: \";\r\n\tconst char *    tr_encoding = \"transfer-encoding:\";\r\n\tconst int       len_len     = strlen(c_length);\r\n\tconst int       enc_len     = strlen(tr_encoding);\r\n\tconst char *    chunked     = \"chunked\";\r\n\tconst int       chunked_len = strlen(chunked);\r\n\r\n    const char*     http_head   =\"HTTP\";\r\n    const int       http_head_len = strlen(http_head);\r\n\r\n    m_http_state = 0;\r\n    // 最初行からHTTPの状態を取得すめE2013.2.13 追加\r\n    if( cmp_header(recv,http_head,http_head_len) ) {\r\n        int state_buff_pos=0;\r\n        int state_check_pos = http_head_len;\r\n        bool bIsSpace = false;\r\n        // HTTPをみつけたら次のスペスをさがす(最長で8斁まで)\r\n        while( state_check_pos<http_head_len+8) {\r\n            bIsSpace = isspace(recv[state_check_pos]);\r\n            state_check_pos++;\r\n            if( bIsSpace == true ) break;\r\n        }\r\n\r\n        if( bIsSpace == true ) {\r\n            char state_buff[4]={0};\r\n            while( !isspace(recv[state_check_pos]) && state_buff_pos<4 ) {\r\n                state_buff[state_buff_pos] = recv[state_check_pos];\r\n                state_check_pos++;state_buff_pos++;\r\n            }\r\n\r\n            m_http_state = atoi(state_buff);\r\n        }\r\n    }\r\n\r\n\t*f_chunked  = false;\r\n\t*length     = 0LL;\r\n\tbool hasContentLength = false;\r\n\r\n\twhile(!finish) {\r\n\t\tint len;\r\n\t\tfor(len = 0; recv[len]; len++) {\r\n            if(!strncmp(recv + len, \"\\r\\n\", 2)) { break; }\r\n\t\t}\r\n\t\tif(len == 0) {\t// 長さが0 すなわち空行に到遁E\r\n\t\t\tfinish = true;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif(cmp_header(recv, tr_encoding, enc_len)) {\r\n\t\t\t// 目皁Eヘッダ(1): Transfer-Encoding\r\n\t\t\tchar * val = recv + enc_len;\r\n            while(*val && *val == ' ') { val++; } // 空白を読み飛\r\n\t\t\tif(!strncmp(val, chunked, chunked_len) && (isspace(val[chunked_len]))) {\r\n\t\t\t\t// Transfer-Encoding: chunked だったで true を返す\r\n\t\t\t\t*f_chunked = true;\r\n\t\t\t}\r\n\t\t} else if(cmp_header(recv, c_length, len_len)) {\r\n\t\t\thasContentLength = true;\r\n\t\t\t// 目皁Eヘッダ(2): Content-Length\r\n\t\t\tchar * val = recv + len_len;\r\n            while(*val && *val == ' ') { val++; }\r\n\t\t\t*length = 0;\r\n\t\t\twhile(!isspace(*val)) {\r\n\t\t\t\tint num = *val;\r\n\t\t\t\tif(num < '0' || num > '9') break;\r\n\t\t\t\tnum -= '0';\r\n\t\t\t\t*length = *length * 10LL + num;\r\n\t\t\t\tval++;\r\n\t\t\t}\r\n\t\t}\r\n\t\trecv += len + 2;\r\n\t\tpos += len + 2;\r\n\t}\r\n\r\n\tif (!hasContentLength) {\r\n\t\tif (*f_chunked == false) {\r\n\t\t\t// klb_assertAlways(\"Server Side stream has neither content-length or chunk query\");\r\n\t\t\tDEBUG_PRINT(\" \");\r\n\t\t\tDEBUG_PRINT(\"### !!!! ERROR !!!! ####\");\r\n\t\t\tDEBUG_PRINT(\"### !!!! CKLBHTTPInterface::Server Side stream has neither content-length nor chunk query !!!! ####\");\r\n\t\t\tDEBUG_PRINT(\"### !!!! ERROR !!!! ####\");\r\n\t\t\tDEBUG_PRINT(\" \");\r\n\t\t}\r\n\t}\r\n\t// ヘッダが見つからなかったで false を返す\r\n\treturn true;\r\n}\r\n\r\nchar *\r\nCKLBHTTPInterface::URLencode(char * retbuf, int maxlen, const char ** postForm)\r\n{\r\n\t// 持されpostForm から、POST斁を生成する\r\n\t// postForm は URLencodeされておらず、個頁が連結されてぁぁ態\r\n\tchar *  basebuf  = (retbuf) ? retbuf : KLBNEWA(char, ALLOC_SIZE);\r\n\tint     now_size = (retbuf) ? maxlen : ALLOC_SIZE;\r\n    if(!basebuf) { return NULL; }\r\n\r\n\tchar * ptr = basebuf;\r\n\r\n\tfor(int i = 0; postForm[i]; i++) {\r\n\t\tconst char * formItem = postForm[i];\r\n\r\n\t\tif(i > 0) {\r\n\t\t\t*ptr++ = '&';\r\n\t\t\tif(ptr - basebuf >= now_size - 1) {\r\n\t\t\t\t// バッファが与えられてぁ場合エラー終亁E\r\n                if(retbuf) { return NULL; }\r\n\r\n\t\t\t\t// 冁で確保されたバッファを用ぁ場合,バッファを継ぎ足\r\n\t\t\t\tint len = ptr - basebuf;\r\n\t\t\t\tchar * newptr = KLBNEWA(char, now_size + ALLOC_SIZE);\r\n\t\t\t\tif(!newptr) {\r\n\t\t\t\t\tKLBDELETEA(basebuf);\r\n\t\t\t\t\treturn NULL;\r\n\t\t\t\t}\r\n\t\t\t\tmemcpy(newptr, basebuf, len);\r\n\t\t\t\tKLBDELETEA(basebuf);\r\n\t\t\t\tbasebuf = newptr;\r\n\t\t\t\tptr = basebuf + len;\r\n\t\t\t\tnow_size += ALLOC_SIZE;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(const char * src = formItem; *src; src++) {\r\n\t\t\tint reqsize = 1;\r\n\t\t\tchar tmpbuf[10];\r\n\t\t\tconst char * data = 0;\r\n\t\t\tif(('0'<= *src && *src <= '9')  ||\r\n\t\t\t\t('a'<= *src && *src <= 'z') ||\r\n\t\t\t\t('A'<= *src && *src <= 'Z') ||\r\n\t\t\t\t*src == '_' || *src == '-'  ||\r\n\t\t\t\t*src == '.' || *src == '*'  || *src == '=') {\r\n\t\r\n\t\t\t\t// そままぁる文孁\r\n\t\t\t\tdata = src;\r\n\t\t\t} else if(*src == ' ') {\r\n\r\n\t\t\t\t// 空白の置き換\r\n\t\t\t\tdata = \"+\";\r\n\r\n\t\t\t} else {\r\n\t\t\t\treqsize = 3;\r\n\t\t\t\tsprintf(tmpbuf, \"%%%02x\", (int)*(unsigned char *)src);\r\n\t\t\t\tdata = (const char *)tmpbuf;\r\n\t\t\t}\r\n\t\t\tif((ptr + reqsize) - basebuf >= now_size - 1) {\r\n\t\t\t\t// バッファが与えられてぁ場合エラー終亁E\r\n                if(retbuf) { return NULL; }\r\n\r\n\t\t\t\t// 冁で確保されたバッファを用ぁ場合,バッファを継ぎ足\r\n\t\t\t\tint len = ptr - basebuf;\r\n\t\t\t\tchar * newptr = KLBNEWA(char, now_size + ALLOC_SIZE);\r\n\t\t\t\tif(!newptr) {\r\n\t\t\t\t\tKLBDELETEA(basebuf);\r\n\t\t\t\t\treturn NULL;\r\n\t\t\t\t}\r\n\t\t\t\tmemcpy(newptr, basebuf, len);\r\n\t\t\t\tKLBDELETEA(basebuf);\r\n\t\t\t\tbasebuf  = newptr;\r\n\t\t\t\tptr      = basebuf + len;\r\n\t\t\t\tnow_size += ALLOC_SIZE;\r\n\t\t\t}\r\n\t\t\tmemcpy(ptr, data, reqsize);\r\n\t\t\tptr += reqsize;\r\n\t\t}\r\n\t}\r\n\t*ptr = 0;\r\n\treturn basebuf;\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::httpMethod(const char * method, const char * method_hdr,\r\n\t\t\t\t\t\t\t  const char * url,\r\n\t\t\t\t\t\t\t  bool isProxy, const char * body)\r\n{\r\n\tchar buf[1024];\r\n\r\n    if(!url_parse(url)) { return false; }\r\n    \r\n    // connect用にここで引数をメンバにコピしたりすめ\r\n    if( m_pMethod ) {\r\n        KLBDELETEA( m_pMethod );\r\n        m_pMethod = NULL;\r\n    }\r\n\tif( method != NULL ) {\r\n\t\tm_pMethod = KLBNEWA( char , strlen(method)+1 );\r\n\t\tmemset( (void*)m_pMethod , 0, strlen(method)+1 );\r\n\t\tmemcpy( (void*)m_pMethod , method , strlen(method) );\r\n\t}\r\n\r\n    if( m_pMethod_header ) {\r\n        KLBDELETEA( m_pMethod_header );\r\n        m_pMethod_header = NULL;\r\n    }\r\n\tif( method_hdr != NULL ) {\r\n\t\tm_pMethod_header = KLBNEWA( char , strlen(method_hdr)+1 );\r\n\t\tmemset( (void*)m_pMethod_header , 0, strlen(method_hdr)+1 );\r\n\t\tmemcpy( (void*)m_pMethod_header , method_hdr , strlen(method_hdr) );\r\n\t}\r\n\r\n    if( m_pBody ) {\r\n        KLBDELETEA( m_pBody );\r\n        m_pBody = NULL;\r\n    }\r\n\tif( body != NULL) {\r\n\t\tm_pBody = KLBNEWA( char , strlen(body)+1 );\r\n\t\tmemset( (void*)m_pBody , 0, strlen(body)+1 );\r\n\t\tmemcpy( (void*)m_pBody , body , strlen(body) );\r\n\t}\r\n    \r\n    m_bIsProxy = isProxy;\r\n\r\n\tm_rdSize = 0;\t// サイズ初期匁\r\n\r\n\t// プロキシが設定されており、なおかつそ使用を指示されてぁ場吁\r\n\tif(isProxy && m_proxy) {\r\n\t\tsprintf(buf, \"socket://%s:%d\", m_proxy_host, m_proxy_port);\r\n\t} else {\r\n\t\tsprintf(buf, \"socket://%s:%d\", m_host, m_port);\r\n\t}\r\n\tif(m_pWRSock) delete m_pWRSock;\r\n\tif(m_pSocket) delete m_pSocket;\r\n\r\n\tm_pWRSock = NULL;\r\n\tm_pSocket = NULL;\r\n\r\n    // connect用スレチをたてめ\r\n    if( m_pConnectName ) {\r\n        KLBDELETEA( m_pConnectName );\r\n        m_pConnectName = NULL;\r\n    }\r\n    m_pConnectName = KLBNEWA( char , strlen(buf)+1 );\r\n    memset( (void*)m_pConnectName , 0 , strlen(buf)+1 );\r\n    memcpy( (void*)m_pConnectName , buf , strlen(buf) );\r\n    \r\n    DEBUG_PRINT(\"--- ConnectName >\");\r\n    DEBUG_PRINT(\"%s\",m_pConnectName);\r\n    \r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    m_hThread = pForm.createThread(CKLBHTTPInterface::ThreadCONNECT, this);\r\n    m_eStep = E_CONNECT_WAITING;\r\n\r\n\tm_http_recv  = NULL;\r\n\tm_recv_size  = 0;\r\n\tm_buf_size   = 0;\r\n\tm_b_finished = false;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBHTTPInterface::httpMethod_AfterConnect(void)\r\n{\r\n    char buf[1024];\r\n    \r\n\tif(!m_pSocket || m_pSocket->getStatus() != IReadStream::NORMAL) {\r\n\t\tm_pSocket = 0;\r\n\t\treturn false;\r\n\t}\r\n\tm_pWRSock = m_pSocket->getWriteStream();\r\n\tif(!m_pWRSock) {\r\n\t\tdelete m_pSocket;\r\n\t\tm_pSocket = 0;\r\n\t\treturn false;\r\n\t}\r\n    \r\n\t// 基本methodとUserAgentを送る\r\n\tif(m_proxy && m_bIsProxy) {\r\n\t\tsprintf(buf,\r\n\t\t\t\t\"%s %s HTTP/1.1\\r\\n\"\r\n\t\t\t\t\"Host: %s:%d\\r\\n\"\r\n\t\t\t\t\"Connection: close\\r\\n\"\r\n\t\t\t\t\"User-Agent: %s\\r\\n%s\", m_pMethod, m_url, m_host, m_port, USER_AGENT, m_pMethod_header);\r\n\t} else {\r\n\t\tsprintf(buf,\r\n\t\t\t\t\"%s %s HTTP/1.1\\r\\n\"\r\n\t\t\t\t\"Host: %s:%d\\r\\n\"\r\n\t\t\t\t\"Connection: close\\r\\n\"\r\n\t\t\t\t\"User-Agent: %s\\r\\n%s\", m_pMethod, m_path, m_host, m_port, USER_AGENT, m_pMethod_header);\r\n\t}\r\n\tm_pWRSock->writeBlock(buf, strlen(buf));\r\n    \r\n\t// そ他追加HTTPヘッダを追加するhdrlen\r\n\tif(m_hdrlen > 0) {\r\n        m_pWRSock->writeBlock((void *)m_headers, m_hdrlen);\r\n    }\r\n    \r\n\t// 番人を送る\r\n\tm_pWRSock->writeBlock((void *)\"\\r\\n\", 2);\r\n\tm_eStep = E_STARTUP;\r\n    \r\n\t// bodyを送る。体的には送E用チEタバッファを確保し、別スレチでパケチの送Eを行わせる\r\n\tif(m_pBody) {\r\n\t\t// 送E冁と送Eサイズをメンバに取り込む\r\n\t\tm_sizeSend = strlen(m_pBody);\r\n\t\tm_bufSend = KLBNEWA(char, m_sizeSend);\r\n\t\tmemcpy((void *)m_bufSend, m_pBody, m_sizeSend); // Since size can be specified when sent out by socket, \\0 is unnecessary.\r\n        \r\n\t\t// 送Eスレチを立ち上げる\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tm_hThread   = pForm.createThread(CKLBHTTPInterface::ThreadSEND, this);\r\n\t\tm_eStep     = E_SENDING;\r\n\t}\r\n\tKLBDELETEA(m_http_recv);\r\n\r\n    // スレチ終亁に呼ばれるはずなのでnewした物は解放する\r\n    if( m_pConnectName ) {\r\n        KLBDELETEA( m_pConnectName );\r\n        m_pConnectName = NULL;\r\n    }\r\n    if( m_pBody ) {\r\n        KLBDELETEA( m_pBody );\r\n        m_pBody = NULL;\r\n    }\r\n    if( m_pMethod_header ) {\r\n        KLBDELETEA( m_pMethod_header );\r\n        m_pMethod_header = NULL;\r\n    }\r\n    if( m_pMethod ) {\r\n        KLBDELETEA( m_pMethod );\r\n        m_pMethod = NULL;\r\n    }\r\n    \r\n\tm_http_recv  = NULL;\r\n\tm_recv_size  = 0;\r\n\tm_buf_size   = 0;\r\n\tm_b_finished = false;\r\n    return true;\r\n}\r\n\r\n// static\r\nbool \r\nCKLBHTTPInterface::initHTTPLib()\r\n{\r\n\treturn true;\r\n}\r\n\r\n// static\r\nvoid \r\nCKLBHTTPInterface::releaseHTTPLib() \r\n{\r\n\t// Do nothing\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBHTTPInterface.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBHTTPInterface_h\r\n#define CKLBHTTPInterface_h\r\n\r\n#include \"CPFInterface.h\"\r\n#include <string.h>\r\n\r\n#define USER_AGENT \"UserAgent\"\r\n\r\n// SocketStream を利用して、HTTP/1.1 による通信を行う。\r\n// オンメモリ読み込みのほか、ダウンロード読み込み対応。\r\n\r\n#define USE_NEW_CURL_WRAPPER\r\n\r\n#ifdef USE_NEW_CURL_WRAPPER\r\nclass ConnectionEntry;\r\n\r\n/*!\r\n* \\class CKLBHTTPInterface\r\n* \\brief HTTP Interface Class\r\n* \r\n* \r\n*/\r\nclass CKLBHTTPInterface\r\n{\r\n\tfriend class ConnectionEntry;\r\nprivate:\r\n\tCKLBHTTPInterface();\r\n\tvirtual ~CKLBHTTPInterface();\r\npublic:\r\n\tvoid reuse();\r\n\r\n\t// 追加HTTPヘッダの指定\r\n\tbool setHeader(const char ** headers);\r\n\r\n\t// 指定フォーム値のURLencode\r\n\tchar * setForm(const char ** postForm);\r\n\r\n\t// GET発行\r\n\tbool httpGET(const char * url, bool isProxy);\r\n\r\n\t// POST発行\r\n\tbool httpPOST(const char * url, bool isProxy);\r\n\r\n\t// ダウンロード保存パス名を指定し、ダウンロードモードでの動作を開始する。\r\n\t// NULL指定で通常のオンメモリモードでの動作に戻る\r\n\tbool setDownload(const char * path);\r\n\r\n\t// 受信ステータス\r\n\tbool httpRECV();\r\n\r\n\t// 現在の受信サイズ\r\n\ts64 getSize();\r\n\tinline s64 getDwnldSize()\t{ return m_receivedSize; }\r\n\r\n\t// 受信リソースの取得\r\n\tu8 * getRecvResource();\r\n\r\n    // httpのstate取得 2013.2.13  追加\r\n\tint getHttpState();\r\n\r\n\tbool isMaintenance()\t\t\t\t\t\t\t\t\t\t{ return this->m_maintenance; }\r\n\tbool hasHeader(const char* header, const char** value);\r\nprivate:\r\n\tvoid clear();\r\n\tvoid init ();\r\n\r\n\tstatic s32\tHTTPConnectionThread(void * hThread, void * data);\r\n\tstatic int\tprogress_func\t\t(void* ctx, double t, double d, double ultotal, double ulnow);\r\n\tstatic size_t write_func\t\t(char *ptr, size_t size, size_t nmemb, void *userdata); \r\n\tstatic size_t headerReceive_func(void *ptr, size_t size, size_t nmemb, void *userdata);\r\n\r\n\tvoid\t\tprogress(u64 total, u64 download);\r\n\tsize_t\t\twrite\t(char *ptr, size_t size, size_t nmemb);\r\n\tvoid\t\tdownload();\r\n\r\n\t// HTTP Error Code\r\n\tint\t\t\tm_errorCode;\r\n\tint\t\t\tm_tmpErrorCode;\r\n\tbool\t\tm_bDataComplete;\r\n\tbool\t\tm_bDownload;\r\n\tbool\t\tm_bothFileAndMem;\r\n\tbool\t\tm_post;\r\n\tbool\t\tm_maintenance;\r\n\tconst char*\tm_url;\r\n\tvoid*\t\tm_pCurl;\r\n\tconst char*\tm_pServerVersion;\r\n\r\n\tITmpFile*\tm_pTmpFile;\r\n\ts64\t\t\tm_receivedSize;\r\n\ts64\t\t\tm_writeIndex;\r\n\tu8*\t\t\tm_receivedData;\r\n\tu8*\t\t\tm_buffer;\r\n\tvoid*\t\tm_thread;\r\npublic:\r\n\tvolatile u32 m_threadStop;\r\nprivate:\r\n\tbool\t\tm_stopThread;\r\n\r\n\t// 追加HTTPヘッダ\r\n\tconst char*\tm_headers;\r\n\tconst char** m_headerEntry;\r\n\tconst char** m_postForm;\r\n\tu32*\t\tm_headerEntryLen;\r\n\tu32\t\t\tm_hdrlen;\r\n\tu32\t\t\tm_headerEntryCount;\r\npublic:\r\n\tstatic\t\tbool initHTTPLib();\r\n\tstatic\t\tvoid releaseHTTPLib();\r\n};\r\n\r\n#else\r\n\r\nclass CKLBHTTPInterface\r\n{\r\npublic:\r\n\tCKLBHTTPInterface();\r\n\tvirtual ~CKLBHTTPInterface();\r\n\r\n\t// 追加HTTPヘッダの指定\r\n\tbool setHeader(const char ** headers);\r\n\r\n\t// 指定フォーム値のURLencode\r\n\tchar * URLencode(char * retbuf, int maxlen, const char ** postForm);\r\n\r\n\t// GET発行\r\n\tinline bool httpGET(const char * url, bool isProxy) {\r\n\t\treturn httpMethod(\"GET\", \"\", url, isProxy, 0);\r\n\t}\r\n\r\n\t// POST発行\r\n\tinline bool httpPOST(const char * url, bool isProxy, const char * encodedForm) {\r\n\t\tchar buf[1024];\r\n\t\tint postLen = strlen(encodedForm);\r\n\t\tsprintf(buf,\r\n                \"Content-type: application/x-www-form-urlencoded; charset=UTF-8\\r\\n\"\r\n                \"Content-Length: %d\\r\\n\", postLen);\r\n\t\treturn httpMethod(\"POST\", buf, url, isProxy, encodedForm);\r\n\t}\r\n\r\n\t// ダウンロード保存パス名を指定し、ダウンロードモードでの動作を開始する。\r\n\t// NULL指定で通常のオンメモリモードでの動作に戻る\r\n\tbool setDownload(const char * path);\r\n\r\n\t// 受信ステータス\r\n\tbool httpRECV();\r\n\r\n\t// 現在の受信サイズ\r\n\tinline s64 getSize\t\t()\t{ return m_rdSize;\t\t}\r\n\tinline s64 getDwnldSize\t()\t{ return m_recv_size;\t}\r\n\t// 受信リソースの取得\r\n\tinline u8 * getRecvResource() {\r\n\t\tif(!m_b_finished) return 0;\t// まだ受信が終わっていない場合\r\n\t\treturn m_http_recv;\r\n\t}\r\n\r\n    // httpのstate取得 2013.2.13  追加\r\n    inline int getHttpState\t()\t{ return m_http_state; }\r\n\r\nprivate:\r\n\t// 受信情報のクリア\r\n\tinline void crearRecvResource() {\r\n\t\tKLBDELETEA(m_http_recv);\r\n\t\tm_buf_size = 0;\r\n\t\tm_recv_size = 0;\r\n\t\tm_b_finished = false;\r\n\t}\r\n    \r\n    // connect thread用\r\n    inline void\t\t\tsetSocket\t\t(IReadStream* _pSpcket) { m_pSocket = _pSpcket; }\r\n    inline const char*\tgetConnectName\t(void)\t\t{ return m_pConnectName;\t\t}\r\n\t// JOINTでのbodySize計算用に\r\n\tinline void\t\t\tSetBodySize\t\t(int _set)\t{ m_test_body_length = _set;\t}\r\n\tinline void\t\t\tAddBodySize\t\t(int _add)\t{ m_test_body_length += _add;\t}\r\n\tinline int\t\t\tGetBodySize\t\t(void)\t\t{ return m_test_body_length;\t}\r\n\r\n\tbool httpMethod(const char * method, const char * method_hdr, \r\n\t\t\t\t\tconst char * url, bool isProxy, const char * body);\r\n\tbool httpMethod_AfterConnect(void); // 上記関数内の処理をconnect終了後の処理と分割\r\n\r\n\tbool url_parse(const char * url);\r\n\r\n\tbool cmp_header(char * ptr, const char * str, size_t len);\r\n\r\n\t// Transfer-Encoding: chunked か否かを判定\r\n\tbool get_format(char * buf, bool * chunked, u64 * length);\r\n\r\n\t// chunkサイズを取得。\r\n\tchar * get_chunk_size(char * buf, size_t len, size_t * chunk_size);\r\n\tint    find_crlf(const char * ptr, int len);\r\n\r\n\t// 送出中処理\r\n\tinline void sending() {\r\n\t\tm_pWRSock->writeBlock((void *)m_bufSend, m_sizeSend);\r\n\t}\r\n\r\n\r\n\tbool\t\t\t\tm_proxy;\r\n\tconst char\t\t*\tm_proxy_host;\r\n\tint\t\t\t\t\tm_proxy_port;\r\n\r\n\tconst char\t\t*\tm_url;\r\n\tconst char\t\t*\tm_host;\r\n\tconst char\t\t*\tm_path;\r\n\tint\t\t\t\t\tm_port;\r\n\r\n\t// 追加HTTPヘッダ\r\n\tconst char\t\t*\tm_headers;\r\n\tint\t\t\t\t\tm_hdrlen;\r\n\r\n\tIReadStream\t\t*\tm_pSocket;\r\n\tIWriteStream\t*\tm_pWRSock;\r\n\r\n\tconst char\t\t*\tm_bufSend;\r\n\tint\t\t\t\t\tm_sizeSend;\r\n\r\n\t// 取得したリソース(コマンド実行結果)\r\n\ts64\t\t\t\t\tm_rdSize;\r\n\tvoid\t\t\t*\tm_hThread;\r\n\tu8\t\t\t\t*\tm_http_recv;\r\n\tsize_t\t\t\t\tm_buf_size;\t\t// 確保ずみバッファのサイズ\r\n\tsize_t\t\t\t\tm_recv_size;\t// 受信済みサイズ\r\n\tsize_t\t\t\t\tm_total_size;\t// header + body のサイズ\r\n\tsize_t\t\t\t\tm_rightsize;\t// 現在の受信単位で読むべきサイズ\r\n\tint\t\t\t\t\tm_sThreadSig;\t// Thread を終了させる値\r\n\tbool\t\t\t\tm_chunked;\t\t// 送信形式が chunked であればtrueになる。\r\n\tbool\t\t\t\tm_b_finished;\t// 読み終わりフラグ\r\n\r\n\tbool\t\t\t\tm_bDownload;\t// ダウンロード読み込みモードフラグ\r\n\tITmpFile\t\t*\tm_pTmpFile;\t\t// ダウンロード先テンポラリ\r\n\r\n    size_t              m_read_size;    // readBrockで読み込んでいるサイズの残り\r\n    size_t              m_header_size;  // ヘッダーサイズ\r\n    u64                 m_notchunk_length;  // chunkで無い場合のデータサイズ\r\n    char*               m_pReadNow;     // 現在の見ている場所\r\n    bool                m_bChunkDebug;\r\n    int                 m_http_state;   // httpヘッダーのstate保存用 2013.2.13 追加\r\n    int                 m_test_body_length;\t// JOINTでのbodySize計算用に\r\n\r\n    // connect thread用\r\n    const char* m_pConnectName;\r\n    const char* m_pMethod;\r\n    const char* m_pMethod_header;\r\n    const char* m_pBody;\r\n    bool        m_bIsProxy;\r\n    \r\n    \r\n\tstruct CHUNK {\r\n\t\tCHUNK\t*\tprev;\r\n\t\tCHUNK\t*\tnext;\r\n\t\tsize_t\t\tsize;\r\n\t};\r\n\tCHUNK\t\t\t*\tm_begin;\r\n\tCHUNK\t\t\t*\tm_end;\r\n\r\n\tCHUNK * create_chunk(size_t size);\r\n\tvoid remove_chunk(CHUNK * pChunk);\r\n\tinline void remove_last_chunk() { remove_chunk(m_end); }\r\n\tvoid read_finish(void);\r\n\r\n\tu8\t\t\t\t\tm_tmpBuf[1025];\r\n\tsize_t\t\t\t\tm_tmpsize;\r\n\ttypedef enum {\r\n        E_CONNECT_WAITING,  // SocketのConnect待ち\r\n\t\tE_SENDING,\t// Request送出中\r\n\t\tE_STARTUP,\t// 開始\r\n\r\n\t\tE_RDHDR,\t// HTTPヘッダ読み込み中 →ヘッダのみの処理にする\r\n\r\n\t\tE_RD_BODY_NOT_CHUNKED,  // chunkでは無いデータの場合\r\n\t\tE_RD_BODY_CHUNKED,      // chunkデータの場合\r\n\r\n\r\n\t\t// 単品bodyの場合\r\n\t\tE_RDBODY,\t// リソース本体読み込み中\r\n\r\n\t\t// Transfer-Encoding: chunked の場合\r\n\t\tE_RDCHUNK,\t// チャンク読み込み中\r\n\t\tE_NEXTCHUNK,// 次のチャンク読み込み待ち\r\n\r\n\t\tE_END\t\t// 読み込み終了\r\n\t} STEP;\r\n\r\n\tSTEP\t\t\t\tm_eStep;\r\n\r\n\tenum {\r\n\t\tHEADER_BUF_SIZE\t\t\t=\t8192,\r\n\t\tBLOCK_SIZE\t\t\t\t=\t4096,\r\n\t\tMAX_BLOCK_IN_FRAME\t\t=\t8,\r\n\r\n\t\tALLOC_SIZE\t\t\t\t=\t1024,\r\n\r\n\t\tRETRY\t\t\t\t\t= 8,\r\n\t};\r\n\r\n\tstatic s32 ThreadSEND\t(void * hThread, void * data);\r\n\tstatic s32 ThreadHTTP\t(void * hThread, void * data);\r\n\tstatic s32 ThreadJOINT\t(void * hThread, void * data);\r\n\tstatic s32 ThreadCONNECT(void * hThread, void * data);\r\npublic:\r\n\tstatic bool initHTTPLib\t\t();\r\n\tstatic void releaseHTTPLib\t();\r\n};\r\n#endif // Selection CURL lib.\r\n\r\n#endif // CKLBHTTPInterface_h\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBJsonItem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBJsonItem.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"../../libs/JSonParser/api/yajl_parse.h\"\r\n#include \"../../libs/JSonParser/api/yajl_gen.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n#include <string.h>\r\n\r\nCKLBJsonItem::CKLBJsonItem(CKLBJsonItem * pParent)\r\n: m_pParent     (pParent)\r\n, m_child_begin (NULL)\r\n, m_child_end   (NULL)\r\n, m_prev        (NULL)\r\n, m_next        (NULL)\r\n, m_key         (NULL)\r\n{\r\n\tif(m_pParent) {\r\n\t\tm_prev = m_pParent->m_child_end;\r\n\t\tif(m_prev) {\r\n\t\t\tm_prev->m_next = this;\r\n\t\t} else {\r\n\t\t\tm_pParent->m_child_begin = this;\r\n\t\t}\r\n\t\tm_pParent->m_child_end = this;\r\n\t}\r\n\tmemset(&m_value, 0, sizeof(union VAR));\r\n}\r\n\r\nCKLBJsonItem::~CKLBJsonItem()\r\n{\r\n\t// 自身の子を削除する\r\n\tCKLBJsonItem * pItem = m_child_begin;\r\n\tCKLBJsonItem * pNext;\r\n\twhile(pItem) {\r\n\t\tpNext = pItem->m_next;\r\n\t\tKLBDELETE(pItem);\r\n\t\tpItem = pNext;\r\n\t}\r\n\r\n\t// 兄弟から抜ける\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tif(m_pParent) m_pParent->m_child_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tif(m_pParent) m_pParent->m_child_end = m_prev;\r\n\t}\r\n\r\n\t// キーを破棄する\r\n\tKLBDELETEA(m_key);\r\n\r\n\t// 自身のtypeがJ_STRINGであれば、その領域を破棄する\r\n\tif(m_type == J_STRING) {\r\n\t\tKLBDELETEA(m_value.s);\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBJsonItem::setKey(const char * keyname)\r\n{\r\n\tm_key = CKLBUtility::copyString(keyname);\r\n    if(!m_key) { return false; }\r\n\treturn true;\r\n}\r\n\r\nCKLBJsonItem *\r\nCKLBJsonItem::searchChild(const char * key)\r\n{\r\n\tCKLBJsonItem * pItem = m_child_begin;\r\n    while(pItem && strcmp(pItem->m_key, key)) { pItem = pItem->m_next; }\r\n\treturn pItem;\r\n}\r\n\r\n\r\nCKLBJsonItem *\r\nCKLBJsonItem::ReadJsonData(const char * json_string, u32 json_size)\r\n{\r\n\ts64 start = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\tstatic yajl_callbacks callbacks = { \r\n\t\tCKLBJsonItem::read_null,  \r\n\t\tCKLBJsonItem::read_boolean,  \r\n\t\tCKLBJsonItem::read_int,  \r\n\t\tCKLBJsonItem::read_double,  \r\n\t\tnull,  \r\n\t\tCKLBJsonItem::read_string,  \r\n\t\tCKLBJsonItem::read_start_map,  \r\n\t\tCKLBJsonItem::read_map_key,  \r\n\t\tCKLBJsonItem::read_end_map,  \r\n\t\tCKLBJsonItem::read_start_array,  \r\n\t\tCKLBJsonItem::read_end_array\r\n\t};\r\n\tyajl_handle hand;\r\n    /* generator config */  \r\n//    yajl_gen g;\t\t\t\t    // My Context.2012.12.05  使用していなかったのでコメントアウト\r\n    yajl_status stat;  \r\n  \r\n\t\r\n//    g = yajl_gen_alloc(NULL);\t\t// 2012.12.05  使用していなかったのでコメントアウト\r\n\r\n\tJSON_State * pState = KLBNEW(JSON_State);\r\n\tpState->pCurrent = NULL;\r\n\tpState->pFirst   = NULL;\r\n\tpState->pParent  = NULL;\r\n\r\n\t/* ok.  open file.  let's read and parse */  \r\n\thand = yajl_alloc(&callbacks, NULL, pState);\r\n\r\n\tif (hand) {\r\n\t\t/* and let's allow comments by default */  \r\n\t\tyajl_config(hand, yajl_allow_comments, 1);\r\n\r\n\t\tu32 size = (!json_size) ? strlen(json_string) : json_size;\r\n\t\tstat = yajl_parse(hand, (const unsigned char *)json_string, size);\r\n\r\n\t\tCKLBJsonItem * pRoot = pState->pFirst;\r\n\t\tKLBDELETE(pState);\r\n\r\n\t\tif (stat == yajl_status_ok) {\r\n\t\t\tstat = yajl_complete_parse(hand);\r\n\t\t\tif (stat == yajl_status_ok) {\r\n\t\t\t\tyajl_free(hand);\r\n\t\t\t\ts64 time = CPFInterface::getInstance().platform().nanotime() - start;\r\n\t\t\t\tDEBUG_PRINT(\"JSon -> Tree : %f ms\",(float)(time / 1000000.0));\r\n\t\t\t\treturn pRoot;\r\n\t\t\t}\r\n\t\t}\r\n        if(pRoot) { KLBDELETE(pRoot); }     // 2012.12.12  NULLチェック追加\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\n\r\nint\r\nCKLBJsonItem::read_null(void * ctx)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tCKLBJsonItem * pItem;\r\n\tif(pState->pCurrent) {\r\n\t\tpItem = pState->pCurrent;\r\n\t} else {\r\n\t\tpItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t}\r\n\tpItem->m_type    = J_NULL;\r\n\tpState->pCurrent = NULL;\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_boolean(void * ctx, int boolean)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tCKLBJsonItem * pItem;\r\n\tif(pState->pCurrent) {\r\n\t\tpItem = pState->pCurrent;\r\n\t} else {\r\n\t\tpItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t}\r\n\tpItem->m_type    = J_BOOLEAN;\r\n\tpItem->m_value.b = (boolean != 0) ? true : false;\r\n\tpState->pCurrent = NULL;\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_int(void * ctx, long long integerVal)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tCKLBJsonItem * pItem;\r\n\tif(pState->pCurrent) {\r\n\t\tpItem = pState->pCurrent;\r\n\t} else {\r\n\t\tpItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t}\r\n\tpItem->m_type    = J_INT;\r\n\tpItem->m_value.i = integerVal;\r\n\tpState->pCurrent = NULL;\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_double(void * ctx, double doubleVal)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tCKLBJsonItem * pItem;\r\n\tif(pState->pCurrent) {\r\n\t\tpItem = pState->pCurrent;\r\n\t} else {\r\n\t\tpItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t}\r\n\tpItem->m_type    = J_DOUBLE;\r\n\tpItem->m_value.d = doubleVal;\r\n\tpState->pCurrent = NULL;\r\n\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_string(void * ctx, const unsigned char * stringVal, size_t stringLen, int /*cte_pool*/)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tchar * buf = KLBNEWA(char, stringLen + 1);\r\n\tstrncpy(buf, (const char *)stringVal, stringLen);\r\n\tbuf[stringLen] = 0;\r\n\r\n\tCKLBJsonItem * pItem;\r\n\tif(pState->pCurrent) {\r\n\t\tpItem = pState->pCurrent;\r\n\t\tpItem->m_type    = J_STRING;\r\n\t\tpItem->m_value.s = buf;\r\n\t} else {\r\n\t\tpItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t}\r\n\tpItem->m_type    = J_STRING;\r\n\tpItem->m_value.s = buf;\r\n\tpState->pCurrent = NULL;\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_start_map(void * ctx, unsigned int /*size*/)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tif(!pState->pCurrent) {\r\n\t\tCKLBJsonItem * pItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t\tpState->pCurrent = pItem;\r\n\t\tif(!pState->pFirst) pState->pFirst = pItem;\r\n\t}\r\n\tpState->pCurrent->m_type = J_MAP;\r\n\r\n\tpState->pParent  = pState->pCurrent;\r\n\tpState->pCurrent = NULL;\r\n\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_map_key(void * ctx, const unsigned char * stringVal, size_t stringLen, int /*cte_pool*/)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tCKLBJsonItem * pItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\tpState->pCurrent = pItem;\r\n\tif(!pState->pFirst) pState->pFirst = pItem;\r\n\r\n\tchar buf[256];\r\n\tstrncpy(buf, (const char *)stringVal, stringLen);\r\n\tbuf[stringLen] = 0;\r\n\tpItem->setKey((const char *)buf);\r\n\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_end_map(void * ctx)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tpState->pCurrent = pState->pParent;\r\n\tpState->pParent  = pState->pCurrent->m_pParent;\r\n\tpState->pCurrent = NULL;\r\n\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_start_array(void * ctx, unsigned int /*size*/)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tif(!pState->pCurrent) {\r\n\t\tCKLBJsonItem * pItem = KLBNEWC(CKLBJsonItem, (pState->pParent));\r\n\t\tpState->pCurrent = pItem;\r\n\t\tif(!pState->pFirst) pState->pFirst = pItem;\r\n\t}\r\n\r\n\tpState->pCurrent->m_type = J_ARRAY;\r\n\r\n\tpState->pParent  = pState->pCurrent;\r\n\tpState->pCurrent = NULL;\r\n\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBJsonItem::read_end_array(void * ctx)\r\n{\r\n\tJSON_State * pState = (JSON_State *)ctx;\r\n\r\n\tpState->pCurrent = pState->pParent;\r\n\tpState->pParent  = pState->pCurrent->m_pParent;\r\n\tpState->pCurrent = NULL;\r\n\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBJsonItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBJsonItem_h\r\n#define CKLBJsonItem_h\r\n\r\n#include <stdlib.h>\r\n#include \"BaseType.h\"\r\n\r\n/*!\r\n* \\class CKLBJsonItem\r\n* \\brief JSON Item Class\r\n* \r\n* \r\n*/\r\nclass CKLBJsonItem\r\n{\r\npublic:\r\n\tCKLBJsonItem(CKLBJsonItem * pParent);\r\n\tvirtual ~CKLBJsonItem();\r\n\r\n\t// キー取得\r\n\tinline const char * key() const { return m_key; }\r\n\r\n\tbool setKey(const char * keyname);\r\n\r\n\t// データ型種別\r\n\ttypedef enum {\r\n\t\tJ_NULL,\r\n\t\tJ_BOOLEAN,\r\n\t\tJ_INT,\r\n\t\tJ_DOUBLE,\r\n\t\tJ_STRING,\r\n\t\tJ_MAP,\t\t\t// { 〜 } mapにはkeyが無い場合がある。\r\n\t\tJ_ARRAY,\t\t// [ 〜 ] arrayにはkeyがある。\r\n\t} JSON_TYPE;\r\n\r\n\t// map と array は Json 的には異なるが、このデータでは同様に階層構造で扱う。\r\n\r\n\tinline const JSON_TYPE getType() const { return m_type; }\r\n\r\n\tstatic CKLBJsonItem * ReadJsonData(const char * json_string, u32 json_size = 0);\r\n\r\n\tinline CKLBJsonItem * next\t() { return m_next;\t\t\t}\r\n\tinline CKLBJsonItem * prev\t() { return m_prev;\t\t\t}\r\n\tinline CKLBJsonItem * child\t() { return m_child_begin;\t}\r\n\tinline CKLBJsonItem * parent() { return m_pParent;\t\t}\r\n\r\n\tinline bool getBool\t() const { return m_value.b;\t\t}\r\n\tinline int  getInt\t() const { return (int)getInt64();\t}\r\n\tinline s64  getInt64() const {\r\n\t\tif(m_type == J_INT) return m_value.i;\r\n\t\tif(m_type == J_DOUBLE) return (s64)m_value.d;\r\n\t\tif(m_type == J_STRING) {\r\n\t\t\ts64 val = 0;\r\n\t\t\tconst char * p = m_value.s;\r\n\t\t\ts64 sign = 1LL;\r\n\t\t\tif(*p == '-') {\r\n\t\t\t\tsign = -1LL;\r\n\t\t\t\tp++;\r\n\t\t\t}\r\n\t\t\twhile(int c = *p++) {\r\n\t\t\t\tval = val * 10LL + (s64)(c - '0');\r\n\t\t\t}\r\n\t\t\tval = val * sign;\r\n\t\t\treturn val;\r\n\t\t}\r\n\t\treturn 0LL;\r\n\t}\r\n\tinline double getDouble() const {\r\n\t\tif(m_type == J_DOUBLE) return m_value.d;\r\n\t\tif(m_type == J_INT) return (double)m_value.i;\r\n\t\tif(m_type == J_STRING) {\r\n\t\t\tdouble val;\r\n\t\t\tsscanf(m_value.s, \"%lf\", &val);\r\n\t\t\treturn val;\r\n\t\t}\r\n\t\treturn 0.0;\r\n\t}\r\n\tinline const char * getString() const { return m_value.s; }\r\n\r\n\tCKLBJsonItem * searchChild(const char * key);\r\n\r\nprivate:\r\n\tCKLBJsonItem\t*\tm_pParent;\t// 親アイテム\r\n\r\n\tCKLBJsonItem\t*\tm_child_begin;\t// 子アイテム\r\n\tCKLBJsonItem\t*\tm_child_end;\r\n\r\n\tCKLBJsonItem\t*\tm_prev;\t\t// 兄弟(前)\r\n\tCKLBJsonItem\t*\tm_next;\t\t// 兄弟(次)\r\n\r\n\tconst char\t\t*\tm_key;\t\t// キー(名前)\r\n\r\nprivate:\r\n\r\n\tunion VAR {\r\n\t\tbool\t\t\tb;\r\n\t\ts64\t\t\t\ti;\r\n\t\tdouble\t\t\td;\r\n\t\tconst char\t*\ts;\r\n\t} m_value;\r\n\r\n\tJSON_TYPE\t\tm_type;\r\n\r\n\ttypedef struct {\r\n\t\tCKLBJsonItem\t*\tpParent;\r\n\t\tCKLBJsonItem\t*\tpCurrent;\r\n\t\tCKLBJsonItem\t*\tpFirst;\r\n\t} JSON_State;\r\n\r\n\tstatic int read_null\t\t(void * ctx);\r\n\tstatic int read_boolean\t\t(void * ctx, int boolean);\r\n\tstatic int read_int\t\t\t(void * ctx, long long integerVal);\r\n\tstatic int read_double\t\t(void * ctx, double doubleVal);\r\n\tstatic int read_string\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_start_map\t(void * ctx, unsigned int size);  \r\n\tstatic int read_map_key\t\t(void * ctx, const unsigned char * stringVal, size_t stringLen, int cte_pool);\r\n\tstatic int read_end_map\t\t(void * ctx);\r\n\tstatic int read_start_array\t(void * ctx, unsigned int size);\r\n\tstatic int read_end_array\t(void * ctx);\r\n};\r\n\r\n\r\n#endif // CKLBJsonItem_h\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBNetAPI.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBNetAPI.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBJsonItem.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBNetAPIKeyChain.h\"\r\n\r\n#include <time.h>\r\n#include <ctype.h>\r\n\r\n;\r\nenum {\r\n\t// Command Values定義\r\n\tNETAPI_SEND,\t\t\t\t// send JSON packet\r\n\tNETAPI_CANCEL,\t\t\t\t// selected session cancel.\r\n\tNETAPI_BUSY,\t\t\t\t// busy\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"NETAPI_SEND\",\t\t\t\tNETAPI_SEND\t\t},\r\n    {\"NETAPI_CANCEL\",\t\t\tNETAPI_CANCEL\t},\r\n\t{\"NETAPI_BUSY\",\t\t\t\tNETAPI_BUSY\t\t},\r\n\r\n\t//\r\n\t// Callback constants\r\n\t//\r\n\t{\"NETAPIMSG_CONNECTION_FAILED\",\tNETAPIMSG_CONNECTION_FAILED },\r\n\t{\"NETAPIMSG_SERVER_ERROR\",\t\tNETAPIMSG_SERVER_ERROR\t\t},\r\n\t{\"NETAPIMSG_SERVER_TIMEOUT\",\tNETAPIMSG_SERVER_TIMEOUT\t},\r\n\t{\"NETAPIMSG_REQUEST_SUCCESS\",\tNETAPIMSG_REQUEST_SUCCESS\t},\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBNetAPI> factory(\"HTTP_API\", CLS_KLBNETAPI, cmd);\r\n\r\nenum {\r\n\tARG_CALLBACK\t= 1,\r\n\tARG_REQUIRE     = ARG_CALLBACK,\r\n};\r\n\r\n\r\nCKLBNetAPI::CKLBNetAPI()\r\n: CKLBLuaTask           ()\r\n, m_http\t\t\t\t(NULL)\r\n, m_timeout\t\t\t\t(30000)\r\n, m_timestart\t\t\t(0)\r\n, m_canceled\t\t\t(false)\r\n, m_pRoot\t\t\t\t(NULL)\r\n, m_callback\t\t\t(NULL)\r\n, m_http_header_array\t(NULL)\r\n, m_http_header_length\t(0)\r\n{\r\n}\r\n\r\nCKLBNetAPI::~CKLBNetAPI() \r\n{\r\n\t// Done in Die()\r\n}\r\n\r\nu32 \r\nCKLBNetAPI::getClassID() \r\n{\r\n\treturn CLS_KLBNETAPI;\r\n}\r\n\r\nvoid\r\nCKLBNetAPI::execute(u32 deltaT)\r\n{\r\n\tif (!m_http) {\r\n\t\treturn; // Do nothing if no active connection\r\n\t}\r\n\r\n\tm_timestart += deltaT;\r\n\r\n\t// Check cancel first\r\n\tif (m_canceled) {\r\n\t\tlua_callback(NETAPIMSG_CONNECTION_CANCELED, -1, NULL);\r\n\r\n\t\tNetworkManager::releaseConnection(m_http);\r\n\t\tm_http = NULL;\r\n\t\t// Reset flag\r\n\t\tm_canceled = false;\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Received data second\r\n\tif (m_http->httpRECV() || (m_http->getHttpState() != -1)) {\r\n\t\t// Get Data\r\n\t\tu8* body\t= m_http->getRecvResource();\r\n\t\tu32 bodyLen\t= body ? m_http->getSize() : 0;\r\n\t\t\r\n\t\t// Get Status Code\r\n\t\tint state = m_http->getHttpState();\r\n\t\tbool invalid = ((state >= 500) && (state <= 599)) || (state == 204);\r\n\t\tint msg = invalid ? NETAPIMSG_REQUEST_SUCCESS : NETAPIMSG_SERVER_ERROR;\r\n\r\n\t\t//\r\n\t\t// Support only JSon for callback\r\n\t\t// \r\n\t\tfreeJSonResult();\r\n\t\tm_pRoot = getJsonTree((const char*)body, bodyLen);\r\n\t\tlua_callback(msg, state, m_pRoot);\r\n\r\n\t\tNetworkManager::releaseConnection(m_http);\r\n\t\tm_http = NULL;\r\n\t\treturn;\r\n\t}\r\n\r\n\tif ((m_http->m_threadStop == 1) && (m_http->getHttpState() == -1)) {\r\n\t\tlua_callback(NETAPIMSG_CONNECTION_FAILED, -1, NULL);\r\n\t\tNetworkManager::releaseConnection(m_http);\r\n\t\tm_http = NULL;\r\n\t}\r\n\r\n\t// Time out third (after check that valid has arrived)\r\n\tif (m_timestart >= m_timeout) {\r\n\t\tlua_callback(NETAPIMSG_SERVER_TIMEOUT, -1, NULL);\r\n\t\tNetworkManager::releaseConnection(m_http);\r\n\t\tm_http = NULL;\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBNetAPI::die()\r\n{\r\n\tif (m_http) {\r\n\t\tNetworkManager::releaseConnection(m_http);\r\n\t}\r\n\tKLBDELETEA(m_callback);\r\n\tfreeHeader();\r\n\tfreeJSonResult();\r\n}\r\n\r\nvoid\r\nCKLBNetAPI::freeJSonResult() {\r\n\tKLBDELETE(m_pRoot);\r\n}\r\n\r\nvoid\r\nCKLBNetAPI::freeHeader() {\r\n\tif (m_http_header_array) {\r\n\t\tfor (u32 n=0; n < m_http_header_length; n++) {\r\n\t\t\tKLBDELETEA(m_http_header_array[n]);\r\n\t\t}\r\n\t\tKLBDELETEA(m_http_header_array);\r\n\t\tm_http_header_array = NULL;\r\n\t}\r\n}\r\n\r\nCKLBNetAPI* \r\nCKLBNetAPI::create( CKLBTask* pParentTask, \r\n                    const char * callback) \r\n{\r\n\tCKLBNetAPI* pTask = KLBNEW(CKLBNetAPI);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool \r\nCKLBNetAPI::init(\tCKLBTask* pTask,\r\n\t\t\t\t\tconst char * callback) \r\n{\r\n\tm_callback = (callback) ? CKLBUtility::copyString(callback) : NULL;\r\n\r\n\t// 一通り初期化値が作れたのでタスクを登録\r\n\tbool res = regist(pTask, P_INPUT);\r\n\treturn res;\r\n}\r\n\r\nbool\r\nCKLBNetAPI::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n    if (argc < ARG_REQUIRE) { return false; }\r\n\r\n\treturn init(NULL, lua.getString(ARG_CALLBACK));\r\n}\r\n\r\nCKLBJsonItem *\r\nCKLBNetAPI::getJsonTree(const char * json_string, u32 dataLen)\r\n{\r\n\tCKLBJsonItem * pRoot = CKLBJsonItem::ReadJsonData((const char *)json_string, dataLen);\r\n\r\n\treturn pRoot;\r\n}\r\n\r\nint\r\nCKLBNetAPI::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tint cmd = lua.getInt(2);\r\n\tint ret = 1;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase NETAPI_CANCEL:\r\n\t\t{\r\n\t\t\tif (m_http != NULL) {\r\n\t\t\t\tm_canceled = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(m_http != NULL);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase NETAPI_BUSY:\r\n\t\t{\r\n\t\t\t// If object is alive, then it is busy.\r\n\t\t\tlua.retBoolean(m_http != NULL);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase NETAPI_SEND:\r\n\t\t{\r\n\t\t\t//\r\n\t\t\t// 3. URL\r\n\t\t\t// 4. Header table\r\n\t\t\t// 5. POST optionnal\r\n\t\t\t// 6. Timeout\r\n\t\t\t//\r\n\t\t\tif(argc < 3 || argc > 6) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\tif (m_http) {\r\n\t\t\t\t// Connection is still busy,you can not send\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconst char * api = NULL;\r\n\t\t\t\tif(!lua.isNil(3)) api = lua.getString(3);\r\n\r\n\t\t\t\t// Header list\r\n\t\t\t\tconst char** headers = NULL;\r\n\t\t\t\tconst char** values  = NULL;\r\n\t\t\t\tfreeHeader();\r\n\r\n\t\t\t\tif(!lua.isNil(4)) {\r\n\t\t\t\t\t// Get the asset list\r\n\t\t\t\t\tlua.retValue(4);\r\n\r\n\t\t\t\t\t// Count the number of elements\r\n\t\t\t\t\tint max = 0;\r\n\t\t\t\t\tlua.retNil();\r\n\r\n\t\t\t\t\t// Read indexes and count entries.\r\n\t\t\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\t\t\tlua.retValue(-2);\r\n\t\t\t\t\t\tmax++;\r\n\t\t\t\t\t\tlua.pop(2);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmax++; // Empty at the end.\r\n\r\n\t\t\t\t\tint idx=0;\r\n\t\t\t\t\tif (max) {\r\n\t\t\t\t\t\tm_http_header_array = KLBNEWA(const char*, max);\r\n\r\n\t\t\t\t\t\tif (m_http_header_array==NULL) {\r\n\t\t\t\t\t\t\t// Connection is still busy,you can not send\r\n\t\t\t\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\t\t\t\tret = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Reset all handle to NULL\r\n\t\t\t\t\t\tfor (idx = 0; idx < max; idx++) {\r\n\t\t\t\t\t\t\tm_http_header_array[idx] = NULL;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tlua.retNil();\r\n\t\t\t\t\t\tidx = 0;\r\n\t\t\t\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\t\t\t\tlua.retValue(-2);\r\n\t\t\t\t\t\t\tconst char * key = lua.getString(-1);\r\n\t\t\t\t\t\t\tconst char * value = lua.getString(-2);\r\n\t\t\t\t\t\t\tlua.pop(2);\r\n\r\n\t\t\t\t\t\t\tif (key && value) {\r\n\t\t\t\t\t\t\t\tint length = strlen(key) + strlen(value) + 4;\r\n\t\t\t\t\t\t\t\tchar* string = KLBNEWA(char, length);\r\n\t\t\t\t\t\t\t\t// Combine string\r\n\t\t\t\t\t\t\t\tsprintf(string, \"%s: %s\", key, value);\r\n\r\n\t\t\t\t\t\t\t\tm_http_header_array[idx++] = string;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tm_http_header_length = idx;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// POST JSon payload\r\n\t\t\t\tconst char* send_json = NULL;\r\n\t\t\t\tif(!lua.isNil(5)) {\r\n\t\t\t\t\t// POST method\r\n\t\t\t\t\tsend_json = lua.getString(5);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// GET method if null json.\r\n\t\t\t\t}\r\n\r\n\t\t\t\tm_http = NetworkManager::createConnection();\r\n\r\n\t\t\t\tif (m_http) {\r\n\t\t\t\t\tif (m_http_header_array) {\r\n\t\t\t\t\t\tm_http->setHeader(m_http_header_array);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (send_json) {\r\n\t\t\t\t\t\tchar* json;\r\n\t\t\t\t\t\tconst char * items[2];\r\n\t\t\t\t\t\tconst char* req = \"request_data=\";\r\n\t\t\t\t\t\tint send_json_length = strlen( send_json );\r\n\t\t\t\t\t\tint req_length = strlen( req );\r\n\r\n\t\t\t\t\t\tjson = KLBNEWA( char , send_json_length+req_length+1 );\r\n\t\t\t\t\t\tstrcpy( json , req );\r\n\t\t\t\t\t\tstrcat( json , send_json );\r\n\t\t\t\t\t\titems[0] = json;\r\n\t\t\t\t\t\titems[1] = NULL;\r\n\r\n\t\t\t\t\t\tm_http->setForm(items);\r\n\t\t\t\t\t\tm_http->httpPOST(api, false);\r\n\r\n\t\t\t\t\t\tKLBDELETEA(json);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tm_http->httpGET(api, false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tm_timeout\t= lua.getInt(6);\r\n\t\t\t\t\tm_timestart = 0;\r\n\r\n\t\t\t\t\tlua.retBoolean(true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Connection creation failed.\r\n\t\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nbool\r\nCKLBNetAPI::lua_callback(int msg, int status, CKLBJsonItem * pRoot)\r\n{\r\n\treturn CKLBScriptEnv::getInstance().call_netAPI_callback(m_callback, this, 0, msg, status, pRoot);\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBNetAPI.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBNetAPI_h\r\n#define CKLBNetAPI_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBHTTPInterface.h\"\r\n#include \"CKLBJsonItem.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"MultithreadedNetwork.h\"\r\n\r\n// regionを指定しなかった場合のデフォルトregion値(ISO 3166-1)\r\n#define DEFAULT_REGION \"840\"    // 北米アメリカ合衆国\r\n\r\n//// 指定しそうなデフォルト値をコメントアウトして書いておく。\r\n// #define DEFAULT_REGION \"392\"    // 日本\r\n\r\n\r\nenum {\r\n\t// メッセージ値定義\r\n\tNETAPIMSG_CONNECTION_CANCELED\t= -999,\t// セッションはキャンセルされた\r\n\tNETAPIMSG_CONNECTION_FAILED\t\t= -500,\t// 接続に失敗した\r\n\tRESERVED\t\t\t\t\t\t= -1,\t// サーバにアクセスできない/サーバからのパケットを解釈できない\r\n\tNETAPIMSG_SERVER_TIMEOUT\t\t= -2,\t// サーバとの通信がタイムアウトした\r\n\tNETAPIMSG_SERVER_ERROR\t\t\t= 0,\r\n\tNETAPIMSG_REQUEST_SUCCESS\t\t= 1,\t// リクエスト成功ステータス\r\n};\r\n\r\n// Native側からAPIタスクにコマンドを発行するためのsingleton.\r\n// \r\nclass CKLBNetAPI;\r\n\r\n/*!\r\n* \\class CKLBNetAPI\r\n* \\brief Net API class.\r\n* \r\n* CKLBNetAPI is responsible Network communications.\r\n*/\r\nclass CKLBNetAPI : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBNetAPI>;\r\nprivate:\r\n\tCKLBNetAPI();\r\n\tvirtual ~CKLBNetAPI();\r\n\r\n\tbool init(\tCKLBTask* pTask, \r\n\t\t\t\tconst char * callback);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBNetAPI* create(\tCKLBTask* pParentTask, \r\n\t\t\t\t\t\t\t\tconst char * callback);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\n\tbool initScript(CLuaState& lua);\r\n\tint commandScript(CLuaState& lua);\r\nprivate:\r\n\tCKLBHTTPInterface*\t\tm_http;\t\t// そのセッションで使用されている接続\r\n\tu32\t\t\t\t\t\tm_timeout;\t// タイムアウト時間\r\n\tu32\t\t\t\t\t\tm_timestart;\r\n\tu32\t\t\t\t\t\tm_http_header_length;\r\n\tbool\t\t\t\t\tm_canceled;\t// セッションがキャンセルされると true になる\r\n\tCKLBJsonItem*\t\t\tm_pRoot;\r\n\r\n\t// スクリプトコールバック用\r\n\tconst char\t\t\t*\tm_callback;\t// Lua callback function\r\n\r\n\t// HTTP通信で追加するヘッダの配列\r\n\tconst char\t\t\t**\tm_http_header_array;\r\n\r\nprivate:\r\n\tvoid freeHeader();\r\n\tvoid freeJSonResult();\r\n\r\n\tbool lua_callback(int msg, int status, CKLBJsonItem * pRoot);\r\n\r\n\tCKLBJsonItem * getJsonTree(const char * json_string, u32 dataLen);\r\n\tbool get_token(CKLBJsonItem * pRoot);\r\n\r\npublic:\r\n\tbool cancel\t\t();\r\n};\r\n\r\n#endif // CKLBNetAPI_h\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBNetAPIKeyChain.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBNetAPIKeyChain.cpp\r\n//  GameEngine\r\n//\r\n\r\n#include \"CKLBNetAPIKeyChain.h\"\r\n\r\n\r\nCKLBNetAPIKeyChain::CKLBNetAPIKeyChain()\r\n: m_token   (NULL)\r\n, m_region  (NULL)\r\n, m_client  (NULL)\r\n, m_cKey    (NULL)\r\n, m_appID   (NULL)\r\n, m_userID  (NULL) \r\n{\r\n}\r\n\r\nCKLBNetAPIKeyChain::~CKLBNetAPIKeyChain()\r\n{\r\n\trelease();\r\n}\r\n\r\nCKLBNetAPIKeyChain&\r\nCKLBNetAPIKeyChain::getInstance()\r\n{\r\n    static CKLBNetAPIKeyChain instance;\r\n    return instance;\r\n}\r\n\r\nvoid \r\nCKLBNetAPIKeyChain::release() {\r\n    KLBDELETEA(m_token);\r\n\tm_token\t\t= NULL;\r\n    KLBDELETEA(m_region);\r\n\tm_region\t= NULL;\r\n    KLBDELETEA(m_client);\r\n\tm_client\t= NULL;\r\n    KLBDELETEA(m_cKey);\r\n\tm_cKey\t\t= NULL;\r\n    KLBDELETEA(m_appID);\r\n\tm_appID\t\t= NULL;\r\n\tKLBDELETEA(m_userID);\r\n\tm_userID\t= NULL; // 2012.11.27  解放漏れがあったので修正\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBNetAPIKeyChain.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBNetAPIKeyChain.h\r\n//  GameEngine\r\n//\r\n\r\n#ifndef CKLBNetAPIKeyChain_h\r\n#define CKLBNetAPIKeyChain_h\r\n\r\n#include \"CKLBUtility.h\"\r\n\r\n/*!\r\n* \\class CKLBNetAPIKeyChain\r\n* \\brief Net API Key Chain Class\r\n* \r\n* \r\n*/\r\nclass CKLBNetAPIKeyChain\r\n{\r\nprivate:\r\n    CKLBNetAPIKeyChain();\r\n    virtual ~CKLBNetAPIKeyChain();\r\npublic:\r\n    static CKLBNetAPIKeyChain& getInstance();\r\n\tvoid release();\r\n\r\n    inline const char * setToken(const char * token) {\r\n        KLBDELETEA(m_token);\r\n\t\tif (token) {\r\n\t        m_token = CKLBUtility::copyString(token);\r\n\t\t} else {\r\n\t\t\tm_token = NULL;\r\n\t\t}\r\n        return m_token;\r\n    }\r\n    \r\n    inline const char * setRegion(const char * region) {\r\n        KLBDELETEA(m_region);\r\n\t\tif (region) {\r\n\t        m_region = CKLBUtility::copyString(region);\r\n\t\t} else {\r\n\t\t\tm_region = NULL;\r\n\t\t}\r\n        return m_region;\r\n    }\r\n    \r\n    inline const char * setClient(const char * client) {\r\n        KLBDELETEA(m_client);\r\n\t\tif (client) {\r\n\t        m_client = CKLBUtility::copyString(client);\r\n\t\t} else {\r\n\t\t\tm_client = NULL;\r\n\t\t}\r\n        return m_client;\r\n    }\r\n    \r\n    inline const char * setConsumernKey(const char * cKey) {\r\n        KLBDELETEA(m_cKey);\r\n\t\tif (cKey) {\r\n\t        m_cKey = CKLBUtility::copyString(cKey);\r\n\t\t} else {\r\n\t\t\tm_cKey = NULL;\r\n\t\t}\r\n        return m_cKey;\r\n    }\r\n\r\n    inline const char * setAppID(const char * appID) {\r\n        KLBDELETEA(m_appID);\r\n\t\tif (appID) {\r\n\t        m_appID = CKLBUtility::copyString(appID);\r\n\t\t} else {\r\n\t\t\tm_appID = NULL;\r\n\t\t}\r\n        return m_appID;\r\n    }\r\n\r\n\tinline const char * setUserID(const char * userID) {\r\n\t\tKLBDELETEA(m_userID);\r\n\t\tif (userID) {\r\n\t\t\tm_userID = CKLBUtility::copyString(userID);\r\n\t\t} else {\r\n\t\t\tm_userID = NULL;\r\n\t\t}\r\n\t\treturn m_userID;\r\n\t}\r\n    \r\n    inline const char * getToken\t\t() const { return m_token;\t}\r\n    inline const char * getRegion\t\t() const { return m_region; }\r\n    inline const char * getClient\t\t() const { return m_client; }\r\n    inline const char * getConsumerKey\t() const { return m_cKey;\t}\r\n    inline const char * getAppID\t\t() const { return m_appID;\t}\r\n\tinline const char * getUserID\t\t() const { return m_userID; }\r\n\r\n\tinline int genCmdNumID(char * retBuf, const char * body, time_t timeStamp, int serial) {\r\n\t\tsprintf(retBuf, \"%s-%s.%d.%d\",\r\n\t\t\t\tbody, m_token,\r\n\t\t\t\t(int)timeStamp, serial);\r\n\t\tint len = strlen(retBuf);\r\n\t\treturn len;\r\n\t}\r\n\r\nprivate:\r\n    const char      *   m_token;    // Authorized Token\r\n    const char      *   m_region;   // region\r\n    const char      *   m_client;   // client version\r\n    const char      *   m_cKey;     // consumerKey\r\n    const char      *   m_appID;    // Application ID\r\n\tconst char\t\t*\tm_userID;\t// User-ID\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBStoreService.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBStoreService.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n\r\n#include \"CKLBStoreService.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CPFInterface.h\"\r\nenum {\r\n\t// Command Values定義\r\n  STORESERVICE_BUY_ITEMS,\r\n  STORESERVICE_GET_PRODUCTS,\r\n  STORESERVICE_FINISH_TRANSACTION\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n    { \"STORESERVICE_BUY_ITEMS\",\t\tSTORESERVICE_BUY_ITEMS \t},\r\n    { \"STORESERVICE_FINISH_TRANSACTION\", STORESERVICE_FINISH_TRANSACTION },\r\n    { \"STORESERVICE_GET_PRODUCTS\",\tSTORESERVICE_GET_PRODUCTS \t},\r\n    \r\n    { \"STORE_FAILED\",               IClientRequest::E_STORE_FAILED },\r\n    { \"STORE_PURCHASHING\",          IClientRequest::E_STORE_PURCHASHING },\r\n    { \"STORE_PURCHACHED\",           IClientRequest::E_STORE_PURCHASHED },\r\n    { \"STORE_RESTORE\",              IClientRequest::E_STORE_RESTORE },\r\n    { \"STORE_RESTORE_COMPLETED\",    IClientRequest::E_STORE_RESTORE_COMPLETED },\r\n    { \"STORE_RESTORE_FAILED\",       IClientRequest::E_STORE_RESTORE_FAILED },\r\n    { \"STORE_GET_PRODUCTS\" ,        IClientRequest::E_STORE_GET_PRODUCTS },\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBStoreService> factory(\"STORE_Service\", CLS_KLBSTORESERVICE, cmd);\r\n\r\nenum {\r\n\tARG_CALLBACK = 1,\r\n\tARG_REQUIRE = ARG_CALLBACK,\r\n\tARG_STORE_MAX = ARG_CALLBACK\r\n};\r\n\r\n\r\nCKLBStoreService::CKLBStoreService()\r\n: CKLBLuaTask\t()\r\n, m_callback\t(NULL)\r\n{\r\n}\r\n\r\nCKLBStoreService::~CKLBStoreService() \r\n{\r\n\tKLBDELETEA(m_callback);\r\n}\r\n\r\nu32 \r\nCKLBStoreService::getClassID() \r\n{\r\n\treturn CLS_KLBSTORESERVICE;\r\n}\r\n\r\n/*static*/\r\nCKLBStoreService* \r\nCKLBStoreService::create(const char* callback) \r\n{\r\n\tCKLBStoreService* pTask = KLBNEW(CKLBStoreService);\r\n    if (!pTask) { return NULL; }\r\n\tif (!pTask->init(callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool \r\nCKLBStoreService::init(const char* callback) \r\n{\r\n\tif(callback) { setStrC(m_callback, callback); }\r\n\r\n    // OsCtrlEventのキューを使用するため、ポーズ中にもイベント回収可能なレベルを使用する。\r\n\treturn regist(NULL, P_IMPORTANT);\r\n}\r\n\r\nbool\r\nCKLBStoreService::initScript(CLuaState& lua)\r\n{\r\n    int argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_STORE_MAX) { return false; }\r\n\r\n    const char * callback = lua.getString(ARG_CALLBACK);\r\n    if(!init(callback)) {\r\n\t\treturn false;\r\n\t}\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    pForm.initStoreTransactionObserver();\r\n\treturn true;\r\n}\r\n\r\nint\r\nCKLBStoreService::commandScript(CLuaState& lua)\r\n{\r\n  int ret = 0;\r\n  int argc = lua.numArgs();\r\n  if(argc < 2) {\r\n    lua.retBool(false);\r\n    return 1;\r\n  }\r\n  int cmd = lua.getInt(2);\r\n  IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n  switch(cmd)\r\n    {\r\n    case STORESERVICE_BUY_ITEMS:\r\n      {\r\n    \t  klb_assert(argc == 3, \"Must specify 1 item for STORESERVICE_BUY_ITEMS\");\r\n          pForm.buyStoreItems(lua.getString(3));\r\n      }\r\n      break;\r\n    case STORESERVICE_GET_PRODUCTS:\r\n      {\r\n        if(argc == 4) {\r\n          /*\r\n            1: task\r\n            2: command\r\n            3: products\r\n            4: currency文字列で取得するか否か\r\n          */\r\n          const char* json      = lua.getString(3);\r\n          bool        currency  = lua.getBoolean(4);\r\n          pForm.getStoreProducts(json, currency);\r\n        }\r\n      }\r\n      break;\r\n    case STORESERVICE_FINISH_TRANSACTION:\r\n    {\r\n        if(argc == 3) {\r\n            /*\r\n             1: task\r\n             2: command\r\n             3: receipt\r\n             */\r\n            const char* receipt = lua.getString(3);\r\n            pForm.finishStoreTransaction(receipt);\r\n        }\r\n        \r\n    \r\n      break;\r\n    }\r\n    default:\r\n      {\r\n        lua.retBool(false);\r\n        ret = 1;\r\n      }\r\n      break;\r\n    }\r\n\r\n  return ret;\r\n}\r\n\r\nvoid\r\nCKLBStoreService::execute(u32 /*deltaT*/)\r\n{\r\n    CKLBOSCtrlQueue& osq  = CKLBOSCtrlQueue::getInstance();\r\n    const OSCTRL *   item = NULL;\r\n    osq.startItem();\r\n    // Widgetポインタが当てられてないがメッセージキューの割当は区別する必要が有るので疑似値を使用する\r\n    while(0 != (item = osq.getItem(0))) {\r\n        switch(item->type)\r\n        {\r\n        case IClientRequest::E_STORE_FAILED:            cbStoreFailed(item);           \tbreak;\r\n        case IClientRequest::E_STORE_PURCHASHED:        cbStorePurchashed(item);       \tbreak;\r\n        case IClientRequest::E_STORE_PURCHASHING:       cbStorePurchashing(item);      \tbreak;\r\n        case IClientRequest::E_STORE_RESTORE:           cbStoreRestore(item);          \tbreak;\r\n        case IClientRequest::E_STORE_RESTORE_COMPLETED: cbStoreRestoreCompleted(item); \tbreak;\r\n        case IClientRequest::E_STORE_RESTORE_FAILED:    cbStoreRestoreFailed(item);    \tbreak;\r\n        case IClientRequest::E_STORE_GET_PRODUCTS: \t\tcbStoreGetProducts(item); \t\tbreak;\r\n        case IClientRequest::E_STORE_BAD_ITEMID: \t\tcbStoreFailed(item); \t\t\tbreak;\r\n        default:\r\n            break;\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCKLBStoreService::die()\r\n{\r\n\t// 2012.11.27  解放漏れがあったので修正\r\n\tif( m_callback ) {\r\n\t\tKLBDELETEA( m_callback );\r\n\t\tm_callback = NULL;\r\n\t}\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    pForm.releaseStoreTransactionObserver();\r\n}\r\n\r\nint\r\nCKLBStoreService::cbStoreFailed(const OSCTRL * item)\r\n{\r\n    const char * itemId = (const char *)item->data1;\r\n\texecCallback(IClientRequest::E_STORE_FAILED, itemId);\r\n    \r\n    return 0;\r\n}\r\n\r\nint\r\nCKLBStoreService::cbStorePurchashed(const OSCTRL * item)\r\n{\r\n    const char * itemId  = (const char *)item->data1;\r\n\tconst char * receipt = (const char *)item->data2;\r\n\texecCallback(IClientRequest::E_STORE_PURCHASHED, itemId, receipt);\r\n\r\n    return 0;\r\n}\r\n\r\nint\r\nCKLBStoreService::cbStorePurchashing(const OSCTRL * item)\r\n{\r\n    const char * itemId = (const char *)item->data1;\r\n\texecCallback(IClientRequest::E_STORE_PURCHASHING, itemId);\r\n    \r\n    return 0;\r\n}\r\nint\r\nCKLBStoreService::cbStoreRestore(const OSCTRL * item)\r\n{\r\n    const char * itemId = (const char *)item->data1;\r\n\texecCallback(IClientRequest::E_STORE_RESTORE, itemId);\r\n    \r\n    return 0;\r\n}\r\n\r\nint\r\nCKLBStoreService::cbStoreRestoreCompleted(const OSCTRL * /*item*/)\r\n{\r\n\texecCallback(IClientRequest::E_STORE_RESTORE_COMPLETED, \"\");\r\n    \r\n    return 0;\r\n}\r\n\r\nint\r\nCKLBStoreService::cbStoreRestoreFailed(const OSCTRL * /*item*/)\r\n{\r\n    execCallback(IClientRequest::E_STORE_RESTORE_FAILED, \"\");\r\n    return 0;\r\n}\r\n\r\nint\r\nCKLBStoreService::cbStoreGetProducts(const OSCTRL * item)\r\n{\r\n    if (item) {\r\n        const char* products = static_cast<const char*>(item->data1);\r\n        execCallback(IClientRequest::E_STORE_GET_PRODUCTS, \"\", products);\r\n    }\r\n    \r\n    return 0;\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBStoreService.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBStoreService.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CKLBStoreService_h\r\n#define CKLBStoreService_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n/*!\r\n* \\class CKLBStoreService\r\n* \\brief Store Service Task class.\r\n* \r\n* CKLBStoreService is responsible for the different interactions with the Application Store,\r\n* as getting the products list or buying items.\r\n* This task is platform independant as it uses IPlatformRequest to process its requests.\r\n*/\r\nclass CKLBStoreService : public CKLBLuaTask\r\n{\r\n    friend class CKLBTaskFactory<CKLBStoreService>;\r\nprivate:\r\n    CKLBStoreService();\r\n    virtual ~CKLBStoreService();\r\n\tbool init(const char* callback);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBStoreService* create(const char* callback);\r\n\r\n    bool\tinitScript\t\t(CLuaState& lua);\r\n    int\t\tcommandScript\t(CLuaState& lua);\r\n    \r\n    void\texecute\t\t\t(u32 deltaT);\r\n    void\tdie\t\t\t\t();\r\n    \r\n\tvoid\tbuyItems\t\t(const char* item) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.buyStoreItems(item);\r\n\t}\r\n\r\n\tinline void getProducts(const char* json, bool currency) { CPFInterface::getInstance().platform().getStoreProducts(json, currency); }\r\n\r\nprivate:\r\n    int cbStoreFailed\t\t\t(const OSCTRL * item);\r\n    int cbStorePurchashed\t\t(const OSCTRL * item);\r\n    int cbStorePurchashing\t\t(const OSCTRL * item);\r\n    int cbStoreRestore\t\t\t(const OSCTRL * item);\r\n    int cbStoreRestoreCompleted\t(const OSCTRL * item);\r\n    int cbStoreRestoreFailed\t(const OSCTRL * item);\r\n    int cbStoreGetProducts\t\t(const OSCTRL * item);\r\n    \r\n\tinline void execCallback(IClientRequest::EVENT_TYPE status, const char * itemId = \"\", const char * data = \"\") {\r\n\t\tif(m_callback) CKLBScriptEnv::getInstance().call_storeEvent(m_callback, this, status, itemId, data);\r\n\t}\r\n \r\nprivate:\r\n    const char          *   m_callback;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBUpdate.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUpdate.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n/**\r\n\t.lock file structure :\r\n\tByte 0000..0999 : Tmp Zip file full path\r\n\tByte 1000..2503 : Zip URL\r\n\tByte 2504..2512 : Size.\r\n\tByte 2513..2999 : UNUSED.\r\n */\r\nstatic const char*\tgUpdateFile = \"file://external/_Upload_Task_Marker_.lock\";\r\n\r\nstatic ILuaFuncLib::DEFCONST defcmd[] = {\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibUPDATE libdef(defcmd);\r\n\r\nCKLBLuaLibUPDATE::CKLBLuaLibUPDATE(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibUPDATE::~CKLBLuaLibUPDATE() {}\r\n\r\nvoid \r\nCKLBLuaLibUPDATE::addLibrary()\r\n{\r\n\taddFunction(\"ONLINE_hasLock\",\t\tCKLBLuaLibUPDATE::luaUpdateHasLock);\r\n\taddFunction(\"ONLINE_killLock\",\t\tCKLBLuaLibUPDATE::luaUpdateKillLock);\r\n}\r\n\r\nint\r\nCKLBLuaLibUPDATE::luaUpdateHasLock(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tbool res = CKLBUpdate::lockExist();\r\n\tlua.retBool(res);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibUPDATE::luaUpdateKillLock(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tCPFInterface::getInstance().platform().removeTmpFile(gUpdateFile);\r\n\treturn 0;\r\n}\r\n\r\nenum {\r\n\tUPDATE_HASLOCK\t\t\t= 0,\r\n\tUPDATE_KILL_LOCK\t\t= 1,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUpdate>\t\tfactoryA(\"ONLINE_Update\",\t\t\tCLS_KLBAPPUPDATE,\t\tcmd);\r\nstatic CKLBTaskFactory<CKLBUpdateZip>\tfactoryB(\"ONLINE_CompleteZip\",\t\tCLS_KLBAPPUPDATEZIP,\tcmd);\r\n\r\nenum {\r\n\tARG_ZIPURL = 1,\r\n\tARG_ZIPSIZE,\r\n\r\n\tARG_TMPNAME,\r\n\r\n\tARG_DOWNLOAD_CALLBACK,\r\n\tARG_UNZIP_CALLBACK,\r\n\tARG_FINISH_CALLBACK,\r\n\tARG_ERROR_CALLBACK,\r\n\r\n\tARG_REQUIRE = ARG_TMPNAME,\r\n\tARG_NUM = ARG_ERROR_CALLBACK\r\n};\r\n\r\nenum {\r\n\tARG_ZIPTMPNAME = 1,\r\n\r\n\tARG_ZIPUNZIP_CALLBACK,\r\n\tARG_ZIPFINISH_CALLBACK,\r\n\tARG_ZIPERROR_CALLBACK,\r\n\r\n\tARG_ZIPREQUIRE\t= ARG_ZIPTMPNAME,\r\n\tARG_ZIPNUM\t\t= ARG_ZIPERROR_CALLBACK\r\n};\r\n\r\n\r\nCUpdateUnZip::CUpdateUnZip(const char * zipPath) : CUnZip(zipPath) {}\r\nCUpdateUnZip::~CUpdateUnZip() {}\r\n\r\nbool\r\nCUpdateUnZip::afterExtract(const char * extract_path, bool isDirectory, size_t size)\r\n{\r\n    if(isDirectory || (size > 0) || (extract_path == 0)) { return true; }\r\n\r\n\t// ディレクトリではないファイルがサイズ0の場合、そのファイルは削除対象となる。\r\n\tCPFInterface::getInstance().platform().removeTmpFile(extract_path);\r\n\treturn true;\r\n}\r\n\r\nCKLBUpdateZip::CKLBUpdateZip()\r\n:CKLBUpdate()\r\n{\r\n}\r\n\r\nCKLBUpdateZip::~CKLBUpdateZip()\r\n{\r\n}\r\n\r\nbool\r\nCKLBUpdateZip::initScript(CLuaState& lua)\r\n{\r\n\t// bool res = true;\r\n\r\n\tint argc = lua.numArgs();\r\n\r\n\t// 引数チェック\r\n\tif(argc < ARG_ZIPREQUIRE || argc > ARG_ZIPNUM) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tconst char * callbackUnzip\t\t= (argc >= ARG_ZIPUNZIP_CALLBACK)   ? lua.getString(ARG_ZIPUNZIP_CALLBACK)  : NULL;\r\n\tconst char * callbackFinish\t\t= (argc >= ARG_ZIPFINISH_CALLBACK)  ? lua.getString(ARG_ZIPFINISH_CALLBACK) : NULL;\r\n\tconst char * callbackError\t\t= (argc >= ARG_ZIPERROR_CALLBACK)   ? lua.getString(ARG_ZIPERROR_CALLBACK)  : NULL;\r\n\t\r\n\tconst char * tmp_name\t\t\t= lua.getString(ARG_ZIPTMPNAME);\r\n\tm_tmpPath\t\t\t\t\t\t= CKLBUtility::copyString(tmp_name);\r\n\r\n\t// Load \"Update\" info if any\r\n\tif (lockExist()) {\r\n\t\tm_eStep = S_INIT_UNZIP;\r\n\r\n\t\tm_zipEntry\t\t\t= 0;\r\n\t\tm_callbackZIP\t\t= CKLBUtility::copyString(callbackUnzip);\r\n\t\tm_callbackFinish\t= CKLBUtility::copyString(callbackFinish);\r\n\t\tm_callbackError\t\t= callbackError ? CKLBUtility::copyString(callbackError) : NULL;\r\n\r\n\t\treturn regist(NULL, P_NORMAL);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nu32 \r\nCKLBUpdateZip::getClassID() \r\n{\r\n\treturn CLS_KLBAPPUPDATEZIP;\r\n}\r\n\r\nCKLBUpdate::CKLBUpdate()\r\n: CKLBLuaTask   ()\r\n, m_unzip       (NULL)\r\n, m_callbackDL  (NULL)\r\n, m_callbackZIP (NULL)\r\n, m_callbackFinish  (NULL)\r\n, m_callbackError   (NULL)\r\n, m_tmpPath     (NULL)\r\n, m_zipURL      (NULL)\r\n, m_zipSize     (0)\r\n, m_dlSize      (0)\r\n, m_zipEntry    (0)\r\n, m_eStep       (S_INIT_DL)\r\n, m_httpIF      (NULL)\r\n{\r\n\tm_httpIF = NetworkManager::createConnection();\r\n}\r\n\r\nCKLBUpdate::~CKLBUpdate() {\r\n\tNetworkManager::releaseConnection(m_httpIF);\r\n\tm_httpIF = NULL;\r\n}\r\n\r\nu32 \r\nCKLBUpdate::getClassID() \r\n{\r\n\treturn CLS_KLBAPPUPDATE;\r\n}\r\n\r\n/*static*/\r\nbool \r\nCKLBUpdate::lockExist() \r\n{\r\n\tIPlatformRequest& ptf = CPFInterface::getInstance().platform();\r\n\tIReadStream* pStream = ptf.openReadStream(gUpdateFile,ptf.useEncryption());\r\n\t// Does the file exist ?\r\n\tif (pStream->getStatus() == IReadStream::NORMAL) {\r\n\t\tdelete pStream; // Do not use KLBDELETE : object created by porting layer.\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUpdate::cleanUpdate(const char* tmpFile) \r\n{\r\n\t// - DELETE Tmp Zip file if exist\r\n\tCPFInterface::getInstance().platform().removeTmpFile(tmpFile);\r\n}\r\n\r\nbool \r\nCKLBUpdate::saveUpdate() \r\n{\r\n\t// - Create Tmp Operation file with all data inside\r\n\tITmpFile* file\t= CPFInterface::getInstance().platform().openTmpFile(gUpdateFile);\r\n\tif (file) {\r\n\t\t// Close file\r\n\t\tdelete file;\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\n/* No Command for now.\r\nint\r\nCKLBUpdate::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tint cmd = lua.getInt(2);\r\n\tswitch(cmd)\r\n\t{\r\n\t}\r\n}*/\r\n\r\nbool\r\nCKLBUpdate::initScript(CLuaState& lua)\r\n{\r\n\t// bool res = true;\r\n\r\n\tint argc = lua.numArgs();\r\n\r\n\t// 引数チェック\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUM) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tconst char * callbackDownload\t= (argc >= ARG_DOWNLOAD_CALLBACK)\t? lua.getString(ARG_DOWNLOAD_CALLBACK)\t: NULL;\r\n\tconst char * callbackUnzip\t\t= (argc >= ARG_UNZIP_CALLBACK)\t\t? lua.getString(ARG_UNZIP_CALLBACK)\t\t: NULL;\r\n\tconst char * callbackFinish\t\t= (argc >= ARG_FINISH_CALLBACK)\t\t? lua.getString(ARG_FINISH_CALLBACK)\t: NULL;\r\n\tconst char * callbackError\t\t= (argc >= ARG_ERROR_CALLBACK)\t\t? lua.getString(ARG_ERROR_CALLBACK)\t\t: NULL;\r\n\t\r\n\tconst char * zip_url;\r\n\tconst char * zip_size;\r\n\tconst char * tmp_name;\r\n\tzip_url\t\t\t\t= lua.getString(ARG_ZIPURL);\r\n\tzip_size\t\t\t= lua.getString(ARG_ZIPSIZE);\t// サイズは狂いがあると困るのでstringで受ける\r\n\ttmp_name\t\t\t= lua.getString(ARG_TMPNAME);\r\n\r\n\tm_tmpPath\t\t\t= CKLBUtility::copyString(tmp_name);\r\n\tm_zipURL\t\t\t= CKLBUtility::copyString(zip_url);\r\n\tm_zipSize\t\t\t= CKLBUtility::stringNum64(zip_size);\r\n\r\n\tm_eStep\t= S_INIT_DL;\r\n\t// Start from scratch and download\r\n\tm_dlSize\t\t\t= -1;\r\n\tm_zipEntry\t\t\t= 0;\r\n\tm_callbackDL\t\t= CKLBUtility::copyString(callbackDownload);\r\n\tm_callbackZIP\t\t= CKLBUtility::copyString(callbackUnzip);\r\n\tm_callbackFinish\t= CKLBUtility::copyString(callbackFinish);\r\n\tm_callbackError\t\t= callbackError ? CKLBUtility::copyString(callbackError) : NULL;\r\n\r\n\treturn regist(NULL, P_NORMAL);\r\n}\r\n\r\nvoid\r\nCKLBUpdate::execute(u32 deltaT)\r\n{\r\n\tswitch(m_eStep)\r\n\t{\r\n\tcase S_INIT_DL:\t\texec_init_download(deltaT); break;\r\n\tcase S_DOWNLOAD:\texec_download(deltaT);\t\tbreak;\r\n\tcase S_INIT_UNZIP:\texec_init_unzip(deltaT);\tbreak;\r\n\tcase S_UNZIP:\t\t/* Now multithreaded */\t\tbreak;\r\n\tcase S_COMPLETE:\texec_complete(deltaT);\t\tbreak;\r\n\tcase S_FINISHED:\texec_finish(deltaT);\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*static*/ \r\ns32 \r\nCKLBUpdate::threadFunc(void* /*pThread*/, void* data) \r\n{\r\n\treturn ((CKLBUpdate*)data)->workThread();\r\n}\r\n\r\ns32 \r\nCKLBUpdate::workThread() \r\n{\r\n\twhile (m_eStep != S_COMPLETE) {\r\n\t\texec_unzip(0);\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nvoid\r\nCKLBUpdate::die()\r\n{\r\n\tif (m_thread) {\r\n\t\tCPFInterface::getInstance().platform().deleteThread(m_thread);\r\n\t\tm_thread = NULL;\r\n\t}\r\n\r\n\tKLBDELETEA(m_zipURL);\r\n\tKLBDELETEA(m_tmpPath);\r\n\tKLBDELETEA(m_callbackZIP);\r\n\tKLBDELETEA(m_callbackDL);\r\n\tKLBDELETEA(m_callbackFinish);\r\n\tKLBDELETEA(m_callbackError);\r\n\r\n\tKLBDELETE(m_unzip);\r\n}\r\n\r\nvoid\r\nCKLBUpdate::exec_init_download(u32 /*deltaT*/)\r\n{\r\n\tm_httpIF->reuse();\r\n\tm_httpIF->setDownload(m_tmpPath);\t// ダウンロードモードで使用する\r\n\tm_httpIF->httpGET(m_zipURL, false);\t// zip取得のrequestを投げる\r\n\tm_eStep = S_DOWNLOAD;\r\n\tm_maxProgress = -1.0f; // Force first callback when set to 0.0f\r\n}\r\n\r\nvoid\r\nCKLBUpdate::exec_download(u32 /*deltaT*/)\r\n{\r\n\tbool bResult = m_httpIF->httpRECV();\r\n\t// Current downloaded size (may be inacurate)\r\n\ts64 size\t\t\t= m_httpIF->getDwnldSize();\r\n\t// Completly download size (accurate but updated at the end)\r\n\ts64 completeOnSize\t= m_httpIF->getSize();\r\n\r\n\tif(size != m_dlSize) {\r\n\t\tm_dlSize = size;\t// 読み込み済サイズを更新\r\n\t\tif(m_callbackDL) {\r\n\t\t\tfloat progress = (m_dlSize * 1000 / m_zipSize) / 1000.0f;\r\n\t\t\tif (progress < 0.0f) {\r\n\t\t\t\tprogress = 0.0f;\r\n\r\n\t\t\t// Trick :\r\n\t\t\t// - avoid callback at 100% because 100% is better to be done when we are sure\r\n\t\t\t//   that download is complete.\r\n\t\t\t// - because of inacurracy, we may also go over 100%\r\n\t\t\t} else if (progress >= 0.999f) {\t\r\n\t\t\t\tprogress = 0.999f;\r\n\t\t\t}\r\n\r\n\t\t\tchar buf[64];\r\n\t\t\tCKLBUtility::numString64(buf, (u64)(m_zipSize * progress));\r\n\r\n\t\t\t// Ensure that we get only higher values, no backward.\r\n\t\t\tif (progress > m_maxProgress) {\r\n\t\t\t\tm_maxProgress = progress;\r\n\t\t\t\t// Only perform callback here when progress is NOT complete.\r\n\t\t\t\tif (!bResult) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUpdateDownload(m_callbackDL, this, (double)progress, buf);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// 平成24年12月17日(月)\r\n\t// RECVの結果がtrueの時、\r\n\t// もしdownload sizeとそもそものzip sizeとの値が異なっている場合は正常に受信できていないので、\r\n\t// ひとまずリトライするようにしてみる.\r\n\tif(bResult) {\r\n\t\tif (completeOnSize == m_zipSize) {\r\n\t\t\tchar buf[64];\r\n\t\t\tCKLBUtility::numString64(buf, completeOnSize);\r\n\t\t\t// Perform a 100% callback here because we know download IS complete.\r\n\t\t\tCKLBScriptEnv::getInstance().call_eventUpdateDownload(m_callbackDL, this, (double)1.0, buf);\r\n\t\t\tsaveUpdate();\r\n\t\t\tm_eStep = S_INIT_UNZIP;\r\n\t\t} else {\r\n\t\t\tCKLBScriptEnv::getInstance().call_eventUpdateError(m_callbackError, this);\r\n\t\t\tDEBUG_PRINT(\"[update] download success but with invalid size. retry.\");\r\n\t\t\tm_eStep = S_INIT_DL;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUpdate::exec_init_unzip(u32 /*deltaT*/)\r\n{\r\n\tconst char * fullpath = CPFInterface::getInstance().platform().getFullPath(m_tmpPath);\r\n\tm_unzip = KLBNEWC(CUpdateUnZip, (fullpath));\r\n\r\n\tif (!m_unzip->getStatus()) {\t// invalid zip file\r\n\t\tCKLBScriptEnv::getInstance().call_eventUpdateError(m_callbackError, this);\r\n\t\tDEBUG_PRINT(\"[update] invalid zip file\");\r\n\t\t// do not change m_eStep, thus it will retry again as the download step do\r\n\t\treturn;\r\n\t}\r\n\r\n\tm_zipEntry   = m_unzip->numEntry();\t// あらかじめエントリ数を取得しておく\r\n\tm_extracting = false;\r\n\tm_eStep      = S_UNZIP;\r\n\r\n\tm_thread = CPFInterface::getInstance().platform().createThread(threadFunc,this);\r\n}\r\n\r\nvoid\r\nCKLBUpdate::exec_unzip(u32 /*deltaT*/)\r\n{\r\n\tbool bResult = true;\r\n\tif(m_extracting) {\r\n\t\tif(m_unzip->isFinishExtract()) {\r\n\t\t\t// 戻り値が true であれば読み込みが終わっている\r\n\t\t\tm_extracting = false;\r\n\t\t\tbResult = m_unzip->gotoNextFile();\t// 次のファイルへ\r\n\r\n\t\t\t// 現在展開済みのファイル数を得る\r\n\t\t\tint finished = m_unzip->getFinishedEntry();\r\n\t\t\tCKLBScriptEnv::getInstance().call_eventUpdateZIP(m_callbackZIP, this, finished, m_zipEntry);\r\n\r\n\t\t\tif(!bResult) {\r\n\t\t\t\t// 展開終了\r\n\t\t\t\tKLBDELETE(m_unzip);\r\n\t\t\t\tm_unzip = NULL;\r\n\t\t\t\t// テンポラリzip削除\r\n\t\t\t\tCPFInterface::getInstance().platform().removeTmpFile(m_tmpPath);\r\n\t\t\t\tm_eStep = S_COMPLETE;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// 次のファイルがあり、なおかつ展開処理が終了していれば次のファイルの読み込みを開始する\r\n\tif(bResult && !m_extracting) {\r\n\t\tif(m_unzip->readCurrentFileInfo()) {\r\n\t\t\tm_unzip->extractCurrentFile(\"file://external/\");\r\n\t\t\tm_extracting = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUpdate::exec_complete(u32 /*deltaT*/) \r\n{\r\n\tif (m_thread) {\r\n\t\tCPFInterface::getInstance().platform().deleteThread(m_thread);\r\n\t\tm_thread = NULL;\r\n\t}\r\n\t// Delete Update State file.\r\n\tm_eStep = S_FINISHED;\r\n\tCPFInterface::getInstance().platform().removeTmpFile(gUpdateFile);\r\n}\r\n\r\nvoid\r\nCKLBUpdate::exec_finish(u32 /*deltaT*/)\r\n{\r\n\tCKLBScriptEnv::getInstance().call_eventUpdateComplete(m_callbackFinish, this);\r\n\tkill();\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/CKLBUpdate.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUpdate_h\r\n#define CKLBUpdate_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBHTTPInterface.h\"\r\n#include \"CUnZip.h\"\r\n#include \"ILuaFuncLib.h\"\r\n#include \"MultithreadedNetwork.h\"\r\n\r\n/*!\r\n* \\class CKLBLuaLibUPDATE\r\n* \\brief Lua Lib Update Class\r\n* \r\n* \r\n*/\r\nclass CKLBLuaLibUPDATE : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibUPDATE();\r\npublic:\r\n\tCKLBLuaLibUPDATE(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibUPDATE();\r\n\r\n\tvoid addLibrary();\r\nprivate:\r\n\tstatic int luaUpdateHasLock\t\t(lua_State * L);\r\n\tstatic int luaUpdateKillLock\t(lua_State * L);\r\n};\r\n\r\nclass CUpdateUnZip : public CUnZip\r\n{\r\nprotected:\r\n\tbool afterExtract(const char * extract_path, bool isDirectory, size_t size);\r\npublic:\r\n\tCUpdateUnZip(const char * zipPath);\r\n\tvirtual ~CUpdateUnZip();\r\n};\r\n\r\n/*!\r\n* \\class CKLBUpdate\r\n* \\brief Updater Task class.\r\n* \r\n* CKLBUpdate is used to update files.\r\n* It downloads it from a specified URL and unzips it.\r\n* Specific callbacks can be registered to be called after different steps\r\n* such as the end of the dowload step, the unzipping step or when the whole \r\n* process is over.\r\n*/\r\nclass CKLBUpdate : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUpdate>;\r\nprotected:\r\n\tCKLBUpdate();\r\n\tvirtual ~CKLBUpdate();\r\npublic:\r\n\tvirtual u32  getClassID\t();\r\n\tvirtual bool initScript\t(CLuaState& lua);\r\n\r\n\tvoid execute\t\t\t(u32 deltaT);\r\n\tvoid die\t\t\t\t();\r\n\r\n\tstatic bool lockExist\t();\r\nprotected:\r\n\tvoid exec_init_download\t(u32 deltaT);\r\n\tvoid exec_download\t\t(u32 deltaT);\r\n\tvoid exec_init_unzip\t(u32 deltaT);\r\n\tvoid exec_unzip\t\t\t(u32 deltaT);\r\n\tvoid exec_complete\t\t(u32 deltaT);\r\n\tvoid exec_finish\t\t(u32 deltaT);\r\n\r\n\tbool isUpdating\t\t\t();\r\n\tvoid cleanUpdate\t\t(const char* tmpFile);\r\n\tbool saveUpdate\t\t\t();\r\n\r\n\t\t   s32\t\t\t\t\tworkThread\t\t\t();\r\n\tstatic s32\t\t\t\t\tthreadFunc\t\t\t(void* pThread, void* data);\r\n\r\nprotected:\r\n\tCKLBHTTPInterface\t*\tm_httpIF;\r\n\tCUpdateUnZip\t\t*\tm_unzip;\r\n\r\n\tenum STEP {\r\n\t\tS_INIT_DL,\t\t// ダウンロード初期化\r\n\t\tS_DOWNLOAD,\t\t// ダウンロード中\r\n\t\tS_INIT_UNZIP,\t// ZIP展開初期化\r\n\t\tS_UNZIP,\t\t// ZIP展開中\r\n\t\tS_COMPLETE,\t\t// Ensure that zip is fully unzipped\r\n\t\tS_FINISHED,\t\t// 完了\r\n\t};\r\n\r\n\tconst char\t\t\t*\tm_callbackDL;\r\n\tconst char\t\t\t*\tm_callbackZIP;\r\n\tconst char\t\t\t*\tm_callbackFinish;\r\n\tconst char\t\t\t*\tm_callbackError;\r\n\t\r\n\tvoid*\t\t\t\t\tm_thread;\r\n\tconst char\t\t\t*\tm_outPath;\r\n\tconst char\t\t\t*\tm_tmpPath;\r\n\tconst char\t\t\t*\tm_zipURL;\r\n\ts64\t\t\t\t\t\tm_zipSize;\r\n\tfloat\t\t\t\t\tm_maxProgress;\r\n\r\n\tvolatile\r\n\tSTEP\t\t\t\t\tm_eStep;\t\t// 進行ステップ\r\n\tbool\t\t\t\t\tm_extracting;\t// 展開中\r\n\r\n\ts64\t\t\t\t\t\tm_dlSize;\t// ダウンロード終了サイズ\r\n\tint\t\t\t\t\t\tm_zipEntry;\t// zip内のエントリ数\r\n};\r\n\r\n/*!\r\n* \\class CKLBUpdateZip\r\n* \\brief Updater through Zip Task class.\r\n* \r\n* CKLBUpdateZip works the same way as CKLBUpdate but only unzips a file already downloaded.\r\n*/\r\nclass CKLBUpdateZip : public CKLBUpdate\r\n{\r\npublic:\r\n\tCKLBUpdateZip();\r\n\tvirtual ~CKLBUpdateZip();\r\n\r\npublic:\r\n\tvirtual u32  getClassID();\r\n\tvirtual bool initScript(CLuaState& lua);\r\n};\r\n\r\n#endif // CKLBUpdate_h\r\n"
  },
  {
    "path": "Engine/source/HTTP/CUnZip.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CPFInterface.h\"\r\n#include \"CUnZip.h\"\r\n#include <string.h>\r\n#ifdef _WIN32\r\n#include <Windows.h>\r\n#endif\r\n#include <sys/stat.h>\r\n#include <sys/types.h>\r\n#include <unistd.h>\r\n#include <fcntl.h>\r\n\r\n#define IsShiftJIS(x) ((BYTE)((x ^ 0x20) - 0xA1) <= 0x3B)\r\n\r\nCUnZip::CUnZip()\r\n: m_hUnzip  (0)\r\n, m_bReady  (false)\r\n, m_finished_entry  (0) \r\n{\r\n}\r\n\r\nCUnZip::CUnZip(const char * zip_path)\r\n: m_hUnzip      (0)\r\n, m_bReady      (false)\r\n, m_finished_entry  (0)\r\n, m_wrfile      (NULL)\r\n{\r\n\tOpen(zip_path);\r\n    memset(m_currentPath, 0, sizeof(m_currentPath));\r\n}\r\n\r\nCUnZip::~CUnZip()\r\n{\r\n\tif(m_hUnzip) unzClose(m_hUnzip);\r\n}\r\n\r\nbool\r\nCUnZip::Open(const char * zip_path)\r\n{\r\n\tm_bReady = false;\r\n\tm_hUnzip = unzOpen(zip_path);\r\n\tif (!m_hUnzip){\r\n\t\treturn false;\r\n\t}\r\n\tunzGetGlobalInfo(m_hUnzip, &m_globalInfo);\r\n\tm_bReady = true;\r\n\tm_finished_entry = 0;\r\n\treturn true;\r\n}\r\n\r\n\r\nbool\r\nCUnZip::afterExtract(const char * /*extract_path*/, bool /*isDirectory*/, size_t /*size*/)\r\n{\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCUnZip::IsFileExist(const char * strFilename)\r\n{\r\n#ifdef _WIN32\r\n\treturn GetFileAttributes(strFilename) != 0xffffffff;\r\n#else\r\n\tstruct stat st;\r\n\tint ret = stat(strFilename, &st);\r\n\treturn (!ret) ? true : false;\r\n#endif\r\n}\r\n\r\nbool\r\nCUnZip::make_directory(const char * dir_name)\r\n{\r\n#ifdef _WIN32\r\n\treturn CreateDirectory(dir_name, 0) ? true : false;\r\n#else\r\n\t// 平成24年11月27日(火)\r\n\t// ディレクトリ下にファイル等を作成する権限がなかったため、適切な権限を付与するよう変更\r\n\tbool ret = (!mkdir(dir_name, 0755)) ? true : false;\r\n    if (ret == true) {\r\n        CPFInterface::getInstance().platform().excludePathFromBackup(dir_name);\r\n    }\r\n    return ret;\r\n#endif\r\n}\r\n\r\nbool\r\nCUnZip::CreateDirectoryReflex(const char * assetPath)\r\n{\r\n\tconst char * strPath = CPFInterface::getInstance().platform().getFullPath(assetPath);\r\n\tchar * strSubPath = new char [ strlen(strPath) + 1 ];\r\n\tfor (const char * p = strPath; *p; p++) {\r\n\t\tif (*p == '/') {\r\n\t\t\tint len = p - strPath + 1;\r\n\t\t\tstrncpy(strSubPath, strPath, len);\r\n\t\t\tstrSubPath[len] = 0;\r\n\t\t\tif (!IsFileExist(strSubPath)) {\r\n\t\t\t\tif (!make_directory(strSubPath)) {\r\n\t\t\t\t\tdelete [] strSubPath;\r\n\t\t\t\t\tdelete [] strPath;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tdelete [] strSubPath;\r\n\tdelete [] strPath;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCUnZip::readCurrentFileInfo()\r\n{\r\n\tif(!m_bReady) return false;\r\n\r\n\tbool bResult = (UNZ_OK == unzGetCurrentFileInfo(m_hUnzip, &m_fileInfo, m_currentPath, sizeof(m_currentPath), 0, 0, 0, 0));\r\n\tm_lenPath = 0;\r\n\tif(bResult) {\r\n\t\tm_lenPath = strlen(m_currentPath);\r\n\t\tfor (int i = 0; i < m_lenPath; ++i) {\r\n\t\t\tif (m_currentPath[i] == '\\\\') m_currentPath[i] = '/';\r\n\t\t}\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCUnZip::extractCurrentFile(const char * extract_root)\r\n{\r\n\tif(!m_bReady) return false;\r\n\r\n\tm_targetPath = new char [ strlen(extract_root) + 512 + 1 ];\r\n\tstrcpy(m_targetPath, extract_root);\r\n\tstrcat(m_targetPath, m_currentPath);\r\n\tCreateDirectoryReflex(m_targetPath);\t// 指定されたディレクトリが無ければ作る\r\n\tm_extractFinish = true;\r\n\r\n\t// ディレクトリの場合\r\n\tif (m_currentPath[m_lenPath - 1] == '/') {\r\n\t\t// 展開後処理の呼び出し\r\n\t\tm_finished_entry++;\r\n\t\tafterExtract(m_targetPath, true, 0);\r\n\t\tif (m_targetPath) {\r\n\t\t\tdelete [] m_targetPath;\r\n\t\t\tm_targetPath = NULL;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t// ファイルの場合\r\n\tif (unzOpenCurrentFile(m_hUnzip) != UNZ_OK) {\r\n\t\tif (m_targetPath) {\r\n\t\t\tdelete [] m_targetPath;\r\n\t\t\tm_targetPath = NULL;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_wrfile = CPFInterface::getInstance().platform().openTmpFile(m_targetPath);\r\n\tif(!m_wrfile) {\r\n\t\t// ファイルが書き込めない場合\r\n\t\tunzCloseCurrentFile(m_hUnzip);\r\n\t\tif (m_targetPath) {\r\n\t\t\tdelete [] m_targetPath;\r\n\t\t\tm_targetPath = NULL;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// unzReadCurrentFile() は最初の一回のみ malloc() を呼ぶため、\r\n\t// その最初の一回はメインスレッドで実行してやる。\r\n\tunsigned char szBuffer[BUF_SIZE];\r\n\tunsigned long dwSizeRead;\r\n\tm_dwSizeWrite = 0;\r\n    memset(szBuffer, 0, sizeof(szBuffer));\r\n\tif((dwSizeRead = unzReadCurrentFile(m_hUnzip, szBuffer, sizeof szBuffer)) > 0) {\r\n\t\tm_dwSizeWrite += m_wrfile->writeTmp(szBuffer, dwSizeRead);\r\n        memset(szBuffer, 0, sizeof(szBuffer));\r\n\t}\r\n\r\n\t// この段階で展開が終了していたら、わざわざ別スレッドを立ち上げる必要はない。\r\n\tif(m_dwSizeWrite == m_fileInfo.uncompressed_size) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t// 展開はこれから別スレッドで行う。スレッド立ち上げ前に展開終了ステータスを false にする\r\n\tm_extractFinish = false;\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tm_hThread = pForm.createThread(CUnZip::ThreadExtractEntry, this);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCUnZip::isFinishExtract()\r\n{\r\n\tif(!m_extractFinish) {\r\n\t\t// 展開が終了していない場合はスレッドをウォッチ\r\n\t\ts32 status = 0;\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tbool result = pForm.watchThread(m_hThread, &status);\r\n        if(result) { return false; }    // thread は実行中\r\n\t\tpForm.deleteThread(m_hThread);\r\n\t\tm_hThread = NULL;\r\n\t\tm_extractFinish = true;\r\n\t}\r\n\r\n    if (m_wrfile) {\r\n        delete m_wrfile;\r\n        m_wrfile = NULL;\r\n    }\r\n\tunzCloseCurrentFile(m_hUnzip);\r\n/*\r\n\tif(m_dwSizeWrite != m_fileInfo.uncompressed_size) {\r\n\t\tdelete [] m_targetPath;\r\n\t\tm_targetPath = 0;\r\n\t\treturn true;\r\n\t}\r\n*/\r\n\t// 展開後処理呼び出し\r\n\tm_finished_entry++;\r\n\tafterExtract(m_targetPath, false, m_dwSizeWrite);\r\n    if (m_targetPath) {\r\n        DEBUG_PRINT(\"[unzip] m_targetpath delete %s\", m_targetPath);\r\n        delete [] m_targetPath;\r\n        m_targetPath = NULL;\r\n    }\r\n\treturn true;\r\n}\r\n\r\ns32\r\nCUnZip::ThreadExtract(void * /* hThread */, void * /*data*/)\r\n{\r\n\tunsigned char szBuffer[BUF_SIZE];\r\n\tunsigned long dwSizeRead;\r\n    memset(szBuffer, 0, sizeof(szBuffer));\r\n    while ((dwSizeRead = unzReadCurrentFile(m_hUnzip, szBuffer, sizeof szBuffer)) > 0) {\r\n\t\tm_dwSizeWrite += m_wrfile->writeTmp(szBuffer, dwSizeRead);\r\n        memset(szBuffer, 0, sizeof(szBuffer));\r\n\t}\r\n\r\n\t// 展開が終わったのでスレッド終了\r\n\treturn 0;\r\n}\r\n\r\ns32\r\nCUnZip::ThreadExtractEntry(void * hThread, void * data)\r\n{\r\n\tCUnZip * pUnZip = (CUnZip *)data;\r\n\treturn pUnZip->ThreadExtract(hThread, data);\r\n}\r\n\r\nbool\r\nCUnZip::gotoNextFile()\r\n{\r\n    if(!m_bReady) { return false; }\r\n\treturn unzGoToNextFile(m_hUnzip) != UNZ_END_OF_LIST_OF_FILE;\r\n}\r\n\r\nbool\r\nCUnZip::unCompress(const char * extract_root)\r\n{\r\n    if(!m_bReady) { return false; }\r\n\tdo {\r\n\t\tif(!readCurrentFileInfo()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\textractCurrentFile(extract_root);\r\n\t} while (gotoNextFile());\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/CUnZip.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CUnZip_h\r\n#define CUnZip_h\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n\r\n#include \"zlib.h\"\r\n#include \"unzip.h\"\r\n#pragma comment(lib, \"zlib.lib\")\r\n\r\n#include \"BaseType.h\"\r\n#include \"ITmpFile.h\"\r\n\r\n/*!\r\n* \\class CUnZip\r\n* \\brief UnZip Class\r\n* \r\n* \r\n*/\r\nclass CUnZip\r\n{\r\npublic:\r\n\tCUnZip();\r\n\tCUnZip(const char * zip_path);\r\n\tvirtual ~CUnZip();\r\n\r\n\tbool Open(const char * zip_path);\r\n\r\n\tinline bool getStatus() {\r\n\t\treturn m_bReady;\r\n\t}\r\n\tinline unsigned long numEntry() { return m_globalInfo.number_entry; }\r\n\tbool readCurrentFileInfo();\r\n\tbool extractCurrentFile\t(const char * extract_root);\r\n\tbool isFinishExtract\t();\r\n\tbool gotoNextFile\t\t();\r\n\r\n\tinline int getFinishedEntry() { return m_finished_entry; }\r\n\r\n\t// 展開処理\r\n\tbool unCompress(const char * extract_root);\r\n\r\nprotected:\r\n\t// ファイル個別の展開が終了したときに、そのファイルのパス名と展開サイズを引数として呼び出される。\r\n\tvirtual bool afterExtract(const char * extract_path, bool isDirectory, size_t size);\r\n\r\nprivate:\r\n\tbool\tmake_directory\t\t\t(const char * dir_name);\r\n\tbool\tCreateDirectoryReflex\t(const char * strPath);\r\n\tbool\tIsFileExist\t\t\t\t(const char * strFilename);\r\n\r\n\ts32\t\tThreadExtract\t\t\t(void * hThread, void * data);\r\n\r\n\tstatic s32 ThreadExtractEntry\t(void * hThread, void * data);\r\n\r\n\r\n\tunzFile\t\t\tm_hUnzip;\r\n\tunz_global_info\tm_globalInfo;\r\n    unz_file_info\tm_fileInfo;\r\n\tchar\t\t\tm_currentPath[512];\r\n\tint\t\t\t\tm_lenPath;\r\n\r\n\tITmpFile\t*\tm_wrfile;\r\n\tunsigned long\tm_dwSizeWrite;\r\n\r\n\tchar\t\t*\tm_targetPath;\r\n\tbool\t\t\tm_extractFinish;\r\n\tvoid\t\t*\tm_hThread;\r\n\r\n\tint\t\t\t\tm_finished_entry;\r\n\r\n\tbool\t\t\tm_bReady;\r\n\r\n\tenum {\r\n\t\tBUF_SIZE = 8192\r\n\t};\r\n};\r\n\r\n\r\n#endif // CUnZip_h\r\n"
  },
  {
    "path": "Engine/source/HTTP/MultithreadedNetwork.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"MultithreadedNetwork.h\"\r\n\r\nNetworkManager NetworkManager::s_manager;\r\n\r\nConnectionEntry::ConnectionEntry() \r\n{\r\n\tm_pNext = NULL;\r\n\tm_kill\t= false;\t\r\n}\r\n\r\nConnectionEntry::~ConnectionEntry() \r\n{\r\n}\r\n\r\nNetworkManager::NetworkManager()\r\n{\r\n}\r\n\r\nNetworkManager::~NetworkManager()\r\n{\r\n}\r\n\r\n// TODO : Task destruction will have task executed at a given frame\r\n// and all task are killed AT THE END OF FRAME.\r\n// Make sure that we kill the network manager AFTER that.\r\n\r\n/*static*/\r\nbool \r\nNetworkManager::startNetworkManager() \r\n{\r\n\t// 1. Start Thread\r\n\ts_manager.m_lock \t\t\t\t= ALLOC_LOCK();\r\n\ts_manager.m_eventLock\t\t\t= ALLOCEVENT_LOCK();\r\n\ts_manager.m_bShutDownComplete\t= false;\r\n\ts_manager.m_bShutDown\t\t\t= false;\r\n\ts_manager.m_entries\t\t\t\t= NULL;\r\n\ts_manager.m_thread\t\t\t\t= NULL;\r\n\ts_manager.m_killCount\t\t\t= 0;\r\n\r\n\ts_manager.m_thread = CREATE_THREAD(threadFunc,&s_manager);\r\n\treturn s_manager.m_thread != 0;\r\n}\r\n\r\n/*static*/\r\nvoid \r\nNetworkManager::stopNetworkManager() \r\n{\r\n\ts_manager.m_bShutDown = true;\r\n\t\r\n\t// May be asleep\r\n\tWAKE_THREAD(s_manager.m_eventLock);\r\n\t\r\n\twhile (s_manager.m_bShutDownComplete == false) {\r\n\t\t// Wait other thread complete loop.\r\n\t}\r\n\r\n\t// TODO clear all entries.\r\n\tklb_assert(s_manager.m_entries == NULL, \"Remaining connection !?\");\r\n\r\n\tFREE_THREAD\t\t(s_manager.m_thread);\r\n\tFREE_LOCK\t\t(s_manager.m_lock);\r\n\tFREEEVENT_LOCK\t(s_manager.m_eventLock);\r\n}\r\n\r\nint gTotal = 0;\r\n\r\n/*static*/\r\nCKLBHTTPInterface* \r\nNetworkManager::createConnection() \r\n{\r\n\tConnectionEntry*\tpEntry = KLBNEW(ConnectionEntry);\r\n\tif (pEntry) {\r\n\t\tpEntry->m_kill \t= false;\r\n\t\t\r\n\t\tLOCK(s_manager.m_lock);\r\n\t\tpEntry->m_pNext\t= s_manager.m_entries;\r\n\t\ts_manager.m_entries = pEntry;\r\n\t\tgTotal++;\r\n\t\tDEBUG_PRINT(\"ALLOC CONNEXION : %8X(%i)\\n\", &pEntry->m_oConnection, gTotal);\r\n\t\tUNLOCK(s_manager.m_lock);\r\n\t\treturn &pEntry->m_oConnection;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\n/*static*/\r\nvoid \r\nNetworkManager::releaseConnection(CKLBHTTPInterface* connection) \r\n{\r\n\tif (!connection) { return; }\r\n\r\n\tLOCK(s_manager.m_lock);\r\n\tgTotal--;\r\n\tDEBUG_PRINT(\"FREE CONNEXION : %8X(%i)\\n\", connection, gTotal);\r\n\t// 1. Find in link list the entry.\r\n\tConnectionEntry* pEntry = s_manager.m_entries;\r\n\tConnectionEntry* pPrev\t= NULL;\r\n\twhile (pEntry) {\r\n\t\tif ((&pEntry->m_oConnection) == connection) {\r\n\t\t\t// Between lock.\r\n\t\t\tif (pPrev) {\r\n\t\t\t\tpPrev->m_pNext\t\t= pEntry->m_pNext;\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\ts_manager.m_entries = pEntry->m_pNext;\r\n\t\t\t}\r\n\r\n\t\t\ts_manager.m_killEntries[s_manager.m_killCount++] = pEntry;\r\n\t\t\tif (s_manager.m_killCount > 10) {\r\n\t\t\t\tDEBUG_PRINT(\"ASSERT : more than 10 FREE CONNEXION WAIT FOR KILL !!! \\n\");\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tpPrev  = pEntry;\r\n\t\tpEntry = pEntry->m_pNext;\r\n\t}\r\n\t\r\n\tif (!pEntry) {\r\n\t\tklb_assertAlways(\"Error\");\r\n\t}\r\n\tUNLOCK(s_manager.m_lock);\r\n\t\r\n\t// May be asleep\r\n\tWAKE_THREAD(s_manager.m_eventLock);\r\n}\r\n\r\n/*static*/ \r\ns32 \r\nNetworkManager::threadFunc(void* /*pThread*/, void* data) \r\n{\r\n\treturn ((NetworkManager*)data)->workThread();\r\n}\r\n\r\ns32 \r\nNetworkManager::workThread() \r\n{\r\n\tSLEEP_THREAD(m_eventLock); // First time wait.\r\n\t\r\n\twhile (!m_bShutDown) {\r\n\t\twhile (m_killCount != 0) {\r\n\t\t\tConnectionEntry* pList = NULL;\r\n\t\t\tLOCK(m_lock);\r\n\t\t\tif (m_killCount) {\r\n\t\t\t\tpList = m_killEntries[--m_killCount];\r\n\t\t\t}\r\n\t\t\tUNLOCK(m_lock);\r\n\r\n\t\t\tif (pList) {\r\n\t\t\t\tDEBUG_PRINT(\"REAL KILL CONNEXION : %8X\\n\", &pList->m_oConnection);\r\n\t\t\t\t// Consume code\r\n\t\t\t\tKLBDELETE(pList);\r\n\t\t\t}\r\n\t\t}\r\n\t\tSLEEP_THREAD(m_eventLock);\r\n\t}\r\n\t\r\n\tm_bShutDownComplete = true;\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/HTTP/MultithreadedNetwork.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef MULTITHREADED_NETWORK_KLB\r\n#define MULTITHREADED_NETWORK_KLB\r\n\r\n#include \"CKLBHTTPInterface.h\"\r\n\r\n#define LOCK(a)\t\t\t\t\tCPFInterface::getInstance().platform().mutexLock(a)\r\n#define UNLOCK(a)\t\t\t\tCPFInterface::getInstance().platform().mutexUnlock(a)\r\n#define ALLOC_LOCK()\t\t\tCPFInterface::getInstance().platform().allocMutex()\r\n#define FREE_LOCK(a)\t\t\tCPFInterface::getInstance().platform().freeMutex(a)\r\n#define ALLOCEVENT_LOCK()\t\tCPFInterface::getInstance().platform().allocEventLock()\r\n#define FREEEVENT_LOCK(a)\t\tCPFInterface::getInstance().platform().freeEventLock(a)\r\n#define CREATE_THREAD(a,b)\t\tCPFInterface::getInstance().platform().createThread(a, b)\r\n#define FREE_THREAD(a)\t\t\tCPFInterface::getInstance().platform().deleteThread(a)\r\n#define WAKE_THREAD(a)\t\t\tCPFInterface::getInstance().platform().eventWakeup(a)\r\n#define SLEEP_THREAD(a)\t\t\tCPFInterface::getInstance().platform().eventSleep(a)\r\n\r\n/*!\r\n* \\class ConnectionEntry\r\n* \\brief Connection Entry Class\r\n* \r\n* \r\n*/\r\nclass ConnectionEntry {\r\npublic:\r\n\tConnectionEntry();\r\n\t~ConnectionEntry();\r\n\tConnectionEntry*\tm_pNext;\r\n\tCKLBHTTPInterface\tm_oConnection;\r\n\tbool\t\t\t\tm_kill;\r\n};\r\n\r\n/*!\r\n* \\class NetworkManager\r\n* \\brief Network Manager\r\n* \r\n* \r\n*/\r\nclass NetworkManager {\r\npublic:\r\n\tstatic bool \t\t\t\tstartNetworkManager\t();\r\n\tstatic void \t\t\t\tstopNetworkManager\t();\r\n\tstatic CKLBHTTPInterface*\tcreateConnection\t();\r\n\tstatic void\t\t\t\t\treleaseConnection\t(CKLBHTTPInterface* connection);\r\nprivate:\r\n\t\t   s32\t\t\t\t\tworkThread\t\t\t();\r\n\tstatic s32\t\t\t\t\tthreadFunc\t\t\t(void* pThread, void* data);\r\n\tstatic NetworkManager\t\ts_manager;\r\n\t\r\n\tNetworkManager();\r\n\t~NetworkManager();\r\n\t\r\n\tvoid* \t\t\t\tm_lock;\r\n\tvoid*\t\t\t\tm_eventLock;\r\n\tConnectionEntry*\tm_entries;\r\n\tvolatile u32\t\tm_killCount;\r\n\tConnectionEntry*\tm_killEntries[200];\r\n\tbool\t\t\t\tm_bShutDown;\r\n\tvoid*\t\t\t\tm_thread;\r\n\t\r\n\tvolatile\r\n\tbool\t\t\t\tm_bShutDownComplete;\r\n\t\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaConst.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaConst.h\"\r\n\r\nvoid\r\nCKLBLuaConst::removeLuaConst(CLuaState& lua, const char * grpName)\r\n{\r\n\tlua.retNil();\r\n\tlua.setGlobal(grpName);\r\n}\r\n\r\n/*!\r\n\t\\param lua\t\treference of target Lua state.\r\n\t\\param grpName\tLua constant group(class) name.\r\n\t\\param nums\t\tdefine constants number.\r\n\t\\param items\tdefine constants item list.\r\n*/\r\nint\r\nCKLBLuaConst::setLuaConst(CLuaState& lua, const char * grpName, int nums, ITEM * items)\r\n{\r\n\tlua.tableNew();\r\n\tfor(int i = 0; i < nums; i++) {\r\n\t\tITEM * pItem = items + i;\r\n\r\n\t\tlua.retString(pItem->name);\r\n\t\tlua.retInt(pItem->value);\r\n\t\tlua.tableSet();\r\n\t}\r\n\tlua.setGlobal(grpName);\r\n\treturn nums;\r\n}\r\n\r\nint\r\nCKLBLuaConst::setLuaConstBy2Lists(CLuaState& lua, const char * grpName,\r\n\t\t\t\t\t\t\t\t\tint nums, const char ** nameList)\r\n{\r\n\tlua.tableNew();\r\n\tfor(int i = 0; i < nums; i++) {\r\n\t\tlua.retString(nameList[i]);\r\n\t\tlua.retInt(i);\r\n\t\tlua.tableSet();\r\n\t}\r\n\tlua.setGlobal(grpName);\r\n\treturn nums;\r\n}\r\n\r\nint\r\nCKLBLuaConst::setLuaConstBy2Lists(CLuaState& lua, const char * grpName,\r\n\t\t\t\t\t\t\t\t\tint nums, const char ** nameList, int * valueList)\r\n{\r\n\tlua.tableNew();\r\n\tfor(int i = 0; i < nums; i++) {\r\n\t\tlua.retString(nameList[i]);\r\n\t\tlua.retInt(valueList[i]);\r\n\t\tlua.tableSet();\r\n\t}\r\n\tlua.setGlobal(grpName);\r\n\treturn nums;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaConst.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaConst_h\r\n#define CKLBLuaConst_h\r\n\r\n#include \"CLuaState.h\"\r\n\r\nclass CKLBLuaConst\r\n{\r\npublic:\r\n\tstruct ITEM {\r\n\t\tconst char * name;\r\n\t\tint value;\r\n\t};\r\n\tstatic void removeLuaConst(CLuaState& lua, const char * grpName);\r\n\r\n\tstatic int setLuaConst(CLuaState& lua, const char * grpName, int num, ITEM * items);\r\n\r\n\tstatic int setLuaConstBy2Lists(CLuaState& lua, const char * grpName,\r\n\t\t\t\t\t\t\t\t\tint nums, const char ** nameList, int * valueList);\r\n\tstatic int setLuaConstBy2Lists(CLuaState& lua, const char * grpName,\r\n\t\t\t\t\t\t\t\t\tint nums, const char ** nameList);\r\n};\r\n/*\r\n　【使用例】\r\n\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tCKLBLuaConst::ITEM list[] = {\r\n\t\t{ \"str\", 1 },\r\n\t\t{ \"int\", 20 },\r\n\t\t{ \"dex\", 300 }\r\n\t};\r\n\tCKLBLuaConst::setLuaConst(lua, \"PARAM\", 3, items);\r\n\r\n\t上記のコードで、Lua側に\r\n\r\n\tPARAM.str = 1\r\n\tPARAM.int = 20\r\n\tPARAM.dex = 300\r\n\r\n\tの定数が定義されます。あるいは、\r\n\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tconst char * nameList[] = { \"str\", \"int\", \"dex\" };\r\n\tint valueList[] = { 1, 20, 300 };\r\n\tCKLBLuaConst::setLuaConstBy2Lists(lua, \"PARAM\", 3, nameList, valueList);\r\n\r\n\tでも同様です。\r\n*/\r\n#endif // CKLBLuaConst_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibAPP.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibAPP.h\"\r\n\r\n;\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n\t{ \"APP_MAIL\",\t\tIPlatformRequest::APP_MAIL },\t\t// 各環境のメールアプリ\r\n\t{ \"APP_BROWSER\",\tIPlatformRequest::APP_BROWSER },\t// 各環境のブラウザアプリ\r\n\t{ \"APP_UPDATE\",\t\tIPlatformRequest::APP_UPDATE },\t\t// 各環境のアップデートアプリ\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibAPP libdef(luaConst);\r\n\r\nCKLBLuaLibAPP::CKLBLuaLibAPP(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibAPP::~CKLBLuaLibAPP() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibAPP::addLibrary()\r\n{\r\n\taddFunction(\"APP_CallApplication\",\t\tCKLBLuaLibAPP::luaCallApplication);\r\n\taddFunction(\"APP_GetPhysicalMem\",\t\tCKLBLuaLibAPP::luaGetPhysicalMem);\r\n}\r\n\r\nint\r\nCKLBLuaLibAPP::luaGetPhysicalMem(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\tu32 value = CPFInterface::getInstance().platform().getPhysicalMemKB();\r\n\tif (value >= 0x1000000) {\r\n\t\t// 24 bit significant.\r\n\t\tvalue = 0xFFFFFF;\r\n\t}\r\n\tlua.retInt(value);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibAPP::luaCallApplication(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tbool result = false;\r\n\tIPlatformRequest::APP_TYPE type = (IPlatformRequest::APP_TYPE)lua.getInt(1);\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tswitch(type)\r\n\t{\r\n\tcase IPlatformRequest::APP_MAIL:\r\n\t\t{\r\n\t\t\tconst char * addr = (lua.isNil(2)) ? \"\" : lua.getString(2);\r\n\t\t\tconst char * subject = (lua.isNil(3)) ? \"\" : lua.getString(3);\r\n\t\t\tconst char * body = (lua.isNil(4)) ? \"\" : lua.getString(4);\r\n\r\n\t\t\tresult = pForm.callApplication(type, addr, subject, body);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase IPlatformRequest::APP_BROWSER:\r\n\t\t{\r\n\t\t\tconst char * url = (lua.isNil(2)) ? \"\" : lua.getString(2);\r\n\r\n\t\t\tresult = pForm.callApplication(type, url);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase IPlatformRequest::APP_UPDATE:\r\n\t\t{\r\n\t\t\tconst char * search_key = (argc >= 2 && !lua.isNil(2)) ? lua.getString(2) : \"\";\r\n\t\t\tresult = pForm.callApplication(type, search_key);\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n\tlua.retBoolean(result);\r\n\treturn 1;\r\n}\r\n\r\n// For C#\r\nbool CKLBLuaLibAPP::callApplication(IPlatformRequest::APP_TYPE type, const char* addr, const char* subject, const char* body)\r\n{\r\n\tbool result = false;\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tswitch(type)\r\n\t{\r\n\tcase IPlatformRequest::APP_MAIL:\r\n\t\t{\r\n\t\t\tresult = pForm.callApplication(type, addr, subject, body);\r\n\t\t}\r\n\t\tbreak;\r\n    case IPlatformRequest::APP_BROWSER:\r\n        {\r\n            result = pForm.callApplication(type, addr);\r\n        }\r\n        break;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibAPP.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibAPP_h\r\n#define CKLBLuaLibAPP_h\r\n\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibAPP : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibAPP();\r\npublic:\r\n\tCKLBLuaLibAPP(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibAPP();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int luaCallApplication\t(lua_State * L);\r\n\tstatic int luaGetPhysicalMem\t(lua_State * L);\r\npublic: // Lua-free\r\n\tstatic bool callApplication(IPlatformRequest::APP_TYPE type, const char* addr, const char* subject, const char* body);\r\n};\r\n\r\n\r\n\r\n#endif // CKLBLuaLibAPP_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibASSET.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibASSET.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n//\t{ \"DBG_M_SWITCH\",\tDBG_MENU::M_SWITCH },\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibASSET libdef(luaConst);\r\n\r\nCKLBLuaLibASSET::CKLBLuaLibASSET(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibASSET::~CKLBLuaLibASSET() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibASSET::addLibrary()\r\n{\r\n\taddFunction(\"ASSET_getImageSize\",\t\tCKLBLuaLibASSET::luaGetImageSize);\r\n\taddFunction(\"ASSET_getBoundSize\",\t\tCKLBLuaLibASSET::luaGetBoundSize);\r\n\taddFunction(\"ASSET_getAssetInfo\",\t\tCKLBLuaLibASSET::luaGetAssetInfo);\r\n\taddFunction(\"ASSET_delExternal\",\t\tCKLBLuaLibASSET::luaDelExternal);\r\n\taddFunction(\"ASSET_getExternalFree\",\tCKLBLuaLibASSET::luaGetExternalFree);\r\n}\r\n\r\ns32\r\nCKLBLuaLibASSET::luaGetImageSize(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 2;\r\n\t}\r\n\r\n\tconst char * asset_name = lua.getString(1);\r\n\tu32 handle;\r\n\tCKLBImageAsset * pAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset_name, &handle);\r\n\tif(!pAsset) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 2;\r\n\t}\r\n\r\n\tSKLBRect * rect = pAsset->getSize();\r\n\r\n\ts32 width = rect->getWidth();\r\n\ts32 height = rect->getHeight();\r\n\r\n\tCKLBDataHandler::releaseHandle(handle);\r\n\r\n\tlua.retInt(width);\r\n\tlua.retInt(height);\r\n\treturn 2;\t\r\n}\r\n\r\ns32\r\nCKLBLuaLibASSET::luaGetBoundSize(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 2;\r\n\t}\r\n\tconst char * asset_name = lua.getString(1);\r\n\tu32 handle;\r\n\tCKLBImageAsset * pAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset_name, &handle);\r\n\tif(!pAsset) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 2;\r\n\t}\r\n\tfloat width = pAsset->m_boundWidth;\r\n\tfloat height = pAsset->m_boundHeight;\r\n\r\n\tCKLBDataHandler::releaseHandle(handle);\r\n\r\n\tlua.retDouble(width);\r\n\tlua.retDouble(height);\r\n\treturn 2;\t\r\n\r\n}\r\n\r\ns32\r\nCKLBLuaLibASSET::luaGetAssetInfo(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 4;\r\n\t}\r\n\tconst char * asset_name = lua.getString(1);\r\n\tu32 handle;\r\n\tCKLBImageAsset * pAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset_name, &handle);\r\n\tif(!pAsset) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 4;\r\n\t}\r\n\tSKLBRect * rect = pAsset->getSize();\r\n\ts32 img_width = rect->getWidth();\r\n\ts32 img_height = rect->getHeight();\r\n\tfloat bound_width = pAsset->m_boundWidth;\r\n\tfloat bound_height = pAsset->m_boundHeight;\r\n\r\n\tCKLBDataHandler::releaseHandle(handle);\r\n\r\n\tlua.retInt(img_width);\r\n\tlua.retInt(img_height);\r\n\tlua.retDouble(bound_width);\r\n\tlua.retDouble(bound_height);\r\n\r\n\treturn 4;\r\n}\r\n\r\ns32\r\nCKLBLuaLibASSET::luaDelExternal(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tconst char * asset_name = lua.getString(1);\r\n\tbool res = CPFInterface::getInstance().platform().removeFileOrFolder(asset_name);\r\n\tlua.retBool(res);\r\n\treturn 1;\r\n}\r\n\r\ns32\r\nCKLBLuaLibASSET::luaGetExternalFree(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 0) {\r\n\t\tlua.retInt(0);\r\n\t\treturn 1;\r\n\t}\r\n\ts32 res = (s32)CPFInterface::getInstance().platform().getFreeSpaceExternalKB(); // Never return more than 0xFFFFFF\r\n\tlua.retInt(res);\r\n\treturn 1;\r\n}\r\n\r\nvoid CKLBLuaLibASSET::cmdGetImageSize(const char* asset_name, s32* pReturnWidth, s32* pReturnHeight)\r\n{\r\n\tu32 handle;\r\n\tCKLBImageAsset * pAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript( asset_name, &handle);\r\n\tif(pAsset)\r\n\t{\r\n\t\tSKLBRect * rect = pAsset->getSize();\r\n\r\n\t\t*pReturnWidth = rect->getWidth();\r\n\t\t*pReturnHeight = rect->getHeight();\r\n\r\n\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t}\r\n}\r\n\r\nvoid CKLBLuaLibASSET::cmdGetBoundSize(const char* asset_name, float* pReturnWidth, float* pReturnHeight)\r\n{\r\n\tu32 handle;\r\n\tCKLBImageAsset * pAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript( asset_name, &handle);\r\n\tif(pAsset)\r\n\t{\r\n\t\t*pReturnWidth = pAsset->m_boundWidth;\r\n\t\t*pReturnHeight = pAsset->m_boundHeight;\r\n\r\n\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t}\r\n}\r\n\r\nvoid CKLBLuaLibASSET::cmdGetAssetInfo(const char* asset_name, s32* pReturnImgWidth, s32* pReturnImgHeight, float* pReturnBoundWidth, float* pReturnBoundHeight)\r\n{\r\n\tu32 handle;\r\n\tCKLBImageAsset * pAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript( asset_name, &handle);\r\n\tif(pAsset) {\r\n\t\tSKLBRect * rect = pAsset->getSize();\r\n\t\t\r\n\t\t*pReturnImgWidth = rect->getWidth();\r\n\t\t*pReturnImgHeight = rect->getHeight();\r\n\t\t*pReturnBoundWidth = pAsset->m_boundWidth;\r\n\t\t*pReturnBoundHeight = pAsset->m_boundHeight;\r\n\r\n\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibASSET.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibASSET_h\r\n#define CKLBLuaLibASSET_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibASSET : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibASSET();\r\npublic:\r\n\tCKLBLuaLibASSET(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibASSET();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic void cmdGetImageSize\t(const char* asset_name, s32* pReturnWidth, s32* pReturnHeight);\r\n\tstatic void cmdGetBoundSize\t(const char* asset_name, float* pReturnWidth, float* pReturnHeight);\r\n\tstatic void cmdGetAssetInfo\t(const char* asset_name, s32* pReturnImgWidth, s32* pReturnImgHeight, float* pReturnBoundWidth, float* pReturnBoundHeight);\r\nprivate:\r\n\tstatic s32\tluaGetImageSize\t\t(lua_State * L);\r\n\tstatic s32\tluaGetBoundSize\t\t(lua_State * L);\r\n\tstatic s32\tluaGetAssetInfo\t\t(lua_State * L);\r\n\tstatic s32\tluaDelExternal\t\t(lua_State * L);\r\n\tstatic s32\tluaGetExternalFree\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibASSET_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibBIN.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibBIN.h\"\r\n\r\nstatic CKLBLuaLibBIN libdef(0);\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* CKLBLuaLibBIN::ms_libRegStruct = CKLBLibRegistrator::getInstance()->add(\"LibBIN\", CLS_KLBBINARRAY);\r\n\r\nCKLBLuaLibBIN::CKLBLuaLibBIN(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibBIN::~CKLBLuaLibBIN()\r\n{\r\n\tCKLBBinArray::removeAll();\r\n}\r\n\r\n// LuaLib全破棄時に、生成されたままクローズされていないバイナリをクローズする\r\nvoid\r\nCKLBLuaLibBIN::destroyResources()\r\n{\r\n\tCKLBBinArray::removeAll();\r\n}\r\n\r\n// バイナリオブジェクトをダンプする\r\nbool\r\nCKLBLuaLibBIN::dumpObjects(IPlatformRequest& pForm)\r\n{\r\n\tpForm.logging(\"[LuaLibBIN]\");\r\n\treturn CKLBBinArray::dumpAll();\r\n}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibBIN::addLibrary()\r\n{\r\n\taddFunction(\"BIN_open\",     CKLBLuaLibBIN::bin_open);\r\n\taddFunction(\"BIN_close\",    CKLBLuaLibBIN::bin_close);\r\n\taddFunction(\"BIN_peek\",\t\tCKLBLuaLibBIN::bin_peek);\r\n    addFunction(\"BIN_peekU16\",  CKLBLuaLibBIN::bin_peek_u16);\r\n    addFunction(\"BIN_peekU32\",  CKLBLuaLibBIN::bin_peek_u32);\r\n}\r\n\r\nint\r\nCKLBLuaLibBIN::bin_open(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tconst char * bin_asset = lua.getString(1);\r\n\tCKLBBinArray * pBIN = KLBNEW(CKLBBinArray);\r\n\tif(!pBIN || !pBIN->loadAsset(bin_asset)) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tlua.retPointer(pBIN);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibBIN::bin_close(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\t// ポインタとして積まれたものがnilだった\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBBinArray * pBIN = (CKLBBinArray *)lua.getPointer(1);\r\n\tKLBDELETE(pBIN);\r\n\tlua.retNil();\r\n\treturn 1;\t// nilを返す\r\n}\r\n\r\nint\r\nCKLBLuaLibBIN::bin_peek(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\t// ポインタとして積まれたものがnilだった\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBBinArray * pBIN = (CKLBBinArray *)lua.getPointer(1);\r\n\tint offset = lua.getInt(2);\r\n\r\n\tif(offset < 0 || (int)pBIN->getSize() <= offset) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tint value = pBIN->getByte(offset);\r\n\tlua.retInt(value);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibBIN::bin_peek_u16(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n\r\n    int argc = lua.numArgs();\r\n\tif(argc < 2 || argc > 3) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\t// ポインタとして積まれたものがnilだった\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBBinArray * pBIN = (CKLBBinArray *)lua.getPointer(1);\r\n\tint offset = lua.getInt(2);\r\n\r\n\tif(offset < 0 || (int)pBIN->getSize() <= offset + 1) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tbool f_bigendian = (argc >= 3) ? lua.getBool(3) : false;\r\n    \r\n\tint value = (f_bigendian) ? pBIN->getWordBE(offset) : pBIN->getWordLE(offset);\r\n\tlua.retInt(value);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibBIN::bin_peek_u32(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n\r\n    int argc = lua.numArgs();\r\n\tif(argc < 2 || argc > 3) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\t// ポインタとして積まれたものがnilだった\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBBinArray * pBIN = (CKLBBinArray *)lua.getPointer(1);\r\n\tint offset = lua.getInt(2);\r\n    \r\n\tif(offset < 0 || (int)pBIN->getSize() <= offset + 3) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tbool f_bigendian = (argc >= 3) ? lua.getBool(3) : false;\r\n    \r\n\tu32 value = (f_bigendian) ? pBIN->getLongBE(offset) : pBIN->getLongLE(offset);\r\n\tlua.retInt(value);\r\n\treturn 1;\r\n}\r\n\r\nCKLBBinArray* CKLBLuaLibBIN::bin_open(const char* bin_asset)\r\n{\r\n\tCKLBBinArray * pBIN = KLBNEW(CKLBBinArray);\r\n\tif(!pBIN || !pBIN->loadAsset(bin_asset))\r\n\t{\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pBIN;\r\n}\r\n\r\nvoid CKLBLuaLibBIN::bin_close(CKLBBinArray* pBIN)\r\n{\r\n\tif(pBIN)\r\n\t{\r\n\t\tKLBDELETE(pBIN);\r\n\t}\r\n}\r\n\r\nbool CKLBLuaLibBIN::bin_peek(CKLBBinArray* pBIN, int offset, int* out_value)\r\n{\r\n\tif(pBIN == NULL || offset < 0 || (int)pBIN->getSize() <= offset) {\r\n\t\treturn false;\r\n\t}\r\n\t*out_value = pBIN->getByte(offset);\r\n\treturn true;\r\n}\r\n\r\nbool CKLBLuaLibBIN::bin_peek_u16(CKLBBinArray* pBIN, int offset, u32* out_value, bool f_bigendian)\r\n{\r\n\tif(pBIN == NULL || offset < 0 || (int)pBIN->getSize() <= offset + 1) {\r\n\t\treturn false;\r\n\t}\r\n\t*out_value = (f_bigendian) ? pBIN->getWordBE(offset) : pBIN->getWordLE(offset);\r\n\treturn true;\r\n}\r\n\r\nbool CKLBLuaLibBIN::bin_peek_u32(CKLBBinArray* pBIN, int offset, u32* out_value, bool f_bigendian)\r\n{\r\n\tif(pBIN == NULL || offset < 0 || (int)pBIN->getSize() <= offset + 3) {\r\n\t\treturn false;\r\n\t}\r\n\t*out_value = (f_bigendian) ? pBIN->getLongBE(offset) : pBIN->getLongLE(offset);\r\n\treturn true;\r\n}"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibBIN.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibBIN_h\r\n#define CKLBLuaLibBIN_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBBinArray.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibBIN : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibBIN();\r\n\r\n\tstatic int bin_open\t\t(lua_State * L);\r\n\tstatic int bin_close\t(lua_State * L);\r\n\tstatic int bin_peek\t\t(lua_State * L);\r\n    static int bin_peek_u16\t(lua_State * L);\r\n    static int bin_peek_u32\t(lua_State * L);\r\n\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibBIN(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibBIN();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n\tvoid destroyResources\t();\r\n\tbool dumpObjects\t\t(IPlatformRequest& pForm);\r\n\r\n\t// -- lua free\r\n\tstatic CKLBBinArray* bin_open(const char* bin_asset);\r\n\tstatic void bin_close\t(CKLBBinArray* pBIN);\r\n\tstatic bool bin_peek\t(CKLBBinArray* pBIN, int offset, s32* out_value);\r\n\tstatic bool bin_peek_u16(CKLBBinArray* pBIN, int offset, u32* out_value, bool f_bigendian);\r\n\tstatic bool bin_peek_u32(CKLBBinArray* pBIN, int offset, u32* out_value, bool f_bigendian);\r\n};\r\n\r\n#endif // CKLBLuaLibBIN_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibCONV.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibCONV.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nstatic CKLBLuaLibCONV libdef(0);\r\n\r\nCKLBLuaLibCONV::CKLBLuaLibCONV(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibCONV::~CKLBLuaLibCONV() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibCONV::addLibrary()\r\n{\r\n\taddFunction(\"CONV_Lua2Json\",     CKLBLuaLibCONV::lua2json);\r\n\taddFunction(\"CONV_Json2Lua\",     CKLBLuaLibCONV::json2lua);\r\n\taddFunction(\"CONV_JsonFile2Lua\", CKLBLuaLibCONV::jsonfile2lua);\r\n}\r\n\r\n\r\nint\r\nCKLBLuaLibCONV::lua2json(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tlua.retValue(1);\r\n\tu32 size; // Ignored here.\r\n\tconst char * json = CKLBUtility::lua2json(lua,size);\r\n\tlua.pop(1);\r\n\tlua.retString(json);\r\n\tKLBDELETEA(json);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibCONV::json2lua(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tconst char * json = lua.getString(1);\r\n\tCKLBUtility::json2lua(lua, json, strlen(json));\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibCONV::jsonfile2lua(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tconst char * asset = lua.getString(1);\r\n\tIReadStream * pStream;\r\n\r\n\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\tpStream = pltf.openReadStream(asset, pltf.useEncryption());\r\n\tif(!pStream || pStream->getStatus() != IReadStream::NORMAL) {\r\n\t\tdelete pStream;\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tint size = pStream->getSize();\r\n\tu8 * buf = KLBNEWA(u8, size + 1);\r\n\tif(!buf) {\r\n\t\tdelete pStream;\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tpStream->readBlock((void *)buf, size);\r\n\tdelete pStream;\r\n\r\n\tbuf[size] = 0;\r\n\tconst char * json = (const char *)buf;\r\n\r\n\tCKLBUtility::json2lua(lua, json, size);\r\n\tKLBDELETEA(buf);\r\n\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibCONV.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibCONV_h\r\n#define CKLBLuaLibCONV_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibCONV : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibCONV();\r\npublic:\r\n\tCKLBLuaLibCONV(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibCONV();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int lua2json\t\t(lua_State * L);\r\n\tstatic int json2lua\t\t(lua_State * L);\r\n\tstatic int jsonfile2lua\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibCONV_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibDATA.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n#include \"CKLBLuaLibDATA.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nstatic CKLBLuaLibDATA libdef(0);\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* CKLBLuaLibDATA::ms_libRegStruct = CKLBLibRegistrator::getInstance()->add(\"LibDATA\", CLS_KLBDATASET);\r\n\r\nCKLBLuaLibDATA::CKLBLuaLibDATA(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibDATA::~CKLBLuaLibDATA() {}\r\n\r\nvoid\r\nCKLBLuaLibDATA::destroyResources()\r\n{\r\n\t CKLBDataHandler::clearAllSet();\r\n}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibDATA::addLibrary()\r\n{\r\n\taddFunction(\"DATA_create\",   CKLBLuaLibDATA::createData);\r\n\taddFunction(\"DATA_register\", CKLBLuaLibDATA::registData);\r\n\taddFunction(\"DATA_regtable\", CKLBLuaLibDATA::registTable);\r\n\taddFunction(\"DATA_delete\",\t CKLBLuaLibDATA::deleteData);\r\n}\r\n\r\nint\r\nCKLBLuaLibDATA::createData(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tif(lua.numArgs() != 1) {\r\n\t\tCKLBLuaEnv::getInstance().errMsg(\"ID is not given to DATA_create().\");\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tu32 dataSetID = lua.getInt(1);\r\n\tCKLBDataSet * pDataSet = CKLBDataHandler::createSet(dataSetID);\r\n\r\n\t// 戻り値は CKLBDataSet のポインタ\r\n\tlua.retPointer(pDataSet);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibDATA::registTable(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int count = 0;\r\n    bool result = true;\r\n    int argc = lua.numArgs();\r\n    if(argc != 2) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    \r\n    CKLBDataSet * pDataSet = (CKLBDataSet *)lua.getPointer(1);\r\n    if(!pDataSet) {\r\n        lua.retBoolean(false);\r\n        return 1;        \r\n    }\r\n    // CPFInterface& pfif = CPFInterface::getInstance();\r\n    // CKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n    CKLBAbstractAsset * pAsset;\r\n    u32 handle;\r\n    \r\n    lua.retValue(2);\r\n    lua.retNil();\r\n    while (lua.tableNext()) {\r\n        lua.retValue(-2);\r\n        \r\n        lua.retValue(-2);\r\n        lua.retNil();\r\n        const char * str[2];\r\n        int idx = 0;\r\n        while(lua.tableNext()) {\r\n            if(idx < 2) str[idx++] = lua.getString(-1);\r\n            lua.pop(1);\r\n        }\r\n        lua.pop(1);\r\n\r\n        const char * asset = str[0];\r\n        const char * name = str[1];\r\n\r\n\t\thandle = 0;\r\n\t\tpAsset = CKLBUtility::loadAsset(asset, 0, 0, true);\r\n\t\thandle = pDataSet->allocateHandle(pAsset, (char *)name);\r\n\t\tif(handle) {\r\n\t\t\tcount++;\r\n\t\t}\r\n        lua.pop(2);\r\n    }\r\n    lua.pop(1);\r\n        \r\n    if(result) {\r\n        lua.retInt(count);\r\n    } else {\r\n        lua.retBoolean(false);\r\n    }\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibDATA::registData(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n    if(lua.numArgs() != 3) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n\tCKLBDataSet * pDataSet = (CKLBDataSet *)lua.getPointer(1);\r\n\tconst char * name_asset = lua.getString(2);\r\n\tconst char * name_data  = lua.getString(3);\r\n    \r\n    if(!pDataSet) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n\r\n\t// CPFInterface& pfif = CPFInterface::getInstance();\r\n\t// CKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\tCKLBAbstractAsset * pAsset;\r\n\tu32 handle;\r\n\r\n\thandle = 0;\r\n\tpAsset = CKLBUtility::loadAsset(name_asset, 0, 0, true);\r\n\thandle = pDataSet->allocateHandle(pAsset, (char *)name_data);\r\n\tlua.retInt(handle);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibDATA::deleteData(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tCKLBDataSet * pDataSet = (CKLBDataSet *)lua.getPointer(1);\r\n    if(pDataSet) {\r\n\t\tCKLBDataHandler::destroySet(pDataSet);\r\n    }\r\n\treturn 0;\r\n}\r\n\r\nCKLBDataSet*\r\nCKLBLuaLibDATA::cmdCreateData(u32 dataSetID)\r\n{\r\n\tCKLBDataSet * pDataSet = CKLBDataHandler::createSet(dataSetID);\r\n\treturn pDataSet;\r\n}\r\n\r\nbool\r\nCKLBLuaLibDATA::cmdRegistData(CKLBDataSet * pDataSet, const char* name_asset, const char* name_data, u32* pReturnHandle)\r\n{\r\n\tif(pDataSet) {\r\n\t\t// CPFInterface& pfif = CPFInterface::getInstance();\r\n\t\t// CKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\t\tCKLBAbstractAsset * pAsset;\r\n\r\n\t\tu32 handle = 0;\r\n\t\tpAsset = CKLBUtility::loadAsset(name_asset, NULL, NULL, true);\r\n\t\thandle = pDataSet->allocateHandle(pAsset, (char *)name_data);\r\n\r\n\t\t*pReturnHandle = handle;\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\treturn false;\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibDATA.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibDATA_h\r\n#define CKLBLuaLibDATA_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBDataSet;\r\n\r\nclass CKLBLuaLibDATA : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibDATA();\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibDATA(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibDATA();\r\n\r\n\tvoid addLibrary();\r\n\tvoid destroyResources();\r\n\r\n\tstatic CKLBDataSet* cmdCreateData\t(u32 dataSetID);\r\n\tstatic bool\t\t\tcmdRegistData\t(CKLBDataSet * pDataSet, const char* name_asset, const char* name_data, u32* pReturnHandle);\r\n\tinline static void\tcmdDelete\t\t(CKLBDataSet * pDataSet) {\r\n\t\tif(pDataSet) {\r\n\t\t\tCKLBDataHandler::destroySet(pDataSet);\r\n\t\t}\r\n\t}\r\n\r\nprivate:\r\n\tstatic int createData\t(lua_State * L);\r\n\tstatic int registData\t(lua_State * L);\r\n\tstatic int registTable\t(lua_State * L);\r\n\tstatic int deleteData\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibDATA_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibDB.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibDB.h\"\r\n\r\nstatic CKLBLuaLibDB libdef(0);\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* CKLBLuaLibDB::ms_libRegStruct = CKLBLibRegistrator::getInstance()->add(\"LibDB\", CLS_KLBLUADB);\r\n\r\nCKLBLuaLibDB::CKLBLuaLibDB(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibDB::~CKLBLuaLibDB()\r\n{\r\n\t// クローズされていないDBがあればすべてクローズ\r\n\tCKLBLuaDB::closeAll();\r\n}\r\n\r\n// LuaLib全破棄時に、クローズされていないDBはすべてクローズ\r\nvoid\r\nCKLBLuaLibDB::destroyResources()\r\n{\r\n\tCKLBLuaDB::closeAll();\r\n}\r\n\r\n// 現在生成されているDBオブジェクトをダンプする\r\nbool\r\nCKLBLuaLibDB::dumpObjects(IPlatformRequest& pForm)\r\n{\r\n\tpForm.logging(\"[LuaLibDB]\");\r\n\treturn CKLBLuaDB::dumpAll();\r\n}\r\n\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibDB::addLibrary()\r\n{\r\n\taddFunction(\"DB_open\",  CKLBLuaLibDB::dbopen);\r\n\taddFunction(\"DB_close\", CKLBLuaLibDB::dbclose);\r\n\taddFunction(\"DB_query\", CKLBLuaLibDB::dbquery);\r\n\taddFunction(\"DB_closeAll\", CKLBLuaLibDB::dbcloseAll);\r\n}\r\n\r\nint\r\nCKLBLuaLibDB::dbopen(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1 || 3 < argc) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char * db_asset = lua.getString(1);\r\n\tbool b_write = (argc >= 2) ? lua.getBool(2) : true;\r\n\tbool b_create = (argc >= 3) ? lua.getBool(3) : true;\r\n\r\n\tCKLBLuaDB * pDB = dbopen(db_asset,b_write,b_create);\r\n\tif(pDB){\r\n\t\tlua.retPointer(pDB);\r\n\t}\r\n\telse {\r\n\t\tlua.retNil();\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibDB::dbclose(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\t// ポインタとして積まれたものがnilだった\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBLuaDB * pDB = (CKLBLuaDB *)lua.getPointer(1);\r\n\tKLBDELETE(pDB);\r\n\tlua.retNil();\r\n\treturn 1;\t// nilを返す\r\n}\r\n\r\nint\r\nCKLBLuaLibDB::dbcloseAll(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 0) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBLuaDB::closeAll();\r\n\tlua.retBool(true);\r\n\treturn 1;\t// nilを返す\r\n}\r\n\r\n\r\nint\r\nCKLBLuaLibDB::dbquery(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\t// ポインタとして積まれたものがnilだった\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBLuaDB * pDB = (CKLBLuaDB *)lua.getPointer(1);\r\n\tconst char * sql = lua.getString(2);\r\n\r\n\treturn pDB->query(&lua, sql);\t// 失敗のときはエラーコード(int)が、成功のときはテーブルが積まれる。\r\n}\r\n\r\nCKLBLuaDB* CKLBLuaLibDB::dbopen(const char* db_asset, bool b_write, bool b_create)\r\n{\r\n\tint flags = (b_write) ? SQLITE_OPEN_READWRITE : SQLITE_OPEN_READONLY;\r\n\tif(b_write && b_create) flags |= SQLITE_OPEN_CREATE;\r\n\r\n\tCKLBLuaDB * pDB = KLBNEWC(CKLBLuaDB, (db_asset, flags));\r\n\tif(!pDB || !pDB->state()) {\r\n\t\tKLBDELETE(pDB);\r\n\t\treturn NULL;\r\n\t}\r\n\tpDB->setName(db_asset);\t// asset名をDBの名前としてつける\r\n\treturn pDB;\r\n}\r\n\r\nvoid CKLBLuaLibDB::dbclose(CKLBLuaDB* pDB)\r\n{\r\n\tif(pDB != NULL)\r\n\t{\r\n\t\tKLBDELETE(pDB);\r\n\t}\r\n\telse{\r\n\t\t//Do nothing\r\n\t}\r\n}"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibDB.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibDB_h\r\n#define CKLBLuaLibDB_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLuaDB.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibDB : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibDB();\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\npublic:\r\n\tCKLBLuaLibDB\t\t\t(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibDB\t();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n\tvoid destroyResources\t();\r\n\tbool dumpObjects\t\t(IPlatformRequest& pForm);\r\n\r\n\t// lua-free\r\n\tstatic CKLBLuaDB*\tdbopen\t(const char* db_asset, bool b_write, bool b_create);\r\n\tstatic void\t\t\tdbclose\t(CKLBLuaDB* pDB);\r\nprivate:\r\n\r\n\tstatic int dbopen\t\t(lua_State * L);\r\n\tstatic int dbclose\t\t(lua_State * L);\r\n\tstatic int dbcloseAll\t(lua_State * L);\r\n\tstatic int dbquery\t\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibDB_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibDEBUG.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibDEBUG.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n\t{ \"DBG_M_SWITCH\",\tDBG_MENU::M_SWITCH },\r\n\t{ \"DBG_M_SELECT\",\tDBG_MENU::M_SELECT },\r\n\t{ \"DBG_M_NUMBER\",\tDBG_MENU::M_NUMBER },\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibDEBUG libdef(luaConst);\r\n\r\n/*static*/ DBG_MENU*\tCKLBLuaLibDEBUG::s_arrMenu\t= NULL;\r\n/*static*/ u32\t\t\tCKLBLuaLibDEBUG::s_maxCount\t= 0;\r\n/*static*/ u32\t\t\tCKLBLuaLibDEBUG::s_idx\t\t= 0;\r\n/*static*/ const char*  CKLBLuaLibDEBUG::s_caption\t= NULL;\r\n/*static*/ const char*  CKLBLuaLibDEBUG::s_key\t\t= NULL;\r\n\r\nCKLBLuaLibDEBUG::CKLBLuaLibDEBUG(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef){}\r\nCKLBLuaLibDEBUG::~CKLBLuaLibDEBUG() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibDEBUG::addLibrary()\r\n{\r\n\taddFunction(\"DEBUG_SetCallback\",\t\tCKLBLuaLibDEBUG::luaDBGSetCallback);\r\n\taddFunction(\"DEBUG_AddItem\",\t\t\tCKLBLuaLibDEBUG::luaDBGSetMenu);\r\n\taddFunction(\"DEBUG_DelItem\",\t\t\tCKLBLuaLibDEBUG::luaDBGRemoveMenu);\r\n}\r\n\r\nint\r\nCKLBLuaLibDEBUG::luaDBGRemoveMenu(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n#ifdef DEBUG_MENU\r\n\tconst char * key = lua.getString(1);\r\n\r\n\tCKLBDebugResource& dbg = CKLBDebugResource::getInstance();\r\n\tdbg.removeGroup(key);\r\n#endif\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibDEBUG::luaDBGSetMenu(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc != 3) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n#ifdef DEBUG_MENU\r\n\tconst char * caption = lua.getString(1);\r\n\tconst char * key = lua.getString(2);\r\n\r\n\tCKLBDebugResource& dbg = CKLBDebugResource::getInstance();\r\n\r\n\t// 3番目の引数として与えられたテーブルをスタック最上位に積みなおす\r\n\tlua.retValue(3);\r\n\r\n\t// その配列でデバッグメニューを登録する\r\n\tdbg.setGroupLua(caption, key, lua);\r\n\r\n\t// 積んであったテーブルをスタックから取り除く\r\n\tlua.pop(1);\r\n#endif\r\n\t// 戻り値はtrue\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibDEBUG::luaDBGSetCallback(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc > 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n#ifdef DEBUG_MENU\r\n\tCKLBDebugResource& dbg = CKLBDebugResource::getInstance();\r\n\tconst char * callback = 0;\r\n\tif(argc == 1) callback = lua.getString(1);\r\n\r\n\tdbg.setCallback(callback);\r\n#endif\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nvoid\r\nCKLBLuaLibDEBUG::startMenu(u32 maxCount, const char * caption, const char * key) \r\n{\r\n#ifdef DEBUG_MENU\r\n\tCKLBLuaLibDEBUG::s_maxCount\t= maxCount;\r\n\tCKLBLuaLibDEBUG::s_arrMenu\t= KLBNEWA(DBG_MENU, maxCount + 1);\r\n\tCKLBLuaLibDEBUG::s_caption\t= CKLBUtility::copyString(caption);\r\n\tCKLBLuaLibDEBUG::s_key\t\t= CKLBUtility::copyString(key);\r\n#endif\r\n}\r\n\r\n/*static*/\r\nvoid \r\nCKLBLuaLibDEBUG::addItem(u32 mode, const char* caption, const char* key, s32 min, s32 max, s32 value, const char** items, u32 itemsCount) \r\n{\r\n#ifdef DEBUG_MENU\r\n\tklb_assert(CKLBLuaLibDEBUG::s_idx <= CKLBLuaLibDEBUG::s_maxCount, \"Max Count reached.\");\r\n\t\r\n\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].mode\t\t= (DBG_MENU::MODE)mode;\r\n\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].caption\t= (caption) ? CKLBUtility::copyString(caption)\t: NULL;\r\n\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].key\t\t= (key)\t\t? CKLBUtility::copyString(key)\t\t: NULL;\r\n\tswitch(CKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].mode)\r\n\t{\r\n\tcase DBG_MENU::M_SWITCH:\r\n\t\t{\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].value\t= value;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].min\t\t= 0;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].max\t\t= 1;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].items\t= NULL;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase DBG_MENU::M_SELECT:\r\n\t\t{\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].value = 0;\r\n\t\t\tconst char ** disp = KLBNEWA(const char *, itemsCount);\r\n\t\t\tfor(u32 idx = 0; idx < itemsCount; idx++) {\r\n\t\t\t\tdisp[idx] = (items[idx]) ? CKLBUtility::copyString(items[idx]) : NULL;\r\n\t\t\t}\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].value\t= value;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].min\t\t= 0;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].max\t\t= itemsCount - 1;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].items\t= disp;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase DBG_MENU::M_NUMBER:\r\n\t\t{\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].min\t\t= min;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].max\t\t= max;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].value\t= value;\r\n\t\t\tCKLBLuaLibDEBUG::s_arrMenu[CKLBLuaLibDEBUG::s_idx].items\t= NULL;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\tCKLBLuaLibDEBUG::s_idx++;\r\n\r\n#endif\r\n}\r\n\r\n/*static*/\r\nvoid\r\nCKLBLuaLibDEBUG::endMenu() \r\n{\r\n#ifdef DEBUG_MENU\r\n\tCKLBDebugResource& dbg = CKLBDebugResource::getInstance();\r\n\tfor(u32 i = CKLBLuaLibDEBUG::s_idx; i < CKLBLuaLibDEBUG::s_maxCount + 1; ++i) {\r\n\t\tCKLBLuaLibDEBUG::s_arrMenu[i].caption = NULL;\r\n\t}\r\n\tdbg.addDebugItem(CKLBLuaLibDEBUG::s_caption, CKLBLuaLibDEBUG::s_key, CKLBLuaLibDEBUG::s_arrMenu);\r\n\tfor(u32 i = 0; i < CKLBLuaLibDEBUG::s_idx; i++) {\r\n\t\tKLBDELETEA(CKLBLuaLibDEBUG::s_arrMenu[i].items);\r\n\t}\r\n\tKLBDELETEA(CKLBLuaLibDEBUG::s_arrMenu);\r\n\tKLBDELETE(CKLBLuaLibDEBUG::s_caption);\r\n\tKLBDELETE(CKLBLuaLibDEBUG::s_key);\r\n\tCKLBLuaLibDEBUG::s_arrMenu\t= NULL;\r\n\tCKLBLuaLibDEBUG::s_caption\t= NULL;\r\n\tCKLBLuaLibDEBUG::s_key\t\t= NULL;\r\n\tCKLBLuaLibDEBUG::s_maxCount\t= 0;\r\n\tCKLBLuaLibDEBUG::s_idx\t\t= 0;\r\n#endif\r\n}\r\n\r\n/*static*/\r\nvoid\r\nCKLBLuaLibDEBUG::removeMenu(const char * key) \r\n{\r\n#ifdef DEBUG_MENU\r\n\tCKLBDebugResource& dbg = CKLBDebugResource::getInstance();\r\n\tdbg.removeGroup(key);\r\n#endif\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibDEBUG.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibDEBUG_h\r\n#define CKLBLuaLibDEBUG_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBDebugMenu.h\"\r\n\r\nclass CKLBLuaLibDEBUG : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibDEBUG();\r\npublic:\r\n\tCKLBLuaLibDEBUG(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibDEBUG();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic DBG_MENU*\ts_arrMenu;\r\n\tstatic u32\t\t\ts_maxCount;\r\n\tstatic u32\t\t\ts_idx;\r\n\tstatic const char*  s_caption;\r\n\tstatic const char*  s_key;\r\n\r\n\tstatic void startMenu\t(u32 maxCount, const char * caption, const char * key);\r\n\tstatic void addItem\t\t(u32 mode, const char* caption, const char* key, s32 min, s32 max, s32 value, const char** items, u32 itemsCount);\r\n\tstatic void endMenu\t\t();\r\n\tstatic void removeMenu\t(const char * key);\r\nprivate:\r\n\tstatic int luaDBGSetCallback\t(lua_State * L);\r\n\tstatic int luaDBGSetMenu\t\t(lua_State * L);\r\n\tstatic int luaDBGRemoveMenu\t\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibDEBUG_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibENG.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibENG.h\"\r\n\r\nstatic CKLBLuaLibENG libdef(0);\r\n\r\ns64  CKLBLuaLibENG::ms_timers[SCRIPT_TIMER_COUNT];\r\n\r\nCKLBLuaLibENG::CKLBLuaLibENG(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibENG::~CKLBLuaLibENG() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibENG::addLibrary()\r\n{\r\n    addFunction(\"ENG_getAppVersion\",    CKLBLuaLibENG::luaGetAppVersion );\r\n\taddFunction(\"ENG_isRelease\",\t\tCKLBLuaLibENG::luaIsRelease\t\t);\r\n\taddFunction(\"ENG_getPlatform\",\t\tCKLBLuaLibENG::luaGetPlatform\t);\r\n\taddFunction(\"ENG_getNanoTime\",\t\tCKLBLuaLibENG::luaGetNanoTime\t);\r\n\taddFunction(\"ENG_startNanoTime\",\tCKLBLuaLibENG::luaStartNanoTime\t);\r\n\taddFunction(\"ENG_endNanoTime\",\t\tCKLBLuaLibENG::luaEndNanoTime\t);\r\n\taddFunction(\"ENG_getFrameID\",\t\tCKLBLuaLibENG::luaGetFrameID\t);\r\n    addFunction(\"ENG_getElapsedTime\",   CKLBLuaLibENG::luaGetElapsedTime);\r\n    addFunction(\"ENG_forbidSleep\",      CKLBLuaLibENG::luaForbidSleep   );\r\n}\r\n\r\n\r\nint CKLBLuaLibENG::luaGetAppVersion(lua_State * L) {\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    lua_newtable(L);\r\n    lua_pushstring(L,pForm.getBundleVersion());\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibENG::luaStartNanoTime(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tint idx = 0;\r\n\tif(argc >= 1) {\r\n\t\tidx = lua.getInt(1);\r\n\t\tklb_assert(idx < SCRIPT_TIMER_COUNT, \"Timer index %i is out of range 0..%i\",idx, (SCRIPT_TIMER_COUNT-1));\r\n\t}\r\n\r\n\t// Read time last.\r\n\tms_timers[idx] = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\t// Return nothing.\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibENG::luaEndNanoTime(lua_State * L)\r\n{\r\n\t// Read time first\r\n\ts64 endTime = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tint idx = 0;\r\n\tif(argc >= 1) {\r\n\t\tidx = lua.getInt(1);\r\n\t\tklb_assert(idx < SCRIPT_TIMER_COUNT, \"Timer index %i is out of range 0..%i\",idx, (SCRIPT_TIMER_COUNT-1));\r\n\t}\r\n\ts64 deltaTime = endTime - ms_timers[idx];\r\n\tms_timers[idx]\t  = endTime;\t// ready for next call to end nanotime.\r\n\r\n\ts32 nano\t= (s32)(deltaTime % 1000000LL);\r\n\ts32 milli\t= (s32)(deltaTime / 1000000LL);\r\n\r\n\tlua.retInt(milli);\r\n\tlua.retInt(nano);\r\n\r\n\treturn 2;\r\n}\r\n\r\nint\r\nCKLBLuaLibENG::luaIsRelease(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 0) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tlua.retBoolean(isRelease());\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibENG::luaGetPlatform(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 0) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\tconst char * platform = pfif.getPlatform();\r\n\r\n\tlua.retString(platform);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibENG::luaGetNanoTime(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\ts64 nanotime = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\ts32 nano  = (s32)(nanotime % 1000000LL);\r\n\ts32 milli = (s32)(nanotime / 1000000LL);\r\n\r\n\tlua.retInt(milli);\r\n\tlua.retInt(nano);\r\n\r\n\treturn 2;\r\n}\r\n\r\nint\r\nCKLBLuaLibENG::luaGetFrameID(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tif(lua.numArgs() > 0) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\tu32 frameID = mgr.getFrameID();\r\n\r\n\tlua.retInt(frameID);\r\n\r\n\treturn 1;\r\n}\r\n\r\nint CKLBLuaLibENG::luaGetElapsedTime(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    \r\n\ts64 sec = CPFInterface::getInstance().platform().getElapsedTime();\r\n    \r\n\tlua.retInt((s32)sec);\r\n    return 1;\r\n}\r\n\r\nint CKLBLuaLibENG::luaForbidSleep(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tbool is_forbidden = lua.getBool(1);\r\n\tCPFInterface::getInstance().platform().forbidSleep(is_forbidden);\r\n\treturn 0;\r\n}\r\n\r\nbool CKLBLuaLibENG::isRelease()\r\n{\r\n\t#if defined(DEBUG_MEMORY) || defined(DEBUG_PERFORMANCE) || defined(DEBUG_LUAEDIT) || defined(DEBUG_RT_CHECK) || defined(DEBUG_MENU)\r\n\t\t/*\r\n\t\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\t\tpfif.logging(\"===== Engine Compile Flags =====\");\r\n\t\t#if defined(DEBUG_MEMORY) \r\n\t\tpfif.logging(\"DEBUG_MEMORY\");\r\n\t\t#endif\r\n\t\t#if defined(DEBUG_PERFORMANCE)\r\n\t\tpfif.logging(\"DEBUG_PERFORMANCE\");\r\n\t\t#endif\r\n\t\t#if defined(DEBUG_LUAEDIT)\r\n\t\tpfif.logging(\"DEBUG_LUAEDIT\");\r\n\t\t#endif\r\n\t\t#if defined(DEBUG_RT_CHECK)\r\n\t\tpfif.logging(\"DEBUG_RT_CHECK\");\r\n\t\t#endif\r\n\t\t#if defined(DEBUG_MENU)\r\n\t\tpfif.logging(\"DEBUG_MENU\");\r\n\t\t#endif\r\n\t\tpfif.logging(\"================================\");\r\n\t\t*/\r\n\t\treturn false;\r\n\t#else\r\n\t\treturn true;\r\n\t#endif\r\n}\r\n\r\nconst char* CKLBLuaLibENG::getPlatform()\r\n{\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\treturn pfif.getPlatform();\r\n}\r\n\r\nvoid CKLBLuaLibENG::getNanoTime(s32* milli, s32* nano)\r\n{\r\n\ts64 nanotime = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\t*nano  = nanotime % 1000000LL;\r\n\t*milli = (s32)(nanotime / 1000000LL);\r\n}\r\n\r\nvoid CKLBLuaLibENG::endNanoTime(int idx, s32* milli, s32* nano)\r\n{\r\n\ts64 endTime = CPFInterface::getInstance().platform().nanotime();\r\n\r\n\tklb_assert(idx < SCRIPT_TIMER_COUNT, \"Timer index %i is out of range 0..%i\",idx, (SCRIPT_TIMER_COUNT-1));\r\n\r\n\ts64 deltaTime = endTime - ms_timers[idx];\r\n\tms_timers[idx]\t  = endTime;\r\n\r\n\t*nano\t= (s32)(deltaTime % 1000000LL);\r\n\t*milli\t= (s32)(deltaTime / 1000000LL);\r\n}\r\n\r\nvoid CKLBLuaLibENG::startNanoTime(int idx) \r\n{\r\n\tms_timers[idx] = CPFInterface::getInstance().platform().nanotime();\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibENG.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibENG_h\r\n#define CKLBLuaLibENG_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBTask.h\"\r\n\r\nclass CKLBLuaLibENG : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibENG();\r\npublic:\r\n\tCKLBLuaLibENG(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibENG();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic bool\t\t\tisRelease\t\t();\r\n\tstatic const char*\tgetPlatform\t\t();\r\n\tstatic void\t\t\tgetNanoTime\t\t(s32* milli, s32* nano);\r\n\tstatic void\t\t\tstartNanoTime\t(int idx);\r\n\tstatic void\t\t\tendNanoTime\t\t(int idx, s32* milli, s32* nano);\r\n\tinline\r\n\tstatic u32\t\t\tgetFrameID\t\t() {\r\n\t\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\t\treturn mgr.getFrameID();\r\n\t}\r\n\r\n\r\nprivate:\r\n    static int luaGetAppVersion (lua_State * L);\r\n\tstatic int luaGetPlatform\t(lua_State * L);\r\n\tstatic int luaIsRelease\t\t(lua_State * L);\r\n\tstatic int luaGetNanoTime\t(lua_State * L);\r\n\tstatic int luaStartNanoTime\t(lua_State * L);\r\n\tstatic int luaEndNanoTime\t(lua_State * L);\r\n\tstatic int luaGetFrameID\t(lua_State * L);\r\n    static int luaGetElapsedTime(lua_State * L);\r\n    static int luaForbidSleep   (lua_State * L);\r\n\tenum {\r\n\t\tSCRIPT_TIMER_COUNT = 10,\r\n\t};\r\n\r\n\tstatic s64  ms_timers[SCRIPT_TIMER_COUNT];\r\n};\r\n\r\n#endif // CKLBLuaLibENG_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibFONT.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibFONT.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBLabelNode.h\"\r\n;\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n//\t{ \"DBG_M_SWITCH\",\tDBG_MENU::M_SWITCH },\r\n\t{ 0, 0 }\r\n};\r\n\r\nCKLBLuaLibFONT::FONTOBJ\t*\tCKLBLuaLibFONT::ms_begin\t= 0;\r\nCKLBLuaLibFONT::FONTOBJ\t*\tCKLBLuaLibFONT::ms_end\t\t= 0;\r\n\r\n\r\nstatic CKLBLuaLibFONT libdef(luaConst);\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* CKLBLuaLibFONT::ms_libRegStruct = CKLBLibRegistrator::getInstance()->add(\"LibFont\", CLS_KLBFONTOBJ);\r\n\r\nu32\r\nCKLBLuaLibFONT::FONTOBJ::getClassID()\r\n{\r\n\treturn CLS_KLBFONTOBJ;\r\n}\r\n\r\nCKLBLuaLibFONT::CKLBLuaLibFONT(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibFONT::~CKLBLuaLibFONT() \r\n{\r\n\tremove_all_font();\r\n}\r\n\r\n// 残りのFONTOBJをすべて破棄\r\nvoid\r\nCKLBLuaLibFONT::destroyResources()\r\n{\r\n\tremove_all_font();\r\n}\r\n\r\n// 現在存在するフォントオブジェクトのダンプ\r\nbool\r\nCKLBLuaLibFONT::dumpObjects(IPlatformRequest& pForm)\r\n{\r\n\tpForm.logging(\"[LuaLibFONT]\");\r\n\r\n\tFONTOBJ * fontobj = ms_begin;\r\n\tbool bResult = false;\r\n\twhile(fontobj) {\r\n\t\tpForm.logging(\"[FONT]<%p>: size=%d\", fontobj, fontobj->size);\r\n\t\tfontobj = fontobj->next;\r\n\t\tbResult = true;\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibFONT::addLibrary()\r\n{\r\n\taddFunction(\"FONT_load\", CKLBLuaLibFONT::luaFontLoad);\r\n\taddFunction(\"FONT_create\", CKLBLuaLibFONT::luaFontCreate);\r\n\taddFunction(\"FONT_release\", CKLBLuaLibFONT::luaFontRelease);\r\n\taddFunction(\"FONT_getTextInfo\", CKLBLuaLibFONT::luaGetTextInfo);\r\n\taddFunction(\"FONT_setDefaultFont\", CKLBLuaLibFONT::luaSetDefaultLabelFont);\r\n}\r\nCKLBLuaLibFONT::FONTOBJ *\r\nCKLBLuaLibFONT::create_font(int size, const char * fontname)\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tvoid * font = pForm.getFont(size, fontname);\r\n\tFONTOBJ * fontobj = (!font) ? NULL : KLBNEW(FONTOBJ);\r\n\tif(fontobj) {\r\n\t\tfontobj->font = font;\r\n\t\tfontobj->size = size;\r\n\t\tfontobj->prev = ms_end;\r\n\t\tfontobj->next = NULL;\r\n\t\tif(fontobj->prev) {\r\n\t\t\tfontobj->prev->next = fontobj;\r\n\t\t} else {\r\n\t\t\tms_begin = fontobj;\r\n\t\t}\r\n\t\tms_end = fontobj;\r\n\t}\r\n\treturn fontobj;\r\n}\r\n\r\nvoid\r\nCKLBLuaLibFONT::remove_font(FONTOBJ * fontobj)\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tpForm.deleteFont(fontobj->font);\r\n\tif(fontobj->prev) {\r\n\t\tfontobj->prev->next = fontobj->next;\r\n\t} else {\r\n\t\tms_begin = fontobj->next;\r\n\t}\r\n\tif(fontobj->next) {\r\n\t\tfontobj->next->prev = fontobj->prev;\r\n\t} else {\r\n\t\tms_end = fontobj->prev;\r\n\t}\r\n\tKLBDELETE(fontobj);\r\n}\r\n\r\nint\r\nCKLBLuaLibFONT::remove_all_font()\r\n{\r\n\tFONTOBJ * fontobj = ms_begin;\r\n\tint cnt = 0;\r\n\twhile(fontobj) {\r\n\t\tFONTOBJ * next = fontobj->next;\r\n\t\tremove_font(fontobj);\r\n\t\tfontobj = next;\r\n\t\tcnt++;\r\n\t}\r\n\treturn cnt;\r\n}\r\n\r\nint\r\nCKLBLuaLibFONT::luaFontCreate(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\t\r\n\tint size = lua.getInt(1);\r\n\tconst char * fontname = lua.getString(2);\r\n\tFONTOBJ * fontobj = create_font(size, fontname);\r\n\r\n\tlua.retPointer(fontobj);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibFONT::luaFontRelease(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tfor(int i = 1; i <= argc; i++) {\r\n\t\tFONTOBJ * fontobj = (FONTOBJ *)lua.getPointer(i);\r\n\t\tremove_font(fontobj);\r\n\t\tlua.retNil();\r\n\t}\r\n\treturn argc;\r\n}\r\n\r\n\r\nint CKLBLuaLibFONT::luaFontLoad(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tbool res = false;\r\n\tif (argc == 2) {\r\n\t\tconst char* fontName = lua.getString(1);\r\n\t\tconst char* fontFile = lua.getString(2);\r\n\t\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\t\t\r\n\t\tres = pfif.platform().registerFont(fontName,fontFile,true);\r\n\t}\r\n\r\n\tlua.retBool(res);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibFONT::luaGetTextInfo(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tFONTOBJ * fontobj = (FONTOBJ *)lua.getPointer(1);\r\n\tvoid * font = fontobj->font;\r\n\tconst char * string = lua.getString(2);\r\n\tSTextInfo info;\r\n\tpForm.getTextInfo(string, font, &info);\r\n\r\n\tlua.tableNew();\r\n\r\n\tlua.retString(\"width\");\r\n\tlua.retDouble(info.width);\r\n\tlua.tableSet();\r\n\r\n\tlua.retString(\"height\");\r\n\tlua.retDouble(info.height);\r\n\tlua.tableSet();\r\n\r\n\tlua.retString(\"ascent\");\r\n\tlua.retDouble(info.ascent);\r\n\tlua.tableSet();\r\n\r\n\tlua.retString(\"descent\");\r\n\tlua.retDouble(info.descent);\r\n\tlua.tableSet();\r\n\r\n\tlua.retString(\"top\");\r\n\tlua.retDouble(info.top);\r\n\tlua.tableSet();\r\n\r\n\tlua.retString(\"bottom\");\r\n\tlua.retDouble(info.bottom);\r\n\tlua.tableSet();\r\n\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibFONT::luaSetDefaultLabelFont(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tconst char * fontname = (lua.isNil(1)) ? NULL : lua.getString(1);\r\n\tbool bResult = CKLBLabelNode::setDefaultFont(fontname);\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibFONT.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibFONT_h\r\n#define CKLBLuaLibFONT_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibFONT : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibFONT();\r\npublic:\r\n\tstruct FONTOBJ : public CKLBObjectScriptable {\r\n\t\tFONTOBJ\t*\tprev;\r\n\t\tFONTOBJ\t*\tnext;\r\n\t\tint\t\t\tsize;\r\n\t\tvoid\t*\tfont;\r\n\r\n\t\tu32 getClassID();\r\n\t};\r\n\tstatic FONTOBJ * create_font(int size, const char * fontname);\r\n\r\n\tCKLBLuaLibFONT(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibFONT();\r\n\r\n\tvoid addLibrary\t\t\t();\r\n\tvoid destroyResources\t();\r\n\tbool dumpObjects\t\t(IPlatformRequest& pForm);\r\n\r\n\tstatic void remove_font\t\t(FONTOBJ * fontobj);\r\n\tstatic void cmdGetTextInfo\t(const char* str, void* font, STextInfo* pReturnInfo) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.getTextInfo(str, font, pReturnInfo);\r\n\t}\r\nprivate:\r\n\r\n\tstatic int remove_all_font\t();\r\n\r\n\tstatic int luaFontLoad\t\t(lua_State * L);\r\n\tstatic int luaFontCreate\t(lua_State * L);\r\n\tstatic int luaFontRelease\t(lua_State * L);\r\n\tstatic int luaGetTextInfo\t(lua_State * L);\r\n\tstatic int luaSetDefaultLabelFont(lua_State * L);\r\n\r\n\tstatic FONTOBJ\t*\tms_begin;\r\n\tstatic FONTOBJ\t*\tms_end;\r\n\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibFONT_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibGL.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibGL.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"TextureManagement.h\"\r\n#include \"CKLBTouchPad.h\"\r\n\r\nstatic CKLBLuaLibGL libdef(0);\r\n\r\nCKLBLuaLibGL::CKLBLuaLibGL(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibGL::~CKLBLuaLibGL() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibGL::addLibrary()\r\n{\r\n\taddFunction(\"GL_SetResolution\",\t\t\tCKLBLuaLibGL::luaGLSetResolution\t\t);\r\n\taddFunction(\"GL_GetHorizontalBorder\",\tCKLBLuaLibGL::luaGLGetHorizontalBorder\t);\r\n\taddFunction(\"GL_GetVerticalBorder\",\t\tCKLBLuaLibGL::luaGLGetVerticalBorder\t);\r\n\taddFunction(\"GL_ClearColor\",\t\t\tCKLBLuaLibGL::luaGLClearColor\t\t\t);\r\n\taddFunction(\"GL_UseImageOffset\",\t\tCKLBLuaLibGL::luaGLUseImageOffset\t\t);\r\n\taddFunction(\"GL_LoadAsQuarterTexture\",\tCKLBLuaLibGL::luaGLSetQuarter\t\t\t);\r\n\r\n\taddFunction(\"GL_CreateScreenAsset\",\t\tCKLBLuaLibGL::luaGLCreateScreenAsset\t);\r\n\taddFunction(\"GL_DoScreenShot\",\t\t\tCKLBLuaLibGL::luaGLDoScreenShot\t\t\t);\r\n\taddFunction(\"GL_FreeScreenAsset\",\t\tCKLBLuaLibGL::luaGLFreeScreenShot\t\t);\r\n\t\r\n\taddFunction(\"SG_GetGuardBand\",\t\t\tCKLBLuaLibGL::luaGetGuardBand\t\t\t);\r\n\taddFunction(\"SG_SetGuardBand\",\t\t\tCKLBLuaLibGL::luaSetGuardBand\t\t\t);\r\n\r\n\taddFunction(\"GL_Unloadtexture\",\t\t\tCKLBLuaLibGL::luaGLUnloadTexture\t\t);\r\n\taddFunction(\"GL_Reloadtexture\",\t\t\tCKLBLuaLibGL::luaGLReloadTexture\t\t);\r\n\taddFunction(\"GL_DoScreenShot\",\t\t\tCKLBLuaLibGL::luaGLDoScreenShot\t\t\t);\r\n}\r\n\r\n/*static*/\r\nint CKLBLuaLibGL::luaGLUnloadTexture (lua_State * L) {\r\n\tCLuaState lua(L);\r\n\tCKLBAssetManager::getInstance().unloadAsset();\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nint CKLBLuaLibGL::luaGLReloadTexture (lua_State * L) {\r\n\tCLuaState lua(L);\r\n\tCKLBAssetManager::getInstance().restoreAsset();\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nint CKLBLuaLibGL::luaGLGetHorizontalBorder\t(lua_State * L) {\r\n\tCLuaState lua(L);\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\tlua.retInt(draw.ox());\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nint CKLBLuaLibGL::luaGLGetVerticalBorder\t(lua_State * L) {\r\n\tCLuaState lua(L);\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\tlua.retInt(draw.oy());\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibGL::luaGLUseImageOffset(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tbool b = lua.getBool(1);\r\n\tuseOffsetForImages(b);\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibGL::luaGLClearColor(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 4) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tfloat r = lua.getFloat(1);\r\n\tfloat g = lua.getFloat(2);\r\n\tfloat b = lua.getFloat(3);\r\n\tfloat a = lua.getFloat(4);\r\n\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\tbool bResult = draw.setClearColor(r, g, b, a);\r\n\tlua.retBoolean(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibGL::luaGLSetResolution(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint width\t= lua.getInt(1);\r\n\tint height\t= lua.getInt(2);\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t\r\n\tif (argc >= 3) {\r\n\t\tdraw.setBorderless(lua.getBool(3));\r\n\t}\r\n\t\r\n\tif (argc == 4) {\r\n\t\tbool b = lua.getBool(4);\r\n\t\tCKLBTouchPadQueue::getInstance().setIgnoreOutside(b);\r\n\t} else {\r\n\t\tCKLBTouchPadQueue::getInstance().setIgnoreOutside(false);\r\n\t}\r\n\r\n\r\n\t// 論理解像度の指定を行う\r\n\tdraw.setLogicalResolution(width, height);\r\n\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\nint CKLBLuaLibGL::luaGetGuardBand(lua_State * L) {\r\n\tCLuaState lua(L);\r\n\t\r\n\tlua.retFloat(CKLBNode::s_fLeftBorder);\r\n\tlua.retFloat(CKLBNode::s_fRightBorder);\r\n\tlua.retFloat(CKLBNode::s_fTopBorder);\r\n\tlua.retFloat(CKLBNode::s_fBottomBorder);\r\n\r\n\treturn 4;\r\n}\r\n\r\nint CKLBLuaLibGL::luaSetGuardBand(lua_State * L) {\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 4) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tCKLBNode::s_fLeftBorder\t\t= lua.getFloat(1);\r\n\tCKLBNode::s_fRightBorder\t= lua.getFloat(2);\r\n\tCKLBNode::s_fTopBorder\t\t= lua.getFloat(3);\r\n\tCKLBNode::s_fBottomBorder\t= lua.getFloat(4);\r\n\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nbool\r\nCKLBLuaLibGL::GLCreateScreenAsset(const char* name)\r\n{\r\n\tIClientRequest& itf\t= CPFInterface::getInstance().client();\r\n\tint width\t\t\t= itf.getPhysicalScreenWidth();\r\n\tint height\t\t\t= itf.getPhysicalScreenHeight();\r\n\r\n\treturn createScreenAsset(name,width,height);\r\n}\r\n\r\nint\r\nCKLBLuaLibGL::luaGLCreateScreenAsset(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif (argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tconst char* name\t= lua.getString(1);\r\n\t\r\n\tlua.retBoolean(GLCreateScreenAsset(name));\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nbool\r\nCKLBLuaLibGL::GLDoScreenShot(const char* name)\r\n{\r\n\tIClientRequest& itf\t= CPFInterface::getInstance().client();\r\n\tint width\t\t\t= itf.getPhysicalScreenWidth();\r\n\tint height\t\t\t= itf.getPhysicalScreenHeight();\r\n\r\n\treturn doScreenShot(name, 0, 0, width, height, 0, 0);\r\n}\r\n\r\nint\r\nCKLBLuaLibGL::luaGLDoScreenShot(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char* name\t= lua.getString(1);\r\n\t\r\n\tlua.retBoolean(GLDoScreenShot(name));\r\n\treturn 1;\r\n}\r\n\r\n/*static*/\r\nvoid\r\nCKLBLuaLibGL::GLFreeScreenAsset(const char* name)\r\n{\r\n\tfreeScreenAsset(name);\r\n}\r\n\r\nint\r\nCKLBLuaLibGL::luaGLFreeScreenShot(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char* name\t= lua.getString(1);\r\n\tfreeScreenAsset(name);\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\n#include \"CKLBAsset.h\"\r\n\r\nint\r\nCKLBLuaLibGL::luaGLSetQuarter(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tbool val = lua.getBoolean(1);\r\n\r\n\t// Get \r\n\tKLBTextureAssetPlugin* pTexPlug = (KLBTextureAssetPlugin*)CKLBAssetManager::getInstance().getPlugin('T');\r\n\tif (pTexPlug) {\r\n\t\tpTexPlug->setQuarterTexture(val);\r\n\t}\r\n\r\n\tlua.retBoolean(pTexPlug != NULL);\r\n\treturn 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibGL.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibGL_h\r\n#define CKLBLuaLibGL_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nclass CKLBLuaLibGL : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibGL();\r\npublic:\r\n\tCKLBLuaLibGL(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibGL();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int luaGLSetResolution\t\t(lua_State * L);\r\n\tstatic int luaGLClearColor\t\t\t(lua_State * L);\r\n\tstatic int luaGLUseImageOffset\t\t(lua_State * L);\r\n\tstatic int luaGetGuardBand\t\t\t(lua_State * L);\r\n\tstatic int luaSetGuardBand\t\t\t(lua_State * L);\r\n\tstatic int luaGLCreateScreenAsset\t(lua_State * L);\r\n\tstatic int luaGLDoScreenShot\t\t(lua_State * L);\r\n\tstatic int luaGLFreeScreenShot\t\t(lua_State * L);\r\n\tstatic int luaGLGetHorizontalBorder\t(lua_State * L);\r\n\tstatic int luaGLGetVerticalBorder\t(lua_State * L);\r\n\tstatic int luaGLSetQuarter\t\t\t(lua_State * L);\r\n\tstatic int luaGLReloadTexture\t\t(lua_State * L);\r\n\tstatic int luaGLUnloadTexture\t\t(lua_State * L);\r\n\r\n\t\r\n\t\t\r\npublic:\r\n\tinline static bool GLClearColor(float r, float g, float b, float a) {\r\n\t\treturn CKLBDrawResource::getInstance().setClearColor(r, g, b, a);\r\n\t}\r\n\r\n\tinline static void GLSetResolution(int width, int height) {\r\n\t\tCKLBDrawResource::getInstance().setLogicalResolution(width, height);\r\n\t}\r\n\r\n\tinline static void SGGetGuardBand(float* leftBorder, float* rightBorder, float* topBorder, float* bottomBorder) {\r\n\t\t*leftBorder\t\t= CKLBNode::s_fLeftBorder;\r\n\t\t*rightBorder\t= CKLBNode::s_fRightBorder;\r\n\t\t*topBorder\t\t= CKLBNode::s_fTopBorder;\r\n\t\t*bottomBorder\t= CKLBNode::s_fBottomBorder;\r\n\t}\r\n\tinline static void SGSetGuardBand(float  leftBorder, float  rightBorder, float  topBorder, float  bottomBorder) {\r\n\t\tCKLBNode::s_fLeftBorder\t\t= leftBorder;\r\n\t\tCKLBNode::s_fRightBorder\t= rightBorder;\r\n\t\tCKLBNode::s_fTopBorder\t\t= topBorder;\r\n\t\tCKLBNode::s_fBottomBorder\t= bottomBorder;\r\n\t}\r\n\r\n\tstatic bool GLCreateScreenAsset\t(const char* name);\r\n\tstatic bool GLDoScreenShot\t\t(const char* name);\r\n\tstatic void GLFreeScreenAsset\t(const char* name);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibGL_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibHASH.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"hash_sha1.h\"\r\n#include \"CKLBLuaLibHASH.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nstatic CKLBLuaLibHASH libdef(0);\r\n\r\nCKLBLuaLibHASH::CKLBLuaLibHASH(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibHASH::~CKLBLuaLibHASH() {}\r\n\r\n// Lua関数の追加\r\n\tvoid\r\nCKLBLuaLibHASH::addLibrary()\r\n{\r\n\taddFunction(\"HASH_SHA1\",     CKLBLuaLibHASH::luaHashSha1);\r\n}\r\n\r\n\r\n\tint\r\nCKLBLuaLibHASH::luaHashSha1(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tconst char * src = lua.getString(1);\r\n\tchar hash_buf[41];\r\n\tSHA1Context sha;\r\n\tSHA1Reset(&sha);\r\n\tSHA1Input(&sha, reinterpret_cast<unsigned char const*>(src), strlen(src));\r\n\tif (!SHA1Result(&sha)) {\r\n\t\treturn 0;\r\n\t}\r\n\tsprintf(hash_buf, \"%08X%08X%08X%08X%08X\", sha.Message_Digest[0], sha.Message_Digest[1], sha.Message_Digest[2], sha.Message_Digest[3], sha.Message_Digest[4]);\r\n\tlua.retString(hash_buf);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibHASH.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibHASH_h\r\n#define CKLBLuaLibHASH_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibHASH : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibHASH();\r\npublic:\r\n\tCKLBLuaLibHASH(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibHASH();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\tstatic int luaHashSha1(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibHASH_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibKEY.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaLibKEY.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#include \"CKLBLuaLibKEY.h\"\r\n#include \"CKLBNetAPIKeyChain.h\"\r\n\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n    { 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibKEY libdef(luaConst);\r\n\r\nCKLBLuaLibKEY::CKLBLuaLibKEY(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibKEY::~CKLBLuaLibKEY() {}\r\n\r\nvoid\r\nCKLBLuaLibKEY::addLibrary()\r\n{\r\n    addFunction(\"KEY_genUserID\",\tCKLBLuaLibKEY::luaGenUserID    );\r\n    addFunction(\"KEY_genUserPW\",\tCKLBLuaLibKEY::luaGenUserPW    );\r\n    addFunction(\"KEY_setSecureID\", \tCKLBLuaLibKEY::luaSetKeyChainID);\r\n    addFunction(\"KEY_setSecurePW\", \tCKLBLuaLibKEY::luaSetKeyChainPW);\r\n    addFunction(\"KEY_getSecureID\", \tCKLBLuaLibKEY::luaGetKeyChainID);\r\n    addFunction(\"KEY_getSecurePW\", \tCKLBLuaLibKEY::luaGetKeyChainPW);\r\n\r\n    addFunction(\"KEY_delSecureID\", \tCKLBLuaLibKEY::luaDelKeyChainID);\r\n    addFunction(\"KEY_delSecurePW\", \tCKLBLuaLibKEY::luaDelKeyChainPW);\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaGenUserID(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc > 0) {\r\n        lua.retNil();\r\n        return 1;\r\n    }\r\n    char buf[1024];\r\n    int len = genUserID(buf, 1024);\r\n    if(!len) {\r\n        lua.retNil();\r\n    } else {\r\n        lua.retString(buf);\r\n    }\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaGenUserPW(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retNil();\r\n        return 1;\r\n    }\r\n    const char * user_id = lua.getString(1);\r\n    char buf[1024];\r\n    int len = genUserPW(user_id, buf, 1024);\r\n    if(!len) {\r\n        lua.retNil();\r\n    } else {\r\n        lua.retString(buf);\r\n    }\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaSetKeyChainID(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 2) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    const char * service_name = lua.getString(1);\r\n    const char * user_id = lua.getString(2);\r\n    bool result = setSecureID(service_name, user_id);\r\n    lua.retBoolean(result);    \r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaSetKeyChainPW(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 2) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    const char * service_name = lua.getString(1);\r\n    const char * passwd = lua.getString(2);\r\n    bool result = setSecurePW(service_name, passwd);\r\n    lua.retBoolean(result);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaGetKeyChainID(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    const char * service_name = lua.getString(1);\r\n    char buf[1024];\r\n    int len = getSecureID(service_name, buf, 1024);\r\n    if(!len) {\r\n        lua.retNil();\r\n    } else {\r\n        lua.retString(buf);\r\n    }\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaGetKeyChainPW(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    const char * service_name = lua.getString(1);\r\n    char buf[1024];\r\n    int len = getSecurePW(service_name, buf, 1024);\r\n    if(!len) {\r\n        lua.retNil();\r\n    } else {\r\n        lua.retString(buf);\r\n    }\r\n    return 1;    \r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaDelKeyChainID(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char * service_name = lua.getString(1);\r\n\tbool bResult = delSecureID(service_name);\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibKEY::luaDelKeyChainPW(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char * service_name = lua.getString(1);\r\n\tbool bResult = delSecurePW(service_name);\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibKEY.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaLibKEY.h\r\n//  GameEngine\r\n//\r\n\r\n#ifndef CKLBLuaLibKEY_h\r\n#define CKLBLuaLibKEY_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibKEY : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibKEY();\r\npublic:\r\n    \r\n\tCKLBLuaLibKEY(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibKEY();\r\n    \r\n\tvoid addLibrary();\r\n\r\n\tinline static \r\n\tint genUserID(char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().genUserID(buf, bufSize);\r\n\t}\r\n\r\n\tinline static\r\n\tint genUserPW(const char* user_id, char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().genUserPW(user_id, buf, bufSize);\r\n\t}\r\n\r\n\tinline static \r\n\tbool setSecureID(const char* service_name, const char* user_id) {\r\n\t\treturn CPFInterface::getInstance().platform().setSecureDataID(service_name, user_id);\r\n\t}\r\n\r\n\tinline static\r\n\tbool setSecurePW(const char* service_name, const char* passwd) {\r\n\t\treturn CPFInterface::getInstance().platform().setSecureDataPW(service_name, passwd);\r\n\t}\r\n\r\n\tinline static\r\n\tint getSecureID(const char* service_name, char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().getSecureDataID(service_name, buf, bufSize);\r\n\t}\r\n\r\n\tinline static \r\n\tint getSecurePW(const char* service_name, char* buf, u32 bufSize) {\r\n\t\treturn CPFInterface::getInstance().platform().getSecureDataPW(service_name, buf, bufSize);\r\n\t}\r\n    \r\n\tinline static\r\n\tbool delSecureID(const char * service_name) {\r\n\t\treturn CPFInterface::getInstance().platform().delSecureDataID(service_name);\r\n\t}\r\n\r\n\tinline static\r\n\tbool delSecurePW(const char * service_name) {\r\n\t\treturn CPFInterface::getInstance().platform().delSecureDataPW(service_name);\r\n\t}\r\n\r\nprivate:\r\n    static int luaGenUserID\t\t(lua_State * L);\r\n    static int luaGenUserPW\t\t(lua_State * L);\r\n\r\n    static int luaSetKeyChainID\t(lua_State * L);\r\n    static int luaSetKeyChainPW\t(lua_State * L);\r\n\r\n    static int luaGetKeyChainID\t(lua_State * L);\r\n    static int luaGetKeyChainPW\t(lua_State * L);\r\n\r\n\tstatic int luaDelKeyChainID\t(lua_State * L);\r\n\tstatic int luaDelKeyChainPW\t(lua_State * L);\r\n};\r\n\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibLANG.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibLANG.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nstatic ILuaFuncLib::DEFCONST defcmd[] = {\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibLANG libdef(defcmd);\r\n\r\nCKLBLuaLibLANG::CKLBLuaLibLANG(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibLANG::~CKLBLuaLibLANG() {}\r\n\r\nvoid CKLBLuaLibLANG::addLibrary()\r\n{\r\n\taddFunction(\"LANG_addString\",\t\tCKLBLuaLibLANG::luaAddString);\r\n\taddFunction(\"LANG_getString\",\t\tCKLBLuaLibLANG::luaGetString);\r\n\taddFunction(\"LANG_removeString\",\tCKLBLuaLibLANG::luaRemoveString);\r\n\taddFunction(\"LANG_useDB\",\t\t\tCKLBLuaLibLANG::luaUseDB);\r\n\taddFunction(\"LANG_loadGroup\",\t\tCKLBLuaLibLANG::luaLoadGroup);\r\n}\r\n\r\nint\r\nCKLBLuaLibLANG::luaUseDB(lua_State * L) {\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\t/*\r\n\tbool\tsetupDB\t\t\t(const char* dbFile,\r\n\t\t\t\t\t\t\t const char* tableName, \r\n\t\t\t\t\t\t\t const char* keyField, \r\n\t\t\t\t\t\t\t const char* valueField,\r\n\t\t\t\t\t\t\t [OPT] const char* groupField\t */\r\n\tif(argc < 4) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char * dbFile = lua.getString(1);\r\n\tconst char * table  = lua.getString(2);\r\n\tconst char * keyF   = lua.getString(3);\r\n\tconst char * valueF = lua.getString(4);\r\n\tconst char * groupF = (argc == 5) ? lua.getString(5) : NULL;\r\n\r\n\tbool bResult = useDB(dbFile, table, keyF, valueF, groupF);\r\n\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibLANG::luaLoadGroup(lua_State * L) {\r\n\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char* groupID = lua.getString(1);\r\n\r\n\tbool bResult = loadGroup(groupID);\r\n\t\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibLANG::luaAddString(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char * id = lua.getString(1);\r\n\tconst char * string = lua.getString(2);\r\n\r\n\tbool bResult = addString(id, string);\r\n\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibLANG::luaGetString(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tconst char * id = lua.getString(1);\r\n\r\n\tconst char * string = getString(id);\r\n\r\n\tif(string) {\r\n\t\tlua.retString(string);\r\n\t} else {\r\n\t\tlua.retNil();\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibLANG::luaRemoveString(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tconst char * id = lua.getString(1);\r\n\r\n\tremoveString(id);\r\n\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibLANG.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibLANG_h\r\n#define CKLBLuaLibLANG_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBLanguageDatabase.h\"\r\n\r\nclass CKLBLuaLibLANG : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibLANG();\r\npublic:\r\n\tCKLBLuaLibLANG(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibLANG();\r\n\r\n\tvoid addLibrary();\r\n\t\r\n\tinline static\r\n\tbool addString(const char* id, const char* str) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().addString(id, str);\r\n\t}\r\n\r\n\tinline static\r\n\tconst char* getString(const char* id) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().getString(id);\r\n\t}\r\n\t\r\n\tinline static\r\n\tvoid removeString(const char* id) {\r\n\t\tCKLBLanguageDatabase& ldb = CKLBLanguageDatabase::getInstance();\r\n\t\tldb.removeString(id);\r\n\t}\r\n\r\n\tinline static\r\n\tbool useDB(const char* dbFile, const char* table, const char* keyF, const char* valueF, const char* groupF) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().setupDB(dbFile, table, keyF, valueF, groupF);\r\n\t}\r\n\r\n\tinline static\r\n\tbool loadGroup(const char* groupId) {\r\n\t\treturn CKLBLanguageDatabase::getInstance().preLoadGroup(groupId);\r\n\t}\r\n\r\nprivate:\r\n\tstatic int luaAddString\t\t(lua_State * L);\r\n\tstatic int luaGetString\t\t(lua_State * L);\r\n\tstatic int luaRemoveString\t(lua_State * L);\r\n\tstatic int luaUseDB\t\t\t(lua_State * L);\r\n\tstatic int luaLoadGroup\t\t(lua_State * L);\r\n};\r\n\r\n#endif // CKLBLiaLibUI_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibMatrix.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibMatrix.h\"\r\n#include <math.h>\r\n#include \"CKLBUtility.h\"\r\n;\r\n#define EPSILON (1e-5f)\r\n\r\n// 大域変数としてインスタンスを作ることで、登録リストに追加される。\r\n/* not used\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n\t{ 0, 0 }\r\n};\r\n*/\r\n\r\nstatic CKLBLuaLibMatrix libdef(0);\r\n\r\n\r\nCKLBLuaLibMatrix::MATRIX\t*\tCKLBLuaLibMatrix::m_pBegin = NULL;\r\nCKLBLuaLibMatrix::MATRIX\t*\tCKLBLuaLibMatrix::m_pEnd   = NULL;\r\n\r\n\r\nCKLBLuaLibMatrix::CKLBLuaLibMatrix(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibMatrix::~CKLBLuaLibMatrix()\r\n{\r\n\tdelAllMatrix();\r\n}\r\n\r\n// LuaLib全破棄時にはすべてのMatrix objectを破棄する\r\nvoid\r\nCKLBLuaLibMatrix::destroyResources()\r\n{\r\n\tdelAllMatrix();\r\n}\r\n\r\n// 全てのmatrixオブジェクトをダンプする\r\nbool\r\nCKLBLuaLibMatrix::dumpObjects(IPlatformRequest& pForm)\r\n{\r\n\tpForm.logging(\"[LuaLibMatrix]\");\r\n\r\n\tMATRIX * pMat = m_pBegin;\r\n\tbool bResult = false;\r\n\t// 現存するすべてを破棄する\r\n\twhile(pMat) {\r\n\t\tpForm.logging(\"[Matrix]<%p>: %s\", pMat, (pMat->name) ? pMat->name : \"(no name)\");\r\n\t\tpMat = pMat->next;\r\n\t\tbResult = true;\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibMatrix::addLibrary()\r\n{\r\n\t// matrixに名前をつける\r\n\taddFunction(\"GEO_SetMatrixName\", CKLBLuaLibMatrix::luaSetMatrixName);\r\n\t// matrixの生成/破棄/複製/変換/復元\r\n\taddFunction(\"GEO_CreateMatrix\", CKLBLuaLibMatrix::luaCreateMatrix);\r\n\taddFunction(\"GEO_DeleteMatrix\", CKLBLuaLibMatrix::luaDeleteMatrix);\r\n\taddFunction(\"GEO_RevertMatrix\", CKLBLuaLibMatrix::luaRevertMatrix);\r\n\taddFunction(\"GEO_CopyMatrix\", CKLBLuaLibMatrix::luaCopyMatrix);\r\n\taddFunction(\"GEO_OverwriteMatrix\", CKLBLuaLibMatrix::luaOverwriteMatrix);\r\n\taddFunction(\"GEO_DeleteAllMatrix\", CKLBLuaLibMatrix::luaDeleteAllMatrix);\r\n\r\n\t// 二つ以上のmatrixを順次掛け合わせ、結果を第一引数のmatrix objectに書き込む\r\n\taddFunction(\"GEO_MulMatrix\", CKLBLuaLibMatrix::luaMulMatrix);\r\n\r\n\t// 逆行列を作る\r\n\taddFunction(\"GEO_InverseMatrix\", CKLBLuaLibMatrix::luaInverseMatrix);\r\n\r\n\t// 転置行列を作る\r\n\taddFunction(\"GEO_TransposedMatrix\", CKLBLuaLibMatrix::luaTransposedMatrix);\r\n\r\n\t// vectorにmatrixをかける\r\n\taddFunction(\"GEO_VecConv\", CKLBLuaLibMatrix::luaMulMatVector);\r\n\taddFunction(\"GEO_VecArrayConv\", CKLBLuaLibMatrix::luaMulMatVecArray);\r\n\r\n\r\n\r\n}\r\n\r\n\r\nvoid\r\nCKLBLuaLibMatrix::getMatrix(CLuaState& lua, MATRIX * ret)\r\n{\r\n\t// 最上位には対象の配列が積んである\r\n\tfor(int idx = 0; idx < 16; idx++) {\r\n\t\tlua.retInt(idx + 1);\t\t\t// Luaテーブル上のindexを積む\r\n\t\tlua.tableGet();\t\t\t\t\t// 対応する値を取得する\r\n\t\tfloat val = lua.getFloat(-1);\r\n\t\tret->m[idx] = val;\r\n\t\tlua.pop(1);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBLuaLibMatrix::setMatrix(CLuaState& lua, MATRIX * mat)\r\n{\r\n\t// 最上位に対象の配列を作る\r\n\tlua.tableNew();\r\n\tfor(int idx = 0; idx < 16; idx++) {\r\n\t\t// key として index 値を積む\r\n\t\tlua.retInt(idx + 1);\r\n\t\t// 値を積む\r\n\t\tlua.retDouble(mat->m[idx]);\r\n\t\t// 値を設定する\r\n\t\tlua.tableSet();\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBLuaLibMatrix::getVector(CLuaState& lua, VECTOR * vec)\r\n{\r\n\t// Luaスタックトップにはvectorテーブルが積んである\r\n\tfor(int n = 0; n < 4; n++) {\r\n\t\tlua.retInt(n + 1); lua.tableGet(); vec->v[n] = lua.getFloat(-1); lua.pop(1);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBLuaLibMatrix::setVector(CLuaState& lua, VECTOR * vec)\r\n{\r\n\tlua.tableNew();\t\t// ベクトル用のテーブル\r\n\tfor(int n = 0; n < 4; n++) {\r\n\t\tlua.retInt(n + 1); lua.retDouble(vec->v[n]); lua.tableSet();\r\n\t}\r\n}\r\n\r\nint\r\nCKLBLuaLibMatrix::getVectorNums(CLuaState& lua)\r\n{\r\n\tint idx = 0;\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint v = lua.getInt(-1);\r\n\t\tif(v > idx) idx = v;\r\n\t\tlua.pop(2);\r\n\t}\r\n\treturn idx;\t// 最大のindex値\r\n}\r\n\r\nvoid\r\nCKLBLuaLibMatrix::getVectorArray(CLuaState& lua, VECTOR * vec, int /*nums*/)\r\n{\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint idx = lua.getInt(-1) - 1;\r\n\r\n\t\tlua.retValue(-2);\r\n\t\tgetVector(lua, &vec[idx]);\r\n\r\n\t\tlua.pop(3);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBLuaLibMatrix::setVectorArray(CLuaState& lua, VECTOR * vec, int nums)\r\n{\r\n\tlua.tableNew();\t\t// ベクトル配列用のテーブル\r\n\r\n\tfor(int idx = 0; idx < nums; idx++) {\r\n\t\tlua.retInt(idx + 1);\t// ベクトル配列中のindexを指定する\r\n\r\n\t\t// ベクトルの値をスタック上に積む\r\n\t\tsetVector(lua, &vec[idx]);\r\n\r\n\t\t// この時点で、ベクトル配列のindexと、ベクトルがスタックに積まれている\r\n\t\tlua.tableSet();\t// ベクトル配列にベクトルを設定する\r\n\t}\r\n\t// 一通りの設定が終わり、ベクトル配列テーブルがスタック上に積まれた状態になる。\r\n}\r\n\r\n// matrix同士を乗算する\r\nvoid\r\nCKLBLuaLibMatrix::mulMatrix(MATRIX * ret, MATRIX * a, MATRIX * b)\r\n{\r\n\tfor(int y = 0; y < 4; y++) {\r\n\t\tfor(int x = 0; x < 4; x++) {\r\n\t\t\tret->m[y*4+x] = 0.0f;\r\n\t\t\tfor(int n = 0; n < 4; n++) {\r\n\t\t\t\tret->m[y*4+x] += a->m[y*4+n] * b->m[n*4+x];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// vector単品にmatrixを乗算する\r\nvoid\r\nCKLBLuaLibMatrix::mulMatVector(VECTOR * ret, VECTOR * vec, MATRIX * mat)\r\n{\r\n\tfor(int n = 0; n < 4; n++) {\r\n\t\tret->v[n] = 0.0f;\r\n\t\tfor(int m = 0; m < 4; m++) {\r\n\t\t\tret->v[n] += vec->v[m] * mat->m[m*4+n];\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// vectorの配列にmatrixを乗算する\r\nvoid\r\nCKLBLuaLibMatrix::mulMatVecArray(int nums, VECTOR * ret, VECTOR * arr, MATRIX * mat)\r\n{\r\n\tfor(int idx = 0; idx < nums; idx++) {\r\n\t\tmulMatVector(&ret[idx], &arr[idx], mat);\r\n\t}\r\n}\r\n\r\n// matrix を inverse matrix に変換する\r\nbool\r\nCKLBLuaLibMatrix::inverseMatrix(MATRIX * mat)\r\n{\r\n\tfloat * A = mat->m;\r\n\tfloat B[16];\r\n\tint x, y, z;\t\r\n\r\n\tfor(x = 0; x < 16; x++) B[x] = (x % 5) ? 0.0f : 1.0f;\r\n\r\n\tfor(y = 0; y < 4; y++) {\r\n\r\n\t\tfloat n = A[4 * y + y];\r\n\t\tif(fabs(n) < EPSILON) return false;\r\n\r\n\t\tfor(x = 0; x < 4; x++) {\r\n\t\t\tA[4*y+x] /= n;\r\n\t\t\tB[4*y+x] /= n;\r\n\t\t}\r\n\t\tfor(x = 0; x < 4; x++) {\r\n\t\t\tif(x == y) continue;\r\n\t\t\tn = A[4*x+y];\r\n\t\t\tfor(z = 0; z < 4; z++) {\r\n\t\t\t\tA[4*x+z] -= A[4*y+z] * n;\r\n\t\t\t\tB[4*x+z] -= B[4*y+z] * n;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// 問題がなければ\r\n\tfor(int i = 0; i < 16; i++) {\r\n\t\tmat->m[i] = B[i];\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nCKLBLuaLibMatrix::MATRIX *\r\nCKLBLuaLibMatrix::newMatrix()\r\n{\r\n\tMATRIX * pMat = KLBNEW(MATRIX);\r\n\tif(!pMat) return NULL;\r\n\tpMat->name = NULL;\r\n\tpMat->prev = m_pEnd;\r\n\tpMat->next = NULL;\r\n\tif(pMat->prev) {\r\n\t\tpMat->prev->next = pMat;\r\n\t} else {\r\n\t\tm_pBegin = pMat;\r\n\t}\r\n\tm_pEnd = pMat;\r\n\treturn pMat;\r\n}\r\n\r\nvoid\r\nCKLBLuaLibMatrix::delMatrix(MATRIX * pMat)\r\n{\r\n\tif(!pMat) return;\r\n\r\n\tif(pMat->prev) {\r\n\t\tpMat->prev->next = pMat->next;\r\n\t} else {\r\n\t\tm_pBegin = pMat->next;\r\n\t}\r\n\tif(pMat->next) {\r\n\t\tpMat->next->prev = pMat->prev;\r\n\t} else {\r\n\t\tm_pEnd = pMat->prev;\r\n\t}\r\n\tKLBDELETEA(pMat->name);\r\n\tKLBDELETE(pMat);\r\n}\r\n\r\nint\r\nCKLBLuaLibMatrix::delAllMatrix()\r\n{\r\n\tMATRIX * pMat = m_pBegin;\r\n\tMATRIX * pNext;\r\n\tint cnt = 0;\r\n\t// 現存するすべてを破棄する\r\n\twhile(pMat) {\r\n\t\tpNext = pMat->next;\r\n\t\tdelMatrix(pMat);\r\n\t\tcnt++;\r\n\t\tpMat = pNext;\r\n\t}\r\n\treturn cnt;\r\n}\r\n\r\nCKLBLuaLibMatrix::MATRIX *\r\nCKLBLuaLibMatrix::getMatPointer(CLuaState& lua, int index)\r\n{\r\n\tif(lua.isNil(index)) return NULL;\r\n\treturn (MATRIX *)lua.getPointer(index);\r\n}\r\n\r\n// matrix object に名前を与える\r\nint\r\nCKLBLuaLibMatrix::luaSetMatrixName(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tMATRIX * pMatrix = (MATRIX *)lua.getPointer(1);\r\n\tconst char * name = (lua.isNil(2)) ? NULL : lua.getString(2);\r\n\tconst char * newname = (name) ? CKLBUtility::copyString(name) : NULL;\r\n\tbool bResult = false;\r\n\tif(newname || (!newname && !name)) {\r\n\t\tif(pMatrix->name) KLBDELETEA(pMatrix->name);\r\n\t\tpMatrix->name = newname;\r\n\t\tbResult = true;\r\n\t}\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\n\r\n// matrix object を作る\r\nint\r\nCKLBLuaLibMatrix::luaCreateMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\t// 引数が無い場合、単位行列を一つ生成して返す。\r\n\tif(argc == 0) {\r\n\t\tMATRIX * pMatrix = newMatrix();\r\n\t\t// 初期値として単位行列を生成する\r\n\t\tfor(int i = 0; i < 16; i++) {\r\n\t\t\tpMatrix->m[i] = ((i % 4) == (i / 4)) ? 1.0f : 0.0f;\r\n\t\t}\r\n\t\tlua.retPointer(pMatrix);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tfor(int i = 1; i <= argc; i++) {\r\n\t\tMATRIX * pMatrix = newMatrix();\r\n\t\t// matrix object が作れなければ nil を返す\r\n\t\tif(!pMatrix) {\r\n\t\t\tlua.retNil();\r\n\t\t} else {\r\n\t\t\tif(lua.isNil(i)) {\r\n\t\t\t\t// 積まれたものがnilだったら単位行列を生成\r\n\t\t\t\tfor(int i = 0; i < 16; i++) {\r\n\t\t\t\t\tpMatrix->m[i] = (!(i % 5)) ? 1.0f : 0.0f;\r\n\t\t\t\t}\r\n\t\t\t} else {\t\r\n\t\t\t\t// Luaテーブルとみなし、初期値を設定する\r\n\t\t\t\tlua.retValue(i);\r\n\t\t\t\tgetMatrix(lua, pMatrix);\r\n\t\t\t\tlua.pop(1);\r\n\t\t\t}\r\n\t\t\t// 生成したmatrix objectのポインタを返す\r\n\t\t\tlua.retPointer(pMatrix);\r\n\t\t}\r\n\t}\r\n\treturn argc;\r\n}\r\n\r\n// matrix object を破棄する\r\nint\r\nCKLBLuaLibMatrix::luaDeleteMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tfor(int i = 1; i <=  argc; i++) {\r\n\t\tMATRIX * pMat = getMatPointer(lua, i);\r\n\t\tdelMatrix(pMat);\r\n\t\tlua.retNil();\r\n\t}\r\n\treturn argc;\r\n}\r\n\r\n// matrix object をLuaテーブルに変換する\r\nint\r\nCKLBLuaLibMatrix::luaRevertMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tMATRIX * pMat = getMatPointer(lua, 1);\r\n\tif(!pMat) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tsetMatrix(lua, pMat);\r\n\r\n\treturn 1;\r\n}\r\n\r\n// matrix object を複製し、新たなmatrix object を生成する\r\nint\r\nCKLBLuaLibMatrix::luaCopyMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tMATRIX * pMat = getMatPointer(lua, 1);\r\n\tMATRIX * pNew = newMatrix();\r\n\r\n\tfor(int i = 0; i < 16; i++) pNew->m[i] = pMat->m[i];\r\n\tlua.retPointer(pNew);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibMatrix::luaInverseMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tMATRIX * pMat = getMatPointer(lua, 1);\r\n\tbool bResult = inverseMatrix(pMat);\r\n\tlua.retBoolean(bResult);\r\n\treturn 1;\r\n}\r\n\r\n\r\n// 指定された matrix object の内容に、Luaテーブルの値を設定する\r\nint\r\nCKLBLuaLibMatrix::luaOverwriteMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tMATRIX * pMat = getMatPointer(lua, 1);\r\n\tif(!pMat) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tlua.retValue(2);\r\n\tgetMatrix(lua, pMat);\r\n\tlua.pop(1);\r\n\r\n\tlua.retPointer(pMat);\r\n\treturn 1;\r\n}\r\n\r\n// 生成されているすべての matrix object を破棄する\r\nint\r\nCKLBLuaLibMatrix::luaDeleteAllMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint cnt = delAllMatrix();\r\n\tlua.retInt(cnt);\r\n\treturn 1;\r\n}\r\n\r\n// マトリクス乗算\r\nint\r\nCKLBLuaLibMatrix::luaMulMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 3) {\t// 対象となるmatrixが二つ以上なければnilを返す\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tMATRIX * ans = getMatPointer(lua, 1);;\r\n\tMATRIX * a = getMatPointer(lua, 2);\r\n\tMATRIX * b = getMatPointer(lua, 3);\r\n\tif(!ans || !a || !b) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\t//\r\n\t// 指定された二つ以上のmatrixを、コピーを行わずに順次掛け合わせていく\r\n\t//\r\n\t// matrixが3つ以上ある場合\r\n\tMATRIX tmp[2];\t// どこともつながらないテンポラリ\r\n\tint idx = 0;\r\n\r\n\t// 最初の二つを乗算する\r\n\tmulMatrix(&tmp[idx], a, b);\r\n\r\n\t// その結果に対し、残りがあれば最後の一つ手前まで順に掛け合わせていく\r\n\tfor(int i = 4; i <= argc; i++) {\r\n\t\tidx = 1 - idx;\r\n\t\ta = getMatPointer(lua, i);\r\n\t\tif(!a) {\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tmulMatrix(&tmp[idx], &tmp[1 - idx], a);\r\n\t}\r\n\r\n\t// tmp[idx]に最後の一つをかけた結果をansに書き出す\r\n\tfor(int i = 0; i < 16; i++) {\r\n\t\tans->m[i] = tmp[idx].m[i];\r\n\t}\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\n// ベクトル単品にマトリクスをかける\r\nint\r\nCKLBLuaLibMatrix::luaMulMatVector(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tMATRIX * mat = getMatPointer(lua, 1);\r\n\tif(!mat) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tVECTOR vec;\r\n\tVECTOR ret;\r\n\r\n\t// vector を取得\r\n\tlua.retValue(2);\r\n\tgetVector(lua, &vec);\r\n\tlua.pop(1);\r\n\r\n\t// vectorにmatrixをかけて、その結果を受け取る\r\n\tmulMatVector(&ret, &vec, mat);\r\n\r\n\t// 結果のvectorをLuaテーブルに変換しスタックに積む\r\n\tsetVector(lua, &ret);\r\n\r\n\treturn 1;\r\n}\r\n\r\n// ベクトル配列にマトリクスをかける\r\nint\r\nCKLBLuaLibMatrix::luaMulMatVecArray(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint nums;\r\n\tMATRIX * mat = getMatPointer(lua, 1);\r\n\tif(!mat) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tVECTOR * arrVec;\r\n\tVECTOR * retVec;\r\n\r\n\t// Luaのvector配列要素数を取得\r\n\tlua.retValue(2);\r\n\tnums = getVectorNums(lua);\r\n\r\n\t// 取得した数だけの要素を持つvector配列を、\r\n\t// 取得用と結果用の二つ作る。\r\n\tarrVec = KLBNEWA(VECTOR, nums);\r\n\tretVec = KLBNEWA(VECTOR, nums);\r\n\r\n\t// 取得用の側に、vector配列の内容を取得する\r\n\tgetVectorArray(lua, arrVec, nums);\r\n\tlua.pop(1);\r\n\r\n\t// 取得したvector群にマトリクスをかける\r\n\tmulMatVecArray(nums, retVec, arrVec, mat);\r\n\r\n\t// 計算結果のベクトル配列をLuaテーブルに変換し、Luaスタックに積む\r\n\tsetVectorArray(lua, retVec, nums);\r\n\r\n\t// バッファはもう用済み\r\n\tKLBDELETEA(retVec);\r\n\tKLBDELETEA(arrVec);\r\n\r\n\t// 積んだベクトル配列を戻り値とする。\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibMatrix::luaTransposedMatrix(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tif(lua.isNil(1)) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tMATRIX * pMat = getMatPointer(lua, 1);\r\n\r\n\tfor(int y = 0; y < 4; y++) {\r\n\t\tfor(int x = 0; x < 4; x++) {\r\n\t\t\tif(y <= x) continue;\r\n\t\t\tfloat tmp = pMat->m[4*y+x];\r\n\t\t\tpMat->m[4*y+x] = pMat->m[4*x+y];\r\n\t\t\tpMat->m[4*x+y] = tmp;\r\n\t\t}\r\n\t}\r\n\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibMatrix.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibMatrix_h\r\n#define CKLBLuaLibMatrix_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBObject.h\"\r\n\r\n\r\nclass CKLBLuaLibMatrix : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibMatrix();\r\npublic:\r\n\tCKLBLuaLibMatrix(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibMatrix();\r\n\r\n\tvoid addLibrary();\r\n\tvoid destroyResources();\r\n\tbool dumpObjects(IPlatformRequest& pForm);\r\n\r\n\tstruct MATRIX {\r\n\t\tMATRIX\t*\tprev;\r\n\t\tMATRIX\t*\tnext;\r\n\r\n\t\tconst char * name;\r\n\r\n\t\tfloat m[16];\r\n\r\n\t};\r\n\t\r\n\tstruct VECTOR {\r\n\t\tfloat v[4];\r\n\t};\r\n\r\n\t// Luaスタック最上位のLuaテーブルを、内部のmatrixとして取得する\r\n\tstatic void getMatrix(CLuaState& lua, MATRIX * ret);\r\n\r\n\t// MATRIXをLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void setMatrix(CLuaState& lua, MATRIX * mat);\r\n\r\n\t// 単品のvectorを取得する\r\n\tstatic void getVector(CLuaState& lua, VECTOR * vec);\r\n\r\n\t// 単品のvectorをLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void setVector(CLuaState& lua, VECTOR * vec);\r\n\r\n\t// Luaスタック最上位のLuaテーブルをvector配列とみなし、vectorの数を取得する\r\n\tstatic int getVectorNums(CLuaState& lua);\r\n\r\n\t// Luaスタック最上位のLuaテーブルを内部のvector配列として取得する\r\n\tstatic void getVectorArray(CLuaState& lua, VECTOR * vec, int nums);\r\n\r\n\t// VECTOR配列をLuaテーブルに変換し、Luaスタックに積む\r\n\tstatic void setVectorArray(CLuaState& lua, VECTOR * vec, int nums);\r\n\r\n\t// vector単品に matrix をかける\r\n\tstatic void mulMatVector(VECTOR * ret, VECTOR * arr, MATRIX * mat);\r\n\r\n\t// vector 配列に matrix をかける\r\n\tstatic void mulMatVecArray(int num, VECTOR * ret, VECTOR * arr, MATRIX * mat);\r\n\r\n\t// matrixの乗算\r\n\tstatic void mulMatrix(MATRIX * ans, MATRIX * a, MATRIX * b); \r\n\r\n\t// inverce matrix に変換する\r\n\tstatic bool inverseMatrix(MATRIX * mat);\r\n\r\nprivate:\r\n\tstatic int luaSetMatrixName\t\t(lua_State * L);\r\n\tstatic int luaCreateMatrix\t\t(lua_State * L);\r\n\tstatic int luaDeleteMatrix\t\t(lua_State * L);\r\n\tstatic int luaRevertMatrix\t\t(lua_State * L);\r\n\tstatic int luaCopyMatrix\t\t(lua_State * L);\r\n\tstatic int luaInverseMatrix\t\t(lua_State * L);\r\n\tstatic int luaOverwriteMatrix\t(lua_State * L);\r\n\tstatic int luaDeleteAllMatrix\t(lua_State * L);\r\n\r\n\tstatic int luaMulMatrix\t\t\t(lua_State * L);\r\n\tstatic int luaMulMatVecArray\t(lua_State * L);\r\n\tstatic int luaMulMatVector\t\t(lua_State * L);\r\n\tstatic int luaTransposedMatrix\t(lua_State * L);\r\n\r\n\tstatic MATRIX * newMatrix\t\t();\r\n\tstatic void\t\tdelMatrix\t\t(MATRIX * pMat);\r\n\tstatic int\t\tdelAllMatrix\t();\r\n\tstatic MATRIX * getMatPointer\t(CLuaState& lua, int index);\r\n\r\n\t// 生成されたmatrix objectはすべてlinkとして\r\n\tstatic MATRIX\t*\tm_pBegin;\r\n\tstatic MATRIX\t*\tm_pEnd;\r\n\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibMatrix_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibRES.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibRES.h\"\r\n\r\n//\r\n// Module for DUMP function.\r\n//\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibRES libdef(luaConst);\r\n\r\nCKLBLuaLibRES::CKLBLuaLibRES(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibRES::~CKLBLuaLibRES() {}\r\n\r\n// Adding Lua functions\r\nvoid\r\nCKLBLuaLibRES::addLibrary()\r\n{\r\n\taddFunction(\"RES_DumpSceneGraph\",\t\tCKLBLuaLibRES::luaRESDumpSceneGraph);\r\n\taddFunction(\"RES_DumpRendering\",\t\tCKLBLuaLibRES::luaRESDumpRendering);\r\n\taddFunction(\"RES_DumpAsset\",\t\t\tCKLBLuaLibRES::luaRESDumpAssets);\r\n\taddFunction(\"RES_DumpTexturePacker\",\tCKLBLuaLibRES::luaRESDumpTexturePacker);\r\n\taddFunction(\"RES_DumpGeometryCost\",\t\tCKLBLuaLibRES::luaRESDumpGeometryCost);\r\n\taddFunction(\"RES_DumpDataSet\",\t\t\tCKLBLuaLibRES::luaRESDumpDataSet);\r\n\taddFunction(\"RES_DumpRenderCost\",\t\tCKLBLuaLibRES::luaRESDumpRenderCost);\r\n\taddFunction(\"RES_DumpTaskList\",\t\t\tCKLBLuaLibRES::luaRESDumpTaskList);\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpTaskList(lua_State * /*L*/) \r\n{\r\n\tCKLBTaskMgr::getInstance().dump();\r\n\t// Return nothing.\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpSceneGraph(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tconst void* ptr = NULL;\t// Summary by default\r\n\tif(argc >= 1) {\r\n\t\tptr = lua.getPointer(1);\r\n\t}\r\n\r\n\tdumpSceneGraph(ptr);\r\n\r\n\t// Return nothing.\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpRendering(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tbool detailed = false;\t// Summary by default\r\n\tif(argc >= 1) {\r\n\t\tdetailed = lua.getBool(1);\r\n\t}\r\n\r\n\tdumpRendering(detailed);\r\n\r\n\t// Return nothing.\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpAssets(lua_State * /*L*/) \r\n{\r\n\tdumpAssets();\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpDataSet(lua_State * /*L*/) \r\n{\r\n\tdumpDataSet();\r\n\treturn 0;\r\n}\r\n\r\n#include \"CKLBDrawTask.h\"\r\nint\r\nCKLBLuaLibRES::luaRESDumpRenderCost(lua_State * L) {\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif (argc >= 1) {\r\n\t\tbool active = lua.getBool(1);\r\n\t\tCKLBDrawResource::getInstance().setLog(active);\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpTexturePacker(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tbool detailed = false;\t// Summary by default\r\n\tif(argc >= 1) {\r\n\t\tdetailed = lua.getBool(1);\r\n\t}\r\n\r\n\tdumpTexturePacker(detailed);\r\n\t// Return nothing.\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibRES::luaRESDumpGeometryCost(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tbool detailed = false;\t// Summary by default\r\n\tif(argc >= 1) {\r\n\t\tdetailed = lua.getBool(1);\r\n\t}\r\n\t\r\n\tdumpGeometryCost(detailed);\r\n\r\n\t// Return nothing.\r\n\treturn 0;\r\n}\r\n\r\nvoid CKLBLuaLibRES::dumpSceneGraph(const void* ptr)\r\n{\r\n\tif (ptr == NULL) {\r\n\t\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\t\tres.getRoot()->dump(0, 0xFFFFFFFF);\r\n\t} else {\r\n\t\tCKLBTask* tsk = (CKLBTask*)ptr;\r\n\t\tif (tsk->getTaskType() == CKLBTask::TASK_LUA_UI) {\r\n\t\t\tCKLBUITask* pUI = (CKLBUITask*)tsk;\r\n\t\t\tpUI->getNode()->dump(0, 0xFFFFFFFF);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBLuaLibRES::dumpGeometryCost(bool /*detailed*/) {\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\tpfif.logging(\"\\n=== Geometry cost ===\\n\");\r\n\t\tpfif.logging(\"Matrix Composition Count : %i\\n\", CKLBNode::s_matrixRecomputeCount);\r\n\t\tpfif.logging(\"Vertex Transform   Count : %i\\n\", CKLBNode::s_vertexRecomputeCount);\r\n\t\tpfif.logging(\"Color  Transform   Count : %i\\n\", CKLBNode::s_colorRecomputeCount );\r\n\t\tpfif.logging(\"=== End Geometry ===\\n\");\r\n\t#else\r\n\t\tpfif.logging(\"DEBUG_DumpGeometryCost only available with DEBUG_PERFORMANCE build.\\n\");\r\n\t#endif\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibRES.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibRES_h\r\n#define CKLBLuaLibRES_h\r\n\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBRendering.h\"\r\n#include \"CKLBTexturePacker.h\"\r\n#include \"CKLBUITask.h\"\r\n\r\nclass CKLBLuaLibRES : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibRES();\r\npublic:\r\n\tCKLBLuaLibRES(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibRES();\r\n\r\n\tvoid addLibrary();\r\n\r\n\tstatic void dumpSceneGraph(const void* ptr);\r\n\r\n\tinline \r\n\tstatic void dumpRendering(bool detailed) {\r\n\t\tif(detailed) {\r\n\t\t\tCKLBRenderingManager::getInstance().dump(0xFFFFFFFF);\r\n\t\t}\r\n\t\tCKLBRenderingManager::getInstance().dumpMetrics();\r\n\t}\r\n\r\n\tinline\r\n\tstatic void dumpAssets() {\r\n\t\tCKLBAssetManager::getInstance().dump();\r\n\t}\r\n\r\n\tinline \r\n\tstatic void dumpDataSet() {\r\n\t\tCKLBDataHandler::dumpDataSet();\r\n\t}\r\n\r\n\tinline\r\n\tstatic void dumpTexturePacker(bool detailed) {\r\n\t\tTexturePacker::getInstance().dump(detailed);\r\n\t}\r\n\r\n\tstatic void dumpGeometryCost(bool detailed);\r\n\r\n\r\nprivate:\r\n\tstatic int luaRESDumpTaskList\t\t(lua_State * L);\r\n\tstatic int luaRESDumpSceneGraph\t\t(lua_State * L);\r\n\tstatic int luaRESDumpRendering\t\t(lua_State * L);\r\n\tstatic int luaRESDumpAssets\t\t\t(lua_State * L);\r\n\tstatic int luaRESDumpDataSet\t\t(lua_State * L);\r\n\tstatic int luaRESDumpTexturePacker\t(lua_State * L);\r\n\tstatic int luaRESDumpGeometryCost\t(lua_State * L);\r\n\tstatic int luaRESDumpRenderCost\t\t(lua_State * L);\r\n};\r\n\r\n\r\n#endif // CKLBLuaLibRES_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibSOUND.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibSOUND.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\nCKLBLibRegistrator::LIBREGISTSTRUCT* CKLBLuaLibSOUND::ms_libRegStruct = CKLBLibRegistrator::getInstance()->add(\"LibSound\", CLS_KLBSOUNDOBJ);\r\n\r\nstatic ILuaFuncLib::DEFCONST luaConst[] = {\r\n\t{ \"SND_BUF_SMALL\",\t0 },\r\n\t{ \"SND_BUF_MEDIUM\",\t1 },\r\n\t{ \"SND_BUF_LARGE\",\t2 },\r\n    \r\n    // 再生状態lua定数\r\n    { \"SND_STATE_PLAY\", IClientRequest::E_SOUND_STATE_PLAY },\r\n    { \"SND_STATE_PAUSE\", IClientRequest::E_SOUND_STATE_PAUSE },\r\n    { \"SND_STATE_STOP\", IClientRequest::E_SOUND_STATE_STOP },\r\n    { \"SND_STATE_INVALID_HANDLE\", IClientRequest::E_SOUND_STATE_INVALID_HANDLE },\r\n    \r\n    // サウンドのミュージックとの並行処理タイプlua定数\r\n    { \"SND_MULTIPROCESS_MUSIC_CUT\",     IClientRequest::E_SOUND_MULTIPROCESS_MUSIC_CUT },\r\n    { \"SND_MULTIPROCESS_SOUND_CUT\",     IClientRequest::E_SOUND_MULTIPROCESS_SOUND_CUT },\r\n    { \"SND_MULTIPROCESS_SOUND_BGM_CUT\", IClientRequest::E_SOUND_MULTIPROCESS_SOUND_BGM_CUT },\r\n    \r\n\t{ 0, 0 }\r\n};\r\nstatic CKLBLuaLibSOUND libdef(luaConst);\r\n\r\nCKLBLuaLibSOUND::SOUND * CKLBLuaLibSOUND::ms_begin = 0;\r\nCKLBLuaLibSOUND::SOUND * CKLBLuaLibSOUND::ms_end = 0;\r\nfloat\t\t\t\t\t CKLBLuaLibSOUND::s_formGlobalVolume = 1.0f;\r\n\r\nu32\r\nCKLBLuaLibSOUND::SOUND::getClassID()\r\n{\r\n\treturn CLS_KLBSOUNDOBJ;\r\n}\r\n\r\nCKLBLuaLibSOUND::CKLBLuaLibSOUND(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibSOUND::~CKLBLuaLibSOUND()\r\n{\r\n\t// 全てのサウンドを同時に破棄\r\n\tremoveSoundAll();\r\n}\r\n\r\n// LuaLib全破棄時に、生成したサウンドリソースをすべて破棄\r\nvoid\r\nCKLBLuaLibSOUND::destroyResources()\r\n{\r\n\tremoveSoundAll();\r\n}\r\n\r\n// 現在オープンされているサウンドオブジェクトのダンプ\r\nbool\r\nCKLBLuaLibSOUND::dumpObjects(IPlatformRequest& pForm)\r\n{\r\n\tpForm.logging(\"[LuaLibSOUND]\");\r\n\r\n\tSOUND * pSnd = ms_begin;\r\n\tbool bResult = false;\r\n\twhile(pSnd) {\r\n\t\tpForm.logging(\"[SOUND] <%p>: %s\", pSnd, (pSnd->name) ? pSnd->name : \"(unknown)\");\r\n\t\tpSnd = pSnd->next;\r\n\t\tbResult = true;\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\n/*static*/ void CKLBLuaLibSOUND::s_dumpObjects() {\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\tSOUND * pSnd = ms_begin;\r\n\twhile(pSnd) {\r\n\t\tfprintf(pFile, \" Audio Asset <%p>: %s\", pSnd, (pSnd->name) ? pSnd->name : \"[NO NAME]\");\r\n\t\tpSnd = pSnd->next;\r\n\t}\r\n}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibSOUND::addLibrary()\r\n{\r\n\t// addFunction(\"<Lua関数名>\",     CKLBLuaLibSOUND::<static関数名>);\r\n\t// …を列挙することで関数定義\r\n\taddFunction(\"SND_Open\",\t\t\tCKLBLuaLibSOUND::luaSoundOpen);\r\n    addFunction(\"SND_setBufSize\",\tCKLBLuaLibSOUND::luaSetBufSize);\r\n\taddFunction(\"SND_Close\",\t\tCKLBLuaLibSOUND::luaSoundClose);\r\n\taddFunction(\"SND_CloseAll\",\t\tCKLBLuaLibSOUND::luaSoundCloseAll);\r\n\taddFunction(\"SND_Play\",\t\t\tCKLBLuaLibSOUND::luaSoundPlay);\r\n\taddFunction(\"SND_Stop\",\t\t\tCKLBLuaLibSOUND::luaSoundStop);\r\n\taddFunction(\"SND_Volume\",\t\tCKLBLuaLibSOUND::luaSoundVolume);\r\n\taddFunction(\"SND_Pan\",\t\t\tCKLBLuaLibSOUND::luaSoundPan);\r\n\r\n    addFunction(\"SND_Pause\",\t\tCKLBLuaLibSOUND::luaSoundPause);\r\n    addFunction(\"SND_Resume\",\t\tCKLBLuaLibSOUND::luaSoundResume);\r\n    addFunction(\"SND_Seek\",\t\t\tCKLBLuaLibSOUND::luaSoundSeek);\r\n    addFunction(\"SND_Tell\",\t\t\tCKLBLuaLibSOUND::luaSoundTell);\r\n\taddFunction(\"SND_getLength\", \tCKLBLuaLibSOUND::luaGetLength);\r\n    addFunction(\"SND_State\", \t\tCKLBLuaLibSOUND::luaSoundState);\r\n    addFunction(\"SND_Fade\", \t\tCKLBLuaLibSOUND::luaSoundSetFade);\r\n    \r\n\taddFunction(\"SND_VolumeBGM\",\tCKLBLuaLibSOUND::luaVolumeBGM);\r\n\taddFunction(\"SND_VolumeSE\",\t\tCKLBLuaLibSOUND::luaVolumeSE);\r\n\taddFunction(\"SND_VolumeFormSE\",\tCKLBLuaLibSOUND::luaVolumeFormSE);\r\n    \r\n    addFunction(\"SND_MultiProcess\", CKLBLuaLibSOUND::luaSoundSetMultiProcessType);\r\n    \r\n    addFunction(\"SND_PauseOnInterruption\",  CKLBLuaLibSOUND::luaSoundPauseOnInterruption);\r\n}\r\n\r\nCKLBLuaLibSOUND::SOUND *\r\nCKLBLuaLibSOUND::createSound(const char * snd_asset, bool is_se)\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tvoid * hSND = pForm.loadAudio(snd_asset, is_se);\r\n\tif(!hSND) return NULL;\r\n\r\n\tSOUND * pSnd = KLBNEW(SOUND);\r\n\tif(!pSnd) {\r\n\t\tpForm.releaseAudio(hSND);\r\n\t\treturn NULL;\r\n\t}\r\n\tpSnd->name = CKLBUtility::copyString(snd_asset);\r\n\r\n\tpSnd->hSND = hSND;\r\n\tpSnd->prev = ms_end;\r\n\tif(pSnd->prev) {\r\n\t\tpSnd->prev->next = pSnd;\r\n\t} else {\r\n\t\tms_begin = pSnd;\r\n\t}\r\n\tpSnd->next = NULL;\r\n\tms_end = pSnd;\r\n\r\n\treturn pSnd;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::removeSoundAll()\r\n{\r\n\tSOUND * pSnd = ms_begin;\r\n\tint cnt = 0;\r\n\twhile(pSnd) {\r\n\t\tSOUND * pNxt = pSnd->next;\r\n\t\tremoveSound(pSnd);\r\n\t\tpSnd = pNxt;\r\n\t\tcnt++;\r\n\t}\r\n\treturn cnt;\r\n}\r\n\r\nvoid\r\nCKLBLuaLibSOUND::removeSound(SOUND * pSnd)\r\n{\r\n    // 与えられたポインタが無効であれば何もしない\r\n    if(!checkSoundExist(pSnd)) return;\r\n    \r\n\tif(pSnd->prev) {\r\n\t\tpSnd->prev->next = pSnd->next;\r\n\t} else {\r\n\t\tms_begin = pSnd->next;\r\n\t}\r\n\tif(pSnd->next) {\r\n\t\tpSnd->next->prev = pSnd->prev;\r\n\t} else {\r\n\t\tms_end = pSnd->prev;\r\n\t}\r\n\r\n\t// サウンドをクローズ\r\n\tCPFInterface::getInstance().platform().releaseAudio(pSnd->hSND);\r\n\t\r\n\t// 名前を破棄\r\n\tKLBDELETEA(pSnd->name);\r\n\r\n\t// 領域を破棄\r\n\tKLBDELETE(pSnd);\r\n}\r\n\r\nint \r\nCKLBLuaLibSOUND::luaGetLength(lua_State * L) \r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n    if(argc < 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    \r\n\tSOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n\r\n\ts32 length = -1;\r\n\tif(checkSoundExist(pSnd)) {\r\n\t\tlength = pForm.totalTimeAudio(pSnd->hSND);\r\n\t}\r\n\tlua.retInt(length);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundOpen(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1 || argc > 2) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tconst char * snd_asset = lua.getString(1);\r\n\tbool f_bgm = (argc >= 2) ? lua.getBool(2) : false;\r\n\r\n\tSOUND * pSnd = createSound(snd_asset, !f_bgm);\r\n\r\n\tif( !f_bgm && pSnd ) pForm.preLoad(pSnd->hSND);\t// SEモードの場合はオンメモリ状態にしておく\r\n\r\n\tlua.retPointer(pSnd);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSetBufSize(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc < 1 || argc > 2) {\r\n        lua.retNil();\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    int level = lua.getInt(2);\r\n    bool bResult = pForm.setBufSize(pSnd->hSND, level);\r\n    lua.retBool(bResult);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundClose(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1) return 0;\r\n\r\n\tfor(int i = 1; i <= argc; i++) {\r\n\t\tSOUND * pSnd = (SOUND *)lua.getPointer(i);\r\n\t\tremoveSound(pSnd);\r\n\t\tlua.retNil();\r\n\t}\r\n\treturn argc;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundCloseAll(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1) return 0;\r\n\r\n\tint result = removeSoundAll();\r\n\r\n\tlua.retInt(result);\r\n\treturn 1;\r\n}\r\n\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundPlay(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 1 || argc > 4) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    \r\n\tSOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    u32 fade_msec = 0;\r\n    float tgtVol = 1.0f;\r\n\tfloat globalVol = 1.0f;\r\n    if( argc > 1 ) {\r\n        fade_msec = (u32)lua.getInt(2);\r\n    }\r\n    if( argc > 2 ) {\r\n        tgtVol = (float)lua.getDouble(3);\r\n    }\r\n    if (argc > 3 ) {\r\n\t\tglobalVol = (float)lua.getDouble(4);\r\n\t}\r\n    // 与えられたポインタが無効であれば何もしない\r\n\tfloat startVol = (fade_msec > 0.0f) ? (0.0f) : (1.0f);\r\n    if(checkSoundExist(pSnd)) pForm.playAudio(pSnd->hSND, fade_msec, tgtVol * globalVol, startVol * globalVol);\r\n    \r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundStop(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n    if(argc < 1 || argc > 3) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    \r\n    u32 fade_msec = 0;\r\n    float tgtVol = 0.0f;\r\n    if( argc > 1 ) {\r\n        fade_msec = (u32)lua.getInt(2);\r\n    }\r\n    if( argc > 2 ) {\r\n        tgtVol = (float)lua.getDouble(3);\r\n    }\r\n    \r\n\tSOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    if(checkSoundExist(pSnd)) pForm.stopAudio(pSnd->hSND, fade_msec, tgtVol);\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundVolume(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 2) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    float volume = lua.getFloat(2);\r\n    if(checkSoundExist(pSnd)) pForm.setAudioVolume(pSnd->hSND, volume);\r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundPan(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 2) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    float pan = lua.getFloat(2);\r\n    if(checkSoundExist(pSnd)) pForm.setAudioPan(pSnd->hSND, pan);\r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\nbool\r\nCKLBLuaLibSOUND::checkSoundExist(CKLBLuaLibSOUND::SOUND *pSnd)\r\n{\r\n    SOUND * p = ms_begin;\r\n    while(p) {\r\n        if(p == pSnd) return true;\r\n        p = p->next;\r\n    }\r\n    return false;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaVolumeBGM(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tfloat volume = lua.getFloat(1);\r\n\tCPFInterface::getInstance().platform().setMasterVolume(volume, false);\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaVolumeSE(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tfloat volume = lua.getFloat(1);\r\n\tCPFInterface::getInstance().platform().setMasterVolume(volume, true);\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBUIForm.h\"\r\n#include \"CKLBDrawTask.h\"\r\nstatic void setFormVolume_r(CKLBNode* pNode, float volume) {\r\n\tCKLBUITask* pTask = pNode->getUITask();\r\n\tif (pTask && pTask->getClassID() == CLS_KLBUIFORM) {\r\n\t\tCKLBUIForm* pForm = (CKLBUIForm*)pTask;\r\n\t\tpForm->setGlobalVolume(volume);\r\n\t} else {\r\n\t\tCKLBNode* pList = pNode->getChild();\r\n\t\twhile (pList) {\r\n\t\t\tsetFormVolume_r(pList, volume);\r\n\t\t\tpList = pList->getBrother();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaVolumeFormSE(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tfloat volume = lua.getFloat(1);\r\n\ts_formGlobalVolume = volume;\r\n\tsetFormVolume_r(CKLBDrawResource::getInstance().getRoot(), volume);\r\n\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundPause(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc < 1 || argc > 3) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    \r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    u32 fade_msec = 0;\r\n    float tgtVol = 0.0f;\r\n    if( argc > 1 ) {\r\n        fade_msec = (u32)lua.getInt(2);\r\n    }\r\n    if( argc > 2 ) {\r\n        tgtVol = (float)lua.getDouble(3);\r\n    }\r\n    \r\n    if(checkSoundExist(pSnd)) pForm.pauseAudio(pSnd->hSND, fade_msec, tgtVol);\r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundResume(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc < 1 || argc > 3) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    \r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    u32 fade_msec = 0;\r\n    float tgtVol = 1.0f;\r\n    if( argc > 1 ) {\r\n        fade_msec = (u32)lua.getInt(2);\r\n    }\r\n    if( argc > 2 ) {\r\n        tgtVol = (float)lua.getDouble(3);\r\n    }\r\n    \r\n    if(checkSoundExist(pSnd)) pForm.resumeAudio(pSnd->hSND, fade_msec, tgtVol);\r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundSeek(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 2) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    s32 millisec = (s32)lua.getDouble(2);\r\n    if(checkSoundExist(pSnd)) pForm.seekAudio(pSnd->hSND, millisec);\r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibSOUND::luaSoundTell(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retNil();\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    s32 millisec = 0;\r\n    if(checkSoundExist(pSnd)) millisec = pForm.tellAudio(pSnd->hSND);\r\n\tlua.retInt(millisec);\r\n    return 1;\r\n}\r\n\r\n/*!\r\n    @brief  指定されたサウンドハンドルの状態を取得\r\n    @param[in]  lua_state * L   luaポインタ\r\n    @return     int             戻り値の個数\r\n */\r\nint\r\nCKLBLuaLibSOUND::luaSoundState(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retNil();\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    s32 state = 0;\r\n    if( checkSoundExist(pSnd) ) {\r\n        // ハンドルが見つかったのでステータスを返す\r\n        state = pForm.getState(pSnd->hSND);\r\n    } else {\r\n        // ハンドルが見つからない\r\n        state = IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\r\n    }\r\n    lua.retInt((int)state);\r\n    return 1;\r\n}\r\n\r\n/*!\r\n @brief  指定されたサウンドハンドルの状態を取得\r\n @param[in]  lua_state * L   luaポインタ\r\n @return     int             戻り値の個数\r\n */\r\nint\r\nCKLBLuaLibSOUND::luaSoundSetFade(lua_State * L)\r\n{\r\n    \r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 3) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    SOUND * pSnd = (SOUND *)lua.getPointer(1);\r\n    s32 millisec = (s32)lua.getDouble(2);\r\n    float tgtVol = (float)lua.getDouble(3);\r\n    \r\n    if(checkSoundExist(pSnd)) pForm.setFadeParam(pSnd->hSND, tgtVol, millisec);\r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\n/*!\r\n @brief  サウンドのミュージックとの並行処理タイプ\r\n @param[in]  lua_state * L   luaポインタ\r\n @ret\r\n */\r\nint\r\nCKLBLuaLibSOUND::luaSoundSetMultiProcessType(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    \r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    s32 type = (s32)lua.getInt(1);\r\n    pForm.setAudioMultiProcessType(type);\r\n    \r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\n/*!\r\n    @brief  端末のサスペンド時の処理をエンジン側で制御するかどうか\r\n    @param[in]  lua_state * L   luaポインタ\r\n    @return\r\n */\r\nint CKLBLuaLibSOUND::luaSoundPauseOnInterruption(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    int argc = lua.numArgs();\r\n    if(argc != 1) {\r\n        lua.retBoolean(false);\r\n        return 1;\r\n    }\r\n    \r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    bool pauseOnInterruption = lua.getBool(1);\r\n    pForm.setPauseOnInterruption(pauseOnInterruption);\r\n    \r\n    lua.retBoolean(true);\r\n    return 1;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibSOUND.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibSOUND_h\r\n#define CKLBLuaLibSOUND_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\nclass CKLBLuaLibSOUND : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibSOUND();\r\npublic:\r\n\tCKLBLuaLibSOUND(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibSOUND();\r\n\r\n\tstatic CKLBLibRegistrator::LIBREGISTSTRUCT* ms_libRegStruct;\r\n\r\n\tvoid addLibrary();\r\n\tvoid destroyResources();\r\n\tbool dumpObjects(IPlatformRequest& pForm);\r\n\tstatic void s_dumpObjects();\r\n\r\n\tstruct SOUND : public CKLBObjectScriptable {\r\n\t\tu32 getClassID();\r\n\r\n\t\tSOUND\t*\tprev;\r\n\t\tSOUND\t*\tnext;\r\n\r\n\t\tvoid\t*\thSND;\t// サウンドハンドル\r\n\t\tconst char * name;\r\n\t};\r\n\t\r\n\tinline\r\n\tstatic SOUND* cmdSoundOpen(const char* snd_asset, bool f_bgm) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tSOUND * pSnd = createSound(snd_asset, !f_bgm);\r\n\t\tif(!f_bgm) pForm.preLoad(pSnd->hSND);\t// SEモードの場合はオンメモリ状態にしておく\r\n\t\treturn pSnd;\r\n\t}\r\n\r\n\tstatic int removeSoundAll();\r\n\r\n\tinline\r\n\tstatic void cmdSoundPlay(SOUND* pSnd, u32 fade_msec, float tgtVol, float globalVol) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\t// 与えられたポインタが無効であれば何もしない\r\n\t\tfloat startVol = (fade_msec > 0.0f) ? (0.0f) : (1.0f);\r\n\t\tif(checkSoundExist(pSnd)) pForm.playAudio(pSnd->hSND, fade_msec, tgtVol * globalVol, startVol * globalVol);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundStop(SOUND* pSnd, u32 fade_msec, float tgtVol) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.stopAudio(pSnd->hSND, fade_msec, tgtVol);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundVolume(SOUND* pSnd, float volume) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.setAudioVolume(pSnd->hSND, volume);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundPan(SOUND* pSnd, float pan) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.setAudioPan(pSnd->hSND, pan);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundPause(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.pauseAudio(pSnd->hSND);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSoundResume(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.resumeAudio(pSnd->hSND);\r\n\t}\r\n\r\n\tinline \r\n\tstatic void cmdSoundSeek(SOUND* pSnd, s32 millisec) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.seekAudio(pSnd->hSND, millisec);\r\n\t}\r\n\r\n\tinline\r\n\tstatic s32  cmdSoundTell(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\ts32 millisec = 0;\r\n\t\tif(checkSoundExist(pSnd)) millisec = pForm.tellAudio(pSnd->hSND);\r\n\t\treturn millisec;\r\n\t}\r\n\r\n\tinline\r\n\tstatic s32  cmdSoundState(SOUND* pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\ts32 state = 0;\r\n\t\tif(checkSoundExist(pSnd)) {\r\n\t\t\t// ハンドルが見つかったのでステータスを返す\r\n\t\t\tstate = pForm.getState(pSnd->hSND);\r\n\t\t} else {\r\n\t\t\t// ハンドルが見つからない\r\n\t\t\tstate = IClientRequest::E_SOUND_STATE_INVALID_HANDLE;\r\n\t\t}\r\n\t\treturn state;\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdVolumeBGM(float volume) {\r\n\t\tCPFInterface::getInstance().platform().setMasterVolume(volume, false);\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdVolumeSE(float volume) { \r\n\t\tCPFInterface::getInstance().platform().setMasterVolume(volume, true);\r\n\t}\r\n\r\n\tstatic void removeSound(SOUND * pSnd);\r\n\r\n\tinline\r\n\tstatic s32 cmdGetLength(SOUND * pSnd) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\ts32 length = -1;\r\n\t\tif(checkSoundExist(pSnd)) {\r\n\t\t\tlength = pForm.totalTimeAudio(pSnd->hSND);\r\n\t\t}\r\n\t\treturn length;\r\n\t}\r\n\r\n\tinline\r\n\tstatic void cmdSetFade(SOUND * pSnd, s32 millisec, float tgtVol) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tif(checkSoundExist(pSnd)) pForm.setFadeParam(pSnd->hSND, tgtVol, millisec);\r\n\t}\r\n\t\r\n\tinline\r\n\tstatic bool cmdSoundSetBufSize(SOUND* pSnd, s32 value) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\treturn pForm.setBufSize(pSnd->hSND, value);\r\n\t}\r\n\r\n\tinline\r\n\tstatic float getFormGlobalVolume() {\r\n\t\treturn s_formGlobalVolume;\r\n\t}\r\nprivate:\r\n\tstatic SOUND * createSound(const char * snd_asset, bool is_se);\r\n\r\n\r\n\tstatic int luaGetLength\t\t(lua_State * L);\r\n\tstatic int luaSoundOpen\t\t(lua_State * L);\r\n    static int luaSetBufSize\t(lua_State * L);\r\n\tstatic int luaSoundClose\t(lua_State * L);\r\n\tstatic int luaSoundCloseAll\t(lua_State * L);\r\n\r\n\tstatic int luaSoundPlay\t\t(lua_State * L);\r\n\tstatic int luaSoundStop\t\t(lua_State * L);\r\n    static int luaSoundVolume\t(lua_State * L);\r\n    static int luaSoundPan\t\t(lua_State * L);\r\n\tstatic int luaVolumeBGM\t\t(lua_State * L);\r\n\tstatic int luaVolumeSE\t\t(lua_State * L);\r\n\tstatic int luaVolumeFormSE\t(lua_State * L);\r\n    static int luaSoundPause\t(lua_State * L);\r\n    static int luaSoundResume\t(lua_State * L);\r\n    static int luaSoundSeek\t\t(lua_State * L);\r\n    static int luaSoundTell\t\t(lua_State * L);\r\n    \r\n    static int luaSoundState\t(lua_State * L);\r\n    static int luaSoundSetFade\t(lua_State * L);\r\n\r\n    static int luaSoundSetMultiProcessType\t(lua_State * L);\r\n    static int luaSoundPauseOnInterruption  (lua_State * L);\r\n    \r\n    static bool checkSoundExist\t(SOUND * pSnd);\r\nprivate:\r\n\r\n\r\n\tstatic float\t\ts_formGlobalVolume;\r\n\tstatic SOUND\t*\tms_begin;\r\n\tstatic SOUND\t*\tms_end;\r\n};\r\n\r\n\r\n#endif // CKLBLuaLIbSOUND_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibTASK.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibTASK.h\"\r\n#include \"CKLBBinArray.h\"\r\n#include \"CKLBLuaPropTask.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n;\r\nstatic CKLBLuaLibTASK libdef(0);\r\n\r\nCKLBLuaLibTASK::CKLBLuaLibTASK(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibTASK::~CKLBLuaLibTASK() {}\r\n\r\n// Lua関数の追加\r\nvoid\r\nCKLBLuaLibTASK::addLibrary()\r\n{\r\n\t// プロパティタスク操作\r\n    addFunction(\"TASK_getProperty\",\t\tCKLBLuaLibTASK::getProperty);\r\n    addFunction(\"TASK_setProperty\",\t\tCKLBLuaLibTASK::setProperty);\r\n\r\n\t// タスク破棄\r\n\taddFunction(\"TASK_kill\",\t\t\tCKLBLuaLibTASK::killTask);\r\n\taddFunction(\"TASK_isKilled\",\t\tCKLBLuaLibTASK::isKill);\r\n\taddFunction(\"TASK_registerkill\",\tCKLBLuaLibTASK::registerKill);\r\n\r\n\t// ステージタスク操作\r\n    addFunction(\"TASK_StageOnly\",\t\tCKLBLuaLibTASK::setStageTask);\r\n    addFunction(\"TASK_StageClear\",\t\tCKLBLuaLibTASK::clearStageTask);\r\n\r\n\t// タスクのpause状態設定\r\n\taddFunction(\"TASK_Pause\",\t\t\tCKLBLuaLibTASK::setPause);\r\n\r\n\t// タスクマネージャレベルでpauseをかける\r\n\taddFunction(\"TASK_ManagerPause\",\tCKLBLuaLibTASK::setManagerPause);\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::getProperty(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tif(lua.numArgs() != 1) return 0;\r\n    if(lua.isNil(1)) return 0;\r\n\r\n\tCKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n\tif(!pTask) return 0;\r\n\r\n\tCHECKTASK(pTask);\r\n\r\n#if defined (DEBUG_RT_CHECK)\r\n    klb_assert(pTask->getTaskType() >= CKLBTask::TASK_LUA_PROPERTY, \"SCRIPT ERROR %s(%d): the task does not have property.\",\r\n               CKLBLuaEnv::getInstance().nowFile(), lua.getNumLine());\r\n#endif\r\n    if(pTask->getTaskType() < CKLBTask::TASK_LUA_PROPERTY) return 0;\r\n\treturn ((CKLBLuaPropTask *)pTask)->getPropertyByScript(L);\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::setProperty(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tif(lua.numArgs() != 2) return 0;\r\n    if(lua.isNil(1)) return 0;\r\n    \r\n    CKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n    if(!pTask) return 0;\r\n\r\n\tCHECKTASK(pTask);\r\n\r\n#if defined (DEBUG_RT_CHECK)\r\n    klb_assert(pTask->getTaskType() >= CKLBTask::TASK_LUA_PROPERTY, \"SCRIPT ERROR %s(%d): the task does not have property.\",\r\n               CKLBLuaEnv::getInstance().nowFile(), lua.getNumLine());\r\n#endif\r\n    if(pTask->getTaskType() < CKLBTask::TASK_LUA_PROPERTY) return 0;\r\n    return ((CKLBLuaPropTask *)pTask)->setPropertyByScript(L);    \r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::killTask(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    if(lua.numArgs() != 1) return 0;\r\n    if(!lua.isNil(1)) {\r\n        CKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n        if(!pTask) return 0;\r\n\t\tCHECKTASK(pTask);\r\n        pTask->kill();\r\n    }\r\n    lua.retNil();\r\n    return 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::isKill(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tif(lua.numArgs() != 1) return 0;\r\n\tbool isRemove = true;\r\n\tif(!lua.isNil(1)) {\r\n\t\tCKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n\t\tif(!pTask) return 0;\r\n\t\tCHECKTASK(pTask);\r\n\t\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\t\tisRemove = mgr.is_remove(pTask);\r\n\t}\r\n\tlua.retBool(isRemove);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::registerKill(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tbool bResult = false;\r\n\tif(lua.numArgs() == 2) {\r\n\t\tCKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n\t\tif(!pTask) return 0;\r\n\t\tCHECKTASK(pTask);\r\n\r\n\t\tconst char* cb = NULL;\r\n\r\n\t\tif (lua.isString(2)) {\r\n\t\t\tcb = lua.getString(2);\r\n        }\r\n\r\n\t\tCKLBTaskMgr::getInstance().setCurrentTask(pTask);\r\n\t\tpTask->setKillCallback(cb);\r\n\t\tCKLBTaskMgr::getInstance().setCurrentTask(NULL);\r\n\t\tbResult = true;\r\n\t}\r\n\tlua.retBool(bResult);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::setStageTask(lua_State * L)\r\n{\r\n    CLuaState lua(L);\r\n    if(lua.numArgs() != 1) return 0;\r\n    if(lua.isNil(1)) return 0;\r\n    CKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n    if(!pTask) return 0;\r\n\tCHECKTASK(pTask);\r\n\r\n\tCKLBTaskMgr::getInstance().registStageTask(pTask);\r\n    return 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::clearStageTask(lua_State *L)\r\n{\r\n    CLuaState lua(L);\r\n    if(lua.numArgs() > 0) return 0;\r\n    CKLBTaskMgr::getInstance().clearStageTask();\r\n    return 0;    \r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::setPause(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2 || argc > 3) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n    CKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);\r\n    if(!pTask) return 0;\r\n\tCHECKTASK(pTask);\r\n\r\n\tbool bPause = lua.getBool(2);\r\n\tbool bRecursive = (argc >= 3) ? lua.getBool(3) : true;\r\n\r\n\tpTask->setPause(bPause, bRecursive);\r\n\r\n\treturn 0;\r\n}\r\n\r\nint\r\nCKLBLuaLibTASK::setManagerPause(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 1) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tbool bPause = lua.getBool(1);\r\n\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\tmgr.setPause(bPause);\r\n\r\n\tlua.retBoolean(true);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibTASK.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibTASK_h\r\n#define CKLBLuaLibTASK_h\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibTASK : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibTASK();\r\npublic:\r\n\tCKLBLuaLibTASK(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibTASK();\r\n\r\n\tvoid addLibrary();\r\n\r\nprivate:\r\n\r\n\tstatic int getProperty\t\t(lua_State * L);\r\n\tstatic int setProperty\t\t(lua_State * L);\r\n\tstatic int killTask\t\t\t(lua_State * L);\r\n\tstatic int isKill\t\t\t(lua_State * L);\r\n\tstatic int registerKill\t\t(lua_State * L);\r\n\tstatic int setStageTask\t\t(lua_State * L);\r\n\tstatic int clearStageTask\t(lua_State * L);\r\n\tstatic int setPause\t\t\t(lua_State * L);\r\n\tstatic int setManagerPause\t(lua_State * L);\r\n};\r\n\r\n#endif // CKLBLuaLIbTASK_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibUI.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLuaLibUI.h\"\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBSplineNode.h\"\r\n\r\nenum {\r\n\tUIPOS_LEFT\t   = 0x00000001,\r\n\tUIPOS_RIGHT    = 0x00000002,\r\n\tUIPOS_H_CENTER = (UIPOS_LEFT | UIPOS_RIGHT),\r\n\r\n\tUIPOS_TOP      = 0x00000004,\r\n\tUIPOS_BOTTOM   = 0x00000008,\r\n\tUIPOS_V_CENTER = (UIPOS_TOP | UIPOS_BOTTOM),\r\n\r\n};\r\nstatic ILuaFuncLib::DEFCONST defcmd[] = {\r\n\t{ \"UI_GENERIC_NODE_RECONNECT\",\tCKLBUITask::UI_GENERIC_NODE_RECONNECT },\r\n\t{ \"UI_GENERIC_SET_NAME\",\t\tCKLBUITask::UI_GENERIC_SET_NAME },\r\n\t{ \"UI_GENERIC_ANIM_SET_SPLINE\",\tCKLBUITask::UI_GENERIC_ANIM_SET_SPLINE },\r\n\t{ \"UI_GENERIC_ANIM_PLAY\",\t\tCKLBUITask::UI_GENERIC_ANIM_PLAY },\r\n\t{ \"UI_GENERIC_ANIM_STOP\",\t\tCKLBUITask::UI_GENERIC_ANIM_STOP },\r\n\t{ \"UI_GENERIC_IS_ANIM\",\t\t\tCKLBUITask::UI_GENERIC_IS_ANIM },\r\n\r\n\t{ \"UI_GENERIC_SET_COLOR\",\t\tCKLBUITask::UI_GENERIC_SET_COLOR },\r\n\t{ \"UI_GENERIC_SET_SCALE\",\t\tCKLBUITask::UI_GENERIC_SET_SCALE },\r\n\t{ \"UI_GENERIC_SET_ROT\",\t\t\tCKLBUITask::UI_GENERIC_SET_ROT },\r\n\t{ \"UI_GENERIC_SET_VISIBLE\",\t\tCKLBUITask::UI_GENERIC_SET_VISIBLE },\r\n\r\n\t{ \"SPL_VALUE_INT\",\t\tCKLBUITask::SPL_VALUE_INT },\r\n\t{ \"SPL_VALUE_NUM\",\t\tCKLBUITask::SPL_VALUE_NUM },\r\n\r\n\t{ \"UIPOS_LEFT\",\t\tUIPOS_LEFT },\r\n\t{ \"UIPOS_RIGHT\",\tUIPOS_RIGHT },\r\n\t{ \"UIPOS_TOP\",\t\tUIPOS_TOP },\r\n\t{ \"UIPOS_BOTTOM\",\tUIPOS_BOTTOM },\r\n\r\n\t{ \"UIPOS_H_CENTER\",\tUIPOS_H_CENTER },\r\n\t{ \"UIPOS_V_CENTER\",\tUIPOS_V_CENTER },\r\n\r\n\t{ \"SPL_MODIFY_X\",\t\tCKLBSplineNode::MODIFY_X },\r\n\t{ \"SPL_MODIFY_Y\",\t\tCKLBSplineNode::MODIFY_Y },\r\n\t{ \"SPL_MODIFY_SCALE\",\tCKLBSplineNode::MODIFY_SCALE },\r\n\t{ \"SPL_MODIFY_R\",\t\tCKLBSplineNode::MODIFY_R },\r\n\t{ \"SPL_MODIFY_G\",\t\tCKLBSplineNode::MODIFY_G },\r\n\t{ \"SPL_MODIFY_B\",\t\tCKLBSplineNode::MODIFY_B },\r\n\t{ \"SPL_MODIFY_A\",\t\tCKLBSplineNode::MODIFY_A },\r\n\t{ \"SPL_MODIFY_ROT\",\t\tCKLBSplineNode::MODIFY_ROT },\r\n\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBLuaLibUI libdef(defcmd);\r\n\r\nCKLBLuaLibUI::CKLBLuaLibUI(DEFCONST * arrConstDef) : ILuaFuncLib(arrConstDef) {}\r\nCKLBLuaLibUI::~CKLBLuaLibUI() {}\r\n\r\nvoid CKLBLuaLibUI::addLibrary()\r\n{\r\n\taddFunction(\"UIF_Position\", CKLBLuaLibUI::luaCalcPosition);\r\n}\r\n\r\nint\r\nCKLBLuaLibUI::luaCalcPosition(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 5) {\r\n\t\tlua.retNil();\r\n\t\tlua.retNil();\r\n\t\treturn 2;\r\n\t}\r\n\tfloat x = lua.getDouble(1);\r\n\tfloat y = lua.getDouble(2);\r\n\tfloat w = lua.getDouble(3);\r\n\tfloat h = lua.getDouble(4);\r\n\tint mask = lua.getInt(5);\r\n\r\n\tfloat rx, ry;\r\n\tcalcPosition(x,y,w,h,mask,&rx,&ry);\r\n\r\n\tlua.retDouble(rx);\r\n\tlua.retDouble(ry);\r\n\treturn 2;\r\n}\r\n\r\nvoid CKLBLuaLibUI::calcPosition(float x, float y, float w, float h, int mask, float* out_rx, float* out_ry)\r\n{\r\n\tswitch(mask & UIPOS_H_CENTER)\r\n\t{\r\n\tdefault:\r\n\tcase UIPOS_LEFT:\t\t*out_rx = x;\t\t\tbreak;\t\r\n\tcase UIPOS_RIGHT:\t\t*out_rx = x + w;\t\tbreak;\r\n\tcase UIPOS_H_CENTER:\t*out_rx = x + w/2;\t\tbreak;\r\n\t}\r\n\r\n\tswitch(mask & UIPOS_V_CENTER)\r\n\t{\r\n\tdefault:\r\n\tcase UIPOS_TOP:\t\t\t*out_ry = y;\t\t\tbreak;\r\n\tcase UIPOS_BOTTOM:\t\t*out_ry = y + h;\t\tbreak;\r\n\tcase UIPOS_V_CENTER:\t*out_ry = y + h/2;\t\tbreak;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/CKLBLuaLibUI.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLuaLibUI_h\r\n#define CKLBLuaLibUI_h\r\n\r\n\r\n#include \"ILuaFuncLib.h\"\r\n\r\nclass CKLBLuaLibUI : public ILuaFuncLib\r\n{\r\nprivate:\r\n\tCKLBLuaLibUI();\r\npublic:\r\n\tCKLBLuaLibUI(DEFCONST * arrConstDef);\r\n\tvirtual ~CKLBLuaLibUI();\r\n\r\n\tvoid addLibrary();\r\nprivate:\r\n\tstatic int luaCalcPosition(lua_State * L);\r\npublic:\r\n\tstatic void calcPosition(float x, float y, float w, float h, int mask, float* out_rx, float* out_ry);\r\n};\r\n\r\n#endif // CKLBLiaLibUI_h\r\n"
  },
  {
    "path": "Engine/source/LuaLib/ILuaFuncLib.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"ILuaFuncLib.h\"\r\n\r\nILuaFuncLib * ILuaFuncLib::m_begin = NULL;\r\nILuaFuncLib * ILuaFuncLib::m_end   = NULL;\r\n\r\nILuaFuncLib::ILuaFuncLib() {}\r\nILuaFuncLib::ILuaFuncLib(DEFCONST * arrCmdItem){ addLink(arrCmdItem); }\r\nILuaFuncLib::~ILuaFuncLib()\r\n{\r\n\tif(m_pPrev) {\r\n\t\tm_pPrev->m_pNext = m_pNext;\r\n\t} else {\r\n\t\tm_begin = m_pNext;\r\n\t}\r\n\tif(m_pNext) {\r\n\t\tm_pNext->m_pPrev = m_pPrev;\r\n\t} else {\r\n\t\tm_end = m_pPrev;\r\n\t}\r\n}\r\n\r\nbool\r\nILuaFuncLib::exist()\r\n{\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nILuaFuncLib::destroyResources() {}\r\n\r\nbool\r\nILuaFuncLib::dumpObjects(IPlatformRequest& /*pForm*/) \r\n{\r\n\treturn false;\r\n}\r\n\r\nvoid\r\nILuaFuncLib::addLink(DEFCONST * arrCmdItem)\r\n{\r\n\tm_arrCmdItem = arrCmdItem;\r\n\tm_pPrev = NULL;\r\n    m_pNext = m_begin;\r\n\tif(m_pNext) {\r\n\t\tm_pNext->m_pPrev = this;\r\n\t} else {\r\n\t\tm_end = this;\r\n\t}\r\n    m_begin = this;\r\n}\r\n\r\nvoid\r\nILuaFuncLib::registLib(lua_State * L)\r\n{\r\n\tm_L = L;\r\n\taddLibrary();\t// 関数群定義が書かれている筈の関数を呼び出す\r\n\tregistConst();\t// 指定された定数リストを読んで定義する\r\n}\r\n\r\nvoid\r\nILuaFuncLib::registConst()\r\n{\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\r\n\t// 定数定義リストが与えられていなければ、行う処理はない。\r\n\tDEFCONST * pConst;\r\n\tfor(pConst = m_arrCmdItem; pConst && pConst->name; pConst++) {\r\n\t\tlua_getglobal(m_L, pConst->name);\r\n\t\tif(!lua_isnil(m_L, -1)) {\r\n\t\t\tlua_pop(m_L, 1);\r\n\t\t\t// 指定されたグローバルラベルがnilではないということは、\r\n\t\t\t// 同名で値が定義済みであるため、エラーを出す。\r\n\t\t\tDEBUG_PRINT(\"[LIB REGISTRATION ERROR] %s it is redefined.\\n\", pConst->name);\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tlua_pop(m_L, 1);\r\n\t\tlua_pushinteger(m_L, pConst->cmd);\r\n\t\tlua_setglobal(m_L, pConst->name);\r\n\t\tpfif.logging(\"\\t\\t[def] %s = %d\", pConst->name, pConst->cmd);\r\n\t}\r\n}\r\n\r\nvoid\r\nILuaFuncLib::addFunction(const char * luaFuncName, int (*func)(lua_State * L))\r\n{\r\n\tlua_register(m_L, luaFuncName, func);\r\n\tDEBUG_PRINT(\"  [func] %s\", luaFuncName);\r\n}\r\n\r\nbool\r\nILuaFuncLib::registAllLibs(lua_State * L)\r\n{\r\n\tILuaFuncLib * pLib = m_begin;\r\n\tIPlatformRequest& pfif = CPFInterface::getInstance().platform();\r\n\r\n\t// オブジェクトダンプ関数を登録する\r\n\tlua_register(L, \"LuaLibDUMP\", ILuaFuncLib::luaDumpObjects);\r\n\r\n\tpfif.logging(\"<<<supported Lua functions>>>\");\r\n\r\n\twhile(pLib) {\r\n\t\tpLib->registLib(L);\r\n\t\tpLib = pLib->m_pNext;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nILuaFuncLib::destroyAllResources()\r\n{\r\n\tILuaFuncLib * pLib = m_begin;\r\n\twhile(pLib) {\r\n\t\tpLib->destroyResources();\r\n\t\tpLib = pLib->m_pNext;\r\n\t}\r\n}\r\n\r\nint\r\nILuaFuncLib::luaDumpObjects(lua_State * L)\r\n{\r\n\tCLuaState lua(L);\r\n\r\n\t// この関数について、引数は一切考慮しない。\r\n\t// 全ての引数を無視する。\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tILuaFuncLib * pLib = m_begin;\r\n\twhile(pLib) {\r\n\t\tpLib->dumpObjects(pForm);\r\n\t\tpLib = pLib->m_pNext;\r\n\t}\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/LuaLib/ILuaFuncLib.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef ILuaFuncLib_h\r\n#define ILuaFuncLib_h\r\n\r\n#include \"CLuaState.h\"\r\n\r\nclass ILuaFuncLib\r\n{\r\npublic:\r\n\ttypedef struct {\r\n\t\tconst char * name;\r\n\t\tint\t\t\t cmd;\r\n\t} DEFCONST;\r\n\r\n\tILuaFuncLib();\r\n\tILuaFuncLib(DEFCONST * arrCmdItem);\r\n\tvirtual ~ILuaFuncLib();\r\n\r\n\tvirtual bool exist\t\t\t\t();\r\n\r\n\tstatic\tbool registAllLibs\t\t(lua_State * L);\r\n\tstatic\tvoid destroyAllResources();\r\n\r\n\tvoid addFunction(const char * luaFuncName, int (*func)(lua_State * L));\r\nprotected:\r\n\r\n\t// 関数追加処理を記述する\r\n\tvirtual void addLibrary() = 0;\r\n\r\n\t// その関数群で確保したリソースに残りがあればすべて破棄する\r\n\tvirtual void destroyResources();\r\n\r\n\t// その関数群で生成したオブジェクトをダンプする必要があればダンプする\r\n\tvirtual bool dumpObjects(IPlatformRequest& pForm);\r\n\r\nprivate:\r\n    void addLink\t(DEFCONST * arrCmdItem);\r\n\tvoid registLib\t(lua_State * L);\r\n\tvoid registConst();\r\n\r\n\tstatic int luaDumpObjects(lua_State * L);\r\n\r\n    static ILuaFuncLib\t*\tm_begin;\r\n\tstatic ILuaFuncLib\t*\tm_end;\r\n\r\n\tILuaFuncLib\t\t\t*\tm_pPrev;\r\n    ILuaFuncLib\t\t\t*   m_pNext;\r\n\tDEFCONST\t\t\t*\tm_arrCmdItem;\r\n\tlua_State\t\t\t*\tm_L;\r\n};\r\n\r\n#endif // ILuaFunkLib_h\r\n"
  },
  {
    "path": "Engine/source/Rendering/CBuffer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\nCBuffer::CBuffer() {\r\n\t// Do nothing.\r\n}\r\n\r\nCBuffer::~CBuffer() {\r\n\t// Do nothing.\r\n}\r\n\r\n//\r\n// Buffer\r\n//\r\n\r\nvoid CBuffer::setDrawOffset(s32 index) {\r\n\tthis->offsetDrawDyn = index * strideDyn;\r\n\tthis->offsetDrawVBO = index * strideVBO;\r\n}\r\n\r\nvoid CBuffer::overrideBuffer(u32 /*vertexCount*/, float* buffer) {\r\n\tptrBuffer = buffer;\r\n\toffsetDrawDyn = 0;\r\n\toffsetDrawVBO = 0;\r\n}\r\n\r\nvoid CBuffer::load(float* vertexArrayStart, s32 vertexSize, s32 vertexInfoID, s32 startVertex, s32 count) {\r\n\tu16 iStrideDest;\r\n\tSVertexEntry* pCurrentVertex;\r\n\t\r\n\tfloat* ptrDst = this->updateStart(vertexInfoID, startVertex, &iStrideDest, &pCurrentVertex);\r\n\tfor (s32 n=0; n < count; n++) {\r\n\t\tfloat* ptrDstLoad = ptrDst;\r\n\t\tfloat* ptrSrcLoad = vertexArrayStart;\r\n\r\n\t\tswitch (pCurrentVertex->type) {\r\n\t\tcase VEC4:\r\n\t\t\t*ptrDstLoad++ = *ptrSrcLoad++;\r\n\t\tcase VEC3:\r\n\t\t\t*ptrDstLoad++ = *ptrSrcLoad++;\r\n\t\tcase VEC2:\r\n\t\t\t*ptrDstLoad++ = *ptrSrcLoad++;\r\n\t\tcase VEC1F:\r\n\t\tcase VEC4BYTE:\r\n\t\t\t*ptrDstLoad++ = *ptrSrcLoad++;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tklb_assertAlways( \"Invalid vertex type\");\r\n\t\t}\r\n\r\n\t\tptrDst\t\t\t\t+= iStrideDest;\t// Next Vertex\r\n\t\tvertexArrayStart\t+= vertexSize;\t// Next Vertex\r\n\t}\r\n\r\n\tthis->updateComplete(startVertex + count);\r\n}\r\n\r\nfloat*\tCBuffer::updateStart\t(s32 vertexInfoID, s32 startVertexIncluded, u16* stride, void* internalptr) {\r\n\tklb_assertc(this->VBOModifying == false, \"Call twice updateStart without proper updateComplete.\");\r\n\tklb_assertc(startVertexIncluded >= 0 && startVertexIncluded < 32768,\r\n\t\t\t\"Invalid index range\");\r\n\r\n\ts32 n\t= 0;\r\n\ts32 end = this->dynCount + this->vboCount;\r\n\twhile (n < end) {\r\n\t\tif (structure[n].vertexInfoID == vertexInfoID) {\r\n\t\t\tif (internalptr) {\r\n\t\t\t\t*((void**)internalptr) = &structure[n];\r\n\t\t\t}\r\n\t\t\tif (structure[n].isVBO) {\r\n\t\t\t\tklb_assertc(this->VBOModifying == false, \"Call twice updateStart without proper updateComplete.\");\r\n\t\t\t\t\r\n\t\t\t\tif (stride) {\r\n\t\t\t\t\t*stride = strideVBO;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this->VBOModified == true) {\r\n\t\t\t\t\tif (this->VBOModifyStart > startVertexIncluded) {\r\n\t\t\t\t\t\tthis->VBOModifyStart = startVertexIncluded;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis->VBOModifyStart = startVertexIncluded;\r\n\t\t\t\t\tthis->VBOModifyEnd\t = -1;\r\n\t\t\t\t}\r\n\t\t\t\tthis->VBOModified\t\t= true;\r\n\t\t\t\tthis->VBOModifying\t\t= true;\r\n\t\t\t\treturn (&(((float*)vboLocalCopy)[(startVertexIncluded*strideDyn) + structure[n].offset]));\r\n\t\t\t} else {\r\n\t\t\t\tif (stride) {\r\n\t\t\t\t\t*stride = strideDyn;\r\n\t\t\t\t}\r\n\t\t\t\treturn (&(((float*)ptrBuffer)[(startVertexIncluded*strideDyn) + structure[n].offset]));\r\n\t\t\t}\r\n\t\t}\r\n\t\tn++;\r\n\t}\r\n\r\n\tklb_assertAlways( \"Unknown vertexInfoID into buffer\");\r\n\tif (stride) {\r\n\t\t*stride = 0;\r\n\t}\r\n\treturn null;\r\n}\r\n\r\nvoid\tCBuffer::updateComplete\t(s32 endVertexExcluded) {\r\n\t//klb_assertc(endVertexIncluded >= 0 && endVertexIncluded < 32768,\r\n\t//\t\t\"Invalid index range\");\r\n\r\n\tif (VBOModifying) {\r\n\t\tVBOModifying = false;\r\n\t\tklb_assertc(endVertexExcluded >= VBOModifyStart, \"\");\r\n\t\tif (endVertexExcluded > VBOModifyEnd) {\r\n\t\t\tthis->VBOModifyEnd\t = endVertexExcluded;\r\n\t\t}\r\n\t}/* else { // DO nothing in case of normal buffer.\r\n\t\tklb_assert(\"Buffer was never start for modification if VBO\");\r\n\t} */\r\n}\r\n\r\nvoid\tCBuffer::commitVBO() {\r\n\t#ifdef STD_OPENGL\r\n\t\t#pragma message (\"Warning : feature not supported with standard OpenGL for now\")\r\n\t#else\r\n\t\tklb_assertc(VBOModified == true, \"VBO is not modified but commitVBO is executed.\");\r\n\t\tdglBindBuffer\t(GL_ARRAY_BUFFER, this->vboID);\r\n\t\tGLintptr\toffset\t= this->VBOModifyStart * strideVBO * sizeof(float);\r\n\t\tGLsizeiptr\tsize\t= (VBOModifyEnd - VBOModifyStart) * strideVBO * sizeof(float);\r\n\t\tvoid*\t\tdata\t= &(((float*)vboLocalCopy)[offset >> 2]);\r\n\r\n\t\tdglBufferSubData\t(GL_ARRAY_BUFFER, offset, size, data);\r\n\t#endif\r\n\r\n\tthis->VBOModified\t= false;\r\n\tthis->VBOModifyEnd\t= -1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CFrame.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\nCFrame::CFrame()\r\n:pColBufferBuf\t\t(NULL)\r\n,pColBufferTex\t\t(NULL)\r\n,pDepthBufferBuf\t(NULL)\r\n,pDepthBufferTex\t(NULL)\r\n,pStencilBufferBuf\t(NULL)\r\n,next\t\t\t\t(NULL)\r\n,colorBuff\t\t\t(0)\r\n,depthBuff\t\t\t(0)\r\n,stencilBuff\t\t(0)\r\n,frameBuffID\t\t(0)\r\n{\r\n}\r\n\r\nCFrame::~CFrame() {\r\n\tif (pColBufferBuf) \t\t{ pColBufferBuf->decrementRefCount(); \t\t}\r\n\tif (pDepthBufferBuf) \t{ pDepthBufferBuf->decrementRefCount();\t\t}\r\n\tif (pStencilBufferBuf)\t{ pStencilBufferBuf->decrementRefCount();\t}\r\n}\r\n\r\nbool CFrame::setColorBuffer(CImageBuffer*\tpBuffer) {\r\n\tif (pColBufferBuf) {\r\n\t\tpColBufferBuf->decrementRefCount();\r\n\t}\r\n\t\r\n\tpColBufferBuf\t= pBuffer;\r\n\tpColBufferTex\t= NULL;\r\n\t\r\n\tif (pBuffer) {\r\n\t\tpBuffer->incrementRefCount();\r\n\t\t\r\n\t\tcolorBuff = pBuffer->buffer;\r\n\t} else {\r\n\t\tcolorBuff = 0;\r\n\t}\r\n\t\r\n\t#ifndef OPENGL2\r\n\t\tklb_assertAlways(\"TODO\");\r\n\t#else\r\n\t\tdglBindFramebuffer\t\t\t(\tGL_FRAMEBUFFER, \tframeBuffID);\r\n\t\tdglFramebufferRenderbuffer\t(\tGL_FRAMEBUFFER,\t\tGL_COLOR_ATTACHMENT0,\r\n\t\t\t\t\t\t\t\t\t\tGL_RENDERBUFFER,\tcolorBuff);\r\n\t#endif\r\n\treturn true;\r\n}\r\n\r\nbool CFrame::setColorBuffer(CTexture*\t\tpTexture, u32 mipLevel) {\r\n\tif (pColBufferBuf) {\r\n\t\tpColBufferBuf->decrementRefCount();\r\n\t}\r\n\t\r\n\tpColBufferBuf\t= NULL;\r\n\tpColBufferTex\t= pTexture;\r\n\t\r\n\tif (pTexture) {\r\n\t\tcolorBuff = pTexture->texture;\r\n\t} else {\r\n\t\tcolorBuff = 0;\r\n\t}\r\n\t\r\n\t#ifndef OPENGL2\r\n        mipLevel = mipLevel;\r\n\t\tklb_assertAlways(\"TODO\");\r\n\t#else\r\n\t\tdglBindFramebuffer\t\t\t(\tGL_FRAMEBUFFER, \tframeBuffID);\r\n\t\tdglFramebufferTexture2D\t\t(\tGL_FRAMEBUFFER,  \tGL_COLOR_ATTACHMENT0,\t\r\n\t\t\t\t\t\t\t\t\t\tGL_TEXTURE_2D /* Our engine use only that */,\r\n\t\t\t\t\t\t\t\t\t\tcolorBuff, mipLevel);\r\n\t#endif\r\n\treturn true;\r\n}\r\n\r\nbool CFrame::setDepthBuffer(CImageBuffer*\tpBuffer) {\r\n\tif (pDepthBufferBuf) {\r\n\t\tpDepthBufferBuf->decrementRefCount();\r\n\t}\r\n\t\r\n\tpDepthBufferBuf\t= pBuffer;\r\n\tpDepthBufferTex\t= NULL;\r\n\t\r\n\tif (pBuffer) {\r\n\t\tpBuffer->incrementRefCount();\r\n\t\t\r\n\t\tdepthBuff = pBuffer->buffer;\r\n\t} else {\r\n\t\tdepthBuff = 0;\r\n\t}\r\n\t\r\n\t#ifndef OPENGL2\r\n\t\tklb_assertAlways(\"TODO\");\r\n\t#else\r\n\t\tdglBindFramebuffer\t\t\t(\tGL_FRAMEBUFFER, \tframeBuffID);\r\n\t\tdglFramebufferRenderbuffer\t(\tGL_FRAMEBUFFER,\t\tGL_DEPTH_ATTACHMENT,\r\n\t\t\t\t\t\t\t\t\t\tGL_RENDERBUFFER,\tdepthBuff);\r\n\t#endif\r\n\treturn true;\r\n}\r\n\r\nbool CFrame::setDepthBuffer(CTexture*\t\tpTexture, u32 mipLevel) {\r\n\tif (pDepthBufferBuf) {\r\n\t\tpDepthBufferBuf->decrementRefCount();\r\n\t}\r\n\t\r\n\tpDepthBufferBuf\t= NULL;\r\n\tpDepthBufferTex\t= pTexture;\r\n\t\r\n\tif (pTexture) {\r\n\t\tdepthBuff = pTexture->texture;\r\n\t} else {\r\n\t\tdepthBuff = 0;\r\n\t}\r\n\t\r\n\t#ifndef OPENGL2\r\n        mipLevel = mipLevel;\r\n\t\tklb_assertAlways(\"TODO\");\r\n\t#else\r\n\t\tdglBindFramebuffer\t\t\t(\tGL_FRAMEBUFFER, \tframeBuffID);\r\n\t\tdglFramebufferTexture2D\t\t(\tGL_FRAMEBUFFER,  \tGL_DEPTH_ATTACHMENT,\t\r\n\t\t\t\t\t\t\t\t\t\tGL_TEXTURE_2D /* Our engine use only that */,\r\n\t\t\t\t\t\t\t\t\t\tdepthBuff, mipLevel);\r\n\t#endif\r\n\treturn true;\r\n}\r\n\r\nbool CFrame::setStencilBuffer(CImageBuffer*\tpBuffer) {\r\n\tif (pStencilBufferBuf) {\r\n\t\tpStencilBufferBuf->decrementRefCount();\r\n\t}\r\n\t\r\n\tpStencilBufferBuf\t= pBuffer;\r\n\t\r\n\tif (pBuffer) {\r\n\t\tpBuffer->incrementRefCount();\r\n\t\t\r\n\t\tstencilBuff = pBuffer->buffer;\r\n\t} else {\r\n\t\tstencilBuff = 0;\r\n\t}\r\n\t\r\n\t#ifndef OPENGL2\r\n\t\tklb_assertAlways(\"TODO\");\r\n\t#else\r\n\t\tdglBindFramebuffer\t\t\t(\tGL_FRAMEBUFFER, \tframeBuffID);\r\n\t\tdglFramebufferRenderbuffer\t(\tGL_FRAMEBUFFER,\t\tGL_STENCIL_ATTACHMENT,\r\n\t\t\t\t\t\t\t\t\t\tGL_RENDERBUFFER,\tstencilBuff);\r\n\t#endif\r\n\treturn true;\r\n}\r\n\r\nbool CFrame::use(bool /*check*/) {\r\n\t#ifndef OPENGL2\r\n\t#else\r\n\t#endif\t\r\n\treturn false;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CImageBuffer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\nCImageBuffer::CImageBuffer()\r\n:next\t\t\t\t(NULL)\r\n,refCounter\t\t\t(0)\r\n,buffer\t\t\t\t(0)\r\n{\r\n}\r\n\r\nCImageBuffer::~CImageBuffer() {\r\n}\r\n\r\nvoid CImageBuffer::incrementRefCount() {\r\n\trefCounter++;\r\n}\r\n\r\nvoid CImageBuffer::decrementRefCount() {\r\n\tif (refCounter > 0) {\r\n\t\trefCounter--;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Reference counting error\");\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CIndexBuffer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n#include \"mem.h\"\t\t\t\t// memcpy\r\n\r\nCIndexBuffer::CIndexBuffer() {\r\n\t// Do nothing.\r\n}\r\n\r\nCIndexBuffer::~CIndexBuffer() {\r\n\t// Do nothing.\r\n}\r\n\r\n//\r\n// Index Buffer\r\n//\r\n\r\nvoid CIndexBuffer::setDrawOffset(s32 index) {\r\n\tthis->offsetDraw = index;\r\n}\r\n\r\nvoid CIndexBuffer::overrideBuffer(u32 /*indexCount*/, u16* buffer) {\r\n\tptrBuffer\t= (short*)buffer;\r\n\toffsetDraw\t= 0;\r\n}\r\n\r\nvoid CIndexBuffer::load(short* pIndex, s32 startIndex, s32 count) {\r\n\tshort* ptrDst = this->updateStart(startIndex);\r\n\tmemcpy16(ptrDst,pIndex,count*sizeof(short));\r\n\tthis->updateComplete(startIndex + count);\r\n}\r\n\r\nshort* CIndexBuffer::updateStart(s32 startIndexIncluded) {\r\n\tklb_assertc(startIndexIncluded >= 0 && startIndexIncluded < 32768,\r\n\t\t\t\"Invalid index range\");\r\n\r\n\tif (vboID != 0) {\r\n\t\tklb_assertc(this->VBOModifying == false, \"Call twice updateStart without proper updateComplete.\");\r\n\t\tif (VBOModified == true) {\r\n\t\t\tif (VBOModifyStart > startIndexIncluded) {\r\n\t\t\t\tVBOModifyStart = startIndexIncluded;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis->VBOModifyStart = startIndexIncluded;\r\n\t\t\tthis->VBOModifyEnd\t = -1;\r\n\t\t}\r\n\t\tthis->VBOModified\t\t= true;\r\n\t\tthis->VBOModifying\t\t= true;\r\n\r\n\t}\r\n\treturn &(((short*)ptrBuffer)[startIndexIncluded]);\r\n}\r\n\r\nvoid CIndexBuffer::updateComplete(s32 endIndexExcluded) {\r\n\t// klb_assertc((endIndexIncluded >= 0 && endIndexIncluded < 32768), \"Invalid index range\");\r\n\r\n\tif (VBOModifying) {\r\n\t\tVBOModifying = false;\r\n\t\tklb_assertc(endIndexExcluded >= VBOModifyStart, \"Update end before start\");\r\n\t\tif (endIndexExcluded > VBOModifyEnd) {\r\n\t\t\tthis->VBOModifyEnd\t = endIndexExcluded;\r\n\t\t}\r\n\t}/* else { // DO nothing in case of normal buffer.\r\n\t\tassert(\"Buffer was never start for modification if VBO\");\r\n\t} */\r\n}\r\n\r\nvoid CIndexBuffer::commitVBO() {\r\n\t#ifdef STD_OPENGL\r\n\t\t#pragma message (\"Warning : feature not supported with standard OpenGL for now\")\r\n\t#else\r\n\t\tklb_assertc(VBOModified == true, \"VBO is not modified but commitVBO is executed.\");\r\n\t\tdglBindBuffer\t(GL_ELEMENT_ARRAY_BUFFER, this->vboID);\r\n\t\tGLintptr\toffset\t= this->VBOModifyStart * sizeof(short);\r\n\t\tGLsizeiptr\tsize\t= (VBOModifyEnd - VBOModifyStart) * sizeof(short);\r\n\t\tvoid*\t\tdata\t= &(((short*)ptrBuffer)[offset >> 1]);\r\n\r\n\t\tdglBufferSubData\t(GL_ELEMENT_ARRAY_BUFFER, offset, size, data);\r\n\t#endif\r\n\r\n\tthis->VBOModified\t= false;\r\n\tthis->VBOModifyEnd\t= -1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CKLBCanvasSprite.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBCanvasSprite.h\"\r\n#include \"mem.h\"\r\n\r\nCKLBCanvasSprite* CKLBRenderingManager::allocateCommandCanvasSprite(\r\n\tu32 vertexCount, \r\n\tu32 indexCount, \r\n\tu32 priority)\r\n{\r\n\tCKLBCanvasSprite* pSpr = KLBNEW(CKLBCanvasSprite);\r\n\tif (pSpr) {\r\n\t\tif (pSpr->setupCanvas(vertexCount, indexCount)) {\r\n\t\t\tpSpr->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pSpr;\r\n\t\t\t}\r\n\t\t\tm_pAllocatedSpriteList\t\t= pSpr;\r\n\t\t\tpSpr->m_uiOrder\t\t\t\t= priority;\r\n\t\t\treturn pSpr;\r\n\t\t}\r\n\t\tKLBDELETE(pSpr);\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nCKLBCanvasSprite::CKLBCanvasSprite()\r\n:CKLBSprite()\r\n,m_freeze\t(false)\r\n{\r\n}\r\n\r\nCKLBCanvasSprite::~CKLBCanvasSprite() {\r\n}\r\n\r\nvoid CKLBCanvasSprite::setupTexture(CKLBTextureAsset* pTexture) {\r\n\t_internalImg.m_pTextureAsset\t= pTexture;\r\n\tm_pTexture\t\t\t= pTexture->m_pTextureUsage;\r\n}\r\n\r\nbool CKLBCanvasSprite::setupCanvas(u32 vertexCount, u32 indexCount) {\r\n\t_internalImg.m_bAllocatedOutsideTexture = true;\r\n\r\n\t// Vertex & index count\r\n\t_internalImg.m_pTextureAsset\t= NULL; //pTexture;\r\n\r\n\tfloat* buf\t=\tKLBNEWA(float, (vertexCount*VERTEX_SIZE) + indexCount);\r\n\r\n\t_internalImg.m_pXYCoord\t\t\t= buf;\r\n\t_internalImg.m_pUVCoord\t\t\t= &buf[vertexCount*(VERTEX_SIZE-2)];\r\n\t_internalImg.m_pIndex\t\t\t= (u16*)&buf[vertexCount*VERTEX_SIZE];\r\n\r\n\t// Pos Transform\r\n\tfloat*\tarr\t\t\t\t\t\t= KLBNEWA(float,vertexCount* (VERTEX_SIZE+2));\r\n\tu32* arrCol\t\t\t\t\t\t= (u32*)&arr[vertexCount * VERTEX_SIZE];\r\n\r\n\tbool res = (_internalImg.m_pXYCoord && arr);\r\n\tif (res) {\r\n\t\tfor (int n=0; n < MAX_SECTION; n++) {\r\n\t\t\tm_dynSection[n].lengthFloat\t= 0;\r\n\t\t\tm_dynSection[n].start\t\t= 0;\r\n\t\t\tm_dynSection[n].started\t\t= false;\r\n\t\t}\r\n\r\n\t\tm_pImageAsset\t\t= &_internalImg;\r\n\t\tm_pVertex\t\t\t= arr;\r\n\t\tm_pColors\t\t\t= arrCol;\r\n\t\tm_pIndex\t\t\t= _internalImg.m_pIndex;\t// Cache\r\n\t\tm_uiMaxVertexCount\t= (u16)vertexCount;\r\n\t\tm_uiMaxIndexCount\t= (u16)indexCount;\r\n\r\n\t\tm_uiStatus\t\t\t= FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\r\n\t\t\r\n\t\tm_uiIndexCount = 1; // Force clear()\r\n\t\tclear();\r\n\r\n\t\tthis->switchImage(&_internalImg);\r\n\t} else {\r\n\t\tif\t(arr)\t\t{ KLBDELETEA(arr);\t\t}\t\t\r\n\t\t// Other arrays destroyed when this object is destroyed.\r\n\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nvoid CKLBCanvasSprite::freeze(bool freeze) {\r\n\tm_freeze = freeze;\r\n}\r\n\r\nbool CKLBCanvasSprite::clear() {\r\n\tif (m_uiIndexCount != 0) {\r\n\t\tm_uiVertexCount\t\t= 0;\r\n\t\tm_uiIndexCount\t\t= 0;\r\n\t\t_internalImg.m_uiIndexCount\t\t= 0;\r\n\t\t_internalImg.m_uiVertexCount\t= 0;\r\n\t\tm_uiStatus\t\t\t\t\t\t|= FLAG_BUFFERSHIFT;\r\n\t\tm_pFillColors\t\t= m_pColors;\r\n\t\tm_pFillVertex\t\t= _internalImg.m_pXYCoord;\r\n\t\tm_pFillUV\t\t\t= _internalImg.m_pUVCoord;\r\n\t\tm_pFillIndex\t\t= m_pIndex;\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid CKLBCanvasSprite::startDynamicSection(u32 section) {\r\n\tif ((section < MAX_SECTION) && (!m_dynSection[section].started)) {\r\n\t\tm_dynSection[section].lengthFloat\t= 0;\r\n\t\tm_dynSection[section].start\t\t\t= _internalImg.m_uiVertexCount<<1;\r\n\t\tm_dynSection[section].started\t\t= true;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Canvas section out of range or not ended\");\r\n\t}\r\n}\r\n\r\nvoid CKLBCanvasSprite::endDynamicSection(u32 section) {\r\n\tif ((section < MAX_SECTION) && (m_dynSection[section].started)) {\r\n\t\tm_dynSection[section].started\t\t= false;\r\n\t\tm_dynSection[section].lengthFloat\t= (_internalImg.m_uiVertexCount<<1) - m_dynSection[section].start;\r\n\t} else {\r\n\t\tklb_assertAlways(\"Canvas section out of range or not started\");\r\n\t}\r\n}\r\n\r\nvoid CKLBCanvasSprite::dynamicSectionTranslate(u32 section, float x, float y) {\r\n\tklb_assert(((section < MAX_SECTION) && (!m_dynSection[section].started)),\"Canvas section out of range or not defined completly\");\r\n\r\n\tint fCount = m_dynSection[section].lengthFloat;\r\n\r\n\tfloat* pFillVertex\t= &_internalImg.m_pXYCoord[m_dynSection[section].start];\r\n\t// Apply Translation.\r\n\tfor (int n=0; n < (fCount>>1); n++) {\r\n\t\tpFillVertex[0] = x + pFillVertex[0];\t// X\r\n\t\tpFillVertex[1] = y + pFillVertex[1];\t// Y\r\n\t\tpFillVertex += 2;\r\n\t}\r\n\tm_uiStatus |= FLAG_XYUPDATE;\r\n}\r\n\r\nvoid CKLBCanvasSprite::dynamicSectionColor(u32 section, u32 color) {\r\n\tklb_assert(((section < MAX_SECTION) && (!m_dynSection[section].started)),\"Canvas section out of range or not defined completly\");\r\n\r\n\tint cCount\t\t\t= m_dynSection[section].lengthFloat>>1;\r\n\tu32* pFillColors\t= &m_pColors[m_dynSection[section].start>>1];\r\n\tmemset32(pFillColors,\tcolor, cCount * sizeof(u32));\r\n\tm_uiStatus |= FLAG_COLORUPDATE;\r\n}\r\n\r\nvoid CKLBCanvasSprite::doUVAndColor(CKLBImageAsset* pImage, u32 color, u16 fCount, u16 iCount) {\r\n\t// Apply UV\r\n\tmemcpy32(m_pFillUV,\t\tpImage->getUVBuffer(), fCount * sizeof(float));\r\n\r\n\t// Apply Color\r\n\tmemset32(m_pFillColors,\tcolor, (fCount>>1) * sizeof(u32));\r\n\r\n\t// Update All Coord / UV counter\r\n\tm_pFillUV\t  += fCount;\r\n\tm_pFillColors += (fCount>>1);\r\n\r\n\tu16  start\t= _internalImg.m_uiVertexCount;\r\n\t_internalImg.m_uiVertexCount\t+= (fCount>>1);\r\n\tm_uiVertexCount\t\t\t\t\t = _internalImg.m_uiVertexCount;\r\n\r\n\t// Apply Indexes\r\n\tu16* ptrIdx = m_pFillIndex;\r\n\tu16* srcIdx = pImage->getIndexBuffer();\r\n\tfor (int n=0; n < iCount; n++) {\r\n\t\tptrIdx[n] = start + srcIdx[n]; \r\n\t}\r\n\r\n\t// Update Index Counter\r\n\tm_pFillIndex\t\t\t\t\t+= iCount;\r\n\t_internalImg.m_uiIndexCount\t\t+= iCount;\r\n\tm_uiIndexCount\t\t\t\t\t= _internalImg.m_uiIndexCount;\r\n\tm_uiStatus\t\t\t\t\t\t|= FLAG_BUFFERSHIFT | FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n}\r\n\r\nbool CKLBCanvasSprite::drawImage(float x, float y, CKLBImageAsset* pImage, u32 color) {\r\n\tu16 vCount = (u16)pImage->getVertexCount() * 2;\r\n\tu16 iCount = (u16)pImage->getIndexCount();\r\n\r\n\t// Apply Translation.\r\n\tfloat* pSrcCoord = pImage->getXYBuffer();\r\n\tfor (u16 n=0; n < (vCount>>1); n++) {\r\n\t\t*m_pFillVertex++ = x + *pSrcCoord++;\t// X\r\n\t\t*m_pFillVertex++ = y + *pSrcCoord++;\t// Y\r\n\t}\r\n\r\n\tdoUVAndColor(pImage, color, vCount, iCount);\r\n\t\r\n\tklb_assert(_internalImg.m_uiIndexCount  <= m_uiMaxIndexCount,  \"Reached Limit\");\r\n\tklb_assert(_internalImg.m_uiVertexCount <= m_uiMaxVertexCount, \"Reached Limit\");\r\n\treturn true;\r\n}\r\n\r\nbool CKLBCanvasSprite::drawImageClip(float x, float y, CKLBImageAsset* pImage, float percW, float percH, u32 color) {\r\n\tu16 vCount = (u16)pImage->getVertexCount() * 2;\r\n\tu16 iCount = (u16)pImage->getIndexCount();\r\n\r\n\t// Apply Translation.\r\n\tfloat* pSrcCoord = pImage->getXYBuffer();\r\n\tfor (u16 n=0; n < (vCount>>1); n++) {\r\n\t\t*m_pFillVertex++ = x + ((*pSrcCoord++) * percW);\t// X\r\n\t\t*m_pFillVertex++ = y + ((*pSrcCoord++) * percH);\t// Y\r\n\t}\r\n\r\n\t// UV\r\n\tfloat* pSrcUV = pImage->getUVBuffer();\r\n\r\n\tm_pFillUV[0] = pSrcUV[0];\r\n\tm_pFillUV[1] = pSrcUV[1];\r\n\r\n\tm_pFillUV[2] = pSrcUV[0] + (percW * (pSrcUV[2] - pSrcUV[0]));\r\n\tm_pFillUV[3] = pSrcUV[1] + (percH * (pSrcUV[3] - pSrcUV[1]));\r\n\r\n\tm_pFillUV[4] = pSrcUV[0] + (percW * (pSrcUV[4] - pSrcUV[0]));\r\n\tm_pFillUV[5] = pSrcUV[1] + (percH * (pSrcUV[5] - pSrcUV[1]));\r\n\r\n\tm_pFillUV[6] = pSrcUV[0] + (percW * (pSrcUV[6] - pSrcUV[0]));\r\n\tm_pFillUV[7] = pSrcUV[1] + (percH * (pSrcUV[7] - pSrcUV[1]));\r\n\r\n\tm_pFillUV += 8;\r\n\r\n\t// Update Vertex count.\r\n\tu16  start\t= _internalImg.m_uiVertexCount;\r\n\t_internalImg.m_uiVertexCount\t+= (vCount>>1);\r\n\tm_uiVertexCount\t\t\t\t\t = _internalImg.m_uiVertexCount;\r\n\r\n\t// Apply Indexes\r\n\tu16* ptrIdx = m_pFillIndex;\r\n\tu16* srcIdx = pImage->getIndexBuffer();\r\n\tfor (int n=0; n < iCount; n++) {\r\n\t\tptrIdx[n] = start + srcIdx[n]; \r\n\t}\r\n\r\n\t// Color\r\n\tmemset32(m_pFillColors,\tcolor, (vCount>>1) * sizeof(u32));\r\n\tm_pFillIndex\t\t\t\t\t+= iCount;\r\n\t_internalImg.m_uiIndexCount\t\t+= iCount;\r\n\tm_uiIndexCount\t\t\t\t\t= _internalImg.m_uiIndexCount;\r\n\tm_uiStatus\t\t\t\t\t\t|= FLAG_BUFFERSHIFT | FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\treturn true;\r\n}\r\n\r\nbool CKLBCanvasSprite::drawScale(float x, float y, float scale, CKLBImageAsset* pImage, u32 color) {\r\n\tu16 vCount = (u16)pImage->getVertexCount() * 2;\r\n\tu16 iCount = (u16)pImage->getIndexCount();\r\n\r\n\t// Apply Translation.\r\n\tfloat* pSrcCoord = pImage->getXYBuffer();\r\n\tfor (u16 n=0; n < (vCount>>1); n++) {\r\n\t\t*m_pFillVertex++ = x + (*pSrcCoord++) * scale;\t// X\r\n\t\t*m_pFillVertex++ = y + (*pSrcCoord++) * scale;\t// Y\r\n\t}\r\n\r\n\tdoUVAndColor(pImage, color, vCount, iCount);\r\n\r\n\tklb_assert(_internalImg.m_uiIndexCount  <= m_uiMaxIndexCount,  \"Reached Limit\");\r\n\tklb_assert(_internalImg.m_uiVertexCount <= m_uiMaxVertexCount, \"Reached Limit\");\r\n\treturn true;\r\n}\r\n\r\nvoid CKLBCanvasSprite::setFillUV(float u, float v) \r\n{\r\n\tm_fillU = u;\r\n\tm_fillV = v;\r\n}\r\n\r\nbool CKLBCanvasSprite::fillRect(float x, float y, float w, float h, u32 color) {\r\n\t//\r\n\t// Coordinate\r\n\t//\r\n\t*m_pFillVertex++ = x;\r\n\t*m_pFillVertex++ = y;\r\n\r\n\tfloat x1 = x + w;\r\n\t*m_pFillVertex++ = x1;\r\n\t*m_pFillVertex++ = y;\r\n\r\n\tfloat y1 = y + h;\r\n\t*m_pFillVertex++ = x1;\r\n\t*m_pFillVertex++ = y1;\r\n\r\n\t*m_pFillVertex++ = x;\r\n\t*m_pFillVertex++ = y1;\r\n\r\n\t//\r\n\t// U,V : 0.0f, 0.0f\r\n\t//\r\n\t*m_pFillUV++ = m_fillU;\r\n\t*m_pFillUV++ = m_fillV;\r\n\t*m_pFillUV++ = m_fillU;\r\n\t*m_pFillUV++ = m_fillV;\r\n\t*m_pFillUV++ = m_fillU;\r\n\t*m_pFillUV++ = m_fillV;\r\n\t*m_pFillUV++ = m_fillU;\r\n\t*m_pFillUV++ = m_fillV;\r\n\r\n\tmemset32(m_pFillColors, color, 4);\r\n\tm_pFillColors += 4;\r\n\r\n\r\n\t// Apply Indexes\r\n\tu16  start\t= _internalImg.m_uiVertexCount;\r\n\t_internalImg.m_uiVertexCount\t+= 4;\r\n\tm_uiVertexCount\t\t\t\t\t= _internalImg.m_uiVertexCount;\r\n\r\n\tu16* ptrIdx = m_pFillIndex;\r\n\r\n\t*ptrIdx++ = start;\t\t// 0 \r\n\t*ptrIdx++ = start+1;\t// 1 \r\n\t*ptrIdx++ = start+3;\t// 3\r\n\t\r\n\t*ptrIdx++ = start+1;\t// 1\r\n\t*ptrIdx++ = start+2;\t// 2\r\n\t*ptrIdx++ = start+3;\t// 3\r\n\r\n\t// Update Index Counter\r\n\tm_pFillIndex\t\t\t\t\t= ptrIdx;\r\n\t_internalImg.m_uiIndexCount\t   += 6;\r\n\tm_uiIndexCount\t\t\t\t\t= _internalImg.m_uiIndexCount;\r\n\r\n\tm_uiStatus\t\t\t\t\t\t|= FLAG_BUFFERSHIFT | FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\r\n\tklb_assert(_internalImg.m_uiIndexCount  <= m_uiMaxIndexCount,  \"Reached Limit\");\r\n\tklb_assert(_internalImg.m_uiVertexCount <= m_uiMaxVertexCount, \"Reached Limit\");\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CKLBCanvasSprite.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_CANVAS_SPRITE__\r\n#define __CKLB_CANVAS_SPRITE__\r\n\r\n#include \"CKLBRendering.h\"\r\n\r\nclass CKLBCanvasSprite : public CKLBSprite {\r\npublic:\r\n\tCKLBCanvasSprite();\r\n\t~CKLBCanvasSprite();\r\n\r\n\tbool setupCanvas\t(u32 vertexCount, u32 indexCount);\r\n\tvoid setupTexture\t(CKLBTextureAsset* pTexture);\r\n\r\n\tinline\r\n\tbool isFreeze\t\t()\t{ return m_freeze; }\r\n\tvoid freeze\t\t\t(bool freeze);\r\n\tbool clear\t\t\t();\r\n\tbool drawImage\t\t(float x, float y, CKLBImageAsset* pImage, u32 color);\r\n\tbool drawScale\t\t(float x, float y, float scale, CKLBImageAsset* pImage, u32 color);\r\n\tbool drawImageClip\t(float x, float y, CKLBImageAsset* pImage, float percW, float percH, u32 color);\r\n\tbool fillRect\t\t(float x, float y, float w, float h, u32 color);\r\n\r\n\tvoid startDynamicSection\t(u32 section);\r\n\tvoid endDynamicSection\t\t(u32 section);\r\n\tvoid dynamicSectionTranslate(u32 section, float x, float y);\r\n\tvoid dynamicSectionColor\t(u32 section, u32 color);\r\n\r\n\tvoid setFillUV\t\t\t\t(float u, float v);\r\nprotected:\r\n\t#define MAX_SECTION\t\t(10)\r\n\tstruct SECTION {\r\n\t\tu16\t\tlengthFloat;\r\n\t\tu16\t\tstart;\r\n\t\tbool\tstarted;\r\n\t};\r\n\r\n\tSECTION\tm_dynSection[10];\r\n\tvoid doUVAndColor\t(CKLBImageAsset* pImage, u32 color, u16 vCount, u16 iCount);\r\n\r\n\tCKLBImageAsset _internalImg;\r\n\tu32*\tm_pLocalColors;\r\n\r\n\tfloat\tm_fillU;\r\n\tfloat\tm_fillV;\r\n\tu32*\tm_pFillColors;\r\n\tfloat*\tm_pFillVertex;\r\n\tfloat*\tm_pFillUV;\r\n\tu16*\tm_pFillIndex;\r\n\tbool\tm_freeze;\r\n};\r\n\r\n#endif // __CKLB_CANVAS_SPRITE__\r\n"
  },
  {
    "path": "Engine/source/Rendering/CKLBRendering.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === Rendering System ===\r\n//\r\n//\r\n\r\n#ifndef __CKLB_RENDERING__\r\n#define __CKLB_RENDERING__\r\n\r\n#include \"CKLBAsset.h\"\r\n#include \"TextureManagement.h\"\r\n#include \"RenderingFramework.h\"\r\n\r\nenum RENDERCOMMAND_TYPE {\r\n\tRENDERCOMMAND_SPRITE\t\t\t\t= 0x001,\r\n\tRENDERCOMMAND_CHANGERENDERSTATE\t\t= 0x002,\r\n\tRENDERCOMMAND_CHANGETARGET\t\t\t= 0x004,\r\n\tRENDERCOMMAND_EXECUTECOMMAND\t\t= 0x008,\r\n\tRENDERCOMMAND_SETSHADER\t\t\t\t= 0x010,\r\n\tRENDERCOMMAND_CLEARCOLOR\t\t\t= 0x020,\r\n\tRENDERCOMMAND_CLEARDEPTH\t\t\t= 0x040,\r\n\tRENDERCOMMAND_CLEARSTENCIL\t\t\t= 0x080,\r\n\tRENDERCOMMAND_3D\t\t\t\t\t= 0x100,\r\n\tRENDERCOMMAND_UNSETSHADER\t\t\t= 0x200,\r\n\tRENDERCOMMAND_DEPTHRANGE\t\t\t= 0x400,\r\n\tRENDERCOMMAND_IGNORE\t\t\t\t= 0x800,\r\n};\r\n\r\n// Buffer length have changed\r\n#define FLAG_BUFFERSHIFT\t\t\t\t(0x01)\r\n#define FLAG_XYUPDATE\t\t\t\t\t(0x02)\r\n#define FLAG_COLORUPDATE\t\t\t\t(0x04)\r\n#define FLAG_UVUPDATE\t\t\t\t\t(0x08)\r\n#define FLAG_IGNORERENDER\t\t\t\t(0x10)\r\n\r\n#define VERTEX_SIZE\t\t\t\t\t\t(4)\r\n#define VERTEX_U_IDX\t\t\t\t\t(VERTEX_SIZE - 2)\r\n#define VERTEX_V_IDX\t\t\t\t\t(VERTEX_SIZE - 1)\r\n\r\nclass CKLBRenderingManager;\r\n\r\nclass CKLBRenderCommand {\r\n\tfriend class CKLBRenderingManager;\r\n\tfriend class CKLBNode;\r\npublic:\r\n\tCKLBRenderCommand();\r\n\tvirtual ~CKLBRenderCommand  ()\t{ /* Do nothing */ }\r\n\r\n\tvirtual\t\r\n    void applyNode\t\t(CKLBNode* pNode)\t{ /*Do nothing by default*/pNode = pNode; /*avoid warning*/ }\r\n\t\r\n\tvoid changeOrder\t(CKLBRenderingManager& pRdr, u32 newOrder);\r\n\r\n\tinline\t\r\n    u32 getOrder        ()\t        { return m_uiOrder; }\r\n\r\n\tbool setLocalColor  (u32 color)\t{\r\n\t\t\t\tif (color != m_uiLocalColor) {\r\n\t\t\t\t\tm_uiLocalColor = color;\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\tinline \r\n    bool isInRenderList ()\t\t\t{ return ((this->m_pNext != NULL) || (this->m_pPrev != NULL));\t}\r\n\tinline \r\n    u32\tgetLocalColor   ()\t\t\t{ return m_uiLocalColor; }\r\n\r\nprotected:\r\n\tinline\r\n\tvoid incrementCount()\t\t\t{ m_uiRefCount++; }\r\n\r\n\tinline\r\n\tu8 decrementCount()\t\t\t\t{ if (m_uiRefCount > 0) { return --m_uiRefCount; } else { return 0; } }\r\n\r\n\tvirtual\tvoid setColor\t\t(const float* /*pVec*/)\t{ /*Do nothing by default*/ }\r\n\tCKLBRenderCommand*\tm_pAllocPrev;\r\n\tCKLBRenderCommand*\tm_pAllocNext;\r\n\tCKLBRenderCommand*\tm_pPrev;\r\n\tCKLBRenderCommand*\tm_pNext;\r\n\tu32\t\t\t\t\tm_uiOrder;\r\n\ts32\t\t\t\t\tm_renderOffset;\r\n\tu32\t\t\t\t\tm_uiLocalColor;\r\n\tu16\t\t\t\t\tm_commandType;\r\n\tu8\t\t\t\t\tm_uiStatus;\r\n\tu8\t\t\t\t\tm_uiRefCount;\r\n\tbool\t\t\t\tignore;\r\n};\r\n\r\nclass CKLBRenderState : public CKLBRenderCommand {\r\n\tfriend class CKLBRenderingManager;\r\n\tfriend class CKLBNode;\r\npublic:\r\n\tCKLBRenderState();\r\n\tvirtual ~CKLBRenderState();\r\n\t\r\n\tvirtual\tvoid\t\tapplyNode\t\t(CKLBNode* pNode);\r\n\t\r\n\tinline\r\n\tSRenderState*\t\tgetState\t\t()\t\t\t\t\t\t\t\t\t{ return &internalState;\t}\r\n\r\n\tinline\r\n\tCShaderInstance*\tgetShader\t\t()\t\t\t\t\t\t\t\t\t{ return pShaderInstance;\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\tCKLBRenderCommand*\tsetJump\t\t\t(CKLBRenderCommand*\tjump)\t\t\t{ this->jump = jump;\t\treturn this->jump;  }\r\n\tCKLBRenderCommand*\tsetReturn\t\t(CKLBRenderCommand*\treturn_)\t\t{ this->end\t = return_;\t\treturn this->end;   }\r\n\tvoid\t\t\t\texecuteCommand\t();\r\n\tvoid\t\t\t\tsetUse\t\t\t(bool useRenderState, bool useCommand, CShaderInstance* pShaderInstance);\r\n\tvoid\t\t\t\tsetClearColor\t(bool active, float r, float g, float b, float alpha);\r\n\tvoid\t\t\t\tsetClearDepth\t(bool active, float depth);\r\n\tvoid\t\t\t\tsetDepthRange\t(float startRange, float endRange);\r\n\tvoid\t\t\t\tsetClearStencil\t(bool active, u32 value);\r\n\tvoid\t\t\t\tsetScissor\t\t(bool active, s32 x = 0, s32 y = 0, s32 w = 0, s32 h = 0);\r\n    inline\r\n\tfloat*\t\t\t\tgetPostScissor\t()\t                                { return m_scissorPost;     }\r\nprotected:\r\n\tCKLBRenderCommand*\tjump;\r\n\tCKLBRenderCommand*\tend;\r\n\tCShaderInstance*\tpShaderInstance;\r\n\r\n\tvoid\t\t\t\tsetupShaderParams\t();\r\n\r\n\tfloat\t\t\t\tm_scissor\t\t[4];\r\n\tfloat\t\t\t\tm_scissorPost\t[4];\r\n\r\n\tGLint\t\t\t\tm_stencilClear;\r\n\tfloat\t\t\t    m_depthClear;\r\n\tfloat\t\t\t    m_colorClearRed;\r\n\tfloat\t\t\t    m_colorClearGreen;\r\n\tfloat\t\t\t    m_colorClearBlue;\r\n\tfloat\t\t\t    m_colorClearAlpha;\r\n\tfloat\t\t\t    m_depthStart;\r\n\tfloat\t\t\t    m_depthEnd;\r\n\r\n\tSRenderState internalState;\r\n};\r\n\r\nclass CTextureUsage;\r\nclass CKLBRenderCommand;\r\n\r\nclass CKLBSprite : public CKLBRenderCommand {\r\n\tfriend class CKLBRenderingManager;\r\npublic:\r\n\tCTextureUsage*\t\t\tm_pTexture;\r\n\tCTextureUsage*\t\t\tm_pMaskTexture;\r\n\tCKLBImageAsset*\t\t\tm_pImageAsset;\r\n\r\n\t// Cached pointer from Image Asset\r\n\tfloat*\t\t\t\tm_pVertex;\r\n\tfloat*\t\t\t\tm_pVertexMaskUV;\r\n\tu16*\t\t\t\tm_pIndex;\r\n\tu32*\t\t\t\tm_pColors;\r\n\r\n\t/**\r\n\t\tTriangle count\t\t= vertex count - 2.\r\n\t\tIndex buffer count\t= Triangle count * 3\r\n\t */\r\n\tu16\t\t\t\t\tm_uiVertexCount;\r\n\tu16\t\t\t\t\tm_uiIndexCount;\r\n\r\n\tvirtual\t\tvoid\tapplyNode\t\t(CKLBNode* pNode);\r\n\r\n\tbool\t\tclicked\t\t    (float u, float v);\r\n\r\n\t// Special version for 2D maps.\r\n\tvoid\t\tapplyNode\t    (CKLBNode* pNode, float tx, float ty);\r\n\r\n\tvoid\t\tswitchImage\t    (CKLBImageAsset* pImage);\r\n\tvoid\t\tsetMask\t\t    (CKLBImageAsset* pMask);\r\n\tvoid\t\tsetRenderState\t(SRenderState* pState) { m_pState = pState; }\r\n\tvoid\t\tsetClickID\t    (u32 id);\r\nprotected:\r\n\tvirtual\tvoid setColor\t\t(const float* vec4);\r\n\r\nprotected:\r\n\tSRenderState*\t\tm_pState;\r\n\tu32\t\t\t\t\tm_uiColor;\r\n\tu32\t\t\t\t\tm_click;\r\n\r\n\tu16\t\t\t\t\tm_uiMaxVertexCount;\r\n\tu16\t\t\t\t\tm_uiMaxIndexCount;\r\n\tu8\t\t\t\t\tm_bAllocated;\r\n\t//\r\n\t// Only CKLBRenderManager can construct sprites.\r\n\t//\r\nprotected:\r\n\tCKLBSprite();\r\n\tvirtual ~CKLBSprite();\r\n};\r\n\r\nclass CKLBSprite4_6 : public CKLBSprite {\r\n\tfriend class CKLBRenderingManager;\r\npublic:\r\n\tCKLBSprite4_6();\r\n\t~CKLBSprite4_6();\r\nprivate:\r\n\tfloat\tm_pBuffer[(VERTEX_SIZE+1)*4];\t// 4 vertex XYUV-Color\r\n};\r\n\r\nclass CKLBDynSprite : public CKLBSprite {\r\npublic:\r\n\tstatic const int\tMARK_CHANGE_XY\t= FLAG_XYUPDATE;\r\n\tstatic const int\tMARK_CHANGE_UV\t= FLAG_UVUPDATE;\r\n\r\n\tCKLBDynSprite();\r\n\t~CKLBDynSprite();\r\n\r\n\tbool\tsetTriangleCount(u16 vertexCount, u16 indexCount);\r\n\tvoid\tsetVertexXY\t\t(u32 index, float x, float y);\r\n\tvoid\tsetVertexUV\t\t(u32 index, float u, float v);\r\n\tvoid\tsetVertexColor\t(CKLBNode* owner, u32 index, u32 color);\r\n\tbool\timportXYUV\t\t(CKLBImageAsset* pImage);\r\n\tvoid\tsetTexture\t\t(CKLBImageAsset* pImage);\r\n\tvoid\tsetTexture\t\t(CTextureUsage*\tpUsage);\r\n\tvoid\tsetVICount\t\t(u32 vertexCount, u32 indexCount);\r\n\r\n\tvirtual\tvoid setColor\t\t(const float* vec4);\r\n\r\n\tinline void\t\tmark                (u32 mask)\t{ m_uiStatus |= mask; }\r\n\tinline float*\tgetSrcUVBuffer      ()\t        { return _internalImg.getUVBuffer();\t}\r\n\tinline float*\tgetSrcXYBuffer      ()\t        { return _internalImg.getXYBuffer();\t}\r\n\tinline u16*\t\tgetSrcIndexBuffer   ()\t        { return _internalImg.getIndexBuffer();\t}\r\nprotected:\r\n\tCKLBImageAsset _internalImg;\r\n\tu32*\tm_pLocalColors;\r\n};\r\n\r\nclass CKLBSpriteScale9 : public CKLBDynSprite {\r\npublic:\r\n\tCKLBSpriteScale9();\r\n\t~CKLBSpriteScale9();\r\n\tvoid\tsetWidth\t\t(s32 width);\r\n\tvoid\tsetHeight\t\t(s32 height);\r\n\r\n\tvoid\tuseImage\t\t(CKLBImageAsset* pImage);\r\nprotected:\r\n\tCKLBImageAsset* m_pOriginalImage;\r\n\tfloat\t\t\tm_fRight;\r\n\tfloat\t\t\tm_fBottom;\r\n\ts16\t\t\t\tm_width;\r\n\ts16\t\t\t\tm_height;\r\n\ts16\t\t\t\tm_left;\r\n\ts16\t\t\t\tm_right;\r\n\ts16\t\t\t\tm_middleX;\r\n\ts16\t\t\t\tm_top;\r\n\ts16\t\t\t\tm_bottom;\r\n\ts16\t\t\t\tm_middleY;\r\n\r\n\r\n\tvoid\trecomputeVertex\t(u32 mode);\r\n};\r\n\r\nclass CKLBPolyline : public CKLBDynSprite {\r\npublic:\r\n\tCKLBPolyline();\r\n\t~CKLBPolyline();\r\n\r\n\tbool setMaxPointCount\t(u32 ptsCount);\r\n\tvoid setPointCount\t\t(u32 ptsCount);\r\n\tvoid setPoint\t\t\t(u32 idx, float x, float y);\r\n\tvoid setColor\t\t\t(u32 color);\r\nprotected:\r\n\tvoid recomputeSegment\t(u32 idxSegment);\r\n\r\n\tu16\t\tm_maxPts;\r\n\tfloat*\tm_points;\r\nprivate:\r\n\tvoid release();\r\n};\r\n\r\nclass CKLBCanvasSprite;\r\nclass CIndexBuffer;\r\nclass CBuffer;\r\n\r\nclass CKLBRenderingManager {\r\npublic:\r\n\tinline\r\n\tstatic CKLBRenderingManager& getInstance() {\r\n\t\tstatic CKLBRenderingManager instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release() {\tgetInstance()._release();\t}\r\n\r\n\tbool\t\tsetup(u16 maxVertexCount, u16 maxIndexCount);\r\n\r\n\t// Rendering Allocation.\r\n\tCKLBSprite*         allocateCommandSprite\t    (CKLBImageAsset* pImage, u32 priority = 0);\r\n\tCKLBSprite*         allocateCommandSprite\t    (u16 maxVertexCount, u16 maxIndexcount, u32 priority = 0);\r\n\tCKLBDynSprite*      allocateCommandDynSprite    (u16 vertexCount, u16 indexCount, u32 priority = 0);\r\n\tCKLBCanvasSprite*   allocateCommandCanvasSprite (u32 vertexCount, u32 indexCount, u32 priority = 0);\r\n\tCKLBRenderState*\tallocateCommandState\t    ();\r\n\tCKLBPolyline*       allocateCommandPolyline\t    (u16 maxPointCount, u32 priority);\r\n\r\n\tvoid\t\treleaseCommand\t\t\t(CKLBRenderCommand* pCommand);\r\n\r\n\tvoid\t\tremoveFromRendering\t\t(CKLBRenderCommand* pRender);\r\n\tvoid\t\taddToRendering\t\t\t(CKLBRenderCommand* pRender, u32 uiOrder);\r\n\r\n\t// Rendering.\r\n\tvoid\t\tenableRange\t\t\t\t(u32 start, u32 end, bool active);\r\n\tvoid\t\tdraw\t\t\t\t\t();\r\n\tvoid\t\tdrawOverdraw\t\t\t();\r\n\r\n\tCKLBRenderCommand*\r\n\t\t\t\tdrawClick\t\t\t\t(u32 x, u32 y);\r\n\tvoid\t\tdump\t\t\t\t\t(u32 mask);\r\n\tvoid\t\tdumpMetrics\t\t\t\t();\r\nSRenderState*\tgetTextState\t\t\t()\t        { return &textState; }\r\n\tvoid\t\tsetRenderMode\t\t\t(u32 mode);\r\n\r\n\tvoid\t\trenderOverdraw\t\t\t(u32 mode)\t{ m_bRenderOverDraw = mode; }\r\n\r\n\t//======================================================================================\r\n\t//  Shader support\r\n\t//======================================================================================\r\nprivate:\r\n\tu32\t\t\tm_bRenderOverDraw;\r\n\r\n\tstruct S_SHADERDEF {\r\n\t\tCShaderSet*\t\t\tm_definition;\r\n\t\tCShader*\t\t\tm_pixelShader;\r\n\t\tu8*\t\t\t\t\tm_paramList;\r\n\t};\r\n\r\n\tstruct S_SHADERINSTANCE {\r\n\t\tS_SHADERINSTANCE*\tm_pNext;\r\n\t\tCShaderInstance*\tm_pInstanceShader;\r\n\t\tu32\t\t\t\t\tm_min;\r\n\t\tu32\t\t\t\t\tm_max;\r\n\t\tu8*\t\t\t\t\tm_paramList;\r\n\t};\r\n\r\n\t#define SHADER_DEF_MAX\t\t(20)\r\n\t\r\n\tS_SHADERDEF\t\t\tm_shaderDef[SHADER_DEF_MAX];\r\n\tu8\t\t\t\t\tm_stackParam[1000];\r\n\tu8*\t\t\t\t\tm_stackParamFiller;\r\n\tS_SHADERINSTANCE*\tm_shaderInstanceList;\t// TODO : set NULL at start, delete all when free rendering manager.\r\n\r\n\tCShaderInstance*\tm_stackShader\t[10];\r\n\tu32\t\t\t\t\tm_stackShaderIdx;\r\n\tbool\t\t\t\tm_coloring;\r\n\r\nprotected:\r\n\tvoid initShaderSystem\t\t();\r\n\tvoid destroyShaderSystem\t();\r\n\tvoid completeParameter\t\t();\r\npublic:\r\n\tvoid stackParameter\t\t\t(const char* name, u8 type, QUALITY_TYPE quality);\r\n\tu32  createShaderDefinition\t(const char* shaderCode);\r\n\tvoid destroyShaderDefinition(u32 shaderDefinition);\r\n\t\r\n\tvoid* instanceShader\t\t(u32 shaderDefinition, u32 startRange, u32 endRange);\r\n\tvoid removeShader\t\t\t(void* instanceShader);\r\n\t\r\n\tvoid setShaderParamI\t\t(void* instanceShader, const char* name, GLint* value);\r\n\tvoid setShaderParamF\t\t(void* instanceShader, const char* name, GLfloat* value);\r\n\tvoid setShaderParamTexture\t(void* instanceShader, const char* name, CTextureUsage* value);\r\n\t//======================================================================================\r\n\t//  /Shader support\r\n\t//======================================================================================\r\n\r\nprivate:\r\n\tCKLBRenderingManager\t();\r\n\t~CKLBRenderingManager\t();\r\n\tvoid\t\t_release\t();\r\n\r\n\tCKLBRenderingManager\t(CKLBRenderingManager const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t\t(CKLBRenderingManager const&);\t\t// Dont implement.\r\n\r\n\r\n\tvoid emitDrawCall\t\t(u16*\tpIndexCounter,\r\n\t\t\t\t\t\t\t u16*\toffsetIndex,\r\n\t\t\t\t\t\t\t u16*\toffsetVertex,\r\n\t\t\t\t\t\t\t u16\toffsetVertexHead,\r\n\t\t\t\t\t\t\t CTextureUsage*\tpTextureUsage,\r\n\t\t\t\t\t\t\t CTextureUsage* pMask);\r\n\tCKLBRenderCommand\t\tm_innerWatchDog;\r\n\tCKLBRenderCommand*\t\tm_pListStart;\r\n\tCKLBRenderCommand*\t\tm_pRenderWatchDog;\r\n\tCKLBRenderCommand*\t\tm_pRenderLastModify;\r\n\tCKLBRenderCommand*\t\tm_pAllocatedSpriteList;\r\n\tCIndexBuffer*\t\t\tm_pIdxBuffer;\r\n\tCBuffer*\t\t\t\tm_pVerBuffer;\r\n\tCBuffer*\t\t\t\tm_pColBuffer;\r\n\tSRenderState\t\t\tstate;\r\n\tSRenderState\t\t\ttextState;\r\n\tSRenderState*\t\t\tm_pCurrState;\r\n\r\n\tCShader*\t\t\t\tm_pVShader;\r\n\tCShader*\t\t\t\tm_pPShader;\r\n\tCShaderSet*\t\t\t\tm_pShaderSet;\r\n\tCShaderInstance*\t\tm_pShaderInstance;\r\n\tCShaderInstance*\t\tm_pCurrShader;\r\n\tCTextureUsage*\t\t\tm_pTextureUsage;\r\n\r\n\tu32\t\tm_renderMode;\r\n\tu32\t\tm_callMode;\r\n\tbool\tm_useTextures;\r\n\tbool\tm_useColor;\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tu32 m_vertexCount;\r\n\tu32 m_indexCount;\r\n\tu32 m_spriteCount;\r\n\tu32 m_renderStateChange;\r\n\tu32 m_textureChange;\r\n\tu32 m_totalTransferSize;\r\n\tu32 m_memCopySize;\r\n\tu32 m_drawCall;\r\n\ts64 m_drawTime;\r\n#endif\r\n\r\n};\r\n\r\nvoid useOffsetForImages(bool use);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Rendering/CKLBRenderingManager.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBRendering.h\"\r\n#include \"mem.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBSprite3D.h\"\r\n\r\nu32\tgUseOffsetSystem = 1;\r\n\r\n// Prototypes\r\nu32  searchID(u8* stream, const char* name);\r\nu32  getColor(u32 code);\r\nbool crossLine(float x1, float y1, float x2, float y2, float px, float py, float cx, float cy);\r\n\r\nvoid useOffsetForImages(bool use) {\r\n\tgUseOffsetSystem = use ? 1 : 0;\r\n}\r\n\r\n//\r\n// #define USE_PREMULALPHA\r\n\r\nCKLBRenderingManager::CKLBRenderingManager():\r\n\tm_pListStart\t\t\t(NULL),\r\n\tm_pAllocatedSpriteList\t(NULL),\r\n\tm_pIdxBuffer\t\t\t(NULL),\r\n\tm_pVerBuffer\t\t\t(NULL),\r\n\tm_pColBuffer\t\t\t(NULL),\r\n\tm_pRenderWatchDog\t\t(NULL),\r\n\tm_pRenderLastModify\t\t(NULL),\r\n\tm_pVShader\t\t\t\t(NULL),\r\n\tm_pPShader\t\t\t\t(NULL),\r\n\tm_pShaderSet\t\t\t(NULL),\r\n\tm_pShaderInstance\t\t(NULL),\r\n\tm_pCurrShader\t\t\t(NULL),\r\n\tm_renderMode\t\t\t(0),\r\n\tm_bRenderOverDraw\t\t(false),\r\n\tm_coloring\t\t\t\t(false)\r\n{\r\n\tsetRenderMode(m_renderMode);\r\n}\r\n\r\nCKLBRenderingManager::~CKLBRenderingManager() {\r\n\t_release();\r\n}\r\n\r\nvoid CKLBRenderingManager::_release() {\r\n\t/* NEVER DESTROY THE RENDER QUEUE BUT\r\n\t   DESTROY THE LIST OF ALLOCATED RENDER ITEM !!!! */\r\n\t/*\t### NO ###\r\n\tCKLBRenderCommand* pCommand = m_pAllocatedSpriteList;\r\n\twhile (pCommand) {\r\n\t\tCKLBRenderCommand* pNext = pCommand->m_pNext;\r\n\t\tif (pNext != m_pRenderWatchDog) {\r\n\t\t\t// KLBDELETE(pCommand);\r\n\t\t}\r\n\t\tpCommand = pNext;\r\n\t}*/\r\n\t// ### YES ###\r\n\tCKLBRenderCommand* pRenderQueue = m_pListStart;\r\n\twhile (pRenderQueue != m_pRenderWatchDog) {\r\n\t\tCKLBRenderCommand* pRenderQueueNext = pRenderQueue->m_pNext;\r\n\t\tKLBDELETE(pRenderQueue);\r\n\t\tpRenderQueue = pRenderQueueNext;\r\n\t}\r\n\r\n\tm_pListStart = m_pRenderWatchDog;\r\n\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\t\t\t= CKLBOGLWrapper::getInstance();\r\n\tif (m_pIdxBuffer) {\r\n\t\tpOGLMgr.releaseIndexBuffer(m_pIdxBuffer);\r\n\t\tm_pIdxBuffer = NULL;\r\n\t}\r\n\r\n\tif (m_pVerBuffer) {\r\n\t\tpOGLMgr.releaseVertexBuffer(m_pVerBuffer);\r\n\t\tm_pVerBuffer = NULL;\r\n\t}\r\n\r\n\tif (m_pColBuffer) {\r\n\t\tpOGLMgr.releaseVertexBuffer(m_pColBuffer);\r\n\t\tm_pColBuffer = NULL;\r\n\t}\r\n\r\n\tif (m_pShaderInstance) {\r\n\t\tm_pShaderSet->releaseInstance(m_pShaderInstance);\r\n\t\tm_pShaderInstance = NULL;\r\n\t}\r\n\r\n\tif (m_pShaderSet) {\r\n\t\tpOGLMgr.releaseShaderSet(m_pShaderSet);\r\n\t\tm_pShaderSet = NULL;\r\n\t}\r\n\r\n\tdestroyShaderSystem();\r\n\r\n\t/* Destroyed by ref counter from ShaderSet\r\n\tif (m_pVShader) {\r\n\t\tpOGLMgr.releaseShader(m_pVShader);\r\n\t\tm_pVShader = NULL;\r\n\t}\r\n\r\n\tif (m_pPShader) {\r\n\t\tpOGLMgr.releaseShader(m_pPShader);\r\n\t\tm_pPShader = NULL;\r\n\t}*/\r\n}\r\n\r\nstatic const SVertexEntry cteListVertex[3] = {\r\n\t//\tStreamID\tOffset\tVBO?\tType\r\n#if (VERTEX_SIZE == 4) \r\n\t{\t\t1,\t\t0,\t\tfalse,\tVEC2\t | VERTEX},\t// Coordinate.\r\n#else\r\n\t{\t\t1,\t\t0,\t\tfalse,\tVEC3\t | VERTEX},\t// Coordinate.\r\n#endif\r\n\t{\t\t2,\t\t0,\t\tfalse,\tVEC2\t | TEXTURE},\t// Texture UV.\r\n\t{ /*NA*/0,/*NA*/0,/*NA*/false,\tEND_LIST}\t// Mark end of list.\r\n};\r\n\r\n\r\nstatic const SVertexEntry cteListColor[2] = {\r\n\t//\tStreamID\tOffset\tVBO?\tType\r\n\t{\t\t3,\t\t0,\t\tfalse,\tVEC4BYTE | COLOR},\r\n\t{ /*NA*/0,/*NA*/0,/*NA*/false,\tEND_LIST}\t// Mark end of list.\r\n};\r\n\r\nbool CKLBRenderingManager::setup(u16 maxVertexCount, u16 maxIndexCount) {\r\n\t// -------------------------------------------------------------------\r\n\t//   OpenGL Initialize.\r\n\t// -------------------------------------------------------------------\r\n\r\n\t//--------------------------------------------------------------------\r\n\t// Setup Blending between Tex0 and Tex1 in multi texture mode\r\n\t//\r\n\r\n\t// Disable Color0 * Tex0\r\n\t//dglActiveTexture(GL_TEXTURE0);\r\n\t//dglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);\r\n\r\n\tdglActiveTexture(GL_TEXTURE1);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);\r\n\t//--------------------------------------------------------------------\r\n\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\r\n\t\t\t\t\t= CKLBOGLWrapper::getInstance();\r\n\tm_pIdxBuffer\t= pOGLMgr.createIndexBuffer(maxIndexCount, false);\r\n\tm_pVerBuffer\t= pOGLMgr.createVertexBuffer(maxVertexCount, &cteListVertex[0]);\r\n\tm_pColBuffer\t= pOGLMgr.createVertexBuffer(maxVertexCount, &cteListColor[0]);\r\n\r\n\t// TODO RP : Hardcoded shader, vertex format.\r\n\t//   Render state,\r\n\t// -------------------------------------- SHADER\r\n\tconst static SParam paramsVert[] = {\r\n\t\t// Name\t\t\t\tUniform?\tStreamID\tData Type\r\n\t\t//\t\t\t\t\t\t\t\tor\r\n\t\t//\t\t\t\t\t\t\t\tUniformID\r\n#if (VERTEX_SIZE == 4) \r\n\t\t{\t\"pos_attr\"\t\t,false\t\t,1\t\t\t,VEC2\t| VERTEX },\t// Coordinate.\r\n#else\r\n\t\t{\t\"pos_attr\"\t\t,false\t\t,1\t\t\t,VEC3\t| VERTEX },\t// Coordinate.\r\n#endif\r\n\t\t{\t\"uv_attr\"\t\t,false\t\t,2\t\t\t,VEC2\t| TEXTURE},\t// UV.\r\n\t\t{   \"col_attr\"\t\t,false\t\t,3\t\t\t,VEC4BYTE | COLOR},\r\n\t\t{\t\"\"\t\t\t\t,false\t\t,0\t\t\t,END_LIST}\t// Mark end of list.\r\n\t};\r\n\r\n\tconst static SParam paramsShader[] = {\r\n\t\t// Name\t\t\t\tUniform?\tStreamID\tData Type\r\n\t\t//\t\t\t\t\t\t\t\tor\r\n\t\t//\t\t\t\t\t\t\t\tUniformID\r\n\t\t{\t\"texture\"\t\t,true\t\t,1\t\t\t,TEX2D    | TEXTURE },\r\n//\t\t{\t\"power\"\t\t\t,true\t\t,2\t\t\t,VEC1F\t\t\t\t},\r\n//\t\t{\t\"table\"\t\t\t,true\t\t,1\t\t\t,TEX2D    | TEXTURE },\r\n\t\t{\t\"\"\t\t\t\t,false\t\t,0\t\t\t,END_LIST}\t\t// Mark end of list.\r\n\t};\r\n\r\n\t// Create shader vertex & pixel\r\n\tSRenderState::RENDER_MODE mode = SRenderState::TEXTURE_MUL_COLOR;\r\n\tm_pVShader\t\t= pOGLMgr.createShader(mode, CKLBOGLWrapper::VERTEX_SHADER, paramsVert);\r\n\tm_pPShader\t\t= pOGLMgr.createShader(mode, CKLBOGLWrapper::PIXEL_SHADER, paramsShader);\r\n\r\n\t// Map the shader together.\r\n\tm_pShaderSet\t= pOGLMgr.createShaderSet(m_pVShader, m_pPShader);\r\n\t// Create instance of shader for param\r\n\tm_pShaderInstance = m_pShaderSet->createInstance();\r\n\t// ----------------------------------------------\r\n\r\n/*\r\n\tfloat val = 0.45f;\r\n\tm_pShaderInstance->setUniformF(CShaderInstance::PIXEL_SHADER, 2, &val);\r\n*/\r\n\t// -------------------------------------------------------------------\r\n\t//   Manager Initialize.\r\n\t// -------------------------------------------------------------------\r\n\r\n\tm_pRenderWatchDog\t\t\t\t= &m_innerWatchDog;\r\n\tm_pListStart\t\t\t\t\t= m_pRenderWatchDog;\r\n\tm_pRenderWatchDog->m_uiOrder\t= 0xFFFFFFFF;\t// Always at the end.\r\n\tm_pRenderLastModify\t\t\t\t= m_pRenderWatchDog;\r\n\r\n#ifdef USE_PREMULALPHA\r\n\tstate.setBlend(SRenderState::ADDITIVE_ALPHA);\r\n#else\r\n\tstate.setBlend(SRenderState::ALPHA);\r\n#endif\r\n\t// state.setTextMode(false); UNDEFINED BY DEFAULT.\r\n\r\n\t// Dest\r\n\t/*\r\n\t\tD_ONE\t\t\t\t\t\t= GL_ONE,\r\n\t\tD_SRC_COLOR\t\t\t\t\t= GL_SRC_COLOR,\r\n\t\tD_ONE_MINUS_SRC_COLOR\t\t= GL_ONE_MINUS_SRC_COLOR,\r\n\t\tD_SRC_ALPHA\t\t\t\t\t= GL_SRC_ALPHA,\r\n\t\tD_ONE_MINUS_SRC_ALPHA\t\t= GL_ONE_MINUS_SRC_ALPHA,\r\n\t\tD_DST_ALPHA\t\t\t\t\t= GL_DST_ALPHA,\r\n\t\tD_ONE_MINUS_DST_ALPHA\t\t= GL_ONE_MINUS_DST_ALPHA\r\n\t */\r\n\r\n\t// Src\r\n\t/*enum BLEND_SRC {\r\n\t\tS_ZERO\t\t\t\t\t\t= GL_ZERO,\r\n\t\tS_ONE\t\t\t\t\t\t= GL_ONE,\r\n\t\tS_DST_COLOR\t\t\t\t\t= GL_DST_COLOR,\r\n\t\tS_ONE_MINUS_DST_COLOR\t\t= GL_ONE_MINUS_DST_COLOR,\r\n\t\tS_SRC_ALPHA_SATURATE\t\t= GL_SRC_ALPHA_SATURATE,\r\n\t\tS_SRC_ALPHA\t\t\t\t\t= GL_SRC_ALPHA,\r\n\t\tS_ONE_MINUS_SRC_ALPHA\t\t= GL_ONE_MINUS_SRC_ALPHA,\r\n\t\tS_DST_ALPHA\t\t\t\t\t= GL_DST_ALPHA,\r\n\t\tS_ONE_MINUS_DST_ALPHA\t\t= GL_ONE_MINUS_DST_ALPHA\r\n\t*/\r\n//\ttextState.setBlendAdvance(SRenderState::S_ONE, SRenderState::D_ONE_MINUS_SRC_ALPHA,SRenderState::ADD /*Add is mandatory in ES2.0*/);\r\n\ttextState.setTextMode(true);\r\n\t//\tsetBlendAdvance(SRenderState::S_ONE, SRenderState::D_ONE_MINUS_SRC_COLOR,SRenderState::ADD /*Add is mandatory in ES2.0*/);\r\n\r\n\tinitShaderSystem();\r\n\r\n\t// ===========================================================\r\n\t//\r\n\t// Test Code : Shader that modify the color strength (grey-scale <--> saturation)\r\n\t//\r\n\t/*\r\n\t// Create Parameter\r\n\tthis->stackParameter(\"power\", VEC1F, MEDP);\r\n\tu32 def = this->createShaderDefinition(\r\n\t\t\"varying lowp vec4 col_var;\\n\"\t\t\t// Cte\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\t\t// Cte\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\t\t// Cte\r\n\t\t\"uniform mediump float power;\\n\"\t\t// Param\r\n\t\t\"const lowp vec3 coef = vec3(0.2125, 0.7154, 0.0721);\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"   lowp vec4 color     = texture2D(texture,uv_var) * col_var;\\n\"\t\t\t// Read Texture\r\n\t\t\"\tgl_FragColor        = mix(vec4(vec3(dot(color.rgb, coef)),color.a),color,power);\\n\"\r\n//\t\t\"   gl_FragColor        = texture2D(texture,floor(uv_var*power)/power) * col_var;\\n\" // Mosaic\r\n\t\t\"}\"\r\n\t);\r\n\r\n\t// Create Shader Instance\r\n\tvoid* shaderI = this->instanceShader(def, 2000, 0x40000000);\r\n\r\n\t// Setup Shader Parameter\r\n\tfloat valuef = 300.0f;\r\n\tthis->setShaderParamF(shaderI, \"power\", &valuef);\r\n\t// ===========================================================\r\n\t*/\r\n\r\n\treturn (m_pIdxBuffer && m_pVerBuffer && m_pColBuffer && m_pVShader && m_pShaderSet && m_pShaderInstance);\r\n}\r\n\r\nvoid CKLBRenderingManager::setRenderMode(u32 mode) {\r\n\tm_renderMode = mode;\r\n\tswitch (mode) {\r\n\tcase 0:\r\n\t\tm_callMode\t\t= GL_TRIANGLES;\r\n\t\tm_useTextures\t= true;\r\n\t\tm_useColor\t\t= true;\r\n\t\tbreak;\r\n\tcase 1:\r\n\t\tm_callMode\t\t= GL_LINE_STRIP;\r\n\t\tm_useTextures\t= false;\r\n\t\tm_useColor\t\t= false;\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nCKLBSprite* CKLBRenderingManager::allocateCommandSprite(CKLBImageAsset* pImage, u32 priority) {\r\n\tklb_assert(m_pRenderWatchDog, \"CKLBRenderingManager::setup not done first\");\r\n\tklb_assert(pImage, \"Null Image definition\");\r\n\tbool isScale9\t= (pImage->hasStandardAttribute(CKLBImageAsset::IS_SCALE9) != 0);\r\n\tbool isStdRect\t= (pImage->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT) != 0);\r\n\tCKLBSprite* pSpr = isScale9 ? KLBNEW(CKLBSpriteScale9) : isStdRect ? KLBNEW(CKLBSprite4_6) : KLBNEW(CKLBSprite);\r\n\tif (pSpr) {\r\n\t\tif (isScale9) {\r\n\t\t\tif (((CKLBDynSprite*)pSpr)->setTriangleCount(16, 54)) {\r\n\t\t\t\t// SETUP BEFORE USE IMAGE !\r\n\t\t\t\tpSpr->m_renderOffset\t= (pImage->m_renderOffset * gUseOffsetSystem);\r\n\t\t\t\tpSpr->m_uiOrder\t\t\t= priority + pSpr->m_renderOffset;\r\n\r\n\t\t\t\t((CKLBSpriteScale9*)pSpr)->useImage(pImage);\r\n\t\t\t\tpSpr->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\t\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pSpr;\r\n\t\t\t\t}\r\n\t\t\t\tm_pAllocatedSpriteList\t\t= pSpr;\r\n\t\t\t\tpSpr->m_uiStatus\t\t\t= FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\t\t\t\tpSpr->m_pState\t\t\t\t= &this->state;\r\n\t\t\t\treturn pSpr;\r\n\t\t\t} else {\r\n\t\t\t\tKLBDELETE(pSpr);\r\n\t\t\t\tpSpr = NULL;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tu32 floatCount\t\t= pImage->getVertexCount() * VERTEX_SIZE;\t// X,Y,(Z),U,V\r\n\t\t\tfloat*  arr\t\t\t= isStdRect ? ((CKLBSprite4_6*)pSpr)->m_pBuffer : KLBNEWA(float, floatCount + pImage->getVertexCount());\r\n\t\t\tu32* arrCol\t\t\t= (u32*)&arr[floatCount];\r\n\r\n\t\t\tif (arr) {\r\n\t\t\t\tpSpr->m_pImageAsset\t\t= pImage;\r\n\t\t\t\tpSpr->m_pVertex\t\t\t= arr;\r\n\t\t\t\tpSpr->m_pColors\t\t\t= arrCol;\r\n\t\t\t\tpSpr->m_pIndex\t\t\t= pImage->getIndexBuffer();\t// Cache\r\n\t\t\t\tpSpr->m_uiVertexCount\t= (u16)pImage->getVertexCount();\r\n\t\t\t\tpSpr->m_uiIndexCount\t= (u16)pImage->getIndexCount();\r\n\t\t\t\tpSpr->m_uiMaxVertexCount= (u16)pImage->getVertexCount();\r\n\t\t\t\tpSpr->m_uiMaxIndexCount = (u16)pImage->getIndexCount();\r\n\t\t\t\tpSpr->m_renderOffset\t= (pImage->m_renderOffset * gUseOffsetSystem);\r\n\r\n\t\t\t\tpSpr->m_uiColor = 0xFFFFFFFF;\t// Set default local color.\r\n\t\t\t\tmemset32(arrCol, 0xFFFFFFFF, pSpr->m_uiVertexCount*sizeof(u32));\r\n\r\n\t\t\t\tif (VERTEX_SIZE > 4) {\r\n\t\t\t\t\tmemset32(arr, 0, pSpr->m_uiVertexCount * VERTEX_SIZE * sizeof(float));\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpSpr->m_pTexture\t\t\t= pImage->getTexture()->m_pTextureUsage;\r\n\t\t\t\tpSpr->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\t\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pSpr;\r\n\t\t\t\t}\r\n\t\t\t\tpSpr->m_uiStatus\t\t\t= FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\t\t\t\tpSpr->m_uiOrder\t\t\t\t= priority + (pImage->m_renderOffset * gUseOffsetSystem);\r\n\t\t\t\tm_pAllocatedSpriteList\t\t= pSpr;\r\n\t\t\t\tpSpr->m_pState\t\t\t\t= &this->state;\r\n\t\t\t} else {\r\n\t\t\t\tif (arr)\t{ KLBDELETEA(arr);\t\t}\r\n\r\n\t\t\t\tKLBDELETE(pSpr);\r\n\t\t\t\tpSpr = NULL;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn pSpr;\r\n}\r\n\r\nCKLBDynSprite* CKLBRenderingManager::allocateCommandDynSprite(u16 vertexCount, u16 indexCount, u32 priority) {\r\n\tCKLBDynSprite* pSpr = KLBNEW(CKLBDynSprite);\r\n\tif (pSpr) {\r\n\t\tif (pSpr->setTriangleCount(vertexCount, indexCount)) {\r\n\t\t\tpSpr->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pSpr;\r\n\t\t\t}\r\n\t\t\tm_pAllocatedSpriteList\t\t= pSpr;\r\n\t\t\tpSpr->m_uiOrder\t\t\t\t= priority;\r\n\t\t\tpSpr->m_pState\t\t\t\t= &this->state;\r\n\t\t\treturn pSpr;\r\n\t\t}\r\n\t\tKLBDELETE(pSpr);\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nCKLBSprite* CKLBRenderingManager::allocateCommandSprite(u16 maxVertexCount, u16 maxIndexCount, u32 priority) {\r\n\tbool isPreAlloc = (maxVertexCount==4 && maxIndexCount==6);\r\n\tCKLBSprite* pSpr = isPreAlloc ? KLBNEW(CKLBSprite4_6) : KLBNEW(CKLBSprite);\r\n\tif (pSpr) {\r\n\t\tu32 floatCount\t\t= maxVertexCount * VERTEX_SIZE;\t// X,Y,U,V\r\n\r\n\t\tfloat*\tarr\t\t\t= isPreAlloc ? ((CKLBSprite4_6*)pSpr)->m_pBuffer : KLBNEWA(float,floatCount + maxIndexCount);\r\n\t\tu32* arrCol\t\t\t= (u32*)&arr[floatCount];\r\n\r\n\t\tif (arr) {\r\n\t\t\tpSpr->m_pImageAsset\t\t= NULL;\r\n\t\t\tpSpr->m_pVertex\t\t\t= arr;\r\n\t\t\tif (VERTEX_SIZE > 4) { memset32(arr, 0, floatCount * sizeof(float)); }\r\n\t\t\tpSpr->m_pColors\t\t\t= arrCol;\r\n\t\t\tpSpr->m_pIndex\t\t\t= NULL;\t// Cache\r\n\t\t\tpSpr->m_uiVertexCount\t= 0;\r\n\t\t\tpSpr->m_uiIndexCount\t= 0;\r\n\t\t\tpSpr->m_uiMaxVertexCount= maxVertexCount;\r\n\t\t\tpSpr->m_uiMaxIndexCount = maxIndexCount;\r\n\r\n\t\t\tpSpr->m_uiColor = 0xFFFFFFFF;\t// Set default local color.\r\n\t\t\tpSpr->m_uiOrder\t\t\t\t= priority;\r\n\t\t\tmemset32(arrCol, 0xFFFFFFFF, maxVertexCount*sizeof(u32));\r\n\t\t\tpSpr->m_pState\t\t\t\t= &this->state;\r\n\r\n\t\t\tpSpr->m_pTexture\t\t\t= NULL;\r\n\t\t\tpSpr->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pSpr;\r\n\t\t\t}\r\n\t\t\tm_pAllocatedSpriteList\t\t= pSpr;\r\n\t\t} else {\r\n\t\t\tif (arr)\t{ KLBDELETEA(arr);\t\t}\r\n\r\n\t\t\tKLBDELETE(pSpr);\r\n\t\t\tpSpr = NULL;\r\n\t\t}\r\n\t}\r\n\treturn pSpr;\r\n}\r\n\r\nCKLBRenderState* CKLBRenderingManager::allocateCommandState() {\r\n\tCKLBRenderState* pComm = KLBNEW(CKLBRenderState);\r\n\tif (pComm) {\r\n\t\tpComm->jump\t\t\t\t\t= NULL;\r\n\t\tpComm->end\t\t\t\t\t= NULL;\r\n\t\tpComm->pShaderInstance\t\t= NULL;\r\n\r\n\t\tpComm->m_scissor[0]\t\t\t= 0.0f;\r\n\t\tpComm->m_scissor[1]\t\t\t= 0.0f;\r\n\t\tpComm->m_scissor[2]\t\t\t= 0.0f;\r\n\t\tpComm->m_scissor[3]\t\t\t= 0.0f;\r\n\r\n\t\tpComm->m_scissorPost[0]\t\t= 0.0f;\r\n\t\tpComm->m_scissorPost[1]\t\t= 0.0f;\r\n\t\tpComm->m_scissorPost[2]\t\t= 0.0f;\r\n\t\tpComm->m_scissorPost[3]\t\t= 0.0f;\r\n\r\n\t\tpComm->m_stencilClear\t\t= 0;\r\n\t\tpComm->m_depthClear\t\t\t= 0.0f;\r\n\t\tpComm->m_colorClearRed\t\t= 0.0f;\r\n\t\tpComm->m_colorClearGreen\t= 0.0f;\r\n\t\tpComm->m_colorClearBlue\t\t= 0.0f;\r\n\t\tpComm->m_colorClearAlpha\t= 0.0f;\r\n\t\tpComm->m_depthStart\t\t\t= 0.0f;\r\n\t\tpComm->m_depthEnd\t\t\t= 0.0f;\r\n\r\n\t\t/*\r\n\t\tmemset(&pComm->internalState,0,sizeof(SRenderState));\r\n\t\t*/\r\n\t\tpComm->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pComm;\r\n\t\t}\r\n\t\tm_pAllocatedSpriteList\t\t= pComm;\r\n\t\tpComm->m_uiStatus = 0;\r\n\t}\r\n\treturn pComm;\r\n}\r\n\r\nCKLBPolyline* CKLBRenderingManager::allocateCommandPolyline(u16 maxPointCount, u32 priority) {\r\n\tCKLBPolyline* pLine = KLBNEW(CKLBPolyline);\r\n\tif (pLine) {\r\n\t\tif (pLine->setMaxPointCount(maxPointCount)) {\r\n\t\t\tpLine->m_pState\t\t\t\t= &this->state;\r\n\r\n\t\t\tpLine->m_uiOrder\t\t\t= priority;\r\n\t\t\tpLine->m_pAllocNext\t\t\t= m_pAllocatedSpriteList;\r\n\t\t\tif (m_pAllocatedSpriteList) {\r\n\t\t\t\tm_pAllocatedSpriteList->m_pAllocPrev = pLine;\r\n\t\t\t}\r\n\t\t\tm_pAllocatedSpriteList\t\t= pLine;\r\n\t\t}\r\n\t}\r\n\treturn pLine;\r\n}\r\n\r\nvoid CKLBRenderingManager::releaseCommand(CKLBRenderCommand* pCommand) {\r\n\tklb_assert(m_pRenderWatchDog, \"CKLBRenderingManager::setup not done first\");\r\n\tklb_assert(pCommand, \"null pointer\");\r\n\r\n\t//\r\n\t// Remove from rendering path.\r\n\t//\r\n\tif (pCommand->m_pNext || pCommand->m_pPrev) {\r\n\t\tremoveFromRendering(pCommand);\r\n\t}\r\n\r\n\tif (pCommand->decrementCount() != 0) { return; }\r\n\r\n\t//\r\n\t// Remove from link list.\r\n\t//\r\n\tif (pCommand->m_pAllocPrev) {\r\n\t\tpCommand->m_pAllocPrev->m_pAllocNext = pCommand->m_pAllocNext;\r\n\t} else {\r\n\t\tm_pAllocatedSpriteList\t\t= pCommand->m_pAllocNext;\r\n\t}\r\n\r\n\tif (pCommand->m_pAllocNext) {\r\n\t\tpCommand->m_pAllocNext->m_pAllocPrev\t= pCommand->m_pAllocPrev;\r\n\t}\r\n\r\n\tKLBDELETE(pCommand);\r\n}\r\n\r\nvoid CKLBRenderingManager::removeFromRendering(CKLBRenderCommand* pRender) {\r\n\tklb_assert(m_pRenderWatchDog, \"CKLBRenderingManager::setup not done first\");\r\n\tklb_assert(pRender,\"null pointer\");\r\n\tklb_assert((pRender->m_pNext || pRender->m_pPrev),\"Item already not in rendering list\");\r\n\r\n\tpRender->m_pNext->m_pPrev\t= pRender->m_pPrev;\r\n\tif (pRender->m_pPrev) {\r\n\t\tpRender->m_pPrev->m_pNext\t= pRender->m_pNext;\r\n\t} else {\r\n\t\tm_pListStart\t\t\t\t= pRender->m_pNext;\r\n\t}\r\n\r\n\tif (pRender == m_pRenderLastModify) {\r\n\t\tm_pRenderLastModify = m_pRenderLastModify->m_pNext;\r\n\t}\r\n\r\n\t// Update renderer that reuse of buffer is becoming useless from this point.\r\n\tpRender->m_pNext->m_uiStatus |= FLAG_BUFFERSHIFT;\r\n\tpRender->m_pNext = NULL;\r\n\tpRender->m_pPrev = NULL;\r\n}\r\n\r\nvoid CKLBRenderingManager::initShaderSystem() {\r\n\tfor (int n=0; n < SHADER_DEF_MAX; n++) {\r\n\t\tm_shaderDef[n].m_definition\t\t= NULL;\r\n\t\tm_shaderDef[n].m_paramList\t\t= NULL;\r\n\t\tm_shaderDef[n].m_pixelShader\t= NULL;\r\n\t}\r\n\tm_shaderInstanceList = NULL;\r\n\tm_stackParamFiller\t = m_stackParam;\r\n}\r\n\r\nvoid CKLBRenderingManager::destroyShaderSystem() {\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\tS_SHADERINSTANCE* pShader = m_shaderInstanceList;\r\n\twhile (pShader) {\r\n\t\tS_SHADERINSTANCE* pNext = pShader->m_pNext;\r\n\t\t// Do not : KLBDELETEA(pShader->m_paramList);  Simple cache here.\r\n\t\tKLBDELETE(pShader);\r\n\t\t// Shader Instance shader freed by Definition.\r\n\t\tpShader = pNext;\r\n\t}\r\n\tm_shaderInstanceList = NULL;\r\n\r\n\tfor (int n=0; n < SHADER_DEF_MAX; n++) {\r\n\t\tif (m_shaderDef[n].m_definition) {\r\n\t\t\tpOGLMgr.releaseShaderSet(m_shaderDef[n].m_definition);\r\n\t\t}\r\n\t\tKLBDELETEA(m_shaderDef[n].m_paramList);\r\n\t\tm_shaderDef[n].m_definition\t\t= NULL;\r\n\t\tm_shaderDef[n].m_paramList\t\t= NULL;\r\n\t\tm_shaderDef[n].m_pixelShader\t= NULL;\r\n\t}\r\n}\r\n\r\nvoid CKLBRenderingManager::stackParameter(const char* name, u8 type, QUALITY_TYPE quality) {\r\n\tu32 strLen = strlen(name) + 1;\r\n\tklb_assert(strLen < 256, \"Shader Param less than 255 char\");\r\n\tm_stackParamFiller[0] = type;\t\t// Param Type\r\n\tm_stackParamFiller[1] = strLen;\t\t// String Size\r\n\tm_stackParamFiller[2] = 0;\t\t\t// Mapped Index\r\n\tm_stackParamFiller[3] = (u8)quality;\r\n\tm_stackParamFiller += 4;\r\n\r\n\t// Copy C String after size and param.\r\n\tmemcpy(m_stackParamFiller, name, strLen);\r\n\tm_stackParamFiller += strLen;\r\n}\r\n\r\nvoid CKLBRenderingManager::completeParameter() {\r\n\tm_stackParamFiller[0] = 0;\r\n\tm_stackParamFiller[1] = 0;\r\n\tm_stackParamFiller[2] = 0;\r\n\tm_stackParamFiller[3] = 0;\r\n\tm_stackParamFiller += 4;\r\n}\r\n\r\nu32 CKLBRenderingManager::createShaderDefinition(const char* shaderCode) {\r\n\r\n#ifdef OPENGL2\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\t// 10 Param Max on stack.\r\n\tSParam paramsShader[10] = {\r\n\t\t// Name\t\t\t\tUniform?\tStreamID\tData Type\r\n\t\t//\t\t\t\t\t\t\t\tor\r\n\t\t//\t\t\t\t\t\t\t\tUniformID\r\n\t\t{\t\"texture\"\t\t,true\t\t,1\t\t\t,TEX2D    | TEXTURE },\t// Index 0\r\n\t};\r\n\r\n\tcompleteParameter();\r\n\r\n\t//\r\n\t// Copy Byte Stream Parameters.\r\n\t//\r\n\tint lenArray\t= m_stackParamFiller - m_stackParam;\r\n\t// COPY FIRST.\r\n\tu8* pParam\t\t= KLBNEWA(u8,lenArray);\r\n\tif (!pParam) {\r\n\t\treturn NULL_IDX;\r\n\t}\r\n\tmemcpy(pParam, m_stackParam, lenArray);\r\n\r\n\t//\r\n\t// Parse Byte Stream Parameter to build the shader.\r\n\t//\r\n\tSParam pTmpStruct;\r\n\tu8* pParamStream = pParam;\r\n\tint streamID = 1;\t// \"texture\" is first.\r\n\twhile (pParamStream[1]!=0) {\t\t\t\t\t\t\t\t// Name Length\r\n\t\tpTmpStruct.name\t\t\t\t\t= (const char*)&pParamStream[3];\r\n\t\tpTmpStruct.isUniform\t\t\t= true;\r\n\t\tpTmpStruct.vertexORuniformID\t= streamID + 1;\r\n\t\tpTmpStruct.dType\t\t\t\t= pParamStream[0];\r\n\t\tpParamStream[2]\t\t\t\t\t= streamID + 1;\r\n\r\n\t\tparamsShader[streamID++]\t\t= pTmpStruct;\r\n\t\tpParamStream += pParamStream[1] + 3;\t\t\t\t\t\t// Go to next item (3+String)\r\n\t}\r\n\r\n\t// Close List\r\n\tparamsShader[streamID].name\t\t\t\t\t= \"\";\r\n\tparamsShader[streamID].isUniform\t\t\t= false;\r\n\tparamsShader[streamID].vertexORuniformID\t= 0;\r\n\tparamsShader[streamID].dType\t\t\t\t= END_LIST;\r\n\t\r\n\t// Reset param stream buffer.\r\n\tm_stackParamFiller\t = m_stackParam;\r\n\r\n\tCShader*\t\t\tpixelShader\t\t= pOGLMgr.createShader(shaderCode, CKLBOGLWrapper::PIXEL_SHADER, paramsShader);\r\n\tCShaderSet*\t\t\tshaderSet\t\t= NULL;\r\n\tif (pixelShader) {\r\n\t\t// Map the shader together.\r\n\t\tshaderSet\t= pOGLMgr.createShaderSet(m_pVShader, pixelShader);\r\n\t\tif (shaderSet) {\r\n\t\t\tfor (int n=0; n < SHADER_DEF_MAX; n++) {\r\n\t\t\t\tif (!m_shaderDef[n].m_definition) {\r\n\t\t\t\t\tm_shaderDef[n].m_definition\t\t= shaderSet;\r\n\t\t\t\t\tm_shaderDef[n].m_pixelShader\t= pixelShader;\r\n\t\t\t\t\tm_shaderDef[n].m_paramList\t\t= pParam;\r\n\r\n\t\t\t\t\treturn n;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpOGLMgr.releaseShaderSet(shaderSet);\r\n\t\t}\r\n\t\tpOGLMgr.releaseShader(pixelShader);\r\n\t}\r\n#else\r\n\tklb_assertAlways(\"OpenGL 1.1 Profile does not support shader APIs\");\r\n#endif\r\n\treturn NULL_IDX;\r\n}\r\n\r\nvoid CKLBRenderingManager::destroyShaderDefinition(u32 shaderDefinition) {\r\n\tif (!m_shaderDef[shaderDefinition].m_definition) {\r\n\t\tCKLBOGLWrapper&\t\tpOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\r\n\t\tKLBDELETEA(m_shaderDef[shaderDefinition].m_paramList);\r\n\t\tm_shaderDef[shaderDefinition].m_paramList = NULL;\r\n\r\n\t\tpOGLMgr.releaseShaderSet(m_shaderDef[shaderDefinition].m_definition);\r\n\t\tpOGLMgr.releaseShader(m_shaderDef[shaderDefinition].m_pixelShader);\r\n\t\tm_shaderDef[shaderDefinition].m_definition\t= NULL;\r\n\t\tm_shaderDef[shaderDefinition].m_pixelShader = NULL;\r\n\t}\r\n}\r\n\r\n// Instance Slot\r\nvoid* CKLBRenderingManager::instanceShader(u32 shaderDefinition, u32 startRange, u32 endRange) {\r\n\t//\r\n\tklb_assert(startRange < endRange,\t\t\t\t\t\t\"Invalid Range\");\r\n\tklb_assert(shaderDefinition < SHADER_DEF_MAX,\t\t\t\"Invalid Shader Index\");\r\n\r\n\tS_SHADERINSTANCE* pInst = m_shaderInstanceList;\r\n\twhile (pInst) {\r\n\t\tif (!(((pInst->m_min > startRange) && (pInst->m_max < endRange)) ||\r\n\t\t\t  ((pInst->m_min < startRange) && (pInst->m_max > endRange)))) {\r\n\t\t\tklb_assertAlways(\"Invalid Ranges\");\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tpInst = pInst->m_pNext;\r\n\t}\r\n\r\n\tpInst = KLBNEW(S_SHADERINSTANCE);\r\n\t\r\n\tCKLBRenderState* pStartState = this->allocateCommandState();\r\n\tCKLBRenderState* pEndState   = this->allocateCommandState();\r\n\r\n\r\n\tif (pInst && pStartState && pEndState && m_shaderDef[shaderDefinition].m_definition) {\r\n\t\tpInst->m_pInstanceShader = m_shaderDef[shaderDefinition].m_definition->createInstance();\r\n\t\tif (pInst->m_pInstanceShader) {\r\n\t\t\tpStartState->setUse(false, false, pInst->m_pInstanceShader);\r\n\t\t\tpEndState->setUse(false,false,NULL);\r\n\t\t\tpEndState->m_commandType = RENDERCOMMAND_UNSETSHADER;\r\n\r\n\t\t\t// Shader Registered.\r\n\t\t\tpInst->m_paramList\t\t= m_shaderDef[shaderDefinition].m_paramList;\r\n\t\t\tpInst->m_pNext\t\t\t= m_shaderInstanceList;\r\n\t\t\tm_shaderInstanceList\t= pInst;\r\n\r\n\t\t\t// Setup Start & End\r\n\t\t\tthis->addToRendering(pStartState, startRange);\r\n\t\t\tthis->addToRendering(pEndState, endRange);\r\n\r\n\t\t\treturn pInst;\r\n\t\t}\r\n\t}\r\n\r\n\t// Handle Error.\r\n\tKLBDELETE(pInst);\r\n\tif (pStartState)\t{ this->releaseCommand(pStartState);\t}\r\n\tif (pEndState)\t\t{ this->releaseCommand(pEndState);\t\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBRenderingManager::removeShader(void* /*instanceShader*/) {\r\n\r\n\t// TODO.\t\r\n\r\n}\r\n\r\nu32 searchID(u8* stream, const char* name) {\r\n\twhile (stream[1]!=0) {\t\t\t\t\t\t\t\t// Name Length\r\n\t\tif (strcmp(name, (const char*)&stream[4])==0) {\t// Name\r\n\t\t\treturn stream[2];\t\t\t\t\t\t\t// Index ID\r\n\t\t}\r\n\t\tstream += stream[1] + 4;\t\t\t\t\t\t// Go to next item (3+String)\r\n\t}\r\n\treturn NULL_IDX;\r\n}\r\n\r\nvoid CKLBRenderingManager::setShaderParamI(void* instanceShader, const char* name, GLint* value) {\r\n\tS_SHADERINSTANCE* pInst = (S_SHADERINSTANCE*)instanceShader;\r\n\tu32 uniformID = searchID(pInst->m_paramList, name);\r\n\tpInst->m_pInstanceShader->setUniformI(CShaderInstance::PIXEL_SHADER, uniformID, value);\r\n}\r\n\r\nvoid CKLBRenderingManager::setShaderParamF(void* instanceShader, const char* name, GLfloat* value) {\r\n\tS_SHADERINSTANCE* pInst = (S_SHADERINSTANCE*)instanceShader;\r\n\tu32 uniformID = searchID(pInst->m_paramList, name);\r\n\tpInst->m_pInstanceShader->setUniformF(CShaderInstance::PIXEL_SHADER, uniformID, value);\r\n}\r\n\r\nvoid CKLBRenderingManager::setShaderParamTexture(void* instanceShader, const char* name, CTextureUsage* value) {\r\n\tS_SHADERINSTANCE* pInst = (S_SHADERINSTANCE*)instanceShader;\r\n\tu32 uniformID = searchID(pInst->m_paramList, name);\r\n\tpInst->m_pInstanceShader->setUniformTexture(CShaderInstance::PIXEL_SHADER, uniformID, value);\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\nvoid CKLBRenderingManager::addToRendering(CKLBRenderCommand* pRender, u32 index) {\r\n\tklb_assert(m_pRenderWatchDog, \"CKLBRenderingManager::setup not done first\");\r\n\t// Roll back when bug found.\r\n\t// klb_assert(index != 0xFFFFFFFF, \" 0xFFFFFFFF Priority should not be used\");\r\n\tklb_assert((pRender->m_pNext == NULL) && (pRender->m_pPrev == NULL), \"Item already in list.\"); \r\n\r\n\t//\r\n\t// Perform insertion.\r\n\t//\r\n\tCKLBRenderCommand* pInsertPoint = m_pRenderLastModify;\r\n\tif (index < m_pRenderLastModify->m_uiOrder) {\r\n\t\t// <\r\n\t\tCKLBRenderCommand* pPrevPoint = pInsertPoint; \r\n\t\twhile (pInsertPoint->m_uiOrder > index) {\r\n\t\t\tpPrevPoint   = pInsertPoint;\r\n\t\t\tpInsertPoint = pInsertPoint->m_pPrev;\r\n\t\t\tif (!pInsertPoint) { break; }\r\n\t\t}\r\n\r\n\t\t// Roll back to next item.\r\n\t\tpInsertPoint = pPrevPoint;\r\n\t} else {\r\n\t\t// loop until >=\r\n\t\twhile (pInsertPoint->m_uiOrder < index) {\r\n\t\t\tpInsertPoint = pInsertPoint->m_pNext;\r\n\t\t}\r\n\t}\r\n\r\n\t//\r\n\t// Object inserted BEFORE insertPoint.\r\n\t//\r\n\r\n\t// Beginning of list\r\n\tif (pInsertPoint->m_pPrev == NULL) {\r\n\t\tpRender->m_pNext\t\t\t= this->m_pListStart;\r\n\t\tpRender->m_pPrev\t\t\t= NULL;\r\n\t\tthis->m_pListStart->m_pPrev\t= pRender;\r\n\t\tthis->m_pListStart\t\t\t= pRender;\r\n\r\n\t} else {\r\n\t// Middle of list\r\n\t\tpRender->m_pNext\t\t\t= pInsertPoint;\r\n\t\tpRender->m_pPrev\t\t\t= pInsertPoint->m_pPrev; \r\n\t\tpInsertPoint->m_pPrev\t\t= pRender;\r\n\t\tpRender->m_pPrev->m_pNext\t= pRender;\r\n\t}\r\n\r\n//\tif (pRender->m_commandType == 1) {\t// Buffer shift only with sprites.\r\n\t\tpRender->m_uiStatus |= FLAG_BUFFERSHIFT;\r\n//\t}\r\n\tpRender->m_uiOrder  = index;\r\n\r\n\tm_pRenderLastModify = pRender;\r\n\r\n\tif (index == 0xFFFFFFFF) {\r\n\t\t// Scene graph\r\n\t\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\t\tres.getRoot()->dump(0, 0xFFFFFFFF);\r\n\t\t// Dump Rendering Queue\r\n\t\tdump(0xFFFFFFFF);\r\n\r\n\t\t// Put back at beginning once we did it.\r\n\t\tklb_assert(index != 0xFFFFFFFF, \" 0xFFFFFFFF Priority should not be used\");\r\n\t}\r\n}\r\n\r\n// Dirty Hack for now : 250 sprites with mask in ONE call max.\r\nfloat\tm_maskUVPtr[10000];\r\n\r\nCTextureUsage* g_textureMask = NULL;\r\nbool g_useTextureLast = false;\r\nbool g_useColorLast = false;\r\n\r\nvoid CKLBRenderingManager::emitDrawCall(\tu16*\t\t\tpIndexCounter,\r\n\t\t\t\t\t\t\t\t\t\t\tu16*\t\t\toffsetIndex,\r\n\t\t\t\t\t\t\t\t\t\t\tu16*\t\t\toffsetVertex,\r\n\t\t\t\t\t\t\t\t\t\t\tu16\t\t\t\toffsetVertexHead,\r\n\t\t\t\t\t\t\t\t\t\t\tCTextureUsage*\tpTextureUsage,\r\n\t\t\t\t\t\t\t\t\t\t\tCTextureUsage*\tpTexture2\r\n\t\t\t\t\t\t\t\t\t\t\t) {\r\n\tu32 indexCount = *pIndexCounter;\r\n\r\n\t// OPTIMIZE : NOT VBO, could remove calls.\r\n\tm_pIdxBuffer->updateComplete(*offsetIndex + indexCount);\r\n\tm_pVerBuffer->updateComplete(offsetVertexHead);\t// In vertex count\r\n\tm_pColBuffer->updateComplete(offsetVertexHead); // In vertex count\r\n\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\tpOGLMgr.applyState(m_pCurrState);\r\n\r\n\tif (pTexture2 != g_textureMask) {\r\n\r\n\t\tdglActiveTexture(GL_TEXTURE1);\r\n\t\tdglClientActiveTexture(GL_TEXTURE1);\r\n\r\n\t\tif (pTexture2) {\r\n\t\t\tdglEnable(GL_TEXTURE_2D);\r\n\t\t\tdglBindTexture(GL_TEXTURE_2D, pTexture2->pTexture->pMaster->activeTexture);\r\n\t\t\t\r\n\t\t\tpOGLMgr.assignSampler(pTexture2, 1);\r\n\r\n\t\t\tdglEnableClientState(GL_TEXTURE_COORD_ARRAY);\r\n\t\t\tdglTexCoordPointer(2, GL_FLOAT, 0, m_maskUVPtr);\r\n\t\t} else {\r\n\t\t\tdglDisable(GL_TEXTURE_2D);\r\n\t\t\tdglDisableClientState(GL_TEXTURE_COORD_ARRAY);\r\n\t\t}\r\n\r\n\t\tdglActiveTexture(GL_TEXTURE0);\r\n\t\tdglClientActiveTexture(GL_TEXTURE0);\r\n\t\tg_textureMask = pTexture2;\r\n\t}\r\n\r\n\tif (indexCount) {\r\n\r\n\t\tm_pIdxBuffer->setDrawOffset(*offsetIndex);\r\n\t\tm_pVerBuffer->setDrawOffset(*offsetVertex);\r\n\t\tm_pColBuffer->setDrawOffset(*offsetVertex);\r\n\r\n\t\t// For now texture is only one texture.\r\n\t\tCTextureUsage* pArrTexture[2];\r\n\t\ts32 idUniform[2];\r\n\t\tpArrTexture\t\t\t[0]\t\t= pTextureUsage;\r\n\t\tidUniform\t\t\t[0]\t\t= 1;\r\n\t\t/*\r\n\t\tpArrTexture\t\t\t[1]\t\t= pTexture2;\r\n\t\tidUniform\t\t\t[1]\t\t= 2;\r\n\t\t*/\r\n\r\n\t\t//\r\n\t\t// Trick to support\r\n\t\t//\r\n\t\tif (pTextureUsage && m_useTextures) {\r\n\t\t\tif (g_useTextureLast == false) {\r\n\t\t\t\tdglEnable(GL_TEXTURE_2D);\r\n\t\t\t\tg_useTextureLast = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (g_useTextureLast == true) {\r\n\t\t\t\tdglDisable(GL_TEXTURE_2D);\r\n\t\t\t\tg_useTextureLast = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n#ifndef OPENGL2\r\n\t\tif (!m_useColor) {\r\n\t\t\tif (g_useColorLast == true) {\r\n\t\t\t\tdglDisableClientState(GL_COLOR_ARRAY);\r\n\t\t\t\tg_useColorLast = false;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (g_useColorLast == false) {\r\n\t\t\t\tdglEnableClientState(GL_COLOR_ARRAY);\r\n\t\t\t\tg_useColorLast = true;\r\n\t\t\t}\r\n\t\t}\r\n#endif\r\n\r\n\t\tm_pTextureUsage = pTextureUsage;\r\n\r\n\t\tCBuffer* arrBuff[2] = {\r\n\t\t\tm_pVerBuffer,\r\n\t\t\tm_pColBuffer,\r\n\t\t};\r\n\r\n\t\tpOGLMgr.draw(\tm_callMode,\r\n\t\t\t\t\t\tm_pCurrShader,\r\n\t\t\t\t\t\tarrBuff,\r\n\t\t\t\t\t\t2,\r\n\t\t\t\t\t\tm_pIdxBuffer,\r\n\t\t\t\t\t\tpArrTexture,\r\n\t\t\t\t\t\tidUniform, \r\n\t\t\t\t\t\tindexCount);\r\n\r\n\t\t*pIndexCounter = 0;\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\tm_drawCall++;\r\n\t\tm_vertexCount\t+= offsetVertexHead - (*offsetVertex); // Amount of vertex.\r\n\t\tm_indexCount\t+= indexCount;\r\n\t#endif\r\n\t}\r\n\r\n\t*offsetVertex\t = offsetVertexHead;\r\n\t*offsetIndex\t+= indexCount;  \r\n}\r\n\r\nvoid CKLBRenderingManager::dumpMetrics() {\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n#ifdef DEBUG_PERFORMANCE\r\n\tfprintf(pFile,\"\\n==== Rendering Metrics ===\\n\");\r\n\tfprintf(pFile,\"Total vertex Count : %i\\n\", m_vertexCount);\r\n\tfprintf(pFile,\"Total index  Count : %i\\n\", m_indexCount);\r\n\tfprintf(pFile,\"Total sprite Count : %i\\n\", m_spriteCount);\r\n\tfprintf(pFile,\"Texture      Change: %i\\n\", m_textureChange);\r\n\tfprintf(pFile,\"Render State Change: %i\\n\", m_renderStateChange);\r\n\tfprintf(pFile,\"Total float transfer to GPU : %i\\n\", m_totalTransferSize);\r\n\tfprintf(pFile,\"Total internal copy: %i\\n\", m_memCopySize);\r\n\tfprintf(pFile,\"Total DrawCall     : %i\\n\", m_drawCall);\r\n\tfprintf(pFile,\"Time %lli uSec\\n\", m_drawTime / 1000);\r\n\tfprintf(pFile,\"==== Rendering Metrics End ===\\n\\n\");\r\n#else\r\n\tfprintf(pFile,\"==== Not Available (Compile option DEBUG_PERFORMANCE not set\\n\\n\");\r\n#endif\r\n}\r\n\r\nvoid CKLBRenderingManager::dump(u32 /*mask*/) {\r\n\tint count = 0;\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\tfprintf(pFile,\"\\n==== Rendering Queue Start ===\\n\");\r\n\tCKLBRenderCommand*\tpCommand\t\t= this->m_pListStart;\r\n\twhile (pCommand != m_pRenderWatchDog) {\r\n\t\tfprintf(pFile,\"@%p %c Priority:[%8i] Type : \",pCommand, pCommand->ignore ? '!' : ' ',pCommand->getOrder());\r\n\t\tu32 command = pCommand->m_commandType;\r\n\t\tif (command & RENDERCOMMAND_SPRITE) {\r\n\t\t\tCKLBSprite* pSpr = (CKLBSprite*)pCommand;\r\n\t\t\tfprintf(pFile,\"[Sprite\");\r\n\r\n\t\t\tif (pCommand->m_uiStatus & FLAG_BUFFERSHIFT) {\r\n\t\t\t\tfprintf(pFile,\" Shft\");\r\n\t\t\t}\r\n\t\t\tif (pCommand->m_uiStatus & FLAG_XYUPDATE) {\r\n\t\t\t\tprintf(\" Geom\");\r\n\t\t\t}\r\n\t\t\tif (pCommand->m_uiStatus & FLAG_COLORUPDATE) {\r\n\t\t\t\tfprintf(pFile,\" Col\");\r\n\t\t\t}\r\n\t\t\tfprintf(pFile,\" Vertex:%i Index:%i] \", pSpr->m_uiVertexCount, pSpr->m_uiIndexCount);\r\n\t\t}\r\n\r\n\t\tif (command & RENDERCOMMAND_CHANGERENDERSTATE) {\r\n\t\t\tfprintf(pFile,\"[Render State\");\r\n\t\t\tCKLBRenderState* pRCom = (CKLBRenderState*)pCommand;\r\n\t\t\tSRenderState* pState = pRCom->getState();\r\n\t\t\tpState->dump();\r\n\r\n\t\t\tfprintf(pFile,\"] \");\r\n\t\t}\r\n\r\n\t\tif (command & RENDERCOMMAND_SETSHADER) {\r\n\t\t\tfprintf(pFile,\"[Shader] \");\r\n\t\t}\r\n\r\n\t\tif (command & RENDERCOMMAND_EXECUTECOMMAND) {\r\n\t\t\tif (command & RENDERCOMMAND_CLEARCOLOR)\t{\t\r\n\t\t\t\tfprintf(pFile,\"[Clear Color] \");\r\n\t\t\t}\r\n\t\t\tif (command & RENDERCOMMAND_CLEARDEPTH)\t{\r\n\t\t\t\tfprintf(pFile,\"[Clear Depth] \");\r\n\t\t\t}\r\n\t\t\tif (command & RENDERCOMMAND_CLEARSTENCIL) {\r\n\t\t\t\tfprintf(pFile,\"[Clear Stencil] \");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tfprintf(pFile,\"\\n\");\r\n\t\tpCommand = pCommand->m_pNext;\r\n\t\tcount++;\r\n\t}\r\n\tfprintf(pFile,\"[WatchDog]\\n==== Rendering Queue End : %i items ===\\n\", count);\r\n}\r\n\r\nu32 getColor(u32 code) {\r\n\tu8 col[4];\r\n\tcol[0] = (code & 0x07) << 5;\r\n\tcol[1] = (code & 0x38) << 2;\r\n\tcol[2] = (code & 0x1C) >> 1;\r\n\tcol[3] = 0xFF;\r\n\r\n\treturn (*((u32*)col));\r\n}\r\n\r\nCKLBRenderCommand* CKLBRenderingManager::drawClick(u32 x, u32 y) {\r\n\tfloat fx = x;\r\n\tfloat fy = y;\r\n\r\n\tCKLBRenderCommand*\tpCommand = m_pRenderWatchDog->m_pPrev;\r\n\twhile (pCommand) {\r\n\t\tif (pCommand->m_commandType & RENDERCOMMAND_SPRITE) {\r\n\t\t\tCKLBSprite* pSpr = (CKLBSprite*)pCommand;\r\n\t\t\tif (pSpr->m_click) {\r\n\t\t\t\tif (pSpr->clicked(fx,fy)) {\r\n\t\t\t\t\treturn pSpr;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpCommand = pCommand->m_pPrev;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n/*\r\nCKLBRenderCommand* CKLBRenderingManager::drawClick(u32 x, u32 y) {\r\n\t\r\n\tm_useTextures = false;\r\n\tm_coloring\t  = true;\r\n\r\n\t// Clear\r\n\tdglClearColor(0.0f, 0.0f, 0.0f, 0.0f);\r\n\tdglClear\t\t(GL_COLOR_BUFFER_BIT);\r\n\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,\tGL_COMBINE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,\t\tGL_REPLACE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,\t\tGL_REPLACE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB,\t\t\tGL_TEXTURE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA,\t\tGL_TEXTURE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB,\t\tGL_SRC_COLOR);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,\tGL_SRC_ALPHA);\r\n\r\n\t// Use vertex color but alpha from texture.\r\n\t//dglTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB,\t\t\tGL_PRIMARY_COLOR);\r\n\t\r\n\t//\r\n\t// Test : to remove.\r\n\t//\r\n\t{\r\n\t\tint assignID = 1;\r\n\t\tCKLBRenderCommand*\tpCommand = this->m_pListStart;\r\n\t\tCKLBRenderCommand*\tfound\t = NULL;\r\n\t\twhile (pCommand != m_pRenderWatchDog) {\r\n\t\t\tif (pCommand->m_commandType & RENDERCOMMAND_SPRITE) {\r\n\t\t\t\tCKLBSprite* pSpr = (CKLBSprite*)pCommand;\r\n\t\t\t\tpSpr->m_clickID = assignID++;\r\n\t\t\t}\r\n\t\t\tpCommand = pCommand->m_pNext;\r\n\t\t}\r\n\r\n\t\tif (this->m_pListStart) {\r\n\t\t\tthis->m_pListStart->m_uiStatus |= FLAG_BUFFERSHIFT;\r\n\t\t}\r\n\t}\r\n\r\n\t// TODO : Modify Scissor\r\n\tdraw();\r\n\r\n\t// TODO : Restore Scissor\r\n\r\n\t// Get X,Y\r\n\tu8 col[8];\r\n\tdglReadPixels(x,y,1,1,GL_RGBA,GL_UNSIGNED_BYTE,&col);\r\n\r\n\t// Convert RGBA into Code\r\n\t// MSB 3 Bit of RGB -> BBBGGGRRR code;\r\n\tcol[0] &= 0xE0;\r\n\tcol[1] &= 0xE0;\r\n\tcol[3] &= 0xE0;\r\n\tcol[4]  = 0xFF;\r\n\r\n\tu32 id = (*((u32*)col));\r\n\r\n\t// Parse all rendering objects.\r\n\tCKLBRenderCommand*\tpCommand = this->m_pListStart;\r\n\tCKLBRenderCommand*\tfound\t = NULL;\r\n\tif (id != 0) {\r\n\t\twhile (pCommand != m_pRenderWatchDog) {\r\n\t\t\tif (pCommand->m_commandType & RENDERCOMMAND_SPRITE) {\r\n\t\t\t\tCKLBSprite* pSpr = (CKLBSprite*)pCommand;\r\n\t\t\t\tif (pSpr->m_clickColor == id) {\r\n\t\t\t\t\tfound = pCommand;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpCommand = pCommand->m_pNext;\r\n\t\t}\r\n\t}\r\n\r\n\t// Restore Initial value\r\n\t\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,\tGL_MODULATE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,\t\tGL_MODULATE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB,\t\t\tGL_TEXTURE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB,\t\t\tGL_PRIMARY_COLOR);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA,\t\tGL_TEXTURE);\r\n\tdglTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA,\t\tGL_PRIMARY_COLOR);\r\n\t\r\n\tm_useTextures = true;\r\n\tm_coloring\t  = false;\r\n\r\n\t// draw();\r\n\r\n\treturn found;\r\n}*/\r\n\r\nvoid CKLBRenderingManager::enableRange(u32 start, u32 end, bool active) {\r\n\tif (end == 0xFFFFFFFF) {\r\n\t\tend--;\r\n\t}\r\n\tCKLBRenderCommand*\tpCommand = m_pListStart;\r\n\twhile (pCommand != m_pRenderWatchDog) {\r\n\t\tif (pCommand->m_uiOrder >= start && pCommand->m_uiOrder <= end) {\r\n\t\t\tpCommand->ignore = !active;\r\n\t\t}\r\n\t\tpCommand = pCommand->m_pNext;\r\n\t}\r\n}\r\n\r\nvoid CKLBRenderingManager::drawOverdraw() {\r\n\tCKLBRenderCommand*\trenderStack[10];\r\n\r\n\tCKLBRenderCommand*\tpCommand\t\t= this->m_pListStart;\r\n\tCTextureUsage*\t\tpLastTexture\t= NULL;\r\n\tu16*\t\t\t\tpDstIndexBuffer = (u16*)m_pIdxBuffer->updateStart(0);\r\n\r\n\tu8\t\t\t\t\tbufferShift\t\t= true;\r\n\tu16\t\t\t\t\tstrideVertex;\r\n\tfloat*\t\t\t\tpDstVertexBuffer\t\t= m_pVerBuffer->updateStart(1, 0, &strideVertex);\r\n\tu32*\t\t\t\tpDstColBuffer\t\t\t= (u32*)m_pColBuffer->updateStart(3, 0, null);\r\n\tu16\t\tindexCount\t\t\t= 0;\r\n\tu16\t\tindexVCount\t\t\t= 0;\r\n\tu16\t\toffsetVertex\t\t= 0;\r\n\tu16\t\toffsetVertexHead\t= 0;\r\n\tu16\t\toffsetIndex\t\t\t= 0;\r\n\ts32\t\tstackDepth\t\t\t= 0;\r\n\tCTextureUsage*\t\tpLastTextureMask = NULL;\r\n\r\n\trenderStack[0]\t= m_pRenderWatchDog;\r\n\trenderStack[1]\t= pCommand;\r\n\r\n\tCKLBOGLWrapper& pOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\tpOGLMgr.resetSampler(0);\r\n\t/*\r\n\tdump(0);\r\n\tdumpMetrics();\r\n\t*/\r\n\r\n\tm_pTextureUsage = pLastTexture;\r\n\r\n\t// Default\r\n\tm_pCurrState\t= &state;\r\n\t// Default\r\n\tm_pCurrShader\t= m_pShaderInstance;\r\n\tm_stackShaderIdx= 0;\r\n\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tm_drawTime\t\t\t= CPFInterface::getInstance().platform().nanotime();\r\n\tm_vertexCount\t\t= 0;\t// DONE\r\n\tm_indexCount\t\t= 0;\t// DONE\r\n\tm_spriteCount\t\t= 0;\t// DONE\r\n\tm_renderStateChange\t= 0;\t// DONE\r\n\tm_textureChange\t\t= 0;\t// DONE\r\n\tm_totalTransferSize\t= 0;\t// Total Transfer to GPU\t\r\n\tm_memCopySize\t\t= 0;\t// Internal Move\r\n\tm_drawCall\t\t\t= 0;\t// DONE\r\n#endif\r\n\tfloat* ptrUVMask\t= m_maskUVPtr;\r\n\r\n\tdglActiveTexture(GL_TEXTURE1);\r\n\tdglClientActiveTexture(GL_TEXTURE1);\r\n\tdglDisable(GL_TEXTURE_2D);\r\n\tdglDisableClientState(GL_TEXTURE_COORD_ARRAY);\r\n\r\n\tdglActiveTexture(GL_TEXTURE0);\r\n\tdglClientActiveTexture(GL_TEXTURE0);\r\n\tg_textureMask = NULL;\r\n\r\n\t// force White fill.\r\n\tdglClearColor(1.0f,1.0f,1.0f,1.0f);\r\n\tdglClear(GL_COLOR_BUFFER_BIT);\r\n\r\n\r\n\t#define COLOR_COUNT\t\t\t(7)\r\n\tstatic u8 g_colors[] = {\r\n\t\t// RGBA\r\n\t\t0xFF,0x00,0x00,0x40,\t// Red\t\t\t1\r\n\t\t0x00,0xFF,0x00,0x40,\t// Green\t\t2\r\n\t\t0x00,0x00,0xFF,0x40,\t// Blue\t\t\t3\r\n\t\t0xFF,0xFF,0x00,0x40,\t// Yellow\t\t4\r\n\t\t0x00,0xFF,0xFF,0x40,\t// Cyan\t\t\t5\r\n\t\t0xFF,0x00,0xFF,0x40,\t// Magenta\t\t6\r\n\t\t0x00,0x00,0x00,0x20,\t// Black\t\t7\r\n\t};\r\n\r\n\tu32 colorIndex = 0;\r\n\r\n\t// OPTIMIZE RP : have mecanism to remember FOR EACH draw call (render state change)\r\n\t//\t\t\t\t\t\tavoid buffer shift in first draw call to impact further draw calls. (ie layers)\r\n\t//\t\t\t\t\t\tand have different buffer to avoid crush by previous call.\r\n\r\n\tbool bTex = (m_bRenderOverDraw == 2);\r\n\r\n\tdo {\r\n\t\tCKLBRenderCommand* pEnd = renderStack[stackDepth];\r\n\t\tpCommand\t\t\t\t= renderStack[stackDepth+1];\r\n\t\twhile (pCommand != pEnd) {\r\n\t\t\tif (pCommand->m_commandType & RENDERCOMMAND_SPRITE) {\r\n\t\t\t\tCKLBSprite* pSpr = (CKLBSprite*)pCommand;\r\n\r\n\t\t\t\tif ((pSpr->m_uiVertexCount != 0) && (!(pCommand->m_commandType & RENDERCOMMAND_IGNORE))) {\t// TODO OPTIMIZE : Empty sprite could be optimized to be skipped once.\r\n\t\t\t\t\tif ((pSpr->m_pTexture != pLastTexture) /*|| (m_pCurrState != pSpr->m_pState)*/ || (pSpr->m_pMaskTexture != pLastTextureMask)) {\r\n\t\t\t\t\t\temitDrawCall\t\t(&indexCount, &offsetIndex, &offsetVertex, offsetVertexHead, bTex ? pLastTexture : NULL ,pLastTextureMask);\r\n\t\t\t\t\t\tcolorIndex++;\r\n\t\t\t\t\t\tptrUVMask\t\t\t= m_maskUVPtr;\r\n\t\t\t\t\t\tindexVCount  = 0; // Reset index counter.\r\n\t\t\t\t\t\tpLastTexture\t\t= pSpr->m_pTexture;\r\n\t\t\t\t\t\tpLastTextureMask\t= pSpr->m_pMaskTexture;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (pCommand->m_commandType & RENDERCOMMAND_3D) {\r\n\t\t\t\t\t\t((CKLBSprite3D*)pCommand)->draw();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tu16 sprIndexCount\t= pSpr->m_uiIndexCount;\r\n\t\t\t\t\t\tu16 skipSize\t\t= pSpr->m_uiVertexCount * strideVertex;\r\n\r\n\t\t\t\t\t\tbufferShift |= (pCommand->m_uiStatus & FLAG_BUFFERSHIFT);\r\n\t\t\t\t\t\t// Copy chunk of complete vertex. \r\n\t\t\t\t\t\t// MemCopy UV\r\n\t\t\t\t\t\t// MemCopy XY\r\n\t\t\t\t\t\tif (bufferShift) {\r\n\t\t\t\t\t\t\t// Copy X,Y,U,V\r\n\t\t\t\t\t\t\tmemcpy32(pDstVertexBuffer,\tpSpr->m_pVertex,\tskipSize              * sizeof(float));\r\n\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tu32 col = colorIndex % COLOR_COUNT;\r\n\t\t\t\t\t\t\t\tfor (u32 n=0; n < pSpr->m_uiVertexCount; n++) {  pDstColBuffer[n] = *((u32*)&g_colors[col*4]); }\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (pLastTextureMask) {\r\n\t\t\t\t\t\t\t\tmemcpy32(ptrUVMask, pSpr->m_pVertexMaskUV,\t(skipSize *sizeof(float)) >> 1);\r\n\t\t\t\t\t\t\t\tptrUVMask += skipSize >> 1;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// Index buffer recompute\r\n\t\t\t\t\t\t\tu16 lCount\t\t= sprIndexCount;\r\n\t\t\t\t\t\t\tu16* pSprIdx\t= pSpr->m_pIndex;\r\n\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t// Unroll loop by block of 8 indexes\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\tloopSwitch:\r\n\t\t\t\t\t\t\tswitch (lCount) {\r\n\t\t\t\t\t\t\tcase 7: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 6: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 5: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 4: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 3: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 2: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 1: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\tif (lCount >= 8) {\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\tlCount -= 8;\r\n\t\t\t\t\t\t\t\t\tgoto loopSwitch;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// --- Geometry or color update : triangle do not change ---\r\n\t\t\t\t\t\t\tif (pCommand->m_uiStatus & (FLAG_XYUPDATE | FLAG_UVUPDATE)) {\r\n\t\t\t\t\t\t\t\tmemcpy32(pDstVertexBuffer, pSpr->m_pVertex, skipSize * sizeof(float));\r\n\t\t\t\t\t\t\t\tif (pLastTextureMask) {\r\n\t\t\t\t\t\t\t\t\tmemcpy32(ptrUVMask, pSpr->m_pVertexMaskUV,\t(skipSize *sizeof(float)) >> 1);\r\n\t\t\t\t\t\t\t\t\tptrUVMask += skipSize >> 1;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tu32 col = colorIndex % COLOR_COUNT;\r\n\t\t\t\t\t\t\t\tfor (u32 n=0; n < pSpr->m_uiVertexCount; n++) {  pDstColBuffer[n] = *((u32*)&g_colors[col*4]); }\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// Index buffer untouched.\r\n\t\t\t\t\t\t\tpDstIndexBuffer\t\t+= sprIndexCount;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tpDstVertexBuffer\t+= skipSize;\r\n\t\t\t\t\t\tpDstColBuffer\t\t+= pSpr->m_uiVertexCount;\r\n\t\t\t\t\t\tindexCount\t\t\t+= sprIndexCount;\r\n\t\t\t\t\t\tindexVCount\t\t\t+= pSpr->m_uiVertexCount;\r\n\t\t\t\t\t\toffsetVertexHead\t+= pSpr->m_uiVertexCount;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// In case a sprite changed from n -> 0 vertex : global buffer is shifted.\r\n\t\t\t\t\tbufferShift |= (pCommand->m_uiStatus & FLAG_BUFFERSHIFT);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Reset flag (processed)\r\n\t\t\t\tpCommand->m_uiStatus = 0;\r\n\t\t\t\t// Go next command.\r\n\t\t\t\tpCommand = pCommand->m_pNext;\r\n\t\t\t} else {\r\n\t\t\t\temitDrawCall\t(&indexCount, &offsetIndex, &offsetVertex, offsetVertexHead, bTex ? pLastTexture : NULL, pLastTextureMask);\r\n\t\t\t\tcolorIndex++;\r\n\t\t\t\tptrUVMask\t= m_maskUVPtr;\r\n\t\t\t\tindexVCount = 0;\r\n\t\t\t\t\r\n\t\t\t\t// Support render state change.\r\n\t\t\t\tCKLBRenderState* pRCom = (CKLBRenderState*)pCommand;\r\n\r\n\t\t\t\tint cmdType = pRCom->m_commandType;\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_CHANGERENDERSTATE) {\r\n\t\t\t\t\tm_pCurrState\t= pRCom->getState();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_SETSHADER) {\r\n\t\t\t\t\tm_stackShader[m_stackShaderIdx++] = m_pCurrShader;\r\n\t\t\t\t\tm_pCurrShader\t= pRCom->getShader();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_EXECUTECOMMAND) {\r\n\t\t\t\t\t// case RENDERCOMMAND_CLEARCOLOR:\r\n\t\t\t\t\t// case RENDERCOMMAND_CLEARDEPTH:\r\n\t\t\t\t\t// case RENDERCOMMAND_CLEARSTENCIL:\r\n\t\t\t\t\tpRCom->executeCommand();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_CHANGETARGET) {\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_UNSETSHADER) {\r\n\t\t\t\t\tm_pCurrShader\t= m_stackShader[--m_stackShaderIdx];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbufferShift |= (pCommand->m_uiStatus & FLAG_BUFFERSHIFT);\r\n\r\n\t\t\t\t// Reset flag (processed)\r\n\t\t\t\tpCommand->m_uiStatus = 0;\r\n\t\t\t\t// Go next command.\r\n\t\t\t\tpCommand = pCommand->m_pNext;\r\n\r\n\t\t\t\tif (pRCom->jump) {\r\n\t\t\t\t\trenderStack[stackDepth  ] = pCommand;\r\n\t\t\t\t\trenderStack[stackDepth+1] = pEnd;\r\n\r\n\t\t\t\t\tstackDepth += 2;\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Switch to new rendering sub-queue\r\n\t\t\t\t\t//\r\n\t\t\t\t\tpCommand\t= pRCom->jump;\r\n\t\t\t\t\tpEnd\t\t= pRCom->end;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\temitDrawCall\t\t(&indexCount, &offsetIndex, &offsetVertex, offsetVertexHead, bTex ? pLastTexture : NULL , pLastTextureMask);\r\n\t\tcolorIndex++;\r\n\t\tptrUVMask\t= m_maskUVPtr;\r\n\t} while ((stackDepth -= 2) >= 0);\r\n}\r\n\r\n// Rendering.\r\nvoid CKLBRenderingManager::draw() {\r\n\tif (m_bRenderOverDraw) {\r\n\t\tdrawOverdraw();\r\n\t\treturn;\r\n\t}\r\n\r\n\tklb_assert(m_pRenderWatchDog, \"CKLBRenderingManager::setup not done first\");\r\n\r\n\tCKLBRenderCommand*\trenderStack[10];\r\n\r\n\tCKLBRenderCommand*\tpCommand\t\t= this->m_pListStart;\r\n\tCTextureUsage*\t\tpLastTexture\t= NULL;\r\n\tu16*\t\t\t\tpDstIndexBuffer = (u16*)m_pIdxBuffer->updateStart(0);\r\n\r\n\tu8\t\t\t\t\tbufferShift\t\t= true;\r\n\tu16\t\t\t\t\tstrideVertex;\r\n\tfloat*\t\t\t\tpDstVertexBuffer\t\t= m_pVerBuffer->updateStart(1, 0, &strideVertex);\r\n\tu32*\t\t\t\tpDstColBuffer\t\t\t= (u32*)m_pColBuffer->updateStart(3, 0, null);\r\n\tu16\t\tindexCount\t\t\t= 0;\r\n\tu16\t\tindexVCount\t\t\t= 0;\r\n\tu16\t\toffsetVertex\t\t= 0;\r\n\tu16\t\toffsetVertexHead\t= 0;\r\n\tu16\t\toffsetIndex\t\t\t= 0;\r\n\ts32\t\tstackDepth\t\t\t= 0;\r\n\tCTextureUsage*\t\tpLastTextureMask = NULL;\r\n\r\n\trenderStack[0]\t= m_pRenderWatchDog;\r\n\trenderStack[1]\t= pCommand;\r\n\r\n\tCKLBOGLWrapper& pOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\tpOGLMgr.resetSampler(0);\r\n\t/*\r\n\tdump(0);\r\n\tdumpMetrics();\r\n\t*/\r\n\r\n\tm_pTextureUsage = pLastTexture;\r\n\r\n\t// Default\r\n\tm_pCurrState\t= &state;\r\n\t// Default\r\n\tm_pCurrShader\t= m_pShaderInstance;\r\n\tm_stackShaderIdx= 0;\r\n\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tm_drawTime\t\t\t= CPFInterface::getInstance().platform().nanotime();\r\n\tm_vertexCount\t\t= 0;\t// DONE\r\n\tm_indexCount\t\t= 0;\t// DONE\r\n\tm_spriteCount\t\t= 0;\t// DONE\r\n\tm_renderStateChange\t= 0;\t// DONE\r\n\tm_textureChange\t\t= 0;\t// DONE\r\n\tm_totalTransferSize\t= 0;\t// Total Transfer to GPU\t\r\n\tm_memCopySize\t\t= 0;\t// Internal Move\r\n\tm_drawCall\t\t\t= 0;\t// DONE\r\n#endif\r\n\tfloat* ptrUVMask\t= m_maskUVPtr;\r\n\r\n\tdglActiveTexture(GL_TEXTURE1);\r\n\tdglClientActiveTexture(GL_TEXTURE1);\r\n\tdglDisable(GL_TEXTURE_2D);\r\n\tdglDisableClientState(GL_TEXTURE_COORD_ARRAY);\r\n\r\n\tdglActiveTexture(GL_TEXTURE0);\r\n\tdglClientActiveTexture(GL_TEXTURE0);\r\n\tg_textureMask = NULL;\r\n\r\n\t// OPTIMIZE RP : have mecanism to remember FOR EACH draw call (render state change)\r\n\t//\t\t\t\t\t\tavoid buffer shift in first draw call to impact further draw calls. (ie layers)\r\n\t//\t\t\t\t\t\tand have different buffer to avoid crush by previous call.\r\n\r\n\tdo {\r\n\t\tCKLBRenderCommand* pEnd = renderStack[stackDepth];\r\n\t\tpCommand\t\t\t\t= renderStack[stackDepth+1];\r\n\t\twhile (pCommand != pEnd) {\r\n\t\t\t/* Comment out code concerning disabling of draw command.\r\n\t\t\tif (pCommand->ignore == true) {\r\n\t\t\t\tpCommand = pCommand->m_pNext;\r\n\t\t\t\tcontinue;\r\n\t\t\t}*/\r\n\r\n\t\t\tif (pCommand->m_commandType & RENDERCOMMAND_SPRITE) {\r\n\t\t\t\tCKLBSprite* pSpr = (CKLBSprite*)pCommand;\r\n\r\n\t\t\t\tif ((pSpr->m_uiVertexCount != 0) && (!(pCommand->m_commandType & RENDERCOMMAND_IGNORE))) {\t// TODO OPTIMIZE : Empty sprite could be optimized to be skipped once.\r\n\t\t\t\t#ifdef DEBUG_PERFORMANCE\r\n\t\t\t\t\tm_spriteCount++;\r\n\t\t\t\t#endif\r\n\t\t\t\t\tif ((pSpr->m_pTexture != pLastTexture) /*|| (m_pCurrState != pSpr->m_pState)*/ || (pSpr->m_pMaskTexture != pLastTextureMask)) {\r\n\t\t\t\t\t#ifdef DEBUG_PERFORMANCE  \r\n\t\t\t\t\t\tm_textureChange++;\r\n\t\t\t\t\t#endif\r\n\t\t\t\t\t\t/* m_pState from sprite is garbage for now. (unused, not set in constructor)\r\n\t\t\t\t\t\tif (pSpr->m_pState) {\r\n\t\t\t\t\t\t\tm_pCurrState = pSpr->m_pState; // BEFORE draw call.\r\n\t\t\t\t\t\t}*/\r\n\r\n\t\t\t\t\t\temitDrawCall\t\t(&indexCount, &offsetIndex, &offsetVertex, offsetVertexHead, pLastTexture,pLastTextureMask);\r\n\t\t\t\t\t\tptrUVMask\t\t\t= m_maskUVPtr;\r\n\t\t\t\t\t\tindexVCount  = 0; // Reset index counter.\r\n\t\t\t\t\t\tpLastTexture\t\t= pSpr->m_pTexture;\r\n\t\t\t\t\t\tpLastTextureMask\t= pSpr->m_pMaskTexture;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (pCommand->m_commandType & RENDERCOMMAND_3D) {\r\n\t\t\t\t\t\t((CKLBSprite3D*)pCommand)->draw();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tu16 sprIndexCount\t= pSpr->m_uiIndexCount;\r\n\t\t\t\t\t\tu16 skipSize\t\t= pSpr->m_uiVertexCount * strideVertex;\r\n\r\n\t\t\t\t\t\tbufferShift |= (pCommand->m_uiStatus & FLAG_BUFFERSHIFT);\r\n\t\t\t\t\t\t// Copy chunk of complete vertex. \r\n\t\t\t\t\t\t// MemCopy UV\r\n\t\t\t\t\t\t// MemCopy XY\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\t\t\t\t\tm_totalTransferSize\t+= skipSize + pSpr->m_uiVertexCount;\t// X,Y,U,V,Color\r\n\t#endif\r\n\t\t\t\t\t\tif (bufferShift) {\r\n\t\t\t\t\t\t\t// Copy X,Y,U,V\r\n\t\t\t\t\t\t\tmemcpy32(pDstVertexBuffer,\tpSpr->m_pVertex,\tskipSize              * sizeof(float));\r\n\t\t\t\t\t\t\t// Modify color only on shift.\r\n\t\t\t\t\t\t\tmemcpy32(pDstColBuffer,\t\tpSpr->m_pColors,\tpSpr->m_uiVertexCount * sizeof(u32  ));\r\n\r\n\t\t\t\t\t\t\tif (pLastTextureMask) {\r\n\t\t\t\t\t\t\t\tmemcpy32(ptrUVMask, pSpr->m_pVertexMaskUV,\t(skipSize *sizeof(float)) >> 1);\r\n\t\t\t\t\t\t\t\tptrUVMask += skipSize >> 1;\r\n\t\t\t\t\t\t\t}\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\t\t\t\t\t\tm_memCopySize\t+= (skipSize + pSpr->m_uiVertexCount);\t// X,Y,U,V,Color\r\n\t#endif\r\n\r\n\t\t\t\t\t\t\t// Index buffer recompute\r\n\t\t\t\t\t\t\tu16 lCount\t\t= sprIndexCount;\r\n\t\t\t\t\t\t\tu16* pSprIdx\t= pSpr->m_pIndex;\r\n\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t// Unroll loop by block of 8 indexes\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\tloopSwitch:\r\n\t\t\t\t\t\t\tswitch (lCount) {\r\n\t\t\t\t\t\t\tcase 7: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 6: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 5: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 4: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 3: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 2: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\tcase 1: *pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\tif (lCount >= 8) {\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\t*pDstIndexBuffer++\t= (*pSprIdx++) + indexVCount;\r\n\t\t\t\t\t\t\t\t\tlCount -= 8;\r\n\t\t\t\t\t\t\t\t\tgoto loopSwitch;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t//\t\t\t\t\tprintf(\"cpy xyuv cpy col by shift\");\r\n\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// --- Geometry or color update : triangle do not change ---\r\n\t\t\t\t\t\t\tif (pCommand->m_uiStatus & (FLAG_XYUPDATE | FLAG_UVUPDATE)) {\r\n\t\t\t\t\t\t\t\tmemcpy32(pDstVertexBuffer, pSpr->m_pVertex, skipSize * sizeof(float));\r\n\t\t\t\t\t\t\t\tif (pLastTextureMask) {\r\n\t\t\t\t\t\t\t\t\tmemcpy32(ptrUVMask, pSpr->m_pVertexMaskUV,\t(skipSize *sizeof(float)) >> 1);\r\n\t\t\t\t\t\t\t\t\tptrUVMask += skipSize >> 1;\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\t\t\t\t\t\t\tm_memCopySize\t+= skipSize;\t// Number of float XYUV\r\n\t#endif\r\n\t\t//\t\t\t\t\t\tprintf(\"cpy xyuv \");\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// else XYUV untouched\r\n\t\t//\t\t\t\t\t\tprintf(\"skp xyuv \");\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (pCommand->m_uiStatus & FLAG_COLORUPDATE) {\r\n\t\t\t\t\t\t\t\tmemcpy32(pDstColBuffer, pSpr->m_pColors, pSpr->m_uiVertexCount * sizeof(u32));\t// Modify color only on shift.\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\t\t\t\t\t\t\tm_memCopySize\t+= pSpr->m_uiVertexCount; // Number of color.\r\n\t#endif\r\n\t\t//\t\t\t\t\t\tprintf(\"cpy col\");\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// else Color untouched.\r\n\t\t//\t\t\t\t\t\tprintf(\"skp col\");\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// Index buffer untouched.\r\n\t\t\t\t\t\t\tpDstIndexBuffer\t\t+= sprIndexCount;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tpDstVertexBuffer\t+= skipSize;\r\n\t\t\t\t\t\tpDstColBuffer\t\t+= pSpr->m_uiVertexCount;\r\n\t\t\t\t\t\tindexCount\t\t\t+= sprIndexCount;\r\n\t\t\t\t\t\tindexVCount\t\t\t+= pSpr->m_uiVertexCount;\r\n\t\t\t\t\t\toffsetVertexHead\t+= pSpr->m_uiVertexCount;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// In case a sprite changed from n -> 0 vertex : global buffer is shifted.\r\n\t\t\t\t\tbufferShift |= (pCommand->m_uiStatus & FLAG_BUFFERSHIFT);\r\n\t//\t\t\t\tprintf(\"skip %i shift\",bufferShift);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Reset flag (processed)\r\n\t\t\t\tpCommand->m_uiStatus = 0;\r\n\t\t\t\t// Go next command.\r\n\t\t\t\tpCommand = pCommand->m_pNext;\r\n\t\t\t} else {\r\n\t\t\t\t#ifdef DEBUG_PERFORMANCE  \r\n\t\t\t\t\tm_renderStateChange++;\r\n\t\t\t\t#endif\r\n\t\t\t\temitDrawCall\t(&indexCount, &offsetIndex, &offsetVertex, offsetVertexHead, pLastTexture, pLastTextureMask);\r\n\t\t\t\tptrUVMask\t= m_maskUVPtr;\r\n\t\t\t\tindexVCount = 0;\r\n\t\t\t\t\r\n\t\t\t\t// Support render state change.\r\n\t\t\t\tCKLBRenderState* pRCom = (CKLBRenderState*)pCommand;\r\n\r\n\t\t\t\tint cmdType = pRCom->m_commandType;\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_CHANGERENDERSTATE) {\r\n\t\t\t\t\tm_pCurrState\t= pRCom->getState();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_SETSHADER) {\r\n\t\t\t\t\tm_stackShader[m_stackShaderIdx++] = m_pCurrShader;\r\n\t\t\t\t\tm_pCurrShader\t= pRCom->getShader();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_EXECUTECOMMAND) {\r\n\t\t\t\t\t// case RENDERCOMMAND_CLEARCOLOR:\r\n\t\t\t\t\t// case RENDERCOMMAND_CLEARDEPTH:\r\n\t\t\t\t\t// case RENDERCOMMAND_CLEARSTENCIL:\r\n\t\t\t\t\tpRCom->executeCommand();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_CHANGETARGET) {\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cmdType & RENDERCOMMAND_UNSETSHADER) {\r\n\t\t\t\t\tm_pCurrShader\t= m_stackShader[--m_stackShaderIdx];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbufferShift |= (pCommand->m_uiStatus & FLAG_BUFFERSHIFT);\r\n\r\n\t\t\t\t// Reset flag (processed)\r\n\t\t\t\tpCommand->m_uiStatus = 0;\r\n\t\t\t\t// Go next command.\r\n\t\t\t\tpCommand = pCommand->m_pNext;\r\n\r\n\t\t\t\tif (pRCom->jump) {\r\n\t\t\t\t\trenderStack[stackDepth  ] = pCommand;\r\n\t\t\t\t\trenderStack[stackDepth+1] = pEnd;\r\n\r\n\t\t\t\t\tstackDepth += 2;\r\n\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Switch to new rendering sub-queue\r\n\t\t\t\t\t//\r\n\t\t\t\t\tpCommand\t= pRCom->jump;\r\n\t\t\t\t\tpEnd\t\t= pRCom->end;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\temitDrawCall\t\t(&indexCount, &offsetIndex, &offsetVertex, offsetVertexHead, pLastTexture, pLastTextureMask);\r\n\t\tptrUVMask\t= m_maskUVPtr;\r\n\t} while ((stackDepth -= 2) >= 0);\r\n#ifdef DEBUG_PERFORMANCE\r\n\tm_drawTime\t\t\t= CPFInterface::getInstance().platform().nanotime() - m_drawTime;\r\n#endif\r\n}\r\n\r\n// ------------------------------------------\r\n//   Render Command.\r\n// ------------------------------------------\r\n\r\nCKLBRenderCommand::CKLBRenderCommand():\r\n\tm_pNext\t\t\t\t(NULL),\r\n\tm_pPrev\t\t\t\t(NULL),\r\n\tm_pAllocPrev\t\t(NULL),\r\n\tm_pAllocNext\t\t(NULL),\r\n\tm_uiLocalColor\t\t(0xFFFFFFFF),\t// Most likely never used color to force refresh at first setup.\r\n\tm_uiOrder\t\t\t(0),\r\n\tm_renderOffset\t\t(0),\r\n\tm_uiRefCount\t\t(0),\r\n\tignore\t\t\t\t(false)\r\n{\r\n\tm_commandType\t= 0;\r\n\tm_uiStatus\t\t= 0;\r\n}\r\n\r\nvoid CKLBRenderCommand::changeOrder(CKLBRenderingManager& pRdr, u32 newOrder) {\r\n\tnewOrder += m_renderOffset;\r\n\r\n\t// Can change the order ONLY if the object is already in the list\r\n\tif (this->m_uiOrder == newOrder) {\r\n\t\treturn;\r\n\t}\r\n\r\n//\tif (this->m_pNext || this->m_pNext) {\r\n\tif (this->m_pPrev || this->m_pNext) {\r\n\t\tpRdr.removeFromRendering(this);\r\n\t\tpRdr.addToRendering(this, newOrder);\r\n\t} else {\r\n\t\tthis->m_uiOrder = newOrder;\r\n\t}\r\n}\r\n\r\n// ------------------------------------------\r\n//   Sprite.\r\n// ------------------------------------------\r\n\r\nCKLBSprite::CKLBSprite():\r\n\tCKLBRenderCommand\t(),\r\n\tm_pTexture\t\t\t(NULL),\r\n\tm_pMaskTexture\t\t(NULL),\r\n\tm_pVertex\t\t\t(NULL),\r\n\tm_pVertexMaskUV\t\t(NULL),\r\n\tm_pIndex\t\t\t(NULL),\r\n\tm_pColors\t\t\t(NULL),\r\n\tm_uiVertexCount\t\t(0),\r\n\tm_uiIndexCount\t\t(0),\r\n\tm_pImageAsset\t\t(NULL),\r\n\tm_pState\t\t\t(NULL),\r\n\tm_uiColor\t\t\t(0x03EF02F6),\r\n\tm_bAllocated\t\t(1),\r\n\tm_click\t\t\t\t(1)\r\n{\r\n\tm_uiStatus\t\t\t= 0;\r\n\tm_commandType\t\t= RENDERCOMMAND_SPRITE;\r\n}\r\n\r\nCKLBSprite::~CKLBSprite() {\r\n\tif (m_pNext || m_pPrev) {\r\n\t\tCKLBRenderingManager::getInstance().removeFromRendering(this);\r\n\t}\r\n\r\n\tif (m_pVertex && m_bAllocated) {\r\n\t\tKLBDELETEA(m_pVertex);\r\n\t\tm_pVertex = NULL;\r\n\t}\r\n}\r\n\r\nbool crossLine( float x1 , float y1 , float x2 , float y2 , float px , float py , float cx , float cy )\r\n{\r\n\tfloat check=0.0f;\r\n\r\n\tcheck = ((x1-x2)*(py-y1) + (y1-y2)*(x1-px)) * ((x1-x2)*(cy-y1) + (y1-y2)*(x1-cx));\r\n\r\n\tif( check<0 ) return true;\r\n\r\n\treturn false;\r\n}\r\nbool CKLBSprite::clicked(float u, float v) {\r\n\tfloat inputX = u;\r\n\tfloat inputY = v;\r\n\r\n\tu16 tri_max = m_uiMaxVertexCount-2;\r\n\tu16 tri_count = 0;\r\n\t\r\n\tfloat p1[4];\r\n\tfloat p2[4];\r\n\tfloat p3[4];\r\n\r\n\t//\r\n\t// 1. Test by bounding box search.\r\n\t//\r\n\tbool inside = false;\r\n\tfloat* pVert = m_pVertex;\r\n\tfloat minX = 99999.0f,  minY = 99999.0f;\r\n\tfloat maxX = -99999.0f, maxY = -99999.0f;\r\n\r\n\tfor( tri_count=0 ; tri_count<m_uiMaxVertexCount; tri_count++ ) {\r\n\t\tfloat v = *pVert++;\t\t// X\r\n\t\tif (v < minX) {\tminX = v;\t}\r\n\t\tif (v > maxX) {\tmaxX = v;\t}\r\n\t\tv = *pVert;\tpVert +=3 ;\t// Y, skip UV\r\n\t\tif (v < minY) {\tminY = v;\t}\r\n\t\tif (v > maxY) {\tmaxY = v;\t}\r\n\t}\r\n\r\n\t// Outside of bounding box -> Early reject.\r\n\tif ((inputX < minX) || (inputX > maxX)) { return false; }\r\n\tif ((inputY < minY) || (inputY > maxY)) { return false; }\r\n\r\n\t//\r\n\t// 2. Test if inside triangle.\r\n\t//\r\n\tfor( tri_count=0 ; tri_count<tri_max ; tri_count++ )\r\n\t{\r\n\t\tu16\tidx[3];\r\n\t\tidx[0] = tri_count*3;\r\n\t\tidx[1] = tri_count*3+1;\r\n\t\tidx[2] = tri_count*3+2;\r\n\r\n\t\tu16 vertexID = m_pIndex[idx[0]]*VERTEX_SIZE;\r\n\t\tp1[0] = m_pVertex[vertexID++];\t\t// x\r\n\t\tp1[1] = m_pVertex[vertexID];\t\t// y\r\n\r\n\t\tvertexID = m_pIndex[idx[1]]*VERTEX_SIZE;\r\n\t\tp2[0] = m_pVertex[vertexID++];\t\t// x\r\n\t\tp2[1] = m_pVertex[vertexID];\t\t// y\r\n\r\n\t\tvertexID = m_pIndex[idx[2]]*VERTEX_SIZE;\r\n\t\tp3[0] = m_pVertex[vertexID++];\t\t// x\r\n\t\tp3[1] = m_pVertex[vertexID];\t\t// y\r\n\r\n\t\tfloat cx = (p1[0] + p2[0] + p3[0])/3.0f;\r\n\t\tfloat cy = (p1[1] + p2[1] + p3[1])/3.0f;\r\n\r\n\t\tif( crossLine( p1[0], p1[1], p2[0], p2[1], inputX, inputY, cx, cy ) ) continue;\r\n\t\tif( crossLine( p1[0], p1[1], p3[0], p3[1], inputX, inputY, cx, cy ) ) continue;\r\n\t\tif( crossLine( p2[0], p2[1], p3[0], p3[1], inputX, inputY, cx, cy ) ) continue;\r\n\r\n\t\tp1[2] = m_pVertex[m_pIndex[idx[0]]*VERTEX_SIZE+VERTEX_U_IDX];\t// u\r\n\t\tp1[3] = m_pVertex[m_pIndex[idx[0]]*VERTEX_SIZE+VERTEX_V_IDX];\t// v\r\n\t\tp2[2] = m_pVertex[m_pIndex[idx[1]]*VERTEX_SIZE+VERTEX_U_IDX];\t// u\r\n\t\tp2[3] = m_pVertex[m_pIndex[idx[1]]*VERTEX_SIZE+VERTEX_V_IDX];\t// v\r\n\t\tp3[2] = m_pVertex[m_pIndex[idx[2]]*VERTEX_SIZE+VERTEX_U_IDX];\t// u\r\n\t\tp3[3] = m_pVertex[m_pIndex[idx[2]]*VERTEX_SIZE+VERTEX_V_IDX];\t// v\r\n\r\n\t\tinside = true;\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif( inside )\r\n\t{\r\n\t\tfloat testX = inputX - p1[0];\r\n\t\tfloat testY = inputY - p1[1];\r\n\t\t\r\n\t\tfloat TX[2],TY[2];\r\n\t\t/*\r\n\t\t\tp3\r\n\t\t\t|\r\n\t\t\tp1----p2\r\n\r\n\t\t\tT1 = p3-p1\r\n\t\t\tT2 = p2-p1\r\n\t\t*/\r\n\t\tTY[0] = p3[0]-p1[0];\r\n\t\tTY[1] = p3[1]-p1[1];\r\n\r\n\t\tTX[0] = p2[0]-p1[0];\r\n\t\tTX[1] = p2[1]-p1[1];\r\n\r\n\t\tfloat invDet = 1.0f / (TX[0]*TY[1]-TX[1]*TY[0]);\r\n\t\tfloat mat[4];\r\n\t\t/*\r\n\t\t\tmat[0] mat[1]\r\n\t\t\tmat[2] mat[3]\r\n\t\t*/\r\n\t\tmat[0] =  TY[1]*invDet;\tmat[1] = -TY[0]*invDet;\r\n\t\tmat[2] = -TX[1]*invDet;\tmat[3] =  TX[0]*invDet;\r\n\r\n\t\tfloat R[2];\r\n\t\tR[0] = testX*mat[0]+testY*mat[1];\r\n\t\tR[1] = testX*mat[2]+testY*mat[3];\r\n\r\n\t\tif ((R[0] < 0.0f) || (R[1] < 0.0f) || (R[0] + R[1] > 1.0f)) {\r\n\t\t\t// Early reject.\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tfloat retU = p1[2]+R[0]*(p2[2]-p1[2])+R[1]*(p3[2]-p1[2]);\r\n\t\tfloat retV = p1[3]+R[0]*(p2[3]-p1[3])+R[1]*(p3[3]-p1[3]);\r\n\r\n\t\treturn this->m_pTexture->pTexture->isAlpha(retU,retV) != 0;\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nCKLBSprite4_6::CKLBSprite4_6():CKLBSprite() {\r\n\tm_bAllocated = 0;\r\n}\r\n\r\nCKLBSprite4_6::~CKLBSprite4_6() {\r\n\t// Do nothing.\r\n}\r\n\r\n#include \"CKLBNode.h\"\r\n\r\n/*virtual*/\r\nvoid CKLBSprite::applyNode(CKLBNode* pNode, float stx, float sty) {\r\n\tconst SMatrix2D* pMat = &pNode->m_composedMatrix;\r\n\tif (this->m_pImageAsset) {\r\n\t\tfloat* srcUV  = this->m_pImageAsset->getUVBuffer();\r\n\t\tfloat* srcXY  = this->m_pImageAsset->getXYBuffer();\r\n\t\tint    vCount = this->m_uiVertexCount;\r\n\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\t\tCKLBNode::s_vertexRecomputeCount += vCount;\r\n\t#endif\r\n\t\r\n\t\t// We are ok here because we garantee to modify coordinate only when matrix changes.\r\n\t\tthis->m_uiStatus |= FLAG_XYUPDATE;\r\n\r\n\t\tfloat* dstXY;\r\n\t\tif (this->m_uiStatus & FLAG_UVUPDATE) {\r\n//\t\t\tprintf(\"update UV\");\r\n\r\n\t\t\t// X,Y,U,V\r\n\t\t\tdstXY  =  this->m_pVertex + (VERTEX_SIZE - 2);\r\n\r\n\t\t\tfor (int n=0; n < vCount; n++) {\r\n\t\t\t\t*dstXY++ = (*srcUV++);\r\n\t\t\t\t*dstXY = (*srcUV++);\r\n\t\t\t\tdstXY += (VERTEX_SIZE-1);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n//\t\tprintf(\"\\n\");\r\n\t\tdstXY  =  this->m_pVertex;\r\n\r\n\t\tswitch (pMat->m_type) {\r\n\t\tcase MATRIX_ID:\t// Identity\r\n\t\t\tfor (int n=0; n < vCount; n++) {\r\n\t\t\t\t*dstXY++ = (*srcXY++) + stx;\r\n\t\t\t\t*dstXY   = (*srcXY++) + sty;\r\n\t\t\t\tdstXY   += (VERTEX_SIZE - 1);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MATRIX_T:\r\n\t\t\t{\r\n\t\t\t\tfloat tx = pMat->m_matrix[MAT_TX] + stx;\r\n\t\t\t\tfloat ty = pMat->m_matrix[MAT_TY] + sty;\r\n\r\n\t\t\t\tfor (int n=0; n < vCount; n++) {\r\n\t\t\t\t\t*dstXY++ = (*srcXY++) + tx;\r\n\t\t\t\t\t*dstXY   = (*srcXY++) + ty;\r\n\t\t\t\t\tdstXY   += (VERTEX_SIZE - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MATRIX_TS:\r\n\t\t\t{\r\n\t\t\t\tfloat tx = pMat->m_matrix[MAT_TX];\r\n\t\t\t\tfloat ty = pMat->m_matrix[MAT_TY];\r\n\t\t\t\tfloat sx = pMat->m_matrix[MAT_A];\r\n\t\t\t\tfloat sy = pMat->m_matrix[MAT_D];\r\n\r\n\t\t\t\tfor (int n=0; n < vCount; n++) {\r\n\t\t\t\t\t*dstXY++ = (((*srcXY++) + stx) * sx) + tx;\r\n\t\t\t\t\t*dstXY   = (((*srcXY++) + sty) * sy) + ty;\r\n\t\t\t\t\tdstXY   += (VERTEX_SIZE - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MATRIX_TG:\r\n\t\t\t{\r\n\t\t\t\tfloat tx  = pMat->m_matrix[MAT_TX];\r\n\t\t\t\tfloat ty  = pMat->m_matrix[MAT_TY];\r\n\t\t\t\tfloat sx  = pMat->m_matrix[MAT_A];\r\n\t\t\t\tfloat nsx = pMat->m_matrix[MAT_B];\r\n\t\t\t\tfloat sy  = pMat->m_matrix[MAT_D];\r\n\t\t\t\tfloat nsy = pMat->m_matrix[MAT_C];\r\n\r\n\t\t\t\tfor (int n=0; n < vCount; n++) {\r\n\t\t\t\t\tfloat lx = (*srcXY++) + stx;\r\n\t\t\t\t\tfloat ly = (*srcXY++) + sty;\r\n\r\n\t\t\t\t\t*dstXY++ = (lx * sx) + (ly * nsx) + tx;\r\n\t\t\t\t\t*dstXY   = (ly * sy) + (lx * nsy) + ty;\r\n\t\t\t\t\tdstXY   += (VERTEX_SIZE - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBSprite::applyNode(CKLBNode* pNode) {\r\n\tapplyNode(pNode, 0.0f, 0.0f);\r\n}\r\n\r\n/**\r\n\tWARNING : This function MUST be used with marking the NODE\r\n\tfor recomputation.\r\n */\r\nvoid CKLBSprite::switchImage(CKLBImageAsset* pImage) {\r\n\tif (m_pImageAsset != pImage) {\r\n\t\tu32 oldOrder = this->m_uiOrder - m_renderOffset; // Original order\r\n\t\tm_pImageAsset = pImage;\r\n\r\n\t\tif (pImage)\t{\r\n\t\t\tu32 vCount = pImage->getVertexCount();\r\n\t\t\tm_uiStatus |= FLAG_UVUPDATE; // XY modified by node marking.\r\n\t\t\tif (m_uiVertexCount\t!= vCount) {\r\n\t\t\t\tm_uiStatus |= FLAG_BUFFERSHIFT;\r\n\t\t\t}\r\n\r\n\t\t\tu32 color = m_pColors[0];\t// Backup transformed color.\r\n\r\n\t\t\tif (vCount > m_uiMaxVertexCount) {\r\n\t\t\t\t//\r\n\t\t\t\t// Delete old buffers\r\n\t\t\t\t//\r\n\t\t\t\tif (m_bAllocated) {\r\n\t\t\t\t\tKLBDELETEA(m_pVertex);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//\r\n\t\t\t\t// Allocate new buffers\r\n\t\t\t\t//\r\n\t\t\t\tint add = ((pImage->m_attribMask & CKLBImageAsset::IS_3DMODEL) ? 2 : 0);\r\n\t\t\t\tfloat* pVertex\t\t= KLBNEWA(float, vCount * (5 + add));\t// Add Z&W for 3D object.\r\n\t\t\t\tu32*   pColors\t\t= (u32*)&pVertex[vCount * 4 + add];\r\n\t\t\t\tif (pVertex) {\r\n\t\t\t\t\tm_bAllocated\t\t= 1;\r\n\t\t\t\t\tm_pVertex\t\t\t= pVertex;\r\n\t\t\t\t\tm_pColors\t\t\t= pColors;\r\n\t\t\t\t\tm_uiMaxVertexCount\t= m_uiVertexCount;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tklb_assertAlways(\"Memory Allocation error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tm_uiIndexCount\t\t= (u16)pImage->getIndexCount();\r\n\t\t\tm_uiVertexCount\t\t= (u16)vCount;\r\n\t\t\tm_pIndex\t\t\t= pImage->getIndexBuffer();\r\n\t\t\tm_pTexture\t\t\t= pImage->getTexture()->m_pTextureUsage;\r\n\t\t\tm_renderOffset\t\t= pImage->m_renderOffset * gUseOffsetSystem;\r\n\t\t\tmemset32(m_pColors, color, vCount*sizeof(u32));\r\n\t\t} else {\r\n\t\t\tm_uiStatus |= FLAG_BUFFERSHIFT;\r\n\r\n\t\t\tm_uiVertexCount\t\t= 0;\r\n\t\t\tm_uiIndexCount\t\t= 0;\r\n\t\t\tm_pIndex\t\t\t= NULL;\r\n\t\t\tm_pTexture\t\t\t= NULL;\r\n\t\t\tm_renderOffset\t\t= 0;\r\n\t\t}\r\n\t\t\r\n\t\tthis->changeOrder(CKLBRenderingManager::getInstance(), oldOrder); // Set original order.\r\n\t}\r\n}\r\n\r\nvoid CKLBSprite::setMask(CKLBImageAsset* pImage) {\r\n\tif (pImage) {\r\n\t\tif ((pImage->getVertexCount() != m_uiVertexCount) || (pImage->getIndexCount() != m_uiIndexCount)) {\r\n\t\t\tklb_assertAlways(\"Mask vertices does not match sprite image vertices\");\r\n\t\t}\r\n\t\tthis->m_pVertexMaskUV\t= pImage->getUVBuffer();\r\n\t\tthis->m_pMaskTexture\t= pImage->getTexture()->m_pTextureUsage;\r\n\t} else {\r\n\t\tthis->m_pVertexMaskUV\t= NULL;\r\n\t\tthis->m_pMaskTexture\t= NULL; \r\n\t}\r\n}\r\n\r\n// ------------------------------------------\r\n//   Dynamic Sprites.\r\n// ------------------------------------------\r\n\r\n\r\nCKLBPolyline::CKLBPolyline()\r\n:CKLBDynSprite\t()\r\n,m_points\t\t(NULL)\r\n,m_maxPts\t\t(0)\r\n{\r\n}\r\n\r\nCKLBPolyline::~CKLBPolyline() {\r\n\trelease();\r\n}\r\n\r\nvoid CKLBPolyline::release() {\r\n\tKLBDELETEA(_internalImg.m_pXYCoord);\r\n\t_internalImg.m_pXYCoord = NULL;\r\n\r\n\tKLBDELETEA(m_pVertex);\r\n\tm_pVertex = NULL;\r\n}\r\n\r\nbool CKLBPolyline::setMaxPointCount\t(u32 ptsCount) {\r\n\trelease();\r\n\tu32 vertCount = (ptsCount-1) * 4;\r\n\tu32 idxCount  = (ptsCount-1) * 6;\r\n\r\n\t_internalImg.m_bAllocatedOutsideTexture = true;\r\n\t\r\n\t_internalImg.m_uiIndexCount\t\t= 0;\r\n\t_internalImg.m_uiVertexCount\t= 0;\r\n\t_internalImg.m_pTextureAsset\t= NULL;\r\n\r\n\tfloat* buf\t=\tKLBNEWA(float, (vertCount*4) + ((idxCount + 2)>>1)); \r\n\t\r\n\t// Use as one memory block.\r\n\t_internalImg.m_pXYCoord\t\t\t= buf;\r\n\t_internalImg.m_pUVCoord\t\t\t= &buf[vertCount*2];\r\n\t_internalImg.m_pIndex\t\t\t= (u16*)&buf[vertCount*4];\r\n\r\n\t// Post Transform array.\r\n\tfloat*\tarr\t\t\t= KLBNEWA(float,(vertCount * (VERTEX_SIZE + 2)) + (ptsCount*2) );\r\n\tu32* arrCol\t\t\t= (u32*)&arr[vertCount*VERTEX_SIZE];\r\n\tm_pLocalColors\t\t= &arrCol[vertCount];\r\n\tm_points\t\t\t= (float*)&m_pLocalColors[vertCount];\r\n\t\r\n\tbool res = _internalImg.m_pXYCoord && arr;\r\n\tif (res) {\r\n\r\n\t\t//\r\n\t\t// Fill arrays\r\n\t\t//\r\n\t\tfor (u32 n=0; n < vertCount*2; n++) {\r\n\t\t\t_internalImg.m_pUVCoord[n] = 0.0f;\r\n\t\t\t_internalImg.m_pXYCoord[n] = 0.0f;\r\n\t\t}\r\n\r\n\t\tu16 m = 0;\r\n\t\tfor (u32 n=0; n < idxCount; n+=6) {\r\n\t\t\t_internalImg.m_pIndex[n  ]\t= 0 + m;\r\n\t\t\t_internalImg.m_pIndex[n+1]\t= 1 + m;\r\n\t\t\t_internalImg.m_pIndex[n+2]\t= 3 + m;\r\n\t\t\t_internalImg.m_pIndex[n+3]\t= 1 + m;\r\n\t\t\t_internalImg.m_pIndex[n+4]\t= 2 + m;\r\n\t\t\t_internalImg.m_pIndex[n+5]\t= 3 + m;\r\n\t\t\tm += 4;\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < vertCount; n++) {\r\n\t\t\tarrCol[n]\t\t\t\t\t= 0xFFFFFFFF;\r\n\t\t\tm_pLocalColors[n]\t\t\t= 0xFFFFFFFF;\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < ptsCount*2; n++) {\r\n\t\t\tm_points[n] = 0.0f;\r\n\t\t}\r\n\r\n\t\tm_pImageAsset\t\t= &_internalImg;\r\n\t\tm_pVertex\t\t\t= arr;\r\n\t\tm_pColors\t\t\t= arrCol;\r\n\t\tm_pIndex\t\t\t= _internalImg.m_pIndex;\t// Cache\r\n\t\tm_uiVertexCount\t\t= 0;\r\n\t\tm_uiIndexCount\t\t= 0;\r\n\t\tm_uiMaxVertexCount\t= (u16)vertCount;\r\n\t\tm_uiMaxIndexCount\t= (u16)idxCount;\r\n\r\n\t\tm_pTexture\t\t\t= NULL;\r\n\t\tm_uiStatus\t\t\t= FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\r\n\t\tthis->switchImage(&_internalImg);\r\n\t\r\n\t\tm_maxPts\t\t\t= (u16)ptsCount;\r\n\t} else {\r\n\t\tKLBDELETEA(arr);\r\n\t\t// Other arrays destroyed when this object is destroyed.\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nvoid CKLBPolyline::setPointCount\t(u32 ptsCount) {\r\n\tu32 vertCount = (ptsCount-1) * 4;\r\n\tu32 idxCount  = (ptsCount-1) * 6;\r\n\r\n\tklb_assert(vertCount <= m_uiMaxVertexCount, \"setPointCount reached limit.\");\r\n\tklb_assert(idxCount  <= m_uiMaxIndexCount , \"setPointCount reached limit.\");\r\n\r\n\tm_uiVertexCount\t\t\t\t\t= (u16)vertCount;\r\n\tm_uiIndexCount\t\t\t\t\t= (u16)idxCount;\r\n\t_internalImg.m_uiIndexCount\t\t= (u16)idxCount;\r\n\t_internalImg.m_uiVertexCount\t= (u16)vertCount;\r\n\r\n\tfor (u32 n=0; n < ptsCount>>1; n++) {\r\n\t\trecomputeSegment(n);\r\n\t}\r\n\tm_uiStatus\t\t\t|= FLAG_BUFFERSHIFT | FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n}\r\n\r\nvoid CKLBPolyline::recomputeSegment(u32 idxSegment) {\r\n\tint id = idxSegment * 2;\r\n\r\n\t// Start\r\n\tfloat dx = m_points[id + 2] - m_points[id];\r\n\tfloat dy = m_points[id + 3] - m_points[id + 1];\r\n\r\n\t// Normalize Vector.\r\n\tfloat norm = sqrt((dx*dx) + (dy*dy));\r\n\tdx\t= dx / norm;\r\n\tdy\t= dy / norm;\r\n\r\n\t// Width for now\r\n\tdx *= 0.75f; \r\n\tdy *= 0.75f; \r\n\r\n\tfloat* arr = &_internalImg.m_pXYCoord[idxSegment * 8];\r\n\r\n\t//\r\n\tarr[0] = m_points[id  ] - dy;\t// x0\r\n\tarr[1] = m_points[id+1] + dx;\t// y0\r\n\r\n\tarr[2] = m_points[id+2] - dy;\t// x1\r\n\tarr[3] = m_points[id+3] + dx;\t// y1\r\n\r\n\tarr[4] = m_points[id+2] + dy;\t// x2\r\n\tarr[5] = m_points[id+3] - dx;\t// y2\r\n\r\n\tarr[6] = m_points[id  ] + dy;\t// x3\r\n\tarr[7] = m_points[id+1] - dx;\t// y3\r\n}\r\n\r\nvoid CKLBPolyline::setPoint\t\t\t(u32 idx, float x, float y) {\r\n\tklb_assert(idx < m_maxPts, \"setPointCount reached limit.\");\r\n\r\n\tu32 id = idx * 2;\r\n\tm_points[id  ] = x;\r\n\tm_points[id+1] = y;\r\n\r\n\tif (idx == 0) {\r\n\t\trecomputeSegment(0);\r\n\t} else if (idx == (m_maxPts-1)) {\r\n\t\tidx++;\r\n\t\tidx >>= 1;\r\n\t\trecomputeSegment(idx  );\r\n\t} else {\r\n\t\t// Intermediate\r\n\t\tidx >>= 1;\r\n\t\trecomputeSegment(idx  );\r\n\t\trecomputeSegment(idx+1);\r\n\t}\r\n\tm_uiStatus\t\t\t|= FLAG_XYUPDATE;\r\n}\r\n\r\nvoid CKLBPolyline::setColor\t\t\t(u32 colorARGB) {\r\n\t// Conversion u32 ARGB platform dependant to RGBA byte order.\r\n\tu8 col[4];\r\n\tcol[3] = colorARGB>>24;\r\n\tcol[0] = colorARGB>>16;\r\n\tcol[1] = colorARGB>>8 ;\r\n\tcol[2] = colorARGB>>0 ;\r\n\tu32 color = *((u32*)col);\r\n\r\n\tfor (u32 n=0; n < m_uiMaxVertexCount; n++) {\r\n\t\tm_pColors[n]\t\t\t\t= color;\r\n\t\tm_pLocalColors[n]\t\t\t= color;\r\n\t}\r\n\tm_uiStatus\t\t\t|= FLAG_COLORUPDATE;\r\n}\r\n\r\nCKLBDynSprite::CKLBDynSprite()\r\n:CKLBSprite()\r\n,m_pLocalColors(NULL)\r\n{\r\n\t_internalImg.m_pTextureAsset\t= NULL;\r\n\tthis->m_pTexture\t\t\t\t= NULL;\r\n}\r\n\r\nCKLBDynSprite::~CKLBDynSprite() {\r\n}\r\n\r\nbool CKLBDynSprite::setTriangleCount(u16 vertexCount, u16 indexCount) {\r\n\t_internalImg.m_bAllocatedOutsideTexture = true;\r\n\t\r\n\t// Vertex & index count\r\n\r\n\t_internalImg.m_uiIndexCount\t\t= indexCount;\r\n\t_internalImg.m_uiVertexCount\t= vertexCount;\r\n\t_internalImg.m_pTextureAsset\t= NULL;\r\n\r\n\tfloat* buf\t=\tKLBNEWA(float, (vertexCount*4) + ((indexCount + (indexCount&1))>>1));\r\n\r\n\t_internalImg.m_pXYCoord\t\t\t= buf;\r\n\t_internalImg.m_pUVCoord\t\t\t= &buf[vertexCount*2];\r\n\t_internalImg.m_pIndex\t\t\t= (u16*)&buf[vertexCount*4];\r\n\r\n\t//\r\n\tfloat*\tarr\t\t\t= KLBNEWA(float,vertexCount * (VERTEX_SIZE + 2) );\r\n\tu32* arrCol\t\t\t= (u32*)&arr[vertexCount * VERTEX_SIZE];\r\n\tm_pLocalColors\t\t= &arrCol[vertexCount];\r\n\r\n\tbool res = (_internalImg.m_pXYCoord && arr);\r\n\tif (res) {\r\n\r\n\t\t//\r\n\t\t// Fill arrays\r\n\t\t//\r\n\t\tfor (u32 n=0; n < (u32)(vertexCount<<1); n++) {\r\n\t\t\t_internalImg.m_pUVCoord[n] = 0.0f;\r\n\t\t\t_internalImg.m_pXYCoord[n] = 0.0f;\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < vertexCount; n++) {\r\n\t\t\t_internalImg.m_pIndex[n]\t= (u16)n;\r\n\t\t\tarrCol[n]\t\t\t\t\t= 0xFFFFFFFF;\r\n\t\t\tm_pLocalColors[n]\t\t\t= 0xFFFFFFFF;\r\n\t\t}\r\n\r\n\t\tif (VERTEX_SIZE > 4) {\r\n\t\t\tmemset32(arr, 0, vertexCount * VERTEX_SIZE * sizeof(float));\r\n\t\t}\r\n\r\n\t\tm_pImageAsset\t\t= &_internalImg;\r\n\t\tm_pVertex\t\t\t= arr;\r\n\t\tm_pColors\t\t\t= arrCol;\r\n\t\tm_pIndex\t\t\t= _internalImg.m_pIndex;\t// Cache\r\n\t\tm_uiVertexCount\t\t= vertexCount;\r\n\t\tm_uiIndexCount\t\t= indexCount;\r\n\t\tm_uiMaxVertexCount\t= vertexCount;\r\n\t\tm_uiMaxIndexCount\t= indexCount;\r\n\r\n\t\tm_pTexture\t\t\t= NULL;\r\n\t\tm_uiStatus\t\t\t= FLAG_XYUPDATE | FLAG_COLORUPDATE | FLAG_UVUPDATE;\r\n\t} else {\r\n\t\tif\t(arr)\t\t\t\t{ KLBDELETEA(arr);\t\t\t\t}\r\n\t\t// Other arrays destroyed when this object is destroyed.\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nvoid CKLBDynSprite::setVertexXY\t\t(u32 index, float x, float y) {\r\n\tif (index < m_uiVertexCount) {\r\n\t\tindex *= 2;\r\n\t\t_internalImg.m_pXYCoord[index++] = x;\r\n\t\t_internalImg.m_pXYCoord[index  ] = y;\r\n\t\tm_uiStatus |= FLAG_XYUPDATE;\r\n\t}\r\n}\r\n\r\nvoid CKLBDynSprite::setVertexUV\t\t(u32 index, float u, float v) {\r\n\tif (index < m_uiVertexCount) {\r\n\t\tindex *= 2;\r\n\t\t_internalImg.m_pUVCoord[index++] = u;\r\n\t\t_internalImg.m_pUVCoord[index  ] = v;\r\n\t\tm_uiStatus |= FLAG_UVUPDATE;\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBSprite::setColor(const float* vec4) {\r\n\tu32 col = getLocalColor();\r\n\tu8* pLocalCol = (u8*)&col;\r\n\r\n\t//-----------------------------------\r\n\t// Combine with node color\r\n\t//-----------------------------------\r\n\ts32 alpha\t = (vec4[3] * pLocalCol[3]); // A\r\n\t\tif (alpha >= 256) {\talpha = 255;\t}\r\n\t\tif (alpha <    0) { alpha = 0;\t\t}\r\n\tpLocalCol[3] = alpha;\r\n#ifdef USE_PREMULALPHA\r\n\talpha += (alpha & 0x80)>>7; // 0..255 -> 0..256\r\n#endif\r\n\ts32 v\t\t = (vec4[0] * pLocalCol[0]); // R\r\n\t\tif (v >= 256) {\tv = 255;\t}\r\n\t\tif (v <    0) { v = 0;\t\t}\r\n#ifdef USE_PREMULALPHA\r\n\t\tpLocalCol[0] = (v * alpha) >> 8;\r\n#else\r\n\t\tpLocalCol[0] = v;\r\n#endif\r\n\t\tv\t\t = (vec4[1] * pLocalCol[1]); // G\r\n\t\tif (v >= 256) {\tv = 255;\t}\r\n\t\tif (v <    0) { v = 0;\t\t}\r\n#ifdef USE_PREMULALPHA\r\n\t\tpLocalCol[1] = (v * alpha) >> 8;\r\n#else\r\n\t\tpLocalCol[1] = v;\r\n#endif\r\n\t\tv\t\t = (vec4[2] * pLocalCol[2]); // B\r\n\t\tif (v >= 256) {\tv = 255;\t}\r\n\t\tif (v <    0) { v = 0;\t\t}\r\n#ifdef USE_PREMULALPHA\r\n\t\tpLocalCol[2] = (v * alpha) >> 8;\r\n#else\r\n\t\tpLocalCol[2] = v;\r\n#endif\r\n\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\tCKLBNode::s_colorRecomputeCount  += 1;\r\n\t#endif\r\n\r\n\t// Color changed ?\r\n\tif ((col != m_uiColor) || (this->m_uiStatus & FLAG_BUFFERSHIFT)) {\r\n\t\tm_uiColor = col;\r\n\t\tu32* pCol = this->m_pColors;\r\n\t\tthis->m_uiStatus |= FLAG_COLORUPDATE;\r\n\r\n\t\t// Fill with RGBA 32 bit color.\r\n\t\tint    vCount = this->m_uiVertexCount;\r\n\t\tmemset32(pCol, col, vCount * sizeof(u32));\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBDynSprite::setColor(const float* vec4) {\r\n\r\n\t#ifdef DEBUG_PERFORMANCE\r\n\tCKLBNode::s_colorRecomputeCount  += this->m_uiVertexCount;\r\n\t#endif\r\n\r\n\tfor (u32 n=0; n<this->m_uiVertexCount; n++) {\r\n\t\tu32 col = m_pLocalColors[n];\r\n\t\tu8* pLocalCol = (u8*)&col;\r\n\r\n\t\t//-----------------------------------\r\n\t\t// Combine with node color\r\n\t\t//-----------------------------------\r\n\t\ts32 alpha\t = (vec4[3] * pLocalCol[3]); // A\r\n\t\t\tif (alpha >= 256) {\talpha = 255;\t}\r\n\t\t\tif (alpha <    0) { alpha = 0;\t\t}\r\n\t\tpLocalCol[3] = alpha;\r\n#ifdef USE_PREMULALPHA\r\n\t\talpha += (alpha & 0x80)>>7; // 0..255 -> 0..256\r\n#endif\r\n\r\n\t\ts32  v\t\t = (vec4[0] * pLocalCol[0]); // R\r\n\t\t\tif (v >= 256) {\tv = 255;\t}\r\n\t\t\tif (v <    0) { v = 0;\t\t}\r\n#ifdef USE_PREMULALPHA\r\n\t\tpLocalCol[0] = (v * alpha) >> 8;\r\n#else\r\n\t\tpLocalCol[0] = v;\r\n#endif\r\n\t\t\tv\t\t = (vec4[1] * pLocalCol[1]); // G\r\n\t\t\tif (v >= 256) {\tv = 255;\t}\r\n\t\t\tif (v <    0) { v = 0;\t\t}\r\n#ifdef USE_PREMULALPHA\r\n\t\tpLocalCol[1] = (v * alpha) >> 8;\r\n#else\r\n\t\tpLocalCol[1] = v;\r\n#endif\r\n\r\n\t\t\tv\t\t = (vec4[2] * pLocalCol[2]); // B\r\n\t\t\tif (v >= 256) {\tv = 255;\t}\r\n\t\t\tif (v <    0) { v = 0;\t\t}\r\n#ifdef USE_PREMULALPHA\r\n\t\tpLocalCol[2] = (v * alpha) >> 8;\r\n#else\r\n\t\tpLocalCol[2] = v;\r\n#endif\r\n\r\n\t\tu32* pCol = this->m_pColors;\r\n\t\tif (pCol[n] != col) {\r\n\t\t\tpCol[n] = col;\r\n\t\t\tthis->m_uiStatus |= FLAG_COLORUPDATE;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBDynSprite::setVertexColor(CKLBNode* owner, u32 index, u32 color) {\r\n\t// !!! WARNING !!!\r\n\t// color is 4x8 bit in memory with RGBA order.\r\n\t// IT IS NOT RGBA inside a U32 ! (ie endianess may change the u32)\r\n\tif (index < m_uiVertexCount) {\r\n\t\tu32 alpha = ((u8*)(&color))[3];\r\n\t\talpha += (alpha & 0x80) >> 7;\r\n\t\tm_pLocalColors[index] = color;\r\n\t\tm_uiStatus |= FLAG_COLORUPDATE;\r\n\t\towner->markUpColor();\r\n\t}\r\n}\r\n\r\nbool CKLBDynSprite::importXYUV\t\t(CKLBImageAsset* pImage) {\r\n\tklb_assert(pImage,\"Null ptr\");\r\n\tklb_assert(pImage->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Not a standard rectangular image\");\r\n\t//\r\n\t// Import only rectangular shape into 2 triangles.\r\n\t// 013 123 Source\r\n\t// 012 345 Dest\r\n\t//\r\n\tfor (u32 n=0; n<12; n+=2) {\r\n\t\tu32 src;\r\n\r\n\t\tswitch (n>>1) {\r\n\t\tcase 0: src = 0; break;\r\n\t\tcase 1: src = 2; break;\r\n\t\tcase 2: src = 6; break;\r\n\t\tcase 3: src = 2; break;\r\n\t\tcase 4: src = 4; break;\r\n\t\tcase 5: src = 6; break;\r\n\t\tdefault: src = 0;\r\n\t\t}\r\n\r\n\t\t// Copy XY\r\n\t\t_internalImg.m_pXYCoord[n  ]\t= pImage->m_pXYCoord[src  ];\r\n\t\t_internalImg.m_pXYCoord[n+1]\t= pImage->m_pXYCoord[src+1];\r\n\r\n\t\t// Copy UV\r\n\t\t_internalImg.m_pUVCoord[n  ]\t= pImage->m_pUVCoord[src  ];\r\n\t\t_internalImg.m_pUVCoord[n+1]\t= pImage->m_pUVCoord[src+1];\r\n\r\n\t\t// Index\r\n\t\tm_pIndex [n>>1] = (u16)(n>>1);\r\n\t}\r\n\r\n\t_internalImg.m_pTextureAsset\t= pImage->getTexture();\r\n\tthis->m_pTexture\t\t\t\t= pImage->getTexture()->m_pTextureUsage;\r\n\r\n\t// May have change in vertex count.\r\n\tm_uiStatus |= FLAG_BUFFERSHIFT;\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid CKLBDynSprite::setTexture\t(CKLBImageAsset* pImage) {\r\n\tif (pImage) {\r\n\t\t_internalImg.m_pTextureAsset\t= pImage->getTexture();\r\n\t\tthis->m_pTexture\t\t\t\t= pImage->getTexture()->m_pTextureUsage;\r\n\t} else {\r\n\t\t_internalImg.m_pTextureAsset\t= NULL;\r\n\t\tthis->m_pTexture\t\t\t\t= NULL;\r\n\t}\r\n\t\r\n\t// May have change in vertex count.\r\n\tm_uiStatus |= FLAG_BUFFERSHIFT;\r\n}\r\n\r\nvoid CKLBDynSprite::setTexture\t(CTextureUsage* pUsage) {\r\n\t\t_internalImg.m_pTextureAsset\t= NULL;\r\n\t\tthis->m_pTexture\t\t\t\t= pUsage;\r\n}\r\n\r\nvoid CKLBDynSprite::setVICount\t(u32 vertexCount, u32 indexCount) {\r\n\tthis->m_uiVertexCount = vertexCount;\r\n\tthis->m_uiIndexCount  = indexCount;\r\n\r\n\t// May have change in vertex count.\r\n\tm_uiStatus |= FLAG_BUFFERSHIFT;\r\n}\r\n\r\n// ------------------------------------------\r\n//   Slice 9 Sprite.\r\n// ------------------------------------------\r\n\r\nCKLBSpriteScale9::CKLBSpriteScale9()\r\n:CKLBDynSprite\t\t()\r\n,m_width\t\t\t(0)\r\n,m_height\t\t\t(0)\r\n,m_pOriginalImage\t(NULL)\r\n{\r\n}\r\n\r\nCKLBSpriteScale9::~CKLBSpriteScale9() {\r\n}\r\n\r\n#define CHANGE_X\t(1)\r\n#define CHANGE_Y\t(2)\r\n\r\nvoid CKLBSpriteScale9::setWidth(s32 width) {\r\n\tif (width != m_width) {\r\n\t\tklb_assert((width >= 0) && (width < 32768), \"Invalid Width (0..32767)\"); \r\n\t\tm_width\t\t= (s16)width;\r\n\t\trecomputeVertex(CHANGE_X);\r\n\t}\r\n}\r\n\r\nvoid CKLBSpriteScale9::setHeight(s32 height) {\r\n\tif (height != m_height) {\r\n\t\tklb_assert((height >= 0) && (height < 32768), \"Invalid Height (0..32767)\"); \r\n\t\tm_height\t= (s16)height;\r\n\t\trecomputeVertex(CHANGE_Y);\r\n\t}\r\n}\r\n\r\nvoid CKLBSpriteScale9::useImage(CKLBImageAsset* pImage) {\r\n\tif (pImage->hasStandardAttribute(CKLBImageAsset::IS_SCALE9)) {\r\n\t\tu32 oldOrder = this->m_uiOrder - m_renderOffset; // Original order\r\n\r\n\t\t// Copy XY\r\n\t\tmemcpy(_internalImg.m_pXYCoord, pImage->m_pXYCoord, 16*2*sizeof(float));\r\n\t\t// Copy UV\r\n\t\tmemcpy(_internalImg.m_pUVCoord, pImage->m_pUVCoord, 16*2*sizeof(float));\r\n\t\t// Copy Index the first time.\r\n\t\tif (m_pOriginalImage == NULL) {\r\n\t\t\tmemcpy(_internalImg.m_pIndex, pImage->m_pIndex, 54*sizeof(u16));\r\n\t\t}\r\n\r\n\t\t_internalImg.m_pTextureAsset\t= pImage->getTexture();\r\n\t\tthis->m_pTexture\t\t\t\t= pImage->getTexture()->m_pTextureUsage;\r\n\t\tthis->m_pOriginalImage\t\t\t= pImage;\r\n\t\tthis->m_renderOffset\t\t\t= pImage->m_renderOffset * gUseOffsetSystem;\r\n\t\t\r\n\t\ts32 left,middleX,right;\r\n\t\ts32 top,middleY,bottom;\r\n\r\n\t\tpImage->getAttribute(ASSET_ATTRIB::zK2_S9_LEFT,\t\tleft);\r\n\t\tm_left\t = (s16)left;\r\n\t\tpImage->getAttribute(ASSET_ATTRIB::zK2_S9_MIDDLEX,\tmiddleX);\r\n\t\tm_middleX= (s16)middleX;\r\n\t\tpImage->getAttribute(ASSET_ATTRIB::zK2_S9_RIGHT,\tright);\r\n\t\tm_right\t = (s16)right;\r\n\t\tm_fRight = (float)right;\r\n\r\n\t\tpImage->getAttribute(ASSET_ATTRIB::zK2_S9_TOP,\t\ttop);\r\n\t\tm_top\t = (s16)top;\r\n\t\tpImage->getAttribute(ASSET_ATTRIB::zK2_S9_MIDDLEY,\tmiddleY);\r\n\t\tm_middleY= (s16)middleY;\r\n\t\tpImage->getAttribute(ASSET_ATTRIB::zK2_S9_BOTTOM,\tbottom);\r\n\t\tm_bottom = (s16)bottom;\r\n\t\tm_fBottom = (float)bottom;\r\n\r\n\t\t// Adapt to new size.\r\n\t\trecomputeVertex(CHANGE_X | CHANGE_Y);\r\n\r\n\t\tchangeOrder(CKLBRenderingManager::getInstance(), oldOrder);\r\n\t} else {\r\n\t\tklb_assertAlways(\"Image not usable in SCALE9\");\r\n\t}\r\n}\r\n\r\nvoid CKLBSpriteScale9::recomputeVertex(u32 mode) {\r\n\tif (!m_pOriginalImage) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t//\t0-1---2-3\r\n\t//  | |   | |\r\n\t//  4-5---6-7\r\n\t//  | |   | |\r\n\t//  | |   | |\r\n\t//  | |   | |\r\n\t//\t8-9---A-B\r\n\t//  | |   | |\r\n\t//  C-D---E-F\r\n\t//  this->m_pOriginalImage : all info.\r\n\t//  -> Recompute sizes.\r\n\r\n\t// When width change :\r\n\tfloat space;\r\n\r\n\tif (mode & CHANGE_X) {\r\n\t\t// Computation compatible with centerX, centerY coordinate system.\r\n\t\t// Compute new width with low clipping\r\n\t\t// Compute new X\r\n\t\t// 26AE = 1 + NewMiddle\r\n\t\tspace = (float)(m_width - (m_left + m_right));\r\n\t\tif (space < 0.0f) { space = 0.0f; }\r\n\r\n\t\tfloat* pVertex = &_internalImg.m_pXYCoord[4];\r\n\t\tfor (int n=0; n<4; n++) {\r\n\t\t\tpVertex[0] = pVertex[-2] + space;\r\n\t\t\tpVertex += 8;\t// Skip 4 vertex XY\r\n\t\t}\r\n\r\n\t\t// 37BF = 2 + Right\r\n\t\tpVertex = &_internalImg.m_pXYCoord[6];\r\n\t\tfor (int n=0; n<4; n++) {\r\n\t\t\tpVertex[0] = pVertex[-2] + m_fRight;\r\n\t\t\tpVertex += 8;\t// Skip 4 vertex XY\r\n\t\t}\r\n\t}\r\n\r\n\t// When height change :\r\n\tif (mode & CHANGE_Y) {\r\n\t\t// 89AB = 4 + New Middle\r\n\t\t// CDEF = 8 + Bottom\r\n\t\tspace = (float)(m_height - (m_top + m_bottom));\r\n\t\tif (space < 0.0f) { space = 0.0f; }\r\n\r\n\t\tfloat* pVertex = &_internalImg.m_pXYCoord[(8*2)+1];\t// Y Coord\r\n\t\tfor (int n=0; n<4; n++) {\r\n\t\t\tpVertex[0] = pVertex[-8] + space;\r\n\t\t\tpVertex += 2;\t// Next vertex XY\r\n\t\t}\r\n\r\n\t\tpVertex = &_internalImg.m_pXYCoord[(12*2)+1]; // Y Coord\r\n\t\tfor (int n=0; n<4; n++) {\r\n\t\t\tpVertex[0] = pVertex[-8] + m_fBottom;\r\n\t\t\tpVertex += 2;\t// Next vertex XY\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// ------------------------------------------\r\n//   Render State / Command\r\n// ------------------------------------------\r\n\r\nCKLBRenderState::CKLBRenderState()\r\n:jump\t\t\t\t(NULL)\r\n,end\t\t\t\t(NULL)\r\n,pShaderInstance\t(NULL)\r\n,m_depthStart\t\t(0.0f)\r\n,m_depthEnd\t\t\t(1.0f)\r\n{\r\n\tm_commandType\t\t= RENDERCOMMAND_CHANGERENDERSTATE;\r\n}\r\n\r\nCKLBRenderState::~CKLBRenderState()\t{\r\n}\r\n\r\nvoid CKLBRenderState::executeCommand() {\r\n\tGLbitfield mask = 0;\r\n\r\n\tif (m_commandType & RENDERCOMMAND_CLEARCOLOR)\t{\t\r\n\t\tdglClearColor (m_colorClearRed, m_colorClearGreen, m_colorClearBlue, m_colorClearAlpha);\r\n\t\tmask |= GL_COLOR_BUFFER_BIT;\t\r\n\t}\r\n\tif (m_commandType & RENDERCOMMAND_CLEARDEPTH)\t{\r\n#ifdef STD_OPENGL\r\n\t\tglClearDepth (m_depthClear);\r\n#else\r\n\t\tdglClearDepthf (m_depthClear);\r\n#endif\r\n\t\tdglDepthMask(GL_TRUE);\r\n\t\tmask |= GL_DEPTH_BUFFER_BIT;\r\n\t}\r\n\tif (m_commandType & RENDERCOMMAND_CLEARSTENCIL) {\r\n\t\tdglClearStencil (m_stencilClear);\r\n\t\tmask |= GL_STENCIL_BUFFER_BIT;\r\n\t}\r\n\r\n\tif (mask) {\r\n\t\tdglClear (mask);\r\n\t}\r\n\r\n\tif (m_commandType & RENDERCOMMAND_DEPTHRANGE) {\r\n#ifdef STD_OPENGL\r\n\t\tglDepthRange(m_depthStart, m_depthEnd);\r\n#else\r\n\t\tdglDepthRangef(m_depthStart, m_depthEnd);\r\n#endif\r\n\t}\r\n}\r\n\r\nvoid CKLBRenderState::setDepthRange(float _near, float _far) {\r\n\tm_commandType |= RENDERCOMMAND_DEPTHRANGE;\r\n\tm_depthStart = _near;\r\n\tm_depthEnd\t = _far;\r\n}\r\n\r\nvoid CKLBRenderState::setClearColor(bool active, float r, float g, float b, float alpha) {\r\n\tif (active) {\r\n\t\tm_commandType |= RENDERCOMMAND_CLEARCOLOR;\r\n\t} else {\r\n\t\tm_commandType &= ~RENDERCOMMAND_CLEARCOLOR;\r\n\t}\r\n\r\n\tm_colorClearRed\t\t= r;\r\n\tm_colorClearGreen\t= g;\r\n\tm_colorClearBlue\t= b;\r\n\tm_colorClearAlpha\t= alpha;\r\n}\r\n\r\nvoid CKLBRenderState::setClearDepth(bool active, float depth) {\r\n\tif (active) {\r\n\t\tm_commandType |= RENDERCOMMAND_CLEARDEPTH;\r\n\t} else {\r\n\t\tm_commandType &= ~RENDERCOMMAND_CLEARDEPTH;\r\n\t}\r\n\r\n\tm_depthClear\t\t= depth;\r\n}\r\n\r\nvoid CKLBRenderState::setClearStencil(bool active, u32 value) {\r\n\tif (active) {\r\n\t\tm_commandType |= RENDERCOMMAND_CLEARSTENCIL;\r\n\t} else {\r\n\t\tm_commandType &= ~RENDERCOMMAND_CLEARSTENCIL;\r\n\t}\r\n\r\n\tm_stencilClear = value;\r\n}\r\n\r\nvoid CKLBRenderState::setScissor(bool active, s32 x, s32 y, s32 w, s32 h) {\r\n\r\n\tinternalState.changed\t\t = true;\r\n\tif (active) {\r\n\t\tinternalState.bEnableScissor = TRUE_BOOL_U8;\r\n\t\tm_scissor[0] = x;\r\n\t\tm_scissor[1] = y;\r\n\t\tm_scissor[2] = x + w;\r\n\t\tm_scissor[3] = y + h;\r\n\t} else {\r\n\t\tinternalState.bEnableScissor = FALSE_BOOL_U8;\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBRenderState::applyNode(CKLBNode* pNode) {\r\n\tif (internalState.bEnableScissor == TRUE_BOOL_U8) {\r\n\t\tconst SMatrix2D* pMat = &pNode->m_composedMatrix;\r\n\r\n\t\t// Apply node transformation to Scissor.\r\n\t\tfloat tx = pMat->m_matrix[MAT_TX];\r\n\t\tfloat ty = pMat->m_matrix[MAT_TY];\r\n\t\tfloat sx = pMat->m_matrix[MAT_A];\r\n\t\tfloat sy = pMat->m_matrix[MAT_D];\r\n\r\n\t\tfloat* scissorSrc\t= &m_scissor[0];\r\n\t\tfloat* scissorPost\t= &m_scissorPost[0]; \r\n\r\n\t\tfor (int n=0; n < 2; n++) {\r\n\t\t\t*scissorPost++ = ((*scissorSrc++) * sx) + tx;\r\n\t\t\t*scissorPost++ = ((*scissorSrc++) * sy) + ty;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Logical Screen Space --> Physical\r\n\t\t//\r\n\t\tCKLBDrawResource& pDRsc = CKLBDrawResource::getInstance();\r\n\t\tint x0, y0, x1, y1, xo0, yo0,xo1, yo1;\r\n\t\tx0 = m_scissorPost[0];\r\n\t\ty0 = m_scissorPost[1];\r\n\t\tx1 = m_scissorPost[2];\r\n\t\ty1 = m_scissorPost[3];\r\n\t\tpDRsc.toPhisicalPosition(x0, y0, xo0, yo0);\r\n\t\tpDRsc.toPhisicalPosition(x1, y1, xo1, yo1);\r\n\r\n\t\t// phisical size. logical size keep.\r\n\t\tfloat localScissor[4]; \r\n\t\tlocalScissor[0] = xo0;\r\n\t\tlocalScissor[1] = yo0;\r\n\t\tlocalScissor[2] = xo1;\r\n\t\tlocalScissor[3] = yo1;\r\n\t\r\n\r\n\t\t//\r\n\t\t// convert x,y,x,y into x,y,w,h\r\n\t\t//\r\n\t\tm_scissorPost[2] -= m_scissorPost[0];\r\n\t\tm_scissorPost[3] -= m_scissorPost[1];\r\n\r\n\t\tlocalScissor[2] -= localScissor[0];\t// roll back to width\r\n\t\tlocalScissor[3] -= localScissor[1];\t// roll back to height\r\n\r\n//\t\tlocalScissor[0] -= pDRsc.ox();\r\n\t\tlocalScissor[1] -= pDRsc.oy()*2;\r\n\r\n\t\t//\r\n\t\t// Float to int for GL (expensive float->int conv)\r\n\t\t//\r\n\t\t// Trick : GL Coordinate system is opposite on Bottom-Left, our system is Top-Left\r\n\t\ts32 h = (s32)localScissor[3];\r\n\t\tif (h < 0) { h = 0; }\r\n\t\ts32 w = (s32)localScissor[2];\r\n\t\tif (w < 0) { w = 0; }\r\n\t\tinternalState.enableScissor\t(\t(s32)localScissor[0],\r\n\t\t\t\t\t\t\t\t\t\t(pDRsc.vp_height() - (s32)localScissor[1]-h ),\r\n\t\t\t\t\t\t\t\t\t\tw,\r\n\t\t\t\t\t\t\t\t\t\th);\r\n\t} else {\r\n\t\tinternalState.disableScissor();\r\n\t}\r\n}\r\n\r\nvoid CKLBRenderState::setUse(bool useRenderState, bool useCommand, CShaderInstance* pShaderInstance) {\r\n\tif (useRenderState) {\r\n\t\tm_commandType |= RENDERCOMMAND_CHANGERENDERSTATE;\r\n\t} else {\r\n\t\tm_commandType &= ~RENDERCOMMAND_CHANGERENDERSTATE;\r\n\t}\r\n\r\n\tif (useCommand) {\r\n\t\tm_commandType |= RENDERCOMMAND_EXECUTECOMMAND;\r\n\t} else {\r\n\t\tm_commandType &= ~RENDERCOMMAND_EXECUTECOMMAND;\r\n\t}\r\n\r\n\tif (pShaderInstance) {\r\n\t\tthis->pShaderInstance = pShaderInstance;\r\n\t\tm_commandType |= RENDERCOMMAND_SETSHADER;\r\n\t} else {\r\n\t\tthis->pShaderInstance = NULL;\r\n\t\tm_commandType &= ~RENDERCOMMAND_SETSHADER;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CKLBSprite3D.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBSprite3D.h\"\r\n#include \"CKLBNode.h\"\r\n\r\nstatic const SVertexEntry cteListVertex3D[3] = {\r\n\t//\tStreamID\tOffset\tVBO?\tType\r\n\t{\t\t1,\t\t0,\t\tfalse,\tVEC4\t | VERTEX},\t// Coordinate.\r\n\t{\t\t2,\t\t0,\t\tfalse,\tVEC2\t | TEXTURE},\t// Texture UV.\r\n\t{ /*NA*/0,/*NA*/0,/*NA*/false,\tEND_LIST}\t// Mark end of list.\r\n};\r\n\r\nvoid CKLBSprite3D::switchImage(CKLBImageAsset* pImage) {\r\n\tif (m_pImageAsset != pImage) {\r\n\t\t// Use switch image.\r\n\t\tCKLBSprite::switchImage(pImage);\r\n\t\t\r\n\t\t// Bind/Rebind index and buffer\r\n\t\tCKLBOGLWrapper& oglW = CKLBOGLWrapper::getInstance();\r\n\r\n\t\tif (!m_pIdxBuff) {\r\n\t\t\t// Create Buffer\r\n\t\t\tm_pIdxBuff = oglW.createIndexBuffer(m_uiIndexCount, false, this->m_pIndex);\r\n\t\t} else {\r\n\t\t\tm_pIdxBuff->overrideBuffer(m_uiIndexCount, this->m_pIndex);\r\n\t\t}\r\n\t\t\r\n\t\tif (!m_pBuff) {\r\n\t\t\t// Create Buffer\r\n\t\t\tm_pBuff = oglW.createVertexBuffer(m_uiVertexCount, cteListVertex3D, this->m_pVertex);\r\n\t\t} else {\r\n\t\t\t//\r\n\t\t\tm_pBuff->overrideBuffer(m_uiVertexCount, this->m_pVertex);\r\n\t\t}\r\n\t\t\r\n\t\t// Bind Buffer\r\n\t\tm_recompute = true;\t// Model as changed.\r\n\t}\r\n}\r\n\r\nvoid CKLBSprite3D::set3DMatrix(float* matrix3d) {\r\n\tm_recompute = true;\r\n\tmemcpy(m_matrixLocal, matrix3d, 16*sizeof(float));\r\n}\r\n\r\nvoid CKLBSprite3D::use2DSceneGraph(bool use) {\r\n\tif (m_bUse2DSceneGraph != use) {\r\n\t\tm_bUse2DSceneGraph = use;\r\n\t\tm_recompute = true;\r\n\t}\r\n}\r\n\r\nvoid CKLBSprite3D::applyNode(CKLBNode* pNode) {\r\n\tif (m_recompute || m_bUse2DSceneGraph) {\r\n\t\tif (m_bUse2DSceneGraph) {\r\n\t\t\t// Compose Local 3d matrix and 2d Matrix into compose 3d Matrix\r\n\t\t\tfloat node[16];\r\n\t\t\tfloat* src = pNode->m_composedMatrix.m_matrix;\r\n\r\n\t\t\t// Embbed 2D Matrix into 3D Matrix.\r\n\t\t\tnode[0] = src[0];\tnode[1] = src[1];\tnode[2] = 0.0f;\tnode[3] = src[4];\r\n\t\t\tnode[4] = src[2];\tnode[5] = src[3];\tnode[6] = 0.0f;\tnode[7] = src[5];\r\n\t\t\tnode[8] = 0.0f;\t\tnode[9] = 0.0f;\t\tnode[10]= 1.0f; node[11]= 0.0f;\r\n\t\t\tnode[12]= 0.0f;\t\tnode[13]= 0.0f;\t\tnode[14]= 0.0f; node[15]= 1.0f;\r\n\r\n\t\t\t// Compute Transformed matrix.\r\n\t\t\tfor(int y = 0; y < 4; y++) {\r\n\t\t\t\tfor(int x = 0; x < 4; x++) {\r\n\t\t\t\t\tm_matrixTransform[y*4+x] = 0.0f;\r\n\t\t\t\t\tfor(int n = 0; n < 4; n++) {\r\n\t\t\t\t\t\tm_matrixTransform[y*4+x] += m_matrixLocal[y*4+n] * node[n*4+x];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmemcpy(m_matrixTransform,m_matrixLocal, sizeof(float) * 16);\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\t// Transform all vertex manually with transform matrix.\r\n\t\t//\r\n\t\tfor (int vert=0; vert < m_uiVertexCount; vert++) {\r\n\t\t\tfloat* v\t= &m_pVertex[vert*4];\t\t\t\t\t// Vec 4 Dest\r\n\t\t\tfloat* src\t= this->m_pImageAsset->getXYBuffer();\t// Vec 3 Source\r\n\r\n\t\t\t// Matrix Transform.\r\n\t\t\tfor(int n = 0; n < 4; n++) {\r\n\t\t\t\tv[n] = 0.0f;\r\n\t\t\t\tfor(int m = 0; m < 3; m++) {\r\n\t\t\t\t\tv[n] += src[m] * m_matrixTransform[(m*4)+n];\r\n\t\t\t\t}\r\n\t\t\t\tv[n] += m_matrixTransform[(3*4)+n];\t// Vec[3] is always 1.\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBSprite3D::draw() {\r\n\t//\r\n\t// Perform Rendering\r\n\t//\r\n\tCKLBOGLWrapper&\tpOGLMgr\t= CKLBOGLWrapper::getInstance();\r\n\r\n\tpOGLMgr.applyState(&s_3Dstate);\r\n\r\n\tm_pIdxBuff->setDrawOffset(0);\r\n\tm_pBuff->setDrawOffset(0);\r\n\r\n\t// For now texture is only one texture.\r\n\tCTextureUsage* pArrTexture[1];\r\n\ts32 idUniform[1];\r\n\tpArrTexture\t\t\t[0]\t\t= this->m_pTexture;\r\n\tidUniform\t\t\t[0]\t\t= 1;\r\n\r\n\tCBuffer* arrBuff[1] = {\r\n\t\tm_pBuff\r\n\t};\r\n\r\n\t// Clear Z Buffer\r\n\tdglClear(GL_DEPTH_BUFFER_BIT);\r\n\r\n\t// Render 3D Object\r\n\tpOGLMgr.draw(\tGL_TRIANGLES,\r\n\t\t\t\t\ts_pShaderInstance,\r\n\t\t\t\t\tarrBuff,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tm_pIdxBuff,\r\n\t\t\t\t\tpArrTexture,\r\n\t\t\t\t\tidUniform, \r\n\t\t\t\t\tm_uiIndexCount);\r\n}\r\n\r\nCShaderSet*\t\t\tCKLBSprite3D::s_pShaderSet\t\t\t= NULL;\r\nCShaderInstance*\tCKLBSprite3D::s_pShaderInstance\t\t= NULL;\r\nCShader*\t\t\tCKLBSprite3D::s_pPShader\t\t\t= NULL;\r\nCShader*\t\t\tCKLBSprite3D::s_pVShader\t\t\t= NULL;\r\nSRenderState\t\tCKLBSprite3D::s_3Dstate;\r\n\r\nCKLBSprite3D::CKLBSprite3D()\r\n:m_pIdxBuff\t\t\t(NULL)\r\n,m_pBuff\t\t\t(NULL)\r\n,m_bUse2DSceneGraph\t(true)\r\n,m_recompute\t\t(true)\r\n{\r\n\tm_commandType = RENDERCOMMAND_3D | RENDERCOMMAND_SPRITE;\r\n\r\n\tif (s_pVShader == NULL) {\r\n\t\tCKLBOGLWrapper&\t\tpOGLMgr\r\n\t\t\t\t\t\t= CKLBOGLWrapper::getInstance();\r\n\t\t// TODO RP : Hardcoded shader, vertex format.\r\n\t\t//   Render state,\r\n\t\t// -------------------------------------- SHADER\r\n\t\tconst static SParam paramsVert[] = {\r\n\t\t\t// Name\t\t\t\tUniform?\tStreamID\tData Type\r\n\t\t\t//\t\t\t\t\t\t\t\tor\r\n\t\t\t//\t\t\t\t\t\t\t\tUniformID\r\n\t\t\t{\t\"pos_attr\"\t\t,false\t\t,1\t\t\t,VEC4\t| VERTEX },\t// Coordinate.\r\n\t\t\t{\t\"uv_attr\"\t\t,false\t\t,2\t\t\t,VEC2\t| TEXTURE},\t// UV.\r\n\t\t\t{\t\"\"\t\t\t\t,false\t\t,0\t\t\t,END_LIST}\t// Mark end of list.\r\n\t\t};\r\n\r\n\t\tconst static SParam paramsShader[] = {\r\n\t\t\t// Name\t\t\t\tUniform?\tStreamID\tData Type\r\n\t\t\t//\t\t\t\t\t\t\t\tor\r\n\t\t\t//\t\t\t\t\t\t\t\tUniformID\r\n\t\t\t{\t\"texture\"\t\t,true\t\t,1\t\t\t,TEX2D    | TEXTURE },\r\n\t//\t\t{\t\"power\"\t\t\t,true\t\t,2\t\t\t,VEC1F\t\t\t\t},\r\n\t//\t\t{\t\"table\"\t\t\t,true\t\t,1\t\t\t,TEX2D    | TEXTURE },\r\n\t\t\t{\t\"\"\t\t\t\t,false\t\t,0\t\t\t,END_LIST}\t\t// Mark end of list.\r\n\t\t};\r\n\r\n\t\t// Create shader vertex & pixel\r\n\t\tSRenderState::RENDER_MODE mode = SRenderState::TEXTURE_MUL_COLOR;\r\n\t\ts_pVShader\t\t= pOGLMgr.createShader(mode, CKLBOGLWrapper::VERTEX_SHADER, paramsVert);\r\n\t\ts_pPShader\t\t= pOGLMgr.createShader(mode, CKLBOGLWrapper::PIXEL_SHADER, paramsShader);\r\n\r\n\t\t// Map the shader together.\r\n\t\ts_pShaderSet\t= pOGLMgr.createShaderSet(s_pVShader, s_pPShader);\r\n\t\t// Create instance of shader for param\r\n\t\ts_pShaderInstance = s_pShaderSet->createInstance();\r\n\t\t// ----------------------------------------------\r\n\r\n\t\t// Render State.\r\n\t\ts_3Dstate.setDepthState(true, true, SRenderState::LESS);\r\n\t\ts_3Dstate.setBlend(SRenderState::ALPHA);\r\n\t}\r\n\r\n\t// Reset\r\n\tfor (int n=0; n < 16; n++) \r\n\t{ m_matrixLocal[n] = 0.0f; }\r\n\r\n\t// Diagonal.\r\n\tm_matrixLocal[0 ] = 1.0f;\r\n\tm_matrixLocal[5 ] = 1.0f;\r\n\tm_matrixLocal[10] = 1.0f;\r\n\tm_matrixLocal[15] = 1.0f;\r\n\r\n}\r\n\r\nCKLBSprite3D::~CKLBSprite3D() {\r\n\tCKLBOGLWrapper& oglW = CKLBOGLWrapper::getInstance();\r\n\tif (m_pIdxBuff) {\r\n\t\toglW.releaseIndexBuffer(m_pIdxBuff);\r\n\t}\r\n\tif (m_pBuff) {\r\n\t\toglW.releaseVertexBuffer(m_pBuff);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CKLBSprite3D.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_SPRITE3D__\r\n#define __CKLB_SPRITE3D__\r\n\r\n#include \"CKLBRendering.h\"\r\n\r\nclass CKLBSprite3D : public CKLBSprite {\r\npublic:\r\n\tvoid switchImage\t\t(CKLBImageAsset* pImage);\r\n\tvoid set3DMatrix\t\t(float* matrix3d);\r\n\tvoid use2DSceneGraph\t(bool use);\r\n\tvoid draw\t\t\t\t();\r\n\r\n\t// Inheritance.\r\n\tvirtual\tvoid applyNode(CKLBNode* pNode);\r\nprotected:\r\n\tCKLBSprite3D ();\r\n\t~CKLBSprite3D();\r\nprivate:\r\n\tfloat\t\t\tm_matrixLocal[16];\r\n\tfloat\t\t\tm_matrixTransform[16];\r\n\tCIndexBuffer*\tm_pIdxBuff;\r\n\tCBuffer*\t\tm_pBuff;\r\n\tbool\t\t\tm_bUse2DSceneGraph;\r\n\tbool\t\t\tm_recompute;\r\n\r\n\tstatic CShader*\t\t\t\ts_pVShader;\r\n\tstatic CShader*\t\t\t\ts_pPShader;\r\n\tstatic CShaderSet*\t\t\ts_pShaderSet;\r\n\tstatic CShaderInstance*\t\ts_pShaderInstance;\r\n\tstatic SRenderState\t\t\ts_3Dstate;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Rendering/CRenderingManager.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n#include \"mem.h\"\r\n\r\nstatic int _x_getVertexSize() {\r\n\treturn 5;\r\n}\r\n\r\nCKLBOGLWrapper::CKLBOGLWrapper():\r\n\tframe\t\t\t\t(0),\r\n\r\n\tm_pTextureList\t\t(NULL),\r\n\tshaderList\t\t\t(NULL),\r\n\tshaderSetList\t\t(NULL),\r\n\tbufferList\t\t\t(NULL),\r\n\tindexBufferList\t\t(NULL),\r\n\timgBufferList\t\t(NULL),\r\n\tframeList\t\t\t(NULL),\r\n\tm_pLastState\t\t(NULL),\r\n\tm_lastShaderInstance(NULL),\r\n\t_glTexImage3DOES\t(NULL),\r\n\t_glTexSubImage3DOES\t(NULL),\r\n\tenableColor\t\t\t(UNDEFINED_BOOL),\r\n\tenableTexture\t\t(UNDEFINED_BOOL),\r\n\tlastElementArrayBuffer\t((GLuint)-1),\r\n\tarrayBufferID\t\t\t((GLuint)-1)\r\n{\r\n\t//char shaderPatchArray[1000];\r\n\r\n\t// Vertex arrays is ALWAYS available\r\n\t// in our system.\r\n#ifndef OPENGL2\r\n\tdglEnableClientState(GL_VERTEX_ARRAY);\r\n#else\r\n\t// ### TODO ### Call Extensions _glTexImage3DOES, _glTexSubImage3DOES\r\n#endif\r\n}\r\n\r\nCKLBOGLWrapper::~CKLBOGLWrapper() {\r\n\t_release();\r\n}\r\n\r\nvoid CKLBOGLWrapper::_release() {\r\n\t//\r\n\t// Release all textures / usages / sub textures.\r\n\t//\r\n\twhile (m_pTextureList) {\r\n\t\tklb_assertAlways(\"Texture not freed yet\");\r\n\t\treleaseTexture(m_pTextureList);\r\n\t}\r\n\t\r\n\twhile (shaderSetList) {\r\n\t\tklb_assertAlways(\"Shader set not freed yet\");\r\n\t\treleaseShaderSet(shaderSetList);\r\n\t}\r\n\r\n\twhile (shaderList) {\r\n\t\tklb_assertAlways(\"Shader not freed yet\");\r\n\t\treleaseShader(shaderList);\r\n\t}\r\n\r\n\tif (bufferList) {\r\n\t}\r\n\r\n\tif (indexBufferList) {\r\n\t}\r\n\r\n\tif (imgBufferList) {\r\n\t}\r\n\r\n\tif (frameList) {\r\n\r\n\t}\r\n}\r\n\r\n//\r\n// Rendering Manager.\r\n//\r\nbool CKLBOGLWrapper::init(float displayMatrix[16]) {\r\n\tmemcpy32(displayMatrix2D, displayMatrix, 16*sizeof(float));\r\n\r\n\t// Current GL state must be uninitialized.\r\n\r\n#ifndef OPENGL2\r\n\tdglMatrixMode(GL_MODELVIEW);\r\n\tdglLoadMatrixf(displayMatrix2D);\r\n#endif\r\n\r\n\treturn true;\r\n}\r\n\r\n// s32\t\tCKLBOGLWrapper::getFrame()\t{ return frame; }\r\n\r\n///\r\n//  Macros\r\n//\r\n#define INVERTED_BIT            (1 << 5)\r\n\r\n///\r\n//  Types\r\n//\r\n#pragma pack(push,x1)                            // Byte alignment (8-bit)\r\n#pragma pack(1)\r\n\r\ntypedef struct\r\n{\r\n   unsigned char  IdSize,\r\n                  MapType,\r\n                  ImageType;\r\n   unsigned short PaletteStart,\r\n                  PaletteSize;\r\n   unsigned char  PaletteEntryDepth;\r\n   unsigned short X,\r\n                  Y,\r\n                  Width,\r\n                  Height;\r\n   unsigned char  ColorDepth,\r\n                  Descriptor;\r\n         \r\n} TGA_HEADER;\r\n\r\ntypedef struct {\r\n\tunsigned char rgbtRed, rgbtGreen, rgbtBlue;\r\n} K_RGBTRIPLE;\r\n\r\ntypedef struct {\r\n\tunsigned char rgbtBlue, rgbtGreen, rgbtRed, rgbtAlpha;\r\n} K_RGBQUAD;\r\n\r\n#pragma pack(pop,x1)\r\n\r\n////////////////////////////////////////////////////////////////////////////////////\r\n//\r\n//  Private Functions\r\n//\r\n\r\n////////////////////////////////////////////////////////////////////////////////////\r\n//\r\n//  Public Functions\r\n//\r\n//\r\n\r\n\r\n///\r\n//  WinTGALoad()\r\n//\r\n#include \"stdio.h\"\r\n#include \"string.h\"\r\n#include \"stdlib.h\"\r\n\r\ns32 TGALoad( const char *fileName, char **buffer, s32 *width, s32 *height, bool load, bool swapXY)\r\n{\r\n\tFILE        *fp;\r\n\tTGA_HEADER   Header;\r\n\r\n\tif ( ( fp = fopen ( fileName, \"rb\" ) ) == 0 )\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tif ( fp == NULL )\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tfread ( &Header, sizeof(TGA_HEADER), 1, fp );\r\n\r\n\t*width = Header.Width;\r\n\t*height = Header.Height;\r\n   \r\n\tif (load) {\r\n\t\tif ( Header.ColorDepth == 24 )\r\n\t\t{\r\n\t\t\tK_RGBTRIPLE *Buffer24;\r\n\r\n\t\t\tBuffer24= (K_RGBTRIPLE*)KLBMALLOC(sizeof(K_RGBTRIPLE) * (*width) * (*height));\r\n\r\n\t\t\tif(Buffer24)\r\n\t\t\t{\r\n\t\t\t\ts32 i=0;\r\n\t\t\t\ts32 x,\r\n\t\t\t\ty;\r\n\r\n\t\t\t\tfread(Buffer24, sizeof(K_RGBTRIPLE), (*width) * (*height), fp);\r\n\r\n\t\t\t\t*buffer= (char*)KLBMALLOC(4 * (*width) * (*height));\r\n\r\n\t\t\t\tif (swapXY) {\r\n\t\t\t\t\tfor ( y = 0; y < *width; y++ )\r\n\t\t\t\t\t\tfor( x = 0; x < *height; x++ )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ts32 Index= x * (*width) + y;\r\n\r\n\t\t\t\t\t\t\tif(!(Header.Descriptor & INVERTED_BIT)) {\r\n\t\t\t\t\t\t\t\tIndex= ((*height) - 1 - x) * (*width) + y;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4)]=      Buffer24[Index].rgbtRed;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 1]=  Buffer24[Index].rgbtGreen;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 2]=  Buffer24[Index].rgbtBlue;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 3]=  (char)255;\r\n        \r\n\t\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfor ( y = 0; y < *height; y++ )\r\n\t\t\t\t\t\tfor( x = 0; x < *width; x++ )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ts32 Index= y * (*width) + x;\r\n\r\n\t\t\t\t\t\t\tif(!(Header.Descriptor & INVERTED_BIT)) {\r\n\t\t\t\t\t\t\t\tIndex= ((*height) - 1 - y) * (*width) + x;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4)]=      Buffer24[Index].rgbtRed;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 1]=  Buffer24[Index].rgbtGreen;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 2]=  Buffer24[Index].rgbtBlue;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 3]=  (char)255;\r\n        \r\n\t\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfclose(fp);\r\n\t\t\t\tKLBFREE(Buffer24);\r\n\t\t\t\treturn 3;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( Header.ColorDepth == 32 )\r\n\t\t{\r\n\t\t\tK_RGBQUAD *Buffer32;\r\n\r\n\t\t\tBuffer32= (K_RGBQUAD*)KLBMALLOC(sizeof(K_RGBQUAD) * (*width) * (*height));\r\n\r\n\t\t\tif(Buffer32)\r\n\t\t\t{\r\n\t\t\t\ts32 i=0;\r\n\t\t\t\ts32 x,\r\n\t\t\t\t\ty;\r\n\r\n\t\t\t\tfread(Buffer32, sizeof(K_RGBQUAD), (*width) * (*height), fp);\r\n\r\n\t\t\t\t*buffer= (char*)KLBMALLOC(4 * (*width) * (*height));\r\n\r\n\t\t\t\tif (swapXY) {\r\n\t\t\t\t\tfor ( y = 0; y < *width; y++ )\r\n\t\t\t\t\t\tfor( x = 0; x < *height; x++ )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ts32 Index= x * (*width) + y;\r\n\r\n\t\t\t\t\t\t\tif(!(Header.Descriptor & INVERTED_BIT)) {\r\n\t\t\t\t\t\t\t\tIndex= ((*height) - 1 - x) * (*width) + y;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4)]=      Buffer32[Index].rgbtRed;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 1]=  Buffer32[Index].rgbtGreen;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 2]=  Buffer32[Index].rgbtBlue;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 3]=  Buffer32[Index].rgbtAlpha;\r\n        \r\n\t\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfor ( y = 0; y < *height; y++ )\r\n\t\t\t\t\t\tfor( x = 0; x < *width; x++ )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ts32 Index= y * (*width) + x;\r\n\r\n\t\t\t\t\t\t\tif(!(Header.Descriptor & INVERTED_BIT)) {\r\n\t\t\t\t\t\t\t\tIndex= ((*height) - 1 - y) * (*width) + x;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4)]=      Buffer32[Index].rgbtRed;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 1]=  Buffer32[Index].rgbtGreen;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 2]=  Buffer32[Index].rgbtBlue;\r\n\t\t\t\t\t\t\t(*buffer)[(i * 4) + 3]=  Buffer32[Index].rgbtAlpha;\r\n        \r\n\t\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tKLBFREE(Buffer32);\r\n\t\t\t}\r\n\t\t\tfclose(fp);\r\n\t\t\treturn 4;\r\n\t\t}\t\t\r\n\t}\r\n\t   \r\n\tfclose(fp);\r\n\treturn 0;\r\n}\r\n\r\nstatic void convertPixels(u8* pBuffer, s32 width, s32 height, u32 channel, GLenum pixFormat) {\r\n\tswitch (channel) {\r\n\tcase 1:\t\t// GL_ALPHA, GL_LUMINANCE\r\n\t\t// Do nothing.\r\n\t\treturn;\r\n\tcase 2:\t\t// GL_LUMINANCE_ALPHA\r\n\t\t// Do nothing.\r\n\t\treturn;\r\n\tcase 3:\t\t// GL_RGB\r\n\tcase 4:\t\t// GL_RGBA\r\n\t\tif (pixFormat == GL_UNSIGNED_BYTE) {\r\n\t\t\t// DO NOTHING.\r\n\t\t\treturn;\r\n\t\t} else if (pixFormat == 0x565) {\r\n\t\t\t// RGBA byte.\r\n\t\t\tfor (s32 y=0; y < height; y++) {\r\n\t\t\t\tu8* pSrc\t= &pBuffer[y * width * channel];\r\n\t\t\t\tu16* pDst\t= (u16*)&pBuffer[y*width*2];\r\n\t\t\t\tfor (s32 x=0; x < width; x++) {\r\n\t\t\t\t\tu16 col = ((pSrc[0] & 0xF8) << 8) | ((pSrc[1] & 0xFC)<<3) | ((pSrc[2] & 0xF8)>>3);\r\n\t\t\t\t\t*pDst++ = col;\r\n\t\t\t\t\t*pSrc  += channel;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (pixFormat == 0x4444) {\r\n\t\t\t// RGBA byte.\r\n\t\t\tif (channel == 3) {\r\n\t\t\t\tchannel = 4;\r\n\t\t\t\tfor (s32 y=0; y < height; y++) {\r\n\t\t\t\t\tu8* pSrc\t= &pBuffer[y * width * channel];\r\n\t\t\t\t\tu16* pDst\t= (u16*)&pBuffer[y*width*2];\r\n\t\t\t\t\tfor (s32 x=0; x < width; x++) {\r\n\t\t\t\t\t\tu16 col = ((pSrc[0] & 0xF0) << 8) | ((pSrc[1] & 0xF0)<<4) | ((pSrc[2] & 0xF0) | 0xF);\r\n\t\t\t\t\t\t*pDst++ = col;\r\n\t\t\t\t\t\t*pSrc  += channel;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor (s32 y=0; y < height; y++) {\r\n\t\t\t\t\tu8* pSrc\t= &pBuffer[y * width * channel];\r\n\t\t\t\t\tu16* pDst\t= (u16*)&pBuffer[y*width*2];\r\n\t\t\t\t\tfor (s32 x=0; x < width; x++) {\r\n\t\t\t\t\t\tu16 col = ((pSrc[0] & 0xF0) << 8) | ((pSrc[1] & 0xF0)<<4) | ((pSrc[2] & 0xF0) | (pSrc[3]>>4));\r\n\t\t\t\t\t\t*pDst++ = col;\r\n\t\t\t\t\t\t*pSrc  += channel;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (pixFormat == 0x5551) {\r\n\t\t\t// RGBA byte.\r\n\t\t\tif (channel == 3) {\r\n\t\t\t\tchannel = 4;\r\n\t\t\t\tfor (s32 y=0; y < height; y++) {\r\n\t\t\t\t\tu8* pSrc\t= &pBuffer[y * width * channel];\r\n\t\t\t\t\tu16* pDst\t= (u16*)&pBuffer[y*width*2];\r\n\t\t\t\t\tfor (s32 x=0; x < width; x++) {\r\n\t\t\t\t\t\tu16 col = ((pSrc[0] & 0xF8) << 8) | ((pSrc[1] & 0xF8)<<3) | (((pSrc[2] & 0xF8)>>2) | 0x1);\r\n\t\t\t\t\t\t*pDst++ = col;\r\n\t\t\t\t\t\t*pSrc  += channel;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor (s32 y=0; y < height; y++) {\r\n\t\t\t\t\tu8* pSrc\t= &pBuffer[y * width * channel];\r\n\t\t\t\t\tu16* pDst\t= (u16*)&pBuffer[y*width*2];\r\n\t\t\t\t\tfor (s32 x=0; x < width; x++) {\r\n\t\t\t\t\t\tu16 col = ((pSrc[0] & 0xF8) << 8) | ((pSrc[1] & 0xF8)<<3) | (((pSrc[2] & 0xF8)>>2) | (pSrc[3]>>7));\r\n\t\t\t\t\t\t*pDst++ = col;\r\n\t\t\t\t\t\t*pSrc  += channel;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nCTexture*\tCKLBOGLWrapper::loadCompress(const char* filename, GLenum pixFormat, u32 w, u32 h, TEX_OPTION option) {\r\n\t// open file and read data.\r\n\tu32 fileLength;\r\n\tu8* pBuffer;\r\n\tCKLBOGLWrapper::TEX_CHANNEL channel = CKLBOGLWrapper::RGBA;\t// Value ignored anyway.\r\n\tFILE* fp;\r\n\tCTexture* pRes = null;\r\n\r\n\tif ((fp = fopen (filename, \"rb\")) == 0)\t{\treturn null;\t}\r\n\tif ( fp == NULL )\t\t\t\t\t\t{\treturn null;\t}\r\n\r\n\tfseek(fp, 0, SEEK_END);\r\n\tfileLength = ftell(fp);\r\n\tfseek(fp, 0, SEEK_SET);\r\n\r\n\tpBuffer = (u8*)KLBMALLOC(fileLength);\r\n\r\n\tif (pBuffer) {\r\n\t\tfread(pBuffer, sizeof(u8), fileLength, fp);\r\n\t\tpRes = createTexture(w,h, pixFormat, channel, pBuffer, fileLength, TEX_OPTION((int)option | TEX_OPT_COMPRESSED_BIT));\r\n\t\tKLBFREE(pBuffer);\r\n\t}\r\n\tfclose(fp);\r\n\treturn pRes;\r\n}\r\n\r\nCTexture*\tCKLBOGLWrapper::loadTGA(const char* filename, GLenum pixFormat, s32* rw, s32* rh, bool load, bool swapXY, CTexture* res, int x, int y, TEX_OPTION option) {\r\n\ts32 w\t= 0;\r\n\ts32 h\t= 0;\r\n\tchar* pBuffer;\r\n\tTEX_CHANNEL channel = (TEX_CHANNEL)TGALoad(filename, &pBuffer, &w, &h, load, swapXY);\r\n\tif (rw) { *rw = w; }\r\n\tif (rh) { *rh = h; }\r\n\tif (channel && load) {\r\n\t\tif (swapXY) {\r\n\t\t\tint tmp;\r\n\t\t\ttmp = w;\r\n\t\t\tw = h;\r\n\t\t\th = tmp;\r\n\t\t}\r\n\r\n\t\tconvertPixels((u8*)pBuffer, w, h, channel, pixFormat);\r\n\r\n\t\tif (res == null) {\r\n\t\t\tres = createTexture(w,h, pixFormat, channel, pBuffer, w*h*channel, option);\r\n\t\t} else {\r\n\t\t\tres->updateTexture(x,y,w,h,pBuffer,w*h*channel);\r\n\t\t}\r\n\t\tKLBFREE(pBuffer);\r\n\t\treturn res;\r\n\t} else {\r\n\t\treturn null;\r\n\t}\r\n}\r\n\r\nint g_CountRl = 0;\r\nvoid\t\tCKLBOGLWrapper::releaseTexture\t(CTexture* texture) {\r\n\tif (texture) {\r\n\t\tprintf(\"Release Texture %p %i\\n\",texture, g_CountRl++);\r\n\t\t// Remove texture usage. (FIRST)\r\n\t\ttexture->releaseUsage();\r\n\r\n\t\t// Remove Sub Textures. (SECOND)\r\n\t\ttexture->releaseSubTextures();\r\n\r\n\t\t//\r\n\t\t// Remove master texture itself from the list.\r\n\t\t//\r\n\t\tif (texture == m_pTextureList) {\r\n\t\t\tm_pTextureList = texture->pNext;\r\n\t\t} else {\r\n\t\t\tCTexture* pPrev = m_pTextureList;\r\n\t\t\twhile (pPrev->pNext != texture) {\r\n\t\t\t\tpPrev = pPrev->pNext;\r\n\t\t\t}\r\n\r\n\t\t\tpPrev->pNext = texture->pNext;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Free on GL side.\r\n\t\t//\r\n\t\tdglDeleteTextures(1, &texture->texture);\r\n\t\ttexture->texture = 0;\r\n\t\tif (texture->textureDoubleBuff != 0) {\r\n\t\t\tdglDeleteTextures(1, &texture->textureDoubleBuff);\r\n\t\t\ttexture->textureDoubleBuff = 0;\r\n\t\t}\r\n\r\n\t\tKLBDELETE(texture);\r\n\t}\r\n}\r\n\r\nCBuffer*\tCKLBOGLWrapper::createVertexBuffer\t\t(s32 vertexCount, const SVertexEntry* listComponent, void* asOutsideBuffer) {\r\n\tCBuffer* pNewBuffer = KLBNEW(CBuffer);\r\n\tif (pNewBuffer) {\r\n\t\ts32 sizeVBOVertex = 0;\r\n\t\ts32 sizeDynVertex = 0;\r\n\t\ts32 cntVBOVertex = 0;\r\n\t\ts32 cntDynVertex = 0;\r\n\t\tconst SVertexEntry* pParse = listComponent;\r\n\t\twhile (pParse->type != END_LIST) {\r\n\t\t\ts32 size;\r\n\r\n\t\t\tswitch (pParse->type & 0x0F) {\r\n\t\t\tcase VEC1F:\r\n\t\t\tcase VEC1I:\r\n\t\t\tcase VEC4BYTE:\r\n\t\t\t\tsize = 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC2:\r\n\t\t\t\tsize = 2;\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC3:\r\n\t\t\t\tsize = 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC4:\r\n\t\t\t\tsize = 4;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tsize = 0;\r\n\t\t\t\tklb_assertAlways(\"Invalid vertex type in vertex entry list (CRenderingBuffer::createVertexBuffer)\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tif (pParse->isVBO) {\r\n\t\t\t\tsizeVBOVertex += size;\r\n\t\t\t\tcntVBOVertex++;\r\n\t\t\t} else {\r\n\t\t\t\tsizeDynVertex += size;\r\n\t\t\t\tcntDynVertex++;\r\n\t\t\t}\r\n\t\t\tpParse++;\r\n\t\t}\r\n\t\t\r\n\t\tpNewBuffer->fromOutside = (asOutsideBuffer != NULL);\r\n\t\tklb_assert(!(pNewBuffer->fromOutside == true && pParse->isVBO == true), \"VBO can not be outside buffer\"); \r\n\r\n\t\tSVertexEntry* list = KLBNEWA(SVertexEntry,cntDynVertex + cntVBOVertex);\r\n\t\tif (list) {\r\n\t\t\tif (cntVBOVertex != 0) {\r\n\t\t\t\tdglGenBuffers(1, &pNewBuffer->vboID);\r\n\t\t\t}\r\n\t\t\tif ((pNewBuffer->vboID) || (cntVBOVertex == 0)) {\r\n\t\t\t\tfloat*\tvboLocal;\r\n\t\t\t\tfloat*\tptrBuff;\r\n\t\t\t\tbool err;\r\n\r\n\t\t\t\tif (sizeDynVertex) {\r\n\t\t\t\t\tptrBuff = KLBNEWA(float,vertexCount * sizeDynVertex);\r\n\t\t\t\t\terr\t\t= (ptrBuff == null);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tptrBuff = null;\r\n\t\t\t\t\terr\t\t= false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (cntVBOVertex != 0) {\r\n\t\t\t\t\tvboLocal = KLBNEWA(float,vertexCount * sizeVBOVertex);\r\n\t\t\t\t\t_glBindBuffer(pNewBuffer->vboID);\r\n\t\t\t\t\tdglBufferData(GL_ARRAY_BUFFER, vertexCount * sizeVBOVertex * sizeof(float), null, GL_STATIC_DRAW);\r\n\t\t\t\t\terr |= (vboLocal == null) || (glGetError() != GL_NO_ERROR);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvboLocal = null;\r\n\t\t\t\t\terr |= false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!err) {\r\n\t\t\t\t\tpNewBuffer->dynCount\t\t= cntDynVertex;\r\n\t\t\t\t\tpNewBuffer->vboCount\t\t= cntVBOVertex;\r\n\t\t\t\t\tpNewBuffer->ptrBuffer\t\t= ptrBuff;\r\n\t\t\t\t\tpNewBuffer->vboLocalCopy\t= vboLocal;\r\n\t\t\t\t\tpNewBuffer->strideVBO\t\t= sizeVBOVertex;\r\n\t\t\t\t\tpNewBuffer->strideDyn\t\t= sizeDynVertex;\r\n\t\t\t\t\tpNewBuffer->VBOModified\t\t= (cntVBOVertex != 0);\r\n\t\t\t\t\tpNewBuffer->VBOModifying\t= false;\r\n\t\t\t\t\tpNewBuffer->VBOModifyStart\t= 0;\r\n\t\t\t\t\tpNewBuffer->VBOModifyEnd\t= vertexCount;\r\n\t\t\t\t\tpNewBuffer->offsetDrawDyn\t= 0;\r\n\t\t\t\t\tpNewBuffer->offsetDrawVBO\t= 0;\r\n\r\n\t\t\t\t\tpNewBuffer->structure\t\t= list;\r\n\r\n\t\t\t\t\tpParse = listComponent;\r\n\t\t\t\t\ts32 sizeVBO = 0;\r\n\t\t\t\t\ts32 sizeDyn = 0;\r\n\r\n\t\t\t\t\twhile (pParse->type != END_LIST) {\r\n\t\t\t\t\t\ts32 size;\r\n\r\n\t\t\t\t\t\t// Copy the struct first.\r\n\t\t\t\t\t\t*list = *pParse;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tswitch (pParse->type & 0x0F) {\r\n\t\t\t\t\t\tcase VEC1F:\r\n\t\t\t\t\t\tcase VEC1I:\r\n\t\t\t\t\t\tcase VEC4BYTE:\r\n\t\t\t\t\t\t\tsize = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase VEC2:\r\n\t\t\t\t\t\t\tsize = 2;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase VEC3:\r\n\t\t\t\t\t\t\tsize = 3;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase VEC4:\r\n\t\t\t\t\t\t\tsize = 4;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t// Assert done already.\r\n\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\tsize = 0;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (pParse->isVBO) {\r\n\t\t\t\t\t\t\tlist->offset = sizeVBO;\r\n\t\t\t\t\t\t\tsizeVBO += size;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tlist->offset = sizeDyn;\r\n\t\t\t\t\t\t\tsizeDyn += size;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpParse++;\r\n\t\t\t\t\t\tlist++;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpNewBuffer->pNext = this->bufferList;\r\n\t\t\t\t\tthis->bufferList = pNewBuffer;\r\n\t\t\t\t\treturn pNewBuffer;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (vboLocal) {\r\n\t\t\t\t\tKLBDELETE(vboLocal);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (ptrBuff && (!asOutsideBuffer)) {\r\n\t\t\t\t\tKLBDELETE(ptrBuff);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdglDeleteBuffers(1, &pNewBuffer->vboID);\r\n\t\t\t}\r\n\t\t\tKLBDELETE(list);\r\n\t\t}\r\n\t\tKLBDELETE(pNewBuffer);\r\n\t\tpNewBuffer = null;\r\n\t}\r\n\treturn pNewBuffer;\r\n}\r\n\r\nCIndexBuffer* CKLBOGLWrapper::createIndexBuffer(s32 indexCount, bool asVBO, void* asOutsideBuffer) {\r\n\tCIndexBuffer* pNewBuffer = KLBNEW(CIndexBuffer);\r\n\tif (pNewBuffer) {\r\n\t\tGLushort*\tptrBuff\t\t= KLBNEWA(GLushort,indexCount);\r\n\t\tpNewBuffer->vboID\t\t= 0;\r\n\t\tpNewBuffer->fromOutside = (asOutsideBuffer != NULL);\r\n\t\tklb_assert(!(pNewBuffer->fromOutside == true && asVBO == true), \"VBO can not be outside buffer\"); \r\n\r\n\t\tbool err = (ptrBuff == null);\r\n\t\tif (asVBO) {\r\n\t\t\tdglGenBuffers(1, &pNewBuffer->vboID);\r\n\t\t\t_glBindBuffer(pNewBuffer->vboID);\r\n\t\t\tdglBufferData(GL_ARRAY_BUFFER, indexCount * sizeof(GLushort), null, GL_STATIC_DRAW);\r\n\t\t\terr |= (dglGetError() != GL_NO_ERROR);\r\n\t\t}\r\n\r\n\t\tif (err == false) {\r\n\t\t\tpNewBuffer->ptrBuffer\t\t= (short*)ptrBuff;\r\n\t\t\tpNewBuffer->VBOModified\t\t= asVBO;\r\n\t\t\tpNewBuffer->VBOModifying\t= false;\r\n\t\t\tpNewBuffer->VBOModifyStart\t= 0;\r\n\t\t\tpNewBuffer->VBOModifyEnd\t= indexCount;\r\n\t\t\tpNewBuffer->isVBO\t\t\t= asVBO;\r\n\t\t\tpNewBuffer->pNext\t\t\t= this->indexBufferList;\r\n\t\t\tpNewBuffer->offsetDraw\t\t= 0;\r\n\t\t\tthis->indexBufferList\t\t= pNewBuffer;\r\n\t\t\treturn pNewBuffer;\r\n\t\t}\r\n\r\n\t\tif (ptrBuff != null && (!asOutsideBuffer)) {\r\n\t\t\tKLBDELETE(ptrBuff);\r\n\t\t}\r\n\r\n\t\tif (pNewBuffer->vboID) {\r\n\t\t\tdglDeleteBuffers(1, &pNewBuffer->vboID);\r\n\t\t}\r\n\r\n\t\tKLBDELETE(pNewBuffer);\r\n\t\tpNewBuffer = null;\r\n\t}\r\n\treturn pNewBuffer;\r\n}\r\n\r\nvoid CKLBOGLWrapper::_glBindBuffer(GLuint id) {\r\n\tif (id != arrayBufferID) {\r\n\t\tarrayBufferID = id;\r\n\t\tdglBindBuffer(GL_ARRAY_BUFFER, id);\r\n\t}\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseIndexBuffer(CIndexBuffer* pBuffer) {\r\n\tCIndexBuffer* p = this->indexBufferList;\r\n\tCIndexBuffer* prev = null;\r\n\twhile (p != pBuffer) {\r\n\t\tprev = p;\r\n\t\tp = p->pNext;\r\n\t}\r\n\r\n\tif (prev == null) {\r\n\t\tthis->indexBufferList = p->pNext;\r\n\t} else {\r\n\t\tprev->pNext = p->pNext;\r\n\t}\r\n\r\n\tdglDeleteBuffers(1, &pBuffer->vboID);\r\n\r\n\tif (!p->fromOutside) {\r\n\t\tKLBDELETE(p->ptrBuffer);\r\n\t}\r\n\tKLBDELETE(pBuffer);\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseVertexBuffer(CBuffer* pBuffer) {\r\n\tCBuffer* p = this->bufferList;\r\n\tCBuffer* prev = null;\r\n\twhile (p != pBuffer) {\r\n\t\tprev = p;\r\n\t\tp = p->pNext;\r\n\t}\r\n\r\n\tif (prev == null) {\r\n\t\tthis->bufferList = p->pNext;\r\n\t} else {\r\n\t\tprev->pNext = p->pNext;\r\n\t}\r\n\r\n\tdglDeleteBuffers(1, &pBuffer->vboID);\r\n\r\n\tKLBDELETE(p->structure);\r\n\r\n\tif (p->ptrBuffer && (!p->fromOutside)) {\r\n\t\tKLBDELETE(p->ptrBuffer);\r\n\t}\r\n\r\n\tif (p->vboLocalCopy) {\r\n\t\tKLBDELETE(p->vboLocalCopy);\r\n\t}\r\n\t\r\n\tKLBDELETE(pBuffer);\r\n}\r\n\r\nvoid CKLBOGLWrapper::endFrame() {\r\n\tframe++;\r\n}\r\n\r\nbool CKLBOGLWrapper::support3DTexture() {\r\n\treturn (_glTexImage3DOES != NULL);\r\n}\r\n\r\nCTexture*\tCKLBOGLWrapper::createTexture\t(\ts32 width, \r\n\t\t\t\t\t\t\t\t\t\t\t\ts32 height, \r\n\t\t\t\t\t\t\t\t\t\t\t\tGLenum pixelFormat, \r\n\t\t\t\t\t\t\t\t\t\t\t\tTEX_CHANNEL channelCount,\r\n\t\t\t\t\t\t\t\t\t\t\t\tvoid* data, \r\n\t\t\t\t\t\t\t\t\t\t\t\ts32 dataLength, \r\n\t\t\t\t\t\t\t\t\t\t\t\tTEX_OPTION option, \r\n\t\t\t\t\t\t\t\t\t\t\t\ts32 /*depth*/,\r\n\t\t\t\t\t\t\t\t\t\t\t\tCTexture* reload) {\r\n\tCTexture* pTexture = reload ? reload : KLBNEW(CTexture);\r\n\r\n\tif (pTexture) {\r\n\t\t// Init to nothing.\r\n\t\tpTexture->texture\t\t\t= 0;\r\n\t\tpTexture->textureDoubleBuff = 0;\r\n        \r\n        GLenum err = glGetError();\r\n\t\tdglGenTextures(1, &pTexture->texture);\r\n\t\t\r\n\t\tpTexture->isDoubleBuffered\t= ((option & TEX_OPT_DOUBLEBUFFERED_BIT\t) != 0);\r\n\t\tpTexture->isCompressed\t\t= ((option & TEX_OPT_COMPRESSED_BIT\t\t) != 0);\r\n\t\tpTexture->isMipmapped\t\t= ((option & TEX_OPT_MIPMAP_BIT\t\t\t) != 0);\r\n\t\tpTexture->is3D\t\t\t\t= ((option & TEX_OPT_3D\t\t\t\t\t) != 0) && _glTexImage3DOES;\r\n\r\n\t\tklb_assert((!(((option & TEX_OPT_3D) != 0) && (_glTexImage3DOES==NULL))), \"3D Texture not supported\");\r\n\r\n\t\tif (pTexture->isDoubleBuffered) {\r\n\t\t\tdglGenTextures(1, &pTexture->textureDoubleBuff);\r\n\t\t}\r\n        err = dglGetError();\r\n\t\tif (err == GL_NO_ERROR) {\r\n\t\t\tpTexture->x = 0;\r\n\t\t\tpTexture->y = 0;\r\n\r\n\t\t\tpTexture->width\t\t\t\t= width;\r\n\t\t\tpTexture->height\t\t\t= height;\r\n\t\t\tpTexture->UPerPixel\t\t\t= (float)(1.0 / width);\r\n\t\t\tpTexture->VPerPixel\t\t\t= (float)(1.0 / height);\r\n\t\t\tpTexture->usageCount\t\t= 0;\r\n\t\t\tpTexture->pMaster\t\t\t= pTexture;\r\n\t\t\tpTexture->pParent\t\t\t= null;\r\n\t\t\tpTexture->pChild\t\t\t= null;\r\n\t\t\tpTexture->pBrother\t\t\t= null;\r\n\t\t\tpTexture->pMgr\t\t\t\t= this;\r\n\r\n\t\t\tpTexture->activeTexture \t= pTexture->texture;\r\n\r\n\t\t\tpTexture->usageList.init(pTexture);\r\n\t\t\tpTexture->usageList.pMgr\t= this;\r\n\r\n\t\t\tpTexture->format\t\t\t= pixelFormat;\r\n\r\n\t\t\t//\r\n\t\t\t//\r\n\t\t\t//\r\n\t\t\tGLenum textureTarget = \r\n#ifdef OPENGL2\r\n                GL_TEXTURE_2D\r\n\t\t\t\t// pTexture->is3D ? GL_TEXTURE_3D_OES : GL_TEXTURE_2D\r\n#else\r\n\t\t\t\tGL_TEXTURE_2D\r\n#endif\r\n\t\t\t\t;\r\n\r\n\t\t\tfor (s32 n=0; n<2; n++) {\r\n\t\t\t\tif ( n == 0) {\r\n\t\t\t\t\tdglBindTexture(textureTarget, pTexture->texture);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (!pTexture->isDoubleBuffered) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdglBindTexture(textureTarget, pTexture->textureDoubleBuff);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pTexture->isCompressed) {\r\n\t\t\t\t\tklb_assert((!pTexture->is3D), \"Do not support compressed 3D textures\");\r\n\t\t\t\t\tdglCompressedTexImage2D(GL_TEXTURE_2D, \r\n\t\t\t\t\t\t\t0,\t// TODO MIPMAP Level\r\n\t\t\t\t\t\t\tpixelFormat,\r\n\t\t\t\t\t\t\twidth,\r\n\t\t\t\t\t\t\theight,\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\tdataLength,\r\n\t\t\t\t\t\t\tdata\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tGLint internalFormat;\r\n\t\t\t\t\tswitch (channelCount) {\r\n\t\t\t\t\t\tcase ALPHA\t\t:\tinternalFormat = GL_ALPHA;\t\t\tbreak;\r\n\t\t\t\t\t\tcase RGB\t\t:\tinternalFormat = GL_RGB;\t\t\tbreak;\r\n\t\t\t\t\t\tcase LUMINANCE\t:\tinternalFormat = GL_LUMINANCE;\t\tbreak;\r\n\t\t\t\t\t\tcase LUMINANCE_ALPHA\r\n\t\t\t\t\t\t\t\t\t\t:\tinternalFormat = GL_LUMINANCE_ALPHA;\tbreak;\r\n\r\n\t\t\t\t\t\tdefault\t\t\t:\r\n\t\t\t\t\t\tcase RGBA\t\t:\tinternalFormat = GL_RGBA;\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpTexture->channels\t\t\t= internalFormat;\r\n\r\n\t\t\t\t\tif (pTexture->is3D) {\r\n\t\t\t\t\t\t// ### TODO TEXTURE UPDATE FUNCTION ###\r\n\t\t\t\t\t\t//PFNGLTEXSUBIMAGE3DOESPROC\t_glTexSubImage3DOES;\r\n#ifdef OPENGL2\r\n                        /*\r\n\t\t\t\t\t\t((PFNGLTEXIMAGE3DOESPROC)_glTexImage3DOES)(GL_TEXTURE_3D_OES, 0, internalFormat, width, height, depth, 0, pixelFormat, internalFormat, data);\r\n                        */\r\n#else\r\n\t\t\t\t\t\tklb_assertAlways(\"OpenGL 1.1 does not use 3D Textures.\");\r\n#endif\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdglTexImage2D(GL_TEXTURE_2D,\r\n\t\t\t\t\t\t\t0,\t// TODO MIPMAP Level\r\n\t\t\t\t\t\t\tinternalFormat,\r\n\t\t\t\t\t\t\twidth,\r\n\t\t\t\t\t\t\theight,\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\tinternalFormat,\r\n\t\t\t\t\t\t\tpixelFormat,\r\n\t\t\t\t\t\t\tdata\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tklb_assert(dglGetError()==GL_NO_ERROR,\"Error creating OpenGL Texture.\\n\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pTexture->isMipmapped) {\r\n#ifdef OPENGL2\r\n\t\t\t\t\tdglGenerateMipmap (GL_TEXTURE_2D);\r\n#else\r\n\t\t\t\t\tklb_assertAlways(\"Implement mipmap for OpenGL 1.x\");\r\n#endif\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (dglGetError() != GL_NO_ERROR) {\r\n\t\t\t\t\tgoto error1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Finally everything is ok : add to the texture list.\r\n\t\t\t//\r\n\t\t\tif (!reload) {\r\n\t\t\t\tpTexture->pNext = m_pTextureList;\r\n\t\t\t\tm_pTextureList = pTexture;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tgoto error1;\r\n\t\t}\r\n\t}\r\n\treturn pTexture;\r\nerror1:\r\n\tif (pTexture->texture != 0) {\tdglDeleteTextures(1, &pTexture->texture);\t}\r\n\r\n\tif (pTexture->textureDoubleBuff != 0) {\r\n\t\t\t\t\t\t\t\t\tdglDeleteTextures(1, &pTexture->textureDoubleBuff); }\r\n\r\n\tKLBDELETE(pTexture);\r\n\tpTexture = null;\r\n\treturn pTexture;\r\n}\r\n\r\nbool CKLBOGLWrapper::supportFrame() {\r\n\tklb_assertAlways(\"TODO\");\r\n\treturn false;\r\n}\r\n\r\nvoid CKLBOGLWrapper::setRenderFrame(CFrame* pFrame) {\r\n\tklb_assert(supportFrame(), \"System does not support offscreen buffers\");\r\n#ifndef OPENGL2\r\n    pFrame = pFrame;\r\n\tklb_assertAlways(\"TODO\");\r\n#else\r\n\t// Done\r\n\tif (pFrame) {\r\n\t\tdglBindFramebuffer(GL_FRAMEBUFFER, pFrame->frameBuffID);\r\n\t} else {\r\n\t\t// Screen direct.\r\n\t\tdglBindFramebuffer(GL_FRAMEBUFFER, 0);\r\n\t}\r\n#endif\r\n}\r\n\r\nCImageBuffer* CKLBOGLWrapper::createImageBuffer(s32 /*width*/, s32 /*height*/, GLenum /*internalformat*/) {\r\n\tCImageBuffer* pBuffer;\r\n\tklb_assert(supportFrame(), \"System does not support offscreen buffers\");\r\n#ifndef OPENGL2\r\n\tklb_assertAlways(\"TODO\");\r\n\tpBuffer = NULL;\r\n#else\r\n\t// Done\r\n\tpBuffer = KLBNEW(CImageBuffer);\r\n\tif (pBuffer) {\r\n\t\tGLuint buf;\r\n\t\tdglGenRenderbuffers(1, &buf);\r\n\t\tif (buf) {\r\n\t\t\tpBuffer->buffer\t= buf;\r\n\t\t\tpBuffer->next\t= imgBufferList;\r\n\t\t\timgBufferList\t= pBuffer;\r\n\t\t}\r\n\t\tKLBDELETE(pBuffer);\r\n\t}\r\n#endif\r\n\treturn pBuffer;\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseImageBuffer(CImageBuffer* imageBuffer) {\r\n\tCImageBuffer* p = this->imgBufferList;\r\n\tCImageBuffer* prev = null;\r\n\twhile (p != imageBuffer) {\r\n\t\tprev = p;\r\n\t\tp = p->next;\r\n\t}\r\n\r\n\tif (prev == null) {\r\n\t\tthis->imgBufferList = p->next;\r\n\t} else {\r\n\t\tprev->next = p->next;\r\n\t}\r\n\r\n#ifndef OPENGL2\r\n\tklb_assertAlways(\"TODO\");\r\n#else\r\n\t// Done\r\n\tdglDeleteRenderbuffers(1, &imageBuffer->buffer);\r\n#endif\r\n}\r\n\r\nCFrame* CKLBOGLWrapper::createFrame() {\r\n\tCFrame* pFrame;\r\n\tklb_assert(supportFrame(), \"System does not support offscreen buffers\");\r\n#ifndef OPENGL2\r\n\tklb_assertAlways(\"TODO\");\r\n\tpFrame = NULL;\r\n#else\r\n\t// Done\r\n\tpFrame = KLBNEW(CFrame);\r\n\tif (pFrame) {\r\n\t\tGLuint buf;\r\n\t\tdglGenFramebuffers(1, &buf);\r\n\t\tif (buf) {\r\n\t\t\tpFrame->frameBuffID\t= buf;\r\n\t\t\tpFrame->next\t= frameList;\r\n\t\t\tframeList\t\t= pFrame;\r\n\t\t}\r\n\t\tKLBDELETE(pFrame);\r\n\t}\r\n#endif\r\n\treturn pFrame;\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseFrame(CFrame* pFrame) {\r\n\tCFrame* p = this->frameList;\r\n\tCFrame* prev = null;\r\n\twhile (p != pFrame) {\r\n\t\tprev = p;\r\n\t\tp = p->next;\r\n\t}\r\n\r\n\tif (prev == null) {\r\n\t\tthis->frameList = p->next;\r\n\t} else {\r\n\t\tprev->next = p->next;\r\n\t}\r\n\r\n#ifndef OPENGL2\r\n\tklb_assertAlways(\"TODO\");\r\n#else\r\n\t// Done\r\n\tdglDeleteFramebuffers(1, &pFrame->frameBuffID);\r\n#endif\r\n\r\n\tif (pFrame) {\r\n\t\tKLBDELETE(pFrame);\r\n\t}\r\n}\r\n\r\nbool CKLBOGLWrapper::copyScreenRGB888(u32 srcx, u32 srcy, u32 width,u32 height,u8* buffer) {\r\n\tdglReadPixels(srcx,srcy,width,height, GL_RGB, GL_UNSIGNED_BYTE, buffer);\r\n\tif (dglGetError()) {\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\n\r\nSRenderState::SRenderState()\r\n:blendEnable\t\t\t(UNDEFINED_BOOL)\r\n,blendSrcFactor\t\t\t(0)\r\n,blendDstFactor\t\t\t(0)\r\n,blendOp\t\t\t\t(0xFF)\r\n\r\n,alphaTestEnable\t\t(UNDEFINED_BOOL)\r\n\r\n,depthWriteEnable\t\t(UNDEFINED_BOOL)\r\n,depthTestEnable\t\t(UNDEFINED_BOOL)\r\n,depthFunction\t\t\t(0xFF)\r\n\r\n,stRefOpCW\t\t\t\t(ALWAYS)\r\n,stRefOpCCW\t\t\t\t(ALWAYS)\r\n,stRefValueCW\t\t\t(0)\r\n,stRefValueCCW\t\t\t(0)\r\n,stReadMaskCCW\t\t\t(0)\r\n,stReadMaskCW\t\t\t(0)\r\n\r\n,textMode\t\t\t\t(UNDEFINED_BOOL)\r\n\r\n,changed\t\t\t\t(true)\r\n{\r\n\tscX\t\t\t\t\t= 0;\r\n\tscY\t\t\t\t\t= 0;\r\n\tscW\t\t\t\t\t= 0;\r\n\tscH\t\t\t\t\t= 0;\r\n\tbEnableScissor\t\t= false;\r\n\talphaFunction\t\t= 0;\r\n\talphaValue\t\t\t= 0;\r\n\r\n\tstWriteMaskCW\t\t\t\t= 0;\r\n\tstWriteMaskCCW\t\t\t\t= 0;\r\n\tstWriteFailS_StencilOP_CW  = ZERO;\r\n\tstWriteFailZ_StencilOP_CW  = ZERO;\r\n\tstWriteSuccZ_StencilOP_CW  = ZERO;\r\n\tstWriteFailS_StencilOP_CCW = ZERO;\r\n\tstWriteFailZ_StencilOP_CCW = ZERO;\r\n\tstWriteSuccZ_StencilOP_CCW = ZERO;\r\n}\r\n\r\nvoid SRenderState::dump() {\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\tSRenderState* pState = this;\r\n\tif (pState->bEnableScissor == 0) {\r\n\t\tfprintf(pFile,\" Scissor None\");\r\n\t} else if (pState->bEnableScissor == 1) {\r\n\t\tfprintf(pFile,\" Scissor ACTIVE\");\r\n\t} else if (pState->bEnableScissor == 2) {\r\n\t\tfprintf(pFile,\" Ignore Scissor\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" -Invalid Scissor-\");\r\n\t}\r\n\r\n\tif (pState->blendEnable == 0) {\r\n\t\tfprintf(pFile,\" Blend None\");\r\n\t} else if (pState->blendEnable == 1) {\r\n\t\tfprintf(pFile,\" Blend ACTIVE\");\r\n\t} else if (pState->blendEnable == 2) {\r\n\t\tfprintf(pFile,\" Ignore Blend\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" -Invalid Blend-\");\r\n\t}\r\n\r\n\tif (pState->alphaTestEnable == 0) {\r\n\t\tfprintf(pFile,\" Alpha Test None\");\r\n\t} else if (pState->alphaTestEnable == 1) {\r\n\t\tfprintf(pFile,\" Alpha Test ACTIVE\");\r\n\t} else if (pState->alphaTestEnable == 2) {\r\n\t\tfprintf(pFile,\" Ignore Alpha Test\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" -Invalid Alpha Test-\");\r\n\t}\r\n\t\t\t\r\n\tif (pState->alphaTestEnable == 0) {\r\n\t\tfprintf(pFile,\" Alpha Test None\");\r\n\t} else if (pState->alphaTestEnable == 1) {\r\n\t\tfprintf(pFile,\" Alpha Test ACTIVE\");\r\n\t} else if (pState->alphaTestEnable == 2) {\r\n\t\tfprintf(pFile,\" Ignore Alpha Test\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" -Invalid Alpha Test-\");\r\n\t}\r\n\t\t\t\r\n\tif (pState->depthWriteEnable == 0) {\r\n\t\tfprintf(pFile,\" Depth Write None\");\r\n\t} else if (pState->depthWriteEnable == 1) {\r\n\t\tfprintf(pFile,\" Depth Write ACTIVE\");\r\n\t} else if (pState->depthWriteEnable == 2) {\r\n\t\tfprintf(pFile,\" Ignore Depth Write\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" -Invalid Depth Write-\");\r\n\t}\r\n\r\n\tif (pState->depthTestEnable == 0) {\r\n\t\tfprintf(pFile,\" Depth Test None\");\r\n\t} else if (pState->depthTestEnable == 1) {\r\n\t\tfprintf(pFile,\" Depth Test ACTIVE\");\r\n\t} else if (pState->depthTestEnable == 2) {\r\n\t\tfprintf(pFile,\" Ignore Depth Test\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" -Invalid Depth Test-\");\r\n\t}\r\n}\r\n\r\nvoid SRenderState::setTextMode(bool active) {\r\n\ttextMode\t= active ? TRUE_BOOL_U8 : FALSE_BOOL_U8;\r\n\tchanged\t\t= true;\r\n}\r\n\r\nvoid SRenderState::setBlend(BLEND_MODE mode) {\r\n\tswitch (mode) {\r\n\tcase NO_ALPHA:\r\n\t\tblendEnable\t\t= false;\r\n\t\tbreak;\r\n\tcase ALPHA:\r\n\t\tblendEnable\t\t= true;\r\n\t\tblendSrcFactor\t= GL_SRC_ALPHA;\r\n\t\tblendDstFactor\t= GL_ONE_MINUS_SRC_ALPHA;\r\n\t\tblendOp\t\t\t= ADD;\r\n\t\tbreak;\r\n\tcase ADDITIVE:\r\n\t\tblendEnable\t\t= true;\r\n\t\tblendSrcFactor\t= GL_SRC_ALPHA;\r\n\t\tblendDstFactor\t= GL_ONE;\r\n\t\tblendOp\t\t\t= ADD;\r\n\t\tbreak;\r\n    case ADDITIVE_ALPHA: \r\n\t\tblendEnable\t\t= true;\r\n\t\tblendSrcFactor\t= GL_ONE;\r\n\t\tblendDstFactor\t= GL_ONE_MINUS_SRC_ALPHA;\r\n\t\tbreak;\r\n\t}\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::setDepthState(bool write, bool test, DEPTH_OP op) {\r\n\tif (write) {\r\n\t\tdepthWriteEnable = GL_TRUE;\r\n\t} else {\r\n\t\tdepthWriteEnable = GL_FALSE;\r\n\t}\r\n\r\n\tdepthTestEnable = test;\r\n\tdepthFunction\t= op;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::setBlendAdvance(BLEND_SRC src, BLEND_DST dst, BLEND_OP src_op_dst) {\r\n\tblendEnable\t\t= true;\r\n\tblendSrcFactor\t= src;\r\n\tblendDstFactor\t= dst;\r\n\tblendOp\t\t\t= src_op_dst;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::setStencilTestCW(u32 readMask, u32 refValue, DEPTH_OP compare_op) {\r\n\tstReadMaskCW\t= readMask;\r\n\tstRefValueCW\t= refValue;\r\n\tstRefOpCW\t\t= compare_op;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::setStencilTestCCW(u32 readMask, u32 refValue, DEPTH_OP compare_op) {\r\n\tstReadMaskCCW\t= readMask;\r\n\tstRefValueCCW\t= refValue;\r\n\tstRefOpCCW\t\t= compare_op;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::setStencilWriteCW(u32 writeMask, STENCIL_OP opFailStencil, STENCIL_OP opFailZ, STENCIL_OP opSucceed) {\r\n\tstWriteMaskCW\t\t\t\t= writeMask;\r\n\tstWriteFailS_StencilOP_CW\t= opFailStencil;\r\n\tstWriteFailZ_StencilOP_CW\t= opFailZ;\r\n\tstWriteSuccZ_StencilOP_CW\t= opSucceed;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::setStencilWriteCCW(u32 writeMask, STENCIL_OP opFailStencil, STENCIL_OP opFailZ, STENCIL_OP opSucceed) {\r\n\tstWriteMaskCCW\t\t\t\t= writeMask;\r\n\tstWriteFailS_StencilOP_CCW\t= opFailStencil;\r\n\tstWriteFailZ_StencilOP_CCW\t= opFailZ;\r\n\tstWriteSuccZ_StencilOP_CCW\t= opSucceed;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::enableAlphaTest\t(float value, DEPTH_OP compare_op) {\r\n\tchanged\t\t\t= true;\r\n\talphaTestEnable = TRUE_BOOL_U8;\r\n\talphaFunction\t= compare_op;\r\n\talphaValue\t\t= value;\r\n}\r\n\r\nvoid SRenderState::disableAlphaTest\t() {\r\n\tchanged\t\t\t= true;\r\n\talphaTestEnable\t= FALSE_BOOL_U8;\r\n}\r\n\r\nvoid SRenderState::enableScissor(s32 x, s32 y, s32 w, s32 h) {\r\n\tbEnableScissor = TRUE_BOOL_U8;\r\n\tscX = x;\r\n\tscY = y;\r\n\tscW = w;\r\n\tscH = h;\r\n\tchanged = true;\r\n}\r\n\r\nvoid SRenderState::disableScissor() {\r\n\tbEnableScissor = false;\r\n\tchanged = true;\r\n}\r\n\r\nvoid CKLBOGLWrapper::applyState(SRenderState* pState) {\r\n\t/*\r\n\t//\r\n\t// Force render States each call.\r\n\t//\r\n\tif ((pState->blendEnable != 0) && (pState->blendEnable != UNDEFINED_BOOL)) {\r\n\t\trState.blendEnable = pState->blendEnable;\r\n\t\tif (rState.blendEnable) {\r\n\t\t\tdglEnable(GL_BLEND);\r\n\t\t\trState.blendSrcFactor = pState->blendSrcFactor;\r\n\t\t\trState.blendDstFactor = pState->blendDstFactor;\r\n\t\t\tdglBlendFunc(rState.blendSrcFactor, rState.blendDstFactor);\r\n\t\t} else {\r\n\t\t\tdglDisable(GL_BLEND);\r\n\t\t}\r\n\t}\r\n\r\n\tif ((pState->bEnableScissor != 0) && (pState->bEnableScissor != UNDEFINED_BOOL)) {\r\n\t\trState.bEnableScissor = pState->bEnableScissor;\r\n\t\tif (rState.bEnableScissor) {\r\n\t\t\trState.scX = pState->scX;\r\n\t\t\trState.scY = pState->scY;\r\n\t\t\trState.scW = pState->scW;\r\n\t\t\trState.scH = pState->scH;\r\n\t\t\tdglEnable(GL_SCISSOR_TEST);\r\n\t\t\tdglScissor(pState->scX, pState->scY, pState->scW, pState->scH);\r\n\r\n\t\t\t// For Testing.\r\n\t\t\t//dglClearColor(1.0f, 0.2039f, 0.7f, 0.0f);\r\n\t\t\t//dglClear(GL_COLOR_BUFFER_BIT);\r\n\t\t\t//\r\n\t\t} else {\r\n\t\t\tdglDisable(GL_SCISSOR_TEST);\r\n\t\t}\r\n\t}*/\r\n\r\n\tif ((m_pLastState != pState) || (pState->changed)) {\r\n\t\tm_pLastState\t= pState;\r\n\t\tpState->changed = false;\r\n\r\n#ifndef OPENGL2\r\n\t\tif ((pState->alphaTestEnable != rState.alphaTestEnable) && (pState->alphaTestEnable != UNDEFINED_BOOL)) {\r\n\t\t\trState.alphaTestEnable = pState->alphaTestEnable;\r\n\t\t\tif (rState.alphaTestEnable) {\r\n\t\t\t\tdglEnable(GL_ALPHA_TEST);\r\n#ifdef STD_OPENGL\r\n\t\t\t\tglAlphaFunc(pState->alphaFunction, pState->alphaValue);\r\n#else\r\n\t\t\t\tdglAlphaFuncx(pState->alphaFunction, pState->alphaValue);\r\n#endif\r\n\t\t\t} else {\r\n\t\t\t\tdglDisable(GL_ALPHA_TEST);\r\n\t\t\t}\r\n\t\t}\r\n#endif\r\n\r\n\t\tif ((pState->blendEnable != rState.blendEnable) && (pState->blendEnable != UNDEFINED_BOOL)) {\r\n\t\t\trState.blendEnable = pState->blendEnable;\r\n\t\t\tif (rState.blendEnable) {\r\n\t\t\t\tdglEnable(GL_BLEND);\r\n\t\t\t} else {\r\n\t\t\t\tdglDisable(GL_BLEND);\r\n\t\t\t}\r\n\t\t}\r\n\r\n#ifndef OPENGL2\r\n\t\tif ((pState->textMode != rState.textMode) && (pState->textMode != UNDEFINED_BOOL)) {\r\n\t\t\trState.textMode = pState->textMode;\r\n\t\t\tif (pState->textMode) {\r\n\t\t\t\t//\r\n\t\t\t\t// Activate\r\n\t\t\t\t//\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB,  GL_TEXTURE);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB,  GL_PRIMARY_COLOR);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB,  GL_SRC_ALPHA);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB,  GL_SRC_COLOR);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB,  GL_MODULATE);\r\n\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_SRC0_ALPHA,  GL_TEXTURE);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_SRC1_ALPHA,  GL_PRIMARY_COLOR);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,  GL_SRC_ALPHA);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_ALPHA,  GL_SRC_COLOR);\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA,  GL_MODULATE);\r\n\r\n\t\t\t\tdglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);\r\n\t\t\t} else {\r\n\t\t\t\t//\r\n\t\t\t\t// Desactivate\r\n\t\t\t\t//\r\n\t\t\t\tdglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);\r\n\t\t\t}\r\n\t\t}\r\n#endif\r\n\r\n\t\t// If enabled -> Check if we need to modify the blending function.\r\n\t\tif (rState.blendEnable && (pState->blendEnable != UNDEFINED_BOOL)) {\r\n\t\t\tif ((pState->blendSrcFactor != rState.blendSrcFactor) || (pState->blendDstFactor != rState.blendDstFactor)) {\r\n\t\t\t\trState.blendSrcFactor = pState->blendSrcFactor;\r\n\t\t\t\trState.blendDstFactor = pState->blendDstFactor;\r\n\t\t\t\t\r\n\t\t\t\tdglBlendFunc(rState.blendSrcFactor, rState.blendDstFactor);\r\n\t\t\t}\r\n\r\n\t\t\t// Other choice than ADD in OpenGLES 2.0\r\n#ifdef OPENGL2\r\n\t\t\tif (pState->blendOp != rState.blendOp) {\r\n\t\t\t\trState.blendOp = pState->blendOp;\r\n\t\t\t\tswitch (rState.blendOp) {\r\n\t\t\t\tcase SRenderState::ADD:\t\tdglBlendEquation(GL_FUNC_ADD); break;\r\n\t\t\t\tcase SRenderState::SUB:\t\tdglBlendEquation(GL_FUNC_SUBTRACT); break;\r\n\t\t\t\tcase SRenderState::REVSUB:\tdglBlendEquation(GL_FUNC_REVERSE_SUBTRACT); break;\r\n\t\t\t\t}\r\n\t\t\t}\r\n#endif\t\t\t\t\r\n\t\t}\r\n\t\t\r\n\r\n\t\tif ((pState->depthWriteEnable != rState.depthWriteEnable) && (pState->depthWriteEnable != UNDEFINED_BOOL)) {\r\n\t\t\trState.depthWriteEnable = pState->depthWriteEnable;\r\n\t\t\tdglDepthMask(rState.depthWriteEnable);\r\n\t\t}\r\n\r\n\t\tif ((pState->depthTestEnable != rState.depthTestEnable) && (pState->depthTestEnable != UNDEFINED_BOOL)) {\r\n\t\t\trState.depthTestEnable = pState->depthTestEnable;\r\n\t\t\tif (rState.depthTestEnable) {\r\n\r\n\t\t\t\tdglEnable(GL_DEPTH_TEST);\r\n\t\t\t} else {\r\n\t\t\t\tdglDisable(GL_DEPTH_TEST);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (rState.depthFunction != pState->depthFunction) {\r\n\t\t\trState.depthFunction = pState->depthFunction;\r\n\t\t\tif (rState.depthTestEnable) {\r\n\t\t\t\tdglDepthFunc(rState.depthFunction);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Stencil Test\r\n\t\tif (((pState->stReadMaskCW | pState->stReadMaskCCW) != (rState.stReadMaskCW | rState.stReadMaskCCW))\r\n\t\t\t||  (pState->stRefOpCW     != rState.stRefOpCW\t\t)\r\n\t\t\t||  (pState->stRefOpCCW    != rState.stRefOpCCW\t\t)\r\n\t\t\t||  (pState->stRefValueCW  != rState.stRefValueCW\t)\r\n\t\t\t||  (pState->stRefValueCCW != rState.stRefValueCCW\t)\r\n\t\t   ) {\r\n\t\t\trState.stRefOpCW\t\t= pState->stRefOpCW;\r\n\t\t\trState.stRefOpCCW\t\t= pState->stRefOpCCW;\r\n\t\t\trState.stRefValueCW\t\t= pState->stRefValueCW;\r\n\t\t\trState.stRefValueCCW\t= pState->stRefValueCCW;\r\n\t\t\trState.stReadMaskCCW\t= pState->stReadMaskCCW;\r\n\t\t\trState.stReadMaskCW\t\t= pState->stReadMaskCW;\r\n\r\n\t\t\tif (pState->stReadMaskCW | pState->stReadMaskCCW) {\r\n\t\t\t\tdglEnable(GL_STENCIL_TEST);\r\n\t\t#ifndef OPENGL2\r\n\t\t\t\tdglStencilFunc(rState.stRefOpCW, rState.stRefValueCW, rState.stReadMaskCW);\r\n\t\t#else\r\n\t\t\t\tdglStencilFuncSeparate(GL_CW, rState.stRefOpCW, rState.stRefValueCW, rState.stReadMaskCW);\r\n\t\t\t\tdglStencilFuncSeparate(GL_CCW, rState.stRefOpCCW, rState.stRefValueCCW, rState.stReadMaskCCW);\r\n\t\t#endif\r\n\t\t\t} else {\r\n\t\t\t\tdglDisable(GL_STENCIL_TEST);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Stencil write\r\n\t\t/* DISABLE : Non working for now --> Default value not set correctly in constructor.\r\n\t\tif (((pState->stWriteMaskCW | pState->stWriteMaskCCW) != (rState.stWriteMaskCW | rState.stWriteMaskCCW)) \r\n\t\t\t|| (pState->stWriteFailS_StencilOP_CW  != rState.stWriteFailS_StencilOP_CW )\r\n\t\t\t|| (pState->stWriteFailS_StencilOP_CCW != rState.stWriteFailS_StencilOP_CCW)\r\n\t\t\t|| (pState->stWriteFailZ_StencilOP_CW  != rState.stWriteFailZ_StencilOP_CW )\r\n\t\t\t|| (pState->stWriteFailZ_StencilOP_CCW != rState.stWriteFailZ_StencilOP_CCW)\r\n\t\t\t|| (pState->stWriteSuccZ_StencilOP_CW  != rState.stWriteSuccZ_StencilOP_CW )\r\n\t\t\t|| (pState->stWriteSuccZ_StencilOP_CCW != rState.stWriteSuccZ_StencilOP_CCW)\r\n\t\t\t) {\r\n\t\t\trState.stWriteMaskCCW\t= pState->stWriteMaskCCW;\r\n\t\t\trState.stWriteMaskCW\t= pState->stWriteMaskCW;\r\n\t\t\tif (rState.stWriteMaskCW | rState.stWriteMaskCCW) {\r\n\t\t#ifndef OPENGL2\r\n\t\t\t\tdglStencilOp(rState.stWriteFailS_StencilOP_CW, rState.stWriteFailZ_StencilOP_CW, rState.stWriteSuccZ_StencilOP_CW);\r\n\t\t\t\tdglStencilMask(rState.stWriteMaskCW);\r\n\t\t#else\r\n\t\t\t\tdglStencilOpSeparate(GL_CW , rState.stWriteFailS_StencilOP_CW , rState.stWriteFailZ_StencilOP_CW , rState.stWriteSuccZ_StencilOP_CW );\r\n\t\t\t\tdglStencilOpSeparate(GL_CCW, rState.stWriteFailS_StencilOP_CCW, rState.stWriteFailZ_StencilOP_CCW, rState.stWriteSuccZ_StencilOP_CCW);\r\n\t\t\t\tdglStencilMaskSeparate(GL_CW, rState.stWriteMaskCW);\r\n\t\t\t\tdglStencilMaskSeparate(GL_CCW, rState.stWriteMaskCCW);\r\n\t\t#endif\r\n\t\t\t} else {\r\n\t\t\t\tdglStencilMask(0);\t// No stencil write authorized.\r\n\t\t\t}\r\n\t\t}\r\n\t\t*/\r\n\r\n\t\tif ((pState->bEnableScissor != rState.bEnableScissor) && (pState->bEnableScissor != UNDEFINED_BOOL)) {\r\n\t\t\trState.bEnableScissor = pState->bEnableScissor;\r\n\t\t\tif (rState.bEnableScissor) {\r\n\t\t\t\trState.scX = pState->scX;\r\n\t\t\t\trState.scY = pState->scY;\r\n\t\t\t\trState.scW = pState->scW;\r\n\t\t\t\trState.scH = pState->scH;\r\n\t\t\t\tdglEnable(GL_SCISSOR_TEST);\r\n\t\t\t\tdglScissor(pState->scX, pState->scY, pState->scW, pState->scH);\r\n\r\n\t\t\t\t// For Testing.\r\n\t\t\t\t//dglClearColor(1.0f, 0.2039f, 0.7f, 0.0f);\r\n\t\t\t\t//dglClear(GL_COLOR_BUFFER_BIT);\r\n\t\t\t\t//\r\n\t\t\t} else {\r\n\t\t\t\tdglDisable(GL_SCISSOR_TEST);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBOGLWrapper::resetSampler(s32 sampler) {\r\n\tsamplerUnit[sampler].texture = 0; // No texture assigned.\r\n}\r\n\r\nvoid CKLBOGLWrapper::assignSampler(CTextureUsage* pTextureInstance, s32 sampler) {\r\n\tGLuint textureID = pTextureInstance->pTexture->pMaster->activeTexture;\r\n\t// Main draw loop setup outside.\r\n\t// dglActiveTexture(GL_TEXTURE0 + sampler);\r\n\r\n\t\r\n\tif (samplerUnit[sampler].texture != textureID) {\r\n\t\tsamplerUnit[sampler].texture = textureID;\r\n\t\tdglBindTexture(GL_TEXTURE_2D, textureID);\r\n\t}\r\n\r\n\tif (pTextureInstance->samplingSetupDone == false) {\r\n\t\tpTextureInstance->samplingSetupDone = true;\r\n\t\tdglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, pTextureInstance->minSampling);\r\n\t\tdglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, pTextureInstance->maxSampling);\r\n\r\n\t\tdglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, pTextureInstance->uMode);\r\n\t\tdglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, pTextureInstance->vMode);\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/Rendering/CRenderingManager_GL1.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\n#ifndef OPENGL2\r\n\r\nCShader*\tCKLBOGLWrapper::createShader(SRenderState::RENDER_MODE /*mode*/, SHADER_TYPE type, const SParam* listParam) {\r\n\treturn createShader(null, type, listParam);\r\n}\r\n\r\n// Shaders.\r\nCShader*\tCKLBOGLWrapper::createShader\t\t(const char* /*source*/, SHADER_TYPE /*type*/, const SParam* listParam) {\r\n\tCShader* pNewShader = KLBNEW(CShader);\r\n\tif (pNewShader) {\r\n\t\t//\r\n\t\t// Parse the list of parameters\r\n\t\t//\r\n\t\tconst SParam* parser = listParam;\r\n\t\t\t\t\r\n\t\tbool type;\r\n\t\t\t\t\r\n\t\tif (parser) {\r\n\t\t\ts32 uniCount = 0;\r\n\t\t\ts32 verCount = 0;\r\n\t\t\twhile (parser->dType != END_LIST) {\r\n\t\t\t\tif (parser->isUniform) {\r\n\t\t\t\t\tuniCount++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tverCount++;\r\n\t\t\t\t}\r\n\t\t\t\tif (parser->dType & TEXTURE) {\r\n\t\t\t\t\tpNewShader->enableTexture = true;\r\n\t\t\t\t}\r\n\t\t\t\tif (parser->dType & COLOR) {\r\n\t\t\t\t\tpNewShader->enableColor = true;\r\n\t\t\t\t}\r\n\t\t\t\tparser++;\r\n\t\t\t}\r\n\r\n\t\t\tpNewShader->countUniform\t\t= uniCount;\r\n\t\t\tpNewShader->countStreamInfo\t\t= verCount;\r\n\r\n\t\t\tpNewShader->arrayParam\t\t\t= KLBNEWA(CShader::SInternalParam,uniCount + verCount);\r\n\r\n\t\t\tif (pNewShader->arrayParam) {\r\n\t\t\t\tCShader::SInternalParam* pUniParam = pNewShader->arrayParam;\r\n\t\t\t\tCShader::SInternalParam* pVerParam = &pNewShader->arrayParam[uniCount];\r\n\t\t\t\tparser = listParam;\r\n\r\n\t\t\t\twhile (parser->dType != END_LIST) {\r\n\t\t\t\t\tif (parser->isUniform) {\r\n\t\t\t\t\t\tpUniParam->param = *parser++;\r\n\t\t\t\t\t\tpUniParam++;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpVerParam->param = *parser++;\r\n\t\t\t\t\t\tpVerParam++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\ttype\t\t\t\t\t\t\t= true;\r\n\t\t} else {\r\n\t\t\tpNewShader->countUniform\t\t= 0;\r\n\t\t\tpNewShader->countStreamInfo\t\t= 0;\r\n\t\t\tpNewShader->arrayParam\t\t\t= null;\r\n\t\t\ttype\t\t\t\t\t\t\t= false;\r\n\t\t}\r\n\r\n\r\n\t\tif ((pNewShader->arrayParam && type) || (!type)) {\r\n\t\t\tpNewShader->refCount\t= 0;\r\n\t\t\tpNewShader->shaderObj\t= 1;\r\n\t\t\tpNewShader->pNext\t\t= this->shaderList;\r\n\t\t\tthis->shaderList\t\t= pNewShader; \r\n\r\n\t\t\treturn pNewShader;\r\n\t\t}\r\n\t\t\t\r\n\t\tKLBDELETE(pNewShader);\r\n\t\tpNewShader = null;\r\n\t}\r\n\treturn pNewShader;\r\n}\r\n\r\n// Rendering Shader.\r\nCShaderSet*\tCKLBOGLWrapper::createShaderSet\t(CShader* pVertexShader, CShader* pPixelShader) {\r\n\tCShaderSet* pNewShaderSet = KLBNEW(CShaderSet);\r\n\tif (pNewShaderSet) {\r\n\t\ts32 size = pVertexShader->countUniform + pPixelShader->countUniform;\r\n\t\tif (size) {\r\n\t\t\tpNewShaderSet->locationArray = KLBNEWA(s32,size);\r\n\t\t} else {\r\n\t\t\tpNewShaderSet->locationArray = null;\r\n\t\t}\r\n\r\n\t\tif ((pNewShaderSet->locationArray) || (size == 0)) {\r\n\t\t\tpNewShaderSet->pInstances\t= null;\r\n\t\t\tpNewShaderSet->pMgr\t\t\t= this;\r\n\r\n\t\t\tpNewShaderSet->pNext\t\t= this->shaderSetList;\r\n\t\t\tthis->shaderSetList\t\t\t= pNewShaderSet;\r\n\r\n\t\t\tpVertexShader->refCount++;\r\n\t\t\tpPixelShader->refCount++;\r\n\r\n\t\t\tpNewShaderSet->pixelShader\t= pPixelShader;\r\n\t\t\tpNewShaderSet->vertexShader\t= pVertexShader;\r\n\r\n\t\t\tpNewShaderSet->enableTexture\t= pPixelShader->enableTexture | pVertexShader->enableTexture;\r\n\t\t\tpNewShaderSet->enableColor\t\t= pPixelShader->enableColor   | pVertexShader->enableColor;\r\n\r\n\t\t\treturn pNewShaderSet;\r\n\t\t}\r\n\t\tKLBDELETE(pNewShaderSet);\r\n\t}\r\n\treturn null;\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseShader(CShader* pShader) {\r\n\tCShader* p = this->shaderList;\r\n\tCShader* prev = null;\r\n\twhile (p != pShader) {\r\n\t\tprev = p;\r\n\t\tp = p->pNext;\r\n\t}\r\n\r\n\t//\r\n\t// Remove from link list.\r\n\t//\r\n\tif (prev == null) {\r\n\t\tthis->shaderList = pShader->pNext;\r\n\t} else {\r\n\t\tprev->pNext = pShader->pNext;\r\n\t}\r\n\r\n\t// Free param\r\n\tif (pShader->arrayParam) {\r\n\t\tKLBDELETE(pShader->arrayParam);\r\n\t\tpShader->arrayParam = NULL;\t// 2012.12.11  念の為\r\n\t}\r\n\r\n\t// Delete object\r\n\tKLBDELETE(pShader);\r\n\tpShader = NULL;\t// 2012.12.11  念の為\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseShaderSet(CShaderSet* pFullShader) {\r\n\tklb_assertc(pFullShader != NULL,\t\t\t\t\t\t\"null shader set\");\r\n\r\n\tCShaderSet* p\t\t= this->shaderSetList;\r\n\tCShaderSet* pPrev\t= null;\r\n\r\n\twhile (p != pFullShader) {\r\n\t\tpPrev = p; p = p->pNext;\r\n\t}\r\n\r\n\tif (pPrev == null) {\r\n\t\tthis->shaderSetList = p->pNext;\r\n\t} else {\r\n\t\tpPrev->pNext = p->pNext;\r\n\t}\r\n\t\r\n\t// Release all instances.\r\n\tpFullShader->releaseAllInstances();\r\n\r\n\tif (pFullShader->locationArray) {\r\n\t\tKLBDELETE(pFullShader->locationArray);\r\n\t}\r\n\r\n\tpFullShader->vertexShader->refCount--;\r\n\tpFullShader->pixelShader->refCount--;\r\n\r\n\tif (pFullShader->vertexShader->refCount == 0) {\r\n\t\tthis->releaseShader(pFullShader->vertexShader);\r\n\t\tpFullShader->vertexShader = NULL;\t// 2012.12.11  念の為\r\n\t}\r\n\r\n\tif (pFullShader->pixelShader->refCount == 0) {\r\n\t\tthis->releaseShader(pFullShader->pixelShader);\r\n\t\tpFullShader->pixelShader = NULL;\t// 2012.12.11  念の為\r\n\t}\r\n\r\n\tKLBDELETE(pFullShader);\r\n\tpFullShader = NULL;\t// 2012.12.11  念の為\r\n}\r\n\r\nvoid CKLBOGLWrapper::draw(\r\n\t\t\tGLenum\t\t\t\tmode, \r\n\t\t\tCShaderInstance*\tinstance,\r\n\t\t\tCBuffer**\t\t\tppBuffer,\r\n\t\t\tu32\t\t\t\t\tbufferCount,\r\n\t\t\tCIndexBuffer*\t\tpIndexBuffer,\r\n\t\t\tCTextureUsage**\t\tarray_pTexture,\r\n\t\t\ts32*\t\t\t\tuniformID,\r\n\t\t\ts32\t\t\t\t\tindexCount) {\r\n\tklb_assert(instance\t\t, \"null shader instance\");\r\n\tklb_assert(ppBuffer\t\t, \"null vertex buffer\");\r\n\tklb_assert(pIndexBuffer\t, \"null index buffer\");\r\n\r\n\tCShader* pVertexS\t= instance->m_pShaderSet->vertexShader;\r\n\ts32 maxVertexInput\t= pVertexS->countStreamInfo;\r\n\r\n\t// Force buffer to commit changes if they are VBO and were not updated.\r\n\tif (pIndexBuffer->VBOModified) {\r\n\t\tpIndexBuffer->commitVBO();\r\n\t}\r\n\r\n\t//\r\n\t// Force VBO Commit.\r\n\t//\r\n\tu32 n=0;\r\n\twhile (n < bufferCount) {\r\n\t\tCBuffer* pBuffer = ppBuffer[n];\r\n\t\tn++;\r\n\r\n\t\tif (pBuffer->VBOModified) {\r\n\t\t\tpBuffer->commitVBO();\r\n\t\t}\r\n\t}\r\n\t\t\r\n\t//\r\n\t// Process all input for shaders.\r\n\t//\r\n\r\n\ts32 count\t\t\t= 0;\r\n\twhile (count < maxVertexInput) {\r\n\t\tCShaderInstance::SInternalParam* pParam = &instance->paramArrayVertexVertexShader[count];\r\n\t\tif (pParam->isConstantifiedOrUniform)\r\n\t\t// Constantified\r\n\t\t{\r\n\t\t\tswitch (pParam->dType >> 4) {\r\n\t\t\tcase (VERTEX>>4):\r\n\t\t\t\t// Do nothing.\r\n\t\t\t\tklb_assertAlways(\"Can not constantify coordinates.\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase (COLOR>>4):\r\n\t\t\t\t_glBindBuffer(0);\r\n\t\t\t\tdglColor4f(pParam->values[0].f, pParam->values[1].f, pParam->values[2].f, pParam->values[3].f);\r\n\t\t\t\tdglColorPointer(4, GL_FLOAT, 0, null);\t// Force constant.\r\n\t\t\t\tbreak;\r\n\t\t\tcase (TEXTURE>>4):\r\n\t\t\t\t_glBindBuffer(0);\r\n\t\t\t\tdglMultiTexCoord4f(GL_TEXTURE0, pParam->values[0].f, pParam->values[1].f, pParam->values[2].f, pParam->values[3].f); \r\n\t\t\t\tdglTexCoordPointer(2, GL_FLOAT, 0, null);\t// Force constant.\r\n\t\t\t\tbreak;\r\n\t\t\tcase (NORM>>4):\r\n\t\t\t\t_glBindBuffer(0);\r\n\t\t\t\tdglNormal3f(pParam->values[0].f, pParam->values[1].f, pParam->values[2].f);\r\n\t\t\t\tdglNormalPointer(GL_FLOAT, 0, null);\t// Force constant.\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t// Buffer\r\n\t\t{\r\n\t\t\t//\r\n\t\t\t// Search in buffer the source mapping the shader input.\r\n\t\t\t//\r\n\t\t\ts32 vertID = instance->paramArrayVertexVertexShader[count].vertexInfoID;\r\n\r\n\t\t\tu32 n=0;\r\n\t\t\twhile (n < bufferCount) {\r\n\t\t\t\tCBuffer* pBuffer = ppBuffer[n];\r\n\t\t\t\tn++;\r\n\r\n\t\t\t\tSVertexEntry* pEntries = pBuffer->structure;\r\n\t\t\t\tSVertexEntry* pEntriesEnd = &pEntries[pBuffer->dynCount + pBuffer->vboCount];\r\n\t\t\t\twhile ((pEntries->vertexInfoID != vertID) && (pEntries < pEntriesEnd)) {\r\n\t\t\t\t\tpEntries++;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pEntries < pEntriesEnd) {\r\n\t\t\t\t\tGLint size = GLint(pParam->dType & 0xF);\r\n\t\t\t\t\tGLenum type\t= GL_FLOAT;\r\n\t\t\t\t\tGLboolean normalized = GL_FALSE;\r\n\t\t\t\t\tif (size == VEC4BYTE) {\r\n\t\t\t\t\t\tsize = 4;\r\n\t\t\t\t\t\ttype = GL_UNSIGNED_BYTE;\r\n\t\t\t\t\t\tnormalized = GL_TRUE;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (pEntries->isVBO) {\r\n\t\t\t\t\t\t_glBindBuffer(pBuffer->vboID);\r\n\t\t\t\t\t\tswitch (pParam->dType >> 4) {\r\n\t\t\t\t\t\tcase (VERTEX>>4):\r\n\t\t\t\t\t\t\tdglVertexPointer\t\t(size, type, (pBuffer->strideVBO * sizeof(float)), (const void*)((pEntries->offset + pBuffer->offsetDrawVBO) * sizeof(float)));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase (COLOR>>4):\r\n\t\t\t\t\t\t\tdglColorPointer\t\t(4, type, (pBuffer->strideVBO * sizeof(float)), (const void*)((pEntries->offset + pBuffer->offsetDrawVBO) * sizeof(float)));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase (TEXTURE>>4):\r\n\t\t\t\t\t\t\tdglTexCoordPointer\t(2, GL_FLOAT, (pBuffer->strideVBO * sizeof(float)), (const void*)((pEntries->offset + pBuffer->offsetDrawVBO) * sizeof(float)));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase (NORM>>4):\r\n\t\t\t\t\t\t\tdglNormal3f(pParam->values[0].f, pParam->values[1].f, pParam->values[2].f);\r\n\t\t\t\t\t\t\tdglNormalPointer\t\t(GL_FLOAT, (pBuffer->strideVBO * sizeof(float)), (const void*)((pEntries->offset + pBuffer->offsetDrawVBO) * sizeof(float)));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t_glBindBuffer(0);\r\n\r\n\t\t\t\t\t\tswitch (pParam->dType >> 4) {\r\n\t\t\t\t\t\tcase (VERTEX>>4):\r\n\t\t\t\t\t\t\tdglVertexPointer\t\t(size, type, (pBuffer->strideDyn * sizeof(float)), &(((float*)pBuffer->ptrBuffer)[pEntries->offset + pBuffer->offsetDrawDyn]));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase (COLOR>>4):\r\n\t\t\t\t\t\t\tdglColorPointer\t\t(4, type, (pBuffer->strideDyn * sizeof(float)), &(((float*)pBuffer->ptrBuffer)[pEntries->offset + pBuffer->offsetDrawDyn]));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase (TEXTURE>>4):\r\n\t\t\t\t\t\t\tdglTexCoordPointer\t(2, GL_FLOAT, (pBuffer->strideDyn * sizeof(float)), &(((float*)pBuffer->ptrBuffer)[pEntries->offset + pBuffer->offsetDrawDyn]));\r\n                      \t\tbreak;\r\n\t\t\t\t\t\tcase (NORM>>4):\r\n\t\t\t\t\t\t\tdglNormal3f(pParam->values[0].f, pParam->values[1].f, pParam->values[2].f);\r\n\t\t\t\t\t\t\tdglNormalPointer\t\t(GL_FLOAT, (pBuffer->strideDyn * sizeof(float)), &(((float*)pBuffer->ptrBuffer)[pEntries->offset + pBuffer->offsetDrawDyn]));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// skip search.\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcount++;\r\n\t}\r\n\r\n\t/*\r\n\t\t// TODO put \"hint\" in vertex def to be able to map correct API.\r\n\t\t// TODO setup all buffers OR constant.\r\n\t*/\r\n\r\n\t//\r\n\t// Process uniform parameters.\r\n\t//\r\n\ts32 countTexture = 0;\r\n//\ts32* pLocation = instance->m_pShaderSet->locationArray;\t// Vertex + Pixel shader.\r\n\r\n\tif (instance->enableColor) {\r\n\t\tif (enableColor != TRUE_BOOL_U8) {\r\n\t\t\tenableColor = TRUE_BOOL_U8;\r\n\t\t\tdglEnableClientState(GL_COLOR_ARRAY);\r\n\t\t}\r\n\t} else {\r\n\t\tif (enableColor != FALSE_BOOL_U8) {\r\n\t\t\tenableColor = FALSE_BOOL_U8;\r\n\t\t\tdglDisableClientState(GL_COLOR_ARRAY);\r\n\t\t}\r\n\t}\r\n\r\n\tif (instance->enableTexture) {\r\n\t\tif (enableTexture != TRUE_BOOL_U8) {\r\n\t\t\tenableTexture = TRUE_BOOL_U8;\r\n\t\t\tdglEnable(GL_TEXTURE_2D);\r\n\t\t\tdglEnableClientState(GL_TEXTURE_COORD_ARRAY);\r\n\t\t}\r\n\r\n\t\tfor (s32 n=0; n < 2; n++) {\r\n\t\t\tCShaderInstance::SInternalParam* pParam;\r\n\t\t\tCShaderInstance::SInternalParam* maxVertexUniform;\r\n\t\t\r\n\t\t\t//\r\n\t\t\t// Vertex & Pixel Shader. (MUST BE SAME ORDER AS CreateShaderSet !!!)\r\n\t\t\t//\r\n\t\t\tif (n == 0) {\r\n\t\t\t\tpParam = instance->paramArrayUniformVertexShader;\r\n\t\t\t\tmaxVertexUniform = &pParam[pVertexS->countUniform];\r\n\t\t\t} else {\r\n\t\t\t\tpParam = instance->paramArrayUniformPixelShader;\r\n\t\t\t\tmaxVertexUniform = &pParam[instance->m_pShaderSet->pixelShader->countUniform];\r\n\t\t\t}\r\n\r\n\t\t\twhile (pParam < maxVertexUniform) {\r\n\t\t\t\tswitch (pParam->dType & 0x0F) {\r\n\t\t\t\tcase TEX2D:\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Process texture\r\n\t\t\t\t\t//\r\n\t\t\t\t\tCTextureUsage**\tpTex\t= array_pTexture;\r\n\t\t\t\t\tif (pTex != null) {\r\n\t\t\t\t\t\ts32*\t\t\tpUniID\t= uniformID;\r\n\t\t\t\t\t\twhile ((*pTex != null) && (pParam->vertexInfoID != *pUniID)) {\r\n\t\t\t\t\t\t\tpTex++;\r\n\t\t\t\t\t\t\tpUniID++;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (*pTex != null) {\r\n\t\t\t\t\t\t\t// Assign texture to texture unit and apply parameters.\r\n\t\t\t\t\t\t\tCTextureUsage* pUsage = *pTex;\r\n\t\t\t\t\t\t\tpUsage->activate(countTexture);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// klb_assertAlways(\"Texture attribute is not mapped to a valid texture\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tklb_assertAlways(\"No texture information when shader use texture\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tpParam++;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tif (enableTexture != FALSE_BOOL_U8) {\r\n\t\t\tenableTexture = FALSE_BOOL_U8;\r\n\t\t\tdglDisable(GL_TEXTURE_2D);\r\n\t\t\tdglDisableClientState(GL_TEXTURE_COORD_ARRAY);\r\n\t\t\t// Should be enough.\r\n\t\t\t// glActiveTexture(GL_TEXTURE0);\t\t\t\t\t// Remove texture from sampler\r\n\t\t\t// glBindTexture(GL_TEXTURE0,0);\r\n\t\t}\r\n\t}\r\n\r\n\t//\r\n\t// Handle Index Buffer & Draw call.\r\n\t//\r\n\tif (pIndexBuffer->isVBO) {\r\n\t\tif (lastElementArrayBuffer != pIndexBuffer->vboID) {\r\n\t\t\tlastElementArrayBuffer = pIndexBuffer->vboID;\r\n\t\t\tdglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, pIndexBuffer->vboID);\r\n\t\t}\r\n\t\tdglDrawElements(mode, indexCount, GL_UNSIGNED_SHORT, 0);\r\n\t} else {\r\n\t\tif (lastElementArrayBuffer != 0) {\r\n\t\t\tlastElementArrayBuffer = 0;\r\n\t\t\tdglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);\r\n\t\t}\r\n\t\tdglDrawElements(mode, indexCount, GL_UNSIGNED_SHORT, &pIndexBuffer->ptrBuffer[pIndexBuffer->offsetDraw]);\r\n\t}\r\n}\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Rendering/CRenderingManager_GL2.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\n#ifdef OPENGL2\r\n\r\n#include \"shaderSource.inl\"\r\n\r\nconst char* CKLBOGLWrapper::patch(const char* shader, const char* glslTransform) {\r\n\treturn NULL;\r\n}\r\n\r\nCShader*\tCKLBOGLWrapper::createShader(SRenderState::RENDER_MODE mode, SHADER_TYPE type, const SParam* listParam) {\r\n\tconst char* src = null;\r\n\r\n\tif (type == VERTEX_SHADER) {\r\n\t\tswitch (mode) {\r\n\t\tcase SRenderState::ONLY_COLOR:\r\n\t\t\tsrc = s_vertColorOnly;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ONLY_TEXTURE:\r\n\t\t\tsrc = s_vertTexture;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::TEXTURE_MUL_COLOR:\r\n\t\t\tsrc = sh_vertColTexture;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_BRIGHTNESS:\r\n\t\t\tsrc = sh_brightNessVS;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_COLORIZE:\r\n\t\tcase SRenderState::ES2_SATURATE:\r\n\t\tcase SRenderState::ES2_RAMP:\r\n\t\t\tsrc = sh_vertColTexture;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_TONE:\r\n\t\t\tif (this->support3DTexture()) {\r\n\t\t\t\tsrc = sh_toneVS_3D;\r\n\t\t\t} else {\r\n\t\t\t\tsrc = sh_toneVS_2D;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_MOSAIC:\r\n\t\t\tsrc = sh_mosaicVS;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t} else {\r\n\t\tswitch (mode) {\r\n\t\tcase SRenderState::ONLY_COLOR:\r\n\t\t\tsrc = s_fragColorOnly;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ONLY_TEXTURE:\r\n\t\t\tsrc = s_fragTexture;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::TEXTURE_MUL_COLOR:\r\n\t\t\tsrc = sh_fragColTexture;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_BRIGHTNESS:\r\n\t\t\tsrc = sh_fragColTexture;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_COLORIZE:\r\n\t\t\tsrc = sh_colorizePS;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_SATURATE:\r\n\t\t\tsrc = sh_saturatePS;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_RAMP:\r\n\t\t\tsrc = sh_curvePS;\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_TONE:\r\n\t\t\tif (this->support3DTexture()) {\r\n\t\t\t\tsrc = sh_tonePS_3D;\r\n\t\t\t} else {\r\n\t\t\t\tsrc = sh_tonePS_2D;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase SRenderState::ES2_MOSAIC:\r\n\t\t\tsrc = sh_mosaicPS;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn createShader(src, type, listParam);\r\n}\r\n\r\n// Shaders.\r\nCShader*\tCKLBOGLWrapper::createShader\t\t(const char* source, SHADER_TYPE type, const SParam* listParam) {\r\n\tCShader* pNewShader = KLBNEW(CShader);\r\n\tif (pNewShader) {\r\n\t\tGLuint shaderID = dglCreateShader(type == VERTEX_SHADER ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER);\r\n\t\tif (shaderID != 0) {\r\n\t\t\tGLint compiled;\r\n\r\n\t\t\tdglShaderSource(shaderID, 1, &source, null);\r\n\t\t\t// Compile the shader\r\n\t\t\tdglCompileShader(shaderID);\r\n\t\t\t// Check the compile status\r\n\t\t\tdglGetShaderiv(shaderID, GL_COMPILE_STATUS, &compiled);\r\n\r\n\t\t\tif (compiled) {\r\n\t\t\t\t//\r\n\t\t\t\t// Parse the list of parameters\r\n\t\t\t\t//\r\n\t\t\t\tconst SParam* parser = listParam;\r\n\t\t\t\t\r\n\t\t\t\tbool type;\r\n\t\t\t\t\r\n\t\t\t\tif (parser) {\r\n\t\t\t\t\ts32 uniCount = 0;\r\n\t\t\t\t\ts32 verCount = 0;\r\n\t\t\t\t\twhile (parser->dType != END_LIST) {\r\n\t\t\t\t\t\tif (parser->isUniform) {\r\n\t\t\t\t\t\t\tuniCount++;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tverCount++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (parser->dType & TEXTURE) {\r\n\t\t\t\t\t\t\tpNewShader->enableTexture = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (parser->dType & COLOR) {\r\n\t\t\t\t\t\t\tpNewShader->enableColor = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tparser++;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpNewShader->countUniform\t\t= uniCount;\r\n\t\t\t\t\tpNewShader->countStreamInfo\t\t= verCount;\r\n\r\n\t\t\t\t\tpNewShader->arrayParam\t\t\t= KLBNEWA(CShader::SInternalParam,uniCount + verCount);\r\n\r\n\t\t\t\t\tif (pNewShader->arrayParam) {\r\n\t\t\t\t\t\tCShader::SInternalParam* pUniParam = pNewShader->arrayParam;\r\n\t\t\t\t\t\tCShader::SInternalParam* pVerParam = &pNewShader->arrayParam[uniCount];\r\n\t\t\t\t\t\tparser = listParam;\r\n\r\n\t\t\t\t\t\twhile (parser->dType != END_LIST) {\r\n\t\t\t\t\t\t\tif (parser->isUniform) {\r\n\t\t\t\t\t\t\t\tpUniParam->param = *parser++;\r\n\t\t\t\t\t\t\t\tpUniParam++;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tpVerParam->param = *parser++;\r\n\t\t\t\t\t\t\t\tpVerParam++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\ttype\t\t\t\t\t\t\t= true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpNewShader->countUniform\t\t= 0;\r\n\t\t\t\t\tpNewShader->countStreamInfo\t\t= 0;\r\n\t\t\t\t\tpNewShader->arrayParam\t\t\t= null;\r\n\t\t\t\t\ttype\t\t\t\t\t\t\t= false;\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif ((pNewShader->arrayParam && type) || (!type)) {\r\n\t\t\t\t\tpNewShader->refCount\t= 0;\r\n\t\t\t\t\tpNewShader->shaderObj\t= shaderID;\r\n\t\t\t\t\tpNewShader->pNext\t\t= this->shaderList;\r\n\t\t\t\t\tthis->shaderList\t\t= pNewShader; \r\n\r\n\t\t\t\t\treturn pNewShader;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdglDeleteShader(shaderID);\r\n\t\t}\r\n\t\t\t\r\n\t\tKLBDELETE(pNewShader);\r\n\t\tpNewShader = null;\r\n\t}\r\n\treturn pNewShader;\r\n}\r\n\r\n// Rendering Shader.\r\nCShaderSet*\tCKLBOGLWrapper::createShaderSet\t(CShader* pVertexShader, CShader* pPixelShader) {\r\n\tCShaderSet* pNewShaderSet = KLBNEW(CShaderSet);\r\n\tif (pNewShaderSet) {\r\n\t\ts32 size = pVertexShader->countUniform + pPixelShader->countUniform;\r\n\t\tif (size) {\r\n\t\t\tpNewShaderSet->locationArray = KLBNEWA(s32,size);\r\n\t\t} else {\r\n\t\t\tpNewShaderSet->locationArray = null;\r\n\t\t}\r\n\r\n\t\tif ((pNewShaderSet->locationArray) || (size == 0)) {\r\n\t\t\tGLuint progID = dglCreateProgram();\r\n\t\t\tif (progID) {\r\n\t\t\t\t// Attach\r\n\t\t\t\tdglAttachShader(progID, pVertexShader->shaderObj);\r\n\t\t\t\tdglAttachShader(progID, pPixelShader->shaderObj);\r\n\t\t\t\r\n\t\t\t\tpNewShaderSet->pInstances\t= null;\r\n\t\t\t\tpNewShaderSet->pMgr\t\t\t= this;\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Iterate through vertex shader attribute \r\n\t\t\t\t//\r\n\t\t\t\ts32 iterator = 0;\r\n\t\t\t\tCShader::SInternalParam* pParam = &pVertexShader->arrayParam[pVertexShader->countUniform];\r\n\t\t\t\twhile (iterator < pVertexShader->countStreamInfo) {\r\n\t\t\t\t\tdglBindAttribLocation(progID, iterator, pParam->param.name);\t// Actually only associated with vertex.\r\n\t\t\t\t\titerator++;\r\n\t\t\t\t\tpParam++;\t\t\t\t\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdglLinkProgram(progID);\r\n\r\n\t\t\t\tGLint success = 0;\r\n\t\t\t\tdglGetProgramiv(progID, GL_LINK_STATUS, &success);\r\n\t\t\t\tif (success)\r\n\t\t\t\t{\r\n\t\t\t\t\ts32 uniformIndex = 0;\r\n\t\t\t\t\tfor (s32 n=0; n < 2; n++) {\r\n\t\t\t\t\t\tCShader* pShader;\r\n\t\t\t\t\t\tif (n==0) { pShader = pVertexShader; } else { pShader = pPixelShader; }\r\n\t\t\t\t\r\n\t\t\t\t\t\tCShader::SInternalParam* pParam = pShader->arrayParam;\r\n\t\t\t\t\t\titerator = 0;\r\n\t\t\t\t\t\twhile (iterator < pShader->countUniform) {\r\n\t\t\t\t\t\t\t// Becomes UniformID\r\n\t\t\t\t\t\t\tpNewShaderSet->locationArray[uniformIndex++] = dglGetUniformLocation(progID, pParam->param.name);\r\n\t\t\t\t\t\t\titerator++;\r\n\t\t\t\t\t\t\tpParam++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tpNewShaderSet->programObj\t= progID;\r\n\t\t\t\t\tpNewShaderSet->pNext\t\t= this->shaderSetList;\r\n\t\t\t\t\tthis->shaderSetList\t\t\t= pNewShaderSet;\r\n\r\n\t\t\t\t\tpVertexShader->refCount++;\r\n\t\t\t\t\tpPixelShader->refCount++;\r\n\r\n\t\t\t\t\tpNewShaderSet->pixelShader\t= pPixelShader;\r\n\t\t\t\t\tpNewShaderSet->vertexShader\t= pVertexShader;\r\n\r\n\t\t\t\t\tpNewShaderSet->enableTexture\t= pPixelShader->enableTexture | pVertexShader->enableTexture;\r\n\t\t\t\t\tpNewShaderSet->enableColor\t\t= pPixelShader->enableColor   | pVertexShader->enableColor;\r\n\r\n\t\t\t\t\treturn pNewShaderSet;\r\n\t\t\t\t}\r\n\t\t\t\tdglDeleteProgram(progID);\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewShaderSet->locationArray) {\r\n\t\t\t\tKLBDELETE(pNewShaderSet->locationArray);\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETE(pNewShaderSet);\r\n\t}\r\n\treturn null;\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseShader(CShader* pShader) {\r\n\tCShader* p = this->shaderList;\r\n\tCShader* prev = null;\r\n\twhile (p != pShader) {\r\n\t\tprev = p;\r\n\t\tp = p->pNext;\r\n\t}\r\n\r\n\t//\r\n\t// Remove from link list.\r\n\t//\r\n\tif (prev == null) {\r\n\t\tthis->shaderList = pShader->pNext;\r\n\t} else {\r\n\t\tprev->pNext = pShader->pNext;\r\n\t}\r\n\r\n\t//\r\n\t// Delete shader from GL\r\n\t//\r\n\tdglDeleteShader(pShader->shaderObj);\r\n\r\n\t// Free param\r\n\tif (pShader->arrayParam) {\r\n\t\tKLBDELETE(pShader->arrayParam);\r\n\t}\r\n\r\n\t// Delete object\r\n\tKLBDELETE(pShader);\r\n}\r\n\r\nvoid CKLBOGLWrapper::releaseShaderSet(CShaderSet* pFullShader) {\r\n\tklb_assertc(pFullShader != nullptr,\t\t\t\t\t\t\"null shader set\");\r\n\r\n\tCShaderSet* p\t\t= this->shaderSetList;\r\n\tCShaderSet* pPrev\t= null;\r\n\r\n\twhile (p != pFullShader) {\r\n\t\tpPrev = p; p = p->pNext;\r\n\t}\r\n\r\n\tif (pPrev == null) {\r\n\t\tthis->shaderSetList = p->pNext;\r\n\t} else {\r\n\t\tpPrev->pNext = p->pNext;\r\n\t}\r\n\t\r\n\t// Release all instances.\r\n\tpFullShader->releaseAllInstances();\r\n\t// Release open GL associated program.\r\n\r\n\tdglDeleteProgram(pFullShader->programObj);\r\n\r\n\tif (pFullShader->locationArray) {\r\n\t\tKLBDELETE(pFullShader->locationArray);\r\n\t}\r\n\r\n\tpFullShader->vertexShader->refCount--;\r\n\tpFullShader->pixelShader->refCount--;\r\n\r\n\tif (pFullShader->vertexShader->refCount == 0) {\r\n\t\tthis->releaseShader(pFullShader->vertexShader);\r\n\t}\r\n\r\n\tif (pFullShader->pixelShader->refCount == 0) {\r\n\t\tthis->releaseShader(pFullShader->pixelShader);\r\n\t}\r\n\r\n\tKLBDELETE(pFullShader);\r\n}\r\n\r\nvoid CKLBOGLWrapper::draw(\r\n\t\t\tGLenum\t\t\t\tmode, \r\n\t\t\tCShaderInstance*\tinstance,\r\n\t\t\tCBuffer**\t\t\tppBuffer,\r\n\t\t\tu32\t\t\t\t\tbufferCount,\r\n\t\t\tCIndexBuffer*\t\tpIndexBuffer,\r\n\t\t\tCTextureUsage**\t\tarray_pTexture,\r\n\t\t\ts32*\t\t\t\tuniformID,\r\n\t\t\ts32\t\t\t\t\tindexCount) {\r\n\r\n\t// Force buffer to commit changes if they are VBO and were not updated.\r\n\r\n\tu32 n=0;\r\n\twhile (n < bufferCount) {\r\n\t\tCBuffer* pBuffer = ppBuffer[n];\r\n\t\tn++;\r\n\r\n\t\tif (pBuffer->VBOModified) {\r\n\t\t\tpBuffer->commitVBO();\r\n\t\t}\r\n\t}\r\n\t\r\n\tif (pIndexBuffer->VBOModified) {\r\n\t\tpIndexBuffer->commitVBO();\r\n\t}\r\n\t\r\n\tif (m_lastShaderInstance != instance) {\r\n\t\t// Same Shader with different param is also a possibility.\r\n\t\tif (!m_lastShaderInstance || (m_lastShaderInstance->m_pShaderSet != instance->m_pShaderSet)) {\r\n\t\t\t// Use Shader only when program really changes.\r\n\t\t\tdglUseProgram(instance->m_pShaderSet->programObj);\r\n\t\t}\r\n\r\n\t\t// Transform matrix\r\n//\t\tu32 _projectionUniform = dglGetUniformLocation(instance->m_pShaderSet->programObj, \"Projection\");\r\n//\t\tdglUniformMatrix4fv(_projectionUniform, 1, 0, displayMatrix2D);\r\n\t\tm_lastShaderInstance = instance;\r\n\t}\r\n    u32 _projectionUniform = dglGetUniformLocation(instance->m_pShaderSet->programObj, \"Projection\");\r\n    dglUniformMatrix4fv(_projectionUniform, 1, 0, displayMatrix2D);\r\n\r\n\t//\r\n\t// Process all input for shaders.\r\n\t//\r\n\tCShader* pVertexS\t= instance->m_pShaderSet->vertexShader;\r\n\ts32 maxVertexInput\t= pVertexS->countStreamInfo;\r\n\ts32 count\t\t\t= 0;\r\n\twhile (count < maxVertexInput) {\r\n\t\tCShaderInstance::SInternalParam* pParam = &instance->paramArrayVertexVertexShader[count];\r\n\t\tif (pParam->isConstantifiedOrUniform)\r\n\t\t{\r\n\t\t\tdglDisableVertexAttribArray(count);\r\n\t\t\t\r\n\t\t\t// Constantified\r\n\t\t\tswitch (pParam->dType & 0x0F) {\r\n\t\t\tcase VEC1F:\r\n\t\t\t\tdglVertexAttrib1fv(count, (GLfloat*)pParam->values);\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC2:\r\n\t\t\t\tdglVertexAttrib2fv(count, (GLfloat*)pParam->values);\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC3:\r\n\t\t\t\tdglVertexAttrib3fv(count, (GLfloat*)pParam->values);\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC4BYTE:\r\n\t\t\tcase VEC4:\r\n\t\t\t\tdglVertexAttrib4fv(count, (GLfloat*)pParam->values);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tklb_assertAlways(\"Invalid Type for vertex attribute\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t//\r\n\t\t\t// Search in buffer the source mapping the shader input.\r\n\t\t\t//\r\n\t\t\ts32 vertID = instance->paramArrayVertexVertexShader[count].vertexInfoID;\r\n\r\n\t\t\tu32 n=0;\r\n\t\t\twhile (n < bufferCount) {\r\n\t\t\t\tCBuffer* pBuffer = ppBuffer[n];\r\n\t\t\t\tn++;\r\n\r\n\t\t\t\tSVertexEntry* pEntries = pBuffer->structure;\r\n\t\t\t\tSVertexEntry* pEntriesEnd = &pEntries[pBuffer->dynCount + pBuffer->vboCount];\r\n\t\t\t\twhile ((pEntries->vertexInfoID != vertID) && (pEntries < pEntriesEnd)) {\r\n\t\t\t\t\tpEntries++;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pEntries < pEntriesEnd) {\r\n\t\t\t\t\tGLint size = GLint(pParam->dType & 0xF);\r\n\t\t\t\t\tGLenum type\t= GL_FLOAT;\r\n\t\t\t\t\tGLboolean normalized = GL_FALSE;\r\n\t\t\t\t\tif (size == VEC4BYTE) {\r\n\t\t\t\t\t\tsize = 4;\r\n\t\t\t\t\t\ttype = GL_UNSIGNED_BYTE;\r\n\t\t\t\t\t\tnormalized = GL_TRUE;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (pEntries->isVBO) {\r\n\t\t\t\t\t\t_glBindBuffer(pBuffer->vboID);\r\n\t\t\t\t\t\tdglEnableVertexAttribArray(count);\r\n\t\t\t\t\t\tdglVertexAttribPointer(\t\t\t\tcount, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnormalized, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(pBuffer->strideVBO * sizeof(float)), \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(const void*)((pEntries->offset + pBuffer->offsetDrawVBO) * sizeof(float)));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t_glBindBuffer(0);\r\n\t\t\t\t\t\tdglEnableVertexAttribArray(count);\r\n\t\t\t\t\t\tdglVertexAttribPointer(\t\t\t\tcount,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnormalized,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(pBuffer->strideDyn * sizeof(float)),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&(((float*)pBuffer->ptrBuffer)[pEntries->offset + pBuffer->offsetDrawDyn]));\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Break and go to next array.\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcount++;\r\n\t}\r\n\r\n\t//\r\n\t// Process uniform parameters.\r\n\t//\r\n\tcount = 0;\r\n\ts32 countTexture = 0;\r\n\ts32* pLocation = instance->m_pShaderSet->locationArray;\t// Vertex + Pixel shader.\r\n\r\n\tfor (s32 n=0; n < 2; n++) {\r\n\t\tCShaderInstance::SInternalParam* pParam;\r\n\t\tCShaderInstance::SInternalParam* maxVertexUniform;\r\n\t\t\r\n\t\t//\r\n\t\t// Vertex & Pixel Shader. (MUST BE SAME ORDER AS CreateShaderSet !!!)\r\n\t\t//\r\n\t\tif (n == 0) {\r\n\t\t\tpParam = instance->paramArrayUniformVertexShader;\r\n\t\t\tmaxVertexUniform = &pParam[pVertexS->countUniform];\r\n\t\t} else {\r\n\t\t\tpParam = instance->paramArrayUniformPixelShader;\r\n\t\t\tmaxVertexUniform = &pParam[instance->m_pShaderSet->pixelShader->countUniform];\r\n\t\t}\r\n\r\n\t\twhile (pParam < maxVertexUniform) {\r\n\t\t\ts32 location = *pLocation++;\r\n\t\t\tswitch (pParam->dType & 0x0F) {\r\n\t\t\tcase VEC1I:\r\n\t\t\t\tdglUniform1iv(location, 1, (GLint*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC1F:\r\n\t\t\t\tdglUniform1fv(location, 1, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC2:\r\n\t\t\t\tdglUniform2fv(location, 1, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC3:\r\n\t\t\t\tdglUniform3fv(location, 1, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase VEC4:\r\n\t\t\t\tdglUniform4fv(location, 1, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase MMAT2:\r\n\t\t\t\tdglUniformMatrix2fv(location, 1, GL_FALSE, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase MMAT3:\r\n\t\t\t\tdglUniformMatrix3fv(location, 1, GL_FALSE, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase MMAT4:\r\n\t\t\t\tdglUniformMatrix4fv(location, 1, GL_FALSE, (GLfloat*)(pParam->values));\r\n\t\t\t\tbreak;\r\n\t\t\tcase TEX2D:\r\n\t\t\t\tif (pParam->pTexture == NULL) {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Process texture\r\n\t\t\t\t\t//\r\n\t\t\t\t\tCTextureUsage**\tpTex\t= array_pTexture;\r\n\t\t\t\t\tif (pTex != null) {\r\n\t\t\t\t\t\ts32*\t\t\tpUniID\t= uniformID;\r\n\t\t\t\t\t\twhile ((*pTex != null) && (pParam->vertexInfoID != *pUniID)) {\r\n\t\t\t\t\t\t\tpTex++;\r\n\t\t\t\t\t\t\tpUniID++;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (*pTex != null) {\r\n\t\t\t\t\t\t\t// Assign texture to texture unit and apply parameters.\r\n\t\t\t\t\t\t\tCTextureUsage* pUsage = *pTex;\r\n\t\t\t\t\t\t\tpUsage->activate(countTexture);\r\n\r\n\t\t\t\t\t\t\t// Link active texture unit to uniform\r\n\t\t\t\t\t\t\tdglUniform1i(location, countTexture);\r\n\t\t\t\t\t\t\tcountTexture++;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// klb_assertAlways(\"Texture attribute is not mapped to a valid texture\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tklb_assertAlways(\"No texture information when shader use texture\");\r\n\t\t\t\t\t}\r\n\t\t\t\t} /*else {\r\n\t\t\t\t\t// Assign texture to texture unit and apply parameters.\r\n\t\t\t\t\tCTextureUsage* pUsage = pParam->pTexture;\r\n\t\t\t\t\tpUsage->activate(countTexture);\r\n\t\t\t\t\t// Link active texture unit to uniform\r\n\t\t\t\t\tdglUniform1i(location, countTexture);\r\n\t\t\t\t\tcountTexture++;\r\n\t\t\t\t}*/\r\n\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpParam++;\r\n\t\t}\r\n\t}\r\n\r\n\t//\r\n\t// Handle Index Buffer & Draw call.\r\n\t//\r\n\tif (pIndexBuffer->isVBO) {\r\n\t\tif (lastElementArrayBuffer != pIndexBuffer->vboID) {\r\n\t\t\tlastElementArrayBuffer = pIndexBuffer->vboID;\r\n\t\t\tdglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, pIndexBuffer->vboID);\r\n\t\t}\r\n\t\tdglDrawElements(mode, indexCount, GL_UNSIGNED_SHORT, 0);\r\n\t} else {\r\n\t\tif (lastElementArrayBuffer != 0) {\r\n\t\t\tlastElementArrayBuffer = 0;\r\n\t\t\tdglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);\r\n\t\t}\r\n\t\tdglDrawElements(mode, indexCount, GL_UNSIGNED_SHORT, &pIndexBuffer->ptrBuffer[pIndexBuffer->offsetDraw]);\r\n\t}\r\n}\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/source/Rendering/CShaderSet.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n#include \"mem.h\"\r\n\r\nCShader::CShader():\r\n\tenableTexture(false),\r\n\tenableColor(false)\r\n{\r\n\t// Do nothing.\r\n}\r\n\r\nCShader::~CShader() {\r\n\t// Do nothing.\r\n}\r\n\r\nCShaderSet::CShaderSet() {\r\n\t// Do nothing.\r\n}\r\n\r\nCShaderSet::~CShaderSet() {\r\n\t// Do nothing.\r\n}\r\n\r\n//\r\n// ShaderSet\r\n//\r\n\r\nCShaderInstance* CShaderSet::createInstance() {\r\n\tCShaderInstance* pNewInstance = KLBNEW(CShaderInstance);\r\n\tif (pNewInstance) {\r\n\t\tbool err = false;\r\n\t\tpNewInstance->m_pShaderSet\t= this;\r\n\t\t\r\n\t\tpNewInstance->enableColor\t= this->enableColor;\r\n\t\tpNewInstance->enableTexture = this->enableTexture;\r\n\r\n\t\t// Count number of vertex input on shader\r\n\t\tpNewInstance->paramArrayVertexVertexShader\t= KLBNEWA(CShaderInstance::SInternalParam,this->vertexShader->countStreamInfo);\r\n\r\n\t\terr = (pNewInstance->paramArrayVertexVertexShader == null);\r\n\r\n\t\tif (this->vertexShader->countUniform) {\r\n\t\t\tpNewInstance->paramArrayUniformVertexShader\t= KLBNEWA(CShaderInstance::SInternalParam,this->vertexShader->countUniform);\r\n\t\t\terr |= (pNewInstance->paramArrayUniformVertexShader == null);\r\n\t\t} else {\r\n\t\t\tpNewInstance->paramArrayUniformVertexShader\t= null;\r\n\t\t}\r\n\r\n\t\tif (this->pixelShader->countUniform) {\r\n\t\t\tpNewInstance->paramArrayUniformPixelShader\t= KLBNEWA(CShaderInstance::SInternalParam,this->pixelShader->countUniform);\r\n\t\t\terr |= (pNewInstance->paramArrayUniformPixelShader == null);\r\n\t\t} else {\r\n\t\t\tpNewInstance->paramArrayUniformPixelShader\t= null;\r\n\t\t}\r\n\r\n\t\tif (err != false) {\r\n\t\t\t// free arrays\r\n\t\t\tif (pNewInstance->paramArrayUniformPixelShader) {\r\n\t\t\t\tKLBDELETE(pNewInstance->paramArrayUniformPixelShader);\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewInstance->paramArrayUniformVertexShader) {\r\n\t\t\t\tKLBDELETE(pNewInstance->paramArrayUniformVertexShader);\r\n\t\t\t}\r\n\r\n\t\t\tif (pNewInstance->paramArrayVertexVertexShader) {\r\n\t\t\t\tKLBDELETE(pNewInstance->paramArrayVertexVertexShader);\r\n\t\t\t}\r\n\r\n\t\t\tKLBDELETE(pNewInstance);\r\n\t\t\tpNewInstance = null;\r\n\t\t} else {\r\n\t\t\t//\r\n\t\t\t// Copy all params to instance.\r\n\t\t\t//\r\n\t\t\tCShaderInstance::SInternalParam* pParam = pNewInstance->paramArrayVertexVertexShader;\t\t\t\r\n\t\t\tCShader::SInternalParam* pSrc = &this->vertexShader->arrayParam[this->vertexShader->countUniform];\r\n\t\t\tfor (s32 n=0; n < this->vertexShader->countStreamInfo; n++) {\r\n\t\t\t\tpParam->dType\t\t\t\t\t\t= pSrc->param.dType;\r\n\t\t\t\tpParam->isConstantifiedOrUniform\t= false;\t// Vertex by default.\r\n\t\t\t\tpParam->vertexInfoID\t\t\t\t= pSrc->param.vertexORuniformID;\r\n\r\n\t\t\t\tpParam++;\r\n\t\t\t\tpSrc++;\r\n\t\t\t}\r\n\r\n\t\t\tpParam = pNewInstance->paramArrayUniformVertexShader;\r\n\t\t\tpSrc = this->vertexShader->arrayParam;\r\n\t\t\tfor (s32 n=0; n < this->vertexShader->countUniform; n++) {\r\n\t\t\t\tpParam->dType\t\t\t\t\t\t= pSrc->param.dType;\r\n\t\t\t\tpParam->isConstantifiedOrUniform\t= true;\r\n\t\t\t\tpParam->pTexture\t\t\t\t\t= NULL;\r\n\t\t\t\tpParam->vertexInfoID\t\t\t\t= pSrc->param.vertexORuniformID;\r\n\t\t\t\tmemset32(pParam->values, 0, 16*4);\r\n\t\t\t\tpParam++;\r\n\t\t\t\tpSrc++;\r\n\t\t\t}\r\n\r\n\t\t\tpParam = pNewInstance->paramArrayUniformPixelShader;\r\n\t\t\tpSrc = this->pixelShader->arrayParam;\r\n\t\t\tfor (s32 n=0; n < this->pixelShader->countUniform; n++) {\r\n\t\t\t\tpParam->dType\t\t\t\t\t\t= pSrc->param.dType;\r\n\t\t\t\tpParam->isConstantifiedOrUniform\t= true;\r\n\t\t\t\tpParam->pTexture\t\t\t\t\t= NULL;\r\n\t\t\t\tpParam->vertexInfoID\t\t\t\t= pSrc->param.vertexORuniformID;\r\n\t\t\t\tmemset32(pParam->values, 0, 16*4);\r\n\t\t\t\tpParam++;\r\n\t\t\t\tpSrc++;\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Link list.\r\n\t\t\t//\r\n\t\t\tpNewInstance->pNext = this->pInstances; \r\n\t\t\tthis->pInstances\t= pNewInstance;\r\n\t\t}\r\n\t}\r\n\treturn pNewInstance;\r\n}\r\n\r\nvoid CShaderSet::releaseAllInstances() {\r\n\tCShaderInstance* p = this->pInstances;\r\n\twhile (p) {\r\n\t\tCShaderInstance* pNext = p->pNext;\r\n\r\n\t\tif (p->paramArrayUniformPixelShader)\t{\tKLBDELETE(p->paramArrayUniformPixelShader);\t\t}\r\n\t\tif (p->paramArrayUniformVertexShader)\t{\tKLBDELETE(p->paramArrayUniformVertexShader);\t\t}\r\n\t\tif (p->paramArrayVertexVertexShader)\t{\tKLBDELETE(p->paramArrayVertexVertexShader);\t\t}\r\n\r\n\t\tKLBDELETE(p);\r\n\t\tp = pNext;\r\n\t}\r\n\tthis->pInstances = null;\r\n}\r\n\r\nvoid CShaderSet::releaseInstance(CShaderInstance* pInstance) {\r\n\tklb_assertc(pInstance != NULL,\t\t\t\t\t\t\"null shader\");\r\n\tklb_assertc(pInstance->m_pShaderSet == this,\"Invalid shader set\");\r\n\r\n\tCShaderInstance* p\t\t= this->pInstances;\r\n\tCShaderInstance* pPrev\t= null;\r\n\r\n\twhile (p != pInstance) {\r\n\t\tpPrev = p; p = p->pNext;\r\n\t}\r\n\r\n\tif (pPrev == null) {\r\n\t\tthis->pInstances = p->pNext;\r\n\t} else {\r\n\t\tpPrev->pNext = p->pNext;\r\n\t}\r\n\r\n\tif (p->paramArrayUniformPixelShader)\t{\tKLBDELETE(p->paramArrayUniformPixelShader);\t}\r\n\tif (p->paramArrayUniformVertexShader)\t{\tKLBDELETE(p->paramArrayUniformVertexShader);\t}\r\n\tif (p->paramArrayVertexVertexShader)\t{\tKLBDELETE(p->paramArrayVertexVertexShader);\t}\r\n\r\n\tKLBDELETE(p);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CShaderSetInstance.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n#include \"mem.h\"\r\n\r\n// TODO Would need later a CController only.\r\n// #include \"ApplicationFramework.h\"\r\n\r\nCShaderInstance::CShaderInstance() {\r\n\t// Do nothing.\r\n}\r\n\r\nCShaderInstance::~CShaderInstance() {\r\n\t// Do nothing.\r\n}\r\n\r\n//\r\n// ShaderSetInstance\r\n//\r\n\r\n/** TODO RP : Shader System with controller implementation.\r\nvoid CShaderInstance::updateByController(CController* pSrc) {\r\n\tfor (s32 n=0; n < pSrc->m_componentCount; n++) {\r\n\t\ts32 select\t= (pSrc->m_targetProperties>>5) & 0x1F;\r\n\t\tSHADER type = select & 0x10 ? PIXEL_SHADER : VERTEX_SHADER;\r\n\t\tif (pSrc->m_asFloat & (1<<n)) {\r\n\t\t\tsetUniformF(type, select & 0xF, (GLfloat*)&pSrc->result[n]);\r\n\t\t\tn += (type-1);\t// Skip vector size.\r\n\t\t} else {\r\n\t\t\tsetUniformI(type, select & 0xF, (GLint*)&pSrc->result[n]);\r\n\t\t}\r\n\t}\r\n}*/\r\n\r\nvoid CShaderInstance::setUniformTexture(SHADER type, s32 uniformID, CTextureUsage*\tpTextureUsage) {\r\n\tSInternalParam* pArray;\r\n\r\n\tif (type == VERTEX_SHADER) {\r\n\t\tpArray = this->paramArrayUniformVertexShader;\r\n\t} else {\r\n\t\tpArray = this->paramArrayUniformPixelShader;\r\n\t}\r\n\r\n\twhile (pArray->vertexInfoID != uniformID) {\r\n\t\tpArray++;\r\n\t}\r\n\r\n\t// TODO assert invalid uniform ID\r\n\r\n\tswitch (pArray->dType) {\r\n\tcase TEX2D:\r\n\t\tpArray->pTexture = pTextureUsage;\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid CShaderInstance::setUniformI(SHADER type, s32 uniformID, GLint* values  ) {\r\n\tSInternalParam* pArray;\r\n\r\n\t// TODO assert shader type\r\n\r\n\tif (type == VERTEX_SHADER) {\r\n\t\tpArray = this->paramArrayUniformVertexShader;\r\n\t} else {\r\n\t\tpArray = this->paramArrayUniformPixelShader;\r\n\t}\r\n\r\n\twhile (pArray->vertexInfoID != uniformID) {\r\n\t\tpArray++;\r\n\t}\r\n\r\n\t// TODO assert invalid uniform ID\r\n\r\n\tswitch (pArray->dType) {\r\n\tcase VEC1I:\r\n\t\tpArray->values[0].i = *values;\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid CShaderInstance::setUniformF(SHADER type, s32 uniformID, GLfloat* values) {\r\n\t\r\n\t// TODO Assert shader type, null pointer\r\n\r\n\tSInternalParam* pArray;\r\n\r\n\tif (type == VERTEX_SHADER) {\r\n\t\tpArray = this->paramArrayUniformVertexShader;\r\n\t} else {\r\n\t\tpArray = this->paramArrayUniformPixelShader;\r\n\t}\r\n\r\n\twhile (pArray->vertexInfoID != uniformID) {\r\n\t\tpArray++;\r\n\t}\r\n\r\n\ts32 size;\r\n\tswitch (pArray->dType) {\r\n\tcase VEC1F:\t\t\tsize = 1;\tbreak;\r\n\tcase VEC2:\t\t\tsize = 2;\tbreak;\r\n\tcase VEC3:\t\t\tsize = 3;\tbreak;\r\n\tcase VEC4:\t\t\tsize = 4;\tbreak;\r\n\tcase MMAT2:\t\t\tsize = 4;\tbreak;\r\n\tcase MMAT3:\t\t\tsize = 9;\tbreak;\r\n\tcase MMAT4:\t\t\tsize = 16;\tbreak;\r\n\tdefault:\t\t\tsize = 0;\r\n\t}\r\n\r\n\t// TODO assert invalid uniform ID\r\n\r\n\tmemcpy32(pArray->values, values, sizeof(float)*size); \r\n}\r\n\r\nvoid CShaderInstance::setConstantifyVertex(s32 vertexID, GLfloat* values) {\r\n\t\r\n\t// TODO Assert vertexID index, null pointer\r\n\r\n\tSInternalParam* pArray = this->paramArrayVertexVertexShader;\r\n\r\n\twhile (pArray->vertexInfoID != vertexID) {\r\n\t\tpArray++;\r\n\t}\r\n\r\n\ts32 size;\r\n\tswitch (pArray->dType) {\r\n\tcase VEC1F:\t\t\tsize = 1;\tbreak;\r\n\tcase VEC2:\t\t\tsize = 2;\tbreak;\r\n\tcase VEC3:\t\t\tsize = 3;\tbreak;\r\n\tcase VEC4:\t\t\tsize = 4;\tbreak;\r\n\tcase MMAT2:\t\t\tsize = 4;\tbreak;\r\n\tcase MMAT3:\t\t\tsize = 9;\tbreak;\r\n\tcase MMAT4:\t\t\tsize = 16;\tbreak;\r\n\tdefault:\t\t\tsize = 0;\r\n\t}\r\n\t\r\n\tpArray->isConstantifiedOrUniform = true;\r\n\r\n\tmemcpy32(pArray->values, values, sizeof(float)*size);\r\n}\r\n\r\nvoid CShaderInstance::unConstantifyVertex(s32 vertexID) {\r\n\t\r\n\t// TODO Assert vertexID index\r\n\r\n\tSInternalParam* pArray = this->paramArrayVertexVertexShader;\r\n\r\n\twhile (pArray->vertexInfoID != vertexID) {\r\n\t\tpArray++;\r\n\t}\r\n\r\n\tpArray->isConstantifiedOrUniform = false;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CTexture.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\n// nothing.\r\n\r\nCTexture::CTexture() {\r\n\t// Do nothing.\r\n}\r\n\r\nCTexture::~CTexture() {\r\n\t// Do nothing.\r\n}\r\n\r\nCSubTexture::CSubTexture() {\r\n\t// Do nothing.\r\n}\r\n\r\nCSubTexture::~CSubTexture() {\r\n\t// Do nothing.\r\n}\r\n\r\nCFontTexture::CFontTexture():CSubTexture(),\r\n\tfixedSize(32),\r\n\tcurrX(0),\r\n\tcurrY(0),\r\n\tu0u1v0v1(null),\r\n\twh(null)\r\n{\r\n}\r\n\r\nCFontTexture::~CFontTexture() {\r\n}\r\n\r\nvoid CFontTexture::setup(s32 fixedSize) {\r\n\tthis->currX = 0;\r\n\tthis->currY = 0;\r\n\tthis->fixedSize\t= fixedSize;\r\n}\r\n\r\nbool CFontTexture::setupCharCount(u16 charCount) {\r\n\twh\t\t\t= KLBNEWA(u32,charCount);\r\n\tu0u1v0v1\t= KLBNEWA(float,charCount * 4);\r\n\tif (wh && u0u1v0v1) {\r\n\t\tfor (s32 n=0; n<charCount*4;) {\r\n\t\t\tu0u1v0v1[n++] = 0.0f;\r\n\t\t\tu0u1v0v1[n++] = 0.0f;\r\n\t\t\tu0u1v0v1[n++] = 0.0f;\r\n\t\t\tu0u1v0v1[n++] = 0.0f;\r\n\t\t}\r\n\t\treturn true;\r\n\t} else {\r\n\t\tif (wh)\t\t\t{ KLBDELETE(wh);\t\t}\r\n\t\tif (u0u1v0v1)\t{ KLBDELETE(u0u1v0v1);\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nvoid CFontTexture::registerChar(u16 c, s32 variableSize) {\r\n\ts32 idx = c << 2;\r\n\tu32\tsize;\r\n\tfloat u0, v0;\r\n\tfloat u1, v1;\r\n\r\n\t// 1.currX, currY define u0,v0\r\n\tconvertPixelToRenderUV(this->currX, this->currY, TOP_LEFT, &u0, &v0);\r\n\r\n\t// 2.Prepair next char.\r\n\t// Horizontal\r\n\tthis->currX += variableSize;\r\n\r\n\tif (this->currX > this->width) {\r\n\t\tthis->currX = 0;\r\n\t\tthis->currY += fixedSize;\r\n\t\tconvertPixelToRenderUV(this->currX, this->currY, TOP_LEFT, &u0, &v0);\r\n\t\tthis->currX += variableSize;\r\n\t}\r\n\r\n\tconvertPixelToRenderUV(this->currX, this->currY + fixedSize, TOP_LEFT, &u1, &v1);\r\n\r\n\r\n\tsize = (variableSize << 16) | fixedSize;\r\n\r\n\tu0u1v0v1[idx  ] = u0;\r\n\tu0u1v0v1[idx+1] = u1;\r\n\tu0u1v0v1[idx+2] = v0;\r\n\tu0u1v0v1[idx+3] = v1;\r\n\twh[c]\t\t\t= size;\r\n}\r\n\r\nvoid CFontTexture::registerChar(u16 c, u32 x, u32 y, u32 w, u32 h, bool /*rot*/, u8 marginTopLeft, u8 marginBottomRight) {\r\n\ts32 idx = c << 2;\r\n\tfloat u0, v0;\r\n\tfloat u1, v1;\r\n\r\n\t// 1.currX, currY define u0,v0\r\n\tconvertPixelToRenderUV(x + marginTopLeft, y + marginTopLeft,\t\t\t\t\t\tTOP_LEFT, &u0, &v0);\r\n\t{\r\n//\tif (rot) {\r\n/*\t\tconvertPixelToRenderUV(x + h, y + w,\tTOP_LEFT, &u1, &v1);\r\n\t\tu0u1v0v1[idx  ] = v0;\r\n\t\tu0u1v0v1[idx+1] = v1;\r\n\t\tu0u1v0v1[idx+2] = u0;\r\n\t\tu0u1v0v1[idx+3] = u1;\r\n\t} else {*/\r\n\t\tconvertPixelToRenderUV(x + w - marginBottomRight, y + h - marginBottomRight,\tTOP_LEFT, &u1, &v1);\r\n\t\tu0u1v0v1[idx  ] = u0;\r\n\t\tu0u1v0v1[idx+1] = u1;\r\n\t\tu0u1v0v1[idx+2] = v0;\r\n\t\tu0u1v0v1[idx+3] = v1;\r\n\t}\r\n\r\n\tw -= marginTopLeft + marginBottomRight;\r\n\th -= marginTopLeft + marginBottomRight;\r\n\r\n\twh[c]\t\t\t= (w << 16) | h;\r\n}\r\n\r\nvoid CFontTexture::getChar(u16 c, float* u0, float* u1, float* v0, float* v1, float* w, float* h) {\r\n\r\n\tu16 flipH = c & 0x8000;\r\n\tu16 flipV = c & 0x4000;\r\n\r\n\tc &= 0x3FFF;\r\n\ts32 idx = c << 2;\r\n\r\n\tif (flipH) {\r\n\t\t*u1 = u0u1v0v1[idx  ];\r\n\t\t*u0 = u0u1v0v1[idx+1];\r\n\t} else {\r\n\t\t*u0 = u0u1v0v1[idx  ];\r\n\t\t*u1 = u0u1v0v1[idx+1];\r\n\t}\r\n\r\n\tif (flipV) {\r\n\t\t*v1 = u0u1v0v1[idx+2];\r\n\t\t*v0 = u0u1v0v1[idx+3];\r\n\t} else {\r\n\t\t*v0 = u0u1v0v1[idx+2];\r\n\t\t*v1 = u0u1v0v1[idx+3];\r\n\t}\r\n\r\n\r\n\t*w  = float(wh[c] >> 16);\r\n\t*h  = float(wh[c] & 0xFFFF);\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CTextureBase.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"RenderingFramework.h\"\r\n\r\nCTextureBase::CTextureBase()\r\n:pSWAlphaMap\t(NULL)\r\n{\r\n\t// Do nothing.\r\n}\r\n\r\nCTextureBase::~CTextureBase() {\r\n\tKLBDELETEA(pSWAlphaMap);\r\n}\r\n\r\nvoid CTextureBase::assignSWAlphaBuffer(u8* pBuffer) {\r\n\tpSWAlphaMap = pBuffer;\r\n}\r\n\r\nu32\tCTextureBase::isAlpha\t(float u,float v) {\r\n\tklb_assert(((u >= 0.0f) && (u <= 1.0f)),\"Out of range UV\");\r\n\tklb_assert(((v >= 0.0f) && (v <= 1.0f)),\"Out of range UV\");\r\n\t// Optimize : have (width/tile)  (height/tile) as float already.\r\n\tint x\t\t= ((int)(u * (this->getWidth ())))>>3;\r\n\tint y\t\t= ((int)(v * (this->getHeight())))>>3;\r\n\tint adr\t\t= (x+(y*(this->getWidth()>>3)));\r\n\tint adrByte = adr>>3;\r\n\tint adrBit\t= adr&7; // 0..7 order\r\n\treturn (pSWAlphaMap[adrByte] >> adrBit) & 1;\r\n}\r\n\r\n//\r\n// Texture base.\r\n//\r\n\r\nCTextureUsage*\tCTextureBase::createUsage() {\r\n\tusageCount++;\r\n\tif (usageCount == 1) {\r\n\t\treturn &this->usageList;\r\n\t} else {\r\n\t\tCTextureUsage* pItem = KLBNEW(CTextureUsage);\r\n\t\tif (pItem) {\r\n\t\t\tpItem->init(this);\r\n\t\t\tpItem->pNext = this->usageList.pNext;\r\n\t\t\tthis->usageList.pNext = pItem;\r\n\t\t}\r\n\t\treturn pItem;\r\n\t}\r\n}\r\n\r\nvoid CTextureBase::releaseUsage(CTextureUsage* pUsage) {\r\n\tif (pUsage) { return; }\r\n\r\n\tCTextureUsage* parse = this->usageList.pNext;\r\n\tCTextureUsage* prev = null;\r\n\twhile (parse != pUsage) {\r\n\t\tprev = parse;\r\n\t\tparse = parse->pNext;\r\n\t}\r\n\r\n\tif (parse == pUsage) {\r\n\t\tif (prev == null) {\r\n\t\t\tthis->usageList.pNext = parse->pNext;\r\n\t\t} else {\r\n\t\t\tprev->pNext = parse->pNext;\r\n\t\t}\r\n\t}\r\n\r\n\tKLBDELETE(pUsage);\r\n}\r\n\r\nvoid CTextureBase::releaseSubTextures() {\r\n\tif (pChild) {\r\n\t\tCTextureBase* pBase = this->pChild;\r\n\t\twhile (pBase) {\r\n\t\t\tCTextureBase* pNext = pBase->pBrother;\r\n\t\t\tpBase->releaseSubTextures();\r\n\t\t\tKLBDELETE(pBase);\r\n\t\t\tpBase = pNext;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CTexture::makeEmptyShell() {\r\n\tif (texture) {\r\n\t\tdglDeleteTextures(1, &texture);\r\n\t\ttexture = 0;\r\n\t}\r\n\tif (textureDoubleBuff) {\r\n\t\tdglDeleteTextures(1, &textureDoubleBuff);\r\n\t\ttextureDoubleBuff = 0;\r\n\t}\r\n}\r\n\r\nCSubTexture*\tCTextureBase::setSubAtlas(bool asFont, s32 x, s32 y, s32 width, s32 height) {\r\n\tCSubTexture* pSub = asFont ? KLBNEW(CFontTexture) : KLBNEW(CSubTexture);\r\n\tif (pSub) {\r\n\t\tpSub->width = width;\r\n\t\tpSub->height = height;\r\n\t\tpSub->x = x + this->x;\r\n\t\tpSub->y = y + this->y;\r\n\r\n\t\tpSub->pChild\t= null;\r\n\t\tpSub->pMaster\t= this->pMaster;\r\n\t\tpSub->pMgr\t\t= this->pMgr;\r\n\t\tpSub->pParent\t= pMaster;\r\n\t\tpSub->usageList.init(this);\r\n\t\tpSub->usageCount\t= 0;\r\n\r\n\t\tpSub->pBrother\t= this->pChild;\r\n\t\tif (this->pChild == null) {\r\n\t\t\tthis->pChild = (CTextureBase*)pSub;\r\n\t\t}\r\n\t}\r\n\treturn pSub;\r\n}\r\n\r\nvoid\tCTextureBase::releaseSubTexture(CSubTexture* /*pSubTex*/) {\r\n\t// ### NOT IMPLEMENTED\r\n\t/*\r\n\tif (pChild) {\r\n\t\tCTextureBase* pParse = pChild;\r\n\t\twhile (pParse) {\r\n\t\t\tCTextureBase* pParseNext = pParse->pBrother;\r\n\t\t\tpParse->releaseSubTextures();\r\n\t\t\tKLBDELETE(pParse);\r\n\t\t\tpParse = pParseNext;\r\n\t\t}\r\n\t\tpChild = null;\r\n\t}*/\r\n}\r\n\r\nvoid CTextureBase::updateTextureFromFrame(u32 mipLevel, s32 dstX, s32 dstY, s32 srcX, s32 srcY, s32 srcW, s32 srcH) {\r\n\tdglBindTexture(GL_TEXTURE_2D,pMaster->getWorkingTexture());\r\n\r\n\tdstX += this->x;\r\n\tdstY += this->y;\r\n\r\n\tdglCopyTexSubImage2D (GL_TEXTURE_2D, mipLevel, dstX, dstY, srcX, srcY, srcW, srcH);\r\n}\r\n\r\nbool\tCTextureBase::updateTexture(s32 x, s32 y, s32 width, s32 height, void* data, s32 dataSize) {\r\n\tx = this->x + x;\r\n\ty = this->y + y;\r\n\r\n\tdglBindTexture(GL_TEXTURE_2D,pMaster->getWorkingTexture());\r\n\r\n\tdglPixelStorei(GL_PACK_ALIGNMENT,\t1);\r\n\tdglPixelStorei(GL_UNPACK_ALIGNMENT,\t1);\r\n\tif (pMaster->isCompressed) {\r\n\t\t#ifdef STD_OPENGL\r\n\t\t\t#pragma message (\"Warning : feature not supported with standard OpenGL for now\")\r\n\t\t#else\r\n\t\t\tdglCompressedTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height,\r\n\t\t\t\t\tpMaster->format,\r\n\t\t\t\t\tdataSize,\r\n\t\t\t\t\tdata);\r\n\t\t#endif\r\n\t} else {\r\n\t\tdglTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height,\r\n\t\t\t\tpMaster->channels,\r\n\t\t\t\tpMaster->format,\r\n\t\t\t\tdata);\r\n\t}\r\n\r\n\tif (dglGetError()) {\r\n\t\tklb_assertAlways(\"Invalid texture update\");\r\n\t\treturn false;\r\n\t} else {\r\n\t\treturn true;\r\n\t}\r\n}\r\n\r\nvoid CTextureBase::convertPixelToRenderUV(s32 x, s32 y, UVCOMPUTE_MODE sampling, float* u, float* v) {\r\n\tfloat offU = 0.0f;\r\n\tfloat offV = 0.0f;\r\n\r\n\t// Absolute coordinate in top parent.\r\n\tx = this->x + x;\r\n\ty = this->y + y;\r\n\r\n\tif (sampling == CENTROID) {\t\t\t\t// Can optimize.\r\n\t\toffU = pMaster->UPerPixel * 0.5f;\r\n\t\toffV = pMaster->VPerPixel * 0.5f;\r\n\t}\r\n\r\n\t*u = (x * pMaster->UPerPixel) + offU;\r\n\t*v = (y * pMaster->VPerPixel) + offV;\r\n}\r\n\r\nvoid \tCTextureBase::releaseUsage() {\r\n\t//\r\n\t// Parse the atlas tree of texture.\r\n\t//\r\n\tif (pChild) {\r\n\t\tCTextureBase* pParse = pChild;\r\n\t\twhile (pParse) {\r\n\t\t\tpParse->releaseUsage();\r\n\t\t\tpParse = pParse->pBrother;\r\n\t\t}\r\n\t}\r\n\r\n\t// Release usage.\r\n\tCTextureUsage* pUsage = this->usageList.pNext;\r\n\twhile (pUsage) {\r\n\t\tCTextureUsage* pNextUsage = pUsage->pNext;\r\n\t\tKLBDELETE(pUsage);\r\n\t\tpUsage = pNextUsage;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/CTextureUsage.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n#include \"RenderingFramework.h\"\r\n\r\nCTextureUsage::CTextureUsage()\r\n:samplingSetupDone(false) {\r\n\t// Do nothing.\r\n}\r\n\r\nCTextureUsage::~CTextureUsage() {\r\n\t// Do nothing.\r\n}\r\n\r\n//\r\n// Texture usage.\r\n//\r\n\r\nvoid\tCTextureUsage::init(CTextureBase* pTexture) {\r\n\tthis->samplingSetupDone = false;\r\n\tthis->minSampling = GL_LINEAR;\r\n\r\n\tCTexture* topTexture = pTexture->pMaster;\r\n\tif (topTexture->isMipmapped) {\r\n\t\tthis->maxSampling = GL_LINEAR_MIPMAP_NEAREST;\r\n\t} else {\r\n\t\tthis->maxSampling = GL_LINEAR;\r\n\t}\r\n\r\n\tthis->pTexture\t= pTexture;\r\n\tthis->pNext\t\t= null;\r\n\tthis->uMode\t\t= GL_REPEAT;\r\n\tthis->vMode\t\t= GL_REPEAT;\r\n}\r\n\r\nvoid \tCTextureUsage::activate(s32 sampler) {\r\n\t// Select NEW(texture id.\r\n\tCTexture* pTexture = this->pTexture->pMaster;\r\n\tif (pTexture->isDoubleBuffered) {\r\n\t\tGLuint\ttextureID;\r\n\t\t\r\n\t\tif (pMgr->getFrame() != pTexture->frame) {\r\n\t\t\t// Texture IS double buffered\r\n\t\t\tif (pTexture->textureDoubleBuff == pTexture->activeTexture) {\r\n\t\t\t\ttextureID = pTexture->texture;\r\n\t\t\t} else {\r\n\t\t\t\ttextureID = pTexture->textureDoubleBuff;\r\n\t\t\t}\r\n\t\t\tpTexture->activeTexture = textureID;\r\n\t\t\tpTexture->frame = pMgr->getFrame();\r\n\t\t} else {\r\n\t\t\ttextureID = pTexture->activeTexture;\r\n\t\t}\r\n\t}\r\n\r\n\t// Activate.\r\n\tpTexture->pMgr->assignSampler(this, sampler);\r\n}\r\n\r\nvoid\tCTextureUsage::setSampling(SAMPLING minmode, SAMPLING magmode) {\r\n\tsamplingSetupDone = false;\r\n\r\n\tswitch (minmode) {\r\n\tcase LINEAR:\r\n\t\tthis->minSampling = GL_LINEAR;\r\n\t\tbreak;\r\n\tcase NEAREST:\r\n\tdefault:\r\n\t\tthis->minSampling = GL_NEAREST;\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif (pTexture->pMaster->isMipmapped) {\r\n\t\tGLuint samplingType;\r\n\t\tswitch (magmode & 1) {\r\n\t\tcase LINEAR:\r\n\t\t\tif (magmode & BLEND_IFMIPMAP_BIT) {\r\n\t\t\t\tsamplingType = GL_LINEAR_MIPMAP_LINEAR;\r\n\t\t\t} else {\r\n\t\t\t\tsamplingType = GL_LINEAR_MIPMAP_NEAREST;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\tcase NEAREST:\r\n\t\t\tif (magmode & BLEND_IFMIPMAP_BIT) {\r\n\t\t\t\tsamplingType = GL_NEAREST_MIPMAP_LINEAR;\r\n\t\t\t} else {\r\n\t\t\t\tsamplingType = GL_NEAREST_MIPMAP_NEAREST;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tthis->maxSampling = samplingType;\r\n\t} else {\r\n\t\tswitch (magmode) {\r\n\t\tcase LINEAR:\r\n\t\t\tthis->maxSampling = GL_LINEAR;\r\n\t\t\tbreak;\r\n\t\tcase NEAREST:\r\n\t\tdefault:\r\n\t\t\tthis->maxSampling = GL_NEAREST;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \tCTextureUsage::setWrapping(WRAPPING U_mode, WRAPPING V_mode) {\r\n\tGLenum mode;\r\n\tswitch (U_mode) {\r\n\tcase CLAMP_TO_EDGE:\r\n#ifdef STD_OPENGL\r\n\t\tmode = GL_CLAMP;\r\n#else\r\n\t\tmode = GL_CLAMP_TO_EDGE;\r\n#endif\r\n\t\tbreak;\r\n\t/* Only in OpenGL 2.0 : Disabled for now.\r\n\tcase MIRRORED:\r\n\t\tmode = GL_MIRRORED_REPEAT;\r\n\t\tbreak;\r\n\t\t*/\r\n\tdefault:\r\n\tcase REPEAT:\r\n\t\tmode = GL_REPEAT;\r\n\t\tbreak;\r\n\t};\r\n\r\n\tthis->uMode = mode;\r\n\r\n\tswitch (V_mode) {\r\n\tcase CLAMP_TO_EDGE:\r\n#ifdef STD_OPENGL\r\n\t\tmode = GL_CLAMP;\r\n#else\r\n\t\tmode = GL_CLAMP_TO_EDGE;\r\n#endif\r\n\t\tbreak;\r\n\t/* Only in OpenGL 2.0 : Disabled for now.\r\n\tcase MIRRORED:\r\n\t\tmode = GL_MIRRORED_REPEAT;\r\n\t\tbreak;*/\r\n\tdefault:\r\n\tcase REPEAT:\r\n\t\tmode = GL_REPEAT;\r\n\t\tbreak;\r\n\t};\r\n\r\n\tthis->vMode = mode;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/Rendering/UTF8Parse.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __NVM_UTF8_CONV__\r\n#define __NVM_UTF8_CONV__\r\n\r\n// #include \"NVMtypes.h\"\r\n#include \"BaseType.h\"\r\n\r\n#define UTF8_ACCEPT 0\r\n#define UTF8_REJECT 1\r\n\r\nu32 toUtf16(const u8* src, u32 srcSizeByte, u16* dst, u32 dstSizeWord);\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Rendering/UTF8Parser.c",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>\r\n// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.\r\n// Further optimization commited by R.Piquois <laxer3a@hotmail.com>\r\n//\r\n#include \"UTF8Parse.h\"\r\n\r\n// 10x4 + 11x4 = 84 byte\r\nstatic const u32 utf8d[] = {\r\n\t/* Original compacted table ==> Need to reverse the BIT by quad.\r\n\t0x00000000,\t// 0\r\n\t0x11111111,\t// 1\r\n\t0x22222222,\t// 2\r\n\t0x33333433,\t// 3\t--> Special pattern.\r\n\t0x88222222,\t// 4\t--> Special pattern.\r\n\t0xA3333333,\t// 5\t--> Special pattern.\r\n\t0xB6665888,\t// 6\t--> Special pattern.\r\n\t0x77777777,\t// 7\r\n\t0x88888888,\t// 8\r\n\t0x99999999,\t// 9\r\n\t*/\r\n\t0x00000000,\t// 0\r\n\t0x11111111,\t// 1\r\n\t0x22222222,\t// 2\r\n\t0x33433333,\t// 3\t--> Special pattern.\r\n\t0x22222288,\t// 4\t--> Special pattern.\r\n\t0x3333333A,\t// 5\t--> Special pattern.\r\n\t0x8885666B,\t// 6\t--> Special pattern.\r\n\t0x77777777,\t// 7\r\n\t0x88888888,\t// 8\r\n\t0x99999999,\t// 9\r\n\r\n\t// State Table Compressed Entry.\r\n\t0x17853210,\t// IT0\r\n\t0x11116411,\t// IT1\r\n\t0x11111111,\t// IT2\r\n\t0x01111101,\t// IT3\r\n\t0x11111101,\t// IT4\r\n\t0x21111121,\t// IT5\r\n\t0x11111121,\t// IT6\r\n\t0x21111111,\t// IT7\r\n\t0x31111111,\t// IT8\r\n\t0x11111131,\t// IT9\r\n\t0x31111131,\t// ITA\r\n};             \r\n\r\n#define IT0\t(10)\r\n#define IT1\t(11)\r\n#define IT2\t(12)\r\n#define IT3\t(13)\r\n#define IT4\t(14)\r\n#define IT5\t(15)\r\n#define IT6\t(16)\r\n#define IT7\t(17)\r\n#define IT8\t(18)\r\n#define IT9\t(19)\r\n#define ITA\t(20)\r\n\r\n// Could compact this table in 16 bytes, but overhead of shift and decode is pretty pointless.\r\n// 32 Bytes.\r\nstatic const u8 code[] = {\r\n\t/*\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 00..1f\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 20..3f\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 40..5f\r\n\t0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 60..7f\r\n\t1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9, // 80..9f\r\n\t7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, // a0..bf\r\n\t8,8,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, // c0..df\r\n\tA,3,3,3,3,3,3,3, 3,3,3,3,3,4,3,3, // e0..ef\r\n\tB,6,6,6,5,8,8,8, 8,8,8,8,8,8,8,8, // f0..ff\r\n\t*/\r\n\t0,0,0,0, // 00..1f\r\n\t0,0,0,0, // 20..3f\r\n\t0,0,0,0, // 40..5f\r\n\t0,0,0,0, // 60..7f\r\n\t1,1,9,9, // 80..9f\r\n\t7,7,7,7, // A0..BF\r\n\t4,2,2,2, // C0..DF\r\n\t5,3,6,8, // E0..FF\r\n};\r\n\r\n// 18 Byte table.\r\nstatic const u8 code2[] = {\r\n/*\tOriginal, non reverse packed.\r\n\t0x01,0x23,0x58,0x71,0x11,0x46,0x11,0x11, // s0..s0\r\n\t0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,\r\n\t0x10,0x11,0x11,0x10,0x10,0x11,0x11,0x11, // s1..s2\r\n\t0x12,0x11,0x11,0x12,0x12,0x11,0x11,0x11,\r\n\t0x11,0x11,0x11,0x12,0x11,0x11,0x11,0x11, // s3..s4\r\n\t0x12,0x11,0x11,0x11,0x12,0x11,0x11,0x11,\r\n\t0x11,0x11,0x11,0x13,0x13,0x11,0x11,0x11, // s5..s6\r\n\t0x13,0x11,0x11,0x13,0x13,0x11,0x11,0x11,\r\n\t0x13,0x11,0x11,0x11,0x11,0x11,0x11,0x11,  // s7 ..s8\r\n\t*/\r\n\r\n\t/* Compressed Version Non Reverse\r\n\t0x01235871,0x11461111, // s0..s0\r\n\t0x11111111,0x11111111,\r\n\t0x10111110,0x10111111, // s1..s2\r\n\t0x12111112,0x12111111,\r\n\t0x11111112,0x11111111, // s3..s4\r\n\t0x12111111,0x12111111,\r\n\t0x11111113,0x13111111, // s5..s6\r\n\t0x13111113,0x13111111,\r\n\t0x13111111,0x11111111,  // s7 ..s8*/\r\n\r\n\tIT0,IT1, // s0..s0\r\n\tIT2,IT2,\r\n\tIT3,IT4, // s1..s2\r\n\tIT5,IT6,\r\n\tIT7,IT2, // s3..s4\r\n\tIT6,IT6,\r\n\tIT8,IT9, // s5..s6\r\n\tITA,IT9,\r\n\tIT9,IT2, // s7..s8\r\n};\r\n\r\nu32 decode(u32* state, u32* codep, u8 byte) {\r\n  u32 type = (utf8d[code[byte>>3]]>>((byte & 7)<<2)) & 0xF;\r\n\r\n  *codep = (*state != UTF8_ACCEPT) ?\r\n    (byte & 0x3fu) | (*codep << 6) :\r\n    (0xff >> type) & (byte);\r\n\r\n  byte = (u8)((*state)*16 + type);\r\n  *state = (utf8d[code2[byte>>3]]>>((byte & 7)<<2)) & 0xF;\r\n  return *state;\r\n}\r\n\r\nu32 toUtf16(const u8* src, u32 srcSizeBytes, u16* dst, u32 dstSizeWord) {\r\n\tconst u8* src_actual_end = src + srcSizeBytes;\r\n\tconst u8* s = src;\r\n\tu16* d = dst;\r\n\tu32 codepoint;\r\n\tu32 state = 0;\r\n\tu32 count = 0;\r\n\r\n\twhile (s < src_actual_end) {\r\n\t\tu32 dst_words_free = dstSizeWord - (d - dst);\r\n\t\tconst u8* src_current_end = s + dst_words_free;\r\n\r\n\t\tif (src_actual_end < src_current_end)\r\n\t\t\tsrc_current_end = src_actual_end;\r\n\r\n\t\tif (src_current_end <= s)\r\n\t\t\tgoto toosmall;\r\n\r\n\t\twhile (s < src_current_end) {\r\n\r\n\t\t\tif (decode(&state, &codepoint, *s++))\r\n\t\t\tcontinue;\r\n\r\n\t\t\tif (codepoint > 0xffff) {\r\n\t\t\t\t*d++ = (u16)(0xD7C0 + (codepoint >> 10));\r\n\t\t\t\t*d++ = (u16)(0xDC00 + (codepoint & 0x3FF));\r\n\t\t\t\tcount += 2;\r\n\t\t\t} else {\r\n\t\t\t\t*d++ = (u16)codepoint;\r\n\t\t\t\tcount += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\ntoosmall:\r\n  /*\r\n  if (state != UTF8_ACCEPT) {\r\n    ...\r\n  }\r\n\r\n  if ((dstWords - (d - dst)) == 0)\r\n    goto toosmall;\r\n\r\n  *d++ = 0;\r\n  ...\r\n\r\n  ...\r\n  */\r\n  return count;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Rendering/glWrapper.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"glWrapper.h\"\r\n#include \"assert_klb.h\"\r\n#include <stdio.h>\r\n\r\n// static bool gl_log = false;\r\n\r\nstatic GLenum lastError = 0;\r\nstatic void processError() {\r\n\tGLenum err = glGetError();\r\n\tif (err) {\r\n\t\tif (lastError == 0) {\r\n\t\t\tklb_assertAlways(\"OpenGLERRROR\");\r\n\t\t\tlastError = err;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nstatic GLenum getLastError() {\r\n\tGLenum err = lastError;\r\n\tlastError = 0;\r\n\treturn err;\r\n}\r\n\r\n#ifdef USE_DEBUG_WRAPPER\r\n\r\n//\r\n// Include only done in glWrapper.h when WRAPPER is NOT used.\r\n//\r\n#if defined(__APPLE__)\r\n    #ifdef OPENGL2\r\n    #import <OpenGLES/ES2/gl.h>\r\n    #import <OpenGLES/ES2/glext.h>\r\n    #else\r\n    #import <OpenGLES/ES1/gl.h>\r\n    #import <OpenGLES/ES1/glext.h>\r\n    #endif\r\n#else\r\n    #ifdef OPENGL2\r\n    #include \"GLES2/gl2.h\"\r\n\t#include \"GLES2/gl2ext.h\"\r\n    // The header file which is not in the Android environment.\r\n\t// #include \"GLES2/gl2extimg.h\"\r\n    #else\r\n    #include \"GLES/gl.h\"\r\n    #endif\r\n#endif\r\n\r\n\t\r\n#ifndef OPENGL2\r\n// Available only in Common profile\r\nvoid dglAlphaFunc  (GLenum func, GLclampf ref) \t\t\t\t\t\t\t\t\t\t\t\t\t{ glAlphaFunc (func, ref); processError(); };\r\nvoid dglClearColor  (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) \t\t\t\t{ glClearColor (red, green, blue, alpha); processError(); };\r\nvoid dglClearDepthf  (GLclampf depth) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClearDepthf (depth); processError(); };\r\nvoid dglClipPlanef  (GLenum plane, const GLfloat *equation) \t\t\t\t\t\t\t\t\t{ glClipPlanef (plane, equation); processError(); };\r\nvoid dglColor4f  (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) \t\t\t\t\t\t{ glColor4f (red, green, blue, alpha); processError(); };\r\nvoid dglDepthRangef  (GLclampf zNear, GLclampf zFar) \t\t\t\t\t\t\t\t\t\t\t{ glDepthRangef (zNear, zFar); processError(); };\r\nvoid dglFogf  (GLenum pname, GLfloat param) \t\t\t\t\t\t\t\t\t\t\t\t\t{ glFogf (pname, param); processError(); };\r\nvoid dglFogfv  (GLenum pname, const GLfloat *params) \t\t\t\t\t\t\t\t\t\t\t{ glFogfv (pname, params); processError(); };\r\nvoid dglFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFrustumf(left,right,bottom,top,zNear,zFar); processError(); } \r\nvoid dglGetClipPlanef (GLenum pname, GLfloat eqn[4])\t\t\t\t\t\t\t\t\t\t\t{ glGetClipPlanef(pname,eqn); processError(); } \r\nvoid dglGetFloatv  (GLenum pname, GLfloat *params) \t\t\t\t\t\t\t\t\t\t\t\t{ glGetFloatv (pname, params); processError(); };\r\nvoid dglGetLightfv  (GLenum light, GLenum pname, GLfloat *params) \t\t\t\t\t\t\t\t{ glGetLightfv (light, pname, params); processError(); };\r\nvoid dglGetMaterialfv  (GLenum face, GLenum pname, GLfloat *params) \t\t\t\t\t\t\t{ glGetMaterialfv (face, pname, params); processError(); };\r\nvoid dglGetTexEnvfv  (GLenum env, GLenum pname, GLfloat *params) \t\t\t\t\t\t\t\t{ glGetTexEnvfv (env, pname, params); processError(); };\r\nvoid dglGetTexParameterfv  (GLenum target, GLenum pname, GLfloat *params) \t\t\t\t\t\t{ glGetTexParameterfv (target, pname, params); processError(); };\r\nvoid dglLightModelf  (GLenum pname, GLfloat param) \t\t\t\t\t\t\t\t\t\t\t\t{ glLightModelf (pname, param); processError(); };\r\nvoid dglLightModelfv  (GLenum pname, const GLfloat *params) \t\t\t\t\t\t\t\t\t{ glLightModelfv (pname, params); processError(); };\r\nvoid dglLightf  (GLenum light, GLenum pname, GLfloat param) \t\t\t\t\t\t\t\t\t{ glLightf (light, pname, param); processError(); };\r\nvoid dglLightfv  (GLenum light, GLenum pname, const GLfloat *params) \t\t\t\t\t\t\t{ glLightfv (light, pname, params); processError(); };\r\nvoid dglLineWidth  (GLfloat width) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLineWidth (width); processError(); };\r\nvoid dglLoadMatrixf  (const GLfloat *m) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLoadMatrixf (m); processError(); };\r\nvoid dglMaterialf  (GLenum face, GLenum pname, GLfloat param) \t\t\t\t\t\t\t\t\t{ glMaterialf (face, pname, param); processError(); };\r\nvoid dglMaterialfv  (GLenum face, GLenum pname, const GLfloat *params) \t\t\t\t\t\t\t{ glMaterialfv (face, pname, params); processError(); };\r\nvoid dglMultMatrixf  (const GLfloat *m) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glMultMatrixf (m); processError(); };\r\nvoid dglMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)\t\t\t\t{ glMultiTexCoord4f(target,s,t,r,q); processError(); }\r\nvoid dglNormal3f  (GLfloat nx, GLfloat ny, GLfloat nz) \t\t\t\t\t\t\t\t\t\t\t{ glNormal3f (nx, ny, nz); processError(); };\r\nvoid dglOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glOrthof(left,right,bottom,top,zNear,zFar); processError(); }\r\nvoid dglPointParameterf  (GLenum pname, GLfloat param) \t\t\t\t\t\t\t\t\t\t\t{ glPointParameterf (pname, param); processError(); };\r\nvoid dglPointParameterfv  (GLenum pname, const GLfloat *params) \t\t\t\t\t\t\t\t{ glPointParameterfv (pname, params); processError(); };\r\nvoid dglPointSize  (GLfloat size) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glPointSize (size); processError(); };\r\nvoid dglPolygonOffset  (GLfloat factor, GLfloat units) \t\t\t\t\t\t\t\t\t\t\t{ glPolygonOffset (factor, units); processError(); };\r\nvoid dglRotatef  (GLfloat angle, GLfloat x, GLfloat y, GLfloat z) \t\t\t\t\t\t\t\t{ glRotatef (angle, x, y, z); processError(); };\r\nvoid dglScalef  (GLfloat x, GLfloat y, GLfloat z) \t\t\t\t\t\t\t\t\t\t\t\t{ glScalef (x, y, z); processError(); };\r\nvoid dglTexEnvf  (GLenum target, GLenum pname, GLfloat param) \t\t\t\t\t\t\t\t\t{ glTexEnvf (target, pname, param); processError(); };\r\nvoid dglTexEnvfv  (GLenum target, GLenum pname, const GLfloat *params) \t\t\t\t\t\t\t{ glTexEnvfv (target, pname, params); processError(); };\r\nvoid dglTexParameterf  (GLenum target, GLenum pname, GLfloat param) \t\t\t\t\t\t\t{ glTexParameterf (target, pname, param); processError(); };\r\nvoid dglTexParameterfv  (GLenum target, GLenum pname, const GLfloat *params) \t\t\t\t\t{ glTexParameterfv (target, pname, params); processError(); };\r\nvoid dglTranslatef  (GLfloat x, GLfloat y, GLfloat z) \t\t\t\t\t\t\t\t\t\t\t{ glTranslatef (x, y, z); processError(); };\r\n\r\n// Available in both Common and Common-Lite profiles\r\nvoid dglActiveTexture  (GLenum texture) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ \r\n\tif (gl_log) { printf(\"glActivateTexture(GL_TEXTURE%i);\\n\",texture - GL_TEXTURE0); }\r\n\tglActiveTexture (texture); processError(); \r\n};\r\nvoid dglAlphaFuncx  (GLenum func, GLclampx ref) \t\t\t\t\t\t\t\t\t\t\t\t{ glAlphaFuncx (func, ref); processError(); };\r\nvoid dglBindBuffer  (GLenum target, GLuint buffer) \t\t\t\t\t\t\t\t\t\t\t\t{ glBindBuffer (target, buffer); processError(); };\r\nvoid dglBindTexture  (GLenum target, GLuint texture) \t\t\t\t\t\t\t\t\t\t\t{\r\n\tif (gl_log) { printf(\"glBindTexture(GL_TEXTURE_2D, %i);\\n\",texture); }\r\n\tglBindTexture (target, texture); processError();\r\n};\r\nvoid dglBlendFunc  (GLenum sfactor, GLenum dfactor) \t\t\t\t\t\t\t\t\t\t\t{ glBlendFunc (sfactor, dfactor); processError(); };\r\nvoid dglBufferData  (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) \t\t\t{ glBufferData (target, size, data, usage); processError(); };\r\nvoid dglBufferSubData  (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) \t{ glBufferSubData (target, offset, size, data); processError(); };\r\nvoid dglClear  (GLbitfield mask) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClear (mask); processError(); };\r\nvoid dglClearColorx  (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) \t\t\t\t{ glClearColorx (red, green, blue, alpha); processError(); };\r\nvoid dglClearDepthx  (GLclampx depth) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClearDepthx (depth); processError(); };\r\nvoid dglClearStencil  (GLint s) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClearStencil (s); processError(); };\r\nvoid dglClientActiveTexture  (GLenum texture) \t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\tif (gl_log) { printf(\"glClientActivateTexture(GL_TEXTURE%i);\\n\",texture - GL_TEXTURE0); }\r\n\tglClientActiveTexture (texture); processError(); \r\n};\r\nvoid dglClipPlanex  (GLenum plane, const GLfixed *equation) \t\t\t\t\t\t\t\t\t{ glClipPlanex (plane, equation); processError(); };\r\nvoid dglColor4ub  (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) \t\t\t\t\t{ glColor4ub (red, green, blue, alpha); processError(); };\r\nvoid dglColor4x  (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) \t\t\t\t\t\t{ glColor4x (red, green, blue, alpha); processError(); };\r\nvoid dglColorMask  (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) \t\t\t{ glColorMask (red, green, blue, alpha); processError(); };\r\nvoid dglColorPointer  (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) \t\t\t{ glColorPointer (size, type, stride, pointer); processError(); };\r\n\r\nvoid dglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) \r\n\t{ glCompressedTexImage2D (target, level, internalformat, width, height, border, imageSize, data); processError(); }\r\n\r\nvoid dglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)\r\n\t{ glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, imageSize, data); processError(); }\r\n\r\nvoid dglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)\r\n\t{ glCopyTexImage2D (target, level, internalformat, x, y, width, height, border); processError(); }\r\n\r\nvoid dglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)\r\n\t{ glCopyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, height); processError(); }\r\n\r\nconst char* getStringCap(GLenum cap) {\r\n\tswitch (cap) {\r\n\t\tcase GL_ALPHA_TEST\t\t\t\t\t: return \"GL_ALPHA_TEST\";\r\n\t\tcase GL_BLEND\t\t\t\t\t\t: return \"GL_BLEND\";\r\n\t\tcase GL_COLOR_LOGIC_OP\t\t\t\t: return \"GL_COLOR_LOGIC_OP\";\r\n\t\tcase GL_CLIP_PLANE0\t\t\t\t\t: return \"GL_CLIP_PLANE0\";\r\n\t\tcase GL_CLIP_PLANE1\t\t\t\t\t: return \"GL_CLIP_PLANE1\";\r\n\t\tcase GL_CLIP_PLANE2\t\t\t\t\t: return \"GL_CLIP_PLANE2\";\r\n\t\tcase GL_CLIP_PLANE3\t\t\t\t\t: return \"GL_CLIP_PLANE3\";\r\n\t\tcase GL_CLIP_PLANE4\t\t\t\t\t: return \"GL_CLIP_PLANE4\";\r\n\t\tcase GL_CLIP_PLANE5\t\t\t\t\t: return \"GL_CLIP_PLANE5\";\r\n\t\tcase GL_COLOR_MATERIAL\t\t\t\t: return \"GL_COLOR_MATERIAL\";\r\n\t\tcase GL_CULL_FACE\t\t\t\t\t: return \"GL_CULL_FACE\";\r\n\t\tcase GL_DEPTH_TEST\t\t\t\t\t: return \"GL_DEPTH_TEST\";\r\n\t\tcase GL_DITHER\t\t\t\t\t\t: return \"GL_DITHER\";\r\n\t\tcase GL_FOG\t\t\t\t\t\t\t: return \"GL_FOG\";\r\n\t\tcase GL_LIGHT0\t\t\t\t\t\t: return \"GL_LIGHT0\";\r\n\t\tcase GL_LIGHTING\t\t\t\t\t: return \"GL_LIGHTING\";\r\n\t\tcase GL_LINE_SMOOTH\t\t\t\t\t: return \"GL_LINE_SMOOTH\";\r\n\t\tcase GL_MULTISAMPLE\t\t\t\t\t: return \"GL_MULTISAMPLE\";\r\n\t\tcase GL_NORMALIZE\t\t\t\t\t: return \"GL_NORMALIZE\";\r\n\t\tcase GL_POINT_SMOOTH\t\t\t\t: return \"GL_POINT_SMOOTH\";\r\n\t\tcase GL_POINT_SPRITE_OES\t\t\t: return \"GL_POINT_SPRITE_OES\";\r\n\t\tcase GL_POLYGON_OFFSET_FILL\t\t\t: return \"GL_POLYGON_OFFSET_FILL\";\r\n\t\tcase GL_RESCALE_NORMAL\t\t\t\t: return \"GL_RESCALE_NORMAL\";\r\n\t\tcase GL_SAMPLE_ALPHA_TO_COVERAGE\t: return \"GL_SAMPLE_ALPHA_TO_COVERAGE\";\r\n\t\tcase GL_SAMPLE_ALPHA_TO_ONE\t\t\t: return \"GL_SAMPLE_ALPHA_TO_ONE\";\r\n\t\tcase GL_SAMPLE_COVERAGE\t\t\t\t: return \"GL_SAMPLE_COVERAGE\";\r\n\t\tcase GL_SCISSOR_TEST\t\t\t\t: return \"GL_SCISSOR_TEST\";\r\n\t\tcase GL_STENCIL_TEST\t\t\t\t: return \"GL_STENCIL_TEST\";\r\n\t\tcase GL_TEXTURE_2D\t\t\t\t\t: \r\n\t\t\treturn \"GL_TEXTURE_2D\";\r\n\t\tdefault: \r\n\t\t\treturn \"Unknown\";\r\n\t}\r\n}\r\n\r\nconst char* getStringClientState(GLenum array_) {\r\n\tswitch (array_) {\r\n\tcase GL_COLOR_ARRAY\t\t\t\t: \r\n\t\treturn \"GL_COLOR_ARRAY\";\t\t\r\n\tcase GL_NORMAL_ARRAY\t\t\t: \r\n\t\treturn \"GL_NORMAL_ARRAY\";\r\n\tcase GL_POINT_SIZE_ARRAY_OES\t: \r\n\t\treturn \"GL_POINT_SIZE_ARRAY_OES\";\r\n\tcase GL_TEXTURE_COORD_ARRAY\t\t: \r\n\t\treturn \"GL_TEXTURE_COORD_ARRAY\";\r\n\tcase GL_VERTEX_ARRAY\t\t\t: \r\n\t\treturn \"GL_VERTEX_ARRAY\";\r\n\tdefault:\r\n\t\treturn \"Unknown\";\r\n\t}\r\n}\r\n\r\nvoid dglCullFace  (GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glCullFace (mode); processError(); };\r\nvoid dglDeleteBuffers  (GLsizei n, const GLuint *buffers) \t\t\t\t\t\t\t\t\t\t{ glDeleteBuffers (n, buffers); processError(); };\r\nvoid dglDeleteTextures  (GLsizei n, const GLuint *textures) \t\t\t\t\t\t\t\t\t{ glDeleteTextures (n, textures); processError(); };\r\nvoid dglDepthFunc  (GLenum func) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDepthFunc (func); processError(); };\r\nvoid dglDepthMask  (GLboolean flag) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDepthMask (flag); processError(); };\r\nvoid dglDepthRangex  (GLclampx zNear, GLclampx zFar) \t\t\t\t\t\t\t\t\t\t\t{ glDepthRangex (zNear, zFar); processError(); };\r\nvoid dglDisable  (GLenum cap) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ \r\n\tif (gl_log) { printf(\"glDisable(%s);\\n\",getStringCap(cap)); }\r\n\tglDisable (cap); processError(); \r\n};\r\nvoid dglDisableClientState  (GLenum array_)\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\tif (gl_log) { printf(\"glDisableClientState(%s);\\n\",getStringClientState(array_)); }\t\r\n\tglDisableClientState (array_); processError(); \r\n};\r\nvoid dglDrawArrays  (GLenum mode, GLint first, GLsizei count) \t\t\t\t\t\t\t\t\t{ glDrawArrays (mode, first, count); processError(); };\r\nvoid dglDrawElements  (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) \t\t\t{ glDrawElements (mode, count, type, indices); processError(); };\r\nvoid dglEnable  (GLenum cap) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ \r\n\tif (gl_log) { printf(\"glEnable(%s);\\n\",getStringCap(cap)); }\r\n\tglEnable (cap); processError(); \r\n};\r\nvoid dglEnableClientState  (GLenum array_) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ \r\n\tif (gl_log) { printf(\"glEnableClientState(%s);\\n\",getStringClientState(array_)); }\t\r\n\tglEnableClientState (array_); processError(); \r\n};\r\nvoid dglFinish (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFinish(); processError(); };\r\nvoid dglFlush (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFlush(); processError(); };\r\nvoid dglFogx  (GLenum pname, GLfixed param) \t\t\t\t\t\t\t\t\t\t\t\t\t{ glFogx (pname, param); processError(); };\r\nvoid dglFogxv  (GLenum pname, const GLfixed *params) \t\t\t\t\t\t\t\t\t\t\t{ glFogxv (pname, params); processError(); };\r\nvoid dglFrontFace  (GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFrontFace (mode); processError(); };\r\nvoid dglFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)\r\n\t{ glFrustumx (left, right, bottom, top, zNear, zFar); processError(); }\r\nvoid dglGetBooleanv  (GLenum pname, GLboolean *params) \t\t\t\t\t\t\t\t\t\t\t{ glGetBooleanv (pname, params); processError(); };\r\nvoid dglGetBufferParameteriv  (GLenum target, GLenum pname, GLint *params) \t\t\t\t\t\t{ glGetBufferParameteriv (target, pname, params); processError(); };\r\nvoid dglGetClipPlanex (GLenum pname, GLfixed eqn[4])\r\n\t{ glGetClipPlanex (pname, eqn); processError(); }\r\nvoid dglGenBuffers  (GLsizei n, GLuint *buffers) \t\t\t\t\t\t\t\t\t\t\t\t{ glGenBuffers (n, buffers); processError(); };\r\nvoid dglGenTextures  (GLsizei n, GLuint *textures) \t\t\t\t\t\t\t\t\t\t\t\t{ glGenTextures (n, textures); processError(); };\r\nGLenum dglGetError (void)\t{ processError(); return getLastError(); }\r\nvoid dglGetFixedv  (GLenum pname, GLfixed *params) \t\t\t\t\t\t\t\t\t\t\t\t{ glGetFixedv (pname, params); processError(); };\r\nvoid dglGetIntegerv  (GLenum pname, GLint *params) \t\t\t\t\t\t\t\t\t\t\t\t{ glGetIntegerv (pname, params); processError(); };\r\nvoid dglGetLightxv  (GLenum light, GLenum pname, GLfixed *params) \t\t\t\t\t\t\t\t{ glGetLightxv (light, pname, params); processError(); };\r\nvoid dglGetMaterialxv  (GLenum face, GLenum pname, GLfixed *params) \t\t\t\t\t\t\t{ glGetMaterialxv (face, pname, params); processError(); };\r\nvoid dglGetPointerv  (GLenum pname, void **params) \t\t\t\t\t\t\t\t\t\t\t\t{ glGetPointerv (pname, params); processError(); };\r\nconst GLubyte * dglGetString  (GLenum name) \t\t\t\t\t\t\t\t\t\t\t\t\t{ const GLubyte* res = glGetString (name); processError(); return res; };\r\nvoid dglGetTexEnviv  (GLenum env, GLenum pname, GLint *params) \t\t\t\t\t\t\t\t\t{ glGetTexEnviv (env, pname, params); processError(); };\r\nvoid dglGetTexEnvxv  (GLenum env, GLenum pname, GLfixed *params) \t\t\t\t\t\t\t\t{ glGetTexEnvxv (env, pname, params); processError(); };\r\nvoid dglGetTexParameteriv  (GLenum target, GLenum pname, GLint *params) \t\t\t\t\t\t{ glGetTexParameteriv (target, pname, params); processError(); };\r\nvoid dglGetTexParameterxv  (GLenum target, GLenum pname, GLfixed *params) \t\t\t\t\t\t{ glGetTexParameterxv (target, pname, params); processError(); };\r\nvoid dglHint  (GLenum target, GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glHint (target, mode); processError(); };\r\nGLboolean dglIsBuffer  (GLuint buffer) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsBuffer (buffer); processError(); return res; };\r\nGLboolean dglIsEnabled  (GLenum cap) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsEnabled (cap); processError(); return res; };\r\nGLboolean dglIsTexture  (GLuint texture) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsTexture (texture); processError(); return res; };\r\nvoid dglLightModelx  (GLenum pname, GLfixed param) \t\t\t\t\t\t\t\t\t\t\t\t{ glLightModelx (pname, param); processError(); };\r\nvoid dglLightModelxv  (GLenum pname, const GLfixed *params) \t\t\t\t\t\t\t\t\t{ glLightModelxv (pname, params); processError(); };\r\nvoid dglLightx  (GLenum light, GLenum pname, GLfixed param) \t\t\t\t\t\t\t\t\t{ glLightx (light, pname, param); processError(); };\r\nvoid dglLightxv  (GLenum light, GLenum pname, const GLfixed *params) \t\t\t\t\t\t\t{ glLightxv (light, pname, params); processError(); };\r\nvoid dglLineWidthx  (GLfixed width) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLineWidthx (width); processError(); };\r\nvoid dglLoadIdentity (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLoadIdentity(); processError(); };\r\nvoid dglLoadMatrixx  (const GLfixed *m) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLoadMatrixx (m); processError(); };\r\nvoid dglLogicOp  (GLenum opcode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLogicOp (opcode); processError(); };\r\nvoid dglMaterialx  (GLenum face, GLenum pname, GLfixed param) \t\t\t\t\t\t\t\t\t{ glMaterialx (face, pname, param); processError(); };\r\nvoid dglMaterialxv  (GLenum face, GLenum pname, const GLfixed *params) \t\t\t\t\t\t\t{ glMaterialxv (face, pname, params); processError(); };\r\nvoid dglMatrixMode  (GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glMatrixMode (mode); processError(); };\r\nvoid dglMultMatrixx  (const GLfixed *m) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glMultMatrixx (m); processError(); };\r\nvoid dglMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)\t\t\t\t{ glMultiTexCoord4x (target, s, t, r, q); processError(); };\r\nvoid dglNormal3x  (GLfixed nx, GLfixed ny, GLfixed nz) \t\t\t\t\t\t\t\t\t\t\t{ glNormal3x (nx, ny, nz); processError(); };\r\nvoid dglNormalPointer  (GLenum type, GLsizei stride, const GLvoid *pointer) \t\t\t\t\t{ glNormalPointer (type, stride, pointer); processError(); };\r\nvoid dglOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glOrthox (left, right, bottom, top, zNear, zFar); processError(); };\r\nvoid dglPixelStorei  (GLenum pname, GLint param) \t\t\t\t\t\t\t\t\t\t\t\t{ glPixelStorei (pname, param); processError(); };\r\nvoid dglPointParameterx  (GLenum pname, GLfixed param) \t\t\t\t\t\t\t\t\t\t\t{ glPointParameterx (pname, param); processError(); };\r\nvoid dglPointParameterxv  (GLenum pname, const GLfixed *params) \t\t\t\t\t\t\t\t{ glPointParameterxv (pname, params); processError(); };\r\nvoid dglPointSizex  (GLfixed size) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glPointSizex (size); processError(); };\r\nvoid dglPolygonOffsetx  (GLfixed factor, GLfixed units) \t\t\t\t\t\t\t\t\t\t{ glPolygonOffsetx (factor, units); processError(); };\r\nvoid dglPopMatrix (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glPopMatrix(); processError(); }\r\nvoid dglPushMatrix (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glPushMatrix(); processError(); }\r\nvoid dglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)\r\n\t{ glReadPixels (x, y, width, height, format, type, pixels); processError(); }\r\nvoid dglRotatex  (GLfixed angle, GLfixed x, GLfixed y, GLfixed z) \t\t\t\t\t\t\t\t{ glRotatex (angle, x, y, z); processError(); };\r\nvoid dglSampleCoverage  (GLclampf value, GLboolean invert) \t\t\t\t\t\t\t\t\t\t{ glSampleCoverage (value, invert); processError(); };\r\nvoid dglSampleCoveragex  (GLclampx value, GLboolean invert) \t\t\t\t\t\t\t\t\t{ glSampleCoveragex (value, invert); processError(); };\r\nvoid dglScalex  (GLfixed x, GLfixed y, GLfixed z) \t\t\t\t\t\t\t\t\t\t\t\t{ glScalex (x, y, z); processError(); };\r\nvoid dglScissor  (GLint x, GLint y, GLsizei width, GLsizei height) \t\t\t\t\t\t\t\t{ glScissor (x, y, width, height); processError(); };\r\nvoid dglShadeModel  (GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glShadeModel (mode); processError(); };\r\nvoid dglStencilFunc  (GLenum func, GLint ref, GLuint mask) \t\t\t\t\t\t\t\t\t\t{ glStencilFunc (func, ref, mask); processError(); };\r\nvoid dglStencilMask  (GLuint mask) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glStencilMask (mask); processError(); };\r\nvoid dglStencilOp  (GLenum fail, GLenum zfail, GLenum zpass) \t\t\t\t\t\t\t\t\t{ glStencilOp (fail, zfail, zpass); processError(); };\r\nvoid dglTexCoordPointer  (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) \t\t{\r\n\tif (gl_log) { printf(\"glTexCoordPointer(...);\\n\"); }\t\r\n\tglTexCoordPointer (size, type, stride, pointer); processError(); \r\n};\r\nvoid dglTexEnvi  (GLenum target, GLenum pname, GLint param) \t\t\t\t\t\t\t\t\t{ glTexEnvi (target, pname, param); processError(); };\r\nvoid dglTexEnvx  (GLenum target, GLenum pname, GLfixed param) \t\t\t\t\t\t\t\t\t{ glTexEnvx (target, pname, param); processError(); };\r\nvoid dglTexEnviv  (GLenum target, GLenum pname, const GLint *params) \t\t\t\t\t\t\t{ glTexEnviv (target, pname, params); processError(); };\r\nvoid dglTexEnvxv  (GLenum target, GLenum pname, const GLfixed *params) \t\t\t\t\t\t\t{ glTexEnvxv (target, pname, params); processError(); };\r\nvoid dglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)\r\n\t{ glTexImage2D (target, level, internalformat, width, height, border, format, type, pixels); processError(); }\r\nvoid dglTexParameteri  (GLenum target, GLenum pname, GLint param) \t\t\t\t\t\t\t\t{ glTexParameteri (target, pname, param); processError(); };\r\nvoid dglTexParameterx  (GLenum target, GLenum pname, GLfixed param) \t\t\t\t\t\t\t{ glTexParameterx (target, pname, param); processError(); };\r\nvoid dglTexParameteriv  (GLenum target, GLenum pname, const GLint *params) \t\t\t\t\t\t{ glTexParameteriv (target, pname, params); processError(); };\r\nvoid dglTexParameterxv  (GLenum target, GLenum pname, const GLfixed *params) \t\t\t\t\t{ glTexParameterxv (target, pname, params); processError(); };\r\nvoid dglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)\r\n\t{ glTexSubImage2D (target, level, xoffset, yoffset, width, height, format, type, pixels); processError(); }\r\nvoid dglTranslatex  (GLfixed x, GLfixed y, GLfixed z) \t\t\t\t\t\t\t\t\t\t\t{ glTranslatex (x, y, z); processError(); };\r\nvoid dglVertexPointer  (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) \t\t{ glVertexPointer (size, type, stride, pointer); processError(); };\r\nvoid dglViewport  (GLint x, GLint y, GLsizei width, GLsizei height) \t\t\t\t\t\t\t{ glViewport (x, y, width, height); processError(); };\r\n#else\r\nvoid dglActiveTexture  (GLenum texture) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glActiveTexture (texture); processError(); };\r\nvoid dglAttachShader  (GLuint program, GLuint shader) \t\t\t\t\t\t\t\t\t\t\t{ glAttachShader (program, shader); processError(); };\r\nvoid dglBindAttribLocation  (GLuint program, GLuint index, const GLchar* name) \t\t\t\t\t{ glBindAttribLocation (program, index, name); processError(); };\r\nvoid dglBindBuffer  (GLenum target, GLuint buffer) \t\t\t\t\t\t\t\t\t\t\t\t{ glBindBuffer (target, buffer); processError(); };\r\nvoid dglBindFramebuffer  (GLenum target, GLuint framebuffer) \t\t\t\t\t\t\t\t\t{ glBindFramebuffer (target, framebuffer); processError(); };\r\nvoid dglBindRenderbuffer  (GLenum target, GLuint renderbuffer) \t\t\t\t\t\t\t\t\t{ glBindRenderbuffer (target, renderbuffer); processError(); };\r\nvoid dglBindTexture  (GLenum target, GLuint texture) \t\t\t\t\t\t\t\t\t\t\t{ glBindTexture (target, texture); processError(); };\r\nvoid dglBlendColor  (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) \t\t\t\t{ glBlendColor (red, green, blue, alpha); processError(); };\r\nvoid dglBlendEquation  ( GLenum mode ) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glBlendEquation (); processError(); };\r\nvoid dglBlendEquationSeparate  (GLenum modeRGB, GLenum modeAlpha) \t\t\t\t\t\t\t\t{ glBlendEquationSeparate (modeRGB, modeAlpha); processError(); };\r\nvoid dglBlendFunc  (GLenum sfactor, GLenum dfactor) \t\t\t\t\t\t\t\t\t\t\t{ glBlendFunc (sfactor, dfactor); processError(); };\r\nvoid dglBlendFuncSeparate  (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) \t{ glBlendFuncSeparate (srcRGB, dstRGB, srcAlpha, dstAlpha); processError(); };\r\nvoid dglBufferData  (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) \t\t\t{ glBufferData (target, size, data, usage); processError(); };\r\nvoid dglBufferSubData  (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) \t{ glBufferSubData (target, offset, size, data); processError(); };\r\nGLenum dglCheckFramebufferStatus  (GLenum target) \t\t\t\t\t\t\t\t\t\t\t\t{ GLenum res = glCheckFramebufferStatus (target); processError(); return res; };\r\nvoid dglClear  (GLbitfield mask) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClear (mask); processError(); };\r\nvoid dglClearColor  (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) \t\t\t\t{ glClearColor (red, green, blue, alpha); processError(); };\r\nvoid dglClearDepthf  (GLclampf depth) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClearDepthf (depth); processError(); };\r\nvoid dglClearStencil  (GLint s) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glClearStencil (s); processError(); };\r\nvoid dglColorMask  (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) \t\t\t{ glColorMask (red, green, blue, alpha); processError(); };\r\nvoid dglCompileShader  (GLuint shader) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glCompileShader (shader); processError(); };\r\nvoid dglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);\r\n\t{ glCompressedTexImage2D (target, level, internalformat, width, height, border, imageSize, data); processError(); }\r\nvoid dglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);\r\n\t{ glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, imageSize, data); processError(); }\r\nvoid dglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\n\t{ glCopyTexImage2D (target,level,internalformat,x,y,width,height,border);  processError(); }\r\nvoid dglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\t{ glCopyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, height); processError(); }\r\nGLuint dglCreateProgram (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLuint res = glCreateProgram(); processError(); return res; } \r\nGLuint dglCreateShader  (GLenum type) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLuint res = glCreateShader (type); processError(); return res; };\r\nvoid dglCullFace  (GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glCullFace (mode); processError(); };\r\nvoid dglDeleteBuffers  (GLsizei n, const GLuint* buffers) \t\t\t\t\t\t\t\t\t\t{ glDeleteBuffers (n, buffers); processError(); };\r\nvoid dglDeleteFramebuffers  (GLsizei n, const GLuint* framebuffers) \t\t\t\t\t\t\t{ glDeleteFramebuffers (n, framebuffers); processError(); };\r\nvoid dglDeleteProgram  (GLuint program) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDeleteProgram (program); processError(); };\r\nvoid dglDeleteRenderbuffers  (GLsizei n, const GLuint* renderbuffers) \t\t\t\t\t\t\t{ glDeleteRenderbuffers (n, renderbuffers); processError(); };\r\nvoid dglDeleteShader  (GLuint shader) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDeleteShader (shader); processError(); };\r\nvoid dglDeleteTextures  (GLsizei n, const GLuint* textures) \t\t\t\t\t\t\t\t\t{ glDeleteTextures (n, textures); processError(); };\r\nvoid dglDepthFunc  (GLenum func) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDepthFunc (func); processError(); };\r\nvoid dglDepthMask  (GLboolean flag) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDepthMask (flag); processError(); };\r\nvoid dglDepthRangef  (GLclampf zNear, GLclampf zFar) \t\t\t\t\t\t\t\t\t\t\t{ glDepthRangef (zNear, zFar); processError(); };\r\nvoid dglDetachShader  (GLuint program, GLuint shader) \t\t\t\t\t\t\t\t\t\t\t{ glDetachShader (program, shader); processError(); };\r\nvoid dglDisable  (GLenum cap) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glDisable (cap); processError(); };\r\nvoid dglDisableVertexAttribArray  (GLuint index) \t\t\t\t\t\t\t\t\t\t\t\t{ glDisableVertexAttribArray (index); processError(); };\r\nvoid dglDrawArrays  (GLenum mode, GLint first, GLsizei count) \t\t\t\t\t\t\t\t\t{ glDrawArrays (mode, first, count); processError(); };\r\nvoid dglDrawElements  (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) \t\t\t{ glDrawElements (mode, count, type, indices); processError(); };\r\nvoid dglEnable  (GLenum cap) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glEnable (cap); processError(); };\r\nvoid dglEnableVertexAttribArray  (GLuint index) \t\t\t\t\t\t\t\t\t\t\t\t{ glEnableVertexAttribArray (index); processError(); };\r\nvoid dglFinish (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFinish(); processError(); }\r\nvoid dglFlush (void)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFlush(); processError(); }\r\nvoid dglFramebufferRenderbuffer  (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFramebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer); processError(); };\r\nvoid glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\nvoid dglFrontFace  (GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glFrontFace (mode); processError(); };\r\nvoid dglGenBuffers  (GLsizei n, GLuint* buffers) \t\t\t\t\t\t\t\t\t\t\t\t{ glGenBuffers (n, buffers); processError(); };\r\nvoid dglGenerateMipmap  (GLenum target) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glGenerateMipmap (target); processError(); };\r\nvoid dglGenFramebuffers  (GLsizei n, GLuint* framebuffers) \t\t\t\t\t\t\t\t\t\t{ glGenFramebuffers (n, framebuffers); processError(); };\r\nvoid dglGenRenderbuffers  (GLsizei n, GLuint* renderbuffers) \t\t\t\t\t\t\t\t\t{ glGenRenderbuffers (n, renderbuffers); processError(); };\r\nvoid dglGenTextures  (GLsizei n, GLuint* textures) \t\t\t\t\t\t\t\t\t\t\t\t{ glGenTextures (n, textures); processError(); };\r\nvoid dglGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\n\t{ glGetActiveAttrib (program, index, bufsize, length, size, type, name); processError(); }\r\n\r\nvoid glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\n\t{ glGetActiveUniform (program, index, bufsize, length, size, type, name); processError(); }\r\n\r\nvoid dglGetAttachedShaders  (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { glGetAttachedShaders (program, maxcount, count, shaders); processError(); };\r\nint  dglGetAttribLocation  (GLuint program, const GLchar* name) \t\t\t\t\t\t\t\t{ int res = glGetAttribLocation (program, name); processError(); return res; };\r\nvoid dglGetBooleanv  (GLenum pname, GLboolean* params) \t\t\t\t\t\t\t\t\t\t\t{ glGetBooleanv (pname, params); processError(); };\r\nvoid dglGetBufferParameteriv  (GLenum target, GLenum pname, GLint* params) \t\t\t\t\t\t{ glGetBufferParameteriv (target, pname, params); processError(); };\r\nGLenum dglGetError (void)\t{ processError(); return getLastError(); }\r\nvoid dglGetFloatv  (GLenum pname, GLfloat* params) \t\t\t\t\t\t\t\t\t\t\t\t{ glGetFloatv (pname, params); processError(); };\r\nvoid dglGetFramebufferAttachmentParameteriv  (GLenum target, GLenum attachment, GLenum pname, GLint* params) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glGetFramebufferAttachmentParameteriv (target, attachment, pname, params); processError(); };\r\nvoid dglGetIntegerv  (GLenum pname, GLint* params) \t\t\t\t\t\t\t\t\t\t\t\t{ glGetIntegerv (pname, params); processError(); };\r\nvoid dglGetProgramiv  (GLuint program, GLenum pname, GLint* params) \t\t\t\t\t\t\t{ glGetProgramiv (program, pname, params); processError(); };\r\nvoid dglGetProgramInfoLog  (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) { glGetProgramInfoLog (program, bufsize, length, infolog); processError(); };\r\nvoid dglGetRenderbufferParameteriv  (GLenum target, GLenum pname, GLint* params) \t\t\t\t{ glGetRenderbufferParameteriv (target, pname, params); processError(); };\r\nvoid dglGetShaderiv  (GLuint shader, GLenum pname, GLint* params) \t\t\t\t\t\t\t\t{ glGetShaderiv (shader, pname, params); processError(); };\r\nvoid dglGetShaderInfoLog  (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) \t{ glGetShaderInfoLog (shader, bufsize, length, infolog); processError(); };\r\nvoid dglGetShaderPrecisionFormat  (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glGetShaderPrecisionFormat (shadertype, precisiontype, range, precision); processError(); };\r\nvoid dglGetShaderSource  (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)\t\t{ glGetShaderSource (shader, bufsize, length, source); processError(); };\r\nconst GLubyte* dglGetString  (GLenum name) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ const GLubyte* res = glGetString (name); processError(); return res; };\r\nvoid dglGetTexParameterfv  (GLenum target, GLenum pname, GLfloat* params) \t\t\t\t\t\t{ glGetTexParameterfv (target, pname, params); processError(); };\r\nvoid dglGetTexParameteriv  (GLenum target, GLenum pname, GLint* params) \t\t\t\t\t\t{ glGetTexParameteriv (target, pname, params); processError(); };\r\nvoid dglGetUniformfv  (GLuint program, GLint location, GLfloat* params) \t\t\t\t\t\t{ glGetUniformfv (program, location, params); processError(); };\r\nvoid dglGetUniformiv  (GLuint program, GLint location, GLint* params) \t\t\t\t\t\t\t{ glGetUniformiv (program, location, params); processError(); };\r\nint  dglGetUniformLocation  (GLuint program, const GLchar* name) \t\t\t\t\t\t\t\t{ int res = glGetUniformLocation (program, name); processError(); return res; };\r\nvoid dglGetVertexAttribfv  (GLuint index, GLenum pname, GLfloat* params) \t\t\t\t\t\t{ glGetVertexAttribfv (index, pname, params); processError(); };\r\nvoid dglGetVertexAttribiv  (GLuint index, GLenum pname, GLint* params) \t\t\t\t\t\t\t{ glGetVertexAttribiv (index, pname, params); processError(); };\r\nvoid dglGetVertexAttribPointerv  (GLuint index, GLenum pname, GLvoid** pointer) \t\t\t\t{ glGetVertexAttribPointerv (index, pname, pointer); processError(); };\r\nvoid dglHint  (GLenum target, GLenum mode) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glHint (target, mode); processError(); };\r\nGLboolean dglIsBuffer  (GLuint buffer) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsBuffer (buffer); processError(); return res; };\r\nGLboolean dglIsEnabled  (GLenum cap) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsEnabled (cap); processError(); return res; };\r\nGLboolean dglIsFramebuffer  (GLuint framebuffer) \t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsFramebuffer (framebuffer); processError(); return res; };\r\nGLboolean dglIsProgram  (GLuint program) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsProgram (program); processError(); return res; };\r\nGLboolean dglIsRenderbuffer  (GLuint renderbuffer) \t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsRenderbuffer (renderbuffer); processError(); return res; };\r\nGLboolean dglIsShader  (GLuint shader) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsShader (shader); processError(); return res; };\r\nGLboolean dglIsTexture  (GLuint texture) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ GLboolean res = glIsTexture (texture); processError(); return res; };\r\nvoid dglLineWidth  (GLfloat width) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLineWidth (width); processError(); };\r\nvoid dglLinkProgram  (GLuint program) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glLinkProgram (program); processError(); };\r\nvoid dglPixelStorei  (GLenum pname, GLint param) \t\t\t\t\t\t\t\t\t\t\t\t{ glPixelStorei (pname, param); processError(); };\r\nvoid dglPolygonOffset  (GLfloat factor, GLfloat units) \t\t\t\t\t\t\t\t\t\t\t{ glPolygonOffset (factor, units); processError(); };\r\nvoid dglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)\r\n\t{ glReadPixels (x, y, width, height, format, type, pixels); processError(); }\r\nvoid dglReleaseShaderCompiler (void)\r\n\t{ glReleaseShaderCompiler(); processError(); }\r\nvoid dglRenderbufferStorage  (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glRenderbufferStorage (target, internalformat, width, height); processError(); };\r\nvoid dglSampleCoverage  (GLclampf value, GLboolean invert) \t\t\t\t\t\t\t\t\t\t{ glSampleCoverage (value, invert); processError(); };\r\nvoid dglScissor  (GLint x, GLint y, GLsizei width, GLsizei height) \t\t\t\t\t\t\t\t{ glScissor (x, y, width, height); processError(); };\r\nvoid dglShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)\r\n\t{ glShaderBinary (n, shaders, binaryformat, binary, length); processError(); }\r\nvoid dglShaderSource  (GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { glShaderSource (shader, count, string, length); processError(); };\r\nvoid dglStencilFunc  (GLenum func, GLint ref, GLuint mask) \t\t\t\t\t\t\t\t\t\t{ glStencilFunc (func, ref, mask); processError(); };\r\nvoid dglStencilFuncSeparate  (GLenum face, GLenum func, GLint ref, GLuint mask) \t\t\t\t{ glStencilFuncSeparate (face, func, ref, mask); processError(); };\r\nvoid dglStencilMask  (GLuint mask) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glStencilMask (mask); processError(); };\r\nvoid dglStencilMaskSeparate  (GLenum face, GLuint mask) \t\t\t\t\t\t\t\t\t\t{ glStencilMaskSeparate (face, mask); processError(); };\r\nvoid dglStencilOp  (GLenum fail, GLenum zfail, GLenum zpass) \t\t\t\t\t\t\t\t\t{ glStencilOp (fail, zfail, zpass); processError(); };\r\nvoid dglStencilOpSeparate  (GLenum face, GLenum fail, GLenum zfail, GLenum zpass) \t\t\t\t{ glStencilOpSeparate (face, fail, zfail, zpass); processError(); };\r\nvoid dglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)\r\n{ glTexImage2D (target, level, internalformat, width, height, border, format, type, pixels); processError(); }\r\nvoid dglTexParameterf  (GLenum target, GLenum pname, GLfloat param) \t\t\t\t\t\t\t{ glTexParameterf (target, pname, param); processError(); };\r\nvoid dglTexParameterfv  (GLenum target, GLenum pname, const GLfloat* params) \t\t\t\t\t{ glTexParameterfv (target, pname, params); processError(); };\r\nvoid dglTexParameteri  (GLenum target, GLenum pname, GLint param)\t\t\t\t\t\t\t\t{ glTexParameteri (target, pname, param); processError(); };\r\nvoid dglTexParameteriv  (GLenum target, GLenum pname, const GLint* params) \t\t\t\t\t\t{ glTexParameteriv (target, pname, params); processError(); };\r\nvoid dglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)\r\n{ glTexSubImage2D (target, level, xoffset, yoffset, width, height, format, type, pixels); processError(); }\r\nvoid dglUniform1f  (GLint location, GLfloat x) \t\t\t\t\t\t\t\t\t\t\t\t\t{ glUniform1f (location, x); processError(); };\r\nvoid dglUniform1fv  (GLint location, GLsizei count, const GLfloat* v) \t\t\t\t\t\t\t{ glUniform1fv (location, count, v); processError(); };\r\nvoid dglUniform1i  (GLint location, GLint x) \t\t\t\t\t\t\t\t\t\t\t\t\t{ glUniform1i (location, x); processError(); };\r\nvoid dglUniform1iv  (GLint location, GLsizei count, const GLint* v) \t\t\t\t\t\t\t{ glUniform1iv (location, count, v); processError(); };\r\nvoid dglUniform2f  (GLint location, GLfloat x, GLfloat y) \t\t\t\t\t\t\t\t\t\t{ glUniform2f (location, x, y); processError(); };\r\nvoid dglUniform2fv  (GLint location, GLsizei count, const GLfloat* v) \t\t\t\t\t\t\t{ glUniform2fv (location, count, v); processError(); };\r\nvoid dglUniform2i  (GLint location, GLint x, GLint y) \t\t\t\t\t\t\t\t\t\t\t{ glUniform2i (location, x, y); processError(); };\r\nvoid dglUniform2iv  (GLint location, GLsizei count, const GLint* v) \t\t\t\t\t\t\t{ glUniform2iv (location, count, v); processError(); };\r\nvoid dglUniform3f  (GLint location, GLfloat x, GLfloat y, GLfloat z) \t\t\t\t\t\t\t{ glUniform3f (location, x, y, z); processError(); };\r\nvoid dglUniform3fv  (GLint location, GLsizei count, const GLfloat* v) \t\t\t\t\t\t\t{ glUniform3fv (location, count, v); processError(); };\r\nvoid dglUniform3i  (GLint location, GLint x, GLint y, GLint z) \t\t\t\t\t\t\t\t\t{ glUniform3i (location, x, y, z); processError(); };\r\nvoid dglUniform3iv  (GLint location, GLsizei count, const GLint* v) \t\t\t\t\t\t\t{ glUniform3iv (location, count, v); processError(); };\r\nvoid dglUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)\t\t\t\t\t{ glUniform4f (location, x, y, z, w); processError() }\r\nvoid dglUniform4fv  (GLint location, GLsizei count, const GLfloat* v) \t\t\t\t\t\t\t{ glUniform4fv (location, count, v); processError(); };\r\nvoid dglUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w)\t\t\t\t\t\t\t{ glUniform4i (location, x, y, z, w); processError(); }\r\nvoid dglUniform4iv  (GLint location, GLsizei count, const GLint* v) \t\t\t\t\t\t\t{ glUniform4iv (location, count, v); processError(); };\r\nvoid dglUniformMatrix2fv  (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glUniformMatrix2fv (location, count, transpose, value); processError(); };\r\nvoid dglUniformMatrix3fv  (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glUniformMatrix3fv (location, count, transpose, value); processError(); };\r\nvoid dglUniformMatrix4fv  (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glUniformMatrix4fv (location, count, transpose, value); processError(); };\r\nvoid dglUseProgram  (GLuint program) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glUseProgram (program); processError(); };\r\nvoid dglValidateProgram  (GLuint program) \t\t\t\t\t\t\t\t\t\t\t\t\t\t{ glValidateProgram (program); processError(); };\r\nvoid dglVertexAttrib1f  (GLuint indx, GLfloat x) \t\t\t\t\t\t\t\t\t\t\t\t{ glVertexAttrib1f (indx, x); processError(); };\r\nvoid dglVertexAttrib1fv  (GLuint indx, const GLfloat* values) \t\t\t\t\t\t\t\t\t{ glVertexAttrib1fv (indx, values); processError(); };\r\nvoid dglVertexAttrib2f  (GLuint indx, GLfloat x, GLfloat y) \t\t\t\t\t\t\t\t\t{ glVertexAttrib2f (indx, x, y); processError(); };\r\nvoid dglVertexAttrib2fv  (GLuint indx, const GLfloat* values) \t\t\t\t\t\t\t\t\t{ glVertexAttrib2fv (indx, values); processError(); };\r\nvoid dglVertexAttrib3f  (GLuint indx, GLfloat x, GLfloat y, GLfloat z) \t\t\t\t\t\t\t{ glVertexAttrib3f (indx, x, y, z); processError(); };\r\nvoid dglVertexAttrib3fv  (GLuint indx, const GLfloat* values) \t\t\t\t\t\t\t\t\t{ glVertexAttrib3fv (indx, values); processError(); };\r\nvoid dglVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\t\t\t\t{ glVertexAttrib4f (indx, x, y, z, w); processError(); }\r\nvoid dglVertexAttrib4fv  (GLuint indx, const GLfloat* values) \t\t\t\t\t\t\t\t\t{ glVertexAttrib4fv (indx, values); processError(); };\r\nvoid dglVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);\r\n{ glVertexAttribPointer (indx, size, type, normalized, stride, ptr); processError(); }\r\nvoid dglViewport  (GLint x, GLint y, GLsizei width, GLsizei height) \t\t\t\t\t\t\t{ glViewport (x, y, width, height); processError(); };\r\n\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Rendering/glWrapper.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __GL_API_DEBUG_WRAPPER__\r\n#define __GL_API_DEBUG_WRAPPER__\r\n\r\n// #define USE_DEBUG_WRAPPER\r\n\r\n// ---------------------------------------------------------------------------------------\r\n//\r\n//  No OpenGLES wrapper (1.x & 2.0)\r\n//\r\n// ---------------------------------------------------------------------------------------\r\n#ifndef USE_DEBUG_WRAPPER\r\n\t#if defined(__APPLE__)\r\n        #include \"TargetConditionals.h\"\r\n\t\t#if TARGET_OS_IPHONE // iOS devices or iOS Simulator\r\n\t\t\t#ifdef OPENGL2\r\n\t\t\t#import <OpenGLES/ES2/gl.h>\r\n\t\t\t#import <OpenGLES/ES2/glext.h>\r\n\t\t\t#else\r\n\t\t\t#import <OpenGLES/ES1/gl.h>\r\n\t\t\t#import <OpenGLES/ES1/glext.h>\r\n\t\t\t#endif\r\n\t\t#else // Mac OS X\r\n\t\t\t// #include \"glew.h\"\r\n\t\t\t#include <GLUT/glut.h>\r\n\t\t\t#include <OpenGL/gl.h>\r\n            #include <OpenGL/glext.h>\r\n\t\t\t#define STD_OPENGL\r\n\t\t#endif\r\n\t#else\r\n\t\t#ifdef OPENGL2\r\n\t\t#include \"GLES2/gl2.h\"\r\n\t\t#include \"GLES2/gl2ext.h\"\r\n\t\t// The header file which is not in the Android environment.\r\n\t\t// #include \"GLES2/gl2extimg.h\"\r\n\t\t#else\r\n\t\t\t#ifdef _WIN32\r\n\t\t\t\t#include <windows.h>\r\n\t\t\t\t#include \"glew.h\"\r\n\t\t\t\t#include \"glut.h\"\r\n\t\t\t\t#include <gl/GL.h>\r\n\t\t\t\t#include \"glext.h\"\r\n\t\t\t\t#define STD_OPENGL\r\n\t\t\t#else\r\n\t\t\t\t#include \"GLES/gl.h\"\r\n\t\t\t#endif\r\n\t\t#endif\r\n\t#endif\r\n\r\n\t#ifndef OPENGL2\r\n\t// Available only in Common profile\r\n\t#define dglAlphaFunc glAlphaFunc\r\n\t#define dglClearColor   glClearColor \r\n\t#define dglClearDepthf   glClearDepthf \r\n\t#define dglClipPlanef   glClipPlanef \r\n\t#define dglColor4f   glColor4f \r\n\t#define dglDepthRangef   glDepthRangef \r\n\t#define dglFogf   glFogf \r\n\t#define dglFogfv   glFogfv \r\n\t#define dglFrustumf   glFrustumf \r\n\t#define dglGetClipPlanef   glGetClipPlanef \r\n\t#define dglGetFloatv   glGetFloatv \r\n\t#define dglGetLightfv   glGetLightfv \r\n\t#define dglGetMaterialfv   glGetMaterialfv \r\n\t#define dglGetTexEnvfv   glGetTexEnvfv \r\n\t#define dglGetTexParameterfv   glGetTexParameterfv \r\n\t#define dglLightModelf   glLightModelf \r\n\t#define dglLightModelfv   glLightModelfv \r\n\t#define dglLightf   glLightf \r\n\t#define dglLightfv   glLightfv \r\n\t#define dglLineWidth   glLineWidth \r\n\t#define dglLoadMatrixf   glLoadMatrixf \r\n\t#define dglMaterialf   glMaterialf \r\n\t#define dglMaterialfv   glMaterialfv \r\n\t#define dglMultMatrixf   glMultMatrixf \r\n\t#define dglMultiTexCoord4f   glMultiTexCoord4f \r\n\t#define dglNormal3f   glNormal3f \r\n\t#define dglOrthof   glOrthof \r\n\t#define dglPointParameterf   glPointParameterf \r\n\t#define dglPointParameterfv   glPointParameterfv \r\n\t#define dglPointSize   glPointSize \r\n\t#define dglPolygonOffset   glPolygonOffset \r\n\t#define dglRotatef   glRotatef \r\n\t#define dglScalef   glScalef \r\n\t#define dglTexEnvf   glTexEnvf \r\n\t#define dglTexEnvfv   glTexEnvfv \r\n\t#define dglTexParameterf   glTexParameterf \r\n\t#define dglTexParameterfv   glTexParameterfv \r\n\t#define dglTranslatef   glTranslatef \r\n\r\n\t// Available in both Common and Common-Lite profiles\r\n\t#define dglActiveTexture   glActiveTexture \r\n\t#define dglAlphaFuncx   glAlphaFuncx \r\n\t#define dglBindBuffer   glBindBuffer \r\n\t#define dglBindTexture   glBindTexture \r\n\t#define dglBlendFunc   glBlendFunc \r\n\t#define dglBufferData   glBufferData \r\n\t#define dglBufferSubData   glBufferSubData \r\n\t#define dglClear   glClear \r\n\t#define dglClearColorx   glClearColorx \r\n\t#define dglClearDepthx   glClearDepthx \r\n\t#define dglClearStencil   glClearStencil \r\n\t#define dglClientActiveTexture   glClientActiveTexture \r\n\t#define dglClipPlanex   glClipPlanex \r\n\t#define dglColor4ub   glColor4ub \r\n\t#define dglColor4x   glColor4x \r\n\t#define dglColorMask   glColorMask \r\n\t#define dglColorPointer   glColorPointer \r\n\t#define dglCompressedTexImage2D   glCompressedTexImage2D \r\n\t#define dglCompressedTexSubImage2D   glCompressedTexSubImage2D \r\n\t#define dglCopyTexImage2D   glCopyTexImage2D \r\n\t#define dglCopyTexSubImage2D   glCopyTexSubImage2D \r\n\t#define dglCullFace   glCullFace \r\n\t#define dglDeleteBuffers   glDeleteBuffers \r\n\t#define dglDeleteTextures   glDeleteTextures \r\n\t#define dglDepthFunc   glDepthFunc \r\n\t#define dglDepthMask   glDepthMask \r\n\t#define dglDepthRangex   glDepthRangex \r\n\t#define dglDisable   glDisable \r\n\t#define dglDisableClientState   glDisableClientState \r\n\t#define dglDrawArrays   glDrawArrays \r\n\t#define dglDrawElements   glDrawElements \r\n\t#define dglEnable   glEnable \r\n\t#define dglEnableClientState   glEnableClientState \r\n\t#define dglFinish   glFinish \r\n\t#define dglFlush   glFlush \r\n\t#define dglFogx   glFogx \r\n\t#define dglFogxv   glFogxv \r\n\t#define dglFrontFace   glFrontFace \r\n\t#define dglFrustumx   glFrustumx \r\n\t#define dglGetBooleanv   glGetBooleanv \r\n\t#define dglGetBufferParameteriv   glGetBufferParameteriv \r\n\t#define dglGetClipPlanex   glGetClipPlanex \r\n\t#define dglGenBuffers   glGenBuffers \r\n\t#define dglGenTextures   glGenTextures \r\n\t#define dglGetError   glGetError \r\n\t#define dglGetFixedv   glGetFixedv \r\n\t#define dglGetIntegerv   glGetIntegerv \r\n\t#define dglGetLightxv   glGetLightxv \r\n\t#define dglGetMaterialxv   glGetMaterialxv \r\n\t#define dglGetPointerv   glGetPointerv \r\n\t#define dglGetString   glGetString \r\n\t#define dglGetTexEnviv   glGetTexEnviv \r\n\t#define dglGetTexEnvxv   glGetTexEnvxv \r\n\t#define dglGetTexParameteriv   glGetTexParameteriv \r\n\t#define dglGetTexParameterxv   glGetTexParameterxv \r\n\t#define dglHint   glHint \r\n\t#define dglIsBuffer   glIsBuffer \r\n\t#define dglIsEnabled   glIsEnabled \r\n\t#define dglIsTexture   glIsTexture \r\n\t#define dglLightModelx   glLightModelx \r\n\t#define dglLightModelxv   glLightModelxv \r\n\t#define dglLightx   glLightx \r\n\t#define dglLightxv   glLightxv \r\n\t#define dglLineWidthx   glLineWidthx \r\n\t#define dglLoadIdentity   glLoadIdentity \r\n\t#define dglLoadMatrixx   glLoadMatrixx \r\n\t#define dglLogicOp   glLogicOp \r\n\t#define dglMaterialx   glMaterialx \r\n\t#define dglMaterialxv   glMaterialxv \r\n\t#define dglMatrixMode   glMatrixMode \r\n\t#define dglMultMatrixx   glMultMatrixx \r\n\t#define dglMultiTexCoord4x   glMultiTexCoord4x \r\n\t#define dglNormal3x   glNormal3x \r\n\t#define dglNormalPointer   glNormalPointer \r\n\t#define dglOrthox   glOrthox \r\n\t#define dglPixelStorei   glPixelStorei \r\n\t#define dglPointParameterx   glPointParameterx \r\n\t#define dglPointParameterxv   glPointParameterxv \r\n\t#define dglPointSizex   glPointSizex \r\n\t#define dglPolygonOffsetx   glPolygonOffsetx \r\n\t#define dglPopMatrix   glPopMatrix \r\n\t#define dglPushMatrix   glPushMatrix \r\n\t#define dglReadPixels   glReadPixels \r\n\t#define dglRotatex   glRotatex \r\n\t#define dglSampleCoverage   glSampleCoverage \r\n\t#define dglSampleCoveragex   glSampleCoveragex \r\n\t#define dglScalex   glScalex \r\n\t#define dglScissor   glScissor \r\n\t#define dglShadeModel   glShadeModel \r\n\t#define dglStencilFunc   glStencilFunc \r\n\t#define dglStencilMask   glStencilMask \r\n\t#define dglStencilOp   glStencilOp \r\n\t#define dglTexCoordPointer   glTexCoordPointer \r\n\t#define dglTexEnvi   glTexEnvi \r\n\t#define dglTexEnvx   glTexEnvx \r\n\t#define dglTexEnviv   glTexEnviv \r\n\t#define dglTexEnvxv   glTexEnvxv \r\n\t#define dglTexImage2D   glTexImage2D \r\n\t#define dglTexParameteri   glTexParameteri \r\n\t#define dglTexParameterx   glTexParameterx \r\n\t#define dglTexParameteriv   glTexParameteriv \r\n\t#define dglTexParameterxv   glTexParameterxv \r\n\t#define dglTexSubImage2D   glTexSubImage2D \r\n\t#define dglTranslatex   glTranslatex \r\n\t#define dglVertexPointer   glVertexPointer \r\n\t#define dglViewport   glViewport \r\n\r\n\t#else\r\n\r\n\t#define dglActiveTexture  glActiveTexture \r\n\t#define dglAttachShader  glAttachShader \r\n\t#define dglBindAttribLocation  glBindAttribLocation \r\n\t#define dglBindBuffer  glBindBuffer \r\n\t#define dglBindFramebuffer  glBindFramebuffer \r\n\t#define dglBindRenderbuffer  glBindRenderbuffer \r\n\t#define dglBindTexture  glBindTexture \r\n\t#define dglBlendColor  glBlendColor \r\n\t#define dglBlendEquation  glBlendEquation \r\n\t#define dglBlendEquationSeparate  glBlendEquationSeparate \r\n\t#define dglBlendFunc  glBlendFunc \r\n\t#define dglBlendFuncSeparate  glBlendFuncSeparate \r\n\t#define dglBufferData  glBufferData \r\n\t#define dglBufferSubData  glBufferSubData \r\n\t#define dglCheckFramebufferStatus  glCheckFramebufferStatus \r\n\t#define dglClear  glClear \r\n\t#define dglClearColor  glClearColor \r\n\t#define dglClearDepthf  glClearDepthf \r\n\t#define dglClearStencil  glClearStencil \r\n\t#define dglColorMask  glColorMask \r\n\t#define dglCompileShader  glCompileShader \r\n\t#define dglCompressedTexImage2D  glCompressedTexImage2D \r\n\t#define dglCompressedTexSubImage2D  glCompressedTexSubImage2D \r\n\t#define dglCopyTexImage2D  glCopyTexImage2D \r\n\t#define dglCopyTexSubImage2D  glCopyTexSubImage2D \r\n\t#define dglCreateProgram  glCreateProgram \r\n\t#define dglCreateShader  glCreateShader \r\n\t#define dglCullFace  glCullFace \r\n\t#define dglDeleteBuffers  glDeleteBuffers \r\n\t#define dglDeleteFramebuffers  glDeleteFramebuffers \r\n\t#define dglDeleteProgram  glDeleteProgram \r\n\t#define dglDeleteRenderbuffers  glDeleteRenderbuffers \r\n\t#define dglDeleteShader  glDeleteShader \r\n\t#define dglDeleteTextures  glDeleteTextures \r\n\t#define dglDepthFunc  glDepthFunc \r\n\t#define dglDepthMask  glDepthMask \r\n\t#define dglDepthRangef  glDepthRangef \r\n\t#define dglDetachShader  glDetachShader \r\n\t#define dglDisable  glDisable \r\n\t#define dglDisableVertexAttribArray  glDisableVertexAttribArray \r\n\t#define dglDrawArrays  glDrawArrays \r\n\t#define dglDrawElements  glDrawElements \r\n\t#define dglEnable  glEnable \r\n\t#define dglEnableVertexAttribArray  glEnableVertexAttribArray \r\n\t#define dglFinish  glFinish \r\n\t#define dglFlush  glFlush \r\n\t#define dglFramebufferRenderbuffer  glFramebufferRenderbuffer \r\n\t#define dglFramebufferTexture2D  glFramebufferTexture2D \r\n\t#define dglFrontFace  glFrontFace \r\n\t#define dglGenBuffers  glGenBuffers \r\n\t#define dglGenerateMipmap  glGenerateMipmap \r\n\t#define dglGenFramebuffers  glGenFramebuffers \r\n\t#define dglGenRenderbuffers  glGenRenderbuffers \r\n\t#define dglGenTextures  glGenTextures \r\n\t#define dglGetActiveAttrib  glGetActiveAttrib \r\n\t#define dglGetActiveUniform  glGetActiveUniform \r\n\t#define dglGetAttachedShaders  glGetAttachedShaders \r\n\t#define dglGetAttribLocation  glGetAttribLocation \r\n\t#define dglGetBooleanv  glGetBooleanv \r\n\t#define dglGetBufferParameteriv  glGetBufferParameteriv \r\n\t#define dglGetError  glGetError \r\n\t#define dglGetFloatv  glGetFloatv \r\n\t#define dglGetFramebufferAttachmentParameteriv  glGetFramebufferAttachmentParameteriv \r\n\t#define dglGetIntegerv  glGetIntegerv \r\n\t#define dglGetProgramiv  glGetProgramiv \r\n\t#define dglGetProgramInfoLog  glGetProgramInfoLog \r\n\t#define dglGetRenderbufferParameteriv  glGetRenderbufferParameteriv \r\n\t#define dglGetShaderiv  glGetShaderiv \r\n\t#define dglGetShaderInfoLog  glGetShaderInfoLog \r\n\t#define dglGetShaderPrecisionFormat  glGetShaderPrecisionFormat \r\n\t#define dglGetShaderSource  glGetShaderSource \r\n\t#define dglGetString  glGetString \r\n\t#define dglGetTexParameterfv  glGetTexParameterfv \r\n\t#define dglGetTexParameteriv  glGetTexParameteriv \r\n\t#define dglGetUniformfv  glGetUniformfv \r\n\t#define dglGetUniformiv  glGetUniformiv \r\n\t#define dglGetUniformLocation  glGetUniformLocation \r\n\t#define dglGetVertexAttribfv  glGetVertexAttribfv \r\n\t#define dglGetVertexAttribiv  glGetVertexAttribiv \r\n\t#define dglGetVertexAttribPointerv  glGetVertexAttribPointerv \r\n\t#define dglHint  glHint \r\n\t#define dglIsBuffer  glIsBuffer \r\n\t#define dglIsEnabled  glIsEnabled \r\n\t#define dglIsFramebuffer  glIsFramebuffer \r\n\t#define dglIsProgram  glIsProgram \r\n\t#define dglIsRenderbuffer  glIsRenderbuffer \r\n\t#define dglIsShader  glIsShader \r\n\t#define dglIsTexture  glIsTexture \r\n\t#define dglLineWidth  glLineWidth \r\n\t#define dglLinkProgram  glLinkProgram \r\n\t#define dglPixelStorei  glPixelStorei \r\n\t#define dglPolygonOffset  glPolygonOffset \r\n\t#define dglReadPixels  glReadPixels \r\n\t#define dglReleaseShaderCompiler  glReleaseShaderCompiler \r\n\t#define dglRenderbufferStorage  glRenderbufferStorage \r\n\t#define dglSampleCoverage  glSampleCoverage \r\n\t#define dglScissor  glScissor \r\n\t#define dglShaderBinary  glShaderBinary \r\n\t#define dglShaderSource  glShaderSource \r\n\t#define dglStencilFunc  glStencilFunc \r\n\t#define dglStencilFuncSeparate  glStencilFuncSeparate \r\n\t#define dglStencilMask  glStencilMask \r\n\t#define dglStencilMaskSeparate  glStencilMaskSeparate \r\n\t#define dglStencilOp  glStencilOp \r\n\t#define dglStencilOpSeparate  glStencilOpSeparate \r\n\t#define dglTexImage2D  glTexImage2D \r\n\t#define dglTexParameterf  glTexParameterf \r\n\t#define dglTexParameterfv  glTexParameterfv \r\n\t#define dglTexParameteri  glTexParameteri \r\n\t#define dglTexParameteriv  glTexParameteriv \r\n\t#define dglTexSubImage2D  glTexSubImage2D \r\n\t#define dglUniform1f  glUniform1f \r\n\t#define dglUniform1fv  glUniform1fv \r\n\t#define dglUniform1i  glUniform1i \r\n\t#define dglUniform1iv  glUniform1iv \r\n\t#define dglUniform2f  glUniform2f \r\n\t#define dglUniform2fv  glUniform2fv \r\n\t#define dglUniform2i  glUniform2i \r\n\t#define dglUniform2iv  glUniform2iv \r\n\t#define dglUniform3f  glUniform3f \r\n\t#define dglUniform3fv  glUniform3fv \r\n\t#define dglUniform3i  glUniform3i \r\n\t#define dglUniform3iv  glUniform3iv \r\n\t#define dglUniform4f  glUniform4f \r\n\t#define dglUniform4fv  glUniform4fv \r\n\t#define dglUniform4i  glUniform4i \r\n\t#define dglUniform4iv  glUniform4iv \r\n\t#define dglUniformMatrix2fv  glUniformMatrix2fv \r\n\t#define dglUniformMatrix3fv  glUniformMatrix3fv \r\n\t#define dglUniformMatrix4fv  glUniformMatrix4fv \r\n\t#define dglUseProgram  glUseProgram \r\n\t#define dglValidateProgram  glValidateProgram \r\n\t#define dglVertexAttrib1f  glVertexAttrib1f \r\n\t#define dglVertexAttrib1fv  glVertexAttrib1fv \r\n\t#define dglVertexAttrib2f  glVertexAttrib2f \r\n\t#define dglVertexAttrib2fv  glVertexAttrib2fv \r\n\t#define dglVertexAttrib3f  glVertexAttrib3f \r\n\t#define dglVertexAttrib3fv  glVertexAttrib3fv \r\n\t#define dglVertexAttrib4f  glVertexAttrib4f \r\n\t#define dglVertexAttrib4fv  glVertexAttrib4fv \r\n\t#define dglVertexAttribPointer  glVertexAttribPointer \r\n\t#define dglViewport  glViewport \r\n#endif\r\n\r\n#else\r\n\t// ---------------------------------------------------------------------------------------\r\n\t//\r\n\t//  With OpenGLES wrapper (1.x & 2.0)\r\n\t//\r\n\t// ---------------------------------------------------------------------------------------\r\n\t#ifndef OPENGL2\r\n\t// Wrapper OpenGL 1.x\r\n\r\n\t// Available only in Common profile\r\n\tvoid dglAlphaFunc (GLenum func, GLclampf ref);\r\n\tvoid dglClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\tvoid dglClearDepthf (GLclampf depth);\r\n\tvoid dglClipPlanef (GLenum plane, const GLfloat *equation);\r\n\tvoid dglColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\r\n\tvoid dglDepthRangef (GLclampf zNear, GLclampf zFar);\r\n\tvoid dglFogf (GLenum pname, GLfloat param);\r\n\tvoid dglFogfv (GLenum pname, const GLfloat *params);\r\n\tvoid dglFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);\r\n\tvoid dglGetClipPlanef (GLenum pname, GLfloat eqn[4]);\r\n\tvoid dglGetFloatv (GLenum pname, GLfloat *params);\r\n\tvoid dglGetLightfv (GLenum light, GLenum pname, GLfloat *params);\r\n\tvoid dglGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);\r\n\tvoid dglGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);\r\n\tvoid dglGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);\r\n\tvoid dglLightModelf (GLenum pname, GLfloat param);\r\n\tvoid dglLightModelfv (GLenum pname, const GLfloat *params);\r\n\tvoid dglLightf (GLenum light, GLenum pname, GLfloat param);\r\n\tvoid dglLightfv (GLenum light, GLenum pname, const GLfloat *params);\r\n\tvoid dglLineWidth (GLfloat width);\r\n\tvoid dglLoadMatrixf (const GLfloat *m);\r\n\tvoid dglMaterialf (GLenum face, GLenum pname, GLfloat param);\r\n\tvoid dglMaterialfv (GLenum face, GLenum pname, const GLfloat *params);\r\n\tvoid dglMultMatrixf (const GLfloat *m);\r\n\tvoid dglMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\r\n\tvoid dglNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);\r\n\tvoid dglOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);\r\n\tvoid dglPointParameterf (GLenum pname, GLfloat param);\r\n\tvoid dglPointParameterfv (GLenum pname, const GLfloat *params);\r\n\tvoid dglPointSize (GLfloat size);\r\n\tvoid dglPolygonOffset (GLfloat factor, GLfloat units);\r\n\tvoid dglRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglScalef (GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglTexEnvf (GLenum target, GLenum pname, GLfloat param);\r\n\tvoid dglTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);\r\n\tvoid dglTexParameterf (GLenum target, GLenum pname, GLfloat param);\r\n\tvoid dglTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);\r\n\tvoid dglTranslatef (GLfloat x, GLfloat y, GLfloat z);\r\n\r\n\t// Available in both Common and Common-Lite profiles\r\n\tvoid dglActiveTexture (GLenum texture);\r\n\tvoid dglAlphaFuncx (GLenum func, GLclampx ref);\r\n\tvoid dglBindBuffer (GLenum target, GLuint buffer);\r\n\tvoid dglBindTexture (GLenum target, GLuint texture);\r\n\tvoid dglBlendFunc (GLenum sfactor, GLenum dfactor);\r\n\tvoid dglBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);\r\n\tvoid dglBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);\r\n\tvoid dglClear (GLbitfield mask);\r\n\tvoid dglClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);\r\n\tvoid dglClearDepthx (GLclampx depth);\r\n\tvoid dglClearStencil (GLint s);\r\n\tvoid dglClientActiveTexture (GLenum texture);\r\n\tvoid dglClipPlanex (GLenum plane, const GLfixed *equation);\r\n\tvoid dglColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\r\n\tvoid dglColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);\r\n\tvoid dglColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\n\tvoid dglColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\r\n\tvoid dglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\r\n\tvoid dglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\n\tvoid dglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tvoid dglCullFace (GLenum mode);\r\n\tvoid dglDeleteBuffers (GLsizei n, const GLuint *buffers);\r\n\tvoid dglDeleteTextures (GLsizei n, const GLuint *textures);\r\n\tvoid dglDepthFunc (GLenum func);\r\n\tvoid dglDepthMask (GLboolean flag);\r\n\tvoid dglDepthRangex (GLclampx zNear, GLclampx zFar);\r\n\tvoid dglDisable (GLenum cap);\r\n\tvoid dglDisableClientState (GLenum array);\r\n\tvoid dglDrawArrays (GLenum mode, GLint first, GLsizei count);\r\n\tvoid dglDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);\r\n\tvoid dglEnable (GLenum cap);\r\n\tvoid dglEnableClientState (GLenum array);\r\n\tvoid dglFinish (void);\r\n\tvoid dglFlush (void);\r\n\tvoid dglFogx (GLenum pname, GLfixed param);\r\n\tvoid dglFogxv (GLenum pname, const GLfixed *params);\r\n\tvoid dglFrontFace (GLenum mode);\r\n\tvoid dglFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);\r\n\tvoid dglGetBooleanv (GLenum pname, GLboolean *params);\r\n\tvoid dglGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);\r\n\tvoid dglGetClipPlanex (GLenum pname, GLfixed eqn[4]);\r\n\tvoid dglGenBuffers (GLsizei n, GLuint *buffers);\r\n\tvoid dglGenTextures (GLsizei n, GLuint *textures);\r\n\tGLenum dglGetError (void);\r\n\tvoid dglGetFixedv (GLenum pname, GLfixed *params);\r\n\tvoid dglGetIntegerv (GLenum pname, GLint *params);\r\n\tvoid dglGetLightxv (GLenum light, GLenum pname, GLfixed *params);\r\n\tvoid dglGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);\r\n\tvoid dglGetPointerv (GLenum pname, void **params);\r\n\tconst GLubyte * dglGetString (GLenum name);\r\n\tvoid dglGetTexEnviv (GLenum env, GLenum pname, GLint *params);\r\n\tvoid dglGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);\r\n\tvoid dglGetTexParameteriv (GLenum target, GLenum pname, GLint *params);\r\n\tvoid dglGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);\r\n\tvoid dglHint (GLenum target, GLenum mode);\r\n\tGLboolean dglIsBuffer (GLuint buffer);\r\n\tGLboolean dglIsEnabled (GLenum cap);\r\n\tGLboolean dglIsTexture (GLuint texture);\r\n\tvoid dglLightModelx (GLenum pname, GLfixed param);\r\n\tvoid dglLightModelxv (GLenum pname, const GLfixed *params);\r\n\tvoid dglLightx (GLenum light, GLenum pname, GLfixed param);\r\n\tvoid dglLightxv (GLenum light, GLenum pname, const GLfixed *params);\r\n\tvoid dglLineWidthx (GLfixed width);\r\n\tvoid dglLoadIdentity (void);\r\n\tvoid dglLoadMatrixx (const GLfixed *m);\r\n\tvoid dglLogicOp (GLenum opcode);\r\n\tvoid dglMaterialx (GLenum face, GLenum pname, GLfixed param);\r\n\tvoid dglMaterialxv (GLenum face, GLenum pname, const GLfixed *params);\r\n\tvoid dglMatrixMode (GLenum mode);\r\n\tvoid dglMultMatrixx (const GLfixed *m);\r\n\tvoid dglMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);\r\n\tvoid dglNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);\r\n\tvoid dglNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);\r\n\tvoid dglPixelStorei (GLenum pname, GLint param);\r\n\tvoid dglPointParameterx (GLenum pname, GLfixed param);\r\n\tvoid dglPointParameterxv (GLenum pname, const GLfixed *params);\r\n\tvoid dglPointSizex (GLfixed size);\r\n\tvoid dglPolygonOffsetx (GLfixed factor, GLfixed units);\r\n\tvoid dglPopMatrix (void);\r\n\tvoid dglPushMatrix (void);\r\n\tvoid dglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);\r\n\tvoid dglRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);\r\n\tvoid dglSampleCoverage (GLclampf value, GLboolean invert);\r\n\tvoid dglSampleCoveragex (GLclampx value, GLboolean invert);\r\n\tvoid dglScalex (GLfixed x, GLfixed y, GLfixed z);\r\n\tvoid dglScissor (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tvoid dglShadeModel (GLenum mode);\r\n\tvoid dglStencilFunc (GLenum func, GLint ref, GLuint mask);\r\n\tvoid dglStencilMask (GLuint mask);\r\n\tvoid dglStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\r\n\tvoid dglTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglTexEnvi (GLenum target, GLenum pname, GLint param);\r\n\tvoid dglTexEnvx (GLenum target, GLenum pname, GLfixed param);\r\n\tvoid dglTexEnviv (GLenum target, GLenum pname, const GLint *params);\r\n\tvoid dglTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);\r\n\tvoid dglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\r\n\tvoid dglTexParameteri (GLenum target, GLenum pname, GLint param);\r\n\tvoid dglTexParameterx (GLenum target, GLenum pname, GLfixed param);\r\n\tvoid dglTexParameteriv (GLenum target, GLenum pname, const GLint *params);\r\n\tvoid dglTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);\r\n\tvoid dglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\r\n\tvoid dglTranslatex (GLfixed x, GLfixed y, GLfixed z);\r\n\tvoid dglVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\r\n\tvoid dglViewport (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\t\r\n\t#else\r\n\t\r\n\tvoid dglActiveTexture (GLenum texture);\r\n\tvoid dglAttachShader (GLuint program, GLuint shader);\r\n\tvoid dglBindAttribLocation (GLuint program, GLuint index, const GLchar* name);\r\n\tvoid dglBindBuffer (GLenum target, GLuint buffer);\r\n\tvoid dglBindFramebuffer (GLenum target, GLuint framebuffer);\r\n\tvoid dglBindRenderbuffer (GLenum target, GLuint renderbuffer);\r\n\tvoid dglBindTexture (GLenum target, GLuint texture);\r\n\tvoid dglBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\tvoid dglBlendEquation ( GLenum mode );\r\n\tvoid dglBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);\r\n\tvoid dglBlendFunc (GLenum sfactor, GLenum dfactor);\r\n\tvoid dglBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\r\n\tvoid dglBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);\r\n\tvoid dglBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);\r\n\tGLenum dglCheckFramebufferStatus (GLenum target);\r\n\tvoid dglClear (GLbitfield mask);\r\n\tvoid dglClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\r\n\tvoid dglClearDepthf (GLclampf depth);\r\n\tvoid dglClearStencil (GLint s);\r\n\tvoid dglColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\r\n\tvoid dglCompileShader (GLuint shader);\r\n\tvoid dglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);\r\n\tvoid dglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);\r\n\tvoid dglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\r\n\tvoid dglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tGLuint dglCreateProgram (void);\r\n\tGLuint dglCreateShader (GLenum type);\r\n\tvoid dglCullFace (GLenum mode);\r\n\tvoid dglDeleteBuffers (GLsizei n, const GLuint* buffers);\r\n\tvoid dglDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);\r\n\tvoid dglDeleteProgram (GLuint program);\r\n\tvoid dglDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);\r\n\tvoid dglDeleteShader (GLuint shader);\r\n\tvoid dglDeleteTextures (GLsizei n, const GLuint* textures);\r\n\tvoid dglDepthFunc (GLenum func);\r\n\tvoid dglDepthMask (GLboolean flag);\r\n\tvoid dglDepthRangef (GLclampf zNear, GLclampf zFar);\r\n\tvoid dglDetachShader (GLuint program, GLuint shader);\r\n\tvoid dglDisable (GLenum cap);\r\n\tvoid dglDisableVertexAttribArray (GLuint index);\r\n\tvoid dglDrawArrays (GLenum mode, GLint first, GLsizei count);\r\n\tvoid dglDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);\r\n\tvoid dglEnable (GLenum cap);\r\n\tvoid dglEnableVertexAttribArray (GLuint index);\r\n\tvoid dglFinish (void);\r\n\tvoid dglFlush (void);\r\n\tvoid dglFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\r\n\tvoid dglFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\r\n\tvoid dglFrontFace (GLenum mode);\r\n\tvoid dglGenBuffers (GLsizei n, GLuint* buffers);\r\n\tvoid dglGenerateMipmap (GLenum target);\r\n\tvoid dglGenFramebuffers (GLsizei n, GLuint* framebuffers);\r\n\tvoid dglGenRenderbuffers (GLsizei n, GLuint* renderbuffers);\r\n\tvoid dglGenTextures (GLsizei n, GLuint* textures);\r\n\tvoid dglGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\n\tvoid dglGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\r\n\tvoid dglGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);\r\n\tint  glGetAttribLocation (GLuint program, const GLchar* name);\r\n\tvoid dglGetBooleanv (GLenum pname, GLboolean* params);\r\n\tvoid dglGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);\r\n\tGLenum dglGetError (void);\r\n\tvoid dglGetFloatv (GLenum pname, GLfloat* params);\r\n\tvoid dglGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);\r\n\tvoid dglGetIntegerv (GLenum pname, GLint* params);\r\n\tvoid dglGetProgramiv (GLuint program, GLenum pname, GLint* params);\r\n\tvoid dglGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);\r\n\tvoid dglGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);\r\n\tvoid dglGetShaderiv (GLuint shader, GLenum pname, GLint* params);\r\n\tvoid dglGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);\r\n\tvoid dglGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);\r\n\tvoid dglGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);\r\n\tconst GLubyte* glGetString (GLenum name);\r\n\tvoid dglGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);\r\n\tvoid dglGetTexParameteriv (GLenum target, GLenum pname, GLint* params);\r\n\tvoid dglGetUniformfv (GLuint program, GLint location, GLfloat* params);\r\n\tvoid dglGetUniformiv (GLuint program, GLint location, GLint* params);\r\n\tint  glGetUniformLocation (GLuint program, const GLchar* name);\r\n\tvoid dglGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);\r\n\tvoid dglGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);\r\n\tvoid dglGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);\r\n\tvoid dglHint (GLenum target, GLenum mode);\r\n\tGLboolean dglIsBuffer (GLuint buffer);\r\n\tGLboolean dglIsEnabled (GLenum cap);\r\n\tGLboolean dglIsFramebuffer (GLuint framebuffer);\r\n\tGLboolean dglIsProgram (GLuint program);\r\n\tGLboolean dglIsRenderbuffer (GLuint renderbuffer);\r\n\tGLboolean dglIsShader (GLuint shader);\r\n\tGLboolean dglIsTexture (GLuint texture);\r\n\tvoid dglLineWidth (GLfloat width);\r\n\tvoid dglLinkProgram (GLuint program);\r\n\tvoid dglPixelStorei (GLenum pname, GLint param);\r\n\tvoid dglPolygonOffset (GLfloat factor, GLfloat units);\r\n\tvoid dglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);\r\n\tvoid dglReleaseShaderCompiler (void);\r\n\tvoid dglRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\r\n\tvoid dglSampleCoverage (GLclampf value, GLboolean invert);\r\n\tvoid dglScissor (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\tvoid dglShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);\r\n\tvoid dglShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);\r\n\tvoid dglStencilFunc (GLenum func, GLint ref, GLuint mask);\r\n\tvoid dglStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);\r\n\tvoid dglStencilMask (GLuint mask);\r\n\tvoid dglStencilMaskSeparate (GLenum face, GLuint mask);\r\n\tvoid dglStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\r\n\tvoid dglStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);\r\n\tvoid dglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);\r\n\tvoid dglTexParameterf (GLenum target, GLenum pname, GLfloat param);\r\n\tvoid dglTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);\r\n\tvoid dglTexParameteri (GLenum target, GLenum pname, GLint param);\r\n\tvoid dglTexParameteriv (GLenum target, GLenum pname, const GLint* params);\r\n\tvoid dglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);\r\n\tvoid dglUniform1f (GLint location, GLfloat x);\r\n\tvoid dglUniform1fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform1i (GLint location, GLint x);\r\n\tvoid dglUniform1iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniform2f (GLint location, GLfloat x, GLfloat y);\r\n\tvoid dglUniform2fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform2i (GLint location, GLint x, GLint y);\r\n\tvoid dglUniform2iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglUniform3fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform3i (GLint location, GLint x, GLint y, GLint z);\r\n\tvoid dglUniform3iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\n\tvoid dglUniform4fv (GLint location, GLsizei count, const GLfloat* v);\r\n\tvoid dglUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);\r\n\tvoid dglUniform4iv (GLint location, GLsizei count, const GLint* v);\r\n\tvoid dglUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\n\tvoid dglUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\n\tvoid dglUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\r\n\tvoid dglUseProgram (GLuint program);\r\n\tvoid dglValidateProgram (GLuint program);\r\n\tvoid dglVertexAttrib1f (GLuint indx, GLfloat x);\r\n\tvoid dglVertexAttrib1fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);\r\n\tvoid dglVertexAttrib2fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);\r\n\tvoid dglVertexAttrib3fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\r\n\tvoid dglVertexAttrib4fv (GLuint indx, const GLfloat* values);\r\n\tvoid dglVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);\r\n\tvoid dglViewport (GLint x, GLint y, GLsizei width, GLsizei height);\r\n\t\r\n\t#endif\r\n\r\n#endif\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Rendering/shaderSource.inl",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\t//\r\n\t// Standard Render state :\r\n\t//\t- \"pos_attr\" \tfor vertex coordinate.\r\n\t//\t- \"uv_attr\"\t\tfor uv coordinate.\r\n\t//\t- \"col_attr\"\tfor color in vertex.\r\n\t//\r\n\t//\t- \"texture\"\t\tis sampler name for texture 0\r\n\t//\r\n\r\n\t// ------------------------------------------------------------------\r\n\t// Color Vertex Only.\r\n\t// ------------------------------------------------------------------\r\n\r\n\tconst static char s_vertColorOnly[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute lowp vec4 col_attr;\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"    col_var = col_attr;\\n\"\r\n\t\t\"}\";\r\n\r\n\tconst static char s_fragColorOnly[] =\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_FragColor = col_var;\\n\"\r\n\t\t\"}\";\r\n\t\t\t\t\r\n\t// ------------------------------------------------------------------\r\n\t// Simple texturing\r\n\t// ------------------------------------------------------------------\r\n\tconst static char s_vertTexture[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute mediump vec2 uv_attr;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"\tuv_var = uv_attr;\\n\"\r\n\t\t\"}\";\r\n\r\n\tconst static char s_fragTexture[] =\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_FragColor  = texture2D(texture,uv_var);\\n\"\r\n\t\t\"}\";\r\n\r\n\t\t\r\n\t\t\r\n\t\t\t\t\r\n\t// ------------------------------------------------------------------\r\n\t// Color Vertex RGBA * Texture\r\n\t// ------------------------------------------------------------------\r\n\t\r\n\tconst static char sh_vertColTexture[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute mediump vec2 uv_attr;\\n\"\r\n\t\t\"attribute lowp vec4 col_attr;\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"    col_var = col_attr;\\n\"\r\n\t\t\"\t uv_var  = uv_attr;\\n\"\r\n\t\t\"}\";\r\n\r\n\tconst static char sh_fragColTexture[] =\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"\tgl_FragColor  = texture2D(texture,uv_var) * col_var;\\n\"\r\n\t\t\"}\";\r\n\r\n\t// ------------------------------------------------------------------\r\n\t//   Special Shader Extension : Brightness\r\n\t// ------------------------------------------------------------------\r\n\r\n\t// float \"power\"\r\n\tconst static char sh_brightNessVS[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute mediump vec2 uv_attr;\\n\"\r\n\t\t\"attribute lowp vec4 col_attr;\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp float power;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"    col_var = col_attr * power;\\n\"\r\n\t\t\"\t uv_var  = uv_attr;\\n\"\r\n\t\t\"}\";\r\n\t\r\n\t// ------------------------------------------------------------------\r\n\t//   Special Shader Extension : Colorize\r\n\t// ------------------------------------------------------------------\r\n\r\n\t// float    \"power\"\r\n\t// float[3] \"colorize\"\r\n\tconst static char sh_colorizePS[] = \r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"uniform lowp vec3 colorize;\\n\"\r\n\t\t\"uniform lowp float power;\\n\"\r\n\t\t\"const lowp vec3 coef = vec3(0.2125, 0.7154, 0.0721);\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"   lowp vec4 color     = texture2D(texture,uv_var) * col_var;\\n\"\t\t\t// Read Texture\r\n\t\t\"\tgl_FragColor        = mix(vec4(vec3(dot(color.rgb, coef)) * colorize,color.a),color,power);\\n\"\r\n\t\t\"}\";\r\n\r\n\t// ------------------------------------------------------------------\r\n\t//   Special Shader Extension : Saturate\r\n\t// ------------------------------------------------------------------\r\n\r\n\t// float    \"power\"\r\n\tconst static char sh_saturatePS[] = \r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"uniform lowp float power;\\n\"\r\n\t\t\"const lowp vec3 coef = vec3(0.2125, 0.7154, 0.0721);\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"   lowp vec4 color     = texture2D(texture,uv_var) * col_var;\\n\"\t\t\t// Read Texture\r\n\t\t\"\tgl_FragColor        = mix(vec4(vec3(dot(color.rgb, coef)),color.a),color,power);\\n\"\r\n\t\t\"}\";\r\n\r\n\t// ------------------------------------------------------------------\r\n\t//   Special Shader Extension : Ramp lookup\r\n\t// ------------------------------------------------------------------\r\n\r\n\t// texture    \"table\" : 16x1 pixel table\r\n\tconst static char sh_curvePS[] = \r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"uniform lowp sampler2D table;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"   lowp vec4 color     = texture2D(texture,uv_var) * col_var;\\n\"\t\t\t// Read Texture\r\n\t\t\"\tgl_FragColor        = vec4(texture2D(table,vec2(color.r,0.0)).r , texture2D(table,vec2(color.g,0.0)).g, texture2D(table,vec2(color.b,0.0)).b, color.a);\\n\"\r\n\t\t\"}\";\r\n\r\n\t// ------------------------------------------------------------------\r\n\t//   Special Shader Extension : Tone mapping\r\n\t// ------------------------------------------------------------------\r\n\r\n\tconst static char sh_toneVS_2D[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute mediump vec2 uv_attr;\\n\"\r\n\t\t\"attribute lowp vec4 col_attr;\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"    col_var = col_attr * vec4(0.06135,15.98,1.0,1.0);\\n\"\r\n\t\t\"\t uv_var  = uv_attr;\\n\"\r\n\t\t\"}\";\r\n\r\n\t// texture\t\"table\" : 256x16 pixel table\r\n\tconst static char sh_tonePS_2D[] = \r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"uniform lowp sampler2D table;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"   lowp vec4 color     = texture2D(texture,uv_var) * col_var;\\n\"\t\t\t// Read Texture and apply vertex color\r\n        \"   gl_FragColor        = vec4(texture2D(table, vec2(color.r + (floor(color.b)/15.98),color.g)).rgb,color.a);\\n\"\r\n\t\t\"}\";\r\n\r\n\tconst static char sh_toneVS_3D[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute mediump vec2 uv_attr;\\n\"\r\n\t\t\"attribute lowp vec4 col_attr;\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"    col_var = col_attr;\\n\"\r\n\t\t\"\t uv_var  = uv_attr;\\n\"\r\n\t\t\"}\";\r\n\r\n\t// texture\t\"table\" : 256x16 pixel table\r\n\tconst static char sh_tonePS_3D[] =\r\n\t\t\"#extension GL_OES_texture_3D : enable\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"uniform lowp sampler3D table;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"   lowp vec4 color     = texture2D(texture,uv_var) * col_var;\\n\"\t\t\t// Read Texture and apply vertex color\r\n\t\t\"   gl_FragColor        = vec4(texture3D(table, color.rgb).rgb,color.a);\\n\"\r\n\t\t\"}\";\r\n\r\n\t// ------------------------------------------------------------------\r\n\t//   Special Shader Extension : Mosaic (Warning : work in texture space : does not support rotation, scaling)\r\n\t// ------------------------------------------------------------------\r\n\r\n\t// float \"power\"\r\n\tconst static char sh_mosaicVS[] =\r\n\t\t\"uniform mat4 Projection;\\n\"\r\n\t\t\"attribute highp vec2 pos_attr;\\n\"\r\n\t\t\"attribute mediump vec2 uv_attr;\\n\"\r\n\t\t\"attribute lowp vec4 col_attr;\\n\"\r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform mediump float power;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"    gl_Position = Projection * vec4(pos_attr, 0.0, 1.0);\\n\"\r\n\t\t\"    col_var = col_attr;\\n\"\r\n\t\t\"\t uv_var  = uv_attr * power;\\n\"\r\n\t\t\"}\";\r\n\t\t\r\n\t// float\t\"power\"\r\n\tconst static char sh_mosaicPS[] = \r\n\t\t\"varying lowp vec4 col_var;\\n\"\r\n\t\t\"varying mediump vec2 uv_var;\\n\"\r\n\t\t\"uniform lowp sampler2D texture;\\n\"\r\n\t\t\"uniform lowp sampler2D table;\\n\"\r\n\t\t\"uniform mediump float power;\\n\"\r\n\t\t\"void main()\\n\"\r\n\t\t\"{\\n\"\r\n\t\t\"\tgl_FragColor        = texture2D(texture, floor(uv_var) / power) * col_var;\\n\"\r\n\t\t\"}\";\r\n\r\n\t// TODO film noise\r\n\t// TODO UV perturbation per pixel\r\n\t// TODO UV perturbation per vertex (grid)\r\n\r\n"
  },
  {
    "path": "Engine/source/SceneGraph/CKLBNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBNode.h\"\r\n#include \"string.h\"\r\n#include \"CKLBUITask.h\"\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n/*static*/ u32\tCKLBNode::s_vertexRecomputeCount = 0;\r\n/*static*/ u32\tCKLBNode::s_matrixRecomputeCount = 0;\r\n/*static*/ u32  CKLBNode::s_colorRecomputeCount  = 0;\r\n#endif\r\n\r\n/*static*/ float CKLBNode::s_fLeftBorder\t=\t-500.0f;\r\n/*static*/ float CKLBNode::s_fRightBorder\t=  +1500.0f;\r\n/*static*/ float CKLBNode::s_fTopBorder\t\t=\t-400.0f;\r\n/*static*/ float CKLBNode::s_fBottomBorder\t=  +1200.0f;\r\n\r\nSMatrix2D::SMatrix2D()\r\n{\r\n\tm_matrix[0] = 1.0f;\r\n\tm_matrix[1] = 0.0f;\r\n\tm_matrix[2] = 0.0f;\r\n\tm_matrix[3] = 1.0f;\r\n\tm_matrix[4] = 0.0f;\r\n\tm_matrix[5] = 0.0f;\r\n\tm_type\t\t= MATRIX_ID;\r\n}\r\n\r\nSColorVector::SColorVector()\r\n{\r\n\tm_vector[0] = 1.0f;\r\n\tm_vector[1] = 1.0f;\r\n\tm_vector[2] = 1.0f;\r\n\tm_vector[3] = 1.0f;\r\n\tm_type\t\t= MATRIX_ID;\r\n}\r\n\r\nCKLBNode::CKLBNode():\r\n\tCKLBObject\t\t\t(),\r\n\tm_pBrother\t\t\t(NULL),\r\n\t// Is visible but not connected = not visible from parent\r\n\tm_status\t\t\t(ANY_CHANGE | MARKED | INVISIBLE_UPPER),\t// Invisible from outside by def\r\n\tm_parent\t\t\t(NULL),\r\n\tm_pChild\t\t\t(NULL),\r\n\tm_useParentColor\t(true),\r\n\tm_pColorMatrix\t\t(NULL),\r\n\tm_pAnimationNext\t(NULL),\r\n\tm_pAnimationPrev\t(NULL),\r\n\tm_pRender\t\t\t(NULL),\r\n\tm_renderSlot\t\t(NULL),\r\n\tm_layer\t\t\t\t(0),\r\n\tm_movieID\t\t\t(0),\r\n\tm_renderCount\t\t(1),\r\n\tm_deleteRender\t\t(true),\r\n\tm_name\t\t\t\t(NULL),\r\n\tm_uitask\t\t\t(NULL),\r\n\tm_isAnimated\t\t(false),\r\n\tm_nameLength\t\t(0),\r\n\tm_rot\t\t\t\t(0.0f),\r\n\tm_scaleX\t\t\t(1.0f),\r\n\tm_scaleY\t\t\t(1.0f),\r\n\tm_bInternalNode\t\t(true),\r\n\tm_reject\t\t\t(false)\r\n{\r\n\tm_pColorMatrix\t= &m_colorMatrix;\r\n\tm_pRender\t\t= &m_renderSlot;\r\n}\r\n\r\n/*virtual*/\r\nCKLBNode* CKLBNode::clone(CKLBNode* newItem, CKLBNode* parent, CKLBNode* brother, bool transferSpriteOwnership) {\r\n\tif (newItem == NULL) {\r\n\t\tnewItem = KLBNEW(CKLBNode);\r\n\t}\r\n\r\n\tif (newItem) {\r\n\t\t//\r\n\t\t// Recursive parse tree.\r\n\t\t//\r\n\t\tCKLBNode* pChild\t= m_pChild;\r\n\t\tCKLBNode* pBrother\t= NULL;\r\n\t\twhile (pChild) {\r\n\t\t\tpBrother = pChild->clone(NULL, newItem, pBrother, transferSpriteOwnership);\r\n\t\t\tnewItem->addNode(pBrother,pBrother->getLayer());\r\n\t\t\tpChild\t\t= pChild->m_pBrother;\r\n\t\t}\r\n\t\tnewItem->m_parent\t\t\t\t\t= parent;\r\n\r\n\t\tnewItem->m_matrix\t\t\t\t\t= m_matrix;\r\n\t\tnewItem->m_localColorMatrix\t\t\t= m_localColorMatrix;\r\n\r\n\t//\tDisconnected by default : CTOR default.\r\n\t//  Recomputed when tree connect.\r\n\t//\tSMatrix2D\t\t\tm_composedMatrix;\r\n\t//\tSColorVector\t\tm_colorMatrix;\r\n\r\n\t\tif (m_name) {\r\n\t\t\tnewItem->m_name = CKLBUtility::copyString(m_name);\r\n\t\t}\r\n\t\tnewItem->m_uitask\t\t\t\t\t= m_uitask;\r\n\r\n\t//\tDisconnected by default : CTOR default\r\n\t//\tCKLBNode*\t\t\tm_pAnimationNext;\r\n\t//\tCKLBNode*\t\t\tm_pAnimationPrev;\r\n\t//\tm_isAnimated;\r\n\r\n\t\tif (m_pColorMatrix != &m_colorMatrix) {\r\n\t\t\tif (parent) {\r\n\t\t\t\tnewItem->m_pColorMatrix = parent->m_pColorMatrix;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (m_pRender != &m_renderSlot) {\r\n\t\t\tnewItem->m_pRender = KLBNEWA(CKLBRenderCommand*,m_renderCount);\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n < m_renderCount; n++) {\r\n\t\t\tif (transferSpriteOwnership) {\r\n\t\t\t\tnewItem->setRenderRef\t(this->getRender(n),n);\r\n\t\t\t} else {\r\n\t\t\t\tnewItem->setRender\t\t(this->getRender(n),n);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tnewItem->m_rot\t\t\t\t= m_rot;\r\n\t\tnewItem->m_scaleX\t\t\t= m_scaleX;\r\n\t\tnewItem->m_scaleY\t\t\t= m_scaleY;\r\n\t\tnewItem->m_renderCount\t\t= m_renderCount;\r\n\r\n\t\tnewItem->m_groupID\t\t\t= m_groupID;\r\n\t\tnewItem->m_status\t\t\t= m_status | INVISIBLE_UPPER;\r\n\r\n\t\tif (parent == NULL) {\r\n\t\t\tnewItem->m_status |= ANY_CHANGE | MARKED;\r\n\t\t}\r\n\r\n\t\tnewItem->m_layer\t\t\t= m_layer;\r\n\t\tnewItem->m_movieID\t\t\t= m_movieID;\r\n\t\tnewItem->m_updateFrame\t\t= m_updateFrame;\r\n\t\tnewItem->m_nameLength\t\t= m_nameLength;\r\n\r\n\t\tif (transferSpriteOwnership) {\r\n\t\t\t// Clone now own the sprite\r\n\t\t\tnewItem->m_deleteRender\t\t= true;\r\n\t\t\tthis->m_deleteRender\t\t= false;\r\n\t\t} else {\r\n\t\t\t// Original own the sprite\r\n\t\t\tnewItem->m_deleteRender\t\t= false;\r\n\t\t}\r\n\r\n\t\tnewItem->m_bInternalNode\t= m_bInternalNode;\r\n\t\tnewItem->m_useParentColor\t= m_useParentColor;\r\n\t\tnewItem->m_reject\t\t\t= m_reject;\r\n\t}\r\n\r\n\treturn newItem;\r\n}\r\n\r\n\r\n\r\nCKLBNode::~CKLBNode() {\r\n\t// \"Save the children\" ;-)\r\n\tCKLBNode* pChildList = m_pChild;\r\n\r\n\tif (m_status & ANIMATED) {\r\n\t\tif (isAnimating()) {\r\n\t\t\tCKLBSystem::removeFromAnimation(this);\r\n\t\t}\r\n\t\tm_status &= ~ANIMATED;\r\n\t}\r\n\r\n\t// Clean list BEFORE, avoid recursion.\r\n\tm_pChild = NULL; setVisible(false);\r\n\r\n\treleaseSlots();\r\n\r\n\tCKLBNode* pChildListNext;\r\n\twhile (pChildList) {\r\n\t\tpChildListNext = pChildList->m_pBrother;\r\n\t\tpChildList->m_parent = NULL;\t// Avoid unlinking for all child.\r\n\t\tif (!pChildList->getUITask()) {\r\n\t\t\tKLBDELETE(pChildList);\r\n\t\t}\r\n\t\tpChildList = pChildListNext;\r\n\t}\r\n\r\n\tif (m_parent) {\r\n\t\t// Only top node will enter here.\r\n\t\tm_parent->removeNode(this);\r\n\t}\r\n\r\n\tKLBDELETEA(m_name);\r\n}\r\n\r\nvoid CKLBNode::dump(u32 level, u32 mask) {\r\n\tFILE* pFile = CPFInterface::getInstance().client().getShellOutput();\r\n\r\n\t// \r\n\tfor (u32 n=0; n < level; n++) { printf(\"  \"); }\r\n\r\n\t// Type\r\n\tswitch (this->getClassID()) {\r\n\tcase CLS_KLBNODE:\r\n\t\tif (this->m_parent == NULL) {\r\n\t\t\tfprintf(pFile,\"Root\");\r\n\t\t} else {\r\n\t\t\tfprintf(pFile,\"Node\");\r\n\t\t}\r\n\t\tbreak;\r\n\tcase CLS_KLBUIELEMENT:\r\n\t\tfprintf(pFile,\"Element\");\r\n\t\tbreak;\r\n\tcase CLS_KLBUISELECTABLE:\r\n\t\tfprintf(pFile,\"Selectable\");\r\n\t\tbreak;\r\n\tcase CLS_KLBUICONTAINER:\r\n\t\tfprintf(pFile,\"Container\");\r\n\t\tbreak;\r\n\tcase CLS_KLBSWFMOVIE:\r\n\t\tfprintf(pFile,\"Flash Movie\");\r\n\t\tbreak;\r\n\tcase CLS_KLBSPLINENODE:\r\n\t\tfprintf(pFile,\"Anim Node\");\r\n\t\tbreak;\r\n\tcase CLS_KLBNODEMAP:\r\n\t\tfprintf(pFile,\"Map\");\r\n\t\tbreak;\r\n\tcase CLS_KLBSCORENODE:\r\n\t\tfprintf(pFile,\"Score\");\r\n\t\tbreak;\r\n\tcase CLS_KLBCELLANIMNODE:\r\n\t\tfprintf(pFile,\"Cell Anim\");\r\n\t\tbreak;\r\n\tcase CLS_KLBTEXTEDIT:\r\n\t\tfprintf(pFile,\"Text Input\");\r\n\t\tbreak;\r\n\tcase CLS_KLBWEBVIEW:\r\n\t\tfprintf(pFile,\"Web View\");\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tfprintf(pFile,\"Other\");\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// Ptr\r\n\tfprintf(pFile,\" @%p \",this);\r\n\r\n\t// Name\r\n\tif (this->m_name) {\r\n\t\tfprintf(pFile,\"(%s) \", this->m_name);\r\n\t}\r\n\r\n\t// Render object associated\r\n\tfprintf(pFile,\"%i\", this->m_renderCount);\r\n\tswitch (this->m_composedMatrix.m_type) {\r\n\tcase MATRIX_ID:\r\n\t\tfprintf(pFile,\" [ID]\");\r\n\t\tbreak;\r\n\tcase MATRIX_T:\r\n\t\tfprintf(pFile,\" [T]\");\r\n\t\tbreak;\r\n\tcase MATRIX_TS:\r\n\t\tfprintf(pFile,\" [TS]\");\r\n\t\tbreak;\r\n\tcase MATRIX_TG:\r\n\t\tfprintf(pFile,\" [TG]\");\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif (this->m_status & INVISIBLE) {\r\n\t\tfprintf(pFile,\" INVISIBLE\");\r\n\t} else {\r\n\t\tfprintf(pFile,\" VISIBLE\");\r\n\t}\r\n\r\n\tif (this->m_status & INVISIBLE_UPPER) {\r\n\t\tfprintf(pFile,\" PARENT-INVISIBLE\");\r\n\t}\r\n\r\n\tif (mask & 4) {\r\n\t\tif (this->m_uitask) {\r\n\t\t\tfprintf(pFile,\" TASK:@%p\",this->m_uitask);\r\n\t\t}\r\n\t}\r\n\r\n\tif (mask & 2) {\r\n\t\tfor (u32 m=0; m < m_renderCount; m++) {\r\n\t\t\tfprintf(pFile,\"\\n    \");\r\n\t\t\tfor (u32 n=0; n < level; n++) { fprintf(pFile,\"  \"); }\r\n\r\n\t\t\tif (this->getRender(m)) {\r\n\t\t\t\tfprintf(pFile,\" @%p (%i)\",this->getRender(m),this->getRender(m)->getOrder());\r\n\t\t\t} else {\r\n\t\t\t\tfprintf(pFile,\" @NULL \");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (mask & 1) {\r\n\t\tfor (int m=0; m < 4; m++) {\r\n\t\t\tfprintf(pFile,\"\\n    \");\r\n\t\t\tfor (u32 n=0; n < level; n++) { printf(\"  \"); }\r\n\t\t\tfprintf(pFile,\"%3i <- %3i\",(int)(this->m_colorMatrix.m_vector[m] * 255), (int)(this->m_localColorMatrix.m_vector[m] * 255));\r\n\t\t}\r\n\t}\r\n\r\n\tfprintf(pFile,\"\\n\");\r\n\r\n\tCKLBNode* pParse = this->m_pChild;\r\n\tlevel++;\r\n\twhile (pParse) {\r\n\t\tpParse->dump(level, mask);\r\n\t\tpParse = pParse->m_pBrother;\r\n\t}\r\n}\r\n\r\nbool CKLBNode::setName(const char * name)\r\n{\r\n\tchar * buf;\r\n\tKLBDELETEA(m_name);\r\n\r\n\tif(name) {\r\n\t\tbuf = KLBNEWA(char, strlen(name) + 1);\r\n\t\tif(!buf) return false;\r\n\t\tstrcpy(buf, name);\r\n\t} else {\r\n\t\tbuf = NULL;\r\n\t}\r\n\tm_name = buf;\r\n\tm_nameLength = m_name ? strlen(m_name) : 0;\r\n\r\n\treturn true;\r\n}\r\n\r\nCKLBNode* CKLBNode::search(const char* name) {\r\n\tCKLBNode* res = NULL;\r\n\r\n\tif (m_name && (strncmp(m_name,name,m_nameLength)==0)) {\r\n\t\tif (name[m_nameLength] == 0) {\r\n\t\t\treturn this;\r\n\t\t} else {\r\n\t\t\t// Get Next\r\n\t\t\tconst char* next = name;\r\n\t\t\twhile ((*next != 0) && (*next != '.')) {\r\n\t\t\t\tnext++;\r\n\t\t\t}\r\n\t\t\tif (*next != 0) {\r\n\t\t\t\tnext++; // Skip '.'\r\n\t\t\t\tres = search(next);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!res) {\r\n\t\tCKLBNode* pChild = this->m_pChild;\r\n\t\twhile (pChild) {\r\n\t\t\tres = pChild->search(name);\r\n\t\t\tif (res) {\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t\tpChild = pChild->m_pBrother;\r\n\t\t}\r\n\t}\r\n\r\n\treturn res;\r\n\r\n\t/*\r\n\tif (m_name && (strcmp(name, m_name) == 0)) {\r\n\t\treturn this;\r\n\t}\r\n\r\n\tCKLBNode* pChild = this->m_pChild;\r\n\twhile (pChild) {\r\n\t\tCKLBNode* res = pChild->search(name);\r\n\t\tif (res) {\r\n\t\t\treturn res;\r\n\t\t}\r\n\t\tpChild = pChild->m_pBrother;\r\n\t}\r\n\r\n\treturn NULL;\r\n\t*/\r\n}\r\n\r\nCKLBNode* CKLBNode::searchFirstByTypeID(u32 typeID) {\r\n\tif (typeID == m_uitask->getClassID()) {\r\n\t\treturn this;\r\n\t}\r\n\r\n\tCKLBNode* pChild = this->m_pChild;\r\n\twhile (pChild) {\r\n\t\tCKLBNode* res = pChild->searchFirstByTypeID(typeID);\r\n\t\tif (res) {\r\n\t\t\treturn res;\r\n\t\t}\r\n\t\tpChild = pChild->m_pBrother;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBNode::releaseSlots() {\r\n\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\r\n\tfor (u32 n=0; n < m_renderCount; n++) {\r\n\t\tif (m_pRender[n]) {\r\n\t\t\tif (m_pRender[n]->isInRenderList()) {\r\n\t\t\t\tpMgr.removeFromRendering(m_pRender[n]);\r\n\t\t\t}\r\n\t\t\tif (m_deleteRender) {\r\n\t\t\t\tpMgr.releaseCommand(m_pRender[n]);\r\n\t\t\t}\r\n\t\t\tm_pRender[n] = NULL;\r\n\t\t}\r\n\t}\r\n\r\n\tif (m_renderCount != 1) {\r\n\t\tif (m_pRender)\t\t{\tKLBDELETEA(m_pRender);\t\t}\r\n\t\tm_pRender\t\t\t= NULL;\r\n\t\tm_renderCount\t\t= 0;\r\n\t}\r\n}\r\n\r\nbool CKLBNode::setRenderSlotCount\t(u32 slot) {\r\n\tbool res = true;\r\n\treleaseSlots();\r\n\r\n\tif (slot != 1) {\r\n\t\tCKLBRenderCommand**\r\n\t\t\t\tnewComm\t= KLBNEWA(CKLBRenderCommand*,\tslot);\r\n\r\n\t\tif (newComm) {\r\n\t\t\tm_renderCount = slot;\r\n\t\t\tm_pRender\t= newComm;\r\n\t\t\tmemset(newComm, NULL, sizeof(CKLBRenderCommand*) * slot);\r\n\t\t} else {\r\n\t\t\tslot = 1;\r\n\t\t\tres = false;\r\n\t\t}\r\n\t}\r\n\r\n\tif (slot == 1) {\r\n\t\tm_pRender\t\t= &m_renderSlot;\r\n\t\tm_renderCount = 1;\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\nCKLBNode* CKLBNode::getNode(u16 layer) {\r\n\tCKLBNode* pList\t= m_pChild;\r\n\r\n\twhile (pList) {\r\n\t\tif (pList->m_layer == layer) {\r\n\t\t\treturn pList;\r\n\t\t}\r\n\t\tpList = pList->m_pBrother;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBNode::addNode(CKLBNode* pNode, u16 layer) {\r\n\tklb_assertNull(pNode, \"null node\");\r\n\tklb_assert((pNode != this), \"Impossible to do this node tree operation\");\r\n\r\n\t//\r\n\t// Remove from previous parent.\r\n\t//\r\n\tif (pNode) {\r\n\t\tif (pNode->m_parent) {\r\n\t\t\tpNode->m_parent->removeNode(pNode);\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Perform insertion.\r\n\t\t//\r\n\t\tCKLBNode* pList\t= m_pChild;\r\n\t\tCKLBNode* pPrev\t= NULL;\r\n\r\n\t\twhile (pList) {\r\n\t\t\tif (pList->m_layer >= layer) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpPrev = pList;\r\n\t\t\tpList = pList->m_pBrother;\r\n\t\t}\r\n\r\n\t\tif (pList != NULL) {\r\n\t\t\tif (pPrev != NULL) {\r\n\t\t\t\t// Force insertion with closest layer.\r\n\t\t\t\tpNode->m_pBrother = pPrev->m_pBrother;\r\n\t\t\t\tpPrev->m_pBrother = pNode;\r\n\t\t\t} else {\r\n\t\t\t\t// Beginning of list.\r\n\t\t\t\tm_pChild = pNode;\r\n\t\t\t\tpNode->m_pBrother = pList;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (pPrev != NULL) {\r\n\t\t\t\t// End of list\r\n\t\t\t\tpPrev->m_pBrother = pNode;\r\n\t\t\t} else {\r\n\t\t\t\t// Beginning of list.\r\n\t\t\t\tm_pChild = pNode;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpNode->m_parent = this;\r\n\t\tpNode->m_layer\t= layer;\r\n\r\n\t\t//\r\n\t\t// If parent node is visible and sub node is visible itself also -> Visible\r\n\t\t//\r\n\t\tif (m_status & (INVISIBLE | INVISIBLE_UPPER)) {\r\n\t\t\t// Node has already been disconnected from previous owner OR never been connected\r\n\t\t\t// pNode->m_status |= INVISIBLE_UPPER; already SET.\r\n\t\t} else {\r\n\t\t\t// Reset owner invisible flag\r\n\t\t\tpNode->m_status &= ~INVISIBLE_UPPER;\r\n\r\n\t\t\t// Item is visible\r\n\t\t\tif ((pNode->m_status & INVISIBLE)==0) {\r\n\t\t\t\t// Add to rendering list.\r\n\t\t\t\tpNode->visibleSelf();\r\n\t\t\t\t// Apply logic to child.\r\n\t\t\t\tpNode->visibleUpperRecursive();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::removeNode(CKLBNode* pChild) {\r\n\tCKLBNode* pList\t= m_pChild;\r\n\tCKLBNode* pPrev\t= NULL;\r\n\r\n\twhile (pList) {\r\n\t\tif (pList == pChild) {\r\n\t\t\t// Beginning of list\r\n\t\t\tif (pPrev == NULL) {\r\n\t\t\t\tm_pChild = pChild->m_pBrother;\r\n\t\t\t// Middle / End of list\r\n\t\t\t} else {\r\n\t\t\t\tpPrev->m_pBrother = pChild->m_pBrother;\r\n\t\t\t}\r\n\r\n\t\t\tif (pList->isVisible()) {\r\n\t\t\t\tpList->invisibleSelf();\r\n\t\t\t\tpList->invisibleUpperRecursive();\r\n\t\t\t}\r\n\r\n\t\t\t// Force removal from animation and rendering system of whole sub tree.\r\n\t\t\tpList->m_status |= INVISIBLE_UPPER;\t// Reset invisible upper as disconnected.\r\n\r\n\t\t\t// do NOT \"delete pChild;\"\r\n\t\t\tpChild->m_parent = NULL;\r\n\r\n\t\t\t// remove brother link\r\n\t\t\tpChild->m_pBrother = NULL;\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tpPrev = pList;\r\n\t\tpList = pList->m_pBrother;\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::addRender() {\r\n\tfor (u32 n = 0; n<this->m_renderCount; n++) {\r\n\t\tif (m_pRender[n]) {\r\n\t\t\tCKLBRenderingManager::getInstance().addToRendering(m_pRender[n], m_pRender[n]->m_uiOrder);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::removeRender() {\r\n\tfor (u32 n = 0; n<this->m_renderCount; n++) {\r\n\t\tif (m_pRender[n]) {\r\n\t\t\tCKLBRenderingManager::getInstance().removeFromRendering(m_pRender[n]);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*inline*/ void CKLBNode::visibleSelf() {\r\n\tmarkUpTree();\r\n\tm_status |= ANY_CHANGE;\r\n\r\n\t/* Animation system is independent of visual aspect.\r\n\r\n\t// Is animated and not connected ?\r\n\tif ((m_status & ANIMATED) && (!isAnimating())) {\r\n\t\tCKLBSystem::addToAnimation(this);\r\n\t}\r\n\t*/\r\n\taddRender();\t// Virtual function.\r\n}\r\n\r\n/*inline*/ void CKLBNode::invisibleSelf() {\r\n\t/* Animation system is independent of visual aspect.\r\n\tif ((m_status & ANIMATED) && (isAnimating())) {\r\n\t\tCKLBSystem::removeFromAnimation\t(this);\r\n\t}\r\n\t*/\r\n\tremoveRender();\t// Virtual function.\r\n}\r\n\r\nvoid CKLBNode::visibleUpperRecursive() {\r\n\tCKLBNode* p = m_pChild;\r\n\twhile (p) {\r\n\t\tif (p->m_status & INVISIBLE_UPPER) {\r\n\t\t\tp->m_status &= ~INVISIBLE_UPPER; // Clear flag\r\n\t\t\tif ((p->m_status & INVISIBLE) == 0) {\r\n\t\t\t\t// Item has visible flag -> Make it really visible.\r\n\t\t\t\tp->visibleSelf();\r\n\t\t\t\tp->visibleUpperRecursive();\r\n\t\t\t}\r\n\t\t} \r\n\t\t// else : NO UPPER +   VISIBLE : Already visible,do nothing.\r\n\t\t// else : NO UPPER + INVISIBLE : Stay hidden,    do nothing.\r\n\t\tp = p->m_pBrother;\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::invisibleUpperRecursive() {\r\n\tCKLBNode* p = m_pChild;\r\n\twhile (p) {\r\n\t\t// No upper set\r\n\t\tif ((p->m_status & INVISIBLE_UPPER) == 0) {\r\n\t\t\tp->m_status |= INVISIBLE_UPPER; // Set flag\r\n\t\t\t// Is Visible -> becomes invisible\r\n\t\t\tif ((p->m_status & INVISIBLE) == 0) {\r\n\t\t\t\tp->invisibleSelf();\r\n\t\t\t\tp->invisibleUpperRecursive();\r\n\t\t\t}\r\n\t\t\t// else Invisible\t: already invisible : do nothing.\r\n\t\t} // else UPPER is already set, change nothing to all items.\r\n\t\tp = p->m_pBrother;\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::setVisible(bool isVisible) {\r\n\r\n\tif (isVisible) {\r\n\t\tif (m_status & INVISIBLE_UPPER) {\r\n\t\t\t// Still invisible from upper object.\r\n\t\t\tm_status &= ~INVISIBLE;\t// Reset flag only.\r\n\t\t} else {\r\n\t\t\tif (m_status & INVISIBLE) {\r\n\t\t\t\tm_status &= ~INVISIBLE;\t// Reset flag.\r\n\t\t\t\tvisibleSelf();\r\n\t\t\t\tvisibleUpperRecursive();\r\n\t\t\t} else {\r\n\t\t\t\t// No changes.\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tif ((m_status & INVISIBLE_UPPER) == 0) {\r\n\t\t\tif (m_status & INVISIBLE) {\r\n\t\t\t\t// No Changes\r\n\t\t\t} else {\r\n\t\t\t\tm_status |= INVISIBLE;\r\n\t\t\t\tinvisibleSelf();\r\n\t\t\t\tinvisibleUpperRecursive();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tm_status |= INVISIBLE;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::clearSubTree() {\r\n\tCKLBNode* pList\t= m_pChild;\r\n\r\n\twhile (pList) {\r\n\t\tCKLBNode* pNext = pList->m_pBrother;\r\n\r\n\t\tpList->m_parent = NULL; // Avoid recursive stupid calls.\r\n\r\n\t\tKLBDELETE(pList);\r\n\t\tpList = pNext;\r\n\t}\r\n\r\n\tm_pChild = NULL;\r\n}\r\n\r\nCKLBNode* CKLBNode::searchCommand(CKLBRenderCommand* comm) {\r\n\tfor (u32 n=0; n<this->m_renderCount; n++) {\r\n\t\tif (m_pRender[n] == comm) {\r\n\t\t\treturn this;\r\n\t\t}\r\n\t}\r\n\r\n\tCKLBNode* pList = m_pChild;\r\n\twhile (pList) {\r\n\t\tCKLBNode* result = pList->searchCommand(comm);\r\n\t\tif (result) {\r\n\t\t\treturn result;\r\n\t\t}\r\n\t\tpList = pList->m_pBrother;\r\n\t}\r\n\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBNode::setRender(CKLBRenderCommand* pRender, u32 indexRender) {\r\n\tklb_assert((indexRender < m_renderCount), \"wrong indexRender\");\r\n\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\tif (m_pRender[indexRender] != NULL) {\r\n\t\tm_pRender[indexRender]->decrementCount();\r\n\t\tif (m_pRender[indexRender]->isInRenderList()) {\r\n\t\t\tpMgr.removeFromRendering(m_pRender[indexRender]);\r\n\t\t}\r\n\t}\r\n\r\n\tm_pRender[indexRender] = pRender;\r\n\tmarkUpColor();\t// Force sprite to recompute color.\r\n\r\n\tif (pRender) {\r\n\t\tpRender->incrementCount();\r\n\t\tif (this->isVisible()) {\r\n\t\t\tpMgr.addToRendering(pRender, pRender->m_uiOrder);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::setRenderRef(CKLBRenderCommand* pRender, u32 indexRender) {\r\n\tklb_assert((indexRender < m_renderCount), \"wrong indexRender\");\r\n\tm_pRender[indexRender] = pRender;\r\n\tif (pRender) {\r\n\t\tpRender->incrementCount();\r\n\t}\r\n}\r\n\r\n/*\r\nvoid CKLBNode::rejectSub() {\r\n\tfor (u32 n=0; n<this->m_renderCount; n++) {\r\n\t\tif (m_pRender[n]) {\r\n\t\t\tm_pRender[n]->m_uiStatus |= FLAG_IGNORERENDER;\r\n\t\t}\r\n\t}\r\n}*/\r\n\r\nvoid CKLBNode::recompute() {\r\n\tif (isVisible()) {\r\n\t\tif (m_parent) {\r\n\t\t\tm_status |= m_parent->m_status & ANY_CHANGE; // If parent changed -> force myself to change.\r\n\t\t}\r\n\r\n\t\tbool force = ((m_status & (MATRIX_CHANGE | CMATRIX_CHANGE)) != 0);\r\n\t\tif (force) {\r\n\t\t\tupdateMatrices();\r\n\t\t}\r\n\r\n\t\tif (force) {\t\t\t\t\t\t\t\t\t// TODO Optimize using RENDER_CHANGE\r\n\t\t\t// Apply tranform/color to each vertex.\r\n\t\t\tfor (u32 n=0; n<this->m_renderCount; n++) {\r\n\t\t\t\tif (m_pRender[n]) {\r\n\t\t\t\t\tif (m_status & MATRIX_CHANGE) {\t\t// TODO remove when use RENDER_CHANGE\r\n\t\t\t\t\t\tif (!m_reject) {\r\n\t\t\t\t\t\t\tm_pRender[n]->m_commandType &= ~RENDERCOMMAND_IGNORE;\r\n\t\t\t\t\t\t\tm_pRender[n]->m_uiStatus\t|= FLAG_BUFFERSHIFT | FLAG_UVUPDATE;\r\n\t\t\t\t\t\t\tm_pRender[n]->applyNode(this);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tm_pRender[n]->m_commandType |= RENDERCOMMAND_IGNORE;\r\n\t\t\t\t\t\t\tm_pRender[n]->m_uiStatus\t|= FLAG_BUFFERSHIFT;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (m_status & CMATRIX_CHANGE) {\t// TODO remove when use RENDER_CHANGE\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Get Sprite Color\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\tapplyColor(m_pRender[n]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (u32 n=0; n<this->m_renderCount; n++) {\r\n\t\t\tif (m_pRender[n]) {\r\n\t\t\t\tif (!this->m_reject) {\r\n\t\t\t\t\tm_pRender[n]->m_uiStatus &= ~FLAG_IGNORERENDER;\r\n\t\t\t\t\tm_pRender[n]->applyNode(this);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_pRender[n]->m_uiStatus |= ~FLAG_IGNORERENDER;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (m_status & ANY_CHANGE) {\r\n\t\t\trecomputeCustom();\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Once node is locally completly updated, update child.\r\n\t\t// (We avoid testing flags of child and do it in the recursion instead, avoid testing twice at the cost of a call)\r\n\t\tif ((m_status & MARKED) || force) {\t// Sub item need computation\r\n\t\t\tCKLBNode* pChild = m_pChild;\r\n\r\n\t\t\twhile (pChild) {\r\n\t\t\t\tpChild->recompute();\r\n\t\t\t\tpChild = pChild->m_pBrother;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Reset all flags\r\n\t\tm_status &= ~(ANY_CHANGE | MARKED);\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::updateMatrices() {\r\n\t//\r\n\t// 2. Matrix update\r\n\t//\r\n\tif (m_status & MATRIX_CHANGE) {\t// if root do nothing.\r\n\t\tif (m_parent) {\r\n\t\t\tSMatrix2D* pParMat = &m_parent->m_composedMatrix;\r\n\t\t\tif (pParMat->m_type != MATRIX_ID) {\r\n\t\t\t\tSMatrix2D* pCurMat = &m_matrix;\r\n\t\t\t\tSMatrix2D* pCompMat = &m_composedMatrix;\r\n\r\n\t\t\t\t// OPTIMIZE RP Optimize based on matrix type from stream (need to locally update type also)\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Matrix Composition.\r\n\t\t\t\t//\r\n\r\n\t\t\t\t//\r\n\t\t\t\t// Load Matrix from local matrix.\r\n\t\t\t\t//\r\n#ifdef DEBUG_PERFORMANCE\r\n\t\t\t\ts_matrixRecomputeCount++;\r\n#endif\r\n\r\n\t\t\t\t#define M2(a)\t\t(pCurMat->m_matrix[a])\r\n\t\t\t\t#define M1(a)\t\t(pParMat->m_matrix[a])\r\n\t\t\t\t#define M(a,b)\t\ta->m_matrix[b]\r\n\t\t\t\tfloat tx;\r\n\t\t\t\tfloat ty;\r\n\t\t\t\tif ((pParMat->m_type < MATRIX_TS)) {\r\n\t\t\t\t\t// If parent is Identity or translation. -> Copy local matrix directly to compose, just translate.\r\n\t\t\t\t\ttx\t= M2(MAT_TX) + M1(MAT_TX);\r\n\t\t\t\t\tty\t= M2(MAT_TY) + M1(MAT_TY);\r\n\t\t\t\t\tM(pCompMat,MAT_TX)\t= tx;\r\n\t\t\t\t\tM(pCompMat,MAT_TY)\t= ty;\r\n\t\t\t\t\tM(pCompMat,MAT_A)\t= M2(MAT_A);\r\n\t\t\t\t\tM(pCompMat,MAT_B)\t= M2(MAT_B);\r\n\t\t\t\t\tM(pCompMat,MAT_C)\t= M2(MAT_C);\r\n\t\t\t\t\tM(pCompMat,MAT_D)\t= M2(MAT_D);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfloat a\t= (M1(MAT_A)*M2(MAT_A)) + (M1(MAT_B)*M2(MAT_C));\r\n\t\t\t\t\tfloat b\t= (M1(MAT_A)*M2(MAT_B)) + (M1(MAT_B)*M2(MAT_D));\r\n\t\t\t\t\tfloat c\t= (M1(MAT_C)*M2(MAT_A)) + (M1(MAT_D)*M2(MAT_C));\r\n\t\t\t\t\tfloat d\t= (M1(MAT_C)*M2(MAT_B)) + (M1(MAT_D)*M2(MAT_D));\r\n\t\t\t\t\ttx\t= (M1(MAT_A)*M2(MAT_TX)) + (M1(MAT_B)*M2(MAT_TY)) + M1(MAT_TX);\r\n\t\t\t\t\tty\t= (M1(MAT_C)*M2(MAT_TX)) + (M1(MAT_D)*M2(MAT_TY)) + M1(MAT_TY);\r\n\r\n\t\t\t\t\tM(pCompMat,MAT_A)\t= a;\r\n\t\t\t\t\tM(pCompMat,MAT_B)\t= b;\r\n\t\t\t\t\tM(pCompMat,MAT_C)\t= c;\r\n\t\t\t\t\tM(pCompMat,MAT_D)\t= d;\r\n\t\t\t\t\tM(pCompMat,MAT_TX)\t= tx;\r\n\t\t\t\t\tM(pCompMat,MAT_TY)\t= ty;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tswitch (pParMat->m_type) {\r\n\t\t\t\tcase MATRIX_T\t:\r\n\t\t\t\t\tswitch (pCurMat->m_type) {\r\n\t\t\t\t\tcase MATRIX_ID\t:\r\n\t\t\t\t\tcase MATRIX_T\t:\tpCompMat->m_type = MATRIX_T;\t\tbreak;\r\n\t\t\t\t\tdefault:\t\t\tpCompMat->m_type = pCurMat->m_type; break;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MATRIX_TS\t:\r\n\t\t\t\t\tswitch (pCurMat->m_type) {\r\n\t\t\t\t\tcase MATRIX_ID\t:\r\n\t\t\t\t\tcase MATRIX_TS\t:\r\n\t\t\t\t\tcase MATRIX_T\t:\tpCompMat->m_type = MATRIX_TS;\t\tbreak;\r\n\t\t\t\t\tdefault:\t\t\tpCompMat->m_type = pCurMat->m_type; break;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MATRIX_TG\t:\tpCompMat->m_type = MATRIX_TG; break;\r\n\t\t\t\t/* Case done with lower else \r\n\t\t\t\tcase MATRIX_ID\t:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t */\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tm_composedMatrix = m_matrix;\r\n\t\t\t}\r\n\r\n\t\t\tif (   (m_composedMatrix.m_matrix[MAT_TX] >= s_fLeftBorder) && (m_composedMatrix.m_matrix[MAT_TX] <= s_fRightBorder)\r\n\t\t\t\t&& (m_composedMatrix.m_matrix[MAT_TY] >= s_fTopBorder ) && (m_composedMatrix.m_matrix[MAT_TY] <= s_fBottomBorder)\r\n\t\t\t   )\r\n\t\t\t{\r\n\t\t\t\tm_reject = false;\r\n\t\t\t} else {\r\n\t\t\t\tm_reject = true;\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\t\t\t// Root : Copy matrix to composed matrix.\r\n\t\t\tm_composedMatrix = m_matrix;\r\n\t\t\tm_reject = false;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif (m_useParentColor) {\r\n\t\t// Propagate matrix.\r\n\t\tif (m_parent) {\r\n\t\t\tm_pColorMatrix = m_parent->m_pColorMatrix;\r\n\t\t}\r\n\t} else {\r\n\t\t// Use self color\r\n\t\tif (m_status & CMATRIX_CHANGE) {\r\n\t\t\t// OPTIMIZE RP : Can use type from stream and avoid testing all components.\r\n\t\t\tif ((this->m_localColorMatrix.m_vector[0] == 1.0f) &&\r\n\t\t\t\t(this->m_localColorMatrix.m_vector[1] == 1.0f) &&\r\n\t\t\t\t(this->m_localColorMatrix.m_vector[2] == 1.0f) &&\r\n\t\t\t\t(this->m_localColorMatrix.m_vector[3] == 1.0f)) {\r\n\t\t\t\tif (m_parent) {\r\n\t\t\t\t\tm_pColorMatrix = m_parent->m_pColorMatrix; // Identity use parent directly.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_pColorMatrix = &m_colorMatrix;\r\n\t\t\t\t\tm_colorMatrix.m_vector[0] = m_localColorMatrix.m_vector[0];\r\n\t\t\t\t\tm_colorMatrix.m_vector[1] = m_localColorMatrix.m_vector[1];\r\n\t\t\t\t\tm_colorMatrix.m_vector[2] = m_localColorMatrix.m_vector[2];\r\n\t\t\t\t\tm_colorMatrix.m_vector[3] = m_localColorMatrix.m_vector[3];\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tm_pColorMatrix = &this->m_colorMatrix; // Used local composed color matrix.\r\n\t\t\t\tm_colorMatrix.m_vector[0] = m_parent->m_pColorMatrix->m_vector[0] * m_localColorMatrix.m_vector[0];\r\n\t\t\t\tm_colorMatrix.m_vector[1] = m_parent->m_pColorMatrix->m_vector[1] * m_localColorMatrix.m_vector[1];\r\n\t\t\t\tm_colorMatrix.m_vector[2] = m_parent->m_pColorMatrix->m_vector[2] * m_localColorMatrix.m_vector[2];\r\n\t\t\t\tm_colorMatrix.m_vector[3] = m_parent->m_pColorMatrix->m_vector[3] * m_localColorMatrix.m_vector[3];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::markUpTree() {\r\n\tCKLBNode* pParent = this->m_parent;\r\n\twhile (pParent) {\r\n\t\tif (pParent->m_status & MARKED) {\r\n\t\t\tbreak;\r\n\t\t} else {\r\n\t\t\tpParent->m_status |= MARKED;\r\n\t\t\tpParent = pParent->m_parent;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::setPriority(u32 order)\r\n{\r\n\tCKLBRenderingManager& pRdr = CKLBRenderingManager::getInstance();\r\n\tfor(u32 idx = 0; idx < m_renderCount; idx++) {\r\n\t\tCKLBRenderCommand * pRender = m_pRender[idx];\r\n\t\tif (pRender) {\r\n\t\t\tpRender->changeOrder(pRdr, order);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBNode::setPriorityL(u32 order) {\r\n\tsetPriority(order);\r\n\r\n\tCKLBNode* pNode = m_pChild;\r\n\twhile (pNode) {\r\n\t\tu32 clID = pNode->getClassID();\r\n\t\tif ((clID == CLS_KLBNODE) || (clID == CLS_KLBSPLINENODE)) {\r\n\t\t\t// Perform recursion\r\n\t\t\tpNode->setPriorityL(order);\r\n\t\t} else {\r\n\t\t\t// Stop and let the object handle it.\r\n\t\t\tpNode->setPriority(order);\r\n\t\t}\r\n\t\tpNode = pNode->m_pBrother;\r\n\t}\r\n}\r\n\r\n\r\nu32 CKLBNode::getPriority()\r\n{\r\n\tklb_assert(m_renderCount == 1, \"The node has two or more commands. \");\r\n\r\n\tCKLBRenderCommand * pRender = m_pRender[0];\r\n\tif (pRender) {\r\n\t\treturn pRender->getOrder();\r\n\t} else {\r\n\t\treturn 0;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/SceneGraph/CKLBNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === 2D Scene Graph ===\r\n//\r\n/*\r\n\tMemo about FLAGS\r\n\t\r\n\tA: RenderCommand Flags (All Sprite)\r\n\t------------------------------------\r\n\tm_uiStatus\r\n\t\tFLAG_XYUPDATE\t\t: Set  in Phase 2.1\r\n\t\tFLAG_COLORUPDATE\t: Set  in Phase 2.3 but uselessly set in many sprite setup.\r\n\t\tFLAG_UVUPDATE\t\t: Used in Phase 2.2 : => __Set in phase 0__ !\r\n\t\tFLAG_BUFFERSHIFT\t: When item \r\n\t\t\r\n\t\t\r\n\tB: Node Flags\r\n\t------------------------------------\r\n\t\tMATRIX_CHANGE\t\t: Set when matrix       changes or sprite recomputation.\r\n\t\tCMATRIX_CHANGE\t\t: Set when color vector changes or sprite recomputation.\r\n\t\tMARKED\t\t\t\t: Sub Node has changed.\r\n\r\n\tC: Phases\r\n\t------------------------------------\r\n\tPhase 0 : [Modification : user code modify tree or geometry and perform marking]\r\n\r\n\tPhase 1 : Modify Matrix / Tree Marking\r\n\t\t-> MATRIX_CHANGE / CMATRIX_CHANGE / MARKED flags are consumed.\r\n\t\t-> FLAG_UVUPDATE is used.\r\n\r\n\tPhase 2 : Apply  Transform\r\n\t\t2.1\tPre  XY -> Post XY\t\t\t\t: Transform coordinate from source image to sprite buffer.\r\n\t\t\t\t\t\t\t\t\t\t\t  FLAG_XYUPDATE Set.\r\n\r\n\t\t2.2\tCopy UV \t\t\t\t\t\t: FLAG_UVUPDATE used, copy UV to sprite buffer.\r\n\t\t\r\n\t\t2.3 Apply Color if CMATRIX_CHANGE\t: FLAG_COLORUPDATE update when color is applied.\r\n\r\n\tPhase 3 : Batch Render Call\t\t\t:\r\n\t\t- Copy or Skip based on flags\tFLAG_UVUPDATE, FLAG_XYUPDATE, FLAG_COLORUPDATE.\r\n\t\t- If FLAG_BUFFERSHIFT, all upper flags are forced to TRUE and copy is forced.\r\n\t\t\r\n\tD: What to do - Uses Cases\r\n\t------------------------------------\r\n\t- Add Sprite to node\t\t\t\t: owner node::markUpMatrix()\r\n\t- Sprite Geometry changed\t\t\t: owner node::markUpMatrix()\r\n\t- Sprite UV       changed\t\t\t: FLAG_UVUPDATE + owner node::markUpMatrix()\r\n\t\t\t\t\t\t\t\t\t\t  --> Lot of waste for just an UV copy in the end.\r\n\t- Sprite Color    changed\t\t\t: owner node::markUpColor()\r\n\t- Sprite Topology changed (ie vertex count change):\r\n\t\t\t\t\t\t\t\t\t\t: FLAG_BUFFERSHIFT set \r\n\t\t\t\t\t\t\t\t\t\t+ FLAG_UVUPDATE\r\n\t\t\t\t\t\t\t\t\t\t+ owner node::markUpMatrixColor() (MATRIX_CHANGE | CMATRIX_CHANGE)\r\n\t- Sprite Added to render list\t\t: FLAG_BUFFERSHIFT set\r\n\t- Sprite Removed from render list\t: FLAG_BUFFERSHIFT on next rendering item.\r\n\t- Matrix transform has changed\t\t: owner node::markUpMatrix()\r\n\t- Matrix color transform changed\t: owner node::markUpColor()\r\n\r\n\tE: Notes\r\n\t------------------------------------\r\n\t- Added a RENDER_CHANGE flag instead of markUpMatrix -> markUpRender()\r\n\t\tShould have a RENDER_CHANGE_GEO, RENDER_CHANGE_COLOR, RENDER_CHANGE_UV\r\n\t\t-> Avoid matrix and sub matrix recomputation.\r\n\r\n*/\r\n\r\n#ifndef __NODE_BASE__\r\n#define __NODE_BASE__\r\n\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBRendering.h\"\r\n\r\n\r\n#define _USE_MATH_DEFINES\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\nclass CKLBNode;\r\nclass CKLBUITask;\r\n\r\n/*!\r\n* \\class CKLBSystem\r\n* \\brief Node System Class\r\n* \r\n* CKLBSystem provides static methods to manage the Animation Node List.\r\n* It allows to separate the Node System from the rest of the Game Engine.\r\n*/\r\nclass CKLBSystem {\r\npublic:\r\n\tstatic void\t\t\tremoveFromAnimation\t\t(CKLBNode* pNode);\r\n\tstatic void\t\t\taddToAnimation\t\t\t(CKLBNode* pNode);\r\n\tstatic CKLBNode*\tgetAnimationNodeList\t();\r\n\tstatic void\t\t\tperformAnimationUpdate\t(u32 milliSecDelta);\r\n};\r\n\r\n//\r\n// Matrix Types\r\n//\r\n\r\n// Identity (color or coordinate matrix)\r\n#define MATRIX_ID\t\t\t\t(0)\r\n// Translation\r\n#define MATRIX_T\t\t\t\t(1)\r\n// Translation + Scale\r\n#define MATRIX_TS\t\t\t\t(2)\r\n// Translation + General\r\n#define MATRIX_TG\t\t\t\t(3)\r\n// Color\r\n#define MATRIX_COL\t\t\t\t(4)\r\n\r\n//\r\n// Matrix Indexes\r\n//\r\n#define MAT_A\t\t\t\t\t(0)\r\n#define MAT_B\t\t\t\t\t(1)\r\n#define MAT_C\t\t\t\t\t(2)\r\n#define MAT_D\t\t\t\t\t(3)\r\n#define MAT_TX\t\t\t\t\t(4)\r\n#define MAT_TY\t\t\t\t\t(5)\r\n\r\nstruct SMatrix2D {\r\n\tu8\t\tm_type;\t// T, TS, TG, Identity\r\n\tfloat\tm_matrix[6];\r\n\r\n\tSMatrix2D();\r\n};\r\n\r\nstruct SColorVector {\r\n\tu8\t\tm_type;\t// color / identity\r\n\tfloat\tm_vector[4];\r\n\tSColorVector();\r\n};\r\n\r\nclass CKLBController;\r\n\r\n/**\r\n\t\r\n */\r\n\r\n/*!\r\n* \\class CKLBNode\r\n* \\brief Scene Graphe Node Root Class\r\n* \r\n* CKLBNode is the root class for the Scene Graph.\r\n* Every Element of the Scene Graph is a CKLBNode or a derivated class.\r\n* Each CKLBNode owns a list of render objects to apply the transformations to.\r\n* The transformations are defined by matrices also owned by the CKLBNode.\r\n*\r\n* A CKLBNode can be linked with a CKLBUITask and in that case, they will point\r\n* each other. Moreover, the CKLBNode will be protected from destruction untill \r\n* the CKLBUITask is destroyed.\r\n* \r\n* Important points about the Scene Graph System :\r\n* - add/remove do also add/remove to the animation and rendering if associated \r\n*\tbit or object are set.\r\n* - add takes in account the fact that upper node of new_ node is visible to perform \r\n*\tthe modification in animation and rendering.\r\n* - node destruction also destroy all the sub system and includes render object associated.\r\n*/\r\nclass CKLBNode : public CKLBObject {\r\n\tfriend class CKLBSWFPlayer;\r\n\tfriend class CKLBSystem;\r\npublic:\r\n\tstatic float\ts_fLeftBorder;\r\n\tstatic float\ts_fRightBorder;\r\n\tstatic float\ts_fTopBorder;\r\n\tstatic float\ts_fBottomBorder;\r\n\r\n\tbool\t\tsetName\t\t\t\t(const char * name);\r\n\tCKLBNode*\tsearch\t\t\t\t(const char* name);\r\n\tCKLBNode*\tsearchFirstByTypeID\t(u32 typeID);\r\n\r\n\tinline const char * getName() const { return m_name; }\r\n\r\n\tCKLBNode();\r\n\tvirtual ~CKLBNode();\r\n\r\n\tvirtual\r\n\tCKLBNode*\tclone\t\t\t\t(CKLBNode* newItem, CKLBNode* parent, CKLBNode* brother, bool transferSpriteOwnership);\r\n\r\n\tinline\r\n\tvoid\t\tsetUITask\t\t\t(CKLBUITask* ptr) { m_uitask = ptr;\t}\r\n\r\n\tinline\r\n\tvoid\t\tresetAsInternalNode\t()\t{ m_bInternalNode = false; }\r\n\r\n\tinline\r\n\tbool\t\tisInternalNode\t\t()\t{ return m_bInternalNode; }\r\n\r\n\tinline\r\n\tCKLBUITask* getUITask\t\t\t()\t{ return m_uitask;\t\t}\r\n\r\n\tvirtual u32\tgetClassID\t\t\t()\t{ return CLS_KLBNODE;\t}\r\n\r\n\tvoid\t\tkickAnimation\t\t(const char* animName,u32* refCounterPtr, bool doBlend);\r\n\tvoid\t\tskipAnimation\t\t(const char* animName);\r\n\r\n\tvoid\t\tasRoot\t\t\t\t()\t{\tm_status = 0;\t// No upper invisible.\r\n\t\t\t\t\t\t\t\t\t\t\tm_pColorMatrix\t\t= &m_colorMatrix;\r\n\t\t\t\t\t\t\t\t\t\t\tm_useParentColor\t= false;\t\t\t} \r\n\r\n\tvoid\t\tdump\t\t\t\t(u32 level, u32 dumpMask = 0);\r\n\r\n\tvoid\t\tremoveNode\t\t\t(CKLBNode* pChild);\r\n\tvoid\t\taddNode\t\t\t\t(CKLBNode* pChild, u16 layer = 0);\r\n\r\n\tinline\r\n\tCKLBNode*\tgetNextAnimation\t()\t{ return m_pAnimationNext; }\r\n\r\n\tvirtual\r\n\tvoid\t\tanimate\t\t\t\t(u32 deltaTimeMilli)\t{ deltaTimeMilli = deltaTimeMilli; /*avoid warning*/ /* Default implementation do nothing */ }\r\n\r\n\tvoid\t\trecompute\t\t\t();\r\n\r\n\tvirtual\t\t\r\n\tvoid\t\trecomputeCustom\t\t()\t{ /* Do nothing default*/ }\r\n\r\n\tvirtual\r\n\tvoid\t\tsetPriority\t\t\t(u32 order);\r\n\r\n\tvoid\t\tsetPriorityL\t\t(u32 order);\r\n\r\n\tvirtual\r\n\tu32\t\t\tgetPriority\t\t\t();\r\n\r\n\tvoid\t\tmarkUpTree\t\t\t();\r\n\r\n\tinline\t\t\r\n\tvoid\t\tmarkUpRender\t\t() {\tm_status |= RENDER_CHANGE;\tmarkUpTree();\t}\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpMatrix\t\t() {\tm_status |= MATRIX_CHANGE;\tmarkUpTree();\t}\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpCustom\t\t() {\tm_status |= CUSTOM_CHANGE;\tmarkUpTree();\t}\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpColor\t\t\t() {\tm_status |= CMATRIX_CHANGE; markUpTree();   }\r\n\r\n\tinline\r\n\tvoid\t\tmarkUpMatrixAndColor() {\tm_status |= MATRIX_CHANGE | CMATRIX_CHANGE; markUpTree(); }\r\n\r\n\tvoid\t\tsetVisible\t\t\t(bool isVisible);\r\n\t\r\n\tinline \r\n\tbool\t\tisVisible\t\t\t()\t{ return (m_status & (INVISIBLE_UPPER | INVISIBLE)) == 0; }\r\n\r\n\tinline\r\n\tCKLBNode*\tgetChild\t\t\t()\t{ return m_pChild;\t}\r\n\r\n\tinline\r\n\tCKLBNode*\tgetBrother\t\t\t()\t{ return m_pBrother; }\r\n\r\n\tinline\r\n\tCKLBNode*\tgetParent\t\t\t()\t{ return m_parent;\t}\r\n\r\n\tinline\r\n\tu16\t\t\tgetLayer\t\t\t()\t{ return m_layer;\t}\r\n\r\n\tvoid\t\tsetRender\t\t\t(CKLBRenderCommand* pRender, u32 index = 0);\r\n\r\n\tvoid\t\tsetRenderOnDestroy\t(bool delete_) { this->m_deleteRender = delete_; }\r\n\r\n\tCKLBNode*\tsearchCommand\t\t(CKLBRenderCommand* comm);\r\n\r\n\tinline\r\n\tCKLBRenderCommand*\tgetRender\t(u32 index = 0)\t{\r\n\t\tklb_assert(index < m_renderCount, \"invalid render index\");\r\n\t\treturn m_pRender[index];\r\n\t}\r\n\r\n\tvoid\t\tsetTranslate\t\t(float x, float y)\t{\r\n\t\tif ((x != m_matrix.m_matrix[MAT_TX]) || (y != m_matrix.m_matrix[MAT_TY])) {\r\n\t\t\tm_status |= MATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\t\t\tm_matrix.m_matrix[MAT_TX] = x;\r\n\t\t\tm_matrix.m_matrix[MAT_TY] = y;\r\n\t\t\tif (m_matrix.m_type == MATRIX_ID) {\r\n\t\t\t\tm_matrix.m_type = MATRIX_T;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvoid\t\tsetRotation\t\t\t(float deg) {\r\n\t\tfloat rot = (deg * ((float)((M_PI) / 180.0)));\r\n\t\tif (rot != m_rot) {\r\n\t\t\tm_rot = rot;\r\n\t\t\trecMatrix();\r\n\t\t}\r\n\t}\r\n\r\n\tvoid\t\tsetScale\t\t\t(float scaleX, float scaleY) {\r\n\t\tif ((m_scaleX != scaleX) || (m_scaleY != scaleY)) {\r\n\t\t\tm_scaleX\t= scaleX;\r\n\t\t\tm_scaleY\t= scaleY;\r\n\t\t\trecMatrix();\r\n\t\t}\r\n\t}\r\n\r\n\tvoid\t\tsetScaleRotation\t(float scaleX, float scaleY, float deg) {\r\n\t\tfloat rot = (deg * ((float)((M_PI) / 180.0)));\r\n\t\tif ((m_scaleX != scaleX) || (m_scaleY != scaleY) || (rot != m_rot)) {\r\n\t\t\tm_scaleX\t= scaleX;\r\n\t\t\tm_scaleY\t= scaleY;\r\n\t\t\tm_rot = rot;\r\n\t\t\trecMatrix();\r\n\t\t}\r\n\t}\r\n\r\n\t#define _epsilon\t\t(0.00001f)\r\n\r\n\tvoid\t\trecMatrix\t\t\t() {\r\n\t\tif (fabs(m_rot) < _epsilon) {\r\n\t\t\tm_status |= MATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\t\t\tm_matrix.m_matrix[MAT_A] = m_scaleX;\r\n\t\t\tm_matrix.m_matrix[MAT_D] = m_scaleY;\r\n\t\t\tm_matrix.m_matrix[MAT_B] = 0.0f;\r\n\t\t\tm_matrix.m_matrix[MAT_C] = 0.0f;\r\n\t\t\tif (m_matrix.m_type < MATRIX_TS) {\r\n\t\t\t\tm_matrix.m_type = MATRIX_TS;\r\n\t\t\t} else {\r\n\t\t\t\tif ((m_scaleX <= (1.0f+_epsilon)) && (m_scaleX >= (1.0f-_epsilon)) && (m_scaleY >= (1.0f-_epsilon)) && (m_scaleY <= (1.0f+_epsilon))) {\r\n\t\t\t\t\tm_matrix.m_type = MATRIX_T;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tm_status |= MATRIX_CHANGE;\r\n\t\t\tmarkUpTree();\r\n\r\n\t\t\tfloat cosT = cos(m_rot);\r\n\t\t\tfloat sinT = sin(m_rot);\r\n\r\n\t\t\tm_matrix.m_matrix[MAT_A] =   cosT  * m_scaleX;\r\n\t\t\tm_matrix.m_matrix[MAT_B] = (-sinT) * m_scaleY;\t// or X / Y ?\r\n\r\n\t\t\tm_matrix.m_matrix[MAT_C] =   sinT  * m_scaleX;\r\n\t\t\tm_matrix.m_matrix[MAT_D] =   cosT  * m_scaleY;\r\n\r\n\t\t\tm_matrix.m_type = MATRIX_TG;\r\n\t\t}\r\n\t}\r\n\r\n\tfloat*\t\tsetMatrix\t\t\t() {\r\n\t\tm_status |= MATRIX_CHANGE;\r\n\t\tm_matrix.m_type = MATRIX_TG;\r\n\t\tmarkUpTree();\r\n\t\treturn m_matrix.m_matrix;\r\n\t}\r\n\r\n\tinline\tvoid getColorMatrix\t\t(SColorVector& color) {\r\n\t\tcolor = this->m_localColorMatrix;\r\n\t}\r\n\r\n\tvoid\t\tsetColorMatrix\t\t(SColorVector color) {\r\n\t\tm_status |= CMATRIX_CHANGE;\r\n\t\tm_localColorMatrix = color;\r\n\r\n\t\tif (\t(m_localColorMatrix.m_vector[0] != 1.0f) || \r\n\t\t\t\t(m_localColorMatrix.m_vector[1] != 1.0f) || \r\n\t\t\t\t(m_localColorMatrix.m_vector[2] != 1.0f) || \r\n\t\t\t\t(m_localColorMatrix.m_vector[3] != 1.0f) ) {\r\n\t\t\tm_pColorMatrix\t\t= &m_colorMatrix;\r\n\t\t\tm_useParentColor\t= false;\r\n\t\t} else {\r\n\t\t\tm_pColorMatrix\t\t= this->m_parent->m_pColorMatrix;\r\n\t\t\tm_useParentColor\t= true;\r\n\t\t}\r\n\r\n\t\tmarkUpTree();\r\n\t}\r\n\r\n\tinline void applyColor(CKLBRenderCommand* pRender) {\r\n\t\tconst float* pVec = m_pColorMatrix->m_vector;\r\n\t\tpRender->setColor(pVec);\r\n\t}\r\n\r\n\tinline float getScaleX      ()\t{ return m_scaleX;\t}\r\n\tinline float getScaleY      ()\t{ return m_scaleY;\t}\r\n\tinline float getRotation    ()\t{ return m_rot;\t\t}\r\n\tinline float getTranslateX  ()\t{ return m_matrix.m_matrix[MAT_TX]; }\r\n\tinline float getTranslateY  ()\t{ return m_matrix.m_matrix[MAT_TY]; }\r\n\r\n\tbool\tsetRenderSlotCount\t(u32 slot);\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tstatic u32\ts_vertexRecomputeCount;\r\n\tstatic u32\ts_matrixRecomputeCount;\r\n\tstatic u32  s_colorRecomputeCount;\r\n#endif\r\nprotected:\r\n\r\n\t// Should be visible from friend class.... but it is not !\r\n\tenum FLAGS_STATE {\r\n\t\t//\r\n\t\t// Change Flags\r\n\t\t//\r\n\t\tMATRIX_CHANGE\t= 0x0001,\r\n\t\tCMATRIX_CHANGE\t= 0x0002,\r\n\t\tCUSTOM_CHANGE\t= 0x0004,\r\n\t\tRENDER_CHANGE\t= 0x0008,\r\n\t\tANY_CHANGE\t\t= MATRIX_CHANGE | CMATRIX_CHANGE | CUSTOM_CHANGE | RENDER_CHANGE,\t// Force all recomputation\r\n\t\tMARKED\t\t\t= 0x0010,\r\n\t\t// 0x0020\t\t: Free\r\n\t\t// 0x0040\t\t: Free\r\n\r\n\t\t//\r\n\t\t// State Flags\r\n\t\t//\r\n\t\tINVISIBLE\t\t= 0x0100,\r\n\t\tINVISIBLE_UPPER\t= 0x0200,\r\n\r\n\t\t//\r\n\t\t// Various flags.\r\n\t\t//\r\n\t\tUNSET\t\t\t= 0x2000,\t// Used for recursion param\r\n\t\tUI_TYPE\t\t\t= 0x0080,\t// Exit just casting purpose.\r\n\t\tANIMATED\t\t= 0x4000\r\n\t};\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t//   Tree Management.\r\n\t// ------------------------------------------------------------------------\r\nprotected:\r\n\r\n\t// TODO LATER RP : Node can support its own render surface.\r\n\r\n\t//\r\n\t// Tree Management\r\n\t//\r\n\tCKLBNode*\r\n\t\t\tgetNode\t\t\t\t(u16 layer);\r\n\tvoid\tupdateMatrices\t\t();\r\n\tvoid\tclearSubTree\t\t();\r\n\r\n\tvoid\tvisibleUpperRecursive();\r\n\tvoid\tinvisibleUpperRecursive();\r\n\r\n\r\n\tvirtual\r\n\tvoid\tvisibleSelf\t\t\t();\r\n\r\n\tvirtual\r\n\tvoid\tinvisibleSelf\t\t();\r\n\r\n\tvirtual\r\n\tvoid\taddRender\t\t();\r\n\r\n\tvirtual\r\n\tvoid\tremoveRender\t();\r\n\r\n\tvoid\tsetRenderRef(CKLBRenderCommand* pRender, u32 indexRender);\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t//\tAnimation Management.\r\n\t// ------------------------------------------------------------------------\r\npublic:\t// Public for now...\r\n\t// Inside Animation Update\r\n\tinline bool\t\t\tisAnimating()\t\t{ return m_isAnimated; }\r\n\t// Animation Complete or not\r\n\tinline bool\t\t\tisStillAnimating()\t{ return (m_status & ANIMATED) ? true : false; }\r\n\r\nprotected:\r\n\tvoid\t\t\t\treleaseSlots();\r\n\r\n// Refactored for more compact class.\r\npublic:\t\tSMatrix2D \t\t\tm_matrix;\r\npublic:\t\tSMatrix2D\t\t\tm_composedMatrix;\r\npublic:\t\tSColorVector\t\tm_colorMatrix;\r\npublic:\t\tSColorVector\t\tm_localColorMatrix;\r\n\r\nprotected:\tconst char*\t\t\tm_name;\t\t\t// form name\r\nprotected:\tCKLBUITask*\t\t\tm_uitask;\r\nprotected:\tCKLBNode*\t\t\tm_pChild;\r\nprotected:\tCKLBNode*\t\t\tm_pBrother;\r\nprotected:\tCKLBNode*\t\t\tm_parent;\r\n\r\nprotected:\tCKLBNode*\t\t\tm_pAnimationNext;\r\nprotected:\tCKLBNode*\t\t\tm_pAnimationPrev;\r\n\r\npublic:\t\tSColorVector*\t\tm_pColorMatrix;\r\nprotected:\tCKLBRenderCommand**\tm_pRender;\r\nprotected:\tCKLBRenderCommand*\tm_renderSlot;\r\n\r\npublic:\t\tfloat\t\t\t\tm_rot;\r\npublic:\t\tfloat\t\t\t\tm_scaleX;\r\npublic:\t\tfloat\t\t\t\tm_scaleY;\r\nprotected:\tu32\t\t\t\t\tm_renderCount;\r\n\r\nprotected:\tu16\t\t\t\t\tm_groupID;\r\npublic:\t\tu16\t\t\t\t\tm_status;\r\nprotected:\tu16\t\t\t\t\tm_layer;\r\n\t// Was necessary in flash and necessary for flash leaf too.\r\n\t// Can reuse in other systems. \r\npublic:\t\tu16\t\t\t\t\tm_movieID;\r\npublic:\t\tu16\t\t\t\t\tm_updateFrame;\r\nprivate:\tu16\t\t\t\t\tm_nameLength;\r\n\r\nprotected:\tbool\t\t\t\tm_isAnimated;\r\nprotected:\tbool\t\t\t\tm_deleteRender;\r\nprotected:\tbool\t\t\t\tm_bInternalNode;\r\npublic:\t\tbool\t\t\t\tm_useParentColor;\r\nprotected:  bool\t\t\t\tm_reject;\r\n\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Scripting/CKLBGCTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifdef __CPP_VERSION__\r\n\r\n#include \"CKLBGCTask.h\"\r\n#include \"RuntimeLibrary/CS_Memory.h\"\r\n\r\nstatic CKLBTaskFactory<CKLBGCTask> factory(\"GCTask\", CLS_KLBGCTASK);\r\n\r\nCKLBGCTask::CKLBGCTask()\r\n: CKLBLuaPropTask\t\t()\r\n, m_timeBetweenGC\t\t(0)\r\n, m_lastGC\t\t\t\t(0)\r\n, m_lastMS\t\t\t\t(0)\r\n, m_lastGen1\t\t\t(0)\r\n, m_MSFrequency\t\t\t(0.02f)\r\n, m_Gen1Frequency\t\t(0.05f)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBGCTask::~CKLBGCTask() \r\n{\r\n}\r\n\r\nu32 CKLBGCTask::getClassID() { return CLS_KLBGCTASK; }\r\n\r\nCKLBGCTask* CKLBGCTask::create(u32 size, u32 rootCount, u16 multipleRefPageCount, u16 markAndSweepStackSize, u32 timeBetweenGC, float MSFrequency, float gen1Frequency) {\r\n\tCKLBGCTask* pTask = KLBNEW(CKLBGCTask);\r\n\tif (!pTask) { return NULL; }\r\n\tif (!pTask->init(size, rootCount, multipleRefPageCount, markAndSweepStackSize, timeBetweenGC, MSFrequency, gen1Frequency)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBGCTask::init(u32 size, u32 rootCount, u16 multipleRefPageCount, u16 markAndSweepStackSize, u32 timeBetweenGC, float MSFrequency, float gen1Frequency) {\r\n\tif(!(System::Memory::setGlobalMemory(size, rootCount, multipleRefPageCount, markAndSweepStackSize))) {\r\n\t\tklb_assertAlways(\"GC initialization has failed.\");\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_timeBetweenGC\t= timeBetweenGC;\r\n\tm_MSFrequency\t= MSFrequency;\r\n\tm_Gen1Frequency\t= gen1Frequency;\r\n\r\n\treturn regist(NULL, CKLBTask::TASK_PHASE::P_GC);\r\n}\r\n\r\nvoid\r\nCKLBGCTask::execute(u32 deltaT)\r\n{\r\n\tm_lastGC\t+= deltaT;\r\n\tm_lastMS\t+= deltaT;\r\n\tm_lastGen1\t+= deltaT;\r\n\r\n\tif(m_lastGC > m_timeBetweenGC) {\r\n\t\tu32 gcInfos = System::Memory::COMPACT_GEN0 | System::Memory::COMPACT_NOW;\r\n\t\tif(m_lastGen1 > m_timeBetweenGC / m_Gen1Frequency) {\r\n\t\t\tgcInfos |= System::Memory::COMPACT_GEN1;\r\n\t\t\tm_lastGen1 = 0;\r\n\t\t}\r\n\r\n\t\tif(m_lastMS > m_timeBetweenGC / m_MSFrequency) {\r\n\t\t\tCHECKMEM();\r\n\t\t\tSystem::Memory::compactionMS(gcInfos);\r\n\t\t\tCHECKMEM();\r\n\t\t\tm_lastMS = 0;\r\n\t\t} else {\r\n\t\t\tCHECKMEM();\r\n\t\t\tSystem::Memory::compactionSmall(gcInfos);\r\n\t\t\tCHECKMEM();\r\n\t\t}\r\n\t\tm_lastGC = 0;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBGCTask::die() \r\n{\r\n\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Scripting/CKLBGCTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBGCTask_h\r\n#define CKLBGCTask_h\r\n\r\n#include \"CKLBLuaPropTask.h\"\r\n\r\n/*!\r\n* \\class CKLBGCTask\r\n* \\brief Garbage Collection Task class\r\n* \r\n* /!\\ This task is only designed for the C# Scripting.\r\n* /!\\ This task has never been tested with a full game, just with basic samples.\r\n* \r\n* CKLBGCTask processes regular Garbage Collections while the game is running.\r\n* It must be used with the C++ C# Runtime.\r\n*/\r\nclass CKLBGCTask : public CKLBLuaPropTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBGCTask>;\r\nprivate:\r\n\tCKLBGCTask();\r\n\tvirtual ~CKLBGCTask();\r\n\tbool init(u32 size, u32 rootCount, u16 MultipleRefPageCount, u16 MarkAndSweepStackSize, u32 timeBetweenGC, float MSFrequency, float Gen1Frequency);\r\npublic:\r\n\tvirtual u32         getClassID();\r\n\tstatic CKLBGCTask*  create(u32 size, u32 rootCount, u16 MultipleRefPageCount, u16 MarkAndSweepStackSize, u32 timeBetweenGC, float MSFrequency, float Gen1Frequency);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tbool initScript(CLuaState& lua) { return true; }\r\n\r\nprivate:\r\n\tu32     m_timeBetweenGC;\r\n\tu32     m_lastGC;\r\n\tu32     m_lastMS;\r\n\tu32     m_lastGen1;\r\n\tfloat   m_MSFrequency;\r\n\tfloat   m_Gen1Frequency;\r\n\t\r\n};\r\n\r\n#endif // CKLBGCTask_h\r\n"
  },
  {
    "path": "Engine/source/Scripting/CKLBScriptEnv_forCSharp.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScriptEnv.h\"\t\r\n\r\n#ifdef __CSHARP_VERSION__\r\n\r\n//#undef DEBUG_WITH_MD\r\n\r\n#include \"CKLBUtility.h\"\r\n#include \"klb_vararg.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n\r\n//Mono includes\r\n#include <mono/jit/jit.h>\r\n#include <mono/metadata/object.h>\r\n#include <mono/metadata/environment.h>\r\n#include <mono/metadata/assembly.h>\r\n#include <mono/metadata/debug-helpers.h>\r\n#include <mono/metadata/mono-config.h>\r\n#include <mono/metadata/mono-debug.h>\r\n#include <mono/utils/mono-logger.h>\r\n#include <exception>\r\n\r\n#ifdef _WIN32\r\n#include <Windows.h>\r\n#endif\r\n\r\n\r\nclass CKLBScriptEnvCSharp : public CKLBScriptEnv {\r\npublic:\r\n\tstatic MonoDomain* s_domain;\r\n\r\n\tstatic MonoMethod* s_destroyPtr;\r\n\tstatic MonoMethod* s_worldCallBackPtr;\r\n\tstatic MonoMethod* s_doCallBackPtrV;\r\n\tstatic MonoMethod* s_doCallBackPtrII;\r\n\tstatic MonoMethod* s_doCallBackPtrIII;\r\n\tstatic MonoMethod* s_doCallBackPtrIIII;\r\n\tstatic MonoMethod* s_doCallBackPtrS;\r\n\tstatic MonoMethod* s_doCallBackPtrSII;\r\n\tstatic MonoMethod* s_doCallBackPtrSU;\r\n\tstatic MonoMethod* s_doCallBackPtrSS;\r\n\tstatic MonoMethod* s_doCallBackPtrUS;\r\n\tstatic MonoMethod* s_doCallBackPtrUSS;\r\n\tstatic MonoMethod* s_doCallBackPtrU;\r\n\tstatic MonoMethod* s_doCallBackPtrUU;\r\n\tstatic MonoMethod* s_doCallBackPtrUFF;\r\n\tstatic MonoMethod* s_doCallBackPtrUI;\r\n\tstatic MonoMethod* s_doCallBackPtrUII;\r\n\tstatic MonoMethod* s_doCallBackPtrUIIII;\r\n\tstatic MonoMethod* s_doCallBackPtrUIIUU;\r\n\tstatic MonoMethod* s_doCallBackPtrUUII;\r\n\tstatic MonoMethod* s_doCallBackPtrUUUII;\r\n\tstatic MonoMethod* s_doCallBackPtrIIIP_retB;\r\n\tstatic MonoMethod* s_doCallBackPtrFS;\r\n\r\n\tCKLBScriptEnvCSharp()\t{}\r\n\r\n\t~CKLBScriptEnvCSharp()\t{}\r\n};\r\n\r\nMonoDomain* CKLBScriptEnvCSharp::s_domain\t\t\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_destroyPtr\t\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_worldCallBackPtr\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrV\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrII\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrIII\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrIIII\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrS\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrSII\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrSU\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrSS\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUS\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUSS\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrU\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUU\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUFF\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUI\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUII\t\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUIIII\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUIIUU\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUUII\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrUUUII\t\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrIIIP_retB\t= NULL;\r\nMonoMethod* CKLBScriptEnvCSharp::s_doCallBackPtrFS\t\t\t= NULL;\r\n\r\n\r\nCKLBScriptEnv&\tCKLBScriptEnv::getInstance() {\r\n\tstatic CKLBScriptEnvCSharp env;\r\n\treturn env;\r\n}\r\n\r\nCKLBScriptEnv::CKLBScriptEnv() {\r\n}\r\n\r\nCKLBScriptEnv::~CKLBScriptEnv() {\r\n}\r\n\r\n//\r\n// CKLBScriptEnv_forCSharp.cpp\r\n//\t\r\nu32 m_call\t\t\t\t= 0;\r\nu32 g_errorFlag\t\t\t= 0;\r\nconst char* g_errorStr\t= NULL;\r\n\r\nu32* CKLBScriptEnv::getCallCounter()\r\n{\r\n\treturn &m_call;\r\n}\r\n\r\nu32* CKLBScriptEnv::getErrorReader() \r\n{\r\n\treturn &g_errorFlag;\r\n}\r\n\r\nconst char* CKLBScriptEnv::getErrorString()\r\n{\r\n\treturn g_errorStr;\r\n}\r\n\r\nvoid setError(const char* err) {\r\n\tg_errorFlag = 1;\r\n\tif (g_errorStr) {\r\n\t\tKLBDELETEA(g_errorStr);\r\n\t\tg_errorStr = NULL;\r\n\t}\r\n\tif (err) {\r\n\t\tg_errorStr = CKLBUtility::copyString(err);\r\n\t}\r\n}\r\n\r\nvoid CKLBScriptEnv::resetError()\r\n{\r\n\tg_errorFlag = 0;\r\n\tKLBDELETEA(g_errorStr);\r\n\tg_errorStr = NULL;\r\n}\r\n\r\nvoid CKLBScriptEnv::errMsg(const char * str) {\r\n\terror(str);\r\n}\r\n\r\nvoid CKLBScriptEnv::error(const char* fmt, ...) {\r\n\tva_list ap;\r\n\tva_start(ap, fmt);\r\n\tchar msg[1024];\r\n\tvsprintf(msg, fmt, ap);\r\n\tva_end(ap);\r\n\r\n\tsetError(msg);\r\n}\r\n\r\nbool CKLBScriptEnv::boot(const char* bootScriptURL)\r\n{\r\n\tCKLBScriptEnvCSharp* _this = reinterpret_cast<CKLBScriptEnvCSharp*>(this);\r\n\r\n\t//mono_set_dirs(\"../../libs/lib/\",\"../../etc/\");\r\n\tmono_set_dirs(\"C:\\\\Users\\\\Administrateur\\\\Desktop\\\\KLab\\\\KLABPROJ\\\\trunk\\\\Engine\\\\porting\\\\Win32\\\\Output\\\\Debug_CSharp\\\\libs\\\\lib\",\"../../etc/\");\r\n\tMonoAssembly* assembly;\r\n\tMonoMethodDesc* mdesc;\r\n\tMonoImage* image;\r\n\tMonoAssembly* bootAsm;\r\n\tMonoImage* bootImg;\r\n\r\n//TODO : better platform support\t\r\n#ifndef _WIN32\r\n#ifndef __MACH__\r\n\tmono_jit_set_aot_only(true);\r\n#endif\r\n#endif\r\n\r\n#ifdef DEBUG_WITH_MD\r\n\tmono_debug_init(MONO_DEBUG_FORMAT_MONO);\r\n\r\n\tchar* options[] = {\r\n\t\t\"--soft-breakpoints\", // makes mono embedded able to catch all C# exceptions.\r\n\t\t\"--debugger-agent=transport=dt_socket,address=127.0.0.1:10000\", // send debug messages to MonoDevelop listener\r\n\t};\r\n\tmono_jit_parse_options(sizeof(options)/sizeof(char*), (char**)options);\r\n#endif\r\n\r\n\t//const char* frameworkPath = CPFInterface::getInstance().platform().getFullPath(\"asset://MyCSharpLibForWindows.dll\");\r\n\tconst char* frameworkPath = \"C:\\\\KLabCSEG\\\\FrameworkTestSuite\\\\FrameworkTestSuite\\\\.publish\\\\iphone\\\\MyCSharpLibForWindows.dll\";\r\n\r\n\tCKLBScriptEnvCSharp::s_domain = mono_jit_init_version(frameworkPath, \"v4.0\");\r\n\tif(!CKLBScriptEnvCSharp::s_domain)\r\n\t{\r\n\t\tklb_assertAlways(\"Mono JIT init failed (this is NOT a matter of JIT).\");\r\n\t\treturn false;\r\n\t}\r\n\r\n#ifdef DEBUG_WITH_MD\r\n\tmono_debug_domain_create(CKLBScriptEnvCSharp::s_domain);\r\n#endif\r\n\r\n\ttry {\r\n\t\tassembly = mono_domain_assembly_open (CKLBScriptEnvCSharp::s_domain, frameworkPath);\r\n\t}\r\n\tcatch(...) {\r\n\t\tdelete[] frameworkPath;\r\n\t}\r\n\tif(!assembly) {\r\n\t\tklb_assertAlways(\"C# assembly loading failed.\");\r\n\t\treturn false;\r\n\t}\r\n\timage = mono_assembly_get_image(assembly);\r\n\r\n\t//const char* bootPath = CPFInterface::getInstance().platform().getFullPath(bootScriptURL);\r\n\tconst char* bootPath = \"C:\\\\KLabCSEG\\\\FrameworkTestSuite\\\\FrameworkTestSuite\\\\.publish\\\\iphone\\\\start.dll\";\r\n\ttry {\r\n\t\tbootAsm = mono_domain_assembly_open (CKLBScriptEnvCSharp::s_domain, bootPath);\r\n\t}\r\n\tcatch(...) {\r\n\t\tdelete[] bootPath;\r\n\t}\r\n\tif(!bootAsm) {\r\n\t\tklb_assertAlways(\"C# boot assembly loading failed.\");\r\n\t\treturn false;\r\n\t}\r\n\tbootImg = mono_assembly_get_image(bootAsm);\r\n\r\n\t//\r\n\t// Parameters for mono_method_desc_new() are optional if there is 1 and only 1 method with this name in C#.\r\n\t//\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:destroyFromNative(uint)\", false);\r\n\tCKLBScriptEnvCSharp::s_destroyPtr = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"CKLBWorld:callBackFunction\", false);\r\n\tCKLBScriptEnvCSharp::s_worldCallBackPtr = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackV(uint)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrV = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackII(uint,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackIII(uint,int,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrIII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackIIII(uint,int,int,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrIIII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackS(uint,intptr)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrS = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackSII(uint,intptr,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrSII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackSU(uint,intptr,uint)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrSU = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackSS(uint,intptr,intptr)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrSS = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUS(uint,uint,intptr)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUS = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUSS(uint,uint,intptr,intptr)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUSS = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackU(uint,uint)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrU = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\t\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUU(uint,uint,uint)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUU = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUFF\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUFF = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\t\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUI(uint,uint,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUI = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUII(uint,uint,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUIIII(uint,uint,int,int,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUIIII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\t\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUIIUU(uint,uint,int,int,uint,uint)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUIIUU = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUUII(uint,uint,uint,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUUII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\t\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackUUUII(uint,uint,uint,uint,int,int)\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrUUUII = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackIIIP_retB\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrIIIP_retB = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"NativeManagement:doCallBackFS\", false);\r\n\tCKLBScriptEnvCSharp::s_doCallBackPtrFS = mono_method_desc_search_in_image(mdesc,image);\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\tmdesc = mono_method_desc_new(\"Program:start\", false);\r\n\tMonoMethod *method = mono_method_desc_search_in_image(mdesc,bootImg);\r\n\tMonoObject* exception = 0;\r\n\tMonoObject* result = mono_runtime_invoke(method,NULL,NULL,&exception);\r\n\tif(exception)\t//an exception has been caught\r\n\t{\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"CKLBScriptEnv::boot raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n\r\n\tmono_method_desc_free(mdesc);\r\n\r\n\treturn true;\r\n}\r\n\r\n//Does nothing, function kept for compatibility with Lua.\r\nbool CKLBScriptEnv::setupScriptEnv() {\r\n\treturn true;\r\n}\r\n\r\nvoid CKLBScriptEnv::finishScriptEnv() {\r\n\tresetError();\r\n\t\r\n\t// TODO C# : determine how to do it the right way.\r\n\t/*\r\n\tmono_debug_cleanup();\r\n\t\r\n\tmono_jit_cleanup(CKLBScriptEnvCSharp::s_domain);\r\n\tif(!mono_domain_finalize(CKLBScriptEnvCSharp::s_domain, 0)) {\r\n\t\tklb_assertAlways(\"Mono domain did not finalized correctly.\");\r\n\t}\r\n\t\r\n\tCKLBScriptEnvCSharp::s_domain = NULL;\r\n\t*/\r\n}\r\n\r\n\r\n\r\nvoid CKLBScriptEnv::destroy(u32 handle)\r\n{\r\n\tvoid* args[2];\r\n\targs[0] = &handle;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_destroyPtr,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"CKLBScriptEnv::destroy raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\n\r\nvoid callbackV(u32 cbInfos)\r\n{\r\n\tvoid* args[1];\r\n\targs[0] = &cbInfos;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrV,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackV raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackII(u32 cbInfos, s32 int_1, s32 int_2)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &int_1;\r\n\targs[2] = &int_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackIII(u32 cbInfos, s32 int_1, s32 int_2, s32 int_3)\r\n{\r\n\tvoid* args[4];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &int_1;\r\n\targs[2] = &int_2;\r\n\targs[3] = &int_3;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrIII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackIII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackIIII(u32 cbInfos, s32 int_1, s32 int_2, s32 int_3, s32 int_4)\r\n{\r\n\tvoid* args[5];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &int_1;\r\n\targs[2] = &int_2;\r\n\targs[3] = &int_3;\r\n\targs[4] = &int_4;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrIIII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackIIII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackS(u32 cbInfos, const char* string_1)\r\n{\r\n\tvoid* args[2];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &string_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrS,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackS raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackSII(u32 cbInfos, const char* string_1, s32 int_1, s32 int_2)\r\n{\r\n\tvoid* args[4];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &string_1;\r\n\targs[2] = &int_1;\r\n\targs[3] = &int_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrSII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackSII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackSU(u32 cbInfos, const char* string_1, u32 uint_1)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &string_1;\r\n\targs[2] = &uint_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrSU,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackSU raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackSS(u32 cbInfos, const char* string_1, const char* string_2)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &string_1;\r\n\targs[2] = &string_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrSS,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackSS raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUS(u32 cbInfos, u32 uint_1, const char* string_1)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &string_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUS,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUS raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUSS(u32 cbInfos, u32 uint_1, const char* string_1, const char* string_2)\r\n{\r\n\tvoid* args[4];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &string_1;\r\n\targs[3] = &string_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUSS,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUSS raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackU(u32 cbInfos, u32 uint_1)\r\n{\r\n\tvoid* args[2];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrU,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackU raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUU(u32 cbInfos, u32 uint_1, u32 uint_2)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &uint_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUU,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUU raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUFF(u32 cbInfos, u32 uint_1, float float_1, float float_2)\r\n{\r\n\tvoid* args[4];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &float_1;\r\n\targs[3] = &float_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUFF,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUFF raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUI(u32 cbInfos, u32 uint_1, s32 int_1)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &int_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUI,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUI raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUII(u32 cbInfos, u32 uint_1, s32 int_1, s32 int_2)\r\n{\r\n\tvoid* args[4];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &int_1;\r\n\targs[3] = &int_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUIIII(u32 cbInfos, u32 uint_1, s32 int_1, s32 int_2, s32 int_3, s32 int_4)\r\n{\r\n\tvoid* args[6];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &int_1;\r\n\targs[3] = &int_2;\r\n\targs[4] = &int_3;\r\n\targs[5] = &int_4;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUIIII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUIIII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUIIUU(u32 cbInfos, u32 uint_1, s32 int_1, s32 int_2, u32 uint_2, u32 uint_3)\r\n{\r\n\tvoid* args[6];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &int_1;\r\n\targs[3] = &int_2;\r\n\targs[4] = &uint_2;\r\n\targs[5] = &uint_3;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUIIUU,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUIIUU raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUUII(u32 cbInfos, u32 uint_1, u32 uint_2, s32 int_1, s32 int_2)\r\n{\r\n\tvoid* args[5];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &uint_2;\r\n\targs[3] = &int_1;\r\n\targs[4] = &int_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUUII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUUII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nvoid callbackUUUII(u32 cbInfos, u32 uint_1, u32 uint_2, u32 uint_3, s32 int_1, s32 int_2)\r\n{\r\n\tvoid* args[6];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &uint_1;\r\n\targs[2] = &uint_2;\r\n\targs[3] = &uint_3;\r\n\targs[4] = &int_1;\r\n\targs[5] = &int_2;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrUUUII,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackUUUII raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\nbool callbackIIIP_retB(u32 cbInfos, s32 int_1, s32 int_2, s32 int_3, void* ptr_1)\r\n{\r\n\tvoid* args[5];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &int_1;\r\n\targs[2] = &int_2;\r\n\targs[3] = &int_3;\r\n\targs[4] = &ptr_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrIIIP_retB,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackIIIP_retB raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n\tif(result) {\r\n\t\treturn *(int*)mono_object_unbox(result);\r\n\t}\r\n}\r\nvoid callbackFS(u32 cbInfos, float float_1, const char* string_1)\r\n{\r\n\tvoid* args[3];\r\n\targs[0] = &cbInfos;\r\n\targs[1] = &float_1;\r\n\targs[2] = &string_1;\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_doCallBackPtrFS,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t\tDEBUG_PRINT(\"callbackFS raised an exception : %s\", mono_string_to_utf8(message));\r\n\t}\r\n}\r\n\r\nvoid CKLBScriptEnv::call_onDie\t\t\t\t\t(const char* funcNAme, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// This callback is stored for each C# Object with an index of 5 in the Delegate array.\r\n\tcallbackV((5<<29) + objectHandle);\r\n}\r\n\r\n// Generic Task\r\nvoid CKLBScriptEnv::call_genTaskExecute\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 deltaT, const char* arrayIndex)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackU(objectHandle, deltaT);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_genTaskDie\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* arrayIndex)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tif(objectHandle != _NULLHANDLER) {\r\n\t\tcallbackV((1<<29) + objectHandle);\r\n\t}\r\n}\r\n\r\nvoid CKLBScriptEnv::call_intervalTimerExecute\t(const char* funcName, CKLBObjectScriptable* obj, u32 timerID)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// timerID is useless for C#\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_asyncLoader\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 loaded, u32 total)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUU(objectHandle, loaded, total);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_asyncFileCopy\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 donePerc, u32 doneSize) \r\n{\r\n    klb_assertAlways(\"TODO\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_webTask\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* url)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUS(objectHandle, type, url);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_pause\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_resume\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_storeEvent\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* itemID, const char* param)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUSS(objectHandle, type, itemID, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_fromSincVM\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id, s32 param)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUI(objectHandle, id, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventVirtualDoc\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 param1, s32 param2, s32 param3, s32 param4)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, param1, param2, param3, param4);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_touchPad\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tklb_assertAlways(\"Call back interface for C#\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_touchPadCSharp\t\t\t(CKLBObjectScriptable* obj, u32 execount, u32 type, u32 id, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUUUII(objectHandle, execount, type, id, x, y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_button                 (const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n    klb_assertAlways(\"TODO\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_textInput\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* txt, u32 id)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackSU(objectHandle, txt, id);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventSelectable\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* name, s32 type, s32 param)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackSII(objectHandle, name, type, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventSwf\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* label)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackS(objectHandle, label);\r\n}\r\n\r\n// 2 call back for list\r\n\r\nvoid CKLBScriptEnv::call_eventUIListDynamic\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 index, u32 id) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII((2<<29) + objectHandle, index, id);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIList\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemCnt, s32 listLength, s32 pos)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUUII((1<<29) + objectHandle, type, itemCnt, listLength, pos);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIListDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 param1, s32 param2)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, param1, param2);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventDragIF\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, deltaX, deltaY);\r\n}\r\n\r\n// UI Control\r\n// 5 call back for UI Control\r\nvoid CKLBScriptEnv::call_eventUIControlDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, deltaX, deltaY);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlPinch\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, float pinch, float rot)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUFF((1<<29) + objectHandle, type, pinch, rot);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlClick\t(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII((2<<29) + objectHandle, x, y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlDblClick\t(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII((3<<29) + objectHandle, x, y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlLongTap\t(const char* funcName, CKLBObjectScriptable* obj, u32 time, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUII((4<<29) + objectHandle, time, x, y);\r\n}\r\n\r\n// UI Drag Icon\r\nvoid CKLBScriptEnv::call_eventDragIcon\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 dragX, s32 dragY)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUII(objectHandle, type, dragX, dragY);\r\n}\r\n\r\n// UI Movie\r\nvoid CKLBScriptEnv::call_eventMovie\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\n// UI Cell Anim\r\nvoid CKLBScriptEnv::call_eventCellAnim\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\n// UI Canvas\r\nvoid CKLBScriptEnv::call_canvasOnDraw\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\n// UI Node Pack Anim\r\nvoid CKLBScriptEnv::call_eventNodeAnimPack\t(const char* funcName, CKLBObjectScriptable* obj, const char * name, u32 id)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// Special Case : owned by different classes : use 4 to avoid conflict.\r\n\tcallbackSU((4<<29) + objectHandle, name, id);\r\n}\r\n\r\n// UI Touch Event UI\r\nvoid CKLBScriptEnv::call_eventUITouchEvent\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 dx, s32 dy)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, dx, dy);\r\n}\r\n\r\n// CKLBDebugMenu\r\nvoid CKLBScriptEnv::call_eventDebugItem\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackU(objectHandle, id);\r\n}\r\n\r\n// UI Scroll Bar / UI List task\r\nvoid CKLBScriptEnv::call_eventScrollBar\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 pos)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUI((3<<29) + objectHandle, type, pos);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventScrollBarStop\t(const char* funcName, CKLBObjectScriptable* obj, s32 pos)\r\n{\r\n\tif(!obj) { return; }\r\n\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUI((3<<29) + objectHandle, CKLBScrollBarIF::SCROLLBAR_STOPPED, pos);\r\n}\r\n\r\n// World Task\r\nvoid CKLBScriptEnv::call_eventWorld\t\t\t(const char* funcName, CKLBObjectScriptable* obj, s32 serial, s32 msg, s32 status)\r\n{\r\n\tm_call++;\r\n\tvoid* args[4];\r\n\targs[0] = &serial;\r\n\targs[1] = &msg;\r\n\targs[2] = &status;\r\n\targs[3] = (int*)&funcName; // funcname is in fact an int* to the callback index.\r\n\tMonoObject* exception;\r\n\tMonoObject* result = mono_runtime_invoke(CKLBScriptEnvCSharp::s_worldCallBackPtr,NULL,args,&exception);\r\n\tif(exception) {\r\n\t\tMonoString* message = mono_object_to_string(exception,NULL);\r\n\t}\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateDownload\t(const char* funcName, CKLBObjectScriptable* obj, double progress, const char* progressStr) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackFS(objectHandle,(float)progress,progressStr);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateZIP\t\t(const char* funcName, CKLBObjectScriptable* obj, s32 progress, s32 total) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII(objectHandle,progress,total);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateComplete\t(const char* funcName, CKLBObjectScriptable* obj) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateError(const char* funcName, CKLBObjectScriptable* obj) {\r\n    klb_assertAlways(\"TODO\");\r\n}\r\n\r\nbool CKLBScriptEnv::call_netAPI_callback(const char* funcName, CKLBObjectScriptable* obj, s32 uniq, s32 msg, s32 status, CKLBJsonItem * pRoot) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\treturn callbackIIIP_retB(objectHandle,uniq,msg,status,pRoot);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_netAPI_versionUp\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* clientVer, const char* serverVer) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackSS((1<<29) + objectHandle,clientVer,serverVer);\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Scripting/CKLBScriptEnv_forCpp.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n#ifdef __CPP_VERSION__\r\n\r\n#include \"CKLBUtility.h\"\r\n#include \"klb_vararg.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"RuntimeLibrary/CS_Object.h\"\r\n#include \"RuntimeLibrary/CS_System.h\"\r\n#include \"RuntimeLibrary/CS_Memory.h\"\r\n#include \"callbackDef.h\"\r\n#include \"CKLBGCTask.h\"\r\n\r\n/*static*/ CallbackDef::FP_V\t\t\tCallbackDef::s_start\t\t\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_U\t\t\tCallbackDef::s_destroyPtr\t\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_IIII\t\t\tCallbackDef::s_worldCallBackPtr\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_U\t\t\tCallbackDef::s_doCallBackPtrV\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UII\t\t\tCallbackDef::s_doCallBackPtrII\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UIII\t\t\tCallbackDef::s_doCallBackPtrIII\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UIIII\t\tCallbackDef::s_doCallBackPtrIIII\t\t= NULL;\r\n/*static*/ CallbackDef::FP_US\t\t\tCallbackDef::s_doCallBackPtrS\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_USII\t\t\tCallbackDef::s_doCallBackPtrSII\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_USU\t\t\tCallbackDef::s_doCallBackPtrSU\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_USS\t\t\tCallbackDef::s_doCallBackPtrSS\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUS\t\t\tCallbackDef::s_doCallBackPtrUS\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUSS\t\t\tCallbackDef::s_doCallBackPtrUSS\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UU\t\t\tCallbackDef::s_doCallBackPtrU\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUU\t\t\tCallbackDef::s_doCallBackPtrUU\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUFF\t\t\tCallbackDef::s_doCallBackPtrUFF\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUI\t\t\tCallbackDef::s_doCallBackPtrUI\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUII\t\t\tCallbackDef::s_doCallBackPtrUII\t\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUIIII\t\tCallbackDef::s_doCallBackPtrUIIII\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUIIUU\t\tCallbackDef::s_doCallBackPtrUIIUU\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUUII\t\tCallbackDef::s_doCallBackPtrUUII\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UUUUII\t\tCallbackDef::s_doCallBackPtrUUUII\t\t= NULL;\r\n/*static*/ CallbackDef::FP_UIIIP_retB\tCallbackDef::s_doCallBackPtrIIIP_retB\t= NULL;\r\n/*static*/ CallbackDef::FP_UFS\t\t\tCallbackDef::s_doCallBackPtrFS\t\t\t= NULL;\r\n\r\nclass CKLBScriptEnvCpp : public CKLBScriptEnv {\r\npublic:\r\n\tCKLBScriptEnvCpp()\t{}\r\n\t~CKLBScriptEnvCpp()\t{}\r\n};\r\n\r\nCKLBScriptEnv&\tCKLBScriptEnv::getInstance() {\r\n\tstatic CKLBScriptEnvCpp env;\r\n\treturn env;\r\n}\r\n\r\nCKLBScriptEnv::CKLBScriptEnv() {\r\n}\r\n\r\nCKLBScriptEnv::~CKLBScriptEnv() {\r\n}\r\n\r\n//\r\n// CKLBScriptEnv_forCpp.cpp\r\n//\r\nu32 m_call\t\t\t\t= 0;\r\nu32 g_errorFlag\t\t\t= 0;\r\nconst char* g_errorStr\t= NULL;\r\n\r\nu32* CKLBScriptEnv::getCallCounter() {\r\n\treturn &m_call;\r\n}\r\n\r\nu32* CKLBScriptEnv::getErrorReader() {\r\n\treturn &g_errorFlag;\r\n}\r\n\r\nconst char* CKLBScriptEnv::getErrorString() {\r\n\treturn g_errorStr;\r\n}\r\n\r\nvoid setError(const char* err) {\r\n\tg_errorFlag = 1;\r\n\tif (g_errorStr) {\r\n\t\tKLBDELETEA(g_errorStr);\r\n\t\tg_errorStr = NULL;\r\n\t}\r\n\tif (err) {\r\n\t\tg_errorStr = CKLBUtility::copyString(err);\r\n\t}\r\n}\r\n\r\nvoid CKLBScriptEnv::resetError() {\r\n\tg_errorFlag = 0;\r\n\tKLBDELETEA(g_errorStr);\r\n\tg_errorStr = NULL;\r\n}\r\n\r\nvoid CKLBScriptEnv::errMsg(const char * str) {\r\n\terror(str);\r\n}\r\n\r\nvoid CKLBScriptEnv::error(const char* fmt, ...) {\r\n\tva_list ap;\r\n\tva_start(ap, fmt);\r\n\tchar msg[1024];\r\n\tvsprintf(msg, fmt, ap);\r\n\tva_end(ap);\r\n\r\n\tsetError(msg);\r\n}\r\n\r\nbool CKLBScriptEnv::boot(const char* bootScriptURL)\r\n{\r\n\tif(CKLBGCTask::create(15000000, 2048, 4096, 4096, 100, 1.0f, 1.0f)) {\r\n\t\tTRY\r\n\t\t\tSystem::initRuntime();\r\n\t\t\tregisterWorldGC();\r\n\t\t\tCallbackDef::s_start();\r\n\t\tCTRY\r\n\t\tFIRSTCATCH(System::Exception, ex)\r\n\t\t\tDEBUG_PRINT(\"Exception raised during CKLBScriptEnv::boot : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\t\t\treturn false;\r\n\t\tFINALLY\r\n\t\tETRY\r\n\t\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\n//Does nothing, function kept for compatibility with Lua.\r\nbool CKLBScriptEnv::setupScriptEnv() {\r\n\treturn true;\r\n}\r\n\r\nvoid CKLBScriptEnv::finishScriptEnv() {\r\n\tresetError();\r\n}\r\n\r\n\r\n\r\nvoid CKLBScriptEnv::destroy(u32 handle)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_destroyPtr(handle);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"CKLBScriptEnv::destroy raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\n\r\nvoid callbackV(u32 cbInfos)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrV(cbInfos);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\tDEBUG_PRINT(\"callbackV raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackII(u32 cbInfos, s32 int_1, s32 int_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrII(cbInfos, int_1, int_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackIII(u32 cbInfos, s32 int_1, s32 int_2, s32 int_3)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrIII(cbInfos, int_1, int_2, int_3);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackIII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackIIII(u32 cbInfos, s32 int_1, s32 int_2, s32 int_3, s32 int_4)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrIIII(cbInfos, int_1, int_2, int_3, int_4);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackIIII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackS(u32 cbInfos, const char* string_1)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrS(cbInfos, (s32*)string_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackS raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackSII(u32 cbInfos, const char* string_1, s32 int_1, s32 int_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrSII(cbInfos, (s32*)string_1, int_1, int_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackSII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackSU(u32 cbInfos, const char* string_1, u32 uint_1)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrSU(cbInfos, (s32*)string_1, uint_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackSU raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackSS(u32 cbInfos, const char* string_1, const char* string_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrSS(cbInfos, (s32*)string_1, (s32*)string_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackSS raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUS(u32 cbInfos, u32 uint_1, const char* string_1)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUS(cbInfos, uint_1, (s32*)string_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUS raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUSS(u32 cbInfos, u32 uint_1, const char* string_1, const char* string_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUSS(cbInfos, uint_1, (s32*)string_1, (s32*)string_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUSS raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackU(u32 cbInfos, u32 uint_1)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrU(cbInfos, uint_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackU raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUU(u32 cbInfos, u32 uint_1, u32 uint_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUU(cbInfos, uint_1, uint_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUU raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUFF(u32 cbInfos, u32 uint_1, float float_1, float float_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUFF(cbInfos, uint_1, float_1, float_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUFF raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUI(u32 cbInfos, u32 uint_1, s32 int_1)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUI(cbInfos, uint_1, int_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUI raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUII(u32 cbInfos, u32 uint_1, s32 int_1, s32 int_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUII(cbInfos, uint_1, int_1, int_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUIIII(u32 cbInfos, u32 uint_1, s32 int_1, s32 int_2, s32 int_3, s32 int_4)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUIIII(cbInfos, uint_1, int_1, int_2, int_3, int_4);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUIIII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUIIUU(u32 cbInfos, u32 uint_1, s32 int_1, s32 int_2, u32 uint_2, u32 uint_3)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUIIUU(cbInfos, uint_1, int_1, int_2, uint_2, uint_3);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUIIUU raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUUII(u32 cbInfos, u32 uint_1, u32 uint_2, s32 int_1, s32 int_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUUII(cbInfos, uint_1, uint_2, int_1, int_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUUII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackUUUII(u32 cbInfos, u32 uint_1, u32 uint_2, u32 uint_3, s32 int_1, s32 int_2)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrUUUII(cbInfos, uint_1, uint_2, uint_3, int_1, int_2);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackUUUII raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nbool callbackIIIP_retB(u32 cbInfos, s32 int_1, s32 int_2, s32 int_3, void* ptr_1)\r\n{\r\n\tTRY\r\n\t\treturn CallbackDef::s_doCallBackPtrIIIP_retB(cbInfos, int_1, int_2, int_3, (s32*)ptr_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackIIIP_retB raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\nvoid callbackFS(u32 cbInfos, float float_1, const char* string_1)\r\n{\r\n\tTRY\r\n\t\tCallbackDef::s_doCallBackPtrFS(cbInfos, float_1, (s32*)string_1);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackFS raised an exception : %s\", ex->_acc_gMessage$()->_toCStr$());\r\n\tFINALLY\r\n\tETRY\r\n}\r\n\r\nvoid CKLBScriptEnv::call_onDie\t\t\t\t\t(const char* funcNAme, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// This callback is stored for each C# Object with an index of 5 in the Delegate array.\r\n\tcallbackV((5<<29) + objectHandle);\r\n}\r\n\r\n// Generic Task\r\nvoid CKLBScriptEnv::call_genTaskExecute\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 deltaT, const char* arrayIndex)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackU(objectHandle, deltaT);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_genTaskDie\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* arrayIndex)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tif(objectHandle != _NULLHANDLER) {\r\n\t\tcallbackV((1<<29) + objectHandle);\r\n\t}\r\n}\r\n\r\nvoid CKLBScriptEnv::call_intervalTimerExecute\t(const char* funcName, CKLBObjectScriptable* obj, u32 timerID)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// timerID is useless for C#\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_asyncLoader\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 loaded, u32 total)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII(objectHandle, loaded, total);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_asyncFileCopy\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 donePerc, u32 doneSize)\r\n{\r\n    m_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// TODO\r\n}\r\n\r\nvoid CKLBScriptEnv::call_webTask\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* url)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUS(objectHandle, type, url);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_pause\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_resume\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_storeEvent\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* itemID, const char* param)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUSS(objectHandle, type, itemID, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_fromSincVM\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id, s32 param)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUI(objectHandle, id, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventVirtualDoc\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 param1, s32 param2, s32 param3, s32 param4)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, param1, param2, param3, param4);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_touchPad\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tklb_assertAlways(\"Call back interface for C#\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_touchPadCSharp\t\t\t(CKLBObjectScriptable* obj, u32 execount, u32 type, u32 id, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUUUII(objectHandle, execount, type, id, x, y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_button\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n    m_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// TODO\r\n}\r\n\r\nvoid CKLBScriptEnv::call_textInput\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* txt, u32 id)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackSU(objectHandle, txt, id);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventSelectable\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* name, s32 type, s32 param)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackSII(objectHandle, name, type, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventSwf\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* label)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackS(objectHandle, label);\r\n}\r\n\r\n// 2 call back for list\r\n\r\nvoid CKLBScriptEnv::call_eventUIListDynamic\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 index, u32 id) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII((2<<29) + objectHandle, index, id);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIList\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemCnt, s32 listLength, s32 pos)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUUII((1<<29) + objectHandle, type, itemCnt, listLength, pos);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIListDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 param1, s32 param2)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, param1, param2);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventDragIF\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, deltaX, deltaY);\r\n}\r\n\r\n// UI Control\r\n// 5 call back for UI Control\r\nvoid CKLBScriptEnv::call_eventUIControlDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, deltaX, deltaY);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlPinch\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, float pinch, float rot)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUFF((1<<29) + objectHandle, type, pinch, rot);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlClick\t(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII((2<<29) + objectHandle, x, y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlDblClick\t(const char* funcName, CKLBObjectScriptable* obj, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII((3<<29) + objectHandle, x, y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlLongTap\t(const char* funcName, CKLBObjectScriptable* obj, u32 time, s32 x, s32 y)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUII((4<<29) + objectHandle, time, x, y);\r\n}\r\n\r\n// UI Drag Icon\r\nvoid CKLBScriptEnv::call_eventDragIcon\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 dragX, s32 dragY)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUII(objectHandle, type, dragX, dragY);\r\n}\r\n\r\n// UI Movie\r\nvoid CKLBScriptEnv::call_eventMovie\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\n// UI Cell Anim\r\nvoid CKLBScriptEnv::call_eventCellAnim\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\n// UI Canvas\r\nvoid CKLBScriptEnv::call_canvasOnDraw\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\n// UI Node Pack Anim\r\nvoid CKLBScriptEnv::call_eventNodeAnimPack\t(const char* funcName, CKLBObjectScriptable* obj, const char * name, u32 id)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// Special Case : owned by different classes : use 4 to avoid conflict.\r\n\tcallbackSU((4<<29) + objectHandle, name, id);\r\n}\r\n\r\n// UI Touch Event UI\r\nvoid CKLBScriptEnv::call_eventUITouchEvent\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 dx, s32 dy)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUIIII(objectHandle, type, x, y, dx, dy);\r\n}\r\n\r\n// CKLBDebugMenu\r\nvoid CKLBScriptEnv::call_eventDebugItem\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackU(objectHandle, id);\r\n}\r\n\r\n// UI Scroll Bar / UI List task\r\nvoid CKLBScriptEnv::call_eventScrollBar\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 pos)\r\n{\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUI((3<<29) + objectHandle, type, pos);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventScrollBarStop\t(const char* funcName, CKLBObjectScriptable* obj, s32 pos)\r\n{\r\n\tif(!obj) { return; }\r\n\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackUI((3<<29) + objectHandle, CKLBScrollBarIF::SCROLLBAR_STOPPED, pos);\r\n}\r\n\r\n\r\n\r\n// World Task\r\nvoid CKLBScriptEnv::call_eventWorld(const char* funcName, CKLBObjectScriptable* obj, s32 serial, s32 msg, s32 status)\r\n{\r\n\tm_call++;\r\n\t\r\n\tTRY\r\n\t\t// funcname is in fact an int* to the callback index.\r\n\t\tCallbackDef::s_worldCallBackPtr(serial, msg, status, *(int*)funcName);\r\n\tCTRY\r\n\tFIRSTCATCH(System::Exception, ex)\r\n\t\tDEBUG_PRINT(\"callbackV raised an exception.\");\r\n\tFINALLY\r\n\tETRY\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateDownload\t(const char* funcName, CKLBObjectScriptable* obj, double progress, const char* progressStr) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackFS(objectHandle,(float)progress,progressStr);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateZIP\t\t(const char* funcName, CKLBObjectScriptable* obj, s32 progress, s32 total) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackII(objectHandle,progress,total);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateComplete\t(const char* funcName, CKLBObjectScriptable* obj) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackV(objectHandle);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateError(const char* funcName, CKLBObjectScriptable* obj) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\t// TODO\r\n}\r\n\r\nbool CKLBScriptEnv::call_netAPI_callback(const char* funcName, CKLBObjectScriptable* obj, s32 uniq, s32 msg, s32 status, CKLBJsonItem * pRoot) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\treturn callbackIIIP_retB(objectHandle,uniq,msg,status,pRoot);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_netAPI_versionUp\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* clientVer, const char* serverVer) {\r\n\tm_call++;\r\n\tu32 objectHandle = obj->getScriptHandle();\r\n\tklb_assert(objectHandle != _NULLHANDLER,\"ScriptHandle is null\");\r\n\tcallbackSS((1<<29) + objectHandle,clientVer,serverVer);\r\n}\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Scripting/CKLBScriptEnv_forLUA.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScriptEnv.h\"\t\r\n\r\n#ifndef __CSHARP_VERSION__\r\n#ifndef __CPP_VERSION__\r\n\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"klb_vararg.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBLuaScript.h\"\r\n\r\nCKLBScriptEnv::CKLBScriptEnv() {\r\n}\r\n\r\nCKLBScriptEnv::~CKLBScriptEnv() {\r\n}\r\n\r\nCKLBScriptEnv&\tCKLBScriptEnv::getInstance() {\r\n\tstatic CKLBScriptEnv env;\r\n\treturn env;\r\n}\r\n\r\n//\r\n// CKLBScriptEnv_forLUA.cpp\r\n//\t\r\n\r\nu32* CKLBScriptEnv::getCallCounter()\r\n{\r\n\treturn NULL;\r\n}\r\n\r\nu32* CKLBScriptEnv::getErrorReader() \r\n{\r\n\treturn NULL;\r\n}\r\n\r\nconst char* CKLBScriptEnv::getErrorString()\r\n{\r\n\treturn NULL;\r\n}\r\n\r\nvoid CKLBScriptEnv::resetError()\r\n{\r\n}\r\n\r\nbool CKLBScriptEnv::boot(const char* bootScriptURL)\r\n{\r\n\treturn CKLBLuaScript::create(bootScriptURL) != NULL;\r\n}\r\n\r\nbool CKLBScriptEnv::setupScriptEnv() {\r\n\t// ::boot already do the call to setupLuaEnv\r\n\t// Nothing do to here !\r\n\t// Never do CKLBLuaEnv::getInstance().setupLuaEnv();\r\n\treturn true;\r\n}\r\n\r\nvoid CKLBScriptEnv::finishScriptEnv() {\r\n\t// \r\n\t// TODO possibe : CKLBLuaEnv::getInstance().finishLuaEnv();\r\n\t// and remove direct call from GameApplication class.\r\n}\r\n\r\nvoid CKLBScriptEnv::errMsg(const char * str) {\r\n\tCKLBLuaEnv::getInstance().errMsg(str);\r\n}\r\n\r\nvoid CKLBScriptEnv::error(const char* fmt,...) {\r\n\tva_list ap;\r\n\tva_start(ap, fmt);\r\n\tchar msg[1024];\r\n\tvsprintf(msg, fmt, ap);\r\n\tva_end(ap);\r\n\r\n\tCKLBLuaEnv::getInstance().getState().error(msg);\r\n}\r\n\r\nvoid CKLBScriptEnv::destroy(unsigned int /*handle*/)\t// Does nothing, only used in C#\r\n{\r\n}\r\n\r\nvoid CKLBScriptEnv::call_onDie\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"P\",obj);\r\n}\r\n\r\n// Generic Task\r\nvoid CKLBScriptEnv::call_genTaskExecute\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 deltaT, const char* arrayIndex)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIS\",obj,deltaT, arrayIndex);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_genTaskDie\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* arrayIndex)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PS\",obj,arrayIndex);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_intervalTimerExecute\t(const char* funcName, CKLBObjectScriptable* /*obj*/, u32 timerID)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"I\",timerID);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_asyncLoader\t\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/, u32 loaded, u32 total)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"II\",loaded,total);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_asyncFileCopy\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 donePerc, u32 doneSize)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PII\",obj,donePerc,doneSize);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_webTask\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type,const char* url)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIS\",obj,type,url);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_pause\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_resume\t\t\t\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_storeEvent\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, const char* itemID, const char* param)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PISS\",obj,type,itemID, param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_fromSincVM\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id, s32 param)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PII\",obj,id,param);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventVirtualDoc\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 param1, s32 param2, s32 param3, s32 param4)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIIIII\",obj,type,param1,param2,param3,param4);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_touchPad\t\t\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.call(1, funcName);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_touchPadCSharp(CKLBObjectScriptable* /*obj*/, u32 /*m_execount*/, u32 /*type*/, u32 /*id*/, s32 /*x*/, s32 /*y*/)\r\n{\r\n\tklb_assertAlways(\"Call back interface for C#\");\r\n}\r\n\r\nvoid CKLBScriptEnv::call_button\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.call(1, funcName);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_textInput\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* txt, u32 id)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PSI\",obj,txt,id);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventSelectable\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/, const char* name, s32 type, s32 param)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"SII\",name,type,param);\r\n}\r\nvoid CKLBScriptEnv::call_eventSwf\t\t\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* label)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PS\",obj,label);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIListDynamic\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 index, u32 id) {\r\n\tif (!funcName) { return; } \r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName, \"PII\", obj, index, id);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIList\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, u32 itemCnt, s32 listLength, s32 pos)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIIII\",obj,type,itemCnt,listLength,pos);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIListDrag\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 param1, s32 param2)\r\n{\r\n\tklb_assertAlways(\"Unused\");\r\n\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIIIII\",obj,type,x,y,param1,param2);\r\n}\r\n\r\n// UI Control\r\nvoid CKLBScriptEnv::call_eventUIControlDrag\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"IIIII\",type,x,y,deltaX,deltaY);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventDragIF\t\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 deltaX, s32 deltaY)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIIIII\",obj,type,x,y,deltaX,deltaY);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlPinch\t(const char* funcName, CKLBObjectScriptable* /*obj*/, u32 type, float pinch, float rot)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"INN\",type,pinch,rot);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlClick\t(const char* funcName, CKLBObjectScriptable* /*obj*/, s32 x, s32 y)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"II\",x,y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlDblClick\t(const char* funcName, CKLBObjectScriptable* /*obj*/, s32 x, s32 y)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"II\",x,y);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUIControlLongTap\t(const char* funcName, CKLBObjectScriptable* /*obj*/, u32 time, s32 x, s32 y)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"III\",time,x,y);\r\n}\r\n\r\n// UI Drag Icon\r\nvoid CKLBScriptEnv::call_eventDragIcon\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/, u32 type, s32 dragX, s32 dragY)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"III\",type,dragX,dragY);\r\n}\r\n\r\n// UI Movie\r\nvoid CKLBScriptEnv::call_eventMovie\t\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"P\",obj);\r\n}\r\n\r\n// UI Cell Anim\r\nvoid CKLBScriptEnv::call_eventCellAnim\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"\");\r\n}\r\n\r\n// UI Canvas\r\nvoid CKLBScriptEnv::call_canvasOnDraw\t\t(const char* funcName, CKLBObjectScriptable* obj)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"P\",obj);\r\n}\r\n\r\n// UI Node Pack Anim\r\nvoid CKLBScriptEnv::call_eventNodeAnimPack\t(const char* funcName, CKLBObjectScriptable* obj, const char * name, u32 id)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PSI\",obj,name,id);\r\n}\r\n\r\n// UI Touch Event UI\r\nvoid CKLBScriptEnv::call_eventUITouchEvent\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 x, s32 y, s32 dx, s32 dy)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PIIIII\",obj,type,x,y,dx,dy);\r\n}\r\n\r\n// CKLBDebugMenu\r\nvoid CKLBScriptEnv::call_eventDebugItem\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 id)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PI\",obj,id);\r\n}\r\n\r\n// UI Scroll Bar / UI List task\r\nvoid CKLBScriptEnv::call_eventScrollBar\t\t(const char* funcName, CKLBObjectScriptable* obj, u32 type, s32 pos)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PII\",obj,type,pos);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventScrollBarStop\t(const char* funcName, CKLBObjectScriptable* obj, s32 pos) {\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PI\",obj,pos);\r\n}\r\n\r\n// World Task\r\nvoid CKLBScriptEnv::call_eventWorld\t\t\t(const char* funcName, CKLBObjectScriptable* /*obj*/, s32 serial, s32 msg, s32 status)\r\n{\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"III\",serial,msg,status);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateDownload(const char* funcName, CKLBObjectScriptable* obj, double progress, const char* progressStr) {\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName,\"PNS\",obj,progress,progressStr);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateZIP\t\t(const char* funcName, CKLBObjectScriptable* obj, int progress, int total) {\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName, \"PII\", obj, progress, total);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateComplete(const char* funcName, CKLBObjectScriptable* obj) {\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName, \"P\", obj);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_eventUpdateError(const char* funcName, CKLBObjectScriptable* obj) {\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName, \"P\", obj);\r\n}\r\n\r\nbool CKLBScriptEnv::call_netAPI_callback(const char* funcName, CKLBObjectScriptable* /*obj*/, int uniq, int msg, int status, CKLBJsonItem * pRoot) {\r\n\tif(!funcName) return false;\r\n\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.getGlobal(funcName);\r\n\tlua.retInt(uniq);\r\n\tlua.retInt(msg);\r\n\tlua.retInt(status);\r\n\tif(pRoot) {\r\n\t\tCKLBUtility::jsonItem2lua(lua, pRoot);\r\n\t} else {\r\n\t\tlua.retNil();\r\n\t}\r\n\treturn lua.call(4, funcName);\r\n}\r\n\r\nvoid CKLBScriptEnv::call_netAPI_versionUp\t\t(const char* funcName, CKLBObjectScriptable* obj, const char* clientVer, const char* serverVer) {\r\n\tif (!funcName) { return; }\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.callback(funcName, \"PSS\", obj, clientVer, serverVer);\r\n}\r\n\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/Scripting/CallbackDef.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CALLBACK_DEF_H\r\n#define CALLBACK_DEF_H\r\n\r\n#include \"BaseType.h\"\r\n\r\nclass CallbackDef {\r\npublic:\r\n\ttypedef void (*FP_V)\t\t\t(void);\r\n\ttypedef void (*FP_U)\t\t\t(u32);\r\n\ttypedef void (*FP_IIII)\t\t\t(s32, s32, s32, s32);\r\n\ttypedef void (*FP_UII)\t\t\t(u32, s32, s32);\r\n\ttypedef void (*FP_UIII)\t\t\t(u32, s32, s32, s32);\r\n\ttypedef void (*FP_UIIII)\t\t(u32, s32, s32, s32, s32);\r\n\ttypedef void (*FP_US)\t\t\t(u32, s32*);\r\n\ttypedef void (*FP_USII)\t\t\t(u32, s32*, s32, s32);\r\n\ttypedef void (*FP_USU)\t\t\t(u32, s32*, u32);\r\n\ttypedef void (*FP_USS)\t\t\t(u32, s32*, s32*);\r\n\ttypedef void (*FP_UUS)\t\t\t(u32, u32, s32*);\r\n\ttypedef void (*FP_UUSS)\t\t\t(u32, u32, s32*, s32*);\r\n\ttypedef void (*FP_UU)\t\t\t(u32, u32);\r\n\ttypedef void (*FP_UUU)\t\t\t(u32, u32, u32);\r\n\ttypedef void (*FP_UUFF)\t\t\t(u32, u32, float, float);\r\n\ttypedef void (*FP_UUI)\t\t\t(u32, u32, s32);\r\n\ttypedef void (*FP_UUII)\t\t\t(u32, u32, s32, s32);\r\n\ttypedef void (*FP_UUIIII)\t\t(u32, u32, s32, s32, s32, s32);\r\n\ttypedef void (*FP_UUIIUU)\t\t(u32, u32, s32, s32, u32, u32);\r\n\ttypedef void (*FP_UUUII)\t\t(u32, u32, u32, s32, s32);\r\n\ttypedef void (*FP_UUUUII)\t\t(u32, u32, u32, u32, s32, s32);\r\n\ttypedef bool (*FP_UIIIP_retB)\t(u32, s32, s32, s32, s32*);\r\n\ttypedef void (*FP_UFS)\t\t\t(u32, float, s32*);\r\n\r\n\tstatic FP_V\t\t\t\ts_start\t\t\t\t\t;\r\n\tstatic FP_U\t\t\t\ts_destroyPtr\t\t\t;\r\n\tstatic FP_IIII\t\t\ts_worldCallBackPtr\t\t;\r\n\tstatic FP_U\t\t\t\ts_doCallBackPtrV\t\t;\r\n\tstatic FP_UII\t\t\ts_doCallBackPtrII\t\t;\r\n\tstatic FP_UIII\t\t\ts_doCallBackPtrIII\t\t;\r\n\tstatic FP_UIIII\t\t\ts_doCallBackPtrIIII\t\t;\r\n\tstatic FP_US\t\t\ts_doCallBackPtrS\t\t;\r\n\tstatic FP_USII\t\t\ts_doCallBackPtrSII\t\t;\r\n\tstatic FP_USU\t\t\ts_doCallBackPtrSU\t\t;\r\n\tstatic FP_USS\t\t\ts_doCallBackPtrSS\t\t;\r\n\tstatic FP_UUS\t\t\ts_doCallBackPtrUS\t\t;\r\n\tstatic FP_UUSS\t\t\ts_doCallBackPtrUSS\t\t;\r\n\tstatic FP_UU\t\t\ts_doCallBackPtrU\t\t;\r\n\tstatic FP_UUU\t\t\ts_doCallBackPtrUU\t\t;\r\n\tstatic FP_UUFF\t\t\ts_doCallBackPtrUFF\t\t;\r\n\tstatic FP_UUI\t\t\ts_doCallBackPtrUI\t\t;\r\n\tstatic FP_UUII\t\t\ts_doCallBackPtrUII\t\t;\r\n\tstatic FP_UUIIII\t\ts_doCallBackPtrUIIII\t;\r\n\tstatic FP_UUIIUU\t\ts_doCallBackPtrUIIUU\t;\r\n\tstatic FP_UUUII\t\t\ts_doCallBackPtrUUII\t\t;\r\n\tstatic FP_UUUUII\t\ts_doCallBackPtrUUUII\t;\r\n\tstatic FP_UIIIP_retB\ts_doCallBackPtrIIIP_retB;\r\n\tstatic FP_UFS\t\t\ts_doCallBackPtrFS\t\t;\r\n};\r\n\r\nvoid initCallbacks();\r\nvoid registerWorldGC();\r\n\r\n#endif //CALLBACK_DEF_H\r\n"
  },
  {
    "path": "Engine/source/Scripting/CallbackDef.inl",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CallBackDef.h\"\r\n\r\nvoid initCallbacks() {\r\n\tCallbackDef::s_start                  = Program::start;\r\n    CallbackDef::s_destroyPtr             = EnginePrototype::NativeManagement::destroyFromNative;\r\n    CallbackDef::s_doCallBackPtrV         = EnginePrototype::NativeManagement::doCallBackV;\r\n    CallbackDef::s_doCallBackPtrII        = EnginePrototype::NativeManagement::doCallBackII;\r\n    CallbackDef::s_doCallBackPtrIII       = EnginePrototype::NativeManagement::doCallBackIII;\r\n    CallbackDef::s_doCallBackPtrIIII      = EnginePrototype::NativeManagement::doCallBackIIII;\r\n    CallbackDef::s_doCallBackPtrS         = EnginePrototype::NativeManagement::doCallBackS;\r\n    CallbackDef::s_doCallBackPtrSII       = EnginePrototype::NativeManagement::doCallBackSII;\r\n    CallbackDef::s_doCallBackPtrSU        = EnginePrototype::NativeManagement::doCallBackSU;\r\n    CallbackDef::s_doCallBackPtrSS        = EnginePrototype::NativeManagement::doCallBackSS;\r\n    CallbackDef::s_doCallBackPtrUS        = EnginePrototype::NativeManagement::doCallBackUS;\r\n    CallbackDef::s_doCallBackPtrUSS       = EnginePrototype::NativeManagement::doCallBackUSS;\r\n    CallbackDef::s_doCallBackPtrU         = EnginePrototype::NativeManagement::doCallBackU;\r\n    CallbackDef::s_doCallBackPtrUU        = EnginePrototype::NativeManagement::doCallBackUU;\r\n    CallbackDef::s_doCallBackPtrUFF       = EnginePrototype::NativeManagement::doCallBackUFF;\r\n    CallbackDef::s_doCallBackPtrUI        = EnginePrototype::NativeManagement::doCallBackUI;\r\n    CallbackDef::s_doCallBackPtrUII       = EnginePrototype::NativeManagement::doCallBackUII;\r\n    CallbackDef::s_doCallBackPtrUIIII     = EnginePrototype::NativeManagement::doCallBackUIIII;\r\n    CallbackDef::s_doCallBackPtrUIIUU     = EnginePrototype::NativeManagement::doCallBackUIIUU;\r\n    CallbackDef::s_doCallBackPtrUUII      = EnginePrototype::NativeManagement::doCallBackUUII;\r\n    CallbackDef::s_doCallBackPtrUUUII     = EnginePrototype::NativeManagement::doCallBackUUUII;\r\n    CallbackDef::s_doCallBackPtrIIIP_retB = EnginePrototype::NativeManagement::doCallBackIIIP_retB;\r\n    CallbackDef::s_doCallBackPtrFS        = EnginePrototype::NativeManagement::doCallBackFS;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Scripting/ExportListC_Likefunction.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef DllExport\r\n#define DllExport   __declspec( dllexport )\r\n#endif\r\n\r\n#include \"ExportListC_Likefunction.h\"\r\n\r\n#include \"CKLBScriptEnv.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBScriptEnv_getCallBackCount() {\r\n\treturn (s32*)CKLBScriptEnv::getInstance().getCallCounter();\r\n}\r\n\r\nextern \"C\" DllExport s32* CKLBScriptEnv_getErrorPtr() {\r\n\treturn (s32*)CKLBScriptEnv::getInstance().getErrorReader();\r\n}\r\n\r\nextern \"C\" DllExport s32* CKLBScriptEnv_getErrorString() {\r\n\treturn (s32*)CKLBScriptEnv::getInstance().getErrorString();\r\n}\r\n\r\nextern \"C\" DllExport void CKLBScriptEnv_resetError() {\r\n\tCKLBScriptEnv::getInstance().resetError();\r\n}\r\n\r\n//======================================================================================\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBLibRegistrator.h\"\r\n\r\n\r\nextern \"C\" DllExport u32 CKLBObject_getTypeID(s32* pCtx) {\r\n\treturn ((CKLBObject*)pCtx)->getClassID();\r\n}\r\n\r\nextern \"C\" DllExport void CKLBObjectScriptable_setScriptContext(s32* pCtx, u32 handle) {\r\n\t((CKLBObjectScriptable*)pCtx)->setScriptHandle(handle);\r\n}\r\n\r\nextern \"C\" DllExport u32 CKLBObjectScriptable_getScriptContext(s32* pCtx) {\r\n\treturn ((CKLBObjectScriptable*)pCtx)->getScriptHandle();\r\n}\r\n\r\nextern \"C\" DllExport u32 Cpp_getClassIDByName(s32* name) {\r\n\tu32 res = IFactory::getClassID((const char*)name, false);\r\n\tif(res == 0) {\r\n\t\tres = CKLBLibRegistrator::getInstance()->getClassID((const char*)name);\r\n\t}\r\n\tif(res == 0) {\r\n\t\tklb_assertAlways(\"Can not find class ID from name %s\", (const char*)name);\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\n//======================================================================================\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"AudioAsset.h\"\r\n\r\nextern \"C\" DllExport s32* node_getRoot() {\r\n\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\treturn (s32*)res.getRoot();\r\n}\r\n\r\nextern \"C\" DllExport s32* node_getChild(s32*  pNode) {\r\n\treturn (s32*)((CKLBNode*)pNode)->getChild();\r\n}\r\n\r\nextern \"C\" DllExport s32* node_getParent(s32*  pNode) {\r\n\treturn (s32*)((CKLBNode*)pNode)->getParent();\r\n}\r\n\r\nextern \"C\" DllExport s32* node_getBrother(s32*  pNode) {\r\n\treturn (s32*)((CKLBNode*)pNode)->getBrother();\r\n}\r\n\r\nextern \"C\" DllExport s32* node_getNodeFromTask(s32* pTask) {\r\n\treturn (s32*)((CKLBUITask*)pTask)->getNode();\r\n}\r\n\r\nextern \"C\" DllExport float node_getNodeScaleX(s32* pNode) { \r\n\treturn ((CKLBNode*)pNode)->getScaleX();\r\n}\r\n\r\nextern \"C\" DllExport float node_getNodeScaleY(s32* pNode) {\r\n\treturn ((CKLBNode*)pNode)->getScaleY();\r\n}\r\n\r\nextern \"C\" DllExport float node_getRotation(s32* pNode) {\r\n\treturn ((CKLBNode*)pNode)->getRotation();\r\n}\r\n\r\nextern \"C\" DllExport float node_getNodeTranslateX(s32*  pNode) {\r\n\treturn ((CKLBNode*)pNode)->getTranslateX();\r\n}\r\n\r\nextern \"C\" DllExport float node_getNodeTranslateY(s32*  pNode) {\r\n\treturn ((CKLBNode*)pNode)->getTranslateY();\r\n}\r\n\r\nextern \"C\" DllExport void node_setTranslate(s32*  pNode, float x, float y) {\r\n\t((CKLBNode*)pNode)->setTranslate(x,y);\r\n}\r\n\r\nextern \"C\" DllExport void node_setRotation(s32*  pNode, float deg) \r\n{\r\n\t((CKLBNode*)pNode)->setRotation(deg);\r\n}\r\n\r\nextern \"C\" DllExport void node_setScale(s32*  pNode, float scaleX, float scaleY)\r\n{\r\n\t((CKLBNode*)pNode)->setScale(scaleX, scaleY);\r\n}\r\n\r\nextern \"C\" DllExport void node_getColorMatrixVec(s32*  pNode, float* dst) {\r\n\tSColorVector colorMat;\r\n\t((CKLBNode*)pNode)->getColorMatrix(colorMat);\r\n\tdst[0] = colorMat.m_vector[0];\r\n\tdst[1] = colorMat.m_vector[1];\r\n\tdst[2] = colorMat.m_vector[2];\r\n\tdst[3] = colorMat.m_vector[3];\r\n}\r\n\r\nextern \"C\" DllExport void node_setColorMatrixVec(s32*  pNode, float* src) {\r\n\tSColorVector colorMat;\r\n\tcolorMat.m_type = 0;\r\n\tcolorMat.m_vector[0] = src[0];\r\n\tcolorMat.m_vector[1] = src[1];\r\n\tcolorMat.m_vector[2] = src[2];\r\n\tcolorMat.m_vector[3] = src[3];\r\n\t\r\n\t((CKLBNode*)pNode)->setColorMatrix(colorMat);\r\n}\r\n\r\nextern \"C\" DllExport u32 node_getColorMatrixUInt(s32*  pNode) {\r\n\tSColorVector colorMat;\r\n\t((CKLBNode*)pNode)->getColorMatrix(colorMat);\r\n\tu32 fr = (u32)(colorMat.m_vector[0] * 255.0f);\r\n\tu32 fg = (u32)(colorMat.m_vector[1] * 255.0f);\r\n\tu32 fb = (u32)(colorMat.m_vector[2] * 255.0f);\r\n\tu32 fa = (u32)(colorMat.m_vector[3] * 255.0f);\r\n\tif (fr > 255) { fr = 255; }\r\n\tif (fg > 255) { fg = 255; }\r\n\tif (fb > 255) { fr = 255; }\r\n\tif (fa > 255) { fr = 255; }\r\n\t\r\n\treturn (fa << 24) | (fr <<16) | (fg << 8) | fb;\r\n}\r\n\r\nextern \"C\" DllExport void node_setColorMatrixUInt(s32*  pNode, u32 val) {\r\n\tSColorVector colorMat;\r\n\tcolorMat.m_type = 0;\r\n\tcolorMat.m_vector[0] = ((val >> 16) & 0xFF) / 255.0f;\t// R\r\n\tcolorMat.m_vector[1] = ((val >> 8) & 0xFF) / 255.0f;\t// G\r\n\tcolorMat.m_vector[2] = (val & 0xFF) / 255.0f;\t// B\r\n\tcolorMat.m_vector[3] = (val >> 24) / 255.0f;\t// A\r\n\t\r\n\t((CKLBNode*)pNode)->setColorMatrix(colorMat);\r\n}\r\n\r\nextern \"C\" DllExport void node_setVisible(s32*  pNode, bool visible) {\r\n\t((CKLBNode*)pNode)->setVisible(visible);\r\n}\r\n\r\nextern \"C\" DllExport bool node_getVisible(s32*  pNode) {\r\n\treturn ((CKLBNode*)pNode)->isVisible();\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_asElement(s32*  pNode) {\r\n\tif (((CKLBNode*)pNode)->getClassID() == CLS_KLBUIELEMENT) {\r\n\t\treturn pNode;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_asContainer(s32*  pNode) {\r\n\tif (((CKLBNode*)pNode)->getClassID() == CLS_KLBUICONTAINER) {\r\n\t\treturn pNode;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_asSelectable(s32*  pNode) {\r\n\tif (((CKLBNode*)pNode)->getClassID() == CLS_KLBUISELECTABLE) {\r\n\t\treturn pNode;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_asAnimationNode(s32*  pNode) {\r\n\tif (((CKLBNode*)pNode)->getClassID() == CLS_KLBSPLINENODE) {\r\n\t\treturn pNode;\r\n\t} else {\r\n\t\treturn NULL;\r\n\t}\r\n}\r\n\r\nextern \"C\" DllExport s32* node_getName(s32*  pNode) {\r\n\treturn (s32*)((CKLBNode*)pNode)->getName();\r\n}\r\n\r\nextern \"C\" DllExport void node_setName(s32* pNode, s32* name) {\r\n\t((CKLBNode*)pNode)->setName((const char*)name);\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_getUITask(s32*  pNode) {\r\n\treturn (s32*)((CKLBNode*)pNode)->getUITask();\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_search(s32*  pNode, s32* name) {\r\n\treturn (s32*)((CKLBNode*)pNode)->search((const char*)name);\r\n}\r\n\r\nextern \"C\" DllExport s32*  node_searchFirstByTypeID(s32*  pNode, u32 typeID) {\r\n\treturn (s32*)((CKLBNode*)pNode)->searchFirstByTypeID(typeID);\r\n}\r\n\r\n//\r\n// Element\r\n//\r\n#include \"CKLBUISystem.h\"\r\n\r\nextern \"C\" DllExport void element_setEnabled(s32*  pElem, bool isEnabled) {\r\n\t((CKLBUIElement*)pElem)->setEnabled(isEnabled);\r\n}\r\n\r\nextern \"C\" DllExport bool element_isEnabled(s32*  pElem) {\r\n\treturn ((CKLBUIElement*)pElem)->isEnabled();\r\n}\r\n\r\nextern \"C\" DllExport bool element_setAsset(s32*  pElem, u32 dest, s32* assetName) {\r\n\tCKLBAsset* pAsset = NULL;\r\n\tif((const char*)assetName) {\r\n\t\tCKLBAssetManager& pAssetMgr = CKLBAssetManager::getInstance();\r\n\t\tu16 assetID = pAssetMgr.getAssetIDFromName((const char*)assetName,0);\r\n\t\tCKLBAbstractAsset* pAbstractAsset= pAssetMgr.getAsset(assetID);\r\n\t\tif (pAbstractAsset && (pAbstractAsset->getAssetType() & HAS_CREATENODE)) {\r\n\t\t\tpAsset = (CKLBAsset*)pAbstractAsset;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\t\t((CKLBUIElement*)pElem)->setAsset(pAsset,(CKLBUIElement::ASSET_TYPE)dest);\r\n\treturn true;\r\n}\r\n\r\nextern \"C\" DllExport void element_setPriority(s32*  pElem, u32 renderPriority) {\r\n\t((CKLBUIElement*)pElem)->setPriority(renderPriority);\r\n}\r\n\r\nextern \"C\" DllExport u32 element_getPriority(s32*  pElem) {\r\n\treturn ((CKLBUIElement*)pElem)->getPriority(); \r\n}\r\n\r\n//\r\n// Selectable\r\n//\r\n\r\nextern \"C\" DllExport void selectable_setClick\t\t(s32*  pSelect, s32 coordinateX, s32 coordinateY, s32 width, s32 height) {\r\n\t((CKLBUISelectable*)pSelect)->setClickLeft(coordinateX);\r\n\t((CKLBUISelectable*)pSelect)->setClickWidth(width);\r\n\t((CKLBUISelectable*)pSelect)->setClickTop(coordinateY);\r\n\t((CKLBUISelectable*)pSelect)->setClickHeight(height);\r\n}\r\n\r\nextern \"C\" DllExport bool selectable_setAudio\t\t\t(s32*  pSelect, s32* assetAudio, u32 mode, float volume) {\r\n\tCKLBAssetManager& pAssetMgr = CKLBAssetManager::getInstance();\r\n\tCKLBAbstractAsset* lAsset = pAssetMgr.loadAssetByFileName((const char*)assetAudio, pAssetMgr.getPlugin('A'), true);\r\n\tif (lAsset && (lAsset->getAssetType() == ASSET_AUDIO)) {\r\n\t\tCKLBAudioAsset* pAudio = (CKLBAudioAsset*)lAsset;\r\n\t\tif (!pAudio->preLoad()) {\r\n\t\t\tklb_assertAlways(\"Failed preloading audio\");\r\n\t\t}\r\n\t\tlAsset->incrementRefCount();\r\n\t\t((CKLBUISelectable*)pSelect)->setAudio(pAudio, mode, volume, true);\r\n\t\t\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nextern \"C\" DllExport void selectable_setStick\t\t\t(s32*  pSelect,bool isStickable) {\r\n\t((CKLBUISelectable*)pSelect)->setStick(isStickable);\r\n}\r\n\r\nextern \"C\" DllExport bool selectable_isStickable\t\t\t(s32*  pSelect)\t\t\t\t\r\n{\treturn ((CKLBUISelectable*)pSelect)->isStickable();\t}\r\n\r\nextern \"C\" DllExport void selectable_setSticked\t\t\t(s32*  pSelect,bool isSticked) {\r\n\t((CKLBUISelectable*)pSelect)->setSticked(isSticked);\r\n}\r\n\r\nextern \"C\" DllExport bool selectable_isSticked\t\t\t(s32*  pSelect)\t\t\t\t\r\n{ return ((CKLBUISelectable*)pSelect)->isSticked();\t}\r\n\r\n//\r\n//\tWhen clicked, all other stickable are modified / reset to unstick.\r\n// 0 : Not radio, 1..n : Radio ID.\r\nextern \"C\" DllExport void\tselectable_setRadio\t\t\t(s32*  pSelect,u32 radioID) {\r\n\t((CKLBUISelectable*)pSelect)->setRadio(radioID);\r\n}\r\n\r\nextern \"C\" DllExport u32\t\tselectable_getRadioID\t\t\t(s32*  pSelect)\t\t\t\t\r\n{ return ((CKLBUISelectable*)pSelect)->getRadioID(); }\r\n\r\n\r\n//\r\n// Container\r\n//\r\n\r\nextern \"C\" DllExport s32\t\tcontainer_getViewOffsetX\t\t(s32*  pCont) { \r\n\treturn ((CKLBUIContainer*)pCont)->getViewOffsetX();\r\n}\r\nextern \"C\" DllExport void\tcontainer_setViewOffsetX\t\t(s32*  pCont,s32 scrollX) {\r\n\t((CKLBUIContainer*)pCont)->setViewOffsetX(scrollX);\r\n}\r\n\r\nextern \"C\" DllExport s32\t\tcontainer_getViewOffsetY\t\t(s32*  pCont) { \r\n\treturn ((CKLBUIContainer*)pCont)->getViewOffsetY();\r\n}\r\nextern \"C\" DllExport void\tcontainer_setViewOffsetY\t\t(s32*  pCont,s32 scrollY) {\r\n\t((CKLBUIContainer*)pCont)->setViewOffsetY(scrollY);\r\n}\r\n\r\n// Allow to find the active radio button inside the container.\r\nextern \"C\" DllExport u32\t\tcontainer_getRadioValue\t\t\t(s32*  pCont) {\r\n\treturn ((CKLBUIContainer*)pCont)->getRadioValue();\r\n}\r\n\r\n\r\n//======================================================================================\r\n#include \"CKLBGenericTask.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\nextern \"C\" DllExport s32* CKLBGenericTask_create(s32* pParentTask, s32 phase)\r\n{ return (s32*)CKLBGenericTask::create((CKLBTask*)pParentTask, (CKLBTask::TASK_PHASE)phase, \"\", \"\", \"\"); }\r\n\r\n//======================================================================================\r\n#include \"CKLBIntervalTimer.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\n// false is given as last arguement to prevent killing a timer if the timer interval has changed during the callback.\r\nextern \"C\" DllExport s32* CKLBIntervalTimer_create(s32* pParent, u32 interval, bool repeat, u8 mode)\r\n{\treturn (s32*)CKLBIntervalTimer::create((CKLBTask*)pParent, NULL, interval, repeat, \"\", mode, false);\t}\r\n\r\nextern \"C\" DllExport u32 CKLBIntervalTimer_getTimerID(s32* pCtx) \t\t\t\t\t\t\t\t\r\n{\treturn ((CKLBIntervalTimer*)pCtx)->getTimerID();\t}\r\nextern \"C\" DllExport void CKLBIntervalTimer_setTimerID(s32* pCtx, u32 ID) \t\t\t\t\t\r\n{\t((CKLBIntervalTimer*)pCtx)->setTimerID(ID);\t\t\t}\r\n\r\nextern \"C\" DllExport bool CKLBIntervalTimer_getRepeat(s32* pCtx) \t\t\t\t\t\t\t\t\r\n{\treturn ((CKLBIntervalTimer*)pCtx)->getRepeat();\t\t}\r\nextern \"C\" DllExport void CKLBIntervalTimer_setRepeat(s32* pCtx, bool boolean) \t\t\t\t\r\n{\t((CKLBIntervalTimer*)pCtx)->setRepeat(boolean);\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBIntervalTimer_getInterval(s32* pCtx)\r\n{\treturn ((CKLBIntervalTimer*)pCtx)->getInterval();\t}\r\nextern \"C\" DllExport void CKLBIntervalTimer_setInterval(s32* pCtx, u32 interval)\r\n{\t((CKLBIntervalTimer*)pCtx)->setInterval(interval);\t}\r\n\r\nextern \"C\" DllExport u8 CKLBIntervalTimer_getMode(s32* pCtx)\r\n{\treturn ((CKLBIntervalTimer*)pCtx)->getMode();\t\t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUIProgressBar.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_create(s32* pParent, \r\n\t\t\t\t\t\t\tu32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\ts32* full_image, s32* empty_image,\r\n\t\t\t\t\t\t\ts32 start_pix, s32 end_pix, u32 anim, bool vert, s32* barfilterImage)\r\n{\treturn (s32*)CKLBUIProgressBar::create(\t(CKLBUITask*)pParent, NULL, \r\n\t\t\t\t\t\t\t\t\t\torder, x, y, width, height, \r\n\t\t\t\t\t\t\t\t\t\t(const char*)full_image, (const char*)empty_image, \r\n\t\t\t\t\t\t\t\t\t\tstart_pix, end_pix, anim, vert, (const char*)barfilterImage);\r\n}\r\n\r\nextern \"C\" DllExport u32 CKLBUIProgressBar_getOrder(s32* pCtx) \r\n{ return ((CKLBUIProgressBar*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setOrder(s32* pCtx, u32 order)\r\n{ ((CKLBUIProgressBar*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getWidth(s32* pCtx) \r\n{ return ((CKLBUIProgressBar*)pCtx)->getWidth(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setWidth(s32* pCtx, float width)\r\n{ ((CKLBUIProgressBar*)pCtx)->setWidth(width); }\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getHeight(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getHeight(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setHeight(s32* pCtx, float height)\r\n{ ((CKLBUIProgressBar*)pCtx)->setHeight(height); }\r\n\r\nextern \"C\" DllExport bool CKLBUIProgressBar_getVertical(s32* pCtx) \r\n{ return ((CKLBUIProgressBar*)pCtx)->getVertical(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setVertical(s32* pCtx, bool vertical)\r\n{ ((CKLBUIProgressBar*)pCtx)->setVertical(vertical); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIProgressBar_getAnimTime(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getAnimTime(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setAnimTime(s32* pCtx, u32 time)\r\n{ ((CKLBUIProgressBar*)pCtx)->setAnimTime(time); }\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getStart(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getStart(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setStart(s32* pCtx, float start)\r\n{ ((CKLBUIProgressBar*)pCtx)->setStart(start); }\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getEnd(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getEnd(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setEnd(s32* pCtx, float end)\r\n{ ((CKLBUIProgressBar*)pCtx)->setEnd(end); }\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getValue(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getValue(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setValue(s32* pCtx, float value)\r\n{ ((CKLBUIProgressBar*)pCtx)->setValue(value); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_getImgEmpty(s32* pCtx)\r\n{ return (s32*)((CKLBUIProgressBar*)pCtx)->getImgEmpty(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setImgEmpty(s32* pCtx, s32* imgEmpty)\r\n{ ((CKLBUIProgressBar*)pCtx)->setImgEmpty((const char*)imgEmpty); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_getImgFull(s32* pCtx)\r\n{ return (s32*)((CKLBUIProgressBar*)pCtx)->getImgFull(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setImgFull(s32* pCtx, s32* imgFull)\r\n{ ((CKLBUIProgressBar*)pCtx)->setImgFull((const char*)imgFull); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_getImgFilter(s32* pCtx)\r\n{ return (s32*)((CKLBUIProgressBar*)pCtx)->getImgFilter(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setImgFilter(s32* pCtx, s32* imgFilter)\r\n{ ((CKLBUIProgressBar*)pCtx)->setImgFilter((const char*)imgFilter); }\r\n\r\nextern \"C\" DllExport void CKLBUIProgressBar_reset(s32* pCtx)\r\n{ ((CKLBUIProgressBar*)pCtx)->reset(); }\r\n\r\nextern \"C\" DllExport bool CKLBUIProgressBar_getFilterVisible(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getFilterVisible(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setFilterVisible(s32* pCtx, bool bFilter)\r\n{ ((CKLBUIProgressBar*)pCtx)->setFilterVisible(bFilter); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIProgressBar_getFilterColor(s32* pCtx)\r\n{ return ((CKLBUIProgressBar*)pCtx)->getFilterColor(); }\r\nextern \"C\" DllExport void CKLBUIProgressBar_setFilterColor(s32* pCtx, u32 argb)\r\n{ ((CKLBUIProgressBar*)pCtx)->setFilterColor(argb); }\r\n\r\nextern \"C\" DllExport bool CKLBUIProgressBar_setFilterAnim(s32* pCtx, bool bColAnim, u32 argb1, u32 argb2, u32 freq)\r\n{ return ((CKLBUIProgressBar*)pCtx)->setFilterAnim(bColAnim, argb1, argb2, freq); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIScore.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIScore_create(s32* pParent,\r\n\t\t\t\t\t\t\t\t\tu32 order, s32 order_offset,\r\n\t\t\t\t\t\t\t\t\tfloat x, float y, s32** tex_table,\r\n\t\t\t\t\t\t\t\t\tfloat stepX, float stepY, u32 column, \r\n\t\t\t\t\t\t\t\t\tbool fillzero, bool anim_flag,\r\n\t\t\t\t\t\t\t\t\tu32 align, bool countclip)\r\n{\treturn (s32*)CKLBUIScore::create((CKLBUITask*)pParent, NULL,\r\n\t\t\t\t\t\t\t\torder, order_offset,\r\n\t\t\t\t\t\t\t\tx, y, (const char**)tex_table, \r\n\t\t\t\t\t\t\t\tstepX, stepY, column, fillzero, anim_flag);\r\n}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getValue(s32* pCtx) \t\t\t\t\t\t\t\t\t\t\r\n{\treturn ((CKLBUIScore*)pCtx)->getValue();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setValue(s32* pCtx, u32 value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setValue(value);\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getOrder();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setOrder(s32* pCtx, u32 value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setOrder(value);\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getOrderOffset(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getOrderOffset();\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScore_getStepX(s32* pCtx) \t\t\t\t\t\t\t\t\t\t\r\n{\treturn ((CKLBUIScore*)pCtx)->getStepX();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setStepX(s32* pCtx, s32 value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setStepX(value);\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScore_getStepY(s32* pCtx) \t\t\t\t\t\t\t\t\t\t\r\n{\treturn ((CKLBUIScore*)pCtx)->getStepY();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setStepY(s32* pCtx, s32 value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setStepY(value);\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getColumn(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getColumn();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setColumn(s32* pCtx, u32 value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setColumn(value);\t\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIScore_getFillZero(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getFillZero();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setFillZero(s32* pCtx, bool value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setFillZero(value);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIScore_getAnim(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getAnim();\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getAlign(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getAlign();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setAlign(s32* pCtx, u32 value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setAlign(value);\t\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIScore_getCountClip(s32* pCtx)\r\n{\treturn ((CKLBUIScore*)pCtx)->getCountClip();\t}\r\nextern \"C\" DllExport void CKLBUIScore_setCountClip(s32* pCtx, bool value) \t\t\t\t\t\t\t\r\n{\t((CKLBUIScore*)pCtx)->setCountClip(value);\t}\r\n\r\nextern \"C\" DllExport s32* CKLBUIScore_getTextures(s32* pCtx)\r\n{\treturn (s32*)((CKLBUIScore*)pCtx)->getTextures();\t}\r\n\r\nextern \"C\" DllExport void CKLBUIScore_setEnterAnimation(s32* pCtx, s32 milliSecondsPlayTime, s32 timeShift, u32 type, u32 affected, const float* arrayParam) \r\n{\t((CKLBUIScore*)pCtx)->setEnterAnimation(milliSecondsPlayTime, timeShift, false, type, affected, arrayParam); }\r\n\r\nextern \"C\" DllExport void CKLBUIScore_setExitAnimation(s32* pCtx, s32 milliSecondsPlayTime, s32 timeShift, u32 type, u32 affected, const float* arrayParam) \r\n{\t((CKLBUIScore*)pCtx)->setExitAnimation(milliSecondsPlayTime, timeShift, false, type, affected, arrayParam); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUITask.h\"\r\n\r\n// No constructor for UI Task\r\n\r\nextern \"C\" DllExport bool CKLBUITask_getVisible(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getVisible(); \t}\r\nextern \"C\" DllExport void CKLBUITask_setVisible(s32* pCtx, bool isVisible)\r\n{\t((CKLBUITask*)pCtx)->setVisible(isVisible);\t}\r\n\r\nextern \"C\" DllExport float CKLBUITask_getScaleX(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getScaleX(); \t}\r\nextern \"C\" DllExport void CKLBUITask_setScaleX(s32* pCtx, float scaleX)\r\n{\t((CKLBUITask*)pCtx)->setScaleX(scaleX);\t\t}\r\n\r\nextern \"C\" DllExport float CKLBUITask_getScaleY(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getScaleY(); \t}\r\nextern \"C\" DllExport void CKLBUITask_setScaleY(s32* pCtx, float scaleY)\r\n{\t((CKLBUITask*)pCtx)->setScaleY(scaleY);\t\t}\r\n\r\nextern \"C\" DllExport float CKLBUITask_getX(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getX(); \t\t}\r\nextern \"C\" DllExport void CKLBUITask_setX(s32* pCtx, float x)\r\n{\t((CKLBUITask*)pCtx)->setX(x);\t\t\t\t}\r\n\r\nextern \"C\" DllExport float CKLBUITask_getY(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getY(); \t\t}\r\nextern \"C\" DllExport void CKLBUITask_setY(s32* pCtx, float y)\r\n{\t((CKLBUITask*)pCtx)->setY(y);\t\t\t\t}\r\n\r\nextern \"C\" DllExport float CKLBUITask_getRotation(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getRotation(); \t}\r\nextern \"C\" DllExport void CKLBUITask_setRotation(s32* pCtx, float y)\r\n{\t((CKLBUITask*)pCtx)->setRotation(y);\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUITask_getArgb(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->getArgb(); \t\t}\r\nextern \"C\" DllExport void CKLBUITask_setArgb(s32* pCtx, u32 argb)\r\n{\t((CKLBUITask*)pCtx)->setArgb(argb);\t\t\t}\r\n\r\nextern \"C\" DllExport bool CKLBUITask_isAnim(s32* pCtx)\r\n{\treturn ((CKLBUITask*)pCtx)->isAnim(); \t\t}\r\n\r\nextern \"C\" DllExport void CKLBUITask_play(s32* pCtx)\r\n{\t((CKLBUITask*)pCtx)->play();\t\t\t\t}\r\nextern \"C\" DllExport void CKLBUITask_stop(s32* pCtx)\r\n{\t((CKLBUITask*)pCtx)->stop();\t\t\t\t}\r\n\r\nextern \"C\" DllExport bool CKLBUITask_setParamCount(s32* pCtx, u32 splineCount, u32 maxKeyCount) \r\n{\treturn ((CKLBUITask*)pCtx)->setParamCount(splineCount, maxKeyCount); }\r\n\r\nextern \"C\" DllExport void CKLBUITask_setTarget\t\t\t(s32* pCtx, u32 splineIndex, u32 targetParameter) \r\n{\t((CKLBUITask*)pCtx)->setTarget(splineIndex, targetParameter);\t\t\t\t}\r\n\r\nextern \"C\" DllExport void CKLBUITask_addKeys\t\t\t\t(s32* pCtx, u32 splineIndex, u32 time, s32 value) \r\n{\t((CKLBUITask*)pCtx)->addKeys(splineIndex, time, value); }\r\n\r\nextern \"C\" DllExport void CKLBUITask_addKeysFixed\t\t(s32* pCtx, u32 splineIndex, u32 time, s32 fixed16Value) \r\n{\t((CKLBUITask*)pCtx)->addKeysFixed(splineIndex, time, fixed16Value); }\r\n\r\nextern \"C\" DllExport void CKLBUITask_generateAnimation\t(s32* pCtx) \r\n{\t((CKLBUITask*)pCtx)->generateAnimation(); }\r\n\r\nextern \"C\" DllExport bool CKLBUITask_reconnect(s32* pCtx, s32* nodeName)\r\n{\treturn ((CKLBUITask*)pCtx)->reconnect((const char*)nodeName); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUISimpleItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUISimpleItem_create(s32* pParent, u32 order, float x, float y, s32* asset)\r\n{\treturn (s32*)CKLBUISimpleItem::create((CKLBUITask*)pParent, NULL, order, x, y, (const char*)asset); }\r\n\r\nextern \"C\" DllExport u32 CKLBUISimpleItem_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUISimpleItem*)pCtx)->getOrder(); \t}\r\nextern \"C\" DllExport void CKLBUISimpleItem_setOrder(s32* pCtx, u32 order)\r\n{\t((CKLBUISimpleItem*)pCtx)->setOrder(order);\t\t}\r\n\r\nextern \"C\" DllExport s32* CKLBUISimpleItem_getAsset(s32* pCtx)\r\n{\treturn (s32*)((CKLBUISimpleItem*)pCtx)->getAsset(); \t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUICanvas.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUICanvas_create(s32* pParent, u32 order, float x, float y, u32 vertexMax, u32 indexMax)\r\n{\treturn (s32*)CKLBUICanvas::create((CKLBUITask*)pParent, NULL, order, x, y, vertexMax, indexMax, NULL); }\r\n\r\nextern \"C\" DllExport u32 CKLBUICanvas_getOrder(s32* pCtx)\t\t\t\t\t\t\t\t\t\r\n{\treturn ((CKLBUICanvas*)pCtx)->getOrder(); \t\t\t}\r\nextern \"C\" DllExport void CKLBUICanvas_setOrder(s32* pCtx, u32 order) \t\t\t\t\t\r\n{\t((CKLBUICanvas*)pCtx)->setOrder(order);\t\t\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUICanvas_getIdxMax(s32* pCtx)\r\n{\treturn ((CKLBUICanvas*)pCtx)->getIdxMax();\t\t\t}\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_setFreeze(s32* pCtx, bool freeze) \t\t\t\t\r\n{\t((CKLBUICanvas*)pCtx)->setFreeze(freeze);\t\t\t}\r\n\r\nextern \"C\" DllExport bool CKLBUICanvas_addResource(s32* pCtx, s32* asset)\r\n{\treturn ((CKLBUICanvas*)pCtx)->addAsset((const char*)asset); }\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_drawImage(s32* pCtx, float x, float y, u32 idx, u32 color)\r\n{\t((CKLBUICanvas*)pCtx)->drawImage(x,y,idx,color);\t}\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_drawImageScale(s32* pCtx, float x, float y, float scale,u32 idx, u32 color)\r\n{\t((CKLBUICanvas*)pCtx)->drawImageScale(x,y,scale,idx,color);\t}\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_fillRect(s32* pCtx, float x, float y, float w, float h, u32 color)\r\n{\t((CKLBUICanvas*)pCtx)->fillRect(x,y,w,h,color);\t\t}\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_startDynamicSection(s32* pCtx, u32 idx)\t\r\n{\t((CKLBUICanvas*)pCtx)->startDynamicSection(idx);\t}\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_endDynamicSection(s32* pCtx, u32 idx)\t\t\r\n{\t((CKLBUICanvas*)pCtx)->endDynamicSection(idx);\t\t}\r\n\t\r\nextern \"C\" DllExport void CKLBUICanvas_dynamicSectionTranslate(s32* pCtx, u32 idx, float deltaX, float deltaY)\r\n{\t((CKLBUICanvas*)pCtx)->dynamicSectionTranslate(idx, deltaX, deltaY); }\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_dynamicSectionColor(s32* pCtx, u32 idx, u32 color)\r\n{\t((CKLBUICanvas*)pCtx)->dynamicSectionColor(idx,color);\t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUIScale9.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIScale9_create(s32* pParent, u32 order, float x, float y, s32 width, s32 height, s32* SCALE9Asset)\r\n{\treturn (s32*)CKLBUIScale9::create((CKLBUITask*)pParent, NULL, order, x, y, width, height, (const char*)SCALE9Asset); }\r\n\r\nextern \"C\" DllExport void CKLBUIScale9_setWidth(s32* pCtx, s32 width)\r\n{\t((CKLBUIScale9*)pCtx)->setWidth(width);\t\t\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScale9_getWidth(s32* pCtx)\r\n{\treturn ((CKLBUIScale9*)pCtx)->getWidth(); \t\t\t}\r\n\r\nextern \"C\" DllExport void CKLBUIScale9_setHeight(s32* pCtx, s32 height)\r\n{\t((CKLBUIScale9*)pCtx)->setHeight(height);\t\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScale9_getHeight(s32* pCtx)\r\n{\treturn ((CKLBUIScale9*)pCtx)->getHeight(); \t\t\t}\r\n\r\nextern \"C\" DllExport void CKLBUIScale9_setOrder(s32* pCtx, u32 order)\r\n{\t((CKLBUIScale9*)pCtx)->setOrder(order);\t\t\t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScale9_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUIScale9*)pCtx)->getOrder(); \t\t\t}\r\n\r\nextern \"C\" DllExport s32* CKLBUIScale9_getAsset(s32* pCtx)\r\n{\treturn (s32*)((CKLBUIScale9*)pCtx)->getAsset(); \t}\r\n\r\nextern \"C\" DllExport bool CKLBUIScale9_setAsset(s32* pCtx, s32* asset)\r\n{\treturn ((CKLBUIScale9*)pCtx)->setAsset((const char*)asset); \t\t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUIScrollBar.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIScrollBar_create(\r\n\ts32* pParent,\r\n\tu32 order, float x, float y, float width, float height,\r\n\ts32 minValue, s32 maxValue, s32 pos,\r\n\ts32* image,\r\n\ts32 slider_size, s32 min_slider_size, \r\n\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hideMode)\r\n{\r\n\treturn (s32*)CKLBUIScrollBar::create(\r\n\t\t(CKLBUITask*)pParent, NULL, \r\n\t\torder, x, y, width, height,\r\n\t\tminValue, maxValue, pos,\r\n\t\t(const char*)image,\r\n\t\tslider_size, min_slider_size,\r\n\t\tNULL,\r\n\t\tcolorNormal, colorSelect, vert, active, hideMode);\r\n}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getMin(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getMin(); \t\t\t}\r\nextern \"C\" DllExport void CKLBUIScrollBar_setMin\t\t\t\t(s32* pCtx, s32 value)\r\n{\t((CKLBUIScrollBar*)pCtx)->setMin(value);\t\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getMax(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getMax(); \t\t\t}\r\nextern \"C\" DllExport void CKLBUIScrollBar_setMax\t\t\t\t(s32* pCtx, s32 value)\r\n{\t((CKLBUIScrollBar*)pCtx)->setMax(value);\t\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getPos(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getPos(); \t\t\t}\r\nextern \"C\" DllExport void CKLBUIScrollBar_setPos\t\t\t\t(s32* pCtx, s32 value)\r\n{\t((CKLBUIScrollBar*)pCtx)->setPos(value);\t\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getSliderSize(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getSliderSize(); \t}\r\nextern \"C\" DllExport void CKLBUIScrollBar_setSliderSize\t\t(s32* pCtx, s32 value)\r\n{\t((CKLBUIScrollBar*)pCtx)->setSliderSize(value);\t\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getSliderSizeMin(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getSliderSizeMin(); }\r\nextern \"C\" DllExport void CKLBUIScrollBar_setSliderSizeMin\t(s32* pCtx, s32 value)\r\n{\t((CKLBUIScrollBar*)pCtx)->setSliderSizeMin(value);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIScrollBar_getTouchActive(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getTouchActive(); \t}\r\nextern \"C\" DllExport void CKLBUIScrollBar_setTouchActive\t\t(s32* pCtx, bool active)\r\n{\t((CKLBUIScrollBar*)pCtx)->setTouchActive(active);\t}\r\n\r\nextern \"C\" DllExport u32  CKLBUIScrollBar_getNormalColor\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getColorMode(0); }\r\nextern \"C\" DllExport void CKLBUIScrollBar_setNormalColor\t\t(s32* pCtx, u32 color)\r\n{\t((CKLBUIScrollBar*)pCtx)->setColorMode(0,color); }\r\n\r\nextern \"C\" DllExport u32  CKLBUIScrollBar_getActiveColor\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getColorMode(1); }\r\nextern \"C\" DllExport void CKLBUIScrollBar_setActiveColor\t\t(s32* pCtx, u32 color)\r\n{\t((CKLBUIScrollBar*)pCtx)->setColorMode(1,color); }\r\n\r\nextern \"C\" DllExport void CKLBUIScrollBar_setMode\t\t\t(s32* pCtx, u32 mode)\r\n{\t((CKLBUIScrollBar*)pCtx)->setMode(mode);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIScrollBar_getVertical\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getVertical(); }\r\nextern \"C\" DllExport void CKLBUIScrollBar_setVertical\t\t(s32* pCtx, bool vertical)\r\n{\t((CKLBUIScrollBar*)pCtx)->setVertical(vertical);\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getWidth\t\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getWidth(); } \r\nextern \"C\" DllExport void CKLBUIScrollBar_setWidth\t\t\t(s32* pCtx, s32 width)\r\n{\t((CKLBUIScrollBar*)pCtx)->setWidth(width);\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getHeight\t\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getHeight(); } \r\nextern \"C\" DllExport void CKLBUIScrollBar_setHeight\t\t\t(s32* pCtx, s32 height)\r\n{\t((CKLBUIScrollBar*)pCtx)->setHeight(height);\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getOrder\t\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getOrder(); } \r\nextern \"C\" DllExport void CKLBUIScrollBar_setOrder\t\t\t(s32* pCtx, u32 order)\r\n{\t((CKLBUIScrollBar*)pCtx)->setOrder(order);\t}\r\n\r\nextern \"C\" DllExport s32* CKLBUIScrollBar_getImage\t(s32* pCtx)\r\n{\treturn (s32*)((CKLBUIScrollBar*)pCtx)->getImage(); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getMode\t\t\t(s32* pCtx)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->getMode(); } \r\n\r\nextern \"C\" DllExport bool CKLBUIScrollBar_selectScrMgr\t\t(s32* pCtx, s32* name, int len, int* args)\r\n{\treturn ((CKLBUIScrollBar*)pCtx)->selectScrMgr((const char*)name, len, args); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIWebArea.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIWebArea_create(s32* pParent, bool mode, float x, float y, float width, float height, s32* url)\r\n{\treturn (s32*)CKLBUIWebArea::create((CKLBUITask*)pParent, NULL, mode, x, y, width, height, (const char*)url, NULL); }\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setWidth(s32* pCtx, s32 width)\r\n{\t((CKLBUIWebArea*)pCtx)->setWidth(width);\t}\r\nextern \"C\" DllExport s32 CKLBUIWebArea_getWidth(s32* pCtx)\r\n{\treturn ((CKLBUIWebArea*)pCtx)->getWidth(); }\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setHeight(s32* pCtx, s32 height)\r\n{\t((CKLBUIWebArea*)pCtx)->setHeight(height);\t}\r\nextern \"C\" DllExport s32 CKLBUIWebArea_getHeight(s32* pCtx)\r\n{\treturn ((CKLBUIWebArea*)pCtx)->getHeight(); }\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setText(s32* pCtx, s32* text)\r\n{\t((CKLBUIWebArea*)pCtx)->setText((const char*)text);\t}\r\nextern \"C\" DllExport s32* CKLBUIWebArea_getText(s32* pCtx)\r\n{\treturn (s32*)((CKLBUIWebArea*)pCtx)->getText(); }\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setScalesPageToFit(s32* pCtx, bool b)\r\n{\t((CKLBUIWebArea*)pCtx)->setScalesPageToFit(b);\t}\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setBgColor(s32* pCtx, u32 argb) {\t\r\n\tu32 alpha = argb >> 24;\r\n\tu32 color = argb & 0xFFFFFF;\t\r\n\t((CKLBUIWebArea*)pCtx)->setBgColor(alpha, color);\t\r\n}\r\n\r\n//======================================================================================\r\n#include \"CKLBUIVirtualDoc.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIVirtualDoc_create(\ts32* pParent,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 order, float x, float y,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 doc_width, u32 doc_height, \r\n\t\t\t\t\t\t\t\t\t\t\tu32 view_width, u32 view_height,\r\n\t\t\t\t\t\t\t\t\t\t\tu32 max_command_nums, bool vertical)\r\n{\treturn (s32*)CKLBUIVirtualDoc::create((CKLBUITask*)pParent, NULL, order, x, y, \r\n\t\t\t\t\t\t\t\t\tdoc_width, doc_height, view_width, view_height, max_command_nums, vertical); \r\n}\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_clear(s32* pCtx, u32 color) \r\n{ ((CKLBUIVirtualDoc*)pCtx)->clear(color); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setFont(s32* pCtx, u32 idx, s32* fontName, u32 fontSize) \r\n{ ((CKLBUIVirtualDoc*)pCtx)->setFont(idx, (const char*)fontName, fontSize); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setViewPortPos(s32* pCtx, s32 x, s32 y) \r\n{ ((CKLBUIVirtualDoc*)pCtx)->setViewPortPos(x, y); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_drawLine(s32* pCtx, s32 x0, s32 y0, s32 x1, s32 y1, u32 color)\r\n{ ((CKLBUIVirtualDoc*)pCtx)->drawLine(x0, y0, x1, y1, color); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_drawImage(s32* pCtx, s32 x0, s32 y0, s32* image, u32 alpha) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->drawImage(x0, y0, (const char*)image, alpha);\t}\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_fillRect(s32* pCtx, s32 x0, s32 y0, u32 width, u32 height, u32 color, bool fill)\r\n{\t((CKLBUIVirtualDoc*)pCtx)->fillRect(x0,y0,width,height,color,fill); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_drawText(s32* pCtx, s32 x0, s32 y0, s32* str, u32 color, u32 fontidx)\r\n{\t((CKLBUIVirtualDoc*)pCtx)->drawText(x0,y0,(const char*)str,color,fontidx); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_startDocument(s32* pCtx)\r\n{\t((CKLBUIVirtualDoc*)pCtx)->startDocument();\t}\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_checkDocumentSize(s32* pCtx)\r\n{\t((CKLBUIVirtualDoc*)pCtx)->checkDocumentSize();\t}\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_endDocument(s32* pCtx)\r\n{\t((CKLBUIVirtualDoc*)pCtx)->endDocument();\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getCommandMax(s32* pCtx) \r\n{ return ((CKLBUIVirtualDoc*)pCtx)->getCommandMax(); }\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setCommandMax(s32* pCtx, u32 command) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setCommandMax(command);\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getDocHeight(s32* pCtx) \r\n{ return ((CKLBUIVirtualDoc*)pCtx)->getDocHeight(); }\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setDocHeight(s32* pCtx, u32 height) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setDocHeight(height); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getDocWidth(s32* pCtx) \r\n{ return ((CKLBUIVirtualDoc*)pCtx)->getDocWidth();\t}\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setDocWidth(s32* pCtx, u32 width) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setDocWidth(width); }\r\n\r\nextern \"C\" DllExport bool CKLBUIVirtualDoc_getVertical(s32* pCtx) \r\n{ return ((CKLBUIVirtualDoc*)pCtx)->getVertical(); }\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setVertical(s32* pCtx, bool vertical) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setVertical(vertical); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getViewHeight(s32* pCtx) \r\n{ return ((CKLBUIVirtualDoc*)pCtx)->getViewHeight(); }\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setViewHeight(s32* pCtx, u32 height) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setViewHeight(height); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getViewWidth(s32* pCtx) \r\n{ return ((CKLBUIVirtualDoc*)pCtx)->getViewWidth(); }\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setViewWidth(s32* pCtx, u32 width) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setViewWidth(width); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUIVirtualDoc*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setOrder(s32* pCtx, u32 order) \r\n{\t((CKLBUIVirtualDoc*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setAlign(s32* pCtx, u32 align, u32 alignWidth)\r\n{\t((CKLBUIVirtualDoc*)pCtx)->setAlign(align, alignWidth);\t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUISWFPlayer.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUISWFPlayer_create(\ts32* pParent, \r\n\t\t\t\t\t\t\t\t\t\t\tu32 order, float x, float y, s32* asset,\r\n\t\t\t\t\t\t\t\t\t\t\ts32* movie_name, s32** replace_list, int asset_cnt)\r\n{\treturn (s32*)CKLBUISWFPlayer::create((CKLBUITask*)pParent, NULL, order, x, y, (const char*)asset, (const char*)movie_name, NULL, (const char**)replace_list, asset_cnt); }\r\n\r\nextern \"C\" DllExport bool CKLBUISWFPlayer_getPlay(s32* pCtx)\t\t\t\r\n{ return ((CKLBUISWFPlayer*)pCtx)->getPlay(); }\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setPlay(s32* pCtx,bool play)\r\n{\t((CKLBUISWFPlayer*)pCtx)->setPlay(play); }\r\n\r\nextern \"C\" DllExport u32 CKLBUISWFPlayer_getOrder(s32* pCtx)\t\t\t\r\n{ return ((CKLBUISWFPlayer*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setOrder(s32* pCtx,u32 order)\r\n{\t((CKLBUISWFPlayer*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport void CKLBUISWFPlayer_gotoFrame(s32* pCtx,s32* label)\r\n{\t((CKLBUISWFPlayer*)pCtx)->gotoFrame((const char*)label); }\r\n\r\nextern \"C\" DllExport u16 CKLBUISWFPlayer_getFrameRate(s32* pCtx)\r\n{\treturn ((CKLBUISWFPlayer*)pCtx)->getFrameRate(); }\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setFrameRate(s32* pCtx,u32 fps)\r\n{\t((CKLBUISWFPlayer*)pCtx)->setFrameRate(fps); }\r\n\r\nextern \"C\" DllExport bool CKLBUISWFPlayer_isAnimating(s32* pCtx) \r\n{ return ((CKLBUISWFPlayer*)pCtx)->isAnimating(); }\r\n\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setFrameRateScale(s32* pCtx,float scale)\r\n{\t((CKLBUISWFPlayer*)pCtx)->setFrameRateScale(scale); }\r\n\r\nextern \"C\" DllExport s32* CKLBUISWFPlayer_getAsset(s32* pCtx)\r\n{ return (s32*)((CKLBUISWFPlayer*)pCtx)->getAsset(); \t\t}\r\n\r\nextern \"C\" DllExport s32* CKLBUISWFPlayer_getMovieName(s32* pCtx)\r\n{ return (s32*)((CKLBUISWFPlayer*)pCtx)->getMovieName(); \t}\r\n\r\nextern \"C\" DllExport float CKLBUISWFPlayer_getVolume(s32* pCtx)\r\n{ return ((CKLBUISWFPlayer*)pCtx)->getVolume(); \t}\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setVolume(s32* pCtx,float volume)\r\n{\t((CKLBUISWFPlayer*)pCtx)->setVolume(volume); \t}\r\n\t\r\n//======================================================================================\r\n#include \"CKLBUIGroup.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIGroup_create(s32* pParent, float x, float y)\r\n{\treturn (s32*)CKLBUIGroup::create((CKLBUITask*)pParent, NULL, x, y); }\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_setAnimCallback(s32* pCtx, s32* callback)\r\n{\treturn ((CKLBUIGroup*)pCtx)->setAnimCallback((const char*)callback); }\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_setAnimation(s32* pCtx, s32* name, bool blend)\r\n{\treturn ((CKLBUIGroup*)pCtx)->setAnimation((const char*)name, blend); }\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_isAnim(s32* pCtx, s32* name)\r\n{\treturn ((CKLBUIGroup*)pCtx)->isAnim((const char*)name); }\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_skipAnim(s32* pCtx, s32* name)\r\n{\treturn ((CKLBUIGroup*)pCtx)->skipAnim((const char*)name); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIPolyline.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIPolyline_create(s32* pParent, u32 order, u32 maxPoint)\r\n{\treturn (s32*)CKLBUIPolyline::create((CKLBUITask*)pParent, NULL, order, maxPoint); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getMaxPoint(s32* pCtx) \r\n{\treturn ((CKLBUIPolyline*)pCtx)->getMaxPoint();\t}\r\nextern \"C\" DllExport void CKLBUIPolyline_setMaxPoint(s32* pCtx,u32 maxpointcount)\r\n{\t((CKLBUIPolyline*)pCtx)->setMaxPoint(maxpointcount); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUIPolyline*)pCtx)->getOrder();\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getPointCount(s32* pCtx) \r\n{\treturn ((CKLBUIPolyline*)pCtx)->getPointCount();\t}\r\nextern \"C\" DllExport void CKLBUIPolyline_setPointCount(s32* pCtx,u32 pointcount)\r\n{\t((CKLBUIPolyline*)pCtx)->setPointCount(pointcount); }\r\n\r\nextern \"C\" DllExport void CKLBUIPolyline_setPoint(s32* pCtx,u32 idx, float x, float y)\r\n{\t((CKLBUIPolyline*)pCtx)->setPoint(idx,x,y); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getColor(s32* pCtx) \r\n{\treturn ((CKLBUIPolyline*)pCtx)->getColor();\t}\r\nextern \"C\" DllExport void CKLBUIPolyline_setColor(s32* pCtx,u32 color)\r\n{\t((CKLBUIPolyline*)pCtx)->setColor(color); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIFreeVertItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIFreeVertItem_create(s32* pParent, u32 order, float x, float y, s32* asset, float* vertices)\r\n{\treturn (s32*)CKLBUIFreeVertItem::create((CKLBUITask*)pParent, NULL, order, x, y, (const char*)asset, vertices); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIFreeVertItem_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUIFreeVertItem*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setOrder(s32* pCtx,u32 order)\r\n{\t((CKLBUIFreeVertItem*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIFreeVertItem_getAsset(s32* pCtx)\r\n{\treturn (s32*)((CKLBUIFreeVertItem*)pCtx)->getAsset(); }\r\n\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setVertices(s32* pCtx, float* coord)\r\n{\t((CKLBUIFreeVertItem*)pCtx)->setVertXY(coord); }\r\n\t\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setColors(s32* pCtx, u32* colors)\r\n{\t((CKLBUIFreeVertItem*)pCtx)->setVertColors(colors); }\t\r\n\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setVertCol(s32* pCtx, u32 idx, u32 argb)\r\n{\treturn ((CKLBUIFreeVertItem*)pCtx)->setVertCol(idx, argb); }\r\n\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setUV(s32* pCtx, float* uv)\r\n{\t((CKLBUIFreeVertItem*)pCtx)->setVertUV(uv); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUITextInput.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUITextInput_create(s32* pParent,\r\n\t\t\t\t\t\t\t\t\t\tbool passwdmode,\r\n\t\t\t\t\t\t\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t\t\ts32* default_text,\r\n\t\t\t\t\t\t\t\t\t\tu32 widget_id, int maxlen, u32 chartype)\r\n{\treturn (s32*)CKLBUITextInput::create((CKLBUITask*)pParent, NULL, passwdmode, x, y, width, height, (const char*)default_text, NULL, widget_id, maxlen, chartype); }\r\n\r\nextern \"C\" DllExport u32  CKLBUITextInput_getWidth(s32* pCtx)\r\n{\treturn ((CKLBUITextInput*)pCtx)->getWidth(); \t}\r\nextern \"C\" DllExport void CKLBUITextInput_setWidth(s32* pCtx, u32 width)\r\n{\t((CKLBUITextInput*)pCtx)->setWidth(width); \t\t}\r\n\r\nextern \"C\" DllExport u32 CKLBUITextInput_getHeight(s32* pCtx)\r\n{\treturn ((CKLBUITextInput*)pCtx)->getHeight(); \t}\r\nextern \"C\" DllExport void CKLBUITextInput_setHeight(s32* pCtx, u32 height)\r\n{\t((CKLBUITextInput*)pCtx)->setHeight(height); \t}\r\n\r\nextern \"C\" DllExport s32* CKLBUITextInput_getText(s32* pCtx)\r\n{\treturn (s32*)((CKLBUITextInput*)pCtx)->getText(); \t}\r\nextern \"C\" DllExport void CKLBUITextInput_setText(s32* pCtx, s32* text)\r\n{\t((CKLBUITextInput*)pCtx)->setText((const char*)text); \t\t}\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setPlaceHolder(s32* pCtx, s32* placeHolder)\r\n{\t((CKLBUITextInput*)pCtx)->setPlaceHolder((const char*)placeHolder);\t}\r\n\r\nextern \"C\" DllExport int CKLBUITextInput_getMaxLen(s32* pCtx)\r\n{\treturn ((CKLBUITextInput*)pCtx)->getMaxLen(); \t}\r\nextern \"C\" DllExport void CKLBUITextInput_setMaxLen(s32* pCtx, int maxLen)\r\n{\t((CKLBUITextInput*)pCtx)->setMaxLen(maxLen); \t}\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setCharType(s32* pCtx, u32 charType)\r\n{\t((CKLBUITextInput*)pCtx)->setCharType(charType); }\r\n\r\nextern \"C\" DllExport s32 CKLBUITextInput_getCharCount(s32* pCtx)\r\n{\treturn ((CKLBUITextInput*)pCtx)->getCharCount(); }\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setColor(s32* pCtx, bool bTouch, u32 fgRgb, u32 bgRgb)\r\n{\t((CKLBUITextInput*)pCtx)->setColor(bTouch, fgRgb, bgRgb); \t}\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setFont(s32* pCtx, s32* fontName, float fontSize)\r\n{\t((CKLBUITextInput*)pCtx)->setFont((const char*)fontName, fontSize); \t\t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUIMultiImgItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIMultiImgItem_create(s32* pParent, u32 order, float x, float y, u32 idx, s32** pArrayAsset,\r\n\t\t\t\t\t\t\t\t\t\t\t\tu32* pArrayIndexes, u32 assetCount)\r\n{ return (s32*)CKLBUIMultiImgItem::create((CKLBUITask*)pParent,NULL,order,x,y,idx,(const char**)pArrayAsset,pArrayIndexes,assetCount); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIMultiImgItem_getIndexMax(s32* pCtx)\r\n{\treturn ((CKLBUIMultiImgItem*)pCtx)->getIndexMax(); }\r\nextern \"C\" DllExport void CKLBUIMultiImgItem_setIndexMax(s32* pCtx,u32 index)\r\n{\t((CKLBUIMultiImgItem*)pCtx)->setIndexMax(index); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIMultiImgItem_getOrder(s32* pCtx)\r\n{\treturn ((CKLBUIMultiImgItem*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIMultiImgItem_setOrder(s32* pCtx,u32 order)\r\n{\t((CKLBUIMultiImgItem*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIMultiImgItem_getIndex(s32* pCtx)\r\n{\treturn ((CKLBUIMultiImgItem*)pCtx)->getIndex(); }\r\nextern \"C\" DllExport void CKLBUIMultiImgItem_setIndex(s32* pCtx, u32 index)\r\n{\t((CKLBUIMultiImgItem*)pCtx)->setIndex(index); }\r\n\r\nextern \"C\" DllExport bool CKLBUIMultiImgItem_changeAssets(s32* pCtx, s32** pArrayAsset, u32* pArrayIndexes, u32 assetCount)\r\n{ return ((CKLBUIMultiImgItem*)pCtx)->changeAssets((const char**)pArrayAsset, pArrayIndexes, assetCount); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIRubberBand.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_create(s32* pParent, u32 order, float x, float y, u32 resolution, s32* origin, s32* joint,\r\n\t\t\t\t\t\t\t\t\t\t\ts32* point, u32 flags, u32 animTime, s32 joint_order_off, s32 point_order_off, bool rot_origin, bool rot_joint, bool rot_point)\r\n{ return (s32*)CKLBUIRubberBand::create((CKLBUITask*)pParent,NULL,order,x,y,resolution,(const char*)origin,(const char*)joint,(const char*)point,flags,animTime,joint_order_off,point_order_off,rot_origin,rot_joint,rot_point); }\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getOriginX(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getOriginX(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setOriginX(s32* pCtx,float x)\r\n{ ((CKLBUIRubberBand*)pCtx)->setOriginX(x); }\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getOriginY(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getOriginY(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setOriginY(s32* pCtx,float y)\r\n{ ((CKLBUIRubberBand*)pCtx)->setOriginY(y); }\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getPointX(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getPointX(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setPointX(s32* pCtx,float x)\r\n{ ((CKLBUIRubberBand*)pCtx)->setPointX(x); }\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getPointY(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getPointY(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setPointY(s32* pCtx,float y)\r\n{ ((CKLBUIRubberBand*)pCtx)->setPointY(y); }\r\n\r\nextern \"C\" DllExport bool CKLBUIRubberBand_getFAnim(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getFAnim(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setFAnim(s32* pCtx,bool fAnim)\r\n{ ((CKLBUIRubberBand*)pCtx)->setFAnim(fAnim); }\r\n\r\nextern \"C\" DllExport bool CKLBUIRubberBand_getFAnimRT(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getFAnimRT(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setFAnimRT(s32* pCtx,bool fAnimRT)\r\n{ ((CKLBUIRubberBand*)pCtx)->setFAnimRT(fAnimRT); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIRubberBand_getAnimTime(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getAnimTime(); }\r\nextern \"C\" DllExport void CKLBUIRubberBand_setAnimTime(s32* pCtx,u32 animTime)\r\n{ ((CKLBUIRubberBand*)pCtx)->setAnimTime(animTime); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIRubberBand_getOrder(s32* pCtx)\r\n{ return ((CKLBUIRubberBand*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_getAssetOrigin(s32* pCtx)\r\n{ return (s32*)((CKLBUIRubberBand*)pCtx)->getAssetOrigin(); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_getAssetJoint(s32* pCtx)\r\n{ return (s32*)((CKLBUIRubberBand*)pCtx)->getAssetJoint(); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_getAssetPoint(s32* pCtx)\r\n{ return (s32*)((CKLBUIRubberBand*)pCtx)->getAssetPoint(); }\r\n\r\nextern \"C\" DllExport bool CKLBUIRubberBand_setOrder(s32* pCtx, u32 order_origin, u32 order_joint, u32 order_point)\r\n{ return ((CKLBUIRubberBand*)pCtx)->setOrder(order_origin, order_joint, order_point); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIPieChart.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIPieChart_create(s32* pParent, u32 order, float x, float y, float width, float height, s32* asset, float start,\r\n\t\t\t\t\t\t\t\t\t\tfloat end, u32 anim, float initial)\r\n{ return (s32*)CKLBUIPieChart::create((CKLBUITask*)pParent,NULL,order,x,y,width,height,(const char*)asset,start,end,anim,initial); }\r\n\r\nextern \"C\" DllExport float CKLBUIPieChart_getStart(s32* pCtx)\r\n{ return ((CKLBUIPieChart*)pCtx)->getStart(); }\r\nextern \"C\" DllExport void CKLBUIPieChart_setStart(s32* pCtx,float start)\r\n{ ((CKLBUIPieChart*)pCtx)->setStart(start); }\r\n\r\nextern \"C\" DllExport float CKLBUIPieChart_getEnd(s32* pCtx)\r\n{ return ((CKLBUIPieChart*)pCtx)->getEnd(); }\r\nextern \"C\" DllExport void CKLBUIPieChart_setEnd(s32* pCtx,float end)\r\n{ ((CKLBUIPieChart*)pCtx)->setEnd(end); }\r\n\r\nextern \"C\" DllExport float CKLBUIPieChart_getValue(s32* pCtx)\r\n{ return ((CKLBUIPieChart*)pCtx)->getValue(); }\r\nextern \"C\" DllExport void CKLBUIPieChart_setValue(s32* pCtx,float value)\r\n{ ((CKLBUIPieChart*)pCtx)->setValue(value); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIPieChart_getAnim(s32* pCtx)\r\n{ return ((CKLBUIPieChart*)pCtx)->getAnim(); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIPieChart_getOrder(s32* pCtx)\r\n{ return ((CKLBUIPieChart*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport bool CKLBUIPieChart_changeAsset(s32* pCtx, s32* assetName)\r\n{ return ((CKLBUIPieChart*)pCtx)->changeAsset((const char*)assetName); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIMoviePlayer.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIMoviePlayer_create(s32* pParent, bool mode, float x, float y, float width, float height, s32* url)\r\n{ return (s32*)CKLBUIMoviePlayer::create((CKLBUITask*)pParent,NULL,mode,x,y,width,height,(const char*)url,NULL); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_setWidth(s32* pCtx,u32 width)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->setWidth(width); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIMoviePlayer_getWidth(s32* pCtx)\r\n{ return ((CKLBUIMoviePlayer*)pCtx)->getWidth(); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_setHeight(s32* pCtx,u32 height)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->setHeight(height); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIMoviePlayer_getHeight(s32* pCtx)\r\n{ return ((CKLBUIMoviePlayer*)pCtx)->getHeight(); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_setText(s32* pCtx, s32* text)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->setText((const char*)text); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIMoviePlayer_getText(s32* pCtx)\r\n{ return (s32*)((CKLBUIMoviePlayer*)pCtx)->getText(); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_moviePlay(s32* pCtx)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->moviePlay(); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_movieStop(s32* pCtx)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->movieStop(); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_moviePause(s32* pCtx)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->moviePause(); }\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_movieResume(s32* pCtx)\r\n{ ((CKLBUIMoviePlayer*)pCtx)->movieResume(); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIDragIcon.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIDragIcon_create(s32* pParent, u32 order, float x, float y, s32* tap_area, s32* asset, s32* drag_asset,\r\n\t\t\t\t\t\t\t\t\t\ts32 drag_order_offset, float drag_alpha, float center_x, float center_y, u32 flags)\r\n{ return (s32*)CKLBUIDragIcon::create((CKLBUITask*)pParent,NULL,order,x,y,(CKLBUIDragIcon::AREA*)tap_area,(const char*)asset,(const char*)drag_asset,drag_order_offset,drag_alpha,center_x,center_y,NULL,flags); }\r\n\r\nextern \"C\" DllExport u32\tCKLBUIDragIcon_getOrder(s32* pCtx)\r\n{ return ((CKLBUIDragIcon*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIDragIcon_getAsset(s32* pCtx)\r\n{ return (s32*)((CKLBUIDragIcon*)pCtx)->getAsset(); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIDragIcon_getDrag(s32* pCtx)\r\n{ return (s32*)((CKLBUIDragIcon*)pCtx)->getDrag(); }\r\n\r\nextern \"C\" DllExport u32\tCKLBUIDragIcon_getFlags(s32* pCtx)\r\n{ return ((CKLBUIDragIcon*)pCtx)->getFlags(); }\r\nextern \"C\" DllExport void CKLBUIDragIcon_setFlags(s32* pCtx,u32 flag)\r\n{ ((CKLBUIDragIcon*)pCtx)->setFlags(flag); }\r\n\r\nextern \"C\" DllExport bool CKLBUIDragIcon_getEnable(s32* pCtx)\r\n{ return ((CKLBUIDragIcon*)pCtx)->getEnable(); }\r\nextern \"C\" DllExport void CKLBUIDragIcon_setEnable(s32* pCtx,bool enable)\r\n{ ((CKLBUIDragIcon*)pCtx)->setEnable(enable); }\r\n\r\nextern \"C\" DllExport float CKLBUIDragIcon_getDragScaleX(s32* pCtx)\r\n{ return ((CKLBUIDragIcon*)pCtx)->getDragScaleX(); }\r\nextern \"C\" DllExport void CKLBUIDragIcon_setDragScaleX(s32* pCtx,float scale)\r\n{ ((CKLBUIDragIcon*)pCtx)->setDragScaleX(scale); }\r\n\r\nextern \"C\" DllExport float CKLBUIDragIcon_getDragScaleY(s32* pCtx)\r\n{ return ((CKLBUIDragIcon*)pCtx)->getDragScaleY(); }\r\nextern \"C\" DllExport void CKLBUIDragIcon_setDragScaleY(s32* pCtx,float scale)\r\n{ ((CKLBUIDragIcon*)pCtx)->setDragScaleY(scale); }\r\n\r\nextern \"C\" DllExport void CKLBUIDragIcon_dragArea(s32* pCtx, s32* area)\r\n{ ((CKLBUIDragIcon*)pCtx)->setDragArea(*(CKLBUIDragIcon::AREA*)area); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIDebugItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIDebugItem_create(s32* pParent, u32 order, float x, float y, u32 argb, s32* font, u32 size, s32* text, u32 id)\r\n{\r\n\tu32 alpha = argb >> 24;\r\n\tu32 color = argb & 0xFFFFFF;\r\n\treturn (s32*)CKLBUIDebugItem::create((CKLBUITask*)pParent,NULL,order,x,y,alpha,color,(const char*)font,size,(const char*)text,\"\",id);\r\n}\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setOrder(s32* pCtx,u32 order)\r\n{ ((CKLBUIDebugItem*)pCtx)->setOrder(order); }\r\nextern \"C\" DllExport u32 CKLBUIDebugItem_getOrder(s32* pCtx)\r\n{ return ((CKLBUIDebugItem*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setColor(s32* pCtx,u32 color)\r\n{ ((CKLBUIDebugItem*)pCtx)->setColor(color); }\r\nextern \"C\" DllExport u32 CKLBUIDebugItem_getColor(s32* pCtx)\r\n{ return ((CKLBUIDebugItem*)pCtx)->getColor(); }\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setFont(s32* pCtx,s32* font)\r\n{ ((CKLBUIDebugItem*)pCtx)->setFont((const char*)font); }\r\nextern \"C\" DllExport s32* CKLBUIDebugItem_getFont(s32* pCtx)\r\n{ return (s32*)((CKLBUIDebugItem*)pCtx)->getFont(); }\r\n\r\n// Font size\r\nextern \"C\" DllExport void CKLBUIDebugItem_setSize(s32* pCtx,u32 size)\r\n{ ((CKLBUIDebugItem*)pCtx)->setSize(size); }\r\nextern \"C\" DllExport u32 CKLBUIDebugItem_getSize(s32* pCtx)\r\n{ return ((CKLBUIDebugItem*)pCtx)->getSize(); }\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setText(s32* pCtx,s32* text)\r\n{ ((CKLBUIDebugItem*)pCtx)->setText((const char*)text); }\r\nextern \"C\" DllExport s32* CKLBUIDebugItem_getText(s32* pCtx)\r\n{ return (s32*)((CKLBUIDebugItem*)pCtx)->getText(); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUILabel.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUILabel_create(s32* pParent, u32 order, float x, float y, u32 argb, s32* font, u32 size, s32* text, u32 align)\r\n{ \r\n\tu32 alpha = argb >> 24;\r\n\tu32 color = argb & 0xFFFFFF;\r\n\treturn (s32*)CKLBUILabel::create((CKLBUITask*)pParent,NULL,order,x,y,alpha,color,(const char*)font,size,(const char*)text,align);\r\n}\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getOrder(s32* pCtx)\r\n{ return ((CKLBUILabel*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUILabel_setOrder(s32* pCtx,u32 order)\r\n{ ((CKLBUILabel*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getAlign(s32* pCtx)\r\n{ return ((CKLBUILabel*)pCtx)->getAlign(); }\r\nextern \"C\" DllExport void CKLBUILabel_setAlign(s32* pCtx,u32 align)\r\n{ ((CKLBUILabel*)pCtx)->setAlign(align); }\r\n\r\nextern \"C\" DllExport s32* CKLBUILabel_getText(s32* pCtx)\r\n{ return (s32*)((CKLBUILabel*)pCtx)->getText(); }\r\nextern \"C\" DllExport void CKLBUILabel_setText(s32* pCtx,s32* txt)\r\n{ ((CKLBUILabel*)pCtx)->setText((const char*)txt); }\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getColor(s32* pCtx)\r\n{ return ((CKLBUILabel*)pCtx)->getColor(); }\r\nextern \"C\" DllExport void CKLBUILabel_setColor(s32* pCtx,u32 color)\r\n{ ((CKLBUILabel*)pCtx)->setColor(color); }\r\n\r\nextern \"C\" DllExport s32* CKLBUILabel_getFont(s32* pCtx)\r\n{ return (s32*)((CKLBUILabel*)pCtx)->getFont(); }\r\nextern \"C\" DllExport void CKLBUILabel_setFont(s32* pCtx,s32* font)\r\n{ ((CKLBUILabel*)pCtx)->setFont((const char*)font); }\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getFontSize(s32* pCtx)\r\n{ return ((CKLBUILabel*)pCtx)->getFontSize(); }\r\nextern \"C\" DllExport void CKLBUILabel_setFontSize(s32* pCtx,u32 size)\r\n{ ((CKLBUILabel*)pCtx)->setFontSize(size); }\r\n\r\nextern \"C\" DllExport void CKLBUILabel_setPosition(s32* pCtx, float x, float y)\r\n{ ((CKLBUILabel*)pCtx)->setPosition(x,y); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIList.h\"\r\n \r\nextern \"C\" DllExport  s32* CKLBUIList_create(s32* pParent, u32 base_order, u32 max_order, float x, float y, float clip_width, float clip_height,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts32 default_line_step, bool vertical, u32 optional_flags)\r\n{ return (s32*)CKLBUIList::create((CKLBUITask*)pParent,NULL,base_order,max_order,x,y,clip_width,clip_height,default_line_step,vertical,\"\",optional_flags); }\r\n \r\nextern \"C\" DllExport u32 CKLBUIList_getWidth(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getWidth(); }\r\nextern \"C\" DllExport void CKLBUIList_setWidth(s32* pCtx,u32 width)\r\n{ ((CKLBUIList*)pCtx)->setWidth(width); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getHeight(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getHeight(); }\r\nextern \"C\" DllExport void CKLBUIList_setHeight(s32* pCtx,u32 height)\r\n{ ((CKLBUIList*)pCtx)->setHeight(height); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getStepX(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getStepX(); }\r\nextern \"C\" DllExport void CKLBUIList_setStepX(s32* pCtx,s32 x)\r\n{ ((CKLBUIList*)pCtx)->setStepX(x); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getStepY(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getStepY(); }\r\nextern \"C\" DllExport void CKLBUIList_setStepY(s32* pCtx,s32 x)\r\n{ ((CKLBUIList*)pCtx)->setStepY(x); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getOrder(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIList_setOrder(s32* pCtx,u32 order)\r\n{ ((CKLBUIList*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getMaxOrder(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getMaxOrder(); }\r\nextern \"C\" DllExport void CKLBUIList_setMaxOrder(s32* pCtx,u32 maxOrder)\r\n{ ((CKLBUIList*)pCtx)->setMaxOrder(maxOrder); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_getVertical(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getVertical(); }\r\nextern \"C\" DllExport void CKLBUIList_setVertical(s32* pCtx,bool vertical)\r\n{ ((CKLBUIList*)pCtx)->setVertical(vertical); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getItems(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getItems(); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getMarginTop(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getMarginTop(); }\r\nextern \"C\" DllExport void CKLBUIList_setMarginTop(s32* pCtx,s32 top)\r\n{ ((CKLBUIList*)pCtx)->setMarginTop(top); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getMarginBottom(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getMarginBottom(); }\r\nextern \"C\" DllExport void CKLBUIList_setMarginBottom(s32* pCtx,s32 bottom)\r\n{ ((CKLBUIList*)pCtx)->setMarginBottom(bottom); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_getDefaultScroll(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->getDefaultScroll(); }\r\nextern \"C\" DllExport void CKLBUIList_setDefaultScroll(s32* pCtx,bool scroll)\r\n{ ((CKLBUIList*)pCtx)->setDefaultScroll(scroll); }\r\n \r\nextern \"C\" DllExport bool CKLBUIList_cmdItemRemove(s32* pCtx,s32 idx)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemRemove(idx); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdItemMove(s32* pCtx,s32 src, s32 dst)\r\n{ ((CKLBUIList*)pCtx)->cmdItemMove(src,dst); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetMargin(s32* pCtx,s32 top, s32 bottom)\r\n{ ((CKLBUIList*)pCtx)->cmdSetMargin(top,bottom); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdGetPosition(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->cmdGetPosition(); }\r\nextern \"C\" DllExport s32 CKLBUIList_cmdSetPosition(s32* pCtx, s32 pos, s32 dir)\r\n{ return ((CKLBUIList*)pCtx)->cmdSetPosition(pos, dir); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdSearchID(s32* pCtx,u32 id)\t// Return a value ?\r\n{ return ((CKLBUIList*)pCtx)->cmdSearchID(id); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetItemPos(s32* pCtx,u32 mode, s32 idx, s32 offset)\r\n{ ((CKLBUIList*)pCtx)->cmdSetItemPos(mode, idx, offset); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetLimitClip(s32* pCtx,bool chklimit)\r\n{ ((CKLBUIList*)pCtx)->cmdSetLimitClip(chklimit, NULL); }\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdGetLimit(s32* pCtx)\r\n{ return ((CKLBUIList*)pCtx)->cmdGetLimit(); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdSetLimitArea(s32* pCtx,s32 limitArea)\r\n{ return ((CKLBUIList*)pCtx)->cmdSetLimitArea(limitArea); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdChangeStep(s32* pCtx,s32 index, s32 step)\r\n{ ((CKLBUIList*)pCtx)->cmdChangeStep(index, step); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdInputEnable(s32* pCtx,bool enable)\r\n{ ((CKLBUIList*)pCtx)->cmdInputEnable(enable); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAnimationItem(s32* pCtx,s32 index, s32* name, bool blend)\r\n{ return ((CKLBUIList*)pCtx)->cmdAnimationItem(index, (const char*)name, blend); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAnimationAll(s32* pCtx, s32* name, bool blend)\r\n{ return ((CKLBUIList*)pCtx)->cmdAnimationAll((const char*)name, blend); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdItemAnimSkip(s32* pCtx,s32 index, s32* name)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemAnimSkip(index, (const char*)name); }\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAllAnimSkip(s32* pCtx, s32* name)\r\n{ return ((CKLBUIList*)pCtx)->cmdAllAnimSkip((const char*)name); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetGroup(s32* pCtx, s32* group_name)\r\n{ ((CKLBUIList*)pCtx)->cmdSetGroup((const char*)group_name); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetItemID(s32* pCtx, s32 index, u32 id)\r\n{ ((CKLBUIList*)pCtx)->cmdSetItemID(index,id);\t}\r\n\r\nextern \"C\" DllExport void CKLBUIList_setLoop(s32* pCtx, bool mode)\r\n{ ((CKLBUIList*)pCtx)->setLoop(mode);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIList_useScrollBar(s32* pCtx, u32 order, bool side, s32 lineWeight, s32* image, s32 min_slender_size, u32 colorNormal, u32 colorSelect, bool active, bool hideMode, bool shortHide)\r\n{ return ((CKLBUIList*)pCtx)->useScrollBar(order,side,lineWeight,(const char*)image,min_slender_size,NULL,colorNormal,colorSelect,active,hideMode,shortHide); }\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdFWModeConfig(s32* pCtx, int itemStep, int maxItems)\r\n{ ((CKLBUIList*)pCtx)->cmdFWModeConfig(itemStep, maxItems);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdSetItemMode(s32* pCtx, int itemMode)\r\n{ return ((CKLBUIList*)pCtx)->cmdSetItemMode(itemMode, \"\");\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAddRecords(s32* pCtx, s32 insIdx, s32* form, s32* db, s32 step)\r\n{ \r\n\tu32 sizeTemplate;\r\n\tu32 sizeDBRec;\r\n\tconst char * tpform = CKLBUIList::toJSON((const char*)form, sizeTemplate);\r\n\tconst char * dbrecs = CKLBUIList::toJSON((const char*)db, sizeDBRec);\r\n\t\r\n\treturn ((CKLBUIList*)pCtx)->cmdAddRecords(insIdx, tpform, sizeTemplate, dbrecs, sizeDBRec, step);\r\n}\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdSetInitial(s32* pCtx, s32 pos)\r\n{ return ((CKLBUIList*)pCtx)->cmdSetInitial(pos);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdSelectScrMgr(s32* pCtx, s32* name, s32* optParams, u32 nb)\r\n{ return ((CKLBUIList*)pCtx)->cmdSelectScrMgr((const char*)name, optParams, nb);\t}\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetClip(s32* pCtx, u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight)\r\n{ return ((CKLBUIList*)pCtx)->cmdSetClip(orderBegin, orderEnd, clipX, clipY, clipWidth, clipHeight);\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdItemAdd(s32* pCtx, s32* asset)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemAdd((const char*)asset);\t}\r\nextern \"C\" DllExport s32 CKLBUIList_cmdItemAdd2(s32* pCtx, s32* asset, s32 step, s32 id)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemAdd((const char*)asset, step, id);\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdInsertItem(s32* pCtx, s32* asset, s32 index)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemInsert((const char*)asset, index);\t}\r\nextern \"C\" DllExport s32 CKLBUIList_cmdInsertItem2(s32* pCtx, s32* asset, s32 index, s32 step, s32 id)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemInsert((const char*)asset, index, step, id);\t}\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdRemoveSelection(s32* pCtx, s32* indexes, u32 nb)\r\n{ return ((CKLBUIList*)pCtx)->cmdItemRemoveSelection(indexes, nb);\t\t}\r\n\r\nextern \"C\" DllExport void CKLBUIList_setDragRect(s32* pCtx, s32 left, s32 top, s32 right, s32 bottom)\r\n{ return ((CKLBUIList*)pCtx)->setDragRect(left, top, right, bottom);\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdExistNode(s32* pCtx, s32 index, s32* name)\r\n{ return ((CKLBUIList*)pCtx)->cmdExistNode(index, (const char*)name);\t}\r\n\r\n//======================================================================================\r\n#include \"CKLBUIForm.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIForm_create(s32* pParent, u32 order, float x, float y, bool bAssetFile, s32* asset, bool bExclusive, bool modal, bool urgent)\r\n{ return (s32*)CKLBUIForm::create((CKLBUITask*)pParent, NULL, order, x, y, bAssetFile, (const char*)asset, bExclusive, modal, urgent); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIForm_getAsset(s32* pCtx)\r\n{ return (s32*)((CKLBUIForm*)pCtx)->getAsset(); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIForm_getOrder(s32* pCtx)\r\n{ return ((CKLBUIForm*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_getExclusive(s32* pCtx)\r\n{ return ((CKLBUIForm*)pCtx)->getExclusive(); }\t\r\nextern \"C\" DllExport void CKLBUIForm_setExclusive(s32* pCtx, bool exclusive)\r\n{ ((CKLBUIForm*)pCtx)->setExclusive(exclusive); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_getIsFile(s32* pCtx)\r\n{ return ((CKLBUIForm*)pCtx)->getAssetFile(); }\r\n\r\nextern \"C\" DllExport void CKLBUIForm_setEnable(s32* pCtx, bool isEnabled)\r\n{ ((CKLBUIForm*)pCtx)->setEnable(isEnabled); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_existNode(s32* pCtx, s32* name)\r\n{ return ((CKLBUIForm*)pCtx)->existNode((const char*)name);\t}\r\n\r\nextern \"C\" DllExport void CKLBUIForm_inputEnable(s32* pCtx, bool bEnable)\r\n{ ((CKLBUIForm*)pCtx)->inputEnable(bEnable); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_animation(s32* pCtx, s32* animname, bool blend)\r\n{ return ((CKLBUIForm*)pCtx)->animation((const char*)animname, blend); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_isAnim(s32* pCtx, s32* name)\r\n{ return ((CKLBUIForm*)pCtx)->isAnim((const char*)name); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_skipAnim(s32* pCtx, s32* name)\r\n{ return ((CKLBUIForm*)pCtx)->skipAnim((const char*)name); }\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_animEnter(s32* pCtx)\r\n{ return ((CKLBUIForm*)pCtx)->animEnter();\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_animLeave(s32* pCtx)\r\n{ return ((CKLBUIForm*)pCtx)->animLeave();\t}\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_setGroup(s32* pCtx, s32* group_name)\r\n{ return ((CKLBUIForm*)pCtx)->setGroup((const char*)group_name); }\r\n\r\nextern \"C\" DllExport void CKLBUIForm_setGlobalVolume(s32* pCtx, float volume)\r\n{ return ((CKLBUIForm*)pCtx)->setGlobalVolume(volume); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIControl.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\nextern \"C\" DllExport s32* CKLBUIControl_create(s32* pParentTask)\r\n{ return (s32*)CKLBUIControl::create((CKLBTask*)pParentTask, \"\", \"\"); }\r\n\r\nextern \"C\" DllExport void CKLBUIControl_lock(s32* pCtx, bool lockMode)\r\n{ ((CKLBUIControl*)pCtx)->lock(lockMode); }\r\n\r\nextern \"C\" DllExport bool CKLBUIControl_setGroup(s32* pCtx, s32* groupName)\r\n{ return ((CKLBUIControl*)pCtx)->setGroup((const char*)groupName); }\r\n\r\nextern \"C\" DllExport void CKLBUIControl_setMask(s32* pCtx, u16 mask)\r\n{ ((CKLBUIControl*)pCtx)->setMask(mask); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUITouchPad.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\nextern \"C\" DllExport s32* CKLBUITouchPad_create(s32* pParent, bool modal)\r\n{ return (s32*)CKLBUITouchPad::create((CKLBTask*)pParent, \"\", modal); }\r\n\r\nextern \"C\" DllExport bool CKLBUITouchPad_setGroup(s32* pCtx, s32* group_name)\r\n{ return ((CKLBUITouchPad*)pCtx)->setGroup((const char*)group_name); }\r\n\r\nextern \"C\" DllExport void CKLBUITouchPad_setLock(s32* pCtx, bool lock_mode)\r\n{ ((CKLBUITouchPad*)pCtx)->lock(lock_mode); }\r\n\r\nextern \"C\" DllExport void CKLBUITouchPad_setGetAll(s32* pCtx, bool b)\r\n{ ((CKLBUITouchPad*)pCtx)->setGetAll(b); }\r\n\r\n//======================================================================================\r\n#include \"CKLBUIClip.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIClip_create(s32* pParent, u32 baseOrder, u32 maxOrder, float x, float y, float clipWidth, float clipHeight)\r\n{ return (s32*)CKLBUIClip::create((CKLBUITask*)pParent, NULL, baseOrder, maxOrder, x, y, clipWidth, clipHeight); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIClip_getOrder(s32* pCtx)\r\n{ return ((CKLBUIClip*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIClip_setOrder(s32* pCtx, u32 order)\r\n{ ((CKLBUIClip*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIClip_getMaxOdr(s32* pCtx)\r\n{ return ((CKLBUIClip*)pCtx)->getMaxOdr(); }\r\nextern \"C\" DllExport void CKLBUIClip_setMaxOdr(s32* pCtx, u32 maxodr)\r\n{ ((CKLBUIClip*)pCtx)->setMaxOdr(maxodr); }\r\n\r\nextern \"C\" DllExport float CKLBUIClip_getWidth(s32* pCtx)\r\n{ return ((CKLBUIClip*)pCtx)->getWidth(); }\r\nextern \"C\" DllExport void CKLBUIClip_setWidth(s32* pCtx, float width)\r\n{ ((CKLBUIClip*)pCtx)->setWidth(width); }\r\n\r\nextern \"C\" DllExport float CKLBUIClip_getHeight(s32* pCtx)\r\n{ return ((CKLBUIClip*)pCtx)->getHeight(); }\r\nextern \"C\" DllExport void CKLBUIClip_setHeight(s32* pCtx, float height)\r\n{ ((CKLBUIClip*)pCtx)->setHeight(height); }\r\n\r\nextern \"C\" DllExport void CKLBUIClip_setPosition(s32* pCtx, float x, float y)\r\n{ ((CKLBUIClip*)pCtx)->setPosition(x,y); }\r\n\r\nextern \"C\" DllExport void CKLBUIClip_setSize(s32* pCtx, float width, float height)\r\n{ ((CKLBUIClip*)pCtx)->setSize(width, height); }\r\n\r\n//======================================================================================\r\n/*\r\n#include \"CKLBMapTask.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBMapTask_create(s32* pParent, u32 allocSize, s32* asset)\r\n{ return (s32*)CKLBMapTask::create((CKLBTask*)pParent, allocSize, (const char*)asset); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getX(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getX(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getY(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getY(); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getOrder(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getOffsetLayer(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getOffsetLayer(); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getOffsetPerLine(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getOffsetPerLine(); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getWidth(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getWidth(); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getHeight(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getHeight(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCoordX(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getCoordX(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCoordY(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getCoordY(); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getMode(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getMode(); }\r\n\r\nextern \"C\" DllExport s32* CKLBMapTask_getAsset(s32* pCtx)\r\n{ return (s32*)((CKLBMapTask*)pCtx)->getAsset(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCenterX(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getCenterX(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCenterY(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getCenterY(); }\r\n\r\nextern \"C\" DllExport float CKLBMapTask_getScale(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getScale(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getTileWidth(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getTileWidth(); }\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getHalfTileHeight(s32* pCtx)\r\n{ return ((CKLBMapTask*)pCtx)->getHalfTileHeight(); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetViewPort(s32* pCtx, u32 width, u32 height, s32 x, s32 y, u32 baseRenderPriority, u32 priorityOffsetPerLayer, u32 priorityOffsetPerLine)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapSetViewPort(width, height, x, y, baseRenderPriority, priorityOffsetPerLayer, priorityOffsetPerLine); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetCoordinate(s32* pCtx, float x, float y, s32 mode)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapSetCoordinate(x, y, mode); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetCenterView(s32* pCtx, float fx, float fy)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapSetCenterView(fx, fy); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetDefaultTile(s32* pCtx, u32 layer, s32* asset, u32 argb)\r\n{\r\n\tu32 alpha = argb >> 24;\r\n\tu32 color = argb & 0xFFFFFF;\r\n\t((CKLBMapTask*)pCtx)->cmdMapSetDefaultTile(layer, (const char*)asset, alpha, color);\r\n}\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetZoom(s32* pCtx, float scale)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapSetZoom(scale); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_getScrCoord(s32* pCtx, float fx, float fy, float* resX, float* resY)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapGetScrCoord(fx, fy, resX, resY); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_getLogCoord(s32* pCtx, float fx, float fy, float* resX, float* resY)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapGetLogCoord(fx, fy, resX, resY); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetTileID(s32* pCtx, u32 layer, u32 tileX, u32 tileY, u32 tileID)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapSetTileID(layer, tileX, tileY, tileID); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetAreaID(s32* pCtx, u32 layer, u32 tileID, u32 x1, u32 y1, u32 x2, u32 y2)\r\n{ ((CKLBMapTask*)pCtx)->cmdMapSetAreaID(layer, tileID, x1, y1, x2, y2); }\r\n\r\n// Camera methods\r\nextern \"C\" DllExport s32* CKLBMapTask_cameraCreate(s32* pCtx)\r\n{ return (s32*)((CKLBMapTask*)pCtx)->cameraCreate(); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraDelete(s32* pCtx, s32* pLuaCam)\r\n{ ((CKLBMapTask*)pCtx)->cameraDelete((CKLBMapTask::LUACAMERA*)pLuaCam); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraMove(s32* pCtx, s32* pLuaCam, s32 x, s32 y)\r\n{ ((CKLBMapTask*)pCtx)->cameraMove((CKLBMapTask::LUACAMERA*)pLuaCam,x,y); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraMoveWithCoord(s32* pCtx, s32* pLuaCam, s32 x, s32 y, s32 mode)\r\n{ ((CKLBMapTask*)pCtx)->cameraMove((CKLBMapTask::LUACAMERA*)pLuaCam,x,y,(CKLBMapNode::COORD_MODE)mode); }\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraSet(s32* pCtx, s32* pLuaCam)\r\n{ ((CKLBMapTask*)pCtx)->cameraSet((CKLBMapTask::LUACAMERA*)pLuaCam); }\r\n*/\r\n//======================================================================================\r\n#include \"CKLBNetAPI.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBNetAPI_create(s32* pParent, s32* apiurl, s32* client_version, s32* consumer_key, s32* application_id,\r\n\t\t\t\t\t\t\t\tu32 session_max, s32* region)\r\n{ return (s32*)CKLBNetAPI::create((CKLBTask*)pParent, (const char*)apiurl, (const char*)client_version, (const char*)consumer_key, (const char*)application_id, NULL, session_max, (const char*)region, NULL); }\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_startUp(s32* pCtx, s32* loginID, s32* password, s32* invite, u32 timeout, u32* session)\r\n{ return ((CKLBNetAPI*)pCtx)->startUp((const char*)loginID, (const char*)password, (const char*)invite, timeout, session); }\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_login(s32* pCtx, s32* loginID, s32* password, u32 timeout, u32* session)\r\n{ return ((CKLBNetAPI*)pCtx)->login((const char*)loginID,(const char*)password,timeout,session); }\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_cancel(s32* pCtx, u32 uniq)\r\n{ return ((CKLBNetAPI*)pCtx)->cancel(uniq); }\r\n\r\nextern \"C\" DllExport void CKLBNetAPI_cancelAll(s32* pCtx)\r\n{ return ((CKLBNetAPI*)pCtx)->cancelAll(); }\r\n\r\nextern \"C\" DllExport void CKLBNetAPI_debugHdr(s32* pCtx, bool debugflag)\r\n{ return ((CKLBNetAPI*)pCtx)->debugHdr(debugflag); }\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_sendHTTP(s32* pCtx, s32* apiURL, s32* json, u32 timeout, bool passVersionCheck, u32* session) \r\n{ return ((CKLBNetAPI*)pCtx)->sendHTTP((const char*)apiURL, (const char*)json, timeout, passVersionCheck, session); }\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_watchMaintenance(s32* pCtx, u32 timeout, u32* session)\r\n{ return ((CKLBNetAPI*)pCtx)->watchMaintenance(timeout, session); }\r\n\r\nextern \"C\" DllExport void CKLBNetAPI_genCmdNumID(s32* pCtx, s32* body, int serial, s32* buf)\r\n{ ((CKLBNetAPI*)pCtx)->genCmdNumID((const char*)body, serial, (char*)buf); }\r\n\r\n//======================================================================================\r\n/*\r\n#include \"CKLBMapGroup.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBMapGroup_create(s32* pParent, u32 order, float x, float y, float z, bool scaleEnable)\r\n{ return (s32*)CKLBMapGroup::create((CKLBUITask*)pParent, NULL, order, x, y, z, scaleEnable); }\r\n\r\nextern \"C\" DllExport u32 CKLBMapGroup_getOrder(s32* pCtx)\r\n{ return ((CKLBMapGroup*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport float CKLBMapGroup_getMapX(s32* pCtx)\r\n{ return ((CKLBMapGroup*)pCtx)->getMapX(); }\r\nextern \"C\" DllExport void CKLBMapGroup_setMapX(s32* pCtx, float x)\r\n{ return ((CKLBMapGroup*)pCtx)->setMapX(x); }\r\n\r\nextern \"C\" DllExport float CKLBMapGroup_getMapY(s32* pCtx)\r\n{ return ((CKLBMapGroup*)pCtx)->getMapY(); }\r\nextern \"C\" DllExport void CKLBMapGroup_setMapY(s32* pCtx, float y)\r\n{ return ((CKLBMapGroup*)pCtx)->setMapY(y); }\r\n\r\nextern \"C\" DllExport float CKLBMapGroup_getMapZ(s32* pCtx)\r\n{ return ((CKLBMapGroup*)pCtx)->getMapZ(); }\r\nextern \"C\" DllExport void CKLBMapGroup_setMapZ(s32* pCtx, float z)\r\n{ return ((CKLBMapGroup*)pCtx)->setMapZ(z); }\r\n\r\nextern \"C\" DllExport void CKLBMapGroup_setPosition(s32* pCtx, float x, float y, float z)\r\n{ ((CKLBMapGroup*)pCtx)->setPosition(x,y,z); }\r\n*/\r\n//======================================================================================\r\n/*\r\n#include \"CKLBUnitTask.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_create(s32* pParent, s32* unitname, bool bMove)\r\n{ return (s32*)CKLBUnitTask::create((CKLBUITask*)pParent,(const char*)unitname,bMove); }\r\n\r\nextern \"C\" DllExport void CKLBUnitTask_getPosition(s32* pCtx, s32* x, s32* y, s32* z, u32* dir)\r\n{ ((CKLBUnitTask*)pCtx)->getPosition(x,y,z,dir); }\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_getClass(s32* pCtx)\r\n{ return (s32*)((CKLBUnitTask*)pCtx)->getClass(); }\r\n\r\nextern \"C\" DllExport u32 CKLBUnitTask_getType(s32* pCtx)\r\n{ return ((CKLBUnitTask*)pCtx)->getType(); }\r\nextern \"C\" DllExport void CKLBUnitTask_setType(s32* pCtx, u32 type)\r\n{ ((CKLBUnitTask*)pCtx)->setType(type); }\r\n\r\nextern \"C\" DllExport u64 CKLBUnitTask_getDbId(s32* pCtx)\r\n{ return ((CKLBUnitTask*)pCtx)->getDbId(); }\r\n\r\nextern \"C\" DllExport u32 CKLBUnitTask_getOrder(s32* pCtx)\r\n{ return ((CKLBUnitTask*)pCtx)->getOrder(); }\r\n\r\nextern \"C\" DllExport bool CKLBUnitTask_getVisible(s32* pCtx)\r\n{ return ((CKLBUnitTask*)pCtx)->getVisible(); }\r\nextern \"C\" DllExport void CKLBUnitTask_setVisible(s32* pCtx, bool visible)\r\n{ ((CKLBUnitTask*)pCtx)->setVisible(visible); }\r\n\r\nextern \"C\" DllExport void CKLBUnitTask_cmdSetLogicalPosition(s32* pCtx, float x, float y, float z, u32 dir, s32* optJSON)\r\n{ ((CKLBUnitTask*)pCtx)->cmdSetLogicalPosition(x,y,z,dir,(const char*)optJSON); }\r\n\r\nextern \"C\" DllExport void CKLBUnitTask_cmdRealize(s32* pCtx, s32* optJSON) \r\n{ ((CKLBUnitTask*)pCtx)->cmdRealize((const char*)optJSON); }\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_cmdExecuteQuery(s32* pCtx, s32*  pQuery , float* pDistance)\r\n{ return (s32*)((CKLBUnitTask*)pCtx)->cmdExecuteQuery((CKLBUnitQuery*)pQuery, *pDistance); }\r\n\r\nextern \"C\" DllExport\tbool CKLBUnitTask_assignAI(s32* pCtx, u32 aiDefinition)\r\n{ return false; // TODO after merging : ((CKLBUnitTask*)pCtx)->unitAssignAI(aiDefinition);\r\n}\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_getAIObject(s32* pCtx)\r\n{ return (s32*)((CKLBUnitTask*)pCtx)->getAIobject(); }\r\n*/\r\n//======================================================================================\r\n#include \"CKLBUIVariableItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIVariableItem_create(s32* pParent, u32 order, float x, float y, float width, float height, s32* asset)\r\n{ return (s32*)CKLBUIVariableItem::create((CKLBUITask*)pParent, NULL, order, x, y, width, height, (const char*)asset); }\r\n\r\nextern \"C\" DllExport u32 CKLBUIVariableItem_getOrder(s32* pCtx)\r\n{ return ((CKLBUIVariableItem*)pCtx)->getOrder(); }\r\nextern \"C\" DllExport void CKLBUIVariableItem_setOrder(s32* pCtx, u32 order)\r\n{ ((CKLBUIVariableItem*)pCtx)->setOrder(order); }\r\n\r\nextern \"C\" DllExport s32* CKLBUIVariableItem_getAsset(s32* pCtx)\r\n{ return (s32*)((CKLBUIVariableItem*)pCtx)->getAsset(); }\r\n\r\nextern \"C\" DllExport float CKLBUIVariableItem_getWidth(s32* pCtx)\r\n{ return ((CKLBUIVariableItem*)pCtx)->getWidth(); }\r\nextern \"C\" DllExport void CKLBUIVariableItem_setWidth(s32* pCtx, float width)\r\n{ ((CKLBUIVariableItem*)pCtx)->setWidth(width); }\r\n\r\nextern \"C\" DllExport float CKLBUIVariableItem_getHeight(s32* pCtx)\r\n{ return ((CKLBUIVariableItem*)pCtx)->getHeight(); }\r\nextern \"C\" DllExport void CKLBUIVariableItem_setHeight(s32* pCtx, float height)\r\n{ ((CKLBUIVariableItem*)pCtx)->setHeight(height); }\r\n\r\nextern \"C\" DllExport bool CKLBUIVariableItem_changeAsset(s32* pCtx, s32* assetName)\r\n{ return ((CKLBUIVariableItem*)pCtx)->changeAsset((const char*)assetName); }\r\n\r\nextern \"C\" DllExport void CKLBUIVariableItem_changeUV(s32* pCtx, float x, float y, float width, float height)\r\n{ ((CKLBUIVariableItem*)pCtx)->changeUV(x, y, width, height); }\r\n\r\n/*\r\nextern \"C\" DllExport void CKLBUIVariableItem_resetUV(s32* pCtx)\r\n{ ((CKLBUIVariableItem*)pCtx)->resetUV(); }\r\n*/\r\n\r\nextern \"C\" DllExport bool CKLBUIVariableItem_setMaskAsset(s32* pCtx, s32* asset)\r\n{ return ((CKLBUIVariableItem*)pCtx)->setMaskAsset((const char*)asset); }\r\n\r\n//======================================================================================\r\n#include \"CKLBStoreService.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBStoreService_create()\r\n{ return (s32*)CKLBStoreService::create(NULL); }\r\n\r\nextern \"C\" DllExport void CKLBStoreService_buyItems(s32* pCtx, s32* item)\r\n{ ((CKLBStoreService*)pCtx)->buyItems((const char*)item); }\r\n\r\nextern \"C\" DllExport void CKLBStoreService_getProducts(s32* pCtx, s32* json, bool currency)\r\n{ ((CKLBStoreService*)pCtx)->getProducts((const char*)json, currency); }\r\n\r\n//======================================================================================\r\n/*\r\n#include \"CKLBWorld.h\"\r\n\r\nclass CSharpWorldCallback : public IWorldRequestCallback\r\n{\r\npublic:\r\n\tCSharpWorldCallback()  {}\r\n\t~CSharpWorldCallback() {}\r\n\tvoid callbackWorld(int serial, int msg, int status, void * data = 0) {\r\n\t\tconst char * funcname = (const char *)data;\r\n\t\tCKLBScriptEnv::getInstance().call_eventWorld(funcname, NULL, serial, msg, status);\r\n\t}\r\n};\r\n\r\nstatic CSharpWorldCallback s_worldCallback;\r\n\r\nextern \"C\" DllExport s32* CKLBWorld_getPointUnit(s32 x, s32 y) { \r\n\treturn (s32*)CKLBWorld::getInstance().pointUnit(x, y);\r\n}\r\n\r\nextern \"C\" DllExport s32* CKLBWorld_getUnitByID(s32* dbID) { \r\n\treturn (s32*)CKLBWorld::getInstance().searchUnitByID(CKLBUtility::stringNum64((const char*)dbID));\r\n}\r\n\r\nextern \"C\" DllExport bool CKLBWorld_doEvent(s32* pSrcTask, s32* pDstTask, s32* pUserTask, s32* pOppoTask, u32 eventID, s32* additionalParams, u32 additionalParamsCount) { \r\n\tCKLBUnitInstanceBase * pSrc\t\t= (pSrcTask)  ? ((CKLBUnitTask*)pSrcTask)->getUnitInstance()  : NULL;\r\n\tCKLBUnitInstanceBase * pDst\t\t= (pDstTask)  ? ((CKLBUnitTask*)pDstTask)->getUnitInstance()  : NULL;\r\n\tCKLBUnitInstanceBase * pUser\t= (pUserTask) ? ((CKLBUnitTask*)pUserTask)->getUnitInstance() : NULL;\r\n\tCKLBUnitInstanceBase * pOppo\t= (pOppoTask) ? ((CKLBUnitTask*)pOppoTask)->getUnitInstance() : NULL;\r\n\r\n\tbool bResult = true;\r\n\tbResult = bResult && (!pSrc  || (pSrc->getClassID()  == CLS_GAMEUNIT));\r\n\tbResult = bResult && (!pDst  || (pDst->getClassID()  == CLS_GAMEUNIT));\r\n\tbResult = bResult && (!pUser || (pUser->getClassID() == CLS_GAMEUNIT));\r\n\tbResult = bResult && (!pOppo || (pOppo->getClassID() == CLS_GAMEUNIT));\r\n\t\r\n\tif(!bResult) {\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tCKLBUnitInstance::doEvent(\t(CKLBUnitInstance *)pSrc,\r\n\t\t\t\t\t\t\t\t(CKLBUnitInstance *)pDst,\r\n\t\t\t\t\t\t\t\t(CKLBUnitInstance *)pUser,\r\n\t\t\t\t\t\t\t\t(CKLBUnitInstance *)pOppo,\r\n\t\t\t\t\t\t\t\teventID, additionalParamsCount, additionalParams);\r\n\t\r\n\treturn true;\r\n}\r\n\r\nextern \"C\" DllExport void CKLBWorld_killAllUnit() { \r\n\tCKLBWorld::getInstance().killAllUnit();\r\n}\r\n\r\nextern \"C\" DllExport u32 CKLBWorld_getUnitListByClass(s32* unitClass, s32** pIds, s32** pTasks, u32 maxLength) { \r\n\tCKLBWorld& world = CKLBWorld::getInstance();\r\n\tCKLBUnitTask* pTask = world.getFirstUnit();\r\n\t\r\n\tu32 idx = 0;\r\n\twhile(pTask && idx < maxLength) {\r\n\t\tCKLBUnitInstanceBase * base = pTask->getUnitInstance();\r\n\t\tif((base->getClassID() != CLS_GAMEUNIT) && (base->getClassID() != CLS_GAMEUNITBASE)) {\r\n\t\t\tpTask = world.getNextUnit(pTask);\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tconst char * unitType = base->getDefinition()->m_name;\r\n\t\tif(strcmp(unitType, (const char*)unitClass) != 0) {\r\n\t\t\tpTask = world.getNextUnit(pTask);\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tu64 dbID = 0;\r\n\t\tif(base->getClassID() == CLS_GAMEUNIT) {\r\n\t\t\tCKLBUnitInstance * pInstance = (CKLBUnitInstance *)base;\r\n\t\t\tdbID = pInstance->m_dbID;\r\n\t\t}\r\n\r\n\t\tidx++;\r\n\r\n\t\tchar buf[256];\r\n\t\tCKLBUtility::numString64(buf, dbID);\r\n\t\t((const char**)pIds)[idx] \t= buf;\r\n\t\t((CKLBUnitTask**)pTasks)[idx] \t= pTask;\r\n\r\n\t\tpTask = world.getNextUnit(pTask);\r\n\t}\r\n\t\r\n\treturn idx;\r\n}\r\n\r\nextern \"C\" DllExport s32 CKLBWorld_getUnitAll(s32* targetUser, s32*  battleId, s32 callbackIndex) { \r\n\treturn CKLBWorld::getInstance().sincGetAll((void *)callbackIndex, &s_worldCallback, (const char*)targetUser, (const char*)battleId);\r\n}\r\n\r\nextern \"C\" DllExport s32 CKLBWorld_getUnitClass(s32* unitClass, s32* strId, s32* targetUser, s32 callbackIndex) {\r\n\tu64 dbID = CKLBUtility::stringNum64((const char*)strId);\r\n\treturn CKLBWorld::getInstance().sincGetClass((const char*)unitClass, dbID, (s32* )callbackIndex, &s_worldCallback, (const char*)targetUser);\r\n}\r\n\r\nextern \"C\" DllExport s32 CKLBWorld_getUnitTableAll(s32* unitTable, s32 callbackIndex) { \r\n\treturn CKLBWorld::getInstance().sincGetTableAll((const char*)unitTable, (s32* )callbackIndex, &s_worldCallback);\r\n}\r\n\r\nextern \"C\" DllExport void CKLBWorld_setOrderParam(u32 baseOrder, float orderReso) { \r\n\tCKLBWorld::getInstance().setNoMapParameter(baseOrder, orderReso);\r\n}\r\n\r\nextern \"C\" DllExport void CKLBWorld_unitFreeze(bool bFreeze) { \r\n\tCKLBWorld::getInstance().setFreeze(bFreeze);\r\n}\r\n*/\r\n//======================================================================================\r\n#include \"CKLBAsyncLoader.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBAsyncLoader_create(s32* pParentTask, s32** assets, u32 count, u32 datasetID)\r\n{ return (s32*)CKLBAsyncLoader::create((CKLBTask*)pParentTask, (const char**)assets, count, datasetID, \"\"); }\r\n\r\nextern \"C\" DllExport u32 CKLBAsyncLoader_getTotalCount(s32* pCtx)\r\n{ return ((CKLBAsyncLoader*)pCtx)->getTotalCount(); }\r\n\r\nextern \"C\" DllExport u32 CKLBAsyncLoader_getProcessCount(s32* pCtx)\r\n{ return ((CKLBAsyncLoader*)pCtx)->getProcessCount(); }\r\n\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n#include \"CKLBLuaLibKEY.h\"\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_genUserID(s32* buf, u32 size)\r\n{ return CKLBLuaLibKEY::genUserID((char*)buf,size); }\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_genUserPW(s32* user_id, s32* buf, u32 size)\r\n{ return CKLBLuaLibKEY::genUserPW((const char*)user_id, (char*)buf,size); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_setSecureID(s32* service_name, s32* user_id)\r\n{ return CKLBLuaLibKEY::setSecureID((const char*)service_name, (const char*)user_id); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_setSecurePW(s32* service_name, s32* passwd)\r\n{ return CKLBLuaLibKEY::setSecurePW((const char*)service_name, (const char*)passwd); }\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_getSecureID(s32* service_name, s32* buf, u32 size)\r\n{ return CKLBLuaLibKEY::getSecureID((const char*)service_name, (char*)buf, size); }\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_getSecurePW(s32* service_name, s32* buf, u32 size)\r\n{ return CKLBLuaLibKEY::getSecurePW((const char*)service_name, (char*)buf, size); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_delSecureID(s32* service_name)\r\n{ return CKLBLuaLibKEY::delSecureID((const char*)service_name); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_delSecurePW(s32* service_name)\r\n{ return CKLBLuaLibKEY::delSecurePW((const char*)service_name); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibRES.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpSceneGraph(s32*  ptr)\r\n{ CKLBLuaLibRES::dumpSceneGraph(ptr); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpRendering(bool detailed)\r\n{ CKLBLuaLibRES::dumpRendering(detailed); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpAssets()\r\n{ CKLBLuaLibRES::dumpAssets(); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpDataSet()\r\n{ CKLBLuaLibRES::dumpDataSet(); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpTexturePacker(bool detailed)\r\n{ CKLBLuaLibRES::dumpTexturePacker(detailed); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpGeometryCost(bool detailed)\r\n{ CKLBLuaLibRES::dumpGeometryCost(detailed); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibENG.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibENG_isRelease()\r\n{ return CKLBLuaLibENG::isRelease(); }\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibENG_getPlatform()\r\n{ return (s32*)CKLBLuaLibENG::getPlatform(); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibENG_getNanoTime(s32* milli, s32* nano)\r\n{ CKLBLuaLibENG::getNanoTime(milli, nano); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibENG_startNanoTime(u32 idx)\r\n{ CKLBLuaLibENG::startNanoTime(idx); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibENG_endNanoTime(u32 idx, s32* milli, s32* nano)\r\n{ CKLBLuaLibENG::endNanoTime(idx, milli, nano); }\r\n\r\nextern \"C\" DllExport u32 CKLBLuaLibENG_getFrameID()\r\n{ return CKLBLuaLibENG::getFrameID(); }\r\n\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaEnv.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdLogging(s32* msg)\r\n{ CKLBLuaEnv::cmdLogging((const char*)msg); }\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdExit()\r\n{ CKLBLuaEnv::cmdExit(); }\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdSystemInfo(s32* width, s32* height)\r\n{ CKLBLuaEnv::cmdSystemInfo(width, height); }\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdSystemReboot()\r\n{ CPFInterface::getInstance().client().reboot(); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibFONT.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibFONT_createFont(s32 size, s32* fontname)\r\n{ return (s32*)CKLBLuaLibFONT::create_font(size, (const char*)fontname); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibFONT_removeFont(s32* fontobj)\r\n{ CKLBLuaLibFONT::remove_font((CKLBLuaLibFONT::FONTOBJ *)fontobj); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibFONT_cmdGetTextInfo(s32* str, s32*  font, s32* pReturnInfo)\r\n{ CKLBLuaLibFONT::cmdGetTextInfo((const char*)str, font, (STextInfo*)pReturnInfo); }\r\n\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibASSET.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibASSET_getImageSize(s32* asset_name, s32* pReturnWidth, s32* pReturnHeight)\r\n{ CKLBLuaLibASSET::cmdGetImageSize((const char*)asset_name, pReturnWidth, pReturnHeight); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibASSET_getBoundSize(s32* asset_name, float* pReturnWidth, float* pReturnHeight)\r\n{ CKLBLuaLibASSET::cmdGetBoundSize((const char*)asset_name, pReturnWidth, pReturnHeight); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibASSET_getAssetInfo(s32* asset_name, s32* pReturnImgWidth, s32* pReturnImgHeight, float* pReturnBoundWidth, float* pReturnBoundHeight)\r\n{ CKLBLuaLibASSET::cmdGetAssetInfo((const char*)asset_name, pReturnImgWidth, pReturnImgHeight, pReturnBoundWidth, pReturnBoundHeight); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibDATA.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibDATA_cmdCreateData(u32 dataSetID)\r\n{ return (s32*)CKLBLuaLibDATA::cmdCreateData(dataSetID); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibDATA_cmdRegistData(s32* pDataSet, s32* name_asset, u32* pReturnHandle)\r\n{ return CKLBLuaLibDATA::cmdRegistData((CKLBDataSet*)pDataSet, (const char*)name_asset, NULL, (u32*)pReturnHandle); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDATA_cmdDelete(s32* pDataSet)\r\n{ CKLBLuaLibDATA::cmdDelete((CKLBDataSet*)pDataSet); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibGL.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibGL_GLClearColor(float r, float g, float b, float a)\r\n{ return CKLBLuaLibGL::GLClearColor(r,g,b,a); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_GLSetResolution(int width, int height)\r\n{ return CKLBLuaLibGL::GLSetResolution(width, height); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_SGGetGuardBand(float* leftBorder, float* rightBorder, float* topBorder, float* bottomBorder)\r\n{ return CKLBLuaLibGL::SGGetGuardBand(leftBorder, rightBorder, topBorder, bottomBorder); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_SGSetGuardBand(float leftBorder, float rightBorder, float topBorder, float bottomBorder)\r\n{ return CKLBLuaLibGL::SGSetGuardBand(leftBorder, rightBorder, topBorder, bottomBorder); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibGL_GLCreateScreenAsset(s32* name) \r\n{ return CKLBLuaLibGL::GLCreateScreenAsset((const char*)name); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibGL_GLDoScreenShot(s32* name) \r\n{ return CKLBLuaLibGL::GLDoScreenShot((const char*)name); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_GLFreeScreenAsset(s32* name) \r\n{ CKLBLuaLibGL::GLFreeScreenAsset((const char*)name); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibUI.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibUI_calcPosition(float x, float y, float w, float h, u32 mask, float* out_rx, float* out_ry)\r\n{ CKLBLuaLibUI::calcPosition(x,y,w,h,mask,out_rx,out_ry); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibBIN.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibBIN_open(s32* bin_asset)\r\n{ return (s32*)CKLBLuaLibBIN::bin_open((const char*)bin_asset); }\r\nextern \"C\" DllExport void CKLBLuaLibBIN_close(s32* pBIN)\r\n{ CKLBLuaLibBIN::bin_close((CKLBBinArray*)pBIN); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibBIN_peek(s32* pBIN, s32 offset, s32* out_value)\r\n{ return CKLBLuaLibBIN::bin_peek((CKLBBinArray*)pBIN,offset,out_value); }\r\nextern \"C\" DllExport bool CKLBLuaLibBIN_peek_u16(s32* pBIN, s32 offset, u32* out_value, bool f_bigendian)\r\n{ return CKLBLuaLibBIN::bin_peek_u16((CKLBBinArray*)pBIN,offset,out_value,f_bigendian); }\r\nextern \"C\" DllExport bool CKLBLuaLibBIN_peek_u32(s32* pBIN, s32 offset, u32* out_value, bool f_bigendian)\r\n{ return CKLBLuaLibBIN::bin_peek_u32((CKLBBinArray*)pBIN,offset,out_value,f_bigendian); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibTASK.h\"\r\n#include \"CKLBTask.h\"\r\n\r\nextern \"C\" DllExport void Task_kill(s32* pTask)\r\n{ ((CKLBLuaTask*)pTask)->kill(); }\r\n\r\nextern \"C\" DllExport bool Task_isKill(s32* pTask)\r\n{ return CKLBTaskMgr::getInstance().is_remove((CKLBLuaTask*)pTask); }\r\n\r\nextern \"C\" DllExport void Task_setStageTask(s32* pTask)\r\n{ CKLBTaskMgr::getInstance().registStageTask((CKLBLuaTask*)pTask); }\r\n\r\nextern \"C\" DllExport void Task_clearStageTask()\r\n{ CKLBTaskMgr::getInstance().clearStageTask(); }\r\n\r\nextern \"C\" DllExport void Task_setPause(s32* pTask, bool bPause, bool bRecursive)\r\n{ ((CKLBLuaTask*)pTask)->setPause(bPause, bRecursive); }\r\n\r\nextern \"C\" DllExport void Task_setManagerPause(bool bPause) {\t\r\n\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\tmgr.setPause(bPause); \r\n}\r\n\r\nextern \"C\" DllExport void Task_interposeTimer(s32* pTask, s32* pTimer) {\r\n\t((CKLBLuaTask*)pTask)->interposeTimer((CKLBTask*)pTimer);\r\n}\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibSOUND.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibSOUND_cmdSoundOpen(s32* snd_asset, bool f_bgm)\r\n{ return (s32*)CKLBLuaLibSOUND::cmdSoundOpen((const char*)snd_asset, f_bgm); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundClose(s32* pSnd)\r\n{ CKLBLuaLibSOUND::removeSound((CKLBLuaLibSOUND::SOUND*)pSnd); }\r\n\r\nextern \"C\" DllExport u32 CKLBLuaLibSOUND_removeSoundAll()\r\n{ return CKLBLuaLibSOUND::removeSoundAll(); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundPlay(s32* pSnd, u32 fade_msec, float tgtVol, float globalVol)\r\n{ CKLBLuaLibSOUND::cmdSoundPlay((CKLBLuaLibSOUND::SOUND*)pSnd, fade_msec, tgtVol, globalVol); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundStop(s32* pSnd, u32 fade_msec, float tgtVol)\r\n{ CKLBLuaLibSOUND::cmdSoundStop((CKLBLuaLibSOUND::SOUND*)pSnd, fade_msec, tgtVol); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundVolume(s32* pSnd, float volume)\r\n{ CKLBLuaLibSOUND::cmdSoundVolume((CKLBLuaLibSOUND::SOUND*)pSnd, volume); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundPan(s32* pSnd, float pan)\r\n{ CKLBLuaLibSOUND::cmdSoundPan((CKLBLuaLibSOUND::SOUND*)pSnd, pan); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundPause(s32* pSnd)\r\n{ CKLBLuaLibSOUND::cmdSoundPause((CKLBLuaLibSOUND::SOUND*)pSnd); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundResume(s32* pSnd)\r\n{ CKLBLuaLibSOUND::cmdSoundResume((CKLBLuaLibSOUND::SOUND*)pSnd); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundSeek(s32* pSnd, s32 millisec)\r\n{ CKLBLuaLibSOUND::cmdSoundSeek((CKLBLuaLibSOUND::SOUND*)pSnd, millisec); }\r\n\r\nextern \"C\" DllExport s32  CKLBLuaLibSOUND_cmdSoundTell(s32* pSnd)\r\n{ return CKLBLuaLibSOUND::cmdSoundTell((CKLBLuaLibSOUND::SOUND*)pSnd); }\r\n\r\nextern \"C\" DllExport s32  CKLBLuaLibSOUND_cmdSoundState(s32* pSnd)\r\n{ return CKLBLuaLibSOUND::cmdSoundState((CKLBLuaLibSOUND::SOUND*)pSnd); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdVolumeBGM(float volume)\r\n{ CKLBLuaLibSOUND::cmdVolumeBGM(volume); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdVolumeSE(float volume)\r\n{ CKLBLuaLibSOUND::cmdVolumeSE(volume); }\r\n\r\nextern \"C\" DllExport s32 CKLBLuaLibSOUND_cmdGetLength(s32* pSnd)\r\n{ return CKLBLuaLibSOUND::cmdGetLength((CKLBLuaLibSOUND::SOUND*)pSnd); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSetFade(s32* pSnd, s32 millisec, float tgtVol)\r\n{ CKLBLuaLibSOUND::cmdSetFade((CKLBLuaLibSOUND::SOUND*)pSnd, millisec, tgtVol); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibSOUND_cmdSoundSetBufSize(s32* pSnd, s32 value)\r\n{ return CKLBLuaLibSOUND::cmdSoundSetBufSize((CKLBLuaLibSOUND::SOUND*)pSnd, value); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibDB.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibDB_dbopen(s32* db_asset, bool b_write, bool b_create)\r\n{ return (s32*)CKLBLuaLibDB::dbopen((const char*)db_asset,b_write,b_create); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDB_dbclose(s32* pDB)\r\n{ CKLBLuaLibDB::dbclose((CKLBLuaDB*)pDB); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDB_closeAll()\r\n{ CKLBLuaDB::closeAll(); }\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibDB_query(s32* pDB, s32* sqlQuery, int* nbEntries)\r\n{\r\n\tconst char** strArray = ((CKLBLuaDB*)pDB)->query((const char*)sqlQuery);\r\n\tif(!strArray) { return NULL; }\r\n\t*nbEntries = (int)strArray[0];\r\n\treturn (s32*)(++strArray);\r\n}\r\n\r\n//======================================================================================\r\n/*\r\n#include \"CKLBLuaLibAI.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibAI_setActive(s32*  pAIobj, bool active)\r\n{ CKLBLuaLibAI::setActive(pAIobj,active); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibAI_resetRule(s32*  pAIobj)\r\n{ CKLBLuaLibAI::resetRule(pAIobj); }\r\n\r\nextern \"C\" DllExport s32 CKLBLuaLibAI_getProp(s32*  pAIobj, u32 index)\r\n{ return CKLBLuaLibAI::getAIprop(pAIobj,index); }\r\nextern \"C\" DllExport void CKLBLuaLibAI_setProp(s32*  pAIobj, u32 index, s32 value)\r\n{ CKLBLuaLibAI::setAIprop(pAIobj,index,value); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibAI_delQuery(s32* pQuery)\r\n{ CKLBLuaLibAI::delExpression((CKLBUnitQuery*)pQuery); }\r\nextern \"C\" DllExport void CKLBLuaLibAI_delQueryAll()\r\n{ CKLBUnitQuery::removeAll(); }\r\n*/\r\n//======================================================================================\r\n#include \"CKLBLuaLibAPP.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibAPP_callApplication(s32 type, s32* addr, s32* subject, s32* body)\r\n{ return CKLBLuaLibAPP::callApplication((IPlatformRequest::APP_TYPE)type,(const char*)addr,(const char*)subject,(const char*)body); }\r\n\r\n//======================================================================================\r\n#include \"CKLBPauseCtrl.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBPauseCtrl_create(s32* pParent)\r\n{ return (s32*)CKLBPauseCtrl::create((CKLBTask*)pParent,NULL,NULL); }\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibLANG.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibLANG_addString(s32* id, s32* str)\r\n{ return CKLBLuaLibLANG::addString((const char*)id, (const char*)str); }\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibLANG_getString(s32* id)\r\n{ return (s32*)CKLBLuaLibLANG::getString((const char*)id); }\r\n\r\nextern \"C\" DllExport void CKLBLuaLibLANG_removeString(s32* id)\r\n{ return CKLBLuaLibLANG::removeString((const char*)id); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibLANG_useDB(s32* dbFile, s32* table, s32* keyF, s32* valueF, s32* groupF)\r\n{ return CKLBLuaLibLANG::useDB((const char*)dbFile, (const char*)table, (const char*)keyF, (const char*)valueF, (const char*)groupF); }\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibLANG_loadGroup(s32* groupId)\r\n{ return CKLBLuaLibLANG::loadGroup((const char*)groupId); }\r\n\r\n\r\n//======================================================================================\r\n#include \"CKLBLuaLibDEBUG.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_startMenu(u32 maxCount, s32* caption, s32* key) { \r\n\tCKLBLuaLibDEBUG::startMenu(maxCount, (const char*)caption, (const char*)key);\r\n}\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_addItem(u32 mode, s32* caption, s32* key, s32 min, s32 max, s32 value, s32** items, u32 itemsCount) {\r\n\tCKLBLuaLibDEBUG::addItem(mode, (const char*)caption, (const char*)key, min, max, value, (const char**)items, itemsCount);\r\n}\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_endMenu() {\r\n\tCKLBLuaLibDEBUG::endMenu();\r\n}\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_removeMenu(s32* key) { \r\n\tCKLBLuaLibDEBUG::removeMenu((const char*)key);\r\n}\r\n\r\n/*\r\n//======================================================================================\r\n#include \".h\"\r\n\r\n//======================================================================================\r\n#include \".h\"\r\n\r\n//======================================================================================\r\n#include \".h\"\r\n\r\n//======================================================================================\r\n#include \".h\"\r\n\r\n//======================================================================================\r\n#include \".h\"\r\n\r\n//======================================================================================\r\n#include \".h\"\r\n*/\r\n"
  },
  {
    "path": "Engine/source/Scripting/ExportListC_Likefunction.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __EXPORT_LIST_H__\r\n#define __EXPORT_LIST_H__\r\n\r\n#ifndef DllExport\r\n#define DllExport   __declspec( dllexport )\r\n#endif\r\n\r\n#include \"BaseType.h\"\r\n\r\n//======================================================================================\r\n//#include \"CKLBScriptEnv.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBScriptEnv_getCallBackCount(); \r\nextern \"C\" DllExport s32* CKLBScriptEnv_getErrorPtr();\r\nextern \"C\" DllExport s32* CKLBScriptEnv_getErrorString();\r\nextern \"C\" DllExport void CKLBScriptEnv_resetError();\r\n//======================================================================================\r\n//#include \"CKLBObject.h\"\r\n//#include \"CKLBLuaTask.h\"\r\n//#include \"CKLBLibRegistrator.h\"\r\n\r\n\r\nextern \"C\" DllExport u32 CKLBObject_getTypeID(s32* pCtx);\r\nextern \"C\" DllExport void CKLBObjectScriptable_setScriptContext(s32* pCtx, u32 handle);\r\nextern \"C\" DllExport u32 CKLBObjectScriptable_getScriptContext(s32* pCtx);\r\nextern \"C\" DllExport u32 Cpp_getClassIDByName(s32* name);\r\n//======================================================================================\r\n//#include \"CKLBNode.h\"\r\n//#include \"CKLBUITask.h\"\r\n//#include \"CKLBDrawTask.h\"\r\n//#include \"AudioAsset.h\"\r\n\r\nextern \"C\" DllExport s32* node_getRoot();\r\nextern \"C\" DllExport s32* node_getChild(s32* pNode);\r\nextern \"C\" DllExport s32* node_getParent(s32* pNode);\r\nextern \"C\" DllExport s32* node_getBrother(s32* pNode);\r\nextern \"C\" DllExport s32* node_getNodeFromTask(s32* pTask);\r\nextern \"C\" DllExport float node_getNodeScaleX(s32* pNode);\r\nextern \"C\" DllExport float node_getNodeScaleY(s32* pNode);\r\nextern \"C\" DllExport float node_getRotation(s32* pNode);\r\nextern \"C\" DllExport float node_getNodeTranslateX(s32* pNode);\r\nextern \"C\" DllExport float node_getNodeTranslateY(s32* pNode);\r\nextern \"C\" DllExport void node_setTranslate(s32* pNode, float x, float y);\r\nextern \"C\" DllExport void node_setRotation(s32* pNode, float deg);\r\n\r\nextern \"C\" DllExport void node_setScale(s32* pNode, float scaleX, float scaleY);\r\n\r\nextern \"C\" DllExport void node_getColorMatrixVec(s32* pNode, float* dst);\r\nextern \"C\" DllExport void node_setColorMatrixVec(s32* pNode, float* src);\r\nextern \"C\" DllExport u32 node_getColorMatrixUInt(s32* pNode);\r\nextern \"C\" DllExport void node_setColorMatrixUInt(s32* pNode, u32 val);\r\nextern \"C\" DllExport void node_setVisible(s32* pNode, bool visible);\r\nextern \"C\" DllExport bool node_getVisible(s32* pNode);\r\nextern \"C\" DllExport s32* node_asElement(s32* pNode);\r\nextern \"C\" DllExport s32* node_asContainer(s32* pNode);\r\nextern \"C\" DllExport s32* node_asSelectable(s32* pNode);\r\nextern \"C\" DllExport s32* node_asAnimationNode(s32* pNode);\r\nextern \"C\" DllExport s32* node_getName(s32* pNode);\r\nextern \"C\" DllExport void node_setName(s32* pNode, s32* name);\r\nextern \"C\" DllExport s32* node_getUITask(s32* pNode);\r\nextern \"C\" DllExport s32* node_search(s32* pNode, s32* name);\r\nextern \"C\" DllExport s32* node_searchFirstByTypeID(s32* pNode, u32 typeID);\r\n//\r\n// Element\r\n//\r\n\r\nextern \"C\" DllExport void element_setEnabled(s32* pElem, bool isEnabled);\r\nextern \"C\" DllExport bool element_isEnabled(s32* pElem);\r\nextern \"C\" DllExport bool element_setAsset(s32* pElem, u32 dest, s32* assetName);\r\nextern \"C\" DllExport void element_setPriority(s32* pElem, u32 renderPriority);\r\nextern \"C\" DllExport u32 element_getPriority(s32* pElem);\r\n//\r\n// Selectable\r\n//\r\n\r\nextern \"C\" DllExport void selectable_setClick(s32* pSelect, s32 coordinateX, s32 coordinateY, s32 width, s32 height);\r\nextern \"C\" DllExport bool selectable_setAudio(s32* pSelect, s32* assetAudio, u32 mode, float volume);\r\nextern \"C\" DllExport void selectable_setStick(s32* pSelect,bool isStickable);\r\nextern \"C\" DllExport bool selectable_isStickable(s32* pSelect);\r\n\r\nextern \"C\" DllExport void selectable_setSticked(s32* pSelect,bool isSticked);\r\nextern \"C\" DllExport bool selectable_isSticked(s32* pSelect);\r\n\r\n//\r\n//\tWhen clicked, all other stickable are modified / reset to unstick.\r\n// 0 : Not radio, 1..n : Radio ID.\r\nextern \"C\" DllExport void selectable_setRadio(s32* pSelect,u32 radioID);\r\nextern \"C\" DllExport u32 selectable_getRadioID(s32* pSelect);\r\n\r\n\r\n//\r\n// Container\r\n//\r\n\r\nextern \"C\" DllExport s32 container_getViewOffsetX(s32* pCont);\r\nextern \"C\" DllExport void container_setViewOffsetX(s32* pCont,s32 scrollX);\r\nextern \"C\" DllExport s32 container_getViewOffsetY(s32* pCont);\r\nextern \"C\" DllExport void container_setViewOffsetY(s32*  pCont,s32 scrollY);\r\n// Allow to find the active radio button inside the container.\r\nextern \"C\" DllExport u32 container_getRadioValue(s32* pCont);\r\n\r\n//======================================================================================\r\n//#include \"CKLBGenericTask.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\nextern \"C\" DllExport s32* CKLBGenericTask_create(s32* pParentTask, s32 phase);\r\n\r\n//======================================================================================\r\n//#include \"CKLBIntervalTimer.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\n// false is given as last arguement to prevent killing a timer if the timer interval has changed during the callback.\r\nextern \"C\" DllExport s32* CKLBIntervalTimer_create(s32* pParent, u32 interval, bool repeat, u8 mode);\r\n\r\nextern \"C\" DllExport u32 CKLBIntervalTimer_getTimerID(s32* pCtx);\r\nextern \"C\" DllExport void CKLBIntervalTimer_setTimerID(s32* pCtx, u32 ID);\r\n\r\nextern \"C\" DllExport bool CKLBIntervalTimer_getRepeat(s32* pCtx);\r\nextern \"C\" DllExport void CKLBIntervalTimer_setRepeat(s32* pCtx, bool boolean);\r\n\r\nextern \"C\" DllExport u32 CKLBIntervalTimer_getInterval(s32* pCtx);\r\nextern \"C\" DllExport void CKLBIntervalTimer_setInterval(s32* pCtx, u32 interval);\r\n\r\nextern \"C\" DllExport u8 CKLBIntervalTimer_getMode(s32* pCtx);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIProgressBar.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_create(s32* pParent, u32 order, float x, float y, float width, float height,s32* full_image, s32* empty_image,s32 start_pix, s32 end_pix, u32 anim, bool vert, s32* barfilterImage);\r\n\r\nextern \"C\" DllExport u32 CKLBUIProgressBar_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setWidth(s32* pCtx, float width);\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setHeight(s32* pCtx, float height);\r\n\r\nextern \"C\" DllExport bool CKLBUIProgressBar_getVertical(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setVertical(s32* pCtx, bool vertical);\r\n\r\nextern \"C\" DllExport u32 CKLBUIProgressBar_getAnimTime(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setAnimTime(s32* pCtx, u32 time);\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getStart(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setStart(s32* pCtx, float start);\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getEnd(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setEnd(s32* pCtx, float end);\r\n\r\nextern \"C\" DllExport float CKLBUIProgressBar_getValue(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setValue(s32* pCtx, float value);\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_getImgEmpty(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setImgEmpty(s32* pCtx, s32* imgEmpty);\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_getImgFull(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setImgFull(s32* pCtx, s32* imgFull);\r\n\r\nextern \"C\" DllExport s32* CKLBUIProgressBar_getImgFilter(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setImgFilter(s32* pCtx, s32* imgFilter);\r\n\r\nextern \"C\" DllExport void CKLBUIProgressBar_reset(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIProgressBar_getFilterVisible(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setFilterVisible(s32* pCtx, bool bFilter);\r\nextern \"C\" DllExport u32 CKLBUIProgressBar_getFilterColor(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIProgressBar_setFilterColor(s32* pCtx, u32 argb);\r\n\r\nextern \"C\" DllExport bool CKLBUIProgressBar_setFilterAnim(s32* pCtx, bool bColAnim, u32 argb1, u32 argb2, u32 freq);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIScore.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIScore_create(s32* pParent,u32 order, s32 order_offset,float x, float y,  s32** tex_table,float stepX, float stepY, u32 column, bool fillzero, bool anim_flag,u32 align, bool countclip);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getValue(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setValue(s32* pCtx, u32 value);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setOrder(s32* pCtx, u32 value);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getOrderOffset(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScore_getStepX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setStepX(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScore_getStepY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setStepY(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getColumn(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setColumn(s32* pCtx, u32 value);\r\n\r\nextern \"C\" DllExport bool CKLBUIScore_getFillZero(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setFillZero(s32* pCtx, bool value);\r\n\r\nextern \"C\" DllExport bool CKLBUIScore_getAnim(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScore_getAlign(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setAlign(s32* pCtx, u32 value);\r\n\r\nextern \"C\" DllExport bool CKLBUIScore_getCountClip(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScore_setCountClip(s32* pCtx, bool value);\r\n\r\nextern \"C\" DllExport s32* CKLBUIScore_getTextures(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIScore_setEnterAnimation(s32* pCtx, s32 milliSecondsPlayTime, s32 timeShift, u32 type, u32 affected, const float* arrayParam);\r\n\r\nextern \"C\" DllExport void CKLBUIScore_setExitAnimation(s32* pCtx, s32 milliSecondsPlayTime, s32 timeShift, u32 type, u32 affected, const float* arrayParam);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUITask.h\"\r\n\r\n// No constructor for UI Task\r\n\r\nextern \"C\" DllExport bool CKLBUITask_getVisible(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setVisible(s32* pCtx, bool isVisible);\r\n\r\nextern \"C\" DllExport float CKLBUITask_getScaleX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setScaleX(s32* pCtx, float scaleX);\r\n\r\nextern \"C\" DllExport float CKLBUITask_getScaleY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setScaleY(s32* pCtx, float scaleY);\r\n\r\nextern \"C\" DllExport float CKLBUITask_getX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setX(s32* pCtx, float x);\r\n\r\nextern \"C\" DllExport float CKLBUITask_getY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setY(s32* pCtx, float y);\r\n\r\nextern \"C\" DllExport float CKLBUITask_getRotation(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setRotation(s32* pCtx, float y);\r\n\r\nextern \"C\" DllExport u32 CKLBUITask_getArgb(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_setArgb(s32* pCtx, u32 argb);\r\n\r\nextern \"C\" DllExport bool CKLBUITask_isAnim(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUITask_play(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITask_stop(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUITask_setParamCount(s32* pCtx, u32 splineCount, u32 maxKeyCount);\r\n\r\nextern \"C\" DllExport void CKLBUITask_setTarget(s32* pCtx, u32 splineIndex, u32 targetParameter);\r\n\r\nextern \"C\" DllExport void CKLBUITask_addKeys(s32* pCtx, u32 splineIndex, u32 time, s32 value);\r\n\r\nextern \"C\" DllExport void CKLBUITask_addKeysFixed(s32* pCtx, u32 splineIndex, u32 time, s32 fixed16Value);\r\n\r\nextern \"C\" DllExport void CKLBUITask_generateAnimation(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUITask_reconnect(s32* pCtx, s32* nodeName);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUISimpleItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUISimpleItem_create(s32* pParent, u32 order, float x, float y, s32* asset);\r\n\r\nextern \"C\" DllExport u32 CKLBUISimpleItem_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUISimpleItem_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport s32* CKLBUISimpleItem_getAsset(s32* pCtx);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUICanvas.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUICanvas_create(s32* pParent, u32 order, float x, float y, u32 vertexMax, u32 indexMax);\r\n\r\nextern \"C\" DllExport u32 CKLBUICanvas_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUICanvas_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport u32 CKLBUICanvas_getIdxMax(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_setFreeze(s32* pCtx, bool freeze);\r\n\r\nextern \"C\" DllExport bool CKLBUICanvas_addResource(s32* pCtx, s32* asset);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_drawImage(s32* pCtx, float x, float y, u32 idx, u32 color);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_drawImageScale(s32* pCtx, float x, float y, float scale,u32 idx, u32 color);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_fillRect(s32* pCtx, float x, float y, float w, float h, u32 color);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_startDynamicSection(s32* pCtx, u32 idx);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_endDynamicSection(s32* pCtx, u32 idx);\r\nextern \"C\" DllExport void CKLBUICanvas_dynamicSectionTranslate(s32* pCtx, u32 idx, float deltaX, float deltaY);\r\n\r\nextern \"C\" DllExport void CKLBUICanvas_dynamicSectionColor(s32* pCtx, u32 idx, u32 color);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIScale9.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIScale9_create(s32* pParent, u32 order, float x, float y, s32 width, s32 height, s32* SCALE9Asset);\r\n\r\nextern \"C\" DllExport void CKLBUIScale9_setWidth(s32* pCtx, s32 width);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScale9_getWidth(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIScale9_setHeight(s32* pCtx, s32 height);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScale9_getHeight(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIScale9_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScale9_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUIScale9_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIScale9_setAsset(s32* pCtx, s32* asset);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIScrollBar.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIScrollBar_create(s32* pParent,u32 order, float x, float y, float width, float height,s32 minValue, s32 maxValue, s32 pos, s32* image,s32 slider_size, s32 min_slider_size, u32 colorNormal, u32 colorSelect, bool vert, bool active, bool hideMode);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getMin(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setMin(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getMax(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setMax(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getPos(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setPos(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getSliderSize(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setSliderSize(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport s32 CKLBUIScrollBar_getSliderSizeMin(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setSliderSizeMin(s32* pCtx, s32 value);\r\n\r\nextern \"C\" DllExport bool CKLBUIScrollBar_getTouchActive(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setTouchActive(s32* pCtx, bool active);\r\n\r\nextern \"C\" DllExport u32  CKLBUIScrollBar_getNormalColor(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setNormalColor(s32* pCtx, u32 color);\r\n\r\nextern \"C\" DllExport u32  CKLBUIScrollBar_getActiveColor(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setActiveColor(s32* pCtx, u32 color);\r\n\r\nextern \"C\" DllExport void CKLBUIScrollBar_setMode(s32* pCtx, u32 mode);\r\n\r\nextern \"C\" DllExport bool CKLBUIScrollBar_getVertical(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIScrollBar_setVertical(s32* pCtx, bool vertical);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getWidth(s32* pCtx); \r\nextern \"C\" DllExport void CKLBUIScrollBar_setWidth(s32* pCtx, s32 width);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getHeight(s32* pCtx); \r\nextern \"C\" DllExport void CKLBUIScrollBar_setHeight(s32* pCtx, s32 height);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getOrder(s32* pCtx); \r\nextern \"C\" DllExport void CKLBUIScrollBar_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport s32* CKLBUIScrollBar_getImage(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIScrollBar_getMode(s32* pCtx); \r\n\r\nextern \"C\" DllExport bool CKLBUIScrollBar_selectScrMgr(s32* pCtx, s32* name, int len, int* args);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIWebArea.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIWebArea_create(s32* pParent, bool mode, float x, float y, float width, float height, s32* url);\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setWidth(s32* pCtx, s32 width);\r\nextern \"C\" DllExport s32 CKLBUIWebArea_getWidth(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setHeight(s32* pCtx, s32 height);\r\nextern \"C\" DllExport s32 CKLBUIWebArea_getHeight(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setText(s32* pCtx, s32* text);\r\nextern \"C\" DllExport s32* CKLBUIWebArea_getText(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setScalesPageToFit(s32* pCtx, bool b);\r\n\r\nextern \"C\" DllExport void CKLBUIWebArea_setBgColor(s32* pCtx, u32 argb);\r\n//======================================================================================\r\n//#include \"CKLBUIVirtualDoc.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIVirtualDoc_create(s32* pParent,u32 order, float x, float y,u32 doc_width, u32 doc_height, u32 view_width, u32 view_height,u32 max_command_nums, bool vertical); \r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_clear(s32* pCtx, u32 color);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setFont(s32* pCtx, u32 idx, s32* fontName, u32 fontSize);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setViewPortPos(s32* pCtx, s32 x, s32 y);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_drawLine(s32* pCtx, s32 x0, s32 y0, s32 x1, s32 y1, u32 color);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_drawImage(s32* pCtx, s32 x0, s32 y0, s32* image, u32 alpha);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_fillRect(s32* pCtx, s32 x0, s32 y0, u32 width, u32 height, u32 color, bool fill);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_drawText(s32* pCtx, s32 x0, s32 y0, s32* str, u32 color, u32 fontidx);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_startDocument(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_checkDocumentSize(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_endDocument(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getCommandMax(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setCommandMax(s32* pCtx, u32 command);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getDocHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setDocHeight(s32* pCtx, u32 height);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getDocWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setDocWidth(s32* pCtx, u32 width);\r\n\r\nextern \"C\" DllExport bool CKLBUIVirtualDoc_getVertical(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setVertical(s32* pCtx, bool vertical);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getViewHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setViewHeight(s32* pCtx, u32 height);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getViewWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setViewWidth(s32* pCtx, u32 width);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVirtualDoc_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport void CKLBUIVirtualDoc_setAlign(s32* pCtx, u32 align, u32 alignWidth);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUICellAnim.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUICellAnim_create(s32* pParent, u32 order, float x, float y, s32* asset, u32 index);\r\n\r\nextern \"C\" DllExport void CKLBUICellAnim_play(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUICellAnim_stop(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUICellAnim_setPlayMode(s32* pCtx, u32 mode);\r\n\r\nextern \"C\" DllExport u32 CKLBUICellAnim_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUICellAnim_getAnimIndex(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUICellAnim_setAnimIndex(s32* pCtx, u32 index);\r\n\r\nextern \"C\" DllExport s32* CKLBUICellAnim_getAsset(s32* pCtx);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUISWFPlayer.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUISWFPlayer_create(s32* pParent, u32 order, float x, float y, s32* asset,s32* movie_name, s32** replace_list, int asset_cnt);\r\n\r\nextern \"C\" DllExport bool CKLBUISWFPlayer_getPlay(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setPlay(s32* pCtx,bool play);\r\n\r\nextern \"C\" DllExport u32 CKLBUISWFPlayer_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setOrder(s32* pCtx,u32 order);\r\n\r\nextern \"C\" DllExport void CKLBUISWFPlayer_gotoFrame(s32* pCtx,s32* label);\r\n\r\nextern \"C\" DllExport u16 CKLBUISWFPlayer_getFrameRate(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setFrameRate(s32* pCtx,u32 fps);\r\n\r\nextern \"C\" DllExport bool CKLBUISWFPlayer_isAnimating(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setFrameRateScale(s32* pCtx,float scale);\r\n\r\nextern \"C\" DllExport s32* CKLBUISWFPlayer_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUISWFPlayer_getMovieName(s32* pCtx);\r\n\r\nextern \"C\" DllExport float CKLBUISWFPlayer_getVolume(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUISWFPlayer_setVolume(s32* pCtx,float volume);\r\n//======================================================================================\r\n//#include \"CKLBUIGroup.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIGroup_create(s32* pParent, float x, float y);\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_setAnimCallback(s32* pCtx, s32* callback);\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_setAnimation(s32* pCtx, s32* name, bool blend);\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_isAnim(s32* pCtx, s32* name);\r\n\r\nextern \"C\" DllExport bool CKLBUIGroup_skipAnim(s32* pCtx, s32* name);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIPolyline.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIPolyline_create(s32* pParent, u32 order, u32 maxPoint);\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getMaxPoint(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIPolyline_setMaxPoint(s32* pCtx,u32 maxpointcount);\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getPointCount(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIPolyline_setPointCount(s32* pCtx,u32 pointcount);\r\n\r\nextern \"C\" DllExport void CKLBUIPolyline_setPoint(s32* pCtx,u32 idx, float x, float y);\r\n\r\nextern \"C\" DllExport u32 CKLBUIPolyline_getColor(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIPolyline_setColor(s32* pCtx,u32 color);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIFreeVertItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIFreeVertItem_create(s32* pParent, u32 order, float x, float y, s32* asset, float* vertices);\r\n\r\nextern \"C\" DllExport u32 CKLBUIFreeVertItem_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setOrder(s32* pCtx,u32 order);\r\n\r\nextern \"C\" DllExport s32* CKLBUIFreeVertItem_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setVertices(s32* pCtx, float* coord);\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setColors(s32* pCtx, u32* colors);\r\n\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setVertCol(s32* pCtx, u32 idx, u32 argb);\r\n\r\nextern \"C\" DllExport void CKLBUIFreeVertItem_setUV(s32* pCtx, float* uv);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUITextInput.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUITextInput_create(s32* pParent,bool passwdmode,float x, float y, float width, float height, s32* default_text,u32 widget_id, int maxlen, u32 chartype);\r\n\r\nextern \"C\" DllExport u32  CKLBUITextInput_getWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITextInput_setWidth(s32* pCtx, u32 width);\r\n\r\nextern \"C\" DllExport u32 CKLBUITextInput_getHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITextInput_setHeight(s32* pCtx, u32 height);\r\n\r\nextern \"C\" DllExport s32* CKLBUITextInput_getText(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITextInput_setText(s32* pCtx, s32* text);\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setPlaceHolder(s32* pCtx, s32* placeHolder);\r\n\r\nextern \"C\" DllExport int CKLBUITextInput_getMaxLen(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUITextInput_setMaxLen(s32* pCtx, int maxLen);\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setCharType(s32* pCtx, u32 charType);\r\n\r\nextern \"C\" DllExport s32 CKLBUITextInput_getCharCount(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setColor(s32* pCtx, bool bTouch, u32 fgRgb, u32 bgRgb);\r\n\r\nextern \"C\" DllExport void CKLBUITextInput_setFont(s32* pCtx, s32* fontName, float fontSize);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIMultiImgItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIMultiImgItem_create(s32* pParent, u32 order, float x, float y, u32 idx, s32** pArrayAsset,u32* pArrayIndexes, u32 assetCount);\r\n\r\nextern \"C\" DllExport u32 CKLBUIMultiImgItem_getIndexMax(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIMultiImgItem_setIndexMax(s32* pCtx,u32 index);\r\n\r\nextern \"C\" DllExport u32 CKLBUIMultiImgItem_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIMultiImgItem_setOrder(s32* pCtx,u32 order);\r\n\r\nextern \"C\" DllExport u32 CKLBUIMultiImgItem_getIndex(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIMultiImgItem_setIndex(s32* pCtx, u32 index);\r\n\r\nextern \"C\" DllExport bool CKLBUIMultiImgItem_changeAssets(s32* pCtx, s32** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIRubberBand.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_create(s32* pParent, u32 order, float x, float y, u32 resolution, s32* origin, s32* joint,s32* point, u32 flags, u32 animTime, s32 joint_order_off, s32 point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getOriginX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setOriginX(s32* pCtx,float x);\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getOriginY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setOriginY(s32* pCtx,float y);\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getPointX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setPointX(s32* pCtx,float x);\r\n\r\nextern \"C\" DllExport float CKLBUIRubberBand_getPointY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setPointY(s32* pCtx,float y);\r\n\r\nextern \"C\" DllExport bool CKLBUIRubberBand_getFAnim(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setFAnim(s32* pCtx,bool fAnim);\r\n\r\nextern \"C\" DllExport bool CKLBUIRubberBand_getFAnimRT(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setFAnimRT(s32* pCtx,bool fAnimRT);\r\n\r\nextern \"C\" DllExport u32 CKLBUIRubberBand_getAnimTime(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIRubberBand_setAnimTime(s32* pCtx,u32 animTime);\r\n\r\nextern \"C\" DllExport u32 CKLBUIRubberBand_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_getAssetOrigin(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_getAssetJoint(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUIRubberBand_getAssetPoint(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIRubberBand_setOrder(s32* pCtx, u32 order_origin, u32 order_joint, u32 order_point);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIPieChart.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIPieChart_create(s32* pParent, u32 order, float x, float y, float width, float height, s32* asset, float start,float end, u32 anim, float initial);\r\n\r\nextern \"C\" DllExport float CKLBUIPieChart_getStart(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIPieChart_setStart(s32* pCtx,float start);\r\n\r\nextern \"C\" DllExport float CKLBUIPieChart_getEnd(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIPieChart_setEnd(s32* pCtx,float end);\r\n\r\nextern \"C\" DllExport float CKLBUIPieChart_getValue(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIPieChart_setValue(s32* pCtx,float value);\r\n\r\nextern \"C\" DllExport s32 CKLBUIPieChart_getAnim(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIPieChart_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIPieChart_changeAsset(s32* pCtx, s32* assetName);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIMoviePlayer.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIMoviePlayer_create(s32* pParent, bool mode, float x, float y, float width, float height, s32* url);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_setWidth(s32* pCtx,u32 width);\r\n\r\nextern \"C\" DllExport u32 CKLBUIMoviePlayer_getWidth(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_setHeight(s32* pCtx,u32 height);\r\n\r\nextern \"C\" DllExport u32 CKLBUIMoviePlayer_getHeight(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_setText(s32* pCtx,s32* text);\r\n\r\nextern \"C\" DllExport s32* CKLBUIMoviePlayer_getText(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_moviePlay(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_movieStop(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_moviePause(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIMoviePlayer_movieResume(s32* pCtx);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIDragIcon.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIDragIcon_create(s32* pParent, u32 order, float x, float y, s32* tap_area, s32* asset, s32* drag_asset,s32 drag_order_offset, float drag_alpha, float center_x, float center_y, u32 flags);\r\n\r\nextern \"C\" DllExport u32 CKLBUIDragIcon_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUIDragIcon_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBUIDragIcon_getDrag(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIDragIcon_getFlags(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIDragIcon_setFlags(s32* pCtx,u32 flag);\r\n\r\nextern \"C\" DllExport bool CKLBUIDragIcon_getEnable(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIDragIcon_setEnable(s32* pCtx,bool enable);\r\n\r\nextern \"C\" DllExport float CKLBUIDragIcon_getDragScaleX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIDragIcon_setDragScaleX(s32* pCtx,float scale);\r\n\r\nextern \"C\" DllExport float CKLBUIDragIcon_getDragScaleY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIDragIcon_setDragScaleY(s32* pCtx,float scale);\r\n\r\nextern \"C\" DllExport void CKLBUIDragIcon_dragArea(s32* pCtx, s32* area);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIDebugItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIDebugItem_create(s32* pParent, u32 order, float x, float y, u32 argb, s32* font, u32 size, s32* text, u32 id);\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setOrder(s32* pCtx,u32 order);\r\nextern \"C\" DllExport u32 CKLBUIDebugItem_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setColor(s32* pCtx,u32 color);\r\nextern \"C\" DllExport u32 CKLBUIDebugItem_getColor(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setFont(s32* pCtx,s32* font);\r\nextern \"C\" DllExport s32* CKLBUIDebugItem_getFont(s32* pCtx);\r\n\r\n// Font size\r\nextern \"C\" DllExport void CKLBUIDebugItem_setSize(s32* pCtx,u32 size);\r\nextern \"C\" DllExport u32 CKLBUIDebugItem_getSize(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIDebugItem_setText(s32* pCtx,s32* text);\r\nextern \"C\" DllExport s32* CKLBUIDebugItem_getText(s32* pCtx);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUILabel.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUILabel_create(s32* pParent, u32 order, float x, float y, u32 argb, s32* font, u32 size, s32* text, u32 align);\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUILabel_setOrder(s32* pCtx,u32 order);\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getAlign(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUILabel_setAlign(s32* pCtx,u32 align);\r\n\r\nextern \"C\" DllExport s32* CKLBUILabel_getText(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUILabel_setText(s32* pCtx,s32* txt);\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getColor(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUILabel_setColor(s32* pCtx,u32 color);\r\n\r\nextern \"C\" DllExport s32* CKLBUILabel_getFont(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUILabel_setFont(s32* pCtx,s32* font);\r\n\r\nextern \"C\" DllExport u32 CKLBUILabel_getFontSize(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUILabel_setFontSize(s32* pCtx,u32 size);\r\n\r\nextern \"C\" DllExport void CKLBUILabel_setPosition(s32* pCtx, float x, float y);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIList.h\"\r\nextern \"C\" DllExport  s32* CKLBUIList_create(s32* pParent, u32 base_order, u32 max_order, float x, float y, float clip_width, float clip_height,s32 default_line_step, bool vertical, u32 optional_flags);\r\nextern \"C\" DllExport u32 CKLBUIList_getWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setWidth(s32* pCtx,u32 width);\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setHeight(s32* pCtx,u32 height);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getStepX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setStepX(s32* pCtx,s32 x);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getStepY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setStepY(s32* pCtx,s32 x);\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setOrder(s32* pCtx,u32 order);\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getMaxOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setMaxOrder(s32* pCtx,u32 maxOrder);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_getVertical(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setVertical(s32* pCtx,bool vertical);\r\n\r\nextern \"C\" DllExport u32 CKLBUIList_getItems(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getMarginTop(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setMarginTop(s32* pCtx,s32 top);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_getMarginBottom(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setMarginBottom(s32* pCtx,s32 bottom);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_getDefaultScroll(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIList_setDefaultScroll(s32* pCtx,bool scroll);\r\nextern \"C\" DllExport bool CKLBUIList_cmdItemRemove(s32* pCtx,s32 idx);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdItemMove(s32* pCtx,s32 src, s32 dst);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetMargin(s32* pCtx,s32 top, s32 bottom);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdGetPosition(s32* pCtx);\r\nextern \"C\" DllExport s32 CKLBUIList_cmdSetPosition(s32* pCtx, s32 pos, s32 dir);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdSearchID(s32* pCtx,u32 id);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetItemPos(s32* pCtx,u32 mode, s32 idx, s32 offset);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetLimitClip(s32* pCtx,bool chklimit);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdGetLimit(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdSetLimitArea(s32* pCtx,s32 limitArea);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdChangeStep(s32* pCtx,s32 index, s32 step);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdInputEnable(s32* pCtx,bool enable);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAnimationItem(s32* pCtx,s32 index, s32* name, bool blend);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAnimationAll(s32* pCtx,s32* name, bool blend);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdItemAnimSkip(s32* pCtx,s32 index, s32* name);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAllAnimSkip(s32* pCtx, s32* name);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetGroup(s32* pCtx, s32* group_name);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetItemID(s32* pCtx, s32 index, u32 id);\r\n\r\nextern \"C\" DllExport void CKLBUIList_setLoop(s32* pCtx, bool mode);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_useScrollBar(s32* pCtx, u32 order, bool side, s32 lineWeight, s32* image, s32 min_slender_size, u32 colorNormal, u32 colorSelect, bool active, bool hideMode, bool shortHide);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdFWModeConfig(s32* pCtx, int itemStep, int maxItems);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdSetItemMode(s32* pCtx, int itemMode);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdAddRecords(s32* pCtx, s32 insIdx, s32* form, s32* db, s32 step);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdSetInitial(s32* pCtx, s32 pos);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdSelectScrMgr(s32* pCtx, s32* name, s32* optParams, u32 nb);\r\n\r\nextern \"C\" DllExport void CKLBUIList_cmdSetClip(s32* pCtx, u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdItemAdd(s32* pCtx, s32* asset);\r\nextern \"C\" DllExport s32 CKLBUIList_cmdItemAdd2(s32* pCtx, s32* asset, s32 step, s32 id);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdInsertItem(s32* pCtx, s32* asset, s32 index);\r\nextern \"C\" DllExport s32 CKLBUIList_cmdInsertItem2(s32* pCtx, s32* asset, s32 index, s32 step, s32 id);\r\n\r\nextern \"C\" DllExport s32 CKLBUIList_cmdRemoveSelection(s32* pCtx, s32* indexes, u32 nb);\r\n\r\nextern \"C\" DllExport void CKLBUIList_setDragRect(s32* pCtx, s32 left, s32 top, s32 right, s32 bottom);\r\n\r\nextern \"C\" DllExport bool CKLBUIList_cmdExistNode(s32* pCtx, s32 index, s32* name);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIForm.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIForm_create(s32* pParent, u32 order, float x, float y, bool bAssetFile, s32* asset, bool bExclusive, bool modal, bool urgent);\r\n\r\nextern \"C\" DllExport s32* CKLBUIForm_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUIForm_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_getExclusive(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIForm_setExclusive(s32* pCtx, bool exclusive);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_getIsFile(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBUIForm_setEnable(s32* pCtx, bool isEnabled);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_existNode(s32* pCtx, s32* name);\r\n\r\nextern \"C\" DllExport void CKLBUIForm_inputEnable(s32* pCtx, bool bEnable);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_animation(s32* pCtx, s32* animname, bool blend);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_isAnim(s32* pCtx, s32* name);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_skipAnim(s32* pCtx, s32* name);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_animEnter(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_animLeave(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIForm_setGroup(s32* pCtx, s32* group_name);\r\n\r\nextern \"C\" DllExport void CKLBUIForm_setGlobalVolume(s32* pCtx, float volume);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIControl.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\nextern \"C\" DllExport s32* CKLBUIControl_create(s32* pParentTask);\r\n\r\nextern \"C\" DllExport void CKLBUIControl_lock(s32* pCtx, bool lockMode);\r\n\r\nextern \"C\" DllExport bool CKLBUIControl_setGroup(s32* pCtx, s32* groupName);\r\n\r\nextern \"C\" DllExport void CKLBUIControl_setMask(s32* pCtx, u16 mask);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUITouchPad.h\"\r\n\r\n// \"\" is given instead of NULL because of the class specifications.\r\nextern \"C\" DllExport s32* CKLBUITouchPad_create(s32* pParent, bool modal);\r\n\r\nextern \"C\" DllExport bool CKLBUITouchPad_setGroup(s32* pCtx, s32* group_name);\r\n\r\nextern \"C\" DllExport void CKLBUITouchPad_setLock(s32* pCtx, bool lock_mode);\r\n\r\nextern \"C\" DllExport void CKLBUITouchPad_setGetAll(s32* pCtx, bool b);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIClip.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIClip_create(s32* pParent, u32 baseOrder, u32 maxOrder, float x, float y, float clipWidth, float clipHeight);\r\n\r\nextern \"C\" DllExport u32 CKLBUIClip_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIClip_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport u32 CKLBUIClip_getMaxOdr(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIClip_setMaxOdr(s32* pCtx, u32 maxodr);\r\n\r\nextern \"C\" DllExport float CKLBUIClip_getWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIClip_setWidth(s32* pCtx, float width);\r\n\r\nextern \"C\" DllExport float CKLBUIClip_getHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIClip_setHeight(s32* pCtx, float height);\r\n\r\nextern \"C\" DllExport void CKLBUIClip_setPosition(s32* pCtx, float x, float y);\r\n\r\nextern \"C\" DllExport void CKLBUIClip_setSize(s32* pCtx, float width, float height);\r\n\r\n//======================================================================================\r\n//#include \"CKLBMapTask.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBMapTask_create(s32* pParent, u32 allocSize, s32* asset);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getX(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getY(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getOffsetLayer(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getOffsetPerLine(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getWidth(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getHeight(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCoordX(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCoordY(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBMapTask_getMode(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32* CKLBMapTask_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCenterX(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getCenterY(s32* pCtx);\r\n\r\nextern \"C\" DllExport float CKLBMapTask_getScale(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getTileWidth(s32* pCtx);\r\n\r\nextern \"C\" DllExport s32 CKLBMapTask_getHalfTileHeight(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetViewPort(s32* pCtx, u32 width, u32 height, s32 x, s32 y, u32 baseRenderPriority, u32 priorityOffsetPerLayer, u32 priorityOffsetPerLine);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetCoordinate(s32* pCtx, float x, float y, s32 mode);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetCenterView(s32* pCtx, float fx, float fy);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetDefaultTile(s32* pCtx, u32 layer, s32* asset, u32 argb);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetZoom(s32* pCtx, float scale);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_getScrCoord(s32* pCtx, float fx, float fy, float* resX, float* resY);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_getLogCoord(s32* pCtx, float fx, float fy, float* resX, float* resY);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetTileID(s32* pCtx, u32 layer, u32 tileX, u32 tileY, u32 tileID);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cmdMapSetAreaID(s32* pCtx, u32 layer, u32 tileID, u32 x1, u32 y1, u32 x2, u32 y2);\r\n\r\n// Camera methods\r\nextern \"C\" DllExport s32* CKLBMapTask_cameraCreate(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraDelete(s32* pCtx, s32* pLuaCam);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraMove(s32* pCtx, s32* pLuaCam, s32 x, s32 y);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraMoveWithCoord(s32* pCtx, s32* pLuaCam, s32 x, s32 y, s32 mode);\r\n\r\nextern \"C\" DllExport void CKLBMapTask_cameraSet(s32* pCtx, s32* pLuaCam);\r\n\r\n//======================================================================================\r\n//#include \"CKLBNetAPI.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBNetAPI_create(s32* pParent, s32* apiurl, s32* client_version, s32* consumer_key, s32* application_id,u32 session_max, s32* region);\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_startUp(s32* pCtx, s32* loginID, s32* password, s32* invite, u32 timeout, u32* session);\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_login(s32* pCtx, s32* loginID, s32* password, u32 timeout, u32* session);\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_cancel(s32* pCtx, u32 uniq);\r\n\r\nextern \"C\" DllExport void CKLBNetAPI_cancelAll(s32* pCtx);\r\n\r\nextern \"C\" DllExport void CKLBNetAPI_debugHdr(s32* pCtx, bool debugflag);\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_sendHTTP(s32* pCtx, s32* apiURL, s32* json, u32 timeout, bool passVersionCheck, u32* session);\r\n\r\nextern \"C\" DllExport bool CKLBNetAPI_watchMaintenance(s32* pCtx, u32 timeout, u32* session);\r\n\r\nextern \"C\" DllExport void CKLBNetAPI_genCmdNumID(s32* pCtx, s32* body, int serial, s32* buf);\r\n\r\n//======================================================================================\r\n//#include \"CKLBMapGroup.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBMapGroup_create(s32* pParent, u32 order, float x, float y, float z, bool scaleEnable);\r\n\r\nextern \"C\" DllExport u32 CKLBMapGroup_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport float CKLBMapGroup_getMapX(s32* pCtx);\r\nextern \"C\" DllExport void CKLBMapGroup_setMapX(s32* pCtx, float x);\r\n\r\nextern \"C\" DllExport float CKLBMapGroup_getMapY(s32* pCtx);\r\nextern \"C\" DllExport void CKLBMapGroup_setMapY(s32* pCtx, float y);\r\n\r\nextern \"C\" DllExport float CKLBMapGroup_getMapZ(s32* pCtx);\r\nextern \"C\" DllExport void CKLBMapGroup_setMapZ(s32* pCtx, float z);\r\n\r\nextern \"C\" DllExport void CKLBMapGroup_setPosition(s32* pCtx, float x, float y, float z);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUnitTask.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_create(s32* pParent, s32* unitname, bool bMove);\r\n\r\nextern \"C\" DllExport void CKLBUnitTask_getPosition(s32* pCtx, s32* x, s32* y, s32* z, u32* dir);\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_getClass(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUnitTask_getType(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUnitTask_setType(s32* pCtx, u32 type);\r\n\r\nextern \"C\" DllExport u64 CKLBUnitTask_getDbId(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBUnitTask_getOrder(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUnitTask_getVisible(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUnitTask_setVisible(s32* pCtx, bool visible);\r\n\r\nextern \"C\" DllExport void CKLBUnitTask_cmdSetLogicalPosition(s32* pCtx, float x, float y, float z, u32 dir, s32* optJSON);\r\n\r\nextern \"C\" DllExport void CKLBUnitTask_cmdRealize(s32* pCtx, s32* optJSON);\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_cmdExecuteQuery(s32* pCtx, s32* pQuery , float* pDistance);\r\n\r\nextern \"C\" DllExport bool CKLBUnitTask_assignAI(s32* pCtx, u32 aiDefinition);\r\n\r\nextern \"C\" DllExport s32* CKLBUnitTask_getAIObject(s32* pCtx);\r\n\r\n//======================================================================================\r\n//#include \"CKLBUIVariableItem.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBUIVariableItem_create(s32* pParent, u32 order, float x, float y, float width, float height, s32* asset);\r\n\r\nextern \"C\" DllExport u32 CKLBUIVariableItem_getOrder(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVariableItem_setOrder(s32* pCtx, u32 order);\r\n\r\nextern \"C\" DllExport s32* CKLBUIVariableItem_getAsset(s32* pCtx);\r\n\r\nextern \"C\" DllExport float CKLBUIVariableItem_getWidth(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVariableItem_setWidth(s32* pCtx, float width);\r\n\r\nextern \"C\" DllExport float CKLBUIVariableItem_getHeight(s32* pCtx);\r\nextern \"C\" DllExport void CKLBUIVariableItem_setHeight(s32* pCtx, float height);\r\n\r\nextern \"C\" DllExport bool CKLBUIVariableItem_changeAsset(s32* pCtx, s32* assetName);\r\n\r\nextern \"C\" DllExport void CKLBUIVariableItem_changeUV(s32* pCtx, float x, float y, float width, float height);\r\n\r\nextern \"C\" DllExport void CKLBUIVariableItem_resetUV(s32* pCtx);\r\n\r\nextern \"C\" DllExport bool CKLBUIVariableItem_setMaskAsset(s32* pCtx, s32* asset);\r\n\r\n//======================================================================================\r\n//#include \"CKLBStoreService.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBStoreService_create();\r\n\r\nextern \"C\" DllExport void CKLBStoreService_buyItems(s32* pCtx, s32* item);\r\n\r\nextern \"C\" DllExport void CKLBStoreService_getProducts(s32* pCtx, s32* json, bool currency);\r\n\r\n//======================================================================================\r\n//#include \"CKLBWorld.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBWorld_getPointUnit(s32 x, s32 y);\r\nextern \"C\" DllExport s32* CKLBWorld_getUnitByID(s32* dbID);\r\nextern \"C\" DllExport bool CKLBWorld_doEvent(s32* pSrcTask, s32* pDstTask, s32* pUserTask, s32* pOppoTask, u32 eventID, s32* additionalParams, u32 additionalParamsCount);\r\nextern \"C\" DllExport void CKLBWorld_killAllUnit();\r\nextern \"C\" DllExport u32 CKLBWorld_getUnitListByClass(s32* unitClass, s32** pIds, s32** pTasks, u32 maxLength);\r\nextern \"C\" DllExport s32 CKLBWorld_getUnitAll(s32* targetUser, s32*  battleId, s32 callbackIndex);\r\nextern \"C\" DllExport s32 CKLBWorld_getUnitClass(s32* unitClass, s32* strId, s32* targetUser, s32 callbackIndex);\r\nextern \"C\" DllExport s32 CKLBWorld_getUnitTableAll(s32* unitTable, s32 callbackIndex);\r\nextern \"C\" DllExport void CKLBWorld_setOrderParam(u32 baseOrder, float orderReso);\r\nextern \"C\" DllExport void CKLBWorld_unitFreeze(bool bFreeze);\r\n//======================================================================================\r\n//#include \"CKLBAsyncLoader.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBAsyncLoader_create(s32* pParentTask, s32** assets, u32 count, u32 datasetID);\r\n\r\nextern \"C\" DllExport u32 CKLBAsyncLoader_getTotalCount(s32* pCtx);\r\n\r\nextern \"C\" DllExport u32 CKLBAsyncLoader_getProcessCount(s32* pCtx);\r\n\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//======================================================================================\r\n//#include \"CKLBLuaLibKEY.h\"\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_genUserID(s32* buf, u32 size);\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_genUserPW(s32* user_id, s32* buf, u32 size);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_setSecureID(s32* service_name, s32* user_id);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_setSecurePW(s32* service_name, s32* passwd);\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_getSecureID(s32* service_name, s32* buf, u32 size);\r\n\r\nextern \"C\" DllExport int CKLBLuaLibKEY_getSecurePW(s32* service_name, s32* buf, u32 size);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_delSecureID(s32* service_name);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibKEY_delSecurePW(s32* service_name);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibRES.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpSceneGraph(s32* ptr);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpRendering(bool detailed);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpAssets();\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpDataSet();\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpTexturePacker(bool detailed);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibRES_dumpGeometryCost(bool detailed);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibENG.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibENG_isRelease();\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibENG_getPlatform();\r\n\r\nextern \"C\" DllExport void CKLBLuaLibENG_getNanoTime(s32* milli, s32* nano);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibENG_startNanoTime(u32 idx);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibENG_endNanoTime(u32 idx, s32* milli, s32* nano);\r\n\r\nextern \"C\" DllExport u32 CKLBLuaLibENG_getFrameID();\r\n\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaEnv.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdLogging(s32* msg);\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdExit();\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdSystemInfo(s32* width, s32* height);\r\n\r\nextern \"C\" DllExport void CKLBLuaEnv_cmdSystemReboot();\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibFONT.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibFONT_createFont(s32 size, s32* fontname);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibFONT_removeFont(s32* fontobj);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibFONT_cmdGetTextInfo(s32* str, s32* font, s32* pReturnInfo);\r\n\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibASSET.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibASSET_getImageSize(s32* asset_name, s32* pReturnWidth, s32* pReturnHeight);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibASSET_getBoundSize(s32* asset_name, float* pReturnWidth, float* pReturnHeight);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibASSET_getAssetInfo(s32* asset_name, s32* pReturnImgWidth, s32* pReturnImgHeight, float* pReturnBoundWidth, float* pReturnBoundHeight);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibDATA.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibDATA_cmdCreateData(u32 dataSetID);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibDATA_cmdRegistData(s32* pDataSet, s32* name_asset, u32* pReturnHandle);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDATA_cmdDelete(s32* pDataSet);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibGL.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibGL_GLClearColor(float r, float g, float b, float a);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_GLSetResolution(int width, int height);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_SGGetGuardBand(float* leftBorder, float* rightBorder, float* topBorder, float* bottomBorder);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_SGSetGuardBand(float leftBorder, float rightBorder, float topBorder, float bottomBorder);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibGL_GLCreateScreenAsset(s32* name);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibGL_GLDoScreenShot(s32* name);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibGL_GLFreeScreenAsset(s32* name);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibUI.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibUI_calcPosition(float x, float y, float w, float h, u32 mask, float* out_rx, float* out_ry);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibBIN.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibBIN_open(s32* bin_asset);\r\nextern \"C\" DllExport void CKLBLuaLibBIN_close(s32* pBIN);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibBIN_peek(s32* pBIN, s32 offset, s32* out_value);\r\nextern \"C\" DllExport bool CKLBLuaLibBIN_peek_u16(s32* pBIN, s32 offset, u32* out_value, bool f_bigendian);\r\nextern \"C\" DllExport bool CKLBLuaLibBIN_peek_u32(s32* pBIN, s32 offset, u32* out_value, bool f_bigendian);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibTASK.h\"\r\n//#include \"CKLBTask.h\"\r\n\r\nextern \"C\" DllExport void Task_kill(s32* pTask);\r\n\r\nextern \"C\" DllExport bool Task_isKill(s32* pTask);\r\n\r\nextern \"C\" DllExport void Task_setStageTask(s32* pTask);\r\n\r\nextern \"C\" DllExport void Task_clearStageTask();\r\n\r\nextern \"C\" DllExport void Task_setPause(s32* pTask, bool bPause, bool bRecursive);\r\n\r\nextern \"C\" DllExport void Task_setManagerPause(bool bPause);\r\nextern \"C\" DllExport void Task_interposeTimer(s32* pTask, s32* pTimer);\r\n//======================================================================================\r\n//#include \"CKLBLuaLibSOUND.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibSOUND_cmdSoundOpen(s32* snd_asset, bool f_bgm);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundClose(s32* pSnd);\r\n\r\nextern \"C\" DllExport u32 CKLBLuaLibSOUND_removeSoundAll();\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundPlay(s32* pSnd, u32 fade_msec, float tgtVol, float globalVol);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundStop(s32* pSnd, u32 fade_msec, float tgtVol);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundVolume(s32* pSnd, float volume);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundPan(s32* pSnd, float pan);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundPause(s32* pSnd);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundResume(s32* pSnd);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSoundSeek(s32* pSnd, s32 millisec);\r\n\r\nextern \"C\" DllExport s32  CKLBLuaLibSOUND_cmdSoundTell(s32* pSnd);\r\n\r\nextern \"C\" DllExport s32  CKLBLuaLibSOUND_cmdSoundState(s32* pSnd);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdVolumeBGM(float volume);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdVolumeSE(float volume);\r\n\r\nextern \"C\" DllExport s32 CKLBLuaLibSOUND_cmdGetLength(s32* pSnd);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibSOUND_cmdSetFade(s32* pSnd, s32 millisec, float tgtVol);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibSOUND_cmdSoundSetBufSize(s32* pSnd, s32 value);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibDB.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibDB_dbopen(s32* db_asset, bool b_write, bool b_create);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDB_dbclose(s32* pDB);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDB_closeAll();\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibDB_query(s32* pDB, s32* sqlQuery, int* nbEntries);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibAI.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibAI_setActive(s32* pAIobj, bool active);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibAI_resetRule(s32* pAIobj);\r\n\r\nextern \"C\" DllExport s32 CKLBLuaLibAI_getProp(s32* pAIobj, u32 index);\r\nextern \"C\" DllExport void CKLBLuaLibAI_setProp(s32* pAIobj, u32 index, s32 value);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibAI_delQuery(s32* pQuery);\r\nextern \"C\" DllExport void CKLBLuaLibAI_delQueryAll();\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibAPP.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibAPP_callApplication(s32 type, s32* addr, s32* subject, s32* body);\r\n\r\n//======================================================================================\r\n//#include \"CKLBPauseCtrl.h\"\r\n\r\nextern \"C\" DllExport s32* CKLBPauseCtrl_create(s32* pParent);\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibLANG.h\"\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibLANG_addString(s32* id, s32* str);\r\n\r\nextern \"C\" DllExport s32* CKLBLuaLibLANG_getString(s32* id);\r\n\r\nextern \"C\" DllExport void CKLBLuaLibLANG_removeString(s32* id);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibLANG_useDB(s32* dbFile, s32* table, s32* keyF, s32* valueF, s32* groupF);\r\n\r\nextern \"C\" DllExport bool CKLBLuaLibLANG_loadGroup(s32* groupId);\r\n\r\n\r\n//======================================================================================\r\n//#include \"CKLBLuaLibDEBUG.h\"\r\n\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_startMenu(u32 maxCount, s32* caption, s32* key);\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_addItem(u32 mode, s32* caption, s32* key, s32 min, s32 max, s32 value, s32** items, u32 itemsCount);\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_endMenu();\r\nextern \"C\" DllExport void CKLBLuaLibDEBUG_removeMenu(s32* key);\r\n/*\r\n//======================================================================================\r\n//#include \".h\"\r\n\r\n//======================================================================================\r\n//#include \".h\"\r\n\r\n//======================================================================================\r\n//#include \".h\"\r\n\r\n//======================================================================================\r\n//#include \".h\"\r\n\r\n//======================================================================================\r\n//#include \".h\"\r\n\r\n//======================================================================================\r\n//#include \".h\"\r\n*/\r\n\r\n#endif //__EXPORT_LIST_H__\r\n"
  },
  {
    "path": "Engine/source/Sound/CSoundAnalysis.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n @file   CSoundAnalysis.cpp\r\n @brief  サウンドファイルの解析など\r\n*/\r\n\r\n#include <string.h>\r\n#include \"CSoundAnalysis.h\"\r\n#include \"CSoundAnalysisMP3.h\"\r\n\r\n/*\r\n @brief  サウンドファイルのいろいろな情報を取得\r\n @param[in]     const char* _path          サウンドファイル名\r\n @param[out]    sSoundAnalysisData* _data  指定サウンドファイルのいろいろな情報格納用\r\n @return        void\r\n */\r\nbool GetSoundAnalysisData( const char* _path, sSoundAnalysisData* _data )\r\n{\r\n    if( _path == NULL || _data == NULL ) return false;\r\n    \r\n    bool bAnalysis = false;\r\n    \r\n    // 拡張子をチェックしてそれぞれの解析を行う\r\n    if( strstr(_path, \".mp3\") )\r\n    {\r\n        // MP3\r\n        bAnalysis = SoundAnalysis_MP3( _path, _data );\r\n    }\r\n    else if( strstr(_path, \".ogg\") )\r\n    {\r\n        // OGG\r\n    }\r\n    \r\n    return bAnalysis;\r\n}\r\n\r\n/*\r\n @brief  サウンドファイルの演奏時間を取得\r\n @param[in] const char* _path   サウンドファイル名\r\n @return    u32                 指定のサウンドファイルの演奏時間\r\n */\r\nu32 GetSoundTotalTime( const char* _path )\r\n{\r\n    sSoundAnalysisData data;\r\n    bool bAnalysis = false;\r\n    \r\n    bAnalysis = GetSoundAnalysisData( _path, &data );\r\n    \r\n    if( bAnalysis ) {\r\n        return (u32)data.m_totalTime;\r\n    }\r\n    return 0;\r\n}\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Engine/source/Sound/CSoundAnalysisMP3.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n @file      CSoundAnalysisMP3.cpp\r\n @brief     MP3形式のサウンドファイルの解析など\r\n */\r\n\r\n#include <string.h>\r\n#include \"CPFInterface.h\"\r\n#include \"CSoundAnalysisMP3.h\"\r\n#include \"encryptFile.h\"\r\n\r\n// ビットレート表\r\n// MPEG1\r\nstatic const short s_MPEG1_BitRateTbl[3][14] =\r\n{\r\n    { 32, 40, 48, 56,  64,  80,  96,  112, 128, 160, 192, 224, 256, 320 },  // layer3\r\n    { 32, 48, 56, 64,  80,  96,  112, 128, 160, 192, 224, 256, 320, 384 },  // layer2\r\n    { 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }   // layer1\r\n};\r\n\r\n// MPEG2\r\nstatic const short s_MPEG2_BitRateTbl[3][14] =\r\n{\r\n    { 8,  16, 24, 32, 40, 48, 56,  64,  80,  96,  112, 128, 144, 160 }, // layer3\r\n    { 8,  16, 24, 32, 40, 48, 56,  64,  80,  96,  112, 128, 144, 160 }, // layer2\r\n    { 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 }  // layer1\r\n};\r\n\r\n// MPEG2.5\r\nstatic const short s_MPEG2_5_BitRateTbl[1][14] =\r\n{\r\n    { 8,  16, 24, 32, 40, 48, 56,  64,  80,  96,  112, 128, 144, 160 }  //\r\n};\r\n\r\n// サンプリングレート表\r\nstatic const unsigned short s_SamplingTbl[3][3] =\r\n{\r\n    { 44100, 48000, 32000 }, // MPEG1\r\n    { 22050, 24000, 16000 }, // MEPG2\r\n    { 11025, 12000, 8000  }  // MPEG2.5\r\n};\r\n\r\n// フレームあたりのサンプル数テーブル\r\nstatic const short s_SamplePerFrame[3][3] =\r\n{\r\n    // MPEG1, MPEG2, MPEG2.5\r\n    { 1152, 576,  576  },  // layer3\r\n    { 1152, 1152, 1152 },  // layer2\r\n    { 384,  384,  384  }   // layer1\r\n};\r\n\r\nenum eMPEG_VER\r\n{\r\n    eMPEG_VER_NONE = -1,\r\n    \r\n    eMPEG_VER_1 = 0,    // MPEG1\r\n    eMPEG_VER_2,        // MPEG2\r\n    eMPEG_VER_2_5,      // MPEG2.5\r\n    \r\n    eMPEG_VER_MAX\r\n};\r\n\r\n// mp3フレームヘッダ情報\r\ntypedef union\r\n{\r\n    char mHeader[4];\r\n    struct\r\n    {\r\n        unsigned int sinc1:     8;  // 同期ヘッダ(0xff)\r\n        unsigned int err:       1;  // エラープロテクション\r\n        unsigned int layer:     2;  // レイヤー\r\n        unsigned int id:        2;  // ID\r\n        unsigned int sinc2:     3;  // 同期ヘッダ(0xf)\r\n        unsigned int ext:       1;  // エクステンション(個人識別フラグ)\r\n        unsigned int padding:   1;  // パディング\r\n        unsigned int sampling:  2;  // サンプリングレート\r\n        unsigned int bitrate:   4;  // ビットレート\r\n        unsigned int enfa:      2;  // エンファシス\r\n        unsigned int original:  1;  // オリジナル/コピー\r\n        unsigned int copyright: 1;  // 著作権\r\n        unsigned int mode:      2;  // モードエクステンション\r\n        unsigned int channel:   2;  // チャンネルモード\r\n    } h;\r\n} MP3FrameHeader;\r\n\r\n// フレームヘッダの情報構造隊\r\ntypedef struct strFrameHeaderInfo\r\n{\r\n    s16 m_version;      // MPEGバージョン\r\n    s16 m_layer;        // レイヤー番号\r\n    s16 m_bitrate;      // ビットレート\r\n    u16 m_samplerate;   // サンプリングレート(44100KHzがs16の範囲を超えるためu16)\r\n    s16 m_padding;      // パディングバイトの有無\r\n    s16 m_channel;      // チャンネル数\r\n    s16 m_framesize;    // フレームサイズ\r\n} sFrameHeaderInfo;\r\n\r\n// フレームヘッダの平均結果\r\ntypedef struct strFrameHeaderAverageInfo\r\n{\r\n    eBITRATE_TYPE   m_bitRateType;          // ビットレートのタイプ(eBITRATE_TYPE参照)\r\n    s16             m_bitRateAverage;       // ビットレート平均\r\n    s32             m_frameCnt;             // フレーム数\r\n    s64             m_dataSize;             // 音声データのトータルサイズ\r\n} sFrameHeaderAverageInfo;\r\n\r\n//===========================\r\n//  ローカル関数\r\n//===========================\r\nbool CheckFrameHeader(const MP3FrameHeader* _header, sFrameHeaderInfo* _pInfo);\r\nbool AverageFrameHeader(CDecryptBaseClass& decryptor, FILE* _fp, s32 _skip, sFrameHeaderAverageInfo* _pInfo);\r\n\r\n/*\r\n @brief  mp3形式のサウンドファイル解析\r\n @param[in] const char* _path                   サウンドファイルのパス\r\n @param[in] sSoundAnalysisData* _analysisData   サウンドファイルの解析結果渡す用\r\n @return    bool    true:解析完了, false:解析失敗\r\n */\r\nbool SoundAnalysis_MP3( const char* _path, sSoundAnalysisData* _analysisData )\r\n{\r\n    if( _path == NULL || _analysisData == NULL ) return false;\r\n    \r\n    FILE* fp = NULL;\r\n    char header[10];\r\n    MP3FrameHeader frameHeader;\r\n    sFrameHeaderInfo headerInfo;\r\n    sFrameHeaderAverageInfo headerAverageInfo;\r\n    int nSize = 0;\r\n    s64 totalFileSize = 0;   // mp3のファイル全体サイズ\r\n    int mp3DataSize = 0;     // mp3の音声データのサイズ\r\n    int skipOffset = 0;      //\r\n    \r\n    // サウンドファイルをオープン\r\n    fp = fopen( _path, \"rb\" );\r\n    if( !fp ) return false;\r\n    \r\n\tCDecryptBaseClass decryptor;\r\n\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\tif (pltf.useEncryption()) {\r\n\t\tu8 hdr[4];\r\n\t\thdr[0] = 0;\r\n\t\thdr[1] = 0;\r\n\t\thdr[2] = 0;\r\n\t\thdr[3] = 0;\r\n\t\tfread(hdr, 1,4,fp);\r\n\t\tdecryptor.decryptSetup((const u8*)_path, hdr);\r\n\t}\r\n\r\n    // ファイル全体のサイズを取得\r\n    fseek( fp, 0, SEEK_END );\r\n    fgetpos( fp, (fpos_t*)&totalFileSize );\r\n\r\n\tif (decryptor.m_useNew) {\r\n\t\ttotalFileSize -= 4;\r\n\t    fseek( fp, 4, SEEK_SET );\r\n\t} else {\r\n\t    fseek( fp, 0, SEEK_SET );\r\n\t}\r\n\r\n    // フレームヘッダのを検索します\r\n    nSize = fread( header, 1, sizeof(header), fp );\r\n    if( nSize < sizeof(header) )\r\n    {\r\n        fclose( fp );\r\n        return false;\r\n    }\r\n\r\n\tdecryptor.decryptBlck(header, nSize);\r\n\r\n    // フレームヘッダかどうかチェック\r\n    if( CheckFrameHeader((MP3FrameHeader*)header, &headerInfo) )\r\n    {\r\n        // ID3v1\r\n\t\tdecryptor.gotoOffset((u32)(totalFileSize - 128));\r\n        fseek( fp, (long)((totalFileSize - 128) + (decryptor.m_useNew ? 4 : 0)), SEEK_SET );\r\n        nSize = fread( header, 1, sizeof(header), fp );\r\n        if( nSize < sizeof(header) )\r\n        {\r\n            fclose( fp );\r\n            return false;\r\n        }\r\n        \r\n\t\tdecryptor.decryptBlck(header, nSize);\r\n\r\n        skipOffset = 0;\r\n        if( !memcmp(header, \"ID3\", 3) ) {\r\n            mp3DataSize = (int)totalFileSize - 128; // 128はID3タグサイズ(固定)\r\n        } else {\r\n            mp3DataSize = (int)totalFileSize; // ID3タグが無いのでファイルサイズがデータサイズ\r\n        }\r\n        \r\n\t\tdecryptor.gotoOffset(skipOffset);\r\n        fseek( fp, skipOffset + (decryptor.m_useNew ? 4 : 0), SEEK_SET );\r\n        nSize = fread( &frameHeader, 1, sizeof(frameHeader), fp );\r\n\r\n\t\tdecryptor.decryptBlck(&frameHeader, nSize);\r\n\r\n        if( nSize < sizeof(frameHeader) )\r\n        {\r\n            fclose( fp );\r\n            return false;\r\n        }\r\n    }\r\n    else if( !memcmp(header, \"ID3\", 3) )\r\n    {\r\n        // ID3v2\r\n        // ID3v2タグサイズ計算\r\n        u32 tagSize = ((header[6]&0x7F)<<21) |\r\n                      ((header[7]&0x7F)<<14) |\r\n                      ((header[8]&0x7F)<<7) |\r\n                      ((header[9]&0x7F));\r\n        // 読み飛ばし位置,mp3データサイズ計算\r\n        skipOffset  = tagSize + 10;\r\n        mp3DataSize = (int)(totalFileSize - skipOffset);\r\n        \r\n        // フレームヘッダ読み込み\r\n\t\tdecryptor.gotoOffset(skipOffset);\r\n        fseek( fp, skipOffset + (decryptor.m_useNew ? 4 : 0), SEEK_SET );\r\n        nSize = fread( &frameHeader, 1, sizeof(frameHeader), fp );\r\n        if( nSize < sizeof(frameHeader) )\r\n        {\r\n            fclose( fp );\r\n            return false;\r\n        }\r\n\t\tdecryptor.decryptBlck(&frameHeader, nSize);\r\n\t\tif( CheckFrameHeader(&frameHeader, &headerInfo) == false )\r\n        {\r\n            fclose( fp );\r\n            return false;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        // フレームヘッダでもID3タグでもなかった場合はreturn\r\n        fclose( fp );\r\n        return false;\r\n    }\r\n    \r\n    // フレームヘッダの平均情報を取得\r\n    if( AverageFrameHeader(decryptor, fp, skipOffset, &headerAverageInfo) == false )\r\n    {\r\n        fclose( fp );\r\n        return false;\r\n    }\r\n    \r\n    // 必要な情報が集まったらsSoundAnalysisDataに代入\r\n    // ここから先return falseしちゃダメ！\r\n    {\r\n        // TODO.\r\n        // 本来可変ビットレートを考え対応しなければならない。\r\n        \r\n        //------------------------\r\n        // 各種データを代入\r\n        _analysisData->m_bitRateType    = headerAverageInfo.m_bitRateType;\r\n        \r\n        _analysisData->m_bitRate        = headerAverageInfo.m_bitRateAverage;\r\n        _analysisData->m_samplingRate   = headerInfo.m_samplerate;\r\n        \r\n        // 再生フレーム数を計算\r\n        _analysisData->m_totalFrame     = headerAverageInfo.m_frameCnt;\r\n        \r\n        // 演奏時間を計算\r\n        _analysisData->m_totalTime      = headerAverageInfo.m_dataSize / (headerAverageInfo.m_bitRateAverage / 8);\r\n    }\r\n    \r\n    // すべて終わったのでサウンドファイルをクローズ\r\n    fclose( fp );\r\n    return true;\r\n}\r\n\r\n//===========================\r\n//  ローカル関数\r\n//===========================\r\n/*\r\n @brief     フレームヘッダかどうかのチェック\r\n @param[in]     MP3FrameHeader* _header     チェック対象のフレームヘッダー\r\n @param[out]    sFrameHeaderInfo* _pInfo    フレームヘッダ情報保存先(NULLの場合はスルー)\r\n @return        bool    true:フレームヘッダである, false:フレームヘッダでない\r\n */\r\nbool CheckFrameHeader(const MP3FrameHeader* _header, sFrameHeaderInfo* _pInfo)\r\n{\r\n    if( _header == NULL ) return false;\r\n    \r\n    // 先頭から11ビットは常に1であるはずのなのでそうでないならreturn\r\n    if( (_header->mHeader[0] & 0xFF) != 0xFF ) return false;\r\n    if( (_header->mHeader[1] & 0xE0) != 0xE0 ) return false;\r\n    \r\n    // MPEGのバージョンチェック(1の場合は予約idなのでreturn)\r\n    if( _header->h.id == 1 ) return false;\r\n    \r\n    // レイヤーチェック(0の場合は予約idなのでreturn)\r\n    if( _header->h.layer == 0 ) return false;\r\n    \r\n    // ビットレートチェック(0以下と15以上だと割当がないのでreturn)\r\n    if( _header->h.bitrate < 0 && _header->h.bitrate >= 15 ) return false;\r\n    \r\n    // サンプリングレートチェック(3の場合は予約idなのでreturn)\r\n    if( _header->h.sampling == 3 ) return false;\r\n    \r\n    // フレームヘッダ情報を保存\r\n    if( _pInfo )\r\n    {\r\n        int version = eMPEG_VER_NONE;\r\n        int bitrate = 0;\r\n        int samplingrate = 0;\r\n        int framesize = 0;\r\n        int layer = _header->h.layer - 1;\r\n        int bit = _header->h.bitrate - 1;\r\n        int sampling = _header->h.sampling;\r\n        switch( _header->h.id )\r\n        {\r\n            case 0: // MPEG2.5\r\n                version = eMPEG_VER_2_5;\r\n                bitrate = s_MPEG2_5_BitRateTbl[0][bit];\r\n                samplingrate = s_SamplingTbl[2][sampling];\r\n                framesize = (s_SamplePerFrame[layer][2] / 8 * bitrate * 1000) / samplingrate + _header->h.padding;\r\n                break;\r\n            case 2: // MPEG2\r\n                version = eMPEG_VER_2;\r\n                bitrate = s_MPEG2_BitRateTbl[layer][bit];\r\n                samplingrate = s_SamplingTbl[1][sampling];\r\n                framesize = (s_SamplePerFrame[layer][1] / 8 * bitrate * 1000) / samplingrate + _header->h.padding;\r\n                break;\r\n            case 3: // MPEG1\r\n                version = eMPEG_VER_1;\r\n                bitrate = s_MPEG1_BitRateTbl[layer][bit];\r\n                samplingrate = s_SamplingTbl[0][sampling];\r\n                framesize = (s_SamplePerFrame[layer][0] / 8 * bitrate * 1000) / samplingrate + _header->h.padding;\r\n                break;\r\n        }\r\n        \r\n        _pInfo->m_version       = version;\r\n        _pInfo->m_layer         = 3 - layer;\r\n        _pInfo->m_bitrate       = bitrate;\r\n        _pInfo->m_samplerate    = samplingrate;\r\n        _pInfo->m_padding       = _header->h.padding;\r\n        _pInfo->m_channel       = _header->h.channel;\r\n        _pInfo->m_framesize     = framesize;\r\n    }\r\n    \r\n    return true;\r\n}\r\n\r\n/*\r\n @brief     フレームヘッダの平均を計算\r\n @param[in]     FILE* _fp   対象のファイルポインタ\r\n @param[in]     s32 _skip   データ先頭へのシークサイズ\r\n @param[out]    sFrameHeaderAverageInfo* _pInfo    フレームヘッダ平均情報保存先(NULLの場合はスルー)\r\n @return        bool    true:フレームヘッダである, false:フレームヘッダでない\r\n */\r\nbool AverageFrameHeader(CDecryptBaseClass& decryptor, FILE* _fp, s32 _skip, sFrameHeaderAverageInfo* _pInfo)\r\n{\r\n    s32 frameCnt = 0;\r\n    s32 ofs = _skip;\r\n    MP3FrameHeader frameHeader;\r\n    sFrameHeaderInfo headerInfo;\r\n    s32 nSize = 0;\r\n    \r\n    eBITRATE_TYPE bitRateType = eBITRATE_TYPE_CBR;    // ビットレートタイプ(とりあえずCBRを初期値)\r\n    s16 bitRate = -1;\r\n    float totalBitRate = 0.0f;  // ビットレートのトータル\r\n    s64 totalDataSize = 0;      // 音声データ部分のトータルサイズ\r\n    \r\n    // Xingヘッダー用変数\r\n    s16 xingFrameCnt = 0;\r\n    s64 xingDataSize = 0;\r\n    // s16 xingQuality = 0;\r\n    \r\n    if( _fp == NULL || _skip < 0 ) {\r\n        return false;\r\n    }\r\n    \r\n    bool bFind = false;\r\n    // bool bXingCheck = false;\r\n    ofs = _skip;\r\n    while( 1 )\r\n    {\r\n        // 読み飛ばし位置に移動してから４byte読み込み\r\n\t\tdecryptor.gotoOffset(ofs);\r\n        fseek( _fp, ofs + (decryptor.m_useNew ? 4 : 0), SEEK_SET );\r\n        nSize = fread( &frameHeader, 1, sizeof(frameHeader), _fp );\r\n        decryptor.decryptBlck(&frameHeader, nSize);\r\n\r\n        // 読み込みサイズが４byte以下の場合はファイル終端に到達したので抜ける\r\n        if( nSize < 4 ) {\r\n            break;\r\n        }\r\n        \r\n        // フレームヘッダのチェック\r\n        if( CheckFrameHeader(&frameHeader, &headerInfo) )\r\n        {\r\n            if( bFind == false ) {\r\n                bFind = true;\r\n            }\r\n/*\r\n            // TODO. Xingヘッダ対応\r\n            // Xingヘッダーを検索\r\n            if( (bitRateType == eBITRATE_TYPE_CBR) && (bXingCheck == false) )\r\n            {\r\n                bXingCheck = true;\r\n                char header[4];\r\n                s32 xingOfs = 0;\r\n                if( frameHeader.h.id == 3 )\r\n                {\r\n                    // MPEG1の場合\r\n                    xingOfs = (frameHeader.h.channel == 1) ? (17) : (32);\r\n                }\r\n                else\r\n                {\r\n                    // MPEG2, MPEG2.5\r\n                    xingOfs = (frameHeader.h.channel == 1) ? (9) : (17);\r\n                }\r\n                \r\n                fseek( _fp, ofs + xingOfs + sizeof(frameHeader), SEEK_SET );\r\n                nSize = fread( header, 1, sizeof(header), _fp );\r\n\t\t\t\tdecryptor.decryptBlck(header, nSize);\r\n\t\t\t\tif( nSize == sizeof(header) )\r\n                {\r\n                    if( memcmp(header, \"Xing\", sizeof(header)) == 0 ||\r\n                        memcmp(header, \"Info\", sizeof(header)) == 0 )\r\n                    {\r\n                        bitRateType = eBITRATE_TYPE_VBR;\r\n                    }\r\n                }\r\n            }\r\n */\r\n            \r\n            // ビットレートの可変チェック\r\n            if( bitRate < 0 )\r\n            {\r\n                // 最初のフレームはただ保存\r\n                bitRate = headerInfo.m_bitrate;\r\n            }\r\n            else\r\n            {\r\n                // 現在のビットレートタイプがCBRで、\r\n                // なおかつ最初のフレームのビットレートと違う場合は平均ビットレートタイプ\r\n                if( (bitRateType == eBITRATE_TYPE_CBR) && (bitRate != headerInfo.m_bitrate) )\r\n                {\r\n                    bitRateType = eBITRATE_TYPE_ABR;\r\n                }\r\n            }\r\n            \r\n            totalBitRate    += headerInfo.m_bitrate;\r\n            totalDataSize   += headerInfo.m_framesize;\r\n            ofs             += headerInfo.m_framesize;\r\n            \r\n            frameCnt++;\r\n        }\r\n        else\r\n        {\r\n            // 見つからない場合はファイルポインタを１つ進めもう一度\r\n            ofs++;\r\n        }\r\n    }\r\n    \r\n    // フレームヘッダが見つかっらなかったら\r\n    if( bFind == false ) {\r\n        return false;\r\n    }\r\n    \r\n    // 平均情報を保存\r\n    if( _pInfo )\r\n    {\r\n        _pInfo->m_bitRateType       = bitRateType;\r\n        _pInfo->m_bitRateAverage    = (s16)(totalBitRate/(float)frameCnt);\r\n        _pInfo->m_dataSize          = (xingDataSize) ? (xingDataSize) : (totalDataSize);\r\n        _pInfo->m_frameCnt          = (xingFrameCnt) ? (xingFrameCnt) : (frameCnt);\r\n    }\r\n    \r\n    // 正常終了\r\n    return true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/Sound/CSoundAnalysisMP3.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n @file      CSoundAnalysisMP3.h\r\n @brief     MP3形式のサウンドファイルの解析など\r\n */\r\n\r\n#ifndef __SOUND_ANALYSIS_MP3_H__\r\n#define __SOUND_ANALYSIS_MP3_H__\r\n\r\n#include \"CSoundAnalysis.h\"\r\n\r\n/*\r\n @brief  mp3形式のサウンドファイル解析\r\n @param[in] const char* _path                   サウンドファイルのパス\r\n @param[in] sSoundAnalysisData* _analysisData   サウンドファイルの解析結果渡す用\r\n @return    bool    true:解析完了, false:解析失敗\r\n */\r\nbool SoundAnalysis_MP3( const char* _path, sSoundAnalysisData* _analysisData );\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBDebugMenu.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBDebugMenu.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n#define CAPTION_X\t32\r\n#define VALUE_X\t\t300\r\n\r\n#define EXIT_MARGINE 40\r\n#define CAP_MARGINE 32\r\n#define LINE_STEP 50\r\n;\r\nconst char * CKLBDebugResource::ms_labelSwitch[] = { \"OFF\", \"ON\" };\r\n\r\nCKLBDebugSign::CKLBDebugSign() : m_pMenu(NULL) {}\r\nCKLBDebugSign::~CKLBDebugSign() {}\r\n\r\nCKLBDebugSign *\r\nCKLBDebugSign::create(CKLBDebugMenu * pMenu)\r\n{\r\n\tif(!pMenu) return NULL;\r\n\r\n\tCKLBDebugSign * pTask = KLBNEW(CKLBDebugSign);\r\n\tif(!pTask) return NULL;\r\n\r\n\tif(!pTask->init(pMenu)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBDebugSign::init(CKLBDebugMenu * pMenu)\r\n{\r\n\tm_cmdStep = 0;\r\n\tm_cmdID = -1;\r\n\tm_pMenu = pMenu;\r\n\r\n\t// 画面サイズを取得\r\n\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\tm_width = res.width();\r\n\tm_height = res.height();\r\n#ifdef DEBUG_MENU\r\n\treturn regist(pMenu, P_DBGSIGN);\r\n#else\r\n\treturn regist(pMenu, P_UIPREV);\t// 使われないがビルドエラーを出さないため\r\n#endif\r\n}\r\n\r\nvoid\r\nCKLBDebugSign::execute(u32 /* deltaT */)\r\n{\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\ttpq.startItem();\r\n\r\n\tconst PAD_ITEM * item;\r\n\tbool bCommand = false;\r\n\r\n\twhile(NULL != (item = tpq.getItem())) {\r\n\t\tswitch(item->type)\r\n\t\t{\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\t{\r\n\t\t\t\t// 既にコマンド入力が別の指で始まっている。\r\n\t\t\t\tif(m_cmdStep > 0) break;\r\n\t\t\t\tif(checkPoint(item->x, item->y) != 1) {\r\n\t\t\t\t\tm_cmdStep = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tm_cmdStep = 1;\r\n\t\t\t\tm_cmdID = item->id;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t{\r\n\t\t\t\t// コマンド解釈とは別の指。\r\n\t\t\t\tif(m_cmdStep == 0 || m_cmdID != item->id) break;\r\n\r\n\t\t\t\tint check = checkPoint(item->x, item->y);\r\n\t\t\t\tif(check == m_cmdStep + 1) m_cmdStep = check;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t{\r\n\t\t\t\tif(m_cmdStep != 4 || m_cmdID != item->id) {\r\n\t\t\t\t\tm_cmdStep = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t// ここに来る前に 4つのチェック条件を満たしている。\r\n\t\t\t\t// その上でチェック条件1の位置に戻ってきていたらコマンドが成立。\r\n\t\t\t\tint check = checkPoint(item->x, item->y);\r\n\t\t\t\tif(check == 1) {\r\n\t\t\t\t\tbCommand = true;\r\n\t\t\t\t\tm_cmdStep = 0;\r\n\t\t\t\t\tm_cmdID = -1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// コマンドが成立していたら、デバッグメニュータスクのモードを切り替える\r\n\tif(bCommand) m_pMenu->menu_switch(true);\r\n}\r\n\r\nvoid\r\nCKLBDebugSign::die()\r\n{\r\n}\r\n\r\nint\r\nCKLBDebugSign::checkPoint(int x, int y)\r\n{\r\n\tstatic int check[4] = { 1, 3, 4, 2 };\r\n\tint idx = (x <m_width / 2) ? 0 : 1;\r\n\tidx += (y < m_height / 2) ? 0 : 2;\r\n\treturn check[idx];\r\n}\r\n\r\n\r\n\r\nCKLBDebugMenu::CKLBDebugMenu() : CKLBTask(), m_state(E_WAIT){}\r\nCKLBDebugMenu::~CKLBDebugMenu() {}\r\n\r\nCKLBDebugMenu *\r\nCKLBDebugMenu::create()\r\n{\r\n\tCKLBDebugMenu * pTask = KLBNEW(CKLBDebugMenu);\r\n\tif(!pTask) return NULL;\r\n\r\n\tif(!pTask->init()) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\n// See dirty hack below !\r\nstatic int gInitCount = 0;\r\n\r\nbool\r\nCKLBDebugMenu::init()\r\n{\r\n\t// 表示物初期化\r\n    //\r\n    // Dirty Hack here :\r\n    // ---------------------------------\r\n\t// Now done before in CKLBGameApplication during boot.\r\n    // This was a necessary change to allow creation of debug menu\r\n    // AFTER font could be loaded with LUA.\r\n    // 1. Font loaded in LUA\r\n    // 2. Create debug menu in the same boot script.\r\n    // 3. Create Task does not destroy the menu we just created.\r\n    //    But need to destroy the next time we recreate the task.\r\n    // => Just a counter for the FIRST time during boot.\r\n    //\r\n\tif ((gInitCount++) != 0) {\r\n\t\tCKLBDebugResource& res = CKLBDebugResource::getInstance();\r\n\t\tres.init();\r\n\t}\r\n\r\n\t// 実行リスト登録\r\n#ifdef DEBUG_MENU\r\n\tregist(NULL, P_DBGMENU);\r\n#else\r\n\tregist(NULL, P_MENU);\r\n#endif\r\n\t// 操作監視タスクを起動し、子タスクとして登録する\r\n\tCKLBTask * pChild = CKLBDebugSign::create(this);\r\n\tif(!pChild) {\r\n\t\tkill();\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBDebugMenu::execute(u32 deltaT)\r\n{\r\n\tif(m_state == E_ACTIVE) execute_active(deltaT);\r\n}\r\n\r\nvoid\r\nCKLBDebugMenu::die()\r\n{\r\n\tCKLBDebugResource& res = CKLBDebugResource::getInstance();\r\n\tres.release();\r\n}\r\n\r\nvoid\r\nCKLBDebugMenu::menu_switch(bool bSwitch)\r\n{\r\n#ifdef DEBUG_MENU\r\n\tCKLBTaskMgr::getInstance().setDbgPause(bSwitch);\r\n#else\r\n\tCKLBTaskMgr::getInstance().setPause(bSwitch);\r\n#endif\r\n\tm_state = (bSwitch) ? E_ACTIVE : E_WAIT;\r\n\tm_step = 0;\r\n}\r\n\r\nvoid\r\nCKLBDebugMenu::execute_active(u32 /*deltaT*/)\r\n{\r\n\tenum {\r\n\t\tE_BEGIN = 0,\r\n\t\tE_LOOP\r\n\t};\r\n\tCKLBDebugResource& dbg = CKLBDebugResource::getInstance();\r\n\r\n\tswitch(m_step)\r\n\t{\r\n\tcase E_BEGIN:\r\n\t\t{\r\n\t\t\tdbg.dispEnable(true);\r\n\t\t\tm_dispY = dbg.setScroll(0);\r\n\t\t\tfor(int i = 0; i < 5; i++) m_pad[i].enable = false;\r\n\t\t\tm_step = E_LOOP;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase E_LOOP:\r\n\t\t{\r\n\t\t\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\t\t\tconst PAD_ITEM * item;\r\n\t\t\ttpq.startItem();\r\n\t\t\twhile(NULL != (item = tpq.getItem())) {\r\n\t\t\t\tswitch(item->type)\r\n\t\t\t\t{\r\n\t\t\t\tcase PAD_ITEM::TAP:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tm_pad[item->id].enable = true;\r\n\t\t\t\t\t\tm_pad[item->id].x = item->x;\r\n\t\t\t\t\t\tm_pad[item->id].y = item->y;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(!m_pad[item->id].enable) break;\r\n\t\t\t\t\t\tint mv_y = m_pad[item->id].y - item->y;\r\n\t\t\t\t\t\tint mv_x = m_pad[item->id].x - item->x;\r\n\r\n\t\t\t\t\t\tif(abs(mv_x) > abs(mv_y)) {\r\n\t\t\t\t\t\t\t// 操作方向でx成分の絶対値が大きいため、横方向の輝度操作と見做す\r\n\t\t\t\t\t\t\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\t\t\t\t\t\t\tint width = res.width();\r\n\t\t\t\t\t\t\tfloat bright = (float)item->x / width;\r\n\t\t\t\t\t\t\tdbg.setBright(bright);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tdbg.setScroll(m_dispY + mv_y);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PAD_ITEM::RELEASE:\r\n\t\t\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(!m_pad[item->id].enable) break;\r\n\t\t\t\t\t\tint mv_y = m_pad[item->id].y - item->y;\r\n\t\t\t\t\t\tint mv_x = m_pad[item->id].x - item->x;\r\n\r\n\t\t\t\t\t\tif(abs(mv_x) > abs(mv_y)) {\r\n\t\t\t\t\t\t\t// 操作方向でx成分の絶対値が大きいため、横方向の輝度操作と見做す\r\n\t\t\t\t\t\t\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\t\t\t\t\t\t\tint width = res.width();\r\n\t\t\t\t\t\t\tfloat bright = (float)item->x / width;\r\n\t\t\t\t\t\t\tdbg.setBright(bright);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tm_dispY += mv_y;\r\n\t\t\t\t\t\tm_dispY = dbg.setScroll(m_dispY);\r\n\r\n\t\t\t\t\t\tbool bResult = dbg.tapItem(item->x, item->y);\r\n\t\t\t\t\t\tif(!bResult) {\r\n\t\t\t\t\t\t\t// [ EXIT ] が押されたので、デバッグメニューを終了する\r\n\t\t\t\t\t\t\tdbg.dispEnable(false);\r\n\r\n\t\t\t\t\t\t\tdbg.finishReport();\r\n\r\n\t\t\t\t\t\t\tmenu_switch(false);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\n\r\nCKLBDebugResource::CKLBDebugResource() : m_begin(NULL), m_end(NULL), m_pNode(NULL), m_order(500000), m_callback(NULL) {\r\n\tm_format = TexturePacker::getCurrentModeTexture();\r\n}\r\n\r\nCKLBDebugResource::~CKLBDebugResource()\r\n{\r\n\trelease();\r\n}\r\n\r\nCKLBDebugResource&\r\nCKLBDebugResource::getInstance()\r\n{\r\n\tstatic CKLBDebugResource instance;\r\n\treturn instance;\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::release()\r\n{\r\n\tGROUP * pItem = m_begin;\r\n\twhile(pItem) {\r\n\t\tGROUP * pNext = pItem->next;\r\n\r\n\t\tSWITCH * sw = pItem->menu;\r\n\t\tfor(int i = 0; i < pItem->cnt; i++) {\r\n\t\t\tKLBDELETEA(sw[i].key);\r\n\t\t\tif(sw[i].mode == DBG_MENU::M_SELECT) {\r\n\t\t\t\tfor(int j = 0; j <= sw[i].max; j++) {\r\n\t\t\t\t\tKLBDELETEA(sw[i].disp[j]);\r\n\t\t\t\t}\r\n\t\t\t\tKLBDELETEA(sw[i].disp);\r\n\t\t\t}\r\n\t\t}\r\n\t\tKLBDELETEA(pItem->menu);\r\n\t\tKLBDELETEA(pItem->key);\r\n\t\tKLBDELETE(pItem);\r\n\r\n\t\tpItem = pNext;\r\n\t}\r\n\tm_begin = NULL;\r\n\tm_end = NULL;\r\n\tm_lastY = 0;\r\n\tm_dispY = 0;\r\n\tKLBDELETE(m_pNode);\r\n\tm_pNode = NULL;\r\n\tKLBDELETEA(m_callback);\r\n\tm_callback = NULL;\r\n}\r\n\r\n\r\nvoid\r\nCKLBDebugResource::init()\r\n{\r\n\trelease();\r\n\r\n\t// 画面サイズを取得\r\n\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\tm_scrnHeight = res.height();\r\n\r\n\tif(m_pNode) KLBDELETE(m_pNode);\r\n\tm_pNode = KLBNEW(CKLBNode);\r\n\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\tdraw.getRoot()->addNode(m_pNode);\r\n\tm_pNode->setTranslate(0, 0);\r\n\tm_pNode->setVisible(false);\r\n\r\n\tCKLBNode * pNode = KLBNEW(CKLBNode);\r\n\tm_pNode->addNode(pNode);\r\n\tpNode->setTranslate(0, 0);\r\n\tCKLBNodeVirtualDocument * pVDoc = createLabelItem(\"[ EXIT ]\", &m_exitWidth, &m_exitHeight);\r\n\tpNode->addNode(pVDoc);\r\n\tpVDoc->setTranslate(0, 0);\r\n\tm_lastY += EXIT_MARGINE;\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::clear()\r\n{\r\n\tinit();\r\n}\r\n\r\nCKLBNodeVirtualDocument *\r\nCKLBDebugResource::createLabelItem(const char * label, int * width, int * height)\r\n{\r\n\tIPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\tSTextInfo txinfo;\r\n\tvoid * pFont = platform.getFont(DBG_FONTSIZE, DBG_FONTNAME);\r\n\tplatform.getTextInfo(label, pFont, &txinfo);\r\n\r\n\t*width = txinfo.width;\r\n\t*height = txinfo.height;\r\n\r\n\tCKLBNodeVirtualDocument * pVDoc = KLBNEW(CKLBNodeVirtualDocument);\r\n\tpVDoc->createDocument(1,m_format);\r\n\tpVDoc->setDocumentSize(txinfo.width, txinfo.height);\r\n\tpVDoc->setViewPortSize(txinfo.width, txinfo.height, 0.0f, 0.0f, m_order, false);\r\n\r\n\tpVDoc->setFont(0, DBG_FONTNAME, DBG_FONTSIZE);\t// 指定フォントをindex=0に指定\r\n\tpVDoc->clear(0);\r\n\r\n\tpVDoc->lockDocument();\r\n\tpVDoc->drawText(0, txinfo.top, (char *)label, 0xffffffff, 0);\r\n\tpVDoc->unlockDocument();\r\n\r\n\tpVDoc->setViewPortPos(0, 0);\t// ViewPort とDocumentのサイズが同じで、かつ表示位置を(0,0)で固定\r\n\tpVDoc->markUpMatrix();\r\n\tpVDoc->setTranslate(0, 0);\r\n\r\n\t// Moved to improve font cache.\r\n\tplatform.deleteFont(pFont);\r\n\treturn pVDoc;\r\n}\r\n\r\nCKLBNode *\r\nCKLBDebugResource::addLabel(int x, int y, const char * label, int * width, int * height)\r\n{\r\n\tCKLBNodeVirtualDocument * pVDoc = createLabelItem(label, width, height);\r\n\tCKLBNode * pNode = KLBNEW(CKLBNode);\r\n\tpNode->addNode(pVDoc);\r\n\tm_pNode->addNode(pNode);\r\n\r\n\tpVDoc->setTranslate(0, 0);\r\n\tpNode->setTranslate(x, y);\r\n\treturn pNode;\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::addDebugItem(const char * caption, const char * key, DBG_MENU * pItem)\r\n{\r\n\tGROUP * pGrp = KLBNEW(GROUP);\r\n\r\n\tpGrp->prev = m_end;\r\n\tpGrp->next = NULL;\r\n\tif(pGrp->prev) {\r\n\t\tpGrp->prev->next = pGrp;\r\n\t} else {\r\n\t\tm_begin = pGrp;\r\n\t}\r\n\tm_end = pGrp;\r\n\r\n\t// グループキャプションの追加\r\n\tm_lastY += CAP_MARGINE;\r\n\tint width, height;\r\n\tpGrp->node = addLabel(0, m_lastY, caption, &width, &height);\r\n\tm_lastY += CAP_MARGINE;\r\n\r\n\tpGrp->key = CKLBUtility::copyString(key);\r\n\r\n\t// アイテム数のカウント\r\n\tpGrp->cnt = 0;\r\n\tfor(int i = 0; pItem[i].caption; i++) pGrp->cnt++;\r\n\r\n\t// アイテム数と同じだけ、スイッチ配列を作る\r\n\tSWITCH * arrSwitch = KLBNEWA(SWITCH, pGrp->cnt);\r\n\r\n\t// アイテムリストに従い、スイッチ配列を初期化する\r\n\tfor(int i = 0; pItem[i].caption; i++) {\r\n\t\t// アイテム項目の追加\r\n\t\tint width, height;\r\n\t\tCKLBNode * label = addLabel(CAPTION_X, m_lastY, pItem[i].caption, &width, &height);\r\n\r\n\t\t// モードを保存\r\n\t\tarrSwitch[i].label = label;\r\n\t\tarrSwitch[i].mode = pItem[i].mode;\r\n\t\tarrSwitch[i].val  = pItem[i].value;\r\n\t\tarrSwitch[i].pNode = KLBNEW(CKLBNode);\r\n\r\n\t\tm_pNode->addNode(arrSwitch[i].pNode);\r\n\r\n\t\tarrSwitch[i].key = CKLBUtility::copyString(pItem[i].key);\r\n\t\tarrSwitch[i].pNode->setTranslate(VALUE_X, m_lastY);\r\n\t\tarrSwitch[i].rect.x = VALUE_X;\r\n\t\tarrSwitch[i].rect.y = m_lastY;\r\n\r\n\t\t// モードに従い、スイッチ配列の値を初期化する\r\n\t\tswitch(pItem[i].mode)\r\n\t\t{\r\n\t\tcase DBG_MENU::M_SWITCH:\t// ON/OFFのスイッチ\r\n\t\t\t{\r\n\t\t\t\tarrSwitch[i].min = 0;\r\n\t\t\t\tarrSwitch[i].max = 1;\r\n\t\t\t\tarrSwitch[i].disp = ms_labelSwitch;\r\n\t\t\t\tint idx = arrSwitch[i].val;\r\n\t\t\t\tconst char * label = arrSwitch[i].disp[idx];\r\n\t\t\t\tint width, height;\r\n\t\t\t\tarrSwitch[i].obj.pVDoc = createLabelItem(label, &width, &height);\r\n\t\t\t\tarrSwitch[i].pNode->addNode(arrSwitch[i].obj.pVDoc);\r\n\t\t\t\tarrSwitch[i].rect.w = width;\r\n\t\t\t\tarrSwitch[i].rect.h = height;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DBG_MENU::M_SELECT:\t// 選択項目\r\n\t\t\t{\r\n\t\t\t\tarrSwitch[i].min = 0;\r\n\t\t\t\tarrSwitch[i].max = pItem[i].max;\t// 項目数\r\n\t\t\t\tconst char ** disp = KLBNEWA(const char *, pItem[i].max + 1);\r\n\t\t\t\tfor(int n = 0; n <= arrSwitch[i].max; n++) {\r\n\t\t\t\t\tdisp[n] = CKLBUtility::copyString(pItem[i].items[n]);\r\n\t\t\t\t}\r\n\t\t\t\tarrSwitch[i].disp = disp;\r\n\t\t\t\tint idx = arrSwitch[i].val;\r\n\t\t\t\tconst char * label = arrSwitch[i].disp[idx];\r\n\t\t\t\tint width, height;\r\n\t\t\t\tarrSwitch[i].obj.pVDoc = createLabelItem(label, &width, &height);\r\n\t\t\t\tarrSwitch[i].pNode->addNode(arrSwitch[i].obj.pVDoc);\r\n\t\t\t\tarrSwitch[i].rect.w = width;\r\n\t\t\t\tarrSwitch[i].rect.h = height;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DBG_MENU::M_NUMBER:\t// 数値\r\n\t\t\t{\r\n\t\t\t\tarrSwitch[i].min = pItem[i].min;\r\n\t\t\t\tarrSwitch[i].max = pItem[i].max;\r\n\t\t\t\tarrSwitch[i].obj.pText = 0;\r\n\t\t\t\tarrSwitch[i].rect.w = DBG_FONTSIZE * 4;\r\n\t\t\t\tarrSwitch[i].rect.h = DBG_FONTSIZE + 8;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tm_lastY += LINE_STEP;\r\n\t}\r\n\tpGrp->menu = arrSwitch;\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::dispEnable(bool enable)\r\n{\r\n\tm_pNode->setVisible(enable);\r\n\r\n\tm_dispY = 0;\t// 位置を 0 にリセットする\r\n\tm_pNode->setTranslate(0, m_dispY);\r\n\r\n\tGROUP * pGrp = m_begin;\r\n\twhile(pGrp) {\r\n\t\tfor(int i = 0; i < pGrp->cnt; i++) {\r\n\t\t\tSWITCH * sw = pGrp->menu + i;\r\n\r\n\t\t\tif(sw->mode != DBG_MENU::M_NUMBER) continue;\r\n\t\t\tif(enable) {\r\n\t\t\t\tCKLBUITextBox * pText = KLBNEWC(CKLBUITextBox, (false));\r\n\t\t\t\tsw->obj.pText = pText;\r\n\t\t\t\tsw->pNode->addNode(pText);\r\n\t\t\t\tpText->setWidth(sw->rect.w);\r\n\t\t\t\tpText->setHeight(sw->rect.h);\r\n\t\t\t\tchar buf[11];\r\n\t\t\t\tsprintf(buf, \"%d\", sw->val);\r\n\t\t\t\tpText->setText(buf);\r\n\t\t\t\tpText->setTranslate(0, 0);\r\n\t\t\t} else {\r\n\t\t\t\tif(sw->obj.pText) {\r\n\t\t\t\t\tCKLBUITextBox * pText = sw->obj.pText;\r\n\t\t\t\t\tconst char * str = pText->getText();\r\n\t\t\t\t\t// 数列ならば数値に変換し、新たな値にする\r\n\t\t\t\t\tbool result = true;\r\n\t\t\t\t\tfor(const char * p = str; *p; p++) {\r\n\t\t\t\t\t\tif((*p < '0' || *p > '9') && (*p != '-')) {\r\n\t\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(result) {\r\n\t\t\t\t\t\tint val = atoi(str);\r\n\t\t\t\t\t\tif(val < sw->min) val = sw->min;\r\n\t\t\t\t\t\tif(val > sw->max) val = sw->max;\r\n\t\t\t\t\t\tsw->val = val;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tKLBDELETE(pText);\r\n\t\t\t\t\tsw->obj.pText = NULL;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpGrp = pGrp->next;\r\n\t}\r\n\r\n\r\n}\r\n\r\nbool\r\nCKLBDebugResource::tapItem(int x, int y)\r\n{\r\n\tint vx, vy;\r\n\ty -= m_dispY;\r\n\tvx = x;\r\n\tvy = y;\r\n\r\n\t// [ EXIT ] が押されたら、falseを返す\r\n\tif(vx >= 0 && vy >= 0 && vx < m_exitWidth && vy < m_exitHeight) {\r\n\t\treturn false;\r\n\t}\r\n\tfor(GROUP * pGrp = m_begin; pGrp; pGrp = pGrp->next) {\r\n\t\tfor(int i = 0; i < pGrp->cnt; i++) {\r\n\t\t\tSWITCH * sw = pGrp->menu + i;\r\n\t\t\tvx = x - sw->rect.x;\r\n\t\t\tvy = y - sw->rect.y;\r\n\t\t\tif(vx >= 0 && vy >= 0 && vx < sw->rect.w && vy < sw->rect.h) {\r\n\t\t\t\t// 項目にヒット\r\n\t\t\t\tswitch(sw->mode)\r\n\t\t\t\t{\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DBG_MENU::M_SWITCH:\r\n\t\t\t\tcase DBG_MENU::M_SELECT:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint val = sw->val + 1;\r\n\t\t\t\t\t\tif(val > sw->max) val = sw->min;\r\n\t\t\t\t\t\tsw->val = val;\r\n\t\t\t\t\t\tconst char * label = sw->disp[val];\r\n\t\t\t\t\t\tint width, height;\r\n\t\t\t\t\t\tCKLBNodeVirtualDocument * pVDoc = createLabelItem(label, &width, &height);\r\n\t\t\t\t\t\tKLBDELETE(sw->obj.pVDoc);\r\n\t\t\t\t\t\tsw->pNode->addNode(pVDoc);\r\n\t\t\t\t\t\tsw->obj.pVDoc = pVDoc;\r\n\t\t\t\t\t\tsw->rect.w = width;\r\n\t\t\t\t\t\tsw->rect.h = height;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::createLuaTable(CLuaState& lua)\r\n{\r\n\tGROUP * pGrp = m_begin;\r\n\r\n\tlua.tableNew();\r\n\twhile(pGrp) {\r\n\t\tlua.retString(pGrp->key);\r\n\t\tlua.tableNew();\r\n\r\n\t\tfor(int i = 0; i < pGrp->cnt; i++) {\r\n\t\t\tSWITCH * sw = pGrp->menu + i;\r\n\t\t\tlua.retString(sw->key);\r\n\t\t\tswitch(sw->mode)\r\n\t\t\t{\r\n\t\t\tcase DBG_MENU::M_SWITCH:\r\n\t\t\t\t{\r\n\t\t\t\t\tbool bVal = (sw->val) ? true : false;\r\n\t\t\t\t\tlua.retBoolean(bVal);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase DBG_MENU::M_SELECT:\r\n\t\t\t\t{\r\n\t\t\t\t\tlua.retString(sw->disp[sw->val]);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase DBG_MENU::M_NUMBER:\r\n\t\t\t\t{\r\n\t\t\t\t\tlua.retInt(sw->val);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.tableSet();\r\n\t\t}\r\n\t\tlua.tableSet();\r\n\t\tpGrp = pGrp->next;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::setGroupLua(const char * caption, const char * key, CLuaState& lua)\r\n{\r\n\t// スタックに積んであるLuaテーブルの要素数を調べる\r\n\tint cnt = 0;\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tcnt++;\r\n\t\tlua.pop(1);\r\n\t}\r\n\tif(!cnt) return;\r\n\r\n\tDBG_MENU * arrMenu = KLBNEWA(DBG_MENU, cnt + 1);\r\n\r\n\tfor(int i = 0; i < cnt; i++) {\r\n\t\tlua.retInt(i + 1);\r\n\t\tlua.tableGet();\r\n\r\n\t\t// 最上位に項目一つ分のLuaテーブルが乗っている\r\n\t\tlua.retInt(1); lua.tableGet(); arrMenu[i].mode = (DBG_MENU::MODE)lua.getInt(-1);\tlua.pop(1);\t// mode\r\n\t\tlua.retInt(2); lua.tableGet(); arrMenu[i].caption = lua.getString(-1);\t\t\t\tlua.pop(1);\t// caption\r\n\t\tlua.retInt(3); lua.tableGet(); arrMenu[i].key = lua.getString(-1);\t\t\t\t\tlua.pop(1);\t// key\r\n\r\n\t\t// ここから先はmodeで分岐\r\n\t\tswitch(arrMenu[i].mode)\r\n\t\t{\r\n\t\tcase DBG_MENU::M_SWITCH:\r\n\t\t\t{\r\n\t\t\t\t// デフォルト値のboolのみ\r\n\t\t\t\tlua.retInt(4); lua.tableGet(); arrMenu[i].value = (lua.getBool(-1)) ? 1 : 0; lua.pop(1);\r\n\t\t\t\tarrMenu[i].min = 0;\r\n\t\t\t\tarrMenu[i].max = 1;\r\n\t\t\t\tarrMenu[i].items = NULL;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DBG_MENU::M_SELECT:\r\n\t\t\t{\r\n\t\t\t\t// デフォルト値\r\n\t\t\t\tarrMenu[i].value = 0;\r\n\t\t\t\tconst char * value;\r\n\t\t\t\tlua.retInt(4); lua.tableGet(); value = lua.getString(-1); lua.pop(1);\r\n\r\n\t\t\t\t// 選択項目配列があるので、その数をカウントする\r\n\t\t\t\tlua.retInt(5); lua.tableGet();\r\n\t\t\t\tint itemcnt = 0;\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\t\titemcnt++;\r\n\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t}\r\n\t\t\t\tconst char ** disp = KLBNEWA(const char *, itemcnt);\r\n\t\t\t\tfor(int idx = 0; idx < itemcnt; idx++) {\r\n\t\t\t\t\tlua.retInt(idx + 1);\r\n\t\t\t\t\tlua.tableGet();\r\n\t\t\t\t\tdisp[idx] = lua.getString(-1);\r\n\t\t\t\t\tif(!CKLBUtility::safe_strcmp(value, disp[idx])) arrMenu[i].value = idx;\r\n\t\t\t\t\tlua.pop(1);\r\n\t\t\t\t}\r\n\t\t\t\tlua.pop(1);\r\n\r\n\t\t\t\tarrMenu[i].min = 0;\r\n\t\t\t\tarrMenu[i].max = itemcnt - 1;\r\n\t\t\t\tarrMenu[i].items = disp;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DBG_MENU::M_NUMBER:\r\n\t\t\t{\r\n\t\t\t\t// 下限、上限、デフォルト値\r\n\t\t\t\tlua.retInt(4); lua.tableGet(); arrMenu[i].min = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\tlua.retInt(5); lua.tableGet(); arrMenu[i].max = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\tlua.retInt(6); lua.tableGet(); arrMenu[i].value = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\tarrMenu[i].items = NULL;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tlua.pop(1);\r\n\t}\r\n\r\n\t// 末尾は caption をNULLにする\r\n\tarrMenu[cnt].caption = NULL;\r\n\r\n\t// 項目を登録する\r\n\taddDebugItem(caption, key, arrMenu);\r\n\r\n\t// もう不要なので、登録元に使用した領域を破棄する\r\n\tfor(int i = 0; i < cnt; i++) {\r\n\t\tKLBDELETEA(arrMenu[i].items);\r\n\t}\r\n\tKLBDELETEA(arrMenu);\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::removeGroup(const char * key)\r\n{\r\n\tGROUP * pGrp = m_begin;\r\n\twhile(pGrp) {\r\n\t\tif(!CKLBUtility::safe_strcmp(pGrp->key, key)) break;\r\n\t\tpGrp = pGrp->next;\r\n\t}\r\n\tif(!pGrp) return;\r\n\r\n\t// リンクを切る\r\n\tif(pGrp->prev) {\r\n\t\tpGrp->prev->next = pGrp->next;\r\n\t} else {\r\n\t\tm_begin = pGrp->next;\r\n\t}\r\n\tif(pGrp->next) {\r\n\t\tpGrp->next->prev = pGrp->prev;\r\n\t} else {\r\n\t\tm_end = pGrp->prev;\r\n\t}\r\n\r\n\tfor(int i = 0; i < pGrp->cnt; i++) {\r\n\t\tswitch(pGrp->menu[i].mode) \r\n\t\t{\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\tcase DBG_MENU::M_SELECT:\r\n\t\t\t{\r\n\t\t\t\tfor(int j = 0; j <= pGrp->menu[i].max; j++) {\r\n\t\t\t\t\tKLBDELETEA(pGrp->menu[i].disp[j]);\r\n\t\t\t\t}\r\n\t\t\t\tconst char ** disp = pGrp->menu[i].disp;\r\n\t\t\t\tKLBDELETEA(disp);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tKLBDELETE(pGrp->menu[i].label);\t// アイテムラベル削除\r\n\t\tKLBDELETE(pGrp->menu[i].pNode);\t// コントロールノード削除\r\n\t\tKLBDELETEA(pGrp->menu[i].key);\t// キー文字列削除\r\n\t}\r\n\tKLBDELETEA(pGrp->menu);\r\n\tKLBDELETE(pGrp->node);\t// グループラベルノードの削除\r\n\tKLBDELETEA(pGrp->key);\t// キー文字列削除\r\n\tKLBDELETE(pGrp);\r\n\r\n\t// 詰めた後の座標を再計算する\r\n\tpGrp = m_begin;\r\n\tm_lastY = EXIT_MARGINE;\r\n\twhile(pGrp) {\r\n\t\tm_lastY += CAP_MARGINE;\r\n\t\tpGrp->node->setTranslate(0, m_lastY);\r\n\t\tm_lastY += CAP_MARGINE;\r\n\t\tfor(int i = 0; i < pGrp->cnt; i++) {\r\n\t\t\tpGrp->menu[i].label->setTranslate(CAPTION_X, m_lastY);\r\n\t\t\tpGrp->menu[i].pNode->setTranslate(VALUE_X, m_lastY);\r\n\t\t\tpGrp->menu[i].rect.y = m_lastY;\r\n\t\t\tm_lastY += LINE_STEP;\r\n\t\t}\r\n\t\tpGrp = pGrp->next;\r\n\t}\r\n}\r\n\r\n\r\nvoid\r\nCKLBDebugResource::setCallback(const char * callback)\r\n{\r\n\tif(m_callback) {\r\n\t\tKLBDELETEA(m_callback);\r\n\t\tm_callback = NULL;\r\n\t}\r\n\tif(callback) {\r\n\t\tm_callback = CKLBUtility::copyString(callback);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBDebugResource::finishReport()\r\n{\r\n\tCLua_Only_State& lua = (CLua_Only_State&)CKLBLuaEnv::getInstance().getState();\r\n\tif(!m_callback) return;\r\n\tlua.getGlobal(m_callback);\r\n\tcreateLuaTable(lua);\r\n\tlua.call(1, m_callback);\r\n}\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBDebugMenu.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBDebugMenu_h\r\n#define CKLBDebugMenu_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CLuaState.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n#define DBG_FONTSIZE 32\r\n#define DBG_FONTNAME \"fixed\"\r\n\r\n\r\nstruct DBG_MENU {\r\n\tconst char * caption;\r\n\tconst char * key;\r\n\tenum MODE {\r\n\t\tM_SWITCH,\t// ON/OFF\r\n\t\tM_NUMBER,\t// 数値\r\n\t\tM_SELECT,\t// 選択メニュー\r\n\t};\r\n\tMODE\t\t\tmode;\r\n\tint\t\t\t\tmin;\r\n\tint\t\t\t\tmax;\r\n\tint\t\t\t\tvalue;\r\n\tconst char **\titems;\r\n};\r\n\r\nclass CKLBDebugMenu;\r\n\r\n/*!\r\n* \\class CKLBDebugSign\r\n* \\brief \r\n* Internal task created by CKLBDebugMenu for controlling the appearance or disappearance of debug menu.\r\n* It detect a specific sign made by moving the finger on the screen.\r\n*\r\n* 1x          x3\r\n*   xx      xx  x\r\n*     xx  xx    x\r\n*       xx      x\r\n*     xx  xx    x\r\n*   xx      xx  x\r\n* 4x          x2\r\n*\r\n* Following the 1,2,3,4 order.\r\n*\r\n*/\r\nclass CKLBDebugSign : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBDebugSign();\r\n\tvirtual ~CKLBDebugSign();\r\npublic:\r\n\tstatic CKLBDebugSign * create(CKLBDebugMenu * pMenu);\r\n\r\n\tbool init(CKLBDebugMenu * pMenu);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\nprivate:\r\n\tint checkPoint(int x, int y);\r\n\r\n\tCKLBDebugMenu\t*\tm_pMenu;\r\n\r\n\tint\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\tm_cmdStep;\r\n\tint\t\t\t\t\tm_cmdID;\r\n};\r\n\r\n/*!\r\n* \\class CKLBDebugMenu\r\n* \\brief Debug Menu\r\n* \r\n* CKLBDebugMenu allows to create a debug menu task for your game.\r\n* Several items can be used in the Menu : \r\n* - Switch between 2 values.\r\n* - Numbers.\r\n* - Select between several values.\r\n*\r\n* Compile option DEBUG_MENU must be set to be able to use it.\r\n*/\r\nclass CKLBDebugMenu : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBDebugMenu();\r\n\tvirtual ~CKLBDebugMenu();\r\npublic:\r\n\tstatic CKLBDebugMenu * create();\r\n\r\n\tbool init   ();\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tvoid menu_switch    (bool bSwitch);\r\n\r\nprivate:\r\n\tvoid execute_active (u32 deltaT);\r\n\r\nprivate:\r\n\tenum STATE {\r\n\t\tE_WAIT,\r\n\t\tE_ACTIVE\r\n\t};\r\n\tSTATE\t\t\tm_state;\t// 現在の状態\r\n\tint\t\t\t\tm_step;\r\n\r\n\tstruct PAD {\r\n\t\tbool\tenable;\r\n\t\tint\t\tx, y;\t// TAP位置\r\n\t};\r\n\tint\t\t\t\tm_dispY;\r\n\tPAD\t\t\t\tm_pad[CKLBTouchEventUIMgr::MAX_TOUCH_POINT];\r\n};\r\n\r\nclass CKLBDebugResource\r\n{\r\nprivate:\r\n\tCKLBDebugResource();\r\n\tvirtual ~CKLBDebugResource();\r\npublic:\r\n\tstatic CKLBDebugResource& getInstance();\r\n\r\n\tvoid    init   ();\r\n\tvoid    clear  ();\r\n\r\n\tvoid    release();\r\n\r\n\tvoid    addDebugItem    (const char * caption, const char * key, DBG_MENU * pItem);\r\n\r\n\tvoid    dispEnable      (bool enable);\r\n\tbool    tapItem         (int x, int y);\r\n\r\n\tvoid    setGroupLua     (const char * caption, const char * key, CLuaState& lua);\r\n\tvoid    removeGroup     (const char * key);\r\n\r\n\tvoid    createLuaTable  (CLuaState& lua);\r\n\r\n\tvoid    setCallback     (const char * callback);\r\n\tvoid    finishReport    ();\r\n\r\n\tint     setScroll       (int dispY) {\r\n\t\tif(dispY > m_lastY - m_scrnHeight) dispY = m_lastY - m_scrnHeight;\r\n\t\tif(dispY < 0) dispY = 0;\r\n\t\tm_dispY = -dispY;\r\n\t\tm_pNode->setTranslate(0, (float)m_dispY);\r\n\t\treturn dispY;\r\n\t}\r\n\tinline void setBright   (float bright) {\r\n\t\tSColorVector vec;\r\n\t\tfor(int i = 0; i < 3; i++) vec.m_vector[i] = bright;\r\n\t\tm_pNode->setColorMatrix(vec);\r\n\t}\r\nprivate:\r\n\tCKLBNode *  addLabel    (int x, int y, const char * label, int * width, int * height);\r\n\tCKLBNodeVirtualDocument * createLabelItem(const char * label, int * width, int * height);\r\n\r\n\tCKLBNode\t*\tm_pNode;\r\n\r\n\tstruct SWITCH {\r\n\t\tCKLBNode\t*\tlabel;\r\n\t\tCKLBNode\t*\tpNode;\r\n\t\tunion {\r\n\t\t\tCKLBNodeVirtualDocument * pVDoc;\r\n\t\t\tCKLBUITextBox\t\t\t* pText;\r\n\t\t} obj;\r\n\r\n\t\tDBG_MENU::MODE\tmode;\r\n\t\tint\t\t\t\tmin;\t// MODEがM_NUMBERのときのみ有効\r\n\t\tint\t\t\t\tmax;\t// 最大値\r\n\t\tint\t\t\t\tval;\t// 現在の値\r\n\t\tconst char\t*\tkey;\t// Lua配列化する際のキー文字列\r\n\t\tconst char **\tdisp;\t// 表示値(M_SWITCH/M_SELECTのときに使用、M_NUMBERでは0)\r\n\t\tstruct {\r\n\t\t\tint x, y;\r\n\t\t\tint w, h;\r\n\t\t} rect;\t\t\t\t\t// switch/select で使用するhitboxの相対位置とサイズ\r\n\t};\r\n\r\n\tstruct GROUP {\r\n\t\tGROUP\t\t*\tprev;\r\n\t\tGROUP\t\t*\tnext;\r\n\r\n\t\tconst char\t*\tkey;\r\n\t\tCKLBNode\t*\tnode;\t// グループラベルのnode\r\n\t\tint\t\t\t\tcnt;\t// 項目数\r\n\t\tSWITCH\t\t*\tmenu;\t// 1項目あたりの領域\r\n\t};\r\n\r\n\tGROUP\t\t*\tm_begin;\r\n\tGROUP\t\t*\tm_end;\r\n\r\n\tint\t\t\t\tm_dispY;\t// スクロール用\r\n\r\n\tint\t\t\t\tm_lastY;\t// 項目追加用\r\n\tu32\t\t\t\tm_order;\r\n\r\n\tint\t\t\t\tm_exitWidth;\r\n\tint\t\t\t\tm_exitHeight;\r\n\r\n\tint\t\t\t\tm_scrnHeight;\r\n\r\n\tconst char\t*\tm_callback;\r\n\r\n\tu8\t\t\t\tm_format;\r\n\r\n\tstatic const char * ms_labelSwitch[];\r\n};\r\n\r\n#endif // CKLBDebugMenu_h\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBDeviceKeyEvent.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBDeviceKeyEvent.cpp\r\n//\r\n\r\n#include \"CKLBDeviceKeyEvent.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nCKLBDeviceKeyEventQueue::CKLBDeviceKeyEventQueue()\r\n\t: m_begin(0), m_read(0), m_rec(0), m_get(0), m_bDoingProcess(false)\r\n{\r\n}\r\nCKLBDeviceKeyEventQueue::~CKLBDeviceKeyEventQueue() {}\r\n\r\nCKLBDeviceKeyEventQueue&\r\nCKLBDeviceKeyEventQueue::getInstance() {\r\n    static CKLBDeviceKeyEventQueue instance;\r\n    return instance;\r\n}\r\n\r\nvoid\r\nCKLBDeviceKeyEventQueue::addQueue(int keyId, char eventType)\r\n{\r\n\tint next = m_rec+1;\r\n\tif (next >= QUEUE_SIZE) { next = 0; }\r\n\r\n    // judge quque hit its limit (drop event)\r\n    if(next == m_read) return;\r\n\r\n    DEVICE_KEY_ITEM::TYPE type = (DEVICE_KEY_ITEM::TYPE)eventType;\r\n\r\n    m_itemQueue[m_rec].id = keyId;\r\n    m_itemQueue[m_rec].type = type;\r\n\r\n    m_rec = next;\r\n}\r\n\r\nCKLBDeviceKeyEvent::CKLBDeviceKeyEvent() : CKLBTask() {}\r\nCKLBDeviceKeyEvent::~CKLBDeviceKeyEvent() {}\r\n\r\nbool\r\nCKLBDeviceKeyEvent::onPause(bool /*bPause*/)\r\n{\r\n\treturn false;\r\n}\r\n\r\nCKLBDeviceKeyEvent *\r\nCKLBDeviceKeyEvent::create()\r\n{\r\n    CKLBDeviceKeyEvent * pTask = KLBNEW(CKLBDeviceKeyEvent);\r\n\tif (pTask) {\r\n\t\tpTask->regist(0, P_INPUT);    // 入力タスクは必ず入力フェーズに指定する。\r\n\t}\r\n    return pTask;\r\n}\r\n\r\nvoid\r\nCKLBDeviceKeyEvent::execute(u32)\r\n{\r\n    // そのフレームでどこからどこまでを取得できるか決定\r\n    CKLBDeviceKeyEventQueue::getInstance().fixLimit();\r\n}\r\n\r\nvoid\r\nCKLBDeviceKeyEvent::die() {}\r\n\r\nu32\r\nCKLBDeviceKeyEvent::getClassID()\r\n{\r\n\treturn CLS_KLBTASKTOUCHPAD;\r\n}\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBDeviceKeyEvent.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBDeviceKeyEvent.h\r\n//\r\n\r\n#ifndef CKLBDeviceKeyEvent_h\r\n#define CKLBDeviceKeyEvent_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n// #define\tLOG_EVENT\r\n\r\ntypedef struct {\r\n    typedef enum {\r\n        PRESS = 1,\r\n        RELEASE = 2,\r\n        CLICK = 3\r\n    } TYPE;\r\n\r\n    TYPE    type;\r\n    int     id;\r\n\tvoid\t* locker;\t// 入力の使用者\r\n} DEVICE_KEY_ITEM;\r\n\r\nclass CKLBDeviceKeyEventQueue\r\n{\r\nprivate:\r\n    CKLBDeviceKeyEventQueue();\r\n    ~CKLBDeviceKeyEventQueue();\r\npublic:\r\n    static CKLBDeviceKeyEventQueue& getInstance();\r\n\r\n    // キューに入力アイテムを追加(システム側からアイテムを追加する際に使用)\r\n    void addQueue(int keyId, char eventType);\r\n    \r\n    // キューの取得限界を現在の点に固定\r\n    inline void fixLimit() {\r\n        m_read = m_begin;\r\n        m_begin = m_rec;\r\n    }\r\n\r\n    // キューの参照点を読み出し先頭に指定する\r\n    void startItem() {\r\n        m_get = m_read;\r\n    }\r\n\r\n\tinline void setProcessing(bool process) {\r\n\t\tm_bDoingProcess = process;\r\n\t}\r\n    \r\n    // キューのアイテムを参照する\r\n    const DEVICE_KEY_ITEM * getItem() {\r\n\t\tconst DEVICE_KEY_ITEM * ret;\r\n\t\tif(m_get == m_begin) return 0;  // no further event queued\r\n\t\tret = m_itemQueue + m_get;\r\n\t    m_get = ++m_get % QUEUE_SIZE;\r\n\t\t\r\n        return ret;\r\n    }\r\n\r\nprivate:\r\n\tbool\t\t\tm_bDoingProcess;\r\n    \r\n    int             m_begin;        // 記録先頭\r\n    int             m_rec;          // 記録点\r\n    int             m_read;         // 読み出し先頭\r\n    int             m_get;          // 取得点\r\n    \r\n    enum {\r\n        QUEUE_SIZE = 64\r\n    };\r\n    \r\n    DEVICE_KEY_ITEM    m_itemQueue[ QUEUE_SIZE ];\r\n};\r\n\r\n/*!\r\n* \\class CKLBDeviceKeyEvent\r\n* \\brief Touch Pad Events handler class\r\n* \r\n* CKLBDeviceKeyEvent is similar to CKLBOSCtrlEvent, but only handles Touch Pad events.\r\n* It owns a queue of Touch Pad events.\r\n* This task is instanciated once when the game starts.\r\n*/\r\nclass CKLBDeviceKeyEvent : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBDeviceKeyEvent();\r\n    virtual ~CKLBDeviceKeyEvent();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n    static CKLBDeviceKeyEvent * create();\r\n\r\n    void execute(u32 deltaT);\r\n    void die();\r\n\r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBDrawTask.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"KLBPlatformMetrics.h\"\r\n;\r\nCKLBDrawResource::CKLBDrawResource()\r\n:m_allowLog\t\t(false)\r\n,m_frameCount\t(0)\r\n,m_hasBorder\t(true)\r\n{}\r\n\r\nCKLBDrawResource::~CKLBDrawResource() {}\r\n\r\nCKLBDrawResource&\r\nCKLBDrawResource::getInstance() {\r\n\tstatic CKLBDrawResource instance;\r\n\treturn instance;\r\n}\r\n\r\nvoid\r\nCKLBDrawResource::setBorderless(bool hasNoBorder) {\r\n\tm_hasBorder = !hasNoBorder;\r\n}\r\n\r\nbool\r\nCKLBDrawResource::setLogicalResolution(int width, int height, float * other_matrix)\r\n{\r\n\tm_width = width;\r\n\tm_height = height;\r\n\t/*\r\n\tGLfloat matrix[16] = {\r\n\t\t(2.0f/m_width),\t0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n\t\t0.0f,\t\t\t(-2.0f/m_height),\t\t\t0.0f,\t0.0f,\r\n\t\t0.0f,\t\t\t0.0f,\t\t\t\t\t0.0f,\t0.0f,\r\n\t\t-1.0f,\t\t\t1.0f,\t\t\t\t\t1.0f,\t1.0f, };\r\n\t*/\r\n\r\n\tfloat scaleX = (float)m_phisical_width  / (float)m_width;\r\n\tfloat scaleY = (float)m_phisical_height / (float)m_height;\r\n\tm_scaleX = scaleX;\r\n\tm_scaleY = scaleY;\r\n\r\n\tm_scale = (scaleX < scaleY) ? scaleX : scaleY;\r\n\r\n\tm_vp_width\t= m_width * m_scale;\r\n\tm_vp_height = m_height * m_scale;\r\n\r\n\t// 画面内の原点位置 m_ox, m_oy を計算\r\n\tm_ox = (m_phisical_width  - m_vp_width ) / 2;\r\n\tm_oy = (m_phisical_height - m_vp_height) / 2;\r\n\r\n\t// Select if 0,0 in coordinate is screen physical 0,0\r\n\tfloat glTX\t\t= m_hasBorder ? -1.0f\t\t\t\t: (-1.0f) + ((m_phisical_width  - (m_width  * m_scale)) / (float)m_phisical_width );\r\n\tfloat glTY\t\t= m_hasBorder ? +1.0f\t\t\t\t: (+1.0f) - ((m_phisical_height - (m_height * m_scale)) / (float)m_phisical_height);\r\n\r\n\t// Viewport pixel count width/height same as logical size ?\r\n\t// Yes : has border\r\n\t// No  : is borderless\r\n\tfloat glScaleX\t= m_hasBorder ? (2.0/m_width)\t\t: (( 2.0f/m_width )*m_scale) / scaleX;\r\n\tfloat glScaleY\t= m_hasBorder ? (-2.0f/m_height)\t: ((-2.0f/m_height)*m_scale) / scaleY;\r\n\r\n\tGLfloat matrix[16] = {\r\n\t\tglScaleX,\t0.0f,\t\t0.0f,\t0.0f,\r\n\t\t0.0f,\t\tglScaleY,\t0.0f,\t0.0f,\r\n\t\t0.0f,\t\t0.0f,\t\t1.0f,\t0.0f,\r\n\t\tglTX,\t\tglTY,\t\t0.0f,\t1.0f, \r\n\t};\r\n\t\t\r\n\tfloat * proj_matrix = (other_matrix) ? other_matrix : matrix;\r\n\tbool bResult = CKLBOGLWrapper::getInstance().init(proj_matrix);\r\n\tif(!bResult) return bResult;\r\n\r\n\t// Perform centering and scaling at GL matrix level.\r\n\tif (m_hasBorder) {\r\n\t\tdglViewport(m_ox, m_oy, m_vp_width, m_vp_height);\r\n\t} else {\r\n\t\tdglViewport(0, 0, m_phisical_width, m_phisical_height);\r\n\t}\r\n\r\n\tdglClearColor(1.0f, 0.7f, 0.2039f, 1.0f);\r\n\tdglDisable( GL_CULL_FACE );\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBDrawResource::initResource(bool /*bLandscape*/, int width, int height)\r\n{\r\n\tbool bResult = false;\r\n\r\n\t// 現時点では、物理解像度と論理解像度は同じ\r\n\tm_phisical_width = width;\r\n\tm_phisical_height = height;\r\n\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\tif (pRdrMgr.setup(65000, 65000)) {\r\n\r\n\t\t// 物理解像度と同じ論理解像度でGLを初期化する。プロジェクションマトリクスはデフォルト\r\n\t\tif(setLogicalResolution(width, height)) {\r\n\t\t\t//\r\n\t\t\t// 3. Create Root Node\r\n\t\t\t//\r\n\t\t\tm_gpRootNode = KLBNEW(CKLBNode);\r\n\t\t\tif (m_gpRootNode) {\r\n\t\t\t\tm_gpRootNode->asRoot();\r\n\t\t\t\tm_gpRootNode->setScale(1.0f,1.0f);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBDrawResource::setClearColor(float r, float g, float b, float a)\r\n{\r\n\tdglClearColor(r, g, b, a);\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBDrawResource::freeResource()\r\n{\r\n\tif (m_gpRootNode) {\r\n\t\tKLBDELETE(m_gpRootNode); m_gpRootNode = NULL;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBDrawResource::changeProjectionMatrix(float * matrix, int width, int height)\r\n{\r\n\tsetLogicalResolution(width, height, matrix);\r\n}\r\n\r\nvoid\r\nCKLBDrawResource::ResetViewport(void)\r\n{\r\n\tif (m_hasBorder) {\r\n\t\tdglViewport(m_ox, m_oy, m_vp_width, m_vp_height);\r\n\t} else {\r\n\t\tdglViewport(0, 0, m_phisical_width, m_phisical_height);\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBDrawResource::allowLog() {\r\n\treturn m_allowLog;\r\n}\r\n\r\nvoid\r\nCKLBDrawResource::setLog(bool activate) {\r\n\tm_allowLog = activate;\r\n}\r\n\r\nu32 CKLBDrawResource::incrementFrame() {\r\n\treturn m_frameCount++;\r\n}\r\n\r\n\r\nCKLBDrawTask::CKLBDrawTask() : CKLBTask() {}\r\nCKLBDrawTask::~CKLBDrawTask() {}\r\n\r\nCKLBDrawTask *\r\nCKLBDrawTask::create(bool rotate, int width, int height)\r\n{\r\n\tCKLBDrawTask * pTask = KLBNEW(CKLBDrawTask);\r\n\tif(!pTask) return NULL;\r\n\tif(!pTask->init(rotate, width, height)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n#ifdef DEBUG_PERFORMANCE\r\n\tpTask->m_recompute->init(pTask);\r\n\tpTask->m_draw->init(pTask);\r\n#endif\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBDrawTask::onPause(bool /*bPause*/)\r\n{\r\n\t// このタスクはpauseされてはならない\r\n\treturn false;\r\n}\r\n\r\n#include \"CKLBTexturePacker.h\" \r\n\r\nvoid\r\nCKLBDrawTask::execute(u32 deltaT)\r\n{\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\r\n\t// clear.\r\n\tdglDisable(GL_SCISSOR_TEST);\r\n\t// For TEST glClearColor(1.0f, 0.7f, 0.2039f, 0.0f);\r\n\tdglClear(GL_COLOR_BUFFER_BIT);\r\n\r\n\ts64 updateAnim\t\t= 0;\r\n\ts64 updateTree\t\t= 0;\r\n\ts64 renderTime\t\t= 0;\r\n\ts64 endrenderTime\t= 0;\r\n\tCKLBDrawResource& drawRes = CKLBDrawResource::getInstance();\r\n\tbool gLogFrameTime = drawRes.allowLog();\r\n\tint  gFrameCounter = CKLBDrawResource::getInstance().incrementFrame();\r\n\r\n\tif (gLogFrameTime) {\r\n\t\tupdateAnim = CPFInterface::getInstance().platform().nanotime();\r\n\t}\r\n\r\n\tTexturePacker::getInstance().refreshTextures();\r\n\r\n\t// 5. Execution animation list (Spline, SWF movies)\r\n\t//\r\n\tif (!CKLBTaskMgr::getInstance().getFreeze()) {\r\n\t\tMEASURE_THREAD_CPU_BEGIN(TASKTYPE_DRAW_ANIMATION);\r\n\t\tdraw.performAnimationUpdate(deltaT);\r\n\t\tMEASURE_THREAD_CPU_END(TASKTYPE_DRAW_ANIMATION);\r\n\t}\r\n\r\n\tif (gLogFrameTime) {\r\n\t\tupdateTree = CPFInterface::getInstance().platform().nanotime();\r\n\t}\r\n#ifndef DEBUG_PERFORMANCE\r\n\t// パフォーマンステストのため、処理を分割\r\n\t//\r\n\t// 6. Tree update\r\n\t//\r\n\tdraw.recompute();\r\n\r\n\tif (gLogFrameTime) {\r\n\t\trenderTime = CPFInterface::getInstance().platform().nanotime();\r\n\t}\r\n\t//\r\n\t// 7. Render Draw\r\n\t//\r\n\tdraw.draw();\r\n\r\n\tif (gLogFrameTime) {\r\n\t\ts64 startFrame = CKLBTaskMgr::getInstance().getStartTime();\r\n\t\ts64 scriptTime = CKLBTaskMgr::getInstance().getScriptTime();\r\n\t\tendrenderTime = CPFInterface::getInstance().platform().nanotime();\r\n\t\tDEBUG_PRINT(\"=== Frame[%8i] Anim : %4.2f mS, Tree : %4.2f mS, Render : %4.2f mS, Total : %4.2f ms, Script : %4.2f\", \r\n\t\t\tgFrameCounter,\r\n\t\t\t(((updateTree - updateAnim) / 1000) / 1000.0f),\r\n\t\t\t(((renderTime - updateTree) / 1000) / 1000.0f),\r\n\t\t\t(((endrenderTime - renderTime) / 1000) / 1000.0f),\r\n\t\t\t(((endrenderTime - startFrame) / 1000) / 1000.0f),\r\n\t\t\t((scriptTime / 1000) / 1000.0f)\r\n\t\t);\r\n\t}\r\n\r\n\t//\r\n\t// 9. Rendering close frame.\r\n\t//\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\t\t\t= CKLBOGLWrapper::getInstance();\r\n\tpOGLMgr.endFrame();\r\n#endif // DEBUG_PERFORMANCE\r\n}\r\n\r\nvoid\r\nCKLBDrawTask::die()\r\n{\r\n\tCKLBDrawResource::getInstance().freeResource();\r\n}\r\n\r\nu32\r\nCKLBDrawTask::getClassID()\r\n{\r\n\treturn CLS_KLBTASKDRAW;\r\n}\r\n\r\n\r\nbool\r\nCKLBDrawTask::init(bool rotate, int width, int height)\r\n{\r\n\tbool bResult = CKLBDrawResource::getInstance().initResource(rotate, width, height);\r\n\r\n    if(!bResult) return false;\r\n#ifdef DEBUG_PERFORMANCE\r\n\tm_recompute = KLBNEW(CKLBDrawTask_recompute);\r\n\tm_draw      = KLBNEW(CKLBDrawTask_draw);\r\n#endif\r\n\treturn regist(NULL, P_DRAW);\r\n}\r\n\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\nCKLBDrawTask_recompute::CKLBDrawTask_recompute() : CKLBTask() { \r\n}\r\nCKLBDrawTask_recompute::~CKLBDrawTask_recompute() {}\r\n\r\nbool\r\nCKLBDrawTask_recompute::init(CKLBDrawTask * pParent)\r\n{\r\n\treturn regist(pParent, P_DRAW);\r\n}\r\n\r\n\r\nvoid\r\nCKLBDrawTask_recompute::execute(u32 deltaT)\r\n{\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t//\r\n\t// 6. Tree update\r\n\t//\r\n\tCKLBNode::s_matrixRecomputeCount = 0;\r\n\tCKLBNode::s_vertexRecomputeCount = 0;\r\n\tCKLBNode::s_colorRecomputeCount  = 0;\r\n\r\n\tdraw.recompute();\r\n}\r\n\r\nvoid\r\nCKLBDrawTask_recompute::die()\r\n{\r\n}\r\n\r\nCKLBDrawTask_draw::CKLBDrawTask_draw() : CKLBTask() {\r\n}\r\nCKLBDrawTask_draw::~CKLBDrawTask_draw() {}\r\n\r\nbool\r\nCKLBDrawTask_draw::init(CKLBDrawTask * pParent)\r\n{\r\n\treturn regist(pParent, P_DRAW);\r\n}\r\n\r\nvoid\r\nCKLBDrawTask_draw::execute(u32 deltaT)\r\n{\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t//\r\n\t// 7. Render Draw\r\n\t//\r\n\tdraw.draw();\r\n\r\n\t//\r\n\t// 9. Rendering close frame.\r\n\t//\r\n\tCKLBOGLWrapper&\t\tpOGLMgr\t\t\t= CKLBOGLWrapper::getInstance();\r\n\tpOGLMgr.endFrame();\r\n}\r\n\r\nvoid\r\nCKLBDrawTask_draw::die()\r\n{\r\n}\r\n\r\n#endif // DEBUG_PERFORMANCE\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBDrawTask.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBDrawTask_h\r\n#define CKLBDrawTask_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBRendering.h\"\r\n#include \"CKLBNode.h\"\r\n\r\n\r\nclass CKLBDrawResource\r\n{\r\nprivate:\r\n\tCKLBDrawResource();\r\n\tvirtual ~CKLBDrawResource();\r\n\r\npublic:\r\n\tstatic CKLBDrawResource& getInstance();\r\n\r\n\tinline const int width      () const { return m_width;      }\r\n\tinline const int height     () const { return m_height;     }\r\n\r\n\tinline const int vp_width   () const { return m_vp_width;   }\r\n\tinline const int vp_height  () const { return m_vp_height;  }\r\n\r\n\tinline const int ox         () const { return m_ox;         }\r\n\tinline const int oy         () const { return m_oy;         }\r\n\r\n\tbool initResource(bool rotation, int width, int height);\r\n\tvoid freeResource();\r\n\r\n\tvoid setBorderless(bool hasNoBorder);\r\n\r\n\tinline\r\n\tbool hasBorder() { return m_hasBorder; }\r\n\tbool setLogicalResolution(int width, int height, float * other_matrix = 0);\r\n\r\n\tinline void convPointing(int x, int y, int& cx, int& cy) {\r\n\t\tcx = (int)((x - m_ox) / m_scale);\r\n\t\tcy = (int)((y - m_oy) / m_scale);\r\n\t}\r\n\r\n\t// 論理座標系上の長さを物理座標系上の長さに変換する\r\n\tinline float toPhisical(float logical) { return logical * m_scale; }\r\n\r\n\t// 物理座標系上の長さを論理座標系上の長さに変換する\r\n\tinline float toLogical(float phisical) { return phisical / m_scale; }\r\n\r\n\t// 論理座標を物理デバイス座標に変換する(OSコントロールの位置変換等に使用)\r\n\tinline void toPhisicalPosition(int lx, int ly, int& px, int& py) {\r\n\t\tpx = (int)(lx * m_scale) + m_ox;\r\n\t\tpy = (int)(ly * m_scale) + m_oy;\r\n\t}\r\n\t// 論理座標系上のサイズを物理デバイス座標系上のサイズに変換する\r\n\tinline void toPhisicalSize(int lw, int lh, int& pw, int& ph) {\r\n\t\tpw = (int)(lw * m_scale);\r\n\t\tph = (int)(lh * m_scale);\r\n\t}\r\n\r\n    void changeProjectionMatrix(float * matrix, int width, int height);\r\n    \r\n\tinline CKLBNode * getRoot() { return m_gpRootNode; }\r\n    \r\n\tinline void performAnimationUpdate(u32 deltaT) {\r\n\t\tCKLBSystem::performAnimationUpdate(deltaT); \r\n\t}\r\n\r\n\tinline void recompute() {\r\n\t\tm_gpRootNode->recompute();\r\n\t}\r\n\r\n\tinline void draw() {\r\n\t\tCKLBRenderingManager::getInstance().draw();\r\n\t}\r\n\r\n\tbool setClearColor(float r, float g, float b, float a);\r\n\r\n    // ビューポートの再設定(Android版でバックグラウンドから復帰した時に使用)\r\n    void ResetViewport(void);\r\n    \r\n\tbool allowLog\t();\r\n\tvoid setLog\t\t(bool activate);\r\n\r\n\tu32 incrementFrame();\r\n\r\nprivate:\r\n\tbool\t\tm_hasBorder;\r\n\tbool\t\tm_allowLog;\r\n\tu32\t\t\tm_frameCount;\r\n\tint\t\t\tm_phisical_width;\r\n\tint\t\t\tm_phisical_height;\r\n\tint\t\t\tm_width;\r\n\tint\t\t\tm_height;\r\n\tint\t\t\tm_ox;\r\n\tint\t\t\tm_oy;\r\n\tint\t\t\tm_vp_width;\r\n\tint\t\t\tm_vp_height;\r\n\tfloat\t\tm_scale;\t// 論理解像度に対する物理画面の倍率\r\n\tfloat\t\tm_scaleX;\r\n\tfloat\t\tm_scaleY;\r\n\tCKLBNode*\tm_gpRootNode;\r\n};\r\n\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\nclass CKLBDrawTask_recompute;\r\nclass CKLBDrawTask_draw;\r\n#endif\r\n\r\n\r\n/*!\r\n* \\class CKLBDrawTask\r\n* \\brief Draw Task class.\r\n* \r\n* CKLBDrawTask is in charge of drawing the game resources each frame.\r\n* It is instancied only once and draws all the resources in one and only one draw call.\r\n* This task is instancied when the game starts and dies when it stops.\r\n*/\r\nclass CKLBDrawTask : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBDrawTask();\r\n\tvirtual ~CKLBDrawTask();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n\tstatic CKLBDrawTask * create(bool rotate, int width, int height);\r\n\r\n\tvoid execute    (u32 deltaT);\r\n\r\n\tvoid die        ();\r\n\r\n\tu32 getClassID  ();\r\n\r\nprivate:\r\n\tbool init(bool rotate, int width, int height);\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\tCKLBDrawTask_recompute\t*\tm_recompute;\r\n\tCKLBDrawTask_draw\t\t*\tm_draw;\r\n#endif\r\n};\r\n\r\n#ifdef DEBUG_PERFORMANCE\r\n\r\nclass CKLBDrawTask_recompute : public CKLBTask\r\n{\r\n\tfriend class CKLBDrawTask;\r\nprivate:\r\n\tCKLBDrawTask_recompute();\r\n\tvirtual ~CKLBDrawTask_recompute();\r\n\tbool init(CKLBDrawTask * pParent);\r\npublic:\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n};\r\n\r\nclass CKLBDrawTask_draw : public CKLBTask\r\n{\r\n\tfriend class CKLBDrawTask;\r\nprivate:\r\n\tCKLBDrawTask_draw();\r\n\tvirtual ~CKLBDrawTask_draw();\r\n\tbool init(CKLBDrawTask * pParent);\r\npublic:\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n};\r\n\r\n\r\n#endif // DEBUG_PERFORMANCE\r\n\r\n#endif // CKLBDrawTask_h\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBLuaScript.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaScript.cpp\r\n//\r\n\r\n#include \"CKLBLuaScript.h\"\r\n\r\n\r\nCKLBLuaScript::CKLBLuaScript() : CKLBTask() {}\r\nCKLBLuaScript::~CKLBLuaScript() {}\r\n\r\nbool\r\nCKLBLuaScript::onPause(bool /*bPause*/)\r\n{\r\n\treturn false;\r\n}\r\n\r\nvoid\r\nCKLBLuaScript::execute(u32 deltaT)\r\n{\r\n    CKLBLuaEnv& env = CKLBLuaEnv::getInstance();\r\n    env.execScript(deltaT);\r\n}\r\n\r\nvoid\r\nCKLBLuaScript::die() {\r\n    // Lua実行環境終了\r\n    //CKLBLuaEnv::getInstance().finishLuaEnv();\r\n}\r\n\r\n\r\nCKLBLuaScript *\r\nCKLBLuaScript::create(const char *bootScriptURL)\r\n{\r\n    // 初期スクリプトのロードおよび初期化処理実行。\r\n    // これ以後、スクリプトからタスクの起動が出来る。\r\n    if(!CKLBLuaEnv::getInstance().setupLuaEnv()) return NULL;    \r\n    if(!CKLBLuaEnv::getInstance().loadScript(bootScriptURL)) {\r\n\t\t// boot script が読めないため、assertを出す。\r\n\t\tklb_assertAlways(\"NOT FOUND! [ start.lua ]\");\r\n\t\treturn NULL;\r\n\t}\r\n    // 初期スクリプトのロードおよび、初期化関数setup()の実行に成功したら、\r\n    // タスク処理タスクを起動する。\r\n    CKLBLuaScript * pTask = KLBNEW(CKLBLuaScript);\r\n    if(!pTask) return NULL;\r\n\r\n    // スクリプトタスクは、必ず P_SCRIPT フェーズで動作する。\r\n    if(!pTask->regist(NULL, P_SCRIPT)) {\r\n        KLBDELETE(pTask);\r\n        return NULL;\r\n    }\r\n    return pTask;\r\n}\r\n\r\nu32\r\nCKLBLuaScript::getClassID()\r\n{\r\n\treturn CLS_KLBTASKSCRIPT;\r\n}"
  },
  {
    "path": "Engine/source/SystemTask/CKLBLuaScript.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBLuaScript.h\r\n//\r\n\r\n#ifndef CKLBLuaScript_h\r\n#define CKLBLuaScript_h\r\n\r\n#include \"CLuaState.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBTask.h\"\r\n\r\n\r\n/*!\r\n* \\class CKLBLuaScript\r\n* \\brief Lua Script loading class.\r\n* \r\n* CKLBLuaScript is used to load and execute some Lua script from an URL.\r\n*/\r\nclass CKLBLuaScript : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBLuaScript ();\r\n    ~CKLBLuaScript();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n    static CKLBLuaScript * create(const char * bootScriptURL);\r\n\r\n    void execute(u32 deltaT);\r\n    void die    ();\r\n\r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBOSCtrlEvent.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBOSCtrlEvent.cpp\r\n//  GameEngine\r\n//\r\n//\r\n#include \"BaseType.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n\r\nCKLBOSCtrlQueue::CKLBOSCtrlQueue()\r\n: m_begin(0), m_read(0), m_rec(0), m_get(0), m_optIdx(0) {}\r\nCKLBOSCtrlQueue::~CKLBOSCtrlQueue() {}\r\n\r\nCKLBOSCtrlQueue&\r\nCKLBOSCtrlQueue::getInstance() {\r\n    static CKLBOSCtrlQueue instance;\r\n    return instance;\r\n}\r\n\r\nvoid *\r\nCKLBOSCtrlQueue::allocData(u32 size, void * pData, u32& retsize)\r\n{\r\n\tklb_assert((m_optData[m_optIdx].topidx + size) < MAX_DATALEN, \"OSEvent queue data buffer overflow.\");\r\n\r\n\tchar * dataTop = m_optData[m_optIdx].strbuf + m_optData[m_optIdx].topidx;\r\n\tvoid * data = dataTop;\r\n\tmemcpy(dataTop, pData, (size_t)size);\r\n\tretsize = size;\r\n    m_optData[m_optIdx].topidx += size;\r\n\treturn data;\r\n}\r\n\r\nvoid\r\nCKLBOSCtrlQueue::addQueue(IClientRequest::EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\t\t\t\t\tu32 datasize1, void * pData1, u32 datasize2, void * pData2)\r\n{\r\n\t// 一つ手前なので記録上限と看做す\r\n\tint next = (m_rec+1);\r\n\tif (next >= MAX_EVENT) { next = 0; }\r\n\r\n\tif (next == m_read) return;\r\n\r\n\t// datasize が 1以上のときは指定されたサイズを確保し、pDataからそのサイズをコピーする\r\n\tm_ctrl[m_rec].type = type;\r\n\tm_ctrl[m_rec].widget = pWidget;\r\n\r\n\tm_ctrl[m_rec].size1 = 0;\r\n\tm_ctrl[m_rec].data1 = NULL;\r\n\r\n\tm_ctrl[m_rec].size2 = 0;\r\n\tm_ctrl[m_rec].data2 = NULL;\r\n\r\n\t// オプションデータは最大2種\r\n    if(datasize1 > 0 && pData1) m_ctrl[m_rec].data1 = allocData(datasize1, pData1, m_ctrl[m_rec].size1);\r\n    if(datasize2 > 0 && pData2) m_ctrl[m_rec].data2 = allocData(datasize2, pData2, m_ctrl[m_rec].size2);\r\n\r\n\tm_rec = next;\r\n}\r\n\r\n\r\nCKLBOSCtrlEvent::CKLBOSCtrlEvent() : CKLBTask(){}\r\nCKLBOSCtrlEvent::~CKLBOSCtrlEvent() {}\r\n\r\nbool\r\nCKLBOSCtrlEvent::onPause(bool /*bPause*/)\r\n{\r\n\treturn false;\r\n}\r\n\r\nCKLBOSCtrlEvent *\r\nCKLBOSCtrlEvent::create()\r\n{\r\n    CKLBOSCtrlEvent * pTask = KLBNEW(CKLBOSCtrlEvent);\r\n\tif (pTask) {\r\n\t\tpTask->regist(NULL, P_INPUT);    // 入力タスクは必ず入力フェーズに指定する。\r\n\t}\r\n    return pTask;\r\n}\r\n\r\nvoid\r\nCKLBOSCtrlEvent::execute(u32)\r\n{\r\n    // そのフレームでどこからどこまでを取得できるか決定\r\n    CKLBOSCtrlQueue::getInstance().fixLimit();\r\n}\r\n\r\nvoid\r\nCKLBOSCtrlEvent::die() {}\r\n\r\nu32\r\nCKLBOSCtrlEvent::getClassID()\r\n{\r\n\treturn CLS_KLBTASKOSCTRLEVENT;\r\n}\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBOSCtrlEvent.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBOSCtrlEvent.h\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#ifndef CKLBOSCtrlEvent_h\r\n#define CKLBOSCtrlEvent_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"OSWidget.h\"\r\n\r\nstruct OSCTRL {\r\n\tIClientRequest::EVENT_TYPE\t\ttype;\r\n\tIWidget\t\t\t\t\t\t*\twidget;\r\n\r\n\tu32\t\t\t\t\t\t\t\tsize1;\r\n\tvoid\t\t\t\t\t\t*\tdata1;\r\n\r\n\tu32\t\t\t\t\t\t\t\tsize2;\r\n\tvoid\t\t\t\t\t\t*\tdata2;\r\n};\r\n\r\nclass CKLBOSCtrlQueue\r\n{\r\nprivate:\r\n    CKLBOSCtrlQueue();\r\n    virtual ~CKLBOSCtrlQueue();\r\npublic:\r\n    static CKLBOSCtrlQueue& getInstance();\r\n\r\n    void addQueue(IClientRequest::EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\t\t\tu32 datasize1 = 0, void * pData1 = NULL,\r\n\t\t\t\t\tu32 datasize2 = 0, void * pData2 = NULL);\r\n\r\n    // キューの取得限界を現在の点に固定\r\n    inline void fixLimit() {\r\n        m_read  = m_begin;\r\n        m_begin = m_rec;\r\n\t\tm_optIdx = 1 - m_optIdx;\t\t\t// 書き込み側 index の表裏を入れ替える\r\n\t\tm_optData[m_optIdx].topidx = 0;\t\t// 書き込み先頭を初期化\r\n    }\r\n    \r\n    // キューの参照点を読み出し先頭に指定する\r\n    void startItem() {\r\n        m_get = m_read;\r\n    }\r\n    \r\n    // 特定のWidgetに関連したキューのアイテムを取得する\r\n    const OSCTRL * getItem(IWidget * pWidget) {\r\n\t\tconst OSCTRL * ret;\r\n\t\tdo {\r\n\t\t\tif(m_get == m_begin) return 0;  // これ以上読んではいけない\r\n\t\t\tret = m_ctrl + m_get;\r\n\t        m_get = ++m_get % MAX_EVENT;\r\n\t\t} while(ret->widget != pWidget);\t// 異なるWidgetに対するものであればスキップする\r\n        return ret;\r\n    }\r\n\r\nprivate:\r\n\tvoid * allocData(u32 size, void * pData, u32& retsize);\r\n\r\n    enum {\r\n        MAX_EVENT   = 1024,\r\n\t\tMAX_DATALEN = 4096 * 32,\r\n    };\r\n    int             m_begin;        // 記録先頭\r\n    int             m_rec;          // 記録点\r\n    int             m_read;         // 読み出し先頭\r\n    int             m_get;          // 取得点\r\n    \r\n\r\n    OSCTRL          m_ctrl[ MAX_EVENT ];\r\n\r\n\tstruct OPTDATA {\r\n\t\tint\t\ttopidx;\r\n\t\tchar\tstrbuf[ MAX_DATALEN ];\r\n\t};\r\n\r\n\tint\t\t\t\tm_optIdx;\r\n\tOPTDATA\t\t\tm_optData[2];\r\n};\r\n\r\n\r\n/*!\r\n* \\class CKLBOSCtrlEvent\r\n* \\brief OS Control Event Task class.\r\n* \r\n* CKLBOSCtrlEvent is the class in charge of handling the OS events.\r\n* Each frame it allows some events to be visible for the Engine.\r\n*/\r\nclass CKLBOSCtrlEvent : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBOSCtrlEvent();\r\n    virtual ~CKLBOSCtrlEvent();\r\n    \r\n\tbool onPause(bool bPause);\r\n    \r\npublic:\r\n    static CKLBOSCtrlEvent * create();\r\n    \r\n    void execute(u32 deltaT);\r\n    void die    ();\r\n    \r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif // CKLBOSCtrlEvent_h\r\n\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBTouchEventUI.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBTouchEventUI.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\nCKLBTouchEventUIMgr::CKLBTouchEventUIMgr() : m_pFormBegin(NULL)\r\n{\r\n\tfor(int i = 0; i < MAX_TOUCH_POINT; i++) m_pTarget[i] = 0;\r\n}\r\nCKLBTouchEventUIMgr::~CKLBTouchEventUIMgr() {}\r\n\r\nCKLBTouchEventUIMgr&\r\nCKLBTouchEventUIMgr::getInstance()\r\n{\r\n\tstatic CKLBTouchEventUIMgr instance;\r\n\treturn instance;\r\n}\r\n\r\nvoid\r\nCKLBTouchEventUIMgr::registForm(SFormCtrlList * pList)\r\n{\r\n\t// 既に登録されているかもしれないので、一旦おなじポインタでremoveを試みる\r\n\tremoveForm(pList);\r\n\tpList->next = m_pFormBegin;\r\n\tm_pFormBegin = pList;\r\n}\r\n\r\nvoid\r\nCKLBTouchEventUIMgr::removeForm(SFormCtrlList * pList)\r\n{\r\n\tSFormCtrlList * pPrev = m_pFormBegin;\r\n\r\n    if(pPrev == pList) {\r\n        m_pFormBegin = pList->next;\r\n        return;\r\n    }\r\n\twhile(pPrev) {\r\n\t\tif(pPrev->next == pList) {\r\n\t\t\tpPrev->next = pList->next;\t// 対象をリストから除外する\r\n\t\t\tpList->next = NULL;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpPrev = pPrev->next;\r\n\t}\r\n}\r\n\r\nSFormCtrlList *\r\nCKLBTouchEventUIMgr::searchCtrl(CKLBUISelectable * pCtrl)\r\n{\r\n\t// 対象のコントロールが含まれるフォームの単位を検索する\r\n\tSFormCtrlList * pList = m_pFormBegin;\r\n\r\n\twhile(pList) {\r\n\r\n\t\tCKLBUISelectable * pItem = pList->pBegin;\r\n\t\twhile(pItem) {\r\n\t\t\tif(pItem == pCtrl) {\r\n\t\t\t\t// このリストに含まれているので、リストのポインタを返す\r\n\t\t\t\treturn pList;\r\n\t\t\t}\r\n\t\t\tpItem = pItem->getNextSelectable();\r\n\t\t}\r\n\t\tpList = pList->next;\r\n\t}\r\n\r\n\t// 含まれるリストは見つからない\r\n\treturn NULL;\r\n}\r\n\r\nvoid\r\nCKLBTouchEventUIMgr::resetSelectable(CKLBUISelectable * pSelectable)\r\n{\r\n\tfor(int i = 0; i < MAX_TOUCH_POINT; i++) {\r\n\t\tif(m_pTarget[i] == pSelectable) {\r\n\t\t\tm_pTarget[i] = 0;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBTouchEventUIMgr::processUI()\r\n{\r\n\t// bool started = false;\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\r\n#ifdef LOG_EVENT\r\n\ttpq.setProcessing(true);\r\n#endif\r\n\ttpq.startItem();\r\n\r\n\tconst PAD_ITEM * item;\r\n\tfloat xf;\r\n\tfloat yf;\r\n\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\r\n\tu32 tapMask = 0;\r\n\r\n\twhile ((item = tpq.getItem()) != NULL)\r\n\t{\r\n#ifdef LOG_EVENT\r\n\t\tif (!started) {\r\n\t\t\tstarted = true;\r\n\t\t\tDEBUG_PRINT(\"EventS\");\r\n\t\t}\r\n\t\tDEBUG_PRINT(\"EventP:%i,%i,%i,%i\",item->id, item->type, item->x, item->y);\r\n#endif\r\n\r\n//\t\tif ((item->type == PAD_ITEM::RELEASE) || (item->type == PAD_ITEM::TAP)) {\r\n\t\t\txf = (float)item->x;\r\n\t\t\tyf = (float)item->y;\r\n\r\n\t\t\tu32 msk = 1 << item->id;\r\n\r\n\t\t\tswitch(item->type)\r\n\t\t\t{\r\n\t\t\tcase PAD_ITEM::TAP:\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((tapMask & msk) != 0) {  \r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tCKLBUISelectable * hitObj = CKLBUISystem::hitTest(xf, yf);\r\n\t\t\t\t\tif(hitObj) {\r\n\t\t\t\t\t\t// そのコントロールが含まれるフォーム情報を得る\r\n\t\t\t\t\t\tSFormCtrlList * pList = searchCtrl(hitObj);\r\n\t\t\t\t\t\tif(pList) {\r\n\t\t\t\t\t\t\t// そのコントロールが操作禁止状態にあれば、\r\n\t\t\t\t\t\t\t// 操作イベントを無視する。\r\n\t\t\t\t\t\t\tif(!pList->bEnable) {\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// そのフォームが排他コントロールフォームであり、\r\n\t\t\t\t\t\t\t// なおかつ同じフォームに含まれる他のコントロールが操作中であるならば\r\n\t\t\t\t\t\t\t// その操作はなかったことにする。\r\n\t\t\t\t\t\t\tif(fGrp.isWorking(pList)) break;\r\n\t\t\t\t\t\t\tfGrp.setWorking(pList, true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tCKLBAction action;\r\n\t\t\t\t\t\tif (hitObj->isVisible()) {\r\n\t\t\t\t\t\t\tm_pTarget[item->id] = hitObj;\r\n\t\t\t\t\t\t\tm_tapPos[item->id].x = item->x;\r\n\t\t\t\t\t\t\tm_tapPos[item->id].y = item->y;\r\n\r\n\t\t\t\t\t\t\tif (hitObj->isEnabled()) {\r\n\t\t\t\t\t\t\t\taction.m_actionType = ACTION_PUSH;\r\n\t\t\t\t\t\t\t\thitObj->processAction(&action);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\ttpq.useItem(item, hitObj);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((tapMask & msk) != 0) {  \r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// そのドラッグに使用されているポイントのIDがこのタスクで補足中の\r\n\t\t\t\t\t// ポイントである場合、その位置をタップ時の位置と比較し、\r\n\t\t\t\t\t// 移動量が一定の閾値以上であれば、そのコントロールへの操作を\r\n\t\t\t\t\t// キャンセル扱いにする\r\n\t\t\t\t\tif(m_pTarget[item->id]) {\r\n\r\n\t\t\t\t\t\t// 現在補足中のドラッグ操作であるので、イベントをマークする\r\n\t\t\t\t\t\tCKLBUISelectable * hitObj = m_pTarget[item->id];\r\n\t\t\t\t\t\ttpq.useItem(item, hitObj);\r\n\r\n\t\t\t\t\t\t// 補足中のID:タップ位置からの移動量を求める。\r\n\t\t\t\t\t\tint mv_x = item->x - m_tapPos[item->id].x;\r\n\t\t\t\t\t\tint mv_y = item->y - m_tapPos[item->id].y;\r\n\t\t\t\t\t\tint ax = (mv_x < 0) ? -mv_x : mv_x;\r\n\t\t\t\t\t\tint ay = (mv_y < 0) ? -mv_y : mv_y;\r\n\r\n\t\t\t\t\t\t// 移動量が閾値を超えていれば、もはやクリック操作ではない。\r\n\t\t\t\t\t\tif(ax > MV_BORDER || ay > MV_BORDER) {\r\n\t\t\t\t\t\t\t// タップされていたターゲットのフォーム情報を得る\r\n\t\t\t\t\t\t\tSFormCtrlList * pList = searchCtrl(hitObj);\r\n\r\n\t\t\t\t\t\t\tCKLBAction action;\r\n\t\t\t\t\t\t\taction.m_actionType = ACTION_UNDEF;\r\n\t\t\t\t\t\t\tif (hitObj->isEnabled()) {\r\n\t\t\t\t\t\t\t\thitObj->processAction(&action);\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// ターゲットのリストが無ければ補足中のIDをキャンセルする\r\n\t\t\t\t\t\t\t// あるいは、すでに対象フォームが disable にされていたらキャンセル。\r\n\t\t\t\t\t\t\tif(!pList || !pList->bEnable) {\r\n\t\t\t\t\t\t\t\tif(pList) fGrp.setWorking(pList, false);\r\n\t\t\t\t\t\t\t\tm_pTarget[item->id] = 0;\r\n\t\t\t\t\t\t\t\t// その他、キャンセル処理があればここに書く。\r\n\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// DRAGのコールバックが指定されていたら基点と移動量を与えて呼び出す\r\n\t\t\t\t\t\t\t\tif(pList->pCallbackIF) {\r\n\t\t\t\t\t\t\t\t\tpList->pCallbackIF->callback(item->type, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].x,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmv_x, mv_y);\r\n\t\t\t\t\t\t\t\t} else if(pList->nativeCallback) {\r\n\t\t\t\t\t\t\t\t\tpList->nativeCallback(pList->pID,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titem->type,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].x,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmv_x, mv_y);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase PAD_ITEM::RELEASE:\r\n\t\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((tapMask & msk) != 0) {  \r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttapMask |= msk;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tCKLBUISelectable * hitObj = 0; // CKLBUISystem::hitTest(xf, yf);\r\n\t\t\t\t\tif(m_pTarget[item->id]) hitObj = m_pTarget[item->id];\r\n\r\n\t\t\t\t\tif(hitObj) {\r\n\t\t\t\t\t\t// そのコントロールが含まれるフォーム情報を得る\r\n\t\t\t\t\t\tSFormCtrlList * pList = searchCtrl(hitObj);\r\n\t\t\t\t\t\tif(pList) fGrp.setWorking(pList, false);\r\n\r\n\t\t\t\t\t\tint mv_x = item->x - m_tapPos[item->id].x;\r\n\t\t\t\t\t\tint mv_y = item->y - m_tapPos[item->id].y;\r\n\t\t\t\t\t\tint ax = (mv_x < 0) ? -mv_x : mv_x;\r\n\t\t\t\t\t\tint ay = (mv_y < 0) ? -mv_y : mv_y;\r\n\r\n\t\t\t\t\t\t// 移動量が閾値を超えていれば、もはやクリック操作ではない。\r\n\t\t\t\t\t\tif(ax > MV_BORDER || ay > MV_BORDER) {\r\n\t\t\t\t\t\t\tCKLBAction action;\r\n\t\t\t\t\t\t\taction.m_actionType = ACTION_UNDEF;\r\n\t\t\t\t\t\t\tif (hitObj->isEnabled()) {\r\n\t\t\t\t\t\t\t\thitObj->processAction(&action);\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t// DRAGのコールバックが指定されていたら基点と移動量を与えて呼び出す\r\n\t\t\t\t\t\t\tif(pList && pList->pCallbackIF) {\r\n\t\t\t\t\t\t\t\tpList->pCallbackIF->callback(item->type, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].x,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmv_x, mv_y);\r\n\t\t\t\t\t\t\t} else if(pList->nativeCallback) {\r\n\t\t\t\t\t\t\t\tpList->nativeCallback(pList->pID,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\titem->type,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].x,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tm_tapPos[item->id].y,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmv_x, mv_y);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// あまり動かずにリリースされたので、\r\n\t\t\t\t\t\t\t// クリック操作とみなす。\r\n\t\t\t\t\t\t\tif(!pList || pList->bEnable) {\r\n\t\t\t\t\t\t\t\t// その時点で操作が禁止されていたら、リリースも発行しない。\r\n\t\t\t\t\t\t\t\tCKLBAction action;\r\n\t\t\t\t\t\t\t\taction.m_actionType = ACTION_RELEASE;\r\n\t\t\t\t\t\t\t\tif (hitObj->isEnabled()) {\r\n\t\t\t\t\t\t\t\t\thitObj->processAction(&action);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttpq.useItem(item, hitObj);\r\n\t\t\t\t\t\tm_pTarget[item->id] = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t/*\r\n\t\t\tCKLBUISelectable* hitObj = CKLBUISystem::hitTest(xf, yf);\r\n\r\n\t\t\tif (hitObj) {\r\n\t\t\t\tCKLBAction action;\r\n\t\t\t\tif (item->type == PAD_ITEM::RELEASE) {\r\n\t\t\t\t\taction.m_actionType\t= ACTION_RELEASE;\r\n\t\t\t\t} else if (item->type == PAD_ITEM::TAP) {\r\n\t\t\t\t\taction.m_actionType = ACTION_PUSH;\r\n\t\t\t\t} else {\r\n\t\t\t\t\taction.m_actionType\t= ACTION_UNDEF;\r\n\t\t\t\t}\r\n\r\n\t\t\t\thitObj->processAction(&action);\r\n\t\t\t\ttpq.useItem(item, hitObj);\r\n\t\t\t}\r\n\t\t\t*/\r\n//\t\t}\r\n\t}\r\n\r\n#ifdef LOG_EVENT\r\n\tif (started) {\r\n\t\tDEBUG_PRINT(\"EventE\");\r\n\t} else {\r\n\t\tDEBUG_PRINT(\"EventF\");\r\n\t}\r\n\ttpq.setProcessing(false);\r\n#endif\r\n}\r\n\r\n\r\nCKLBTouchEventUITask::CKLBTouchEventUITask() : CKLBTask() {}\r\nCKLBTouchEventUITask::~CKLBTouchEventUITask() {}\r\n\r\nCKLBTouchEventUITask *\r\nCKLBTouchEventUITask::create()\r\n{\r\n\tCKLBTouchEventUITask * pTask = KLBNEW(CKLBTouchEventUITask);\r\n\tif(!pTask) return NULL;\r\n\tif(!pTask->init()) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nvoid\r\nCKLBTouchEventUITask::execute(u32 /*deltaT*/)\r\n{\r\n\tCKLBTouchEventUIMgr& mgr = CKLBTouchEventUIMgr::getInstance();\r\n\r\n\tmgr.processUI();\r\n}\r\n\r\nvoid\r\nCKLBTouchEventUITask::die()\r\n{\r\n\t// Do nothing for now.\r\n}\r\n\r\nu32\r\nCKLBTouchEventUITask::getClassID()\r\n{\r\n\treturn CLS_KLBTASKUIEVENT;\r\n}\r\n\r\nbool\r\nCKLBTouchEventUITask::init()\r\n{\r\n\treturn regist(NULL, P_UIPREV);\r\n}\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBTouchEventUI.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBTouchEventUI_h\r\n#define CKLBTouchEventUI_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CKLBUISystem.h\"\r\n\r\nclass CKLBTouchEventUIMgr\r\n{\r\n\tfriend class CKLBUISystem;\r\nprivate:\r\n\tCKLBTouchEventUIMgr();\r\n\tvirtual ~CKLBTouchEventUIMgr();\r\n\r\npublic:\r\n\tstatic CKLBTouchEventUIMgr& getInstance();\r\n\r\n\tvoid processUI      ();\r\n\tvoid resetSelectable(CKLBUISelectable * pSelectable);\r\n\r\n\tvoid registForm     (SFormCtrlList * pList);\r\n\tvoid removeForm     (SFormCtrlList * pList);\r\n\tSFormCtrlList * searchCtrl(CKLBUISelectable * pCtrl);\r\n\r\n\tenum {\r\n\t\tMAX_TOUCH_POINT = 10,\r\n\t\tMV_BORDER = 20\t// TAPからこのpixel数以上DRAGしたら、クリック操作ではないと判断\r\n\t};\r\nprivate:\r\n\t// 現在稼働中のフォームごとに、各フォームのコントロールリストが登録される。\r\n\tSFormCtrlList\t\t*\tm_pFormBegin;\r\n\r\n\tCKLBUISelectable\t*\tm_pTarget[ MAX_TOUCH_POINT ];\r\n\tstruct {\r\n\t\tint x;\r\n\t\tint y;\r\n\t} m_tapPos[ MAX_TOUCH_POINT ];\r\n};\r\n\r\n\r\n/*!\r\n* \\class CKLBTouchEventUITask\r\n* \\brief Touch Event handler task class.\r\n* \r\n* CKLBTouchEventUITask is in charge of handling the various touch events \r\n* of the game and redistribute it to the right item. \r\n* Forms can be registered in order to be able to process some actions \r\n* on Touch Pad events.\r\n* This task is instanciated when the game starts.\r\n*/\r\nclass CKLBTouchEventUITask : public CKLBTask\r\n{\r\nprivate:\r\n\tCKLBTouchEventUITask();\r\n\tvirtual ~CKLBTouchEventUITask();\r\n\r\npublic:\r\n\tstatic CKLBTouchEventUITask * create();\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tu32 getClassID();\r\n\r\nprivate:\r\n\tbool init();\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBTouchPad.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBTouchPad.cpp\r\n//\r\n\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nCKLBTouchPadQueue::CKLBTouchPadQueue()\r\n\t: m_begin(0), m_read(0), m_rec(0), m_get(0), m_bDoingProcess(false), m_ignoreOutScreen(false), m_maskIgnoreFinger(0)\r\n{\r\n    float matrix[6] = {\r\n        1.0f, 0.0f, 0.0f,\r\n        0.0f, 1.0f, 0.0f\r\n    };\r\n    setConvertMatrix(matrix);\r\n}\r\nCKLBTouchPadQueue::~CKLBTouchPadQueue() {}\r\n\r\nCKLBTouchPadQueue&\r\nCKLBTouchPadQueue::getInstance() {\r\n    static CKLBTouchPadQueue instance;\r\n    return instance;\r\n}\r\n\r\nvoid\r\nCKLBTouchPadQueue::addQueue(int id, IClientRequest::INPUT_TYPE gtype, int x, int y)\r\n{\r\n\tint next = m_rec+1;\r\n\tif (next >= QUEUE_SIZE) { next = 0; }\r\n\r\n    // 一つ手前なので記録上限と看做す\r\n    if(next == m_read) return;\r\n\r\n    PAD_ITEM::TYPE type = (PAD_ITEM::TYPE)gtype;\r\n\r\n    m_itemQueue[m_rec].id = id;\r\n    m_itemQueue[m_rec].type = type;\r\n\tint xp = (int)(m_matrix[0] * x + m_matrix[3] * y + m_matrix[2]);\r\n\tint yp = (int)(m_matrix[1] * x + m_matrix[4] * y + m_matrix[5]);\r\n\tm_itemQueue[m_rec].locker = 0;\r\n\r\n\tif (m_ignoreOutScreen) {\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t\tbool outsideScreen = (xp < 0) || (yp < 0) || (xp >= draw.width()) || (yp >= draw.height());\r\n\r\n\t\tswitch (type) {\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\tif (outsideScreen) {\r\n\t\t\t\tm_maskIgnoreFinger |= 1<<id;\r\n\t\t\t\tnext = m_rec; // Cancel current event.\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\tif (m_maskIgnoreFinger & (1<<id)) {\r\n\t\t\t\tnext = m_rec; // Cancel drag event\r\n\t\t\t} else {\r\n\t\t\t\tif (xp < 0) {\r\n\t\t\t\t\txp = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (xp >= draw.width()) {\r\n\t\t\t\t\txp = draw.width() - 1;\r\n\t\t\t\t}\r\n\t\t\t\tif (yp < 0) {\r\n\t\t\t\t\typ = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (yp >= draw.height()) {\r\n\t\t\t\t\typ = draw.height() - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\t\tif (m_maskIgnoreFinger & (1<<id)) {\r\n\t\t\t\tnext = m_rec; // Cancel release event and remove the flag.\r\n\t\t\t} else {\r\n\t\t\t\tif (xp < 0) {\r\n\t\t\t\t\txp = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (xp >= draw.width()) {\r\n\t\t\t\t\txp = draw.width() - 1;\r\n\t\t\t\t}\r\n\t\t\t\tif (yp < 0) {\r\n\t\t\t\t\typ = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (yp >= draw.height()) {\r\n\t\t\t\t\typ = draw.height() - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_maskIgnoreFinger &= ~(1<<id);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tm_itemQueue[m_rec].x = xp;\r\n    m_itemQueue[m_rec].y = yp;\r\n\r\n#ifdef LOG_EVENT\r\n\tif (m_bDoingProcess) {\r\n\t\tDEBUG_PRINT(\"Event1:%i,%i,%i,%i\", id, type, m_itemQueue[m_rec].x, m_itemQueue[m_rec].y);\r\n\t} else {\r\n\t\tDEBUG_PRINT(\"Event0:%i,%i,%i,%i\", id, type, m_itemQueue[m_rec].x, m_itemQueue[m_rec].y);\r\n\t}\r\n#endif\r\n    m_rec = next;\r\n}\r\n\r\nvoid\r\nCKLBTouchPadQueue::setConvertMatrix(float *matrix)\r\n{\r\n    int i;\r\n    for(i = 0; i < 6; i++) m_matrix[i] = matrix[i];\r\n}\r\n\r\n\r\nCKLBTouchPad::CKLBTouchPad() : CKLBTask() {}\r\nCKLBTouchPad::~CKLBTouchPad() {}\r\n\r\nbool\r\nCKLBTouchPad::onPause(bool /*bPause*/)\r\n{\r\n\treturn false;\r\n}\r\n\r\nCKLBTouchPad *\r\nCKLBTouchPad::create()\r\n{\r\n    CKLBTouchPad * pTask = KLBNEW(CKLBTouchPad);\r\n\tif (pTask) {\r\n\t\tpTask->regist(NULL, P_INPUT);    // 入力タスクは必ず入力フェーズに指定する。\r\n\t}\r\n    return pTask;\r\n}\r\n\r\nvoid\r\nCKLBTouchPad::execute(u32)\r\n{\r\n    // そのフレームでどこからどこまでを取得できるか決定\r\n    CKLBTouchPadQueue::getInstance().fixLimit();\r\n}\r\n\r\nvoid\r\nCKLBTouchPad::die() {}\r\n\r\nu32\r\nCKLBTouchPad::getClassID()\r\n{\r\n\treturn CLS_KLBTASKTOUCHPAD;\r\n}\r\n"
  },
  {
    "path": "Engine/source/SystemTask/CKLBTouchPad.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBTouchPad.h\r\n//\r\n\r\n#ifndef CKLBTouchPad_h\r\n#define CKLBTouchPad_h\r\n\r\n#include \"CKLBTask.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n// #define\tLOG_EVENT\r\n\r\ntypedef struct {\r\n    typedef enum {\r\n        TAP,\r\n        DRAG,\r\n        RELEASE,\r\n\t\tCANCEL\r\n    } TYPE;\r\n\r\n    TYPE    type;\r\n    int     id;     // 入力点ID(multi touch 対応)\r\n    int     x;\r\n    int     y;\r\n\tvoid\t* locker;\t// 入力の使用者\r\n} PAD_ITEM;\r\n\r\n// タッチパッドキュークラス。\r\n// 基本的に、本体を正位置に構えた状態での座標のみを提供する。\r\n// 本体を回転させて使う際の座標変換は、各ゲームの責任において行うものとする。\r\nclass CKLBTouchPadQueue\r\n{\r\nprivate:\r\n    CKLBTouchPadQueue();\r\n    ~CKLBTouchPadQueue();\r\npublic:\r\n    static CKLBTouchPadQueue& getInstance();\r\n\r\n    // キューに入力アイテムを追加(システム側からアイテムを追加する際に使用)\r\n    void addQueue(int id, IClientRequest::INPUT_TYPE type, int x, int y);\r\n    \r\n    // 座標変換マトリクスを設定する\r\n    void setConvertMatrix(float * matrix);\r\n    \r\n    // キューの取得限界を現在の点に固定\r\n    inline void fixLimit() {\r\n        m_read = m_begin;\r\n        m_begin = m_rec;\r\n    }\r\n\r\n    // キューの参照点を読み出し先頭に指定する\r\n    void startItem() {\r\n        m_get = m_read;\r\n    }\r\n\r\n\tinline void setProcessing(bool process) {\r\n\t\tm_bDoingProcess = process;\r\n\t}\r\n    \r\n    // キューのアイテムを参照する\r\n    const PAD_ITEM * getItem(bool bAll = false) {\r\n\t\tconst PAD_ITEM * ret;\r\n\t\tdo {\r\n\t\t\tif(m_get == m_begin) return 0;  // これ以上読んではいけない\r\n\t\t\tret = m_itemQueue + m_get;\r\n\t        m_get = ++m_get % QUEUE_SIZE;\r\n\t\t} while(!bAll && ret->locker);\t// 既に使用済アイテムであれば次を読む(bAll == false の場合)\r\n\t\t\r\n\t\t// bAll が true の場合、マークされたイベントであっても取得する。\r\n        return ret;\r\n    }\r\n\r\n\t// アイテムに使用済みマークをつける。\r\n\tinline bool useItem(const PAD_ITEM * item, void * pUser) {\r\n\t\tif(item->locker) return false;\r\n\t\tPAD_ITEM * val = (PAD_ITEM *)item;\r\n\t\tval->locker = pUser;\r\n\t\treturn true;\r\n\t}\r\n\r\n\tvoid setIgnoreOutside(bool ignore) {\r\n\t\tm_ignoreOutScreen\t= ignore;\r\n\t\tm_maskIgnoreFinger\t= 0; // Reset all fingers.\r\n\t}\r\n\r\nprivate:\r\n\tbool\t\t\tm_bDoingProcess;\r\n    float           m_matrix[6];    // 座標変換マトリクス\r\n    \r\n    int             m_begin;        // 記録先頭\r\n    int             m_rec;          // 記録点\r\n    int             m_read;         // 読み出し先頭\r\n    int             m_get;          // 取得点\r\n\tu32\t\t\t\tm_maskIgnoreFinger;\r\n\tbool\t\t\tm_ignoreOutScreen;\r\n    \r\n    enum {\r\n        QUEUE_SIZE = 1024\r\n    };\r\n    \r\n    PAD_ITEM    m_itemQueue[ QUEUE_SIZE ];\r\n};\r\n\r\n/*!\r\n* \\class CKLBTouchPad\r\n* \\brief Touch Pad Events handler class\r\n* \r\n* CKLBTouchPad is similar to CKLBOSCtrlEvent, but only handles Touch Pad events.\r\n* It owns a queue of Touch Pad events.\r\n* This task is instanciated once when the game starts.\r\n*/\r\nclass CKLBTouchPad : public CKLBTask\r\n{\r\nprivate:\r\n    CKLBTouchPad();\r\n    virtual ~CKLBTouchPad();\r\n\r\n\tbool onPause(bool bPause);\r\n\r\npublic:\r\n    static CKLBTouchPad * create();\r\n\r\n    void execute(u32 deltaT);\r\n    void die();\r\n\r\n\tu32 getClassID();\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBActivityIndicatorNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBActivityIndicatorNode.cpp\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#include \"CKLBActivityIndicatorNode.h\"\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CKLBLanguageDatabase.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nCKLBActivityIndicatorNode::CKLBActivityIndicatorNode(int show_type)\r\n:nativeInputItem\t(NULL)\r\n,m_width\t\t\t(0)\r\n,m_height\t\t\t(0)\r\n,m_tx\t\t\t\t(0)\r\n,m_ty\t\t\t\t(0)\r\n{\r\n\t//\r\n\t//\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tIWidget::CONTROL control = IWidget::ACTIVITYINDICATOR;\r\n\tnativeInputItem = pForm.createControl(control , 0, \"\", 0, 0, 0, 0);\r\n    \r\n\tklb_assert(nativeInputItem, \"ActivityIndicator allocation failed\");\r\n    \r\n    nativeInputItem->cmd(IWidget::ACT_SET_STYLE, show_type);\r\n}\r\n\r\nCKLBActivityIndicatorNode::~CKLBActivityIndicatorNode() {\r\n\t// Call Interface to release the input box\r\n    \r\n\tif (nativeInputItem) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.destroyControl(nativeInputItem);\r\n\t\tnativeInputItem = NULL;\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBActivityIndicatorNode::recomputeCustom() {\r\n\tif (nativeInputItem) {\r\n\t\tconst SMatrix2D* pMat = &m_composedMatrix;\r\n        \r\n\t\ts32 x = (s32)pMat->m_matrix[MAT_TX];\r\n\t\ts32 y = (s32)pMat->m_matrix[MAT_TY];\r\n        \r\n\t\tif ((m_tx != x) || (m_ty != y)) {\r\n            \r\n\t\t\tint px, py;\r\n\t\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n            \r\n\t\t\tm_tx = x;\r\n\t\t\tm_ty = y;\r\n            \r\n\t\t\tdraw.toPhisicalPosition(x, y, px, py);\r\n\t\t\tnativeInputItem->move(px, py);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid CKLBActivityIndicatorNode::setWidth\t(u32 width) {\r\n\tif (nativeInputItem && (width != m_width)) {\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t\tint pw, ph;\r\n        \r\n\t\tm_width = width;\r\n        \r\n\t\tdraw.toPhisicalSize(m_width, m_height, pw, ph);\r\n\t\tnativeInputItem->resize(pw, ph);\r\n\t}\r\n}\r\n\r\nvoid CKLBActivityIndicatorNode::setHeight\t(u32 height) {\r\n\tif (nativeInputItem && (height != m_height)) {\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\t\tint pw, ph;\r\n        \r\n\t\tm_height = height;\r\n        \r\n\t\tdraw.toPhisicalSize(m_width, m_height, pw, ph);\r\n\t\tnativeInputItem->resize(pw, ph);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBActivityIndicatorNode::setEnabled(bool isEnabled) {\r\n\tCKLBUIElement::setEnabled(isEnabled);\r\n    \r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBActivityIndicatorNode::setUpperEnabled(bool isEnabled) {\r\n\tCKLBUIElement::setUpperEnabled(isEnabled);\r\n    \r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n//\r\n// Visible / Invisible related.\r\n//\r\n/*virtual*/\r\nvoid CKLBActivityIndicatorNode::addRender() {\r\n\tCKLBUIElement::addRender();\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(true);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBActivityIndicatorNode::removeRender() {\r\n\tCKLBUIElement::removeRender();\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBActivityIndicatorNode::setAsset(CKLBAsset* /*pAsset*/, ASSET_TYPE /*mode*/) {\r\n\t// Do nothing, no asset display.\r\n}\r\n\r\n/*virtual*/\r\nbool CKLBActivityIndicatorNode::processAction\t(CKLBAction* /*pAction*/) {\r\n\t// Do nothing for now, may implement call back.\r\n\treturn false;\r\n}\r\n\r\nvoid CKLBActivityIndicatorNode::setText(const char* text) {\r\n\tif (nativeInputItem) {\r\n\t\ttext = CKLBLanguageDatabase::getInstance().getString(text);\r\n\t\tnativeInputItem->setText(text);\r\n\t}\r\n}\r\n\r\nconst char*\tCKLBActivityIndicatorNode::getText() {\r\n\treturn NULL;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBActivityIndicatorNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBActivityIndicatorNode.h\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#ifndef CKLBActivityIndicatorNode_h\r\n#define CKLBActivityIndicatorNode_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBActivityIndicatorNode\r\n* \\brief Activity Indicator Specializec Node Class\r\n* \r\n* \r\n*/\r\nclass CKLBActivityIndicatorNode : public CKLBUIElement\r\n{\r\npublic:\r\n\tCKLBActivityIndicatorNode (int show_type);\r\n\t~CKLBActivityIndicatorNode();\r\n    \r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBACTIVITYINDICATORNODE; }\r\n    \r\n\t// KLBNode::\r\n\tvirtual\r\n\tvoid\trecomputeCustom\t\t();\r\n    \r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n    \r\n\tvirtual bool isSelectable   ()          { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n    \r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n    \r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t        { return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t        { return m_height;\t}\r\n    \r\n    inline IWidget * getWidget  () const    { return nativeInputItem; }\r\n    \r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n    \r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual\r\n\tvoid\taddRender\t\t\t();\r\n\tvirtual\r\n\tvoid\tremoveRender\t\t();\r\n    \r\n\tIWidget * nativeInputItem;\r\n\tu32\t\tm_width;\r\n\tu32\t\tm_height;\r\n\ts32\t\tm_tx;\r\n\ts32\t\tm_ty;\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBDragCallbackIF.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBDragCallbackIF.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\nCKLBDragCallbackIF::CKLBDragCallbackIF(const char * funcname)\r\n{\r\n\tm_funcname = CKLBUtility::copyString(funcname);\r\n}\r\n\r\nCKLBDragCallbackIF::~CKLBDragCallbackIF()\r\n{\r\n\tKLBDELETEA(m_funcname);\r\n}\r\n\r\nvoid\r\nCKLBDragCallbackIF::execCallback(void * id, PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y)\r\n{\r\n\tCKLBScriptEnv::getInstance().call_eventDragIF(m_funcname, (CKLBObjectScriptable*)id, type, tap_x, tap_y, mv_x, mv_y);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBDragCallbackIF.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBDragCallbackIF_h\r\n#define CKLBDragCallbackIF_h\r\n\r\n#include \"CKLBTouchPad.h\"\r\n\r\nclass CKLBDragCallbackIF\r\n{\r\npublic:\r\n\tCKLBDragCallbackIF(const char * funcname);\r\n\tvirtual ~CKLBDragCallbackIF();\r\n\r\n\tvirtual void callback(PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y) = 0;\r\n\r\nprotected:\r\n\tvoid execCallback(void * id, PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y);\r\n\r\nprivate:\r\n\tconst char\t*\tm_funcname;\r\n};\r\n\r\n#endif // CKLBUIDragCallback_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBFormGroup.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\n\r\nCKLBFormGroup::CKLBFormGroup() : m_begin(NULL), m_end(NULL) {}\r\nCKLBFormGroup::~CKLBFormGroup()\r\n{\r\n\trelease();\r\n}\r\n\r\nCKLBFormGroup&\r\nCKLBFormGroup::getInstance()\r\n{\r\n\tstatic CKLBFormGroup instance;\r\n\treturn instance;\r\n}\r\n\r\nvoid\r\nCKLBFormGroup::release()\r\n{\r\n\tGROUP * pGrp = m_begin;\r\n\r\n\twhile(pGrp) {\r\n\t\tGROUP * pNxt = pGrp->next;\r\n\r\n\t\tSFormCtrlList * pCtrl = pGrp->begin;\r\n\t\twhile(pCtrl) {\r\n\t\t\tSFormCtrlList * pCtrlNext = pCtrl->pGrpNext;\r\n\t\t\tdelForm(pCtrl);\r\n\t\t\tpCtrl = pCtrlNext;\r\n\t\t}\r\n\t\tpGrp = pNxt;\r\n\t}\r\n}\r\n\r\n\r\nbool\r\nCKLBFormGroup::addForm(SFormCtrlList * list, const char * group_name)\r\n{\r\n\t// 指定されたコントロールリストがすでにどこかのグループに属していれば、一旦除外する\r\n\tdelForm(list);\r\n\r\n\t// 新たに所属させるべきグループを得る。\r\n\tGROUP * pGrp = createGroup(group_name);\r\n\tif(!pGrp) return false;\r\n\r\n\t// リストをグループに所属させる\r\n\tlist->pGroup = (void *)pGrp;\r\n\tlist->pGrpPrev = pGrp->end;\r\n\tlist->pGrpNext = NULL;\r\n\r\n\tif(list->pGrpPrev) {\r\n\t\tlist->pGrpPrev->pGrpNext = list;\r\n\t} else {\r\n\t\tpGrp->begin = list;\r\n\t}\r\n\tpGrp->end = list;\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBFormGroup::delForm(SFormCtrlList * list)\r\n{\r\n\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\tif(!pGrp) return true;\r\n\r\n\tif(pGrp->worker == list && pGrp->working) {\r\n\t\tpGrp->working = false;\r\n\t}\r\n\t// フォームを完全にグループから除外する\r\n\tif(list->pGrpPrev) {\r\n\t\tlist->pGrpPrev->pGrpNext = list->pGrpNext;\r\n\t} else {\r\n\t\tpGrp->begin = list->pGrpNext;\r\n\t}\r\n\tif(list->pGrpNext) {\r\n\t\tlist->pGrpNext->pGrpPrev = list->pGrpPrev;\r\n\t} else {\r\n\t\tpGrp->end = list->pGrpPrev;\r\n\t}\r\n\tlist->pGrpNext = NULL;\r\n\tlist->pGrpPrev = NULL;\r\n\tlist->pGroup = NULL;\r\n\r\n\t// 結果としてグループに所属するフォームが無くなることがあるので、\r\n\t// その場合はグループそのものを削除する\r\n\tcheckGroup(pGrp);\r\n\treturn true;\r\n}\r\n\r\n// 既存のグループから指定された名称のものを探す。\r\n// なければ 0(NULL)を返す。\r\nCKLBFormGroup::GROUP *\r\nCKLBFormGroup::searchGroup(const char * group_name)\r\n{\r\n\tGROUP * pGrp = m_begin;\r\n\twhile(pGrp) {\r\n\t\tif(!CKLBUtility::safe_strcmp(pGrp->name, group_name)) return pGrp;\r\n\t\tpGrp = pGrp->next;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n// 指定された名称のグループが無ければ生成する。\r\n// 既に存在すれば既存のポインタを返す。\r\nCKLBFormGroup::GROUP *\r\nCKLBFormGroup::createGroup(const char * group_name)\r\n{\r\n\tGROUP * pGrp = searchGroup(group_name);\r\n\tif(pGrp) return pGrp;\t// 既にある場合は流用する\r\n\r\n\tpGrp = KLBNEW(GROUP);\r\n\tif(!pGrp) return NULL;\r\n\r\n\tpGrp->prev = m_end;\r\n\tpGrp->next = NULL;\r\n\r\n\tif(m_begin) {\r\n\t\tm_end->next = pGrp;\r\n\t} else {\r\n\t\tm_begin = pGrp;\r\n\t}\r\n\tm_end = pGrp;\r\n\r\n\tpGrp->name = CKLBUtility::copyString(group_name);\r\n\tpGrp->exclusive = true;\r\n\tpGrp->begin = NULL;\r\n\tpGrp->end = NULL;\r\n\r\n\treturn pGrp;\r\n}\r\n\r\nvoid\r\nCKLBFormGroup::checkGroup(GROUP * pGrp)\r\n{\r\n\t// 登録されたフォームが一つもなければ、このグループ自体を削除する。\r\n\tif(pGrp->begin || pGrp->end) return;\r\n\r\n\tKLBDELETEA(pGrp->name);\r\n\tif(pGrp->prev) {\r\n\t\tpGrp->prev->next = pGrp->next;\r\n\t} else {\r\n\t\tm_begin = pGrp->next;\r\n\t}\r\n\tif(pGrp->next) {\r\n\t\tpGrp->next->prev = pGrp->prev;\r\n\t} else {\r\n\t\tm_end = pGrp->prev;\r\n\t}\r\n\tKLBDELETE(pGrp);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBFormGroup.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBFormGroup_h\r\n#define CKLBFormGroup_h\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\nclass CKLBFormGroup\r\n{\r\nprivate:\r\n\tCKLBFormGroup();\r\n\tvirtual ~CKLBFormGroup();\r\npublic:\r\n\tstatic CKLBFormGroup& getInstance();\r\n\r\n\tvoid release();\r\n\r\n\tbool addForm(SFormCtrlList * list, const char * group_name);\r\n\tbool delForm(SFormCtrlList * list);\r\n\r\n\tinline bool isExclusive(SFormCtrlList * list) {\r\n\t\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\t\tbool grpEx = (pGrp) ? true : false;\r\n\t\treturn list->bExclusive || grpEx;\r\n\t}\r\n\r\n\tinline bool isWorking(SFormCtrlList * list, void * locker = NULL) {\r\n\t\tif(list->bExclusive && list->bWorking) return true;\r\n\t\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\t\tif(pGrp && pGrp->working) {\r\n\t\t\tif(!locker || locker != pGrp->locker) return true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tinline void setWorking(SFormCtrlList * list, bool working, void * locker = NULL) {\r\n\t\tif(list->bExclusive) list->bWorking = working;\r\n\t\tGROUP * pGrp = (GROUP *)list->pGroup;\r\n\t\tif(pGrp) {\r\n\t\t\tpGrp->working = working;\r\n\t\t\tpGrp->locker = (working) ? locker : NULL;\r\n\t\t\tpGrp->worker = (working) ? list   : NULL;\r\n\t\t}\r\n\t}\r\n\r\nprivate:\r\n\tstruct GROUP {\r\n\t\tGROUP\t\t*\tprev;\r\n\t\tGROUP\t\t*\tnext;\r\n\r\n\t\t// グループの持つ属性\r\n\t\tconst char\t*\tname;\r\n\t\tbool\t\t\texclusive;\t// 排他制御(trueで排他)\r\n\t\tbool\t\t\tworking;\t// 操作中\r\n\t\tvoid\t\t*\tlocker;\t\t// ロックした者の識別子(ポインタ)\r\n\r\n\t\tSFormCtrlList\t*\tworker;\r\n\r\n\t\t// グループ所属のコントロールリスト構造体リスト(「リスト」が多くてめんどくさい)\r\n\t\tSFormCtrlList\t*\tbegin;\r\n\t\tSFormCtrlList\t*\tend;\r\n\t};\r\n\r\n\tGROUP * searchGroup(const char * group_name);\r\n\tGROUP * createGroup(const char * group_name);\r\n\tvoid    checkGroup(GROUP * pGrp);\r\n\r\n\tGROUP\t\t*\tm_begin;\r\n\tGROUP\t\t*\tm_end;\r\n};\r\n\r\n#endif // CKLBFormGroup_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBFormIF.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBFormIF.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n#include \"CKLBWebViewNode.h\"\r\n#include \"CKLBLabelNode.h\"\r\n#include \"CKLBUITextInput.h\"\r\n#include \"CKLBUILabel.h\"\r\n#include \"CKLBUIWebArea.h\"\r\n;\r\nCKLBFormIF::CKLBFormIF(CKLBTask * pOwner) : m_begin(NULL), m_end(NULL), m_pOwner(pOwner) {}\r\nCKLBFormIF::~CKLBFormIF()\r\n{\r\n\t// 破棄されるまでに保持された asset は自前で破棄する\r\n\t/*\r\n\tFORM_ASSET * pItem = m_begin;\r\n\twhile(pItem) {\r\n\t\tFORM_ASSET * next = pItem->next;\r\n\t\tCKLBDataHandler::releaseHandle(pItem->handle);\r\n\t\tKLBDELETE(pItem);\r\n\t\tpItem = next;\r\n\t}\r\n\t*/\r\n}\r\n\r\nCKLBAsset *\r\nCKLBFormIF::updateAsset(CLuaState& /*lua*/, CKLBUIElement * pElement, const char * assetName, CKLBUIElement::ASSET_TYPE\tmode, void * /*item*/)\r\n{\r\n\tCKLBAsset * pAsset;\r\n\tif (assetName) {\r\n\t\tpAsset = CKLBUtility::loadAsset(assetName, NULL, NULL);\r\n\t\tif(!pAsset) return NULL;\r\n\t} else {\r\n\t\tpAsset = NULL;\r\n\t}\r\n\r\n\t/*\r\n\t// 同じAsset を同じ Element が持っていた場合は何もせず終了\r\n\tFORM_ASSET * pItem;\r\n\tfor(pItem = m_begin; pItem != 0; pItem = pItem->next) {\r\n\t\tif(pItem->node != pElement) continue;\r\n\t\tif(pItem->asset == pAsset && pItem->mode == mode) {\r\n\t\t\t// 全く同じノードに全く同じ asset を設定しようとしたので、何もしない\r\n\t\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t\t\treturn pAsset;\r\n\t\t}\r\n\t\t// 今assetを指定しようとしているノードが別のassetを割り当てられているので、\r\n\t\t// まずはこれを解放する\r\n\t\tbreak;\r\n\t}*/\r\n\r\n\tpElement->setAsset(pAsset, mode);\r\n\r\n\t/*\r\n\t// 以前に同じ node/mode に asset を設定していた項目があれば破棄\r\n\tif(pItem) {\r\n\t\tif(pItem->prev) {\r\n\t\t\tpItem->prev->next = pItem->next;\r\n\t\t} else {\r\n\t\t\tm_begin = pItem->next;\r\n\t\t}\r\n\t\tif(pItem->next) {\r\n\t\t\tpItem->next->prev = pItem->prev;\r\n\t\t} else {\r\n\t\t\tm_end = pItem->prev;\r\n\t\t}\r\n\t\tCKLBDataHandler::releaseHandle(pItem->handle);\r\n\t\tKLBDELETE(pItem);\r\n\t}\r\n\tpItem = KLBNEW(FORM_ASSET);\r\n\tpItem->node = pElement;\r\n\tpItem->asset = pAsset;\r\n\tpItem->handle = handle;\r\n\tpItem->item = item;\r\n\r\n\t// 末尾に追加\r\n\tpItem->next = 0;\r\n\tpItem->prev = m_end;\r\n\tif(pItem->prev) {\r\n\t\tpItem->prev->next = pItem;\r\n\t} else {\r\n\t\tm_begin = pItem;\r\n\t}\r\n\tm_end = pItem;\r\n\t*/\r\n\treturn pAsset;\r\n}\r\n\r\n// 指定されたアイテム向けに差し替えられたassetを破棄する(UI_Listで使用。タスクを生かしたままitemを削除することがあるため)\r\nvoid\r\nCKLBFormIF::removeAssetByHandle(void * /*item*/)\r\n{\r\n\t/*\r\n\tFORM_ASSET * pItem = m_begin;\r\n\twhile(pItem) {\r\n\t\tFORM_ASSET * pNext = pItem->next;\r\n\t\tif(pItem->item == item) {\r\n\t\t\tif(pItem->prev) {\r\n\t\t\t\tpItem->prev->next = pItem->next;\r\n\t\t\t} else {\r\n\t\t\t\tm_begin = pItem->next;\r\n\t\t\t}\r\n\t\t\tif(pItem->next) {\r\n\t\t\t\tpItem->next->prev = pItem->prev;\r\n\t\t\t} else {\r\n\t\t\t\tm_end = pItem->prev;\r\n\t\t\t}\r\n\t\t\tCKLBDataHandler::releaseHandle(pItem->handle);\r\n\t\t\tKLBDELETE(pItem);\r\n\t\t}\r\n\t\tpItem = pNext;\r\n\t}*/\r\n}\r\n\r\nbool\r\nCKLBFormIF::isExistNode(CKLBNode * pParent, const char * name)\r\n{\r\n\tCKLBNode * pNode = pParent->search(name);\r\n\treturn (pNode) ? true : false;\r\n}\r\n\r\nint\r\nCKLBFormIF::updateNode(CLuaState& lua, int argc, int base, CKLBNode * pParent, int nodeIndex, int subcmd, void * item, int index)\r\n{\r\n\tCKLBNode * pNode = NULL;\r\n\tif(lua.isString(nodeIndex)) {\r\n\t\tconst char * name = lua.getString(nodeIndex);\r\n\t\tif (name) {\r\n\t\t\tpNode = pParent->search(name);\r\n\t\t}\r\n\t\tklb_assert(pNode, \"Node not found: name = \\\"%s\\\"\", name);\r\n\t} else {\r\n\t\tpNode = (CKLBNode *)lua.getPointer(nodeIndex);\r\n\t}\r\n\tint ret = 0;\r\n\r\n\tif(base > argc) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tif (!pNode) {\r\n\t\tlua.retNil();\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tCKLBUITask* pTask\t\t= pNode->getUITask();\r\n\tu32 classID;\r\n\tif (pTask) {\r\n\t\tclassID = pTask->getClassID();\r\n\t} else {\r\n\t\tclassID = pNode->getClassID();\r\n\t}\r\n\r\n\t// 対象のノードによって、可能な操作が異なる。\r\n\tbool result;\r\n\tswitch(classID)\r\n\t{\r\n\tdefault:\t\t\t\t\tresult = updateStandardNode(lua, argc, base, subcmd, pNode, ret, item, index);\tbreak;\r\n\tcase CLS_KLBUIELEMENT:\t\tresult = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);\t\tbreak;\r\n\tcase CLS_KLBUISELECTABLE:\tresult = updateUISelectable(lua, argc, base, subcmd, pNode, ret, item, index);\tbreak;\r\n\tcase CLS_KLBUICONTAINER:\tresult = updateUIContainer(lua, argc, base, subcmd, pNode, ret, item, index);\tbreak;\r\n\tcase CLS_KLBUILABEL:\r\n\tcase CLS_KLBLABEL:\t\t\tresult = updateLabelNode(lua, argc, base, subcmd, pNode, ret, item, index);\t\tbreak;\r\n\tcase CLS_KLBTEXTEDIT:\r\n\tcase CLS_KLBUITEXTINPUT:\tresult = updateUITextEdit(lua, argc, base, subcmd, pNode, ret, item, index);\tbreak;\r\n\tcase CLS_KLBUIWEBVIEW:\r\n\tcase CLS_KLBWEBVIEW:\t\tresult = updateUIWebView(lua, argc, base, subcmd, pNode, ret, item, index);\tbreak;\r\n\t}\r\n\t// ここまでで処理されたコマンドが無い場合、標準コマンドを処理する。\r\n\tif(!result) {\r\n\t\t// コマンドとして解釈できなかったので、falseを返す。\r\n\t\tlua.retBoolean(false);\r\n\t\tret = 1;\r\n\t}\r\n\t// 戻り値に相当するものはすでにLuaスタックに積んであるはずなので、戻り値の数を返す。\r\n\treturn ret;\r\n}\r\n\r\nbool\r\nCKLBFormIF::updateStandardNode(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * /*item*/, int index)\r\n{\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_POINTER:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.retPointer(pNode);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase FORM_NODE_RECURSIVE:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * funcname = lua.getString(base + 1);\t// コールバック名の取得\r\n\t\t\tresult = nodeRecursive(lua, funcname, pNode, index);\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase FORM_NODE_TRANS:\r\n\t\t{\r\n\t\t\tif(argc != (base + 2)) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfloat x = lua.getFloat(base + 1);\r\n\t\t\tfloat y = lua.getFloat(base + 2);\r\n\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\t// Change next frame or current frame.\r\n\t\t\t\tif(pTask->isNewScriptModel()) {\r\n\t\t\t\t\tpTask->setX(x);\r\n\t\t\t\t\tpTask->setY(y);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tint idxX = pTask->findProperty(\"x\");\r\n\t\t\t\t\tint idxY = idxX + 1;\r\n\t\t\t\t\tpTask->setNum(idxX, x);\r\n\t\t\t\t\tpTask->setNum(idxY, y);\r\n\t\t\t\t}\r\n\t\t\t\t// Trick: we modify directly the node AND change the property.\r\n\t\t\t\t// If another property is modified later, it will force the value to be used. \r\n\t\t\t\t// ==> Do not execute pTask->setInnerUpdate();\r\n\t\t\t}\r\n\t\t\t// But changes also RIGHT AWAY\r\n\t\t\tpNode->setTranslate(x, y);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_SCALE:\r\n\t\t{\r\n\t\t\tif(argc != base + 2) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfloat scaleX = lua.getFloat(base + 1);\r\n\t\t\tfloat scaleY = lua.getFloat(base + 2);\r\n\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\tif(pTask->isNewScriptModel()) {\r\n\t\t\t\t\tpTask->setScaleX(scaleX);\r\n\t\t\t\t\tpTask->setScaleY(scaleY);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tint idxX = pTask->findProperty(\"scaleX\");\r\n\t\t\t\t\tint idxY = idxX + 1;\r\n\t\t\t\t\tpTask->setNum(idxX, scaleX);\r\n\t\t\t\t\tpTask->setNum(idxY, scaleY);\r\n\t\t\t\t}\r\n\t\t\t\t// Trick: we modify directly the node AND change the property.\r\n\t\t\t\t// If another property is modified later, it will force the value to be used. \r\n\t\t\t\t// ==> Do not execute pTask->setInnerUpdate();\r\n\t\t\t}\r\n\t\t\tpNode->setScale(scaleX, scaleY);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_ROT:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfloat rot = lua.getFloat(base + 1);\r\n\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\tif(pTask->isNewScriptModel()) {\r\n\t\t\t\t\tpTask->setRotation(rot);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tint idxRot = pTask->findProperty(\"rot\");\r\n\t\t\t\t\tpTask->setNum(idxRot, rot);\r\n\t\t\t\t}\r\n\t\t\t\tpTask->setInnerUpdate();\r\n\t\t\t\t// Trick: we modify directly the node AND change the property.\r\n\t\t\t\t// If another property is modified later, it will force the value to be used. \r\n\t\t\t\t// ==> Do not execute pTask->setInnerUpdate();\r\n\t\t\t}\r\n\t\t\tpNode->setRotation(rot);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_COLOR:\r\n\t\t{\r\n\t\t\tif(argc != base + 2) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tu32 alpha = lua.getInt(base + 1);\r\n\t\t\tu32 rgb   = lua.getInt(base + 2);\r\n\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\tif(pTask->isNewScriptModel()) {\r\n\t\t\t\t\tpTask->setAlpha(alpha);\r\n\t\t\t\t\tpTask->setArgb(rgb);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tint idxcol = pTask->findProperty(\"alpha\");\t// Color just after !\r\n\t\t\t\t\tpTask->setInt(idxcol, alpha);\r\n\t\t\t\t\tpTask->setInt(idxcol+1, rgb);\r\n\t\t\t\t}\r\n\t\t\t\tpTask->setInnerUpdate();\r\n\t\t\t}\r\n\r\n\t\t\tSColorVector color;\r\n\t\t\tcolor.m_type = 0;\r\n\r\n\t\t\tfor(int i = 0; i < 3; i++) {\r\n\t\t\t\tint col = 0xff & (rgb >> (16 - 8 * i));\r\n\t\t\t\tcolor.m_vector[i] = col / 255.0f;\r\n\t\t\t}\r\n\t\t\tcolor.m_vector[3] = (alpha & 0xff) / 255.0f;\r\n\t\t\tpNode->setColorMatrix(color);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_VISIBLE:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool visible = lua.getBool(base + 1);\r\n\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\tpTask->setVisible(visible);\r\n\t\t\t} else {\r\n\t\t\t\tpNode->setVisible(visible);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_ORDER:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint order = lua.getInt(base + 1);\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\tif(pTask->isNewScriptModel()) {\r\n\t\t\t\t\tpTask->setOrder(order);\r\n\t\t\t\t\tpTask->setInnerUpdate();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tint idx_order = pTask->findProperty(\"order\");\r\n\t\t\t\t\tif (idx_order >= 0) {\r\n\t\t\t\t\t\tpTask->setInt(idx_order, order);\r\n\t\t\t\t\t\tpTask->setInnerUpdate();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpNode->setPriority(order);\r\n\t\t\tpNode->markUpMatrix();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_NODE_GET_ORDER:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint order;\r\n\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\tif (pTask) {\r\n\t\t\t\tif(pTask->isNewScriptModel()) {\r\n\t\t\t\t\torder = pTask->getOrder();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tint idx_order = pTask->findProperty(\"order\");\r\n\t\t\t\t\tif (idx_order >= 0) {\r\n\t\t\t\t\t\torder = pTask->getInt(idx_order);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\torder = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\torder = pNode->getPriority();\r\n\t\t\t}\r\n\t\t\tlua.retInt(order);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase FORM_NODE_TASK:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tCKLBUITask * pTask = pNode->getUITask();\r\n\t\t\tif(!pTask) {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t} else {\r\n\t\t\t\tlua.retPointer(pTask);\r\n\t\t\t}\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBFormIF::updateUIElement(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)\r\n{\r\n\tCKLBUIElement * pElement = (CKLBUIElement *)pNode;\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = updateStandardNode(lua, argc, base, subcmd, pNode, ret, item, index);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIE_SET_ENABLED:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool enable = lua.getBool(base + 1);\r\n\t\t\tpElement->setEnabled(enable);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIE_GET_ENABLED:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool enable = pElement->isEnabled();\r\n\t\t\tlua.retBoolean(enable);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIE_SET_ASSET:\r\n\t\t{\r\n\t\t\tif(argc != base + 2) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * asset = (!lua.isNil(base + 1)) ? lua.getString(base + 1) : NULL;\r\n\t\t\tconst int mode = lua.getInt(base + 2);\r\n\t\t\tCKLBAsset * pAsset = updateAsset(lua, pElement, asset, (CKLBUIElement::ASSET_TYPE)mode, item);\r\n\t\t\tbool result = (!pAsset) ? false : true;\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n\r\nbool\r\nCKLBFormIF::updateUISelectable(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)\r\n{\r\n\tCKLBUISelectable * pSelectable = (CKLBUISelectable *)pNode;\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\t// selectable専用コマンドに該当しなければ Element として処理する\r\n\t\t\tresult = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIS_SET_CLICK:\r\n\t\t{\r\n\t\t\tif(argc != 8) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\ts32 x = lua.getInt(base + 1);\r\n\t\t\ts32 y = lua.getInt(base + 2);\r\n\t\t\ts32 width = lua.getInt(base + 3);\r\n\t\t\ts32 height = lua.getInt(base + 4);\r\n\t\t\tpSelectable->setClickLeft(x);\r\n\t\t\tpSelectable->setClickTop(y);\r\n\t\t\tpSelectable->setClickWidth(width);\r\n\t\t\tpSelectable->setClickHeight(height);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIS_SET_STICK:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool stick = lua.getBool(base + 1);\r\n\t\t\tpSelectable->setSticked(stick);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIS_SET_RADIO:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint radioID = lua.getInt(base + 1);\r\n\t\t\tpSelectable->setRadio(radioID);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIS_GET_STICK:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool sticked = pSelectable->isSticked();\r\n\t\t\tlua.retBoolean(sticked);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_UIS_SET_CALLBACK:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tconst char* newFct = NULL;\r\n\t\t\tif (lua.isString(base+1)) {\r\n\t\t\t\tnewFct = lua.getString(base + 1);\r\n\t\t\t}\r\n\t\t\tpSelectable->setLuaFunction(newFct);\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBFormIF::updateUIContainer(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)\r\n{\r\n\tCKLBUIContainer * pCont = (CKLBUIContainer *)pNode;\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_CONT_VIEWOFFSET:\r\n\t\t{\r\n\t\t\tif(argc != base + 2) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\ts32 offX = lua.getInt(base + 1);\r\n\t\t\ts32 offY = lua.getInt(base + 2);\r\n\t\t\tpCont->setViewOffsetX(offX);\r\n\t\t\tpCont->setViewOffsetY(offY);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_CONT_GET_RADIO_VALUE:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tu32 value = pCont->getRadioValue();\r\n\t\t\tlua.retInt(value);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBFormIF::updateUITextEdit(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)\r\n{\r\n\tCKLBUITask* pTask\t\t= pNode->getUITask();\r\n\tCKLBUITextBox * pText\t= (CKLBUITextBox *)pNode;\r\n\r\n    // 2012-12-3(Mon)\r\n    // pTaskが存在していない可能性が高いのでpTaskのNULLチェックを追加しました\r\n\tif ((pTask) && (pTask->getClassID() != CLS_KLBUITEXTINPUT)) {\r\n\t\t// Not valid\r\n\t\tpTask = NULL;\r\n\t}\r\n\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_LBL_GET_TEXT:\t// Trick : label & text command backward compatible.\r\n\tcase FORM_TEXT_GET:\r\n\t\t{\r\n\t\t\t/* Do not understand why return false for now.\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}*/\r\n\t\t\tconst char * text;\r\n\r\n\t\t\tif (pTask) {\r\n\t\t\t\ttext = ((CKLBUITextInput*)pTask)->getText();\r\n\t\t\t} else {\r\n\t\t\t\ttext = pText->getText();\r\n\t\t\t}\r\n\r\n\t\t\tlua.retString(text);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_TEXT_SET:\t// Trick : label & text command backward compatible.\r\n\tcase FORM_LBL_SET_TEXT:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * text = lua.getString(base + 1);\r\n\t\t\t\r\n\t\t\tif (pTask) {\r\n\t\t\t\t((CKLBUITextInput*)pTask)->setText(text);\r\n\t\t\t} else {\r\n\t\t\t\tpText->setText((char *)text);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBFormIF::updateUIWebView(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)\r\n{\r\n\tCKLBUITask* pTask\t\t= pNode->getUITask();\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_WEB_SET_URI:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * uri = lua.getString(base + 1);\r\n\t\t\tif (pTask) {\r\n\t\t\t\tCKLBUIWebArea* pWebTask = (CKLBUIWebArea*)pTask;\r\n\t\t\t\tpWebTask->setText(uri);\r\n\t\t\t} else {\r\n\t\t\t\tCKLBUIWebView * pWeb = (CKLBUIWebView *)pNode;\r\n\t\t\t\tpWeb->setText((char *)uri);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_WEB_GET_URI:\r\n\t\t{\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * uri;\r\n\t\t\tif (pTask) {\r\n\t\t\t\tCKLBUIWebArea* pWebTask = (CKLBUIWebArea*)pTask;\r\n\t\t\t\turi = pWebTask->getText();\r\n\t\t\t} else {\r\n\t\t\t\tCKLBUIWebView * pWeb = (CKLBUIWebView *)pNode;\r\n\t\t\t\turi = pWeb->getText();\r\n\t\t\t}\r\n\r\n\t\t\tlua.retString(uri);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBFormIF::updateLabelNode(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)\r\n{\r\n\tCKLBLabelNode * pLabel = (CKLBLabelNode *)pNode;\r\n\tCKLBUITask* pTask\t\t= pNode->getUITask();\r\n\r\n    // pTaskが存在していない可能性が高いのでpTaskのNULLチェックを追加しました\r\n\tif ((pTask) && (pTask->getClassID() != CLS_KLBUILABEL)) {\r\n\t\t// Not valid\r\n\t\tpTask = NULL;\r\n\t}\r\n\r\n\tbool result = true;\r\n\tswitch(subcmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_TEXT_SET:\t// Trick : label & text command backward compatible.\r\n\tcase FORM_LBL_SET_TEXT:\r\n\t\t{\r\n\t\t\tif(argc != base + 1) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * text = lua.getString(base + 1);\r\n\t\t\tif (pTask) {\r\n\t\t\t\t((CKLBUILabel*)pTask)->setText(text);\r\n\t\t\t} else {\r\n\t\t\t\tpLabel->setText((char *)text);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase FORM_LBL_GET_TEXT:\t// Trick : label & text command backward compatible.\r\n\tcase FORM_TEXT_GET:\r\n\t\t{\r\n\t\t\t/*\r\n\t\t\tif(argc != base) {\r\n\t\t\t\tresult = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}*/\r\n\t\t\tconst char * uri;\r\n\t\t\tif (pTask) {\r\n\t\t\t\turi = ((CKLBUILabel*)pTask)->getText();\r\n\t\t\t} else {\r\n\t\t\t\turi = pLabel->getText();\r\n\t\t\t}\r\n\t\t\tlua.retString(uri);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBFormIF::nodeRecursive(CLuaState& lua, const char * funcname, CKLBNode * pNode, int index, int level)\r\n{\r\n\t// タスクノードには適用されない\r\n\tif(pNode->getUITask()) return true;\r\n\r\n\t// 内部ノードについては lua の callback を呼ばない。\r\n\tif(pNode->isInternalNode()) return true;\r\n\r\n\t// LUA Specific feature\r\n\tCLua_Only_State& luaSpecific = (CLua_Only_State&)lua;\r\n\tluaSpecific.callback(funcname, \"PPII\", m_pOwner, pNode, index, level);\r\n\r\n\t// 子を走査\r\n\tCKLBNode * pChild = pNode->getChild();\r\n\twhile(pChild) {\r\n\t\tnodeRecursive(lua, funcname, pChild, index, level + 1);\r\n\t\tpChild = pChild->getBrother();\r\n\t}\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBFormIF.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBFormIF_h\r\n#define CKLBFormIF_h\r\n\r\n#include \"CLuaState.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*\r\n\tUI_Form や UI_List の UPDATE_NODE コマンド用サブコマンド解釈クラス\r\n */\r\nclass CKLBFormIF\r\n{\r\npublic:\r\n\tenum {\r\n\t\t// 標準ノードサブコマンド\r\n\t\tFORM_NODE_POINTER,\t\t// ノードポインタ取得\r\n\t\tFORM_NODE_RECURSIVE,\t// ノード再帰処理\r\n\t\tFORM_NODE_TRANS,\t\t// 位置指定\r\n\t\tFORM_NODE_SCALE,\t\t// 倍率指定(x, y)\r\n\t\tFORM_NODE_ROT,\t\t\t// 回転角指定(deg)\r\n\t\tFORM_NODE_COLOR,\t\t// RGBA指定\r\n\t\tFORM_NODE_VISIBLE,\t\t// 表示/非表示指定\r\n\t\tFORM_NODE_ORDER,\t\t// プライオリティ\r\n\t\tFORM_NODE_GET_ORDER,\t// プライオリティ取得\r\n\t\tFORM_NODE_TASK,\t\t\t// 対応するUIタスク取得\r\n\r\n\r\n\t\t// CKLBUIElement 対象コマンド\r\n\t\tFORM_UIE_SET_ENABLED,\t// 有効/無効\r\n\t\tFORM_UIE_GET_ENABLED,\t\r\n\t\tFORM_UIE_SET_ASSET,\t\t// assetを変更\r\n\r\n\t\t// CKLBUISelectable 対象コマンド\r\n\t\tFORM_UIS_SET_CLICK,\t\t\t// クリック反応領域を再設定\r\n\t\tFORM_UIS_SET_STICK,\t\t\t// checkbox の状態を設定する\r\n\t\tFORM_UIS_SET_RADIO,\r\n\t\tFORM_UIS_GET_STICK,\t\t\t// checkbox の状態を取得する\r\n\t\tFORM_UIS_SET_CALLBACK,\r\n\r\n\t\t// CKLBUIContainer 対象コマンド\r\n\t\tFORM_CONT_VIEWOFFSET,\t\t// View offset\r\n\t\tFORM_CONT_GET_RADIO_VALUE,\r\n\r\n\t\t// CKLBUITextBox 対象コマンド\r\n\t\tFORM_TEXT_SET,\r\n\t\tFORM_TEXT_GET,\r\n\r\n\t\t// CKLBUIWebView 対象コマンド\r\n\t\tFORM_WEB_SET_URI,\r\n\t\tFORM_WEB_GET_URI,\r\n\r\n\t\t// CKLBLabelNode 対象コマンド\r\n\t\tFORM_LBL_SET_TEXT,\t\t// ラベルのテキスト変更\r\n\t\tFORM_LBL_GET_TEXT,\t\t// ラベルのテキスト取得\r\n\t};\r\n\r\n\tCKLBFormIF(CKLBTask * pOwner = 0);\r\n\tvirtual ~CKLBFormIF();\r\n\r\n\tbool isExistNode        (CKLBNode * pParent, const char * name);\r\n\tint  updateNode         (CLuaState& lua, int argc, int base, CKLBNode * pParent, int nodeIndex, int subcmd, void * item = NULL, int index = 0);\r\n\tvoid removeAssetByHandle(void * item);\r\nprivate:\r\n\tbool updateStandardNode (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUIElement    (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUISelectable (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUIContainer  (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUITextEdit   (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateUIWebView    (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\n\tbool updateLabelNode    (CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index);\r\nprivate:\r\n\tCKLBAsset * updateAsset (CLuaState& lua, CKLBUIElement * pElement, const char * name, CKLBUIElement::ASSET_TYPE mode, void * item);\r\n\r\n\tbool nodeRecursive      (CLuaState& lua, const char * funcname, CKLBNode * pNode, int index = 0, int level = 0);\r\n\r\n\t// SET_ASSET コマンドによって差し替えた asset は、\r\n\t// refCount を管理するため、独自にハンドルを保持する必要がある。\r\n\tstruct FORM_ASSET {\r\n\t\tFORM_ASSET\t\t\t\t*\tprev;\r\n\t\tFORM_ASSET\t\t\t\t*\tnext;\r\n\r\n\t\tvoid\t\t\t\t\t*\titem;\t// そのassetを設定したアイテム(Listの場合)\r\n\t\tCKLBUIElement\t\t\t*\tnode;\t// 対象ノード\r\n\t\tCKLBAsset\t\t\t\t*\tasset;\t// 現在の保持asset\r\n\t\tu32\t\t\t\t\t\t\thandle;\t// 上記 asset の保持 handle\r\n\t\tCKLBUIElement::ASSET_TYPE\tmode;\t// 指定モード\r\n\t};\r\n\r\n\tFORM_ASSET\t\t*\tm_begin;\r\n\tFORM_ASSET\t\t*\tm_end;\r\n\r\n\tCKLBTask\t\t*\tm_pOwner;\r\n};\r\n\r\n#endif // CKLBFormIF_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBLabelNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBLabelNode.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CKLBLanguageDatabase.h\"\r\n\r\nconst char * CKLBLabelNode::ms_default_font = NULL;\r\n\r\nbool\r\nCKLBLabelNode::setDefaultFont(const char * fontname)\r\n{\r\n\tchar * name = NULL;\r\n\tif(fontname) {\r\n\t\tname = KLBNEWA(char, strlen(fontname) + 1);\r\n\t\tstrcpy(name, fontname);\r\n\t\tif(!name) return false;\r\n\t}\r\n\tKLBDELETEA(ms_default_font);\r\n\tms_default_font = (const char *)name;\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBLabelNode::release()\r\n{\r\n\tKLBDELETEA(ms_default_font);\r\n\tms_default_font = NULL;\t// 2012.12.11  Reboot時に値が残ったままになり。↑のsetDefaultFont()で変なアドレスが解放される\r\n}\r\n\r\nCKLBLabelNode::CKLBLabelNode(int fontsize, const char * fontname, const char * text)\r\n:m_pLabel\t\t\t(NULL)\r\n,m_fontname\t\t\t(NULL)\r\n,m_fontsize\t\t\t(-1)\r\n,m_width\t\t\t(0)\r\n,m_height\t\t\t(0)\r\n,m_textLen\t\t\t(0)\r\n,m_textBuf\t\t\t(NULL)\r\n,m_align\t\t\t(0)\r\n,m_alignX\t\t\t(0.0f)\r\n,m_alignY\t\t\t(0.0f)\r\n,m_tx\t\t\t\t(0.0f)\r\n,m_ty\t\t\t\t(0.0f)\r\n,m_lock\t\t\t\t(false)\r\n,m_changed\t\t\t(false)\r\n,m_useTextSize\t\t(true)\t// Must be true by default.\r\n{\r\n\t// klb_assert(m_pLabel, \"could not create label.\");\r\n\tlock(true);\r\n\tsetFont\t(fontsize, fontname);\r\n\tsetText\t((char *)text);\r\n\t// Trick : do not force creation of object here.\r\n\tm_lock\t\t= false;\r\n\tm_changed\t= false;\r\n\tm_format\t= TexturePacker::getCurrentModeTexture();\r\n}\r\n\r\nCKLBLabelNode::~CKLBLabelNode() {\r\n\t// \r\n\tKLBDELETE(m_pLabel);\r\n\r\n\t// Call Interface to release the input box\r\n\tKLBDELETEA(m_textBuf);\r\n\r\n\tKLBDELETEA(m_fontname);\r\n}\r\n\r\n/*virtual*/\t\r\nvoid CKLBLabelNode::recomputeCustom() {\r\n\tCKLBUIElement::recomputeCustom();\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBLabelNode::setAsset(CKLBAsset* /*pAsset*/, ASSET_TYPE /*mode*/) {\r\n\t// Do nothing, no asset display.\r\n}\r\n\r\n/*virtual*/\r\nbool CKLBLabelNode::processAction\t(CKLBAction* /*pAction*/) {\r\n\t// Do nothing for now, may implement call back.\r\n\treturn false;\r\n}\r\n\r\nvoid CKLBLabelNode::lock\t\t(bool stop) {\r\n\tif (stop != m_lock) {\r\n\t\tif (!stop) {\r\n\t\t\tif (m_changed) {\r\n\t\t\t\tupdateLabel();\r\n\t\t\t\tm_changed = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tm_lock = stop;\r\n\t}\r\n}\r\n\r\nbool CKLBLabelNode::setFont\t\t(int fontsize, const char * fontname) {\r\n\tif(!fontname) fontname = ms_default_font;\r\n\tbool allow = (fontsize != m_fontsize);\r\n\tif (fontname) {\r\n\t\tif (m_fontname) {\r\n\t\t\tallow |= (strcmp(m_fontname, fontname) != 0);\r\n\t\t}\r\n\r\n\t\tif (allow) {\r\n\t\t\tchar * buf = KLBNEWA(char, strlen(fontname) + 1);\r\n\t\t\tif (buf) {\r\n\t\t\t\tKLBDELETEA(m_fontname);\r\n\t\t\t\tstrcpy(buf, fontname);\r\n\t\t\t\tm_fontname = (const char *)buf;\r\n\t\t\t\tm_fontsize = fontsize;\r\n\t\t\t\tif (!m_lock) { updateLabel(); } else { m_changed = true; }\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// No changes\r\n\t\t\treturn true;\r\n\t\t}\r\n\t} else {\r\n\t\tif (m_fontname) {\r\n\t\t\tKLBDELETEA(m_fontname);\r\n\t\t\tallow = true;\r\n\t\t}\r\n\r\n\t\tif (allow) {\r\n\t\t\tm_fontname = NULL;\r\n\t\t\tm_fontsize = fontsize;\r\n\t\t\tif (!m_lock) { updateLabel(); } else { m_changed = true; }\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n}\r\n\r\nvoid CKLBLabelNode::setWidth\t(u32 width) {\r\n\tif (width != m_width) {\r\n\t\tm_width = width;\r\n\t\tif (!m_lock) { updateLabel(); } else { m_changed = true; }\r\n\t}\r\n}\r\n\r\nvoid CKLBLabelNode::setHeight\t(u32 height) {\r\n\tif (height != m_height) {\r\n\t\tm_height = height;\r\n\t\tif (!m_lock) { updateLabel(); } else { m_changed = true; }\r\n\t}\r\n}\r\n\r\nvoid CKLBLabelNode::setAlign(u32 align) {\r\n\tif (align != m_align) {\r\n\t\tm_align = align;\r\n\t\tif (!m_lock) { updateLabel(); } else { m_changed = true; }\r\n\t}\r\n}\r\n\r\nvoid CKLBLabelNode::setTextColor(u32 color) {\r\n\tif (color != m_color) {\r\n\t\tm_color = color;\r\n\t\tif (!m_lock) { updateLabel(); } else { m_changed = true; }\r\n\t}\r\n}\r\n\r\nvoid CKLBLabelNode::setText(const char* text) {\r\n\tif (text) {\r\n\t\ttext = CKLBLanguageDatabase::getInstance().getString(text);\r\n\t\tsize_t len = strlen(text);\r\n\t\tbool allow = len != m_textLen;\r\n\t\t\r\n\t\tif (m_textBuf) {\r\n\t\t\tallow |= (strcmp(text, m_textBuf) != 0);\r\n\t\t} else {\r\n\t\t\tallow = true;\r\n\t\t}\r\n\r\n\t\tif (allow) {\r\n\t\t\tKLBDELETEA(m_textBuf);\r\n\t\t\tm_textBuf = KLBNEWA(char, len + 1);\r\n\t\t\tm_textLen = len;\r\n\r\n\t\t\tstrcpy(m_textBuf, text);\r\n\t\t\tif (!m_lock) {\r\n\t\t\t\tupdateLabel();\r\n\t\t\t} else {\r\n\t\t\t\tm_changed = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nconst char*\tCKLBLabelNode::getText() {\r\n\treturn m_textBuf;\r\n}\r\n\r\nvoid CKLBLabelNode::setUseTextSize(bool autoSize) {\r\n\tm_useTextSize = autoSize;\r\n}\r\n\r\nvoid CKLBLabelNode::updateLabel()\r\n{\r\n\tif(!m_textBuf || ((!m_width || !m_height) && !m_useTextSize)) {\r\n\t\tKLBDELETE(m_pLabel);\r\n\t\tm_pLabel = NULL;\r\n\t\treturn;\r\n\t}\r\n\r\n\t// 本来VDocは動作中にプロパティを変更するような作りになっていないため、\r\n\t// プロパティ変更が生じたときは改めて VDOCを作り直す。\r\n\tif (!m_pLabel) {\r\n\t\tCKLBNodeVirtualDocument * pNewNode = KLBNEW(CKLBNodeVirtualDocument);\r\n\t\tif(!pNewNode) return;\r\n\r\n\t\tif(m_pLabel) KLBDELETE(m_pLabel);\r\n\t\tm_pLabel = pNewNode;\r\n\r\n\t\tthis->addNode(m_pLabel);\r\n\t}\r\n\r\n\t// 描画コマンド数は固定。文字列一つだけの表示なので。\r\n\tm_pLabel->createDocument(1,m_format);\r\n\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\r\n\t// 指定されている文字列とフォント、フォントサイズでの表示に必要な幅と高さを取得する。\r\n\tvoid * pFont = pForm.getFont(m_fontsize, m_fontname);\r\n\tSTextInfo txinfo;\r\n\tpForm.getTextInfo(m_textBuf ? m_textBuf : \" \",pFont, &txinfo);\r\n\r\n\t// CKLBLabelNode の場合は、実際に文字列描画が必要とする面積がどうあれ、\r\n\t// 指定された幅と高さで VirtualDocumentを生成する\r\n\tu32 width\t= m_useTextSize ? txinfo.width  : m_width;\r\n\tu32 height\t= m_useTextSize ? txinfo.height : m_height;\r\n\r\n\tm_pLabel->setDocumentSize(width, height);\r\n\r\n\tfloat x;\r\n\tfloat y;\r\n\r\n\t// X align\r\n\tswitch(m_align & 3) {\r\n\tdefault:\r\n\tcase 0:\tx = 0.0f;\t\t\t\t\t\tbreak;\r\n\tcase 1: x = -(txinfo.width / 2.0f);\t\tbreak;\r\n\tcase 2: x = -txinfo.width;\t\t\t\tbreak;\r\n\t}\r\n\r\n\t// Y align\r\n\tswitch(m_align >> 2) {\r\n\tdefault:\r\n\tcase 0:\ty = 0.0f;\t\t\t\t\t\tbreak;\r\n\tcase 1: y = -(txinfo.height / 2.0f);\tbreak;\r\n\tcase 2: y = -txinfo.height;\t\t\t\tbreak;\r\n\t}\r\n\r\n\tm_alignX = x;\r\n\tm_alignY = y;\r\n\r\n\tm_pLabel->setViewPortSize(width, height, x, y,m_renderPrio, false);\r\n\r\n\t// font index = 0 で、指定されている文字列を描画\r\n\tm_pLabel->setFont(0, m_fontname, m_fontsize);\t// 指定フォントをindex=0に指定\r\n\tm_pLabel->clear(0);\r\n\r\n\tm_pLabel->lockDocument();\r\n\tif (m_textBuf) {\r\n\t\tm_pLabel->drawText(0, txinfo.top, m_textBuf, m_color, 0);\r\n\t}\r\n\tm_pLabel->unlockDocument();\r\n\r\n\t// Optimize font cache by deleting after.\r\n\tpForm.deleteFont(pFont);\r\n\r\n\t/*\r\n\t//\r\n\t// Update translation here directly.\r\n\t// ----------------------------------\r\n\tm_status |= MATRIX_CHANGE;\r\n\tmarkUpTree();\r\n\tm_matrix.m_matrix[MAT_TX] = m_tx + m_alignX;\r\n\tm_matrix.m_matrix[MAT_TY] = m_ty + m_alignY;\r\n\tif (m_matrix.m_type == MATRIX_ID) {\r\n\t\tm_matrix.m_type = MATRIX_T;\r\n\t}\r\n\t// ----------------------------------\r\n\r\n\tm_pLabel->setViewPortPos(0, 0);\t// ViewPort とDocumentのサイズが同じで、かつ表示位置を(0,0)で固定\r\n\tm_pLabel->markUpMatrix();\r\n\t*/\r\n\tm_status |= MATRIX_CHANGE;\r\n\tm_pLabel->setViewPortPos(0, 0);\r\n\tm_pLabel->setPriority(m_renderPrio);\r\n\tmarkUpTree();\r\n}\r\n\r\nvoid\tCKLBLabelNode::setPriority(u32 renderPriority)\r\n{\r\n\tm_renderPrio = renderPriority;\r\n\tif(m_pLabel) m_pLabel->setPriority(renderPriority);\r\n}\r\n\r\n/*\r\nvoid CKLBLabelNode::setTranslateVirtual\t(float x, float y)  {\r\n\t// --> Not possible anymore : if ((x != m_matrix.m_matrix[MAT_TX]) || (y != m_matrix.m_matrix[MAT_TY])) {\r\n\r\n\tm_status |= MATRIX_CHANGE;\r\n\tmarkUpTree();\r\n\tm_tx = x;\r\n\tm_ty = y;\r\n\tm_matrix.m_matrix[MAT_TX] = m_tx + m_alignX;\r\n\tm_matrix.m_matrix[MAT_TY] = m_ty + m_alignY;\r\n\tif (m_matrix.m_type == MATRIX_ID) {\r\n\t\tm_matrix.m_type = MATRIX_T;\r\n\t}\r\n\r\n\t// }\r\n}\r\n*/\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBLabelNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_LABELNODE__\r\n#define __CKLB_LABELNODE__\r\n\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n\r\n/*!\r\n* \\class CKLBLabelNode\r\n* \\brief Text Specialized Node Class\r\n* \r\n* CKLBLabelNode is a text specialized Node for Scene Graph.\r\n* It provides methods to modify the apparence of the text label.\r\n*/\r\nclass CKLBLabelNode : public CKLBUIElement {\r\npublic:\r\n\tCKLBLabelNode(int fontsize, const char * fontname = 0, const char * text = 0);\r\n\t~CKLBLabelNode();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBLABEL; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\t\t\r\n\tvoid\trecomputeCustom\t\t();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\t// virtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   ()  { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tlock\t\t\t(bool stop);\r\n\tvoid\t\tsetAlign\t\t(u32 align);\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n\r\n\tvoid\t\tsetTextColor\t(u32 color);\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n\tbool\t\tsetFont\t\t\t(int fontsize, const char * fontname);   \r\n\r\n\tvoid\t\tsetUseTextSize\t(bool autoSize);\r\n\tvoid\t\tsetPriority\t\t(u32 renderPriority);\r\n\r\n\tvoid\t\tforceRefresh\t()  { m_pLabel->forceRefresh(); }\r\n\r\n\tstatic bool setDefaultFont  (const char * fontname = 0);\r\n\tstatic void release         ();\r\n\r\nprotected:\r\n\t// virtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\t// virtual void\taddRender\t\t\t();\r\n\t// virtual void\tremoveRender\t\t();\r\n\r\n\tconst char * m_fontname;\r\n\tint          m_fontsize;\r\n\tCKLBNodeVirtualDocument\t*\tm_pLabel;\r\n\r\n\tu32\t\tm_width;\r\n\tu32\t\tm_height;\r\n\r\n\tu32\t\tm_color;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n\r\n\tu32\t\tm_align;\r\n\tfloat\tm_tx;\r\n\tfloat\tm_ty;\r\n\tfloat\tm_alignX;\r\n\tfloat\tm_alignY;\r\n\tu8\t\tm_format;\r\n\tbool\tm_lock;\r\n\tbool\tm_changed;\r\n\tbool\tm_useTextSize;\r\n\r\nprivate:\r\n\r\n\tvoid updateLabel();\r\n\r\n\tstatic const char * ms_default_font;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBModalStack.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBModalStack.h\"\r\n;\r\nCKLBModalStack * CKLBModalStack::ms_begin = 0;\r\nCKLBModalStack * CKLBModalStack::ms_end   = 0;\r\n\r\nCKLBModalStack::CKLBModalStack(bool bModal, bool bUrgent)\r\n\t: m_bEnable(true), m_bModal(bModal), m_bUrgent(bUrgent), m_prev(0), m_next(0)\r\n{\r\n\tif(m_bUrgent) m_bModal = true;\r\n}\r\n\r\nCKLBModalStack::~CKLBModalStack()\r\n{\r\n\tremove();\r\n}\r\n\r\nvoid\r\nCKLBModalStack::push()\r\n{\r\n\t// 既にスタック上にあれば一旦removeする\r\n\tif(m_prev || m_next || ms_begin == this || ms_end == this) remove();\r\n\r\n\t// 自身をスタックの上に積む。ただし、\r\n\t// bUrgent = true は最上位に、\r\n\t// そうでないものは bUrgent = true のものの下に\r\n\t// 積まれる。\r\n    CKLBModalStack * begin = ms_begin;\r\n\twhile(begin && begin->m_bUrgent) begin = begin->m_next;\r\n\r\n\tm_prev = (begin) ? begin->m_prev : 0;\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = this;\r\n\t} else {\r\n\t\tms_begin = this;\r\n\t}\r\n\tm_next = begin;\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = this;\r\n\t} else {\r\n\t\tms_end = this;\r\n\t}\r\n\r\n\t// モーダルフォームのスタックであれば、\r\n\t// 自分の先に積まれていたすべてのフォームを disableにする\r\n\tif(m_bModal) {\r\n\t\tCKLBModalStack * pStack = m_next;\r\n\t\twhile(pStack) {\r\n\t\t\tpStack->setEnable(false);\r\n\t\t\tpStack = pStack->m_next;\r\n\t\t}\r\n\t}\r\n\r\n\t// 自分自身は enable にする\r\n\tm_bEnable = true;\r\n}\r\n\r\nvoid\r\nCKLBModalStack::pop()\r\n{\r\n\tremove();\r\n}\r\n\r\nvoid\r\nCKLBModalStack::remove()\r\n{\r\n\t// 取り除かれようとしている自分が modal であり、\r\n\t// なおかつ自分より上にモーダルのタスクが無ければ、自身より下にあり、\r\n\t// 次のmodalであるフォームまでを enable にする\r\n\tif(m_bModal) {\r\n\t\t// 自分より上にmodalのタスクがあるか確認する\r\n\t\tbool existModal = false;\r\n\t\tCKLBModalStack * pStack = m_prev;\r\n\t\twhile(pStack) {\r\n\t\t\tif(pStack->isModal()) existModal = true;\r\n\t\t\tpStack = pStack->m_prev;\r\n\t\t}\r\n\t\t// existModal がfalseならば、自身がもっとも上に積まれているmodalコントロールであるため、\r\n\t\t// 自身より下にある次の modalコントロールが見つかるまでのコントロールをすべて enable にする\r\n\t\tif(!existModal) {\r\n\t\t\tpStack = m_next;\r\n\t\t\twhile(pStack) {\r\n\t\t\t\tpStack->setEnable(true);\r\n\t\t\t\tif(pStack->isModal()) break;\r\n\t\t\t\tpStack = pStack->m_next;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// 自身をスタックから取り除く\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tif(ms_begin == this) ms_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tif(ms_end == this) ms_end = m_prev;\r\n\t}\r\n\tm_prev = m_next = 0;\r\n\r\n\t// 自分自身は disable にする\r\n\tm_bEnable = false;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBModalStack.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBModalStack_h\r\n#define CKLBModalStack_h\r\n\r\nclass CKLBModalStack\r\n{\r\npublic:\r\n\tCKLBModalStack(bool bModal = false, bool bUrgent = false);\r\n\tvirtual ~CKLBModalStack();\r\n\r\n\tinline bool isUrgent() const { return m_bUrgent; }\r\n\tinline bool isModal () const { return m_bModal;  }\r\n\tinline bool isEnable() const { return m_bEnable; }\r\n\r\n\tinline bool setModal(bool bModal, bool bUrgent = false) {\r\n\t\tm_bModal  = bModal;\r\n\t\tm_bUrgent = bUrgent;\r\n        if(m_bUrgent) { m_bModal = true; }\r\n\t\treturn m_bModal;\r\n\t}\r\n\t \r\n\tinline bool setEnable(bool bEnable) {\r\n\t\tm_bEnable = bEnable;\r\n\t\treturn m_bEnable;\r\n\t}\r\n\r\n\tvoid push   ();\r\n\tvoid pop    ();\r\n\tvoid remove ();\r\n\r\nprivate:\r\n\t\r\n\tbool\t\t\t\t\t\tm_bEnable;\r\n\r\n\tbool\t\t\t\t\t\tm_bModal;\r\n\tbool\t\t\t\t\t\tm_bUrgent;\r\n\r\n\tCKLBModalStack\t\t\t*\tm_prev;\r\n\tCKLBModalStack\t\t\t*\tm_next;\r\n\r\n\tstatic CKLBModalStack\t*\tms_begin;\r\n\tstatic CKLBModalStack\t*\tms_end;\r\n};\r\n\r\n\r\n#endif // CKLBModalStack_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBMovieNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n#include \"CKLBMovieNode.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CKLBDrawTask.h\"\r\n\r\nCKLBMovieNode::CKLBMovieNode(const char * path, bool background)\r\n:nativeInputItem\t(NULL)\r\n,m_width\t\t\t(0)\r\n,m_height\t\t\t(0)\r\n,m_tx\t\t\t\t(0)\r\n,m_ty\t\t\t\t(0)\r\n,m_textLen\t\t\t(0)\r\n,m_textBuf\t\t\t(0)\r\n{\r\n\t//\r\n\t//\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n    IWidget::CONTROL type = (background) ? IWidget::BGMOVIEPLAYER : IWidget::MOVIEPLAYER;\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\tint px,py;\r\n\tdraw.toPhisicalPosition(m_tx, m_ty, px, py);\t// OSコントロールの配置は物理座標系で行う\r\n\tnativeInputItem = pForm.createControl(type, 0, path, px, py, 0, 0);\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n\r\n\tklb_assert(nativeInputItem, \"MoviePlayer allocation failed\");\r\n}\r\n\r\nCKLBMovieNode::~CKLBMovieNode() {\r\n\t// Call Interface to release the input box\r\n\r\n\tif (nativeInputItem) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.destroyControl(nativeInputItem);\r\n\t\tnativeInputItem = NULL;\r\n\t}\r\n\tKLBDELETEA(m_textBuf);\r\n}\r\n\r\n/*virtual*/\t\r\nvoid CKLBMovieNode::recomputeCustom() {\r\n\tif (nativeInputItem) {\r\n\t\tconst SMatrix2D* pMat = &m_composedMatrix;\r\n\r\n\t\ts32 x = (s32)pMat->m_matrix[MAT_TX];\r\n\t\ts32 y = (s32)pMat->m_matrix[MAT_TY];\r\n\r\n\t\tint px, py;\r\n\t\tint width, height;\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\r\n\t\tm_tx = x;\r\n\t\tm_ty = y;\r\n\r\n\t\tint transWidth  = m_width  * pMat->m_matrix[MAT_A];\r\n\t\tint transHeight = m_height * pMat->m_matrix[MAT_D];\r\n\r\n\t\t// OSコントロールの配置は物理座標系で行う\r\n\t\tdraw.toPhisicalPosition(x, y, px, py);\t\r\n\t\tdraw.toPhisicalSize(transWidth, transHeight, width, height);\r\n\t\tnativeInputItem->move(px, py);\r\n\t\tnativeInputItem->resize(width, height);\r\n\t}\r\n}\r\n\r\nvoid CKLBMovieNode::setWidth\t(u32 width) {\r\n\tif (nativeInputItem && (width != m_width)) {\r\n\t\tm_width = width;\r\n\t\tthis->markUpMatrix(); // Force recomputeCustom()\r\n\t}\r\n}\r\n\r\nvoid CKLBMovieNode::setHeight\t(u32 height) {\r\n\tif (nativeInputItem && (height != m_height)) {\r\n\t\tm_height = height;\r\n\t\tthis->markUpMatrix(); // Force recomputeCustom()\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBMovieNode::setEnabled(bool isEnabled) {\r\n//\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tCKLBUIElement::setEnabled(isEnabled);\r\n\r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBMovieNode::setUpperEnabled(bool isEnabled) {\r\n//\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\tCKLBUIElement::setUpperEnabled(isEnabled);\r\n\r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n//\r\n// Visible / Invisible related.\r\n//\r\n/*virtual*/\r\nvoid CKLBMovieNode::addRender() {\r\n\tCKLBUIElement::addRender();\r\n\tif (nativeInputItem) {\r\n//\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tnativeInputItem->visible(true);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBMovieNode::removeRender() {\r\n\tCKLBUIElement::removeRender();\r\n\tif (nativeInputItem) {\r\n//\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid CKLBMovieNode::setAsset(CKLBAsset* /*pAsset*/, ASSET_TYPE /*mode*/) {\r\n\t// Do nothing, no asset display.\r\n}\r\n\r\n/*virtual*/\r\nbool CKLBMovieNode::processAction\t(CKLBAction* /*pAction*/) {\r\n\t// Do nothing for now, may implement call back.\r\n\treturn false;\r\n}\r\n\r\nvoid CKLBMovieNode::setText(const char* text) {\r\n\tif (nativeInputItem) {\r\n//\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\t\tnativeInputItem->setText(text);\r\n\t}\r\n}\r\n\r\nconst char*\tCKLBMovieNode::getText() {\r\n\tif (nativeInputItem) {\r\n//\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\r\n\t\tsize_t len = nativeInputItem->getTextLength();\r\n\t\tif(!m_textBuf || len > m_textLen) {\r\n\t\t\tKLBDELETEA(m_textBuf);\r\n\t\t\tm_textLen = len;\r\n\t\t\tm_textBuf = KLBNEWA(char, m_textLen + 1);\r\n\t\t}\r\n\t\tnativeInputItem->getText(m_textBuf, m_textLen + 1);\r\n\r\n\t\treturn m_textBuf;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid\r\nCKLBMovieNode::command(IWidget::MOVIECMD cmd)\r\n{\r\n    nativeInputItem->cmd(cmd);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBMovieNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_MOVIENODE__\r\n#define __CKLB_MOVIENODE__\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBMovieNode\r\n* \\brief Movie Specialized Node Class\r\n* \r\n* CKLBMovieNode is a specilized Node for movie management.\r\n* It takes care of the graphic operations that can be processed\r\n* on a movie asset.\r\n*/\r\nclass CKLBMovieNode : public CKLBUIElement {\r\npublic:\r\n\tCKLBMovieNode(const char * path, bool background = false);\r\n\t~CKLBMovieNode();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBMOVIENODE; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\t\t\r\n\tvoid\trecomputeCustom\t\t();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   ()  { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n    \r\n    void        command         (IWidget::MOVIECMD cmd);\r\n\r\n    inline IWidget * getWidget  () const { return nativeInputItem; }\r\n    \r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender      ();\r\n\tvirtual void removeRender   ();\r\n\r\n\tIWidget *   nativeInputItem;\r\n\tu32         m_width;\r\n\tu32         m_height;\r\n\ts32         m_tx;\r\n\ts32         m_ty;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBNodeAnimPack.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBNodeAnimPack.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n;\r\nconst char * CKLBNodeAnimPack::ms_labelEnter = \"enter\";\r\nconst char * CKLBNodeAnimPack::ms_labelLeave = \"leave\";\r\n\r\nCKLBNodeAnimPack::CKLBNodeAnimPack() \r\n: m_begin       (NULL)\r\n, m_end         (NULL)\r\n, m_callback    (NULL)\r\n, m_enterBlend  (false) \r\n{\r\n}\r\n\r\nCKLBNodeAnimPack::~CKLBNodeAnimPack()\r\n{\r\n\t// アニメーション監視領域が残っていたら破棄する\r\n\tANIMCOUNT * anim = m_begin;\r\n\twhile(anim) {\r\n\t\tANIMCOUNT * next = anim->next;\r\n\t\tKLBDELETEA(anim->name);\r\n\t\tKLBDELETE(anim);\r\n\t\tanim = next;\r\n\t}\r\n\t// 2012.11.27  解放漏れがあったので修正\r\n\tif( m_callback ) {\r\n\t\tKLBDELETEA(m_callback);\r\n\t\tm_callback = NULL;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBNodeAnimPack::setCallback(const char * callback)\r\n{\r\n\tconst char * str = NULL;\r\n\tif(callback) {\r\n\t\tstr = CKLBUtility::copyString(callback);\r\n        if(!str) { return false; }\r\n\t}\r\n    if(m_callback) { KLBDELETEA(m_callback); }\r\n\tm_callback = str;\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBNodeAnimPack::skipAnim(CKLBNode * pNode, const char * name)\r\n{\r\n\tpNode->skipAnimation(name);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBNodeAnimPack::kickAnim(CKLBNode * pNode, const char * name, bool doBlend, int id, bool kill)\r\n{\r\n\tANIMCOUNT * anim = KLBNEW(ANIMCOUNT);\r\n    if(!anim) { return false; }\r\n\tanim->name = CKLBUtility::copyString(name);\r\n\tif(!anim->name) {\r\n\t\tKLBDELETE(anim);\r\n\t\treturn false;\r\n\t}\r\n\t// 念のため0クリアする\r\n\tanim->count = 0;\r\n\r\n\t// animation を kick する\r\n\tpNode->kickAnimation(name, &anim->count, doBlend);\r\n\r\n\t// Add to list if only kicked.\r\n\tif (anim->count) {\r\n\t\tanim->node = pNode;\r\n\t\tanim->id = id;\r\n\t\tanim->kill = kill;\r\n\r\n\t\t// 再生中アニメリストに追加する\r\n\t\tanim->prev = m_end;\r\n\t\tanim->next = NULL;\r\n\t\tif(anim->prev) {\r\n\t\t\tanim->prev->next = anim;\r\n\t\t} else {\r\n\t\t\tm_begin = anim;\r\n\t\t}\r\n\t\tm_end = anim;\r\n\t} else {\r\n\t\t// Delete Name first.\r\n\t\tKLBDELETEA(anim->name);\r\n\t\t// Then delete animation.\r\n\t\tKLBDELETE(anim);\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBNodeAnimPack::watchFinishedAnim(CKLBLuaTask * pTask)\r\n{\r\n\t// アニメーションの終了を監視する\r\n\tANIMCOUNT * anim = m_begin;\r\n\twhile(anim) {\r\n\t\tif(anim->count) {\r\n\t\t\t// カウンタが残っていればアニメーションは終了していない。\r\n\t\t\t// 次の監視対象に移る。\r\n\t\t\tanim = anim->next;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t// カウンタが0なので、そのアニメーションは終了したと認識\r\n\t\t// リストからはずす\r\n\t\tif(anim->prev) {\r\n\t\t\tanim->prev->next = anim->next;\r\n\t\t} else {\r\n\t\t\tm_begin = anim->next;\r\n\t\t}\r\n\t\tif(anim->next) {\r\n\t\t\tanim->next->prev = anim->prev;\r\n\t\t} else {\r\n\t\t\tm_end = anim->prev;\r\n\t\t}\r\n\r\n\t\tANIMCOUNT * next = anim->next;\r\n\t\tconst char * name = anim->name;\r\n\t\tint id = anim->id;\r\n\t\tbool bKill = anim->kill;\r\n\t\tKLBDELETE(anim);\r\n\r\n\t\tCKLBScriptEnv::getInstance().call_eventNodeAnimPack(m_callback, pTask, name, id);\r\n\r\n\t\t// kill が true の時アニメーションが終了したならば指定されたタスクのkill()を呼ぶ\r\n\t\tif(bKill) pTask->kill();\r\n\t\tKLBDELETEA(name);\r\n\r\n\t\tanim = next;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBNodeAnimPack::kickEnter(CKLBNode * pNode)\r\n{\r\n\tbool result = kickAnim(pNode, ms_labelEnter, m_enterBlend);\r\n\tm_enterBlend = true;\r\n\treturn result;\r\n}\r\n\r\nbool\r\nCKLBNodeAnimPack::kickLeave(CKLBNode * pNode)\r\n{\r\n\treturn kickAnim(pNode, ms_labelLeave, true, 0, true);\r\n}\r\n\r\nint\r\nCKLBNodeAnimPack::getAnimCounter(const char * name)\r\n{\r\n\tu32 cntSum = 0;\r\n\t// 現在実行中のアニメーションのなかから該当する名称を持つものを探し、\r\n\t// そのリファレンスカウンタ値を返す。\r\n\tANIMCOUNT * anim = m_begin;\r\n\twhile(anim) {\r\n\t\tcntSum += anim->count;\r\n\t\t// 名前が指定されていて、その名前に合致するカウンタならばその値を返す。\r\n\t\tif(name && !strcmp(anim->name, name)) return anim->count;\r\n\t\tanim = anim->next;\r\n\t}\r\n\t// 見つからない場合:\r\n\t// 名前が指定されていない場合(NULL)は、すべてのカウンタの合計を返す\r\n\t// 名前が指定されていた場合は0を返す\r\n\treturn (!name) ? cntSum : 0;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBNodeAnimPack.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBNodeAnimPack_h\r\n#define CKLBNodeAnimPack_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBNode.h\"\r\n\r\n\r\n// アニメーションノードを持たせるためのパッケージ\r\nclass CKLBNodeAnimPack\r\n{\r\npublic:\r\n\tCKLBNodeAnimPack();\r\n\tvirtual ~CKLBNodeAnimPack();\r\n\r\n\tbool                setCallback(const char * callback);\r\n\tinline const char * getCallback() { return m_callback; }\r\n\r\n\tbool skipAnim   (CKLBNode * pNode, const char * name);\r\n\tbool kickAnim   (CKLBNode * pNode, const char * name, bool doBlend, int id = 0, bool kill = false);\r\n\r\n\tbool kickEnter  (CKLBNode * pNode);\r\n\tbool kickLeave  (CKLBNode * pNode);\r\n\r\n\tvoid watchFinishedAnim(CKLBLuaTask * pTask);\r\n\r\n\tint getAnimCounter(const char * name);\r\n\r\nprivate:\r\n\tstruct ANIMCOUNT {\r\n\t\tANIMCOUNT\t*\tprev;\r\n\t\tANIMCOUNT\t*\tnext;\r\n\t\tCKLBNode\t*\tnode;\t// コマンド発行ノード\r\n\t\tconst char\t*\tname;\t// アニメーションラベル\r\n\t\tint\t\t\t\tid;\t\t// 実行時に与えられたID値\r\n\t\tbool\t\t\tkill;\t// アニメーション終了時、タスクにkill発行\r\n\t\tu32\t\t\t\tcount;\t// アニメーションノード数のrefCount\r\n\t};\r\n\r\n\tANIMCOUNT\t\t*\tm_begin;\r\n\tANIMCOUNT\t\t*\tm_end;\r\n\r\n\tconst char\t\t*\tm_callback;\r\n\r\n\tbool\t\t\t\tm_enterBlend;\r\n\r\n\tstatic const char * ms_labelEnter;\r\n\tstatic const char * ms_labelLeave;\r\n};\r\n\r\n#endif // CKLBNodeAnimPack_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrMgrDefault.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScrMgrDefault.h\"\r\n\r\nstatic CKLBScrMgrDefaultFactory factory(\"default\");\r\n\r\nCKLBScrMgrDefaultFactory::CKLBScrMgrDefaultFactory(const char * name) \r\n: IMgrEntry (name) \r\n{\r\n}\r\n\r\nCKLBScrMgrDefaultFactory::~CKLBScrMgrDefaultFactory() \r\n{\r\n}\r\n\r\nCKLBScrollMgr *\r\nCKLBScrMgrDefaultFactory::createManager(int argc, int args[])\r\n{\r\n\tint delay = (argc > 0) ? args[0] : DEFAULT_DELAY;\r\n\treturn KLBNEWC(CKLBScrMgrDefault, (delay));\r\n}\r\n\r\nCKLBScrollMgr *\r\nCKLBScrMgrDefaultFactory::createManagerByProperty(CKLBPropertyBag * pProp)\r\n{\r\n\tint delay = (pProp->getIndex(\"delay\") >= 0) ? pProp->getPropertyInt(\"delay\") : DEFAULT_DELAY;\r\n\treturn KLBNEWC(CKLBScrMgrDefault, (delay));\r\n}\r\n\r\n\r\n/*\r\n  サンプルのスクロールマネージャ実装。\r\n  与えられた位置を即その場で反映し、バーの位置 = 値の位置という極めて基本的なサンプル。\r\n  */\r\n\r\nCKLBScrMgrDefault::CKLBScrMgrDefault(int delay) \r\n: m_posTarget   (0.0f)\r\n, m_posNow      (0.0f)\r\n, m_delay       (delay)\r\n, m_mvDir       (0)\r\n, m_speed       (0.0f) \r\n{\r\n}\r\n\r\nCKLBScrMgrDefault::~CKLBScrMgrDefault() \r\n{\r\n}\r\n\r\nvoid\r\nCKLBScrMgrDefault::setMargin(int /*top*/, int /*bottom*/) {}\r\n\r\nvoid\r\nCKLBScrMgrDefault::setInitial(int pos)\r\n{\r\n\tsetPosition(pos, 0);\r\n\tm_posNow = m_posTarget;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrDefault::setPosition(int pos, int dir)\r\n{\r\n\tm_posTarget = loopRound((float)pos);\r\n\tm_mvDir = dir;\t// 移動方向\r\n}\r\n\r\nint\r\nCKLBScrMgrDefault::getPosition()\r\n{\r\n\treturn (int)m_posNow;\r\n}\r\n\r\nint\r\nCKLBScrMgrDefault::getBarPosition()\r\n{\r\n\treturn (int)m_posTarget;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrDefault::execute(u32 /* deltaT */)\r\n{\r\n\tif((int)m_posTarget == (int)(m_posNow + 0.05f)) {\r\n\t\tm_posNow    = m_posTarget;\r\n\t\tm_mvDir     = 0;\r\n\t\tm_speed     = 0.0f;\r\n\t\texecCallback(m_posNow);\r\n\t\treturn;\r\n\t}\r\n\tfloat target = m_posTarget;\r\n    if(m_mvDir < 0 && target > m_posNow) { target -= m_lenLoop; }\r\n\tif(m_mvDir > 0 && target < m_posNow) { target += m_lenLoop; }\r\n\tfloat left = target - m_posNow;\r\n\r\n\tm_speed   = left / m_delay;\r\n\tm_posNow += m_speed;\r\n\tm_posNow  = loopRound(m_posNow);\r\n}\r\n\r\nbool \r\nCKLBScrMgrDefault::stillScrolling() {\r\n\t// Less than 2 pix per second.\r\n\treturn fabs(m_speed) > 2.0f;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrMgrDefault.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrMgrDefault_h\r\n#define CKLBScrMgrDefault_h\r\n\r\n#include \"IMgrEntry.h\"\r\n\r\nclass CKLBScrMgrDefaultFactory : public IMgrEntry\r\n{\r\npublic:\r\n\tCKLBScrMgrDefaultFactory(const char * name);\r\n\tvirtual ~CKLBScrMgrDefaultFactory();\r\n\r\n\tCKLBScrollMgr * createManager(int argc, int args[]);\r\n\tCKLBScrollMgr * createManagerByProperty(CKLBPropertyBag * pProp);\r\n\r\n\tenum {\r\n\t\tDEFAULT_DELAY = 10\r\n\t};\r\n};\r\n\r\nclass CKLBScrMgrDefault : public CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrMgrDefault(int delay);\r\n\tvirtual ~CKLBScrMgrDefault();\r\n\r\n\tvirtual void setMargin      (int top, int bottom);\r\n\tvirtual void setInitial     (int pos);\r\n\tvirtual void setPosition    (int pos, int dir);\r\n\tvirtual int  getPosition    ();\r\n\tvirtual int  getBarPosition ();\r\n\tvirtual void execute        (u32 deltaT);\r\n\tvirtual bool stillScrolling ();\r\nprivate:\r\n\tfloat\t\tm_speed;\r\n\tfloat\t\tm_posTarget;\r\n\tfloat\t\tm_posNow;\r\n\tint\t\t\tm_delay;\r\n\tint\t\t\tm_mvDir;\r\n};\r\n\r\n\r\n#endif // CKLBScrMgrDefault_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrMgrPage.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScrMgrPage.h\"\r\n\r\nstatic CKLBScrMgrPageFactory factory(\"page\");\r\n\r\nCKLBScrMgrPageFactory::CKLBScrMgrPageFactory(const char * name) \r\n: IMgrEntry(name) \r\n{\r\n}\r\n\r\nCKLBScrMgrPageFactory::~CKLBScrMgrPageFactory() \r\n{\r\n}\r\n\r\nCKLBScrollMgr *\r\nCKLBScrMgrPageFactory::createManager(int argc, int args[])\r\n{\r\n    if(argc < 1 || argc > 3) { return NULL; }\r\n\tint pagesize = args[0];\r\n\tint delay    = (argc >= 2) ? args[1] : DEFAULT_DELAY;\r\n\tint offset   = (argc >= 3) ? args[2] : 0;\r\n\treturn KLBNEWC(CKLBScrMgrPage, (pagesize, delay, offset));\r\n}\r\n\r\nCKLBScrollMgr *\r\nCKLBScrMgrPageFactory::createManagerByProperty(CKLBPropertyBag * pProp)\r\n{\r\n\tint delay    = (pProp->getIndex(\"delay\") >= 0) ? pProp->getPropertyInt(\"delay\") : DEFAULT_DELAY;\r\n\tint pagesize = pProp->getPropertyInt(\"pagesize\");\r\n\tint offset   = (pProp->getIndex(\"offset\") >= 0) ? pProp->getPropertyInt(\"offset\") : 0;\r\n\treturn KLBNEWC(CKLBScrMgrPage, (pagesize, delay, offset));\r\n}\r\n\r\n//\r\n// Page Scroll Manager\r\n//\r\n\r\nCKLBScrMgrPage::CKLBScrMgrPage(int pagesize, int delay, int offset)\r\n: m_posTarget   (0.0f)\r\n, m_posNow      (0.0f)\r\n, m_pagesize    (pagesize)\r\n, m_delay       (delay)\r\n, m_offset      (offset)\r\n, m_margin_top  (0)\r\n, m_margin_bottom   (0)\r\n, m_mvDir       (0)\r\n, m_speed       (0.0f)\r\n{\r\n}\r\n\r\nCKLBScrMgrPage::~CKLBScrMgrPage() \r\n{\r\n}\r\n\r\nvoid\r\nCKLBScrMgrPage::setMargin(int top, int bottom)\r\n{\r\n\tm_margin_top    = top;\r\n\tm_margin_bottom = bottom;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrPage::setInitial(int pos)\r\n{\r\n\tsetPosition(pos - m_offset, 0);\r\n\tm_posTarget = loopRound(m_posTarget);\r\n\tm_posNow    = m_posTarget;\t// 初期位置に合わせる\r\n\tm_initial   = true;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrPage::setPosition(int pos, int dir)\r\n{\r\n\tint margin_top  = (m_lenLoop) ? 0 : m_margin_top;\r\n\tint upos        = pos - margin_top + m_offset;\r\n\tint mvDir       = dir;\r\n\tupos = (int)loopRound((float)upos);\r\n//\tif(upos >= -(m_pagesize / 2)) {\r\n\t\tint page = (upos + (m_pagesize / 2)) / m_pagesize;\r\n\t\tint npos = page * m_pagesize + margin_top - m_offset ;\r\n\t\tnpos = (int)loopRound((float)npos);\r\n        if(m_posTarget != npos) { m_mvDir = mvDir; }\r\n\t\tm_posTarget = loopRound(npos);\r\n/*\r\n\t} else {\r\n\t\tm_posTarget = margin_top - m_offset;\r\n\t}\r\n*/\r\n}\r\n\r\nint\r\nCKLBScrMgrPage::getPosition()\r\n{\r\n\treturn (int)loopRound(m_posNow);\r\n}\r\n\r\nint\r\nCKLBScrMgrPage::getBarPosition()\r\n{\r\n\treturn (int)m_posTarget;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrPage::execute(u32 /* deltaT */)\r\n{\r\n\tif((int)(abs(m_posTarget)) == (int)(abs(m_posNow) + 0.05f)) {\r\n\t\tm_posNow = m_posTarget;\r\n\t\tm_mvDir  = 0;\r\n\t\tm_speed  = 0.0f;\r\n\t\tint cbpos = loopRound(m_posNow + m_offset);\r\n\t\texecCallback(cbpos);\r\n\t\treturn;\r\n\t}\r\n\tfloat target = m_posTarget;\r\n    if(m_mvDir < 0 && target > m_posNow) { target -= m_lenLoop; }\r\n\tif(m_mvDir > 0 && target < m_posNow) { target += m_lenLoop; }\r\n\tfloat left = target - m_posNow;\r\n\r\n\tm_speed   = left / m_delay;\r\n\tm_posNow += m_speed;\r\n\tm_posNow  = loopRound(m_posNow);\r\n}\r\n\r\nbool \r\nCKLBScrMgrPage::stillScrolling() {\r\n\t// Less than 2 pix per second.\r\n\treturn fabs(m_speed) > 2.0f;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrMgrPage.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrMgrPage_h\r\n#define CKLBScrMgrPage_h\r\n\r\n#include \"IMgrEntry.h\"\r\n\r\nclass CKLBScrMgrPageFactory : public IMgrEntry\r\n{\r\npublic:\r\n\tCKLBScrMgrPageFactory(const char * name);\r\n\tvirtual ~CKLBScrMgrPageFactory();\r\n\r\n\tCKLBScrollMgr * createManager(int argc, int args[]);\r\n\tCKLBScrollMgr * createManagerByProperty(CKLBPropertyBag * pProp);\r\n\r\n\tenum {\r\n\t\tDEFAULT_DELAY = 10\r\n\t};\r\n};\r\n\r\nclass CKLBScrMgrPage : public CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrMgrPage(int pagesize, int delay, int offset);\r\n\tvirtual ~CKLBScrMgrPage();\r\n\r\n\tvirtual void setMargin      (int top, int bottom);\r\n\tvirtual void setInitial     (int pos);\r\n\tvirtual void setPosition    (int pos, int dir);\r\n\tvirtual int  getPosition    ();\r\n\tvirtual int  getBarPosition ();\r\n\tvirtual void execute        (u32 deltaT);\r\n\tvirtual bool stillScrolling ();\r\nprivate:\r\n\tint\t\t\tm_pagesize;\t\t// ページサイズ\r\n\tint\t\t\tm_delay;\t\t// ディレイ\r\n\tint\t\t\tm_offset;\r\n\r\n\tfloat\t\tm_speed;\r\n\tfloat\t\tm_posTarget;\t// スクロール目標\r\n\tfloat\t\tm_posNow;\t\t// 現在位置\r\n\tint\t\t\tm_mvDir;\t\t// 移動方向\r\n\tint\t\t\tm_margin_top;\r\n\tint\t\t\tm_margin_bottom;\r\n\r\n\tbool\t\tm_initial;\r\n};\r\n\r\n\r\n#endif // CKLBScrMgrPage_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrMgrSolid.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScrMgrSolid.h\"\r\n\r\nstatic CKLBScrMgrSolidFactory factory(\"solid\");\r\n\r\nCKLBScrMgrSolidFactory::CKLBScrMgrSolidFactory(const char * name) \r\n: IMgrEntry (name) \r\n{\r\n}\r\n\r\nCKLBScrMgrSolidFactory::~CKLBScrMgrSolidFactory() \r\n{\r\n}\r\n\r\nCKLBScrollMgr *\r\nCKLBScrMgrSolidFactory::createManager(int /*argc*/, /*int args[]*/ int*)\r\n{\r\n\treturn KLBNEW(CKLBScrMgrSolid);\r\n}\r\n\r\nCKLBScrollMgr *\r\nCKLBScrMgrSolidFactory::createManagerByProperty(CKLBPropertyBag * /*pProp*/)\r\n{\r\n\treturn KLBNEW(CKLBScrMgrSolid);\r\n}\r\n\r\n/*\r\n  サンプルのスクロールマネージャ実装。\r\n  与えられた位置を即その場で反映し、バーの位置 = 値の位置という極めて基本的なサンプル。\r\n  */\r\n\r\nCKLBScrMgrSolid::CKLBScrMgrSolid() \r\n: m_pos (0) \r\n{\r\n}\r\n\r\nCKLBScrMgrSolid::~CKLBScrMgrSolid() \r\n{\r\n}\r\n\r\nvoid\r\nCKLBScrMgrSolid::setMargin(int /*top*/, int /*bottom*/) \r\n{\r\n}\r\n\r\nvoid\r\nCKLBScrMgrSolid::setInitial(int pos)\r\n{\r\n\tm_pos = pos;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrSolid::setPosition(int pos, int /*dir*/)\r\n{\r\n\t/*\r\n\tif(pos < 0) pos = 0;\r\n\tif(pos > m_maxPos) pos = m_maxPos;\r\n*/\r\n\tm_pos = loopRound(pos);\r\n}\r\n\r\nint\r\nCKLBScrMgrSolid::getPosition()\r\n{\r\n\treturn m_pos;\r\n}\r\n\r\nint\r\nCKLBScrMgrSolid::getBarPosition()\r\n{\r\n\treturn m_pos;\r\n}\r\n\r\nvoid\r\nCKLBScrMgrSolid::execute(u32 /* deltaT */)\r\n{\r\n\texecCallback(m_pos);\r\n}\r\n\r\nbool \r\nCKLBScrMgrSolid::stillScrolling() {\r\n\treturn false;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrMgrSolid.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrMgrSolid_h\r\n#define CKLBScrMgrSolid_h\r\n\r\n#include \"IMgrEntry.h\"\r\n\r\nclass CKLBScrMgrSolidFactory : public IMgrEntry\r\n{\r\npublic:\r\n\tCKLBScrMgrSolidFactory(const char * name);\r\n\tvirtual ~CKLBScrMgrSolidFactory();\r\n\r\n\tCKLBScrollMgr * createManager(int argc, int args[]);\r\n\tCKLBScrollMgr * createManagerByProperty(CKLBPropertyBag * pProp);\r\n};\r\n\r\nclass CKLBScrMgrSolid : public CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrMgrSolid();\r\n\tvirtual ~CKLBScrMgrSolid();\r\n\r\n\tvirtual void setMargin      (int top, int bottom);\r\n\tvirtual void setInitial     (int pos);\r\n\tvirtual void setPosition    (int pos, int dir);\r\n\tvirtual int  getPosition    ();\r\n\tvirtual int  getBarPosition ();\r\n\tvirtual void execute        (u32 deltaT);\r\n\tvirtual bool stillScrolling ();\r\nprivate:\r\n\tint\t\t    m_pos;\r\n};\r\n\r\n\r\n#endif // CKLBScrMgrSolid_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrollBarIF.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBTouchPad.h\"\r\n;\r\n// 共通インデックスバッファ\r\nconst u16 CKLBScrollBarIF::ms_indices[] = {\r\n\t0, 1, 3,\r\n\t1, 2, 3,\r\n\t4, 5, 7,\r\n\t5, 6, 7,\r\n\t8, 9, 11,\r\n    9,10, 11,\r\n};\r\n\r\nCKLBScrollMgr::CKLBScrollMgr() \r\n: m_maxPos      (0)\r\n, m_lenLoop     (0)\r\n, m_data        (NULL)\r\n, m_callback    (NULL)\r\n, m_precallPos  (-1) \r\n{\r\n}\r\n\r\nCKLBScrollMgr::~CKLBScrollMgr()\r\n{\r\n\tKLBDELETEA(m_callback);\r\n}\r\n\r\nbool\r\nCKLBScrollMgr::setCallback(void * pData, const char * funcname)\r\n{\r\n\tm_data = pData;\r\n\tconst char * name = CKLBUtility::copyString(funcname);\r\n    if(!name) { return false; }\r\n\tKLBDELETEA(m_callback);\r\n\tm_callback = name;\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBScrollMgr::execCallback(int pos)\r\n{\r\n    if(m_precallPos == pos) { return; }\r\n\tm_precallPos = pos;\r\n\r\n\tCKLBScriptEnv::getInstance().call_eventScrollBarStop(m_callback, (CKLBObjectScriptable*)m_data, pos);\r\n}\r\n\r\nvoid\r\nCKLBScrollMgr::setMaxPosition(int pos)\r\n{\r\n\tm_maxPos = pos;\r\n}\r\n\r\nvoid\r\nCKLBScrollMgr::setLoopArea(int lenLoop)\r\n{\r\n\tm_lenLoop = lenLoop;\r\n}\r\n\r\nfloat\r\nCKLBScrollMgr::loopRound(float pos)\r\n{\r\n    if(!m_lenLoop) { return pos; }\r\n    while(pos < 0.0f)               { pos += (float)m_lenLoop; }\r\n    while(pos >= (float)m_lenLoop)  { pos -= (float)m_lenLoop; }\r\n\treturn pos;\r\n}\r\n\r\n// 2012.11.29  m_callbackの初期化漏れを修正\r\nCKLBScrollBarIF::CKLBScrollBarIF(CKLBLuaTask * pOwner)\r\n: m_pScrMgr     (NULL)\r\n, m_maxPos      (0)\r\n, m_minPos      (0)\r\n, m_barPos      (0)\r\n, m_lastPos     (0)\r\n, m_texHandle   (0)\r\n, m_mode        (0)\r\n, m_first       (true)\r\n, m_bReady      (false)\r\n, m_pNode       (NULL)\r\n, m_pBaseNode   (NULL)\r\n, m_overScroll  (false)\r\n, m_pOwner      (pOwner)\r\n, m_margin_top  (0)\r\n, m_margin_bottom   (0)\r\n, m_minLoop     (0)\r\n, m_maxLoop     (0)\r\n, m_hide_mode   (false)\r\n, m_hide        (false)\r\n, m_timeHide    (0)\r\n, m_bShortHide  (true)\r\n, m_callback    (NULL)\r\n{\r\n}\r\n\r\nCKLBScrollBarIF::~CKLBScrollBarIF()\r\n{\r\n    if(m_texHandle) { CKLBDataHandler::releaseHandle(m_texHandle); }\r\n\tif(m_callback) {\r\n\t\tKLBDELETEA(m_callback);\t// 2012.11.29  解放漏れ修正\r\n\t\tm_callback = NULL;\r\n\t}\r\n    if(m_pScrMgr) { KLBDELETE(m_pScrMgr); }\r\n}\r\n\r\nbool\r\nCKLBScrollBarIF::init(\r\n\t\tCKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos, const char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode)\r\n{\r\n\t// 初期化前にCKLBScrollMgr が登録されている必要がある。\r\n\t// 登録されていない場合は初期化失敗。\r\n\tif(!m_pScrMgr) {\r\n\t\tklb_assert(m_pScrMgr, \"Scroll Manager not found.\");\r\n\t\treturn false;\r\n\t}\r\n\tm_x         = (int)x;\r\n\tm_y         = (int)y;\r\n\tm_width     = (int)width;\r\n\tm_height    = (int)height;\r\n\tm_vertical  = vert;\r\n\tm_hide_mode = hide_mode;\r\n\r\n\tif(hide_mode) {\r\n\t\tm_hide      = true;\r\n\t\tm_timeHide  = 1300; // 初期はhide状態\r\n\t}\r\n\r\n\tm_col_normal = colorNormal;\r\n\tm_col_select = colorSelect;\r\n\r\n\tm_callback = (callback) ? CKLBUtility::copyString(callback) : NULL;\r\n\r\n\t// 必要とされるオブジェクトを生成する\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\t// イメージの取得\r\n\tconst char * imgname    = image;\r\n\tconst char * asset_name = image;\r\n\r\n\t{\r\n\t\tconst char * scheme[] = {\r\n\t\t\t\"asset://\",\r\n\t\t\t\"file://install/\",\r\n\t\t\t\"file://external/\",\r\n\t\t\t0\r\n\t\t};\r\n\t\tfor(int j = 0; scheme[j]; j++) {\r\n\t\t\tint len = strlen(scheme[j]);\r\n\t\t\tif(!strncmp(imgname, scheme[j], len)) {\r\n\t\t\t\timgname += len;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tCKLBTextureAsset * pTexAsset;\r\n\tpTexAsset = (CKLBTextureAsset *)CKLBUtility::loadAssetScript(asset_name, &m_texHandle, 0, true);\r\n\tif(!pTexAsset) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_pTex = pTexAsset->getImage(imgname);\r\n\r\n\tm_pDynSprite = pRdrMgr.allocateCommandDynSprite(6*3,6*3); // 三角形6個分のDynamicSprite\r\n\tif (!m_pDynSprite) {\r\n\t\tCKLBDataHandler::releaseHandle(m_texHandle);\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_pDynSprite->setTexture(m_pTex);\r\n\tm_pDynSprite->changeOrder(pRdrMgr, order);\r\n\tm_order = order;\r\n\r\n\tm_pBaseNode = KLBNEW(CKLBNode);\r\n\tm_pBaseNode->setTranslate(0.0f, 0.0f);\r\n\tm_pNode = KLBNEW(CKLBNode);\r\n\tm_pNode->setRender(m_pDynSprite);\r\n\tm_pNode->setRenderOnDestroy(true);\r\n\r\n\t// 指定された親ノードにぶら下げる\r\n\tpNode->addNode(m_pBaseNode);\r\n\tm_pBaseNode->addNode(m_pNode);\r\n\tm_pNode->setTranslate((float)m_x, (float)m_y);\r\n\r\n\t// Set BEFORE slider size.\r\n\ts32 left;\r\n\ts32 right;\r\n\ts32 middle;\r\n\ts32 bothModeInt;\r\n\ts32 bitmapVertical;\r\n\tbool hasAttrib = true;\r\n\r\n\thasAttrib &= m_pTex->getAttribute(ASSET_ATTRIB::zK1_SC_LEFT,        left);\r\n\thasAttrib &= m_pTex->getAttribute(ASSET_ATTRIB::zK1_SC_MIDDLE,      middle);\r\n\thasAttrib &= m_pTex->getAttribute(ASSET_ATTRIB::zK1_SC_RIGHT,       right);\r\n\thasAttrib &= m_pTex->getAttribute(ASSET_ATTRIB::zK1_SC_HASBITMAP,   bothModeInt);\r\n\thasAttrib &= m_pTex->getAttribute(ASSET_ATTRIB::zK1_SC_ISVERTICAL,  bitmapVertical);\r\n\r\n\tklb_assert(hasAttrib, \"Image source for Scroll bar does not have attributes for scroll bar design\");\r\n\t//klb_assert(bitmapVertical == (vert ? 1 : 0), \"Bitmap and scroll bar have different orientation\");\r\n\r\n\tbool bothMode = bothModeInt ? true : false;\r\n\tbitmapHasBoth = bothMode;\r\n\r\n\tbTotal  = left + right + middle;\r\n\tbLeft   = left;\r\n\tbRight  = right;\r\n\tbMiddle\t= middle;\r\n\t\r\n\tsetMinPosition(minValue);\r\n\tsetMaxPosition(maxValue);\r\n\tsetInitial(pos);\r\n\r\n\tsetSliderSizeMin(min_slider_size);\r\n\tsetSliderSize(slider_size);\r\n\r\n\tm_active = active;\r\n\tm_state  = S_WAIT;\r\n\tm_bReady = true;\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::die()\r\n{\r\n\tCKLBDataHandler::releaseHandle(m_texHandle);\r\n\tm_texHandle = 0;\r\n\r\n\tif(m_callback) {\r\n\t\tKLBDELETEA( m_callback );\t// 2012.11.29  解放漏れ修正\r\n\t\tm_callback = NULL;\r\n\t}\r\n    if(m_pScrMgr) { KLBDELETE(m_pScrMgr); }\r\n\tm_pScrMgr = NULL;\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setSliderSize(s32 value)\r\n{\r\n\ts32  size = m_vertical ? m_height : m_width;\r\n\r\n\tif (value > size) {\r\n\t\tvalue = size;\t\r\n\t}\r\n\r\n\ts32 minSize  = m_slider_min_size;\r\n\tif (value < minSize) {\r\n\t\tvalue = minSize;\r\n\t}\r\n\r\n\ts32 currSize = m_slider_size;\r\n\tif (value != currSize) {\r\n\t\tm_slider_size = value;\r\n\t\tm_bCmdUpdate = true;\r\n\t}\r\n\t// m_barPos = m_pScrMgr->getBarPosition();\r\n\tm_barPos = m_pScrMgr->getNowBar();\r\n    if(m_barPos < 0)                    { m_barPos = m_minPos; }\r\n    if(m_barPos > m_maxPos - m_minPos)  { m_barPos = m_maxPos - m_minPos; }\r\n    if(m_bReady)                        { updateDisplay(); }\r\n\r\n\t// 変更後のスライダサイズで表示状態を変更する\r\n\tsetVisible(m_visible);\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setSliderSizeMin(s32 value)\r\n{\r\n\tif (value < (bLeft + bRight)) {\r\n\t\tvalue = bLeft + bRight;\r\n\t}\r\n\r\n\ts32  size = m_vertical ? m_height : m_width;\r\n\tif (value > size) {\r\n\t\tvalue = size;\r\n\t}\r\n\r\n\ts32 minSize  = m_slider_min_size;\r\n\tif (value != minSize) {\r\n\t\tm_slider_min_size = value;\r\n\t\tm_bCmdUpdate = true;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setColorMode(u32 mode, u32 color) \r\n{\r\n\t// OPTIMIZE : Can optimize on value change\r\n\r\n\tif (mode == 0) {\r\n\t\tm_col_normal = color;\r\n\t} else {\r\n\t\tm_col_select = color;\r\n\t}\r\n\r\n\tm_bCmdUpdate = true;\r\n}\r\n\r\nu32\r\nCKLBScrollBarIF::getColorMode(u32 mode) \r\n{\r\n\treturn (mode ? m_col_select : m_col_normal);\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setMode(u32 mode) \r\n{\r\n\tif (mode != m_mode) {\r\n\t\tm_mode          = (u8)mode;\r\n\t\tm_first         = true;\r\n\t\tm_bCmdUpdate    = true;\r\n\r\n\t\tif(m_mode) {\r\n\t\t\tSColorVector vec;\r\n            for(int i = 0; i < 4; i++) { vec.m_vector[i] = 1.0f; }\r\n            if(m_pBaseNode) { m_pBaseNode->setColorMatrix(vec); }\r\n\t\t\tm_hide = false;\r\n\t\t} else {\r\n\t\t\tm_timeHide = 0;\r\n\t\t\tm_hide = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBScrollBarIF::setTouchActive(bool active) \r\n{\r\n\tm_active = active;\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setScrollMgr(CKLBScrollMgr * mgr)\r\n{\r\n\tKLBDELETE(m_pScrMgr);\r\n\tm_pScrMgr = mgr;\r\n\tm_pScrMgr->setMargin(m_margin_top, m_margin_bottom);\r\n\tm_pScrMgr->setMaxPosition(m_maxPos);\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setCtrlStatus(bool status)\r\n{\r\n\tsetMode((status) ? 1 : 0);\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setMaxPosition(int maxPos)\r\n{\r\n\tm_maxPos = maxPos;\r\n\tif(m_pScrMgr) {\r\n\t\tm_pScrMgr->setMaxPosition(m_maxPos - m_minPos);\r\n\t\t// m_barPos = m_pScrMgr->getBarPosition();\r\n\t\tm_barPos = m_pScrMgr->getNowBar();\r\n        if(m_barPos < 0)                    { m_barPos = m_minPos;              }\r\n\t\tif(m_barPos > m_maxPos - m_minPos)  { m_barPos = m_maxPos - m_minPos;   }\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setMinPosition(int minPos)\r\n{\r\n\tm_minPos = minPos;\r\n\tif(m_pScrMgr) {\r\n\t\tm_pScrMgr->setMaxPosition(m_maxPos - m_minPos);\r\n\t\t//m_barPos = m_pScrMgr->getBarPosition();\r\n\t\tm_barPos = m_pScrMgr->getNowBar();\r\n        if(m_barPos < 0)                    { m_barPos = m_minPos;              }\r\n\t\tif(m_barPos > m_maxPos - m_minPos)  { m_barPos = m_maxPos - m_minPos;   }\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setInitial(int pos)\r\n{\r\n\tif(!m_overScroll) {\r\n        if(pos < m_minPos) { pos = m_minPos; }\r\n\t\tif(pos > m_maxPos) { pos = m_maxPos; }\r\n\t}\r\n\t// バーの位置は overScroll を問わずクリッピングする\r\n\tm_barPos = pos - m_minPos;\r\n\tint setPos = m_barPos;\r\n\tif((m_maxLoop - m_minLoop) == 0) {\r\n        if(m_barPos < 0)                    { m_barPos = 0;                     }\r\n        if(m_barPos > m_maxPos - m_minPos)  { m_barPos = m_maxPos - m_minPos;   }\r\n\t} else {\r\n        if(m_barPos < 0)                    { m_barPos += m_maxPos - m_minPos;  }\r\n        if(m_barPos > m_maxPos - m_minPos)  { m_barPos -= m_maxPos - m_minPos;  }\r\n\t}\r\n\tif(m_pScrMgr) {\r\n\t\tm_pScrMgr->initPos(setPos);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setPosition(int pos, int dir)\r\n{\r\n\tif(!m_overScroll) {\r\n        if(pos < m_minPos) { pos = m_minPos; }\r\n\t\tif(pos > m_maxPos) { pos = m_maxPos; }\r\n\t}\r\n\t// バーの位置は overScroll を問わずクリッピングする\r\n\tm_barPos = pos - m_minPos;\r\n\tint setPos = m_barPos;\r\n\tif((m_maxLoop - m_minLoop) == 0) {\r\n        if(m_barPos < 0)                    { m_barPos = 0;                     }\r\n        if(m_barPos > m_maxPos - m_minPos)  { m_barPos = m_maxPos - m_minPos;   }\r\n\t} else {\r\n        if(m_barPos < 0)                    { m_barPos += m_maxPos - m_minPos;  }\r\n\t\tif(m_barPos > m_maxPos - m_minPos)  { m_barPos -= m_maxPos - m_minPos;  }\r\n\t}\r\n\tif(m_pScrMgr) {\r\n\t\tm_pScrMgr->setPos(setPos, dir);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setMargin(int top, int bottom)\r\n{\r\n\tm_margin_top = top;\r\n\tm_margin_bottom = bottom;\r\n\tif(m_pScrMgr) {\r\n\t\tm_pScrMgr->setMargin(top, bottom);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::setLoopArea(int min, int max)\r\n{\r\n\tm_minLoop = min;\r\n\tm_maxLoop = max;\r\n\tif(m_pScrMgr) m_pScrMgr->setLoopArea(max - min);\r\n}\r\n\r\nint\r\nCKLBScrollBarIF::getPosition()\r\n{\r\n\tif(m_pScrMgr) {\r\n\t\t// m_lastPos = m_pScrMgr->getPosition();\r\n\t\tm_lastPos = m_pScrMgr->getNowPos();\r\n\t}\r\n\tif(!m_overScroll && !(m_maxLoop - m_minLoop)) {\r\n        if(m_lastPos < 0)                   { m_lastPos = 0;                    }\r\n\t\tif(m_lastPos > m_maxPos - m_minPos) { m_lastPos = m_maxPos - m_minPos;  }\r\n\t}\r\n\treturn m_lastPos + m_minPos;\r\n}\r\n\r\nint\r\nCKLBScrollBarIF::getBarPosition()\r\n{\r\n\treturn m_barPos;\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::execute(u32 deltaT)\r\n{\r\n\tif(m_hide_mode && m_hide) {\r\n\t\tm_timeHide += deltaT;\r\n\t\tif(m_timeHide >= 1000 && !m_mode) {\t// 操作終了から1秒を超えていたら、0.3秒でフェードアウトさせる。\r\n\t\t\tu32 fadeTime = m_timeHide - 1000;\r\n\t\t\tif(fadeTime >= 300) {\r\n\t\t\t\tfadeTime = 300;\r\n\t\t\t\tm_hide = false;\r\n\t\t\t}\r\n\t\t\tfloat alpha = (300 - fadeTime) / 300.0f;\r\n\t\t\tSColorVector vec;\r\n            for(int i = 0; i < 3; i++) { vec.m_vector[i] = 1.0f; }\r\n\t\t\tvec.m_vector[3] = alpha;\r\n\t\t\tm_pBaseNode->setColorMatrix(vec);\r\n\t\t}\r\n\t}\r\n\t// 無効にされていたら何もしない。\r\n    if(!m_enable) { return; }\r\n\t\t\r\n\t// 表示されていて操作が許可されている場合は操作を受け付ける\r\n    if(m_bReady && m_visible && m_active) { procUserCtrl(); }\r\n\r\n\t// 操作結果をスクロールマネージャに通し、最終的なバーの表示位置を取得する\r\n\tif(m_pScrMgr) {\r\n\t\tm_pScrMgr->execute(deltaT);\r\n\r\n\t\t//m_barPos = m_pScrMgr->getBarPosition();\r\n\t\tm_barPos = m_pScrMgr->getNowBar();\r\n\t} else {\r\n\t\tm_barPos = m_lastPos;\r\n\t}\r\n    if(m_barPos < 0)                    { m_barPos = 0;                     }\r\n\tif(m_barPos > m_maxPos - m_minPos)  { m_barPos = m_maxPos - m_minPos;   }\r\n\r\n\t// そもそも初期化されていない場合は何も処理しない\r\n    if(!m_bReady) { return; }\r\n\r\n\t// バー位置が変更されていたら表示の変更処理を行う\r\n\tif(m_prePos != m_barPos || m_bCmdUpdate) {\r\n\t\tupdateDisplay();\r\n\t\tm_bCmdUpdate = false;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::procUserCtrl()\r\n{\r\n    CKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n    const PAD_ITEM * item;\r\n\r\n    tpq.startItem();\r\n\r\n    bool bFirst = true;\r\n\r\n    while((item = tpq.getItem())) {\r\n\r\n\t    switch(item->type)\r\n\t    {\r\n\t    case PAD_ITEM::TAP:\r\n\t\t    {\r\n\t\t\t    // そのフレームで最初にみつけたTAPならば、\r\n\t\t\t    // 現在DragIconのある位置から、絶対座標上のヒットボックスを計算する\r\n\t\t\t    if(bFirst) {\r\n\t\t\t\t    bFirst = false;\r\n\t\t\t\t    CKLBNode * pNode = m_pNode;\r\n\t\t\t\t    CKLBUtility::getNodeInverseMatrix(pNode, m_invTransf);\r\n\t\t\t\t    CKLBUtility::transform(&m_invTransf, item->x, item->y, m_ofs_x, m_ofs_y);\r\n\t\t\t    }\r\n\r\n\t\t\t    if(\t   (m_ofs_x >= 0.0f    ) \r\n\t\t\t\t    && (m_ofs_x <= (float)m_width) \r\n\t\t\t\t    && (m_ofs_y >=0.0f     ) \r\n\t\t\t\t    && (m_ofs_y <= (float)m_height) ) {\r\n\r\n\t\t\t\t    bool isSliderDrag = false;\r\n\r\n\t\t\t\t    s32 deltaTotal  = m_maxPos - m_minPos;\r\n\t\t\t\t    s32 pos         = m_barPos;\r\n\t\t\t\t    s32 sliderSize  = m_slider_size;\r\n\r\n\t\t\t\t    if (m_vertical) {\r\n\t\t\t\t\t    // Vertical\r\n\t\t\t\t\t    s32 sliderPos\t= m_height - sliderSize;\t\r\n\t\t\t\t\t    s32 posY\t\t= deltaTotal ? (sliderPos * pos) / deltaTotal : 0;\r\n\r\n\t\t\t\t\t    isSliderDrag\t= (m_ofs_y >= posY && m_ofs_y <= (posY + sliderSize));\r\n\t\t\t\t    } else {\r\n\t\t\t\t\t    // Horizontal\r\n\t\t\t\t\t    s32 sliderPos\t= m_width  - sliderSize;\t\r\n\t\t\t\t\t    s32 posX\t\t= deltaTotal ? (sliderPos * pos) / deltaTotal : 0;\r\n\r\n\t\t\t\t\t    isSliderDrag\t= (m_ofs_x >= posX && m_ofs_x <= (posX + sliderSize));\r\n\t\t\t\t    }\r\n\r\n\t\t\t\t    if (isSliderDrag) {\r\n\t\t\t\t\t    setMode(1); // Selected Mode\r\n\t\t\t\t\t    m_dragStartPos = m_barPos + m_minPos;\r\n\t\t\t\t\t    m_state = S_DRAG;\t// 状態をドラッグ中のstateに変更\r\n\t\t\t\t    } else {\r\n\t\t\t\t\t    m_state = S_DRAG_IGNORE;\r\n\t\t\t\t    }\r\n\t\t\t\t    m_tid = item->id;\t// 操作に使われたポイントIDを記録する\r\n\t\t\t\t    tpq.useItem(item, this);\r\n\t\t\t    }\r\n\t\t    }\r\n\t\t    break;\r\n\t    case PAD_ITEM::DRAG:\r\n\t\t    {\r\n\t\t\t    // このタスクのステートがドラッグ中でない限り、\r\n\t\t\t    // そのドラッグは他の用途のためのドラッグ操作。\r\n\t\t\t    // また、タップ時に確定した操作ポイントIDが異なる場合も異なる操作。\r\n\t\t\t    if(m_state == S_WAIT || m_tid != item->id) break;\r\n\r\n\t\t\t    if (m_state == S_DRAG) {\r\n\t\t\t\t    setMode(1); // Selected Mode\r\n\r\n\t\t\t\t    float drag_x,drag_y,delta;\r\n\t\t\t\t    s32 lengthScr;\r\n\t\t\t\t    s32 lengthValue;\r\n\r\n\t\t\t\t    CKLBUtility::transform(&m_invTransf, item->x, item->y, drag_x, drag_y);\r\n\r\n\t\t\t\t    lengthValue = m_maxPos - m_minPos;\r\n\t\t\t\t    if (m_vertical) {\r\n\t\t\t\t\t    delta       = drag_y - m_ofs_y;\r\n\t\t\t\t\t    lengthScr   = m_height - m_slider_size;\r\n\t\t\t\t    } else {\r\n\t\t\t\t\t    delta       = drag_x - m_ofs_x;\r\n\t\t\t\t\t    lengthScr   = m_width - m_slider_size;\r\n\t\t\t\t    }\r\n\r\n\t\t\t\t    s32 scrollAmount = (lengthValue * delta) / lengthScr;\t// Pixel Delta => Scroll Delta\r\n\t\t\t\t    s32 oldPos       = m_barPos + m_minPos;\r\n\t\t\t\t    setPosition(m_dragStartPos + scrollAmount);\r\n\r\n\t\t\t\t    s32 nowPos = getPosition();\r\n\t\t\t\t    if(oldPos != nowPos) {\r\n\t\t\t\t\t    CKLBScriptEnv::getInstance().call_eventScrollBar(m_callback, m_pOwner, SCROLLBAR_DRAG, nowPos);\r\n\t\t\t\t    }\r\n\t\t\t    }\r\n\r\n\t\t\t    // ドラッグ座標をコールバックに通知する。\r\n\t\t\t    tpq.useItem(item, this);\r\n\t\t    }\r\n\t\t    break;\r\n\t    case PAD_ITEM::RELEASE:\r\n\t    case PAD_ITEM::CANCEL:\r\n\t\t    {\t\t\t\t\t\r\n\t\t\t    // このタスクのステートがドラッグ中でない限り\r\n\t\t\t    // そのドラッグは他の用途のためのドラッグ操作。\r\n\t\t\t    // また、タップ時に確定した操作ポイントIDが異なる場合も異なる操作。\r\n                if(m_state == S_WAIT || m_tid != item->id) { break; }\r\n\t\t\t\t\t\r\n\t\t\t    if (m_state == S_DRAG) {\r\n\t\t\t\t    setMode(0); // Selected Mode\r\n\r\n\t\t\t\t    CKLBScriptEnv::getInstance().call_eventScrollBar(m_callback, m_pOwner, SCROLLBAR_RELEASE, getPosition());\r\n\t\t\t    }\r\n\r\n\t\t\t    // リリースされた座標をコールバックに通知する。\r\n\t\t\t    tpq.useItem(item, this);\r\n\t\t\t    m_state = S_WAIT;\r\n\t\t\t    m_tid = -1;\t// そのIDはリリースされたので、操作が行われていない状態に戻す\r\n\t\t    }\r\n\t\t    break;\r\n\t    }\r\n    }\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::updateDisplay()\r\n{\r\n\trecompute();\r\n\tm_prePos = m_barPos;\r\n}\r\n\r\nvoid\r\nCKLBScrollBarIF::recompute() \r\n{\r\n\t// Compute new UV,XY\r\n\r\n\t/*\r\n\t\t0---1\r\n\t\t|\t|\r\n\t\t|\t|\r\n\t\t3---2\r\n\t */\r\n\r\n\tSColorVector col;\r\n\r\n\t// OPTIMIZE : Could store internally as float also to avoid this conversion\r\n\tu32 color = getColorMode(m_mode);\t// ARGB\r\n\tcol.m_vector[0]\t= ((color >> 16) & 0xFF) / 255.0f;\t// R\r\n\tcol.m_vector[1]\t= ((color >> 8 ) & 0xFF) / 255.0f;\t// G\r\n\tcol.m_vector[2]\t= ((color      ) & 0xFF) / 255.0f;\t// B\r\n\tcol.m_vector[3]\t= ((color >> 24) & 0xFF) / 255.0f;\t// A\r\n\r\n\tm_pNode->setColorMatrix(col);\r\n\r\n\tif (m_first) {\r\n\t\t//\r\n\t\tfloat u0,u1,u2,u3;\r\n\t\tfloat v0,v1,v2,v3;\r\n\r\n\t\t// Bitmap including all sub bitmaps.\r\n\t\tm_pTex->getUV(0, &u0, &v0);\r\n\t\tm_pTex->getUV(1, &u1, &v1);\r\n\t\tm_pTex->getUV(2, &u2, &v2);\r\n\t\tm_pTex->getUV(3, &u3, &v3);\r\n\r\n\t\tfloat du0 = u1 - u0;\r\n\t\tfloat dv0 = v1 - v0;\r\n\t\t// float du1 = u3 - u0;\r\n\t\t// float dv1 = v3 - v0;\r\n\r\n\t\t// Find if texture is oriented\r\n\t\tbool texHoriz = true;\r\n\t\tif (du0 < dv0) {\r\n\t\t\ttexHoriz = false;\r\n\t\t}\r\n\r\n\t\t// Swap UV\r\n\t\tif (!texHoriz) {\r\n\t\t\tfloat t;\r\n\t\t\tt = u0; u0 = v0; v0=t;\t\r\n\t\t\tt = u1; u1 = v1; v1=t;\t\r\n\t\t\tt = u2; u2 = v2; v2=t;\t\r\n\t\t\tt = u3; u3 = v3; v3=t;\t\r\n\t\t}\r\n\r\n\t\tif (bitmapHasBoth) {\r\n\t\t\tif (!m_vertical) {\r\n\t\t\t\tfloat step = (u1-u0)/2.0f;\r\n\t\t\t\tu0 += step * m_mode;\r\n\t\t\t\tu3 += step * m_mode;\r\n\t\t\t\tu1 = u0 + step;\r\n\t\t\t\tu2 = u3 + step;\r\n\t\t\t} else {\r\n\t\t\t\tfloat step = (v2-v0)/2.0f;\r\n\t\t\t\tv0 += step * m_mode;\r\n\t\t\t\tv1 += step * m_mode;\r\n\t\t\t\tv2 = v0 + step;\r\n\t\t\t\tv3 = v1 + step;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Do not change UV\r\n\t\t}\r\n\r\n\t\t// Can optimize :\r\n\t\t// - u1-u0 and u2-u3 should be the same.\r\n\t\t// - can factorize u1-u0 / bTotal for all expressions.\r\n\t\t// - factorize all\r\n\t\t// - bLeft, etc... can be store as float to avoid conv each time.\r\n\t\t// - Most of this could be computed\r\n\r\n\t\tif (!m_vertical) {\r\n\t\t\t// Left   Item\r\n\t\t\tm_vertices[0 ].u = u0;\t\t\t\t\t\t\t\t\t\t\t\t\tm_vertices[0 ].v = v0;\r\n\t\t\tm_vertices[1 ].u = u0 + (((u1 - u0)*bLeft) / bTotal);\t\t\t\t\tm_vertices[1 ].v = v1;\r\n\t\t\tm_vertices[2 ].u = u3 + (((u2 - u3)*bLeft) / bTotal);\t\t\t\t\tm_vertices[2 ].v = v2;\r\n\t\t\tm_vertices[3 ].u = u3;\t\t\t\t\t\t\t\t\t\t\t\t\tm_vertices[3 ].v = v3;\r\n\r\n\t\t\t// Middle Item\r\n\t\t\tm_vertices[4 ].u = m_vertices[1].u;\t\t\t\t\t\t\t\t\t\tm_vertices[4 ].v = v0;\r\n\t\t\tm_vertices[5 ].u = m_vertices[1].u + (((u1 - u0)*bMiddle) / bTotal);\tm_vertices[5 ].v = v1;\r\n\t\t\tm_vertices[6 ].u = m_vertices[2].u + (((u1 - u0)*bMiddle) / bTotal);\tm_vertices[6 ].v = v2;\r\n\t\t\tm_vertices[7 ].u = m_vertices[2].u;\t\t\t\t\t\t\t\t\t\tm_vertices[7 ].v = v3;\r\n\r\n\t\t\t// Right  Item\r\n\t\t\tm_vertices[8 ].u = m_vertices[5].u;\t\t\t\t\t\t\t\t\t\tm_vertices[8 ].v = v0;\r\n\t\t\tm_vertices[9 ].u = m_vertices[5].u + (((u1 - u0)*bRight) / bTotal);\t\tm_vertices[9 ].v = v1;\r\n\t\t\tm_vertices[10].u = m_vertices[6].u + (((u1 - u0)*bRight) / bTotal);\t\tm_vertices[10].v = v2;\r\n\t\t\tm_vertices[11].u = m_vertices[6].u;\t\t\t\t\t\t\t\t\t\tm_vertices[11].v = v3;\r\n\t\t} else {\r\n\t\t\tm_vertices[0 ].u = u0;\r\n\t\t\tm_vertices[1 ].u = u1;\r\n\t\t\tm_vertices[2 ].u = u2;\r\n\t\t\tm_vertices[3 ].u = u3;\r\n\r\n\t\t\tm_vertices[4 ].u = u0;\r\n\t\t\tm_vertices[5 ].u = u1;\r\n\t\t\tm_vertices[6 ].u = u2;\r\n\t\t\tm_vertices[7 ].u = u3;\r\n\r\n\t\t\tm_vertices[8 ].u = u0;\r\n\t\t\tm_vertices[9 ].u = u1;\r\n\t\t\tm_vertices[10].u = u2;\r\n\t\t\tm_vertices[11].u = u3;\r\n\r\n\r\n\t\t\t// Left   Item\r\n\t\t\tm_vertices[0 ].v = v0;\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\tm_vertices[1 ].v = v1;\r\n\t\t\tm_vertices[2 ].v = v1 + (((v2 - v1)*bLeft) / bTotal);\t\t\t\t\t\r\n\t\t\tm_vertices[3 ].v = v0 + (((v3 - v0)*bLeft) / bTotal);\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t// Middle Item\r\n\t\t\tm_vertices[4 ].v = m_vertices[3].v;\t\t\t\t\t\t\t\t\t\t\r\n\t\t\tm_vertices[5 ].v = m_vertices[2].v;\r\n\t\t\tm_vertices[6 ].v = m_vertices[2].v + (((v2 - v1)*bMiddle) / bTotal);\r\n\t\t\tm_vertices[7 ].v = m_vertices[3].v + (((v2 - v1)*bMiddle) / bTotal);\r\n\r\n\t\t\t// Right  Item\r\n\t\t\tm_vertices[8 ].v = m_vertices[7].v;\t\t\t\t\t\t\t\t\t\t\r\n\t\t\tm_vertices[9 ].v = m_vertices[6].v;\r\n\t\t\tm_vertices[10].v = m_vertices[6].v + (((v2 - v1)*bRight) / bTotal);\r\n\t\t\tm_vertices[11].v = m_vertices[7].v + (((v2 - v1)*bRight) / bTotal);\r\n\t\t}\r\n\r\n\t\tif (!texHoriz) {\r\n\t\t\t// Swap back U & V.\r\n\t\t\tfor(int i = 0; i < 12; i++) {\r\n\t\t\t\tfloat t = m_vertices[i].u;\r\n\t\t\t\tm_vertices[i].u = m_vertices[i].v;\r\n\t\t\t\tm_vertices[i].v = t;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tm_first = false;\r\n\t}\r\n\r\n\r\n\t// ### OPTIMIZE Expressions ### (factorization, convertion cast)\r\n\r\n\ts32 deltaTotal  = m_maxPos - m_minPos;\r\n\ts32 pos         = m_barPos;\r\n\ts32 sliderSize  = m_slider_size;\r\n\r\n\ts32 bMiddleScr\t= sliderSize - (bLeft + bRight);\r\n\r\n\tif (m_vertical) {\r\n\t\t// Vertical\r\n\t\ts32 sliderPos   = m_height - sliderSize;\t\r\n\t\ts32 posY        = s32(deltaTotal ? (((s64)sliderPos * pos)) / deltaTotal : 0);\r\n\r\n\t\t// ==== Coordinate ====\r\n\t\tfloat width = (float)m_width;\r\n\r\n\t\t// Left   Item\r\n\t\tm_vertices[0 ].x = 0.0f;\t\t\t\t\t\t\tm_vertices[0 ].y = posY;\t\t\t\t\t\t\t\t\r\n\t\tm_vertices[1 ].x = width;\t\t\t\t\t\t\tm_vertices[1 ].y = posY;\t\t\t\t\t\t\r\n\t\tm_vertices[2 ].x = width;\t\t\t\t\t\t\tm_vertices[2 ].y = posY + bLeft;\t\t\t\t\t\t\r\n\t\tm_vertices[3 ].x = 0.0f;\t\t\t\t\t\t\tm_vertices[3 ].y = posY + bLeft;\r\n\r\n\t\t// Middle Item\r\n\t\tm_vertices[4 ].x = 0.0f;\t\t\t\t\t\t\tm_vertices[4 ].y = m_vertices[3].y;\r\n\t\tm_vertices[5 ].x = width;\t\t\t\t\t\t\tm_vertices[5 ].y = m_vertices[2].y;\t\t\r\n\t\tm_vertices[6 ].x = width;\t\t\t\t\t\t\tm_vertices[6 ].y = m_vertices[2].y + bMiddleScr;\t\t\r\n\t\tm_vertices[7 ].x = 0.0f;\t\t\t\t\t\t\tm_vertices[7 ].y = m_vertices[3].y + bMiddleScr;\t\t\t\t\t\r\n\r\n\t\t// Right  Item\r\n\t\tm_vertices[8 ].x = 0.0f;\t\t\t\t\t\t\tm_vertices[8 ].y = m_vertices[7].y;\t\t\t\t\t\r\n\t\tm_vertices[9 ].x = width;\t\t\t\t\t\t\tm_vertices[9 ].y = m_vertices[6].y;\r\n\t\tm_vertices[10].x = width;\t\t\t\t\t\t\tm_vertices[10].y = m_vertices[6].y + bRight;\t\t\r\n\t\tm_vertices[11].x = 0.0f;\t\t\t\t\t\t\tm_vertices[11].y = m_vertices[7].y + bRight;\r\n\t} else {\r\n\t\t// Horizontal\r\n\t\ts32 sliderPos\t= m_width  - sliderSize;\t\r\n\t\ts32 posX\t\t= (s32)(deltaTotal ? (((s64)sliderPos * pos)) / deltaTotal : 0);\r\n\r\n\t\t// ==== Coordinate ====\r\n\t\tfloat height = (float)m_height;\r\n\r\n\t\t// Left   Item\r\n\t\tm_vertices[0 ].x = posX;\t\t\t\t\t\t\tm_vertices[0].y = 0.0f;\r\n\t\tm_vertices[1 ].x = posX + bLeft;\t\t\t\t\tm_vertices[1].y = 0.0f;\r\n\t\tm_vertices[2 ].x = posX + bLeft;\t\t\t\t\tm_vertices[2].y = height;\r\n\t\tm_vertices[3 ].x = posX;\t\t\t\t\t\t\tm_vertices[3].y = height;\r\n\r\n\t\t// Middle Item\r\n\t\tm_vertices[4 ].x = m_vertices[1].x;\t\t\t\t\tm_vertices[4].y = 0.0f;\r\n\t\tm_vertices[5 ].x = m_vertices[1].x + bMiddleScr;\tm_vertices[5].y = 0.0f;\r\n\t\tm_vertices[6 ].x = m_vertices[2].x + bMiddleScr;\tm_vertices[6].y = height;\r\n\t\tm_vertices[7 ].x = m_vertices[2].x;\t\t\t\t\tm_vertices[7].y = height;\r\n\r\n\t\t// Right  Item\r\n\t\tm_vertices[8 ].x = m_vertices[5].x;\t\t\t\t\tm_vertices[8 ].y = 0.0f;\r\n\t\tm_vertices[9 ].x = m_vertices[5].x + bRight;\t\tm_vertices[9 ].y = 0.0f;\r\n\t\tm_vertices[10].x = m_vertices[6].x + bRight;\t\tm_vertices[10].y = height;\r\n\t\tm_vertices[11].x = m_vertices[6].x;\t\t\t\t\tm_vertices[11].y = height;\r\n\t}\r\n\r\n\tfor(int i = 0; i < 18; i++) {\r\n\t\tint idx = ms_indices[i];\r\n\t\tm_pDynSprite->setVertexXY(i, m_vertices[idx].x, m_vertices[idx].y);\r\n\t\tm_pDynSprite->setVertexUV(i, m_vertices[idx].u, m_vertices[idx].v);\r\n\t}\r\n\r\n\tm_pNode->markUpMatrix();\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBScrollBarIF.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBScrollBarIF_h\r\n#define CKLBScrollBarIF_h\r\n\r\n\r\n#include \"CLuaState.h\"\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n//! スクロールマネージャインタフェース\r\nclass CKLBScrollMgr\r\n{\r\npublic:\r\n\tCKLBScrollMgr();\r\n\tvirtual ~CKLBScrollMgr();\r\n\r\n\tvoid setMaxPosition (int max);\r\n\tvoid setLoopArea    (int lenLoop = 0);\r\n\r\n\t// callbackの設定\r\n\tbool setCallback    (void * pData, const char * funcname);\r\n\r\n\t// 引数として位置を与え callback を呼び出す\r\n\tvoid execCallback   (int pos);\r\n\r\n\tinline void initPos (int pos) {\r\n\t\tsetInitial(pos);\r\n\t}\r\n\t\r\n\tinline void setPos  (int pos, int dir) {\r\n\t\tsetPosition(pos, dir);\r\n\t}\r\n\r\n\tinline int  getNowPos() {\r\n\t\tfloat pos = (float)getPosition();\r\n\t\treturn (int)loopRound(pos);\r\n\t}\r\n\tinline int  getNowBar() {\r\n\t\tfloat pos = (float)getBarPosition();\r\n\t\tpos = loopRound(pos);\r\n\t\tif(pos > (float)m_maxPos) pos = (float)m_maxPos;\r\n\t\treturn (int)pos;\r\n\t}\r\n\r\n\tvirtual void setMargin      (int top, int bottom)   = 0;\r\n\tvirtual void setInitial     (int pos)               = 0; \r\n\tvirtual void setPosition    (int pos, int dir)      = 0;\r\n\tvirtual int  getPosition    ()                      = 0;\r\n\tvirtual int  getBarPosition ()                      = 0;\r\n\tvirtual void execute        (u32 deltaT)            = 0;\r\n\tvirtual bool stillScrolling ()                      = 0;\r\nprotected:\r\n\tfloat loopRound(float pos);\r\n\r\n\tint\t\t\t\tm_maxPos;\r\n\tint\t\t\t\tm_lenLoop;\r\n\r\n\tvoid\t\t*\tm_data;\t\t\t// data pointer for callback.\r\n\tconst char\t*\tm_callback;\t\t// callback function name\r\n\tint\t\t\t\tm_precallPos;\r\n};\r\n\r\n\r\n//! スクロールバーインタフェース\r\n/*!\r\n\t\r\n*/\r\nclass CKLBScrollBarIF\r\n{\r\npublic:\r\n\tenum {\r\n\t\tSCROLLBAR_DRAG\t\t= 0,\r\n\t\tSCROLLBAR_RELEASE\t= 1,\r\n\t\tSCROLLBAR_STOPPED\t= 2,\t// Use for C# callback of CKLBScrollMgr::execCallback\r\n\t};\r\n\r\n\tCKLBScrollBarIF(CKLBLuaTask * pOwner = 0);\r\n\tvirtual ~CKLBScrollBarIF();\r\n\r\n\tvoid setScrollMgr(CKLBScrollMgr * mgr);\r\n\tinline bool setScrMgrCallback(void * pData, const char * funcname) {\r\n\t\tbool bResult = false;\r\n\t\tif(m_pScrMgr) {\r\n\t\t\tbResult = m_pScrMgr->setCallback(pData, funcname);\r\n\t\t}\r\n\t\treturn bResult;\r\n\t}\r\n\r\n\tinline bool isScrolling() {\r\n\t\tif (m_pScrMgr) {\r\n\t\t\treturn m_pScrMgr->stillScrolling();\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tbool init(\r\n\t\tCKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos, const char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode = false);\r\n\r\n\tvoid die                ();\r\n\r\n\tvoid setSliderSize      (s32 value);\r\n\tvoid setSliderSizeMin   (s32 value);\r\n\tvoid setColorMode       (u32 mode, u32 color);\r\n\tu32  getColorMode       (u32 mode);\r\n\tvoid setMode            (u32 mode);\r\n\tvoid setTouchActive     (bool active);\r\n\r\n\tinline void setOverScroll   (bool overscroll)   { m_overScroll = overscroll; }\r\n\tinline void setShortHide    (bool shortHide)    { m_bShortHide = shortHide;  }\r\n\r\n\tinline void setVisible      (bool visible) {\r\n\t\tm_visible = visible;\r\n\t\tif(m_pNode) {\r\n\t\t\ts32  size = m_vertical ? m_height : m_width;\r\n\t\t\tif(m_slider_size >= size && m_bShortHide) visible = false;\r\n\t\t\tm_pNode->setVisible(visible);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setEnable       (bool enable)       { m_enable = enable; }\r\n\r\n\tinline void setVertical     (bool vertical) {\r\n\t\tif (vertical != m_vertical) {\r\n\t\t\tm_vertical = vertical;\r\n\t\t\tm_bCmdUpdate = true;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setWidth        (s32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_bCmdUpdate = false;\r\n\t\t\tm_width = width;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setHeight       (s32 height) {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_bCmdUpdate = false;\r\n\t\t\tm_height = height;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setOrder        (u32 order) {\r\n\t\tif (m_order != order) {\r\n\t\t\tm_order = order;\r\n\t\t\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\t\t\tm_pDynSprite->changeOrder(pRdrMgr, order);\r\n\t\t}\r\n\t}\r\n\r\n\tvoid setMaxPosition (int max);\r\n\tvoid setMinPosition (int min);\r\n\tvoid setLoopArea    (int min, int max);\r\n\tvoid setInitial     (int pos);\r\n\tvoid setPosition    (int pos, int dir = 0);\t// dir = スクロール方向指定\r\n\tvoid setMargin      (int top, int bottom);\r\n\tvoid setCtrlStatus  (bool status);\r\n\tint getPosition     ();\r\n\tint getBarPosition  ();\r\n\r\n\tinline int getMinPosition   () { return m_minPos; }\r\n\tinline int getMaxPosition   () { return m_maxPos; }\r\n\r\n\tinline int getSliderSize    () { return m_slider_size;      }\r\n\tinline int getSliderSizeMin () { return m_slider_min_size;  }\r\n\r\n\tinline bool getTouchActive  () { return m_active; }\r\n\r\n\tvoid execute(u32 deltaT);\r\n\r\nprivate:\r\n\tvoid procUserCtrl   ();\r\n\tvoid updateDisplay  ();\r\n\tvoid recompute      ();\r\n\r\nprivate:\r\n\tCKLBScrollMgr\t*\tm_pScrMgr;\r\n\tint\t\t\t\t\tm_maxPos;\r\n\tint\t\t\t\t\tm_minPos;\r\n\r\n\tint\t\t\t\t\tm_minLoop;\r\n\tint\t\t\t\t\tm_maxLoop;\r\n\r\n\tint\t\t\t\t\tm_lastPos;\r\n\tint\t\t\t\t\tm_barPos;\r\n\tint\t\t\t\t\tm_prePos;\r\n\r\n\tint\t\t\t\t\tm_margin_top;\r\n\tint\t\t\t\t\tm_margin_bottom;\r\n\tu32\t\t\t\t\tm_order;\r\n\r\n\tbool\t\t\t\tm_visible;\r\n\tbool\t\t\t\tm_enable;\r\n\tbool\t\t\t\tm_overScroll;\r\n\tbool\t\t\t\tm_bShortHide;\r\n\r\n\ttypedef enum {\r\n\t\tS_WAIT,\t\t\t\t//!< 待機中\r\n\t\tS_DRAG,\t\t\t\t//!< ドラッグ中\r\n\t\tS_DRAG_IGNORE,\t\t//!< Sliderではないところのドラッグ\r\n\t} STATE;\r\n\r\n\r\n\t// 以下描画情報\r\n\tstruct {\r\n\t\tfloat\tx, y;\r\n\t\tfloat\tu, v;\r\n\t} m_vertices[12];\r\n\r\n\tCKLBLuaTask\t\t*\tm_pOwner;\t\t// オーナーとなるタスクのポインタ\r\n\tCKLBImageAsset\t*\tm_pTex;\r\n\r\n\r\n\tCKLBNode\t\t*\tm_pBaseNode;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tSMatrix2D\t\t\tm_invTransf;\r\n\r\n\tu32\t\t\t\t\tm_texHandle;\r\n\tu8\t\t\t\t\tm_mode;\r\n\tbool\t\t\t\tm_first;\r\n\r\n\ts32\t\t\t\t\tbMiddle;\r\n\ts32\t\t\t\t\tbLeft;\r\n\ts32\t\t\t\t\tbRight;\r\n\ts32\t\t\t\t\tbTotal;\r\n\ts32\t\t\t\t\tm_dragStartPos;\r\n\r\n\tu32\t\t\t\t\tm_state;\r\n\tfloat\t\t\t\tm_ofs_x;\r\n\tfloat\t\t\t\tm_ofs_y;\r\n\tint\t\t\t\t\tm_tid;\r\n\r\n\tbool\t\t\t\tbitmapHasBoth;\r\n\r\n\r\n\tint\t\t\t\t\tm_x, m_y;\r\n\tint\t\t\t\t\tm_width, m_height;\r\n\tbool\t\t\t\tm_vertical;\r\n\r\n\tu32\t\t\t\t\tm_col_normal;\r\n\tu32\t\t\t\t\tm_col_select;\r\n\r\n\ts32\t\t\t\t\tm_slider_min_size;\r\n\ts32\t\t\t\t\tm_slider_size;\r\n\r\n\tbool\t\t\t\tm_active;\r\n\r\n\tbool\t\t\t\tm_bCmdUpdate;\r\n\r\n\tbool\t\t\t\tm_bReady;\r\n\r\n\tbool\t\t\t\tm_hide_mode;\r\n\tbool\t\t\t\tm_hide;\t\t\t// hide処理中ならtrue\r\n\tu32\t\t\t\t\tm_timeHide;\t\t// 表示を隠すまでの時間カウント\r\n\r\n\tconst char *\t\tm_callback;\r\n\tstatic const u16\tms_indices[];\r\n};\r\n\r\n\r\n#endif // CKLBScrollBarIF_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBTextInputNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n#include \"CKLBTextInputNode.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CKLBLanguageDatabase.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\nCKLBUITextBox::CKLBUITextBox(bool isPassword, int maxlen)\r\n: nativeInputItem   (NULL)\r\n, m_pFont           (NULL)\r\n, m_width           (0)\r\n, m_height          (0)\r\n, m_tx              (0)\r\n, m_ty              (0)\r\n, m_textLen         (0)\r\n, m_textBuf         (NULL)\r\n{\r\n\tIPlatformRequest& pForm  = CPFInterface::getInstance().platform();\r\n\tIWidget::CONTROL control = (isPassword) ? IWidget::PASSWDBOX : IWidget::TEXTBOX;\r\n\tCKLBDrawResource& draw   = CKLBDrawResource::getInstance();\r\n\tint px,py;\r\n\tdraw.toPhisicalPosition(m_tx, m_ty, px, py);\r\n\tnativeInputItem = pForm.createControl(control , 0, \"\", px, py, 0, 0, maxlen);\r\n\tif(nativeInputItem) {\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n\tklb_assert(nativeInputItem, \"EditBox allocation failed\");\r\n}\r\n\r\nCKLBUITextBox::~CKLBUITextBox() {\r\n\t// Call Interface to release the input box\r\n\r\n    IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tif(nativeInputItem) {\r\n\t\tpForm.destroyControl(nativeInputItem);\r\n\t\tnativeInputItem = NULL;\r\n\t}\r\n    if(m_pFont) {\r\n        pForm.deleteFontSystem(m_pFont);\r\n    }\r\n\tKLBDELETEA(m_textBuf);\r\n}\r\n\r\n/*virtual*/\t\r\nvoid \r\nCKLBUITextBox::recomputeCustom() \r\n{\r\n\tif(nativeInputItem) {\r\n\t\tconst SMatrix2D* pMat = &m_composedMatrix;\r\n\r\n\t\ts32 x = (s32)pMat->m_matrix[MAT_TX];\r\n\t\ts32 y = (s32)pMat->m_matrix[MAT_TY];\r\n\r\n\t\tint px, py;\r\n\t\tint width, height;\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\r\n\t\tm_tx = x;\r\n\t\tm_ty = y;\r\n\r\n\t\tint transWidth  = m_width  * pMat->m_matrix[MAT_A];\r\n\t\tint transHeight = m_height * pMat->m_matrix[MAT_D];\r\n\r\n\t\tdraw.toPhisicalPosition(x, y, px, py);\t\r\n\t\tdraw.toPhisicalSize(transWidth, transHeight, width, height);\r\n\t\tnativeInputItem->move(px, py);\r\n\t\tnativeInputItem->resize(width, height);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setWidth(u32 width) \r\n{\r\n\tif(nativeInputItem && (width != m_width)) {\r\n\t\tm_width = width;\r\n\t\tthis->markUpMatrix(); // Force recomputeCustom()\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setHeight(u32 height) \r\n{\r\n\tif(nativeInputItem && (height != m_height)) {\r\n\t\tm_height = height;\r\n\t\tthis->markUpMatrix(); // Force recomputeCustom()\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUITextBox::setEnabled(bool isEnabled) \r\n{\r\n\tCKLBUIElement::setEnabled(isEnabled);\r\n\r\n\tif(this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUITextBox::setUpperEnabled(bool isEnabled) \r\n{\r\n\tCKLBUIElement::setUpperEnabled(isEnabled);\r\n\r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n//\r\n// Visible / Invisible related.\r\n//\r\n/*virtual*/\r\nvoid \r\nCKLBUITextBox::addRender() \r\n{\r\n\tCKLBUIElement::addRender();\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(true);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUITextBox::removeRender() \r\n{\r\n\tCKLBUIElement::removeRender();\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUITextBox::setAsset(CKLBAsset* /*pAsset*/, ASSET_TYPE /*mode*/) \r\n{\r\n\t// Do nothing, no asset display.\r\n}\r\n\r\n/*virtual*/\r\nbool \r\nCKLBUITextBox::processAction(CKLBAction* /*pAction*/) \r\n{\r\n\t// Do nothing for now, may implement call back.\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setText(const char* text) \r\n{\r\n\tif (nativeInputItem) {\r\n\t\ttext = CKLBLanguageDatabase::getInstance().getString(text);\r\n\t\tnativeInputItem->setText(text ? text : \"\");\r\n\t}\r\n}\r\n\r\nconst char*\t\r\nCKLBUITextBox::getText() \r\n{\r\n\tif (nativeInputItem) {\r\n\t\tsize_t len = nativeInputItem->getTextLength();\r\n\t\tif(!m_textBuf || len > m_textLen) {\r\n\t\t\tKLBDELETEA(m_textBuf);\r\n\t\t\tm_textLen = len;\r\n\t\t\tm_textBuf = KLBNEWA(char, m_textLen + 1);\r\n\t\t}\r\n\t\tnativeInputItem->getText(m_textBuf, m_textLen + 1);\r\n\r\n\t\treturn m_textBuf;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setFont(const char *fontname, float fontsize) \r\n{\r\n    if(nativeInputItem) {\r\n        IPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n        if(m_pFont) {\r\n            pForm.deleteFontSystem(m_pFont);\r\n            m_pFont = NULL;\r\n        }\r\n        fontsize = CKLBDrawResource::getInstance().toPhisical(fontsize);\r\n        m_pFont = pForm.getFontSystem(fontsize, fontname);\r\n        nativeInputItem->cmd(IWidget::TX_FONT, m_pFont);\r\n    }\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setPlaceHolder(const char *placeholder) \r\n{\r\n    if(nativeInputItem) {\r\n        placeholder = CKLBLanguageDatabase::getInstance().getString(placeholder);\r\n        nativeInputItem->cmd(IWidget::TX_PLACEHOLDER, placeholder);\r\n    }\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setAlign(IWidget::TEXTALIGNMENTTYPE _alignType)\r\n{\r\n    if(nativeInputItem) {\r\n        nativeInputItem->cmd(IWidget::TX_ALIGNMENTTYPE, _alignType);\r\n    }\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setColor(bool bTouch, u32 foreground, u32 background) \r\n{\r\n    if(!nativeInputItem) { return; }\r\n    if(!bTouch) {\r\n        nativeInputItem->cmd(IWidget::TX_BGCOLOR_NORMAL, background);\r\n        nativeInputItem->cmd(IWidget::TX_FGCOLOR_NORMAL, foreground);\r\n    } else {\r\n        nativeInputItem->cmd(IWidget::TX_BGCOLOR_TOUCH, background);\r\n        nativeInputItem->cmd(IWidget::TX_FGCOLOR_TOUCH, foreground);        \r\n    }\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setMaxlen(int maxlen)\r\n{\r\n    if(nativeInputItem) {\r\n        nativeInputItem->cmd(IWidget::TX_MAXLEN, maxlen);\r\n    }\r\n}\r\n\r\nint \r\nCKLBUITextBox::getMaxlen()\r\n{\r\n\tif(nativeInputItem) {\r\n\t\treturn nativeInputItem->getTextMaxLength();\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nvoid \r\nCKLBUITextBox::setCharType(IWidget::TEXTCHARTYPE chartype)\r\n{\r\n    if(nativeInputItem) {\r\n        nativeInputItem->cmd(IWidget::TX_CHARTYPE, (int)chartype);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBTextInputNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_UITEXTBOX__\r\n#define __CKLB_UITEXTBOX__\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBUITextBox\r\n* \\brief Text Box Specialized Node Class\r\n* \r\n* CKLBUITextBox is a UITextBox specialized Node.\r\n* It provides methodss to manage a TextBox.\r\n*/\r\nclass CKLBUITextBox : public CKLBUIElement {\r\npublic:\r\n\tCKLBUITextBox(bool isPassword, int maxlen = 0);\r\n\t~CKLBUITextBox();\r\n\r\n\t// KLBObject::\r\n\tvirtual u32\t getClassID     ()\t\t\t\t\t{ return CLS_KLBTEXTEDIT; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\tvoid recomputeCustom();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   ()  { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n    \r\n    void        setFont         (const char* fontname, float fontsize);\r\n    void        setPlaceHolder  (const char* placeholder);\r\n    void        setAlign        (IWidget::TEXTALIGNMENTTYPE _alignType);\r\n    void        setMaxlen       (int maxlen);\r\n\tint\t\t\tgetMaxlen\t\t();\r\n    void        setCharType     (IWidget::TEXTCHARTYPE chartype);\r\n    void        setColor        (bool bTouch, u32 foreground, u32 background);\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n\r\n    inline IWidget * getWidget  () const { return nativeInputItem; }\r\n    \r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender      ();\r\n\tvirtual void removeRender   ();\r\n\r\n\tIWidget *   nativeInputItem;\r\n    void    *   m_pFont;\r\n\tu32\t\t    m_width;\r\n\tu32\t\t    m_height;\r\n\ts32\t\t    m_tx;\r\n\ts32\t\t    m_ty;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIActivityIndicator.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBUIActivityIndicator.cpp\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#include \"CKLBUIActivityIndicator.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\nenum {\r\n    UI_ACTI_ANIM_START,\r\n    UI_ACTI_ANIM_STOP,\r\n    UI_ACTI_IS_ANIM,\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n    { \"UI_ACTI_ANIM_START\", UI_ACTI_ANIM_START },\r\n    { \"UI_ACTI_ANIM_STOP\",  UI_ACTI_ANIM_STOP },\r\n    { \"UI_ACTI_IS_ANIM\",    UI_ACTI_IS_ANIM },\r\n\r\n    { \"ACTI_TYPE_WHITE\",        IWidget::ACTI_TYPE_WHITE },\r\n    { \"ACTI_TYPE_GRAY\",         IWidget::ACTI_TYPE_GRAY },\r\n    { \"ACTI_TYPE_WHITELARGE\",   IWidget::ACTI_TYPE_WHITELARGE },\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIActivityIndicator> factory(\"UI_ActivityIndicator\", CLS_KLBUIACTIVITYINDICATOR, cmd);\r\n\r\n// Allowed Property Keys\r\nconst char * CKLBUIActivityIndicator::ms_propItems[] = {\r\n\t\"width\",\r\n\t\"height\",\r\n\t0\r\n};\r\n\r\nenum PROP_ID{\r\n\tPR_WIDTH,\r\n\tPR_HEIGHT,\r\n};\r\nenum {\r\n\tARG_PARENT = 1,\r\n    \r\n\tARG_TYPE,\r\n    \r\n\tARG_X,\r\n\tARG_Y,\r\n    \r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n    ARG_ID,\r\n    \r\n\tARG_REQUIRE = ARG_HEIGHT,\r\n\tARG_NUMS    = ARG_ID\r\n};\r\n\r\n\r\nCKLBUIActivityIndicator::CKLBUIActivityIndicator() \r\n: CKLBUITask    ()\r\n, m_pActivityIndicator  (NULL) \r\n{\r\n}\r\n\r\nCKLBUIActivityIndicator::~CKLBUIActivityIndicator() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIActivityIndicator::getClassID()\r\n{\r\n\treturn CLS_KLBUIACTIVITYINDICATOR;\r\n}\r\n\r\nCKLBUIActivityIndicator *\r\nCKLBUIActivityIndicator::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                                int show_type,\r\n                                float x, float y, float width, float height,\r\n                                int widget_id)\r\n{\r\n\tCKLBUIActivityIndicator * pTask = KLBNEW(CKLBUIActivityIndicator);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, show_type, x, y, width, height, widget_id)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIActivityIndicator::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                      int show_type,\r\n                      float x, float y, float width, float height,\r\n                      int widget_id)\r\n{\r\n    if(!setupNode()) { return false; }\r\n    \r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(show_type, x, y, width, height, widget_id);\r\n    \r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n    \r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIActivityIndicator::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n    \r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tint show_type   = lua.getInt(ARG_TYPE);\r\n\tfloat width     = lua.getFloat(ARG_WIDTH);\r\n\tfloat height    = lua.getFloat(ARG_HEIGHT);\r\n\tint widget_id   = (argc >= ARG_ID) ? lua.getInt(ARG_ID) : 0;\r\n    \r\n\treturn initCore(show_type, x, y, width, height, widget_id);\r\n}\r\n\r\nbool\r\nCKLBUIActivityIndicator::initCore(\r\n                          int show_type,\r\n                          float x, float y, float width, float height,\r\n                          int widget_id)\r\n{\r\n\tif(!setupPropertyList(ms_propItems)) {\r\n\t\treturn false;\r\n\t}\r\n\tsetInitPos(x, y);\r\n\tsetNum(PR_WIDTH, width);\r\n\tsetNum(PR_HEIGHT, height);\r\n\r\n\tm_ID = widget_id;\r\n    \r\n\tm_pActivityIndicator = KLBNEWC( CKLBActivityIndicatorNode,(show_type));\r\n    \r\n\tgetNode()->addNode(m_pActivityIndicator);\r\n\tm_pActivityIndicator->setWidth(getInt(PR_WIDTH));\r\n\tm_pActivityIndicator->setHeight(getInt(PR_HEIGHT));\r\n    \r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIActivityIndicator::execute(u32 /* deltaT */)\r\n{\r\n\tupdateUIProperty();\r\n\tif(getUpdateFlag()) {\r\n\t\tm_pActivityIndicator->setWidth(getInt(PR_WIDTH));\r\n\t\tm_pActivityIndicator->setHeight(getInt(PR_HEIGHT));\r\n\t\tclearUpdateFlag();\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIActivityIndicator::dieUI()\r\n{\r\n\tKLBDELETE(m_pActivityIndicator);\r\n}\r\n\r\nint\r\nCKLBUIActivityIndicator::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n        default:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n        case UI_ACTI_ANIM_START:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 2) {\r\n                IWidget * pActI = m_pActivityIndicator->getWidget();\r\n                pActI->cmd(IWidget::ACT_STARTANIM);\r\n                bResult = true;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n            break;\r\n        case UI_ACTI_ANIM_STOP:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 2) {\r\n                IWidget * pActI = m_pActivityIndicator->getWidget();\r\n                pActI->cmd(IWidget::ACT_STOPANIM);\r\n                bResult = true;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n            break;\r\n        case UI_ACTI_IS_ANIM:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 2) {\r\n                IWidget * pActI = m_pActivityIndicator->getWidget();\r\n                bResult = pActI->status() != 0;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n            break;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIActivityIndicator.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBUIActivityIndicator.h\r\n//  GameEngine\r\n//\r\n//\r\n//\r\n\r\n#ifndef CKLBUIActivityIndicator_h\r\n#define CKLBUIActivityIndicator_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"OSWidget.h\"\r\n#include \"CKLBActivityIndicatorNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIActivityIndicator\r\n* \\brief UI Activity Indicator Task Class\r\n* This task display an OS native \"busy\" indicator to show that the device is busy doing some work.\r\n* As an example, when application is connecting or transfering data with the server.\r\n*/\r\nclass CKLBUIActivityIndicator : public CKLBUITask\r\n{\r\n    friend class CKLBTaskFactory<CKLBUIActivityIndicator>;\r\nprivate:\r\n    CKLBUIActivityIndicator();\r\n    virtual ~CKLBUIActivityIndicator();\r\npublic:\r\n    u32 getClassID();\r\n    \r\n\tstatic CKLBUIActivityIndicator * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                                            int show_type,\r\n                                            float x, float y, float width, float height,\r\n                                            int widget_id = 0);\r\n    \r\n\tbool initUI     (CLuaState& lua);\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n    \r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\nprivate:\r\n    \r\n    bool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              int show_type,\r\n              float x, float y, float width, float height,\r\n              int widget_id);\r\n    \r\n\tbool initCore(int show_type,\r\n                  float x, float y, float width, float height,\r\n                  int widget_id);\r\n\r\nprivate:\r\n    CKLBActivityIndicatorNode   *   m_pActivityIndicator;\r\n\tint                             m_ID;\r\n    \r\n\tstatic const char           *   ms_propItems[];\r\n};\r\n\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIButton.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIButton.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBDeviceKeyEvent.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n;\r\nenum {\r\n\tUI_TOUCHPAD_SET_GROUP,\r\n\tUI_TOUCHPAD_LOCK,\r\n\tUI_TOUCHPAD_GET_ALL,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIButton> factory(\"UI_Button\", CLS_KLBUIBUTTON, cmd);\r\n\r\nenum {\r\n\tARG_CALLBACK = 1,\r\n\r\n\tARG_REQUIRE = ARG_CALLBACK,\r\n\tARG_NUMS = ARG_CALLBACK\r\n};\r\n\r\nCKLBUIButton::CKLBUIButton() \r\n: CKLBLuaTask\t()\r\n, m_luaFunc\t\t(NULL)\r\n, m_bAll\t\t(false) \r\n{\r\n\r\n}\r\n\r\nCKLBUIButton::~CKLBUIButton() {}\r\n\r\nu32\r\nCKLBUIButton::getClassID()\r\n{\r\n\treturn CLS_KLBUIBUTTON;\r\n}\r\n\r\nCKLBUIButton* CKLBUIButton::create(CKLBTask* pParentTask, const char * funcName) {\r\n\tCKLBUIButton* pTask = KLBNEW(CKLBUIButton);\r\n\tif(!pTask) return 0;\r\n\r\n\tif(!pTask->init(pParentTask, funcName)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn 0;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool CKLBUIButton::init(CKLBTask* pTask, const char* funcname) {\r\n\tif(funcname) setStrC(m_luaFunc, funcname);\r\n\r\n\tm_ctrlList.pGroup\t\t\t= NULL;\r\n\tm_ctrlList.pGrpPrev\t\t\t= NULL;\r\n\tm_ctrlList.pGrpNext\t\t\t= NULL;\r\n\r\n\tm_ctrlList.pBegin\t\t\t= NULL;\r\n\tm_ctrlList.next\t\t\t\t= NULL;\r\n\tm_ctrlList.bEnable\t\t\t= true;\r\n\tm_ctrlList.bExclusive\t\t= false;\r\n\tm_ctrlList.bWorking\t\t\t= false;\r\n\tm_ctrlList.pCallbackIF\t\t= NULL;\r\n\tm_ctrlList.nativeCallback\t= NULL;\r\n\tm_ctrlList.pID\t\t\t\t= NULL;\r\n\r\n    bool result = regist(pTask, P_AFTER);\r\n    if(!result) {\r\n        KLBDELETEA(m_luaFunc);\r\n    }\r\n\r\n\tm_execount = 0;\r\n    return true;\r\n}\r\n\r\nbool\r\nCKLBUIButton::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tconst char * funcname = lua.getString(ARG_CALLBACK);\r\n\r\n\treturn init(NULL, funcname);\r\n}\r\n\r\nvoid\r\nCKLBUIButton::execute(u32 /*deltaT*/)\r\n{\r\n\tm_execount++;\r\n\r\n\tCKLBDeviceKeyEventQueue& keq = CKLBDeviceKeyEventQueue::getInstance();\r\n\r\n\tkeq.startItem();\r\n\r\n\tconst DEVICE_KEY_ITEM * item = keq.getItem();\r\n\tif(!item) return;\t\t// そのフレームには通知すべきイベントがない\r\n\r\n\t// IPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\r\n\t// platform.logging(\"TP[%d]\", m_execount);\r\n\r\n\t// 通知すべきイベントがあるので、Lua配列を生成する。\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.retGlobal(m_luaFunc);\r\n\tlua.tableNew();\r\n\r\n\tint index = 1;\r\n\tdo {\r\n\t\tlua.retInt(index);\r\n\r\n\t\tlua.tableNew();\r\n\r\n\t\tlua.retString(\"type\");\r\n\t\tlua.retInt(item->type);\r\n\t\tlua.tableSet();\r\n\r\n\t\tlua.retString(\"id\");\r\n\t\tlua.retInt(item->id);\r\n\t\tlua.tableSet();\r\n\r\n\t\tlua.tableSet();\r\n\r\n\t\tindex++;\r\n\t\titem = keq.getItem();\r\n\t} while(item);\r\n\r\n\t// 引数とすべき値は、すでにLuaスタックに積まれている。\r\n\tCKLBScriptEnv::getInstance().call_button(m_luaFunc, this);\r\n}\r\n\r\nvoid\r\nCKLBUIButton::die()\r\n{\r\n\tKLBDELETEA(m_luaFunc);\r\n}\r\n\r\nint\r\nCKLBUIButton::commandScript(CLuaState& lua)\r\n{\r\n\tlua.retBool(true);\r\n\treturn 1;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIButton.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIButton_h\r\n#define CKLBUIButton_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBFormGroup.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\nclass CKLBUIButton : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIButton>;\r\nprotected:\r\n\tCKLBUIButton();\r\n\tvirtual ~CKLBUIButton();\r\n\r\npublic:\r\n\tstatic CKLBUIButton* create(CKLBTask* pParentTask, const char * funcName);\r\n\tbool init(CKLBTask* pTask, const char* funcName);\r\n\r\n\tbool initScript(CLuaState& lua);\r\n\tint commandScript(CLuaState& lua);\r\n\r\n\tinline bool setGroup(const char* group_name) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\treturn fGrp.addForm(&m_ctrlList, group_name);\r\n\t}\r\n\r\n\tinline void lock(bool lock_mode) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\tfGrp.setWorking(&m_ctrlList, lock_mode, this);\t// locker を指定することで、自分がかけたlockは無視できる\r\n\t}\r\n\r\n\tinline void setGetAll(bool b) { m_bAll = b; }\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die();\r\n\r\n    u32 getClassID();\r\n\r\nprivate:\r\n\tconst char * m_luaFunc;\r\n\r\n\t// グループ化用\r\n\tSFormCtrlList\t\tm_ctrlList;\r\n\r\n\tbool\t\t\t\tm_bAll;\r\n\r\n\tint m_execount;\r\n};\r\n\r\n#endif // CKLBUIButton_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUICanvas.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUICanvas.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_CANVAS_ADDRESOURCE       = 0,\r\n\tUI_CANVAS_DRAWIMAGE         = 1,\r\n\tUI_CANVAS_DRAWIMAGESCALE    = 2,\r\n\tUI_CANVAS_FILLRECT          = 3,\r\n\tUI_CANVAS_FREEZE            = 4,\r\n\tUI_CANVAS_STARTSECTION      = 5,\r\n\tUI_CANVAS_ENDSECTION        = 6,\r\n\tUI_CANVAS_SECTIONTRANSLATE  = 7,\r\n\tUI_CANVAS_SECTIONCOLOR      = 8\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_CANVAS_ADDRESOURCE\",\t\tUI_CANVAS_ADDRESOURCE\t\t},\r\n\t{\"UI_CANVAS_DRAWIMAGE\",\t\t\tUI_CANVAS_DRAWIMAGE\t\t\t},\r\n\t{\"UI_CANVAS_DRAWIMAGESCALE\",\tUI_CANVAS_DRAWIMAGESCALE\t},\r\n\t{\"UI_CANVAS_FILLRECT\",\t\t\tUI_CANVAS_FILLRECT\t\t\t},\r\n\t{\"UI_CANVAS_FREEZE\",\t\t\tUI_CANVAS_FREEZE\t\t\t},\r\n\t{\"UI_CANVAS_STARTSECTION\",\t\tUI_CANVAS_STARTSECTION\t\t},\r\n\t{\"UI_CANVAS_ENDSECTION\",\t\tUI_CANVAS_ENDSECTION\t\t},\r\n\t{\"UI_CANVAS_SECTIONTRANSLATE\",\tUI_CANVAS_SECTIONTRANSLATE\t},\r\n\t{\"UI_CANVAS_SECTIONCOLOR\",\t\tUI_CANVAS_SECTIONCOLOR\t\t},\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUICanvas> factory(\"UI_Canvas\", CLS_KLBUICANVAS, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUICanvas::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUICanvas::setOrder,\t\t(getBoolT)&CKLBUICanvas::getOrder,\t\t0\t},\r\n\t{\t\"idxmax\",\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUICanvas::getIdxMax,\t\t0\t},\r\n\t{\t\"callback\",\tSTRING,\t\t(setBoolT)&CKLBUICanvas::setCallBack,\t(getBoolT)&CKLBUICanvas::getCallBack,\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_VERTEX_MAX,\r\n\tARG_INDEX_MAX,\r\n\tARG_CALLBACK,\r\n\r\n\tARG_REQUIRE = ARG_CALLBACK,\r\n\tARG_NUMS = ARG_CALLBACK\r\n};\r\n\r\nCKLBUICanvas::CKLBUICanvas() : CKLBUITask()\r\n, m_handle          (0)\r\n, m_assetCount      (0)\r\n, m_maxAssetCount   (0)\r\n, m_texture         (NULL)\r\n, m_assets          (NULL)\r\n, m_pCanvas         (NULL)\r\n, m_callback        (NULL)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUICanvas::~CKLBUICanvas() \r\n{\r\n\tKLBDELETEA(m_callback);\r\n}\r\n\r\nu32\r\nCKLBUICanvas::getClassID()\r\n{\r\n\treturn CLS_KLBUICANVAS;\r\n}\r\n\r\nbool\r\nCKLBUICanvas::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tu32 order = lua.getInt(ARG_ORDER);\r\n\r\n\tconst char* cb  = lua.getString(ARG_CALLBACK);\r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\r\n\treturn initCore(order, x,y, \r\n\t\tlua.getInt(ARG_VERTEX_MAX),\r\n\t\tlua.getInt(ARG_INDEX_MAX),\r\n\t\tcb);\r\n}\r\n\r\nCKLBUICanvas *\r\nCKLBUICanvas::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                     u32 order, float x, float y, u32 vertexMax, u32 indexMax,\r\n                     const char * callback)\r\n{\r\n\tCKLBUICanvas * pTask = KLBNEW(CKLBUICanvas);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParent, pNode, order, x, y, vertexMax, indexMax, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUICanvas::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                   u32 order, float x, float y, u32 vertexMax, u32 indexMax,\r\n                   const char * callback)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, vertexMax, indexMax, callback);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUICanvas::initCore(u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback)\r\n{\r\n\t// 対応するプロパティリストを規定する。\r\n\tif (!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_pCanvas = CKLBRenderingManager::getInstance().allocateCommandCanvasSprite(vertexMax, indexMax, order);\r\n\r\n\tif (!m_pCanvas) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\tif(callback) {\r\n\t\tsetStrC(m_callback, callback);\r\n\t} else {\r\n\t\tm_callback = NULL;\r\n\t}\r\n\r\n\tgetNode()->setRender(m_pCanvas);\r\n\tsetInitPos(x, y);\r\n\treturn true;\r\n}\r\n\r\nbool \r\nCKLBUICanvas::addAsset(const char* asset) \r\n{\r\n\tu32 handle;\r\n\tCKLBAsset* pAsset = CKLBUtility::loadAssetScript(asset,&handle);\r\n\tif(pAsset && (pAsset->getAssetType() == ASSET_IMAGE)) {\r\n\t\tCKLBImageAsset* pImgAsset   = (CKLBImageAsset*)pAsset;\r\n\t\tCKLBTextureAsset* pTex      = (CKLBTextureAsset*)pImgAsset->getTexture();\r\n\r\n\t\t// We store only ONE handle at a time as we force the texture to be the same anyway.\r\n\t\tif(m_handle) { CKLBDataHandler::releaseHandle(m_handle); }\r\n\t\tm_handle = handle;\r\n\r\n\t\tif(m_assetCount == 0) {\r\n\t\t\tm_texture\t= pTex;\r\n\t\t\tm_pCanvas->setupTexture(pTex);\r\n\t\t\t//\r\n\t\t\t// Patch Texture\r\n\t\t\t//\r\n\t\t\tu32 colArray[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };\r\n\t\t\tpTex->m_pTexture->updateTexture(pTex->m_width - 2, pTex->m_height - 2,2,2,colArray, pTex->m_bytePerPix * 4);\r\n\r\n\t\t\tm_pCanvas->setFillUV(1.0f - (1.0f / (pTex->m_width)) , 1.0f - (1.0f / (pTex->m_height)));\r\n\t\t} else {\r\n\t\t\tif(pTex != m_texture) {\r\n\t\t\t\tklb_assertAlways(\"UI Canvas must have all images in same texture !\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(m_assetCount >= m_maxAssetCount) {\r\n\t\t\tCKLBImageAsset** pArray = KLBNEWA(CKLBImageAsset*, m_maxAssetCount + 16);\r\n\t\t\tif(pArray) {\r\n\t\t\t\tmemcpy(pArray, m_assets, sizeof(CKLBImageAsset*) * m_assetCount);\r\n\t\t\t\tKLBDELETEA(m_assets);\r\n\t\t\t\tm_assets = pArray;\r\n\t\t\t\tm_maxAssetCount += 16;\r\n\t\t\t} else {\r\n\t\t\t\tklb_assertAlways(\"Allocation failure\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tm_assets[m_assetCount++] = pImgAsset;\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBUICanvas::setTiledRect(u32 width, u32 height, const char* asset, u32 alpha) \r\n{\r\n\tif(addAsset(asset)) {\r\n\t\tu32 idx = m_assetCount - 1; // Loaded Asset\r\n\t\tsetTiledRect(width,height,idx,alpha);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUICanvas::freeze(bool freeze) \r\n{\r\n\tm_pCanvas->freeze(freeze);\r\n}\r\n\r\nvoid \r\nCKLBUICanvas::setTiledRect(u32 width, u32 height, u32 idx, u32 alpha) \r\n{\r\n\tm_pCanvas->clear();\r\n\t\r\n\tif((width == 0) || (height == 0)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tSKLBRect* pSize = m_assets[0]->getSize();\r\n\r\n\t// Image Size\r\n\tfloat imgW = pSize->getWidth();\r\n\tfloat imgH = pSize->getHeight();\r\n\r\n\t// Number of tile in the rectangle (non integer !)\r\n\tfloat tilew = ((float)width  / imgW);\r\n\tfloat tileh = ((float)height / imgH);\r\n\tfloat modW  = tilew - floor(tilew);\r\n\tfloat modH  = tileh - floor(tileh);\r\n\r\n\t// Number of tile to be drawn.\r\n\tint tilewI  = (int)(floor(tilew));\r\n\tint tilehI  = (int)(floor(tileh));\r\n\r\n\ts32 cx;\r\n\ts32 cy;\r\n\tm_assets[idx]->getCenter(cx,cy);\r\n\tCKLBImageAsset* pTLAsset = m_assets[idx]->getAsTopLeftImage(cx,cy);\r\n\r\n\tfor(int y = 0; y < tilehI; y++) {\r\n\t\tfor (int x=0; x < tilewI; x++) {\r\n\t\t\tm_pCanvas->drawImage(\r\n\t\t\t\tx * imgW,\r\n\t\t\t\ty * imgH,\r\n\t\t\t\tpTLAsset,\r\n\t\t\t\t0xFFFFFF | (alpha<<24));\t\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\t// int tileIntegerW = width  / pSize->getWidth();\r\n\tif(modW > 0.0000001f) {\t// epsilon\r\n\t\tfloat lx = tilewI * imgW;\r\n\t\t// Get remaining part.\r\n\t\tfor(int y=0; y < tilehI; y++) {\r\n\t\t\tm_pCanvas->drawImageClip(\r\n\t\t\t\tlx,\r\n\t\t\t\ty * imgH,\r\n\t\t\t\tpTLAsset,\r\n\t\t\t\tmodW,\r\n\t\t\t\t1.0f,\r\n\t\t\t\t0xFFFFFF | (alpha<<24));\t\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\t// int tileIntegerH = height / pSize->getHeight();\r\n\tif(modH > 0.0000001f) {\t// epsilon\r\n\t\tfloat ly = tilehI * imgH;\r\n\t\t// Get remaining part.\r\n\t\tfor(int x=0; x < tilewI; x++) {\r\n\t\t\tm_pCanvas->drawImageClip(\r\n\t\t\t\tx * imgW,\r\n\t\t\t\tly,\r\n\t\t\t\tpTLAsset,\r\n\t\t\t\t1.0f,\r\n\t\t\t\tmodH,\r\n\t\t\t\t0xFFFFFF | (alpha<<24));\t\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\tif((modW > 0.0000001f)\r\n\t&& (modH > 0.0000001f)) {\r\n\t\tm_pCanvas->drawImageClip(\r\n\t\t\ttilewI * imgW,\r\n\t\t\ttilehI * imgH,\r\n\t\t\tpTLAsset,\r\n\t\t\tmodW,\r\n\t\t\tmodH,\r\n\t\t\t0xFFFFFF | (alpha<<24));\t\t\t\t\r\n\t}\r\n\r\n\tgetNode()->markUpMatrixAndColor();\r\n}\r\n\r\nint\r\nCKLBUICanvas::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tbool result = false;\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_CANVAS_ADDRESOURCE:\r\n\t\tif (argc == 3 && addAsset(lua.getString(3))) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_DRAWIMAGE:\r\n\t\tif(argc == 7) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\r\n\t\t\tdrawImage(\r\n\t\t\t\tlua.getFloat(3),\t// X \r\n\t\t\t\tlua.getFloat(4),\t// Y\r\n\t\t\t\tlua.getInt(5),\t\t// Asset Index\r\n\t\t\t\tlua.getInt(6) |\t\t// Color + Alpha\r\n\t\t\t\t(lua.getInt(7) << 24)\r\n\t\t\t);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_DRAWIMAGESCALE:\r\n\t\tif(argc == 8) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\r\n\t\t\tdrawImageScale(\r\n\t\t\t\tlua.getFloat(3),\t// X \r\n\t\t\t\tlua.getFloat(4),\t// Y\r\n\t\t\t\tlua.getFloat(5),\t// Scale \r\n\t\t\t\tlua.getInt(6),\t\t// Asset Index\r\n\t\t\t\tlua.getInt(7) |\t\t// Color + Alpha\r\n\t\t\t\t(lua.getInt(8) << 24)\r\n\t\t\t);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_FILLRECT:\r\n\t\tif(argc == 8) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\r\n\t\t\tfillRect(\r\n\t\t\t\tlua.getFloat(3),\t// X \r\n\t\t\t\tlua.getFloat(4),\t// Y\r\n\t\t\t\tlua.getFloat(5),\t// W\r\n\t\t\t\tlua.getFloat(6),\t// H\r\n\t\t\t\tlua.getInt(7) |\t\t// Color + Alpha\r\n\t\t\t\t(lua.getInt(8) << 24)\r\n\t\t\t);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_FREEZE:\r\n\t\tif(argc == 3) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\r\n\t\t\tsetFreeze(lua.getBool(3));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_STARTSECTION:\r\n\t\tif(argc == 3) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\t\t\tstartDynamicSection(lua.getInt(3));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_ENDSECTION:\r\n\t\tif(argc == 3) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\t\t\tendDynamicSection(lua.getInt(3));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_SECTIONTRANSLATE:\r\n\t\tif(argc == 5) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\t\t\tdynamicSectionTranslate(lua.getInt(3),lua.getFloat(4),lua.getFloat(5));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CANVAS_SECTIONCOLOR:\r\n\t\tif(argc == 5) {\r\n\t\t\tret\t\t= 1;\r\n\t\t\tresult\t= true;\r\n\t\t\tdynamicSectionColor(lua.getInt(3), \r\n\t\t\t\tlua.getInt(4) |\t\t// Color + Alpha\r\n\t\t\t\t(lua.getInt(5) << 24)\r\n\t\t\t);\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\tlua.retBoolean(result);\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUICanvas::execute(u32 /* deltaT */)\r\n{\r\n\tif(!m_pCanvas->isFreeze()) {\r\n\t\tm_pCanvas->clear();\r\n\t\tCKLBScriptEnv::getInstance().call_canvasOnDraw(m_callback, this);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUICanvas::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(NULL, m_handle);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUICanvas.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUICanvas_h\r\n#define CKLBUICanvas_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBCanvasSprite.h\"\r\n\r\n/*!\r\n* \\class CKLBUICanvas\r\n* \\brief Canvas Task Class\r\n* \r\n* CKLBUICanvas regroups various images to draw Canvas\r\n* The different assets must be in the same texture.\r\n*/\r\nclass CKLBUICanvas : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUICanvas>;\r\nprivate:\r\n\tCKLBUICanvas();\r\n\tvirtual ~CKLBUICanvas();\r\n\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUICanvas * create(CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback);\r\n\t\r\n\tbool init\t\t    (CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback);\r\n\tbool initCore\t    (u32 order, float x, float y, u32 vertexMax, u32 indexMax, const char * callback);\r\n\r\n\tbool initUI\t\t    (CLuaState& lua);\r\n\tint commandUI\t    (CLuaState& lua, int argc, int cmd);\r\n\r\n\tbool addAsset\t\t(const char* asset);\r\n\tvoid setTiledRect\t(u32 width, u32 height, const char* asset, u32 alpha);\r\n\tvoid freeze\t\t\t(bool freeze);\r\n\tvoid execute\t\t(u32 deltaT);\r\n\tvoid dieUI\t\t\t();\r\n\r\n\t\r\n\tinline virtual void setOrder    (u32 order) {\r\n\t\tif(order != m_order) {\r\n\t\t\tm_pCanvas->changeOrder(CKLBRenderingManager::getInstance(),order);\r\n\t\t\tm_order = order;\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32  getOrder    ()                      { return m_order;                   }\r\n\r\n\tinline u32          getIdxMax   ()\t\t\t\t\t\t{ return m_maxAssetCount;           }\r\n\r\n\tinline void         setCallBack (const char* callback)\t{ setStrC(m_callback, callback);\t}\r\n\tinline const char*  getCallBack ()\t\t\t\t        { return m_callback;\t\t        }\r\n\r\n\tinline void         setFreeze   (bool val) {\r\n\t\tif (!val) {\r\n\t\t\tREFRESH_A;\r\n\t\t} else {\r\n\t\t\tRESET_A;\r\n\t\t}\r\n\t\tm_pCanvas->freeze(val);\r\n\t}\r\n\r\n\tinline void drawImage           (float x, float y, u32 idx, u32 color) {\r\n\t\tCKLBImageAsset* pAsset;\r\n\t\tif (idx >= m_assetCount) {\r\n\t\t\tpAsset = NULL;\r\n\t\t} else {\r\n\t\t\tpAsset = m_assets[idx];\r\n\t\t}\r\n\r\n\t\tm_pCanvas->drawImage(\r\n\t\t\tx,\t\t\t// X \r\n\t\t\ty,\t\t\t// Y\r\n\t\t\tpAsset,\t\t// Asset Index\r\n\t\t\tcolor\r\n\t\t);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\t\r\n\tinline void drawImageScale      (float x, float y, float scale, u32 idx, u32 color) {\r\n\t\tCKLBImageAsset* pAsset;\r\n\t\tif (idx >= m_assetCount) {\r\n\t\t\tpAsset = NULL;\r\n\t\t} else {\r\n\t\t\tpAsset = m_assets[idx];\r\n\t\t}\r\n\r\n\t\tm_pCanvas->drawScale(\r\n\t\t\tx,y,scale,\r\n\t\t\tpAsset,\t\t// Asset Index\r\n\t\t\tcolor\r\n\t\t);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void fillRect            (float x, float y, float w, float h, u32 color) {\r\n\t\tm_pCanvas->fillRect(x,y,w,h,color);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void startDynamicSection (u32 idx)\t{\tm_pCanvas->startDynamicSection(idx);\t}\r\n\tinline void endDynamicSection   (u32 idx)\t{\tm_pCanvas->endDynamicSection(idx);\t\t}\r\n\t\r\n\tinline void dynamicSectionTranslate(u32 idx, float deltaX, float deltaY) {\r\n\t\tm_pCanvas->dynamicSectionTranslate(idx, deltaX, deltaY);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void dynamicSectionColor(u32 idx, u32 color) {\r\n\t\tm_pCanvas->dynamicSectionColor(idx, color);\r\n\t\tgetNode()->markUpColor();\r\n\t}\r\n\r\nprivate:\r\n\tCKLBCanvasSprite*\tm_pCanvas;\r\n\tCKLBTextureAsset*\tm_texture;\r\n\tCKLBImageAsset**\tm_assets;\r\n\tu32\t\t\t\t\tm_handle;\r\n\tu32\t\t\t\t\tm_assetCount;\r\n\tu32\t\t\t\t\tm_maxAssetCount;\r\n\r\n\tu32\t\t\t\t\tm_order;\r\n\tconst char*\t\t\tm_callback;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n\r\n\tvoid setTiledRect\t(u32 width, u32 height, u32 idx, u32 alpha);\r\n};\r\n\r\n#endif // CKLBCanvas_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIClip.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIClip.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBUISystem.h\"\r\n;\r\n\r\n// Command Values\r\nenum {\r\n\tUI_CLIP_SET_POSITION,       // Change the clip position\r\n\tUI_CLIP_SET_SIZE,           // Change the clip size\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t// Operations of the list of items\r\n\t{ \"UI_CLIP_SET_POSITION\",\tUI_CLIP_SET_POSITION },\r\n\t{ \"UI_CLIP_SET_SIZE\",\t\tUI_CLIP_SET_SIZE },\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIClip> factory(\"UI_Clip\", CLS_KLBUICLIP, cmd);\r\n\r\nCKLBLuaPropTask::PROP_V2 CKLBUIClip::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"width\",\tINTEGER,\t(setBoolT)&CKLBUIClip::setWidth,\t(getBoolT)&CKLBUIClip::getWidth,\t0\t},\r\n\t{\t\"height\",\tINTEGER,\t(setBoolT)&CKLBUIClip::setHeight,\t(getBoolT)&CKLBUIClip::getHeight,\t0\t},\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUIClip::setOrder,\t(getBoolT)&CKLBUIClip::getOrder,\t0\t},\r\n\t{\t\"maxodr\",\tUINTEGER,\t(setBoolT)&CKLBUIClip::setMaxOdr,\t(getBoolT)&CKLBUIClip::getMaxOdr,\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_MAXODR,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\r\n\tARG_REQUIRE = ARG_HEIGHT,\r\n\tARG_NUMS    = ARG_HEIGHT\r\n};\r\n\r\nCKLBUIClip::CKLBUIClip()\r\n: CKLBUITask    (CKLBTask::P_UIAFTER)\r\n, m_clipHandle  (NULL)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIClip::~CKLBUIClip() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIClip::getClassID()\r\n{\r\n\treturn CLS_KLBUICLIP;\r\n}\r\n\r\nCKLBUIClip *\r\nCKLBUIClip::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                   u32 base_order, u32 max_order,\r\n                   float x, float y, float clip_width, float clip_height)\r\n{\r\n\tCKLBUIClip * pTask = KLBNEW(CKLBUIClip);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, base_order, max_order, x, y, clip_width, clip_height)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIClip::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\t\tfloat x, float y, float clip_width, float clip_height)\r\n{\r\n\tif(!setupNode()) return false;\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(base_order, max_order,\r\n\t\t\t\t\t\t\tx, y, clip_width, clip_height);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIClip::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tu32 base_order      = lua.getInt(ARG_ORDER);\r\n\tu32 max_order       = lua.getInt(ARG_MAXODR);\r\n\r\n\tfloat x             = lua.getFloat(ARG_X);\r\n\tfloat y             = lua.getFloat(ARG_Y);\r\n\tfloat clip_width    = lua.getFloat(ARG_WIDTH);\r\n\tfloat clip_height   = lua.getFloat(ARG_HEIGHT);\r\n\r\n\treturn initCore(base_order, max_order, x, y, clip_width, clip_height);\r\n}\r\n\r\nbool\r\nCKLBUIClip::initCore(u32 base_order, u32 max_order,\r\n                     float x, float y, float clip_width, float clip_height)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tklb_assert((((s32)base_order) >= 0), \"Order Problem\");\r\n\tklb_assert((((s32)max_order ) >= 0), \"Order Problem\");\r\n\r\n\tm_basePriority  = base_order;\r\n\tm_endPriority   = max_order;\r\n\t\r\n\tm_clipX         = x;\r\n\tm_clipY         = y;\r\n\tm_clipWidth     = (int)clip_width;\r\n\tm_clipHeight    = (int)clip_height;\r\n\r\n\tsetInitPos(m_clipX, m_clipY);\r\n\tsetWidth(m_clipWidth);\r\n\tsetHeight(m_clipHeight);\r\n\r\n\tsetOrder(m_basePriority);\r\n\tsetMaxOdr(m_endPriority);\r\n\r\n\tbool bResult = setClip(m_uiOrder, m_uiMaxOdr, 0, 0, (s16)m_fWidth, (s16)m_fHeight);\r\n\r\n\tif(!bResult) {\r\n\t\tconst char * msg = \"Overlapping clipping range or Reached max UI clipping stack.\";\r\n\t\tCKLBScriptEnv::getInstance().error(msg);\r\n\t\tklb_assertAlways(msg);\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIClip::setClip(u32 orderBegin, u32 orderEnd,\r\n                    s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight)\r\n{\r\n\tCKLBRenderingManager& pMgr  = CKLBRenderingManager::getInstance();\r\n\tCKLBRenderState* pClipStart = pMgr.allocateCommandState();\r\n\tCKLBRenderState* pClipEnd   = pMgr.allocateCommandState();\r\n\r\n\tCKLBNode * pNode = getNode();\r\n\tif(pNode->setRenderSlotCount(2) && pClipStart && pClipEnd) {\r\n\t\tpClipStart->changeOrder(pMgr, orderBegin);\r\n\t\tpClipEnd->changeOrder(pMgr, orderEnd);\r\n\r\n\t\tpClipStart->setUse  (true,false,null);\r\n\t\tpClipEnd->setUse    (true,false,null);\r\n\r\n\t\tpClipStart->setScissor(true, clipX, clipY, clipWidth, clipHeight);\r\n\t\tpClipEnd->setScissor(false);\r\n\t\t\t\t\t\t\t\r\n\t\tpNode->setRender(pClipStart,0);\r\n\t\tpNode->setRender(pClipEnd  ,1);\r\n\r\n\t\tm_clipHandle = CKLBUISystem::registerClip(pClipStart, pClipEnd);\r\n        if(!m_clipHandle) { return false; }\r\n\t} else {\r\n\t\tif(pClipEnd)    { pMgr.releaseCommand(pClipEnd);    }\r\n\t\tif(pClipStart)  { pMgr.releaseCommand(pClipStart);  }\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIClip::execute(u32 /*deltaT*/)\r\n{\r\n\t// 一旦現在のclip領域を破棄する\r\n    if(m_clipHandle) { CKLBUISystem::unregisterClip(m_clipHandle); }\r\n\r\n\t// clip領域を再設定する\r\n\tsetClip(m_basePriority, m_endPriority, 0, 0, (s16)m_clipWidth, (s16)m_clipHeight);\r\n\tRESET_A;\r\n\tRESET_B;\r\n}\r\n\r\nvoid\r\nCKLBUIClip::dieUI()\r\n{\r\n\tif (m_clipHandle) {\r\n\t\tCKLBUISystem::unregisterClip(m_clipHandle);\r\n\t}\r\n}\r\n\r\nint\r\nCKLBUIClip::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBool(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CLIP_SET_POSITION:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\tm_clipX = lua.getFloat(3);\r\n\t\t\t\tm_clipY = lua.getFloat(4);\r\n\t\t\t\tsetPosition(m_clipX, m_clipY);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CLIP_SET_SIZE:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\tm_clipWidth = lua.getInt(3);\r\n\t\t\t\tm_clipHeight = lua.getInt(4);\r\n\t\t\t\tsetSize(m_clipWidth, m_clipHeight);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIClip.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIClip_h\r\n#define CKLBUIClip_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIClip\r\n* \\brief Clip Task Class\r\n* \r\n* CKLBUIClip creates a Task clipping the screen for the required area.\r\n* Sub tasks outside the clipping area will not be drawn.\r\n*/\r\nclass CKLBUIClip : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIClip>;\r\nprivate:\r\n\tCKLBUIClip();\r\n\tvirtual ~CKLBUIClip();\r\n\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tstatic CKLBUIClip * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\t\t\t\t\tfloat x, float y, float clip_width, float clip_height);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getOrder() { return m_uiOrder;\t}\r\n\tinline void\tsetOrder(u32 order) {\r\n\t\tif (order != m_uiOrder) {\r\n\t\t\tm_uiOrder = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getWidth() { return m_fWidth; }\r\n\tinline void\t setWidth(float width) {\r\n\t\tif (width != m_fWidth) {\r\n\t\t\tm_fWidth = width;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getHeight() { return m_fHeight; }\r\n\tinline void\t setHeight(float height) {\r\n\t\tif (height != m_fHeight) {\r\n\t\t\tm_fHeight = height;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getMaxOdr() { return m_uiMaxOdr;\t}\r\n\tinline void\tsetMaxOdr(u32 maxodr) {\r\n\t\tif (maxodr != m_uiMaxOdr) {\r\n\t\t\tm_uiMaxOdr = maxodr;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setPosition(float x, float y) {\r\n\t\tsetX(x);\r\n\t\tsetY(y);\r\n\t\tgetNode()->setTranslate(x, y);\r\n\t\tREFRESH_A;\r\n\t}\r\n\r\n\tinline void setSize(float width, float height) {\r\n\t\tm_fWidth  = width;\r\n\t\tm_fHeight = height;\r\n\t\tREFRESH_A;\r\n\t}\r\n\r\nprivate:\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              u32 base_order, u32 max_order,\r\n              float x, float y, float clip_width, float clip_height);\r\n\r\n\tbool initCore(u32 base_order, u32 max_order,\r\n\t\t\t\t  float x, float y, float clip_width, float clip_height);\r\n\r\n\tbool setClip(u32 orderBegin, u32 orderEnd,\r\n\t\t\t\t s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\r\n\t// clip情報\r\n\tint\t\t\t\t\t\tm_basePriority;\t// クリッピング基点プライオリティ\r\n\tint\t\t\t\t\t\tm_endPriority;\t// クリッピング終了プライオリティ\r\n\r\n\tu32\t\t\t\t\t\tm_uiOrder;\r\n\tfloat\t\t\t\t\tm_fWidth;\r\n\tfloat\t\t\t\t\tm_fHeight;\r\n\tu32\t\t\t\t\t\tm_uiMaxOdr;\r\n\r\n\tfloat\t\t\t\t\tm_clipX;\r\n\tfloat\t\t\t\t\tm_clipY;\r\n\tint\t\t\t\t\t\tm_clipWidth;\r\n\tint\t\t\t\t\t\tm_clipHeight;\r\n\r\n\tvoid\t\t\t\t*\tm_clipHandle;\r\n\tstatic PROP_V2\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIClip_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIControl.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIControl.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBFormGroup.h\"\r\n#define _USE_MATH_DEFINES\r\n#include <math.h>\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_CONTROL_ON_PINCH,\r\n    UI_CONTROL_ON_DBLCLICK,\r\n\tUI_CONTROL_ON_LONGTAP,\r\n\tUI_CONTROL_ON_RAWEVENT,\r\n\r\n\tUI_CONTROL_SET_GROUP,\r\n\tUI_CONTROL_LOCK,\r\n\r\n\tUI_CONTROL_SET_MASK,\r\n\tUI_CONTROL_GET_ALL,\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_CONTROL_ON_PINCH\",    UI_CONTROL_ON_PINCH },\r\n\t{ \"UI_CONTROL_ON_DBLCLICK\", UI_CONTROL_ON_DBLCLICK },\r\n\t{ \"UI_CONTROL_ON_LONGTAP\",  UI_CONTROL_ON_LONGTAP },\r\n\t{ \"UI_CONTROL_ON_RAWEVENT\",\tUI_CONTROL_ON_RAWEVENT },\r\n\r\n\t{ \"UI_CONTROL_SET_GROUP\",\tUI_CONTROL_SET_GROUP },\r\n\t// { \"UI_CONTROL_LOCK\",\t\tUI_CONTROL_LOCK },\r\n\t{ \"UI_CONTROL_SET_MASK\",\tUI_CONTROL_SET_MASK },\r\n\t{ \"UI_CONTROL_GET_ALL\",\t\tUI_CONTROL_GET_ALL },\r\n\r\n\t{ \"CTRLMASK_CLICK\",\t\t\tCKLBUIControl::MASK_CLICK },\r\n\t{ \"CTRLMASK_DRAG\",\t\t\tCKLBUIControl::MASK_DRAG },\r\n\t{ \"CTRLMASK_PINCH\",\t\t\tCKLBUIControl::MASK_PINCH },\r\n\t{ \"CTRLMASK_DBLCLICK\",\t\tCKLBUIControl::MASK_DBLCLICK },\r\n\t{ \"CTRLMASK_LONGTAP\",\t\tCKLBUIControl::MASK_LONGTAP },\r\n\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIControl> factory(\"UI_Control\", CLS_KLBUICONTROL, cmd);\r\n\r\nCKLBUIControl::CKLBUIControl()\r\n: CKLBLuaTask   ()\r\n, m_onClick     (NULL)\r\n, m_onDrag      (NULL)\r\n, m_onDblClick  (NULL)\r\n, m_onPinch     (NULL)\r\n, m_onLongTap   (NULL)\r\n, m_onEventRaw  (NULL)\r\n, m_modalStack  (false)\r\n, m_bModalEnable(true)\r\n, m_callbackMask(0)\r\n, m_lastClick   (0)\r\n, m_bAll        (false) \r\n{\r\n}\r\n\r\nCKLBUIControl::~CKLBUIControl() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIControl::getClassID()\r\n{\r\n\treturn CLS_KLBUICONTROL;\r\n}\r\n\r\nvoid\r\nCKLBUIControl::calc_distance(float * dist, float * angle)\r\n{\r\n\tfloat x = (float)(m_posX[1] - m_posX[0]);\r\n\tfloat y = (float)(m_posY[1] - m_posY[0]);\r\n\t*dist = sqrt(x * x + y * y);\t\t// 2点間の距離\r\n \r\n    // 正規化し、その線分の角度を得る\r\n    x = x / *dist;\r\n    y = y / *dist;\r\n\r\n    *angle = acosf(x);\r\n    if(y < 0.0f) { *angle = 2.0f * M_PI - *angle; }\r\n}\r\n\r\nCKLBUIControl* \r\nCKLBUIControl::create(CKLBTask* pParentTask, const char* onClick, const char* onDrag) {\r\n\tCKLBUIControl* pTask = KLBNEW(CKLBUIControl);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, onClick, onDrag)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool \r\nCKLBUIControl::init(CKLBTask* /*pTask*/, const char* onClick, const char* onDrag) {\r\n\tif(onClick) m_onClick = CKLBUtility::copyString(onClick);\r\n\tif(onDrag)  m_onDrag  = CKLBUtility::copyString(onDrag);\r\n\r\n\tif(!m_onClick || !m_onDrag) {\r\n\t\tKLBDELETEA(m_onClick);\r\n\t\tKLBDELETEA(m_onDrag);\r\n\t\treturn false;\r\n\t}\r\n\r\n    m_bClick    = false;\r\n\tm_bControl  = false;\r\n\tm_usePt     = 0;\r\n\r\n\tm_ctrlList.pGroup   = NULL;\r\n\tm_ctrlList.pGrpPrev = NULL;\r\n\tm_ctrlList.pGrpNext = NULL;\r\n\r\n\tm_ctrlList.pBegin   = NULL;\r\n\tm_ctrlList.next     = NULL;\r\n\tm_ctrlList.bEnable  = true;\r\n\tm_ctrlList.bExclusive       = false;\r\n\tm_ctrlList.bWorking         = false;\r\n\tm_ctrlList.pCallbackIF      = NULL;\r\n\tm_ctrlList.nativeCallback   = NULL;\r\n\tm_ctrlList.pID      = NULL;\r\n\r\n\tif(regist(0, P_AFTER)) {\r\n\t\tm_modalStack.setModal(false);\r\n\t\tm_modalStack.setEnable(true);\r\n\t\tm_modalStack.push();\r\n\t\tm_bModalEnable = true;\r\n\t\treturn true;\r\n\t}\r\n\t// regist に失敗した場合\r\n\treturn false;\r\n}\r\n\r\nbool\r\nCKLBUIControl::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc != 2) return false;\r\n\r\n\tconst char * onClick = lua.getString(1);\r\n\tconst char * onDrag  = lua.getString(2);\r\n\r\n\treturn init(NULL, onClick, onDrag);\r\n}\r\n\r\nint\r\nCKLBUIControl::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint ret = 1;\r\n\tint cmd = lua.getInt(2);\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tret = 1;\r\n\t\t\tlua.retBoolean(false);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CONTROL_ON_PINCH:\r\n\t\t{\r\n\t\t\tret = 1;\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * onPinch = lua.getString(3);\r\n\t\t\tif(!onPinch) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tm_onPinch = CKLBUtility::copyString(onPinch);\r\n\t\t\tif(!onPinch) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(true);\r\n\t\t}\r\n\t\tbreak;\r\n    case UI_CONTROL_ON_DBLCLICK:\r\n\t\t{\r\n\t\t\tret = 1;\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * onDblClick = lua.getString(3);\r\n\t\t\tif(!onDblClick) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tsetOnDblClick(onDblClick);\r\n\t\t\tif(!onDblClick) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(true);\r\n\t\t}\r\n        break;\r\n\tcase UI_CONTROL_ON_LONGTAP:\r\n\t\t{\r\n\t\t\tret = 1;\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * onLongTap = lua.getString(3);\r\n\t\t\tsetOnLongTap(onLongTap);\r\n\t\t\tif(!onLongTap) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(true);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CONTROL_ON_RAWEVENT:\r\n\t\t{\r\n\t\t\tret = 1;\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * onRawEvent = lua.getString(3);\r\n\t\t\tsetOnEventRaw(onRawEvent);\r\n\t\t\tif(!onRawEvent) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(true);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CONTROL_SET_GROUP:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * group_name = lua.getString(3);\r\n\t\t\t\tret = setGroup(group_name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t/*\r\n\tcase UI_CONTROL_LOCK:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tbool lock_mode = lua.getBool(3);\r\n\t\t\t\tlock(lock_mode);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t*/\r\n\tcase UI_CONTROL_SET_MASK:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tu16 mask = lua.getInt(3);\r\n\t\t\t\tm_callbackMask = mask;\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_CONTROL_GET_ALL:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tsetGetAll(lua.getBool(3));\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIControl::execute(u32 deltaT)\r\n{\r\n\tm_bModalEnable = m_modalStack.isEnable();\r\n\r\n\tif(!m_bModalEnable) {\r\n\t\t// 呼び出したcallback中などにmodal form等が表示されると、\r\n\t\t// その後のexecuteが処理されないことにより、あるtapのreleaseが検知できないことがある。\r\n\t\t// このため、modal状態によって操作をブロックされている間は操作状態を完全にリセットする。\r\n\t\tm_bControl  = false;        // 操作終了\r\n\t\tm_usePt     = 0;            // どちらか一方でもreleaseされたら操作を終了する\r\n\t\tm_bClick    = false;\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tint frameID = CKLBTaskMgr::getInstance().getFrameID();\t\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\tconst PAD_ITEM * item;\r\n\r\n\tif(m_onEventRaw) {\r\n\t\ttpq.startItem();\r\n\t\t// 通知すべきイベントがあるので、Lua配列を生成する。\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\t\tlua.retGlobal(m_onEventRaw);\r\n\t\tlua.tableNew();\r\n\t\tint index = 1;\r\n\r\n\t\twhile((item = tpq.getItem(m_bAll))) {\r\n\t\t\tlua.retInt(index);\r\n\r\n\t\t\tlua.tableNew();\r\n\r\n\t\t\tlua.retString(\"type\");\r\n\t\t\tlua.retInt(item->type);\r\n\t\t\tlua.tableSet();\r\n\r\n\t\t\tlua.retString(\"id\");\r\n\t\t\tlua.retInt(item->id);\r\n\t\t\tlua.tableSet();\r\n\r\n\t\t\tlua.retString(\"x\");\r\n\t\t\tlua.retDouble(item->x);\r\n\t\t\tlua.tableSet();\r\n\r\n\t\t\tlua.retString(\"y\");\r\n\t\t\tlua.retDouble(item->y);\r\n\t\t\tlua.tableSet();\r\n\r\n\t\t\tlua.tableSet();\r\n\r\n\t\t\tindex++;\r\n\t\t}\r\n\r\n\t\t// 引数とすべき値は、すでにLuaスタックに積まれている。\r\n\t\tCKLBScriptEnv::getInstance().call_touchPad(m_onEventRaw, this);\r\n\t}\r\n\r\n\ttpq.startItem();\r\n\twhile((item = tpq.getItem(m_bAll))) {\r\n\t\tswitch(item->type)\r\n\t\t{\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\t{\r\n\t\t\t\t// 操作対象点以上は操作に用いない\r\n\t\t\t\tif(m_usePt >= POINT_NUMS) break;\r\n\r\n\t\t\t\t// 最初の一点目の操作であれば、group の working 状態を確認し、\r\n\t\t\t\t// working 状態であれば reject する\r\n                if((m_usePt == 0) && fGrp.isWorking(&m_ctrlList, this)) { break; }\r\n\t\t\t\tfGrp.setWorking(&m_ctrlList, true, this);\t\t// working 状態にする\r\n\r\n\t\t\t\tm_id[m_usePt]       = item->id;\r\n\t\t\t\tm_f_move[m_usePt]   = false;\r\n\t\t\t\tm_tcnt[m_usePt]     = 0;\r\n\t\t\t\tif(m_usePt == 0) {\r\n\t\t\t\t\tm_tapX  = item->x;\r\n\t\t\t\t\tm_tapY  = item->y;\r\n\t\t\t\t\tm_moveX = m_moveY = 0;\r\n                    m_maxX  = m_maxY  = 0;\r\n\t\t\t\t}\r\n\t\t\t\tm_posX[m_usePt] = item->x;\r\n\t\t\t\tm_posY[m_usePt] = item->y;\r\n\r\n\t\t\t\t// 2点目のタップであれば、1点目との距離と角度を求めておく\r\n\t\t\t\tif(m_usePt == 1) {\r\n                    calc_distance(&m_orgLen, &m_orgAngle);\r\n                }\r\n\t\t\t\tm_usePt++;\r\n\t\t\t\tm_bControl = true;\r\n\t\t\t\ttpq.useItem(item, this);\t// アイテムに使用済みマークをつける\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t{\r\n\t\t\t\t// 自身の操作中でなければ、アイテムがあってもそれは自身への操作ではない。\r\n                if(!m_bControl) { break; }\r\n\r\n\t\t\t\tint pos = -1;\r\n\t\t\t\tfor(int i = 0; i < m_usePt; i++) {\r\n\t\t\t\t\tif(m_id[i] == item->id) pos = i;\r\n\t\t\t\t}\r\n                if(pos < 0) { break; }\r\n\r\n\t\t\t\tif(m_usePt == 1) {  // 1点のみの操作中\r\n                    if(m_id[0] != item->id) { break; }  // 違うポイントでの操作なら反応しない\r\n\t\t\t\t\tm_moveX = item->x - m_tapX;\r\n\t\t\t\t\tm_moveY = item->y - m_tapY;\r\n                    \r\n                    // 移動量絶対値\r\n                    s32 mvX = (m_moveX < 0) ? -m_moveX : m_moveX;\r\n                    s32 mvY = (m_moveY < 0) ? -m_moveY : m_moveY;\r\n                    \r\n                    // その操作における最大移動距離を記録する\r\n                    if(mvX > m_maxX) { m_maxX = mvX; } \r\n                    if(mvY > m_maxY) { m_maxY = mvY; }\r\n                    \r\n\t\t\t\t\ttpq.useItem(item, this);\r\n\r\n\t\t\t\t\t// onDrag は、その時点での座標値とドラッグ移動量を返す。\r\n                    // 人間の指には遊びがあるので、最大移動距離がしきい値を超えたらドラッグを通知。\r\n                    if(m_maxX >= CALIB || m_maxY >= CALIB) {\r\n\t\t\t\t\t\tm_f_move[pos] = true;\r\n\t\t\t\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_DRAG)) {\r\n\t\t\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlDrag(m_onDrag, this, item->type, item->x, item->y, m_moveX, m_moveY);\r\n\t\t\t\t\t\t}\r\n                    }\r\n\t\t\t\t} else if(m_usePt == 2) {\r\n\t\t\t\t\t// 操作対象点のどちらかでなければ反応しない\r\n\r\n\t\t\t\t\t// 操作点座標更新\r\n\t\t\t\t\tm_posX[pos] = item->x;\r\n\t\t\t\t\tm_posY[pos] = item->y;\r\n\r\n\t\t\t\t\t// 更新後の座標で、2点間の距離を求める。\r\n\t\t\t\t\tfloat dist, angle;\r\n                    calc_distance(&dist, &angle);\r\n\r\n\t\t\t\t\t// 初期の距離との比率を求める\r\n\t\t\t\t\tfloat pinch = dist / m_orgLen;\r\n                    float rot   = angle - m_orgAngle;\r\n\r\n\t\t\t\t\t// アイテムをマーク済みにする\r\n\t\t\t\t\ttpq.useItem(item, this);\r\n\r\n\t\t\t\t\t// onPinch が指定されていれば呼ぶ\r\n\t\t\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_PINCH)) {\r\n\t\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlPinch(m_onPinch, this, item->type, pinch, rot);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t{\r\n\t\t\t\t// 自身の操作中でなければ、アイテムがあってもそれは自身への操作ではない。\r\n\t\t\t\tif(!m_bControl) break;\r\n\t\t\t\tif(m_usePt == 1) {\t// 1点のみの操作中\r\n\t\t\t\t\tif(m_id[0] != item->id) break;\t// 違うポイントでの操作なら反応しない\r\n\r\n\t\t\t\t\tm_moveX = item->x - m_tapX;\r\n\t\t\t\t\tm_moveY = item->y - m_tapY;\r\n\r\n\t\t\t\t\ttpq.useItem(item, this);\r\n\r\n\t\t\t\t\t// マップ上クリック操作時\r\n\t\t\t\t\t// TAP->RELEASEの間にDRAGが無く、移動量が0の場合は click とみなす。\r\n\t\t\t\t\tif(m_maxX < CALIB && m_maxY < CALIB) {\r\n                        if(!m_bClick) {\r\n                            m_bClick  = true;\r\n                            m_timeCnt = 0;\r\n                            m_clickX  = m_tapX;\r\n                            m_clickY  = m_tapY;\r\n                        } else {\r\n                            if(m_timeCnt < CLICKTIME) {\r\n                                // 時間内にダブルクリックが成立\r\n                                m_bClick  = false;\r\n                                m_timeCnt = 0;\r\n                                if(m_onDblClick) {\r\n\t\t\t\t\t\t\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_DBLCLICK)) {\r\n\t\t\t\t\t\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlDblClick(\r\n\t\t\t\t\t\t\t\t\t\t\tm_onDblClick, this, m_clickX, m_clickY);\r\n\t\t\t\t\t\t\t\t\t}\r\n                                } else {\r\n                                    // ダブルクリックハンドラがない場合はクリックと同じ動作\r\n\t\t\t\t\t\t\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_CLICK)) {\r\n\t\t\t\t\t\t\t\t\t\tif(m_lastClick != frameID) {\r\n\t\t\t\t\t\t\t\t\t\t\tm_lastClick = frameID;\r\n\t\t\t\t\t\t\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlClick(\r\n\t\t\t\t\t\t\t\t\t\t\t\tm_onClick, this, m_clickX, m_clickY);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n                                }\r\n\t\t\t\t\t\t\t\tfGrp.setWorking(&m_ctrlList, false, this);\t// 確定なのでworking解除\r\n\t\t\t\t\t\t\t}\r\n                        }\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// onDrag は、その時点での座標値とドラッグ移動量を返す。\r\n\t\t\t\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_DRAG)) {\r\n\t\t\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlDrag(\r\n\t\t\t\t\t\t\t\tm_onDrag, this, item->type, item->x, item->y, m_moveX, m_moveY);\r\n\t\t\t\t\t\t\tfGrp.setWorking(&m_ctrlList, false, this);\t// 確定なのでworking解除\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if(m_usePt == 2) {\r\n\t\t\t\t\t// 操作対象点のどちらかでなければ反応しない\r\n\t\t\t\t\tint pos = -1;\r\n\t\t\t\t\tfor(int i = 0; i < m_usePt; i++) {\r\n\t\t\t\t\t\tif(m_id[i] == item->id) pos = i;\r\n\t\t\t\t\t}\r\n                    if(pos < 0) { break; }\r\n\r\n\t\t\t\t\t// 操作点座標更新\r\n\t\t\t\t\tm_posX[pos] = item->x;\r\n\t\t\t\t\tm_posY[pos] = item->y;\r\n\r\n\t\t\t\t\t// 更新後の座標で、2点間の距離を求める。\r\n\t\t\t\t\tfloat dist, angle;\r\n                    calc_distance(&dist, &angle);\r\n                    \r\n\t\t\t\t\t// 初期の距離との比率を求める\r\n\t\t\t\t\tfloat pinch = dist / m_orgLen;\r\n                    float rot = angle - m_orgAngle;\r\n\r\n\t\t\t\t\t// アイテムをマーク済みにする\r\n\t\t\t\t\ttpq.useItem(item, this);\r\n\r\n\t\t\t\t\t// onPinch が指定されていれば呼ぶ\r\n\t\t\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_PINCH)) {\r\n\t\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlPinch(m_onPinch, this, item->type, pinch, rot);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfGrp.setWorking(&m_ctrlList, false, this);\t// 確定なのでworking解除\r\n\t\t\t\t}\r\n\t\t\t\tm_bControl = false;\t\t// 操作終了\r\n\t\t\t\tm_usePt    = 0;\t\t\t// どちらか一方でもreleaseされたら操作を終了する\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// 1点のみの操作中で、まだ概念上DRAGが始まっておらず、\r\n\t// TAP操作からの経過時間が0より大きければcallbackを呼ぶ\r\n\tif(m_usePt == 1 && !m_f_move[0]) {\r\n\t\tif(m_tcnt[0] > 0 && m_onLongTap && !fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_LONGTAP)) {\r\n\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlLongTap(m_onLongTap, this, m_tcnt[0], m_tapX, m_tapY);\r\n\t\t\tfGrp.setWorking(&m_ctrlList, false, this); // Need to cancel if UI changes or something.\r\n\t\t}\r\n\t\tm_tcnt[0] += deltaT;\r\n\t}\r\n\r\n\tif(m_bClick) {\r\n        m_timeCnt += deltaT;\r\n        if(m_timeCnt >= CLICKTIME) {\r\n            m_timeCnt = 0;\r\n            m_bClick = false;\r\n\t\t\tif(!fGrp.isWorking(&m_ctrlList, this) && !(m_callbackMask & MASK_CLICK)) {\r\n\t\t\t\tif(m_lastClick != frameID) {\r\n\t\t\t\t\tm_lastClick = frameID;\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIControlClick(m_onClick, this, m_clickX, m_clickY);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfGrp.setWorking(&m_ctrlList, false, this);\t// 確定なのでworking解除\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCKLBUIControl::die()\r\n{\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\tfGrp.delForm(&m_ctrlList);\r\n\r\n\tm_modalStack.remove();\r\n\tKLBDELETEA(m_onPinch);\r\n\tKLBDELETEA(m_onLongTap);\r\n\tKLBDELETEA(m_onDblClick);\r\n\tKLBDELETEA(m_onClick);\r\n\tKLBDELETEA(m_onDrag);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIControl.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIControl_h\r\n#define CKLBUIControl_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\n/*!\r\n* \\class CKLBUIControl\r\n* \\brief UI Control Task class.\r\n* \r\n* CKLBUIControl is a high level Touch Pad Events handler.\r\n* Events (Tap, Drag, Release) are interpreted into higher level events such as \r\n* Click, Double Click, Drag, Long Tap, Pinch).\r\n* It provides a few callbacks that are called when some actions are processed.\r\n* Events can be masked to select only the ones you want.\r\n*/\r\nclass CKLBUIControl : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIControl>;\r\nprivate:\r\n\tCKLBUIControl();\r\n\tvirtual ~CKLBUIControl();\r\n\r\n\tbool init(CKLBTask* pTask, const char* onClick, const char* onDrag);\r\npublic:\r\n\tstatic CKLBUIControl* create(CKLBTask* pParentTask, const char* onClick, const char* onDrag);\r\n\r\n\tu32 getClassID();\r\n\r\n\tbool initScript  (CLuaState& lua);\r\n\tint commandScript(CLuaState& lua);\r\n\r\n\tinline void setMask\t\t\t(u16 mask)\t\t\t\t\t{ m_callbackMask = mask;\t\t\t\t}\r\n\tinline void setOnPinch\t\t(const char* onPinch)\t\t{ setStrC(m_onPinch, onPinch);\t\t\t}\r\n\tinline void setOnDblClick\t(const char* onDblClick)\t{ setStrC(m_onDblClick, onDblClick);\t}\r\n\tinline void setOnLongTap\t(const char* onLongTap)\t\t{ setStrC(m_onLongTap, onLongTap);\t\t}\r\n\tinline void setOnEventRaw\t(const char* onRawEvent)\t{ setStrC(m_onEventRaw, onRawEvent);\t}\r\n\tinline bool setGroup\t\t(const char* group_name)\t{\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\treturn fGrp.addForm(&m_ctrlList, group_name);\r\n\t}\r\n\r\n\tinline void lock            (bool lock_mode)            {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\tfGrp.setWorking(&m_ctrlList, lock_mode, this);\r\n\t}\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n\tenum {\r\n\t\tMASK_CLICK     = 0x0001,\t// クリックcallbackを禁止する\r\n\t\tMASK_DRAG      = 0x0002,\t// ドラッグcallbackを禁止する\r\n\t\tMASK_PINCH     = 0x0004,\t// ピンチイン/アウト/ローテーションcallbackを禁止する\r\n\t\tMASK_DBLCLICK  = 0x0008,\t// ダブルクリックcallbackを禁止する\r\n\t\tMASK_LONGTAP   = 0x0010\t\t// ロングタップcallbackを禁止する\r\n\t};\r\nprivate:\r\n\tinline void setGetAll(bool b) { m_bAll = b; }\r\n\r\n\tvoid calc_distance(float * dist, float * angle);\r\n\r\n\tenum {\r\n\t\tPOINT_NUMS = 2,\r\n        CALIB = 16,\r\n        CLICKTIME = 300\r\n\t};\r\n\r\n\r\n\t// 操作が始まったとき、タップされた位置(第一ポイントのみ)\r\n\ts32\t\t\tm_tapX;\r\n\ts32\t\t\tm_tapY;\r\n\r\n\t// タップ位置からドラッグされた差分位置(ドラッグ操作用)\r\n\ts32\t\t\tm_moveX;\r\n\ts32\t\t\tm_moveY;\r\n\r\n    // タップ時から動いた最大距離の絶対値\r\n    s32         m_maxX;\r\n    s32         m_maxY;\r\n\r\n\t// それぞれの操作点座標\r\n\ts32\t\t\tm_posX[ POINT_NUMS ];\r\n\ts32\t\t\tm_posY[ POINT_NUMS ];\r\n\tfloat\t\tm_orgLen;\t// 最初に2点タップされた時点の、2点間の距離\r\n    float       m_orgAngle; // 最初に2点タップされた時点の、2点間を結ぶ線分の角度\r\n\t// 操作中フラグ\r\n\t// TAPでtrue\r\n\t// DRAG/RELEASEが来てもtrueでなければ自身への操作として受け付けない\r\n\t// RELEASE時にfalseになる。\r\n\tbool\t\tm_bAll;\r\n\tbool\t\tm_bControl;\t// 何らかの操作中にtrueとなる\r\n\tint\t\t\tm_id[ POINT_NUMS ];\t// 操作ID(マルチタッチ用)2点までを認識する\r\n\tbool\t\tm_f_move[ POINT_NUMS ];\t// 閾値以上移動したらtrue\r\n\tint\t\t\tm_tcnt[ POINT_NUMS ];\r\n\tint\t\t\tm_usePt;\t// 操作に使用しているポイントの数(最大2)\r\n    \r\n    bool        m_bClick;   // クリック成立\r\n    s32         m_clickX;   // クリック成立時の座標\r\n    s32         m_clickY;   // クリック成立時の座標\r\n    u32         m_timeCnt;  // クリック成立からの経過時間\r\n    \r\n\tSFormCtrlList\tm_ctrlList;\t\t// UI_Form / UI_List と同様のグループ制御を行うためのメンバ\r\n\tCKLBModalStack\tm_modalStack;\r\n\tbool\t\t\tm_bModalEnable;\r\n\r\n\tint\t\t\t\tm_lastClick;\t// 最後にクリックイベントを発生させたフレーム\r\n\r\n\tu16\t\t\t\tm_callbackMask;\t// コールバックマスク\r\n\r\n\tconst char\t*\tm_onClick;      // クリック時のコールバック\r\n\tconst char\t*\tm_onDrag;       // ドラッグ自のコールバック\r\n\tconst char\t*\tm_onPinch;      // ピンチ操作のコールバック\r\n    const char  *   m_onDblClick;   // ダブルクリック時のコールバック\r\n\tconst char\t*\tm_onLongTap;\t// ロングタップ(長押し)時のコールバック\r\n\tconst char  *   m_onEventRaw;\t// Low Level Raw event.\r\n};\r\n\r\n#endif // CKLBMapControl_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIDebugItem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIDebugItem.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBTexturePacker.h\"\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIDebugItem> factory(\"UI_DbgLabel\", CLS_KLBUIDBGLABEL, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIDebugItem::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUIDebugItem::setOrder,\t\t(getBoolT)&CKLBUIDebugItem::getOrder,\t\t\t0\t},\r\n\t{\t\"font\",\t\tSTRING,\t\t(setBoolT)&CKLBUIDebugItem::setFont,\t\t(getBoolT)&CKLBUIDebugItem::getFont,\t\t\t0\t},\r\n\t{\t\"size\",\t\tUINTEGER,\t(setBoolT)&CKLBUIDebugItem::setSize,\t\t(getBoolT)&CKLBUIDebugItem::getSize,\t\t\t0\t},\r\n\t{\t\"alpha\",\tUINTEGER,\t(setBoolT)&CKLBUIDebugItem::setAlpha,\t\t(getBoolT)&CKLBUIDebugItem::getAlpha,\t\t\t0\t},\r\n\t{\t\"color\",\tUINTEGER,\t(setBoolT)&CKLBUIDebugItem::setU24Color,\t(getBoolT)&CKLBUIDebugItem::getU24Color,\t\t0\t},\r\n\t{\t\"text\",\t\tSTRING,\t\t(setBoolT)&CKLBUIDebugItem::setText,\t\t(getBoolT)&CKLBUIDebugItem::getText,\t\t\t0\t},\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ALPHA,\r\n\tARG_COLOR,\r\n\r\n\tARG_FONT,\r\n\tARG_SIZE,\r\n\r\n\tARG_TEXT,\r\n\r\n\tARG_ID,\r\n\tARG_CALLBACK,\r\n\r\n\tARG_REQUIRE = ARG_CALLBACK,\r\n\tARG_NUMS    = ARG_CALLBACK\r\n};\r\n\r\nCKLBUIDebugItem::CKLBUIDebugItem()\r\n: CKLBUITask\t()\r\n, m_pLabel\t\t(NULL)\r\n, m_font\t\t(NULL)\r\n, m_text\t\t(NULL)\r\n, m_callback\t(NULL)\r\n{\r\n\tm_newScriptModel = true;\r\n\tm_format = TexturePacker::getCurrentModeTexture();\r\n}\r\n\r\nCKLBUIDebugItem::~CKLBUIDebugItem() \r\n{\r\n\tKLBDELETEA(m_font);\r\n\tKLBDELETEA(m_text);\r\n\tKLBDELETEA(m_callback);\r\n}\r\n\r\nu32\r\nCKLBUIDebugItem::getClassID()\r\n{\r\n\treturn CLS_KLBUIDBGLABEL;\r\n}\r\n\r\nCKLBUIDebugItem* \r\nCKLBUIDebugItem::create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, \r\n                        const char* font, u32 size, const char* text, const char* callback,u32 id) \r\n{\r\n\tCKLBUIDebugItem* pTask = KLBNEW(CKLBUIDebugItem);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, order, x,y,alpha,color,font,size,text,callback,id)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool \r\nCKLBUIDebugItem::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, \r\n                      const char* font, u32 size, const char* text, const char* callback,u32 id) \r\n{\r\n    if(!setupNode()) { return false; }\r\n\tbool bResult = initCore(order, x,y,alpha,color,font,size,text,callback,id);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool \r\nCKLBUIDebugItem::initCore(u32 order, float x, float y, u32 alpha, u32 color, \r\n                          const char* font, u32 size, const char* text, const char* callback,u32 id)\r\n{\r\n\t// 保持プロパティを定義\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\tm_alpha = alpha;\r\n\tm_color = color;\r\n\tsetStrC(m_font,  font);\r\n\tm_size  = size;\r\n\tsetStrC(m_text,  text);\r\n\tsetStrC(m_callback, callback);\r\n\tm_ID    = id;\r\n\r\n\tm_padId = -1;\r\n\r\n\tm_update = false;\r\n\treturn setup_node();\r\n}\r\n\r\nbool\r\nCKLBUIDebugItem::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\treturn initCore(lua.getInt(ARG_ORDER),\r\n\t\t\t\t\tlua.getFloat(ARG_X),\r\n\t\t\t\t\tlua.getFloat(ARG_Y),\r\n\t\t\t\t\tlua.getInt(ARG_ALPHA),\r\n\t\t\t\t\tlua.getInt(ARG_COLOR),\r\n\t\t\t\t\tlua.getString(ARG_FONT),\r\n\t\t\t\t\tlua.getInt(ARG_SIZE),\r\n\t\t\t\t\tlua.getString(ARG_TEXT),\r\n\t\t\t\t\tlua.getString(ARG_CALLBACK),\r\n\t\t\t\t\tlua.getInt(ARG_ID));\r\n}\r\n\r\nbool\r\nCKLBUIDebugItem::setup_node()\r\n{\r\n\t// 本来VDocは動作中にプロパティを変更するような作りになっていないため、\r\n\t// プロパティ変更が生じたときは改めて VDOCを作り直す。\r\n\tCKLBNodeVirtualDocument * pNewNode = KLBNEW(CKLBNodeVirtualDocument);\r\n    if(!pNewNode) { return false; }\r\n\r\n    if(m_pLabel) { KLBDELETE(m_pLabel); }\r\n\tm_pLabel = pNewNode;\r\n\r\n\tgetNode()->addNode(m_pLabel);\r\n\r\n\t// 描画コマンド数は固定。文字列一つだけの表示なので。\r\n\tm_pLabel->createDocument(1,m_format);\r\n\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\r\n\t// 指定されている文字列とフォント、フォントサイズでの表示に必要な幅と高さを取得する。\r\n\tvoid * pFont = pfif.platform().getFont(m_size, m_font);\r\n\tpfif.platform().getTextInfo(m_text,pFont, &m_txinfo);\r\n\r\n\t// 必要な幅と高さが取得できたので、そのサイズで VDoc を作る\r\n\tm_pLabel->setDocumentSize(m_txinfo.width, m_txinfo.height);\r\n\tm_pLabel->setViewPortSize(m_txinfo.width, m_txinfo.height, 0.0f, 0.0f, m_order, false);\r\n\r\n\t// 親ノードで表示位置を指定\r\n\t// getNode()->setTranslate(getNum(PR_X), getNum(PR_Y));\t// generic property で対応\r\n\r\n\t// font index = 0 で、指定されている文字列を描画\r\n\tm_pLabel->setFont(0, m_font, m_size);\t// 指定フォントをindex=0に指定\r\n\tm_pLabel->clear(0);\r\n\r\n\tm_pLabel->lockDocument();\r\n\tm_pLabel->drawText(0, m_txinfo.top, m_text, m_color|(m_alpha << 24), 0);\r\n\tm_pLabel->unlockDocument();\r\n\r\n\tm_pLabel->setViewPortPos(0, 0);\t// ViewPort とDocumentのサイズが同じで、かつ表示位置を(0,0)で固定\r\n\r\n\t// Moved to optimize font cache.\r\n\tpfif.platform().deleteFont(pFont);\r\n\r\n\t// 表示位置を指定\r\n\t// getNode()->setTranslate(getNum(PR_X), getNum(PR_Y));\r\n\tm_pLabel->markUpMatrix();\r\n    return true;\r\n}\r\n\r\nvoid\r\nCKLBUIDebugItem::execute(u32 /*deltaT*/)\r\n{\r\n\tif(m_update) {\r\n\t\tsetup_node();\r\n\t\tm_update = false;\r\n\t}\r\n\t//m_pLabel->setViewPortPos(0, 0);\r\n\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\ttpq.startItem();\r\n\tconst PAD_ITEM * item;\r\n\twhile(NULL != (item = tpq.getItem())) {\r\n\t\tswitch(item->type) {\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\t{\r\n                if(m_padId >= 0) { continue; }\r\n\t\t\t\tfloat fx, fy;\r\n\t\t\t\tCKLBUtility::getNodePosition(getNode(), &fx, &fy);\r\n\t\t\t\tif(item->x >= fx && item->y >= fy &&\r\n\t\t\t\t\titem->x - fx < m_txinfo.width && item->y - fy < m_txinfo.height) {\r\n\t\t\t\t\tm_padId = item->id;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t{\r\n                if(item->id != m_padId) { break; }\r\n\t\t\t\tm_padId = -1;\r\n\t\t\t\tCKLBScriptEnv::getInstance().call_eventDebugItem(m_callback, this, m_ID);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIDebugItem::dieUI()\r\n{\r\n\tKLBDELETE(m_pLabel);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIDebugItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIDebugItem_h\r\n#define CKLBUIDebugItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n\r\n/*!\r\n* \\class CKLBUIDebugItem\r\n* \\brief Debug Item Task Class\r\n* \r\n* CKLBUIDebugItem allows to display debug purpose items in the Game.\r\n* A few properties (such as text, color, etc.) can be modified in runtime \r\n* and used for debugging.\r\n*/\r\nclass CKLBUIDebugItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIDebugItem>;\r\nprivate:\r\n\tCKLBUIDebugItem();\r\n\tvirtual ~CKLBUIDebugItem();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, const char* callback,u32 id);\r\n\tbool initCore(u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, const char* callback,u32 id);\r\npublic:\r\n\tstatic CKLBUIDebugItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, const char* callback,u32 id);\r\n\tu32 getClassID  ();\r\n\tbool initUI     (CLuaState& lua);\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tinline virtual void setOrder    (u32 order)\t\t    { m_order = order; m_update = true; }\r\n\tinline virtual u32 getOrder     ()\t\t\t\t    { return m_order;\t}\r\n\r\n\tinline void         setAlpha    (u32 alpha)\t\t    { m_alpha = alpha; m_update = true;\t}\r\n\tinline u32          getAlpha    ()\t\t\t\t    { return m_alpha;\t}\r\n\r\n\tinline void         setU24Color (u32 color)\t        { m_color = color; m_update = true;\t}\r\n\tinline u32          getU24Color ()\t\t\t        { return m_color;\t}\r\n\r\n\tinline void         setColor    (u32 color)\t\t    { m_alpha = color >> 24; m_color = color & 0xFFFFFF; m_update = true; }\r\n\tinline u32          getColor    ()\t\t\t\t    { return (m_alpha << 24) | m_color; }\r\n\r\n\tinline void         setFont     (const char* font)\t{ setStrC(m_font, font); m_update = true;\t}\r\n\tinline const char*  getFont     ()\t\t\t        { return m_font; }\r\n\r\n\tinline void         setSize     (u32 size)\t\t    { m_size = size; m_update = true;\t}\r\n\tinline u32          getSize     ()\t\t\t\t    { return m_size; }\r\n\r\n\tinline void         setText     (const char* text)\t{ setStrC(m_text, text); m_update = true;\t}\r\n\tinline const char*  getText     ()\t\t\t        { return m_text; }\r\n\r\nprivate:\r\n\tu32\t\t\t\t\t\t\tm_order;\r\n\tu8\t\t\t\t\t\t\tm_format;\r\n\tu8\t\t\t\t\t\t\tm_alpha;\r\n\tu32\t\t\t\t\t\t\tm_color;\r\n\tconst char*\t\t\t\t\tm_font;\r\n\tconst char*\t\t\t\t\tm_text;\r\n\tu32\t\t\t\t\t\t\tm_size;\r\n\r\n\tbool setup_node();\r\n\t// 現在は VDocで仮実装しておく。\r\n\tCKLBNodeVirtualDocument\t*\tm_pLabel;\r\n\tbool\t\t\t\t\t\tm_update;\r\n\r\n\tSTextInfo\t\t\t\t\tm_txinfo;\r\n\tconst char\t\t\t\t*\tm_callback;\r\n\tint\t\t\t\t\t\t\tm_ID;\r\n\r\n\tint\t\t\t\t\t\t\tm_padId;\r\n\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIDebugItem_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIDragIcon.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIDragIcon.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBDrawTask.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\n\r\n// Command Values\r\nenum {\r\n\tUI_DRAGICON_ENABLE = 0,\r\n\tUI_DRAGICON_DRAGAREA,\r\n};\r\n// 状態値\r\nenum {\r\n\tDRAGICON_DRAG,\r\n\tDRAGICON_RELEASE,\r\n};\r\n// 動作モード設定フラグ群\r\nenum {\r\n\tF_DICON_BASEINVISIBLE = 0x00000001,\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_DRAGICON_ENABLE\",\t\tUI_DRAGICON_ENABLE},\r\n\t{\"UI_DRAGICON_DRAGAREA\",\tUI_DRAGICON_DRAGAREA},\r\n\r\n\t{\"DRAGICON_DRAG\",\t\t\tDRAGICON_DRAG},\r\n\t{\"DRAGICON_RELEASE\",\t\tDRAGICON_RELEASE},\r\n\r\n\t{\"F_DICON_BASEINVISIBLE\",\tF_DICON_BASEINVISIBLE },\r\n\r\n\t{0, 0}\r\n};\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIDragIcon::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\t\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIDragIcon::getOrder,\t\t0\t\t},\r\n\t{\t\"asset\",\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIDragIcon::getAsset,\t\t0\t\t},\r\n\t{\t\"drag\",\t\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIDragIcon::getDrag,\t\t\t0\t\t},\r\n\t{\t\"flags\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIDragIcon::setFlags,\t\t(getBoolT)&CKLBUIDragIcon::getFlags,\t\t0\t\t},\r\n\t{\t\"callback\",\t\t\tSTRING,\t\t(setBoolT)&CKLBUIDragIcon::setCallBack,\t\t(getBoolT)&CKLBUIDragIcon::getCallBack,\t\t0\t\t},\r\n\t{\t\"drag_scaleX\",\t\tNUMERIC,\t(setBoolT)&CKLBUIDragIcon::setDragScaleX,\t(getBoolT)&CKLBUIDragIcon::getDragScaleX,\t0\t\t},\r\n\t{\t\"drag_scaleY\",\t\tNUMERIC,\t(setBoolT)&CKLBUIDragIcon::setDragScaleY,\t(getBoolT)&CKLBUIDragIcon::getDragScaleY,\t0\t\t}\r\n\t// TODO : setEnable / getEnable exist but no property for LUA\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_AREA,\r\n\r\n\tARG_ASSET,\r\n\tARG_DRAG,\r\n\r\n\tARG_ORDER_STEP,\r\n\tARG_ALPHA,\r\n\r\n\tARG_CENTER_X,\r\n\tARG_CENTER_Y,\r\n\r\n\tARG_CALLBACK,\r\n\r\n\tARG_FLAGS,\r\n\r\n\tARG_REQUIRE = ARG_DRAG,\r\n\tARG_NUMS = ARG_FLAGS\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIDragIcon> factory(\"UI_DragIcon\", CLS_KLBUIDRAGICON, cmd);\r\n\r\n\r\nCKLBUIDragIcon::CKLBUIDragIcon()\r\n: CKLBUITask\t()\r\n, m_modalStack\t(false)\r\n, m_asset\t\t(NULL)\r\n, m_dragAsset\t(NULL)\r\n, m_callBack\t(NULL)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIDragIcon::~CKLBUIDragIcon() \r\n{\r\n\tKLBDELETEA(m_asset);\r\n\tKLBDELETEA(m_dragAsset);\r\n\tKLBDELETEA(m_callBack);\t\r\n}\r\n\r\nu32\r\nCKLBUIDragIcon::getClassID()\r\n{\r\n\treturn CLS_KLBUIDRAGICON;\r\n}\r\n\r\nCKLBUIDragIcon *\r\nCKLBUIDragIcon::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                       u32 order, float x, float y, AREA * tap_area,\r\n                       const char * asset, const char * drag_asset,\r\n                       s32 drag_order_offset, float drag_alpha, \r\n                       float center_x, float center_y, \r\n                       const char * callback, u32 flags)\r\n{\r\n\tCKLBUIDragIcon * pTask = KLBNEW(CKLBUIDragIcon);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, order, x, y,\r\n\t\t\t\t\ttap_area, asset, drag_asset, drag_order_offset,\r\n\t\t\t\t\tdrag_alpha, center_x, center_y, callback, flags)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIDragIcon::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                     u32 order, float x, float y, AREA * tap_area,\r\n                     const char * asset, const char * drag_asset,\r\n                     s32 drag_order_offset, float drag_alpha, \r\n                     float center_x, float center_y, \r\n                     const char * callback, u32 flags)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, tap_area,\r\n\t\t\t\t\t\t\tasset, drag_asset, drag_order_offset,\r\n\t\t\t\t\t\t\tdrag_alpha, center_x, center_y, callback, flags);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIDragIcon::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n\t// 引数の数が合わない\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\t// 引数をプロパティ初期値として登録\r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tu32 order       = lua.getInt(ARG_ORDER);\r\n\tconst char * asset      = lua.getString(ARG_ASSET);\r\n\tconst char * drag_asset = lua.getString(ARG_DRAG);\r\n\tint drag_order_offset   = lua.getInt(ARG_ORDER_STEP);\r\n\tfloat alpha     = lua.getFloat(ARG_ALPHA);\r\n\tfloat center_x  = lua.getFloat(ARG_CENTER_X);\r\n\tfloat center_y  = lua.getFloat(ARG_CENTER_Y);\r\n\r\n\tconst char * callback = (argc >= ARG_CALLBACK) ? lua.getString(ARG_CALLBACK) : NULL;\r\n\tint flags = (argc >= ARG_FLAGS) ? lua.getInt(ARG_FLAGS) : 0;\r\n\r\n\tAREA tap_area;\r\n    if(!get_area(lua, ARG_AREA, tap_area)) { return false; }\r\n\r\n\treturn initCore(order, x, y, &tap_area,\r\n\t\t\t\t\tasset, drag_asset, drag_order_offset,\r\n\t\t\t\t\talpha, center_x, center_y, callback, flags);\r\n}\r\n\r\nbool\r\nCKLBUIDragIcon::initCore(u32 order, float x, float y, AREA * tap_area,\r\n                         const char * asset, const char * drag_asset,\r\n                         s32 drag_order_offset, float drag_alpha, \r\n                         float center_x, float center_y, \r\n                         const char * callback, u32 flags)\r\n{\r\n\t// プロパティの種類を定義\r\n\tif (!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 引数をプロパティ初期値として登録\r\n\tsetInitPos(x, y);\r\n\tm_order = order;\r\n\tsetStrC(m_asset, asset);\r\n\r\n\t// ドラッグアイコン関係\r\n\tsetStrC(m_dragAsset, drag_asset);\r\n\tint order_step  = drag_order_offset;\r\n\tfloat alpha     = drag_alpha;\r\n\tm_center_x  = center_x;\r\n\tm_center_y  = center_y;\r\n\r\n\tif(callback) { setStrC(m_callBack, callback); }\r\n\r\n\tm_flags         = flags;\r\n\tm_dragScaleX    = 1.0f;\r\n\tm_dragScaleY    = 1.0f;\r\n\r\n\t// 操作対象エリアを取得\r\n\tmemcpy(&m_area, tap_area, sizeof(AREA));\r\n\r\n\t// モーダルスタック情報を初期化\r\n\t// UI_DragIcon 自体は決してモーダルにはならない。\r\n\t// ただし、モーダルスタックの影響をうける。\r\n\tm_modalStack.setModal(false);\r\n\tm_modalStack.push();\r\n\r\n\t// assetをロードして、アイコン用、ドラッグ用のNodeを作る\r\n\tm_pIconNode = CKLBUtility::createNodeScript(asset, order, &m_iconHandle);\r\n\tm_pDragNode = CKLBUtility::createNodeScript(drag_asset, order_step + order, &m_dragHandle);\r\n\r\n\t// この段階でUIノードが出来上がっているので、位置とプライオリティを設定\r\n\t// m_pIconNode->setTranslate(getNum(PR_X), getNum(PR_Y));\r\n\tm_pIconNode->setPriority(order);\r\n\r\n\t// 親nodeにつなぐ\r\n\tgetNode()->addNode(m_pIconNode);\r\n\r\n\t// ドラッグアイコンは絶対位置で使用されなければならないため、\r\n\t// root ノードに接続して、必要になるまで invisible にしておく\r\n\tCKLBDrawResource& res = CKLBDrawResource::getInstance();\r\n\tres.getRoot()->addNode(m_pDragNode);\r\n\tSColorVector color;\r\n\tcolor.m_vector[3] = alpha;\r\n\tm_pDragNode->setColorMatrix(color);\r\n\tm_pDragNode->setVisible(false);\r\n\r\n\t// ドラッグ領域制限は初期状態で画面全域\r\n\tm_clip.x        = 0;\r\n\tm_clip.y        = 0;\r\n\tm_clip.width    = res.width();\r\n\tm_clip.height   = res.height();\r\n\r\n\t// 待機中\r\n\tm_state = S_WAIT;\r\n\r\n\t// 操作の許可\r\n\tm_enable=false; setEnable(true);\t// Force flag change.\r\n\r\n\t//m_bModalEnable = true;\r\n\tm_ofs_x = 0;\r\n\tm_ofs_y = 0;\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIDragIcon::execute(u32 /*deltaT*/)\r\n{\r\n\t// 操作が許可されていない場合、TouchPadを確認しない\r\n\t//if(!m_enable) return; // useless thanks to A Flag. (Guillaume).\r\n\r\n\t// モーダルスタックによって操作が禁止されている場合\r\n    if(!m_modalStack.isEnable()) { return; }\r\n\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\tconst PAD_ITEM * item;\r\n\r\n\ttpq.startItem();\r\n\r\n\tbool bFirst = true;\r\n\r\n\twhile((item = tpq.getItem())) {\r\n\t\tswitch(item->type)\r\n\t\t{\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\t{\r\n\t\t\t\t// そのフレームで最初にみつけたTAPならば、\r\n\t\t\t\t// 現在DragIconのある位置から、絶対座標上のヒットボックスを計算する\r\n\t\t\t\tif(bFirst) {\r\n\t\t\t\t\tbFirst = false;\r\n\t\t\t\t\tfloat fx, fy;\r\n\t\t\t\t\tCKLBNode * pNode = getNode();\r\n\t\t\t\t\tCKLBUtility::getNodePosition(pNode, &fx, &fy);\r\n\t\t\t\t\tm_ofs_x = fx;\r\n\t\t\t\t\tm_ofs_y = fy;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// 自身のアイコンに対する操作ならば、状態をドラッグ中に切り替える。\r\n\t\t\t\tif(is_tap(item->x, item->y)) {\r\n\t\t\t\t\tm_state = S_DRAG;\t// 状態をドラッグ中のstateに変更\r\n\t\t\t\t\tm_tid = item->id;\t// 操作に使われたポイントIDを記録する\r\n\t\t\t\t\tm_pDragNode->setVisible(true);\r\n\r\n\t\t\t\t\t// scale が指定された場合、親アイコンは基礎Nodeに繋がっているためscaleが有効になるが、\r\n\t\t\t\t\t// ドラッグ中のアイコンは独立Nodeであるためscaleが有効にならない。\r\n\t\t\t\t\tfloat scaleX = m_dragScaleX;\r\n\t\t\t\t\tfloat scaleY = m_dragScaleY;\r\n\t\t\t\t\tm_pDragNode->setScale(scaleX, scaleY);\r\n\r\n\t\t\t\t\tint flags = m_flags;\r\n\t\t\t\t\tif(flags & F_DICON_BASEINVISIBLE) {\r\n\t\t\t\t\t\tm_pIconNode->setVisible(false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tm_pDragNode->setTranslate(item->x - m_center_x, item->y - m_center_y);\r\n\t\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t{\r\n\t\t\t\t// このタスクのステートがドラッグ中でない限り、\r\n\t\t\t\t// そのドラッグは他の用途のためのドラッグ操作。\r\n\t\t\t\t// また、タップ時に確定した操作ポイントIDが異なる場合も異なる操作。\r\n\t\t\t\tif(m_state != S_DRAG || m_tid != item->id) break;\r\n\r\n\t\t\t\ts32 x, y;\r\n\t\t\t\tdrag_clip(item->x, item->y, &x, &y);\r\n\r\n\t\t\t\tm_pDragNode->setTranslate(x - m_center_x, y - m_center_y);\r\n\r\n\t\t\t\t// ドラッグ座標をコールバックに通知する。\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tCKLBScriptEnv::getInstance().call_eventDragIcon(m_callBack, this, DRAGICON_DRAG, x, y);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t{\r\n\t\t\t\t// このタスクのステートがドラッグ中でない限り\r\n\t\t\t\t// そのドラッグは他の用途のためのドラッグ操作。\r\n\t\t\t\t// また、タップ時に確定した操作ポイントIDが異なる場合も異なる操作。\r\n\t\t\t\tif(m_state != S_DRAG || m_tid != item->id) break;\r\n\r\n\t\t\t\ts32 x, y;\r\n\t\t\t\tdrag_clip(item->x, item->y, &x, &y);\r\n\r\n\t\t\t\tm_pDragNode->setVisible(false);\r\n\t\t\t\tint flags = m_flags;\r\n\t\t\t\tif (flags & F_DICON_BASEINVISIBLE) {\r\n\t\t\t\t\tm_pIconNode->setVisible(true);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// リリースされた座標をコールバックに通知する。\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tm_state = S_WAIT;\r\n\t\t\t\tCKLBScriptEnv::getInstance().call_eventDragIcon(m_callBack, this, DRAGICON_RELEASE, x, y);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIDragIcon::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(m_pIconNode, m_iconHandle);\r\n\tCKLBUtility::deleteNode(m_pDragNode, m_dragHandle);\r\n}\r\n\r\nint\r\nCKLBUIDragIcon::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_DRAGICON_ENABLE:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool enable = lua.getBool(3);\r\n\t\t\tsetEnable(enable);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_DRAGICON_DRAGAREA:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tAREA clip;\r\n\t\t\tif(!get_area(lua, 3, clip)) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tm_clip = clip;\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tlua.retBoolean(false);\r\n\t\tret = 1;\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn ret;\r\n}\r\n\r\n// Luaの配列で渡された操作エリア情報を取得する\r\nbool\r\nCKLBUIDragIcon::get_area(CLuaState& lua, int argp, AREA& area)\r\n{\r\n\tbool bResult = true;\r\n\r\n\tlua.retValue(argp);\r\n\tlua.retNil();\r\n\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\t// index\r\n\r\n\t\tconst char * index = lua.getString(-1);\r\n\t\tint          value = lua.getInt(-2);\r\n\r\n\t\tif(!strcmp(index, \"x\")) {\r\n\t\t\tarea.x = value;\r\n\t\t} else if(!strcmp(index, \"y\")) {\r\n\t\t\tarea.y = value;\r\n\t\t} else if(!strcmp(index, \"width\")) {\r\n\t\t\tarea.width = value;\r\n\t\t} else if(!strcmp(index, \"height\")) {\r\n\t\t\tarea.height = value;\r\n\t\t} else {\r\n\t\t\t// 未知のメンバが存在する\r\n\t\t\tklb_assertAlways(\"unknown member in area structure: [%s]\", index);\r\n\t\t\tbResult = false;\r\n\t\t}\r\n\t\tlua.pop(2);\r\n\t}\r\n\tlua.pop(1);\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIDragIcon::is_tap(int x, int y)\r\n{\r\n\tint sx = m_area.x + m_ofs_x;\r\n\tint sy = m_area.y + m_ofs_y;\r\n\tif(x < sx || y < sy) return false;\r\n\tx -= sx;\r\n\ty -= sy;\r\n\tif(x >= m_area.width || y >= m_area.height) return false;\r\n\treturn true;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIDragIcon::drag_clip(s32 drx, s32 dry, s32 * x, s32 * y)\r\n{\r\n\t// 座標が指定範囲内であればそのまま返す。\r\n\tif(drx >= m_clip.x  && dry >= m_clip.y &&\r\n\t\t(drx - m_clip.x) < m_clip.width && (dry - m_clip.y) < m_clip.height) {\r\n\t\t\t*x = drx;\r\n\t\t\t*y = dry;\r\n\t\t\treturn true;\r\n\t}\r\n\r\n\tif(drx < m_clip.x) { drx = m_clip.x; }\r\n\tif(dry < m_clip.y) { dry = m_clip.y; }\r\n\tif(drx >= m_clip.x + m_clip.width ) { drx = m_clip.x + m_clip.width  - 1; }\r\n\tif(dry >= m_clip.y + m_clip.height) { dry = m_clip.y + m_clip.height - 1; }\r\n\r\n\t*x = drx;\r\n\t*y = dry;\r\n\treturn false;\r\n\r\n\t// 指定座標が範囲制限の外側にある場合、\r\n\t// - 反応エリアの左上から (m_center_x, m_center_y) の位置にある座標と、\r\n\t// - 現在の指定座標を結んだ線分が\r\n\t// - 指定範囲矩形の辺と交差する点\r\n\t// を、クリップ後の座標とする。\r\n\r\n\t// 基点座標:\r\n\t/* Direction calculation of the intersection between clipping border and line from center to drag coordinate\r\n\t   Releaved to be unstable\r\n\t// 傾きを求めるためのx,y各軸の差分\r\n\tfloat bx = m_area.x + m_ofs_x + m_center_x;\r\n\tfloat by = m_area.y + m_ofs_y + m_center_y;\r\n\tfloat fx = (float)drx;\r\n\tfloat fy = (float)dry;\r\n\tfloat dx = (float)(drx - bx);\r\n\tfloat dy = (float)(dry - by);\r\n\tfloat b = fy - (fx * dy / dx);\t// y = ax + b の b\r\n\r\n\t// 上下の辺との交点を求める。\r\n\tfloat ly = (float)(m_clip.y + ((dy > 0) ? m_clip.height - 1 : 0));\r\n\tfloat lx = dx * (ly - b) / dy;\r\n\tif(lx >= (float)m_clip.x && lx < (float)(m_clip.x + m_clip.width)) {\r\n\t\t// クリップ幅以内に収まっていれば、上限辺上の点をクリップ後の座標として返す。\r\n\t\t*x = (s32)lx;\r\n\t\t*y = (s32)ly;\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\t// 交点が左右の枠外であれば、左右の辺との交点を求める。\r\n\tlx = (float)(m_clip.x + ((dx > 0) ? m_clip.width - 1 : 0));\r\n\tly = b + lx * dy / dx;\r\n\t*x = (s32)lx;\r\n\t*y = (s32)ly;\r\n\r\n\treturn false;\r\n\t*/\r\n\r\n\t/*\tVariation using subdivision -> got same bug as the upper routine\r\n\t\t\r\n\tfloat sx = m_area.x + m_ofs_x + m_center_x;\r\n\tfloat sy = m_area.y + m_ofs_y + m_center_y;\r\n\r\n\tfloat dx = drx;\r\n\tfloat dy = dry;\r\n\tfloat prec = fabs(dx) > fabs(dy) ? fabs(dx) : fabs(dy);\r\n\r\n\tfloat mx = sx;\r\n\tfloat my = sy;\r\n\r\n\twhile (prec > 0.25f) {\r\n\t\tfloat deltaX = dx - sx;\r\n\t\tfloat deltaY = dy - sy;\r\n\t\tmx = sx + (deltaX * 0.5f);\r\n\t\tmy = sy + (deltaY * 0.5f);\r\n\r\n\t\tif (mx >= m_clip.x  && mx >= m_clip.y &&\r\n\t\t\t(mx - m_clip.x) < m_clip.width && (my - m_clip.y) < m_clip.height) {\r\n\t\t\tsx = mx;\r\n\t\t\tsy = my;\r\n\t\t} else {\r\n\t\t\tdx = mx;\r\n\t\t\tdy = my;\r\n\t\t}\r\n\t\tprec *= 0.5f;\r\n\t}\r\n\r\n\t*x = mx;\r\n\t*y = my;\r\n\r\n\treturn false;\r\n\t*/\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIDragIcon.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIDragIcon_h\r\n#define CKLBUIDragIcon_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\n/*!\r\n* \\class CKLBUIDragIcon\r\n* \\brief Drag Icon Task Class\r\n* \r\n* CKLBUIDragIcon allows to create a Task owning an image and answering the Drag Events.\r\n* The image can be scalled and/or moved while draging.\r\n* A specific drag area can also be defined to limitate the DragIcon possible received events.\r\n*/\r\nclass CKLBUIDragIcon : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIDragIcon>;\r\nprivate:\r\n\tCKLBUIDragIcon();\r\n\tvirtual ~CKLBUIDragIcon();\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\ttypedef struct {\r\n\t\ts32 x;\r\n\t\ts32 y;\r\n\t\ts32 width;\r\n\t\ts32 height;\r\n\t} AREA;\r\n\r\n\tstatic CKLBUIDragIcon * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\tu32 order, float x, float y, AREA * tap_area,\r\n\t\t\t\t\t\t\t\t\tconst char * asset, const char * drag_asset,\r\n\t\t\t\t\t\t\t\t\ts32 drag_order_offset, float drag_alpha, \r\n\t\t\t\t\t\t\t\t\tfloat center_x, float center_y, \r\n\t\t\t\t\t\t\t\t\tconst char * callback, u32 flags = 0);\r\n\r\n\tbool initUI (CLuaState& lua);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline void setEnable(bool enable) {\r\n\t\tif(m_enable != enable) {\r\n\t\t\t// 現在と異なる状態を設定した場合、\r\n\t\t\t// 許可/不許可にかかわらず一旦操作をリセットする\r\n\t\t\tm_state  = S_WAIT;\r\n\t\t\tm_enable = enable;\r\n\t\t\tif(enable) {\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t} else {\r\n\t\t\t\tRESET_A;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfloat\t\t\tm_dragScaleX;\r\n\tfloat\t\t\tm_dragScaleY;\r\n\tu32\t\t\t\tm_flags;\r\n\tu32\t\t\t\tm_order;\r\n\tconst char *\tm_callBack;\r\n\tconst char *\tm_dragAsset;\r\n\tconst char *\tm_asset;\r\n\r\n\tinline u32\t        getOrder    ()\t\t\t\t\t\t{\treturn m_order;\t\t\t}\r\n\tinline const char*  getAsset    ()\t\t\t\t\t    {\treturn m_asset;\t\t\t}\r\n\tinline const char*  getDrag     ()\t\t\t\t\t    {\treturn m_dragAsset;\t\t}\r\n\tinline u32\t        getFlags    ()\t\t\t\t\t\t{\treturn m_flags;\t\t\t}\r\n\tinline void         setFlags    (u32 flag)\t\t\t\t{\tm_flags = flag;\t\t\t}\r\n\tinline void         setCallBack (const char* callback)\t{\tsetStrC(m_callBack, callback);\t}\r\n\tinline const char*  getCallBack ()\t\t\t\t        {\treturn m_callBack;\t\t}\r\n\tinline bool         getEnable   ()\t\t\t\t\t\t{\treturn m_enable;\t\t}\r\n\r\n\tinline void         setDragScaleX(float scale)\t\t\t{\t\r\n\t\tm_dragScaleX = scale;\r\n\t\tm_pDragNode->setScale(m_dragScaleX, m_dragScaleY);\r\n\t}\r\n\tinline float        getDragScaleX()\t\t\t\t\t    {\treturn m_dragScaleX;\t}\r\n\r\n\tinline void         setDragScaleY(float scale)\t\t\t{\t\r\n\t\tm_dragScaleY = scale;\t\r\n\t\tm_pDragNode->setScale(m_dragScaleX, m_dragScaleY);\r\n\t}\r\n\tinline float        getDragScaleY()\t\t\t\t\t    {\treturn m_dragScaleY;\t}\r\n\r\n\tinline void         setDragArea(AREA area)\t\t\t\t{\tm_clip = area;\t\t\t}\r\n\r\nprivate:\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 order, float x, float y, AREA * tap_area,\r\n\t\t\t\tconst char * asset, const char * drag_asset,\r\n\t\t\t\ts32 drag_order_offset, float drag_alpha, \r\n\t\t\t\tfloat center_x, float center_y, \r\n\t\t\t\tconst char * callback, u32 flags = 0);\r\n\r\n\tbool initCore(\r\n\t\t\t\t\tu32 order, float x, float y, AREA * tap_area,\r\n\t\t\t\t\tconst char * asset, const char * drag_asset,\r\n\t\t\t\t\ts32 drag_order_offset, float drag_alpha, \r\n\t\t\t\t\tfloat center_x, float center_y, \r\n\t\t\t\t\tconst char * callback, u32 flags = 0);\r\n\r\n\ttypedef enum {\r\n\t\tS_WAIT,\t//!< 待機中\r\n\t\tS_DRAG,\t//!< ドラッグ中\r\n\t} STATE;\r\n\r\n\r\n\tbool\t\tis_tap      (int x, int y);\r\n\tbool\t\tget_area    (CLuaState& lua, int argp, AREA& area);\r\n\tbool\t\tdrag_clip   (s32 drx, s32 dry, s32 * x, s32 * y);\r\n\r\n\tAREA\t\t\t\t\tm_clip;\t\t// ドラッグ可能範囲\r\n\tAREA\t\t\t\t\tm_area;\t\t// アイコン操作エリア\r\n\r\n\t// 相対座標から絶対座標を求めるためのオフセット位置\r\n\tint\t\t\t\t\t\tm_ofs_x;\r\n\tint\t\t\t\t\t\tm_ofs_y;\r\n\r\n\t// ドラッグ中表示される半透明アイコンの中心位置(タップ位置に相当する部分)\r\n\tfloat\t\t\t\t\tm_center_x;\r\n\tfloat\t\t\t\t\tm_center_y;\r\n\r\n\tint\t\t\t\t\t\tm_tid;\t\t// 操作に使用されるポイントのID\r\n\tSTATE\t\t\t\t\tm_state;\r\n\r\n\tbool\t\t\t\t\tm_enable;\t\t\t// false の間は操作を許可しない。\r\n\t//bool\t\t\t\t\tm_bModalEnable;\t\t// モーダルスタックによる許可状態\r\n\r\n\tCKLBNode\t\t\t*\tm_pIconNode;\t// アイコンとしての表示\r\n\tCKLBNode\t\t\t*\tm_pDragNode;\t// ドラッグ中指についてくる表示\r\n\r\n\tu32\t\t\t\t\t\tm_iconHandle;\r\n\tu32\t\t\t\t\t\tm_dragHandle;\r\n\r\n\tCKLBModalStack\t\t\tm_modalStack;\t// モーダルスタック\r\n\r\n\tstatic\tPROP_V2\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIDragIcon_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIForm.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIForm.h\"\r\n#include \"CKLBAction.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n#include \"CKLBWebViewNode.h\"\r\n#include \"CKLBFormGroup.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBLuaLibSOUND.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_FORM_SET_ENABLED = 0,\r\n\tUI_FORM_UPDATE_NODE,\r\n\tUI_FORM_EXIST_NODE,\r\n\tUI_FORM_INPUT_ENABLE,       // フォーム単位でのパネル入力許可/禁止\r\n\r\n\tUI_FORM_ANIM_CALLBACK,      // アニメーションコールバックを設定\r\n\tUI_FORM_ANIM_GET_CALLBACK,\t// アニメーションコールバック名を取得\r\n\tUI_FORM_ANIMATION,          // アニメーションを開始\r\n\tUI_FORM_SKIP_ANIM,          // アニメーションを強制的に終了状態に\r\n\r\n\tUI_FORM_IS_ANIM,\r\n\r\n\tUI_FORM_ANIM_ENTER,\r\n\tUI_FORM_ANIM_LEAVE,\r\n\r\n\tUI_FORM_SET_GROUP,          // フォームをグループに所属させる(フォーム間排他)\r\n\tUI_FORM_SET_VOLUME,\r\n};\r\n\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_FORM_SET_ENABLED\",\tUI_FORM_SET_ENABLED             },\r\n\t{ \"UI_FORM_UPDATE_NODE\",\tUI_FORM_UPDATE_NODE             },\r\n\t{ \"UI_FORM_EXIST_NODE\",\t\tUI_FORM_EXIST_NODE              },\r\n\t{ \"UI_FORM_INPUT_ENABLE\",\tUI_FORM_INPUT_ENABLE            },\r\n\t{ \"UI_FORM_ANIM_CALLBACK\",\tUI_FORM_ANIM_CALLBACK           },\r\n\t{ \"UI_FORM_ANIM_GET_CALLBACK\",\tUI_FORM_ANIM_GET_CALLBACK   },\r\n\t{ \"UI_FORM_ANIMATION\",\t\tUI_FORM_ANIMATION               },\r\n\r\n\t{ \"UI_FORM_IS_ANIM\",\t\tUI_FORM_IS_ANIM         },\r\n\t{ \"UI_FORM_SKIP_ANIM\",\t\tUI_FORM_SKIP_ANIM       },\r\n\t\r\n\t{ \"UI_FORM_ANIM_ENTER\",\t\tUI_FORM_ANIM_ENTER      },\r\n\t{ \"UI_FORM_ANIM_LEAVE\",\t\tUI_FORM_ANIM_LEAVE      },\r\n\r\n\t{ \"UI_FORM_SET_GROUP\",\t\tUI_FORM_SET_GROUP       },\r\n//\t{ \"UI_FORM_SET_VOLUME\",\t\tUI_FORM_SET_VOLUME      }, Private for now.\r\n\t{ \"ACTION_UNDEF\",\tACTION_UNDEF    },\r\n\t{ \"ACTION_PUSH\",\tACTION_PUSH     },\r\n\t{ \"ACTION_RELEASE\",\tACTION_RELEASE  },\r\n\t{ \"ACTION_CLOSE\",\tACTION_CLOSE    },\r\n\t{ \"ACTION_ENDANIM\",\tACTION_ENDANIM  },\r\n\t{ \"ACTION_CHANGE\",\tACTION_CHANGE   },\r\n\t{ \"ACTION_FOCUS\",\tACTION_FOCUS    },\r\n\t{ \"ACTION_CUSTOM\",\tACTION_CUSTOM   },\r\n\t{ \"ACTION_CLICK\",   ACTION_CLICK    },\r\n\r\n\r\n\t// サブコマンド定数定義\r\n\t{ \"FORM_NODE_POINTER\",\t\t\tCKLBFormIF::FORM_NODE_POINTER   },\r\n\t{ \"FORM_NODE_RECURSIVE\",\t\tCKLBFormIF::FORM_NODE_RECURSIVE },\r\n\t{ \"FORM_NODE_TRANS\",\t\t\tCKLBFormIF::FORM_NODE_TRANS     },\r\n\t{ \"FORM_NODE_SCALE\",\t\t\tCKLBFormIF::FORM_NODE_SCALE     },\r\n\t{ \"FORM_NODE_ROT\",\t\t\t\tCKLBFormIF::FORM_NODE_ROT       },\r\n\t{ \"FORM_NODE_COLOR\",\t\t\tCKLBFormIF::FORM_NODE_COLOR     },\r\n\t{ \"FORM_NODE_VISIBLE\",\t\t\tCKLBFormIF::FORM_NODE_VISIBLE   },\r\n\t{ \"FORM_NODE_ORDER\",\t\t\tCKLBFormIF::FORM_NODE_ORDER     },\r\n\t{ \"FORM_NODE_GET_ORDER\",\t\tCKLBFormIF::FORM_NODE_GET_ORDER },\r\n\t{ \"FORM_NODE_TASK\",\t\t\t\tCKLBFormIF::FORM_NODE_TASK      },\r\n\r\n\t{ \"FORM_UIE_SET_ENABLED\",\t\tCKLBFormIF::FORM_UIE_SET_ENABLED    },\r\n\t{ \"FORM_UIE_GET_ENABLED\",\t\tCKLBFormIF::FORM_UIE_GET_ENABLED    },\r\n\t{ \"FORM_UIE_SET_ASSET\",\t\t\tCKLBFormIF::FORM_UIE_SET_ASSET      },\r\n\r\n\t{ \"FORM_UIS_SET_CLICK\",\t\t\tCKLBFormIF::FORM_UIS_SET_CLICK  },\r\n\t{ \"FORM_UIS_SET_STICK\",\t\t\tCKLBFormIF::FORM_UIS_SET_STICK  },\r\n\t{ \"FORM_UIS_SET_RADIO\",\t\t\tCKLBFormIF::FORM_UIS_SET_RADIO  },\r\n\t{ \"FORM_UIS_GET_STICK\",\t\t\tCKLBFormIF::FORM_UIS_GET_STICK  },\r\n\t{ \"FORM_UIS_SET_CALLBACK\",\t\tCKLBFormIF::FORM_UIS_SET_CALLBACK   },\r\n\r\n\t{ \"FORM_CONT_VIEWOFFSET\",\t\tCKLBFormIF::FORM_CONT_VIEWOFFSET        },\r\n\t{ \"FORM_CONT_GET_RADIO_VALUE\",\tCKLBFormIF::FORM_CONT_GET_RADIO_VALUE   },\r\n\r\n\t{ \"FORM_TEXT_SET\",\t\t\t\tCKLBFormIF::FORM_TEXT_SET       },\r\n\t{ \"FORM_TEXT_GET\",\t\t\t\tCKLBFormIF::FORM_TEXT_GET       },\r\n\r\n\t{ \"FORM_WEB_SET_URI\",\t\t\tCKLBFormIF::FORM_WEB_SET_URI    },\r\n\t{ \"FORM_WEB_GET_URI\",\t\t\tCKLBFormIF::FORM_WEB_GET_URI    },\r\n\r\n\t{ \"FORM_LBL_SET_TEXT\",\t\t\tCKLBFormIF::FORM_LBL_SET_TEXT   },\r\n\t{ \"FORM_LBL_GET_TEXT\",\t\t\tCKLBFormIF::FORM_LBL_GET_TEXT   },\r\n\r\n\t{ \"FORM_ASSET_NORMAL\",\t\t\tCKLBUIElement::NORMAL_ASSET     },\r\n\t{ \"FORM_ASSET_DISABLED\",\t\tCKLBUIElement::DISABLED_ASSET   },\r\n\t{ \"FORM_ASSET_FOCUSED\",\t\t\tCKLBUIElement::FOCUSED_ASSET    },\r\n\t{ \"FORM_ASSET_PUSHED\",\t\t\tCKLBUIElement::PUSHED_ASSET     },\r\n\r\n\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIForm> factory(\"UI_Form\", CLS_KLBUIFORM, cmd);\r\n\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIForm::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\t\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIForm::getOrder,\t\t0\t},\r\n\t{\t\"asset\",\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIForm::getAsset,\t\t0\t},\r\n\t{\t\"isfile\",\t\t\tR_BOOLEANT,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIForm::getAssetFile,\t0\t},\r\n\t{\t\"exclusive\",\t\tBOOLEANT,\t(setBoolT)&CKLBUIForm::setExclusive,\t(getBoolT)&CKLBUIForm::getExclusive,\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ASSET,\r\n\r\n\tARG_EXCLUSIVE,\r\n\r\n\tARG_MODAL,\r\n\r\n\tARG_URGENT,\r\n\r\n\tARG_REQUIRE = ARG_ASSET,\r\n\tARG_NUMS    = ARG_URGENT\r\n};\r\n\r\nCKLBUIForm::CKLBUIForm()\r\n: CKLBUITask    ()\r\n, m_modalStack  (false)\r\n, m_asset       (NULL)\r\n, m_bInputEnable(true) \r\n{\r\n\tm_formIF = this;\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIForm::~CKLBUIForm() \r\n{\r\n\tKLBDELETEA(m_asset);\r\n}\r\n\r\nu32\r\nCKLBUIForm::getClassID()\r\n{\r\n\treturn CLS_KLBUIFORM;\r\n}\r\n\r\nCKLBUIForm* \r\nCKLBUIForm::create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, bool bAssetFile, const char* asset, bool bExclusive, bool modal, bool urgent) {\r\n\tCKLBUIForm* pTask = KLBNEW(CKLBUIForm);\r\n    if (!pTask) { return NULL; }\r\n\tif (!pTask->init(pParent, pNode, order, x,y,bAssetFile,asset,bExclusive,modal, urgent)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nvoid \r\nCKLBUIForm::setGlobalVolume(float volume) \r\n{\r\n\tsetGlobalVolume_r(getNode(), volume);\r\n}\r\n\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\nvoid \r\nCKLBUIForm::setGlobalVolume_r(CKLBNode* pNode, float volume) \r\n{\r\n\tif (pNode->getClassID() == CLS_KLBUISELECTABLE) {\r\n\t\tCKLBUISelectable* pSelect = (CKLBUISelectable*)pNode;\r\n\t\tpSelect->setMultiplyVolume(0, volume);\r\n\t\tpSelect->setMultiplyVolume(1, volume);\r\n\t}\r\n\tCKLBNode* pList = pNode->getChild();\r\n\twhile (pList) {\r\n\t\tsetGlobalVolume_r(pList, volume);\r\n\t\tpList = pList->getBrother();\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBUIForm::init(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, bool bAssetFile, const char* asset, bool bExclusive, bool modal, bool urgent) \r\n{\r\n\tif (!setupNode()) return false;\r\n\tbool bResult = initCore(order, x, y, bAssetFile, asset, 0, bExclusive, modal, urgent);\r\n\tbResult = registUI(parent, bResult);\r\n\tif (pNode) {\r\n\t\tparent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIForm::initCore(u32 order, float x, float y, bool bAssetFile, const char* asset, u32 size, bool bExclusive, bool modal, bool urgent)\r\n{\r\n\tif (!setupPropertyList((const char**)ms_propItems, SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\r\n\t// assetがファイルで与えられた場合true, luaテーブルで与えられた場合false\r\n\tm_bAssetFile = bAssetFile;\r\n\tif(size == 0) { \r\n\t\tsetStrC(m_asset, asset); \r\n\t} else {\r\n\t\tm_asset = CKLBUtility::copyMem(asset, size);\r\n\t}\r\n\tm_modalStack.setModal(modal, urgent);\r\n\r\n\tm_bExclusive = bExclusive;\r\n\r\n\t// form によって起動されたタスクの中に、UI_DragIconのようなモーダルスタック対応タスクがある場合があるので、\r\n\t// form を作る前に自身をモーダルスタックに積む。\r\n\tm_modalStack.push();\r\n\r\n\tm_ctrlList.pGroup           = NULL;\r\n\tm_ctrlList.pGrpPrev         = NULL;\r\n\tm_ctrlList.pGrpNext         = NULL;\r\n\r\n\tm_ctrlList.pBegin           = NULL;\r\n\tm_ctrlList.next             = NULL;\r\n\tm_ctrlList.bEnable          = true;\r\n\tm_ctrlList.bExclusive       = bExclusive;\r\n\tm_ctrlList.bWorking         = false;\r\n\tm_ctrlList.pCallbackIF      = NULL;\r\n\tm_ctrlList.nativeCallback   = NULL;\r\n\tm_ctrlList.pID              = NULL;\r\n\r\n\tCKLBUISystem::setFormList(&m_ctrlList);\r\n\t// DEBUG_PRINT(\" FORM:ctrl: %p\", &m_ctrlList);\r\n\r\n\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\tif(bAssetFile) {\r\n\t\tm_pFormNode = CKLBUtility::createCompositeNodeScript(this, m_asset, m_order, &m_handle, pAssetManager.getPlugin('P'));\r\n\t} else {\r\n\t\tm_pFormNode = NULL;\r\n\t\tCKLBAsset * pAsset = CKLBUtility::readAsset((u8 *)m_asset, size, &m_handle, pAssetManager.getPlugin('P'));\r\n\t\tif(!pAsset) {\r\n\t\t\tCKLBScriptEnv::getInstance().error(\"could not load asset: %s\", m_asset);\r\n\t\t} else {\r\n\t\t\tm_pFormNode = ((CKLBCompositeAsset*)pAsset)->createSubTree(this, m_order);\r\n\t\t\tif(!m_pFormNode) {\r\n\t\t\t\tCKLBScriptEnv::getInstance().error(\"Node create failed. Json arg.\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tCKLBUISystem::setFormList(NULL);\r\n\tif(!m_pFormNode) {\r\n\t\t// フォームのツリー生成に失敗した場合、すべてをご破算にしてタスク生成を失敗させる\r\n\t\treturn false;\r\n\t}\r\n\t// フォーム単位として登録する\r\n\tCKLBTouchEventUIMgr::getInstance().registForm(&m_ctrlList);\r\n\r\n\t// CKLBUISystem::setFormList(&m_ctrlList) ～ CKLBUISystem::setFormList(0) までの処理で、\r\n\t// m_ctrlList 内に、このフォームで作られたものに限定された CKLBUISelectable のリストが得られる。\r\n\r\n\tgetNode()->addNode(m_pFormNode);\r\n\t// getNode()->setTranslate(getNum(PR_X), getNum(PR_Y));\t// generic property として設定される\r\n\r\n\tsetGlobalVolume(CKLBLuaLibSOUND::getFormGlobalVolume());\r\n\r\n\tm_bEnable = false;\r\n\tsetFormEnable(true);\r\n\r\n//\tsetVisible(true);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIForm::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tconst char* asset;\r\n\tbool bAssetFile = true;\r\n\tu32 size = 0;\r\n\tif(lua.isString(ARG_ASSET)) {\r\n\t\t// 指定されたassetが文字列であれば、パス名として使用\r\n\t\tasset = lua.getString(ARG_ASSET);\r\n\t} else {\r\n\t\t// 指定されたassetが文字列でなければ、おそらくLuaテーブル。\r\n\t\t// Luaテーブルを元にJSONを生成し、それをassetとして使用する。\r\n\t\tbAssetFile = false;\r\n\t\tlua.retValue(ARG_ASSET);\r\n\t\tasset = CKLBUtility::lua2BJson(lua,size);\r\n\t\tlua.pop(1);\r\n\t}\r\n\r\n\tbool bExclusive = (argc >= ARG_EXCLUSIVE)\t? lua.getBool(ARG_EXCLUSIVE)\t: false;\r\n\tbool modal\t\t= (argc >= ARG_MODAL)\t\t? lua.getBool(ARG_MODAL)\t\t: false;\r\n\tbool urgent\t\t= (argc >= ARG_URGENT)\t\t? lua.getBool(ARG_URGENT)\t\t: false;\r\n\t\r\n\tbool res = initCore(lua.getInt(ARG_ORDER),\r\n\t\t\t\t\t\tlua.getFloat(ARG_X), \r\n\t\t\t\t\t\tlua.getFloat(ARG_Y),\r\n\t\t\t\t\t\tbAssetFile,\r\n\t\t\t\t\t\tasset, size,\r\n\t\t\t\t\t\tbExclusive,\r\n\t\t\t\t\t\tmodal,\r\n\t\t\t\t\t\turgent);\r\n\r\n\tif(!bAssetFile) {\r\n\t\tKLBDELETEA(asset);\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\nvoid\r\nCKLBUIForm::dieUI()\r\n{\r\n\t// モーダル制御\r\n\tsetVisible(false);\t// フォームが無効になるので、スタックから取り除く処理。\r\n\r\n\tCKLBTouchEventUIMgr& mgr = CKLBTouchEventUIMgr::getInstance();\r\n\r\n\r\n\tCKLBUISelectable * pItem = m_ctrlList.pBegin;\r\n\tCKLBUISelectable * pNext;\r\n\twhile(pItem) {\r\n\t\tpNext = pItem->getNextSelectable();\r\n\t\t// フォームのコントロールが操作中であれば、操作中ステータスをリセットする\r\n\t\tmgr.resetSelectable(pItem);\r\n\t\tpItem = pNext;\r\n\t}\r\n\r\n\t// フォームグループから削除する\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\tfGrp.delForm(&m_ctrlList);\r\n\r\n\tCKLBUtility::deleteNode(m_pFormNode, m_handle);\r\n\r\n\t// フォームを破棄\r\n\t// Remove last.\r\n\tmgr.removeForm(&m_ctrlList);\r\n}\r\n\r\nvoid\r\nCKLBUIForm::execute(u32 /*deltaT*/)\r\n{\r\n\tsetFormEnable(m_modalStack.isEnable());\t// modal 状態反映\r\n\tm_animpack.watchFinishedAnim(this);\r\n}\r\n\r\n\r\nint\r\nCKLBUIForm::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\t// 知らないコマンドの場合\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_SET_ENABLED:\r\n\t\t{\r\n\t\t\t// フォーム操作の許可/禁止(全体)\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool isEnable = lua.getBool(3);\r\n\r\n\t\t\tsetEnable(isEnable);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_UPDATE_NODE:\r\n\t\t{\r\n\t\t\tif(argc < 4) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t// const char * name = lua.getString(3);\r\n\t\t\tint subcmd = lua.getInt(4);\r\n\t\t\tCKLBNode * pParent = getNode();\r\n\t\t\tret = m_formIF.updateNode(lua, argc, 4, pParent, 3, subcmd);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_EXIST_NODE:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * name =  lua.getString(3);\r\n\r\n\t\t\tbool bResult = existNode(name);\r\n\t\t\t\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_INPUT_ENABLE:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbool bEnable = lua.getBool(3);\r\n\r\n\t\t\tinputEnable(bEnable);\r\n\t\t\t\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase UI_FORM_ANIM_CALLBACK:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * callback = (lua.isNil(3)) ? NULL : lua.getString(3);\r\n\t\t\t\tresult = setAnimCallback(callback);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase UI_FORM_ANIM_GET_CALLBACK:\r\n\t\t{\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tconst char * callback = m_animpack.getCallback();\r\n\t\t\t\tlua.retString(callback);\r\n\t\t\t} else {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t}\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase UI_FORM_ANIMATION:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\t\tconst char * animname = lua.getString(3);\r\n\t\t\t\tbool blend = (argc >= 4) ? lua.getBool(4) : false;\r\n\r\n\t\t\t\tresult = animation(animname, blend);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_IS_ANIM:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc >= 2 && argc <= 3) {\r\n\t\t\t\tconst char * name = 0;\r\n\t\t\t\tif(argc >= 3 && !lua.isNil(3)) name = lua.getString(3);\r\n\t\t\t\t\r\n\t\t\t\tresult = isAnim(name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_SKIP_ANIM:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc >= 2 && argc <= 3) {\r\n\t\t\t\tconst char * name = 0;\r\n\t\t\t\tif(argc >= 3 && !lua.isNil(3)) name = lua.getString(3);\r\n\t\t\t\t\r\n\t\t\t\tresult = skipAnim(name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_ANIM_ENTER:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tresult = animEnter();\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_ANIM_LEAVE:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tresult = animLeave();\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase UI_FORM_SET_GROUP:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * group_name = lua.getString(3);\r\n\t\t\t\t\r\n\t\t\t\tresult = setGroup(group_name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FORM_SET_VOLUME:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tfloat volume = lua.getFloat(3);\r\n\t\t\t\tsetGlobalVolume(volume);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nbool\r\nCKLBUIForm::setFormEnable(bool bEnable)\r\n{\r\n//\tif(m_bEnable == bEnable) return bEnable;\r\n\r\n\tm_bEnable = bEnable;\r\n\tm_ctrlList.bEnable = m_bEnable && m_bInputEnable;\r\n\r\n\t/*\r\n\tSFormCtrl * pItem;\r\n\tfor(pItem = m_ctrlList.pBegin; pItem; pItem = pItem->pNext) {\r\n\t\tpItem->pCtrl->setEnabled(bEnable);\r\n\t}\r\n\t*/\r\n\treturn bEnable;\r\n}\r\n\r\nvoid\r\nCKLBUIForm::setVisible(bool visible)\r\n{\r\n\tif(visible != getVisible()) {\r\n\t\tCKLBUITask::setVisible(visible);\r\n\t\tif(visible) {\r\n\t\t\t// 有効にされた場合\r\n\t\t\tm_modalStack.push();\r\n\t\t} else {\r\n\t\t\t// 無効にされた場合\r\n\t\t\tm_modalStack.remove();\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIForm.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIForm_h\r\n#define CKLBUIForm_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeAnimPack.h\"\r\n#include \"CKLBFormIF.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\n/*!\r\n* \\class CKLBUIForm\r\n* \\brief Form Task Class\r\n* \r\n* CKLBUIForm is designed to manage forms in the Game.\r\n* It allows to manage a whole form (composed of several sub elements) very easily.\r\n*/\r\nclass CKLBUIForm : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIForm>;\r\nprivate:\r\n\tCKLBUIForm();\r\n\tvirtual ~CKLBUIForm();\r\n\r\n\tbool init(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, bool bAssetFile, const char* asset, bool bExclusive, bool modal, bool urgent);\r\n\tbool initCore(u32 order, float x, float y, bool bAssetFile, const char* asset, u32 size, bool bExclusive, bool modal, bool urgent);\r\n\r\npublic:\r\n\tstatic CKLBUIForm* create(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, bool bAssetFile, const char* asset, bool bExclusive, bool modal, bool urgent);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tu32 getClassID();\r\n\r\n\t// Read only\r\n\tinline const char*  getAsset    ()\t\t\t\t    { return m_asset;\t\t\t}\r\n\r\n\t// Read Only\r\n\tinline \r\n\tvirtual u32         getOrder    ()\t\t\t\t\t{ return m_order;\t\t\t}\r\n\r\n\tinline bool         getExclusive()\t\t\t\t\t{ return m_bExclusive;\t\t}\r\n\tinline void         setExclusive(bool exclusive)\t{ m_bExclusive = exclusive; }\r\n\t\r\n\t// Read Only\r\n\tinline bool         getAssetFile()\t\t\t\t\t{ return m_bAssetFile;\t\t}\r\n\r\n\t/* Read only\r\n\tinline\r\n\tvoid setAssetFile(bool fileAsset)\t\t\t{ m_bAssetFile = fileAsset; }\r\n\t*/\r\n\r\n\tinline void setEnable       (bool isEnable)\t\t            {\r\n\t\tm_bEnable = isEnable;\r\n\t\tCKLBUISelectable * pItem;\r\n\t\tfor(pItem = m_ctrlList.pBegin; pItem; pItem = pItem->getNextSelectable()) {\r\n\t\t\tpItem->setEnabled(isEnable);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void inputEnable     (bool bEnable)\t\t\t\t\t{ \r\n\t\tm_bInputEnable = bEnable;\r\n\t\tm_ctrlList.bEnable = m_bEnable && m_bInputEnable;\t// モーダル状態との複合になる。\r\n\t}\r\n\r\n\tinline bool setAnimCallback (const char* callback)\t\t        { return m_animpack.setCallback(callback);\t\t}\r\n\r\n\tinline bool animation       (const char* animname, bool blend)  { return m_animpack.kickAnim(getNode(), animname, blend);\t}\r\n\r\n\tinline bool animEnter       ()\t\t\t\t\t\t\t\t\t{ return m_animpack.kickEnter(getNode());\t\t}\r\n\r\n\tinline bool animLeave       ()\t\t\t\t\t\t\t\t\t{ return m_animpack.kickLeave(getNode());\t\t}\r\n\r\n\tinline bool isAnim          (const char* name)\t\t\t\t\t{\r\n\t\tint cnt = m_animpack.getAnimCounter(name);\r\n\t\treturn (cnt > 0);\r\n\t}\r\n\r\n\tinline bool skipAnim        (const char* name)\t\t\t\t\t{ return m_animpack.skipAnim(getNode(), name);\t}\r\n\r\n\tinline bool setGroup        (const char* group_name)\t\t\t{ return CKLBFormGroup::getInstance().addForm(&m_ctrlList, group_name);\t}\r\n\r\n\tinline bool existNode       (const char* name)\t\t\t\t\t{ return m_formIF.isExistNode(getNode(), name);\t}\r\n\r\n\tvoid\t\tsetGlobalVolume (float volume);\r\nprotected:\r\n\tu32\t\t\tm_order;\r\n\tconst char* m_asset;\r\n\tbool\t\tm_bAssetFile;\r\n\tbool\t\tm_bExclusive;\r\nprivate:\r\n\tvoid         setGlobalVolume_r  (CKLBNode* pNode, float volume);\r\n\tbool         setFormEnable      (bool bEnable);\r\n\tvirtual void setVisible         (bool visible);\r\n\r\n\tCKLBNode\t\t*\tm_pFormNode;\r\n\tSFormCtrlList\t\tm_ctrlList;\r\n\tu32\t\t\t\t\tm_handle;\r\n\r\n\tCKLBNodeAnimPack\tm_animpack;\t\t// ポインタではないので注意\r\n\r\n\tCKLBFormIF\t\t\tm_formIF;\r\n\tCKLBModalStack\t\tm_modalStack;\r\n\r\n\tbool\t\t\t\tm_bEnable;\t\t// これまでのモーダルenable\r\n\tbool\t\t\t\tm_bInputEnable;\t// これまでの InputEnable\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIForm_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIFreeVertItem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIFreeVertItem.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"mem.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_FREEVERT_SET_VERTICES = 0,\t// 頂点位置を指定\r\n\tUI_FREEVERT_SET_COLORS,\t\t\t// 頂点カラー一括指定\r\n\tUI_FREEVERT_SET_VERT_COL,\t\t// 頂点カラー個別指定\r\n\tUI_FREEVERT_SET_UV,\t\t\t\t// 頂点UV指定\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_FREEVERT_SET_VERTICES\",\tUI_FREEVERT_SET_VERTICES },\r\n\t{ \"UI_FREEVERT_SET_COLORS\",\t\tUI_FREEVERT_SET_COLORS },\r\n\t{ \"UI_FREEVERT_SET_VERT_COL\",\tUI_FREEVERT_SET_VERT_COL },\r\n\t{ \"UI_FREEVERT_SET_UV\",\t\t\tUI_FREEVERT_SET_UV },\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIFreeVertItem> factory(\"UI_FreeVertItem\", CLS_KLBUIFREEVERTITEM, cmd);\r\n\r\nCKLBUIFreeVertItem::CKLBUIFreeVertItem()\r\n: CKLBUITask    ()\r\n, m_handle      (0)\r\n, m_asset       (NULL)\r\n{\t\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIFreeVertItem::~CKLBUIFreeVertItem() \r\n{\r\n\tKLBDELETEA(m_asset);\r\n}\r\n\r\nu32\r\nCKLBUIFreeVertItem::getClassID()\r\n{\r\n\treturn CLS_KLBUIFREEVERTITEM;\r\n}\r\n\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIFreeVertItem::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIFreeVertItem::setOrder,\t\t(getBoolT)&CKLBUIFreeVertItem::getOrder,\t0\t},\r\n\t{\t\"asset\",\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIFreeVertItem::getAsset,\t0\t},\r\n};\r\n\r\nconst u16 CKLBUIFreeVertItem::ms_indices[] = {\r\n\t0, 1, 3,\r\n\t1, 2, 3\r\n};\r\n\r\n\r\n// 引数のインデックス定義\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_ASSET,\r\n\tARG_VERTICES,\r\n\r\n\tARG_REQUIRE = ARG_VERTICES,\r\n};\r\n\r\nCKLBUIFreeVertItem* \r\nCKLBUIFreeVertItem::create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset, float* vertices) \r\n{\r\n\tCKLBUIFreeVertItem* pTask = KLBNEW(CKLBUIFreeVertItem);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, order, x, y, asset, vertices)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIFreeVertItem::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset, float* vertices) \r\n{\r\n    if(!setupNode()) { return false; }\r\n\tbool bResult = initCore(order, x, y, asset, vertices);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIFreeVertItem::initCore(u32 order, float x, float y, const char* asset, float* vertices)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 読み込んだ頂点データと、座標値、orderで表示物を用意する。\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\r\n\t// 初期RGBA値を設定しておく\r\n    for(int i = 0; i < 4; i++) { m_arrColor[i] = 0xffffffff; }\r\n\r\n\tm_pDynSprite = pRdrMgr.allocateCommandDynSprite(4, 2*3);\r\n\tif(asset) {\r\n\t\tsetStrC(m_asset, asset);\r\n\t} else {\r\n\t\tsetStrC(m_asset, \"\");\r\n\t}\r\n\tsetInitPos(x, y);\r\n\r\n\tm_pTex = NULL;\r\n    if(asset) { m_pTex = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset, &m_handle); }\r\n\tif(m_pTex) {\r\n\t\tsetUV(m_pTex);\t// UV値を取り込んでおく\r\n\t\tm_pDynSprite->setTexture(m_pTex);\r\n\t}\r\n\r\n\tgetNode()->setRender(m_pDynSprite);\r\n\tgetNode()->setRenderOnDestroy(true);\r\n\tgetNode()->setPriority(m_order);\r\n\r\n\tif(vertices) {\r\n\t\tsetVertXY(vertices);\r\n\t} else {\r\n\t\tfloat f = 0.0f;\r\n\t\tint   i = *((int*)&f);\r\n\t\tmemset32(m_arrVert, i, 8 * sizeof(float));\r\n\t\tassignVertices();\r\n\t}\r\n\r\n\tu16* pBuff = m_pDynSprite->getSrcIndexBuffer();\r\n\tmemcpy(pBuff, ms_indices, 6*sizeof(u16));\r\n\r\n\tassignVertColors();\r\n\tassignUV();\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIFreeVertItem::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE) { return false; }\r\n\r\n\t// 基本プロパティの取り込み\r\n\tfloat x = lua.getFloat(ARG_X);\r\n\tfloat y = lua.getFloat(ARG_Y);\r\n\tconst char * asset = NULL;\r\n\tif(!lua.isNil(ARG_ASSET)) {\r\n\t\tasset = lua.getString(ARG_ASSET);\r\n\t}\r\n\t// 初期頂点データの読み込み\r\n\tlua.retValue(ARG_VERTICES);\r\n\tfloat tmpVert[8];\r\n\tbool bResult = setVertices(lua,tmpVert);\r\n\tlua.pop(1);\r\n\r\n\t// 頂点データが正しく読めていなければタスク起動失敗\r\n\tif(!bResult) { \r\n\t\treturn false; \r\n\t} else { \r\n\t\treturn initCore(lua.getInt(ARG_ORDER),x,y,asset,tmpVert); \r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIFreeVertItem::dieUI()\r\n{\r\n\tCKLBDataHandler::releaseHandle(m_handle);\r\n}\r\n\r\nvoid\r\nCKLBUIFreeVertItem::execute(u32 /* deltaT */)\r\n{\r\n\r\n}\r\n\r\nint\r\nCKLBUIFreeVertItem::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_FREEVERT_SET_VERTICES:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tlua.retValue(3);\r\n\t\t\tbool bResult = setVertices(lua);\t// Lua配列から頂点情報を取得\r\n\t\t\tlua.pop(1);\r\n\t\t\tif(bResult)\tassignVertices();\t// 取り込んだ頂点座標をDynSpriteに設定\r\n\r\n\t\t\tlua.retBoolean(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FREEVERT_SET_COLORS:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlua.retValue(3);\r\n\t\t\tbool bResult = setVertColors(lua);\t// Lua配列から頂点カラーを取得\r\n\t\t\tlua.pop(1);\r\n\t\t\tif(bResult) assignVertColors();\t\t// 取り込んだ頂点カラーをDynSpriteに設定\r\n\t\t\tlua.retBoolean(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FREEVERT_SET_VERT_COL:\r\n\t\t{\r\n\t\t\tif(argc != 5) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint idx   = lua.getInt(3);\r\n\t\t\tu32 alpha = lua.getInt(4);\r\n\t\t\tu32 rgb   = lua.getInt(5);\r\n\t\t\tu32 argb = (rgb & 0xffffff)|((alpha & 0xff)<<24);\r\n\t\t\tsetVertCol(idx,argb);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_FREEVERT_SET_UV:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) { \r\n\t\t\t\tlua.retValue(3);\r\n\t\t\t\tbool bResult = setArrUV(lua);\t// Lua配列から頂点情報を取得\r\n\t\t\t\tlua.pop(1);\r\n\t\t\t\tif(bResult)\tassignUV();\t\t\t// 取り込んだ頂点座標をDynSpriteに設定\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid \r\nCKLBUIFreeVertItem::setVertColors(u32* colors) \r\n{\r\n\tmemcpy(m_arrColor, colors, 4 * sizeof(u32));\r\n\tassignVertColors();\r\n}\r\n\r\nvoid CKLBUIFreeVertItem::setVertUV(float* uv) \r\n{\r\n\t/* 取り込んだ値をテクスチャ内ローカルの値から、\r\n\t\tテクスチャアトラスレベルの値に変換する */\r\n\tfloat width  = m_arrOriginalUV[2] - m_arrOriginalUV[0];\r\n\tfloat height = m_arrOriginalUV[5] - m_arrOriginalUV[1];\r\n\tfloat baseX  = m_arrOriginalUV[0];\r\n\tfloat baseY  = m_arrOriginalUV[1];\r\n\r\n\tfor(int i = 0; i < 4; i++) {\r\n\t\tfloat u = uv[i* 2];\r\n\t\tfloat v = uv[i * 2 + 1];\r\n\r\n\t\t// 負の値が指定された場合に、隣のテクスチャに割り込まないようにする処理。\r\n\t\t// 指定された画像より左側にuvが動くとGLのテクスチャアトラス上で問題が生じることがある。\r\n\r\n        if(u < 0.0f) { u = 1.0f - u; }\r\n\t\tif(v < 0.0f) { v = 1.0f - v; }\r\n\r\n\t\tm_arrUV[i * 2]      = u * width + baseX;\r\n\t\tm_arrUV[i * 2 + 1]  = v * height + baseY;\r\n\t}\r\n\tassignUV();\r\n}\r\n\r\nvoid \r\nCKLBUIFreeVertItem::setVertXY(float* coord) \r\n{\r\n\tmemcpy(m_arrVert, coord, 8 * sizeof(float));\r\n\tassignVertices();\r\n}\r\n\r\nbool\r\nCKLBUIFreeVertItem::setVertColors(CLuaState& lua)\r\n{\r\n\tint i;\r\n\tbool bResult = true;\r\n\tu32 alpha, rgb;\r\n\r\n\tfor(i = 0; i < 4; i++) {\r\n\t\tlua.retInt(i * 2 + 1);\r\n\t\tlua.tableGet();\r\n\t\tif(lua.isNil(-1)) {\r\n\t\t\tbResult = false;\r\n\t\t\tlua.pop(1);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\talpha = lua.getInt(-1);\r\n\t\tlua.pop(1);\r\n\t\tlua.retInt(i * 2 + 2);\r\n\t\tlua.tableGet();\r\n\t\tif(lua.isNil(-1)) {\r\n\t\t\tbResult = false;\r\n\t\t\tlua.pop(1);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\trgb = lua.getInt(-1);\r\n\t\tlua.pop(1);\r\n\r\n\t\t// alpha と rgb 値を組み合わせてRGBA値を作る\r\n\t\tm_arrColor[i] = (rgb & 0xffffff) | ((alpha & 0xff) << 24);\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIFreeVertItem::setVertices(CLuaState& lua, float* tmpDst)\r\n{\r\n\tint i;\r\n\tbool bResult = true;\r\n\r\n\t// 頂点情報配列には、x,y,x,y,... のような形式で\r\n\t// 頂点が格納されているので、それを読み取り内部の配列に格納する。\r\n\tfor(i = 0; i < 8; i++) {\r\n\t\tlua.retInt(i + 1);\r\n\t\tlua.tableGet();\r\n\t\tif(lua.isNil(-1)) {\r\n\t\t\tbResult = false;\r\n\t\t\tlua.pop(1);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tfloat f = lua.getFloat(-1);\r\n\t\tif(tmpDst) {\r\n\t\t\ttmpDst[i] = f;\r\n\t\t} else {\r\n\t\t\tm_arrVert[i] = f;\r\n\t\t}\r\n\t\tlua.pop(1);\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nvoid\r\nCKLBUIFreeVertItem::setUV(CKLBImageAsset * pTex)\r\n{\r\n\tklb_assert(pTex->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in FreeVertItem task.\");\r\n\r\n\tfor(int i = 0; i < 4; i++) {\r\n\t\tpTex->getUV(i, &m_arrUV[i * 2], &m_arrUV[i * 2 + 1]);\r\n\t\tm_arrOriginalUV[i * 2]      = m_arrUV[i * 2];\r\n\t\tm_arrOriginalUV[i * 2 + 1]  = m_arrUV[i * 2 + 1];\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIFreeVertItem::setVertColors()\r\n{\r\n\tfor(int i = 0; i < 6; i++) {\r\n\t\tint idx = ms_indices[i];\r\n\t\tu32 col;\r\n\t\tu32 color = m_arrColor[idx];\r\n\t\tu8* pCol = (u8*)&col;\r\n\t\t// Memory order cast to 'col'\r\n\t\tpCol[0] = color >> 16;\t// R\r\n\t\tpCol[1] = color >> 8;\t// G\r\n\t\tpCol[2] = color;\t\t// B\r\n\t\tpCol[3] = color >> 24;  // A\r\n\t\tm_pDynSprite->setVertexColor(getNode(),i, col);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIFreeVertItem::setVertices()\r\n{\r\n\t// 4頂点分の座標値が頂点配列に格納されているので、\r\n\t// それをDynSpriteに設定する。\r\n\r\n\t// DynSpriteは三角形二つ分なので、合計6頂点。\r\n\tfor(int i = 0; i < 6; i++) {\r\n\t\tint idx = ms_indices[i];\r\n\t\tm_pDynSprite->setVertexXY(i, m_arrVert[idx * 2], m_arrVert[idx * 2 + 1]);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIFreeVertItem::setUV()\r\n{\r\n\t// 4頂点分の座標値が頂点配列に格納されているので、\r\n\t// それをDynSpriteに設定する。\r\n\r\n\t// DynSpriteは三角形二つ分なので、合計6頂点。\r\n\tfor(int i = 0; i < 6; i++) {\r\n\t\tint idx = ms_indices[i];\r\n\t\tm_pDynSprite->setVertexUV(i, m_arrUV[idx * 2], m_arrUV[idx * 2 + 1]);\r\n\t}\r\n\tgetNode()->markUpMatrix();\r\n}\r\n\r\nbool\r\nCKLBUIFreeVertItem::setArrUV(CLuaState& lua)\r\n{\r\n\tint i;\r\n\tbool bResult = true;\r\n\r\n\t// 頂点情報配列には、x,y,x,y,... のような形式で\r\n\t// 頂点が格納されているので、それを読み取り内部の配列に格納する。\r\n\tfor(i = 0; i < 8; i++) {\r\n\t\tlua.retInt(i + 1);\r\n\t\tlua.tableGet();\r\n\t\tif(lua.isNil(-1)) {\r\n\t\t\tbResult = false;\r\n\t\t\tlua.pop(1);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tm_arrUV[i] = lua.getFloat(-1);\r\n\t\tlua.pop(1);\r\n\t}\r\n\t/* 取り込んだ値をテクスチャ内ローカルの値から、\r\n\t\tテクスチャアトラスレベルの値に変換する */\r\n\tfloat width  = m_arrOriginalUV[2] - m_arrOriginalUV[0];\r\n\tfloat height = m_arrOriginalUV[5] - m_arrOriginalUV[1];\r\n\tfloat baseX  = m_arrOriginalUV[0];\r\n\tfloat baseY  = m_arrOriginalUV[1];\r\n\r\n\tfor(int i = 0; i < 4; i++) {\r\n\t\tfloat u = m_arrUV[i* 2];\r\n\t\tfloat v = m_arrUV[i * 2 + 1];\r\n\r\n\t\t// 負の値が指定された場合に、隣のテクスチャに割り込まないようにする処理。\r\n\t\t// 指定された画像より左側にuvが動くとGLのテクスチャアトラス上で問題が生じることがある。\r\n\r\n\t\tif(u < 0.0f) u = 1.0f - u;\r\n\t\tif(v < 0.0f) v = 1.0f - v;\r\n\r\n\t\tm_arrUV[i * 2] = u * width + baseX;\r\n\t\tm_arrUV[i * 2 + 1] = v * height + baseY;\r\n\t}\r\n\treturn bResult;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIFreeVertItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIFreeVertItem_h\r\n#define CKLBUIFreeVertItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBDrawTask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIFreeVertItem\r\n* \\brief Free Vertex Item Task Class\r\n* \r\n* CKLBUIFreeVertItem can display image like CKLBUISimpleItem.\r\n* However, it is possible to modify the UV, Colors and coordinate for each vertex.\r\n* It is usefull also to just display a filled area with a given RGBA color, or gradient display \r\n* without texture at all.\r\n*/\r\nclass CKLBUIFreeVertItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIFreeVertItem>;\r\nprivate:\r\n\tCKLBUIFreeVertItem();\r\n\tvirtual ~CKLBUIFreeVertItem();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset, float* vertices);\r\n\tbool initCore(u32 order, float x, float y, const char* asset, float* vertices);\r\npublic:\r\n\tu32 getClassID();\r\n\tstatic CKLBUIFreeVertItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset, float* vertices);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline virtual u32 getOrder() {\treturn m_order; }\r\n\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif (m_order != order) {\r\n\t\t\tgetNode()->setPriority(order);\r\n\t\t\tm_order = order;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getAsset() { return m_asset; }\r\n\r\n\tinline void setVertCol(int idx, u32 argb) {\r\n\t\tm_arrColor[idx] = argb;\r\n\t\tassignVertColors();\r\n\t}\r\n\r\n\tvoid setVertColors\t(u32* colors);\r\n\tvoid setVertUV\t\t(float* uv);\r\n\tvoid setVertXY\t\t(float* coord);\r\n\r\nprivate:\r\n\tu32         m_order;\r\n\tconst char* m_asset;\r\n\r\n\tbool setVertColors  (CLuaState& lua);\r\n\tbool setVertices    (CLuaState& lua, float* tmpDest = NULL);\t// Lua配列から頂点座標値を取り込んでおく\r\n\tvoid setUV          (CKLBImageAsset * pTex);\t                // テクスチャからUV値を取り込んでおく\r\n\tbool setArrUV       (CLuaState& lua);\t\t                    // Lua配列からUV値を取り込んでおく\r\n\r\n\tvoid setVertColors  ();\r\n\tvoid setVertices    ();     // 頂点座標値配列から、座標値を設定する\r\n\tvoid setUV          ();\t    // UV値配列から、UV値を設定する。\r\n\r\nprivate:\r\n\tinline void assignVertColors() {\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tu32 col;\r\n\t\t\tu32 color = m_arrColor[i];\r\n\t\t\tu8* pCol = (u8*)&col;\r\n\t\t\t// Memory order cast to 'col'\r\n\t\t\tpCol[0] = color >> 16;\t// R\r\n\t\t\tpCol[1] = color >> 8;\t// G\r\n\t\t\tpCol[2] = color;\t\t// B\r\n\t\t\tpCol[3] = color >> 24;  // A\r\n\r\n\t\t\tm_pDynSprite->setVertexColor(getNode(),i, col);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void assignVertices() {\r\n\t\t// 4頂点分の座標値が頂点配列に格納されているので、\r\n\t\t// それをDynSpriteに設定する。\r\n\r\n\t\t//\r\n\t\t// Patch coordinate to fit screen if we are in bordeless mode.\r\n\t\t//\r\n\t\tint w = CKLBDrawResource::getInstance().width ();\r\n\t\tint h = CKLBDrawResource::getInstance().height();\r\n\r\n\t\tif (\r\n\t\t\t(((int)m_arrVert[0]) == 0) &&\r\n\t\t\t(((int)m_arrVert[1]) == 0) &&\r\n\t\t\t(((int)m_arrVert[2]) == w) &&\r\n\t\t\t(((int)m_arrVert[3]) == 0) &&\r\n\t\t\t(((int)m_arrVert[4]) == w) &&\r\n\t\t\t(((int)m_arrVert[5]) == h) &&\r\n\t\t\t(((int)m_arrVert[6]) == 0) &&\r\n\t\t\t(((int)m_arrVert[7]) == h)\r\n\t\t   )\r\n\t\t{\r\n\t\t\tfloat oxf = CKLBDrawResource::getInstance().ox();\r\n\t\t\tfloat oyf = CKLBDrawResource::getInstance().oy();\r\n\t\t\tm_arrVert[0] -= oxf;\r\n\t\t\tm_arrVert[1] -= oyf;\r\n\t\t\tm_arrVert[2] += oxf;\r\n\t\t\tm_arrVert[3] -= oyf;\r\n\t\t\tm_arrVert[4] += oxf;\r\n\t\t\tm_arrVert[5] += oyf;\r\n\t\t\tm_arrVert[6] -= oxf;\r\n\t\t\tm_arrVert[7] += oyf;\r\n\t\t}\r\n\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tm_pDynSprite->setVertexXY(i, m_arrVert[i*2], m_arrVert[(i*2) + 1]);\r\n\t\t}\r\n\t}\r\n\r\n\tinline void assignUV()\r\n\t{\r\n\t\t// 4頂点分の座標値が頂点配列に格納されているので、\r\n\t\t// それをDynSpriteに設定する。\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tm_pDynSprite->setVertexUV(i, m_arrUV[i*2], m_arrUV[(i*2) + 1]);\r\n\t\t}\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\r\n\tCKLBImageAsset\t*\tm_pTex;\r\n\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\r\n\tu32\t\t\t\t\tm_handle;\r\n\r\n\tfloat\t\t\t\tm_arrVert[8];\r\n\tfloat\t\t\t\tm_arrUV[8];\r\n\tfloat\t\t\t\tm_arrOriginalUV[8];\r\n\tu32\t\t\t\t\tm_arrColor[4];\r\n\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\tstatic const u16\tms_indices[];\r\n\r\n\t// プロパティのインデックス\r\n};\r\n\r\n#endif // CKLBUIFormVertItem_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIGroup.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIGroup.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_GROUP_ANIM_CALLBACK = 0,\r\n\tUI_GROUP_ANIMATION,\r\n\tUI_GROUP_GET_ANIM_NODE,\r\n\tUI_GROUP_SKIP_ANIM,\r\n\tUI_GROUP_IS_ANIM,\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_GROUP_ANIM_CALLBACK\", UI_GROUP_ANIM_CALLBACK },\r\n\t{ \"UI_GROUP_ANIMATION\",\t\tUI_GROUP_ANIMATION },\r\n// \t{ \"UI_GROUP_GET_ANIM_NODE\",\tUI_GROUP_GET_ANIM_NODE },\r\n\r\n\t{ \"UI_GROUP_IS_ANIM\",\t\tUI_GROUP_IS_ANIM },\r\n\t{ \"UI_GROUP_SKIP_ANIM\",\t\tUI_GROUP_SKIP_ANIM },\r\n\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIGroup> factory(\"UI_Group\", CLS_KLBUIGROUP, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIGroup::ms_propItems[] = {\r\n\tUI_BASE_PROP\r\n//\t\"order\"\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\t// TODO :Useless property\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_REQUIRE = ARG_Y,\r\n\tARG_NUMS    = ARG_Y\r\n};\r\n\r\nCKLBUIGroup::CKLBUIGroup()\r\n: CKLBUITask() \r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIGroup::~CKLBUIGroup() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIGroup::getClassID()\r\n{\r\n\treturn CLS_KLBUIGROUP;\r\n}\r\n\r\nCKLBUIGroup*\r\nCKLBUIGroup::create(CKLBUITask* pParent, CKLBNode* pNode, float x, float y) {\r\n\tCKLBUIGroup* pTask = KLBNEW(CKLBUIGroup);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, x, y)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIGroup::init(CKLBUITask* pParent, CKLBNode* pNode, float x, float y) {\r\n\tif(!setupNode()) return false;\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(x, y);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIGroup::initCore(float x, float y)\r\n{\r\n\tif (!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIGroup::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tfloat x = lua.getFloat(ARG_X);\r\n\tfloat y = lua.getFloat(ARG_Y);\r\n\r\n\t// getNode()->setTranslate(getNum(PR_X), getNum(PR_Y));\r\n\treturn initCore(x,y);\r\n}\r\n\r\nvoid\r\nCKLBUIGroup::execute(u32 /*deltaT*/)\r\n{\r\n\t// TODO OPTIMIZE : possible to sleep task if no anim.\r\n\t// アニメーションの終了を監視する\r\n\tm_animpack.watchFinishedAnim(this);\r\n}\r\n\r\nvoid\r\nCKLBUIGroup::dieUI()\r\n{\r\n\t// 破棄と同時に m_animpack も破棄されるため、特にここで何かを行う必要はない。\r\n}\r\n\r\nint\r\nCKLBUIGroup::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(ret?true:false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GROUP_ANIM_CALLBACK:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * callback = (lua.isNil(3)) ? NULL : lua.getString(3);\r\n\t\t\t\tresult = setAnimCallback(callback);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GROUP_ANIMATION:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\t\tconst char * animname = lua.getString(3);\r\n\t\t\t\tbool blend = (argc >= 4) ? lua.getBool(4) : false;\r\n\t\t\t\tresult = setAnimation(animname, blend);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GROUP_IS_ANIM:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc >= 2 && argc <= 3) {\r\n\t\t\t\tconst char * name = NULL;\r\n\t\t\t\tif(argc >= 3 && !lua.isNil(3)) name = lua.getString(3);\r\n\t\t\t\tresult = isAnim(name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_GROUP_SKIP_ANIM:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc >= 2 || argc <= 3) {\r\n\t\t\t\tconst char * name = NULL;\r\n\t\t\t\tif(argc >= 3 && !lua.isNil(3)) name = lua.getString(3);\r\n\t\t\t\tresult = skipAnim(name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIGroup.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIGroup_h\r\n#define CKLBUIGroup_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBNodeAnimPack.h\"\r\n\r\n/*!\r\n* \\class CKLBUIGroup\r\n* \\brief Group Task Class\r\n* \r\n* CKLBUIGroup allows to easily manage UITasks groups.\r\n* With CKLBUIGroup you can anim or skip the anim of a whole group of tasks \r\n* at the same time with a single command.\r\n*/\r\nclass CKLBUIGroup : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIGroup>;\r\nprivate:\r\n\tCKLBUIGroup();\r\n\tvirtual ~CKLBUIGroup();\r\n\r\n\tbool init(CKLBUITask* parent, CKLBNode* pNode, float x, float y);\r\n\tbool initCore(float x, float y);\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUIGroup* create(CKLBUITask* parent, CKLBNode* pNode, float x, float y);\r\n\tbool initUI     (CLuaState& lua);\r\n\tint  commandUI  (CLuaState& lua, int argc, int cmd);\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tinline bool setAnimCallback\t(const char* callback)\t\t\t{ return m_animpack.setCallback(callback);\t\t\t\t}\r\n\tinline bool setAnimation\t(const char* name, bool blend)\t{ return m_animpack.kickAnim(getNode(), name, blend);\t}\r\n\tinline bool skipAnim\t\t(const char* name)\t\t\t\t{ return m_animpack.skipAnim(getNode(), name);\t\t\t}\r\n\tinline bool isAnim\t\t\t(const char* name)\t\t\t\t{ return name ? (m_animpack.getAnimCounter(name) > 0) : false; }\r\n\r\n\tCKLBNodeAnimPack\tm_animpack;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIGroup_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUILabel.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUILabel.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_LABEL_SET_TEXT,\r\n\tUI_LABEL_SET_COLOR,\r\n\tUI_LABEL_SET_FONT,\r\n\tUI_LABEL_SET_POSITION,\r\n\tUI_LABEL_SET_ALIGNMENT\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_LABEL_SET_TEXT\",\t\tUI_LABEL_SET_TEXT },\r\n\t{\"UI_LABEL_SET_COLOR\",\t\tUI_LABEL_SET_COLOR },\r\n\t{\"UI_LABEL_SET_FONT\",\t\tUI_LABEL_SET_FONT },\r\n\t{\"UI_LABEL_SET_POSITION\",\tUI_LABEL_SET_POSITION },\r\n\t{\"UI_LABEL_SET_ALIGNMENT\",\tUI_LABEL_SET_ALIGNMENT },\r\n\t{0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUILabel> factory(\"UI_Label\", CLS_KLBUILABEL, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUILabel::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUILabel::setOrder,\t\t(getBoolT)&CKLBUILabel::getOrder,\t\t0\t\t},\r\n\t{\t\"font\",\t\t\t\tSTRING,\t\t(setBoolT)&CKLBUILabel::setFont,\t\t(getBoolT)&CKLBUILabel::getFont,\t\t0\t\t},\r\n\t{\t\"size\",\t\t\t\tUINTEGER,\t(setBoolT)&CKLBUILabel::setFontSize,\t(getBoolT)&CKLBUILabel::getFontSize,\t0\t\t},\r\n\t{\t\"txt_alpha\",\t\tUINTEGER,\t(setBoolT)&CKLBUILabel::setAlpha,\t\t(getBoolT)&CKLBUILabel::getAlpha,\t\t0\t\t},\r\n\t{\t\"txt_color\",\t\tUINTEGER,\t(setBoolT)&CKLBUILabel::setU24Color,\t(getBoolT)&CKLBUILabel::getU24Color,\t0\t\t},\r\n\t{\t\"text\",\t\t\t\tSTRING,\t\t(setBoolT)&CKLBUILabel::setText,\t\t(getBoolT)&CKLBUILabel::getText,\t\t0\t\t},\r\n\t{\t\"align\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUILabel::setAlign,\t\t(getBoolT)&CKLBUILabel::getAlign,\t\t0\t\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ALPHA,\r\n\tARG_COLOR,\r\n\r\n\tARG_FONT,\r\n\tARG_SIZE,\r\n\r\n\tARG_TEXT,\r\n\r\n\tARG_ALIGN,\r\n\r\n\tARG_REQUIRE = ARG_TEXT,\r\n\tARG_NUMS = ARG_ALIGN\r\n};\r\nCKLBUILabel::CKLBUILabel()\r\n: CKLBUITask()\r\n, m_pLabel\t(NULL)\r\n, m_font\t(NULL)\r\n, m_text\t(NULL)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUILabel::~CKLBUILabel() \r\n{\r\n\tKLBDELETEA(m_font);\r\n\tKLBDELETEA(m_text);\r\n}\r\n\r\nu32\r\nCKLBUILabel::getClassID()\r\n{\r\n\treturn CLS_KLBUILABEL;\r\n}\r\n\r\nCKLBUILabel* CKLBUILabel::create(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, u32 align) {\r\n\tCKLBUILabel* pTask = KLBNEW(CKLBUILabel);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(parent, pNode, order, x, y, alpha, color, font, size, text, align)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUILabel::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align) {\r\n\tif (!setupNode()) return false;\r\n\tbool bResult = initCore(order, x, y,alpha, color, font, size, text,align);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif (pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUILabel::initCore(u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text, u32 align)\r\n{\r\n\tif (!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\tm_alpha = alpha;\r\n\tm_color = color;\r\n\tsetStrC(m_font,font);\r\n\tm_size  = size;\r\n\tsetStrC(m_text,  text);\r\n\tm_align = align;\r\n\tm_update = false;\r\n\treturn setup_node();\r\n}\r\n\r\nbool\r\nCKLBUILabel::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\treturn initCore(lua.getInt(ARG_ORDER),\r\n                    lua.getFloat(ARG_X),\r\n                    lua.getFloat(ARG_Y),\r\n                    lua.getInt(ARG_ALPHA),\r\n                    lua.getInt(ARG_COLOR),\r\n                    lua.getString(ARG_FONT),\r\n                    lua.getInt(ARG_SIZE),\r\n                    lua.getString(ARG_TEXT),\r\n                    (argc >= ARG_ALIGN) ? lua.getInt(ARG_ALIGN) : 0\r\n                   );\r\n}\r\n\r\nint\r\nCKLBUILabel::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_LABEL_SET_TEXT:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tconst char * text = lua.getString(3);\r\n\r\n\t\t\tsetText(text);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LABEL_SET_COLOR:\r\n\t\t{\r\n\t\t\tif(argc != 4) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tu32 alpha = lua.getInt(3);\r\n\t\t\tu32 col = lua.getInt(4);\r\n\r\n\t\t\tsetColor((alpha << 24) | col);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LABEL_SET_FONT:\r\n\t\t{\r\n\t\t\tif(argc != 4) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tconst char * font = lua.getString(3);\r\n\t\t\tu32 size = lua.getInt(4);\r\n\r\n\t\t\tsetFont(font);\r\n\t\t\tsetFontSize(size);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LABEL_SET_POSITION:\r\n\t\t{\r\n\t\t\tif(argc != 4) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tfloat x = lua.getFloat(3);\r\n\t\t\tfloat y = lua.getFloat(4);\r\n\r\n\t\t\tsetPosition(x,y);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LABEL_SET_ALIGNMENT:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tu32 align = lua.getInt(3);\r\n\r\n\t\t\tsetAlign(align);\r\n\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUILabel::execute(u32 /*deltaT*/)\r\n{\r\n\tsetup_node();\r\n\tRESET_A;\r\n\r\n\t//m_pLabel->setViewPortPos(0, 0);\r\n}\r\n\r\nvoid\r\nCKLBUILabel::dieUI()\r\n{\r\n\tKLBDELETE(m_pLabel);\r\n}\r\n\r\nbool\r\nCKLBUILabel::setup_node()\r\n{\r\n\tif(!m_pLabel) {\r\n\t\tm_pLabel = KLBNEWC(CKLBLabelNode,(0,m_font,0));\t// No text, No font\r\n\t\tif(m_pLabel) { \r\n\t\t\tm_pLabel->setUseTextSize(true);\r\n\t\t\tgetNode()->addNode(m_pLabel); \r\n\t\t\tm_pLabel->setPriority(m_order);\r\n\t\t}\r\n\t}\r\n\r\n\tif(!m_pLabel) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_pLabel->lock(true);\r\n\r\n\tm_pLabel->setFont   (m_size,m_font);\r\n\tm_pLabel->setAlign  (m_align);\r\n\tm_pLabel->setText   (m_text);\r\n\r\n\tu32 alpha = m_alpha;\r\n\tu32 col   = m_color;\r\n\tm_pLabel->setTextColor(col|(alpha << 24));\r\n\r\n\tm_pLabel->lock(false);\r\n\tm_pLabel->forceRefresh();\r\n\r\n\t//\tDEBUG_PRINT(\"[%p] setup_node(): str = [%s] color=%08x (first)\",\r\n\t//\t\tthis, getStr(PR_TEXT), col|(alpha << 24));\r\n    return true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUILabel.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUILabel_h\r\n#define CKLBUILabel_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBLabelNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUILabel\r\n* \\brief Label Task Class\r\n* \r\n* CKLBUILabel is a basic text label task.\r\n*/\r\nclass CKLBUILabel : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUILabel>;\r\nprivate:\r\n\tCKLBUILabel();\r\n\tvirtual ~CKLBUILabel();\r\n\r\n\tbool init(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align);\r\n\tbool initCore(u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align);\r\npublic:\r\n\tstatic CKLBUILabel* create(CKLBUITask* parent, CKLBNode* pNode, u32 order, float x, float y, u32 alpha, u32 color, const char* font, u32 size, const char* text,u32 align);\r\n\tvirtual u32 getClassID();\r\n\r\n\tbool initUI (CLuaState& lua);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline virtual u32 getOrder()\t{ return m_order;\t}\r\n\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif (order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getAlign()\t{ return m_align;\t}\r\n\r\n\tinline void setAlign(u32 align) {\r\n\t\tif (align != m_align) {\r\n\t\t\tm_align  = align;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline void setText(const char* txt) {\r\n\t\tif (txt) {\r\n\t\t\tif ((!m_text) || (strcmp(txt,m_text)!=0)) {\r\n\t\t\t\tsetStrC(m_text, txt);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_text) {\r\n\t\t\t\tsetStrC(m_text, txt);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getText()\t\t{ return m_text;\t}\r\n\r\n\tinline void setAlpha(u32 alpha)\t\t{ \r\n\t\tif(alpha != m_alpha) {\r\n\t\t\tm_alpha = alpha;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline u32 getAlpha()\t\t\t\t{ return m_alpha;\t}\r\n\r\n\tinline void setU24Color(u32 color)\t{ \r\n\t\tif(color != m_color) {\r\n\t\t\tm_color = color;\t\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline u32 getU24Color()\t\t\t{ return m_color;\t}\r\n\r\n\tinline void setColor(u32 color) {\r\n\t\tu32 alpha = color>>24;\r\n\t\tu32 col\t  = color & 0xFFFFFF;\r\n\t\tif (alpha != m_alpha) {\r\n\t\t\tm_alpha = alpha;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\r\n\t\tif (col != m_color) {\r\n\t\t\tm_color = col;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getColor()\t{ return m_color | (m_alpha<<24);\t}\r\n\r\n\tinline void setFont(const char* font) {\r\n\t\tif (font) {\r\n\t\t\tif ((!m_font) || (strcmp(font,m_font)!=0)) {\r\n\t\t\t\tsetStrC(m_font, font);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (m_font) {\r\n\t\t\t\tsetStrC(m_font, font);\r\n\t\t\t\tREFRESH_A;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getFont()\t\t{ return m_font; }\r\n\r\n\tinline void setFontSize(u32 size) {\r\n\t\tif (size != m_size) {\r\n\t\t\tm_size = size;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getFontSize() { return m_size; }\r\n\r\n\tinline void setPosition(float x, float y) {\r\n\t\tsetX(x);\r\n\t\tsetY(y);\r\n\t\tREFRESH_A;\r\n\t}\r\n\r\nprivate:\r\n\tu32\t\t\tm_align;\r\n\tu32\t\t\tm_color;\r\n\tu32\t\t\tm_size;\r\n\tu32\t\t\tm_order;\r\n\tconst char* m_font;\r\n\tconst char* m_text;\r\n\tu8\t\t\tm_alpha;\r\n\r\n\tbool setup_node();\r\n\t\r\n\t// 現在は VDocで仮実装しておく。\r\n\tCKLBLabelNode\t\t\t*\tm_pLabel;\r\n\tbool\t\t\t\t\t\tm_update;\r\n\tstatic\tPROP_V2\t\t\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUILabel_h\r\n\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIList.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIList.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBFormGroup.h\"\r\n\r\n#include \"CKLBUIScrollBar.h\"\r\n#include \"IMgrEntry.h\"\r\n;\r\n\r\n// Command Values\r\nenum {\r\n\tUI_LIST_ITEM_ADD,\t\t// アイテムを下端に追加\r\n\tUI_LIST_ITEM_INSERT,\t// アイテムを指定位置に追加\r\n\tUI_LIST_ITEM_REMOVE,\t// アイテムを削除\r\n\tUI_LIST_ITEM_MOVE,\t\t// アイテムを移動\r\n\r\n\tUI_LIST_FWMODE_CONFIG,\t// FW動作パラメータを設定する(保持アイテム最大数,アイテムのステップ値)\r\n\tUI_LIST_FWITEM_ADD,\t\t\t// 下端にアイテムを追加する\r\n\tUI_LIST_FWITEM_INSERTTOP,\t// 上端にアイテムを追加する\r\n\tUI_LIST_SET_MARGIN,\t\t// リスト先端/終端のスクロール幅マージンを指定\r\n\tUI_LIST_SET_OFFSET,\t\t// 指定したposが表示上あわされるラインの位置を指定(default: 0)\r\n\r\n\tUI_LIST_SET_LOOPMODE,\t// ループモードを指定\r\n\tUI_LIST_SET_ITEMMODE,\t// アイテム保持モードを指定\r\n\r\n\tUI_LIST_ITEM_REMOVE_SELECTION,\t// 複数アイテムの選択同時破棄\r\n\r\n\tUI_LIST_ADD_RECORDS,\t// 複数アイテムを同一のテンプレートを使用して一括追加する\r\n\r\n\tUI_LIST_SET_ITEM_ID,\t// 指定されたindexのアイテムにIDを与える\r\n\tUI_LIST_SEARCH_ID,\t\t// 指定されたIDを持つアイテムのindexを得る\r\n\r\n\tUI_LIST_SET_POSITION,\t// スクロール位置合わせ\r\n\tUI_LIST_SET_INITIAL,\t// 初期スクロール位置の設定\r\n\tUI_LIST_SET_DRAGRECT,\t// Set scroll draggable area\r\n\tUI_LIST_SET_ITEM_POS,\t// スクロール位置をアイテム位置に合わせる\r\n\tUI_LIST_GET_POSITION,\t// スクロール位置\r\n\r\n\tUI_LIST_GET_LIMIT,\t\t// スクロール上限値を得る\r\n\tUI_LIST_SET_LIMITCLIP,\t// 上限/下限でストップするか否かのモードを設定する\r\n\tUI_LIST_SET_LIMITAREA,\t// 超過スクロール警告コールバックが呼ばれる条件となる範囲のサイズを設定する\r\n\r\n\tUI_LIST_CHANGE_STEP,\t// 指定アイテムの占有する幅を変更する\r\n\r\n\tUI_LIST_EXIST_NODE,\t\t// 指定されたindexアイテムに指定された名称のノードがあるかを確認する\r\n\tUI_LIST_UPDATE_NODE,\t// 指定indexのアイテムをUI_Form同様に更新する\r\n\r\n\tUI_LIST_INPUT_ENABLE,\t// リスト単位でのパネル入力許可/禁止\r\n\tUI_LIST_ITEM_ENABLE,\t// アイテム単位での操作許可/禁止\r\n\r\n\tUI_LIST_ANIM_CALLBACK,\t// リストアニメーションのコールバック設定\r\n\tUI_LIST_ANIMATION_ITEM,\t// リストアイテム単独のアニメーション\r\n\tUI_LIST_ANIMATION_ALL,\t// リストの全アイテムアニメーション\r\n\tUI_LIST_ITEM_ANIM_SKIP,\t// リストアイテム単独のアニメーションをスキップし終了状態にする\r\n\tUI_LIST_ALL_ANIM_SKIP,\t// リストの全アイテムアニメーションをスキップし終了状態にする\r\n\r\n\tUI_LIST_USE_SCROLLBAR,\t// リストのスクロールバーを有効にする\r\n\tUI_LIST_SELECT_SCRMGR,\t// スクロールマネージャを変更する\r\n\tUI_LIST_SCRMGR_CALLBACK,// スクロールマネージャレベルでのコールバック指定(動作停止時に呼ばれる)\r\n\tUI_LIST_SET_GROUP,\t\t// リストのグループを指定する\r\n\tUI_LIST_SET_CLIP,\t\t// Reset clip.\r\n\tUI_LIST_GET_ITEMCOUNT,\t// Get Count List Item.\r\n\tUI_LIST_GET_ITEMFORM,\t// Return a form object if exist for a given item.\r\n\tUI_LIST_SET_DRAGMINDISTANCE, //\r\n};\r\n// コントロール用値\r\nenum {\r\n\tLIST_VIEW_TOP,\t\t\t// UI_LIST_SET_ITEM_POS の際、指定アイテムをリスト上端に合わせる\r\n\tLIST_VIEW_CENTER,\t\t// UI_LIST_SET_ITEM_POS の際、指定アイテムをリスト中央に合わせる\r\n\tLIST_VIEW_END,\t\t\t// UI_LIST_SET_ITEM_POS の際、指定アイテムをリスト下端に合わせる\r\n\tLIST_VIEW_OFFSET,\t\t// UI_LIST_SET_ITEM_POS の際、指定アイテムをリスト中の指定された位置に合わせる\r\n};\r\n\r\n// スクロールオーバー値\r\nenum {\r\n\tLIST_SCROVER_TOP,\t\t// 上端が近づいた\r\n\tLIST_SCROVER_BOTTOM,\t// 下端が近づいた\r\n\tLIST_SCROVER_TAKEOFF,\t// 端から離れた\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t// リストアイテムの操作\r\n\t{ \"UI_LIST_ITEM_ADD\",\t\t\t\tUI_LIST_ITEM_ADD },\r\n\t{ \"UI_LIST_ITEM_INSERT\",\t\t\tUI_LIST_ITEM_INSERT },\r\n\t{ \"UI_LIST_ITEM_REMOVE\",\t\t\tUI_LIST_ITEM_REMOVE },\r\n\t{ \"UI_LIST_ITEM_MOVE\",\t\t\t\tUI_LIST_ITEM_MOVE },\r\n\t{ \"UI_LIST_ITEM_REMOVE_SELECTION\",\tUI_LIST_ITEM_REMOVE_SELECTION },\r\n\r\n\r\n\t{ \"UI_LIST_FWMODE_CONFIG\",\t\t\tUI_LIST_FWMODE_CONFIG },\r\n\t{ \"UI_LIST_FWITEM_ADD\",\t\t\t\tUI_LIST_FWITEM_ADD },\r\n\t{ \"UI_LIST_FWITEM_INSERTTOP\",\t\tUI_LIST_FWITEM_INSERTTOP },\r\n\r\n\t{ \"UI_LIST_SET_MARGIN\",\t\t\t\tUI_LIST_SET_MARGIN },\r\n\r\n\t{ \"UI_LIST_SET_LOOPMODE\",\t\t\tUI_LIST_SET_LOOPMODE },\r\n\t{ \"UI_LIST_SET_ITEMMODE\",\t\t\tUI_LIST_SET_ITEMMODE },\r\n\r\n\t{ \"UI_LIST_ADD_RECORDS\",\t\t\tUI_LIST_ADD_RECORDS },\r\n\r\n\t{ \"UI_LIST_SET_ITEM_ID\",\t\t\tUI_LIST_SET_ITEM_ID },\r\n\t{ \"UI_LIST_SEARCH_ID\",\t\t\t\tUI_LIST_SEARCH_ID },\r\n\r\n\t// 表示位置のジャンプ\r\n\t{ \"UI_LIST_SET_POSITION\",\t\t\tUI_LIST_SET_POSITION },\r\n\t{ \"UI_LIST_SET_INITIAL\",\t\t\tUI_LIST_SET_INITIAL },\r\n\t{ \"UI_LIST_SET_DRAGRECT\",\t\t\tUI_LIST_SET_DRAGRECT },\r\n\r\n\t{ \"UI_LIST_SET_ITEM_POS\",\t\t\tUI_LIST_SET_ITEM_POS },\r\n\t{ \"UI_LIST_GET_POSITION\",\t\t\tUI_LIST_GET_POSITION },\r\n\r\n\t{ \"UI_LIST_GET_LIMIT\",\t\t\t\tUI_LIST_GET_LIMIT },\r\n\t{ \"UI_LIST_SET_LIMITCLIP\",\t\t\tUI_LIST_SET_LIMITCLIP },\r\n\t{ \"UI_LIST_SET_LIMITAREA\",\t\t\tUI_LIST_SET_LIMITAREA },\r\n\r\n\t{ \"UI_LIST_CHANGE_STEP\",\t\t\tUI_LIST_CHANGE_STEP },\r\n\t{ \"UI_LIST_EXIST_NODE\",\t\t\t\tUI_LIST_EXIST_NODE },\r\n\t{ \"UI_LIST_UPDATE_NODE\",\t\t\tUI_LIST_UPDATE_NODE },\r\n\r\n\t{ \"UI_LIST_INPUT_ENABLE\",\t\t\tUI_LIST_INPUT_ENABLE },\r\n\t{ \"UI_LIST_ITEM_ENABLE\",\t\t\tUI_LIST_ITEM_ENABLE },\r\n\r\n\t{ \"UI_LIST_ANIM_CALLBACK\",\t\t\tUI_LIST_ANIM_CALLBACK },\r\n\t{ \"UI_LIST_ANIMATION_ITEM\",\t\t\tUI_LIST_ANIMATION_ITEM },\r\n\t{ \"UI_LIST_ANIMATION_ALL\",\t\t\tUI_LIST_ANIMATION_ALL },\r\n\r\n\t{ \"UI_LIST_ITEM_ANIM_SKIP\",\t\t\tUI_LIST_ITEM_ANIM_SKIP },\r\n\t{ \"UI_LIST_ALL_ANIM_SKIP\",\t\t\tUI_LIST_ALL_ANIM_SKIP },\r\n\r\n\t// スクロールバーを使用する\r\n\t{ \"UI_LIST_USE_SCROLLBAR\",\t\t\tUI_LIST_USE_SCROLLBAR },\r\n\t{ \"UI_LIST_SELECT_SCRMGR\",\t\t\tUI_LIST_SELECT_SCRMGR },\t// スクロールマネージャ選択\r\n\t{ \"UI_LIST_SCRMGR_CALLBACK\",\t\tUI_LIST_SCRMGR_CALLBACK },\t// スクロールマネージャコールバック指定\r\n\r\n\t// グループ指定\r\n\t{ \"UI_LIST_SET_GROUP\",\t\t\t\tUI_LIST_SET_GROUP },\r\n\r\n\t{ \"UI_LIST_SET_CLIP\",\t\t\t\tUI_LIST_SET_CLIP },\r\n\r\n\t{ \"UI_LIST_GET_ITEMCOUNT\",\t\t\tUI_LIST_GET_ITEMCOUNT },\r\n\t{ \"UI_LIST_GET_ITEMFORM\",\t\t\tUI_LIST_GET_ITEMFORM },\r\n\r\n\t{ \"UI_LIST_SET_DRAGMINDISTANCE\",\tUI_LIST_SET_DRAGMINDISTANCE },\r\n\r\n\t{ \"LIST_VIEW_TOP\",\t\t\t\t\tLIST_VIEW_TOP },\r\n\t{ \"LIST_VIEW_CENTER\",\t\t\t\tLIST_VIEW_CENTER },\r\n\t{ \"LIST_VIEW_END\",\t\t\t\t\tLIST_VIEW_END },\r\n\t{ \"LIST_VIEW_OFFSET\",\t\t\t\tLIST_VIEW_OFFSET },\r\n\r\n\t{ \"LIST_SCROVER_TOP\",\t\t\t\tLIST_SCROVER_TOP },\r\n\t{ \"LIST_SCROVER_BOTTOM\",\t\t\tLIST_SCROVER_BOTTOM },\r\n\t{ \"LIST_SCROVER_TAKEOFF\",\t\t\tLIST_SCROVER_TAKEOFF },\r\n\r\n\t{ \"LIST_FLAG_BOTTOM\",\t\t\t\tCKLBUIList::LIST_FLAG_BOTTOM },\r\n\t{ \"LIST_FLAG_MODAL\",\t\t\t\tCKLBUIList::LIST_FLAG_MODAL },\r\n\r\n\t{ \"LIST_ITEM_NORMAL\",\t\t\t\tCKLBUIList::LIST_ITEM_NORMAL },\r\n\t{ \"LIST_ITEM_DYNAMIC\",\t\t\t\tCKLBUIList::LIST_ITEM_DYNAMIC },\r\n\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIList> factory(\"UI_List\", CLS_KLBUILIST, cmd);\r\n\r\nCKLBLuaPropTask::PROP_V2 CKLBUIList::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"width\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIList::setWidth,\t\t\t(getBoolT)&CKLBUIList::getWidth,\t\t\t0\t},\r\n\t{\t\"height\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIList::setHeight,\t\t\t(getBoolT)&CKLBUIList::getHeight,\t\t\t0\t},\r\n\t{\t\"stepX\",\t\t\tINTEGER,\t(setBoolT)&CKLBUIList::setStepX,\t\t\t(getBoolT)&CKLBUIList::getStepX,\t\t\t0\t},\r\n\t{\t\"stepY\",\t\t\tINTEGER,\t(setBoolT)&CKLBUIList::setStepY,\t\t\t(getBoolT)&CKLBUIList::getStepY,\t\t\t0\t},\r\n\t{\t\"order\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIList::setOrder,\t\t\t(getBoolT)&CKLBUIList::getOrder,\t\t\t0\t},\r\n\t{\t\"maxodr\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIList::setMaxOrder,\t\t\t(getBoolT)&CKLBUIList::getMaxOrder,\t\t\t0\t},\r\n\t{\t\"vertical\",\t\t\tBOOLEANT,\t(setBoolT)&CKLBUIList::setVertical,\t\t\t(getBoolT)&CKLBUIList::getVertical,\t\t\t0\t},\r\n\t{\t\"items\",\t\t\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIList::getItems,\t\t\t0\t},\r\n\t{\t\"margin_top\",\t\tINTEGER,\t(setBoolT)&CKLBUIList::setMarginTop,\t\t(getBoolT)&CKLBUIList::getMarginTop,\t\t0\t},\r\n\t{\t\"margin_bottom\",\tINTEGER,\t(setBoolT)&CKLBUIList::setMarginBottom,\t\t(getBoolT)&CKLBUIList::getMarginBottom,\t\t0\t},\r\n\t{\t\"default_scroll\",\tBOOLEANT,\t(setBoolT)&CKLBUIList::setDefaultScroll,\t(getBoolT)&CKLBUIList::getDefaultScroll,\t0\t}\r\n\t// TODO : getTop, getBottom -> Added lately and was forgot in spec. (setMargin command)\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_MAXODR,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\r\n\tARG_STEP,\r\n\tARG_VERTICAL,\r\n\r\n\tARG_DRAGCALLBACK,\r\n\tARG_OPTIONFLAGS,\r\n\r\n\tARG_REQUIRE = ARG_STEP,\r\n\tARG_NUMS    = ARG_OPTIONFLAGS\r\n};\r\n\r\nCKLBListDrag::CKLBListDrag(CKLBUIList * parent, const char * funcname)\r\n: CKLBDragCallbackIF(funcname)\r\n, m_pParent         (parent) \r\n{\r\n}\r\n\r\nCKLBListDrag::~CKLBListDrag() \r\n{\r\n}\r\n\r\nvoid\r\nCKLBListDrag::callback(PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y)\r\n{\r\n\tm_pParent->m_scrBar.setCtrlStatus((type != PAD_ITEM::RELEASE) || (type != PAD_ITEM::CANCEL));\r\n\texecCallback((void *)m_pParent, type, tap_x, tap_y, mv_x, mv_y); \r\n}\r\n\r\n\r\n\r\nCKLBUIList::CKLBUIList()\r\n: CKLBUITask            (CKLBTask::P_UIAFTER)\r\n, m_clipHandle          (NULL)\r\n, m_listLength          (0)\r\n, m_modalStack          (false)\r\n, m_layoutTable         (NULL)\r\n, m_layoutTableXY       (NULL)\r\n, m_layoutTableScale    (NULL)\r\n, m_layoutTableRotation (NULL)\r\n, m_layoutTableAlpha    (NULL)\r\n, m_layoutTableRGB      (NULL)\r\n, m_layoutTablePriority (NULL)\r\n, m_layoutTableLayout   (NULL)\r\n, m_curveLength         (0)\r\n, m_layoutInterlaceSize (0)\r\n, m_dragCallback        (NULL)\r\n, m_limitCallback       (NULL)\r\n, m_dynamicCallback     (NULL)\r\n, m_limitCalled         (false)\r\n, m_limitAreaSize       (0)\r\n, m_pCtrlNode           (NULL)\r\n, m_pGroupName          (NULL)\r\n, m_defaultPrePos       (-1)\r\n, m_bTaped              (false)\r\n, m_bLoop               (false)\r\n, m_itemMode            (LIST_ITEM_NORMAL)\r\n, m_scrOffset           (0)\r\n, m_leftDrag            (0)\r\n, m_rightDrag           (0)\r\n, m_topDrag             (0)\r\n, m_bottomDrag          (0)\r\n, m_dragDistance        (0)\r\n{\r\n\tm_scrBar = this;\r\n\tm_formIF = this;\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIList::~CKLBUIList() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIList::getClassID()\r\n{\r\n\treturn CLS_KLBUILIST;\r\n}\r\n\r\n\r\nCKLBUIList *\r\nCKLBUIList::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                   u32 base_order, u32 max_order,\r\n                   float x, float y, float clip_width, float clip_height,\r\n                   int default_line_step, bool vertical,\r\n                   const char * callback, u32 optional_flags)\r\n{\r\n\tCKLBUIList * pTask = KLBNEW(CKLBUIList);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, base_order, max_order, \r\n\t\t\t\t\tx, y, clip_width, clip_height, default_line_step,\r\n\t\t\t\t\tvertical, callback, optional_flags)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIList::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t u32 base_order, u32 max_order,\r\n\t\t\t\t float x, float y, float clip_width, float clip_height,\r\n\t\t\t\t int default_line_step, bool vertical,\r\n\t\t\t\t const char * callback, u32 optional_flags)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(base_order, max_order,\r\n\t\t\t\t\t\t\tx, y, clip_width, clip_height,\r\n\t\t\t\t\t\t\tdefault_line_step, vertical, callback, optional_flags);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIList::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tu32 base_order\t\t\t= lua.getInt(ARG_ORDER);\r\n\tu32 max_order\t\t\t= lua.getInt(ARG_MAXODR);\r\n\r\n\tfloat x\t\t\t\t\t= lua.getFloat(ARG_X);\r\n\tfloat y \t\t\t\t= lua.getFloat(ARG_Y);\r\n\tfloat clip_width\t\t= lua.getFloat(ARG_WIDTH);\r\n\tfloat clip_height\t\t= lua.getFloat(ARG_HEIGHT);\r\n\tint\tdefault_line_step\t= lua.getInt(ARG_STEP);\r\n\tbool vertical\t\t\t= (argc >= ARG_VERTICAL) ? lua.getBool(ARG_VERTICAL) : true;\r\n\tconst char * callback\t= (argc >= ARG_DRAGCALLBACK) ? ((lua.isString(ARG_DRAGCALLBACK)) ? lua.getString(ARG_DRAGCALLBACK): NULL) : NULL;\r\n\tu32 optional_flags\t\t= (argc >= ARG_OPTIONFLAGS) ? lua.getInt(ARG_OPTIONFLAGS) : 0;\r\n\r\n\treturn initCore(base_order, max_order, x, y, clip_width, clip_height, default_line_step, vertical, callback, optional_flags);\r\n}\r\n\r\nbool\r\nCKLBUIList::initCore(u32 base_order, u32 max_order,\r\n                     float x, float y, float clip_width, float clip_height,\r\n                     int default_line_step, bool vertical,\r\n                     const char * callback, u32 optional_flags)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tklb_assert((((s32)base_order) >= 0), \"Order Problem\");\r\n\tklb_assert((((s32)max_order ) >= 0), \"Order Problem\");\r\n\r\n\tm_basePriority\t= base_order;\r\n\tm_endPriority\t= max_order;\r\n\t\r\n\tm_clipX\t\t\t= x;\r\n\tm_clipY\t\t\t= y;\r\n\tm_clipWidth\t\t= (int)clip_width;\r\n\tm_clipHeight\t= (int)clip_height;\r\n\r\n\tm_leftDrag\t\t= 0;\r\n\tm_rightDrag\t\t= m_clipWidth;\r\n\tm_topDrag\t\t= 0;\r\n\tm_bottomDrag\t= m_clipHeight;\r\n\r\n\tm_vertical\t\t= vertical;\r\n\tm_chklimit\t\t= true;\r\n\tm_touchenable\t= true;\r\n\tm_bModalEnable\t= true;\r\n\r\n\tif(callback) { m_dragCallback = KLBNEWC(CKLBListDrag, (this, callback)); }\r\n\r\n\tm_flags         = optional_flags;\r\n\r\n\tm_itemCnt\t\t= 0;\r\n\r\n\tif(m_vertical) {\r\n\t\tm_stepX = 0;\r\n\t\tm_stepY = default_line_step;\r\n\t} else {\r\n\t\tm_stepX = default_line_step;\r\n\t\tm_stepY = 0;\r\n\t}\r\n\r\n\tsetInitPos(m_clipX, m_clipY);\r\n\tm_width\t\t\t= m_clipWidth;\r\n\tm_height\t\t= m_clipHeight;\r\n\tm_marginTop\t\t= 0;\r\n\tm_marginBottom\t= 0;\r\n\tm_defScroll\t\t= false;\r\n\r\n\t// リストアイテムをぶら下げるノードを作る。\r\n\tm_pCtrlNode = KLBNEW(CKLBNode);\r\n\tgetNode()->addNode(m_pCtrlNode);\r\n\r\n\tm_ctrlX = m_ctrlY = 0;\r\n\tif(m_flags & LIST_FLAG_BOTTOM) {\r\n\t\tif(!m_vertical) {\r\n\t\t\tm_ctrlY = m_clipHeight;\r\n\t\t} else {\r\n\t\t\tm_ctrlX = m_clipWidth;\r\n\t\t}\r\n\t}\r\n\tm_scrollPos\t\t= (m_vertical) ? m_ctrlY : m_ctrlX;\r\n\tm_enableEvents\t= true;\r\n\tm_force\t\t\t= true;\r\n\r\n\tm_clipSize  = (m_vertical) ? m_clipHeight : m_clipWidth;\r\n\r\n\tm_pCtrlNode->setTranslate(m_ctrlX, m_ctrlY);\r\n\t\r\n\tm_lstBegin\t= m_lstEnd\t= NULL;\r\n\tm_killBegin = m_killEnd = NULL;\r\n\r\n\tbool bResult = setClip(m_basePriority, m_endPriority, 0, 0, (s16)m_width, (s16)m_height);\r\n\r\n\tif(!bResult) {\r\n\t\tconst char * msg = \"Overlapping clipping range or Reached max UI clipping stack.\";\r\n\t\tCKLBScriptEnv::getInstance().error(msg);\r\n\t\tklb_assertAlways(msg);\r\n\t}\r\n\r\n\tm_dragID = -1;\r\n\tm_dragX  = 0;\r\n\tm_dragY  = 0;\r\n\r\n\tbool modal = (m_flags & LIST_FLAG_MODAL) ? true : false;\r\n\tm_modalStack.setModal(modal);\r\n\tm_modalStack.push();\r\n\r\n\t// スクロールバーの準備\r\n\tm_scrBar.setScrollMgr(IMgrEntry::getMgr(\"default\", 0));\r\n\t//useScrollBar(lua, max_order, true, 25, \"\", 25, 0, 0x80ffffff, 0xffffffff, true);\r\n\tm_scrBar.setVisible(false);\r\n\r\n\tm_itemUpdate = false;\r\n\tm_posUpdate  = false;\r\n\r\n\tREFRESH_A;\r\n\tREFRESH_B;\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIList::setItemMode(int mode, const char * dynamicCallback)\r\n{\r\n\tbool bResult = false;\r\n\r\n\t// 既にアイテムが登録されており、異なるモードが設定されたらassertionで落とす\r\n\tklb_assert(!m_lstBegin && !m_lstEnd, \"The list items are already registered. \");\r\n\r\n\tm_itemMode = mode;\t// アイテム保持モードを設定する\r\n\r\n\tKLBDELETEA(m_dynamicCallback);\r\n\tm_dynamicCallback = NULL;\r\n\r\n\tswitch(mode)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\t// 未知の値。特に何もしない。\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LIST_ITEM_NORMAL:\r\n\t\t{\r\n\t\t\t// デフォルトの動作モード。\r\n\t\t\tbResult = true;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LIST_ITEM_DYNAMIC:\r\n\t\t{\r\n\t\t\t// アイテムを通常は JSON 文字列で保持しておき、画面に出る時のみtree化する。\r\n\t\t\tm_dynamicCallback = CKLBUtility::copyString(dynamicCallback);\r\n\t\t\tbResult = true;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LIST_ITEM_FLYWEIGHT:\r\n\t\t{\r\n\t\t\t// アイテムを一定数以上保持しない。既定の個数を超えたら\r\n\t\t\tbResult = true;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdItemAdd(CLuaState& lua, int argc)\r\n{\r\n\tbool bResult = false;\r\n\tif(argc >= 3 && argc <= 5) {\r\n\t\tint step = (m_vertical) ? m_stepY : m_stepX;\r\n\t\tif(argc >= 4) step = lua.getInt(4);\r\n\t\tint id = (argc >= 5) ? lua.getInt(5) : -1;\r\n\t\tbResult = itemInsertUniversal(0, step, lua, 3, id);\t// 最後に追加するのでNULLを指定\r\n\t}\r\n\tlua.retBoolean(bResult);\r\n\treturn 1;\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemAdd(const char* assetName)\r\n{\r\n\tint step = (m_vertical) ? m_stepY : m_stepX;\r\n\treturn itemAddInsert(NULL, assetName, step, -1);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemAdd(const char* assetName, int step, int id)\r\n{\r\n\treturn itemAddInsert(NULL, assetName, step, id);\r\n}\r\n\r\nbool\r\nCKLBUIList::itemAddInsert(LISTITEM * posItem, const char* assetName, int step, int id) \r\n{\r\n\tif(!assetName) { return false; }\r\n\r\n\tu32 size;\r\n\tconst char* json = toJSON(assetName, size);\r\n\r\n\titemInsert(posItem, step, json, size, id);\r\n\tKLBDELETEA(json);\r\n\r\n\treturn true;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdItemInsert(CLuaState& lua, int argc)\r\n{\r\n\tbool bResult = false;\r\n\tif(argc >= 4 && argc <= 5) {\r\n\t\tint idx = lua.getInt(4);\r\n\t\tint id = (argc >= 5) ? lua.getInt(5) : -1;\r\n\t\tint step = (m_vertical) ? m_stepY : m_stepX;\r\n\t\tLISTITEM * posItem = getItemByIndex(idx);\r\n\t\t// Safe against NULL posItem\r\n\t\tbResult = itemInsertUniversal(posItem, step, lua, 3, id);\r\n\t}\r\n\tlua.retBoolean(bResult);\r\n\t\r\n\treturn 1;\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemInsert(const char* assetName, int idx)\r\n{\r\n\tint step = (m_vertical) ? m_stepY : m_stepX;\r\n\r\n\tLISTITEM * posItem = getItemByIndex(idx);\r\n\treturn itemAddInsert(posItem, assetName, step, -1);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemInsert(const char* assetName, int idx, int step, int id)\r\n{\r\n\tLISTITEM * posItem = getItemByIndex(idx);\r\n\treturn itemAddInsert(posItem, assetName, step, id);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemRemove(int idx)\r\n{\r\n\tLISTITEM * posItem = getItemByIndex(idx);\r\n\tif (posItem) { itemDelete(posItem); }\r\n\treturn ((posItem) != NULL);\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdItemMove(int src, int dst)\r\n{\r\n\tif(src != dst) {\r\n\t\tLISTITEM * posItem = getItemByIndex(src);\r\n\r\n\t\t// 挿入先indexのアイテムを取得し、その位置に挿入する\r\n\t\tLISTITEM * dstItem = getItemByIndex(dst);\r\n\r\n\t\tif (posItem && dstItem) {\r\n\t\t\t// 一回アイテムを抜き取る\r\n\t\t\tif(posItem->prev) {\r\n\t\t\t\tposItem->prev->next = posItem->next;\r\n\t\t\t} else {\r\n\t\t\t\tm_lstBegin = posItem->next;\r\n\t\t\t}\r\n\t\t\tif(posItem->next) {\r\n\t\t\t\tposItem->next->prev = posItem->prev;\r\n\t\t\t} else {\r\n\t\t\t\tm_lstEnd = posItem->prev;\r\n\t\t\t}\r\n\r\n\t\t\tposItem->next = dstItem;\r\n\t\t\tif(dstItem) {\r\n\t\t\t\tposItem->prev = dstItem->prev;\r\n\t\t\t\tposItem->next = dstItem;\r\n\t\t\t\tdstItem->prev = posItem;\r\n\t\t\t} else {\r\n\t\t\t\tposItem->prev = m_lstEnd;\r\n\t\t\t\tposItem->next = NULL;\r\n\t\t\t\tm_lstEnd = posItem;\r\n\t\t\t}\r\n\t\t\tif(posItem->prev) {\r\n\t\t\t\tposItem->prev->next = posItem;\r\n\t\t\t} else {\r\n\t\t\t\tm_lstBegin = posItem;\r\n\t\t\t}\r\n\t\t\tm_posUpdate = true;\r\n\t\t\tm_itemUpdate = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nint\r\nCKLBUIList::cmdItemRemoveSelection(CLuaState& lua, int argc)\r\n{\r\n\tbool result = true;\r\n\tif(argc != 3) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\t// pass-1: 現在のアイテム数をカウントする\r\n\tint count = 0;\r\n\tLISTITEM * posItem = m_lstBegin;\r\n\twhile(posItem) {\r\n\t\tcount++;\r\n\t\tposItem = posItem->next;\r\n\t}\r\n\tif(!count) {\r\n\t\t// アイテムが無い場合は何もしない\r\n\t\tlua.retBoolean(result);\r\n\t\treturn 1;\r\n\t}\r\n\t// pass-2: 現在のアイテムポインタの配列を作り、各ポインタを格納する。\r\n\tLISTITEM ** arrItem = KLBNEWA(LISTITEM *, count);\r\n\tif(!arrItem) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tposItem = m_lstBegin;\r\n\tint index = 0;\r\n\twhile(posItem) {\r\n\t\tarrItem[index] = posItem;\r\n\t\tindex++;\r\n\t\tposItem = posItem->next;\r\n\t}\r\n\r\n\t// pass-3: lua配列で指定されたindexに該当するアイテムを破棄する。\r\n\tlua.retValue(3);\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tindex = lua.getInt(-1);\t// index を取得\r\n\t\tif(index >= 0 && index < count) {\r\n\t\t\tposItem = arrItem[index];\r\n\t\t\tif(posItem) itemDelete(posItem);\r\n\t\t\tarrItem[index] = 0;\r\n\t\t} else {\r\n\t\t\tresult = false;\t// 存在しないindexが指定されている。\r\n\t\t}\r\n\t\tlua.pop(1);\r\n\t}\r\n\tlua.pop(1);\r\n\r\n\t// ポインタ配列として確保したバッファを破棄する\r\n\tKLBDELETEA(arrItem);\r\n\r\n\tlua.retBoolean(result);\r\n\treturn 1;\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemRemoveSelection(int* idxList, u32 nbItems)\r\n{\r\n\tbool result = true;\r\n\tLISTITEM ** arrItem = KLBNEWA(LISTITEM *, m_itemCnt);\r\n\tif(!arrItem) {\r\n\t\treturn false;\r\n\t}\r\n\tLISTITEM * posItem = m_lstBegin;\r\n\tint index = 0;\r\n\twhile(posItem) {\r\n\t\tarrItem[index] = posItem;\r\n\t\tindex++;\r\n\t\tposItem = posItem->next;\r\n\t}\r\n\r\n\tfor(u32 i = 0; i < nbItems; ++i) {\r\n\t\tif(idxList[i] && idxList[i] < m_itemCnt) {\r\n\t\t\tposItem = arrItem[idxList[i]];\r\n\t\t\tif(posItem) { itemDelete(posItem); }\r\n\t\t\tarrItem[idxList[i]] = 0;\r\n\t\t} else {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t}\r\n\r\n\tKLBDELETEA(arrItem);\r\n\r\n\treturn result;\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdFWModeConfig(int itemStep, int maxItems)\r\n{\r\n\tm_flyweight.itemstep = itemStep;\t// アイテム一個あたりが占有する幅\r\n\tm_flyweight.maxitems = maxItems;\t// 保持し続けるアイテムの最大数\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdFWItemAdd()\r\n{\r\n\t// TODO\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdFWItemInsert()\r\n{\r\n\t// TODO\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdSetMargin(int top, int bottom)\r\n{\r\n\tsetMarginTop(top);\r\n\tsetMarginBottom(bottom);\r\n\r\n\t// スクロールバー経由でスクロールマネージャにも通知する\r\n\tm_scrBar.setMargin(top, bottom);\r\n\r\n\tm_itemUpdate = true;\t// 配置が変更される。\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdSetItemMode(int mode, const char* dynamicCallback)\r\n{\r\n\tbool bResult = false;\r\n\r\n\tif(mode != LIST_ITEM_DYNAMIC) { dynamicCallback = NULL; }\r\n\tbResult = setItemMode(mode, dynamicCallback);\r\n\r\n\treturn bResult;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIList::cmdAddRecords(int insIdx, const char* tpform, u32 sizeTemplate, const char* dbrecs, u32 sizeDBRec, int step)\r\n{\r\n\tu32 handle          = 0;\r\n\tLISTITEM * posItem  = getItemByIndex(insIdx);\r\n\tint itemPos         = posItem ? posItem->pos : 0;\r\n\t \r\n\t// pNode と handle を作る\r\n\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\tCKLBCompositeAsset * pAsset = (CKLBCompositeAsset *)CKLBUtility::readAsset((u8 *)tpform, sizeTemplate, &handle, pAssetManager.getPlugin('P'));\r\n\tif(!pAsset) {\r\n\t\treturn false;\r\n\t}\r\n\tif(!step) { step = (m_vertical) ? pAsset->get_height() : pAsset->get_width(); }\r\n\r\n\tIDataSource * pSource = JSonDB::openDB((const u8 *)dbrecs, sizeDBRec);\r\n\tpSource->moveTo(0);\t// 先頭にジャンプ\r\n\r\n\tbool bResult = true;\r\n\tint addLen = 0;\r\n\tdo {\r\n\t\taddLen += step;\r\n\t\tbResult = bResult && itemInsert(posItem, step, tpform, sizeTemplate,-1, pAsset, pSource);\r\n\t} while (pSource->moveNext() != MOVE_EOF);\r\n\r\n\tKLBDELETE(pSource);\r\n\tif(-m_scrollPos >= itemPos) {\r\n\t\tm_scrollPos -= addLen;\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdSetPosition(int pos, int dir)\r\n{\r\n\tint retPos = setPosition(pos);\t// その値に「なったとき」の位置を取得\r\n\r\n\t// 実際の表示はスクロールバーのスクロールマネージャ経由\r\n\tm_scrBar.setPosition(pos, dir);\r\n\tpos = m_scrBar.getPosition();\r\n\tsetPosition(pos);\r\n\treturn retPos;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdSetInitial(int pos)\r\n{\r\n\tm_itemUpdate = true;\r\n\titemRealloc();\t// アイテム配置を行う(リストの長さを求める)\r\n\t\r\n\tint retPos = setPosition(pos);\t// その値に「なったとき」の位置を取得\r\n\r\n\t// 実際の表示はスクロールバーのスクロールマネージャ経由\r\n\tm_scrBar.setInitial(pos);\r\n\tpos = m_scrBar.getPosition();\r\n\tsetPosition(pos);\r\n\r\n\treturn retPos;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdGetPosition()\r\n{\r\n\treturn -m_scrollPos;\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdSetItemID(int index, int id)\r\n{\r\n\tLISTITEM * posItem = getItemByIndex(index);\r\n\tif (posItem) {\r\n\t\tset_item_id(posItem, id);\r\n\t}\r\n}\r\n\r\nint\r\nCKLBUIList::cmdSearchID(int id)\r\n{\r\n\treturn get_item_index_by_id(id);\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdSetItemPos(int mode, int idx, int offset)\r\n{\r\n    if(idx < 0)         { idx = 0;         }\r\n\tif(idx > m_itemCnt) { idx = m_itemCnt; }\r\n\r\n\t// まだ位置が確定していないアイテムが存在する可能性があるため、\r\n\t// 位置を確定させる。\r\n\titemRealloc();\r\n\r\n\tLISTITEM * posItem = getItemByIndex(idx);\r\n\r\n\tif (posItem) {\r\n\t\tint pos     = posItem->pos;\r\n\t\tint step    = posItem->step;\r\n\t\tint mergin  = m_clipSize;\r\n\r\n\t\tswitch(mode) {\r\n\t\tcase LIST_VIEW_TOP:\t\tbreak;\r\n\t\tcase LIST_VIEW_CENTER:\tpos = pos - (mergin - step) / 2;    break;\r\n\t\tcase LIST_VIEW_END:\t\tpos = pos - (mergin - step);        break;\r\n\t\tcase LIST_VIEW_OFFSET:\tpos = pos - offset;                 break;\r\n\t\t}\r\n\r\n\t\t//itemRealloc();\r\n\t\tsetPosition(pos);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdChangeStep(int idx, int step)\r\n{\r\n    if(idx < 0)         { idx = 0;         }\r\n\tif(idx > m_itemCnt) { idx = m_itemCnt; }\r\n\r\n\tLISTITEM * posItem = getItemByIndex(idx);\r\n\tif (posItem) {\r\n\t\t// step 値を再設定\r\n\t\tposItem->step = step;\r\n\t\tm_itemUpdate = true;\r\n\t\t// itemRealloc();\t// 再設定したSTEP値で位置を再計算\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdSetLimitClip(bool chklimit, const char* limitCallback)\r\n{\r\n\tm_chklimit = chklimit;\r\n\tm_scrBar.setOverScroll(m_bLoop || !m_chklimit);\r\n\tif(limitCallback) { setStrC(m_limitCallback, limitCallback); }\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdSetLimitArea(int limitArea)\r\n{\r\n\tif(limitArea >= 0) {\r\n\t\tm_limitAreaSize = limitArea;\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdGetLimit()\r\n{\r\n\tif(m_itemUpdate) { \r\n\t\titemRealloc(); \r\n\t}\r\n\treturn m_listLength - ((m_vertical) ? m_clipHeight : m_clipWidth);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdExistNode(int index, const char* name)\r\n{\r\n\tif(m_itemMode == LIST_ITEM_DYNAMIC) { CKLBScriptEnv::getInstance().error(\"[UI_List] could not update node on DYNAMIC item mode.\"); }\r\n\tLISTITEM * posItem = getItemByIndex(index);\r\n\tif (posItem) {\r\n\t\tCKLBNode * pParent = posItem->form;\r\n\t\treturn m_formIF.isExistNode(pParent, name);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nint\r\nCKLBUIList::cmdUpdateNode(CLuaState& lua, int argc)\r\n{\r\n\tif(argc < 5) {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint index = lua.getInt(3);\r\n\t// const char * name = lua.getString(4);\r\n\tint subcmd = lua.getInt(5);\r\n\tLISTITEM * posItem = getItemByIndex(index);\r\n\tif (posItem) {\r\n\t\tif(m_itemMode == LIST_ITEM_DYNAMIC && !posItem->form) {\r\n\t\t\tCKLBScriptEnv::getInstance().error(\"[UI_List] could not update node on DYNAMIC item mode.\");\r\n\t\t}\r\n\t\tCKLBNode * pParent = posItem->form;\r\n\t\treturn m_formIF.updateNode(lua, argc, 5, pParent, 4, subcmd, posItem, index);\r\n\t} else {\r\n\t\tlua.retBoolean(false);\r\n\t\treturn 1;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdInputEnable(bool bEnable)\r\n{\r\n\tm_touchenable = bEnable;\r\n\tupdateEnable();\r\n\t// DEBUG_PRINT(\"InputEnable: %p = %s\", this, (bEnable) ? \"true\" : \"false\");\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdAnimCallback(const char* callback)\r\n{\r\n\tm_animpack.setCallback(callback);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdAnimationItem(int idx, const char* name, bool blend)\r\n{\r\n\t// idx の値から、アイテムのnodeを取得する\r\n\tLISTITEM * item = getItemByIndex(idx);\r\n\tif (item) {\r\n\t\treturn m_animpack.kickAnim(item->form, name, blend, idx);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdAnimationAll(const char* name, bool blend)\r\n{\r\n\treturn m_animpack.kickAnim(getNode(), name, blend, -1);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdItemAnimSkip(int index, const char* name)\r\n{\r\n\t// idx の値から、アイテムのnodeを取得する\r\n\tLISTITEM * item = getItemByIndex(index);\r\n\tif (item) {\r\n\t\treturn m_animpack.skipAnim(item->form, name);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdAllAnimSkip(const char* name)\r\n{\r\n\treturn m_animpack.skipAnim(getNode(), name);\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdSelectScrMgr(const char* name, int* params, int nb)\r\n{\r\n\tCKLBScrollMgr * pMgr = IMgrEntry::getMgrByArray(name, nb, params); \r\n    if(pMgr) { m_scrBar.setScrollMgr(pMgr); }\r\n\r\n\tm_scrBar.setInitial(-m_scrollPos);\r\n\tint pos = m_scrBar.getPosition();\r\n\tsetPosition(pos);\r\n\treturn (pMgr != NULL) ? true : false;\r\n}\r\n\r\nbool\r\nCKLBUIList::cmdScrMgrCallback(const char* callback)\r\n{\r\n\treturn m_scrBar.setScrMgrCallback(this, callback);\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdSetGroup(const char* group_name)\r\n{\t\r\n\tsetStrC(m_pGroupName, group_name);\r\n\r\n\tif(m_pGroupName) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\t// 既存のアイテムをすべてそのグループに所属させる\r\n\t\tLISTITEM * pItem = m_lstBegin;\r\n\t\twhile(pItem) {\r\n\t\t\tfGrp.addForm(&(pItem->ctrl), m_pGroupName);\r\n\t\t\tpItem = pItem->next;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIList::cmdSetClip(u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight) \r\n{\r\n\tresetClip(orderBegin, orderEnd, clipX, clipY, clipWidth, clipHeight, false);\r\n}\r\n\r\nint\r\nCKLBUIList::cmdGetItemCount(CLuaState& lua, int /*argc*/) \r\n{\r\n\tlua.retInt(m_itemCnt);\r\n\treturn 1;\r\n}\r\n\r\nint\r\nCKLBUIList::cmdGetItemForm(CLuaState& lua, int argc) \r\n{\r\n\tvoid* ptr = NULL;\r\n\r\n\tif(argc == 3) {\r\n\t\tint idx = lua.getInt(3);\r\n\t\tif((idx >= 0) && (idx < m_itemCnt)) {\r\n\t\t\tLISTITEM * pItem = NULL;\r\n\t\t\tCKLBNode* pNode = NULL;\r\n\r\n\t\t\tswitch(m_itemMode)\r\n\t\t\t{\r\n\t\t\tcase LIST_ITEM_NORMAL:\r\n\t\t\tcase LIST_ITEM_DYNAMIC:\r\n\t\t\t\t{\r\n\t\t\t\t\t// Same logic for both.\r\n\t\t\t\t\t// int item_index = 0;\r\n\t\t\t\t\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\t\t\t\t\tif (pItem->index == idx) { pNode = pItem->form; break; }\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (pNode) {\r\n\t\t\t\t\t\tCKLBUITask* pTask = pNode->getUITask();\r\n\t\t\t\t\t\tif (pTask->getClassID() == CLS_KLBUIFORM) {\r\n\t\t\t\t\t\t\tptr = pTask;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tif(ptr) {\r\n\t\t\t\tlua.retPointer(ptr);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlua.retNil();\r\n\t} else {\r\n\t\tlua.retBool(false);\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nint \r\nCKLBUIList::cmdSetDragRect(CLuaState& lua, int argc) \r\n{\r\n\tif(argc == 6) {\r\n\t\tsetDragRect(lua.getInt(3),lua.getInt(4),lua.getInt(5),lua.getInt(6));\r\n\t} else {\r\n\t\tlua.retBool(false);\r\n\t}\r\n\treturn 1;\r\n}\r\n\r\nvoid \r\nCKLBUIList::setDragRect(s32 left, s32 top, s32 right, s32 bottom) {\r\n\tm_leftDrag   = left;\r\n\tm_rightDrag  = right;\r\n\tm_topDrag    = top;\r\n\tm_bottomDrag = bottom;\r\n}\r\n\r\n// 物理位置を設定するだけの関数\r\nint\r\nCKLBUIList::setPosition(int pos)\r\n{\r\n\tif(m_chklimit && !m_bLoop) {\r\n\t\tif(pos >= m_listLength - m_clipSize)    { pos = m_listLength - m_clipSize; }\r\n        if(pos < 0)                             { pos = 0;                         }\r\n\t}\r\n\r\n\tm_scrollPos = -pos;\r\n\r\n\t// itemRealloc();\r\n\tm_posUpdate = true;\r\n\treturn -m_scrollPos;\r\n}\r\n\r\nbool\r\nCKLBUIList::useScrollBar(u32 order, bool side, int lineWeight,\r\n\t\t\t\t\t\tconst char * image, int min_slider_size, const char * callback,\r\n\t\t\t\t\t\tu32 colorNormal, u32 colorSelect, bool active, bool hide_mode, bool short_hide)\r\n{\r\n\tint x       = 0;\r\n\tint y       = 0;\r\n\tint width   = m_clipWidth;\r\n\tint height  = m_clipHeight;\r\n\tint pos     = 0;\r\n\tif(m_vertical) {\r\n\t\tx       = (side) ? (m_clipWidth - lineWeight) : 0;\r\n\t\twidth   = lineWeight;\r\n\t} else {\r\n\t\ty       = (side) ? (m_clipHeight - lineWeight) : 0;\r\n\t\theight  = lineWeight;\r\n\t}\r\n\tpos = -m_scrollPos;\r\n\tint limit       = (int)(m_listLength - m_clipSize);\r\n\tint slider_size = m_clipSize * m_clipSize / limit;\r\n\t//CLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tbool bResult    = m_scrBar.init(getNode(),\r\n                                    order, (float)x, (float)y, (float)width, (float)height,\r\n                                    0, limit,\r\n                                    pos,\r\n                                    image,\r\n                                    slider_size, min_slider_size,\r\n                                    callback,\r\n                                    colorNormal, colorSelect, m_vertical, active, hide_mode);\r\n\tm_scrBar.setShortHide(short_hide);\r\n\tm_scrBar.setVisible(bResult);\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIList::useScrollBarByProperty(CKLBPropertyBag * pProp, u32 priorityOffset)\r\n{\r\n\tu32\t\t\t\torder\t\t\t= pProp->getPropertyInt(\"order\");\r\n\tbool\t\t\tside\t\t\t= pProp->getPropertyBool(\"side\");\r\n\tint\t\t\t\tlineWeight\t\t= pProp->getPropertyInt(\"line_weight\");\r\n\tconst char\t*\timage\t\t\t= pProp->getPropertyString(\"slider_image\");\r\n\tint\t\t\t\tmin_slider_size = pProp->getPropertyInt(\"min_slider_size\");\r\n\tconst char\t*\tcallback\t\t= (pProp->getIndex(\"callback\") >= 0) ? pProp->getPropertyString(\"callback\") : NULL;\r\n\tu32\t\t\t\tcolorNormal\t\t= pProp->getPropertyInt(\"normal_RGBA\");\r\n\tu32\t\t\t\tcolorSelect\t\t= pProp->getPropertyInt(\"select_RGBA\");\r\n\tbool\t\t\tactive\t\t\t= pProp->getPropertyBool(\"active\");\r\n\r\n\tbool\t\t\thide_mode\t\t= (pProp->getIndex(\"hide_mode\") >= 0) ? pProp->getPropertyBool(\"hide_mode\") : false;\r\n\tbool\t\t\tdefault_scroll\t= (pProp->getIndex(\"default_scroll\") >= 0) ? pProp->getPropertyBool(\"default_scroll\") : false;\r\n\r\n\tsetDefaultScroll(default_scroll);\r\n\r\n\tchar * path = KLBNEWA(char, strlen(image) + 9);\r\n\tstrcpy(path, \"asset://\");\r\n\tstrcat(path, image);\r\n\t\r\n\tbool bResult = useScrollBar(priorityOffset + order, side, lineWeight, path, min_slider_size, callback, colorNormal, colorSelect, active, hide_mode);\r\n\r\n\tKLBDELETEA(path);\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIList::selectScrollMgr(const char * manager_name, int argc, int * params)\r\n{\r\n\tCKLBScrollMgr * pMgr = IMgrEntry::getMgrByArray(manager_name, argc, params); \r\n    if(pMgr) { m_scrBar.setScrollMgr(pMgr); }\r\n\tKLBDELETE(params);\r\n\tbool bResult = (pMgr != 0) ? true : false;\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIList::selectScrollMgrByProperty(CKLBPropertyBag * pProp)\r\n{\r\n\tCKLBScrollMgr * pMgr = IMgrEntry::getMgrByProperty(pProp); \r\n\tif(pMgr) m_scrBar.setScrollMgr(pMgr);\r\n\tbool bResult = (pMgr != 0) ? true : false;\r\n\treturn bResult;\r\n}\r\n\r\nint\r\nCKLBUIList::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tbool result = false;\r\n\tint  ret    = 1;\t// Default.\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LIST_ITEM_ADD:\t\t\t\tret = cmdItemAdd(lua, argc);\t\t\tbreak;\r\n\tcase UI_LIST_ITEM_INSERT:\t\t\tret = cmdItemInsert(lua, argc);         break;\t\r\n\tcase UI_LIST_ITEM_REMOVE:\r\n\t\tif(argc == 3) {\r\n\t\t\tint idx = lua.getInt(3);\r\n\t\t\tresult = cmdItemRemove(idx);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ITEM_MOVE:\r\n\t\tif(argc == 4) {\r\n\t\t\tint src = lua.getInt(3);\r\n\t\t\tint dst = lua.getInt(4);\r\n\t\t\tcmdItemMove(src,dst);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ITEM_REMOVE_SELECTION: ret = cmdItemRemoveSelection(lua, argc);    break;\r\n\tcase UI_LIST_SET_ITEM_ID:\r\n\t\tif(argc == 4) {\r\n\t\t\tint index\t= lua.getInt(3);\r\n\t\t\tint id\t\t= lua.getInt(4);\r\n\t\t\tcmdSetItemID(index,id);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SEARCH_ID:\r\n\t\tif(argc == 3) {\r\n\t\t\tint id = lua.getInt(3);\r\n\t\t\tint idx = cmdSearchID(id);\r\n\t\t\tif(idx < 0) {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t} else {\r\n\t\t\t\tlua.retInt(idx);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlua.retNil();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LIST_FWMODE_CONFIG:\r\n\t\tif(argc == 4) {\r\n\t\t\tint itemStep = lua.getInt(3);\r\n\t\t\tint maxItems = lua.getInt(4);\r\n\t\t\tcmdFWModeConfig(itemStep, maxItems);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_FWITEM_ADD:\r\n\t\tret = 0;\r\n\t\tbreak;\r\n\tcase UI_LIST_FWITEM_INSERTTOP:\r\n\t\tret = 0;\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_MARGIN:\r\n\t\tif(argc == 4) {\r\n\t\t\tint top\t\t= lua.getInt(3);\r\n\t\t\tint bottom\t= lua.getInt(4);\r\n\t\t\tcmdSetMargin(top, bottom);\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_LOOPMODE:\r\n\t\tif (argc == 3) {\r\n\t\t\tbool bLoop = lua.getBool(3);\r\n\t\t\tsetLoop(bLoop);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_ITEMMODE: \r\n\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\tint mode = lua.getInt(3);\r\n\t\t\tconst char * dynamicCallback = (argc >= 4) ? lua.getString(4) : NULL;\r\n\t\t\tresult = cmdSetItemMode(mode, dynamicCallback);\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ADD_RECORDS:\r\n\t\tif(argc >= 5 && argc <= 6) {\r\n\t\t\tint insIdx = lua.getInt(3);\t\t\t\t// 挿入位置index\r\n\t\t\tu32 sizeTemplate;\r\n\t\t\tu32 sizeDBRec;\r\n\t\t\tconst char * tpform = toJSON(lua, 4, sizeTemplate);\t// テンプレートフォーム\r\n\t\t\tconst char * dbrecs = toJSON(lua, 5, sizeDBRec);\t// DBデータ群\r\n\t\t\tint step = (argc >= 6) ? lua.getInt(6) : 0;\r\n\t\r\n\t\t\tresult = cmdAddRecords(insIdx, tpform, sizeTemplate, dbrecs, sizeDBRec, step);\r\n\r\n\t\t\tKLBDELETEA(tpform);\r\n\t\t\tKLBDELETEA(dbrecs);\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_POSITION:\r\n\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\tint pos\t\t= lua.getInt(3);\r\n\t\t\tint dir\t\t= (argc >= 4) ? lua.getInt(4) : 0;\r\n\t\t\tint retPos\t= cmdSetPosition(pos, dir);\r\n\t\t\tlua.retInt(retPos);\r\n\t\t} else {\r\n\t\t\tlua.retBool(result);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_INITIAL:\r\n\t\tif(argc == 3) {\r\n\t\t\tint pos = lua.getInt(3);\r\n\t\t\tint retPos = cmdSetInitial(pos);\r\n\t\t\tlua.retInt(retPos);\r\n\t\t} else {\r\n\t\t\tlua.retBool(result);\r\n\t\t}\r\n\tcase UI_LIST_SET_DRAGRECT:\t\t\tret = cmdSetDragRect(lua, argc);\t\tbreak;\r\n\tcase UI_LIST_GET_POSITION:\r\n\t\tif(argc != 2) {\r\n\t\t\tlua.retBool(false);\r\n\t\t} else {\r\n\t\t\ts32 val = cmdGetPosition();\r\n\t\t\tlua.retInt(val);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_ITEM_POS:\r\n\t\tif(argc >= 4 && argc <= 5) {\r\n\t\t\tint mode    = lua.getInt(3);\r\n\t\t\tint idx     = lua.getInt(4);\r\n\t\t\tint offset  = (mode == LIST_VIEW_OFFSET) ? 0 : lua.getInt(5);\r\n\r\n\t\t\tif (!(mode != LIST_VIEW_OFFSET && argc == 5)) {\r\n\t\t\t\tcmdSetItemPos(mode, idx, offset);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_CHANGE_STEP:\r\n\t\tif(argc == 4) {\r\n\t\t\tint idx \t= lua.getInt(3);\r\n\t\t\tint step \t= lua.getInt(4);\r\n\t\t\tcmdChangeStep(idx, step);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_LIMITCLIP:\r\n\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\tbool chklimit = lua.getBool(3);\r\n\t\t\tconst char* limitCallback = NULL;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\t// 終端越えコールバックを設定\r\n\t\t\t\tif(lua.isString(4)) limitCallback = lua.getString(4);\r\n\t\t\t}\r\n\r\n\t\t\tcmdSetLimitClip(chklimit, limitCallback);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_LIMITAREA:\r\n\t\tif(argc == 3) {\r\n\t\t\tint limitArea = lua.getInt(3);\r\n\t\t\tresult = cmdSetLimitArea(limitArea);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_GET_LIMIT:\r\n\t\tif(argc != 2) {\r\n\t\t\tlua.retBoolean(false);\r\n\t\t} else {\r\n\t\t\tlua.retInt(cmdGetLimit());\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LIST_INPUT_ENABLE:\r\n\t\tif(argc == 3) {\r\n\t\t\tbool bEnable = lua.getBool(3);\r\n\t\t\tcmdInputEnable(bEnable);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_EXIST_NODE:\r\n\t\tif(argc == 4) {\r\n\t\t\tint index\t\t\t= lua.getInt(3);\r\n\t\t\tconst char * name\t= lua.getString(4);\r\n\t\t\t\r\n\t\t\tresult = cmdExistNode(index, name);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_UPDATE_NODE:\t\t\tret = cmdUpdateNode(lua, argc);\t\t\tbreak;\r\n\tcase UI_LIST_ANIM_CALLBACK:\r\n\t\tif(argc == 3) {\r\n\t\t\tconst char * callback = (lua.isNil(3)) ? NULL : lua.getString(3);\r\n\t\t\tcmdAnimCallback(callback);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ANIMATION_ITEM:\r\n\t\tif(argc >= 4 && argc <= 5) {\r\n\t\t\tint idx = lua.getInt(3);\r\n\t\t\tconst char * name = lua.getString(4);\r\n\t\t\tbool blend = (argc >= 5) ? lua.getBool(5) : false;\r\n\t\t\tresult = cmdAnimationItem(idx, name, blend);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ANIMATION_ALL:\r\n\t\tif (argc >= 3 && argc <= 4) {\r\n\t\t\tconst char * name = lua.getString(3);\r\n\t\t\tbool blend = (argc >= 4) ? lua.getBool(4) : false;\r\n\t\t\tresult = cmdAnimationAll(name, blend);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ITEM_ANIM_SKIP:\r\n\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\tint idx = lua.getInt(3);\r\n\t\t\tconst char * name = NULL;\r\n            if(argc >= 4 && !lua.isNil(4)) { name = lua.getString(4); }\r\n\t\t\tresult = cmdItemAnimSkip(idx, name);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_ALL_ANIM_SKIP:\r\n\t\tif(argc >= 2 && argc <= 3) {\r\n\t\t\tconst char * name = NULL;\r\n            if(argc >= 3 && !lua.isNil(3)) { name = lua.getString(3); }\r\n\t\t\tresult = cmdAllAnimSkip(name);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_DRAGMINDISTANCE:\r\n\t\tif(argc == 3) {\r\n\t\t\tint v = lua.getInt(3);\r\n\t\t\t// Return only positive value, else scroll would become impossible.\r\n\t\t\tm_dragDistance = (v < 0) ? 0 : v;\t\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_LIST_USE_SCROLLBAR:\r\n\t\tif(argc >= 13 && argc <= 15) {\r\n\t\t\tu32 order\t\t\t= lua.getInt(3);\r\n\t\t\tbool side\t\t\t= lua.getBoolean(4);\r\n\t\t\tint lineWeight\t\t= lua.getInt(5);\r\n\t\t\tconst char * image\t= lua.getString(6);\r\n\t\t\tint min_slider_size = lua.getInt(7);\r\n\t\t\tconst char * callback = (lua.isNil(8)) ? NULL : lua.getString(8);\r\n\t\t\tu32 alphaNormal\t\t= lua.getInt(9);\r\n\t\t\tu32 colorNormal\t\t= (lua.getInt(10) & 0xffffff) | (alphaNormal << 24);\r\n\t\t\tu32 alphaSelect\t\t= lua.getInt(11);\r\n\t\t\tu32 colorSelect\t\t= (lua.getInt(12) & 0xffffff) | (alphaSelect << 24);\r\n\t\t\tbool active\t\t\t= lua.getBool(13);\r\n\t\t\tbool hide_mode\t\t= (argc >= 14) ? lua.getBool(14) : false;\r\n\t\t\tbool short_hide\t\t= (argc >= 15) ? lua.getBool(15) : true;\r\n\r\n\t\t\t// リストに合わせてスクロールバーを呼び出す\r\n\t\t\tresult = useScrollBar(\torder, side, lineWeight,\r\n\t\t\t\t\t\t\t\t\timage, min_slider_size, callback,\r\n\t\t\t\t\t\t\t\t\tcolorNormal, colorSelect, active, hide_mode, short_hide);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SELECT_SCRMGR:\r\n\t\tif(argc >= 3) {\r\n\t\t\tconst char * name = lua.getString(3);\r\n\t\t\tint ac = argc - 3;\r\n\t\t\tint * params = NULL;\r\n\t\t\tif(ac > 0) {\r\n\t\t\t\tparams = KLBNEWA(int, ac);\r\n\t\t\t\tfor(int i = 0; i < ac; i++) {\r\n\t\t\t\t\tparams[i] = lua.getInt(4 + i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tcmdSelectScrMgr(name, params, ac);\r\n\r\n\t\t\tKLBDELETEA(params);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SCRMGR_CALLBACK:\r\n\t\tif(argc == 3) {\r\n\t\t\tconst char * callback = lua.getString(3);\r\n\t\t\tresult = cmdScrMgrCallback(callback);\r\n\t\t}\r\n\t\tlua.retBoolean(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_GROUP:\t\t\t\t\r\n\t\tif(argc == 3) {\r\n\t\t\tconst char * name = lua.getString(3);\r\n\t\t\tif(name) {\r\n\t\t\t\tcmdSetGroup(name);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_SET_CLIP:\r\n\t\tif(argc == 8) {\r\n\t\t\tu32 orderBegin\t= lua.getInt(3);\r\n\t\t\tu32 orderEnd\t= lua.getInt(4);\r\n\t\t\ts16 clipX\t\t= lua.getInt(5);\r\n\t\t\ts16 clipY\t\t= lua.getInt(6);\r\n\t\t\ts16 clipWidth\t= lua.getInt(7);\r\n\t\t\ts16 clipHeight\t= lua.getInt(8);\r\n\r\n\t\t\tcmdSetClip(orderBegin, orderEnd, clipX, clipY, clipWidth, clipHeight);\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tlua.retBool(result);\r\n\t\tbreak;\r\n\tcase UI_LIST_GET_ITEMCOUNT:\t\t\tret = cmdGetItemCount(lua,argc);\t\tbreak;\r\n\tcase UI_LIST_GET_ITEMFORM:\t\t\tret = cmdGetItemForm(lua,argc);\t\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIList::updateEnable()\r\n{\r\n\t// モーダル状態による操作許可と、\r\n\t// リスト全体の操作許可から、現在リストが操作されるべきかの値を作る\r\n\tbool totalEnable = m_bModalEnable && m_touchenable;\r\n\r\n\t// リスト個別の許可情報と併せて、現在それぞれのリストが操作されるべきかを決める。\r\n\tLISTITEM * pItem;\r\n\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\tpItem->ctrl.bEnable = pItem->enable && totalEnable;\r\n\t}\r\n}\r\n\r\nvoid CKLBUIList::setVisible(bool visible) {\r\n\t//\r\n\t// Do not comment out : some scripters used the setup of setVisible to force\r\n\t// refresh --> Was not pushed to modalstack even if visible.\r\n\t//\r\n\t//if (visible != getVisible()) {\r\n\t\tif(visible) {\r\n\t\t\tm_modalStack.push();\r\n\t\t} else {\r\n\t\t\tm_modalStack.remove();\r\n\t\t}\r\n\t\tm_scrBar.setVisible(visible);\r\n\t\tCKLBUITask::setVisible(visible);\r\n\t//}\r\n}\r\n\r\nvoid\r\nCKLBUIList::execute(u32 deltaT)\r\n{\r\n\tif(CHANGE_A) {\r\n\t\tbool visible = getVisible();\r\n\t\tif(visible) {\r\n\t\t\tm_modalStack.push();\r\n\t\t} else {\r\n\t\t\tm_modalStack.remove();\r\n\t\t}\r\n\t\tm_scrBar.setVisible(visible);\r\n\r\n\t\tif(CHANGE_B) {\r\n\t\t\tm_clipX = getX();\r\n\t\t\tm_clipY = getY();\r\n\r\n\t\t\t// マージンをスクロールバー経由でスクロールマネージャに通知する\r\n\t\t\tm_scrBar.setMargin(m_marginTop, m_marginBottom);\r\n\t\t\tm_itemUpdate = true;\r\n\t\t\tRESET_B;\r\n\t\t}\r\n\r\n\t\tRESET_A;\r\n\t}\r\n\t\r\n\t// 削除予約されたアイテムがあれば真っ先に処理する。\r\n\titemCleanUp();\r\n\r\n\tm_bModalEnable = m_modalStack.isEnable();\r\n\tupdateEnable();\r\n\tm_scrBar.setEnable(m_bModalEnable);\r\n\r\n\tm_scrBar.execute(deltaT);\r\n\tsetPosition(m_scrBar.getPosition());\r\n\tif((m_scrBar.isScrolling()) || (m_force)) {\r\n\t\t// Disable list item click / events...\r\n\t\tif((m_enableEvents) || (m_force)) {\r\n\t\t\tm_enableEvents\t= false;\r\n\t\t\tm_force\t\t\t= false;\r\n\r\n\t\t\tLISTITEM*\tparse = m_lstBegin;\r\n\t\t\twhile(parse) {\r\n\t\t\t\tparse->ctrl.bWorking = true;\r\n\t\t\t\t// Do not : fGrp.setWorking(&parse->ctrl, true);\r\n\t\t\t\tparse = parse->next;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t// Enable list item click / events...\r\n\t\tif((!m_enableEvents) || (m_force)) {\r\n\t\t\tm_enableEvents = true;\r\n\t\t\tm_force\t\t\t= false;\r\n\r\n\t\t\tLISTITEM*\tparse = m_lstBegin;\r\n\t\t\twhile(parse) {\r\n\t\t\t\tparse->ctrl.bWorking = false;\r\n\t\t\t\t// Do not : fGrp.setWorking(&parse->ctrl, false);\r\n\t\t\t\tparse = parse->next;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tbool visible = getVisible();\r\n\tif(visible) { itemRealloc(); }\r\n\r\n\tm_animpack.watchFinishedAnim(this);\r\n\tif(m_bModalEnable && m_touchenable && visible && m_pUINode->isVisible()) { touchpadEvent(); }\r\n}\r\n\r\nvoid\r\nCKLBUIList::dieUI()\r\n{\r\n\tm_modalStack.remove();\r\n\r\n\t// 削除予約リストにアイテムが残っていれば、先に破棄する。\r\n\t// 子タスクのkillは行わずともよい。\r\n\titemCleanUp(false);\r\n\r\n\tLISTITEM * pItem = m_lstBegin;\r\n\tLISTITEM * next;\r\n\r\n\t// 現在抱えているリストアイテムの破棄\r\n\twhile(pItem) {\r\n\t\tnext = pItem->next;\r\n\t\t// dieUIが呼ばれるころにはすべての子タスクが削除済みなので、\r\n\t\t// kill()処理を行わずdelete する。\r\n\t\tdelete_item(pItem, false);\r\n\t\tpItem = next;\r\n\t}\r\n\r\n\t// スクロールコントロールノードの破棄\r\n\tKLBDELETE(m_pCtrlNode);\r\n\r\n\tKLBDELETE(m_dragCallback);\r\n\tKLBDELETEA(m_dynamicCallback);\r\n\r\n\tKLBDELETEA(m_limitCallback);\t// 2012.11.27  解放漏れがあったので修正\r\n\tKLBDELETEA(m_pGroupName);\t\t// 2012.11.27  解放漏れがあったので修正\r\n\r\n\tif(m_clipHandle) {\r\n\t\tCKLBUISystem::unregisterClip(m_clipHandle);\r\n\t}\r\n}\r\n\r\n\r\nbool\r\nCKLBUIList::load_itemform(CKLBUIList::LISTITEM * pItem, const char * json, u32 jsonLength, CKLBCompositeAsset * pOrgAsset, IDataSource * pSource)\r\n{\r\n\t// 既に form がロードされている場合は何もしない\r\n\tif(pItem->form && pItem->handle) return true;\r\n\r\n\tu32 handle = 0;\r\n\r\n\t// グループ化情報を初期化\r\n\tpItem->ctrl.pGrpPrev    = NULL;\r\n\tpItem->ctrl.pGrpNext    = NULL;\r\n\tpItem->ctrl.pGroup      = NULL;\r\n\r\n\tpItem->ctrl.pBegin      = NULL;\r\n\tpItem->ctrl.next        = NULL;\r\n\tpItem->ctrl.bEnable     = m_bModalEnable && m_touchenable;\r\n\tpItem->ctrl.bExclusive  = true;\r\n\tpItem->ctrl.bWorking    = false;\r\n\tpItem->ctrl.pCallbackIF = m_dragCallback;\r\n\tpItem->ctrl.nativeCallback = (!m_dragCallback) ? (CKLBUIList::defaultScroll) : NULL;\r\n\tpItem->ctrl.pID         = this;\r\n\r\n\t// pNode と handle を作る\r\n\tCKLBCompositeAsset * pAsset = pOrgAsset;\r\n\tif(!pAsset) {\r\n\t\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\t\tpAsset = (CKLBCompositeAsset *)CKLBUtility::readAsset((u8 *)json, jsonLength, &handle, pAssetManager.getPlugin('P'));\r\n\t}\r\n\tif(!pAsset) {\r\n\t\tKLBDELETE(pItem);\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// アイテムによって生成されたコントロールノードの記録を取る。\r\n\tCKLBUISystem::setFormList(&pItem->ctrl);\r\n\r\n\t// compositeを生成する際、起動されたタスクの記録をとっておく。\r\n\tCKLBTaskMgr& mgr = CKLBTaskMgr::getInstance();\r\n\tmgr.setRegistedTaskList(&pItem->taskList);\r\n\r\n\t// DEBUG_PRINT(\" LIST:ctrl: %p\", &pItem->ctrl);\r\n\r\n\tif(pSource) pAsset->setRecord(pSource, pSource->getRecord());\r\n\tCKLBNode * pNode = pAsset->createSubTree(this,m_basePriority);\r\n\tpNode->setVisible(false);\t// 生成直後は invisible にしておく\r\n\r\n\t// タスク記録終了\r\n\tmgr.setRegistedTaskList(NULL);\r\n\r\n\t// コントロールノード記録終了\r\n\tCKLBUISystem::setFormList(NULL);\r\n\r\n\t// グループ名が指定されていたら、自動的にグループに所属させる。\r\n\tif(m_pGroupName) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\tfGrp.addForm(&(pItem->ctrl), m_pGroupName);\r\n\t}\r\n\r\n\tif(!pNode && !pOrgAsset) {\r\n\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t\treturn false;\r\n\t}\r\n\tm_pCtrlNode->addNode(pNode);\r\n\r\n\t// この段階で、composit の node tree と handle が出来上がっている\r\n\r\n\t// その node と handle を抱えたLISTITEMを作る\r\n\tpItem->form   = pNode;\r\n\tpItem->handle = handle;\r\n\r\n\tCKLBTouchEventUIMgr::getInstance().registForm(&pItem->ctrl);\r\n\r\n\t// アイテムの再生が終わったので、コールバックが指定されていたら呼び出す。\r\n\t\r\n\tCKLBScriptEnv::getInstance().call_eventUIListDynamic(m_dynamicCallback,this, pItem->index, pItem->id);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIList::unload_itemform(CKLBUIList::LISTITEM * pItem, bool kill_child)\r\n{\r\n\t// フォームコントロールリストをグループから削除する\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\tfGrp.delForm(&(pItem->ctrl));\r\n\r\n\t// 既にフォームが破棄されている場合は何もしない\r\n\tif(!pItem->form && !pItem->handle) return true;\r\n\r\n\tpItem->form->setVisible(false);\r\n\r\n\t// ctrl を処理する\r\n\tCKLBTouchEventUIMgr& mgr = CKLBTouchEventUIMgr::getInstance();\r\n\r\n\tCKLBUISelectable * pCtrl = pItem->ctrl.pBegin;\r\n\tCKLBUISelectable * pNext;\r\n\twhile(pCtrl) {\r\n\t\tpNext = pCtrl->getNextSelectable();\r\n\t\t// フォームのコントロールが操作中であれば、操作中ステータスをリセットする\r\n\t\tmgr.resetSelectable(pCtrl);\r\n\t\tpCtrl = pNext;\r\n\t}\r\n\r\n\t// このアイテム向けに差し替えられたassetがあれば破棄する\r\n\tm_formIF.removeAssetByHandle(pItem);\r\n\r\n\t// このアイテム用に起動されたタスクがあれば破棄する\r\n\tpItem->taskList.killTaskList(kill_child);\r\n\r\n\t// node と handle を処理する\r\n\tCKLBUtility::deleteNode(pItem->form, pItem->handle);\r\n\r\n\t// フォームのコントロールリストを破棄\r\n\t// AFTER pItem->form destruction.\r\n\tmgr.removeForm(&pItem->ctrl);\r\n\r\n\tpItem->form   = NULL;\r\n\tpItem->handle = 0;\r\n\r\n\treturn true;\r\n}\r\n\r\nCKLBUIList::LISTITEM *\r\nCKLBUIList::create_item(const char * json, u32 size, int id, CKLBCompositeAsset * pOrgAsset, IDataSource * pSource)\r\n{\r\n\t//u32 handle = 0;\r\n\r\n\t// LISTITEMを作る\r\n\tLISTITEM * pItem = KLBNEW(LISTITEM);\r\n    if(!pItem) { return NULL; }\r\n\r\n\tpItem->enable = true;\r\n\tpItem->id = id;\r\n\r\n\tswitch(m_itemMode)\r\n\t{\r\n\tcase LIST_ITEM_NORMAL:\r\n\tcase LIST_ITEM_FLYWEIGHT:\r\n\t\t{\r\n\t\t\tpItem->jsonp    = NULL;\r\n\t\t\tpItem->jsonlen  = 0;\r\n\t\t\tpItem->handle   = 0;\r\n\t\t\tpItem->form     = NULL;\r\n\t\t\tload_itemform(pItem, json, size, pOrgAsset, pSource);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LIST_ITEM_DYNAMIC:\r\n\t\t{\r\n\t\t\tpItem->jsonp    = CKLBUtility::copyMem(json, size);\r\n\t\t\tpItem->jsonlen  = size;\r\n\t\t\tpItem->handle   = 0;\r\n\t\t\tpItem->form     = NULL;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\tpItem->prev = pItem->next = NULL;\r\n\r\n\treturn pItem;\r\n}\r\n\r\nvoid\r\nCKLBUIList::delete_item(LISTITEM * pItem, bool kill_child)\r\n{\r\n\t// フォームがロードされていたら破棄する\r\n\t// if(pItem->form && pItem->handle) { <-- Test done in un_load\r\n\tunload_itemform(pItem, kill_child);\r\n\r\n\t// JSONがあれば破棄する\r\n\tKLBDELETEA(pItem->jsonp);\r\n\r\n\tKLBDELETE(pItem);\t// インスタンス本体を破棄\r\n}\r\n\r\nint\r\nCKLBUIList::get_item_index_by_id(int id)\r\n{\r\n\tLISTITEM * pItem;\r\n\tint idx = 0;\r\n\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\tif(pItem->id == id) return idx;\r\n\t\tidx++;\r\n\t}\r\n\treturn -1;\r\n}\r\n\r\nCKLBUIList::LISTITEM *\r\nCKLBUIList::getItemByID(int id)\r\n{\r\n\tLISTITEM * pItem;\r\n\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\tif(pItem->id == id) return pItem;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nCKLBUIList::LISTITEM *\r\nCKLBUIList::getItemByIndex(int index)\r\n{\r\n\tLISTITEM * pItem;\r\n\tint idx = 0;\r\n\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\tif(idx == index) return pItem;\r\n\t\tidx++;\r\n\t}\r\n\treturn NULL;\r\n}\r\nbool\r\nCKLBUIList::itemInsertUniversal(LISTITEM * posItem, int step, CLuaState& lua, int index, int id)\r\n{\r\n\tu32 size;\r\n\tconst char * json = toJSON(lua, index, size);\t// 対応している型ならすべてJSON文字列になる。\r\n\tbool bResult = itemInsert(posItem, step, json, size, id);\r\n\tKLBDELETEA(json);\r\n\r\n\treturn bResult;\r\n}\r\n\r\n//\r\n// 現在Luaスタックの指定indexに積まれている値をJSON文字列化する。\r\n// JSON-assetパス、JSON文字列、Luaテーブルに対応。\r\n//\r\nconst char *\r\nCKLBUIList::toJSON(CLuaState& lua, int index, u32& size)\r\n{\r\n\tif(lua.isString(index)) {\r\n\t\t// 文字列である場合、先頭が \"asset://\" \"file://\" であれば asset file、それ以外なたJSON string\r\n\t\t// と判断して処理する。\r\n\t\tconst char * param  = lua.getString(index);\r\n\t\tconst char * string = NULL;\r\n\t\tif(!strncmp(param, \"asset://\", 8) || !strncmp(param, \"file://\", 7)) {\r\n\t\t\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\t\t\tIReadStream * pStream = pltf.openReadStream(param, pltf.useEncryption());\r\n\t\t\tif(!pStream || pStream->getStatus() != IReadStream::NORMAL) {\r\n\t\t\t\tdelete pStream;\r\n\t\t\t\treturn NULL;\r\n\t\t\t}\r\n\t\t\tint ssize = pStream->getSize();\r\n\t\t\tchar * buf = KLBNEWA(char, ssize + 1);\r\n\t\t\tpStream->readBlock(buf, ssize);\r\n\t\t\tdelete pStream;\r\n\t\t\tbuf[ssize] = 0;\r\n\t\t\tstring = (const char *)buf;\r\n\t\t\tsize = ssize;\r\n\t\t} else {\r\n\t\t\tsize = strlen(param);\r\n\t\t\tstring = CKLBUtility::copyString(param);\r\n\t\t}\r\n\t\treturn string;\r\n\t}\r\n\t// 文字列ではない場合、Luaテーブルとして処理する\r\n\tlua.retValue(index);\r\n\tconst char * json = CKLBUtility::lua2BJson(lua, size);\r\n\tlua.pop(1);\r\n\r\n\treturn json;\r\n}\r\n\r\n/*static*/\r\nconst char *\r\nCKLBUIList::toJSON(const char* param, u32& size)\r\n{\r\n\t// 文字列である場合、先頭が \"asset://\" \"file://\" であれば asset file、それ以外なたJSON string\r\n\t// と判断して処理する。\r\n\tconst char * string = NULL;\r\n\tif(!strncmp(param, \"asset://\", 8) || !strncmp(param, \"file://\", 7)) {\r\n\t\tIPlatformRequest& pltf = CPFInterface::getInstance().platform();\r\n\t\tIReadStream * pStream = pltf.openReadStream(param, pltf.useEncryption());\r\n\t\tif(!pStream || pStream->getStatus() != IReadStream::NORMAL) {\r\n\t\t\tdelete pStream;\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tint ssize = pStream->getSize();\r\n\t\tchar * buf = KLBNEWA(char, ssize + 1);\r\n\t\tpStream->readBlock(buf, ssize);\r\n\t\tdelete pStream;\r\n\t\tbuf[ssize] = 0;\r\n\t\tstring = (const char *)buf;\r\n\t\tsize = ssize;\r\n\t} else {\r\n\t\tsize = strlen(param);\r\n\t\tstring = CKLBUtility::copyString(param);\r\n\t}\r\n\treturn string;\r\n}\r\n\r\n// JSONから生成したcompositをリストの項目として追加する\r\nbool\r\nCKLBUIList::itemInsert(LISTITEM * posItem, int step, const char * json, u32 size, int id, \r\n\t\t\t\t\t\tCKLBCompositeAsset * pAsset, IDataSource * pSource)\r\n{\r\n\t// ノードを作る\r\n\r\n\tLISTITEM * pItem = create_item(json, size, id, pAsset, pSource);\r\n    if(!pItem) { return false; }\r\n\r\n\tm_force = true; // Will be added to the list.\r\n\r\n\tpItem->step = step;\r\n\r\n\tif(posItem) {\r\n\t\tpItem->prev = posItem->prev;\r\n\t\tposItem->prev = pItem;\r\n\t} else {\r\n\t\tpItem->prev = m_lstEnd;\r\n\t\tm_lstEnd = pItem;\r\n\t}\r\n\tif(pItem->prev) {\r\n\t\tpItem->prev->next = pItem;\r\n\t} else {\r\n\t\tm_lstBegin = pItem;\r\n\t}\r\n\tpItem->next = posItem;\r\n\r\n\t// アイテムが加わったので再配置\r\n\tm_itemUpdate = true;\r\n\t// itemRealloc();\r\n\r\n\tm_itemCnt++;\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIList::itemDelete(LISTITEM * posItem)\r\n{\r\n\t// アイテムをメインリストから取り外す\r\n\tif(posItem->prev) {\r\n\t\tposItem->prev->next = posItem->next;\r\n\t} else {\r\n\t\tm_lstBegin = posItem->next;\r\n\t}\r\n\tif(posItem->next) {\r\n\t\tposItem->next->prev = posItem->prev;\r\n\t} else {\r\n\t\tm_lstEnd = posItem->prev;\r\n\t}\r\n\r\n\t// 取り外したアイテムを killリストに付け替える\r\n\tposItem->prev = m_killEnd;\r\n\tposItem->next = NULL;\r\n\tif(posItem->prev) {\r\n\t\tposItem->prev->next = posItem;\r\n\t} else {\r\n\t\tm_killBegin = posItem;\r\n\t}\r\n\tm_killEnd = posItem;\r\n\r\n\t// この時点での物理的削除は行わない。\r\n\t// アイテムの持つボタン等からのLuaコールバック内で削除が指示されるケースもあるため、\r\n\t// コールバックから戻ってきた時点でinstanceが無くなっていることは避けねばならない。\r\n\t// メインリスト中からは消えているため、従来通り削除と同時にindexが振りなおされる仕様は保たれる。\r\n\t// 以下は旧コード。\r\n\t// // アイテムを削除する\r\n\t// delete_item(posItem);\r\n\r\n\t// アイテムが減ったので再配置\r\n\tm_itemUpdate = true;\r\n\t// itemRealloc();\r\n\tm_itemCnt--;\r\n}\r\n\r\nvoid\r\nCKLBUIList::itemCleanUp(bool kill_child)\r\n{\r\n\tLISTITEM * pItem = m_killBegin;\r\n\twhile(pItem) {\r\n\t\tLISTITEM * pNext = pItem->next;\r\n\t\tdelete_item(pItem, kill_child);\r\n\t\tpItem = pNext;\r\n\t}\r\n\tm_killBegin = m_killEnd = NULL;\r\n}\r\n\r\nvoid \r\nCKLBUIList::setSplineLayout(float* array_, u32 setupBitmask, u32 curveLengthPixel) \r\n{\r\n\tm_layoutTableXY\t\t\t= array_; array_ += 4;\r\n\tm_layoutInterlaceSize\t= 4;\r\n\tm_curveLength\t\t\t= curveLengthPixel;\r\n\r\n\tif (setupBitmask & (1<<CKLBSplineNode::MODIFY_SCALE)) {\r\n\t\tm_layoutTableScale\t\t= array_; array_ += 4;\t// Scale X & Y\r\n\t\tm_layoutInterlaceSize\t+= 4;\r\n\t} else {\r\n\t\tm_layoutTableScale\t\t= NULL;\r\n\t}\r\n\r\n\tif (setupBitmask & ((1<<CKLBSplineNode::MODIFY_R) | (1<<CKLBSplineNode::MODIFY_G) | (1<<CKLBSplineNode::MODIFY_B))) {\r\n\t\tm_layoutTableRGB\t\t= array_; array_ += 6;\t// RGB\r\n\t\tm_layoutInterlaceSize  += 6;\r\n\t} else {\r\n\t\tm_layoutTableRGB\t\t= NULL;\r\n\t}\r\n\r\n\tif (setupBitmask & (1<<CKLBSplineNode::MODIFY_A)) {\r\n\t\tm_layoutTableAlpha\t\t= array_; array_ += 2;\t// Alpha\r\n\t\tm_layoutInterlaceSize  += 2;\r\n\t} else {\r\n\t\tm_layoutTableAlpha\t    = NULL;\r\n\t}\r\n\r\n\tif (setupBitmask & (1<<CKLBSplineNode::MODIFY_ROT)) {\r\n\t\tm_layoutTableRotation\t= array_; array_ += 2;\t// Rotation\r\n\t\tm_layoutInterlaceSize  +=2;\r\n\t} else {\r\n\t\tm_layoutTableRotation\t= NULL;\r\n\t}\r\n\r\n\tif (setupBitmask & (1<<CKLBSplineNode::MODIFY_PRIORITY)) {\r\n\t\tm_layoutTablePriority\t= array_; array_ += 2;\r\n\t\tm_layoutInterlaceSize  +=2;\r\n\t} else {\r\n\t\tm_layoutTablePriority\t= NULL;\r\n\t}\r\n\r\n\tif (setupBitmask & (1<<CKLBSplineNode::MODIFY_LAYOUT)) {\r\n\t\tm_layoutTableLayout\t\t= array_; array_ += 2;\r\n\t\tm_layoutInterlaceSize  +=2;\r\n\t} else {\r\n\t\tm_layoutTableLayout\t\t= NULL;\r\n\t}\r\n\r\n\tm_layoutTable = array_;\r\n}\r\n\r\ns32 \r\nCKLBUIList::fromScreenDistanceToSplineDistance(s32 posPixelSpace) \r\n{\r\n\treturn (posPixelSpace << 12) / m_curveLength;\r\n}\r\n\r\ninline \r\nvoid \r\nCKLBUIList::interpolate1(float* array_, float sub, float& res) \r\n{\r\n\tres  = *array_ + (array_[1] * sub); // Export .4 fixed\r\n}\r\n\r\ninline \r\nvoid \r\nCKLBUIList::interpolate2(float* array_, float sub, float& resA, float& resB) \r\n{\r\n\tresA = array_[0] + (array_[1] * sub);\r\n\tresB = array_[2] + (array_[3] * sub);\r\n}\r\n\r\ninline \r\nvoid \r\nCKLBUIList::interpolate3(float* array_, float sub, float& resA, float& resB, float& resC) \r\n{\r\n\tresA = array_[0] + (array_[1] * sub);\r\n\tresB = array_[2] + (array_[3] * sub);\r\n\tresC = array_[4] + (array_[5] * sub);\r\n}\r\n\r\n// アイテムの表示位置関係を再設定する\r\nvoid\r\nCKLBUIList::itemRealloc()\r\n{\r\n\tLISTITEM * pItem;\r\n\tbool posUpdate = m_posUpdate;\r\n\tbool itemUpdate = m_itemUpdate;\r\n\tm_posUpdate = m_itemUpdate = false;\r\n\r\n\t// それぞれのフォーム表示位置を再設定する\r\n\tif(itemUpdate || m_bLoop) {\t// loop のときは必ず処理\r\n\t\tint pos = (m_bLoop) ? 0 : m_marginTop;\r\n\t\tm_itemCnt = 0;\r\n\t\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\t\tpItem->pos = pos;\r\n\t\t\tpos += pItem->step;\r\n\t\t\tm_itemCnt++;\r\n\t\t}\r\n\r\n\t\tm_listLength = pos + ((m_bLoop) ? 0 : m_marginBottom);\t// 終端値\r\n\t}\r\n\r\n\t// ループ可能な最小クリップサイズの計算。\r\n\t// m_listLength + index[0] の step サイズ以下の場合、\r\n\t// スクロールによって最初のアイテムがクリップ領域中の二か所以上に\r\n\t// 表示されなければならない状況が生じるため、\r\n\t// ループには少なくとも最初のアイテムが二重に必要とされないサイズが必須。\r\n\r\n\tint loopMinSize = m_listLength - ((m_lstBegin) ? m_lstBegin->step : 0);\r\n\r\n\tif(m_bLoop && (loopMinSize >= m_clipSize)) {\r\n\t\tm_scrBar.setOverScroll(m_bLoop || !m_chklimit);\r\n\t\tm_scrBar.setLoopArea(0, m_listLength);\r\n\t} else {\r\n\t\tm_scrBar.setOverScroll(!m_chklimit);\r\n\t\tm_scrBar.setLoopArea(0, 0);\t// ループなし\r\n\t}\r\n\r\n\tif(posUpdate) {\r\n\t\tif(m_chklimit && !m_bLoop) {\r\n\t\t\t// クリッピング処理ありかつループなし\r\n\t\t\tif(m_scrollPos + m_listLength < m_clipSize) m_scrollPos = m_clipSize - m_listLength;\r\n\t\t\tif(m_scrollPos > 0) m_scrollPos = 0;\r\n\t\t\tbool call = false;\r\n\t\t\tif(m_scrollPos == 0) {\r\n\t\t\t\tcall = true;\r\n\t\t\t\tif(!m_limitCalled) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIList(m_limitCallback, \r\n\t\t\t\t\t\tthis, LIST_SCROVER_TOP, m_itemCnt, m_listLength, -m_scrollPos);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(m_scrollPos + m_listLength <= m_clipSize) {\r\n\t\t\t\tcall = true;\r\n\t\t\t\tif(!m_limitCalled) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIList(m_limitCallback,\r\n\t\t\t\t\t\tthis, LIST_SCROVER_BOTTOM, m_itemCnt, m_listLength, -m_scrollPos);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// 前回コール条件を満たしていたが、今回コール条件を満たしていない場合は、領域を離れた旨の呼び出しを行う。\r\n\t\t\tif(m_limitCalled && !call) {\r\n\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIList(m_limitCallback,\r\n\t\t\t\t\tthis, LIST_SCROVER_TAKEOFF, m_itemCnt, m_listLength, -m_scrollPos);\r\n\t\t\t}\r\n\t\t\tm_limitCalled = call;\t// 次回にコール済みか否かの記録を残す。\r\n\t\t} else {\r\n\t\t\t//\r\n\t\t\t// クリッピング処理なしもしくはループあり\r\n\t\t\t//\r\n\t\t\tbool call = false;\r\n\t\t\tint pos = -m_scrollPos;\t// 表示用の m_scrollPos は符号が反転しているため。\r\n\t\t\tint limitArea = (m_limitAreaSize > 0) ? m_limitAreaSize : m_clipSize;\r\n\r\n\t\t\t// スクロール結果、画面下端が最後の「ページ(= 画面と同サイズの領域)」にかかったら、\r\n\t\t\t// 下端オーバーコールバックを呼ぶ(設定されている場合)\r\n\t\t\tif(!m_bLoop && (pos >= m_listLength - (limitArea + m_clipSize)) ) {\r\n\t\t\t\tcall = true;\r\n\t\t\t\tif(!m_limitCalled) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIList(m_limitCallback, \r\n\t\t\t\t\t\t\t\tthis, LIST_SCROVER_BOTTOM, m_itemCnt, m_listLength, pos);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// スクロール結果、画面上端が最初の「ページ(= 画面と同サイズの領域)」にかかったら、\r\n\t\t\t// 上端オーバーコールバックを呼ぶ(設定されている場合)\r\n\t\t\tif(!m_bLoop && (pos <= limitArea)) {\r\n\t\t\t\tcall = true;\r\n\t\t\t\tif(!m_limitCalled) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIList(m_limitCallback,\r\n\t\t\t\t\t\t\t\tthis, LIST_SCROVER_TOP, m_itemCnt, m_listLength, pos);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// 前回コール条件を満たしていたが、今回コール条件を満たしていない場合は、領域を離れた旨の呼び出しを行う。\r\n\t\t\tif(!m_bLoop && m_limitCalled && !call) {\r\n\t\t\t\tCKLBScriptEnv::getInstance().call_eventUIList(m_limitCallback,\r\n\t\t\t\t\tthis, LIST_SCROVER_TAKEOFF, m_itemCnt, m_listLength, pos);\r\n\t\t\t}\r\n\t\t\tm_limitCalled = call;\t// 次回にコール済みか否かの記録を残す。\r\n\r\n\t\t\tif(m_bLoop && (loopMinSize >= m_clipSize)) {\r\n\t\t\t\t// ループありのとき、スクロール位置が下端に近く、境界が表示域内に入るならば\r\n\t\t\t\t// 上端部の表示位置を下端から継続するように再配置する。\r\n\t\t\t\t// ただし、リスト全体の長さがクリップサイズ未満である場合はこの処理は行わない。\r\n\t\t\t\tif(m_scrollPos + m_listLength < m_clipSize) {\r\n\t\t\t\t\tpItem = m_lstBegin;\r\n\t\t\t\t\tif(pItem) {\r\n\t\t\t\t\t\twhile(pItem->pos + m_scrollPos + m_listLength < m_clipSize) {\r\n\t\t\t\t\t\t\tpItem->pos += m_listLength;\r\n\t\t\t\t\t\t\tpItem = pItem->next;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// 各アイテムの表示位置を反映させる\r\n\tif(posUpdate || itemUpdate) {\r\n\t\tif(m_layoutTable) {\r\n\t\t\tsetSplinePosition();\r\n\t\t} else {\r\n\t\t\tsetStraightPosition();\r\n\t\t}\r\n\t\t// 設定されたリストの最大長を利用して、スクロールバーの最大値を設定する。\r\n\t\tint maxPos = m_listLength - m_clipSize;\r\n\t\tif(maxPos < 0) {\r\n\t\t\t// リスト全体の長さがクリッピング領域に満たない場合\r\n\t\t\tmaxPos = 0;\r\n\t\t}\r\n\t\tm_scrBar.setMaxPosition(maxPos);\r\n\r\n\t\t// スライダのサイズを変動させる\r\n\t\tif(maxPos > 0) {\r\n\t\t\tint slider_size = m_clipSize * m_clipSize / m_listLength;\r\n\t\t\tm_scrBar.setSliderSize(slider_size);\r\n\t\t} else {\r\n\t\t\tm_scrBar.setSliderSize(m_clipSize);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIList::setStraightPosition()\r\n{\r\n\tLISTITEM * pItem;\r\n\r\n\t// それぞれのフォーム表示位置を再設定する\r\n\tint x, y;\r\n\tx = y = 0;\r\n\tswitch(m_itemMode)\r\n\t{\r\n\tcase LIST_ITEM_NORMAL:\r\n\t\t{\r\n\t\t\tint item_index = 0;\r\n\t\t\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\t\t\t// index を再設定する\r\n\t\t\t\tpItem->index = item_index;\r\n\t\t\t\titem_index++;\r\n\r\n\t\t\t\tx = (m_vertical)  ? 0 : (pItem->pos);\r\n\t\t\t\ty = (!m_vertical) ? 0 : (pItem->pos);\r\n\t\t\t\tpItem->form->setTranslate((float)x, (float)y);\r\n\t\t\t\tpItem->form->setVisible(true);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase LIST_ITEM_DYNAMIC:\r\n\t\t{\r\n\t\t\tint item_index = 0;\r\n\t\t\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\t\t\t// index を再設定する\r\n\t\t\t\tpItem->index = item_index;\r\n\t\t\t\titem_index++;\r\n\r\n\t\t\t\t// このアイテムが画面内に入っていれば、アイテムツリーを生成\r\n\t\t\t\t// 入っていなければアイテムツリーを破棄\r\n\t\t\t\tint pos = pItem->pos + m_scrollPos;\r\n\t\t\t\tif((pos + pItem->step) > 0 && pos < m_clipSize) {\r\n\t\t\t\t\t// アイテムがクリップ領域内にある\r\n\t\t\t\t\tload_itemform(pItem, pItem->jsonp, pItem->jsonlen);\r\n\t\t\t\t\tx = (m_vertical)  ? 0 : pItem->pos;\r\n\t\t\t\t\ty = (!m_vertical) ? 0 : pItem->pos;\r\n\t\t\t\t\tpItem->form->setTranslate((float)x, (float)y);\r\n\t\t\t\t\tpItem->form->setVisible(true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// アイテムはクリップ領域外にある\r\n\t\t\t\t\tunload_itemform(pItem);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// m_scrollPos はクリッピング済み\r\n\tif(m_vertical) {\r\n\t\tm_ctrlY = m_scrollPos;\r\n\t} else {\r\n\t\tm_ctrlX = m_scrollPos;\r\n\t}\r\n\r\n\tm_pCtrlNode->setTranslate(m_ctrlX, m_ctrlY);\r\n}\r\n\r\nvoid\r\nCKLBUIList::setSplinePosition()\r\n{\r\n\tLISTITEM * pItem;\r\n\r\n\tbool isDynamic = m_itemMode == LIST_ITEM_DYNAMIC;\r\n\r\n\t// scrollOffset Range = 0..((Item Count * (Item Size << 12)) / curveLengthPixel)\r\n\t// m_ctrlX or m_ctrlY based on bool vert.  <-- Scroll position.\r\n\r\n\t// それぞれのフォーム表示位置を再設定する\r\n\tint item_index = 0;\r\n\tint\toffsetPos  = 0;\r\n\r\n\tfor(pItem = m_lstBegin; pItem; pItem = pItem->next) {\r\n\t\t\t\r\n\t\tpItem->index = item_index;\r\n\t\titem_index++;\r\n\r\n\t\tif(m_layoutTableLayout) {\r\n\t\t\tint splinePos\t= fromScreenDistanceToSplineDistance(pItem->pos + m_scrollPos);\r\n\t\t\tif((splinePos < 0) || (splinePos >= 4096)) {\r\n\t\t\t\toffsetPos = 0;\r\n\t\t\t} else {\r\n\t\t\t\tu32 idx\t\t\t= (splinePos >> 4) * m_layoutInterlaceSize;\r\n\t\t\t\tfloat sub\t\t= (splinePos & 0xF) * (1.0f/16.0f);\r\n\t\t\t\tfloat layoutStepF;\r\n\t\t\t\tinterpolate1(&m_layoutTableLayout[idx], sub, layoutStepF);\r\n\t\t\t\toffsetPos = (s32)(layoutStepF * 4096);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tint splinePos\t= fromScreenDistanceToSplineDistance(pItem->pos + offsetPos + m_scrollPos);\r\n\r\n\t\tif((splinePos < 0) || (splinePos >= 4096)) {\r\n\t\t\tif (!isDynamic) {\r\n\t\t\t\tpItem->form->setVisible(false);\r\n\t\t\t} else {\r\n\t\t\t\t// アイテムはクリップ領域外にある\r\n\t\t\t\tunload_itemform(pItem);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tCKLBNode* pNode = NULL;\r\n\t\t\t// アイテムがクリップ領域内にある\r\n\t\t\tif(isDynamic) {\r\n\t\t\t\tif(load_itemform(pItem, pItem->jsonp, pItem->jsonlen)) {\r\n\t\t\t\t\tpNode = pItem->form;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tpNode = pItem->form;\r\n\t\t\t}\r\n\r\n\t\t\tif(pNode) {\r\n\t\t\t\tpNode->setVisible(true);\r\n\t\t\t\tfloat x,y;\r\n\t\t\t\tu32 idx     = (splinePos >> 4) * m_layoutInterlaceSize;\r\n\t\t\t\tfloat sub   = (splinePos & 0xF) * (1.0f/16.0f);\r\n\r\n\t\t\t\t// X,Y\r\n\t\t\t\tinterpolate2(&m_layoutTableXY[idx], sub, x, y);\r\n\t\t\t\tpNode->setTranslate(x,y);\r\n\r\n\t\t\t\t// Scale\r\n\t\t\t\tif(m_layoutTableScale || m_layoutTableRotation) {\r\n\t\t\t\t\tif(m_layoutTableScale && !m_layoutTableRotation) {\r\n\t\t\t\t\t\tinterpolate2(&m_layoutTableScale[idx], sub, x, y);\r\n\t\t\t\t\t\tpNode->setScale(x,y);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t// Rotation\r\n\t\t\t\t\tif(m_layoutTableRotation && !m_layoutTableScale) {\r\n\t\t\t\t\t\tfloat rot;\r\n\t\t\t\t\t\tinterpolate1(&m_layoutTableRotation[idx], sub, rot);\r\n\t\t\t\t\t\tpNode->setRotation(rot);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t// Rotation & Scale\r\n\t\t\t\t\tif(m_layoutTableRotation && m_layoutTableScale) {\r\n\t\t\t\t\t\tfloat rot;\r\n\t\t\t\t\t\tinterpolate1(&m_layoutTableRotation[idx], sub, rot);\r\n\t\t\t\t\t\tinterpolate2(&m_layoutTableScale[idx], sub, x, y);\r\n\t\t\t\t\t\tpNode->setScaleRotation(x,y,rot);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\t// Alpha\r\n\t\t\t\tif(m_layoutTableAlpha) {\r\n\t\t\t\t\tSColorVector col;\r\n\t\t\t\t\tpNode->getColorMatrix(col);\r\n\t\t\t\t\tinterpolate1(&m_layoutTableAlpha[idx], sub, col.m_vector[3]); // Can probably avoid interpolation here.\r\n\t\t\t\t\tpNode->setColorMatrix(col);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// R,G,B\r\n\t\t\t\tif(m_layoutTableRGB) {\r\n\t\t\t\t\tSColorVector col;\r\n\t\t\t\t\tpNode->getColorMatrix(col);\r\n\t\t\t\t\tinterpolate3(&m_layoutTableRGB[idx], sub, col.m_vector[0], col.m_vector[1], col.m_vector[2]); // Can probably avoid interpolation here.\r\n\t\t\t\t\tpNode->setColorMatrix(col);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(m_layoutTablePriority) {\r\n\t\t\t\t\tfloat priority;\r\n\t\t\t\t\tinterpolate1(&m_layoutTablePriority[idx], sub, priority);\r\n\t\t\t\t\tpNode->setPriorityL(priority);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// ### TODO CLIPPING ###\r\n}\r\n\r\n\r\nbool\r\nCKLBUIList::setClip(u32 orderBegin, u32 orderEnd,\r\n                    s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight)\r\n{\r\n\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\tCKLBRenderState* pClipStart = pMgr.allocateCommandState();\r\n\tCKLBRenderState* pClipEnd   = pMgr.allocateCommandState();\r\n\r\n\tCKLBNode * pNode = getNode();\r\n\tif(pNode->setRenderSlotCount(2) && pClipStart && pClipEnd) {\r\n\t\tpNode->setRender(pClipStart,0);\r\n\t\tpNode->setRender(pClipEnd  ,1);\r\n\r\n\t\tpClipStart->setUse\t(true,false,null);\r\n\t\tpClipEnd->setUse\t(true,false,null);\r\n\r\n\t\treturn resetClip(orderBegin, orderEnd, clipX, clipY, clipWidth, clipHeight, true);\r\n\t} else {\r\n\t\tif (pClipEnd)\t{ pMgr.releaseCommand(pClipEnd);\t}\r\n\t\tif (pClipStart) { pMgr.releaseCommand(pClipStart);\t}\r\n\t\treturn false;\r\n\t}\r\n\t//return true;\r\n}\r\n\r\nbool \r\nCKLBUIList::resetClip(u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight, bool forceClip) \r\n{\r\n\tCKLBRenderingManager& pMgr = CKLBRenderingManager::getInstance();\r\n\tCKLBNode*        pNode      = getNode();\r\n\tCKLBRenderState* pClipStart = (CKLBRenderState*)pNode->getRender(0);\r\n\tCKLBRenderState* pClipEnd\t= (CKLBRenderState*)pNode->getRender(1);\r\n\t\r\n\tif(orderBegin != 0xFFFFFFFF) {\r\n\t\tpClipStart->changeOrder(pMgr, orderBegin);\r\n\t}\r\n\r\n\tif(orderBegin != 0xFFFFFFFF) {\r\n\t\tpClipEnd->changeOrder(pMgr, orderEnd);\r\n\t}\r\n\r\n\tbool enabled = true;\r\n\tif(forceClip || (clipWidth != 0) || (clipHeight != 0)) {\r\n\t\tpClipStart->setScissor(true, clipX, clipY, clipWidth, clipHeight);\r\n\t} else {\r\n\t\tenabled = false;\r\n\t\tpClipStart->setScissor(false, 0, 0, 0, 0);\r\n\t}\r\n\tpClipEnd->setScissor(false);\r\n\r\n\tif(enabled) {\r\n\t\tif(m_clipHandle == NULL) {\r\n\t\t\tm_clipHandle = CKLBUISystem::registerClip(pClipStart, pClipEnd);\r\n\t\t\treturn m_clipHandle != NULL;\r\n\t\t}\r\n\t} else {\r\n\t\tif(m_clipHandle != NULL) {\r\n\t\t\tCKLBUISystem::unregisterClip(m_clipHandle);\r\n\t\t\tm_clipHandle = NULL;\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIList::touchpadEvent()\r\n{\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\tfloat fx, fy;\r\n\tCKLBUtility::getNodePosition(getNode(), &fx, &fy);\r\n\tint x, y, rx, ry;\r\n\tx = (int)fx;\r\n\ty = (int)fy;\r\n\t\r\n\tfloat scaleX = getScaleX();\r\n\tfloat scaleY = getScaleY();\r\n\r\n\tint left   = (int)(m_leftDrag   * scaleX);\r\n\tint right  = (int)(m_rightDrag  * scaleX);\r\n\tint top    = (int)(m_topDrag    * scaleY);\r\n\tint bottom = (int)(m_bottomDrag * scaleY);\r\n\r\n\tconst PAD_ITEM * item;\r\n\ttpq.startItem();\r\n\twhile(NULL != (item = tpq.getItem())) {\r\n\t\tswitch(item->type)\r\n\t\t{\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\t{\r\n\t\t\t\t// タップ位置がリストの範囲内に入っていれば自身に対する操作とみなす。\r\n\t\t\t\trx = item->x - x;\r\n\t\t\t\try = item->y - y;\r\n\t\t\t\tif((rx < left) || (rx >= right) || ry < top || ry >= bottom) {\r\n\t\t\t\t\t// クリップ外なのであずかり知らぬイベント。\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tm_dragID = item->id;\r\n\t\t\t\tm_dragX = item->x;\r\n\t\t\t\tm_dragY = item->y;\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tif(m_dragCallback) {\r\n\t\t\t\t\tm_dragCallback->callback(item->type, item->x, item->y, 0, 0);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdefaultScroll(this, item->type, item->x, item->y, 0, 0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t{\r\n\t\t\t\tif(item->id != m_dragID) break;\r\n\t\t\t\tint mv_x = item->x - m_dragX;\r\n\t\t\t\tint mv_y = item->y - m_dragY;\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tif(m_dragCallback) {\r\n\t\t\t\t\t// DEBUG_PRINT(\"  EVENT: %p (drag)\", this);\r\n\t\t\t\t\tm_dragCallback->callback(item->type, m_dragX, m_dragY, mv_x, mv_y);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdefaultScroll(this, item->type, m_dragX, m_dragY, mv_x, mv_y);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t{\r\n\t\t\t\tif(item->id != m_dragID) break;\r\n\t\t\t\tint mv_x = item->x - m_dragX;\r\n\t\t\t\tint mv_y = item->y - m_dragY;\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tif(m_dragCallback) {\r\n\t\t\t\t\tm_dragCallback->callback(item->type, m_dragX, m_dragY, mv_x, mv_y);\r\n\t\t\t\t\t// DEBUG_PRINT(\"  EVENT: %p (release)\", this);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdefaultScroll(this, item->type, m_dragX, m_dragY, mv_x, mv_y);\r\n\t\t\t\t}\r\n\t\t\t\tm_dragID = -1;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// デフォルトでドラッグ操作に追従させてスクロールさせる場合\r\nvoid\r\nCKLBUIList::defaultScroll(void * pData, PAD_ITEM::TYPE type, int dragX, int dragY, int mvX, int mvY)\r\n{\r\n\tCKLBUIList * pList = (CKLBUIList *)pData;\r\n\tif(!pList->m_defScroll) return;\t// デフォルトスクロールが禁止なら処理しない。\r\n\tswitch(type)\r\n\t{\r\n\tcase PAD_ITEM::TAP:\r\n\t\t{\r\n\t\t\tpList->m_defaultPrePos  = -pList->m_scrollPos;\r\n\t\t\tpList->m_defaultDragPos = -pList->m_scrollPos;\r\n\t\t\tpList->m_dragX          = dragX;\r\n\t\t\tpList->m_dragY          = dragY;\r\n\t\t\tpList->m_bTaped         = true;\r\n\t\t\tpList->m_scrBar.setCtrlStatus(true);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase PAD_ITEM::DRAG:\r\n\t\t{\r\n\t\t\tif ((abs(mvX) + abs(mvY)) >= pList->m_dragDistance) {\r\n\t\t\t\tif(!pList->m_bTaped) {\r\n\t\t\t\t\tpList->m_defaultPrePos  = -pList->m_scrollPos;\r\n\t\t\t\t\tpList->m_defaultDragPos = -pList->m_scrollPos;\r\n\t\t\t\t\tpList->m_bTaped = true;\r\n\t\t\t\t\tpList->m_scrBar.setCtrlStatus(true);\r\n\t\t\t\t}\r\n\t\t\t\ts32 pos = pList->m_defaultPrePos;\r\n\t\t\t\tif(pList->m_vertical) {\r\n\t\t\t\t\tpos -= mvY;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpos -= mvX;\r\n\t\t\t\t}\r\n\t\t\t\tint dir = (pos > pList->m_defaultDragPos) ? 1 : -1;\r\n\t\t\t\tpList->m_defaultDragPos = pos;\t// 前回のpos指定からどちらにドラッグしたかで変わるため。\r\n\t\t\t\tpList->m_scrBar.setPosition(pos, dir);\r\n\t\t\t\tpos = pList->m_scrBar.getPosition();\r\n\t\t\t\tpList->setPosition(pos);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase PAD_ITEM::RELEASE:\r\n\tcase PAD_ITEM::CANCEL:\r\n\t\t{\r\n\t\t\ts32 pos = pList->m_defaultPrePos;\r\n\t\t\tif(pList->m_vertical) {\r\n\t\t\t\tpos -= mvY;\r\n\t\t\t} else {\r\n\t\t\t\tpos -= mvX;\r\n\t\t\t}\r\n\t\t\tint dir = (pos > pList->m_defaultDragPos) ? 1 : -1;\r\n\t\t\tpList->m_scrBar.setPosition(pos, dir);\r\n\t\t\tpos = pList->m_scrBar.getPosition();\r\n\t\t\tpList->setPosition(pos);\r\n\t\t\tpList->m_bTaped = false;\r\n\t\t\tpList->m_scrBar.setCtrlStatus(false);\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIList.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIList_h\r\n#define CKLBUIList_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBNodeAnimPack.h\"\r\n#include \"CKLBFormIF.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"CompositeManagement.h\"\r\n#include \"DataSet_JSonDB.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBPropertyBag.h\"\r\n#include \"CKLBDragCallbackIF.h\"\r\n\r\nclass CKLBUIList;\r\n\r\nclass CKLBListDrag : public CKLBDragCallbackIF\r\n{\r\npublic:\r\n\tCKLBListDrag(CKLBUIList * parent, const char * funcname);\r\n\tvirtual ~CKLBListDrag();\r\n\tvoid callback(PAD_ITEM::TYPE type, int tap_x, int tap_y, int mv_x, int mv_y);\r\n\r\nprivate:\r\n\tCKLBUIList\t\t*\tm_pParent;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIList\r\n* \\brief List Task Class\r\n* \r\n* CKLBUIList allows to create and manage lists of items.\r\n* It comes with its own scrollbar.\r\n* Items can be added dynamically and managed easily through\r\n* the several developped APIs.\r\n* \r\n*/\r\nclass CKLBUIList : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIList>;\r\n\tfriend class CKLBListDrag;\r\nprivate:\r\n\tCKLBUIList();\r\n\tvirtual ~CKLBUIList();\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tenum {\r\n\t\tLIST_FLAG_BOTTOM = 0x00000001,\t// アイテムを並べる基準点を、水平リストならばクリッピングの下端、\r\n\t\t\t\t\t\t\t\t\t\t// 垂直リストならばクリッピングの右端に変更する\r\n\r\n\t\tLIST_FLAG_MODAL  = 0x00000002,\t// リスト全体をモーダルコントロールとして表示する\r\n\t};\r\n\r\n\t// アイテム保持モード定数\r\n\tenum {\r\n\t\tLIST_ITEM_NORMAL,\r\n\t\tLIST_ITEM_DYNAMIC,\r\n\t\tLIST_ITEM_FLYWEIGHT,\r\n\t};\r\n\r\n\r\n\r\n\tstatic CKLBUIList * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\t\t\t\t\tfloat x, float y, float clip_width, float clip_height,\r\n\t\t\t\t\t\t\t\tint default_line_step, bool vertical = true,\r\n\t\t\t\t\t\t\t\tconst char * callback = NULL, u32 optional_flags = 0);\r\n\r\n\tbool initUI     (CLuaState& lua);\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tinline void setLoop(bool bLoop) {\r\n\t\tif(m_bLoop != bLoop) {\r\n\t\t\tm_posUpdate  = true;\r\n\t\t\tm_itemUpdate = true;\r\n\t\t\tm_scrBar.setOverScroll(bLoop || !m_chklimit);\r\n\t\t}\r\n\t\tm_bLoop = bLoop;\t\r\n\t}\r\n\r\n\tbool setItemMode(int mode, const char * dynamicCallback = NULL);\r\n\r\n\tbool useScrollBar(u32 order, bool side, int lineWeight,\r\n\t\t\t\t\t\tconst char * image, int min_slider_size,\r\n\t\t\t\t\t\tconst char * callback,\r\n\t\t\t\t\t\tu32 colorNormal, u32 colorSelect, bool active, bool hide_mode = false, bool short_hide = true);\r\n\r\n\tbool useScrollBarByProperty(CKLBPropertyBag * pProp, u32 priorityOffset);\r\n\r\n\tbool selectScrollMgr(const char * manager_name, int argc = 0, int * params = NULL);\r\n\tbool selectScrollMgrByProperty(CKLBPropertyBag * pProp);\r\n\r\n\r\n\tvoid setSplineLayout(float* array_, u32 setupBitmask, u32 curveLengthPixel);\r\n\r\nprivate:\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\tfloat x, float y, float clip_width, float clip_height,\r\n\t\t\t\tint default_line_step, bool vertical,\r\n\t\t\t\tconst char * callback, u32 optional_flags);\r\n\r\n\tbool initCore(\r\n\t\t\t\tu32 base_order, u32 max_order,\r\n\t\t\t\tfloat x, float y, float clip_width, float clip_height,\r\n\t\t\t\tint default_line_step, bool vertical,\r\n\t\t\t\tconst char * callback, u32 optional_flags);\r\n\r\npublic:\r\n\tvirtual void setVisible         (bool visible);\r\n\r\n\tinline u32\tgetWidth\t\t\t()\t\t\t\t\t{ return m_width;\t\t\t}\r\n\tinline u32\tgetHeight\t\t\t()\t\t\t\t\t{ return m_height;\t\t\t}\r\n\tinline int\tgetStepX\t\t\t()\t\t\t\t\t{ return m_stepX;\t\t\t}\r\n\tinline int\tgetStepY\t\t\t()\t\t\t\t\t{ return m_stepY;\t\t\t}\r\n\tinline u32\tgetOrder\t\t\t()\t\t\t\t\t{ return m_basePriority;\t}\r\n\tinline u32\tgetMaxOrder\t\t\t()\t\t\t\t\t{ return m_endPriority;\t\t}\r\n\tinline bool getVertical\t\t\t()\t\t\t\t\t{ return m_vertical;\t\t}\r\n\tinline u32\tgetItems\t\t\t()\t\t\t\t\t{ return m_itemCnt;\t\t\t}\r\n\tinline s32\tgetMarginTop\t\t()\t\t\t\t\t{ return m_marginTop;\t\t}\r\n\tinline s32\tgetMarginBottom\t\t()\t\t\t\t\t{ return m_marginBottom;\t}\r\n\tinline bool getDefaultScroll\t()\t\t\t\t\t{ return m_defScroll;\t\t}\r\n\t\r\n\tinline void setWidth\t\t\t(u32 width)\t\t\t{ \r\n\t\tif(m_width != width || m_clipWidth != width) {\r\n\t\t\tm_width = width;\r\n\t\t\tm_clipWidth = width;\r\n\t\t\tREFRESH_A;\r\n\t\t} \r\n\t}\r\n\tinline void setHeight\t\t\t(u32 height)\t\t{ \r\n\t\tif(m_height != height || m_clipHeight != height) {\r\n\t\t\tm_height = height;\t\r\n\t\t\tm_clipHeight = height;\t\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setStepX\t\t\t(int x)\t\t\t\t{ \r\n\t\tif(m_stepX != x) {\r\n\t\t\tm_stepX = x;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setStepY\t\t\t(int y)\t\t\t\t{ \r\n\t\tif(m_stepY != y) {\r\n\t\t\tm_stepY = y;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setOrder\t\t\t(u32 order)\t\t\t{ \r\n\t\tif(m_basePriority != order) {\r\n\t\t\tm_basePriority = order;\t\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setMaxOrder\t\t\t(u32 order)\t\t\t{ \r\n\t\tif(m_endPriority != order) {\r\n\t\t\tm_endPriority = order;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setVertical\t\t\t(bool vertical)\t\t{ \r\n\t\tif(m_vertical != vertical) {\r\n\t\t\tm_vertical = vertical;\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\tinline void setMarginTop\t\t(s32 top)\t\t\t{\r\n\t\tif (m_marginTop != top) {\r\n\t\t\tm_marginTop = top;\r\n\t\t\tREFRESH_A;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\tinline void setMarginBottom\t\t(s32 bottom)\t\t{\r\n\t\tif (m_marginBottom != bottom) {\r\n\t\t\tm_marginBottom = bottom;\r\n\t\t\tREFRESH_A;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\tinline void setDefaultScroll\t(bool scroll)\t\t{ \r\n\t\tif(m_defScroll != scroll) {\r\n\t\t\tm_defScroll = scroll;\t\r\n\t\t\tREFRESH_A; \r\n\t\t}\r\n\t}\r\n\r\n\tvoid setDragRect    (s32 left, s32 top, s32 right, s32 bottom);\r\n\r\n\tint  cmdItemAdd     (CLuaState& lua, int argc);\r\n\tbool cmdItemAdd     (const char* assetName);\r\n\tbool cmdItemAdd     (const char* assetName, int step, int id = -1);\r\n\tint  cmdItemInsert  (CLuaState& lua, int argc);\r\n\tbool cmdItemInsert  (const char* assetName, int idx);\r\n\tbool cmdItemInsert  (const char* assetName, int idx, int step, int id);\r\n\tbool cmdItemRemove  (int idx);\r\n\tvoid cmdItemMove    (int src, int dst);\r\n\tint  cmdItemRemoveSelection (CLuaState& lua, int argc);\r\n\tbool cmdItemRemoveSelection (int* idxList, u32 nbItems);\r\n\r\n\tvoid cmdFWModeConfig(int itemStep, int maxItems);\r\n\tvoid cmdFWItemAdd   (/* TODO */);\r\n\tvoid cmdFWItemInsert(/* TODO */);\r\n\r\n\tvoid cmdSetMargin   (int top, int bottom);\r\n\tbool cmdSetItemMode (int mode, const char* dynamicCallback);\r\n\r\n\tbool cmdAddRecords  (int insIdx, const char* tpform, u32 sizeTemplate, const char* dbrecs, u32 sizeDBRec, int step);\r\n\r\n\tint  cmdSetPosition (int pos, int dir);\r\n\tint  cmdSetInitial  (int);\r\n\tint cmdSetDragRect  (CLuaState& lua, int argc);\r\n\tint  cmdGetPosition ();\r\n\r\n\tvoid cmdSetItemID   (int index, int id);\r\n\tint  cmdSearchID    (int id);\r\n\r\n\tvoid cmdSetItemPos  (int mode, int idx, int offset);\r\n\r\n\tvoid cmdChangeStep  (int index, int step);\r\n\r\n\tvoid cmdSetLimitClip(bool chklimit, const char* limitCallback);\r\n\tint  cmdGetLimit    ();\r\n\tbool cmdSetLimitArea(int limitArea);\r\n\r\n\tbool cmdExistNode   (int index, const char* name);\r\n\tint  cmdUpdateNode  (CLuaState& lua, int argc);\r\n\tvoid cmdInputEnable (bool enable);\r\n\r\n\tvoid cmdAnimCallback    (const char* callback);\r\n\tbool cmdAnimationItem   (int index, const char* name, bool blend);\r\n\tbool cmdAnimationAll    (const char* name, bool blend);\r\n\tbool cmdItemAnimSkip    (int index, const char* name);\r\n\tbool cmdAllAnimSkip     (const char* name);\r\n\r\n\tbool cmdSelectScrMgr    (const char* name, int* params, int nb);\r\n\tbool cmdScrMgrCallback  (const char* callback);\r\n\tvoid cmdSetGroup        (const char* group_name);\r\n\tvoid cmdSetClip         (u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\tint  cmdGetItemCount    (CLuaState& lua, int argc);\r\n\tint  cmdGetItemForm     (CLuaState& lua, int argc);\r\n\r\n\tint  setPosition        (int pos);\r\n\tvoid updateEnable       ();\r\n\r\nprivate:\r\n\tu32                     m_width;\r\n\tu32                     m_height;\r\n\ts32                     m_marginTop;\r\n\ts32                     m_marginBottom;\r\n\tbool                    m_defScroll;\r\n\r\n\tCKLBNodeAnimPack\t\tm_animpack;\t\t// アニメーションパッケージ\r\n\tCKLBFormIF\t\t\t\tm_formIF;\t\t// Formパッケージ\r\n\tCKLBModalStack\t\t\tm_modalStack;\t// モーダルスタックパッケージ\r\n\r\n\t// リスト自体の操作許可情報\r\n\tbool\t\t\t\t\tm_bModalEnable;\r\n\r\n\t// clip情報\r\n\tu32\t\t\t\t\t\tm_basePriority;\t// クリッピング基点プライオリティ\r\n\tu32\t\t\t\t\t\tm_endPriority;\t// クリッピング終了プライオリティ\r\n\r\n\tfloat\t\t\t\t\tm_clipX;\r\n\tfloat\t\t\t\t\tm_clipY;\r\n\tint\t\t\t\t\t\tm_clipWidth;\r\n\tint\t\t\t\t\t\tm_clipHeight;\r\n\r\n\t// list配置情報\r\n\tbool\t\t\t\t\tm_vertical;\t\t// 縦配置フラグ(true:縦スクロール/false:横スクロール)\r\n\tbool\t\t\t\t\tm_chklimit;\t\t// 上限/下限制約をつける\r\n\tbool\t\t\t\t\tm_touchenable;\t// 入力取得許可/禁止\r\n\r\n\tint\t\t\t\t\t\tm_stepX;\t\t// 横方向のアイテム原点間隔(縦配置のときは0)\r\n\tint\t\t\t\t\t\tm_stepY;\t\t// 縦方向のアイテム原点間隔(横配置のときは0)\r\n\r\n\tint\t\t\t\t\t\tm_listLength;\t// リストの長さ\r\n\tint\t\t\t\t\t\tm_flags;\t\t// 動作オプションフラグ\r\n\r\n\t// Listの親ノード\r\n\t// 全てのアイテムは、このノードの下にぶらさがる。\r\n\tCKLBNode\t\t\t*\tm_pCtrlNode;\r\n\tint\t\t\t\t\t\tm_ctrlX;\r\n\tint\t\t\t\t\t\tm_ctrlY;\r\n\r\n\tvoid*\t\t\t\t\tm_clipHandle;\r\n\r\n\tfloat*\t\t\t\t\tm_layoutTable;\r\n\r\n\tfloat*\t\t\t\t\tm_layoutTableXY;\r\n\tfloat*\t\t\t\t\tm_layoutTableScale;\r\n\tfloat*\t\t\t\t\tm_layoutTableRotation;\r\n\tfloat*\t\t\t\t\tm_layoutTableAlpha;\r\n\tfloat*\t\t\t\t\tm_layoutTableRGB;\r\n\tfloat*\t\t\t\t\tm_layoutTablePriority;\r\n\tfloat*\t\t\t\t\tm_layoutTableLayout;\r\n\r\n\tu32\t\t\t\t\t\tm_curveLength;\r\n\tu16\t\t\t\t\t\tm_layoutInterlaceSize;\r\n\r\n\tconst char\t\t\t*\tm_pGroupName;\r\n\r\n\tstruct LISTITEM {\r\n\r\n\t\tLISTITEM\t\t*\tprev;\t// 前の項目\r\n\t\tLISTITEM\t\t*\tnext;\t// 次の項目\r\n\r\n\t\tbool\t\t\t\tenable;\t// 項目操作の許可禁止\r\n\r\n\t\tconst char\t\t*\tjsonp;\t// dynamic モードで使用。アイテム生成フォームのJSON\r\n\t\tu32\t\t\t\t\tjsonlen;\r\n\r\n\t\tCKLBNode\t\t*\tform;\t// 項目フォームのノード\r\n\t\tu32\t\t\t\t\thandle;\t// フォームアセットのハンドル\r\n\r\n\t\tSFormCtrlList\t\tctrl;\t// コントロールリスト\r\n\r\n\t\tint\t\t\t\t\tstep;\t// 項目の占有する幅\r\n\t\tint\t\t\t\t\tpos;\t// アイテムが現在存在する場所\r\n\t\tint\t\t\t\t\tindex;\t// アイテムのindex\r\n\t\tint\t\t\t\t\tid;\t\t// アイテムに与えられたID\r\n\r\n\t\t// このアイテムで起動されたタスクの一覧\r\n\t\tCKLBRegistedTaskList\ttaskList;\r\n\r\n\t\tLISTITEM()\r\n\t\t\t: prev  (NULL)\r\n            , next  (NULL)\r\n            , enable(false)\r\n            , jsonp (NULL)\r\n            , jsonlen   (0)\r\n            , form  (NULL)\r\n            , handle(0)\r\n            , ctrl  ()\r\n            , step  (0)\r\n            , pos   (0)\r\n            , index (0)\r\n            , id    (0)\r\n            , taskList  ()\r\n\t\t{}\r\n\t};\r\n\r\n\tLISTITEM\t\t*\tm_lstBegin;\r\n\tLISTITEM\t\t*\tm_lstEnd;\r\n\r\n\tLISTITEM\t\t*\tm_killBegin;\r\n\tLISTITEM\t\t*\tm_killEnd;\r\n\r\n\tint\t\t\t\t\tm_itemCnt;\t\t\t// 登録アイテム数\r\n\tint\t\t\t\t\tm_scrollPos;\t\t// スクロール位置\r\n\tbool\t\t\t\tm_enableEvents;\r\n\tbool\t\t\t\tm_force;\r\n\r\n\tint\t\t\t\t\tm_scrOffset;\t\t// スクロール位置オフセット\r\n\tint\t\t\t\t\tm_clipSize;\t\t\t// クリップサイズ\r\n\r\n\tbool\t\t\t\tm_itemUpdate;\t\t// アイテム更新フラグ\r\n\tbool\t\t\t\tm_posUpdate;\t\t// 表示位置更新フラグ\r\n\r\n\tbool\t\t\t\tm_bLoop;\t\t\t// ループ動作モード\r\n\r\n\tCKLBListDrag\t*\tm_dragCallback;\t\t// ドラッグ時のコールバック関数名\r\n\tconst char\t\t*\tm_limitCallback;\t// 終端ページ入りコールバック関数名\r\n\tbool\t\t\t\tm_limitCalled;\t\t// 既に終端コールバックを呼んだか否か\r\n\tint\t\t\t\t\tm_limitAreaSize;\t// 両端超過コールバックを呼びだす領域のサイズ\r\n\r\n\tconst char\t\t*\tm_dynamicCallback;\t// ダイナミックモードでアイテムの再生が終了した後に呼び出すコールバック\r\n\r\n\tint\t\t\t\t\tm_dragID;\r\n\tint\t\t\t\t\tm_dragX;\r\n\tint\t\t\t\t\tm_dragY;\r\n\ts32\t\t\t\t\tm_leftDrag;\r\n\ts32\t\t\t\t\tm_rightDrag;\r\n\ts32\t\t\t\t\tm_topDrag;\r\n\ts32\t\t\t\t\tm_bottomDrag;\r\n\ts32\t\t\t\t\tm_dragDistance;\r\n\r\n\tCKLBScrollBarIF\t\tm_scrBar;\t\t\t// スクロールバー\r\n\r\n\t// デフォルトスクロールで使用する。\r\n\tint\t\t\t\t\tm_defaultPrePos;\r\n\tint\t\t\t\t\tm_defaultDragPos;\r\n\tbool\t\t\t\tm_bTaped;\r\n\r\n\t// アイテム保持モード\r\n\tint\t\t\t\t\tm_itemMode;\r\n\r\n\tstruct FLYWEIGHT {\r\n\t\tint\t\t\tmaxitems;\t// 最大保持アイテム数\r\n\t\tint\t\t\titemstep;\t// \r\n\t};\r\n\tFLYWEIGHT\t\t\tm_flyweight;\r\n\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\r\n\r\nprivate:\r\n\tvoid        updateIndex ();\r\n\r\n\tbool        setClip     (u32 orderBegin, u32 orderEnd,\r\n\t\t\t\t\t         s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight);\r\n\r\n\tbool        resetClip   (u32 orderBegin, u32 orderEnd, s16 clipX, s16 clipY, s16 clipWidth, s16 clipHeight, bool forceClip);\r\n\r\n\tLISTITEM *  create_item (const char * json, u32 jsonLen, int id = -1, CKLBCompositeAsset * pAsset = NULL, IDataSource * pSource = NULL);\r\n\tvoid        delete_item (LISTITEM * pItem, bool kill_child = true);\r\n\r\n\tbool        load_itemform   (LISTITEM * pItem, const char * json, u32 jsonLen, CKLBCompositeAsset * pOrgAsset = NULL, IDataSource * pSource = NULL);\r\n\tbool        unload_itemform (LISTITEM * pItem, bool kill_child = true);\r\n\t\r\n\tinline void set_item_id (LISTITEM * pItem, int id = -1) { pItem->id = id; }\r\n\r\n\tint         get_item_index_by_id(int id);\r\n\r\n\tLISTITEM *  getItemByID (int id);\r\n\r\n\tLISTITEM *  getItemByIndex(int index);\r\n\r\n\t// 指定されたLuaスタック上のパラメータをJSON文字列に変換する\r\n\tconst char * toJSON(CLuaState& lua, int index, u32& size);\r\n\r\n\t// 指定されたLuaスタック上のパラメータを元に、テーブルにぶら下げるアイテムツリーを生成する。\r\n\tbool itemInsertUniversal(LISTITEM * posItem, int step, CLuaState& lua, int index, int id = -1);\r\n\r\n\t// JSONをもとにアイテムツリーを作り、\r\n\t// posItem とその直前のアイテムの間に挟む\r\n\tbool itemInsert(LISTITEM * posItem, int step, const char * json, u32 jsonLen, int id = -1,\r\n\t\t\t\t\tCKLBCompositeAsset * pAsset = 0, IDataSource * pSource = 0);\r\n\r\n\t// 指定されたアイテムを削除し、間を詰める\r\n\tvoid itemDelete(LISTITEM * posItem);\r\n\r\n\t// 削除予約されたアイテムインスタンスをすべて削除する\r\n\tvoid itemCleanUp(bool kill_child = true);\r\n\r\n\t// アイテムを挿入/破棄した後の処理として、各アイテムの配置を再計算する。\r\n\tvoid itemRealloc();\r\n\r\n\t// 直線型リストの表示位置再設定\r\n\tvoid setStraightPosition();\r\n\r\n\t// スプライン型リストの表示位置再設定\r\n\tvoid setSplinePosition();\r\n\r\n\t// タッチパッドイベント処理\r\n\tvoid touchpadEvent();\r\n\r\n\t\r\n\ts32 fromScreenDistanceToSplineDistance(s32 posPixelSpace);\r\n\r\n\t// Interpolation from spline lookup table for vec1,vec2,vec3\r\n\tvoid interpolate1(float* array_, float sub, float& res);\r\n\tvoid interpolate2(float* array_, float sub, float& resA, float& resB);\r\n\tvoid interpolate3(float* array_, float sub, float& resA, float& resB, float& resC);\r\n\r\n\t// デフォルトスクロール処理\r\n\tstatic void defaultScroll(void * pData, PAD_ITEM::TYPE type, int dragX, int dragY, int mvX, int mvY);\r\n\r\npublic:\r\n\tbool itemAddInsert(LISTITEM * posItem, const char* assetName, int step, int id);\r\n\t\r\n\tstatic const char * toJSON(const char* param, u32& size);\r\n};\r\n\r\n\r\n#endif // CKLBUIList_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIMoviePlayer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n//  CKLBUIMoviePlayer.cpp\r\n//  GameEngine\r\n//\r\n//\r\n\r\n#include \"CKLBUIMoviePlayer.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n\r\nenum {\r\n\tUI_MOVIE_SETPATH,\r\n\tUI_MOVIE_GETPATH,\r\n    \r\n    UI_MOVIE_PLAY,\r\n    UI_MOVIE_STOP,\r\n    UI_MOVIE_PAUSE,\r\n    UI_MOVIE_RESUME,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_MOVIE_SETPATH\", UI_MOVIE_SETPATH },\r\n\t{\"UI_MOVIE_GETPATH\", UI_MOVIE_GETPATH },\r\n\r\n    {\"UI_MOVIE_PLAY\",   UI_MOVIE_PLAY },\r\n\t{\"UI_MOVIE_STOP\",   UI_MOVIE_STOP },\r\n\t{\"UI_MOVIE_PAUSE\",  UI_MOVIE_PAUSE },\r\n\t{\"UI_MOVIE_RESUME\", UI_MOVIE_RESUME },\r\n    { 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIMoviePlayer> factory(\"UI_MoviePlayer\", CLS_KLBUIMOVIEPLAYER, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIMoviePlayer::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"width\",\t\tUINTEGER,\t(setBoolT)&CKLBUIMoviePlayer::setWidth,\t\t(getBoolT)&CKLBUIMoviePlayer::getWidth,\t\t0\t},\r\n\t{\t\"height\",\t\tUINTEGER,\t(setBoolT)&CKLBUIMoviePlayer::setHeight,\t(getBoolT)&CKLBUIMoviePlayer::getHeight,\t0\t},\r\n\t{\t\"value\",\t\tSTRING,\t\t(setBoolT)&CKLBUIMoviePlayer::setText,\t\t(getBoolT)&CKLBUIMoviePlayer::getText,\t\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n    \r\n\tARG_MODE,\r\n    \r\n\tARG_X,\r\n\tARG_Y,\r\n    \r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n    \r\n\tARG_VALUE,\t// 初期表示URL\r\n    \r\n    ARG_CALLBACK,   // command-URIを受け付ける場合は、その受付callbackを指定する\r\n    \r\n\tARG_REQUIRE = ARG_HEIGHT,\r\n\tARG_NUMS    = ARG_CALLBACK\r\n};\r\n\r\n\r\nCKLBUIMoviePlayer::CKLBUIMoviePlayer() \r\n: CKLBUITask    ()\r\n, m_pMovieNode  (NULL)\r\n, m_cmdCallback (NULL)\r\n, m_url         (NULL) \r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\n\r\nCKLBUIMoviePlayer::~CKLBUIMoviePlayer() \r\n{\r\n\tKLBDELETEA(m_url);\r\n}\r\n\r\nu32\r\nCKLBUIMoviePlayer::getClassID()\r\n{\r\n\treturn CLS_KLBUIMOVIEPLAYER;\r\n}\r\n\r\n\r\nCKLBUIMoviePlayer *\r\nCKLBUIMoviePlayer::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                          bool mode, float x, float y,\r\n                          float width, float height,\r\n                          const char * url, const char * callback)\r\n{\r\n\tCKLBUIMoviePlayer * pTask = KLBNEW(CKLBUIMoviePlayer);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, mode, x, y, width, height, url, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIMoviePlayer::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                        bool mode, float x, float y,\r\n                        float width, float height,\r\n                        const char * url, const char * callback)\r\n{\r\n    if(!setupNode()) { return false; }\r\n    \r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(mode, x, y, width, height, url, callback);\r\n    \r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n    \r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIMoviePlayer::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n    \r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tbool mode       = lua.getBool(ARG_MODE);\r\n\tfloat width     = lua.getFloat(ARG_WIDTH);\r\n\tfloat height    = lua.getFloat(ARG_HEIGHT);\r\n\tconst char * url        = (argc >= ARG_VALUE)    ? lua.getString(ARG_VALUE)     : NULL;\r\n    const char * callback   = (argc >= ARG_CALLBACK) ? lua.getString(ARG_CALLBACK)  : NULL;\r\n    \r\n\treturn initCore(mode, x, y, width, height, url, callback);\r\n}\r\n\r\nbool\r\nCKLBUIMoviePlayer::initCore(bool mode, float x, float y,\r\n                            float width, float height,\r\n                            const char * url, const char * callback)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\tsetInitPos(x, y);\r\n\tm_width  = width;\r\n\tm_height = height;\r\n\r\n\tconst char * str = (url) ? url : \"\";\r\n    bool background = mode;\r\n\tsetStrC(m_url, str);\r\n    m_cmdCallback = (!callback) ? NULL : CKLBUtility::copyString(callback);\r\n        \r\n\tm_pMovieNode = KLBNEWC( CKLBMovieNode, (str, background) );\r\n    getNode()->addNode(m_pMovieNode);\r\n\tm_pMovieNode->setWidth(m_width);\r\n\tm_pMovieNode->setHeight(m_height);\r\n    \r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIMoviePlayer::execute(u32 /* deltaT */)\r\n{\r\n\tif(CHANGE_A) {\r\n\t\tm_pMovieNode->setWidth(m_width);\r\n\t\tm_pMovieNode->setHeight(m_height);\r\n\t\tRESET_A;\r\n\t}\r\n\r\n\tif(CHANGE_B) {\r\n\t\tm_pMovieNode->setText(m_url);\r\n\t\tRESET_B;\r\n\t}\r\n    \r\n    // 再生が終了したら、設定されているコールバックを呼び出す\r\n    if(m_pMovieNode->getWidget()) {\r\n        if(m_pMovieNode->getWidget()->status()) {\r\n            CKLBScriptEnv::getInstance().call_eventMovie(m_cmdCallback, this);\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCKLBUIMoviePlayer::dieUI()\r\n{\r\n\tKLBDELETE(m_pMovieNode);\r\n    KLBDELETEA(m_cmdCallback);\r\n}\r\n\r\nint\r\nCKLBUIMoviePlayer::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n        default:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n        }\r\n            break;\r\n        case UI_MOVIE_SETPATH:\r\n        {\r\n            bool result = false;\r\n            if(argc == 3) {\r\n                const char * path = lua.getString(3);\r\n\t\t\t\tsetText(path);\r\n                result = true;                                                  \r\n            }\r\n            lua.retBool(result);\r\n            ret = 1;\r\n        }\r\n            break;\r\n        case UI_MOVIE_GETPATH:\r\n        {\r\n            if(argc == 2) {\r\n                const char * path = getText();\r\n                lua.retString(path);\r\n            } else {\r\n                lua.retNil();\r\n            }\r\n            ret = 1;\r\n        }\r\n            break;\r\n            \r\n        case UI_MOVIE_PLAY:\r\n        {\r\n            bool result = false;\r\n            if(argc == 2) {\r\n\t\t\t\tmoviePlay();\r\n                result = true;\r\n            }\r\n            lua.retBool(result);\r\n            ret = 1;\r\n        }\r\n            break;\r\n        case UI_MOVIE_STOP:\r\n        {\r\n            bool result = false;\r\n            if(argc == 2) {\r\n\t\t\t\tmovieStop();\r\n                result = true;\r\n            }\r\n            lua.retBool(result);\r\n            ret = 1;\r\n        }\r\n            break;\r\n        case UI_MOVIE_PAUSE:\r\n        {\r\n            bool result = false;\r\n            if(argc == 2) {\r\n\t\t\t\tmoviePause();\r\n                result = true;\r\n            }\r\n            lua.retBool(result);\r\n            ret = 1;\r\n        }\r\n            break;\r\n        case UI_MOVIE_RESUME:\r\n        {\r\n            bool result = false;\r\n            if(argc == 2) {\r\n\t\t\t\tmovieResume();\r\n                result = true;\r\n            }\r\n            lua.retBool(result);\r\n            ret = 1;            \r\n        }\r\n            break;\r\n    }\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIMoviePlayer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIMoviePlayer_h\r\n#define CKLBUIMoviePlayer_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBMovieNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIMoviePlayer\r\n* \\brief Movie Player Task Class\r\n* \r\n* CKLBUIMoviePlayer is used to play movies into the Game.\r\n* It provides a few APIs to manage the movie display and some\r\n* playing option (play, stop, pause, resume).\r\n* The task is platform independant as it uses a CKLBMovieNode which\r\n* uses itself an implementation of IWidget that is platform specific.\r\n*\r\n* /!\\ CKLBUIMoviePlayer does NOT work on Windows at the moment.\r\n*/\r\nclass CKLBUIMoviePlayer : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIMoviePlayer>;\r\nprivate:\r\n\tCKLBUIMoviePlayer();\r\n\tvirtual ~CKLBUIMoviePlayer();\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUIMoviePlayer * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                                      bool mode, float x, float y,\r\n                                      float width, float height,\r\n                                      const char * url, const char * callback);\r\n    \r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n    \r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline void setWidth(u32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_width = width;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinline u32  getWidth() {\r\n\t\treturn m_width;\r\n\t}\r\n\r\n\tinline void setHeight(u32 height) {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_height = height;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getHeight() {\r\n\t\treturn m_height;\r\n\t}\r\n\r\n\tinline void setText(const char* text) {\r\n\t\tif (text) {\r\n\t\t\tif (CKLBUtility::safe_strcmp(text, m_url)!=0) {\r\n\t\t\t\tsetStrC(m_url,text);\r\n\t\t\t\tREFRESH_B;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (CKLBUtility::safe_strcmp(\"\", m_url)!=0) {\r\n\t\t\t\tsetStrC(m_url,\"\");\r\n\t\t\t\tREFRESH_B;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tinline const char* getText() { return m_url; }\r\n\r\n\tinline void moviePlay   ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_PLAY);   }\r\n\tinline void movieStop   ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_STOP);   }\r\n\tinline void moviePause  ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_PAUSE);  }\r\n\tinline void movieResume ()\t\t\t\t{ m_pMovieNode->command(IWidget::MV_RESUME); }\r\n\r\nprivate:\r\n\tu32\t        m_width;\r\n\tu32         m_height;\r\n\tconst char* m_url;\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              bool mode, float x, float y,\r\n              float width, float height,\r\n              const char * url, const char * callback);\r\n    \r\n\tbool initCore(bool mode, float x, float y,\r\n                  float width, float height,\r\n                  const char * url, const char * callback);\r\n    \r\n\tCKLBMovieNode\t*\tm_pMovieNode;\r\n    \r\n    const char      *   m_cmdCallback;\r\n    \r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIMoviePlayer_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIMultiImgItem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIMultiImgItem.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_MULTIIMG_SET_INDEX = 0,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_MULTIIMG_SET_INDEX\", UI_MULTIIMG_SET_INDEX },\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIMultiImgItem> factory(\"UI_MultiImgItem\", CLS_KLBUIMULTIIMGITEM, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIMultiImgItem::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUIMultiImgItem::setOrder,\t(getBoolT)&CKLBUIMultiImgItem::getOrder,\t0\t},\r\n\t{\t\"index\",\tUINTEGER,\t(setBoolT)&CKLBUIMultiImgItem::setIndex,\t(getBoolT)&CKLBUIMultiImgItem::getIndex,\t0\t},\r\n\t{\t\"idxmax\",\tUINTEGER,\t(setBoolT)&CKLBUIMultiImgItem::setIndexMax,\t(getBoolT)&CKLBUIMultiImgItem::getIndexMax,\t0\t}\r\n\t// TODO : Useless property -> Does not exist, isnt used !\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ASSET_LIST,\r\n\r\n\tARG_INDEX,\r\n\r\n\tARG_REQUIRE = ARG_ASSET_LIST,\r\n\tARG_NUMS = ARG_INDEX\r\n};\r\n\r\nCKLBUIMultiImgItem::CKLBUIMultiImgItem()\r\n: CKLBUITask    ()\r\n, m_items       (NULL)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIMultiImgItem::~CKLBUIMultiImgItem() \r\n{\r\n}\r\n\r\nCKLBUIMultiImgItem* \r\nCKLBUIMultiImgItem::create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount) \r\n{\r\n\tCKLBUIMultiImgItem* pTask = KLBNEW(CKLBUIMultiImgItem);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParent, pNode, order, x,y,idx,pArrayAsset, pArrayIndexes, assetCount)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool CKLBUIMultiImgItem::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount) {\r\n\tif(!setupNode()) return false;\r\n\r\n\t//\r\n\t// Create array and load resources.\r\n\t//\r\n\tu32 max = 0;\r\n\tfor(u32 i = 0; i < assetCount; i++) {\r\n\t\tu32 idxImg = pArrayIndexes[i];\r\n        if(max < idxImg) { max = idxImg; }\r\n\t}\r\n\t\r\n\tmax++;\r\n\r\n\tIMGITEM* items = KLBNEWA(IMGITEM, max);\r\n\tif(!items) { return false; }\r\n\r\n\t// Reset all handle to NULL\r\n\tfor(u32 i=0; i < max; i++) {\r\n\t\titems[i].handle\t= 0;\r\n\t\titems[i].sprite = NULL;\r\n\t}\r\n\r\n\tCKLBRenderingManager& rdr = CKLBRenderingManager::getInstance();\r\n\tfor(u32 i = 0; i < assetCount; i++) {\r\n\t\tconst char* name = pArrayAsset[i];\r\n\t\tu32 idxImg = pArrayIndexes[i];\r\n\t\tu32 handle;\r\n\t\tCKLBAsset * pAsset = CKLBUtility::loadAsset(name, &handle, NULL);\r\n\t\tif(pAsset->getAssetType() == ASSET_IMAGE) {\r\n\t\t\tCKLBSprite*\tpRender\t= rdr.allocateCommandSprite((CKLBImageAsset*)pAsset,order);\r\n\r\n\t\t\titems[idxImg].handle = handle;\r\n\t\t\titems[idxImg].sprite = pRender;\r\n\t\t}\r\n\t}\r\n\r\n\tbool bResult = initCore(order,x,y,idx,items,max);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool \r\nCKLBUIMultiImgItem::initCore(u32 order,float x,float y, u32 index, IMGITEM* pIndexes, u32 max)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\r\n\t// 領域を確保\r\n\tm_cntImg    = max;\r\n\tm_items     = pIndexes;\r\n    if(!m_items) { return false; }\r\n\tm_idxMax    = m_cntImg - 1;\t// 最大index値を追加する\r\n\r\n\tREFRESH_A;\r\n\tREFRESH_B;\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order     = order;\r\n\tsetIndex(index);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIMultiImgItem::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tfloat x     = lua.getFloat(ARG_X);\r\n\tfloat y     = lua.getFloat(ARG_Y);\r\n\tu32 order   = lua.getInt(ARG_ORDER);\r\n\tu32 idxImg  = (argc >= ARG_INDEX) ? lua.getInt(ARG_INDEX) : 0;\r\n\t\r\n\t// asset list を取得\r\n\tlua.retValue(ARG_ASSET_LIST);\r\n\r\n\t// 要素の数を数える\r\n\tint max = 0;\r\n\tlua.retNil();\r\n\r\n\t// Read indexes and count entries.\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint idx = lua.getInt(-1);\r\n\t\tif(max < idx) max = idx;\r\n\t\tlua.pop(2);\r\n\t}\r\n\r\n\tIMGITEM* items = KLBNEWA(IMGITEM, max);\r\n\r\n    if(!items) { return false; }\r\n\r\n\t// Reset all handle to NULL\r\n\tfor(int idx = 0; idx < max; idx++) {\r\n\t\titems[idx].handle = 0;\r\n\t\titems[idx].sprite = NULL;\r\n\t}\r\n\r\n\tm_order = order; // Needed for getImgList\r\n    if(!getImgList(lua,items,max)) { return false; }\r\n\treturn initCore(order, x,y,idxImg,items,max);\r\n}\r\n\r\nbool\r\nCKLBUIMultiImgItem::getImgList(CLuaState& lua, IMGITEM* items, u32 /*max*/)\r\n{\r\n\tCKLBRenderingManager& rdr = CKLBRenderingManager::getInstance();\r\n\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint idx = lua.getInt(-1) - 1;\r\n\t\tconst char * name = lua.getString(-2);\r\n\t\tlua.pop(2);\r\n\r\n\t\tu32 handle;\r\n\t\tCKLBAsset * pAsset = CKLBUtility::loadAsset(name, &handle, NULL);\r\n\t\tif(pAsset->getAssetType() == ASSET_IMAGE) {\r\n\t\t\tCKLBSprite*\tpRender\t= rdr.allocateCommandSprite((CKLBImageAsset*)pAsset,m_order);\r\n\r\n\t\t\titems[idx].handle = handle;\r\n\t\t\titems[idx].sprite = pRender;\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nint\r\nCKLBUIMultiImgItem::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_MULTIIMG_SET_INDEX:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint idx = lua.getInt(3);\r\n\t\t\t// 指定されたindexが有効な範囲に収まらなければ、何もせずfalseを返す\r\n\t\t\tint max = m_idxMax;\r\n\t\t\tif(idx > max || idx < 0) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tsetIndex(idx);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIMultiImgItem::execute(u32 /* deltaT */)\r\n{\r\n\tif(CHANGE_A) {\r\n\t\tCKLBNode* pNode = getNode();\r\n\t\tpNode->setRender(m_items[m_idxImg].sprite,0);\r\n\t\tpNode->markUpMatrix();\r\n\t\tRESET_A;\r\n\t}\r\n\r\n\tif(CHANGE_B) {\r\n\t\tu32 max = m_idxMax;\r\n\r\n\t\t// 最大値の書き換えは是正する\r\n\t\tif(max >= m_cntImg) {\r\n\t\t\tmax = m_cntImg - 1;\r\n\t\t\tm_idxMax = max;\r\n\t\t}\r\n\r\n\t\tif(m_idxImg <= max) {  /* && m_idxImg >= 0 : m_idxImg is unsigned */\r\n\t\t\tCKLBNode* pNode = getNode();\r\n\t\t\tCKLBRenderingManager& rdr = CKLBRenderingManager::getInstance();\r\n\t\t\tm_items[m_idxImg].sprite->changeOrder(rdr,m_order);\r\n\t\t\tif(m_items[m_idxImg].sprite != pNode->getRender(0)) {\r\n\t\t\t\tpNode->setRender(m_items[m_idxImg].sprite,0);\r\n\t\t\t\tpNode->markUpMatrix();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tRESET_B;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIMultiImgItem::dieUI()\r\n{\r\n\tgetNode()->setRender(NULL,0);\r\n\tCKLBRenderingManager& rdr = CKLBRenderingManager::getInstance();\r\n\tfor(u32 i = 0; i < m_cntImg; i++) {\r\n\t\tCKLBDataHandler::releaseHandle(m_items[i].handle);\r\n\t\trdr.releaseCommand(m_items[i].sprite);\r\n\t}\r\n\tKLBDELETEA(m_items);\r\n}\r\n\r\nu32\r\nCKLBUIMultiImgItem::getClassID()\r\n{\r\n\treturn CLS_KLBUIMULTIIMGITEM;\r\n}\r\n\r\n// TODO C# - check this method.\r\nbool \r\nCKLBUIMultiImgItem::changeAssets(const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount)\r\n{\r\n\tgetNode()->setRender(NULL,0);\r\n\tCKLBRenderingManager& rdr = CKLBRenderingManager::getInstance();\r\n\tfor(u32 i = 0; i < m_cntImg; i++) {\r\n\t\tCKLBDataHandler::releaseHandle(m_items[i].handle);\r\n\t\trdr.releaseCommand(m_items[i].sprite);\r\n\t}\r\n\tKLBDELETEA(m_items);\r\n\r\n\tu32 max = 0;\r\n\tfor(u32 idx = 0; idx < assetCount; idx++) {\r\n\t\tu32 idxImg = pArrayIndexes[idx];\r\n\t\tif (max < idxImg) max = idxImg;\r\n\t}\r\n\t\r\n\tmax++;\r\n\r\n\tIMGITEM* items = KLBNEWA(IMGITEM, max);\r\n\tif(!items) { return false; }\r\n\r\n\t// Reset all handle to 0\r\n\tfor(u32 idx = 0; idx < max; idx++) {\r\n\t\titems[idx].handle = 0;\r\n\t\titems[idx].sprite = NULL;\r\n\t}\r\n\r\n\tfor(u32 i=0; i < assetCount; i++) {\r\n\t\tconst char* name = pArrayAsset[i];\r\n\t\tu32 idxImg = pArrayIndexes[i];\r\n\t\tu32 handle;\r\n\t\tCKLBAsset * pAsset = CKLBUtility::loadAsset(name, &handle, NULL);\r\n\t\tif (pAsset->getAssetType() == ASSET_IMAGE) {\r\n\t\t\tCKLBSprite*\tpRender\t= rdr.allocateCommandSprite((CKLBImageAsset*)pAsset,m_order);\r\n\r\n\t\t\titems[idxImg].handle = handle;\r\n\t\t\titems[idxImg].sprite = pRender;\r\n\t\t}\r\n\t}\r\n\r\n\tm_cntImg    = max;\r\n\tm_items     = items;\r\n\tm_idxMax    = m_cntImg - 1;\t// 最大index値を追加する\r\n\r\n\tREFRESH_A;\r\n\tREFRESH_B;\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIMultiImgItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIMultiImgItem_h\r\n#define CKLBUIMultiImgItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\nstruct IMGITEM {\r\n\tu32\t\t\t\thandle;\r\n\tCKLBSprite*\t\tsprite;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIMultiImgItem\r\n* \\brief Multi Images Item Task Class\r\n* \r\n* CKLBUIMultiImgItem is used to regroup some images into one Task.\r\n* One image only is displayed every frame, but the active image can be changed\r\n* at any moment through provided APIs.\r\n*/\r\nclass CKLBUIMultiImgItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIMultiImgItem>;\r\nprivate:\r\n\tCKLBUIMultiImgItem();\r\n\tvirtual ~CKLBUIMultiImgItem();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\tbool initCore(u32 order,float x,float y, u32 index, IMGITEM* pIndexes, u32 max);\r\npublic:\r\n\tu32 getClassID();\r\n\tstatic CKLBUIMultiImgItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getIndexMax() { return m_idxMax; }\r\n\tinline void setIndexMax(u32 index) {\r\n\t\tif (index != m_idxMax) {\r\n\t\t\tm_idxMax = index;\r\n\t\t\tif(m_idxImg > m_idxMax) {\r\n\t\t\t\tm_idxImg = m_idxMax;\r\n\t\t\t}\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32 getOrder() { return m_order; }\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif(order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getIndex() { return m_idxImg; }\r\n\tinline void setIndex(u32 index) {\r\n\t\tif(index != m_idxImg) {\r\n\t\t\tm_idxImg = (index <= m_idxMax) ? index : m_idxMax;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tbool changeAssets(const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount);\r\n\r\nprotected:\r\n\tIMGITEM\t\t*\tm_items;\t// イメージの情報\r\n\r\n\tbool getImgList(CLuaState& lua, IMGITEM* items, u32 max);\r\nprivate:\r\n\r\n\tu32\t\t\t\tm_idxMax;\r\n\tu32\t\t\t\tm_cntImg;\t// 与えられたイメージの数\r\n\tu32\t\t\t\tm_idxImg;\t// 現在表示されているイメージのindex\r\n\tu32\t\t\t\tm_order;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBMultiImgItem_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIPieChart.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdio.h>\r\n#include <math.h>\r\n#include \"CKLBUIPieChart.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\nenum {\r\n\tUI_PIE_SET_START,\r\n\tUI_PIE_SET_END,\r\n\tUI_PIE_SET_VALUE,\r\n};\r\n\r\nIFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_PIE_SET_START\",\tUI_PIE_SET_START\t},\r\n\t{ \"UI_PIE_SET_END\",\t\tUI_PIE_SET_END\t\t},\r\n\t{ \"UI_PIE_SET_VALUE\",\tUI_PIE_SET_VALUE\t},\r\n\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIPieChart> factory(\"UI_PieChart\", CLS_KLBUIPIECHART, cmd);\r\n\r\nconst CKLBUIPieChart::VERTMAP CKLBUIPieChart::ms_vertMaster[] = {\r\n\t{  0.0f,  0.0f, 0.5f, 0.5f },\t// 中心\r\n\r\n\t{  0.0f, -1.0f, 0.5f, 0.0f },\t// 上辺中央\r\n\t{  1.0f, -1.0f, 1.0f, 0.0f },\t// 上辺右 / 右辺上\r\n\r\n\t{  1.0f, -1.0f, 1.0f, 0.0f },\t// 上辺右 / 右辺上\r\n\t{  1.0f,  0.0f, 1.0f, 0.5f },\t// 右辺中央\r\n\r\n\t{  1.0f,  0.0f, 1.0f, 0.5f },\t// 右辺中央\r\n\t{  1.0f,  1.0f, 1.0f, 1.0f },\t// 右辺下 / 下辺右\r\n\r\n\t{  1.0f,  1.0f, 1.0f, 1.0f },\t// 右辺下 / 下辺右\r\n\t{  0.0f,  1.0f, 0.5f, 1.0f },\t// 下辺中央\r\n\r\n\t{  0.0f,  1.0f, 0.5f, 1.0f },\t// 下辺中央\r\n\t{ -1.0f,  1.0f, 0.0f, 1.0f },\t// 下辺左 / 左辺下\r\n\r\n\t{ -1.0f,  1.0f, 0.0f, 1.0f },\t// 下辺左 / 左辺下\r\n\t{ -1.0f,  0.0f, 0.0f, 0.5f },\t// 左辺中央\r\n\r\n\t{ -1.0f,  0.0f, 0.0f, 0.5f },\t// 左辺中央\r\n\t{ -1.0f, -1.0f, 0.0f, 0.0f },\t// 左辺上 / 上辺左\r\n\r\n\t{ -1.0f, -1.0f, 0.0f, 0.0f },\t// 左辺上 / 上辺左\r\n\t{  0.0f, -1.0f, 0.5f, 0.0f },\t// 上辺中央に戻ってくる\r\n};\r\n\r\nconst int CKLBUIPieChart::ms_idxMaster[][3] = {\r\n\t{ 0, 1, 2 },\r\n\t{ 0, 3, 4 },\r\n\t{ 0, 5, 6 },\r\n\t{ 0, 7, 8 },\r\n\r\n\t{ 0, 9, 10 },\r\n\t{ 0, 11, 12 },\r\n\t{ 0, 13, 14 },\r\n\t{ 0, 15, 16 },\r\n};\r\n\r\n// property key list\r\nCKLBLuaPropTask::PROP_V2 CKLBUIPieChart::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIPieChart::getOrder,\t0\t},\r\n// Value never set in constructor\r\n//\t{\t\"asset\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIPieChart::getAsset,\t0\t},\r\n\t{\t\"start\",\tNUMERIC,\t(setBoolT)&CKLBUIPieChart::setStart,\t(getBoolT)&CKLBUIPieChart::getStart,\t0\t},\r\n\t{\t\"end\",\t\tNUMERIC,\t(setBoolT)&CKLBUIPieChart::setEnd,\t\t(getBoolT)&CKLBUIPieChart::getEnd,\t\t0\t},\r\n\t{\t\"value\",\tNUMERIC,\t(setBoolT)&CKLBUIPieChart::setValue,\t(getBoolT)&CKLBUIPieChart::getValue,\t0\t},\r\n\t{\t\"anim\",\t\tR_INTEGER,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIPieChart::getAnim,\t\t0\t}\r\n};\r\n\r\n// argument indices\r\nenum {\r\n\tARG_PARENT\t= 1,\r\n\r\n\tARG_ORDER,\t\t// プライオリティ\r\n\tARG_X,\t\t\t// 円グラフ中心の x座標\r\n\tARG_Y,\t\t\t// 円グラフ中心の y座標\r\n\r\n\tARG_WIDTH,\t\t// 円グラフ表示サイズ\r\n\tARG_HEIGHT,\t\t// 円グラフ表示サイズ\r\n\r\n\tARG_ASSET,\t\t// asset名\r\n\r\n\tARG_START,\t\t// グラフの開始点(degree)\r\n\tARG_END,\t\t// グラフの終了点(degree)\r\n\r\n\tARG_ANIM,\t\t// アニメーション時間\r\n\r\n\tARG_INITIAL,\t// 初期値\r\n\r\n\tARG_REQUIRE = ARG_END,\r\n\tARG_MAXNUM  = ARG_INITIAL\r\n};\r\n\r\nCKLBUIPieChart::CKLBUIPieChart() \r\n: CKLBUITask()\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIPieChart::~CKLBUIPieChart() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIPieChart::getClassID()\r\n{\r\n\treturn CLS_KLBUIPIECHART;\r\n}\r\n\r\nCKLBUIPieChart *\r\nCKLBUIPieChart::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                       u32 order, float x, float y, float width, float height,\r\n                       const char * asset, float start, float end, int anim, float initial)\r\n{\r\n\tCKLBUIPieChart * pTask = KLBNEW(CKLBUIPieChart);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode,\r\n\t\t\t\t\torder, x, y, width, height,\r\n\t\t\t\t\tasset, start, end, anim, initial)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIPieChart::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                     u32 order, float x, float y, float width, float height,\r\n                     const char * asset, float start, float end, int anim, float initial)\r\n{\r\n\tif(!setupNode()) return false;\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, width, height, asset, start, end, anim, initial);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIPieChart::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_MAXNUM) return false;\r\n\r\n\tu32   order     = lua.getInt(ARG_ORDER);\r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tfloat width     = lua.getFloat(ARG_WIDTH);\r\n\tfloat height    = lua.getFloat(ARG_HEIGHT);\r\n\tconst char * asset = lua.getString(ARG_ASSET);\r\n\tfloat start     = lua.getFloat(ARG_START);\r\n\tfloat end       = lua.getFloat(ARG_END);\r\n\tint   anim      = (argc >= ARG_ANIM)    ? lua.getInt(ARG_ANIM)      : 0;\r\n\tfloat initial   = (argc >= ARG_INITIAL) ? lua.getFloat(ARG_INITIAL) : 0.0f;\r\n\r\n\treturn initCore(order, x, y, width, height, asset, start, end, anim, initial);\r\n}\r\n\r\nbool\r\nCKLBUIPieChart::initCore(u32 order, float x, float y, float width, float height,\r\n                         const char * asset, float start, float end, int anim, float initial)\r\n{\r\n\t// 保持プロパティを定義\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\tm_start = start;\r\n\tm_end   = end;\r\n\tm_anim  = anim;\r\n\r\n\tm_texWidth  = width;\r\n\tm_texHeight = height;\r\n\r\n\t// asset の取得\r\n\tm_pImgAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset, &m_texHandle);\r\n\tif(!m_pImgAsset) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 必要とされるオブジェクトを生成する\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\tm_pDynSprite = pRdrMgr.allocateCommandDynSprite(8*3,8*3);\t// 中央から8分割(45度ごと)\r\n\r\n\tm_pNode = KLBNEW(CKLBNode);\r\n\tif((!m_pDynSprite) || (!m_pNode)) {\r\n\t\tCKLBDataHandler::releaseHandle(m_texHandle);\r\n\t\tKLBDELETE(m_pNode);\r\n\t\tKLBDELETE(m_pDynSprite);\r\n\t\treturn false;\r\n\t}\r\n\r\n\tklb_assert(m_pImgAsset->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in PieChart task.\");\r\n\tm_pDynSprite->setTexture(m_pImgAsset);\r\n\tm_pNode->setRender(m_pDynSprite);\r\n\tm_pNode->setRenderOnDestroy(true);\r\n\tm_pNode->setPriority(order);\r\n\r\n\t// 自身の持つノードに追加\r\n\tgetNode()->addNode(m_pNode);\r\n\r\n\t// 初期状態の頂点を設定する\r\n\tm_value     = initial;\r\n\tm_prevRate  = m_value;\r\n\tm_bAnim     = false;\r\n\tREFRESH_A;\r\n\r\n\tsetVertices(initial);\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIPieChart::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(m_pNode, m_texHandle);\r\n}\r\n\r\nint\r\nCKLBUIPieChart::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tklb_assertAlways(\"unknown command: %d\", cmd);\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PIE_SET_START:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tfloat start = lua.getFloat(3);\r\n\t\t\t\tsetStart(start);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PIE_SET_END:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tfloat end = lua.getFloat(3);\r\n\t\t\t\tsetEnd(end);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PIE_SET_VALUE:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tfloat value = lua.getFloat(3);\r\n\t\t\t\tsetValue(value);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIPieChart::execute(u32 deltaT)\r\n{\r\n\tif(CHANGE_A) {\r\n\t\tif (!m_bAnim) {\r\n\t\t\tm_bAnim     = true;\r\n\t\t\tm_iTimeCnt  = 0;\r\n\t\t\tm_nowRate   = m_prevRate;\r\n\t\t}\r\n\t} else {\r\n\t\tm_prevRate = m_value;\r\n\t}\r\n\r\n\tif(m_bAnim) {\r\n\t\tint p_anim = m_anim;\r\n\t\tm_iTimeCnt += deltaT;\r\n\r\n\t\tfloat rate = (!p_anim) ? 1.0f : ((float)m_iTimeCnt/p_anim);\r\n\t\tif(rate > 1.0f) rate = 1.0f;\r\n\r\n\t\tfloat value = m_nowRate + (m_value - m_nowRate) * rate;\r\n\r\n\t\t// アニメーション中に書き換える\r\n\t\tsetVertices(value);\r\n\r\n\t\tif(rate >= 1.0f) {\r\n\t\t\tm_bAnim     = false;\r\n\t\t\tm_prevRate  = m_value;\r\n\t\t\tRESET_A;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIPieChart::setVertices(float value)\r\n{\r\n\t// 描画開始角と終了角の値を整理する\r\n\tfloat start = m_start;\r\n\tfloat end \t= m_end;\r\n\tfloat theta = (end - start) * value + start;\r\n\tfloat min, max;\r\n\tif(start <= theta) {\r\n\t\tmin = start;\r\n\t\tmax = theta;\r\n\t} else {\r\n\t\tmin = theta;\r\n\t\tmax = start;\r\n\t}\r\n\t// 値が一周以上している場合は明らかに全部描画する\r\n\tif((max - min) >= 360.0f) {\r\n\t\tmin = 0.0f;\r\n\t\tmax = 360.0f;\r\n\t}\r\n\r\n\t// 値の差が一定以上であれば 0 とみなし、表示しない。\r\n\tbool visible = ((max - min) < 0.001f) ? false : true;\r\n\tm_pNode->setVisible(visible);\r\n\r\n\t// 表示しない場合\r\n    if(!visible) { return; }\r\n\r\n\tfloat half_w, half_h, ub, vb, uw, vh;\r\n\thalf_w = m_texWidth / 2.0f;\r\n\thalf_h = m_texHeight / 2.0f;\r\n\tm_pImgAsset->getUV(0, &ub, &vb);\r\n\tm_pImgAsset->getUV(2, &uw, &vh);\r\n\tuw -= ub;\r\n\tvh -= vb;\r\n\r\n\t// とりあえず頂点データをフルで作る\r\n\tfor(int i = 0; i < 17; i++) {\r\n\t\tm_vertices[i].x = half_w * ms_vertMaster[i].x;\r\n\t\tm_vertices[i].y = half_h * ms_vertMaster[i].y;\r\n\t\tm_vertices[i].u = ub + uw * ms_vertMaster[i].u;\r\n\t\tm_vertices[i].v = vb + vh * ms_vertMaster[i].v;\r\n\t}\r\n\r\n\t// min, max に合わせて必要な三角形の頂点をいじる\r\n\tint min_idx = (int)(min / 45.0f);\r\n\tint max_idx = (int)(max / 45.0f);\r\n\tfloat min45 = min - 45.0f * min_idx;\r\n\tfloat max45 = max - 45.0f * max_idx;\r\n\tif(max_idx > 0 && max45 < 0.0001f) {\r\n\t\tmax45 = 45.0f;\r\n\t\tmax_idx--;\r\n\t}\r\n\r\n    if(min_idx & 1) { min45 = 45.0f - min45; }\r\n\tif(max_idx & 1) { max45 = 45.0f - max45; }\r\n\r\n\tfloat min_n = tan(min45 * M_PI / 180.0f);\r\n\tfloat max_n = tan(max45 * M_PI / 180.0f);\r\n\r\n    if(min_idx & 1) { min_n = 1.0f - min_n; }\r\n\tif(max_idx & 1) { max_n = 1.0f - max_n; }\r\n\r\n\tfloat min_x, min_y, min_u, min_v;\r\n\tfloat max_x, max_y, max_u, max_v;\r\n\tgetPoint(min_idx, min_n, min_x, min_y, min_u, min_v);\r\n\tgetPoint(max_idx, max_n, max_x, max_y, max_u, max_v);\r\n\r\n\tint min_i = ms_idxMaster[min_idx & 7][1];\r\n\tint max_i = ms_idxMaster[max_idx & 7][2];\r\n\tm_vertices[min_i].x = min_x;\r\n\tm_vertices[min_i].y = min_y;\r\n\tm_vertices[min_i].u = min_u;\r\n\tm_vertices[min_i].v = min_v;\r\n\r\n\tm_vertices[max_i].x = max_x;\r\n\tm_vertices[max_i].y = max_y;\r\n\tm_vertices[max_i].u = max_u;\r\n\tm_vertices[max_i].v = max_v;\r\n\r\n\tfor(int i = 0; i < 8; i++) {\r\n\t\t// 描画する条件\r\n\t\tif((i >= min_idx && i <= max_idx) || (max_idx >= 8 && (i <= (max_idx & 7)))) {\r\n\t\t\tfor(int j = 0; j < 3; j++) {\r\n\t\t\t\tint idx = ms_idxMaster[i][j];\r\n\t\t\t\tm_pDynSprite->setVertexXY(i * 3 + j, m_vertices[idx].x, m_vertices[idx].y);\r\n\t\t\t\tm_pDynSprite->setVertexUV(i * 3 + j, m_vertices[idx].u, m_vertices[idx].v);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// 頂点を中央に寄せて表示させない。\r\n\t\t\tfor(int j = 0; j < 3; j++) {\r\n\t\t\t\tm_pDynSprite->setVertexXY(i * 3 + j, m_vertices[0].x, m_vertices[0].y);\r\n\t\t\t\tm_pDynSprite->setVertexUV(i * 3 + j, m_vertices[0].u, m_vertices[0].v);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tm_pNode->markUpMatrix();\r\n}\r\n\r\nvoid\r\nCKLBUIPieChart::getPoint(int idx, float n, float& x, float& y, float& u, float& v)\r\n{\r\n\tfloat base_x, base_y, len_x, len_y;\r\n\tfloat base_u, base_v, len_u, len_v;\r\n\tint v1, v2;\r\n\r\n\tv1 = ms_idxMaster[idx & 7][1];\r\n\tv2 = ms_idxMaster[idx & 7][2];\r\n\r\n\tbase_x = m_vertices[v1].x;\r\n\tbase_y = m_vertices[v1].y;\r\n\tlen_x  = m_vertices[v2].x - base_x;\r\n\tlen_y  = m_vertices[v2].y - base_y;\r\n\r\n\tbase_u = m_vertices[v1].u;\r\n\tbase_v = m_vertices[v1].v;\r\n\tlen_u  = m_vertices[v2].u - base_u;\r\n\tlen_v  = m_vertices[v2].v - base_v;\r\n\r\n\tx = base_x + len_x * n;\r\n\ty = base_y + len_y * n;\r\n\tu = base_u + len_u * n;\r\n\tv = base_v + len_v * n;\r\n}\r\n\r\nbool \r\nCKLBUIPieChart::changeAsset(const char* asset)\r\n{\r\n\tu32 newTextHandle;\r\n\tCKLBImageAsset* newImgAsset = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset, &newTextHandle);\r\n\tif(!newImgAsset) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tCKLBUtility::deleteNode(m_pNode, m_texHandle);\r\n\r\n\tm_pImgAsset = newImgAsset;\r\n\tm_texHandle = newTextHandle;\r\n\r\n\t// 必要とされるオブジェクトを生成する\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\tm_pDynSprite = pRdrMgr.allocateCommandDynSprite(8*3,8*3);\t// 中央から8分割(45度ごと)\r\n\r\n\tm_pNode = KLBNEW(CKLBNode);\r\n\tif((!m_pDynSprite) || (!m_pNode)) {\r\n\t\tCKLBDataHandler::releaseHandle(m_texHandle);\r\n\t\tKLBDELETE(m_pNode);\r\n\t\tKLBDELETE(m_pDynSprite);\r\n\t\treturn false;\r\n\t}\r\n\r\n\tklb_assert(m_pImgAsset->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in PieChart task.\");\r\n\tm_pDynSprite->setTexture(m_pImgAsset);\r\n\tm_pNode->setRender(m_pDynSprite);\r\n\tm_pNode->setRenderOnDestroy(true);\r\n\tm_pNode->setPriority(m_order);\r\n\r\n\t// 自身の持つノードに追加\r\n\tgetNode()->addNode(m_pNode);\r\n\tsetVertices(m_value);\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIPieChart.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIPieChart_h\r\n#define CKLBUIPieChart_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIPieChart\r\n* \\brief Pie Chart Task Class\r\n* \r\n* CKLBUIPieChart allows to create dynamic Pie Charts.\r\n*/\r\nclass CKLBUIPieChart : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIPieChart>;\r\nprivate:\r\n\tCKLBUIPieChart();\r\n\tvirtual ~CKLBUIPieChart();\r\n\r\npublic:\r\n\tu32 getClassID();\r\n\r\n\tstatic CKLBUIPieChart * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t                           u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t   const char * asset, float start, float end,\r\n\t\t\t\t\t\t\t\t   int anim = 0, float initial = 0.0f);\r\n\r\n\tbool initUI(CLuaState& lua);\r\n\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline void  setStart(float start) {\r\n\t\tif (start != m_start) {\r\n\t\t\tm_start = start;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline float getStart() { return m_start; }\r\n\r\n\tinline void  setEnd(float end) {\r\n\t\tif (end != m_end) {\r\n\t\t\tm_end = end;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline float getEnd()   { return m_end; }\r\n\r\n\tinline void setValue(float value) {\r\n\t\tif (value != m_value) {\r\n\t\t\tm_value = value;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\tinline float getValue()\t{ return m_value;\t}\r\n\r\n\tinline s32 getAnim()    { return m_anim;\t}\r\n\r\n\tinline \r\n\tvirtual u32 getOrder()\t{ return m_order;\t}\r\n\r\n\tbool changeAsset(const char* asset);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\nprivate:\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n              u32 order, float x, float y, float width, float height,\r\n\t\t\t  const char * asset, float start, float end, int anim = 0, float initial = 0.0f);\r\n\r\n\tbool initCore(u32 order,\r\n\t\t\t\t  float x, float y, float width, float height, \r\n\t\t\t\t  const char * asset, float start, float end, int anim = 0, float initial = 0.0f);\r\n\r\n\r\n\tvoid setVertices(float value);\r\n\tvoid getPoint   (int idx, float n, float& x, float &y, float& u, float& v);\r\n\r\n\r\n\t// テクスチャ情報\r\n\tu32\t\t\t\t\tm_texHandle;\r\n\tCKLBImageAsset\t*\tm_pImgAsset;\r\n\ts32\t\t\t\t\tm_texWidth;\r\n\ts32\t\t\t\t\tm_texHeight;\r\n\r\n\t// ダイナミックスプライト\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\r\n\t// アニメーション情報\r\n\tbool\t\t\t\tm_bAnim;\r\n\tint\t\t\t\t\tm_iTimeCnt;\r\n\tfloat\t\t\t\tm_nowRate;\r\n\tfloat\t\t\t\tm_prevRate;\r\n\r\n\tfloat\t\t\t\tm_start;\r\n\tfloat\t\t\t\tm_end;\r\n\tfloat\t\t\t\tm_value;\r\n\ts32\t\t\t\t\tm_anim;\r\n\tu32\t\t\t\t\tm_order;\r\n\r\n\r\n\t// 頂点情報\r\n\tstruct VERTMAP {\r\n\t\tfloat x, y;\r\n\t\tfloat u, v;\r\n\t};\r\n\t\r\n\t\r\n\tVERTMAP\t\t\t\t    m_vertices[ 17 ];\r\n\r\n\tstatic const VERTMAP \tms_vertMaster[];\r\n\tstatic const int \t\tms_idxMaster[8][3];\r\n\tstatic PROP_V2\t\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIPieChart_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIPolyline.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIPolyline.h\"\r\n\r\nenum {\r\n\tUI_POLYLINE_SET_POINTCOUNT,\r\n\tUI_POLYLINE_SET_POINT,\r\n\tUI_POLYLINE_SET_COLOR\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_POLYLINE_SET_POINTCOUNT\",\t\tUI_POLYLINE_SET_POINTCOUNT  },\r\n\t{\"UI_POLYLINE_SET_POINT\",\t\t\tUI_POLYLINE_SET_POINT       },\r\n\t{\"UI_POLYLINE_SET_COLOR\",\t\t\tUI_POLYLINE_SET_COLOR       },\r\n\r\n\t{0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIPolyline> factory(\"UI_Polyline\", CLS_KLBUIPOLYLINE, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIPolyline::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\t\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIPolyline::getOrder,\t0\t},\r\n\t{\t\"maxpointcount\",\tUINTEGER,\t(setBoolT)&CKLBUIPolyline::setMaxPoint,\t(getBoolT)&CKLBUIPolyline::getMaxPoint,\t0\t}\r\n};\r\n\r\n// 引数のインデックス定義\r\nenum {\r\n\tARG_PARENT = 1,\r\n\tARG_ORDER,\r\n\r\n\tARG_MAXPOINTCNT,\r\n\t\r\n\tARG_NUMS    = ARG_MAXPOINTCNT,\r\n\tARG_REQUIRE = ARG_MAXPOINTCNT\t// 最低限必要なパラメータ数\r\n};\r\n\r\nCKLBUIPolyline::CKLBUIPolyline()\r\n: CKLBUITask\t()\r\n, m_pPolyline\t(NULL) \r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIPolyline::~CKLBUIPolyline() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUIPolyline::getClassID()\r\n{\r\n\treturn CLS_KLBUIPOLYLINE;\r\n}\r\n\r\nCKLBUIPolyline* \r\nCKLBUIPolyline::create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, u32 maxPoint) \r\n{\r\n\tCKLBUIPolyline* pTask = KLBNEW(CKLBUIPolyline);\r\n    if (!pTask) { return NULL; }\r\n\tif (!pTask->init(pParent, pNode, order, maxPoint)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool CKLBUIPolyline::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, u32 maxPoint) {\r\n    if(!setupNode()) { return false; }\r\n\tbool bResult = initCore(order, maxPoint);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool \r\nCKLBUIPolyline::initCore(u32 order, u32 maxPoint)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tm_maxpointcount = maxPoint;\r\n\tm_order         = order;\r\n\r\n\t// 必要とされるオブジェクトを生成する\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\tm_pPolyline = pRdrMgr.allocateCommandPolyline(m_maxpointcount, order);\r\n\tif(!m_pPolyline) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 二つのDynSpriteを自分のNodeに登録\r\n\tgetNode()->setRender(m_pPolyline);\r\n\tgetNode()->setRenderOnDestroy(true);\r\n\r\n\tgetNode()->markUpMatrix();\r\n\t\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIPolyline::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc > ARG_NUMS || argc < ARG_REQUIRE) { return false; }\r\n\r\n\tu32 order = lua.getInt(ARG_ORDER);\r\n\tu32 maxpoint = lua.getInt(ARG_MAXPOINTCNT);\r\n\treturn initCore(order,maxpoint);\r\n}\r\n\r\nint\r\nCKLBUIPolyline::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_POLYLINE_SET_POINTCOUNT:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tint ptsCount = lua.getInt(3);\r\n\t\t\t\tsetPointCount(ptsCount);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_POLYLINE_SET_POINT:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 5) {\r\n\t\t\t\tint idx = lua.getInt(3);\r\n\t\t\t\tfloat x = lua.getFloat(4);\r\n\t\t\t\tfloat y = lua.getFloat(5);\r\n\t\t\t\tsetPoint(idx,x,y);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_POLYLINE_SET_COLOR:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\tu32 alpha = lua.getInt(3);\r\n\t\t\t\tu32 rgb = lua.getInt(4);\r\n\r\n\t\t\t\tu32 color = (alpha << 24) | (rgb & 0xffffff);\r\n\r\n\t\t\t\tsetColor(color);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIPolyline::execute(u32 /*deltaT*/)\r\n{\r\n\t// Should never be executed.\r\n\tklb_assertAlways(\"Task execution is not necessary\");\r\n}\r\n\r\nvoid\r\nCKLBUIPolyline::dieUI()\r\n{\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIPolyline.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIPolyline_h\r\n#define CKLBUIPolyline_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIPolyline\r\n* \\brief Polyline Task Class\r\n* \r\n* CKLBUIPolyline allows to create Polylines.\r\n*/\r\nclass CKLBUIPolyline : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIPolyline>;\r\nprivate:\r\n\tCKLBUIPolyline();\r\n\tvirtual ~CKLBUIPolyline();\r\n\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, u32 maxPoint);\r\n\tbool initCore(u32 order, u32 maxPoint);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBUIPolyline* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, u32 maxPoint);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32 getMaxPoint()\t\t{ return m_maxpointcount;\t}\r\n\tinline void setMaxPoint(u32 maxpointcount) {\r\n\t\tif (m_maxpointcount != maxpointcount) {\r\n\t\t\tm_maxpointcount = maxpointcount;\r\n\t\t\tm_pPolyline->setMaxPointCount(maxpointcount);\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32 getOrder()\t{ return m_order;\t\t\t}\r\n\r\n\tinline u32\tgetPointCount()\t\t{ return m_pointCount;\t\t}\r\n\tinline void setPointCount(u32 pointcount) {\r\n\t\tm_pointCount = pointcount;\r\n\t\tm_pPolyline->setPointCount(pointcount);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline void setPoint(u32 idx, float x, float y) {\r\n\t\tm_pPolyline->setPoint(idx, x, y);\r\n\t\tgetNode()->markUpMatrix();\r\n\t}\r\n\r\n\tinline u32\tgetColor()\t\t\t{ return m_color;\t\t\t}\r\n\tinline void setColor(u32 color) {\r\n\t\tm_color = color;\r\n\t\tm_pPolyline->setColor(color);\r\n\t\tgetNode()->markUpColor();\r\n\t}\r\n\r\nprivate:\r\n\r\n\tCKLBPolyline\t*\tm_pPolyline;\r\n\r\n\tu32\t\t\t\t\tm_maxpointcount;\r\n\tu32\t\t\t\t\tm_pointCount;\r\n\tu32\t\t\t\t\tm_order;\r\n\tu32\t\t\t\t\tm_color;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIPolyline_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIProgressBar.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIProgressBar.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_PROGRESS_RESET = 0,\r\n\tUI_PROGRESS_SET,\r\n\tUI_PROGRESS_SET_IMAGE,\r\n\tUI_PROGRESS_MAX,\r\n\tUI_PROGRESS_GET,\r\n\r\n\tUI_PROGRESS_FILTER_VISIBLE,\r\n\tUI_PROGRESS_FILTER_COLOR,\r\n\tUI_PROGRESS_FILTER_ANIM,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_PROGRESS_RESET\",\t\tUI_PROGRESS_RESET       },\r\n\t{ \"UI_PROGRESS_SET\",\t\tUI_PROGRESS_SET         },\r\n\t{ \"UI_PROGRESS_SET_IMAGE\",\tUI_PROGRESS_SET_IMAGE   },\r\n\t{ \"UI_PROGRESS_MAX\",\t\tUI_PROGRESS_MAX         },\r\n\t{ \"UI_PROGRESS_GET\",\t\tUI_PROGRESS_GET         },\r\n\r\n\t{ \"UI_PROGRESS_FILTER_VISIBLE\",\tUI_PROGRESS_FILTER_VISIBLE  },\r\n\t{ \"UI_PROGRESS_FILTER_COLOR\",\tUI_PROGRESS_FILTER_COLOR    },\r\n\t{ \"UI_PROGRESS_FILTER_ANIM\",\tUI_PROGRESS_FILTER_ANIM     },\r\n\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIProgressBar> factory(\"UI_ProgressBar\", CLS_KLBUIPROGRESS, cmd);\r\n\r\n\r\nCKLBUIProgressBar::CKLBUIProgressBar()\r\n: CKLBUITask    ()\r\n, m_texHandle   (0)\r\n, m_bFilterSW   (false)\r\n, m_bColAnim    (false)\r\n, m_emptyImage  (NULL)\r\n, m_fullImage   (NULL)\r\n, m_pTexAsset   (NULL)\r\n, m_filterImage (NULL)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIProgressBar::~CKLBUIProgressBar() \r\n{\r\n\tKLBDELETEA(m_emptyImage);\r\n\tKLBDELETEA(m_fullImage);\r\n\tKLBDELETEA(m_filterImage);\r\n}\r\n\r\n// 共通インデックスバッファ\r\nconst u16 CKLBUIProgressBar::ms_indices[] = {\r\n\t0, 1, 2,\r\n\t3, 2, 1,\r\n\t4, 5, 6,\r\n\t7, 6, 5,\r\n\r\n\t// filter\r\n\t8, 9, 10,\r\n\t11, 10, 9\r\n};\r\n\r\nCKLBLuaPropTask::PROP_V2 CKLBUIProgressBar::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"width\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUIProgressBar::setWidth,\t\t\t(getBoolT)&CKLBUIProgressBar::getWidth,\t\t\t0\t},\r\n\t{\t\"height\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUIProgressBar::setHeight,\t\t(getBoolT)&CKLBUIProgressBar::getHeight,\t\t0\t},\r\n\t{\t\"order\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIProgressBar::setOrder,\t\t\t(getBoolT)&CKLBUIProgressBar::getOrder,\t\t\t0\t},\r\n\t{\t\"f_vert\",\t\t\tBOOLEANT,\t(setBoolT)&CKLBUIProgressBar::setVertical,\t\t(getBoolT)&CKLBUIProgressBar::getVertical,\t\t0\t},\r\n\t{\t\"t_anim\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIProgressBar::setAnimTime,\t\t(getBoolT)&CKLBUIProgressBar::getAnimTime,\t\t0\t},\r\n\t{\t\"start\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUIProgressBar::setStart,\t\t\t(getBoolT)&CKLBUIProgressBar::getStart,\t\t\t0\t},\r\n\t{\t\"end\",\t\t\t\tNUMERIC,\t(setBoolT)&CKLBUIProgressBar::setEnd,\t\t\t(getBoolT)&CKLBUIProgressBar::getEnd,\t\t\t0\t},\r\n\t{\t\"img_empty\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIProgressBar::getImgEmpty,\t\t0\t},\r\n\t{\t\"img_full\",\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIProgressBar::getImgFull,\t\t0\t},\r\n\t{\t\"value\",\t\t\tNUMERIC,\t(setBoolT)&CKLBUIProgressBar::setValue,\t\t\t(getBoolT)&CKLBUIProgressBar::getValue,\t\t\t0\t},\r\n\t{\t\"img_filter\",\t\tSTRING,\t\t(setBoolT)&CKLBUIProgressBar::setImgFilter,\t\t(getBoolT)&CKLBUIProgressBar::getImgFilter,\t\t0\t},\r\n\t{\t\"filter_visible\",\tBOOLEANT,\t(setBoolT)&CKLBUIProgressBar::setFilterVisible,\t(getBoolT)&CKLBUIProgressBar::getFilterVisible,\t0\t},\r\n\t{\t\"filter_color\",\t\tUINTEGER,\t(setBoolT)&CKLBUIProgressBar::setFilterColor,\t(getBoolT)&CKLBUIProgressBar::getFilterColor,\t0\t}\r\n};\r\n\r\n// 引数のインデックス定義\r\nenum {\r\n\tARG_PARENT = 1,\r\n\tARG_ORDER,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\r\n\tARG_IMG_FULL,\r\n\tARG_IMG_EMPTY,\r\n\r\n\tARG_START,\r\n\tARG_END,\r\n\tARG_ANIM,\r\n\tARG_VERT,\r\n\r\n\tARG_BARFILTER,\r\n\r\n\tARG_TOTAL = ARG_BARFILTER,\r\n\tARG_REQUIRE = ARG_IMG_FULL\t// 最低限必要なパラメータ数\r\n};\r\n\r\nCKLBUIProgressBar *\r\nCKLBUIProgressBar::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                          u32 order, float x, float y, float width, float height,\r\n                          const char * full_image, const char * empty_image,\r\n                          s32 start_pix, s32 end_pix, int anim, bool vert,\r\n                          const char * barfilter_image)\r\n{\r\n\tCKLBUIProgressBar * pTask = KLBNEW(CKLBUIProgressBar);\r\n    if(!pTask) { return NULL; }\r\n    if(start_pix < 0) { start_pix = 0;                     }\r\n\tif(end_pix   < 0) { end_pix = (vert) ? height : width; }\r\n\tif(!pTask->init(pParent, pNode, order, x, y, width, height,\r\n\t\t\t\t\tfull_image, empty_image, start_pix, end_pix, anim, vert,\r\n\t\t\t\t\tbarfilter_image)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIProgressBar::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                        u32 order, float x, float y, float width, float height,\r\n                        const char * full_image, const char * empty_image,\r\n                        s32 start_pix, s32 end_pix, int anim, bool vert,\r\n                        const char * barfilter_image)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, width, height,\r\n\t\t\t\t\t\t\tfull_image, empty_image, start_pix, end_pix, anim, vert,\r\n\t\t\t\t\t\t\tbarfilter_image);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIProgressBar::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n    if(argc > ARG_TOTAL || argc < ARG_REQUIRE) { return false; }\r\n\tu32   order  = lua.getInt(ARG_ORDER);\r\n\tfloat x      = lua.getFloat(ARG_X);\r\n\tfloat y      = lua.getFloat(ARG_Y);\r\n\tfloat width  = lua.getFloat(ARG_WIDTH);\r\n\tfloat height = lua.getFloat(ARG_HEIGHT);\r\n\tconst char * img_full  = lua.getString(ARG_IMG_FULL);\r\n\tconst char * img_empty = lua.getString(ARG_IMG_EMPTY);\r\n\r\n\tbool  vert  = (argc >= ARG_VERT)  ? lua.getBool(ARG_VERT)   : false;\r\n\tint   anim  = (argc >= ARG_ANIM)  ? lua.getInt(ARG_ANIM)    : 0;\r\n\tfloat start = (argc >= ARG_START) ? lua.getFloat(ARG_START) : 0.0f;\r\n\tfloat end   = (argc >= ARG_END)   ? lua.getFloat(ARG_END)   : ((!vert) ? width : height);\r\n\tconst char * img_barfilter = (argc >= ARG_BARFILTER) ? lua.getString(ARG_BARFILTER) : NULL;\r\n\r\n\treturn initCore(order, x, y, width, height, img_full, img_empty, start, end, anim, vert, img_barfilter);\r\n}\r\n\r\nbool\r\nCKLBUIProgressBar::initCore(u32 order,\r\n                            float x, float y, float width, float height,\r\n                            const char * full_image, const char * empty_image,\r\n                            s32 start_pix, s32 end_pix, int anim, bool vert,\r\n                            const char * img_barfilter)\r\n{\r\n\t// 対応するプロパティリストを規定する。\r\n\tif (!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 起動関数のパラメータとして初期値を受け取る\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tsetOrder(order);\r\n\tsetWidth(width);\r\n\tsetHeight(height);\r\n\tif(empty_image)     { setStrC(m_emptyImage, empty_image);\t}\r\n\tif(full_image)      { setStrC(m_fullImage, full_image);\t\t}\r\n\tif(img_barfilter)   { setStrC(m_filterImage, img_barfilter);}\r\n\t\r\n\tfloat start = start_pix;\r\n\tfloat end   = end_pix;\r\n\r\n\tm_isVertical \t= vert;\r\n\tm_anim_length\t= anim;\r\n\tm_startPixelF \t= ((start != -1) ? start : 0.0f);\r\n\tm_endPixelF\t  \t= ((end != -1)\t ? end   : width);\r\n\r\n\tm_fStart\t  \t= 0.0f;\r\n\tm_fEnd        \t= 1.0f;\r\n\r\n\r\n\t// 初期値は 0.0\r\n\tm_fValue = 1.0f;\t// Force setValue to be completely executed.\r\n\tsetValue(0.0f);\r\n\r\n\t// 必要とされるオブジェクトを生成する\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\t// イメージの取得\r\n\tconst char * imgname[3];\r\n\tconst char * asset_name = m_fullImage;\r\n\timgname[0] = m_fullImage;\r\n\timgname[1] = m_emptyImage;\r\n\timgname[2] = m_filterImage;\r\n\t{\r\n\t\tconst char * scheme[] = {\r\n\t\t\t\"asset://\",\r\n\t\t\t\"file://install/\",\r\n\t\t\t\"file://external/\",\r\n\t\t\t0\r\n\t\t};\r\n\t\tfor(int i = 0; i < 3; i++) {\r\n\t\t\tif(!imgname[i]) continue;\r\n\t\t\tfor(int j = 0; scheme[j]; j++) {\r\n\t\t\t\tint len = strlen(scheme[j]);\r\n\t\t\t\tif(!strncmp(imgname[i], scheme[j], len)) {\r\n\t\t\t\t\timgname[i] += len;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tm_pTexAsset = (CKLBTextureAsset *)CKLBUtility::loadAssetScript(asset_name, &m_texHandle, NULL, true);\r\n\tif(!m_pTexAsset) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfor(int i = 0; i < 3; i++) {\r\n\t\tm_pTex[i] = NULL;\r\n\t\tif(!imgname[i]) continue;\r\n\t\tm_pTex[i] = m_pTexAsset->getImage(imgname[i]);\r\n\r\n\t\t// 同じ .texb 内部に存在しない場合はエラー\r\n\t\tif(m_pTex[i] == NULL) {\r\n\t\t\tCKLBScriptEnv::getInstance().error(\"TEXB differs between [%s] and [%s].\", imgname[0], imgname[1]);\r\n\t\t\tCKLBDataHandler::releaseHandle(m_texHandle);\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tklb_assert(m_pTex[i]->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in ProgressBar task.\");\r\n\t}\r\n\tm_vertices = 8;\r\n\tm_indices = 12;\r\n\tif(imgname[2]) {\r\n\t\tm_vertices += 4;\r\n\t\tm_indices += 6;\r\n\t}\r\n\tm_pDynSprite = pRdrMgr.allocateCommandDynSprite(m_vertices, m_indices); // 三角形4個分 (+ フィルタで計6個)\r\n\tm_pNode = KLBNEW(CKLBNode);\r\n\tif ((!m_pDynSprite) || (!m_pNode)) {\r\n\t\tCKLBDataHandler::releaseHandle(m_texHandle);\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetupProgressBarConstant();\r\n\tsetFilterVisible(false);\r\n\r\n\t// 二つのDynSpriteを自分のNodeに登録\r\n\tm_pNode->setRender(m_pDynSprite);\r\n\tm_pNode->setRenderOnDestroy(true);\r\n\r\n\t// m_pNode->setVisible(true);\r\n\r\n\t// プロパティから初期状態を設定する\r\n\tm_prevRate = getValue();\r\n\tsetBorder(m_prevRate);\r\n\r\n\t// 自身の持つノードに追加\r\n\tgetNode()->addNode(m_pNode);\r\n\r\n\tREFRESH_A;\r\n\tREFRESH_B;\r\n\r\n\treturn true;\r\n}\r\n\r\nu32\r\nCKLBUIProgressBar::getClassID()\r\n{\r\n\treturn CLS_KLBUIPROGRESS;\r\n}\r\n\r\nint\r\nCKLBUIProgressBar::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\t//if(argc < 2 || 3 < argc) return 0;\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_PROGRESS_RESET:\r\n\t\t{\r\n\t\t\treset();\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PROGRESS_SET:\r\n\t\t{\r\n\t\t\tif(argc != 3) { return 0; }\r\n\t\t\tfloat val = lua.getFloat(3);\r\n\t\t\tsetValue(val);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PROGRESS_SET_IMAGE:\r\n       {\r\n           bool bResult = false;\r\n           if(argc == 4) {\r\n               bool isEmpty = lua.getBool(3);\r\n               const char * path = lua.getString(4);\r\n               bResult = setImg(isEmpty, path);\r\n           }\r\n           lua.retBool(bResult);\r\n           ret = 1;\r\n       }\r\n       break;\r\n\tcase UI_PROGRESS_MAX:\r\n\t\tsetValue(m_fEnd);\r\n\t\tbreak;\r\n\tcase UI_PROGRESS_GET:\r\n\t\t{\r\n\t\t\tfloat val = getValue();\r\n\t\t\tlua.retDouble(val);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PROGRESS_FILTER_VISIBLE:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tbool visible = lua.getBool(3);\r\n\t\t\t\tsetFilterVisible(visible);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PROGRESS_FILTER_COLOR:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 4) {\r\n\t\t\t\tu32 alpha = lua.getInt(3);\r\n\t\t\t\tu32 rgb   = lua.getInt(4);\r\n\t\t\t\tu32 color = ((alpha & 0xff) << 24) | (rgb & 0xffffff);\r\n\t\t\t\tsetFilterColor(color);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_PROGRESS_FILTER_ANIM:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc >= 3 && argc <= 8) {\r\n\t\t\t\tbool bColAnim = lua.getBool(3);\r\n\t\t\t\tu32 alpha1 = (argc >= 4) ? lua.getInt(4) : 0xff;\r\n\t\t\t\tu32 color1 = (argc >= 5) ? lua.getInt(5) : 0xffffff;\r\n\t\t\t\tu32 alpha2 = (argc >= 6) ? lua.getInt(6) : 0xff;\r\n\t\t\t\tu32 color2 = (argc >= 7) ? lua.getInt(7) : 0xffffff;\r\n\t\t\t\tu32 freq   = (argc >= 8) ? lua.getInt(8) : 500;\r\n\t\t\t\tcolor1 = ((alpha1 & 0xff) << 24) | (color1 & 0xffffff);\r\n\t\t\t\tcolor2 = ((alpha2 & 0xff) << 24) | (color2 & 0xffffff);\r\n\t\t\t\tbResult = setFilterAnim(bColAnim, color1, color2, freq);\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIProgressBar::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(m_pNode, m_texHandle);\r\n}\r\n\r\nvoid\r\nCKLBUIProgressBar::execute(u32 deltaT)\r\n{\r\n\t// Order Changed.\r\n\tif(CHANGE_A) {\r\n\t\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\t\t// 表示プライオリティを設定\r\n\t\tint order = getOrder();\r\n\t\tm_pDynSprite->changeOrder(pRdrMgr, order);\r\n\t\tRESET_A;\r\n\t}\r\n\r\n\t// Geometry, value change.\r\n\tif(CHANGE_B) {\r\n\t\tREFRESH_C;\t// Cascade C change.\r\n\t\tm_iTimeCnt = 0;\r\n\t\tm_nowRate = m_prevRate;\r\n\t\tRESET_B;\r\n\t}\r\n\r\n\tif(CHANGE_D) {\r\n\t\tsetupProgressBarConstant();\r\n\t\tsetBorder(m_lastValue);\r\n\t\tRESET_D;\r\n\t}\r\n\r\n\tif(CHANGE_C) {\r\n\t\tu32 p_anim = getAnimTime();\r\n\t\tm_iTimeCnt += deltaT;\r\n\r\n\t\tfloat rate = (!p_anim) ? 1.0f : ((float)m_iTimeCnt/p_anim);\r\n        if(rate > 1.0f) { rate = 1.0f; }\r\n\r\n\t\tfloat value = m_nowRate + (getValueNormalized() - m_nowRate) * rate;\r\n\r\n\t\t// アニメーション中に書き換える\r\n\t\tif(m_lastValue != value) {\r\n\t\t\tsetBorder(value);\r\n\t\t}\r\n\t\tif(rate >= 1.0f) {\r\n\t\t\tRESET_C;\r\n\t\t\tm_prevRate = getValueNormalized();\r\n\t\t}\r\n\t}\r\n\r\n\t// フィルタのカラーアニメーションが有効ならば再生する。\r\n\tif(m_bColAnim) {\r\n\t\t// 変数名はm_animfreqだが、値は「周期(period)」であることに注意。周波数(frequency)ではない。\r\n\t\tm_animTime += deltaT;\r\n\t\twhile(m_animTime > m_animfreq) { m_animTime -= m_animfreq; }\r\n\t\tfloat theta = 2.0f * M_PI * m_animTime / (float)m_animfreq;\r\n\t\tfloat value = (sin(theta) + 1.0f) / 2.0f;\r\n\r\n\t\tu32 col = 0;\r\n\t\tint shift = 0;\r\n\t\tfor(int i = 0; i < 4; i++) {\r\n\t\t\tshift = i * 8;\r\n\t\t\tfloat a = ((m_animcol[0] >> shift) & 0xff) / 255.0f;\r\n\t\t\tfloat b = ((m_animcol[1] >> shift) & 0xff) / 255.0f;\r\n\t\t\tfloat c = a + (b - a) * value;\r\n\t\t\tcol |= (0xff & (int)(c * 0xff)) << shift;\r\n\t\t}\r\n\t\tsetFilterColor(col);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIProgressBar::setupProgressBarConstant() {\r\n\tfloat p_start   = m_startPixelF;\r\n\tfloat p_end     = m_endPixelF;\r\n\tbool  p_vert    = m_isVertical;\r\n\tfloat p_width   = m_fWidth;\r\n\tfloat p_height  = m_fHeight;\r\n\r\n\t//\r\n\t// Setup Index Buffer.\r\n\t//\r\n\tu16* pBuff = m_pDynSprite->getSrcIndexBuffer();\r\n\tmemcpy(pBuff, CKLBUIProgressBar::ms_indices, m_indices*sizeof(u16));\r\n\tm_pDynSprite->setTexture(m_pTex[0]);\r\n\r\n\tm_idx_a = (p_start < p_end) ? E_full : E_empty;\r\n\tm_idx_b = (p_start < p_end) ? E_empty : E_full;\r\n\tm_idx_c = E_filter;\r\n\r\n\t//\r\n\t// Setup Constant UV\r\n\t//\r\n\tfloat* verticesUV = m_pDynSprite->getSrcUVBuffer();\r\n\tif (!p_vert) {\r\n\t\t// 左端uv\r\n\t\tm_pTex[m_idx_a]->getUV(0, &(verticesUV[0]), &(verticesUV[1]));\r\n\t\tm_pTex[m_idx_a]->getUV(3, &(verticesUV[4]), &(verticesUV[5]));\r\n\t\t// 右端uv\r\n\t\tm_pTex[m_idx_b]->getUV(1, &(verticesUV[10]), &(verticesUV[11]));\r\n\t\tm_pTex[m_idx_b]->getUV(2, &(verticesUV[14]), &(verticesUV[15]));\r\n\t} else {\r\n\t\t// 右端uv\r\n\t\tm_pTex[m_idx_b]->getUV(3, &(verticesUV[12]), &(verticesUV[13]));\r\n\t\tm_pTex[m_idx_b]->getUV(2, &(verticesUV[14]), &(verticesUV[15]));\r\n\t\t// 上端uv\r\n\t\tm_pTex[m_idx_a]->getUV(0, &(verticesUV[0]), &(verticesUV[1]));\r\n\t\tm_pTex[m_idx_a]->getUV(1, &(verticesUV[2]), &(verticesUV[3]));\r\n\t}\r\n\r\n\t// フィルタがある場合、フィルタ各頂点のUVを指定する\r\n\t// フィルタは分断されず伸縮されるため、すべてのUVを事前に設定してよい。\r\n\tif(m_pTex[m_idx_c]) {\r\n\t\tm_pTex[m_idx_c]->getUV(0, &(verticesUV[16]), &(verticesUV[17]));\r\n\t\tm_pTex[m_idx_c]->getUV(1, &(verticesUV[18]), &(verticesUV[19]));\r\n\t\tm_pTex[m_idx_c]->getUV(2, &(verticesUV[22]), &(verticesUV[23]));\r\n\t\tm_pTex[m_idx_c]->getUV(3, &(verticesUV[20]), &(verticesUV[21]));\r\n\t}\r\n\r\n\t//\r\n\t// Setup Constant XY\r\n\t//\r\n\tfloat* verticesXY = m_pDynSprite->getSrcXYBuffer();\r\n\tif (!p_vert) {\r\n\t\t// xy の操作\r\n\t\t// 左パーツ(idx_a)\r\n\t\tverticesXY[0] = 0.0f;\r\n\t\tverticesXY[1] = 0.0f;\r\n\r\n\t\t// [2] : Variable\r\n\t\tverticesXY[3] = 0.0f;\r\n\r\n\t\tverticesXY[4] = 0.0f;\r\n\t\tverticesXY[5] = p_height;\r\n\r\n\t\t// [6] : Variable\r\n\t\tverticesXY[7] = p_height;\r\n\r\n\t\t// 右パーツ(idx_b)\r\n\t\t// [8] : Variable\r\n\t\tverticesXY[9] = 0.0f;\r\n\r\n\t\tverticesXY[10] = p_width;\r\n\t\tverticesXY[11] = 0.0f;\r\n\r\n\t\t// [12] : Variable\r\n\t\tverticesXY[13] = p_height;\r\n\r\n\t\tverticesXY[14] = p_width;\r\n\t\tverticesXY[15] = p_height;\r\n\r\n\t\tif(m_pTex[m_idx_c]) {\r\n\t\t\tif(m_idx_a == E_full) {\r\n\t\t\t\tm_filterXY[0] = p_start;\r\n\t\t\t\tm_filterXY[1] = 0.0f;\r\n\r\n\t\t\t\t// m_filterXY[2] = 可変\r\n\t\t\t\tm_filterXY[3] = 0.0f;\r\n\r\n\t\t\t\tm_filterXY[4] = p_start;\r\n\t\t\t\tm_filterXY[5] = p_height;\r\n\r\n\t\t\t\t// m_filterXY[6] = 可変\r\n\t\t\t\tm_filterXY[7] = p_height;\r\n\t\t\t} else {\r\n\t\t\t\t// m_filterXY[0] = 可変;\r\n\t\t\t\tm_filterXY[1] = 0.0f;\r\n\r\n\t\t\t\tm_filterXY[2] = p_start;\r\n\t\t\t\tm_filterXY[3] = 0.0f;\r\n\r\n\t\t\t\t// m_filterXY[4] = 可変;\r\n\t\t\t\tm_filterXY[5] = p_height;\r\n\r\n\t\t\t\tm_filterXY[6] = p_start;\r\n\t\t\t\tm_filterXY[7] = p_height;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t// 上パーツ\r\n\t\tverticesXY[0] = 0.0f;\r\n\t\tverticesXY[1] = 0.0f;\r\n\t\tverticesXY[2] = p_width;\r\n\t\tverticesXY[3] = 0.0f;\r\n\t\tverticesXY[4] = 0.0f;\r\n\t\tverticesXY[6] = p_width;\r\n\r\n\r\n\t\t// 下パーツ\r\n\t\tverticesXY[8] = 0.0f;\r\n\t\tverticesXY[10] = p_width;\r\n\t\tverticesXY[12] = 0.0f;\r\n\t\tverticesXY[13] = p_height;\r\n\t\tverticesXY[14] = p_width;\r\n\t\tverticesXY[15] = p_height;\r\n\r\n\t\tif(m_pTex[m_idx_c]) {\r\n\t\t\tif(m_idx_a == E_full) {\r\n\t\t\t\tm_filterXY[0] = 0.0f;\r\n\t\t\t\tm_filterXY[1] = p_start;\r\n\t\t\t\tm_filterXY[2] = p_width;\r\n\t\t\t\tm_filterXY[3] = p_start;\r\n\r\n\t\t\t\tm_filterXY[4] = 0.0f;\r\n\t\t\t\t// m_filterXY[5] = 可変\r\n\r\n\t\t\t\tm_filterXY[6] = p_width;\r\n\t\t\t\t// m_filterXY[7] = 可変\r\n\t\t\t} else {\r\n\t\t\t\tm_filterXY[0] = 0.0f;\r\n\t\t\t\t// m_filterXY[1] = 可変\r\n\r\n\t\t\t\tm_filterXY[2] = p_width;\r\n\t\t\t\t// m_filterXY[3] = 可変\r\n\r\n\t\t\t\tm_filterXY[4] = 0.0f;\r\n\t\t\t\tm_filterXY[5] = p_start;\r\n\t\t\t\tm_filterXY[6] = p_width;\r\n\t\t\t\tm_filterXY[7] = p_start;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIProgressBar::setBorder(float value)\r\n{\r\n\tm_lastValue = value;\r\n\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\t// 表示プライオリティを設定\r\n\tm_pDynSprite->changeOrder(pRdrMgr, getOrder());\r\n\r\n\t// その他の情報\r\n\tbool  p_vert;\r\n\tfloat p_start, p_end, p_border;\r\n\tfloat p_value;\r\n\tp_vert \t= getVertical();\r\n\tp_start = m_startPixelF;\r\n\tp_end   = m_endPixelF;\r\n\tp_value = value;\r\n\r\n\tp_border = p_start + (p_end - p_start) * p_value;\r\n\t\r\n\tfloat* verticesUV = m_pDynSprite->getSrcUVBuffer();\r\n\tfloat* verticesXY = m_pDynSprite->getSrcXYBuffer();\r\n\r\n\tif(!p_vert) {\t\t// 横方向成長\r\n\t\t//\r\n\t\t// Geometry Change\r\n\t\t//\r\n\t\tverticesXY[2]   = p_border;\r\n\t\tverticesXY[6]   = p_border;\r\n\t\tverticesXY[8]   = p_border;\r\n\t\tverticesXY[12]  = p_border;\r\n\t\tif(m_pTex[m_idx_c]) {\r\n\t\t\tif(m_idx_a == E_full) {\r\n\t\t\t\tm_filterXY[2] = p_border;\r\n\t\t\t\tm_filterXY[6] = p_border;\r\n\t\t\t} else {\r\n\t\t\t\tm_filterXY[0] = p_border;\r\n\t\t\t\tm_filterXY[4] = p_border;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfloat rate, u, v;\r\n\t\trate = p_border / m_fWidth;\t// 画像の分割比率\r\n\r\n\t\t// 左端uv\r\n\t\t// Constant done at creation.\r\n\t\t// m_pTex[idx_a]->getUV(0, &(verticesUV[0]), &(verticesUV[1]));\r\n\t\t// m_pTex[idx_a]->getUV(3, &(verticesUV[4]), &(verticesUV[5]));\r\n\r\n\t\tm_pTex[m_idx_a]->getUV(1, &u, &v);\r\n\t\tverticesUV[2] = verticesUV[0] + (u - verticesUV[0]) * rate;\r\n\t\tverticesUV[3] = verticesUV[1] + (v - verticesUV[1]) * rate;\r\n\t\tm_pTex[m_idx_a]->getUV(2, &u, &v);\r\n\t\tverticesUV[6] = verticesUV[4] + (u - verticesUV[4]) * rate;\r\n\t\tverticesUV[7] = verticesUV[5] + (v - verticesUV[5]) * rate;\r\n\r\n\t\t// 右端uv\r\n\t\t// m_pTex[idx_b]->getUV(1, &(verticesUV[10]), &(verticesUV[11]));\r\n\t\t// m_pTex[idx_b]->getUV(2, &(verticesUV[14]), &(verticesUV[15]));\r\n\r\n\t\tm_pTex[m_idx_b]->getUV(0, &u, &v);\r\n\t\tverticesUV[8] = u + (verticesUV[10] - u) * rate;\r\n\t\tverticesUV[9] = v + (verticesUV[11] - v) * rate;\r\n\t\tm_pTex[m_idx_b]->getUV(3, &u, &v);\r\n\t\tverticesUV[12] = u + (verticesUV[14] - u) * rate;\r\n\t\tverticesUV[13] = v + (verticesUV[15] - v) * rate;\r\n\t} else {\t\t\t// 縦方向成長\r\n\t\t//\r\n\t\t// Geometry Change\r\n\t\t//\r\n\t\tverticesXY[5]   = p_border;\r\n\t\tverticesXY[7]   = p_border;\r\n\t\tverticesXY[9]   = p_border;\r\n\t\tverticesXY[11]  = p_border;\r\n\r\n\t\tif(m_pTex[m_idx_c]) {\r\n\t\t\tif(m_idx_a == E_full) {\r\n\t\t\t\tm_filterXY[5] = p_border;\r\n\t\t\t\tm_filterXY[7] = p_border;\r\n\t\t\t} else {\r\n\t\t\t\tm_filterXY[1] = p_border;\r\n\t\t\t\tm_filterXY[3] = p_border;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfloat rate, u, v;\r\n\t\trate = p_border / m_fHeight;\t// 画像の分割比率\r\n\r\n\t\t// 上端uv\r\n\t\t// m_pTex[idx_a]->getUV(0, &(verticesUV[0]), &(verticesUV[1]));\r\n\t\t// m_pTex[idx_a]->getUV(1, &(verticesUV[2]), &(verticesUV[3]));\r\n\r\n\t\tm_pTex[m_idx_a]->getUV(3, &u, &v);\r\n\t\tverticesUV[4] = verticesUV[0] + (u - verticesUV[0]) * rate;\r\n\t\tverticesUV[5] = verticesUV[1] + (v - verticesUV[1]) * rate;\r\n\r\n\t\tm_pTex[m_idx_a]->getUV(2, &u, &v);\r\n\t\tverticesUV[6] = verticesUV[2] + (u - verticesUV[2]) * rate;\r\n\t\tverticesUV[7] = verticesUV[3] + (v - verticesUV[3]) * rate;\r\n\r\n\t\t// 右端uv\r\n\t\t// m_pTex[idx_b]->getUV(3, &(verticesUV[12]), &(verticesUV[13]));\r\n\t\t// m_pTex[idx_b]->getUV(2, &(verticesUV[14]), &(verticesUV[15]));\r\n\r\n\t\tm_pTex[m_idx_b]->getUV(0, &u, &v);\r\n\t\tverticesUV[8] = u + (verticesUV[12] - u) * rate;\r\n\t\tverticesUV[9] = v + (verticesUV[13] - v) * rate;\r\n\r\n\t\tm_pTex[m_idx_b]->getUV(1, &u, &v);\r\n\t\tverticesUV[10] = u + (verticesUV[14] - u) * rate;\r\n\t\tverticesUV[11] = v + (verticesUV[14] - v) * rate;\r\n\t}\r\n\r\n\tif(m_bFilterSW && m_pTex[m_idx_c]) {\r\n\t\t// filter が指定されていて、なおかつ有効になっていれば頂点情報を反映する\r\n\t\tmemcpy(verticesXY + 16, m_filterXY, 8 * sizeof(float));\r\n\t}\r\n\tm_pDynSprite->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY);\r\n\tm_pNode->markUpMatrix();\r\n}\r\n\r\nbool \r\nCKLBUIProgressBar::setImg(bool isEmpty, const char* imageName)\r\n{\r\n\tif(!imageName) { return false; }\r\n\r\n\tif(CKLBUtility::safe_strcmp(imageName, isEmpty ? m_emptyImage : m_fullImage) != 0) {\r\n\t\tconst char * imgname;\r\n\t\timgname = imageName;\r\n\r\n\t\t{\r\n\t\t\tconst char * scheme[] = {\r\n\t\t\t\t\"asset://\",\r\n\t\t\t\t\"file://install/\",\r\n\t\t\t\t\"file://external/\",\r\n\t\t\t\t0\r\n\t\t\t};\r\n\t\t\tfor(int j = 0; scheme[j]; j++) {\r\n\t\t\t\tint len = strlen(scheme[j]);\r\n\t\t\t\tif(!strncmp(imgname, scheme[j], len)) {\r\n\t\t\t\t\timgname += len;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tCKLBImageAsset* image = m_pTexAsset->getImage(imgname);\r\n\r\n\t\tif(!image) {\r\n\t\t\tklb_assertAlways(\"[%s] is not in the assigned texture.\",imgname);\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tklb_assert(image->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in ProgressBar task.\");\r\n\r\n\t\tif(isEmpty) {\r\n\t\t\tsetStrC(m_emptyImage,imageName);\r\n\t\t\tm_pTex[1] = image;\r\n\t\t} else {\r\n\t\t\tsetStrC(m_fullImage,imageName);\r\n\t\t\tm_pTex[0] = image;\r\n\t\t}\r\n\r\n\t\tREFRESH_D;\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIProgressBar::setFilterColor(u32 argb)\r\n{\r\n\tu8 v[4];\r\n\tv[0] = (argb >> 16);\r\n\tv[1] = (argb >>  8);\r\n\tv[2] = (argb      );\r\n\tv[3] = (argb >> 24);\r\n\r\n\r\n\t// Memory RGBA\r\n\tu32 rgba = *((u32*)v);\r\n\tfor(int i = 8; i < 12; i++) {\r\n\t\tm_pDynSprite->setVertexColor(m_pNode,i, rgba);\r\n\t}\r\n\tm_FilterCol = argb;\r\n}\r\n\r\nvoid\r\nCKLBUIProgressBar::setFilterVisible(bool visible)\r\n{\r\n\tm_bFilterSW = visible;\r\n\r\n\t// filter を disable したときは、filter用頂点を全て 0.0f にすることで表示されないようにする。\r\n\tif(!visible && m_pTex[m_idx_c]) {\r\n\t\tfloat* verticesXY = m_pDynSprite->getSrcXYBuffer();\r\n\t\tfor(int i = 16; i < 24; i++) verticesXY[i] = 0.0f;\r\n\t}\r\n}\r\n\r\nbool\r\nCKLBUIProgressBar::setFilterAnim(bool bFilterAnim, u32 col1, u32 col2, u32 freq)\r\n{\r\n\tm_bColAnim      = bFilterAnim;\r\n\tm_animfreq      = freq;\r\n\tm_animcol[0]    = col1;\r\n\tm_animcol[1]    = col2;\r\n\tm_animTime      = 0;\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIProgressBar.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIProgressBar_h\r\n#define CKLBUIProgressBar_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIProgressBar\r\n* \\brief Progress Bar Task Class\r\n* \r\n* CKLBUIProgressBar allows to create dynamic Progress Bars.\r\n*/\r\nclass CKLBUIProgressBar : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIProgressBar>;\r\nprivate:\r\n\tCKLBUIProgressBar();\r\n\tvirtual ~CKLBUIProgressBar();\r\npublic:\r\n\t// プロパティのインデックス\r\n\tenum PROP_ID{\r\n\t\tP_WIDTH,\r\n\t\tP_HEIGHT,\r\n\t\tP_ORDER,\r\n\t\tP_VERT,\r\n\t\tP_ANIM,\r\n\t\tP_START,\r\n\t\tP_END_POS,\r\n\t\tP_IMG_EMPTY,\r\n\t\tP_IMG_FULL,\r\n\t\tP_VALUE,\r\n\t\tP_IMG_FILTER,\r\n\t\tP_FILTER_VISIBLE,\r\n\t\tP_FILTER_COLOR,\r\n\t};\r\n\r\n\tstatic CKLBUIProgressBar *\r\n\t\tcreate(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\tu32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\tconst char * full_image, const char * empty_image,\r\n\t\t\t\t\t\t\ts32 start_pix = -1, s32 end_pix = -1, int anim = 0, bool vert = false,\r\n\t\t\t\t\t\t\tconst char * barfilter_image = NULL);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tbool setFilterAnim(bool bFilterAnim, u32 col1, u32 col2, u32 freq);\r\n\t\r\n\t// A : Perform animation\r\n\t// B : Perform geometry\r\n\r\n\tinline u32  getOrder()\t\t\t\t{ return m_uiOrder;\t\t}\r\n\tinline void\tsetOrder(u32 order)\t\t{\r\n\t\tif (order != m_uiOrder) {\r\n\t\t\tm_uiOrder = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getWidth()\t\t\t\t{ return m_fWidth;\t\t}\r\n\tinline void\t setWidth(float width)\t{\r\n\t\tif (width != m_fWidth) {\r\n\t\t\tif(!m_isVertical) {\r\n\t\t\t\tif(m_startPixelF <= m_endPixelF) {\r\n\t\t\t\t\tm_endPixelF += width - m_fWidth;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_startPixelF += width - m_fWidth;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_fWidth = width;\r\n\t\t\tREFRESH_D;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getHeight()             { return m_fHeight;\t\t}\r\n\tinline void\t setHeight(float height) {\r\n\t\tif (height != m_fHeight) {\r\n\t\t\tif(m_isVertical) {\r\n\t\t\t\tif(m_startPixelF <= m_endPixelF) {\r\n\t\t\t\t\tm_endPixelF += height - m_fHeight;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tm_startPixelF += height - m_fHeight;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tm_fHeight = height;\r\n\t\t\tREFRESH_D;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool\tgetVertical()\t\t\t    { return m_isVertical;\t}\r\n\tinline void\tsetVertical(bool vertical)  {\r\n\t\tif (m_isVertical != vertical) {\r\n\t\t\tm_isVertical = vertical;\r\n\t\t\tREFRESH_D;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetAnimTime()\t\t\t{ return m_anim_length; }\r\n\tinline void\tsetAnimTime(u32 time)\t{\r\n\t\tif (time != m_anim_length) {\r\n\t\t\tm_anim_length = time;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getStart()\t\t\t\t{ return m_fStart;\t\t}\r\n\tinline void\t setStart(float start)\t{\r\n\t\tif (start != m_fStart) {\r\n\t\t\tm_fStart = start;\r\n\t\t\tm_fNormValue = (m_fValue - m_fStart) / (m_fEnd - m_fStart); \r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getEnd()\t\t\t\t{ return m_fEnd;\t\t}\r\n\tinline void\t setEnd(float end)\t\t{\r\n\t\tif (end != m_fEnd) {\r\n\t\t\tm_fEnd = end;\r\n\t\t\tm_fNormValue = (m_fValue - m_fStart) / (m_fEnd - m_fStart); \r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getImgEmpty()\t{ return m_emptyImage;\t}\r\n\tinline void         setImgEmpty(const char* empty_image)\t{ \r\n\t\tsetStrC(m_emptyImage, empty_image); \r\n\t\tsetImg(true, empty_image); \r\n\t}\r\n\r\n\tinline const char*  getImgFull()\t{ return m_fullImage;\t}\r\n\tinline void         setImgFull(const char* full_image)\t\t{ \r\n\t\tsetStrC(m_fullImage, full_image); \r\n\t\tsetImg(false, full_image); \r\n\t}\r\n\r\n\tinline float getValue()\t\t\t\t{ return m_fValue;\t\t}\r\n\tinline void\t setValue(float value)\t{\r\n\t\tif (value != m_fValue) {\r\n\t\t\tm_fValue = value;\r\n\t\t\tm_fNormValue = (value - m_fStart) / (m_fEnd - m_fStart); \r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getValueNormalized()\t{ return m_fNormValue;\t}\r\n\t\r\n\tinline const char*  getImgFilter()\t{ return m_filterImage; }\r\n\tinline void         setImgFilter(const char* img_filter)\t{ setStrC(m_filterImage, img_filter); /*TODO*/ }\r\n\r\n\tinline bool getFilterVisible()\t\t{ return m_bFilterSW;\t}\r\n\tvoid        setFilterVisible(bool visible);\r\n\r\n\tinline u32\tgetFilterColor()\t\t{ return m_FilterCol; }\r\n\tvoid        setFilterColor(u32 argb);\r\n\r\n\tinline void reset()\t{\r\n\t\tsetValue(m_fStart);\r\n\t\tm_iTimeCnt = 0;\r\n\t\tm_nowRate = m_prevRate = m_fStart;\r\n\t\tm_lastValue = m_fStart;\r\n\t\tsetBorder(m_fStart);\r\n\t}\r\n\r\n\tu32 getClassID();\r\nprivate:\r\n\tbool setImg(bool isEmpty, const char* imageName);\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 order, float x, float y, float width, float height,\r\n\t\t\t\tconst char * full_image, const char * empty_image,\r\n\t\t\t\ts32 start_pix, s32 end_pix, int anim, bool vert,\r\n\t\t\t\tconst char * barfilter_image);\r\n\r\n\tbool initCore(  u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\tconst char * full_image, const char * empty_image,\r\n\t\t\t\t\ts32 start_pix, s32 end_pix, int anim, bool vert,\r\n\t\t\t\t\tconst char * barfilter_image);\r\n\r\n\tvoid setBorder\t\t\t\t\t(float value);\r\n\tvoid setupProgressBarConstant\t();\r\n\r\n\tenum {\r\n\t\tE_full,\r\n\t\tE_empty,\r\n\t\tE_filter,\r\n\t};\r\n\tCKLBImageAsset\t*\tm_pTex[3];\t\t// [0]full / [1]empty / [2]filter\r\n\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\r\n\tCKLBTextureAsset *\tm_pTexAsset;\r\n\tu32\t\t\t\t\tm_texHandle;\r\n\tu32\t\t\t\t\tm_uiOrder;\r\n\tfloat\t\t\t\tm_fWidth;\r\n\tfloat\t\t\t\tm_fHeight;\r\n\tu32\t\t\t\t\tm_anim_length;\r\n\tfloat\t\t\t\tm_fStart;\r\n\tfloat\t\t\t\tm_fEnd;\r\n\tfloat\t\t\t\tm_startPixelF;\r\n\tfloat\t\t\t\tm_endPixelF;\r\n\tfloat\t\t\t\tm_fValue;\r\n\tfloat\t\t\t\tm_fNormValue;\r\n\tbool\t\t\t\tm_isVertical;\r\n\r\n\tfloat\t\t\t\tm_lastValue;\r\n\tfloat\t\t\t\tm_prevRate;\r\n\tu32\t\t\t\t\tm_iTimeCnt;\t\t// アニメ用タイムカウンタ\r\n\tfloat\t\t\t\tm_nowRate;\t\t// アニメーション中の表示レート\r\n\t//GG//bool\t\t\tm_bAnim;\t\t// アニメーション中のフラグ\r\n\tu8\t\t\t\t\tm_idx_a;\r\n\tu8\t\t\t\t\tm_idx_b;\r\n\tu8\t\t\t\t\tm_idx_c;\t\t// filter用\r\n\r\n\tint\t\t\t\t\tm_vertices;\t\t// 頂点の数\r\n\tint\t\t\t\t\tm_indices;\t\t// インデックスの数\r\n\t\r\n\r\n\tbool\t\t\t\tm_bFilterSW;\t// フィルタ表示の ON/OFF\r\n\tu32\t\t\t\t\tm_FilterCol;\t// フィルタ用RGBA値\r\n\tfloat\t\t\t\tm_filterXY[8];\t// フィルタ表示用頂点\r\n\r\n\tbool\t\t\t\tm_bColAnim;\t\t\t// フィルタカラーアニメーション有効\r\n\tu32\t\t\t\t\tm_animfreq;\t\t\t// RGBAアニメーションの周期([ms])\r\n\tu32\t\t\t\t\tm_animcol[2];\t\t// RGBAアニメーションで補間する二つのカラー\r\n\tu32\t\t\t\t\tm_animTime;\t\t\t// タイムカウンタ\r\n\r\n\tbool\t\t\t\tm_bCmdUpdate;\r\n\r\n\tconst char\t\t*\tm_emptyImage;\r\n\tconst char\t\t*\tm_fullImage;\r\n\tconst char\t\t*\tm_filterImage;\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\tstatic const u16\tms_indices[];\r\n};\r\n\r\n#endif // CKLBUIProgressBar_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIRubberBand.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#define _USE_MATH_DEFINES\r\n#include <math.h>\r\n#include \"CKLBUIRubberBand.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_RUBBAND_SET_ORIGIN,\r\n\tUI_RUBBAND_SET_POINT,\r\n\tUI_RUBBAND_SET_ORDER,\r\n\r\n\tRB_ANIM_ENABLE   = 0x00000001,\r\n\tRB_ANIM_REALTIME = 0x00000002,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_RUBBAND_SET_ORIGIN\",\tUI_RUBBAND_SET_ORIGIN },\r\n\t{ \"UI_RUBBAND_SET_POINT\",\tUI_RUBBAND_SET_POINT },\r\n\r\n\t{ \"UI_RUBBAND_SET_ORDER\",\tUI_RUBBAND_SET_ORDER },\r\n\r\n\t{ \"RB_ANIM_ENABLE\",\t\tRB_ANIM_ENABLE },\r\n\t{ \"RB_ANIM_REALTIME\",\tRB_ANIM_REALTIME },\r\n\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIRubberBand> factory(\"UI_RubberBand\", CLS_KLBUIRUBBERBAND, cmd);\r\n\r\nfloat CKLBUIRubberBand::ms_norot_mat[4] = { 1.0f, 0.0f, 0.0f, -1.0f };\r\n\r\nCKLBUIRubberBand::CKLBUIRubberBand()\r\n: CKLBUITask    ()\r\n, m_assetOrigin (NULL)\r\n, m_assetJoint  (NULL)\r\n, m_assetPoint  (NULL)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIRubberBand::~CKLBUIRubberBand() \r\n{\r\n\tKLBDELETEA(m_assetOrigin);\r\n\tKLBDELETEA(m_assetJoint);\r\n\tKLBDELETEA(m_assetPoint);\r\n}\r\n\r\nu32\r\nCKLBUIRubberBand::getClassID()\r\n{\r\n\treturn CLS_KLBUIRUBBERBAND;\r\n}\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIRubberBand::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIRubberBand::getOrder,\t\t\t0\t}, // 表示オーダー\r\n\r\n\t{\t\"asset_origin\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIRubberBand::getAssetOrigin,\t0\t},\r\n\t{\t\"asset_joint\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIRubberBand::getAssetJoint,\t\t0\t},\r\n\t{\t\"asset_point\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIRubberBand::getAssetPoint,\t\t0\t},\r\n\r\n\t{\t\"originX\",\t\tNUMERIC,\t(setBoolT)&CKLBUIRubberBand::setOriginX,\t(getBoolT)&CKLBUIRubberBand::getOriginX,\t\t0\t},\r\n\t{\t\"originY\",\t\tNUMERIC,\t(setBoolT)&CKLBUIRubberBand::setOriginY,\t(getBoolT)&CKLBUIRubberBand::getOriginY,\t\t0\t},\r\n\r\n\t{\t\"pointX\",\t\tNUMERIC,\t(setBoolT)&CKLBUIRubberBand::setPointX,\t\t(getBoolT)&CKLBUIRubberBand::getPointX,\t\t\t0\t},\r\n\t{\t\"pointY\",\t\tNUMERIC,\t(setBoolT)&CKLBUIRubberBand::setPointY,\t\t(getBoolT)&CKLBUIRubberBand::getPointY,\t\t\t0\t},\r\n\t\t\r\n\t{\t\"f_anim\",\t\tBOOLEANT,\t(setBoolT)&CKLBUIRubberBand::setFAnim,\t\t(getBoolT)&CKLBUIRubberBand::getFAnim,\t\t\t0\t},\r\n\t{\t\"f_realtime\",\tBOOLEANT,\t(setBoolT)&CKLBUIRubberBand::setFAnimRT,\t(getBoolT)&CKLBUIRubberBand::getFAnimRT,\t\t0\t},\r\n\t{\t\"anim_time\",\tUINTEGER,\t(setBoolT)&CKLBUIRubberBand::setAnimTime,\t(getBoolT)&CKLBUIRubberBand::getAnimTime,\t\t0\t}\r\n};\r\n\r\n// 引数のインデックス定義\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ASSET_ORIGIN,\r\n\tARG_ASSET_JOINT,\r\n\tARG_ASSET_POINT,\r\n\r\n\tARG_RESOLUTION,\r\n\r\n\tARG_FLAGS,\r\n\r\n\tARG_ANIM_TIME,\r\n\r\n\tARG_JOINT_ORDER_OFFSET,\r\n\tARG_POINT_ORDER_OFFSET,\r\n\r\n\tARG_ROT_ORIGIN,\r\n\tARG_ROT_JOINT,\r\n\tARG_ROT_POINT,\r\n\r\n\tARG_REQUIRE = ARG_ASSET_POINT,\r\n\tARG_NUMS = ARG_ROT_POINT\r\n};\r\n\r\nCKLBUIRubberBand* \r\nCKLBUIRubberBand::create(\r\n    CKLBUITask* pParent, \r\n    CKLBNode* pNode, \r\n    u32 order, float x, float y, u32 resolution, \r\n    const char* origin, const char* joint, const char* point, \r\n    u32 flags, u32 animTime,\r\n    int joint_order_off, int point_order_off,\r\n    bool rot_origin, bool rot_joint, bool rot_point) \r\n{\r\n\tCKLBUIRubberBand* pTask = KLBNEW(CKLBUIRubberBand);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, order,x,y,resolution,origin,joint,point,flags,animTime,joint_order_off,point_order_off,rot_origin,rot_joint,rot_point)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool \r\nCKLBUIRubberBand::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n                       int joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point) \r\n{\r\n    if(!setupNode()) { return false; }\r\n\tbool bResult = initCore(order,x,y,resolution,origin,joint,point,flags,animTime,joint_order_off,point_order_off,rot_origin,rot_joint,rot_point);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif (pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\n\r\nbool CKLBUIRubberBand::initCore(u32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\t\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(0, 0);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order     = order;\r\n\tm_originX   = x;\r\n\tm_originY   = y;\r\n\r\n\t// 初期の先端位置は起点と同じ\r\n\tm_x         = m_originX;\r\n\tm_y         = m_originY;\r\n\r\n\tm_reso      = resolution;\r\n    if(!m_reso) { m_reso = 10; }    // 0 の場合は10分割\r\n\r\n\tsetStrC(m_assetOrigin, origin);\r\n\tsetStrC(m_assetJoint,  joint);\r\n\tsetStrC(m_assetPoint,  point);\r\n\r\n\tm_rot_origin = rot_origin;\r\n\tm_rot_joint  = rot_joint;\r\n\tm_rot_point  = rot_point;\r\n\r\n\tm_fAnim     = (flags & RB_ANIM_ENABLE)   ? true : false;\r\n\tm_fAnimRT   = (flags & RB_ANIM_REALTIME) ? true : false;\r\n\tm_animTime  = animTime;\r\n\r\n\tm_animCount = 0;\r\n\r\n\t// 一通り値が取れたので、nodeやspriteを用意する。\r\n\t\r\n\t// 分割数-1の個数だけ、JointNodeの配列を確保する\r\n\tm_pJointNode = KLBNEWA(CKLBNode *, m_reso - 1);\r\n    if(!m_pJointNode) { return false; }\r\n\tm_sprJoint = KLBNEWA(CKLBDynSprite *, m_reso - 1);\r\n\tif(!m_sprJoint) {\r\n\t\tKLBDELETEA(m_pJointNode);\r\n\t\treturn false;\r\n\t}\r\n\r\n\tCKLBImageAsset * pImgOrigin = (CKLBImageAsset *)CKLBUtility::loadAssetScript( m_assetOrigin, &m_handle_origin);\r\n\tCKLBImageAsset * pImgJoint  = (CKLBImageAsset *)CKLBUtility::loadAssetScript( m_assetJoint,  &m_handle_joint);\r\n\tCKLBImageAsset * pImgPoint  = (CKLBImageAsset *)CKLBUtility::loadAssetScript( m_assetPoint,  &m_handle_point);\r\n\r\n\tm_img_origin = pImgOrigin;\r\n\tm_img_point  = pImgPoint;\r\n\tm_img_joint  = pImgJoint;\r\n\r\n\t// JointのNodeを作る\r\n\tbool bResult = true;\r\n\tPOINT ** arrPoint = &m_vertJoint;\r\n\tint *    cntValue = &m_cntJoint;\r\n\t\r\n\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\t// m_pJointNode[i] = pImgJoint->createSubTree(m_order + joint_order_off);\r\n\r\n\t\tm_pJointNode[i] = KLBNEW(CKLBNode);\r\n\t\tif(!m_pJointNode[i]) {\r\n\t\t\tbResult = false;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tm_sprJoint[i] = create_rotSprite(m_pJointNode[i], order + joint_order_off, pImgJoint, cntValue, arrPoint);\r\n\t\t// 同じassetを使用するので、頂点配列および頂点数の取得は一回で充分。\r\n\t\tcntValue = NULL;\r\n\t\tarrPoint = NULL;\r\n\r\n\t\tgetNode()->addNode(m_pJointNode[i]);\r\n\t\tm_pJointNode[i]->setTranslate(x, y);\r\n\t}\r\n\tif(!bResult) {\r\n\t\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\t\tKLBDELETE(m_pJointNode[i]);\r\n\t\t}\r\n\t\tKLBDELETEA(m_pJointNode);\r\n\t\tCKLBDataHandler::releaseHandle(m_handle_origin);\r\n\t\tCKLBDataHandler::releaseHandle(m_handle_joint);\r\n\t\tCKLBDataHandler::releaseHandle(m_handle_point);\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 起点と終点のDynSpriteを作る\r\n\tm_pOriginNode = KLBNEW(CKLBNode);\r\n\tm_sprOrigin = create_rotSprite(m_pOriginNode, m_order, pImgOrigin, &m_cntOrigin, &m_vertOrigin);\r\n\r\n\tm_pPointNode = KLBNEW(CKLBNode);\r\n\tm_sprPoint  = create_rotSprite(m_pPointNode, m_order + point_order_off, pImgPoint, &m_cntPoint, &m_vertPoint);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIRubberBand::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tu32 flags    = (argc >= ARG_FLAGS)      ? lua.getInt(ARG_FLAGS)     : 0;\r\n\tu32 animTime = (argc >= ARG_ANIM_TIME)  ? lua.getInt(ARG_ANIM_TIME) : 0;\r\n\r\n\tint joint_order_off = ((argc >= ARG_JOINT_ORDER_OFFSET) && !lua.isNil(ARG_JOINT_ORDER_OFFSET)) ? lua.getInt(ARG_JOINT_ORDER_OFFSET) : 1;\r\n\tint point_order_off = ((argc >= ARG_POINT_ORDER_OFFSET) && !lua.isNil(ARG_POINT_ORDER_OFFSET)) ? lua.getInt(ARG_POINT_ORDER_OFFSET) : 2;\r\n\r\n\tbool rot_origin = (argc >= ARG_ROT_ORIGIN) ? lua.getBool(ARG_ROT_ORIGIN) : true;\r\n\tbool rot_joint  = (argc >= ARG_ROT_JOINT)  ? lua.getBool(ARG_ROT_JOINT)  : false;\r\n\tbool rot_point  = (argc >= ARG_ROT_POINT)  ? lua.getBool(ARG_ROT_POINT)  : true;\r\n\r\n\treturn initCore(\r\n\t\tlua.getInt(ARG_ORDER),lua.getFloat(ARG_X), lua.getFloat(ARG_Y),\r\n\t\tlua.getInt(ARG_RESOLUTION),\r\n\t\tlua.getString(ARG_ASSET_ORIGIN),\r\n\t\tlua.getString(ARG_ASSET_JOINT),\r\n\t\tlua.getString(ARG_ASSET_POINT),\r\n\t\tflags,\r\n\t\tanimTime,\r\n\t\tjoint_order_off,\r\n\t\tpoint_order_off,\r\n\t\trot_origin, rot_joint, rot_point);\r\n}\r\n\r\nCKLBDynSprite *\r\nCKLBUIRubberBand::create_rotSprite(CKLBNode * node, u32 order, CKLBImageAsset * asset, int * vertCnt, POINT ** arrVert)\r\n{\r\n\t// 与えられたテクスチャの頂点数を得る\r\n\tint vertCount   = asset->getVertexCount();\r\n\tint indxCount   = asset->getIndexCount();\r\n\tint triangleNum = (indxCount + 2) / 3;\t// 構成するために必要な三角形の数\r\n\tu16 * pIndex    = asset->getIndexBuffer();\r\n\r\n    if(vertCnt) { *vertCnt = vertCount; }\r\n\tif(arrVert) {\r\n\t\tPOINT * arrPoint = KLBNEWA(POINT, vertCount);\r\n\t\t*arrVert = arrPoint;\r\n\t}\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\tCKLBDynSprite * dynSpr = pRdrMgr.allocateCommandDynSprite(triangleNum*3,triangleNum*3); // 三角形4個分のDynamicSprite\tCKLBDynSprite\r\n\r\n\tdynSpr->setTexture(asset);\r\n\tnode->setRender(dynSpr);\r\n\tnode->setRenderOnDestroy(true);\r\n\tnode->setPriority(order);\r\n\r\n\t// 頂点のuvを割り当てる。uvは以後割り当て不要。\r\n\tfor(int i = 0; i < indxCount; i++) {\r\n\t\tfloat u, v;\r\n\t\tfloat x, y;\r\n\t\tint idx = pIndex[i];\r\n\t\tasset->getXY(idx, &x, &y);\t\t// assetからxy取得\r\n\t\tasset->getUV(idx, &u, &v);\t\t// assetからuv取得\r\n\t\tdynSpr->setVertexXY(i, x, y);\t// DynSpriteの頂点にxyを指定\r\n\t\tdynSpr->setVertexUV(i, u, v);\t// DynSpriteの頂点にuvを指定\r\n\t}\r\n\r\n\tgetNode()->addNode(node);\r\n\r\n\treturn dynSpr;\r\n}\r\n\r\nint\r\nCKLBUIRubberBand::commandUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\tint cmd = lua.getInt(2);\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_RUBBAND_SET_ORDER:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 5) {\r\n\t\t\t\tu32 order_origin = lua.getInt(3);\r\n\t\t\t\tu32 order_joint  = lua.getInt(4);\r\n\t\t\t\tu32 order_point  = lua.getInt(5);\r\n\t\t\t\t\r\n\t\t\t\tbResult = setOrder(order_origin, order_joint, order_point);\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIRubberBand::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(m_pOriginNode, m_handle_origin);\r\n\tCKLBUtility::deleteNode(m_pPointNode, m_handle_point);\r\n\r\n\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\tKLBDELETE(m_pJointNode[i]);\r\n\t}\r\n\tCKLBDataHandler::releaseHandle(m_handle_joint);\r\n\tKLBDELETEA(m_sprJoint);\r\n\tKLBDELETEA(m_pJointNode);\r\n\r\n\tKLBDELETEA(m_vertOrigin);\r\n\tKLBDELETEA(m_vertPoint);\r\n\tKLBDELETEA(m_vertJoint);\r\n}\r\n\r\nvoid\r\nCKLBUIRubberBand::execute(u32 deltaT)\r\n{\r\n\tfloat dx, dy;\r\n\tfloat x, y;\r\n\tfloat animRate;\r\n\tx = m_originX;\r\n\ty = m_originY;\r\n\tdx = m_x - x;\r\n\tdy = m_y - y;\r\n\r\n\tif(m_fAnim) {\r\n\t\tif(m_fAnimRT) {\r\n\t\t\tm_animCount += deltaT;\t// 実時間式\r\n\t\t} else {\r\n\t\t\tm_animCount++;\t\t\t// フレームカウント式\r\n\t\t}\r\n\t\tif(m_animTime > 0) {\r\n\t\t\twhile(m_animCount >= m_animTime) {\r\n\t\t\t\tm_animCount -= m_animTime;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// アニメーションレート\r\n\t\tanimRate = (float)m_animCount / (float)m_animTime;\r\n\t} else {\r\n\t\tanimRate = 1.0f;\r\n\t}\r\n\t// 間のポイントが採るべき位置を設定\r\n\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\tfloat n = (float)i + animRate;\r\n\r\n\t\tm_pJointNode[i]->setTranslate(x + (dx * n / m_reso), y + (dy * n / m_reso));\r\n\t}\r\n\t// 位置を指定\r\n\tm_pOriginNode->setTranslate(x, y);\r\n\tm_pPointNode->setTranslate(x + dx, y + dy);\r\n\r\n\t// 先端と基点は回転させる。\r\n\r\n\t// 傾きから回転の角度を得る\r\n\tfloat theta = 0.0f;\r\n\tfloat adx   = (dx > 0.0f) ? dx : -dx;\r\n\tfloat ady   = (dy > 0.0f) ? dy : -dy;\r\n\tif(fabs(adx) < 1.0f && fabs(ady) < 1.0f) {\r\n\t\ttheta = 0.0f;\r\n\t} else {\r\n\t\ttheta = (adx > ady) ? atan(ady/adx) : (M_PI / 2 - atan(adx/ady));\r\n\t}\r\n\tif(dx < 0) { theta = M_PI - theta; }\r\n    if(dy < 0) { theta = -theta;       }\r\n\r\n\tfloat sin_h = sin(theta);\r\n\tfloat cos_h = cos(theta);\r\n\r\n\tfloat mat[4];\r\n\tmat[0] = cos_h;\r\n\tmat[1] = sin_h;\r\n\tmat[2] = sin_h;\r\n\tmat[3] = -cos_h;\r\n\r\n\trot_vertex(m_sprOrigin, m_img_origin, m_cntOrigin, m_vertOrigin, (m_rot_origin) ? mat : ms_norot_mat);\r\n\trot_vertex(m_sprPoint,  m_img_point,  m_cntPoint,  m_vertPoint,  (m_rot_point)  ? mat : ms_norot_mat);\r\n\tm_pOriginNode->markUpMatrix();\r\n\tm_pPointNode->markUpMatrix();\r\n\r\n\t// 間の点も回転させる\r\n\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\trot_vertex(m_sprJoint[i], m_img_joint, m_cntJoint, m_vertJoint, (m_rot_joint) ? mat : ms_norot_mat);\r\n\t\tm_pJointNode[i]->markUpMatrix();\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIRubberBand::rot_vertex(CKLBDynSprite * dynSpr, CKLBImageAsset * pAsset, int cntVert, POINT * pbuf, float * mat)\r\n{\r\n\t// 持っている頂点をすべて与えられたマトリクスで回転させる\r\n\tfor(int i = 0; i < cntVert; i++) {\r\n\t\tfloat x, y;\r\n\t\tpAsset->getXY(i, &x, &y);\r\n\t\tpbuf[i].x = x * mat[0] + y * mat[2];\r\n\t\tpbuf[i].y = x * mat[1] + y * mat[3];\r\n\t}\r\n\r\n\t// 各頂点の座標を指定する\r\n\tint cntIndex = pAsset->getIndexCount();\r\n\tu16 * pIndex = pAsset->getIndexBuffer();\r\n\tfor(int i = 0; i < cntIndex; i++) {\r\n\t\tint idx = pIndex[i];\r\n\t\tdynSpr->setVertexXY(i, pbuf[idx].x, pbuf[idx].y);\t// DynSpriteの頂点にxyを指定\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIRubberBand.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIRubberBand_h\r\n#define CKLBUIRubberBand_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIRubberBand\r\n* \\brief Rubber Band Task Class\r\n* \r\n* CKLBUIRubberBand allows to create dynamic Rubber Bands.\r\n*/\r\nclass CKLBUIRubberBand : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIRubberBand>;\r\nprivate:\r\n\tCKLBUIRubberBand();\r\n\tvirtual ~CKLBUIRubberBand();\r\n\r\n\tbool initCore(\tu32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\n\r\n\tbool init(\tCKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\npublic:\r\n\tu32 getClassID();\r\n\tstatic CKLBUIRubberBand* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 resolution, const char* origin, const char* joint, const char* point, u32 flags, u32 animTime,\r\n\t\t\t\t\t\t\t\t\tint joint_order_off, int point_order_off, bool rot_origin, bool rot_joint, bool rot_point);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline float getOriginX ()\t\t\t{ return m_originX;\t\t}\r\n\tinline void  setOriginX (float x)\t{ m_originX = x;\t\t}\r\n\r\n\tinline float getOriginY ()\t\t\t{ return m_originY;\t\t}\r\n\tinline void  setOriginY (float y)\t{ m_originY = y;\t\t}\r\n\r\n\tinline void  setPointX  (float x)\t{ m_x = x;\t\t\t\t}\r\n\tinline float getPointX  ()\t\t\t{ return m_x;\t\t\t}\r\n\r\n\tinline void  setPointY  (float y)\t{ m_y = y;\t\t\t\t}\r\n\tinline float getPointY  ()\t\t\t{ return m_y;\t\t\t}\r\n\r\n\tinline void  setFAnim   (bool fAnim){ m_fAnim = fAnim;\t\t}\r\n\tinline bool\t getFAnim   ()\t\t\t{ return m_fAnim;\t\t}\r\n\r\n\tinline void  setFAnimRT (bool fAnim){ m_fAnimRT = fAnim;\t}\r\n\tinline bool\t getFAnimRT ()\t\t\t{ return m_fAnimRT;\t\t}\r\n\r\n\tinline void  setAnimTime(u32 time)\t{ m_animTime = time;\t}\r\n\tinline u32   getAnimTime()\t\t\t{ return m_animTime;\t}\r\n\r\n\tinline virtual u32 getOrder         () { return m_order;        }\r\n\tinline const char* getAssetOrigin   () { return m_assetOrigin;  }\r\n\tinline const char* getAssetJoint    () { return m_assetJoint;   }\r\n\tinline const char* getAssetPoint    () { return m_assetPoint;   }\r\n\r\n\tinline bool setOrder(u32 order_origin, u32 order_joint, u32 order_point) {\r\n\t\tm_pOriginNode->setPriority(order_origin);\r\n\t\tm_pPointNode->setPriority(order_point);\r\n\t\tfor(int i = 0; i < m_reso - 1; i++) {\r\n\t\t\tm_pJointNode[i]->setPriority(order_joint);\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\nprivate:\r\n\tu32\t\t    m_order;\r\n\tfloat\t    m_originX;\r\n\tfloat\t    m_originY;\r\n\tfloat\t    m_x;\r\n\tfloat\t    m_y;\r\n\tconst char*\tm_assetOrigin;\r\n\tconst char* m_assetJoint;\r\n\tconst char* m_assetPoint;\r\n\r\n\tCKLBNode\t\t*\tm_pOriginNode;\t\t// 起点となるスプライト(角度に合わせ回転する)\r\n\tCKLBNode\t\t*\tm_pPointNode;\t\t// 先端のスプライト(角度に合わせ回転する)\r\n\tCKLBNode\t\t**\tm_pJointNode;\t\t// 節となるスプライト(回転しない)\r\n\r\n\tCKLBDynSprite\t*\tm_sprOrigin;\t\t// 起点用\r\n\tCKLBDynSprite\t*\tm_sprPoint;\t\t\t// 先端用\r\n\tCKLBDynSprite\t**\tm_sprJoint;\t\t\t// 節用\r\n\r\n\tstruct POINT {\r\n\t\tfloat x;\r\n\t\tfloat y;\r\n\t};\r\n\tint\t\t\t\t\tm_cntOrigin;\r\n\tPOINT\t\t\t*\tm_vertOrigin;\r\n\r\n\tint\t\t\t\t\tm_cntPoint;\r\n\tPOINT\t\t\t*\tm_vertPoint;\r\n\r\n\tint\t\t\t\t\tm_cntJoint;\r\n\tPOINT\t\t\t*\tm_vertJoint;\r\n\r\n\tu32\t\t\t\t\tm_handle_origin;\t// 起点テクスチャのハンドル\r\n\tu32\t\t\t\t\tm_handle_point;\t\t// 先端テクスチャのハンドル\r\n\tu32\t\t\t\t\tm_handle_joint;\t\t// 節テクスチャのハンドル\r\n\r\n\tCKLBImageAsset\t*\tm_img_origin;\r\n\tCKLBImageAsset\t*\tm_img_point;\r\n\tCKLBImageAsset\t*\tm_img_joint;\r\n\r\n\tbool\t\t\t\tm_rot_origin;\r\n\tbool\t\t\t\tm_rot_joint;\r\n\tbool\t\t\t\tm_rot_point;\r\n\r\n\tint\t\t\t\t\tm_reso;\t\t\t\t// 分割数\r\n\r\n\tbool\t\t\t\tm_fAnim;\t\t\t// アニメーションの有無\r\n\tbool\t\t\t\tm_fAnimRT;\t\t\t// 時間指定のリアルタイムフラグ(false = フレーム指定)\r\n\tu32\t\t\t\t\tm_animTime;\t\t\t// アニメーション時間(1ループ)\r\n\tu32\t\t\t\t\tm_animCount;\t\t// 経過時間カウント\r\n\r\n\r\n\tPOINT\t\t\t\tm_origin;\r\n\tPOINT\t\t\t\tm_point;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n\tstatic float\t\tms_norot_mat[4];\r\nprivate:\r\n\tCKLBDynSprite * create_rotSprite(CKLBNode * node, u32 order, CKLBImageAsset * asset,\r\n\t\t\t\t\t\t\t\t\t int * vertCnt, POINT ** arrVert);\r\n\tvoid rot_vertex(CKLBDynSprite * dynSpr, CKLBImageAsset * pAsset, int cntVert, POINT * pbuf, float * mat);\r\n};\r\n\r\n#endif // CKLBUIRubberBand_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUISWFPlayer.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUISWFPlayer.h\"\r\n#include \"CKLBObject.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"Message.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_SWF_PLAY = 0,\r\n\tUI_SWF_STOP,\r\n\tUI_SWF_GOTOFRAME,\r\n\tUI_SWF_REACHFRAME,\r\n\tUI_SWF_GETFRAME,\r\n\tUI_SWF_SETFRAMERATE,\r\n\tUI_SWF_SETFRAMERATE_SCALE,\r\n\tUI_SWF_SETIMAGE,\r\n\r\n\t//\tUI_SWF_REPLACE_ASSETS,\t\t// 廃止\r\n\r\n\tUI_SWF_IS_ANIM,\r\n\tUI_SWF_SETSEVOLUME,\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_SWF_PLAY\",\t\t\tUI_SWF_PLAY},\r\n\t{\"UI_SWF_STOP\",\t\t\tUI_SWF_STOP},\r\n\t{\"UI_SWF_GOTOFRAME\",\tUI_SWF_GOTOFRAME},\r\n\t{\"UI_SWF_REACHFRAME\",\tUI_SWF_REACHFRAME},\r\n//\t{\"UI_SWF_GETFRAME\",\t\tUI_SWF_GETFRAME},\r\n\t{\"UI_SWF_SETFRAMERATE\",\tUI_SWF_SETFRAMERATE},\r\n\t{\"UI_SWF_SETFRAMERATE_SCALE\", UI_SWF_SETFRAMERATE_SCALE },\r\n//\t{\"UI_SWF_SETIMAGE\",\t\tUI_SWF_SETIMAGE},\r\n\r\n//\t{\"UI_SWF_REPLACE_ASSETS\", UI_SWF_REPLACE_ASSETS },\r\n\r\n\t{\"UI_SWF_IS_ANIM\",\t\tUI_SWF_IS_ANIM },\r\n\t{\"UI_SWF_SETSEVOLUME\",\tUI_SWF_SETSEVOLUME },\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUISWFPlayer> factory(\"UI_SWFPlayer\", CLS_KLBUISWFPLAYER, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUISWFPlayer::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUISWFPlayer::setOrder,\t(getBoolT)&CKLBUISWFPlayer::getOrder,\t\t0\t},\r\n\t{\t\"asset\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUISWFPlayer::getAsset,\t\t0\t},\r\n\t{\t\"mvname\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUISWFPlayer::getMovieName,\t0\t},\r\n\r\n\t{\t\"callback\",\tSTRING,\t\t(setBoolT)&CKLBUISWFPlayer::setCallBack,(getBoolT)&CKLBUISWFPlayer::getCallBack,\t0\t},\r\n\r\n\t{\t\"play\",\t\tBOOLEANT,\t(setBoolT)&CKLBUISWFPlayer::setPlay,\t(getBoolT)&CKLBUISWFPlayer::getPlay,\t\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ASSET,\r\n\tARG_MVNAME,\r\n\tARG_CALLBACK,\r\n\r\n\tARG_ASSET_REPLACE,\r\n\r\n\tARG_REQUIRE = ARG_MVNAME,\r\n\tARG_NUMS = ARG_ASSET_REPLACE\r\n};\r\n\r\n\r\nCKLBUISWFPlayer::CKLBUISWFPlayer()\r\n: CKLBUITask    ()\r\n, m_beginLabel  (NULL)\r\n, m_flashHandle (0)\r\n, m_callBack    (NULL)\r\n, m_movieName   (NULL)\r\n, m_asset       (NULL)\r\n, m_play        (true)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUISWFPlayer::~CKLBUISWFPlayer() \r\n{\r\n\tKLBDELETEA(m_callBack);\r\n\tKLBDELETEA(m_movieName);\r\n\tKLBDELETEA(m_asset);\r\n}\r\n\r\nu32\r\nCKLBUISWFPlayer::getClassID()\r\n{\r\n\treturn CLS_KLBUISWFPLAYER;\r\n}\r\n\r\nCKLBUISWFPlayer *\r\nCKLBUISWFPlayer::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                        u32 order, float x, float y, const char * asset,\r\n                        const char * movie_name, const char * complete_callback,\r\n                        const char ** replace_list, int asset_cnt)\r\n{\r\n\tCKLBUISWFPlayer * pTask = KLBNEW(CKLBUISWFPlayer);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParent, pNode, order, x, y, asset, movie_name, complete_callback,\r\n\t\t\t\t\treplace_list, asset_cnt)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUISWFPlayer::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                      u32 order, float x, float y, const char * asset,\r\n                      const char * movie_name, const char * complete_callback,\r\n                      const char ** replace_list, int asset_cnt)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, asset, movie_name, complete_callback, replace_list, asset_cnt);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUISWFPlayer::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\tfloat x     = lua.getFloat(ARG_X);\r\n\tfloat y     = lua.getFloat(ARG_Y);\r\n\tu32   order = lua.getInt(ARG_ORDER);\r\n\tconst char * asset      = lua.getString(ARG_ASSET);\r\n\tconst char * mvname     = (lua.isNil(ARG_MVNAME)) ? NULL : lua.getString(ARG_MVNAME);\r\n\tconst char * callback   = (argc >= ARG_CALLBACK)  ? lua.getString(ARG_CALLBACK) : NULL;\r\n\r\n\tint asset_cnt = 0;\r\n\tconst char ** replace_list = (argc >= ARG_ASSET_REPLACE) ? replaceAssets(lua, ARG_ASSET_REPLACE, &asset_cnt) : NULL;\r\n\tbool bResult = initCore(order, x, y, asset, mvname, callback, replace_list, asset_cnt);\r\n\tremoveReplaceList(replace_list, asset_cnt);\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUISWFPlayer::initCore(u32 order,\r\n                          float x, float y, const char * asset,\r\n                          const char * movie_name, const char * complete_callback,\r\n                          const char ** replace_list, int asset_cnt)\r\n{\r\n\t// 保持プロパティの定義\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\r\n\tREFRESH_A;\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\tsetStrC(m_asset, asset);\r\n\r\n\tif(!movie_name) {\r\n\t\tm_movieName = NULL;\r\n\t} else {\r\n\t\tsetStrC(m_movieName, movie_name);\r\n\t}\r\n\r\n\tif(complete_callback) { setStrC(m_callBack, complete_callback); }\r\n\r\n\t// Asset をロードし、CKLBSWFAssetを作る。\r\n\tCKLBSWFAsset* pSWFAsset;\r\n\tpSWFAsset = (CKLBSWFAsset *)CKLBUtility::loadAssetScript(m_asset, &m_flashHandle);\r\n    if(!pSWFAsset) { return false; }\r\n\r\n\t// CKLBSWFAsset から、addMovie でCKLBSWFMovieを作る。\r\n\tSMatrix2D mat;\r\n\tm_pSWFNode = (CKLBSWFMovie*)pSWFAsset->addMovieA((char *)m_movieName, 0, &mat, 0, replace_list, asset_cnt);\r\n\tif(!m_pSWFNode) {\r\n\t\tklb_assertAlways(\"SWF could not create instance of movie %s. Is ASLinkage setup correctly ? Movie Name correct ?\", m_movieName);\r\n\t\tCKLBDataHandler::releaseHandle(m_flashHandle);\r\n\t\treturn false;\r\n\t}\r\n\tgetNode()->addNode(m_pSWFNode);\r\n\r\n\t// 初期パラメータを与える\r\n\tm_pSWFNode->setPriority(m_order);\r\n\r\n\t// メッセージcallbackを登録する\r\n\tm_pSWFNode->setListener(this);\r\n\r\n\t// 初期状態のフレームレートを取得する(単位:[ms])\r\n\tm_defaultRate = m_pSWFNode->getFrameRate();\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUISWFPlayer::execute(u32)\r\n{\r\n\tif(CHANGE_A) {\r\n\t\t// スクリプトからプロパティが変更されたら反映させる\r\n\t\tm_pSWFNode->setPlay(m_play);\r\n\t\tm_pSWFNode->setPriority(m_order);\r\n\t\tRESET_A;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUISWFPlayer::dieUI()\r\n{\r\n\tLABEL * pLabel = m_beginLabel;\r\n\tLABEL * nxt;\r\n\twhile(pLabel) {\r\n\t\tnxt = pLabel->next;\r\n\t\tKLBDELETEA(pLabel->label);\r\n\t\tKLBDELETEA(pLabel->callback);\r\n\t\tKLBDELETE(pLabel);\r\n\t\tpLabel = nxt;\r\n\t}\r\n\tm_pSWFNode->setPlay(false);\r\n\tCKLBUtility::deleteNode(m_pSWFNode, m_flashHandle);\r\n}\r\n\r\nvoid CKLBUISWFPlayer::reachFrame(const char* label, const char* callBack) {\r\n\tLABEL * pLabel;\r\n\tfor(pLabel = m_beginLabel; pLabel; pLabel = pLabel->next) {\r\n\t\tif(!CKLBUtility::safe_strcmp(label, pLabel->label)) {\r\n            if(pLabel->callback) { KLBDELETEA(pLabel->callback); }\r\n\t\t\tpLabel->callback = CKLBUtility::copyString(callBack);\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\tif(!pLabel) {\r\n\t\tpLabel = KLBNEW(LABEL);\r\n\t\tif(!pLabel) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpLabel->label = CKLBUtility::copyString(label);\r\n\t\tpLabel->callback = CKLBUtility::copyString(callBack);\r\n\t\tif(!pLabel->label || !pLabel->callback) {\r\n\t\t\tKLBDELETEA(pLabel->label);\r\n\t\t\tKLBDELETEA(pLabel->callback);\r\n\t\t\tKLBDELETE(pLabel);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpLabel->index = 0xFFFF;\r\n\t\tpLabel->next  = m_beginLabel;\r\n\t\tm_beginLabel  = pLabel;\r\n\t}\r\n}\r\n\r\nint\r\nCKLBUISWFPlayer::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_SWF_PLAY:\r\n\t\t{\r\n\t\t\tsetPlay(true);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_STOP:\r\n\t\t{\r\n\t\t\tsetPlay(false);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_GOTOFRAME:\r\n\t\t{\r\n\t\t\tconst char * label = lua.getString(3);\r\n\t\t\t//u16 fnum;\r\n\t\t\tgotoFrame(label);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_REACHFRAME:\r\n\t\t{\r\n\t\t\tconst char * label\t\t= lua.getString(3);\r\n\t\t\tconst char * luafunc\t= lua.getString(4);\r\n\r\n\t\t\treachFrame(label, luafunc);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_GETFRAME:\r\n\t\t{\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_SETFRAMERATE:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t// fps で与える\r\n\t\t\tu16 fps = lua.getInt(3);\r\n\t\t\tsetFrameRate(fps);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_SETFRAMERATE_SCALE:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfloat scale = lua.getFloat(3);\r\n\t\t\tsetFrameRateScale(scale);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_SETIMAGE:\r\n\t\t{\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_IS_ANIM:\r\n\t\t{\r\n\t\t\tbool result = isAnimating();\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SWF_SETSEVOLUME:\r\n\t\t{\r\n\t\t\tif (argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tsetVolume(lua.getFloat(3));\r\n\t\t}\r\n\t\tbreak;\r\n/*\r\n\tcase UI_SWF_REPLACE_ASSETS:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tint asset_cnt = 0;\r\n\t\t\t\tconst char ** replace_list = replaceAssets(lua, 3, &asset_cnt);\r\n\t\t\t\tm_pSWFNode->replaceAsTemplate(replace_list, asset_cnt);\r\n\t\t\t\tremoveReplaceList(replace_list, asset_cnt);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n*/\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nconst char **\r\nCKLBUISWFPlayer::replaceAssets(CLuaState& lua, int pos, int * retcnt)\r\n{\r\n\tconst char ** list = KLBNEWA(const char *, REPLACE_BLOCK);\r\n\tint max     = REPLACE_BLOCK;\r\n\tint cnt     = 0;\r\n\tint cntmax  = 0;\r\n\tlua.retValue(pos);\r\n\tlua.retNil();\r\n\twhile(lua.tableNext()) {\r\n\t\tconst char * string = lua.getString(-1);\r\n\r\n\t\t// lua配列の indexは nextでとると順不同になる可能性があるため、\r\n\t\t// 実際のindex値を取得しておく\r\n\t\tlua.retValue(-2);\r\n\t\tint index = lua.getInt(-1);\r\n\t\tlua.pop(1);\r\n\r\n\t\t// 現在のバッファが index を収容しきれないようであれば、\r\n\t\t// 収容できるサイズまで拡張する\r\n\t\tcnt = index - 1;\r\n        if(cntmax < cnt) { cntmax = cnt; }\r\n\t\twhile(cnt >= max) {\r\n\t\t\tconst char ** tmplist = KLBNEWA(const char *, max + REPLACE_BLOCK);\r\n            for(int i = 0; i < max; i++) { tmplist[i] = list[i]; }\r\n\t\t\tKLBDELETEA(list);\r\n\t\t\tlist = tmplist;\r\n\t\t\tmax += REPLACE_BLOCK;\r\n\t\t}\r\n\t\tlist[cnt] = CKLBUtility::copyString(string);\r\n\t\tlua.pop(1);\r\n\t}\r\n\tlua.pop(1);\r\n\r\n\t*retcnt = (cntmax + 1) / 2;\r\n\treturn list;\r\n}\r\n\r\nbool\r\nCKLBUISWFPlayer::removeReplaceList(const char ** list, int cnt)\r\n{\r\n    if(!list) { return true; }\r\n\r\n\tbool result = false;\r\n\r\n    for(int i = 0; i < cnt * 2; i++) { KLBDELETEA(list[i]); }\r\n\tKLBDELETEA(list);\r\n\r\n\treturn result;\r\n}\r\n\r\nvoid\r\nCKLBUISWFPlayer::receiveMsg(CKLBObject* /*emitter*/, u32 msgID, u32 msgParam)\r\n{\r\n\tswitch(msgID)\r\n\t{\r\n\tcase LABEL_REACHED:\r\n\t\t{\r\n\t\t\t// 既に既知のindexであれば、それで飛ぶ。\r\n\t\t\tLABEL * pLabel;\r\n\t\t\tfor(pLabel = m_beginLabel; pLabel; pLabel = pLabel->next) {\r\n\t\t\t\tif(pLabel->index == msgParam) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventSwf(pLabel->callback, this, pLabel->label);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\r\n\t\t\t// 未知の index であれば、ラベルから検索する。\r\n\r\n\t\t\tconst char * label = ((CKLBSWFAsset*)CKLBDataHandler::getPointer(m_flashHandle))->getConstantString(msgParam);\r\n\t\t\tfor(pLabel = m_beginLabel; pLabel; pLabel = pLabel->next) {\r\n\t\t\t\tif(!CKLBUtility::safe_strcmp(pLabel->label, label)) {\r\n\t\t\t\t\tpLabel->index = msgParam;\t// 次回以降indexでの検索を可能にする。\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventSwf(pLabel->callback, this, pLabel->label);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// 該当するものがなければ、次回からの文字列比較を不要にするため、\r\n\t\t\t// 項目を作成する。\r\n\t\t\tpLabel = KLBNEW(LABEL);\r\n            if(!pLabel) { break; }\r\n\t\t\tpLabel->callback = NULL;\r\n\t\t\tpLabel->label = CKLBUtility::copyString(label);\r\n            if(!pLabel->label) {\r\n                KLBDELETEA(pLabel->label);\r\n                KLBDELETE(pLabel);\r\n                break;\r\n            }\r\n\t\t\tpLabel->index = msgParam;\r\n\t\t\tpLabel->next  = m_beginLabel;\r\n\t\t\tm_beginLabel  = pLabel;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase ANIMATION_COMPLETE:\r\n\t\t{\r\n\t\t\tCKLBScriptEnv::getInstance().call_eventSwf(m_callBack, this, \"\");\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUISWFPlayer.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUISWFPlayer_h\r\n#define CKLBUISWFPlayer_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBSWFPlayer.h\"\r\n\r\n/*!\r\n* \\class CKLBUISWFPlayer\r\n* \\brief SWF Player Task Class\r\n* \r\n* CKLBUISWFPlayer is a Flash Player that can read and display our SWFAssets.\r\n*/\r\nclass CKLBUISWFPlayer : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUISWFPlayer>;\r\nprotected:\r\n\tCKLBUISWFPlayer();\r\n\tvirtual ~CKLBUISWFPlayer();\r\npublic:\r\n\tstatic CKLBUISWFPlayer * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t            u32 order, float x, float y, const char * asset,\r\n\t\t\t\t\t\t            const char * movie_name, const char * complete_callback,\r\n\t\t\t\t\t\t            const char ** replace_list, int asset_cnt);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n    u32 getClassID();\r\n\r\n\tinline bool getPlay() { return m_play; }\r\n    inline void setPlay(bool play) {\r\n\t\tif (m_play != play) {\r\n\t\t\tm_play = play;\r\n\t\t\tm_pSWFNode->setPlay(play);\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getOrder()\t\t\t{ return m_order;\t\t}\r\n    inline void setOrder(u32 order) {\r\n\t\tif (order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getCallBack()\t                    { return m_callBack;\t         }\r\n    inline void         setCallBack(const char* callBack)   { setStrC(m_callBack, callBack); }\r\n\t\r\n\tinline const char* getAsset()\t\t{ return m_asset;\t\t}\r\n\r\n\tinline const char* getMovieName()\t{ return m_movieName;\t}\r\n\r\n\tinline void gotoFrame(const char* label) {\r\n\t\tu16 fnum;\r\n\t\tm_pSWFNode->findCodeFrame((char *)label, &fnum);\r\n\t\tm_pSWFNode->gotoFrame(fnum);\r\n\t\tif (fnum == NULL_IDX) {\r\n\t\t\t\tDEBUG_PRINT(\"[SCRIPT] Flash GOTOFRAME %s not found.\", label);\r\n\t\t}\r\n\t}\r\n\r\n\tinline u16\tgetFrameRate()\t\t\t{ return 1000/m_pSWFNode->getFrameRate();\t\t}\r\n\tinline void setFrameRate(u32 fps)\t{ m_pSWFNode->setFrameRate((u16)(1000/fps));\t}\r\n\r\n\tinline bool isAnimating()\t\t\t{ return m_pSWFNode->isStillAnimating();\t\t}\r\n\r\n\tinline void setFrameRateScale(float scale) {\r\n\t\tfloat rate = (float)m_defaultRate * scale;\r\n\t\tm_pSWFNode->setFrameRate((u16)rate);\r\n\t}\r\n\r\n\tinline float getVolume()\t\t\t\t{ return m_pSWFNode->getVolumeSE();\t}\r\n\tinline void  setVolume(float volume)\t{ m_pSWFNode->setVolumeSE(volume);\t}\r\n\r\nprivate:\r\n\r\n\tconst char*\tm_callBack;\r\n\tconst char* m_movieName;\r\n\tconst char* m_asset;\r\n\tu32\t\t\tm_order;\r\n\tbool\t\tm_play;\r\n\r\n\tCKLBSWFMovie\t\t*\tm_pSWFNode;\r\n\r\n\tstruct LABEL {\r\n\t\tLABEL\t   * next;\r\n\r\n\t\tconst char * label;\r\n\t\tconst char * callback;\r\n\t\tu16\t\t\t index;\r\n\t};\r\n\r\n\tLABEL\t\t\t*\tm_beginLabel;\r\n\tu32\t\t\t\t\tm_flashHandle;\r\n\r\n\tu16\t\t\t\t\tm_defaultRate;\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n\r\n\tenum {\r\n\t\tREPLACE_BLOCK = 10\r\n\t};\r\n\r\n\tvoid receiveMsg\t(CKLBObject* emitter, u32 msgID, u32 msgParam);\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t  u32 order, float x, float y, const char * asset,\r\n\t\t\t  const char * movie_name, const char * complete_callback,\r\n\t\t\t  const char ** replace_list = NULL, int asset_cnt = 0);\r\n\r\n\tbool initCore(  u32 order,\r\n\t\t\t\t\tfloat x, float y, const char * asset,\r\n\t\t\t\t\tconst char * movie_name, const char * complete_callback,\r\n\t\t\t\t\tconst char ** asset_list = NULL, int replace_cnt = 0);\r\n\r\n\tconst char **   replaceAssets       (CLuaState& lua, int pos, int * retcnt);\r\n\tbool            removeReplaceList   (const char ** list, int cnt);\r\n\tvoid            reachFrame          (const char* label, const char* callBack);\r\n\r\n};\r\n\r\n\r\n\r\n#endif // CKLBUISWFPlayer_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIScale9.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIScale9.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_SCALE9_SETRESOURCE\t= 0,\r\n\tUI_SCALE9_SETWIDTH\t\t= 1,\r\n\tUI_SCALE9_SETHEIGHT\t\t= 2,\r\n\tUI_SCALE9_SETSIZE\t\t= 3\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_SCALE9_SETRESOURCE\",\t\tUI_SCALE9_SETRESOURCE\t\t},\r\n\t{\"UI_SCALE9_SETWIDTH\",\t\t\tUI_SCALE9_SETWIDTH\t\t\t},\r\n\t{\"UI_SCALE9_SETHEIGHT\",\t\t\tUI_SCALE9_SETHEIGHT\t\t\t},\r\n\t{\"UI_SCALE9_SETSIZE\",\t\t\tUI_SCALE9_SETSIZE\t\t\t},\r\n\t{0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIScale9> factory(\"UI_Scale9\", CLS_KLBUISCALE9, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIScale9::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUIScale9::setOrder,\t(getBoolT)&CKLBUIScale9::getOrder,\t0\t},\r\n\t{\t\"width\",\tINTEGER,\t(setBoolT)&CKLBUIScale9::setWidth,\t(getBoolT)&CKLBUIScale9::getWidth,\t0\t},\r\n\t{\t\"height\",\tINTEGER,\t(setBoolT)&CKLBUIScale9::setHeight,\t(getBoolT)&CKLBUIScale9::getHeight,\t0\t},\r\n\t{\t\"asset\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScale9::getAsset,\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\tARG_ASSET,\r\n\r\n\tARG_REQUIRE\t= ARG_ASSET,\r\n\tARG_NUMS\t= ARG_ASSET\r\n};\r\n\r\nCKLBUIScale9::CKLBUIScale9()\r\n: CKLBUITask    ()\r\n, m_handle      (0)\r\n, m_texture     (NULL)\r\n, m_scale9      (NULL)\r\n, m_asset       (NULL)\r\n, m_width       (0)\r\n, m_height      (0)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIScale9::~CKLBUIScale9() {\r\n KLBDELETEA(m_asset);\r\n}\r\n\r\nu32\r\nCKLBUIScale9::getClassID()\r\n{\r\n\treturn CLS_KLBUISCALE9;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIScale9::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tu32 order\t= lua.getInt(ARG_ORDER);\r\n\tfloat x \t= lua.getFloat(ARG_X);\r\n\tfloat y \t= lua.getFloat(ARG_Y);\r\n\r\n\treturn initCore(order, x,y, \r\n\t\tlua.getInt(ARG_WIDTH),\r\n\t\tlua.getInt(ARG_HEIGHT),\r\n\t\tlua.getString(ARG_ASSET));\r\n}\r\n\r\nCKLBUIScale9 *\r\nCKLBUIScale9::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                     u32 order, float x, float y, s32 width, s32 height,\r\n                     const char * asset)\r\n{\r\n\tCKLBUIScale9 * pTask = KLBNEW(CKLBUIScale9);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParent, pNode, order, x, y, width, height, asset)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIScale9::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                   u32 order, float x, float y, s32 width, s32 height, const char * asset)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, width, height, asset);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIScale9::initCore(u32 order, float x, float y, s32 width, s32 height, const char * asset)\r\n{\r\n\t// 対応するプロパティリストを規定する。\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\t/* FUTURE VERSION.\r\n\t// 対応するプロパティリストを規定する。\r\n\tCKLBUITask::setupPropertyList(s_Scale9NameStatic, m_Scale9PropValue, m_Scale9PropType, m_Scale9PropChecked);\r\n\tfillPropertyList(ms_propItems);\r\n\t*/\r\n\t\r\n\tCKLBAsset* pAsset = CKLBUtility::loadAssetScript(asset,&m_handle);\r\n\tif(pAsset && (pAsset->getAssetType() == ASSET_IMAGE)) {\r\n\t\tCKLBImageAsset* pImage = (CKLBImageAsset*)pAsset;\r\n\t\tbool isScale9 = (pImage->hasStandardAttribute(CKLBImageAsset::IS_SCALE9) != 0);\t\t\r\n\t\tif(isScale9) {\r\n\t\t\tm_scale9 = (CKLBSpriteScale9*)CKLBRenderingManager::getInstance().allocateCommandSprite(pImage, order);\r\n\t\t} else {\r\n\t\t\tklb_assertAlways(\"Not scale 9 image associated to UIScale9 object (%s)\",asset);\r\n\t\t}\r\n\t}\r\n\r\n\tif(!m_scale9) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tsetOrder(order);\r\n\tsetStrC(m_asset, asset);\r\n\r\n\tgetNode()->setRender(m_scale9);\r\n\tsetInitPos(x, y);\r\n\tsetWidth(width);\r\n\tsetHeight(height);\r\n\tm_bInit = true;\r\n\t\r\n\treturn true;\r\n}\r\n\r\nbool \r\nCKLBUIScale9::setAsset(const char* asset) \r\n{\r\n\tu32 oldHandle = m_handle;\r\n\r\n\tCKLBAsset* pAsset = CKLBUtility::loadAssetScript(asset,&m_handle);\r\n\tif(pAsset && (pAsset->getAssetType() == ASSET_IMAGE)) {\r\n\t\tCKLBImageAsset* pImgAsset\t= (CKLBImageAsset*)pAsset;\r\n\t\tbool isScale9 = (pImgAsset->hasStandardAttribute(CKLBImageAsset::IS_SCALE9) != 0);\t\t\r\n\t\tif(isScale9) {\r\n\t\t\tsetStrC(m_asset, asset);\r\n\t\t\tm_scale9->useImage(pImgAsset);\r\n\t\t\t// Release link on previous texture.\r\n\t\t\tCKLBUtility::deleteNode(NULL, oldHandle);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nint\r\nCKLBUIScale9::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tbool result = false;\r\n\tint  ret    = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_SCALE9_SETRESOURCE:\r\n\t\tif (argc == 3) {\r\n\t\t\tresult = setAsset(lua.getString(3));\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCALE9_SETWIDTH:\r\n\t\tif (argc == 3) {\r\n\t\t\ts32 width = lua.getInt(3);\r\n\t\t\tsetWidth(width);\r\n\t\t\tret = 1;\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCALE9_SETHEIGHT:\r\n\t\tif (argc == 3) {\r\n\t\t\ts32 height = lua.getInt(3);\r\n\t\t\tsetHeight(height);\r\n\t\t\tret = 1;\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCALE9_SETSIZE:\r\n\t\tif (argc == 4) {\r\n\t\t\ts32 width\t= lua.getInt(3);\r\n\t\t\ts32 height\t= lua.getInt(4);\r\n\r\n\t\t\tsetWidth(width);\r\n\t\t\tsetHeight(height);\r\n\t\t\t\r\n\t\t\tret = 1;\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\t{\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\tlua.retBoolean(result);\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIScale9::execute(u32 /* deltaT */)\r\n{\r\n}\r\n\r\nvoid\r\nCKLBUIScale9::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(NULL, m_handle);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIScale9.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIScale9_h\r\n#define CKLBUIScale9_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIScale9\r\n* \\brief Scale 9 Task CLass\r\n* \r\n* CKLBUIScale9 is designed to manage assets cut in 9 parts.\r\n* 4 for corners, 4 for borders and 1 for the center.\r\n*/\r\nclass CKLBUIScale9 : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIScale9>;\r\nprivate:\r\n\tCKLBUIScale9();\r\n\tvirtual ~CKLBUIScale9();\r\nprotected:\r\n\tenum PROP_ID{\r\n\t\tPR_ORDER /*= PRG_LAST_UITASK  <-- Support in FUTURE changes */,\r\n\t\tPR_WIDTH,\r\n\t\tPR_HEIGHT,\r\n\t\tPR_ASSET,\r\n\t\tPR_LAST_UISCALE9\r\n\t};\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBUIScale9 * create(CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, s32 width, s32 height, const char* SCALE9Asset);\r\n\t\r\n\tbool init\t\t(CKLBUITask * pParent, CKLBNode * pNode, u32 order, float x, float y, s32 width, s32 height, const char* SCALE9Asset);\r\n\tbool initCore\t(u32 order, float x, float y, s32 width, s32 height, const char* SCALE9Asset);\r\n\r\n\tbool initUI\t\t(CLuaState& lua);\r\n\tint commandUI\t(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute\t(u32 deltaT);\r\n\tvoid dieUI\t\t();\r\n\r\n\tinline void setWidth(s32 width) {\r\n\t\tif(m_width != width) {\r\n\t\t\tm_scale9->setWidth(width);\r\n\t\t\tm_width = width;\r\n\t\t\tgetNode()->markUpMatrix();\r\n\t\t}\r\n\t}\r\n\tinline s32 getWidth() { return m_width; }\r\n\r\n\tinline void setHeight(s32 height) {\r\n\t\tif(m_height != height) {\r\n\t\t\tm_scale9->setHeight(height);\r\n\t\t\tm_height = height;\r\n\t\t\tgetNode()->markUpMatrix();\r\n\t\t}\r\n\t}\r\n\tinline s32 getHeight() { return m_height; }\r\n\r\n\tinline void setOrder(u32 order) {\r\n\t\tif(order != m_order) {\r\n\t\t\tm_scale9->changeOrder(CKLBRenderingManager::getInstance(),order);\r\n\t\t\tm_order = order;\r\n\t\t}\r\n\t}\r\n\tinline u32 getOrder() { return m_order; }\r\n\r\n\tinline const char* getAsset() { return m_asset; }\r\n\r\n\tbool setAsset\t(const char* asset);\r\n\r\nprivate:\r\n\tu32\t\t\t\t\tm_handle;\r\n\tCKLBTextureAsset*\tm_texture;\r\n\tconst char*\t\t\tm_asset;\r\n\tCKLBSpriteScale9*\tm_scale9;\r\n\t\r\n\tbool\t\t\t    m_bInit;\r\n\tu32\t\t\t\t    m_order;\r\n\ts32\t\t\t\t    m_width;\r\n\ts32\t\t\t\t    m_height;\r\n\r\n\tstatic PROP_V2\t\t\tms_propItems[];\r\n\r\n\t/* FUTURE property handling.\r\n\tstatic\r\n\tconst char *\ts_Scale9NameStatic\t\t[PR_LAST_UISCALE9];\r\n\tVALUE\t\t\tm_Scale9PropValue\t\t[PR_LAST_UISCALE9];\r\n\tPROPTYPE\t\tm_Scale9PropType\t\t[PR_LAST_UISCALE9];\r\n\tbool\t\t\tm_Scale9PropChecked\t\t[PR_LAST_UISCALE9];\r\n\t*/\r\n};\r\n\r\n#endif // CKLBUIScale9_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIScore.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIScore.h\"\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_SCORE_RESET = 0,\r\n\tUI_SCORE_SET,\r\n\tUI_SCORE_SETFLOAT,\r\n\tUI_SCORE_SETDOT,\r\n\tUI_SCORE_GET,\r\n\tUI_SCORE_ENTERANIM,\r\n\tUI_SCORE_EXITANIM,\r\n\tUI_SCORE_ALIGN,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_SCORE_RESET\",     UI_SCORE_RESET      },\r\n\t{ \"UI_SCORE_SET\",       UI_SCORE_SET        },\r\n\t{ \"UI_SCORE_GET\",       UI_SCORE_GET        },\r\n\t{ \"UI_SCORE_ENTERANIM\", UI_SCORE_ENTERANIM  },\r\n\t{ \"UI_SCORE_EXITANIM\",  UI_SCORE_EXITANIM   },\r\n\t{ \"UI_SCORE_ALIGN\",     UI_SCORE_ALIGN      },\r\n\t{ \"UI_SCORE_SETFLOAT\",\tUI_SCORE_SETFLOAT },\r\n\t{ \"UI_SCORE_DOT\",\t\tUI_SCORE_SETDOT },\r\n\r\n\t{ \"SCORE_ALIGN_RIGHT\",\tCKLBUIScore::ALIGN_RIGHT    },\r\n\t{ \"SCORE_ALIGN_CENTER\",\tCKLBUIScore::ALIGN_CENTER   },\r\n\t{ \"SCORE_ALIGN_LEFT\",\tCKLBUIScore::ALIGN_LEFT     },\r\n\r\n\t{ \"ANM_X_COORD_0\",          CKLBSplineNode::ANM_X_COORD_0       },\r\n\t{ \"ANM_Y_COORD_1\",          CKLBSplineNode::ANM_Y_COORD_1       },\r\n\t{ \"ANM_SCALE_COORD_2\",      CKLBSplineNode::ANM_SCALE_COORD_2   },\r\n\t{ \"ANM_R_COLOR_3\",          CKLBSplineNode::ANM_R_COLOR_3       },\r\n\t{ \"ANM_G_COLOR_4\",          CKLBSplineNode::ANM_G_COLOR_4       },\r\n\t{ \"ANM_B_COLOR_5\",          CKLBSplineNode::ANM_B_COLOR_5       },\r\n\t{ \"ANM_A_COLOR_6\",          CKLBSplineNode::ANM_A_COLOR_6       },\r\n\t{ \"ANM_SCALEX_COORD_7\",     CKLBSplineNode::ANM_SCALEX_COORD_7  },\r\n\t{ \"ANM_SCALEY_COORD_8\",     CKLBSplineNode::ANM_SCALEY_COORD_8  },\r\n\t{ \"ANM_ROTATION_COORD_9\",   CKLBSplineNode::ANM_ROTATION_COORD_9},\r\n\r\n\t{ \"ANM_TYPE_LINEAR\",        CKLBSplineNode::ANM_LINEAR          },\r\n\t{ \"ANM_TYPE_SWING\",         CKLBSplineNode::ANM_SWING           },\r\n\t{ \"ANM_TYPE_EASEINQUAD\",    CKLBSplineNode::ANM_EASEINQUAD      },\r\n\t{ \"ANM_TYPE_EASEOUTQUAD\",   CKLBSplineNode::ANM_EASEOUTQUAD     },\r\n\t{ \"ANM_TYPE_EASEINOUTQUAD\", CKLBSplineNode::ANM_EASEINOUTQUAD   },\r\n\t{ \"ANM_TYPE_EASEINCUBIC\",   CKLBSplineNode::ANM_EASEINCUBIC     },\r\n\t{ \"ANM_TYPE_EASEOUTCUBIC\",  CKLBSplineNode::ANM_EASEOUTCUBIC    },\r\n\t{ \"ANM_TYPE_EASEINOUTCUBIC\",CKLBSplineNode::ANM_EASEINOUTCUBIC  },\r\n\t{ \"ANM_TYPE_EASEINQUART\",   CKLBSplineNode::ANM_EASEINQUART     },\r\n\t{ \"ANM_TYPE_EASEINBACK\",    CKLBSplineNode::ANM_EASEINBACK      },\r\n\t{ \"ANM_TYPE_EASEOUTBACK\",   CKLBSplineNode::ANM_EASEOUTBACK     },\r\n\t{ \"ANM_TYPE_EASEINOUTBACK\", CKLBSplineNode::ANM_EASEINOUTBACK   },\r\n\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIScore> factory(\"UI_Score\", CLS_KLBUISCORE, cmd);\r\n\r\nCKLBUIScore::CKLBUIScore()\r\n: CKLBUITask    ()\r\n, m_pScoreNode  (NULL)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tfor (int n=0; n<10; n++) {\r\n\t\tm_asset[n] = NULL;\r\n\t}\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIScore::~CKLBUIScore() {\r\n\tfor (int n = 0; n<10; n++) {\r\n\t\tKLBDELETEA(m_asset[n]);\r\n\t}\r\n}\r\n\r\nu32\r\nCKLBUIScore::getClassID()\r\n{\r\n\treturn CLS_KLBUISCORE;\r\n}\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIScore::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUIScore::setOrder,\t\t(getBoolT)&CKLBUIScore::getOrder,\t\t0\t},\r\n\t{\t\"odoff\",\tR_UINTEGER,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getOrderOffset,\t0\t},\r\n\t{\t\"stepX\",\tINTEGER,\t(setBoolT)&CKLBUIScore::setStepX,\t\t(getBoolT)&CKLBUIScore::getStepX,\t\t0\t},\r\n\t{\t\"stepY\",\tINTEGER,\t(setBoolT)&CKLBUIScore::setStepY,\t\t(getBoolT)&CKLBUIScore::getStepY,\t\t0\t},\r\n\t{\t\"cols\",\t\tUINTEGER,\t(setBoolT)&CKLBUIScore::setColumn,\t\t(getBoolT)&CKLBUIScore::getColumn,\t\t0\t},\r\n\t{\t\"fillz\",\tBOOLEANT,\t(setBoolT)&CKLBUIScore::setFillZero,\t(getBoolT)&CKLBUIScore::getFillZero,\t0\t},\r\n\t{\t\"anim\",\t\tR_BOOLEANT,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getAnim,\t\t0\t},\r\n\t{\t\"value\",\tUINTEGER,\t(setBoolT)&CKLBUIScore::setValue,\t\t(getBoolT)&CKLBUIScore::getValue,\t\t0\t},\r\n\t{\t\"align\",\tUINTEGER,\t(setBoolT)&CKLBUIScore::setAlign,\t\t(getBoolT)&CKLBUIScore::getAlign,\t\t0\t},\r\n\t{\t\"countclip\",BOOLEANT,\t(setBoolT)&CKLBUIScore::setCountClip,\t(getBoolT)&CKLBUIScore::getCountClip,\t0\t},\r\n\r\n\t{\t\"tex0\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex0,\t\t0\t},\r\n\t{\t\"tex1\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex1,\t\t0\t},\r\n\t{\t\"tex2\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex2,\t\t0\t},\r\n\t{\t\"tex3\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex3,\t\t0\t},\r\n\t{\t\"tex4\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex4,\t\t0\t},\r\n\t{\t\"tex5\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex5,\t\t0\t},\r\n\t{\t\"tex6\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex6,\t\t0\t},\r\n\t{\t\"tex7\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex7,\t\t0\t},\r\n\t{\t\"tex8\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex8,\t\t0\t},\r\n\t{\t\"tex9\",\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScore::getTex9,\t\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\tARG_ORDER,\r\n\tARG_ODOFF,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_TEXTBL,\r\n\tARG_STEP_X,\r\n\tARG_STEP_Y,\r\n\tARG_COLS,\r\n\tARG_FILLZERO,\r\n\tARG_ANIM,\r\n\tARG_ALIGN,\r\n\tARG_COUNTCLIP,\r\n\r\n\tARG_REQUIRE = ARG_ANIM,\r\n\tARG_NUMS = ARG_COUNTCLIP\r\n};\r\n\r\nCKLBUIScore *\r\nCKLBUIScore::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\tu32 order, s32 order_offset, float x, float y, \r\n\t\t\t\t\tconst char ** tex_table, float stepX, float stepY, int column, \r\n\t\t\t\t\tbool fillzero, bool anim_flags, u32 align, bool countclip)\r\n{\r\n\tCKLBUIScore * pTask = KLBNEW(CKLBUIScore);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParent, pNode, order, order_offset, x, y, tex_table, stepX, stepY, column, fillzero, anim_flags, align, countclip)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIScore::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                  u32 order, s32 order_offset, float x, float y, \r\n                  const char ** tex_table, float stepX, float stepY, int column, \r\n                  bool fillzero, bool anim_flag, u32 align, bool countclip)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, order_offset, x, y, tex_table, stepX, stepY, column, fillzero, anim_flag, align, countclip);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIScore::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n\t// 引数の数が合わない場合\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tfloat   x            = lua.getFloat(ARG_X);\r\n\tfloat   y            = lua.getFloat(ARG_Y);\r\n\tu32     order        = lua.getInt(ARG_ORDER);\r\n\ts32     order_offset = lua.getInt(ARG_ODOFF);\r\n\tfloat   stepX        = lua.getFloat(ARG_STEP_X);\r\n\tfloat   stepY        = lua.getFloat(ARG_STEP_Y);\r\n\tint     column       = lua.getInt(ARG_COLS);\r\n\tbool    fillzero     = lua.getBool(ARG_FILLZERO);\r\n\tbool    anim_flag    = lua.getBool(ARG_ANIM);\r\n\tint     align        = (argc >= ARG_ALIGN)     ? lua.getInt(ARG_ALIGN)      : ALIGN_RIGHT;\r\n\tbool    countclip    = (argc >= ARG_COUNTCLIP) ? lua.getBool(ARG_COUNTCLIP) : false;\r\n\r\n\tconst char * tex_list[10];\r\n\tlua.retValue(ARG_TEXTBL);\t// 対象となる配列をスタックトップに積む\r\n\tlua.retNil();\t\t\t\t// nil をスタックトップに積む\r\n\tint tex_cnt = 0;\r\n\twhile(lua.tableNext()) {\r\n\t\tlua.retValue(-2);\r\n\t\tint idx = lua.getInt(-1) - 1;\t\t\t// Lua配列の添え字は1からなので、-1する。\r\n\t\tconst char * str = lua.getString(-1);\r\n\r\n\t\t// 与えられた配列のindexに整数以外が使われているときや、\r\n\t\t// 範囲を超えたものがある場合はエラー扱いとする。\r\n\t\tklb_assert((idx >= 0 && idx <= 9), \"BAD INDEX [%s] in texture array.\", str);\r\n\t\tif(idx < 0 || idx > 9) {\t// 数値以外のインデックスが指定されていたり、範囲を超えている場合\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tconst char * texname = lua.getString(-2);\t// テクスチャ名称が格納されている。\r\n\t\ttex_list[idx] = texname;\r\n\t\ttex_cnt++;\r\n\t\tlua.pop(2);\r\n\t}\r\n\tlua.pop(1);\r\n\t// テクスチャの数が足りなければエラーとする。\r\n\tif(tex_cnt != 10) {\r\n\t\tklb_assert(tex_cnt == 10, \"%s(%d): The number of textures is insufficient. \", lua.getScriptName(), lua.getNumLine()); \r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn initCore(order, order_offset, x, y, tex_list, stepX, stepY, column, fillzero, anim_flag, align, countclip);\r\n}\r\n\r\nbool\r\nCKLBUIScore::initCore(u32 order, s32 order_offset, float x, float y, \r\n                      const char ** tex_table, float stepX, float stepY, int column, \r\n                      bool fillzero, bool anim_flag, u32 align, bool countclip)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\tm_order         = order;\r\n\tm_orderOffset   = order_offset;\r\n\tm_stepX         = (int)stepX;\r\n\tm_stepY         = (int)stepY;\r\n\tm_column        = column;\r\n\tm_bFillZero     = fillzero;\r\n\tm_anim          = anim_flag;\r\n\tm_align         = align;\r\n\tm_bCountClip    = countclip;\r\n\tm_dotStepX\t\t= 0;\r\n\tm_dotStepY\t\t= 0;\r\n\tm_value         = 0xFFFFFFFF;\r\n\tm_fValue        = -12345678.0f;\r\n\tsetValue(0);\r\n\tsetValueFloat(0.0f, 0);\r\n\tRESET_B;\t// Reset flag done by setValueFloat.\r\n\r\n\r\n\t// align設定用の幅を計算\r\n\tm_width  = stepX * column;\r\n\tm_height = stepY * column;\r\n\r\n\t// 保持できる最大値+1を計算\r\n\tm_maxvalue = 1;\r\n    for(int i = 0; i < column; i++) { m_maxvalue = m_maxvalue * 10; }\r\n\r\n\tfor(int idx = 0; idx < 10; idx++) {\r\n\t\tsetStrC(m_asset[idx], tex_table[idx]);\r\n\t}\r\n\r\n\tCKLBTextureAsset * pTexAsset;\r\n\tpTexAsset = (CKLBTextureAsset *)CKLBUtility::loadAssetScript( m_asset[0], &m_handle, NULL, true);\r\n\r\n\tconst char * texname[10];\r\n\tfor(int i = 0; i < 10; i++) {\r\n\t\ttexname[i] = m_asset[i] + 8;\r\n\t}\r\n\r\n\tm_pScoreNode = KLBNEW(CKLBScoreNode);\r\n    if(!m_pScoreNode) {\r\n\t\tCKLBDataHandler::releaseHandle(m_handle);\r\n        return false;\r\n    }\r\n    \r\n    for(int i = 0; i < 10; i++) {\r\n        m_numTex[i] = pTexAsset->getImage(texname[i]);\r\n        if(m_numTex[i] == 0) {\r\n\t\t\tCKLBScriptEnv::getInstance().error(\"TEXB differs from [%s] by [%s].\", texname[0], texname[i]);\r\n\t\t\tCKLBDataHandler::releaseHandle(m_handle);\r\n\t\t\treturn false;\r\n\t\t}\r\n    }\r\n\r\n    bool bResult = m_pScoreNode->init(\torder,\r\n\t\t\t                            order_offset,\r\n\t\t\t                            m_numTex,\r\n\t\t\t                            m_stepX,\r\n\t\t\t\t\t\t\t\t\t\tm_stepY,\r\n\t\t\t\t\t\t\t\t\t\tcolumn,\r\n\t\t\t\t\t\t\t\t\t\tfillzero,\r\n\t\t\t\t\t\t\t\t\t    anim_flag);\r\n    \r\n    getNode()->addNode(m_pScoreNode, 0);\r\n\tm_pScoreNode->markUpMatrix();\r\n\tm_bScoreUpdate = true;\r\n\r\n\tif(!bResult) CKLBDataHandler::releaseHandle(m_handle);\r\n\r\n\treturn bResult;\r\n}\r\n\r\nvoid\r\nCKLBUIScore::execute(u32 deltaT)\r\n{\r\n\tdeltaT = deltaT; // Avoid Warning\r\n\r\n\tbool useFloat = CHANGE_B;\r\n\ts32 fDot = 0;\r\n\tint column;\r\n\tif (useFloat) {\r\n\t\tm_pScoreNode->setScoreFloat(m_fValue, m_fPrec, true);\r\n\t\tif (!m_bFillZero) {\r\n\t\t\tcolumn = countColumn(m_pScoreNode->getScore());\r\n\t\t\tfDot = 1;\r\n\t\t}\r\n\t} else {\r\n\t\tint value = m_value;\r\n\t\tif(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1;\r\n\t\tm_pScoreNode->setScore(value, true);\r\n\t\tcolumn = countColumn(value);\t// 桁数をカウント\r\n\t}\r\n\tm_pScoreNode->setPriority(m_order);\r\n\tm_pScoreNode->update();\r\n\r\n\tif(!m_bFillZero) {\r\n\t\tint offX;\r\n\t\tint offY;\r\n\t\tint stepX = m_stepX;\r\n\t\tint stepY = m_stepY;\r\n\t\tint max_cols = m_column;\r\n\t\tint dotStepX = (m_dotStepX * fDot);\r\n\t\tint dotStepY = (m_dotStepY * fDot);\r\n        if(column > max_cols) { column = max_cols; }\r\n\t\tswitch(m_align)\r\n\t\t{\r\n\t\tdefault:\r\n\t\tcase ALIGN_RIGHT:\r\n\t\t\toffX = 0;\r\n\t\t\toffY = 0;\r\n\t\t\tbreak;\r\n\t\tcase ALIGN_CENTER:\r\n\t\t\toffX = ((m_width  - stepX * column) + dotStepX) / 2;\r\n\t\t\toffY = ((m_height - stepY * column) + dotStepY) / 2;\r\n\t\t\tbreak;\r\n\t\tcase ALIGN_LEFT:\r\n\t\t\toffX = (m_width  - (stepX * column)) + dotStepX;\r\n\t\t\toffY = (m_height - (stepY * column)) + dotStepY;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tm_pScoreNode->setTranslate(-offX, -offY);\r\n\t}\r\n\tRESET_A;\r\n\tRESET_B;\r\n}\r\n\r\nvoid\r\nCKLBUIScore::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(m_pScoreNode, m_handle);\r\n}\r\n\r\n// 表示の必要がある桁数を数える\r\nint\r\nCKLBUIScore::countColumn(u32 value)\r\n{\r\n\tint cnt = 0;\r\n\tdo {\r\n\t\tcnt++;\r\n\t\tvalue = (value - (value % 10)) / 10;\r\n\t} while(value > 0);\r\n\treturn cnt;\r\n}\r\n\r\nvoid CKLBUIScore::setDot(const char* dotAsset, s32 width, s32 height) {\r\n\tCKLBTextureAsset * pAsset\t\t= m_numTex[0]->getTexture();\r\n\r\n\tu32 handle = 0;\r\n\tCKLBTextureAsset * pTexAsset\t= (CKLBTextureAsset *)CKLBUtility::loadAssetScript( dotAsset, &handle, 0, true);\r\n\tif (pAsset != pTexAsset) {\r\n\t\tCKLBScriptEnv::getInstance().error(\"DOT image %s not inside same texture as score 0..9 graphics.\", dotAsset);\r\n\t}\r\n\r\n\tif (handle) {\r\n\t\t// Release double lock\r\n\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t}\r\n\r\n\tCKLBImageAsset* pImgAsset = pAsset->getImage(dotAsset + 8); // Skip asset://\r\n\r\n\tm_dotStepX = width;\r\n\tm_dotStepY = height;\r\n\r\n\t// Assign ressource\r\n\tm_pScoreNode->setDot(pImgAsset,width,height);\r\n}\r\n\r\nconst char* CKLBUIScore::getDot() {\r\n\treturn NULL; // TODO\r\n}\r\n\r\nint\r\nCKLBUIScore::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_SCORE_RESET:\r\n\t\tsetValue(0);\r\n\t\tm_bScoreUpdate = true;\r\n\t\tbreak;\r\n\tcase UI_SCORE_SET:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint value = lua.getInt(3);\r\n\t\t\tif(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1;\r\n\t\t\tsetValue(value);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCORE_SETFLOAT:\r\n\t\t{\r\n\t\t\tif(argc != 4) {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfloat value = lua.getFloat(3);\r\n\t\t\tint pos = lua.getInt(4);\r\n\t\t\tif(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1;\r\n\t\t\tsetValueFloat(value, pos);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCORE_SETDOT:\r\n\t\t{\r\n\t\t\tif(argc != 5) {\r\n\t\t\t\tlua.retNil();\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tsetDot(lua.getString(3), lua.getInt(4), lua.getInt(5));\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCORE_GET:\r\n\t\t{\t\r\n\t\t\tint value = getValue();\r\n\t\t\tlua.retInt(value);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCORE_ENTERANIM:\r\n\t\t{\r\n\t\t\tif(argc != 8) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\ts32  mspt       = lua.getInt(3);\r\n\t\t\ts32  tshift     = lua.getInt(4);\r\n\t\t\tbool onlychg    = lua.getBool(5);\r\n\t\t\tint  type       = lua.getInt(6);\r\n\t\t\tu32  affected   = lua.getInt(7);\r\n\t\t\tfloat mat[8];\r\n\t\t\tklb_assert(type > 0, \"UI_Score: UI_SCORE_ENTERANIM type == 0\");\r\n\r\n\t\t\t// 配列を読む\r\n\t\t\tlua.retValue(8);\r\n\t\t\tlua.retNil();\r\n\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\tlua.retValue(-2);\r\n\t\t\t\tint idx = lua.getInt(-1) - 1;\r\n\t\t\t\tklb_assert((idx >= 0 && idx < 8), \"%s(%d): bad array index. UI_SCORE_ENTERANIM\", lua.getScriptName(), lua.getNumLine());\r\n\t\t\t\tmat[idx] = lua.getFloat(-2);\r\n\t\t\t\tlua.pop(2);\r\n\t\t\t}\r\n\t\t\tlua.pop(1);\r\n\r\n\t\t\tklb_assert(type != 0, \"Custom animation is not authorized (type 0)\");\r\n\t\t\tm_pScoreNode->setEnterAnimation(mspt, tshift, onlychg, type, affected, mat);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCORE_EXITANIM:\r\n\t\t{\r\n\t\t\tif(argc != 8) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\ts32  mspt       = lua.getInt(3);\r\n\t\t\ts32  tshift     = lua.getInt(4);\r\n\t\t\tbool onlychg    = lua.getBool(5);\r\n\t\t\tint  type       = lua.getInt(6);\r\n\t\t\tu32  affected   = lua.getInt(7);\r\n\t\t\tfloat mat[4];\r\n\t\t\tklb_assert(type > 0, \"UI_Score: UI_SCORE_ENTERANIM type == 0\");\r\n\r\n\t\t\t// 配列を読む\r\n\t\t\tlua.retValue(8);\r\n\t\t\tlua.retNil();\r\n\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\tlua.retValue(-2);\r\n\t\t\t\tint idx = lua.getInt(-1) - 1;\r\n\t\t\t\tmat[idx] = lua.getFloat(-2);\r\n\t\t\t\tlua.pop(2);\r\n\t\t\t}\r\n\t\t\tlua.pop(1);\r\n\r\n\t\t\tklb_assert(type != 0, \"Custom animation is not authorized (type 0)\");\r\n\t\t\tm_pScoreNode->setExitAnimation(mspt, tshift, onlychg, type, affected, mat);\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_SCORE_ALIGN:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tint align = lua.getInt(3);\r\n\t\t\t\tsetAlign(align);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIScore.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIScore_h\r\n#define CKLBUIScore_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBScoreNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIScore\r\n* \\brief Score Task Class\r\n* \r\n* CKLBUIScore is designed for managing Score.\r\n* It handles 10 assets, one for each digit and uses it to display a score.\r\n* It also manages the animation going with the two different scores transitions.\r\n*/\r\nclass CKLBUIScore : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIScore>;\r\nprivate:\r\n\tCKLBUIScore();\r\n\tvirtual ~CKLBUIScore();\r\npublic:\r\n\t// プロパティのインデックス\r\n\tenum PROP_ID{\r\n\t\tPR_ORDER,\r\n\t\tPR_ODOFF,\r\n\t\tPR_STEP_X,\r\n\t\tPR_STEP_Y,\r\n\t\tPR_COLS,\r\n\t\tPR_FILLZERO,\r\n\t\tPR_ANIM,\r\n\t\tPR_VALUE,\r\n\t\tPR_ALIGN,\r\n\t\tPR_COUNTCLIP,\r\n\r\n\r\n\t\tPR_TEX_0,\r\n\t\tPR_TEX_1,\r\n\t\tPR_TEX_2,\r\n\t\tPR_TEX_3,\r\n\t\tPR_TEX_4,\r\n\t\tPR_TEX_5,\r\n\t\tPR_TEX_6,\r\n\t\tPR_TEX_7,\r\n\t\tPR_TEX_8,\r\n\t\tPR_TEX_9,\r\n\t};\r\n\r\n\tenum {\r\n\t\t// 以下の値を変更する場合は CompositeManagement.cpp 等、\r\n\t\t// 外部のツールから与えられる値との間で整合を取ること。\r\n\t\tALIGN_RIGHT  = 0,\r\n\t\tALIGN_CENTER = 1,\r\n\t\tALIGN_LEFT   = 2,\r\n\t};\r\n\r\n\tstatic CKLBUIScore * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\tu32 order, s32 order_offset,\r\n\t\t\t\t\t\t\t\tfloat x, float y, const char ** tex_table,\r\n\t\t\t\t\t\t\t\tfloat stepX, float stepY, int column, \r\n\t\t\t\t\t\t\t\tbool fillzero, bool anim_flags, u32 align = ALIGN_RIGHT,\r\n\t\t\t\t\t\t\t\tbool countclip = false);\r\n\tbool initUI     (CLuaState& lua);\r\n\tu32 getClassID  ();\r\n\r\n\tvoid execute    (u32 deltaT);\r\n\tvoid dieUI      ();\r\n\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n\r\n\tinline u32\tgetValue()\t\t\t\t{ return m_value;\t\t}\r\n\tinline void setValue(u32 value)     {\r\n\t\tif (value != m_value) {\r\n\t\t\tm_value = value;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getValueFloat()\t\t\t{ return m_value;\t\t}\r\n\tinline void setValueFloat(float value, u32 prec)\t{\r\n\t\tif ((value != m_fValue) || (prec != m_fPrec)) {\r\n\t\t\tm_fValue = value;\r\n\t\t\tm_fPrec  = prec;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinline u32\tgetOrder()\t\t\t\t{ return m_order;\t\t}\r\n\tinline void setOrder(u32 order)\t\t{\r\n\t\tif(order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetOrderOffset()\t\t{ return m_orderOffset;\t}\r\n\r\n\tinline s32\tgetStepX()\t\t\t\t{ return m_stepX;\t\t}\r\n\tinline void setStepX(s32 stepX)\t\t{\r\n\t\tif(stepX != m_stepX) {\r\n\t\t\tm_stepX = stepX;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32\tgetStepY()\t\t\t\t{ return m_stepY;\t\t}\r\n\tinline void setStepY(s32 stepY)\t\t{\r\n\t\tif(stepY != m_stepY) {\r\n\t\t\tm_stepY = stepY;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetColumn()\t\t\t\t{ return m_column;\t\t}\r\n\tinline void setColumn(u32 cols)\t\t{\r\n\t\tif(cols != m_column) {\r\n\t\t\tm_column = cols;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getFillZero()\t\t\t{ return m_bFillZero;\t}\r\n\tinline void setFillZero(bool fZero)\t{\r\n\t\tif(fZero != m_bFillZero) {\r\n\t\t\tm_bFillZero = fZero;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getAnim()\t\t\t\t{ return m_anim;\t\t}\r\n\r\n\tinline u32\tgetAlign()\t\t\t\t{ return m_align;\t\t}\r\n\tinline void setAlign(u32 align)\t\t{\r\n\t\tif(align != m_align) {\r\n\t\t\tm_align = align;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getCountClip()\t\t\t{ return m_bCountClip;\t}\r\n\tinline void setCountClip(bool b)\t{\r\n\t\tif(b != m_bCountClip) {\r\n\t\t\tm_bCountClip = b;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinline const char*\tgetTex0     ()  { return m_asset[0]; }\r\n\tinline const char*\tgetTex1     ()  { return m_asset[1]; }\r\n\tinline const char*\tgetTex2     ()  { return m_asset[2]; }\r\n\tinline const char*\tgetTex3     ()  { return m_asset[3]; }\r\n\tinline const char*\tgetTex4     ()  { return m_asset[4]; }\r\n\tinline const char*\tgetTex5     ()  { return m_asset[5]; }\r\n\tinline const char*\tgetTex6     ()  { return m_asset[6]; }\r\n\tinline const char*\tgetTex7     ()  { return m_asset[7]; }\r\n\tinline const char*  getTex8     ()  { return m_asset[8]; }\r\n\tinline const char*  getTex9     ()  { return m_asset[9]; }\r\n\tinline const char** getTextures ()  { return m_asset; \t }\r\n\r\n\tvoid setDot(const char* dotAsset, s32 width, s32 height);\r\n\tconst char* getDot();\r\n\r\n\tinline void setEnterAnimation(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam) {\r\n\t\tm_pScoreNode->setEnterAnimation(milliSecondsPlayTime, timeShift, onlyChange, type, affected, arrayParam);\r\n\t}\r\n\r\n\tinline void setExitAnimation(s32 milliSecondsPlayTime, s32 timeShift, bool onlyChange, u32 type, u32 affected, const float* arrayParam) {\r\n\t\tm_pScoreNode->setExitAnimation(milliSecondsPlayTime, timeShift, onlyChange, type, affected, arrayParam);\r\n\t}\r\nprivate:\r\n\r\nbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\tu32 order, s32 order_offset, float x, float y, \r\n\t\t\t\t\tconst char ** tex_table, float stepX, float stepY, int column, \r\n\t\t\t\t\tbool fillzero, bool anim_flag, u32 align, bool countclip);\r\n\tbool initCore(  u32 order, s32 order_offset, float x, float y, \r\n\t\t\t\t\tconst char ** tex_table, float stepX, float stepY, int column, \r\n\t\t\t\t\tbool fillzero, bool anim_flag, u32 align, bool countclip);\r\n\r\n\tint countColumn(u32 value);\r\n\r\n\tu32\t\tm_value;\r\n\tfloat\tm_fValue;\r\n\ts32\t\tm_dotStepX;\r\n\ts32\t\tm_dotStepY;\r\n\tu32\t\tm_order;\r\n\tu32\t\tm_orderOffset;\r\n\ts32\t\tm_stepX;\r\n\ts32\t\tm_stepY;\r\n\tu32\t\tm_column;\r\n\tu32\t\tm_align;\r\n\tbool\tm_bFillZero;\r\n\tbool\tm_anim;\r\n\tbool\tm_bScoreUpdate;\r\n\tbool\tm_bCountClip;\r\n\tu8\t\tm_fPrec;\r\n\r\n\tconst char *        m_asset[10];\r\n\r\n\tCKLBScoreNode\t*\tm_pScoreNode;\r\n\tCKLBImageAsset\t*\tm_numTex[10];\r\n\tu32\t\t\t\t\tm_handle;\r\n\r\n\tint\t\t\t\t\tm_width;\r\n\tint\t\t\t\t\tm_height;\r\n\r\n\tint\t\t\t\t\tm_maxvalue;\r\n\t\r\n\tstatic PROP_V2 \t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIScore_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIScrollBar.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIScrollBar.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_SCROLL_SET_MIN = 0,\r\n\tUI_SCROLL_GET_MIN,\r\n\tUI_SCROLL_SET_MAX,\r\n\tUI_SCROLL_GET_MAX,\r\n\tUI_SCROLL_SET_POS,\r\n\tUI_SCROLL_GET_POS,\r\n\tUI_SCROLL_SET_SLIDER_SIZE,\r\n\tUI_SCROLL_GET_SLIDER_SIZE,\r\n\tUI_SCROLL_SET_SLIDER_MIN_SIZE,\r\n\tUI_SCROLL_GET_SLIDER_MIN_SIZE,\r\n\tUI_SCROLL_SET_COLOR_NORMAL,\r\n\tUI_SCROLL_GET_COLOR_NORMAL,\r\n\tUI_SCROLL_SET_COLOR_SELECT,\r\n\tUI_SCROLL_GET_COLOR_SELECT,\r\n\tUI_SCROLL_SET_ALPHA_NORMAL,\r\n\tUI_SCROLL_GET_ALPHA_NORMAL,\r\n\tUI_SCROLL_SET_ALPHA_SELECT,\r\n\tUI_SCROLL_GET_ALPHA_SELECT,\r\n\tUI_SCROLL_SET_TOUCH_ACTIVE,\r\n\tUI_SCROLL_GET_TOUCH_ACTIVE,\r\n\r\n\tUI_SCROLL_SELECT_SCRMGR,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_SCROLL_SET_MIN\",\t\t\t\tUI_SCROLL_SET_MIN},\r\n\t{ \"UI_SCROLL_GET_MIN\",\t\t\t\tUI_SCROLL_GET_MIN},\r\n\t{ \"UI_SCROLL_SET_MAX\",\t\t\t\tUI_SCROLL_SET_MAX},\r\n\t{ \"UI_SCROLL_GET_MAX\",\t\t\t\tUI_SCROLL_GET_MAX},\r\n\t{ \"UI_SCROLL_SET_POS\",\t\t\t\tUI_SCROLL_SET_POS},\r\n\t{ \"UI_SCROLL_GET_POS\",\t\t\t\tUI_SCROLL_GET_POS},\r\n\t{ \"UI_SCROLL_SET_SLIDER_SIZE\",\t\tUI_SCROLL_SET_SLIDER_SIZE},\r\n\t{ \"UI_SCROLL_GET_SLIDER_SIZE\",\t\tUI_SCROLL_GET_SLIDER_SIZE},\r\n\t{ \"UI_SCROLL_SET_SLIDER_MIN_SIZE\",\tUI_SCROLL_SET_SLIDER_MIN_SIZE},\r\n\t{ \"UI_SCROLL_GET_SLIDER_MIN_SIZE\",\tUI_SCROLL_GET_SLIDER_MIN_SIZE},\r\n\t{ \"UI_SCROLL_SET_COLOR_NORMAL\",\t\tUI_SCROLL_SET_COLOR_NORMAL},\r\n\t{ \"UI_SCROLL_GET_COLOR_NORMAL\",\t\tUI_SCROLL_GET_COLOR_NORMAL},\r\n\t{ \"UI_SCROLL_SET_COLOR_SELECT\",\t\tUI_SCROLL_SET_COLOR_SELECT},\r\n\t{ \"UI_SCROLL_GET_COLOR_SELECT\",\t\tUI_SCROLL_GET_COLOR_SELECT},\r\n\t{ \"UI_SCROLL_SET_ALPHA_NORMAL\",\t\tUI_SCROLL_SET_ALPHA_NORMAL},\r\n\t{ \"UI_SCROLL_GET_ALPHA_NORMAL\",\t\tUI_SCROLL_GET_ALPHA_NORMAL},\r\n\t{ \"UI_SCROLL_SET_ALPHA_SELECT\",\t\tUI_SCROLL_SET_ALPHA_SELECT},\r\n\t{ \"UI_SCROLL_GET_ALPHA_SELECT\",\t\tUI_SCROLL_GET_ALPHA_SELECT},\r\n\t{ \"UI_SCROLL_SET_TOUCH_ACTIVE\",\t\tUI_SCROLL_SET_TOUCH_ACTIVE},\r\n\t{ \"UI_SCROLL_GET_TOUCH_ACTIVE\",\t\tUI_SCROLL_GET_TOUCH_ACTIVE},\r\n\r\n\t{ \"UI_SCROLL_SELECT_SCRMGR\",\t\tUI_SCROLL_SELECT_SCRMGR },\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIScrollBar> factory(\"UI_ScrollBar\", CLB_KLBUISCROLLBAR, cmd);\r\n\r\n\r\nCKLBUIScrollBar::CKLBUIScrollBar() \r\n: CKLBUITask    ()\r\n, m_callback    (NULL)\r\n, m_image       (NULL)\r\n, m_min         (0)\r\n, m_max         (0)\r\n, m_pos         (0)\r\n{\r\n\tm_scrBar = this;\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIScrollBar::~CKLBUIScrollBar() \r\n{\r\n\tKLBDELETEA(m_callback);\r\n\tKLBDELETEA(m_image);\r\n}\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIScrollBar::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\t\tUINTEGER,\t(setBoolT)&CKLBUIScrollBar::setOrder,\t\t\t(getBoolT)&CKLBUIScrollBar::getOrder,\t\t\t0\t},\r\n\t{\t\"width\",\t\t\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setWidth,\t\t\t(getBoolT)&CKLBUIScrollBar::getWidth,\t\t\t0\t},\r\n\t{\t\"height\",\t\t\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setHeight,\t\t\t(getBoolT)&CKLBUIScrollBar::getHeight,\t\t\t0\t},\r\n\t{\t\"min\",\t\t\t\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setMin,\t\t\t\t(getBoolT)&CKLBUIScrollBar::getMin,\t\t\t\t0\t},\r\n\t{\t\"max\",\t\t\t\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setMax,\t\t\t\t(getBoolT)&CKLBUIScrollBar::getMax,\t\t\t\t0\t},\r\n\t{\t\"pos\",\t\t\t\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setPos,\t\t\t\t(getBoolT)&CKLBUIScrollBar::getPos,\t\t\t\t0\t},\r\n\t{\t\"img\",\t\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScrollBar::getImage,\t\t\t0\t},\r\n\t{\t\"slider_size\",\t\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setSliderSize,\t\t(getBoolT)&CKLBUIScrollBar::getSliderSize,\t\t0\t},\r\n\t{\t\"slider_minsize\",\tINTEGER,\t(setBoolT)&CKLBUIScrollBar::setSliderSizeMin,\t(getBoolT)&CKLBUIScrollBar::getSliderSizeMin,\t0\t},\r\n\t{\t\"f_vert\",\t\t\tBOOLEANT,\t(setBoolT)&CKLBUIScrollBar::setVertical,\t\t(getBoolT)&CKLBUIScrollBar::getVertical,\t\t0\t},\r\n\t{\t\"callback\",\t\t\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUIScrollBar::getCallBack,\t\t0\t},\r\n\t{\t\"alpha_normal\",\t\tUINTEGER,\t(setBoolT)&CKLBUIScrollBar::setAlphaNormal,\t\t(getBoolT)&CKLBUIScrollBar::getAlphaNormal,\t\t0\t},\r\n\t{\t\"alpha_select\",\t\tUINTEGER,\t(setBoolT)&CKLBUIScrollBar::setAlphaSelect,\t\t(getBoolT)&CKLBUIScrollBar::getAlphaSelect,\t\t0\t},\r\n\t{\t\"color_normal\",\t\tUINTEGER,\t(setBoolT)&CKLBUIScrollBar::setColorNormal,\t\t(getBoolT)&CKLBUIScrollBar::getColorNormal,\t\t0\t},\r\n\t{\t\"color_select\",\t\tUINTEGER,\t(setBoolT)&CKLBUIScrollBar::setColorSelect,\t\t(getBoolT)&CKLBUIScrollBar::getColorSelect,\t\t0\t},\r\n\t{\t\"touch_active\",\t\tBOOLEANT,\t(setBoolT)&CKLBUIScrollBar::setTouchActive,\t\t(getBoolT)&CKLBUIScrollBar::getTouchActive,\t\t0\t}\r\n};\r\n\r\n// 引数のインデックス定義\r\nenum {\r\n\tARG_PARENT = 1,\r\n\tARG_ORDER,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\r\n\tARG_VALMIN,\r\n\tARG_VALMAX,\r\n\tARG_POS,\r\n\r\n\tARG_IMG,\r\n\r\n\tARG_SLIDER_SIZE,\r\n\tARG_SLIDER_MIN_SIZE,\r\n\t\r\n\tARG_VERT,\r\n\tARG_CALLBACK,\r\n\r\n\tARG_TOUCH_ACTIVE,\r\n\tARG_ALPHA_NORMAL,\r\n\tARG_ALPHA_SELECT,\r\n\tARG_COLOR_NORMAL,\r\n\tARG_COLOR_SELECT,\r\n\r\n\tARG_HIDE_MODE,\r\n\r\n\tARG_TOTAL   = ARG_HIDE_MODE,\r\n\tARG_REQUIRE = ARG_VERT\t// 最低限必要なパラメータ数\r\n};\r\n\r\nCKLBUIScrollBar *\r\nCKLBUIScrollBar::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                        u32 order, float x, float y, float width, float height,\r\n                        s32 minValue, s32 maxValue, s32 pos,\r\n                        const char * image,\r\n                        s32 slider_size, s32 min_slider_size,\r\n                        const char * callback,\r\n                        u32 colorNormal, u32 colorSelect, bool vert, bool active,\r\n                        bool hide_mode)\r\n{\r\n\tCKLBUIScrollBar * pTask = KLBNEW(CKLBUIScrollBar);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParent, pNode, \r\n                    order, x, y, width, height, \r\n                    minValue, maxValue, pos, \r\n                    image, \r\n                    slider_size, min_slider_size, \r\n                    callback,\r\n                    colorNormal, colorSelect, vert, active, hide_mode)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIScrollBar::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                      u32 order, float x, float y, float width, float height,\r\n                      s32 minValue, s32 maxValue, s32 pos,\r\n                      const char * image,\r\n                      s32 slider_size, s32 min_slider_size, \r\n                      const char * callback,\r\n                      u32 colorNormal, u32 colorSelect, bool vert, bool active,\r\n                      bool hide_mode)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, width, height, minValue, maxValue, pos, image, \r\n                            slider_size, min_slider_size, \r\n                            callback,\r\n                            colorNormal, colorSelect, vert, active, hide_mode);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\n\r\nbool\r\nCKLBUIScrollBar::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\r\n\tif(argc > ARG_TOTAL || argc < ARG_REQUIRE) return false;\r\n\r\n\tu32 order\t\t\t\t= lua.getInt(ARG_ORDER);\r\n\tfloat x\t\t\t\t\t= lua.getFloat(ARG_X);\r\n\tfloat y\t\t\t\t\t= lua.getFloat(ARG_Y);\r\n\tfloat width\t\t\t\t= lua.getFloat(ARG_WIDTH);\r\n\tfloat height\t\t\t= lua.getFloat(ARG_HEIGHT);\r\n\r\n\ts32 minValue\t\t\t= lua.getInt(ARG_VALMIN);\r\n\ts32 maxValue\t\t\t= lua.getInt(ARG_VALMAX);\r\n\ts32 pos\t\t\t\t\t= lua.getInt(ARG_POS);\r\n\tconst char * image\t\t= lua.getString(ARG_IMG);\r\n\ts32 slider_size\t\t\t= lua.getInt(ARG_SLIDER_SIZE);\r\n\ts32 min_slider_size\t\t= lua.getInt(ARG_SLIDER_MIN_SIZE);\r\n\tbool vert\t\t\t\t= (argc >= ARG_VERT\t\t\t) ? lua.getBool(ARG_VERT\t\t) : false;\r\n\tbool active\t\t\t\t= (argc >= ARG_TOUCH_ACTIVE\t) ? lua.getBool(ARG_TOUCH_ACTIVE) : false;\r\n\tconst char * callback\t= (argc >= ARG_CALLBACK)\t  ? (lua.isNil(ARG_CALLBACK) ? NULL: lua.getString(ARG_CALLBACK)) : NULL;\r\n\r\n\t// 8 Bit A\r\n\tu32 alphaNormal\t\t\t= (argc >= ARG_ALPHA_NORMAL\t) ? lua.getInt(ARG_ALPHA_NORMAL)  : 0xFF;\r\n\tu32 alphaSelect\t\t\t= (argc >= ARG_ALPHA_SELECT\t) ? lua.getInt(ARG_ALPHA_SELECT)  : 0xFF;\r\n\r\n\t// 24 Bit RGB + 8 Bit A\r\n\tu32 colorNormal\t\t\t= (alphaNormal << 24) | ((argc >= ARG_COLOR_NORMAL\t) ? lua.getInt(ARG_COLOR_NORMAL)  : 0xFFFFFF);\r\n\tu32 colorSelect\t\t\t= (alphaSelect << 24) | ((argc >= ARG_COLOR_SELECT\t) ? lua.getInt(ARG_COLOR_SELECT)  : 0xFFFFFF);\r\n\r\n\tbool hide_mode\t\t\t= (argc >= ARG_HIDE_MODE) ? lua.getBool(ARG_HIDE_MODE) : false;\r\n\treturn initCore(order, x, y, width, height, minValue, maxValue, pos, image, \r\n                    slider_size, min_slider_size, \r\n                    callback,\r\n                    colorNormal, colorSelect, vert, active, hide_mode );\r\n}\r\n\r\nbool\r\nCKLBUIScrollBar::initCore(u32 order, float x, float y, float width, float height,\r\n                          s32 minValue, s32 maxValue, s32 pos,\r\n                          const char * image,\r\n                          s32 slider_size, s32 min_slider_size, \r\n                          const char * callback,\r\n                          u32 colorNormal, u32 colorSelect, bool vert, bool active,\r\n                          bool hide_mode)\r\n{\r\n\t// 対応するプロパティリストを規定する。\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// スクロールバーインタフェースにスクロールマネージャを登録する\r\n\t// m_scrBar.die() あるいは破棄と同時に delete されるので、この場でnewする\r\n\tm_scrBar.setScrollMgr(IMgrEntry::getMgr(\"solid\", 10));\r\n\r\n\t// 起動関数のパラメータとして初期値を受け取る\r\n\tsetInitPos(x, y);\r\n\tif(callback) {\r\n\t\tsetStrC(m_callback, callback);\r\n\t}\r\n\r\n\t// スクロールバーインタフェースを初期化する\r\n\tbool res = m_scrBar.init(getNode(), order, 0, 0, width, height,\r\n\t\tminValue, maxValue,\t// ScrollBarIF では0〜maxなので、minも含めた幅を持つbarを作る\r\n\t\tpos, image, slider_size, min_slider_size, callback, colorNormal, colorSelect, vert, active, hide_mode);\r\n\t\r\n\tif(res) {\r\n\t\tsetOrder    (order);\r\n\t\tsetWidth    (width);\r\n\t\tsetHeight   (height);\r\n\r\n\t\tsetMin(minValue);\r\n\t\tsetMax(maxValue);\r\n\r\n\t\tsetSliderSize(slider_size);\r\n\t\tsetSliderSizeMin(min_slider_size);\r\n\t\tsetStrC(m_image, image);\r\n\t\tsetTouchActive(active);\r\n\r\n\t\t// Set right away because other setter depends on it.\r\n\t\tsetVertical(vert);\r\n\r\n\t\tsetAlphaNormal(colorNormal >> 24);\r\n\t\tsetAlphaSelect(colorSelect >> 24);\r\n\t\tsetColorNormal(colorNormal & 0xFFFFFF);\r\n\t\tsetColorSelect(colorSelect & 0xFFFFFF);\r\n\t}\r\n\r\n\treturn res;\r\n}\r\n\r\nu32\r\nCKLBUIScrollBar::getClassID()\r\n{\r\n\treturn CLB_KLBUISCROLLBAR;\r\n}\r\n\r\nvoid\r\nCKLBUIScrollBar::setMin(s32 value) \r\n{\r\n\tif(value != m_min) {\r\n\t\tif(value > m_max) { setMax(value); }\r\n\t\tif(value > m_pos) { setPos(value); }\r\n\t\t\r\n\t\tm_min = value;\r\n\r\n\t\tm_scrBar.setMinPosition(value);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIScrollBar::setMax(s32 value) \r\n{\r\n\tif(value != m_max) {\r\n\t\tif(value < m_min) { setMin(value); }\r\n\t\tif(value < m_pos) { setPos(value); }\r\n\t\t\r\n\t\tm_max = value;\r\n\r\n\t\tm_scrBar.setMaxPosition(value);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIScrollBar::setPos(s32 value) \r\n{\r\n\ts32 iValue = getPos();\r\n\r\n\tif(value != iValue) {\r\n\t\tif(value < m_min) { value = m_min; }\r\n\t\tif(value > m_max) { value = m_max; }\r\n\t\t\r\n\t\tm_scrBar.setPosition(value);\r\n\t\tm_pos = value;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIScrollBar::setColorMode(u32 mode, u32 color) \r\n{\r\n\t// OPTIMIZE : Can optimize on value change\r\n\tif(mode == 0) {\r\n\t\tm_alphaNormal = color >> 24;\r\n\t\tm_colorNormal = color & 0xFFFFFF;\r\n\t} else {\r\n\t\tm_alphaSelect = color >> 24;\r\n\t\tm_colorSelect = color & 0xFFFFFF;\r\n\t}\r\n\tm_scrBar.setColorMode(mode, color);\r\n}\r\n\r\nint\r\nCKLBUIScrollBar::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n    if(argc < 2 || 3 < argc) { return 0; }\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tcase UI_SCROLL_SET_MIN:\r\n\t\tsetMin(lua.getInt(3));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_MIN:\r\n\t\tlua.retInt(getMin()); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_MAX:\r\n\t\tsetMax(lua.getInt(3));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_MAX:\r\n\t\tlua.retInt(getMax()); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_POS:\r\n\t\tsetPos(lua.getInt(3));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_POS:\r\n\t\tlua.retInt(getPos()); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_SLIDER_SIZE:\r\n\t\tsetSliderSize(lua.getInt(3));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_SLIDER_SIZE:\r\n\t\tlua.retInt(getSliderSize()); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_SLIDER_MIN_SIZE:\r\n\t\tsetSliderSizeMin(lua.getInt(3));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_SLIDER_MIN_SIZE:\r\n\t\tlua.retInt(getSliderSizeMin()); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_COLOR_NORMAL:\r\n\t\tsetColorMode(0, lua.getInt(3) | (getColorMode(0) & 0xFF000000));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_COLOR_NORMAL:\r\n\t\tlua.retInt(getColorMode(0) & 0xFFFFFF); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_COLOR_SELECT:\r\n\t\tsetColorMode(1, lua.getInt(3) | (getColorMode(1) & 0xFF000000));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_COLOR_SELECT:\r\n\t\tlua.retInt(getColorMode(1) & 0xFFFFFF); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_ALPHA_NORMAL:\r\n\t\tsetColorMode(0, (lua.getInt(3)<<24) | (getColorMode(0) & 0xFFFFFF));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_ALPHA_NORMAL:\r\n\t\tlua.retInt((getColorMode(0) >> 24) & 0xFF); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_ALPHA_SELECT:\r\n\t\tsetColorMode(1, (lua.getInt(3)<<24) | (getColorMode(1) & 0xFFFFFF));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_ALPHA_SELECT:\r\n\t\tlua.retInt((getColorMode(1) >> 24) & 0xFF); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SET_TOUCH_ACTIVE:\r\n\t\tsetTouchActive(lua.getBool(3));\r\n\t\tbreak;\r\n\tcase UI_SCROLL_GET_TOUCH_ACTIVE:\r\n\t\tlua.retInt(getTouchActive()); ret = 1;\r\n\t\tbreak;\r\n\tcase UI_SCROLL_SELECT_SCRMGR:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc >= 3) {\r\n\t\t\t\tconst char * name = lua.getString(3);\r\n\t\t\t\tint ac = argc - 3;\r\n\t\t\t\tint * params = 0;\r\n\t\t\t\tif(ac > 0) {\r\n\t\t\t\t\tparams = KLBNEWA(int, ac);\r\n\t\t\t\t\tfor(int i = 0; i < ac; i++) {\r\n\t\t\t\t\t\tparams[i] = lua.getInt(4 + i);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbResult = selectScrMgr(name, ac, params);\r\n\t\t\t\tKLBDELETE(params);\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nvoid\r\nCKLBUIScrollBar::dieUI()\r\n{\r\n\tm_scrBar.die();\r\n}\r\n\r\nvoid\r\nCKLBUIScrollBar::execute(u32 deltaT)\r\n{\r\n\t// モーダルスタック中で動作が有効になっていればm_scrBarの処理を行う\r\n\tbool enable  = m_modalStack.isEnable();\r\n\tbool visible = getVisible();\r\n\r\n\t// scrollbar の挙動は、タスクの modal 状態と visible に同期させる\r\n\tm_scrBar.setEnable(enable);\r\n\tm_scrBar.setVisible(visible);\r\n\r\n\t// scrollbarのフレーム処理(enableとvisibleを与えた上で必ず呼び出す)\r\n\tm_scrBar.execute(deltaT);\r\n\r\n\t// 現在のバー位置をプロパティに反映する\r\n\tm_pos = m_scrBar.getBarPosition();\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIScrollBar.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIScrollBar_h\r\n#define CKLBUIScrollBar_h\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBModalStack.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"IMgrEntry.h\"\r\n\r\n/*!\r\n* \\class CKLBUIScrollBar\r\n* \\brief Scroll Bar Task Class\r\n* \r\n* CKLBUIScrollBar allows to create and manage a Scroll Bar.\r\n* The Scroll Bar action into the Game can be defined through a callback.\r\n*/\r\nclass CKLBUIScrollBar : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIScrollBar>;\r\nprivate:\r\n\tCKLBUIScrollBar();\r\n\tvirtual ~CKLBUIScrollBar();\r\npublic:\r\n\t// プロパティのインデックス\r\n\tenum PROP_ID{\r\n\t\tP_WIDTH,\r\n\t\tP_HEIGHT,\r\n\t\tP_ORDER,\r\n\t\tP_VERT,\r\n\r\n\t\tP_IMAGE,\r\n\t\tP_MIN,\r\n\t\tP_MAX,\r\n\t\tP_POS,\r\n\r\n\t\tP_SLIDER_SIZE,\r\n\t\tP_SLIDER_MIN_SIZE,\r\n\t\r\n\t\tP_CALLBACK,\r\n\t\tP_TOUCH_ACTIVE,\r\n\t\tP_ALPHA_NORMAL,\r\n\t\tP_ALPHA_SELECT,\r\n\t\tP_COLOR_NORMAL,\r\n\t\tP_COLOR_SELECT,\r\n\t};\r\n\r\n\tstatic CKLBUIScrollBar * create(\r\n\t\tCKLBUITask * pParent, CKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos,\r\n\t\tconst char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode = false);\r\n\r\n\tbool initUI(CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI();\r\n\t\r\n\tu32 getClassID();\r\n\r\n\tinline s32\tgetMin          ()          { return m_min;             }\r\n\tinline s32\tgetMax          ()          { return m_max;             }\r\n\tinline s32\tgetPos          ()          { return m_pos;\t            }\r\n\tinline s32\tgetSliderSize   ()          { return m_sliderSize;      }\r\n\tinline s32\tgetSliderSizeMin()          { return m_sliderSizeMin;   }\r\n\tinline bool getTouchActive  ()          { return m_bTouchActive;    }\r\n\tinline u32\tgetColorMode    (u32 mode)  { return m_scrBar.getColorMode(mode); }\r\n\tinline u32\tgetOrder        ()\t\t    { return m_order;           }\r\n\tinline s32\tgetWidth        ()\t\t    { return m_width;           }\r\n\tinline s32\tgetHeight       ()\t\t    { return m_height;          }\r\n\tinline bool getVertical     ()\t\t    { return m_vert;            }\r\n\tinline u32\tgetAlphaNormal  ()\t\t    { return m_alphaNormal;     }\r\n\tinline u32\tgetAlphaSelect  ()\t\t    { return m_alphaSelect;     }\r\n\tinline u32\tgetColorNormal  ()\t\t    { return m_colorNormal;     }\r\n\tinline u32\tgetColorSelect  ()\t\t    { return m_colorSelect;     }\r\n\tinline const char* getImage ()\t\t    { return m_image;           }\r\n\tinline const char* getCallBack()\t    { return m_callback;        }\r\n\tinline u32\tgetMode         ()\t\t    { return m_mode;            }\r\n\r\n\tvoid setMin\t(s32 value);\r\n\tvoid setMax\t(s32 value);\r\n\tvoid setPos\t(s32 value);\r\n\r\n\tinline void setSliderSize\t(s32 value)\t\t\t\t{ m_scrBar.setSliderSize(value);\tm_sliderSize = m_scrBar.getSliderSize();\t\t}\r\n\tinline void setSliderSizeMin(s32 value)\t\t\t\t{ m_scrBar.setSliderSizeMin(value); m_sliderSizeMin = m_scrBar.getSliderSizeMin();\t}\r\n\tinline void setTouchActive\t(bool active)\t\t\t{ m_active = active; m_scrBar.setTouchActive(active);\t}\r\n\tinline void setMode\t\t\t(u32 mode)\t\t\t\t{ m_mode = mode;\t m_scrBar.setMode(mode);\t\t\t}\r\n\tinline void setVertical\t\t(bool vertical)\t\t\t{ m_vert = vertical; m_scrBar.setVertical(vertical);\t}\r\n\tinline void setAlphaNormal\t(u32 alpha)\t\t\t\t{ m_alphaNormal = (u8)alpha; m_scrBar.setColorMode(0,(m_alphaNormal<<24) | m_colorNormal);\t}\r\n\tinline void setAlphaSelect\t(u32 alpha)\t\t\t\t{ m_alphaSelect = (u8)alpha; m_scrBar.setColorMode(1,(m_alphaSelect<<24) | m_colorSelect);\t}\r\n\tinline void setColorNormal\t(u32 colorRGB)\t\t\t{ m_colorNormal = colorRGB;  m_scrBar.setColorMode(0,(m_alphaNormal<<24) | m_colorNormal);\t}\r\n\tinline void setColorSelect\t(u32 colorRGB)\t\t\t{ m_colorSelect = colorRGB;  m_scrBar.setColorMode(1,(m_alphaSelect<<24) | m_colorSelect);\t}\r\n\tinline void setWidth\t\t(s32 width)\t\t\t\t{ m_width  = width;\t m_scrBar.setWidth(width);\t\t}\r\n\tinline void setHeight\t\t(s32 height)\t\t\t{ m_height = height; m_scrBar.setHeight(height);\t}\r\n\tinline void setOrder\t\t(u32 order)\t\t\t\t{ m_order  = order;\t m_scrBar.setOrder(order);\t\t}\r\n\tinline bool\tselectScrMgr\t(const char* name, int len, int* args) {\r\n\t\tCKLBScrollMgr * pMgr = IMgrEntry::getMgrByArray(name, len, args); \r\n\t\tif(pMgr) m_scrBar.setScrollMgr(pMgr);\r\n\t\treturn ((pMgr != NULL) ? true:false);\r\n\t}\r\n\r\n\tvoid setColorMode\t\t\t(u32 mode, u32 color);\r\nprotected:\r\n\r\n\ts32\t\t    m_min;\r\n\ts32\t\t    m_max;\r\n\ts32\t\t    m_pos;\r\n\ts32\t\t    m_sliderSize;\r\n\ts32\t\t    m_sliderSizeMin;\r\n\tbool\t    m_bTouchActive;\r\n\ts32\t\t    m_width;\r\n\ts32\t\t    m_height;\t\r\n\tu32\t\t    m_order;\r\n\tbool\t    m_vert;\r\n\r\n\tconst char*\tm_image;\r\n\r\n\tconst char* m_callback;\r\n\r\n\tu32\t\t    m_mode;\r\n\tu32\t\t    m_colorNormal;\r\n\tu32\t\t    m_colorSelect;\r\n\tbool\t    m_active;\r\n\tu8\t\t    m_alphaNormal;\r\n\tu8\t\t    m_alphaSelect;\r\n\r\nprivate:\r\n\tvoid recompute\t();\r\n\r\n\tbool init(\r\n\t\tCKLBUITask * pParent, CKLBNode * pNode,\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos,\r\n\t\tconst char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode);\r\n\r\n\tbool initCore(\r\n\t\tu32 order, float x, float y, float width, float height,\r\n\t\ts32 minValue, s32 maxValue, s32 pos,\r\n\t\tconst char * image,\r\n\t\ts32 slider_size, s32 min_slider_size, \r\n\t\tconst char * callback,\r\n\t\tu32 colorNormal, u32 colorSelect, bool vert, bool active, bool hide_mode);\r\n\r\n\r\n\tint\t\t\t\t\tm_minPos;\r\n\tCKLBModalStack\t\tm_modalStack;\t// モーダルスタック\r\n\tCKLBScrollBarIF\t\tm_scrBar;\t\t// ScrollBarインタフェース\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n\r\n#endif // CKLBUIScrollBar_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUISimpleItem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUISimpleItem.h\"\r\n#include \"CKLBUtility.h\"\r\n\r\n// Command Values\r\nenum {\r\n\tUI_SIMPLE_ = 0,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_SIMPLE_\", UI_SIMPLE_ },\r\n\t{0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUISimpleItem> factory(\"UI_SimpleItem\", CLS_KLBUISIMPLEITEM, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUISimpleItem::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUISimpleItem::setOrder,\t(getBoolT)&CKLBUISimpleItem::getOrder,\t0 },\r\n\t{\t\"asset\",\tR_STRING,\tNULL,\t\t\t\t\t\t\t\t\t(getBoolT)&CKLBUISimpleItem::getAsset,\t0 }\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_ASSET,\r\n\r\n\tARG_REQUIRE = ARG_ASSET,\r\n\tARG_NUMS = ARG_ASSET\r\n};\r\n\r\nCKLBUISimpleItem::CKLBUISimpleItem() \r\n: CKLBUITask()\r\n, m_pNode   (NULL)\r\n, m_asset   (NULL) \r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUISimpleItem::~CKLBUISimpleItem() \r\n{\r\n\tKLBDELETEA(m_asset);\r\n}\r\n\r\nu32 \r\nCKLBUISimpleItem::getClassID() \r\n{ \r\n    return CLS_KLBUISIMPLEITEM; \r\n}\r\n\r\nCKLBUISimpleItem* \r\nCKLBUISimpleItem::create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset) \r\n{\r\n\tCKLBUISimpleItem* pTask = KLBNEW(CKLBUISimpleItem);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, order,x,y,asset)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUISimpleItem::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset) \r\n{\r\n    if(!setupNode()) { return false; }\r\n\tbool bResult = initCore(order,x,y,asset);\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUISimpleItem::initCore(u32 order, float x, float y, const char* asset)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\r\n\tsetStrC(m_asset, asset);\r\n\r\n\tm_pNode = CKLBUtility::createNodeScript( m_asset, m_order, &m_handle);\r\n\tif(!m_pNode) {\r\n\t\treturn false;\r\n\t}\r\n\tgetNode()->addNode(m_pNode);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUISimpleItem::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tfloat x = lua.getFloat(ARG_X);\r\n\tfloat y = lua.getFloat(ARG_Y);\r\n\r\n\treturn initCore(lua.getInt(ARG_ORDER),x,y,lua.getString(ARG_ASSET));\r\n} \r\n\r\nvoid\r\nCKLBUISimpleItem::execute(u32 /*deltaT*/)\r\n{\r\n\tklb_assertAlways(\"Should never be executed\");\r\n}\r\n\r\nvoid\r\nCKLBUISimpleItem::dieUI()\r\n{\r\n\tCKLBUtility::deleteNode(m_pNode, m_handle);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUISimpleItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUISimpleItem_h\r\n#define CKLBUISimpleItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUISimpleItem\r\n* \\brief Simple Item task Class\r\n* \r\n* CKLBUISimpleItem is a simple Image.\r\n*/\r\nclass CKLBUISimpleItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUISimpleItem>;\r\nprivate:\r\n\tCKLBUISimpleItem();\r\n\tvirtual ~CKLBUISimpleItem();\r\n\tbool init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset);\r\n\tbool initCore(u32 order, float x, float y, const char* asset);\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\tstatic CKLBUISimpleItem* create(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset);\r\n\tbool initUI (CLuaState& lua);\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline virtual void setOrder(u32 order) {\r\n\t\tif (order != m_order) {\r\n\t\t\tm_order = order;\r\n\t\t\tm_pNode->setPriority(m_order);\r\n\t\t}\r\n\t}\r\n\r\n\tinline virtual u32  getOrder() { return m_order; }\r\n\tinline const char*\tgetAsset() { return m_asset; }\r\n\r\nprivate:\r\n\tu32\t\t\t\tm_order;\r\n\tconst char*\t\tm_asset;\r\n\tu32\t\t\t\tm_handle;\r\n\tCKLBNode\t*\tm_pNode;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUISimpleItem_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUISystem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include <string.h>\r\n#include \"AudioAsset.h\"\r\n#include \"CKLBTouchEventUI.h\"\r\n\r\n// Init Touch System.\r\nSFormCtrlList* CKLBUISystem::s_formList = NULL;\r\nSClipRecord*   CKLBUISystem::s_clip_array[UI_SYS_MAXCLIP_ARRAY];\r\nu16 CKLBUISystem::s_clip_arraySize = 0;\r\n\r\nCKLBUISelectable* \r\nCKLBUISystem::hitTest(float screenX, float screenY) \r\n{\r\n\tCKLBUISelectable*   result      = NULL;\r\n\tSFormCtrlList*      pFormParse  = CKLBTouchEventUIMgr::getInstance().m_pFormBegin;\r\n\tu32 priorityResult = 0;\r\n\r\n\twhile (pFormParse) {\r\n\t\t// Possible optimization here using form \"state\" information.\r\n\t\t// if (pFormParse->bEnable) { pFormParse = pFormParse->nextForm; continue; }\r\n\r\n\t\tCKLBUISelectable* elem      = pFormParse->pBegin;\r\n\t\twhile (elem) {\r\n\t\t\tif (elem->isEnabled()) {\t\t// Visible AND Enabled test.\r\n\t\t\t\tSTouchSurface* list = &elem->m_touchSurface;\r\n\r\n\t\t\t\tif (list->isUpToDate == false) {\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// Apply matrix computation.\r\n\t\t\t\t\t//\r\n\t\t\t\t\tfloat tx  = list->transform->m_matrix[MAT_TX];\r\n\t\t\t\t\tfloat ty  = list->transform->m_matrix[MAT_TY];\r\n\t\t\t\t\tfloat sx  = list->transform->m_matrix[MAT_A];\r\n\t\t\t\t\tfloat nsx = list->transform->m_matrix[MAT_B];\r\n\t\t\t\t\tfloat sy  = list->transform->m_matrix[MAT_D];\r\n\t\t\t\t\tfloat nsy = list->transform->m_matrix[MAT_C];\r\n\r\n\t\t\t\t\tfor (int idx=0; idx<4; idx += 2) {\r\n\t\t\t\t\t\tfloat lx = (idx == 0) ? list->beforeTransform[0] :  list->beforeTransform[0] + list->beforeTransform[2];\r\n\t\t\t\t\t\tfloat ly = (idx == 0) ? list->beforeTransform[1] :  list->beforeTransform[1] + list->beforeTransform[3];\r\n\r\n\t\t\t\t\t\tlist->afterTransform[0+idx] = (lx * sx) + (ly * nsx) + tx;\r\n\t\t\t\t\t\tlist->afterTransform[1+idx] = (ly * sy) + (lx * nsy) + ty;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlist->isUpToDate = true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// 1.Check if list->touchSurfacePriorityEquiv belong to a clipping range.\r\n\t\t\t\t//\tIf so, clip afterTransformCoordinates\r\n\t\t\t\tint n = 0;\r\n\t\t\t\twhile (n < s_clip_arraySize) {\r\n\t\t\t\t\tif ((list->touchSurfacePriorityEquiv >= s_clip_array[n]->pClipStartState->getOrder()) &&\r\n\t\t\t\t\t\t(list->touchSurfacePriorityEquiv <  s_clip_array[n]->pClipEndState->getOrder())) {\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Perform clipping\r\n\t\t\t\t\t\t//\r\n\r\n\t\t\t\t\t\t// Convert H,W -> X,Y\r\n\t\t\t\t\t\tfloat clip[4];\r\n\t\t\t\t\t\tfloat* src = s_clip_array[n]->pClipStartState->getPostScissor();\r\n\r\n\t\t\t\t\t\tclip[0] = src[0];\r\n\t\t\t\t\t\tclip[1] = src[1];\r\n\t\t\t\t\t\tclip[2] = src[2] + src[0];\r\n\t\t\t\t\t\tclip[3] = src[3] + src[1];\r\n\r\n\t\t\t\t\t\tif (list->afterTransform[0] < clip[0]) { list->afterTransform[0] = clip[0]; }\r\n\t\t\t\t\t\tif (list->afterTransform[1] < clip[1]) { list->afterTransform[1] = clip[1]; }\r\n\t\t\t\t\t\tif (list->afterTransform[0] > clip[2]) { list->afterTransform[0] = clip[2]; }\r\n\t\t\t\t\t\tif (list->afterTransform[1] > clip[3]) { list->afterTransform[1] = clip[3]; }\r\n\t\t\t\t\t\tif (list->afterTransform[2] < clip[0]) { list->afterTransform[2] = clip[0]; }\r\n\t\t\t\t\t\tif (list->afterTransform[3] < clip[1]) { list->afterTransform[3] = clip[1]; }\r\n\t\t\t\t\t\tif (list->afterTransform[2] > clip[2]) { list->afterTransform[2] = clip[2]; }\r\n\t\t\t\t\t\tif (list->afterTransform[3] > clip[3]) { list->afterTransform[3] = clip[3]; }\r\n\r\n\t\t\t\t\t\t// Little optimization, early stop.\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tn++;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (    (screenX >= list->afterTransform[0]) && (screenY >= list->afterTransform[1])\r\n\t\t\t\t\t&&  (screenX <= list->afterTransform[2]) && (screenY <= list->afterTransform[3]))\r\n\t\t\t\t{\r\n\t\t\t\t\tif (list->touchSurfacePriorityEquiv >= priorityResult) {\r\n\t\t\t\t\t\tpriorityResult = list->touchSurfacePriorityEquiv;\r\n\t\t\t\t\t\tresult = elem;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\telem = elem->m_pNextSelectable;\r\n\t\t}\r\n\r\n\t\tpFormParse = pFormParse->next;\r\n\t}\r\n\tprintf(\"CLICK %p\\n\", result);\r\n\treturn result;\r\n}\r\n\r\nbool \r\nCKLBUISystem::checkRange(CKLBRenderState* startClip, CKLBRenderState* endClip) \r\n{\r\n\tklb_assert(startClip->getOrder() < endClip->getOrder(), \"Wrong clipping order (start >= end)\");\r\n\r\n\tint n = 0;\r\n\twhile (n < s_clip_arraySize) {\r\n\t\tCKLBRenderState* pStateS = s_clip_array[n]->pClipStartState;\r\n\t\tCKLBRenderState* pStateE = s_clip_array[n]->pClipEndState;\r\n\r\n\t\tif ((startClip->getOrder() >= pStateS->getOrder()) && (startClip->getOrder() <= pStateE->getOrder())) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif ((endClip->getOrder() >= pStateS->getOrder()) && (endClip->getOrder() <= pStateE->getOrder())) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tn++;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nvoid* \r\nCKLBUISystem::registerClip(CKLBRenderState* startClip, CKLBRenderState* endClip) \r\n{\r\n\tklb_assert(s_clip_arraySize < UI_SYS_MAXCLIP_ARRAY, \"Reached max UI clipping stack\");\r\n\r\n\tklb_assert(checkRange(startClip, endClip), \"Overlapping clipping range\");\r\n\r\n\tSClipRecord * pRec = KLBNEW(SClipRecord);\r\n\tpRec->pClipStartState = startClip;\r\n\tpRec->pClipEndState = endClip;\r\n\ts_clip_array[s_clip_arraySize++] = pRec; \r\n\treturn (void *)pRec;\r\n}\r\n\r\nvoid \r\nCKLBUISystem::unregisterClip(void* handle) \r\n{\r\n\tif (handle) {\r\n\t\ts32 n = 0;\r\n\t\twhile (n < s_clip_arraySize) {\r\n\t\t\tif (s_clip_array[n] == handle) {\r\n\t\t\t\t//\r\n\t\t\t\t// Remove from list.\r\n\t\t\t\t//\r\n\t\t\t\twhile (n < (s_clip_arraySize-1)) {\r\n\t\t\t\t\ts_clip_array[n] = s_clip_array[n+1];\r\n\t\t\t\t\tn++;\r\n\t\t\t\t}\r\n\t\t\t\tKLBDELETE((SClipRecord *)handle);\r\n\t\t\t\thandle = NULL;\r\n\t\t\t\ts_clip_arraySize--;\r\n\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tn++;\r\n\t\t}\r\n\t}\r\n\r\n\t// Do nothing.\r\n}\r\n\r\nCKLBUISelectable* \r\nCKLBUISystem::createTouchSurface(CKLBUISelectable* pSource, u32 priority) \r\n{\r\n\tklb_assert(s_formList, \"Always have form assigned\");\r\n\tklb_assert(pSource->m_pNextSelectable == NULL, \"Must be null\");\r\n\r\n\tSTouchSurface*\tpNew    = &pSource->m_touchSurface;\r\n\tpNew->isUpToDate        = false;\r\n\t\t\t\r\n\tpNew->beforeTransform[0] = 0.0f;\r\n\tpNew->beforeTransform[1] = 0.0f;\r\n\tpNew->beforeTransform[2] = 0.0f;\r\n\tpNew->beforeTransform[3] = 0.0f;\r\n\r\n\tpNew->surfaceIndex              = 0; // Not used for now.\r\n\tpNew->transform                 = &pSource->m_composedMatrix;\r\n\tpNew->touchSurfacePriorityEquiv\t= priority;\r\n\r\n\tprintf(\"FORM Add Ctrl : %p\\n\", pSource);\r\n\r\n\tpSource->m_pNextSelectable = s_formList->pBegin;\r\n\ts_formList->pBegin = pSource;\r\n\t\r\n\treturn pSource;\r\n}\r\n\r\nvoid \r\nCKLBUISystem::releaseTouchSurface(CKLBUISelectable* pSurface) \r\n{\r\n\tSFormCtrlList* pFormParse\t\t= CKLBTouchEventUIMgr::getInstance().m_pFormBegin;\r\n\tklb_assert(pSurface, \"NULL PTR\");\r\n\r\n\twhile (pFormParse) {\r\n\t\t// Possible optimization here using form \"state\" information.\r\n\t\t// if (pFormParse->bEnable) { pFormParse = pFormParse->nextForm; continue; }\r\n\r\n\t\tCKLBUISelectable* elem = pFormParse->pBegin;\r\n\t\tCKLBUISelectable* prev = NULL;\r\n\r\n\t\twhile (elem && elem != pSurface) {\r\n\t\t\tprev = elem;\r\n\t\t\telem = elem->m_pNextSelectable;\r\n\t\t}\r\n\r\n\t\tif (elem) {\r\n\t\t\tprintf(\"FORM Remove Ctrl : %p %p\\n\", pSurface, pFormParse);\r\n\t\t\tif (prev == NULL) {\r\n\t\t\t\tpFormParse->pBegin = elem->m_pNextSelectable;\r\n\t\t\t} else {\r\n\t\t\t\tprev->m_pNextSelectable = elem->m_pNextSelectable;\r\n\t\t\t}\r\n\r\n\t\t\t// Early return\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tpFormParse = pFormParse->next;\r\n\t}\r\n\r\n\tklb_assertAlways(\"Surface not found\");\r\n}\r\n\r\nvoid \r\nCKLBUISystem::releaseAll() \r\n{\r\n\t/*\r\n\tklb_assert(!s_touchList, \"Hit List should be empty\");\r\n\r\n\ts_touchList = NULL;\r\n\t*/\r\n}\r\n\r\nvoid \r\nCKLBUISystem::setFormList(SFormCtrlList * pList)\r\n{\r\n\ts_formList = pList;\r\n}\r\n\r\n// -----------------------------------------------------------------\r\n//   CKLBUIElement\r\n// -----------------------------------------------------------------\r\n\r\nCKLBUIElement::CKLBUIElement()\r\n: CKLBNode              ()\r\n, m_currentAsset        (NULL)\r\n, m_currentAssetTree    (NULL)\r\n, m_pActionHandlerList  (NULL)\r\n, m_pNormal             (NULL)\r\n, m_pDisabled           (NULL)\r\n, m_pNormalTree         (NULL)\r\n, m_pDisabledTree       (NULL)\r\n, m_luaFunc             (NULL)\r\n, m_scriptable          (NULL)\r\n, m_UIState             (NORMAL)\r\n, m_listenerMask        (0)\r\n, m_renderPrio          (0)\r\n, m_bEnabled            (true)\r\n, m_bUpperEnabled       (true)\r\n, m_bDoRefCount         (true)\r\n{\r\n\tm_bInternalNode  = false;\r\n\tm_status        |= UI_TYPE;\t// Node made it visible and marked for refresh.\r\n}\r\n\r\nCKLBUIElement::~CKLBUIElement() \r\n{\r\n\treleaseAsset(m_pNormal);\r\n\treleaseAsset(m_pDisabled);\r\n\tm_pNormal   = NULL;\r\n\tm_pDisabled\t= NULL;\r\n\r\n\tKLBDELETE(m_pNormalTree);\r\n\tKLBDELETE(m_pDisabledTree);\r\n\tKLBDELETEA(m_luaFunc);\r\n}\r\n\r\nvoid \r\nCKLBUIElement::setScriptable(CKLBObjectScriptable* pScriptable) \r\n{\r\n\tm_scriptable = pScriptable;\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIElement::addRender() \r\n{\r\n\t// Ancestor support.\r\n\tCKLBNode::addRender();\r\n\r\n\t// Visibility flag is up to date : call works.\r\n\tswitchTo(m_UIState);\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIElement::removeRender() \r\n{\r\n\t// Ancestor support.\r\n\tCKLBNode::removeRender();\r\n\r\n\tif (m_currentAssetTree) {\r\n\t\tthis->removeNode(m_currentAssetTree);\r\n\t\tm_currentAsset = NULL; // No asset is displayed now.\r\n\t}\r\n}\r\n\r\n\r\nvoid \r\nCKLBUIElement::setLeft(s32 coordinateX) \r\n{\r\n\tthis->m_matrix.m_matrix[MAT_TX] = (float)coordinateX;\r\n\tmarkUpMatrix();\r\n}\r\n\r\nvoid \r\nCKLBUIElement::setTop(s32 coordinateY) \r\n{\r\n\tthis->m_matrix.m_matrix[MAT_TY] = (float)coordinateY;\r\n\tmarkUpMatrix();\r\n}\r\n\r\nvoid \r\nCKLBUIElement::releaseAsset(CKLBAsset* pAsset) \r\n{\r\n\tif (pAsset && m_bDoRefCount) {\r\n\t\tif (pAsset->getAssetType() != ASSET_IMAGE) {\r\n\t\t\tpAsset->decrementRefCount();\r\n\t\t} else {\r\n\t\t\t((CKLBImageAsset*)pAsset)->getTexture()->decrementRefCount();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIElement::resetAsset(CKLBAsset** ppOldAsset, CKLBNode** ppOldNode, CKLBAsset* newAsset) \r\n{\r\n\tif (*ppOldAsset != newAsset) {\r\n\t\treleaseAsset(*ppOldAsset);\r\n\r\n\t\tKLBDELETE((*ppOldNode));\r\n\t\t*ppOldAsset = newAsset;\r\n\r\n\t\tif (newAsset && m_bDoRefCount) {\r\n\t\t\tif (newAsset->getAssetType() != ASSET_IMAGE) {\r\n\t\t\t\tnewAsset->incrementRefCount();\r\n\t\t\t} else {\r\n\t\t\t\t((CKLBImageAsset*)newAsset)->getTexture()->incrementRefCount();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t*ppOldNode\t= NULL;\r\n\r\n\t\tswitchTo(m_UIState);\r\n\t}\r\n}\r\n\r\n/*virtual*/ \r\nvoid \r\nCKLBUIElement::setAsset(CKLBAsset*\tpAsset, CKLBUIElement::ASSET_TYPE mode) \r\n{\r\n\tswitch (mode) {\r\n\tcase CKLBUIElement::NORMAL_ASSET:\r\n\t\tresetAsset(&m_pNormal, &m_pNormalTree, pAsset);\r\n\t\tbreak;\r\n\tcase CKLBUIElement::DISABLED_ASSET:\r\n\t\tresetAsset(&m_pDisabled, &m_pDisabledTree, pAsset);\r\n\t\tbreak;\r\n\tdefault:\r\n\t\t// Do nothing.\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIElement::visibleSelf() \r\n{\r\n\tCKLBNode::visibleSelf();\r\n\t// sendEvent(ACTION_STATECHANGE, this->m_UIState);\r\n}\r\n\r\nvoid \r\nCKLBUIElement::invisibleSelf() \r\n{\r\n\tCKLBNode::invisibleSelf();\r\n\t// sendEvent(ACTION_STATECHANGE, NOT_ON_SCREEN);\r\n}\r\n\r\nvoid \r\nCKLBUIElement::setUpperEnabled(bool isEnabled) \r\n{\r\n\tif ((isEnabled != m_bUpperEnabled) || (m_currentAsset == NULL)) {\r\n\t\tm_bUpperEnabled = isEnabled;\r\n\t\tif (isEnabled && m_bEnabled) {\t// Both upper and current enabled.\r\n\t\t\tswitchTo(NORMAL);\r\n\t\t} else {\r\n\t\t\tswitchTo(DISABLED);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIElement::setEnabled(bool isEnabled) \r\n{\r\n\tif ((isEnabled != m_bEnabled) || (m_currentAsset == NULL)) {\r\n\t\tm_bEnabled = isEnabled;\r\n\t\tif (isEnabled && m_bUpperEnabled) {\t// Both current and upper enabled.\r\n\t\t\tswitchTo(NORMAL);\r\n\t\t} else {\r\n\t\t\tswitchTo(DISABLED);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nbool \r\nCKLBUIElement::isEnabled() \r\n{\r\n\treturn m_bEnabled && m_bUpperEnabled && isVisible();\r\n}\r\n\r\nvoid \r\nCKLBUIElement::switchTo(UI_STATE newState) \r\n{\r\n\tif (isVisible()) {\r\n\t\tCKLBAsset*  pCurrAsset  = NULL;\r\n\t\tCKLBNode*   pCurrNode   = NULL;\r\n\t\tbool create = false;\r\n\r\n\t\t//\r\n\t\t// Select Graphical state : asset and create cached node tree if not present.\r\n\t\t//\r\n\t\tswitch (newState) {\r\n\t\tcase CKLBUIElement::NORMAL_ASSET:\r\n\t\t\tpCurrAsset = m_pNormal;\r\n\t\t\tif (m_pNormal && (m_pNormalTree == NULL)) {\r\n\t\t\t\tm_pNormalTree\t= m_pNormal->createSubTree(m_renderPrio);\r\n\t\t\t\tcreate = true;\r\n\t\t\t}\r\n\t\t\tpCurrNode\t\t= m_pNormalTree;\r\n\t\t\tbreak;\r\n\t\tcase CKLBUIElement::DISABLED_ASSET:\r\n\t\t\tpCurrAsset = m_pDisabled;\r\n\t\t\tif (m_pDisabled && (m_pDisabledTree == NULL)) {\r\n\t\t\t\tm_pDisabledTree = m_pDisabled->createSubTree(m_renderPrio);\r\n\t\t\t\tcreate = true;\r\n\t\t\t}\r\n\t\t\tpCurrNode\t\t= m_pDisabledTree;\r\n\t\t\tbreak;\r\n\t\tcase CKLBUIElement::FOCUSED_ASSET:\r\n\t\t\tif (isSelectable()) {\r\n\t\t\t\tCKLBUISelectable* pSelect = (CKLBUISelectable*)this;\r\n\t\t\t\tpCurrAsset = pSelect->m_pFocus;\r\n\t\t\t\tif (pSelect->m_pFocus && (pSelect->m_pFocusTree == NULL)) {\r\n\t\t\t\t\tpSelect->m_pFocusTree = pCurrNode = pSelect->m_pFocus->createSubTree(m_renderPrio);\r\n\t\t\t\t}\r\n\t\t\t\tpCurrNode\t= pSelect->m_pFocusTree;\r\n\t\t\t\tcreate = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CKLBUIElement::PUSHED_ASSET:\r\n\t\t\tif (isSelectable()) {\r\n\t\t\t\tCKLBUISelectable* pSelect = (CKLBUISelectable*)this;\r\n\t\t\t\tpCurrAsset = pSelect->m_pPushed;\r\n\t\t\t\tif (pSelect->m_pPushed && (pSelect->m_pPushedTree == NULL)) {\r\n\t\t\t\t\tpCurrNode = pSelect->m_pPushedTree = pSelect->m_pPushed->createSubTree(m_renderPrio);\r\n\t\t\t\t}\r\n\t\t\t\tpCurrNode\t= pSelect->m_pPushedTree;\r\n\t\t\t\tcreate = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n        case CKLBUIElement::NOT_ON_SCREEN:\r\n            /* not handled */\r\n            break;\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Apply new Graphical state.\r\n\t\t//\r\n\t\tif ((m_currentAsset != pCurrAsset) || create) {\r\n\t\t\t//\r\n\t\t\t// Remove old visual\r\n\t\t\t//\r\n\t\t\tif (m_currentAssetTree) {\r\n\t\t\t\tthis->removeNode(m_currentAssetTree);\r\n\t\t\t\tm_currentAssetTree = NULL;\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Add new visual\r\n\t\t\t//\r\n\t\t\tif (pCurrNode) {\r\n\t\t\t\tthis->addNode(pCurrNode);\r\n\t\t\t}\r\n\r\n\t\t\tm_currentAsset\t\t= pCurrAsset;\r\n\t\t\tm_currentAssetTree\t= pCurrNode;\r\n\t\t}\r\n\t\t\r\n\t\t/* Temporary comment out.\r\n\t\tif (m_UIState != newState) {\r\n\t\t\tsendEvent(ACTION_STATECHANGE, newState);\r\n\t\t}*/\r\n\t} // else do not modify the scene graph\r\n\r\n\t// Still, state must change.\r\n\tm_UIState = newState;\r\n}\r\n\r\nCKLBUIContainer* \r\nCKLBUIElement::getParentUI() \r\n{\r\n\tCKLBNode* pNode = this->getParent();\r\n\twhile (pNode) {\r\n\t\tu32 clID = pNode->getClassID();\r\n\t\tif (clID & CLS_KLBUICORECLASS) {\r\n\t\t\tif (((CKLBUIElement*)pNode)->isContainer()) {\r\n\t\t\t\treturn (CKLBUIContainer*)pNode;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpNode = pNode->getParent();\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\nbool \r\nCKLBUIElement::processListener(CKLBAction* pAction) \r\n{\r\n\tbool forwardEvent = true;\r\n\tCKLBActionHandler* pHandler = this->m_pActionHandlerList;\r\n\twhile (pHandler) {\r\n\t\tif (pHandler->m_actionType == pAction->m_actionType) {\r\n\t\t\tforwardEvent &= pHandler->handler(pAction);\r\n\t\t}\r\n\t}\r\n\treturn forwardEvent;\r\n}\r\n\r\n/*virtual*/\r\nbool \r\nCKLBUIElement::processAction(CKLBAction* pAction) \r\n{\r\n\tbool forwardEvent = true;\r\n\t/*\r\n\tif (m_listenerMask & (1 << pAction->m_actionType)) {\r\n\t\tforwardEvent &= processListener(pAction);\r\n\t}*/\r\n\r\n\tif (forwardEvent) {\r\n\t\tCKLBUIContainer* pParent = this->getParentUI();\r\n\t\tif (pParent) {\r\n\t\t\tpParent->processAction(pAction);\r\n\t\t}\r\n\t}\r\n\r\n\treturn forwardEvent;\r\n}\r\n\r\n// -----------------------------------------------------------------\r\n//   CKLBUISelectable\r\n// -----------------------------------------------------------------\r\n\r\n#define NO_RADIO_VALUE  (0xFFFFFFFF)\r\n\r\nCKLBUISelectable::CKLBUISelectable()\r\n: CKLBUIElement         ()\r\n, m_pNextSelectable     (NULL)\r\n, m_pPushed             (NULL)\r\n, m_pFocus              (NULL)\r\n, m_pPushedTree         (NULL)\r\n, m_pFocusTree          (NULL)\r\n, m_modalResult         (0)\r\n, m_radioID             (NO_RADIO_VALUE)\r\n, m_bStick              (false)\r\n, m_bDown               (false)\r\n, m_bLocked             (false)\r\n, m_pDownAudio          (NULL)\r\n, m_pUpAudio            (NULL)\r\n, m_pDownVolumeOriginal (1.0f)\r\n, m_pUpVolumeOriginal   (1.0f)\r\n, m_pDownVolumeFactor   (1.0f)\r\n, m_pUpVolumeFactor     (1.0f)\r\n, m_pDownVolume         (1.0f)\r\n, m_pUpVolume           (1.0f)\r\n, m_groupID             (0)\r\n, m_lastClick           (0)\r\n, m_bOwnerDownAudio     (false)\r\n, m_bOwnerUpAudio       (false)\r\n{\r\n}\r\n\r\nbool \r\nCKLBUISelectable::init(u32 priority) \r\n{\r\n\tCKLBUISystem::createTouchSurface(this,priority);\r\n\treturn true;\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUISelectable::recomputeCustom() \r\n{\r\n\t//\r\n\t// Refresh surface computation if a click occurs.\r\n\t//\r\n\tif (m_status & MATRIX_CHANGE) {\r\n\t\tm_touchSurface.isUpToDate = false;\r\n\t}\r\n}\r\n\r\n\r\nCKLBUISelectable::~CKLBUISelectable() \r\n{\r\n\treleaseAsset(m_pPushed);\r\n\treleaseAsset(m_pFocus);\r\n\tm_pPushed   = NULL;\r\n\tm_pFocus    = NULL;\r\n\r\n\tKLBDELETE(m_pPushedTree);\r\n\tKLBDELETE(m_pFocusTree);\r\n\r\n\tCKLBUISystem::releaseTouchSurface(this);\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setClickLeft(s32 coordinateX) \r\n{\r\n\tm_touchSurface.beforeTransform[0]   = (float)coordinateX;\r\n\tm_touchSurface.isUpToDate           = false;\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setClickWidth(u32 width) \r\n{\r\n\tm_touchSurface.beforeTransform[2]   = (float)width;\r\n\tm_touchSurface.isUpToDate           = false;\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setClickTop(s32 coordinateY) \r\n{\r\n\tm_touchSurface.beforeTransform[1]   = (float)coordinateY;\r\n\tm_touchSurface.isUpToDate           = false;\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setClickHeight(u32 height) \r\n{\r\n\tm_touchSurface.beforeTransform[3]   = (float)height;\r\n\tm_touchSurface.isUpToDate           = false;\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setModalResult(u32 modalResult) \r\n{\r\n\tm_modalResult = modalResult;\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setStick(bool isStickable) \r\n{\r\n\tm_bStick = isStickable;\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setSticked(bool isSticked) \r\n{\r\n\tif (isSticked == true) {\r\n\t\t// 1. Get Parent Container.\r\n\t\tCKLBUIContainer* pParent = this->getParentUI();\r\n\r\n\t\tif (pParent) {\r\n\t\t\t// 2. Parse all the children : reset\r\n\t\t\tCKLBUIElement* pElement = pParent->getChildUI();\r\n\t\t\twhile (pElement) {\r\n\t\t\t\tu32 clID = pElement->getClassID();\r\n\t\t\t\tif (clID & CLS_KLBUICORECLASS) {\r\n\t\t\t\t\tresetSticked(pElement);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetStickedRecurse(pElement);\r\n\t\t\t\t}\r\n\t\t\t\tpElement = (CKLBUIElement*)(((CKLBUISelectable*)pElement)->m_pBrother);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis->setStickedInternal(isSticked);\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setStickedRecurse(CKLBNode* pNode) \r\n{\r\n    pNode = pNode->getChild();\r\n    while (pNode) {\r\n\t    u32 clID = pNode->getClassID();\r\n\t    if (clID & CLS_KLBUICORECLASS) {\r\n\t\t    if (clID == CLS_KLBUISELECTABLE) {\r\n\t\t\t    resetSticked((CKLBUIElement*)pNode);\r\n\t\t    }\r\n\t    } else {\r\n\t\t    setStickedRecurse(pNode);\r\n\t    }\r\n\t    pNode = (((CKLBUISelectable*)pNode)->m_pBrother);\r\n    }\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::resetSticked(CKLBUIElement* pElement) \r\n{\r\n\tif (pElement->isSelectable()) {\r\n\t\tCKLBUISelectable* pSelect = (CKLBUISelectable*)pElement;\r\n\t\tif (pSelect->isStickable() && (pSelect->getRadioID() != 0xFFFFFFFF)) {\r\n\t\t\tif (pElement->isEnabled()) {\t// Should not be needed but programmatically could occur.\t\t<-- Reset even disabled item\r\n\t\t\t\tif (pSelect != this) {\r\n\t\t\t\t\tpSelect->setStickedInternal(false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setUpperEnabled(bool isEnabled) \r\n{\r\n\tif ((isEnabled != m_bUpperEnabled) || (m_currentAsset == NULL)) {\r\n\t\tm_bUpperEnabled = isEnabled;\r\n\t\tif (isEnabled && m_bEnabled) {\t// Both upper and current enabled.\r\n\t\t\tif ((m_bStick) && (m_bDown)) {\r\n\t\t\t\tswitchTo(DOWN);\r\n\t\t\t} else {\r\n\t\t\t\tm_bDown = false;\r\n\t\t\t\tswitchTo(NORMAL);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tswitchTo(DISABLED);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setEnabled(bool isEnabled) \r\n{\r\n\tif ((isEnabled != m_bEnabled) || (m_currentAsset == NULL)) {\r\n\t\tm_bEnabled = isEnabled;\r\n\t\tif (isEnabled && m_bUpperEnabled) {\t// Both current and upper enabled.\r\n\t\t\tif ((m_bStick) && (m_bDown)) {\r\n\t\t\t\tswitchTo(DOWN);\r\n\t\t\t} else {\r\n\t\t\t\tm_bDown = false;\r\n\t\t\t\tswitchTo(NORMAL);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tswitchTo(DISABLED);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setStickedInternal(bool isSticked) \r\n{\r\n\tbool tmp = (isSticked != m_bDown); \r\n\tif (tmp || (m_currentAsset == NULL)) {\r\n\t\tm_bDown = isSticked;\r\n\r\n\t\tif (m_UIState != DISABLED) {\r\n\t\t\tif (isSticked) {\r\n\t\t\t\tswitchTo(DOWN);\r\n\t\t\t} else {\r\n\t\t\t\tswitchTo(NORMAL);\r\n\t\t\t\tm_bLocked = false;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Do nothing, stay DISABLED view\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setRadio(u32 radioID) \r\n{\r\n\tm_radioID = radioID;\r\n}\r\n\r\n/*virtual*/\r\nbool \r\nCKLBUISelectable::processAction\t(CKLBAction* pAction) \r\n{\r\n\tbool down = this->m_bDown;\r\n\r\n\tif (pAction->m_actionType == ACTION_PUSH) {\r\n\t\tif (!down && m_pDownAudio) {\r\n\t\t\tm_pDownAudio->play(m_pDownVolume);\r\n\t\t}\r\n\r\n\t\tif (this->m_bStick == false) {\t// If button : down on push.\r\n\t\t\tthis->setSticked(true);\r\n\t\t\tif (m_bStick) {\r\n\t\t\t\tm_bLocked = !m_bLocked;\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (pAction->m_actionType == ACTION_RELEASE) {\r\n\t\tif (this->m_bStick && down == false) {\r\n\t\t\tthis->setSticked(true);\r\n\t\t\t/* locked desactive\r\n\t\t\tif (m_bStick) {\r\n\t\t\t\tm_bLocked = !m_bLocked;\r\n\t\t\t}*/\r\n\t\t}\r\n\t\telse\r\n\t\tif ((this->m_bStick == false) || (m_bLocked == false)) {\r\n\t\t\tif (down && m_pUpAudio) {\r\n\t\t\t\tm_pUpAudio->play(m_pUpVolume);\r\n\t\t\t}\r\n\t\t\tthis->setSticked(false);\r\n\t\t\tm_bLocked = false;\r\n\t\t}\r\n\r\n\t\tif (m_bDown && (m_modalResult != 0)) {\r\n\t\t\tCKLBUIContainer* pParent = this->getParentUI();\r\n\t\t\twhile (pParent) {\r\n\t\t\t\tif (pParent->isModal()) {\r\n\t\t\t\t\tpParent->sendEvent(ACTION_CLOSE, m_modalResult);\r\n\t\t\t\t\tpParent->getParent()->removeNode(pParent);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tpParent = pParent->getParentUI();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Only check box deliver change event.\r\n\t\tif ((down != this->m_bDown) && (this->m_bStick == true)) {\r\n\t\t\tsendEvent(ACTION_CHANGE, m_bDown ? 1 : 0);\r\n\t\t}\r\n\t} else if (pAction->m_actionType == ACTION_UNDEF) {\r\n\t\t// Cancel action on a checkbox.\r\n\t\tif (this->m_bStick) {\r\n\t\t\t// Do nothing, change on release.\r\n\t\t} else {\r\n\t\t// Cancel button pushed.\r\n\t\t\tthis->setSticked(false);\r\n\t\t}\r\n\t}\r\n\r\n\tswitch (pAction->m_actionType) {\r\n\tcase ACTION_PUSH:\r\n\t\tsendEvent((ACTION_TYPE)pAction->m_actionType, 0);\r\n\t\tbreak;\r\n\tcase ACTION_RELEASE:\r\n\t\t{\r\n\t\t\tsendEvent((ACTION_TYPE)pAction->m_actionType, 0);\t// Release\r\n\t\t\tint fid = CKLBTaskMgr::getInstance().getFrameID();\r\n\t\t\tif(fid != m_lastClick) {\r\n\t\t\t\tm_lastClick = fid;\r\n\t\t\t\tsendEvent(ACTION_CLICK,0);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\tcase ACTION_UNDEF:\r\n\t\tsendEvent(ACTION_RELEASE, 1);\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn CKLBUIElement::processAction(pAction);\r\n}\r\n\r\nbool \r\nCKLBUIElement::sendEvent(ACTION_TYPE type, u32 param) \r\n{\r\n    if(!m_luaFunc) { return false; } // do not have Lua function name.\r\n\r\n\tconst char * name = (!m_name) ? \"\" : m_name;\r\n    if(m_luaFunc) { \r\n        CKLBScriptEnv::getInstance().call_eventSelectable(m_luaFunc, m_scriptable, name, (int)type, param); \r\n    }\r\n\r\n\treturn false;\r\n}\r\n\r\nbool \r\nCKLBUISelectable::setLuaFunction(const char * name)\r\n{\r\n\tchar * buf;\r\n\tif(name) {\r\n\t\tbuf = KLBNEWA(char, strlen(name) + 1);\r\n\t\tif(!buf) return false;\r\n\t\tstrcpy(buf, name);\r\n\t} else {\r\n\t\tbuf = NULL;\r\n\t}\r\n\tif(m_luaFunc) KLBDELETEA(m_luaFunc);\r\n\tm_luaFunc = buf;\r\n\treturn true;\r\n}\r\n\r\n/*virtual*/ \r\nvoid \r\nCKLBUISelectable::setAsset(CKLBAsset*\tpAsset, CKLBUIElement::ASSET_TYPE mode) \r\n{\r\n\tswitch (mode) {\r\n\tcase CKLBUIElement::PUSHED_ASSET:\r\n\t\tresetAsset(&m_pPushed, &m_pPushedTree, pAsset);\r\n\t\tbreak;\r\n\tcase CKLBUIElement::FOCUSED_ASSET:\r\n\t\tresetAsset(&m_pPushed, &m_pPushedTree, pAsset);\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tCKLBUIElement::setAsset(pAsset, mode);\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUISelectable::setAudio(CKLBAudioAsset* pAudioAsset, u32 mode, float volume, bool bOwner) \r\n{\r\n\tif (mode == 0) {\r\n\t\t// Down\r\n\t\tif(m_bOwnerDownAudio && m_pDownAudio) {\r\n\t\t\tm_pDownAudio->decrementRefCount();\r\n\t\t}\r\n\t\tm_pDownAudio        = pAudioAsset;\r\n\t\tm_bOwnerDownAudio   = bOwner;\r\n\t\tm_pDownVolumeOriginal = volume;\r\n\t\tm_pDownVolume       = m_pDownVolumeOriginal * m_pDownVolumeFactor;\r\n\t} else {\r\n\t\t// Up\r\n\t\tif(m_bOwnerUpAudio && m_pUpAudio) {\r\n\t\t\tm_pUpAudio->decrementRefCount();\r\n\t\t}\r\n\t\tm_pUpAudio          = pAudioAsset;\r\n\t\tm_bOwnerUpAudio     = bOwner;\r\n\t\tm_pUpVolumeOriginal = volume;\r\n\t\tm_pUpVolume         = m_pUpVolumeOriginal * m_pUpVolumeFactor;\r\n\t}\r\n}\r\n\r\nvoid CKLBUISelectable::setMultiplyVolume(u32 mode, float factorVolume) {\r\n\tif (mode == 0) {\r\n        m_pDownVolumeFactor = factorVolume;\r\n\t\tm_pDownVolume       = m_pDownVolumeOriginal * m_pDownVolumeFactor;\r\n\t} else {\r\n\t\t// Up\r\n        m_pUpVolumeFactor   = factorVolume;\r\n\t\tm_pUpVolume         = m_pUpVolumeOriginal * m_pUpVolumeFactor;\r\n\t}\r\n}\r\n\r\n// -----------------------------------------------------------------\r\n//   CKLBUIContainer\r\n// -----------------------------------------------------------------\r\n\r\nCKLBUIContainer::CKLBUIContainer()\r\n: CKLBUIElement     ()\r\n, m_viewPortWidth   (0)\r\n, m_viewPortHeight  (0)\r\n, m_viewScrollX     (0)\r\n, m_viewScrollY     (0)\r\n, m_innerNode       (NULL)\r\n, m_bAsModal        (false)\r\n, m_clipHandle      (NULL)\r\n{\r\n    m_outerNode = this; // Should not be used in initializer. (Compiler Warning)\r\n}\r\n\r\nCKLBUIContainer::~CKLBUIContainer() \r\n{\r\n\tif (m_clipHandle) {\r\n\t\tCKLBUISystem::unregisterClip(m_clipHandle);\r\n\t\tm_clipHandle = NULL;\r\n\t}\r\n\tKLBDELETE(m_innerNode);\r\n}\r\n\r\nbool CKLBUIContainer::init() \r\n{\r\n\tm_innerNode = KLBNEW(CKLBNode);\r\n\tif (m_innerNode) {\r\n\t\tthis->addNode(m_innerNode);\r\n\t}\r\n\r\n\treturn (m_innerNode != NULL);\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIContainer::setUpperEnabled(bool isEnabled) \r\n{\r\n\tif ((isEnabled != m_bUpperEnabled) || (m_currentAsset == NULL)) {\r\n\t\tm_bUpperEnabled = isEnabled;\r\n\t\tif (isEnabled && m_bEnabled) {\t// Both upper and current enabled.\r\n\t\t\tswitchTo(NORMAL);\r\n\t\t} else {\r\n\t\t\tswitchTo(DISABLED);\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Modify all sub tree.\r\n\t\t//\r\n\t\tCKLBNode* pElement = this->getChildUI();\r\n\t\twhile (pElement) {\r\n\t\t\t//\r\n\t\t\t// Dirty cast (CKLBUIContainer*) because protected inheritance C++ spec are stupid.\r\n\t\t\t//\r\n\t\t\tswitch (pElement->getClassID()) {\r\n\t\t\tcase CLS_KLBUIELEMENT:\r\n\t\t\tcase CLS_KLBUISELECTABLE:\r\n\t\t\tcase CLS_KLBUICONTAINER:\r\n\t\t\t\t((CKLBUIContainer*)pElement)->setUpperEnabled(isEnabled);\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpElement = ((CKLBUIContainer*)pElement)->m_pBrother;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIContainer::setEnabled(bool isEnabled) \r\n{\r\n\tif ((isEnabled != m_bEnabled) || (m_currentAsset == NULL)) {\r\n\t\tm_bEnabled = isEnabled;\r\n\t\tif (isEnabled && m_bUpperEnabled) {\t// Both current and upper enabled.\r\n\t\t\tswitchTo(NORMAL);\r\n\t\t} else {\r\n\t\t\tswitchTo(DISABLED);\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Modify all sub tree.\r\n\t\t//\r\n\t\tCKLBNode* pElement = this->getChildUI();\r\n\t\twhile (pElement) {\r\n\t\t\t//\r\n\t\t\t// Dirty cast (CKLBUIContainer*) because protected inheritance C++ spec are stupid.\r\n\t\t\t//\r\n\t\t\tswitch (pElement->getClassID()) {\r\n\t\t\tcase CLS_KLBUIELEMENT:\r\n\t\t\tcase CLS_KLBUISELECTABLE:\r\n\t\t\tcase CLS_KLBUICONTAINER:\r\n\t\t\t\t((CKLBUIContainer*)pElement)->setUpperEnabled(isEnabled);\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpElement = ((CKLBUIContainer*)pElement)->m_pBrother;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nCKLBUIElement* \r\nCKLBUIContainer::getChildUI(bool external) \r\n{\r\n\tCKLBNode* pNode;\r\n\t\r\n\tif (external) {\r\n\t\tpNode = m_outerNode; \r\n\t} else {\r\n\t\tpNode = m_innerNode;\r\n\t}\r\n\r\n\treturn (CKLBUIElement*)pNode->getChild();\r\n}\r\n\r\nvoid \r\nCKLBUIContainer::setViewOffsetX(s32 scrollX) \r\n{\r\n\tthis->m_innerNode->setTranslate((float)scrollX,m_innerNode->m_matrix.m_matrix[5]);\r\n}\r\n\r\nvoid \r\nCKLBUIContainer::setViewOffsetY(s32 scrollY) \r\n{\r\n\tthis->m_innerNode->setTranslate(m_innerNode->m_matrix.m_matrix[4],(float)scrollY);\r\n}\r\n\r\nvoid \r\nCKLBUIContainer::addElement(CKLBUIElement*\tpElement, bool external) \r\n{\r\n\tCKLBNode* pNode;\r\n\tif (external) {\r\n\t\tpNode = m_outerNode; \r\n\t} else {\r\n\t\tpNode = m_innerNode;\r\n\t}\r\n\r\n\tpNode->addNode(pElement);\r\n}\r\n\r\nvoid \r\nCKLBUIContainer::removeElement(CKLBUIElement* pElement, bool external) \r\n{\r\n\tCKLBNode* pNode;\r\n\tif (external) {\r\n\t\tpNode = m_outerNode; \r\n\t} else {\r\n\t\tpNode = m_innerNode;\r\n\t}\r\n\r\n\tpNode->removeNode(pElement);\r\n}\r\n\r\nu32 \r\nCKLBUIContainer::getRadioValue() \r\n{\r\n\treturn getRadioValueRecurse(m_innerNode);\r\n}\r\n\r\nu32 \r\nCKLBUIContainer::getRadioValueRecurse(CKLBNode* pNode) \r\n{\r\n\tpNode = pNode->getChild();\r\n\twhile (pNode) {\r\n\t\tu32 res = NO_RADIO_VALUE;\r\n\t\tif (pNode->m_status & UI_TYPE) {\r\n\t\t\tu32 clID = pNode->getClassID(); \r\n\t\t\tif (clID == CLS_KLBUISELECTABLE) {\r\n\t\t\t\tCKLBUISelectable* pSelect = (CKLBUISelectable*)pNode;\r\n\t\t\t\tif (pSelect->isStickable()) {\r\n\t\t\t\t\tif (pSelect->isEnabled()) {\r\n\t\t\t\t\t\tif (pSelect->isSticked()) {\r\n\t\t\t\t\t\t\tu32 radioID = pSelect->getRadioID();\r\n\t\t\t\t\t\t\tif (radioID != NO_RADIO_VALUE) {\r\n\t\t\t\t\t\t\t\treturn radioID;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Element / Container DO NOTHING.\r\n\t\t} else {\r\n\t\t\tres = getRadioValueRecurse(pNode);\r\n\t\t}\r\n\r\n\t\tif (res != NO_RADIO_VALUE) {\r\n\t\t\treturn res;\r\n\t\t}\r\n\t\tpNode = (((CKLBUIContainer*)pNode)->m_pBrother);\r\n\t}\r\n\r\n\treturn NO_RADIO_VALUE;\r\n}\r\n\r\nvoid \r\nCKLBUIContainer::showModal(CKLBNode* pNode) \r\n{\r\n\tthis->m_bAsModal = true;\r\n\tpNode->addNode(this);\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUISystem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n//\r\n// === UI System derived from scene graph ===\r\n//\r\n\r\n#ifndef __KLB_UISYSTEM__\r\n#define __KLB_UISYSTEM__\r\n\r\n#include \"CKLBNode.h\"\r\n#include \"CKLBAsset.h\"\r\n#include \"CKLBTouchPad.h\"\r\n\r\n#include \"CKLBDragCallbackIF.h\"\r\n\r\nclass CKLBUIContainer;\r\nclass CKLBUISelectable;\r\nclass CKLBUISystem;\r\n\r\n/**\r\n\tEach element will use a TouchSurface\r\n */\r\nstruct STouchSurface {\r\n\tfriend class CKLBUISystem;\r\npublic:\r\n\t// Direct link to transform matrix in screen space.\r\n\tSMatrix2D*\t\t\ttransform;\r\n\t\r\n\t// Coordinate setup by user\r\n\t// x,y,w,h\r\n\tfloat\t\t\t\tbeforeTransform[4];\r\n\r\n\t// x0,y0,x1,y1\r\n\tfloat\t\t\t\tafterTransform[4];\t// Coordinate post-transform.\r\n\r\n\tu16\t\t\t\t\tsurfaceIndex;\r\n\tu32\t\t\t\t\ttouchSurfacePriorityEquiv;\t\t\t\t\t\r\n\tbool\t\t\t\tisUpToDate;\t\t\t// Bit telling that user has modified the selection space OR matrix has been changed.\r\n};\r\n\r\nstruct SClipRecord {\r\n\tCKLBRenderState*\tpClipStartState;\r\n\tCKLBRenderState*\tpClipEndState;\r\n};\r\n\r\n#define UI_SYS_MAXCLIP_ARRAY\t\t(16)\r\nstruct SFormCtrlList;\r\n\r\n/*!\r\n* \\class CKLBUISystem\r\n* \\brief UISystem Class\r\n* \r\n* CKLBUISystem provides static methods to manage screen area using STouchSurface.\r\n* It can be used to create/release touch surfaces and clips.\r\n*/\r\nclass CKLBUISystem {\r\npublic:\r\n\tstatic CKLBUISelectable*\thitTest\t\t\t\t(float screenX, float screenY);\r\n\tstatic CKLBUISelectable*\tcreateTouchSurface\t(CKLBUISelectable*\tpSource , u32 priority);\r\n\tstatic void\t\t\t\t\treleaseTouchSurface\t(CKLBUISelectable*\tpSurface);\r\n\tstatic void\t\t\t\t\treleaseAll          ();\r\n\tstatic void\t\t\t\t\tsetFormList\t\t\t(SFormCtrlList * pList);\r\n\tstatic void*\t\t\t\tregisterClip\t\t(CKLBRenderState* startClip, CKLBRenderState* endClip);\r\n\tstatic void\t\t\t\t\tunregisterClip\t\t(void* clipHandle);\r\nprivate:\r\n\tstatic bool\t\t\t\t\tcheckRange\t\t\t(CKLBRenderState* startClip, CKLBRenderState* endClip);\r\n\r\n\tstatic SFormCtrlList*\t\ts_formList;\r\n\tstatic SClipRecord*\t\t\ts_clip_array[UI_SYS_MAXCLIP_ARRAY];\r\n\tstatic u16\t\t\t\t\ts_clip_arraySize;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIElement\r\n* \\brief Element Node Class\r\n* \r\n* CKLBUIElement is the most basic UI Node as it directly inherits CKLBNode.\r\n* It adds Assets and asset management methods to the CKLBNode.\r\n* A CKLBUIElement supports multiple assets association in order to change\r\n* the asset if the CKLBUIElement is enable or not.\r\n*/\r\nclass CKLBUIElement : public CKLBNode {\r\npublic:\r\n\tenum UI_STATE {\r\n\t\tNORMAL,\r\n\t\tDISABLED,\r\n\t\tFOCUSED,\r\n\t\tDOWN,\r\n\t\tNOT_ON_SCREEN\r\n\t};\r\n\r\n\tenum ASSET_TYPE {\r\n\t\tNORMAL_ASSET\t\t= NORMAL,\r\n\t\tDISABLED_ASSET\t\t= DISABLED,\r\n\t\tFOCUSED_ASSET\t\t= FOCUSED,\r\n\t\tPUSHED_ASSET\t\t= DOWN\r\n\t};\r\n\r\n\tCKLBUIElement();\r\n\t~CKLBUIElement();\r\n\r\n\tvoid\tstoreDoRefLock\t\t(bool doRefCounting)\t{ m_bDoRefCount = doRefCounting; }\r\n\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t    { return CLS_KLBUIELEMENT; }\r\n\r\n\tvoid\tsetLeft\t\t\t\t(s32 coordinateX);\r\n\tvoid\tsetTop\t\t\t\t(s32 coordinateY);\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\tbool\t     isEnabled\t\t();\r\n\r\n\tvirtual\tbool isSelectable\t()\t\t{ return false; }\r\n\tvirtual bool isContainer\t()\t\t{ return false; }\r\n\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\r\n\tCKLBUIContainer* getParentUI();\r\n\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\tregisterHandler\t\t(CKLBActionHandler* pActionHandler);\r\n\tvoid\tclearHandlers\t\t();\r\n\r\n\tvoid\tsetScriptable\t\t(CKLBObjectScriptable* pScriptable);\r\n\r\n\tvirtual void setPriority\t(u32 renderPriority) {\r\n\t\tif (renderPriority != m_renderPrio) {\r\n\t\t\tm_renderPrio = renderPriority;\r\n\t\t\tCKLBNode::setPriority(m_renderPrio);\r\n\t\t\tif (m_currentAssetTree) {\r\n\t\t\t\tm_currentAssetTree->setPriority(m_renderPrio);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvirtual u32\tgetPriority\t\t() {\r\n\t\treturn m_renderPrio;\r\n\t}\r\n\r\n\tbool\tsendEvent\t\t\t(ACTION_TYPE type, u32 param);\t// Should be protected but access issue.\r\nprotected:\r\n\tvirtual void visibleSelf\t();\r\n\t\r\n\tvirtual void invisibleSelf  ();\r\n\t\r\n\tvoid\tresetAsset\t\t\t(CKLBAsset** ppOldAsset, CKLBNode** ppOldNode, CKLBAsset* newAsset);\r\n\r\n\tbool\tprocessListener\t\t(CKLBAction* pAction);\r\n\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\tvoid releaseAsset\t\t\t(CKLBAsset* pAsset);\r\n\tvoid switchTo\t\t\t\t(UI_STATE newState);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender\t\t();\r\n\tvirtual void removeRender\t();\r\n\r\n\tCKLBAsset*\t\t\tm_currentAsset;\r\n\tCKLBNode*\t\t\tm_currentAssetTree;\r\n\tCKLBActionHandler*\tm_pActionHandlerList;\r\n\r\n\tCKLBAsset*\t\t\tm_pNormal;\r\n\tCKLBNode*\t\t\tm_pNormalTree;\r\n\r\n\tCKLBAsset*\t\t\tm_pDisabled;\r\n\tCKLBNode*\t\t\tm_pDisabledTree;\r\n\r\n\tCKLBObjectScriptable*\r\n\t\t\t\t\t\tm_scriptable;\r\n\r\n\tu32\t\t\t\t\tm_renderPrio;\r\n\tu32\t\t\t\t\tm_listenerMask;\r\n\tUI_STATE\t\t\tm_UIState;\r\n\tbool\t\t\t\tm_bEnabled;\r\n\tbool\t\t\t\tm_bUpperEnabled;\r\n\tbool\t\t\t\tm_bDoRefCount;\r\n\tconst char*\t\t\tm_luaFunc;\t\t// callback Lua function\r\n\r\nprivate:\r\n\tCKLBAction\t\t\tm_localAction;\r\n};\r\n\r\nclass CKLBAudioAsset;\r\n\r\n/*!\r\n* \\class CKLBUISelectable\r\n* \\brief Selectable Node Class\r\n* \r\n* CKLBUISelectable represents a selectable item Node.\r\n* A STouchSurface is allocated for each CKLBUISelectable and represents the \r\n* screen area associated with the object.\r\n*/\r\nclass CKLBUISelectable : public CKLBUIElement {\r\n\tfriend class CKLBUIElement;\r\n\tfriend struct SFormCtrlList;\r\n\tfriend class CKLBUISystem;\r\npublic:\r\n\tCKLBUISelectable();\r\n\t~CKLBUISelectable();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t\t\t\t{ return CLS_KLBUISELECTABLE; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\t\t\r\n\tvoid\t\trecomputeCustom\t();\r\n\r\n\t// KLBUIElement::\r\n\tvirtual\r\n\tbool\tisSelectable\t\t()\t\t{ return true; }\r\n\tvirtual\r\n\tvoid\tsetEnabled\t\t\t(bool isEnabled);\r\n\tvirtual\r\n\tvoid\tsetAsset\t\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\r\n\tvoid\tsetAudio\t\t\t(CKLBAudioAsset* pAudioAsset, u32 mode, float volume, bool bOwner = false);\r\n\tvoid\tsetMultiplyVolume\t(u32 mode, float factorVolume);\r\n\r\n\tvirtual\r\n\tbool\tprocessAction\t\t(CKLBAction* pAction);\r\n\r\n\tbool\tinit\t\t\t\t(u32 priority);\r\n\r\n\t//\r\n\t// Define rectangle for reaction to touch screen.\r\n\t//\r\n\tvoid\tsetClickLeft\t\t(s32 coordinateX);\r\n\tvoid\tsetClickWidth\t\t(u32 width);\r\n\tvoid\tsetClickTop\t\t\t(s32 coordinateY);\r\n\tvoid\tsetClickHeight\t\t(u32 height);\r\n\r\n\tvoid\tsetModalResult\t\t(u32 modalResult);\r\n\r\n\t//\r\n\t//\tWhen clicked, stay down after release or up again (=Check box / down button)\r\n\t//\r\n\tvoid\tsetStick\t\t\t(bool isStickable);\r\n\tbool\tisStickable\t\t\t()\t\t\t\t{ return m_bStick;\t}\r\n\tvoid\tsetSticked\t\t\t(bool isSticked);\r\n\tbool\tisSticked\t\t\t()\t\t\t\t{ return m_bDown;\t}\r\n\r\n\t//\r\n\t//\tWhen clicked, all other stickable are modified / reset to unstick.\r\n\t// 0 : Not radio, 1..n : Radio ID.\r\n\tvoid\tsetRadio\t\t\t(u32 radioID);\r\n\tu32\t\tgetRadioID\t\t\t()\t\t\t\t{ return m_radioID; }\r\n\r\n\r\n\tbool\tsetLuaFunction(const char * funcname);\r\n\r\n\tinline\r\n\tCKLBUISelectable*\tgetNextSelectable() { return m_pNextSelectable; }\r\nprotected:\r\n\tvoid\tresetSticked\t\t(CKLBUIElement* pElement);\r\n\tvoid\tsetStickedRecurse\t(CKLBNode* pNode);\r\n\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\tCKLBUISelectable*\tm_pNextSelectable;\r\n\r\n\tCKLBAsset*\tm_pFocus;\r\n\tCKLBNode*\tm_pFocusTree;\r\n\tCKLBAsset*\tm_pPushed;\r\n\tCKLBNode*\tm_pPushedTree;\r\n\tCKLBAudioAsset*\tm_pDownAudio;\r\n\tCKLBAudioAsset* m_pUpAudio;\r\n\tfloat\t\tm_pDownVolumeOriginal;\r\n\tfloat\t\tm_pUpVolumeOriginal;\r\n    float       m_pDownVolumeFactor;\r\n    float       m_pUpVolumeFactor;\r\n\tfloat\t\tm_pDownVolume;\r\n\tfloat\t\tm_pUpVolume;\r\n\tbool\t\tm_bOwnerDownAudio;\r\n\tbool\t\tm_bOwnerUpAudio;\r\n\r\n\tu32\t\t\tm_modalResult;\r\n\tu32\t\t\tm_radioID;\r\npublic:\r\n\tu16\t\t\tm_groupID;\r\nprotected:\r\n\tSTouchSurface\tm_touchSurface;\r\n\r\n\tbool\tm_bStick;\t\t// Stay down even if current state is \"up\".\r\n\tbool\tm_bDown;\t\t// Current State.\r\n\tbool\tm_bLocked;\t\t// Used for canceling an event. (drag)\r\n\tint\t\tm_lastClick;\t// last click frameID\r\n\r\n\tvoid setStickedInternal(bool isSticked);\r\n};\r\n\r\nstruct SFormCtrlList {\r\n\tSFormCtrlList\t\t*\tnext;\r\n\tCKLBUISelectable\t*\tpBegin;\r\n\r\n\tvoid\t\t\t\t*\tpGroup;\t\t// Formが所属するグループのポインタ\r\n\tSFormCtrlList\t\t*\tpGrpPrev;\t// グループ内リンク用\r\n\tSFormCtrlList\t\t*\tpGrpNext;\t// グループ内リンク用\r\n\r\n\tbool\t\t\t\t\tbExclusive;\r\n\tbool\t\t\t\t\tbWorking;\r\n\tbool\t\t\t\t\tbEnable;\r\n\r\n\tSFormCtrlList(void)\r\n\t\t: next      (NULL)\r\n        , pBegin    (NULL)\r\n        , pGroup    (NULL)\r\n        , pGrpPrev  (NULL)\r\n        , pGrpNext  (NULL)\r\n        , bExclusive(false)\r\n        , bWorking  (false)\r\n        , bEnable   (false)\r\n\t{}\r\n\r\n\tCKLBDragCallbackIF\t*\tpCallbackIF;\r\n\tvoid (*nativeCallback)(void * pData, PAD_ITEM::TYPE type, int dragX, int dragY, int mvX, int mvY);\r\n\tCKLBObjectScriptable*\tpID;\r\n};\r\n\r\n/*!\r\n* \\class CKLBUIContainer\r\n* \\brief Container Node Class\r\n* \r\n* CKLBUIContainer allows to regroup sub items and manage them like one.\r\n*/\r\nclass CKLBUIContainer : public CKLBUIElement {\r\npublic:\r\n\tCKLBUIContainer ();\r\n\t~CKLBUIContainer();\r\n\r\n\tbool\tinit\t\t\t\t();\r\n\r\n\t// KLBObject::\r\n\tvirtual\r\n\tu32\t\tgetClassID\t\t\t()\t\t{ return CLS_KLBUICONTAINER; }\r\n\r\n\t// KLBUIElement::\r\n\tvirtual\r\n\tbool\tisContainer\t\t\t()\t\t{ return true; }\r\n\tvirtual\r\n\tvoid\tsetEnabled\t\t\t(bool isEnabled);\r\n\r\n\tCKLBUIElement* getChildUI\t(bool external = false);\r\n\r\n\tvoid\tsetViewOffsetX\t\t(s32 scrollX);\r\n\tvoid\tsetViewOffsetY\t\t(s32 scrollY);\r\n\r\n\tinline\r\n\ts32\t\tgetViewOffsetX\t\t() { return (s32)m_innerNode->m_matrix.m_matrix[4]; }\r\n\tinline\r\n\ts32\t\tgetViewOffsetY\t\t() { return (s32)m_innerNode->m_matrix.m_matrix[5]; }\r\n\r\n\t//\r\n\t// Allow to connect sub UI component to the container.\r\n\t//\r\n\tvoid\taddElement\t\t\t(CKLBUIElement*\tpElement, bool external = false);\r\n\tvoid\tremoveElement\t\t(CKLBUIElement* pElement, bool external = false);\r\n\r\n\t//\r\n\t// Allow to find the active radio button inside the container.\r\n\t//\r\n\tu32\t\tgetRadioValue\t\t();\r\n\r\n\tvoid\tshowModal\t\t\t(CKLBNode* pNode);\r\n\r\n\tinline\r\n\tCKLBNode*\tgetInnerNode\t()\t{ return m_innerNode; }\r\n\r\n\tinline\r\n\tvoid\t\tsetClipHandle\t(void* clipHandle) { m_clipHandle = clipHandle; }\r\n\r\nprotected:\r\n\tvirtual \r\n    void        setUpperEnabled (bool isEnabled);\r\n\tu32\t\t\tgetRadioValueRecurse\t(CKLBNode* pNode);\r\n\r\nprivate:\r\n\tCKLBNode*\tm_innerNode;\r\n\tCKLBNode*\tm_outerNode;\r\n\tvoid*\t\tm_clipHandle;\r\n\r\n\tu32\t\t\tm_viewPortWidth;\r\n\tu32\t\t\tm_viewPortHeight;\r\n\ts32\t\t\tm_viewScrollX;\r\n\ts32\t\t\tm_viewScrollY;\r\n\tbool\t\tm_bAsModal;\t// Just to avoid compile error.\r\npublic:\r\n\tbool\t\tisModal() { return m_bAsModal; }\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUITextInput.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUITextInput.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBUtility.h\"\r\n;\r\nenum {\r\n\tUI_TEXTBOX_SETTEXT,\r\n\tUI_TEXTBOX_GETTEXT,\r\n    UI_TEXTBOX_SETPLACEHOLDER,\r\n    UI_TEXTBOX_SETCOLOR,\r\n    UI_TEXTBOX_SETFONT,\r\n    UI_TEXTBOX_SETMAXLEN,\r\n\tUI_TEXTBOX_GETMAXLEN,\r\n    UI_TEXTBOX_SETCHARTYPE,\r\n\tUI_TEXTBOX_GETCHARCOUNT,\r\n    UI_TEXTBOX_SETALIGN\r\n};\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_TEXTBOX_SETTEXT\",          UI_TEXTBOX_SETTEXT },\r\n\t{\"UI_TEXTBOX_GETTEXT\",          UI_TEXTBOX_GETTEXT },\r\n    {\"UI_TEXTBOX_SETPLACEHOLDER\",   UI_TEXTBOX_SETPLACEHOLDER },\r\n    {\"UI_TEXTBOX_SETCOLOR\",         UI_TEXTBOX_SETCOLOR },\r\n    {\"UI_TEXTBOX_SETFONT\",          UI_TEXTBOX_SETFONT },\r\n    {\"UI_TEXTBOX_SETMAXLEN\",        UI_TEXTBOX_SETMAXLEN },\r\n\t{\"UI_TEXTBOX_GETMAXLEN\",\t\tUI_TEXTBOX_GETMAXLEN },\r\n    {\"UI_TEXTBOX_SETCHARTYPE\",      UI_TEXTBOX_SETCHARTYPE },\r\n\t{\"UI_TEXTBOX_GETCHARCOUNT\",\t\tUI_TEXTBOX_GETCHARCOUNT },\r\n\t{\"UI_TEXTBOX_SETALIGN\",         UI_TEXTBOX_SETALIGN },\r\n    \r\n    {\"TXCH_7BIT_ASCII\",             IWidget::TXCH_7BIT_ASCII },\r\n    {\"TXCH_UTF8\",                   IWidget::TXCH_UTF8 },\r\n    \r\n    {\"TX_ALIGN_LEFT\",               IWidget::TX_ALIGN_LEFT },\r\n    {\"TX_ALIGN_CENTER\",             IWidget::TX_ALIGN_CENTER },\r\n    {\"TX_ALIGN_RIGHT\",              IWidget::TX_ALIGN_RIGHT },\r\n    \r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUITextInput> factory(\"UI_TextInput\", CLS_KLBUITEXTINPUT, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUITextInput::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"width\",\tUINTEGER,\t(setBoolT)&CKLBUITextInput::setWidth,\t(getBoolT)&CKLBUITextInput::getWidth,\t0\t},\r\n\t{\t\"height\",\tUINTEGER,\t(setBoolT)&CKLBUITextInput::setHeight,\t(getBoolT)&CKLBUITextInput::getHeight,\t0\t},\r\n\t{\t\"value\",\tSTRING,\t\t(setBoolT)&CKLBUITextInput::setText,\t(getBoolT)&CKLBUITextInput::getText,\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_MODE,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\r\n\tARG_VALUE,\r\n\r\n\tARG_CALLBACK,\r\n\tARG_ID,\r\n\tARG_MAXLEN,\r\n    ARG_CHARTYPE,\r\n\r\n\tARG_REQUIRE = ARG_HEIGHT,\r\n\tARG_NUMS    = ARG_CHARTYPE\r\n};\r\n\r\n\r\nCKLBUITextInput::CKLBUITextInput() \r\n: CKLBUITask()\r\n, m_pTextBox(NULL)\r\n, m_text    (NULL) \r\n, m_width   (0)\r\n, m_height  (0)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUITextInput::~CKLBUITextInput() \r\n{\r\n\tKLBDELETEA(m_text);\r\n}\r\n\r\nu32\r\nCKLBUITextInput::getClassID()\r\n{\r\n\treturn CLS_KLBUITEXTINPUT;\r\n}\r\n\r\n\r\nCKLBUITextInput *\r\nCKLBUITextInput::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                        bool passwdmode,\r\n                        float x, float y, float width, float height,\r\n                        const char * default_text,\r\n                        const char * on_change_callback,\r\n                        int widget_id, int maxlen, u32 chartype)\r\n{\r\n\tCKLBUITextInput * pTask = KLBNEW(CKLBUITextInput);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, passwdmode,\r\n\t\t\t\t\tx, y, width, height,\r\n\t\t\t\t\tdefault_text,\r\n\t\t\t\t\ton_change_callback, widget_id, maxlen, chartype)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\n\t\r\nbool\r\nCKLBUITextInput::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                      bool passwdmode,\r\n                      float x, float y, float width, float height,\r\n                      const char * default_text,\r\n                      const char * on_change_callback,\r\n                      int widget_id, int maxlen, u32 chartype)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(passwdmode,\r\n\t\t\t\t\t\t\tx, y, width, height,\r\n\t\t\t\t\t\t\tdefault_text,\r\n\t\t\t\t\t\t\ton_change_callback,\r\n\t\t\t\t\t\t\twidget_id, maxlen, chartype);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUITextInput::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tbool passwdmode = lua.getBool(ARG_MODE);\r\n\tfloat width     = lua.getFloat(ARG_WIDTH);\r\n\tfloat height    = lua.getFloat(ARG_HEIGHT);\r\n\tconst char * default_text       = (argc >= ARG_VALUE) ? lua.getString(ARG_VALUE) : \"\";\r\n\tconst char * on_change_callback = (argc >= ARG_CALLBACK && !lua.isNil(ARG_CALLBACK)) ? lua.getString(ARG_CALLBACK) : NULL;\r\n\tint widget_id   = (argc >= ARG_ID)       ? lua.getInt(ARG_ID)       : 0;\r\n\tint maxlen      = (argc >= ARG_MAXLEN)   ? lua.getInt(ARG_MAXLEN)   : 0;\r\n    int chartype    = (argc >= ARG_CHARTYPE) ? lua.getInt(ARG_CHARTYPE) : (IWidget::TXCH_7BIT_ASCII|IWidget::TXCH_UTF8);\r\n\treturn initCore(passwdmode, x, y, width, height, default_text, on_change_callback, widget_id, maxlen, chartype);\r\n}\r\n\r\nbool\r\nCKLBUITextInput::initCore(bool passwdmode,\r\n                          float x, float y, float width, float height,\r\n                          const char * default_text,\r\n                          const char * on_change_callback,\r\n                          int widget_id, int maxlen, u32 chartype)\r\n{\r\n\tif (!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\tsetInitPos(x, y);\r\n\r\n\tm_ID        = widget_id;\r\n\tm_callback  = (on_change_callback) ? CKLBUtility::copyString(on_change_callback) : NULL;\r\n\r\n\tm_pTextBox  = KLBNEWC( CKLBUITextBox,(passwdmode, maxlen));\r\n\r\n\tgetNode()->addNode(m_pTextBox);\r\n\tsetWidth(width);\r\n\tsetHeight(height);\r\n\tsetText(default_text);\r\n    setCharType(chartype);\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUITextInput::execute(u32 /* deltaT */)\r\n{\r\n\tconst char * text = m_pTextBox->getText();\r\n\tbool bChange;\r\n\tif ((text && !m_text) || (!text && m_text)) {\r\n\t\tbChange = true;\r\n\t} else {\r\n\t\tif (text && m_text) {\r\n\t\t\tbChange = strcmp(text, m_text) ? true : false;\r\n\t\t} else {\r\n\t\t\tbChange = false;\r\n\t\t}\r\n\t}\r\n\tsetStrC(m_text, text);\r\n\r\n\tif(m_callback && bChange) {\r\n\t\tCKLBScriptEnv::getInstance().call_textInput(m_callback, this, m_text, m_ID);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUITextInput::dieUI()\r\n{\r\n\tKLBDELETEA(m_callback);\r\n\tKLBDELETE(m_pTextBox);\r\n}\r\n\r\nint\r\nCKLBUITextInput::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_TEXTBOX_SETTEXT:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * string = lua.getString(3);\r\n\t\t\tsetText(string);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_TEXTBOX_GETTEXT:\r\n\t\t{\r\n\t\t\tif(argc != 2) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * string = getText();\r\n\t\t\tlua.retString(string);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_TEXTBOX_GETCHARCOUNT:\r\n\t\t{\r\n\t\t\tif(argc != 2) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\ts32 count = getCharCount();\r\n\t\t\tlua.retInt(count);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n    case UI_TEXTBOX_SETPLACEHOLDER:\r\n        {\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * string = lua.getString(3);\r\n\t\t\tsetPlaceHolder(string);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n        }\r\n        break;\r\n    case UI_TEXTBOX_SETCOLOR:\r\n        {\r\n\t\t\tif(argc != 5) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n            bool bTouch = lua.getBool(3);\r\n            u32  fg_rgb = lua.getInt(4);\r\n            u32  bg_rgb = lua.getInt(5);\r\n\r\n\t\t\tsetColor(bTouch, fg_rgb, bg_rgb);\r\n\t\t\t\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;            \r\n        }\r\n        break;\r\n    case UI_TEXTBOX_SETFONT:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 4) {\r\n                const char * fontname = (!lua.isNil(3)) ? lua.getString(3) : NULL;\r\n                float fontsize = lua.getFloat(4);\r\n                \r\n                setFont(fontname, fontsize);\r\n                bResult = true;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n        break;\r\n    case UI_TEXTBOX_SETMAXLEN:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 3) {\r\n                int maxlen = lua.getInt(3);\r\n                setMaxLen(maxlen);\r\n                bResult = true;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n        break;\r\n\tcase UI_TEXTBOX_GETMAXLEN:\r\n\t\t{\r\n\t\t\tret = 1;\r\n            if(argc != 2) {\r\n\t            lua.retBool(false);\r\n            } else {\r\n\t\t\t\tlua.retInt(getMaxLen());\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n    case UI_TEXTBOX_SETCHARTYPE:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 3) {\r\n                int chartype = lua.getInt(3);\r\n                setCharType((IWidget::TEXTCHARTYPE)chartype);\r\n                bResult = true;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n        break;\r\n    case UI_TEXTBOX_SETALIGN:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 3)\r\n            {\r\n                int alignType = lua.getInt(3);\r\n                setAlign(alignType);\r\n                bResult = true;\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n        break;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUITextInput.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUITextBox_h\r\n#define CKLBUITextBox_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBTextInputNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUITextInput\r\n* \\brief Text Input Task Class\r\n* \r\n* CKLBUITextInput is a UITask managing text inputs.\r\n* In addition to providing desing and display APIs, it also provides some control ones \r\n* such as a maximum length control.\r\n*/\r\nclass CKLBUITextInput : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUITextInput>;\r\nprivate:\r\n\tCKLBUITextInput();\r\n\tvirtual ~CKLBUITextInput();\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tstatic CKLBUITextInput * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\tbool passwdmode,\r\n\t\t\t\t\t\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t\tconst char * default_text,\r\n\t\t\t\t\t\t\t\t\tconst char * on_change_callback,\r\n\t\t\t\t\t\t\t\t\tint widget_id, int maxlen, u32 chartype);\r\n\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getWidth()\t\t\t\t\t{ return m_width;\t}\r\n\tinline void setWidth(u32 width)\t\t\t{\r\n\t\t// m_widthは変更なしだが、textBoxのwidthが初期値の場合があるためどちらもみるように変更  2013/03/25   //\r\n\t\tif (m_width != width || m_pTextBox->getWidth() != width) {\r\n\t\t\tm_width = width;\r\n\t\t\tm_pTextBox->setWidth(width);\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32 getHeight()\t\t\t\t\t{ return m_height;\t}\r\n\tinline void setHeight(u32 height)\t\t{\r\n\t\t// m_heightは変更なしだが、textBoxのheightが初期値の場合があるためどちらもみるように変更  2013/03/25   //\r\n\t\tif (m_height != height || m_pTextBox->getHeight() != height) {\r\n\t\t\tm_height = height;\r\n\t\t\tm_pTextBox->setHeight(height);\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getText()\t\t\t        { return m_pTextBox->getText();\t\t}\r\n\tinline void         setText(const char* text)\t{\r\n\t\tsetStrC(m_text, text);\r\n\t\tm_pTextBox->setText(text);\r\n\t}\r\n\r\n\tinline void setPlaceHolder(const char * placeholder) { m_pTextBox->setPlaceHolder(placeholder); }\r\n\r\n\tinline int\tgetMaxLen()\t\t\t\t\t{ return m_pTextBox->getMaxlen();\t}\r\n\tinline void setMaxLen(int maxLen)\t\t{ m_pTextBox->setMaxlen(maxLen);\t}\r\n\r\n\tinline void setCharType(u32 charType)\t{ m_pTextBox->setCharType((IWidget::TEXTCHARTYPE)charType); }\r\n\r\n\tinline s32\tgetCharCount()\t\t\t\t{ return CKLBUtility::charCountUtf8(m_pTextBox->getText()); }\r\n\r\n\tinline void setColor(bool bTouch, u32 fg_rgb, u32 bg_rgb) {\r\n\t\tfg_rgb |= 0xff000000;\r\n        bg_rgb |= 0xff000000;\r\n\t\tm_pTextBox->setColor(bTouch, fg_rgb, bg_rgb);\r\n\t}\r\n\r\n\tinline void setFont(const char* fontName, float fontSize) { m_pTextBox->setFont(fontName, fontSize); }\r\n    \r\n    inline void setAlign(int _alignType) { if(!m_pTextBox) return; m_pTextBox->setAlign((IWidget::TEXTALIGNMENTTYPE)_alignType); }\r\n\r\nprivate:\r\n\tbool init(  CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tbool passwdmode,\r\n\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\tconst char * default_text,\r\n\t\t\t\tconst char * on_change_callback,\r\n\t\t\t\tint widget_id, int maxlen, u32 chartype);\r\n\r\n\tbool initCore(\tbool passwdmode,\r\n\t\t\t\t\tfloat x, float y, float width, float height,\r\n\t\t\t\t\tconst char * default_text,\r\n\t\t\t\t\tconst char * on_change_callback,\r\n\t\t\t\t\tint widget_id, int maxlen, u32 chartype);\r\n\r\n\tconst char*\t\t\tm_text;\r\n\tCKLBUITextBox\t*\tm_pTextBox;\r\n\tconst char\t\t*\tm_callback;\r\n\tu32\t\t\t\t\tm_width;\r\n\tu32\t\t\t\t\tm_height;\r\n\tint\t\t\t\t\tm_ID;\r\n\r\n\tstatic\tPROP_V2\t\tms_propItems[];\r\n};\r\n\r\n#endif // CKLBUITextBox_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUITouchPad.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUITouchPad.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n\r\n;\r\nenum {\r\n\tUI_TOUCHPAD_SET_GROUP,\r\n\tUI_TOUCHPAD_LOCK,\r\n\tUI_TOUCHPAD_GET_ALL,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_TOUCHPAD_SET_GROUP\",\tUI_TOUCHPAD_SET_GROUP },\r\n\t{ \"UI_TOUCHPAD_LOCK\",\t\tUI_TOUCHPAD_LOCK },\r\n\t{ \"UI_TOUCHPAD_GET_ALL\",\tUI_TOUCHPAD_GET_ALL },\r\n\r\n\t{ \"PAD_ITEM_TAP\",       PAD_ITEM::TAP },\r\n\t{ \"PAD_ITEM_DRAG\",      PAD_ITEM::DRAG },\r\n\t{ \"PAD_ITEM_RELEASE\",\tPAD_ITEM::RELEASE },\r\n\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUITouchPad> factory(\"UI_TouchPad\", CLS_KLBUITOUCHPAD, cmd);\r\n\r\nenum {\r\n\tARG_CALLBACK = 1,\r\n\tARG_MODAL,\r\n\r\n\tARG_REQUIRE = ARG_CALLBACK,\r\n\tARG_NUMS = ARG_MODAL\r\n};\r\n\r\nCKLBUITouchPad::CKLBUITouchPad() \r\n: CKLBLuaTask   ()\r\n, m_luaFunc     (NULL)\r\n, m_bAll        (false) \r\n{\r\n}\r\n\r\nCKLBUITouchPad::~CKLBUITouchPad() \r\n{\r\n}\r\n\r\nu32\r\nCKLBUITouchPad::getClassID()\r\n{\r\n\treturn CLS_KLBUITOUCHPAD;\r\n}\r\n\r\nCKLBUITouchPad* \r\nCKLBUITouchPad::create(CKLBTask* pParentTask, const char * funcName, bool modal) \r\n{\r\n\tCKLBUITouchPad* pTask = KLBNEW(CKLBUITouchPad);\r\n    if(!pTask) { return NULL; }\r\n\r\n\tif(!pTask->init(pParentTask, funcName, modal)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool \r\nCKLBUITouchPad::init(CKLBTask* pTask, const char* funcname, bool modal) \r\n{\r\n\tif(funcname) setStrC(m_luaFunc, funcname);\r\n\tm_modal = modal;\r\n\r\n\tm_ctrlList.pGroup           = NULL;\r\n\tm_ctrlList.pGrpPrev         = NULL;\r\n\tm_ctrlList.pGrpNext         = NULL;\r\n\r\n\tm_ctrlList.pBegin           = NULL;\r\n\tm_ctrlList.next             = NULL;\r\n\tm_ctrlList.bEnable          = true;\r\n\tm_ctrlList.bExclusive       = false;\r\n\tm_ctrlList.bWorking         = false;\r\n\tm_ctrlList.pCallbackIF      = NULL;\r\n\tm_ctrlList.nativeCallback   = NULL;\r\n\tm_ctrlList.pID              = NULL;\r\n\r\n\tif(m_modal) {\r\n\t\tm_modalStack.setModal(false);\r\n\t\tm_modalStack.push();\t// modal stack に積む\r\n\t}\r\n    bool result = regist(pTask, P_AFTER);\r\n    if(!result) {\r\n        KLBDELETEA(m_luaFunc);\r\n    }\r\n\r\n\tm_execount = 0;\r\n    return true;\r\n}\r\n\r\nbool\r\nCKLBUITouchPad::initScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }\r\n\r\n\tconst char * funcname = lua.getString(ARG_CALLBACK);\r\n\tbool modal = (argc >= ARG_MODAL) ? lua.getBool(ARG_MODAL) : false;\r\n\r\n\treturn init(NULL, funcname, modal);\r\n}\r\n\r\nvoid\r\nCKLBUITouchPad::execute(u32 /*deltaT*/)\r\n{\r\n\tm_execount++;\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\r\n\tbool bEnable = (m_modal) ? m_modalStack.isEnable() : true;\r\n\tbEnable = bEnable && !fGrp.isWorking(&m_ctrlList, this);\t// locker 指定により、自分以外のロックのみを見る\r\n\r\n\t// モーダル状態と、グループによる排他制御状態で反応を返すべきか判断する\r\n    if(!bEnable) { return; }    // どちらかにより無効にされていたら処理しない。\r\n\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\r\n\ttpq.startItem();\r\n\r\n\tconst PAD_ITEM * item = tpq.getItem(m_bAll);\r\n    if(!item) { return; }       // そのフレームには通知すべきイベントがない\r\n\r\n\t// IPlatformRequest& platform = CPFInterface::getInstance().platform();\r\n\r\n\t// platform.logging(\"TP[%d]\", m_execount);\r\n\r\n#if defined(__CSHARP_VERSION__) || defined(__CPP_VERSION__)\r\n\tdo {\r\n\t\tCKLBScriptEnv::getInstance().call_touchPadCSharp(this, m_execount,item->type, item->id, item->x, item->y);\r\n\t\titem = tpq.getItem(m_bAll);\r\n\t} while(item);\r\n#else\r\n\t// 通知すべきイベントがあるので、Lua配列を生成する。\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\tCLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n\tlua.retGlobal(m_luaFunc);\r\n\tlua.tableNew();\r\n\r\n\tint index = 1;\r\n\tdo {\r\n\t\t// platform.logging(\"type[%d] id[%d] x[%d] y[%d]\", item->type, item->id, item->x, item->y);\r\n\r\n\t\tlua.retInt(index);\r\n\r\n\t\tlua.tableNew();\r\n\r\n\t\tlua.retString(\"type\");\r\n\t\tlua.retInt(item->type);\r\n\t\tlua.tableSet();\r\n\r\n\t\tlua.retString(\"id\");\r\n\t\tlua.retInt(item->id);\r\n\t\tlua.tableSet();\r\n\r\n\t\tlua.retString(\"x\");\r\n\t\tlua.retDouble(item->x);\r\n\t\tlua.tableSet();\r\n\r\n\t\tlua.retString(\"y\");\r\n\t\tlua.retDouble(item->y);\r\n\t\tlua.tableSet();\r\n\r\n\t\tlua.tableSet();\r\n\r\n\t\tindex++;\r\n\t\titem = tpq.getItem(m_bAll);\r\n\t} while(item);\r\n\r\n\t// 引数とすべき値は、すでにLuaスタックに積まれている。\r\n\tCKLBScriptEnv::getInstance().call_touchPad(m_luaFunc, this);\r\n#endif\r\n}\r\n\r\nvoid\r\nCKLBUITouchPad::die()\r\n{\r\n\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\tfGrp.delForm(&m_ctrlList);\r\n\r\n    if(m_modal) { m_modalStack.remove(); }\r\n\r\n\tKLBDELETEA(m_luaFunc);\r\n}\r\n\r\nint\r\nCKLBUITouchPad::commandScript(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < 2) {\r\n\t\tlua.retBool(false);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\tint cmd = lua.getInt(2);\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBool(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_TOUCHPAD_SET_GROUP:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * group_name = lua.getString(3);\r\n\t\t\t\tresult = setGroup(group_name);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_TOUCHPAD_LOCK:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tbool lock_mode = lua.getBool(3);\r\n\t\t\t\tlock(lock_mode);\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_TOUCHPAD_GET_ALL:\r\n\t\t{\r\n\t\t\tbool result = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tsetGetAll(lua.getBool(3));\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(result);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUITouchPad.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUITouchPad_h\r\n#define CKLBUITouchPad_h\r\n\r\n#include \"CKLBLuaTask.h\"\r\n#include \"CKLBUISystem.h\"\r\n#include \"CKLBFormGroup.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\n/*!\r\n* \\class CKLBUITouchPad\r\n* \\brief UI Touch Pad Task class.\r\n* \r\n* CKLBUITouchPad is a simple low level Touch Pad Events handler.\r\n* It provides a few callbacks that are called when some actions are processed\r\n* (Only Tap, Drag and Release).\r\n* For a higher level Touch Pad Events handling, see UIControl.\r\n*/\r\nclass CKLBUITouchPad : public CKLBLuaTask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUITouchPad>;\r\nprotected:\r\n\tCKLBUITouchPad();\r\n\tvirtual ~CKLBUITouchPad();\r\n\r\npublic:\r\n\tstatic CKLBUITouchPad* create(CKLBTask* pParentTask, const char * funcName, bool modal);\r\n\tbool init(CKLBTask* pTask, const char* funcName, bool modal);\r\n\r\n\tbool    initScript      (CLuaState& lua);\r\n\tint     commandScript   (CLuaState& lua);\r\n\r\n\tinline bool setGroup    (const char* group_name) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\treturn fGrp.addForm(&m_ctrlList, group_name);\r\n\t}\r\n\r\n\tinline void lock        (bool lock_mode) {\r\n\t\tCKLBFormGroup& fGrp = CKLBFormGroup::getInstance();\r\n\t\tfGrp.setWorking(&m_ctrlList, lock_mode, this);\t// locker を指定することで、自分がかけたlockは無視できる\r\n\t}\r\n\r\n\tinline void setGetAll   (bool b) { m_bAll = b; }\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid die    ();\r\n\r\n    u32 getClassID();\r\n\r\nprivate:\r\n\tconst char *        m_luaFunc;\r\n\r\n\t// グループ化用\r\n\tSFormCtrlList\t\tm_ctrlList;\r\n\tCKLBModalStack\t\tm_modalStack;\r\n\r\n\tbool\t\t\t\tm_modal;\r\n\tbool\t\t\t\tm_bAll;\r\n\r\n\tint m_execount;\r\n};\r\n\r\n#endif // CKLBUITouchPad_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIVariableItem.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIVariableItem.h\"\r\n\r\n#include \"CKLBDataHandler.h\"\r\n#include \"CKLBUtility.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n\r\n// ƒRƒ}ƒ“ƒh’l\r\nenum {\r\n\tUI_VARITEM_CHANGE_ASSET = 0,\t// 頂点位置を指定\r\n\tUI_VARITEM_SET_UV,\t\t\t\t// UV値を画像内ピクセル位置とピクセルサイズで指定する\r\n\tUI_VARITEM_RESET_UV,\t\t\t// UV値をデフォルトに戻す\r\n\tUI_VARITEM_SET_MASK,\t\t\t// Assign a Mask to multivar item.\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_VARITEM_CHANGE_ASSET\",\tUI_VARITEM_CHANGE_ASSET },\r\n\t{ \"UI_VARITEM_SET_UV\",\t\t\tUI_VARITEM_SET_UV       },\r\n\t{ \"UI_VARITEM_RESET_UV\",\t\tUI_VARITEM_RESET_UV     },\r\n\t{ \"UI_VARITEM_SET_MASK\",\t\tUI_VARITEM_SET_MASK     },\r\n\t{ 0, 0}\r\n};\r\nstatic CKLBTaskFactory<CKLBUIVariableItem> factory(\"UI_VariableItem\", CLS_KLBUIVARIABLEITEM,cmd);\r\n\r\nCKLBUIVariableItem::CKLBUIVariableItem()\r\n: CKLBUITask\t()\r\n, m_handle\t\t(0)\r\n, m_pTex\t\t(NULL)\r\n, m_asset\t\t(NULL)\r\n, m_pMaskTex\t(NULL)\r\n, m_pDynSprite\t(NULL)\r\n, m_Maskhandle\t(0)\r\n, m_org_height\t(0.0f)\r\n, m_org_width\t(0.0f)\r\n{\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIVariableItem::~CKLBUIVariableItem() \r\n{\r\n}\r\n\r\nu32 CKLBUIVariableItem::getClassID() \r\n{\r\n\treturn CLS_KLBUIVARIABLEITEM;\r\n}\r\n\r\n// 持たせるプロパティキー\r\nCKLBLuaPropTask::PROP_V2 CKLBUIVariableItem::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\tUINTEGER,\t(setBoolT)&CKLBUIVariableItem::setOrder,\t(getBoolT)&CKLBUIVariableItem::getOrder,\t0 },\r\n\t{\t\"asset\",\tSTRING,\t\t(setBoolT)&CKLBUIVariableItem::changeAsset,\t(getBoolT)&CKLBUIVariableItem::getAsset,\t0 },\r\n\t{\t\"width\",\tNUMERIC,\t(setBoolT)&CKLBUIVariableItem::setWidth,\t(getBoolT)&CKLBUIVariableItem::getWidth,\t0 },\r\n\t{\t\"height\",\tNUMERIC,\t(setBoolT)&CKLBUIVariableItem::setHeight,\t(getBoolT)&CKLBUIVariableItem::getHeight,\t0 }\r\n};\r\n\r\nenum PROP_ID{\r\n\tPR_ORDER,\r\n\tPR_ASSET,\r\n\tPR_WIDTH,\r\n\tPR_HEIGHT,\r\n};\r\n\r\n// 引数のインデックス定義\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\tARG_ASSET,\r\n\r\n\tARG_REQUIRE = ARG_ASSET,\r\n};\r\n\r\n\r\nCKLBUIVariableItem *\r\nCKLBUIVariableItem::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                           u32 order, float x, float y, float width, float height,\r\n                           const char * asset)\r\n{\r\n\tCKLBUIVariableItem * pTask = KLBNEW(CKLBUIVariableItem);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode,\r\n\t\t\t\t\torder, x, y, width, height,\r\n\t\t\t\t\tasset)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIVariableItem::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t const char * asset)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y, width, height, asset);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIVariableItem::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE) return false;\r\n\r\n\t// 基本プロパティの取り込み\r\n\tu32 order       = lua.getInt(ARG_ORDER);\r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tfloat width     = lua.getFloat(ARG_WIDTH);\r\n\tfloat height    = lua.getFloat(ARG_HEIGHT);\r\n\tconst char * asset = (lua.isNil(ARG_ASSET)) ? NULL : lua.getString(ARG_ASSET);\r\n\r\n\treturn initCore(order, x, y, width, height, asset);\r\n}\r\n\r\nbool\r\nCKLBUIVariableItem::initCore(u32 order, float x, float y, float width, float height, const char * asset)\r\n{\r\n\t// 対応するプロパティリストを規定する。\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// 読み込んだ頂点データと、座標値、orderで表示物を用意する。\r\n\tCKLBRenderingManager& pRdrMgr = CKLBRenderingManager::getInstance();\r\n\r\n\t// 基本プロパティの取り込み\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order     = order;\r\n\tm_width     = width;\r\n\tm_height    = height;\r\n\r\n\tm_pDynSprite = pRdrMgr.allocateCommandDynSprite(8, 12);\r\n\r\n\tif(!m_pDynSprite) {\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tm_pNode = KLBNEW(CKLBNode);\r\n\r\n\t// 初期assetを設定する\r\n\tsetAsset(asset);\r\n\r\n\tm_pNode->setRender(m_pDynSprite);\r\n\r\n\tm_pNode->setRenderOnDestroy(true);\r\n\tgetNode()->addNode(m_pNode);\r\n\r\n\tm_pNode->setTranslate(0, 0);\r\n\tm_pNode->setPriority(order);\r\n\r\n\treturn true;\r\n}\r\n\r\nbool\r\nCKLBUIVariableItem::setAsset(const char * asset)\r\n{\r\n\tu32 handle = 0;\r\n\tCKLBImageAsset * pTex = NULL;\r\n\tif(asset) {\r\n\t\tpTex = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset, &handle);\r\n\t}\r\n\tbool ret;\r\n\r\n\tif(!pTex) {\r\n\t\tm_pDynSprite->setVICount(4,6); // Default no display.\r\n\t\tu16* pIdxBuff = m_pDynSprite->getSrcIndexBuffer();\r\n\r\n\t\tpIdxBuff[0] = 0;\r\n\t\tpIdxBuff[1] = 1;\r\n\t\tpIdxBuff[2] = 3;\r\n\t\tpIdxBuff[3] = 1;\r\n\t\tpIdxBuff[4] = 2;\r\n\t\tpIdxBuff[5] = 3;\r\n\r\n\t\tret = false;\r\n\t} else {\r\n\t\tm_pDynSprite->setVICount(pTex->getVertexCount(),pTex->getIndexCount());\r\n\t\tu16* pIdxBuff = m_pDynSprite->getSrcIndexBuffer();\r\n\t\tu16* pSrcIdx  = pTex->getIndexBuffer();\r\n\t\tfor(u32 n = 0; n < pTex->getIndexCount(); n++) {\r\n\t\t\tpIdxBuff[n] = pSrcIdx[n];\r\n\t\t}\r\n\r\n\t\t// 今回ロードしたassetを設定する\r\n\t\tgetUV(pTex);\r\n\t\tgetSize(pTex);\r\n\r\n\t\tm_pDynSprite->setTexture(pTex);\r\n\r\n\t\tm_pNode->markUpMatrixAndColor();\r\n\t\t// 以前にロードしたassetは破棄する\r\n\t\tif(m_pTex && m_handle) {\r\n\t\t\tCKLBDataHandler::releaseHandle(m_handle);\r\n\t\t\tKLBDELETEA(m_asset);\r\n\t\t}\r\n\t\t// 今回ロードしたassetを保持する\r\n\t\tm_pTex   = pTex;\r\n\t\tm_handle = handle;\r\n\t\tm_asset  = CKLBUtility::copyString(asset);\r\n\t\tsetStrC(m_asset, (asset) ? asset : \"\");\r\n\r\n\t\tSKLBRect * pRect = pTex->getSize();\r\n\r\n\t\tm_org_width  = pRect->getWidth();\r\n\t\tm_org_height = pRect->getHeight();\r\n\t\tret = true;\r\n\t}\r\n\r\n\t// 指定サイズから頂点データを生成する\r\n\tcreateArrVert(m_width, m_height);\r\n\tm_pDynSprite->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY | FLAG_BUFFERSHIFT);\r\n\r\n\treturn ret;\r\n}\r\n\r\nbool\r\nCKLBUIVariableItem::setMaskAsset(const char* asset) {\r\n\t// 以前にロードしたassetは破棄する\r\n\tif(m_pMaskTex && m_Maskhandle) {\r\n\t\tCKLBDataHandler::releaseHandle(m_Maskhandle);\r\n\t}\r\n\r\n\tu32 handle = 0;\r\n\tCKLBImageAsset * pTex = NULL;\r\n\tif(asset) {\r\n\t\tpTex = (CKLBImageAsset *)CKLBUtility::loadAssetScript(asset, &handle);\r\n\t\tif(!pTex) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t} else {\r\n\t\tpTex = NULL;\r\n\t}\r\n\r\n\tif(m_pDynSprite) {\r\n\t\tm_pDynSprite->setMask(pTex);\r\n\t}\r\n\r\n\t// 今回ロードしたassetを保持する\r\n\tm_pMaskTex   = pTex;\r\n\tm_Maskhandle = handle;\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIVariableItem::getUV(CKLBImageAsset * pTex)\r\n{\r\n\t// klb_assert(pTex->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in VariableItem task.\");\r\n\tfloat* pBuffUV = pTex->getUVBuffer();\r\n\tfor(u32 i = 0; i < pTex->getVertexCount(); i++) {\r\n\t\tm_pDynSprite->setVertexUV(i, pBuffUV[i*2], pBuffUV[i*2+1]); \r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIVariableItem::getSize(CKLBImageAsset * pTex)\r\n{\r\n\t// klb_assert(pTex->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in VariableItem task.\");\r\n\tSKLBRect * pRect = pTex->getSize();\r\n\tm_org_width = pRect->getWidth();\r\n\tm_org_height = pRect->getHeight();\r\n}\r\n\r\n#include \"CKLBDrawTask.h\"\r\n\r\nvoid\r\nCKLBUIVariableItem::createArrVert(float width, float height)\r\n{\r\n\tbool originalSize = (width == -1 && height == -1);\r\n\t\r\n\tfloat ratioX;\r\n\tfloat ratioY;\r\n\tif(originalSize) {\r\n\t\tratioX = 1.0f;\r\n\t\tratioY = 1.0f;\r\n\t} else {\r\n\t\tratioX = width / m_org_width;\r\n\t\tratioY = height/ m_org_height;\r\n\t}\r\n\r\n\tif(m_pTex) {\r\n\t\tfloat* vertex = m_pTex->getXYBuffer();\r\n\t\tfloat  cx\t  = m_pTex->m_iCenterX;\r\n\t\tfloat  cy\t  = m_pTex->m_iCenterY;\r\n\r\n\t\t// Keep original vertex information alive.\r\n\t\tfor(u32 n = 0; n < m_pTex->getVertexCount(); n++) {\r\n\t\t\tfloat x = (*vertex++ + cx) * ratioX;\r\n\t\t\tfloat y = (*vertex++ + cy) * ratioY;\r\n\t\t\tm_pDynSprite->setVertexXY(n, x , y);\r\n\t\t\tm_pDynSprite->setVertexColor(m_pNode,n,0xffffffff);\r\n\t\t}\r\n\t} else {\r\n\t\tm_pDynSprite->setVertexXY(0, 0.0f,  0.0f);\r\n\t\tm_pDynSprite->setVertexXY(1, width, 0.0f);\r\n\t\tm_pDynSprite->setVertexXY(2, width, height);\r\n\t\tm_pDynSprite->setVertexXY(3, 0.0f,  height);\r\n\t\tm_pDynSprite->setVertexColor(m_pNode,0,0xffffffff);\r\n\t\tm_pDynSprite->setVertexColor(m_pNode,1,0xffffffff);\r\n\t\tm_pDynSprite->setVertexColor(m_pNode,2,0xffffffff);\r\n\t\tm_pDynSprite->setVertexColor(m_pNode,3,0xffffffff);\r\n\t}\r\n}\r\n\r\n// 画像内におけるピクセル単位の位置とサイズの指定でUV値を設定する。\r\nvoid\r\nCKLBUIVariableItem::changeUV(float x, float y, float width, float height)\r\n{\r\n\r\n\t// それぞれを「ピクセル単位による画像内の位置およびサイズ」として解釈する。\r\n\tif(m_pTex) {\r\n\t\tklb_assert(m_pTex->hasStandardAttribute(CKLBImageAsset::IS_STANDARD_RECT), \"Must use a standard rectangular image in VariableItem task.\");\r\n\r\n\t\tfloat* arrOriginalUV = m_pTex->getUVBuffer();\r\n\t\tfloat uv_x = arrOriginalUV[0];\r\n\t\tfloat uv_y = arrOriginalUV[1];\r\n\t\tfloat uv_width  = arrOriginalUV[2] - arrOriginalUV[0];\r\n\t\tfloat uv_height = arrOriginalUV[7] - arrOriginalUV[1];\r\n\r\n\t\t// 位置の設定\r\n\t\tx = uv_x + x * uv_width / m_org_width;\r\n\t\ty = uv_y + y * uv_height / m_org_height;\r\n\r\n\t\t// 幅と高さの設定\r\n\t\twidth  = width  * uv_width  / m_org_width;\r\n\t\theight = height * uv_height / m_org_height;\r\n\r\n\t\tm_pDynSprite->setVertexUV(0, x,y);\r\n\t\tm_pDynSprite->setVertexUV(1, x + width, y);\r\n\t\tm_pDynSprite->setVertexUV(2, x + width, y + height);\r\n\t\tm_pDynSprite->setVertexUV(3, x , y + height);\r\n\t} else {\r\n\t\t// fill white texture in openGL\r\n\t\tm_pDynSprite->setVertexUV(0, 0.0f,0.0f);\r\n\t\tm_pDynSprite->setVertexUV(1, 0.0f,0.0f);\r\n\t\tm_pDynSprite->setVertexUV(2, 0.0f,0.0f);\r\n\t\tm_pDynSprite->setVertexUV(3, 0.0f,0.0f);\r\n\t}\r\n\r\n\tm_pNode->markUpMatrix();\r\n\tm_pDynSprite->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY | FLAG_BUFFERSHIFT);\r\n}\r\n\r\nvoid\r\nCKLBUIVariableItem::dieUI()\r\n{\r\n\tKLBDELETEA(m_asset);\r\n\tCKLBUtility::deleteNode(m_pNode, m_handle);\r\n\r\n\tif(m_pMaskTex && m_Maskhandle) {\r\n\t\tCKLBDataHandler::releaseHandle(m_Maskhandle);\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIVariableItem::execute(u32 /* deltaT */)\r\n{\r\n\tcreateArrVert(m_width, m_height);\r\n\tm_pNode->markUpMatrix();\r\n\tm_pDynSprite->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY | FLAG_BUFFERSHIFT);\r\n\tRESET_A;\r\n}\r\n\r\nint\r\nCKLBUIVariableItem::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VARITEM_CHANGE_ASSET:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * asset = (lua.isNil(3)) ? NULL : lua.getString(3);\r\n\t\t\t\tbResult = changeAsset(asset);\r\n\t\t\t}\r\n\t\t\tlua.retBoolean(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VARITEM_SET_UV:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 6) {\r\n\t\t\t\tfloat x      = lua.getFloat(3);\r\n\t\t\t\tfloat y      = lua.getFloat(4);\r\n\t\t\t\tfloat width  = lua.getFloat(5);\r\n\t\t\t\tfloat height = lua.getFloat(6);\r\n\r\n\t\t\t\tchangeUV(x, y, width, height);\r\n\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VARITEM_RESET_UV:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 2) {\r\n\t\t\t\tgetUV(this->m_pTex);\r\n\t\t\t\tm_pNode->markUpMatrix();\r\n\t\t\t\tm_pDynSprite->mark(CKLBDynSprite::MARK_CHANGE_UV | CKLBDynSprite::MARK_CHANGE_XY | FLAG_BUFFERSHIFT);\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VARITEM_SET_MASK:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc == 3) {\r\n\t\t\t\tconst char * asset = (lua.isNil(3)) ? 0 : lua.getString(3);\r\n\t\t\t\tbResult = setMaskAsset(asset);\r\n\t\t\t}\r\n\t\t\tlua.retBool(bResult);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIVariableItem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIVariableItem_h\r\n#define CKLBUIVariableItem_h\r\n\r\n#include \"CKLBUITask.h\"\r\n\r\n/*!\r\n* \\class CKLBUIVariableItem\r\n* \\brief Variable Item Task Class\r\n* \r\n* CKLBUIVariableItem is nearly similar to CKLBUISimpleItem.\r\n* However, it is possible to modify the UV on the texture \r\n* or to change the asset associated to an instance of CKLBUIVariableItem.\r\n* It also support multitexturing using the second texture as a mask (multiply)\r\n*/\r\nclass CKLBUIVariableItem : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIVariableItem>;\r\nprivate:\r\n\tCKLBUIVariableItem();\r\n\tvirtual ~CKLBUIVariableItem();\r\n\r\npublic:\r\n\tvirtual u32 getClassID();\r\n\r\n\tstatic CKLBUIVariableItem * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\t   u32 order, float x, float y, float width, float height,\r\n\t\t\t\t\t\t\t\t\t   const char * asset);\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t  u32 order, float x, float y, float width, float height, const char * asset);\r\n\tbool initUI  (CLuaState& lua);\r\n\tint commandUI(CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline u32  getOrder() { return m_order; }\r\n\tinline void setOrder(u32 order) { \r\n\t\tif(m_order != order) {\r\n\t\t\tm_order = order;\r\n\t\t\tm_pDynSprite->changeOrder(CKLBRenderingManager::getInstance(), m_order);\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char* getAsset() { return m_asset; }\r\n\r\n\tinline float getWidth() { return m_width; }\r\n\tinline void  setWidth(float width) {\r\n\t\tif(m_width != width) {\r\n\t\t\tm_width = width;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline float getHeight() { return m_height; }\r\n\tinline void  setHeight(float height) {\r\n\t\tif(m_height != height) {\r\n\t\t\tm_height = height; \r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tvoid changeUV(float x, float y, float width, float height);\r\n\r\n\tinline bool changeAsset(const char* asset) {\r\n\t\tbool bResult = setAsset(asset);\r\n\t\tm_pNode->markUpMatrix();\r\n\t\treturn bResult;\r\n\t}\r\n\r\n\tbool setMaskAsset(const char* asset);\r\n\r\nprivate:\r\n\tbool initCore(u32 order, float x, float y, float width, float height, const char * asset);\r\n\r\n\tvoid createArrVert(float width, float height);\r\n\t\r\n\tvoid getUV      (CKLBImageAsset * pTex);\t\t// テクスチャからUV値を取り込んでおく\r\n\tvoid getSize    (CKLBImageAsset * pTex);\t    // テクスチャからオリジナルサイズを取得する。\r\n\tbool setAsset   (const char * asset);\r\nprivate:\r\n\tCKLBImageAsset\t*\tm_pTex;\r\n\tu32\t\t\t\t\tm_handle;\r\n\tCKLBImageAsset\t*\tm_pMaskTex;\r\n\tu32\t\t\t\t\tm_Maskhandle;\r\n\r\n\tconst char\t\t*\tm_asset;\r\n\r\n\tCKLBDynSprite\t*\tm_pDynSprite;\r\n\tCKLBNode\t\t*\tm_pNode;\r\n\r\n\tfloat\t\t\t\tm_width;\r\n\tfloat\t\t\t\tm_height;\r\n\r\n\tfloat\t\t\t\tm_arrUV_intern[8];\r\n\tfloat\t\t\t\tm_arrOriginalUV_intern[8];\r\n\tfloat\t\t\t\tm_arrVert_intern[8];\r\n\r\n\t// 元画像のサイズ\r\n\tfloat\t\t\t\tm_org_width;\r\n\tfloat\t\t\t\tm_org_height;\r\n\r\n\tu32\t\t\t\t\tm_order;\r\n\tu32\t\t\t\t\tm_vCount;\r\n\r\n\tstatic PROP_V2\t\tms_propItems[];\r\n\r\n\t// プロパティのインデックス\r\n};\r\n\r\n\r\n#endif // CKLBUIVariableItem_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIVirtualDoc.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIVirtualDoc.h\"\r\n#include \"CKLBTouchPad.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBLanguageDatabase.h\"\r\n;\r\n// Command Values\r\nenum {\r\n\tUI_VDOC_CLEAR = 0x01,\r\n\tUI_VDOC_FONT,\r\n\tUI_VDOC_VIEWPOS,\r\n\tUI_VDOC_DRAW,\r\n\r\n\tUI_VDOC_ALIGN,\r\n\r\n\tVD_DRAW_LINE = 0x10,\r\n\tVD_DRAW_TEXT,\r\n\tVD_FILL_RECT,\r\n\tVD_DRAW_IMAG,\r\n\r\n\tVD_ALIGN_LEFT = 0,\r\n\tVD_ALIGN_CENTER,\r\n\tVD_ALIGN_RIGHT,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{ \"UI_VDOC_CLEAR\",\t\tUI_VDOC_CLEAR   },\r\n\t{ \"UI_VDOC_FONT\",\t\tUI_VDOC_FONT    },\r\n\t{ \"UI_VDOC_DRAW\",\t\tUI_VDOC_DRAW    },\r\n\t{ \"UI_VDOC_VIEWPOS\",\tUI_VDOC_VIEWPOS },\r\n\t{ \"UI_VDOC_ALIGN\",\t\tUI_VDOC_ALIGN   },\r\n\r\n\t{ \"VD_DRAW_LINE\",\t\tVD_DRAW_LINE    },\r\n\t{ \"VD_DRAW_TEXT\",\t\tVD_DRAW_TEXT    },\r\n\t{ \"VD_FILL_RECT\",\t\tVD_FILL_RECT    },\r\n\t{ \"VD_DRAW_IMAG\",\t\tVD_DRAW_IMAG    },\r\n\r\n\t{ \"VD_ALIGN_LEFT\",\t\tVD_ALIGN_LEFT   },\r\n\t{ \"VD_ALIGN_CENTER\",\tVD_ALIGN_CENTER },\r\n\t{ \"VD_ALIGN_RIGHT\",\t\tVD_ALIGN_RIGHT  },\r\n\r\n\t{ 0, 0}\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIVirtualDoc> factory(\"UI_VirtualDoc\", CLS_KLBUIVIRTUALDOC, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIVirtualDoc::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"order\",\t\tUINTEGER,\t(setBoolT)&CKLBUIVirtualDoc::setOrder,\t\t(getBoolT)&CKLBUIVirtualDoc::getOrder,\t\t0\t},\t// int:\t\t表示プライオリティ\r\n\t{\t\"cmdmax\",\t\tUINTEGER,\t(setBoolT)&CKLBUIVirtualDoc::setCommandMax,\t(getBoolT)&CKLBUIVirtualDoc::getCommandMax,\t0\t},\t// int:\t\t描画コマンド数上限\r\n\t{\t\"vertical\",\t\tBOOLEANT,\t(setBoolT)&CKLBUIVirtualDoc::setVertical,\t(getBoolT)&CKLBUIVirtualDoc::getVertical,\t0\t},\t// bool:\t縦書きフラグ\r\n\r\n\t{\t\"doc_width\",\tUINTEGER,\t(setBoolT)&CKLBUIVirtualDoc::setDocWidth,\t(getBoolT)&CKLBUIVirtualDoc::getDocWidth,\t0\t},\t// float:\tドキュメントのサイズ\r\n\t{\t\"doc_height\",\tUINTEGER,\t(setBoolT)&CKLBUIVirtualDoc::setDocHeight,\t(getBoolT)&CKLBUIVirtualDoc::getDocHeight,\t0\t},\t// float:\tドキュメントのサイズ\r\n\r\n\t{\t\"view_width\",\tUINTEGER,\t(setBoolT)&CKLBUIVirtualDoc::setViewWidth,\t(getBoolT)&CKLBUIVirtualDoc::getViewWidth,\t0\t},\t// float:\tViewPort のサイズ\r\n\t{\t\"view_height\",\tUINTEGER,\t(setBoolT)&CKLBUIVirtualDoc::setViewHeight,\t(getBoolT)&CKLBUIVirtualDoc::getViewHeight,\t0\t},\t// float:\tViewPort のサイズ\r\n\r\n\t{\t\"callback\",\t\tSTRING,\t\t(setBoolT)&CKLBUIVirtualDoc::setCallBack,\t(getBoolT)&CKLBUIVirtualDoc::getCallBack,\t0\t}\t// string:\tポインティングデバイス操作時のコールバック\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_ORDER,\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_DOC_WIDTH,\r\n\tARG_DOC_HEIGHT,\r\n\r\n\tARG_VIEW_WIDTH,\r\n\tARG_VIEW_HEIGHT,\r\n\r\n\tARG_CMDMAX,\r\n\tARG_VERTICAL,\r\n\r\n\tARG_CALLBACK,\r\n\r\n\tARG_REQUIRE = ARG_VERTICAL,\r\n\tARG_MAXNUM = ARG_CALLBACK\r\n};\r\n\r\nCKLBUIVirtualDoc::CKLBUIVirtualDoc()\r\n: CKLBUITask    ()\r\n, m_imgBegin    (NULL)\r\n, m_imgEnd      (NULL)\r\n, m_align       (VD_ALIGN_LEFT)\r\n, m_callBack    (NULL)\r\n, m_viewPosX    (0)\r\n, m_viewPosY    (0)\r\n, m_forceRefreshMode    (true)\r\n, m_counter     (0)\r\n{\r\n\tm_format = TexturePacker::getCurrentModeTexture();\r\n\tsetNotAlwaysActive();\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIVirtualDoc::~CKLBUIVirtualDoc() \r\n{\r\n\tKLBDELETEA(m_callBack);\r\n}\r\n\r\nu32\r\nCKLBUIVirtualDoc::getClassID()\r\n{\r\n\treturn CLS_KLBUIVIRTUALDOC;\r\n}\r\n\r\nCKLBUIVirtualDoc *\r\nCKLBUIVirtualDoc::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                         u32 order, float x, float y,\r\n                         u32 doc_width, u32 doc_height, \r\n                         u32 view_width, u32 view_height,\r\n                         u32 max_command_nums, bool vertical, const char * callback)\r\n{\r\n\tCKLBUIVirtualDoc * pTask = KLBNEW(CKLBUIVirtualDoc);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode,\r\n\t\t\t\t\torder, x, y,\r\n\t\t\t\t\tdoc_width, doc_height,\r\n\t\t\t\t\tview_width, view_height,\r\n\t\t\t\t\tmax_command_nums, vertical, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIVirtualDoc::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                       u32 order, float x, float y,\r\n                       u32 doc_width, u32 doc_height, \r\n                       u32 view_width, u32 view_height,\r\n                       u32 max_command_nums, bool vertical, const char * callback)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(order, x, y,\r\n\t\t\t\t\t\t\tdoc_width, doc_height,\r\n\t\t\t\t\t\t\tview_width, view_height,\r\n\t\t\t\t\t\t\tmax_command_nums, vertical, callback);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIVirtualDoc::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_MAXNUM) return false;\r\n\r\n\tfloat x             = lua.getFloat(ARG_X);\r\n\tfloat y             = lua.getFloat(ARG_Y);\r\n\tu32   order         = lua.getInt(ARG_ORDER);\r\n\tfloat doc_width     = lua.getFloat(ARG_DOC_WIDTH);\r\n\tfloat doc_height    = lua.getFloat(ARG_DOC_HEIGHT);\r\n\tfloat view_width    = lua.getFloat(ARG_VIEW_WIDTH);\r\n\tfloat view_height   = lua.getFloat(ARG_VIEW_HEIGHT);\r\n\tu32   max_command_nums = lua.getInt(ARG_CMDMAX);\r\n\tbool  vertical       = lua.getBool(ARG_VERTICAL);\r\n\tconst char * callback = (argc >= ARG_CALLBACK) ? lua.getString(ARG_CALLBACK) : NULL;\r\n\r\n\treturn initCore(order, x, y,\r\n                    doc_width, doc_height,\r\n                    view_width, view_height,\r\n                    max_command_nums, vertical, callback);\r\n}\r\n\r\nbool\r\nCKLBUIVirtualDoc::initCore(u32 order, float x, float y,\r\n                           u32 doc_width, u32 doc_height, \r\n                           u32 view_width, u32 view_height,\r\n                           u32 max_command_nums, bool vertical, const char * callback)\r\n{\r\n\t// 保持プロパティを定義\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\tsetInitPos(x, y);\r\n\r\n\tklb_assert((((s32)order) >= 0), \"Order Problem\");\r\n\r\n\tm_order = order;\r\n\r\n\tREFRESH_A;\r\n\tREFRESH_B;\r\n\tREFRESH_C;\r\n\tREFRESH_D;\r\n\tREFRESH_E;\r\n\r\n\tm_width         = doc_width;\r\n\tm_height        = doc_height;\r\n\tm_viewWidth     = view_width;\r\n\tm_viewHeight    = view_height;\r\n\tm_align_width   = m_viewWidth;\r\n\tm_commandMax    = max_command_nums;\r\n\tm_vertical\t    = vertical;\r\n\tm_callBack      = NULL;\r\n    if(callback) { setStrC(m_callBack, callback); }\r\n\r\n\tm_pDocNode = KLBNEW(CKLBNodeVirtualDocument);\r\n    if(!m_pDocNode) { return false; }\r\n\tgetNode()->addNode(m_pDocNode);\r\n\r\n\t/*\r\n\tbool bResult = setupView();\r\n    if(!bResult) {\r\n        KLBDELETE(m_pDocNode);\r\n        return false;\r\n    }*/\r\n\tm_pDocNode->markUpMatrix();\r\n\r\n\tm_dragID = -1;\r\n\tm_modalStack.setModal(false);\r\n\tm_modalStack.push();\r\n\r\n\texecute(0);\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIVirtualDoc::checkDocumentSize() \r\n{\r\n\tif (CHANGE_A) {\r\n\t\tm_pDocNode->createDocument(m_commandMax,m_format);\r\n\t\tRESET_A;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIVirtualDoc::execute(u32 deltaT)\r\n{\r\n\tbool change = false;\r\n\tdeltaT = deltaT; // avoid warning.\r\n\r\n\tif(CHANGE_A) {\r\n\t\tchange = true;\r\n\t}\r\n\tcheckDocumentSize();\r\n\r\n\tif(CHANGE_B) {\r\n\t\tm_pDocNode->setDocumentSize(m_width, m_height, m_vertical);\t// virtual size, vertical\r\n\t\tchange = true;\r\n\t\tRESET_B;\r\n\t\tforceRefresh();\r\n\t}\r\n\r\n\tif(CHANGE_C) {\r\n\t\tm_pDocNode->setViewPortSize(m_viewWidth, m_viewHeight,\r\n\t\t\t\t\t\t\t\t\t0.0f, 0.0f,\r\n\t\t\t\t\t\t\t\t\tm_order, true);\t\t\t// physical size\r\n\t\tm_pDocNode->setViewPortPos(m_viewPosX,m_viewPosY);\r\n\t\tchange = true;\r\n\t\tRESET_C;\r\n\t\tforceRefresh();\r\n\t}\r\n\r\n\tif(CHANGE_D) {\r\n\t\tchange = true;\r\n\t\tRESET_D;\r\n\t}\r\n\r\n\tif(m_forceRefreshMode) {\r\n\t\tREFRESH_E;\r\n\t\tif(change) {\r\n\t\t\tm_counter = 1;\r\n\t\t}\r\n\r\n\t\tif(m_counter) {\r\n\t\t\tforceRefresh();\r\n\t\t}\r\n\r\n\t\tif(m_counter > 0) {\r\n\t\t\tm_counter--;\r\n\t\t}\r\n\t}\r\n\r\n\tbool bModalEnable = m_modalStack.isEnable();\r\n\r\n\t// ポインティング操作のコールバックが指定されていなければ何もしない。\r\n\tif(m_callBack) {\r\n\t\tif(bModalEnable) {\r\n\t\t\ttouchPadEvent();\r\n\t\t}\r\n\t} else {\r\n\t\tif(m_counter == 0) {\r\n\t\t\tRESET_E;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIVirtualDoc::forceRefresh() \r\n{\r\n\tm_pDocNode->forceRefresh();\r\n}\r\n\r\nvoid\r\nCKLBUIVirtualDoc::dieUI()\r\n{\r\n\tKLBDELETE(m_pDocNode);\r\n\tdestroyImages();\r\n}\r\n\r\nint\r\nCKLBUIVirtualDoc::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 0;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\tklb_assertAlways(\"[UI_VirtualDoc] unknown command 0x%04x.\\n\", cmd);\r\n\r\n\tcase UI_VDOC_CLEAR:\r\n\t\t{\r\n\t\t\tif(argc != 4) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tu32 alpha   = lua.getInt(3);\r\n\t\t\tu32 col     = lua.getInt(4);\r\n\t\t\tclear(col|(alpha << 24));\r\n\t\t\tforceRefresh();\r\n\t\t\tCHANGE_D;\r\n\t\t}\r\n\t\tbreak;\r\n\r\n\tcase UI_VDOC_FONT:\r\n\t\t{\r\n\t\t\tif(argc != 5) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint idx = lua.getInt(3);\r\n\t\t\tconst char * name = lua.getString(4);\r\n\t\t\tint font_size = lua.getInt(5);\r\n\t\t\tsetFont(idx,name,font_size);\r\n\t\t\tforceRefresh();\r\n\t\t\tCHANGE_D;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VDOC_VIEWPOS:\r\n\t\t{\r\n\t\t\tif(argc != 4) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tint x = lua.getInt(3);\r\n\t\t\tint y = lua.getInt(4);\r\n\t\t\tsetViewPortPos(x, y);\r\n\t\t\tforceRefresh();\r\n\t\t\tCHANGE_D;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VDOC_ALIGN:\r\n\t\t{\r\n\t\t\tbool bResult = false;\r\n\t\t\tif(argc >= 3 && argc <= 4) {\r\n\t\t\t\tu8 align = lua.getInt(3);\r\n\t\t\t\tint align_width = (argc >= 4) ? lua.getInt(4) : m_viewWidth;\r\n\t\t\t\tsetAlign(align, align_width);\r\n\t\t\t\tforceRefresh();\r\n\t\t\t\tCHANGE_D;\r\n\t\t\t\tbResult = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_VDOC_DRAW:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tcheckDocumentSize();\r\n\t\t\tm_pDocNode->emptyDocument();\r\n\t\t\tm_pDocNode->setDocumentSize(m_width, m_height,m_vertical);\r\n\t\t\tm_pDocNode->lockDocument();\r\n\t\t\tklb_assert(lua.isTable(3), \"[UI_VirtualDoc::UI_VDOC_DRAW] BAD command table format.\");\r\n\t\t\tlua.retValue(3);\r\n\t\t\tlua.retNil();\r\n\t\t\twhile(lua.tableNext()) {\r\n\t\t\t\tlua.retValue(-2);\t// index\r\n\r\n\t\t\t\tklb_assert(lua.isTable(-2), \"[UI_VirtualDoc::UI_VDOC_DRAW] BAD command table format.\");\r\n\r\n\t\t\t\tlua.retValue(-2);\t// array\r\n\t\t\t\tlua.retNil();\r\n\r\n\t\t\t\tlua.tableNext();\t// 最初の値(描画コマンド)\r\n\t\t\t\tint dcmd = lua.getInt(-1);\r\n\t\t\t\tlua.pop(1);\r\n\t\t\t\tswitch(dcmd)\r\n\t\t\t\t{\r\n\t\t\t\tdefault:\t// 不明な描画コマンド値\r\n\t\t\t\t\tklb_assertAlways(\"[UI_VirtualDoc] unknown draw command 0x%04x.\\n\", cmd);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase VD_DRAW_LINE:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint x0, y0, x1, y1;\r\n\t\t\t\t\t\tu32 col, alpha;\r\n\t\t\t\t\t\tlua.tableNext(); x0\t\t= lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); y0\t\t= lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); x1\t\t= lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); y1\t\t= lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); alpha  = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); col\t= lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tdrawLine(x0, y0, x1, y1, col|(alpha << 24));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase VD_DRAW_TEXT:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint x0, y0, fontidx;\r\n\t\t\t\t\t\tu32 col, alpha;\r\n\t\t\t\t\t\tchar const * str;\r\n\t\t\t\t\t\tlua.tableNext(); x0      = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); y0      = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); str     = (char *)lua.getString(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); alpha   = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); col     = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); fontidx = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tstr = CKLBLanguageDatabase::getInstance().getString(str);\r\n\r\n\t\t\t\t\t\tdrawText(x0, y0, str, col|(alpha << 24), fontidx);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase VD_FILL_RECT:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint x0, y0, width, height;\r\n\t\t\t\t\t\tu32 col, alpha;\r\n\t\t\t\t\t\tbool fill;\r\n\t\t\t\t\t\tlua.tableNext(); x0      = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); y0      = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); width   = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); height  = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); alpha   = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); col     = lua.getInt(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); fill    = lua.getBool(-1); lua.pop(1);\r\n\t\t\t\t\t\tfillRect(x0, y0, width, height, col|(alpha << 24), fill);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase VD_DRAW_IMAG:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint x0, y0;\r\n\t\t\t\t\t\tconst char * image;\r\n\t\t\t\t\t\tint alpha;\r\n\r\n\t\t\t\t\t\tlua.tableNext(); x0    = lua.getInt(-1);    lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); y0    = lua.getInt(-1);    lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); image = lua.getString(-1); lua.pop(1);\r\n\t\t\t\t\t\tlua.tableNext(); alpha = lua.getInt(-1);    lua.pop(1);\r\n\r\n\t\t\t\t\t\t// image は後で破棄しなければならないので、使った分をリストとして保持しておく。\r\n\t\t\t\t\t\tdrawImage(x0, y0, image, alpha);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tlua.pop(4);\r\n\t\t\t}\r\n\t\t\tlua.pop(1);\r\n\t\t\tm_pDocNode->unlockDocument();\r\n\t\t\tm_pDocNode->setViewPortPos(0, 0);\r\n\t\t\tforceRefresh();\r\n\t\t\tCHANGE_D;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// VDoc で使用する画像をロードし、使った分だけイメージのハンドルを握っておく\r\nCKLBImageAsset *\r\nCKLBUIVirtualDoc::loadImage(const char * image)\r\n{\r\n\tu32 handle;\r\n\r\n\tCKLBAssetManager& pAssetManager = CKLBAssetManager::getInstance();\r\n\tKLBTextureAssetPlugin* pPlug = (KLBTextureAssetPlugin*)pAssetManager.getPlugin('T'); // Texture\r\n\r\n\tpPlug->setLoadingMode(TEX_LOAD_GPUCPU);\r\n\r\n\tCKLBImageAsset * pImage = (CKLBImageAsset *)CKLBUtility::loadAssetScript(image, &handle);\r\n\tif(pImage) {\r\n\t\t// assetがロードできたらリスト項目を作る。\r\n\t\tVDIMG * pImg = KLBNEW(VDIMG);\r\n\t\tif(!pImg) {\r\n\t\t\tCKLBDataHandler::releaseHandle(handle);\r\n\t\t\treturn NULL;\r\n\t\t}\r\n\t\tu8* pix\t\t= pImage->m_pTextureAsset->m_softTexture;\r\n\t\tif (pix == NULL) {\r\n\t\t\tklb_assertAlways(\"TEXTURE IS ALREADY USED. To use bitmap, virtual doc must be the first to lock the resource or create a small special texture.\");\r\n\t\t}\r\n\t\tpImg->handle = handle;\r\n\t\tpImg->pImage = pImage;\r\n\t\tpImg->next   = NULL;\r\n\t\tpImg->prev   = m_imgEnd;\r\n\t\tif(pImg->prev) {\r\n\t\t\tpImg->prev->next = pImg;\r\n\t\t} else {\r\n\t\t\tm_imgBegin = pImg;\r\n\t\t}\r\n\t\tm_imgEnd = pImg;\r\n\t}\r\n\r\n\tpPlug->setLoadingMode(TEX_LOAD_GPU);\r\n\r\n\treturn pImage;\r\n}\r\n\r\n// VDoc で使用した画像をすべて解放する\r\nvoid\r\nCKLBUIVirtualDoc::destroyImages()\r\n{\r\n\tVDIMG * pImg = m_imgBegin;\r\n\twhile(pImg) {\r\n\t\tVDIMG * pNxt = pImg->next;\r\n\t\tCKLBDataHandler::releaseHandle(pImg->handle);\r\n\t\tKLBDELETE(pImg);\r\n\t\tpImg = pNxt;\r\n\t}\r\n}\r\n\r\nvoid\r\nCKLBUIVirtualDoc::touchPadEvent()\r\n{\r\n\tCKLBTouchPadQueue& tpq = CKLBTouchPadQueue::getInstance();\r\n\tfloat fx, fy;\r\n\tCKLBUtility::getNodePosition(getNode(), &fx, &fy);\r\n\tint x, y, rx, ry;\r\n\tx = fx;\r\n\ty = fy;\r\n\r\n\tint width   = m_viewWidth  * getScaleX();\r\n\tint height  = m_viewHeight * getScaleY();\r\n\tconst char * func_callback = m_callBack;\r\n\r\n\tconst PAD_ITEM * item;\r\n\ttpq.startItem();\r\n\twhile((item = tpq.getItem())) {\r\n\t\tswitch(item->type)\r\n\t\t{\r\n\t\tcase PAD_ITEM::TAP:\r\n\t\t\t{\r\n\t\t\t\t// タップ位置がリストの範囲内に入っていれば自身に対する操作とみなす。\r\n\t\t\t\trx = item->x - x;\r\n\t\t\t\try = item->y - y;\r\n\t\t\t\tif(rx < 0 || rx >= width || ry < 0 || ry >= height) {\r\n\t\t\t\t\t// クリップ外なのであずかり知らぬイベント。\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tm_dragID = item->id;\r\n\t\t\t\tm_dragX = item->x;\r\n\t\t\t\tm_dragY = item->y;\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tif(func_callback) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventVirtualDoc(func_callback, this, item->type, item->x, item->y, 0, 0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase PAD_ITEM::DRAG:\r\n\t\t\t{\r\n\t\t\t\tif(item->id != m_dragID) break;\r\n\t\t\t\tint mv_x = item->x - m_dragX;\r\n\t\t\t\tint mv_y = item->y - m_dragY;\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tif(func_callback) {\r\n\t\t\t\t\t// DEBUG_PRINT(\"  EVENT: %p (drag)\", this);\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventVirtualDoc(func_callback, this, item->type, m_dragX, m_dragY, mv_x, mv_y);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase PAD_ITEM::RELEASE:\r\n\t\tcase PAD_ITEM::CANCEL:\r\n\t\t\t{\r\n\t\t\t\tif(item->id != m_dragID) break;\r\n\t\t\t\tint mv_x = item->x - m_dragX;\r\n\t\t\t\tint mv_y = item->y - m_dragY;\r\n\t\t\t\ttpq.useItem(item, this);\r\n\t\t\t\tif(func_callback) {\r\n\t\t\t\t\tCKLBScriptEnv::getInstance().call_eventVirtualDoc(func_callback, this, item->type, m_dragX, m_dragY, mv_x, mv_y);\r\n\t\t\t\t}\r\n\t\t\t\tm_dragID = -1;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIVirtualDoc.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIVirtualDoc_h\r\n#define CKLBUIVirtualDoc_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBNodeVirtualDocument.h\"\r\n#include \"CKLBModalStack.h\"\r\n\r\n/*!\r\n* \\class CKLBUIVirtualDoc\r\n* \\brief Virtual Document Task Class\r\n* \r\n* CKLBUIVirtualDoc creates and allows to manage a Virtual Document.\r\n* A Virtual Document allows to manage the rendering of an area of the screen.\r\n* Several items can be associated to it, such as text, lines or images.\r\n*/\r\nclass CKLBUIVirtualDoc : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIVirtualDoc>;\r\nprivate:\r\n\tCKLBUIVirtualDoc();\r\n\tvirtual ~CKLBUIVirtualDoc();\r\npublic:\r\n\tstatic CKLBUIVirtualDoc * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\t u32 order, float x, float y,\r\n\t\t\t\t\t\t\t\t\t u32 doc_width, u32 doc_height, \r\n\t\t\t\t\t\t\t\t\t u32 view_width, u32 view_height,\r\n\t\t\t\t\t\t\t\t\t u32 max_command_nums, bool vertical,\r\n\t\t\t\t\t\t\t\t\t const char * callback = NULL);\r\n\tbool initUI     (CLuaState& lua);\r\n\tu32  getClassID ();\r\n\tint  commandUI  (CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tvoid checkDocumentSize();\r\n\r\n\tinline void clear(u32 color) \r\n\t{ m_pDocNode->clear(color); }\r\n\r\n\tinline void setFont(u32 idx, const char* fontName, u32 fontSize) \r\n\t{ m_pDocNode->setFont(idx, fontName, fontSize); }\r\n\r\n\tinline void setViewPortPos(s32 x, s32 y) \r\n\t{ m_viewPosX = x; m_viewPosY = y; m_pDocNode->setViewPortPos(x, y); }\r\n\r\n\tinline void drawLine(s32 x0, s32 y0, s32 x1, s32 y1, u32 color)\r\n\t{ m_pDocNode->drawLine(x0, y0, x1, y1, color); }\r\n\r\n\tinline void drawImage(s32 x0, s32 y0, const char* image, u32 alpha) \r\n\t{\tCKLBImageAsset * pImage = loadImage(image);\r\n\t\tm_pDocNode->drawImage(x0, y0, pImage, alpha);\t}\r\n\r\n\tinline void fillRect(s32 x0, s32 y0, u32 width, u32 height, u32 color, bool fill)\r\n\t{\tm_pDocNode->fillRect(x0, y0, width, height, color,fill); }\r\n\r\n\tinline void drawText(s32 x0, s32 y0, const char* str, u32 color, u32 fontidx)\r\n\t{\tm_pDocNode->drawText(x0, y0, str, color, fontidx, (u8)m_align, (s16)m_align_width); REFRESH_B; }\r\n\r\n\tinline void startDocument()\t\t\t{ m_pDocNode->emptyDocument(); m_pDocNode->lockDocument();\t}\r\n\tinline void endDocument  ()\t\t\t{ m_pDocNode->unlockDocument();\t}\r\n\r\n\tinline u32  getCommandMax()\t\t\t{ return m_commandMax; }\r\n\tinline void setCommandMax(u32 command) {\r\n\t\tif (command != m_commandMax) {\r\n\t\t\tm_commandMax = command;\r\n\t\t\tREFRESH_A;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getDocHeight()\t\t\t{ return m_height; }\r\n\tinline void setDocHeight(u32 height) {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_height = height;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32  getDocWidth()\t\t\t{ return m_width;\t}\r\n\tinline void setDocWidth(u32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_width = width;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline bool getVertical()\t\t\t{ return m_vertical; }\r\n\tinline void setVertical(bool vertical) {\r\n\t\tif (vertical != m_vertical) {\r\n\t\t\tm_vertical = vertical;\r\n\t\t\tREFRESH_B;\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32  getViewHeight()\t\t\t\t{ return m_viewHeight; }\r\n\tinline void setViewHeight(s32 height)\t{\r\n\t\tif (height != m_viewHeight) {\r\n\t\t\tm_viewHeight = height;\r\n\t\t\tREFRESH_C;\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32  getViewWidth()\t\t\t{ return m_viewWidth; }\r\n\tinline void setViewWidth(s32 width) {\r\n\t\tif (width != m_viewWidth) {\r\n\t\t\tm_viewWidth = width;\r\n\t\t\tREFRESH_C;\r\n\t\t}\r\n\t}\r\n\r\n\tinline u32\tgetOrder\t()\t\t\t{\treturn m_order; }\r\n\tinline void setOrder\t(u32 order)\t{\r\n\t\tif (m_order != order) {\r\n\t\t\tm_order = order;\r\n\t\t\tm_pDocNode->setPriority(order);\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getCallBack()\t\t\t\t        { return m_callBack;\t\t\t}\r\n\tinline void         setCallBack(const char* callBack)\t{ REFRESH_E; setStrC(m_callBack, callBack);}\r\n\r\n\tinline void         setAlign(u8 align, int alignWidth)  { m_align = align; m_align_width = alignWidth; }\r\n\r\nprivate:\r\n\tvoid forceRefresh();\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\tu32 order, float x, float y,\r\n\t\t\t\tu32 doc_width, u32 doc_height, \r\n\t\t\t\tu32 view_width, u32 view_height,\r\n\t\t\t\tu32 max_command_nums, bool vertical, const char * callback);\r\n\r\n\tbool initCore(\r\n\t\t\t\tu32 order, float x, float y,\r\n\t\t\t\tu32 doc_width, u32 doc_height, \r\n\t\t\t\tu32 view_width, u32 view_height,\r\n\t\t\t\tu32 max_command_nums, bool vertical, const char * callback);\r\n\r\n\tCKLBImageAsset * loadImage(const char * image);\r\n\tvoid destroyImages();\r\n\tvoid touchPadEvent();\r\n\r\n\tu32\t\t    m_order;\r\n\tu32\t\t    m_commandMax;\r\n\tu32\t\t    m_height;\r\n\tu32\t\t    m_width;\r\n\tu32\t\t    m_viewWidth;\r\n\tu32\t\t    m_viewHeight;\r\n\tu32\t\t    m_counter;\r\n\tconst char*\tm_callBack;\r\n\ts32         m_viewPosX;\r\n\ts32         m_viewPosY;\r\n\tu8\t\t\tm_format;\r\n\r\n\tbool\t    m_vertical;\r\n\tbool\t    m_forceRefreshMode;\r\n\r\n\tstruct VDIMG {\r\n\r\n\t\tVDIMG\t\t\t*\tprev;\r\n\t\tVDIMG\t\t\t*\tnext;\r\n\r\n\t\tCKLBImageAsset\t*\tpImage;\r\n\t\tu32\t\t\t\t\thandle;\r\n\t};\r\n\tVDIMG\t\t\t\t\t*\tm_imgBegin;\r\n\tVDIMG\t\t\t\t\t*\tm_imgEnd;\r\n\r\n\tint\t\t\t\t\t\t\tm_dragID;\r\n\tint\t\t\t\t\t\t\tm_dragX;\r\n\tint\t\t\t\t\t\t\tm_dragY;\r\n\r\n\tu8\t\t\t\t\t\t\tm_align;\r\n\tint\t\t\t\t\t\t\tm_align_width;\r\n\r\n\tCKLBNodeVirtualDocument\t*\tm_pDocNode;\r\n\tCKLBModalStack\t\t\t\tm_modalStack;\t// モーダルスタックパッケージ\r\n\r\n\tstatic PROP_V2\t\t\t\tms_propItems[];\r\n\r\n};\r\n\r\n\r\n#endif // CKLBUIVirtualDoc_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIWebArea.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"CKLBUIWebArea.h\"\r\n#include \"CKLBLuaEnv.h\"\r\n#include \"CKLBScriptEnv.h\"\r\n#include \"CKLBOSCtrlEvent.h\"\r\n#include \"CKLBNetAPIKeyChain.h\"\r\n;\r\nenum {\r\n\tUI_WEBVIEW_SETURL,\r\n\tUI_WEBVIEW_GETURL,\r\n    UI_WEBVIEW_SCALESPAGETOFIT,\r\n    UI_WEBVIEW_SETBGCOLOR,      // 背景色の設定\r\n\tUI_WEBVIEW_RESETCALLBACK,\r\n    \r\n    WEBVIEW_LOCALLINK = 0,\r\n    WEBVIEW_DIDSTARTLOAD,\r\n    WEBVIEW_DIDENDLOAD,\r\n    WEBVIEW_FAILEDLOAD,\r\n};\r\n\r\nstatic IFactory::DEFCMD cmd[] = {\r\n\t{\"UI_WEBVIEW_SETURL\",           UI_WEBVIEW_SETURL           },\r\n\t{\"UI_WEBVIEW_GETURL\",           UI_WEBVIEW_GETURL           },\r\n    {\"UI_WEBVIEW_SCALESPAGETOFIT\",\tUI_WEBVIEW_SCALESPAGETOFIT  },\r\n    {\"UI_WEBVIEW_SETBGCOLOR\",\t\tUI_WEBVIEW_SETBGCOLOR       },\r\n\t{\"UI_WEBVIEW_RESETCALLBACK\",\tUI_WEBVIEW_RESETCALLBACK    },\r\n    \r\n    {\"WEBVIEW_LOCALLINK\",       WEBVIEW_LOCALLINK       },\r\n    {\"WEBVIEW_DIDSTARTLOAD\",    WEBVIEW_DIDSTARTLOAD    },\r\n    {\"WEBVIEW_DIDENDLOAD\",      WEBVIEW_DIDENDLOAD      },\r\n    {\"WEBVIEW_FAILEDLOAD\",      WEBVIEW_FAILEDLOAD      },\r\n\r\n\t{ 0, 0 }\r\n};\r\n\r\nstatic CKLBTaskFactory<CKLBUIWebArea> factory(\"UI_WebView\", CLS_KLBUIWEBVIEW, cmd);\r\n\r\n// Allowed Property Keys\r\nCKLBLuaPropTask::PROP_V2 CKLBUIWebArea::ms_propItems[] = {\r\n\tUI_BASE_PROP,\r\n\t{\t\"width\",\tINTEGER,\t(setBoolT)&CKLBUIWebArea::setWidth,\t\t(getBoolT)&CKLBUIWebArea::getWidth,\t\t0\t},\r\n\t{\t\"height\",\tINTEGER,\t(setBoolT)&CKLBUIWebArea::setHeight,\t(getBoolT)&CKLBUIWebArea::getHeight,\t0\t},\r\n\t{\t\"value\",\tSTRING,\t\t(setBoolT)&CKLBUIWebArea::setText,\t\t(getBoolT)&CKLBUIWebArea::getText,\t\t0\t}\r\n};\r\n\r\nenum {\r\n\tARG_PARENT = 1,\r\n\r\n\tARG_MODE,\r\n\r\n\tARG_X,\r\n\tARG_Y,\r\n\r\n\tARG_WIDTH,\r\n\tARG_HEIGHT,\r\n\r\n\tARG_VALUE,\t// 初期表示URL\r\n    \r\n    ARG_CALLBACK,   // command-URIを受け付ける場合は、その受付callbackを指定する\r\n\r\n\tARG_REQUIRE = ARG_HEIGHT,\r\n\tARG_NUMS    = ARG_CALLBACK\r\n};\r\n\r\nCKLBUIWebArea::CKLBUIWebArea() \r\n: CKLBUITask    ()\r\n, m_pWebView    (NULL)\r\n, m_cmdCallback (NULL)\r\n, m_text        (NULL)\r\n{\r\n\tm_newScriptModel = true;\r\n}\r\n\r\nCKLBUIWebArea::~CKLBUIWebArea()\r\n{\r\n\tKLBDELETEA(m_text);\r\n\tKLBDELETEA(m_cmdCallback);\r\n}\r\n\r\nu32 \r\nCKLBUIWebArea::getClassID() \r\n{ \r\n    return CLS_KLBUIWEBVIEW; \r\n}\r\n\r\nCKLBUIWebArea *\r\nCKLBUIWebArea::create(CKLBUITask * pParent, CKLBNode * pNode,\r\n                      bool mode, float x, float y,\r\n                      float width, float height,\r\n                      const char * url, const char * callback)\r\n{\r\n\tCKLBUIWebArea * pTask = KLBNEW(CKLBUIWebArea);\r\n    if(!pTask) { return NULL; }\r\n\tif(!pTask->init(pParent, pNode, mode, x, y, width, height, url, callback)) {\r\n\t\tKLBDELETE(pTask);\r\n\t\treturn NULL;\r\n\t}\r\n\treturn pTask;\r\n}\r\n\r\nbool\r\nCKLBUIWebArea::init(CKLBUITask * pParent, CKLBNode * pNode,\r\n                    bool mode, float x, float y,\r\n                    float width, float height,\r\n                    const char * url, const char * callback)\r\n{\r\n    if(!setupNode()) { return false; }\r\n\r\n\t// ユーザ定義初期化を呼び、初期化に失敗したら終了。\r\n\tbool bResult = initCore(mode, x, y, width, height, url, callback);\r\n\r\n\t// 初期化処理終了後の登録。失敗時の処理も適切に行う。\r\n\tbResult = registUI(pParent, bResult);\r\n\tif(pNode) {\r\n\t\tpParent->getNode()->removeNode(getNode());\r\n\t\tpNode->addNode(getNode());\r\n\t}\r\n\r\n\treturn bResult;\r\n}\r\n\r\nbool\r\nCKLBUIWebArea::initUI(CLuaState& lua)\r\n{\r\n\tint argc = lua.numArgs();\r\n\tif(argc < ARG_REQUIRE || argc > ARG_NUMS) return false;\r\n\r\n\tfloat x         = lua.getFloat(ARG_X);\r\n\tfloat y         = lua.getFloat(ARG_Y);\r\n\tbool  mode      = lua.getBool(ARG_MODE);\r\n\tfloat width     = lua.getFloat(ARG_WIDTH);\r\n\tfloat height    = lua.getFloat(ARG_HEIGHT);\r\n\tconst char * url        = (argc >= ARG_VALUE)    ? lua.getString(ARG_VALUE)     : NULL;\r\n    const char * callback   = (argc >= ARG_CALLBACK) ? lua.getString(ARG_CALLBACK)  : NULL;\r\n\r\n\treturn initCore(mode, x, y, width, height, url, callback);\r\n}\r\n\r\nbool\r\nCKLBUIWebArea::initCore(bool mode, float x, float y,\r\n\t\t\t\t\t\tfloat width, float height,\r\n\t\t\t\t\t\tconst char * url, const char * callback)\r\n{\r\n\tif(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {\r\n\t\treturn false;\r\n\t}\r\n\tsetInitPos(x, y);\r\n\tconst char * str = (url) ? url : \"\";\r\n\tif(callback) {\r\n\t\tm_cmdCallback = CKLBUtility::copyString(callback);\r\n\t}\r\n\r\n    // 起動時点でauthorized tokenとregionが登録されていたら、それをWebViewに与える。\r\n    CKLBNetAPIKeyChain& keychain = CKLBNetAPIKeyChain::getInstance();\r\n    const char * token  = keychain.getToken();\r\n    const char * region = keychain.getRegion();\r\n    const char * client = keychain.getClient();\r\n    const char * consumerKey = keychain.getConsumerKey();\r\n    const char * appID  = keychain.getAppID();\r\n\tconst char * userID = keychain.getUserID();\r\n    \r\n\tm_pWebView = KLBNEWC( CKLBUIWebView,(mode, str, token, region, client, consumerKey, appID, userID));\r\n\tgetNode()->addNode(m_pWebView);\r\n\r\n\tsetText(str);\r\n\tsetWidth((int)width);\r\n\tsetHeight((int)height);\r\n\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCKLBUIWebArea::execute(u32 /* deltaT */)\r\n{\r\n    const char * text = m_pWebView->getText();\r\n\tif(text) {\r\n\t\tsetStrC(m_text, text);\r\n\t}\r\n\r\n    // WebView がイベントを起こしていたら処理する\r\n    CKLBOSCtrlQueue& osctrl = CKLBOSCtrlQueue::getInstance();\r\n    const OSCTRL * item;\r\n    IWidget * pWidget = m_pWebView->getWidget();\r\n    \r\n    osctrl.startItem();\r\n    // CLuaState& lua = CKLBLuaEnv::getInstance().getState();\r\n    while(NULL != (item = osctrl.getItem(pWidget))) {\r\n        switch(item->type) {\r\n            case IClientRequest::E_URLJUMP:\r\n            {\r\n                // そのWebViewでcommand-URL遷移のイベントが発生していたら、Luaのcallbackに遷移先URLを丸ごと渡す\r\n                const char * url = pWidget->getTmpString();\r\n                if(m_cmdCallback) { CKLBScriptEnv::getInstance().call_webTask(m_cmdCallback, this, WEBVIEW_LOCALLINK, url); }\r\n                break;\r\n            }\r\n            case IClientRequest::E_DIDSTARTLOADWEB:\r\n            {\r\n                // Webのロードが開始された\r\n                if(m_cmdCallback) { CKLBScriptEnv::getInstance().call_webTask(m_cmdCallback, this, WEBVIEW_DIDSTARTLOAD, \"\"); }\r\n                break;\r\n            }\r\n            case IClientRequest::E_DIDLOADENDWEB:\r\n            {\r\n                if(m_cmdCallback) { CKLBScriptEnv::getInstance().call_webTask(m_cmdCallback, this, WEBVIEW_DIDENDLOAD, \"\"); }\r\n                break;\r\n            }\r\n            case IClientRequest::E_FAILEDLOADWEB:\r\n            {\r\n                if(m_cmdCallback) { CKLBScriptEnv::getInstance().call_webTask(m_cmdCallback, this, WEBVIEW_FAILEDLOAD, \"\"); }\r\n                break;\r\n            }\r\n            default:\r\n                break;\r\n        }\r\n    }\r\n}\r\n\r\nvoid\r\nCKLBUIWebArea::dieUI()\r\n{\r\n\tKLBDELETE(m_pWebView);\r\n}\r\n\r\nint\r\nCKLBUIWebArea::commandUI(CLuaState& lua, int argc, int cmd)\r\n{\r\n\tint ret = 1;\r\n\tswitch(cmd)\r\n\t{\r\n\tdefault:\r\n\t\t{\r\n\t\t\tlua.retBoolean(false);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_WEBVIEW_SETURL:\r\n\t\t{\r\n\t\t\tif(argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * string = lua.getString(3);\r\n\t\t\tsetText(string);\r\n\t\t\tlua.retBoolean(true);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase UI_WEBVIEW_GETURL:\r\n\t\t{\r\n\t\t\tif(argc != 2) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * string = m_pWebView->getText();\r\n\t\t\tlua.retString(string);\r\n\t\t\tret = 1;\r\n\t\t}\r\n\t\tbreak;\r\n    case UI_WEBVIEW_SCALESPAGETOFIT:\r\n        {\r\n            bool bResult = false;\r\n            if(argc == 3) {\r\n                bResult = true;\r\n                bool scalesPageToFit = lua.getBool(3);\r\n                setScalesPageToFit(scalesPageToFit);\r\n            }\r\n            lua.retBool(bResult);\r\n            ret = 1;\r\n        }\r\n        break;\r\n    case UI_WEBVIEW_SETBGCOLOR:\r\n        {\r\n            if(argc != 4) {\r\n                lua.retBoolean(false);\r\n                ret = 1;\r\n                break;\r\n            }\r\n            u32 alpha = lua.getInt(3);\r\n            u32 color = lua.getInt(4);\r\n            setBgColor(alpha, color);\r\n            lua.retBoolean(true);\r\n            ret = 1;\r\n        }\r\n        break;\r\n\tcase UI_WEBVIEW_RESETCALLBACK:\r\n\t\t{\r\n\t\t\tif (argc != 3) {\r\n\t\t\t\tlua.retBoolean(false);\r\n\t\t\t\tret = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tconst char * string = lua.getString(3);\r\n\t\t\tif (string) {\r\n\t\t\t\tconst char * copy   = CKLBUtility::copyString(string);\r\n\t\t\t\tif (copy) {\r\n\t\t\t\t\tKLBDELETEA(m_cmdCallback);\r\n\t\t\t\t\tm_cmdCallback = copy;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n\treturn ret;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBUIWebArea.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBUIWebArea_h\r\n#define CKLBUIWebArea_h\r\n\r\n#include \"CKLBUITask.h\"\r\n#include \"CKLBWebViewNode.h\"\r\n\r\n/*!\r\n* \\class CKLBUIWebArea\r\n* \\brief Web Area Task Class\r\n* \r\n* CKLBUIWebArea is used to create a web viewer area.\r\n*/\r\nclass CKLBUIWebArea : public CKLBUITask\r\n{\r\n\tfriend class CKLBTaskFactory<CKLBUIWebArea>;\r\nprivate:\r\n\tCKLBUIWebArea();\r\n\tvirtual ~CKLBUIWebArea();\r\npublic:\r\n\tstatic CKLBUIWebArea * create(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t\t\t\t\t\t\tbool mode, float x, float y,\r\n\t\t\t\t\t\t\t\t\tfloat width, float height,\r\n\t\t\t\t\t\t\t\t\tconst char * url, const char * callback);\r\n\r\n\tu32 getClassID  ();\r\n\tbool initUI     (CLuaState& lua);\r\n\tint commandUI   (CLuaState& lua, int argc, int cmd);\r\n\r\n\tvoid execute(u32 deltaT);\r\n\tvoid dieUI  ();\r\n\r\n\tinline s32  getWidth()          { return m_width; }\r\n\tinline void setWidth(s32 width) {\r\n\t\tif (width != m_width) {\r\n\t\t\tm_width = width;\r\n\t\t\tm_pWebView->setWidth(width);\r\n\t\t}\r\n\t}\r\n\r\n\tinline s32  getHeight()             { return m_height; }\r\n\tinline void setHeight(s32 height)   {\r\n\t\tif (height != m_height) {\r\n\t\t\tm_height = height;\r\n\t\t\tm_pWebView->setHeight(height);\r\n\t\t}\r\n\t}\r\n\r\n\tinline const char*  getText()                   {\treturn m_text; }\r\n\tinline void         setText(const char* text)   {\r\n\t\tsetStrC(m_text, text);\r\n\t\tm_pWebView->setText(text);\r\n\t}\r\n\t\r\n\tinline void setScalesPageToFit(bool b)\t\t\t{ m_pWebView->setScalesPageToFit(b);\t}\r\n\r\n\tinline void setBgColor(u32 alpha, u32 color)\t{ m_pWebView->setBgColor(alpha, color); }\r\n\r\nprivate:\r\n\tconst char*\tm_text;\r\n\ts32\t\t\tm_width;\r\n\ts32\t\t\tm_height;\r\n\r\n\tbool init(CKLBUITask * pParent, CKLBNode * pNode,\r\n\t\t\t  bool mode, float x, float y,\r\n\t\t\t  float width, float height,\r\n\t\t\t  const char * url, const char * callback);\r\n\r\n\tbool initCore(\r\n\t\t\t\tbool mode, float x, float y,\r\n\t\t\t\tfloat width, float height,\r\n\t\t\t\tconst char * url, const char * callback);\r\n\r\n\tCKLBUIWebView\t*\tm_pWebView;\r\n\r\n    const char      *   m_cmdCallback;\r\n    \r\n\tstatic PROP_V2      ms_propItems[];\r\n};\r\n\r\n#endif // CKLBUIWebArea_h\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBWebViewNode.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\n#include \"CKLBWebViewNode.h\"\r\n\r\n#include \"CPFInterface.h\"\r\n\r\n#include \"CKLBDrawTask.h\"\r\n\r\nCKLBUIWebView::CKLBUIWebView(bool isPageJump, const char * initialURL,\r\n                            const char * token, const char * region, const char * client,\r\n                            const char * consumerKey, const char * applicationId, const char * userID)\r\n: nativeInputItem   (NULL)\r\n, m_width           (0)\r\n, m_height          (0)\r\n, m_tx              (0)\r\n, m_ty              (0)\r\n, m_bgcolor         (0xffffffff)\r\n, m_textLen         (0)\r\n, m_textBuf         (0)\r\n{\r\n\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\tIWidget::CONTROL control = (isPageJump) ? IWidget::WEBVIEW : IWidget::WEBNOJUMP;\r\n    const char * url = (initialURL) ? initialURL : \"\";\r\n\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\tint px,py;\r\n\tdraw.toPhisicalPosition(m_tx, m_ty, px, py);\r\n\tnativeInputItem = pForm.createControl(control , 0, url, px, py, 0, 0, token, region, client, consumerKey, applicationId, userID);\r\n\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n\r\n\tklb_assert(nativeInputItem, \"EditBox allocation failed\");\r\n}\r\n\r\nCKLBUIWebView::~CKLBUIWebView() \r\n{\r\n\t// Call Interface to release the input box\r\n\tif (nativeInputItem) {\r\n\t\tIPlatformRequest& pForm = CPFInterface::getInstance().platform();\r\n\t\tpForm.destroyControl(nativeInputItem);\r\n\t\tnativeInputItem = NULL;\r\n\t}\r\n\tKLBDELETEA(m_textBuf);\r\n}\r\n\r\n/*virtual*/\t\r\nvoid \r\nCKLBUIWebView::recomputeCustom() \r\n{\r\n\tif (nativeInputItem) {\r\n\t\tconst SMatrix2D* pMat = &m_composedMatrix;\r\n\r\n\t\ts32 x = (s32)pMat->m_matrix[MAT_TX];\r\n\t\ts32 y = (s32)pMat->m_matrix[MAT_TY];\r\n\r\n\t\tint px, py;\r\n\t\tint width, height;\r\n\t\tCKLBDrawResource& draw = CKLBDrawResource::getInstance();\r\n\r\n\t\tm_tx = x;\r\n\t\tm_ty = y;\r\n\r\n\t\tint transWidth  = m_width  * pMat->m_matrix[MAT_A];\r\n\t\tint transHeight = m_height * pMat->m_matrix[MAT_D];\r\n\r\n\t\tdraw.toPhisicalPosition(x, y, px, py);\t\r\n\t\tdraw.toPhisicalSize(transWidth, transHeight, width, height);\r\n\t\tnativeInputItem->move(px, py);\r\n\t\tnativeInputItem->resize(width, height);\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIWebView::setBgColor(u32 bgalpha, u32 bgcolor)\r\n{\r\n    if (nativeInputItem && (bgcolor != m_bgcolor)) {\r\n\t\tnativeInputItem->cmd(IWidget::WEB_BGCOLOR_NORMAL, bgalpha, bgcolor);\r\n    }\r\n}\r\n \r\nvoid \r\nCKLBUIWebView::setWidth(u32 width) {\r\n\tif (nativeInputItem && (width != m_width)) {\r\n\t\tm_width = width;\r\n\t\tthis->markUpMatrix(); // Force recomputeCustom()\r\n\t}\r\n}\r\n\r\nvoid \r\nCKLBUIWebView::setHeight(u32 height) \r\n{\r\n\tif (nativeInputItem && (height != m_height)) {\r\n\t\tm_height = height;\r\n\t\tthis->markUpMatrix(); // Force recomputeCustom()\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIWebView::setEnabled(bool isEnabled) \r\n{\r\n\tCKLBUIElement::setEnabled(isEnabled);\r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIWebView::setUpperEnabled(bool isEnabled) \r\n{\r\n\tCKLBUIElement::setUpperEnabled(isEnabled);\r\n\tif (this->isEnabled()) {\r\n\t\tnativeInputItem->enable(true);\r\n\t} else {\r\n\t\tnativeInputItem->enable(false);\r\n\t}\r\n}\r\n\r\n//\r\n// Visible / Invisible related.\r\n//\r\n/*virtual*/\r\nvoid \r\nCKLBUIWebView::addRender() \r\n{\r\n\tCKLBUIElement::addRender();\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(true);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIWebView::removeRender() \r\n{\r\n\tCKLBUIElement::removeRender();\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->visible(false);\r\n\t}\r\n}\r\n\r\n/*virtual*/\r\nvoid \r\nCKLBUIWebView::setAsset(CKLBAsset* /*pAsset*/, ASSET_TYPE /*mode*/) \r\n{\r\n\t// Do nothing, no asset display.\r\n}\r\n\r\n/*virtual*/\r\nbool \r\nCKLBUIWebView::processAction(CKLBAction* /*pAction*/) \r\n{\r\n\t// Do nothing for now, may implement call back.\r\n\treturn false;\r\n}\r\n\r\nvoid \r\nCKLBUIWebView::setText(const char* text) \r\n{\r\n\tif (nativeInputItem) {\r\n\t\tnativeInputItem->setText(text);\r\n\t}\r\n}\r\n\r\nconst char*\t\r\nCKLBUIWebView::getText() \r\n{\r\n\tif (nativeInputItem) {\r\n\t\tsize_t len = nativeInputItem->getTextLength();\r\n\t\tif (!m_textBuf || len > m_textLen) {\r\n\t\t\tKLBDELETEA(m_textBuf);\r\n\t\t\tm_textLen = len;\r\n\t\t\tm_textBuf = KLBNEWA(char, m_textLen + 1);\r\n\t\t}\r\n\t\tnativeInputItem->getText(m_textBuf, m_textLen + 1);\r\n\t\treturn m_textBuf;\r\n\t}\r\n\treturn NULL;\r\n}\r\n\r\n"
  },
  {
    "path": "Engine/source/UISystem/CKLBWebViewNode.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __CKLB_UIWEBVIEW__\r\n#define __CKLB_UIWEBVIEW__\r\n\r\n#include \"CKLBUISystem.h\"\r\n\r\n/*!\r\n* \\class CKLBUIWebView\r\n* \\brief UI Web View Specialized Node Class\r\n* \r\n* CKLBUIWebView provides methods to manage a Web Viewer.\r\n*/\r\nclass CKLBUIWebView : public CKLBUIElement {\r\npublic:\r\n\tCKLBUIWebView(bool isPageJump, const char * initialURL = NULL,\r\n                  const char * token = NULL, const char * region = NULL, const char * client = NULL,\r\n                  const char * consumerKey = NULL, const char * applicationID = NULL, const char * userID = NULL);\r\n\t~CKLBUIWebView();\r\n\r\n\t// KLBObject::\r\n\tvirtual u32\tgetClassID\t    ()\t\t\t\t\t{ return CLS_KLBWEBVIEW; }\r\n\r\n\t// KLBNode::\r\n\tvirtual\tvoid recomputeCustom();\r\n\r\n\t//\r\n\t//\tCan interact with selection or not.\r\n\t//\r\n\tvirtual\tvoid setEnabled\t\t(bool isEnabled);\r\n\r\n\tvirtual bool isSelectable   () { return true; }\r\n\tvirtual void setAsset\t\t(CKLBAsset*\tpAsset, ASSET_TYPE mode);\r\n\tvirtual\tbool processAction\t(CKLBAction* pAction);\r\n\r\n\tvoid\t\tsetText\t\t\t(const char* text);\r\n\tconst char*\tgetText\t\t\t();\r\n    \r\n    void        setScalesPageToFit(bool scalesPageToFit) {\r\n        nativeInputItem->cmd(IWidget::WEB_SET_SCALESPAGETOFIT, scalesPageToFit);\r\n    }\r\n    \r\n    void        setBgColor      (u32 bgalpha, u32 bgcolor);\r\n\tvoid\t\tsetWidth\t\t(u32 width);\r\n\tvoid\t\tsetHeight\t\t(u32 heigth);\r\n\tu32\t\t\tgetWidth\t\t()\t{ return m_width;\t}\r\n\tu32\t\t\tgetHeight\t\t()\t{ return m_height;\t}\r\n    \r\n    inline IWidget *   getWidget() const { return nativeInputItem; }\r\n\r\nprotected:\r\n\tvirtual void setUpperEnabled(bool isEnabled);\r\n\r\n\t//\r\n\t// Visible / Invisible related.\r\n\t//\r\n\tvirtual void addRender\t\t();\r\n\tvirtual void removeRender\t();\r\n\r\n\tIWidget *   nativeInputItem;\r\n\tu32\t\t    m_width;\r\n\tu32\t\t    m_height;\r\n\ts32\t\t    m_tx;\r\n\ts32\t\t    m_ty;\r\n    u32         m_bgcolor;\r\n\r\n\tchar\t*\tm_textBuf;\r\n\tsize_t\t\tm_textLen;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/UISystem/IMgrEntry.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"IMgrEntry.h\"\r\n\r\nIMgrEntry * IMgrEntry::ms_begin = NULL;\r\nIMgrEntry * IMgrEntry::ms_end   = NULL;\r\n\r\nIMgrEntry::IMgrEntry(const char * name) \r\n: m_name    (name)\r\n, m_next    (NULL)\r\n, m_prev    (NULL)\r\n{\r\n\tm_next = ms_begin;\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = this;\r\n\t} else {\r\n\t\tms_end = this;\r\n\t}\r\n\tms_begin = this;\r\n}\r\n\r\nIMgrEntry::~IMgrEntry()\r\n{\r\n\tif(m_prev) {\r\n\t\tm_prev->m_next = m_next;\r\n\t} else {\r\n\t\tms_begin = m_next;\r\n\t}\r\n\tif(m_next) {\r\n\t\tm_next->m_prev = m_prev;\r\n\t} else {\r\n\t\tms_end = m_prev;\r\n\t}\r\n}\r\n\r\nbool\r\nIMgrEntry::exist()\r\n{\r\n\treturn true;\r\n}\r\n\r\nIMgrEntry *\r\nIMgrEntry::search(const char * name)\r\n{\r\n\t// 指定された名称を持つscroll managerを検索する\r\n\tIMgrEntry * pEntry = ms_begin;\r\n\twhile(pEntry) {\r\n        if(!strcmp(pEntry->m_name, name)) { break; }\r\n\t\tpEntry = pEntry->m_next;\r\n\t}\r\n\treturn pEntry;\r\n}\r\n\r\nCKLBScrollMgr *\r\nIMgrEntry::getMgr(const char * name, int argc, ...)\r\n{\r\n\t// 指定された名称を持つscroll managerを検索する\r\n\tIMgrEntry * pEntry = search(name);\r\n    if(!pEntry) { return NULL; }\r\n\r\n\tint * params = NULL;\r\n\tif(argc > 0) {\r\n\t\tparams = KLBNEWA(int, argc);\r\n\t\tva_list ap;\r\n\t\tva_start(ap, argc);\r\n\t\tfor(int i = 0; i < argc; i++) {\r\n\t\t\tparams[i] = va_arg(ap, int);\r\n\t\t}\r\n\t\tva_end(ap);\r\n\t}\r\n\tCKLBScrollMgr * mgr = pEntry->createManager(argc, params);\r\n\r\n\tKLBDELETEA(params);\r\n\r\n\treturn mgr;\r\n}\r\n\r\nCKLBScrollMgr *\r\nIMgrEntry::getMgrByArray(const char * name, int argc, int args[])\r\n{\r\n\tIMgrEntry * pEntry = search(name);\r\n    if(!pEntry) { return NULL; }\r\n\r\n\tCKLBScrollMgr * mgr = pEntry->createManager(argc, args);\r\n\r\n\treturn mgr;\r\n}\r\n\r\nCKLBScrollMgr *\r\nIMgrEntry::getMgrByProperty(CKLBPropertyBag * pProp)\r\n{\r\n\tconst char * name = pProp->getPropertyString(\"name\");\r\n\tIMgrEntry * pEntry = search(name);\r\n    if(!pEntry) { return NULL; }\r\n\r\n\tCKLBScrollMgr * mgr = pEntry->createManagerByProperty(pProp);\r\n\treturn mgr;\r\n}\r\n"
  },
  {
    "path": "Engine/source/UISystem/IMgrEntry.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CKLBLibScrollMgr_h\r\n#define CKLBLibScrollMgr_h\r\n\r\n#include \"klb_vararg.h\"\r\n#include \"CKLBScrollBarIF.h\"\r\n#include \"CKLBPropertyBag.h\"\r\n\r\nclass CKLBLibScrollMgr;\r\n\r\nclass IMgrEntry\r\n{\r\n\tfriend class CKLBLibScrollMgr;\r\npublic:\r\n\tIMgrEntry(const char * label);\r\n\tvirtual ~IMgrEntry();\r\n\r\n\tstatic CKLBScrollMgr * getMgr           (const char * name, int argc = 0, ...);\r\n\tstatic CKLBScrollMgr * getMgrByArray    (const char * name, int argc = 0, int args[] = NULL);\r\n\tstatic CKLBScrollMgr * getMgrByProperty (CKLBPropertyBag * pProp);\r\n\r\n\tvirtual bool exist();\r\n\r\nprotected:\r\n\tvirtual CKLBScrollMgr * createManager           (int argc, int args[])      = 0;\r\n\tvirtual CKLBScrollMgr * createManagerByProperty (CKLBPropertyBag * pProp)   = 0;\r\n\r\nprivate:\r\n\tstatic IMgrEntry * search(const char * name);\r\n\r\n\tconst char\t*\tm_name;\r\n\r\n\tIMgrEntry\t*\tm_prev;\r\n\tIMgrEntry\t*\tm_next;\r\n\r\n\tstatic IMgrEntry\t*\tms_begin;\r\n\tstatic IMgrEntry\t*\tms_end;\r\n};\r\n\r\n#endif // CKLBLibScrollMgr_h\r\n"
  },
  {
    "path": "Engine/source/include/CPFInterface.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*!\r\n  \\brief ポーティングレイヤインタフェース CPFInterface と、使用されるインタフェースクラス IClientRequest / iPlatformRequest\r\n  \\file  CPFInterface.h\r\n\r\n  ゲームの起動から実行、ゲーム側からのプラットフォーム機能利用までを含めた、ポーティングレイヤインタフェース。\r\n  ゲームの実行シーケンスは、\r\n\r\n  -# CPFInterface::setPlatformRequest() / IPlatformRequest実装をCPFInterfaceに登録\r\n  -# GameSetup() / ゲーム側スタートアップ関数呼び出し\r\n  -# GameSetup()内: CPFInterface::setClientRequest() / IClientRequest実装をCPFInterfaceに登録\r\n  .\r\n  -# CPFInterface::client().setScreenInfo() / 画面サイズをゲームに通知\r\n  -# CPFInterface::client().setFilePath() / データアクセスパスをゲームに通知\r\n  -# CPFInterface::client().initGame() / ゲーム初期化処理の呼び出し\r\n  .\r\n  となり、プラットフォーム側の実装はこの呼び出し順が保証されなければならない。\r\n  また、ゲーム側もこの順で実行されることを前提として実装される必要がある。\r\n\r\n  以上の起動シーケンスが終了した後, CPFInterFace::client().frameFlip() が毎フレームが呼び出される。\r\n  */\r\n#ifndef CPFInterface_h\r\n#define CPFInterface_h\r\n\r\n#include \"BaseType.h\"\r\n#include \"FileSystem.h\"\r\n#include \"OSWidget.h\"\r\n#include \"ITmpFile.h\"\r\n\r\n\r\ntypedef struct {\r\n\tfloat   width;\r\n\tfloat   height;\r\n\tfloat   ascent;\r\n\tfloat   descent;\r\n\tfloat   top;\r\n\tfloat   bottom;\r\n} STextInfo;\r\n\r\n\r\n//! ゲーム側設定関数\r\n/*\r\n   \\return ゲーム側設定の成否\r\n\r\n   C++関数。ゲームタイトル側で実装されるべき起動初期化関数。\r\n   ポーティング層は、CPFInterface のメソッドを呼び出すのに先駆け、必ずこの関数を呼ぶこと。\r\n\r\n   ゲーム(マルチプラットフォーム側)では、実装したIClientRequest派生クラスをこの関数の中で CPFInterface に登録する。\r\n   */\r\nbool GameSetup(void);\r\n\r\n//! ゲーム側インタフェースクラス\r\n/*!\r\n  プラットフォーム側から呼び出される処理をゲーム側で実装するためのインタフェース。\r\n  ゲーム(マルチプラットフォーム側)で内容を実装。\r\n  プラットフォーム側は、\r\n\r\n  -# setScreenInfo()\r\n  -# setFilePath()\r\n  -# initGame()\r\n\r\n  の順で呼び出してゲームの初期化を行い、毎フレーム frameFlip()を呼び出してゲームの実行を行うように実装される。\r\n  */\r\nclass IClientRequest\r\n{\r\npublic:\r\n\tstatic const int\tENGINE_USE_DEFAULTDB\t= 0x1;\r\n\tstatic const int\tENGINE_USE_DEFAULTFONT\t= 0x2;\r\n\r\n\tenum INPUT_TYPE {\r\n\t\tI_CLICK,    //!< マウスのクリック、タッチパネルのタップ動作\r\n\t\tI_DRAG,     //!< ドラッグ動作\r\n\t\tI_RELEASE,  //!< リリース動作(離す)\r\n\t\tI_CANCEL\t//!< Cancel event\r\n\t};\r\n\r\n\tenum EVENT_TYPE {\r\n\t\tE_PAUSE,\t\t// プロセスがポーズ状態になった\r\n\t\tE_RESUME,\t\t// プロセスがレジュームされた\r\n\t\tE_TEXTCHANGE,   // TextBox の文字列が変更された\r\n\t\tE_URLJUMP,      // Webのコマンドリンクが指定された\r\n\r\n\t\tE_DIDSTARTLOADWEB,  // Webのロードが開始された\r\n\t\tE_DIDLOADENDWEB,\t// Webのロードが終了した\r\n\t\tE_FAILEDLOADWEB,    // Webのロードが失敗した\r\n\r\n\t\tE_STORE_BAD_ITEMID,         // アイテムIDが無効\r\n\t\tE_STORE_PURCHASHING,        // 購入処理中\r\n\t\tE_STORE_PURCHASHED,         // 購入処理終了\r\n\t\tE_STORE_FAILED,             // 購入処理失敗\r\n\r\n\t\tE_STORE_RESTORE,            // リストア終了\r\n\t\tE_STORE_RESTORE_FAILED,     // リストア失敗\r\n\t\tE_STORE_RESTORE_COMPLETED,  // 全リストア終了\r\n\r\n\t\tE_STORE_GET_PRODUCTS, // ProductListの取得.\r\n\r\n\t\t// サウンドステータス\r\n\t\tE_SOUND_STATE_PLAY,             // サウンド再生中\r\n\t\tE_SOUND_STATE_STOP,             // サウンド停止中\r\n\t\tE_SOUND_STATE_PAUSE,            // サウンド一時停止中\r\n\t\tE_SOUND_STATE_INVALID_HANDLE,   // サウンドハンドル無効\r\n\r\n\t\t// サウンドのミュージックとの並行処理タイプlua定数\r\n\t\tE_SOUND_MULTIPROCESS_MUSIC_CUT,     // ゲームサウンドが再生される際に、iPodミュージックを停止\r\n\t\tE_SOUND_MULTIPROCESS_SOUND_CUT,     // iPodミュージックが再生されている際に、ゲーム中のサウンドを全カット\r\n\t\tE_SOUND_MULTIPROCESS_SOUND_BGM_CUT, // iPodミュージックが再生されている際に、ゲーム中のBGMサウンドを全カット\r\n\t};\r\n\r\n\tstatic const u32 KEY_BACK = 0x00000001;\r\n\tstatic const u32 KEY_MENU = 0x00000002;\r\n\r\n\tstatic const char KEYEVENT_PRESS = 0x01;\r\n\tstatic const char KEYEVENT_RELEASE = 0x02;\r\n\tstatic const char KEYEVENT_CLICK = 0x03;\r\n\tIClientRequest();\r\n\tvirtual ~IClientRequest();\r\n\r\n\t\r\n\t//! ゲーム初期化処理\r\n\t/*!\r\n\t\tSend parameters from OS launch application to engine.\r\n\t\tWe keep the design generic as option and parameters could vary based\r\n\t\ton version of the engine.\r\n\t  */\r\n\tvirtual void setInitParam(u32 param, void* complexSetup) = 0;\r\n\r\n\t//! ゲーム初期化処理\r\n\t/*!\r\n\t  ゲームの初期化処理を記述。\r\n\t  描画やスクリプトエンジンのようなシステムタスクの起動や、各種初期値の指定など、ゲームの初期化を行う。\r\n\t  */\r\n\tvirtual bool initGame() = 0;\r\n\r\n\t//! ゲーム終了処理\r\n\t/*!\r\n\t  ゲーム起動中に確保されたリソースをすべて破棄する。\r\n\t  アプリケーション終了のタイミングでプラットフォーム側から呼び出される。\r\n\t  */\r\n\tvirtual void finishGame() = 0;\r\n\r\n\t//! 画面情報通知\r\n\t/*!\r\n\t  \\param orientationFlip   横(False)・立て(True)画面\r\n\t  \\param width             水平方向の解像度\r\n\t  \\param height            垂直方向の解像度\r\n\r\n\t  プラットフォーム側から、使用可能な画面解像度についての情報が通知される際に呼び出される。\r\n\t  通知された情報はシステム側で保持する必要がある。\r\n\t  */\r\n\tvirtual bool setScreenInfo(bool orientationFlip, int width, int height) = 0;\r\n\r\n\t//! データアクセスパス\r\n\t/*!\r\n\t  \\param pStr  パス文字列\r\n\r\n\t  ゲームが利用するデータのアクセスに必要なパス文字列が渡される。\r\n\t  プラットフォームによって該当する文字列データが無い場合、動作に影響を与えない文字列が渡される。\r\n\t  */\r\n\tvirtual bool setFilePath(const char * pStr) = 0;\r\n\r\n\t//! フレーム更新\r\n\t/*!\r\n\t  \\param　dTime  直前のフレームからの経過時間(単位 [ms])\r\n\r\n\t  毎フレームの更新タイミングで呼び出される。\r\n\t  この中でフレーム処理(CKLBTaskMgr.execute()等)を呼び出すことでゲームが動作する。\r\n\t  */\r\n\tvirtual bool frameFlip(u32 dTime) = 0;\r\n\r\n\t/**\r\n\t  ゲームのフレームレートを決まる。\r\n\t  一フレーム当たりのミニマムの実行時間を設定する。\r\n\t  Defaultは16ms (1000 / 16 = 62fps)\r\n\t  */\r\n\tvirtual s32  getFrameTime() = 0;\r\n\tvirtual void setFrameTime(s32 time) = 0;\r\n\r\n\t//! ポインティングデバイス入力\r\n\t/*!\r\n\t  \\param  id     入力されたポイントのID\r\n\t  \\param  type   入力のタイプ\r\n\t  \\param  x      入力があった座標\r\n\t  \\param  y      入力があった座標\r\n\r\n\t  マウスやタッチパネルなど、ポインティングデバイスによる入力があった際に、プラットフォームレイヤから呼び出される。\r\n\t  これらの入力はフレーム駆動と非同期に行われるため、ゲーム側はこれを適切に処理しなければならない。\r\n\t  */\r\n\tvirtual void inputPoint(int id, INPUT_TYPE type, int x, int y) = 0;\r\n\r\n\t//! input by device buttons\r\n\t/*!\r\n\t  \\param keyId\t\tdevice key ID\r\n\t  \\param eventType\tinput event type\r\n\t */\r\n\tvirtual void inputDeviceKey(int keyId, char eventType) = 0;\r\n\r\n\t/*!\r\n\t  OSにより生成されたコントロールからのイベント等が通知される。TextBoxの文字列変更や、特殊URLジャンプなど。\r\n\t  */\r\n\tvirtual void controlEvent(EVENT_TYPE type, IWidget * pWidget,\r\n\t\t\tsize_t datasize1, void * pData1, size_t datasize2, void * pData2) = 0;\r\n\r\n\ttypedef enum {\r\n\t\tLEFT_TOP,\t\t// 原点は左上(反時計廻りに0°)\r\n\t\tLEFT_BOTTOM,\t// 原点は左下(反時計廻りに90°)\r\n\t\tRIGHT_BOTTOM,\t// 原点は右下(反時計廻りに180°)\r\n\t\tRIGHT_TOP\t\t// 原点は右上(反時計廻りに270°)\r\n\t} ORIGIN;\r\n\r\n\ttypedef enum {\r\n\t\tPORTRAIT,\t\t// 縦長の画面\r\n\t\tLANDSCAPE\t\t// 横長の画面\r\n\t} SCRMODE;\r\n\r\n\t//! 画面ローテーション通知\r\n\t/*!\r\n\t  \\param origin\t新たな原点\r\n\t  \\param mode\t\t新たな画面の縦横方向\r\n\r\n\t  \\return その画面ローテーションを許可する場合はtrue, 禁止の場合はfalse\r\n\r\n\t  プラットフォームレイヤから、端末の回転を通知し、回転動作の可否を問い合わせるために呼び出されます。\r\n\t  回転動作を許可する際は true を、禁止する場合は false を返します。\r\n\r\n\t  基本的には新たな画面比率が縦長か横長かだけを通知します。\r\n\t  具体的な画面サイズは、許可されて回転動作が完了した後、changeScreenInfo()で通知されます。\r\n\t  */\r\n\tvirtual bool reportScreenRotation(ORIGIN origin, SCRMODE mode) = 0;\r\n\r\n\r\n\t//! 画面比率変更通知\r\n\t/*!\r\n\t  \\param origin\t新たな原点の位置\r\n\t  \\param width\torigin が 0 のときの画面幅\r\n\t  \\param height\torigin が 0 のときの画面高\r\n\t  回転動作の終了後に確定した、新たな画面の向きと、向きが 0 のときの幅/高さを通知します。\r\n\r\n\t  もともと回転に対応しており、GL側が回転後の上下を把握して設定を変更する環境の場合は、\r\n\t  幅、高さだけが更新されて通知されます。\r\n\t  */\r\n\tvirtual void changeScreenInfo(ORIGIN origin, int width, int height) = 0;\r\n\r\n\t//! ゲームリブート\r\n\t/*!\r\n\t  ゲームを最初から実行しなおします。\r\n\t  */\r\n\tvirtual void reboot\t\t\t() = 0;\r\n\r\n\tvirtual bool executeCommand\t(const char* command) = 0;\r\n\r\n\tvirtual void resetViewport\t() = 0;\r\n\r\n\tvirtual int  getPhysicalScreenWidth\t() = 0;\r\n\tvirtual int  getPhysicalScreenHeight() = 0;\r\n\tvirtual void pauseGame\t\t(bool pause) = 0;\r\n\r\n\tvirtual FILE* getShellOutput() = 0;\r\n\tvirtual void  setShellOutput(FILE* file) = 0;\r\n};\r\n\r\n//! プラットフォーム側インタフェースクラス\r\n/*!\r\n  ゲームから呼び出すことで使用されるプラットフォーム側の機能を、\r\n  プラットフォーム側で実装するためのインタフェースクラス。\r\n  */\r\nclass IPlatformRequest\r\n{\r\npublic:\r\n\tIPlatformRequest();\r\n\tvirtual ~IPlatformRequest();\r\n\r\n\tvirtual bool useEncryption() = 0;\r\n\r\n    // ゲーム側からプラットフォーム機能を呼び出す必要があるインタフェースは、\r\n    // こちらにそのインタフェースメソッドを実装する。呼び出しのタイミングは、ゲーム側の実装に依存する。\r\n\r\n\t//! 各プラットフォーム側デバッグ出力など\r\n\t/*!\r\n\t  \\param  format   printf形式のフォーマット文字列\r\n\r\n\t  指定された引数を printf 形式として、それぞれのプラットフォーム依存のデバッグ出力として出力する。\r\n\t  ゲーム側で実装された klb_assert マクロなどは、最終的にこのメソッドを使って出力される。\r\n\t  */\r\n\tvirtual void detailedLogging(const char * basefile, const char * functionName, int lineNo, const char * format, ...) = 0;\r\n\tvirtual void logging(const char * format, ...) = 0;\r\n    \r\n    // バンドルバージョン取得\r\n    virtual const char* getBundleVersion() = 0;\r\n\r\n\t//! ナノ秒時刻取得\r\n\t/*!\r\n\t  ナノ秒単位の時刻を取得します。\r\n\t  取得される時刻の EPOCH は環境によって異なりますが、返される値の差分で経過時間を計測することができます。\r\n\t  */\r\n\tvirtual  s64 nanotime() = 0;\r\n\r\n\t//! 読み込みストリーム要求\r\n\t/*!\r\n\t  \\param fileName    要求する読み込みストリームの仮想パス\r\n\t  \\return アクセス対象となるストリームインスタンスのポインタ。ストリームのオープンに失敗した場合は 0\r\n\r\n\t  ファイルやネットワーク、Webなど、データ読み込み対象となるストリームを開きます。\r\n\t  プラットフォーム間の差異を吸収するため、全てのプラットフォームにおいて共通の仮想パス表記が用いられます。\r\n\r\n\t  <scheme>:<location>\r\n\r\n\t  <scheme>は、ストリームの種類を表します。\r\n\r\n\t  - file\r\n\t  - ファイルを対象とします。<location>はファイルセグメントと、各セグメント内でのパスとなります。\r\n\r\n\t  例) file://external/savedata.dat\r\n\t  　file://install/MAP_0001.dat\r\n\t  　file://asset/assetdata.dat\r\n\r\n\t  scheme が file:// の場合、一段目はファイルセグメントになります。install は読み出しのみが許可される\r\n\t  システムデータ、external は読み書き可能なファイルです。asset が指定された場合、対象のファイルを\r\n\t  external から探し、見つからなければ install を探しにいきます。install ファイルに問題が見つかった場合など、\r\n\t  修正パッチの配布に利用されることが想定されます。\r\n\t  .\r\n\t  - sock\r\n\t  - ソケットを対象とします。<location>は対象ホストのIPアドレスまたはFQDNとポートになります。\r\n\t  例) sock://192.168.0.1:5432\r\n\t  　sock://www.apple.com:80\r\n\t  .\r\n\t  - http/https\r\n\t  - HTTPまたはHTTPSによるリソースを対象とします。<location>はURIの scheme を除いたものとなります。\r\n\t  つまり、通常のURIを記述すれば、そのまま対象のリソースをアクセスできます。\r\n\r\n\t  例) http://www.google.co.jp/\r\n\t  .\r\n\t  */\r\n\tvirtual IReadStream* openReadStream(const char* fileName, bool decrypt) = 0;\r\n\r\n\r\n\tvirtual ITmpFile *\topenTmpFile\t\t\t\t(const char * filePath) = 0;\r\n\tvirtual void\t\tremoveTmpFile\t\t\t(const char * filePath) = 0;\r\n\tvirtual bool\t\tremoveFileOrFolder\t\t(const char * filePath) = 0;\r\n    virtual void\t\texcludePathFromBackup\t(const char * path)\t\t= 0;\r\n\tvirtual u32\t\t\tgetFreeSpaceExternalKB\t() = 0;\r\n\tvirtual u32\t\t\tgetPhysicalMemKB\t\t() = 0;\r\n\r\n\tvirtual void*\t\tifopen\t(const char* name, const char* mode) = 0;\r\n\tvirtual void\t\tifclose\t(void* file) = 0;\r\n\tvirtual int\t\t\tifseek\t(void* file, long int offset, int origin) = 0;\r\n\tvirtual u32\t\t\tifread\t(void* ptr, u32 size, u32 count, void* file ) = 0;\r\n\tvirtual u32\t\t\tifwrite\t(const void * ptr, u32 size, u32 count, void* file) = 0;\r\n\tvirtual int\t\t\tifflush\t(void* file) = 0;\r\n\tvirtual long int\tiftell\t(void* file) = 0;\r\n\tvirtual bool\t\ticreateEmptyFile(const char* name) = 0;\r\n\r\n    //! オーディオデータのロード\r\n    /*!\r\n     \\param url     ロードするオーディオデータの所在(suffix除く)\r\n     \\return        アクセス用ハンドル(void 型ポインタ)\r\n     \r\n     指定されたオーディオデータをオープンし再生の準備をした上、アクセス用のポインタをハンドルとして取得します。\r\n     オーディオのファイル形式はプラットフォームに依存するため、urlにはsuffix(もしくは拡張子)無しのパスを指定します。\r\n     また、同じ理由でゲームエンジン側からは直接オーディオデータそのものを参照することはできません\r\n\r\n     オーディオデータはプラットフォーム側が管理し、その管理領域にアクセスするためのポインタのみが返されます。\r\n     ポインタの先で示される領域の実装についてはプラットフォーム側に依存し、ゲーム側でその実装に依存するコードを書くことは推奨されません。\r\n     */\r\n    virtual void*   loadAudio(const char* url, bool is_se = false) = 0;\r\n    \r\n    //! オーディオデータのオンメモリ化\r\n    /*!\r\n     \\param handle  loadAudio() で取得されたオーディオデータ管理領域\r\n     \\return オンメモリ化が正常終了した場合は true, 失敗した場合は false\r\n     \r\n     指定されたオーディオデータをメモリ上に展開し、即時再生できるようにします。\r\n     ゲーム中のSEなどは短い上に頻繁に再生されるデータですが、これらをストレージから読みながら再生すると\r\n     再生開始まで時間がかかることがあります。こうしたSEデータをあらかじめメモリ上に展開し、\r\n     いつでも即時再生できるよう準備するために使用されます。\r\n     */\r\n    virtual bool    preLoad(void* handle) = 0;\r\n    \r\n    \r\n    //! BGMオーディオデータのバッファサイズ指定\r\n    /*!\r\n     \\param handle  loadAudio() で取得されたオーディオデータ管理領域\r\n     \\param level   バッファサイズ指定。0(小) 〜 2(大) で指定。\r\n     \\return オンメモリ化が正常終了した場合は true, 失敗した場合は false\r\n \r\n     指定されたオーディオデータをBGMとして再生する際の、再生バッファサイズを大中小の3段階で選びます。\r\n     指定されたサイズが具体的にどのように用いられるかはプラットフォームによって異なります。\r\n     これを指定しない場合のデフォルトバッファサイズは 1(中)と同等でなければなりません。\r\n     */\r\n    virtual bool    setBufSize(void * handle, int level) = 0;\r\n    \r\n    //! オーディオデータの再生\r\n    /*!\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n\r\n     handleで指定されたオーディオデータの再生を開始します。\r\n     */\r\n    virtual void    playAudio(void* handle, s32 _msec=0, float _tgtVol=1.0f, float _startVol=1.0f) = 0;\r\n    \r\n    //! 再生中オーディオ再生の停止\r\n    /*!\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     \r\n     handleで指定されたオーディオデータが現在再生中の場合、そのデータの再生を停止します。\r\n     再生中でなければ何もしません。\r\n     */\r\n    virtual void    stopAudio(void* handle, s32 _msec=0, float _tgtVol=0.0f) = 0;\r\n\r\n    \r\n    //! オーディオ全体のボリューム設定\r\n    /*!\r\n     \\param volume ボリューム値。0.0f〜1.0fの間で指定。\r\n     \\param SEmode falseでBGM全体のボリューム設定。trueでSE全体のボリューム設定。\r\n     \r\n     BGMあるいはSE全体のレベルでボリュームを設定する。\r\n     実際の再生ボリュームは、このAPIで設定したボリューム値に、各オーディオデータ個別のボリューム値を掛けた値となる。\r\n     \r\n     SEmode が false の場合はBGMに対するボリューム設定となり、\r\n     個別のオーディオデータのうちpreLoad()でオンメモリ化されていないもののみが影響を受けます。\r\n     \r\n     SEmode が true の場合、SEに対するボリューム設定となり、\r\n     preLoad() でオンメモリ化されたオーディオデータのみが影響を受けます。\r\n     */\r\n    virtual void    setMasterVolume(float volume, bool SEmode) = 0;\r\n    \r\n    \r\n    //! 各オーディオハンドル単位のボリューム設定\r\n    /*!\r\n     */\r\n    virtual void    setAudioVolume(void * handle, float volume) = 0;\r\n    \r\n    //! オーディオのパン設定\r\n    virtual void    setAudioPan(void * handle, float pan) = 0;\r\n\r\n    \r\n    //! オーディオデータの解放\r\n    /*!\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータを解放します。\r\n     */\r\n    virtual void    releaseAudio(void* handle) = 0;\r\n\r\n    //! オーディオ一時停止\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータ再生を一時停止します。\r\n     */\r\n    virtual void pauseAudio(void * handle, s32 _msec=0, float _tgtVol=0.0f) = 0;\r\n    \r\n    //! オーディオ再生再開\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータが一時停止しているときに再生を再開します。\r\n     */\r\n    virtual void resumeAudio(void * handle, s32 _msec=0, float _tgtVol=1.0f) = 0;\r\n\r\n    //! オーディオ再生時刻移動\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータが一時停止しているときに再生を再開します。\r\n     */\r\n    virtual void seekAudio(void * handle, s32 millisec) = 0;\r\n\r\n    \r\n    //! オーディオ再生時刻取得\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータにおける現在の再生位置時刻をミリ秒単位で取得します。\r\n     ただし、環境によって取得できる時刻の分解能は異なり、原則「再生系によって検知された最新の時刻」を返します。\r\n     */\r\n    virtual s32  tellAudio(void * handle) = 0;\r\n    \r\n    \r\n    //! オーディオ合計演奏取得\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータにおける現在の合計演奏時間をミリ秒単位で取得します。\r\n     */\r\n    virtual s32  totalTimeAudio(void * handle) = 0;\r\n    \r\n    //! オーディオステータス取得\r\n    /*\r\n     \\param handle  loadAudio()で取得されたオーディオデータ管理領域\r\n     handleで指定された、現在ロードされているオーディオデータの状態を取得します。\r\n     */\r\n    virtual s32  getState(void * handle) = 0;\r\n    \r\n    //! オーディオにフェードステータスを設定\r\n    /*\r\n     \\param _handle     loadAudio()で取得されたオーディオデータ管理領域\r\n     \\param _tgtVol     目標のフェード値(0.0f~1.0f)\r\n     \\param _msec       フェードにかかる時間(ミリ秒)\r\n     handleで指定された、現在ロードされているオーディオデータにフェード処理を追加\r\n     */\r\n    virtual void setFadeParam(void * _handle, float _tgtVol, u32 _msec) = 0;\r\n    \r\n    //! サウンドとミュージックの並行処理タイプ設定\r\n    virtual void setAudioMultiProcessType( s32 _processType ) = 0;\r\n    \r\n    //! サウンドの割り込み処理をOSに依存するかどうか\r\n    virtual void setPauseOnInterruption(bool _bPauseOnInterruption) = 0;\r\n    \r\n    //! OS起動からの経過時間を取得\r\n    virtual s64 getElapsedTime( void ) = 0;\r\n    \r\n\tvirtual\tbool registerFont(const char* logicalName, const char* physFile, bool default_) = 0;\r\n\r\n    //! フォントオブジェクト取得\r\n    virtual void * getFont(int size, const char * fontName = 0, float* pAscent = NULL) = 0;\r\n    \r\n    //! フォントオブジェクト破棄\r\n    virtual void deleteFont(void * pFont) = 0;\r\n\r\n\t//! フォントオブジェクト取得\r\n    virtual void * getFontSystem(int size, const char * fontName = 0) = 0;\r\n    \r\n    //! フォントオブジェクト破棄\r\n    virtual void deleteFontSystem(void * pFont) = 0;\r\n    \r\n    //! フォントテクスチャ描画\r\n    virtual bool renderText(const char* utf8String, void * pFont, u32 color,    //!< 描画する文字列とフォントの指定\r\n                            u16 width, u16 height, u8 * pBuffer8888,            //!< 描画対象とするテクスチャバッファとそのピクセルサイズ\r\n                            s16 stride, s16 base_x, s16 base_y, bool use4444 = false) = 0;            //!< baseline起点とするテクスチャ内の位置\r\n\r\n    virtual bool getTextInfo(const char* utf8String, void * pFont, STextInfo* pReturnInfo) = 0;\r\n\r\n\r\n\t//! 指定アセットパスを各プラットフォーム上のフルパスに変換した文字列を返す。\r\n\t// 返された文字列は、別途 delete [] で削除の必要がある。\r\n\tvirtual const char * getFullPath(const char * assetPath, bool* isReadOnly=NULL) = 0;\r\n\r\n\t//! 動作環境情報文字列を返す。\r\n\tvirtual const char * getPlatform() = 0;\r\n\r\n\t//! eglGetProcAddress() 相当の処理を行う\r\n\tvirtual void * getGLExtension(const char * ext) = 0;\r\n\r\n\t//! OS機能によるコントロール配置\r\n\t/*!\r\n\t  \\param type\t\t生成するコントロールのタイプ\r\n\t  \\param id\t\tコントロールに与えるID\r\n\t  \\param caption\tコントロールに与えるcaption値\r\n\t  \\param x\t\tコントロールを配置する位置\r\n\t  \\param y\t\tコントロールを配置する位置\r\n\t  \\param width\tコントロールのサイズ\r\n\t  \\param height\tコントロールのサイズ\r\n\r\n\t  OS機能を利用してコントロールを生成します。\r\n\t  指定された位置やサイズは最大限努力はされますが、\r\n\t  指定された位置/サイズと完全に合致しないことがあります。\r\n\t  */\r\n\tvirtual IWidget * createControl(IWidget::CONTROL type, int id,\r\n\t\t\tconst char * caption, int x, int y, int width, int height, ...) = 0;\r\n\r\n\t//! OS機能によるコントロールの破棄\r\n\t/*!\r\n\t  \\param pControl createControl()の戻り値として返されたcontrolハンドルとなるポインタ\r\n\r\n\t  createControl()で生成したコントロールを破棄します。\r\n\t  */\r\n\tvirtual void destroyControl(IWidget * pControl) = 0;\r\n\r\n\r\n\tenum APP_TYPE {\r\n\t\tAPP_MAIL,\r\n\t\tAPP_BROWSER,\r\n\t\tAPP_UPDATE,\t\t// アプリケーションのアップデートが可能なアプリ(iOSならAppStore)\r\n\t};\r\n\r\n\t//! OSアプリケーションの起動\r\n\t/*!\r\n\t  \\param type 起動するアプリケーションのタイプ。実際に何が起動されるかはプラットフォーム依存だが、そのタイプを適切にこなせるものである必要がある。\r\n\r\n\t  createControl()で生成したコントロールを破棄します。\r\n\t  */\r\n\tvirtual bool callApplication(APP_TYPE type, ... ) = 0;\r\n\r\n\r\n\t//! スレッド起動\r\n\t/*!\r\n\r\n*/\r\n\tvirtual void *\tcreateThread\t(s32 (*thread_func)(void * hThread, void * data), void * data) = 0;\r\n\tvirtual void\texitThread\t\t(void * hThread, s32 status)   = 0;\r\n\tvirtual bool\twatchThread\t\t(void * hThread, s32 * status) = 0;\r\n\tvirtual void\tdeleteThread\t(void * hThread) = 0;\r\n\tvirtual void\tbreakThread\t\t(void * hThread) = 0;\r\n\r\n\tvirtual int\t\tgenUserID\t\t(char * retBuf, int maxlen) = 0;\r\n\tvirtual int\t\tgenUserPW\t\t(const char * salt, char * retBuf, int maxlen) = 0;\r\n\r\n\tvirtual bool\treadyDevID\t\t() = 0;\r\n\tvirtual int\t\tgetDevID\t\t(char * retBuf, int maxlen) = 0;\r\n\tvirtual bool\tsetSecureDataID\t(const char * service_name, const char * user_id)\t\t= 0;\r\n\tvirtual bool\tsetSecureDataPW\t(const char * service_name, const char * passwd)\t\t= 0;\r\n\tvirtual int\t\tgetSecureDataID\t(const char * service_name, char * retBuf, int maxlen)  = 0;\r\n\tvirtual int\t\tgetSecureDataPW\t(const char * service_name, char * retBuf, int maxlen)  = 0;\r\n\tvirtual bool\tdelSecureDataID\t(const char * service_name) = 0;\r\n\tvirtual bool\tdelSecureDataPW\t(const char * service_name) = 0;\r\n\r\n\t//! ストア機能\r\n\t//! トランザクション監視開始\r\n\tvirtual void initStoreTransactionObserver() = 0;\r\n\t//! トランザクション監視終了\r\n\tvirtual void releaseStoreTransactionObserver() = 0;\r\n\t//! 購入要求: アイテムIDと、その数を渡す\r\n\tvirtual void buyStoreItems(const char * item_id) = 0;\r\n\t//! プロダクトリスト取得要求: アイテムIDの配列とその数、及びcurrency表示にするかの判定とcallbackを渡す.\r\n\tvirtual void getStoreProducts(const char* json, bool currency_mode) = 0;\r\n\t//! サーバー通信後にトランザクションを閉じて購入処理を確定させる。\r\n\tvirtual void finishStoreTransaction(const char* receipt) = 0;\r\n\r\n\tvirtual void*\tallocMutex\t\t() = 0;\r\n\tvirtual void\tfreeMutex\t\t(void* mutex) = 0;\r\n\tvirtual void\tmutexLock\t\t(void* mutex) = 0;\r\n\tvirtual void\tmutexUnlock\t\t(void* mutex) = 0;\r\n\r\n\tvirtual void*\tallocEventLock\t() = 0;\r\n\tvirtual void\tfreeEventLock\t(void* lock) = 0;\r\n\tvirtual void\teventSleep\t\t(void* lock) = 0;\r\n\tvirtual void\teventWakeup\t\t(void* lock) = 0;\r\n\t\r\n\tvirtual void\tstartAlertDialog( const char* title , const char* message ) = 0;\r\n\r\n\tvirtual void\tforbidSleep\t\t(bool is_forbidden) = 0;\r\n};\r\n\r\n#ifdef DEBUG\r\n# \r\n# define DEBUG_PRINT(...) CPFInterface::getInstance().platform().detailedLogging(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)\r\n#else\r\n# define DEBUG_PRINT(...) \r\n#endif\r\n\r\n//!\r\n/*!\r\n  プラットフォーム側とゲーム側のインタフェースとなる Singleton.\r\n  両者のやり取りは必ず CPFInterface インスタンスを介して行われる。\r\n\r\n  初期化シーケンス:\r\n  -# CPFInterface::setPlatformRequest() / IPlatformRequest実装をCPFInterfaceに登録\r\n  -# GameSetup() / ゲーム側スタートアップ関数呼び出し\r\n  -# GameSetup()内: CPFInterface::setClientRequest() / IClientRequest実装をCPFInterfaceに登録\r\n  .\r\n  -# CPFInterface::client().setScreenInfo() / 画面サイズをゲームに通知\r\n  -# CPFInterface::client().setFilePath() / データアクセスパスをゲームに通知\r\n  -# CPFInterface::client().initGame() / ゲーム初期化処理の呼び出し\r\n  .\r\n  また、ゲームの実行は毎フレームプラットフォーム側から CPFInterface::client.flipFrame()を呼び出すことで行われる。\r\n  */\r\nclass CPFInterface\r\n{\r\nprivate:\r\n\tstatic CPFInterface * instance;\r\n\tIClientRequest * m_pClient;\r\n\tIPlatformRequest * m_pPlatform;\r\nprivate:\r\n\tCPFInterface();\r\n\tvirtual ~CPFInterface();\r\npublic:\r\n\r\n\t//! インスタンス取得\r\n\t/*!\r\n\t  \\return Singletonインスタンスへの参照\r\n\r\n\t  Singletonインスタンスへの参照を取得する。\r\n\t  ゲーム側、プラットフォーム側いずれでも使用される。\r\n\t  */\r\n\tstatic CPFInterface& getInstance();\r\n\r\n\t//! ゲーム側インタフェースの登録\r\n\t/*!\r\n\t  \\param pClient  クライアント側インタフェースのポインタ\r\n\r\n\t  プラットフォーム側からゲーム側をコールする際に使用されるインタフェースを登録する。\r\n\t  IClientRequest(Client側Strategy)を受け取り設定する\r\n\t  */\r\n\tvoid setClientRequest(IClientRequest * pClient) {\r\n\t\tm_pClient = pClient;\r\n\t}\r\n\r\n\t//! プラットフォーム側インタフェースの登録\r\n\t/*!\r\n\t  \\param pPlatform  プラットフォーム側インタフェースのポインタ\r\n\r\n\t  ゲーム側からプラットフォーム側をコールする際に使用されるインタフェースを登録する。\r\n\t  IPlatformRequest(Platform側Strategy)を受け取り設定する\r\n\t  */\r\n\tvoid setPlatformRequest(IPlatformRequest * pPlatform) {\r\n\t\tm_pPlatform = pPlatform;\r\n\t}\r\n\r\n\t//! ゲーム側インタフェースの参照取得\r\n\t/*!\r\n\t  \\return ゲーム側インタフェースへの参照\r\n\r\n\t  ゲーム側から指定されたインタフェースへの参照を取得する。\r\n\t  */\r\n\tinline IClientRequest& client() {\r\n\t\treturn *m_pClient;\r\n\t}\r\n\r\n\t//! プラットフォーム側インタフェースの参照取得\r\n\t/*!\r\n\t  \\return プラットフォーム側インタフェースへの参照\r\n\r\n\t  プラットフォーム側から指定されたインタフェースへの参照を取得する。\r\n\t  */\r\n\tinline IPlatformRequest& platform() {\r\n\t\treturn *m_pPlatform;\r\n\t}\r\n\r\n\t//! エンディアン確認\r\n\t/*!\r\n\t  \\return  ビッグエンディアンのときは true, リトルエンディアンのときは false\r\n\t  実行環境のエンディアンを調査する。\r\n\t  */\r\n\tbool isBigEndian();\r\n\r\n\tinline bool isClient\t() const { return (m_pClient != 0);\t\t}\r\n\tinline bool isPlatform\t() const { return (m_pPlatform != 0);\t}\r\n};\r\n\r\n#endif // CPFInterface_h\r\n"
  },
  {
    "path": "Engine/source/include/CSoundAnalysis.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n/*\r\n @file      CSoundAnalysis.h\r\n @brief     サウンドファイルの解析など\r\n*/\r\n\r\n#ifndef __SOUND_ANALYSIS_H__\r\n#define __SOUND_ANALYSIS_H__\r\n\r\n#include \"BaseType.h\"\r\n\r\n/*\r\n @enum  eBITRATE_TYPE\r\n */\r\nenum eBITRATE_TYPE\r\n{\r\n    eBITRATE_TYPE_NONE = -1,\r\n    \r\n    eBITRATE_TYPE_VBR = 0,  // 可変ビットレート\r\n    eBITRATE_TYPE_CBR,      // 固定ビットレート\r\n    eBITRATE_TYPE_ABR,      // 平均ビットレート\r\n    \r\n    eBITRATE_TYPE_MAX,\r\n};\r\n\r\n/*\r\n @struct sSoundAnalysisData\r\n */\r\ntypedef struct strSoundAnalysisData\r\n{\r\n    eBITRATE_TYPE   m_bitRateType;  //!< ビットレートのタイプ(固定,可変,平均)\r\n    s16             m_bitRate;      //!< ビットレート(単位:kbps)\r\n    u16             m_samplingRate; //!< サンプリングレート(単位:kHz)\r\n    s32             m_totalFrame;   //!< サウンドの再生フレーム数\r\n    s64             m_totalTime;    //!< サウンドの再生時間(ミリ秒)\r\n} sSoundAnalysisData;\r\n\r\n\r\n/*\r\n @brief  サウンドファイルのいろいろな情報を取得\r\n @param[in]     const char* _path          サウンドファイル名\r\n @param[out]    sSoundAnalysisData* _data  指定サウンドファイルのいろいろな情報格納用\r\n @return        void\r\n */\r\nbool GetSoundAnalysisData( const char* _path, sSoundAnalysisData* _data );\r\n\r\n/*\r\n @brief  サウンドファイルの演奏時間を取得\r\n @param[in]  const char* _path   サウンドファイル名\r\n @return     u32                 指定のサウンドファイルの演奏時間\r\n */\r\nu32 GetSoundTotalTime( const char* _path );\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/include/KLBPlatformMetricsCommon.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef KLBPlatformMetricsCommon_h\r\n#define KLBPlatformMetricsCommon_h\r\n\r\n// WARNING: this file should never included directly from Engine, nor from Porting layer.\r\n// You should always include \"KLBPlatformMetrics.h\" instead.\r\n\r\n// CPU usage measurement type constants\r\n// bits layout: abbbbbbbcccccccc\r\n//              a\t\t\t\t\t: begin/end flag; 0=begin, 1=end\r\n//               bbbbbbb\t\t\t: task type flag\r\n//                      cccccccc\t: subtask type flag\r\n#define TASKTYPE_BEGIN\t\t\t\t(0x0000)\r\n#define TASKTYPE_END\t\t\t\t(0x8000)\r\n#define TASKTYPE_LUA\t\t\t\t(0x0100)\r\n#define TASKTYPE_LUA_LOAD\t\t\t((TASKTYPE_LUA) | 0x01)\r\n#define TASKTYPE_LUA_EXEC\t\t\t((TASKTYPE_LUA) | 0x02)\r\n#define TASKTYPE_LUA_GC\t\t\t\t((TASKTYPE_LUA) | 0x03)\r\n#define TASKTYPE_TEX\t\t\t\t(0x0200)\r\n#define TASKTYPE_TEX_LOAD\t\t\t((TASKTYPE_TEX) | 0x10)\r\n#define TASKTYPE_TEX_LOAD_INFLATE\t((TASKTYPE_TEX_LOAD) | 0x1)\r\n#define TASKTYPE_TEX_LOAD_LOWCONV\t((TASKTYPE_TEX_LOAD) | 0x2)\r\n#define TASKTYPE_TEX_LOAD_OGL\t\t((TASKTYPE_TEX_LOAD) | 0x3)\r\n#define TASKTYPE_TEX_UPLOAD\t\t\t((TASKTYPE_TEX) | 0x20)\r\n#define TASKTYPE_SOUND\t\t\t\t(0x0300)\r\n#define TASKTYPE_SOUND_DECODE\t\t((TASKTYPE_SOUND) | 0x01)\r\n#define TASKTYPE_DRAW\t\t\t\t(0x0400)\r\n#define TASKTYPE_DRAW_ANIMATION\t\t((TASKTYPE_DRAW) | 0x10)\r\n\r\n// default (empty) macros. should be overridden using #undef inside platforms' \"KLBPlatformMetrics.h\".\r\n#define REPORT_METRICS(msg) \r\n#define MEASURE_THREAD_CPU_BEGIN(type) \r\n#define MEASURE_THREAD_CPU_END(type) \r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/include/RenderingFramework.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef __GL_WRAPPER__\r\n#define __GL_WRAPPER__\r\n\r\n#include \"BaseType.h\"\r\n#include \"CPFInterface.h\"\r\n#include \"glWrapper.h\"\r\n\r\n// #include \"icontrollable.h\"\r\n\r\n#define null\t\t(0)\r\n\r\n#define S_UNIFORM\t(0x0001)\r\n#define S_ATTRIBUTE\t(0x0002)\r\n#define S_CONSTANT\t(0x0003)\r\n\r\n#define\tS_INT\t\t(0x0010)\r\n#define S_FLOAT\t\t(0x0020)\r\n#define S_MATRIX\t(0x0030)\r\n\r\n#define S_SIZE1\t\t(0x0100)\r\n#define\tS_SIZE2\t\t(0x0200)\r\n#define S_SIZE3\t\t(0x0300)\r\n#define S_SIZE4\t\t(0x0400)\r\n\r\n#include \"assert_klb.h\"\r\n\r\n#define\tklb_assertm(s)\t\tklb_assertAlways(s)\r\n#define klb_assertc(c,s)\tklb_assert((int)(c),(s))\r\n\r\nclass CBuffer;\r\n\r\n//\r\n// Shader\r\n//\r\nstruct SParam;\r\nclass CShader;\r\nclass CShaderInstance;\r\nclass CShaderSet;\r\n\r\n//\r\n// Texture\r\n//\r\nclass CTextureBase;\r\nclass CTexture;\r\nclass CSubTexture;\r\nclass CTextureUsage;\r\n\r\n//\r\n// Main Manager\r\n//\r\nclass CKLBOGLWrapper;\r\n\r\n#define UNDEFINED_BOOL\t\t(2)\r\n#define TRUE_BOOL_U8\t\t(1)\r\n#define FALSE_BOOL_U8\t\t(0)\r\n\r\nenum DATA_TYPE {\r\n\tVEC1I\t\t= 0,\r\n\tVEC1F\t\t= 1,\r\n\tVEC2\t\t= 2,\r\n\tVEC3\t\t= 3,\r\n\tVEC4\t\t= 4,\r\n\tMMAT2\t\t= 5,\r\n\tMMAT3\t\t= 6,\r\n\tMMAT4\t\t= 7,\r\n\tTEX2D\t\t= 8,\r\n\tVEC4BYTE\t= 9,\r\n\t// --- 10,11,12,13,14,15 --- format are free.\r\n\t//\r\n\t// MSB 4 BIT IS BITMASK.\r\n\t//\r\n\tVERTEX\t\t= 0x00,\r\n\tCOLOR\t\t= 0x10,\r\n\tTEXTURE\t\t= 0x20,\r\n\tNORM\t\t= 0x30,\r\n\tEND_LIST\t= 0xFF\r\n};\r\n\r\nenum QUALITY_TYPE {\r\n\tLOWP\t\t= 1,\r\n\tMEDP\t\t= 2,\r\n\tHIGHP\t\t= 3\r\n};\r\n\r\nstruct SVertexEntry {\r\npublic:\r\n\ts32\t\t\t\tvertexInfoID;\r\n\ts32\t\t\t\toffset;\r\n\tbool\t\t\tisVBO;\r\n\tu8\t\t\t\ttype;\r\nprivate:\r\n\t// TODO.\r\n};\r\n\r\nstruct SParam {\r\npublic:\r\n\tconst char*\t\tname;\r\n\tbool\t\t\tisUniform;\r\n\ts32\t\t\t\tvertexORuniformID;\r\n\tu8\t\t\t\tdType;\r\n};\r\n\r\n// Able to use loader directly from code.\r\ns32 TGALoad( const char *fileName, char **buffer, s32 *width, s32 *height, bool load, bool swapXY);\r\n\r\n// Shader : \"name\" + type (Uniform/vertex + Format) + vertexLocationID\r\nclass CIndexBuffer {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tvoid\t\t\toverrideBuffer\t(u32 indexCount, u16* buffer);\r\n\tvoid\t\t\tload\t\t\t(short* pIndex, s32 startIndex, s32 count);\t\r\n\tshort*\t\t\tupdateStart\t\t(s32 startIndexIncluded);\r\n\tvoid\t\t\tupdateComplete\t(s32 endIndexExcluded);\r\n\tvoid\t\t\tsetDrawOffset\t(s32 index);\r\nprivate:\r\n\tCIndexBuffer*\tpNext;\r\n\tshort*\t\t\tptrBuffer;\t\t// Dynamic buffer.\r\n\tbool\t\t\tfromOutside;\r\n\r\n\tGLuint\t\t\tvboID;\r\n\r\n\tu16\t\t\t\toffsetDraw;\r\n\tshort\t\t\tVBOModifyStart;\r\n\tshort\t\t\tVBOModifyEnd;\r\n\tbool\t\t\tisVBO;\r\n\tbool\t\t\tVBOModified;\r\n\tbool\t\t\tVBOModifying;\r\n\r\n\tvoid\t\t\tcommitVBO\t\t();\r\n\r\n\tCIndexBuffer();\r\n\t~CIndexBuffer();\r\n};\r\n\r\nclass CBuffer {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tvoid\t\t\toverrideBuffer\t(u32 vertexCount, float* buffer); \r\n\tvoid\t\t\tload\t\t\t(float* vertexArrayStart, s32 vertexSize, s32 vertexInfoID, s32 startVertex, s32 count);\t\r\n\tfloat*\t\t\tupdateStart\t\t(s32 vertexInfoID, s32 startVertexIncluded, u16* stride, void* internalPtr = NULL); \r\n\tvoid\t\t\tupdateComplete\t(s32 endVertexExcluded);\r\n\tvoid\t\t\tsetDrawOffset\t(s32 index);\r\nprivate:\r\n\tCBuffer*\t\tpNext;\r\n\tfloat*\t\t\tptrBuffer;\t\t// Dynamic buffer.\r\n\tfloat*\t\t\tvboLocalCopy;\t// Dynamic local buffer.\r\n\tGLuint\t\t\tvboID;\r\n\r\n\tSVertexEntry*\tstructure;\r\n\tshort\t\t\tVBOModifyStart;\r\n\tshort\t\t\tVBOModifyEnd;\r\n\ts32\t\t\t\toffsetDrawVBO;\r\n\ts32\t\t\t\toffsetDrawDyn;\r\n\tu8\t\t\t\tstrideVBO;\r\n\tu8\t\t\t\tstrideDyn;\r\n\tu8\t\t\t\tvboCount;\r\n\tu8\t\t\t\tdynCount;\r\n\tbool\t\t\tVBOModified;\r\n\tbool\t\t\tVBOModifying;\r\n\tbool\t\t\tfromOutside;\r\n\tvoid\t\t\tcommitVBO\t\t();\r\n\r\n\tCBuffer();\r\n\t~CBuffer();\r\n};\r\n\r\n// #############################################################################\r\n//\r\n//   \r\n//    SHADER MANAGEMENT\r\n//\r\n//\r\n// #############################################################################\r\n\r\nclass CShader {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CShaderInstance;\r\n\tfriend class CShaderSet;\r\npublic:\r\n\t// Do nothing.\r\nprivate:\r\n\tstruct SInternalParam {\r\n\t\tSParam\t\t\tparam;\r\n\t//\ts32\t\t\t\tlocationID;\r\n\t};\r\n\r\n\tCShader*\t\tpNext;\r\n\tSInternalParam*\tarrayParam;\t\t\t// One Array, shared in two.\r\n\tGLuint\t\t\tshaderObj;\r\n\tu8\t\t\t\tcountUniform;\r\n\tu8\t\t\t\tcountStreamInfo;\r\n\tu8\t\t\t\trefCount;\r\n\r\n\tbool\t\t\tenableTexture;\r\n\tbool\t\t\tenableColor;\r\n\r\n\t// Invisible, only through factory.\r\n\tCShader();\r\n\t~CShader();\r\n};\r\n\r\nclass CShaderInstance {\r\n\tfriend class CShaderSet;\r\n\tfriend class CShader;\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tenum SHADER {\r\n\t\tVERTEX_SHADER = 0,\r\n\t\tPIXEL_SHADER  = 1\r\n\t};\r\n\r\n\tvoid\t\t\tsetUniformTexture\t\t(SHADER type, s32 uniformID, CTextureUsage*\tpTextureUsage);\r\n\tvoid\t\t\tsetUniformI\t\t\t\t(SHADER type, s32 uniformID, GLint* values  );\r\n\tvoid\t\t\tsetUniformF\t\t\t\t(SHADER type, s32 uniformID, GLfloat* values);\r\n\tvoid\t\t\tsetConstantifyVertex\t(s32 vertexID, GLfloat* values);\r\n\tvoid\t\t\tunConstantifyVertex\t\t(s32 vertexID);\r\n\r\nprivate:\r\n\tunion Float_I32\t{\r\n\t\tfloat\tf;\r\n\t\ts32\t\ti;\r\n\t};\r\n\r\n\tstruct SInternalParam {\r\n\t\tCTextureUsage*\tpTexture;\t\t// Store pointer become ID change at runtime.\r\n\t\tFloat_I32\t\tvalues[16];\t\t// Can store up to 4x4 matrices.\t\r\n\t\ts32\t\t\t\tvertexInfoID;\r\n\t\tu8\t\t\t\tisConstantifiedOrUniform;\r\n\t\tu8\t\t\t\tdType;\r\n\t};\r\n\r\n\tSInternalParam*\tparamArrayUniformPixelShader;\r\n\tSInternalParam*\tparamArrayUniformVertexShader;\r\n\tSInternalParam* paramArrayVertexVertexShader;\r\n\tCShaderSet*\t\tm_pShaderSet;\r\n\tCShaderInstance*\tpNext;\r\n\r\n\tbool\t\t\tenableTexture;\r\n\tbool\t\t\tenableColor;\r\n\r\n\t// Invisible, only through factory.\r\n\tCShaderInstance();\r\n\t~CShaderInstance();\r\n};\r\n\r\nclass CShaderSet {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CShaderInstance;\r\n\tfriend class CShader;\r\npublic:\r\n\tCShader*\t\t\tvertexShader;\r\n\tCShader*\t\t\tpixelShader;\r\n\r\n\tCShaderInstance*\tcreateInstance();\r\n\tvoid\t\t\t\treleaseInstance(CShaderInstance* pInstance);\r\nprivate:\r\n\tCShaderInstance*\tpInstances;\r\n\tCShaderSet*\t\t\tpNext;\r\n\tCKLBOGLWrapper*\t\tpMgr;\r\n\ts32*\t\t\t\tlocationArray;\r\n\tGLuint\t\t\t\tprogramObj;\r\n\r\n\tbool\t\t\t\tenableTexture;\r\n\tbool\t\t\t\tenableColor;\r\n\r\n\tvoid\t\t\t\treleaseAllInstances();\r\n\r\n\tCShaderSet();\r\n\t~CShaderSet();\r\n};\r\n\r\nclass CRenderState {\r\n\t// Z Buffer on / off / READ / WRITE / Z VALUE\r\n\t// Stencil\r\n\t// Blend operator setup\r\n};\r\n\r\nclass CImageBuffer {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CFrame;\r\npublic:\r\n\t// Publicly do nothing.\r\nprivate:\r\n\tCImageBuffer();\r\n\t~CImageBuffer();\r\n\t\r\n\tvoid incrementRefCount();\r\n\tvoid decrementRefCount();\r\n\r\n\tCImageBuffer* next;\t\r\n\tGLuint\tbuffer;\r\n\ts32\t\twidth;\r\n\ts32\t\theight;\r\n\tGLenum\tinternalFormat;\r\n\tu8\t\trefCounter;\r\n};\r\n\r\nclass CFrame {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tbool setColorBuffer\t\t(CImageBuffer*\tpBuffer);\r\n\tbool setColorBuffer\t\t(CTexture*\t\tpTexture, u32 mipLevel);\r\n\tbool setDepthBuffer\t\t(CImageBuffer*\tpBuffer);\r\n\tbool setDepthBuffer\t\t(CTexture*\t\tpTexture, u32 mipLevel);\r\n\tbool setStencilBuffer\t(CImageBuffer*\tpBuffer);\r\n\t\r\n\tbool use(bool check);\t// Allow user to verify that setup is correct, else return always true.\r\nprivate:\r\n\tCFrame();\r\n\t~CFrame();\r\n\r\n\tCFrame*\t\t\tnext;\r\n\tCImageBuffer*\tpColBufferBuf;\r\n\tCTexture*\t\tpColBufferTex;\r\n\tCImageBuffer*\tpDepthBufferBuf;\r\n\tCTexture*\t\tpDepthBufferTex;\r\n\tCImageBuffer*\tpStencilBufferBuf;\r\n\r\n\tGLuint\tcolorBuff;\r\n\tGLuint\tdepthBuff;\r\n\tGLuint\tstencilBuff;\r\n\r\n\tGLuint\tframeBuffID;\r\n};\r\n\r\n// #############################################################################\r\n//\r\n//   \r\n//    TEXTURE MANAGEMENT\r\n//\r\n//\r\n// #############################################################################\r\n\r\nclass CTextureUsage {\r\n\tfriend class CTextureBase;\r\n\tfriend class CTexture;\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tenum SAMPLING {\r\n\t\tNEAREST = 0,\r\n\t\tLINEAR  = 1,\r\n\t\tBLEND_IFMIPMAP_BIT = 0x2 \r\n\t};\r\n\r\n\tenum WRAPPING {\r\n\t\tREPEAT\t\t\t= 0,\r\n\t\tCLAMP_TO_EDGE\t= 1\r\n\t\t// MIRRORED\t\t= 2 Not available on OpenGL 2.0 AND 1.1\r\n\t};\r\n\r\n\tvoid\t\t\tinit\t\t\t\t(CTextureBase* pTexture);\r\n\r\n\tvoid \t\t\tactivate\t\t\t(s32 sampler);\r\n\t\r\n\t// \r\n\tvoid\t\t\tsetSampling\t\t\t(SAMPLING minmode, SAMPLING magmode);\r\n\tvoid \t\t\tsetWrapping\t\t\t(WRAPPING U_mode, WRAPPING V_mode);\r\n\r\n\t// Lots of people need to find a texture based on usage ptr, put as public for now.\r\n\tCTextureBase*\t\tpTexture;\r\nprivate:\r\n\tGLenum\tminSampling;\r\n\tGLenum\tmaxSampling;\r\n\tGLenum\tuMode;\r\n\tGLenum\tvMode;\r\n\tbool\tsamplingSetupDone;\r\n\r\n\tCKLBOGLWrapper*\tpMgr;\r\n\tCTextureUsage*\t\tpNext;\r\n\r\n\tCTextureUsage();\r\n\t~CTextureUsage();\r\n};\r\n\r\nclass CTextureBase {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CTextureUsage;\r\n\tfriend class CTexture;\r\n\tfriend class CSubTexture;\r\n\tfriend class CFontTexture;\r\npublic:\r\n\tenum UVCOMPUTE_MODE {\r\n\t\tTOP_LEFT\t\t= 0,\r\n\t\tCENTROID\t\t= 1\r\n\t};\r\n\r\n\tu32\tisAlpha\t(float u,float v);\r\n\r\n\tinline\r\n\ts32 \t\t\tgetWidth\t\t\t\t()\t\t\t\t\t\t\t\t\t{ return width; \t}\r\n\tinline\r\n\ts32 \t\t\tgetHeight\t\t\t\t()\t\t\t\t\t\t\t\t\t{ return height;\t}\r\n\t\r\n\tCTextureUsage*\tcreateUsage\t\t\t\t();\r\n\tvoid \t\t\treleaseUsage\t\t\t(CTextureUsage* pUsage);\r\n\r\n\tCSubTexture*\tsetSubAtlas\t\t\t\t(bool asFont, s32 x, s32 y, s32 width, s32 height);\r\n\tvoid\t\t\treleaseSubTexture\t\t(CSubTexture* pSubTex);\r\n\tbool\t\t\tupdateTexture\t\t\t(s32 x, s32 y, s32 width, s32 height, void* data, s32 dataSize);\r\n\tvoid\t\t\tupdateTextureFromFrame\t(u32 mipLevel, s32 dstX, s32 dstY, s32 srcX, s32 srcY, s32 srcW, s32 srcH);\r\n\tvoid\t\t\tconvertPixelToRenderUV\t(s32 x, s32 y, UVCOMPUTE_MODE sampling, float* u, float* v);\r\n\tvoid\t\t\tconvertLocalUVToRenderUV(float lu, float lv, float* u, float *v);\r\n\tvoid\t\t\tassignSWAlphaBuffer\t\t(u8* buffer);\r\n\tu8*\t\t\t\tgetSWAlphaBuffer\t\t()\t{ return pSWAlphaMap ; }\r\n\r\n\t// To allow user to get main texture easily.\r\n\tCTexture*\t\tpMaster;\r\nprivate:\r\n\t// In absolute top parent coordinate system\r\n\ts32\t\t\t\tx;\r\n\ts32\t\t\t\ty;\r\n\r\n\ts32\t\t\t\twidth;\r\n\ts32\t\t\t\theight;\r\n\ts32\t\t\t\tusageCount;\r\n\tu8*\t\t\t\tpSWAlphaMap;\r\n\r\n\tCKLBOGLWrapper*\tpMgr;\r\n\r\n\tCTextureUsage\tusageList;\r\n\r\n\t// Atlas feature.\r\n\tCTextureBase*\tpParent;\r\n\tCTextureBase*\tpChild;\r\n\tCTextureBase*\tpBrother;\r\n\r\n\tCTextureBase();\r\n\t~CTextureBase();\r\n\r\n\tvoid \t\t\treleaseUsage\t\t();\r\n\tvoid\t\t\treleaseSubTextures\t();\r\n};\r\n\r\nclass CTexture : public CTextureBase {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CTextureUsage;\r\n\tfriend class CTextureBase;\r\n\tfriend class CFontTexture;\r\n\tfriend class CFrame;\r\npublic:\r\n\tvoid\t\t\tmakeEmptyShell\t\t\t();\r\n\tGLuint\t\t\tactiveTexture;\t\r\nprivate:\r\n\tGLuint\t\t\tgetWorkingTexture() {\r\n\t\tif (pMaster->isDoubleBuffered) {\r\n\t\t\treturn (pMaster->activeTexture == pMaster->texture) ? pMaster->textureDoubleBuff : pMaster->texture; \r\n\t\t} else {\r\n\t\t\treturn pMaster->texture;\r\n\t\t}\r\n\t}\r\n\r\n\tfloat\t\t\tUPerPixel;\r\n\tfloat\t\t\tVPerPixel;\r\n\t\r\n\tCTexture*\t\tpNext;\r\n\tbool\t\t\tisDoubleBuffered;\r\n\tbool\t\t\tisMipmapped;\r\n\tbool\t\t\tisCompressed;\r\n\tbool\t\t\tis3D;\r\n\ts32\t\t\t\tframe;\r\n\r\n\t// Open GL side\r\n\tGLenum\t\t\tformat;\r\n\tGLint\t\t\tchannels;\r\n\r\n\tGLuint\t\t\ttexture;\r\n\tGLuint\t\t\ttextureDoubleBuff;\r\n\r\n\tCTexture ();\r\n\t~CTexture();\r\n};\r\n\r\nclass CFontTexture;\r\n\r\nclass CSubTexture : public CTextureBase {\r\n\tfriend class CKLBOGLWrapper;\r\n\tfriend class CTexture;\r\n#ifndef __GNUC__\r\n\tfriend class CSubTexture;\r\n#endif\r\n\tfriend class CTextureBase;\r\n\tfriend class CFontTexture;\r\n\t// No member, no function for now.\r\nprivate:\r\n\tCSubTexture();\r\n\t~CSubTexture();\r\n};\r\n\r\nclass CFontTexture : public CSubTexture {\r\n\tfriend class CTextureBase;\r\npublic:\r\n\tvoid setup\t\t\t(s32 fixedSize);\r\n\tbool setupCharCount\t(u16 charCount);\r\n\r\n\tvoid registerChar\t(unichar c, s32 variableSize);\r\n\tvoid registerChar\t(unichar c, u32 x, u32 y, u32 w, u32 h, bool rot = false, u8 marginTopLeft = 0, u8 marginBottomRight = 0);\r\n\tvoid getChar\t\t(unichar c, float* u0, float* u1, float* v0, float* v1, float* w, float* h);\r\nprivate:\r\n\ts32\t\t\t\tfixedSize;\r\n\ts32\t\t\t\tcurrX;\r\n\ts32\t\t\t\tcurrY;\r\n\tfloat*\t\t\tu0u1v0v1;\r\n\tu32*\t\t\twh;\r\n\r\n\tCFontTexture();\r\n\t~CFontTexture();\r\n};\r\n\r\nstruct USampler {\r\n\tGLuint\ttexture;\r\n};\r\n\r\n// #############################################################################\r\n//\r\n//   \r\n//    MAIN SYSTEM\r\n//\r\n//\r\n// #############################################################################\r\nstruct SRenderState {\r\n\tfriend class CKLBOGLWrapper;\r\npublic:\r\n\tSRenderState();\r\n\r\n\tenum RENDER_MODE {\r\n\t\tONLY_COLOR,\r\n\t\tONLY_TEXTURE,\r\n\t\tTEXTURE_MUL_COLOR,\r\n\t\tES2_BRIGHTNESS,\r\n\t\tES2_COLORIZE,\r\n\t\tES2_SATURATE,\r\n\t\tES2_RAMP,\r\n\t\tES2_TONE,\r\n\t\tES2_MOSAIC\r\n\t};\r\n\r\n\tenum BLEND_MODE {\r\n\t\tNO_ALPHA,\r\n\t\tALPHA,\r\n\t\tADDITIVE,\r\n\t\tADDITIVE_ALPHA\r\n\t};\r\n\r\n\tenum BLEND_DST {\r\n\t\tD_ONE\t\t\t\t\t\t= GL_ONE,\r\n\t\tD_SRC_COLOR\t\t\t\t\t= GL_SRC_COLOR,\r\n\t\tD_ONE_MINUS_SRC_COLOR\t\t= GL_ONE_MINUS_SRC_COLOR,\r\n\t\tD_SRC_ALPHA\t\t\t\t\t= GL_SRC_ALPHA,\r\n\t\tD_ONE_MINUS_SRC_ALPHA\t\t= GL_ONE_MINUS_SRC_ALPHA,\r\n\t\tD_DST_ALPHA\t\t\t\t\t= GL_DST_ALPHA,\r\n\t\tD_ONE_MINUS_DST_ALPHA\t\t= GL_ONE_MINUS_DST_ALPHA\r\n\t};\r\n\r\n\tenum BLEND_SRC {\r\n\t\tS_ZERO\t\t\t\t\t\t= GL_ZERO,\r\n\t\tS_ONE\t\t\t\t\t\t= GL_ONE,\r\n\t\tS_DST_COLOR\t\t\t\t\t= GL_DST_COLOR,\r\n\t\tS_ONE_MINUS_DST_COLOR\t\t= GL_ONE_MINUS_DST_COLOR,\r\n\t\tS_SRC_ALPHA_SATURATE\t\t= GL_SRC_ALPHA_SATURATE,\r\n\t\tS_SRC_ALPHA\t\t\t\t\t= GL_SRC_ALPHA,\r\n\t\tS_ONE_MINUS_SRC_ALPHA\t\t= GL_ONE_MINUS_SRC_ALPHA,\r\n\t\tS_DST_ALPHA\t\t\t\t\t= GL_DST_ALPHA,\r\n\t\tS_ONE_MINUS_DST_ALPHA\t\t= GL_ONE_MINUS_DST_ALPHA\r\n\t};\r\n\r\n\tenum DEPTH_OP {\r\n\t\tLESS\t= GL_LESS,\r\n\t\tGREATER\t= GL_GREATER,\r\n\t\tLEQUAL\t= GL_LEQUAL,\r\n\t\tGEQUAL\t= GL_GEQUAL,\r\n\t\tEQUAL\t= GL_EQUAL,\r\n\t\tNOTEQUAL= GL_NOTEQUAL,\r\n\t\tALWAYS\t= GL_ALWAYS,\r\n\t\tNEVER\t= GL_NEVER\r\n\t};\r\n\r\n\tenum STENCIL_OP {\r\n\t\tKEEP\t= GL_KEEP,\r\n\t\tZERO\t= GL_ZERO,\r\n\t\tREPLACE\t= GL_REPLACE,\r\n\t\tINCR\t= GL_INCR,\r\n\t\tDECR\t= GL_DECR,\r\n#ifdef OPENGL2\r\n\t\tINCR_WRAP = GL_INCR_WRAP,\r\n\t\tDECR_WRAP = GL_DECR_WRAP,\r\n#endif\r\n\t\tINVERT\t  = GL_INVERT\r\n\t};\r\n\r\n\tenum BLEND_OP {\r\n\t\tADD\t\t= 0,\r\n#ifdef OPENGL2\r\n\t\tSUB\t\t= 1,\r\n\t\tREVSUB\t= 2\r\n#endif\r\n\t};\r\n\r\n\tvoid setTextMode\t\t(bool active);\r\n\tvoid setBlend\t\t\t(BLEND_MODE mode);\r\n\tvoid setBlendAdvance\t(BLEND_SRC src, BLEND_DST dst, BLEND_OP src_op_dst);\r\n\tvoid setDepthState\t\t(bool write, bool test, DEPTH_OP op);\r\n\r\n\tvoid setStencilTestCW\t(u32 readMask, u32 refValue, DEPTH_OP compare_op); \r\n\tvoid setStencilTestCCW\t(u32 readMask, u32 refValue, DEPTH_OP compare_op); \r\n\r\n\tvoid setStencilWriteCW\t(u32 writeMask, STENCIL_OP opFailStencil, STENCIL_OP opFailZ, STENCIL_OP opSucceed);\r\n\tvoid setStencilWriteCCW\t(u32 writeMask, STENCIL_OP opFailStencil, STENCIL_OP opFailZ, STENCIL_OP opSucceed);\r\n\r\n\tvoid enableAlphaTest\t(float value, DEPTH_OP compare_op);\r\n\tvoid disableAlphaTest\t();\r\n\r\n\tvoid enableScissor\t\t(s32 x, s32 y, s32 w, s32 h);\r\n\tvoid disableScissor\t\t();\r\n\r\n\tvoid dump\t\t\t\t();\r\npublic:\r\n\tbool\t\tchanged;\r\n\r\n\t// Scissor\t(ability for external recomputation : public)\r\n\tGLint\t\tscX;\r\n\tGLint\t\tscY;\r\n\tGLsizei\t\tscW;\r\n\tGLsizei\t\tscH;\r\n\tu8\t\t\tbEnableScissor;\r\n\r\nprivate:\r\n\t// Blending\r\n\tu8\t\t\tblendEnable;\r\n\tGLenum\t\tblendSrcFactor;\r\n\tGLenum\t\tblendDstFactor;\r\n\tu8\t\t\tblendOp;\r\n\r\n\t// Depth\r\n\tu8\t\t\tdepthWriteEnable;\r\n\tu8\t\t\tdepthTestEnable;\r\n\tGLenum\t\tdepthFunction;\r\n\t\r\n\t// Custom text mode\r\n\tu8\t\t\ttextMode;\r\n\r\n\t// Alpha Test\r\n\tu8\t\t\talphaTestEnable;\r\n\tGLenum\t\talphaFunction;\r\n\tfloat\t\talphaValue;\r\n\r\n\t//\r\n\t// Stencil Read\r\n\t//\r\n\tu16\t\t\tstReadMaskCW;\r\n\tu16\t\t\tstReadMaskCCW;\r\n\tu16\t\t\tstRefValueCW;\r\n\tu16\t\t\tstRefValueCCW;\r\n\tDEPTH_OP\tstRefOpCW;\r\n\tDEPTH_OP\tstRefOpCCW;\r\n\r\n\t//\r\n\t// Stencil Write\r\n\t//\r\n\tu16\t\t\tstWriteMaskCW;\r\n\tu16\t\t\tstWriteMaskCCW;\r\n\tSTENCIL_OP\tstWriteFailS_StencilOP_CW;\r\n\tSTENCIL_OP\tstWriteFailZ_StencilOP_CW;\r\n\tSTENCIL_OP\tstWriteSuccZ_StencilOP_CW;\r\n\tSTENCIL_OP\tstWriteFailS_StencilOP_CCW;\r\n\tSTENCIL_OP\tstWriteFailZ_StencilOP_CCW;\r\n\tSTENCIL_OP\tstWriteSuccZ_StencilOP_CCW;\r\n};\r\n\r\nclass CKLBOGLWrapper {\r\n\tfriend class CTextureUsage;\r\npublic:\r\n\tinline\r\n\tstatic CKLBOGLWrapper& getInstance() {\r\n\t\tstatic CKLBOGLWrapper instance;\r\n\t\treturn instance;\r\n\t}\r\n\tstatic void release() {\r\n\t\tgetInstance()._release();\r\n\t}\r\n\r\n\t// Texture.\r\n\tenum TEX_OPTION {\r\n\t\tTEX_NONE\t\t\t\t\t= 0,\r\n\t\tTEX_OPT_DOUBLEBUFFERED_BIT\t= 0x1,\r\n\t\tTEX_OPT_MIPMAP_BIT\t\t\t= 0x2,\r\n\t\tTEX_OPT_COMPRESSED_BIT\t\t= 0x4,\r\n\t\tTEX_OPT_3D\t\t\t\t\t= 0x8\r\n\t};\r\n\r\n\tenum TEX_CHANNEL {\r\n\t\tALPHA\t\t\t= 1,\r\n\t\tRGB\t\t\t\t= 3,\r\n\t\tRGBA\t\t\t= 4,\r\n\t\tLUMINANCE\t\t= 0,\r\n\t\tLUMINANCE_ALPHA\t= 2\r\n\t};\r\n\r\n\tenum SHADER_TYPE {\r\n\t\tVERTEX_SHADER\t= 0,\r\n\t\tPIXEL_SHADER\t= 1\r\n\t};\r\n\r\n\tbool\t\t\tinit(float displayMatrix[6]);\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t// Buffers.\r\n\t//\r\n\r\n\ts32\t\t\t\tgetFrame()\t\t\t{ return frame; }\r\n\tvoid\t\t\tendFrame();\r\n\r\n\t// ------------------------------------------------------------------------\r\n\t// Rendering.\r\n\t//\r\n\r\n\tvoid\t\t\tresetSampler\t\t(s32 sampler);\r\n\tvoid\t\t\tapplyState(SRenderState* pState);\r\n\tvoid\t\t\tdraw(\r\n\t\t\t\t\t\t\t\tGLenum\t\t\t\tmode,\r\n\t\t\t\t\t\t\t\tCShaderInstance*\tinstance,\r\n\t\t\t\t\t\t\t\tCBuffer**\t\t\tpBuffer,\r\n\t\t\t\t\t\t\t\tu32\t\t\t\t\tbufferCount,\r\n\t\t\t\t\t\t\t\tCIndexBuffer*\t\tpIndexBuffer,\r\n\t\t\t\t\t\t\t\tCTextureUsage**\t\tarray_pTexture,\r\n\t\t\t\t\t\t\t\ts32*\t\t\t\tuniformID,\r\n\t\t\t\t\t\t\t\ts32\t\t\t\t\tindexCount);\r\n\r\n\tvoid\t\t\tsetRenderFrame(CFrame* pFrame = 0);\r\n\t\r\n\t\r\n\t// ------------------------------------------------------------------------\r\n\t// Object Allocation / Management\r\n\t//\r\n\r\n\tCTexture*\t\tloadTGA\t\t\t\t(const char* filename, u32 pixFormat, s32* rw = null, s32* rh = null, bool load = true, bool swapXY = false, CTexture* res = null, int x = 0, int y = 0, TEX_OPTION option = TEX_NONE);\r\n\tCTexture*\t\tloadCompress\t\t(const char* filename, u32 pixFormat, u32 w, u32 h, TEX_OPTION option = TEX_NONE);\r\n\r\n\t// 0 : Color\r\n\t// 1 : Depth\r\n\t// 2 : Stencil\r\n\tCImageBuffer*\tcreateImageBuffer\t(s32 width, s32 height, GLenum internalformat);\r\n\tvoid\t\t\treleaseImageBuffer\t(CImageBuffer* imageBuffer);\r\n\r\n\tbool\t\t\tsupportFrame\t\t();\r\n\tbool\t\t\tsupport3DTexture\t();\r\n\r\n\tCFrame*\t\t\tcreateFrame\t\t\t();\r\n\tvoid\t\t\treleaseFrame\t\t(CFrame* pFrame);\r\n\r\n\tbool\t\t\tcopyScreenRGB888\t(u32 srcx, u32 srcy, u32 width,u32 height,u8* buffer);\r\n\r\n\tCTexture*\t\tcreateTexture\t\t(s32 width, s32 height, GLenum pixelFormat, TEX_CHANNEL channelCount,void* data, s32 dataLength = 0, TEX_OPTION option = TEX_NONE, s32 depth = 0, CTexture* reload = NULL);\r\n\tvoid\t\t\treleaseTexture\t\t(CTexture* texture);\r\n\t\r\n\t// Shaders.\r\n\tCShader*\t\tcreateShader\t\t(SRenderState::RENDER_MODE, SHADER_TYPE type, const SParam* listParam);\r\n\tCShader*\t\tcreateShader\t\t(const char* source, SHADER_TYPE type, const SParam* listParam);\r\n\tvoid\t\t\treleaseShader\t\t(CShader* pShader);\r\n\r\n\t// Rendering Shader.\r\n\tCShaderSet*\t\tcreateShaderSet\t\t(CShader* pVertexShader, CShader* pPixelShader);\r\n\tvoid\t\t\treleaseShaderSet\t(CShaderSet* pFullShader);\r\n\r\n\tCBuffer*\t\tcreateVertexBuffer\t(s32 vertexCount, const SVertexEntry* listComponent, void* usingOutsideBuffer = NULL);\r\n\tvoid\t\t\treleaseVertexBuffer\t(CBuffer* pBuffer);\r\n\r\n\tCIndexBuffer*\tcreateIndexBuffer\t(s32 indexCount, bool asVBO, void* usingOutsideBuffer = NULL);\r\n\tvoid\t\t\treleaseIndexBuffer\t(CIndexBuffer* pBuffer);\r\n\r\n\tvoid\t\t\tassignSampler\t\t(CTextureUsage* pTextureInstance, s32 sampler);\r\nprivate:\r\n\tCKLBOGLWrapper\t();\r\n\t~CKLBOGLWrapper\t();\r\n\tvoid _release\t();\r\n\r\n\tCKLBOGLWrapper\t(CKLBOGLWrapper const&);\t\t// Dont implement.\r\n\tvoid operator=\t\t(CKLBOGLWrapper const&);\t\t// Dont implement.\r\n\r\n\tconst char*\t\tpatch\t\t\t\t(const char* shader, const char* glslTransform);\r\n\r\n\tGLuint\t\t\tarrayBufferID;\r\n\tvoid\t\t\t_glBindBuffer\t\t(GLuint id);\r\n\r\n\tUSampler\t\tsamplerUnit[4];\r\n\ts32\t\t\t\tframe;\r\n\r\n\tGLfloat\t\t\tdisplayMatrix2D[16];\r\n\r\n\tCTexture*\t\tm_pTextureList;\r\n\tCShader*\t\tshaderList;\r\n\tCShaderSet*\t\tshaderSetList;\r\n\tCBuffer*\t\tbufferList;\r\n\tCIndexBuffer*\tindexBufferList;\r\n\tCImageBuffer*\timgBufferList;\r\n\tCFrame*\t\t\tframeList;\r\n\r\n\tSRenderState\trState;\r\n\tSRenderState*\tm_pLastState;\r\n\tCShaderInstance*\r\n\t\t\t\t\tm_lastShaderInstance;\r\n\tGLuint\t\t\tlastElementArrayBuffer;\r\n\tu8\t\t\t\tenableColor;\r\n\tu8\t\t\t\tenableTexture;\r\n\r\n#ifdef OPENGL2\r\n\tchar shaderPatchArray[1000];\r\n#endif\r\n\tvoid*\t\t\t_glTexImage3DOES;\r\n\tvoid*\t\t\t_glTexSubImage3DOES;\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/include/encryptFile.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef H_HEADER_PROTECT_ENCRYPTFILE_H\r\n#define H_HEADER_PROTECT_ENCRYPTFILE_H\r\n\r\n#include \"BaseType.h\"\r\n#include \"encryptUserContext.h\"\r\n\r\n/*!\r\n    @class  DecryptBaseClass\r\n    @brief  複合化基礎クラス\r\n */\r\nclass CDecryptBaseClass {\r\npublic:\r\n\tSUserStruct\tm_userCtx;\r\n\tbool\t\tm_decrypt;\r\n\tbool\t\tm_useNew;\r\nprivate:\r\n\tvoid\t\tdecrypt(void* ptr, u32 length);\r\npublic:\r\n\tCDecryptBaseClass();\r\n\tinline void decryptBlck(void* ptr, u32 length) {\r\n\t\tif (m_decrypt) { decrypt(ptr, length); }\r\n\t}\r\n\r\n\tu32\t\t\tdecryptSetup(const u8* ptr, const u8* hdr);\r\n\tvoid\t\tgotoOffset\t(u32 offset);\r\n};\r\n\r\n#endif\r\n"
  },
  {
    "path": "Engine/source/include/encryptUserContext.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n\r\nstruct SUserStruct {\r\n\t// Here add your custom information needed in the decrypter\r\n};\r\n"
  },
  {
    "path": "Engine/source/include/mem.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _MEM_MACRO_KLB_\r\n#define _MEM_MACRO_KLB_\r\n\r\n// Memcpy / Memset / strlen\r\n#include \"string.h\"\r\n\r\n//\r\n// \"Slow\" implementation for now.\r\n//\r\n#define\tmemcpy32\tmemcpy\r\n#define memcpy16\tmemcpy\r\n#define memset16(dst, val, size)\t{ u16 v = (u16)(val); u16* ptrStart = (u16*)(dst); u16* ptrEnd = &ptrStart[(size)>>1]; while (ptrStart != ptrEnd) { *ptrStart++ = v; } }\r\n#define memset32(dst, val, size)\t{ u32 v = (u32)(val); u32* ptrStart = (u32*)(dst); u32* ptrEnd = &ptrStart[(size)>>2]; while (ptrStart != ptrEnd) { *ptrStart++ = v; } }\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "Engine/source/include/unistd.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n"
  },
  {
    "path": "README.md",
    "content": "# Playground OSS\r\n\r\nThis is the 'Playground' game engine and is released in open source under Apache License v2.0.\r\n\r\n * All the needed documentation is in the /Doc folder.\r\n * Source code are under the /Engine folder.\r\n * Tool to compile a sample project is under /Tools folder.\r\n * Sample showing the scripting APIs are available under the /Tutorial folder.\r\n\r\nOther folders (CSharpVersion, SampleProject) are more related to prototype features or detailed implementations.\r\n\r\nTo get started, please read the /Doc/Project.md\r\n\r\nThe dev team.\r\n\r\n## Build Status\r\n[![Build Status](https://travis-ci.org/KLab/PlaygroundOSS.png?branch=master)](https://travis-ci.org/KLab/PlaygroundOSS)\r\n\r\n\r\n## LICENSE\r\n'Playground OSS' is released under Apache Software License, Version 2.0 (Apache 2.0). Please refer http://www.apache.org/licenses/LICENSE-2.0 file for detail.\r\n\r\n\r\n---------------------------------------------------------------------------\r\n"
  },
  {
    "path": "SampleProject/CSharp/Program.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\nusing EnginePrototype;\r\n\r\npublic class Program\r\n{\r\n    public static void start()\r\n    {\r\n        SampleGame.Program.start();\r\n    }\r\n}\r\n\r\nnamespace SampleGame\r\n{\r\n    public class Program\r\n    {\r\n        public static void start()\r\n        {\r\n            Main(null);\r\n        }\r\n\r\n        public static void Main(string[] args)\r\n        {\r\n            Console.WriteLine(\"Hello from C# In Console.\");\r\n            try\r\n            {\r\n                CKLBUILabel label = new CKLBUILabel(null, 1000, 300, 100, 0x00000000, \"georgia\", 16, \"Hello World from C#!\", CKLBUILabel.EALIGN.MID);\r\n            }\r\n            catch(Exception ex)\r\n            {\r\n                Console.WriteLine(\"##################################\");\r\n                Console.WriteLine(\"####### Exception Handling #######\");\r\n                Console.WriteLine(\"##################################\");\r\n                Console.WriteLine();\r\n                Console.WriteLine(\"Exception Type : \" + ex.GetType());\r\n                Console.WriteLine();\r\n                Console.WriteLine(\"Error Message : \" + ex.Message);\r\n                Console.WriteLine();\r\n                Console.WriteLine(\"Stack Trace : \" + ex.StackTrace);\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "SampleProject/CSharp/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// Les informations générales relatives à un assembly dépendent de \r\n// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations\r\n// associées à un assembly.\r\n[assembly: AssemblyTitle(\"FrameworkTestSuite\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"\")]\r\n[assembly: AssemblyProduct(\"FrameworkTestSuite\")]\r\n[assembly: AssemblyCopyright(\"Copyright ©  2013\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly \r\n// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de \r\n// COM, affectez la valeur true à l'attribut ComVisible sur ce type.\r\n[assembly: ComVisible(false)]\r\n\r\n// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM\r\n[assembly: Guid(\"487162bc-567a-440f-81a8-db526c2c7acd\")]\r\n\r\n// Les informations de version pour un assembly se composent des quatre valeurs suivantes :\r\n//\r\n//      Version principale\r\n//      Version secondaire \r\n//      Numéro de build\r\n//      Révision\r\n//\r\n// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut \r\n// en utilisant '*', comme indiqué ci-dessous :\r\n// [assembly: AssemblyVersion(\"1.0.*\")]\r\n[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\r\n"
  },
  {
    "path": "SampleProject/CSharp/SampleGame.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">x86</Platform>\r\n    <ProductVersion>2.0</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{EF6B4106-AD3E-44B7-9BF4-A527B9E53EA4}</ProjectGuid>\r\n    <OutputType>Library</OutputType>\r\n    <RootNamespace>SampleGame</RootNamespace>\r\n    <AssemblyName>start</AssemblyName>\r\n    <PublishUrl>publier\\</PublishUrl>\r\n    <Install>true</Install>\r\n    <InstallFrom>Disk</InstallFrom>\r\n    <UpdateEnabled>false</UpdateEnabled>\r\n    <UpdateMode>Foreground</UpdateMode>\r\n    <UpdateInterval>7</UpdateInterval>\r\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r\n    <UpdatePeriodically>false</UpdatePeriodically>\r\n    <UpdateRequired>false</UpdateRequired>\r\n    <MapFileExtensions>true</MapFileExtensions>\r\n    <ApplicationRevision>0</ApplicationRevision>\r\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r\n    <IsWebBootstrapper>false</IsWebBootstrapper>\r\n    <UseApplicationTrust>false</UseApplicationTrust>\r\n    <BootstrapperEnabled>true</BootstrapperEnabled>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x86' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <Externalconsole>true</Externalconsole>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"MyCSharpLibForWindows\">\r\n      <HintPath>..\\..\\VariousPrototyping\\Engine_Prototype\\EnginePrototypeCS\\EnginePrototype\\bin\\Debug\\MyCSharpLibForWindows.dll</HintPath>\r\n    </Reference>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\">\r\n      <Link>Properties\\AssemblyInfo.cs</Link>\r\n    </Compile>\r\n    <Compile Include=\"Program.cs\">\r\n      <Link>Program.cs</Link>\r\n    </Compile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <BootstrapperPackage Include=\".NETFramework,Version=v4.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Microsoft .NET Framework 4 %28x86 et x64%29</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Client.3.5\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Windows.Installer.4.5\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Windows Installer 4.5</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Folder Include=\"Properties\\\" />\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "SampleProject/CSharp/SampleGame.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 11.00\r\n# Visual Studio 2010\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SampleGame\", \"SampleGame.csproj\", \"{EF6B4106-AD3E-44B7-9BF4-A527B9E53EA4}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ToCompile\", \"ToCompile\\ToCompile.csproj\", \"{CD0A1059-F896-4BE3-8540-6505EE6D972B}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{CD0A1059-F896-4BE3-8540-6505EE6D972B}.Debug|x86.ActiveCfg = Debug|x86\r\n\t\t{CD0A1059-F896-4BE3-8540-6505EE6D972B}.Debug|x86.Build.0 = Debug|x86\r\n\t\t{CD0A1059-F896-4BE3-8540-6505EE6D972B}.Release|x86.ActiveCfg = Release|x86\r\n\t\t{CD0A1059-F896-4BE3-8540-6505EE6D972B}.Release|x86.Build.0 = Release|x86\r\n\t\t{EF6B4106-AD3E-44B7-9BF4-A527B9E53EA4}.Debug|x86.ActiveCfg = Debug|x86\r\n\t\t{EF6B4106-AD3E-44B7-9BF4-A527B9E53EA4}.Release|x86.ActiveCfg = Debug|x86\r\n\t\t{EF6B4106-AD3E-44B7-9BF4-A527B9E53EA4}.Release|x86.Build.0 = Debug|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(MonoDevelopProperties) = preSolution\r\n\t\tStartupItem = ToCompile\\ToCompile.csproj\r\n\t\tPolicies = $0\r\n\t\t$0.TextStylePolicy = $1\r\n\t\t$1.FileWidth = 120\r\n\t\t$1.inheritsSet = VisualStudio\r\n\t\t$1.inheritsScope = text/plain\r\n\t\t$1.scope = text/plain\r\n\t\t$0.StandardHeader = $2\r\n\t\t$2.Text = \r\n\t\t$2.IncludeInNewFiles = True\r\n\t\t$0.NameConventionPolicy = $3\r\n\t\t$3.Rules = $4\r\n\t\t$4.NamingRule = $5\r\n\t\t$5.Name = Namespaces\r\n\t\t$5.AffectedEntity = Namespace\r\n\t\t$5.VisibilityMask = VisibilityMask\r\n\t\t$5.NamingStyle = PascalCase\r\n\t\t$5.IncludeInstanceMembers = True\r\n\t\t$5.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $6\r\n\t\t$6.Name = Types\r\n\t\t$6.AffectedEntity = Class, Struct, Enum, Delegate\r\n\t\t$6.VisibilityMask = Public\r\n\t\t$6.NamingStyle = PascalCase\r\n\t\t$6.IncludeInstanceMembers = True\r\n\t\t$6.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $7\r\n\t\t$7.Name = Interfaces\r\n\t\t$7.RequiredPrefixes = $8\r\n\t\t$8.String = I\r\n\t\t$7.AffectedEntity = Interface\r\n\t\t$7.VisibilityMask = Public\r\n\t\t$7.NamingStyle = PascalCase\r\n\t\t$7.IncludeInstanceMembers = True\r\n\t\t$7.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $9\r\n\t\t$9.Name = Attributes\r\n\t\t$9.RequiredSuffixes = $10\r\n\t\t$10.String = Attribute\r\n\t\t$9.AffectedEntity = CustomAttributes\r\n\t\t$9.VisibilityMask = Public\r\n\t\t$9.NamingStyle = PascalCase\r\n\t\t$9.IncludeInstanceMembers = True\r\n\t\t$9.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $11\r\n\t\t$11.Name = Event Arguments\r\n\t\t$11.RequiredSuffixes = $12\r\n\t\t$12.String = EventArgs\r\n\t\t$11.AffectedEntity = CustomEventArgs\r\n\t\t$11.VisibilityMask = Public\r\n\t\t$11.NamingStyle = PascalCase\r\n\t\t$11.IncludeInstanceMembers = True\r\n\t\t$11.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $13\r\n\t\t$13.Name = Exceptions\r\n\t\t$13.RequiredSuffixes = $14\r\n\t\t$14.String = Exception\r\n\t\t$13.AffectedEntity = CustomExceptions\r\n\t\t$13.VisibilityMask = VisibilityMask\r\n\t\t$13.NamingStyle = PascalCase\r\n\t\t$13.IncludeInstanceMembers = True\r\n\t\t$13.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $15\r\n\t\t$15.Name = Methods\r\n\t\t$15.AffectedEntity = Methods\r\n\t\t$15.VisibilityMask = Protected, Public\r\n\t\t$15.NamingStyle = PascalCase\r\n\t\t$15.IncludeInstanceMembers = True\r\n\t\t$15.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $16\r\n\t\t$16.Name = Static Readonly Fields\r\n\t\t$16.AffectedEntity = ReadonlyField\r\n\t\t$16.VisibilityMask = Protected, Public\r\n\t\t$16.NamingStyle = PascalCase\r\n\t\t$16.IncludeInstanceMembers = False\r\n\t\t$16.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $17\r\n\t\t$17.Name = Fields\r\n\t\t$17.AffectedEntity = Field\r\n\t\t$17.VisibilityMask = Protected, Public\r\n\t\t$17.NamingStyle = PascalCase\r\n\t\t$17.IncludeInstanceMembers = True\r\n\t\t$17.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $18\r\n\t\t$18.Name = ReadOnly Fields\r\n\t\t$18.AffectedEntity = ReadonlyField\r\n\t\t$18.VisibilityMask = Protected, Public\r\n\t\t$18.NamingStyle = PascalCase\r\n\t\t$18.IncludeInstanceMembers = True\r\n\t\t$18.IncludeStaticEntities = False\r\n\t\t$4.NamingRule = $19\r\n\t\t$19.Name = Constant Fields\r\n\t\t$19.AffectedEntity = ConstantField\r\n\t\t$19.VisibilityMask = Protected, Public\r\n\t\t$19.NamingStyle = PascalCase\r\n\t\t$19.IncludeInstanceMembers = True\r\n\t\t$19.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $20\r\n\t\t$20.Name = Properties\r\n\t\t$20.AffectedEntity = Property\r\n\t\t$20.VisibilityMask = Protected, Public\r\n\t\t$20.NamingStyle = PascalCase\r\n\t\t$20.IncludeInstanceMembers = True\r\n\t\t$20.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $21\r\n\t\t$21.Name = Events\r\n\t\t$21.AffectedEntity = Event\r\n\t\t$21.VisibilityMask = Protected, Public\r\n\t\t$21.NamingStyle = PascalCase\r\n\t\t$21.IncludeInstanceMembers = True\r\n\t\t$21.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $22\r\n\t\t$22.Name = Enum Members\r\n\t\t$22.AffectedEntity = EnumMember\r\n\t\t$22.VisibilityMask = VisibilityMask\r\n\t\t$22.NamingStyle = PascalCase\r\n\t\t$22.IncludeInstanceMembers = True\r\n\t\t$22.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $23\r\n\t\t$23.Name = Parameters\r\n\t\t$23.AffectedEntity = Parameter\r\n\t\t$23.VisibilityMask = VisibilityMask\r\n\t\t$23.NamingStyle = CamelCase\r\n\t\t$23.IncludeInstanceMembers = True\r\n\t\t$23.IncludeStaticEntities = True\r\n\t\t$4.NamingRule = $24\r\n\t\t$24.Name = Type Parameters\r\n\t\t$24.RequiredPrefixes = $25\r\n\t\t$25.String = T\r\n\t\t$24.AffectedEntity = TypeParameter\r\n\t\t$24.VisibilityMask = VisibilityMask\r\n\t\t$24.NamingStyle = PascalCase\r\n\t\t$24.IncludeInstanceMembers = True\r\n\t\t$24.IncludeStaticEntities = True\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "SampleProject/CSharp/ToCompile/Program.cs",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\nusing System;\r\n\r\nnamespace ToCompile\r\n{\r\n    class MainClass\r\n    {\r\n        public static void Main (string[] args)\r\n        {\r\n            Console.WriteLine (\"Hello World!\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "SampleProject/CSharp/ToCompile/Properties/AssemblyInfo.cs",
    "content": "using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\n\r\n// Information about this assembly is defined by the following attributes. \r\n// Change them to the values specific to your project.\r\n[assembly: AssemblyTitle (\"ToCompile\")]\r\n[assembly: AssemblyDescription (\"\")]\r\n[assembly: AssemblyConfiguration (\"\")]\r\n[assembly: AssemblyCompany (\"\")]\r\n[assembly: AssemblyProduct (\"\")]\r\n[assembly: AssemblyCopyright (\"Lysander\")]\r\n[assembly: AssemblyTrademark (\"\")]\r\n[assembly: AssemblyCulture (\"\")]\r\n// The assembly version has the format \"{Major}.{Minor}.{Build}.{Revision}\".\r\n// The form \"{Major}.{Minor}.*\" will automatically update the build and revision,\r\n// and \"{Major}.{Minor}.{Build}.*\" will update just the revision.\r\n[assembly: AssemblyVersion (\"1.0.*\")]\r\n// The following attributes are used to specify the signing key for the assembly, \r\n// if desired. See the Mono documentation for more information about signing.\r\n//[assembly: AssemblyDelaySign(false)]\r\n//[assembly: AssemblyKeyFile(\"\")]\r\n\r\n"
  },
  {
    "path": "SampleProject/CSharp/ToCompile/ToCompile.csproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">x86</Platform>\r\n    <ProductVersion>10.0.0</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{CD0A1059-F896-4BE3-8540-6505EE6D972B}</ProjectGuid>\r\n    <OutputType>Exe</OutputType>\r\n    <RootNamespace>ToCompile</RootNamespace>\r\n    <AssemblyName>ToCompile</AssemblyName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x86' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug</OutputPath>\r\n    <DefineConstants>DEBUG;</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <Externalconsole>true</Externalconsole>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|x86' \">\r\n    <DebugType>full</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\Release</OutputPath>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <Externalconsole>true</Externalconsole>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Program.cs\" />\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n</Project>"
  },
  {
    "path": "SampleProject/Cpp/framework.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"framework.h\"\r\n\r\n//\r\n// Delegate Implementation\r\n//\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerV_inner0 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 59;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerV_inner0,System::Delegate);\r\n    }\r\n\r\n    inline void call$() { CHCKTHIS; (*this)(); }\r\n    virtual void operator() ()=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerV_inner0 : public EnginePrototype::_Delegate_Base_FunctionPointerV_inner0\r\n{\r\nprivate:\r\n    void (TClass::*fpt)();\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerV_inner0(TClass* _pt2Object, void(TClass::*_fpt)()) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerV_inner0::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()() { (*pt2Object.*fpt)();}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerV_inner0 : public EnginePrototype::_Delegate_Base_FunctionPointerV_inner0{\r\nprivate:\r\n    void (*fpt)();\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerV_inner0(void(*_fpt)())    { fpt=_fpt; };\r\n\r\n    virtual void operator()() { (*fpt)(); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerII_inner1 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 61;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerII_inner1,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32 int_1,s32 int_2) { CHCKTHIS; (*this)(int_1,int_2); }\r\n    virtual void operator() (s32 int_1,s32 int_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerII_inner1 : public EnginePrototype::_Delegate_Base_FunctionPointerII_inner1\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32 int_1,s32 int_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerII_inner1(TClass* _pt2Object, void(TClass::*_fpt)(s32 int_1,s32 int_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerII_inner1::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32 int_1,s32 int_2) { (*pt2Object.*fpt)(int_1,int_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerII_inner1 : public EnginePrototype::_Delegate_Base_FunctionPointerII_inner1{\r\nprivate:\r\n    void (*fpt)(s32 int_1,s32 int_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerII_inner1(void(*_fpt)(s32 int_1,s32 int_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32 int_1,s32 int_2) { (*fpt)(int_1,int_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerIII_inner2 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 63;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerIII_inner2,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32 int_1,s32 int_2,s32 int_3) { CHCKTHIS; (*this)(int_1,int_2,int_3); }\r\n    virtual void operator() (s32 int_1,s32 int_2,s32 int_3)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerIII_inner2 : public EnginePrototype::_Delegate_Base_FunctionPointerIII_inner2\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32 int_1,s32 int_2,s32 int_3);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerIII_inner2(TClass* _pt2Object, void(TClass::*_fpt)(s32 int_1,s32 int_2,s32 int_3)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerIII_inner2::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32 int_1,s32 int_2,s32 int_3) { (*pt2Object.*fpt)(int_1,int_2,int_3);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerIII_inner2 : public EnginePrototype::_Delegate_Base_FunctionPointerIII_inner2{\r\nprivate:\r\n    void (*fpt)(s32 int_1,s32 int_2,s32 int_3);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerIII_inner2(void(*_fpt)(s32 int_1,s32 int_2,s32 int_3))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32 int_1,s32 int_2,s32 int_3) { (*fpt)(int_1,int_2,int_3); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerIIII_inner3 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 65;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerIIII_inner3,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32 int_1,s32 int_2,s32 int_3,s32 int_4) { CHCKTHIS; (*this)(int_1,int_2,int_3,int_4); }\r\n    virtual void operator() (s32 int_1,s32 int_2,s32 int_3,s32 int_4)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerIIII_inner3 : public EnginePrototype::_Delegate_Base_FunctionPointerIIII_inner3\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32 int_1,s32 int_2,s32 int_3,s32 int_4);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerIIII_inner3(TClass* _pt2Object, void(TClass::*_fpt)(s32 int_1,s32 int_2,s32 int_3,s32 int_4)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerIIII_inner3::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32 int_1,s32 int_2,s32 int_3,s32 int_4) { (*pt2Object.*fpt)(int_1,int_2,int_3,int_4);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerIIII_inner3 : public EnginePrototype::_Delegate_Base_FunctionPointerIIII_inner3{\r\nprivate:\r\n    void (*fpt)(s32 int_1,s32 int_2,s32 int_3,s32 int_4);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerIIII_inner3(void(*_fpt)(s32 int_1,s32 int_2,s32 int_3,s32 int_4))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32 int_1,s32 int_2,s32 int_3,s32 int_4) { (*fpt)(int_1,int_2,int_3,int_4); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerS_inner4 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 67;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerS_inner4,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32* intptr_1) { CHCKTHIS; (*this)(intptr_1); }\r\n    virtual void operator() (s32* intptr_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerS_inner4 : public EnginePrototype::_Delegate_Base_FunctionPointerS_inner4\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32* intptr_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerS_inner4(TClass* _pt2Object, void(TClass::*_fpt)(s32* intptr_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerS_inner4::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32* intptr_1) { (*pt2Object.*fpt)(intptr_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerS_inner4 : public EnginePrototype::_Delegate_Base_FunctionPointerS_inner4{\r\nprivate:\r\n    void (*fpt)(s32* intptr_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerS_inner4(void(*_fpt)(s32* intptr_1))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32* intptr_1) { (*fpt)(intptr_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerSII_inner5 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 69;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerSII_inner5,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32* intptr_1,s32 int_1,s32 int_2) { CHCKTHIS; (*this)(intptr_1,int_1,int_2); }\r\n    virtual void operator() (s32* intptr_1,s32 int_1,s32 int_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerSII_inner5 : public EnginePrototype::_Delegate_Base_FunctionPointerSII_inner5\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32* intptr_1,s32 int_1,s32 int_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerSII_inner5(TClass* _pt2Object, void(TClass::*_fpt)(s32* intptr_1,s32 int_1,s32 int_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerSII_inner5::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32* intptr_1,s32 int_1,s32 int_2) { (*pt2Object.*fpt)(intptr_1,int_1,int_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerSII_inner5 : public EnginePrototype::_Delegate_Base_FunctionPointerSII_inner5{\r\nprivate:\r\n    void (*fpt)(s32* intptr_1,s32 int_1,s32 int_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerSII_inner5(void(*_fpt)(s32* intptr_1,s32 int_1,s32 int_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32* intptr_1,s32 int_1,s32 int_2) { (*fpt)(intptr_1,int_1,int_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerSU_inner6 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 71;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerSU_inner6,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32* intptr_1,u32 uint_1) { CHCKTHIS; (*this)(intptr_1,uint_1); }\r\n    virtual void operator() (s32* intptr_1,u32 uint_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerSU_inner6 : public EnginePrototype::_Delegate_Base_FunctionPointerSU_inner6\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32* intptr_1,u32 uint_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerSU_inner6(TClass* _pt2Object, void(TClass::*_fpt)(s32* intptr_1,u32 uint_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerSU_inner6::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32* intptr_1,u32 uint_1) { (*pt2Object.*fpt)(intptr_1,uint_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerSU_inner6 : public EnginePrototype::_Delegate_Base_FunctionPointerSU_inner6{\r\nprivate:\r\n    void (*fpt)(s32* intptr_1,u32 uint_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerSU_inner6(void(*_fpt)(s32* intptr_1,u32 uint_1))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32* intptr_1,u32 uint_1) { (*fpt)(intptr_1,uint_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerSS_inner7 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 73;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerSS_inner7,System::Delegate);\r\n    }\r\n\r\n    inline void call$(s32* intptr_1,s32* intptr_2) { CHCKTHIS; (*this)(intptr_1,intptr_2); }\r\n    virtual void operator() (s32* intptr_1,s32* intptr_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerSS_inner7 : public EnginePrototype::_Delegate_Base_FunctionPointerSS_inner7\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(s32* intptr_1,s32* intptr_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerSS_inner7(TClass* _pt2Object, void(TClass::*_fpt)(s32* intptr_1,s32* intptr_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerSS_inner7::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(s32* intptr_1,s32* intptr_2) { (*pt2Object.*fpt)(intptr_1,intptr_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerSS_inner7 : public EnginePrototype::_Delegate_Base_FunctionPointerSS_inner7{\r\nprivate:\r\n    void (*fpt)(s32* intptr_1,s32* intptr_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerSS_inner7(void(*_fpt)(s32* intptr_1,s32* intptr_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(s32* intptr_1,s32* intptr_2) { (*fpt)(intptr_1,intptr_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUS_inner8 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 75;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUS_inner8,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,s32* intptr_1) { CHCKTHIS; (*this)(uint_1,intptr_1); }\r\n    virtual void operator() (u32 uint_1,s32* intptr_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUS_inner8 : public EnginePrototype::_Delegate_Base_FunctionPointerUS_inner8\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,s32* intptr_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUS_inner8(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,s32* intptr_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUS_inner8::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,s32* intptr_1) { (*pt2Object.*fpt)(uint_1,intptr_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUS_inner8 : public EnginePrototype::_Delegate_Base_FunctionPointerUS_inner8{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,s32* intptr_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUS_inner8(void(*_fpt)(u32 uint_1,s32* intptr_1))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,s32* intptr_1) { (*fpt)(uint_1,intptr_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUSS_inner9 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 77;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUSS_inner9,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,s32* intptr_1,s32* intptr_2) { CHCKTHIS; (*this)(uint_1,intptr_1,intptr_2); }\r\n    virtual void operator() (u32 uint_1,s32* intptr_1,s32* intptr_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUSS_inner9 : public EnginePrototype::_Delegate_Base_FunctionPointerUSS_inner9\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,s32* intptr_1,s32* intptr_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUSS_inner9(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,s32* intptr_1,s32* intptr_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUSS_inner9::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,s32* intptr_1,s32* intptr_2) { (*pt2Object.*fpt)(uint_1,intptr_1,intptr_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUSS_inner9 : public EnginePrototype::_Delegate_Base_FunctionPointerUSS_inner9{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,s32* intptr_1,s32* intptr_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUSS_inner9(void(*_fpt)(u32 uint_1,s32* intptr_1,s32* intptr_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,s32* intptr_1,s32* intptr_2) { (*fpt)(uint_1,intptr_1,intptr_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerU_inner10 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 79;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerU_inner10,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1) { CHCKTHIS; (*this)(uint_1); }\r\n    virtual void operator() (u32 uint_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerU_inner10 : public EnginePrototype::_Delegate_Base_FunctionPointerU_inner10\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerU_inner10(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerU_inner10::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1) { (*pt2Object.*fpt)(uint_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerU_inner10 : public EnginePrototype::_Delegate_Base_FunctionPointerU_inner10{\r\nprivate:\r\n    void (*fpt)(u32 uint_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerU_inner10(void(*_fpt)(u32 uint_1))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1) { (*fpt)(uint_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUU_inner11 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 81;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUU_inner11,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,u32 uint_2) { CHCKTHIS; (*this)(uint_1,uint_2); }\r\n    virtual void operator() (u32 uint_1,u32 uint_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUU_inner11 : public EnginePrototype::_Delegate_Base_FunctionPointerUU_inner11\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,u32 uint_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUU_inner11(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,u32 uint_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUU_inner11::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,u32 uint_2) { (*pt2Object.*fpt)(uint_1,uint_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUU_inner11 : public EnginePrototype::_Delegate_Base_FunctionPointerUU_inner11{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,u32 uint_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUU_inner11(void(*_fpt)(u32 uint_1,u32 uint_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,u32 uint_2) { (*fpt)(uint_1,uint_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUFF_inner12 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 83;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUFF_inner12,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,float float_1,float float_2) { CHCKTHIS; (*this)(uint_1,float_1,float_2); }\r\n    virtual void operator() (u32 uint_1,float float_1,float float_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUFF_inner12 : public EnginePrototype::_Delegate_Base_FunctionPointerUFF_inner12\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,float float_1,float float_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUFF_inner12(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,float float_1,float float_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUFF_inner12::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,float float_1,float float_2) { (*pt2Object.*fpt)(uint_1,float_1,float_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUFF_inner12 : public EnginePrototype::_Delegate_Base_FunctionPointerUFF_inner12{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,float float_1,float float_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUFF_inner12(void(*_fpt)(u32 uint_1,float float_1,float float_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,float float_1,float float_2) { (*fpt)(uint_1,float_1,float_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUI_inner13 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 85;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUI_inner13,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,s32 int_1) { CHCKTHIS; (*this)(uint_1,int_1); }\r\n    virtual void operator() (u32 uint_1,s32 int_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUI_inner13 : public EnginePrototype::_Delegate_Base_FunctionPointerUI_inner13\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,s32 int_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUI_inner13(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,s32 int_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUI_inner13::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1) { (*pt2Object.*fpt)(uint_1,int_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUI_inner13 : public EnginePrototype::_Delegate_Base_FunctionPointerUI_inner13{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,s32 int_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUI_inner13(void(*_fpt)(u32 uint_1,s32 int_1))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1) { (*fpt)(uint_1,int_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUII_inner14 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 87;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUII_inner14,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,s32 int_1,s32 int_2) { CHCKTHIS; (*this)(uint_1,int_1,int_2); }\r\n    virtual void operator() (u32 uint_1,s32 int_1,s32 int_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUII_inner14 : public EnginePrototype::_Delegate_Base_FunctionPointerUII_inner14\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,s32 int_1,s32 int_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUII_inner14(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,s32 int_1,s32 int_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUII_inner14::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1,s32 int_2) { (*pt2Object.*fpt)(uint_1,int_1,int_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUII_inner14 : public EnginePrototype::_Delegate_Base_FunctionPointerUII_inner14{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,s32 int_1,s32 int_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUII_inner14(void(*_fpt)(u32 uint_1,s32 int_1,s32 int_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1,s32 int_2) { (*fpt)(uint_1,int_1,int_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUIIII_inner15 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 89;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUIIII_inner15,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4) { CHCKTHIS; (*this)(uint_1,int_1,int_2,int_3,int_4); }\r\n    virtual void operator() (u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUIIII_inner15 : public EnginePrototype::_Delegate_Base_FunctionPointerUIIII_inner15\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUIIII_inner15(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUIIII_inner15::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4) { (*pt2Object.*fpt)(uint_1,int_1,int_2,int_3,int_4);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUIIII_inner15 : public EnginePrototype::_Delegate_Base_FunctionPointerUIIII_inner15{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUIIII_inner15(void(*_fpt)(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4) { (*fpt)(uint_1,int_1,int_2,int_3,int_4); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUIIUU_inner16 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 91;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUIIUU_inner16,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3) { CHCKTHIS; (*this)(uint_1,int_1,int_2,uint_2,uint_3); }\r\n    virtual void operator() (u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUIIUU_inner16 : public EnginePrototype::_Delegate_Base_FunctionPointerUIIUU_inner16\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUIIUU_inner16(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUIIUU_inner16::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3) { (*pt2Object.*fpt)(uint_1,int_1,int_2,uint_2,uint_3);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUIIUU_inner16 : public EnginePrototype::_Delegate_Base_FunctionPointerUIIUU_inner16{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUIIUU_inner16(void(*_fpt)(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3) { (*fpt)(uint_1,int_1,int_2,uint_2,uint_3); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUUII_inner17 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 93;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUUII_inner17,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2) { CHCKTHIS; (*this)(uint_1,uint_2,int_1,int_2); }\r\n    virtual void operator() (u32 uint_1,u32 uint_2,s32 int_1,s32 int_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUUII_inner17 : public EnginePrototype::_Delegate_Base_FunctionPointerUUII_inner17\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUUII_inner17(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUUII_inner17::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2) { (*pt2Object.*fpt)(uint_1,uint_2,int_1,int_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUUII_inner17 : public EnginePrototype::_Delegate_Base_FunctionPointerUUII_inner17{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUUII_inner17(void(*_fpt)(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,u32 uint_2,s32 int_1,s32 int_2) { (*fpt)(uint_1,uint_2,int_1,int_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerUUUII_inner18 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 95;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerUUUII_inner18,System::Delegate);\r\n    }\r\n\r\n    inline void call$(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2) { CHCKTHIS; (*this)(uint_1,uint_2,uint_3,int_1,int_2); }\r\n    virtual void operator() (u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerUUUII_inner18 : public EnginePrototype::_Delegate_Base_FunctionPointerUUUII_inner18\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerUUUII_inner18(TClass* _pt2Object, void(TClass::*_fpt)(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerUUUII_inner18::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2) { (*pt2Object.*fpt)(uint_1,uint_2,uint_3,int_1,int_2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerUUUII_inner18 : public EnginePrototype::_Delegate_Base_FunctionPointerUUUII_inner18{\r\nprivate:\r\n    void (*fpt)(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerUUUII_inner18(void(*_fpt)(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2) { (*fpt)(uint_1,uint_2,uint_3,int_1,int_2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerIIIP_retB_inner19 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 97;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerIIIP_retB_inner19,System::Delegate);\r\n    }\r\n\r\n    inline bool call$(s32 int_1,s32 int_2,s32 int_3,s32* obj_1) { CHCKTHIS; return (*this)(int_1,int_2,int_3,obj_1); }\r\n    virtual bool operator() (s32 int_1,s32 int_2,s32 int_3,s32* obj_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerIIIP_retB_inner19 : public EnginePrototype::_Delegate_Base_FunctionPointerIIIP_retB_inner19\r\n{\r\nprivate:\r\n    bool (TClass::*fpt)(s32 int_1,s32 int_2,s32 int_3,s32* obj_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerIIIP_retB_inner19(TClass* _pt2Object, bool(TClass::*_fpt)(s32 int_1,s32 int_2,s32 int_3,s32* obj_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerIIIP_retB_inner19::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual bool operator()(s32 int_1,s32 int_2,s32 int_3,s32* obj_1) { return (*pt2Object.*fpt)(int_1,int_2,int_3,obj_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerIIIP_retB_inner19 : public EnginePrototype::_Delegate_Base_FunctionPointerIIIP_retB_inner19{\r\nprivate:\r\n    bool (*fpt)(s32 int_1,s32 int_2,s32 int_3,s32* obj_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerIIIP_retB_inner19(bool(*_fpt)(s32 int_1,s32 int_2,s32 int_3,s32* obj_1))    { fpt=_fpt; };\r\n\r\n    virtual bool operator()(s32 int_1,s32 int_2,s32 int_3,s32* obj_1) { return (*fpt)(int_1,int_2,int_3,obj_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_FunctionPointerFS_inner20 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 99;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_FunctionPointerFS_inner20,System::Delegate);\r\n    }\r\n\r\n    inline void call$(float float_1,s32* intptr_1) { CHCKTHIS; (*this)(float_1,intptr_1); }\r\n    virtual void operator() (float float_1,s32* intptr_1)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_FunctionPointerFS_inner20 : public EnginePrototype::_Delegate_Base_FunctionPointerFS_inner20\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(float float_1,s32* intptr_1);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_FunctionPointerFS_inner20(TClass* _pt2Object, void(TClass::*_fpt)(float float_1,s32* intptr_1)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_FunctionPointerFS_inner20::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(float float_1,s32* intptr_1) { (*pt2Object.*fpt)(float_1,intptr_1);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_FunctionPointerFS_inner20 : public EnginePrototype::_Delegate_Base_FunctionPointerFS_inner20{\r\nprivate:\r\n    void (*fpt)(float float_1,s32* intptr_1);\r\npublic:\r\n\r\n    _DelegateS_FunctionPointerFS_inner20(void(*_fpt)(float float_1,s32* intptr_1))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(float float_1,s32* intptr_1) { (*fpt)(float_1,intptr_1); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner21 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 142;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner21,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total) { CHCKTHIS; (*this)(caller,loaded,total); }\r\n    virtual void operator() (EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner21 : public EnginePrototype::_Delegate_Base_CallBack_inner21\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner21(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner21::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total) { (*pt2Object.*fpt)(caller,loaded,total);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner21 : public EnginePrototype::_Delegate_Base_CallBack_inner21{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner21(void(*_fpt)(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBAsyncLoader* caller,u32 loaded,u32 total) { (*fpt)(caller,loaded,total); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 145;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_ExecuteCallBack_inner22,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime) { CHCKTHIS; (*this)(caller,deltaTime); }\r\n    virtual void operator() (EnginePrototype::CKLBGenericTask* caller,u32 deltaTime)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_ExecuteCallBack_inner22 : public EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_ExecuteCallBack_inner22(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_ExecuteCallBack_inner22::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime) { (*pt2Object.*fpt)(caller,deltaTime);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_ExecuteCallBack_inner22 : public EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime);\r\npublic:\r\n\r\n    _DelegateS_ExecuteCallBack_inner22(void(*_fpt)(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBGenericTask* caller,u32 deltaTime) { (*fpt)(caller,deltaTime); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_DieCallBack_inner23 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 147;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_DieCallBack_inner23,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBGenericTask* caller) { CHCKTHIS; (*this)(caller); }\r\n    virtual void operator() (EnginePrototype::CKLBGenericTask* caller)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_DieCallBack_inner23 : public EnginePrototype::_Delegate_Base_DieCallBack_inner23\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBGenericTask* caller);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_DieCallBack_inner23(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBGenericTask* caller)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_DieCallBack_inner23::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBGenericTask* caller) { (*pt2Object.*fpt)(caller);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_DieCallBack_inner23 : public EnginePrototype::_Delegate_Base_DieCallBack_inner23{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBGenericTask* caller);\r\npublic:\r\n\r\n    _DelegateS_DieCallBack_inner23(void(*_fpt)(EnginePrototype::CKLBGenericTask* caller))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBGenericTask* caller) { (*fpt)(caller); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner24 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 150;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner24,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBIntervalTimer* caller) { CHCKTHIS; (*this)(caller); }\r\n    virtual void operator() (EnginePrototype::CKLBIntervalTimer* caller)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner24 : public EnginePrototype::_Delegate_Base_CallBack_inner24\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBIntervalTimer* caller);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner24(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBIntervalTimer* caller)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner24::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBIntervalTimer* caller) { (*pt2Object.*fpt)(caller);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner24 : public EnginePrototype::_Delegate_Base_CallBack_inner24{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBIntervalTimer* caller);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner24(void(*_fpt)(EnginePrototype::CKLBIntervalTimer* caller))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBIntervalTimer* caller) { (*fpt)(caller); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner25 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 154;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner25,System::Delegate);\r\n    }\r\n\r\n    inline bool call$(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot) { CHCKTHIS; return (*this)(caller,uniq,msg,status,pRoot); }\r\n    virtual bool operator() (EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner25 : public EnginePrototype::_Delegate_Base_CallBack_inner25\r\n{\r\nprivate:\r\n    bool (TClass::*fpt)(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner25(TClass* _pt2Object, bool(TClass::*_fpt)(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner25::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual bool operator()(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot) { return (*pt2Object.*fpt)(caller,uniq,msg,status,pRoot);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner25 : public EnginePrototype::_Delegate_Base_CallBack_inner25{\r\nprivate:\r\n    bool (*fpt)(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner25(bool(*_fpt)(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot))    { fpt=_fpt; };\r\n\r\n    virtual bool operator()(EnginePrototype::CKLBNetAPI* caller,s32 uniq,s32 msg,s32 status,s32* pRoot) { return (*fpt)(caller,uniq,msg,status,pRoot); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 156;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBackVersionUp_inner26,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer) { CHCKTHIS; (*this)(caller,clientVer,serverVer); }\r\n    virtual void operator() (EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBackVersionUp_inner26 : public EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBackVersionUp_inner26(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBackVersionUp_inner26::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer) { (*pt2Object.*fpt)(caller,clientVer,serverVer);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBackVersionUp_inner26 : public EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer);\r\npublic:\r\n\r\n    _DelegateS_CallBackVersionUp_inner26(void(*_fpt)(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBNetAPI* caller,System::String* clientVer,System::String* serverVer) { (*fpt)(caller,clientVer,serverVer); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner27 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 160;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner27,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param) { CHCKTHIS; (*this)(caller,type,itemID,param); }\r\n    virtual void operator() (EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner27 : public EnginePrototype::_Delegate_Base_CallBack_inner27\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner27(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner27::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param) { (*pt2Object.*fpt)(caller,type,itemID,param);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner27 : public EnginePrototype::_Delegate_Base_CallBack_inner27{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner27(void(*_fpt)(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBStoreService* caller,s32 type,System::String* itemID,System::String* param) { (*fpt)(caller,type,itemID,param); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_onDieCallBack_inner28 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 163;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_onDieCallBack_inner28,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBTask* caller) { CHCKTHIS; (*this)(caller); }\r\n    virtual void operator() (EnginePrototype::CKLBTask* caller)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_onDieCallBack_inner28 : public EnginePrototype::_Delegate_Base_onDieCallBack_inner28\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBTask* caller);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_onDieCallBack_inner28(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBTask* caller)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_onDieCallBack_inner28::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBTask* caller) { (*pt2Object.*fpt)(caller);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_onDieCallBack_inner28 : public EnginePrototype::_Delegate_Base_onDieCallBack_inner28{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBTask* caller);\r\npublic:\r\n\r\n    _DelegateS_onDieCallBack_inner28(void(*_fpt)(EnginePrototype::CKLBTask* caller))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBTask* caller) { (*fpt)(caller); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner29 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 168;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner29,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUICanvas* caller) { CHCKTHIS; (*this)(caller); }\r\n    virtual void operator() (EnginePrototype::CKLBUICanvas* caller)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner29 : public EnginePrototype::_Delegate_Base_CallBack_inner29\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUICanvas* caller);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner29(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUICanvas* caller)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner29::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUICanvas* caller) { (*pt2Object.*fpt)(caller);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner29 : public EnginePrototype::_Delegate_Base_CallBack_inner29{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUICanvas* caller);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner29(void(*_fpt)(EnginePrototype::CKLBUICanvas* caller))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUICanvas* caller) { (*fpt)(caller); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_OnClickCallBack_inner30 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 172;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_OnClickCallBack_inner30,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y) { CHCKTHIS; (*this)(caller,x,y); }\r\n    virtual void operator() (EnginePrototype::CKLBUIControl* caller,s32 x,s32 y)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_OnClickCallBack_inner30 : public EnginePrototype::_Delegate_Base_OnClickCallBack_inner30\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_OnClickCallBack_inner30(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_OnClickCallBack_inner30::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y) { (*pt2Object.*fpt)(caller,x,y);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_OnClickCallBack_inner30 : public EnginePrototype::_Delegate_Base_OnClickCallBack_inner30{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y);\r\npublic:\r\n\r\n    _DelegateS_OnClickCallBack_inner30(void(*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y) { (*fpt)(caller,x,y); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 174;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_OnDblClickCallBack_inner31,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y) { CHCKTHIS; (*this)(caller,x,y); }\r\n    virtual void operator() (EnginePrototype::CKLBUIControl* caller,s32 x,s32 y)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_OnDblClickCallBack_inner31 : public EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_OnDblClickCallBack_inner31(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_OnDblClickCallBack_inner31::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y) { (*pt2Object.*fpt)(caller,x,y);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_OnDblClickCallBack_inner31 : public EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y);\r\npublic:\r\n\r\n    _DelegateS_OnDblClickCallBack_inner31(void(*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 x,s32 y) { (*fpt)(caller,x,y); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_OnDragCallBack_inner32 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 176;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_OnDragCallBack_inner32,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY) { CHCKTHIS; (*this)(caller,mode,x,y,mvX,mvY); }\r\n    virtual void operator() (EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_OnDragCallBack_inner32 : public EnginePrototype::_Delegate_Base_OnDragCallBack_inner32\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_OnDragCallBack_inner32(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_OnDragCallBack_inner32::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY) { (*pt2Object.*fpt)(caller,mode,x,y,mvX,mvY);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_OnDragCallBack_inner32 : public EnginePrototype::_Delegate_Base_OnDragCallBack_inner32{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY);\r\npublic:\r\n\r\n    _DelegateS_OnDragCallBack_inner32(void(*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 mode,s32 x,s32 y,s32 mvX,s32 mvY) { (*fpt)(caller,mode,x,y,mvX,mvY); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 178;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_OnPinchCallBack_inner33,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation) { CHCKTHIS; (*this)(caller,mode,pinch,rotation); }\r\n    virtual void operator() (EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_OnPinchCallBack_inner33 : public EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_OnPinchCallBack_inner33(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_OnPinchCallBack_inner33::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation) { (*pt2Object.*fpt)(caller,mode,pinch,rotation);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_OnPinchCallBack_inner33 : public EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation);\r\npublic:\r\n\r\n    _DelegateS_OnPinchCallBack_inner33(void(*_fpt)(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,s32 mode,float pinch,float rotation) { (*fpt)(caller,mode,pinch,rotation); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 180;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_OnLongTapCallBack_inner34,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y) { CHCKTHIS; (*this)(caller,elapsedTime,x,y); }\r\n    virtual void operator() (EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_OnLongTapCallBack_inner34 : public EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_OnLongTapCallBack_inner34(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_OnLongTapCallBack_inner34::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y) { (*pt2Object.*fpt)(caller,elapsedTime,x,y);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_OnLongTapCallBack_inner34 : public EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y);\r\npublic:\r\n\r\n    _DelegateS_OnLongTapCallBack_inner34(void(*_fpt)(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIControl* caller,u32 elapsedTime,s32 x,s32 y) { (*fpt)(caller,elapsedTime,x,y); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner35 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 185;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner35,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID) { CHCKTHIS; (*this)(caller,cmdID); }\r\n    virtual void operator() (EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner35 : public EnginePrototype::_Delegate_Base_CallBack_inner35\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner35(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner35::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID) { (*pt2Object.*fpt)(caller,cmdID);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner35 : public EnginePrototype::_Delegate_Base_CallBack_inner35{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner35(void(*_fpt)(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIDebugItem* caller,u32 cmdID) { (*fpt)(caller,cmdID); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner36 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 188;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner36,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y) { CHCKTHIS; (*this)(caller,type,x,y); }\r\n    virtual void operator() (EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner36 : public EnginePrototype::_Delegate_Base_CallBack_inner36\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner36(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner36::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y) { (*pt2Object.*fpt)(caller,type,x,y);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner36 : public EnginePrototype::_Delegate_Base_CallBack_inner36{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner36(void(*_fpt)(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIDragIcon* caller,u32 type,s32 x,s32 y) { (*fpt)(caller,type,x,y); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_SelectableCallBack_inner37 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 195;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_SelectableCallBack_inner37,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param) { CHCKTHIS; (*this)(caller,name,type,param); }\r\n    virtual void operator() (EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_SelectableCallBack_inner37 : public EnginePrototype::_Delegate_Base_SelectableCallBack_inner37\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_SelectableCallBack_inner37(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_SelectableCallBack_inner37::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param) { (*pt2Object.*fpt)(caller,name,type,param);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_SelectableCallBack_inner37 : public EnginePrototype::_Delegate_Base_SelectableCallBack_inner37{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param);\r\npublic:\r\n\r\n    _DelegateS_SelectableCallBack_inner37(void(*_fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIForm* caller,System::String* name,s32 type,s32 param) { (*fpt)(caller,name,type,param); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_AnimCallBack_inner38 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 197;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_AnimCallBack_inner38,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id) { CHCKTHIS; (*this)(caller,name,id); }\r\n    virtual void operator() (EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_AnimCallBack_inner38 : public EnginePrototype::_Delegate_Base_AnimCallBack_inner38\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_AnimCallBack_inner38(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_AnimCallBack_inner38::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id) { (*pt2Object.*fpt)(caller,name,id);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_AnimCallBack_inner38 : public EnginePrototype::_Delegate_Base_AnimCallBack_inner38{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id);\r\npublic:\r\n\r\n    _DelegateS_AnimCallBack_inner38(void(*_fpt)(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIForm* caller,System::String* name,u32 id) { (*fpt)(caller,name,id); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_AnimCallBack_inner39 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 201;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_AnimCallBack_inner39,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id) { CHCKTHIS; (*this)(caller,name,id); }\r\n    virtual void operator() (EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_AnimCallBack_inner39 : public EnginePrototype::_Delegate_Base_AnimCallBack_inner39\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_AnimCallBack_inner39(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_AnimCallBack_inner39::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id) { (*pt2Object.*fpt)(caller,name,id);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_AnimCallBack_inner39 : public EnginePrototype::_Delegate_Base_AnimCallBack_inner39{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id);\r\npublic:\r\n\r\n    _DelegateS_AnimCallBack_inner39(void(*_fpt)(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIGroup* caller,System::String* name,u32 id) { (*fpt)(caller,name,id); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_LimitCallBack_inner40 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 206;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_LimitCallBack_inner40,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos) { CHCKTHIS; (*this)(caller,type,itemCount,listLength,pos); }\r\n    virtual void operator() (EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_LimitCallBack_inner40 : public EnginePrototype::_Delegate_Base_LimitCallBack_inner40\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_LimitCallBack_inner40(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_LimitCallBack_inner40::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos) { (*pt2Object.*fpt)(caller,type,itemCount,listLength,pos);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_LimitCallBack_inner40 : public EnginePrototype::_Delegate_Base_LimitCallBack_inner40{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos);\r\npublic:\r\n\r\n    _DelegateS_LimitCallBack_inner40(void(*_fpt)(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,u32 type,u32 itemCount,s32 listLength,s32 pos) { (*fpt)(caller,type,itemCount,listLength,pos); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_DragCallBack_inner41 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 208;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_DragCallBack_inner41,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2) { CHCKTHIS; (*this)(caller,type,x,y,param1,param2); }\r\n    virtual void operator() (EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_DragCallBack_inner41 : public EnginePrototype::_Delegate_Base_DragCallBack_inner41\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_DragCallBack_inner41(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_DragCallBack_inner41::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2) { (*pt2Object.*fpt)(caller,type,x,y,param1,param2);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_DragCallBack_inner41 : public EnginePrototype::_Delegate_Base_DragCallBack_inner41{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2);\r\npublic:\r\n\r\n    _DelegateS_DragCallBack_inner41(void(*_fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,u32 type,s32 x,s32 y,s32 param1,s32 param2) { (*fpt)(caller,type,x,y,param1,param2); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_DynamicCallBack_inner42 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 210;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_DynamicCallBack_inner42,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIList* caller,s32 index,s32 id) { CHCKTHIS; (*this)(caller,index,id); }\r\n    virtual void operator() (EnginePrototype::CKLBUIList* caller,s32 index,s32 id)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_DynamicCallBack_inner42 : public EnginePrototype::_Delegate_Base_DynamicCallBack_inner42\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIList* caller,s32 index,s32 id);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_DynamicCallBack_inner42(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIList* caller,s32 index,s32 id)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_DynamicCallBack_inner42::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,s32 index,s32 id) { (*pt2Object.*fpt)(caller,index,id);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_DynamicCallBack_inner42 : public EnginePrototype::_Delegate_Base_DynamicCallBack_inner42{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIList* caller,s32 index,s32 id);\r\npublic:\r\n\r\n    _DelegateS_DynamicCallBack_inner42(void(*_fpt)(EnginePrototype::CKLBUIList* caller,s32 index,s32 id))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,s32 index,s32 id) { (*fpt)(caller,index,id); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 212;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_ScrollBarCallBack_inner43,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos) { CHCKTHIS; (*this)(caller,type,pos); }\r\n    virtual void operator() (EnginePrototype::CKLBUIList* caller,u32 type,s32 pos)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_ScrollBarCallBack_inner43 : public EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_ScrollBarCallBack_inner43(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_ScrollBarCallBack_inner43::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos) { (*pt2Object.*fpt)(caller,type,pos);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_ScrollBarCallBack_inner43 : public EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos);\r\npublic:\r\n\r\n    _DelegateS_ScrollBarCallBack_inner43(void(*_fpt)(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,u32 type,s32 pos) { (*fpt)(caller,type,pos); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_AnimCallBack_inner44 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 214;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_AnimCallBack_inner44,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id) { CHCKTHIS; (*this)(caller,name,id); }\r\n    virtual void operator() (EnginePrototype::CKLBUIList* caller,System::String* name,u32 id)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_AnimCallBack_inner44 : public EnginePrototype::_Delegate_Base_AnimCallBack_inner44\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_AnimCallBack_inner44(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_AnimCallBack_inner44::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id) { (*pt2Object.*fpt)(caller,name,id);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_AnimCallBack_inner44 : public EnginePrototype::_Delegate_Base_AnimCallBack_inner44{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id);\r\npublic:\r\n\r\n    _DelegateS_AnimCallBack_inner44(void(*_fpt)(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIList* caller,System::String* name,u32 id) { (*fpt)(caller,name,id); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner45 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 220;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner45,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIMoviePlayer* caller) { CHCKTHIS; (*this)(caller); }\r\n    virtual void operator() (EnginePrototype::CKLBUIMoviePlayer* caller)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner45 : public EnginePrototype::_Delegate_Base_CallBack_inner45\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIMoviePlayer* caller);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner45(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIMoviePlayer* caller)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner45::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIMoviePlayer* caller) { (*pt2Object.*fpt)(caller);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner45 : public EnginePrototype::_Delegate_Base_CallBack_inner45{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIMoviePlayer* caller);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner45(void(*_fpt)(EnginePrototype::CKLBUIMoviePlayer* caller))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIMoviePlayer* caller) { (*fpt)(caller); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 233;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_ScrollBarCallBack_inner46,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos) { CHCKTHIS; (*this)(caller,type,pos); }\r\n    virtual void operator() (EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_ScrollBarCallBack_inner46 : public EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_ScrollBarCallBack_inner46(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_ScrollBarCallBack_inner46::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos) { (*pt2Object.*fpt)(caller,type,pos);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_ScrollBarCallBack_inner46 : public EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos);\r\npublic:\r\n\r\n    _DelegateS_ScrollBarCallBack_inner46(void(*_fpt)(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIScrollBar* caller,u32 type,s32 pos) { (*fpt)(caller,type,pos); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner47 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 238;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner47,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label) { CHCKTHIS; (*this)(caller,label); }\r\n    virtual void operator() (EnginePrototype::CKLBUISWFPlayer* caller,System::String* label)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner47 : public EnginePrototype::_Delegate_Base_CallBack_inner47\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner47(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner47::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label) { (*pt2Object.*fpt)(caller,label);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner47 : public EnginePrototype::_Delegate_Base_CallBack_inner47{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner47(void(*_fpt)(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUISWFPlayer* caller,System::String* label) { (*fpt)(caller,label); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner48 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 256;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner48,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id) { CHCKTHIS; (*this)(caller,txt,id); }\r\n    virtual void operator() (EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner48 : public EnginePrototype::_Delegate_Base_CallBack_inner48\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner48(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner48::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id) { (*pt2Object.*fpt)(caller,txt,id);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner48 : public EnginePrototype::_Delegate_Base_CallBack_inner48{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner48(void(*_fpt)(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUITextInput* caller,System::String* txt,u32 id) { (*fpt)(caller,txt,id); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner49 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 260;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner49,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y) { CHCKTHIS; (*this)(caller,execount,type,id,x,y); }\r\n    virtual void operator() (EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner49 : public EnginePrototype::_Delegate_Base_CallBack_inner49\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner49(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner49::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y) { (*pt2Object.*fpt)(caller,execount,type,id,x,y);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner49 : public EnginePrototype::_Delegate_Base_CallBack_inner49{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner49(void(*_fpt)(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUITouchPad* caller,u32 execount,u32 type,u32 id,s32 x,s32 y) { (*fpt)(caller,execount,type,id,x,y); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner50 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 265;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner50,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY) { CHCKTHIS; (*this)(caller,type,x,y,moveX,moveY); }\r\n    virtual void operator() (EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner50 : public EnginePrototype::_Delegate_Base_CallBack_inner50\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner50(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner50::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY) { (*pt2Object.*fpt)(caller,type,x,y,moveX,moveY);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner50 : public EnginePrototype::_Delegate_Base_CallBack_inner50{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner50(void(*_fpt)(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIVirtualDoc* caller,s32 type,s32 x,s32 y,u32 moveX,u32 moveY) { (*fpt)(caller,type,x,y,moveX,moveY); };\r\n};\r\n\r\nclass EnginePrototype::_Delegate_Base_CallBack_inner51 : public System::Delegate\r\n{\r\nprivate:\r\nstatic const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 270;\r\npublic:\r\n    virtual bool _isInstanceOf(u32 typeID) {\r\n\t    _INSTANCEOF(_Delegate_Base_CallBack_inner51,System::Delegate);\r\n    }\r\n\r\n    inline void call$(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url) { CHCKTHIS; (*this)(caller,uint1,url); }\r\n    virtual void operator() (EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url)=0;\r\n    virtual u32 _processGC() { return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { }\r\n};\r\n\r\ntemplate <class TClass> class EnginePrototype::_DelegateI_CallBack_inner51 : public EnginePrototype::_Delegate_Base_CallBack_inner51\r\n{\r\nprivate:\r\n    void (TClass::*fpt)(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url);\r\n    TClass* pt2Object;\r\npublic:\r\n\r\n    _DelegateI_CallBack_inner51(TClass* _pt2Object, void(TClass::*_fpt)(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url)) {\r\n        if (!_pt2Object) { THROW(CS_NEW System::ArgumentException()); }\r\n        System::__GCObject::_RefSetValue((System::__GCObject**)&pt2Object, _pt2Object);\r\n        fpt=_fpt;\r\n    }\r\n\r\n    virtual u32 _processGC() { if (pt2Object) { System::Memory::pushList(pt2Object,0); } return System::__GCObject::COMPLETE; }\r\n    virtual void _releaseGC() { if (pt2Object && !pt2Object->isFreed()) { pt2Object->_removeRef((System::__GCObject**)&pt2Object); } }\r\n    virtual void _moveAlert(u32 offset) { \r\n        _Delegate_Base_CallBack_inner51::_moveAlert(offset);\r\n        u8* oldPtr; u8* newPtr;\r\n        if(pt2Object) {\r\n            newPtr = (u8*)(&pt2Object); oldPtr = newPtr - offset;\r\n            pt2Object->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n        }\r\n    }\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url) { (*pt2Object.*fpt)(caller,uint1,url);}\r\n};\r\n\r\nclass EnginePrototype::_DelegateS_CallBack_inner51 : public EnginePrototype::_Delegate_Base_CallBack_inner51{\r\nprivate:\r\n    void (*fpt)(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url);\r\npublic:\r\n\r\n    _DelegateS_CallBack_inner51(void(*_fpt)(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url))    { fpt=_fpt; };\r\n\r\n    virtual void operator()(EnginePrototype::CKLBUIWebArea* caller,u32 uint1,System::String* url) { (*fpt)(caller,uint1,url); };\r\n};\r\n\r\n//\r\n// Class/Struct Implementation\r\n//\r\n\r\n//=============================\r\n// Implementation of 'CKLBException'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBException::_ctor_CKLBException() {\r\n}\r\n\r\nEnginePrototype::CKLBException::CKLBException(System::String* msg) : System::Exception(msg)\r\n{\r\n    _ctor_CKLBException();\r\n}\r\n\r\nEnginePrototype::CKLBException::CKLBException() { _ctor_CKLBException(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBException::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBException,System::Exception);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBException::_processGC() {\r\n    System::Exception::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBException::_releaseGC() {\r\n    System::Exception::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBException::_moveAlert(u32 offset) {\r\n    System::Exception::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBExceptionNotImplemented'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBExceptionNotImplemented::_ctor_CKLBExceptionNotImplemented() {\r\n}\r\n\r\nEnginePrototype::CKLBExceptionNotImplemented::CKLBExceptionNotImplemented(System::String* msg) : EnginePrototype::CKLBException(msg)\r\n{\r\n    _ctor_CKLBExceptionNotImplemented();\r\n}\r\n\r\nEnginePrototype::CKLBExceptionNotImplemented::CKLBExceptionNotImplemented() { _ctor_CKLBExceptionNotImplemented(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBExceptionNotImplemented::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBExceptionNotImplemented,EnginePrototype::CKLBException);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBExceptionNotImplemented::_processGC() {\r\n    EnginePrototype::CKLBException::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionNotImplemented::_releaseGC() {\r\n    EnginePrototype::CKLBException::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionNotImplemented::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBException::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBExceptionForbiddenMethod'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBExceptionForbiddenMethod::_ctor_CKLBExceptionForbiddenMethod() {\r\n}\r\n\r\nEnginePrototype::CKLBExceptionForbiddenMethod::CKLBExceptionForbiddenMethod(System::String* msg) : EnginePrototype::CKLBException(msg)\r\n{\r\n    _ctor_CKLBExceptionForbiddenMethod();\r\n}\r\n\r\nEnginePrototype::CKLBExceptionForbiddenMethod::CKLBExceptionForbiddenMethod() { _ctor_CKLBExceptionForbiddenMethod(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBExceptionForbiddenMethod::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBExceptionForbiddenMethod,EnginePrototype::CKLBException);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBExceptionForbiddenMethod::_processGC() {\r\n    EnginePrototype::CKLBException::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionForbiddenMethod::_releaseGC() {\r\n    EnginePrototype::CKLBException::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionForbiddenMethod::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBException::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBExceptionNullCppObject'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBExceptionNullCppObject::_ctor_CKLBExceptionNullCppObject() {\r\n}\r\n\r\nEnginePrototype::CKLBExceptionNullCppObject::CKLBExceptionNullCppObject(System::String* msg) : EnginePrototype::CKLBException(msg)\r\n{\r\n    _ctor_CKLBExceptionNullCppObject();\r\n}\r\n\r\nEnginePrototype::CKLBExceptionNullCppObject::CKLBExceptionNullCppObject() { _ctor_CKLBExceptionNullCppObject(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBExceptionNullCppObject::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBExceptionNullCppObject,EnginePrototype::CKLBException);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBExceptionNullCppObject::_processGC() {\r\n    EnginePrototype::CKLBException::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionNullCppObject::_releaseGC() {\r\n    EnginePrototype::CKLBException::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionNullCppObject::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBException::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBExceptionTooOld'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBExceptionTooOld::_ctor_CKLBExceptionTooOld() {\r\n}\r\n\r\nEnginePrototype::CKLBExceptionTooOld::CKLBExceptionTooOld(System::String* msg) : EnginePrototype::CKLBException(msg)\r\n{\r\n    _ctor_CKLBExceptionTooOld();\r\n}\r\n\r\nEnginePrototype::CKLBExceptionTooOld::CKLBExceptionTooOld() { _ctor_CKLBExceptionTooOld(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBExceptionTooOld::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBExceptionTooOld,EnginePrototype::CKLBException);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBExceptionTooOld::_processGC() {\r\n    EnginePrototype::CKLBException::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionTooOld::_releaseGC() {\r\n    EnginePrototype::CKLBException::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBExceptionTooOld::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBException::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'GameObject'\r\n//=============================\r\n\r\nvoid EnginePrototype::GameObject::_ctor_GameObject() {\r\n    m_handle = NULLHANDLER;\r\n    _sm_callbacksArray(CS_NEW System::Array< System::Delegate* >(NBCALLBACKS));\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::GameObject::_ext_CKLBObjectScriptable_getScriptContext(s32* p)\r\n{\r\n    return CKLBObjectScriptable_getScriptContext(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::GameObject::_ext_CKLBObjectScriptable_setScriptContext(s32* p,u32 handle)\r\n{\r\n    CKLBObjectScriptable_setScriptContext(p,handle);\r\n}\r\n\r\nbool EnginePrototype::GameObject::isBoundToCpp()\r\n{\r\n    return _gm_cppObject$() != System::IntPtr::Zero;\r\n}\r\n\r\ninline bool EnginePrototype::GameObject::isBoundToCpp$() { CHCKTHIS; return isBoundToCpp(); }\r\n\r\nEnginePrototype::GameObject::GameObject(u32 typeID)\r\n{\r\n    _ctor_GameObject();\r\n    _sm_typeID$(typeID);\r\n    EnginePrototype::WrapperReg::getInstance()->registerGameObject$(this);\r\n    _sm_cppObject$(System::IntPtr::Zero);\r\n}\r\n\r\nvoid EnginePrototype::GameObject::bind(s32* cppObj)\r\n{\r\n    if (cppObj != System::IntPtr::Zero)\r\n    {\r\n        if (_gm_cppObject$() == System::IntPtr::Zero)\r\n        {\r\n            u32 nativeHandle = _ext_CKLBObjectScriptable_getScriptContext(cppObj);\r\n            if (nativeHandle == NULLHANDLER)\r\n            {\r\n                EnginePrototype::NativeManagement::registerWrapper(cppObj,_gm_handle$());\r\n                _sm_cppObject$(cppObj);\r\n                doSetupCallbacks$();\r\n            }\r\n            else\r\n            {\r\n                THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr6Obj));\r\n            }\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr7Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr8Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::GameObject::bind$(s32* cppObj) { CHCKTHIS; return bind(cppObj); }\r\n\r\nvoid EnginePrototype::GameObject::bind(System::String* nodeName)\r\n{\r\n    if (nodeName == NULL)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr9Obj));\r\n    }\r\n    if (_gm_cppObject$() != System::IntPtr::Zero)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr7Obj));\r\n    }\r\n    EnginePrototype::NodeIterator* nodeIterator = CS_NEW EnginePrototype::NodeIterator(EnginePrototype::NativeManagement::getContextCounter(),EnginePrototype::NodeIterator::getRoot());\r\n    if (nodeIterator->find$(nodeName,false))\r\n    {\r\n        s32* cppObj = nodeIterator->getAsUITask$()->_acc_gCppObject$();\r\n        u32 nativeHandle = _ext_CKLBObjectScriptable_getScriptContext(cppObj);\r\n        if (nativeHandle == NULLHANDLER)\r\n        {\r\n            EnginePrototype::NativeManagement::registerWrapper(cppObj,_gm_handle$());\r\n            _sm_cppObject$(cppObj);\r\n            doSetupCallbacks$();\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr6Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr10Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::GameObject::bind$(System::String* nodeName) { CHCKTHIS; return bind(nodeName); }\r\n\r\nvoid EnginePrototype::GameObject::unbind()\r\n{\r\n    System::Console::WriteLine(_$_cteStr11Obj);\r\n    if (_gm_cppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBObjectScriptable_setScriptContext(_gm_cppObject$(),NULLHANDLER);\r\n        _sm_cppObject$(System::IntPtr::Zero);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    System::Console::WriteLine(_$_cteStr12Obj);\r\n}\r\n\r\ninline void EnginePrototype::GameObject::unbind$() { CHCKTHIS; return unbind(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::GameObject::doSetupCallbacks()\r\n{\r\n}\r\n\r\ninline void EnginePrototype::GameObject::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::GameObject::clearInternals()\r\n{\r\n}\r\n\r\ninline void EnginePrototype::GameObject::clearInternals$() { CHCKTHIS; return clearInternals(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::GameObject::Dispose()\r\n{\r\n    System::Console::WriteLine(_$_cteStr13Obj);\r\n    clearInternals$();\r\n    if (_gm_handle$() != NULLHANDLER)\r\n    {\r\n        EnginePrototype::WrapperReg::getInstance()->unregisterGameObject$(this);\r\n    }\r\n    if (_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        unbind$();\r\n    }\r\n    System::Console::WriteLine(_$_cteStr14Obj);\r\n}\r\n\r\ninline void EnginePrototype::GameObject::Dispose$() { CHCKTHIS; return Dispose(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::GameObject::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr15Obj));\r\n}\r\n\r\ninline void EnginePrototype::GameObject::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*static*/\r\nvoid EnginePrototype::GameObject::staticSetDelegate(u32 handle,System::Delegate* delegatePtr,System::String* delegateName)\r\n{\r\n    EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle)->setDelegate$(delegatePtr,delegateName);\r\n}\r\n\r\nvoid EnginePrototype::GameObject::forceSetupCallBackWithVirtual(System::String* delegateName)\r\n{\r\n    setDelegate$((System::Delegate*)NULL,delegateName);\r\n}\r\n\r\ninline void EnginePrototype::GameObject::forceSetupCallBackWithVirtual$(System::String* delegateName) { CHCKTHIS; return forceSetupCallBackWithVirtual(delegateName); }\r\n\r\nvoid EnginePrototype::GameObject::registerCallBack(System::Delegate* callback,u32 index)\r\n{\r\n    if (0 <= index && index < NBCALLBACKS)\r\n    {\r\n        if (callback != NULL)\r\n        {\r\n            _gm_callbacksArray$()->_idx_s$(index,callback);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr16Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::GameObject::registerCallBack$(System::Delegate* callback,u32 index) { CHCKTHIS; return registerCallBack(callback,index); }\r\n\r\nSystem::Delegate* EnginePrototype::GameObject::getCallBack(u32 index)\r\n{\r\n    if (0 <= index && index < NBCALLBACKS)\r\n    {\r\n        System::Delegate* d = _gm_callbacksArray$()->_idx_g$(index);\r\n        return d;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\ninline System::Delegate* EnginePrototype::GameObject::getCallBack$(u32 index) { CHCKTHIS; return getCallBack(index); }\r\n\r\nEnginePrototype::GameObject::GameObject() { _ctor_GameObject(); }\r\n\r\ninline System::Object* EnginePrototype::GameObject::_sm_tag(System::Object* _$value)  { return (System::Object*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_tag,_$value); }\r\ninline System::Object* EnginePrototype::GameObject::_sm_tag$(System::Object* _$value) { CHCKTHIS; return _sm_tag(_$value); }\r\ninline System::Array<System::Delegate*>* EnginePrototype::GameObject::_sm_callbacksArray(System::Array<System::Delegate*>* _$value)  { return (System::Array<System::Delegate*>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callbacksArray,_$value); }\r\ninline System::Array<System::Delegate*>* EnginePrototype::GameObject::_sm_callbacksArray$(System::Array<System::Delegate*>* _$value) { CHCKTHIS; return _sm_callbacksArray(_$value); }\r\n\r\n\r\ninline System::Object* EnginePrototype::GameObject::_acc_gTag(){\r\n    return _gm_tag$();\r\n}\r\n\r\ninline System::Object* EnginePrototype::GameObject::_acc_gTag$() { CHCKTHIS; return _acc_gTag(); }\r\n\r\ninline System::Object* EnginePrototype::GameObject::_acc_sTag(System::Object* value){\r\n    System::Object* _returnValue_ = value;\r\n    _sm_tag$(value);\r\n    return _returnValue_;\r\n}\r\ninline System::Object* EnginePrototype::GameObject::_acc_sTag$(System::Object* value)\t\t{ CHCKTHIS; return _acc_sTag(value); }\r\ninline u32 EnginePrototype::GameObject::_acc_gTypeID(){\r\n    return _gm_typeID$();\r\n}\r\n\r\ninline u32 EnginePrototype::GameObject::_acc_gTypeID$() { CHCKTHIS; return _acc_gTypeID(); }\r\n\r\ninline u32 EnginePrototype::GameObject::_acc_gHandle(){\r\n    return _gm_handle$();\r\n}\r\n\r\ninline u32 EnginePrototype::GameObject::_acc_gHandle$() { CHCKTHIS; return _acc_gHandle(); }\r\n\r\ninline u32 EnginePrototype::GameObject::_acc_sHandle(u32 value){\r\n    u32 _returnValue_ = value;\r\n    _sm_handle$(value);\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::GameObject::_acc_sHandle$(u32 value)\t\t{ CHCKTHIS; return _acc_sHandle(value); }\r\ninline s32* EnginePrototype::GameObject::_acc_gCppObject(){\r\n    return _gm_cppObject$();\r\n}\r\n\r\ninline s32* EnginePrototype::GameObject::_acc_gCppObject$() { CHCKTHIS; return _acc_gCppObject(); }\r\n\r\ninline s32* EnginePrototype::GameObject::_acc_sCppObject(s32* value){\r\n    s32* _returnValue_ = value;\r\n    _sm_cppObject$(value);\r\n    return _returnValue_;\r\n}\r\ninline s32* EnginePrototype::GameObject::_acc_sCppObject$(s32* value)\t\t{ CHCKTHIS; return _acc_sCppObject(value); }\r\n/*virtual*/\r\nbool EnginePrototype::GameObject::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(GameObject,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::GameObject::_processGC() {\r\n    if (m_tag) { System::Memory::pushList(m_tag,0); }\r\n    if (m_callbacksArray) { System::Memory::pushList(m_callbacksArray,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::GameObject::_releaseGC() {\r\n    Dispose$();\r\n    if (m_tag && !m_tag->isFreed()) { m_tag->_removeRef((System::__GCObject**)&m_tag); }\r\n    if (m_callbacksArray && !m_callbacksArray->isFreed()) { m_callbacksArray->_removeRef((System::__GCObject**)&m_callbacksArray); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::GameObject::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_tag) {\r\n      newPtr = (u8*)(&m_tag); oldPtr = newPtr - offset;\r\n      m_tag->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_callbacksArray) {\r\n      newPtr = (u8*)(&m_callbacksArray); oldPtr = newPtr - offset;\r\n      m_callbacksArray->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'GameObjectFactory'\r\n//=============================\r\n\r\nvoid EnginePrototype::GameObjectFactory::_ctor_GameObjectFactory() {\r\n}\r\n\r\nEnginePrototype::GameObjectFactory::GameObjectFactory() { _ctor_GameObjectFactory(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::GameObjectFactory::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(GameObjectFactory,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::GameObjectFactory::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::GameObjectFactory::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::GameObjectFactory::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'NativeManagement'\r\n//=============================\r\n\r\nvoid EnginePrototype::NativeManagement::_ctor_NativeManagement() {\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::NativeManagement::_ext_CKLBObject_getTypeID(s32* p)\r\n{\r\n    return CKLBObject_getTypeID(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::NativeManagement::_ext_CKLBObjectScriptable_getScriptContext(s32* p)\r\n{\r\n    return CKLBObjectScriptable_getScriptContext(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::_ext_CKLBObjectScriptable_setScriptContext(s32* p,u32 handle)\r\n{\r\n    CKLBObjectScriptable_setScriptContext(p,handle);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NativeManagement::_ext_CKLBScriptEnv_getCallBackCount()\r\n{\r\n    return CKLBScriptEnv_getCallBackCount();\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NativeManagement::_ext_CKLBScriptEnv_getErrorPtr()\r\n{\r\n    return CKLBScriptEnv_getErrorPtr();\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NativeManagement::_ext_CKLBScriptEnv_getErrorString()\r\n{\r\n    return CKLBScriptEnv_getErrorString();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::_ext_CKLBScriptEnv_resetError()\r\n{\r\n    CKLBScriptEnv_resetError();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::resetCppError()\r\n{\r\n    _ext_CKLBScriptEnv_resetError();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::intercepCppError()\r\n{\r\n    if (_acc_gCppErrorFlag() != 0)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr19Obj)->_appendStr(_acc_gCppErrorString())->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::NativeManagement::getContextCounter()\r\n{\r\n    return (u32)System::Runtime::InteropServices::Marshal::ReadInt32(ms_counter);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::NativeManagement::getTypeID(s32* cppObj)\r\n{\r\n    return _ext_CKLBObject_getTypeID(cppObj);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::registerWrapper(s32* cppObj,u32 handle)\r\n{\r\n    System::Console::WriteLine(_$_cteStr20Obj);\r\n    EnginePrototype::GameObject* gameObject = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (cppObj != System::IntPtr::Zero)\r\n    {\r\n        if (EnginePrototype::NativeManagement::getTypeID(cppObj) == gameObject->_acc_gTypeID$())\r\n        {\r\n            _ext_CKLBObjectScriptable_setScriptContext(cppObj,handle);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr21Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    System::Console::WriteLine(_$_cteStr22Obj);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::unregisterWrapper(s32* cppObj)\r\n{\r\n    if (cppObj != System::IntPtr::Zero)\r\n    {\r\n        System::Console::WriteLine(_$_cteStr23Obj);\r\n        _ext_CKLBObjectScriptable_setScriptContext(cppObj,EnginePrototype::GameObject::NULLHANDLER);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::destroyFromNative(u32 handle)\r\n{\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (obj != NULL)\r\n    {\r\n        EnginePrototype::WrapperReg::getInstance()->unregisterGameObject$(obj);\r\n        obj->_acc_sCppObject$(System::IntPtr::Zero);\r\n        obj->Dispose$();\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackV(u32 cbInfos)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerV_inner0* cb = (EnginePrototype::_Delegate_Base_FunctionPointerV_inner0*)obj->getCallBack$(callbackIndex);\r\n        cb->call$();\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackII(u32 cbInfos,s32 int_1,s32 int_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerII_inner1* cb = (EnginePrototype::_Delegate_Base_FunctionPointerII_inner1*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(int_1,int_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackIII(u32 cbInfos,s32 int_1,s32 int_2,s32 int_3)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerIII_inner2* cb = (EnginePrototype::_Delegate_Base_FunctionPointerIII_inner2*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(int_1,int_2,int_3);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackIIII(u32 cbInfos,s32 int_1,s32 int_2,s32 int_3,s32 int_4)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerIIII_inner3* cb = (EnginePrototype::_Delegate_Base_FunctionPointerIIII_inner3*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(int_1,int_2,int_3,int_4);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackS(u32 cbInfos,s32* intptr_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerS_inner4* cb = (EnginePrototype::_Delegate_Base_FunctionPointerS_inner4*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(intptr_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackSII(u32 cbInfos,s32* intptr_1,s32 int_1,s32 int_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerSII_inner5* cb = (EnginePrototype::_Delegate_Base_FunctionPointerSII_inner5*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(intptr_1,int_1,int_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackSU(u32 cbInfos,s32* intptr_1,u32 uint_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerSU_inner6* cb = (EnginePrototype::_Delegate_Base_FunctionPointerSU_inner6*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(intptr_1,uint_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackSS(u32 cbInfos,s32* intptr_1,s32* intptr_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerSS_inner7* cb = (EnginePrototype::_Delegate_Base_FunctionPointerSS_inner7*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(intptr_1,intptr_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUS(u32 cbInfos,u32 uint_1,s32* intptr_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUS_inner8* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUS_inner8*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,intptr_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUSS(u32 cbInfos,u32 uint_1,s32* intptr_1,s32* intptr_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUSS_inner9* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUSS_inner9*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,intptr_1,intptr_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackU(u32 cbInfos,u32 uint_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerU_inner10* cb = (EnginePrototype::_Delegate_Base_FunctionPointerU_inner10*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUU(u32 cbInfos,u32 uint_1,u32 uint_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUU_inner11* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUU_inner11*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,uint_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUFF(u32 cbInfos,u32 uint_1,float float_1,float float_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUFF_inner12* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUFF_inner12*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,float_1,float_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUI(u32 cbInfos,u32 uint_1,s32 int_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUI_inner13* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUI_inner13*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,int_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUII(u32 cbInfos,u32 uint_1,s32 int_1,s32 int_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUII_inner14* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUII_inner14*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,int_1,int_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUIIII(u32 cbInfos,u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUIIII_inner15* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUIIII_inner15*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,int_1,int_2,int_3,int_4);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUIIUU(u32 cbInfos,u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUIIUU_inner16* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUIIUU_inner16*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,int_1,int_2,uint_2,uint_3);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUUII(u32 cbInfos,u32 uint_1,u32 uint_2,s32 int_1,s32 int_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUUII_inner17* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUUII_inner17*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,uint_2,int_1,int_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackUUUII(u32 cbInfos,u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerUUUII_inner18* cb = (EnginePrototype::_Delegate_Base_FunctionPointerUUUII_inner18*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(uint_1,uint_2,uint_3,int_1,int_2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::NativeManagement::doCallBackIIIP_retB(u32 cbInfos,s32 int_1,s32 int_2,s32 int_3,s32* obj_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerIIIP_retB_inner19* cb = (EnginePrototype::_Delegate_Base_FunctionPointerIIIP_retB_inner19*)obj->getCallBack$(callbackIndex);\r\n        return cb->call$(int_1,int_2,int_3,obj_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NativeManagement::doCallBackFS(u32 cbInfos,float float_1,s32* intptr_1)\r\n{\r\n    u32 callbackIndex = (cbInfos & -536870912) >> 29;\r\n    u32 handle = cbInfos & 536870911;\r\n    EnginePrototype::GameObject* obj = EnginePrototype::WrapperReg::getInstance()->getObjectFromHandle$(handle);\r\n    if (0 <= callbackIndex && callbackIndex < EnginePrototype::GameObject::NBCALLBACKS)\r\n    {\r\n        EnginePrototype::_Delegate_Base_FunctionPointerFS_inner20* cb = (EnginePrototype::_Delegate_Base_FunctionPointerFS_inner20*)obj->getCallBack$(callbackIndex);\r\n        cb->call$(float_1,intptr_1);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException((CS_NEW System::String())->_appendStr(_$_cteStr17Obj)->_appendI((EnginePrototype::GameObject::NBCALLBACKS - 1))->_appendStr(_$_cteStr18Obj)->_appendClose()));\r\n    }\r\n}\r\n\r\nEnginePrototype::NativeManagement::NativeManagement() { _ctor_NativeManagement(); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::NativeManagement::_acc_gCppErrorFlag(){\r\n    return (u32)System::Runtime::InteropServices::Marshal::ReadInt32(ms_cppErrorFlag);\r\n}\r\n\r\ninline System::String* EnginePrototype::NativeManagement::_acc_gCppErrorString(){\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBScriptEnv_getErrorString());\r\n}\r\n\r\n/*virtual*/\r\nbool EnginePrototype::NativeManagement::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(NativeManagement,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::NativeManagement::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::NativeManagement::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::NativeManagement::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'NodeIterator'\r\n//=============================\r\n\r\nvoid EnginePrototype::NodeIterator::_ctor_NodeIterator() {\r\n    _sm_navigation(CS_NEW System::Collections::Generic::List<s32*>());\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getRoot()\r\n{\r\n    return node_getRoot();\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getChild(s32* pNode)\r\n{\r\n    return node_getChild(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getParent(s32* pNode)\r\n{\r\n    return node_getParent(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getBrother(s32* pNode)\r\n{\r\n    return node_getBrother(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getNodeFromTask(s32* pTask)\r\n{\r\n    return node_getNodeFromTask(pTask);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::NodeIterator::_ext_node_getNodeScaleX(s32* pNode)\r\n{\r\n    return node_getNodeScaleX(pNode);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::NodeIterator::_ext_node_getNodeScaleY(s32* pNode)\r\n{\r\n    return node_getNodeScaleY(pNode);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::NodeIterator::_ext_node_getRotation(s32* pNode)\r\n{\r\n    return node_getRotation(pNode);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::NodeIterator::_ext_node_getNodeTranslateX(s32* pNode)\r\n{\r\n    return node_getNodeTranslateX(pNode);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::NodeIterator::_ext_node_getNodeTranslateY(s32* pNode)\r\n{\r\n    return node_getNodeTranslateY(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getName(s32* pNode)\r\n{\r\n    return node_getName(pNode);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setName(s32* pNode,s32* name)\r\n{\r\n    node_setName(pNode,name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setTranslate(s32* pNode,float x,float y)\r\n{\r\n    node_setTranslate(pNode,x,y);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setRotation(s32* pNode,float deg)\r\n{\r\n    node_setRotation(pNode,deg);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setScale(s32* pNode,float scaleX,float scaleY)\r\n{\r\n    node_setScale(pNode,scaleX,scaleY);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_getColorMatrixVec(s32* pNode,System::Array<float>* dst)\r\n{\r\n    node_getColorMatrixVec(pNode,dst ? (float*)dst->_getPArray() : NULL);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setColorMatrixVec(s32* pNode,System::Array<float>* src)\r\n{\r\n    node_setColorMatrixVec(pNode,src ? (float*)src->_getPArray() : NULL);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::NodeIterator::_ext_node_getColorMatrixUInt(s32* pNode)\r\n{\r\n    return node_getColorMatrixUInt(pNode);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setColorMatrixUInt(s32* pNode,u32 val)\r\n{\r\n    node_setColorMatrixUInt(pNode,val);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::NodeIterator::_ext_node_setVisible(s32* pNode,bool visible)\r\n{\r\n    node_setVisible(pNode,visible);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::NodeIterator::_ext_node_getVisible(s32* pNode)\r\n{\r\n    return node_getVisible(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_asElement(s32* pNode)\r\n{\r\n    return node_asElement(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_asContainer(s32* pNode)\r\n{\r\n    return node_asContainer(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_asSelectable(s32* pNode)\r\n{\r\n    return node_asSelectable(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_asAnimationNode(s32* pNode)\r\n{\r\n    return node_asAnimationNode(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_getUITask(s32* pNode)\r\n{\r\n    return node_getUITask(pNode);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_search(s32* pNode,s32* name)\r\n{\r\n    return node_search(pNode,name);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::_ext_node_searchFirstByTypeID(s32* pNode,u32 typeID)\r\n{\r\n    return node_searchFirstByTypeID(pNode,typeID);\r\n}\r\n\r\nEnginePrototype::NodeIterator::NodeIterator()\r\n{\r\n    _ctor_NodeIterator();\r\n}\r\n\r\nEnginePrototype::NodeIterator::NodeIterator(u32 counter,s32* node)\r\n{\r\n    _ctor_NodeIterator();\r\n    this->_sm_counter$(counter);\r\n    this->_sm_nodeCpp$(node);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::getRoot()\r\n{\r\n    return _ext_node_getRoot();\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::NodeIterator::getNodeFromTask(EnginePrototype::CKLBUITask* task)\r\n{\r\n    return _ext_node_getNodeFromTask(task->_acc_gCppObject$());\r\n}\r\n\r\nEnginePrototype::Element* EnginePrototype::NodeIterator::getAsElement()\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_ext_node_asElement(_gm_nodeCpp$()) != System::IntPtr::Zero)\r\n        {\r\n            return CS_NEW EnginePrototype::Element(_gm_counter$(),_ext_node_asElement(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            return NULL;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline EnginePrototype::Element* EnginePrototype::NodeIterator::getAsElement$() { CHCKTHIS; return getAsElement(); }\r\n\r\nEnginePrototype::Container* EnginePrototype::NodeIterator::getAsContainer()\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_ext_node_asContainer(_gm_nodeCpp$()) != System::IntPtr::Zero)\r\n        {\r\n            return CS_NEW EnginePrototype::Container(_gm_counter$(),_ext_node_asElement(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            return NULL;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline EnginePrototype::Container* EnginePrototype::NodeIterator::getAsContainer$() { CHCKTHIS; return getAsContainer(); }\r\n\r\nEnginePrototype::Selectable* EnginePrototype::NodeIterator::getAsSelectable()\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_ext_node_asSelectable(_gm_nodeCpp$()) != System::IntPtr::Zero)\r\n        {\r\n            return CS_NEW EnginePrototype::Selectable(_gm_counter$(),_ext_node_asElement(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            return NULL;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline EnginePrototype::Selectable* EnginePrototype::NodeIterator::getAsSelectable$() { CHCKTHIS; return getAsSelectable(); }\r\n\r\nEnginePrototype::AnimationNode* EnginePrototype::NodeIterator::getAsAnimationNode()\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_ext_node_asAnimationNode(_gm_nodeCpp$()) != System::IntPtr::Zero)\r\n        {\r\n            return CS_NEW EnginePrototype::AnimationNode(_gm_counter$(),_ext_node_asElement(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            return NULL;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline EnginePrototype::AnimationNode* EnginePrototype::NodeIterator::getAsAnimationNode$() { CHCKTHIS; return getAsAnimationNode(); }\r\n\r\nbool EnginePrototype::NodeIterator::gotoChild(bool registerStack)\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        s32* nNode = _ext_node_getChild(_gm_nodeCpp$());\r\n        if (nNode != System::IntPtr::Zero)\r\n        {\r\n            if (registerStack)\r\n            {\r\n                _gm_navigation$()->Add$(_gm_nodeCpp$());\r\n            }\r\n            _sm_nodeCpp$(nNode);\r\n            return true;\r\n        }\r\n        else\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::NodeIterator::gotoChild$(bool registerStack) { CHCKTHIS; return gotoChild(registerStack); }\r\n\r\nbool EnginePrototype::NodeIterator::gotoBrother(bool registerStack)\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        s32* nNode = _ext_node_getBrother(_gm_nodeCpp$());\r\n        if (nNode != System::IntPtr::Zero)\r\n        {\r\n            if (registerStack)\r\n            {\r\n                _gm_navigation$()->Add$(_gm_nodeCpp$());\r\n            }\r\n            _sm_nodeCpp$(nNode);\r\n            return true;\r\n        }\r\n        else\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::NodeIterator::gotoBrother$(bool registerStack) { CHCKTHIS; return gotoBrother(registerStack); }\r\n\r\nbool EnginePrototype::NodeIterator::gotoParent(bool registerStack)\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        s32* nNode = _ext_node_getParent(_gm_nodeCpp$());\r\n        if (nNode != System::IntPtr::Zero)\r\n        {\r\n            if (registerStack)\r\n            {\r\n                _gm_navigation$()->Add$(_gm_nodeCpp$());\r\n            }\r\n            _sm_nodeCpp$(nNode);\r\n            return true;\r\n        }\r\n        else\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::NodeIterator::gotoParent$(bool registerStack) { CHCKTHIS; return gotoParent(registerStack); }\r\n\r\nbool EnginePrototype::NodeIterator::rollback()\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_navigation$()->_acc_gCount$() != 0)\r\n        {\r\n            _sm_nodeCpp$(_gm_navigation$()->_idx_g$(_gm_navigation$()->_acc_gCount$() - 1));\r\n            _gm_navigation$()->RemoveAt$(_gm_navigation$()->_acc_gCount$() - 1);\r\n            return true;\r\n        }\r\n        else\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::NodeIterator::rollback$() { CHCKTHIS; return rollback(); }\r\n\r\nbool EnginePrototype::NodeIterator::find(System::String* name,bool registerStack)\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            s32* ptr = _ext_node_search(_gm_nodeCpp$(),System::__MarshallingUtils::NativeUtf8FromString(name));\r\n            if (ptr != System::IntPtr::Zero)\r\n            {\r\n                if (registerStack)\r\n                {\r\n                    _gm_navigation$()->Add$(_gm_nodeCpp$());\r\n                }\r\n                _sm_nodeCpp$(ptr);\r\n                return true;\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::NodeIterator::find$(System::String* name,bool registerStack) { CHCKTHIS; return find(name,registerStack); }\r\n\r\nEnginePrototype::CKLBUITask* EnginePrototype::NodeIterator::getAsUITask()\r\n{\r\n    s32* ptr = _ext_node_getUITask(_gm_nodeCpp$());\r\n    if (ptr != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        EnginePrototype::CKLBUITask* task = CS_NEW EnginePrototype::CKLBUITask(EnginePrototype::NativeManagement::getTypeID(ptr));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        task->bind$(ptr);\r\n        return task;\r\n    }\r\n    else\r\n    {\r\n        return NULL;\r\n    }\r\n}\r\n\r\ninline EnginePrototype::CKLBUITask* EnginePrototype::NodeIterator::getAsUITask$() { CHCKTHIS; return getAsUITask(); }\r\n\r\nEnginePrototype::CKLBUITask* EnginePrototype::NodeIterator::bindTask(EnginePrototype::CKLBUITask* task,System::String* name)\r\n{\r\n    if (name != NULL)\r\n    {\r\n        if (find$(name,true))\r\n        {\r\n            task->bind$(_ext_node_getUITask(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr10Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        s32* ptr = _ext_node_searchFirstByTypeID(_gm_nodeCpp$(),task->_acc_gTypeID$());\r\n        if (ptr != System::IntPtr::Zero)\r\n        {\r\n            task->bind$(ptr);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr24Obj));\r\n        }\r\n    }\r\n    return task;\r\n}\r\n\r\ninline EnginePrototype::CKLBUITask* EnginePrototype::NodeIterator::bindTask$(EnginePrototype::CKLBUITask* task,System::String* name) { CHCKTHIS; return bindTask(task,name); }\r\n\r\nvoid EnginePrototype::NodeIterator::setXY(float x,float y)\r\n{\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setTranslate(_gm_nodeCpp$(),x,y);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::NodeIterator::setXY$(float x,float y) { CHCKTHIS; return setXY(x,y); }\r\n\r\ninline System::Collections::Generic::List<s32*>* EnginePrototype::NodeIterator::_sm_navigation(System::Collections::Generic::List<s32*>* _$value)  { return (System::Collections::Generic::List<s32*>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_navigation,_$value); }\r\ninline System::Collections::Generic::List<s32*>* EnginePrototype::NodeIterator::_sm_navigation$(System::Collections::Generic::List<s32*>* _$value) { CHCKTHIS; return _sm_navigation(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::NodeIterator::_acc_gRgba(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getColorMatrixUInt(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::NodeIterator::_acc_gRgba$() { CHCKTHIS; return _acc_gRgba(); }\r\n\r\ninline u32 EnginePrototype::NodeIterator::_acc_sRgba(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setColorMatrixUInt(_gm_nodeCpp$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::NodeIterator::_acc_sRgba$(u32 value)\t\t{ CHCKTHIS; return _acc_sRgba(value); }\r\ninline float EnginePrototype::NodeIterator::_acc_gScaleX(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getNodeScaleX(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_gScaleX$() { CHCKTHIS; return _acc_gScaleX(); }\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_sScaleX(float value){\r\n    float _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setScale(_gm_nodeCpp$(),value,_ext_node_getNodeScaleY(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::NodeIterator::_acc_sScaleX$(float value)\t\t{ CHCKTHIS; return _acc_sScaleX(value); }\r\ninline float EnginePrototype::NodeIterator::_acc_gScaleY(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getNodeScaleY(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_gScaleY$() { CHCKTHIS; return _acc_gScaleY(); }\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_sScaleY(float value){\r\n    float _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setScale(_gm_nodeCpp$(),_ext_node_getNodeScaleX(_gm_nodeCpp$()),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::NodeIterator::_acc_sScaleY$(float value)\t\t{ CHCKTHIS; return _acc_sScaleY(value); }\r\ninline float EnginePrototype::NodeIterator::_acc_sScale(float value){\r\n    float _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setScale(_gm_nodeCpp$(),value,value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::NodeIterator::_acc_sScale$(float value)\t\t{ CHCKTHIS; return _acc_sScale(value); }\r\ninline float EnginePrototype::NodeIterator::_acc_gRotation(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getRotation(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_gRotation$() { CHCKTHIS; return _acc_gRotation(); }\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_sRotation(float value){\r\n    float _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setRotation(_gm_nodeCpp$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::NodeIterator::_acc_sRotation$(float value)\t\t{ CHCKTHIS; return _acc_sRotation(value); }\r\ninline float EnginePrototype::NodeIterator::_acc_gX(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getNodeTranslateX(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_gX$() { CHCKTHIS; return _acc_gX(); }\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_sX(float value){\r\n    float _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setTranslate(_gm_nodeCpp$(),value,_ext_node_getNodeTranslateY(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::NodeIterator::_acc_sX$(float value)\t\t{ CHCKTHIS; return _acc_sX(value); }\r\ninline float EnginePrototype::NodeIterator::_acc_gY(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getNodeTranslateY(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_gY$() { CHCKTHIS; return _acc_gY(); }\r\n\r\ninline float EnginePrototype::NodeIterator::_acc_sY(float value){\r\n    float _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setTranslate(_gm_nodeCpp$(),_ext_node_getNodeTranslateX(_gm_nodeCpp$()),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::NodeIterator::_acc_sY$(float value)\t\t{ CHCKTHIS; return _acc_sY(value); }\r\ninline bool EnginePrototype::NodeIterator::_acc_gVisible(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_node_getVisible(_gm_nodeCpp$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::NodeIterator::_acc_gVisible$() { CHCKTHIS; return _acc_gVisible(); }\r\n\r\ninline bool EnginePrototype::NodeIterator::_acc_sVisible(bool value){\r\n    bool _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setVisible(_gm_nodeCpp$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::NodeIterator::_acc_sVisible$(bool value)\t\t{ CHCKTHIS; return _acc_sVisible(value); }\r\ninline System::String* EnginePrototype::NodeIterator::_acc_gName(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            return System::__MarshallingUtils::StringFromNativeUtf8(_ext_node_getName(_gm_nodeCpp$()));\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::NodeIterator::_acc_gName$() { CHCKTHIS; return _acc_gName(); }\r\n\r\ninline System::String* EnginePrototype::NodeIterator::_acc_sName(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodeCpp$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_node_setName(_gm_nodeCpp$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::NodeIterator::_acc_sName$(System::String* value)\t\t{ CHCKTHIS; return _acc_sName(value); }\r\n/*virtual*/\r\nbool EnginePrototype::NodeIterator::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(NodeIterator,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::NodeIterator::_processGC() {\r\n    if (m_navigation) { System::Memory::pushList(m_navigation,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::NodeIterator::_releaseGC() {\r\n    if (m_navigation && !m_navigation->isFreed()) { m_navigation->_removeRef((System::__GCObject**)&m_navigation); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::NodeIterator::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_navigation) {\r\n      newPtr = (u8*)(&m_navigation); oldPtr = newPtr - offset;\r\n      m_navigation->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'Element'\r\n//=============================\r\n\r\nvoid EnginePrototype::Element::_ctor_Element() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Element::_ext_element_setEnabled(s32* pElem,bool isEnabled)\r\n{\r\n    element_setEnabled(pElem,isEnabled);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::Element::_ext_element_isEnabled(s32* pElem)\r\n{\r\n    return element_isEnabled(pElem);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::Element::_ext_element_setAsset(s32* pElem,u32 dest,s32* assetName)\r\n{\r\n    return element_setAsset(pElem,dest,assetName);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Element::_ext_element_setPriority(s32* pElem,u32 renderPriority)\r\n{\r\n    element_setPriority(pElem,renderPriority);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::Element::_ext_element_getPriority(s32* pElem)\r\n{\r\n    return element_getPriority(pElem);\r\n}\r\n\r\nEnginePrototype::Element::Element(u32 m_counter,s32* nodePtr)\r\n{\r\n    _ctor_Element();\r\n    this->_sm_counter$(m_counter);\r\n    this->_sm_nodePtr$(nodePtr);\r\n}\r\n\r\nEnginePrototype::Element::Element() { _ctor_Element(); }\r\n\r\n\r\n\r\ninline bool EnginePrototype::Element::_acc_gEnabled(){\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_element_isEnabled(_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::Element::_acc_gEnabled$() { CHCKTHIS; return _acc_gEnabled(); }\r\n\r\ninline bool EnginePrototype::Element::_acc_sEnabled(bool value){\r\n    bool _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_element_setEnabled(_gm_nodePtr$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::Element::_acc_sEnabled$(bool value)\t\t{ CHCKTHIS; return _acc_sEnabled(value); }\r\ninline System::String* EnginePrototype::Element::_acc_snormalAsset(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            EnginePrototype::NativeManagement::resetCppError();\r\n            if (!_ext_element_setAsset(_gm_nodePtr$(),(u32)ASSET_TYPE::NORMAL_ASSET,System::__MarshallingUtils::NativeUtf8FromString(value)))\r\n            {\r\n                EnginePrototype::NativeManagement::intercepCppError();\r\n            }\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::Element::_acc_snormalAsset$(System::String* value)\t\t{ CHCKTHIS; return _acc_snormalAsset(value); }\r\ninline System::String* EnginePrototype::Element::_acc_sdisableAsset(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            EnginePrototype::NativeManagement::resetCppError();\r\n            if (!_ext_element_setAsset(_gm_nodePtr$(),(u32)ASSET_TYPE::DISABLED_ASSET,System::__MarshallingUtils::NativeUtf8FromString(value)))\r\n            {\r\n                EnginePrototype::NativeManagement::intercepCppError();\r\n            }\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::Element::_acc_sdisableAsset$(System::String* value)\t\t{ CHCKTHIS; return _acc_sdisableAsset(value); }\r\n/*virtual*/\r\nbool EnginePrototype::Element::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Element,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::Element::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Element::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Element::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'Container'\r\n//=============================\r\n\r\nvoid EnginePrototype::Container::_ctor_Container() {\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::Container::_ext_container_getViewOffsetX(s32* pCont)\r\n{\r\n    return container_getViewOffsetX(pCont);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Container::_ext_container_setViewOffsetX(s32* pCont,s32 scrollX)\r\n{\r\n    container_setViewOffsetX(pCont,scrollX);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::Container::_ext_container_getViewOffsetY(s32* pCont)\r\n{\r\n    return container_getViewOffsetY(pCont);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Container::_ext_container_setViewOffsetY(s32* pCont,s32 scrollY)\r\n{\r\n    container_setViewOffsetY(pCont,scrollY);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::Container::_ext_container_getRadioValue(s32* pCont)\r\n{\r\n    return container_getRadioValue(pCont);\r\n}\r\n\r\nEnginePrototype::Container::Container(u32 m_counter,s32* nodePtr) : EnginePrototype::Element(m_counter,nodePtr)\r\n{\r\n    _ctor_Container();\r\n}\r\n\r\nEnginePrototype::Container::Container() { _ctor_Container(); }\r\n\r\n\r\n\r\ninline s32 EnginePrototype::Container::_acc_gViewOffsetX(){\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_container_getViewOffsetX(EnginePrototype::Element::_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::Container::_acc_gViewOffsetX$() { CHCKTHIS; return _acc_gViewOffsetX(); }\r\n\r\ninline s32 EnginePrototype::Container::_acc_sViewOffsetX(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_container_setViewOffsetX(EnginePrototype::Element::_gm_nodePtr$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::Container::_acc_sViewOffsetX$(s32 value)\t\t{ CHCKTHIS; return _acc_sViewOffsetX(value); }\r\ninline s32 EnginePrototype::Container::_acc_gViewOffsetY(){\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_container_getViewOffsetY(EnginePrototype::Element::_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::Container::_acc_gViewOffsetY$() { CHCKTHIS; return _acc_gViewOffsetY(); }\r\n\r\ninline s32 EnginePrototype::Container::_acc_sViewOffsetY(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_container_setViewOffsetY(EnginePrototype::Element::_gm_nodePtr$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::Container::_acc_sViewOffsetY$(s32 value)\t\t{ CHCKTHIS; return _acc_sViewOffsetY(value); }\r\ninline u32 EnginePrototype::Container::_acc_gRadioValue(){\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_container_getRadioValue(EnginePrototype::Element::_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::Container::_acc_gRadioValue$() { CHCKTHIS; return _acc_gRadioValue(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::Container::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Container,EnginePrototype::Element);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::Container::_processGC() {\r\n    EnginePrototype::Element::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Container::_releaseGC() {\r\n    EnginePrototype::Element::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Container::_moveAlert(u32 offset) {\r\n    EnginePrototype::Element::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'Selectable'\r\n//=============================\r\n\r\nvoid EnginePrototype::Selectable::_ctor_Selectable() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Selectable::_ext_selectable_setClick(s32* pSelect,s32 coordinateX,s32 coordinateY,s32 width,s32 height)\r\n{\r\n    selectable_setClick(pSelect,coordinateX,coordinateY,width,height);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::Selectable::_ext_selectable_setAudio(s32* pSelect,s32* assetAudio,u32 mode,float volume)\r\n{\r\n    return selectable_setAudio(pSelect,assetAudio,mode,volume);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Selectable::_ext_selectable_setStick(s32* pSelect,bool isStickable)\r\n{\r\n    selectable_setStick(pSelect,isStickable);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::Selectable::_ext_selectable_isStickable(s32* pSelect)\r\n{\r\n    return selectable_isStickable(pSelect);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Selectable::_ext_selectable_setSticked(s32* pSelect,bool isSticked)\r\n{\r\n    selectable_setSticked(pSelect,isSticked);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::Selectable::_ext_selectable_isSticked(s32* pSelect)\r\n{\r\n    return selectable_isSticked(pSelect);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::Selectable::_ext_selectable_setRadio(s32* pSelect,u32 radioID)\r\n{\r\n    selectable_setRadio(pSelect,radioID);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::Selectable::_ext_selectable_getRadioID(s32* pSelect)\r\n{\r\n    return selectable_getRadioID(pSelect);\r\n}\r\n\r\nEnginePrototype::Selectable::Selectable(u32 m_counter,s32* nodePtr) : EnginePrototype::Element(m_counter,nodePtr)\r\n{\r\n    _ctor_Selectable();\r\n}\r\n\r\nbool EnginePrototype::Selectable::setAudio(System::String* assetName,u32 mode,float volume)\r\n{\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_selectable_setAudio(EnginePrototype::Element::_gm_nodePtr$(),System::__MarshallingUtils::NativeUtf8FromString(assetName),mode,volume);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::Selectable::setAudio$(System::String* assetName,u32 mode,float volume) { CHCKTHIS; return setAudio(assetName,mode,volume); }\r\n\r\nvoid EnginePrototype::Selectable::setClickArea(s32 x,s32 y,s32 width,s32 height)\r\n{\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_selectable_setClick(EnginePrototype::Element::_gm_nodePtr$(),x,y,width,height);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::Selectable::setClickArea$(s32 x,s32 y,s32 width,s32 height) { CHCKTHIS; return setClickArea(x,y,width,height); }\r\n\r\nEnginePrototype::Selectable::Selectable() { _ctor_Selectable(); }\r\n\r\n\r\n\r\ninline System::String* EnginePrototype::Selectable::_acc_spushedAsset(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            EnginePrototype::NativeManagement::resetCppError();\r\n            if (!EnginePrototype::Element::_ext_element_setAsset(EnginePrototype::Element::_gm_nodePtr$(),(u32)EnginePrototype::Element::ASSET_TYPE::PUSHED_ASSET,System::__MarshallingUtils::NativeUtf8FromString(value)))\r\n            {\r\n                EnginePrototype::NativeManagement::intercepCppError();\r\n            }\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::Selectable::_acc_spushedAsset$(System::String* value)\t\t{ CHCKTHIS; return _acc_spushedAsset(value); }\r\ninline bool EnginePrototype::Selectable::_acc_gisDown(){\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_selectable_isSticked(EnginePrototype::Element::_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::Selectable::_acc_gisDown$() { CHCKTHIS; return _acc_gisDown(); }\r\n\r\ninline bool EnginePrototype::Selectable::_acc_sisDown(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_selectable_setStick(EnginePrototype::Element::_gm_nodePtr$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::Selectable::_acc_sisDown$(bool value)\t\t{ CHCKTHIS; return _acc_sisDown(value); }\r\ninline bool EnginePrototype::Selectable::_acc_gcheckBoxMode(){\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_selectable_isStickable(EnginePrototype::Element::_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::Selectable::_acc_gcheckBoxMode$() { CHCKTHIS; return _acc_gcheckBoxMode(); }\r\n\r\ninline bool EnginePrototype::Selectable::_acc_scheckBoxMode(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_selectable_setSticked(EnginePrototype::Element::_gm_nodePtr$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::Selectable::_acc_scheckBoxMode$(bool value)\t\t{ CHCKTHIS; return _acc_scheckBoxMode(value); }\r\ninline u32 EnginePrototype::Selectable::_acc_gRadioID(){\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            return _ext_selectable_getRadioID(EnginePrototype::Element::_gm_nodePtr$());\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::Selectable::_acc_gRadioID$() { CHCKTHIS; return _acc_gRadioID(); }\r\n\r\ninline u32 EnginePrototype::Selectable::_acc_sRadioID(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::Element::_gm_counter$() == EnginePrototype::NativeManagement::getContextCounter())\r\n    {\r\n        if (EnginePrototype::Element::_gm_nodePtr$() != System::IntPtr::Zero)\r\n        {\r\n            _ext_selectable_setRadio(EnginePrototype::Element::_gm_nodePtr$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionTooOld(_$_cteStr4Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::Selectable::_acc_sRadioID$(u32 value)\t\t{ CHCKTHIS; return _acc_sRadioID(value); }\r\n/*virtual*/\r\nbool EnginePrototype::Selectable::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Selectable,EnginePrototype::Element);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::Selectable::_processGC() {\r\n    EnginePrototype::Element::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Selectable::_releaseGC() {\r\n    EnginePrototype::Element::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Selectable::_moveAlert(u32 offset) {\r\n    EnginePrototype::Element::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'AnimationNode'\r\n//=============================\r\n\r\nvoid EnginePrototype::AnimationNode::_ctor_AnimationNode() {\r\n}\r\n\r\nEnginePrototype::AnimationNode::AnimationNode(u32 m_counter,s32* nodePtr)\r\n{\r\n    _ctor_AnimationNode();\r\n    this->_sm_counter$(m_counter);\r\n    this->_snodePtr$(nodePtr);\r\n}\r\n\r\nvoid EnginePrototype::AnimationNode::setAnimation(EnginePrototype::AnimationInfo* animationInfo)\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNotImplemented(_$_cteStr1Obj));\r\n}\r\n\r\ninline void EnginePrototype::AnimationNode::setAnimation$(EnginePrototype::AnimationInfo* animationInfo) { CHCKTHIS; return setAnimation(animationInfo); }\r\n\r\nEnginePrototype::AnimationNode::AnimationNode() { _ctor_AnimationNode(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::AnimationNode::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(AnimationNode,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::AnimationNode::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::AnimationNode::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::AnimationNode::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'Size'\r\n//=============================\r\n\r\nvoid EnginePrototype::Size::_ctor_Size() {\r\n}\r\n\r\nEnginePrototype::Size::Size() { _ctor_Size(); }\r\n\r\n\r\ninline u32 EnginePrototype::Size::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\ninline void EnginePrototype::Size::_releaseGC() {\r\n}\r\ninline void* EnginePrototype::Size::_RefSetValue(void* newStruct) {\r\n    Size* pStruct = (Size*)newStruct;\r\n    this->width = pStruct->width;\r\n    this->height = pStruct->height;\r\n    return newStruct;\r\n}\r\ninline void EnginePrototype::Size::_moveAlert(u32 offset) {\r\n}\r\ninline EnginePrototype::Size& EnginePrototype::Size::__registerByRef(EnginePrototype::Size& m) {\r\n    return m;\r\n}\r\n\r\n\r\n//=============================\r\n// Implementation of 'USize'\r\n//=============================\r\n\r\nvoid EnginePrototype::USize::_ctor_USize() {\r\n}\r\n\r\nEnginePrototype::USize::USize() { _ctor_USize(); }\r\n\r\n\r\ninline u32 EnginePrototype::USize::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\ninline void EnginePrototype::USize::_releaseGC() {\r\n}\r\ninline void* EnginePrototype::USize::_RefSetValue(void* newStruct) {\r\n    USize* pStruct = (USize*)newStruct;\r\n    this->width = pStruct->width;\r\n    this->height = pStruct->height;\r\n    return newStruct;\r\n}\r\ninline void EnginePrototype::USize::_moveAlert(u32 offset) {\r\n}\r\ninline EnginePrototype::USize& EnginePrototype::USize::__registerByRef(EnginePrototype::USize& m) {\r\n    return m;\r\n}\r\n\r\n\r\n//=============================\r\n// Implementation of 'FSize'\r\n//=============================\r\n\r\nvoid EnginePrototype::FSize::_ctor_FSize() {\r\n}\r\n\r\nEnginePrototype::FSize::FSize() { _ctor_FSize(); }\r\n\r\n\r\ninline u32 EnginePrototype::FSize::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\ninline void EnginePrototype::FSize::_releaseGC() {\r\n}\r\ninline void* EnginePrototype::FSize::_RefSetValue(void* newStruct) {\r\n    FSize* pStruct = (FSize*)newStruct;\r\n    this->width = pStruct->width;\r\n    this->height = pStruct->height;\r\n    return newStruct;\r\n}\r\ninline void EnginePrototype::FSize::_moveAlert(u32 offset) {\r\n}\r\ninline EnginePrototype::FSize& EnginePrototype::FSize::__registerByRef(EnginePrototype::FSize& m) {\r\n    return m;\r\n}\r\n\r\n\r\n//=============================\r\n// Implementation of 'IClientRequest'\r\n//=============================\r\n\r\nvoid EnginePrototype::IClientRequest::_ctor_IClientRequest() {\r\n}\r\n\r\nEnginePrototype::IClientRequest::IClientRequest() { _ctor_IClientRequest(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::IClientRequest::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(IClientRequest,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::IClientRequest::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::IClientRequest::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::IClientRequest::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of '__FrameworkUtils'\r\n//=============================\r\n\r\nvoid EnginePrototype::__FrameworkUtils::_ctor___FrameworkUtils() {\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::__FrameworkUtils::_ext_Cpp_getClassIDByName(s32* name)\r\n{\r\n    return Cpp_getClassIDByName(name);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::__FrameworkUtils::GetClassIDByName(System::String* className)\r\n{\r\n    System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr25Obj)->_appendStr(className)->_appendStr(_$_cteStr26Obj)->_appendU(_ext_Cpp_getClassIDByName(System::__MarshallingUtils::NativeUtf8FromString(className)))->_appendClose());\r\n    return _ext_Cpp_getClassIDByName(System::__MarshallingUtils::NativeUtf8FromString(className));\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::__FrameworkUtils::RegisterClass(System::String* className)\r\n{\r\n    return GetClassIDByName(className);\r\n}\r\n\r\nEnginePrototype::__FrameworkUtils::__FrameworkUtils() { _ctor___FrameworkUtils(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::__FrameworkUtils::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(__FrameworkUtils,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::__FrameworkUtils::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::__FrameworkUtils::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::__FrameworkUtils::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'WrapperReg'\r\n//=============================\r\n\r\nvoid EnginePrototype::WrapperReg::_ctor_WrapperReg() {\r\n}\r\n\r\nEnginePrototype::WrapperReg::WrapperReg()\r\n{\r\n    _ctor_WrapperReg();\r\n    System::Console::WriteLine(_$_cteStr27Obj);\r\n    _sm_listSize$(10);\r\n    _sm_list$(CS_NEW System::Array< EnginePrototype::GameObject* >(_gm_listSize$()));\r\n    _sm_freeHandlesList$(CS_NEW System::Collections::Generic::List<u32>());\r\n    _sm_objectCounter$(0);\r\n    System::Console::WriteLine(_$_cteStr28Obj);\r\n}\r\n\r\n/*static*/\r\nEnginePrototype::WrapperReg* EnginePrototype::WrapperReg::getInstance()\r\n{\r\n    return reg;\r\n}\r\n\r\nu32 EnginePrototype::WrapperReg::registerGameObject(EnginePrototype::GameObject* pObj)\r\n{\r\n    System::Console::WriteLine(_$_cteStr29Obj);\r\n    if (pObj->_acc_gHandle$() == EnginePrototype::GameObject::NULLHANDLER)\r\n    {\r\n        System::Console::WriteLine(_$_cteStr30Obj);\r\n        if (_gm_freeHandlesList$()->_acc_gCount$() == 0)\r\n        {\r\n            _gm_list$()->_idx_s$(_gm_objectCounter$(),pObj);\r\n            pObj->_acc_sHandle$(_gm_objectCounter$());\r\n            if (++m_objectCounter == _gm_listSize$())\r\n            {\r\n                System::Console::WriteLine(_$_cteStr31Obj);\r\n                System::AbstractArray::Resize((System::Array<EnginePrototype::GameObject*>*&)System::__GCObject::__registerByRef((System::__GCObject*&)_gm_list$()),m_listSize += 10);\r\n            }\r\n            System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr32Obj)->_appendI((_gm_objectCounter$() - 1))->_appendClose());\r\n            return _gm_objectCounter$() - 1;\r\n        }\r\n        else\r\n        {\r\n            u32 idx = _gm_freeHandlesList$()->_idx_g$(0);\r\n            _gm_freeHandlesList$()->RemoveAt$(0);\r\n            _gm_list$()->_idx_s$(idx,pObj);\r\n            pObj->_acc_sHandle$(idx);\r\n            System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr33Obj)->_appendU(idx)->_appendClose());\r\n            return idx;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr34Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::WrapperReg::registerGameObject$(EnginePrototype::GameObject* pObj) { CHCKTHIS; return registerGameObject(pObj); }\r\n\r\nvoid EnginePrototype::WrapperReg::unregisterGameObject(EnginePrototype::GameObject* pObj)\r\n{\r\n    System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr35Obj)->_appendStr(pObj->ToString())->_appendStr(_$_cteStr36Obj)->_appendClose());\r\n    if (pObj->_acc_gHandle$() != EnginePrototype::GameObject::NULLHANDLER)\r\n    {\r\n        _gm_freeHandlesList$()->Add$(pObj->_acc_gHandle$());\r\n        _gm_list$()->_idx_s$(pObj->_acc_gHandle$(),NULL);\r\n        pObj->_acc_sHandle$(EnginePrototype::GameObject::NULLHANDLER);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr37Obj));\r\n    }\r\n    System::Console::WriteLine(_$_cteStr38Obj);\r\n}\r\n\r\ninline void EnginePrototype::WrapperReg::unregisterGameObject$(EnginePrototype::GameObject* pObj) { CHCKTHIS; return unregisterGameObject(pObj); }\r\n\r\nEnginePrototype::GameObject* EnginePrototype::WrapperReg::getObjectFromHandle(u32 handle)\r\n{\r\n    if (handle < _gm_listSize$())\r\n    {\r\n        return _gm_list$()->_idx_g$(handle);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr39Obj));\r\n    }\r\n}\r\n\r\ninline EnginePrototype::GameObject* EnginePrototype::WrapperReg::getObjectFromHandle$(u32 handle) { CHCKTHIS; return getObjectFromHandle(handle); }\r\n\r\nvoid EnginePrototype::WrapperReg::display()\r\n{\r\n    System::Console::WriteLine();\r\n    System::Console::WriteLine(_$_cteStr40Obj);\r\n    System::Console::WriteLine(_$_cteStr41Obj);\r\n    System::Console::WriteLine(_$_cteStr40Obj);\r\n    for (s32 i = 0;_gm_list$()->_idx_g$(i) != NULL && i < _gm_listSize$();++i)\r\n    System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr42Obj)->_appendI(i)->_appendStr(_$_cteStr43Obj)->_appendStr(_gm_list$()->_idx_g$(i)->ToString())->_appendClose());\r\n}\r\n\r\ninline void EnginePrototype::WrapperReg::display$() { CHCKTHIS; return display(); }\r\n\r\ninline System::Array<EnginePrototype::GameObject*>* EnginePrototype::WrapperReg::_sm_list(System::Array<EnginePrototype::GameObject*>* _$value)  { return (System::Array<EnginePrototype::GameObject*>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_list,_$value); }\r\ninline System::Array<EnginePrototype::GameObject*>* EnginePrototype::WrapperReg::_sm_list$(System::Array<EnginePrototype::GameObject*>* _$value) { CHCKTHIS; return _sm_list(_$value); }\r\ninline System::Collections::Generic::List<u32>* EnginePrototype::WrapperReg::_sm_freeHandlesList(System::Collections::Generic::List<u32>* _$value)  { return (System::Collections::Generic::List<u32>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_freeHandlesList,_$value); }\r\ninline System::Collections::Generic::List<u32>* EnginePrototype::WrapperReg::_sm_freeHandlesList$(System::Collections::Generic::List<u32>* _$value) { CHCKTHIS; return _sm_freeHandlesList(_$value); }\r\ninline EnginePrototype::WrapperReg* EnginePrototype::WrapperReg::_sreg(EnginePrototype::WrapperReg* _$value)\t\t{ return (EnginePrototype::WrapperReg*)System::__GCObject::_RefSetValue((System::__GCObject**)&reg,_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::WrapperReg::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(WrapperReg,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::WrapperReg::_processGC() {\r\n    if (m_list) { System::Memory::pushList(m_list,0); }\r\n    if (m_freeHandlesList) { System::Memory::pushList(m_freeHandlesList,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::WrapperReg::_releaseGC() {\r\n    if (m_list && !m_list->isFreed()) { m_list->_removeRef((System::__GCObject**)&m_list); }\r\n    if (m_freeHandlesList && !m_freeHandlesList->isFreed()) { m_freeHandlesList->_removeRef((System::__GCObject**)&m_freeHandlesList); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::WrapperReg::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_list) {\r\n      newPtr = (u8*)(&m_list); oldPtr = newPtr - offset;\r\n      m_list->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_freeHandlesList) {\r\n      newPtr = (u8*)(&m_freeHandlesList); oldPtr = newPtr - offset;\r\n      m_freeHandlesList->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSAPP'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSAPP::_ctor_CSAPP() {\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSAPP::_ext_CKLBLuaLibAPP_callApplication(s32 type,s32* addr,s32* subject,s32* body)\r\n{\r\n    return CKLBLuaLibAPP_callApplication(type,addr,subject,body);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSAPP::callApplication(s32 type,System::String* addr,System::String* subject,System::String* body)\r\n{\r\n    return _ext_CKLBLuaLibAPP_callApplication(type,System::__MarshallingUtils::NativeUtf8FromString(addr),System::__MarshallingUtils::NativeUtf8FromString(subject),System::__MarshallingUtils::NativeUtf8FromString(body));\r\n}\r\n\r\nEnginePrototype::CSAPP::CSAPP() { _ctor_CSAPP(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSAPP::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSAPP,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSAPP::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSAPP::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSAPP::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSAsset'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSAsset::_ctor_CSAsset() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::_ext_CKLBLuaLibASSET_getImageSize(s32* assetName,s32& returnWidth,s32& returnHeight)\r\n{\r\n    CKLBLuaLibASSET_getImageSize(assetName,&returnWidth,&returnHeight);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::_ext_CKLBLuaLibASSET_getBoundSize(s32* assetName,float& returnWidth,float& returnHeight)\r\n{\r\n    CKLBLuaLibASSET_getBoundSize(assetName,&returnWidth,&returnHeight);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::_ext_CKLBLuaLibASSET_getAssetInfo(s32* assetName,s32& returnImgWidth,s32& returnImgHeight,float& returnBoundWidth,float& returnBoundHeight)\r\n{\r\n    CKLBLuaLibASSET_getAssetInfo(assetName,&returnImgWidth,&returnImgHeight,&returnBoundWidth,&returnBoundHeight);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::getImageSize(System::String* assetPath,s32& width,s32& height)\r\n{\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    _ext_CKLBLuaLibASSET_getImageSize(System::__MarshallingUtils::NativeUtf8FromString(assetPath),width,height);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::getImageSize(System::String* assetPath,EnginePrototype::Size& size)\r\n{\r\n    s32 width = 0;\r\n    s32 height = 0;\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    _ext_CKLBLuaLibASSET_getImageSize(System::__MarshallingUtils::NativeUtf8FromString(assetPath),width,height);\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    size._swidth$(width);\r\n    size._sheight$(height);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::getBoundSize(System::String* assetPath,float& width,float& height)\r\n{\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    _ext_CKLBLuaLibASSET_getBoundSize(System::__MarshallingUtils::NativeUtf8FromString(assetPath),width,height);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::getBoundSize(System::String* assetPath,EnginePrototype::FSize& size)\r\n{\r\n    float width = 0;\r\n    float height = 0;\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    _ext_CKLBLuaLibASSET_getBoundSize(System::__MarshallingUtils::NativeUtf8FromString(assetPath),width,height);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    size._swidth$(width);\r\n    size._sheight$(height);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::getAssetInfo(System::String* assetPath,s32& imgWidth,s32& imgHeight,float& boundWidth,float& boundHeight)\r\n{\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    _ext_CKLBLuaLibASSET_getAssetInfo(System::__MarshallingUtils::NativeUtf8FromString(assetPath),imgWidth,imgHeight,boundWidth,boundHeight);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSAsset::getAssetInfo(System::String* assetPath,EnginePrototype::Size& imgSize,EnginePrototype::FSize& boundSize)\r\n{\r\n    s32 imgWidth = 0;\r\n    s32 imgHeight = 0;\r\n    float boundWidth = 0;\r\n    float boundHeight = 0;\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    _ext_CKLBLuaLibASSET_getAssetInfo(System::__MarshallingUtils::NativeUtf8FromString(assetPath),imgWidth,imgHeight,boundWidth,boundHeight);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    imgSize._swidth$(imgWidth);\r\n    imgSize._sheight$(imgHeight);\r\n    boundSize._swidth$(boundWidth);\r\n    boundSize._sheight$(boundHeight);\r\n}\r\n\r\nEnginePrototype::CSAsset::CSAsset() { _ctor_CSAsset(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSAsset::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSAsset,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSAsset::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSAsset::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSAsset::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSBin'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSBin::_ctor_CSBin() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSBin::_ext_CKLBLuaLibBIN_open(s32* bin_asset)\r\n{\r\n    return CKLBLuaLibBIN_open(bin_asset);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSBin::_ext_CKLBLuaLibBIN_close(s32* pBIN)\r\n{\r\n    CKLBLuaLibBIN_close(pBIN);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSBin::_ext_CKLBLuaLibBIN_peek(s32* pBIN,s32 offset,s32& value)\r\n{\r\n    return CKLBLuaLibBIN_peek(pBIN,offset,&value);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSBin::_ext_CKLBLuaLibBIN_peek_u16(s32* pBIN,s32 offset,u32& value,bool f_bigendian)\r\n{\r\n    return CKLBLuaLibBIN_peek_u16(pBIN,offset,&value,f_bigendian);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSBin::_ext_CKLBLuaLibBIN_peek_u32(s32* pBIN,s32 offset,u32& value,bool f_bigendian)\r\n{\r\n    return CKLBLuaLibBIN_peek_u32(pBIN,offset,&value,f_bigendian);\r\n}\r\n\r\nEnginePrototype::CSBin::CSBin(System::String* bin_asset) : EnginePrototype::GameObject(s_classID)\r\n{\r\n    _ctor_CSBin();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBLuaLibBIN_open(System::__MarshallingUtils::NativeUtf8FromString(bin_asset));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CSBin::clearInternals()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibBIN_close(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSBin::clearInternals$() { CHCKTHIS; return clearInternals(); }\r\n\r\nbool EnginePrototype::CSBin::peek(s32 offset,s32& value)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibBIN_peek(EnginePrototype::GameObject::_acc_gCppObject$(),offset,value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CSBin::peek$(s32 offset,s32& value) { CHCKTHIS; return peek(offset,value); }\r\n\r\nbool EnginePrototype::CSBin::peek_u16(s32 offset,u32& value,bool f_bigendian)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibBIN_peek_u16(EnginePrototype::GameObject::_acc_gCppObject$(),offset,value,f_bigendian);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CSBin::peek_u16$(s32 offset,u32& value,bool f_bigendian) { CHCKTHIS; return peek_u16(offset,value,f_bigendian); }\r\n\r\nbool EnginePrototype::CSBin::peek_u32(s32 offset,u32& value,bool f_bigendian)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibBIN_peek_u32(EnginePrototype::GameObject::_acc_gCppObject$(),offset,value,f_bigendian);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CSBin::peek_u32$(s32 offset,u32& value,bool f_bigendian) { CHCKTHIS; return peek_u32(offset,value,f_bigendian); }\r\n\r\nEnginePrototype::CSBin::CSBin() { _ctor_CSBin(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSBin::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSBin,EnginePrototype::GameObject);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSBin::_processGC() {\r\n    EnginePrototype::GameObject::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSBin::_releaseGC() {\r\n    EnginePrototype::GameObject::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSBin::_moveAlert(u32 offset) {\r\n    EnginePrototype::GameObject::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSData'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSData::_ctor_CSData() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSData::_ext_CKLBLuaLibDATA_cmdCreateData(u32 dataSetID)\r\n{\r\n    return CKLBLuaLibDATA_cmdCreateData(dataSetID);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSData::_ext_CKLBLuaLibDATA_cmdRegistData(s32* pDataSet,s32* nameAsset,u32& pReturnHandle)\r\n{\r\n    return CKLBLuaLibDATA_cmdRegistData(pDataSet,nameAsset,&pReturnHandle);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSData::_ext_CKLBLuaLibDATA_cmdDelete(s32* pDataSet)\r\n{\r\n    CKLBLuaLibDATA_cmdDelete(pDataSet);\r\n}\r\n\r\nEnginePrototype::CSData::CSData(u32 ID) : EnginePrototype::GameObject(s_classID)\r\n{\r\n    _ctor_CSData();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBLuaLibDATA_cmdCreateData(ID);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nbool EnginePrototype::CSData::registerData(System::String* nameAsset,u32& pReturnHandle)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibDATA_cmdRegistData(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(nameAsset),pReturnHandle);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CSData::registerData$(System::String* nameAsset,u32& pReturnHandle) { CHCKTHIS; return registerData(nameAsset,pReturnHandle); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CSData::clearInternals()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibDATA_cmdDelete(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSData::clearInternals$() { CHCKTHIS; return clearInternals(); }\r\n\r\nEnginePrototype::CSData::CSData() { _ctor_CSData(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSData::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSData,EnginePrototype::GameObject);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSData::_processGC() {\r\n    EnginePrototype::GameObject::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSData::_releaseGC() {\r\n    EnginePrototype::GameObject::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSData::_moveAlert(u32 offset) {\r\n    EnginePrototype::GameObject::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSDB'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSDB::_ctor_CSDB() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSDB::_ext_CKLBLuaLibDB_dbopen(s32* db_asset,bool b_write,bool b_create)\r\n{\r\n    return CKLBLuaLibDB_dbopen(db_asset,b_write,b_create);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDB::_ext_CKLBLuaLibDB_dbclose(s32* pDB)\r\n{\r\n    CKLBLuaLibDB_dbclose(pDB);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDB::_ext_CKLBLuaLibDB_closeAll()\r\n{\r\n    CKLBLuaLibDB_closeAll();\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSDB::_ext_CKLBLuaLibDB_query(s32* pDB,s32* sqlQuery,s32& nbEntries)\r\n{\r\n    return CKLBLuaLibDB_query(pDB,sqlQuery,&nbEntries);\r\n}\r\n\r\nEnginePrototype::CSDB::CSDB(System::String* db_asset,bool b_write,bool b_create) : EnginePrototype::GameObject(s_classID)\r\n{\r\n    _ctor_CSDB();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBLuaLibDB_dbopen(System::__MarshallingUtils::NativeUtf8FromString(db_asset),b_write,b_create);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_isWritable$(b_write);\r\n    _sm_isCreatable$(b_create);\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CSDB::clearInternals()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibDB_dbclose(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSDB::clearInternals$() { CHCKTHIS; return clearInternals(); }\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDB::closeAll()\r\n{\r\n    _ext_CKLBLuaLibDB_closeAll();\r\n}\r\n\r\nvoid EnginePrototype::CSDB::_ref_query(System::String* sqlQuery,System::Array<System::String*>*& results)\r\n{\r\n    s32 nbEntries = 0;\r\n    s32* p = _ext_CKLBLuaLibDB_query(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(sqlQuery),nbEntries);\r\n    results = System::__MarshallingUtils::StringArrayFromNativeUtf8IntPtr(p,nbEntries * 2);\r\n}\r\n\r\ninline void EnginePrototype::CSDB::query$(System::String* sqlQuery,System::Array<System::String*>*& results) { CHCKTHIS; return query(sqlQuery,results); }\r\n\r\ninline void EnginePrototype::CSDB::query(System::String* sqlQuery,System::Array<System::String*>*& results) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); _ref_query(sqlQuery,results); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); }\r\n\r\nEnginePrototype::CSDB::CSDB() { _ctor_CSDB(); }\r\n\r\n\r\n\r\ninline bool EnginePrototype::CSDB::_acc_gIsWritable(){\r\n    return _gm_isWritable$();\r\n}\r\n\r\ninline bool EnginePrototype::CSDB::_acc_gIsWritable$() { CHCKTHIS; return _acc_gIsWritable(); }\r\n\r\ninline bool EnginePrototype::CSDB::_acc_gIsCreatable(){\r\n    return _gm_isCreatable$();\r\n}\r\n\r\ninline bool EnginePrototype::CSDB::_acc_gIsCreatable$() { CHCKTHIS; return _acc_gIsCreatable(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSDB::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSDB,EnginePrototype::GameObject);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSDB::_processGC() {\r\n    EnginePrototype::GameObject::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSDB::_releaseGC() {\r\n    EnginePrototype::GameObject::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSDB::_moveAlert(u32 offset) {\r\n    EnginePrototype::GameObject::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSDebug'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSDebug::_ctor_CSDebug() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::_ext_CKLBLuaLibDEBUG_startMenu(u32 maxCount,s32* caption,s32* key)\r\n{\r\n    CKLBLuaLibDEBUG_startMenu(maxCount,caption,key);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::_ext_CKLBLuaLibDEBUG_addItem(u32 mode,s32* caption,s32* key,s32 min,s32 max,s32 value,System::Array<s32*>* items,u32 itemsCount)\r\n{\r\n    CKLBLuaLibDEBUG_addItem(mode,caption,key,min,max,value,items ? (s32**)items->_getPArray() : NULL,itemsCount);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::_ext_CKLBLuaLibDEBUG_endMenu()\r\n{\r\n    CKLBLuaLibDEBUG_endMenu();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::_ext_CKLBLuaLibDEBUG_removeMenu(s32* key)\r\n{\r\n    CKLBLuaLibDEBUG_removeMenu(key);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::setCallback()\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNotImplemented(_$_cteStr1Obj));\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::startMenu(u32 maxCount,System::String* caption,System::String* key)\r\n{\r\n    if (s_isBuildingMenu)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr47Obj));\r\n    }\r\n    s_isBuildingMenu = true;\r\n    _ext_CKLBLuaLibDEBUG_startMenu(maxCount,System::__MarshallingUtils::NativeUtf8FromString(caption),System::__MarshallingUtils::NativeUtf8FromString(key));\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::addItemSwitch(System::String* itemName,System::String* itemKey,bool defaultValue)\r\n{\r\n    if (!s_isBuildingMenu)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr48Obj));\r\n    }\r\n    _ext_CKLBLuaLibDEBUG_addItem((u32)ESECTION_TYPE::M_SWITCH,System::__MarshallingUtils::NativeUtf8FromString(itemName),System::__MarshallingUtils::NativeUtf8FromString(itemKey),0,0,((defaultValue) ? 1 : 0),(System::Array<s32*>*)NULL,0);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::addItemSelect(System::String* itemName,System::String* itemKey,System::String* defaultValue,System::Array<System::String*>* items)\r\n{\r\n    if (!s_isBuildingMenu)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr48Obj));\r\n    }\r\n    _ext_CKLBLuaLibDEBUG_addItem((u32)ESECTION_TYPE::M_SELECT,System::__MarshallingUtils::NativeUtf8FromString(itemName),System::__MarshallingUtils::NativeUtf8FromString(itemKey),0,0,System::AbstractArray::IndexOf(items,defaultValue),System::__MarshallingUtils::NativeUtf8ArrayFromStringArray(items,items->_acc_gLength$()),(u32)items->_acc_gLength$());\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::addItemNumber(System::String* itemName,System::String* itemKey,s32 lowerLimit,s32 upperLimit,s32 defaultValue)\r\n{\r\n    if (!s_isBuildingMenu)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr48Obj));\r\n    }\r\n    _ext_CKLBLuaLibDEBUG_addItem((u32)ESECTION_TYPE::M_NUMBER,System::__MarshallingUtils::NativeUtf8FromString(itemName),System::__MarshallingUtils::NativeUtf8FromString(itemKey),lowerLimit,upperLimit,defaultValue,(System::Array<s32*>*)NULL,0);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::endMenu()\r\n{\r\n    if (!s_isBuildingMenu)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr48Obj));\r\n    }\r\n    _ext_CKLBLuaLibDEBUG_endMenu();\r\n    s_isBuildingMenu = false;\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSDebug::removeMenu(System::String* key)\r\n{\r\n    _ext_CKLBLuaLibDEBUG_removeMenu(System::__MarshallingUtils::NativeUtf8FromString(key));\r\n}\r\n\r\nEnginePrototype::CSDebug::CSDebug() { _ctor_CSDebug(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSDebug::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSDebug,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSDebug::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSDebug::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSDebug::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSEng'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSEng::_ctor_CSEng() {\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSEng::_ext_CKLBLuaLibENG_isRelease()\r\n{\r\n    return CKLBLuaLibENG_isRelease();\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSEng::_ext_CKLBLuaLibENG_getPlatform()\r\n{\r\n    return CKLBLuaLibENG_getPlatform();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSEng::_ext_CKLBLuaLibENG_getNanoTime(s32& milli,s32& nano)\r\n{\r\n    CKLBLuaLibENG_getNanoTime(&milli,&nano);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSEng::_ext_CKLBLuaLibENG_startNanoTime(s32 idx)\r\n{\r\n    CKLBLuaLibENG_startNanoTime(idx);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSEng::_ext_CKLBLuaLibENG_endNanoTime(s32 idx,s32& milli,s32& nano)\r\n{\r\n    CKLBLuaLibENG_endNanoTime(idx,&milli,&nano);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CSEng::_ext_CKLBLuaLibENG_getFrameID()\r\n{\r\n    return CKLBLuaLibENG_getFrameID();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSEng::getNanoTime(s32& milli,s32& nano)\r\n{\r\n    _ext_CKLBLuaLibENG_getNanoTime(milli,nano);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSEng::startNanoTime(s32 idx)\r\n{\r\n    _ext_CKLBLuaLibENG_startNanoTime(idx);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSEng::endNanoTime(s32 idx,s32& milli,s32& nano)\r\n{\r\n    _ext_CKLBLuaLibENG_endNanoTime(idx,milli,nano);\r\n}\r\n\r\nEnginePrototype::CSEng::CSEng() { _ctor_CSEng(); }\r\n\r\n\r\n\r\ninline bool EnginePrototype::CSEng::_acc_gIsRelease(){\r\n    return _ext_CKLBLuaLibENG_isRelease();\r\n}\r\n\r\ninline System::String* EnginePrototype::CSEng::_acc_gPlatform(){\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBLuaLibENG_getPlatform());\r\n}\r\n\r\ninline u32 EnginePrototype::CSEng::_acc_gFrameId(){\r\n    return _ext_CKLBLuaLibENG_getFrameID();\r\n}\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSEng::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSEng,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSEng::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSEng::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSEng::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSFont'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSFont::_ctor_CSFont() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSFont::_ext_CKLBLuaLibFONT_createFont(s32 size,s32* fontName)\r\n{\r\n    return CKLBLuaLibFONT_createFont(size,fontName);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSFont::_ext_CKLBLuaLibFONT_removeFont(s32* font)\r\n{\r\n    CKLBLuaLibFONT_removeFont(font);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSFont::_ext_CKLBLuaLibFONT_cmdGetTextInfo(s32* str,s32* font,EnginePrototype::STextInfo_inner0& outInfo)\r\n{\r\n    CKLBLuaLibFONT_cmdGetTextInfo(str,font,(s32*)&outInfo + 1);\r\n}\r\n\r\nEnginePrototype::CSFont::CSFont(u32 size,System::String* name) : EnginePrototype::GameObject(s_classID)\r\n{\r\n    _ctor_CSFont();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBLuaLibFONT_createFont((s32)size,System::__MarshallingUtils::NativeUtf8FromString(name));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_size$(size);\r\n    _sm_name$(name);\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CSFont::clearInternals()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibFONT_removeFont(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSFont::clearInternals$() { CHCKTHIS; return clearInternals(); }\r\n\r\nvoid EnginePrototype::CSFont::getTextInfo(System::String* text,EnginePrototype::STextInfo_inner0& info)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibFONT_cmdGetTextInfo(System::__MarshallingUtils::NativeUtf8FromString(text),EnginePrototype::GameObject::_acc_gCppObject$(),info);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSFont::getTextInfo$(System::String* text,EnginePrototype::STextInfo_inner0& info) { CHCKTHIS; return getTextInfo(text,info); }\r\n\r\nEnginePrototype::CSFont::CSFont() { _ctor_CSFont(); }\r\n\r\ninline System::String* EnginePrototype::CSFont::_sm_name(System::String* _$value)  { return (System::String*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_name,_$value); }\r\ninline System::String* EnginePrototype::CSFont::_sm_name$(System::String* _$value) { CHCKTHIS; return _sm_name(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CSFont::_acc_gSize(){\r\n    return _gm_size$();\r\n}\r\n\r\ninline u32 EnginePrototype::CSFont::_acc_gSize$() { CHCKTHIS; return _acc_gSize(); }\r\n\r\ninline u32 EnginePrototype::CSFont::_acc_sSize(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_size$(value);\r\n        _ext_CKLBLuaLibFONT_removeFont(EnginePrototype::GameObject::_acc_gCppObject$());\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        s32* ptr = _ext_CKLBLuaLibFONT_createFont((s32)value,System::__MarshallingUtils::NativeUtf8FromString(_gm_name$()));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        EnginePrototype::WrapperReg::getInstance()->registerGameObject$(this);\r\n        EnginePrototype::GameObject::bind$(ptr);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CSFont::_acc_sSize$(u32 value)\t\t{ CHCKTHIS; return _acc_sSize(value); }\r\ninline System::String* EnginePrototype::CSFont::_acc_gName(){\r\n    return _gm_name$();\r\n}\r\n\r\ninline System::String* EnginePrototype::CSFont::_acc_gName$() { CHCKTHIS; return _acc_gName(); }\r\n\r\ninline System::String* EnginePrototype::CSFont::_acc_sName(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_name$(value);\r\n        _ext_CKLBLuaLibFONT_removeFont(EnginePrototype::GameObject::_acc_gCppObject$());\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        s32* ptr = _ext_CKLBLuaLibFONT_createFont((s32)_gm_size$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        EnginePrototype::WrapperReg::getInstance()->registerGameObject$(this);\r\n        EnginePrototype::GameObject::bind$(ptr);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CSFont::_acc_sName$(System::String* value)\t\t{ CHCKTHIS; return _acc_sName(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CSFont::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSFont,EnginePrototype::GameObject);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSFont::_processGC() {\r\n    EnginePrototype::GameObject::_processGC();\r\n\r\n    if (m_name) { System::Memory::pushList(m_name,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSFont::_releaseGC() {\r\n    EnginePrototype::GameObject::_releaseGC();\r\n\r\n    if (m_name && !m_name->isFreed()) { m_name->_removeRef((System::__GCObject**)&m_name); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSFont::_moveAlert(u32 offset) {\r\n    EnginePrototype::GameObject::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_name) {\r\n      newPtr = (u8*)(&m_name); oldPtr = newPtr - offset;\r\n      m_name->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'STextInfo_inner0'\r\n//=============================\r\n\r\nvoid EnginePrototype::STextInfo_inner0::_ctor_STextInfo_inner0() {\r\n}\r\n\r\nEnginePrototype::STextInfo_inner0::STextInfo_inner0() { _ctor_STextInfo_inner0(); }\r\n\r\n\r\ninline u32 EnginePrototype::STextInfo_inner0::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\ninline void EnginePrototype::STextInfo_inner0::_releaseGC() {\r\n}\r\ninline void* EnginePrototype::STextInfo_inner0::_RefSetValue(void* newStruct) {\r\n    STextInfo_inner0* pStruct = (STextInfo_inner0*)newStruct;\r\n    this->width = pStruct->width;\r\n    this->height = pStruct->height;\r\n    this->ascent = pStruct->ascent;\r\n    this->descent = pStruct->descent;\r\n    this->top = pStruct->top;\r\n    this->bottom = pStruct->bottom;\r\n    return newStruct;\r\n}\r\ninline void EnginePrototype::STextInfo_inner0::_moveAlert(u32 offset) {\r\n}\r\ninline EnginePrototype::STextInfo_inner0& EnginePrototype::STextInfo_inner0::__registerByRef(EnginePrototype::STextInfo_inner0& m) {\r\n    return m;\r\n}\r\n\r\n\r\n//=============================\r\n// Implementation of 'CSGL'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSGL::_ctor_CSGL() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::_ext_CKLBLuaLibGL_GLClearColor(float r,float g,float b,float a)\r\n{\r\n    CKLBLuaLibGL_GLClearColor(r,g,b,a);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::_ext_CKLBLuaLibGL_GLSetResolution(s32 width,s32 height)\r\n{\r\n    CKLBLuaLibGL_GLSetResolution(width,height);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSGL::_ext_CKLBLuaLibGL_GLCreateScreenAsset(s32* name)\r\n{\r\n    return CKLBLuaLibGL_GLCreateScreenAsset(name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSGL::_ext_CKLBLuaLibGL_GLDoScreenShot(s32* name)\r\n{\r\n    return CKLBLuaLibGL_GLDoScreenShot(name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::_ext_CKLBLuaLibGL_GLFreeScreenAsset(s32* name)\r\n{\r\n    CKLBLuaLibGL_GLFreeScreenAsset(name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::_ext_CKLBLuaLibGL_SGGetGuardBand(float& leftBorder,float& rightBorder,float& topBorder,float& bottomBorder)\r\n{\r\n    CKLBLuaLibGL_SGGetGuardBand(&leftBorder,&rightBorder,&topBorder,&bottomBorder);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::_ext_CKLBLuaLibGL_SGSetGuardBand(float leftBorder,float rightBorder,float topBorder,float bottomBorder)\r\n{\r\n    CKLBLuaLibGL_SGSetGuardBand(leftBorder,rightBorder,topBorder,bottomBorder);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::clearColor(float r,float g,float b,float a)\r\n{\r\n    _ext_CKLBLuaLibGL_GLClearColor(r,g,b,a);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::setResolution(s32 width,s32 height)\r\n{\r\n    _ext_CKLBLuaLibGL_GLSetResolution(width,height);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSGL::createScreenAsset(System::String* name)\r\n{\r\n    return _ext_CKLBLuaLibGL_GLCreateScreenAsset(System::__MarshallingUtils::NativeUtf8FromString(name));\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSGL::doScreenShot(System::String* name)\r\n{\r\n    return _ext_CKLBLuaLibGL_GLDoScreenShot(System::__MarshallingUtils::NativeUtf8FromString(name));\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::freeScreenAsset(System::String* name)\r\n{\r\n    _ext_CKLBLuaLibGL_GLFreeScreenAsset(System::__MarshallingUtils::NativeUtf8FromString(name));\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::getGuardBand(float& leftBorder,float& rightBorder,float& topBorder,float& bottomBorder)\r\n{\r\n    _ext_CKLBLuaLibGL_SGGetGuardBand(leftBorder,rightBorder,topBorder,bottomBorder);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSGL::setGuardBand(float leftBorder,float rightBorder,float topBorder,float bottomBorder)\r\n{\r\n    _ext_CKLBLuaLibGL_SGSetGuardBand(leftBorder,rightBorder,topBorder,bottomBorder);\r\n}\r\n\r\nEnginePrototype::CSGL::CSGL() { _ctor_CSGL(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSGL::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSGL,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSGL::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSGL::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSGL::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSKey'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSKey::_ctor_CSKey() {\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_genUserID(s32* userId,u32 bufSize)\r\n{\r\n    return CKLBLuaLibKEY_genUserID(userId,bufSize);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_genUserPW(s32* userId,s32* buf,u32 bufSize)\r\n{\r\n    return CKLBLuaLibKEY_genUserPW(userId,buf,bufSize);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_setSecureID(s32* serviceName,s32* userId)\r\n{\r\n    return CKLBLuaLibKEY_setSecureID(serviceName,userId);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_setSecurePW(s32* serviceName,s32* passwd)\r\n{\r\n    return CKLBLuaLibKEY_setSecurePW(serviceName,passwd);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_getSecureID(s32* serviceName,s32* buf,u32 bufSize)\r\n{\r\n    return CKLBLuaLibKEY_getSecureID(serviceName,buf,bufSize);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_getSecurePW(s32* serviceName,s32* buf,u32 bufSize)\r\n{\r\n    return CKLBLuaLibKEY_getSecurePW(serviceName,buf,bufSize);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_delSecureID(s32* serviceName)\r\n{\r\n    return CKLBLuaLibKEY_delSecureID(serviceName);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::_ext_CKLBLuaLibKEY_delSecurePW(s32* serviceName)\r\n{\r\n    return CKLBLuaLibKEY_delSecurePW(serviceName);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ref_genUserID(System::String*& userId,u32 bufSize)\r\n{\r\n    s32* intPtr = System::__MarshallingUtils::NativeUtf8FromString(CS_NEW System::String('0',(s32)bufSize));\r\n    s32 len = _ext_CKLBLuaLibKEY_genUserID(intPtr,bufSize);\r\n    userId = System::__MarshallingUtils::StringFromNativeUtf8(intPtr);\r\n    return len;\r\n}\r\n\r\ninline s32 EnginePrototype::CSKey::genUserID(System::String*& userId,u32 bufSize) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); s32 r = _ref_genUserID(userId,bufSize); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ref_genUserPW(System::String* userId,System::String*& passwd,u32 bufSize)\r\n{\r\n    s32* intPtr = System::__MarshallingUtils::NativeUtf8FromString(CS_NEW System::String('0',(s32)bufSize));\r\n    s32 len = _ext_CKLBLuaLibKEY_genUserPW(System::__MarshallingUtils::NativeUtf8FromString(userId),intPtr,bufSize);\r\n    passwd = System::__MarshallingUtils::StringFromNativeUtf8(intPtr);\r\n    return len;\r\n}\r\n\r\ninline s32 EnginePrototype::CSKey::genUserPW(System::String* userId,System::String*& passwd,u32 bufSize) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); s32 r = _ref_genUserPW(userId,passwd,bufSize); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::setSecureID(System::String* serviceName,System::String* userId)\r\n{\r\n    return _ext_CKLBLuaLibKEY_setSecureID(System::__MarshallingUtils::NativeUtf8FromString(serviceName),System::__MarshallingUtils::NativeUtf8FromString(userId));\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::setSecurePW(System::String* serviceName,System::String* passwd)\r\n{\r\n    return _ext_CKLBLuaLibKEY_setSecurePW(System::__MarshallingUtils::NativeUtf8FromString(serviceName),System::__MarshallingUtils::NativeUtf8FromString(passwd));\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ref_getSecureID(System::String* serviceName,System::String*& secureID,u32 bufSize)\r\n{\r\n    s32* intPtr = System::__MarshallingUtils::NativeUtf8FromString(CS_NEW System::String('0',(s32)bufSize));\r\n    s32 len = _ext_CKLBLuaLibKEY_getSecureID(System::__MarshallingUtils::NativeUtf8FromString(serviceName),intPtr,bufSize);\r\n    secureID = System::__MarshallingUtils::StringFromNativeUtf8(intPtr);\r\n    return len;\r\n}\r\n\r\ninline s32 EnginePrototype::CSKey::getSecureID(System::String* serviceName,System::String*& secureID,u32 bufSize) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); s32 r = _ref_getSecureID(serviceName,secureID,bufSize); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSKey::_ref_getSecurePW(System::String* serviceName,System::String*& securePW,u32 bufSize)\r\n{\r\n    s32* intPtr = System::__MarshallingUtils::NativeUtf8FromString(CS_NEW System::String('0',(s32)bufSize));\r\n    s32 len = _ext_CKLBLuaLibKEY_getSecurePW(System::__MarshallingUtils::NativeUtf8FromString(serviceName),intPtr,bufSize);\r\n    securePW = System::__MarshallingUtils::StringFromNativeUtf8(intPtr);\r\n    return len;\r\n}\r\n\r\ninline s32 EnginePrototype::CSKey::getSecurePW(System::String* serviceName,System::String*& securePW,u32 bufSize) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); s32 r = _ref_getSecurePW(serviceName,securePW,bufSize); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::delSecureID(System::String* serviceName)\r\n{\r\n    return _ext_CKLBLuaLibKEY_delSecureID(System::__MarshallingUtils::NativeUtf8FromString(serviceName));\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSKey::delSecurePW(System::String* serviceName)\r\n{\r\n    return _ext_CKLBLuaLibKEY_delSecurePW(System::__MarshallingUtils::NativeUtf8FromString(serviceName));\r\n}\r\n\r\nEnginePrototype::CSKey::CSKey() { _ctor_CSKey(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSKey::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSKey,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSKey::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSKey::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSKey::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSLang'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSLang::_ctor_CSLang() {\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSLang::_ext_CKLBLuaLibLANG_addString(s32* id,s32* str)\r\n{\r\n    return CKLBLuaLibLANG_addString(id,str);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSLang::_ext_CKLBLuaLibLANG_getString(s32* id)\r\n{\r\n    return CKLBLuaLibLANG_getString(id);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSLang::_ext_CKLBLuaLibLANG_removeString(s32* id)\r\n{\r\n    CKLBLuaLibLANG_removeString(id);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSLang::_ext_CKLBLuaLibLANG_useDB(s32* dbFile,s32* table,s32* keyF,s32* valueF,s32* groupF)\r\n{\r\n    return CKLBLuaLibLANG_useDB(dbFile,table,keyF,valueF,groupF);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSLang::_ext_CKLBLuaLibLANG_loadGroup(s32* groupId)\r\n{\r\n    return CKLBLuaLibLANG_loadGroup(groupId);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSLang::addString(System::String* id,System::String* str)\r\n{\r\n    return _ext_CKLBLuaLibLANG_addString(System::__MarshallingUtils::NativeUtf8FromString(id),System::__MarshallingUtils::NativeUtf8FromString(str));\r\n}\r\n\r\n/*static*/\r\nSystem::String* EnginePrototype::CSLang::getString(System::String* id)\r\n{\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBLuaLibLANG_getString(System::__MarshallingUtils::NativeUtf8FromString(id)));\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSLang::removeString(System::String* id)\r\n{\r\n    _ext_CKLBLuaLibLANG_removeString(System::__MarshallingUtils::NativeUtf8FromString(id));\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSLang::useDB(System::String* dbFile,System::String* table,System::String* keyF,System::String* valueF,System::String* groupF)\r\n{\r\n    return _ext_CKLBLuaLibLANG_useDB(System::__MarshallingUtils::NativeUtf8FromString(dbFile),System::__MarshallingUtils::NativeUtf8FromString(table),System::__MarshallingUtils::NativeUtf8FromString(keyF),System::__MarshallingUtils::NativeUtf8FromString(valueF),System::__MarshallingUtils::NativeUtf8FromString(groupF));\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSLang::loadGroup(System::String* groupId)\r\n{\r\n    return _ext_CKLBLuaLibLANG_loadGroup(System::__MarshallingUtils::NativeUtf8FromString(groupId));\r\n}\r\n\r\nEnginePrototype::CSLang::CSLang() { _ctor_CSLang(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSLang::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSLang,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSLang::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSLang::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSLang::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSMatrix'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSMatrix::_ctor_CSMatrix() {\r\n}\r\n\r\nEnginePrototype::CSMatrix::CSMatrix(System::Array<float>* matrix)\r\n{\r\n    _ctor_CSMatrix();\r\n    if (matrix != NULL)\r\n    {\r\n        if (matrix->_acc_gLength$() == 16)\r\n        {\r\n            _sm_matrix$(matrix);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr50Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        _sm_matrix$((System::Array<float>*)_global_array_initializer_0(CS_NEW System::Array< float >(16)));\r\n    }\r\n}\r\n\r\nSystem::Object* EnginePrototype::CSMatrix::Clone()\r\n{\r\n    return CS_NEW EnginePrototype::CSMatrix((System::Array<float>*)_gm_matrix$()->Clone$());\r\n}\r\n\r\ninline System::Object* EnginePrototype::CSMatrix::Clone$() { CHCKTHIS; return Clone(); }\r\n\r\nEnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Copy()\r\n{\r\n    return (EnginePrototype::CSMatrix*)this->Clone$();\r\n}\r\n\r\ninline EnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Copy$() { CHCKTHIS; return Copy(); }\r\n\r\nEnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Transposed()\r\n{\r\n    System::Array<float>* res = (System::Array<float>*)_global_array_initializer_1(CS_NEW System::Array< float >(16));\r\n    for (s32 i = 0;i < 4;++i)\r\n    {\r\n        for (s32 j = 0;j < 4;++j)\r\n        {\r\n            res->_idx_s$(4 * i + j,_gm_matrix$()->_idx_g$(4 * j + i));\r\n        }\r\n    }\r\n    return CS_NEW EnginePrototype::CSMatrix(res);\r\n}\r\n\r\ninline EnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Transposed$() { CHCKTHIS; return Transposed(); }\r\n\r\nEnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Mul(EnginePrototype::CSMatrix* mat)\r\n{\r\n    System::Array<float>* res = (System::Array<float>*)_global_array_initializer_2(CS_NEW System::Array< float >(16));\r\n    for (s32 i = 0;i < 4;++i)\r\n    {\r\n        for (s32 j = 0;j < 4;++j)\r\n        {\r\n            for (s32 k = 0;k < 4;++k)\r\n            {\r\n                res->_idx_g$(4 * j + i) += this->_idx_g$(i,k) * mat->_idx_g$(k,j);\r\n            }\r\n        }\r\n    }\r\n    return CS_NEW EnginePrototype::CSMatrix(res);\r\n}\r\n\r\ninline EnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Mul$(EnginePrototype::CSMatrix* mat) { CHCKTHIS; return Mul(mat); }\r\n\r\nEnginePrototype::CSVector_inner1* EnginePrototype::CSMatrix::Mul(EnginePrototype::CSVector_inner1* vect)\r\n{\r\n    System::Array<float>* res = (System::Array<float>*)_global_array_initializer_3(CS_NEW System::Array< float >(4));\r\n    for (s32 i = 0;i < 4;++i)\r\n    {\r\n        for (s32 k = 0;k < 4;++k)\r\n        {\r\n            res->_idx_g$(i) += this->_idx_g$(i,k) * vect->_idx_g$(k);\r\n        }\r\n    }\r\n    return CS_NEW EnginePrototype::CSVector_inner1(res);\r\n}\r\n\r\ninline EnginePrototype::CSVector_inner1* EnginePrototype::CSMatrix::Mul$(EnginePrototype::CSVector_inner1* vect) { CHCKTHIS; return Mul(vect); }\r\n\r\n/*static*/\r\nfloat EnginePrototype::CSMatrix::fabs(float f)\r\n{\r\n    return (f >= 0 ? f : f * (-1));\r\n}\r\n\r\nEnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Inverse()\r\n{\r\n    System::Array<float>* A = _gm_matrix$();\r\n    System::Array<float>* B = (System::Array<float>*)_global_array_initializer_4(CS_NEW System::Array< float >(16));\r\n    for (s32 y = 0;y < 4;++y)\r\n    {\r\n        float n = A->_idx_g$(4 * y + y);\r\n        if (fabs(n) < EPSILON)\r\n        return NULL;\r\n        for (s32 x = 0;x < 4;++x)\r\n        {\r\n            A->_idx_g$(4 * y + x) /= n;\r\n            B->_idx_g$(4 * y + x) /= n;\r\n        }\r\n        for (s32 x = 0;x < 4;++x)\r\n        {\r\n            if (x == y)\r\n            {\r\n                continue;\r\n            }\r\n            n = A->_idx_g$(4 * x + y);\r\n            for (s32 z = 0;z < 4;++z)\r\n            {\r\n                A->_idx_g$(4 * x + z) -= A->_idx_g$(4 * y + z) * n;\r\n                B->_idx_g$(4 * x + z) -= B->_idx_g$(4 * y + z) * n;\r\n            }\r\n        }\r\n    }\r\n    return CS_NEW EnginePrototype::CSMatrix(B);\r\n}\r\n\r\ninline EnginePrototype::CSMatrix* EnginePrototype::CSMatrix::Inverse$() { CHCKTHIS; return Inverse(); }\r\n\r\nEnginePrototype::CSMatrix::CSMatrix() { _ctor_CSMatrix(); }\r\n\r\ninline System::Array<float>* EnginePrototype::CSMatrix::_sm_matrix(System::Array<float>* _$value)  { return (System::Array<float>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_matrix,_$value); }\r\ninline System::Array<float>* EnginePrototype::CSMatrix::_sm_matrix$(System::Array<float>* _$value) { CHCKTHIS; return _sm_matrix(_$value); }\r\n\r\n\r\ninline float EnginePrototype::CSMatrix::_idx_g(s32 i, s32 j){\r\n    return _gm_matrix$()->_idx_g$(4 * i + j);\r\n}\r\n\r\ninline float EnginePrototype::CSMatrix::_idx_g$(s32 i, s32 j) { CHCKTHIS; return _idx_g(i, j); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSMatrix::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSMatrix,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSMatrix::_processGC() {\r\n    if (m_matrix) { System::Memory::pushList(m_matrix,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSMatrix::_releaseGC() {\r\n    if (m_matrix && !m_matrix->isFreed()) { m_matrix->_removeRef((System::__GCObject**)&m_matrix); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSMatrix::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_matrix) {\r\n      newPtr = (u8*)(&m_matrix); oldPtr = newPtr - offset;\r\n      m_matrix->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSVector_inner1'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSVector_inner1::_ctor_CSVector_inner1() {\r\n}\r\n\r\nEnginePrototype::CSVector_inner1::CSVector_inner1(System::Array<float>* vector)\r\n{\r\n    _ctor_CSVector_inner1();\r\n    _sm_vector$(vector);\r\n}\r\n\r\nSystem::Object* EnginePrototype::CSVector_inner1::Clone()\r\n{\r\n    return CS_NEW EnginePrototype::CSVector_inner1((System::Array<float>*)_gm_vector$()->Clone$());\r\n}\r\n\r\ninline System::Object* EnginePrototype::CSVector_inner1::Clone$() { CHCKTHIS; return Clone(); }\r\n\r\nEnginePrototype::CSVector_inner1::CSVector_inner1() { _ctor_CSVector_inner1(); }\r\n\r\ninline System::Array<float>* EnginePrototype::CSVector_inner1::_sm_vector(System::Array<float>* _$value)  { return (System::Array<float>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_vector,_$value); }\r\ninline System::Array<float>* EnginePrototype::CSVector_inner1::_sm_vector$(System::Array<float>* _$value) { CHCKTHIS; return _sm_vector(_$value); }\r\n\r\n\r\ninline float EnginePrototype::CSVector_inner1::_idx_g(s32 i){\r\n    return _gm_vector$()->_idx_g$(i);\r\n}\r\n\r\ninline float EnginePrototype::CSVector_inner1::_idx_g$(s32 i) { CHCKTHIS; return _idx_g(i); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSVector_inner1::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSVector_inner1,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSVector_inner1::_processGC() {\r\n    if (m_vector) { System::Memory::pushList(m_vector,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSVector_inner1::_releaseGC() {\r\n    if (m_vector && !m_vector->isFreed()) { m_vector->_removeRef((System::__GCObject**)&m_vector); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSVector_inner1::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_vector) {\r\n      newPtr = (u8*)(&m_vector); oldPtr = newPtr - offset;\r\n      m_vector->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSRES'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSRES::_ctor_CSRES() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::_ext_CKLBLuaLibRES_dumpSceneGraph(s32* task)\r\n{\r\n    CKLBLuaLibRES_dumpSceneGraph(task);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::_ext_CKLBLuaLibRES_dumpRendering(bool detailed)\r\n{\r\n    CKLBLuaLibRES_dumpRendering(detailed);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::_ext_CKLBLuaLibRES_dumpAssets()\r\n{\r\n    CKLBLuaLibRES_dumpAssets();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::_ext_CKLBLuaLibRES_dumpDataSet()\r\n{\r\n    CKLBLuaLibRES_dumpDataSet();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::_ext_CKLBLuaLibRES_dumpTexturePacker(bool detailed)\r\n{\r\n    CKLBLuaLibRES_dumpTexturePacker(detailed);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::_ext_CKLBLuaLibRES_dumpGeometryCost(bool detailed)\r\n{\r\n    CKLBLuaLibRES_dumpGeometryCost(detailed);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::dumpSceneGraph(EnginePrototype::CKLBUITask* task)\r\n{\r\n    if (task != NULL)\r\n    {\r\n        _ext_CKLBLuaLibRES_dumpSceneGraph(task->_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        _ext_CKLBLuaLibRES_dumpSceneGraph(System::IntPtr::Zero);\r\n    }\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::dumpRendering(bool detailed)\r\n{\r\n    _ext_CKLBLuaLibRES_dumpRendering(detailed);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::dumpAssets()\r\n{\r\n    _ext_CKLBLuaLibRES_dumpAssets();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::dumpDataSet()\r\n{\r\n    _ext_CKLBLuaLibRES_dumpDataSet();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::dumpTexturePacker(bool detailed)\r\n{\r\n    _ext_CKLBLuaLibRES_dumpTexturePacker(detailed);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSRES::dumpGeometryCost(bool detailed)\r\n{\r\n    _ext_CKLBLuaLibRES_dumpGeometryCost(detailed);\r\n}\r\n\r\nEnginePrototype::CSRES::CSRES() { _ctor_CSRES(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSRES::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSRES,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSRES::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSRES::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSRES::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSSound'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSSound::_ctor_CSSound() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundOpen(s32* sndAsset,bool fBgm)\r\n{\r\n    return CKLBLuaLibSOUND_cmdSoundOpen(sndAsset,fBgm);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundSetBufSize(s32* pSnd,s32 level)\r\n{\r\n    return CKLBLuaLibSOUND_cmdSoundSetBufSize(pSnd,level);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundClose(s32* pSnd)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundClose(pSnd);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_removeSoundAll()\r\n{\r\n    return CKLBLuaLibSOUND_removeSoundAll();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundPlay(s32* pSnd,u32 fade_msec,float tgtVol,float globalVol)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundPlay(pSnd,fade_msec,tgtVol,globalVol);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundStop(s32* pSnd,u32 fade_msec,float tgtVol)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundStop(pSnd,fade_msec,tgtVol);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundVolume(s32* pSnd,float volume)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundVolume(pSnd,volume);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundPan(s32* pSnd,float pan)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundPan(pSnd,pan);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundPause(s32* pSnd)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundPause(pSnd);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundResume(s32* pSnd)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundResume(pSnd);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundSeek(s32* pSnd,s32 millisec)\r\n{\r\n    CKLBLuaLibSOUND_cmdSoundSeek(pSnd,millisec);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundTell(s32* pSnd)\r\n{\r\n    return CKLBLuaLibSOUND_cmdSoundTell(pSnd);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSoundState(s32* pSnd)\r\n{\r\n    return CKLBLuaLibSOUND_cmdSoundState(pSnd);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdVolumeBGM(float volume)\r\n{\r\n    CKLBLuaLibSOUND_cmdVolumeBGM(volume);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdVolumeSE(float volume)\r\n{\r\n    CKLBLuaLibSOUND_cmdVolumeSE(volume);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdGetLength(s32* pSnd)\r\n{\r\n    return CKLBLuaLibSOUND_cmdGetLength(pSnd);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::_ext_CKLBLuaLibSOUND_cmdSetFade(s32* pSnd,s32 millisec,float tgtVol)\r\n{\r\n    CKLBLuaLibSOUND_cmdSetFade(pSnd,millisec,tgtVol);\r\n}\r\n\r\nEnginePrototype::CSSound::CSSound(System::String* sound_asset,bool bgmMode) : EnginePrototype::GameObject(s_classID)\r\n{\r\n    _ctor_CSSound();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBLuaLibSOUND_cmdSoundOpen(System::__MarshallingUtils::NativeUtf8FromString(sound_asset),bgmMode);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nbool EnginePrototype::CSSound::setBufSize(s32 size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_bufSize$(size);\r\n        return _ext_CKLBLuaLibSOUND_cmdSoundSetBufSize(EnginePrototype::GameObject::_acc_gCppObject$(),(s32)size);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CSSound::setBufSize$(s32 size) { CHCKTHIS; return setBufSize(size); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CSSound::clearInternals()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSoundClose(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::clearInternals$() { CHCKTHIS; return clearInternals(); }\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::closeAll()\r\n{\r\n    _ext_CKLBLuaLibSOUND_removeSoundAll();\r\n}\r\n\r\nvoid EnginePrototype::CSSound::play(u32 fade_msec,float tgtVol,float globalVol)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSoundPlay(EnginePrototype::GameObject::_acc_gCppObject$(),fade_msec,tgtVol,globalVol);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::play$(u32 fade_msec,float tgtVol,float globalVol) { CHCKTHIS; return play(fade_msec,tgtVol,globalVol); }\r\n\r\nvoid EnginePrototype::CSSound::stop(u32 fade_msec,float tgtVol)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSoundStop(EnginePrototype::GameObject::_acc_gCppObject$(),fade_msec,tgtVol);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::stop$(u32 fade_msec,float tgtVol) { CHCKTHIS; return stop(fade_msec,tgtVol); }\r\n\r\nvoid EnginePrototype::CSSound::pause()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSoundPause(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::pause$() { CHCKTHIS; return pause(); }\r\n\r\nvoid EnginePrototype::CSSound::resume()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSoundResume(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::resume$() { CHCKTHIS; return resume(); }\r\n\r\nvoid EnginePrototype::CSSound::seek(s32 milliseconds)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSoundSeek(EnginePrototype::GameObject::_acc_gCppObject$(),milliseconds);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::seek$(s32 milliseconds) { CHCKTHIS; return seek(milliseconds); }\r\n\r\ns32 EnginePrototype::CSSound::tell()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibSOUND_cmdSoundTell(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CSSound::tell$() { CHCKTHIS; return tell(); }\r\n\r\ns32 EnginePrototype::CSSound::state()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibSOUND_cmdSoundState(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CSSound::state$() { CHCKTHIS; return state(); }\r\n\r\nvoid EnginePrototype::CSSound::setFade(s32 millisec,float tgtVol)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBLuaLibSOUND_cmdSetFade(EnginePrototype::GameObject::_acc_gCppObject$(),millisec,tgtVol);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CSSound::setFade$(s32 millisec,float tgtVol) { CHCKTHIS; return setFade(millisec,tgtVol); }\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::volumeBGM(float volume)\r\n{\r\n    _ext_CKLBLuaLibSOUND_cmdVolumeBGM(volume);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSound::volumeSE(float volume)\r\n{\r\n    _ext_CKLBLuaLibSOUND_cmdVolumeSE(volume);\r\n}\r\n\r\nEnginePrototype::CSSound::CSSound() { _ctor_CSSound(); }\r\n\r\n\r\n\r\ninline s32 EnginePrototype::CSSound::_acc_gBufSize(){\r\n    return _gm_bufSize$();\r\n}\r\n\r\ninline s32 EnginePrototype::CSSound::_acc_gBufSize$() { CHCKTHIS; return _acc_gBufSize(); }\r\n\r\ninline float EnginePrototype::CSSound::_acc_gVolume(){\r\n    return _gm_volume$();\r\n}\r\n\r\ninline float EnginePrototype::CSSound::_acc_gVolume$() { CHCKTHIS; return _acc_gVolume(); }\r\n\r\ninline float EnginePrototype::CSSound::_acc_sVolume(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_volume$(value);\r\n        _ext_CKLBLuaLibSOUND_cmdSoundVolume(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CSSound::_acc_sVolume$(float value)\t\t{ CHCKTHIS; return _acc_sVolume(value); }\r\ninline float EnginePrototype::CSSound::_acc_gPan(){\r\n    return _gm_pan$();\r\n}\r\n\r\ninline float EnginePrototype::CSSound::_acc_gPan$() { CHCKTHIS; return _acc_gPan(); }\r\n\r\ninline float EnginePrototype::CSSound::_acc_sPan(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_pan$(value);\r\n        _ext_CKLBLuaLibSOUND_cmdSoundPan(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CSSound::_acc_sPan$(float value)\t\t{ CHCKTHIS; return _acc_sPan(value); }\r\ninline s32 EnginePrototype::CSSound::_acc_gLength(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBLuaLibSOUND_cmdGetLength(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CSSound::_acc_gLength$() { CHCKTHIS; return _acc_gLength(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSSound::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSSound,EnginePrototype::GameObject);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSSound::_processGC() {\r\n    EnginePrototype::GameObject::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSSound::_releaseGC() {\r\n    EnginePrototype::GameObject::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSSound::_moveAlert(u32 offset) {\r\n    EnginePrototype::GameObject::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CSSystem'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSSystem::_ctor_CSSystem() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::_ext_CKLBLuaEnv_cmdLogging(s32* msg)\r\n{\r\n    CKLBLuaEnv_cmdLogging(msg);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::_ext_CKLBLuaEnv_cmdExit()\r\n{\r\n    CKLBLuaEnv_cmdExit();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::_ext_CKLBLuaEnv_cmdSystemInfo(s32& width,s32& height)\r\n{\r\n    CKLBLuaEnv_cmdSystemInfo(&width,&height);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::_ext_CKLBLuaEnv_cmdSystemReboot()\r\n{\r\n    CKLBLuaEnv_cmdSystemReboot();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::logging(System::String* msg)\r\n{\r\n    _ext_CKLBLuaEnv_cmdLogging(System::__MarshallingUtils::NativeUtf8FromString(msg));\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::exitGame()\r\n{\r\n    _ext_CKLBLuaEnv_cmdExit();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::getInfo(EnginePrototype::SystemInfo_inner2& sysInfos)\r\n{\r\n    s32 width = 0;\r\n    s32 height = 0;\r\n    _ext_CKLBLuaEnv_cmdSystemInfo(width,height);\r\n    sysInfos._swidth$(width);\r\n    sysInfos._sheight$(height);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSSystem::reboot()\r\n{\r\n    _ext_CKLBLuaEnv_cmdSystemReboot();\r\n}\r\n\r\nEnginePrototype::CSSystem::CSSystem() { _ctor_CSSystem(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSSystem::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSSystem,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSSystem::_processGC() {\r\n    System::Object::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSSystem::_releaseGC() {\r\n    System::Object::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSSystem::_moveAlert(u32 offset) {\r\n    System::Object::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'SystemInfo_inner2'\r\n//=============================\r\n\r\nvoid EnginePrototype::SystemInfo_inner2::_ctor_SystemInfo_inner2() {\r\n}\r\n\r\nEnginePrototype::SystemInfo_inner2::SystemInfo_inner2() { _ctor_SystemInfo_inner2(); }\r\n\r\n\r\ninline u32 EnginePrototype::SystemInfo_inner2::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\ninline void EnginePrototype::SystemInfo_inner2::_releaseGC() {\r\n}\r\ninline void* EnginePrototype::SystemInfo_inner2::_RefSetValue(void* newStruct) {\r\n    SystemInfo_inner2* pStruct = (SystemInfo_inner2*)newStruct;\r\n    this->width = pStruct->width;\r\n    this->height = pStruct->height;\r\n    return newStruct;\r\n}\r\ninline void EnginePrototype::SystemInfo_inner2::_moveAlert(u32 offset) {\r\n}\r\ninline EnginePrototype::SystemInfo_inner2& EnginePrototype::SystemInfo_inner2::__registerByRef(EnginePrototype::SystemInfo_inner2& m) {\r\n    return m;\r\n}\r\n\r\n\r\n//=============================\r\n// Implementation of 'CSUI'\r\n//=============================\r\n\r\nvoid EnginePrototype::CSUI::_ctor_CSUI() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSUI::_ext_CKLBLuaLibUI_calcPosition(float x,float y,float w,float h,u32 mask,float& out_rx,float& out_ry)\r\n{\r\n    CKLBLuaLibUI_calcPosition(x,y,w,h,mask,&out_rx,&out_ry);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CSUI::calcPosition(float x,float y,float w,float h,s32 mask,float& out_rx,float& out_ry)\r\n{\r\n    _ext_CKLBLuaLibUI_calcPosition(x,y,w,h,(u32)mask,out_rx,out_ry);\r\n}\r\n\r\nEnginePrototype::CSUI::CSUI() { _ctor_CSUI(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CSUI::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CSUI,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CSUI::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSUI::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CSUI::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBAsyncLoader'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBAsyncLoader::_ctor_CKLBAsyncLoader() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBAsyncLoader::_ext_CKLBAsyncLoader_create(s32* pParentTask,System::Array<s32*>* assets,u32 count,u32 datasetID)\r\n{\r\n    return CKLBAsyncLoader_create(pParentTask,assets ? (s32**)assets->_getPArray() : NULL,count,datasetID);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBAsyncLoader::_ext_CKLBAsyncLoader_getProcessCount(s32* p)\r\n{\r\n    return CKLBAsyncLoader_getProcessCount(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBAsyncLoader::_ext_CKLBAsyncLoader_getTotalCount(s32* p)\r\n{\r\n    return CKLBAsyncLoader_getTotalCount(p);\r\n}\r\n\r\nEnginePrototype::CKLBAsyncLoader::CKLBAsyncLoader(EnginePrototype::CKLBTask* pParent,System::Array<System::String*>* assets,u32 datasetID,EnginePrototype::_Delegate_Base_CallBack_inner21* callback) : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBAsyncLoader();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBAsyncLoader_create(((pParent != NULL) ? pParent->_acc_gCppObject$() : System::IntPtr::Zero),System::__MarshallingUtils::NativeUtf8ArrayFromStringArray(assets,assets->_acc_gLength$()),(u32)assets->_acc_gLength$(),datasetID);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    _sm_callback$(callback);\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBAsyncLoader::CKLBAsyncLoader() : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBAsyncLoader();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBAsyncLoader::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUU_inner11<CKLBAsyncLoader>(this,&CKLBAsyncLoader::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBAsyncLoader::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBAsyncLoader::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner21*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBAsyncLoader::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBAsyncLoader::callBackFunction(u32 loaded,u32 total)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,loaded,total);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBAsyncLoader::callBackFunction$(u32 loaded,u32 total) { CHCKTHIS; return callBackFunction(loaded,total); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner21* EnginePrototype::CKLBAsyncLoader::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner21* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner21*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner21* EnginePrototype::CKLBAsyncLoader::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner21* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBAsyncLoader::_acc_gProcessCount(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBAsyncLoader_getProcessCount(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBAsyncLoader::_acc_gProcessCount$() { CHCKTHIS; return _acc_gProcessCount(); }\r\n\r\ninline u32 EnginePrototype::CKLBAsyncLoader::_acc_gTotalCount(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBAsyncLoader_getTotalCount(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBAsyncLoader::_acc_gTotalCount$() { CHCKTHIS; return _acc_gTotalCount(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBAsyncLoader::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBAsyncLoader,EnginePrototype::CKLBTask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBAsyncLoader::_processGC() {\r\n    EnginePrototype::CKLBTask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBAsyncLoader::_releaseGC() {\r\n    EnginePrototype::CKLBTask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBAsyncLoader::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBTask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBGenericTask'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBGenericTask::_ctor_CKLBGenericTask() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBGenericTask::_ext_CKLBGenericTask_create(s32* pParent,u32 phase)\r\n{\r\n    return CKLBGenericTask_create(pParent,phase);\r\n}\r\n\r\nEnginePrototype::CKLBGenericTask::CKLBGenericTask(EnginePrototype::CKLBTask* parent,s32 phase,EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* executeCallBack,EnginePrototype::_Delegate_Base_DieCallBack_inner23* dieCallBack) : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBGenericTask();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBGenericTask_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),(u32)phase);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_executeCallBack$(executeCallBack);\r\n    _sm_dieCallBack$(dieCallBack);\r\n}\r\n\r\nEnginePrototype::CKLBGenericTask::CKLBGenericTask() : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBGenericTask();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBGenericTask::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerU_inner10<CKLBGenericTask>(this,&CKLBGenericTask::executeCallBackFunction),0);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerV_inner0<CKLBGenericTask>(this,&CKLBGenericTask::dieCallBackFunction),1);\r\n}\r\n\r\ninline void EnginePrototype::CKLBGenericTask::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBGenericTask::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    if (delegateName->Equals(_$_cteStr55Obj))\r\n    {\r\n        _sm_executeCallBack$((EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr56Obj))\r\n    {\r\n        _sm_dieCallBack$((EnginePrototype::_Delegate_Base_DieCallBack_inner23*)anyDelegate);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr57Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBGenericTask::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBGenericTask::executeCallBackFunction(u32 deltaTime)\r\n{\r\n    if (_gm_executeCallBack$() != NULL)\r\n    {\r\n        _gm_executeCallBack$()->call$(this,deltaTime);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBGenericTask::executeCallBackFunction$(u32 deltaTime) { CHCKTHIS; return executeCallBackFunction(deltaTime); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBGenericTask::dieCallBackFunction()\r\n{\r\n    if (_gm_dieCallBack$() != NULL)\r\n    {\r\n        _gm_dieCallBack$()->call$(this);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBGenericTask::dieCallBackFunction$() { CHCKTHIS; return dieCallBackFunction(); }\r\n\r\ninline EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* EnginePrototype::CKLBGenericTask::_sm_executeCallBack(EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* _$value)  { return (EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_executeCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* EnginePrototype::CKLBGenericTask::_sm_executeCallBack$(EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* _$value) { CHCKTHIS; return _sm_executeCallBack(_$value); }\r\ninline EnginePrototype::_Delegate_Base_DieCallBack_inner23* EnginePrototype::CKLBGenericTask::_sm_dieCallBack(EnginePrototype::_Delegate_Base_DieCallBack_inner23* _$value)  { return (EnginePrototype::_Delegate_Base_DieCallBack_inner23*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_dieCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_DieCallBack_inner23* EnginePrototype::CKLBGenericTask::_sm_dieCallBack$(EnginePrototype::_Delegate_Base_DieCallBack_inner23* _$value) { CHCKTHIS; return _sm_dieCallBack(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBGenericTask::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBGenericTask,EnginePrototype::CKLBTask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBGenericTask::_processGC() {\r\n    EnginePrototype::CKLBTask::_processGC();\r\n\r\n    if (m_executeCallBack) { System::Memory::pushList(m_executeCallBack,0); }\r\n    if (m_dieCallBack) { System::Memory::pushList(m_dieCallBack,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBGenericTask::_releaseGC() {\r\n    EnginePrototype::CKLBTask::_releaseGC();\r\n\r\n    if (m_executeCallBack && !m_executeCallBack->isFreed()) { m_executeCallBack->_removeRef((System::__GCObject**)&m_executeCallBack); }\r\n    if (m_dieCallBack && !m_dieCallBack->isFreed()) { m_dieCallBack->_removeRef((System::__GCObject**)&m_dieCallBack); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBGenericTask::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBTask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_executeCallBack) {\r\n      newPtr = (u8*)(&m_executeCallBack); oldPtr = newPtr - offset;\r\n      m_executeCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_dieCallBack) {\r\n      newPtr = (u8*)(&m_dieCallBack); oldPtr = newPtr - offset;\r\n      m_dieCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBIntervalTimer'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBIntervalTimer::_ctor_CKLBIntervalTimer() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_create(s32* pParent,u32 interval,bool repeat,u8 mode)\r\n{\r\n    return CKLBIntervalTimer_create(pParent,interval,repeat,mode);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_getTimerID(s32* p)\r\n{\r\n    return CKLBIntervalTimer_getTimerID(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_setTimerID(s32* p,u32 ID)\r\n{\r\n    CKLBIntervalTimer_setTimerID(p,ID);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_getRepeat(s32* p)\r\n{\r\n    return CKLBIntervalTimer_getRepeat(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_setRepeat(s32* p,bool boolean)\r\n{\r\n    CKLBIntervalTimer_setRepeat(p,boolean);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_getInterval(s32* p)\r\n{\r\n    return CKLBIntervalTimer_getInterval(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_setInterval(s32* p,u32 interval)\r\n{\r\n    CKLBIntervalTimer_setInterval(p,interval);\r\n}\r\n\r\n/*static*/\r\nu8 EnginePrototype::CKLBIntervalTimer::_ext_CKLBIntervalTimer_getMode(s32* p)\r\n{\r\n    return CKLBIntervalTimer_getMode(p);\r\n}\r\n\r\nEnginePrototype::CKLBIntervalTimer::CKLBIntervalTimer(EnginePrototype::CKLBTask* parent,u32 interval,EnginePrototype::_Delegate_Base_CallBack_inner24* callback,bool repeat,s32 mode) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBIntervalTimer();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBIntervalTimer_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),interval,repeat,(u8)mode);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBIntervalTimer::CKLBIntervalTimer() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBIntervalTimer();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBIntervalTimer::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerV_inner0<CKLBIntervalTimer>(this,&CKLBIntervalTimer::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBIntervalTimer::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBIntervalTimer::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner24*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBIntervalTimer::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBIntervalTimer::callBackFunction()\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBIntervalTimer::callBackFunction$() { CHCKTHIS; return callBackFunction(); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner24* EnginePrototype::CKLBIntervalTimer::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner24* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner24*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner24* EnginePrototype::CKLBIntervalTimer::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner24* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline s32 EnginePrototype::CKLBIntervalTimer::_acc_gMode(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return (ETIMERMODE)_ext_CKLBIntervalTimer_getMode(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBIntervalTimer::_acc_gMode$() { CHCKTHIS; return _acc_gMode(); }\r\n\r\ninline u32 EnginePrototype::CKLBIntervalTimer::_acc_gInterval(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBIntervalTimer_getInterval(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBIntervalTimer::_acc_gInterval$() { CHCKTHIS; return _acc_gInterval(); }\r\n\r\ninline u32 EnginePrototype::CKLBIntervalTimer::_acc_sInterval(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBIntervalTimer_setInterval(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBIntervalTimer::_acc_sInterval$(u32 value)\t\t{ CHCKTHIS; return _acc_sInterval(value); }\r\ninline bool EnginePrototype::CKLBIntervalTimer::_acc_gRepeat(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBIntervalTimer_getRepeat(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBIntervalTimer::_acc_gRepeat$() { CHCKTHIS; return _acc_gRepeat(); }\r\n\r\ninline bool EnginePrototype::CKLBIntervalTimer::_acc_sRepeat(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBIntervalTimer_setRepeat(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBIntervalTimer::_acc_sRepeat$(bool value)\t\t{ CHCKTHIS; return _acc_sRepeat(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBIntervalTimer::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBIntervalTimer,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBIntervalTimer::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBIntervalTimer::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBIntervalTimer::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBNetAPI'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBNetAPI::_ctor_CKLBNetAPI() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_create(s32* pParent,s32* apiurl,s32* client_version,s32* consumerKey,s32* applicationId,u32 sessionMax,s32* region)\r\n{\r\n    return CKLBNetAPI_create(pParent,apiurl,client_version,consumerKey,applicationId,sessionMax,region);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_startUp(s32* p,s32* loginID,s32* password,s32* invite,u32 timeout,u32& session)\r\n{\r\n    return CKLBNetAPI_startUp(p,loginID,password,invite,timeout,&session);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_login(s32* p,s32* loginID,s32* password,u32 timeout,u32& session)\r\n{\r\n    return CKLBNetAPI_login(p,loginID,password,timeout,&session);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_cancel(s32* p,u32 uniq)\r\n{\r\n    return CKLBNetAPI_cancel(p,uniq);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_cancelAll(s32* p)\r\n{\r\n    CKLBNetAPI_cancelAll(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_watchMaintenance(s32* p,u32 timeout,u32& session)\r\n{\r\n    return CKLBNetAPI_watchMaintenance(p,timeout,&session);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_debugHdr(s32* p,bool debugflag)\r\n{\r\n    CKLBNetAPI_debugHdr(p,debugflag);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_genCmdNumID(s32* p,s32* body,s32 serial,s32* buf)\r\n{\r\n    CKLBNetAPI_genCmdNumID(p,body,serial,buf);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBNetAPI::_ext_CKLBNetAPI_sendHTTP(s32* p,s32* apiURL,s32* json,u32 timeout,bool passVersionCheck,u32& session)\r\n{\r\n    return CKLBNetAPI_sendHTTP(p,apiURL,json,timeout,passVersionCheck,&session);\r\n}\r\n\r\nEnginePrototype::CKLBNetAPI::CKLBNetAPI(EnginePrototype::CKLBTask* parent,System::String* apiUrl,System::String* clientVersion,System::String* consumerKey,System::String* applicationID,u32 sessionMax,System::String* region,EnginePrototype::_Delegate_Base_CallBack_inner25* callback,EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* versionUpCallback) : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBNetAPI();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBNetAPI_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),System::__MarshallingUtils::NativeUtf8FromString(apiUrl),System::__MarshallingUtils::NativeUtf8FromString(clientVersion),System::__MarshallingUtils::NativeUtf8FromString(consumerKey),System::__MarshallingUtils::NativeUtf8FromString(applicationID),sessionMax,System::__MarshallingUtils::NativeUtf8FromString(region));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n    _sm_callbackVersionUp$(versionUpCallback);\r\n}\r\n\r\nEnginePrototype::CKLBNetAPI::CKLBNetAPI() : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBNetAPI();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBNetAPI::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerIIIP_retB_inner19<CKLBNetAPI>(this,&CKLBNetAPI::callBackFunction),0);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerSS_inner7<CKLBNetAPI>(this,&CKLBNetAPI::callBackVersionUpFunction),1);\r\n}\r\n\r\ninline void EnginePrototype::CKLBNetAPI::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBNetAPI::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    if (delegateName->Equals(_$_cteStr61Obj))\r\n    {\r\n        _sm_callbackVersionUp$((EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26*)anyDelegate);\r\n    }\r\n    else\r\n    {\r\n        _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner25*)anyDelegate);\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBNetAPI::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBNetAPI::callBackFunction(s32 uniq,s32 msg,s32 status,s32* pRoot)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        return _gm_callback$()->call$(this,uniq,(ESTATUS)msg,status,pRoot);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBNetAPI::callBackFunction$(s32 uniq,s32 msg,s32 status,s32* pRoot) { CHCKTHIS; return callBackFunction(uniq,msg,status,pRoot); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBNetAPI::callBackVersionUpFunction(s32* clientVer,s32* serverVer)\r\n{\r\n    if (_gm_callbackVersionUp$() != NULL)\r\n    {\r\n        _gm_callbackVersionUp$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(clientVer),System::__MarshallingUtils::StringFromNativeUtf8(serverVer));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBNetAPI::callBackVersionUpFunction$(s32* clientVer,s32* serverVer) { CHCKTHIS; return callBackVersionUpFunction(clientVer,serverVer); }\r\n\r\nbool EnginePrototype::CKLBNetAPI::startUp(u32& session,System::String* loginID,System::String* password,System::String* invite,u32 timeout)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        bool res = _ext_CKLBNetAPI_startUp(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(loginID),System::__MarshallingUtils::NativeUtf8FromString(password),System::__MarshallingUtils::NativeUtf8FromString(invite),timeout,session);\r\n        return res;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBNetAPI::startUp$(u32& session,System::String* loginID,System::String* password,System::String* invite,u32 timeout) { CHCKTHIS; return startUp(session,loginID,password,invite,timeout); }\r\n\r\nbool EnginePrototype::CKLBNetAPI::login(u32& session,System::String* loginID,System::String* password,u32 timeout)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        bool res = _ext_CKLBNetAPI_login(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(loginID),System::__MarshallingUtils::NativeUtf8FromString(password),timeout,session);\r\n        return res;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBNetAPI::login$(u32& session,System::String* loginID,System::String* password,u32 timeout) { CHCKTHIS; return login(session,loginID,password,timeout); }\r\n\r\nbool EnginePrototype::CKLBNetAPI::cancel(u32 session)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBNetAPI_cancel(EnginePrototype::GameObject::_acc_gCppObject$(),session);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBNetAPI::cancel$(u32 session) { CHCKTHIS; return cancel(session); }\r\n\r\nbool EnginePrototype::CKLBNetAPI::send(u32& session,System::String* json,System::String* apiURL,u32 timeout,bool pass_version_check)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBNetAPI_sendHTTP(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(apiURL),System::__MarshallingUtils::NativeUtf8FromString(json),timeout,pass_version_check,session);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBNetAPI::send$(u32& session,System::String* json,System::String* apiURL,u32 timeout,bool pass_version_check) { CHCKTHIS; return send(session,json,apiURL,timeout,pass_version_check); }\r\n\r\nvoid EnginePrototype::CKLBNetAPI::cancelAll()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBNetAPI_cancelAll(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBNetAPI::cancelAll$() { CHCKTHIS; return cancelAll(); }\r\n\r\nbool EnginePrototype::CKLBNetAPI::watchMaintenance(u32& session,u32 timeout)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBNetAPI_watchMaintenance(EnginePrototype::GameObject::_acc_gCppObject$(),timeout,session);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBNetAPI::watchMaintenance$(u32& session,u32 timeout) { CHCKTHIS; return watchMaintenance(session,timeout); }\r\n\r\nvoid EnginePrototype::CKLBNetAPI::debugHdr(bool debugflag)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBNetAPI_debugHdr(EnginePrototype::GameObject::_acc_gCppObject$(),debugflag);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBNetAPI::debugHdr$(bool debugflag) { CHCKTHIS; return debugHdr(debugflag); }\r\n\r\nvoid EnginePrototype::CKLBNetAPI::_ref_genCmdNumID(System::String*& numID,System::String* body,s32 serial)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        s32* intPtr = System::__MarshallingUtils::NativeUtf8FromString(CS_NEW System::String('0',512));\r\n        _ext_CKLBNetAPI_genCmdNumID(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(body),serial,intPtr);\r\n        numID = System::__MarshallingUtils::StringFromNativeUtf8(intPtr);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBNetAPI::genCmdNumID$(System::String*& numID,System::String* body,s32 serial) { CHCKTHIS; return genCmdNumID(numID,body,serial); }\r\n\r\ninline void EnginePrototype::CKLBNetAPI::genCmdNumID(System::String*& numID,System::String* body,s32 serial) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); _ref_genCmdNumID(numID,body,serial); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner25* EnginePrototype::CKLBNetAPI::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner25* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner25*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner25* EnginePrototype::CKLBNetAPI::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner25* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* EnginePrototype::CKLBNetAPI::_sm_callbackVersionUp(EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* _$value)  { return (EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callbackVersionUp,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* EnginePrototype::CKLBNetAPI::_sm_callbackVersionUp$(EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* _$value) { CHCKTHIS; return _sm_callbackVersionUp(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBNetAPI::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBNetAPI,EnginePrototype::CKLBTask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBNetAPI::_processGC() {\r\n    EnginePrototype::CKLBTask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    if (m_callbackVersionUp) { System::Memory::pushList(m_callbackVersionUp,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBNetAPI::_releaseGC() {\r\n    EnginePrototype::CKLBTask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n    if (m_callbackVersionUp && !m_callbackVersionUp->isFreed()) { m_callbackVersionUp->_removeRef((System::__GCObject**)&m_callbackVersionUp); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBNetAPI::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBTask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_callbackVersionUp) {\r\n      newPtr = (u8*)(&m_callbackVersionUp); oldPtr = newPtr - offset;\r\n      m_callbackVersionUp->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBStoreService'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBStoreService::_ctor_CKLBStoreService() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBStoreService::_ext_CKLBStoreService_create()\r\n{\r\n    return CKLBStoreService_create();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBStoreService::_ext_CKLBStoreService_buyItems(s32* p,s32* item)\r\n{\r\n    CKLBStoreService_buyItems(p,item);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBStoreService::_ext_CKLBStoreService_getProducts(s32* p,s32* json,bool currency)\r\n{\r\n    CKLBStoreService_getProducts(p,json,currency);\r\n}\r\n\r\nEnginePrototype::CKLBStoreService::CKLBStoreService(EnginePrototype::_Delegate_Base_CallBack_inner27* callback) : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBStoreService();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBStoreService_create();\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    _sm_callback$(callback);\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBStoreService::CKLBStoreService() : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBStoreService();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBStoreService::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUSS_inner9<CKLBStoreService>(this,&CKLBStoreService::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBStoreService::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBStoreService::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner27*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBStoreService::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBStoreService::callBackFunction(u32 type,s32* itemID,s32* param)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,(EnginePrototype::IClientRequest::EVENT_TYPE)type,System::__MarshallingUtils::StringFromNativeUtf8(itemID),System::__MarshallingUtils::StringFromNativeUtf8(param));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBStoreService::callBackFunction$(u32 type,s32* itemID,s32* param) { CHCKTHIS; return callBackFunction(type,itemID,param); }\r\n\r\nvoid EnginePrototype::CKLBStoreService::buyItems(System::String* item)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBStoreService_buyItems(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(item));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBStoreService::buyItems$(System::String* item) { CHCKTHIS; return buyItems(item); }\r\n\r\nvoid EnginePrototype::CKLBStoreService::getProducts(System::String* json,bool currency)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBStoreService_getProducts(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(json),currency);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBStoreService::getProducts$(System::String* json,bool currency) { CHCKTHIS; return getProducts(json,currency); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner27* EnginePrototype::CKLBStoreService::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner27* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner27*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner27* EnginePrototype::CKLBStoreService::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner27* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBStoreService::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBStoreService,EnginePrototype::CKLBTask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBStoreService::_processGC() {\r\n    EnginePrototype::CKLBTask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBStoreService::_releaseGC() {\r\n    EnginePrototype::CKLBTask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBStoreService::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBTask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBTask'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBTask::_ctor_CKLBTask() {\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::_ext_Task_kill(s32* task)\r\n{\r\n    Task_kill(task);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::_ext_Task_setStageTask(s32* task)\r\n{\r\n    Task_setStageTask(task);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::_ext_Task_clearStageTask()\r\n{\r\n    Task_clearStageTask();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::_ext_Task_setPause(s32* task,bool bPause,bool bRecursive)\r\n{\r\n    Task_setPause(task,bPause,bRecursive);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::_ext_Task_setManagerPause(bool bPause)\r\n{\r\n    Task_setManagerPause(bPause);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::_ext_Task_interposeTimer(s32* pTask,s32* pTimer)\r\n{\r\n    Task_interposeTimer(pTask,pTimer);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBTask::_ext_Task_isKill(s32* task)\r\n{\r\n    return Task_isKill(task);\r\n}\r\n\r\nEnginePrototype::CKLBTask::CKLBTask(u32 classID) : EnginePrototype::GameObject(classID)\r\n{\r\n    _ctor_CKLBTask();\r\n    _sm_timer$(NULL);\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerV_inner0<CKLBTask>(this,&CKLBTask::onDieCallBackFunction),5);\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\nvoid EnginePrototype::CKLBTask::setOnDieCallBack(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* anyDelegate)\r\n{\r\n    _sm_callback$(anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::setOnDieCallBack$(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* anyDelegate) { CHCKTHIS; return setOnDieCallBack(anyDelegate); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::onDieCallBackFunction()\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this);\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::onDieCallBackFunction$() { CHCKTHIS; return onDieCallBackFunction(); }\r\n\r\nvoid EnginePrototype::CKLBTask::kill()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        onDieCallBackFunction$();\r\n        s32* cppObject = EnginePrototype::GameObject::_acc_gCppObject$();\r\n        EnginePrototype::GameObject::unbind$();\r\n        _ext_Task_kill(cppObject);\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::kill$() { CHCKTHIS; return kill(); }\r\n\r\nbool EnginePrototype::CKLBTask::isKill()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_Task_isKill(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    return true;\r\n}\r\n\r\ninline bool EnginePrototype::CKLBTask::isKill$() { CHCKTHIS; return isKill(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::Dispose()\r\n{\r\n    kill$();\r\n    EnginePrototype::GameObject::Dispose();\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::Dispose$() { CHCKTHIS; return Dispose(); }\r\n\r\nvoid EnginePrototype::CKLBTask::setPause(bool bPause,bool bRecursive)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_Task_setPause(EnginePrototype::GameObject::_acc_gCppObject$(),bPause,bRecursive);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::setPause$(bool bPause,bool bRecursive) { CHCKTHIS; return setPause(bPause,bRecursive); }\r\n\r\nvoid EnginePrototype::CKLBTask::setLifeTime(s32 mode,u32 time)\r\n{\r\n    if (_gm_timer$() == NULL)\r\n    {\r\n        EnginePrototype::_Delegate_Base_CallBack_inner24* cb = CS_NEW EnginePrototype::_DelegateI_CallBack_inner24<_anon_0>(CS_NEW _anon_0(this,mode,time), &_anon_0::_delegate);\r\n        _sm_timer$(CS_NEW EnginePrototype::CKLBIntervalTimer((EnginePrototype::CKLBTask*)NULL,time,cb,false,mode));\r\n        _ext_Task_interposeTimer(EnginePrototype::GameObject::_acc_gCppObject$(),_gm_timer$()->_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        _gm_timer$()->_acc_sInterval$(time);\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::setLifeTime$(s32 mode,u32 time) { CHCKTHIS; return setLifeTime(mode,time); }\r\n\r\nvoid EnginePrototype::CKLBTask::stageOnly()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_Task_setStageTask(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::stageOnly$() { CHCKTHIS; return stageOnly(); }\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::clearStage()\r\n{\r\n    _ext_Task_clearStageTask();\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBTask::setManagerPause(bool bPause)\r\n{\r\n    _ext_Task_setManagerPause(bPause);\r\n}\r\n\r\nEnginePrototype::CKLBTask::CKLBTask() { _ctor_CKLBTask(); }\r\n\r\ninline EnginePrototype::_Delegate_Base_onDieCallBack_inner28* EnginePrototype::CKLBTask::_sm_callback(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* _$value)  { return (EnginePrototype::_Delegate_Base_onDieCallBack_inner28*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_onDieCallBack_inner28* EnginePrototype::CKLBTask::_sm_callback$(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\ninline EnginePrototype::CKLBIntervalTimer* EnginePrototype::CKLBTask::_sm_timer(EnginePrototype::CKLBIntervalTimer* _$value)  { return (EnginePrototype::CKLBIntervalTimer*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_timer,_$value); }\r\ninline EnginePrototype::CKLBIntervalTimer* EnginePrototype::CKLBTask::_sm_timer$(EnginePrototype::CKLBIntervalTimer* _$value) { CHCKTHIS; return _sm_timer(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBTask::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBTask,EnginePrototype::GameObject);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBTask::_processGC() {\r\n    EnginePrototype::GameObject::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    if (m_timer) { System::Memory::pushList(m_timer,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::_releaseGC() {\r\n    EnginePrototype::GameObject::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n    if (m_timer && !m_timer->isFreed()) { m_timer->_removeRef((System::__GCObject**)&m_timer); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::_moveAlert(u32 offset) {\r\n    EnginePrototype::GameObject::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_timer) {\r\n      newPtr = (u8*)(&m_timer); oldPtr = newPtr - offset;\r\n      m_timer->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\nvoid EnginePrototype::CKLBTask::_anon_0::_ctor__anon_0() {\r\n}\r\n\r\nEnginePrototype::CKLBTask::_anon_0::_anon_0(EnginePrototype::CKLBTask* _this__,s32 mode,u32 time)\r\n{\r\n    _ctor__anon_0();\r\n    _s_this__(_this__);\r\n    mode = mode;\r\n    time = time;\r\n}\r\n\r\nvoid EnginePrototype::CKLBTask::_anon_0::_delegate(EnginePrototype::CKLBIntervalTimer* caller)\r\n{\r\n}\r\n\r\ninline void EnginePrototype::CKLBTask::_anon_0::_delegate$(EnginePrototype::CKLBIntervalTimer* caller) { CHCKTHIS; return _delegate(caller); }\r\n\r\nEnginePrototype::CKLBTask::_anon_0::_anon_0() { _ctor__anon_0(); }\r\n\r\ninline EnginePrototype::CKLBTask* EnginePrototype::CKLBTask::_anon_0::_s_this__(EnginePrototype::CKLBTask* _$value)  { return (EnginePrototype::CKLBTask*)System::__GCObject::_RefSetValue((System::__GCObject**)&_this__,_$value); }\r\ninline EnginePrototype::CKLBTask* EnginePrototype::CKLBTask::_anon_0::_s_this__$(EnginePrototype::CKLBTask* _$value) { CHCKTHIS; return _s_this__(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBTask::_anon_0::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(_anon_0,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBTask::_anon_0::_processGC() {\r\n    if (_this__) { System::Memory::pushList(_this__,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::_anon_0::_releaseGC() {\r\n    if (_this__ && !_this__->isFreed()) { _this__->_removeRef((System::__GCObject**)&_this__); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBTask::_anon_0::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (_this__) {\r\n      newPtr = (u8*)(&_this__); oldPtr = newPtr - offset;\r\n      _this__->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUICanvas'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUICanvas::_ctor_CKLBUICanvas() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_create(s32* pParent,u32 order,float x,float y,u32 vertexMax,u32 indexMax)\r\n{\r\n    return CKLBUICanvas_create(pParent,order,x,y,vertexMax,indexMax);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_getOrder(s32* p)\r\n{\r\n    return CKLBUICanvas_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUICanvas_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_getIdxMax(s32* p)\r\n{\r\n    return CKLBUICanvas_getIdxMax(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_addResource(s32* p,s32* asset)\r\n{\r\n    return CKLBUICanvas_addResource(p,asset);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_setFreeze(s32* p,bool freeze)\r\n{\r\n    CKLBUICanvas_setFreeze(p,freeze);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_drawImage(s32* p,float x,float y,u32 idx,u32 color)\r\n{\r\n    CKLBUICanvas_drawImage(p,x,y,idx,color);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_drawImageScale(s32* p,float x,float y,float scale,u32 idx,u32 color)\r\n{\r\n    CKLBUICanvas_drawImageScale(p,x,y,scale,idx,color);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_fillRect(s32* p,float x,float y,float w,float h,u32 color)\r\n{\r\n    CKLBUICanvas_fillRect(p,x,y,w,h,color);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_startDynamicSection(s32* p,u32 idx)\r\n{\r\n    CKLBUICanvas_startDynamicSection(p,idx);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_endDynamicSection(s32* p,u32 idx)\r\n{\r\n    CKLBUICanvas_endDynamicSection(p,idx);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_dynamicSectionTranslate(s32* p,u32 idx,float deltaX,float deltaY)\r\n{\r\n    CKLBUICanvas_dynamicSectionTranslate(p,idx,deltaX,deltaY);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUICanvas::_ext_CKLBUICanvas_dynamicSectionColor(s32* p,u32 idx,u32 color)\r\n{\r\n    CKLBUICanvas_dynamicSectionColor(p,idx,color);\r\n}\r\n\r\nEnginePrototype::CKLBUICanvas::CKLBUICanvas(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 vertexMax,u32 indexMax,EnginePrototype::_Delegate_Base_CallBack_inner29* onDrawCallBack) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUICanvas();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUICanvas_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,vertexMax,indexMax);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(onDrawCallBack);\r\n}\r\n\r\nEnginePrototype::CKLBUICanvas::CKLBUICanvas() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUICanvas();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUICanvas::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerV_inner0<CKLBUICanvas>(this,&CKLBUICanvas::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUICanvas::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner29*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUICanvas::callBackFunction()\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::callBackFunction$() { CHCKTHIS; return callBackFunction(); }\r\n\r\nbool EnginePrototype::CKLBUICanvas::addResource(System::String* asset)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        bool res = _ext_CKLBUICanvas_addResource(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(asset));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        return res;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUICanvas::addResource$(System::String* asset) { CHCKTHIS; return addResource(asset); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::drawImage(float x,float y,u32 idx,u32 color)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_drawImage(EnginePrototype::GameObject::_acc_gCppObject$(),x,y,idx,color);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::drawImage$(float x,float y,u32 idx,u32 color) { CHCKTHIS; return drawImage(x,y,idx,color); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::drawImageScale(float x,float y,float scale,u32 idx,u32 color)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_drawImageScale(EnginePrototype::GameObject::_acc_gCppObject$(),x,y,scale,idx,color);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::drawImageScale$(float x,float y,float scale,u32 idx,u32 color) { CHCKTHIS; return drawImageScale(x,y,scale,idx,color); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::fillRect(float x,float y,float w,float h,u32 color)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_fillRect(EnginePrototype::GameObject::_acc_gCppObject$(),x,y,w,h,color);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::fillRect$(float x,float y,float w,float h,u32 color) { CHCKTHIS; return fillRect(x,y,w,h,color); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::startDynamicSection(u32 idx)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_startDynamicSection(EnginePrototype::GameObject::_acc_gCppObject$(),idx);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::startDynamicSection$(u32 idx) { CHCKTHIS; return startDynamicSection(idx); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::endDynamicSection(u32 idx)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_endDynamicSection(EnginePrototype::GameObject::_acc_gCppObject$(),idx);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::endDynamicSection$(u32 idx) { CHCKTHIS; return endDynamicSection(idx); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::dynamicSectionTranslate(u32 idx,float deltaX,float deltaY)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_dynamicSectionTranslate(EnginePrototype::GameObject::_acc_gCppObject$(),idx,deltaX,deltaY);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::dynamicSectionTranslate$(u32 idx,float deltaX,float deltaY) { CHCKTHIS; return dynamicSectionTranslate(idx,deltaX,deltaY); }\r\n\r\nvoid EnginePrototype::CKLBUICanvas::dynamicSectionColor(u32 idx,u32 color)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_dynamicSectionColor(EnginePrototype::GameObject::_acc_gCppObject$(),idx,color);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUICanvas::dynamicSectionColor$(u32 idx,u32 color) { CHCKTHIS; return dynamicSectionColor(idx,color); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner29* EnginePrototype::CKLBUICanvas::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner29* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner29*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner29* EnginePrototype::CKLBUICanvas::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner29* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUICanvas::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUICanvas_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUICanvas::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUICanvas::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUICanvas::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline u32 EnginePrototype::CKLBUICanvas::_acc_gIdxMax(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUICanvas_getIdxMax(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUICanvas::_acc_gIdxMax$() { CHCKTHIS; return _acc_gIdxMax(); }\r\n\r\ninline bool EnginePrototype::CKLBUICanvas::_acc_sFreeze(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUICanvas_setFreeze(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUICanvas::_acc_sFreeze$(bool value)\t\t{ CHCKTHIS; return _acc_sFreeze(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUICanvas::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUICanvas,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUICanvas::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUICanvas::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUICanvas::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIClip'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIClip::_ctor_CKLBUIClip() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_create(s32* pParent,u32 baseOrder,u32 maxOrder,float x,float y,float clipWidth,float clipHeight)\r\n{\r\n    return CKLBUIClip_create(pParent,baseOrder,maxOrder,x,y,clipWidth,clipHeight);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_getOrder(s32* p)\r\n{\r\n    return CKLBUIClip_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIClip_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_getMaxOdr(s32* p)\r\n{\r\n    return CKLBUIClip_getMaxOdr(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_setMaxOdr(s32* p,u32 maxodr)\r\n{\r\n    CKLBUIClip_setMaxOdr(p,maxodr);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_getWidth(s32* p)\r\n{\r\n    return CKLBUIClip_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_setWidth(s32* p,float width)\r\n{\r\n    CKLBUIClip_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_getHeight(s32* p)\r\n{\r\n    return CKLBUIClip_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_setHeight(s32* p,float height)\r\n{\r\n    CKLBUIClip_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_setPosition(s32* p,float x,float y)\r\n{\r\n    CKLBUIClip_setPosition(p,x,y);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIClip::_ext_CKLBUIClip_setSize(s32* p,float width,float height)\r\n{\r\n    CKLBUIClip_setSize(p,width,height);\r\n}\r\n\r\nEnginePrototype::CKLBUIClip::CKLBUIClip(EnginePrototype::CKLBUITask* parent,u32 baseOrder,u32 maxOrder,float x,float y,float clipWidth,float clipHeight) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIClip();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIClip_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),baseOrder,maxOrder,x,y,clipWidth,clipHeight);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIClip::CKLBUIClip() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIClip();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIClip::getSize(EnginePrototype::FSize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIClip_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIClip_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIClip::getSize$(EnginePrototype::FSize& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIClip::setSize(EnginePrototype::FSize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setSize(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIClip::setSize$(EnginePrototype::FSize size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIClip::setSize(float width,float height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setSize(EnginePrototype::GameObject::_acc_gCppObject$(),width,height);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIClip::setSize$(float width,float height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIClip::setPosition(float x,float y)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setPosition(EnginePrototype::GameObject::_acc_gCppObject$(),x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIClip::setPosition$(float x,float y) { CHCKTHIS; return setPosition(x,y); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIClip_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_gMaxOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIClip_getMaxOdr(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_gMaxOrder$() { CHCKTHIS; return _acc_gMaxOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_sMaxOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setMaxOdr(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIClip::_acc_sMaxOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sMaxOrder(value); }\r\ninline float EnginePrototype::CKLBUIClip::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIClip_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIClip::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline float EnginePrototype::CKLBUIClip::_acc_sWidth(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIClip::_acc_sWidth$(float value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline float EnginePrototype::CKLBUIClip::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIClip_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIClip::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline float EnginePrototype::CKLBUIClip::_acc_sHeight(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIClip_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIClip::_acc_sHeight$(float value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIClip::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIClip,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIClip::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIClip::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIClip::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIControl'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIControl::_ctor_CKLBUIControl() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIControl::_ext_CKLBUIControl_create(s32* pParent)\r\n{\r\n    return CKLBUIControl_create(pParent);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIControl::_ext_CKLBUIControl_setGroup(s32* p,s32* groupName)\r\n{\r\n    return CKLBUIControl_setGroup(p,groupName);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIControl::_ext_CKLBUIControl_setMask(s32* p,u16 mask)\r\n{\r\n    CKLBUIControl_setMask(p,mask);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIControl::_ext_CKLBUIControl_lock(s32* p,bool lockMode)\r\n{\r\n    CKLBUIControl_lock(p,lockMode);\r\n}\r\n\r\nEnginePrototype::CKLBUIControl::CKLBUIControl(EnginePrototype::CKLBTask* parent,EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* onClickCallBack,EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* onDragCallBack) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIControl();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIControl_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_onDragCallBack$(onDragCallBack);\r\n    _sm_onClickCallBack$(onClickCallBack);\r\n}\r\n\r\nEnginePrototype::CKLBUIControl::CKLBUIControl() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIControl();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUIIII_inner15<CKLBUIControl>(this,&CKLBUIControl::onDragCallBackFunction),0);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUFF_inner12<CKLBUIControl>(this,&CKLBUIControl::onPinchCallBackFunction),1);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerII_inner1<CKLBUIControl>(this,&CKLBUIControl::onClickCallBackFunction),2);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerII_inner1<CKLBUIControl>(this,&CKLBUIControl::onDblClickCallBackFunction),3);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUII_inner14<CKLBUIControl>(this,&CKLBUIControl::onLongTapCallBackFunction),4);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    if (delegateName->Equals(_$_cteStr67Obj))\r\n    {\r\n        _sm_onDragCallBack$((EnginePrototype::_Delegate_Base_OnDragCallBack_inner32*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr68Obj))\r\n    {\r\n        _sm_onPinchCallBack$((EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr69Obj))\r\n    {\r\n        _sm_onClickCallBack$((EnginePrototype::_Delegate_Base_OnClickCallBack_inner30*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr70Obj))\r\n    {\r\n        _sm_onDblClickCallBack$((EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr71Obj))\r\n    {\r\n        _sm_onLongTapCallBack$((EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34*)anyDelegate);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr57Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::onClickCallBackFunction(s32 x,s32 y)\r\n{\r\n    if (_gm_onClickCallBack$() != NULL)\r\n    {\r\n        _gm_onClickCallBack$()->call$(this,x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::onClickCallBackFunction$(s32 x,s32 y) { CHCKTHIS; return onClickCallBackFunction(x,y); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::onDragCallBackFunction(u32 mode,s32 x,s32 y,s32 mvX,s32 mvY)\r\n{\r\n    if (_gm_onDragCallBack$() != NULL)\r\n    {\r\n        _gm_onDragCallBack$()->call$(this,(EMODE)mode,x,y,mvX,mvY);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::onDragCallBackFunction$(u32 mode,s32 x,s32 y,s32 mvX,s32 mvY) { CHCKTHIS; return onDragCallBackFunction(mode,x,y,mvX,mvY); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::onPinchCallBackFunction(u32 mode,float pinch,float rotation)\r\n{\r\n    if (_gm_onPinchCallBack$() != NULL)\r\n    {\r\n        _gm_onPinchCallBack$()->call$(this,(EMODE)mode,pinch,rotation);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::onPinchCallBackFunction$(u32 mode,float pinch,float rotation) { CHCKTHIS; return onPinchCallBackFunction(mode,pinch,rotation); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::onDblClickCallBackFunction(s32 x,s32 y)\r\n{\r\n    if (_gm_onDblClickCallBack$() != NULL)\r\n    {\r\n        _gm_onDblClickCallBack$()->call$(this,x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::onDblClickCallBackFunction$(s32 x,s32 y) { CHCKTHIS; return onDblClickCallBackFunction(x,y); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::onLongTapCallBackFunction(u32 elapsedTime,s32 x,s32 y)\r\n{\r\n    if (_gm_onLongTapCallBack$() != NULL)\r\n    {\r\n        _gm_onLongTapCallBack$()->call$(this,elapsedTime,x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::onLongTapCallBackFunction$(u32 elapsedTime,s32 x,s32 y) { CHCKTHIS; return onLongTapCallBackFunction(elapsedTime,x,y); }\r\n\r\nbool EnginePrototype::CKLBUIControl::setGroup(System::String* groupName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIControl_setGroup(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(groupName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIControl::setGroup$(System::String* groupName) { CHCKTHIS; return setGroup(groupName); }\r\n\r\nvoid EnginePrototype::CKLBUIControl::setMask(s32 mask)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIControl_setMask(EnginePrototype::GameObject::_acc_gCppObject$(),(u16)mask);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::setMask$(s32 mask) { CHCKTHIS; return setMask(mask); }\r\n\r\nvoid EnginePrototype::CKLBUIControl::setLock(bool lockBool)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIControl_lock(EnginePrototype::GameObject::_acc_gCppObject$(),lockBool);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIControl::setLock$(bool lockBool) { CHCKTHIS; return setLock(lockBool); }\r\n\r\ninline EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* EnginePrototype::CKLBUIControl::_sm_onDragCallBack(EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* _$value)  { return (EnginePrototype::_Delegate_Base_OnDragCallBack_inner32*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_onDragCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* EnginePrototype::CKLBUIControl::_sm_onDragCallBack$(EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* _$value) { CHCKTHIS; return _sm_onDragCallBack(_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* EnginePrototype::CKLBUIControl::_sm_onPinchCallBack(EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* _$value)  { return (EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_onPinchCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* EnginePrototype::CKLBUIControl::_sm_onPinchCallBack$(EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* _$value) { CHCKTHIS; return _sm_onPinchCallBack(_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* EnginePrototype::CKLBUIControl::_sm_onClickCallBack(EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* _$value)  { return (EnginePrototype::_Delegate_Base_OnClickCallBack_inner30*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_onClickCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* EnginePrototype::CKLBUIControl::_sm_onClickCallBack$(EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* _$value) { CHCKTHIS; return _sm_onClickCallBack(_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* EnginePrototype::CKLBUIControl::_sm_onDblClickCallBack(EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* _$value)  { return (EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_onDblClickCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* EnginePrototype::CKLBUIControl::_sm_onDblClickCallBack$(EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* _$value) { CHCKTHIS; return _sm_onDblClickCallBack(_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* EnginePrototype::CKLBUIControl::_sm_onLongTapCallBack(EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* _$value)  { return (EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_onLongTapCallBack,_$value); }\r\ninline EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* EnginePrototype::CKLBUIControl::_sm_onLongTapCallBack$(EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* _$value) { CHCKTHIS; return _sm_onLongTapCallBack(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIControl::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIControl,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIControl::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_onDragCallBack) { System::Memory::pushList(m_onDragCallBack,0); }\r\n    if (m_onPinchCallBack) { System::Memory::pushList(m_onPinchCallBack,0); }\r\n    if (m_onClickCallBack) { System::Memory::pushList(m_onClickCallBack,0); }\r\n    if (m_onDblClickCallBack) { System::Memory::pushList(m_onDblClickCallBack,0); }\r\n    if (m_onLongTapCallBack) { System::Memory::pushList(m_onLongTapCallBack,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_onDragCallBack && !m_onDragCallBack->isFreed()) { m_onDragCallBack->_removeRef((System::__GCObject**)&m_onDragCallBack); }\r\n    if (m_onPinchCallBack && !m_onPinchCallBack->isFreed()) { m_onPinchCallBack->_removeRef((System::__GCObject**)&m_onPinchCallBack); }\r\n    if (m_onClickCallBack && !m_onClickCallBack->isFreed()) { m_onClickCallBack->_removeRef((System::__GCObject**)&m_onClickCallBack); }\r\n    if (m_onDblClickCallBack && !m_onDblClickCallBack->isFreed()) { m_onDblClickCallBack->_removeRef((System::__GCObject**)&m_onDblClickCallBack); }\r\n    if (m_onLongTapCallBack && !m_onLongTapCallBack->isFreed()) { m_onLongTapCallBack->_removeRef((System::__GCObject**)&m_onLongTapCallBack); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIControl::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_onDragCallBack) {\r\n      newPtr = (u8*)(&m_onDragCallBack); oldPtr = newPtr - offset;\r\n      m_onDragCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_onPinchCallBack) {\r\n      newPtr = (u8*)(&m_onPinchCallBack); oldPtr = newPtr - offset;\r\n      m_onPinchCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_onClickCallBack) {\r\n      newPtr = (u8*)(&m_onClickCallBack); oldPtr = newPtr - offset;\r\n      m_onClickCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_onDblClickCallBack) {\r\n      newPtr = (u8*)(&m_onDblClickCallBack); oldPtr = newPtr - offset;\r\n      m_onDblClickCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_onLongTapCallBack) {\r\n      newPtr = (u8*)(&m_onLongTapCallBack); oldPtr = newPtr - offset;\r\n      m_onLongTapCallBack->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIDebugItem'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIDebugItem::_ctor_CKLBUIDebugItem() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_create(s32* pParent,u32 order,float x,float y,u32 argb,s32* font,u32 size,s32* text,u32 id)\r\n{\r\n    return CKLBUIDebugItem_create(pParent,order,x,y,argb,font,size,text,id);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_getOrder(s32* p)\r\n{\r\n    return CKLBUIDebugItem_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIDebugItem_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_getColor(s32* p)\r\n{\r\n    return CKLBUIDebugItem_getColor(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_setColor(s32* p,u32 order)\r\n{\r\n    CKLBUIDebugItem_setColor(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_getFont(s32* p)\r\n{\r\n    return CKLBUIDebugItem_getFont(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_setFont(s32* p,s32* font)\r\n{\r\n    CKLBUIDebugItem_setFont(p,font);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_getSize(s32* p)\r\n{\r\n    return CKLBUIDebugItem_getSize(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_setSize(s32* p,u32 order)\r\n{\r\n    CKLBUIDebugItem_setSize(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_getText(s32* p)\r\n{\r\n    return CKLBUIDebugItem_getText(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_ext_CKLBUIDebugItem_setText(s32* p,s32* text)\r\n{\r\n    CKLBUIDebugItem_setText(p,text);\r\n}\r\n\r\nEnginePrototype::CKLBUIDebugItem::CKLBUIDebugItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 argb,System::String* font_name,u32 font_size,System::String* text,u32 cmdID,EnginePrototype::_Delegate_Base_CallBack_inner35* callback) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIDebugItem();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIDebugItem_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,argb,System::__MarshallingUtils::NativeUtf8FromString(font_name),font_size,System::__MarshallingUtils::NativeUtf8FromString(text),cmdID);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUIDebugItem::CKLBUIDebugItem() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIDebugItem();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDebugItem::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerU_inner10<CKLBUIDebugItem>(this,&CKLBUIDebugItem::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDebugItem::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDebugItem::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner35*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDebugItem::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDebugItem::callBackFunction(u32 cmdID)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,cmdID);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDebugItem::callBackFunction$(u32 cmdID) { CHCKTHIS; return callBackFunction(cmdID); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner35* EnginePrototype::CKLBUIDebugItem::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner35* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner35*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner35* EnginePrototype::CKLBUIDebugItem::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner35* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIDebugItem_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDebugItem_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_gFont(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIDebugItem_getFont(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_gFont$() { CHCKTHIS; return _acc_gFont(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_sFont(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDebugItem_setFont(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_sFont$(System::String* value)\t\t{ CHCKTHIS; return _acc_sFont(value); }\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_gSize(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIDebugItem_getSize(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_gSize$() { CHCKTHIS; return _acc_gSize(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_sSize(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDebugItem_setSize(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_sSize$(u32 value)\t\t{ CHCKTHIS; return _acc_sSize(value); }\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_gTextArgb(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIDebugItem_getColor(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_gTextArgb$() { CHCKTHIS; return _acc_gTextArgb(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_sTextArgb(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDebugItem_setColor(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIDebugItem::_acc_sTextArgb$(u32 value)\t\t{ CHCKTHIS; return _acc_sTextArgb(value); }\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_gText(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIDebugItem_getText(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_gText$() { CHCKTHIS; return _acc_gText(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_sText(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDebugItem_setText(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIDebugItem::_acc_sText$(System::String* value)\t\t{ CHCKTHIS; return _acc_sText(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIDebugItem::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIDebugItem,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIDebugItem::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDebugItem::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIDragIcon'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIDragIcon::_ctor_CKLBUIDragIcon() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_create(s32* pParent,u32 order,float x,float y,EnginePrototype::Area_inner3& tap_area,s32* asset,s32* drag_asset,s32 drag_order_offset,float drag_alpha,float center_x,float center_y,u32 flags)\r\n{\r\n    return CKLBUIDragIcon_create(pParent,order,x,y,(s32*)&tap_area + 1,asset,drag_asset,drag_order_offset,drag_alpha,center_x,center_y,flags);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getOrder(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getOrder(p);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getAsset(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getAsset(p);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getDrag(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getDrag(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getFlags(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getFlags(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_setFlags(s32* p,u32 flag)\r\n{\r\n    CKLBUIDragIcon_setFlags(p,flag);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getEnable(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getEnable(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_setEnable(s32* p,bool enable)\r\n{\r\n    CKLBUIDragIcon_setEnable(p,enable);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getDragScaleX(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getDragScaleX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_setDragScaleX(s32* p,float x)\r\n{\r\n    CKLBUIDragIcon_setDragScaleX(p,x);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_getDragScaleY(s32* p)\r\n{\r\n    return CKLBUIDragIcon_getDragScaleY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_setDragScaleY(s32* p,float y)\r\n{\r\n    CKLBUIDragIcon_setDragScaleY(p,y);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_ext_CKLBUIDragIcon_dragArea(s32* p,EnginePrototype::Area_inner3& area)\r\n{\r\n    CKLBUIDragIcon_dragArea(p,(s32*)&area + 1);\r\n}\r\n\r\nEnginePrototype::CKLBUIDragIcon::CKLBUIDragIcon(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,EnginePrototype::Area_inner3& tap_area,System::String* asset,System::String* drag_asset,s32 drag_order_offset,float drag_alpha,float center_x,float center_y,EnginePrototype::_Delegate_Base_CallBack_inner36* callback,u32 flags) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIDragIcon();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIDragIcon_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,tap_area,System::__MarshallingUtils::NativeUtf8FromString(asset),System::__MarshallingUtils::NativeUtf8FromString(drag_asset),drag_order_offset,drag_alpha,center_x,center_y,flags);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUIDragIcon::CKLBUIDragIcon() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIDragIcon();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDragIcon::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUII_inner14<CKLBUIDragIcon>(this,&CKLBUIDragIcon::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDragIcon::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDragIcon::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner36*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDragIcon::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDragIcon::callBackFunction(u32 type,s32 x,s32 y)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,type,x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDragIcon::callBackFunction$(u32 type,s32 x,s32 y) { CHCKTHIS; return callBackFunction(type,x,y); }\r\n\r\nvoid EnginePrototype::CKLBUIDragIcon::dragArea(EnginePrototype::Area_inner3 area)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDragIcon_dragArea(EnginePrototype::GameObject::_acc_gCppObject$(),area);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIDragIcon::dragArea$(EnginePrototype::Area_inner3 area) { CHCKTHIS; return dragArea(area); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner36* EnginePrototype::CKLBUIDragIcon::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner36* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner36*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner36* EnginePrototype::CKLBUIDragIcon::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner36* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIDragIcon::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIDragIcon_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIDragIcon::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIDragIcon::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIDragIcon_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIDragIcon::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIDragIcon::_acc_gDragAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIDragIcon_getDrag(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIDragIcon::_acc_gDragAsset$() { CHCKTHIS; return _acc_gDragAsset(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIDragIcon::_acc_gFlags(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return (EFLAGS)_ext_CKLBUIDragIcon_getFlags(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIDragIcon::_acc_gFlags$() { CHCKTHIS; return _acc_gFlags(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIDragIcon::_acc_sFlags(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDragIcon_setFlags(EnginePrototype::GameObject::_acc_gCppObject$(),(u32)value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIDragIcon::_acc_sFlags$(s32 value)\t\t{ CHCKTHIS; return _acc_sFlags(value); }\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_gDragScaleX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIDragIcon_getDragScaleX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_gDragScaleX$() { CHCKTHIS; return _acc_gDragScaleX(); }\r\n\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_sDragScaleX(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDragIcon_setDragScaleX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_sDragScaleX$(float value)\t\t{ CHCKTHIS; return _acc_sDragScaleX(value); }\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_gDragScaleY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIDragIcon_getDragScaleY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_gDragScaleY$() { CHCKTHIS; return _acc_gDragScaleY(); }\r\n\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_sDragScaleY(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDragIcon_setDragScaleY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIDragIcon::_acc_sDragScaleY$(float value)\t\t{ CHCKTHIS; return _acc_sDragScaleY(value); }\r\ninline bool EnginePrototype::CKLBUIDragIcon::_acc_gEnable(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIDragIcon_getEnable(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIDragIcon::_acc_gEnable$() { CHCKTHIS; return _acc_gEnable(); }\r\n\r\ninline bool EnginePrototype::CKLBUIDragIcon::_acc_sEnable(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIDragIcon_setEnable(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIDragIcon::_acc_sEnable$(bool value)\t\t{ CHCKTHIS; return _acc_sEnable(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIDragIcon::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIDragIcon,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIDragIcon::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIDragIcon::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'Area_inner3'\r\n//=============================\r\n\r\nvoid EnginePrototype::Area_inner3::_ctor_Area_inner3() {\r\n}\r\n\r\nEnginePrototype::Area_inner3::Area_inner3(s32 _x,s32 _y,s32 _width,s32 _height)\r\n{\r\n    _ctor_Area_inner3();\r\n    _sx$(_x);\r\n    _sy$(_y);\r\n    _swidth$(_width);\r\n    _sheight$(_height);\r\n}\r\n\r\nvoid EnginePrototype::Area_inner3::setValues(s32 _x,s32 _y,s32 _width,s32 _height)\r\n{\r\n    _sx$(_x);\r\n    _sy$(_y);\r\n    _swidth$(_width);\r\n    _sheight$(_height);\r\n}\r\n\r\ninline void EnginePrototype::Area_inner3::setValues$(s32 _x,s32 _y,s32 _width,s32 _height) { CHCKTHIS; return setValues(_x,_y,_width,_height); }\r\n\r\nEnginePrototype::Area_inner3::Area_inner3() { _ctor_Area_inner3(); }\r\n\r\n\r\ninline u32 EnginePrototype::Area_inner3::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\ninline void EnginePrototype::Area_inner3::_releaseGC() {\r\n}\r\ninline void* EnginePrototype::Area_inner3::_RefSetValue(void* newStruct) {\r\n    Area_inner3* pStruct = (Area_inner3*)newStruct;\r\n    this->x = pStruct->x;\r\n    this->y = pStruct->y;\r\n    this->width = pStruct->width;\r\n    this->height = pStruct->height;\r\n    return newStruct;\r\n}\r\ninline void EnginePrototype::Area_inner3::_moveAlert(u32 offset) {\r\n}\r\ninline EnginePrototype::Area_inner3& EnginePrototype::Area_inner3::__registerByRef(EnginePrototype::Area_inner3& m) {\r\n    return m;\r\n}\r\n\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIForm'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIForm::_ctor_CKLBUIForm() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_create(s32* pParent,u32 order,float x,float y,bool bAssetFile,s32* asset,bool bExclusive,bool modal,bool urgent)\r\n{\r\n    return CKLBUIForm_create(pParent,order,x,y,bAssetFile,asset,bExclusive,modal,urgent);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_getAsset(s32* p)\r\n{\r\n    return CKLBUIForm_getAsset(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_getOrder(s32* p)\r\n{\r\n    return CKLBUIForm_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_getExclusive(s32* p)\r\n{\r\n    return CKLBUIForm_getExclusive(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_setExclusive(s32* p,bool exclusive)\r\n{\r\n    CKLBUIForm_setExclusive(p,exclusive);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_getIsFile(s32* p)\r\n{\r\n    return CKLBUIForm_getIsFile(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_setEnable(s32* p,bool isEnabled)\r\n{\r\n    CKLBUIForm_setEnable(p,isEnabled);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_existNode(s32* p,s32* name)\r\n{\r\n    return CKLBUIForm_existNode(p,name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_inputEnable(s32* p,bool bEnable)\r\n{\r\n    CKLBUIForm_inputEnable(p,bEnable);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_animation(s32* p,s32* animname,bool blend)\r\n{\r\n    return CKLBUIForm_animation(p,animname,blend);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_animEnter(s32* p)\r\n{\r\n    return CKLBUIForm_animEnter(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_animLeave(s32* p)\r\n{\r\n    return CKLBUIForm_animLeave(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_isAnim(s32* p,s32* name)\r\n{\r\n    return CKLBUIForm_isAnim(p,name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_skipAnim(s32* p,s32* name)\r\n{\r\n    return CKLBUIForm_skipAnim(p,name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_setGroup(s32* p,s32* groupName)\r\n{\r\n    return CKLBUIForm_setGroup(p,groupName);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIForm::_ext_CKLBUIForm_setGlobalVolume(s32* p,float volume)\r\n{\r\n    CKLBUIForm_setGlobalVolume(p,volume);\r\n}\r\n\r\nEnginePrototype::CKLBUIForm::CKLBUIForm(EnginePrototype::CKLBUITask* parent,u32 order,s32 x,s32 y,bool assetFile,System::String* asset_name,bool bExclusive,bool modal,bool urgent) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIForm();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIForm_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,assetFile,System::__MarshallingUtils::NativeUtf8FromString(asset_name),bExclusive,modal,urgent);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIForm::CKLBUIForm() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIForm();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIForm::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerSII_inner5<CKLBUIForm>(this,&CKLBUIForm::selectableCallbackFunction),0);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerSU_inner6<CKLBUIForm>(this,&CKLBUIForm::animCallBackFunction),4);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIForm::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    if (delegateName->Equals(_$_cteStr75Obj))\r\n    {\r\n        _sm_selectableCallback$((EnginePrototype::_Delegate_Base_SelectableCallBack_inner37*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr76Obj))\r\n    {\r\n        _sm_animCallback$((EnginePrototype::_Delegate_Base_AnimCallBack_inner38*)anyDelegate);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr57Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIForm::animCallBackFunction(s32* name,u32 id)\r\n{\r\n    if (_gm_animCallback$() != NULL)\r\n    {\r\n        _gm_animCallback$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(name),id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::animCallBackFunction$(s32* name,u32 id) { CHCKTHIS; return animCallBackFunction(name,id); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIForm::selectableCallbackFunction(s32* name,s32 type,s32 param)\r\n{\r\n    if (_gm_selectableCallback$() != NULL)\r\n    {\r\n        _gm_selectableCallback$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(name),type,param);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::selectableCallbackFunction$(s32* name,s32 type,s32 param) { CHCKTHIS; return selectableCallbackFunction(name,type,param); }\r\n\r\nvoid EnginePrototype::CKLBUIForm::setEnabled(bool isEnabled)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIForm_setEnable(EnginePrototype::GameObject::_acc_gCppObject$(),isEnabled);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::setEnabled$(bool isEnabled) { CHCKTHIS; return setEnabled(isEnabled); }\r\n\r\nbool EnginePrototype::CKLBUIForm::existNode(System::String* name)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_existNode(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(name));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::existNode$(System::String* name) { CHCKTHIS; return existNode(name); }\r\n\r\nvoid EnginePrototype::CKLBUIForm::inputEnable(bool bEnable)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIForm_inputEnable(EnginePrototype::GameObject::_acc_gCppObject$(),bEnable);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::inputEnable$(bool bEnable) { CHCKTHIS; return inputEnable(bEnable); }\r\n\r\nbool EnginePrototype::CKLBUIForm::animation(System::String* animationName,bool blend)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_animation(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName),blend);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::animation$(System::String* animationName,bool blend) { CHCKTHIS; return animation(animationName,blend); }\r\n\r\nbool EnginePrototype::CKLBUIForm::isRunningAnimation(System::String* animationName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_isAnim(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::isRunningAnimation$(System::String* animationName) { CHCKTHIS; return isRunningAnimation(animationName); }\r\n\r\nbool EnginePrototype::CKLBUIForm::skipAnim(System::String* animationName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_skipAnim(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::skipAnim$(System::String* animationName) { CHCKTHIS; return skipAnim(animationName); }\r\n\r\nbool EnginePrototype::CKLBUIForm::animEnter()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_animEnter(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::animEnter$() { CHCKTHIS; return animEnter(); }\r\n\r\nbool EnginePrototype::CKLBUIForm::animLeave()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_animLeave(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::animLeave$() { CHCKTHIS; return animLeave(); }\r\n\r\nbool EnginePrototype::CKLBUIForm::setGroup(System::String* groupName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_setGroup(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(groupName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::setGroup$(System::String* groupName) { CHCKTHIS; return setGroup(groupName); }\r\n\r\nvoid EnginePrototype::CKLBUIForm::setGlobalVolume(float volume)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIForm_setGlobalVolume(EnginePrototype::GameObject::_acc_gCppObject$(),volume);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIForm::setGlobalVolume$(float volume) { CHCKTHIS; return setGlobalVolume(volume); }\r\n\r\ninline EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* EnginePrototype::CKLBUIForm::_sm_selectableCallback(EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* _$value)  { return (EnginePrototype::_Delegate_Base_SelectableCallBack_inner37*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_selectableCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* EnginePrototype::CKLBUIForm::_sm_selectableCallback$(EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* _$value) { CHCKTHIS; return _sm_selectableCallback(_$value); }\r\ninline EnginePrototype::_Delegate_Base_AnimCallBack_inner38* EnginePrototype::CKLBUIForm::_sm_animCallback(EnginePrototype::_Delegate_Base_AnimCallBack_inner38* _$value)  { return (EnginePrototype::_Delegate_Base_AnimCallBack_inner38*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_animCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_AnimCallBack_inner38* EnginePrototype::CKLBUIForm::_sm_animCallback$(EnginePrototype::_Delegate_Base_AnimCallBack_inner38* _$value) { CHCKTHIS; return _sm_animCallback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIForm::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIForm::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIForm::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIForm_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIForm::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\ninline bool EnginePrototype::CKLBUIForm::_acc_gIsFile(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_getIsFile(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::_acc_gIsFile$() { CHCKTHIS; return _acc_gIsFile(); }\r\n\r\ninline bool EnginePrototype::CKLBUIForm::_acc_gExclusive(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIForm_getExclusive(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIForm::_acc_gExclusive$() { CHCKTHIS; return _acc_gExclusive(); }\r\n\r\ninline bool EnginePrototype::CKLBUIForm::_acc_sExclusive(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIForm_setExclusive(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIForm::_acc_sExclusive$(bool value)\t\t{ CHCKTHIS; return _acc_sExclusive(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIForm::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIForm,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIForm::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_selectableCallback) { System::Memory::pushList(m_selectableCallback,0); }\r\n    if (m_animCallback) { System::Memory::pushList(m_animCallback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIForm::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_selectableCallback && !m_selectableCallback->isFreed()) { m_selectableCallback->_removeRef((System::__GCObject**)&m_selectableCallback); }\r\n    if (m_animCallback && !m_animCallback->isFreed()) { m_animCallback->_removeRef((System::__GCObject**)&m_animCallback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIForm::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_selectableCallback) {\r\n      newPtr = (u8*)(&m_selectableCallback); oldPtr = newPtr - offset;\r\n      m_selectableCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_animCallback) {\r\n      newPtr = (u8*)(&m_animCallback); oldPtr = newPtr - offset;\r\n      m_animCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIFreeVertItem'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_ctor_CKLBUIFreeVertItem() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_create(s32* parent,u32 order,float x,float y,s32* asset,System::Array<float>* verticesArray)\r\n{\r\n    return CKLBUIFreeVertItem_create(parent,order,x,y,asset,verticesArray ? (float*)verticesArray->_getPArray() : NULL);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_getOrder(s32* p)\r\n{\r\n    return CKLBUIFreeVertItem_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIFreeVertItem_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_getAsset(s32* p)\r\n{\r\n    return CKLBUIFreeVertItem_getAsset(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_setVertices(s32* p,System::Array<float>* coord)\r\n{\r\n    CKLBUIFreeVertItem_setVertices(p,coord ? (float*)coord->_getPArray() : NULL);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_setColors(s32* p,System::Array<u32>* colors)\r\n{\r\n    CKLBUIFreeVertItem_setColors(p,colors ? (u32*)colors->_getPArray() : NULL);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_setVertCol(s32* p,s32 idx,u32 argb)\r\n{\r\n    CKLBUIFreeVertItem_setVertCol(p,idx,argb);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_ext_CKLBUIFreeVertItem_setUV(s32* p,System::Array<float>* uv)\r\n{\r\n    CKLBUIFreeVertItem_setUV(p,uv ? (float*)uv->_getPArray() : NULL);\r\n}\r\n\r\nEnginePrototype::CKLBUIFreeVertItem::CKLBUIFreeVertItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::String* asset,System::Array<float>* verticesArray) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIFreeVertItem();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIFreeVertItem_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,System::__MarshallingUtils::NativeUtf8FromString(asset),verticesArray);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIFreeVertItem::CKLBUIFreeVertItem() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIFreeVertItem();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIFreeVertItem::setVertices(System::Array<float>* coords)\r\n{\r\n    if (coords->_acc_gLength$() != 8)\r\n    THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr78Obj));\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIFreeVertItem_setVertices(EnginePrototype::GameObject::_acc_gCppObject$(),coords);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIFreeVertItem::setVertices$(System::Array<float>* coords) { CHCKTHIS; return setVertices(coords); }\r\n\r\nvoid EnginePrototype::CKLBUIFreeVertItem::setColors(System::Array<u32>* colors)\r\n{\r\n    if (colors->_acc_gLength$() != 4)\r\n    THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr79Obj));\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIFreeVertItem_setColors(EnginePrototype::GameObject::_acc_gCppObject$(),colors);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIFreeVertItem::setColors$(System::Array<u32>* colors) { CHCKTHIS; return setColors(colors); }\r\n\r\nvoid EnginePrototype::CKLBUIFreeVertItem::setVertCol(s32 idx,u32 argb)\r\n{\r\n    if (idx > 7)\r\n    THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr80Obj));\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIFreeVertItem_setVertCol(EnginePrototype::GameObject::_acc_gCppObject$(),idx,argb);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIFreeVertItem::setVertCol$(s32 idx,u32 argb) { CHCKTHIS; return setVertCol(idx,argb); }\r\n\r\nvoid EnginePrototype::CKLBUIFreeVertItem::setUv(System::Array<float>* uv)\r\n{\r\n    if (uv->_acc_gLength$() != 8)\r\n    THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr81Obj));\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIFreeVertItem_setUV(EnginePrototype::GameObject::_acc_gCppObject$(),uv);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIFreeVertItem::setUv$(System::Array<float>* uv) { CHCKTHIS; return setUv(uv); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIFreeVertItem::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIFreeVertItem_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIFreeVertItem::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIFreeVertItem::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIFreeVertItem_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIFreeVertItem::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline System::String* EnginePrototype::CKLBUIFreeVertItem::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIFreeVertItem_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIFreeVertItem::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIFreeVertItem::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIFreeVertItem,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIFreeVertItem::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIFreeVertItem::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIGroup'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIGroup::_ctor_CKLBUIGroup() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIGroup::_ext_CKLBUIGroup_create(s32* parent,float x,float y)\r\n{\r\n    return CKLBUIGroup_create(parent,x,y);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIGroup::_ext_CKLBUIGroup_setAnimCallback(s32* p,s32* callback)\r\n{\r\n    return CKLBUIGroup_setAnimCallback(p,callback);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIGroup::_ext_CKLBUIGroup_setAnimation(s32* p,s32* anim_name,bool blend)\r\n{\r\n    return CKLBUIGroup_setAnimation(p,anim_name,blend);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIGroup::_ext_CKLBUIGroup_isAnim(s32* p,s32* anim_name)\r\n{\r\n    return CKLBUIGroup_isAnim(p,anim_name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIGroup::_ext_CKLBUIGroup_skipAnim(s32* p,s32* anim_name)\r\n{\r\n    return CKLBUIGroup_skipAnim(p,anim_name);\r\n}\r\n\r\nEnginePrototype::CKLBUIGroup::CKLBUIGroup(EnginePrototype::CKLBUITask* parent,float x,float y) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIGroup();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIGroup_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),x,y);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIGroup::CKLBUIGroup() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIGroup();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIGroup::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerSU_inner6<CKLBUIGroup>(this,&CKLBUIGroup::animCallBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIGroup::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIGroup::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    if (delegateName->Equals(_$_cteStr76Obj))\r\n    {\r\n        _sm_animCallback$((EnginePrototype::_Delegate_Base_AnimCallBack_inner39*)anyDelegate);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr57Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIGroup::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIGroup::animCallBackFunction(s32* name,u32 id)\r\n{\r\n    if (_gm_animCallback$() != NULL)\r\n    {\r\n        _gm_animCallback$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(name),id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIGroup::animCallBackFunction$(s32* name,u32 id) { CHCKTHIS; return animCallBackFunction(name,id); }\r\n\r\nbool EnginePrototype::CKLBUIGroup::setAnimation(System::String* animationName,bool blendFlag)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIGroup_setAnimation(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName),blendFlag);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIGroup::setAnimation$(System::String* animationName,bool blendFlag) { CHCKTHIS; return setAnimation(animationName,blendFlag); }\r\n\r\nbool EnginePrototype::CKLBUIGroup::isRunningAnimation(System::String* animationName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIGroup_isAnim(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIGroup::isRunningAnimation$(System::String* animationName) { CHCKTHIS; return isRunningAnimation(animationName); }\r\n\r\nbool EnginePrototype::CKLBUIGroup::skipAnim(System::String* animationName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIGroup_skipAnim(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIGroup::skipAnim$(System::String* animationName) { CHCKTHIS; return skipAnim(animationName); }\r\n\r\ninline EnginePrototype::_Delegate_Base_AnimCallBack_inner39* EnginePrototype::CKLBUIGroup::_sm_animCallback(EnginePrototype::_Delegate_Base_AnimCallBack_inner39* _$value)  { return (EnginePrototype::_Delegate_Base_AnimCallBack_inner39*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_animCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_AnimCallBack_inner39* EnginePrototype::CKLBUIGroup::_sm_animCallback$(EnginePrototype::_Delegate_Base_AnimCallBack_inner39* _$value) { CHCKTHIS; return _sm_animCallback(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIGroup::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIGroup,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIGroup::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_animCallback) { System::Memory::pushList(m_animCallback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIGroup::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_animCallback && !m_animCallback->isFreed()) { m_animCallback->_removeRef((System::__GCObject**)&m_animCallback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIGroup::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_animCallback) {\r\n      newPtr = (u8*)(&m_animCallback); oldPtr = newPtr - offset;\r\n      m_animCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUILabel'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUILabel::_ctor_CKLBUILabel() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_create(s32* pParent,u32 order,float x,float y,u32 argb,s32* font,u32 size,s32* text,u32 align)\r\n{\r\n    return CKLBUILabel_create(pParent,order,x,y,argb,font,size,text,align);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_getOrder(s32* p)\r\n{\r\n    return CKLBUILabel_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUILabel_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_getAlign(s32* p)\r\n{\r\n    return CKLBUILabel_getAlign(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setAlign(s32* p,u32 align)\r\n{\r\n    CKLBUILabel_setAlign(p,align);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_getText(s32* p)\r\n{\r\n    return CKLBUILabel_getText(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setText(s32* p,s32* text)\r\n{\r\n    CKLBUILabel_setText(p,text);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_getColor(s32* p)\r\n{\r\n    return CKLBUILabel_getColor(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setColor(s32* p,u32 color)\r\n{\r\n    CKLBUILabel_setColor(p,color);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_getFont(s32* p)\r\n{\r\n    return CKLBUILabel_getFont(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setFont(s32* p,s32* font)\r\n{\r\n    CKLBUILabel_setFont(p,font);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_getFontSize(s32* p)\r\n{\r\n    return CKLBUILabel_getFontSize(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setFontSize(s32* p,u32 size)\r\n{\r\n    CKLBUILabel_setFontSize(p,size);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUILabel::_ext_CKLBUILabel_setPosition(s32* p,float x,float y)\r\n{\r\n    CKLBUILabel_setPosition(p,x,y);\r\n}\r\n\r\nEnginePrototype::CKLBUILabel::CKLBUILabel(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 argb,System::String* font_name,u32 font_size,System::String* text,s32 align) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUILabel();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUILabel_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,argb,System::__MarshallingUtils::NativeUtf8FromString(font_name),font_size,System::__MarshallingUtils::NativeUtf8FromString(text),(u32)align);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUILabel::CKLBUILabel() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUILabel();\r\n    System::Console::WriteLine(_$_cteStr84Obj);\r\n}\r\n\r\nvoid EnginePrototype::CKLBUILabel::setFont(System::String* name,u32 size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setFont(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(name));\r\n        _ext_CKLBUILabel_setFontSize(EnginePrototype::GameObject::_acc_gCppObject$(),size);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUILabel::setFont$(System::String* name,u32 size) { CHCKTHIS; return setFont(name,size); }\r\n\r\nvoid EnginePrototype::CKLBUILabel::setPosition(float x,float y)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setPosition(EnginePrototype::GameObject::_acc_gCppObject$(),x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUILabel::setPosition$(float x,float y) { CHCKTHIS; return setPosition(x,y); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUILabel_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_gFontName(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUILabel_getFont(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_gFontName$() { CHCKTHIS; return _acc_gFontName(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_sFontName(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setFont(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_sFontName$(System::String* value)\t\t{ CHCKTHIS; return _acc_sFontName(value); }\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_gFontSize(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUILabel_getFontSize(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_gFontSize$() { CHCKTHIS; return _acc_gFontSize(); }\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_sFontSize(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setFontSize(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_sFontSize$(u32 value)\t\t{ CHCKTHIS; return _acc_sFontSize(value); }\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_gTxtArgb(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUILabel_getColor(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_gTxtArgb$() { CHCKTHIS; return _acc_gTxtArgb(); }\r\n\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_sTxtArgb(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setColor(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUILabel::_acc_sTxtArgb$(u32 value)\t\t{ CHCKTHIS; return _acc_sTxtArgb(value); }\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_gText(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUILabel_getText(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_gText$() { CHCKTHIS; return _acc_gText(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_sText(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setText(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUILabel::_acc_sText$(System::String* value)\t\t{ CHCKTHIS; return _acc_sText(value); }\r\ninline s32 EnginePrototype::CKLBUILabel::_acc_gAlign(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return (EALIGN)_ext_CKLBUILabel_getAlign(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUILabel::_acc_gAlign$() { CHCKTHIS; return _acc_gAlign(); }\r\n\r\ninline s32 EnginePrototype::CKLBUILabel::_acc_sAlign(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUILabel_setAlign(EnginePrototype::GameObject::_acc_gCppObject$(),(u32)value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUILabel::_acc_sAlign$(s32 value)\t\t{ CHCKTHIS; return _acc_sAlign(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUILabel::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUILabel,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUILabel::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUILabel::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUILabel::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIList'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIList::_ctor_CKLBUIList() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIList::_ext_CKLBUIList_create(s32* pParent,u32 baseOrder,u32 maxOrder,float x,float y,float clipWidth,float clipHeight,s32 defaultLineStep,bool vertical,u32 optionalFlags)\r\n{\r\n    return CKLBUIList_create(pParent,baseOrder,maxOrder,x,y,clipWidth,clipHeight,defaultLineStep,vertical,optionalFlags);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getWidth(s32* p)\r\n{\r\n    return CKLBUIList_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setWidth(s32* p,u32 width)\r\n{\r\n    CKLBUIList_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getHeight(s32* p)\r\n{\r\n    return CKLBUIList_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setHeight(s32* p,u32 height)\r\n{\r\n    CKLBUIList_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getStepX(s32* p)\r\n{\r\n    return CKLBUIList_getStepX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setStepX(s32* p,s32 x)\r\n{\r\n    CKLBUIList_setStepX(p,x);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getStepY(s32* p)\r\n{\r\n    return CKLBUIList_getStepY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setStepY(s32* p,s32 y)\r\n{\r\n    CKLBUIList_setStepY(p,y);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getOrder(s32* p)\r\n{\r\n    return CKLBUIList_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIList_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getMaxOrder(s32* p)\r\n{\r\n    return CKLBUIList_getMaxOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setMaxOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIList_setMaxOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_getVertical(s32* p)\r\n{\r\n    return CKLBUIList_getVertical(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setVertical(s32* p,bool vertical)\r\n{\r\n    CKLBUIList_setVertical(p,vertical);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getItems(s32* p)\r\n{\r\n    return CKLBUIList_getItems(p);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getMarginTop(s32* p)\r\n{\r\n    return CKLBUIList_getMarginTop(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setMarginTop(s32* p,s32 top)\r\n{\r\n    CKLBUIList_setMarginTop(p,top);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_getMarginBottom(s32* p)\r\n{\r\n    return CKLBUIList_getMarginBottom(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setMarginBottom(s32* p,s32 bottom)\r\n{\r\n    CKLBUIList_setMarginBottom(p,bottom);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_getDefaultScroll(s32* p)\r\n{\r\n    return CKLBUIList_getDefaultScroll(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setDefaultScroll(s32* p,bool scroll)\r\n{\r\n    CKLBUIList_setDefaultScroll(p,scroll);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdItemRemove(s32* p,s32 idx)\r\n{\r\n    return CKLBUIList_cmdItemRemove(p,idx);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdItemMove(s32* p,s32 src,s32 dst)\r\n{\r\n    CKLBUIList_cmdItemMove(p,src,dst);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetMargin(s32* p,s32 top,s32 bottom)\r\n{\r\n    CKLBUIList_cmdSetMargin(p,top,bottom);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdGetPosition(s32* p)\r\n{\r\n    return CKLBUIList_cmdGetPosition(p);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetPosition(s32* p,s32 pos,s32 dir)\r\n{\r\n    return CKLBUIList_cmdSetPosition(p,pos,dir);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetItemID(s32* p,s32 index,s32 id)\r\n{\r\n    CKLBUIList_cmdSetItemID(p,index,id);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSearchID(s32* p,s32 id)\r\n{\r\n    return CKLBUIList_cmdSearchID(p,id);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetItemPos(s32* p,s32 mode,s32 idx,s32 offset)\r\n{\r\n    CKLBUIList_cmdSetItemPos(p,mode,idx,offset);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetLimitClip(s32* p,bool chklimit)\r\n{\r\n    CKLBUIList_cmdSetLimitClip(p,chklimit);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdGetLimit(s32* p)\r\n{\r\n    return CKLBUIList_cmdGetLimit(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetLimitArea(s32* p,s32 limitArea)\r\n{\r\n    return CKLBUIList_cmdSetLimitArea(p,limitArea);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdChangeStep(s32* p,s32 index,s32 step)\r\n{\r\n    CKLBUIList_cmdChangeStep(p,index,step);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdInputEnable(s32* p,bool enable)\r\n{\r\n    CKLBUIList_cmdInputEnable(p,enable);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdExistNode(s32* p,s32 index,s32* name)\r\n{\r\n    return CKLBUIList_cmdExistNode(p,index,name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdAnimationItem(s32* p,s32 index,s32* name,bool blend)\r\n{\r\n    return CKLBUIList_cmdAnimationItem(p,index,name,blend);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdAnimationAll(s32* p,s32* name,bool blend)\r\n{\r\n    return CKLBUIList_cmdAnimationAll(p,name,blend);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdItemAnimSkip(s32* p,s32 idx,s32* name)\r\n{\r\n    return CKLBUIList_cmdItemAnimSkip(p,idx,name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdAllAnimSkip(s32* p,s32* name)\r\n{\r\n    return CKLBUIList_cmdAllAnimSkip(p,name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetGroup(s32* p,s32* group_name)\r\n{\r\n    CKLBUIList_cmdSetGroup(p,group_name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setLoop(s32* p,bool mode)\r\n{\r\n    CKLBUIList_setLoop(p,mode);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetInitial(s32* p,s32 pos)\r\n{\r\n    return CKLBUIList_cmdSetInitial(p,pos);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_useScrollBar(s32* p,u32 order,bool side,s32 lineWeight,s32* image,s32 minSlenderSize,u32 colorNormal,u32 colorSelect,bool active,bool hideMode,bool shortHide)\r\n{\r\n    return CKLBUIList_useScrollBar(p,order,side,lineWeight,image,minSlenderSize,colorNormal,colorSelect,active,hideMode,shortHide);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdFWModeConfig(s32* p,s32 itemStep,s32 maxItems)\r\n{\r\n    CKLBUIList_cmdFWModeConfig(p,itemStep,maxItems);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetItemMode(s32* p,s32 itemMode)\r\n{\r\n    return CKLBUIList_cmdSetItemMode(p,itemMode);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdAddRecords(s32* p,s32 insIdx,s32* tpForm,s32* dbRecords,s32 step)\r\n{\r\n    return CKLBUIList_cmdAddRecords(p,insIdx,tpForm,dbRecords,step);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSelectScrMgr(s32* p,s32* name,System::Array<s32>* optParams,u32 nb)\r\n{\r\n    return CKLBUIList_cmdSelectScrMgr(p,name,optParams ? (s32*)optParams->_getPArray() : NULL,nb);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdSetClip(s32* p,u32 orderBegin,u32 orderEnd,s16 clipX,s16 clipY,s16 clipWidth,s16 clipHeight)\r\n{\r\n    CKLBUIList_cmdSetClip(p,orderBegin,orderEnd,clipX,clipY,clipWidth,clipHeight);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdItemAdd(s32* p,s32* name)\r\n{\r\n    return CKLBUIList_cmdItemAdd(p,name);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdItemAdd2(s32* p,s32* name,s32 step,s32 id)\r\n{\r\n    return CKLBUIList_cmdItemAdd2(p,name,step,id);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdInsertItem(s32* p,s32* name,s32 idx)\r\n{\r\n    return CKLBUIList_cmdInsertItem(p,name,idx);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdInsertItem2(s32* p,s32* name,s32 idx,s32 step,s32 id)\r\n{\r\n    return CKLBUIList_cmdInsertItem2(p,name,idx,step,id);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIList::_ext_CKLBUIList_cmdRemoveSelection(s32* p,System::Array<s32>* indexes,u32 nb)\r\n{\r\n    return CKLBUIList_cmdRemoveSelection(p,indexes ? (s32*)indexes->_getPArray() : NULL,nb);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIList::_ext_CKLBUIList_setDragRect(s32* p,s32 left,s32 top,s32 right,s32 bottom)\r\n{\r\n    CKLBUIList_setDragRect(p,left,top,right,bottom);\r\n}\r\n\r\nEnginePrototype::CKLBUIList::CKLBUIList(EnginePrototype::CKLBUITask* parent,u32 base_priority,u32 max_order,float x,float y,float clip_width,float clip_height,s32 default_line_step,EnginePrototype::_Delegate_Base_DragCallBack_inner41* callback,bool vertical,u32 option_flags) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIList();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIList_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),base_priority,max_order,x,y,clip_width,clip_height,default_line_step,vertical,option_flags);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_dragCallback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUIList::CKLBUIList() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIList();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUIIII_inner15<CKLBUIList>(this,&CKLBUIList::dragCallBackFunction),0);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUUII_inner17<CKLBUIList>(this,&CKLBUIList::limitCallBackFunction),1);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerII_inner1<CKLBUIList>(this,&CKLBUIList::dynamicCallBackFunction),2);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUI_inner13<CKLBUIList>(this,&CKLBUIList::scrollbarCallBackFunction),3);\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerSU_inner6<CKLBUIList>(this,&CKLBUIList::animCallBackFunction),4);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    if (delegateName->Equals(_$_cteStr86Obj))\r\n    {\r\n        _sm_limitCallback$((EnginePrototype::_Delegate_Base_LimitCallBack_inner40*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr87Obj))\r\n    {\r\n        _sm_dragCallback$((EnginePrototype::_Delegate_Base_DragCallBack_inner41*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr88Obj))\r\n    {\r\n        _sm_dynamicCallback$((EnginePrototype::_Delegate_Base_DynamicCallBack_inner42*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr76Obj))\r\n    {\r\n        _sm_animCallback$((EnginePrototype::_Delegate_Base_AnimCallBack_inner44*)anyDelegate);\r\n    }\r\n    else\r\n    if (delegateName->Equals(_$_cteStr89Obj))\r\n    {\r\n        _sm_scrollbarCallback$((EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43*)anyDelegate);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr57Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::dragCallBackFunction(u32 type,s32 x,s32 y,s32 param1,s32 param2)\r\n{\r\n    if (_gm_dragCallback$() != NULL)\r\n    {\r\n        _gm_dragCallback$()->call$(this,type,x,y,param1,param2);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::dragCallBackFunction$(u32 type,s32 x,s32 y,s32 param1,s32 param2) { CHCKTHIS; return dragCallBackFunction(type,x,y,param1,param2); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::limitCallBackFunction(u32 type,u32 itemCount,s32 listLength,s32 pos)\r\n{\r\n    if (_gm_limitCallback$() != NULL)\r\n    {\r\n        _gm_limitCallback$()->call$(this,type,itemCount,listLength,pos);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::limitCallBackFunction$(u32 type,u32 itemCount,s32 listLength,s32 pos) { CHCKTHIS; return limitCallBackFunction(type,itemCount,listLength,pos); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::dynamicCallBackFunction(s32 index,s32 id)\r\n{\r\n    if (_gm_dynamicCallback$() != NULL)\r\n    {\r\n        _gm_dynamicCallback$()->call$(this,index,id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::dynamicCallBackFunction$(s32 index,s32 id) { CHCKTHIS; return dynamicCallBackFunction(index,id); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::scrollbarCallBackFunction(u32 type,s32 pos)\r\n{\r\n    if (_gm_scrollbarCallback$() != NULL)\r\n    {\r\n        _gm_scrollbarCallback$()->call$(this,type,pos);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::scrollbarCallBackFunction$(u32 type,s32 pos) { CHCKTHIS; return scrollbarCallBackFunction(type,pos); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::animCallBackFunction(s32* name,u32 id)\r\n{\r\n    if (_gm_animCallback$() != NULL)\r\n    {\r\n        _gm_animCallback$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(name),id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::animCallBackFunction$(s32* name,u32 id) { CHCKTHIS; return animCallBackFunction(name,id); }\r\n\r\nvoid EnginePrototype::CKLBUIList::getSize(EnginePrototype::USize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIList_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIList_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::getSize$(EnginePrototype::USize& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setSize(EnginePrototype::USize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIList_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setSize$(EnginePrototype::USize size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setSize(u32 width,u32 height)\r\n{\r\n    _ext_CKLBUIList_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n    _ext_CKLBUIList_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setSize$(u32 width,u32 height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIList::itemAdd(System::String* asset)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdItemAdd(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(asset));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::itemAdd$(System::String* asset) { CHCKTHIS; return itemAdd(asset); }\r\n\r\nvoid EnginePrototype::CKLBUIList::itemAdd(System::String* asset,s32 step,s32 id)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdItemAdd2(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(asset),step,id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::itemAdd$(System::String* asset,s32 step,s32 id) { CHCKTHIS; return itemAdd(asset,step,id); }\r\n\r\nvoid EnginePrototype::CKLBUIList::itemInsert(System::String* asset,s32 index)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdInsertItem(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(asset),index);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::itemInsert$(System::String* asset,s32 index) { CHCKTHIS; return itemInsert(asset,index); }\r\n\r\nvoid EnginePrototype::CKLBUIList::itemInsert(System::String* asset,s32 index,s32 step,s32 id)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdInsertItem2(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(asset),index,step,id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::itemInsert$(System::String* asset,s32 index,s32 step,s32 id) { CHCKTHIS; return itemInsert(asset,index,step,id); }\r\n\r\nbool EnginePrototype::CKLBUIList::itemRemove(s32 index)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdItemRemove(EnginePrototype::GameObject::_acc_gCppObject$(),index);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::itemRemove$(s32 index) { CHCKTHIS; return itemRemove(index); }\r\n\r\nvoid EnginePrototype::CKLBUIList::itemMove(s32 src,s32 dst)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdItemMove(EnginePrototype::GameObject::_acc_gCppObject$(),src,dst);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::itemMove$(s32 src,s32 dst) { CHCKTHIS; return itemMove(src,dst); }\r\n\r\nvoid EnginePrototype::CKLBUIList::itemRemoveSelection(System::Array<s32>* indexes)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdRemoveSelection(EnginePrototype::GameObject::_acc_gCppObject$(),indexes,(u32)indexes->_acc_gLength$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::itemRemoveSelection$(System::Array<s32>* indexes) { CHCKTHIS; return itemRemoveSelection(indexes); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setMargin(s32 margin_top,s32 margin_bottom)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdSetMargin(EnginePrototype::GameObject::_acc_gCppObject$(),margin_top,margin_bottom);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setMargin$(s32 margin_top,s32 margin_bottom) { CHCKTHIS; return setMargin(margin_top,margin_bottom); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setItemPosition(s32 positionMode,s32 index,s32 offset)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdSetItemPos(EnginePrototype::GameObject::_acc_gCppObject$(),(s32)positionMode,index,offset);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setItemPosition$(s32 positionMode,s32 index,s32 offset) { CHCKTHIS; return setItemPosition(positionMode,index,offset); }\r\n\r\nvoid EnginePrototype::CKLBUIList::changeStep(s32 index,s32 newStep)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdChangeStep(EnginePrototype::GameObject::_acc_gCppObject$(),index,newStep);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::changeStep$(s32 index,s32 newStep) { CHCKTHIS; return changeStep(index,newStep); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setLimitClip(bool limitClipEnable)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdSetLimitClip(EnginePrototype::GameObject::_acc_gCppObject$(),limitClipEnable);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setLimitClip$(bool limitClipEnable) { CHCKTHIS; return setLimitClip(limitClipEnable); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setLimitClip(bool limitClipEnable,EnginePrototype::_Delegate_Base_LimitCallBack_inner40* limitCallback)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_limitCallback$(limitCallback);\r\n        _ext_CKLBUIList_cmdSetLimitClip(EnginePrototype::GameObject::_acc_gCppObject$(),limitClipEnable);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setLimitClip$(bool limitClipEnable,EnginePrototype::_Delegate_Base_LimitCallBack_inner40* limitCallback) { CHCKTHIS; return setLimitClip(limitClipEnable,limitCallback); }\r\n\r\nbool EnginePrototype::CKLBUIList::setLimitArea(s32 size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdSetLimitArea(EnginePrototype::GameObject::_acc_gCppObject$(),size);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::setLimitArea$(s32 size) { CHCKTHIS; return setLimitArea(size); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setInputEnable(bool enableFlag)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdInputEnable(EnginePrototype::GameObject::_acc_gCppObject$(),enableFlag);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setInputEnable$(bool enableFlag) { CHCKTHIS; return setInputEnable(enableFlag); }\r\n\r\nbool EnginePrototype::CKLBUIList::existNode(s32 index,System::String* name)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        bool res = _ext_CKLBUIList_cmdExistNode(EnginePrototype::GameObject::_acc_gCppObject$(),index,System::__MarshallingUtils::NativeUtf8FromString(name));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        return res;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::existNode$(s32 index,System::String* name) { CHCKTHIS; return existNode(index,name); }\r\n\r\nbool EnginePrototype::CKLBUIList::animationItem(s32 index,System::String* animationName,bool blendFlag)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdAnimationItem(EnginePrototype::GameObject::_acc_gCppObject$(),index,System::__MarshallingUtils::NativeUtf8FromString(animationName),blendFlag);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::animationItem$(s32 index,System::String* animationName,bool blendFlag) { CHCKTHIS; return animationItem(index,animationName,blendFlag); }\r\n\r\nbool EnginePrototype::CKLBUIList::animationAll(System::String* animationName,bool blendFlag)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdAnimationAll(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(animationName),blendFlag);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::animationAll$(System::String* animationName,bool blendFlag) { CHCKTHIS; return animationAll(animationName,blendFlag); }\r\n\r\nbool EnginePrototype::CKLBUIList::useScrollbar(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,bool hideMode,bool shortHide)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_useScrollBar(EnginePrototype::GameObject::_acc_gCppObject$(),order,side,lineWeight,System::__MarshallingUtils::NativeUtf8FromString(image),minSliderSize,colorNormal,colorSelect,active,hideMode,shortHide);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::useScrollbar$(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,bool hideMode,bool shortHide) { CHCKTHIS; return useScrollbar(order,side,lineWeight,image,minSliderSize,colorNormal,colorSelect,active,hideMode,shortHide); }\r\n\r\nbool EnginePrototype::CKLBUIList::useScrollbar(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* callback,bool hideMode,bool shortHide)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_scrollbarCallback$(callback);\r\n        return _ext_CKLBUIList_useScrollBar(EnginePrototype::GameObject::_acc_gCppObject$(),order,side,lineWeight,System::__MarshallingUtils::NativeUtf8FromString(image),minSliderSize,colorNormal,colorSelect,active,hideMode,shortHide);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::useScrollbar$(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* callback,bool hideMode,bool shortHide) { CHCKTHIS; return useScrollbar(order,side,lineWeight,image,minSliderSize,colorNormal,colorSelect,active,callback,hideMode,shortHide); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setItemID(s32 index,s32 id)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdSetItemID(EnginePrototype::GameObject::_acc_gCppObject$(),index,id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setItemID$(s32 index,s32 id) { CHCKTHIS; return setItemID(index,id); }\r\n\r\ns32 EnginePrototype::CKLBUIList::searchID(s32 index)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdSearchID(EnginePrototype::GameObject::_acc_gCppObject$(),index);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::searchID$(s32 index) { CHCKTHIS; return searchID(index); }\r\n\r\nbool EnginePrototype::CKLBUIList::selectScrMgr(System::String* managerName,System::Array<s32>* optParams)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        if (optParams != NULL)\r\n        {\r\n            return _ext_CKLBUIList_cmdSelectScrMgr(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(managerName),optParams,(u32)optParams->_acc_gLength$());\r\n        }\r\n        else\r\n        {\r\n            return _ext_CKLBUIList_cmdSelectScrMgr(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(managerName),(System::Array<s32>*)NULL,0);\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::selectScrMgr$(System::String* managerName,System::Array<s32>* optParams) { CHCKTHIS; return selectScrMgr(managerName,optParams); }\r\n\r\nbool EnginePrototype::CKLBUIList::itemAnimSkip(s32 idx,System::String* name)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdItemAnimSkip(EnginePrototype::GameObject::_acc_gCppObject$(),idx,System::__MarshallingUtils::NativeUtf8FromString(name));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::itemAnimSkip$(s32 idx,System::String* name) { CHCKTHIS; return itemAnimSkip(idx,name); }\r\n\r\nbool EnginePrototype::CKLBUIList::allAnimSkip(System::String* groupName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdAllAnimSkip(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(groupName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::allAnimSkip$(System::String* groupName) { CHCKTHIS; return allAnimSkip(groupName); }\r\n\r\nbool EnginePrototype::CKLBUIList::addRecords(s32 insIdx,System::String* tpForm,System::String* dbRecords,s32 step)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdAddRecords(EnginePrototype::GameObject::_acc_gCppObject$(),insIdx,System::__MarshallingUtils::NativeUtf8FromString(tpForm),System::__MarshallingUtils::NativeUtf8FromString(dbRecords),step);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::addRecords$(s32 insIdx,System::String* tpForm,System::String* dbRecords,s32 step) { CHCKTHIS; return addRecords(insIdx,tpForm,dbRecords,step); }\r\n\r\ns32 EnginePrototype::CKLBUIList::setInitial(s32 pos)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdSetInitial(EnginePrototype::GameObject::_acc_gCppObject$(),pos);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::setInitial$(s32 pos) { CHCKTHIS; return setInitial(pos); }\r\n\r\nvoid EnginePrototype::CKLBUIList::fwModeConfig(s32 itemStep,s32 maxItems)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdFWModeConfig(EnginePrototype::GameObject::_acc_gCppObject$(),itemStep,maxItems);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::fwModeConfig$(s32 itemStep,s32 maxItems) { CHCKTHIS; return fwModeConfig(itemStep,maxItems); }\r\n\r\nvoid EnginePrototype::CKLBUIList::fwItemAdd()\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNotImplemented(_$_cteStr90Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::fwItemAdd$() { CHCKTHIS; return fwItemAdd(); }\r\n\r\nvoid EnginePrototype::CKLBUIList::fwItemInsertTop()\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNotImplemented(_$_cteStr90Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::fwItemInsertTop$() { CHCKTHIS; return fwItemInsertTop(); }\r\n\r\nbool EnginePrototype::CKLBUIList::setItemMode(s32 mode)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdSetItemMode(EnginePrototype::GameObject::_acc_gCppObject$(),(s32)mode);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::setItemMode$(s32 mode) { CHCKTHIS; return setItemMode(mode); }\r\n\r\nbool EnginePrototype::CKLBUIList::setItemMode(s32 mode,EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* dynamicCallback)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _sm_dynamicCallback$(dynamicCallback);\r\n        return _ext_CKLBUIList_cmdSetItemMode(EnginePrototype::GameObject::_acc_gCppObject$(),(s32)mode);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::setItemMode$(s32 mode,EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* dynamicCallback) { CHCKTHIS; return setItemMode(mode,dynamicCallback); }\r\n\r\ns32 EnginePrototype::CKLBUIList::setPosition(s32 pos,s32 dir)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdSetPosition(EnginePrototype::GameObject::_acc_gCppObject$(),pos,dir);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::setPosition$(s32 pos,s32 dir) { CHCKTHIS; return setPosition(pos,dir); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setGroup(System::String* groupName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdSetGroup(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(groupName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setGroup$(System::String* groupName) { CHCKTHIS; return setGroup(groupName); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setClip(u32 orderBegin,u32 orderEnd,s16 clipX,s16 clipY,s16 clipWidth,s16 clipHeight)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_cmdSetClip(EnginePrototype::GameObject::_acc_gCppObject$(),orderBegin,orderEnd,clipX,clipY,clipWidth,clipHeight);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setClip$(u32 orderBegin,u32 orderEnd,s16 clipX,s16 clipY,s16 clipWidth,s16 clipHeight) { CHCKTHIS; return setClip(orderBegin,orderEnd,clipX,clipY,clipWidth,clipHeight); }\r\n\r\nvoid EnginePrototype::CKLBUIList::setDragRect(s32 left,s32 top,s32 right,s32 bottom)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setDragRect(EnginePrototype::GameObject::_acc_gCppObject$(),left,top,right,bottom);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIList::setDragRect$(s32 left,s32 top,s32 right,s32 bottom) { CHCKTHIS; return setDragRect(left,top,right,bottom); }\r\n\r\ninline EnginePrototype::_Delegate_Base_LimitCallBack_inner40* EnginePrototype::CKLBUIList::_sm_limitCallback(EnginePrototype::_Delegate_Base_LimitCallBack_inner40* _$value)  { return (EnginePrototype::_Delegate_Base_LimitCallBack_inner40*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_limitCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_LimitCallBack_inner40* EnginePrototype::CKLBUIList::_sm_limitCallback$(EnginePrototype::_Delegate_Base_LimitCallBack_inner40* _$value) { CHCKTHIS; return _sm_limitCallback(_$value); }\r\ninline EnginePrototype::_Delegate_Base_DragCallBack_inner41* EnginePrototype::CKLBUIList::_sm_dragCallback(EnginePrototype::_Delegate_Base_DragCallBack_inner41* _$value)  { return (EnginePrototype::_Delegate_Base_DragCallBack_inner41*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_dragCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_DragCallBack_inner41* EnginePrototype::CKLBUIList::_sm_dragCallback$(EnginePrototype::_Delegate_Base_DragCallBack_inner41* _$value) { CHCKTHIS; return _sm_dragCallback(_$value); }\r\ninline EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* EnginePrototype::CKLBUIList::_sm_dynamicCallback(EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* _$value)  { return (EnginePrototype::_Delegate_Base_DynamicCallBack_inner42*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_dynamicCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* EnginePrototype::CKLBUIList::_sm_dynamicCallback$(EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* _$value) { CHCKTHIS; return _sm_dynamicCallback(_$value); }\r\ninline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* EnginePrototype::CKLBUIList::_sm_scrollbarCallback(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* _$value)  { return (EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_scrollbarCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* EnginePrototype::CKLBUIList::_sm_scrollbarCallback$(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* _$value) { CHCKTHIS; return _sm_scrollbarCallback(_$value); }\r\ninline EnginePrototype::_Delegate_Base_AnimCallBack_inner44* EnginePrototype::CKLBUIList::_sm_animCallback(EnginePrototype::_Delegate_Base_AnimCallBack_inner44* _$value)  { return (EnginePrototype::_Delegate_Base_AnimCallBack_inner44*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_animCallback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_AnimCallBack_inner44* EnginePrototype::CKLBUIList::_sm_animCallback$(EnginePrototype::_Delegate_Base_AnimCallBack_inner44* _$value) { CHCKTHIS; return _sm_animCallback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sWidth(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sWidth$(u32 value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sHeight(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sHeight$(u32 value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gStepX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getStepX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gStepX$() { CHCKTHIS; return _acc_gStepX(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sStepX(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setStepX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sStepX$(s32 value)\t\t{ CHCKTHIS; return _acc_sStepX(value); }\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gStepY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getStepY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gStepY$() { CHCKTHIS; return _acc_gStepY(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sStepY(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setStepY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sStepY$(s32 value)\t\t{ CHCKTHIS; return _acc_sStepY(value); }\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gMaxodr(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getMaxOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gMaxodr$() { CHCKTHIS; return _acc_gMaxodr(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sMaxodr(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setMaxOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIList::_acc_sMaxodr$(u32 value)\t\t{ CHCKTHIS; return _acc_sMaxodr(value); }\r\ninline bool EnginePrototype::CKLBUIList::_acc_gIsVertical(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getVertical(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_gIsVertical$() { CHCKTHIS; return _acc_gIsVertical(); }\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_sIsVertical(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setVertical(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIList::_acc_sIsVertical$(bool value)\t\t{ CHCKTHIS; return _acc_sIsVertical(value); }\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gItems(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getItems(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIList::_acc_gItems$() { CHCKTHIS; return _acc_gItems(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gMarginTop(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getMarginTop(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gMarginTop$() { CHCKTHIS; return _acc_gMarginTop(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sMarginTop(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setMarginTop(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sMarginTop$(s32 value)\t\t{ CHCKTHIS; return _acc_sMarginTop(value); }\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gMarginBottom(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getMarginBottom(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gMarginBottom$() { CHCKTHIS; return _acc_gMarginBottom(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sMarginBottom(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setMarginBottom(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIList::_acc_sMarginBottom$(s32 value)\t\t{ CHCKTHIS; return _acc_sMarginBottom(value); }\r\ninline bool EnginePrototype::CKLBUIList::_acc_gDefaultScroll(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_getDefaultScroll(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_gDefaultScroll$() { CHCKTHIS; return _acc_gDefaultScroll(); }\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_sDefaultScroll(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setDefaultScroll(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIList::_acc_sDefaultScroll$(bool value)\t\t{ CHCKTHIS; return _acc_sDefaultScroll(value); }\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gPosition(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdGetPosition(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gPosition$() { CHCKTHIS; return _acc_gPosition(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gLimit(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIList_cmdGetLimit(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIList::_acc_gLimit$() { CHCKTHIS; return _acc_gLimit(); }\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_gLoopMode(){\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNotImplemented(_$_cteStr1Obj));\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_gLoopMode$() { CHCKTHIS; return _acc_gLoopMode(); }\r\n\r\ninline bool EnginePrototype::CKLBUIList::_acc_sLoopMode(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIList_setLoop(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIList::_acc_sLoopMode$(bool value)\t\t{ CHCKTHIS; return _acc_sLoopMode(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIList::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIList,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIList::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_limitCallback) { System::Memory::pushList(m_limitCallback,0); }\r\n    if (m_dragCallback) { System::Memory::pushList(m_dragCallback,0); }\r\n    if (m_dynamicCallback) { System::Memory::pushList(m_dynamicCallback,0); }\r\n    if (m_scrollbarCallback) { System::Memory::pushList(m_scrollbarCallback,0); }\r\n    if (m_animCallback) { System::Memory::pushList(m_animCallback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_limitCallback && !m_limitCallback->isFreed()) { m_limitCallback->_removeRef((System::__GCObject**)&m_limitCallback); }\r\n    if (m_dragCallback && !m_dragCallback->isFreed()) { m_dragCallback->_removeRef((System::__GCObject**)&m_dragCallback); }\r\n    if (m_dynamicCallback && !m_dynamicCallback->isFreed()) { m_dynamicCallback->_removeRef((System::__GCObject**)&m_dynamicCallback); }\r\n    if (m_scrollbarCallback && !m_scrollbarCallback->isFreed()) { m_scrollbarCallback->_removeRef((System::__GCObject**)&m_scrollbarCallback); }\r\n    if (m_animCallback && !m_animCallback->isFreed()) { m_animCallback->_removeRef((System::__GCObject**)&m_animCallback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIList::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_limitCallback) {\r\n      newPtr = (u8*)(&m_limitCallback); oldPtr = newPtr - offset;\r\n      m_limitCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_dragCallback) {\r\n      newPtr = (u8*)(&m_dragCallback); oldPtr = newPtr - offset;\r\n      m_dragCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_dynamicCallback) {\r\n      newPtr = (u8*)(&m_dynamicCallback); oldPtr = newPtr - offset;\r\n      m_dynamicCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_scrollbarCallback) {\r\n      newPtr = (u8*)(&m_scrollbarCallback); oldPtr = newPtr - offset;\r\n      m_scrollbarCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n    if (m_animCallback) {\r\n      newPtr = (u8*)(&m_animCallback); oldPtr = newPtr - offset;\r\n      m_animCallback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIMoviePlayer'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ctor_CKLBUIMoviePlayer() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_create(s32* pParent,bool mode,float x,float y,float width,float height,s32* url)\r\n{\r\n    return CKLBUIMoviePlayer_create(pParent,mode,x,y,width,height,url);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_getWidth(s32* p)\r\n{\r\n    return CKLBUIMoviePlayer_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_setWidth(s32* p,u32 width)\r\n{\r\n    CKLBUIMoviePlayer_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_getHeight(s32* p)\r\n{\r\n    return CKLBUIMoviePlayer_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_setHeight(s32* p,u32 height)\r\n{\r\n    CKLBUIMoviePlayer_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_getText(s32* p)\r\n{\r\n    return CKLBUIMoviePlayer_getText(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_setText(s32* p,s32* text)\r\n{\r\n    CKLBUIMoviePlayer_setText(p,text);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_moviePlay(s32* p)\r\n{\r\n    CKLBUIMoviePlayer_moviePlay(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_movieStop(s32* p)\r\n{\r\n    CKLBUIMoviePlayer_movieStop(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_moviePause(s32* p)\r\n{\r\n    CKLBUIMoviePlayer_moviePause(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_ext_CKLBUIMoviePlayer_movieResume(s32* p)\r\n{\r\n    CKLBUIMoviePlayer_movieResume(p);\r\n}\r\n\r\nEnginePrototype::CKLBUIMoviePlayer::CKLBUIMoviePlayer(EnginePrototype::CKLBUITask* parent,bool background_mode,float x,float y,float width,float height,EnginePrototype::_Delegate_Base_CallBack_inner45* callback,System::String* url) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIMoviePlayer();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIMoviePlayer_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),background_mode,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(url));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUIMoviePlayer::CKLBUIMoviePlayer() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIMoviePlayer();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerV_inner0<CKLBUIMoviePlayer>(this,&CKLBUIMoviePlayer::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner45*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::callBackFunction()\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::callBackFunction$() { CHCKTHIS; return callBackFunction(); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::getSize(EnginePrototype::USize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIMoviePlayer_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIMoviePlayer_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::getSize$(EnginePrototype::USize& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::setSize(EnginePrototype::USize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIMoviePlayer_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIMoviePlayer_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::setSize$(EnginePrototype::USize size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::setSize(u32 width,u32 height)\r\n{\r\n    _ext_CKLBUIMoviePlayer_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n    _ext_CKLBUIMoviePlayer_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::setSize$(u32 width,u32 height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::play()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_moviePlay(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::play$() { CHCKTHIS; return play(); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::pause()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_moviePause(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::pause$() { CHCKTHIS; return pause(); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::stop()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_movieStop(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::stop$() { CHCKTHIS; return stop(); }\r\n\r\nvoid EnginePrototype::CKLBUIMoviePlayer::resume()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_movieResume(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIMoviePlayer::resume$() { CHCKTHIS; return resume(); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner45* EnginePrototype::CKLBUIMoviePlayer::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner45* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner45*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner45* EnginePrototype::CKLBUIMoviePlayer::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner45* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIMoviePlayer_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_sWidth(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_sWidth$(u32 value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIMoviePlayer_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_sHeight(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIMoviePlayer::_acc_sHeight$(u32 value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline System::String* EnginePrototype::CKLBUIMoviePlayer::_acc_gPath(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIMoviePlayer_getText(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIMoviePlayer::_acc_gPath$() { CHCKTHIS; return _acc_gPath(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIMoviePlayer::_acc_sPath(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIMoviePlayer_setText(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIMoviePlayer::_acc_sPath$(System::String* value)\t\t{ CHCKTHIS; return _acc_sPath(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIMoviePlayer::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIMoviePlayer,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIMoviePlayer::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMoviePlayer::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIMultiImgItem'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIMultiImgItem::_ctor_CKLBUIMultiImgItem() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_create(s32* pParent,u32 order,float x,float y,u32 idx,System::Array<s32*>* pArrayAsset,System::Array<u32>* pArrayIndexes,u32 assetCount)\r\n{\r\n    return CKLBUIMultiImgItem_create(pParent,order,x,y,idx,pArrayAsset ? (s32**)pArrayAsset->_getPArray() : NULL,pArrayIndexes ? (u32*)pArrayIndexes->_getPArray() : NULL,assetCount);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_getIndexMax(s32* p)\r\n{\r\n    return CKLBUIMultiImgItem_getIndexMax(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_setIndexMax(s32* p,u32 index)\r\n{\r\n    CKLBUIMultiImgItem_setIndexMax(p,index);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_getOrder(s32* p)\r\n{\r\n    return CKLBUIMultiImgItem_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIMultiImgItem_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_getIndex(s32* p)\r\n{\r\n    return CKLBUIMultiImgItem_getIndex(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_setIndex(s32* p,u32 index)\r\n{\r\n    CKLBUIMultiImgItem_setIndex(p,index);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIMultiImgItem::_ext_CKLBUIMultiImgItem_changeAssets(s32* p,System::Array<s32*>* pArrayAsset,System::Array<u32>* pArrayIndexes,u32 assetCount)\r\n{\r\n    return CKLBUIMultiImgItem_changeAssets(p,pArrayAsset ? (s32**)pArrayAsset->_getPArray() : NULL,pArrayIndexes ? (u32*)pArrayIndexes->_getPArray() : NULL,assetCount);\r\n}\r\n\r\nEnginePrototype::CKLBUIMultiImgItem::CKLBUIMultiImgItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::Array<System::String*>* pArrayAsset,System::Array<u32>* pArrayIndexes,u32 index) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIMultiImgItem();\r\n    if (pArrayAsset->_acc_gLength$() != pArrayAsset->_acc_gLength$())\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr93Obj));\r\n    }\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIMultiImgItem_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,index,System::__MarshallingUtils::NativeUtf8ArrayFromStringArray(pArrayAsset,pArrayAsset->_acc_gLength$()),pArrayIndexes,(u32)pArrayAsset->_acc_gLength$());\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIMultiImgItem::CKLBUIMultiImgItem() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIMultiImgItem();\r\n}\r\n\r\nbool EnginePrototype::CKLBUIMultiImgItem::changeAssets(System::Array<System::String*>* pArrayAsset,System::Array<u32>* pArrayIndexes)\r\n{\r\n    if (pArrayAsset->_acc_gLength$() != pArrayIndexes->_acc_gLength$())\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr94Obj));\r\n    }\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        bool res = _ext_CKLBUIMultiImgItem_changeAssets(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8ArrayFromStringArray(pArrayAsset,pArrayAsset->_acc_gLength$()),pArrayIndexes,(u32)pArrayAsset->_acc_gLength$());\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        return res;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIMultiImgItem::changeAssets$(System::Array<System::String*>* pArrayAsset,System::Array<u32>* pArrayIndexes) { CHCKTHIS; return changeAssets(pArrayAsset,pArrayIndexes); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIMultiImgItem_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIMultiImgItem_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_gIndex(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIMultiImgItem_getIndex(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_gIndex$() { CHCKTHIS; return _acc_gIndex(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_sIndex(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIMultiImgItem_setIndex(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_sIndex$(u32 value)\t\t{ CHCKTHIS; return _acc_sIndex(value); }\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_gIdMax(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIMultiImgItem_getIndexMax(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_gIdMax$() { CHCKTHIS; return _acc_gIdMax(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_sIdMax(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIMultiImgItem_setIndexMax(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIMultiImgItem::_acc_sIdMax$(u32 value)\t\t{ CHCKTHIS; return _acc_sIdMax(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIMultiImgItem::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIMultiImgItem,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIMultiImgItem::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMultiImgItem::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIMultiImgItem::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIPieChart'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIPieChart::_ctor_CKLBUIPieChart() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_create(s32* pParent,u32 order,float x,float y,float width,float height,s32* asset,float start,float end,s32 anim,float initial)\r\n{\r\n    return CKLBUIPieChart_create(pParent,order,x,y,width,height,asset,start,end,anim,initial);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_getStart(s32* p)\r\n{\r\n    return CKLBUIPieChart_getStart(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_setStart(s32* p,float start)\r\n{\r\n    CKLBUIPieChart_setStart(p,start);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_getEnd(s32* p)\r\n{\r\n    return CKLBUIPieChart_getEnd(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_setEnd(s32* p,float end)\r\n{\r\n    CKLBUIPieChart_setEnd(p,end);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_getValue(s32* p)\r\n{\r\n    return CKLBUIPieChart_getValue(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_setValue(s32* p,float value)\r\n{\r\n    CKLBUIPieChart_setValue(p,value);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_getAnim(s32* p)\r\n{\r\n    return CKLBUIPieChart_getAnim(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_getOrder(s32* p)\r\n{\r\n    return CKLBUIPieChart_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIPieChart::_ext_CKLBUIPieChart_changeAsset(s32* p,s32* assetName)\r\n{\r\n    return CKLBUIPieChart_changeAsset(p,assetName);\r\n}\r\n\r\nEnginePrototype::CKLBUIPieChart::CKLBUIPieChart(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,System::String* image_asset,float start_angle,float end_angle,s32 anim_time,float initial_value) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIPieChart();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIPieChart_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(image_asset),start_angle,end_angle,anim_time,initial_value);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIPieChart::CKLBUIPieChart() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIPieChart();\r\n}\r\n\r\nbool EnginePrototype::CKLBUIPieChart::changeAsset(System::String* assetName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        bool res = _ext_CKLBUIPieChart_changeAsset(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(assetName));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n        return res;\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIPieChart::changeAsset$(System::String* assetName) { CHCKTHIS; return changeAsset(assetName); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIPieChart::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPieChart_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIPieChart::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_gStart(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPieChart_getStart(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_gStart$() { CHCKTHIS; return _acc_gStart(); }\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_sStart(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIPieChart_setStart(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_sStart$(float value)\t\t{ CHCKTHIS; return _acc_sStart(value); }\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_gEnd(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPieChart_getEnd(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_gEnd$() { CHCKTHIS; return _acc_gEnd(); }\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_sEnd(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIPieChart_setEnd(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_sEnd$(float value)\t\t{ CHCKTHIS; return _acc_sEnd(value); }\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_gValue(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPieChart_getValue(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_gValue$() { CHCKTHIS; return _acc_gValue(); }\r\n\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_sValue(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIPieChart_setValue(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIPieChart::_acc_sValue$(float value)\t\t{ CHCKTHIS; return _acc_sValue(value); }\r\ninline s32 EnginePrototype::CKLBUIPieChart::_acc_gAnim(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPieChart_getAnim(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIPieChart::_acc_gAnim$() { CHCKTHIS; return _acc_gAnim(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIPieChart::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIPieChart,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIPieChart::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIPieChart::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIPieChart::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIPolyline'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIPolyline::_ctor_CKLBUIPolyline() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_create(s32* parent,u32 order,u32 maxPoint)\r\n{\r\n    return CKLBUIPolyline_create(parent,order,maxPoint);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_getMaxPoint(s32* p)\r\n{\r\n    return CKLBUIPolyline_getMaxPoint(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_setMaxPoint(s32* p,u32 maxpointcount)\r\n{\r\n    CKLBUIPolyline_setMaxPoint(p,maxpointcount);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_getOrder(s32* p)\r\n{\r\n    return CKLBUIPolyline_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_getPointCount(s32* p)\r\n{\r\n    return CKLBUIPolyline_getPointCount(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_setPointCount(s32* p,u32 pointcount)\r\n{\r\n    CKLBUIPolyline_setPointCount(p,pointcount);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_setPoint(s32* p,u32 idx,float x,float y)\r\n{\r\n    CKLBUIPolyline_setPoint(p,idx,x,y);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_getColor(s32* p)\r\n{\r\n    return CKLBUIPolyline_getColor(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIPolyline::_ext_CKLBUIPolyline_setColor(s32* p,u32 color)\r\n{\r\n    CKLBUIPolyline_setColor(p,color);\r\n}\r\n\r\nEnginePrototype::CKLBUIPolyline::CKLBUIPolyline(EnginePrototype::CKLBUITask* parent,u32 order,u32 maxPoint) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIPolyline();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIPolyline_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,maxPoint);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIPolyline::CKLBUIPolyline() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIPolyline();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIPolyline::setPoint(u32 point_index,float x,float y)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIPolyline_setPoint(EnginePrototype::GameObject::_acc_gCppObject$(),point_index,x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIPolyline::setPoint$(u32 point_index,float x,float y) { CHCKTHIS; return setPoint(point_index,x,y); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPolyline_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gMaxPointCount(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPolyline_getMaxPoint(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gMaxPointCount$() { CHCKTHIS; return _acc_gMaxPointCount(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_sMaxPointCount(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIPolyline_setMaxPoint(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_sMaxPointCount$(u32 value)\t\t{ CHCKTHIS; return _acc_sMaxPointCount(value); }\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gPointCount(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPolyline_getPointCount(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gPointCount$() { CHCKTHIS; return _acc_gPointCount(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_sPointCount(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        if (value > 0)\r\n        {\r\n            _ext_CKLBUIPolyline_setPointCount(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n        }\r\n        else\r\n        {\r\n            THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr97Obj));\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_sPointCount$(u32 value)\t\t{ CHCKTHIS; return _acc_sPointCount(value); }\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gColor(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIPolyline_getColor(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_gColor$() { CHCKTHIS; return _acc_gColor(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_sColor(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIPolyline_setColor(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIPolyline::_acc_sColor$(u32 value)\t\t{ CHCKTHIS; return _acc_sColor(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIPolyline::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIPolyline,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIPolyline::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIPolyline::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIPolyline::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIProgressBar'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIProgressBar::_ctor_CKLBUIProgressBar() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_create(s32* pParent,u32 order,float x,float y,float width,float height,s32* fullImage,s32* emptyImage,s32 startPix,s32 endPix,s32 anim,bool vert,s32* barfilterImage)\r\n{\r\n    return CKLBUIProgressBar_create(pParent,order,x,y,width,height,fullImage,emptyImage,startPix,endPix,anim,vert,barfilterImage);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getOrder(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIProgressBar_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getWidth(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setWidth(s32* p,float width)\r\n{\r\n    CKLBUIProgressBar_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getHeight(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setHeight(s32* p,float height)\r\n{\r\n    CKLBUIProgressBar_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getVertical(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getVertical(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setVertical(s32* p,bool vertical)\r\n{\r\n    CKLBUIProgressBar_setVertical(p,vertical);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getAnimTime(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getAnimTime(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setAnimTime(s32* p,u32 time)\r\n{\r\n    CKLBUIProgressBar_setAnimTime(p,time);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getStart(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getStart(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setStart(s32* p,float start)\r\n{\r\n    CKLBUIProgressBar_setStart(p,start);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getEnd(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getEnd(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setEnd(s32* p,float end)\r\n{\r\n    CKLBUIProgressBar_setEnd(p,end);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getValue(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getValue(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setValue(s32* p,float value)\r\n{\r\n    CKLBUIProgressBar_setValue(p,value);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getImgEmpty(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getImgEmpty(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setImgEmpty(s32* p,s32* imageEmpty)\r\n{\r\n    CKLBUIProgressBar_setImgEmpty(p,imageEmpty);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getImgFull(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getImgFull(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setImgFull(s32* p,s32* imageFull)\r\n{\r\n    CKLBUIProgressBar_setImgFull(p,imageFull);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getImgFilter(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getImgFilter(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setImgFilter(s32* p,s32* imageFilter)\r\n{\r\n    CKLBUIProgressBar_setImgFilter(p,imageFilter);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_reset(s32* p)\r\n{\r\n    CKLBUIProgressBar_reset(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getFilterVisible(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getFilterVisible(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setFilterVisible(s32* p,bool value)\r\n{\r\n    CKLBUIProgressBar_setFilterVisible(p,value);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_getFilterColor(s32* p)\r\n{\r\n    return CKLBUIProgressBar_getFilterColor(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setFilterColor(s32* p,u32 value)\r\n{\r\n    CKLBUIProgressBar_setFilterColor(p,value);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIProgressBar::_ext_CKLBUIProgressBar_setFilterAnim(s32* p,bool bColAnim,u32 argb1,u32 argb2,u32 freq)\r\n{\r\n    return CKLBUIProgressBar_setFilterAnim(p,bColAnim,argb1,argb2,freq);\r\n}\r\n\r\nEnginePrototype::CKLBUIProgressBar::CKLBUIProgressBar(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,System::String* imageFull,System::String* imageEmpty,s32 startPix,s32 endPix,s32 animTime,bool verticalFlag,System::String* barfilterImage) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIProgressBar();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIProgressBar_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(imageFull),System::__MarshallingUtils::NativeUtf8FromString(imageEmpty),startPix,endPix,animTime,verticalFlag,System::__MarshallingUtils::NativeUtf8FromString(barfilterImage));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIProgressBar::CKLBUIProgressBar() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIProgressBar();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIProgressBar::getSize(EnginePrototype::FSize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIProgressBar_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIProgressBar_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIProgressBar::getSize$(EnginePrototype::FSize& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIProgressBar::setSize(EnginePrototype::FSize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIProgressBar_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIProgressBar::setSize$(EnginePrototype::FSize size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIProgressBar::setSize(float width,float height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n        _ext_CKLBUIProgressBar_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIProgressBar::setSize$(float width,float height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIProgressBar::reset()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_reset(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIProgressBar::reset$() { CHCKTHIS; return reset(); }\r\n\r\nvoid EnginePrototype::CKLBUIProgressBar::complete()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setValue(EnginePrototype::GameObject::_acc_gCppObject$(),_ext_CKLBUIProgressBar_getEnd(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIProgressBar::complete$() { CHCKTHIS; return complete(); }\r\n\r\nbool EnginePrototype::CKLBUIProgressBar::setFilterAnim(bool bColAnim,u32 argb1,u32 argb2,u32 freq)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_setFilterAnim(EnginePrototype::GameObject::_acc_gCppObject$(),bColAnim,argb1,argb2,freq);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIProgressBar::setFilterAnim$(bool bColAnim,u32 argb1,u32 argb2,u32 freq) { CHCKTHIS; return setFilterAnim(bColAnim,argb1,argb2,freq); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sWidth(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sWidth$(float value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sHeight(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sHeight$(float value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_gIsVertical(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getVertical(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_gIsVertical$() { CHCKTHIS; return _acc_gIsVertical(); }\r\n\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_sIsVertical(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setVertical(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_sIsVertical$(bool value)\t\t{ CHCKTHIS; return _acc_sIsVertical(value); }\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_gAnimTime(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getAnimTime(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_gAnimTime$() { CHCKTHIS; return _acc_gAnimTime(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_sAnimTime(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setAnimTime(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_sAnimTime$(u32 value)\t\t{ CHCKTHIS; return _acc_sAnimTime(value); }\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gStart(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getStart(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gStart$() { CHCKTHIS; return _acc_gStart(); }\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sStart(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setStart(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sStart$(float value)\t\t{ CHCKTHIS; return _acc_sStart(value); }\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gEnd(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getEnd(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gEnd$() { CHCKTHIS; return _acc_gEnd(); }\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sEnd(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setEnd(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sEnd$(float value)\t\t{ CHCKTHIS; return _acc_sEnd(value); }\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_gImageEmpty(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIProgressBar_getImgEmpty(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_gImageEmpty$() { CHCKTHIS; return _acc_gImageEmpty(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_sImageEmpty(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setImgEmpty(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_sImageEmpty$(System::String* value)\t\t{ CHCKTHIS; return _acc_sImageEmpty(value); }\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_gImageFull(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIProgressBar_getImgFull(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_gImageFull$() { CHCKTHIS; return _acc_gImageFull(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_sImageFull(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setImgFull(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_sImageFull$(System::String* value)\t\t{ CHCKTHIS; return _acc_sImageFull(value); }\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_gImageFilter(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIProgressBar_getImgFilter(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_gImageFilter$() { CHCKTHIS; return _acc_gImageFilter(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_sImageFilter(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setImgFilter(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIProgressBar::_acc_sImageFilter$(System::String* value)\t\t{ CHCKTHIS; return _acc_sImageFilter(value); }\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gValue(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getValue(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_gValue$() { CHCKTHIS; return _acc_gValue(); }\r\n\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sValue(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setValue(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIProgressBar::_acc_sValue$(float value)\t\t{ CHCKTHIS; return _acc_sValue(value); }\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_gFilterVisible(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getFilterVisible(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_gFilterVisible$() { CHCKTHIS; return _acc_gFilterVisible(); }\r\n\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_sFilterVisible(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setFilterVisible(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIProgressBar::_acc_sFilterVisible$(bool value)\t\t{ CHCKTHIS; return _acc_sFilterVisible(value); }\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_gFilterColor(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIProgressBar_getFilterColor(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_gFilterColor$() { CHCKTHIS; return _acc_gFilterColor(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_sFilterColor(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIProgressBar_setFilterColor(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIProgressBar::_acc_sFilterColor$(u32 value)\t\t{ CHCKTHIS; return _acc_sFilterColor(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIProgressBar::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIProgressBar,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIProgressBar::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIProgressBar::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIRubberBand'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIRubberBand::_ctor_CKLBUIRubberBand() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_create(s32* pParent,u32 order,float x,float y,u32 resolution,s32* origin,s32* joint,s32* point,u32 flags,u32 animTime,s32 joint_order_off,s32 point_order_off,bool rot_origin,bool rot_joint,bool rot_point)\r\n{\r\n    return CKLBUIRubberBand_create(pParent,order,x,y,resolution,origin,joint,point,flags,animTime,joint_order_off,point_order_off,rot_origin,rot_joint,rot_point);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getOriginX(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getOriginX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setOriginX(s32* p,float x)\r\n{\r\n    CKLBUIRubberBand_setOriginX(p,x);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getOriginY(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getOriginY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setOriginY(s32* p,float y)\r\n{\r\n    CKLBUIRubberBand_setOriginY(p,y);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getPointX(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getPointX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setPointX(s32* p,float x)\r\n{\r\n    CKLBUIRubberBand_setPointX(p,x);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getPointY(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getPointY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setPointY(s32* p,float y)\r\n{\r\n    CKLBUIRubberBand_setPointY(p,y);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getFAnim(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getFAnim(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setFAnim(s32* p,bool fAnim)\r\n{\r\n    CKLBUIRubberBand_setFAnim(p,fAnim);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getFAnimRT(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getFAnimRT(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setFAnimRT(s32* p,bool fAnimRT)\r\n{\r\n    CKLBUIRubberBand_setFAnimRT(p,fAnimRT);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getAnimTime(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getAnimTime(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setAnimTime(s32* p,u32 animTime)\r\n{\r\n    CKLBUIRubberBand_setAnimTime(p,animTime);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getOrder(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getOrder(p);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getAssetOrigin(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getAssetOrigin(p);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getAssetJoint(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getAssetJoint(p);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_getAssetPoint(s32* p)\r\n{\r\n    return CKLBUIRubberBand_getAssetPoint(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIRubberBand::_ext_CKLBUIRubberBand_setOrder(s32* p,u32 orderOrigin,u32 orderJoint,u32 orderPoint)\r\n{\r\n    return CKLBUIRubberBand_setOrder(p,orderOrigin,orderJoint,orderPoint);\r\n}\r\n\r\nEnginePrototype::CKLBUIRubberBand::CKLBUIRubberBand(EnginePrototype::CKLBUITask* parent,u32 order,float origin_x,float origin_y,System::String* origin_asset,System::String* joint_asset,System::String* point_asset,u32 resolution,u32 option_flags,u32 animation_time,s32 joint_priority_offset,s32 point_priority_offset,bool rot_origin,bool rot_joint,bool rot_point) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIRubberBand();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIRubberBand_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,origin_x,origin_y,resolution,System::__MarshallingUtils::NativeUtf8FromString(origin_asset),System::__MarshallingUtils::NativeUtf8FromString(joint_asset),System::__MarshallingUtils::NativeUtf8FromString(point_asset),option_flags,animation_time,joint_priority_offset,point_priority_offset,rot_origin,rot_joint,rot_point);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIRubberBand::CKLBUIRubberBand() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIRubberBand();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIRubberBand::setOrder(u32 orderOrigin,u32 orderJoint,u32 orderPoint)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),orderOrigin,orderJoint,orderPoint);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIRubberBand::setOrder$(u32 orderOrigin,u32 orderJoint,u32 orderPoint) { CHCKTHIS; return setOrder(orderOrigin,orderJoint,orderPoint); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIRubberBand::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIRubberBand::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIRubberBand::_acc_gAssetOrigin(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIRubberBand_getAssetOrigin(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIRubberBand::_acc_gAssetOrigin$() { CHCKTHIS; return _acc_gAssetOrigin(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIRubberBand::_acc_gAssetJoint(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIRubberBand_getAssetJoint(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIRubberBand::_acc_gAssetJoint$() { CHCKTHIS; return _acc_gAssetJoint(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIRubberBand::_acc_gAssetPoint(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIRubberBand_getAssetPoint(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIRubberBand::_acc_gAssetPoint$() { CHCKTHIS; return _acc_gAssetPoint(); }\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gOriginX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getOriginX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gOriginX$() { CHCKTHIS; return _acc_gOriginX(); }\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sOriginX(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setOriginX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sOriginX$(float value)\t\t{ CHCKTHIS; return _acc_sOriginX(value); }\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gOriginY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getOriginY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gOriginY$() { CHCKTHIS; return _acc_gOriginY(); }\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sOriginY(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setOriginY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sOriginY$(float value)\t\t{ CHCKTHIS; return _acc_sOriginY(value); }\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gPointX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getPointX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gPointX$() { CHCKTHIS; return _acc_gPointX(); }\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sPointX(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setPointX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sPointX$(float value)\t\t{ CHCKTHIS; return _acc_sPointX(value); }\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gPointY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getPointY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_gPointY$() { CHCKTHIS; return _acc_gPointY(); }\r\n\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sPointY(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setPointY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIRubberBand::_acc_sPointY$(float value)\t\t{ CHCKTHIS; return _acc_sPointY(value); }\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_gAnimFlag(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getFAnim(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_gAnimFlag$() { CHCKTHIS; return _acc_gAnimFlag(); }\r\n\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_sAnimFlag(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setFAnim(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_sAnimFlag$(bool value)\t\t{ CHCKTHIS; return _acc_sAnimFlag(value); }\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_gRealTimeFlag(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getFAnimRT(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_gRealTimeFlag$() { CHCKTHIS; return _acc_gRealTimeFlag(); }\r\n\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_sRealTimeFlag(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setFAnimRT(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIRubberBand::_acc_sRealTimeFlag$(bool value)\t\t{ CHCKTHIS; return _acc_sRealTimeFlag(value); }\r\ninline u32 EnginePrototype::CKLBUIRubberBand::_acc_gAnimTime(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIRubberBand_getAnimTime(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIRubberBand::_acc_gAnimTime$() { CHCKTHIS; return _acc_gAnimTime(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIRubberBand::_acc_sAnimTime(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIRubberBand_setAnimTime(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIRubberBand::_acc_sAnimTime$(u32 value)\t\t{ CHCKTHIS; return _acc_sAnimTime(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIRubberBand::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIRubberBand,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIRubberBand::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIRubberBand::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIScale9'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIScale9::_ctor_CKLBUIScale9() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_create(s32* pParent,u32 order,float x,float y,s32 width,s32 height,s32* asset)\r\n{\r\n    return CKLBUIScale9_create(pParent,order,x,y,width,height,asset);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_getWidth(s32* p)\r\n{\r\n    return CKLBUIScale9_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_setWidth(s32* p,s32 width)\r\n{\r\n    CKLBUIScale9_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_getHeight(s32* p)\r\n{\r\n    return CKLBUIScale9_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_setHeight(s32* p,s32 height)\r\n{\r\n    CKLBUIScale9_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_getOrder(s32* p)\r\n{\r\n    return CKLBUIScale9_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIScale9_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_getAsset(s32* p)\r\n{\r\n    return CKLBUIScale9_getAsset(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScale9::_ext_CKLBUIScale9_setAsset(s32* p,s32* asset)\r\n{\r\n    return CKLBUIScale9_setAsset(p,asset);\r\n}\r\n\r\nEnginePrototype::CKLBUIScale9::CKLBUIScale9(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,s32 width,s32 height,System::String* asset) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIScale9();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIScale9_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(asset));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIScale9::CKLBUIScale9() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIScale9();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIScale9::getSize(EnginePrototype::Size& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIScale9_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIScale9_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScale9::getSize$(EnginePrototype::Size& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIScale9::setSize(EnginePrototype::Size size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScale9_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIScale9_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScale9::setSize$(EnginePrototype::Size size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIScale9::setSize(s32 width,s32 height)\r\n{\r\n    _ext_CKLBUIScale9_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n    _ext_CKLBUIScale9_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScale9::setSize$(s32 width,s32 height) { CHCKTHIS; return setSize(width,height); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIScale9::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScale9_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScale9::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScale9::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScale9_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScale9::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScale9_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_sWidth(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScale9_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_sWidth$(s32 value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScale9_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_sHeight(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScale9_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScale9::_acc_sHeight$(s32 value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline System::String* EnginePrototype::CKLBUIScale9::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIScale9_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIScale9::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIScale9::_acc_sAsset(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        _ext_CKLBUIScale9_setAsset(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIScale9::_acc_sAsset$(System::String* value)\t\t{ CHCKTHIS; return _acc_sAsset(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIScale9::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIScale9,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIScale9::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScale9::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScale9::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'AnimationInfo'\r\n//=============================\r\n\r\nvoid EnginePrototype::AnimationInfo::_ctor_AnimationInfo() {\r\n    m_mask = 0;\r\n    _sm_internalArray(CS_NEW System::Array< float >(22));\r\n}\r\n\r\nvoid EnginePrototype::AnimationInfo::createAlphaAnimation(float start,float end)\r\n{\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::A_COLOR));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::A_COLOR),start);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::A_COLOR) + 1,end);\r\n}\r\n\r\ninline void EnginePrototype::AnimationInfo::createAlphaAnimation$(float start,float end) { CHCKTHIS; return createAlphaAnimation(start,end); }\r\n\r\nvoid EnginePrototype::AnimationInfo::createRGBAnimation(float RStart,float REnd,float GStart,float GEnd,float BStart,float BEnd)\r\n{\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::R_COLOR));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::R_COLOR),RStart);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::R_COLOR) + 1,REnd);\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::G_COLOR));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::G_COLOR),GStart);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::G_COLOR) + 1,GEnd);\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::B_COLOR));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::R_COLOR),BStart);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::R_COLOR) + 1,BEnd);\r\n}\r\n\r\ninline void EnginePrototype::AnimationInfo::createRGBAnimation$(float RStart,float REnd,float GStart,float GEnd,float BStart,float BEnd) { CHCKTHIS; return createRGBAnimation(RStart,REnd,GStart,GEnd,BStart,BEnd); }\r\n\r\nvoid EnginePrototype::AnimationInfo::createScaleAnimation(float start,float end)\r\n{\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::SCALE_COORD));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::SCALE_COORD),start);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::SCALE_COORD) + 1,end);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::SCALE_COORD) + 2,start);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::SCALE_COORD) + 3,end);\r\n}\r\n\r\ninline void EnginePrototype::AnimationInfo::createScaleAnimation$(float start,float end) { CHCKTHIS; return createScaleAnimation(start,end); }\r\n\r\nvoid EnginePrototype::AnimationInfo::createXOffsetAnimation(float start,float end)\r\n{\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::X_COORD));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::X_COORD),start);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::X_COORD) + 1,end);\r\n}\r\n\r\ninline void EnginePrototype::AnimationInfo::createXOffsetAnimation$(float start,float end) { CHCKTHIS; return createXOffsetAnimation(start,end); }\r\n\r\nvoid EnginePrototype::AnimationInfo::createYOffsetAnimation(float start,float end)\r\n{\r\n    _sm_mask$OrEq(ms_maskArr->_idx_g$((u32)EIDX::Y_COORD));\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::Y_COORD),start);\r\n    _gm_internalArray$()->_idx_s$(ms_indexes->_idx_g$((s32)EIDX::Y_COORD) + 1,end);\r\n}\r\n\r\ninline void EnginePrototype::AnimationInfo::createYOffsetAnimation$(float start,float end) { CHCKTHIS; return createYOffsetAnimation(start,end); }\r\n\r\nvoid EnginePrototype::AnimationInfo::_ref_getAnimInfo(u32& type,u32& affected,System::Array<float>*& arrayParam)\r\n{\r\n    affected = _gm_mask$();\r\n    type = 1;\r\n    arrayParam = CS_NEW System::Array< float >(22);\r\n    s32 idx = 0;\r\n    for (s32 i = 0;i <= (s32)EIDX::COUNT;++i)\r\n    {\r\n        u32 currentAnim = ms_maskArr->_idx_g$(i);\r\n        if (((u32)_gm_mask$() & currentAnim) == currentAnim)\r\n        {\r\n            s32 currentIdx = ms_indexes->_idx_g$(i);\r\n            arrayParam->_idx_s$(idx++,_gm_internalArray$()->_idx_g$(currentIdx));\r\n            arrayParam->_idx_s$(idx++,_gm_internalArray$()->_idx_g$(currentIdx + 1));\r\n            if (currentAnim == (u32)EIDX::SCALE_COORD)\r\n            {\r\n                arrayParam->_idx_s$(idx++,_gm_internalArray$()->_idx_g$(currentIdx + 2));\r\n                arrayParam->_idx_s$(idx++,_gm_internalArray$()->_idx_g$(currentIdx + 3));\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::AnimationInfo::getAnimInfo$(u32& type,u32& affected,System::Array<float>*& arrayParam) { CHCKTHIS; return getAnimInfo(type,affected,arrayParam); }\r\n\r\ninline void EnginePrototype::AnimationInfo::getAnimInfo(u32& type,u32& affected,System::Array<float>*& arrayParam) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); _ref_getAnimInfo(type,affected,arrayParam); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); }\r\n\r\nEnginePrototype::AnimationInfo::AnimationInfo() { _ctor_AnimationInfo(); }\r\n\r\ninline System::Array<u32>* EnginePrototype::AnimationInfo::_sms_maskArr(System::Array<u32>* _$value)\t\t{ return (System::Array<u32>*)System::__GCObject::_RefSetValue((System::__GCObject**)&ms_maskArr,_$value); }\r\ninline System::Array<s32>* EnginePrototype::AnimationInfo::_sms_indexes(System::Array<s32>* _$value)\t\t{ return (System::Array<s32>*)System::__GCObject::_RefSetValue((System::__GCObject**)&ms_indexes,_$value); }\r\ninline System::Array<float>* EnginePrototype::AnimationInfo::_sm_internalArray(System::Array<float>* _$value)  { return (System::Array<float>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_internalArray,_$value); }\r\ninline System::Array<float>* EnginePrototype::AnimationInfo::_sm_internalArray$(System::Array<float>* _$value) { CHCKTHIS; return _sm_internalArray(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::AnimationInfo::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(AnimationInfo,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::AnimationInfo::_processGC() {\r\n    if (m_internalArray) { System::Memory::pushList(m_internalArray,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::AnimationInfo::_releaseGC() {\r\n    if (m_internalArray && !m_internalArray->isFreed()) { m_internalArray->_removeRef((System::__GCObject**)&m_internalArray); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::AnimationInfo::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_internalArray) {\r\n      newPtr = (u8*)(&m_internalArray); oldPtr = newPtr - offset;\r\n      m_internalArray->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIScore'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIScore::_ctor_CKLBUIScore() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_create(s32* pParent,u32 order,s32 orderOffset,float x,float y,System::Array<s32*>* texTable,float stepX,float stepY,s32 column,bool fillZero,bool animFlags,u32 align,bool countClip)\r\n{\r\n    return CKLBUIScore_create(pParent,order,orderOffset,x,y,texTable ? (s32**)texTable->_getPArray() : NULL,stepX,stepY,column,fillZero,animFlags,align,countClip);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getValue(s32* p)\r\n{\r\n    return CKLBUIScore_getValue(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setValue(s32* p,u32 value)\r\n{\r\n    CKLBUIScore_setValue(p,value);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getOrder(s32* p)\r\n{\r\n    return CKLBUIScore_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setOrder(s32* p,u32 value)\r\n{\r\n    CKLBUIScore_setOrder(p,value);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getOrderOffset(s32* p)\r\n{\r\n    return CKLBUIScore_getOrderOffset(p);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getStepX(s32* p)\r\n{\r\n    return CKLBUIScore_getStepX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setStepX(s32* p,s32 value)\r\n{\r\n    CKLBUIScore_setStepX(p,value);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getStepY(s32* p)\r\n{\r\n    return CKLBUIScore_getStepY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setStepY(s32* p,s32 value)\r\n{\r\n    CKLBUIScore_setStepY(p,value);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getColumn(s32* p)\r\n{\r\n    return CKLBUIScore_getColumn(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setColumn(s32* p,u32 value)\r\n{\r\n    CKLBUIScore_setColumn(p,value);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getFillZero(s32* p)\r\n{\r\n    return CKLBUIScore_getFillZero(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setFillZero(s32* p,bool value)\r\n{\r\n    CKLBUIScore_setFillZero(p,value);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getAnim(s32* p)\r\n{\r\n    return CKLBUIScore_getAnim(p);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getAlign(s32* p)\r\n{\r\n    return CKLBUIScore_getAlign(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setAlign(s32* p,s32 align)\r\n{\r\n    CKLBUIScore_setAlign(p,align);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getTextures(s32* p)\r\n{\r\n    return CKLBUIScore_getTextures(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_getCountClip(s32* p)\r\n{\r\n    return CKLBUIScore_getCountClip(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setCountClip(s32* p,bool value)\r\n{\r\n    CKLBUIScore_setCountClip(p,value);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setEnterAnimation(s32* p,u32 milliSecondsPlayTime,s32 timeShift,u32 type,u32 affected,System::Array<float>* arrayParam)\r\n{\r\n    CKLBUIScore_setEnterAnimation(p,milliSecondsPlayTime,timeShift,type,affected,arrayParam ? (float*)arrayParam->_getPArray() : NULL);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScore::_ext_CKLBUIScore_setExitAnimation(s32* p,u32 milliSecondsPlayTime,s32 timeShift,u32 type,u32 affected,System::Array<float>* arrayParam)\r\n{\r\n    CKLBUIScore_setExitAnimation(p,milliSecondsPlayTime,timeShift,type,affected,arrayParam ? (float*)arrayParam->_getPArray() : NULL);\r\n}\r\n\r\nEnginePrototype::CKLBUIScore::CKLBUIScore(EnginePrototype::CKLBUITask* parent,u32 order,s32 orderOffset,float x,float y,System::Array<System::String*>* textureTable,float stepX,float stepY,s32 column,bool fillZeroFlag,bool animationFlag,s32 align,bool countClip) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIScore();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIScore_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,orderOffset,x,y,System::__MarshallingUtils::NativeUtf8ArrayFromStringArray(textureTable,textureTable->_acc_gLength$()),stepX,stepY,column,fillZeroFlag,animationFlag,(u32)align,countClip);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIScore::CKLBUIScore() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIScore();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIScore::reset()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setValue(EnginePrototype::GameObject::_acc_gCppObject$(),0);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScore::reset$() { CHCKTHIS; return reset(); }\r\n\r\nvoid EnginePrototype::CKLBUIScore::enterAnim(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        u32 type = 0;\r\n        u32 affected = 0;\r\n        System::Array<float>* param_array = NULL;\r\n        if (animation != NULL)\r\n        {\r\n            animation->getAnimInfo$(type,affected,param_array);\r\n        }\r\n        _ext_CKLBUIScore_setEnterAnimation(EnginePrototype::GameObject::_acc_gCppObject$(),msPlayTime,timeShift,type,affected,param_array);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScore::enterAnim$(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift) { CHCKTHIS; return enterAnim(animation,msPlayTime,timeShift); }\r\n\r\nvoid EnginePrototype::CKLBUIScore::exitAnim(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        u32 type = 0;\r\n        u32 affected = 0;\r\n        System::Array<float>* param_array = NULL;\r\n        if (animation != NULL)\r\n        {\r\n            animation->getAnimInfo$(type,affected,param_array);\r\n        }\r\n        _ext_CKLBUIScore_setExitAnimation(EnginePrototype::GameObject::_acc_gCppObject$(),msPlayTime,timeShift,type,affected,param_array);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScore::exitAnim$(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift) { CHCKTHIS; return exitAnim(animation,msPlayTime,timeShift); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gOdoff(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getOrderOffset(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gOdoff$() { CHCKTHIS; return _acc_gOdoff(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_gStepX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getStepX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_gStepX$() { CHCKTHIS; return _acc_gStepX(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_sStepX(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setStepX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_sStepX$(s32 value)\t\t{ CHCKTHIS; return _acc_sStepX(value); }\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_gStepY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getStepY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_gStepY$() { CHCKTHIS; return _acc_gStepY(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_sStepY(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setStepY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_sStepY$(s32 value)\t\t{ CHCKTHIS; return _acc_sStepY(value); }\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gCols(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getColumn(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gCols$() { CHCKTHIS; return _acc_gCols(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_sCols(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setColumn(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_sCols$(u32 value)\t\t{ CHCKTHIS; return _acc_sCols(value); }\r\ninline bool EnginePrototype::CKLBUIScore::_acc_gFillZero(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getFillZero(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIScore::_acc_gFillZero$() { CHCKTHIS; return _acc_gFillZero(); }\r\n\r\ninline bool EnginePrototype::CKLBUIScore::_acc_sFillZero(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setFillZero(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIScore::_acc_sFillZero$(bool value)\t\t{ CHCKTHIS; return _acc_sFillZero(value); }\r\ninline bool EnginePrototype::CKLBUIScore::_acc_gIsAnim(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getAnim(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIScore::_acc_gIsAnim$() { CHCKTHIS; return _acc_gIsAnim(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gValue(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getValue(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_gValue$() { CHCKTHIS; return _acc_gValue(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_sValue(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setValue(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScore::_acc_sValue$(u32 value)\t\t{ CHCKTHIS; return _acc_sValue(value); }\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_gAlign(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return (EALIGN)_ext_CKLBUIScore_getAlign(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_gAlign$() { CHCKTHIS; return _acc_gAlign(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_sAlign(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setAlign(EnginePrototype::GameObject::_acc_gCppObject$(),(s32)value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScore::_acc_sAlign$(s32 value)\t\t{ CHCKTHIS; return _acc_sAlign(value); }\r\ninline bool EnginePrototype::CKLBUIScore::_acc_gCountClip(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScore_getCountClip(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIScore::_acc_gCountClip$() { CHCKTHIS; return _acc_gCountClip(); }\r\n\r\ninline bool EnginePrototype::CKLBUIScore::_acc_sCountClip(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScore_setCountClip(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIScore::_acc_sCountClip$(bool value)\t\t{ CHCKTHIS; return _acc_sCountClip(value); }\r\ninline System::Array<System::String*>* EnginePrototype::CKLBUIScore::_acc_gTextures(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringArrayFromNativeUtf8IntPtr(_ext_CKLBUIScore_getTextures(EnginePrototype::GameObject::_acc_gCppObject$()),10);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::Array<System::String*>* EnginePrototype::CKLBUIScore::_acc_gTextures$() { CHCKTHIS; return _acc_gTextures(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIScore::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIScore,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIScore::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScore::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScore::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIScrollBar'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIScrollBar::_ctor_CKLBUIScrollBar() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_create(s32* pParent,u32 order,float x,float y,float width,float height,s32 minValue,s32 maxValue,s32 pos,s32* image,s32 slider_size,s32 min_slider_size,u32 colorNormal,u32 colorSelect,bool vert,bool active,bool hideMode)\r\n{\r\n    return CKLBUIScrollBar_create(pParent,order,x,y,width,height,minValue,maxValue,pos,image,slider_size,min_slider_size,colorNormal,colorSelect,vert,active,hideMode);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getMin(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getMin(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setMin(s32* p,s32 value)\r\n{\r\n    CKLBUIScrollBar_setMin(p,value);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getMax(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getMax(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setMax(s32* p,s32 value)\r\n{\r\n    CKLBUIScrollBar_setMax(p,value);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getPos(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getPos(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setPos(s32* p,s32 value)\r\n{\r\n    CKLBUIScrollBar_setPos(p,value);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getSliderSize(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getSliderSize(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setSliderSize(s32* p,s32 value)\r\n{\r\n    CKLBUIScrollBar_setSliderSize(p,value);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getSliderSizeMin(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getSliderSizeMin(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setSliderSizeMin(s32* p,s32 value)\r\n{\r\n    CKLBUIScrollBar_setSliderSizeMin(p,value);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getTouchActive(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getTouchActive(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setTouchActive(s32* p,bool active)\r\n{\r\n    CKLBUIScrollBar_setTouchActive(p,active);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getNormalColor(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getNormalColor(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setNormalColor(s32* p,u32 color)\r\n{\r\n    CKLBUIScrollBar_setNormalColor(p,color);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getActiveColor(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getActiveColor(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setActiveColor(s32* p,u32 color)\r\n{\r\n    CKLBUIScrollBar_setActiveColor(p,color);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setMode(s32* p,u32 mode)\r\n{\r\n    CKLBUIScrollBar_setMode(p,mode);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getVertical(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getVertical(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setVertical(s32* p,bool vertical)\r\n{\r\n    CKLBUIScrollBar_setVertical(p,vertical);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getWidth(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setWidth(s32* p,s32 width)\r\n{\r\n    CKLBUIScrollBar_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getHeight(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setHeight(s32* p,s32 height)\r\n{\r\n    CKLBUIScrollBar_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getOrder(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIScrollBar_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getImage(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getImage(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_getMode(s32* p)\r\n{\r\n    return CKLBUIScrollBar_getMode(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIScrollBar::_ext_CKLBUIScrollBar_selectScrMgr(s32* p,s32* name,s32 len,System::Array<s32>* args)\r\n{\r\n    return CKLBUIScrollBar_selectScrMgr(p,name,len,args ? (s32*)args->_getPArray() : NULL);\r\n}\r\n\r\nEnginePrototype::CKLBUIScrollBar::CKLBUIScrollBar(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,s32 minValue,s32 maxValue,s32 pos,System::String* image,s32 sliderSize,s32 minSliderSize,u32 argbNormal,u32 argbSelect,bool vert,bool active,bool hideMode,EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* callback) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIScrollBar();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIScrollBar_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,width,height,minValue,maxValue,pos,System::__MarshallingUtils::NativeUtf8FromString(image),sliderSize,minSliderSize,argbNormal,argbSelect,vert,active,hideMode);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUIScrollBar::CKLBUIScrollBar() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIScrollBar();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScrollBar::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUI_inner13<CKLBUIScrollBar>(this,&CKLBUIScrollBar::callBackFunction),3);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScrollBar::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScrollBar::callBackFunction(u32 type,s32 pos)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,type,pos);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::callBackFunction$(u32 type,s32 pos) { CHCKTHIS; return callBackFunction(type,pos); }\r\n\r\nvoid EnginePrototype::CKLBUIScrollBar::getSize(EnginePrototype::Size& size)\r\n{\r\n    size._swidth$(_ext_CKLBUIScrollBar_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    size._sheight$(_ext_CKLBUIScrollBar_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::getSize$(EnginePrototype::Size& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIScrollBar::setSize(EnginePrototype::Size size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIScrollBar_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::setSize$(EnginePrototype::Size size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIScrollBar::setSize(s32 width,s32 height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n        _ext_CKLBUIScrollBar_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::setSize$(s32 width,s32 height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIScrollBar::selectScrollManager(System::String* name,System::Array<s32>* args)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        if (args != NULL)\r\n        {\r\n            _ext_CKLBUIScrollBar_selectScrMgr(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(name),args->_acc_gLength$(),args);\r\n        }\r\n        else\r\n        {\r\n            _ext_CKLBUIScrollBar_selectScrMgr(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(name),0,(System::Array<s32>*)NULL);\r\n        }\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIScrollBar::selectScrollManager$(System::String* name,System::Array<s32>* args) { CHCKTHIS; return selectScrollManager(name,args); }\r\n\r\ninline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* EnginePrototype::CKLBUIScrollBar::_sm_callback(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* _$value)  { return (EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* EnginePrototype::CKLBUIScrollBar::_sm_callback$(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sWidth(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sWidth$(s32 value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sHeight(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sHeight$(s32 value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gStart(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getMin(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gStart$() { CHCKTHIS; return _acc_gStart(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sStart(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setMin(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sStart$(s32 value)\t\t{ CHCKTHIS; return _acc_sStart(value); }\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gEnd(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getMax(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gEnd$() { CHCKTHIS; return _acc_gEnd(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sEnd(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setMax(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sEnd$(s32 value)\t\t{ CHCKTHIS; return _acc_sEnd(value); }\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gPos(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getPos(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gPos$() { CHCKTHIS; return _acc_gPos(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sPos(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setPos(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sPos$(s32 value)\t\t{ CHCKTHIS; return _acc_sPos(value); }\r\ninline System::String* EnginePrototype::CKLBUIScrollBar::_acc_gImg(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIScrollBar_getImage(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIScrollBar::_acc_gImg$() { CHCKTHIS; return _acc_gImg(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gSliderSize(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getSliderSize(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gSliderSize$() { CHCKTHIS; return _acc_gSliderSize(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sSliderSize(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setSliderSize(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sSliderSize$(s32 value)\t\t{ CHCKTHIS; return _acc_sSliderSize(value); }\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gSliderSizeMin(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getSliderSizeMin(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_gSliderSizeMin$() { CHCKTHIS; return _acc_gSliderSizeMin(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sSliderSizeMin(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setSliderSizeMin(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIScrollBar::_acc_sSliderSizeMin$(s32 value)\t\t{ CHCKTHIS; return _acc_sSliderSizeMin(value); }\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_gIsVertical(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getVertical(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_gIsVertical$() { CHCKTHIS; return _acc_gIsVertical(); }\r\n\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_sIsVertical(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setVertical(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_sIsVertical$(bool value)\t\t{ CHCKTHIS; return _acc_sIsVertical(value); }\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gArgbNormal(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getNormalColor(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gArgbNormal$() { CHCKTHIS; return _acc_gArgbNormal(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sArgbNormal(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setNormalColor(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sArgbNormal$(u32 value)\t\t{ CHCKTHIS; return _acc_sArgbNormal(value); }\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gArgbActive(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getActiveColor(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gArgbActive$() { CHCKTHIS; return _acc_gArgbActive(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sArgbActive(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setActiveColor(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sArgbActive$(u32 value)\t\t{ CHCKTHIS; return _acc_sArgbActive(value); }\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_gIsTouchActive(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getTouchActive(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_gIsTouchActive$() { CHCKTHIS; return _acc_gIsTouchActive(); }\r\n\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_sIsTouchActive(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setTouchActive(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIScrollBar::_acc_sIsTouchActive$(bool value)\t\t{ CHCKTHIS; return _acc_sIsTouchActive(value); }\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gMode(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIScrollBar_getMode(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_gMode$() { CHCKTHIS; return _acc_gMode(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sMode(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIScrollBar_setMode(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIScrollBar::_acc_sMode$(u32 value)\t\t{ CHCKTHIS; return _acc_sMode(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIScrollBar::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIScrollBar,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIScrollBar::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIScrollBar::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUISimpleItem'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUISimpleItem::_ctor_CKLBUISimpleItem() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUISimpleItem::_ext_CKLBUISimpleItem_create(s32* pParent,u32 order,float x,float y,s32* asset)\r\n{\r\n    return CKLBUISimpleItem_create(pParent,order,x,y,asset);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUISimpleItem::_ext_CKLBUISimpleItem_getOrder(s32* p)\r\n{\r\n    return CKLBUISimpleItem_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISimpleItem::_ext_CKLBUISimpleItem_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUISimpleItem_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUISimpleItem::_ext_CKLBUISimpleItem_getAsset(s32* p)\r\n{\r\n    return CKLBUISimpleItem_getAsset(p);\r\n}\r\n\r\nEnginePrototype::CKLBUISimpleItem::CKLBUISimpleItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::String* asset) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUISimpleItem();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUISimpleItem_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,System::__MarshallingUtils::NativeUtf8FromString(asset));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUISimpleItem::CKLBUISimpleItem() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUISimpleItem();\r\n}\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUISimpleItem::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUISimpleItem_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUISimpleItem::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUISimpleItem::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUISimpleItem_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUISimpleItem::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline System::String* EnginePrototype::CKLBUISimpleItem::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUISimpleItem_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUISimpleItem::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUISimpleItem::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUISimpleItem,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUISimpleItem::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISimpleItem::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISimpleItem::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUISWFPlayer'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ctor_CKLBUISWFPlayer() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_create(s32* parent,u32 order,float x,float y,s32* asset,s32* movieNameconst,System::Array<s32*>* replaceList,s32 assetCnt)\r\n{\r\n    return CKLBUISWFPlayer_create(parent,order,x,y,asset,movieNameconst,replaceList ? (s32**)replaceList->_getPArray() : NULL,assetCnt);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_getPlay(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_getPlay(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_setPlay(s32* p,bool play)\r\n{\r\n    CKLBUISWFPlayer_setPlay(p,play);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_getOrder(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUISWFPlayer_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_gotoFrame(s32* p,s32* label)\r\n{\r\n    CKLBUISWFPlayer_gotoFrame(p,label);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_getFrameRate(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_getFrameRate(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_setFrameRate(s32* p,u32 fps)\r\n{\r\n    CKLBUISWFPlayer_setFrameRate(p,fps);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_isAnimating(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_isAnimating(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_setFrameRateScale(s32* p,float scale)\r\n{\r\n    CKLBUISWFPlayer_setFrameRateScale(p,scale);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_getAsset(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_getAsset(p);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_getMovieName(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_getMovieName(p);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_getVolume(s32* p)\r\n{\r\n    return CKLBUISWFPlayer_getVolume(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_ext_CKLBUISWFPlayer_setVolume(s32* p,float volume)\r\n{\r\n    CKLBUISWFPlayer_setVolume(p,volume);\r\n}\r\n\r\nEnginePrototype::CKLBUISWFPlayer::CKLBUISWFPlayer(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::String* asset,System::String* movieName,EnginePrototype::_Delegate_Base_CallBack_inner47* callback,System::Array<System::String*>* replaceList,s32 assetCnt) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUISWFPlayer();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUISWFPlayer_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,System::__MarshallingUtils::NativeUtf8FromString(asset),System::__MarshallingUtils::NativeUtf8FromString(movieName),((replaceList != NULL) ? System::__MarshallingUtils::NativeUtf8ArrayFromStringArray(replaceList,replaceList->_acc_gLength$()) : NULL),assetCnt);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUISWFPlayer::CKLBUISWFPlayer() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUISWFPlayer();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerS_inner4<CKLBUISWFPlayer>(this,&CKLBUISWFPlayer::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner47*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::callBackFunction(s32* label)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(label));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::callBackFunction$(s32* label) { CHCKTHIS; return callBackFunction(label); }\r\n\r\nvoid EnginePrototype::CKLBUISWFPlayer::play()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setPlay(EnginePrototype::GameObject::_acc_gCppObject$(),true);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::play$() { CHCKTHIS; return play(); }\r\n\r\nvoid EnginePrototype::CKLBUISWFPlayer::stop()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setPlay(EnginePrototype::GameObject::_acc_gCppObject$(),false);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::stop$() { CHCKTHIS; return stop(); }\r\n\r\nvoid EnginePrototype::CKLBUISWFPlayer::goToFrame(System::String* label)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_gotoFrame(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(label));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::goToFrame$(System::String* label) { CHCKTHIS; return goToFrame(label); }\r\n\r\nvoid EnginePrototype::CKLBUISWFPlayer::setFramerateScale(float scale)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setFrameRateScale(EnginePrototype::GameObject::_acc_gCppObject$(),scale);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUISWFPlayer::setFramerateScale$(float scale) { CHCKTHIS; return setFramerateScale(scale); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner47* EnginePrototype::CKLBUISWFPlayer::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner47* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner47*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner47* EnginePrototype::CKLBUISWFPlayer::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner47* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUISWFPlayer_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline System::String* EnginePrototype::CKLBUISWFPlayer::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUISWFPlayer_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUISWFPlayer::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUISWFPlayer::_acc_gMovieName(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUISWFPlayer_getMovieName(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUISWFPlayer::_acc_gMovieName$() { CHCKTHIS; return _acc_gMovieName(); }\r\n\r\ninline bool EnginePrototype::CKLBUISWFPlayer::_acc_gIsPlaying(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUISWFPlayer_getPlay(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUISWFPlayer::_acc_gIsPlaying$() { CHCKTHIS; return _acc_gIsPlaying(); }\r\n\r\ninline bool EnginePrototype::CKLBUISWFPlayer::_acc_sIsPlaying(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setPlay(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUISWFPlayer::_acc_sIsPlaying$(bool value)\t\t{ CHCKTHIS; return _acc_sIsPlaying(value); }\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_gFramerate(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUISWFPlayer_getFrameRate(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_gFramerate$() { CHCKTHIS; return _acc_gFramerate(); }\r\n\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_sFramerate(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setFrameRate(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUISWFPlayer::_acc_sFramerate$(u32 value)\t\t{ CHCKTHIS; return _acc_sFramerate(value); }\r\ninline bool EnginePrototype::CKLBUISWFPlayer::_acc_gIsAnim(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUISWFPlayer_isAnimating(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUISWFPlayer::_acc_gIsAnim$() { CHCKTHIS; return _acc_gIsAnim(); }\r\n\r\ninline float EnginePrototype::CKLBUISWFPlayer::_acc_gVolume(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUISWFPlayer_getVolume(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUISWFPlayer::_acc_gVolume$() { CHCKTHIS; return _acc_gVolume(); }\r\n\r\ninline float EnginePrototype::CKLBUISWFPlayer::_acc_sVolume(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUISWFPlayer_setVolume(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUISWFPlayer::_acc_sVolume$(float value)\t\t{ CHCKTHIS; return _acc_sVolume(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUISWFPlayer::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUISWFPlayer,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUISWFPlayer::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUISWFPlayer::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUITask'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUITask::_ctor_CKLBUITask() {\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUITask::_ext_CKLBUITask_getVisible(s32* p)\r\n{\r\n    return CKLBUITask_getVisible(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setVisible(s32* p,bool isVisible)\r\n{\r\n    CKLBUITask_setVisible(p,isVisible);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUITask::_ext_CKLBUITask_getScaleX(s32* p)\r\n{\r\n    return CKLBUITask_getScaleX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setScaleX(s32* p,float scaleX)\r\n{\r\n    CKLBUITask_setScaleX(p,scaleX);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUITask::_ext_CKLBUITask_getScaleY(s32* p)\r\n{\r\n    return CKLBUITask_getScaleY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setScaleY(s32* p,float scaleY)\r\n{\r\n    CKLBUITask_setScaleY(p,scaleY);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUITask::_ext_CKLBUITask_getX(s32* p)\r\n{\r\n    return CKLBUITask_getX(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setX(s32* p,float x)\r\n{\r\n    CKLBUITask_setX(p,x);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUITask::_ext_CKLBUITask_getY(s32* p)\r\n{\r\n    return CKLBUITask_getY(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setY(s32* p,float y)\r\n{\r\n    CKLBUITask_setY(p,y);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUITask::_ext_CKLBUITask_getRotation(s32* p)\r\n{\r\n    return CKLBUITask_getRotation(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setRotation(s32* p,float rotation)\r\n{\r\n    CKLBUITask_setRotation(p,rotation);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUITask::_ext_CKLBUITask_getArgb(s32* p)\r\n{\r\n    return CKLBUITask_getArgb(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setArgb(s32* p,u32 argb)\r\n{\r\n    CKLBUITask_setArgb(p,argb);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUITask::_ext_CKLBUITask_isAnim(s32* p)\r\n{\r\n    return CKLBUITask_isAnim(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_play(s32* p)\r\n{\r\n    CKLBUITask_play(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_stop(s32* p)\r\n{\r\n    CKLBUITask_stop(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUITask::_ext_CKLBUITask_setParamCount(s32* p,u32 splineCount,u32 maxKeyCount)\r\n{\r\n    return CKLBUITask_setParamCount(p,splineCount,maxKeyCount);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_setTarget(s32* p,u32 splineIndex,s32 targetParameter)\r\n{\r\n    CKLBUITask_setTarget(p,splineIndex,targetParameter);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_addKeys(s32* p,u32 splineIndex,u32 time,s32 value)\r\n{\r\n    CKLBUITask_addKeys(p,splineIndex,time,value);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_addKeysFixed(s32* p,u32 splineIndex,u32 time,s32 fixed16Value)\r\n{\r\n    CKLBUITask_addKeysFixed(p,splineIndex,time,fixed16Value);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITask::_ext_CKLBUITask_generateAnimation(s32* p)\r\n{\r\n    CKLBUITask_generateAnimation(p);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUITask::_ext_CKLBUITask_reconnect(s32* p,s32* nodeName)\r\n{\r\n    return CKLBUITask_reconnect(p,nodeName);\r\n}\r\n\r\nEnginePrototype::CKLBUITask::CKLBUITask(u32 classID) : EnginePrototype::CKLBTask(classID)\r\n{\r\n    _ctor_CKLBUITask();\r\n}\r\n\r\nEnginePrototype::NodeIterator* EnginePrototype::CKLBUITask::_ref_getIterator(EnginePrototype::NodeIterator*& nodeIterator)\r\n{\r\n    u32 counter = EnginePrototype::NativeManagement::getContextCounter();\r\n    s32* node = EnginePrototype::NodeIterator::getNodeFromTask(this);\r\n    nodeIterator = CS_NEW EnginePrototype::NodeIterator(counter,node);\r\n    return nodeIterator;\r\n}\r\n\r\ninline EnginePrototype::NodeIterator* EnginePrototype::CKLBUITask::getIterator$(EnginePrototype::NodeIterator*& nodeIterator) { CHCKTHIS; return getIterator(nodeIterator); }\r\n\r\ninline EnginePrototype::NodeIterator* EnginePrototype::CKLBUITask::getIterator(EnginePrototype::NodeIterator*& nodeIterator) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); EnginePrototype::NodeIterator* r = _ref_getIterator(nodeIterator); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\r\n\r\nEnginePrototype::NodeIterator* EnginePrototype::CKLBUITask::_ref_getIteratorFromName(System::String* name,EnginePrototype::NodeIterator*& nodeIterator)\r\n{\r\n    nodeIterator = getIterator$(nodeIterator);\r\n    if (!nodeIterator->find$(name,false))\r\n    {\r\n        nodeIterator = NULL;\r\n    }\r\n    return nodeIterator;\r\n}\r\n\r\ninline EnginePrototype::NodeIterator* EnginePrototype::CKLBUITask::getIteratorFromName$(System::String* name,EnginePrototype::NodeIterator*& nodeIterator) { CHCKTHIS; return getIteratorFromName(name,nodeIterator); }\r\n\r\ninline EnginePrototype::NodeIterator* EnginePrototype::CKLBUITask::getIteratorFromName(System::String* name,EnginePrototype::NodeIterator*& nodeIterator) { System::RefHolder _cs_refholder_loc_array[1]; u32 _cs_count_refholder = _refCallFinish_(_cs_refholder_loc_array); EnginePrototype::NodeIterator* r = _ref_getIteratorFromName(name,nodeIterator); _refRemove_(_cs_count_refholder,_cs_refholder_loc_array); return r; }\r\n\r\nvoid EnginePrototype::CKLBUITask::nodeReconnect(System::String* nodeName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_reconnect(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(nodeName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITask::nodeReconnect$(System::String* nodeName) { CHCKTHIS; return nodeReconnect(nodeName); }\r\n\r\nvoid EnginePrototype::CKLBUITask::animationPlay()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_play(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITask::animationPlay$() { CHCKTHIS; return animationPlay(); }\r\n\r\nvoid EnginePrototype::CKLBUITask::animationStop()\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_stop(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITask::animationStop$() { CHCKTHIS; return animationStop(); }\r\n\r\nvoid EnginePrototype::CKLBUITask::setScale(float scaleX,float scaleY)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setScaleX(EnginePrototype::GameObject::_acc_gCppObject$(),scaleX);\r\n        _ext_CKLBUITask_setScaleY(EnginePrototype::GameObject::_acc_gCppObject$(),scaleY);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITask::setScale$(float scaleX,float scaleY) { CHCKTHIS; return setScale(scaleX,scaleY); }\r\n\r\nvoid EnginePrototype::CKLBUITask::setAnimSpline(EnginePrototype::AnimSpline_inner9* splineArray)\r\n{\r\n    u32 maxKeyCount = 0;\r\n    for (s32 i = 0;i < splineArray->_acc_gSplines$()->_acc_gCount$();++i)\r\n    {\r\n        if (splineArray->_acc_gSplines$()->_idx_g$(i)->_acc_gKeyCount$() > maxKeyCount)\r\n        {\r\n            maxKeyCount = splineArray->_acc_gSplines$()->_idx_g$(i)->_acc_gKeyCount$();\r\n        }\r\n    }\r\n    if (_ext_CKLBUITask_setParamCount(EnginePrototype::GameObject::_acc_gCppObject$(),(u32)splineArray->_acc_gSplines$()->_acc_gCount$(),maxKeyCount))\r\n    {\r\n        u32 splineIndex = 0;\r\n        for (s32 i = 0;i < splineArray->_acc_gSplines$()->_acc_gCount$();++i)\r\n        {\r\n            _ext_CKLBUITask_setTarget(EnginePrototype::GameObject::_acc_gCppObject$(),splineIndex,splineArray->_acc_gSplines$()->_idx_g$(i)->_acc_gTargetType$());\r\n            splineArray->_acc_gSplines$()->_idx_g$(i)->addKeys$(EnginePrototype::GameObject::_acc_gCppObject$(),splineIndex++);\r\n        }\r\n        _ext_CKLBUITask_generateAnimation(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITask::setAnimSpline$(EnginePrototype::AnimSpline_inner9* splineArray) { CHCKTHIS; return setAnimSpline(splineArray); }\r\n\r\nEnginePrototype::CKLBUITask::CKLBUITask() { _ctor_CKLBUITask(); }\r\n\r\n\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_gScaleX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getScaleX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_gScaleX$() { CHCKTHIS; return _acc_gScaleX(); }\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_sScaleX(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setScaleX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUITask::_acc_sScaleX$(float value)\t\t{ CHCKTHIS; return _acc_sScaleX(value); }\r\ninline float EnginePrototype::CKLBUITask::_acc_gScaleY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getScaleY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_gScaleY$() { CHCKTHIS; return _acc_gScaleY(); }\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_sScaleY(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setScaleY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUITask::_acc_sScaleY$(float value)\t\t{ CHCKTHIS; return _acc_sScaleY(value); }\r\ninline float EnginePrototype::CKLBUITask::_acc_gRotation(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getRotation(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_gRotation$() { CHCKTHIS; return _acc_gRotation(); }\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_sRotation(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setRotation(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUITask::_acc_sRotation$(float value)\t\t{ CHCKTHIS; return _acc_sRotation(value); }\r\ninline float EnginePrototype::CKLBUITask::_acc_gX(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getX(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_gX$() { CHCKTHIS; return _acc_gX(); }\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_sX(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setX(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUITask::_acc_sX$(float value)\t\t{ CHCKTHIS; return _acc_sX(value); }\r\ninline float EnginePrototype::CKLBUITask::_acc_gY(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getY(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_gY$() { CHCKTHIS; return _acc_gY(); }\r\n\r\ninline float EnginePrototype::CKLBUITask::_acc_sY(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setY(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUITask::_acc_sY$(float value)\t\t{ CHCKTHIS; return _acc_sY(value); }\r\ninline bool EnginePrototype::CKLBUITask::_acc_gIsVisible(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getVisible(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUITask::_acc_gIsVisible$() { CHCKTHIS; return _acc_gIsVisible(); }\r\n\r\ninline bool EnginePrototype::CKLBUITask::_acc_sIsVisible(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setVisible(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUITask::_acc_sIsVisible$(bool value)\t\t{ CHCKTHIS; return _acc_sIsVisible(value); }\r\ninline u32 EnginePrototype::CKLBUITask::_acc_gArgb(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_getArgb(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUITask::_acc_gArgb$() { CHCKTHIS; return _acc_gArgb(); }\r\n\r\ninline u32 EnginePrototype::CKLBUITask::_acc_sArgb(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITask_setArgb(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUITask::_acc_sArgb$(u32 value)\t\t{ CHCKTHIS; return _acc_sArgb(value); }\r\ninline bool EnginePrototype::CKLBUITask::_acc_gIsNodeAnim(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITask_isAnim(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUITask::_acc_gIsNodeAnim$() { CHCKTHIS; return _acc_gIsNodeAnim(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUITask::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUITask,EnginePrototype::CKLBTask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUITask::_processGC() {\r\n    EnginePrototype::CKLBTask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITask::_releaseGC() {\r\n    EnginePrototype::CKLBTask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITask::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBTask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'Spline_inner4'\r\n//=============================\r\n\r\nvoid EnginePrototype::Spline_inner4::_ctor_Spline_inner4() {\r\n}\r\n\r\nEnginePrototype::Spline_inner4::Spline_inner4(s32 targetType)\r\n{\r\n    _ctor_Spline_inner4();\r\n    _sm_targetType$(targetType);\r\n}\r\n\r\ninline void EnginePrototype::Spline_inner4::addKeyInt$(u32 time,s32 value) { CHCKTHIS; return addKeyInt(time,value); }\r\n\r\ninline void EnginePrototype::Spline_inner4::addKeyFloat$(u32 time,float value) { CHCKTHIS; return addKeyFloat(time,value); }\r\n\r\ninline void EnginePrototype::Spline_inner4::addKeys$(s32* p,u32 splineIndex) { CHCKTHIS; return addKeys(p,splineIndex); }\r\n\r\nEnginePrototype::Spline_inner4::Spline_inner4() { _ctor_Spline_inner4(); }\r\n\r\n\r\n\r\ninline s32 EnginePrototype::Spline_inner4::_acc_gTargetType(){\r\n    return _gm_targetType$();\r\n}\r\n\r\ninline s32 EnginePrototype::Spline_inner4::_acc_gTargetType$() { CHCKTHIS; return _acc_gTargetType(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::Spline_inner4::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Spline_inner4,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::Spline_inner4::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Spline_inner4::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::Spline_inner4::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'IntSpline_inner5'\r\n//=============================\r\n\r\nvoid EnginePrototype::IntSpline_inner5::_ctor_IntSpline_inner5() {\r\n}\r\n\r\nEnginePrototype::IntSpline_inner5::IntSpline_inner5(s32 targetType) : EnginePrototype::Spline_inner4(targetType)\r\n{\r\n    _ctor_IntSpline_inner5();\r\n    _sm_points$(CS_NEW System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>());\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::IntSpline_inner5::addKeyInt(u32 time,s32 value)\r\n{\r\n    if (value <= 32767)\r\n    {\r\n        _gm_points$()->Add$(CS_NEW EnginePrototype::IntPoint_inner6(time,(s16)value));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr105Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::IntSpline_inner5::addKeyInt$(u32 time,s32 value) { CHCKTHIS; return addKeyInt(time,value); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::IntSpline_inner5::addKeyFloat(u32 time,float value)\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionForbiddenMethod(_$_cteStr2Obj));\r\n}\r\n\r\ninline void EnginePrototype::IntSpline_inner5::addKeyFloat$(u32 time,float value) { CHCKTHIS; return addKeyFloat(time,value); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::IntSpline_inner5::addKeys(s32* p,u32 splineIndex)\r\n{\r\n    for (s32 i = 0;i < _gm_points$()->_acc_gCount$();++i)\r\n    {\r\n        EnginePrototype::CKLBUITask::_ext_CKLBUITask_addKeys(p,splineIndex,_gm_points$()->_idx_g$(i)->_acc_gTime$(),_gm_points$()->_idx_g$(i)->_acc_gValue$());\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::IntSpline_inner5::addKeys$(s32* p,u32 splineIndex) { CHCKTHIS; return addKeys(p,splineIndex); }\r\n\r\nEnginePrototype::IntSpline_inner5::IntSpline_inner5() { _ctor_IntSpline_inner5(); }\r\n\r\ninline System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* EnginePrototype::IntSpline_inner5::_sm_points(System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* _$value)  { return (System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_points,_$value); }\r\ninline System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* EnginePrototype::IntSpline_inner5::_sm_points$(System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* _$value) { CHCKTHIS; return _sm_points(_$value); }\r\n\r\n\r\n u32 EnginePrototype::IntSpline_inner5::_acc_gKeyCount(){\r\n    return (u32)_gm_points$()->_acc_gCount$();\r\n}\r\n\r\ninline u32 EnginePrototype::IntSpline_inner5::_acc_gKeyCount$() { CHCKTHIS; return _acc_gKeyCount(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::IntSpline_inner5::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(IntSpline_inner5,EnginePrototype::Spline_inner4);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::IntSpline_inner5::_processGC() {\r\n    EnginePrototype::Spline_inner4::_processGC();\r\n\r\n    if (m_points) { System::Memory::pushList(m_points,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::IntSpline_inner5::_releaseGC() {\r\n    EnginePrototype::Spline_inner4::_releaseGC();\r\n\r\n    if (m_points && !m_points->isFreed()) { m_points->_removeRef((System::__GCObject**)&m_points); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::IntSpline_inner5::_moveAlert(u32 offset) {\r\n    EnginePrototype::Spline_inner4::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_points) {\r\n      newPtr = (u8*)(&m_points); oldPtr = newPtr - offset;\r\n      m_points->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'IntPoint_inner6'\r\n//=============================\r\n\r\nvoid EnginePrototype::IntPoint_inner6::_ctor_IntPoint_inner6() {\r\n}\r\n\r\nEnginePrototype::IntPoint_inner6::IntPoint_inner6(u32 time,s16 value)\r\n{\r\n    _ctor_IntPoint_inner6();\r\n    _sm_time$(time);\r\n    _sm_value$(value);\r\n}\r\n\r\nEnginePrototype::IntPoint_inner6::IntPoint_inner6() { _ctor_IntPoint_inner6(); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::IntPoint_inner6::_acc_gTime(){\r\n    return _gm_time$();\r\n}\r\n\r\ninline u32 EnginePrototype::IntPoint_inner6::_acc_gTime$() { CHCKTHIS; return _acc_gTime(); }\r\n\r\ninline s16 EnginePrototype::IntPoint_inner6::_acc_gValue(){\r\n    return _gm_value$();\r\n}\r\n\r\ninline s16 EnginePrototype::IntPoint_inner6::_acc_gValue$() { CHCKTHIS; return _acc_gValue(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::IntPoint_inner6::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(IntPoint_inner6,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::IntPoint_inner6::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::IntPoint_inner6::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::IntPoint_inner6::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'FloatSpline_inner7'\r\n//=============================\r\n\r\nvoid EnginePrototype::FloatSpline_inner7::_ctor_FloatSpline_inner7() {\r\n}\r\n\r\nEnginePrototype::FloatSpline_inner7::FloatSpline_inner7(s32 targetType) : EnginePrototype::Spline_inner4(targetType)\r\n{\r\n    _ctor_FloatSpline_inner7();\r\n    _sm_points$(CS_NEW System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>());\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::FloatSpline_inner7::addKeyFloat(u32 time,float value)\r\n{\r\n    _gm_points$()->Add$(CS_NEW EnginePrototype::FloatPoint_inner8(time,value));\r\n}\r\n\r\ninline void EnginePrototype::FloatSpline_inner7::addKeyFloat$(u32 time,float value) { CHCKTHIS; return addKeyFloat(time,value); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::FloatSpline_inner7::addKeyInt(u32 time,s32 value)\r\n{\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionForbiddenMethod(_$_cteStr2Obj));\r\n}\r\n\r\ninline void EnginePrototype::FloatSpline_inner7::addKeyInt$(u32 time,s32 value) { CHCKTHIS; return addKeyInt(time,value); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::FloatSpline_inner7::addKeys(s32* p,u32 splineIndex)\r\n{\r\n    for (s32 i = 0;i < _gm_points$()->_acc_gCount$();++i)\r\n    {\r\n        EnginePrototype::CKLBUITask::_ext_CKLBUITask_addKeysFixed(p,splineIndex,_gm_points$()->_idx_g$(i)->_acc_gTime$(),(s32)(_gm_points$()->_idx_g$(i)->_acc_gValue$() * 65536.000000));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::FloatSpline_inner7::addKeys$(s32* p,u32 splineIndex) { CHCKTHIS; return addKeys(p,splineIndex); }\r\n\r\nEnginePrototype::FloatSpline_inner7::FloatSpline_inner7() { _ctor_FloatSpline_inner7(); }\r\n\r\ninline System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* EnginePrototype::FloatSpline_inner7::_sm_points(System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* _$value)  { return (System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_points,_$value); }\r\ninline System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* EnginePrototype::FloatSpline_inner7::_sm_points$(System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* _$value) { CHCKTHIS; return _sm_points(_$value); }\r\n\r\n\r\n u32 EnginePrototype::FloatSpline_inner7::_acc_gKeyCount(){\r\n    return (u32)_gm_points$()->_acc_gCount$();\r\n}\r\n\r\ninline u32 EnginePrototype::FloatSpline_inner7::_acc_gKeyCount$() { CHCKTHIS; return _acc_gKeyCount(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::FloatSpline_inner7::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(FloatSpline_inner7,EnginePrototype::Spline_inner4);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::FloatSpline_inner7::_processGC() {\r\n    EnginePrototype::Spline_inner4::_processGC();\r\n\r\n    if (m_points) { System::Memory::pushList(m_points,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::FloatSpline_inner7::_releaseGC() {\r\n    EnginePrototype::Spline_inner4::_releaseGC();\r\n\r\n    if (m_points && !m_points->isFreed()) { m_points->_removeRef((System::__GCObject**)&m_points); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::FloatSpline_inner7::_moveAlert(u32 offset) {\r\n    EnginePrototype::Spline_inner4::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_points) {\r\n      newPtr = (u8*)(&m_points); oldPtr = newPtr - offset;\r\n      m_points->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'FloatPoint_inner8'\r\n//=============================\r\n\r\nvoid EnginePrototype::FloatPoint_inner8::_ctor_FloatPoint_inner8() {\r\n}\r\n\r\nEnginePrototype::FloatPoint_inner8::FloatPoint_inner8(u32 time,float value)\r\n{\r\n    _ctor_FloatPoint_inner8();\r\n    _sm_time$(time);\r\n    _sm_value$(value);\r\n}\r\n\r\nEnginePrototype::FloatPoint_inner8::FloatPoint_inner8() { _ctor_FloatPoint_inner8(); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::FloatPoint_inner8::_acc_gTime(){\r\n    return _gm_time$();\r\n}\r\n\r\ninline u32 EnginePrototype::FloatPoint_inner8::_acc_gTime$() { CHCKTHIS; return _acc_gTime(); }\r\n\r\ninline float EnginePrototype::FloatPoint_inner8::_acc_gValue(){\r\n    return _gm_value$();\r\n}\r\n\r\ninline float EnginePrototype::FloatPoint_inner8::_acc_gValue$() { CHCKTHIS; return _acc_gValue(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::FloatPoint_inner8::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(FloatPoint_inner8,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::FloatPoint_inner8::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::FloatPoint_inner8::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::FloatPoint_inner8::_moveAlert(u32 offset) {\r\n}\r\n\r\n//=============================\r\n// Implementation of 'AnimSpline_inner9'\r\n//=============================\r\n\r\nvoid EnginePrototype::AnimSpline_inner9::_ctor_AnimSpline_inner9() {\r\n}\r\n\r\nEnginePrototype::AnimSpline_inner9::AnimSpline_inner9()\r\n{\r\n    _ctor_AnimSpline_inner9();\r\n    _sm_splines$(CS_NEW System::Collections::Generic::List<EnginePrototype::Spline_inner4*>());\r\n}\r\n\r\nEnginePrototype::Spline_inner4* EnginePrototype::AnimSpline_inner9::addNewSpline(s32 targetType,s32 splineType)\r\n{\r\n    switch (splineType) {\r\n    case EnginePrototype::CKLBUITask::ESPLINE_TYPE::INT_SPLINE: sw_$lbl_1_0:\r\n        {\r\n            EnginePrototype::IntSpline_inner5* spline = CS_NEW EnginePrototype::IntSpline_inner5(targetType);\r\n            _gm_splines$()->Add$(spline);\r\n            return spline;\r\n        }\r\n    case EnginePrototype::CKLBUITask::ESPLINE_TYPE::FLOAT_SPLINE: sw_$lbl_1_1:\r\n        {\r\n            EnginePrototype::FloatSpline_inner7* spline = CS_NEW EnginePrototype::FloatSpline_inner7(targetType);\r\n            _gm_splines$()->Add$(spline);\r\n            return spline;\r\n        }\r\n    default : sw_$lbl_1_default:\r\n        return NULL;\r\n    }\r\n}\r\n\r\ninline EnginePrototype::Spline_inner4* EnginePrototype::AnimSpline_inner9::addNewSpline$(s32 targetType,s32 splineType) { CHCKTHIS; return addNewSpline(targetType,splineType); }\r\n\r\nvoid EnginePrototype::AnimSpline_inner9::reset()\r\n{\r\n    _gm_splines$()->Clear$();\r\n}\r\n\r\ninline void EnginePrototype::AnimSpline_inner9::reset$() { CHCKTHIS; return reset(); }\r\n\r\ninline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* EnginePrototype::AnimSpline_inner9::_sm_splines(System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _$value)  { return (System::Collections::Generic::List<EnginePrototype::Spline_inner4*>*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_splines,_$value); }\r\ninline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* EnginePrototype::AnimSpline_inner9::_sm_splines$(System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _$value) { CHCKTHIS; return _sm_splines(_$value); }\r\n\r\n\r\ninline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* EnginePrototype::AnimSpline_inner9::_acc_gSplines(){\r\n    return _gm_splines$();\r\n}\r\n\r\ninline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* EnginePrototype::AnimSpline_inner9::_acc_gSplines$() { CHCKTHIS; return _acc_gSplines(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::AnimSpline_inner9::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(AnimSpline_inner9,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::AnimSpline_inner9::_processGC() {\r\n    if (m_splines) { System::Memory::pushList(m_splines,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::AnimSpline_inner9::_releaseGC() {\r\n    if (m_splines && !m_splines->isFreed()) { m_splines->_removeRef((System::__GCObject**)&m_splines); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::AnimSpline_inner9::_moveAlert(u32 offset) {\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_splines) {\r\n      newPtr = (u8*)(&m_splines); oldPtr = newPtr - offset;\r\n      m_splines->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUITextInput'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUITextInput::_ctor_CKLBUITextInput() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_create(s32* parent,bool passwordMode,float x,float y,float width,float height,s32* defaultText,s32 widgetId,s32 maxLen,u32 charType)\r\n{\r\n    return CKLBUITextInput_create(parent,passwordMode,x,y,width,height,defaultText,widgetId,maxLen,charType);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_getWidth(s32* p)\r\n{\r\n    return CKLBUITextInput_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setWidth(s32* p,u32 width)\r\n{\r\n    CKLBUITextInput_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_getHeight(s32* p)\r\n{\r\n    return CKLBUITextInput_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setHeight(s32* p,u32 height)\r\n{\r\n    CKLBUITextInput_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_getText(s32* p)\r\n{\r\n    return CKLBUITextInput_getText(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setText(s32* p,s32* text)\r\n{\r\n    CKLBUITextInput_setText(p,text);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setPlaceHolder(s32* p,s32* placeholder)\r\n{\r\n    CKLBUITextInput_setPlaceHolder(p,placeholder);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setColor(s32* p,bool bTouch,u32 foregroundRgb,u32 backgroundRgb)\r\n{\r\n    CKLBUITextInput_setColor(p,bTouch,foregroundRgb,backgroundRgb);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_getMaxLen(s32* p)\r\n{\r\n    return CKLBUITextInput_getMaxLen(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setMaxLen(s32* p,s32 maxlen)\r\n{\r\n    CKLBUITextInput_setMaxLen(p,maxlen);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setCharType(s32* p,u32 chartype)\r\n{\r\n    CKLBUITextInput_setCharType(p,chartype);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_getCharCount(s32* p)\r\n{\r\n    return CKLBUITextInput_getCharCount(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITextInput::_ext_CKLBUITextInput_setFont(s32* p,s32* fontName,float fontSize)\r\n{\r\n    CKLBUITextInput_setFont(p,fontName,fontSize);\r\n}\r\n\r\nEnginePrototype::CKLBUITextInput::CKLBUITextInput(EnginePrototype::CKLBUITask* parent,bool passwordMode,s32 x,s32 y,u32 width,u32 height,System::String* defaultText,EnginePrototype::_Delegate_Base_CallBack_inner48* callback,s32 widgetId,s32 maxLen,u32 charType) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUITextInput();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUITextInput_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),passwordMode,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(defaultText),widgetId,maxLen,charType);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUITextInput::CKLBUITextInput() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUITextInput();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITextInput::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerSU_inner6<CKLBUITextInput>(this,&CKLBUITextInput::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITextInput::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner48*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITextInput::callBackFunction(s32* txt,u32 id)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,System::__MarshallingUtils::StringFromNativeUtf8(txt),id);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::callBackFunction$(s32* txt,u32 id) { CHCKTHIS; return callBackFunction(txt,id); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::getSize(EnginePrototype::USize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUITextInput_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUITextInput_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::getSize$(EnginePrototype::USize& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::setSize(EnginePrototype::USize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITextInput_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUITextInput_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setSize$(EnginePrototype::USize size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::setSize(u32 width,u32 height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITextInput_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n        _ext_CKLBUITextInput_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setSize$(u32 width,u32 height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::setColor(bool bTouch,u32 foregroundRgb,u32 backgroundRgb)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setColor(EnginePrototype::GameObject::_acc_gCppObject$(),bTouch,foregroundRgb,backgroundRgb);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setColor$(bool bTouch,u32 foregroundRgb,u32 backgroundRgb) { CHCKTHIS; return setColor(bTouch,foregroundRgb,backgroundRgb); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::setFont(System::String* fontName,float fontSize)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setFont(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(fontName),fontSize);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setFont$(System::String* fontName,float fontSize) { CHCKTHIS; return setFont(fontName,fontSize); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::setCharType(s32 chartype)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setCharType(EnginePrototype::GameObject::_acc_gCppObject$(),(u32)chartype);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setCharType$(s32 chartype) { CHCKTHIS; return setCharType(chartype); }\r\n\r\nvoid EnginePrototype::CKLBUITextInput::setPlaceHolder(System::String* placeHolder)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setPlaceHolder(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(placeHolder));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITextInput::setPlaceHolder$(System::String* placeHolder) { CHCKTHIS; return setPlaceHolder(placeHolder); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner48* EnginePrototype::CKLBUITextInput::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner48* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner48*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner48* EnginePrototype::CKLBUITextInput::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner48* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUITextInput_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_sWidth(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_sWidth$(u32 value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUITextInput_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_sHeight(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUITextInput::_acc_sHeight$(u32 value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline System::String* EnginePrototype::CKLBUITextInput::_acc_gText(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUITextInput_getText(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUITextInput::_acc_gText$() { CHCKTHIS; return _acc_gText(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUITextInput::_acc_sText(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setText(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUITextInput::_acc_sText$(System::String* value)\t\t{ CHCKTHIS; return _acc_sText(value); }\r\ninline s32 EnginePrototype::CKLBUITextInput::_acc_gMaxLen(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUITextInput_getMaxLen(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUITextInput::_acc_gMaxLen$() { CHCKTHIS; return _acc_gMaxLen(); }\r\n\r\ninline s32 EnginePrototype::CKLBUITextInput::_acc_sMaxLen(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUITextInput_setMaxLen(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUITextInput::_acc_sMaxLen$(s32 value)\t\t{ CHCKTHIS; return _acc_sMaxLen(value); }\r\ninline s32 EnginePrototype::CKLBUITextInput::_acc_gCharCount(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUITextInput_getCharCount(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUITextInput::_acc_gCharCount$() { CHCKTHIS; return _acc_gCharCount(); }\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUITextInput::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUITextInput,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUITextInput::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITextInput::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITextInput::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUITouchPad'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUITouchPad::_ctor_CKLBUITouchPad() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUITouchPad::_ext_CKLBUITouchPad_create(s32* pParent,bool modal)\r\n{\r\n    return CKLBUITouchPad_create(pParent,modal);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUITouchPad::_ext_CKLBUITouchPad_setGroup(s32* p,s32* group_name)\r\n{\r\n    return CKLBUITouchPad_setGroup(p,group_name);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITouchPad::_ext_CKLBUITouchPad_setLock(s32* p,bool lock_mode)\r\n{\r\n    CKLBUITouchPad_setLock(p,lock_mode);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUITouchPad::_ext_CKLBUITouchPad_setGetAll(s32* p,bool bAll)\r\n{\r\n    CKLBUITouchPad_setGetAll(p,bAll);\r\n}\r\n\r\nEnginePrototype::CKLBUITouchPad::CKLBUITouchPad(EnginePrototype::CKLBTask* parent,EnginePrototype::_Delegate_Base_CallBack_inner49* callback,bool modal) : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBUITouchPad();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUITouchPad_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),modal);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUITouchPad::CKLBUITouchPad() : EnginePrototype::CKLBTask(s_classID)\r\n{\r\n    _ctor_CKLBUITouchPad();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITouchPad::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUUUII_inner18<CKLBUITouchPad>(this,&CKLBUITouchPad::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITouchPad::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITouchPad::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner49*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITouchPad::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITouchPad::callBackFunction(u32 execount,u32 type,u32 id,s32 x,s32 y)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,execount,type,id,x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITouchPad::callBackFunction$(u32 execount,u32 type,u32 id,s32 x,s32 y) { CHCKTHIS; return callBackFunction(execount,type,id,x,y); }\r\n\r\nvoid EnginePrototype::CKLBUITouchPad::setGetAll(bool bGetAll)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITouchPad_setGetAll(EnginePrototype::GameObject::_acc_gCppObject$(),bGetAll);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITouchPad::setGetAll$(bool bGetAll) { CHCKTHIS; return setGetAll(bGetAll); }\r\n\r\nvoid EnginePrototype::CKLBUITouchPad::setLock(bool bLock)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUITouchPad_setLock(EnginePrototype::GameObject::_acc_gCppObject$(),bLock);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUITouchPad::setLock$(bool bLock) { CHCKTHIS; return setLock(bLock); }\r\n\r\nbool EnginePrototype::CKLBUITouchPad::setGroup(System::String* group_name)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUITouchPad_setGroup(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(group_name));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUITouchPad::setGroup$(System::String* group_name) { CHCKTHIS; return setGroup(group_name); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner49* EnginePrototype::CKLBUITouchPad::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner49* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner49*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner49* EnginePrototype::CKLBUITouchPad::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner49* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUITouchPad::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUITouchPad,EnginePrototype::CKLBTask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUITouchPad::_processGC() {\r\n    EnginePrototype::CKLBTask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITouchPad::_releaseGC() {\r\n    EnginePrototype::CKLBTask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUITouchPad::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBTask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIVariableItem'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIVariableItem::_ctor_CKLBUIVariableItem() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_create(s32* pParent,u32 order,float x,float y,float width,float height,s32* asset)\r\n{\r\n    return CKLBUIVariableItem_create(pParent,order,x,y,width,height,asset);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_getOrder(s32* p)\r\n{\r\n    return CKLBUIVariableItem_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIVariableItem_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_getAsset(s32* p)\r\n{\r\n    return CKLBUIVariableItem_getAsset(p);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_getWidth(s32* p)\r\n{\r\n    return CKLBUIVariableItem_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_setWidth(s32* p,float width)\r\n{\r\n    CKLBUIVariableItem_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nfloat EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_getHeight(s32* p)\r\n{\r\n    return CKLBUIVariableItem_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_setHeight(s32* p,float height)\r\n{\r\n    CKLBUIVariableItem_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_changeAsset(s32* p,s32* assetName)\r\n{\r\n    return CKLBUIVariableItem_changeAsset(p,assetName);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_changeUV(s32* p,float x,float y,float width,float height)\r\n{\r\n    CKLBUIVariableItem_changeUV(p,x,y,width,height);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIVariableItem::_ext_CKLBUIVariableItem_setMaskAsset(s32* p,s32* assetName)\r\n{\r\n    return CKLBUIVariableItem_setMaskAsset(p,assetName);\r\n}\r\n\r\nEnginePrototype::CKLBUIVariableItem::CKLBUIVariableItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,System::String* asset) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIVariableItem();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIVariableItem_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(asset));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n}\r\n\r\nEnginePrototype::CKLBUIVariableItem::CKLBUIVariableItem() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIVariableItem();\r\n}\r\n\r\nvoid EnginePrototype::CKLBUIVariableItem::getSize(EnginePrototype::FSize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIVariableItem_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIVariableItem_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVariableItem::getSize$(EnginePrototype::FSize& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIVariableItem::setUV(float x,float y,float width,float height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVariableItem_changeUV(EnginePrototype::GameObject::_acc_gCppObject$(),x,y,width,height);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVariableItem::setUV$(float x,float y,float width,float height) { CHCKTHIS; return setUV(x,y,width,height); }\r\n\r\nbool EnginePrototype::CKLBUIVariableItem::setMaskAsset(System::String* assetName)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVariableItem_setMaskAsset(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(assetName));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIVariableItem::setMaskAsset$(System::String* assetName) { CHCKTHIS; return setMaskAsset(assetName); }\r\n\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIVariableItem::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVariableItem_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVariableItem::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVariableItem::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVariableItem_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVariableItem::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline System::String* EnginePrototype::CKLBUIVariableItem::_acc_gAsset(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIVariableItem_getAsset(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIVariableItem::_acc_gAsset$() { CHCKTHIS; return _acc_gAsset(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIVariableItem::_acc_sAsset(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        _ext_CKLBUIVariableItem_changeAsset(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIVariableItem::_acc_sAsset$(System::String* value)\t\t{ CHCKTHIS; return _acc_sAsset(value); }\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVariableItem_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_sWidth(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVariableItem_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_sWidth$(float value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVariableItem_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_sHeight(float value){\r\n    float _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVariableItem_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline float EnginePrototype::CKLBUIVariableItem::_acc_sHeight$(float value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIVariableItem::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIVariableItem,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIVariableItem::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVariableItem::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVariableItem::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIVirtualDoc'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ctor_CKLBUIVirtualDoc() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_create(s32* pParent,u32 order,float x,float y,u32 docWidth,u32 docHeight,u32 viewWidth,u32 viewHeight,u32 maxCommandNums,bool verticalFlag)\r\n{\r\n    return CKLBUIVirtualDoc_create(pParent,order,x,y,docWidth,docHeight,viewWidth,viewHeight,maxCommandNums,verticalFlag);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_clear(s32* p,u32 color)\r\n{\r\n    CKLBUIVirtualDoc_clear(p,color);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setFont(s32* p,u32 idx,s32* fontName,u32 fontSize)\r\n{\r\n    CKLBUIVirtualDoc_setFont(p,idx,fontName,fontSize);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setViewPortPos(s32* p,s32 x,s32 y)\r\n{\r\n    CKLBUIVirtualDoc_setViewPortPos(p,x,y);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_drawLine(s32* p,s32 x0,s32 y0,s32 x1,s32 y1,u32 color)\r\n{\r\n    CKLBUIVirtualDoc_drawLine(p,x0,y0,x1,y1,color);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_drawImage(s32* p,s32 x0,s32 y0,s32* image,u32 alpha)\r\n{\r\n    CKLBUIVirtualDoc_drawImage(p,x0,y0,image,alpha);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_fillRect(s32* p,s32 x0,s32 y0,u32 width,u32 height,u32 color,bool fill)\r\n{\r\n    CKLBUIVirtualDoc_fillRect(p,x0,y0,width,height,color,fill);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_drawText(s32* p,s32 x0,s32 y0,s32* str,u32 color,u32 fontidx)\r\n{\r\n    CKLBUIVirtualDoc_drawText(p,x0,y0,str,color,fontidx);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_startDocument(s32* p)\r\n{\r\n    CKLBUIVirtualDoc_startDocument(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_checkDocumentSize(s32* p)\r\n{\r\n    CKLBUIVirtualDoc_checkDocumentSize(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_endDocument(s32* p)\r\n{\r\n    CKLBUIVirtualDoc_endDocument(p);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getCommandMax(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getCommandMax(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setCommandMax(s32* p,u32 command)\r\n{\r\n    CKLBUIVirtualDoc_setCommandMax(p,command);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getDocHeight(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getDocHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setDocHeight(s32* p,u32 command)\r\n{\r\n    CKLBUIVirtualDoc_setDocHeight(p,command);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getDocWidth(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getDocWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setDocWidth(s32* p,u32 command)\r\n{\r\n    CKLBUIVirtualDoc_setDocWidth(p,command);\r\n}\r\n\r\n/*static*/\r\nbool EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getVertical(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getVertical(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setVertical(s32* p,bool vertical)\r\n{\r\n    CKLBUIVirtualDoc_setVertical(p,vertical);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getViewHeight(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getViewHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setViewHeight(s32* p,u32 height)\r\n{\r\n    CKLBUIVirtualDoc_setViewHeight(p,height);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getViewWidth(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getViewWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setViewWidth(s32* p,u32 width)\r\n{\r\n    CKLBUIVirtualDoc_setViewWidth(p,width);\r\n}\r\n\r\n/*static*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_getOrder(s32* p)\r\n{\r\n    return CKLBUIVirtualDoc_getOrder(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setOrder(s32* p,u32 order)\r\n{\r\n    CKLBUIVirtualDoc_setOrder(p,order);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_ext_CKLBUIVirtualDoc_setAlign(s32* p,u32 align,s32 alignWidth)\r\n{\r\n    CKLBUIVirtualDoc_setAlign(p,align,alignWidth);\r\n}\r\n\r\nEnginePrototype::CKLBUIVirtualDoc::CKLBUIVirtualDoc(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 docWidth,u32 docHeight,u32 viewWidth,u32 viewHeight,u32 maxCommandNums,bool verticalFlag,EnginePrototype::_Delegate_Base_CallBack_inner50* callback) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIVirtualDoc();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIVirtualDoc_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),order,x,y,docWidth,docHeight,viewWidth,viewHeight,maxCommandNums,verticalFlag);\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n    _sm_isLocked$(false);\r\n}\r\n\r\nEnginePrototype::CKLBUIVirtualDoc::CKLBUIVirtualDoc() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIVirtualDoc();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUIIUU_inner16<CKLBUIVirtualDoc>(this,&CKLBUIVirtualDoc::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner50*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::callBackFunction(u32 type,s32 x,s32 y,u32 moveX,u32 moveY)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,(ETYPE)type,x,y,moveX,moveY);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::callBackFunction$(u32 type,s32 x,s32 y,u32 moveX,u32 moveY) { CHCKTHIS; return callBackFunction(type,x,y,moveX,moveY); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::getDocSize(EnginePrototype::USize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIVirtualDoc_getDocWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIVirtualDoc_getDocHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::getDocSize$(EnginePrototype::USize& size) { CHCKTHIS; return getDocSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setDocSize(EnginePrototype::USize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setDocWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIVirtualDoc_setDocHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setDocSize$(EnginePrototype::USize size) { CHCKTHIS; return setDocSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setDocSize(u32 width,u32 height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setDocWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n        _ext_CKLBUIVirtualDoc_setDocHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setDocSize$(u32 width,u32 height) { CHCKTHIS; return setDocSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::getViewSize(EnginePrototype::USize& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIVirtualDoc_getViewWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIVirtualDoc_getViewHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::getViewSize$(EnginePrototype::USize& size) { CHCKTHIS; return getViewSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setViewSize(EnginePrototype::USize size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setViewWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIVirtualDoc_setViewHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setViewSize$(EnginePrototype::USize size) { CHCKTHIS; return setViewSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setViewSize(u32 width,u32 height)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setViewWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n        _ext_CKLBUIVirtualDoc_setViewHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setViewSize$(u32 width,u32 height) { CHCKTHIS; return setViewSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setFont(u32 index,System::String* name,u32 size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setFont(EnginePrototype::GameObject::_acc_gCppObject$(),index,System::__MarshallingUtils::NativeUtf8FromString(name),size);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setFont$(u32 index,System::String* name,u32 size) { CHCKTHIS; return setFont(index,name,size); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::clear(u32 argb)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_clear(EnginePrototype::GameObject::_acc_gCppObject$(),argb);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::clear$(u32 argb) { CHCKTHIS; return clear(argb); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setViewPortPos(s32 x,s32 y)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setViewPortPos(EnginePrototype::GameObject::_acc_gCppObject$(),x,y);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setViewPortPos$(s32 x,s32 y) { CHCKTHIS; return setViewPortPos(x,y); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::setAlign(s32 align,s32 alignWidth)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setAlign(EnginePrototype::GameObject::_acc_gCppObject$(),(u32)align,((alignWidth == -1) ? (s32)_acc_gViewWidth$() : alignWidth));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::setAlign$(s32 align,s32 alignWidth) { CHCKTHIS; return setAlign(align,alignWidth); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::startDrawList(u32 commandCount)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setCommandMax(EnginePrototype::GameObject::_acc_gCppObject$(),commandCount);\r\n        _ext_CKLBUIVirtualDoc_checkDocumentSize(EnginePrototype::GameObject::_acc_gCppObject$());\r\n        _ext_CKLBUIVirtualDoc_startDocument(EnginePrototype::GameObject::_acc_gCppObject$());\r\n        _sm_isLocked$(true);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::startDrawList$(u32 commandCount) { CHCKTHIS; return startDrawList(commandCount); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::endDrawList()\r\n{\r\n    _ext_CKLBUIVirtualDoc_endDocument(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    _sm_isLocked$(false);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::endDrawList$() { CHCKTHIS; return endDrawList(); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::drawLine(s32 x0,s32 y0,s32 x1,s32 y1,u32 argb)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() == System::IntPtr::Zero)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    if (_gm_isLocked$())\r\n    {\r\n        _ext_CKLBUIVirtualDoc_drawLine(EnginePrototype::GameObject::_acc_gCppObject$(),x0,y0,x1,y1,argb);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr110Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::drawLine$(s32 x0,s32 y0,s32 x1,s32 y1,u32 argb) { CHCKTHIS; return drawLine(x0,y0,x1,y1,argb); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::drawText(s32 x0,s32 y0,System::String* str,u32 argb,u32 font_index)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() == System::IntPtr::Zero)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    if (_gm_isLocked$())\r\n    {\r\n        _ext_CKLBUIVirtualDoc_drawText(EnginePrototype::GameObject::_acc_gCppObject$(),x0,y0,System::__MarshallingUtils::NativeUtf8FromString(str),argb,font_index);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr110Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::drawText$(s32 x0,s32 y0,System::String* str,u32 argb,u32 font_index) { CHCKTHIS; return drawText(x0,y0,str,argb,font_index); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::drawFillRect(s32 x0,s32 y0,u32 width,u32 height,u32 argb,bool fill)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() == System::IntPtr::Zero)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    if (_gm_isLocked$())\r\n    {\r\n        _ext_CKLBUIVirtualDoc_fillRect(EnginePrototype::GameObject::_acc_gCppObject$(),x0,y0,width,height,argb,fill);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr110Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::drawFillRect$(s32 x0,s32 y0,u32 width,u32 height,u32 argb,bool fill) { CHCKTHIS; return drawFillRect(x0,y0,width,height,argb,fill); }\r\n\r\nvoid EnginePrototype::CKLBUIVirtualDoc::drawImage(s32 x,s32 y,System::String* image,u32 alpha)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() == System::IntPtr::Zero)\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    if (_gm_isLocked$())\r\n    {\r\n        EnginePrototype::NativeManagement::resetCppError();\r\n        _ext_CKLBUIVirtualDoc_drawImage(EnginePrototype::GameObject::_acc_gCppObject$(),x,y,System::__MarshallingUtils::NativeUtf8FromString(image),alpha);\r\n        EnginePrototype::NativeManagement::intercepCppError();\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr110Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIVirtualDoc::drawImage$(s32 x,s32 y,System::String* image,u32 alpha) { CHCKTHIS; return drawImage(x,y,image,alpha); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner50* EnginePrototype::CKLBUIVirtualDoc::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner50* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner50*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner50* EnginePrototype::CKLBUIVirtualDoc::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner50* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gOrder(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getOrder(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gOrder$() { CHCKTHIS; return _acc_gOrder(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sOrder(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setOrder(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sOrder$(u32 value)\t\t{ CHCKTHIS; return _acc_sOrder(value); }\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gCmdMax(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getCommandMax(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gCmdMax$() { CHCKTHIS; return _acc_gCmdMax(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sCmdMax(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setCommandMax(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sCmdMax$(u32 value)\t\t{ CHCKTHIS; return _acc_sCmdMax(value); }\r\ninline bool EnginePrototype::CKLBUIVirtualDoc::_acc_gVertical(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getVertical(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline bool EnginePrototype::CKLBUIVirtualDoc::_acc_gVertical$() { CHCKTHIS; return _acc_gVertical(); }\r\n\r\ninline bool EnginePrototype::CKLBUIVirtualDoc::_acc_sVertical(bool value){\r\n    bool _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setVertical(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline bool EnginePrototype::CKLBUIVirtualDoc::_acc_sVertical$(bool value)\t\t{ CHCKTHIS; return _acc_sVertical(value); }\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gDocWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getDocWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gDocWidth$() { CHCKTHIS; return _acc_gDocWidth(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sDocWidth(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setDocWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sDocWidth$(u32 value)\t\t{ CHCKTHIS; return _acc_sDocWidth(value); }\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gDocHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getDocHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gDocHeight$() { CHCKTHIS; return _acc_gDocHeight(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sDocHeight(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setDocHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sDocHeight$(u32 value)\t\t{ CHCKTHIS; return _acc_sDocHeight(value); }\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gViewWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getViewWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gViewWidth$() { CHCKTHIS; return _acc_gViewWidth(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sViewWidth(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setViewWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sViewWidth$(u32 value)\t\t{ CHCKTHIS; return _acc_sViewWidth(value); }\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gViewHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        return _ext_CKLBUIVirtualDoc_getViewHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_gViewHeight$() { CHCKTHIS; return _acc_gViewHeight(); }\r\n\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sViewHeight(u32 value){\r\n    u32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIVirtualDoc_setViewHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n    return _returnValue_;\r\n}\r\ninline u32 EnginePrototype::CKLBUIVirtualDoc::_acc_sViewHeight$(u32 value)\t\t{ CHCKTHIS; return _acc_sViewHeight(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIVirtualDoc::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIVirtualDoc,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIVirtualDoc::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIVirtualDoc::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\n//=============================\r\n// Implementation of 'CKLBUIWebArea'\r\n//=============================\r\n\r\nvoid EnginePrototype::CKLBUIWebArea::_ctor_CKLBUIWebArea() {\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_create(s32* pParent,bool mode,float x,float y,float width,float height,s32* url)\r\n{\r\n    return CKLBUIWebArea_create(pParent,mode,x,y,width,height,url);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_getWidth(s32* p)\r\n{\r\n    return CKLBUIWebArea_getWidth(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_setWidth(s32* p,s32 width)\r\n{\r\n    CKLBUIWebArea_setWidth(p,width);\r\n}\r\n\r\n/*static*/\r\ns32 EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_getHeight(s32* p)\r\n{\r\n    return CKLBUIWebArea_getHeight(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_setHeight(s32* p,s32 height)\r\n{\r\n    CKLBUIWebArea_setHeight(p,height);\r\n}\r\n\r\n/*static*/\r\ns32* EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_getText(s32* p)\r\n{\r\n    return CKLBUIWebArea_getText(p);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_setText(s32* p,s32* text)\r\n{\r\n    CKLBUIWebArea_setText(p,text);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_setScalesPageToFit(s32* p,bool b)\r\n{\r\n    CKLBUIWebArea_setScalesPageToFit(p,b);\r\n}\r\n\r\n/*static*/\r\nvoid EnginePrototype::CKLBUIWebArea::_ext_CKLBUIWebArea_setBgColor(s32* p,u32 argb)\r\n{\r\n    CKLBUIWebArea_setBgColor(p,argb);\r\n}\r\n\r\nEnginePrototype::CKLBUIWebArea::CKLBUIWebArea(EnginePrototype::CKLBUITask* parent,bool mode,float x,float y,float width,float height,System::String* url,EnginePrototype::_Delegate_Base_CallBack_inner51* callback) : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIWebArea();\r\n    EnginePrototype::NativeManagement::resetCppError();\r\n    s32* ptr = _ext_CKLBUIWebArea_create((parent != NULL ? parent->_acc_gCppObject$() : System::IntPtr::Zero),mode,x,y,width,height,System::__MarshallingUtils::NativeUtf8FromString(url));\r\n    EnginePrototype::NativeManagement::intercepCppError();\r\n    EnginePrototype::GameObject::bind$(ptr);\r\n    _sm_callback$(callback);\r\n}\r\n\r\nEnginePrototype::CKLBUIWebArea::CKLBUIWebArea() : EnginePrototype::CKLBUITask(s_classID)\r\n{\r\n    _ctor_CKLBUIWebArea();\r\n}\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIWebArea::doSetupCallbacks()\r\n{\r\n    EnginePrototype::GameObject::registerCallBack$(CS_NEW EnginePrototype::_DelegateI_FunctionPointerUS_inner8<CKLBUIWebArea>(this,&CKLBUIWebArea::callBackFunction),0);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::doSetupCallbacks$() { CHCKTHIS; return doSetupCallbacks(); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIWebArea::setDelegate(System::Delegate* anyDelegate,System::String* delegateName)\r\n{\r\n    _sm_callback$((EnginePrototype::_Delegate_Base_CallBack_inner51*)anyDelegate);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::setDelegate$(System::Delegate* anyDelegate,System::String* delegateName) { CHCKTHIS; return setDelegate(anyDelegate,delegateName); }\r\n\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIWebArea::callBackFunction(u32 uint1,s32* url)\r\n{\r\n    if (_gm_callback$() != NULL)\r\n    {\r\n        _gm_callback$()->call$(this,uint1,System::__MarshallingUtils::StringFromNativeUtf8(url));\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBException(_$_cteStr53Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::callBackFunction$(u32 uint1,s32* url) { CHCKTHIS; return callBackFunction(uint1,url); }\r\n\r\nvoid EnginePrototype::CKLBUIWebArea::getSize(EnginePrototype::Size& size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        size._swidth$(_ext_CKLBUIWebArea_getWidth(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n        size._sheight$(_ext_CKLBUIWebArea_getHeight(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::getSize$(EnginePrototype::Size& size) { CHCKTHIS; return getSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIWebArea::setSize(EnginePrototype::Size size)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIWebArea_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),size._gwidth$());\r\n        _ext_CKLBUIWebArea_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),size._gheight$());\r\n    }\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::setSize$(EnginePrototype::Size size) { CHCKTHIS; return setSize(size); }\r\n\r\nvoid EnginePrototype::CKLBUIWebArea::setSize(s32 width,s32 height)\r\n{\r\n    _ext_CKLBUIWebArea_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),width);\r\n    _ext_CKLBUIWebArea_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),height);\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::setSize$(s32 width,s32 height) { CHCKTHIS; return setSize(width,height); }\r\n\r\nvoid EnginePrototype::CKLBUIWebArea::setScalesPageToFit(bool b)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIWebArea_setScalesPageToFit(EnginePrototype::GameObject::_acc_gCppObject$(),b);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::setScalesPageToFit$(bool b) { CHCKTHIS; return setScalesPageToFit(b); }\r\n\r\nvoid EnginePrototype::CKLBUIWebArea::setBgColor(u32 argb)\r\n{\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    {\r\n        _ext_CKLBUIWebArea_setBgColor(EnginePrototype::GameObject::_acc_gCppObject$(),argb);\r\n    }\r\n    else\r\n    {\r\n        THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    }\r\n}\r\n\r\ninline void EnginePrototype::CKLBUIWebArea::setBgColor$(u32 argb) { CHCKTHIS; return setBgColor(argb); }\r\n\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner51* EnginePrototype::CKLBUIWebArea::_sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner51* _$value)  { return (EnginePrototype::_Delegate_Base_CallBack_inner51*)System::__GCObject::_RefSetValue((System::__GCObject**)&m_callback,_$value); }\r\ninline EnginePrototype::_Delegate_Base_CallBack_inner51* EnginePrototype::CKLBUIWebArea::_sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner51* _$value) { CHCKTHIS; return _sm_callback(_$value); }\r\n\r\n\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_gWidth(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIWebArea_getWidth(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_gWidth$() { CHCKTHIS; return _acc_gWidth(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_sWidth(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIWebArea_setWidth(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_sWidth$(s32 value)\t\t{ CHCKTHIS; return _acc_sWidth(value); }\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_gHeight(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return _ext_CKLBUIWebArea_getHeight(EnginePrototype::GameObject::_acc_gCppObject$());\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_gHeight$() { CHCKTHIS; return _acc_gHeight(); }\r\n\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_sHeight(s32 value){\r\n    s32 _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIWebArea_setHeight(EnginePrototype::GameObject::_acc_gCppObject$(),value);\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline s32 EnginePrototype::CKLBUIWebArea::_acc_sHeight$(s32 value)\t\t{ CHCKTHIS; return _acc_sHeight(value); }\r\ninline System::String* EnginePrototype::CKLBUIWebArea::_acc_gUrl(){\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    return System::__MarshallingUtils::StringFromNativeUtf8(_ext_CKLBUIWebArea_getText(EnginePrototype::GameObject::_acc_gCppObject$()));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n}\r\n\r\ninline System::String* EnginePrototype::CKLBUIWebArea::_acc_gUrl$() { CHCKTHIS; return _acc_gUrl(); }\r\n\r\ninline System::String* EnginePrototype::CKLBUIWebArea::_acc_sUrl(System::String* value){\r\n    System::String* _returnValue_ = value;\r\n    if (EnginePrototype::GameObject::_acc_gCppObject$() != System::IntPtr::Zero)\r\n    _ext_CKLBUIWebArea_setText(EnginePrototype::GameObject::_acc_gCppObject$(),System::__MarshallingUtils::NativeUtf8FromString(value));\r\n    else\r\n    THROW(CS_NEW EnginePrototype::CKLBExceptionNullCppObject(_$_cteStr3Obj));\r\n    return _returnValue_;\r\n}\r\ninline System::String* EnginePrototype::CKLBUIWebArea::_acc_sUrl$(System::String* value)\t\t{ CHCKTHIS; return _acc_sUrl(value); }\r\n/*virtual*/\r\nbool EnginePrototype::CKLBUIWebArea::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(CKLBUIWebArea,EnginePrototype::CKLBUITask);\r\n}\r\n\r\n/*virtual*/\r\nu32 EnginePrototype::CKLBUIWebArea::_processGC() {\r\n    EnginePrototype::CKLBUITask::_processGC();\r\n\r\n    if (m_callback) { System::Memory::pushList(m_callback,0); }\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIWebArea::_releaseGC() {\r\n    EnginePrototype::CKLBUITask::_releaseGC();\r\n\r\n    if (m_callback && !m_callback->isFreed()) { m_callback->_removeRef((System::__GCObject**)&m_callback); }\r\n}\r\n/*virtual*/\r\nvoid EnginePrototype::CKLBUIWebArea::_moveAlert(u32 offset) {\r\n    EnginePrototype::CKLBUITask::_moveAlert(offset);\r\n\r\n    u8* oldPtr; u8* newPtr;\r\n    if (m_callback) {\r\n      newPtr = (u8*)(&m_callback); oldPtr = newPtr - offset;\r\n      m_callback->_moveRef((__GCObject**)oldPtr,(__GCObject**)newPtr);\r\n    }\r\n}\r\n\r\nu32 EnginePrototype::GameObject::NULLHANDLER;\r\nu32 EnginePrototype::GameObject::NBCALLBACKS;\r\ns32* EnginePrototype::NativeManagement::ms_cppErrorFlag;\r\ns32* EnginePrototype::NativeManagement::ms_counter;\r\nEnginePrototype::WrapperReg* EnginePrototype::WrapperReg::reg;\r\nu32 EnginePrototype::CSBin::s_classID;\r\nu32 EnginePrototype::CSData::s_classID;\r\nu32 EnginePrototype::CSDB::s_classID;\r\nbool EnginePrototype::CSDebug::s_isBuildingMenu;\r\nu32 EnginePrototype::CSFont::s_classID;\r\nfloat EnginePrototype::CSMatrix::EPSILON;\r\nu32 EnginePrototype::CSSound::s_classID;\r\nu32 EnginePrototype::CKLBAsyncLoader::s_classID;\r\nu32 EnginePrototype::CKLBGenericTask::s_classID;\r\nu32 EnginePrototype::CKLBIntervalTimer::s_classID;\r\nu32 EnginePrototype::CKLBNetAPI::s_classID;\r\nu32 EnginePrototype::CKLBStoreService::s_classID;\r\nu32 EnginePrototype::CKLBUICanvas::s_classID;\r\nu32 EnginePrototype::CKLBUIClip::s_classID;\r\nu32 EnginePrototype::CKLBUIControl::s_classID;\r\nu32 EnginePrototype::CKLBUIDebugItem::s_classID;\r\nu32 EnginePrototype::CKLBUIDragIcon::s_classID;\r\nu32 EnginePrototype::CKLBUIForm::s_classID;\r\nu32 EnginePrototype::CKLBUIFreeVertItem::s_classID;\r\nu32 EnginePrototype::CKLBUIGroup::s_classID;\r\nu32 EnginePrototype::CKLBUILabel::s_classID;\r\nu32 EnginePrototype::CKLBUIList::s_classID;\r\nu32 EnginePrototype::CKLBUIMoviePlayer::s_classID;\r\nu32 EnginePrototype::CKLBUIMultiImgItem::s_classID;\r\nu32 EnginePrototype::CKLBUIPieChart::s_classID;\r\nu32 EnginePrototype::CKLBUIPolyline::s_classID;\r\nu32 EnginePrototype::CKLBUIProgressBar::s_classID;\r\nu32 EnginePrototype::CKLBUIRubberBand::s_classID;\r\nu32 EnginePrototype::CKLBUIScale9::s_classID;\r\nSystem::Array<u32>* EnginePrototype::AnimationInfo::ms_maskArr;\r\nSystem::Array<s32>* EnginePrototype::AnimationInfo::ms_indexes;\r\nu32 EnginePrototype::CKLBUIScore::s_classID;\r\nu32 EnginePrototype::CKLBUIScrollBar::s_classID;\r\nu32 EnginePrototype::CKLBUISimpleItem::s_classID;\r\nu32 EnginePrototype::CKLBUISWFPlayer::s_classID;\r\nu32 EnginePrototype::CKLBUITextInput::s_classID;\r\nu32 EnginePrototype::CKLBUITouchPad::s_classID;\r\nu32 EnginePrototype::CKLBUIVariableItem::s_classID;\r\nu32 EnginePrototype::CKLBUIVirtualDoc::s_classID;\r\nu32 EnginePrototype::CKLBUIWebArea::s_classID;\r\nvoid* _global_array_initializer_6(void* array_) {\r\n    System::Array<s32>* _array = (System::Array<s32>*)array_;\r\n\r\n    static const s32 _arrayCTE[] = {0,2,4,8,10,12,14,16,18,20};\r\n    _array->_setMemCpy(_arrayCTE);\r\n    return array_;\r\n}\r\nvoid* _global_array_initializer_4(void* array_) {\r\n    System::Array<float>* _array = (System::Array<float>*)array_;\r\n\r\n    static const float _arrayCTE[] = {1.000000f,0.000000f,0.000000f,0.000000f,0.000000f,1.000000f,0.000000f,0.000000f,0.000000f,0.000000f,1.000000f,0.000000f,0.000000f,0.000000f,0.000000f,1.000000f};\r\n    _array->_setMemCpy(_arrayCTE);\r\n    return array_;\r\n}\r\nvoid* _global_array_initializer_3(void* array_) {\r\n    System::Array<float>* _array = (System::Array<float>*)array_;\r\n\r\n    static const float _arrayCTE[] = {0,0,0,0};\r\n    _array->_setMemCpy(_arrayCTE);\r\n    return array_;\r\n}\r\nvoid* _global_array_initializer_2(void* array_) {\r\n    System::Array<float>* _array = (System::Array<float>*)array_;\r\n\r\n    static const float _arrayCTE[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};\r\n    _array->_setMemCpy(_arrayCTE);\r\n    return array_;\r\n}\r\nvoid* _global_array_initializer_1(void* array_) {\r\n    System::Array<float>* _array = (System::Array<float>*)array_;\r\n\r\n    static const float _arrayCTE[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};\r\n    _array->_setMemCpy(_arrayCTE);\r\n    return array_;\r\n}\r\nvoid* _global_array_initializer_0(void* array_) {\r\n    System::Array<float>* _array = (System::Array<float>*)array_;\r\n\r\n    static const float _arrayCTE[] = {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1};\r\n    _array->_setMemCpy(_arrayCTE);\r\n    return array_;\r\n}\r\n\r\n#include \"callbackDef.inl\"\r\n\r\nvoid initFrameworkStatic() {\r\n    EnginePrototype::GameObject::NULLHANDLER = -1;\r\n    EnginePrototype::GameObject::NBCALLBACKS = 6;\r\n    EnginePrototype::NativeManagement::ms_cppErrorFlag = EnginePrototype::NativeManagement::_ext_CKLBScriptEnv_getErrorPtr();\r\n    EnginePrototype::NativeManagement::ms_counter = EnginePrototype::NativeManagement::_ext_CKLBScriptEnv_getCallBackCount();\r\n    EnginePrototype::WrapperReg::reg = CS_NEW EnginePrototype::WrapperReg();\r\n    EnginePrototype::CSBin::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr44Obj);\r\n    EnginePrototype::CSData::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr45Obj);\r\n    EnginePrototype::CSDB::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr46Obj);\r\n    EnginePrototype::CSDebug::s_isBuildingMenu = false;\r\n    EnginePrototype::CSFont::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr49Obj);\r\n    EnginePrototype::CSMatrix::EPSILON = 0.000010f;\r\n    EnginePrototype::CSSound::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr51Obj);\r\n    EnginePrototype::CKLBAsyncLoader::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr52Obj);\r\n    EnginePrototype::CKLBGenericTask::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr54Obj);\r\n    EnginePrototype::CKLBNetAPI::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr59Obj);\r\n    EnginePrototype::CKLBStoreService::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr63Obj);\r\n    EnginePrototype::AnimationInfo::ms_maskArr = (CS_NEW System::Array< u32 >(10))->_s(0,1 << 1)->_s(1,1 << 2)->_s(2,1 << 3)->_s(3,1 << 4)->_s(4,1 << 5)->_s(5,1 << 6)->_s(6,1 << 7)->_s(7,1 << 8)->_s(8,1 << 9)->_s(9,1 << 10);\r\n    EnginePrototype::AnimationInfo::ms_indexes = (System::Array<s32>*)_global_array_initializer_6(CS_NEW System::Array< s32 >(10));\r\n    EnginePrototype::CKLBIntervalTimer::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr58Obj);\r\n    EnginePrototype::CKLBUICanvas::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr64Obj);\r\n    EnginePrototype::CKLBUIClip::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr65Obj);\r\n    EnginePrototype::CKLBUIControl::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr66Obj);\r\n    EnginePrototype::CKLBUIDebugItem::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr72Obj);\r\n    EnginePrototype::CKLBUIDragIcon::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr73Obj);\r\n    EnginePrototype::CKLBUIForm::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr74Obj);\r\n    EnginePrototype::CKLBUIFreeVertItem::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr77Obj);\r\n    EnginePrototype::CKLBUIGroup::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr82Obj);\r\n    EnginePrototype::CKLBUILabel::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr83Obj);\r\n    EnginePrototype::CKLBUIList::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr85Obj);\r\n    EnginePrototype::CKLBUIMoviePlayer::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr91Obj);\r\n    EnginePrototype::CKLBUIMultiImgItem::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr92Obj);\r\n    EnginePrototype::CKLBUIPieChart::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr95Obj);\r\n    EnginePrototype::CKLBUIPolyline::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr96Obj);\r\n    EnginePrototype::CKLBUIProgressBar::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr98Obj);\r\n    EnginePrototype::CKLBUIRubberBand::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr99Obj);\r\n    EnginePrototype::CKLBUIScale9::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr100Obj);\r\n    EnginePrototype::CKLBUIScore::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr101Obj);\r\n    EnginePrototype::CKLBUIScrollBar::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr102Obj);\r\n    EnginePrototype::CKLBUISimpleItem::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr103Obj);\r\n    EnginePrototype::CKLBUISWFPlayer::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr104Obj);\r\n    EnginePrototype::CKLBUITextInput::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr106Obj);\r\n    EnginePrototype::CKLBUITouchPad::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr107Obj);\r\n    EnginePrototype::CKLBUIVariableItem::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr108Obj);\r\n    EnginePrototype::CKLBUIVirtualDoc::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr109Obj);\r\n    EnginePrototype::CKLBUIWebArea::s_classID = EnginePrototype::__FrameworkUtils::RegisterClass(_$_cteStr111Obj);\r\n}\r\n\r\nvoid initFramework() {\r\n    // Register Strings into the GC.\r\n    _$_cteStr111Obj = CS_NEW System::String(_$_cteStr111,sizeof(_$_cteStr111) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr111Obj);\r\n\r\n    _$_cteStr110Obj = CS_NEW System::String(_$_cteStr110,sizeof(_$_cteStr110) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr110Obj);\r\n\r\n    _$_cteStr109Obj = CS_NEW System::String(_$_cteStr109,sizeof(_$_cteStr109) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr109Obj);\r\n\r\n    _$_cteStr108Obj = CS_NEW System::String(_$_cteStr108,sizeof(_$_cteStr108) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr108Obj);\r\n\r\n    _$_cteStr107Obj = CS_NEW System::String(_$_cteStr107,sizeof(_$_cteStr107) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr107Obj);\r\n\r\n    _$_cteStr106Obj = CS_NEW System::String(_$_cteStr106,sizeof(_$_cteStr106) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr106Obj);\r\n\r\n    _$_cteStr105Obj = CS_NEW System::String(_$_cteStr105,sizeof(_$_cteStr105) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr105Obj);\r\n\r\n    _$_cteStr104Obj = CS_NEW System::String(_$_cteStr104,sizeof(_$_cteStr104) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr104Obj);\r\n\r\n    _$_cteStr103Obj = CS_NEW System::String(_$_cteStr103,sizeof(_$_cteStr103) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr103Obj);\r\n\r\n    _$_cteStr102Obj = CS_NEW System::String(_$_cteStr102,sizeof(_$_cteStr102) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr102Obj);\r\n\r\n    _$_cteStr101Obj = CS_NEW System::String(_$_cteStr101,sizeof(_$_cteStr101) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr101Obj);\r\n\r\n    _$_cteStr100Obj = CS_NEW System::String(_$_cteStr100,sizeof(_$_cteStr100) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr100Obj);\r\n\r\n    _$_cteStr99Obj = CS_NEW System::String(_$_cteStr99,sizeof(_$_cteStr99) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr99Obj);\r\n\r\n    _$_cteStr98Obj = CS_NEW System::String(_$_cteStr98,sizeof(_$_cteStr98) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr98Obj);\r\n\r\n    _$_cteStr97Obj = CS_NEW System::String(_$_cteStr97,sizeof(_$_cteStr97) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr97Obj);\r\n\r\n    _$_cteStr96Obj = CS_NEW System::String(_$_cteStr96,sizeof(_$_cteStr96) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr96Obj);\r\n\r\n    _$_cteStr95Obj = CS_NEW System::String(_$_cteStr95,sizeof(_$_cteStr95) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr95Obj);\r\n\r\n    _$_cteStr94Obj = CS_NEW System::String(_$_cteStr94,sizeof(_$_cteStr94) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr94Obj);\r\n\r\n    _$_cteStr93Obj = CS_NEW System::String(_$_cteStr93,sizeof(_$_cteStr93) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr93Obj);\r\n\r\n    _$_cteStr92Obj = CS_NEW System::String(_$_cteStr92,sizeof(_$_cteStr92) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr92Obj);\r\n\r\n    _$_cteStr91Obj = CS_NEW System::String(_$_cteStr91,sizeof(_$_cteStr91) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr91Obj);\r\n\r\n    _$_cteStr90Obj = CS_NEW System::String(_$_cteStr90,sizeof(_$_cteStr90) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr90Obj);\r\n\r\n    _$_cteStr89Obj = CS_NEW System::String(_$_cteStr89,sizeof(_$_cteStr89) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr89Obj);\r\n\r\n    _$_cteStr88Obj = CS_NEW System::String(_$_cteStr88,sizeof(_$_cteStr88) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr88Obj);\r\n\r\n    _$_cteStr87Obj = CS_NEW System::String(_$_cteStr87,sizeof(_$_cteStr87) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr87Obj);\r\n\r\n    _$_cteStr86Obj = CS_NEW System::String(_$_cteStr86,sizeof(_$_cteStr86) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr86Obj);\r\n\r\n    _$_cteStr85Obj = CS_NEW System::String(_$_cteStr85,sizeof(_$_cteStr85) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr85Obj);\r\n\r\n    _$_cteStr84Obj = CS_NEW System::String(_$_cteStr84,sizeof(_$_cteStr84) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr84Obj);\r\n\r\n    _$_cteStr83Obj = CS_NEW System::String(_$_cteStr83,sizeof(_$_cteStr83) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr83Obj);\r\n\r\n    _$_cteStr82Obj = CS_NEW System::String(_$_cteStr82,sizeof(_$_cteStr82) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr82Obj);\r\n\r\n    _$_cteStr81Obj = CS_NEW System::String(_$_cteStr81,sizeof(_$_cteStr81) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr81Obj);\r\n\r\n    _$_cteStr80Obj = CS_NEW System::String(_$_cteStr80,sizeof(_$_cteStr80) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr80Obj);\r\n\r\n    _$_cteStr79Obj = CS_NEW System::String(_$_cteStr79,sizeof(_$_cteStr79) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr79Obj);\r\n\r\n    _$_cteStr78Obj = CS_NEW System::String(_$_cteStr78,sizeof(_$_cteStr78) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr78Obj);\r\n\r\n    _$_cteStr77Obj = CS_NEW System::String(_$_cteStr77,sizeof(_$_cteStr77) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr77Obj);\r\n\r\n    _$_cteStr76Obj = CS_NEW System::String(_$_cteStr76,sizeof(_$_cteStr76) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr76Obj);\r\n\r\n    _$_cteStr75Obj = CS_NEW System::String(_$_cteStr75,sizeof(_$_cteStr75) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr75Obj);\r\n\r\n    _$_cteStr74Obj = CS_NEW System::String(_$_cteStr74,sizeof(_$_cteStr74) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr74Obj);\r\n\r\n    _$_cteStr73Obj = CS_NEW System::String(_$_cteStr73,sizeof(_$_cteStr73) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr73Obj);\r\n\r\n    _$_cteStr72Obj = CS_NEW System::String(_$_cteStr72,sizeof(_$_cteStr72) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr72Obj);\r\n\r\n    _$_cteStr71Obj = CS_NEW System::String(_$_cteStr71,sizeof(_$_cteStr71) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr71Obj);\r\n\r\n    _$_cteStr70Obj = CS_NEW System::String(_$_cteStr70,sizeof(_$_cteStr70) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr70Obj);\r\n\r\n    _$_cteStr69Obj = CS_NEW System::String(_$_cteStr69,sizeof(_$_cteStr69) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr69Obj);\r\n\r\n    _$_cteStr68Obj = CS_NEW System::String(_$_cteStr68,sizeof(_$_cteStr68) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr68Obj);\r\n\r\n    _$_cteStr67Obj = CS_NEW System::String(_$_cteStr67,sizeof(_$_cteStr67) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr67Obj);\r\n\r\n    _$_cteStr66Obj = CS_NEW System::String(_$_cteStr66,sizeof(_$_cteStr66) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr66Obj);\r\n\r\n    _$_cteStr65Obj = CS_NEW System::String(_$_cteStr65,sizeof(_$_cteStr65) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr65Obj);\r\n\r\n    _$_cteStr64Obj = CS_NEW System::String(_$_cteStr64,sizeof(_$_cteStr64) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr64Obj);\r\n\r\n    _$_cteStr63Obj = CS_NEW System::String(_$_cteStr63,sizeof(_$_cteStr63) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr63Obj);\r\n\r\n    _$_cteStr62Obj = CS_NEW System::String(_$_cteStr62,sizeof(_$_cteStr62) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr62Obj);\r\n\r\n    _$_cteStr61Obj = CS_NEW System::String(_$_cteStr61,sizeof(_$_cteStr61) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr61Obj);\r\n\r\n    _$_cteStr60Obj = CS_NEW System::String(_$_cteStr60,sizeof(_$_cteStr60) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr60Obj);\r\n\r\n    _$_cteStr59Obj = CS_NEW System::String(_$_cteStr59,sizeof(_$_cteStr59) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr59Obj);\r\n\r\n    _$_cteStr58Obj = CS_NEW System::String(_$_cteStr58,sizeof(_$_cteStr58) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr58Obj);\r\n\r\n    _$_cteStr57Obj = CS_NEW System::String(_$_cteStr57,sizeof(_$_cteStr57) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr57Obj);\r\n\r\n    _$_cteStr56Obj = CS_NEW System::String(_$_cteStr56,sizeof(_$_cteStr56) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr56Obj);\r\n\r\n    _$_cteStr55Obj = CS_NEW System::String(_$_cteStr55,sizeof(_$_cteStr55) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr55Obj);\r\n\r\n    _$_cteStr54Obj = CS_NEW System::String(_$_cteStr54,sizeof(_$_cteStr54) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr54Obj);\r\n\r\n    _$_cteStr53Obj = CS_NEW System::String(_$_cteStr53,sizeof(_$_cteStr53) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr53Obj);\r\n\r\n    _$_cteStr52Obj = CS_NEW System::String(_$_cteStr52,sizeof(_$_cteStr52) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr52Obj);\r\n\r\n    _$_cteStr51Obj = CS_NEW System::String(_$_cteStr51,sizeof(_$_cteStr51) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr51Obj);\r\n\r\n    _$_cteStr50Obj = CS_NEW System::String(_$_cteStr50,sizeof(_$_cteStr50) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr50Obj);\r\n\r\n    _$_cteStr49Obj = CS_NEW System::String(_$_cteStr49,sizeof(_$_cteStr49) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr49Obj);\r\n\r\n    _$_cteStr48Obj = CS_NEW System::String(_$_cteStr48,sizeof(_$_cteStr48) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr48Obj);\r\n\r\n    _$_cteStr47Obj = CS_NEW System::String(_$_cteStr47,sizeof(_$_cteStr47) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr47Obj);\r\n\r\n    _$_cteStr46Obj = CS_NEW System::String(_$_cteStr46,sizeof(_$_cteStr46) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr46Obj);\r\n\r\n    _$_cteStr45Obj = CS_NEW System::String(_$_cteStr45,sizeof(_$_cteStr45) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr45Obj);\r\n\r\n    _$_cteStr44Obj = CS_NEW System::String(_$_cteStr44,sizeof(_$_cteStr44) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr44Obj);\r\n\r\n    _$_cteStr43Obj = CS_NEW System::String(_$_cteStr43,sizeof(_$_cteStr43) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr43Obj);\r\n\r\n    _$_cteStr42Obj = CS_NEW System::String(_$_cteStr42,sizeof(_$_cteStr42) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr42Obj);\r\n\r\n    _$_cteStr41Obj = CS_NEW System::String(_$_cteStr41,sizeof(_$_cteStr41) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr41Obj);\r\n\r\n    _$_cteStr40Obj = CS_NEW System::String(_$_cteStr40,sizeof(_$_cteStr40) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr40Obj);\r\n\r\n    _$_cteStr39Obj = CS_NEW System::String(_$_cteStr39,sizeof(_$_cteStr39) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr39Obj);\r\n\r\n    _$_cteStr38Obj = CS_NEW System::String(_$_cteStr38,sizeof(_$_cteStr38) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr38Obj);\r\n\r\n    _$_cteStr37Obj = CS_NEW System::String(_$_cteStr37,sizeof(_$_cteStr37) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr37Obj);\r\n\r\n    _$_cteStr36Obj = CS_NEW System::String(_$_cteStr36,sizeof(_$_cteStr36) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr36Obj);\r\n\r\n    _$_cteStr35Obj = CS_NEW System::String(_$_cteStr35,sizeof(_$_cteStr35) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr35Obj);\r\n\r\n    _$_cteStr34Obj = CS_NEW System::String(_$_cteStr34,sizeof(_$_cteStr34) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr34Obj);\r\n\r\n    _$_cteStr33Obj = CS_NEW System::String(_$_cteStr33,sizeof(_$_cteStr33) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr33Obj);\r\n\r\n    _$_cteStr32Obj = CS_NEW System::String(_$_cteStr32,sizeof(_$_cteStr32) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr32Obj);\r\n\r\n    _$_cteStr31Obj = CS_NEW System::String(_$_cteStr31,sizeof(_$_cteStr31) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr31Obj);\r\n\r\n    _$_cteStr30Obj = CS_NEW System::String(_$_cteStr30,sizeof(_$_cteStr30) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr30Obj);\r\n\r\n    _$_cteStr29Obj = CS_NEW System::String(_$_cteStr29,sizeof(_$_cteStr29) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr29Obj);\r\n\r\n    _$_cteStr28Obj = CS_NEW System::String(_$_cteStr28,sizeof(_$_cteStr28) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr28Obj);\r\n\r\n    _$_cteStr27Obj = CS_NEW System::String(_$_cteStr27,sizeof(_$_cteStr27) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr27Obj);\r\n\r\n    _$_cteStr26Obj = CS_NEW System::String(_$_cteStr26,sizeof(_$_cteStr26) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr26Obj);\r\n\r\n    _$_cteStr25Obj = CS_NEW System::String(_$_cteStr25,sizeof(_$_cteStr25) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr25Obj);\r\n\r\n    _$_cteStr24Obj = CS_NEW System::String(_$_cteStr24,sizeof(_$_cteStr24) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr24Obj);\r\n\r\n    _$_cteStr23Obj = CS_NEW System::String(_$_cteStr23,sizeof(_$_cteStr23) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr23Obj);\r\n\r\n    _$_cteStr22Obj = CS_NEW System::String(_$_cteStr22,sizeof(_$_cteStr22) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr22Obj);\r\n\r\n    _$_cteStr21Obj = CS_NEW System::String(_$_cteStr21,sizeof(_$_cteStr21) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr21Obj);\r\n\r\n    _$_cteStr20Obj = CS_NEW System::String(_$_cteStr20,sizeof(_$_cteStr20) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr20Obj);\r\n\r\n    _$_cteStr19Obj = CS_NEW System::String(_$_cteStr19,sizeof(_$_cteStr19) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr19Obj);\r\n\r\n    _$_cteStr18Obj = CS_NEW System::String(_$_cteStr18,sizeof(_$_cteStr18) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr18Obj);\r\n\r\n    _$_cteStr17Obj = CS_NEW System::String(_$_cteStr17,sizeof(_$_cteStr17) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr17Obj);\r\n\r\n    _$_cteStr16Obj = CS_NEW System::String(_$_cteStr16,sizeof(_$_cteStr16) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr16Obj);\r\n\r\n    _$_cteStr15Obj = CS_NEW System::String(_$_cteStr15,sizeof(_$_cteStr15) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr15Obj);\r\n\r\n    _$_cteStr14Obj = CS_NEW System::String(_$_cteStr14,sizeof(_$_cteStr14) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr14Obj);\r\n\r\n    _$_cteStr13Obj = CS_NEW System::String(_$_cteStr13,sizeof(_$_cteStr13) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr13Obj);\r\n\r\n    _$_cteStr12Obj = CS_NEW System::String(_$_cteStr12,sizeof(_$_cteStr12) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr12Obj);\r\n\r\n    _$_cteStr11Obj = CS_NEW System::String(_$_cteStr11,sizeof(_$_cteStr11) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr11Obj);\r\n\r\n    _$_cteStr10Obj = CS_NEW System::String(_$_cteStr10,sizeof(_$_cteStr10) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr10Obj);\r\n\r\n    _$_cteStr9Obj = CS_NEW System::String(_$_cteStr9,sizeof(_$_cteStr9) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr9Obj);\r\n\r\n    _$_cteStr8Obj = CS_NEW System::String(_$_cteStr8,sizeof(_$_cteStr8) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr8Obj);\r\n\r\n    _$_cteStr7Obj = CS_NEW System::String(_$_cteStr7,sizeof(_$_cteStr7) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr7Obj);\r\n\r\n    _$_cteStr6Obj = CS_NEW System::String(_$_cteStr6,sizeof(_$_cteStr6) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr6Obj);\r\n\r\n    _$_cteStr5Obj = CS_NEW System::String(_$_cteStr5,sizeof(_$_cteStr5) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr5Obj);\r\n\r\n    _$_cteStr4Obj = CS_NEW System::String(_$_cteStr4,sizeof(_$_cteStr4) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr4Obj);\r\n\r\n    _$_cteStr3Obj = CS_NEW System::String(_$_cteStr3,sizeof(_$_cteStr3) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr3Obj);\r\n\r\n    _$_cteStr2Obj = CS_NEW System::String(_$_cteStr2,sizeof(_$_cteStr2) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr2Obj);\r\n\r\n    _$_cteStr1Obj = CS_NEW System::String(_$_cteStr1,sizeof(_$_cteStr1) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr1Obj);\r\n\r\n    System::__GCObject::_RefSetValue((System::__GCObject**)&_$_cteStr0Obj, System::String::Empty);\r\n\r\n    initFrameworkStatic();\r\n    initCallbacks();\r\n\r\n    System::Memory::registerGCRoot(&EnginePrototype::WrapperReg::reg);\r\n    System::Memory::registerGCRoot(&EnginePrototype::AnimationInfo::ms_maskArr);\r\n    System::Memory::registerGCRoot(&EnginePrototype::AnimationInfo::ms_indexes);\r\n\r\n}\r\n"
  },
  {
    "path": "SampleProject/Cpp/framework.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef _FRAMEWORK_H\r\n#define _FRAMEWORK_H\r\n\r\n#include \"RuntimeLibrary/CS_Array.h\"\r\n#include \"RuntimeLibrary/CS_Console.h\"\r\n#include \"RuntimeLibrary/CS_Marshal.h\"\r\n#include \"RuntimeLibrary/CS_Memory.h\"\r\n#include \"RuntimeLibrary/CS_Object.h\"\r\n#include \"RuntimeLibrary/CS_String.h\"\r\n#include \"RuntimeLibrary/CS_System.h\"\r\n#include \"RuntimeLibrary/Collections/Collections.h\"\r\n#include \"RuntimeLibrary/Collections/Generic/CS_Dictionary.h\"\r\n#include \"RuntimeLibrary/Collections/Generic/CS_List.h\"\r\n#include \"RuntimeLibrary/Collections/Generic/Generic.h\"\r\n#include \"RuntimeLibrary/InternalUtils.h\"\r\n#include \"RuntimeLibrary/MarshallingUtils.h\"\r\n#include \"ExportListC_Likefunction.h\"\r\n\r\n/* UI_WebView */\r\nstatic const uniChar _$_cteStr111[] = {85,73,95,87,101,98,86,105,101,119};\r\nstatic System::String* _$_cteStr111Obj;\r\n\r\n/* Please use the draw functions in startDrawList()/endDrawList() blocks */\r\nstatic const uniChar _$_cteStr110[] = {80,108,101,97,115,101,32,117,115,101,32,116,104,101,32,100,114,97,119,32,102,117,110,99,116,105,111,110,115,32,105,110,32,115,116,97,114,116,68,114,97,119,76,105,115,116,40,41,47,101,110,100,68,114,97,119,76,105,115,116,40,41,32,98,108,111,99,107,115};\r\nstatic System::String* _$_cteStr110Obj;\r\n\r\n/* UI_VirtualDoc */\r\nstatic const uniChar _$_cteStr109[] = {85,73,95,86,105,114,116,117,97,108,68,111,99};\r\nstatic System::String* _$_cteStr109Obj;\r\n\r\n/* UI_VariableItem */\r\nstatic const uniChar _$_cteStr108[] = {85,73,95,86,97,114,105,97,98,108,101,73,116,101,109};\r\nstatic System::String* _$_cteStr108Obj;\r\n\r\n/* UI_TouchPad */\r\nstatic const uniChar _$_cteStr107[] = {85,73,95,84,111,117,99,104,80,97,100};\r\nstatic System::String* _$_cteStr107Obj;\r\n\r\n/* UI_TextInput */\r\nstatic const uniChar _$_cteStr106[] = {85,73,95,84,101,120,116,73,110,112,117,116};\r\nstatic System::String* _$_cteStr106Obj;\r\n\r\n/* The value of a spline point cannot be greater than 32767 */\r\nstatic const uniChar _$_cteStr105[] = {84,104,101,32,118,97,108,117,101,32,111,102,32,97,32,115,112,108,105,110,101,32,112,111,105,110,116,32,99,97,110,110,111,116,32,98,101,32,103,114,101,97,116,101,114,32,116,104,97,110,32,51,50,55,54,55};\r\nstatic System::String* _$_cteStr105Obj;\r\n\r\n/* UI_SWFPlayer */\r\nstatic const uniChar _$_cteStr104[] = {85,73,95,83,87,70,80,108,97,121,101,114};\r\nstatic System::String* _$_cteStr104Obj;\r\n\r\n/* UI_SimpleItem */\r\nstatic const uniChar _$_cteStr103[] = {85,73,95,83,105,109,112,108,101,73,116,101,109};\r\nstatic System::String* _$_cteStr103Obj;\r\n\r\n/* UI_ScrollBar */\r\nstatic const uniChar _$_cteStr102[] = {85,73,95,83,99,114,111,108,108,66,97,114};\r\nstatic System::String* _$_cteStr102Obj;\r\n\r\n/* UI_Score */\r\nstatic const uniChar _$_cteStr101[] = {85,73,95,83,99,111,114,101};\r\nstatic System::String* _$_cteStr101Obj;\r\n\r\n/* UI_Scale9 */\r\nstatic const uniChar _$_cteStr100[] = {85,73,95,83,99,97,108,101,57};\r\nstatic System::String* _$_cteStr100Obj;\r\n\r\n/* UI_RubberBand */\r\nstatic const uniChar _$_cteStr99[] = {85,73,95,82,117,98,98,101,114,66,97,110,100};\r\nstatic System::String* _$_cteStr99Obj;\r\n\r\n/* UI_ProgressBar */\r\nstatic const uniChar _$_cteStr98[] = {85,73,95,80,114,111,103,114,101,115,115,66,97,114};\r\nstatic System::String* _$_cteStr98Obj;\r\n\r\n/* PointCount must be strictly positive */\r\nstatic const uniChar _$_cteStr97[] = {80,111,105,110,116,67,111,117,110,116,32,109,117,115,116,32,98,101,32,115,116,114,105,99,116,108,121,32,112,111,115,105,116,105,118,101};\r\nstatic System::String* _$_cteStr97Obj;\r\n\r\n/* UI_Polyline */\r\nstatic const uniChar _$_cteStr96[] = {85,73,95,80,111,108,121,108,105,110,101};\r\nstatic System::String* _$_cteStr96Obj;\r\n\r\n/* UI_PieChart */\r\nstatic const uniChar _$_cteStr95[] = {85,73,95,80,105,101,67,104,97,114,116};\r\nstatic System::String* _$_cteStr95Obj;\r\n\r\n/* pArrayAsset and pArrayIndexes must have the same length. */\r\nstatic const uniChar _$_cteStr94[] = {112,65,114,114,97,121,65,115,115,101,116,32,97,110,100,32,112,65,114,114,97,121,73,110,100,101,120,101,115,32,109,117,115,116,32,104,97,118,101,32,116,104,101,32,115,97,109,101,32,108,101,110,103,116,104,46};\r\nstatic System::String* _$_cteStr94Obj;\r\n\r\n/* ArrayAsset and ArrayIndexes must have the same size. */\r\nstatic const uniChar _$_cteStr93[] = {65,114,114,97,121,65,115,115,101,116,32,97,110,100,32,65,114,114,97,121,73,110,100,101,120,101,115,32,109,117,115,116,32,104,97,118,101,32,116,104,101,32,115,97,109,101,32,115,105,122,101,46};\r\nstatic System::String* _$_cteStr93Obj;\r\n\r\n/* UI_MultiImgItem */\r\nstatic const uniChar _$_cteStr92[] = {85,73,95,77,117,108,116,105,73,109,103,73,116,101,109};\r\nstatic System::String* _$_cteStr92Obj;\r\n\r\n/* UI_MoviePlayer */\r\nstatic const uniChar _$_cteStr91[] = {85,73,95,77,111,118,105,101,80,108,97,121,101,114};\r\nstatic System::String* _$_cteStr91Obj;\r\n\r\n/* Not implemented in C++ yet. */\r\nstatic const uniChar _$_cteStr90[] = {78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,32,105,110,32,67,43,43,32,121,101,116,46};\r\nstatic System::String* _$_cteStr90Obj;\r\n\r\n/* scrollbar */\r\nstatic const uniChar _$_cteStr89[] = {115,99,114,111,108,108,98,97,114};\r\nstatic System::String* _$_cteStr89Obj;\r\n\r\n/* dynamic */\r\nstatic const uniChar _$_cteStr88[] = {100,121,110,97,109,105,99};\r\nstatic System::String* _$_cteStr88Obj;\r\n\r\n/* drag */\r\nstatic const uniChar _$_cteStr87[] = {100,114,97,103};\r\nstatic System::String* _$_cteStr87Obj;\r\n\r\n/* limit */\r\nstatic const uniChar _$_cteStr86[] = {108,105,109,105,116};\r\nstatic System::String* _$_cteStr86Obj;\r\n\r\n/* UI_List */\r\nstatic const uniChar _$_cteStr85[] = {85,73,95,76,105,115,116};\r\nstatic System::String* _$_cteStr85Obj;\r\n\r\n/* YOLO */\r\nstatic const uniChar _$_cteStr84[] = {89,79,76,79};\r\nstatic System::String* _$_cteStr84Obj;\r\n\r\n/* UI_Label */\r\nstatic const uniChar _$_cteStr83[] = {85,73,95,76,97,98,101,108};\r\nstatic System::String* _$_cteStr83Obj;\r\n\r\n/* UI_Group */\r\nstatic const uniChar _$_cteStr82[] = {85,73,95,71,114,111,117,112};\r\nstatic System::String* _$_cteStr82Obj;\r\n\r\n/* UV must be a float[8] array. */\r\nstatic const uniChar _$_cteStr81[] = {85,86,32,109,117,115,116,32,98,101,32,97,32,102,108,111,97,116,91,56,93,32,97,114,114,97,121,46};\r\nstatic System::String* _$_cteStr81Obj;\r\n\r\n/* idx must be between 0 and 7. */\r\nstatic const uniChar _$_cteStr80[] = {105,100,120,32,109,117,115,116,32,98,101,32,98,101,116,119,101,101,110,32,48,32,97,110,100,32,55,46};\r\nstatic System::String* _$_cteStr80Obj;\r\n\r\n/* Colors must be a uint[4] array. */\r\nstatic const uniChar _$_cteStr79[] = {67,111,108,111,114,115,32,109,117,115,116,32,98,101,32,97,32,117,105,110,116,91,52,93,32,97,114,114,97,121,46};\r\nstatic System::String* _$_cteStr79Obj;\r\n\r\n/* Vertices must be a float[8] array. */\r\nstatic const uniChar _$_cteStr78[] = {86,101,114,116,105,99,101,115,32,109,117,115,116,32,98,101,32,97,32,102,108,111,97,116,91,56,93,32,97,114,114,97,121,46};\r\nstatic System::String* _$_cteStr78Obj;\r\n\r\n/* UI_FreeVertItem */\r\nstatic const uniChar _$_cteStr77[] = {85,73,95,70,114,101,101,86,101,114,116,73,116,101,109};\r\nstatic System::String* _$_cteStr77Obj;\r\n\r\n/* anim */\r\nstatic const uniChar _$_cteStr76[] = {97,110,105,109};\r\nstatic System::String* _$_cteStr76Obj;\r\n\r\n/* selectable */\r\nstatic const uniChar _$_cteStr75[] = {115,101,108,101,99,116,97,98,108,101};\r\nstatic System::String* _$_cteStr75Obj;\r\n\r\n/* UI_Form */\r\nstatic const uniChar _$_cteStr74[] = {85,73,95,70,111,114,109};\r\nstatic System::String* _$_cteStr74Obj;\r\n\r\n/* UI_DragIcon */\r\nstatic const uniChar _$_cteStr73[] = {85,73,95,68,114,97,103,73,99,111,110};\r\nstatic System::String* _$_cteStr73Obj;\r\n\r\n/* UI_DbgLabel */\r\nstatic const uniChar _$_cteStr72[] = {85,73,95,68,98,103,76,97,98,101,108};\r\nstatic System::String* _$_cteStr72Obj;\r\n\r\n/* onLongtap */\r\nstatic const uniChar _$_cteStr71[] = {111,110,76,111,110,103,116,97,112};\r\nstatic System::String* _$_cteStr71Obj;\r\n\r\n/* onDblClick */\r\nstatic const uniChar _$_cteStr70[] = {111,110,68,98,108,67,108,105,99,107};\r\nstatic System::String* _$_cteStr70Obj;\r\n\r\n/* onClick */\r\nstatic const uniChar _$_cteStr69[] = {111,110,67,108,105,99,107};\r\nstatic System::String* _$_cteStr69Obj;\r\n\r\n/* onPinch */\r\nstatic const uniChar _$_cteStr68[] = {111,110,80,105,110,99,104};\r\nstatic System::String* _$_cteStr68Obj;\r\n\r\n/* onDrag */\r\nstatic const uniChar _$_cteStr67[] = {111,110,68,114,97,103};\r\nstatic System::String* _$_cteStr67Obj;\r\n\r\n/* UI_Control */\r\nstatic const uniChar _$_cteStr66[] = {85,73,95,67,111,110,116,114,111,108};\r\nstatic System::String* _$_cteStr66Obj;\r\n\r\n/* UI_Clip */\r\nstatic const uniChar _$_cteStr65[] = {85,73,95,67,108,105,112};\r\nstatic System::String* _$_cteStr65Obj;\r\n\r\n/* UI_Canvas */\r\nstatic const uniChar _$_cteStr64[] = {85,73,95,67,97,110,118,97,115};\r\nstatic System::String* _$_cteStr64Obj;\r\n\r\n/* STORE_Service */\r\nstatic const uniChar _$_cteStr63[] = {83,84,79,82,69,95,83,101,114,118,105,99,101};\r\nstatic System::String* _$_cteStr63Obj;\r\n\r\n/* /api */\r\nstatic const uniChar _$_cteStr62[] = {47,97,112,105};\r\nstatic System::String* _$_cteStr62Obj;\r\n\r\n/* versionUp */\r\nstatic const uniChar _$_cteStr61[] = {118,101,114,115,105,111,110,85,112};\r\nstatic System::String* _$_cteStr61Obj;\r\n\r\n/* 840 */\r\nstatic const uniChar _$_cteStr60[] = {56,52,48};\r\nstatic System::String* _$_cteStr60Obj;\r\n\r\n/* HTTP_API */\r\nstatic const uniChar _$_cteStr59[] = {72,84,84,80,95,65,80,73};\r\nstatic System::String* _$_cteStr59Obj;\r\n\r\n/* UTIL_IntervalTimer */\r\nstatic const uniChar _$_cteStr58[] = {85,84,73,76,95,73,110,116,101,114,118,97,108,84,105,109,101,114};\r\nstatic System::String* _$_cteStr58Obj;\r\n\r\n/* Unvalid delegate name */\r\nstatic const uniChar _$_cteStr57[] = {85,110,118,97,108,105,100,32,100,101,108,101,103,97,116,101,32,110,97,109,101};\r\nstatic System::String* _$_cteStr57Obj;\r\n\r\n/* die */\r\nstatic const uniChar _$_cteStr56[] = {100,105,101};\r\nstatic System::String* _$_cteStr56Obj;\r\n\r\n/* execute */\r\nstatic const uniChar _$_cteStr55[] = {101,120,101,99,117,116,101};\r\nstatic System::String* _$_cteStr55Obj;\r\n\r\n/* TASK_Generic */\r\nstatic const uniChar _$_cteStr54[] = {84,65,83,75,95,71,101,110,101,114,105,99};\r\nstatic System::String* _$_cteStr54Obj;\r\n\r\n/* Delegate NULL for this callback : Virtual function in subclass not implemented or delegate is null */\r\nstatic const uniChar _$_cteStr53[] = {68,101,108,101,103,97,116,101,32,78,85,76,76,32,102,111,114,32,116,104,105,115,32,99,97,108,108,98,97,99,107,32,58,32,86,105,114,116,117,97,108,32,102,117,110,99,116,105,111,110,32,105,110,32,115,117,98,99,108,97,115,115,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,32,111,114,32,100,101,108,101,103,97,116,101,32,105,115,32,110,117,108,108};\r\nstatic System::String* _$_cteStr53Obj;\r\n\r\n/* UTIL_AsyncLoader */\r\nstatic const uniChar _$_cteStr52[] = {85,84,73,76,95,65,115,121,110,99,76,111,97,100,101,114};\r\nstatic System::String* _$_cteStr52Obj;\r\n\r\n/* LibSound */\r\nstatic const uniChar _$_cteStr51[] = {76,105,98,83,111,117,110,100};\r\nstatic System::String* _$_cteStr51Obj;\r\n\r\n/* Length must be 16. */\r\nstatic const uniChar _$_cteStr50[] = {76,101,110,103,116,104,32,109,117,115,116,32,98,101,32,49,54,46};\r\nstatic System::String* _$_cteStr50Obj;\r\n\r\n/* LibFont */\r\nstatic const uniChar _$_cteStr49[] = {76,105,98,70,111,110,116};\r\nstatic System::String* _$_cteStr49Obj;\r\n\r\n/* There is no Menu building. Please use startMenu before. */\r\nstatic const uniChar _$_cteStr48[] = {84,104,101,114,101,32,105,115,32,110,111,32,77,101,110,117,32,98,117,105,108,100,105,110,103,46,32,80,108,101,97,115,101,32,117,115,101,32,115,116,97,114,116,77,101,110,117,32,98,101,102,111,114,101,46};\r\nstatic System::String* _$_cteStr48Obj;\r\n\r\n/* A Menu is already being built at the moment. */\r\nstatic const uniChar _$_cteStr47[] = {65,32,77,101,110,117,32,105,115,32,97,108,114,101,97,100,121,32,98,101,105,110,103,32,98,117,105,108,116,32,97,116,32,116,104,101,32,109,111,109,101,110,116,46};\r\nstatic System::String* _$_cteStr47Obj;\r\n\r\n/* LibDB */\r\nstatic const uniChar _$_cteStr46[] = {76,105,98,68,66};\r\nstatic System::String* _$_cteStr46Obj;\r\n\r\n/* LibDATA */\r\nstatic const uniChar _$_cteStr45[] = {76,105,98,68,65,84,65};\r\nstatic System::String* _$_cteStr45Obj;\r\n\r\n/* LibBIN */\r\nstatic const uniChar _$_cteStr44[] = {76,105,98,66,73,78};\r\nstatic System::String* _$_cteStr44Obj;\r\n\r\n/* ] */\r\nstatic const uniChar _$_cteStr43[] = {93};\r\nstatic System::String* _$_cteStr43Obj;\r\n\r\n/* [ */\r\nstatic const uniChar _$_cteStr42[] = {91};\r\nstatic System::String* _$_cteStr42Obj;\r\n\r\n/* ####### Wrapper Reg Display ###### */\r\nstatic const uniChar _$_cteStr41[] = {35,35,35,35,35,35,35,32,87,114,97,112,112,101,114,32,82,101,103,32,68,105,115,112,108,97,121,32,35,35,35,35,35,35};\r\nstatic System::String* _$_cteStr41Obj;\r\n\r\n/* ################################## */\r\nstatic const uniChar _$_cteStr40[] = {35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35};\r\nstatic System::String* _$_cteStr40Obj;\r\n\r\n/* This handle is too high. */\r\nstatic const uniChar _$_cteStr39[] = {84,104,105,115,32,104,97,110,100,108,101,32,105,115,32,116,111,111,32,104,105,103,104,46};\r\nstatic System::String* _$_cteStr39Obj;\r\n\r\n/* [C#] WrapperReg.unregisterGameObject END */\r\nstatic const uniChar _$_cteStr38[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,46,117,110,114,101,103,105,115,116,101,114,71,97,109,101,79,98,106,101,99,116,32,69,78,68};\r\nstatic System::String* _$_cteStr38Obj;\r\n\r\n/* Already unregistered. */\r\nstatic const uniChar _$_cteStr37[] = {65,108,114,101,97,100,121,32,117,110,114,101,103,105,115,116,101,114,101,100,46};\r\nstatic System::String* _$_cteStr37Obj;\r\n\r\n/*  BEGIN */\r\nstatic const uniChar _$_cteStr36[] = {32,66,69,71,73,78};\r\nstatic System::String* _$_cteStr36Obj;\r\n\r\n/* [C#] WrapperReg.unregisterGameObject  */\r\nstatic const uniChar _$_cteStr35[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,46,117,110,114,101,103,105,115,116,101,114,71,97,109,101,79,98,106,101,99,116,32};\r\nstatic System::String* _$_cteStr35Obj;\r\n\r\n/* This object is already registered. */\r\nstatic const uniChar _$_cteStr34[] = {84,104,105,115,32,111,98,106,101,99,116,32,105,115,32,97,108,114,101,97,100,121,32,114,101,103,105,115,116,101,114,101,100,46};\r\nstatic System::String* _$_cteStr34Obj;\r\n\r\n/* Register GameObject with handle  */\r\nstatic const uniChar _$_cteStr33[] = {82,101,103,105,115,116,101,114,32,71,97,109,101,79,98,106,101,99,116,32,119,105,116,104,32,104,97,110,100,108,101,32};\r\nstatic System::String* _$_cteStr33Obj;\r\n\r\n/* [C#] WrapperReg - Register GameObject with handle  */\r\nstatic const uniChar _$_cteStr32[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,32,45,32,82,101,103,105,115,116,101,114,32,71,97,109,101,79,98,106,101,99,116,32,119,105,116,104,32,104,97,110,100,108,101,32};\r\nstatic System::String* _$_cteStr32Obj;\r\n\r\n/* [C#] WrapperReg - array RESIZE */\r\nstatic const uniChar _$_cteStr31[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,32,45,32,97,114,114,97,121,32,82,69,83,73,90,69};\r\nstatic System::String* _$_cteStr31Obj;\r\n\r\n/* [C#] WrapperReg - Handle OK */\r\nstatic const uniChar _$_cteStr30[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,32,45,32,72,97,110,100,108,101,32,79,75};\r\nstatic System::String* _$_cteStr30Obj;\r\n\r\n/* [C#] WrapperReg.registerGameObject BEGIN */\r\nstatic const uniChar _$_cteStr29[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,46,114,101,103,105,115,116,101,114,71,97,109,101,79,98,106,101,99,116,32,66,69,71,73,78};\r\nstatic System::String* _$_cteStr29Obj;\r\n\r\n/* [C#] WrapperReg cctor END */\r\nstatic const uniChar _$_cteStr28[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,32,99,99,116,111,114,32,69,78,68};\r\nstatic System::String* _$_cteStr28Obj;\r\n\r\n/* [C#] WrapperReg cctor BEGIN */\r\nstatic const uniChar _$_cteStr27[] = {91,67,35,93,32,87,114,97,112,112,101,114,82,101,103,32,99,99,116,111,114,32,66,69,71,73,78};\r\nstatic System::String* _$_cteStr27Obj;\r\n\r\n/* ) =  */\r\nstatic const uniChar _$_cteStr26[] = {41,32,61,32};\r\nstatic System::String* _$_cteStr26Obj;\r\n\r\n/* [C#] Utils.GetClassIDByName( */\r\nstatic const uniChar _$_cteStr25[] = {91,67,35,93,32,85,116,105,108,115,46,71,101,116,67,108,97,115,115,73,68,66,121,78,97,109,101,40};\r\nstatic System::String* _$_cteStr25Obj;\r\n\r\n/* There is not any Node compatible with this task. */\r\nstatic const uniChar _$_cteStr24[] = {84,104,101,114,101,32,105,115,32,110,111,116,32,97,110,121,32,78,111,100,101,32,99,111,109,112,97,116,105,98,108,101,32,119,105,116,104,32,116,104,105,115,32,116,97,115,107,46};\r\nstatic System::String* _$_cteStr24Obj;\r\n\r\n/* Unregister Wrapper */\r\nstatic const uniChar _$_cteStr23[] = {85,110,114,101,103,105,115,116,101,114,32,87,114,97,112,112,101,114};\r\nstatic System::String* _$_cteStr23Obj;\r\n\r\n/* [C#] NativeManagement.registerWrapper END */\r\nstatic const uniChar _$_cteStr22[] = {91,67,35,93,32,78,97,116,105,118,101,77,97,110,97,103,101,109,101,110,116,46,114,101,103,105,115,116,101,114,87,114,97,112,112,101,114,32,69,78,68};\r\nstatic System::String* _$_cteStr22Obj;\r\n\r\n/* C# object and C++ object don't have the same typeID, impossible to bind them. */\r\nstatic const uniChar _$_cteStr21[] = {67,35,32,111,98,106,101,99,116,32,97,110,100,32,67,43,43,32,111,98,106,101,99,116,32,100,111,110,39,116,32,104,97,118,101,32,116,104,101,32,115,97,109,101,32,116,121,112,101,73,68,44,32,105,109,112,111,115,115,105,98,108,101,32,116,111,32,98,105,110,100,32,116,104,101,109,46};\r\nstatic System::String* _$_cteStr21Obj;\r\n\r\n/* [C#] NativeManagement.registerWrapper BEGIN */\r\nstatic const uniChar _$_cteStr20[] = {91,67,35,93,32,78,97,116,105,118,101,77,97,110,97,103,101,109,101,110,116,46,114,101,103,105,115,116,101,114,87,114,97,112,112,101,114,32,66,69,71,73,78};\r\nstatic System::String* _$_cteStr20Obj;\r\n\r\n/* Error from C++ Engine :  */\r\nstatic const uniChar _$_cteStr19[] = {69,114,114,111,114,32,102,114,111,109,32,67,43,43,32,69,110,103,105,110,101,32,58,32};\r\nstatic System::String* _$_cteStr19Obj;\r\n\r\n/* . */\r\nstatic const uniChar _$_cteStr18[] = {46};\r\nstatic System::String* _$_cteStr18Obj;\r\n\r\n/* Invalid index, it must be between 0 and  */\r\nstatic const uniChar _$_cteStr17[] = {73,110,118,97,108,105,100,32,105,110,100,101,120,44,32,105,116,32,109,117,115,116,32,98,101,32,98,101,116,119,101,101,110,32,48,32,97,110,100,32};\r\nstatic System::String* _$_cteStr17Obj;\r\n\r\n/* NULL function pointer. */\r\nstatic const uniChar _$_cteStr16[] = {78,85,76,76,32,102,117,110,99,116,105,111,110,32,112,111,105,110,116,101,114,46};\r\nstatic System::String* _$_cteStr16Obj;\r\n\r\n/* This class doesn't have any callback */\r\nstatic const uniChar _$_cteStr15[] = {84,104,105,115,32,99,108,97,115,115,32,100,111,101,115,110,39,116,32,104,97,118,101,32,97,110,121,32,99,97,108,108,98,97,99,107};\r\nstatic System::String* _$_cteStr15Obj;\r\n\r\n/* [C#] GameObject.Dispose END */\r\nstatic const uniChar _$_cteStr14[] = {91,67,35,93,32,71,97,109,101,79,98,106,101,99,116,46,68,105,115,112,111,115,101,32,69,78,68};\r\nstatic System::String* _$_cteStr14Obj;\r\n\r\n/* [C#] GameObject.Dispose BEGIN */\r\nstatic const uniChar _$_cteStr13[] = {91,67,35,93,32,71,97,109,101,79,98,106,101,99,116,46,68,105,115,112,111,115,101,32,66,69,71,73,78};\r\nstatic System::String* _$_cteStr13Obj;\r\n\r\n/* [C#] GameObject.unbind() END */\r\nstatic const uniChar _$_cteStr12[] = {91,67,35,93,32,71,97,109,101,79,98,106,101,99,116,46,117,110,98,105,110,100,40,41,32,69,78,68};\r\nstatic System::String* _$_cteStr12Obj;\r\n\r\n/* [C#] GameObject.unbind() BEGIN */\r\nstatic const uniChar _$_cteStr11[] = {91,67,35,93,32,71,97,109,101,79,98,106,101,99,116,46,117,110,98,105,110,100,40,41,32,66,69,71,73,78};\r\nstatic System::String* _$_cteStr11Obj;\r\n\r\n/* There is not any Node with this name. */\r\nstatic const uniChar _$_cteStr10[] = {84,104,101,114,101,32,105,115,32,110,111,116,32,97,110,121,32,78,111,100,101,32,119,105,116,104,32,116,104,105,115,32,110,97,109,101,46};\r\nstatic System::String* _$_cteStr10Obj;\r\n\r\n/* Impossible to bind with a null name. */\r\nstatic const uniChar _$_cteStr9[] = {73,109,112,111,115,115,105,98,108,101,32,116,111,32,98,105,110,100,32,119,105,116,104,32,97,32,110,117,108,108,32,110,97,109,101,46};\r\nstatic System::String* _$_cteStr9Obj;\r\n\r\n/* Impossible to bind a null pointer (It can be a failure on Engine side while creating C++ instance). */\r\nstatic const uniChar _$_cteStr8[] = {73,109,112,111,115,115,105,98,108,101,32,116,111,32,98,105,110,100,32,97,32,110,117,108,108,32,112,111,105,110,116,101,114,32,40,73,116,32,99,97,110,32,98,101,32,97,32,102,97,105,108,117,114,101,32,111,110,32,69,110,103,105,110,101,32,115,105,100,101,32,119,104,105,108,101,32,99,114,101,97,116,105,110,103,32,67,43,43,32,105,110,115,116,97,110,99,101,41,46};\r\nstatic System::String* _$_cteStr8Obj;\r\n\r\n/* This GameObject is already binded. */\r\nstatic const uniChar _$_cteStr7[] = {84,104,105,115,32,71,97,109,101,79,98,106,101,99,116,32,105,115,32,97,108,114,101,97,100,121,32,98,105,110,100,101,100,46};\r\nstatic System::String* _$_cteStr7Obj;\r\n\r\n/* This C++ object is already wrapped. */\r\nstatic const uniChar _$_cteStr6[] = {84,104,105,115,32,67,43,43,32,111,98,106,101,99,116,32,105,115,32,97,108,114,101,97,100,121,32,119,114,97,112,112,101,100,46};\r\nstatic System::String* _$_cteStr6Obj;\r\n\r\n/* __Internal */\r\nstatic const uniChar _$_cteStr5[] = {95,95,73,110,116,101,114,110,97,108};\r\nstatic System::String* _$_cteStr5Obj;\r\n\r\n/* Use iterator or related object created in a different time frame / call back. */\r\nstatic const uniChar _$_cteStr4[] = {85,115,101,32,105,116,101,114,97,116,111,114,32,111,114,32,114,101,108,97,116,101,100,32,111,98,106,101,99,116,32,99,114,101,97,116,101,100,32,105,110,32,97,32,100,105,102,102,101,114,101,110,116,32,116,105,109,101,32,102,114,97,109,101,32,47,32,99,97,108,108,32,98,97,99,107,46};\r\nstatic System::String* _$_cteStr4Obj;\r\n\r\n/* Null CppObject Pointer. */\r\nstatic const uniChar _$_cteStr3[] = {78,117,108,108,32,67,112,112,79,98,106,101,99,116,32,80,111,105,110,116,101,114,46};\r\nstatic System::String* _$_cteStr3Obj;\r\n\r\n/* Forbidden Method */\r\nstatic const uniChar _$_cteStr2[] = {70,111,114,98,105,100,100,101,110,32,77,101,116,104,111,100};\r\nstatic System::String* _$_cteStr2Obj;\r\n\r\n/* Not implemented */\r\nstatic const uniChar _$_cteStr1[] = {78,111,116,32,105,109,112,108,101,109,101,110,116,101,100};\r\nstatic System::String* _$_cteStr1Obj;\r\n\r\n/*  */\r\nstatic System::String* _$_cteStr0Obj;\r\n\r\nvoid* _global_array_initializer_6(void* array_);\r\nvoid* _global_array_initializer_4(void* array_);\r\nvoid* _global_array_initializer_3(void* array_);\r\nvoid* _global_array_initializer_2(void* array_);\r\nvoid* _global_array_initializer_1(void* array_);\r\nvoid* _global_array_initializer_0(void* array_);\r\n\r\n\r\nnamespace EnginePrototype {\r\n    class _Delegate_Base_FunctionPointerV_inner0;\r\n    template <class TClass> class _DelegateI_FunctionPointerV_inner0;\r\n    class _DelegateS_FunctionPointerV_inner0;\r\n    class _Delegate_Base_FunctionPointerII_inner1;\r\n    template <class TClass> class _DelegateI_FunctionPointerII_inner1;\r\n    class _DelegateS_FunctionPointerII_inner1;\r\n    class _Delegate_Base_FunctionPointerIII_inner2;\r\n    template <class TClass> class _DelegateI_FunctionPointerIII_inner2;\r\n    class _DelegateS_FunctionPointerIII_inner2;\r\n    class _Delegate_Base_FunctionPointerIIII_inner3;\r\n    template <class TClass> class _DelegateI_FunctionPointerIIII_inner3;\r\n    class _DelegateS_FunctionPointerIIII_inner3;\r\n    class _Delegate_Base_FunctionPointerS_inner4;\r\n    template <class TClass> class _DelegateI_FunctionPointerS_inner4;\r\n    class _DelegateS_FunctionPointerS_inner4;\r\n    class _Delegate_Base_FunctionPointerSII_inner5;\r\n    template <class TClass> class _DelegateI_FunctionPointerSII_inner5;\r\n    class _DelegateS_FunctionPointerSII_inner5;\r\n    class _Delegate_Base_FunctionPointerSU_inner6;\r\n    template <class TClass> class _DelegateI_FunctionPointerSU_inner6;\r\n    class _DelegateS_FunctionPointerSU_inner6;\r\n    class _Delegate_Base_FunctionPointerSS_inner7;\r\n    template <class TClass> class _DelegateI_FunctionPointerSS_inner7;\r\n    class _DelegateS_FunctionPointerSS_inner7;\r\n    class _Delegate_Base_FunctionPointerUS_inner8;\r\n    template <class TClass> class _DelegateI_FunctionPointerUS_inner8;\r\n    class _DelegateS_FunctionPointerUS_inner8;\r\n    class _Delegate_Base_FunctionPointerUSS_inner9;\r\n    template <class TClass> class _DelegateI_FunctionPointerUSS_inner9;\r\n    class _DelegateS_FunctionPointerUSS_inner9;\r\n    class _Delegate_Base_FunctionPointerU_inner10;\r\n    template <class TClass> class _DelegateI_FunctionPointerU_inner10;\r\n    class _DelegateS_FunctionPointerU_inner10;\r\n    class _Delegate_Base_FunctionPointerUU_inner11;\r\n    template <class TClass> class _DelegateI_FunctionPointerUU_inner11;\r\n    class _DelegateS_FunctionPointerUU_inner11;\r\n    class _Delegate_Base_FunctionPointerUFF_inner12;\r\n    template <class TClass> class _DelegateI_FunctionPointerUFF_inner12;\r\n    class _DelegateS_FunctionPointerUFF_inner12;\r\n    class _Delegate_Base_FunctionPointerUI_inner13;\r\n    template <class TClass> class _DelegateI_FunctionPointerUI_inner13;\r\n    class _DelegateS_FunctionPointerUI_inner13;\r\n    class _Delegate_Base_FunctionPointerUII_inner14;\r\n    template <class TClass> class _DelegateI_FunctionPointerUII_inner14;\r\n    class _DelegateS_FunctionPointerUII_inner14;\r\n    class _Delegate_Base_FunctionPointerUIIII_inner15;\r\n    template <class TClass> class _DelegateI_FunctionPointerUIIII_inner15;\r\n    class _DelegateS_FunctionPointerUIIII_inner15;\r\n    class _Delegate_Base_FunctionPointerUIIUU_inner16;\r\n    template <class TClass> class _DelegateI_FunctionPointerUIIUU_inner16;\r\n    class _DelegateS_FunctionPointerUIIUU_inner16;\r\n    class _Delegate_Base_FunctionPointerUUII_inner17;\r\n    template <class TClass> class _DelegateI_FunctionPointerUUII_inner17;\r\n    class _DelegateS_FunctionPointerUUII_inner17;\r\n    class _Delegate_Base_FunctionPointerUUUII_inner18;\r\n    template <class TClass> class _DelegateI_FunctionPointerUUUII_inner18;\r\n    class _DelegateS_FunctionPointerUUUII_inner18;\r\n    class _Delegate_Base_FunctionPointerIIIP_retB_inner19;\r\n    template <class TClass> class _DelegateI_FunctionPointerIIIP_retB_inner19;\r\n    class _DelegateS_FunctionPointerIIIP_retB_inner19;\r\n    class _Delegate_Base_FunctionPointerFS_inner20;\r\n    template <class TClass> class _DelegateI_FunctionPointerFS_inner20;\r\n    class _DelegateS_FunctionPointerFS_inner20;\r\n    class _Delegate_Base_CallBack_inner21;\r\n    template <class TClass> class _DelegateI_CallBack_inner21;\r\n    class _DelegateS_CallBack_inner21;\r\n    class _Delegate_Base_ExecuteCallBack_inner22;\r\n    template <class TClass> class _DelegateI_ExecuteCallBack_inner22;\r\n    class _DelegateS_ExecuteCallBack_inner22;\r\n    class _Delegate_Base_DieCallBack_inner23;\r\n    template <class TClass> class _DelegateI_DieCallBack_inner23;\r\n    class _DelegateS_DieCallBack_inner23;\r\n    class _Delegate_Base_CallBack_inner24;\r\n    template <class TClass> class _DelegateI_CallBack_inner24;\r\n    class _DelegateS_CallBack_inner24;\r\n    class _Delegate_Base_CallBack_inner25;\r\n    template <class TClass> class _DelegateI_CallBack_inner25;\r\n    class _DelegateS_CallBack_inner25;\r\n    class _Delegate_Base_CallBackVersionUp_inner26;\r\n    template <class TClass> class _DelegateI_CallBackVersionUp_inner26;\r\n    class _DelegateS_CallBackVersionUp_inner26;\r\n    class _Delegate_Base_CallBack_inner27;\r\n    template <class TClass> class _DelegateI_CallBack_inner27;\r\n    class _DelegateS_CallBack_inner27;\r\n    class _Delegate_Base_onDieCallBack_inner28;\r\n    template <class TClass> class _DelegateI_onDieCallBack_inner28;\r\n    class _DelegateS_onDieCallBack_inner28;\r\n    class _Delegate_Base_CallBack_inner29;\r\n    template <class TClass> class _DelegateI_CallBack_inner29;\r\n    class _DelegateS_CallBack_inner29;\r\n    class _Delegate_Base_OnClickCallBack_inner30;\r\n    template <class TClass> class _DelegateI_OnClickCallBack_inner30;\r\n    class _DelegateS_OnClickCallBack_inner30;\r\n    class _Delegate_Base_OnDblClickCallBack_inner31;\r\n    template <class TClass> class _DelegateI_OnDblClickCallBack_inner31;\r\n    class _DelegateS_OnDblClickCallBack_inner31;\r\n    class _Delegate_Base_OnDragCallBack_inner32;\r\n    template <class TClass> class _DelegateI_OnDragCallBack_inner32;\r\n    class _DelegateS_OnDragCallBack_inner32;\r\n    class _Delegate_Base_OnPinchCallBack_inner33;\r\n    template <class TClass> class _DelegateI_OnPinchCallBack_inner33;\r\n    class _DelegateS_OnPinchCallBack_inner33;\r\n    class _Delegate_Base_OnLongTapCallBack_inner34;\r\n    template <class TClass> class _DelegateI_OnLongTapCallBack_inner34;\r\n    class _DelegateS_OnLongTapCallBack_inner34;\r\n    class _Delegate_Base_CallBack_inner35;\r\n    template <class TClass> class _DelegateI_CallBack_inner35;\r\n    class _DelegateS_CallBack_inner35;\r\n    class _Delegate_Base_CallBack_inner36;\r\n    template <class TClass> class _DelegateI_CallBack_inner36;\r\n    class _DelegateS_CallBack_inner36;\r\n    class _Delegate_Base_SelectableCallBack_inner37;\r\n    template <class TClass> class _DelegateI_SelectableCallBack_inner37;\r\n    class _DelegateS_SelectableCallBack_inner37;\r\n    class _Delegate_Base_AnimCallBack_inner38;\r\n    template <class TClass> class _DelegateI_AnimCallBack_inner38;\r\n    class _DelegateS_AnimCallBack_inner38;\r\n    class _Delegate_Base_AnimCallBack_inner39;\r\n    template <class TClass> class _DelegateI_AnimCallBack_inner39;\r\n    class _DelegateS_AnimCallBack_inner39;\r\n    class _Delegate_Base_LimitCallBack_inner40;\r\n    template <class TClass> class _DelegateI_LimitCallBack_inner40;\r\n    class _DelegateS_LimitCallBack_inner40;\r\n    class _Delegate_Base_DragCallBack_inner41;\r\n    template <class TClass> class _DelegateI_DragCallBack_inner41;\r\n    class _DelegateS_DragCallBack_inner41;\r\n    class _Delegate_Base_DynamicCallBack_inner42;\r\n    template <class TClass> class _DelegateI_DynamicCallBack_inner42;\r\n    class _DelegateS_DynamicCallBack_inner42;\r\n    class _Delegate_Base_ScrollBarCallBack_inner43;\r\n    template <class TClass> class _DelegateI_ScrollBarCallBack_inner43;\r\n    class _DelegateS_ScrollBarCallBack_inner43;\r\n    class _Delegate_Base_AnimCallBack_inner44;\r\n    template <class TClass> class _DelegateI_AnimCallBack_inner44;\r\n    class _DelegateS_AnimCallBack_inner44;\r\n    class _Delegate_Base_CallBack_inner45;\r\n    template <class TClass> class _DelegateI_CallBack_inner45;\r\n    class _DelegateS_CallBack_inner45;\r\n    class _Delegate_Base_ScrollBarCallBack_inner46;\r\n    template <class TClass> class _DelegateI_ScrollBarCallBack_inner46;\r\n    class _DelegateS_ScrollBarCallBack_inner46;\r\n    class _Delegate_Base_CallBack_inner47;\r\n    template <class TClass> class _DelegateI_CallBack_inner47;\r\n    class _DelegateS_CallBack_inner47;\r\n    class _Delegate_Base_CallBack_inner48;\r\n    template <class TClass> class _DelegateI_CallBack_inner48;\r\n    class _DelegateS_CallBack_inner48;\r\n    class _Delegate_Base_CallBack_inner49;\r\n    template <class TClass> class _DelegateI_CallBack_inner49;\r\n    class _DelegateS_CallBack_inner49;\r\n    class _Delegate_Base_CallBack_inner50;\r\n    template <class TClass> class _DelegateI_CallBack_inner50;\r\n    class _DelegateS_CallBack_inner50;\r\n    class _Delegate_Base_CallBack_inner51;\r\n    template <class TClass> class _DelegateI_CallBack_inner51;\r\n    class _DelegateS_CallBack_inner51;\r\n    class CKLBException;\r\n    class CKLBExceptionNotImplemented;\r\n    class CKLBExceptionForbiddenMethod;\r\n    class CKLBExceptionNullCppObject;\r\n    class CKLBExceptionTooOld;\r\n    class GameObject;\r\n    class GameObjectFactory;\r\n    class NativeManagement;\r\n    class NodeIterator;\r\n    class Element;\r\n    class Container;\r\n    class Selectable;\r\n    class AnimationNode;\r\n    struct Size;\r\n    struct USize;\r\n    struct FSize;\r\n    class IClientRequest;\r\n    class __FrameworkUtils;\r\n    class WrapperReg;\r\n    class CSAPP;\r\n    class CSAsset;\r\n    class CSBin;\r\n    class CSData;\r\n    class CSDB;\r\n    class CSDebug;\r\n    class CSEng;\r\n    class CSFont;\r\n    struct STextInfo_inner0;\r\n    class CSGL;\r\n    class CSKey;\r\n    class CSLang;\r\n    class CSMatrix;\r\n    class CSVector_inner1;\r\n    class CSRES;\r\n    class CSSound;\r\n    class CSSystem;\r\n    struct SystemInfo_inner2;\r\n    class CSUI;\r\n    class CKLBAsyncLoader;\r\n    class CKLBGenericTask;\r\n    class CKLBIntervalTimer;\r\n    class CKLBNetAPI;\r\n    class CKLBStoreService;\r\n    class CKLBTask;\r\n    class CKLBUICanvas;\r\n    class CKLBUIClip;\r\n    class CKLBUIControl;\r\n    class CKLBUIDebugItem;\r\n    class CKLBUIDragIcon;\r\n    struct Area_inner3;\r\n    class CKLBUIForm;\r\n    class CKLBUIFreeVertItem;\r\n    class CKLBUIGroup;\r\n    class CKLBUILabel;\r\n    class CKLBUIList;\r\n    class CKLBUIMoviePlayer;\r\n    class CKLBUIMultiImgItem;\r\n    class CKLBUIPieChart;\r\n    class CKLBUIPolyline;\r\n    class CKLBUIProgressBar;\r\n    class CKLBUIRubberBand;\r\n    class CKLBUIScale9;\r\n    class AnimationInfo;\r\n    class CKLBUIScore;\r\n    class CKLBUIScrollBar;\r\n    class CKLBUISimpleItem;\r\n    class CKLBUISWFPlayer;\r\n    class CKLBUITask;\r\n    class Spline_inner4;\r\n    class IntSpline_inner5;\r\n    class IntPoint_inner6;\r\n    class FloatSpline_inner7;\r\n    class FloatPoint_inner8;\r\n    class AnimSpline_inner9;\r\n    class CKLBUITextInput;\r\n    class CKLBUITouchPad;\r\n    class CKLBUIVariableItem;\r\n    class CKLBUIVirtualDoc;\r\n    class CKLBUIWebArea;\r\n\r\n}\r\nclass EnginePrototype::CKLBException : public System::Exception {\r\n\r\npublic:\r\n    void _ctor_CKLBException();\r\n    CKLBException(System::String* msg);\r\n    CKLBException();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 50;\r\n};\r\nclass EnginePrototype::CKLBExceptionNotImplemented : public EnginePrototype::CKLBException {\r\n\r\npublic:\r\n    void _ctor_CKLBExceptionNotImplemented();\r\n    CKLBExceptionNotImplemented(System::String* msg);\r\n    CKLBExceptionNotImplemented();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 51;\r\n};\r\nclass EnginePrototype::CKLBExceptionForbiddenMethod : public EnginePrototype::CKLBException {\r\n\r\npublic:\r\n    void _ctor_CKLBExceptionForbiddenMethod();\r\n    CKLBExceptionForbiddenMethod(System::String* msg);\r\n    CKLBExceptionForbiddenMethod();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 52;\r\n};\r\nclass EnginePrototype::CKLBExceptionNullCppObject : public EnginePrototype::CKLBException {\r\n\r\npublic:\r\n    void _ctor_CKLBExceptionNullCppObject();\r\n    CKLBExceptionNullCppObject(System::String* msg);\r\n    CKLBExceptionNullCppObject();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 53;\r\n};\r\nclass EnginePrototype::CKLBExceptionTooOld : public EnginePrototype::CKLBException {\r\n\r\npublic:\r\n    void _ctor_CKLBExceptionTooOld();\r\n    CKLBExceptionTooOld(System::String* msg);\r\n    CKLBExceptionTooOld();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 54;\r\n};\r\nclass EnginePrototype::GameObject : public System::Object ,public System::IDisposable {\r\n\r\npublic:\r\n    void _ctor_GameObject();\r\n    static u32 NULLHANDLER;\r\n    inline static u32 _sNULLHANDLERDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return NULLHANDLER /= value; }\r\n    inline static u32 _sNULLHANDLERModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return NULLHANDLER %= value; }\r\n\r\n    static u32 NBCALLBACKS;\r\n    inline static u32 _sNBCALLBACKSDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return NBCALLBACKS /= value; }\r\n    inline static u32 _sNBCALLBACKSModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return NBCALLBACKS %= value; }\r\n\r\n    System::Object* m_tag;\r\n    inline System::Object*& _gm_tag$() { CHCKTHIS; return m_tag; }\r\n    inline System::Object* _sm_tag(System::Object* _$value);\r\n    inline System::Object* _sm_tag$(System::Object* _$value);\r\n\r\n    u32 m_typeID;\r\n    inline u32& _gm_typeID$() { CHCKTHIS; return m_typeID; }\r\n    inline u32 _sm_typeID$(u32 _$value) { CHCKTHIS; return m_typeID = _$value; }\r\n    inline u32 _sm_typeID$postInc()\t\t\t\t{ CHCKTHIS; return m_typeID++; }\r\n    inline u32 _sm_typeID$postDec()\t\t\t\t{ CHCKTHIS; return m_typeID--; }\r\n    inline u32 _sm_typeID$preInc()\t\t\t\t{ CHCKTHIS; return ++m_typeID; }\r\n    inline u32 _sm_typeID$preDec()\t\t\t\t{ CHCKTHIS; return --m_typeID; }\r\n    inline u32 _sm_typeID$AddEq(u32 value)\t\t{ CHCKTHIS; return m_typeID += value; }\r\n    inline u32 _sm_typeID$SubEq(u32 value)\t\t{ CHCKTHIS; return m_typeID -= value; }\r\n    inline u32 _sm_typeID$MulEq(u32 value)\t\t{ CHCKTHIS; return m_typeID *= value; }\r\n    inline u32 _sm_typeID$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_typeID /= value; }\r\n    inline u32 _sm_typeID$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_typeID %= value; }\r\n    inline u32 _sm_typeID$XorEq(u32 value)\t\t{ CHCKTHIS; return m_typeID ^= value; }\r\n    inline u32 _sm_typeID$AndEq(u32 value)\t\t{ CHCKTHIS; return m_typeID &= value; }\r\n    inline u32 _sm_typeID$OrEq(u32 value)\t\t{ CHCKTHIS; return m_typeID |= value; }\r\n    inline u32 _sm_typeID$RShiftEq(u32 value)\t{ CHCKTHIS; return m_typeID >>= value; }\r\n    inline u32 _sm_typeID$LShiftEq(u32 value)\t{ CHCKTHIS; return m_typeID <<= value; }\r\n    inline u32 _sm_typeIDpostInc()\t\t\t\t{ return m_typeID++; }\r\n    inline u32 _sm_typeIDpostDec()\t\t\t\t{ return m_typeID--; }\r\n    inline u32 _sm_typeIDpreInc()\t\t\t\t{ return ++m_typeID; }\r\n    inline u32 _sm_typeIDpreDec()\t\t\t\t{ return --m_typeID; }\r\n    inline u32 _sm_typeIDAddEq(u32 value)\t\t{ return m_typeID += value; }\r\n    inline u32 _sm_typeIDSubEq(u32 value)\t\t{ return m_typeID -= value; }\r\n    inline u32 _sm_typeIDMulEq(u32 value)\t\t{ return m_typeID *= value; }\r\n    inline u32 _sm_typeIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_typeID /= value; }\r\n    inline u32 _sm_typeIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_typeID %= value; }\r\n    inline u32 _sm_typeIDXorEq(u32 value)\t\t{ return m_typeID ^= value; }\r\n    inline u32 _sm_typeIDAndEq(u32 value)\t\t{ return m_typeID &= value; }\r\n    inline u32 _sm_typeIDOrEq(u32 value)\t\t\t{ return m_typeID |= value; }\r\n    inline u32 _sm_typeIDRShiftEq(u32 value)\t\t{ return m_typeID >>= value; }\r\n    inline u32 _sm_typeIDLShiftEq(u32 value)\t\t{ return m_typeID <<= value; }\r\n\r\n    u32 m_handle;\r\n    inline u32& _gm_handle$() { CHCKTHIS; return m_handle; }\r\n    inline u32 _sm_handle$(u32 _$value) { CHCKTHIS; return m_handle = _$value; }\r\n    inline u32 _sm_handle$postInc()\t\t\t\t{ CHCKTHIS; return m_handle++; }\r\n    inline u32 _sm_handle$postDec()\t\t\t\t{ CHCKTHIS; return m_handle--; }\r\n    inline u32 _sm_handle$preInc()\t\t\t\t{ CHCKTHIS; return ++m_handle; }\r\n    inline u32 _sm_handle$preDec()\t\t\t\t{ CHCKTHIS; return --m_handle; }\r\n    inline u32 _sm_handle$AddEq(u32 value)\t\t{ CHCKTHIS; return m_handle += value; }\r\n    inline u32 _sm_handle$SubEq(u32 value)\t\t{ CHCKTHIS; return m_handle -= value; }\r\n    inline u32 _sm_handle$MulEq(u32 value)\t\t{ CHCKTHIS; return m_handle *= value; }\r\n    inline u32 _sm_handle$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_handle /= value; }\r\n    inline u32 _sm_handle$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_handle %= value; }\r\n    inline u32 _sm_handle$XorEq(u32 value)\t\t{ CHCKTHIS; return m_handle ^= value; }\r\n    inline u32 _sm_handle$AndEq(u32 value)\t\t{ CHCKTHIS; return m_handle &= value; }\r\n    inline u32 _sm_handle$OrEq(u32 value)\t\t{ CHCKTHIS; return m_handle |= value; }\r\n    inline u32 _sm_handle$RShiftEq(u32 value)\t{ CHCKTHIS; return m_handle >>= value; }\r\n    inline u32 _sm_handle$LShiftEq(u32 value)\t{ CHCKTHIS; return m_handle <<= value; }\r\n    inline u32 _sm_handlepostInc()\t\t\t\t{ return m_handle++; }\r\n    inline u32 _sm_handlepostDec()\t\t\t\t{ return m_handle--; }\r\n    inline u32 _sm_handlepreInc()\t\t\t\t{ return ++m_handle; }\r\n    inline u32 _sm_handlepreDec()\t\t\t\t{ return --m_handle; }\r\n    inline u32 _sm_handleAddEq(u32 value)\t\t{ return m_handle += value; }\r\n    inline u32 _sm_handleSubEq(u32 value)\t\t{ return m_handle -= value; }\r\n    inline u32 _sm_handleMulEq(u32 value)\t\t{ return m_handle *= value; }\r\n    inline u32 _sm_handleDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_handle /= value; }\r\n    inline u32 _sm_handleModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_handle %= value; }\r\n    inline u32 _sm_handleXorEq(u32 value)\t\t{ return m_handle ^= value; }\r\n    inline u32 _sm_handleAndEq(u32 value)\t\t{ return m_handle &= value; }\r\n    inline u32 _sm_handleOrEq(u32 value)\t\t\t{ return m_handle |= value; }\r\n    inline u32 _sm_handleRShiftEq(u32 value)\t\t{ return m_handle >>= value; }\r\n    inline u32 _sm_handleLShiftEq(u32 value)\t\t{ return m_handle <<= value; }\r\n\r\n    s32* m_cppObject;\r\n    inline s32*& _gm_cppObject$() { CHCKTHIS; return m_cppObject; }\r\n    inline s32* _sm_cppObject$(s32* _$value) { CHCKTHIS; return m_cppObject = _$value; }\r\n    inline s32* _sm_cppObject$AddEq(s32 value)\t\t{ CHCKTHIS; return m_cppObject += value; }\r\n    inline s32* _sm_cppObject$SubEq(s32 value)\t\t{ CHCKTHIS; return m_cppObject -= value; }\r\n    inline s32* _sm_cppObjectAddEq(s32 value)\t\t{ return m_cppObject += value; }\r\n    inline s32* _sm_cppObjectSubEq(s32 value)\t\t{ return m_cppObject -= value; }\r\n\r\n    System::Array<System::Delegate*>* m_callbacksArray;\r\n    inline System::Array<System::Delegate*>*& _gm_callbacksArray$() { CHCKTHIS; return m_callbacksArray; }\r\n    inline System::Array<System::Delegate*>* _sm_callbacksArray(System::Array<System::Delegate*>* _$value);\r\n    inline System::Array<System::Delegate*>* _sm_callbacksArray$(System::Array<System::Delegate*>* _$value);\r\n\r\n    inline System::Object* _acc_gTag();\r\n    inline System::Object* _acc_gTag$();\r\n\r\n    inline System::Object* _acc_sTag(System::Object* value);\r\n    inline System::Object* _acc_sTag$(System::Object* value);\r\n    inline u32 _acc_gTypeID();\r\n    inline u32 _acc_gTypeID$();\r\n\r\n    inline u32 _acc_gHandle();\r\n    inline u32 _acc_gHandle$();\r\n\r\n    inline u32 _acc_sHandle(u32 value);\r\n    inline u32 _acc_sHandle$(u32 value);\r\n    inline u32 _acc_sHandlepostInc()\t\t\t{ u32 tmp; _acc_sHandle((tmp = _acc_gHandle())+1); return tmp; }\r\n    inline u32 _acc_sHandle$postInc()\t\t\t{ CHCKTHIS; return _acc_sHandlepostInc(); }\r\n    inline u32 _acc_sHandlepostDec()\t\t\t{ u32 tmp; _acc_sHandle((tmp = _acc_gHandle())-1); return tmp; }\r\n    inline u32 _acc_sHandle$postDec()\t\t\t{ CHCKTHIS; return _acc_sHandlepostDec(); }\r\n    inline u32 _acc_sHandlepreInc()\t\t\t{ return _acc_sHandle(_acc_gHandle()+1); }\r\n    inline u32 _acc_sHandle$preInc()\t\t\t{ CHCKTHIS; return _acc_sHandlepreInc(); }\r\n    inline u32 _acc_sHandlepreDec()\t\t\t{ return _acc_sHandle(_acc_gHandle()-1); }\r\n    inline u32 _acc_sHandle$preDec()\t\t\t{ CHCKTHIS; return _acc_sHandlepreDec(); }\r\n    inline u32 _acc_sHandleAddEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() + value); }\r\n    inline u32 _acc_sHandle$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleAddEq(value); }\r\n    inline u32 _acc_sHandleSubEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() - value); }\r\n    inline u32 _acc_sHandle$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleSubEq(value); }\r\n    inline u32 _acc_sHandleMulEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() * value); }\r\n    inline u32 _acc_sHandle$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleMulEq(value); }\r\n    inline u32 _acc_sHandleDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHandle(_acc_gHandle() / value); }\r\n    inline u32 _acc_sHandle$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleDivEq(value); }\r\n    inline u32 _acc_sHandleModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHandle(_acc_gHandle() % value); }\r\n    inline u32 _acc_sHandle$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleModEq(value); }\r\n    inline u32 _acc_sHandleXorEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() ^ value); }\r\n    inline u32 _acc_sHandle$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleXorEq(value); }\r\n    inline u32 _acc_sHandleAndEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() & value); }\r\n    inline u32 _acc_sHandle$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleAndEq(value); }\r\n    inline u32 _acc_sHandleOrEq(u32 value)\t\t{ return _acc_sHandle(_acc_gHandle() | value); }\r\n    inline u32 _acc_sHandle$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleOrEq(value); }\r\n    inline u32 _acc_sHandleRShiftEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() >> value); }\r\n    inline u32 _acc_sHandle$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleRShiftEq(value); }\r\n    inline u32 _acc_sHandleLShiftEq(u32 value)\t{ return _acc_sHandle(_acc_gHandle() << value); }\r\n    inline u32 _acc_sHandle$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHandleLShiftEq(value); }\r\n    inline s32* _acc_gCppObject();\r\n    inline s32* _acc_gCppObject$();\r\n\r\n    inline s32* _acc_sCppObject(s32* value);\r\n    inline s32* _acc_sCppObject$(s32* value);\r\n    inline s32* _acc_sCppObjectAddEq(s32 value)\t{ return _acc_sCppObject(_acc_gCppObject() + value); }\r\n    inline s32* _acc_sCppObject$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sCppObjectAddEq(value); }\r\n    inline s32* _acc_sCppObjectSubEq(s32 value)\t{ return _acc_sCppObject(_acc_gCppObject() - value); }\r\n    inline s32* _acc_sCppObject$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sCppObjectSubEq(value); }\r\n    static u32 _ext_CKLBObjectScriptable_getScriptContext(s32* p);\r\n    static void _ext_CKLBObjectScriptable_setScriptContext(s32* p,u32 handle);\r\n    bool isBoundToCpp();\r\n    inline bool isBoundToCpp$();\r\n    GameObject(u32 typeID);\r\n    void bind(s32* cppObj);\r\n    inline void bind$(s32* cppObj);\r\n    void bind(System::String* nodeName);\r\n    inline void bind$(System::String* nodeName);\r\n    void unbind();\r\n    inline void unbind$();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void clearInternals();\r\n    inline void clearInternals$();\r\n    virtual void Dispose();\r\n    inline void Dispose$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    static void staticSetDelegate(u32 handle,System::Delegate* delegatePtr,System::String* delegateName);\r\n    void forceSetupCallBackWithVirtual(System::String* delegateName);\r\n    inline void forceSetupCallBackWithVirtual$(System::String* delegateName);\r\n    void registerCallBack(System::Delegate* callback,u32 index);\r\n    inline void registerCallBack$(System::Delegate* callback,u32 index);\r\n    System::Delegate* getCallBack(u32 index);\r\n    inline System::Delegate* getCallBack$(u32 index);\r\n    GameObject();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 55;\r\n};\r\nclass EnginePrototype::GameObjectFactory : public System::Object {\r\n\r\npublic:\r\n    void _ctor_GameObjectFactory();\r\n    GameObjectFactory();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 56;\r\n};\r\nclass EnginePrototype::NativeManagement : public System::Object {\r\nfriend class FunctionPointerV_inner0;\r\nfriend class FunctionPointerII_inner1;\r\nfriend class FunctionPointerIII_inner2;\r\nfriend class FunctionPointerIIII_inner3;\r\nfriend class FunctionPointerS_inner4;\r\nfriend class FunctionPointerSII_inner5;\r\nfriend class FunctionPointerSU_inner6;\r\nfriend class FunctionPointerSS_inner7;\r\nfriend class FunctionPointerUS_inner8;\r\nfriend class FunctionPointerUSS_inner9;\r\nfriend class FunctionPointerU_inner10;\r\nfriend class FunctionPointerUU_inner11;\r\nfriend class FunctionPointerUFF_inner12;\r\nfriend class FunctionPointerUI_inner13;\r\nfriend class FunctionPointerUII_inner14;\r\nfriend class FunctionPointerUIIII_inner15;\r\nfriend class FunctionPointerUIIUU_inner16;\r\nfriend class FunctionPointerUUII_inner17;\r\nfriend class FunctionPointerUUUII_inner18;\r\nfriend class FunctionPointerIIIP_retB_inner19;\r\nfriend class FunctionPointerFS_inner20;\r\n\r\npublic:\r\n    void _ctor_NativeManagement();\r\n    static s32* ms_cppErrorFlag;\r\n\r\n    static s32* ms_counter;\r\n\r\n    static inline u32 _acc_gCppErrorFlag();\r\n    static inline System::String* _acc_gCppErrorString();\r\n    static u32 _ext_CKLBObject_getTypeID(s32* p);\r\n    static u32 _ext_CKLBObjectScriptable_getScriptContext(s32* p);\r\n    static void _ext_CKLBObjectScriptable_setScriptContext(s32* p,u32 handle);\r\n    static s32* _ext_CKLBScriptEnv_getCallBackCount();\r\n    static s32* _ext_CKLBScriptEnv_getErrorPtr();\r\n    static s32* _ext_CKLBScriptEnv_getErrorString();\r\n    static void _ext_CKLBScriptEnv_resetError();\r\n    static void resetCppError();\r\n    static void intercepCppError();\r\n    static u32 getContextCounter();\r\n    static u32 getTypeID(s32* cppObj);\r\n    static void registerWrapper(s32* cppObj,u32 handle);\r\n    static void unregisterWrapper(s32* cppObj);\r\n    static void destroyFromNative(u32 handle);\r\n    static void doCallBackV(u32 cbInfos);\r\n    static void doCallBackII(u32 cbInfos,s32 int_1,s32 int_2);\r\n    static void doCallBackIII(u32 cbInfos,s32 int_1,s32 int_2,s32 int_3);\r\n    static void doCallBackIIII(u32 cbInfos,s32 int_1,s32 int_2,s32 int_3,s32 int_4);\r\n    static void doCallBackS(u32 cbInfos,s32* intptr_1);\r\n    static void doCallBackSII(u32 cbInfos,s32* intptr_1,s32 int_1,s32 int_2);\r\n    static void doCallBackSU(u32 cbInfos,s32* intptr_1,u32 uint_1);\r\n    static void doCallBackSS(u32 cbInfos,s32* intptr_1,s32* intptr_2);\r\n    static void doCallBackUS(u32 cbInfos,u32 uint_1,s32* intptr_1);\r\n    static void doCallBackUSS(u32 cbInfos,u32 uint_1,s32* intptr_1,s32* intptr_2);\r\n    static void doCallBackU(u32 cbInfos,u32 uint_1);\r\n    static void doCallBackUU(u32 cbInfos,u32 uint_1,u32 uint_2);\r\n    static void doCallBackUFF(u32 cbInfos,u32 uint_1,float float_1,float float_2);\r\n    static void doCallBackUI(u32 cbInfos,u32 uint_1,s32 int_1);\r\n    static void doCallBackUII(u32 cbInfos,u32 uint_1,s32 int_1,s32 int_2);\r\n    static void doCallBackUIIII(u32 cbInfos,u32 uint_1,s32 int_1,s32 int_2,s32 int_3,s32 int_4);\r\n    static void doCallBackUIIUU(u32 cbInfos,u32 uint_1,s32 int_1,s32 int_2,u32 uint_2,u32 uint_3);\r\n    static void doCallBackUUII(u32 cbInfos,u32 uint_1,u32 uint_2,s32 int_1,s32 int_2);\r\n    static void doCallBackUUUII(u32 cbInfos,u32 uint_1,u32 uint_2,u32 uint_3,s32 int_1,s32 int_2);\r\n    static bool doCallBackIIIP_retB(u32 cbInfos,s32 int_1,s32 int_2,s32 int_3,s32* obj_1);\r\n    static void doCallBackFS(u32 cbInfos,float float_1,s32* intptr_1);\r\n    NativeManagement();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 57;\r\n};\r\nclass EnginePrototype::NodeIterator : public System::Object {\r\n\r\npublic:\r\n    void _ctor_NodeIterator();\r\n    u32 m_counter;\r\n    inline u32& _gm_counter$() { CHCKTHIS; return m_counter; }\r\n    inline u32 _sm_counter$(u32 _$value) { CHCKTHIS; return m_counter = _$value; }\r\n    inline u32 _sm_counter$postInc()\t\t\t\t{ CHCKTHIS; return m_counter++; }\r\n    inline u32 _sm_counter$postDec()\t\t\t\t{ CHCKTHIS; return m_counter--; }\r\n    inline u32 _sm_counter$preInc()\t\t\t\t{ CHCKTHIS; return ++m_counter; }\r\n    inline u32 _sm_counter$preDec()\t\t\t\t{ CHCKTHIS; return --m_counter; }\r\n    inline u32 _sm_counter$AddEq(u32 value)\t\t{ CHCKTHIS; return m_counter += value; }\r\n    inline u32 _sm_counter$SubEq(u32 value)\t\t{ CHCKTHIS; return m_counter -= value; }\r\n    inline u32 _sm_counter$MulEq(u32 value)\t\t{ CHCKTHIS; return m_counter *= value; }\r\n    inline u32 _sm_counter$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_counter /= value; }\r\n    inline u32 _sm_counter$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_counter %= value; }\r\n    inline u32 _sm_counter$XorEq(u32 value)\t\t{ CHCKTHIS; return m_counter ^= value; }\r\n    inline u32 _sm_counter$AndEq(u32 value)\t\t{ CHCKTHIS; return m_counter &= value; }\r\n    inline u32 _sm_counter$OrEq(u32 value)\t\t{ CHCKTHIS; return m_counter |= value; }\r\n    inline u32 _sm_counter$RShiftEq(u32 value)\t{ CHCKTHIS; return m_counter >>= value; }\r\n    inline u32 _sm_counter$LShiftEq(u32 value)\t{ CHCKTHIS; return m_counter <<= value; }\r\n    inline u32 _sm_counterpostInc()\t\t\t\t{ return m_counter++; }\r\n    inline u32 _sm_counterpostDec()\t\t\t\t{ return m_counter--; }\r\n    inline u32 _sm_counterpreInc()\t\t\t\t{ return ++m_counter; }\r\n    inline u32 _sm_counterpreDec()\t\t\t\t{ return --m_counter; }\r\n    inline u32 _sm_counterAddEq(u32 value)\t\t{ return m_counter += value; }\r\n    inline u32 _sm_counterSubEq(u32 value)\t\t{ return m_counter -= value; }\r\n    inline u32 _sm_counterMulEq(u32 value)\t\t{ return m_counter *= value; }\r\n    inline u32 _sm_counterDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_counter /= value; }\r\n    inline u32 _sm_counterModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_counter %= value; }\r\n    inline u32 _sm_counterXorEq(u32 value)\t\t{ return m_counter ^= value; }\r\n    inline u32 _sm_counterAndEq(u32 value)\t\t{ return m_counter &= value; }\r\n    inline u32 _sm_counterOrEq(u32 value)\t\t\t{ return m_counter |= value; }\r\n    inline u32 _sm_counterRShiftEq(u32 value)\t\t{ return m_counter >>= value; }\r\n    inline u32 _sm_counterLShiftEq(u32 value)\t\t{ return m_counter <<= value; }\r\n\r\n    s32* m_nodeCpp;\r\n    inline s32*& _gm_nodeCpp$() { CHCKTHIS; return m_nodeCpp; }\r\n    inline s32* _sm_nodeCpp$(s32* _$value) { CHCKTHIS; return m_nodeCpp = _$value; }\r\n    inline s32* _sm_nodeCpp$AddEq(s32 value)\t\t{ CHCKTHIS; return m_nodeCpp += value; }\r\n    inline s32* _sm_nodeCpp$SubEq(s32 value)\t\t{ CHCKTHIS; return m_nodeCpp -= value; }\r\n    inline s32* _sm_nodeCppAddEq(s32 value)\t\t{ return m_nodeCpp += value; }\r\n    inline s32* _sm_nodeCppSubEq(s32 value)\t\t{ return m_nodeCpp -= value; }\r\n\r\n    System::Collections::Generic::List<s32*>* m_navigation;\r\n    inline System::Collections::Generic::List<s32*>*& _gm_navigation$() { CHCKTHIS; return m_navigation; }\r\n    inline System::Collections::Generic::List<s32*>* _sm_navigation(System::Collections::Generic::List<s32*>* _$value);\r\n    inline System::Collections::Generic::List<s32*>* _sm_navigation$(System::Collections::Generic::List<s32*>* _$value);\r\n\r\n    inline u32 _acc_gRgba();\r\n    inline u32 _acc_gRgba$();\r\n\r\n    inline u32 _acc_sRgba(u32 value);\r\n    inline u32 _acc_sRgba$(u32 value);\r\n    inline u32 _acc_sRgbapostInc()\t\t\t{ u32 tmp; _acc_sRgba((tmp = _acc_gRgba())+1); return tmp; }\r\n    inline u32 _acc_sRgba$postInc()\t\t\t{ CHCKTHIS; return _acc_sRgbapostInc(); }\r\n    inline u32 _acc_sRgbapostDec()\t\t\t{ u32 tmp; _acc_sRgba((tmp = _acc_gRgba())-1); return tmp; }\r\n    inline u32 _acc_sRgba$postDec()\t\t\t{ CHCKTHIS; return _acc_sRgbapostDec(); }\r\n    inline u32 _acc_sRgbapreInc()\t\t\t{ return _acc_sRgba(_acc_gRgba()+1); }\r\n    inline u32 _acc_sRgba$preInc()\t\t\t{ CHCKTHIS; return _acc_sRgbapreInc(); }\r\n    inline u32 _acc_sRgbapreDec()\t\t\t{ return _acc_sRgba(_acc_gRgba()-1); }\r\n    inline u32 _acc_sRgba$preDec()\t\t\t{ CHCKTHIS; return _acc_sRgbapreDec(); }\r\n    inline u32 _acc_sRgbaAddEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() + value); }\r\n    inline u32 _acc_sRgba$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaAddEq(value); }\r\n    inline u32 _acc_sRgbaSubEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() - value); }\r\n    inline u32 _acc_sRgba$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaSubEq(value); }\r\n    inline u32 _acc_sRgbaMulEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() * value); }\r\n    inline u32 _acc_sRgba$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaMulEq(value); }\r\n    inline u32 _acc_sRgbaDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sRgba(_acc_gRgba() / value); }\r\n    inline u32 _acc_sRgba$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaDivEq(value); }\r\n    inline u32 _acc_sRgbaModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sRgba(_acc_gRgba() % value); }\r\n    inline u32 _acc_sRgba$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaModEq(value); }\r\n    inline u32 _acc_sRgbaXorEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() ^ value); }\r\n    inline u32 _acc_sRgba$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaXorEq(value); }\r\n    inline u32 _acc_sRgbaAndEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() & value); }\r\n    inline u32 _acc_sRgba$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaAndEq(value); }\r\n    inline u32 _acc_sRgbaOrEq(u32 value)\t\t{ return _acc_sRgba(_acc_gRgba() | value); }\r\n    inline u32 _acc_sRgba$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaOrEq(value); }\r\n    inline u32 _acc_sRgbaRShiftEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() >> value); }\r\n    inline u32 _acc_sRgba$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaRShiftEq(value); }\r\n    inline u32 _acc_sRgbaLShiftEq(u32 value)\t{ return _acc_sRgba(_acc_gRgba() << value); }\r\n    inline u32 _acc_sRgba$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRgbaLShiftEq(value); }\r\n    inline float _acc_gScaleX();\r\n    inline float _acc_gScaleX$();\r\n\r\n    inline float _acc_sScaleX(float value);\r\n    inline float _acc_sScaleX$(float value);\r\n    inline float _acc_sScaleXpostInc()\t\t\t{ float tmp; _acc_sScaleX((tmp = _acc_gScaleX())+1); return tmp; }\r\n    inline float _acc_sScaleX$postInc()\t\t\t{ CHCKTHIS; return _acc_sScaleXpostInc(); }\r\n    inline float _acc_sScaleXpostDec()\t\t\t{ float tmp; _acc_sScaleX((tmp = _acc_gScaleX())-1); return tmp; }\r\n    inline float _acc_sScaleX$postDec()\t\t\t{ CHCKTHIS; return _acc_sScaleXpostDec(); }\r\n    inline float _acc_sScaleXpreInc()\t\t\t{ return _acc_sScaleX(_acc_gScaleX()+1); }\r\n    inline float _acc_sScaleX$preInc()\t\t\t{ CHCKTHIS; return _acc_sScaleXpreInc(); }\r\n    inline float _acc_sScaleXpreDec()\t\t\t{ return _acc_sScaleX(_acc_gScaleX()-1); }\r\n    inline float _acc_sScaleX$preDec()\t\t\t{ CHCKTHIS; return _acc_sScaleXpreDec(); }\r\n    inline float _acc_sScaleXAddEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() + value); }\r\n    inline float _acc_sScaleX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXAddEq(value); }\r\n    inline float _acc_sScaleXSubEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() - value); }\r\n    inline float _acc_sScaleX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXSubEq(value); }\r\n    inline float _acc_sScaleXMulEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() * value); }\r\n    inline float _acc_sScaleX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXMulEq(value); }\r\n    inline float _acc_sScaleXDivEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() / value); }\r\n    inline float _acc_sScaleX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXDivEq(value); }\r\n    inline float _acc_sScaleXModEq(float value)\t{  float orig = _acc_gScaleX(); s32 tmp = (s32)(orig / value); return _acc_sScaleX(orig - (tmp * value)); }\r\n    inline float _acc_sScaleX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXModEq(value); }\r\n    inline float _acc_gScaleY();\r\n    inline float _acc_gScaleY$();\r\n\r\n    inline float _acc_sScaleY(float value);\r\n    inline float _acc_sScaleY$(float value);\r\n    inline float _acc_sScaleYpostInc()\t\t\t{ float tmp; _acc_sScaleY((tmp = _acc_gScaleY())+1); return tmp; }\r\n    inline float _acc_sScaleY$postInc()\t\t\t{ CHCKTHIS; return _acc_sScaleYpostInc(); }\r\n    inline float _acc_sScaleYpostDec()\t\t\t{ float tmp; _acc_sScaleY((tmp = _acc_gScaleY())-1); return tmp; }\r\n    inline float _acc_sScaleY$postDec()\t\t\t{ CHCKTHIS; return _acc_sScaleYpostDec(); }\r\n    inline float _acc_sScaleYpreInc()\t\t\t{ return _acc_sScaleY(_acc_gScaleY()+1); }\r\n    inline float _acc_sScaleY$preInc()\t\t\t{ CHCKTHIS; return _acc_sScaleYpreInc(); }\r\n    inline float _acc_sScaleYpreDec()\t\t\t{ return _acc_sScaleY(_acc_gScaleY()-1); }\r\n    inline float _acc_sScaleY$preDec()\t\t\t{ CHCKTHIS; return _acc_sScaleYpreDec(); }\r\n    inline float _acc_sScaleYAddEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() + value); }\r\n    inline float _acc_sScaleY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYAddEq(value); }\r\n    inline float _acc_sScaleYSubEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() - value); }\r\n    inline float _acc_sScaleY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYSubEq(value); }\r\n    inline float _acc_sScaleYMulEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() * value); }\r\n    inline float _acc_sScaleY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYMulEq(value); }\r\n    inline float _acc_sScaleYDivEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() / value); }\r\n    inline float _acc_sScaleY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYDivEq(value); }\r\n    inline float _acc_sScaleYModEq(float value)\t{  float orig = _acc_gScaleY(); s32 tmp = (s32)(orig / value); return _acc_sScaleY(orig - (tmp * value)); }\r\n    inline float _acc_sScaleY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYModEq(value); }\r\n    inline float _acc_sScale(float value);\r\n    inline float _acc_sScale$(float value);\r\n    inline float _acc_gRotation();\r\n    inline float _acc_gRotation$();\r\n\r\n    inline float _acc_sRotation(float value);\r\n    inline float _acc_sRotation$(float value);\r\n    inline float _acc_sRotationpostInc()\t\t\t{ float tmp; _acc_sRotation((tmp = _acc_gRotation())+1); return tmp; }\r\n    inline float _acc_sRotation$postInc()\t\t\t{ CHCKTHIS; return _acc_sRotationpostInc(); }\r\n    inline float _acc_sRotationpostDec()\t\t\t{ float tmp; _acc_sRotation((tmp = _acc_gRotation())-1); return tmp; }\r\n    inline float _acc_sRotation$postDec()\t\t\t{ CHCKTHIS; return _acc_sRotationpostDec(); }\r\n    inline float _acc_sRotationpreInc()\t\t\t{ return _acc_sRotation(_acc_gRotation()+1); }\r\n    inline float _acc_sRotation$preInc()\t\t\t{ CHCKTHIS; return _acc_sRotationpreInc(); }\r\n    inline float _acc_sRotationpreDec()\t\t\t{ return _acc_sRotation(_acc_gRotation()-1); }\r\n    inline float _acc_sRotation$preDec()\t\t\t{ CHCKTHIS; return _acc_sRotationpreDec(); }\r\n    inline float _acc_sRotationAddEq(float value)\t{ return _acc_sRotation(_acc_gRotation() + value); }\r\n    inline float _acc_sRotation$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationAddEq(value); }\r\n    inline float _acc_sRotationSubEq(float value)\t{ return _acc_sRotation(_acc_gRotation() - value); }\r\n    inline float _acc_sRotation$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationSubEq(value); }\r\n    inline float _acc_sRotationMulEq(float value)\t{ return _acc_sRotation(_acc_gRotation() * value); }\r\n    inline float _acc_sRotation$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationMulEq(value); }\r\n    inline float _acc_sRotationDivEq(float value)\t{ return _acc_sRotation(_acc_gRotation() / value); }\r\n    inline float _acc_sRotation$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationDivEq(value); }\r\n    inline float _acc_sRotationModEq(float value)\t{  float orig = _acc_gRotation(); s32 tmp = (s32)(orig / value); return _acc_sRotation(orig - (tmp * value)); }\r\n    inline float _acc_sRotation$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationModEq(value); }\r\n    inline float _acc_gX();\r\n    inline float _acc_gX$();\r\n\r\n    inline float _acc_sX(float value);\r\n    inline float _acc_sX$(float value);\r\n    inline float _acc_sXpostInc()\t\t\t{ float tmp; _acc_sX((tmp = _acc_gX())+1); return tmp; }\r\n    inline float _acc_sX$postInc()\t\t\t{ CHCKTHIS; return _acc_sXpostInc(); }\r\n    inline float _acc_sXpostDec()\t\t\t{ float tmp; _acc_sX((tmp = _acc_gX())-1); return tmp; }\r\n    inline float _acc_sX$postDec()\t\t\t{ CHCKTHIS; return _acc_sXpostDec(); }\r\n    inline float _acc_sXpreInc()\t\t\t{ return _acc_sX(_acc_gX()+1); }\r\n    inline float _acc_sX$preInc()\t\t\t{ CHCKTHIS; return _acc_sXpreInc(); }\r\n    inline float _acc_sXpreDec()\t\t\t{ return _acc_sX(_acc_gX()-1); }\r\n    inline float _acc_sX$preDec()\t\t\t{ CHCKTHIS; return _acc_sXpreDec(); }\r\n    inline float _acc_sXAddEq(float value)\t{ return _acc_sX(_acc_gX() + value); }\r\n    inline float _acc_sX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXAddEq(value); }\r\n    inline float _acc_sXSubEq(float value)\t{ return _acc_sX(_acc_gX() - value); }\r\n    inline float _acc_sX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXSubEq(value); }\r\n    inline float _acc_sXMulEq(float value)\t{ return _acc_sX(_acc_gX() * value); }\r\n    inline float _acc_sX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXMulEq(value); }\r\n    inline float _acc_sXDivEq(float value)\t{ return _acc_sX(_acc_gX() / value); }\r\n    inline float _acc_sX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXDivEq(value); }\r\n    inline float _acc_sXModEq(float value)\t{  float orig = _acc_gX(); s32 tmp = (s32)(orig / value); return _acc_sX(orig - (tmp * value)); }\r\n    inline float _acc_sX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXModEq(value); }\r\n    inline float _acc_gY();\r\n    inline float _acc_gY$();\r\n\r\n    inline float _acc_sY(float value);\r\n    inline float _acc_sY$(float value);\r\n    inline float _acc_sYpostInc()\t\t\t{ float tmp; _acc_sY((tmp = _acc_gY())+1); return tmp; }\r\n    inline float _acc_sY$postInc()\t\t\t{ CHCKTHIS; return _acc_sYpostInc(); }\r\n    inline float _acc_sYpostDec()\t\t\t{ float tmp; _acc_sY((tmp = _acc_gY())-1); return tmp; }\r\n    inline float _acc_sY$postDec()\t\t\t{ CHCKTHIS; return _acc_sYpostDec(); }\r\n    inline float _acc_sYpreInc()\t\t\t{ return _acc_sY(_acc_gY()+1); }\r\n    inline float _acc_sY$preInc()\t\t\t{ CHCKTHIS; return _acc_sYpreInc(); }\r\n    inline float _acc_sYpreDec()\t\t\t{ return _acc_sY(_acc_gY()-1); }\r\n    inline float _acc_sY$preDec()\t\t\t{ CHCKTHIS; return _acc_sYpreDec(); }\r\n    inline float _acc_sYAddEq(float value)\t{ return _acc_sY(_acc_gY() + value); }\r\n    inline float _acc_sY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYAddEq(value); }\r\n    inline float _acc_sYSubEq(float value)\t{ return _acc_sY(_acc_gY() - value); }\r\n    inline float _acc_sY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYSubEq(value); }\r\n    inline float _acc_sYMulEq(float value)\t{ return _acc_sY(_acc_gY() * value); }\r\n    inline float _acc_sY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYMulEq(value); }\r\n    inline float _acc_sYDivEq(float value)\t{ return _acc_sY(_acc_gY() / value); }\r\n    inline float _acc_sY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYDivEq(value); }\r\n    inline float _acc_sYModEq(float value)\t{  float orig = _acc_gY(); s32 tmp = (s32)(orig / value); return _acc_sY(orig - (tmp * value)); }\r\n    inline float _acc_sY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYModEq(value); }\r\n    inline bool _acc_gVisible();\r\n    inline bool _acc_gVisible$();\r\n\r\n    inline bool _acc_sVisible(bool value);\r\n    inline bool _acc_sVisible$(bool value);\r\n    inline System::String* _acc_gName();\r\n    inline System::String* _acc_gName$();\r\n\r\n    inline System::String* _acc_sName(System::String* value);\r\n    inline System::String* _acc_sName$(System::String* value);\r\n    static s32* _ext_node_getRoot();\r\n    static s32* _ext_node_getChild(s32* pNode);\r\n    static s32* _ext_node_getParent(s32* pNode);\r\n    static s32* _ext_node_getBrother(s32* pNode);\r\n    static s32* _ext_node_getNodeFromTask(s32* pTask);\r\n    static float _ext_node_getNodeScaleX(s32* pNode);\r\n    static float _ext_node_getNodeScaleY(s32* pNode);\r\n    static float _ext_node_getRotation(s32* pNode);\r\n    static float _ext_node_getNodeTranslateX(s32* pNode);\r\n    static float _ext_node_getNodeTranslateY(s32* pNode);\r\n    static s32* _ext_node_getName(s32* pNode);\r\n    static void _ext_node_setName(s32* pNode,s32* name);\r\n    static void _ext_node_setTranslate(s32* pNode,float x,float y);\r\n    static void _ext_node_setRotation(s32* pNode,float deg);\r\n    static void _ext_node_setScale(s32* pNode,float scaleX,float scaleY);\r\n    static void _ext_node_getColorMatrixVec(s32* pNode,System::Array<float>* dst);\r\n    static void _ext_node_setColorMatrixVec(s32* pNode,System::Array<float>* src);\r\n    static u32 _ext_node_getColorMatrixUInt(s32* pNode);\r\n    static void _ext_node_setColorMatrixUInt(s32* pNode,u32 val);\r\n    static void _ext_node_setVisible(s32* pNode,bool visible);\r\n    static bool _ext_node_getVisible(s32* pNode);\r\n    static s32* _ext_node_asElement(s32* pNode);\r\n    static s32* _ext_node_asContainer(s32* pNode);\r\n    static s32* _ext_node_asSelectable(s32* pNode);\r\n    static s32* _ext_node_asAnimationNode(s32* pNode);\r\n    static s32* _ext_node_getUITask(s32* pNode);\r\n    static s32* _ext_node_search(s32* pNode,s32* name);\r\n    static s32* _ext_node_searchFirstByTypeID(s32* pNode,u32 typeID);\r\n    NodeIterator();\r\n    NodeIterator(u32 counter,s32* node);\r\n    static s32* getRoot();\r\n    static s32* getNodeFromTask(EnginePrototype::CKLBUITask* task);\r\n    EnginePrototype::Element* getAsElement();\r\n    inline EnginePrototype::Element* getAsElement$();\r\n    EnginePrototype::Container* getAsContainer();\r\n    inline EnginePrototype::Container* getAsContainer$();\r\n    EnginePrototype::Selectable* getAsSelectable();\r\n    inline EnginePrototype::Selectable* getAsSelectable$();\r\n    EnginePrototype::AnimationNode* getAsAnimationNode();\r\n    inline EnginePrototype::AnimationNode* getAsAnimationNode$();\r\n    bool gotoChild(bool registerStack);\r\n    inline bool gotoChild$(bool registerStack);\r\n    bool gotoBrother(bool registerStack);\r\n    inline bool gotoBrother$(bool registerStack);\r\n    bool gotoParent(bool registerStack);\r\n    inline bool gotoParent$(bool registerStack);\r\n    bool rollback();\r\n    inline bool rollback$();\r\n    bool find(System::String* name,bool registerStack);\r\n    inline bool find$(System::String* name,bool registerStack);\r\n    EnginePrototype::CKLBUITask* getAsUITask();\r\n    inline EnginePrototype::CKLBUITask* getAsUITask$();\r\n    EnginePrototype::CKLBUITask* bindTask(EnginePrototype::CKLBUITask* task,System::String* name);\r\n    inline EnginePrototype::CKLBUITask* bindTask$(EnginePrototype::CKLBUITask* task,System::String* name);\r\n    void setXY(float x,float y);\r\n    inline void setXY$(float x,float y);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 100;\r\n};\r\nclass EnginePrototype::Element : public System::Object {\r\n\r\npublic:\r\n    enum ASSET_TYPE {\r\n        NORMAL_ASSET = 0,\r\n        DISABLED_ASSET = 1,\r\n        FOCUSED_ASSET = 2,\r\n        PUSHED_ASSET = 3,\r\n        _ForceWORD_ASSET_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_Element();\r\n    s32* m_nodePtr;\r\n    inline s32*& _gm_nodePtr$() { CHCKTHIS; return m_nodePtr; }\r\n    inline s32* _sm_nodePtr$(s32* _$value) { CHCKTHIS; return m_nodePtr = _$value; }\r\n    inline s32* _sm_nodePtr$AddEq(s32 value)\t\t{ CHCKTHIS; return m_nodePtr += value; }\r\n    inline s32* _sm_nodePtr$SubEq(s32 value)\t\t{ CHCKTHIS; return m_nodePtr -= value; }\r\n    inline s32* _sm_nodePtrAddEq(s32 value)\t\t{ return m_nodePtr += value; }\r\n    inline s32* _sm_nodePtrSubEq(s32 value)\t\t{ return m_nodePtr -= value; }\r\n\r\n    u32 m_counter;\r\n    inline u32& _gm_counter$() { CHCKTHIS; return m_counter; }\r\n    inline u32 _sm_counter$(u32 _$value) { CHCKTHIS; return m_counter = _$value; }\r\n    inline u32 _sm_counter$postInc()\t\t\t\t{ CHCKTHIS; return m_counter++; }\r\n    inline u32 _sm_counter$postDec()\t\t\t\t{ CHCKTHIS; return m_counter--; }\r\n    inline u32 _sm_counter$preInc()\t\t\t\t{ CHCKTHIS; return ++m_counter; }\r\n    inline u32 _sm_counter$preDec()\t\t\t\t{ CHCKTHIS; return --m_counter; }\r\n    inline u32 _sm_counter$AddEq(u32 value)\t\t{ CHCKTHIS; return m_counter += value; }\r\n    inline u32 _sm_counter$SubEq(u32 value)\t\t{ CHCKTHIS; return m_counter -= value; }\r\n    inline u32 _sm_counter$MulEq(u32 value)\t\t{ CHCKTHIS; return m_counter *= value; }\r\n    inline u32 _sm_counter$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_counter /= value; }\r\n    inline u32 _sm_counter$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_counter %= value; }\r\n    inline u32 _sm_counter$XorEq(u32 value)\t\t{ CHCKTHIS; return m_counter ^= value; }\r\n    inline u32 _sm_counter$AndEq(u32 value)\t\t{ CHCKTHIS; return m_counter &= value; }\r\n    inline u32 _sm_counter$OrEq(u32 value)\t\t{ CHCKTHIS; return m_counter |= value; }\r\n    inline u32 _sm_counter$RShiftEq(u32 value)\t{ CHCKTHIS; return m_counter >>= value; }\r\n    inline u32 _sm_counter$LShiftEq(u32 value)\t{ CHCKTHIS; return m_counter <<= value; }\r\n    inline u32 _sm_counterpostInc()\t\t\t\t{ return m_counter++; }\r\n    inline u32 _sm_counterpostDec()\t\t\t\t{ return m_counter--; }\r\n    inline u32 _sm_counterpreInc()\t\t\t\t{ return ++m_counter; }\r\n    inline u32 _sm_counterpreDec()\t\t\t\t{ return --m_counter; }\r\n    inline u32 _sm_counterAddEq(u32 value)\t\t{ return m_counter += value; }\r\n    inline u32 _sm_counterSubEq(u32 value)\t\t{ return m_counter -= value; }\r\n    inline u32 _sm_counterMulEq(u32 value)\t\t{ return m_counter *= value; }\r\n    inline u32 _sm_counterDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_counter /= value; }\r\n    inline u32 _sm_counterModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_counter %= value; }\r\n    inline u32 _sm_counterXorEq(u32 value)\t\t{ return m_counter ^= value; }\r\n    inline u32 _sm_counterAndEq(u32 value)\t\t{ return m_counter &= value; }\r\n    inline u32 _sm_counterOrEq(u32 value)\t\t\t{ return m_counter |= value; }\r\n    inline u32 _sm_counterRShiftEq(u32 value)\t\t{ return m_counter >>= value; }\r\n    inline u32 _sm_counterLShiftEq(u32 value)\t\t{ return m_counter <<= value; }\r\n\r\n    inline bool _acc_gEnabled();\r\n    inline bool _acc_gEnabled$();\r\n\r\n    inline bool _acc_sEnabled(bool value);\r\n    inline bool _acc_sEnabled$(bool value);\r\n    inline System::String* _acc_snormalAsset(System::String* value);\r\n    inline System::String* _acc_snormalAsset$(System::String* value);\r\n    inline System::String* _acc_sdisableAsset(System::String* value);\r\n    inline System::String* _acc_sdisableAsset$(System::String* value);\r\n    static void _ext_element_setEnabled(s32* pElem,bool isEnabled);\r\n    static bool _ext_element_isEnabled(s32* pElem);\r\n    static bool _ext_element_setAsset(s32* pElem,u32 dest,s32* assetName);\r\n    static void _ext_element_setPriority(s32* pElem,u32 renderPriority);\r\n    static u32 _ext_element_getPriority(s32* pElem);\r\n    Element(u32 m_counter,s32* nodePtr);\r\n    Element();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 101;\r\n};\r\nclass EnginePrototype::Container : public EnginePrototype::Element {\r\n\r\npublic:\r\n    void _ctor_Container();\r\n    inline s32 _acc_gViewOffsetX();\r\n    inline s32 _acc_gViewOffsetX$();\r\n\r\n    inline s32 _acc_sViewOffsetX(s32 value);\r\n    inline s32 _acc_sViewOffsetX$(s32 value);\r\n    inline s32 _acc_sViewOffsetXpostInc()\t\t\t{ s32 tmp; _acc_sViewOffsetX((tmp = _acc_gViewOffsetX())+1); return tmp; }\r\n    inline s32 _acc_sViewOffsetX$postInc()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXpostInc(); }\r\n    inline s32 _acc_sViewOffsetXpostDec()\t\t\t{ s32 tmp; _acc_sViewOffsetX((tmp = _acc_gViewOffsetX())-1); return tmp; }\r\n    inline s32 _acc_sViewOffsetX$postDec()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXpostDec(); }\r\n    inline s32 _acc_sViewOffsetXpreInc()\t\t\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX()+1); }\r\n    inline s32 _acc_sViewOffsetX$preInc()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXpreInc(); }\r\n    inline s32 _acc_sViewOffsetXpreDec()\t\t\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX()-1); }\r\n    inline s32 _acc_sViewOffsetX$preDec()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXpreDec(); }\r\n    inline s32 _acc_sViewOffsetXAddEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() + value); }\r\n    inline s32 _acc_sViewOffsetX$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXAddEq(value); }\r\n    inline s32 _acc_sViewOffsetXSubEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() - value); }\r\n    inline s32 _acc_sViewOffsetX$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXSubEq(value); }\r\n    inline s32 _acc_sViewOffsetXMulEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() * value); }\r\n    inline s32 _acc_sViewOffsetX$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXMulEq(value); }\r\n    inline s32 _acc_sViewOffsetXDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewOffsetX(_acc_gViewOffsetX() / value); }\r\n    inline s32 _acc_sViewOffsetX$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXDivEq(value); }\r\n    inline s32 _acc_sViewOffsetXModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewOffsetX(_acc_gViewOffsetX() % value); }\r\n    inline s32 _acc_sViewOffsetX$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXModEq(value); }\r\n    inline s32 _acc_sViewOffsetXXorEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() ^ value); }\r\n    inline s32 _acc_sViewOffsetX$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXXorEq(value); }\r\n    inline s32 _acc_sViewOffsetXAndEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() & value); }\r\n    inline s32 _acc_sViewOffsetX$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXAndEq(value); }\r\n    inline s32 _acc_sViewOffsetXOrEq(s32 value)\t\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() | value); }\r\n    inline s32 _acc_sViewOffsetX$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXOrEq(value); }\r\n    inline s32 _acc_sViewOffsetXRShiftEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() >> value); }\r\n    inline s32 _acc_sViewOffsetX$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXRShiftEq(value); }\r\n    inline s32 _acc_sViewOffsetXLShiftEq(s32 value)\t{ return _acc_sViewOffsetX(_acc_gViewOffsetX() << value); }\r\n    inline s32 _acc_sViewOffsetX$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetXLShiftEq(value); }\r\n    inline s32 _acc_gViewOffsetY();\r\n    inline s32 _acc_gViewOffsetY$();\r\n\r\n    inline s32 _acc_sViewOffsetY(s32 value);\r\n    inline s32 _acc_sViewOffsetY$(s32 value);\r\n    inline s32 _acc_sViewOffsetYpostInc()\t\t\t{ s32 tmp; _acc_sViewOffsetY((tmp = _acc_gViewOffsetY())+1); return tmp; }\r\n    inline s32 _acc_sViewOffsetY$postInc()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYpostInc(); }\r\n    inline s32 _acc_sViewOffsetYpostDec()\t\t\t{ s32 tmp; _acc_sViewOffsetY((tmp = _acc_gViewOffsetY())-1); return tmp; }\r\n    inline s32 _acc_sViewOffsetY$postDec()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYpostDec(); }\r\n    inline s32 _acc_sViewOffsetYpreInc()\t\t\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY()+1); }\r\n    inline s32 _acc_sViewOffsetY$preInc()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYpreInc(); }\r\n    inline s32 _acc_sViewOffsetYpreDec()\t\t\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY()-1); }\r\n    inline s32 _acc_sViewOffsetY$preDec()\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYpreDec(); }\r\n    inline s32 _acc_sViewOffsetYAddEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() + value); }\r\n    inline s32 _acc_sViewOffsetY$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYAddEq(value); }\r\n    inline s32 _acc_sViewOffsetYSubEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() - value); }\r\n    inline s32 _acc_sViewOffsetY$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYSubEq(value); }\r\n    inline s32 _acc_sViewOffsetYMulEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() * value); }\r\n    inline s32 _acc_sViewOffsetY$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYMulEq(value); }\r\n    inline s32 _acc_sViewOffsetYDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewOffsetY(_acc_gViewOffsetY() / value); }\r\n    inline s32 _acc_sViewOffsetY$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYDivEq(value); }\r\n    inline s32 _acc_sViewOffsetYModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewOffsetY(_acc_gViewOffsetY() % value); }\r\n    inline s32 _acc_sViewOffsetY$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYModEq(value); }\r\n    inline s32 _acc_sViewOffsetYXorEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() ^ value); }\r\n    inline s32 _acc_sViewOffsetY$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYXorEq(value); }\r\n    inline s32 _acc_sViewOffsetYAndEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() & value); }\r\n    inline s32 _acc_sViewOffsetY$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYAndEq(value); }\r\n    inline s32 _acc_sViewOffsetYOrEq(s32 value)\t\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() | value); }\r\n    inline s32 _acc_sViewOffsetY$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYOrEq(value); }\r\n    inline s32 _acc_sViewOffsetYRShiftEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() >> value); }\r\n    inline s32 _acc_sViewOffsetY$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYRShiftEq(value); }\r\n    inline s32 _acc_sViewOffsetYLShiftEq(s32 value)\t{ return _acc_sViewOffsetY(_acc_gViewOffsetY() << value); }\r\n    inline s32 _acc_sViewOffsetY$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sViewOffsetYLShiftEq(value); }\r\n    inline u32 _acc_gRadioValue();\r\n    inline u32 _acc_gRadioValue$();\r\n\r\n    static s32 _ext_container_getViewOffsetX(s32* pCont);\r\n    static void _ext_container_setViewOffsetX(s32* pCont,s32 scrollX);\r\n    static s32 _ext_container_getViewOffsetY(s32* pCont);\r\n    static void _ext_container_setViewOffsetY(s32* pCont,s32 scrollY);\r\n    static u32 _ext_container_getRadioValue(s32* pCont);\r\n    Container(u32 m_counter,s32* nodePtr);\r\n    Container();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 103;\r\n};\r\nclass EnginePrototype::Selectable : public EnginePrototype::Element {\r\n\r\npublic:\r\n    void _ctor_Selectable();\r\n    inline System::String* _acc_spushedAsset(System::String* value);\r\n    inline System::String* _acc_spushedAsset$(System::String* value);\r\n    inline bool _acc_gisDown();\r\n    inline bool _acc_gisDown$();\r\n\r\n    inline bool _acc_sisDown(bool value);\r\n    inline bool _acc_sisDown$(bool value);\r\n    inline bool _acc_gcheckBoxMode();\r\n    inline bool _acc_gcheckBoxMode$();\r\n\r\n    inline bool _acc_scheckBoxMode(bool value);\r\n    inline bool _acc_scheckBoxMode$(bool value);\r\n    inline u32 _acc_gRadioID();\r\n    inline u32 _acc_gRadioID$();\r\n\r\n    inline u32 _acc_sRadioID(u32 value);\r\n    inline u32 _acc_sRadioID$(u32 value);\r\n    inline u32 _acc_sRadioIDpostInc()\t\t\t{ u32 tmp; _acc_sRadioID((tmp = _acc_gRadioID())+1); return tmp; }\r\n    inline u32 _acc_sRadioID$postInc()\t\t\t{ CHCKTHIS; return _acc_sRadioIDpostInc(); }\r\n    inline u32 _acc_sRadioIDpostDec()\t\t\t{ u32 tmp; _acc_sRadioID((tmp = _acc_gRadioID())-1); return tmp; }\r\n    inline u32 _acc_sRadioID$postDec()\t\t\t{ CHCKTHIS; return _acc_sRadioIDpostDec(); }\r\n    inline u32 _acc_sRadioIDpreInc()\t\t\t{ return _acc_sRadioID(_acc_gRadioID()+1); }\r\n    inline u32 _acc_sRadioID$preInc()\t\t\t{ CHCKTHIS; return _acc_sRadioIDpreInc(); }\r\n    inline u32 _acc_sRadioIDpreDec()\t\t\t{ return _acc_sRadioID(_acc_gRadioID()-1); }\r\n    inline u32 _acc_sRadioID$preDec()\t\t\t{ CHCKTHIS; return _acc_sRadioIDpreDec(); }\r\n    inline u32 _acc_sRadioIDAddEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() + value); }\r\n    inline u32 _acc_sRadioID$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDAddEq(value); }\r\n    inline u32 _acc_sRadioIDSubEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() - value); }\r\n    inline u32 _acc_sRadioID$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDSubEq(value); }\r\n    inline u32 _acc_sRadioIDMulEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() * value); }\r\n    inline u32 _acc_sRadioID$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDMulEq(value); }\r\n    inline u32 _acc_sRadioIDDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sRadioID(_acc_gRadioID() / value); }\r\n    inline u32 _acc_sRadioID$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDDivEq(value); }\r\n    inline u32 _acc_sRadioIDModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sRadioID(_acc_gRadioID() % value); }\r\n    inline u32 _acc_sRadioID$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDModEq(value); }\r\n    inline u32 _acc_sRadioIDXorEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() ^ value); }\r\n    inline u32 _acc_sRadioID$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDXorEq(value); }\r\n    inline u32 _acc_sRadioIDAndEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() & value); }\r\n    inline u32 _acc_sRadioID$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDAndEq(value); }\r\n    inline u32 _acc_sRadioIDOrEq(u32 value)\t\t{ return _acc_sRadioID(_acc_gRadioID() | value); }\r\n    inline u32 _acc_sRadioID$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDOrEq(value); }\r\n    inline u32 _acc_sRadioIDRShiftEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() >> value); }\r\n    inline u32 _acc_sRadioID$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDRShiftEq(value); }\r\n    inline u32 _acc_sRadioIDLShiftEq(u32 value)\t{ return _acc_sRadioID(_acc_gRadioID() << value); }\r\n    inline u32 _acc_sRadioID$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sRadioIDLShiftEq(value); }\r\n    static void _ext_selectable_setClick(s32* pSelect,s32 coordinateX,s32 coordinateY,s32 width,s32 height);\r\n    static bool _ext_selectable_setAudio(s32* pSelect,s32* assetAudio,u32 mode,float volume);\r\n    static void _ext_selectable_setStick(s32* pSelect,bool isStickable);\r\n    static bool _ext_selectable_isStickable(s32* pSelect);\r\n    static void _ext_selectable_setSticked(s32* pSelect,bool isSticked);\r\n    static bool _ext_selectable_isSticked(s32* pSelect);\r\n    static void _ext_selectable_setRadio(s32* pSelect,u32 radioID);\r\n    static u32 _ext_selectable_getRadioID(s32* pSelect);\r\n    Selectable(u32 m_counter,s32* nodePtr);\r\n    bool setAudio(System::String* assetName,u32 mode,float volume);\r\n    inline bool setAudio$(System::String* assetName,u32 mode,float volume);\r\n    void setClickArea(s32 x,s32 y,s32 width,s32 height);\r\n    inline void setClickArea$(s32 x,s32 y,s32 width,s32 height);\r\n    Selectable();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 104;\r\n};\r\nclass EnginePrototype::AnimationNode : public System::Object {\r\n\r\npublic:\r\n    void _ctor_AnimationNode();\r\n    s32* nodePtr;\r\n    inline s32*& _gnodePtr$() { CHCKTHIS; return nodePtr; }\r\n    inline s32* _snodePtr$(s32* _$value) { CHCKTHIS; return nodePtr = _$value; }\r\n    inline s32* _snodePtr$AddEq(s32 value)\t\t{ CHCKTHIS; return nodePtr += value; }\r\n    inline s32* _snodePtr$SubEq(s32 value)\t\t{ CHCKTHIS; return nodePtr -= value; }\r\n    inline s32* _snodePtrAddEq(s32 value)\t\t{ return nodePtr += value; }\r\n    inline s32* _snodePtrSubEq(s32 value)\t\t{ return nodePtr -= value; }\r\n\r\n    u32 m_counter;\r\n    inline u32& _gm_counter$() { CHCKTHIS; return m_counter; }\r\n    inline u32 _sm_counter$(u32 _$value) { CHCKTHIS; return m_counter = _$value; }\r\n    inline u32 _sm_counter$postInc()\t\t\t\t{ CHCKTHIS; return m_counter++; }\r\n    inline u32 _sm_counter$postDec()\t\t\t\t{ CHCKTHIS; return m_counter--; }\r\n    inline u32 _sm_counter$preInc()\t\t\t\t{ CHCKTHIS; return ++m_counter; }\r\n    inline u32 _sm_counter$preDec()\t\t\t\t{ CHCKTHIS; return --m_counter; }\r\n    inline u32 _sm_counter$AddEq(u32 value)\t\t{ CHCKTHIS; return m_counter += value; }\r\n    inline u32 _sm_counter$SubEq(u32 value)\t\t{ CHCKTHIS; return m_counter -= value; }\r\n    inline u32 _sm_counter$MulEq(u32 value)\t\t{ CHCKTHIS; return m_counter *= value; }\r\n    inline u32 _sm_counter$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_counter /= value; }\r\n    inline u32 _sm_counter$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_counter %= value; }\r\n    inline u32 _sm_counter$XorEq(u32 value)\t\t{ CHCKTHIS; return m_counter ^= value; }\r\n    inline u32 _sm_counter$AndEq(u32 value)\t\t{ CHCKTHIS; return m_counter &= value; }\r\n    inline u32 _sm_counter$OrEq(u32 value)\t\t{ CHCKTHIS; return m_counter |= value; }\r\n    inline u32 _sm_counter$RShiftEq(u32 value)\t{ CHCKTHIS; return m_counter >>= value; }\r\n    inline u32 _sm_counter$LShiftEq(u32 value)\t{ CHCKTHIS; return m_counter <<= value; }\r\n    inline u32 _sm_counterpostInc()\t\t\t\t{ return m_counter++; }\r\n    inline u32 _sm_counterpostDec()\t\t\t\t{ return m_counter--; }\r\n    inline u32 _sm_counterpreInc()\t\t\t\t{ return ++m_counter; }\r\n    inline u32 _sm_counterpreDec()\t\t\t\t{ return --m_counter; }\r\n    inline u32 _sm_counterAddEq(u32 value)\t\t{ return m_counter += value; }\r\n    inline u32 _sm_counterSubEq(u32 value)\t\t{ return m_counter -= value; }\r\n    inline u32 _sm_counterMulEq(u32 value)\t\t{ return m_counter *= value; }\r\n    inline u32 _sm_counterDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_counter /= value; }\r\n    inline u32 _sm_counterModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_counter %= value; }\r\n    inline u32 _sm_counterXorEq(u32 value)\t\t{ return m_counter ^= value; }\r\n    inline u32 _sm_counterAndEq(u32 value)\t\t{ return m_counter &= value; }\r\n    inline u32 _sm_counterOrEq(u32 value)\t\t\t{ return m_counter |= value; }\r\n    inline u32 _sm_counterRShiftEq(u32 value)\t\t{ return m_counter >>= value; }\r\n    inline u32 _sm_counterLShiftEq(u32 value)\t\t{ return m_counter <<= value; }\r\n\r\n    AnimationNode(u32 m_counter,s32* nodePtr);\r\n    void setAnimation(EnginePrototype::AnimationInfo* animationInfo);\r\n    inline void setAnimation$(EnginePrototype::AnimationInfo* animationInfo);\r\n    AnimationNode();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 105;\r\n};\r\nstruct EnginePrototype::Size : public System::__GCStruct {\r\n\r\npublic:\r\n    void _ctor_Size();\r\n    s32 width;\r\n    inline s32& _gwidth$() { CHCKTHIS; return width; }\r\n    inline s32 _swidth$(s32 _$value) { CHCKTHIS; return width = _$value; }\r\n    inline s32 _swidth$postInc()\t\t\t\t{ CHCKTHIS; return width++; }\r\n    inline s32 _swidth$postDec()\t\t\t\t{ CHCKTHIS; return width--; }\r\n    inline s32 _swidth$preInc()\t\t\t\t{ CHCKTHIS; return ++width; }\r\n    inline s32 _swidth$preDec()\t\t\t\t{ CHCKTHIS; return --width; }\r\n    inline s32 _swidth$AddEq(s32 value)\t\t{ CHCKTHIS; return width += value; }\r\n    inline s32 _swidth$SubEq(s32 value)\t\t{ CHCKTHIS; return width -= value; }\r\n    inline s32 _swidth$MulEq(s32 value)\t\t{ CHCKTHIS; return width *= value; }\r\n    inline s32 _swidth$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline s32 _swidth$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline s32 _swidth$XorEq(s32 value)\t\t{ CHCKTHIS; return width ^= value; }\r\n    inline s32 _swidth$AndEq(s32 value)\t\t{ CHCKTHIS; return width &= value; }\r\n    inline s32 _swidth$OrEq(s32 value)\t\t{ CHCKTHIS; return width |= value; }\r\n    inline s32 _swidth$RShiftEq(s32 value)\t{ CHCKTHIS; return width >>= value; }\r\n    inline s32 _swidth$LShiftEq(s32 value)\t{ CHCKTHIS; return width <<= value; }\r\n    inline s32 _swidthpostInc()\t\t\t\t{ return width++; }\r\n    inline s32 _swidthpostDec()\t\t\t\t{ return width--; }\r\n    inline s32 _swidthpreInc()\t\t\t\t{ return ++width; }\r\n    inline s32 _swidthpreDec()\t\t\t\t{ return --width; }\r\n    inline s32 _swidthAddEq(s32 value)\t\t{ return width += value; }\r\n    inline s32 _swidthSubEq(s32 value)\t\t{ return width -= value; }\r\n    inline s32 _swidthMulEq(s32 value)\t\t{ return width *= value; }\r\n    inline s32 _swidthDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline s32 _swidthModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline s32 _swidthXorEq(s32 value)\t\t{ return width ^= value; }\r\n    inline s32 _swidthAndEq(s32 value)\t\t{ return width &= value; }\r\n    inline s32 _swidthOrEq(s32 value)\t\t\t{ return width |= value; }\r\n    inline s32 _swidthRShiftEq(s32 value)\t\t{ return width >>= value; }\r\n    inline s32 _swidthLShiftEq(s32 value)\t\t{ return width <<= value; }\r\n\r\n    s32 height;\r\n    inline s32& _gheight$() { CHCKTHIS; return height; }\r\n    inline s32 _sheight$(s32 _$value) { CHCKTHIS; return height = _$value; }\r\n    inline s32 _sheight$postInc()\t\t\t\t{ CHCKTHIS; return height++; }\r\n    inline s32 _sheight$postDec()\t\t\t\t{ CHCKTHIS; return height--; }\r\n    inline s32 _sheight$preInc()\t\t\t\t{ CHCKTHIS; return ++height; }\r\n    inline s32 _sheight$preDec()\t\t\t\t{ CHCKTHIS; return --height; }\r\n    inline s32 _sheight$AddEq(s32 value)\t\t{ CHCKTHIS; return height += value; }\r\n    inline s32 _sheight$SubEq(s32 value)\t\t{ CHCKTHIS; return height -= value; }\r\n    inline s32 _sheight$MulEq(s32 value)\t\t{ CHCKTHIS; return height *= value; }\r\n    inline s32 _sheight$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline s32 _sheight$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline s32 _sheight$XorEq(s32 value)\t\t{ CHCKTHIS; return height ^= value; }\r\n    inline s32 _sheight$AndEq(s32 value)\t\t{ CHCKTHIS; return height &= value; }\r\n    inline s32 _sheight$OrEq(s32 value)\t\t{ CHCKTHIS; return height |= value; }\r\n    inline s32 _sheight$RShiftEq(s32 value)\t{ CHCKTHIS; return height >>= value; }\r\n    inline s32 _sheight$LShiftEq(s32 value)\t{ CHCKTHIS; return height <<= value; }\r\n    inline s32 _sheightpostInc()\t\t\t\t{ return height++; }\r\n    inline s32 _sheightpostDec()\t\t\t\t{ return height--; }\r\n    inline s32 _sheightpreInc()\t\t\t\t{ return ++height; }\r\n    inline s32 _sheightpreDec()\t\t\t\t{ return --height; }\r\n    inline s32 _sheightAddEq(s32 value)\t\t{ return height += value; }\r\n    inline s32 _sheightSubEq(s32 value)\t\t{ return height -= value; }\r\n    inline s32 _sheightMulEq(s32 value)\t\t{ return height *= value; }\r\n    inline s32 _sheightDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline s32 _sheightModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline s32 _sheightXorEq(s32 value)\t\t{ return height ^= value; }\r\n    inline s32 _sheightAndEq(s32 value)\t\t{ return height &= value; }\r\n    inline s32 _sheightOrEq(s32 value)\t\t\t{ return height |= value; }\r\n    inline s32 _sheightRShiftEq(s32 value)\t\t{ return height >>= value; }\r\n    inline s32 _sheightLShiftEq(s32 value)\t\t{ return height <<= value; }\r\n\r\n    Size();\r\n    inline u32 _processGC();\r\n    inline void _releaseGC();\r\n    inline void* _RefSetValue(void* newStruct);\r\n    virtual inline void _moveAlert(u32 offset);\r\n    inline static Size& __registerByRef(Size& m);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_STRUCT | 106;\r\n};\r\nstruct EnginePrototype::USize : public System::__GCStruct {\r\n\r\npublic:\r\n    void _ctor_USize();\r\n    u32 width;\r\n    inline u32& _gwidth$() { CHCKTHIS; return width; }\r\n    inline u32 _swidth$(u32 _$value) { CHCKTHIS; return width = _$value; }\r\n    inline u32 _swidth$postInc()\t\t\t\t{ CHCKTHIS; return width++; }\r\n    inline u32 _swidth$postDec()\t\t\t\t{ CHCKTHIS; return width--; }\r\n    inline u32 _swidth$preInc()\t\t\t\t{ CHCKTHIS; return ++width; }\r\n    inline u32 _swidth$preDec()\t\t\t\t{ CHCKTHIS; return --width; }\r\n    inline u32 _swidth$AddEq(u32 value)\t\t{ CHCKTHIS; return width += value; }\r\n    inline u32 _swidth$SubEq(u32 value)\t\t{ CHCKTHIS; return width -= value; }\r\n    inline u32 _swidth$MulEq(u32 value)\t\t{ CHCKTHIS; return width *= value; }\r\n    inline u32 _swidth$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline u32 _swidth$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline u32 _swidth$XorEq(u32 value)\t\t{ CHCKTHIS; return width ^= value; }\r\n    inline u32 _swidth$AndEq(u32 value)\t\t{ CHCKTHIS; return width &= value; }\r\n    inline u32 _swidth$OrEq(u32 value)\t\t{ CHCKTHIS; return width |= value; }\r\n    inline u32 _swidth$RShiftEq(u32 value)\t{ CHCKTHIS; return width >>= value; }\r\n    inline u32 _swidth$LShiftEq(u32 value)\t{ CHCKTHIS; return width <<= value; }\r\n    inline u32 _swidthpostInc()\t\t\t\t{ return width++; }\r\n    inline u32 _swidthpostDec()\t\t\t\t{ return width--; }\r\n    inline u32 _swidthpreInc()\t\t\t\t{ return ++width; }\r\n    inline u32 _swidthpreDec()\t\t\t\t{ return --width; }\r\n    inline u32 _swidthAddEq(u32 value)\t\t{ return width += value; }\r\n    inline u32 _swidthSubEq(u32 value)\t\t{ return width -= value; }\r\n    inline u32 _swidthMulEq(u32 value)\t\t{ return width *= value; }\r\n    inline u32 _swidthDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline u32 _swidthModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline u32 _swidthXorEq(u32 value)\t\t{ return width ^= value; }\r\n    inline u32 _swidthAndEq(u32 value)\t\t{ return width &= value; }\r\n    inline u32 _swidthOrEq(u32 value)\t\t\t{ return width |= value; }\r\n    inline u32 _swidthRShiftEq(u32 value)\t\t{ return width >>= value; }\r\n    inline u32 _swidthLShiftEq(u32 value)\t\t{ return width <<= value; }\r\n\r\n    u32 height;\r\n    inline u32& _gheight$() { CHCKTHIS; return height; }\r\n    inline u32 _sheight$(u32 _$value) { CHCKTHIS; return height = _$value; }\r\n    inline u32 _sheight$postInc()\t\t\t\t{ CHCKTHIS; return height++; }\r\n    inline u32 _sheight$postDec()\t\t\t\t{ CHCKTHIS; return height--; }\r\n    inline u32 _sheight$preInc()\t\t\t\t{ CHCKTHIS; return ++height; }\r\n    inline u32 _sheight$preDec()\t\t\t\t{ CHCKTHIS; return --height; }\r\n    inline u32 _sheight$AddEq(u32 value)\t\t{ CHCKTHIS; return height += value; }\r\n    inline u32 _sheight$SubEq(u32 value)\t\t{ CHCKTHIS; return height -= value; }\r\n    inline u32 _sheight$MulEq(u32 value)\t\t{ CHCKTHIS; return height *= value; }\r\n    inline u32 _sheight$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline u32 _sheight$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline u32 _sheight$XorEq(u32 value)\t\t{ CHCKTHIS; return height ^= value; }\r\n    inline u32 _sheight$AndEq(u32 value)\t\t{ CHCKTHIS; return height &= value; }\r\n    inline u32 _sheight$OrEq(u32 value)\t\t{ CHCKTHIS; return height |= value; }\r\n    inline u32 _sheight$RShiftEq(u32 value)\t{ CHCKTHIS; return height >>= value; }\r\n    inline u32 _sheight$LShiftEq(u32 value)\t{ CHCKTHIS; return height <<= value; }\r\n    inline u32 _sheightpostInc()\t\t\t\t{ return height++; }\r\n    inline u32 _sheightpostDec()\t\t\t\t{ return height--; }\r\n    inline u32 _sheightpreInc()\t\t\t\t{ return ++height; }\r\n    inline u32 _sheightpreDec()\t\t\t\t{ return --height; }\r\n    inline u32 _sheightAddEq(u32 value)\t\t{ return height += value; }\r\n    inline u32 _sheightSubEq(u32 value)\t\t{ return height -= value; }\r\n    inline u32 _sheightMulEq(u32 value)\t\t{ return height *= value; }\r\n    inline u32 _sheightDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline u32 _sheightModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline u32 _sheightXorEq(u32 value)\t\t{ return height ^= value; }\r\n    inline u32 _sheightAndEq(u32 value)\t\t{ return height &= value; }\r\n    inline u32 _sheightOrEq(u32 value)\t\t\t{ return height |= value; }\r\n    inline u32 _sheightRShiftEq(u32 value)\t\t{ return height >>= value; }\r\n    inline u32 _sheightLShiftEq(u32 value)\t\t{ return height <<= value; }\r\n\r\n    USize();\r\n    inline u32 _processGC();\r\n    inline void _releaseGC();\r\n    inline void* _RefSetValue(void* newStruct);\r\n    virtual inline void _moveAlert(u32 offset);\r\n    inline static USize& __registerByRef(USize& m);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_STRUCT | 107;\r\n};\r\nstruct EnginePrototype::FSize : public System::__GCStruct {\r\n\r\npublic:\r\n    void _ctor_FSize();\r\n    float width;\r\n    inline float& _gwidth$() { CHCKTHIS; return width; }\r\n    inline float _swidth$(float _$value) { CHCKTHIS; return width = _$value; }\r\n    inline float _swidth$postInc()\t\t\t\t{ CHCKTHIS; return width++; }\r\n    inline float _swidth$postDec()\t\t\t\t{ CHCKTHIS; return width--; }\r\n    inline float _swidth$preInc()\t\t\t\t{ CHCKTHIS; return ++width; }\r\n    inline float _swidth$preDec()\t\t\t\t{ CHCKTHIS; return --width; }\r\n    inline float _swidth$AddEq(float value)\t\t{ CHCKTHIS; return width += value; }\r\n    inline float _swidth$SubEq(float value)\t\t{ CHCKTHIS; return width -= value; }\r\n    inline float _swidth$MulEq(float value)\t\t{ CHCKTHIS; return width *= value; }\r\n    inline float _swidth$DivEq(float value)\t\t{ CHCKTHIS; ; return width /= value; }\r\n    inline float _swidth$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(width / value)); return width = width-(tmp*value); }\r\n    inline float _swidthpostInc()\t\t\t\t{ return width++; }\r\n    inline float _swidthpostDec()\t\t\t\t{ return width--; }\r\n    inline float _swidthpreInc()\t\t\t\t{ return ++width; }\r\n    inline float _swidthpreDec()\t\t\t\t{ return --width; }\r\n    inline float _swidthAddEq(float value)\t\t{ return width += value; }\r\n    inline float _swidthSubEq(float value)\t\t{ return width -= value; }\r\n    inline float _swidthMulEq(float value)\t\t{ return width *= value; }\r\n    inline float _swidthDivEq(float value)\t\t{ ; return width /= value; }\r\n    inline float _swidthModEq(float value)\t\t{ s32 tmp = ((s32)(width / value)); return width = width-(tmp*value); }\r\n\r\n    float height;\r\n    inline float& _gheight$() { CHCKTHIS; return height; }\r\n    inline float _sheight$(float _$value) { CHCKTHIS; return height = _$value; }\r\n    inline float _sheight$postInc()\t\t\t\t{ CHCKTHIS; return height++; }\r\n    inline float _sheight$postDec()\t\t\t\t{ CHCKTHIS; return height--; }\r\n    inline float _sheight$preInc()\t\t\t\t{ CHCKTHIS; return ++height; }\r\n    inline float _sheight$preDec()\t\t\t\t{ CHCKTHIS; return --height; }\r\n    inline float _sheight$AddEq(float value)\t\t{ CHCKTHIS; return height += value; }\r\n    inline float _sheight$SubEq(float value)\t\t{ CHCKTHIS; return height -= value; }\r\n    inline float _sheight$MulEq(float value)\t\t{ CHCKTHIS; return height *= value; }\r\n    inline float _sheight$DivEq(float value)\t\t{ CHCKTHIS; ; return height /= value; }\r\n    inline float _sheight$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(height / value)); return height = height-(tmp*value); }\r\n    inline float _sheightpostInc()\t\t\t\t{ return height++; }\r\n    inline float _sheightpostDec()\t\t\t\t{ return height--; }\r\n    inline float _sheightpreInc()\t\t\t\t{ return ++height; }\r\n    inline float _sheightpreDec()\t\t\t\t{ return --height; }\r\n    inline float _sheightAddEq(float value)\t\t{ return height += value; }\r\n    inline float _sheightSubEq(float value)\t\t{ return height -= value; }\r\n    inline float _sheightMulEq(float value)\t\t{ return height *= value; }\r\n    inline float _sheightDivEq(float value)\t\t{ ; return height /= value; }\r\n    inline float _sheightModEq(float value)\t\t{ s32 tmp = ((s32)(height / value)); return height = height-(tmp*value); }\r\n\r\n    FSize();\r\n    inline u32 _processGC();\r\n    inline void _releaseGC();\r\n    inline void* _RefSetValue(void* newStruct);\r\n    virtual inline void _moveAlert(u32 offset);\r\n    inline static FSize& __registerByRef(FSize& m);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_STRUCT | 108;\r\n};\r\nclass EnginePrototype::IClientRequest : public System::Object {\r\n\r\npublic:\r\n    enum EVENT_TYPE {\r\n        E_PAUSE,\r\n        E_RESUME,\r\n        E_TEXTCHANGE,\r\n        E_URLJUMP,\r\n        E_DIDSTARTLOADWEB,\r\n        E_DIDLOADENDWEB,\r\n        E_FAILEDLOADWEB,\r\n        E_STORE_BAD_ITEMID,\r\n        E_STORE_PURCHASHING,\r\n        E_STORE_PURCHASHED,\r\n        E_STORE_FAILED,\r\n        E_STORE_RESTORE,\r\n        E_STORE_RESTORE_FAILED,\r\n        E_STORE_RESTORE_COMPLETED,\r\n        E_STORE_GET_PRODUCTS,\r\n        E_SOUND_STATE_PLAY,\r\n        E_SOUND_STATE_STOP,\r\n        E_SOUND_STATE_PAUSE,\r\n        E_SOUND_STATE_INVALID_HANDLE,\r\n        _ForceWORD_EVENT_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_IClientRequest();\r\n    IClientRequest();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 109;\r\n};\r\nclass EnginePrototype::__FrameworkUtils : public System::Object {\r\n\r\npublic:\r\n    void _ctor___FrameworkUtils();\r\n    static u32 _ext_Cpp_getClassIDByName(s32* name);\r\n    static u32 GetClassIDByName(System::String* className);\r\n    static u32 RegisterClass(System::String* className);\r\n    __FrameworkUtils();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 111;\r\n};\r\nclass EnginePrototype::WrapperReg : public System::Object {\r\n\r\npublic:\r\n    void _ctor_WrapperReg();\r\n    s32 m_listSize;\r\n    inline s32& _gm_listSize$() { CHCKTHIS; return m_listSize; }\r\n    inline s32 _sm_listSize$(s32 _$value) { CHCKTHIS; return m_listSize = _$value; }\r\n    inline s32 _sm_listSize$postInc()\t\t\t\t{ CHCKTHIS; return m_listSize++; }\r\n    inline s32 _sm_listSize$postDec()\t\t\t\t{ CHCKTHIS; return m_listSize--; }\r\n    inline s32 _sm_listSize$preInc()\t\t\t\t{ CHCKTHIS; return ++m_listSize; }\r\n    inline s32 _sm_listSize$preDec()\t\t\t\t{ CHCKTHIS; return --m_listSize; }\r\n    inline s32 _sm_listSize$AddEq(s32 value)\t\t{ CHCKTHIS; return m_listSize += value; }\r\n    inline s32 _sm_listSize$SubEq(s32 value)\t\t{ CHCKTHIS; return m_listSize -= value; }\r\n    inline s32 _sm_listSize$MulEq(s32 value)\t\t{ CHCKTHIS; return m_listSize *= value; }\r\n    inline s32 _sm_listSize$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_listSize /= value; }\r\n    inline s32 _sm_listSize$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_listSize %= value; }\r\n    inline s32 _sm_listSize$XorEq(s32 value)\t\t{ CHCKTHIS; return m_listSize ^= value; }\r\n    inline s32 _sm_listSize$AndEq(s32 value)\t\t{ CHCKTHIS; return m_listSize &= value; }\r\n    inline s32 _sm_listSize$OrEq(s32 value)\t\t{ CHCKTHIS; return m_listSize |= value; }\r\n    inline s32 _sm_listSize$RShiftEq(s32 value)\t{ CHCKTHIS; return m_listSize >>= value; }\r\n    inline s32 _sm_listSize$LShiftEq(s32 value)\t{ CHCKTHIS; return m_listSize <<= value; }\r\n    inline s32 _sm_listSizepostInc()\t\t\t\t{ return m_listSize++; }\r\n    inline s32 _sm_listSizepostDec()\t\t\t\t{ return m_listSize--; }\r\n    inline s32 _sm_listSizepreInc()\t\t\t\t{ return ++m_listSize; }\r\n    inline s32 _sm_listSizepreDec()\t\t\t\t{ return --m_listSize; }\r\n    inline s32 _sm_listSizeAddEq(s32 value)\t\t{ return m_listSize += value; }\r\n    inline s32 _sm_listSizeSubEq(s32 value)\t\t{ return m_listSize -= value; }\r\n    inline s32 _sm_listSizeMulEq(s32 value)\t\t{ return m_listSize *= value; }\r\n    inline s32 _sm_listSizeDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_listSize /= value; }\r\n    inline s32 _sm_listSizeModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_listSize %= value; }\r\n    inline s32 _sm_listSizeXorEq(s32 value)\t\t{ return m_listSize ^= value; }\r\n    inline s32 _sm_listSizeAndEq(s32 value)\t\t{ return m_listSize &= value; }\r\n    inline s32 _sm_listSizeOrEq(s32 value)\t\t\t{ return m_listSize |= value; }\r\n    inline s32 _sm_listSizeRShiftEq(s32 value)\t\t{ return m_listSize >>= value; }\r\n    inline s32 _sm_listSizeLShiftEq(s32 value)\t\t{ return m_listSize <<= value; }\r\n\r\n    System::Array<EnginePrototype::GameObject*>* m_list;\r\n    inline System::Array<EnginePrototype::GameObject*>*& _gm_list$() { CHCKTHIS; return m_list; }\r\n    inline System::Array<EnginePrototype::GameObject*>* _sm_list(System::Array<EnginePrototype::GameObject*>* _$value);\r\n    inline System::Array<EnginePrototype::GameObject*>* _sm_list$(System::Array<EnginePrototype::GameObject*>* _$value);\r\n\r\n    System::Collections::Generic::List<u32>* m_freeHandlesList;\r\n    inline System::Collections::Generic::List<u32>*& _gm_freeHandlesList$() { CHCKTHIS; return m_freeHandlesList; }\r\n    inline System::Collections::Generic::List<u32>* _sm_freeHandlesList(System::Collections::Generic::List<u32>* _$value);\r\n    inline System::Collections::Generic::List<u32>* _sm_freeHandlesList$(System::Collections::Generic::List<u32>* _$value);\r\n\r\n    u32 m_objectCounter;\r\n    inline u32& _gm_objectCounter$() { CHCKTHIS; return m_objectCounter; }\r\n    inline u32 _sm_objectCounter$(u32 _$value) { CHCKTHIS; return m_objectCounter = _$value; }\r\n    inline u32 _sm_objectCounter$postInc()\t\t\t\t{ CHCKTHIS; return m_objectCounter++; }\r\n    inline u32 _sm_objectCounter$postDec()\t\t\t\t{ CHCKTHIS; return m_objectCounter--; }\r\n    inline u32 _sm_objectCounter$preInc()\t\t\t\t{ CHCKTHIS; return ++m_objectCounter; }\r\n    inline u32 _sm_objectCounter$preDec()\t\t\t\t{ CHCKTHIS; return --m_objectCounter; }\r\n    inline u32 _sm_objectCounter$AddEq(u32 value)\t\t{ CHCKTHIS; return m_objectCounter += value; }\r\n    inline u32 _sm_objectCounter$SubEq(u32 value)\t\t{ CHCKTHIS; return m_objectCounter -= value; }\r\n    inline u32 _sm_objectCounter$MulEq(u32 value)\t\t{ CHCKTHIS; return m_objectCounter *= value; }\r\n    inline u32 _sm_objectCounter$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_objectCounter /= value; }\r\n    inline u32 _sm_objectCounter$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_objectCounter %= value; }\r\n    inline u32 _sm_objectCounter$XorEq(u32 value)\t\t{ CHCKTHIS; return m_objectCounter ^= value; }\r\n    inline u32 _sm_objectCounter$AndEq(u32 value)\t\t{ CHCKTHIS; return m_objectCounter &= value; }\r\n    inline u32 _sm_objectCounter$OrEq(u32 value)\t\t{ CHCKTHIS; return m_objectCounter |= value; }\r\n    inline u32 _sm_objectCounter$RShiftEq(u32 value)\t{ CHCKTHIS; return m_objectCounter >>= value; }\r\n    inline u32 _sm_objectCounter$LShiftEq(u32 value)\t{ CHCKTHIS; return m_objectCounter <<= value; }\r\n    inline u32 _sm_objectCounterpostInc()\t\t\t\t{ return m_objectCounter++; }\r\n    inline u32 _sm_objectCounterpostDec()\t\t\t\t{ return m_objectCounter--; }\r\n    inline u32 _sm_objectCounterpreInc()\t\t\t\t{ return ++m_objectCounter; }\r\n    inline u32 _sm_objectCounterpreDec()\t\t\t\t{ return --m_objectCounter; }\r\n    inline u32 _sm_objectCounterAddEq(u32 value)\t\t{ return m_objectCounter += value; }\r\n    inline u32 _sm_objectCounterSubEq(u32 value)\t\t{ return m_objectCounter -= value; }\r\n    inline u32 _sm_objectCounterMulEq(u32 value)\t\t{ return m_objectCounter *= value; }\r\n    inline u32 _sm_objectCounterDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_objectCounter /= value; }\r\n    inline u32 _sm_objectCounterModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_objectCounter %= value; }\r\n    inline u32 _sm_objectCounterXorEq(u32 value)\t\t{ return m_objectCounter ^= value; }\r\n    inline u32 _sm_objectCounterAndEq(u32 value)\t\t{ return m_objectCounter &= value; }\r\n    inline u32 _sm_objectCounterOrEq(u32 value)\t\t\t{ return m_objectCounter |= value; }\r\n    inline u32 _sm_objectCounterRShiftEq(u32 value)\t\t{ return m_objectCounter >>= value; }\r\n    inline u32 _sm_objectCounterLShiftEq(u32 value)\t\t{ return m_objectCounter <<= value; }\r\n\r\n    static EnginePrototype::WrapperReg* reg;\r\n    inline static EnginePrototype::WrapperReg* _sreg(EnginePrototype::WrapperReg* _$value);\r\n\r\n    WrapperReg();\r\n    static EnginePrototype::WrapperReg* getInstance();\r\n    u32 registerGameObject(EnginePrototype::GameObject* pObj);\r\n    inline u32 registerGameObject$(EnginePrototype::GameObject* pObj);\r\n    void unregisterGameObject(EnginePrototype::GameObject* pObj);\r\n    inline void unregisterGameObject$(EnginePrototype::GameObject* pObj);\r\n    EnginePrototype::GameObject* getObjectFromHandle(u32 handle);\r\n    inline EnginePrototype::GameObject* getObjectFromHandle$(u32 handle);\r\n    void display();\r\n    inline void display$();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 113;\r\n};\r\nclass EnginePrototype::CSAPP : public System::Object {\r\n\r\npublic:\r\n    enum APP_TYPE {\r\n        APP_MAIL,\r\n        APP_BROWSER,\r\n        _ForceWORD_APP_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CSAPP();\r\n    static bool _ext_CKLBLuaLibAPP_callApplication(s32 type,s32* addr,s32* subject,s32* body);\r\n    static bool callApplication(s32 type,System::String* addr,System::String* subject,System::String* body);\r\n    CSAPP();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 114;\r\n};\r\nclass EnginePrototype::CSAsset : public System::Object {\r\n\r\npublic:\r\n    void _ctor_CSAsset();\r\n    static void _ext_CKLBLuaLibASSET_getImageSize(s32* assetName,s32& returnWidth,s32& returnHeight);\r\n    static void _ext_CKLBLuaLibASSET_getBoundSize(s32* assetName,float& returnWidth,float& returnHeight);\r\n    static void _ext_CKLBLuaLibASSET_getAssetInfo(s32* assetName,s32& returnImgWidth,s32& returnImgHeight,float& returnBoundWidth,float& returnBoundHeight);\r\n    static void getImageSize(System::String* assetPath,s32& width,s32& height);\r\n    static void getImageSize(System::String* assetPath,EnginePrototype::Size& size);\r\n    static void getBoundSize(System::String* assetPath,float& width,float& height);\r\n    static void getBoundSize(System::String* assetPath,EnginePrototype::FSize& size);\r\n    static void getAssetInfo(System::String* assetPath,s32& imgWidth,s32& imgHeight,float& boundWidth,float& boundHeight);\r\n    static void getAssetInfo(System::String* assetPath,EnginePrototype::Size& imgSize,EnginePrototype::FSize& boundSize);\r\n    CSAsset();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 116;\r\n};\r\nclass EnginePrototype::CSBin : public EnginePrototype::GameObject {\r\n\r\npublic:\r\n    void _ctor_CSBin();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    static s32* _ext_CKLBLuaLibBIN_open(s32* bin_asset);\r\n    static void _ext_CKLBLuaLibBIN_close(s32* pBIN);\r\n    static bool _ext_CKLBLuaLibBIN_peek(s32* pBIN,s32 offset,s32& value);\r\n    static bool _ext_CKLBLuaLibBIN_peek_u16(s32* pBIN,s32 offset,u32& value,bool f_bigendian);\r\n    static bool _ext_CKLBLuaLibBIN_peek_u32(s32* pBIN,s32 offset,u32& value,bool f_bigendian);\r\n    CSBin(System::String* bin_asset);\r\n    virtual void clearInternals();\r\n    inline void clearInternals$();\r\n    bool peek(s32 offset,s32& value);\r\n    inline bool peek$(s32 offset,s32& value);\r\n    bool peek_u16(s32 offset,u32& value,bool f_bigendian);\r\n    inline bool peek_u16$(s32 offset,u32& value,bool f_bigendian);\r\n    bool peek_u32(s32 offset,u32& value,bool f_bigendian);\r\n    inline bool peek_u32$(s32 offset,u32& value,bool f_bigendian);\r\n    CSBin();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 117;\r\n};\r\nclass EnginePrototype::CSData : public EnginePrototype::GameObject {\r\n\r\npublic:\r\n    void _ctor_CSData();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    static s32* _ext_CKLBLuaLibDATA_cmdCreateData(u32 dataSetID);\r\n    static bool _ext_CKLBLuaLibDATA_cmdRegistData(s32* pDataSet,s32* nameAsset,u32& pReturnHandle);\r\n    static void _ext_CKLBLuaLibDATA_cmdDelete(s32* pDataSet);\r\n    CSData(u32 ID);\r\n    bool registerData(System::String* nameAsset,u32& pReturnHandle);\r\n    inline bool registerData$(System::String* nameAsset,u32& pReturnHandle);\r\n    virtual void clearInternals();\r\n    inline void clearInternals$();\r\n    CSData();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 118;\r\n};\r\nclass EnginePrototype::CSDB : public EnginePrototype::GameObject {\r\n\r\npublic:\r\n    void _ctor_CSDB();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    bool m_isWritable;\r\n    inline bool& _gm_isWritable$() { CHCKTHIS; return m_isWritable; }\r\n    inline bool _sm_isWritable$(bool _$value) { CHCKTHIS; return m_isWritable = _$value; }\r\n\r\n    bool m_isCreatable;\r\n    inline bool& _gm_isCreatable$() { CHCKTHIS; return m_isCreatable; }\r\n    inline bool _sm_isCreatable$(bool _$value) { CHCKTHIS; return m_isCreatable = _$value; }\r\n\r\n    inline bool _acc_gIsWritable();\r\n    inline bool _acc_gIsWritable$();\r\n\r\n    inline bool _acc_gIsCreatable();\r\n    inline bool _acc_gIsCreatable$();\r\n\r\n    static s32* _ext_CKLBLuaLibDB_dbopen(s32* db_asset,bool b_write,bool b_create);\r\n    static void _ext_CKLBLuaLibDB_dbclose(s32* pDB);\r\n    static void _ext_CKLBLuaLibDB_closeAll();\r\n    static s32* _ext_CKLBLuaLibDB_query(s32* pDB,s32* sqlQuery,s32& nbEntries);\r\n    CSDB(System::String* db_asset,bool b_write,bool b_create);\r\n    virtual void clearInternals();\r\n    inline void clearInternals$();\r\n    static void closeAll();\r\n    void _ref_query(System::String* sqlQuery,System::Array<System::String*>*& results);\r\n    inline void query$(System::String* sqlQuery,System::Array<System::String*>*& results);\r\n    inline void query(System::String* sqlQuery,System::Array<System::String*>*& results);\r\n    CSDB();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 119;\r\n};\r\nclass EnginePrototype::CSDebug : public System::Object {\r\n\r\npublic:\r\n    enum ESECTION_TYPE {\r\n        M_SWITCH = 0,\r\n        M_NUMBER = 1,\r\n        M_SELECT = 2,\r\n        _ForceWORD_ESECTION_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CSDebug();\r\n    static bool s_isBuildingMenu;\r\n\r\n    static void _ext_CKLBLuaLibDEBUG_startMenu(u32 maxCount,s32* caption,s32* key);\r\n    static void _ext_CKLBLuaLibDEBUG_addItem(u32 mode,s32* caption,s32* key,s32 min,s32 max,s32 value,System::Array<s32*>* items,u32 itemsCount);\r\n    static void _ext_CKLBLuaLibDEBUG_endMenu();\r\n    static void _ext_CKLBLuaLibDEBUG_removeMenu(s32* key);\r\n    static void setCallback();\r\n    static void startMenu(u32 maxCount,System::String* caption,System::String* key);\r\n    static void addItemSwitch(System::String* itemName,System::String* itemKey,bool defaultValue);\r\n    static void addItemSelect(System::String* itemName,System::String* itemKey,System::String* defaultValue,System::Array<System::String*>* items);\r\n    static void addItemNumber(System::String* itemName,System::String* itemKey,s32 lowerLimit,s32 upperLimit,s32 defaultValue);\r\n    static void endMenu();\r\n    static void removeMenu(System::String* key);\r\n    CSDebug();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 120;\r\n};\r\nclass EnginePrototype::CSEng : public System::Object {\r\n\r\npublic:\r\n    void _ctor_CSEng();\r\n    static inline bool _acc_gIsRelease();\r\n    static inline System::String* _acc_gPlatform();\r\n    static inline u32 _acc_gFrameId();\r\n    static bool _ext_CKLBLuaLibENG_isRelease();\r\n    static s32* _ext_CKLBLuaLibENG_getPlatform();\r\n    static void _ext_CKLBLuaLibENG_getNanoTime(s32& milli,s32& nano);\r\n    static void _ext_CKLBLuaLibENG_startNanoTime(s32 idx);\r\n    static void _ext_CKLBLuaLibENG_endNanoTime(s32 idx,s32& milli,s32& nano);\r\n    static u32 _ext_CKLBLuaLibENG_getFrameID();\r\n    static void getNanoTime(s32& milli,s32& nano);\r\n    static void startNanoTime(s32 idx);\r\n    static void endNanoTime(s32 idx,s32& milli,s32& nano);\r\n    CSEng();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 122;\r\n};\r\nclass EnginePrototype::CSFont : public EnginePrototype::GameObject {\r\nfriend struct STextInfo_inner0;\r\n\r\npublic:\r\n    void _ctor_CSFont();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    u32 m_size;\r\n    inline u32& _gm_size$() { CHCKTHIS; return m_size; }\r\n    inline u32 _sm_size$(u32 _$value) { CHCKTHIS; return m_size = _$value; }\r\n    inline u32 _sm_size$postInc()\t\t\t\t{ CHCKTHIS; return m_size++; }\r\n    inline u32 _sm_size$postDec()\t\t\t\t{ CHCKTHIS; return m_size--; }\r\n    inline u32 _sm_size$preInc()\t\t\t\t{ CHCKTHIS; return ++m_size; }\r\n    inline u32 _sm_size$preDec()\t\t\t\t{ CHCKTHIS; return --m_size; }\r\n    inline u32 _sm_size$AddEq(u32 value)\t\t{ CHCKTHIS; return m_size += value; }\r\n    inline u32 _sm_size$SubEq(u32 value)\t\t{ CHCKTHIS; return m_size -= value; }\r\n    inline u32 _sm_size$MulEq(u32 value)\t\t{ CHCKTHIS; return m_size *= value; }\r\n    inline u32 _sm_size$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_size /= value; }\r\n    inline u32 _sm_size$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_size %= value; }\r\n    inline u32 _sm_size$XorEq(u32 value)\t\t{ CHCKTHIS; return m_size ^= value; }\r\n    inline u32 _sm_size$AndEq(u32 value)\t\t{ CHCKTHIS; return m_size &= value; }\r\n    inline u32 _sm_size$OrEq(u32 value)\t\t{ CHCKTHIS; return m_size |= value; }\r\n    inline u32 _sm_size$RShiftEq(u32 value)\t{ CHCKTHIS; return m_size >>= value; }\r\n    inline u32 _sm_size$LShiftEq(u32 value)\t{ CHCKTHIS; return m_size <<= value; }\r\n    inline u32 _sm_sizepostInc()\t\t\t\t{ return m_size++; }\r\n    inline u32 _sm_sizepostDec()\t\t\t\t{ return m_size--; }\r\n    inline u32 _sm_sizepreInc()\t\t\t\t{ return ++m_size; }\r\n    inline u32 _sm_sizepreDec()\t\t\t\t{ return --m_size; }\r\n    inline u32 _sm_sizeAddEq(u32 value)\t\t{ return m_size += value; }\r\n    inline u32 _sm_sizeSubEq(u32 value)\t\t{ return m_size -= value; }\r\n    inline u32 _sm_sizeMulEq(u32 value)\t\t{ return m_size *= value; }\r\n    inline u32 _sm_sizeDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_size /= value; }\r\n    inline u32 _sm_sizeModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_size %= value; }\r\n    inline u32 _sm_sizeXorEq(u32 value)\t\t{ return m_size ^= value; }\r\n    inline u32 _sm_sizeAndEq(u32 value)\t\t{ return m_size &= value; }\r\n    inline u32 _sm_sizeOrEq(u32 value)\t\t\t{ return m_size |= value; }\r\n    inline u32 _sm_sizeRShiftEq(u32 value)\t\t{ return m_size >>= value; }\r\n    inline u32 _sm_sizeLShiftEq(u32 value)\t\t{ return m_size <<= value; }\r\n\r\n    System::String* m_name;\r\n    inline System::String*& _gm_name$() { CHCKTHIS; return m_name; }\r\n    inline System::String* _sm_name(System::String* _$value);\r\n    inline System::String* _sm_name$(System::String* _$value);\r\n\r\n    inline u32 _acc_gSize();\r\n    inline u32 _acc_gSize$();\r\n\r\n    inline u32 _acc_sSize(u32 value);\r\n    inline u32 _acc_sSize$(u32 value);\r\n    inline u32 _acc_sSizepostInc()\t\t\t{ u32 tmp; _acc_sSize((tmp = _acc_gSize())+1); return tmp; }\r\n    inline u32 _acc_sSize$postInc()\t\t\t{ CHCKTHIS; return _acc_sSizepostInc(); }\r\n    inline u32 _acc_sSizepostDec()\t\t\t{ u32 tmp; _acc_sSize((tmp = _acc_gSize())-1); return tmp; }\r\n    inline u32 _acc_sSize$postDec()\t\t\t{ CHCKTHIS; return _acc_sSizepostDec(); }\r\n    inline u32 _acc_sSizepreInc()\t\t\t{ return _acc_sSize(_acc_gSize()+1); }\r\n    inline u32 _acc_sSize$preInc()\t\t\t{ CHCKTHIS; return _acc_sSizepreInc(); }\r\n    inline u32 _acc_sSizepreDec()\t\t\t{ return _acc_sSize(_acc_gSize()-1); }\r\n    inline u32 _acc_sSize$preDec()\t\t\t{ CHCKTHIS; return _acc_sSizepreDec(); }\r\n    inline u32 _acc_sSizeAddEq(u32 value)\t{ return _acc_sSize(_acc_gSize() + value); }\r\n    inline u32 _acc_sSize$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeAddEq(value); }\r\n    inline u32 _acc_sSizeSubEq(u32 value)\t{ return _acc_sSize(_acc_gSize() - value); }\r\n    inline u32 _acc_sSize$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeSubEq(value); }\r\n    inline u32 _acc_sSizeMulEq(u32 value)\t{ return _acc_sSize(_acc_gSize() * value); }\r\n    inline u32 _acc_sSize$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeMulEq(value); }\r\n    inline u32 _acc_sSizeDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSize(_acc_gSize() / value); }\r\n    inline u32 _acc_sSize$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeDivEq(value); }\r\n    inline u32 _acc_sSizeModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSize(_acc_gSize() % value); }\r\n    inline u32 _acc_sSize$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeModEq(value); }\r\n    inline u32 _acc_sSizeXorEq(u32 value)\t{ return _acc_sSize(_acc_gSize() ^ value); }\r\n    inline u32 _acc_sSize$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeXorEq(value); }\r\n    inline u32 _acc_sSizeAndEq(u32 value)\t{ return _acc_sSize(_acc_gSize() & value); }\r\n    inline u32 _acc_sSize$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeAndEq(value); }\r\n    inline u32 _acc_sSizeOrEq(u32 value)\t\t{ return _acc_sSize(_acc_gSize() | value); }\r\n    inline u32 _acc_sSize$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeOrEq(value); }\r\n    inline u32 _acc_sSizeRShiftEq(u32 value)\t{ return _acc_sSize(_acc_gSize() >> value); }\r\n    inline u32 _acc_sSize$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeRShiftEq(value); }\r\n    inline u32 _acc_sSizeLShiftEq(u32 value)\t{ return _acc_sSize(_acc_gSize() << value); }\r\n    inline u32 _acc_sSize$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeLShiftEq(value); }\r\n    inline System::String* _acc_gName();\r\n    inline System::String* _acc_gName$();\r\n\r\n    inline System::String* _acc_sName(System::String* value);\r\n    inline System::String* _acc_sName$(System::String* value);\r\n    static s32* _ext_CKLBLuaLibFONT_createFont(s32 size,s32* fontName);\r\n    static void _ext_CKLBLuaLibFONT_removeFont(s32* font);\r\n    static void _ext_CKLBLuaLibFONT_cmdGetTextInfo(s32* str,s32* font,EnginePrototype::STextInfo_inner0& outInfo);\r\n    CSFont(u32 size,System::String* name);\r\n    virtual void clearInternals();\r\n    inline void clearInternals$();\r\n    void getTextInfo(System::String* text,EnginePrototype::STextInfo_inner0& info);\r\n    inline void getTextInfo$(System::String* text,EnginePrototype::STextInfo_inner0& info);\r\n    CSFont();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 123;\r\n};\r\nstruct EnginePrototype::STextInfo_inner0 : public System::__GCStruct {\r\n\r\npublic:\r\n    void _ctor_STextInfo_inner0();\r\n    float width;\r\n    inline float& _gwidth$() { CHCKTHIS; return width; }\r\n    inline float _swidth$(float _$value) { CHCKTHIS; return width = _$value; }\r\n    inline float _swidth$postInc()\t\t\t\t{ CHCKTHIS; return width++; }\r\n    inline float _swidth$postDec()\t\t\t\t{ CHCKTHIS; return width--; }\r\n    inline float _swidth$preInc()\t\t\t\t{ CHCKTHIS; return ++width; }\r\n    inline float _swidth$preDec()\t\t\t\t{ CHCKTHIS; return --width; }\r\n    inline float _swidth$AddEq(float value)\t\t{ CHCKTHIS; return width += value; }\r\n    inline float _swidth$SubEq(float value)\t\t{ CHCKTHIS; return width -= value; }\r\n    inline float _swidth$MulEq(float value)\t\t{ CHCKTHIS; return width *= value; }\r\n    inline float _swidth$DivEq(float value)\t\t{ CHCKTHIS; ; return width /= value; }\r\n    inline float _swidth$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(width / value)); return width = width-(tmp*value); }\r\n    inline float _swidthpostInc()\t\t\t\t{ return width++; }\r\n    inline float _swidthpostDec()\t\t\t\t{ return width--; }\r\n    inline float _swidthpreInc()\t\t\t\t{ return ++width; }\r\n    inline float _swidthpreDec()\t\t\t\t{ return --width; }\r\n    inline float _swidthAddEq(float value)\t\t{ return width += value; }\r\n    inline float _swidthSubEq(float value)\t\t{ return width -= value; }\r\n    inline float _swidthMulEq(float value)\t\t{ return width *= value; }\r\n    inline float _swidthDivEq(float value)\t\t{ ; return width /= value; }\r\n    inline float _swidthModEq(float value)\t\t{ s32 tmp = ((s32)(width / value)); return width = width-(tmp*value); }\r\n\r\n    float height;\r\n    inline float& _gheight$() { CHCKTHIS; return height; }\r\n    inline float _sheight$(float _$value) { CHCKTHIS; return height = _$value; }\r\n    inline float _sheight$postInc()\t\t\t\t{ CHCKTHIS; return height++; }\r\n    inline float _sheight$postDec()\t\t\t\t{ CHCKTHIS; return height--; }\r\n    inline float _sheight$preInc()\t\t\t\t{ CHCKTHIS; return ++height; }\r\n    inline float _sheight$preDec()\t\t\t\t{ CHCKTHIS; return --height; }\r\n    inline float _sheight$AddEq(float value)\t\t{ CHCKTHIS; return height += value; }\r\n    inline float _sheight$SubEq(float value)\t\t{ CHCKTHIS; return height -= value; }\r\n    inline float _sheight$MulEq(float value)\t\t{ CHCKTHIS; return height *= value; }\r\n    inline float _sheight$DivEq(float value)\t\t{ CHCKTHIS; ; return height /= value; }\r\n    inline float _sheight$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(height / value)); return height = height-(tmp*value); }\r\n    inline float _sheightpostInc()\t\t\t\t{ return height++; }\r\n    inline float _sheightpostDec()\t\t\t\t{ return height--; }\r\n    inline float _sheightpreInc()\t\t\t\t{ return ++height; }\r\n    inline float _sheightpreDec()\t\t\t\t{ return --height; }\r\n    inline float _sheightAddEq(float value)\t\t{ return height += value; }\r\n    inline float _sheightSubEq(float value)\t\t{ return height -= value; }\r\n    inline float _sheightMulEq(float value)\t\t{ return height *= value; }\r\n    inline float _sheightDivEq(float value)\t\t{ ; return height /= value; }\r\n    inline float _sheightModEq(float value)\t\t{ s32 tmp = ((s32)(height / value)); return height = height-(tmp*value); }\r\n\r\n    float ascent;\r\n    inline float& _gascent$() { CHCKTHIS; return ascent; }\r\n    inline float _sascent$(float _$value) { CHCKTHIS; return ascent = _$value; }\r\n    inline float _sascent$postInc()\t\t\t\t{ CHCKTHIS; return ascent++; }\r\n    inline float _sascent$postDec()\t\t\t\t{ CHCKTHIS; return ascent--; }\r\n    inline float _sascent$preInc()\t\t\t\t{ CHCKTHIS; return ++ascent; }\r\n    inline float _sascent$preDec()\t\t\t\t{ CHCKTHIS; return --ascent; }\r\n    inline float _sascent$AddEq(float value)\t\t{ CHCKTHIS; return ascent += value; }\r\n    inline float _sascent$SubEq(float value)\t\t{ CHCKTHIS; return ascent -= value; }\r\n    inline float _sascent$MulEq(float value)\t\t{ CHCKTHIS; return ascent *= value; }\r\n    inline float _sascent$DivEq(float value)\t\t{ CHCKTHIS; ; return ascent /= value; }\r\n    inline float _sascent$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(ascent / value)); return ascent = ascent-(tmp*value); }\r\n    inline float _sascentpostInc()\t\t\t\t{ return ascent++; }\r\n    inline float _sascentpostDec()\t\t\t\t{ return ascent--; }\r\n    inline float _sascentpreInc()\t\t\t\t{ return ++ascent; }\r\n    inline float _sascentpreDec()\t\t\t\t{ return --ascent; }\r\n    inline float _sascentAddEq(float value)\t\t{ return ascent += value; }\r\n    inline float _sascentSubEq(float value)\t\t{ return ascent -= value; }\r\n    inline float _sascentMulEq(float value)\t\t{ return ascent *= value; }\r\n    inline float _sascentDivEq(float value)\t\t{ ; return ascent /= value; }\r\n    inline float _sascentModEq(float value)\t\t{ s32 tmp = ((s32)(ascent / value)); return ascent = ascent-(tmp*value); }\r\n\r\n    float descent;\r\n    inline float& _gdescent$() { CHCKTHIS; return descent; }\r\n    inline float _sdescent$(float _$value) { CHCKTHIS; return descent = _$value; }\r\n    inline float _sdescent$postInc()\t\t\t\t{ CHCKTHIS; return descent++; }\r\n    inline float _sdescent$postDec()\t\t\t\t{ CHCKTHIS; return descent--; }\r\n    inline float _sdescent$preInc()\t\t\t\t{ CHCKTHIS; return ++descent; }\r\n    inline float _sdescent$preDec()\t\t\t\t{ CHCKTHIS; return --descent; }\r\n    inline float _sdescent$AddEq(float value)\t\t{ CHCKTHIS; return descent += value; }\r\n    inline float _sdescent$SubEq(float value)\t\t{ CHCKTHIS; return descent -= value; }\r\n    inline float _sdescent$MulEq(float value)\t\t{ CHCKTHIS; return descent *= value; }\r\n    inline float _sdescent$DivEq(float value)\t\t{ CHCKTHIS; ; return descent /= value; }\r\n    inline float _sdescent$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(descent / value)); return descent = descent-(tmp*value); }\r\n    inline float _sdescentpostInc()\t\t\t\t{ return descent++; }\r\n    inline float _sdescentpostDec()\t\t\t\t{ return descent--; }\r\n    inline float _sdescentpreInc()\t\t\t\t{ return ++descent; }\r\n    inline float _sdescentpreDec()\t\t\t\t{ return --descent; }\r\n    inline float _sdescentAddEq(float value)\t\t{ return descent += value; }\r\n    inline float _sdescentSubEq(float value)\t\t{ return descent -= value; }\r\n    inline float _sdescentMulEq(float value)\t\t{ return descent *= value; }\r\n    inline float _sdescentDivEq(float value)\t\t{ ; return descent /= value; }\r\n    inline float _sdescentModEq(float value)\t\t{ s32 tmp = ((s32)(descent / value)); return descent = descent-(tmp*value); }\r\n\r\n    float top;\r\n    inline float& _gtop$() { CHCKTHIS; return top; }\r\n    inline float _stop$(float _$value) { CHCKTHIS; return top = _$value; }\r\n    inline float _stop$postInc()\t\t\t\t{ CHCKTHIS; return top++; }\r\n    inline float _stop$postDec()\t\t\t\t{ CHCKTHIS; return top--; }\r\n    inline float _stop$preInc()\t\t\t\t{ CHCKTHIS; return ++top; }\r\n    inline float _stop$preDec()\t\t\t\t{ CHCKTHIS; return --top; }\r\n    inline float _stop$AddEq(float value)\t\t{ CHCKTHIS; return top += value; }\r\n    inline float _stop$SubEq(float value)\t\t{ CHCKTHIS; return top -= value; }\r\n    inline float _stop$MulEq(float value)\t\t{ CHCKTHIS; return top *= value; }\r\n    inline float _stop$DivEq(float value)\t\t{ CHCKTHIS; ; return top /= value; }\r\n    inline float _stop$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(top / value)); return top = top-(tmp*value); }\r\n    inline float _stoppostInc()\t\t\t\t{ return top++; }\r\n    inline float _stoppostDec()\t\t\t\t{ return top--; }\r\n    inline float _stoppreInc()\t\t\t\t{ return ++top; }\r\n    inline float _stoppreDec()\t\t\t\t{ return --top; }\r\n    inline float _stopAddEq(float value)\t\t{ return top += value; }\r\n    inline float _stopSubEq(float value)\t\t{ return top -= value; }\r\n    inline float _stopMulEq(float value)\t\t{ return top *= value; }\r\n    inline float _stopDivEq(float value)\t\t{ ; return top /= value; }\r\n    inline float _stopModEq(float value)\t\t{ s32 tmp = ((s32)(top / value)); return top = top-(tmp*value); }\r\n\r\n    float bottom;\r\n    inline float& _gbottom$() { CHCKTHIS; return bottom; }\r\n    inline float _sbottom$(float _$value) { CHCKTHIS; return bottom = _$value; }\r\n    inline float _sbottom$postInc()\t\t\t\t{ CHCKTHIS; return bottom++; }\r\n    inline float _sbottom$postDec()\t\t\t\t{ CHCKTHIS; return bottom--; }\r\n    inline float _sbottom$preInc()\t\t\t\t{ CHCKTHIS; return ++bottom; }\r\n    inline float _sbottom$preDec()\t\t\t\t{ CHCKTHIS; return --bottom; }\r\n    inline float _sbottom$AddEq(float value)\t\t{ CHCKTHIS; return bottom += value; }\r\n    inline float _sbottom$SubEq(float value)\t\t{ CHCKTHIS; return bottom -= value; }\r\n    inline float _sbottom$MulEq(float value)\t\t{ CHCKTHIS; return bottom *= value; }\r\n    inline float _sbottom$DivEq(float value)\t\t{ CHCKTHIS; ; return bottom /= value; }\r\n    inline float _sbottom$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(bottom / value)); return bottom = bottom-(tmp*value); }\r\n    inline float _sbottompostInc()\t\t\t\t{ return bottom++; }\r\n    inline float _sbottompostDec()\t\t\t\t{ return bottom--; }\r\n    inline float _sbottompreInc()\t\t\t\t{ return ++bottom; }\r\n    inline float _sbottompreDec()\t\t\t\t{ return --bottom; }\r\n    inline float _sbottomAddEq(float value)\t\t{ return bottom += value; }\r\n    inline float _sbottomSubEq(float value)\t\t{ return bottom -= value; }\r\n    inline float _sbottomMulEq(float value)\t\t{ return bottom *= value; }\r\n    inline float _sbottomDivEq(float value)\t\t{ ; return bottom /= value; }\r\n    inline float _sbottomModEq(float value)\t\t{ s32 tmp = ((s32)(bottom / value)); return bottom = bottom-(tmp*value); }\r\n\r\n    STextInfo_inner0();\r\n    inline u32 _processGC();\r\n    inline void _releaseGC();\r\n    inline void* _RefSetValue(void* newStruct);\r\n    virtual inline void _moveAlert(u32 offset);\r\n    inline static STextInfo_inner0& __registerByRef(STextInfo_inner0& m);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_STRUCT | 124;\r\n};\r\nclass EnginePrototype::CSGL : public System::Object {\r\n\r\npublic:\r\n    void _ctor_CSGL();\r\n    static void _ext_CKLBLuaLibGL_GLClearColor(float r,float g,float b,float a);\r\n    static void _ext_CKLBLuaLibGL_GLSetResolution(s32 width,s32 height);\r\n    static bool _ext_CKLBLuaLibGL_GLCreateScreenAsset(s32* name);\r\n    static bool _ext_CKLBLuaLibGL_GLDoScreenShot(s32* name);\r\n    static void _ext_CKLBLuaLibGL_GLFreeScreenAsset(s32* name);\r\n    static void _ext_CKLBLuaLibGL_SGGetGuardBand(float& leftBorder,float& rightBorder,float& topBorder,float& bottomBorder);\r\n    static void _ext_CKLBLuaLibGL_SGSetGuardBand(float leftBorder,float rightBorder,float topBorder,float bottomBorder);\r\n    static void clearColor(float r,float g,float b,float a);\r\n    static void setResolution(s32 width,s32 height);\r\n    static bool createScreenAsset(System::String* name);\r\n    static bool doScreenShot(System::String* name);\r\n    static void freeScreenAsset(System::String* name);\r\n    static void getGuardBand(float& leftBorder,float& rightBorder,float& topBorder,float& bottomBorder);\r\n    static void setGuardBand(float leftBorder,float rightBorder,float topBorder,float bottomBorder);\r\n    CSGL();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 126;\r\n};\r\nclass EnginePrototype::CSKey : public System::Object {\r\n\r\npublic:\r\n    void _ctor_CSKey();\r\n    static s32 _ext_CKLBLuaLibKEY_genUserID(s32* userId,u32 bufSize);\r\n    static s32 _ext_CKLBLuaLibKEY_genUserPW(s32* userId,s32* buf,u32 bufSize);\r\n    static bool _ext_CKLBLuaLibKEY_setSecureID(s32* serviceName,s32* userId);\r\n    static bool _ext_CKLBLuaLibKEY_setSecurePW(s32* serviceName,s32* passwd);\r\n    static s32 _ext_CKLBLuaLibKEY_getSecureID(s32* serviceName,s32* buf,u32 bufSize);\r\n    static s32 _ext_CKLBLuaLibKEY_getSecurePW(s32* serviceName,s32* buf,u32 bufSize);\r\n    static bool _ext_CKLBLuaLibKEY_delSecureID(s32* serviceName);\r\n    static bool _ext_CKLBLuaLibKEY_delSecurePW(s32* serviceName);\r\n    static s32 _ref_genUserID(System::String*& userId,u32 bufSize);\r\n    inline static s32 genUserID(System::String*& userId,u32 bufSize);\r\n    static s32 _ref_genUserPW(System::String* userId,System::String*& passwd,u32 bufSize);\r\n    inline static s32 genUserPW(System::String* userId,System::String*& passwd,u32 bufSize);\r\n    static bool setSecureID(System::String* serviceName,System::String* userId);\r\n    static bool setSecurePW(System::String* serviceName,System::String* passwd);\r\n    static s32 _ref_getSecureID(System::String* serviceName,System::String*& secureID,u32 bufSize);\r\n    inline static s32 getSecureID(System::String* serviceName,System::String*& secureID,u32 bufSize);\r\n    static s32 _ref_getSecurePW(System::String* serviceName,System::String*& securePW,u32 bufSize);\r\n    inline static s32 getSecurePW(System::String* serviceName,System::String*& securePW,u32 bufSize);\r\n    static bool delSecureID(System::String* serviceName);\r\n    static bool delSecurePW(System::String* serviceName);\r\n    CSKey();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 127;\r\n};\r\nclass EnginePrototype::CSLang : public System::Object {\r\n\r\npublic:\r\n    void _ctor_CSLang();\r\n    static bool _ext_CKLBLuaLibLANG_addString(s32* id,s32* str);\r\n    static s32* _ext_CKLBLuaLibLANG_getString(s32* id);\r\n    static void _ext_CKLBLuaLibLANG_removeString(s32* id);\r\n    static bool _ext_CKLBLuaLibLANG_useDB(s32* dbFile,s32* table,s32* keyF,s32* valueF,s32* groupF);\r\n    static bool _ext_CKLBLuaLibLANG_loadGroup(s32* groupId);\r\n    static bool addString(System::String* id,System::String* str);\r\n    static System::String* getString(System::String* id);\r\n    static void removeString(System::String* id);\r\n    static bool useDB(System::String* dbFile,System::String* table,System::String* keyF,System::String* valueF,System::String* groupF);\r\n    static bool loadGroup(System::String* groupId);\r\n    CSLang();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 128;\r\n};\r\nclass EnginePrototype::CSMatrix : public System::Object ,public System::ICloneable {\r\nfriend class CSVector_inner1;\r\n\r\npublic:\r\n    void _ctor_CSMatrix();\r\n    static float EPSILON;\r\n    inline static float _sEPSILONModEq(float value)\t\t{ s32 tmp = ((s32)(EPSILON / value)); return EPSILON = EPSILON-(tmp*value); }\r\n\r\n    System::Array<float>* m_matrix;\r\n    inline System::Array<float>*& _gm_matrix$() { CHCKTHIS; return m_matrix; }\r\n    inline System::Array<float>* _sm_matrix(System::Array<float>* _$value);\r\n    inline System::Array<float>* _sm_matrix$(System::Array<float>* _$value);\r\n\r\n    inline float _idx_g(s32 i, s32 j);\r\n    inline float _idx_g$(s32 i, s32 j);\r\n\r\n    CSMatrix(System::Array<float>* matrix);\r\n    System::Object* Clone();\r\n    inline System::Object* Clone$();\r\n    EnginePrototype::CSMatrix* Copy();\r\n    inline EnginePrototype::CSMatrix* Copy$();\r\n    EnginePrototype::CSMatrix* Transposed();\r\n    inline EnginePrototype::CSMatrix* Transposed$();\r\n    EnginePrototype::CSMatrix* Mul(EnginePrototype::CSMatrix* mat);\r\n    inline EnginePrototype::CSMatrix* Mul$(EnginePrototype::CSMatrix* mat);\r\n    EnginePrototype::CSVector_inner1* Mul(EnginePrototype::CSVector_inner1* vect);\r\n    inline EnginePrototype::CSVector_inner1* Mul$(EnginePrototype::CSVector_inner1* vect);\r\n    static float fabs(float f);\r\n    EnginePrototype::CSMatrix* Inverse();\r\n    inline EnginePrototype::CSMatrix* Inverse$();\r\n    CSMatrix();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 129;\r\n};\r\nclass EnginePrototype::CSVector_inner1 : public System::Object ,public System::ICloneable {\r\n\r\npublic:\r\n    void _ctor_CSVector_inner1();\r\n    System::Array<float>* m_vector;\r\n    inline System::Array<float>*& _gm_vector$() { CHCKTHIS; return m_vector; }\r\n    inline System::Array<float>* _sm_vector(System::Array<float>* _$value);\r\n    inline System::Array<float>* _sm_vector$(System::Array<float>* _$value);\r\n\r\n    inline float _idx_g(s32 i);\r\n    inline float _idx_g$(s32 i);\r\n\r\n    CSVector_inner1(System::Array<float>* vector);\r\n    System::Object* Clone();\r\n    inline System::Object* Clone$();\r\n    CSVector_inner1();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 130;\r\n};\r\nclass EnginePrototype::CSRES : public System::Object {\r\n\r\npublic:\r\n    void _ctor_CSRES();\r\n    static void _ext_CKLBLuaLibRES_dumpSceneGraph(s32* task);\r\n    static void _ext_CKLBLuaLibRES_dumpRendering(bool detailed);\r\n    static void _ext_CKLBLuaLibRES_dumpAssets();\r\n    static void _ext_CKLBLuaLibRES_dumpDataSet();\r\n    static void _ext_CKLBLuaLibRES_dumpTexturePacker(bool detailed);\r\n    static void _ext_CKLBLuaLibRES_dumpGeometryCost(bool detailed);\r\n    static void dumpSceneGraph(EnginePrototype::CKLBUITask* task);\r\n    static void dumpRendering(bool detailed);\r\n    static void dumpAssets();\r\n    static void dumpDataSet();\r\n    static void dumpTexturePacker(bool detailed);\r\n    static void dumpGeometryCost(bool detailed);\r\n    CSRES();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 132;\r\n};\r\nclass EnginePrototype::CSSound : public EnginePrototype::GameObject {\r\n\r\npublic:\r\n    enum EBUF_SIZE {\r\n        SND_BUF_SMALL = 0,\r\n        SND_BUF_MEDIUM = 1,\r\n        SND_BUF_LARGE = 2,\r\n        _ForceWORD_EBUF_SIZE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CSSound();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    s32 m_bufSize;\r\n    inline s32& _gm_bufSize$() { CHCKTHIS; return m_bufSize; }\r\n    inline s32 _sm_bufSize$(s32 _$value) { CHCKTHIS; return m_bufSize = _$value; }\r\n    inline s32 _sm_bufSize$postInc()\t\t\t\t{ CHCKTHIS; return (s32)(((s32&)m_bufSize)++); }\r\n    inline s32 _sm_bufSize$postDec()\t\t\t\t{ CHCKTHIS; return (s32)(((s32&)m_bufSize)--); }\r\n    inline s32 _sm_bufSize$preInc()\t\t\t\t{ CHCKTHIS; return (s32)(++(s32&)m_bufSize); }\r\n    inline s32 _sm_bufSize$preDec()\t\t\t\t{ CHCKTHIS; return (s32)(--(s32&)m_bufSize); }\r\n    inline s32 _sm_bufSize$AddEq(s32 value)\t\t{ CHCKTHIS; return (s32)((s32&)m_bufSize += value); }\r\n    inline s32 _sm_bufSize$SubEq(s32 value)\t\t{ CHCKTHIS; return (s32)((s32&)m_bufSize -= value); }\r\n    inline s32 _sm_bufSizepostInc()\t\t\t\t{ return (s32)(((s32&)m_bufSize)++); }\r\n    inline s32 _sm_bufSizepostDec()\t\t\t\t{ return (s32)(((s32&)m_bufSize)--); }\r\n    inline s32 _sm_bufSizepreInc()\t\t\t\t{ return (s32)(++(s32&)m_bufSize); }\r\n    inline s32 _sm_bufSizepreDec()\t\t\t\t{ return (s32)(--(s32&)m_bufSize); }\r\n    inline s32 _sm_bufSizeAddEq(s32 value)\t\t{ return (s32)((s32&)m_bufSize += value); }\r\n    inline s32 _sm_bufSizeSubEq(s32 value)\t\t{ return (s32)((s32&)m_bufSize -= value); }\r\n\r\n    float m_volume;\r\n    inline float& _gm_volume$() { CHCKTHIS; return m_volume; }\r\n    inline float _sm_volume$(float _$value) { CHCKTHIS; return m_volume = _$value; }\r\n    inline float _sm_volume$postInc()\t\t\t\t{ CHCKTHIS; return m_volume++; }\r\n    inline float _sm_volume$postDec()\t\t\t\t{ CHCKTHIS; return m_volume--; }\r\n    inline float _sm_volume$preInc()\t\t\t\t{ CHCKTHIS; return ++m_volume; }\r\n    inline float _sm_volume$preDec()\t\t\t\t{ CHCKTHIS; return --m_volume; }\r\n    inline float _sm_volume$AddEq(float value)\t\t{ CHCKTHIS; return m_volume += value; }\r\n    inline float _sm_volume$SubEq(float value)\t\t{ CHCKTHIS; return m_volume -= value; }\r\n    inline float _sm_volume$MulEq(float value)\t\t{ CHCKTHIS; return m_volume *= value; }\r\n    inline float _sm_volume$DivEq(float value)\t\t{ CHCKTHIS; ; return m_volume /= value; }\r\n    inline float _sm_volume$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(m_volume / value)); return m_volume = m_volume-(tmp*value); }\r\n    inline float _sm_volumepostInc()\t\t\t\t{ return m_volume++; }\r\n    inline float _sm_volumepostDec()\t\t\t\t{ return m_volume--; }\r\n    inline float _sm_volumepreInc()\t\t\t\t{ return ++m_volume; }\r\n    inline float _sm_volumepreDec()\t\t\t\t{ return --m_volume; }\r\n    inline float _sm_volumeAddEq(float value)\t\t{ return m_volume += value; }\r\n    inline float _sm_volumeSubEq(float value)\t\t{ return m_volume -= value; }\r\n    inline float _sm_volumeMulEq(float value)\t\t{ return m_volume *= value; }\r\n    inline float _sm_volumeDivEq(float value)\t\t{ ; return m_volume /= value; }\r\n    inline float _sm_volumeModEq(float value)\t\t{ s32 tmp = ((s32)(m_volume / value)); return m_volume = m_volume-(tmp*value); }\r\n\r\n    float m_pan;\r\n    inline float& _gm_pan$() { CHCKTHIS; return m_pan; }\r\n    inline float _sm_pan$(float _$value) { CHCKTHIS; return m_pan = _$value; }\r\n    inline float _sm_pan$postInc()\t\t\t\t{ CHCKTHIS; return m_pan++; }\r\n    inline float _sm_pan$postDec()\t\t\t\t{ CHCKTHIS; return m_pan--; }\r\n    inline float _sm_pan$preInc()\t\t\t\t{ CHCKTHIS; return ++m_pan; }\r\n    inline float _sm_pan$preDec()\t\t\t\t{ CHCKTHIS; return --m_pan; }\r\n    inline float _sm_pan$AddEq(float value)\t\t{ CHCKTHIS; return m_pan += value; }\r\n    inline float _sm_pan$SubEq(float value)\t\t{ CHCKTHIS; return m_pan -= value; }\r\n    inline float _sm_pan$MulEq(float value)\t\t{ CHCKTHIS; return m_pan *= value; }\r\n    inline float _sm_pan$DivEq(float value)\t\t{ CHCKTHIS; ; return m_pan /= value; }\r\n    inline float _sm_pan$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(m_pan / value)); return m_pan = m_pan-(tmp*value); }\r\n    inline float _sm_panpostInc()\t\t\t\t{ return m_pan++; }\r\n    inline float _sm_panpostDec()\t\t\t\t{ return m_pan--; }\r\n    inline float _sm_panpreInc()\t\t\t\t{ return ++m_pan; }\r\n    inline float _sm_panpreDec()\t\t\t\t{ return --m_pan; }\r\n    inline float _sm_panAddEq(float value)\t\t{ return m_pan += value; }\r\n    inline float _sm_panSubEq(float value)\t\t{ return m_pan -= value; }\r\n    inline float _sm_panMulEq(float value)\t\t{ return m_pan *= value; }\r\n    inline float _sm_panDivEq(float value)\t\t{ ; return m_pan /= value; }\r\n    inline float _sm_panModEq(float value)\t\t{ s32 tmp = ((s32)(m_pan / value)); return m_pan = m_pan-(tmp*value); }\r\n\r\n    inline s32 _acc_gBufSize();\r\n    inline s32 _acc_gBufSize$();\r\n\r\n    inline float _acc_gVolume();\r\n    inline float _acc_gVolume$();\r\n\r\n    inline float _acc_sVolume(float value);\r\n    inline float _acc_sVolume$(float value);\r\n    inline float _acc_sVolumepostInc()\t\t\t{ float tmp; _acc_sVolume((tmp = _acc_gVolume())+1); return tmp; }\r\n    inline float _acc_sVolume$postInc()\t\t\t{ CHCKTHIS; return _acc_sVolumepostInc(); }\r\n    inline float _acc_sVolumepostDec()\t\t\t{ float tmp; _acc_sVolume((tmp = _acc_gVolume())-1); return tmp; }\r\n    inline float _acc_sVolume$postDec()\t\t\t{ CHCKTHIS; return _acc_sVolumepostDec(); }\r\n    inline float _acc_sVolumepreInc()\t\t\t{ return _acc_sVolume(_acc_gVolume()+1); }\r\n    inline float _acc_sVolume$preInc()\t\t\t{ CHCKTHIS; return _acc_sVolumepreInc(); }\r\n    inline float _acc_sVolumepreDec()\t\t\t{ return _acc_sVolume(_acc_gVolume()-1); }\r\n    inline float _acc_sVolume$preDec()\t\t\t{ CHCKTHIS; return _acc_sVolumepreDec(); }\r\n    inline float _acc_sVolumeAddEq(float value)\t{ return _acc_sVolume(_acc_gVolume() + value); }\r\n    inline float _acc_sVolume$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeAddEq(value); }\r\n    inline float _acc_sVolumeSubEq(float value)\t{ return _acc_sVolume(_acc_gVolume() - value); }\r\n    inline float _acc_sVolume$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeSubEq(value); }\r\n    inline float _acc_sVolumeMulEq(float value)\t{ return _acc_sVolume(_acc_gVolume() * value); }\r\n    inline float _acc_sVolume$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeMulEq(value); }\r\n    inline float _acc_sVolumeDivEq(float value)\t{ return _acc_sVolume(_acc_gVolume() / value); }\r\n    inline float _acc_sVolume$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeDivEq(value); }\r\n    inline float _acc_sVolumeModEq(float value)\t{  float orig = _acc_gVolume(); s32 tmp = (s32)(orig / value); return _acc_sVolume(orig - (tmp * value)); }\r\n    inline float _acc_sVolume$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeModEq(value); }\r\n    inline float _acc_gPan();\r\n    inline float _acc_gPan$();\r\n\r\n    inline float _acc_sPan(float value);\r\n    inline float _acc_sPan$(float value);\r\n    inline float _acc_sPanpostInc()\t\t\t{ float tmp; _acc_sPan((tmp = _acc_gPan())+1); return tmp; }\r\n    inline float _acc_sPan$postInc()\t\t\t{ CHCKTHIS; return _acc_sPanpostInc(); }\r\n    inline float _acc_sPanpostDec()\t\t\t{ float tmp; _acc_sPan((tmp = _acc_gPan())-1); return tmp; }\r\n    inline float _acc_sPan$postDec()\t\t\t{ CHCKTHIS; return _acc_sPanpostDec(); }\r\n    inline float _acc_sPanpreInc()\t\t\t{ return _acc_sPan(_acc_gPan()+1); }\r\n    inline float _acc_sPan$preInc()\t\t\t{ CHCKTHIS; return _acc_sPanpreInc(); }\r\n    inline float _acc_sPanpreDec()\t\t\t{ return _acc_sPan(_acc_gPan()-1); }\r\n    inline float _acc_sPan$preDec()\t\t\t{ CHCKTHIS; return _acc_sPanpreDec(); }\r\n    inline float _acc_sPanAddEq(float value)\t{ return _acc_sPan(_acc_gPan() + value); }\r\n    inline float _acc_sPan$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPanAddEq(value); }\r\n    inline float _acc_sPanSubEq(float value)\t{ return _acc_sPan(_acc_gPan() - value); }\r\n    inline float _acc_sPan$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPanSubEq(value); }\r\n    inline float _acc_sPanMulEq(float value)\t{ return _acc_sPan(_acc_gPan() * value); }\r\n    inline float _acc_sPan$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPanMulEq(value); }\r\n    inline float _acc_sPanDivEq(float value)\t{ return _acc_sPan(_acc_gPan() / value); }\r\n    inline float _acc_sPan$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPanDivEq(value); }\r\n    inline float _acc_sPanModEq(float value)\t{  float orig = _acc_gPan(); s32 tmp = (s32)(orig / value); return _acc_sPan(orig - (tmp * value)); }\r\n    inline float _acc_sPan$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPanModEq(value); }\r\n    inline s32 _acc_gLength();\r\n    inline s32 _acc_gLength$();\r\n\r\n    static s32* _ext_CKLBLuaLibSOUND_cmdSoundOpen(s32* sndAsset,bool fBgm);\r\n    static bool _ext_CKLBLuaLibSOUND_cmdSoundSetBufSize(s32* pSnd,s32 level);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundClose(s32* pSnd);\r\n    static s32 _ext_CKLBLuaLibSOUND_removeSoundAll();\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundPlay(s32* pSnd,u32 fade_msec,float tgtVol,float globalVol);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundStop(s32* pSnd,u32 fade_msec,float tgtVol);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundVolume(s32* pSnd,float volume);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundPan(s32* pSnd,float pan);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundPause(s32* pSnd);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundResume(s32* pSnd);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSoundSeek(s32* pSnd,s32 millisec);\r\n    static s32 _ext_CKLBLuaLibSOUND_cmdSoundTell(s32* pSnd);\r\n    static s32 _ext_CKLBLuaLibSOUND_cmdSoundState(s32* pSnd);\r\n    static void _ext_CKLBLuaLibSOUND_cmdVolumeBGM(float volume);\r\n    static void _ext_CKLBLuaLibSOUND_cmdVolumeSE(float volume);\r\n    static s32 _ext_CKLBLuaLibSOUND_cmdGetLength(s32* pSnd);\r\n    static void _ext_CKLBLuaLibSOUND_cmdSetFade(s32* pSnd,s32 millisec,float tgtVol);\r\n    CSSound(System::String* sound_asset,bool bgmMode);\r\n    bool setBufSize(s32 size);\r\n    inline bool setBufSize$(s32 size);\r\n    virtual void clearInternals();\r\n    inline void clearInternals$();\r\n    static void closeAll();\r\n    void play(u32 fade_msec,float tgtVol,float globalVol);\r\n    inline void play$(u32 fade_msec,float tgtVol,float globalVol);\r\n    void stop(u32 fade_msec,float tgtVol);\r\n    inline void stop$(u32 fade_msec,float tgtVol);\r\n    void pause();\r\n    inline void pause$();\r\n    void resume();\r\n    inline void resume$();\r\n    void seek(s32 milliseconds);\r\n    inline void seek$(s32 milliseconds);\r\n    s32 tell();\r\n    inline s32 tell$();\r\n    s32 state();\r\n    inline s32 state$();\r\n    void setFade(s32 millisec,float tgtVol);\r\n    inline void setFade$(s32 millisec,float tgtVol);\r\n    static void volumeBGM(float volume);\r\n    static void volumeSE(float volume);\r\n    CSSound();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 133;\r\n};\r\nclass EnginePrototype::CSSystem : public System::Object {\r\nfriend struct SystemInfo_inner2;\r\n\r\npublic:\r\n    void _ctor_CSSystem();\r\n    static void _ext_CKLBLuaEnv_cmdLogging(s32* msg);\r\n    static void _ext_CKLBLuaEnv_cmdExit();\r\n    static void _ext_CKLBLuaEnv_cmdSystemInfo(s32& width,s32& height);\r\n    static void _ext_CKLBLuaEnv_cmdSystemReboot();\r\n    static void logging(System::String* msg);\r\n    static void exitGame();\r\n    static void getInfo(EnginePrototype::SystemInfo_inner2& sysInfos);\r\n    static void reboot();\r\n    CSSystem();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 135;\r\n};\r\nstruct EnginePrototype::SystemInfo_inner2 : public System::__GCStruct {\r\n\r\npublic:\r\n    void _ctor_SystemInfo_inner2();\r\n    s32 width;\r\n    inline s32& _gwidth$() { CHCKTHIS; return width; }\r\n    inline s32 _swidth$(s32 _$value) { CHCKTHIS; return width = _$value; }\r\n    inline s32 _swidth$postInc()\t\t\t\t{ CHCKTHIS; return width++; }\r\n    inline s32 _swidth$postDec()\t\t\t\t{ CHCKTHIS; return width--; }\r\n    inline s32 _swidth$preInc()\t\t\t\t{ CHCKTHIS; return ++width; }\r\n    inline s32 _swidth$preDec()\t\t\t\t{ CHCKTHIS; return --width; }\r\n    inline s32 _swidth$AddEq(s32 value)\t\t{ CHCKTHIS; return width += value; }\r\n    inline s32 _swidth$SubEq(s32 value)\t\t{ CHCKTHIS; return width -= value; }\r\n    inline s32 _swidth$MulEq(s32 value)\t\t{ CHCKTHIS; return width *= value; }\r\n    inline s32 _swidth$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline s32 _swidth$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline s32 _swidth$XorEq(s32 value)\t\t{ CHCKTHIS; return width ^= value; }\r\n    inline s32 _swidth$AndEq(s32 value)\t\t{ CHCKTHIS; return width &= value; }\r\n    inline s32 _swidth$OrEq(s32 value)\t\t{ CHCKTHIS; return width |= value; }\r\n    inline s32 _swidth$RShiftEq(s32 value)\t{ CHCKTHIS; return width >>= value; }\r\n    inline s32 _swidth$LShiftEq(s32 value)\t{ CHCKTHIS; return width <<= value; }\r\n    inline s32 _swidthpostInc()\t\t\t\t{ return width++; }\r\n    inline s32 _swidthpostDec()\t\t\t\t{ return width--; }\r\n    inline s32 _swidthpreInc()\t\t\t\t{ return ++width; }\r\n    inline s32 _swidthpreDec()\t\t\t\t{ return --width; }\r\n    inline s32 _swidthAddEq(s32 value)\t\t{ return width += value; }\r\n    inline s32 _swidthSubEq(s32 value)\t\t{ return width -= value; }\r\n    inline s32 _swidthMulEq(s32 value)\t\t{ return width *= value; }\r\n    inline s32 _swidthDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline s32 _swidthModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline s32 _swidthXorEq(s32 value)\t\t{ return width ^= value; }\r\n    inline s32 _swidthAndEq(s32 value)\t\t{ return width &= value; }\r\n    inline s32 _swidthOrEq(s32 value)\t\t\t{ return width |= value; }\r\n    inline s32 _swidthRShiftEq(s32 value)\t\t{ return width >>= value; }\r\n    inline s32 _swidthLShiftEq(s32 value)\t\t{ return width <<= value; }\r\n\r\n    s32 height;\r\n    inline s32& _gheight$() { CHCKTHIS; return height; }\r\n    inline s32 _sheight$(s32 _$value) { CHCKTHIS; return height = _$value; }\r\n    inline s32 _sheight$postInc()\t\t\t\t{ CHCKTHIS; return height++; }\r\n    inline s32 _sheight$postDec()\t\t\t\t{ CHCKTHIS; return height--; }\r\n    inline s32 _sheight$preInc()\t\t\t\t{ CHCKTHIS; return ++height; }\r\n    inline s32 _sheight$preDec()\t\t\t\t{ CHCKTHIS; return --height; }\r\n    inline s32 _sheight$AddEq(s32 value)\t\t{ CHCKTHIS; return height += value; }\r\n    inline s32 _sheight$SubEq(s32 value)\t\t{ CHCKTHIS; return height -= value; }\r\n    inline s32 _sheight$MulEq(s32 value)\t\t{ CHCKTHIS; return height *= value; }\r\n    inline s32 _sheight$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline s32 _sheight$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline s32 _sheight$XorEq(s32 value)\t\t{ CHCKTHIS; return height ^= value; }\r\n    inline s32 _sheight$AndEq(s32 value)\t\t{ CHCKTHIS; return height &= value; }\r\n    inline s32 _sheight$OrEq(s32 value)\t\t{ CHCKTHIS; return height |= value; }\r\n    inline s32 _sheight$RShiftEq(s32 value)\t{ CHCKTHIS; return height >>= value; }\r\n    inline s32 _sheight$LShiftEq(s32 value)\t{ CHCKTHIS; return height <<= value; }\r\n    inline s32 _sheightpostInc()\t\t\t\t{ return height++; }\r\n    inline s32 _sheightpostDec()\t\t\t\t{ return height--; }\r\n    inline s32 _sheightpreInc()\t\t\t\t{ return ++height; }\r\n    inline s32 _sheightpreDec()\t\t\t\t{ return --height; }\r\n    inline s32 _sheightAddEq(s32 value)\t\t{ return height += value; }\r\n    inline s32 _sheightSubEq(s32 value)\t\t{ return height -= value; }\r\n    inline s32 _sheightMulEq(s32 value)\t\t{ return height *= value; }\r\n    inline s32 _sheightDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline s32 _sheightModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline s32 _sheightXorEq(s32 value)\t\t{ return height ^= value; }\r\n    inline s32 _sheightAndEq(s32 value)\t\t{ return height &= value; }\r\n    inline s32 _sheightOrEq(s32 value)\t\t\t{ return height |= value; }\r\n    inline s32 _sheightRShiftEq(s32 value)\t\t{ return height >>= value; }\r\n    inline s32 _sheightLShiftEq(s32 value)\t\t{ return height <<= value; }\r\n\r\n    SystemInfo_inner2();\r\n    inline u32 _processGC();\r\n    inline void _releaseGC();\r\n    inline void* _RefSetValue(void* newStruct);\r\n    virtual inline void _moveAlert(u32 offset);\r\n    inline static SystemInfo_inner2& __registerByRef(SystemInfo_inner2& m);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_STRUCT | 136;\r\n};\r\nclass EnginePrototype::CSUI : public System::Object {\r\n\r\npublic:\r\n    enum E_POSITION {\r\n        LEFT = 1,\r\n        RIGHT = 2,\r\n        H_CENTER = 3,\r\n        TOP = 4,\r\n        BOTTOM = 8,\r\n        V_CENTER = 12,\r\n        _ForceWORD_E_POSITION = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CSUI();\r\n    static void _ext_CKLBLuaLibUI_calcPosition(float x,float y,float w,float h,u32 mask,float& out_rx,float& out_ry);\r\n    static void calcPosition(float x,float y,float w,float h,s32 mask,float& out_rx,float& out_ry);\r\n    CSUI();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 138;\r\n};\r\nclass EnginePrototype::CKLBTask : public EnginePrototype::GameObject {\r\nfriend class onDieCallBack_inner28;\r\n\r\npublic:\r\nclass _anon_0;\r\n    enum ETASK_PHASE {\r\n        P_BEGIN = 0,\r\n        P_INPUT = 1,\r\n        P_DBGSIGN = 2,\r\n        P_DBGMENU = 3,\r\n        P_UIPREV = 4,\r\n        P_SCRIPT = 5,\r\n        P_UIPROC = 6,\r\n        P_UIAFTER = 7,\r\n        P_MENU = 8,\r\n        P_PREV = 9,\r\n        P_NORMAL = 10,\r\n        P_AFTER = 11,\r\n        P_JUDGE = 12,\r\n        P_DRAW = 13,\r\n        P_GC = 14,\r\n        P_END = 15,\r\n        P_MAX = 16,\r\n        _ForceWORD_ETASK_PHASE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBTask();\r\n    EnginePrototype::_Delegate_Base_onDieCallBack_inner28* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_onDieCallBack_inner28*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_onDieCallBack_inner28* _sm_callback(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* _$value);\r\n    inline EnginePrototype::_Delegate_Base_onDieCallBack_inner28* _sm_callback$(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* _$value);\r\n\r\n    EnginePrototype::CKLBIntervalTimer* m_timer;\r\n    inline EnginePrototype::CKLBIntervalTimer*& _gm_timer$() { CHCKTHIS; return m_timer; }\r\n    inline EnginePrototype::CKLBIntervalTimer* _sm_timer(EnginePrototype::CKLBIntervalTimer* _$value);\r\n    inline EnginePrototype::CKLBIntervalTimer* _sm_timer$(EnginePrototype::CKLBIntervalTimer* _$value);\r\n\r\n    static void _ext_Task_kill(s32* task);\r\n    static void _ext_Task_setStageTask(s32* task);\r\n    static void _ext_Task_clearStageTask();\r\n    static void _ext_Task_setPause(s32* task,bool bPause,bool bRecursive);\r\n    static void _ext_Task_setManagerPause(bool bPause);\r\n    static void _ext_Task_interposeTimer(s32* pTask,s32* pTimer);\r\n    static bool _ext_Task_isKill(s32* task);\r\n    CKLBTask(u32 classID);\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    void setOnDieCallBack(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* anyDelegate);\r\n    inline void setOnDieCallBack$(EnginePrototype::_Delegate_Base_onDieCallBack_inner28* anyDelegate);\r\n    virtual void onDieCallBackFunction();\r\n    inline void onDieCallBackFunction$();\r\n    void kill();\r\n    inline void kill$();\r\n    bool isKill();\r\n    inline bool isKill$();\r\n    virtual void Dispose();\r\n    inline void Dispose$();\r\n    void setPause(bool bPause,bool bRecursive);\r\n    inline void setPause$(bool bPause,bool bRecursive);\r\n    void setLifeTime(s32 mode,u32 time);\r\n    inline void setLifeTime$(s32 mode,u32 time);\r\n    void stageOnly();\r\n    inline void stageOnly$();\r\n    static void clearStage();\r\n    static void setManagerPause(bool bPause);\r\n    CKLBTask();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 161;\r\n};\r\nclass EnginePrototype::CKLBAsyncLoader : public EnginePrototype::CKLBTask {\r\nfriend class CallBack_inner21;\r\n\r\npublic:\r\n    void _ctor_CKLBAsyncLoader();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner21* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner21*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner21* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner21* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner21* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner21* _$value);\r\n\r\n    inline u32 _acc_gProcessCount();\r\n    inline u32 _acc_gProcessCount$();\r\n\r\n    inline u32 _acc_gTotalCount();\r\n    inline u32 _acc_gTotalCount$();\r\n\r\n    static s32* _ext_CKLBAsyncLoader_create(s32* pParentTask,System::Array<s32*>* assets,u32 count,u32 datasetID);\r\n    static u32 _ext_CKLBAsyncLoader_getProcessCount(s32* p);\r\n    static u32 _ext_CKLBAsyncLoader_getTotalCount(s32* p);\r\n    CKLBAsyncLoader(EnginePrototype::CKLBTask* pParent,System::Array<System::String*>* assets,u32 datasetID,EnginePrototype::_Delegate_Base_CallBack_inner21* callback);\r\n    CKLBAsyncLoader();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 loaded,u32 total);\r\n    inline void callBackFunction$(u32 loaded,u32 total);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 140;\r\n};\r\nclass EnginePrototype::CKLBGenericTask : public EnginePrototype::CKLBTask {\r\nfriend class ExecuteCallBack_inner22;\r\nfriend class DieCallBack_inner23;\r\n\r\npublic:\r\n    void _ctor_CKLBGenericTask();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* m_executeCallBack;\r\n    inline EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22*& _gm_executeCallBack$() { CHCKTHIS; return m_executeCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* _sm_executeCallBack(EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* _$value);\r\n    inline EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* _sm_executeCallBack$(EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_DieCallBack_inner23* m_dieCallBack;\r\n    inline EnginePrototype::_Delegate_Base_DieCallBack_inner23*& _gm_dieCallBack$() { CHCKTHIS; return m_dieCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_DieCallBack_inner23* _sm_dieCallBack(EnginePrototype::_Delegate_Base_DieCallBack_inner23* _$value);\r\n    inline EnginePrototype::_Delegate_Base_DieCallBack_inner23* _sm_dieCallBack$(EnginePrototype::_Delegate_Base_DieCallBack_inner23* _$value);\r\n\r\n    static s32* _ext_CKLBGenericTask_create(s32* pParent,u32 phase);\r\n    CKLBGenericTask(EnginePrototype::CKLBTask* parent,s32 phase,EnginePrototype::_Delegate_Base_ExecuteCallBack_inner22* executeCallBack,EnginePrototype::_Delegate_Base_DieCallBack_inner23* dieCallBack);\r\n    CKLBGenericTask();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void executeCallBackFunction(u32 deltaTime);\r\n    inline void executeCallBackFunction$(u32 deltaTime);\r\n    virtual void dieCallBackFunction();\r\n    inline void dieCallBackFunction$();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 143;\r\n};\r\nclass EnginePrototype::CKLBNetAPI : public EnginePrototype::CKLBTask {\r\nfriend class CallBack_inner25;\r\nfriend class CallBackVersionUp_inner26;\r\n\r\npublic:\r\n    enum ESTATUS {\r\n        NETAPIMSG_SESSION_CANCELED = -999,\r\n        NETAPIMSG_CONNECTION_FAILED = -500,\r\n        NETAPIMSG_INVITE_FAILED = -200,\r\n        NETAPIMSG_STARTUP_FAILED = -100,\r\n        NETAPIMSG_SERVER_TIMEOUT = -4,\r\n        NETAPIMSG_REQUEST_FAILED = -3,\r\n        NETAPIMSG_LOGIN_FAILED = -2,\r\n        NETAPIMSG_SERVER_ERROR = -1,\r\n        NETAPIMSG_UNKNOWN = 0,\r\n        NETAPIMSG_LOGIN_SUCCESS = 2,\r\n        NETAPIMSG_REQUEST_SUCCESS = 3,\r\n        NETAPIMSG_STARTUP_SUCCESS = 100,\r\n        NETAPIMSG_INVITE_SUCCESS = 200,\r\n        _ForceWORD_ESTATUS = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBNetAPI();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner25* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner25*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner25* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner25* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner25* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner25* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* m_callbackVersionUp;\r\n    inline EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26*& _gm_callbackVersionUp$() { CHCKTHIS; return m_callbackVersionUp; }\r\n    inline EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* _sm_callbackVersionUp(EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* _sm_callbackVersionUp$(EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* _$value);\r\n\r\n    static s32* _ext_CKLBNetAPI_create(s32* pParent,s32* apiurl,s32* client_version,s32* consumerKey,s32* applicationId,u32 sessionMax,s32* region);\r\n    static bool _ext_CKLBNetAPI_startUp(s32* p,s32* loginID,s32* password,s32* invite,u32 timeout,u32& session);\r\n    static bool _ext_CKLBNetAPI_login(s32* p,s32* loginID,s32* password,u32 timeout,u32& session);\r\n    static bool _ext_CKLBNetAPI_cancel(s32* p,u32 uniq);\r\n    static void _ext_CKLBNetAPI_cancelAll(s32* p);\r\n    static bool _ext_CKLBNetAPI_watchMaintenance(s32* p,u32 timeout,u32& session);\r\n    static void _ext_CKLBNetAPI_debugHdr(s32* p,bool debugflag);\r\n    static void _ext_CKLBNetAPI_genCmdNumID(s32* p,s32* body,s32 serial,s32* buf);\r\n    static bool _ext_CKLBNetAPI_sendHTTP(s32* p,s32* apiURL,s32* json,u32 timeout,bool passVersionCheck,u32& session);\r\n    CKLBNetAPI(EnginePrototype::CKLBTask* parent,System::String* apiUrl,System::String* clientVersion,System::String* consumerKey,System::String* applicationID,u32 sessionMax,System::String* region,EnginePrototype::_Delegate_Base_CallBack_inner25* callback,EnginePrototype::_Delegate_Base_CallBackVersionUp_inner26* versionUpCallback);\r\n    CKLBNetAPI();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual bool callBackFunction(s32 uniq,s32 msg,s32 status,s32* pRoot);\r\n    inline bool callBackFunction$(s32 uniq,s32 msg,s32 status,s32* pRoot);\r\n    virtual void callBackVersionUpFunction(s32* clientVer,s32* serverVer);\r\n    inline void callBackVersionUpFunction$(s32* clientVer,s32* serverVer);\r\n    bool startUp(u32& session,System::String* loginID,System::String* password,System::String* invite,u32 timeout);\r\n    inline bool startUp$(u32& session,System::String* loginID,System::String* password,System::String* invite,u32 timeout);\r\n    bool login(u32& session,System::String* loginID,System::String* password,u32 timeout);\r\n    inline bool login$(u32& session,System::String* loginID,System::String* password,u32 timeout);\r\n    bool cancel(u32 session);\r\n    inline bool cancel$(u32 session);\r\n    bool send(u32& session,System::String* json,System::String* apiURL,u32 timeout,bool pass_version_check);\r\n    inline bool send$(u32& session,System::String* json,System::String* apiURL,u32 timeout,bool pass_version_check);\r\n    void cancelAll();\r\n    inline void cancelAll$();\r\n    bool watchMaintenance(u32& session,u32 timeout);\r\n    inline bool watchMaintenance$(u32& session,u32 timeout);\r\n    void debugHdr(bool debugflag);\r\n    inline void debugHdr$(bool debugflag);\r\n    void _ref_genCmdNumID(System::String*& numID,System::String* body,s32 serial);\r\n    inline void genCmdNumID$(System::String*& numID,System::String* body,s32 serial);\r\n    inline void genCmdNumID(System::String*& numID,System::String* body,s32 serial);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 152;\r\n};\r\nclass EnginePrototype::CKLBStoreService : public EnginePrototype::CKLBTask {\r\nfriend class CallBack_inner27;\r\n\r\npublic:\r\n    void _ctor_CKLBStoreService();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner27* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner27*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner27* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner27* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner27* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner27* _$value);\r\n\r\n    static s32* _ext_CKLBStoreService_create();\r\n    static void _ext_CKLBStoreService_buyItems(s32* p,s32* item);\r\n    static void _ext_CKLBStoreService_getProducts(s32* p,s32* json,bool currency);\r\n    CKLBStoreService(EnginePrototype::_Delegate_Base_CallBack_inner27* callback);\r\n    CKLBStoreService();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 type,s32* itemID,s32* param);\r\n    inline void callBackFunction$(u32 type,s32* itemID,s32* param);\r\n    void buyItems(System::String* item);\r\n    inline void buyItems$(System::String* item);\r\n    void getProducts(System::String* json,bool currency);\r\n    inline void getProducts$(System::String* json,bool currency);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 158;\r\n};\r\nclass EnginePrototype::CKLBTask::_anon_0 : public System::Object {\r\n\r\npublic:\r\n    void _ctor__anon_0();\r\n    EnginePrototype::CKLBTask* _this__;\r\n    inline EnginePrototype::CKLBTask*& _g_this__$() { CHCKTHIS; return _this__; }\r\n    inline EnginePrototype::CKLBTask* _s_this__(EnginePrototype::CKLBTask* _$value);\r\n    inline EnginePrototype::CKLBTask* _s_this__$(EnginePrototype::CKLBTask* _$value);\r\n\r\n    s32 mode;\r\n    inline s32& _gmode$() { CHCKTHIS; return mode; }\r\n    inline s32 _smode$(s32 _$value) { CHCKTHIS; return mode = _$value; }\r\n    inline s32 _smode$postInc()\t\t\t\t{ CHCKTHIS; return (s32)(((s32&)mode)++); }\r\n    inline s32 _smode$postDec()\t\t\t\t{ CHCKTHIS; return (s32)(((s32&)mode)--); }\r\n    inline s32 _smode$preInc()\t\t\t\t{ CHCKTHIS; return (s32)(++(s32&)mode); }\r\n    inline s32 _smode$preDec()\t\t\t\t{ CHCKTHIS; return (s32)(--(s32&)mode); }\r\n    inline s32 _smode$AddEq(s32 value)\t\t{ CHCKTHIS; return (s32)((s32&)mode += value); }\r\n    inline s32 _smode$SubEq(s32 value)\t\t{ CHCKTHIS; return (s32)((s32&)mode -= value); }\r\n    inline s32 _smodepostInc()\t\t\t\t{ return (s32)(((s32&)mode)++); }\r\n    inline s32 _smodepostDec()\t\t\t\t{ return (s32)(((s32&)mode)--); }\r\n    inline s32 _smodepreInc()\t\t\t\t{ return (s32)(++(s32&)mode); }\r\n    inline s32 _smodepreDec()\t\t\t\t{ return (s32)(--(s32&)mode); }\r\n    inline s32 _smodeAddEq(s32 value)\t\t{ return (s32)((s32&)mode += value); }\r\n    inline s32 _smodeSubEq(s32 value)\t\t{ return (s32)((s32&)mode -= value); }\r\n\r\n    u32 time;\r\n    inline u32& _gtime$() { CHCKTHIS; return time; }\r\n    inline u32 _stime$(u32 _$value) { CHCKTHIS; return time = _$value; }\r\n    inline u32 _stime$postInc()\t\t\t\t{ CHCKTHIS; return time++; }\r\n    inline u32 _stime$postDec()\t\t\t\t{ CHCKTHIS; return time--; }\r\n    inline u32 _stime$preInc()\t\t\t\t{ CHCKTHIS; return ++time; }\r\n    inline u32 _stime$preDec()\t\t\t\t{ CHCKTHIS; return --time; }\r\n    inline u32 _stime$AddEq(u32 value)\t\t{ CHCKTHIS; return time += value; }\r\n    inline u32 _stime$SubEq(u32 value)\t\t{ CHCKTHIS; return time -= value; }\r\n    inline u32 _stime$MulEq(u32 value)\t\t{ CHCKTHIS; return time *= value; }\r\n    inline u32 _stime$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return time /= value; }\r\n    inline u32 _stime$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return time %= value; }\r\n    inline u32 _stime$XorEq(u32 value)\t\t{ CHCKTHIS; return time ^= value; }\r\n    inline u32 _stime$AndEq(u32 value)\t\t{ CHCKTHIS; return time &= value; }\r\n    inline u32 _stime$OrEq(u32 value)\t\t{ CHCKTHIS; return time |= value; }\r\n    inline u32 _stime$RShiftEq(u32 value)\t{ CHCKTHIS; return time >>= value; }\r\n    inline u32 _stime$LShiftEq(u32 value)\t{ CHCKTHIS; return time <<= value; }\r\n    inline u32 _stimepostInc()\t\t\t\t{ return time++; }\r\n    inline u32 _stimepostDec()\t\t\t\t{ return time--; }\r\n    inline u32 _stimepreInc()\t\t\t\t{ return ++time; }\r\n    inline u32 _stimepreDec()\t\t\t\t{ return --time; }\r\n    inline u32 _stimeAddEq(u32 value)\t\t{ return time += value; }\r\n    inline u32 _stimeSubEq(u32 value)\t\t{ return time -= value; }\r\n    inline u32 _stimeMulEq(u32 value)\t\t{ return time *= value; }\r\n    inline u32 _stimeDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return time /= value; }\r\n    inline u32 _stimeModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return time %= value; }\r\n    inline u32 _stimeXorEq(u32 value)\t\t{ return time ^= value; }\r\n    inline u32 _stimeAndEq(u32 value)\t\t{ return time &= value; }\r\n    inline u32 _stimeOrEq(u32 value)\t\t\t{ return time |= value; }\r\n    inline u32 _stimeRShiftEq(u32 value)\t\t{ return time >>= value; }\r\n    inline u32 _stimeLShiftEq(u32 value)\t\t{ return time <<= value; }\r\n\r\n    _anon_0(EnginePrototype::CKLBTask* _this__,s32 mode,u32 time);\r\n    void _delegate(EnginePrototype::CKLBIntervalTimer* caller);\r\n    inline void _delegate$(EnginePrototype::CKLBIntervalTimer* caller);\r\n    _anon_0();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 165;\r\n};\r\nstruct EnginePrototype::Area_inner3 : public System::__GCStruct {\r\n\r\npublic:\r\n    void _ctor_Area_inner3();\r\n    s32 x;\r\n    inline s32& _gx$() { CHCKTHIS; return x; }\r\n    inline s32 _sx$(s32 _$value) { CHCKTHIS; return x = _$value; }\r\n    inline s32 _sx$postInc()\t\t\t\t{ CHCKTHIS; return x++; }\r\n    inline s32 _sx$postDec()\t\t\t\t{ CHCKTHIS; return x--; }\r\n    inline s32 _sx$preInc()\t\t\t\t{ CHCKTHIS; return ++x; }\r\n    inline s32 _sx$preDec()\t\t\t\t{ CHCKTHIS; return --x; }\r\n    inline s32 _sx$AddEq(s32 value)\t\t{ CHCKTHIS; return x += value; }\r\n    inline s32 _sx$SubEq(s32 value)\t\t{ CHCKTHIS; return x -= value; }\r\n    inline s32 _sx$MulEq(s32 value)\t\t{ CHCKTHIS; return x *= value; }\r\n    inline s32 _sx$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return x /= value; }\r\n    inline s32 _sx$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return x %= value; }\r\n    inline s32 _sx$XorEq(s32 value)\t\t{ CHCKTHIS; return x ^= value; }\r\n    inline s32 _sx$AndEq(s32 value)\t\t{ CHCKTHIS; return x &= value; }\r\n    inline s32 _sx$OrEq(s32 value)\t\t{ CHCKTHIS; return x |= value; }\r\n    inline s32 _sx$RShiftEq(s32 value)\t{ CHCKTHIS; return x >>= value; }\r\n    inline s32 _sx$LShiftEq(s32 value)\t{ CHCKTHIS; return x <<= value; }\r\n    inline s32 _sxpostInc()\t\t\t\t{ return x++; }\r\n    inline s32 _sxpostDec()\t\t\t\t{ return x--; }\r\n    inline s32 _sxpreInc()\t\t\t\t{ return ++x; }\r\n    inline s32 _sxpreDec()\t\t\t\t{ return --x; }\r\n    inline s32 _sxAddEq(s32 value)\t\t{ return x += value; }\r\n    inline s32 _sxSubEq(s32 value)\t\t{ return x -= value; }\r\n    inline s32 _sxMulEq(s32 value)\t\t{ return x *= value; }\r\n    inline s32 _sxDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return x /= value; }\r\n    inline s32 _sxModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return x %= value; }\r\n    inline s32 _sxXorEq(s32 value)\t\t{ return x ^= value; }\r\n    inline s32 _sxAndEq(s32 value)\t\t{ return x &= value; }\r\n    inline s32 _sxOrEq(s32 value)\t\t\t{ return x |= value; }\r\n    inline s32 _sxRShiftEq(s32 value)\t\t{ return x >>= value; }\r\n    inline s32 _sxLShiftEq(s32 value)\t\t{ return x <<= value; }\r\n\r\n    s32 y;\r\n    inline s32& _gy$() { CHCKTHIS; return y; }\r\n    inline s32 _sy$(s32 _$value) { CHCKTHIS; return y = _$value; }\r\n    inline s32 _sy$postInc()\t\t\t\t{ CHCKTHIS; return y++; }\r\n    inline s32 _sy$postDec()\t\t\t\t{ CHCKTHIS; return y--; }\r\n    inline s32 _sy$preInc()\t\t\t\t{ CHCKTHIS; return ++y; }\r\n    inline s32 _sy$preDec()\t\t\t\t{ CHCKTHIS; return --y; }\r\n    inline s32 _sy$AddEq(s32 value)\t\t{ CHCKTHIS; return y += value; }\r\n    inline s32 _sy$SubEq(s32 value)\t\t{ CHCKTHIS; return y -= value; }\r\n    inline s32 _sy$MulEq(s32 value)\t\t{ CHCKTHIS; return y *= value; }\r\n    inline s32 _sy$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return y /= value; }\r\n    inline s32 _sy$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return y %= value; }\r\n    inline s32 _sy$XorEq(s32 value)\t\t{ CHCKTHIS; return y ^= value; }\r\n    inline s32 _sy$AndEq(s32 value)\t\t{ CHCKTHIS; return y &= value; }\r\n    inline s32 _sy$OrEq(s32 value)\t\t{ CHCKTHIS; return y |= value; }\r\n    inline s32 _sy$RShiftEq(s32 value)\t{ CHCKTHIS; return y >>= value; }\r\n    inline s32 _sy$LShiftEq(s32 value)\t{ CHCKTHIS; return y <<= value; }\r\n    inline s32 _sypostInc()\t\t\t\t{ return y++; }\r\n    inline s32 _sypostDec()\t\t\t\t{ return y--; }\r\n    inline s32 _sypreInc()\t\t\t\t{ return ++y; }\r\n    inline s32 _sypreDec()\t\t\t\t{ return --y; }\r\n    inline s32 _syAddEq(s32 value)\t\t{ return y += value; }\r\n    inline s32 _sySubEq(s32 value)\t\t{ return y -= value; }\r\n    inline s32 _syMulEq(s32 value)\t\t{ return y *= value; }\r\n    inline s32 _syDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return y /= value; }\r\n    inline s32 _syModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return y %= value; }\r\n    inline s32 _syXorEq(s32 value)\t\t{ return y ^= value; }\r\n    inline s32 _syAndEq(s32 value)\t\t{ return y &= value; }\r\n    inline s32 _syOrEq(s32 value)\t\t\t{ return y |= value; }\r\n    inline s32 _syRShiftEq(s32 value)\t\t{ return y >>= value; }\r\n    inline s32 _syLShiftEq(s32 value)\t\t{ return y <<= value; }\r\n\r\n    s32 width;\r\n    inline s32& _gwidth$() { CHCKTHIS; return width; }\r\n    inline s32 _swidth$(s32 _$value) { CHCKTHIS; return width = _$value; }\r\n    inline s32 _swidth$postInc()\t\t\t\t{ CHCKTHIS; return width++; }\r\n    inline s32 _swidth$postDec()\t\t\t\t{ CHCKTHIS; return width--; }\r\n    inline s32 _swidth$preInc()\t\t\t\t{ CHCKTHIS; return ++width; }\r\n    inline s32 _swidth$preDec()\t\t\t\t{ CHCKTHIS; return --width; }\r\n    inline s32 _swidth$AddEq(s32 value)\t\t{ CHCKTHIS; return width += value; }\r\n    inline s32 _swidth$SubEq(s32 value)\t\t{ CHCKTHIS; return width -= value; }\r\n    inline s32 _swidth$MulEq(s32 value)\t\t{ CHCKTHIS; return width *= value; }\r\n    inline s32 _swidth$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline s32 _swidth$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline s32 _swidth$XorEq(s32 value)\t\t{ CHCKTHIS; return width ^= value; }\r\n    inline s32 _swidth$AndEq(s32 value)\t\t{ CHCKTHIS; return width &= value; }\r\n    inline s32 _swidth$OrEq(s32 value)\t\t{ CHCKTHIS; return width |= value; }\r\n    inline s32 _swidth$RShiftEq(s32 value)\t{ CHCKTHIS; return width >>= value; }\r\n    inline s32 _swidth$LShiftEq(s32 value)\t{ CHCKTHIS; return width <<= value; }\r\n    inline s32 _swidthpostInc()\t\t\t\t{ return width++; }\r\n    inline s32 _swidthpostDec()\t\t\t\t{ return width--; }\r\n    inline s32 _swidthpreInc()\t\t\t\t{ return ++width; }\r\n    inline s32 _swidthpreDec()\t\t\t\t{ return --width; }\r\n    inline s32 _swidthAddEq(s32 value)\t\t{ return width += value; }\r\n    inline s32 _swidthSubEq(s32 value)\t\t{ return width -= value; }\r\n    inline s32 _swidthMulEq(s32 value)\t\t{ return width *= value; }\r\n    inline s32 _swidthDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width /= value; }\r\n    inline s32 _swidthModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return width %= value; }\r\n    inline s32 _swidthXorEq(s32 value)\t\t{ return width ^= value; }\r\n    inline s32 _swidthAndEq(s32 value)\t\t{ return width &= value; }\r\n    inline s32 _swidthOrEq(s32 value)\t\t\t{ return width |= value; }\r\n    inline s32 _swidthRShiftEq(s32 value)\t\t{ return width >>= value; }\r\n    inline s32 _swidthLShiftEq(s32 value)\t\t{ return width <<= value; }\r\n\r\n    s32 height;\r\n    inline s32& _gheight$() { CHCKTHIS; return height; }\r\n    inline s32 _sheight$(s32 _$value) { CHCKTHIS; return height = _$value; }\r\n    inline s32 _sheight$postInc()\t\t\t\t{ CHCKTHIS; return height++; }\r\n    inline s32 _sheight$postDec()\t\t\t\t{ CHCKTHIS; return height--; }\r\n    inline s32 _sheight$preInc()\t\t\t\t{ CHCKTHIS; return ++height; }\r\n    inline s32 _sheight$preDec()\t\t\t\t{ CHCKTHIS; return --height; }\r\n    inline s32 _sheight$AddEq(s32 value)\t\t{ CHCKTHIS; return height += value; }\r\n    inline s32 _sheight$SubEq(s32 value)\t\t{ CHCKTHIS; return height -= value; }\r\n    inline s32 _sheight$MulEq(s32 value)\t\t{ CHCKTHIS; return height *= value; }\r\n    inline s32 _sheight$DivEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline s32 _sheight$ModEq(s32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline s32 _sheight$XorEq(s32 value)\t\t{ CHCKTHIS; return height ^= value; }\r\n    inline s32 _sheight$AndEq(s32 value)\t\t{ CHCKTHIS; return height &= value; }\r\n    inline s32 _sheight$OrEq(s32 value)\t\t{ CHCKTHIS; return height |= value; }\r\n    inline s32 _sheight$RShiftEq(s32 value)\t{ CHCKTHIS; return height >>= value; }\r\n    inline s32 _sheight$LShiftEq(s32 value)\t{ CHCKTHIS; return height <<= value; }\r\n    inline s32 _sheightpostInc()\t\t\t\t{ return height++; }\r\n    inline s32 _sheightpostDec()\t\t\t\t{ return height--; }\r\n    inline s32 _sheightpreInc()\t\t\t\t{ return ++height; }\r\n    inline s32 _sheightpreDec()\t\t\t\t{ return --height; }\r\n    inline s32 _sheightAddEq(s32 value)\t\t{ return height += value; }\r\n    inline s32 _sheightSubEq(s32 value)\t\t{ return height -= value; }\r\n    inline s32 _sheightMulEq(s32 value)\t\t{ return height *= value; }\r\n    inline s32 _sheightDivEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height /= value; }\r\n    inline s32 _sheightModEq(s32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return height %= value; }\r\n    inline s32 _sheightXorEq(s32 value)\t\t{ return height ^= value; }\r\n    inline s32 _sheightAndEq(s32 value)\t\t{ return height &= value; }\r\n    inline s32 _sheightOrEq(s32 value)\t\t\t{ return height |= value; }\r\n    inline s32 _sheightRShiftEq(s32 value)\t\t{ return height >>= value; }\r\n    inline s32 _sheightLShiftEq(s32 value)\t\t{ return height <<= value; }\r\n\r\n    Area_inner3(s32 _x,s32 _y,s32 _width,s32 _height);\r\n    void setValues(s32 _x,s32 _y,s32 _width,s32 _height);\r\n    inline void setValues$(s32 _x,s32 _y,s32 _width,s32 _height);\r\n    Area_inner3();\r\n    inline u32 _processGC();\r\n    inline void _releaseGC();\r\n    inline void* _RefSetValue(void* newStruct);\r\n    virtual inline void _moveAlert(u32 offset);\r\n    inline static Area_inner3& __registerByRef(Area_inner3& m);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_STRUCT | 189;\r\n};\r\nclass EnginePrototype::AnimationInfo : public System::Object {\r\n\r\npublic:\r\n    enum EIDX {\r\n        X_COORD = 0,\r\n        Y_COORD = 1,\r\n        SCALE_COORD = 2,\r\n        R_COLOR = 3,\r\n        G_COLOR = 4,\r\n        B_COLOR = 5,\r\n        A_COLOR = 6,\r\n        SCALEX_COORD = 7,\r\n        SCALEY_COORD = 8,\r\n        ROTATION_COORD = 9,\r\n        COUNT = 9,\r\n        _ForceWORD_EIDX = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_AnimationInfo();\r\n    u32 m_mask;\r\n    inline u32& _gm_mask$() { CHCKTHIS; return m_mask; }\r\n    inline u32 _sm_mask$(u32 _$value) { CHCKTHIS; return m_mask = _$value; }\r\n    inline u32 _sm_mask$postInc()\t\t\t\t{ CHCKTHIS; return m_mask++; }\r\n    inline u32 _sm_mask$postDec()\t\t\t\t{ CHCKTHIS; return m_mask--; }\r\n    inline u32 _sm_mask$preInc()\t\t\t\t{ CHCKTHIS; return ++m_mask; }\r\n    inline u32 _sm_mask$preDec()\t\t\t\t{ CHCKTHIS; return --m_mask; }\r\n    inline u32 _sm_mask$AddEq(u32 value)\t\t{ CHCKTHIS; return m_mask += value; }\r\n    inline u32 _sm_mask$SubEq(u32 value)\t\t{ CHCKTHIS; return m_mask -= value; }\r\n    inline u32 _sm_mask$MulEq(u32 value)\t\t{ CHCKTHIS; return m_mask *= value; }\r\n    inline u32 _sm_mask$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_mask /= value; }\r\n    inline u32 _sm_mask$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_mask %= value; }\r\n    inline u32 _sm_mask$XorEq(u32 value)\t\t{ CHCKTHIS; return m_mask ^= value; }\r\n    inline u32 _sm_mask$AndEq(u32 value)\t\t{ CHCKTHIS; return m_mask &= value; }\r\n    inline u32 _sm_mask$OrEq(u32 value)\t\t{ CHCKTHIS; return m_mask |= value; }\r\n    inline u32 _sm_mask$RShiftEq(u32 value)\t{ CHCKTHIS; return m_mask >>= value; }\r\n    inline u32 _sm_mask$LShiftEq(u32 value)\t{ CHCKTHIS; return m_mask <<= value; }\r\n    inline u32 _sm_maskpostInc()\t\t\t\t{ return m_mask++; }\r\n    inline u32 _sm_maskpostDec()\t\t\t\t{ return m_mask--; }\r\n    inline u32 _sm_maskpreInc()\t\t\t\t{ return ++m_mask; }\r\n    inline u32 _sm_maskpreDec()\t\t\t\t{ return --m_mask; }\r\n    inline u32 _sm_maskAddEq(u32 value)\t\t{ return m_mask += value; }\r\n    inline u32 _sm_maskSubEq(u32 value)\t\t{ return m_mask -= value; }\r\n    inline u32 _sm_maskMulEq(u32 value)\t\t{ return m_mask *= value; }\r\n    inline u32 _sm_maskDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_mask /= value; }\r\n    inline u32 _sm_maskModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_mask %= value; }\r\n    inline u32 _sm_maskXorEq(u32 value)\t\t{ return m_mask ^= value; }\r\n    inline u32 _sm_maskAndEq(u32 value)\t\t{ return m_mask &= value; }\r\n    inline u32 _sm_maskOrEq(u32 value)\t\t\t{ return m_mask |= value; }\r\n    inline u32 _sm_maskRShiftEq(u32 value)\t\t{ return m_mask >>= value; }\r\n    inline u32 _sm_maskLShiftEq(u32 value)\t\t{ return m_mask <<= value; }\r\n\r\n    static System::Array<u32>* ms_maskArr;\r\n    inline static System::Array<u32>* _sms_maskArr(System::Array<u32>* _$value);\r\n\r\n    static System::Array<s32>* ms_indexes;\r\n    inline static System::Array<s32>* _sms_indexes(System::Array<s32>* _$value);\r\n\r\n    System::Array<float>* m_internalArray;\r\n    inline System::Array<float>*& _gm_internalArray$() { CHCKTHIS; return m_internalArray; }\r\n    inline System::Array<float>* _sm_internalArray(System::Array<float>* _$value);\r\n    inline System::Array<float>* _sm_internalArray$(System::Array<float>* _$value);\r\n\r\n    void createAlphaAnimation(float start,float end);\r\n    inline void createAlphaAnimation$(float start,float end);\r\n    void createRGBAnimation(float RStart,float REnd,float GStart,float GEnd,float BStart,float BEnd);\r\n    inline void createRGBAnimation$(float RStart,float REnd,float GStart,float GEnd,float BStart,float BEnd);\r\n    void createScaleAnimation(float start,float end);\r\n    inline void createScaleAnimation$(float start,float end);\r\n    void createXOffsetAnimation(float start,float end);\r\n    inline void createXOffsetAnimation$(float start,float end);\r\n    void createYOffsetAnimation(float start,float end);\r\n    inline void createYOffsetAnimation$(float start,float end);\r\n    void _ref_getAnimInfo(u32& type,u32& affected,System::Array<float>*& arrayParam);\r\n    inline void getAnimInfo$(u32& type,u32& affected,System::Array<float>*& arrayParam);\r\n    inline void getAnimInfo(u32& type,u32& affected,System::Array<float>*& arrayParam);\r\n    AnimationInfo();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 227;\r\n};\r\nclass EnginePrototype::CKLBUITask : public EnginePrototype::CKLBTask {\r\nfriend class Spline_inner4;\r\nfriend class IntSpline_inner5;\r\nfriend class IntPoint_inner6;\r\nfriend class FloatSpline_inner7;\r\nfriend class FloatPoint_inner8;\r\nfriend class AnimSpline_inner9;\r\n\r\npublic:\r\n    enum ETARGET_TYPE {\r\n        MODIFY_X = 1,\r\n        MODIFY_Y = 2,\r\n        MODIFY_SCALE = 3,\r\n        MODIFY_R = 4,\r\n        MODIFY_G = 5,\r\n        MODIFY_B = 6,\r\n        MODIFY_A = 7,\r\n        MODIFY_ROT = 8,\r\n        _ForceWORD_ETARGET_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    enum ESPLINE_TYPE {\r\n        INT_SPLINE,\r\n        FLOAT_SPLINE,\r\n        _ForceWORD_ESPLINE_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUITask();\r\n    inline float _acc_gScaleX();\r\n    inline float _acc_gScaleX$();\r\n\r\n    inline float _acc_sScaleX(float value);\r\n    inline float _acc_sScaleX$(float value);\r\n    inline float _acc_sScaleXpostInc()\t\t\t{ float tmp; _acc_sScaleX((tmp = _acc_gScaleX())+1); return tmp; }\r\n    inline float _acc_sScaleX$postInc()\t\t\t{ CHCKTHIS; return _acc_sScaleXpostInc(); }\r\n    inline float _acc_sScaleXpostDec()\t\t\t{ float tmp; _acc_sScaleX((tmp = _acc_gScaleX())-1); return tmp; }\r\n    inline float _acc_sScaleX$postDec()\t\t\t{ CHCKTHIS; return _acc_sScaleXpostDec(); }\r\n    inline float _acc_sScaleXpreInc()\t\t\t{ return _acc_sScaleX(_acc_gScaleX()+1); }\r\n    inline float _acc_sScaleX$preInc()\t\t\t{ CHCKTHIS; return _acc_sScaleXpreInc(); }\r\n    inline float _acc_sScaleXpreDec()\t\t\t{ return _acc_sScaleX(_acc_gScaleX()-1); }\r\n    inline float _acc_sScaleX$preDec()\t\t\t{ CHCKTHIS; return _acc_sScaleXpreDec(); }\r\n    inline float _acc_sScaleXAddEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() + value); }\r\n    inline float _acc_sScaleX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXAddEq(value); }\r\n    inline float _acc_sScaleXSubEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() - value); }\r\n    inline float _acc_sScaleX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXSubEq(value); }\r\n    inline float _acc_sScaleXMulEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() * value); }\r\n    inline float _acc_sScaleX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXMulEq(value); }\r\n    inline float _acc_sScaleXDivEq(float value)\t{ return _acc_sScaleX(_acc_gScaleX() / value); }\r\n    inline float _acc_sScaleX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXDivEq(value); }\r\n    inline float _acc_sScaleXModEq(float value)\t{  float orig = _acc_gScaleX(); s32 tmp = (s32)(orig / value); return _acc_sScaleX(orig - (tmp * value)); }\r\n    inline float _acc_sScaleX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleXModEq(value); }\r\n    inline float _acc_gScaleY();\r\n    inline float _acc_gScaleY$();\r\n\r\n    inline float _acc_sScaleY(float value);\r\n    inline float _acc_sScaleY$(float value);\r\n    inline float _acc_sScaleYpostInc()\t\t\t{ float tmp; _acc_sScaleY((tmp = _acc_gScaleY())+1); return tmp; }\r\n    inline float _acc_sScaleY$postInc()\t\t\t{ CHCKTHIS; return _acc_sScaleYpostInc(); }\r\n    inline float _acc_sScaleYpostDec()\t\t\t{ float tmp; _acc_sScaleY((tmp = _acc_gScaleY())-1); return tmp; }\r\n    inline float _acc_sScaleY$postDec()\t\t\t{ CHCKTHIS; return _acc_sScaleYpostDec(); }\r\n    inline float _acc_sScaleYpreInc()\t\t\t{ return _acc_sScaleY(_acc_gScaleY()+1); }\r\n    inline float _acc_sScaleY$preInc()\t\t\t{ CHCKTHIS; return _acc_sScaleYpreInc(); }\r\n    inline float _acc_sScaleYpreDec()\t\t\t{ return _acc_sScaleY(_acc_gScaleY()-1); }\r\n    inline float _acc_sScaleY$preDec()\t\t\t{ CHCKTHIS; return _acc_sScaleYpreDec(); }\r\n    inline float _acc_sScaleYAddEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() + value); }\r\n    inline float _acc_sScaleY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYAddEq(value); }\r\n    inline float _acc_sScaleYSubEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() - value); }\r\n    inline float _acc_sScaleY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYSubEq(value); }\r\n    inline float _acc_sScaleYMulEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() * value); }\r\n    inline float _acc_sScaleY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYMulEq(value); }\r\n    inline float _acc_sScaleYDivEq(float value)\t{ return _acc_sScaleY(_acc_gScaleY() / value); }\r\n    inline float _acc_sScaleY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYDivEq(value); }\r\n    inline float _acc_sScaleYModEq(float value)\t{  float orig = _acc_gScaleY(); s32 tmp = (s32)(orig / value); return _acc_sScaleY(orig - (tmp * value)); }\r\n    inline float _acc_sScaleY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sScaleYModEq(value); }\r\n    inline float _acc_gRotation();\r\n    inline float _acc_gRotation$();\r\n\r\n    inline float _acc_sRotation(float value);\r\n    inline float _acc_sRotation$(float value);\r\n    inline float _acc_sRotationpostInc()\t\t\t{ float tmp; _acc_sRotation((tmp = _acc_gRotation())+1); return tmp; }\r\n    inline float _acc_sRotation$postInc()\t\t\t{ CHCKTHIS; return _acc_sRotationpostInc(); }\r\n    inline float _acc_sRotationpostDec()\t\t\t{ float tmp; _acc_sRotation((tmp = _acc_gRotation())-1); return tmp; }\r\n    inline float _acc_sRotation$postDec()\t\t\t{ CHCKTHIS; return _acc_sRotationpostDec(); }\r\n    inline float _acc_sRotationpreInc()\t\t\t{ return _acc_sRotation(_acc_gRotation()+1); }\r\n    inline float _acc_sRotation$preInc()\t\t\t{ CHCKTHIS; return _acc_sRotationpreInc(); }\r\n    inline float _acc_sRotationpreDec()\t\t\t{ return _acc_sRotation(_acc_gRotation()-1); }\r\n    inline float _acc_sRotation$preDec()\t\t\t{ CHCKTHIS; return _acc_sRotationpreDec(); }\r\n    inline float _acc_sRotationAddEq(float value)\t{ return _acc_sRotation(_acc_gRotation() + value); }\r\n    inline float _acc_sRotation$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationAddEq(value); }\r\n    inline float _acc_sRotationSubEq(float value)\t{ return _acc_sRotation(_acc_gRotation() - value); }\r\n    inline float _acc_sRotation$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationSubEq(value); }\r\n    inline float _acc_sRotationMulEq(float value)\t{ return _acc_sRotation(_acc_gRotation() * value); }\r\n    inline float _acc_sRotation$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationMulEq(value); }\r\n    inline float _acc_sRotationDivEq(float value)\t{ return _acc_sRotation(_acc_gRotation() / value); }\r\n    inline float _acc_sRotation$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationDivEq(value); }\r\n    inline float _acc_sRotationModEq(float value)\t{  float orig = _acc_gRotation(); s32 tmp = (s32)(orig / value); return _acc_sRotation(orig - (tmp * value)); }\r\n    inline float _acc_sRotation$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sRotationModEq(value); }\r\n    inline float _acc_gX();\r\n    inline float _acc_gX$();\r\n\r\n    inline float _acc_sX(float value);\r\n    inline float _acc_sX$(float value);\r\n    inline float _acc_sXpostInc()\t\t\t{ float tmp; _acc_sX((tmp = _acc_gX())+1); return tmp; }\r\n    inline float _acc_sX$postInc()\t\t\t{ CHCKTHIS; return _acc_sXpostInc(); }\r\n    inline float _acc_sXpostDec()\t\t\t{ float tmp; _acc_sX((tmp = _acc_gX())-1); return tmp; }\r\n    inline float _acc_sX$postDec()\t\t\t{ CHCKTHIS; return _acc_sXpostDec(); }\r\n    inline float _acc_sXpreInc()\t\t\t{ return _acc_sX(_acc_gX()+1); }\r\n    inline float _acc_sX$preInc()\t\t\t{ CHCKTHIS; return _acc_sXpreInc(); }\r\n    inline float _acc_sXpreDec()\t\t\t{ return _acc_sX(_acc_gX()-1); }\r\n    inline float _acc_sX$preDec()\t\t\t{ CHCKTHIS; return _acc_sXpreDec(); }\r\n    inline float _acc_sXAddEq(float value)\t{ return _acc_sX(_acc_gX() + value); }\r\n    inline float _acc_sX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXAddEq(value); }\r\n    inline float _acc_sXSubEq(float value)\t{ return _acc_sX(_acc_gX() - value); }\r\n    inline float _acc_sX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXSubEq(value); }\r\n    inline float _acc_sXMulEq(float value)\t{ return _acc_sX(_acc_gX() * value); }\r\n    inline float _acc_sX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXMulEq(value); }\r\n    inline float _acc_sXDivEq(float value)\t{ return _acc_sX(_acc_gX() / value); }\r\n    inline float _acc_sX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXDivEq(value); }\r\n    inline float _acc_sXModEq(float value)\t{  float orig = _acc_gX(); s32 tmp = (s32)(orig / value); return _acc_sX(orig - (tmp * value)); }\r\n    inline float _acc_sX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sXModEq(value); }\r\n    inline float _acc_gY();\r\n    inline float _acc_gY$();\r\n\r\n    inline float _acc_sY(float value);\r\n    inline float _acc_sY$(float value);\r\n    inline float _acc_sYpostInc()\t\t\t{ float tmp; _acc_sY((tmp = _acc_gY())+1); return tmp; }\r\n    inline float _acc_sY$postInc()\t\t\t{ CHCKTHIS; return _acc_sYpostInc(); }\r\n    inline float _acc_sYpostDec()\t\t\t{ float tmp; _acc_sY((tmp = _acc_gY())-1); return tmp; }\r\n    inline float _acc_sY$postDec()\t\t\t{ CHCKTHIS; return _acc_sYpostDec(); }\r\n    inline float _acc_sYpreInc()\t\t\t{ return _acc_sY(_acc_gY()+1); }\r\n    inline float _acc_sY$preInc()\t\t\t{ CHCKTHIS; return _acc_sYpreInc(); }\r\n    inline float _acc_sYpreDec()\t\t\t{ return _acc_sY(_acc_gY()-1); }\r\n    inline float _acc_sY$preDec()\t\t\t{ CHCKTHIS; return _acc_sYpreDec(); }\r\n    inline float _acc_sYAddEq(float value)\t{ return _acc_sY(_acc_gY() + value); }\r\n    inline float _acc_sY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYAddEq(value); }\r\n    inline float _acc_sYSubEq(float value)\t{ return _acc_sY(_acc_gY() - value); }\r\n    inline float _acc_sY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYSubEq(value); }\r\n    inline float _acc_sYMulEq(float value)\t{ return _acc_sY(_acc_gY() * value); }\r\n    inline float _acc_sY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYMulEq(value); }\r\n    inline float _acc_sYDivEq(float value)\t{ return _acc_sY(_acc_gY() / value); }\r\n    inline float _acc_sY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYDivEq(value); }\r\n    inline float _acc_sYModEq(float value)\t{  float orig = _acc_gY(); s32 tmp = (s32)(orig / value); return _acc_sY(orig - (tmp * value)); }\r\n    inline float _acc_sY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sYModEq(value); }\r\n    inline bool _acc_gIsVisible();\r\n    inline bool _acc_gIsVisible$();\r\n\r\n    inline bool _acc_sIsVisible(bool value);\r\n    inline bool _acc_sIsVisible$(bool value);\r\n    inline u32 _acc_gArgb();\r\n    inline u32 _acc_gArgb$();\r\n\r\n    inline u32 _acc_sArgb(u32 value);\r\n    inline u32 _acc_sArgb$(u32 value);\r\n    inline u32 _acc_sArgbpostInc()\t\t\t{ u32 tmp; _acc_sArgb((tmp = _acc_gArgb())+1); return tmp; }\r\n    inline u32 _acc_sArgb$postInc()\t\t\t{ CHCKTHIS; return _acc_sArgbpostInc(); }\r\n    inline u32 _acc_sArgbpostDec()\t\t\t{ u32 tmp; _acc_sArgb((tmp = _acc_gArgb())-1); return tmp; }\r\n    inline u32 _acc_sArgb$postDec()\t\t\t{ CHCKTHIS; return _acc_sArgbpostDec(); }\r\n    inline u32 _acc_sArgbpreInc()\t\t\t{ return _acc_sArgb(_acc_gArgb()+1); }\r\n    inline u32 _acc_sArgb$preInc()\t\t\t{ CHCKTHIS; return _acc_sArgbpreInc(); }\r\n    inline u32 _acc_sArgbpreDec()\t\t\t{ return _acc_sArgb(_acc_gArgb()-1); }\r\n    inline u32 _acc_sArgb$preDec()\t\t\t{ CHCKTHIS; return _acc_sArgbpreDec(); }\r\n    inline u32 _acc_sArgbAddEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() + value); }\r\n    inline u32 _acc_sArgb$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbAddEq(value); }\r\n    inline u32 _acc_sArgbSubEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() - value); }\r\n    inline u32 _acc_sArgb$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbSubEq(value); }\r\n    inline u32 _acc_sArgbMulEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() * value); }\r\n    inline u32 _acc_sArgb$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbMulEq(value); }\r\n    inline u32 _acc_sArgbDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sArgb(_acc_gArgb() / value); }\r\n    inline u32 _acc_sArgb$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbDivEq(value); }\r\n    inline u32 _acc_sArgbModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sArgb(_acc_gArgb() % value); }\r\n    inline u32 _acc_sArgb$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbModEq(value); }\r\n    inline u32 _acc_sArgbXorEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() ^ value); }\r\n    inline u32 _acc_sArgb$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbXorEq(value); }\r\n    inline u32 _acc_sArgbAndEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() & value); }\r\n    inline u32 _acc_sArgb$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbAndEq(value); }\r\n    inline u32 _acc_sArgbOrEq(u32 value)\t\t{ return _acc_sArgb(_acc_gArgb() | value); }\r\n    inline u32 _acc_sArgb$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbOrEq(value); }\r\n    inline u32 _acc_sArgbRShiftEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() >> value); }\r\n    inline u32 _acc_sArgb$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbRShiftEq(value); }\r\n    inline u32 _acc_sArgbLShiftEq(u32 value)\t{ return _acc_sArgb(_acc_gArgb() << value); }\r\n    inline u32 _acc_sArgb$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbLShiftEq(value); }\r\n    inline bool _acc_gIsNodeAnim();\r\n    inline bool _acc_gIsNodeAnim$();\r\n\r\n    static bool _ext_CKLBUITask_getVisible(s32* p);\r\n    static void _ext_CKLBUITask_setVisible(s32* p,bool isVisible);\r\n    static float _ext_CKLBUITask_getScaleX(s32* p);\r\n    static void _ext_CKLBUITask_setScaleX(s32* p,float scaleX);\r\n    static float _ext_CKLBUITask_getScaleY(s32* p);\r\n    static void _ext_CKLBUITask_setScaleY(s32* p,float scaleY);\r\n    static float _ext_CKLBUITask_getX(s32* p);\r\n    static void _ext_CKLBUITask_setX(s32* p,float x);\r\n    static float _ext_CKLBUITask_getY(s32* p);\r\n    static void _ext_CKLBUITask_setY(s32* p,float y);\r\n    static float _ext_CKLBUITask_getRotation(s32* p);\r\n    static void _ext_CKLBUITask_setRotation(s32* p,float rotation);\r\n    static u32 _ext_CKLBUITask_getArgb(s32* p);\r\n    static void _ext_CKLBUITask_setArgb(s32* p,u32 argb);\r\n    static bool _ext_CKLBUITask_isAnim(s32* p);\r\n    static void _ext_CKLBUITask_play(s32* p);\r\n    static void _ext_CKLBUITask_stop(s32* p);\r\n    static bool _ext_CKLBUITask_setParamCount(s32* p,u32 splineCount,u32 maxKeyCount);\r\n    static void _ext_CKLBUITask_setTarget(s32* p,u32 splineIndex,s32 targetParameter);\r\n    static void _ext_CKLBUITask_addKeys(s32* p,u32 splineIndex,u32 time,s32 value);\r\n    static void _ext_CKLBUITask_addKeysFixed(s32* p,u32 splineIndex,u32 time,s32 fixed16Value);\r\n    static void _ext_CKLBUITask_generateAnimation(s32* p);\r\n    static bool _ext_CKLBUITask_reconnect(s32* p,s32* nodeName);\r\n    CKLBUITask(u32 classID);\r\n    EnginePrototype::NodeIterator* _ref_getIterator(EnginePrototype::NodeIterator*& nodeIterator);\r\n    inline EnginePrototype::NodeIterator* getIterator$(EnginePrototype::NodeIterator*& nodeIterator);\r\n    inline EnginePrototype::NodeIterator* getIterator(EnginePrototype::NodeIterator*& nodeIterator);\r\n    EnginePrototype::NodeIterator* _ref_getIteratorFromName(System::String* name,EnginePrototype::NodeIterator*& nodeIterator);\r\n    inline EnginePrototype::NodeIterator* getIteratorFromName$(System::String* name,EnginePrototype::NodeIterator*& nodeIterator);\r\n    inline EnginePrototype::NodeIterator* getIteratorFromName(System::String* name,EnginePrototype::NodeIterator*& nodeIterator);\r\n    void nodeReconnect(System::String* nodeName);\r\n    inline void nodeReconnect$(System::String* nodeName);\r\n    void animationPlay();\r\n    inline void animationPlay$();\r\n    void animationStop();\r\n    inline void animationStop$();\r\n    void setScale(float scaleX,float scaleY);\r\n    inline void setScale$(float scaleX,float scaleY);\r\n    void setAnimSpline(EnginePrototype::AnimSpline_inner9* splineArray);\r\n    inline void setAnimSpline$(EnginePrototype::AnimSpline_inner9* splineArray);\r\n    CKLBUITask();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 239;\r\n};\r\nclass EnginePrototype::CKLBIntervalTimer : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner24;\r\n\r\npublic:\r\n    enum ETIMERMODE {\r\n        INTERVALTIMER_TIME = 0,\r\n        INTERVALTIMER_FRAME,\r\n        _ForceWORD_ETIMERMODE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBIntervalTimer();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner24* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner24*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner24* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner24* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner24* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner24* _$value);\r\n\r\n    inline s32 _acc_gMode();\r\n    inline s32 _acc_gMode$();\r\n\r\n    inline u32 _acc_gInterval();\r\n    inline u32 _acc_gInterval$();\r\n\r\n    inline u32 _acc_sInterval(u32 value);\r\n    inline u32 _acc_sInterval$(u32 value);\r\n    inline u32 _acc_sIntervalpostInc()\t\t\t{ u32 tmp; _acc_sInterval((tmp = _acc_gInterval())+1); return tmp; }\r\n    inline u32 _acc_sInterval$postInc()\t\t\t{ CHCKTHIS; return _acc_sIntervalpostInc(); }\r\n    inline u32 _acc_sIntervalpostDec()\t\t\t{ u32 tmp; _acc_sInterval((tmp = _acc_gInterval())-1); return tmp; }\r\n    inline u32 _acc_sInterval$postDec()\t\t\t{ CHCKTHIS; return _acc_sIntervalpostDec(); }\r\n    inline u32 _acc_sIntervalpreInc()\t\t\t{ return _acc_sInterval(_acc_gInterval()+1); }\r\n    inline u32 _acc_sInterval$preInc()\t\t\t{ CHCKTHIS; return _acc_sIntervalpreInc(); }\r\n    inline u32 _acc_sIntervalpreDec()\t\t\t{ return _acc_sInterval(_acc_gInterval()-1); }\r\n    inline u32 _acc_sInterval$preDec()\t\t\t{ CHCKTHIS; return _acc_sIntervalpreDec(); }\r\n    inline u32 _acc_sIntervalAddEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() + value); }\r\n    inline u32 _acc_sInterval$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalAddEq(value); }\r\n    inline u32 _acc_sIntervalSubEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() - value); }\r\n    inline u32 _acc_sInterval$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalSubEq(value); }\r\n    inline u32 _acc_sIntervalMulEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() * value); }\r\n    inline u32 _acc_sInterval$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalMulEq(value); }\r\n    inline u32 _acc_sIntervalDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sInterval(_acc_gInterval() / value); }\r\n    inline u32 _acc_sInterval$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalDivEq(value); }\r\n    inline u32 _acc_sIntervalModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sInterval(_acc_gInterval() % value); }\r\n    inline u32 _acc_sInterval$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalModEq(value); }\r\n    inline u32 _acc_sIntervalXorEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() ^ value); }\r\n    inline u32 _acc_sInterval$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalXorEq(value); }\r\n    inline u32 _acc_sIntervalAndEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() & value); }\r\n    inline u32 _acc_sInterval$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalAndEq(value); }\r\n    inline u32 _acc_sIntervalOrEq(u32 value)\t\t{ return _acc_sInterval(_acc_gInterval() | value); }\r\n    inline u32 _acc_sInterval$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalOrEq(value); }\r\n    inline u32 _acc_sIntervalRShiftEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() >> value); }\r\n    inline u32 _acc_sInterval$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalRShiftEq(value); }\r\n    inline u32 _acc_sIntervalLShiftEq(u32 value)\t{ return _acc_sInterval(_acc_gInterval() << value); }\r\n    inline u32 _acc_sInterval$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIntervalLShiftEq(value); }\r\n    inline bool _acc_gRepeat();\r\n    inline bool _acc_gRepeat$();\r\n\r\n    inline bool _acc_sRepeat(bool value);\r\n    inline bool _acc_sRepeat$(bool value);\r\n    static s32* _ext_CKLBIntervalTimer_create(s32* pParent,u32 interval,bool repeat,u8 mode);\r\n    static u32 _ext_CKLBIntervalTimer_getTimerID(s32* p);\r\n    static void _ext_CKLBIntervalTimer_setTimerID(s32* p,u32 ID);\r\n    static bool _ext_CKLBIntervalTimer_getRepeat(s32* p);\r\n    static void _ext_CKLBIntervalTimer_setRepeat(s32* p,bool boolean);\r\n    static u32 _ext_CKLBIntervalTimer_getInterval(s32* p);\r\n    static void _ext_CKLBIntervalTimer_setInterval(s32* p,u32 interval);\r\n    static u8 _ext_CKLBIntervalTimer_getMode(s32* p);\r\n    CKLBIntervalTimer(EnginePrototype::CKLBTask* parent,u32 interval,EnginePrototype::_Delegate_Base_CallBack_inner24* callback,bool repeat,s32 mode);\r\n    CKLBIntervalTimer();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction();\r\n    inline void callBackFunction$();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 148;\r\n};\r\nclass EnginePrototype::CKLBUICanvas : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner29;\r\n\r\npublic:\r\n    void _ctor_CKLBUICanvas();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner29* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner29*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner29* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner29* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner29* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner29* _$value);\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline u32 _acc_gIdxMax();\r\n    inline u32 _acc_gIdxMax$();\r\n\r\n    inline bool _acc_sFreeze(bool value);\r\n    inline bool _acc_sFreeze$(bool value);\r\n    static s32* _ext_CKLBUICanvas_create(s32* pParent,u32 order,float x,float y,u32 vertexMax,u32 indexMax);\r\n    static u32 _ext_CKLBUICanvas_getOrder(s32* p);\r\n    static void _ext_CKLBUICanvas_setOrder(s32* p,u32 order);\r\n    static u32 _ext_CKLBUICanvas_getIdxMax(s32* p);\r\n    static bool _ext_CKLBUICanvas_addResource(s32* p,s32* asset);\r\n    static void _ext_CKLBUICanvas_setFreeze(s32* p,bool freeze);\r\n    static void _ext_CKLBUICanvas_drawImage(s32* p,float x,float y,u32 idx,u32 color);\r\n    static void _ext_CKLBUICanvas_drawImageScale(s32* p,float x,float y,float scale,u32 idx,u32 color);\r\n    static void _ext_CKLBUICanvas_fillRect(s32* p,float x,float y,float w,float h,u32 color);\r\n    static void _ext_CKLBUICanvas_startDynamicSection(s32* p,u32 idx);\r\n    static void _ext_CKLBUICanvas_endDynamicSection(s32* p,u32 idx);\r\n    static void _ext_CKLBUICanvas_dynamicSectionTranslate(s32* p,u32 idx,float deltaX,float deltaY);\r\n    static void _ext_CKLBUICanvas_dynamicSectionColor(s32* p,u32 idx,u32 color);\r\n    CKLBUICanvas(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 vertexMax,u32 indexMax,EnginePrototype::_Delegate_Base_CallBack_inner29* onDrawCallBack);\r\n    CKLBUICanvas();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction();\r\n    inline void callBackFunction$();\r\n    bool addResource(System::String* asset);\r\n    inline bool addResource$(System::String* asset);\r\n    void drawImage(float x,float y,u32 idx,u32 color);\r\n    inline void drawImage$(float x,float y,u32 idx,u32 color);\r\n    void drawImageScale(float x,float y,float scale,u32 idx,u32 color);\r\n    inline void drawImageScale$(float x,float y,float scale,u32 idx,u32 color);\r\n    void fillRect(float x,float y,float w,float h,u32 color);\r\n    inline void fillRect$(float x,float y,float w,float h,u32 color);\r\n    void startDynamicSection(u32 idx);\r\n    inline void startDynamicSection$(u32 idx);\r\n    void endDynamicSection(u32 idx);\r\n    inline void endDynamicSection$(u32 idx);\r\n    void dynamicSectionTranslate(u32 idx,float deltaX,float deltaY);\r\n    inline void dynamicSectionTranslate$(u32 idx,float deltaX,float deltaY);\r\n    void dynamicSectionColor(u32 idx,u32 color);\r\n    inline void dynamicSectionColor$(u32 idx,u32 color);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 166;\r\n};\r\nclass EnginePrototype::CKLBUIClip : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIClip();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline u32 _acc_gMaxOrder();\r\n    inline u32 _acc_gMaxOrder$();\r\n\r\n    inline u32 _acc_sMaxOrder(u32 value);\r\n    inline u32 _acc_sMaxOrder$(u32 value);\r\n    inline u32 _acc_sMaxOrderpostInc()\t\t\t{ u32 tmp; _acc_sMaxOrder((tmp = _acc_gMaxOrder())+1); return tmp; }\r\n    inline u32 _acc_sMaxOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sMaxOrderpostInc(); }\r\n    inline u32 _acc_sMaxOrderpostDec()\t\t\t{ u32 tmp; _acc_sMaxOrder((tmp = _acc_gMaxOrder())-1); return tmp; }\r\n    inline u32 _acc_sMaxOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sMaxOrderpostDec(); }\r\n    inline u32 _acc_sMaxOrderpreInc()\t\t\t{ return _acc_sMaxOrder(_acc_gMaxOrder()+1); }\r\n    inline u32 _acc_sMaxOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sMaxOrderpreInc(); }\r\n    inline u32 _acc_sMaxOrderpreDec()\t\t\t{ return _acc_sMaxOrder(_acc_gMaxOrder()-1); }\r\n    inline u32 _acc_sMaxOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sMaxOrderpreDec(); }\r\n    inline u32 _acc_sMaxOrderAddEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() + value); }\r\n    inline u32 _acc_sMaxOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderAddEq(value); }\r\n    inline u32 _acc_sMaxOrderSubEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() - value); }\r\n    inline u32 _acc_sMaxOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderSubEq(value); }\r\n    inline u32 _acc_sMaxOrderMulEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() * value); }\r\n    inline u32 _acc_sMaxOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderMulEq(value); }\r\n    inline u32 _acc_sMaxOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxOrder(_acc_gMaxOrder() / value); }\r\n    inline u32 _acc_sMaxOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderDivEq(value); }\r\n    inline u32 _acc_sMaxOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxOrder(_acc_gMaxOrder() % value); }\r\n    inline u32 _acc_sMaxOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderModEq(value); }\r\n    inline u32 _acc_sMaxOrderXorEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() ^ value); }\r\n    inline u32 _acc_sMaxOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderXorEq(value); }\r\n    inline u32 _acc_sMaxOrderAndEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() & value); }\r\n    inline u32 _acc_sMaxOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderAndEq(value); }\r\n    inline u32 _acc_sMaxOrderOrEq(u32 value)\t\t{ return _acc_sMaxOrder(_acc_gMaxOrder() | value); }\r\n    inline u32 _acc_sMaxOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderOrEq(value); }\r\n    inline u32 _acc_sMaxOrderRShiftEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() >> value); }\r\n    inline u32 _acc_sMaxOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderRShiftEq(value); }\r\n    inline u32 _acc_sMaxOrderLShiftEq(u32 value)\t{ return _acc_sMaxOrder(_acc_gMaxOrder() << value); }\r\n    inline u32 _acc_sMaxOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxOrderLShiftEq(value); }\r\n    inline float _acc_gWidth();\r\n    inline float _acc_gWidth$();\r\n\r\n    inline float _acc_sWidth(float value);\r\n    inline float _acc_sWidth$(float value);\r\n    inline float _acc_sWidthpostInc()\t\t\t{ float tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline float _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline float _acc_sWidthpostDec()\t\t\t{ float tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline float _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline float _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline float _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline float _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline float _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline float _acc_sWidthAddEq(float value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline float _acc_sWidth$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline float _acc_sWidthSubEq(float value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline float _acc_sWidth$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline float _acc_sWidthMulEq(float value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline float _acc_sWidth$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline float _acc_sWidthDivEq(float value)\t{ return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline float _acc_sWidth$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline float _acc_sWidthModEq(float value)\t{  float orig = _acc_gWidth(); s32 tmp = (s32)(orig / value); return _acc_sWidth(orig - (tmp * value)); }\r\n    inline float _acc_sWidth$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline float _acc_gHeight();\r\n    inline float _acc_gHeight$();\r\n\r\n    inline float _acc_sHeight(float value);\r\n    inline float _acc_sHeight$(float value);\r\n    inline float _acc_sHeightpostInc()\t\t\t{ float tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline float _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline float _acc_sHeightpostDec()\t\t\t{ float tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline float _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline float _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline float _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline float _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline float _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline float _acc_sHeightAddEq(float value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline float _acc_sHeight$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline float _acc_sHeightSubEq(float value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline float _acc_sHeight$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline float _acc_sHeightMulEq(float value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline float _acc_sHeight$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline float _acc_sHeightDivEq(float value)\t{ return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline float _acc_sHeight$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline float _acc_sHeightModEq(float value)\t{  float orig = _acc_gHeight(); s32 tmp = (s32)(orig / value); return _acc_sHeight(orig - (tmp * value)); }\r\n    inline float _acc_sHeight$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    static s32* _ext_CKLBUIClip_create(s32* pParent,u32 baseOrder,u32 maxOrder,float x,float y,float clipWidth,float clipHeight);\r\n    static u32 _ext_CKLBUIClip_getOrder(s32* p);\r\n    static void _ext_CKLBUIClip_setOrder(s32* p,u32 order);\r\n    static u32 _ext_CKLBUIClip_getMaxOdr(s32* p);\r\n    static void _ext_CKLBUIClip_setMaxOdr(s32* p,u32 maxodr);\r\n    static float _ext_CKLBUIClip_getWidth(s32* p);\r\n    static void _ext_CKLBUIClip_setWidth(s32* p,float width);\r\n    static float _ext_CKLBUIClip_getHeight(s32* p);\r\n    static void _ext_CKLBUIClip_setHeight(s32* p,float height);\r\n    static void _ext_CKLBUIClip_setPosition(s32* p,float x,float y);\r\n    static void _ext_CKLBUIClip_setSize(s32* p,float width,float height);\r\n    CKLBUIClip(EnginePrototype::CKLBUITask* parent,u32 baseOrder,u32 maxOrder,float x,float y,float clipWidth,float clipHeight);\r\n    CKLBUIClip();\r\n    void getSize(EnginePrototype::FSize& size);\r\n    inline void getSize$(EnginePrototype::FSize& size);\r\n    void setSize(EnginePrototype::FSize size);\r\n    inline void setSize$(EnginePrototype::FSize size);\r\n    void setSize(float width,float height);\r\n    inline void setSize$(float width,float height);\r\n    void setPosition(float x,float y);\r\n    inline void setPosition$(float x,float y);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 169;\r\n};\r\nclass EnginePrototype::CKLBUIControl : public EnginePrototype::CKLBUITask {\r\nfriend class OnClickCallBack_inner30;\r\nfriend class OnDblClickCallBack_inner31;\r\nfriend class OnDragCallBack_inner32;\r\nfriend class OnPinchCallBack_inner33;\r\nfriend class OnLongTapCallBack_inner34;\r\n\r\npublic:\r\n    enum EMODE {\r\n        TAP,\r\n        DRAG,\r\n        RELEASE,\r\n        _ForceWORD_EMODE = 0x7FFFFFFF\r\n    };\r\n\r\n    enum EMASK {\r\n        MASK_CLICK = 1,\r\n        MASK_DRAG = 2,\r\n        MASK_PINCH = 4,\r\n        MASK_DBLCLICK = 8,\r\n        MASK_LONGTAP = 16,\r\n        _ForceWORD_EMASK = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUIControl();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* m_onDragCallBack;\r\n    inline EnginePrototype::_Delegate_Base_OnDragCallBack_inner32*& _gm_onDragCallBack$() { CHCKTHIS; return m_onDragCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* _sm_onDragCallBack(EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* _$value);\r\n    inline EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* _sm_onDragCallBack$(EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* m_onPinchCallBack;\r\n    inline EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33*& _gm_onPinchCallBack$() { CHCKTHIS; return m_onPinchCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* _sm_onPinchCallBack(EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* _$value);\r\n    inline EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* _sm_onPinchCallBack$(EnginePrototype::_Delegate_Base_OnPinchCallBack_inner33* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* m_onClickCallBack;\r\n    inline EnginePrototype::_Delegate_Base_OnClickCallBack_inner30*& _gm_onClickCallBack$() { CHCKTHIS; return m_onClickCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* _sm_onClickCallBack(EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* _$value);\r\n    inline EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* _sm_onClickCallBack$(EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* m_onDblClickCallBack;\r\n    inline EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31*& _gm_onDblClickCallBack$() { CHCKTHIS; return m_onDblClickCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* _sm_onDblClickCallBack(EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* _$value);\r\n    inline EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* _sm_onDblClickCallBack$(EnginePrototype::_Delegate_Base_OnDblClickCallBack_inner31* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* m_onLongTapCallBack;\r\n    inline EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34*& _gm_onLongTapCallBack$() { CHCKTHIS; return m_onLongTapCallBack; }\r\n    inline EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* _sm_onLongTapCallBack(EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* _$value);\r\n    inline EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* _sm_onLongTapCallBack$(EnginePrototype::_Delegate_Base_OnLongTapCallBack_inner34* _$value);\r\n\r\n    static s32* _ext_CKLBUIControl_create(s32* pParent);\r\n    static bool _ext_CKLBUIControl_setGroup(s32* p,s32* groupName);\r\n    static void _ext_CKLBUIControl_setMask(s32* p,u16 mask);\r\n    static void _ext_CKLBUIControl_lock(s32* p,bool lockMode);\r\n    CKLBUIControl(EnginePrototype::CKLBTask* parent,EnginePrototype::_Delegate_Base_OnClickCallBack_inner30* onClickCallBack,EnginePrototype::_Delegate_Base_OnDragCallBack_inner32* onDragCallBack);\r\n    CKLBUIControl();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void onClickCallBackFunction(s32 x,s32 y);\r\n    inline void onClickCallBackFunction$(s32 x,s32 y);\r\n    virtual void onDragCallBackFunction(u32 mode,s32 x,s32 y,s32 mvX,s32 mvY);\r\n    inline void onDragCallBackFunction$(u32 mode,s32 x,s32 y,s32 mvX,s32 mvY);\r\n    virtual void onPinchCallBackFunction(u32 mode,float pinch,float rotation);\r\n    inline void onPinchCallBackFunction$(u32 mode,float pinch,float rotation);\r\n    virtual void onDblClickCallBackFunction(s32 x,s32 y);\r\n    inline void onDblClickCallBackFunction$(s32 x,s32 y);\r\n    virtual void onLongTapCallBackFunction(u32 elapsedTime,s32 x,s32 y);\r\n    inline void onLongTapCallBackFunction$(u32 elapsedTime,s32 x,s32 y);\r\n    bool setGroup(System::String* groupName);\r\n    inline bool setGroup$(System::String* groupName);\r\n    void setMask(s32 mask);\r\n    inline void setMask$(s32 mask);\r\n    void setLock(bool lockBool);\r\n    inline void setLock$(bool lockBool);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 170;\r\n};\r\nclass EnginePrototype::CKLBUIDebugItem : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner35;\r\n\r\npublic:\r\n    void _ctor_CKLBUIDebugItem();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner35* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner35*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner35* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner35* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner35* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner35* _$value);\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline System::String* _acc_gFont();\r\n    inline System::String* _acc_gFont$();\r\n\r\n    inline System::String* _acc_sFont(System::String* value);\r\n    inline System::String* _acc_sFont$(System::String* value);\r\n    inline u32 _acc_gSize();\r\n    inline u32 _acc_gSize$();\r\n\r\n    inline u32 _acc_sSize(u32 value);\r\n    inline u32 _acc_sSize$(u32 value);\r\n    inline u32 _acc_sSizepostInc()\t\t\t{ u32 tmp; _acc_sSize((tmp = _acc_gSize())+1); return tmp; }\r\n    inline u32 _acc_sSize$postInc()\t\t\t{ CHCKTHIS; return _acc_sSizepostInc(); }\r\n    inline u32 _acc_sSizepostDec()\t\t\t{ u32 tmp; _acc_sSize((tmp = _acc_gSize())-1); return tmp; }\r\n    inline u32 _acc_sSize$postDec()\t\t\t{ CHCKTHIS; return _acc_sSizepostDec(); }\r\n    inline u32 _acc_sSizepreInc()\t\t\t{ return _acc_sSize(_acc_gSize()+1); }\r\n    inline u32 _acc_sSize$preInc()\t\t\t{ CHCKTHIS; return _acc_sSizepreInc(); }\r\n    inline u32 _acc_sSizepreDec()\t\t\t{ return _acc_sSize(_acc_gSize()-1); }\r\n    inline u32 _acc_sSize$preDec()\t\t\t{ CHCKTHIS; return _acc_sSizepreDec(); }\r\n    inline u32 _acc_sSizeAddEq(u32 value)\t{ return _acc_sSize(_acc_gSize() + value); }\r\n    inline u32 _acc_sSize$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeAddEq(value); }\r\n    inline u32 _acc_sSizeSubEq(u32 value)\t{ return _acc_sSize(_acc_gSize() - value); }\r\n    inline u32 _acc_sSize$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeSubEq(value); }\r\n    inline u32 _acc_sSizeMulEq(u32 value)\t{ return _acc_sSize(_acc_gSize() * value); }\r\n    inline u32 _acc_sSize$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeMulEq(value); }\r\n    inline u32 _acc_sSizeDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSize(_acc_gSize() / value); }\r\n    inline u32 _acc_sSize$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeDivEq(value); }\r\n    inline u32 _acc_sSizeModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSize(_acc_gSize() % value); }\r\n    inline u32 _acc_sSize$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeModEq(value); }\r\n    inline u32 _acc_sSizeXorEq(u32 value)\t{ return _acc_sSize(_acc_gSize() ^ value); }\r\n    inline u32 _acc_sSize$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeXorEq(value); }\r\n    inline u32 _acc_sSizeAndEq(u32 value)\t{ return _acc_sSize(_acc_gSize() & value); }\r\n    inline u32 _acc_sSize$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeAndEq(value); }\r\n    inline u32 _acc_sSizeOrEq(u32 value)\t\t{ return _acc_sSize(_acc_gSize() | value); }\r\n    inline u32 _acc_sSize$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeOrEq(value); }\r\n    inline u32 _acc_sSizeRShiftEq(u32 value)\t{ return _acc_sSize(_acc_gSize() >> value); }\r\n    inline u32 _acc_sSize$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeRShiftEq(value); }\r\n    inline u32 _acc_sSizeLShiftEq(u32 value)\t{ return _acc_sSize(_acc_gSize() << value); }\r\n    inline u32 _acc_sSize$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sSizeLShiftEq(value); }\r\n    inline u32 _acc_gTextArgb();\r\n    inline u32 _acc_gTextArgb$();\r\n\r\n    inline u32 _acc_sTextArgb(u32 value);\r\n    inline u32 _acc_sTextArgb$(u32 value);\r\n    inline u32 _acc_sTextArgbpostInc()\t\t\t{ u32 tmp; _acc_sTextArgb((tmp = _acc_gTextArgb())+1); return tmp; }\r\n    inline u32 _acc_sTextArgb$postInc()\t\t\t{ CHCKTHIS; return _acc_sTextArgbpostInc(); }\r\n    inline u32 _acc_sTextArgbpostDec()\t\t\t{ u32 tmp; _acc_sTextArgb((tmp = _acc_gTextArgb())-1); return tmp; }\r\n    inline u32 _acc_sTextArgb$postDec()\t\t\t{ CHCKTHIS; return _acc_sTextArgbpostDec(); }\r\n    inline u32 _acc_sTextArgbpreInc()\t\t\t{ return _acc_sTextArgb(_acc_gTextArgb()+1); }\r\n    inline u32 _acc_sTextArgb$preInc()\t\t\t{ CHCKTHIS; return _acc_sTextArgbpreInc(); }\r\n    inline u32 _acc_sTextArgbpreDec()\t\t\t{ return _acc_sTextArgb(_acc_gTextArgb()-1); }\r\n    inline u32 _acc_sTextArgb$preDec()\t\t\t{ CHCKTHIS; return _acc_sTextArgbpreDec(); }\r\n    inline u32 _acc_sTextArgbAddEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() + value); }\r\n    inline u32 _acc_sTextArgb$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbAddEq(value); }\r\n    inline u32 _acc_sTextArgbSubEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() - value); }\r\n    inline u32 _acc_sTextArgb$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbSubEq(value); }\r\n    inline u32 _acc_sTextArgbMulEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() * value); }\r\n    inline u32 _acc_sTextArgb$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbMulEq(value); }\r\n    inline u32 _acc_sTextArgbDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sTextArgb(_acc_gTextArgb() / value); }\r\n    inline u32 _acc_sTextArgb$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbDivEq(value); }\r\n    inline u32 _acc_sTextArgbModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sTextArgb(_acc_gTextArgb() % value); }\r\n    inline u32 _acc_sTextArgb$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbModEq(value); }\r\n    inline u32 _acc_sTextArgbXorEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() ^ value); }\r\n    inline u32 _acc_sTextArgb$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbXorEq(value); }\r\n    inline u32 _acc_sTextArgbAndEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() & value); }\r\n    inline u32 _acc_sTextArgb$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbAndEq(value); }\r\n    inline u32 _acc_sTextArgbOrEq(u32 value)\t\t{ return _acc_sTextArgb(_acc_gTextArgb() | value); }\r\n    inline u32 _acc_sTextArgb$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbOrEq(value); }\r\n    inline u32 _acc_sTextArgbRShiftEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() >> value); }\r\n    inline u32 _acc_sTextArgb$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbRShiftEq(value); }\r\n    inline u32 _acc_sTextArgbLShiftEq(u32 value)\t{ return _acc_sTextArgb(_acc_gTextArgb() << value); }\r\n    inline u32 _acc_sTextArgb$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTextArgbLShiftEq(value); }\r\n    inline System::String* _acc_gText();\r\n    inline System::String* _acc_gText$();\r\n\r\n    inline System::String* _acc_sText(System::String* value);\r\n    inline System::String* _acc_sText$(System::String* value);\r\n    static s32* _ext_CKLBUIDebugItem_create(s32* pParent,u32 order,float x,float y,u32 argb,s32* font,u32 size,s32* text,u32 id);\r\n    static u32 _ext_CKLBUIDebugItem_getOrder(s32* p);\r\n    static void _ext_CKLBUIDebugItem_setOrder(s32* p,u32 order);\r\n    static u32 _ext_CKLBUIDebugItem_getColor(s32* p);\r\n    static void _ext_CKLBUIDebugItem_setColor(s32* p,u32 order);\r\n    static s32* _ext_CKLBUIDebugItem_getFont(s32* p);\r\n    static void _ext_CKLBUIDebugItem_setFont(s32* p,s32* font);\r\n    static u32 _ext_CKLBUIDebugItem_getSize(s32* p);\r\n    static void _ext_CKLBUIDebugItem_setSize(s32* p,u32 order);\r\n    static s32* _ext_CKLBUIDebugItem_getText(s32* p);\r\n    static void _ext_CKLBUIDebugItem_setText(s32* p,s32* text);\r\n    CKLBUIDebugItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 argb,System::String* font_name,u32 font_size,System::String* text,u32 cmdID,EnginePrototype::_Delegate_Base_CallBack_inner35* callback);\r\n    CKLBUIDebugItem();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 cmdID);\r\n    inline void callBackFunction$(u32 cmdID);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 183;\r\n};\r\nclass EnginePrototype::CKLBUIDragIcon : public EnginePrototype::CKLBUITask {\r\nfriend struct Area_inner3;\r\nfriend class CallBack_inner36;\r\n\r\npublic:\r\n    enum ESTEP {\r\n        DRAG,\r\n        RELEASE,\r\n        _ForceWORD_ESTEP = 0x7FFFFFFF\r\n    };\r\n\r\n    enum EFLAGS {\r\n        F_DICON_BASEINVISIBLE = 4,\r\n        _ForceWORD_EFLAGS = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUIDragIcon();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner36* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner36*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner36* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner36* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner36* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner36* _$value);\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    inline System::String* _acc_gDragAsset();\r\n    inline System::String* _acc_gDragAsset$();\r\n\r\n    inline s32 _acc_gFlags();\r\n    inline s32 _acc_gFlags$();\r\n\r\n    inline s32 _acc_sFlags(s32 value);\r\n    inline s32 _acc_sFlags$(s32 value);\r\n    inline s32 _acc_sFlagspostInc()\t\t\t{ s32 tmp = _acc_gFlags(); _acc_sFlags((s32)((s32)tmp + 1)); return tmp; }\r\n    inline s32 _acc_sFlags$postInc()\t\t\t{ CHCKTHIS; return _acc_sFlagspostInc(); }\r\n    inline s32 _acc_sFlagspostDec()\t\t\t{ s32 tmp = _acc_gFlags(); _acc_sFlags((s32)((s32)tmp - 1)); return tmp; }\r\n    inline s32 _acc_sFlags$postDec()\t\t\t{ CHCKTHIS; return _acc_sFlagspostDec(); }\r\n    inline s32 _acc_sFlagspreInc()\t\t\t{ return _acc_sFlags((s32)((s32)_acc_gFlags()+1)); }\r\n    inline s32 _acc_sFlags$preInc()\t\t\t{ CHCKTHIS; return _acc_sFlagspreInc(); }\r\n    inline s32 _acc_sFlagspreDec()\t\t\t{ return _acc_sFlags((s32)((s32)_acc_gFlags()-1)); }\r\n    inline s32 _acc_sFlags$preDec()\t\t\t{ CHCKTHIS; return _acc_sFlagspreDec(); }\r\n    inline s32 _acc_sFlagsAddEq(s32 value)\t{ return _acc_sFlags((s32)((s32)_acc_gFlags() + value)); }\r\n    inline s32 _acc_sFlags$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sFlagsAddEq(value); }\r\n    inline s32 _acc_sFlagsSubEq(s32 value)\t{ return _acc_sFlags((s32)((s32)_acc_gFlags() - value)); }\r\n    inline s32 _acc_sFlags$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sFlagsSubEq(value); }\r\n    inline float _acc_gDragScaleX();\r\n    inline float _acc_gDragScaleX$();\r\n\r\n    inline float _acc_sDragScaleX(float value);\r\n    inline float _acc_sDragScaleX$(float value);\r\n    inline float _acc_sDragScaleXpostInc()\t\t\t{ float tmp; _acc_sDragScaleX((tmp = _acc_gDragScaleX())+1); return tmp; }\r\n    inline float _acc_sDragScaleX$postInc()\t\t\t{ CHCKTHIS; return _acc_sDragScaleXpostInc(); }\r\n    inline float _acc_sDragScaleXpostDec()\t\t\t{ float tmp; _acc_sDragScaleX((tmp = _acc_gDragScaleX())-1); return tmp; }\r\n    inline float _acc_sDragScaleX$postDec()\t\t\t{ CHCKTHIS; return _acc_sDragScaleXpostDec(); }\r\n    inline float _acc_sDragScaleXpreInc()\t\t\t{ return _acc_sDragScaleX(_acc_gDragScaleX()+1); }\r\n    inline float _acc_sDragScaleX$preInc()\t\t\t{ CHCKTHIS; return _acc_sDragScaleXpreInc(); }\r\n    inline float _acc_sDragScaleXpreDec()\t\t\t{ return _acc_sDragScaleX(_acc_gDragScaleX()-1); }\r\n    inline float _acc_sDragScaleX$preDec()\t\t\t{ CHCKTHIS; return _acc_sDragScaleXpreDec(); }\r\n    inline float _acc_sDragScaleXAddEq(float value)\t{ return _acc_sDragScaleX(_acc_gDragScaleX() + value); }\r\n    inline float _acc_sDragScaleX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleXAddEq(value); }\r\n    inline float _acc_sDragScaleXSubEq(float value)\t{ return _acc_sDragScaleX(_acc_gDragScaleX() - value); }\r\n    inline float _acc_sDragScaleX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleXSubEq(value); }\r\n    inline float _acc_sDragScaleXMulEq(float value)\t{ return _acc_sDragScaleX(_acc_gDragScaleX() * value); }\r\n    inline float _acc_sDragScaleX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleXMulEq(value); }\r\n    inline float _acc_sDragScaleXDivEq(float value)\t{ return _acc_sDragScaleX(_acc_gDragScaleX() / value); }\r\n    inline float _acc_sDragScaleX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleXDivEq(value); }\r\n    inline float _acc_sDragScaleXModEq(float value)\t{  float orig = _acc_gDragScaleX(); s32 tmp = (s32)(orig / value); return _acc_sDragScaleX(orig - (tmp * value)); }\r\n    inline float _acc_sDragScaleX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleXModEq(value); }\r\n    inline float _acc_gDragScaleY();\r\n    inline float _acc_gDragScaleY$();\r\n\r\n    inline float _acc_sDragScaleY(float value);\r\n    inline float _acc_sDragScaleY$(float value);\r\n    inline float _acc_sDragScaleYpostInc()\t\t\t{ float tmp; _acc_sDragScaleY((tmp = _acc_gDragScaleY())+1); return tmp; }\r\n    inline float _acc_sDragScaleY$postInc()\t\t\t{ CHCKTHIS; return _acc_sDragScaleYpostInc(); }\r\n    inline float _acc_sDragScaleYpostDec()\t\t\t{ float tmp; _acc_sDragScaleY((tmp = _acc_gDragScaleY())-1); return tmp; }\r\n    inline float _acc_sDragScaleY$postDec()\t\t\t{ CHCKTHIS; return _acc_sDragScaleYpostDec(); }\r\n    inline float _acc_sDragScaleYpreInc()\t\t\t{ return _acc_sDragScaleY(_acc_gDragScaleY()+1); }\r\n    inline float _acc_sDragScaleY$preInc()\t\t\t{ CHCKTHIS; return _acc_sDragScaleYpreInc(); }\r\n    inline float _acc_sDragScaleYpreDec()\t\t\t{ return _acc_sDragScaleY(_acc_gDragScaleY()-1); }\r\n    inline float _acc_sDragScaleY$preDec()\t\t\t{ CHCKTHIS; return _acc_sDragScaleYpreDec(); }\r\n    inline float _acc_sDragScaleYAddEq(float value)\t{ return _acc_sDragScaleY(_acc_gDragScaleY() + value); }\r\n    inline float _acc_sDragScaleY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleYAddEq(value); }\r\n    inline float _acc_sDragScaleYSubEq(float value)\t{ return _acc_sDragScaleY(_acc_gDragScaleY() - value); }\r\n    inline float _acc_sDragScaleY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleYSubEq(value); }\r\n    inline float _acc_sDragScaleYMulEq(float value)\t{ return _acc_sDragScaleY(_acc_gDragScaleY() * value); }\r\n    inline float _acc_sDragScaleY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleYMulEq(value); }\r\n    inline float _acc_sDragScaleYDivEq(float value)\t{ return _acc_sDragScaleY(_acc_gDragScaleY() / value); }\r\n    inline float _acc_sDragScaleY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleYDivEq(value); }\r\n    inline float _acc_sDragScaleYModEq(float value)\t{  float orig = _acc_gDragScaleY(); s32 tmp = (s32)(orig / value); return _acc_sDragScaleY(orig - (tmp * value)); }\r\n    inline float _acc_sDragScaleY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sDragScaleYModEq(value); }\r\n    inline bool _acc_gEnable();\r\n    inline bool _acc_gEnable$();\r\n\r\n    inline bool _acc_sEnable(bool value);\r\n    inline bool _acc_sEnable$(bool value);\r\n    static s32* _ext_CKLBUIDragIcon_create(s32* pParent,u32 order,float x,float y,EnginePrototype::Area_inner3& tap_area,s32* asset,s32* drag_asset,s32 drag_order_offset,float drag_alpha,float center_x,float center_y,u32 flags);\r\n    static u32 _ext_CKLBUIDragIcon_getOrder(s32* p);\r\n    static s32* _ext_CKLBUIDragIcon_getAsset(s32* p);\r\n    static s32* _ext_CKLBUIDragIcon_getDrag(s32* p);\r\n    static u32 _ext_CKLBUIDragIcon_getFlags(s32* p);\r\n    static void _ext_CKLBUIDragIcon_setFlags(s32* p,u32 flag);\r\n    static bool _ext_CKLBUIDragIcon_getEnable(s32* p);\r\n    static void _ext_CKLBUIDragIcon_setEnable(s32* p,bool enable);\r\n    static float _ext_CKLBUIDragIcon_getDragScaleX(s32* p);\r\n    static void _ext_CKLBUIDragIcon_setDragScaleX(s32* p,float x);\r\n    static float _ext_CKLBUIDragIcon_getDragScaleY(s32* p);\r\n    static void _ext_CKLBUIDragIcon_setDragScaleY(s32* p,float y);\r\n    static void _ext_CKLBUIDragIcon_dragArea(s32* p,EnginePrototype::Area_inner3& area);\r\n    CKLBUIDragIcon(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,EnginePrototype::Area_inner3& tap_area,System::String* asset,System::String* drag_asset,s32 drag_order_offset,float drag_alpha,float center_x,float center_y,EnginePrototype::_Delegate_Base_CallBack_inner36* callback,u32 flags);\r\n    CKLBUIDragIcon();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 type,s32 x,s32 y);\r\n    inline void callBackFunction$(u32 type,s32 x,s32 y);\r\n    void dragArea(EnginePrototype::Area_inner3 area);\r\n    inline void dragArea$(EnginePrototype::Area_inner3 area);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 186;\r\n};\r\nclass EnginePrototype::CKLBUIForm : public EnginePrototype::CKLBUITask {\r\nfriend class SelectableCallBack_inner37;\r\nfriend class AnimCallBack_inner38;\r\n\r\npublic:\r\n    void _ctor_CKLBUIForm();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* m_selectableCallback;\r\n    inline EnginePrototype::_Delegate_Base_SelectableCallBack_inner37*& _gm_selectableCallback$() { CHCKTHIS; return m_selectableCallback; }\r\n    inline EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* _sm_selectableCallback(EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* _$value);\r\n    inline EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* _sm_selectableCallback$(EnginePrototype::_Delegate_Base_SelectableCallBack_inner37* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_AnimCallBack_inner38* m_animCallback;\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner38*& _gm_animCallback$() { CHCKTHIS; return m_animCallback; }\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner38* _sm_animCallback(EnginePrototype::_Delegate_Base_AnimCallBack_inner38* _$value);\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner38* _sm_animCallback$(EnginePrototype::_Delegate_Base_AnimCallBack_inner38* _$value);\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    inline bool _acc_gIsFile();\r\n    inline bool _acc_gIsFile$();\r\n\r\n    inline bool _acc_gExclusive();\r\n    inline bool _acc_gExclusive$();\r\n\r\n    inline bool _acc_sExclusive(bool value);\r\n    inline bool _acc_sExclusive$(bool value);\r\n    static s32* _ext_CKLBUIForm_create(s32* pParent,u32 order,float x,float y,bool bAssetFile,s32* asset,bool bExclusive,bool modal,bool urgent);\r\n    static s32* _ext_CKLBUIForm_getAsset(s32* p);\r\n    static u32 _ext_CKLBUIForm_getOrder(s32* p);\r\n    static bool _ext_CKLBUIForm_getExclusive(s32* p);\r\n    static void _ext_CKLBUIForm_setExclusive(s32* p,bool exclusive);\r\n    static bool _ext_CKLBUIForm_getIsFile(s32* p);\r\n    static void _ext_CKLBUIForm_setEnable(s32* p,bool isEnabled);\r\n    static bool _ext_CKLBUIForm_existNode(s32* p,s32* name);\r\n    static void _ext_CKLBUIForm_inputEnable(s32* p,bool bEnable);\r\n    static bool _ext_CKLBUIForm_animation(s32* p,s32* animname,bool blend);\r\n    static bool _ext_CKLBUIForm_animEnter(s32* p);\r\n    static bool _ext_CKLBUIForm_animLeave(s32* p);\r\n    static bool _ext_CKLBUIForm_isAnim(s32* p,s32* name);\r\n    static bool _ext_CKLBUIForm_skipAnim(s32* p,s32* name);\r\n    static bool _ext_CKLBUIForm_setGroup(s32* p,s32* groupName);\r\n    static void _ext_CKLBUIForm_setGlobalVolume(s32* p,float volume);\r\n    CKLBUIForm(EnginePrototype::CKLBUITask* parent,u32 order,s32 x,s32 y,bool assetFile,System::String* asset_name,bool bExclusive,bool modal,bool urgent);\r\n    CKLBUIForm();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void animCallBackFunction(s32* name,u32 id);\r\n    inline void animCallBackFunction$(s32* name,u32 id);\r\n    virtual void selectableCallbackFunction(s32* name,s32 type,s32 param);\r\n    inline void selectableCallbackFunction$(s32* name,s32 type,s32 param);\r\n    void setEnabled(bool isEnabled);\r\n    inline void setEnabled$(bool isEnabled);\r\n    bool existNode(System::String* name);\r\n    inline bool existNode$(System::String* name);\r\n    void inputEnable(bool bEnable);\r\n    inline void inputEnable$(bool bEnable);\r\n    bool animation(System::String* animationName,bool blend);\r\n    inline bool animation$(System::String* animationName,bool blend);\r\n    bool isRunningAnimation(System::String* animationName);\r\n    inline bool isRunningAnimation$(System::String* animationName);\r\n    bool skipAnim(System::String* animationName);\r\n    inline bool skipAnim$(System::String* animationName);\r\n    bool animEnter();\r\n    inline bool animEnter$();\r\n    bool animLeave();\r\n    inline bool animLeave$();\r\n    bool setGroup(System::String* groupName);\r\n    inline bool setGroup$(System::String* groupName);\r\n    void setGlobalVolume(float volume);\r\n    inline void setGlobalVolume$(float volume);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 193;\r\n};\r\nclass EnginePrototype::CKLBUIFreeVertItem : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIFreeVertItem();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    static s32* _ext_CKLBUIFreeVertItem_create(s32* parent,u32 order,float x,float y,s32* asset,System::Array<float>* verticesArray);\r\n    static u32 _ext_CKLBUIFreeVertItem_getOrder(s32* p);\r\n    static void _ext_CKLBUIFreeVertItem_setOrder(s32* p,u32 order);\r\n    static s32* _ext_CKLBUIFreeVertItem_getAsset(s32* p);\r\n    static void _ext_CKLBUIFreeVertItem_setVertices(s32* p,System::Array<float>* coord);\r\n    static void _ext_CKLBUIFreeVertItem_setColors(s32* p,System::Array<u32>* colors);\r\n    static void _ext_CKLBUIFreeVertItem_setVertCol(s32* p,s32 idx,u32 argb);\r\n    static void _ext_CKLBUIFreeVertItem_setUV(s32* p,System::Array<float>* uv);\r\n    CKLBUIFreeVertItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::String* asset,System::Array<float>* verticesArray);\r\n    CKLBUIFreeVertItem();\r\n    void setVertices(System::Array<float>* coords);\r\n    inline void setVertices$(System::Array<float>* coords);\r\n    void setColors(System::Array<u32>* colors);\r\n    inline void setColors$(System::Array<u32>* colors);\r\n    void setVertCol(s32 idx,u32 argb);\r\n    inline void setVertCol$(s32 idx,u32 argb);\r\n    void setUv(System::Array<float>* uv);\r\n    inline void setUv$(System::Array<float>* uv);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 198;\r\n};\r\nclass EnginePrototype::CKLBUIGroup : public EnginePrototype::CKLBUITask {\r\nfriend class AnimCallBack_inner39;\r\n\r\npublic:\r\n    void _ctor_CKLBUIGroup();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_AnimCallBack_inner39* m_animCallback;\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner39*& _gm_animCallback$() { CHCKTHIS; return m_animCallback; }\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner39* _sm_animCallback(EnginePrototype::_Delegate_Base_AnimCallBack_inner39* _$value);\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner39* _sm_animCallback$(EnginePrototype::_Delegate_Base_AnimCallBack_inner39* _$value);\r\n\r\n    static s32* _ext_CKLBUIGroup_create(s32* parent,float x,float y);\r\n    static bool _ext_CKLBUIGroup_setAnimCallback(s32* p,s32* callback);\r\n    static bool _ext_CKLBUIGroup_setAnimation(s32* p,s32* anim_name,bool blend);\r\n    static bool _ext_CKLBUIGroup_isAnim(s32* p,s32* anim_name);\r\n    static bool _ext_CKLBUIGroup_skipAnim(s32* p,s32* anim_name);\r\n    CKLBUIGroup(EnginePrototype::CKLBUITask* parent,float x,float y);\r\n    CKLBUIGroup();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void animCallBackFunction(s32* name,u32 id);\r\n    inline void animCallBackFunction$(s32* name,u32 id);\r\n    bool setAnimation(System::String* animationName,bool blendFlag);\r\n    inline bool setAnimation$(System::String* animationName,bool blendFlag);\r\n    bool isRunningAnimation(System::String* animationName);\r\n    inline bool isRunningAnimation$(System::String* animationName);\r\n    bool skipAnim(System::String* animationName);\r\n    inline bool skipAnim$(System::String* animationName);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 199;\r\n};\r\nclass EnginePrototype::CKLBUILabel : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    enum EALIGN {\r\n        MID = 5,\r\n        TOP_LEFT = 10,\r\n        TOP = 9,\r\n        TOP_RIGHT = 8,\r\n        LEFT = 6,\r\n        RIGHT = 4,\r\n        BOTTOM_LEFT = 2,\r\n        BOTTOM = 1,\r\n        BOTTOM_RIGHT = 0,\r\n        _ForceWORD_EALIGN = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUILabel();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline System::String* _acc_gFontName();\r\n    inline System::String* _acc_gFontName$();\r\n\r\n    inline System::String* _acc_sFontName(System::String* value);\r\n    inline System::String* _acc_sFontName$(System::String* value);\r\n    inline u32 _acc_gFontSize();\r\n    inline u32 _acc_gFontSize$();\r\n\r\n    inline u32 _acc_sFontSize(u32 value);\r\n    inline u32 _acc_sFontSize$(u32 value);\r\n    inline u32 _acc_sFontSizepostInc()\t\t\t{ u32 tmp; _acc_sFontSize((tmp = _acc_gFontSize())+1); return tmp; }\r\n    inline u32 _acc_sFontSize$postInc()\t\t\t{ CHCKTHIS; return _acc_sFontSizepostInc(); }\r\n    inline u32 _acc_sFontSizepostDec()\t\t\t{ u32 tmp; _acc_sFontSize((tmp = _acc_gFontSize())-1); return tmp; }\r\n    inline u32 _acc_sFontSize$postDec()\t\t\t{ CHCKTHIS; return _acc_sFontSizepostDec(); }\r\n    inline u32 _acc_sFontSizepreInc()\t\t\t{ return _acc_sFontSize(_acc_gFontSize()+1); }\r\n    inline u32 _acc_sFontSize$preInc()\t\t\t{ CHCKTHIS; return _acc_sFontSizepreInc(); }\r\n    inline u32 _acc_sFontSizepreDec()\t\t\t{ return _acc_sFontSize(_acc_gFontSize()-1); }\r\n    inline u32 _acc_sFontSize$preDec()\t\t\t{ CHCKTHIS; return _acc_sFontSizepreDec(); }\r\n    inline u32 _acc_sFontSizeAddEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() + value); }\r\n    inline u32 _acc_sFontSize$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeAddEq(value); }\r\n    inline u32 _acc_sFontSizeSubEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() - value); }\r\n    inline u32 _acc_sFontSize$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeSubEq(value); }\r\n    inline u32 _acc_sFontSizeMulEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() * value); }\r\n    inline u32 _acc_sFontSize$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeMulEq(value); }\r\n    inline u32 _acc_sFontSizeDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sFontSize(_acc_gFontSize() / value); }\r\n    inline u32 _acc_sFontSize$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeDivEq(value); }\r\n    inline u32 _acc_sFontSizeModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sFontSize(_acc_gFontSize() % value); }\r\n    inline u32 _acc_sFontSize$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeModEq(value); }\r\n    inline u32 _acc_sFontSizeXorEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() ^ value); }\r\n    inline u32 _acc_sFontSize$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeXorEq(value); }\r\n    inline u32 _acc_sFontSizeAndEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() & value); }\r\n    inline u32 _acc_sFontSize$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeAndEq(value); }\r\n    inline u32 _acc_sFontSizeOrEq(u32 value)\t\t{ return _acc_sFontSize(_acc_gFontSize() | value); }\r\n    inline u32 _acc_sFontSize$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeOrEq(value); }\r\n    inline u32 _acc_sFontSizeRShiftEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() >> value); }\r\n    inline u32 _acc_sFontSize$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeRShiftEq(value); }\r\n    inline u32 _acc_sFontSizeLShiftEq(u32 value)\t{ return _acc_sFontSize(_acc_gFontSize() << value); }\r\n    inline u32 _acc_sFontSize$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFontSizeLShiftEq(value); }\r\n    inline u32 _acc_gTxtArgb();\r\n    inline u32 _acc_gTxtArgb$();\r\n\r\n    inline u32 _acc_sTxtArgb(u32 value);\r\n    inline u32 _acc_sTxtArgb$(u32 value);\r\n    inline u32 _acc_sTxtArgbpostInc()\t\t\t{ u32 tmp; _acc_sTxtArgb((tmp = _acc_gTxtArgb())+1); return tmp; }\r\n    inline u32 _acc_sTxtArgb$postInc()\t\t\t{ CHCKTHIS; return _acc_sTxtArgbpostInc(); }\r\n    inline u32 _acc_sTxtArgbpostDec()\t\t\t{ u32 tmp; _acc_sTxtArgb((tmp = _acc_gTxtArgb())-1); return tmp; }\r\n    inline u32 _acc_sTxtArgb$postDec()\t\t\t{ CHCKTHIS; return _acc_sTxtArgbpostDec(); }\r\n    inline u32 _acc_sTxtArgbpreInc()\t\t\t{ return _acc_sTxtArgb(_acc_gTxtArgb()+1); }\r\n    inline u32 _acc_sTxtArgb$preInc()\t\t\t{ CHCKTHIS; return _acc_sTxtArgbpreInc(); }\r\n    inline u32 _acc_sTxtArgbpreDec()\t\t\t{ return _acc_sTxtArgb(_acc_gTxtArgb()-1); }\r\n    inline u32 _acc_sTxtArgb$preDec()\t\t\t{ CHCKTHIS; return _acc_sTxtArgbpreDec(); }\r\n    inline u32 _acc_sTxtArgbAddEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() + value); }\r\n    inline u32 _acc_sTxtArgb$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbAddEq(value); }\r\n    inline u32 _acc_sTxtArgbSubEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() - value); }\r\n    inline u32 _acc_sTxtArgb$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbSubEq(value); }\r\n    inline u32 _acc_sTxtArgbMulEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() * value); }\r\n    inline u32 _acc_sTxtArgb$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbMulEq(value); }\r\n    inline u32 _acc_sTxtArgbDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sTxtArgb(_acc_gTxtArgb() / value); }\r\n    inline u32 _acc_sTxtArgb$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbDivEq(value); }\r\n    inline u32 _acc_sTxtArgbModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sTxtArgb(_acc_gTxtArgb() % value); }\r\n    inline u32 _acc_sTxtArgb$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbModEq(value); }\r\n    inline u32 _acc_sTxtArgbXorEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() ^ value); }\r\n    inline u32 _acc_sTxtArgb$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbXorEq(value); }\r\n    inline u32 _acc_sTxtArgbAndEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() & value); }\r\n    inline u32 _acc_sTxtArgb$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbAndEq(value); }\r\n    inline u32 _acc_sTxtArgbOrEq(u32 value)\t\t{ return _acc_sTxtArgb(_acc_gTxtArgb() | value); }\r\n    inline u32 _acc_sTxtArgb$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbOrEq(value); }\r\n    inline u32 _acc_sTxtArgbRShiftEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() >> value); }\r\n    inline u32 _acc_sTxtArgb$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbRShiftEq(value); }\r\n    inline u32 _acc_sTxtArgbLShiftEq(u32 value)\t{ return _acc_sTxtArgb(_acc_gTxtArgb() << value); }\r\n    inline u32 _acc_sTxtArgb$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sTxtArgbLShiftEq(value); }\r\n    inline System::String* _acc_gText();\r\n    inline System::String* _acc_gText$();\r\n\r\n    inline System::String* _acc_sText(System::String* value);\r\n    inline System::String* _acc_sText$(System::String* value);\r\n    inline s32 _acc_gAlign();\r\n    inline s32 _acc_gAlign$();\r\n\r\n    inline s32 _acc_sAlign(s32 value);\r\n    inline s32 _acc_sAlign$(s32 value);\r\n    inline s32 _acc_sAlignpostInc()\t\t\t{ s32 tmp = _acc_gAlign(); _acc_sAlign((s32)((s32)tmp + 1)); return tmp; }\r\n    inline s32 _acc_sAlign$postInc()\t\t\t{ CHCKTHIS; return _acc_sAlignpostInc(); }\r\n    inline s32 _acc_sAlignpostDec()\t\t\t{ s32 tmp = _acc_gAlign(); _acc_sAlign((s32)((s32)tmp - 1)); return tmp; }\r\n    inline s32 _acc_sAlign$postDec()\t\t\t{ CHCKTHIS; return _acc_sAlignpostDec(); }\r\n    inline s32 _acc_sAlignpreInc()\t\t\t{ return _acc_sAlign((s32)((s32)_acc_gAlign()+1)); }\r\n    inline s32 _acc_sAlign$preInc()\t\t\t{ CHCKTHIS; return _acc_sAlignpreInc(); }\r\n    inline s32 _acc_sAlignpreDec()\t\t\t{ return _acc_sAlign((s32)((s32)_acc_gAlign()-1)); }\r\n    inline s32 _acc_sAlign$preDec()\t\t\t{ CHCKTHIS; return _acc_sAlignpreDec(); }\r\n    inline s32 _acc_sAlignAddEq(s32 value)\t{ return _acc_sAlign((s32)((s32)_acc_gAlign() + value)); }\r\n    inline s32 _acc_sAlign$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sAlignAddEq(value); }\r\n    inline s32 _acc_sAlignSubEq(s32 value)\t{ return _acc_sAlign((s32)((s32)_acc_gAlign() - value)); }\r\n    inline s32 _acc_sAlign$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sAlignSubEq(value); }\r\n    static s32* _ext_CKLBUILabel_create(s32* pParent,u32 order,float x,float y,u32 argb,s32* font,u32 size,s32* text,u32 align);\r\n    static u32 _ext_CKLBUILabel_getOrder(s32* p);\r\n    static void _ext_CKLBUILabel_setOrder(s32* p,u32 order);\r\n    static u32 _ext_CKLBUILabel_getAlign(s32* p);\r\n    static void _ext_CKLBUILabel_setAlign(s32* p,u32 align);\r\n    static s32* _ext_CKLBUILabel_getText(s32* p);\r\n    static void _ext_CKLBUILabel_setText(s32* p,s32* text);\r\n    static u32 _ext_CKLBUILabel_getColor(s32* p);\r\n    static void _ext_CKLBUILabel_setColor(s32* p,u32 color);\r\n    static s32* _ext_CKLBUILabel_getFont(s32* p);\r\n    static void _ext_CKLBUILabel_setFont(s32* p,s32* font);\r\n    static u32 _ext_CKLBUILabel_getFontSize(s32* p);\r\n    static void _ext_CKLBUILabel_setFontSize(s32* p,u32 size);\r\n    static void _ext_CKLBUILabel_setPosition(s32* p,float x,float y);\r\n    CKLBUILabel(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 argb,System::String* font_name,u32 font_size,System::String* text,s32 align);\r\n    CKLBUILabel();\r\n    void setFont(System::String* name,u32 size);\r\n    inline void setFont$(System::String* name,u32 size);\r\n    void setPosition(float x,float y);\r\n    inline void setPosition$(float x,float y);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 202;\r\n};\r\nclass EnginePrototype::CKLBUIList : public EnginePrototype::CKLBUITask {\r\nfriend class LimitCallBack_inner40;\r\nfriend class DragCallBack_inner41;\r\nfriend class DynamicCallBack_inner42;\r\nfriend class ScrollBarCallBack_inner43;\r\nfriend class AnimCallBack_inner44;\r\n\r\npublic:\r\n    enum EPOSITION_MODE {\r\n        LIST_VIEW_TOP,\r\n        LIST_VIEW_CENTER,\r\n        LIST_VIEW_END,\r\n        LIST_VIEW_OFFSET,\r\n        _ForceWORD_EPOSITION_MODE = 0x7FFFFFFF\r\n    };\r\n\r\n    enum ESCROLLBAR_VALUE {\r\n        LIST_SCROVER_TOP,\r\n        LIST_SCROVER_BOTTTOM,\r\n        LIST_SCROVER_TAKEOFF,\r\n        _ForceWORD_ESCROLLBAR_VALUE = 0x7FFFFFFF\r\n    };\r\n\r\n    enum EITEM_MODE {\r\n        LIST_ITEM_NORMAL,\r\n        LIST_ITEM_DYNAMIC,\r\n        LIST_ITEM_FLYWEIGHT,\r\n        _ForceWORD_EITEM_MODE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUIList();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_LimitCallBack_inner40* m_limitCallback;\r\n    inline EnginePrototype::_Delegate_Base_LimitCallBack_inner40*& _gm_limitCallback$() { CHCKTHIS; return m_limitCallback; }\r\n    inline EnginePrototype::_Delegate_Base_LimitCallBack_inner40* _sm_limitCallback(EnginePrototype::_Delegate_Base_LimitCallBack_inner40* _$value);\r\n    inline EnginePrototype::_Delegate_Base_LimitCallBack_inner40* _sm_limitCallback$(EnginePrototype::_Delegate_Base_LimitCallBack_inner40* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_DragCallBack_inner41* m_dragCallback;\r\n    inline EnginePrototype::_Delegate_Base_DragCallBack_inner41*& _gm_dragCallback$() { CHCKTHIS; return m_dragCallback; }\r\n    inline EnginePrototype::_Delegate_Base_DragCallBack_inner41* _sm_dragCallback(EnginePrototype::_Delegate_Base_DragCallBack_inner41* _$value);\r\n    inline EnginePrototype::_Delegate_Base_DragCallBack_inner41* _sm_dragCallback$(EnginePrototype::_Delegate_Base_DragCallBack_inner41* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* m_dynamicCallback;\r\n    inline EnginePrototype::_Delegate_Base_DynamicCallBack_inner42*& _gm_dynamicCallback$() { CHCKTHIS; return m_dynamicCallback; }\r\n    inline EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* _sm_dynamicCallback(EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* _$value);\r\n    inline EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* _sm_dynamicCallback$(EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* m_scrollbarCallback;\r\n    inline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43*& _gm_scrollbarCallback$() { CHCKTHIS; return m_scrollbarCallback; }\r\n    inline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* _sm_scrollbarCallback(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* _$value);\r\n    inline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* _sm_scrollbarCallback$(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* _$value);\r\n\r\n    EnginePrototype::_Delegate_Base_AnimCallBack_inner44* m_animCallback;\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner44*& _gm_animCallback$() { CHCKTHIS; return m_animCallback; }\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner44* _sm_animCallback(EnginePrototype::_Delegate_Base_AnimCallBack_inner44* _$value);\r\n    inline EnginePrototype::_Delegate_Base_AnimCallBack_inner44* _sm_animCallback$(EnginePrototype::_Delegate_Base_AnimCallBack_inner44* _$value);\r\n\r\n    inline u32 _acc_gWidth();\r\n    inline u32 _acc_gWidth$();\r\n\r\n    inline u32 _acc_sWidth(u32 value);\r\n    inline u32 _acc_sWidth$(u32 value);\r\n    inline u32 _acc_sWidthpostInc()\t\t\t{ u32 tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline u32 _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline u32 _acc_sWidthpostDec()\t\t\t{ u32 tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline u32 _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline u32 _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline u32 _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline u32 _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline u32 _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline u32 _acc_sWidthAddEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline u32 _acc_sWidth$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline u32 _acc_sWidthSubEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline u32 _acc_sWidth$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline u32 _acc_sWidthMulEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline u32 _acc_sWidth$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline u32 _acc_sWidthDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline u32 _acc_sWidth$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline u32 _acc_sWidthModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() % value); }\r\n    inline u32 _acc_sWidth$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline u32 _acc_sWidthXorEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() ^ value); }\r\n    inline u32 _acc_sWidth$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthXorEq(value); }\r\n    inline u32 _acc_sWidthAndEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() & value); }\r\n    inline u32 _acc_sWidth$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAndEq(value); }\r\n    inline u32 _acc_sWidthOrEq(u32 value)\t\t{ return _acc_sWidth(_acc_gWidth() | value); }\r\n    inline u32 _acc_sWidth$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthOrEq(value); }\r\n    inline u32 _acc_sWidthRShiftEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() >> value); }\r\n    inline u32 _acc_sWidth$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthRShiftEq(value); }\r\n    inline u32 _acc_sWidthLShiftEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() << value); }\r\n    inline u32 _acc_sWidth$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthLShiftEq(value); }\r\n    inline u32 _acc_gHeight();\r\n    inline u32 _acc_gHeight$();\r\n\r\n    inline u32 _acc_sHeight(u32 value);\r\n    inline u32 _acc_sHeight$(u32 value);\r\n    inline u32 _acc_sHeightpostInc()\t\t\t{ u32 tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline u32 _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline u32 _acc_sHeightpostDec()\t\t\t{ u32 tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline u32 _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline u32 _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline u32 _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline u32 _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline u32 _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline u32 _acc_sHeightAddEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline u32 _acc_sHeight$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline u32 _acc_sHeightSubEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline u32 _acc_sHeight$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline u32 _acc_sHeightMulEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline u32 _acc_sHeight$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline u32 _acc_sHeightDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline u32 _acc_sHeight$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline u32 _acc_sHeightModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() % value); }\r\n    inline u32 _acc_sHeight$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline u32 _acc_sHeightXorEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() ^ value); }\r\n    inline u32 _acc_sHeight$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightXorEq(value); }\r\n    inline u32 _acc_sHeightAndEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() & value); }\r\n    inline u32 _acc_sHeight$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAndEq(value); }\r\n    inline u32 _acc_sHeightOrEq(u32 value)\t\t{ return _acc_sHeight(_acc_gHeight() | value); }\r\n    inline u32 _acc_sHeight$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightOrEq(value); }\r\n    inline u32 _acc_sHeightRShiftEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() >> value); }\r\n    inline u32 _acc_sHeight$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightRShiftEq(value); }\r\n    inline u32 _acc_sHeightLShiftEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() << value); }\r\n    inline u32 _acc_sHeight$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightLShiftEq(value); }\r\n    inline s32 _acc_gStepX();\r\n    inline s32 _acc_gStepX$();\r\n\r\n    inline s32 _acc_sStepX(s32 value);\r\n    inline s32 _acc_sStepX$(s32 value);\r\n    inline s32 _acc_sStepXpostInc()\t\t\t{ s32 tmp; _acc_sStepX((tmp = _acc_gStepX())+1); return tmp; }\r\n    inline s32 _acc_sStepX$postInc()\t\t\t{ CHCKTHIS; return _acc_sStepXpostInc(); }\r\n    inline s32 _acc_sStepXpostDec()\t\t\t{ s32 tmp; _acc_sStepX((tmp = _acc_gStepX())-1); return tmp; }\r\n    inline s32 _acc_sStepX$postDec()\t\t\t{ CHCKTHIS; return _acc_sStepXpostDec(); }\r\n    inline s32 _acc_sStepXpreInc()\t\t\t{ return _acc_sStepX(_acc_gStepX()+1); }\r\n    inline s32 _acc_sStepX$preInc()\t\t\t{ CHCKTHIS; return _acc_sStepXpreInc(); }\r\n    inline s32 _acc_sStepXpreDec()\t\t\t{ return _acc_sStepX(_acc_gStepX()-1); }\r\n    inline s32 _acc_sStepX$preDec()\t\t\t{ CHCKTHIS; return _acc_sStepXpreDec(); }\r\n    inline s32 _acc_sStepXAddEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() + value); }\r\n    inline s32 _acc_sStepX$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXAddEq(value); }\r\n    inline s32 _acc_sStepXSubEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() - value); }\r\n    inline s32 _acc_sStepX$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXSubEq(value); }\r\n    inline s32 _acc_sStepXMulEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() * value); }\r\n    inline s32 _acc_sStepX$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXMulEq(value); }\r\n    inline s32 _acc_sStepXDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepX(_acc_gStepX() / value); }\r\n    inline s32 _acc_sStepX$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXDivEq(value); }\r\n    inline s32 _acc_sStepXModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepX(_acc_gStepX() % value); }\r\n    inline s32 _acc_sStepX$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXModEq(value); }\r\n    inline s32 _acc_sStepXXorEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() ^ value); }\r\n    inline s32 _acc_sStepX$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXXorEq(value); }\r\n    inline s32 _acc_sStepXAndEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() & value); }\r\n    inline s32 _acc_sStepX$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXAndEq(value); }\r\n    inline s32 _acc_sStepXOrEq(s32 value)\t\t{ return _acc_sStepX(_acc_gStepX() | value); }\r\n    inline s32 _acc_sStepX$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXOrEq(value); }\r\n    inline s32 _acc_sStepXRShiftEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() >> value); }\r\n    inline s32 _acc_sStepX$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXRShiftEq(value); }\r\n    inline s32 _acc_sStepXLShiftEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() << value); }\r\n    inline s32 _acc_sStepX$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXLShiftEq(value); }\r\n    inline s32 _acc_gStepY();\r\n    inline s32 _acc_gStepY$();\r\n\r\n    inline s32 _acc_sStepY(s32 value);\r\n    inline s32 _acc_sStepY$(s32 value);\r\n    inline s32 _acc_sStepYpostInc()\t\t\t{ s32 tmp; _acc_sStepY((tmp = _acc_gStepY())+1); return tmp; }\r\n    inline s32 _acc_sStepY$postInc()\t\t\t{ CHCKTHIS; return _acc_sStepYpostInc(); }\r\n    inline s32 _acc_sStepYpostDec()\t\t\t{ s32 tmp; _acc_sStepY((tmp = _acc_gStepY())-1); return tmp; }\r\n    inline s32 _acc_sStepY$postDec()\t\t\t{ CHCKTHIS; return _acc_sStepYpostDec(); }\r\n    inline s32 _acc_sStepYpreInc()\t\t\t{ return _acc_sStepY(_acc_gStepY()+1); }\r\n    inline s32 _acc_sStepY$preInc()\t\t\t{ CHCKTHIS; return _acc_sStepYpreInc(); }\r\n    inline s32 _acc_sStepYpreDec()\t\t\t{ return _acc_sStepY(_acc_gStepY()-1); }\r\n    inline s32 _acc_sStepY$preDec()\t\t\t{ CHCKTHIS; return _acc_sStepYpreDec(); }\r\n    inline s32 _acc_sStepYAddEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() + value); }\r\n    inline s32 _acc_sStepY$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYAddEq(value); }\r\n    inline s32 _acc_sStepYSubEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() - value); }\r\n    inline s32 _acc_sStepY$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYSubEq(value); }\r\n    inline s32 _acc_sStepYMulEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() * value); }\r\n    inline s32 _acc_sStepY$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYMulEq(value); }\r\n    inline s32 _acc_sStepYDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepY(_acc_gStepY() / value); }\r\n    inline s32 _acc_sStepY$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYDivEq(value); }\r\n    inline s32 _acc_sStepYModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepY(_acc_gStepY() % value); }\r\n    inline s32 _acc_sStepY$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYModEq(value); }\r\n    inline s32 _acc_sStepYXorEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() ^ value); }\r\n    inline s32 _acc_sStepY$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYXorEq(value); }\r\n    inline s32 _acc_sStepYAndEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() & value); }\r\n    inline s32 _acc_sStepY$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYAndEq(value); }\r\n    inline s32 _acc_sStepYOrEq(s32 value)\t\t{ return _acc_sStepY(_acc_gStepY() | value); }\r\n    inline s32 _acc_sStepY$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYOrEq(value); }\r\n    inline s32 _acc_sStepYRShiftEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() >> value); }\r\n    inline s32 _acc_sStepY$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYRShiftEq(value); }\r\n    inline s32 _acc_sStepYLShiftEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() << value); }\r\n    inline s32 _acc_sStepY$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYLShiftEq(value); }\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline u32 _acc_gMaxodr();\r\n    inline u32 _acc_gMaxodr$();\r\n\r\n    inline u32 _acc_sMaxodr(u32 value);\r\n    inline u32 _acc_sMaxodr$(u32 value);\r\n    inline u32 _acc_sMaxodrpostInc()\t\t\t{ u32 tmp; _acc_sMaxodr((tmp = _acc_gMaxodr())+1); return tmp; }\r\n    inline u32 _acc_sMaxodr$postInc()\t\t\t{ CHCKTHIS; return _acc_sMaxodrpostInc(); }\r\n    inline u32 _acc_sMaxodrpostDec()\t\t\t{ u32 tmp; _acc_sMaxodr((tmp = _acc_gMaxodr())-1); return tmp; }\r\n    inline u32 _acc_sMaxodr$postDec()\t\t\t{ CHCKTHIS; return _acc_sMaxodrpostDec(); }\r\n    inline u32 _acc_sMaxodrpreInc()\t\t\t{ return _acc_sMaxodr(_acc_gMaxodr()+1); }\r\n    inline u32 _acc_sMaxodr$preInc()\t\t\t{ CHCKTHIS; return _acc_sMaxodrpreInc(); }\r\n    inline u32 _acc_sMaxodrpreDec()\t\t\t{ return _acc_sMaxodr(_acc_gMaxodr()-1); }\r\n    inline u32 _acc_sMaxodr$preDec()\t\t\t{ CHCKTHIS; return _acc_sMaxodrpreDec(); }\r\n    inline u32 _acc_sMaxodrAddEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() + value); }\r\n    inline u32 _acc_sMaxodr$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrAddEq(value); }\r\n    inline u32 _acc_sMaxodrSubEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() - value); }\r\n    inline u32 _acc_sMaxodr$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrSubEq(value); }\r\n    inline u32 _acc_sMaxodrMulEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() * value); }\r\n    inline u32 _acc_sMaxodr$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrMulEq(value); }\r\n    inline u32 _acc_sMaxodrDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxodr(_acc_gMaxodr() / value); }\r\n    inline u32 _acc_sMaxodr$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrDivEq(value); }\r\n    inline u32 _acc_sMaxodrModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxodr(_acc_gMaxodr() % value); }\r\n    inline u32 _acc_sMaxodr$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrModEq(value); }\r\n    inline u32 _acc_sMaxodrXorEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() ^ value); }\r\n    inline u32 _acc_sMaxodr$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrXorEq(value); }\r\n    inline u32 _acc_sMaxodrAndEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() & value); }\r\n    inline u32 _acc_sMaxodr$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrAndEq(value); }\r\n    inline u32 _acc_sMaxodrOrEq(u32 value)\t\t{ return _acc_sMaxodr(_acc_gMaxodr() | value); }\r\n    inline u32 _acc_sMaxodr$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrOrEq(value); }\r\n    inline u32 _acc_sMaxodrRShiftEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() >> value); }\r\n    inline u32 _acc_sMaxodr$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrRShiftEq(value); }\r\n    inline u32 _acc_sMaxodrLShiftEq(u32 value)\t{ return _acc_sMaxodr(_acc_gMaxodr() << value); }\r\n    inline u32 _acc_sMaxodr$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxodrLShiftEq(value); }\r\n    inline bool _acc_gIsVertical();\r\n    inline bool _acc_gIsVertical$();\r\n\r\n    inline bool _acc_sIsVertical(bool value);\r\n    inline bool _acc_sIsVertical$(bool value);\r\n    inline u32 _acc_gItems();\r\n    inline u32 _acc_gItems$();\r\n\r\n    inline s32 _acc_gMarginTop();\r\n    inline s32 _acc_gMarginTop$();\r\n\r\n    inline s32 _acc_sMarginTop(s32 value);\r\n    inline s32 _acc_sMarginTop$(s32 value);\r\n    inline s32 _acc_sMarginToppostInc()\t\t\t{ s32 tmp; _acc_sMarginTop((tmp = _acc_gMarginTop())+1); return tmp; }\r\n    inline s32 _acc_sMarginTop$postInc()\t\t\t{ CHCKTHIS; return _acc_sMarginToppostInc(); }\r\n    inline s32 _acc_sMarginToppostDec()\t\t\t{ s32 tmp; _acc_sMarginTop((tmp = _acc_gMarginTop())-1); return tmp; }\r\n    inline s32 _acc_sMarginTop$postDec()\t\t\t{ CHCKTHIS; return _acc_sMarginToppostDec(); }\r\n    inline s32 _acc_sMarginToppreInc()\t\t\t{ return _acc_sMarginTop(_acc_gMarginTop()+1); }\r\n    inline s32 _acc_sMarginTop$preInc()\t\t\t{ CHCKTHIS; return _acc_sMarginToppreInc(); }\r\n    inline s32 _acc_sMarginToppreDec()\t\t\t{ return _acc_sMarginTop(_acc_gMarginTop()-1); }\r\n    inline s32 _acc_sMarginTop$preDec()\t\t\t{ CHCKTHIS; return _acc_sMarginToppreDec(); }\r\n    inline s32 _acc_sMarginTopAddEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() + value); }\r\n    inline s32 _acc_sMarginTop$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopAddEq(value); }\r\n    inline s32 _acc_sMarginTopSubEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() - value); }\r\n    inline s32 _acc_sMarginTop$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopSubEq(value); }\r\n    inline s32 _acc_sMarginTopMulEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() * value); }\r\n    inline s32 _acc_sMarginTop$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopMulEq(value); }\r\n    inline s32 _acc_sMarginTopDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMarginTop(_acc_gMarginTop() / value); }\r\n    inline s32 _acc_sMarginTop$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopDivEq(value); }\r\n    inline s32 _acc_sMarginTopModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMarginTop(_acc_gMarginTop() % value); }\r\n    inline s32 _acc_sMarginTop$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopModEq(value); }\r\n    inline s32 _acc_sMarginTopXorEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() ^ value); }\r\n    inline s32 _acc_sMarginTop$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopXorEq(value); }\r\n    inline s32 _acc_sMarginTopAndEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() & value); }\r\n    inline s32 _acc_sMarginTop$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopAndEq(value); }\r\n    inline s32 _acc_sMarginTopOrEq(s32 value)\t\t{ return _acc_sMarginTop(_acc_gMarginTop() | value); }\r\n    inline s32 _acc_sMarginTop$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopOrEq(value); }\r\n    inline s32 _acc_sMarginTopRShiftEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() >> value); }\r\n    inline s32 _acc_sMarginTop$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopRShiftEq(value); }\r\n    inline s32 _acc_sMarginTopLShiftEq(s32 value)\t{ return _acc_sMarginTop(_acc_gMarginTop() << value); }\r\n    inline s32 _acc_sMarginTop$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginTopLShiftEq(value); }\r\n    inline s32 _acc_gMarginBottom();\r\n    inline s32 _acc_gMarginBottom$();\r\n\r\n    inline s32 _acc_sMarginBottom(s32 value);\r\n    inline s32 _acc_sMarginBottom$(s32 value);\r\n    inline s32 _acc_sMarginBottompostInc()\t\t\t{ s32 tmp; _acc_sMarginBottom((tmp = _acc_gMarginBottom())+1); return tmp; }\r\n    inline s32 _acc_sMarginBottom$postInc()\t\t\t{ CHCKTHIS; return _acc_sMarginBottompostInc(); }\r\n    inline s32 _acc_sMarginBottompostDec()\t\t\t{ s32 tmp; _acc_sMarginBottom((tmp = _acc_gMarginBottom())-1); return tmp; }\r\n    inline s32 _acc_sMarginBottom$postDec()\t\t\t{ CHCKTHIS; return _acc_sMarginBottompostDec(); }\r\n    inline s32 _acc_sMarginBottompreInc()\t\t\t{ return _acc_sMarginBottom(_acc_gMarginBottom()+1); }\r\n    inline s32 _acc_sMarginBottom$preInc()\t\t\t{ CHCKTHIS; return _acc_sMarginBottompreInc(); }\r\n    inline s32 _acc_sMarginBottompreDec()\t\t\t{ return _acc_sMarginBottom(_acc_gMarginBottom()-1); }\r\n    inline s32 _acc_sMarginBottom$preDec()\t\t\t{ CHCKTHIS; return _acc_sMarginBottompreDec(); }\r\n    inline s32 _acc_sMarginBottomAddEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() + value); }\r\n    inline s32 _acc_sMarginBottom$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomAddEq(value); }\r\n    inline s32 _acc_sMarginBottomSubEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() - value); }\r\n    inline s32 _acc_sMarginBottom$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomSubEq(value); }\r\n    inline s32 _acc_sMarginBottomMulEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() * value); }\r\n    inline s32 _acc_sMarginBottom$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomMulEq(value); }\r\n    inline s32 _acc_sMarginBottomDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMarginBottom(_acc_gMarginBottom() / value); }\r\n    inline s32 _acc_sMarginBottom$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomDivEq(value); }\r\n    inline s32 _acc_sMarginBottomModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMarginBottom(_acc_gMarginBottom() % value); }\r\n    inline s32 _acc_sMarginBottom$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomModEq(value); }\r\n    inline s32 _acc_sMarginBottomXorEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() ^ value); }\r\n    inline s32 _acc_sMarginBottom$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomXorEq(value); }\r\n    inline s32 _acc_sMarginBottomAndEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() & value); }\r\n    inline s32 _acc_sMarginBottom$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomAndEq(value); }\r\n    inline s32 _acc_sMarginBottomOrEq(s32 value)\t\t{ return _acc_sMarginBottom(_acc_gMarginBottom() | value); }\r\n    inline s32 _acc_sMarginBottom$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomOrEq(value); }\r\n    inline s32 _acc_sMarginBottomRShiftEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() >> value); }\r\n    inline s32 _acc_sMarginBottom$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomRShiftEq(value); }\r\n    inline s32 _acc_sMarginBottomLShiftEq(s32 value)\t{ return _acc_sMarginBottom(_acc_gMarginBottom() << value); }\r\n    inline s32 _acc_sMarginBottom$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMarginBottomLShiftEq(value); }\r\n    inline bool _acc_gDefaultScroll();\r\n    inline bool _acc_gDefaultScroll$();\r\n\r\n    inline bool _acc_sDefaultScroll(bool value);\r\n    inline bool _acc_sDefaultScroll$(bool value);\r\n    inline s32 _acc_gPosition();\r\n    inline s32 _acc_gPosition$();\r\n\r\n    inline s32 _acc_gLimit();\r\n    inline s32 _acc_gLimit$();\r\n\r\n    inline bool _acc_gLoopMode();\r\n    inline bool _acc_gLoopMode$();\r\n\r\n    inline bool _acc_sLoopMode(bool value);\r\n    inline bool _acc_sLoopMode$(bool value);\r\n    static s32* _ext_CKLBUIList_create(s32* pParent,u32 baseOrder,u32 maxOrder,float x,float y,float clipWidth,float clipHeight,s32 defaultLineStep,bool vertical,u32 optionalFlags);\r\n    static u32 _ext_CKLBUIList_getWidth(s32* p);\r\n    static void _ext_CKLBUIList_setWidth(s32* p,u32 width);\r\n    static u32 _ext_CKLBUIList_getHeight(s32* p);\r\n    static void _ext_CKLBUIList_setHeight(s32* p,u32 height);\r\n    static s32 _ext_CKLBUIList_getStepX(s32* p);\r\n    static void _ext_CKLBUIList_setStepX(s32* p,s32 x);\r\n    static s32 _ext_CKLBUIList_getStepY(s32* p);\r\n    static void _ext_CKLBUIList_setStepY(s32* p,s32 y);\r\n    static u32 _ext_CKLBUIList_getOrder(s32* p);\r\n    static void _ext_CKLBUIList_setOrder(s32* p,u32 order);\r\n    static u32 _ext_CKLBUIList_getMaxOrder(s32* p);\r\n    static void _ext_CKLBUIList_setMaxOrder(s32* p,u32 order);\r\n    static bool _ext_CKLBUIList_getVertical(s32* p);\r\n    static void _ext_CKLBUIList_setVertical(s32* p,bool vertical);\r\n    static u32 _ext_CKLBUIList_getItems(s32* p);\r\n    static s32 _ext_CKLBUIList_getMarginTop(s32* p);\r\n    static void _ext_CKLBUIList_setMarginTop(s32* p,s32 top);\r\n    static s32 _ext_CKLBUIList_getMarginBottom(s32* p);\r\n    static void _ext_CKLBUIList_setMarginBottom(s32* p,s32 bottom);\r\n    static bool _ext_CKLBUIList_getDefaultScroll(s32* p);\r\n    static void _ext_CKLBUIList_setDefaultScroll(s32* p,bool scroll);\r\n    static bool _ext_CKLBUIList_cmdItemRemove(s32* p,s32 idx);\r\n    static void _ext_CKLBUIList_cmdItemMove(s32* p,s32 src,s32 dst);\r\n    static void _ext_CKLBUIList_cmdSetMargin(s32* p,s32 top,s32 bottom);\r\n    static s32 _ext_CKLBUIList_cmdGetPosition(s32* p);\r\n    static s32 _ext_CKLBUIList_cmdSetPosition(s32* p,s32 pos,s32 dir);\r\n    static void _ext_CKLBUIList_cmdSetItemID(s32* p,s32 index,s32 id);\r\n    static s32 _ext_CKLBUIList_cmdSearchID(s32* p,s32 id);\r\n    static void _ext_CKLBUIList_cmdSetItemPos(s32* p,s32 mode,s32 idx,s32 offset);\r\n    static void _ext_CKLBUIList_cmdSetLimitClip(s32* p,bool chklimit);\r\n    static s32 _ext_CKLBUIList_cmdGetLimit(s32* p);\r\n    static bool _ext_CKLBUIList_cmdSetLimitArea(s32* p,s32 limitArea);\r\n    static void _ext_CKLBUIList_cmdChangeStep(s32* p,s32 index,s32 step);\r\n    static void _ext_CKLBUIList_cmdInputEnable(s32* p,bool enable);\r\n    static bool _ext_CKLBUIList_cmdExistNode(s32* p,s32 index,s32* name);\r\n    static bool _ext_CKLBUIList_cmdAnimationItem(s32* p,s32 index,s32* name,bool blend);\r\n    static bool _ext_CKLBUIList_cmdAnimationAll(s32* p,s32* name,bool blend);\r\n    static bool _ext_CKLBUIList_cmdItemAnimSkip(s32* p,s32 idx,s32* name);\r\n    static bool _ext_CKLBUIList_cmdAllAnimSkip(s32* p,s32* name);\r\n    static void _ext_CKLBUIList_cmdSetGroup(s32* p,s32* group_name);\r\n    static void _ext_CKLBUIList_setLoop(s32* p,bool mode);\r\n    static s32 _ext_CKLBUIList_cmdSetInitial(s32* p,s32 pos);\r\n    static bool _ext_CKLBUIList_useScrollBar(s32* p,u32 order,bool side,s32 lineWeight,s32* image,s32 minSlenderSize,u32 colorNormal,u32 colorSelect,bool active,bool hideMode,bool shortHide);\r\n    static void _ext_CKLBUIList_cmdFWModeConfig(s32* p,s32 itemStep,s32 maxItems);\r\n    static bool _ext_CKLBUIList_cmdSetItemMode(s32* p,s32 itemMode);\r\n    static bool _ext_CKLBUIList_cmdAddRecords(s32* p,s32 insIdx,s32* tpForm,s32* dbRecords,s32 step);\r\n    static bool _ext_CKLBUIList_cmdSelectScrMgr(s32* p,s32* name,System::Array<s32>* optParams,u32 nb);\r\n    static void _ext_CKLBUIList_cmdSetClip(s32* p,u32 orderBegin,u32 orderEnd,s16 clipX,s16 clipY,s16 clipWidth,s16 clipHeight);\r\n    static bool _ext_CKLBUIList_cmdItemAdd(s32* p,s32* name);\r\n    static bool _ext_CKLBUIList_cmdItemAdd2(s32* p,s32* name,s32 step,s32 id);\r\n    static bool _ext_CKLBUIList_cmdInsertItem(s32* p,s32* name,s32 idx);\r\n    static bool _ext_CKLBUIList_cmdInsertItem2(s32* p,s32* name,s32 idx,s32 step,s32 id);\r\n    static bool _ext_CKLBUIList_cmdRemoveSelection(s32* p,System::Array<s32>* indexes,u32 nb);\r\n    static void _ext_CKLBUIList_setDragRect(s32* p,s32 left,s32 top,s32 right,s32 bottom);\r\n    CKLBUIList(EnginePrototype::CKLBUITask* parent,u32 base_priority,u32 max_order,float x,float y,float clip_width,float clip_height,s32 default_line_step,EnginePrototype::_Delegate_Base_DragCallBack_inner41* callback,bool vertical,u32 option_flags);\r\n    CKLBUIList();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void dragCallBackFunction(u32 type,s32 x,s32 y,s32 param1,s32 param2);\r\n    inline void dragCallBackFunction$(u32 type,s32 x,s32 y,s32 param1,s32 param2);\r\n    virtual void limitCallBackFunction(u32 type,u32 itemCount,s32 listLength,s32 pos);\r\n    inline void limitCallBackFunction$(u32 type,u32 itemCount,s32 listLength,s32 pos);\r\n    virtual void dynamicCallBackFunction(s32 index,s32 id);\r\n    inline void dynamicCallBackFunction$(s32 index,s32 id);\r\n    virtual void scrollbarCallBackFunction(u32 type,s32 pos);\r\n    inline void scrollbarCallBackFunction$(u32 type,s32 pos);\r\n    virtual void animCallBackFunction(s32* name,u32 id);\r\n    inline void animCallBackFunction$(s32* name,u32 id);\r\n    void getSize(EnginePrototype::USize& size);\r\n    inline void getSize$(EnginePrototype::USize& size);\r\n    void setSize(EnginePrototype::USize size);\r\n    inline void setSize$(EnginePrototype::USize size);\r\n    void setSize(u32 width,u32 height);\r\n    inline void setSize$(u32 width,u32 height);\r\n    void itemAdd(System::String* asset);\r\n    inline void itemAdd$(System::String* asset);\r\n    void itemAdd(System::String* asset,s32 step,s32 id);\r\n    inline void itemAdd$(System::String* asset,s32 step,s32 id);\r\n    void itemInsert(System::String* asset,s32 index);\r\n    inline void itemInsert$(System::String* asset,s32 index);\r\n    void itemInsert(System::String* asset,s32 index,s32 step,s32 id);\r\n    inline void itemInsert$(System::String* asset,s32 index,s32 step,s32 id);\r\n    bool itemRemove(s32 index);\r\n    inline bool itemRemove$(s32 index);\r\n    void itemMove(s32 src,s32 dst);\r\n    inline void itemMove$(s32 src,s32 dst);\r\n    void itemRemoveSelection(System::Array<s32>* indexes);\r\n    inline void itemRemoveSelection$(System::Array<s32>* indexes);\r\n    void setMargin(s32 margin_top,s32 margin_bottom);\r\n    inline void setMargin$(s32 margin_top,s32 margin_bottom);\r\n    void setItemPosition(s32 positionMode,s32 index,s32 offset);\r\n    inline void setItemPosition$(s32 positionMode,s32 index,s32 offset);\r\n    void changeStep(s32 index,s32 newStep);\r\n    inline void changeStep$(s32 index,s32 newStep);\r\n    void setLimitClip(bool limitClipEnable);\r\n    inline void setLimitClip$(bool limitClipEnable);\r\n    void setLimitClip(bool limitClipEnable,EnginePrototype::_Delegate_Base_LimitCallBack_inner40* limitCallback);\r\n    inline void setLimitClip$(bool limitClipEnable,EnginePrototype::_Delegate_Base_LimitCallBack_inner40* limitCallback);\r\n    bool setLimitArea(s32 size);\r\n    inline bool setLimitArea$(s32 size);\r\n    void setInputEnable(bool enableFlag);\r\n    inline void setInputEnable$(bool enableFlag);\r\n    bool existNode(s32 index,System::String* name);\r\n    inline bool existNode$(s32 index,System::String* name);\r\n    bool animationItem(s32 index,System::String* animationName,bool blendFlag);\r\n    inline bool animationItem$(s32 index,System::String* animationName,bool blendFlag);\r\n    bool animationAll(System::String* animationName,bool blendFlag);\r\n    inline bool animationAll$(System::String* animationName,bool blendFlag);\r\n    bool useScrollbar(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,bool hideMode,bool shortHide);\r\n    inline bool useScrollbar$(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,bool hideMode,bool shortHide);\r\n    bool useScrollbar(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* callback,bool hideMode,bool shortHide);\r\n    inline bool useScrollbar$(u32 order,bool side,s32 lineWeight,System::String* image,s32 minSliderSize,u32 colorNormal,u32 colorSelect,bool active,EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner43* callback,bool hideMode,bool shortHide);\r\n    void setItemID(s32 index,s32 id);\r\n    inline void setItemID$(s32 index,s32 id);\r\n    s32 searchID(s32 index);\r\n    inline s32 searchID$(s32 index);\r\n    bool selectScrMgr(System::String* managerName,System::Array<s32>* optParams);\r\n    inline bool selectScrMgr$(System::String* managerName,System::Array<s32>* optParams);\r\n    bool itemAnimSkip(s32 idx,System::String* name);\r\n    inline bool itemAnimSkip$(s32 idx,System::String* name);\r\n    bool allAnimSkip(System::String* groupName);\r\n    inline bool allAnimSkip$(System::String* groupName);\r\n    bool addRecords(s32 insIdx,System::String* tpForm,System::String* dbRecords,s32 step);\r\n    inline bool addRecords$(s32 insIdx,System::String* tpForm,System::String* dbRecords,s32 step);\r\n    s32 setInitial(s32 pos);\r\n    inline s32 setInitial$(s32 pos);\r\n    void fwModeConfig(s32 itemStep,s32 maxItems);\r\n    inline void fwModeConfig$(s32 itemStep,s32 maxItems);\r\n    void fwItemAdd();\r\n    inline void fwItemAdd$();\r\n    void fwItemInsertTop();\r\n    inline void fwItemInsertTop$();\r\n    bool setItemMode(s32 mode);\r\n    inline bool setItemMode$(s32 mode);\r\n    bool setItemMode(s32 mode,EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* dynamicCallback);\r\n    inline bool setItemMode$(s32 mode,EnginePrototype::_Delegate_Base_DynamicCallBack_inner42* dynamicCallback);\r\n    s32 setPosition(s32 pos,s32 dir);\r\n    inline s32 setPosition$(s32 pos,s32 dir);\r\n    void setGroup(System::String* groupName);\r\n    inline void setGroup$(System::String* groupName);\r\n    void setClip(u32 orderBegin,u32 orderEnd,s16 clipX,s16 clipY,s16 clipWidth,s16 clipHeight);\r\n    inline void setClip$(u32 orderBegin,u32 orderEnd,s16 clipX,s16 clipY,s16 clipWidth,s16 clipHeight);\r\n    void setDragRect(s32 left,s32 top,s32 right,s32 bottom);\r\n    inline void setDragRect$(s32 left,s32 top,s32 right,s32 bottom);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 204;\r\n};\r\nclass EnginePrototype::CKLBUIMoviePlayer : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner45;\r\n\r\npublic:\r\n    void _ctor_CKLBUIMoviePlayer();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner45* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner45*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner45* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner45* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner45* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner45* _$value);\r\n\r\n    inline u32 _acc_gWidth();\r\n    inline u32 _acc_gWidth$();\r\n\r\n    inline u32 _acc_sWidth(u32 value);\r\n    inline u32 _acc_sWidth$(u32 value);\r\n    inline u32 _acc_sWidthpostInc()\t\t\t{ u32 tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline u32 _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline u32 _acc_sWidthpostDec()\t\t\t{ u32 tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline u32 _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline u32 _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline u32 _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline u32 _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline u32 _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline u32 _acc_sWidthAddEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline u32 _acc_sWidth$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline u32 _acc_sWidthSubEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline u32 _acc_sWidth$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline u32 _acc_sWidthMulEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline u32 _acc_sWidth$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline u32 _acc_sWidthDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline u32 _acc_sWidth$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline u32 _acc_sWidthModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() % value); }\r\n    inline u32 _acc_sWidth$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline u32 _acc_sWidthXorEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() ^ value); }\r\n    inline u32 _acc_sWidth$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthXorEq(value); }\r\n    inline u32 _acc_sWidthAndEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() & value); }\r\n    inline u32 _acc_sWidth$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAndEq(value); }\r\n    inline u32 _acc_sWidthOrEq(u32 value)\t\t{ return _acc_sWidth(_acc_gWidth() | value); }\r\n    inline u32 _acc_sWidth$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthOrEq(value); }\r\n    inline u32 _acc_sWidthRShiftEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() >> value); }\r\n    inline u32 _acc_sWidth$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthRShiftEq(value); }\r\n    inline u32 _acc_sWidthLShiftEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() << value); }\r\n    inline u32 _acc_sWidth$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthLShiftEq(value); }\r\n    inline u32 _acc_gHeight();\r\n    inline u32 _acc_gHeight$();\r\n\r\n    inline u32 _acc_sHeight(u32 value);\r\n    inline u32 _acc_sHeight$(u32 value);\r\n    inline u32 _acc_sHeightpostInc()\t\t\t{ u32 tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline u32 _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline u32 _acc_sHeightpostDec()\t\t\t{ u32 tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline u32 _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline u32 _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline u32 _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline u32 _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline u32 _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline u32 _acc_sHeightAddEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline u32 _acc_sHeight$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline u32 _acc_sHeightSubEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline u32 _acc_sHeight$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline u32 _acc_sHeightMulEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline u32 _acc_sHeight$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline u32 _acc_sHeightDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline u32 _acc_sHeight$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline u32 _acc_sHeightModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() % value); }\r\n    inline u32 _acc_sHeight$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline u32 _acc_sHeightXorEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() ^ value); }\r\n    inline u32 _acc_sHeight$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightXorEq(value); }\r\n    inline u32 _acc_sHeightAndEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() & value); }\r\n    inline u32 _acc_sHeight$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAndEq(value); }\r\n    inline u32 _acc_sHeightOrEq(u32 value)\t\t{ return _acc_sHeight(_acc_gHeight() | value); }\r\n    inline u32 _acc_sHeight$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightOrEq(value); }\r\n    inline u32 _acc_sHeightRShiftEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() >> value); }\r\n    inline u32 _acc_sHeight$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightRShiftEq(value); }\r\n    inline u32 _acc_sHeightLShiftEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() << value); }\r\n    inline u32 _acc_sHeight$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightLShiftEq(value); }\r\n    inline System::String* _acc_gPath();\r\n    inline System::String* _acc_gPath$();\r\n\r\n    inline System::String* _acc_sPath(System::String* value);\r\n    inline System::String* _acc_sPath$(System::String* value);\r\n    static s32* _ext_CKLBUIMoviePlayer_create(s32* pParent,bool mode,float x,float y,float width,float height,s32* url);\r\n    static u32 _ext_CKLBUIMoviePlayer_getWidth(s32* p);\r\n    static void _ext_CKLBUIMoviePlayer_setWidth(s32* p,u32 width);\r\n    static u32 _ext_CKLBUIMoviePlayer_getHeight(s32* p);\r\n    static void _ext_CKLBUIMoviePlayer_setHeight(s32* p,u32 height);\r\n    static s32* _ext_CKLBUIMoviePlayer_getText(s32* p);\r\n    static void _ext_CKLBUIMoviePlayer_setText(s32* p,s32* text);\r\n    static void _ext_CKLBUIMoviePlayer_moviePlay(s32* p);\r\n    static void _ext_CKLBUIMoviePlayer_movieStop(s32* p);\r\n    static void _ext_CKLBUIMoviePlayer_moviePause(s32* p);\r\n    static void _ext_CKLBUIMoviePlayer_movieResume(s32* p);\r\n    CKLBUIMoviePlayer(EnginePrototype::CKLBUITask* parent,bool background_mode,float x,float y,float width,float height,EnginePrototype::_Delegate_Base_CallBack_inner45* callback,System::String* url);\r\n    CKLBUIMoviePlayer();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction();\r\n    inline void callBackFunction$();\r\n    void getSize(EnginePrototype::USize& size);\r\n    inline void getSize$(EnginePrototype::USize& size);\r\n    void setSize(EnginePrototype::USize size);\r\n    inline void setSize$(EnginePrototype::USize size);\r\n    void setSize(u32 width,u32 height);\r\n    inline void setSize$(u32 width,u32 height);\r\n    void play();\r\n    inline void play$();\r\n    void pause();\r\n    inline void pause$();\r\n    void stop();\r\n    inline void stop$();\r\n    void resume();\r\n    inline void resume$();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 218;\r\n};\r\nclass EnginePrototype::CKLBUIMultiImgItem : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIMultiImgItem();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline u32 _acc_gIndex();\r\n    inline u32 _acc_gIndex$();\r\n\r\n    inline u32 _acc_sIndex(u32 value);\r\n    inline u32 _acc_sIndex$(u32 value);\r\n    inline u32 _acc_sIndexpostInc()\t\t\t{ u32 tmp; _acc_sIndex((tmp = _acc_gIndex())+1); return tmp; }\r\n    inline u32 _acc_sIndex$postInc()\t\t\t{ CHCKTHIS; return _acc_sIndexpostInc(); }\r\n    inline u32 _acc_sIndexpostDec()\t\t\t{ u32 tmp; _acc_sIndex((tmp = _acc_gIndex())-1); return tmp; }\r\n    inline u32 _acc_sIndex$postDec()\t\t\t{ CHCKTHIS; return _acc_sIndexpostDec(); }\r\n    inline u32 _acc_sIndexpreInc()\t\t\t{ return _acc_sIndex(_acc_gIndex()+1); }\r\n    inline u32 _acc_sIndex$preInc()\t\t\t{ CHCKTHIS; return _acc_sIndexpreInc(); }\r\n    inline u32 _acc_sIndexpreDec()\t\t\t{ return _acc_sIndex(_acc_gIndex()-1); }\r\n    inline u32 _acc_sIndex$preDec()\t\t\t{ CHCKTHIS; return _acc_sIndexpreDec(); }\r\n    inline u32 _acc_sIndexAddEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() + value); }\r\n    inline u32 _acc_sIndex$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexAddEq(value); }\r\n    inline u32 _acc_sIndexSubEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() - value); }\r\n    inline u32 _acc_sIndex$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexSubEq(value); }\r\n    inline u32 _acc_sIndexMulEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() * value); }\r\n    inline u32 _acc_sIndex$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexMulEq(value); }\r\n    inline u32 _acc_sIndexDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sIndex(_acc_gIndex() / value); }\r\n    inline u32 _acc_sIndex$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexDivEq(value); }\r\n    inline u32 _acc_sIndexModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sIndex(_acc_gIndex() % value); }\r\n    inline u32 _acc_sIndex$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexModEq(value); }\r\n    inline u32 _acc_sIndexXorEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() ^ value); }\r\n    inline u32 _acc_sIndex$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexXorEq(value); }\r\n    inline u32 _acc_sIndexAndEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() & value); }\r\n    inline u32 _acc_sIndex$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexAndEq(value); }\r\n    inline u32 _acc_sIndexOrEq(u32 value)\t\t{ return _acc_sIndex(_acc_gIndex() | value); }\r\n    inline u32 _acc_sIndex$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexOrEq(value); }\r\n    inline u32 _acc_sIndexRShiftEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() >> value); }\r\n    inline u32 _acc_sIndex$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexRShiftEq(value); }\r\n    inline u32 _acc_sIndexLShiftEq(u32 value)\t{ return _acc_sIndex(_acc_gIndex() << value); }\r\n    inline u32 _acc_sIndex$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIndexLShiftEq(value); }\r\n    inline u32 _acc_gIdMax();\r\n    inline u32 _acc_gIdMax$();\r\n\r\n    inline u32 _acc_sIdMax(u32 value);\r\n    inline u32 _acc_sIdMax$(u32 value);\r\n    inline u32 _acc_sIdMaxpostInc()\t\t\t{ u32 tmp; _acc_sIdMax((tmp = _acc_gIdMax())+1); return tmp; }\r\n    inline u32 _acc_sIdMax$postInc()\t\t\t{ CHCKTHIS; return _acc_sIdMaxpostInc(); }\r\n    inline u32 _acc_sIdMaxpostDec()\t\t\t{ u32 tmp; _acc_sIdMax((tmp = _acc_gIdMax())-1); return tmp; }\r\n    inline u32 _acc_sIdMax$postDec()\t\t\t{ CHCKTHIS; return _acc_sIdMaxpostDec(); }\r\n    inline u32 _acc_sIdMaxpreInc()\t\t\t{ return _acc_sIdMax(_acc_gIdMax()+1); }\r\n    inline u32 _acc_sIdMax$preInc()\t\t\t{ CHCKTHIS; return _acc_sIdMaxpreInc(); }\r\n    inline u32 _acc_sIdMaxpreDec()\t\t\t{ return _acc_sIdMax(_acc_gIdMax()-1); }\r\n    inline u32 _acc_sIdMax$preDec()\t\t\t{ CHCKTHIS; return _acc_sIdMaxpreDec(); }\r\n    inline u32 _acc_sIdMaxAddEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() + value); }\r\n    inline u32 _acc_sIdMax$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxAddEq(value); }\r\n    inline u32 _acc_sIdMaxSubEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() - value); }\r\n    inline u32 _acc_sIdMax$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxSubEq(value); }\r\n    inline u32 _acc_sIdMaxMulEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() * value); }\r\n    inline u32 _acc_sIdMax$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxMulEq(value); }\r\n    inline u32 _acc_sIdMaxDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sIdMax(_acc_gIdMax() / value); }\r\n    inline u32 _acc_sIdMax$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxDivEq(value); }\r\n    inline u32 _acc_sIdMaxModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sIdMax(_acc_gIdMax() % value); }\r\n    inline u32 _acc_sIdMax$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxModEq(value); }\r\n    inline u32 _acc_sIdMaxXorEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() ^ value); }\r\n    inline u32 _acc_sIdMax$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxXorEq(value); }\r\n    inline u32 _acc_sIdMaxAndEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() & value); }\r\n    inline u32 _acc_sIdMax$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxAndEq(value); }\r\n    inline u32 _acc_sIdMaxOrEq(u32 value)\t\t{ return _acc_sIdMax(_acc_gIdMax() | value); }\r\n    inline u32 _acc_sIdMax$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxOrEq(value); }\r\n    inline u32 _acc_sIdMaxRShiftEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() >> value); }\r\n    inline u32 _acc_sIdMax$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxRShiftEq(value); }\r\n    inline u32 _acc_sIdMaxLShiftEq(u32 value)\t{ return _acc_sIdMax(_acc_gIdMax() << value); }\r\n    inline u32 _acc_sIdMax$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sIdMaxLShiftEq(value); }\r\n    static s32* _ext_CKLBUIMultiImgItem_create(s32* pParent,u32 order,float x,float y,u32 idx,System::Array<s32*>* pArrayAsset,System::Array<u32>* pArrayIndexes,u32 assetCount);\r\n    static u32 _ext_CKLBUIMultiImgItem_getIndexMax(s32* p);\r\n    static void _ext_CKLBUIMultiImgItem_setIndexMax(s32* p,u32 index);\r\n    static u32 _ext_CKLBUIMultiImgItem_getOrder(s32* p);\r\n    static void _ext_CKLBUIMultiImgItem_setOrder(s32* p,u32 order);\r\n    static u32 _ext_CKLBUIMultiImgItem_getIndex(s32* p);\r\n    static void _ext_CKLBUIMultiImgItem_setIndex(s32* p,u32 index);\r\n    static bool _ext_CKLBUIMultiImgItem_changeAssets(s32* p,System::Array<s32*>* pArrayAsset,System::Array<u32>* pArrayIndexes,u32 assetCount);\r\n    CKLBUIMultiImgItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::Array<System::String*>* pArrayAsset,System::Array<u32>* pArrayIndexes,u32 index);\r\n    CKLBUIMultiImgItem();\r\n    bool changeAssets(System::Array<System::String*>* pArrayAsset,System::Array<u32>* pArrayIndexes);\r\n    inline bool changeAssets$(System::Array<System::String*>* pArrayAsset,System::Array<u32>* pArrayIndexes);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 221;\r\n};\r\nclass EnginePrototype::CKLBUIPieChart : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIPieChart();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline float _acc_gStart();\r\n    inline float _acc_gStart$();\r\n\r\n    inline float _acc_sStart(float value);\r\n    inline float _acc_sStart$(float value);\r\n    inline float _acc_sStartpostInc()\t\t\t{ float tmp; _acc_sStart((tmp = _acc_gStart())+1); return tmp; }\r\n    inline float _acc_sStart$postInc()\t\t\t{ CHCKTHIS; return _acc_sStartpostInc(); }\r\n    inline float _acc_sStartpostDec()\t\t\t{ float tmp; _acc_sStart((tmp = _acc_gStart())-1); return tmp; }\r\n    inline float _acc_sStart$postDec()\t\t\t{ CHCKTHIS; return _acc_sStartpostDec(); }\r\n    inline float _acc_sStartpreInc()\t\t\t{ return _acc_sStart(_acc_gStart()+1); }\r\n    inline float _acc_sStart$preInc()\t\t\t{ CHCKTHIS; return _acc_sStartpreInc(); }\r\n    inline float _acc_sStartpreDec()\t\t\t{ return _acc_sStart(_acc_gStart()-1); }\r\n    inline float _acc_sStart$preDec()\t\t\t{ CHCKTHIS; return _acc_sStartpreDec(); }\r\n    inline float _acc_sStartAddEq(float value)\t{ return _acc_sStart(_acc_gStart() + value); }\r\n    inline float _acc_sStart$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartAddEq(value); }\r\n    inline float _acc_sStartSubEq(float value)\t{ return _acc_sStart(_acc_gStart() - value); }\r\n    inline float _acc_sStart$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartSubEq(value); }\r\n    inline float _acc_sStartMulEq(float value)\t{ return _acc_sStart(_acc_gStart() * value); }\r\n    inline float _acc_sStart$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartMulEq(value); }\r\n    inline float _acc_sStartDivEq(float value)\t{ return _acc_sStart(_acc_gStart() / value); }\r\n    inline float _acc_sStart$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartDivEq(value); }\r\n    inline float _acc_sStartModEq(float value)\t{  float orig = _acc_gStart(); s32 tmp = (s32)(orig / value); return _acc_sStart(orig - (tmp * value)); }\r\n    inline float _acc_sStart$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartModEq(value); }\r\n    inline float _acc_gEnd();\r\n    inline float _acc_gEnd$();\r\n\r\n    inline float _acc_sEnd(float value);\r\n    inline float _acc_sEnd$(float value);\r\n    inline float _acc_sEndpostInc()\t\t\t{ float tmp; _acc_sEnd((tmp = _acc_gEnd())+1); return tmp; }\r\n    inline float _acc_sEnd$postInc()\t\t\t{ CHCKTHIS; return _acc_sEndpostInc(); }\r\n    inline float _acc_sEndpostDec()\t\t\t{ float tmp; _acc_sEnd((tmp = _acc_gEnd())-1); return tmp; }\r\n    inline float _acc_sEnd$postDec()\t\t\t{ CHCKTHIS; return _acc_sEndpostDec(); }\r\n    inline float _acc_sEndpreInc()\t\t\t{ return _acc_sEnd(_acc_gEnd()+1); }\r\n    inline float _acc_sEnd$preInc()\t\t\t{ CHCKTHIS; return _acc_sEndpreInc(); }\r\n    inline float _acc_sEndpreDec()\t\t\t{ return _acc_sEnd(_acc_gEnd()-1); }\r\n    inline float _acc_sEnd$preDec()\t\t\t{ CHCKTHIS; return _acc_sEndpreDec(); }\r\n    inline float _acc_sEndAddEq(float value)\t{ return _acc_sEnd(_acc_gEnd() + value); }\r\n    inline float _acc_sEnd$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndAddEq(value); }\r\n    inline float _acc_sEndSubEq(float value)\t{ return _acc_sEnd(_acc_gEnd() - value); }\r\n    inline float _acc_sEnd$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndSubEq(value); }\r\n    inline float _acc_sEndMulEq(float value)\t{ return _acc_sEnd(_acc_gEnd() * value); }\r\n    inline float _acc_sEnd$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndMulEq(value); }\r\n    inline float _acc_sEndDivEq(float value)\t{ return _acc_sEnd(_acc_gEnd() / value); }\r\n    inline float _acc_sEnd$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndDivEq(value); }\r\n    inline float _acc_sEndModEq(float value)\t{  float orig = _acc_gEnd(); s32 tmp = (s32)(orig / value); return _acc_sEnd(orig - (tmp * value)); }\r\n    inline float _acc_sEnd$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndModEq(value); }\r\n    inline float _acc_gValue();\r\n    inline float _acc_gValue$();\r\n\r\n    inline float _acc_sValue(float value);\r\n    inline float _acc_sValue$(float value);\r\n    inline float _acc_sValuepostInc()\t\t\t{ float tmp; _acc_sValue((tmp = _acc_gValue())+1); return tmp; }\r\n    inline float _acc_sValue$postInc()\t\t\t{ CHCKTHIS; return _acc_sValuepostInc(); }\r\n    inline float _acc_sValuepostDec()\t\t\t{ float tmp; _acc_sValue((tmp = _acc_gValue())-1); return tmp; }\r\n    inline float _acc_sValue$postDec()\t\t\t{ CHCKTHIS; return _acc_sValuepostDec(); }\r\n    inline float _acc_sValuepreInc()\t\t\t{ return _acc_sValue(_acc_gValue()+1); }\r\n    inline float _acc_sValue$preInc()\t\t\t{ CHCKTHIS; return _acc_sValuepreInc(); }\r\n    inline float _acc_sValuepreDec()\t\t\t{ return _acc_sValue(_acc_gValue()-1); }\r\n    inline float _acc_sValue$preDec()\t\t\t{ CHCKTHIS; return _acc_sValuepreDec(); }\r\n    inline float _acc_sValueAddEq(float value)\t{ return _acc_sValue(_acc_gValue() + value); }\r\n    inline float _acc_sValue$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueAddEq(value); }\r\n    inline float _acc_sValueSubEq(float value)\t{ return _acc_sValue(_acc_gValue() - value); }\r\n    inline float _acc_sValue$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueSubEq(value); }\r\n    inline float _acc_sValueMulEq(float value)\t{ return _acc_sValue(_acc_gValue() * value); }\r\n    inline float _acc_sValue$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueMulEq(value); }\r\n    inline float _acc_sValueDivEq(float value)\t{ return _acc_sValue(_acc_gValue() / value); }\r\n    inline float _acc_sValue$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueDivEq(value); }\r\n    inline float _acc_sValueModEq(float value)\t{  float orig = _acc_gValue(); s32 tmp = (s32)(orig / value); return _acc_sValue(orig - (tmp * value)); }\r\n    inline float _acc_sValue$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueModEq(value); }\r\n    inline s32 _acc_gAnim();\r\n    inline s32 _acc_gAnim$();\r\n\r\n    static s32* _ext_CKLBUIPieChart_create(s32* pParent,u32 order,float x,float y,float width,float height,s32* asset,float start,float end,s32 anim,float initial);\r\n    static float _ext_CKLBUIPieChart_getStart(s32* p);\r\n    static void _ext_CKLBUIPieChart_setStart(s32* p,float start);\r\n    static float _ext_CKLBUIPieChart_getEnd(s32* p);\r\n    static void _ext_CKLBUIPieChart_setEnd(s32* p,float end);\r\n    static float _ext_CKLBUIPieChart_getValue(s32* p);\r\n    static void _ext_CKLBUIPieChart_setValue(s32* p,float value);\r\n    static s32 _ext_CKLBUIPieChart_getAnim(s32* p);\r\n    static u32 _ext_CKLBUIPieChart_getOrder(s32* p);\r\n    static bool _ext_CKLBUIPieChart_changeAsset(s32* p,s32* assetName);\r\n    CKLBUIPieChart(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,System::String* image_asset,float start_angle,float end_angle,s32 anim_time,float initial_value);\r\n    CKLBUIPieChart();\r\n    bool changeAsset(System::String* assetName);\r\n    inline bool changeAsset$(System::String* assetName);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 222;\r\n};\r\nclass EnginePrototype::CKLBUIPolyline : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIPolyline();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_gMaxPointCount();\r\n    inline u32 _acc_gMaxPointCount$();\r\n\r\n    inline u32 _acc_sMaxPointCount(u32 value);\r\n    inline u32 _acc_sMaxPointCount$(u32 value);\r\n    inline u32 _acc_sMaxPointCountpostInc()\t\t\t{ u32 tmp; _acc_sMaxPointCount((tmp = _acc_gMaxPointCount())+1); return tmp; }\r\n    inline u32 _acc_sMaxPointCount$postInc()\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountpostInc(); }\r\n    inline u32 _acc_sMaxPointCountpostDec()\t\t\t{ u32 tmp; _acc_sMaxPointCount((tmp = _acc_gMaxPointCount())-1); return tmp; }\r\n    inline u32 _acc_sMaxPointCount$postDec()\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountpostDec(); }\r\n    inline u32 _acc_sMaxPointCountpreInc()\t\t\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount()+1); }\r\n    inline u32 _acc_sMaxPointCount$preInc()\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountpreInc(); }\r\n    inline u32 _acc_sMaxPointCountpreDec()\t\t\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount()-1); }\r\n    inline u32 _acc_sMaxPointCount$preDec()\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountpreDec(); }\r\n    inline u32 _acc_sMaxPointCountAddEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() + value); }\r\n    inline u32 _acc_sMaxPointCount$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountAddEq(value); }\r\n    inline u32 _acc_sMaxPointCountSubEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() - value); }\r\n    inline u32 _acc_sMaxPointCount$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountSubEq(value); }\r\n    inline u32 _acc_sMaxPointCountMulEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() * value); }\r\n    inline u32 _acc_sMaxPointCount$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountMulEq(value); }\r\n    inline u32 _acc_sMaxPointCountDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxPointCount(_acc_gMaxPointCount() / value); }\r\n    inline u32 _acc_sMaxPointCount$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountDivEq(value); }\r\n    inline u32 _acc_sMaxPointCountModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxPointCount(_acc_gMaxPointCount() % value); }\r\n    inline u32 _acc_sMaxPointCount$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountModEq(value); }\r\n    inline u32 _acc_sMaxPointCountXorEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() ^ value); }\r\n    inline u32 _acc_sMaxPointCount$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountXorEq(value); }\r\n    inline u32 _acc_sMaxPointCountAndEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() & value); }\r\n    inline u32 _acc_sMaxPointCount$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountAndEq(value); }\r\n    inline u32 _acc_sMaxPointCountOrEq(u32 value)\t\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() | value); }\r\n    inline u32 _acc_sMaxPointCount$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountOrEq(value); }\r\n    inline u32 _acc_sMaxPointCountRShiftEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() >> value); }\r\n    inline u32 _acc_sMaxPointCount$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountRShiftEq(value); }\r\n    inline u32 _acc_sMaxPointCountLShiftEq(u32 value)\t{ return _acc_sMaxPointCount(_acc_gMaxPointCount() << value); }\r\n    inline u32 _acc_sMaxPointCount$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxPointCountLShiftEq(value); }\r\n    inline u32 _acc_gPointCount();\r\n    inline u32 _acc_gPointCount$();\r\n\r\n    inline u32 _acc_sPointCount(u32 value);\r\n    inline u32 _acc_sPointCount$(u32 value);\r\n    inline u32 _acc_sPointCountpostInc()\t\t\t{ u32 tmp; _acc_sPointCount((tmp = _acc_gPointCount())+1); return tmp; }\r\n    inline u32 _acc_sPointCount$postInc()\t\t\t{ CHCKTHIS; return _acc_sPointCountpostInc(); }\r\n    inline u32 _acc_sPointCountpostDec()\t\t\t{ u32 tmp; _acc_sPointCount((tmp = _acc_gPointCount())-1); return tmp; }\r\n    inline u32 _acc_sPointCount$postDec()\t\t\t{ CHCKTHIS; return _acc_sPointCountpostDec(); }\r\n    inline u32 _acc_sPointCountpreInc()\t\t\t{ return _acc_sPointCount(_acc_gPointCount()+1); }\r\n    inline u32 _acc_sPointCount$preInc()\t\t\t{ CHCKTHIS; return _acc_sPointCountpreInc(); }\r\n    inline u32 _acc_sPointCountpreDec()\t\t\t{ return _acc_sPointCount(_acc_gPointCount()-1); }\r\n    inline u32 _acc_sPointCount$preDec()\t\t\t{ CHCKTHIS; return _acc_sPointCountpreDec(); }\r\n    inline u32 _acc_sPointCountAddEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() + value); }\r\n    inline u32 _acc_sPointCount$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountAddEq(value); }\r\n    inline u32 _acc_sPointCountSubEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() - value); }\r\n    inline u32 _acc_sPointCount$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountSubEq(value); }\r\n    inline u32 _acc_sPointCountMulEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() * value); }\r\n    inline u32 _acc_sPointCount$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountMulEq(value); }\r\n    inline u32 _acc_sPointCountDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sPointCount(_acc_gPointCount() / value); }\r\n    inline u32 _acc_sPointCount$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountDivEq(value); }\r\n    inline u32 _acc_sPointCountModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sPointCount(_acc_gPointCount() % value); }\r\n    inline u32 _acc_sPointCount$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountModEq(value); }\r\n    inline u32 _acc_sPointCountXorEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() ^ value); }\r\n    inline u32 _acc_sPointCount$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountXorEq(value); }\r\n    inline u32 _acc_sPointCountAndEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() & value); }\r\n    inline u32 _acc_sPointCount$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountAndEq(value); }\r\n    inline u32 _acc_sPointCountOrEq(u32 value)\t\t{ return _acc_sPointCount(_acc_gPointCount() | value); }\r\n    inline u32 _acc_sPointCount$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountOrEq(value); }\r\n    inline u32 _acc_sPointCountRShiftEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() >> value); }\r\n    inline u32 _acc_sPointCount$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountRShiftEq(value); }\r\n    inline u32 _acc_sPointCountLShiftEq(u32 value)\t{ return _acc_sPointCount(_acc_gPointCount() << value); }\r\n    inline u32 _acc_sPointCount$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sPointCountLShiftEq(value); }\r\n    inline u32 _acc_gColor();\r\n    inline u32 _acc_gColor$();\r\n\r\n    inline u32 _acc_sColor(u32 value);\r\n    inline u32 _acc_sColor$(u32 value);\r\n    inline u32 _acc_sColorpostInc()\t\t\t{ u32 tmp; _acc_sColor((tmp = _acc_gColor())+1); return tmp; }\r\n    inline u32 _acc_sColor$postInc()\t\t\t{ CHCKTHIS; return _acc_sColorpostInc(); }\r\n    inline u32 _acc_sColorpostDec()\t\t\t{ u32 tmp; _acc_sColor((tmp = _acc_gColor())-1); return tmp; }\r\n    inline u32 _acc_sColor$postDec()\t\t\t{ CHCKTHIS; return _acc_sColorpostDec(); }\r\n    inline u32 _acc_sColorpreInc()\t\t\t{ return _acc_sColor(_acc_gColor()+1); }\r\n    inline u32 _acc_sColor$preInc()\t\t\t{ CHCKTHIS; return _acc_sColorpreInc(); }\r\n    inline u32 _acc_sColorpreDec()\t\t\t{ return _acc_sColor(_acc_gColor()-1); }\r\n    inline u32 _acc_sColor$preDec()\t\t\t{ CHCKTHIS; return _acc_sColorpreDec(); }\r\n    inline u32 _acc_sColorAddEq(u32 value)\t{ return _acc_sColor(_acc_gColor() + value); }\r\n    inline u32 _acc_sColor$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorAddEq(value); }\r\n    inline u32 _acc_sColorSubEq(u32 value)\t{ return _acc_sColor(_acc_gColor() - value); }\r\n    inline u32 _acc_sColor$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorSubEq(value); }\r\n    inline u32 _acc_sColorMulEq(u32 value)\t{ return _acc_sColor(_acc_gColor() * value); }\r\n    inline u32 _acc_sColor$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorMulEq(value); }\r\n    inline u32 _acc_sColorDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sColor(_acc_gColor() / value); }\r\n    inline u32 _acc_sColor$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorDivEq(value); }\r\n    inline u32 _acc_sColorModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sColor(_acc_gColor() % value); }\r\n    inline u32 _acc_sColor$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorModEq(value); }\r\n    inline u32 _acc_sColorXorEq(u32 value)\t{ return _acc_sColor(_acc_gColor() ^ value); }\r\n    inline u32 _acc_sColor$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorXorEq(value); }\r\n    inline u32 _acc_sColorAndEq(u32 value)\t{ return _acc_sColor(_acc_gColor() & value); }\r\n    inline u32 _acc_sColor$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorAndEq(value); }\r\n    inline u32 _acc_sColorOrEq(u32 value)\t\t{ return _acc_sColor(_acc_gColor() | value); }\r\n    inline u32 _acc_sColor$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorOrEq(value); }\r\n    inline u32 _acc_sColorRShiftEq(u32 value)\t{ return _acc_sColor(_acc_gColor() >> value); }\r\n    inline u32 _acc_sColor$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorRShiftEq(value); }\r\n    inline u32 _acc_sColorLShiftEq(u32 value)\t{ return _acc_sColor(_acc_gColor() << value); }\r\n    inline u32 _acc_sColor$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColorLShiftEq(value); }\r\n    static s32* _ext_CKLBUIPolyline_create(s32* parent,u32 order,u32 maxPoint);\r\n    static u32 _ext_CKLBUIPolyline_getMaxPoint(s32* p);\r\n    static void _ext_CKLBUIPolyline_setMaxPoint(s32* p,u32 maxpointcount);\r\n    static u32 _ext_CKLBUIPolyline_getOrder(s32* p);\r\n    static u32 _ext_CKLBUIPolyline_getPointCount(s32* p);\r\n    static void _ext_CKLBUIPolyline_setPointCount(s32* p,u32 pointcount);\r\n    static void _ext_CKLBUIPolyline_setPoint(s32* p,u32 idx,float x,float y);\r\n    static u32 _ext_CKLBUIPolyline_getColor(s32* p);\r\n    static void _ext_CKLBUIPolyline_setColor(s32* p,u32 color);\r\n    CKLBUIPolyline(EnginePrototype::CKLBUITask* parent,u32 order,u32 maxPoint);\r\n    CKLBUIPolyline();\r\n    void setPoint(u32 point_index,float x,float y);\r\n    inline void setPoint$(u32 point_index,float x,float y);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 223;\r\n};\r\nclass EnginePrototype::CKLBUIProgressBar : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIProgressBar();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline float _acc_gWidth();\r\n    inline float _acc_gWidth$();\r\n\r\n    inline float _acc_sWidth(float value);\r\n    inline float _acc_sWidth$(float value);\r\n    inline float _acc_sWidthpostInc()\t\t\t{ float tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline float _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline float _acc_sWidthpostDec()\t\t\t{ float tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline float _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline float _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline float _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline float _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline float _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline float _acc_sWidthAddEq(float value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline float _acc_sWidth$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline float _acc_sWidthSubEq(float value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline float _acc_sWidth$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline float _acc_sWidthMulEq(float value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline float _acc_sWidth$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline float _acc_sWidthDivEq(float value)\t{ return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline float _acc_sWidth$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline float _acc_sWidthModEq(float value)\t{  float orig = _acc_gWidth(); s32 tmp = (s32)(orig / value); return _acc_sWidth(orig - (tmp * value)); }\r\n    inline float _acc_sWidth$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline float _acc_gHeight();\r\n    inline float _acc_gHeight$();\r\n\r\n    inline float _acc_sHeight(float value);\r\n    inline float _acc_sHeight$(float value);\r\n    inline float _acc_sHeightpostInc()\t\t\t{ float tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline float _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline float _acc_sHeightpostDec()\t\t\t{ float tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline float _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline float _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline float _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline float _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline float _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline float _acc_sHeightAddEq(float value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline float _acc_sHeight$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline float _acc_sHeightSubEq(float value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline float _acc_sHeight$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline float _acc_sHeightMulEq(float value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline float _acc_sHeight$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline float _acc_sHeightDivEq(float value)\t{ return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline float _acc_sHeight$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline float _acc_sHeightModEq(float value)\t{  float orig = _acc_gHeight(); s32 tmp = (s32)(orig / value); return _acc_sHeight(orig - (tmp * value)); }\r\n    inline float _acc_sHeight$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline bool _acc_gIsVertical();\r\n    inline bool _acc_gIsVertical$();\r\n\r\n    inline bool _acc_sIsVertical(bool value);\r\n    inline bool _acc_sIsVertical$(bool value);\r\n    inline u32 _acc_gAnimTime();\r\n    inline u32 _acc_gAnimTime$();\r\n\r\n    inline u32 _acc_sAnimTime(u32 value);\r\n    inline u32 _acc_sAnimTime$(u32 value);\r\n    inline u32 _acc_sAnimTimepostInc()\t\t\t{ u32 tmp; _acc_sAnimTime((tmp = _acc_gAnimTime())+1); return tmp; }\r\n    inline u32 _acc_sAnimTime$postInc()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepostInc(); }\r\n    inline u32 _acc_sAnimTimepostDec()\t\t\t{ u32 tmp; _acc_sAnimTime((tmp = _acc_gAnimTime())-1); return tmp; }\r\n    inline u32 _acc_sAnimTime$postDec()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepostDec(); }\r\n    inline u32 _acc_sAnimTimepreInc()\t\t\t{ return _acc_sAnimTime(_acc_gAnimTime()+1); }\r\n    inline u32 _acc_sAnimTime$preInc()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepreInc(); }\r\n    inline u32 _acc_sAnimTimepreDec()\t\t\t{ return _acc_sAnimTime(_acc_gAnimTime()-1); }\r\n    inline u32 _acc_sAnimTime$preDec()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepreDec(); }\r\n    inline u32 _acc_sAnimTimeAddEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() + value); }\r\n    inline u32 _acc_sAnimTime$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeAddEq(value); }\r\n    inline u32 _acc_sAnimTimeSubEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() - value); }\r\n    inline u32 _acc_sAnimTime$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeSubEq(value); }\r\n    inline u32 _acc_sAnimTimeMulEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() * value); }\r\n    inline u32 _acc_sAnimTime$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeMulEq(value); }\r\n    inline u32 _acc_sAnimTimeDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sAnimTime(_acc_gAnimTime() / value); }\r\n    inline u32 _acc_sAnimTime$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeDivEq(value); }\r\n    inline u32 _acc_sAnimTimeModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sAnimTime(_acc_gAnimTime() % value); }\r\n    inline u32 _acc_sAnimTime$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeModEq(value); }\r\n    inline u32 _acc_sAnimTimeXorEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() ^ value); }\r\n    inline u32 _acc_sAnimTime$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeXorEq(value); }\r\n    inline u32 _acc_sAnimTimeAndEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() & value); }\r\n    inline u32 _acc_sAnimTime$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeAndEq(value); }\r\n    inline u32 _acc_sAnimTimeOrEq(u32 value)\t\t{ return _acc_sAnimTime(_acc_gAnimTime() | value); }\r\n    inline u32 _acc_sAnimTime$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeOrEq(value); }\r\n    inline u32 _acc_sAnimTimeRShiftEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() >> value); }\r\n    inline u32 _acc_sAnimTime$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeRShiftEq(value); }\r\n    inline u32 _acc_sAnimTimeLShiftEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() << value); }\r\n    inline u32 _acc_sAnimTime$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeLShiftEq(value); }\r\n    inline float _acc_gStart();\r\n    inline float _acc_gStart$();\r\n\r\n    inline float _acc_sStart(float value);\r\n    inline float _acc_sStart$(float value);\r\n    inline float _acc_sStartpostInc()\t\t\t{ float tmp; _acc_sStart((tmp = _acc_gStart())+1); return tmp; }\r\n    inline float _acc_sStart$postInc()\t\t\t{ CHCKTHIS; return _acc_sStartpostInc(); }\r\n    inline float _acc_sStartpostDec()\t\t\t{ float tmp; _acc_sStart((tmp = _acc_gStart())-1); return tmp; }\r\n    inline float _acc_sStart$postDec()\t\t\t{ CHCKTHIS; return _acc_sStartpostDec(); }\r\n    inline float _acc_sStartpreInc()\t\t\t{ return _acc_sStart(_acc_gStart()+1); }\r\n    inline float _acc_sStart$preInc()\t\t\t{ CHCKTHIS; return _acc_sStartpreInc(); }\r\n    inline float _acc_sStartpreDec()\t\t\t{ return _acc_sStart(_acc_gStart()-1); }\r\n    inline float _acc_sStart$preDec()\t\t\t{ CHCKTHIS; return _acc_sStartpreDec(); }\r\n    inline float _acc_sStartAddEq(float value)\t{ return _acc_sStart(_acc_gStart() + value); }\r\n    inline float _acc_sStart$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartAddEq(value); }\r\n    inline float _acc_sStartSubEq(float value)\t{ return _acc_sStart(_acc_gStart() - value); }\r\n    inline float _acc_sStart$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartSubEq(value); }\r\n    inline float _acc_sStartMulEq(float value)\t{ return _acc_sStart(_acc_gStart() * value); }\r\n    inline float _acc_sStart$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartMulEq(value); }\r\n    inline float _acc_sStartDivEq(float value)\t{ return _acc_sStart(_acc_gStart() / value); }\r\n    inline float _acc_sStart$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartDivEq(value); }\r\n    inline float _acc_sStartModEq(float value)\t{  float orig = _acc_gStart(); s32 tmp = (s32)(orig / value); return _acc_sStart(orig - (tmp * value)); }\r\n    inline float _acc_sStart$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sStartModEq(value); }\r\n    inline float _acc_gEnd();\r\n    inline float _acc_gEnd$();\r\n\r\n    inline float _acc_sEnd(float value);\r\n    inline float _acc_sEnd$(float value);\r\n    inline float _acc_sEndpostInc()\t\t\t{ float tmp; _acc_sEnd((tmp = _acc_gEnd())+1); return tmp; }\r\n    inline float _acc_sEnd$postInc()\t\t\t{ CHCKTHIS; return _acc_sEndpostInc(); }\r\n    inline float _acc_sEndpostDec()\t\t\t{ float tmp; _acc_sEnd((tmp = _acc_gEnd())-1); return tmp; }\r\n    inline float _acc_sEnd$postDec()\t\t\t{ CHCKTHIS; return _acc_sEndpostDec(); }\r\n    inline float _acc_sEndpreInc()\t\t\t{ return _acc_sEnd(_acc_gEnd()+1); }\r\n    inline float _acc_sEnd$preInc()\t\t\t{ CHCKTHIS; return _acc_sEndpreInc(); }\r\n    inline float _acc_sEndpreDec()\t\t\t{ return _acc_sEnd(_acc_gEnd()-1); }\r\n    inline float _acc_sEnd$preDec()\t\t\t{ CHCKTHIS; return _acc_sEndpreDec(); }\r\n    inline float _acc_sEndAddEq(float value)\t{ return _acc_sEnd(_acc_gEnd() + value); }\r\n    inline float _acc_sEnd$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndAddEq(value); }\r\n    inline float _acc_sEndSubEq(float value)\t{ return _acc_sEnd(_acc_gEnd() - value); }\r\n    inline float _acc_sEnd$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndSubEq(value); }\r\n    inline float _acc_sEndMulEq(float value)\t{ return _acc_sEnd(_acc_gEnd() * value); }\r\n    inline float _acc_sEnd$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndMulEq(value); }\r\n    inline float _acc_sEndDivEq(float value)\t{ return _acc_sEnd(_acc_gEnd() / value); }\r\n    inline float _acc_sEnd$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndDivEq(value); }\r\n    inline float _acc_sEndModEq(float value)\t{  float orig = _acc_gEnd(); s32 tmp = (s32)(orig / value); return _acc_sEnd(orig - (tmp * value)); }\r\n    inline float _acc_sEnd$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sEndModEq(value); }\r\n    inline System::String* _acc_gImageEmpty();\r\n    inline System::String* _acc_gImageEmpty$();\r\n\r\n    inline System::String* _acc_sImageEmpty(System::String* value);\r\n    inline System::String* _acc_sImageEmpty$(System::String* value);\r\n    inline System::String* _acc_gImageFull();\r\n    inline System::String* _acc_gImageFull$();\r\n\r\n    inline System::String* _acc_sImageFull(System::String* value);\r\n    inline System::String* _acc_sImageFull$(System::String* value);\r\n    inline System::String* _acc_gImageFilter();\r\n    inline System::String* _acc_gImageFilter$();\r\n\r\n    inline System::String* _acc_sImageFilter(System::String* value);\r\n    inline System::String* _acc_sImageFilter$(System::String* value);\r\n    inline float _acc_gValue();\r\n    inline float _acc_gValue$();\r\n\r\n    inline float _acc_sValue(float value);\r\n    inline float _acc_sValue$(float value);\r\n    inline float _acc_sValuepostInc()\t\t\t{ float tmp; _acc_sValue((tmp = _acc_gValue())+1); return tmp; }\r\n    inline float _acc_sValue$postInc()\t\t\t{ CHCKTHIS; return _acc_sValuepostInc(); }\r\n    inline float _acc_sValuepostDec()\t\t\t{ float tmp; _acc_sValue((tmp = _acc_gValue())-1); return tmp; }\r\n    inline float _acc_sValue$postDec()\t\t\t{ CHCKTHIS; return _acc_sValuepostDec(); }\r\n    inline float _acc_sValuepreInc()\t\t\t{ return _acc_sValue(_acc_gValue()+1); }\r\n    inline float _acc_sValue$preInc()\t\t\t{ CHCKTHIS; return _acc_sValuepreInc(); }\r\n    inline float _acc_sValuepreDec()\t\t\t{ return _acc_sValue(_acc_gValue()-1); }\r\n    inline float _acc_sValue$preDec()\t\t\t{ CHCKTHIS; return _acc_sValuepreDec(); }\r\n    inline float _acc_sValueAddEq(float value)\t{ return _acc_sValue(_acc_gValue() + value); }\r\n    inline float _acc_sValue$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueAddEq(value); }\r\n    inline float _acc_sValueSubEq(float value)\t{ return _acc_sValue(_acc_gValue() - value); }\r\n    inline float _acc_sValue$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueSubEq(value); }\r\n    inline float _acc_sValueMulEq(float value)\t{ return _acc_sValue(_acc_gValue() * value); }\r\n    inline float _acc_sValue$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueMulEq(value); }\r\n    inline float _acc_sValueDivEq(float value)\t{ return _acc_sValue(_acc_gValue() / value); }\r\n    inline float _acc_sValue$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueDivEq(value); }\r\n    inline float _acc_sValueModEq(float value)\t{  float orig = _acc_gValue(); s32 tmp = (s32)(orig / value); return _acc_sValue(orig - (tmp * value)); }\r\n    inline float _acc_sValue$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sValueModEq(value); }\r\n    inline bool _acc_gFilterVisible();\r\n    inline bool _acc_gFilterVisible$();\r\n\r\n    inline bool _acc_sFilterVisible(bool value);\r\n    inline bool _acc_sFilterVisible$(bool value);\r\n    inline u32 _acc_gFilterColor();\r\n    inline u32 _acc_gFilterColor$();\r\n\r\n    inline u32 _acc_sFilterColor(u32 value);\r\n    inline u32 _acc_sFilterColor$(u32 value);\r\n    inline u32 _acc_sFilterColorpostInc()\t\t\t{ u32 tmp; _acc_sFilterColor((tmp = _acc_gFilterColor())+1); return tmp; }\r\n    inline u32 _acc_sFilterColor$postInc()\t\t\t{ CHCKTHIS; return _acc_sFilterColorpostInc(); }\r\n    inline u32 _acc_sFilterColorpostDec()\t\t\t{ u32 tmp; _acc_sFilterColor((tmp = _acc_gFilterColor())-1); return tmp; }\r\n    inline u32 _acc_sFilterColor$postDec()\t\t\t{ CHCKTHIS; return _acc_sFilterColorpostDec(); }\r\n    inline u32 _acc_sFilterColorpreInc()\t\t\t{ return _acc_sFilterColor(_acc_gFilterColor()+1); }\r\n    inline u32 _acc_sFilterColor$preInc()\t\t\t{ CHCKTHIS; return _acc_sFilterColorpreInc(); }\r\n    inline u32 _acc_sFilterColorpreDec()\t\t\t{ return _acc_sFilterColor(_acc_gFilterColor()-1); }\r\n    inline u32 _acc_sFilterColor$preDec()\t\t\t{ CHCKTHIS; return _acc_sFilterColorpreDec(); }\r\n    inline u32 _acc_sFilterColorAddEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() + value); }\r\n    inline u32 _acc_sFilterColor$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorAddEq(value); }\r\n    inline u32 _acc_sFilterColorSubEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() - value); }\r\n    inline u32 _acc_sFilterColor$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorSubEq(value); }\r\n    inline u32 _acc_sFilterColorMulEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() * value); }\r\n    inline u32 _acc_sFilterColor$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorMulEq(value); }\r\n    inline u32 _acc_sFilterColorDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sFilterColor(_acc_gFilterColor() / value); }\r\n    inline u32 _acc_sFilterColor$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorDivEq(value); }\r\n    inline u32 _acc_sFilterColorModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sFilterColor(_acc_gFilterColor() % value); }\r\n    inline u32 _acc_sFilterColor$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorModEq(value); }\r\n    inline u32 _acc_sFilterColorXorEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() ^ value); }\r\n    inline u32 _acc_sFilterColor$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorXorEq(value); }\r\n    inline u32 _acc_sFilterColorAndEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() & value); }\r\n    inline u32 _acc_sFilterColor$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorAndEq(value); }\r\n    inline u32 _acc_sFilterColorOrEq(u32 value)\t\t{ return _acc_sFilterColor(_acc_gFilterColor() | value); }\r\n    inline u32 _acc_sFilterColor$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorOrEq(value); }\r\n    inline u32 _acc_sFilterColorRShiftEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() >> value); }\r\n    inline u32 _acc_sFilterColor$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorRShiftEq(value); }\r\n    inline u32 _acc_sFilterColorLShiftEq(u32 value)\t{ return _acc_sFilterColor(_acc_gFilterColor() << value); }\r\n    inline u32 _acc_sFilterColor$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFilterColorLShiftEq(value); }\r\n    static s32* _ext_CKLBUIProgressBar_create(s32* pParent,u32 order,float x,float y,float width,float height,s32* fullImage,s32* emptyImage,s32 startPix,s32 endPix,s32 anim,bool vert,s32* barfilterImage);\r\n    static u32 _ext_CKLBUIProgressBar_getOrder(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setOrder(s32* p,u32 order);\r\n    static float _ext_CKLBUIProgressBar_getWidth(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setWidth(s32* p,float width);\r\n    static float _ext_CKLBUIProgressBar_getHeight(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setHeight(s32* p,float height);\r\n    static bool _ext_CKLBUIProgressBar_getVertical(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setVertical(s32* p,bool vertical);\r\n    static u32 _ext_CKLBUIProgressBar_getAnimTime(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setAnimTime(s32* p,u32 time);\r\n    static float _ext_CKLBUIProgressBar_getStart(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setStart(s32* p,float start);\r\n    static float _ext_CKLBUIProgressBar_getEnd(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setEnd(s32* p,float end);\r\n    static float _ext_CKLBUIProgressBar_getValue(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setValue(s32* p,float value);\r\n    static s32* _ext_CKLBUIProgressBar_getImgEmpty(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setImgEmpty(s32* p,s32* imageEmpty);\r\n    static s32* _ext_CKLBUIProgressBar_getImgFull(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setImgFull(s32* p,s32* imageFull);\r\n    static s32* _ext_CKLBUIProgressBar_getImgFilter(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setImgFilter(s32* p,s32* imageFilter);\r\n    static void _ext_CKLBUIProgressBar_reset(s32* p);\r\n    static bool _ext_CKLBUIProgressBar_getFilterVisible(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setFilterVisible(s32* p,bool value);\r\n    static u32 _ext_CKLBUIProgressBar_getFilterColor(s32* p);\r\n    static void _ext_CKLBUIProgressBar_setFilterColor(s32* p,u32 value);\r\n    static bool _ext_CKLBUIProgressBar_setFilterAnim(s32* p,bool bColAnim,u32 argb1,u32 argb2,u32 freq);\r\n    CKLBUIProgressBar(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,System::String* imageFull,System::String* imageEmpty,s32 startPix,s32 endPix,s32 animTime,bool verticalFlag,System::String* barfilterImage);\r\n    CKLBUIProgressBar();\r\n    void getSize(EnginePrototype::FSize& size);\r\n    inline void getSize$(EnginePrototype::FSize& size);\r\n    void setSize(EnginePrototype::FSize size);\r\n    inline void setSize$(EnginePrototype::FSize size);\r\n    void setSize(float width,float height);\r\n    inline void setSize$(float width,float height);\r\n    void reset();\r\n    inline void reset$();\r\n    void complete();\r\n    inline void complete$();\r\n    bool setFilterAnim(bool bColAnim,u32 argb1,u32 argb2,u32 freq);\r\n    inline bool setFilterAnim$(bool bColAnim,u32 argb1,u32 argb2,u32 freq);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 224;\r\n};\r\nclass EnginePrototype::CKLBUIRubberBand : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIRubberBand();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline System::String* _acc_gAssetOrigin();\r\n    inline System::String* _acc_gAssetOrigin$();\r\n\r\n    inline System::String* _acc_gAssetJoint();\r\n    inline System::String* _acc_gAssetJoint$();\r\n\r\n    inline System::String* _acc_gAssetPoint();\r\n    inline System::String* _acc_gAssetPoint$();\r\n\r\n    inline float _acc_gOriginX();\r\n    inline float _acc_gOriginX$();\r\n\r\n    inline float _acc_sOriginX(float value);\r\n    inline float _acc_sOriginX$(float value);\r\n    inline float _acc_sOriginXpostInc()\t\t\t{ float tmp; _acc_sOriginX((tmp = _acc_gOriginX())+1); return tmp; }\r\n    inline float _acc_sOriginX$postInc()\t\t\t{ CHCKTHIS; return _acc_sOriginXpostInc(); }\r\n    inline float _acc_sOriginXpostDec()\t\t\t{ float tmp; _acc_sOriginX((tmp = _acc_gOriginX())-1); return tmp; }\r\n    inline float _acc_sOriginX$postDec()\t\t\t{ CHCKTHIS; return _acc_sOriginXpostDec(); }\r\n    inline float _acc_sOriginXpreInc()\t\t\t{ return _acc_sOriginX(_acc_gOriginX()+1); }\r\n    inline float _acc_sOriginX$preInc()\t\t\t{ CHCKTHIS; return _acc_sOriginXpreInc(); }\r\n    inline float _acc_sOriginXpreDec()\t\t\t{ return _acc_sOriginX(_acc_gOriginX()-1); }\r\n    inline float _acc_sOriginX$preDec()\t\t\t{ CHCKTHIS; return _acc_sOriginXpreDec(); }\r\n    inline float _acc_sOriginXAddEq(float value)\t{ return _acc_sOriginX(_acc_gOriginX() + value); }\r\n    inline float _acc_sOriginX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginXAddEq(value); }\r\n    inline float _acc_sOriginXSubEq(float value)\t{ return _acc_sOriginX(_acc_gOriginX() - value); }\r\n    inline float _acc_sOriginX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginXSubEq(value); }\r\n    inline float _acc_sOriginXMulEq(float value)\t{ return _acc_sOriginX(_acc_gOriginX() * value); }\r\n    inline float _acc_sOriginX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginXMulEq(value); }\r\n    inline float _acc_sOriginXDivEq(float value)\t{ return _acc_sOriginX(_acc_gOriginX() / value); }\r\n    inline float _acc_sOriginX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginXDivEq(value); }\r\n    inline float _acc_sOriginXModEq(float value)\t{  float orig = _acc_gOriginX(); s32 tmp = (s32)(orig / value); return _acc_sOriginX(orig - (tmp * value)); }\r\n    inline float _acc_sOriginX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginXModEq(value); }\r\n    inline float _acc_gOriginY();\r\n    inline float _acc_gOriginY$();\r\n\r\n    inline float _acc_sOriginY(float value);\r\n    inline float _acc_sOriginY$(float value);\r\n    inline float _acc_sOriginYpostInc()\t\t\t{ float tmp; _acc_sOriginY((tmp = _acc_gOriginY())+1); return tmp; }\r\n    inline float _acc_sOriginY$postInc()\t\t\t{ CHCKTHIS; return _acc_sOriginYpostInc(); }\r\n    inline float _acc_sOriginYpostDec()\t\t\t{ float tmp; _acc_sOriginY((tmp = _acc_gOriginY())-1); return tmp; }\r\n    inline float _acc_sOriginY$postDec()\t\t\t{ CHCKTHIS; return _acc_sOriginYpostDec(); }\r\n    inline float _acc_sOriginYpreInc()\t\t\t{ return _acc_sOriginY(_acc_gOriginY()+1); }\r\n    inline float _acc_sOriginY$preInc()\t\t\t{ CHCKTHIS; return _acc_sOriginYpreInc(); }\r\n    inline float _acc_sOriginYpreDec()\t\t\t{ return _acc_sOriginY(_acc_gOriginY()-1); }\r\n    inline float _acc_sOriginY$preDec()\t\t\t{ CHCKTHIS; return _acc_sOriginYpreDec(); }\r\n    inline float _acc_sOriginYAddEq(float value)\t{ return _acc_sOriginY(_acc_gOriginY() + value); }\r\n    inline float _acc_sOriginY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginYAddEq(value); }\r\n    inline float _acc_sOriginYSubEq(float value)\t{ return _acc_sOriginY(_acc_gOriginY() - value); }\r\n    inline float _acc_sOriginY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginYSubEq(value); }\r\n    inline float _acc_sOriginYMulEq(float value)\t{ return _acc_sOriginY(_acc_gOriginY() * value); }\r\n    inline float _acc_sOriginY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginYMulEq(value); }\r\n    inline float _acc_sOriginYDivEq(float value)\t{ return _acc_sOriginY(_acc_gOriginY() / value); }\r\n    inline float _acc_sOriginY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginYDivEq(value); }\r\n    inline float _acc_sOriginYModEq(float value)\t{  float orig = _acc_gOriginY(); s32 tmp = (s32)(orig / value); return _acc_sOriginY(orig - (tmp * value)); }\r\n    inline float _acc_sOriginY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sOriginYModEq(value); }\r\n    inline float _acc_gPointX();\r\n    inline float _acc_gPointX$();\r\n\r\n    inline float _acc_sPointX(float value);\r\n    inline float _acc_sPointX$(float value);\r\n    inline float _acc_sPointXpostInc()\t\t\t{ float tmp; _acc_sPointX((tmp = _acc_gPointX())+1); return tmp; }\r\n    inline float _acc_sPointX$postInc()\t\t\t{ CHCKTHIS; return _acc_sPointXpostInc(); }\r\n    inline float _acc_sPointXpostDec()\t\t\t{ float tmp; _acc_sPointX((tmp = _acc_gPointX())-1); return tmp; }\r\n    inline float _acc_sPointX$postDec()\t\t\t{ CHCKTHIS; return _acc_sPointXpostDec(); }\r\n    inline float _acc_sPointXpreInc()\t\t\t{ return _acc_sPointX(_acc_gPointX()+1); }\r\n    inline float _acc_sPointX$preInc()\t\t\t{ CHCKTHIS; return _acc_sPointXpreInc(); }\r\n    inline float _acc_sPointXpreDec()\t\t\t{ return _acc_sPointX(_acc_gPointX()-1); }\r\n    inline float _acc_sPointX$preDec()\t\t\t{ CHCKTHIS; return _acc_sPointXpreDec(); }\r\n    inline float _acc_sPointXAddEq(float value)\t{ return _acc_sPointX(_acc_gPointX() + value); }\r\n    inline float _acc_sPointX$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointXAddEq(value); }\r\n    inline float _acc_sPointXSubEq(float value)\t{ return _acc_sPointX(_acc_gPointX() - value); }\r\n    inline float _acc_sPointX$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointXSubEq(value); }\r\n    inline float _acc_sPointXMulEq(float value)\t{ return _acc_sPointX(_acc_gPointX() * value); }\r\n    inline float _acc_sPointX$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointXMulEq(value); }\r\n    inline float _acc_sPointXDivEq(float value)\t{ return _acc_sPointX(_acc_gPointX() / value); }\r\n    inline float _acc_sPointX$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointXDivEq(value); }\r\n    inline float _acc_sPointXModEq(float value)\t{  float orig = _acc_gPointX(); s32 tmp = (s32)(orig / value); return _acc_sPointX(orig - (tmp * value)); }\r\n    inline float _acc_sPointX$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointXModEq(value); }\r\n    inline float _acc_gPointY();\r\n    inline float _acc_gPointY$();\r\n\r\n    inline float _acc_sPointY(float value);\r\n    inline float _acc_sPointY$(float value);\r\n    inline float _acc_sPointYpostInc()\t\t\t{ float tmp; _acc_sPointY((tmp = _acc_gPointY())+1); return tmp; }\r\n    inline float _acc_sPointY$postInc()\t\t\t{ CHCKTHIS; return _acc_sPointYpostInc(); }\r\n    inline float _acc_sPointYpostDec()\t\t\t{ float tmp; _acc_sPointY((tmp = _acc_gPointY())-1); return tmp; }\r\n    inline float _acc_sPointY$postDec()\t\t\t{ CHCKTHIS; return _acc_sPointYpostDec(); }\r\n    inline float _acc_sPointYpreInc()\t\t\t{ return _acc_sPointY(_acc_gPointY()+1); }\r\n    inline float _acc_sPointY$preInc()\t\t\t{ CHCKTHIS; return _acc_sPointYpreInc(); }\r\n    inline float _acc_sPointYpreDec()\t\t\t{ return _acc_sPointY(_acc_gPointY()-1); }\r\n    inline float _acc_sPointY$preDec()\t\t\t{ CHCKTHIS; return _acc_sPointYpreDec(); }\r\n    inline float _acc_sPointYAddEq(float value)\t{ return _acc_sPointY(_acc_gPointY() + value); }\r\n    inline float _acc_sPointY$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointYAddEq(value); }\r\n    inline float _acc_sPointYSubEq(float value)\t{ return _acc_sPointY(_acc_gPointY() - value); }\r\n    inline float _acc_sPointY$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointYSubEq(value); }\r\n    inline float _acc_sPointYMulEq(float value)\t{ return _acc_sPointY(_acc_gPointY() * value); }\r\n    inline float _acc_sPointY$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointYMulEq(value); }\r\n    inline float _acc_sPointYDivEq(float value)\t{ return _acc_sPointY(_acc_gPointY() / value); }\r\n    inline float _acc_sPointY$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointYDivEq(value); }\r\n    inline float _acc_sPointYModEq(float value)\t{  float orig = _acc_gPointY(); s32 tmp = (s32)(orig / value); return _acc_sPointY(orig - (tmp * value)); }\r\n    inline float _acc_sPointY$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sPointYModEq(value); }\r\n    inline bool _acc_gAnimFlag();\r\n    inline bool _acc_gAnimFlag$();\r\n\r\n    inline bool _acc_sAnimFlag(bool value);\r\n    inline bool _acc_sAnimFlag$(bool value);\r\n    inline bool _acc_gRealTimeFlag();\r\n    inline bool _acc_gRealTimeFlag$();\r\n\r\n    inline bool _acc_sRealTimeFlag(bool value);\r\n    inline bool _acc_sRealTimeFlag$(bool value);\r\n    inline u32 _acc_gAnimTime();\r\n    inline u32 _acc_gAnimTime$();\r\n\r\n    inline u32 _acc_sAnimTime(u32 value);\r\n    inline u32 _acc_sAnimTime$(u32 value);\r\n    inline u32 _acc_sAnimTimepostInc()\t\t\t{ u32 tmp; _acc_sAnimTime((tmp = _acc_gAnimTime())+1); return tmp; }\r\n    inline u32 _acc_sAnimTime$postInc()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepostInc(); }\r\n    inline u32 _acc_sAnimTimepostDec()\t\t\t{ u32 tmp; _acc_sAnimTime((tmp = _acc_gAnimTime())-1); return tmp; }\r\n    inline u32 _acc_sAnimTime$postDec()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepostDec(); }\r\n    inline u32 _acc_sAnimTimepreInc()\t\t\t{ return _acc_sAnimTime(_acc_gAnimTime()+1); }\r\n    inline u32 _acc_sAnimTime$preInc()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepreInc(); }\r\n    inline u32 _acc_sAnimTimepreDec()\t\t\t{ return _acc_sAnimTime(_acc_gAnimTime()-1); }\r\n    inline u32 _acc_sAnimTime$preDec()\t\t\t{ CHCKTHIS; return _acc_sAnimTimepreDec(); }\r\n    inline u32 _acc_sAnimTimeAddEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() + value); }\r\n    inline u32 _acc_sAnimTime$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeAddEq(value); }\r\n    inline u32 _acc_sAnimTimeSubEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() - value); }\r\n    inline u32 _acc_sAnimTime$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeSubEq(value); }\r\n    inline u32 _acc_sAnimTimeMulEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() * value); }\r\n    inline u32 _acc_sAnimTime$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeMulEq(value); }\r\n    inline u32 _acc_sAnimTimeDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sAnimTime(_acc_gAnimTime() / value); }\r\n    inline u32 _acc_sAnimTime$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeDivEq(value); }\r\n    inline u32 _acc_sAnimTimeModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sAnimTime(_acc_gAnimTime() % value); }\r\n    inline u32 _acc_sAnimTime$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeModEq(value); }\r\n    inline u32 _acc_sAnimTimeXorEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() ^ value); }\r\n    inline u32 _acc_sAnimTime$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeXorEq(value); }\r\n    inline u32 _acc_sAnimTimeAndEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() & value); }\r\n    inline u32 _acc_sAnimTime$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeAndEq(value); }\r\n    inline u32 _acc_sAnimTimeOrEq(u32 value)\t\t{ return _acc_sAnimTime(_acc_gAnimTime() | value); }\r\n    inline u32 _acc_sAnimTime$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeOrEq(value); }\r\n    inline u32 _acc_sAnimTimeRShiftEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() >> value); }\r\n    inline u32 _acc_sAnimTime$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeRShiftEq(value); }\r\n    inline u32 _acc_sAnimTimeLShiftEq(u32 value)\t{ return _acc_sAnimTime(_acc_gAnimTime() << value); }\r\n    inline u32 _acc_sAnimTime$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sAnimTimeLShiftEq(value); }\r\n    static s32* _ext_CKLBUIRubberBand_create(s32* pParent,u32 order,float x,float y,u32 resolution,s32* origin,s32* joint,s32* point,u32 flags,u32 animTime,s32 joint_order_off,s32 point_order_off,bool rot_origin,bool rot_joint,bool rot_point);\r\n    static float _ext_CKLBUIRubberBand_getOriginX(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setOriginX(s32* p,float x);\r\n    static float _ext_CKLBUIRubberBand_getOriginY(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setOriginY(s32* p,float y);\r\n    static float _ext_CKLBUIRubberBand_getPointX(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setPointX(s32* p,float x);\r\n    static float _ext_CKLBUIRubberBand_getPointY(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setPointY(s32* p,float y);\r\n    static bool _ext_CKLBUIRubberBand_getFAnim(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setFAnim(s32* p,bool fAnim);\r\n    static bool _ext_CKLBUIRubberBand_getFAnimRT(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setFAnimRT(s32* p,bool fAnimRT);\r\n    static u32 _ext_CKLBUIRubberBand_getAnimTime(s32* p);\r\n    static void _ext_CKLBUIRubberBand_setAnimTime(s32* p,u32 animTime);\r\n    static u32 _ext_CKLBUIRubberBand_getOrder(s32* p);\r\n    static s32* _ext_CKLBUIRubberBand_getAssetOrigin(s32* p);\r\n    static s32* _ext_CKLBUIRubberBand_getAssetJoint(s32* p);\r\n    static s32* _ext_CKLBUIRubberBand_getAssetPoint(s32* p);\r\n    static bool _ext_CKLBUIRubberBand_setOrder(s32* p,u32 orderOrigin,u32 orderJoint,u32 orderPoint);\r\n    CKLBUIRubberBand(EnginePrototype::CKLBUITask* parent,u32 order,float origin_x,float origin_y,System::String* origin_asset,System::String* joint_asset,System::String* point_asset,u32 resolution,u32 option_flags,u32 animation_time,s32 joint_priority_offset,s32 point_priority_offset,bool rot_origin,bool rot_joint,bool rot_point);\r\n    CKLBUIRubberBand();\r\n    void setOrder(u32 orderOrigin,u32 orderJoint,u32 orderPoint);\r\n    inline void setOrder$(u32 orderOrigin,u32 orderJoint,u32 orderPoint);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 225;\r\n};\r\nclass EnginePrototype::CKLBUIScale9 : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIScale9();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline s32 _acc_gWidth();\r\n    inline s32 _acc_gWidth$();\r\n\r\n    inline s32 _acc_sWidth(s32 value);\r\n    inline s32 _acc_sWidth$(s32 value);\r\n    inline s32 _acc_sWidthpostInc()\t\t\t{ s32 tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline s32 _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline s32 _acc_sWidthpostDec()\t\t\t{ s32 tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline s32 _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline s32 _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline s32 _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline s32 _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline s32 _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline s32 _acc_sWidthAddEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline s32 _acc_sWidth$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline s32 _acc_sWidthSubEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline s32 _acc_sWidth$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline s32 _acc_sWidthMulEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline s32 _acc_sWidth$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline s32 _acc_sWidthDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline s32 _acc_sWidth$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline s32 _acc_sWidthModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() % value); }\r\n    inline s32 _acc_sWidth$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline s32 _acc_sWidthXorEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() ^ value); }\r\n    inline s32 _acc_sWidth$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthXorEq(value); }\r\n    inline s32 _acc_sWidthAndEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() & value); }\r\n    inline s32 _acc_sWidth$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAndEq(value); }\r\n    inline s32 _acc_sWidthOrEq(s32 value)\t\t{ return _acc_sWidth(_acc_gWidth() | value); }\r\n    inline s32 _acc_sWidth$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthOrEq(value); }\r\n    inline s32 _acc_sWidthRShiftEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() >> value); }\r\n    inline s32 _acc_sWidth$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthRShiftEq(value); }\r\n    inline s32 _acc_sWidthLShiftEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() << value); }\r\n    inline s32 _acc_sWidth$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthLShiftEq(value); }\r\n    inline s32 _acc_gHeight();\r\n    inline s32 _acc_gHeight$();\r\n\r\n    inline s32 _acc_sHeight(s32 value);\r\n    inline s32 _acc_sHeight$(s32 value);\r\n    inline s32 _acc_sHeightpostInc()\t\t\t{ s32 tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline s32 _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline s32 _acc_sHeightpostDec()\t\t\t{ s32 tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline s32 _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline s32 _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline s32 _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline s32 _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline s32 _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline s32 _acc_sHeightAddEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline s32 _acc_sHeight$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline s32 _acc_sHeightSubEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline s32 _acc_sHeight$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline s32 _acc_sHeightMulEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline s32 _acc_sHeight$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline s32 _acc_sHeightDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline s32 _acc_sHeight$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline s32 _acc_sHeightModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() % value); }\r\n    inline s32 _acc_sHeight$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline s32 _acc_sHeightXorEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() ^ value); }\r\n    inline s32 _acc_sHeight$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightXorEq(value); }\r\n    inline s32 _acc_sHeightAndEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() & value); }\r\n    inline s32 _acc_sHeight$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAndEq(value); }\r\n    inline s32 _acc_sHeightOrEq(s32 value)\t\t{ return _acc_sHeight(_acc_gHeight() | value); }\r\n    inline s32 _acc_sHeight$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightOrEq(value); }\r\n    inline s32 _acc_sHeightRShiftEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() >> value); }\r\n    inline s32 _acc_sHeight$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightRShiftEq(value); }\r\n    inline s32 _acc_sHeightLShiftEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() << value); }\r\n    inline s32 _acc_sHeight$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightLShiftEq(value); }\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    inline System::String* _acc_sAsset(System::String* value);\r\n    inline System::String* _acc_sAsset$(System::String* value);\r\n    static s32* _ext_CKLBUIScale9_create(s32* pParent,u32 order,float x,float y,s32 width,s32 height,s32* asset);\r\n    static s32 _ext_CKLBUIScale9_getWidth(s32* p);\r\n    static void _ext_CKLBUIScale9_setWidth(s32* p,s32 width);\r\n    static s32 _ext_CKLBUIScale9_getHeight(s32* p);\r\n    static void _ext_CKLBUIScale9_setHeight(s32* p,s32 height);\r\n    static u32 _ext_CKLBUIScale9_getOrder(s32* p);\r\n    static void _ext_CKLBUIScale9_setOrder(s32* p,u32 order);\r\n    static s32* _ext_CKLBUIScale9_getAsset(s32* p);\r\n    static bool _ext_CKLBUIScale9_setAsset(s32* p,s32* asset);\r\n    CKLBUIScale9(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,s32 width,s32 height,System::String* asset);\r\n    CKLBUIScale9();\r\n    void getSize(EnginePrototype::Size& size);\r\n    inline void getSize$(EnginePrototype::Size& size);\r\n    void setSize(EnginePrototype::Size size);\r\n    inline void setSize$(EnginePrototype::Size size);\r\n    void setSize(s32 width,s32 height);\r\n    inline void setSize$(s32 width,s32 height);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 226;\r\n};\r\nclass EnginePrototype::CKLBUIScore : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    enum EALIGN {\r\n        ALIGN_RIGHT = 0,\r\n        ALIGN_CENTER = 1,\r\n        ALIGN_LEFT = 2,\r\n        _ForceWORD_EALIGN = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUIScore();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline u32 _acc_gOdoff();\r\n    inline u32 _acc_gOdoff$();\r\n\r\n    inline s32 _acc_gStepX();\r\n    inline s32 _acc_gStepX$();\r\n\r\n    inline s32 _acc_sStepX(s32 value);\r\n    inline s32 _acc_sStepX$(s32 value);\r\n    inline s32 _acc_sStepXpostInc()\t\t\t{ s32 tmp; _acc_sStepX((tmp = _acc_gStepX())+1); return tmp; }\r\n    inline s32 _acc_sStepX$postInc()\t\t\t{ CHCKTHIS; return _acc_sStepXpostInc(); }\r\n    inline s32 _acc_sStepXpostDec()\t\t\t{ s32 tmp; _acc_sStepX((tmp = _acc_gStepX())-1); return tmp; }\r\n    inline s32 _acc_sStepX$postDec()\t\t\t{ CHCKTHIS; return _acc_sStepXpostDec(); }\r\n    inline s32 _acc_sStepXpreInc()\t\t\t{ return _acc_sStepX(_acc_gStepX()+1); }\r\n    inline s32 _acc_sStepX$preInc()\t\t\t{ CHCKTHIS; return _acc_sStepXpreInc(); }\r\n    inline s32 _acc_sStepXpreDec()\t\t\t{ return _acc_sStepX(_acc_gStepX()-1); }\r\n    inline s32 _acc_sStepX$preDec()\t\t\t{ CHCKTHIS; return _acc_sStepXpreDec(); }\r\n    inline s32 _acc_sStepXAddEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() + value); }\r\n    inline s32 _acc_sStepX$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXAddEq(value); }\r\n    inline s32 _acc_sStepXSubEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() - value); }\r\n    inline s32 _acc_sStepX$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXSubEq(value); }\r\n    inline s32 _acc_sStepXMulEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() * value); }\r\n    inline s32 _acc_sStepX$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXMulEq(value); }\r\n    inline s32 _acc_sStepXDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepX(_acc_gStepX() / value); }\r\n    inline s32 _acc_sStepX$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXDivEq(value); }\r\n    inline s32 _acc_sStepXModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepX(_acc_gStepX() % value); }\r\n    inline s32 _acc_sStepX$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXModEq(value); }\r\n    inline s32 _acc_sStepXXorEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() ^ value); }\r\n    inline s32 _acc_sStepX$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXXorEq(value); }\r\n    inline s32 _acc_sStepXAndEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() & value); }\r\n    inline s32 _acc_sStepX$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXAndEq(value); }\r\n    inline s32 _acc_sStepXOrEq(s32 value)\t\t{ return _acc_sStepX(_acc_gStepX() | value); }\r\n    inline s32 _acc_sStepX$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXOrEq(value); }\r\n    inline s32 _acc_sStepXRShiftEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() >> value); }\r\n    inline s32 _acc_sStepX$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXRShiftEq(value); }\r\n    inline s32 _acc_sStepXLShiftEq(s32 value)\t{ return _acc_sStepX(_acc_gStepX() << value); }\r\n    inline s32 _acc_sStepX$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepXLShiftEq(value); }\r\n    inline s32 _acc_gStepY();\r\n    inline s32 _acc_gStepY$();\r\n\r\n    inline s32 _acc_sStepY(s32 value);\r\n    inline s32 _acc_sStepY$(s32 value);\r\n    inline s32 _acc_sStepYpostInc()\t\t\t{ s32 tmp; _acc_sStepY((tmp = _acc_gStepY())+1); return tmp; }\r\n    inline s32 _acc_sStepY$postInc()\t\t\t{ CHCKTHIS; return _acc_sStepYpostInc(); }\r\n    inline s32 _acc_sStepYpostDec()\t\t\t{ s32 tmp; _acc_sStepY((tmp = _acc_gStepY())-1); return tmp; }\r\n    inline s32 _acc_sStepY$postDec()\t\t\t{ CHCKTHIS; return _acc_sStepYpostDec(); }\r\n    inline s32 _acc_sStepYpreInc()\t\t\t{ return _acc_sStepY(_acc_gStepY()+1); }\r\n    inline s32 _acc_sStepY$preInc()\t\t\t{ CHCKTHIS; return _acc_sStepYpreInc(); }\r\n    inline s32 _acc_sStepYpreDec()\t\t\t{ return _acc_sStepY(_acc_gStepY()-1); }\r\n    inline s32 _acc_sStepY$preDec()\t\t\t{ CHCKTHIS; return _acc_sStepYpreDec(); }\r\n    inline s32 _acc_sStepYAddEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() + value); }\r\n    inline s32 _acc_sStepY$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYAddEq(value); }\r\n    inline s32 _acc_sStepYSubEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() - value); }\r\n    inline s32 _acc_sStepY$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYSubEq(value); }\r\n    inline s32 _acc_sStepYMulEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() * value); }\r\n    inline s32 _acc_sStepY$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYMulEq(value); }\r\n    inline s32 _acc_sStepYDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepY(_acc_gStepY() / value); }\r\n    inline s32 _acc_sStepY$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYDivEq(value); }\r\n    inline s32 _acc_sStepYModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStepY(_acc_gStepY() % value); }\r\n    inline s32 _acc_sStepY$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYModEq(value); }\r\n    inline s32 _acc_sStepYXorEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() ^ value); }\r\n    inline s32 _acc_sStepY$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYXorEq(value); }\r\n    inline s32 _acc_sStepYAndEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() & value); }\r\n    inline s32 _acc_sStepY$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYAndEq(value); }\r\n    inline s32 _acc_sStepYOrEq(s32 value)\t\t{ return _acc_sStepY(_acc_gStepY() | value); }\r\n    inline s32 _acc_sStepY$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYOrEq(value); }\r\n    inline s32 _acc_sStepYRShiftEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() >> value); }\r\n    inline s32 _acc_sStepY$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYRShiftEq(value); }\r\n    inline s32 _acc_sStepYLShiftEq(s32 value)\t{ return _acc_sStepY(_acc_gStepY() << value); }\r\n    inline s32 _acc_sStepY$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStepYLShiftEq(value); }\r\n    inline u32 _acc_gCols();\r\n    inline u32 _acc_gCols$();\r\n\r\n    inline u32 _acc_sCols(u32 value);\r\n    inline u32 _acc_sCols$(u32 value);\r\n    inline u32 _acc_sColspostInc()\t\t\t{ u32 tmp; _acc_sCols((tmp = _acc_gCols())+1); return tmp; }\r\n    inline u32 _acc_sCols$postInc()\t\t\t{ CHCKTHIS; return _acc_sColspostInc(); }\r\n    inline u32 _acc_sColspostDec()\t\t\t{ u32 tmp; _acc_sCols((tmp = _acc_gCols())-1); return tmp; }\r\n    inline u32 _acc_sCols$postDec()\t\t\t{ CHCKTHIS; return _acc_sColspostDec(); }\r\n    inline u32 _acc_sColspreInc()\t\t\t{ return _acc_sCols(_acc_gCols()+1); }\r\n    inline u32 _acc_sCols$preInc()\t\t\t{ CHCKTHIS; return _acc_sColspreInc(); }\r\n    inline u32 _acc_sColspreDec()\t\t\t{ return _acc_sCols(_acc_gCols()-1); }\r\n    inline u32 _acc_sCols$preDec()\t\t\t{ CHCKTHIS; return _acc_sColspreDec(); }\r\n    inline u32 _acc_sColsAddEq(u32 value)\t{ return _acc_sCols(_acc_gCols() + value); }\r\n    inline u32 _acc_sCols$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsAddEq(value); }\r\n    inline u32 _acc_sColsSubEq(u32 value)\t{ return _acc_sCols(_acc_gCols() - value); }\r\n    inline u32 _acc_sCols$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsSubEq(value); }\r\n    inline u32 _acc_sColsMulEq(u32 value)\t{ return _acc_sCols(_acc_gCols() * value); }\r\n    inline u32 _acc_sCols$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsMulEq(value); }\r\n    inline u32 _acc_sColsDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sCols(_acc_gCols() / value); }\r\n    inline u32 _acc_sCols$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsDivEq(value); }\r\n    inline u32 _acc_sColsModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sCols(_acc_gCols() % value); }\r\n    inline u32 _acc_sCols$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsModEq(value); }\r\n    inline u32 _acc_sColsXorEq(u32 value)\t{ return _acc_sCols(_acc_gCols() ^ value); }\r\n    inline u32 _acc_sCols$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsXorEq(value); }\r\n    inline u32 _acc_sColsAndEq(u32 value)\t{ return _acc_sCols(_acc_gCols() & value); }\r\n    inline u32 _acc_sCols$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsAndEq(value); }\r\n    inline u32 _acc_sColsOrEq(u32 value)\t\t{ return _acc_sCols(_acc_gCols() | value); }\r\n    inline u32 _acc_sCols$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsOrEq(value); }\r\n    inline u32 _acc_sColsRShiftEq(u32 value)\t{ return _acc_sCols(_acc_gCols() >> value); }\r\n    inline u32 _acc_sCols$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsRShiftEq(value); }\r\n    inline u32 _acc_sColsLShiftEq(u32 value)\t{ return _acc_sCols(_acc_gCols() << value); }\r\n    inline u32 _acc_sCols$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sColsLShiftEq(value); }\r\n    inline bool _acc_gFillZero();\r\n    inline bool _acc_gFillZero$();\r\n\r\n    inline bool _acc_sFillZero(bool value);\r\n    inline bool _acc_sFillZero$(bool value);\r\n    inline bool _acc_gIsAnim();\r\n    inline bool _acc_gIsAnim$();\r\n\r\n    inline u32 _acc_gValue();\r\n    inline u32 _acc_gValue$();\r\n\r\n    inline u32 _acc_sValue(u32 value);\r\n    inline u32 _acc_sValue$(u32 value);\r\n    inline u32 _acc_sValuepostInc()\t\t\t{ u32 tmp; _acc_sValue((tmp = _acc_gValue())+1); return tmp; }\r\n    inline u32 _acc_sValue$postInc()\t\t\t{ CHCKTHIS; return _acc_sValuepostInc(); }\r\n    inline u32 _acc_sValuepostDec()\t\t\t{ u32 tmp; _acc_sValue((tmp = _acc_gValue())-1); return tmp; }\r\n    inline u32 _acc_sValue$postDec()\t\t\t{ CHCKTHIS; return _acc_sValuepostDec(); }\r\n    inline u32 _acc_sValuepreInc()\t\t\t{ return _acc_sValue(_acc_gValue()+1); }\r\n    inline u32 _acc_sValue$preInc()\t\t\t{ CHCKTHIS; return _acc_sValuepreInc(); }\r\n    inline u32 _acc_sValuepreDec()\t\t\t{ return _acc_sValue(_acc_gValue()-1); }\r\n    inline u32 _acc_sValue$preDec()\t\t\t{ CHCKTHIS; return _acc_sValuepreDec(); }\r\n    inline u32 _acc_sValueAddEq(u32 value)\t{ return _acc_sValue(_acc_gValue() + value); }\r\n    inline u32 _acc_sValue$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueAddEq(value); }\r\n    inline u32 _acc_sValueSubEq(u32 value)\t{ return _acc_sValue(_acc_gValue() - value); }\r\n    inline u32 _acc_sValue$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueSubEq(value); }\r\n    inline u32 _acc_sValueMulEq(u32 value)\t{ return _acc_sValue(_acc_gValue() * value); }\r\n    inline u32 _acc_sValue$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueMulEq(value); }\r\n    inline u32 _acc_sValueDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sValue(_acc_gValue() / value); }\r\n    inline u32 _acc_sValue$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueDivEq(value); }\r\n    inline u32 _acc_sValueModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sValue(_acc_gValue() % value); }\r\n    inline u32 _acc_sValue$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueModEq(value); }\r\n    inline u32 _acc_sValueXorEq(u32 value)\t{ return _acc_sValue(_acc_gValue() ^ value); }\r\n    inline u32 _acc_sValue$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueXorEq(value); }\r\n    inline u32 _acc_sValueAndEq(u32 value)\t{ return _acc_sValue(_acc_gValue() & value); }\r\n    inline u32 _acc_sValue$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueAndEq(value); }\r\n    inline u32 _acc_sValueOrEq(u32 value)\t\t{ return _acc_sValue(_acc_gValue() | value); }\r\n    inline u32 _acc_sValue$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueOrEq(value); }\r\n    inline u32 _acc_sValueRShiftEq(u32 value)\t{ return _acc_sValue(_acc_gValue() >> value); }\r\n    inline u32 _acc_sValue$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueRShiftEq(value); }\r\n    inline u32 _acc_sValueLShiftEq(u32 value)\t{ return _acc_sValue(_acc_gValue() << value); }\r\n    inline u32 _acc_sValue$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sValueLShiftEq(value); }\r\n    inline s32 _acc_gAlign();\r\n    inline s32 _acc_gAlign$();\r\n\r\n    inline s32 _acc_sAlign(s32 value);\r\n    inline s32 _acc_sAlign$(s32 value);\r\n    inline s32 _acc_sAlignpostInc()\t\t\t{ s32 tmp = _acc_gAlign(); _acc_sAlign((s32)((s32)tmp + 1)); return tmp; }\r\n    inline s32 _acc_sAlign$postInc()\t\t\t{ CHCKTHIS; return _acc_sAlignpostInc(); }\r\n    inline s32 _acc_sAlignpostDec()\t\t\t{ s32 tmp = _acc_gAlign(); _acc_sAlign((s32)((s32)tmp - 1)); return tmp; }\r\n    inline s32 _acc_sAlign$postDec()\t\t\t{ CHCKTHIS; return _acc_sAlignpostDec(); }\r\n    inline s32 _acc_sAlignpreInc()\t\t\t{ return _acc_sAlign((s32)((s32)_acc_gAlign()+1)); }\r\n    inline s32 _acc_sAlign$preInc()\t\t\t{ CHCKTHIS; return _acc_sAlignpreInc(); }\r\n    inline s32 _acc_sAlignpreDec()\t\t\t{ return _acc_sAlign((s32)((s32)_acc_gAlign()-1)); }\r\n    inline s32 _acc_sAlign$preDec()\t\t\t{ CHCKTHIS; return _acc_sAlignpreDec(); }\r\n    inline s32 _acc_sAlignAddEq(s32 value)\t{ return _acc_sAlign((s32)((s32)_acc_gAlign() + value)); }\r\n    inline s32 _acc_sAlign$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sAlignAddEq(value); }\r\n    inline s32 _acc_sAlignSubEq(s32 value)\t{ return _acc_sAlign((s32)((s32)_acc_gAlign() - value)); }\r\n    inline s32 _acc_sAlign$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sAlignSubEq(value); }\r\n    inline bool _acc_gCountClip();\r\n    inline bool _acc_gCountClip$();\r\n\r\n    inline bool _acc_sCountClip(bool value);\r\n    inline bool _acc_sCountClip$(bool value);\r\n    inline System::Array<System::String*>* _acc_gTextures();\r\n    inline System::Array<System::String*>* _acc_gTextures$();\r\n\r\n    static s32* _ext_CKLBUIScore_create(s32* pParent,u32 order,s32 orderOffset,float x,float y,System::Array<s32*>* texTable,float stepX,float stepY,s32 column,bool fillZero,bool animFlags,u32 align,bool countClip);\r\n    static u32 _ext_CKLBUIScore_getValue(s32* p);\r\n    static void _ext_CKLBUIScore_setValue(s32* p,u32 value);\r\n    static u32 _ext_CKLBUIScore_getOrder(s32* p);\r\n    static void _ext_CKLBUIScore_setOrder(s32* p,u32 value);\r\n    static u32 _ext_CKLBUIScore_getOrderOffset(s32* p);\r\n    static s32 _ext_CKLBUIScore_getStepX(s32* p);\r\n    static void _ext_CKLBUIScore_setStepX(s32* p,s32 value);\r\n    static s32 _ext_CKLBUIScore_getStepY(s32* p);\r\n    static void _ext_CKLBUIScore_setStepY(s32* p,s32 value);\r\n    static u32 _ext_CKLBUIScore_getColumn(s32* p);\r\n    static void _ext_CKLBUIScore_setColumn(s32* p,u32 value);\r\n    static bool _ext_CKLBUIScore_getFillZero(s32* p);\r\n    static void _ext_CKLBUIScore_setFillZero(s32* p,bool value);\r\n    static bool _ext_CKLBUIScore_getAnim(s32* p);\r\n    static s32 _ext_CKLBUIScore_getAlign(s32* p);\r\n    static void _ext_CKLBUIScore_setAlign(s32* p,s32 align);\r\n    static s32* _ext_CKLBUIScore_getTextures(s32* p);\r\n    static bool _ext_CKLBUIScore_getCountClip(s32* p);\r\n    static void _ext_CKLBUIScore_setCountClip(s32* p,bool value);\r\n    static void _ext_CKLBUIScore_setEnterAnimation(s32* p,u32 milliSecondsPlayTime,s32 timeShift,u32 type,u32 affected,System::Array<float>* arrayParam);\r\n    static void _ext_CKLBUIScore_setExitAnimation(s32* p,u32 milliSecondsPlayTime,s32 timeShift,u32 type,u32 affected,System::Array<float>* arrayParam);\r\n    CKLBUIScore(EnginePrototype::CKLBUITask* parent,u32 order,s32 orderOffset,float x,float y,System::Array<System::String*>* textureTable,float stepX,float stepY,s32 column,bool fillZeroFlag,bool animationFlag,s32 align,bool countClip);\r\n    CKLBUIScore();\r\n    void reset();\r\n    inline void reset$();\r\n    void enterAnim(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift);\r\n    inline void enterAnim$(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift);\r\n    void exitAnim(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift);\r\n    inline void exitAnim$(EnginePrototype::AnimationInfo* animation,u32 msPlayTime,s32 timeShift);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 229;\r\n};\r\nclass EnginePrototype::CKLBUIScrollBar : public EnginePrototype::CKLBUITask {\r\nfriend class ScrollBarCallBack_inner46;\r\n\r\npublic:\r\n    enum ETYPE {\r\n        SCROLLBAR_DRAG = 0,\r\n        SCROLLBAR_RELEASE = 1,\r\n        _ForceWORD_ETYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUIScrollBar();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* _sm_callback(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* _$value);\r\n    inline EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* _sm_callback$(EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* _$value);\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline s32 _acc_gWidth();\r\n    inline s32 _acc_gWidth$();\r\n\r\n    inline s32 _acc_sWidth(s32 value);\r\n    inline s32 _acc_sWidth$(s32 value);\r\n    inline s32 _acc_sWidthpostInc()\t\t\t{ s32 tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline s32 _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline s32 _acc_sWidthpostDec()\t\t\t{ s32 tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline s32 _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline s32 _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline s32 _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline s32 _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline s32 _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline s32 _acc_sWidthAddEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline s32 _acc_sWidth$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline s32 _acc_sWidthSubEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline s32 _acc_sWidth$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline s32 _acc_sWidthMulEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline s32 _acc_sWidth$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline s32 _acc_sWidthDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline s32 _acc_sWidth$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline s32 _acc_sWidthModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() % value); }\r\n    inline s32 _acc_sWidth$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline s32 _acc_sWidthXorEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() ^ value); }\r\n    inline s32 _acc_sWidth$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthXorEq(value); }\r\n    inline s32 _acc_sWidthAndEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() & value); }\r\n    inline s32 _acc_sWidth$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAndEq(value); }\r\n    inline s32 _acc_sWidthOrEq(s32 value)\t\t{ return _acc_sWidth(_acc_gWidth() | value); }\r\n    inline s32 _acc_sWidth$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthOrEq(value); }\r\n    inline s32 _acc_sWidthRShiftEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() >> value); }\r\n    inline s32 _acc_sWidth$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthRShiftEq(value); }\r\n    inline s32 _acc_sWidthLShiftEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() << value); }\r\n    inline s32 _acc_sWidth$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthLShiftEq(value); }\r\n    inline s32 _acc_gHeight();\r\n    inline s32 _acc_gHeight$();\r\n\r\n    inline s32 _acc_sHeight(s32 value);\r\n    inline s32 _acc_sHeight$(s32 value);\r\n    inline s32 _acc_sHeightpostInc()\t\t\t{ s32 tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline s32 _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline s32 _acc_sHeightpostDec()\t\t\t{ s32 tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline s32 _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline s32 _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline s32 _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline s32 _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline s32 _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline s32 _acc_sHeightAddEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline s32 _acc_sHeight$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline s32 _acc_sHeightSubEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline s32 _acc_sHeight$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline s32 _acc_sHeightMulEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline s32 _acc_sHeight$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline s32 _acc_sHeightDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline s32 _acc_sHeight$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline s32 _acc_sHeightModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() % value); }\r\n    inline s32 _acc_sHeight$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline s32 _acc_sHeightXorEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() ^ value); }\r\n    inline s32 _acc_sHeight$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightXorEq(value); }\r\n    inline s32 _acc_sHeightAndEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() & value); }\r\n    inline s32 _acc_sHeight$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAndEq(value); }\r\n    inline s32 _acc_sHeightOrEq(s32 value)\t\t{ return _acc_sHeight(_acc_gHeight() | value); }\r\n    inline s32 _acc_sHeight$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightOrEq(value); }\r\n    inline s32 _acc_sHeightRShiftEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() >> value); }\r\n    inline s32 _acc_sHeight$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightRShiftEq(value); }\r\n    inline s32 _acc_sHeightLShiftEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() << value); }\r\n    inline s32 _acc_sHeight$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightLShiftEq(value); }\r\n    inline s32 _acc_gStart();\r\n    inline s32 _acc_gStart$();\r\n\r\n    inline s32 _acc_sStart(s32 value);\r\n    inline s32 _acc_sStart$(s32 value);\r\n    inline s32 _acc_sStartpostInc()\t\t\t{ s32 tmp; _acc_sStart((tmp = _acc_gStart())+1); return tmp; }\r\n    inline s32 _acc_sStart$postInc()\t\t\t{ CHCKTHIS; return _acc_sStartpostInc(); }\r\n    inline s32 _acc_sStartpostDec()\t\t\t{ s32 tmp; _acc_sStart((tmp = _acc_gStart())-1); return tmp; }\r\n    inline s32 _acc_sStart$postDec()\t\t\t{ CHCKTHIS; return _acc_sStartpostDec(); }\r\n    inline s32 _acc_sStartpreInc()\t\t\t{ return _acc_sStart(_acc_gStart()+1); }\r\n    inline s32 _acc_sStart$preInc()\t\t\t{ CHCKTHIS; return _acc_sStartpreInc(); }\r\n    inline s32 _acc_sStartpreDec()\t\t\t{ return _acc_sStart(_acc_gStart()-1); }\r\n    inline s32 _acc_sStart$preDec()\t\t\t{ CHCKTHIS; return _acc_sStartpreDec(); }\r\n    inline s32 _acc_sStartAddEq(s32 value)\t{ return _acc_sStart(_acc_gStart() + value); }\r\n    inline s32 _acc_sStart$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartAddEq(value); }\r\n    inline s32 _acc_sStartSubEq(s32 value)\t{ return _acc_sStart(_acc_gStart() - value); }\r\n    inline s32 _acc_sStart$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartSubEq(value); }\r\n    inline s32 _acc_sStartMulEq(s32 value)\t{ return _acc_sStart(_acc_gStart() * value); }\r\n    inline s32 _acc_sStart$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartMulEq(value); }\r\n    inline s32 _acc_sStartDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStart(_acc_gStart() / value); }\r\n    inline s32 _acc_sStart$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartDivEq(value); }\r\n    inline s32 _acc_sStartModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sStart(_acc_gStart() % value); }\r\n    inline s32 _acc_sStart$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartModEq(value); }\r\n    inline s32 _acc_sStartXorEq(s32 value)\t{ return _acc_sStart(_acc_gStart() ^ value); }\r\n    inline s32 _acc_sStart$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartXorEq(value); }\r\n    inline s32 _acc_sStartAndEq(s32 value)\t{ return _acc_sStart(_acc_gStart() & value); }\r\n    inline s32 _acc_sStart$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartAndEq(value); }\r\n    inline s32 _acc_sStartOrEq(s32 value)\t\t{ return _acc_sStart(_acc_gStart() | value); }\r\n    inline s32 _acc_sStart$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartOrEq(value); }\r\n    inline s32 _acc_sStartRShiftEq(s32 value)\t{ return _acc_sStart(_acc_gStart() >> value); }\r\n    inline s32 _acc_sStart$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartRShiftEq(value); }\r\n    inline s32 _acc_sStartLShiftEq(s32 value)\t{ return _acc_sStart(_acc_gStart() << value); }\r\n    inline s32 _acc_sStart$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sStartLShiftEq(value); }\r\n    inline s32 _acc_gEnd();\r\n    inline s32 _acc_gEnd$();\r\n\r\n    inline s32 _acc_sEnd(s32 value);\r\n    inline s32 _acc_sEnd$(s32 value);\r\n    inline s32 _acc_sEndpostInc()\t\t\t{ s32 tmp; _acc_sEnd((tmp = _acc_gEnd())+1); return tmp; }\r\n    inline s32 _acc_sEnd$postInc()\t\t\t{ CHCKTHIS; return _acc_sEndpostInc(); }\r\n    inline s32 _acc_sEndpostDec()\t\t\t{ s32 tmp; _acc_sEnd((tmp = _acc_gEnd())-1); return tmp; }\r\n    inline s32 _acc_sEnd$postDec()\t\t\t{ CHCKTHIS; return _acc_sEndpostDec(); }\r\n    inline s32 _acc_sEndpreInc()\t\t\t{ return _acc_sEnd(_acc_gEnd()+1); }\r\n    inline s32 _acc_sEnd$preInc()\t\t\t{ CHCKTHIS; return _acc_sEndpreInc(); }\r\n    inline s32 _acc_sEndpreDec()\t\t\t{ return _acc_sEnd(_acc_gEnd()-1); }\r\n    inline s32 _acc_sEnd$preDec()\t\t\t{ CHCKTHIS; return _acc_sEndpreDec(); }\r\n    inline s32 _acc_sEndAddEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() + value); }\r\n    inline s32 _acc_sEnd$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndAddEq(value); }\r\n    inline s32 _acc_sEndSubEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() - value); }\r\n    inline s32 _acc_sEnd$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndSubEq(value); }\r\n    inline s32 _acc_sEndMulEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() * value); }\r\n    inline s32 _acc_sEnd$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndMulEq(value); }\r\n    inline s32 _acc_sEndDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sEnd(_acc_gEnd() / value); }\r\n    inline s32 _acc_sEnd$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndDivEq(value); }\r\n    inline s32 _acc_sEndModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sEnd(_acc_gEnd() % value); }\r\n    inline s32 _acc_sEnd$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndModEq(value); }\r\n    inline s32 _acc_sEndXorEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() ^ value); }\r\n    inline s32 _acc_sEnd$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndXorEq(value); }\r\n    inline s32 _acc_sEndAndEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() & value); }\r\n    inline s32 _acc_sEnd$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndAndEq(value); }\r\n    inline s32 _acc_sEndOrEq(s32 value)\t\t{ return _acc_sEnd(_acc_gEnd() | value); }\r\n    inline s32 _acc_sEnd$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndOrEq(value); }\r\n    inline s32 _acc_sEndRShiftEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() >> value); }\r\n    inline s32 _acc_sEnd$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndRShiftEq(value); }\r\n    inline s32 _acc_sEndLShiftEq(s32 value)\t{ return _acc_sEnd(_acc_gEnd() << value); }\r\n    inline s32 _acc_sEnd$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sEndLShiftEq(value); }\r\n    inline s32 _acc_gPos();\r\n    inline s32 _acc_gPos$();\r\n\r\n    inline s32 _acc_sPos(s32 value);\r\n    inline s32 _acc_sPos$(s32 value);\r\n    inline s32 _acc_sPospostInc()\t\t\t{ s32 tmp; _acc_sPos((tmp = _acc_gPos())+1); return tmp; }\r\n    inline s32 _acc_sPos$postInc()\t\t\t{ CHCKTHIS; return _acc_sPospostInc(); }\r\n    inline s32 _acc_sPospostDec()\t\t\t{ s32 tmp; _acc_sPos((tmp = _acc_gPos())-1); return tmp; }\r\n    inline s32 _acc_sPos$postDec()\t\t\t{ CHCKTHIS; return _acc_sPospostDec(); }\r\n    inline s32 _acc_sPospreInc()\t\t\t{ return _acc_sPos(_acc_gPos()+1); }\r\n    inline s32 _acc_sPos$preInc()\t\t\t{ CHCKTHIS; return _acc_sPospreInc(); }\r\n    inline s32 _acc_sPospreDec()\t\t\t{ return _acc_sPos(_acc_gPos()-1); }\r\n    inline s32 _acc_sPos$preDec()\t\t\t{ CHCKTHIS; return _acc_sPospreDec(); }\r\n    inline s32 _acc_sPosAddEq(s32 value)\t{ return _acc_sPos(_acc_gPos() + value); }\r\n    inline s32 _acc_sPos$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosAddEq(value); }\r\n    inline s32 _acc_sPosSubEq(s32 value)\t{ return _acc_sPos(_acc_gPos() - value); }\r\n    inline s32 _acc_sPos$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosSubEq(value); }\r\n    inline s32 _acc_sPosMulEq(s32 value)\t{ return _acc_sPos(_acc_gPos() * value); }\r\n    inline s32 _acc_sPos$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosMulEq(value); }\r\n    inline s32 _acc_sPosDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sPos(_acc_gPos() / value); }\r\n    inline s32 _acc_sPos$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosDivEq(value); }\r\n    inline s32 _acc_sPosModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sPos(_acc_gPos() % value); }\r\n    inline s32 _acc_sPos$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosModEq(value); }\r\n    inline s32 _acc_sPosXorEq(s32 value)\t{ return _acc_sPos(_acc_gPos() ^ value); }\r\n    inline s32 _acc_sPos$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosXorEq(value); }\r\n    inline s32 _acc_sPosAndEq(s32 value)\t{ return _acc_sPos(_acc_gPos() & value); }\r\n    inline s32 _acc_sPos$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosAndEq(value); }\r\n    inline s32 _acc_sPosOrEq(s32 value)\t\t{ return _acc_sPos(_acc_gPos() | value); }\r\n    inline s32 _acc_sPos$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosOrEq(value); }\r\n    inline s32 _acc_sPosRShiftEq(s32 value)\t{ return _acc_sPos(_acc_gPos() >> value); }\r\n    inline s32 _acc_sPos$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosRShiftEq(value); }\r\n    inline s32 _acc_sPosLShiftEq(s32 value)\t{ return _acc_sPos(_acc_gPos() << value); }\r\n    inline s32 _acc_sPos$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sPosLShiftEq(value); }\r\n    inline System::String* _acc_gImg();\r\n    inline System::String* _acc_gImg$();\r\n\r\n    inline s32 _acc_gSliderSize();\r\n    inline s32 _acc_gSliderSize$();\r\n\r\n    inline s32 _acc_sSliderSize(s32 value);\r\n    inline s32 _acc_sSliderSize$(s32 value);\r\n    inline s32 _acc_sSliderSizepostInc()\t\t\t{ s32 tmp; _acc_sSliderSize((tmp = _acc_gSliderSize())+1); return tmp; }\r\n    inline s32 _acc_sSliderSize$postInc()\t\t\t{ CHCKTHIS; return _acc_sSliderSizepostInc(); }\r\n    inline s32 _acc_sSliderSizepostDec()\t\t\t{ s32 tmp; _acc_sSliderSize((tmp = _acc_gSliderSize())-1); return tmp; }\r\n    inline s32 _acc_sSliderSize$postDec()\t\t\t{ CHCKTHIS; return _acc_sSliderSizepostDec(); }\r\n    inline s32 _acc_sSliderSizepreInc()\t\t\t{ return _acc_sSliderSize(_acc_gSliderSize()+1); }\r\n    inline s32 _acc_sSliderSize$preInc()\t\t\t{ CHCKTHIS; return _acc_sSliderSizepreInc(); }\r\n    inline s32 _acc_sSliderSizepreDec()\t\t\t{ return _acc_sSliderSize(_acc_gSliderSize()-1); }\r\n    inline s32 _acc_sSliderSize$preDec()\t\t\t{ CHCKTHIS; return _acc_sSliderSizepreDec(); }\r\n    inline s32 _acc_sSliderSizeAddEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() + value); }\r\n    inline s32 _acc_sSliderSize$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeAddEq(value); }\r\n    inline s32 _acc_sSliderSizeSubEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() - value); }\r\n    inline s32 _acc_sSliderSize$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeSubEq(value); }\r\n    inline s32 _acc_sSliderSizeMulEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() * value); }\r\n    inline s32 _acc_sSliderSize$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMulEq(value); }\r\n    inline s32 _acc_sSliderSizeDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSliderSize(_acc_gSliderSize() / value); }\r\n    inline s32 _acc_sSliderSize$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeDivEq(value); }\r\n    inline s32 _acc_sSliderSizeModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSliderSize(_acc_gSliderSize() % value); }\r\n    inline s32 _acc_sSliderSize$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeModEq(value); }\r\n    inline s32 _acc_sSliderSizeXorEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() ^ value); }\r\n    inline s32 _acc_sSliderSize$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeXorEq(value); }\r\n    inline s32 _acc_sSliderSizeAndEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() & value); }\r\n    inline s32 _acc_sSliderSize$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeAndEq(value); }\r\n    inline s32 _acc_sSliderSizeOrEq(s32 value)\t\t{ return _acc_sSliderSize(_acc_gSliderSize() | value); }\r\n    inline s32 _acc_sSliderSize$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeOrEq(value); }\r\n    inline s32 _acc_sSliderSizeRShiftEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() >> value); }\r\n    inline s32 _acc_sSliderSize$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeRShiftEq(value); }\r\n    inline s32 _acc_sSliderSizeLShiftEq(s32 value)\t{ return _acc_sSliderSize(_acc_gSliderSize() << value); }\r\n    inline s32 _acc_sSliderSize$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeLShiftEq(value); }\r\n    inline s32 _acc_gSliderSizeMin();\r\n    inline s32 _acc_gSliderSizeMin$();\r\n\r\n    inline s32 _acc_sSliderSizeMin(s32 value);\r\n    inline s32 _acc_sSliderSizeMin$(s32 value);\r\n    inline s32 _acc_sSliderSizeMinpostInc()\t\t\t{ s32 tmp; _acc_sSliderSizeMin((tmp = _acc_gSliderSizeMin())+1); return tmp; }\r\n    inline s32 _acc_sSliderSizeMin$postInc()\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinpostInc(); }\r\n    inline s32 _acc_sSliderSizeMinpostDec()\t\t\t{ s32 tmp; _acc_sSliderSizeMin((tmp = _acc_gSliderSizeMin())-1); return tmp; }\r\n    inline s32 _acc_sSliderSizeMin$postDec()\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinpostDec(); }\r\n    inline s32 _acc_sSliderSizeMinpreInc()\t\t\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin()+1); }\r\n    inline s32 _acc_sSliderSizeMin$preInc()\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinpreInc(); }\r\n    inline s32 _acc_sSliderSizeMinpreDec()\t\t\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin()-1); }\r\n    inline s32 _acc_sSliderSizeMin$preDec()\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinpreDec(); }\r\n    inline s32 _acc_sSliderSizeMinAddEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() + value); }\r\n    inline s32 _acc_sSliderSizeMin$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinAddEq(value); }\r\n    inline s32 _acc_sSliderSizeMinSubEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() - value); }\r\n    inline s32 _acc_sSliderSizeMin$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinSubEq(value); }\r\n    inline s32 _acc_sSliderSizeMinMulEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() * value); }\r\n    inline s32 _acc_sSliderSizeMin$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinMulEq(value); }\r\n    inline s32 _acc_sSliderSizeMinDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSliderSizeMin(_acc_gSliderSizeMin() / value); }\r\n    inline s32 _acc_sSliderSizeMin$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinDivEq(value); }\r\n    inline s32 _acc_sSliderSizeMinModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sSliderSizeMin(_acc_gSliderSizeMin() % value); }\r\n    inline s32 _acc_sSliderSizeMin$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinModEq(value); }\r\n    inline s32 _acc_sSliderSizeMinXorEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() ^ value); }\r\n    inline s32 _acc_sSliderSizeMin$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinXorEq(value); }\r\n    inline s32 _acc_sSliderSizeMinAndEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() & value); }\r\n    inline s32 _acc_sSliderSizeMin$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinAndEq(value); }\r\n    inline s32 _acc_sSliderSizeMinOrEq(s32 value)\t\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() | value); }\r\n    inline s32 _acc_sSliderSizeMin$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinOrEq(value); }\r\n    inline s32 _acc_sSliderSizeMinRShiftEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() >> value); }\r\n    inline s32 _acc_sSliderSizeMin$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinRShiftEq(value); }\r\n    inline s32 _acc_sSliderSizeMinLShiftEq(s32 value)\t{ return _acc_sSliderSizeMin(_acc_gSliderSizeMin() << value); }\r\n    inline s32 _acc_sSliderSizeMin$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sSliderSizeMinLShiftEq(value); }\r\n    inline bool _acc_gIsVertical();\r\n    inline bool _acc_gIsVertical$();\r\n\r\n    inline bool _acc_sIsVertical(bool value);\r\n    inline bool _acc_sIsVertical$(bool value);\r\n    inline u32 _acc_gArgbNormal();\r\n    inline u32 _acc_gArgbNormal$();\r\n\r\n    inline u32 _acc_sArgbNormal(u32 value);\r\n    inline u32 _acc_sArgbNormal$(u32 value);\r\n    inline u32 _acc_sArgbNormalpostInc()\t\t\t{ u32 tmp; _acc_sArgbNormal((tmp = _acc_gArgbNormal())+1); return tmp; }\r\n    inline u32 _acc_sArgbNormal$postInc()\t\t\t{ CHCKTHIS; return _acc_sArgbNormalpostInc(); }\r\n    inline u32 _acc_sArgbNormalpostDec()\t\t\t{ u32 tmp; _acc_sArgbNormal((tmp = _acc_gArgbNormal())-1); return tmp; }\r\n    inline u32 _acc_sArgbNormal$postDec()\t\t\t{ CHCKTHIS; return _acc_sArgbNormalpostDec(); }\r\n    inline u32 _acc_sArgbNormalpreInc()\t\t\t{ return _acc_sArgbNormal(_acc_gArgbNormal()+1); }\r\n    inline u32 _acc_sArgbNormal$preInc()\t\t\t{ CHCKTHIS; return _acc_sArgbNormalpreInc(); }\r\n    inline u32 _acc_sArgbNormalpreDec()\t\t\t{ return _acc_sArgbNormal(_acc_gArgbNormal()-1); }\r\n    inline u32 _acc_sArgbNormal$preDec()\t\t\t{ CHCKTHIS; return _acc_sArgbNormalpreDec(); }\r\n    inline u32 _acc_sArgbNormalAddEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() + value); }\r\n    inline u32 _acc_sArgbNormal$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalAddEq(value); }\r\n    inline u32 _acc_sArgbNormalSubEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() - value); }\r\n    inline u32 _acc_sArgbNormal$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalSubEq(value); }\r\n    inline u32 _acc_sArgbNormalMulEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() * value); }\r\n    inline u32 _acc_sArgbNormal$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalMulEq(value); }\r\n    inline u32 _acc_sArgbNormalDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sArgbNormal(_acc_gArgbNormal() / value); }\r\n    inline u32 _acc_sArgbNormal$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalDivEq(value); }\r\n    inline u32 _acc_sArgbNormalModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sArgbNormal(_acc_gArgbNormal() % value); }\r\n    inline u32 _acc_sArgbNormal$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalModEq(value); }\r\n    inline u32 _acc_sArgbNormalXorEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() ^ value); }\r\n    inline u32 _acc_sArgbNormal$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalXorEq(value); }\r\n    inline u32 _acc_sArgbNormalAndEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() & value); }\r\n    inline u32 _acc_sArgbNormal$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalAndEq(value); }\r\n    inline u32 _acc_sArgbNormalOrEq(u32 value)\t\t{ return _acc_sArgbNormal(_acc_gArgbNormal() | value); }\r\n    inline u32 _acc_sArgbNormal$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalOrEq(value); }\r\n    inline u32 _acc_sArgbNormalRShiftEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() >> value); }\r\n    inline u32 _acc_sArgbNormal$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalRShiftEq(value); }\r\n    inline u32 _acc_sArgbNormalLShiftEq(u32 value)\t{ return _acc_sArgbNormal(_acc_gArgbNormal() << value); }\r\n    inline u32 _acc_sArgbNormal$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbNormalLShiftEq(value); }\r\n    inline u32 _acc_gArgbActive();\r\n    inline u32 _acc_gArgbActive$();\r\n\r\n    inline u32 _acc_sArgbActive(u32 value);\r\n    inline u32 _acc_sArgbActive$(u32 value);\r\n    inline u32 _acc_sArgbActivepostInc()\t\t\t{ u32 tmp; _acc_sArgbActive((tmp = _acc_gArgbActive())+1); return tmp; }\r\n    inline u32 _acc_sArgbActive$postInc()\t\t\t{ CHCKTHIS; return _acc_sArgbActivepostInc(); }\r\n    inline u32 _acc_sArgbActivepostDec()\t\t\t{ u32 tmp; _acc_sArgbActive((tmp = _acc_gArgbActive())-1); return tmp; }\r\n    inline u32 _acc_sArgbActive$postDec()\t\t\t{ CHCKTHIS; return _acc_sArgbActivepostDec(); }\r\n    inline u32 _acc_sArgbActivepreInc()\t\t\t{ return _acc_sArgbActive(_acc_gArgbActive()+1); }\r\n    inline u32 _acc_sArgbActive$preInc()\t\t\t{ CHCKTHIS; return _acc_sArgbActivepreInc(); }\r\n    inline u32 _acc_sArgbActivepreDec()\t\t\t{ return _acc_sArgbActive(_acc_gArgbActive()-1); }\r\n    inline u32 _acc_sArgbActive$preDec()\t\t\t{ CHCKTHIS; return _acc_sArgbActivepreDec(); }\r\n    inline u32 _acc_sArgbActiveAddEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() + value); }\r\n    inline u32 _acc_sArgbActive$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveAddEq(value); }\r\n    inline u32 _acc_sArgbActiveSubEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() - value); }\r\n    inline u32 _acc_sArgbActive$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveSubEq(value); }\r\n    inline u32 _acc_sArgbActiveMulEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() * value); }\r\n    inline u32 _acc_sArgbActive$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveMulEq(value); }\r\n    inline u32 _acc_sArgbActiveDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sArgbActive(_acc_gArgbActive() / value); }\r\n    inline u32 _acc_sArgbActive$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveDivEq(value); }\r\n    inline u32 _acc_sArgbActiveModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sArgbActive(_acc_gArgbActive() % value); }\r\n    inline u32 _acc_sArgbActive$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveModEq(value); }\r\n    inline u32 _acc_sArgbActiveXorEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() ^ value); }\r\n    inline u32 _acc_sArgbActive$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveXorEq(value); }\r\n    inline u32 _acc_sArgbActiveAndEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() & value); }\r\n    inline u32 _acc_sArgbActive$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveAndEq(value); }\r\n    inline u32 _acc_sArgbActiveOrEq(u32 value)\t\t{ return _acc_sArgbActive(_acc_gArgbActive() | value); }\r\n    inline u32 _acc_sArgbActive$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveOrEq(value); }\r\n    inline u32 _acc_sArgbActiveRShiftEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() >> value); }\r\n    inline u32 _acc_sArgbActive$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveRShiftEq(value); }\r\n    inline u32 _acc_sArgbActiveLShiftEq(u32 value)\t{ return _acc_sArgbActive(_acc_gArgbActive() << value); }\r\n    inline u32 _acc_sArgbActive$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sArgbActiveLShiftEq(value); }\r\n    inline bool _acc_gIsTouchActive();\r\n    inline bool _acc_gIsTouchActive$();\r\n\r\n    inline bool _acc_sIsTouchActive(bool value);\r\n    inline bool _acc_sIsTouchActive$(bool value);\r\n    inline u32 _acc_gMode();\r\n    inline u32 _acc_gMode$();\r\n\r\n    inline u32 _acc_sMode(u32 value);\r\n    inline u32 _acc_sMode$(u32 value);\r\n    inline u32 _acc_sModepostInc()\t\t\t{ u32 tmp; _acc_sMode((tmp = _acc_gMode())+1); return tmp; }\r\n    inline u32 _acc_sMode$postInc()\t\t\t{ CHCKTHIS; return _acc_sModepostInc(); }\r\n    inline u32 _acc_sModepostDec()\t\t\t{ u32 tmp; _acc_sMode((tmp = _acc_gMode())-1); return tmp; }\r\n    inline u32 _acc_sMode$postDec()\t\t\t{ CHCKTHIS; return _acc_sModepostDec(); }\r\n    inline u32 _acc_sModepreInc()\t\t\t{ return _acc_sMode(_acc_gMode()+1); }\r\n    inline u32 _acc_sMode$preInc()\t\t\t{ CHCKTHIS; return _acc_sModepreInc(); }\r\n    inline u32 _acc_sModepreDec()\t\t\t{ return _acc_sMode(_acc_gMode()-1); }\r\n    inline u32 _acc_sMode$preDec()\t\t\t{ CHCKTHIS; return _acc_sModepreDec(); }\r\n    inline u32 _acc_sModeAddEq(u32 value)\t{ return _acc_sMode(_acc_gMode() + value); }\r\n    inline u32 _acc_sMode$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeAddEq(value); }\r\n    inline u32 _acc_sModeSubEq(u32 value)\t{ return _acc_sMode(_acc_gMode() - value); }\r\n    inline u32 _acc_sMode$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeSubEq(value); }\r\n    inline u32 _acc_sModeMulEq(u32 value)\t{ return _acc_sMode(_acc_gMode() * value); }\r\n    inline u32 _acc_sMode$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeMulEq(value); }\r\n    inline u32 _acc_sModeDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMode(_acc_gMode() / value); }\r\n    inline u32 _acc_sMode$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeDivEq(value); }\r\n    inline u32 _acc_sModeModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMode(_acc_gMode() % value); }\r\n    inline u32 _acc_sMode$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeModEq(value); }\r\n    inline u32 _acc_sModeXorEq(u32 value)\t{ return _acc_sMode(_acc_gMode() ^ value); }\r\n    inline u32 _acc_sMode$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeXorEq(value); }\r\n    inline u32 _acc_sModeAndEq(u32 value)\t{ return _acc_sMode(_acc_gMode() & value); }\r\n    inline u32 _acc_sMode$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeAndEq(value); }\r\n    inline u32 _acc_sModeOrEq(u32 value)\t\t{ return _acc_sMode(_acc_gMode() | value); }\r\n    inline u32 _acc_sMode$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeOrEq(value); }\r\n    inline u32 _acc_sModeRShiftEq(u32 value)\t{ return _acc_sMode(_acc_gMode() >> value); }\r\n    inline u32 _acc_sMode$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeRShiftEq(value); }\r\n    inline u32 _acc_sModeLShiftEq(u32 value)\t{ return _acc_sMode(_acc_gMode() << value); }\r\n    inline u32 _acc_sMode$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sModeLShiftEq(value); }\r\n    static s32* _ext_CKLBUIScrollBar_create(s32* pParent,u32 order,float x,float y,float width,float height,s32 minValue,s32 maxValue,s32 pos,s32* image,s32 slider_size,s32 min_slider_size,u32 colorNormal,u32 colorSelect,bool vert,bool active,bool hideMode);\r\n    static s32 _ext_CKLBUIScrollBar_getMin(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setMin(s32* p,s32 value);\r\n    static s32 _ext_CKLBUIScrollBar_getMax(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setMax(s32* p,s32 value);\r\n    static s32 _ext_CKLBUIScrollBar_getPos(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setPos(s32* p,s32 value);\r\n    static s32 _ext_CKLBUIScrollBar_getSliderSize(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setSliderSize(s32* p,s32 value);\r\n    static s32 _ext_CKLBUIScrollBar_getSliderSizeMin(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setSliderSizeMin(s32* p,s32 value);\r\n    static bool _ext_CKLBUIScrollBar_getTouchActive(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setTouchActive(s32* p,bool active);\r\n    static u32 _ext_CKLBUIScrollBar_getNormalColor(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setNormalColor(s32* p,u32 color);\r\n    static u32 _ext_CKLBUIScrollBar_getActiveColor(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setActiveColor(s32* p,u32 color);\r\n    static void _ext_CKLBUIScrollBar_setMode(s32* p,u32 mode);\r\n    static bool _ext_CKLBUIScrollBar_getVertical(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setVertical(s32* p,bool vertical);\r\n    static s32 _ext_CKLBUIScrollBar_getWidth(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setWidth(s32* p,s32 width);\r\n    static s32 _ext_CKLBUIScrollBar_getHeight(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setHeight(s32* p,s32 height);\r\n    static u32 _ext_CKLBUIScrollBar_getOrder(s32* p);\r\n    static void _ext_CKLBUIScrollBar_setOrder(s32* p,u32 order);\r\n    static s32* _ext_CKLBUIScrollBar_getImage(s32* p);\r\n    static u32 _ext_CKLBUIScrollBar_getMode(s32* p);\r\n    static bool _ext_CKLBUIScrollBar_selectScrMgr(s32* p,s32* name,s32 len,System::Array<s32>* args);\r\n    CKLBUIScrollBar(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,s32 minValue,s32 maxValue,s32 pos,System::String* image,s32 sliderSize,s32 minSliderSize,u32 argbNormal,u32 argbSelect,bool vert,bool active,bool hideMode,EnginePrototype::_Delegate_Base_ScrollBarCallBack_inner46* callback);\r\n    CKLBUIScrollBar();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 type,s32 pos);\r\n    inline void callBackFunction$(u32 type,s32 pos);\r\n    void getSize(EnginePrototype::Size& size);\r\n    inline void getSize$(EnginePrototype::Size& size);\r\n    void setSize(EnginePrototype::Size size);\r\n    inline void setSize$(EnginePrototype::Size size);\r\n    void setSize(s32 width,s32 height);\r\n    inline void setSize$(s32 width,s32 height);\r\n    void selectScrollManager(System::String* name,System::Array<s32>* args);\r\n    inline void selectScrollManager$(System::String* name,System::Array<s32>* args);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 231;\r\n};\r\nclass EnginePrototype::CKLBUISimpleItem : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUISimpleItem();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    static s32* _ext_CKLBUISimpleItem_create(s32* pParent,u32 order,float x,float y,s32* asset);\r\n    static u32 _ext_CKLBUISimpleItem_getOrder(s32* p);\r\n    static void _ext_CKLBUISimpleItem_setOrder(s32* p,u32 order);\r\n    static s32* _ext_CKLBUISimpleItem_getAsset(s32* p);\r\n    CKLBUISimpleItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::String* asset);\r\n    CKLBUISimpleItem();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 235;\r\n};\r\nclass EnginePrototype::CKLBUISWFPlayer : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner47;\r\n\r\npublic:\r\n    void _ctor_CKLBUISWFPlayer();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner47* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner47*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner47* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner47* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner47* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner47* _$value);\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    inline System::String* _acc_gMovieName();\r\n    inline System::String* _acc_gMovieName$();\r\n\r\n    inline bool _acc_gIsPlaying();\r\n    inline bool _acc_gIsPlaying$();\r\n\r\n    inline bool _acc_sIsPlaying(bool value);\r\n    inline bool _acc_sIsPlaying$(bool value);\r\n    inline u32 _acc_gFramerate();\r\n    inline u32 _acc_gFramerate$();\r\n\r\n    inline u32 _acc_sFramerate(u32 value);\r\n    inline u32 _acc_sFramerate$(u32 value);\r\n    inline u32 _acc_sFrameratepostInc()\t\t\t{ u32 tmp; _acc_sFramerate((tmp = _acc_gFramerate())+1); return tmp; }\r\n    inline u32 _acc_sFramerate$postInc()\t\t\t{ CHCKTHIS; return _acc_sFrameratepostInc(); }\r\n    inline u32 _acc_sFrameratepostDec()\t\t\t{ u32 tmp; _acc_sFramerate((tmp = _acc_gFramerate())-1); return tmp; }\r\n    inline u32 _acc_sFramerate$postDec()\t\t\t{ CHCKTHIS; return _acc_sFrameratepostDec(); }\r\n    inline u32 _acc_sFrameratepreInc()\t\t\t{ return _acc_sFramerate(_acc_gFramerate()+1); }\r\n    inline u32 _acc_sFramerate$preInc()\t\t\t{ CHCKTHIS; return _acc_sFrameratepreInc(); }\r\n    inline u32 _acc_sFrameratepreDec()\t\t\t{ return _acc_sFramerate(_acc_gFramerate()-1); }\r\n    inline u32 _acc_sFramerate$preDec()\t\t\t{ CHCKTHIS; return _acc_sFrameratepreDec(); }\r\n    inline u32 _acc_sFramerateAddEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() + value); }\r\n    inline u32 _acc_sFramerate$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateAddEq(value); }\r\n    inline u32 _acc_sFramerateSubEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() - value); }\r\n    inline u32 _acc_sFramerate$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateSubEq(value); }\r\n    inline u32 _acc_sFramerateMulEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() * value); }\r\n    inline u32 _acc_sFramerate$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateMulEq(value); }\r\n    inline u32 _acc_sFramerateDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sFramerate(_acc_gFramerate() / value); }\r\n    inline u32 _acc_sFramerate$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateDivEq(value); }\r\n    inline u32 _acc_sFramerateModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sFramerate(_acc_gFramerate() % value); }\r\n    inline u32 _acc_sFramerate$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateModEq(value); }\r\n    inline u32 _acc_sFramerateXorEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() ^ value); }\r\n    inline u32 _acc_sFramerate$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateXorEq(value); }\r\n    inline u32 _acc_sFramerateAndEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() & value); }\r\n    inline u32 _acc_sFramerate$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateAndEq(value); }\r\n    inline u32 _acc_sFramerateOrEq(u32 value)\t\t{ return _acc_sFramerate(_acc_gFramerate() | value); }\r\n    inline u32 _acc_sFramerate$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateOrEq(value); }\r\n    inline u32 _acc_sFramerateRShiftEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() >> value); }\r\n    inline u32 _acc_sFramerate$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateRShiftEq(value); }\r\n    inline u32 _acc_sFramerateLShiftEq(u32 value)\t{ return _acc_sFramerate(_acc_gFramerate() << value); }\r\n    inline u32 _acc_sFramerate$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sFramerateLShiftEq(value); }\r\n    inline bool _acc_gIsAnim();\r\n    inline bool _acc_gIsAnim$();\r\n\r\n    inline float _acc_gVolume();\r\n    inline float _acc_gVolume$();\r\n\r\n    inline float _acc_sVolume(float value);\r\n    inline float _acc_sVolume$(float value);\r\n    inline float _acc_sVolumepostInc()\t\t\t{ float tmp; _acc_sVolume((tmp = _acc_gVolume())+1); return tmp; }\r\n    inline float _acc_sVolume$postInc()\t\t\t{ CHCKTHIS; return _acc_sVolumepostInc(); }\r\n    inline float _acc_sVolumepostDec()\t\t\t{ float tmp; _acc_sVolume((tmp = _acc_gVolume())-1); return tmp; }\r\n    inline float _acc_sVolume$postDec()\t\t\t{ CHCKTHIS; return _acc_sVolumepostDec(); }\r\n    inline float _acc_sVolumepreInc()\t\t\t{ return _acc_sVolume(_acc_gVolume()+1); }\r\n    inline float _acc_sVolume$preInc()\t\t\t{ CHCKTHIS; return _acc_sVolumepreInc(); }\r\n    inline float _acc_sVolumepreDec()\t\t\t{ return _acc_sVolume(_acc_gVolume()-1); }\r\n    inline float _acc_sVolume$preDec()\t\t\t{ CHCKTHIS; return _acc_sVolumepreDec(); }\r\n    inline float _acc_sVolumeAddEq(float value)\t{ return _acc_sVolume(_acc_gVolume() + value); }\r\n    inline float _acc_sVolume$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeAddEq(value); }\r\n    inline float _acc_sVolumeSubEq(float value)\t{ return _acc_sVolume(_acc_gVolume() - value); }\r\n    inline float _acc_sVolume$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeSubEq(value); }\r\n    inline float _acc_sVolumeMulEq(float value)\t{ return _acc_sVolume(_acc_gVolume() * value); }\r\n    inline float _acc_sVolume$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeMulEq(value); }\r\n    inline float _acc_sVolumeDivEq(float value)\t{ return _acc_sVolume(_acc_gVolume() / value); }\r\n    inline float _acc_sVolume$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeDivEq(value); }\r\n    inline float _acc_sVolumeModEq(float value)\t{  float orig = _acc_gVolume(); s32 tmp = (s32)(orig / value); return _acc_sVolume(orig - (tmp * value)); }\r\n    inline float _acc_sVolume$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sVolumeModEq(value); }\r\n    static s32* _ext_CKLBUISWFPlayer_create(s32* parent,u32 order,float x,float y,s32* asset,s32* movieNameconst,System::Array<s32*>* replaceList,s32 assetCnt);\r\n    static bool _ext_CKLBUISWFPlayer_getPlay(s32* p);\r\n    static void _ext_CKLBUISWFPlayer_setPlay(s32* p,bool play);\r\n    static u32 _ext_CKLBUISWFPlayer_getOrder(s32* p);\r\n    static void _ext_CKLBUISWFPlayer_setOrder(s32* p,u32 order);\r\n    static void _ext_CKLBUISWFPlayer_gotoFrame(s32* p,s32* label);\r\n    static u32 _ext_CKLBUISWFPlayer_getFrameRate(s32* p);\r\n    static void _ext_CKLBUISWFPlayer_setFrameRate(s32* p,u32 fps);\r\n    static bool _ext_CKLBUISWFPlayer_isAnimating(s32* p);\r\n    static void _ext_CKLBUISWFPlayer_setFrameRateScale(s32* p,float scale);\r\n    static s32* _ext_CKLBUISWFPlayer_getAsset(s32* p);\r\n    static s32* _ext_CKLBUISWFPlayer_getMovieName(s32* p);\r\n    static float _ext_CKLBUISWFPlayer_getVolume(s32* p);\r\n    static void _ext_CKLBUISWFPlayer_setVolume(s32* p,float volume);\r\n    CKLBUISWFPlayer(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,System::String* asset,System::String* movieName,EnginePrototype::_Delegate_Base_CallBack_inner47* callback,System::Array<System::String*>* replaceList,s32 assetCnt);\r\n    CKLBUISWFPlayer();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(s32* label);\r\n    inline void callBackFunction$(s32* label);\r\n    void play();\r\n    inline void play$();\r\n    void stop();\r\n    inline void stop$();\r\n    void goToFrame(System::String* label);\r\n    inline void goToFrame$(System::String* label);\r\n    void setFramerateScale(float scale);\r\n    inline void setFramerateScale$(float scale);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 236;\r\n};\r\nclass EnginePrototype::Spline_inner4 : public System::Object {\r\n\r\npublic:\r\n    void _ctor_Spline_inner4();\r\n    s32 m_targetType;\r\n    inline s32& _gm_targetType$() { CHCKTHIS; return m_targetType; }\r\n    inline s32 _sm_targetType$(s32 _$value) { CHCKTHIS; return m_targetType = _$value; }\r\n    inline s32 _sm_targetType$postInc()\t\t\t\t{ CHCKTHIS; return (s32)(((s32&)m_targetType)++); }\r\n    inline s32 _sm_targetType$postDec()\t\t\t\t{ CHCKTHIS; return (s32)(((s32&)m_targetType)--); }\r\n    inline s32 _sm_targetType$preInc()\t\t\t\t{ CHCKTHIS; return (s32)(++(s32&)m_targetType); }\r\n    inline s32 _sm_targetType$preDec()\t\t\t\t{ CHCKTHIS; return (s32)(--(s32&)m_targetType); }\r\n    inline s32 _sm_targetType$AddEq(s32 value)\t\t{ CHCKTHIS; return (s32)((s32&)m_targetType += value); }\r\n    inline s32 _sm_targetType$SubEq(s32 value)\t\t{ CHCKTHIS; return (s32)((s32&)m_targetType -= value); }\r\n    inline s32 _sm_targetTypepostInc()\t\t\t\t{ return (s32)(((s32&)m_targetType)++); }\r\n    inline s32 _sm_targetTypepostDec()\t\t\t\t{ return (s32)(((s32&)m_targetType)--); }\r\n    inline s32 _sm_targetTypepreInc()\t\t\t\t{ return (s32)(++(s32&)m_targetType); }\r\n    inline s32 _sm_targetTypepreDec()\t\t\t\t{ return (s32)(--(s32&)m_targetType); }\r\n    inline s32 _sm_targetTypeAddEq(s32 value)\t\t{ return (s32)((s32&)m_targetType += value); }\r\n    inline s32 _sm_targetTypeSubEq(s32 value)\t\t{ return (s32)((s32&)m_targetType -= value); }\r\n\r\n    inline s32 _acc_gTargetType();\r\n    inline s32 _acc_gTargetType$();\r\n\r\n    virtual u32 _acc_gKeyCount() = 0;\r\n    virtual u32 _acc_gKeyCount$() = 0;\r\n    Spline_inner4(s32 targetType);\r\n    virtual void addKeyInt(u32 time,s32 value) = 0;\r\n    inline void addKeyInt$(u32 time,s32 value);\r\n    virtual void addKeyFloat(u32 time,float value) = 0;\r\n    inline void addKeyFloat$(u32 time,float value);\r\n    virtual void addKeys(s32* p,u32 splineIndex) = 0;\r\n    inline void addKeys$(s32* p,u32 splineIndex);\r\n    Spline_inner4();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 242;\r\n};\r\nclass EnginePrototype::IntSpline_inner5 : public EnginePrototype::Spline_inner4 {\r\nfriend class IntPoint_inner6;\r\n\r\npublic:\r\n    void _ctor_IntSpline_inner5();\r\n    System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* m_points;\r\n    inline System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>*& _gm_points$() { CHCKTHIS; return m_points; }\r\n    inline System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* _sm_points(System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* _$value);\r\n    inline System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* _sm_points$(System::Collections::Generic::List<EnginePrototype::IntPoint_inner6*>* _$value);\r\n\r\n    virtual u32 _acc_gKeyCount();\r\n    inline u32 _acc_gKeyCount$();\r\n\r\n    IntSpline_inner5(s32 targetType);\r\n    virtual void addKeyInt(u32 time,s32 value);\r\n    inline void addKeyInt$(u32 time,s32 value);\r\n    virtual void addKeyFloat(u32 time,float value);\r\n    inline void addKeyFloat$(u32 time,float value);\r\n    virtual void addKeys(s32* p,u32 splineIndex);\r\n    inline void addKeys$(s32* p,u32 splineIndex);\r\n    IntSpline_inner5();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 244;\r\n};\r\nclass EnginePrototype::IntPoint_inner6 : public System::Object {\r\n\r\npublic:\r\n    void _ctor_IntPoint_inner6();\r\n    u32 m_time;\r\n    inline u32& _gm_time$() { CHCKTHIS; return m_time; }\r\n    inline u32 _sm_time$(u32 _$value) { CHCKTHIS; return m_time = _$value; }\r\n    inline u32 _sm_time$postInc()\t\t\t\t{ CHCKTHIS; return m_time++; }\r\n    inline u32 _sm_time$postDec()\t\t\t\t{ CHCKTHIS; return m_time--; }\r\n    inline u32 _sm_time$preInc()\t\t\t\t{ CHCKTHIS; return ++m_time; }\r\n    inline u32 _sm_time$preDec()\t\t\t\t{ CHCKTHIS; return --m_time; }\r\n    inline u32 _sm_time$AddEq(u32 value)\t\t{ CHCKTHIS; return m_time += value; }\r\n    inline u32 _sm_time$SubEq(u32 value)\t\t{ CHCKTHIS; return m_time -= value; }\r\n    inline u32 _sm_time$MulEq(u32 value)\t\t{ CHCKTHIS; return m_time *= value; }\r\n    inline u32 _sm_time$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_time /= value; }\r\n    inline u32 _sm_time$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_time %= value; }\r\n    inline u32 _sm_time$XorEq(u32 value)\t\t{ CHCKTHIS; return m_time ^= value; }\r\n    inline u32 _sm_time$AndEq(u32 value)\t\t{ CHCKTHIS; return m_time &= value; }\r\n    inline u32 _sm_time$OrEq(u32 value)\t\t{ CHCKTHIS; return m_time |= value; }\r\n    inline u32 _sm_time$RShiftEq(u32 value)\t{ CHCKTHIS; return m_time >>= value; }\r\n    inline u32 _sm_time$LShiftEq(u32 value)\t{ CHCKTHIS; return m_time <<= value; }\r\n    inline u32 _sm_timepostInc()\t\t\t\t{ return m_time++; }\r\n    inline u32 _sm_timepostDec()\t\t\t\t{ return m_time--; }\r\n    inline u32 _sm_timepreInc()\t\t\t\t{ return ++m_time; }\r\n    inline u32 _sm_timepreDec()\t\t\t\t{ return --m_time; }\r\n    inline u32 _sm_timeAddEq(u32 value)\t\t{ return m_time += value; }\r\n    inline u32 _sm_timeSubEq(u32 value)\t\t{ return m_time -= value; }\r\n    inline u32 _sm_timeMulEq(u32 value)\t\t{ return m_time *= value; }\r\n    inline u32 _sm_timeDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_time /= value; }\r\n    inline u32 _sm_timeModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_time %= value; }\r\n    inline u32 _sm_timeXorEq(u32 value)\t\t{ return m_time ^= value; }\r\n    inline u32 _sm_timeAndEq(u32 value)\t\t{ return m_time &= value; }\r\n    inline u32 _sm_timeOrEq(u32 value)\t\t\t{ return m_time |= value; }\r\n    inline u32 _sm_timeRShiftEq(u32 value)\t\t{ return m_time >>= value; }\r\n    inline u32 _sm_timeLShiftEq(u32 value)\t\t{ return m_time <<= value; }\r\n\r\n    s16 m_value;\r\n    inline s16& _gm_value$() { CHCKTHIS; return m_value; }\r\n    inline s16 _sm_value$(s16 _$value) { CHCKTHIS; return m_value = _$value; }\r\n    inline s16 _sm_value$postInc()\t\t\t\t{ CHCKTHIS; return m_value++; }\r\n    inline s16 _sm_value$postDec()\t\t\t\t{ CHCKTHIS; return m_value--; }\r\n    inline s16 _sm_value$preInc()\t\t\t\t{ CHCKTHIS; return ++m_value; }\r\n    inline s16 _sm_value$preDec()\t\t\t\t{ CHCKTHIS; return --m_value; }\r\n    inline s16 _sm_value$AddEq(s16 value)\t\t{ CHCKTHIS; return m_value += value; }\r\n    inline s16 _sm_value$SubEq(s16 value)\t\t{ CHCKTHIS; return m_value -= value; }\r\n    inline s16 _sm_value$MulEq(s16 value)\t\t{ CHCKTHIS; return m_value *= value; }\r\n    inline s16 _sm_value$DivEq(s16 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_value /= value; }\r\n    inline s16 _sm_value$ModEq(s16 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_value %= value; }\r\n    inline s16 _sm_value$XorEq(s16 value)\t\t{ CHCKTHIS; return m_value ^= value; }\r\n    inline s16 _sm_value$AndEq(s16 value)\t\t{ CHCKTHIS; return m_value &= value; }\r\n    inline s16 _sm_value$OrEq(s16 value)\t\t{ CHCKTHIS; return m_value |= value; }\r\n    inline s16 _sm_value$RShiftEq(s16 value)\t{ CHCKTHIS; return m_value >>= value; }\r\n    inline s16 _sm_value$LShiftEq(s16 value)\t{ CHCKTHIS; return m_value <<= value; }\r\n    inline s16 _sm_valuepostInc()\t\t\t\t{ return m_value++; }\r\n    inline s16 _sm_valuepostDec()\t\t\t\t{ return m_value--; }\r\n    inline s16 _sm_valuepreInc()\t\t\t\t{ return ++m_value; }\r\n    inline s16 _sm_valuepreDec()\t\t\t\t{ return --m_value; }\r\n    inline s16 _sm_valueAddEq(s16 value)\t\t{ return m_value += value; }\r\n    inline s16 _sm_valueSubEq(s16 value)\t\t{ return m_value -= value; }\r\n    inline s16 _sm_valueMulEq(s16 value)\t\t{ return m_value *= value; }\r\n    inline s16 _sm_valueDivEq(s16 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_value /= value; }\r\n    inline s16 _sm_valueModEq(s16 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_value %= value; }\r\n    inline s16 _sm_valueXorEq(s16 value)\t\t{ return m_value ^= value; }\r\n    inline s16 _sm_valueAndEq(s16 value)\t\t{ return m_value &= value; }\r\n    inline s16 _sm_valueOrEq(s16 value)\t\t\t{ return m_value |= value; }\r\n    inline s16 _sm_valueRShiftEq(s16 value)\t\t{ return m_value >>= value; }\r\n    inline s16 _sm_valueLShiftEq(s16 value)\t\t{ return m_value <<= value; }\r\n\r\n    inline u32 _acc_gTime();\r\n    inline u32 _acc_gTime$();\r\n\r\n    inline s16 _acc_gValue();\r\n    inline s16 _acc_gValue$();\r\n\r\n    IntPoint_inner6(u32 time,s16 value);\r\n    IntPoint_inner6();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 246;\r\n};\r\nclass EnginePrototype::FloatSpline_inner7 : public EnginePrototype::Spline_inner4 {\r\nfriend class FloatPoint_inner8;\r\n\r\npublic:\r\n    void _ctor_FloatSpline_inner7();\r\n    System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* m_points;\r\n    inline System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>*& _gm_points$() { CHCKTHIS; return m_points; }\r\n    inline System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* _sm_points(System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* _$value);\r\n    inline System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* _sm_points$(System::Collections::Generic::List<EnginePrototype::FloatPoint_inner8*>* _$value);\r\n\r\n    virtual u32 _acc_gKeyCount();\r\n    inline u32 _acc_gKeyCount$();\r\n\r\n    FloatSpline_inner7(s32 targetType);\r\n    virtual void addKeyFloat(u32 time,float value);\r\n    inline void addKeyFloat$(u32 time,float value);\r\n    virtual void addKeyInt(u32 time,s32 value);\r\n    inline void addKeyInt$(u32 time,s32 value);\r\n    virtual void addKeys(s32* p,u32 splineIndex);\r\n    inline void addKeys$(s32* p,u32 splineIndex);\r\n    FloatSpline_inner7();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 248;\r\n};\r\nclass EnginePrototype::FloatPoint_inner8 : public System::Object {\r\n\r\npublic:\r\n    void _ctor_FloatPoint_inner8();\r\n    u32 m_time;\r\n    inline u32& _gm_time$() { CHCKTHIS; return m_time; }\r\n    inline u32 _sm_time$(u32 _$value) { CHCKTHIS; return m_time = _$value; }\r\n    inline u32 _sm_time$postInc()\t\t\t\t{ CHCKTHIS; return m_time++; }\r\n    inline u32 _sm_time$postDec()\t\t\t\t{ CHCKTHIS; return m_time--; }\r\n    inline u32 _sm_time$preInc()\t\t\t\t{ CHCKTHIS; return ++m_time; }\r\n    inline u32 _sm_time$preDec()\t\t\t\t{ CHCKTHIS; return --m_time; }\r\n    inline u32 _sm_time$AddEq(u32 value)\t\t{ CHCKTHIS; return m_time += value; }\r\n    inline u32 _sm_time$SubEq(u32 value)\t\t{ CHCKTHIS; return m_time -= value; }\r\n    inline u32 _sm_time$MulEq(u32 value)\t\t{ CHCKTHIS; return m_time *= value; }\r\n    inline u32 _sm_time$DivEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_time /= value; }\r\n    inline u32 _sm_time$ModEq(u32 value)\t\t{ CHCKTHIS; if (value == 0) { THROWDIVZERO; }; ; return m_time %= value; }\r\n    inline u32 _sm_time$XorEq(u32 value)\t\t{ CHCKTHIS; return m_time ^= value; }\r\n    inline u32 _sm_time$AndEq(u32 value)\t\t{ CHCKTHIS; return m_time &= value; }\r\n    inline u32 _sm_time$OrEq(u32 value)\t\t{ CHCKTHIS; return m_time |= value; }\r\n    inline u32 _sm_time$RShiftEq(u32 value)\t{ CHCKTHIS; return m_time >>= value; }\r\n    inline u32 _sm_time$LShiftEq(u32 value)\t{ CHCKTHIS; return m_time <<= value; }\r\n    inline u32 _sm_timepostInc()\t\t\t\t{ return m_time++; }\r\n    inline u32 _sm_timepostDec()\t\t\t\t{ return m_time--; }\r\n    inline u32 _sm_timepreInc()\t\t\t\t{ return ++m_time; }\r\n    inline u32 _sm_timepreDec()\t\t\t\t{ return --m_time; }\r\n    inline u32 _sm_timeAddEq(u32 value)\t\t{ return m_time += value; }\r\n    inline u32 _sm_timeSubEq(u32 value)\t\t{ return m_time -= value; }\r\n    inline u32 _sm_timeMulEq(u32 value)\t\t{ return m_time *= value; }\r\n    inline u32 _sm_timeDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_time /= value; }\r\n    inline u32 _sm_timeModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return m_time %= value; }\r\n    inline u32 _sm_timeXorEq(u32 value)\t\t{ return m_time ^= value; }\r\n    inline u32 _sm_timeAndEq(u32 value)\t\t{ return m_time &= value; }\r\n    inline u32 _sm_timeOrEq(u32 value)\t\t\t{ return m_time |= value; }\r\n    inline u32 _sm_timeRShiftEq(u32 value)\t\t{ return m_time >>= value; }\r\n    inline u32 _sm_timeLShiftEq(u32 value)\t\t{ return m_time <<= value; }\r\n\r\n    float m_value;\r\n    inline float& _gm_value$() { CHCKTHIS; return m_value; }\r\n    inline float _sm_value$(float _$value) { CHCKTHIS; return m_value = _$value; }\r\n    inline float _sm_value$postInc()\t\t\t\t{ CHCKTHIS; return m_value++; }\r\n    inline float _sm_value$postDec()\t\t\t\t{ CHCKTHIS; return m_value--; }\r\n    inline float _sm_value$preInc()\t\t\t\t{ CHCKTHIS; return ++m_value; }\r\n    inline float _sm_value$preDec()\t\t\t\t{ CHCKTHIS; return --m_value; }\r\n    inline float _sm_value$AddEq(float value)\t\t{ CHCKTHIS; return m_value += value; }\r\n    inline float _sm_value$SubEq(float value)\t\t{ CHCKTHIS; return m_value -= value; }\r\n    inline float _sm_value$MulEq(float value)\t\t{ CHCKTHIS; return m_value *= value; }\r\n    inline float _sm_value$DivEq(float value)\t\t{ CHCKTHIS; ; return m_value /= value; }\r\n    inline float _sm_value$ModEq(float value)\t\t{ CHCKTHIS; s32 tmp = ((s32)(m_value / value)); return m_value = m_value-(tmp*value); }\r\n    inline float _sm_valuepostInc()\t\t\t\t{ return m_value++; }\r\n    inline float _sm_valuepostDec()\t\t\t\t{ return m_value--; }\r\n    inline float _sm_valuepreInc()\t\t\t\t{ return ++m_value; }\r\n    inline float _sm_valuepreDec()\t\t\t\t{ return --m_value; }\r\n    inline float _sm_valueAddEq(float value)\t\t{ return m_value += value; }\r\n    inline float _sm_valueSubEq(float value)\t\t{ return m_value -= value; }\r\n    inline float _sm_valueMulEq(float value)\t\t{ return m_value *= value; }\r\n    inline float _sm_valueDivEq(float value)\t\t{ ; return m_value /= value; }\r\n    inline float _sm_valueModEq(float value)\t\t{ s32 tmp = ((s32)(m_value / value)); return m_value = m_value-(tmp*value); }\r\n\r\n    inline u32 _acc_gTime();\r\n    inline u32 _acc_gTime$();\r\n\r\n    inline float _acc_gValue();\r\n    inline float _acc_gValue$();\r\n\r\n    FloatPoint_inner8(u32 time,float value);\r\n    FloatPoint_inner8();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 250;\r\n};\r\nclass EnginePrototype::AnimSpline_inner9 : public System::Object {\r\n\r\npublic:\r\n    void _ctor_AnimSpline_inner9();\r\n    System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* m_splines;\r\n    inline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>*& _gm_splines$() { CHCKTHIS; return m_splines; }\r\n    inline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _sm_splines(System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _$value);\r\n    inline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _sm_splines$(System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _$value);\r\n\r\n    inline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _acc_gSplines();\r\n    inline System::Collections::Generic::List<EnginePrototype::Spline_inner4*>* _acc_gSplines$();\r\n\r\n    AnimSpline_inner9();\r\n    EnginePrototype::Spline_inner4* addNewSpline(s32 targetType,s32 splineType);\r\n    inline EnginePrototype::Spline_inner4* addNewSpline$(s32 targetType,s32 splineType);\r\n    void reset();\r\n    inline void reset$();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 252;\r\n};\r\nclass EnginePrototype::CKLBUITextInput : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner48;\r\n\r\npublic:\r\n    enum ECHAR_TYPE {\r\n        TXCH_7BIT_ASCII = 1,\r\n        TXCH_UTF8 = 2,\r\n        _ForceWORD_ECHAR_TYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUITextInput();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner48* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner48*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner48* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner48* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner48* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner48* _$value);\r\n\r\n    inline u32 _acc_gWidth();\r\n    inline u32 _acc_gWidth$();\r\n\r\n    inline u32 _acc_sWidth(u32 value);\r\n    inline u32 _acc_sWidth$(u32 value);\r\n    inline u32 _acc_sWidthpostInc()\t\t\t{ u32 tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline u32 _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline u32 _acc_sWidthpostDec()\t\t\t{ u32 tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline u32 _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline u32 _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline u32 _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline u32 _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline u32 _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline u32 _acc_sWidthAddEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline u32 _acc_sWidth$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline u32 _acc_sWidthSubEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline u32 _acc_sWidth$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline u32 _acc_sWidthMulEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline u32 _acc_sWidth$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline u32 _acc_sWidthDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline u32 _acc_sWidth$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline u32 _acc_sWidthModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() % value); }\r\n    inline u32 _acc_sWidth$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline u32 _acc_sWidthXorEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() ^ value); }\r\n    inline u32 _acc_sWidth$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthXorEq(value); }\r\n    inline u32 _acc_sWidthAndEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() & value); }\r\n    inline u32 _acc_sWidth$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAndEq(value); }\r\n    inline u32 _acc_sWidthOrEq(u32 value)\t\t{ return _acc_sWidth(_acc_gWidth() | value); }\r\n    inline u32 _acc_sWidth$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthOrEq(value); }\r\n    inline u32 _acc_sWidthRShiftEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() >> value); }\r\n    inline u32 _acc_sWidth$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthRShiftEq(value); }\r\n    inline u32 _acc_sWidthLShiftEq(u32 value)\t{ return _acc_sWidth(_acc_gWidth() << value); }\r\n    inline u32 _acc_sWidth$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthLShiftEq(value); }\r\n    inline u32 _acc_gHeight();\r\n    inline u32 _acc_gHeight$();\r\n\r\n    inline u32 _acc_sHeight(u32 value);\r\n    inline u32 _acc_sHeight$(u32 value);\r\n    inline u32 _acc_sHeightpostInc()\t\t\t{ u32 tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline u32 _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline u32 _acc_sHeightpostDec()\t\t\t{ u32 tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline u32 _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline u32 _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline u32 _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline u32 _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline u32 _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline u32 _acc_sHeightAddEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline u32 _acc_sHeight$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline u32 _acc_sHeightSubEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline u32 _acc_sHeight$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline u32 _acc_sHeightMulEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline u32 _acc_sHeight$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline u32 _acc_sHeightDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline u32 _acc_sHeight$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline u32 _acc_sHeightModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() % value); }\r\n    inline u32 _acc_sHeight$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline u32 _acc_sHeightXorEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() ^ value); }\r\n    inline u32 _acc_sHeight$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightXorEq(value); }\r\n    inline u32 _acc_sHeightAndEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() & value); }\r\n    inline u32 _acc_sHeight$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAndEq(value); }\r\n    inline u32 _acc_sHeightOrEq(u32 value)\t\t{ return _acc_sHeight(_acc_gHeight() | value); }\r\n    inline u32 _acc_sHeight$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightOrEq(value); }\r\n    inline u32 _acc_sHeightRShiftEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() >> value); }\r\n    inline u32 _acc_sHeight$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightRShiftEq(value); }\r\n    inline u32 _acc_sHeightLShiftEq(u32 value)\t{ return _acc_sHeight(_acc_gHeight() << value); }\r\n    inline u32 _acc_sHeight$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightLShiftEq(value); }\r\n    inline System::String* _acc_gText();\r\n    inline System::String* _acc_gText$();\r\n\r\n    inline System::String* _acc_sText(System::String* value);\r\n    inline System::String* _acc_sText$(System::String* value);\r\n    inline s32 _acc_gMaxLen();\r\n    inline s32 _acc_gMaxLen$();\r\n\r\n    inline s32 _acc_sMaxLen(s32 value);\r\n    inline s32 _acc_sMaxLen$(s32 value);\r\n    inline s32 _acc_sMaxLenpostInc()\t\t\t{ s32 tmp; _acc_sMaxLen((tmp = _acc_gMaxLen())+1); return tmp; }\r\n    inline s32 _acc_sMaxLen$postInc()\t\t\t{ CHCKTHIS; return _acc_sMaxLenpostInc(); }\r\n    inline s32 _acc_sMaxLenpostDec()\t\t\t{ s32 tmp; _acc_sMaxLen((tmp = _acc_gMaxLen())-1); return tmp; }\r\n    inline s32 _acc_sMaxLen$postDec()\t\t\t{ CHCKTHIS; return _acc_sMaxLenpostDec(); }\r\n    inline s32 _acc_sMaxLenpreInc()\t\t\t{ return _acc_sMaxLen(_acc_gMaxLen()+1); }\r\n    inline s32 _acc_sMaxLen$preInc()\t\t\t{ CHCKTHIS; return _acc_sMaxLenpreInc(); }\r\n    inline s32 _acc_sMaxLenpreDec()\t\t\t{ return _acc_sMaxLen(_acc_gMaxLen()-1); }\r\n    inline s32 _acc_sMaxLen$preDec()\t\t\t{ CHCKTHIS; return _acc_sMaxLenpreDec(); }\r\n    inline s32 _acc_sMaxLenAddEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() + value); }\r\n    inline s32 _acc_sMaxLen$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenAddEq(value); }\r\n    inline s32 _acc_sMaxLenSubEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() - value); }\r\n    inline s32 _acc_sMaxLen$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenSubEq(value); }\r\n    inline s32 _acc_sMaxLenMulEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() * value); }\r\n    inline s32 _acc_sMaxLen$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenMulEq(value); }\r\n    inline s32 _acc_sMaxLenDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxLen(_acc_gMaxLen() / value); }\r\n    inline s32 _acc_sMaxLen$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenDivEq(value); }\r\n    inline s32 _acc_sMaxLenModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sMaxLen(_acc_gMaxLen() % value); }\r\n    inline s32 _acc_sMaxLen$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenModEq(value); }\r\n    inline s32 _acc_sMaxLenXorEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() ^ value); }\r\n    inline s32 _acc_sMaxLen$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenXorEq(value); }\r\n    inline s32 _acc_sMaxLenAndEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() & value); }\r\n    inline s32 _acc_sMaxLen$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenAndEq(value); }\r\n    inline s32 _acc_sMaxLenOrEq(s32 value)\t\t{ return _acc_sMaxLen(_acc_gMaxLen() | value); }\r\n    inline s32 _acc_sMaxLen$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenOrEq(value); }\r\n    inline s32 _acc_sMaxLenRShiftEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() >> value); }\r\n    inline s32 _acc_sMaxLen$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenRShiftEq(value); }\r\n    inline s32 _acc_sMaxLenLShiftEq(s32 value)\t{ return _acc_sMaxLen(_acc_gMaxLen() << value); }\r\n    inline s32 _acc_sMaxLen$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sMaxLenLShiftEq(value); }\r\n    inline s32 _acc_gCharCount();\r\n    inline s32 _acc_gCharCount$();\r\n\r\n    static s32* _ext_CKLBUITextInput_create(s32* parent,bool passwordMode,float x,float y,float width,float height,s32* defaultText,s32 widgetId,s32 maxLen,u32 charType);\r\n    static u32 _ext_CKLBUITextInput_getWidth(s32* p);\r\n    static void _ext_CKLBUITextInput_setWidth(s32* p,u32 width);\r\n    static u32 _ext_CKLBUITextInput_getHeight(s32* p);\r\n    static void _ext_CKLBUITextInput_setHeight(s32* p,u32 height);\r\n    static s32* _ext_CKLBUITextInput_getText(s32* p);\r\n    static void _ext_CKLBUITextInput_setText(s32* p,s32* text);\r\n    static void _ext_CKLBUITextInput_setPlaceHolder(s32* p,s32* placeholder);\r\n    static void _ext_CKLBUITextInput_setColor(s32* p,bool bTouch,u32 foregroundRgb,u32 backgroundRgb);\r\n    static s32 _ext_CKLBUITextInput_getMaxLen(s32* p);\r\n    static void _ext_CKLBUITextInput_setMaxLen(s32* p,s32 maxlen);\r\n    static void _ext_CKLBUITextInput_setCharType(s32* p,u32 chartype);\r\n    static s32 _ext_CKLBUITextInput_getCharCount(s32* p);\r\n    static void _ext_CKLBUITextInput_setFont(s32* p,s32* fontName,float fontSize);\r\n    CKLBUITextInput(EnginePrototype::CKLBUITask* parent,bool passwordMode,s32 x,s32 y,u32 width,u32 height,System::String* defaultText,EnginePrototype::_Delegate_Base_CallBack_inner48* callback,s32 widgetId,s32 maxLen,u32 charType);\r\n    CKLBUITextInput();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(s32* txt,u32 id);\r\n    inline void callBackFunction$(s32* txt,u32 id);\r\n    void getSize(EnginePrototype::USize& size);\r\n    inline void getSize$(EnginePrototype::USize& size);\r\n    void setSize(EnginePrototype::USize size);\r\n    inline void setSize$(EnginePrototype::USize size);\r\n    void setSize(u32 width,u32 height);\r\n    inline void setSize$(u32 width,u32 height);\r\n    void setColor(bool bTouch,u32 foregroundRgb,u32 backgroundRgb);\r\n    inline void setColor$(bool bTouch,u32 foregroundRgb,u32 backgroundRgb);\r\n    void setFont(System::String* fontName,float fontSize);\r\n    inline void setFont$(System::String* fontName,float fontSize);\r\n    void setCharType(s32 chartype);\r\n    inline void setCharType$(s32 chartype);\r\n    void setPlaceHolder(System::String* placeHolder);\r\n    inline void setPlaceHolder$(System::String* placeHolder);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 254;\r\n};\r\nclass EnginePrototype::CKLBUITouchPad : public EnginePrototype::CKLBTask {\r\nfriend class CallBack_inner49;\r\n\r\npublic:\r\n    enum ETYPE {\r\n        TAP,\r\n        DRAG,\r\n        RELEASE,\r\n        _ForceWORD_ETYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUITouchPad();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner49* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner49*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner49* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner49* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner49* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner49* _$value);\r\n\r\n    static s32* _ext_CKLBUITouchPad_create(s32* pParent,bool modal);\r\n    static bool _ext_CKLBUITouchPad_setGroup(s32* p,s32* group_name);\r\n    static void _ext_CKLBUITouchPad_setLock(s32* p,bool lock_mode);\r\n    static void _ext_CKLBUITouchPad_setGetAll(s32* p,bool bAll);\r\n    CKLBUITouchPad(EnginePrototype::CKLBTask* parent,EnginePrototype::_Delegate_Base_CallBack_inner49* callback,bool modal);\r\n    CKLBUITouchPad();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 execount,u32 type,u32 id,s32 x,s32 y);\r\n    inline void callBackFunction$(u32 execount,u32 type,u32 id,s32 x,s32 y);\r\n    void setGetAll(bool bGetAll);\r\n    inline void setGetAll$(bool bGetAll);\r\n    void setLock(bool bLock);\r\n    inline void setLock$(bool bLock);\r\n    bool setGroup(System::String* group_name);\r\n    inline bool setGroup$(System::String* group_name);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 258;\r\n};\r\nclass EnginePrototype::CKLBUIVariableItem : public EnginePrototype::CKLBUITask {\r\n\r\npublic:\r\n    void _ctor_CKLBUIVariableItem();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline System::String* _acc_gAsset();\r\n    inline System::String* _acc_gAsset$();\r\n\r\n    inline System::String* _acc_sAsset(System::String* value);\r\n    inline System::String* _acc_sAsset$(System::String* value);\r\n    inline float _acc_gWidth();\r\n    inline float _acc_gWidth$();\r\n\r\n    inline float _acc_sWidth(float value);\r\n    inline float _acc_sWidth$(float value);\r\n    inline float _acc_sWidthpostInc()\t\t\t{ float tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline float _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline float _acc_sWidthpostDec()\t\t\t{ float tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline float _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline float _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline float _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline float _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline float _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline float _acc_sWidthAddEq(float value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline float _acc_sWidth$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline float _acc_sWidthSubEq(float value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline float _acc_sWidth$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline float _acc_sWidthMulEq(float value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline float _acc_sWidth$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline float _acc_sWidthDivEq(float value)\t{ return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline float _acc_sWidth$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline float _acc_sWidthModEq(float value)\t{  float orig = _acc_gWidth(); s32 tmp = (s32)(orig / value); return _acc_sWidth(orig - (tmp * value)); }\r\n    inline float _acc_sWidth$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline float _acc_gHeight();\r\n    inline float _acc_gHeight$();\r\n\r\n    inline float _acc_sHeight(float value);\r\n    inline float _acc_sHeight$(float value);\r\n    inline float _acc_sHeightpostInc()\t\t\t{ float tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline float _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline float _acc_sHeightpostDec()\t\t\t{ float tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline float _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline float _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline float _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline float _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline float _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline float _acc_sHeightAddEq(float value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline float _acc_sHeight$AddEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline float _acc_sHeightSubEq(float value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline float _acc_sHeight$SubEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline float _acc_sHeightMulEq(float value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline float _acc_sHeight$MulEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline float _acc_sHeightDivEq(float value)\t{ return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline float _acc_sHeight$DivEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline float _acc_sHeightModEq(float value)\t{  float orig = _acc_gHeight(); s32 tmp = (s32)(orig / value); return _acc_sHeight(orig - (tmp * value)); }\r\n    inline float _acc_sHeight$ModEq(float value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    static s32* _ext_CKLBUIVariableItem_create(s32* pParent,u32 order,float x,float y,float width,float height,s32* asset);\r\n    static u32 _ext_CKLBUIVariableItem_getOrder(s32* p);\r\n    static void _ext_CKLBUIVariableItem_setOrder(s32* p,u32 order);\r\n    static s32* _ext_CKLBUIVariableItem_getAsset(s32* p);\r\n    static float _ext_CKLBUIVariableItem_getWidth(s32* p);\r\n    static void _ext_CKLBUIVariableItem_setWidth(s32* p,float width);\r\n    static float _ext_CKLBUIVariableItem_getHeight(s32* p);\r\n    static void _ext_CKLBUIVariableItem_setHeight(s32* p,float height);\r\n    static bool _ext_CKLBUIVariableItem_changeAsset(s32* p,s32* assetName);\r\n    static void _ext_CKLBUIVariableItem_changeUV(s32* p,float x,float y,float width,float height);\r\n    static bool _ext_CKLBUIVariableItem_setMaskAsset(s32* p,s32* assetName);\r\n    CKLBUIVariableItem(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,float width,float height,System::String* asset);\r\n    CKLBUIVariableItem();\r\n    void getSize(EnginePrototype::FSize& size);\r\n    inline void getSize$(EnginePrototype::FSize& size);\r\n    void setUV(float x,float y,float width,float height);\r\n    inline void setUV$(float x,float y,float width,float height);\r\n    bool setMaskAsset(System::String* assetName);\r\n    inline bool setMaskAsset$(System::String* assetName);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 262;\r\n};\r\nclass EnginePrototype::CKLBUIVirtualDoc : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner50;\r\n\r\npublic:\r\n    enum ETYPE {\r\n        TAP,\r\n        DRAG,\r\n        RELEASE,\r\n        _ForceWORD_ETYPE = 0x7FFFFFFF\r\n    };\r\n\r\n    enum EALIGN {\r\n        VD_ALIGN_LEFT = 0,\r\n        VD_ALIGN_CENTER,\r\n        VD_ALIGN_RIGHT,\r\n        _ForceWORD_EALIGN = 0x7FFFFFFF\r\n    };\r\n\r\n    void _ctor_CKLBUIVirtualDoc();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner50* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner50*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner50* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner50* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner50* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner50* _$value);\r\n\r\n    bool m_isLocked;\r\n    inline bool& _gm_isLocked$() { CHCKTHIS; return m_isLocked; }\r\n    inline bool _sm_isLocked$(bool _$value) { CHCKTHIS; return m_isLocked = _$value; }\r\n\r\n    inline u32 _acc_gOrder();\r\n    inline u32 _acc_gOrder$();\r\n\r\n    inline u32 _acc_sOrder(u32 value);\r\n    inline u32 _acc_sOrder$(u32 value);\r\n    inline u32 _acc_sOrderpostInc()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())+1); return tmp; }\r\n    inline u32 _acc_sOrder$postInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpostInc(); }\r\n    inline u32 _acc_sOrderpostDec()\t\t\t{ u32 tmp; _acc_sOrder((tmp = _acc_gOrder())-1); return tmp; }\r\n    inline u32 _acc_sOrder$postDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpostDec(); }\r\n    inline u32 _acc_sOrderpreInc()\t\t\t{ return _acc_sOrder(_acc_gOrder()+1); }\r\n    inline u32 _acc_sOrder$preInc()\t\t\t{ CHCKTHIS; return _acc_sOrderpreInc(); }\r\n    inline u32 _acc_sOrderpreDec()\t\t\t{ return _acc_sOrder(_acc_gOrder()-1); }\r\n    inline u32 _acc_sOrder$preDec()\t\t\t{ CHCKTHIS; return _acc_sOrderpreDec(); }\r\n    inline u32 _acc_sOrderAddEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() + value); }\r\n    inline u32 _acc_sOrder$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAddEq(value); }\r\n    inline u32 _acc_sOrderSubEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() - value); }\r\n    inline u32 _acc_sOrder$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderSubEq(value); }\r\n    inline u32 _acc_sOrderMulEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() * value); }\r\n    inline u32 _acc_sOrder$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderMulEq(value); }\r\n    inline u32 _acc_sOrderDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() / value); }\r\n    inline u32 _acc_sOrder$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderDivEq(value); }\r\n    inline u32 _acc_sOrderModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sOrder(_acc_gOrder() % value); }\r\n    inline u32 _acc_sOrder$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderModEq(value); }\r\n    inline u32 _acc_sOrderXorEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() ^ value); }\r\n    inline u32 _acc_sOrder$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderXorEq(value); }\r\n    inline u32 _acc_sOrderAndEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() & value); }\r\n    inline u32 _acc_sOrder$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderAndEq(value); }\r\n    inline u32 _acc_sOrderOrEq(u32 value)\t\t{ return _acc_sOrder(_acc_gOrder() | value); }\r\n    inline u32 _acc_sOrder$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderOrEq(value); }\r\n    inline u32 _acc_sOrderRShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() >> value); }\r\n    inline u32 _acc_sOrder$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderRShiftEq(value); }\r\n    inline u32 _acc_sOrderLShiftEq(u32 value)\t{ return _acc_sOrder(_acc_gOrder() << value); }\r\n    inline u32 _acc_sOrder$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sOrderLShiftEq(value); }\r\n    inline u32 _acc_gCmdMax();\r\n    inline u32 _acc_gCmdMax$();\r\n\r\n    inline u32 _acc_sCmdMax(u32 value);\r\n    inline u32 _acc_sCmdMax$(u32 value);\r\n    inline u32 _acc_sCmdMaxpostInc()\t\t\t{ u32 tmp; _acc_sCmdMax((tmp = _acc_gCmdMax())+1); return tmp; }\r\n    inline u32 _acc_sCmdMax$postInc()\t\t\t{ CHCKTHIS; return _acc_sCmdMaxpostInc(); }\r\n    inline u32 _acc_sCmdMaxpostDec()\t\t\t{ u32 tmp; _acc_sCmdMax((tmp = _acc_gCmdMax())-1); return tmp; }\r\n    inline u32 _acc_sCmdMax$postDec()\t\t\t{ CHCKTHIS; return _acc_sCmdMaxpostDec(); }\r\n    inline u32 _acc_sCmdMaxpreInc()\t\t\t{ return _acc_sCmdMax(_acc_gCmdMax()+1); }\r\n    inline u32 _acc_sCmdMax$preInc()\t\t\t{ CHCKTHIS; return _acc_sCmdMaxpreInc(); }\r\n    inline u32 _acc_sCmdMaxpreDec()\t\t\t{ return _acc_sCmdMax(_acc_gCmdMax()-1); }\r\n    inline u32 _acc_sCmdMax$preDec()\t\t\t{ CHCKTHIS; return _acc_sCmdMaxpreDec(); }\r\n    inline u32 _acc_sCmdMaxAddEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() + value); }\r\n    inline u32 _acc_sCmdMax$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxAddEq(value); }\r\n    inline u32 _acc_sCmdMaxSubEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() - value); }\r\n    inline u32 _acc_sCmdMax$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxSubEq(value); }\r\n    inline u32 _acc_sCmdMaxMulEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() * value); }\r\n    inline u32 _acc_sCmdMax$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxMulEq(value); }\r\n    inline u32 _acc_sCmdMaxDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sCmdMax(_acc_gCmdMax() / value); }\r\n    inline u32 _acc_sCmdMax$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxDivEq(value); }\r\n    inline u32 _acc_sCmdMaxModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sCmdMax(_acc_gCmdMax() % value); }\r\n    inline u32 _acc_sCmdMax$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxModEq(value); }\r\n    inline u32 _acc_sCmdMaxXorEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() ^ value); }\r\n    inline u32 _acc_sCmdMax$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxXorEq(value); }\r\n    inline u32 _acc_sCmdMaxAndEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() & value); }\r\n    inline u32 _acc_sCmdMax$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxAndEq(value); }\r\n    inline u32 _acc_sCmdMaxOrEq(u32 value)\t\t{ return _acc_sCmdMax(_acc_gCmdMax() | value); }\r\n    inline u32 _acc_sCmdMax$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxOrEq(value); }\r\n    inline u32 _acc_sCmdMaxRShiftEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() >> value); }\r\n    inline u32 _acc_sCmdMax$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxRShiftEq(value); }\r\n    inline u32 _acc_sCmdMaxLShiftEq(u32 value)\t{ return _acc_sCmdMax(_acc_gCmdMax() << value); }\r\n    inline u32 _acc_sCmdMax$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sCmdMaxLShiftEq(value); }\r\n    inline bool _acc_gVertical();\r\n    inline bool _acc_gVertical$();\r\n\r\n    inline bool _acc_sVertical(bool value);\r\n    inline bool _acc_sVertical$(bool value);\r\n    inline u32 _acc_gDocWidth();\r\n    inline u32 _acc_gDocWidth$();\r\n\r\n    inline u32 _acc_sDocWidth(u32 value);\r\n    inline u32 _acc_sDocWidth$(u32 value);\r\n    inline u32 _acc_sDocWidthpostInc()\t\t\t{ u32 tmp; _acc_sDocWidth((tmp = _acc_gDocWidth())+1); return tmp; }\r\n    inline u32 _acc_sDocWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sDocWidthpostInc(); }\r\n    inline u32 _acc_sDocWidthpostDec()\t\t\t{ u32 tmp; _acc_sDocWidth((tmp = _acc_gDocWidth())-1); return tmp; }\r\n    inline u32 _acc_sDocWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sDocWidthpostDec(); }\r\n    inline u32 _acc_sDocWidthpreInc()\t\t\t{ return _acc_sDocWidth(_acc_gDocWidth()+1); }\r\n    inline u32 _acc_sDocWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sDocWidthpreInc(); }\r\n    inline u32 _acc_sDocWidthpreDec()\t\t\t{ return _acc_sDocWidth(_acc_gDocWidth()-1); }\r\n    inline u32 _acc_sDocWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sDocWidthpreDec(); }\r\n    inline u32 _acc_sDocWidthAddEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() + value); }\r\n    inline u32 _acc_sDocWidth$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthAddEq(value); }\r\n    inline u32 _acc_sDocWidthSubEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() - value); }\r\n    inline u32 _acc_sDocWidth$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthSubEq(value); }\r\n    inline u32 _acc_sDocWidthMulEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() * value); }\r\n    inline u32 _acc_sDocWidth$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthMulEq(value); }\r\n    inline u32 _acc_sDocWidthDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sDocWidth(_acc_gDocWidth() / value); }\r\n    inline u32 _acc_sDocWidth$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthDivEq(value); }\r\n    inline u32 _acc_sDocWidthModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sDocWidth(_acc_gDocWidth() % value); }\r\n    inline u32 _acc_sDocWidth$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthModEq(value); }\r\n    inline u32 _acc_sDocWidthXorEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() ^ value); }\r\n    inline u32 _acc_sDocWidth$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthXorEq(value); }\r\n    inline u32 _acc_sDocWidthAndEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() & value); }\r\n    inline u32 _acc_sDocWidth$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthAndEq(value); }\r\n    inline u32 _acc_sDocWidthOrEq(u32 value)\t\t{ return _acc_sDocWidth(_acc_gDocWidth() | value); }\r\n    inline u32 _acc_sDocWidth$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthOrEq(value); }\r\n    inline u32 _acc_sDocWidthRShiftEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() >> value); }\r\n    inline u32 _acc_sDocWidth$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthRShiftEq(value); }\r\n    inline u32 _acc_sDocWidthLShiftEq(u32 value)\t{ return _acc_sDocWidth(_acc_gDocWidth() << value); }\r\n    inline u32 _acc_sDocWidth$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocWidthLShiftEq(value); }\r\n    inline u32 _acc_gDocHeight();\r\n    inline u32 _acc_gDocHeight$();\r\n\r\n    inline u32 _acc_sDocHeight(u32 value);\r\n    inline u32 _acc_sDocHeight$(u32 value);\r\n    inline u32 _acc_sDocHeightpostInc()\t\t\t{ u32 tmp; _acc_sDocHeight((tmp = _acc_gDocHeight())+1); return tmp; }\r\n    inline u32 _acc_sDocHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sDocHeightpostInc(); }\r\n    inline u32 _acc_sDocHeightpostDec()\t\t\t{ u32 tmp; _acc_sDocHeight((tmp = _acc_gDocHeight())-1); return tmp; }\r\n    inline u32 _acc_sDocHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sDocHeightpostDec(); }\r\n    inline u32 _acc_sDocHeightpreInc()\t\t\t{ return _acc_sDocHeight(_acc_gDocHeight()+1); }\r\n    inline u32 _acc_sDocHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sDocHeightpreInc(); }\r\n    inline u32 _acc_sDocHeightpreDec()\t\t\t{ return _acc_sDocHeight(_acc_gDocHeight()-1); }\r\n    inline u32 _acc_sDocHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sDocHeightpreDec(); }\r\n    inline u32 _acc_sDocHeightAddEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() + value); }\r\n    inline u32 _acc_sDocHeight$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightAddEq(value); }\r\n    inline u32 _acc_sDocHeightSubEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() - value); }\r\n    inline u32 _acc_sDocHeight$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightSubEq(value); }\r\n    inline u32 _acc_sDocHeightMulEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() * value); }\r\n    inline u32 _acc_sDocHeight$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightMulEq(value); }\r\n    inline u32 _acc_sDocHeightDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sDocHeight(_acc_gDocHeight() / value); }\r\n    inline u32 _acc_sDocHeight$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightDivEq(value); }\r\n    inline u32 _acc_sDocHeightModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sDocHeight(_acc_gDocHeight() % value); }\r\n    inline u32 _acc_sDocHeight$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightModEq(value); }\r\n    inline u32 _acc_sDocHeightXorEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() ^ value); }\r\n    inline u32 _acc_sDocHeight$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightXorEq(value); }\r\n    inline u32 _acc_sDocHeightAndEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() & value); }\r\n    inline u32 _acc_sDocHeight$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightAndEq(value); }\r\n    inline u32 _acc_sDocHeightOrEq(u32 value)\t\t{ return _acc_sDocHeight(_acc_gDocHeight() | value); }\r\n    inline u32 _acc_sDocHeight$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightOrEq(value); }\r\n    inline u32 _acc_sDocHeightRShiftEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() >> value); }\r\n    inline u32 _acc_sDocHeight$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightRShiftEq(value); }\r\n    inline u32 _acc_sDocHeightLShiftEq(u32 value)\t{ return _acc_sDocHeight(_acc_gDocHeight() << value); }\r\n    inline u32 _acc_sDocHeight$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sDocHeightLShiftEq(value); }\r\n    inline u32 _acc_gViewWidth();\r\n    inline u32 _acc_gViewWidth$();\r\n\r\n    inline u32 _acc_sViewWidth(u32 value);\r\n    inline u32 _acc_sViewWidth$(u32 value);\r\n    inline u32 _acc_sViewWidthpostInc()\t\t\t{ u32 tmp; _acc_sViewWidth((tmp = _acc_gViewWidth())+1); return tmp; }\r\n    inline u32 _acc_sViewWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sViewWidthpostInc(); }\r\n    inline u32 _acc_sViewWidthpostDec()\t\t\t{ u32 tmp; _acc_sViewWidth((tmp = _acc_gViewWidth())-1); return tmp; }\r\n    inline u32 _acc_sViewWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sViewWidthpostDec(); }\r\n    inline u32 _acc_sViewWidthpreInc()\t\t\t{ return _acc_sViewWidth(_acc_gViewWidth()+1); }\r\n    inline u32 _acc_sViewWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sViewWidthpreInc(); }\r\n    inline u32 _acc_sViewWidthpreDec()\t\t\t{ return _acc_sViewWidth(_acc_gViewWidth()-1); }\r\n    inline u32 _acc_sViewWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sViewWidthpreDec(); }\r\n    inline u32 _acc_sViewWidthAddEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() + value); }\r\n    inline u32 _acc_sViewWidth$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthAddEq(value); }\r\n    inline u32 _acc_sViewWidthSubEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() - value); }\r\n    inline u32 _acc_sViewWidth$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthSubEq(value); }\r\n    inline u32 _acc_sViewWidthMulEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() * value); }\r\n    inline u32 _acc_sViewWidth$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthMulEq(value); }\r\n    inline u32 _acc_sViewWidthDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewWidth(_acc_gViewWidth() / value); }\r\n    inline u32 _acc_sViewWidth$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthDivEq(value); }\r\n    inline u32 _acc_sViewWidthModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewWidth(_acc_gViewWidth() % value); }\r\n    inline u32 _acc_sViewWidth$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthModEq(value); }\r\n    inline u32 _acc_sViewWidthXorEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() ^ value); }\r\n    inline u32 _acc_sViewWidth$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthXorEq(value); }\r\n    inline u32 _acc_sViewWidthAndEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() & value); }\r\n    inline u32 _acc_sViewWidth$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthAndEq(value); }\r\n    inline u32 _acc_sViewWidthOrEq(u32 value)\t\t{ return _acc_sViewWidth(_acc_gViewWidth() | value); }\r\n    inline u32 _acc_sViewWidth$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthOrEq(value); }\r\n    inline u32 _acc_sViewWidthRShiftEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() >> value); }\r\n    inline u32 _acc_sViewWidth$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthRShiftEq(value); }\r\n    inline u32 _acc_sViewWidthLShiftEq(u32 value)\t{ return _acc_sViewWidth(_acc_gViewWidth() << value); }\r\n    inline u32 _acc_sViewWidth$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewWidthLShiftEq(value); }\r\n    inline u32 _acc_gViewHeight();\r\n    inline u32 _acc_gViewHeight$();\r\n\r\n    inline u32 _acc_sViewHeight(u32 value);\r\n    inline u32 _acc_sViewHeight$(u32 value);\r\n    inline u32 _acc_sViewHeightpostInc()\t\t\t{ u32 tmp; _acc_sViewHeight((tmp = _acc_gViewHeight())+1); return tmp; }\r\n    inline u32 _acc_sViewHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sViewHeightpostInc(); }\r\n    inline u32 _acc_sViewHeightpostDec()\t\t\t{ u32 tmp; _acc_sViewHeight((tmp = _acc_gViewHeight())-1); return tmp; }\r\n    inline u32 _acc_sViewHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sViewHeightpostDec(); }\r\n    inline u32 _acc_sViewHeightpreInc()\t\t\t{ return _acc_sViewHeight(_acc_gViewHeight()+1); }\r\n    inline u32 _acc_sViewHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sViewHeightpreInc(); }\r\n    inline u32 _acc_sViewHeightpreDec()\t\t\t{ return _acc_sViewHeight(_acc_gViewHeight()-1); }\r\n    inline u32 _acc_sViewHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sViewHeightpreDec(); }\r\n    inline u32 _acc_sViewHeightAddEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() + value); }\r\n    inline u32 _acc_sViewHeight$AddEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightAddEq(value); }\r\n    inline u32 _acc_sViewHeightSubEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() - value); }\r\n    inline u32 _acc_sViewHeight$SubEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightSubEq(value); }\r\n    inline u32 _acc_sViewHeightMulEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() * value); }\r\n    inline u32 _acc_sViewHeight$MulEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightMulEq(value); }\r\n    inline u32 _acc_sViewHeightDivEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewHeight(_acc_gViewHeight() / value); }\r\n    inline u32 _acc_sViewHeight$DivEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightDivEq(value); }\r\n    inline u32 _acc_sViewHeightModEq(u32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sViewHeight(_acc_gViewHeight() % value); }\r\n    inline u32 _acc_sViewHeight$ModEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightModEq(value); }\r\n    inline u32 _acc_sViewHeightXorEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() ^ value); }\r\n    inline u32 _acc_sViewHeight$XorEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightXorEq(value); }\r\n    inline u32 _acc_sViewHeightAndEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() & value); }\r\n    inline u32 _acc_sViewHeight$AndEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightAndEq(value); }\r\n    inline u32 _acc_sViewHeightOrEq(u32 value)\t\t{ return _acc_sViewHeight(_acc_gViewHeight() | value); }\r\n    inline u32 _acc_sViewHeight$OrEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightOrEq(value); }\r\n    inline u32 _acc_sViewHeightRShiftEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() >> value); }\r\n    inline u32 _acc_sViewHeight$RShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightRShiftEq(value); }\r\n    inline u32 _acc_sViewHeightLShiftEq(u32 value)\t{ return _acc_sViewHeight(_acc_gViewHeight() << value); }\r\n    inline u32 _acc_sViewHeight$LShiftEq(u32 value)\t\t\t{ CHCKTHIS; return _acc_sViewHeightLShiftEq(value); }\r\n    static s32* _ext_CKLBUIVirtualDoc_create(s32* pParent,u32 order,float x,float y,u32 docWidth,u32 docHeight,u32 viewWidth,u32 viewHeight,u32 maxCommandNums,bool verticalFlag);\r\n    static void _ext_CKLBUIVirtualDoc_clear(s32* p,u32 color);\r\n    static void _ext_CKLBUIVirtualDoc_setFont(s32* p,u32 idx,s32* fontName,u32 fontSize);\r\n    static void _ext_CKLBUIVirtualDoc_setViewPortPos(s32* p,s32 x,s32 y);\r\n    static void _ext_CKLBUIVirtualDoc_drawLine(s32* p,s32 x0,s32 y0,s32 x1,s32 y1,u32 color);\r\n    static void _ext_CKLBUIVirtualDoc_drawImage(s32* p,s32 x0,s32 y0,s32* image,u32 alpha);\r\n    static void _ext_CKLBUIVirtualDoc_fillRect(s32* p,s32 x0,s32 y0,u32 width,u32 height,u32 color,bool fill);\r\n    static void _ext_CKLBUIVirtualDoc_drawText(s32* p,s32 x0,s32 y0,s32* str,u32 color,u32 fontidx);\r\n    static void _ext_CKLBUIVirtualDoc_startDocument(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_checkDocumentSize(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_endDocument(s32* p);\r\n    static u32 _ext_CKLBUIVirtualDoc_getCommandMax(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setCommandMax(s32* p,u32 command);\r\n    static u32 _ext_CKLBUIVirtualDoc_getDocHeight(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setDocHeight(s32* p,u32 command);\r\n    static u32 _ext_CKLBUIVirtualDoc_getDocWidth(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setDocWidth(s32* p,u32 command);\r\n    static bool _ext_CKLBUIVirtualDoc_getVertical(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setVertical(s32* p,bool vertical);\r\n    static u32 _ext_CKLBUIVirtualDoc_getViewHeight(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setViewHeight(s32* p,u32 height);\r\n    static u32 _ext_CKLBUIVirtualDoc_getViewWidth(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setViewWidth(s32* p,u32 width);\r\n    static u32 _ext_CKLBUIVirtualDoc_getOrder(s32* p);\r\n    static void _ext_CKLBUIVirtualDoc_setOrder(s32* p,u32 order);\r\n    static void _ext_CKLBUIVirtualDoc_setAlign(s32* p,u32 align,s32 alignWidth);\r\n    CKLBUIVirtualDoc(EnginePrototype::CKLBUITask* parent,u32 order,float x,float y,u32 docWidth,u32 docHeight,u32 viewWidth,u32 viewHeight,u32 maxCommandNums,bool verticalFlag,EnginePrototype::_Delegate_Base_CallBack_inner50* callback);\r\n    CKLBUIVirtualDoc();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 type,s32 x,s32 y,u32 moveX,u32 moveY);\r\n    inline void callBackFunction$(u32 type,s32 x,s32 y,u32 moveX,u32 moveY);\r\n    void getDocSize(EnginePrototype::USize& size);\r\n    inline void getDocSize$(EnginePrototype::USize& size);\r\n    void setDocSize(EnginePrototype::USize size);\r\n    inline void setDocSize$(EnginePrototype::USize size);\r\n    void setDocSize(u32 width,u32 height);\r\n    inline void setDocSize$(u32 width,u32 height);\r\n    void getViewSize(EnginePrototype::USize& size);\r\n    inline void getViewSize$(EnginePrototype::USize& size);\r\n    void setViewSize(EnginePrototype::USize size);\r\n    inline void setViewSize$(EnginePrototype::USize size);\r\n    void setViewSize(u32 width,u32 height);\r\n    inline void setViewSize$(u32 width,u32 height);\r\n    void setFont(u32 index,System::String* name,u32 size);\r\n    inline void setFont$(u32 index,System::String* name,u32 size);\r\n    void clear(u32 argb);\r\n    inline void clear$(u32 argb);\r\n    void setViewPortPos(s32 x,s32 y);\r\n    inline void setViewPortPos$(s32 x,s32 y);\r\n    void setAlign(s32 align,s32 alignWidth);\r\n    inline void setAlign$(s32 align,s32 alignWidth);\r\n    void startDrawList(u32 commandCount);\r\n    inline void startDrawList$(u32 commandCount);\r\n    void endDrawList();\r\n    inline void endDrawList$();\r\n    void drawLine(s32 x0,s32 y0,s32 x1,s32 y1,u32 argb);\r\n    inline void drawLine$(s32 x0,s32 y0,s32 x1,s32 y1,u32 argb);\r\n    void drawText(s32 x0,s32 y0,System::String* str,u32 argb,u32 font_index);\r\n    inline void drawText$(s32 x0,s32 y0,System::String* str,u32 argb,u32 font_index);\r\n    void drawFillRect(s32 x0,s32 y0,u32 width,u32 height,u32 argb,bool fill);\r\n    inline void drawFillRect$(s32 x0,s32 y0,u32 width,u32 height,u32 argb,bool fill);\r\n    void drawImage(s32 x,s32 y,System::String* image,u32 alpha);\r\n    inline void drawImage$(s32 x,s32 y,System::String* image,u32 alpha);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 263;\r\n};\r\nclass EnginePrototype::CKLBUIWebArea : public EnginePrototype::CKLBUITask {\r\nfriend class CallBack_inner51;\r\n\r\npublic:\r\n    void _ctor_CKLBUIWebArea();\r\n    static u32 s_classID;\r\n    inline static u32 _ss_classIDDivEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID /= value; }\r\n    inline static u32 _ss_classIDModEq(u32 value)\t\t{ if (value == 0) { THROWDIVZERO; }; ; return s_classID %= value; }\r\n\r\n    EnginePrototype::_Delegate_Base_CallBack_inner51* m_callback;\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner51*& _gm_callback$() { CHCKTHIS; return m_callback; }\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner51* _sm_callback(EnginePrototype::_Delegate_Base_CallBack_inner51* _$value);\r\n    inline EnginePrototype::_Delegate_Base_CallBack_inner51* _sm_callback$(EnginePrototype::_Delegate_Base_CallBack_inner51* _$value);\r\n\r\n    inline s32 _acc_gWidth();\r\n    inline s32 _acc_gWidth$();\r\n\r\n    inline s32 _acc_sWidth(s32 value);\r\n    inline s32 _acc_sWidth$(s32 value);\r\n    inline s32 _acc_sWidthpostInc()\t\t\t{ s32 tmp; _acc_sWidth((tmp = _acc_gWidth())+1); return tmp; }\r\n    inline s32 _acc_sWidth$postInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpostInc(); }\r\n    inline s32 _acc_sWidthpostDec()\t\t\t{ s32 tmp; _acc_sWidth((tmp = _acc_gWidth())-1); return tmp; }\r\n    inline s32 _acc_sWidth$postDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpostDec(); }\r\n    inline s32 _acc_sWidthpreInc()\t\t\t{ return _acc_sWidth(_acc_gWidth()+1); }\r\n    inline s32 _acc_sWidth$preInc()\t\t\t{ CHCKTHIS; return _acc_sWidthpreInc(); }\r\n    inline s32 _acc_sWidthpreDec()\t\t\t{ return _acc_sWidth(_acc_gWidth()-1); }\r\n    inline s32 _acc_sWidth$preDec()\t\t\t{ CHCKTHIS; return _acc_sWidthpreDec(); }\r\n    inline s32 _acc_sWidthAddEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() + value); }\r\n    inline s32 _acc_sWidth$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAddEq(value); }\r\n    inline s32 _acc_sWidthSubEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() - value); }\r\n    inline s32 _acc_sWidth$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthSubEq(value); }\r\n    inline s32 _acc_sWidthMulEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() * value); }\r\n    inline s32 _acc_sWidth$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthMulEq(value); }\r\n    inline s32 _acc_sWidthDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() / value); }\r\n    inline s32 _acc_sWidth$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthDivEq(value); }\r\n    inline s32 _acc_sWidthModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sWidth(_acc_gWidth() % value); }\r\n    inline s32 _acc_sWidth$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthModEq(value); }\r\n    inline s32 _acc_sWidthXorEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() ^ value); }\r\n    inline s32 _acc_sWidth$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthXorEq(value); }\r\n    inline s32 _acc_sWidthAndEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() & value); }\r\n    inline s32 _acc_sWidth$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthAndEq(value); }\r\n    inline s32 _acc_sWidthOrEq(s32 value)\t\t{ return _acc_sWidth(_acc_gWidth() | value); }\r\n    inline s32 _acc_sWidth$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthOrEq(value); }\r\n    inline s32 _acc_sWidthRShiftEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() >> value); }\r\n    inline s32 _acc_sWidth$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthRShiftEq(value); }\r\n    inline s32 _acc_sWidthLShiftEq(s32 value)\t{ return _acc_sWidth(_acc_gWidth() << value); }\r\n    inline s32 _acc_sWidth$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sWidthLShiftEq(value); }\r\n    inline s32 _acc_gHeight();\r\n    inline s32 _acc_gHeight$();\r\n\r\n    inline s32 _acc_sHeight(s32 value);\r\n    inline s32 _acc_sHeight$(s32 value);\r\n    inline s32 _acc_sHeightpostInc()\t\t\t{ s32 tmp; _acc_sHeight((tmp = _acc_gHeight())+1); return tmp; }\r\n    inline s32 _acc_sHeight$postInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpostInc(); }\r\n    inline s32 _acc_sHeightpostDec()\t\t\t{ s32 tmp; _acc_sHeight((tmp = _acc_gHeight())-1); return tmp; }\r\n    inline s32 _acc_sHeight$postDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpostDec(); }\r\n    inline s32 _acc_sHeightpreInc()\t\t\t{ return _acc_sHeight(_acc_gHeight()+1); }\r\n    inline s32 _acc_sHeight$preInc()\t\t\t{ CHCKTHIS; return _acc_sHeightpreInc(); }\r\n    inline s32 _acc_sHeightpreDec()\t\t\t{ return _acc_sHeight(_acc_gHeight()-1); }\r\n    inline s32 _acc_sHeight$preDec()\t\t\t{ CHCKTHIS; return _acc_sHeightpreDec(); }\r\n    inline s32 _acc_sHeightAddEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() + value); }\r\n    inline s32 _acc_sHeight$AddEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAddEq(value); }\r\n    inline s32 _acc_sHeightSubEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() - value); }\r\n    inline s32 _acc_sHeight$SubEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightSubEq(value); }\r\n    inline s32 _acc_sHeightMulEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() * value); }\r\n    inline s32 _acc_sHeight$MulEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightMulEq(value); }\r\n    inline s32 _acc_sHeightDivEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() / value); }\r\n    inline s32 _acc_sHeight$DivEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightDivEq(value); }\r\n    inline s32 _acc_sHeightModEq(s32 value)\t{ if (value == 0) { THROWDIVZERO; }; return _acc_sHeight(_acc_gHeight() % value); }\r\n    inline s32 _acc_sHeight$ModEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightModEq(value); }\r\n    inline s32 _acc_sHeightXorEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() ^ value); }\r\n    inline s32 _acc_sHeight$XorEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightXorEq(value); }\r\n    inline s32 _acc_sHeightAndEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() & value); }\r\n    inline s32 _acc_sHeight$AndEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightAndEq(value); }\r\n    inline s32 _acc_sHeightOrEq(s32 value)\t\t{ return _acc_sHeight(_acc_gHeight() | value); }\r\n    inline s32 _acc_sHeight$OrEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightOrEq(value); }\r\n    inline s32 _acc_sHeightRShiftEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() >> value); }\r\n    inline s32 _acc_sHeight$RShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightRShiftEq(value); }\r\n    inline s32 _acc_sHeightLShiftEq(s32 value)\t{ return _acc_sHeight(_acc_gHeight() << value); }\r\n    inline s32 _acc_sHeight$LShiftEq(s32 value)\t\t\t{ CHCKTHIS; return _acc_sHeightLShiftEq(value); }\r\n    inline System::String* _acc_gUrl();\r\n    inline System::String* _acc_gUrl$();\r\n\r\n    inline System::String* _acc_sUrl(System::String* value);\r\n    inline System::String* _acc_sUrl$(System::String* value);\r\n    static s32* _ext_CKLBUIWebArea_create(s32* pParent,bool mode,float x,float y,float width,float height,s32* url);\r\n    static s32 _ext_CKLBUIWebArea_getWidth(s32* p);\r\n    static void _ext_CKLBUIWebArea_setWidth(s32* p,s32 width);\r\n    static s32 _ext_CKLBUIWebArea_getHeight(s32* p);\r\n    static void _ext_CKLBUIWebArea_setHeight(s32* p,s32 height);\r\n    static s32* _ext_CKLBUIWebArea_getText(s32* p);\r\n    static void _ext_CKLBUIWebArea_setText(s32* p,s32* text);\r\n    static void _ext_CKLBUIWebArea_setScalesPageToFit(s32* p,bool b);\r\n    static void _ext_CKLBUIWebArea_setBgColor(s32* p,u32 argb);\r\n    CKLBUIWebArea(EnginePrototype::CKLBUITask* parent,bool mode,float x,float y,float width,float height,System::String* url,EnginePrototype::_Delegate_Base_CallBack_inner51* callback);\r\n    CKLBUIWebArea();\r\n    virtual void doSetupCallbacks();\r\n    inline void doSetupCallbacks$();\r\n    virtual void setDelegate(System::Delegate* anyDelegate,System::String* delegateName);\r\n    inline void setDelegate$(System::Delegate* anyDelegate,System::String* delegateName);\r\n    virtual void callBackFunction(u32 uint1,s32* url);\r\n    inline void callBackFunction$(u32 uint1,s32* url);\r\n    void getSize(EnginePrototype::Size& size);\r\n    inline void getSize$(EnginePrototype::Size& size);\r\n    void setSize(EnginePrototype::Size size);\r\n    inline void setSize$(EnginePrototype::Size size);\r\n    void setSize(s32 width,s32 height);\r\n    inline void setSize$(s32 width,s32 height);\r\n    void setScalesPageToFit(bool b);\r\n    inline void setScalesPageToFit$(bool b);\r\n    void setBgColor(u32 argb);\r\n    inline void setBgColor$(u32 argb);\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 268;\r\n};\r\n\r\nvoid initFramework();\r\n\r\nclass Program : public System::Object {\r\npublic:\r\n    void _ctor_Program();\r\n\r\n    Program();\r\n    static void start();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = 0xFFFFFFFF;\r\n};\r\n\r\n\r\n#endif // _FRAMEWORK_H\r\n\r\n"
  },
  {
    "path": "SampleProject/Cpp/out.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include \"framework.cpp\"\r\n\r\n/* Stack Trace :  */\r\nstatic const uniChar _$_cteStr118[] = {83,116,97,99,107,32,84,114,97,99,101,32,58,32};\r\nstatic System::String* _$_cteStr118Obj;\r\n\r\n/* Error Message :  */\r\nstatic const uniChar _$_cteStr117[] = {69,114,114,111,114,32,77,101,115,115,97,103,101,32,58,32};\r\nstatic System::String* _$_cteStr117Obj;\r\n\r\n/* Exception Type :  */\r\nstatic const uniChar _$_cteStr116[] = {69,120,99,101,112,116,105,111,110,32,84,121,112,101,32,58,32};\r\nstatic System::String* _$_cteStr116Obj;\r\n\r\n/* ####### Exception Handling ####### */\r\nstatic const uniChar _$_cteStr115[] = {35,35,35,35,35,35,35,32,69,120,99,101,112,116,105,111,110,32,72,97,110,100,108,105,110,103,32,35,35,35,35,35,35,35};\r\nstatic System::String* _$_cteStr115Obj;\r\n\r\n/* Hello World from C#! */\r\nstatic const uniChar _$_cteStr114[] = {72,101,108,108,111,32,87,111,114,108,100,32,102,114,111,109,32,67,35,33};\r\nstatic System::String* _$_cteStr114Obj;\r\n\r\n/* georgia */\r\nstatic const uniChar _$_cteStr113[] = {103,101,111,114,103,105,97};\r\nstatic System::String* _$_cteStr113Obj;\r\n\r\n/* Hello from C# In Console. */\r\nstatic const uniChar _$_cteStr112[] = {72,101,108,108,111,32,102,114,111,109,32,67,35,32,73,110,32,67,111,110,115,111,108,101,46};\r\nstatic System::String* _$_cteStr112Obj;\r\n\r\n\r\nclass Program;\r\n\r\nnamespace SampleGame {\r\n    class Program;\r\n\r\n}\r\nclass SampleGame::Program : public System::Object {\r\n\r\npublic:\r\n    void _ctor_Program();\r\n    static void start();\r\n    static void Main(System::Array<System::String*>* args);\r\n    Program();\r\n    virtual u32 _processGC();\r\n    virtual void _releaseGC();\r\n    virtual bool _isInstanceOf(u32 typeID);\r\n    virtual inline void _moveAlert(u32 offset);\r\nprivate:\r\n    static const u32 _TYPEID = _TYPE_USEROBJECT | ET_CLASS | 272;\r\n};\r\n//\r\n// Class/Struct Implementation\r\n//\r\n\r\n//=============================\r\n// Implementation of 'Program'\r\n//=============================\r\n\r\nvoid SampleGame::Program::_ctor_Program() {\r\n}\r\n\r\n/*static*/\r\nvoid SampleGame::Program::start()\r\n{\r\n    Main((System::Array<System::String*>*)NULL);\r\n}\r\n\r\n/*static*/\r\nvoid SampleGame::Program::Main(System::Array<System::String*>* args)\r\n{\r\n    System::Console::WriteLine(_$_cteStr112Obj);\r\n    TRY\r\n    {\r\n        EnginePrototype::CKLBUILabel* label = CS_NEW EnginePrototype::CKLBUILabel((EnginePrototype::CKLBUITask*)NULL,1000,300,100,0,_$_cteStr113Obj,16,_$_cteStr114Obj,EnginePrototype::CKLBUILabel::EALIGN::MID);\r\n    }\r\n    CTRY\r\n    FIRSTCATCH(System::Exception,ex)\r\n    {\r\n        System::Console::WriteLine(_$_cteStr40Obj);\r\n        System::Console::WriteLine(_$_cteStr115Obj);\r\n        System::Console::WriteLine(_$_cteStr40Obj);\r\n        System::Console::WriteLine();\r\n        System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr116Obj)->_appendStr(ex->GetType$())->_appendClose());\r\n        System::Console::WriteLine();\r\n        System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr117Obj)->_appendStr(ex->_acc_gMessage$())->_appendClose());\r\n        System::Console::WriteLine();\r\n        System::Console::WriteLine((CS_NEW System::String())->_appendStr(_$_cteStr118Obj)->_appendStr(ex->_acc_gStackTrace$())->_appendClose());\r\n    }\r\n    FINALLY\r\n    ETRY\r\n}\r\n\r\nSampleGame::Program::Program() { _ctor_Program(); }\r\n\r\n\r\n\r\n/*virtual*/\r\nbool SampleGame::Program::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Program,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 SampleGame::Program::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid SampleGame::Program::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid SampleGame::Program::_moveAlert(u32 offset) {\r\n}\r\n\r\n//\r\n// Class/Struct Implementation\r\n//\r\n\r\n//=============================\r\n// Implementation of 'Program'\r\n//=============================\r\n\r\nvoid Program::_ctor_Program() {\r\n}\r\n\r\n/*static*/\r\nvoid Program::start()\r\n{\r\n    SampleGame::Program::start();\r\n}\r\n\r\n\r\n\r\n/*virtual*/\r\nbool Program::_isInstanceOf(u32 typeID) {\r\n\t_INSTANCEOF(Program,System::Object);\r\n}\r\n\r\n/*virtual*/\r\nu32 Program::_processGC() {\r\n    return System::__GCObject::COMPLETE;\r\n}\r\n/*virtual*/\r\nvoid Program::_releaseGC() {\r\n}\r\n/*virtual*/\r\nvoid Program::_moveAlert(u32 offset) {\r\n}\r\n\r\n\r\nvoid initAllStatic() {\r\n}\r\n\r\nvoid registerWorldGC() {\r\n    initFramework();\r\n    // Register Strings into the GC.\r\n    _$_cteStr118Obj = CS_NEW System::String(_$_cteStr118,sizeof(_$_cteStr118) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr118Obj);\r\n\r\n    _$_cteStr117Obj = CS_NEW System::String(_$_cteStr117,sizeof(_$_cteStr117) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr117Obj);\r\n\r\n    _$_cteStr116Obj = CS_NEW System::String(_$_cteStr116,sizeof(_$_cteStr116) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr116Obj);\r\n\r\n    _$_cteStr115Obj = CS_NEW System::String(_$_cteStr115,sizeof(_$_cteStr115) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr115Obj);\r\n\r\n    _$_cteStr114Obj = CS_NEW System::String(_$_cteStr114,sizeof(_$_cteStr114) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr114Obj);\r\n\r\n    _$_cteStr113Obj = CS_NEW System::String(_$_cteStr113,sizeof(_$_cteStr113) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr113Obj);\r\n\r\n    _$_cteStr112Obj = CS_NEW System::String(_$_cteStr112,sizeof(_$_cteStr112) / sizeof(uniChar));\r\n    System::Memory::registerGCRoot(&_$_cteStr112Obj);\r\n\r\n\r\n    initAllStatic();\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "SampleProject/game/CSampleProjectEntrance.cpp",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#include <stdlib.h>\r\n#include \"CSampleProjectEntrance.h\"\r\n\r\nbool\r\nGameSetup()\r\n{\r\n\tCSampleProjectEntrance * pClient = CSampleProjectEntrance::getInstance();\r\n\r\n\tCPFInterface& pfif = CPFInterface::getInstance();\r\n\tpfif.setClientRequest(pClient);\r\n\treturn true;\r\n}\r\n\r\nCSampleProjectEntrance::CSampleProjectEntrance() : CKLBGameApplication() {}\r\nCSampleProjectEntrance::~CSampleProjectEntrance() {}\r\n\r\nCSampleProjectEntrance *\r\nCSampleProjectEntrance::getInstance()\r\n{\r\n    static CSampleProjectEntrance instance;\r\n    return &instance;\r\n}\r\n\r\n\r\nbool\r\nCSampleProjectEntrance::initLocalSystem(CKLBAssetManager& mgrAsset)\r\n{\r\n\treturn true;\r\n}\r\n\r\nvoid\r\nCSampleProjectEntrance::localFinish()\r\n{\r\n}\r\n"
  },
  {
    "path": "SampleProject/game/CSampleProjectEntrance.h",
    "content": "﻿/* \r\n   Copyright 2013 KLab Inc.\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n       http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n*/\r\n#ifndef CSampleProjectEntrance_h\r\n#define CSampleProjectEntrance_h\r\n\r\n#include \"CPFInterface.h\"\r\n#include \"CKLBGameApplication.h\"\r\n\r\nclass CSampleProjectEntrance : public CKLBGameApplication\r\n{\r\nprivate:\r\n\tCSampleProjectEntrance();\r\n\tvirtual ~CSampleProjectEntrance();\r\npublic:\r\n    static CSampleProjectEntrance * getInstance();\r\n\r\nprivate:\r\n\tbool initLocalSystem(CKLBAssetManager& mgrAsset);\r\n\tvoid localFinish();\r\n};\r\n\r\n#endif // CSampleProjectEntrance_h\r\n"
  },
  {
    "path": "Tests/OSX/testcases_osx/DummyTest.cpp",
    "content": "#include \"gtest/gtest.h\"\n\n#define private public\n#define protected public\n#include <PlaygroundOSS/CKLBNode.h>\n#undef protected\n#undef private\n\n/**\n * Dummy test case for checking test runner is running properly or not.\n */\nTEST(OSXDummyTest, AlwaysPass)\n{\n    EXPECT_TRUE(1);\n}\n"
  },
  {
    "path": "Tests/OSX/xcode/Config/DebugProject.xcconfig",
    "content": "//\n//  DebugProject.xcconfig\n//\n//  These are Debug Configuration project settings for the gtest framework and\n//  examples. It is set in the \"Based On:\" dropdown in the \"Project\" info\n//  dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n#include \"General.xcconfig\"\n\n// No optimization\nGCC_OPTIMIZATION_LEVEL = 0\n\n// Deployment postprocessing is what triggers Xcode to strip, turn it off\nDEPLOYMENT_POSTPROCESSING = NO\n\n// Dead code stripping off\nDEAD_CODE_STRIPPING = NO\n\n// Debug symbols should be on obviously\nGCC_GENERATE_DEBUGGING_SYMBOLS = YES\n\n// Define the DEBUG macro in all debug builds\nOTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1\n\n// These are turned off to avoid STL incompatibilities with client code\n// // Turns on special C++ STL checks to \"encourage\" good STL use\n// GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS\n"
  },
  {
    "path": "Tests/OSX/xcode/Config/FrameworkTarget.xcconfig",
    "content": "//\n//  FrameworkTarget.xcconfig\n//\n//  These are Framework target settings for the gtest framework and examples. It\n//  is set in the \"Based On:\" dropdown in the \"Target\" info dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n// Dynamic libs need to be position independent\nGCC_DYNAMIC_NO_PIC = NO\n\n// Dynamic libs should not have their external symbols stripped.\nSTRIP_STYLE = non-global\n\n// Let the user install by specifying the $DSTROOT with xcodebuild\nSKIP_INSTALL = NO\n"
  },
  {
    "path": "Tests/OSX/xcode/Config/General.xcconfig",
    "content": "//\n//  General.xcconfig\n//\n//  These are General configuration settings for the gtest framework and\n//  examples.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n// Build for PPC and Intel, 32- and 64-bit\nARCHS = i386 x86_64 ppc ppc64\n\n// Zerolink prevents link warnings so turn it off\nZERO_LINK = NO\n\n// Prebinding considered unhelpful in 10.3 and later\nPREBINDING = NO\n\n// Strictest warning policy\nWARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow\n\n// Work around Xcode bugs by using external strip. See:\n// http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html\nSEPARATE_STRIP = YES\n\n// Force C99 dialect\nGCC_C_LANGUAGE_STANDARD = c99\n\n// not sure why apple defaults this on, but it's pretty risky\nALWAYS_SEARCH_USER_PATHS = NO\n\n// Turn on position dependent code for most cases (overridden where appropriate)\nGCC_DYNAMIC_NO_PIC = YES\n\n// Default SDK and minimum OS version is 10.4\nSDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk\nMACOSX_DEPLOYMENT_TARGET = 10.4\nGCC_VERSION = 4.0\n\n// VERSIONING BUILD SETTINGS (used in Info.plist)\nGTEST_VERSIONINFO_ABOUT =  © 2008 Google Inc.\n"
  },
  {
    "path": "Tests/OSX/xcode/Config/ReleaseProject.xcconfig",
    "content": "//\n//  ReleaseProject.xcconfig\n//\n//  These are Release Configuration project settings for the gtest framework\n//  and examples. It is set in the \"Based On:\" dropdown in the \"Project\" info\n//  dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n#include \"General.xcconfig\"\n\n// subconfig/Release.xcconfig\n\n// Optimize for space and size (Apple recommendation)\nGCC_OPTIMIZATION_LEVEL = s\n\n// Deploment postprocessing is what triggers Xcode to strip\nDEPLOYMENT_POSTPROCESSING = YES\n\n// No symbols\nGCC_GENERATE_DEBUGGING_SYMBOLS = NO\n\n// Dead code strip does not affect ObjC code but can help for C\nDEAD_CODE_STRIPPING = YES\n\n// NDEBUG is used by things like assert.h, so define it for general compat.\n// ASSERT going away in release tends to create unused vars.\nOTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable\n\n// When we strip we want to strip all symbols in release, but save externals.\nSTRIP_STYLE = all\n"
  },
  {
    "path": "Tests/OSX/xcode/Config/StaticLibraryTarget.xcconfig",
    "content": "//\n//  StaticLibraryTarget.xcconfig\n//\n//  These are static library target settings for libgtest.a. It\n//  is set in the \"Based On:\" dropdown in the \"Target\" info dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n// Static libs can be included in bundles so make them position independent\nGCC_DYNAMIC_NO_PIC = NO\n\n// Static libs should not have their internal globals or external symbols\n// stripped.\nSTRIP_STYLE = debugging\n\n// Let the user install by specifying the $DSTROOT with xcodebuild\nSKIP_INSTALL = NO\n"
  },
  {
    "path": "Tests/OSX/xcode/Config/TestTarget.xcconfig",
    "content": "//\n//  TestTarget.xcconfig\n//\n//  These are Test target settings for the gtest framework and examples. It\n//  is set in the \"Based On:\" dropdown in the \"Target\" info dialog.\n\nPRODUCT_NAME = $(TARGET_NAME)\nHEADER_SEARCH_PATHS = ../include\n"
  },
  {
    "path": "Tests/OSX/xcode/Resources/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.google.${PRODUCT_NAME}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>GTEST_VERSIONINFO_LONG</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>GTEST_VERSIONINFO_SHORT</string>\n\t<key>CFBundleGetInfoString</key>\n\t<string>${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT}</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>${GTEST_VERSIONINFO_ABOUT}</string>\n\t<key>CSResourcesFileMapped</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/OSX/xcode/Samples/FrameworkSample/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.google.gtest.${PRODUCT_NAME:identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>CSResourcesFileMapped</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/OSX/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 42;\n\tobjects = {\n\n/* Begin PBXAggregateTarget section */\n\t\t4024D162113D7D2400C7059E /* Test */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 4024D169113D7D4600C7059E /* Build configuration list for PBXAggregateTarget \"Test\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t4024D161113D7D2400C7059E /* ShellScript */,\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t4024D166113D7D3100C7059E /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = Test;\n\t\t\tproductName = TestAndBuild;\n\t\t};\n\t\t4024D1E9113D83FF00C7059E /* TestAndBuild */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 4024D1F0113D842B00C7059E /* Build configuration list for PBXAggregateTarget \"TestAndBuild\" */;\n\t\t\tbuildPhases = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t4024D1ED113D840900C7059E /* PBXTargetDependency */,\n\t\t\t\t4024D1EF113D840D00C7059E /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = TestAndBuild;\n\t\t\tproductName = TestAndBuild;\n\t\t};\n/* End PBXAggregateTarget section */\n\n/* Begin PBXBuildFile section */\n\t\t3B7EB1250E5AEE3500C7F239 /* widget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1230E5AEE3500C7F239 /* widget.cc */; };\n\t\t3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B7EB1240E5AEE3500C7F239 /* widget.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1270E5AEE4600C7F239 /* widget_test.cc */; };\n\t\t3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */; };\n\t\t4024D188113D7D7800C7059E /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4024D185113D7D5500C7059E /* libgtest.a */; };\n\t\t4024D189113D7D7A00C7059E /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4024D183113D7D5500C7059E /* libgtest_main.a */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t3B07BDF00E3F3FAE00647869 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = gTestExample;\n\t\t};\n\t\t4024D165113D7D3100C7059E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 3B07BDE90E3F3F9E00647869;\n\t\t\tremoteInfo = WidgetFrameworkTest;\n\t\t};\n\t\t4024D1EC113D840900C7059E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = WidgetFramework;\n\t\t};\n\t\t4024D1EE113D840D00C7059E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4024D162113D7D2400C7059E;\n\t\t\tremoteInfo = Test;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = WidgetFrameworkTest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3B7EB1230E5AEE3500C7F239 /* widget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget.cc; sourceTree = \"<group>\"; };\n\t\t3B7EB1240E5AEE3500C7F239 /* widget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = widget.h; sourceTree = \"<group>\"; };\n\t\t3B7EB1270E5AEE4600C7F239 /* widget_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget_test.cc; sourceTree = \"<group>\"; };\n\t\t4024D183113D7D5500C7059E /* libgtest_main.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest_main.a; path = /usr/local/lib/libgtest_main.a; sourceTree = \"<absolute>\"; };\n\t\t4024D185113D7D5500C7059E /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest.a; path = /usr/local/lib/libgtest.a; sourceTree = \"<absolute>\"; };\n\t\t4024D1E2113D838200C7059E /* runtests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests.sh; sourceTree = \"<group>\"; };\n\t\t8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t8D07F2C80486CC7A007CD1D0 /* Widget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Widget.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3B07BDE80E3F3F9E00647869 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4024D189113D7D7A00C7059E /* libgtest_main.a in Frameworks */,\n\t\t\t\t4024D188113D7D7800C7059E /* libgtest.a in Frameworks */,\n\t\t\t\t3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8D07F2C30486CC7A007CD1D0 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t034768DDFF38A45A11DB9C8B /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8D07F2C80486CC7A007CD1D0 /* Widget.framework */,\n\t\t\t\t3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0867D691FE84028FC02AAC07 /* gTestExample */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4024D1E1113D836C00C7059E /* Scripts */,\n\t\t\t\t08FB77ACFE841707C02AAC07 /* Source */,\n\t\t\t\t089C1665FE841158C02AAC07 /* Resources */,\n\t\t\t\t3B07BE350E4094E400647869 /* Test */,\n\t\t\t\t0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,\n\t\t\t\t034768DDFF38A45A11DB9C8B /* Products */,\n\t\t\t);\n\t\t\tname = gTestExample;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4024D183113D7D5500C7059E /* libgtest_main.a */,\n\t\t\t\t4024D185113D7D5500C7059E /* libgtest.a */,\n\t\t\t);\n\t\t\tname = \"External Frameworks and Libraries\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t089C1665FE841158C02AAC07 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8D07F2C70486CC7A007CD1D0 /* Info.plist */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t08FB77ACFE841707C02AAC07 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3B7EB1230E5AEE3500C7F239 /* widget.cc */,\n\t\t\t\t3B7EB1240E5AEE3500C7F239 /* widget.h */,\n\t\t\t);\n\t\t\tname = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3B07BE350E4094E400647869 /* Test */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3B7EB1270E5AEE4600C7F239 /* widget_test.cc */,\n\t\t\t);\n\t\t\tname = Test;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4024D1E1113D836C00C7059E /* Scripts */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4024D1E2113D838200C7059E /* runtests.sh */,\n\t\t\t);\n\t\t\tname = Scripts;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3B07BDF40E3F3FB600647869 /* Build configuration list for PBXNativeTarget \"WidgetFrameworkTest\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3B07BDE70E3F3F9E00647869 /* Sources */,\n\t\t\t\t3B07BDE80E3F3F9E00647869 /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t3B07BDF10E3F3FAE00647869 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = WidgetFrameworkTest;\n\t\t\tproductName = gTestExampleTest;\n\t\t\tproductReference = 3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"WidgetFramework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t8D07F2C10486CC7A007CD1D0 /* Sources */,\n\t\t\t\t8D07F2C30486CC7A007CD1D0 /* Frameworks */,\n\t\t\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */,\n\t\t\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */,\n\t\t\t\t8D07F2C50486CC7A007CD1D0 /* Rez */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = WidgetFramework;\n\t\t\tproductInstallPath = \"$(HOME)/Library/Frameworks\";\n\t\t\tproductName = gTestExample;\n\t\t\tproductReference = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t0867D690FE84028FC02AAC07 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tbuildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"WidgetFramework\" */;\n\t\t\tcompatibilityVersion = \"Xcode 2.4\";\n\t\t\thasScannedForEncodings = 1;\n\t\t\tmainGroup = 0867D691FE84028FC02AAC07 /* gTestExample */;\n\t\t\tproductRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */,\n\t\t\t\t3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */,\n\t\t\t\t4024D162113D7D2400C7059E /* Test */,\n\t\t\t\t4024D1E9113D83FF00C7059E /* TestAndBuild */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXRezBuildPhase section */\n\t\t8D07F2C50486CC7A007CD1D0 /* Rez */ = {\n\t\t\tisa = PBXRezBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXRezBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t4024D161113D7D2400C7059E /* ShellScript */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"/bin/bash $SRCROOT/runtests.sh $BUILT_PRODUCTS_DIR/WidgetFrameworkTest\\n\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3B07BDE70E3F3F9E00647869 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8D07F2C10486CC7A007CD1D0 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3B7EB1250E5AEE3500C7F239 /* widget.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t3B07BDF10E3F3FAE00647869 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */;\n\t\t\ttargetProxy = 3B07BDF00E3F3FAE00647869 /* PBXContainerItemProxy */;\n\t\t};\n\t\t4024D166113D7D3100C7059E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */;\n\t\t\ttargetProxy = 4024D165113D7D3100C7059E /* PBXContainerItemProxy */;\n\t\t};\n\t\t4024D1ED113D840900C7059E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */;\n\t\t\ttargetProxy = 4024D1EC113D840900C7059E /* PBXContainerItemProxy */;\n\t\t};\n\t\t4024D1EF113D840D00C7059E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 4024D162113D7D2400C7059E /* Test */;\n\t\t\ttargetProxy = 4024D1EE113D840D00C7059E /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3B07BDEC0E3F3F9F00647869 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = WidgetFrameworkTest;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3B07BDED0E3F3F9F00647869 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = WidgetFrameworkTest;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4024D163113D7D2400C7059E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4024D164113D7D2400C7059E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4024D1EA113D83FF00C7059E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4024D1EB113D83FF00C7059E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24308B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tINFOPLIST_FILE = Info.plist;\n\t\t\t\tINSTALL_PATH = \"@loader_path/../Frameworks\";\n\t\t\t\tPRODUCT_NAME = Widget;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24408B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tINFOPLIST_FILE = Info.plist;\n\t\t\t\tINSTALL_PATH = \"@loader_path/../Frameworks\";\n\t\t\t\tPRODUCT_NAME = Widget;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24708B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = 4.0;\n\t\t\t\tSDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24808B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = 4.0;\n\t\t\t\tSDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3B07BDF40E3F3FB600647869 /* Build configuration list for PBXNativeTarget \"WidgetFrameworkTest\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3B07BDEC0E3F3F9F00647869 /* Debug */,\n\t\t\t\t3B07BDED0E3F3F9F00647869 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4024D169113D7D4600C7059E /* Build configuration list for PBXAggregateTarget \"Test\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4024D163113D7D2400C7059E /* Debug */,\n\t\t\t\t4024D164113D7D2400C7059E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4024D1F0113D842B00C7059E /* Build configuration list for PBXAggregateTarget \"TestAndBuild\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4024D1EA113D83FF00C7059E /* Debug */,\n\t\t\t\t4024D1EB113D83FF00C7059E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"WidgetFramework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24308B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24408B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"WidgetFramework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24708B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24808B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 0867D690FE84028FC02AAC07 /* Project object */;\n}\n"
  },
  {
    "path": "Tests/OSX/xcode/Samples/FrameworkSample/runtests.sh",
    "content": "#!/bin/bash\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Executes the samples and tests for the Google Test Framework.\n\n# Help the dynamic linker find the path to the libraries.\nexport DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR\nexport DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR\n\n# Create some executables.\ntest_executables=$@\n\n# Now execute each one in turn keeping track of how many succeeded and failed.\nsucceeded=0\nfailed=0\nfailed_list=()\nfor test in ${test_executables[*]}; do\n  \"$test\"\n  result=$?\n  if [ $result -eq 0 ]; then\n    succeeded=$(( $succeeded + 1 ))\n  else\n    failed=$(( failed + 1 ))\n    failed_list=\"$failed_list $test\"\n  fi\ndone\n\n# Report the successes and failures to the console.\necho \"Tests complete with $succeeded successes and $failed failures.\"\nif [ $failed -ne 0 ]; then\n  echo \"The following tests failed:\"\n  echo $failed_list\nfi\nexit $failed\n"
  },
  {
    "path": "Tests/OSX/xcode/Samples/FrameworkSample/widget.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: preston.a.jackson@gmail.com (Preston Jackson)\n//\n// Google Test - FrameworkSample\n// widget.cc\n//\n\n// Widget is a very simple class used for demonstrating the use of gtest\n\n#include \"widget.h\"\n\nWidget::Widget(int number, const std::string& name)\n    : number_(number),\n      name_(name) {}\n\nWidget::~Widget() {}\n\nfloat Widget::GetFloatValue() const {\n  return number_;\n}\n\nint Widget::GetIntValue() const {\n  return static_cast<int>(number_);\n}\n\nstd::string Widget::GetStringValue() const {\n  return name_;\n}\n\nvoid Widget::GetCharPtrValue(char* buffer, size_t max_size) const {\n  // Copy the char* representation of name_ into buffer, up to max_size.\n  strncpy(buffer, name_.c_str(), max_size-1);\n  buffer[max_size-1] = '\\0';\n  return;\n}\n"
  },
  {
    "path": "Tests/OSX/xcode/Samples/FrameworkSample/widget.h",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: preston.a.jackson@gmail.com (Preston Jackson)\n//\n// Google Test - FrameworkSample\n// widget.h\n//\n\n// Widget is a very simple class used for demonstrating the use of gtest. It\n// simply stores two values a string and an integer, which are returned via\n// public accessors in multiple forms.\n\n#import <string>\n\nclass Widget {\n public:\n  Widget(int number, const std::string& name);\n  ~Widget();\n\n  // Public accessors to number data\n  float GetFloatValue() const;\n  int GetIntValue() const;\n\n  // Public accessors to the string data\n  std::string GetStringValue() const;\n  void GetCharPtrValue(char* buffer, size_t max_size) const;\n\n private:\n  // Data members\n  float number_;\n  std::string name_;\n};\n"
  },
  {
    "path": "Tests/OSX/xcode/Samples/FrameworkSample/widget_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: preston.a.jackson@gmail.com (Preston Jackson)\n//\n// Google Test - FrameworkSample\n// widget_test.cc\n//\n\n// This is a simple test file for the Widget class in the Widget.framework\n\n#include <string>\n#include \"gtest/gtest.h\"\n\n#include <Widget/widget.h>\n\n// This test verifies that the constructor sets the internal state of the\n// Widget class correctly.\nTEST(WidgetInitializerTest, TestConstructor) {\n  Widget widget(1.0f, \"name\");\n  EXPECT_FLOAT_EQ(1.0f, widget.GetFloatValue());\n  EXPECT_EQ(std::string(\"name\"), widget.GetStringValue());\n}\n\n// This test verifies the conversion of the float and string values to int and\n// char*, respectively.\nTEST(WidgetInitializerTest, TestConversion) {\n  Widget widget(1.0f, \"name\");\n  EXPECT_EQ(1, widget.GetIntValue());\n\n  size_t max_size = 128;\n  char buffer[max_size];\n  widget.GetCharPtrValue(buffer, max_size);\n  EXPECT_STREQ(\"name\", buffer);\n}\n\n// Use the Google Test main that is linked into the framework. It does something\n// like this:\n// int main(int argc, char** argv) {\n//   testing::InitGoogleTest(&argc, argv);\n//   return RUN_ALL_TESTS();\n// }\n"
  },
  {
    "path": "Tests/OSX/xcode/Scripts/runtests.sh",
    "content": "#!/bin/bash\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Executes the samples and tests for the Google Test Framework.\n\n# Help the dynamic linker find the path to the libraries.\nexport DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR\nexport DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR\n\n# Create some executables.\ntest_executables=(\"$BUILT_PRODUCTS_DIR/gtest_unittest-framework\"\n                  \"$BUILT_PRODUCTS_DIR/gtest_unittest\"\n                  \"$BUILT_PRODUCTS_DIR/sample1_unittest-framework\"\n                  \"$BUILT_PRODUCTS_DIR/sample1_unittest-static\")\n\n# Now execute each one in turn keeping track of how many succeeded and failed. \nsucceeded=0\nfailed=0\nfailed_list=()\nfor test in ${test_executables[*]}; do\n  \"$test\"\n  result=$?\n  if [ $result -eq 0 ]; then\n    succeeded=$(( $succeeded + 1 ))\n  else\n    failed=$(( failed + 1 ))\n    failed_list=\"$failed_list $test\"\n  fi\ndone\n\n# Report the successes and failures to the console.\necho \"Tests complete with $succeeded successes and $failed failures.\"\nif [ $failed -ne 0 ]; then\n  echo \"The following tests failed:\"\n  echo $failed_list\nfi\nexit $failed\n"
  },
  {
    "path": "Tests/OSX/xcode/Scripts/versiongenerate.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"A script to prepare version informtion for use the gtest Info.plist file.\n\n  This script extracts the version information from the configure.ac file and\n  uses it to generate a header file containing the same information. The\n  #defines in this header file will be included in during the generation of\n  the Info.plist of the framework, giving the correct value to the version\n  shown in the Finder.\n\n  This script makes the following assumptions (these are faults of the script,\n  not problems with the Autoconf):\n    1. The AC_INIT macro will be contained within the first 1024 characters\n       of configure.ac\n    2. The version string will be 3 integers separated by periods and will be\n       surrounded by squre brackets, \"[\" and \"]\" (e.g. [1.0.1]). The first\n       segment represents the major version, the second represents the minor\n       version and the third represents the fix version.\n    3. No \")\" character exists between the opening \"(\" and closing \")\" of\n       AC_INIT, including in comments and character strings.\n\"\"\"\n\nimport sys\nimport re\n\n# Read the command line argument (the output directory for Version.h)\nif (len(sys.argv) < 3):\n  print \"Usage: versiongenerate.py input_dir output_dir\"\n  sys.exit(1)\nelse:\n  input_dir = sys.argv[1]\n  print input_dir\n  output_dir = sys.argv[2]\n\n# Read the first 1024 characters of the configure.ac file\nconfig_file = open(\"%s/configure.ac\" % input_dir, 'r')\nbuffer_size = 1024\nopening_string = config_file.read(buffer_size)\nconfig_file.close()\n\n# Extract the version string from the AC_INIT macro\n#   The following init_expression means:\n#     Extract three integers separated by periods and surrounded by squre\n#     brackets(e.g. \"[1.0.1]\") between \"AC_INIT(\" and \")\". Do not be greedy\n#     (*? is the non-greedy flag) since that would pull in everything between\n#     the first \"(\" and the last \")\" in the file.\nversion_expression = re.compile(r\"AC_INIT\\(.*?\\[(\\d+)\\.(\\d+)\\.(\\d+)\\].*?\\)\",\n                                re.DOTALL)\nversion_values = version_expression.search(opening_string)\nmajor_version = version_values.group(1)\nminor_version = version_values.group(2)\nfix_version = version_values.group(3)\n\n# Write the version information to a header file to be included in the\n# Info.plist file.\nfile_data = \"\"\"//\n// DO NOT MODIFY THIS FILE (but you can delete it)\n//\n// This file is autogenerated by the versiongenerate.py script. This script\n// is executed in a \"Run Script\" build phase when creating gtest.framework. This\n// header file is not used during compilation of C-source. Rather, it simply\n// defines some version strings for substitution in the Info.plist. Because of\n// this, we are not not restricted to C-syntax nor are we using include guards.\n//\n\n#define GTEST_VERSIONINFO_SHORT %s.%s\n#define GTEST_VERSIONINFO_LONG %s.%s.%s\n\n\"\"\" % (major_version, minor_version, major_version, minor_version, fix_version)\nversion_file = open(\"%s/Version.h\" % output_dir, 'w')\nversion_file.write(file_data)\nversion_file.close()\n"
  },
  {
    "path": "Tests/OSX/xcode/gtest.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXAggregateTarget section */\n\t\t3B238F5F0E828B5400846E11 /* Check */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 3B238FA30E828BB600846E11 /* Build configuration list for PBXAggregateTarget \"Check\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3B238F5E0E828B5400846E11 /* ShellScript */,\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40899F9D0FFA740F000B29AE /* PBXTargetDependency */,\n\t\t\t\t40C849F7101A43440083642A /* PBXTargetDependency */,\n\t\t\t\t4089A0980FFAD34A000B29AE /* PBXTargetDependency */,\n\t\t\t\t40C849F9101A43490083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = Check;\n\t\t\tproductName = Check;\n\t\t};\n\t\t40C44ADC0E3798F4008FCC51 /* Version Info */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 40C44AE40E379905008FCC51 /* Build configuration list for PBXAggregateTarget \"Version Info\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C44ADB0E3798F4008FCC51 /* Generate Version.h */,\n\t\t\t);\n\t\t\tcomments = \"The generation of Version.h must be performed in its own target. Since the Info.plist is preprocessed before any of the other build phases in gtest, the Version.h file would not be ready if included as a build phase of that target.\";\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"Version Info\";\n\t\t\tproductName = Version.h;\n\t\t};\n/* End PBXAggregateTarget section */\n\n/* Begin PBXBuildFile section */\n\t\t224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */ = {isa = PBXBuildFile; fileRef = 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t32D86EC8182FE06800210C28 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86EC6182FE06800210C28 /* AVFoundation.framework */; };\n\t\t32D86EC9182FE06800210C28 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86EC7182FE06800210C28 /* OpenGL.framework */; };\n\t\t32D86ED0182FE06E00210C28 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86ECA182FE06E00210C28 /* Security.framework */; };\n\t\t32D86ED1182FE06E00210C28 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86ECB182FE06E00210C28 /* CoreVideo.framework */; };\n\t\t32D86ED2182FE06E00210C28 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86ECC182FE06E00210C28 /* libz.dylib */; };\n\t\t32D86ED3182FE06E00210C28 /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86ECD182FE06E00210C28 /* libcurl.dylib */; };\n\t\t32D86ED4182FE06E00210C28 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86ECE182FE06E00210C28 /* AudioToolbox.framework */; };\n\t\t32D86ED5182FE06E00210C28 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86ECF182FE06E00210C28 /* AudioUnit.framework */; };\n\t\t32D86EF9182FF4D800210C28 /* PlaygroundOSS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86EF8182FF4D800210C28 /* PlaygroundOSS.framework */; };\n\t\t32D86EFB182FF4EA00210C28 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86EFA182FF4EA00210C28 /* QuartzCore.framework */; };\n\t\t32D86EFD182FF50700210C28 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D86EFC182FF50700210C28 /* Cocoa.framework */; };\n\t\t32D86F03182FFB9B00210C28 /* DummyTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32D86F01182FFB9B00210C28 /* DummyTest.cpp */; };\n\t\t32D86F07182FFC5F00210C28 /* CKLBNodeRenderCountTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32D86F06182FFC5F00210C28 /* CKLBNodeRenderCountTest.cpp */; };\n\t\t3BF6F2A00E79B5AD000F2EEE /* gtest-type-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */; };\n\t\t3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DB0E2F799B00CF7658 /* gtest-death-test.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t404884390E2F799B00CF7658 /* gtest-message.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DC0E2F799B00CF7658 /* gtest-message.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DD0E2F799B00CF7658 /* gtest-spi.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843B0E2F799B00CF7658 /* gtest.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DE0E2F799B00CF7658 /* gtest.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883E00E2F799B00CF7658 /* gtest_prod.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */; };\n\t\t404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E30E2F799B00CF7658 /* gtest-filepath.h */; };\n\t\t404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E40E2F799B00CF7658 /* gtest-internal.h */; };\n\t\t404884A30E2F7BE600CF7658 /* gtest-port.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E50E2F799B00CF7658 /* gtest-port.h */; };\n\t\t404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E60E2F799B00CF7658 /* gtest-string.h */; };\n\t\t40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };\n\t\t40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 40899F4D0FFA7271000B29AE /* gtest-tuple.h */; };\n\t\t40C848FF101A21150083642A /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };\n\t\t40C84915101A21DF0083642A /* gtest_main.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4048840D0E2F799B00CF7658 /* gtest_main.cc */; };\n\t\t40C84916101A235B0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84921101A23AD0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84978101A36540083642A /* libgtest_main.a in Resources */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84982101A36850083642A /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C848FA101A209C0083642A /* libgtest.a */; };\n\t\t40C84983101A36850083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84992101A36A60083642A /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C848FA101A209C0083642A /* libgtest.a */; };\n\t\t40C84993101A36A60083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C849A2101A37050083642A /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4539C8FF0EC27F6400A70F4C /* gtest.framework */; };\n\t\t40C849A4101A37150083642A /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4539C8FF0EC27F6400A70F4C /* gtest.framework */; };\n\t\t4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 4539C9330EC280AE00A70F4C /* gtest-param-test.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4539C9380EC280E200A70F4C /* gtest-linked_ptr.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */; };\n\t\t4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */; };\n\t\t4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9370EC280E200A70F4C /* gtest-param-util.h */; };\n\t\t4567C8181264FF71007740BE /* gtest-printers.h in Headers */ = {isa = PBXBuildFile; fileRef = 4567C8171264FF71007740BE /* gtest-printers.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t40899F9C0FFA740F000B29AE /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40899F420FFA7184000B29AE;\n\t\t\tremoteInfo = gtest_unittest;\n\t\t};\n\t\t4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4089A0120FFACEFC000B29AE;\n\t\t\tremoteInfo = sample1_unittest;\n\t\t};\n\t\t408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C848F9101A209C0083642A;\n\t\t\tremoteInfo = \"gtest-static\";\n\t\t};\n\t\t40C44AE50E379922008FCC51 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C44ADC0E3798F4008FCC51;\n\t\t\tremoteInfo = Version.h;\n\t\t};\n\t\t40C8497C101A36850083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C848F9101A209C0083642A;\n\t\t\tremoteInfo = \"gtest-static\";\n\t\t};\n\t\t40C8497E101A36850083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8490A101A217E0083642A;\n\t\t\tremoteInfo = \"gtest_main-static\";\n\t\t};\n\t\t40C8498B101A36A60083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C848F9101A209C0083642A;\n\t\t\tremoteInfo = \"gtest-static\";\n\t\t};\n\t\t40C8498D101A36A60083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8490A101A217E0083642A;\n\t\t\tremoteInfo = \"gtest_main-static\";\n\t\t};\n\t\t40C8499B101A36DC0083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8490A101A217E0083642A;\n\t\t\tremoteInfo = \"gtest_main-static\";\n\t\t};\n\t\t40C8499D101A36E50083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = \"gtest-framework\";\n\t\t};\n\t\t40C8499F101A36F10083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = \"gtest-framework\";\n\t\t};\n\t\t40C849F6101A43440083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8497A101A36850083642A;\n\t\t\tremoteInfo = \"gtest_unittest-static\";\n\t\t};\n\t\t40C849F8101A43490083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C84989101A36A60083642A;\n\t\t\tremoteInfo = \"sample1_unittest-static\";\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t404884A50E2F7C0400CF7658 /* Copy Headers Internal */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = Headers/internal;\n\t\t\tdstSubfolderSpec = 6;\n\t\t\tfiles = (\n\t\t\t\t404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */,\n\t\t\t\t404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */,\n\t\t\t\t404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */,\n\t\t\t\t4539C9380EC280E200A70F4C /* gtest-linked_ptr.h in Copy Headers Internal */,\n\t\t\t\t4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */,\n\t\t\t\t4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */,\n\t\t\t\t404884A30E2F7BE600CF7658 /* gtest-port.h in Copy Headers Internal */,\n\t\t\t\t404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */,\n\t\t\t\t40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */,\n\t\t\t\t3BF6F2A00E79B5AD000F2EEE /* gtest-type-util.h in Copy Headers Internal */,\n\t\t\t);\n\t\t\tname = \"Copy Headers Internal\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t224A12A10E9EADA700BD17FD /* gtest-all.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = \"gtest-all.cc\"; sourceTree = \"<group>\"; };\n\t\t224A12A20E9EADCC00BD17FD /* gtest-test-part.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = \"gtest-test-part.h\"; sourceTree = \"<group>\"; };\n\t\t32D86EC6182FE06800210C28 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t32D86EC7182FE06800210C28 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; };\n\t\t32D86ECA182FE06E00210C28 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };\n\t\t32D86ECB182FE06E00210C28 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreVideo.framework; sourceTree = DEVELOPER_DIR; };\n\t\t32D86ECC182FE06E00210C28 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = libz.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };\n\t\t32D86ECD182FE06E00210C28 /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = \"compiled.mach-o.dylib\"; name = libcurl.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libcurl.dylib; sourceTree = DEVELOPER_DIR; };\n\t\t32D86ECE182FE06E00210C28 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AudioToolbox.framework; sourceTree = DEVELOPER_DIR; };\n\t\t32D86ECF182FE06E00210C28 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AudioUnit.framework; sourceTree = DEVELOPER_DIR; };\n\t\t32D86EF8182FF4D800210C28 /* PlaygroundOSS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PlaygroundOSS.framework; path = ../../../Engine/prebuilt/OSX/PlaygroundOSS.framework; sourceTree = SOURCE_ROOT; };\n\t\t32D86EFA182FF4EA00210C28 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };\n\t\t32D86EFC182FF50700210C28 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };\n\t\t32D86F01182FFB9B00210C28 /* DummyTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DummyTest.cpp; sourceTree = \"<group>\"; };\n\t\t32D86F06182FFC5F00210C28 /* CKLBNodeRenderCountTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CKLBNodeRenderCountTest.cpp; sourceTree = \"<group>\"; };\n\t\t3B87D2100E96B92E000D1852 /* runtests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests.sh; sourceTree = \"<group>\"; };\n\t\t3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-type-util.h\"; sourceTree = \"<group>\"; };\n\t\t3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-typed-test.h\"; sourceTree = \"<group>\"; };\n\t\t403EE37C0E377822004BD1E2 /* versiongenerate.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = versiongenerate.py; sourceTree = \"<group>\"; };\n\t\t404883DB0E2F799B00CF7658 /* gtest-death-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-death-test.h\"; sourceTree = \"<group>\"; };\n\t\t404883DC0E2F799B00CF7658 /* gtest-message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-message.h\"; sourceTree = \"<group>\"; };\n\t\t404883DD0E2F799B00CF7658 /* gtest-spi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-spi.h\"; sourceTree = \"<group>\"; };\n\t\t404883DE0E2F799B00CF7658 /* gtest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest.h; sourceTree = \"<group>\"; };\n\t\t404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest_pred_impl.h; sourceTree = \"<group>\"; };\n\t\t404883E00E2F799B00CF7658 /* gtest_prod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest_prod.h; sourceTree = \"<group>\"; };\n\t\t404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-death-test-internal.h\"; sourceTree = \"<group>\"; };\n\t\t404883E30E2F799B00CF7658 /* gtest-filepath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-filepath.h\"; sourceTree = \"<group>\"; };\n\t\t404883E40E2F799B00CF7658 /* gtest-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-internal.h\"; sourceTree = \"<group>\"; };\n\t\t404883E50E2F799B00CF7658 /* gtest-port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-port.h\"; sourceTree = \"<group>\"; };\n\t\t404883E60E2F799B00CF7658 /* gtest-string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-string.h\"; sourceTree = \"<group>\"; };\n\t\t4048840D0E2F799B00CF7658 /* gtest_main.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_main.cc; sourceTree = \"<group>\"; };\n\t\t40899F430FFA7184000B29AE /* gtest_unittest-framework */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = \"gtest_unittest-framework\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40899F4D0FFA7271000B29AE /* gtest-tuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-tuple.h\"; sourceTree = \"<group>\"; };\n\t\t40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = StaticLibraryTarget.xcconfig; sourceTree = \"<group>\"; };\n\t\t4089A0130FFACEFC000B29AE /* sample1_unittest-framework */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = \"sample1_unittest-framework\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C848FA101A209C0083642A /* libgtest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C8490B101A217E0083642A /* libgtest_main.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgtest_main.a; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C84987101A36850083642A /* gtest_unittest */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = gtest_unittest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C84997101A36A60083642A /* playground_unittest-static */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = \"playground_unittest-static\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40D4CDF10E30E07400294801 /* DebugProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugProject.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FrameworkTarget.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CDF30E30E07400294801 /* General.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ReleaseProject.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CF510E30F5E200294801 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t4539C8FF0EC27F6400A70F4C /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = gtest.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t4539C9330EC280AE00A70F4C /* gtest-param-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-param-test.h\"; sourceTree = \"<group>\"; };\n\t\t4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-linked_ptr.h\"; sourceTree = \"<group>\"; };\n\t\t4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-param-util-generated.h\"; sourceTree = \"<group>\"; };\n\t\t4539C9370EC280E200A70F4C /* gtest-param-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-param-util.h\"; sourceTree = \"<group>\"; };\n\t\t4567C8171264FF71007740BE /* gtest-printers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-printers.h\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t40899F410FFA7184000B29AE /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C849A4101A37150083642A /* gtest.framework in Frameworks */,\n\t\t\t\t40C84916101A235B0083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4089A0110FFACEFC000B29AE /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C849A2101A37050083642A /* gtest.framework in Frameworks */,\n\t\t\t\t40C84921101A23AD0083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C84981101A36850083642A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84982101A36850083642A /* libgtest.a in Frameworks */,\n\t\t\t\t40C84983101A36850083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C84991101A36A60083642A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86EFD182FF50700210C28 /* Cocoa.framework in Frameworks */,\n\t\t\t\t32D86EFB182FF4EA00210C28 /* QuartzCore.framework in Frameworks */,\n\t\t\t\t32D86EF9182FF4D800210C28 /* PlaygroundOSS.framework in Frameworks */,\n\t\t\t\t40C84992101A36A60083642A /* libgtest.a in Frameworks */,\n\t\t\t\t40C84993101A36A60083642A /* libgtest_main.a in Frameworks */,\n\t\t\t\t32D86EC8182FE06800210C28 /* AVFoundation.framework in Frameworks */,\n\t\t\t\t32D86EC9182FE06800210C28 /* OpenGL.framework in Frameworks */,\n\t\t\t\t32D86ED0182FE06E00210C28 /* Security.framework in Frameworks */,\n\t\t\t\t32D86ED1182FE06E00210C28 /* CoreVideo.framework in Frameworks */,\n\t\t\t\t32D86ED2182FE06E00210C28 /* libz.dylib in Frameworks */,\n\t\t\t\t32D86ED3182FE06E00210C28 /* libcurl.dylib in Frameworks */,\n\t\t\t\t32D86ED4182FE06E00210C28 /* AudioToolbox.framework in Frameworks */,\n\t\t\t\t32D86ED5182FE06E00210C28 /* AudioUnit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t034768DDFF38A45A11DB9C8B /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4539C8FF0EC27F6400A70F4C /* gtest.framework */,\n\t\t\t\t40C848FA101A209C0083642A /* libgtest.a */,\n\t\t\t\t40C8490B101A217E0083642A /* libgtest_main.a */,\n\t\t\t\t40899F430FFA7184000B29AE /* gtest_unittest-framework */,\n\t\t\t\t40C84987101A36850083642A /* gtest_unittest */,\n\t\t\t\t4089A0130FFACEFC000B29AE /* sample1_unittest-framework */,\n\t\t\t\t40C84997101A36A60083642A /* playground_unittest-static */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0867D691FE84028FC02AAC07 /* gtest */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40D4CDF00E30E07400294801 /* Config */,\n\t\t\t\t08FB77ACFE841707C02AAC07 /* Source */,\n\t\t\t\t40D4CF4E0E30F5E200294801 /* Resources */,\n\t\t\t\t403EE37B0E377822004BD1E2 /* Scripts */,\n\t\t\t\t32D86EFE182FF7E100210C28 /* Frameworks */,\n\t\t\t\t034768DDFF38A45A11DB9C8B /* Products */,\n\t\t\t);\n\t\t\tname = gtest;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t08FB77ACFE841707C02AAC07 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86F05182FFC5F00210C28 /* testcases_common */,\n\t\t\t\t4089A02F0FFACF84000B29AE /* testcases_osx */,\n\t\t\t\t404883D90E2F799B00CF7658 /* include */,\n\t\t\t\t404884070E2F799B00CF7658 /* src */,\n\t\t\t);\n\t\t\tname = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32D86EFE182FF7E100210C28 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86EFC182FF50700210C28 /* Cocoa.framework */,\n\t\t\t\t32D86EFA182FF4EA00210C28 /* QuartzCore.framework */,\n\t\t\t\t32D86EF8182FF4D800210C28 /* PlaygroundOSS.framework */,\n\t\t\t\t32D86ECA182FE06E00210C28 /* Security.framework */,\n\t\t\t\t32D86ECB182FE06E00210C28 /* CoreVideo.framework */,\n\t\t\t\t32D86ECC182FE06E00210C28 /* libz.dylib */,\n\t\t\t\t32D86ECD182FE06E00210C28 /* libcurl.dylib */,\n\t\t\t\t32D86ECE182FE06E00210C28 /* AudioToolbox.framework */,\n\t\t\t\t32D86ECF182FE06E00210C28 /* AudioUnit.framework */,\n\t\t\t\t32D86EC6182FE06800210C28 /* AVFoundation.framework */,\n\t\t\t\t32D86EC7182FE06800210C28 /* OpenGL.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32D86F05182FFC5F00210C28 /* testcases_common */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86F06182FFC5F00210C28 /* CKLBNodeRenderCountTest.cpp */,\n\t\t\t);\n\t\t\tname = testcases_common;\n\t\t\tpath = ../../testcases_common;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t403EE37B0E377822004BD1E2 /* Scripts */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t403EE37C0E377822004BD1E2 /* versiongenerate.py */,\n\t\t\t\t3B87D2100E96B92E000D1852 /* runtests.sh */,\n\t\t\t);\n\t\t\tpath = Scripts;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t404883D90E2F799B00CF7658 /* include */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404883DA0E2F799B00CF7658 /* gtest */,\n\t\t\t);\n\t\t\tname = include;\n\t\t\tpath = ../../gtest/include;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t404883DA0E2F799B00CF7658 /* gtest */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404883E10E2F799B00CF7658 /* internal */,\n\t\t\t\t224A12A20E9EADCC00BD17FD /* gtest-test-part.h */,\n\t\t\t\t404883DB0E2F799B00CF7658 /* gtest-death-test.h */,\n\t\t\t\t404883DC0E2F799B00CF7658 /* gtest-message.h */,\n\t\t\t\t4539C9330EC280AE00A70F4C /* gtest-param-test.h */,\n\t\t\t\t4567C8171264FF71007740BE /* gtest-printers.h */,\n\t\t\t\t404883DD0E2F799B00CF7658 /* gtest-spi.h */,\n\t\t\t\t404883DE0E2F799B00CF7658 /* gtest.h */,\n\t\t\t\t404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */,\n\t\t\t\t404883E00E2F799B00CF7658 /* gtest_prod.h */,\n\t\t\t\t3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */,\n\t\t\t);\n\t\t\tpath = gtest;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t404883E10E2F799B00CF7658 /* internal */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */,\n\t\t\t\t404883E30E2F799B00CF7658 /* gtest-filepath.h */,\n\t\t\t\t404883E40E2F799B00CF7658 /* gtest-internal.h */,\n\t\t\t\t4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */,\n\t\t\t\t4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */,\n\t\t\t\t4539C9370EC280E200A70F4C /* gtest-param-util.h */,\n\t\t\t\t404883E50E2F799B00CF7658 /* gtest-port.h */,\n\t\t\t\t404883E60E2F799B00CF7658 /* gtest-string.h */,\n\t\t\t\t40899F4D0FFA7271000B29AE /* gtest-tuple.h */,\n\t\t\t\t3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */,\n\t\t\t);\n\t\t\tpath = internal;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t404884070E2F799B00CF7658 /* src */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t224A12A10E9EADA700BD17FD /* gtest-all.cc */,\n\t\t\t\t4048840D0E2F799B00CF7658 /* gtest_main.cc */,\n\t\t\t);\n\t\t\tname = src;\n\t\t\tpath = ../../gtest/src;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t4089A02F0FFACF84000B29AE /* testcases_osx */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32D86F01182FFB9B00210C28 /* DummyTest.cpp */,\n\t\t\t);\n\t\t\tname = testcases_osx;\n\t\t\tpath = ../testcases_osx;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t40D4CDF00E30E07400294801 /* Config */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40D4CDF10E30E07400294801 /* DebugProject.xcconfig */,\n\t\t\t\t40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */,\n\t\t\t\t40D4CDF30E30E07400294801 /* General.xcconfig */,\n\t\t\t\t40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */,\n\t\t\t\t40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */,\n\t\t\t);\n\t\t\tpath = Config;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t40D4CF4E0E30F5E200294801 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40D4CF510E30F5E200294801 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */,\n\t\t\t\t404884390E2F799B00CF7658 /* gtest-message.h in Headers */,\n\t\t\t\t4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */,\n\t\t\t\t4567C8181264FF71007740BE /* gtest-printers.h in Headers */,\n\t\t\t\t3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */,\n\t\t\t\t4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */,\n\t\t\t\t4048843B0E2F799B00CF7658 /* gtest.h in Headers */,\n\t\t\t\t4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */,\n\t\t\t\t4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */,\n\t\t\t\t224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t40899F420FFA7184000B29AE /* gtest_unittest-framework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40899F4A0FFA71BC000B29AE /* Build configuration list for PBXNativeTarget \"gtest_unittest-framework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40899F400FFA7184000B29AE /* Sources */,\n\t\t\t\t40899F410FFA7184000B29AE /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C849A0101A36F10083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"gtest_unittest-framework\";\n\t\t\tproductName = gtest_unittest;\n\t\t\tproductReference = 40899F430FFA7184000B29AE /* gtest_unittest-framework */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t4089A0120FFACEFC000B29AE /* sample1_unittest-framework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4089A0240FFACF01000B29AE /* Build configuration list for PBXNativeTarget \"sample1_unittest-framework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t4089A0100FFACEFC000B29AE /* Sources */,\n\t\t\t\t4089A0110FFACEFC000B29AE /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C8499E101A36E50083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"sample1_unittest-framework\";\n\t\t\tproductName = sample1_unittest;\n\t\t\tproductReference = 4089A0130FFACEFC000B29AE /* sample1_unittest-framework */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t40C848F9101A209C0083642A /* gtest-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84902101A212E0083642A /* Build configuration list for PBXNativeTarget \"gtest-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C848F7101A209C0083642A /* Sources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"gtest-static\";\n\t\t\tproductName = \"gtest-static\";\n\t\t\tproductReference = 40C848FA101A209C0083642A /* libgtest.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n\t\t40C8490A101A217E0083642A /* gtest_main-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84912101A21D20083642A /* Build configuration list for PBXNativeTarget \"gtest_main-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C84908101A217E0083642A /* Sources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"gtest_main-static\";\n\t\t\tproductName = \"gtest_main-static\";\n\t\t\tproductReference = 40C8490B101A217E0083642A /* libgtest_main.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n\t\t40C8497A101A36850083642A /* gtest_unittest-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84984101A36850083642A /* Build configuration list for PBXNativeTarget \"gtest_unittest-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C8497F101A36850083642A /* Sources */,\n\t\t\t\t40C84981101A36850083642A /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C8497B101A36850083642A /* PBXTargetDependency */,\n\t\t\t\t40C8497D101A36850083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"gtest_unittest-static\";\n\t\t\tproductName = gtest_unittest;\n\t\t\tproductReference = 40C84987101A36850083642A /* gtest_unittest */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t40C84989101A36A60083642A /* sample1_unittest-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84994101A36A60083642A /* Build configuration list for PBXNativeTarget \"sample1_unittest-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C8498E101A36A60083642A /* Sources */,\n\t\t\t\t40C84991101A36A60083642A /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C8498A101A36A60083642A /* PBXTargetDependency */,\n\t\t\t\t40C8498C101A36A60083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"sample1_unittest-static\";\n\t\t\tproductName = sample1_unittest;\n\t\t\tproductReference = 40C84997101A36A60083642A /* playground_unittest-static */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t8D07F2BC0486CC7A007CD1D0 /* gtest-framework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"gtest-framework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t8D07F2C10486CC7A007CD1D0 /* Sources */,\n\t\t\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */,\n\t\t\t\t404884A50E2F7C0400CF7658 /* Copy Headers Internal */,\n\t\t\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C44AE60E379922008FCC51 /* PBXTargetDependency */,\n\t\t\t\t408BEC101046CFE900DEF522 /* PBXTargetDependency */,\n\t\t\t\t40C8499C101A36DC0083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"gtest-framework\";\n\t\t\tproductInstallPath = \"$(HOME)/Library/Frameworks\";\n\t\t\tproductName = gtest;\n\t\t\tproductReference = 4539C8FF0EC27F6400A70F4C /* gtest.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t0867D690FE84028FC02AAC07 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 0460;\n\t\t\t};\n\t\t\tbuildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"gtest\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 1;\n\t\t\tknownRegions = (\n\t\t\t\tEnglish,\n\t\t\t\tJapanese,\n\t\t\t\tFrench,\n\t\t\t\tGerman,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 0867D691FE84028FC02AAC07 /* gtest */;\n\t\t\tproductRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t8D07F2BC0486CC7A007CD1D0 /* gtest-framework */,\n\t\t\t\t40C848F9101A209C0083642A /* gtest-static */,\n\t\t\t\t40C8490A101A217E0083642A /* gtest_main-static */,\n\t\t\t\t40899F420FFA7184000B29AE /* gtest_unittest-framework */,\n\t\t\t\t40C8497A101A36850083642A /* gtest_unittest-static */,\n\t\t\t\t4089A0120FFACEFC000B29AE /* sample1_unittest-framework */,\n\t\t\t\t40C84989101A36A60083642A /* sample1_unittest-static */,\n\t\t\t\t3B238F5F0E828B5400846E11 /* Check */,\n\t\t\t\t40C44ADC0E3798F4008FCC51 /* Version Info */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84978101A36540083642A /* libgtest_main.a in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t3B238F5E0E828B5400846E11 /* ShellScript */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"# Remember, this \\\"Run Script\\\" build phase will be executed from $SRCROOT\\n/bin/bash Scripts/runtests.sh\";\n\t\t};\n\t\t40C44ADB0E3798F4008FCC51 /* Generate Version.h */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"$(SRCROOT)/Scripts/versiongenerate.py\",\n\t\t\t\t\"$(SRCROOT)/../configure.ac\",\n\t\t\t);\n\t\t\tname = \"Generate Version.h\";\n\t\t\toutputPaths = (\n\t\t\t\t\"$(PROJECT_TEMP_DIR)/Version.h\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"# Remember, this \\\"Run Script\\\" build phase will be executed from $SRCROOT\\n/usr/bin/python Scripts/versiongenerate.py ../../gtest $PROJECT_TEMP_DIR\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t40899F400FFA7184000B29AE /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4089A0100FFACEFC000B29AE /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C848F7101A209C0083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C848FF101A21150083642A /* gtest-all.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C84908101A217E0083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84915101A21DF0083642A /* gtest_main.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C8497F101A36850083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C8498E101A36A60083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t32D86F03182FFB9B00210C28 /* DummyTest.cpp in Sources */,\n\t\t\t\t32D86F07182FFC5F00210C28 /* CKLBNodeRenderCountTest.cpp in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8D07F2C10486CC7A007CD1D0 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t40899F9D0FFA740F000B29AE /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40899F420FFA7184000B29AE /* gtest_unittest-framework */;\n\t\t\ttargetProxy = 40899F9C0FFA740F000B29AE /* PBXContainerItemProxy */;\n\t\t};\n\t\t4089A0980FFAD34A000B29AE /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 4089A0120FFACEFC000B29AE /* sample1_unittest-framework */;\n\t\t\ttargetProxy = 4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */;\n\t\t};\n\t\t408BEC101046CFE900DEF522 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C848F9101A209C0083642A /* gtest-static */;\n\t\t\ttargetProxy = 408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C44AE60E379922008FCC51 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C44ADC0E3798F4008FCC51 /* Version Info */;\n\t\t\ttargetProxy = 40C44AE50E379922008FCC51 /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8497B101A36850083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C848F9101A209C0083642A /* gtest-static */;\n\t\t\ttargetProxy = 40C8497C101A36850083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8497D101A36850083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8490A101A217E0083642A /* gtest_main-static */;\n\t\t\ttargetProxy = 40C8497E101A36850083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8498A101A36A60083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C848F9101A209C0083642A /* gtest-static */;\n\t\t\ttargetProxy = 40C8498B101A36A60083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8498C101A36A60083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8490A101A217E0083642A /* gtest_main-static */;\n\t\t\ttargetProxy = 40C8498D101A36A60083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8499C101A36DC0083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8490A101A217E0083642A /* gtest_main-static */;\n\t\t\ttargetProxy = 40C8499B101A36DC0083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8499E101A36E50083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */;\n\t\t\ttargetProxy = 40C8499D101A36E50083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C849A0101A36F10083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */;\n\t\t\ttargetProxy = 40C8499F101A36F10083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C849F7101A43440083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8497A101A36850083642A /* gtest_unittest-static */;\n\t\t\ttargetProxy = 40C849F6101A43440083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C849F9101A43490083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C84989101A36A60083642A /* sample1_unittest-static */;\n\t\t\ttargetProxy = 40C849F8101A43490083642A /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3B238F600E828B5400846E11 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = Check;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3B238F610E828B5400846E11 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = Check;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tZERO_LINK = NO;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40899F450FFA7185000B29AE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = \"\\\"$(SRCROOT)/../../gtest\\\"\";\n\t\t\t\tPRODUCT_NAME = \"gtest_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40899F460FFA7185000B29AE /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = \"\\\"$(SRCROOT)/../../gtest\\\"\";\n\t\t\t\tPRODUCT_NAME = \"gtest_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4089A0150FFACEFD000B29AE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = \"sample1_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4089A0160FFACEFD000B29AE /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = \"sample1_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C44ADF0E3798F4008FCC51 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.7;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tTARGET_NAME = gtest;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C44AE00E3798F4008FCC51 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.7;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tTARGET_NAME = gtest;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C848FB101A209D0083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_INLINES_ARE_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest\\\"\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest/include\\\"\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C848FC101A209D0083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_INLINES_ARE_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest\\\"\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest/include\\\"\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C8490E101A217F0083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest\\\"\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest/include\\\"\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest_main;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C8490F101A217F0083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest\\\"\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest/include\\\"\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest_main;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C84985101A36850083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = \"\\\"$(SRCROOT)/../../gtest\\\"\";\n\t\t\t\tPRODUCT_NAME = gtest_unittest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C84986101A36850083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = \"\\\"$(SRCROOT)/../../gtest\\\"\";\n\t\t\t\tPRODUCT_NAME = gtest_unittest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C84995101A36A60083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD)\";\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"\\\\\\\"$(SRCROOT)/../../../Engine/prebuilt/OSX/\",\n\t\t\t\t\t/Users/keinakazawa/Documents/workspace/PlaygroundOSS/Engine/prebuilt/OSX,\n\t\t\t\t);\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;\n\t\t\t\tPRODUCT_NAME = \"playground_unittest-static\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C84996101A36A60083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD)\";\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"\\\\\\\"$(SRCROOT)/../../../Engine/prebuilt/OSX/\",\n\t\t\t\t\t/Users/keinakazawa/Documents/workspace/PlaygroundOSS/Engine/prebuilt/OSX,\n\t\t\t\t);\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;\n\t\t\t\tPRODUCT_NAME = \"playground_unittest-static\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24308B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest\\\"\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest/include\\\"\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Resources/Info.plist;\n\t\t\t\tINFOPLIST_PREFIX_HEADER = \"$(PROJECT_TEMP_DIR)/Version.h\";\n\t\t\t\tINFOPLIST_PREPROCESS = YES;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24408B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest\\\"\",\n\t\t\t\t\t\"\\\"$(SRCROOT)/../../gtest/include\\\"\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Resources/Info.plist;\n\t\t\t\tINFOPLIST_PREFIX_HEADER = \"$(PROJECT_TEMP_DIR)/Version.h\";\n\t\t\t\tINFOPLIST_PREPROCESS = YES;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24708B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF10E30E07400294801 /* DebugProject.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD)\";\n\t\t\t\tGCC_VERSION = \"\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tWARNING_CFLAGS = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24808B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD)\";\n\t\t\t\tGCC_VERSION = \"\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tWARNING_CFLAGS = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3B238FA30E828BB600846E11 /* Build configuration list for PBXAggregateTarget \"Check\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3B238F600E828B5400846E11 /* Debug */,\n\t\t\t\t3B238F610E828B5400846E11 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40899F4A0FFA71BC000B29AE /* Build configuration list for PBXNativeTarget \"gtest_unittest-framework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40899F450FFA7185000B29AE /* Debug */,\n\t\t\t\t40899F460FFA7185000B29AE /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4089A0240FFACF01000B29AE /* Build configuration list for PBXNativeTarget \"sample1_unittest-framework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4089A0150FFACEFD000B29AE /* Debug */,\n\t\t\t\t4089A0160FFACEFD000B29AE /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C44AE40E379905008FCC51 /* Build configuration list for PBXAggregateTarget \"Version Info\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C44ADF0E3798F4008FCC51 /* Debug */,\n\t\t\t\t40C44AE00E3798F4008FCC51 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84902101A212E0083642A /* Build configuration list for PBXNativeTarget \"gtest-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C848FB101A209D0083642A /* Debug */,\n\t\t\t\t40C848FC101A209D0083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84912101A21D20083642A /* Build configuration list for PBXNativeTarget \"gtest_main-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C8490E101A217F0083642A /* Debug */,\n\t\t\t\t40C8490F101A217F0083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84984101A36850083642A /* Build configuration list for PBXNativeTarget \"gtest_unittest-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C84985101A36850083642A /* Debug */,\n\t\t\t\t40C84986101A36850083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84994101A36A60083642A /* Build configuration list for PBXNativeTarget \"sample1_unittest-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C84995101A36A60083642A /* Debug */,\n\t\t\t\t40C84996101A36A60083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"gtest-framework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24308B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24408B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"gtest\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24708B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24808B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 0867D690FE84028FC02AAC07 /* Project object */;\n}\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest-md.sln",
    "content": "Microsoft Visual Studio Solution File, Format Version 8.00\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest-md\", \"gtest-md.vcproj\", \"{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest_main-md\", \"gtest_main-md.vcproj\", \"{3AF54C8A-10BF-4332-9147-F68ED9862033}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest_prod_test-md\", \"gtest_prod_test-md.vcproj\", \"{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest_unittest-md\", \"gtest_unittest-md.vcproj\", \"{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfiguration) = preSolution\r\n\t\tDebug = Debug\r\n\t\tRelease = Release\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfiguration) = postSolution\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.Build.0 = Debug|Win32\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.ActiveCfg = Release|Win32\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.Build.0 = Release|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.Build.0 = Debug|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.ActiveCfg = Release|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.Build.0 = Release|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.Build.0 = Debug|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.ActiveCfg = Release|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.Build.0 = Release|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.Build.0 = Debug|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.ActiveCfg = Release|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.Build.0 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityAddIns) = postSolution\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest-md.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest-md\"\r\n\tProjectGUID=\"{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_LIB\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"3\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtestd.lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"&quot;..\\include&quot;;&quot;..&quot;\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_LIB\"\r\n\t\t\t\tRuntimeLibrary=\"2\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest.lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\src\\gtest-all.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest.sln",
    "content": "Microsoft Visual Studio Solution File, Format Version 8.00\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest\", \"gtest.vcproj\", \"{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest_main\", \"gtest_main.vcproj\", \"{3AF54C8A-10BF-4332-9147-F68ED9862032}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest_unittest\", \"gtest_unittest.vcproj\", \"{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"gtest_prod_test\", \"gtest_prod_test.vcproj\", \"{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfiguration) = preSolution\r\n\t\tDebug = Debug\r\n\t\tRelease = Release\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfiguration) = postSolution\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.Build.0 = Debug|Win32\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.ActiveCfg = Release|Win32\r\n\t\t{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.Build.0 = Release|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.Build.0 = Debug|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.ActiveCfg = Release|Win32\r\n\t\t{3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.Build.0 = Release|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.Build.0 = Debug|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.ActiveCfg = Release|Win32\r\n\t\t{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.Build.0 = Release|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.ActiveCfg = Debug|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.Build.0 = Debug|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.ActiveCfg = Release|Win32\r\n\t\t{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.Build.0 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityAddIns) = postSolution\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest\"\r\n\tProjectGUID=\"{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_LIB\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"5\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtestd.lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"&quot;..\\include&quot;;&quot;..&quot;\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_LIB\"\r\n\t\t\t\tRuntimeLibrary=\"4\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest.lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\src\\gtest-all.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest_main-md.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest_main-md\"\r\n\tProjectGUID=\"{3AF54C8A-10BF-4332-9147-F68ED9862033}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_LIB\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"3\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/$(ProjectName)d.lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"&quot;..\\include&quot;;&quot;..&quot;\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_LIB\"\r\n\t\t\t\tRuntimeLibrary=\"2\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/$(ProjectName).lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t\t<ProjectReference\r\n\t\t\tReferencedProjectIdentifier=\"{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}\"\r\n\t\t\tName=\"gtest-md\"/>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\src\\gtest_main.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest_main.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest_main\"\r\n\tProjectGUID=\"{3AF54C8A-10BF-4332-9147-F68ED9862032}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_LIB\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"5\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/$(ProjectName)d.lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"4\"\r\n\t\t\tCharacterSet=\"2\"\r\n\t\t\tReferencesPath=\"&quot;..\\include&quot;;&quot;..&quot;\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_LIB\"\r\n\t\t\t\tRuntimeLibrary=\"4\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLibrarianTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/$(ProjectName).lib\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t\t<ProjectReference\r\n\t\t\tReferencedProjectIdentifier=\"{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}\"\r\n\t\t\tName=\"gtest\"/>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\src\\gtest_main.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest_prod_test-md.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest_prod_test-md\"\r\n\tProjectGUID=\"{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"3\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_prod_test.exe\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tProgramDatabaseFile=\"$(OutDir)/gtest_prod_test.pdb\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE\"\r\n\t\t\t\tRuntimeLibrary=\"2\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_prod_test.exe\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t\t<ProjectReference\r\n\t\t\tReferencedProjectIdentifier=\"{3AF54C8A-10BF-4332-9147-F68ED9862033}\"\r\n\t\t\tName=\"gtest_main-md\"/>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\gtest_prod_test.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\production.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\production.h\">\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest_prod_test.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest_prod_test\"\r\n\tProjectGUID=\"{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"5\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_prod_test.exe\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tProgramDatabaseFile=\"$(OutDir)/gtest_prod_test.pdb\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE\"\r\n\t\t\t\tRuntimeLibrary=\"4\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_prod_test.exe\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t\t<ProjectReference\r\n\t\t\tReferencedProjectIdentifier=\"{3AF54C8A-10BF-4332-9147-F68ED9862032}\"\r\n\t\t\tName=\"gtest_main\"/>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\gtest_prod_test.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\production.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\production.h\">\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest_unittest-md.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest_unittest-md\"\r\n\tProjectGUID=\"{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"3\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_unittest.exe\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tProgramDatabaseFile=\"$(OutDir)/gtest_unittest.pdb\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE\"\r\n\t\t\t\tRuntimeLibrary=\"2\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_unittest.exe\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t\t<ProjectReference\r\n\t\t\tReferencedProjectIdentifier=\"{3AF54C8A-10BF-4332-9147-F68ED9862033}\"\r\n\t\t\tName=\"gtest_main-md\"/>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\gtest_unittest.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tOptimization=\"1\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tBasicRuntimeChecks=\"0\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/Win32/msvc/gtest_unittest.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"gtest_unittest\"\r\n\tProjectGUID=\"{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"5\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_unittest.exe\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tProgramDatabaseFile=\"$(OutDir)/gtest_unittest.pdb\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionName)/$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(OutDir)/$(ProjectName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE\"\r\n\t\t\t\tRuntimeLibrary=\"4\"\r\n\t\t\t\tUsePrecompiledHeader=\"3\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"FALSE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)/gtest_unittest.exe\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t\t<ProjectReference\r\n\t\t\tReferencedProjectIdentifier=\"{3AF54C8A-10BF-4332-9147-F68ED9862032}\"\r\n\t\t\tName=\"gtest_main\"/>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\test\\gtest_unittest.cc\">\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Debug|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tOptimization=\"1\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tBasicRuntimeChecks=\"0\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t\t<FileConfiguration\r\n\t\t\t\t\tName=\"Release|Win32\">\r\n\t\t\t\t\t<Tool\r\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"&quot;..&quot;;&quot;..\\include&quot;\"\r\n\t\t\t\t\t\tUsePrecompiledHeader=\"0\"/>\r\n\t\t\t\t</FileConfiguration>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Tests/gtest/CHANGES",
    "content": "Changes for 1.7.0:\n\n* New feature: death tests are supported on OpenBSD and in iOS\n  simulator now.\n* New feature: Google Test now implements a protocol to allow\n  a test runner to detect that a test program has exited\n  prematurely and report it as a failure (before it would be\n  falsely reported as a success if the exit code is 0).\n* New feature: Test::RecordProperty() can now be used outside of the\n  lifespan of a test method, in which case it will be attributed to\n  the current test case or the test program in the XML report.\n* New feature (potentially breaking): --gtest_list_tests now prints\n  the type parameters and value parameters for each test.\n* Improvement: char pointers and char arrays are now escaped properly\n  in failure messages.\n* Improvement: failure summary in XML reports now includes file and\n  line information.\n* Improvement: the <testsuites> XML element now has a timestamp attribute.\n* Improvement: When --gtest_filter is specified, XML report now doesn't\n  contain information about tests that are filtered out.\n* Fixed the bug where long --gtest_filter flag values are truncated in\n  death tests.\n* Potentially breaking change: RUN_ALL_TESTS() is now implemented as a\n  function instead of a macro in order to work better with Clang.\n* Compatibility fixes with C++ 11 and various platforms.\n* Bug/warning fixes.\n\nChanges for 1.6.0:\n\n* New feature: ADD_FAILURE_AT() for reporting a test failure at the\n  given source location -- useful for writing testing utilities.\n* New feature: the universal value printer is moved from Google Mock\n  to Google Test.\n* New feature: type parameters and value parameters are reported in\n  the XML report now.\n* A gtest_disable_pthreads CMake option.\n* Colored output works in GNU Screen sessions now.\n* Parameters of value-parameterized tests are now printed in the\n  textual output.\n* Failures from ad hoc test assertions run before RUN_ALL_TESTS() are\n  now correctly reported.\n* Arguments of ASSERT_XY and EXPECT_XY no longer need to support << to\n  ostream.\n* More complete handling of exceptions.\n* GTEST_ASSERT_XY can be used instead of ASSERT_XY in case the latter\n  name is already used by another library.\n* --gtest_catch_exceptions is now true by default, allowing a test\n  program to continue after an exception is thrown.\n* Value-parameterized test fixtures can now derive from Test and\n  WithParamInterface<T> separately, easing conversion of legacy tests.\n* Death test messages are clearly marked to make them more\n  distinguishable from other messages.\n* Compatibility fixes for Android, Google Native Client, MinGW, HP UX,\n  PowerPC, Lucid autotools, libCStd, Sun C++, Borland C++ Builder (Code Gear),\n  IBM XL C++ (Visual Age C++), and C++0x.\n* Bug fixes and implementation clean-ups.\n* Potentially incompatible changes: disables the harmful 'make install'\n  command in autotools.\n\nChanges for 1.5.0:\n\n * New feature: assertions can be safely called in multiple threads\n   where the pthreads library is available.\n * New feature: predicates used inside EXPECT_TRUE() and friends\n   can now generate custom failure messages.\n * New feature: Google Test can now be compiled as a DLL.\n * New feature: fused source files are included.\n * New feature: prints help when encountering unrecognized Google Test flags.\n * Experimental feature: CMake build script (requires CMake 2.6.4+).\n * Experimental feature: the Pump script for meta programming.\n * double values streamed to an assertion are printed with enough precision\n   to differentiate any two different values.\n * Google Test now works on Solaris and AIX.\n * Build and test script improvements.\n * Bug fixes and implementation clean-ups.\n\n Potentially breaking changes:\n\n * Stopped supporting VC++ 7.1 with exceptions disabled.\n * Dropped support for 'make install'.\n\nChanges for 1.4.0:\n\n * New feature: the event listener API\n * New feature: test shuffling\n * New feature: the XML report format is closer to junitreport and can\n   be parsed by Hudson now.\n * New feature: when a test runs under Visual Studio, its failures are\n   integrated in the IDE.\n * New feature: /MD(d) versions of VC++ projects.\n * New feature: elapsed time for the tests is printed by default.\n * New feature: comes with a TR1 tuple implementation such that Boost\n   is no longer needed for Combine().\n * New feature: EXPECT_DEATH_IF_SUPPORTED macro and friends.\n * New feature: the Xcode project can now produce static gtest\n   libraries in addition to a framework.\n * Compatibility fixes for Solaris, Cygwin, minGW, Windows Mobile,\n   Symbian, gcc, and C++Builder.\n * Bug fixes and implementation clean-ups.\n\nChanges for 1.3.0:\n\n * New feature: death tests on Windows, Cygwin, and Mac.\n * New feature: ability to use Google Test assertions in other testing\n   frameworks.\n * New feature: ability to run disabled test via\n   --gtest_also_run_disabled_tests.\n * New feature: the --help flag for printing the usage.\n * New feature: access to Google Test flag values in user code.\n * New feature: a script that packs Google Test into one .h and one\n   .cc file for easy deployment.\n * New feature: support for distributing test functions to multiple\n   machines (requires support from the test runner).\n * Bug fixes and implementation clean-ups.\n\nChanges for 1.2.1:\n\n * Compatibility fixes for Linux IA-64 and IBM z/OS.\n * Added support for using Boost and other TR1 implementations.\n * Changes to the build scripts to support upcoming release of Google C++\n   Mocking Framework.\n * Added Makefile to the distribution package.\n * Improved build instructions in README.\n\nChanges for 1.2.0:\n\n * New feature: value-parameterized tests.\n * New feature: the ASSERT/EXPECT_(NON)FATAL_FAILURE(_ON_ALL_THREADS)\n   macros.\n * Changed the XML report format to match JUnit/Ant's.\n * Added tests to the Xcode project.\n * Added scons/SConscript for building with SCons.\n * Added src/gtest-all.cc for building Google Test from a single file.\n * Fixed compatibility with Solaris and z/OS.\n * Enabled running Python tests on systems with python 2.3 installed,\n   e.g. Mac OS X 10.4.\n * Bug fixes.\n\nChanges for 1.1.0:\n\n * New feature: type-parameterized tests.\n * New feature: exception assertions.\n * New feature: printing elapsed time of tests.\n * Improved the robustness of death tests.\n * Added an Xcode project and samples.\n * Adjusted the output format on Windows to be understandable by Visual Studio.\n * Minor bug fixes.\n\nChanges for 1.0.1:\n\n * Added project files for Visual Studio 7.1.\n * Fixed issues with compiling on Mac OS X.\n * Fixed issues with compiling on Cygwin.\n\nChanges for 1.0.0:\n\n * Initial Open Source release of Google Test\n"
  },
  {
    "path": "Tests/gtest/CMakeLists.txt",
    "content": "########################################################################\n# CMake build script for Google Test.\n#\n# To run the tests for Google Test itself on Linux, use 'make test' or\n# ctest.  You can select which tests to run using 'ctest -R regex'.\n# For more options, run 'ctest --help'.\n\n# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to\n# make it prominent in the GUI.\noption(BUILD_SHARED_LIBS \"Build shared libraries (DLLs).\" OFF)\n\n# When other libraries are using a shared version of runtime libraries,\n# Google Test also has to use one.\noption(\n  gtest_force_shared_crt\n  \"Use shared (DLL) run-time lib even when Google Test is built as static lib.\"\n  OFF)\n\noption(gtest_build_tests \"Build all of gtest's own tests.\" OFF)\n\noption(gtest_build_samples \"Build gtest's sample programs.\" OFF)\n\noption(gtest_disable_pthreads \"Disable uses of pthreads in gtest.\" OFF)\n\n# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().\ninclude(cmake/hermetic_build.cmake OPTIONAL)\n\nif (COMMAND pre_project_set_up_hermetic_build)\n  pre_project_set_up_hermetic_build()\nendif()\n\n########################################################################\n#\n# Project-wide settings\n\n# Name of the project.\n#\n# CMake files in this project can refer to the root source directory\n# as ${gtest_SOURCE_DIR} and to the root binary directory as\n# ${gtest_BINARY_DIR}.\n# Language \"C\" is required for find_package(Threads).\nproject(gtest CXX C)\ncmake_minimum_required(VERSION 2.6.2)\n\nif (COMMAND set_up_hermetic_build)\n  set_up_hermetic_build()\nendif()\n\n# Define helper functions and macros used by Google Test.\ninclude(cmake/internal_utils.cmake)\n\nconfig_compiler_and_linker()  # Defined in internal_utils.cmake.\n\n# Where Google Test's .h files can be found.\ninclude_directories(\n  ${gtest_SOURCE_DIR}/include\n  ${gtest_SOURCE_DIR})\n\n# Where Google Test's libraries can be found.\nlink_directories(${gtest_BINARY_DIR}/src)\n\n########################################################################\n#\n# Defines the gtest & gtest_main libraries.  User tests should link\n# with one of them.\n\n# Google Test libraries.  We build them using more strict warnings than what\n# are used for other targets, to ensure that gtest can be compiled by a user\n# aggressive about warnings.\ncxx_library(gtest \"${cxx_strict}\" src/gtest-all.cc)\ncxx_library(gtest_main \"${cxx_strict}\" src/gtest_main.cc)\ntarget_link_libraries(gtest_main gtest)\n\n########################################################################\n#\n# Samples on how to link user tests with gtest or gtest_main.\n#\n# They are not built by default.  To build them, set the\n# gtest_build_samples option to ON.  You can do it by running ccmake\n# or specifying the -Dgtest_build_samples=ON flag when running cmake.\n\nif (gtest_build_samples)\n  cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc)\n  cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc)\n  cxx_executable(sample3_unittest samples gtest_main)\n  cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc)\n  cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc)\n  cxx_executable(sample6_unittest samples gtest_main)\n  cxx_executable(sample7_unittest samples gtest_main)\n  cxx_executable(sample8_unittest samples gtest_main)\n  cxx_executable(sample9_unittest samples gtest)\n  cxx_executable(sample10_unittest samples gtest)\nendif()\n\n########################################################################\n#\n# Google Test's own tests.\n#\n# You can skip this section if you aren't interested in testing\n# Google Test itself.\n#\n# The tests are not built by default.  To build them, set the\n# gtest_build_tests option to ON.  You can do it by running ccmake\n# or specifying the -Dgtest_build_tests=ON flag when running cmake.\n\nif (gtest_build_tests)\n  # This must be set in the root directory for the tests to be run by\n  # 'make test' or ctest.\n  enable_testing()\n\n  ############################################################\n  # C++ tests built with standard compiler flags.\n\n  cxx_test(gtest-death-test_test gtest_main)\n  cxx_test(gtest_environment_test gtest)\n  cxx_test(gtest-filepath_test gtest_main)\n  cxx_test(gtest-linked_ptr_test gtest_main)\n  cxx_test(gtest-listener_test gtest_main)\n  cxx_test(gtest_main_unittest gtest_main)\n  cxx_test(gtest-message_test gtest_main)\n  cxx_test(gtest_no_test_unittest gtest)\n  cxx_test(gtest-options_test gtest_main)\n  cxx_test(gtest-param-test_test gtest\n    test/gtest-param-test2_test.cc)\n  cxx_test(gtest-port_test gtest_main)\n  cxx_test(gtest_pred_impl_unittest gtest_main)\n  cxx_test(gtest_premature_exit_test gtest\n    test/gtest_premature_exit_test.cc)\n  cxx_test(gtest-printers_test gtest_main)\n  cxx_test(gtest_prod_test gtest_main\n    test/production.cc)\n  cxx_test(gtest_repeat_test gtest)\n  cxx_test(gtest_sole_header_test gtest_main)\n  cxx_test(gtest_stress_test gtest)\n  cxx_test(gtest-test-part_test gtest_main)\n  cxx_test(gtest_throw_on_failure_ex_test gtest)\n  cxx_test(gtest-typed-test_test gtest_main\n    test/gtest-typed-test2_test.cc)\n  cxx_test(gtest_unittest gtest_main)\n  cxx_test(gtest-unittest-api_test gtest)\n\n  ############################################################\n  # C++ tests built with non-standard compiler flags.\n\n  # MSVC 7.1 does not support STL with exceptions disabled.\n  if (NOT MSVC OR MSVC_VERSION GREATER 1310)\n    cxx_library(gtest_no_exception \"${cxx_no_exception}\"\n      src/gtest-all.cc)\n    cxx_library(gtest_main_no_exception \"${cxx_no_exception}\"\n      src/gtest-all.cc src/gtest_main.cc)\n  endif()\n  cxx_library(gtest_main_no_rtti \"${cxx_no_rtti}\"\n    src/gtest-all.cc src/gtest_main.cc)\n\n  cxx_test_with_flags(gtest-death-test_ex_nocatch_test\n    \"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0\"\n    gtest test/gtest-death-test_ex_test.cc)\n  cxx_test_with_flags(gtest-death-test_ex_catch_test\n    \"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1\"\n    gtest test/gtest-death-test_ex_test.cc)\n\n  cxx_test_with_flags(gtest_no_rtti_unittest \"${cxx_no_rtti}\"\n    gtest_main_no_rtti test/gtest_unittest.cc)\n\n  cxx_shared_library(gtest_dll \"${cxx_default}\"\n    src/gtest-all.cc src/gtest_main.cc)\n\n  cxx_executable_with_flags(gtest_dll_test_ \"${cxx_default}\"\n    gtest_dll test/gtest_all_test.cc)\n  set_target_properties(gtest_dll_test_\n                        PROPERTIES\n                        COMPILE_DEFINITIONS \"GTEST_LINKED_AS_SHARED_LIBRARY=1\")\n\n  if (NOT MSVC OR NOT MSVC_VERSION EQUAL 1600)\n    # The C++ Standard specifies tuple_element<int, class>.\n    # Yet MSVC 10's <utility> declares tuple_element<size_t, class>.\n    # That declaration conflicts with our own standard-conforming\n    # tuple implementation.  Therefore using our own tuple with\n    # MSVC 10 doesn't compile.\n    cxx_library(gtest_main_use_own_tuple \"${cxx_use_own_tuple}\"\n      src/gtest-all.cc src/gtest_main.cc)\n\n    cxx_test_with_flags(gtest-tuple_test \"${cxx_use_own_tuple}\"\n      gtest_main_use_own_tuple test/gtest-tuple_test.cc)\n\n    cxx_test_with_flags(gtest_use_own_tuple_test \"${cxx_use_own_tuple}\"\n      gtest_main_use_own_tuple\n      test/gtest-param-test_test.cc test/gtest-param-test2_test.cc)\n  endif()\n\n  ############################################################\n  # Python tests.\n\n  cxx_executable(gtest_break_on_failure_unittest_ test gtest)\n  py_test(gtest_break_on_failure_unittest)\n\n  # MSVC 7.1 does not support STL with exceptions disabled.\n  if (NOT MSVC OR MSVC_VERSION GREATER 1310)\n    cxx_executable_with_flags(\n      gtest_catch_exceptions_no_ex_test_\n      \"${cxx_no_exception}\"\n      gtest_main_no_exception\n      test/gtest_catch_exceptions_test_.cc)\n  endif()\n\n  cxx_executable_with_flags(\n    gtest_catch_exceptions_ex_test_\n    \"${cxx_exception}\"\n    gtest_main\n    test/gtest_catch_exceptions_test_.cc)\n  py_test(gtest_catch_exceptions_test)\n\n  cxx_executable(gtest_color_test_ test gtest)\n  py_test(gtest_color_test)\n\n  cxx_executable(gtest_env_var_test_ test gtest)\n  py_test(gtest_env_var_test)\n\n  cxx_executable(gtest_filter_unittest_ test gtest)\n  py_test(gtest_filter_unittest)\n\n  cxx_executable(gtest_help_test_ test gtest_main)\n  py_test(gtest_help_test)\n\n  cxx_executable(gtest_list_tests_unittest_ test gtest)\n  py_test(gtest_list_tests_unittest)\n\n  cxx_executable(gtest_output_test_ test gtest)\n  py_test(gtest_output_test)\n\n  cxx_executable(gtest_shuffle_test_ test gtest)\n  py_test(gtest_shuffle_test)\n\n  # MSVC 7.1 does not support STL with exceptions disabled.\n  if (NOT MSVC OR MSVC_VERSION GREATER 1310)\n    cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception)\n    set_target_properties(gtest_throw_on_failure_test_\n      PROPERTIES\n      COMPILE_FLAGS \"${cxx_no_exception}\")\n    py_test(gtest_throw_on_failure_test)\n  endif()\n\n  cxx_executable(gtest_uninitialized_test_ test gtest)\n  py_test(gtest_uninitialized_test)\n\n  cxx_executable(gtest_xml_outfile1_test_ test gtest_main)\n  cxx_executable(gtest_xml_outfile2_test_ test gtest_main)\n  py_test(gtest_xml_outfiles_test)\n\n  cxx_executable(gtest_xml_output_unittest_ test gtest)\n  py_test(gtest_xml_output_unittest)\nendif()\n"
  },
  {
    "path": "Tests/gtest/CONTRIBUTORS",
    "content": "# This file contains a list of people who've made non-trivial\n# contribution to the Google C++ Testing Framework project.  People\n# who commit code to the project are encouraged to add their names\n# here.  Please keep the list sorted by first names.\n\nAjay Joshi <jaj@google.com>\nBalázs Dán <balazs.dan@gmail.com>\nBharat Mediratta <bharat@menalto.com>\nChandler Carruth <chandlerc@google.com>\nChris Prince <cprince@google.com>\nChris Taylor <taylorc@google.com>\nDan Egnor <egnor@google.com>\nEric Roman <eroman@chromium.org>\nHady Zalek <hady.zalek@gmail.com>\nJeffrey Yasskin <jyasskin@google.com>\nJói Sigurðsson <joi@google.com>\nKeir Mierle <mierle@gmail.com>\nKeith Ray <keith.ray@gmail.com>\nKenton Varda <kenton@google.com>\nManuel Klimek <klimek@google.com>\nMarkus Heule <markus.heule@gmail.com>\nMika Raento <mikie@iki.fi>\nMiklós Fazekas <mfazekas@szemafor.com>\nPasi Valminen <pasi.valminen@gmail.com>\nPatrick Hanna <phanna@google.com>\nPatrick Riley <pfr@google.com>\nPeter Kaminski <piotrk@google.com>\nPreston Jackson <preston.a.jackson@gmail.com>\nRainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com>\nRuss Cox <rsc@google.com>\nRuss Rufer <russ@pentad.com>\nSean Mcafee <eefacm@gmail.com>\nSigurður Ásgeirsson <siggi@google.com>\nTracy Bialik <tracy@pentad.com>\nVadim Berman <vadimb@google.com>\nVlad Losev <vladl@google.com>\nZhanyong Wan <wan@google.com>\n"
  },
  {
    "path": "Tests/gtest/LICENSE",
    "content": "Copyright 2008, Google Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n    * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "Tests/gtest/Makefile.am",
    "content": "# Automake file\n\nACLOCAL_AMFLAGS = -I m4\n\n# Nonstandard package files for distribution\nEXTRA_DIST = \\\n  CHANGES \\\n  CONTRIBUTORS \\\n  LICENSE \\\n  include/gtest/gtest-param-test.h.pump \\\n  include/gtest/internal/gtest-param-util-generated.h.pump \\\n  include/gtest/internal/gtest-tuple.h.pump \\\n  include/gtest/internal/gtest-type-util.h.pump \\\n  make/Makefile \\\n  scripts/fuse_gtest_files.py \\\n  scripts/gen_gtest_pred_impl.py \\\n  scripts/pump.py \\\n  scripts/test/Makefile\n\n# gtest source files that we don't compile directly.  They are\n# #included by gtest-all.cc.\nGTEST_SRC = \\\n  src/gtest-death-test.cc \\\n  src/gtest-filepath.cc \\\n  src/gtest-internal-inl.h \\\n  src/gtest-port.cc \\\n  src/gtest-printers.cc \\\n  src/gtest-test-part.cc \\\n  src/gtest-typed-test.cc \\\n  src/gtest.cc\n\nEXTRA_DIST += $(GTEST_SRC)\n\n# Sample files that we don't compile.\nEXTRA_DIST += \\\n  samples/prime_tables.h \\\n  samples/sample2_unittest.cc \\\n  samples/sample3_unittest.cc \\\n  samples/sample4_unittest.cc \\\n  samples/sample5_unittest.cc \\\n  samples/sample6_unittest.cc \\\n  samples/sample7_unittest.cc \\\n  samples/sample8_unittest.cc \\\n  samples/sample9_unittest.cc\n\n# C++ test files that we don't compile directly.\nEXTRA_DIST += \\\n  test/gtest-death-test_ex_test.cc \\\n  test/gtest-death-test_test.cc \\\n  test/gtest-filepath_test.cc \\\n  test/gtest-linked_ptr_test.cc \\\n  test/gtest-listener_test.cc \\\n  test/gtest-message_test.cc \\\n  test/gtest-options_test.cc \\\n  test/gtest-param-test2_test.cc \\\n  test/gtest-param-test2_test.cc \\\n  test/gtest-param-test_test.cc \\\n  test/gtest-param-test_test.cc \\\n  test/gtest-param-test_test.h \\\n  test/gtest-port_test.cc \\\n  test/gtest_premature_exit_test.cc \\\n  test/gtest-printers_test.cc \\\n  test/gtest-test-part_test.cc \\\n  test/gtest-tuple_test.cc \\\n  test/gtest-typed-test2_test.cc \\\n  test/gtest-typed-test_test.cc \\\n  test/gtest-typed-test_test.h \\\n  test/gtest-unittest-api_test.cc \\\n  test/gtest_break_on_failure_unittest_.cc \\\n  test/gtest_catch_exceptions_test_.cc \\\n  test/gtest_color_test_.cc \\\n  test/gtest_env_var_test_.cc \\\n  test/gtest_environment_test.cc \\\n  test/gtest_filter_unittest_.cc \\\n  test/gtest_help_test_.cc \\\n  test/gtest_list_tests_unittest_.cc \\\n  test/gtest_main_unittest.cc \\\n  test/gtest_no_test_unittest.cc \\\n  test/gtest_output_test_.cc \\\n  test/gtest_pred_impl_unittest.cc \\\n  test/gtest_prod_test.cc \\\n  test/gtest_repeat_test.cc \\\n  test/gtest_shuffle_test_.cc \\\n  test/gtest_sole_header_test.cc \\\n  test/gtest_stress_test.cc \\\n  test/gtest_throw_on_failure_ex_test.cc \\\n  test/gtest_throw_on_failure_test_.cc \\\n  test/gtest_uninitialized_test_.cc \\\n  test/gtest_unittest.cc \\\n  test/gtest_unittest.cc \\\n  test/gtest_xml_outfile1_test_.cc \\\n  test/gtest_xml_outfile2_test_.cc \\\n  test/gtest_xml_output_unittest_.cc \\\n  test/production.cc \\\n  test/production.h\n\n# Python tests that we don't run.\nEXTRA_DIST += \\\n  test/gtest_break_on_failure_unittest.py \\\n  test/gtest_catch_exceptions_test.py \\\n  test/gtest_color_test.py \\\n  test/gtest_env_var_test.py \\\n  test/gtest_filter_unittest.py \\\n  test/gtest_help_test.py \\\n  test/gtest_list_tests_unittest.py \\\n  test/gtest_output_test.py \\\n  test/gtest_output_test_golden_lin.txt \\\n  test/gtest_shuffle_test.py \\\n  test/gtest_test_utils.py \\\n  test/gtest_throw_on_failure_test.py \\\n  test/gtest_uninitialized_test.py \\\n  test/gtest_xml_outfiles_test.py \\\n  test/gtest_xml_output_unittest.py \\\n  test/gtest_xml_test_utils.py\n\n# CMake script\nEXTRA_DIST += \\\n  CMakeLists.txt \\\n  cmake/internal_utils.cmake\n\n# MSVC project files\nEXTRA_DIST += \\\n  msvc/gtest-md.sln \\\n  msvc/gtest-md.vcproj \\\n  msvc/gtest.sln \\\n  msvc/gtest.vcproj \\\n  msvc/gtest_main-md.vcproj \\\n  msvc/gtest_main.vcproj \\\n  msvc/gtest_prod_test-md.vcproj \\\n  msvc/gtest_prod_test.vcproj \\\n  msvc/gtest_unittest-md.vcproj \\\n  msvc/gtest_unittest.vcproj\n\n# xcode project files\nEXTRA_DIST += \\\n  xcode/Config/DebugProject.xcconfig \\\n  xcode/Config/FrameworkTarget.xcconfig \\\n  xcode/Config/General.xcconfig \\\n  xcode/Config/ReleaseProject.xcconfig \\\n  xcode/Config/StaticLibraryTarget.xcconfig \\\n  xcode/Config/TestTarget.xcconfig \\\n  xcode/Resources/Info.plist \\\n  xcode/Scripts/runtests.sh \\\n  xcode/Scripts/versiongenerate.py \\\n  xcode/gtest.xcodeproj/project.pbxproj\n\n# xcode sample files\nEXTRA_DIST += \\\n  xcode/Samples/FrameworkSample/Info.plist \\\n  xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj \\\n  xcode/Samples/FrameworkSample/runtests.sh \\\n  xcode/Samples/FrameworkSample/widget.cc \\\n  xcode/Samples/FrameworkSample/widget.h \\\n  xcode/Samples/FrameworkSample/widget_test.cc\n\n# C++Builder project files\nEXTRA_DIST += \\\n  codegear/gtest.cbproj \\\n  codegear/gtest.groupproj \\\n  codegear/gtest_all.cc \\\n  codegear/gtest_link.cc \\\n  codegear/gtest_main.cbproj \\\n  codegear/gtest_unittest.cbproj\n\n# Distribute and install M4 macro\nm4datadir = $(datadir)/aclocal\nm4data_DATA = m4/gtest.m4\nEXTRA_DIST += $(m4data_DATA)\n\n# We define the global AM_CPPFLAGS as everything we compile includes from these\n# directories.\nAM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include\n\n# Modifies compiler and linker flags for pthreads compatibility.\nif HAVE_PTHREADS\n  AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1\n  AM_LIBS = @PTHREAD_LIBS@\nelse\n  AM_CXXFLAGS = -DGTEST_HAS_PTHREAD=0\nendif\n\n# Build rules for libraries.\nlib_LTLIBRARIES = lib/libgtest.la lib/libgtest_main.la\n\nlib_libgtest_la_SOURCES = src/gtest-all.cc\n\npkginclude_HEADERS = \\\n  include/gtest/gtest-death-test.h \\\n  include/gtest/gtest-message.h \\\n  include/gtest/gtest-param-test.h \\\n  include/gtest/gtest-printers.h \\\n  include/gtest/gtest-spi.h \\\n  include/gtest/gtest-test-part.h \\\n  include/gtest/gtest-typed-test.h \\\n  include/gtest/gtest.h \\\n  include/gtest/gtest_pred_impl.h \\\n  include/gtest/gtest_prod.h\n\npkginclude_internaldir = $(pkgincludedir)/internal\npkginclude_internal_HEADERS = \\\n  include/gtest/internal/gtest-death-test-internal.h \\\n  include/gtest/internal/gtest-filepath.h \\\n  include/gtest/internal/gtest-internal.h \\\n  include/gtest/internal/gtest-linked_ptr.h \\\n  include/gtest/internal/gtest-param-util-generated.h \\\n  include/gtest/internal/gtest-param-util.h \\\n  include/gtest/internal/gtest-port.h \\\n  include/gtest/internal/gtest-string.h \\\n  include/gtest/internal/gtest-tuple.h \\\n  include/gtest/internal/gtest-type-util.h\n\nlib_libgtest_main_la_SOURCES = src/gtest_main.cc\nlib_libgtest_main_la_LIBADD = lib/libgtest.la\n\n# Bulid rules for samples and tests. Automake's naming for some of\n# these variables isn't terribly obvious, so this is a brief\n# reference:\n#\n# TESTS -- Programs run automatically by \"make check\"\n# check_PROGRAMS -- Programs built by \"make check\" but not necessarily run\n\nnoinst_LTLIBRARIES = samples/libsamples.la\n\nsamples_libsamples_la_SOURCES = \\\n  samples/sample1.cc \\\n  samples/sample1.h \\\n  samples/sample2.cc \\\n  samples/sample2.h \\\n  samples/sample3-inl.h \\\n  samples/sample4.cc \\\n  samples/sample4.h\n\nTESTS=\nTESTS_ENVIRONMENT = GTEST_SOURCE_DIR=\"$(srcdir)/test\" \\\n                    GTEST_BUILD_DIR=\"$(top_builddir)/test\"\ncheck_PROGRAMS=\n\n# A simple sample on using gtest.\nTESTS += samples/sample1_unittest\ncheck_PROGRAMS += samples/sample1_unittest\nsamples_sample1_unittest_SOURCES = samples/sample1_unittest.cc\nsamples_sample1_unittest_LDADD = lib/libgtest_main.la \\\n                                 lib/libgtest.la \\\n                                 samples/libsamples.la\n\n# Another sample.  It also verifies that libgtest works.\nTESTS += samples/sample10_unittest\ncheck_PROGRAMS += samples/sample10_unittest\nsamples_sample10_unittest_SOURCES = samples/sample10_unittest.cc\nsamples_sample10_unittest_LDADD = lib/libgtest.la\n\n# This tests most constructs of gtest and verifies that libgtest_main\n# and libgtest work.\nTESTS += test/gtest_all_test\ncheck_PROGRAMS += test/gtest_all_test\ntest_gtest_all_test_SOURCES = test/gtest_all_test.cc\ntest_gtest_all_test_LDADD = lib/libgtest_main.la \\\n                            lib/libgtest.la\n\n# Tests that fused gtest files compile and work.\nFUSED_GTEST_SRC = \\\n  fused-src/gtest/gtest-all.cc \\\n  fused-src/gtest/gtest.h \\\n  fused-src/gtest/gtest_main.cc\n\nif HAVE_PYTHON\nTESTS += test/fused_gtest_test\ncheck_PROGRAMS += test/fused_gtest_test\ntest_fused_gtest_test_SOURCES = $(FUSED_GTEST_SRC) \\\n                                samples/sample1.cc samples/sample1_unittest.cc\ntest_fused_gtest_test_CPPFLAGS = -I\"$(srcdir)/fused-src\"\n\n# Build rules for putting fused Google Test files into the distribution\n# package. The user can also create those files by manually running\n# scripts/fuse_gtest_files.py.\n$(test_fused_gtest_test_SOURCES): fused-gtest\n\nfused-gtest: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \\\n             $(GTEST_SRC) src/gtest-all.cc src/gtest_main.cc \\\n             scripts/fuse_gtest_files.py\n\tmkdir -p \"$(srcdir)/fused-src\"\n\tchmod -R u+w \"$(srcdir)/fused-src\"\n\trm -f \"$(srcdir)/fused-src/gtest/gtest-all.cc\"\n\trm -f \"$(srcdir)/fused-src/gtest/gtest.h\"\n\t\"$(srcdir)/scripts/fuse_gtest_files.py\" \"$(srcdir)/fused-src\"\n\tcp -f \"$(srcdir)/src/gtest_main.cc\" \"$(srcdir)/fused-src/gtest/\"\n\nmaintainer-clean-local:\n\trm -rf \"$(srcdir)/fused-src\"\nendif\n\n# Death tests may produce core dumps in the build directory. In case\n# this happens, clean them to keep distcleancheck happy.\nCLEANFILES = core\n\n# Disables 'make install' as installing a compiled version of Google\n# Test can lead to undefined behavior due to violation of the\n# One-Definition Rule.\n\ninstall-exec-local:\n\techo \"'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system.\"\n\tfalse\n\ninstall-data-local:\n\techo \"'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system.\"\n\tfalse\n"
  },
  {
    "path": "Tests/gtest/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11.3 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software\n# Foundation, Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Automake file\n\n\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\nTESTS = samples/sample1_unittest$(EXEEXT) \\\n\tsamples/sample10_unittest$(EXEEXT) \\\n\ttest/gtest_all_test$(EXEEXT) $(am__EXEEXT_1)\ncheck_PROGRAMS = samples/sample1_unittest$(EXEEXT) \\\n\tsamples/sample10_unittest$(EXEEXT) \\\n\ttest/gtest_all_test$(EXEEXT) $(am__EXEEXT_1)\n@HAVE_PYTHON_TRUE@am__append_1 = test/fused_gtest_test\n@HAVE_PYTHON_TRUE@am__append_2 = test/fused_gtest_test\nsubdir = .\nDIST_COMMON = README $(am__configure_deps) $(pkginclude_HEADERS) \\\n\t$(pkginclude_internal_HEADERS) $(srcdir)/Makefile.am \\\n\t$(srcdir)/Makefile.in $(top_srcdir)/build-aux/config.h.in \\\n\t$(top_srcdir)/configure $(top_srcdir)/scripts/gtest-config.in \\\n\tbuild-aux/config.guess build-aux/config.sub build-aux/depcomp \\\n\tbuild-aux/install-sh build-aux/ltmain.sh build-aux/missing\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \\\n\t$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \\\n\t$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \\\n\t$(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nam__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \\\n configure.lineno config.status.lineno\nmkinstalldirs = $(install_sh) -d\nCONFIG_HEADER = $(top_builddir)/build-aux/config.h\nCONFIG_CLEAN_FILES = scripts/gtest-config\nCONFIG_CLEAN_VPATH_FILES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__uninstall_files_from_dir = { \\\n  test -z \"$$files\" \\\n    || { test ! -d \"$$dir\" && test ! -f \"$$dir\" && test ! -r \"$$dir\"; } \\\n    || { echo \" ( cd '$$dir' && rm -f\" $$files \")\"; \\\n         $(am__cd) \"$$dir\" && rm -f $$files; }; \\\n  }\nam__installdirs = \"$(DESTDIR)$(libdir)\" \"$(DESTDIR)$(m4datadir)\" \\\n\t\"$(DESTDIR)$(pkgincludedir)\" \\\n\t\"$(DESTDIR)$(pkginclude_internaldir)\"\nLTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)\nlib_libgtest_la_LIBADD =\nam__dirstamp = $(am__leading_dot)dirstamp\nam_lib_libgtest_la_OBJECTS = src/gtest-all.lo\nlib_libgtest_la_OBJECTS = $(am_lib_libgtest_la_OBJECTS)\nlib_libgtest_main_la_DEPENDENCIES = lib/libgtest.la\nam_lib_libgtest_main_la_OBJECTS = src/gtest_main.lo\nlib_libgtest_main_la_OBJECTS = $(am_lib_libgtest_main_la_OBJECTS)\nsamples_libsamples_la_LIBADD =\nam_samples_libsamples_la_OBJECTS = samples/sample1.lo \\\n\tsamples/sample2.lo samples/sample4.lo\nsamples_libsamples_la_OBJECTS = $(am_samples_libsamples_la_OBJECTS)\n@HAVE_PYTHON_TRUE@am__EXEEXT_1 = test/fused_gtest_test$(EXEEXT)\nam_samples_sample10_unittest_OBJECTS =  \\\n\tsamples/sample10_unittest.$(OBJEXT)\nsamples_sample10_unittest_OBJECTS =  \\\n\t$(am_samples_sample10_unittest_OBJECTS)\nsamples_sample10_unittest_DEPENDENCIES = lib/libgtest.la\nam_samples_sample1_unittest_OBJECTS =  \\\n\tsamples/sample1_unittest.$(OBJEXT)\nsamples_sample1_unittest_OBJECTS =  \\\n\t$(am_samples_sample1_unittest_OBJECTS)\nsamples_sample1_unittest_DEPENDENCIES = lib/libgtest_main.la \\\n\tlib/libgtest.la samples/libsamples.la\nam__test_fused_gtest_test_SOURCES_DIST = fused-src/gtest/gtest-all.cc \\\n\tfused-src/gtest/gtest.h fused-src/gtest/gtest_main.cc \\\n\tsamples/sample1.cc samples/sample1_unittest.cc\nam__objects_1 =  \\\n\tfused-src/gtest/test_fused_gtest_test-gtest-all.$(OBJEXT) \\\n\tfused-src/gtest/test_fused_gtest_test-gtest_main.$(OBJEXT)\n@HAVE_PYTHON_TRUE@am_test_fused_gtest_test_OBJECTS = $(am__objects_1) \\\n@HAVE_PYTHON_TRUE@\tsamples/test_fused_gtest_test-sample1.$(OBJEXT) \\\n@HAVE_PYTHON_TRUE@\tsamples/test_fused_gtest_test-sample1_unittest.$(OBJEXT)\ntest_fused_gtest_test_OBJECTS = $(am_test_fused_gtest_test_OBJECTS)\ntest_fused_gtest_test_LDADD = $(LDADD)\nam_test_gtest_all_test_OBJECTS = test/gtest_all_test.$(OBJEXT)\ntest_gtest_all_test_OBJECTS = $(am_test_gtest_all_test_OBJECTS)\ntest_gtest_all_test_DEPENDENCIES = lib/libgtest_main.la \\\n\tlib/libgtest.la\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/build-aux\ndepcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \\\n\t$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)\nLTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \\\n\t--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \\\n\t$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)\nCXXLD = $(CXX)\nCXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \\\n\t--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \\\n\t$(LDFLAGS) -o $@\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \\\n\t--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \\\n\t$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nCCLD = $(CC)\nLINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \\\n\t--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \\\n\t$(LDFLAGS) -o $@\nSOURCES = $(lib_libgtest_la_SOURCES) $(lib_libgtest_main_la_SOURCES) \\\n\t$(samples_libsamples_la_SOURCES) \\\n\t$(samples_sample10_unittest_SOURCES) \\\n\t$(samples_sample1_unittest_SOURCES) \\\n\t$(test_fused_gtest_test_SOURCES) \\\n\t$(test_gtest_all_test_SOURCES)\nDIST_SOURCES = $(lib_libgtest_la_SOURCES) \\\n\t$(lib_libgtest_main_la_SOURCES) \\\n\t$(samples_libsamples_la_SOURCES) \\\n\t$(samples_sample10_unittest_SOURCES) \\\n\t$(samples_sample1_unittest_SOURCES) \\\n\t$(am__test_fused_gtest_test_SOURCES_DIST) \\\n\t$(test_gtest_all_test_SOURCES)\nDATA = $(m4data_DATA)\nHEADERS = $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS)\nETAGS = etags\nCTAGS = ctags\nam__tty_colors = \\\nred=; grn=; lgn=; blu=; std=\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\ndistdir = $(PACKAGE)-$(VERSION)\ntop_distdir = $(distdir)\nam__remove_distdir = \\\n  if test -d \"$(distdir)\"; then \\\n    find \"$(distdir)\" -type d ! -perm -200 -exec chmod u+w {} ';' \\\n      && rm -rf \"$(distdir)\" \\\n      || { sleep 5 && rm -rf \"$(distdir)\"; }; \\\n  else :; fi\nDIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip\nGZIP_ENV = --best\ndistuninstallcheck_listfiles = find . -type f -print\nam__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \\\n  | sed 's|^\\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'\ndistcleancheck_listfiles = find . -type f -print\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAR = @AR@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAKEINFO = @MAKEINFO@\nMANIFEST_TOOL = @MANIFEST_TOOL@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nPYTHON = @PYTHON@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_AR = @ac_ct_AR@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget_alias = @target_alias@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nACLOCAL_AMFLAGS = -I m4\n\n# Nonstandard package files for distribution\n\n# Sample files that we don't compile.\n\n# C++ test files that we don't compile directly.\n\n# Python tests that we don't run.\n\n# CMake script\n\n# MSVC project files\n\n# xcode project files\n\n# xcode sample files\n\n# C++Builder project files\nEXTRA_DIST = CHANGES CONTRIBUTORS LICENSE \\\n\tinclude/gtest/gtest-param-test.h.pump \\\n\tinclude/gtest/internal/gtest-param-util-generated.h.pump \\\n\tinclude/gtest/internal/gtest-tuple.h.pump \\\n\tinclude/gtest/internal/gtest-type-util.h.pump make/Makefile \\\n\tscripts/fuse_gtest_files.py scripts/gen_gtest_pred_impl.py \\\n\tscripts/pump.py scripts/test/Makefile $(GTEST_SRC) \\\n\tsamples/prime_tables.h samples/sample2_unittest.cc \\\n\tsamples/sample3_unittest.cc samples/sample4_unittest.cc \\\n\tsamples/sample5_unittest.cc samples/sample6_unittest.cc \\\n\tsamples/sample7_unittest.cc samples/sample8_unittest.cc \\\n\tsamples/sample9_unittest.cc test/gtest-death-test_ex_test.cc \\\n\ttest/gtest-death-test_test.cc test/gtest-filepath_test.cc \\\n\ttest/gtest-linked_ptr_test.cc test/gtest-listener_test.cc \\\n\ttest/gtest-message_test.cc test/gtest-options_test.cc \\\n\ttest/gtest-param-test2_test.cc test/gtest-param-test2_test.cc \\\n\ttest/gtest-param-test_test.cc test/gtest-param-test_test.cc \\\n\ttest/gtest-param-test_test.h test/gtest-port_test.cc \\\n\ttest/gtest_premature_exit_test.cc test/gtest-printers_test.cc \\\n\ttest/gtest-test-part_test.cc test/gtest-tuple_test.cc \\\n\ttest/gtest-typed-test2_test.cc test/gtest-typed-test_test.cc \\\n\ttest/gtest-typed-test_test.h test/gtest-unittest-api_test.cc \\\n\ttest/gtest_break_on_failure_unittest_.cc \\\n\ttest/gtest_catch_exceptions_test_.cc test/gtest_color_test_.cc \\\n\ttest/gtest_env_var_test_.cc test/gtest_environment_test.cc \\\n\ttest/gtest_filter_unittest_.cc test/gtest_help_test_.cc \\\n\ttest/gtest_list_tests_unittest_.cc test/gtest_main_unittest.cc \\\n\ttest/gtest_no_test_unittest.cc test/gtest_output_test_.cc \\\n\ttest/gtest_pred_impl_unittest.cc test/gtest_prod_test.cc \\\n\ttest/gtest_repeat_test.cc test/gtest_shuffle_test_.cc \\\n\ttest/gtest_sole_header_test.cc test/gtest_stress_test.cc \\\n\ttest/gtest_throw_on_failure_ex_test.cc \\\n\ttest/gtest_throw_on_failure_test_.cc \\\n\ttest/gtest_uninitialized_test_.cc test/gtest_unittest.cc \\\n\ttest/gtest_unittest.cc test/gtest_xml_outfile1_test_.cc \\\n\ttest/gtest_xml_outfile2_test_.cc \\\n\ttest/gtest_xml_output_unittest_.cc test/production.cc \\\n\ttest/production.h test/gtest_break_on_failure_unittest.py \\\n\ttest/gtest_catch_exceptions_test.py test/gtest_color_test.py \\\n\ttest/gtest_env_var_test.py test/gtest_filter_unittest.py \\\n\ttest/gtest_help_test.py test/gtest_list_tests_unittest.py \\\n\ttest/gtest_output_test.py \\\n\ttest/gtest_output_test_golden_lin.txt \\\n\ttest/gtest_shuffle_test.py test/gtest_test_utils.py \\\n\ttest/gtest_throw_on_failure_test.py \\\n\ttest/gtest_uninitialized_test.py \\\n\ttest/gtest_xml_outfiles_test.py \\\n\ttest/gtest_xml_output_unittest.py test/gtest_xml_test_utils.py \\\n\tCMakeLists.txt cmake/internal_utils.cmake msvc/gtest-md.sln \\\n\tmsvc/gtest-md.vcproj msvc/gtest.sln msvc/gtest.vcproj \\\n\tmsvc/gtest_main-md.vcproj msvc/gtest_main.vcproj \\\n\tmsvc/gtest_prod_test-md.vcproj msvc/gtest_prod_test.vcproj \\\n\tmsvc/gtest_unittest-md.vcproj msvc/gtest_unittest.vcproj \\\n\txcode/Config/DebugProject.xcconfig \\\n\txcode/Config/FrameworkTarget.xcconfig \\\n\txcode/Config/General.xcconfig \\\n\txcode/Config/ReleaseProject.xcconfig \\\n\txcode/Config/StaticLibraryTarget.xcconfig \\\n\txcode/Config/TestTarget.xcconfig xcode/Resources/Info.plist \\\n\txcode/Scripts/runtests.sh xcode/Scripts/versiongenerate.py \\\n\txcode/gtest.xcodeproj/project.pbxproj \\\n\txcode/Samples/FrameworkSample/Info.plist \\\n\txcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj \\\n\txcode/Samples/FrameworkSample/runtests.sh \\\n\txcode/Samples/FrameworkSample/widget.cc \\\n\txcode/Samples/FrameworkSample/widget.h \\\n\txcode/Samples/FrameworkSample/widget_test.cc \\\n\tcodegear/gtest.cbproj codegear/gtest.groupproj \\\n\tcodegear/gtest_all.cc codegear/gtest_link.cc \\\n\tcodegear/gtest_main.cbproj codegear/gtest_unittest.cbproj \\\n\t$(m4data_DATA)\n\n# gtest source files that we don't compile directly.  They are\n# #included by gtest-all.cc.\nGTEST_SRC = \\\n  src/gtest-death-test.cc \\\n  src/gtest-filepath.cc \\\n  src/gtest-internal-inl.h \\\n  src/gtest-port.cc \\\n  src/gtest-printers.cc \\\n  src/gtest-test-part.cc \\\n  src/gtest-typed-test.cc \\\n  src/gtest.cc\n\n\n# Distribute and install M4 macro\nm4datadir = $(datadir)/aclocal\nm4data_DATA = m4/gtest.m4\n\n# We define the global AM_CPPFLAGS as everything we compile includes from these\n# directories.\nAM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include\n@HAVE_PTHREADS_FALSE@AM_CXXFLAGS = -DGTEST_HAS_PTHREAD=0\n\n# Modifies compiler and linker flags for pthreads compatibility.\n@HAVE_PTHREADS_TRUE@AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1\n@HAVE_PTHREADS_TRUE@AM_LIBS = @PTHREAD_LIBS@\n\n# Build rules for libraries.\nlib_LTLIBRARIES = lib/libgtest.la lib/libgtest_main.la\nlib_libgtest_la_SOURCES = src/gtest-all.cc\npkginclude_HEADERS = \\\n  include/gtest/gtest-death-test.h \\\n  include/gtest/gtest-message.h \\\n  include/gtest/gtest-param-test.h \\\n  include/gtest/gtest-printers.h \\\n  include/gtest/gtest-spi.h \\\n  include/gtest/gtest-test-part.h \\\n  include/gtest/gtest-typed-test.h \\\n  include/gtest/gtest.h \\\n  include/gtest/gtest_pred_impl.h \\\n  include/gtest/gtest_prod.h\n\npkginclude_internaldir = $(pkgincludedir)/internal\npkginclude_internal_HEADERS = \\\n  include/gtest/internal/gtest-death-test-internal.h \\\n  include/gtest/internal/gtest-filepath.h \\\n  include/gtest/internal/gtest-internal.h \\\n  include/gtest/internal/gtest-linked_ptr.h \\\n  include/gtest/internal/gtest-param-util-generated.h \\\n  include/gtest/internal/gtest-param-util.h \\\n  include/gtest/internal/gtest-port.h \\\n  include/gtest/internal/gtest-string.h \\\n  include/gtest/internal/gtest-tuple.h \\\n  include/gtest/internal/gtest-type-util.h\n\nlib_libgtest_main_la_SOURCES = src/gtest_main.cc\nlib_libgtest_main_la_LIBADD = lib/libgtest.la\n\n# Bulid rules for samples and tests. Automake's naming for some of\n# these variables isn't terribly obvious, so this is a brief\n# reference:\n#\n# TESTS -- Programs run automatically by \"make check\"\n# check_PROGRAMS -- Programs built by \"make check\" but not necessarily run\nnoinst_LTLIBRARIES = samples/libsamples.la\nsamples_libsamples_la_SOURCES = \\\n  samples/sample1.cc \\\n  samples/sample1.h \\\n  samples/sample2.cc \\\n  samples/sample2.h \\\n  samples/sample3-inl.h \\\n  samples/sample4.cc \\\n  samples/sample4.h\n\nTESTS_ENVIRONMENT = GTEST_SOURCE_DIR=\"$(srcdir)/test\" \\\n                    GTEST_BUILD_DIR=\"$(top_builddir)/test\"\n\nsamples_sample1_unittest_SOURCES = samples/sample1_unittest.cc\nsamples_sample1_unittest_LDADD = lib/libgtest_main.la \\\n                                 lib/libgtest.la \\\n                                 samples/libsamples.la\n\nsamples_sample10_unittest_SOURCES = samples/sample10_unittest.cc\nsamples_sample10_unittest_LDADD = lib/libgtest.la\ntest_gtest_all_test_SOURCES = test/gtest_all_test.cc\ntest_gtest_all_test_LDADD = lib/libgtest_main.la \\\n                            lib/libgtest.la\n\n\n# Tests that fused gtest files compile and work.\nFUSED_GTEST_SRC = \\\n  fused-src/gtest/gtest-all.cc \\\n  fused-src/gtest/gtest.h \\\n  fused-src/gtest/gtest_main.cc\n\n@HAVE_PYTHON_TRUE@test_fused_gtest_test_SOURCES = $(FUSED_GTEST_SRC) \\\n@HAVE_PYTHON_TRUE@                                samples/sample1.cc samples/sample1_unittest.cc\n\n@HAVE_PYTHON_TRUE@test_fused_gtest_test_CPPFLAGS = -I\"$(srcdir)/fused-src\"\n\n# Death tests may produce core dumps in the build directory. In case\n# this happens, clean them to keep distcleancheck happy.\nCLEANFILES = core\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .cc .lo .o .obj\nam--refresh: Makefile\n\t@:\n$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \\\n\t      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \\\n\t\t&& exit 0; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    echo ' $(SHELL) ./config.status'; \\\n\t    $(SHELL) ./config.status;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\t$(SHELL) ./config.status --recheck\n\n$(top_srcdir)/configure:  $(am__configure_deps)\n\t$(am__cd) $(srcdir) && $(AUTOCONF)\n$(ACLOCAL_M4):  $(am__aclocal_m4_deps)\n\t$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)\n$(am__aclocal_m4_deps):\n\nbuild-aux/config.h: build-aux/stamp-h1\n\t@if test ! -f $@; then rm -f build-aux/stamp-h1; else :; fi\n\t@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) build-aux/stamp-h1; else :; fi\n\nbuild-aux/stamp-h1: $(top_srcdir)/build-aux/config.h.in $(top_builddir)/config.status\n\t@rm -f build-aux/stamp-h1\n\tcd $(top_builddir) && $(SHELL) ./config.status build-aux/config.h\n$(top_srcdir)/build-aux/config.h.in:  $(am__configure_deps) \n\t($(am__cd) $(top_srcdir) && $(AUTOHEADER))\n\trm -f build-aux/stamp-h1\n\ttouch $@\n\ndistclean-hdr:\n\t-rm -f build-aux/config.h build-aux/stamp-h1\nscripts/gtest-config: $(top_builddir)/config.status $(top_srcdir)/scripts/gtest-config.in\n\tcd $(top_builddir) && $(SHELL) ./config.status $@\ninstall-libLTLIBRARIES: $(lib_LTLIBRARIES)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(libdir)\" || $(MKDIR_P) \"$(DESTDIR)$(libdir)\"\n\t@list='$(lib_LTLIBRARIES)'; test -n \"$(libdir)\" || list=; \\\n\tlist2=; for p in $$list; do \\\n\t  if test -f $$p; then \\\n\t    list2=\"$$list2 $$p\"; \\\n\t  else :; fi; \\\n\tdone; \\\n\ttest -z \"$$list2\" || { \\\n\t  echo \" $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'\"; \\\n\t  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 \"$(DESTDIR)$(libdir)\"; \\\n\t}\n\nuninstall-libLTLIBRARIES:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(lib_LTLIBRARIES)'; test -n \"$(libdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  $(am__strip_dir) \\\n\t  echo \" $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'\"; \\\n\t  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f \"$(DESTDIR)$(libdir)/$$f\"; \\\n\tdone\n\nclean-libLTLIBRARIES:\n\t-test -z \"$(lib_LTLIBRARIES)\" || rm -f $(lib_LTLIBRARIES)\n\t@list='$(lib_LTLIBRARIES)'; for p in $$list; do \\\n\t  dir=\"`echo $$p | sed -e 's|/[^/]*$$||'`\"; \\\n\t  test \"$$dir\" != \"$$p\" || dir=.; \\\n\t  echo \"rm -f \\\"$${dir}/so_locations\\\"\"; \\\n\t  rm -f \"$${dir}/so_locations\"; \\\n\tdone\n\nclean-noinstLTLIBRARIES:\n\t-test -z \"$(noinst_LTLIBRARIES)\" || rm -f $(noinst_LTLIBRARIES)\n\t@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \\\n\t  dir=\"`echo $$p | sed -e 's|/[^/]*$$||'`\"; \\\n\t  test \"$$dir\" != \"$$p\" || dir=.; \\\n\t  echo \"rm -f \\\"$${dir}/so_locations\\\"\"; \\\n\t  rm -f \"$${dir}/so_locations\"; \\\n\tdone\nsrc/$(am__dirstamp):\n\t@$(MKDIR_P) src\n\t@: > src/$(am__dirstamp)\nsrc/$(DEPDIR)/$(am__dirstamp):\n\t@$(MKDIR_P) src/$(DEPDIR)\n\t@: > src/$(DEPDIR)/$(am__dirstamp)\nsrc/gtest-all.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)\nlib/$(am__dirstamp):\n\t@$(MKDIR_P) lib\n\t@: > lib/$(am__dirstamp)\nlib/libgtest.la: $(lib_libgtest_la_OBJECTS) $(lib_libgtest_la_DEPENDENCIES) $(EXTRA_lib_libgtest_la_DEPENDENCIES) lib/$(am__dirstamp)\n\t$(CXXLINK) -rpath $(libdir) $(lib_libgtest_la_OBJECTS) $(lib_libgtest_la_LIBADD) $(LIBS)\nsrc/gtest_main.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)\nlib/libgtest_main.la: $(lib_libgtest_main_la_OBJECTS) $(lib_libgtest_main_la_DEPENDENCIES) $(EXTRA_lib_libgtest_main_la_DEPENDENCIES) lib/$(am__dirstamp)\n\t$(CXXLINK) -rpath $(libdir) $(lib_libgtest_main_la_OBJECTS) $(lib_libgtest_main_la_LIBADD) $(LIBS)\nsamples/$(am__dirstamp):\n\t@$(MKDIR_P) samples\n\t@: > samples/$(am__dirstamp)\nsamples/$(DEPDIR)/$(am__dirstamp):\n\t@$(MKDIR_P) samples/$(DEPDIR)\n\t@: > samples/$(DEPDIR)/$(am__dirstamp)\nsamples/sample1.lo: samples/$(am__dirstamp) \\\n\tsamples/$(DEPDIR)/$(am__dirstamp)\nsamples/sample2.lo: samples/$(am__dirstamp) \\\n\tsamples/$(DEPDIR)/$(am__dirstamp)\nsamples/sample4.lo: samples/$(am__dirstamp) \\\n\tsamples/$(DEPDIR)/$(am__dirstamp)\nsamples/libsamples.la: $(samples_libsamples_la_OBJECTS) $(samples_libsamples_la_DEPENDENCIES) $(EXTRA_samples_libsamples_la_DEPENDENCIES) samples/$(am__dirstamp)\n\t$(CXXLINK)  $(samples_libsamples_la_OBJECTS) $(samples_libsamples_la_LIBADD) $(LIBS)\n\nclean-checkPROGRAMS:\n\t@list='$(check_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\nsamples/sample10_unittest.$(OBJEXT): samples/$(am__dirstamp) \\\n\tsamples/$(DEPDIR)/$(am__dirstamp)\nsamples/sample10_unittest$(EXEEXT): $(samples_sample10_unittest_OBJECTS) $(samples_sample10_unittest_DEPENDENCIES) $(EXTRA_samples_sample10_unittest_DEPENDENCIES) samples/$(am__dirstamp)\n\t@rm -f samples/sample10_unittest$(EXEEXT)\n\t$(CXXLINK) $(samples_sample10_unittest_OBJECTS) $(samples_sample10_unittest_LDADD) $(LIBS)\nsamples/sample1_unittest.$(OBJEXT): samples/$(am__dirstamp) \\\n\tsamples/$(DEPDIR)/$(am__dirstamp)\nsamples/sample1_unittest$(EXEEXT): $(samples_sample1_unittest_OBJECTS) $(samples_sample1_unittest_DEPENDENCIES) $(EXTRA_samples_sample1_unittest_DEPENDENCIES) samples/$(am__dirstamp)\n\t@rm -f samples/sample1_unittest$(EXEEXT)\n\t$(CXXLINK) $(samples_sample1_unittest_OBJECTS) $(samples_sample1_unittest_LDADD) $(LIBS)\nfused-src/gtest/$(am__dirstamp):\n\t@$(MKDIR_P) fused-src/gtest\n\t@: > fused-src/gtest/$(am__dirstamp)\nfused-src/gtest/$(DEPDIR)/$(am__dirstamp):\n\t@$(MKDIR_P) fused-src/gtest/$(DEPDIR)\n\t@: > fused-src/gtest/$(DEPDIR)/$(am__dirstamp)\nfused-src/gtest/test_fused_gtest_test-gtest-all.$(OBJEXT):  \\\n\tfused-src/gtest/$(am__dirstamp) \\\n\tfused-src/gtest/$(DEPDIR)/$(am__dirstamp)\nfused-src/gtest/test_fused_gtest_test-gtest_main.$(OBJEXT):  \\\n\tfused-src/gtest/$(am__dirstamp) \\\n\tfused-src/gtest/$(DEPDIR)/$(am__dirstamp)\nsamples/test_fused_gtest_test-sample1.$(OBJEXT):  \\\n\tsamples/$(am__dirstamp) samples/$(DEPDIR)/$(am__dirstamp)\nsamples/test_fused_gtest_test-sample1_unittest.$(OBJEXT):  \\\n\tsamples/$(am__dirstamp) samples/$(DEPDIR)/$(am__dirstamp)\ntest/$(am__dirstamp):\n\t@$(MKDIR_P) test\n\t@: > test/$(am__dirstamp)\ntest/fused_gtest_test$(EXEEXT): $(test_fused_gtest_test_OBJECTS) $(test_fused_gtest_test_DEPENDENCIES) $(EXTRA_test_fused_gtest_test_DEPENDENCIES) test/$(am__dirstamp)\n\t@rm -f test/fused_gtest_test$(EXEEXT)\n\t$(CXXLINK) $(test_fused_gtest_test_OBJECTS) $(test_fused_gtest_test_LDADD) $(LIBS)\ntest/$(DEPDIR)/$(am__dirstamp):\n\t@$(MKDIR_P) test/$(DEPDIR)\n\t@: > test/$(DEPDIR)/$(am__dirstamp)\ntest/gtest_all_test.$(OBJEXT): test/$(am__dirstamp) \\\n\ttest/$(DEPDIR)/$(am__dirstamp)\ntest/gtest_all_test$(EXEEXT): $(test_gtest_all_test_OBJECTS) $(test_gtest_all_test_DEPENDENCIES) $(EXTRA_test_gtest_all_test_DEPENDENCIES) test/$(am__dirstamp)\n\t@rm -f test/gtest_all_test$(EXEEXT)\n\t$(CXXLINK) $(test_gtest_all_test_OBJECTS) $(test_gtest_all_test_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\t-rm -f fused-src/gtest/test_fused_gtest_test-gtest-all.$(OBJEXT)\n\t-rm -f fused-src/gtest/test_fused_gtest_test-gtest_main.$(OBJEXT)\n\t-rm -f samples/sample1.$(OBJEXT)\n\t-rm -f samples/sample1.lo\n\t-rm -f samples/sample10_unittest.$(OBJEXT)\n\t-rm -f samples/sample1_unittest.$(OBJEXT)\n\t-rm -f samples/sample2.$(OBJEXT)\n\t-rm -f samples/sample2.lo\n\t-rm -f samples/sample4.$(OBJEXT)\n\t-rm -f samples/sample4.lo\n\t-rm -f samples/test_fused_gtest_test-sample1.$(OBJEXT)\n\t-rm -f samples/test_fused_gtest_test-sample1_unittest.$(OBJEXT)\n\t-rm -f src/gtest-all.$(OBJEXT)\n\t-rm -f src/gtest-all.lo\n\t-rm -f src/gtest_main.$(OBJEXT)\n\t-rm -f src/gtest_main.lo\n\t-rm -f test/gtest_all_test.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/sample1.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/sample10_unittest.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/sample1_unittest.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/sample2.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/sample4.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/test_fused_gtest_test-sample1.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/gtest-all.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/gtest_main.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/gtest_all_test.Po@am__quote@\n\n.cc.o:\n@am__fastdepCXX_TRUE@\tdepbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\\.o$$||'`;\\\n@am__fastdepCXX_TRUE@\t$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\\\n@am__fastdepCXX_TRUE@\t$(am__mv) $$depbase.Tpo $$depbase.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXXCOMPILE) -c -o $@ $<\n\n.cc.obj:\n@am__fastdepCXX_TRUE@\tdepbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\\.obj$$||'`;\\\n@am__fastdepCXX_TRUE@\t$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\\\n@am__fastdepCXX_TRUE@\t$(am__mv) $$depbase.Tpo $$depbase.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`\n\n.cc.lo:\n@am__fastdepCXX_TRUE@\tdepbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\\.lo$$||'`;\\\n@am__fastdepCXX_TRUE@\t$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\\\n@am__fastdepCXX_TRUE@\t$(am__mv) $$depbase.Tpo $$depbase.Plo\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(LTCXXCOMPILE) -c -o $@ $<\n\nfused-src/gtest/test_fused_gtest_test-gtest-all.o: fused-src/gtest/gtest-all.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fused-src/gtest/test_fused_gtest_test-gtest-all.o -MD -MP -MF fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Tpo -c -o fused-src/gtest/test_fused_gtest_test-gtest-all.o `test -f 'fused-src/gtest/gtest-all.cc' || echo '$(srcdir)/'`fused-src/gtest/gtest-all.cc\n@am__fastdepCXX_TRUE@\t$(am__mv) fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Tpo fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='fused-src/gtest/gtest-all.cc' object='fused-src/gtest/test_fused_gtest_test-gtest-all.o' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fused-src/gtest/test_fused_gtest_test-gtest-all.o `test -f 'fused-src/gtest/gtest-all.cc' || echo '$(srcdir)/'`fused-src/gtest/gtest-all.cc\n\nfused-src/gtest/test_fused_gtest_test-gtest-all.obj: fused-src/gtest/gtest-all.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fused-src/gtest/test_fused_gtest_test-gtest-all.obj -MD -MP -MF fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Tpo -c -o fused-src/gtest/test_fused_gtest_test-gtest-all.obj `if test -f 'fused-src/gtest/gtest-all.cc'; then $(CYGPATH_W) 'fused-src/gtest/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/fused-src/gtest/gtest-all.cc'; fi`\n@am__fastdepCXX_TRUE@\t$(am__mv) fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Tpo fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest-all.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='fused-src/gtest/gtest-all.cc' object='fused-src/gtest/test_fused_gtest_test-gtest-all.obj' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fused-src/gtest/test_fused_gtest_test-gtest-all.obj `if test -f 'fused-src/gtest/gtest-all.cc'; then $(CYGPATH_W) 'fused-src/gtest/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/fused-src/gtest/gtest-all.cc'; fi`\n\nfused-src/gtest/test_fused_gtest_test-gtest_main.o: fused-src/gtest/gtest_main.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fused-src/gtest/test_fused_gtest_test-gtest_main.o -MD -MP -MF fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Tpo -c -o fused-src/gtest/test_fused_gtest_test-gtest_main.o `test -f 'fused-src/gtest/gtest_main.cc' || echo '$(srcdir)/'`fused-src/gtest/gtest_main.cc\n@am__fastdepCXX_TRUE@\t$(am__mv) fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Tpo fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='fused-src/gtest/gtest_main.cc' object='fused-src/gtest/test_fused_gtest_test-gtest_main.o' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fused-src/gtest/test_fused_gtest_test-gtest_main.o `test -f 'fused-src/gtest/gtest_main.cc' || echo '$(srcdir)/'`fused-src/gtest/gtest_main.cc\n\nfused-src/gtest/test_fused_gtest_test-gtest_main.obj: fused-src/gtest/gtest_main.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fused-src/gtest/test_fused_gtest_test-gtest_main.obj -MD -MP -MF fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Tpo -c -o fused-src/gtest/test_fused_gtest_test-gtest_main.obj `if test -f 'fused-src/gtest/gtest_main.cc'; then $(CYGPATH_W) 'fused-src/gtest/gtest_main.cc'; else $(CYGPATH_W) '$(srcdir)/fused-src/gtest/gtest_main.cc'; fi`\n@am__fastdepCXX_TRUE@\t$(am__mv) fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Tpo fused-src/gtest/$(DEPDIR)/test_fused_gtest_test-gtest_main.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='fused-src/gtest/gtest_main.cc' object='fused-src/gtest/test_fused_gtest_test-gtest_main.obj' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fused-src/gtest/test_fused_gtest_test-gtest_main.obj `if test -f 'fused-src/gtest/gtest_main.cc'; then $(CYGPATH_W) 'fused-src/gtest/gtest_main.cc'; else $(CYGPATH_W) '$(srcdir)/fused-src/gtest/gtest_main.cc'; fi`\n\nsamples/test_fused_gtest_test-sample1.o: samples/sample1.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT samples/test_fused_gtest_test-sample1.o -MD -MP -MF samples/$(DEPDIR)/test_fused_gtest_test-sample1.Tpo -c -o samples/test_fused_gtest_test-sample1.o `test -f 'samples/sample1.cc' || echo '$(srcdir)/'`samples/sample1.cc\n@am__fastdepCXX_TRUE@\t$(am__mv) samples/$(DEPDIR)/test_fused_gtest_test-sample1.Tpo samples/$(DEPDIR)/test_fused_gtest_test-sample1.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='samples/sample1.cc' object='samples/test_fused_gtest_test-sample1.o' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o samples/test_fused_gtest_test-sample1.o `test -f 'samples/sample1.cc' || echo '$(srcdir)/'`samples/sample1.cc\n\nsamples/test_fused_gtest_test-sample1.obj: samples/sample1.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT samples/test_fused_gtest_test-sample1.obj -MD -MP -MF samples/$(DEPDIR)/test_fused_gtest_test-sample1.Tpo -c -o samples/test_fused_gtest_test-sample1.obj `if test -f 'samples/sample1.cc'; then $(CYGPATH_W) 'samples/sample1.cc'; else $(CYGPATH_W) '$(srcdir)/samples/sample1.cc'; fi`\n@am__fastdepCXX_TRUE@\t$(am__mv) samples/$(DEPDIR)/test_fused_gtest_test-sample1.Tpo samples/$(DEPDIR)/test_fused_gtest_test-sample1.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='samples/sample1.cc' object='samples/test_fused_gtest_test-sample1.obj' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o samples/test_fused_gtest_test-sample1.obj `if test -f 'samples/sample1.cc'; then $(CYGPATH_W) 'samples/sample1.cc'; else $(CYGPATH_W) '$(srcdir)/samples/sample1.cc'; fi`\n\nsamples/test_fused_gtest_test-sample1_unittest.o: samples/sample1_unittest.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT samples/test_fused_gtest_test-sample1_unittest.o -MD -MP -MF samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Tpo -c -o samples/test_fused_gtest_test-sample1_unittest.o `test -f 'samples/sample1_unittest.cc' || echo '$(srcdir)/'`samples/sample1_unittest.cc\n@am__fastdepCXX_TRUE@\t$(am__mv) samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Tpo samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='samples/sample1_unittest.cc' object='samples/test_fused_gtest_test-sample1_unittest.o' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o samples/test_fused_gtest_test-sample1_unittest.o `test -f 'samples/sample1_unittest.cc' || echo '$(srcdir)/'`samples/sample1_unittest.cc\n\nsamples/test_fused_gtest_test-sample1_unittest.obj: samples/sample1_unittest.cc\n@am__fastdepCXX_TRUE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT samples/test_fused_gtest_test-sample1_unittest.obj -MD -MP -MF samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Tpo -c -o samples/test_fused_gtest_test-sample1_unittest.obj `if test -f 'samples/sample1_unittest.cc'; then $(CYGPATH_W) 'samples/sample1_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/samples/sample1_unittest.cc'; fi`\n@am__fastdepCXX_TRUE@\t$(am__mv) samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Tpo samples/$(DEPDIR)/test_fused_gtest_test-sample1_unittest.Po\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='samples/sample1_unittest.cc' object='samples/test_fused_gtest_test-sample1_unittest.obj' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_fused_gtest_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o samples/test_fused_gtest_test-sample1_unittest.obj `if test -f 'samples/sample1_unittest.cc'; then $(CYGPATH_W) 'samples/sample1_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/samples/sample1_unittest.cc'; fi`\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\t-rm -rf lib/.libs lib/_libs\n\t-rm -rf samples/.libs samples/_libs\n\t-rm -rf src/.libs src/_libs\n\t-rm -rf test/.libs test/_libs\n\ndistclean-libtool:\n\t-rm -f libtool config.lt\ninstall-m4dataDATA: $(m4data_DATA)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(m4datadir)\" || $(MKDIR_P) \"$(DESTDIR)$(m4datadir)\"\n\t@list='$(m4data_DATA)'; test -n \"$(m4datadir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'\"; \\\n\t  $(INSTALL_DATA) $$files \"$(DESTDIR)$(m4datadir)\" || exit $$?; \\\n\tdone\n\nuninstall-m4dataDATA:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(m4data_DATA)'; test -n \"$(m4datadir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\tdir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir)\ninstall-pkgincludeHEADERS: $(pkginclude_HEADERS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(pkgincludedir)\" || $(MKDIR_P) \"$(DESTDIR)$(pkgincludedir)\"\n\t@list='$(pkginclude_HEADERS)'; test -n \"$(pkgincludedir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'\"; \\\n\t  $(INSTALL_HEADER) $$files \"$(DESTDIR)$(pkgincludedir)\" || exit $$?; \\\n\tdone\n\nuninstall-pkgincludeHEADERS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(pkginclude_HEADERS)'; test -n \"$(pkgincludedir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\tdir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)\ninstall-pkginclude_internalHEADERS: $(pkginclude_internal_HEADERS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(pkginclude_internaldir)\" || $(MKDIR_P) \"$(DESTDIR)$(pkginclude_internaldir)\"\n\t@list='$(pkginclude_internal_HEADERS)'; test -n \"$(pkginclude_internaldir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkginclude_internaldir)'\"; \\\n\t  $(INSTALL_HEADER) $$files \"$(DESTDIR)$(pkginclude_internaldir)\" || exit $$?; \\\n\tdone\n\nuninstall-pkginclude_internalHEADERS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(pkginclude_internal_HEADERS)'; test -n \"$(pkginclude_internaldir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\tdir='$(DESTDIR)$(pkginclude_internaldir)'; $(am__uninstall_files_from_dir)\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ncheck-TESTS: $(TESTS)\n\t@failed=0; all=0; xfail=0; xpass=0; skip=0; \\\n\tsrcdir=$(srcdir); export srcdir; \\\n\tlist=' $(TESTS) '; \\\n\t$(am__tty_colors); \\\n\tif test -n \"$$list\"; then \\\n\t  for tst in $$list; do \\\n\t    if test -f ./$$tst; then dir=./; \\\n\t    elif test -f $$tst; then dir=; \\\n\t    else dir=\"$(srcdir)/\"; fi; \\\n\t    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \\\n\t      all=`expr $$all + 1`; \\\n\t      case \" $(XFAIL_TESTS) \" in \\\n\t      *[\\ \\\t]$$tst[\\ \\\t]*) \\\n\t\txpass=`expr $$xpass + 1`; \\\n\t\tfailed=`expr $$failed + 1`; \\\n\t\tcol=$$red; res=XPASS; \\\n\t      ;; \\\n\t      *) \\\n\t\tcol=$$grn; res=PASS; \\\n\t      ;; \\\n\t      esac; \\\n\t    elif test $$? -ne 77; then \\\n\t      all=`expr $$all + 1`; \\\n\t      case \" $(XFAIL_TESTS) \" in \\\n\t      *[\\ \\\t]$$tst[\\ \\\t]*) \\\n\t\txfail=`expr $$xfail + 1`; \\\n\t\tcol=$$lgn; res=XFAIL; \\\n\t      ;; \\\n\t      *) \\\n\t\tfailed=`expr $$failed + 1`; \\\n\t\tcol=$$red; res=FAIL; \\\n\t      ;; \\\n\t      esac; \\\n\t    else \\\n\t      skip=`expr $$skip + 1`; \\\n\t      col=$$blu; res=SKIP; \\\n\t    fi; \\\n\t    echo \"$${col}$$res$${std}: $$tst\"; \\\n\t  done; \\\n\t  if test \"$$all\" -eq 1; then \\\n\t    tests=\"test\"; \\\n\t    All=\"\"; \\\n\t  else \\\n\t    tests=\"tests\"; \\\n\t    All=\"All \"; \\\n\t  fi; \\\n\t  if test \"$$failed\" -eq 0; then \\\n\t    if test \"$$xfail\" -eq 0; then \\\n\t      banner=\"$$All$$all $$tests passed\"; \\\n\t    else \\\n\t      if test \"$$xfail\" -eq 1; then failures=failure; else failures=failures; fi; \\\n\t      banner=\"$$All$$all $$tests behaved as expected ($$xfail expected $$failures)\"; \\\n\t    fi; \\\n\t  else \\\n\t    if test \"$$xpass\" -eq 0; then \\\n\t      banner=\"$$failed of $$all $$tests failed\"; \\\n\t    else \\\n\t      if test \"$$xpass\" -eq 1; then passes=pass; else passes=passes; fi; \\\n\t      banner=\"$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)\"; \\\n\t    fi; \\\n\t  fi; \\\n\t  dashes=\"$$banner\"; \\\n\t  skipped=\"\"; \\\n\t  if test \"$$skip\" -ne 0; then \\\n\t    if test \"$$skip\" -eq 1; then \\\n\t      skipped=\"($$skip test was not run)\"; \\\n\t    else \\\n\t      skipped=\"($$skip tests were not run)\"; \\\n\t    fi; \\\n\t    test `echo \"$$skipped\" | wc -c` -le `echo \"$$banner\" | wc -c` || \\\n\t      dashes=\"$$skipped\"; \\\n\t  fi; \\\n\t  report=\"\"; \\\n\t  if test \"$$failed\" -ne 0 && test -n \"$(PACKAGE_BUGREPORT)\"; then \\\n\t    report=\"Please report to $(PACKAGE_BUGREPORT)\"; \\\n\t    test `echo \"$$report\" | wc -c` -le `echo \"$$banner\" | wc -c` || \\\n\t      dashes=\"$$report\"; \\\n\t  fi; \\\n\t  dashes=`echo \"$$dashes\" | sed s/./=/g`; \\\n\t  if test \"$$failed\" -eq 0; then \\\n\t    col=\"$$grn\"; \\\n\t  else \\\n\t    col=\"$$red\"; \\\n\t  fi; \\\n\t  echo \"$${col}$$dashes$${std}\"; \\\n\t  echo \"$${col}$$banner$${std}\"; \\\n\t  test -z \"$$skipped\" || echo \"$${col}$$skipped$${std}\"; \\\n\t  test -z \"$$report\" || echo \"$${col}$$report$${std}\"; \\\n\t  echo \"$${col}$$dashes$${std}\"; \\\n\t  test \"$$failed\" -eq 0; \\\n\telse :; fi\n\ndistdir: $(DISTFILES)\n\t$(am__remove_distdir)\n\ttest -d \"$(distdir)\" || mkdir \"$(distdir)\"\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t-test -n \"$(am__skip_mode_fix)\" \\\n\t|| find \"$(distdir)\" -type d ! -perm -755 \\\n\t\t-exec chmod u+rwx,go+rx {} \\; -o \\\n\t  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \\; -o \\\n\t  ! -type d ! -perm -400 -exec chmod a+r {} \\; -o \\\n\t  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \\; \\\n\t|| chmod -R a+r \"$(distdir)\"\ndist-gzip: distdir\n\ttardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz\n\t$(am__remove_distdir)\ndist-bzip2: distdir\n\ttardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2\n\t$(am__remove_distdir)\n\ndist-lzip: distdir\n\ttardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz\n\t$(am__remove_distdir)\n\ndist-lzma: distdir\n\ttardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma\n\t$(am__remove_distdir)\n\ndist-xz: distdir\n\ttardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz\n\t$(am__remove_distdir)\n\ndist-tarZ: distdir\n\ttardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z\n\t$(am__remove_distdir)\n\ndist-shar: distdir\n\tshar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz\n\t$(am__remove_distdir)\ndist-zip: distdir\n\t-rm -f $(distdir).zip\n\tzip -rq $(distdir).zip $(distdir)\n\t$(am__remove_distdir)\n\ndist dist-all: distdir\n\ttardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz\n\ttardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2\n\t-rm -f $(distdir).zip\n\tzip -rq $(distdir).zip $(distdir)\n\t$(am__remove_distdir)\n\n# This target untars the dist file and tries a VPATH configuration.  Then\n# it guarantees that the distribution is self-contained by making another\n# tarfile.\ndistcheck: dist\n\tcase '$(DIST_ARCHIVES)' in \\\n\t*.tar.gz*) \\\n\t  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\\\n\t*.tar.bz2*) \\\n\t  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\\\n\t*.tar.lzma*) \\\n\t  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\\\n\t*.tar.lz*) \\\n\t  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\\\n\t*.tar.xz*) \\\n\t  xz -dc $(distdir).tar.xz | $(am__untar) ;;\\\n\t*.tar.Z*) \\\n\t  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\\\n\t*.shar.gz*) \\\n\t  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\\\n\t*.zip*) \\\n\t  unzip $(distdir).zip ;;\\\n\tesac\n\tchmod -R a-w $(distdir); chmod a+w $(distdir)\n\tmkdir $(distdir)/_build\n\tmkdir $(distdir)/_inst\n\tchmod a-w $(distdir)\n\ttest -d $(distdir)/_build || exit 0; \\\n\tdc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\\\/]:[\\\\/],/,'` \\\n\t  && dc_destdir=\"$${TMPDIR-/tmp}/am-dc-$$$$/\" \\\n\t  && am__cwd=`pwd` \\\n\t  && $(am__cd) $(distdir)/_build \\\n\t  && ../configure --srcdir=.. --prefix=\"$$dc_install_base\" \\\n\t    $(AM_DISTCHECK_CONFIGURE_FLAGS) \\\n\t    $(DISTCHECK_CONFIGURE_FLAGS) \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) dvi \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) check \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) install \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) installcheck \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) uninstall \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir=\"$$dc_install_base\" \\\n\t        distuninstallcheck \\\n\t  && chmod -R a-w \"$$dc_install_base\" \\\n\t  && ({ \\\n\t       (cd ../.. && umask 077 && mkdir \"$$dc_destdir\") \\\n\t       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR=\"$$dc_destdir\" install \\\n\t       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR=\"$$dc_destdir\" uninstall \\\n\t       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR=\"$$dc_destdir\" \\\n\t            distuninstallcheck_dir=\"$$dc_destdir\" distuninstallcheck; \\\n\t      } || { rm -rf \"$$dc_destdir\"; exit 1; }) \\\n\t  && rm -rf \"$$dc_destdir\" \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) dist \\\n\t  && rm -rf $(DIST_ARCHIVES) \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \\\n\t  && cd \"$$am__cwd\" \\\n\t  || exit 1\n\t$(am__remove_distdir)\n\t@(echo \"$(distdir) archives ready for distribution: \"; \\\n\t  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \\\n\t  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'\ndistuninstallcheck:\n\t@test -n '$(distuninstallcheck_dir)' || { \\\n\t  echo 'ERROR: trying to run $@ with an empty' \\\n\t       '$$(distuninstallcheck_dir)' >&2; \\\n\t  exit 1; \\\n\t}; \\\n\t$(am__cd) '$(distuninstallcheck_dir)' || { \\\n\t  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \\\n\t  exit 1; \\\n\t}; \\\n\ttest `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \\\n\t   || { echo \"ERROR: files left after uninstall:\" ; \\\n\t        if test -n \"$(DESTDIR)\"; then \\\n\t          echo \"  (check DESTDIR support)\"; \\\n\t        fi ; \\\n\t        $(distuninstallcheck_listfiles) ; \\\n\t        exit 1; } >&2\ndistcleancheck: distclean\n\t@if test '$(srcdir)' = . ; then \\\n\t  echo \"ERROR: distcleancheck can only run from a VPATH build\" ; \\\n\t  exit 1 ; \\\n\tfi\n\t@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \\\n\t  || { echo \"ERROR: files left in build directory after distclean:\" ; \\\n\t       $(distcleancheck_listfiles) ; \\\n\t       exit 1; } >&2\ncheck-am: all-am\n\t$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)\n\t$(MAKE) $(AM_MAKEFLAGS) check-TESTS\ncheck: check-am\nall-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(libdir)\" \"$(DESTDIR)$(m4datadir)\" \"$(DESTDIR)$(pkgincludedir)\" \"$(DESTDIR)$(pkginclude_internaldir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\tif test -z '$(STRIP)'; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t    install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t      install; \\\n\telse \\\n\t  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t    install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t    \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\" install; \\\n\tfi\nmostlyclean-generic:\n\nclean-generic:\n\t-test -z \"$(CLEANFILES)\" || rm -f $(CLEANFILES)\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\t-rm -f fused-src/gtest/$(DEPDIR)/$(am__dirstamp)\n\t-rm -f fused-src/gtest/$(am__dirstamp)\n\t-rm -f lib/$(am__dirstamp)\n\t-rm -f samples/$(DEPDIR)/$(am__dirstamp)\n\t-rm -f samples/$(am__dirstamp)\n\t-rm -f src/$(DEPDIR)/$(am__dirstamp)\n\t-rm -f src/$(am__dirstamp)\n\t-rm -f test/$(DEPDIR)/$(am__dirstamp)\n\t-rm -f test/$(am__dirstamp)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\n@HAVE_PYTHON_FALSE@maintainer-clean-local:\nclean: clean-am\n\nclean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \\\n\tclean-libtool clean-noinstLTLIBRARIES mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f $(am__CONFIG_DISTCLEAN_FILES)\n\t-rm -rf fused-src/gtest/$(DEPDIR) samples/$(DEPDIR) src/$(DEPDIR) test/$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-hdr distclean-libtool distclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-data-local install-m4dataDATA \\\n\tinstall-pkgincludeHEADERS install-pkginclude_internalHEADERS\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am: install-exec-local install-libLTLIBRARIES\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f $(am__CONFIG_DISTCLEAN_FILES)\n\t-rm -rf $(top_srcdir)/autom4te.cache\n\t-rm -rf fused-src/gtest/$(DEPDIR) samples/$(DEPDIR) src/$(DEPDIR) test/$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic \\\n\tmaintainer-clean-local\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-libLTLIBRARIES uninstall-m4dataDATA \\\n\tuninstall-pkgincludeHEADERS \\\n\tuninstall-pkginclude_internalHEADERS\n\n.MAKE: check-am install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \\\n\tclean clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \\\n\tclean-libtool clean-noinstLTLIBRARIES ctags dist dist-all \\\n\tdist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ \\\n\tdist-xz dist-zip distcheck distclean distclean-compile \\\n\tdistclean-generic distclean-hdr distclean-libtool \\\n\tdistclean-tags distcleancheck distdir distuninstallcheck dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-data-local install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-exec-local \\\n\tinstall-html install-html-am install-info install-info-am \\\n\tinstall-libLTLIBRARIES install-m4dataDATA install-man \\\n\tinstall-pdf install-pdf-am install-pkgincludeHEADERS \\\n\tinstall-pkginclude_internalHEADERS install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic \\\n\tmaintainer-clean-local mostlyclean mostlyclean-compile \\\n\tmostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \\\n\ttags uninstall uninstall-am uninstall-libLTLIBRARIES \\\n\tuninstall-m4dataDATA uninstall-pkgincludeHEADERS \\\n\tuninstall-pkginclude_internalHEADERS\n\n\n# Build rules for putting fused Google Test files into the distribution\n# package. The user can also create those files by manually running\n# scripts/fuse_gtest_files.py.\n@HAVE_PYTHON_TRUE@$(test_fused_gtest_test_SOURCES): fused-gtest\n\n@HAVE_PYTHON_TRUE@fused-gtest: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \\\n@HAVE_PYTHON_TRUE@             $(GTEST_SRC) src/gtest-all.cc src/gtest_main.cc \\\n@HAVE_PYTHON_TRUE@             scripts/fuse_gtest_files.py\n@HAVE_PYTHON_TRUE@\tmkdir -p \"$(srcdir)/fused-src\"\n@HAVE_PYTHON_TRUE@\tchmod -R u+w \"$(srcdir)/fused-src\"\n@HAVE_PYTHON_TRUE@\trm -f \"$(srcdir)/fused-src/gtest/gtest-all.cc\"\n@HAVE_PYTHON_TRUE@\trm -f \"$(srcdir)/fused-src/gtest/gtest.h\"\n@HAVE_PYTHON_TRUE@\t\"$(srcdir)/scripts/fuse_gtest_files.py\" \"$(srcdir)/fused-src\"\n@HAVE_PYTHON_TRUE@\tcp -f \"$(srcdir)/src/gtest_main.cc\" \"$(srcdir)/fused-src/gtest/\"\n\n@HAVE_PYTHON_TRUE@maintainer-clean-local:\n@HAVE_PYTHON_TRUE@\trm -rf \"$(srcdir)/fused-src\"\n\n# Disables 'make install' as installing a compiled version of Google\n# Test can lead to undefined behavior due to violation of the\n# One-Definition Rule.\n\ninstall-exec-local:\n\techo \"'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system.\"\n\tfalse\n\ninstall-data-local:\n\techo \"'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system.\"\n\tfalse\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "Tests/gtest/README",
    "content": "Google C++ Testing Framework\n============================\n\nhttp://code.google.com/p/googletest/\n\nOverview\n--------\n\nGoogle's framework for writing C++ tests on a variety of platforms\n(Linux, Mac OS X, Windows, Windows CE, Symbian, etc).  Based on the\nxUnit architecture.  Supports automatic test discovery, a rich set of\nassertions, user-defined assertions, death tests, fatal and non-fatal\nfailures, various options for running the tests, and XML test report\ngeneration.\n\nPlease see the project page above for more information as well as the\nmailing list for questions, discussions, and development.  There is\nalso an IRC channel on OFTC (irc.oftc.net) #gtest available.  Please\njoin us!\n\nRequirements for End Users\n--------------------------\n\nGoogle Test is designed to have fairly minimal requirements to build\nand use with your projects, but there are some.  Currently, we support\nLinux, Windows, Mac OS X, and Cygwin.  We will also make our best\neffort to support other platforms (e.g. Solaris, AIX, and z/OS).\nHowever, since core members of the Google Test project have no access\nto these platforms, Google Test may have outstanding issues there.  If\nyou notice any problems on your platform, please notify\ngoogletestframework@googlegroups.com.  Patches for fixing them are\neven more welcome!\n\n### Linux Requirements ###\n\nThese are the base requirements to build and use Google Test from a source\npackage (as described below):\n  * GNU-compatible Make or gmake\n  * POSIX-standard shell\n  * POSIX(-2) Regular Expressions (regex.h)\n  * A C++98-standard-compliant compiler\n\n### Windows Requirements ###\n\n  * Microsoft Visual C++ 7.1 or newer\n\n### Cygwin Requirements ###\n\n  * Cygwin 1.5.25-14 or newer\n\n### Mac OS X Requirements ###\n\n  * Mac OS X 10.4 Tiger or newer\n  * Developer Tools Installed\n\nAlso, you'll need CMake 2.6.4 or higher if you want to build the\nsamples using the provided CMake script, regardless of the platform.\n\nRequirements for Contributors\n-----------------------------\n\nWe welcome patches.  If you plan to contribute a patch, you need to\nbuild Google Test and its own tests from an SVN checkout (described\nbelow), which has further requirements:\n\n  * Python version 2.3 or newer (for running some of the tests and\n    re-generating certain source files from templates)\n  * CMake 2.6.4 or newer\n\nGetting the Source\n------------------\n\nThere are two primary ways of getting Google Test's source code: you\ncan download a stable source release in your preferred archive format,\nor directly check out the source from our Subversion (SVN) repositary.\nThe SVN checkout requires a few extra steps and some extra software\npackages on your system, but lets you track the latest development and\nmake patches much more easily, so we highly encourage it.\n\n### Source Package ###\n\nGoogle Test is released in versioned source packages which can be\ndownloaded from the download page [1].  Several different archive\nformats are provided, but the only difference is the tools used to\nmanipulate them, and the size of the resulting file.  Download\nwhichever you are most comfortable with.\n\n  [1] http://code.google.com/p/googletest/downloads/list\n\nOnce the package is downloaded, expand it using whichever tools you\nprefer for that type.  This will result in a new directory with the\nname \"gtest-X.Y.Z\" which contains all of the source code.  Here are\nsome examples on Linux:\n\n  tar -xvzf gtest-X.Y.Z.tar.gz\n  tar -xvjf gtest-X.Y.Z.tar.bz2\n  unzip gtest-X.Y.Z.zip\n\n### SVN Checkout ###\n\nTo check out the main branch (also known as the \"trunk\") of Google\nTest, run the following Subversion command:\n\n  svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn\n\nSetting up the Build\n--------------------\n\nTo build Google Test and your tests that use it, you need to tell your\nbuild system where to find its headers and source files.  The exact\nway to do it depends on which build system you use, and is usually\nstraightforward.\n\n### Generic Build Instructions ###\n\nSuppose you put Google Test in directory ${GTEST_DIR}.  To build it,\ncreate a library build target (or a project as called by Visual Studio\nand Xcode) to compile\n\n  ${GTEST_DIR}/src/gtest-all.cc\n\nwith ${GTEST_DIR}/include in the system header search path and ${GTEST_DIR}\nin the normal header search path.  Assuming a Linux-like system and gcc,\nsomething like the following will do:\n\n  g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \\\n      -pthread -c ${GTEST_DIR}/src/gtest-all.cc\n  ar -rv libgtest.a gtest-all.o\n\n(We need -pthread as Google Test uses threads.)\n\nNext, you should compile your test source file with\n${GTEST_DIR}/include in the system header search path, and link it\nwith gtest and any other necessary libraries:\n\n  g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \\\n      -o your_test\n\nAs an example, the make/ directory contains a Makefile that you can\nuse to build Google Test on systems where GNU make is available\n(e.g. Linux, Mac OS X, and Cygwin).  It doesn't try to build Google\nTest's own tests.  Instead, it just builds the Google Test library and\na sample test.  You can use it as a starting point for your own build\nscript.\n\nIf the default settings are correct for your environment, the\nfollowing commands should succeed:\n\n  cd ${GTEST_DIR}/make\n  make\n  ./sample1_unittest\n\nIf you see errors, try to tweak the contents of make/Makefile to make\nthem go away.  There are instructions in make/Makefile on how to do\nit.\n\n### Using CMake ###\n\nGoogle Test comes with a CMake build script (CMakeLists.txt) that can\nbe used on a wide range of platforms (\"C\" stands for cross-platofrm.).\nIf you don't have CMake installed already, you can download it for\nfree from http://www.cmake.org/.\n\nCMake works by generating native makefiles or build projects that can\nbe used in the compiler environment of your choice.  The typical\nworkflow starts with:\n\n  mkdir mybuild       # Create a directory to hold the build output.\n  cd mybuild\n  cmake ${GTEST_DIR}  # Generate native build scripts.\n\nIf you want to build Google Test's samples, you should replace the\nlast command with\n\n  cmake -Dgtest_build_samples=ON ${GTEST_DIR}\n\nIf you are on a *nix system, you should now see a Makefile in the\ncurrent directory.  Just type 'make' to build gtest.\n\nIf you use Windows and have Vistual Studio installed, a gtest.sln file\nand several .vcproj files will be created.  You can then build them\nusing Visual Studio.\n\nOn Mac OS X with Xcode installed, a .xcodeproj file will be generated.\n\n### Legacy Build Scripts ###\n\nBefore settling on CMake, we have been providing hand-maintained build\nprojects/scripts for Visual Studio, Xcode, and Autotools.  While we\ncontinue to provide them for convenience, they are not actively\nmaintained any more.  We highly recommend that you follow the\ninstructions in the previous two sections to integrate Google Test\nwith your existing build system.\n\nIf you still need to use the legacy build scripts, here's how:\n\nThe msvc\\ folder contains two solutions with Visual C++ projects.\nOpen the gtest.sln or gtest-md.sln file using Visual Studio, and you\nare ready to build Google Test the same way you build any Visual\nStudio project.  Files that have names ending with -md use DLL\nversions of Microsoft runtime libraries (the /MD or the /MDd compiler\noption).  Files without that suffix use static versions of the runtime\nlibraries (the /MT or the /MTd option).  Please note that one must use\nthe same option to compile both gtest and the test code.  If you use\nVisual Studio 2005 or above, we recommend the -md version as /MD is\nthe default for new projects in these versions of Visual Studio.\n\nOn Mac OS X, open the gtest.xcodeproj in the xcode/ folder using\nXcode.  Build the \"gtest\" target.  The universal binary framework will\nend up in your selected build directory (selected in the Xcode\n\"Preferences...\" -> \"Building\" pane and defaults to xcode/build).\nAlternatively, at the command line, enter:\n\n  xcodebuild\n\nThis will build the \"Release\" configuration of gtest.framework in your\ndefault build location.  See the \"xcodebuild\" man page for more\ninformation about building different configurations and building in\ndifferent locations.\n\nIf you wish to use the Google Test Xcode project with Xcode 4.x and\nabove, you need to either:\n * update the SDK configuration options in xcode/Config/General.xconfig.\n   Comment options SDKROOT, MACOS_DEPLOYMENT_TARGET, and GCC_VERSION. If\n   you choose this route you lose the ability to target earlier versions\n   of MacOS X.\n * Install an SDK for an earlier version. This doesn't appear to be\n   supported by Apple, but has been reported to work\n   (http://stackoverflow.com/questions/5378518).\n\nTweaking Google Test\n--------------------\n\nGoogle Test can be used in diverse environments.  The default\nconfiguration may not work (or may not work well) out of the box in\nsome environments.  However, you can easily tweak Google Test by\ndefining control macros on the compiler command line.  Generally,\nthese macros are named like GTEST_XYZ and you define them to either 1\nor 0 to enable or disable a certain feature.\n\nWe list the most frequently used macros below.  For a complete list,\nsee file include/gtest/internal/gtest-port.h.\n\n### Choosing a TR1 Tuple Library ###\n\nSome Google Test features require the C++ Technical Report 1 (TR1)\ntuple library, which is not yet available with all compilers.  The\ngood news is that Google Test implements a subset of TR1 tuple that's\nenough for its own need, and will automatically use this when the\ncompiler doesn't provide TR1 tuple.\n\nUsually you don't need to care about which tuple library Google Test\nuses.  However, if your project already uses TR1 tuple, you need to\ntell Google Test to use the same TR1 tuple library the rest of your\nproject uses, or the two tuple implementations will clash.  To do\nthat, add\n\n  -DGTEST_USE_OWN_TR1_TUPLE=0\n\nto the compiler flags while compiling Google Test and your tests.  If\nyou want to force Google Test to use its own tuple library, just add\n\n  -DGTEST_USE_OWN_TR1_TUPLE=1\n\nto the compiler flags instead.\n\nIf you don't want Google Test to use tuple at all, add\n\n  -DGTEST_HAS_TR1_TUPLE=0\n\nand all features using tuple will be disabled.\n\n### Multi-threaded Tests ###\n\nGoogle Test is thread-safe where the pthread library is available.\nAfter #include \"gtest/gtest.h\", you can check the GTEST_IS_THREADSAFE\nmacro to see whether this is the case (yes if the macro is #defined to\n1, no if it's undefined.).\n\nIf Google Test doesn't correctly detect whether pthread is available\nin your environment, you can force it with\n\n  -DGTEST_HAS_PTHREAD=1\n\nor\n\n  -DGTEST_HAS_PTHREAD=0\n\nWhen Google Test uses pthread, you may need to add flags to your\ncompiler and/or linker to select the pthread library, or you'll get\nlink errors.  If you use the CMake script or the deprecated Autotools\nscript, this is taken care of for you.  If you use your own build\nscript, you'll need to read your compiler and linker's manual to\nfigure out what flags to add.\n\n### As a Shared Library (DLL) ###\n\nGoogle Test is compact, so most users can build and link it as a\nstatic library for the simplicity.  You can choose to use Google Test\nas a shared library (known as a DLL on Windows) if you prefer.\n\nTo compile *gtest* as a shared library, add\n\n  -DGTEST_CREATE_SHARED_LIBRARY=1\n\nto the compiler flags.  You'll also need to tell the linker to produce\na shared library instead - consult your linker's manual for how to do\nit.\n\nTo compile your *tests* that use the gtest shared library, add\n\n  -DGTEST_LINKED_AS_SHARED_LIBRARY=1\n\nto the compiler flags.\n\nNote: while the above steps aren't technically necessary today when\nusing some compilers (e.g. GCC), they may become necessary in the\nfuture, if we decide to improve the speed of loading the library (see\nhttp://gcc.gnu.org/wiki/Visibility for details).  Therefore you are\nrecommended to always add the above flags when using Google Test as a\nshared library.  Otherwise a future release of Google Test may break\nyour build script.\n\n### Avoiding Macro Name Clashes ###\n\nIn C++, macros don't obey namespaces.  Therefore two libraries that\nboth define a macro of the same name will clash if you #include both\ndefinitions.  In case a Google Test macro clashes with another\nlibrary, you can force Google Test to rename its macro to avoid the\nconflict.\n\nSpecifically, if both Google Test and some other code define macro\nFOO, you can add\n\n  -DGTEST_DONT_DEFINE_FOO=1\n\nto the compiler flags to tell Google Test to change the macro's name\nfrom FOO to GTEST_FOO.  Currently FOO can be FAIL, SUCCEED, or TEST.\nFor example, with -DGTEST_DONT_DEFINE_TEST=1, you'll need to write\n\n  GTEST_TEST(SomeTest, DoesThis) { ... }\n\ninstead of\n\n  TEST(SomeTest, DoesThis) { ... }\n\nin order to define a test.\n\nUpgrating from an Earlier Version\n---------------------------------\n\nWe strive to keep Google Test releases backward compatible.\nSometimes, though, we have to make some breaking changes for the\nusers' long-term benefits.  This section describes what you'll need to\ndo if you are upgrading from an earlier version of Google Test.\n\n### Upgrading from 1.3.0 or Earlier ###\n\nYou may need to explicitly enable or disable Google Test's own TR1\ntuple library.  See the instructions in section \"Choosing a TR1 Tuple\nLibrary\".\n\n### Upgrading from 1.4.0 or Earlier ###\n\nThe Autotools build script (configure + make) is no longer officially\nsupportted.  You are encouraged to migrate to your own build system or\nuse CMake.  If you still need to use Autotools, you can find\ninstructions in the README file from Google Test 1.4.0.\n\nOn platforms where the pthread library is available, Google Test uses\nit in order to be thread-safe.  See the \"Multi-threaded Tests\" section\nfor what this means to your build script.\n\nIf you use Microsoft Visual C++ 7.1 with exceptions disabled, Google\nTest will no longer compile.  This should affect very few people, as a\nlarge portion of STL (including <string>) doesn't compile in this mode\nanyway.  We decided to stop supporting it in order to greatly simplify\nGoogle Test's implementation.\n\nDeveloping Google Test\n----------------------\n\nThis section discusses how to make your own changes to Google Test.\n\n### Testing Google Test Itself ###\n\nTo make sure your changes work as intended and don't break existing\nfunctionality, you'll want to compile and run Google Test's own tests.\nFor that you can use CMake:\n\n  mkdir mybuild\n  cd mybuild\n  cmake -Dgtest_build_tests=ON ${GTEST_DIR}\n\nMake sure you have Python installed, as some of Google Test's tests\nare written in Python.  If the cmake command complains about not being\nable to find Python (\"Could NOT find PythonInterp (missing:\nPYTHON_EXECUTABLE)\"), try telling it explicitly where your Python\nexecutable can be found:\n\n  cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}\n\nNext, you can build Google Test and all of its own tests.  On *nix,\nthis is usually done by 'make'.  To run the tests, do\n\n  make test\n\nAll tests should pass.\n\n### Regenerating Source Files ###\n\nSome of Google Test's source files are generated from templates (not\nin the C++ sense) using a script.  A template file is named FOO.pump,\nwhere FOO is the name of the file it will generate.  For example, the\nfile include/gtest/internal/gtest-type-util.h.pump is used to generate\ngtest-type-util.h in the same directory.\n\nNormally you don't need to worry about regenerating the source files,\nunless you need to modify them.  In that case, you should modify the\ncorresponding .pump files instead and run the pump.py Python script to\nregenerate them.  You can find pump.py in the scripts/ directory.\nRead the Pump manual [2] for how to use it.\n\n  [2] http://code.google.com/p/googletest/wiki/PumpManual\n\n### Contributing a Patch ###\n\nWe welcome patches.  Please read the Google Test developer's guide [3]\nfor how you can contribute.  In particular, make sure you have signed\nthe Contributor License Agreement, or we won't be able to accept the\npatch.\n\n  [3] http://code.google.com/p/googletest/wiki/GoogleTestDevGuide\n\nHappy testing!\n"
  },
  {
    "path": "Tests/gtest/aclocal.m4",
    "content": "# generated automatically by aclocal 1.11.3 -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,\n# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,\n# Inc.\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\nm4_ifndef([AC_AUTOCONF_VERSION],\n  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl\nm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,\n[m4_warning([this file was generated for autoconf 2.68.\nYou have another version of autoconf.  It may work, but is not guaranteed to.\nIf you have problems, you may need to regenerate the build system entirely.\nTo do so, use the procedure documented by the package, typically `autoreconf'.])])\n\n# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software\n# Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# AM_AUTOMAKE_VERSION(VERSION)\n# ----------------------------\n# Automake X.Y traces this macro to ensure aclocal.m4 has been\n# generated from the m4 files accompanying Automake X.Y.\n# (This private macro should not be called outside this file.)\nAC_DEFUN([AM_AUTOMAKE_VERSION],\n[am__api_version='1.11'\ndnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to\ndnl require some minimum version.  Point them to the right macro.\nm4_if([$1], [1.11.3], [],\n      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl\n])\n\n# _AM_AUTOCONF_VERSION(VERSION)\n# -----------------------------\n# aclocal traces this macro to find the Autoconf version.\n# This is a private macro too.  Using m4_define simplifies\n# the logic in aclocal, which can simply ignore this definition.\nm4_define([_AM_AUTOCONF_VERSION], [])\n\n# AM_SET_CURRENT_AUTOMAKE_VERSION\n# -------------------------------\n# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.\n# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.\nAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],\n[AM_AUTOMAKE_VERSION([1.11.3])dnl\nm4_ifndef([AC_AUTOCONF_VERSION],\n  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl\n_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])\n\n# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-\n\n# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets\n# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to\n# `$srcdir', `$srcdir/..', or `$srcdir/../..'.\n#\n# Of course, Automake must honor this variable whenever it calls a\n# tool from the auxiliary directory.  The problem is that $srcdir (and\n# therefore $ac_aux_dir as well) can be either absolute or relative,\n# depending on how configure is run.  This is pretty annoying, since\n# it makes $ac_aux_dir quite unusable in subdirectories: in the top\n# source directory, any form will work fine, but in subdirectories a\n# relative path needs to be adjusted first.\n#\n# $ac_aux_dir/missing\n#    fails when called from a subdirectory if $ac_aux_dir is relative\n# $top_srcdir/$ac_aux_dir/missing\n#    fails if $ac_aux_dir is absolute,\n#    fails when called from a subdirectory in a VPATH build with\n#          a relative $ac_aux_dir\n#\n# The reason of the latter failure is that $top_srcdir and $ac_aux_dir\n# are both prefixed by $srcdir.  In an in-source build this is usually\n# harmless because $srcdir is `.', but things will broke when you\n# start a VPATH build or use an absolute $srcdir.\n#\n# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,\n# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:\n#   am_aux_dir='\\$(top_srcdir)/'`expr \"$ac_aux_dir\" : \"$srcdir//*\\(.*\\)\"`\n# and then we would define $MISSING as\n#   MISSING=\"\\${SHELL} $am_aux_dir/missing\"\n# This will work as long as MISSING is not called from configure, because\n# unfortunately $(top_srcdir) has no meaning in configure.\n# However there are other variables, like CC, which are often used in\n# configure, and could therefore not use this \"fixed\" $ac_aux_dir.\n#\n# Another solution, used here, is to always expand $ac_aux_dir to an\n# absolute PATH.  The drawback is that using absolute paths prevent a\n# configured tree to be moved without reconfiguration.\n\nAC_DEFUN([AM_AUX_DIR_EXPAND],\n[dnl Rely on autoconf to set up CDPATH properly.\nAC_PREREQ([2.50])dnl\n# expand $ac_aux_dir to an absolute path\nam_aux_dir=`cd $ac_aux_dir && pwd`\n])\n\n# AM_CONDITIONAL                                            -*- Autoconf -*-\n\n# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 9\n\n# AM_CONDITIONAL(NAME, SHELL-CONDITION)\n# -------------------------------------\n# Define a conditional.\nAC_DEFUN([AM_CONDITIONAL],\n[AC_PREREQ(2.52)dnl\n ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],\n\t[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl\nAC_SUBST([$1_TRUE])dnl\nAC_SUBST([$1_FALSE])dnl\n_AM_SUBST_NOTMAKE([$1_TRUE])dnl\n_AM_SUBST_NOTMAKE([$1_FALSE])dnl\nm4_define([_AM_COND_VALUE_$1], [$2])dnl\nif $2; then\n  $1_TRUE=\n  $1_FALSE='#'\nelse\n  $1_TRUE='#'\n  $1_FALSE=\nfi\nAC_CONFIG_COMMANDS_PRE(\n[if test -z \"${$1_TRUE}\" && test -z \"${$1_FALSE}\"; then\n  AC_MSG_ERROR([[conditional \"$1\" was never defined.\nUsually this means the macro was only invoked conditionally.]])\nfi])])\n\n# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,\n# 2010, 2011 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 12\n\n# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be\n# written in clear, in which case automake, when reading aclocal.m4,\n# will think it sees a *use*, and therefore will trigger all it's\n# C support machinery.  Also note that it means that autoscan, seeing\n# CC etc. in the Makefile, will ask for an AC_PROG_CC use...\n\n\n# _AM_DEPENDENCIES(NAME)\n# ----------------------\n# See how the compiler implements dependency checking.\n# NAME is \"CC\", \"CXX\", \"GCJ\", or \"OBJC\".\n# We try a few techniques and use that to set a single cache variable.\n#\n# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was\n# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular\n# dependency, and given that the user is not expected to run this macro,\n# just rely on AC_PROG_CC.\nAC_DEFUN([_AM_DEPENDENCIES],\n[AC_REQUIRE([AM_SET_DEPDIR])dnl\nAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl\nAC_REQUIRE([AM_MAKE_INCLUDE])dnl\nAC_REQUIRE([AM_DEP_TRACK])dnl\n\nifelse([$1], CC,   [depcc=\"$CC\"   am_compiler_list=],\n       [$1], CXX,  [depcc=\"$CXX\"  am_compiler_list=],\n       [$1], OBJC, [depcc=\"$OBJC\" am_compiler_list='gcc3 gcc'],\n       [$1], UPC,  [depcc=\"$UPC\"  am_compiler_list=],\n       [$1], GCJ,  [depcc=\"$GCJ\"  am_compiler_list='gcc3 gcc'],\n                   [depcc=\"$$1\"   am_compiler_list=])\n\nAC_CACHE_CHECK([dependency style of $depcc],\n               [am_cv_$1_dependencies_compiler_type],\n[if test -z \"$AMDEP_TRUE\" && test -f \"$am_depcomp\"; then\n  # We make a subdir and do the tests there.  Otherwise we can end up\n  # making bogus files that we don't know about and never remove.  For\n  # instance it was reported that on HP-UX the gcc test will end up\n  # making a dummy file named `D' -- because `-MD' means `put the output\n  # in D'.\n  rm -rf conftest.dir\n  mkdir conftest.dir\n  # Copy depcomp to subdir because otherwise we won't find it if we're\n  # using a relative directory.\n  cp \"$am_depcomp\" conftest.dir\n  cd conftest.dir\n  # We will build objects and dependencies in a subdirectory because\n  # it helps to detect inapplicable dependency modes.  For instance\n  # both Tru64's cc and ICC support -MD to output dependencies as a\n  # side effect of compilation, but ICC will put the dependencies in\n  # the current directory while Tru64 will put them in the object\n  # directory.\n  mkdir sub\n\n  am_cv_$1_dependencies_compiler_type=none\n  if test \"$am_compiler_list\" = \"\"; then\n     am_compiler_list=`sed -n ['s/^#*\\([a-zA-Z0-9]*\\))$/\\1/p'] < ./depcomp`\n  fi\n  am__universal=false\n  m4_case([$1], [CC],\n    [case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac],\n    [CXX],\n    [case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac])\n\n  for depmode in $am_compiler_list; do\n    # Setup a source with many dependencies, because some compilers\n    # like to wrap large dependency lists on column 80 (with \\), and\n    # we should not choose a depcomp mode which is confused by this.\n    #\n    # We need to recreate these files for each test, as the compiler may\n    # overwrite some of them when testing with obscure command lines.\n    # This happens at least with the AIX C compiler.\n    : > sub/conftest.c\n    for i in 1 2 3 4 5 6; do\n      echo '#include \"conftst'$i'.h\"' >> sub/conftest.c\n      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with\n      # Solaris 8's {/usr,}/bin/sh.\n      touch sub/conftst$i.h\n    done\n    echo \"${am__include} ${am__quote}sub/conftest.Po${am__quote}\" > confmf\n\n    # We check with `-c' and `-o' for the sake of the \"dashmstdout\"\n    # mode.  It turns out that the SunPro C++ compiler does not properly\n    # handle `-M -o', and we need to detect this.  Also, some Intel\n    # versions had trouble with output in subdirs\n    am__obj=sub/conftest.${OBJEXT-o}\n    am__minus_obj=\"-o $am__obj\"\n    case $depmode in\n    gcc)\n      # This depmode causes a compiler race in universal mode.\n      test \"$am__universal\" = false || continue\n      ;;\n    nosideeffect)\n      # after this tag, mechanisms are not by side-effect, so they'll\n      # only be used when explicitly requested\n      if test \"x$enable_dependency_tracking\" = xyes; then\n\tcontinue\n      else\n\tbreak\n      fi\n      ;;\n    msvc7 | msvc7msys | msvisualcpp | msvcmsys)\n      # This compiler won't grok `-c -o', but also, the minuso test has\n      # not run yet.  These depmodes are late enough in the game, and\n      # so weak that their functioning should not be impacted.\n      am__obj=conftest.${OBJEXT-o}\n      am__minus_obj=\n      ;;\n    none) break ;;\n    esac\n    if depmode=$depmode \\\n       source=sub/conftest.c object=$am__obj \\\n       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \\\n       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \\\n         >/dev/null 2>conftest.err &&\n       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&\n       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then\n      # icc doesn't choke on unknown options, it will just issue warnings\n      # or remarks (even with -Werror).  So we grep stderr for any message\n      # that says an option was ignored or not supported.\n      # When given -MP, icc 7.0 and 7.1 complain thusly:\n      #   icc: Command line warning: ignoring option '-M'; no argument required\n      # The diagnosis changed in icc 8.0:\n      #   icc: Command line remark: option '-MP' not supported\n      if (grep 'ignoring option' conftest.err ||\n          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else\n        am_cv_$1_dependencies_compiler_type=$depmode\n        break\n      fi\n    fi\n  done\n\n  cd ..\n  rm -rf conftest.dir\nelse\n  am_cv_$1_dependencies_compiler_type=none\nfi\n])\nAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])\nAM_CONDITIONAL([am__fastdep$1], [\n  test \"x$enable_dependency_tracking\" != xno \\\n  && test \"$am_cv_$1_dependencies_compiler_type\" = gcc3])\n])\n\n\n# AM_SET_DEPDIR\n# -------------\n# Choose a directory name for dependency files.\n# This macro is AC_REQUIREd in _AM_DEPENDENCIES\nAC_DEFUN([AM_SET_DEPDIR],\n[AC_REQUIRE([AM_SET_LEADING_DOT])dnl\nAC_SUBST([DEPDIR], [\"${am__leading_dot}deps\"])dnl\n])\n\n\n# AM_DEP_TRACK\n# ------------\nAC_DEFUN([AM_DEP_TRACK],\n[AC_ARG_ENABLE(dependency-tracking,\n[  --disable-dependency-tracking  speeds up one-time build\n  --enable-dependency-tracking   do not reject slow dependency extractors])\nif test \"x$enable_dependency_tracking\" != xno; then\n  am_depcomp=\"$ac_aux_dir/depcomp\"\n  AMDEPBACKSLASH='\\'\n  am__nodep='_no'\nfi\nAM_CONDITIONAL([AMDEP], [test \"x$enable_dependency_tracking\" != xno])\nAC_SUBST([AMDEPBACKSLASH])dnl\n_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl\nAC_SUBST([am__nodep])dnl\n_AM_SUBST_NOTMAKE([am__nodep])dnl\n])\n\n# Generate code to set up dependency tracking.              -*- Autoconf -*-\n\n# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n#serial 5\n\n# _AM_OUTPUT_DEPENDENCY_COMMANDS\n# ------------------------------\nAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],\n[{\n  # Autoconf 2.62 quotes --file arguments for eval, but not when files\n  # are listed without --file.  Let's play safe and only enable the eval\n  # if we detect the quoting.\n  case $CONFIG_FILES in\n  *\\'*) eval set x \"$CONFIG_FILES\" ;;\n  *)   set x $CONFIG_FILES ;;\n  esac\n  shift\n  for mf\n  do\n    # Strip MF so we end up with the name of the file.\n    mf=`echo \"$mf\" | sed -e 's/:.*$//'`\n    # Check whether this is an Automake generated Makefile or not.\n    # We used to match only the files named `Makefile.in', but\n    # some people rename them; so instead we look at the file content.\n    # Grep'ing the first line is not enough: some people post-process\n    # each Makefile.in and add a new line on top of each file to say so.\n    # Grep'ing the whole file is not good either: AIX grep has a line\n    # limit of 2048, but all sed's we know have understand at least 4000.\n    if sed -n 's,^#.*generated by automake.*,X,p' \"$mf\" | grep X >/dev/null 2>&1; then\n      dirpart=`AS_DIRNAME(\"$mf\")`\n    else\n      continue\n    fi\n    # Extract the definition of DEPDIR, am__include, and am__quote\n    # from the Makefile without running `make'.\n    DEPDIR=`sed -n 's/^DEPDIR = //p' < \"$mf\"`\n    test -z \"$DEPDIR\" && continue\n    am__include=`sed -n 's/^am__include = //p' < \"$mf\"`\n    test -z \"am__include\" && continue\n    am__quote=`sed -n 's/^am__quote = //p' < \"$mf\"`\n    # When using ansi2knr, U may be empty or an underscore; expand it\n    U=`sed -n 's/^U = //p' < \"$mf\"`\n    # Find all dependency output files, they are included files with\n    # $(DEPDIR) in their names.  We invoke sed twice because it is the\n    # simplest approach to changing $(DEPDIR) to its actual value in the\n    # expansion.\n    for file in `sed -n \"\n      s/^$am__include $am__quote\\(.*(DEPDIR).*\\)$am__quote\"'$/\\1/p' <\"$mf\" | \\\n\t sed -e 's/\\$(DEPDIR)/'\"$DEPDIR\"'/g' -e 's/\\$U/'\"$U\"'/g'`; do\n      # Make sure the directory exists.\n      test -f \"$dirpart/$file\" && continue\n      fdir=`AS_DIRNAME([\"$file\"])`\n      AS_MKDIR_P([$dirpart/$fdir])\n      # echo \"creating $dirpart/$file\"\n      echo '# dummy' > \"$dirpart/$file\"\n    done\n  done\n}\n])# _AM_OUTPUT_DEPENDENCY_COMMANDS\n\n\n# AM_OUTPUT_DEPENDENCY_COMMANDS\n# -----------------------------\n# This macro should only be invoked once -- use via AC_REQUIRE.\n#\n# This code is only required when automatic dependency tracking\n# is enabled.  FIXME.  This creates each `.P' file that we will\n# need in order to bootstrap the dependency handling code.\nAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],\n[AC_CONFIG_COMMANDS([depfiles],\n     [test x\"$AMDEP_TRUE\" != x\"\" || _AM_OUTPUT_DEPENDENCY_COMMANDS],\n     [AMDEP_TRUE=\"$AMDEP_TRUE\" ac_aux_dir=\"$ac_aux_dir\"])\n])\n\n# Do all the work for Automake.                             -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,\n# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 16\n\n# This macro actually does too much.  Some checks are only needed if\n# your package does certain things.  But this isn't really a big deal.\n\n# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])\n# AM_INIT_AUTOMAKE([OPTIONS])\n# -----------------------------------------------\n# The call with PACKAGE and VERSION arguments is the old style\n# call (pre autoconf-2.50), which is being phased out.  PACKAGE\n# and VERSION should now be passed to AC_INIT and removed from\n# the call to AM_INIT_AUTOMAKE.\n# We support both call styles for the transition.  After\n# the next Automake release, Autoconf can make the AC_INIT\n# arguments mandatory, and then we can depend on a new Autoconf\n# release and drop the old call support.\nAC_DEFUN([AM_INIT_AUTOMAKE],\n[AC_PREREQ([2.62])dnl\ndnl Autoconf wants to disallow AM_ names.  We explicitly allow\ndnl the ones we care about.\nm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl\nAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl\nAC_REQUIRE([AC_PROG_INSTALL])dnl\nif test \"`cd $srcdir && pwd`\" != \"`pwd`\"; then\n  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output\n  # is not polluted with repeated \"-I.\"\n  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl\n  # test to see if srcdir already configured\n  if test -f $srcdir/config.status; then\n    AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])\n  fi\nfi\n\n# test whether we have cygpath\nif test -z \"$CYGPATH_W\"; then\n  if (cygpath --version) >/dev/null 2>/dev/null; then\n    CYGPATH_W='cygpath -w'\n  else\n    CYGPATH_W=echo\n  fi\nfi\nAC_SUBST([CYGPATH_W])\n\n# Define the identity of the package.\ndnl Distinguish between old-style and new-style calls.\nm4_ifval([$2],\n[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl\n AC_SUBST([PACKAGE], [$1])dnl\n AC_SUBST([VERSION], [$2])],\n[_AM_SET_OPTIONS([$1])dnl\ndnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.\nm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,\n  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl\n AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl\n AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl\n\n_AM_IF_OPTION([no-define],,\n[AC_DEFINE_UNQUOTED(PACKAGE, \"$PACKAGE\", [Name of package])\n AC_DEFINE_UNQUOTED(VERSION, \"$VERSION\", [Version number of package])])dnl\n\n# Some tools Automake needs.\nAC_REQUIRE([AM_SANITY_CHECK])dnl\nAC_REQUIRE([AC_ARG_PROGRAM])dnl\nAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})\nAM_MISSING_PROG(AUTOCONF, autoconf)\nAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})\nAM_MISSING_PROG(AUTOHEADER, autoheader)\nAM_MISSING_PROG(MAKEINFO, makeinfo)\nAC_REQUIRE([AM_PROG_INSTALL_SH])dnl\nAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl\nAC_REQUIRE([AM_PROG_MKDIR_P])dnl\n# We need awk for the \"check\" target.  The system \"awk\" is bad on\n# some platforms.\nAC_REQUIRE([AC_PROG_AWK])dnl\nAC_REQUIRE([AC_PROG_MAKE_SET])dnl\nAC_REQUIRE([AM_SET_LEADING_DOT])dnl\n_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],\n\t      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],\n\t\t\t     [_AM_PROG_TAR([v7])])])\n_AM_IF_OPTION([no-dependencies],,\n[AC_PROVIDE_IFELSE([AC_PROG_CC],\n\t\t  [_AM_DEPENDENCIES(CC)],\n\t\t  [define([AC_PROG_CC],\n\t\t\t  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl\nAC_PROVIDE_IFELSE([AC_PROG_CXX],\n\t\t  [_AM_DEPENDENCIES(CXX)],\n\t\t  [define([AC_PROG_CXX],\n\t\t\t  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl\nAC_PROVIDE_IFELSE([AC_PROG_OBJC],\n\t\t  [_AM_DEPENDENCIES(OBJC)],\n\t\t  [define([AC_PROG_OBJC],\n\t\t\t  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl\n])\n_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl\ndnl The `parallel-tests' driver may need to know about EXEEXT, so add the\ndnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro\ndnl is hooked onto _AC_COMPILER_EXEEXT early, see below.\nAC_CONFIG_COMMANDS_PRE(dnl\n[m4_provide_if([_AM_COMPILER_EXEEXT],\n  [AM_CONDITIONAL([am__EXEEXT], [test -n \"$EXEEXT\"])])])dnl\n])\n\ndnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not\ndnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further\ndnl mangled by Autoconf and run in a shell conditional statement.\nm4_define([_AC_COMPILER_EXEEXT],\nm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])\n\n\n# When config.status generates a header, we must update the stamp-h file.\n# This file resides in the same directory as the config header\n# that is generated.  The stamp files are numbered to have different names.\n\n# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the\n# loop where config.status creates the headers, so we can generate\n# our stamp files there.\nAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],\n[# Compute $1's index in $config_headers.\n_am_arg=$1\n_am_stamp_count=1\nfor _am_header in $config_headers :; do\n  case $_am_header in\n    $_am_arg | $_am_arg:* )\n      break ;;\n    * )\n      _am_stamp_count=`expr $_am_stamp_count + 1` ;;\n  esac\ndone\necho \"timestamp for $_am_arg\" >`AS_DIRNAME([\"$_am_arg\"])`/stamp-h[]$_am_stamp_count])\n\n# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,\n# Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# AM_PROG_INSTALL_SH\n# ------------------\n# Define $install_sh.\nAC_DEFUN([AM_PROG_INSTALL_SH],\n[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl\nif test x\"${install_sh}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    install_sh=\"\\${SHELL} '$am_aux_dir/install-sh'\" ;;\n  *)\n    install_sh=\"\\${SHELL} $am_aux_dir/install-sh\"\n  esac\nfi\nAC_SUBST(install_sh)])\n\n# Copyright (C) 2003, 2005  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 2\n\n# Check whether the underlying file-system supports filenames\n# with a leading dot.  For instance MS-DOS doesn't.\nAC_DEFUN([AM_SET_LEADING_DOT],\n[rm -rf .tst 2>/dev/null\nmkdir .tst 2>/dev/null\nif test -d .tst; then\n  am__leading_dot=.\nelse\n  am__leading_dot=_\nfi\nrmdir .tst 2>/dev/null\nAC_SUBST([am__leading_dot])])\n\n# Check to see how 'make' treats includes.\t            -*- Autoconf -*-\n\n# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 4\n\n# AM_MAKE_INCLUDE()\n# -----------------\n# Check to see how make treats includes.\nAC_DEFUN([AM_MAKE_INCLUDE],\n[am_make=${MAKE-make}\ncat > confinc << 'END'\nam__doit:\n\t@echo this is the am__doit target\n.PHONY: am__doit\nEND\n# If we don't find an include directive, just comment out the code.\nAC_MSG_CHECKING([for style of include used by $am_make])\nam__include=\"#\"\nam__quote=\n_am_result=none\n# First try GNU make style include.\necho \"include confinc\" > confmf\n# Ignore all kinds of additional output from `make'.\ncase `$am_make -s -f confmf 2> /dev/null` in #(\n*the\\ am__doit\\ target*)\n  am__include=include\n  am__quote=\n  _am_result=GNU\n  ;;\nesac\n# Now try BSD make style include.\nif test \"$am__include\" = \"#\"; then\n   echo '.include \"confinc\"' > confmf\n   case `$am_make -s -f confmf 2> /dev/null` in #(\n   *the\\ am__doit\\ target*)\n     am__include=.include\n     am__quote=\"\\\"\"\n     _am_result=BSD\n     ;;\n   esac\nfi\nAC_SUBST([am__include])\nAC_SUBST([am__quote])\nAC_MSG_RESULT([$_am_result])\nrm -f confinc confmf\n])\n\n# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-\n\n# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 6\n\n# AM_MISSING_PROG(NAME, PROGRAM)\n# ------------------------------\nAC_DEFUN([AM_MISSING_PROG],\n[AC_REQUIRE([AM_MISSING_HAS_RUN])\n$1=${$1-\"${am_missing_run}$2\"}\nAC_SUBST($1)])\n\n\n# AM_MISSING_HAS_RUN\n# ------------------\n# Define MISSING if not defined so far and test if it supports --run.\n# If it does, set am_missing_run to use it, otherwise, to nothing.\nAC_DEFUN([AM_MISSING_HAS_RUN],\n[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl\nAC_REQUIRE_AUX_FILE([missing])dnl\nif test x\"${MISSING+set}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    MISSING=\"\\${SHELL} \\\"$am_aux_dir/missing\\\"\" ;;\n  *)\n    MISSING=\"\\${SHELL} $am_aux_dir/missing\" ;;\n  esac\nfi\n# Use eval to expand $SHELL\nif eval \"$MISSING --run true\"; then\n  am_missing_run=\"$MISSING --run \"\nelse\n  am_missing_run=\n  AC_MSG_WARN([`missing' script is too old or missing])\nfi\n])\n\n# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,\n# Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# AM_PROG_MKDIR_P\n# ---------------\n# Check for `mkdir -p'.\nAC_DEFUN([AM_PROG_MKDIR_P],\n[AC_PREREQ([2.60])dnl\nAC_REQUIRE([AC_PROG_MKDIR_P])dnl\ndnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,\ndnl while keeping a definition of mkdir_p for backward compatibility.\ndnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.\ndnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of\ndnl Makefile.ins that do not define MKDIR_P, so we do our own\ndnl adjustment using top_builddir (which is defined more often than\ndnl MKDIR_P).\nAC_SUBST([mkdir_p], [\"$MKDIR_P\"])dnl\ncase $mkdir_p in\n  [[\\\\/$]]* | ?:[[\\\\/]]*) ;;\n  */*) mkdir_p=\"\\$(top_builddir)/$mkdir_p\" ;;\nesac\n])\n\n# Helper functions for option handling.                     -*- Autoconf -*-\n\n# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software\n# Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 5\n\n# _AM_MANGLE_OPTION(NAME)\n# -----------------------\nAC_DEFUN([_AM_MANGLE_OPTION],\n[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])\n\n# _AM_SET_OPTION(NAME)\n# --------------------\n# Set option NAME.  Presently that only means defining a flag for this option.\nAC_DEFUN([_AM_SET_OPTION],\n[m4_define(_AM_MANGLE_OPTION([$1]), 1)])\n\n# _AM_SET_OPTIONS(OPTIONS)\n# ------------------------\n# OPTIONS is a space-separated list of Automake options.\nAC_DEFUN([_AM_SET_OPTIONS],\n[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])\n\n# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])\n# -------------------------------------------\n# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.\nAC_DEFUN([_AM_IF_OPTION],\n[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])\n\n# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009,\n# 2011 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 2\n\n# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])\n# ---------------------------------------------------------------------------\n# Adds support for distributing Python modules and packages.  To\n# install modules, copy them to $(pythondir), using the python_PYTHON\n# automake variable.  To install a package with the same name as the\n# automake package, install to $(pkgpythondir), or use the\n# pkgpython_PYTHON automake variable.\n#\n# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as\n# locations to install python extension modules (shared libraries).\n# Another macro is required to find the appropriate flags to compile\n# extension modules.\n#\n# If your package is configured with a different prefix to python,\n# users will have to add the install directory to the PYTHONPATH\n# environment variable, or create a .pth file (see the python\n# documentation for details).\n#\n# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will\n# cause an error if the version of python installed on the system\n# doesn't meet the requirement.  MINIMUM-VERSION should consist of\n# numbers and dots only.\nAC_DEFUN([AM_PATH_PYTHON],\n [\n  dnl Find a Python interpreter.  Python versions prior to 2.0 are not\n  dnl supported. (2.0 was released on October 16, 2000).\n  m4_define_default([_AM_PYTHON_INTERPRETER_LIST],\n[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl\n python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])\n\n  AC_ARG_VAR([PYTHON], [the Python interpreter])\n\n  m4_if([$1],[],[\n    dnl No version check is needed.\n    # Find any Python interpreter.\n    if test -z \"$PYTHON\"; then\n      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)\n    fi\n    am_display_PYTHON=python\n  ], [\n    dnl A version check is needed.\n    if test -n \"$PYTHON\"; then\n      # If the user set $PYTHON, use it and don't search something else.\n      AC_MSG_CHECKING([whether $PYTHON version >= $1])\n      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],\n\t\t\t      [AC_MSG_RESULT(yes)],\n\t\t\t      [AC_MSG_ERROR(too old)])\n      am_display_PYTHON=$PYTHON\n    else\n      # Otherwise, try each interpreter until we find one that satisfies\n      # VERSION.\n      AC_CACHE_CHECK([for a Python interpreter with version >= $1],\n\t[am_cv_pathless_PYTHON],[\n\tfor am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do\n\t  test \"$am_cv_pathless_PYTHON\" = none && break\n\t  AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])\n\tdone])\n      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.\n      if test \"$am_cv_pathless_PYTHON\" = none; then\n\tPYTHON=:\n      else\n        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])\n      fi\n      am_display_PYTHON=$am_cv_pathless_PYTHON\n    fi\n  ])\n\n  if test \"$PYTHON\" = :; then\n  dnl Run any user-specified action, or abort.\n    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])\n  else\n\n  dnl Query Python for its version number.  Getting [:3] seems to be\n  dnl the best way to do this; it's what \"site.py\" does in the standard\n  dnl library.\n\n  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],\n    [am_cv_python_version=`$PYTHON -c \"import sys; sys.stdout.write(sys.version[[:3]])\"`])\n  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])\n\n  dnl Use the values of $prefix and $exec_prefix for the corresponding\n  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made\n  dnl distinct variables so they can be overridden if need be.  However,\n  dnl general consensus is that you shouldn't need this ability.\n\n  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])\n  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])\n\n  dnl At times (like when building shared libraries) you may want\n  dnl to know which OS platform Python thinks this is.\n\n  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],\n    [am_cv_python_platform=`$PYTHON -c \"import sys; sys.stdout.write(sys.platform)\"`])\n  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])\n\n\n  dnl Set up 4 directories:\n\n  dnl pythondir -- where to install python scripts.  This is the\n  dnl   site-packages directory, not the python standard library\n  dnl   directory like in previous automake betas.  This behavior\n  dnl   is more consistent with lispdir.m4 for example.\n  dnl Query distutils for this directory.\n  AC_CACHE_CHECK([for $am_display_PYTHON script directory],\n    [am_cv_python_pythondir],\n    [if test \"x$prefix\" = xNONE\n     then\n       am_py_prefix=$ac_default_prefix\n     else\n       am_py_prefix=$prefix\n     fi\n     am_cv_python_pythondir=`$PYTHON -c \"import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))\" 2>/dev/null`\n     case $am_cv_python_pythondir in\n     $am_py_prefix*)\n       am__strip_prefix=`echo \"$am_py_prefix\" | sed 's|.|.|g'`\n       am_cv_python_pythondir=`echo \"$am_cv_python_pythondir\" | sed \"s,^$am__strip_prefix,$PYTHON_PREFIX,\"`\n       ;;\n     *)\n       case $am_py_prefix in\n         /usr|/System*) ;;\n         *)\n\t  am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages\n\t  ;;\n       esac\n       ;;\n     esac\n    ])\n  AC_SUBST([pythondir], [$am_cv_python_pythondir])\n\n  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was\n  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is\n  dnl   more consistent with the rest of automake.\n\n  AC_SUBST([pkgpythondir], [\\${pythondir}/$PACKAGE])\n\n  dnl pyexecdir -- directory for installing python extension modules\n  dnl   (shared libraries)\n  dnl Query distutils for this directory.\n  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],\n    [am_cv_python_pyexecdir],\n    [if test \"x$exec_prefix\" = xNONE\n     then\n       am_py_exec_prefix=$am_py_prefix\n     else\n       am_py_exec_prefix=$exec_prefix\n     fi\n     am_cv_python_pyexecdir=`$PYTHON -c \"import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))\" 2>/dev/null`\n     case $am_cv_python_pyexecdir in\n     $am_py_exec_prefix*)\n       am__strip_prefix=`echo \"$am_py_exec_prefix\" | sed 's|.|.|g'`\n       am_cv_python_pyexecdir=`echo \"$am_cv_python_pyexecdir\" | sed \"s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,\"`\n       ;;\n     *)\n       case $am_py_exec_prefix in\n         /usr|/System*) ;;\n         *)\n\t   am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages\n\t   ;;\n       esac\n       ;;\n     esac\n    ])\n  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])\n\n  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)\n\n  AC_SUBST([pkgpyexecdir], [\\${pyexecdir}/$PACKAGE])\n\n  dnl Run any user-specified action.\n  $2\n  fi\n\n])\n\n\n# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])\n# ---------------------------------------------------------------------------\n# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.\n# Run ACTION-IF-FALSE otherwise.\n# This test uses sys.hexversion instead of the string equivalent (first\n# word of sys.version), in order to cope with versions such as 2.2c1.\n# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).\nAC_DEFUN([AM_PYTHON_CHECK_VERSION],\n [prog=\"import sys\n# split strings by '.' and convert to numeric.  Append some zeros\n# because we need at least 4 digits for the hex conversion.\n# map returns an iterator in Python 3.0 and a list in 2.x\nminver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]\nminverhex = 0\n# xrange is not present in Python 3.0 and range returns an iterator\nfor i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]\nsys.exit(sys.hexversion < minverhex)\"\n  AS_IF([AM_RUN_LOG([$1 -c \"$prog\"])], [$3], [$4])])\n\n# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# AM_RUN_LOG(COMMAND)\n# -------------------\n# Run COMMAND, save the exit status in ac_status, and log it.\n# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)\nAC_DEFUN([AM_RUN_LOG],\n[{ echo \"$as_me:$LINENO: $1\" >&AS_MESSAGE_LOG_FD\n   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD\n   ac_status=$?\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   (exit $ac_status); }])\n\n# Check to make sure that the build environment is sane.    -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 5\n\n# AM_SANITY_CHECK\n# ---------------\nAC_DEFUN([AM_SANITY_CHECK],\n[AC_MSG_CHECKING([whether build environment is sane])\n# Just in case\nsleep 1\necho timestamp > conftest.file\n# Reject unsafe characters in $srcdir or the absolute working directory\n# name.  Accept space and tab only in the latter.\nam_lf='\n'\ncase `pwd` in\n  *[[\\\\\\\"\\#\\$\\&\\'\\`$am_lf]]*)\n    AC_MSG_ERROR([unsafe absolute working directory name]);;\nesac\ncase $srcdir in\n  *[[\\\\\\\"\\#\\$\\&\\'\\`$am_lf\\ \\\t]]*)\n    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;\nesac\n\n# Do `set' in a subshell so we don't clobber the current shell's\n# arguments.  Must try -L first in case configure is actually a\n# symlink; some systems play weird games with the mod time of symlinks\n# (eg FreeBSD returns the mod time of the symlink's containing\n# directory).\nif (\n   set X `ls -Lt \"$srcdir/configure\" conftest.file 2> /dev/null`\n   if test \"$[*]\" = \"X\"; then\n      # -L didn't work.\n      set X `ls -t \"$srcdir/configure\" conftest.file`\n   fi\n   rm -f conftest.file\n   if test \"$[*]\" != \"X $srcdir/configure conftest.file\" \\\n      && test \"$[*]\" != \"X conftest.file $srcdir/configure\"; then\n\n      # If neither matched, then we have a broken ls.  This can happen\n      # if, for instance, CONFIG_SHELL is bash and it inherits a\n      # broken ls alias from the environment.  This has actually\n      # happened.  Such a system could not be considered \"sane\".\n      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken\nalias in your environment])\n   fi\n\n   test \"$[2]\" = conftest.file\n   )\nthen\n   # Ok.\n   :\nelse\n   AC_MSG_ERROR([newly created file is older than distributed files!\nCheck your system clock])\nfi\nAC_MSG_RESULT(yes)])\n\n# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# AM_PROG_INSTALL_STRIP\n# ---------------------\n# One issue with vendor `install' (even GNU) is that you can't\n# specify the program used to strip binaries.  This is especially\n# annoying in cross-compiling environments, where the build's strip\n# is unlikely to handle the host's binaries.\n# Fortunately install-sh will honor a STRIPPROG variable, so we\n# always use install-sh in `make install-strip', and initialize\n# STRIPPROG with the value of the STRIP variable (set by the user).\nAC_DEFUN([AM_PROG_INSTALL_STRIP],\n[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl\n# Installed binaries are usually stripped using `strip' when the user\n# run `make install-strip'.  However `strip' might not be the right\n# tool to use in cross-compilation environments, therefore Automake\n# will honor the `STRIP' environment variable to overrule this program.\ndnl Don't test for $cross_compiling = yes, because it might be `maybe'.\nif test \"$cross_compiling\" != no; then\n  AC_CHECK_TOOL([STRIP], [strip], :)\nfi\nINSTALL_STRIP_PROGRAM=\"\\$(install_sh) -c -s\"\nAC_SUBST([INSTALL_STRIP_PROGRAM])])\n\n# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 3\n\n# _AM_SUBST_NOTMAKE(VARIABLE)\n# ---------------------------\n# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.\n# This macro is traced by Automake.\nAC_DEFUN([_AM_SUBST_NOTMAKE])\n\n# AM_SUBST_NOTMAKE(VARIABLE)\n# --------------------------\n# Public sister of _AM_SUBST_NOTMAKE.\nAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])\n\n# Check how to create a tarball.                            -*- Autoconf -*-\n\n# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 2\n\n# _AM_PROG_TAR(FORMAT)\n# --------------------\n# Check how to create a tarball in format FORMAT.\n# FORMAT should be one of `v7', `ustar', or `pax'.\n#\n# Substitute a variable $(am__tar) that is a command\n# writing to stdout a FORMAT-tarball containing the directory\n# $tardir.\n#     tardir=directory && $(am__tar) > result.tar\n#\n# Substitute a variable $(am__untar) that extract such\n# a tarball read from stdin.\n#     $(am__untar) < result.tar\nAC_DEFUN([_AM_PROG_TAR],\n[# Always define AMTAR for backward compatibility.  Yes, it's still used\n# in the wild :-(  We should find a proper way to deprecate it ...\nAC_SUBST([AMTAR], ['$${TAR-tar}'])\nm4_if([$1], [v7],\n     [am__tar='$${TAR-tar} chof - \"$$tardir\"' am__untar='$${TAR-tar} xf -'],\n     [m4_case([$1], [ustar],, [pax],,\n              [m4_fatal([Unknown tar format])])\nAC_MSG_CHECKING([how to create a $1 tar archive])\n# Loop over all known methods to create a tar archive until one works.\n_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'\n_am_tools=${am_cv_prog_tar_$1-$_am_tools}\n# Do not fold the above two line into one, because Tru64 sh and\n# Solaris sh will not grok spaces in the rhs of `-'.\nfor _am_tool in $_am_tools\ndo\n  case $_am_tool in\n  gnutar)\n    for _am_tar in tar gnutar gtar;\n    do\n      AM_RUN_LOG([$_am_tar --version]) && break\n    done\n    am__tar=\"$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - \"'\"$$tardir\"'\n    am__tar_=\"$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - \"'\"$tardir\"'\n    am__untar=\"$_am_tar -xf -\"\n    ;;\n  plaintar)\n    # Must skip GNU tar: if it does not support --format= it doesn't create\n    # ustar tarball either.\n    (tar --version) >/dev/null 2>&1 && continue\n    am__tar='tar chf - \"$$tardir\"'\n    am__tar_='tar chf - \"$tardir\"'\n    am__untar='tar xf -'\n    ;;\n  pax)\n    am__tar='pax -L -x $1 -w \"$$tardir\"'\n    am__tar_='pax -L -x $1 -w \"$tardir\"'\n    am__untar='pax -r'\n    ;;\n  cpio)\n    am__tar='find \"$$tardir\" -print | cpio -o -H $1 -L'\n    am__tar_='find \"$tardir\" -print | cpio -o -H $1 -L'\n    am__untar='cpio -i -H $1 -d'\n    ;;\n  none)\n    am__tar=false\n    am__tar_=false\n    am__untar=false\n    ;;\n  esac\n\n  # If the value was cached, stop now.  We just wanted to have am__tar\n  # and am__untar set.\n  test -n \"${am_cv_prog_tar_$1}\" && break\n\n  # tar/untar a dummy directory, and stop if the command works\n  rm -rf conftest.dir\n  mkdir conftest.dir\n  echo GrepMe > conftest.dir/file\n  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])\n  rm -rf conftest.dir\n  if test -s conftest.tar; then\n    AM_RUN_LOG([$am__untar <conftest.tar])\n    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break\n  fi\ndone\nrm -rf conftest.dir\n\nAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])\nAC_MSG_RESULT([$am_cv_prog_tar_$1])])\nAC_SUBST([am__tar])\nAC_SUBST([am__untar])\n]) # _AM_PROG_TAR\n\nm4_include([m4/libtool.m4])\nm4_include([m4/ltoptions.m4])\nm4_include([m4/ltsugar.m4])\nm4_include([m4/ltversion.m4])\nm4_include([m4/lt~obsolete.m4])\n"
  },
  {
    "path": "Tests/gtest/build-aux/config.guess",
    "content": "#! /bin/sh\n# Attempt to guess a canonical system name.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,\n#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n#   2011, 2012 Free Software Foundation, Inc.\n\ntimestamp='2012-02-10'\n\n# This file is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <http://www.gnu.org/licenses/>.\n#\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n\n# Originally written by Per Bothner.  Please send patches (context\n# diff format) to <config-patches@gnu.org> and include a ChangeLog\n# entry.\n#\n# This script attempts to guess a canonical system name similar to\n# config.sub.  If it succeeds, it prints the system name on stdout, and\n# exits with 0.  Otherwise, it exits with 1.\n#\n# You can get the latest version of this script from:\n# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD\n\nme=`echo \"$0\" | sed -e 's,.*/,,'`\n\nusage=\"\\\nUsage: $0 [OPTION]\n\nOutput the configuration name of the system \\`$me' is run on.\n\nOperation modes:\n  -h, --help         print this help, then exit\n  -t, --time-stamp   print date of last modification, then exit\n  -v, --version      print version number, then exit\n\nReport bugs and patches to <config-patches@gnu.org>.\"\n\nversion=\"\\\nGNU config.guess ($timestamp)\n\nOriginally written by Per Bothner.\nCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,\n2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012\nFree Software Foundation, Inc.\n\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\"\n\nhelp=\"\nTry \\`$me --help' for more information.\"\n\n# Parse command line\nwhile test $# -gt 0 ; do\n  case $1 in\n    --time-stamp | --time* | -t )\n       echo \"$timestamp\" ; exit ;;\n    --version | -v )\n       echo \"$version\" ; exit ;;\n    --help | --h* | -h )\n       echo \"$usage\"; exit ;;\n    -- )     # Stop option processing\n       shift; break ;;\n    - )\t# Use stdin as input.\n       break ;;\n    -* )\n       echo \"$me: invalid option $1$help\" >&2\n       exit 1 ;;\n    * )\n       break ;;\n  esac\ndone\n\nif test $# != 0; then\n  echo \"$me: too many arguments$help\" >&2\n  exit 1\nfi\n\ntrap 'exit 1' 1 2 15\n\n# CC_FOR_BUILD -- compiler used by this script. Note that the use of a\n# compiler to aid in system detection is discouraged as it requires\n# temporary files to be created and, as you can see below, it is a\n# headache to deal with in a portable fashion.\n\n# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still\n# use `HOST_CC' if defined, but it is deprecated.\n\n# Portable tmp directory creation inspired by the Autoconf team.\n\nset_cc_for_build='\ntrap \"exitcode=\\$?; (rm -f \\$tmpfiles 2>/dev/null; rmdir \\$tmp 2>/dev/null) && exit \\$exitcode\" 0 ;\ntrap \"rm -f \\$tmpfiles 2>/dev/null; rmdir \\$tmp 2>/dev/null; exit 1\" 1 2 13 15 ;\n: ${TMPDIR=/tmp} ;\n { tmp=`(umask 077 && mktemp -d \"$TMPDIR/cgXXXXXX\") 2>/dev/null` && test -n \"$tmp\" && test -d \"$tmp\" ; } ||\n { test -n \"$RANDOM\" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||\n { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo \"Warning: creating insecure temp directory\" >&2 ; } ||\n { echo \"$me: cannot create a temporary directory in $TMPDIR\" >&2 ; exit 1 ; } ;\ndummy=$tmp/dummy ;\ntmpfiles=\"$dummy.c $dummy.o $dummy.rel $dummy\" ;\ncase $CC_FOR_BUILD,$HOST_CC,$CC in\n ,,)    echo \"int x;\" > $dummy.c ;\n\tfor c in cc gcc c89 c99 ; do\n\t  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then\n\t     CC_FOR_BUILD=\"$c\"; break ;\n\t  fi ;\n\tdone ;\n\tif test x\"$CC_FOR_BUILD\" = x ; then\n\t  CC_FOR_BUILD=no_compiler_found ;\n\tfi\n\t;;\n ,,*)   CC_FOR_BUILD=$CC ;;\n ,*,*)  CC_FOR_BUILD=$HOST_CC ;;\nesac ; set_cc_for_build= ;'\n\n# This is needed to find uname on a Pyramid OSx when run in the BSD universe.\n# (ghazi@noc.rutgers.edu 1994-08-24)\nif (test -f /.attbin/uname) >/dev/null 2>&1 ; then\n\tPATH=$PATH:/.attbin ; export PATH\nfi\n\nUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown\nUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown\nUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown\nUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown\n\n# Note: order is significant - the case branches are not exclusive.\n\ncase \"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}\" in\n    *:NetBSD:*:*)\n\t# NetBSD (nbsd) targets should (where applicable) match one or\n\t# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,\n\t# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently\n\t# switched to ELF, *-*-netbsd* would select the old\n\t# object file format.  This provides both forward\n\t# compatibility and a consistent mechanism for selecting the\n\t# object file format.\n\t#\n\t# Note: NetBSD doesn't particularly care about the vendor\n\t# portion of the name.  We always set it to \"unknown\".\n\tsysctl=\"sysctl -n hw.machine_arch\"\n\tUNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \\\n\t    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`\n\tcase \"${UNAME_MACHINE_ARCH}\" in\n\t    armeb) machine=armeb-unknown ;;\n\t    arm*) machine=arm-unknown ;;\n\t    sh3el) machine=shl-unknown ;;\n\t    sh3eb) machine=sh-unknown ;;\n\t    sh5el) machine=sh5le-unknown ;;\n\t    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;\n\tesac\n\t# The Operating System including object format, if it has switched\n\t# to ELF recently, or will in the future.\n\tcase \"${UNAME_MACHINE_ARCH}\" in\n\t    arm*|i386|m68k|ns32k|sh3*|sparc|vax)\n\t\teval $set_cc_for_build\n\t\tif echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t\t\t| grep -q __ELF__\n\t\tthen\n\t\t    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).\n\t\t    # Return netbsd for either.  FIX?\n\t\t    os=netbsd\n\t\telse\n\t\t    os=netbsdelf\n\t\tfi\n\t\t;;\n\t    *)\n\t\tos=netbsd\n\t\t;;\n\tesac\n\t# The OS release\n\t# Debian GNU/NetBSD machines have a different userland, and\n\t# thus, need a distinct triplet. However, they do not need\n\t# kernel version information, so it can be replaced with a\n\t# suitable tag, in the style of linux-gnu.\n\tcase \"${UNAME_VERSION}\" in\n\t    Debian*)\n\t\trelease='-gnu'\n\t\t;;\n\t    *)\n\t\trelease=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\\./'`\n\t\t;;\n\tesac\n\t# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:\n\t# contains redundant information, the shorter form:\n\t# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.\n\techo \"${machine}-${os}${release}\"\n\texit ;;\n    *:OpenBSD:*:*)\n\tUNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`\n\techo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}\n\texit ;;\n    *:ekkoBSD:*:*)\n\techo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}\n\texit ;;\n    *:SolidBSD:*:*)\n\techo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}\n\texit ;;\n    macppc:MirBSD:*:*)\n\techo powerpc-unknown-mirbsd${UNAME_RELEASE}\n\texit ;;\n    *:MirBSD:*:*)\n\techo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}\n\texit ;;\n    alpha:OSF1:*:*)\n\tcase $UNAME_RELEASE in\n\t*4.0)\n\t\tUNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`\n\t\t;;\n\t*5.*)\n\t\tUNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`\n\t\t;;\n\tesac\n\t# According to Compaq, /usr/sbin/psrinfo has been available on\n\t# OSF/1 and Tru64 systems produced since 1995.  I hope that\n\t# covers most systems running today.  This code pipes the CPU\n\t# types through head -n 1, so we only detect the type of CPU 0.\n\tALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \\(.*\\) processor.*$/\\1/p' | head -n 1`\n\tcase \"$ALPHA_CPU_TYPE\" in\n\t    \"EV4 (21064)\")\n\t\tUNAME_MACHINE=\"alpha\" ;;\n\t    \"EV4.5 (21064)\")\n\t\tUNAME_MACHINE=\"alpha\" ;;\n\t    \"LCA4 (21066/21068)\")\n\t\tUNAME_MACHINE=\"alpha\" ;;\n\t    \"EV5 (21164)\")\n\t\tUNAME_MACHINE=\"alphaev5\" ;;\n\t    \"EV5.6 (21164A)\")\n\t\tUNAME_MACHINE=\"alphaev56\" ;;\n\t    \"EV5.6 (21164PC)\")\n\t\tUNAME_MACHINE=\"alphapca56\" ;;\n\t    \"EV5.7 (21164PC)\")\n\t\tUNAME_MACHINE=\"alphapca57\" ;;\n\t    \"EV6 (21264)\")\n\t\tUNAME_MACHINE=\"alphaev6\" ;;\n\t    \"EV6.7 (21264A)\")\n\t\tUNAME_MACHINE=\"alphaev67\" ;;\n\t    \"EV6.8CB (21264C)\")\n\t\tUNAME_MACHINE=\"alphaev68\" ;;\n\t    \"EV6.8AL (21264B)\")\n\t\tUNAME_MACHINE=\"alphaev68\" ;;\n\t    \"EV6.8CX (21264D)\")\n\t\tUNAME_MACHINE=\"alphaev68\" ;;\n\t    \"EV6.9A (21264/EV69A)\")\n\t\tUNAME_MACHINE=\"alphaev69\" ;;\n\t    \"EV7 (21364)\")\n\t\tUNAME_MACHINE=\"alphaev7\" ;;\n\t    \"EV7.9 (21364A)\")\n\t\tUNAME_MACHINE=\"alphaev79\" ;;\n\tesac\n\t# A Pn.n version is a patched version.\n\t# A Vn.n version is a released version.\n\t# A Tn.n version is a released field test version.\n\t# A Xn.n version is an unreleased experimental baselevel.\n\t# 1.2 uses \"1.2\" for uname -r.\n\techo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`\n\t# Reset EXIT trap before exiting to avoid spurious non-zero exit code.\n\texitcode=$?\n\ttrap '' 0\n\texit $exitcode ;;\n    Alpha\\ *:Windows_NT*:*)\n\t# How do we know it's Interix rather than the generic POSIX subsystem?\n\t# Should we change UNAME_MACHINE based on the output of uname instead\n\t# of the specific Alpha model?\n\techo alpha-pc-interix\n\texit ;;\n    21064:Windows_NT:50:3)\n\techo alpha-dec-winnt3.5\n\texit ;;\n    Amiga*:UNIX_System_V:4.0:*)\n\techo m68k-unknown-sysv4\n\texit ;;\n    *:[Aa]miga[Oo][Ss]:*:*)\n\techo ${UNAME_MACHINE}-unknown-amigaos\n\texit ;;\n    *:[Mm]orph[Oo][Ss]:*:*)\n\techo ${UNAME_MACHINE}-unknown-morphos\n\texit ;;\n    *:OS/390:*:*)\n\techo i370-ibm-openedition\n\texit ;;\n    *:z/VM:*:*)\n\techo s390-ibm-zvmoe\n\texit ;;\n    *:OS400:*:*)\n\techo powerpc-ibm-os400\n\texit ;;\n    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)\n\techo arm-acorn-riscix${UNAME_RELEASE}\n\texit ;;\n    arm:riscos:*:*|arm:RISCOS:*:*)\n\techo arm-unknown-riscos\n\texit ;;\n    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)\n\techo hppa1.1-hitachi-hiuxmpp\n\texit ;;\n    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)\n\t# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.\n\tif test \"`(/bin/universe) 2>/dev/null`\" = att ; then\n\t\techo pyramid-pyramid-sysv3\n\telse\n\t\techo pyramid-pyramid-bsd\n\tfi\n\texit ;;\n    NILE*:*:*:dcosx)\n\techo pyramid-pyramid-svr4\n\texit ;;\n    DRS?6000:unix:4.0:6*)\n\techo sparc-icl-nx6\n\texit ;;\n    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)\n\tcase `/usr/bin/uname -p` in\n\t    sparc) echo sparc-icl-nx7; exit ;;\n\tesac ;;\n    s390x:SunOS:*:*)\n\techo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4H:SunOS:5.*:*)\n\techo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)\n\techo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)\n\techo i386-pc-auroraux${UNAME_RELEASE}\n\texit ;;\n    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)\n\teval $set_cc_for_build\n\tSUN_ARCH=\"i386\"\n\t# If there is a compiler, see if it is configured for 64-bit objects.\n\t# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.\n\t# This test works for both compilers.\n\tif [ \"$CC_FOR_BUILD\" != 'no_compiler_found' ]; then\n\t    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \\\n\t\t(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \\\n\t\tgrep IS_64BIT_ARCH >/dev/null\n\t    then\n\t\tSUN_ARCH=\"x86_64\"\n\t    fi\n\tfi\n\techo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4*:SunOS:6*:*)\n\t# According to config.sub, this is the proper way to canonicalize\n\t# SunOS6.  Hard to guess exactly what SunOS6 will be like, but\n\t# it's likely to be more like Solaris than SunOS4.\n\techo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4*:SunOS:*:*)\n\tcase \"`/usr/bin/arch -k`\" in\n\t    Series*|S4*)\n\t\tUNAME_RELEASE=`uname -v`\n\t\t;;\n\tesac\n\t# Japanese Language versions have a version number like `4.1.3-JL'.\n\techo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`\n\texit ;;\n    sun3*:SunOS:*:*)\n\techo m68k-sun-sunos${UNAME_RELEASE}\n\texit ;;\n    sun*:*:4.2BSD:*)\n\tUNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`\n\ttest \"x${UNAME_RELEASE}\" = \"x\" && UNAME_RELEASE=3\n\tcase \"`/bin/arch`\" in\n\t    sun3)\n\t\techo m68k-sun-sunos${UNAME_RELEASE}\n\t\t;;\n\t    sun4)\n\t\techo sparc-sun-sunos${UNAME_RELEASE}\n\t\t;;\n\tesac\n\texit ;;\n    aushp:SunOS:*:*)\n\techo sparc-auspex-sunos${UNAME_RELEASE}\n\texit ;;\n    # The situation for MiNT is a little confusing.  The machine name\n    # can be virtually everything (everything which is not\n    # \"atarist\" or \"atariste\" at least should have a processor\n    # > m68000).  The system name ranges from \"MiNT\" over \"FreeMiNT\"\n    # to the lowercase version \"mint\" (or \"freemint\").  Finally\n    # the system name \"TOS\" denotes a system which is actually not\n    # MiNT.  But MiNT is downward compatible to TOS, so this should\n    # be no problem.\n    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)\n\techo m68k-atari-mint${UNAME_RELEASE}\n\texit ;;\n    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)\n\techo m68k-atari-mint${UNAME_RELEASE}\n\texit ;;\n    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)\n\techo m68k-atari-mint${UNAME_RELEASE}\n\texit ;;\n    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)\n\techo m68k-milan-mint${UNAME_RELEASE}\n\texit ;;\n    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)\n\techo m68k-hades-mint${UNAME_RELEASE}\n\texit ;;\n    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)\n\techo m68k-unknown-mint${UNAME_RELEASE}\n\texit ;;\n    m68k:machten:*:*)\n\techo m68k-apple-machten${UNAME_RELEASE}\n\texit ;;\n    powerpc:machten:*:*)\n\techo powerpc-apple-machten${UNAME_RELEASE}\n\texit ;;\n    RISC*:Mach:*:*)\n\techo mips-dec-mach_bsd4.3\n\texit ;;\n    RISC*:ULTRIX:*:*)\n\techo mips-dec-ultrix${UNAME_RELEASE}\n\texit ;;\n    VAX*:ULTRIX*:*:*)\n\techo vax-dec-ultrix${UNAME_RELEASE}\n\texit ;;\n    2020:CLIX:*:* | 2430:CLIX:*:*)\n\techo clipper-intergraph-clix${UNAME_RELEASE}\n\texit ;;\n    mips:*:*:UMIPS | mips:*:*:RISCos)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n#ifdef __cplusplus\n#include <stdio.h>  /* for printf() prototype */\n\tint main (int argc, char *argv[]) {\n#else\n\tint main (argc, argv) int argc; char *argv[]; {\n#endif\n\t#if defined (host_mips) && defined (MIPSEB)\n\t#if defined (SYSTYPE_SYSV)\n\t  printf (\"mips-mips-riscos%ssysv\\n\", argv[1]); exit (0);\n\t#endif\n\t#if defined (SYSTYPE_SVR4)\n\t  printf (\"mips-mips-riscos%ssvr4\\n\", argv[1]); exit (0);\n\t#endif\n\t#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)\n\t  printf (\"mips-mips-riscos%sbsd\\n\", argv[1]); exit (0);\n\t#endif\n\t#endif\n\t  exit (-1);\n\t}\nEOF\n\t$CC_FOR_BUILD -o $dummy $dummy.c &&\n\t  dummyarg=`echo \"${UNAME_RELEASE}\" | sed -n 's/\\([0-9]*\\).*/\\1/p'` &&\n\t  SYSTEM_NAME=`$dummy $dummyarg` &&\n\t    { echo \"$SYSTEM_NAME\"; exit; }\n\techo mips-mips-riscos${UNAME_RELEASE}\n\texit ;;\n    Motorola:PowerMAX_OS:*:*)\n\techo powerpc-motorola-powermax\n\texit ;;\n    Motorola:*:4.3:PL8-*)\n\techo powerpc-harris-powermax\n\texit ;;\n    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)\n\techo powerpc-harris-powermax\n\texit ;;\n    Night_Hawk:Power_UNIX:*:*)\n\techo powerpc-harris-powerunix\n\texit ;;\n    m88k:CX/UX:7*:*)\n\techo m88k-harris-cxux7\n\texit ;;\n    m88k:*:4*:R4*)\n\techo m88k-motorola-sysv4\n\texit ;;\n    m88k:*:3*:R3*)\n\techo m88k-motorola-sysv3\n\texit ;;\n    AViiON:dgux:*:*)\n\t# DG/UX returns AViiON for all architectures\n\tUNAME_PROCESSOR=`/usr/bin/uname -p`\n\tif [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]\n\tthen\n\t    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \\\n\t       [ ${TARGET_BINARY_INTERFACE}x = x ]\n\t    then\n\t\techo m88k-dg-dgux${UNAME_RELEASE}\n\t    else\n\t\techo m88k-dg-dguxbcs${UNAME_RELEASE}\n\t    fi\n\telse\n\t    echo i586-dg-dgux${UNAME_RELEASE}\n\tfi\n\texit ;;\n    M88*:DolphinOS:*:*)\t# DolphinOS (SVR3)\n\techo m88k-dolphin-sysv3\n\texit ;;\n    M88*:*:R3*:*)\n\t# Delta 88k system running SVR3\n\techo m88k-motorola-sysv3\n\texit ;;\n    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)\n\techo m88k-tektronix-sysv3\n\texit ;;\n    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)\n\techo m68k-tektronix-bsd\n\texit ;;\n    *:IRIX*:*:*)\n\techo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`\n\texit ;;\n    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.\n\techo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id\n\texit ;;               # Note that: echo \"'`uname -s`'\" gives 'AIX '\n    i*86:AIX:*:*)\n\techo i386-ibm-aix\n\texit ;;\n    ia64:AIX:*:*)\n\tif [ -x /usr/bin/oslevel ] ; then\n\t\tIBM_REV=`/usr/bin/oslevel`\n\telse\n\t\tIBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}\n\tfi\n\techo ${UNAME_MACHINE}-ibm-aix${IBM_REV}\n\texit ;;\n    *:AIX:2:3)\n\tif grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then\n\t\teval $set_cc_for_build\n\t\tsed 's/^\t\t//' << EOF >$dummy.c\n\t\t#include <sys/systemcfg.h>\n\n\t\tmain()\n\t\t\t{\n\t\t\tif (!__power_pc())\n\t\t\t\texit(1);\n\t\t\tputs(\"powerpc-ibm-aix3.2.5\");\n\t\t\texit(0);\n\t\t\t}\nEOF\n\t\tif $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`\n\t\tthen\n\t\t\techo \"$SYSTEM_NAME\"\n\t\telse\n\t\t\techo rs6000-ibm-aix3.2.5\n\t\tfi\n\telif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then\n\t\techo rs6000-ibm-aix3.2.4\n\telse\n\t\techo rs6000-ibm-aix3.2\n\tfi\n\texit ;;\n    *:AIX:*:[4567])\n\tIBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`\n\tif /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then\n\t\tIBM_ARCH=rs6000\n\telse\n\t\tIBM_ARCH=powerpc\n\tfi\n\tif [ -x /usr/bin/oslevel ] ; then\n\t\tIBM_REV=`/usr/bin/oslevel`\n\telse\n\t\tIBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}\n\tfi\n\techo ${IBM_ARCH}-ibm-aix${IBM_REV}\n\texit ;;\n    *:AIX:*:*)\n\techo rs6000-ibm-aix\n\texit ;;\n    ibmrt:4.4BSD:*|romp-ibm:BSD:*)\n\techo romp-ibm-bsd4.4\n\texit ;;\n    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and\n\techo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to\n\texit ;;                             # report: romp-ibm BSD 4.3\n    *:BOSX:*:*)\n\techo rs6000-bull-bosx\n\texit ;;\n    DPX/2?00:B.O.S.:*:*)\n\techo m68k-bull-sysv3\n\texit ;;\n    9000/[34]??:4.3bsd:1.*:*)\n\techo m68k-hp-bsd\n\texit ;;\n    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)\n\techo m68k-hp-bsd4.4\n\texit ;;\n    9000/[34678]??:HP-UX:*:*)\n\tHPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`\n\tcase \"${UNAME_MACHINE}\" in\n\t    9000/31? )            HP_ARCH=m68000 ;;\n\t    9000/[34]?? )         HP_ARCH=m68k ;;\n\t    9000/[678][0-9][0-9])\n\t\tif [ -x /usr/bin/getconf ]; then\n\t\t    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`\n\t\t    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`\n\t\t    case \"${sc_cpu_version}\" in\n\t\t      523) HP_ARCH=\"hppa1.0\" ;; # CPU_PA_RISC1_0\n\t\t      528) HP_ARCH=\"hppa1.1\" ;; # CPU_PA_RISC1_1\n\t\t      532)                      # CPU_PA_RISC2_0\n\t\t\tcase \"${sc_kernel_bits}\" in\n\t\t\t  32) HP_ARCH=\"hppa2.0n\" ;;\n\t\t\t  64) HP_ARCH=\"hppa2.0w\" ;;\n\t\t\t  '') HP_ARCH=\"hppa2.0\" ;;   # HP-UX 10.20\n\t\t\tesac ;;\n\t\t    esac\n\t\tfi\n\t\tif [ \"${HP_ARCH}\" = \"\" ]; then\n\t\t    eval $set_cc_for_build\n\t\t    sed 's/^\t\t//' << EOF >$dummy.c\n\n\t\t#define _HPUX_SOURCE\n\t\t#include <stdlib.h>\n\t\t#include <unistd.h>\n\n\t\tint main ()\n\t\t{\n\t\t#if defined(_SC_KERNEL_BITS)\n\t\t    long bits = sysconf(_SC_KERNEL_BITS);\n\t\t#endif\n\t\t    long cpu  = sysconf (_SC_CPU_VERSION);\n\n\t\t    switch (cpu)\n\t\t\t{\n\t\t\tcase CPU_PA_RISC1_0: puts (\"hppa1.0\"); break;\n\t\t\tcase CPU_PA_RISC1_1: puts (\"hppa1.1\"); break;\n\t\t\tcase CPU_PA_RISC2_0:\n\t\t#if defined(_SC_KERNEL_BITS)\n\t\t\t    switch (bits)\n\t\t\t\t{\n\t\t\t\tcase 64: puts (\"hppa2.0w\"); break;\n\t\t\t\tcase 32: puts (\"hppa2.0n\"); break;\n\t\t\t\tdefault: puts (\"hppa2.0\"); break;\n\t\t\t\t} break;\n\t\t#else  /* !defined(_SC_KERNEL_BITS) */\n\t\t\t    puts (\"hppa2.0\"); break;\n\t\t#endif\n\t\t\tdefault: puts (\"hppa1.0\"); break;\n\t\t\t}\n\t\t    exit (0);\n\t\t}\nEOF\n\t\t    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`\n\t\t    test -z \"$HP_ARCH\" && HP_ARCH=hppa\n\t\tfi ;;\n\tesac\n\tif [ ${HP_ARCH} = \"hppa2.0w\" ]\n\tthen\n\t    eval $set_cc_for_build\n\n\t    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating\n\t    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler\n\t    # generating 64-bit code.  GNU and HP use different nomenclature:\n\t    #\n\t    # $ CC_FOR_BUILD=cc ./config.guess\n\t    # => hppa2.0w-hp-hpux11.23\n\t    # $ CC_FOR_BUILD=\"cc +DA2.0w\" ./config.guess\n\t    # => hppa64-hp-hpux11.23\n\n\t    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |\n\t\tgrep -q __LP64__\n\t    then\n\t\tHP_ARCH=\"hppa2.0w\"\n\t    else\n\t\tHP_ARCH=\"hppa64\"\n\t    fi\n\tfi\n\techo ${HP_ARCH}-hp-hpux${HPUX_REV}\n\texit ;;\n    ia64:HP-UX:*:*)\n\tHPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`\n\techo ia64-hp-hpux${HPUX_REV}\n\texit ;;\n    3050*:HI-UX:*:*)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#include <unistd.h>\n\tint\n\tmain ()\n\t{\n\t  long cpu = sysconf (_SC_CPU_VERSION);\n\t  /* The order matters, because CPU_IS_HP_MC68K erroneously returns\n\t     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct\n\t     results, however.  */\n\t  if (CPU_IS_PA_RISC (cpu))\n\t    {\n\t      switch (cpu)\n\t\t{\n\t\t  case CPU_PA_RISC1_0: puts (\"hppa1.0-hitachi-hiuxwe2\"); break;\n\t\t  case CPU_PA_RISC1_1: puts (\"hppa1.1-hitachi-hiuxwe2\"); break;\n\t\t  case CPU_PA_RISC2_0: puts (\"hppa2.0-hitachi-hiuxwe2\"); break;\n\t\t  default: puts (\"hppa-hitachi-hiuxwe2\"); break;\n\t\t}\n\t    }\n\t  else if (CPU_IS_HP_MC68K (cpu))\n\t    puts (\"m68k-hitachi-hiuxwe2\");\n\t  else puts (\"unknown-hitachi-hiuxwe2\");\n\t  exit (0);\n\t}\nEOF\n\t$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&\n\t\t{ echo \"$SYSTEM_NAME\"; exit; }\n\techo unknown-hitachi-hiuxwe2\n\texit ;;\n    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )\n\techo hppa1.1-hp-bsd\n\texit ;;\n    9000/8??:4.3bsd:*:*)\n\techo hppa1.0-hp-bsd\n\texit ;;\n    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)\n\techo hppa1.0-hp-mpeix\n\texit ;;\n    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )\n\techo hppa1.1-hp-osf\n\texit ;;\n    hp8??:OSF1:*:*)\n\techo hppa1.0-hp-osf\n\texit ;;\n    i*86:OSF1:*:*)\n\tif [ -x /usr/sbin/sysversion ] ; then\n\t    echo ${UNAME_MACHINE}-unknown-osf1mk\n\telse\n\t    echo ${UNAME_MACHINE}-unknown-osf1\n\tfi\n\texit ;;\n    parisc*:Lites*:*:*)\n\techo hppa1.1-hp-lites\n\texit ;;\n    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)\n\techo c1-convex-bsd\n\texit ;;\n    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)\n\tif getsysinfo -f scalar_acc\n\tthen echo c32-convex-bsd\n\telse echo c2-convex-bsd\n\tfi\n\texit ;;\n    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)\n\techo c34-convex-bsd\n\texit ;;\n    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)\n\techo c38-convex-bsd\n\texit ;;\n    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)\n\techo c4-convex-bsd\n\texit ;;\n    CRAY*Y-MP:*:*:*)\n\techo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*[A-Z]90:*:*:*)\n\techo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \\\n\t| sed -e 's/CRAY.*\\([A-Z]90\\)/\\1/' \\\n\t      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \\\n\t      -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*TS:*:*:*)\n\techo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*T3E:*:*:*)\n\techo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*SV1:*:*:*)\n\techo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    *:UNICOS/mp:*:*)\n\techo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)\n\tFUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`\n\tFUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\\///'`\n\tFUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`\n\techo \"${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}\"\n\texit ;;\n    5000:UNIX_System_V:4.*:*)\n\tFUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\\///'`\n\tFUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`\n\techo \"sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}\"\n\texit ;;\n    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\\ Embedded/OS:*:*)\n\techo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}\n\texit ;;\n    sparc*:BSD/OS:*:*)\n\techo sparc-unknown-bsdi${UNAME_RELEASE}\n\texit ;;\n    *:BSD/OS:*:*)\n\techo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}\n\texit ;;\n    *:FreeBSD:*:*)\n\tUNAME_PROCESSOR=`/usr/bin/uname -p`\n\tcase ${UNAME_PROCESSOR} in\n\t    amd64)\n\t\techo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\t    *)\n\t\techo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\tesac\n\texit ;;\n    i*:CYGWIN*:*)\n\techo ${UNAME_MACHINE}-pc-cygwin\n\texit ;;\n    *:MINGW*:*)\n\techo ${UNAME_MACHINE}-pc-mingw32\n\texit ;;\n    i*:MSYS*:*)\n\techo ${UNAME_MACHINE}-pc-msys\n\texit ;;\n    i*:windows32*:*)\n\t# uname -m includes \"-pc\" on this system.\n\techo ${UNAME_MACHINE}-mingw32\n\texit ;;\n    i*:PW*:*)\n\techo ${UNAME_MACHINE}-pc-pw32\n\texit ;;\n    *:Interix*:*)\n\tcase ${UNAME_MACHINE} in\n\t    x86)\n\t\techo i586-pc-interix${UNAME_RELEASE}\n\t\texit ;;\n\t    authenticamd | genuineintel | EM64T)\n\t\techo x86_64-unknown-interix${UNAME_RELEASE}\n\t\texit ;;\n\t    IA64)\n\t\techo ia64-unknown-interix${UNAME_RELEASE}\n\t\texit ;;\n\tesac ;;\n    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)\n\techo i${UNAME_MACHINE}-pc-mks\n\texit ;;\n    8664:Windows_NT:*)\n\techo x86_64-pc-mks\n\texit ;;\n    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)\n\t# How do we know it's Interix rather than the generic POSIX subsystem?\n\t# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we\n\t# UNAME_MACHINE based on the output of uname instead of i386?\n\techo i586-pc-interix\n\texit ;;\n    i*:UWIN*:*)\n\techo ${UNAME_MACHINE}-pc-uwin\n\texit ;;\n    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)\n\techo x86_64-unknown-cygwin\n\texit ;;\n    p*:CYGWIN*:*)\n\techo powerpcle-unknown-cygwin\n\texit ;;\n    prep*:SunOS:5.*:*)\n\techo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    *:GNU:*:*)\n\t# the GNU system\n\techo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`\n\texit ;;\n    *:GNU/*:*:*)\n\t# other systems with GNU libc and userland\n\techo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu\n\texit ;;\n    i*86:Minix:*:*)\n\techo ${UNAME_MACHINE}-pc-minix\n\texit ;;\n    aarch64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    aarch64_be:Linux:*:*)\n\tUNAME_MACHINE=aarch64_be\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    alpha:Linux:*:*)\n\tcase `sed -n '/^cpu model/s/^.*: \\(.*\\)/\\1/p' < /proc/cpuinfo` in\n\t  EV5)   UNAME_MACHINE=alphaev5 ;;\n\t  EV56)  UNAME_MACHINE=alphaev56 ;;\n\t  PCA56) UNAME_MACHINE=alphapca56 ;;\n\t  PCA57) UNAME_MACHINE=alphapca56 ;;\n\t  EV6)   UNAME_MACHINE=alphaev6 ;;\n\t  EV67)  UNAME_MACHINE=alphaev67 ;;\n\t  EV68*) UNAME_MACHINE=alphaev68 ;;\n\tesac\n\tobjdump --private-headers /bin/sh | grep -q ld.so.1\n\tif test \"$?\" = 0 ; then LIBC=\"libc1\" ; else LIBC=\"\" ; fi\n\techo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}\n\texit ;;\n    arm*:Linux:*:*)\n\teval $set_cc_for_build\n\tif echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t    | grep -q __ARM_EABI__\n\tthen\n\t    echo ${UNAME_MACHINE}-unknown-linux-gnu\n\telse\n\t    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t\t| grep -q __ARM_PCS_VFP\n\t    then\n\t\techo ${UNAME_MACHINE}-unknown-linux-gnueabi\n\t    else\n\t\techo ${UNAME_MACHINE}-unknown-linux-gnueabihf\n\t    fi\n\tfi\n\texit ;;\n    avr32*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    cris:Linux:*:*)\n\techo ${UNAME_MACHINE}-axis-linux-gnu\n\texit ;;\n    crisv32:Linux:*:*)\n\techo ${UNAME_MACHINE}-axis-linux-gnu\n\texit ;;\n    frv:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    hexagon:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    i*86:Linux:*:*)\n\tLIBC=gnu\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#ifdef __dietlibc__\n\tLIBC=dietlibc\n\t#endif\nEOF\n\teval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`\n\techo \"${UNAME_MACHINE}-pc-linux-${LIBC}\"\n\texit ;;\n    ia64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    m32r*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    m68*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    mips:Linux:*:* | mips64:Linux:*:*)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#undef CPU\n\t#undef ${UNAME_MACHINE}\n\t#undef ${UNAME_MACHINE}el\n\t#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)\n\tCPU=${UNAME_MACHINE}el\n\t#else\n\t#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)\n\tCPU=${UNAME_MACHINE}\n\t#else\n\tCPU=\n\t#endif\n\t#endif\nEOF\n\teval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`\n\ttest x\"${CPU}\" != x && { echo \"${CPU}-unknown-linux-gnu\"; exit; }\n\t;;\n    or32:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    padre:Linux:*:*)\n\techo sparc-unknown-linux-gnu\n\texit ;;\n    parisc64:Linux:*:* | hppa64:Linux:*:*)\n\techo hppa64-unknown-linux-gnu\n\texit ;;\n    parisc:Linux:*:* | hppa:Linux:*:*)\n\t# Look for CPU level\n\tcase `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in\n\t  PA7*) echo hppa1.1-unknown-linux-gnu ;;\n\t  PA8*) echo hppa2.0-unknown-linux-gnu ;;\n\t  *)    echo hppa-unknown-linux-gnu ;;\n\tesac\n\texit ;;\n    ppc64:Linux:*:*)\n\techo powerpc64-unknown-linux-gnu\n\texit ;;\n    ppc:Linux:*:*)\n\techo powerpc-unknown-linux-gnu\n\texit ;;\n    s390:Linux:*:* | s390x:Linux:*:*)\n\techo ${UNAME_MACHINE}-ibm-linux\n\texit ;;\n    sh64*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    sh*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    sparc:Linux:*:* | sparc64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    tile*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    vax:Linux:*:*)\n\techo ${UNAME_MACHINE}-dec-linux-gnu\n\texit ;;\n    x86_64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    xtensa*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    i*86:DYNIX/ptx:4*:*)\n\t# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.\n\t# earlier versions are messed up and put the nodename in both\n\t# sysname and nodename.\n\techo i386-sequent-sysv4\n\texit ;;\n    i*86:UNIX_SV:4.2MP:2.*)\n\t# Unixware is an offshoot of SVR4, but it has its own version\n\t# number series starting with 2...\n\t# I am not positive that other SVR4 systems won't match this,\n\t# I just have to hope.  -- rms.\n\t# Use sysv4.2uw... so that sysv4* matches it.\n\techo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}\n\texit ;;\n    i*86:OS/2:*:*)\n\t# If we were able to find `uname', then EMX Unix compatibility\n\t# is probably installed.\n\techo ${UNAME_MACHINE}-pc-os2-emx\n\texit ;;\n    i*86:XTS-300:*:STOP)\n\techo ${UNAME_MACHINE}-unknown-stop\n\texit ;;\n    i*86:atheos:*:*)\n\techo ${UNAME_MACHINE}-unknown-atheos\n\texit ;;\n    i*86:syllable:*:*)\n\techo ${UNAME_MACHINE}-pc-syllable\n\texit ;;\n    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)\n\techo i386-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    i*86:*DOS:*:*)\n\techo ${UNAME_MACHINE}-pc-msdosdjgpp\n\texit ;;\n    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)\n\tUNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\\/MP$//'`\n\tif grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then\n\t\techo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}\n\telse\n\t\techo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}\n\tfi\n\texit ;;\n    i*86:*:5:[678]*)\n\t# UnixWare 7.x, OpenUNIX and OpenServer 6.\n\tcase `/bin/uname -X | grep \"^Machine\"` in\n\t    *486*)\t     UNAME_MACHINE=i486 ;;\n\t    *Pentium)\t     UNAME_MACHINE=i586 ;;\n\t    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;\n\tesac\n\techo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}\n\texit ;;\n    i*86:*:3.2:*)\n\tif test -f /usr/options/cb.name; then\n\t\tUNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`\n\t\techo ${UNAME_MACHINE}-pc-isc$UNAME_REL\n\telif /bin/uname -X 2>/dev/null >/dev/null ; then\n\t\tUNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`\n\t\t(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486\n\t\t(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i586\n\t\t(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i686\n\t\t(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i686\n\t\techo ${UNAME_MACHINE}-pc-sco$UNAME_REL\n\telse\n\t\techo ${UNAME_MACHINE}-pc-sysv32\n\tfi\n\texit ;;\n    pc:*:*:*)\n\t# Left here for compatibility:\n\t# uname -m prints for DJGPP always 'pc', but it prints nothing about\n\t# the processor, so we play safe by assuming i586.\n\t# Note: whatever this is, it MUST be the same as what config.sub\n\t# prints for the \"djgpp\" host, or else GDB configury will decide that\n\t# this is a cross-build.\n\techo i586-pc-msdosdjgpp\n\texit ;;\n    Intel:Mach:3*:*)\n\techo i386-pc-mach3\n\texit ;;\n    paragon:*:*:*)\n\techo i860-intel-osf1\n\texit ;;\n    i860:*:4.*:*) # i860-SVR4\n\tif grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then\n\t  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4\n\telse # Add other i860-SVR4 vendors below as they are discovered.\n\t  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4\n\tfi\n\texit ;;\n    mini*:CTIX:SYS*5:*)\n\t# \"miniframe\"\n\techo m68010-convergent-sysv\n\texit ;;\n    mc68k:UNIX:SYSTEM5:3.51m)\n\techo m68k-convergent-sysv\n\texit ;;\n    M680?0:D-NIX:5.3:*)\n\techo m68k-diab-dnix\n\texit ;;\n    M68*:*:R3V[5678]*:*)\n\ttest -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;\n    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)\n\tOS_REL=''\n\ttest -r /etc/.relid \\\n\t&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \\([0-9][0-9]\\).*/\\1/p' < /etc/.relid`\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \\\n\t  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;\n    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t  && { echo i486-ncr-sysv4; exit; } ;;\n    NCR*:*:4.2:* | MPRAS*:*:4.2:*)\n\tOS_REL='.3'\n\ttest -r /etc/.relid \\\n\t    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \\([0-9][0-9]\\).*/\\1/p' < /etc/.relid`\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \\\n\t    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \\\n\t    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;\n    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)\n\techo m68k-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    mc68030:UNIX_System_V:4.*:*)\n\techo m68k-atari-sysv4\n\texit ;;\n    TSUNAMI:LynxOS:2.*:*)\n\techo sparc-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    rs6000:LynxOS:2.*:*)\n\techo rs6000-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)\n\techo powerpc-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    SM[BE]S:UNIX_SV:*:*)\n\techo mips-dde-sysv${UNAME_RELEASE}\n\texit ;;\n    RM*:ReliantUNIX-*:*:*)\n\techo mips-sni-sysv4\n\texit ;;\n    RM*:SINIX-*:*:*)\n\techo mips-sni-sysv4\n\texit ;;\n    *:SINIX-*:*:*)\n\tif uname -p 2>/dev/null >/dev/null ; then\n\t\tUNAME_MACHINE=`(uname -p) 2>/dev/null`\n\t\techo ${UNAME_MACHINE}-sni-sysv4\n\telse\n\t\techo ns32k-sni-sysv\n\tfi\n\texit ;;\n    PENTIUM:*:4.0*:*)\t# Unisys `ClearPath HMP IX 4000' SVR4/MP effort\n\t\t\t# says <Richard.M.Bartel@ccMail.Census.GOV>\n\techo i586-unisys-sysv4\n\texit ;;\n    *:UNIX_System_V:4*:FTX*)\n\t# From Gerald Hewes <hewes@openmarket.com>.\n\t# How about differentiating between stratus architectures? -djm\n\techo hppa1.1-stratus-sysv4\n\texit ;;\n    *:*:*:FTX*)\n\t# From seanf@swdc.stratus.com.\n\techo i860-stratus-sysv4\n\texit ;;\n    i*86:VOS:*:*)\n\t# From Paul.Green@stratus.com.\n\techo ${UNAME_MACHINE}-stratus-vos\n\texit ;;\n    *:VOS:*:*)\n\t# From Paul.Green@stratus.com.\n\techo hppa1.1-stratus-vos\n\texit ;;\n    mc68*:A/UX:*:*)\n\techo m68k-apple-aux${UNAME_RELEASE}\n\texit ;;\n    news*:NEWS-OS:6*:*)\n\techo mips-sony-newsos6\n\texit ;;\n    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)\n\tif [ -d /usr/nec ]; then\n\t\techo mips-nec-sysv${UNAME_RELEASE}\n\telse\n\t\techo mips-unknown-sysv${UNAME_RELEASE}\n\tfi\n\texit ;;\n    BeBox:BeOS:*:*)\t# BeOS running on hardware made by Be, PPC only.\n\techo powerpc-be-beos\n\texit ;;\n    BeMac:BeOS:*:*)\t# BeOS running on Mac or Mac clone, PPC only.\n\techo powerpc-apple-beos\n\texit ;;\n    BePC:BeOS:*:*)\t# BeOS running on Intel PC compatible.\n\techo i586-pc-beos\n\texit ;;\n    BePC:Haiku:*:*)\t# Haiku running on Intel PC compatible.\n\techo i586-pc-haiku\n\texit ;;\n    SX-4:SUPER-UX:*:*)\n\techo sx4-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-5:SUPER-UX:*:*)\n\techo sx5-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-6:SUPER-UX:*:*)\n\techo sx6-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-7:SUPER-UX:*:*)\n\techo sx7-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-8:SUPER-UX:*:*)\n\techo sx8-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-8R:SUPER-UX:*:*)\n\techo sx8r-nec-superux${UNAME_RELEASE}\n\texit ;;\n    Power*:Rhapsody:*:*)\n\techo powerpc-apple-rhapsody${UNAME_RELEASE}\n\texit ;;\n    *:Rhapsody:*:*)\n\techo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}\n\texit ;;\n    *:Darwin:*:*)\n\tUNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown\n\tcase $UNAME_PROCESSOR in\n\t    i386)\n\t\teval $set_cc_for_build\n\t\tif [ \"$CC_FOR_BUILD\" != 'no_compiler_found' ]; then\n\t\t  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \\\n\t\t      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \\\n\t\t      grep IS_64BIT_ARCH >/dev/null\n\t\t  then\n\t\t      UNAME_PROCESSOR=\"x86_64\"\n\t\t  fi\n\t\tfi ;;\n\t    unknown) UNAME_PROCESSOR=powerpc ;;\n\tesac\n\techo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}\n\texit ;;\n    *:procnto*:*:* | *:QNX:[0123456789]*:*)\n\tUNAME_PROCESSOR=`uname -p`\n\tif test \"$UNAME_PROCESSOR\" = \"x86\"; then\n\t\tUNAME_PROCESSOR=i386\n\t\tUNAME_MACHINE=pc\n\tfi\n\techo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}\n\texit ;;\n    *:QNX:*:4*)\n\techo i386-pc-qnx\n\texit ;;\n    NEO-?:NONSTOP_KERNEL:*:*)\n\techo neo-tandem-nsk${UNAME_RELEASE}\n\texit ;;\n    NSE-?:NONSTOP_KERNEL:*:*)\n\techo nse-tandem-nsk${UNAME_RELEASE}\n\texit ;;\n    NSR-?:NONSTOP_KERNEL:*:*)\n\techo nsr-tandem-nsk${UNAME_RELEASE}\n\texit ;;\n    *:NonStop-UX:*:*)\n\techo mips-compaq-nonstopux\n\texit ;;\n    BS2000:POSIX*:*:*)\n\techo bs2000-siemens-sysv\n\texit ;;\n    DS/*:UNIX_System_V:*:*)\n\techo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}\n\texit ;;\n    *:Plan9:*:*)\n\t# \"uname -m\" is not consistent, so use $cputype instead. 386\n\t# is converted to i386 for consistency with other x86\n\t# operating systems.\n\tif test \"$cputype\" = \"386\"; then\n\t    UNAME_MACHINE=i386\n\telse\n\t    UNAME_MACHINE=\"$cputype\"\n\tfi\n\techo ${UNAME_MACHINE}-unknown-plan9\n\texit ;;\n    *:TOPS-10:*:*)\n\techo pdp10-unknown-tops10\n\texit ;;\n    *:TENEX:*:*)\n\techo pdp10-unknown-tenex\n\texit ;;\n    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)\n\techo pdp10-dec-tops20\n\texit ;;\n    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)\n\techo pdp10-xkl-tops20\n\texit ;;\n    *:TOPS-20:*:*)\n\techo pdp10-unknown-tops20\n\texit ;;\n    *:ITS:*:*)\n\techo pdp10-unknown-its\n\texit ;;\n    SEI:*:*:SEIUX)\n\techo mips-sei-seiux${UNAME_RELEASE}\n\texit ;;\n    *:DragonFly:*:*)\n\techo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`\n\texit ;;\n    *:*VMS:*:*)\n\tUNAME_MACHINE=`(uname -p) 2>/dev/null`\n\tcase \"${UNAME_MACHINE}\" in\n\t    A*) echo alpha-dec-vms ; exit ;;\n\t    I*) echo ia64-dec-vms ; exit ;;\n\t    V*) echo vax-dec-vms ; exit ;;\n\tesac ;;\n    *:XENIX:*:SysV)\n\techo i386-pc-xenix\n\texit ;;\n    i*86:skyos:*:*)\n\techo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'\n\texit ;;\n    i*86:rdos:*:*)\n\techo ${UNAME_MACHINE}-pc-rdos\n\texit ;;\n    i*86:AROS:*:*)\n\techo ${UNAME_MACHINE}-pc-aros\n\texit ;;\n    x86_64:VMkernel:*:*)\n\techo ${UNAME_MACHINE}-unknown-esx\n\texit ;;\nesac\n\n#echo '(No uname command or uname output not recognized.)' 1>&2\n#echo \"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}\" 1>&2\n\neval $set_cc_for_build\ncat >$dummy.c <<EOF\n#ifdef _SEQUENT_\n# include <sys/types.h>\n# include <sys/utsname.h>\n#endif\nmain ()\n{\n#if defined (sony)\n#if defined (MIPSEB)\n  /* BFD wants \"bsd\" instead of \"newsos\".  Perhaps BFD should be changed,\n     I don't know....  */\n  printf (\"mips-sony-bsd\\n\"); exit (0);\n#else\n#include <sys/param.h>\n  printf (\"m68k-sony-newsos%s\\n\",\n#ifdef NEWSOS4\n\t\"4\"\n#else\n\t\"\"\n#endif\n\t); exit (0);\n#endif\n#endif\n\n#if defined (__arm) && defined (__acorn) && defined (__unix)\n  printf (\"arm-acorn-riscix\\n\"); exit (0);\n#endif\n\n#if defined (hp300) && !defined (hpux)\n  printf (\"m68k-hp-bsd\\n\"); exit (0);\n#endif\n\n#if defined (NeXT)\n#if !defined (__ARCHITECTURE__)\n#define __ARCHITECTURE__ \"m68k\"\n#endif\n  int version;\n  version=`(hostinfo | sed -n 's/.*NeXT Mach \\([0-9]*\\).*/\\1/p') 2>/dev/null`;\n  if (version < 4)\n    printf (\"%s-next-nextstep%d\\n\", __ARCHITECTURE__, version);\n  else\n    printf (\"%s-next-openstep%d\\n\", __ARCHITECTURE__, version);\n  exit (0);\n#endif\n\n#if defined (MULTIMAX) || defined (n16)\n#if defined (UMAXV)\n  printf (\"ns32k-encore-sysv\\n\"); exit (0);\n#else\n#if defined (CMU)\n  printf (\"ns32k-encore-mach\\n\"); exit (0);\n#else\n  printf (\"ns32k-encore-bsd\\n\"); exit (0);\n#endif\n#endif\n#endif\n\n#if defined (__386BSD__)\n  printf (\"i386-pc-bsd\\n\"); exit (0);\n#endif\n\n#if defined (sequent)\n#if defined (i386)\n  printf (\"i386-sequent-dynix\\n\"); exit (0);\n#endif\n#if defined (ns32000)\n  printf (\"ns32k-sequent-dynix\\n\"); exit (0);\n#endif\n#endif\n\n#if defined (_SEQUENT_)\n    struct utsname un;\n\n    uname(&un);\n\n    if (strncmp(un.version, \"V2\", 2) == 0) {\n\tprintf (\"i386-sequent-ptx2\\n\"); exit (0);\n    }\n    if (strncmp(un.version, \"V1\", 2) == 0) { /* XXX is V1 correct? */\n\tprintf (\"i386-sequent-ptx1\\n\"); exit (0);\n    }\n    printf (\"i386-sequent-ptx\\n\"); exit (0);\n\n#endif\n\n#if defined (vax)\n# if !defined (ultrix)\n#  include <sys/param.h>\n#  if defined (BSD)\n#   if BSD == 43\n      printf (\"vax-dec-bsd4.3\\n\"); exit (0);\n#   else\n#    if BSD == 199006\n      printf (\"vax-dec-bsd4.3reno\\n\"); exit (0);\n#    else\n      printf (\"vax-dec-bsd\\n\"); exit (0);\n#    endif\n#   endif\n#  else\n    printf (\"vax-dec-bsd\\n\"); exit (0);\n#  endif\n# else\n    printf (\"vax-dec-ultrix\\n\"); exit (0);\n# endif\n#endif\n\n#if defined (alliant) && defined (i860)\n  printf (\"i860-alliant-bsd\\n\"); exit (0);\n#endif\n\n  exit (1);\n}\nEOF\n\n$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&\n\t{ echo \"$SYSTEM_NAME\"; exit; }\n\n# Apollos put the system type in the environment.\n\ntest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }\n\n# Convex versions that predate uname can use getsysinfo(1)\n\nif [ -x /usr/convex/getsysinfo ]\nthen\n    case `getsysinfo -f cpu_type` in\n    c1*)\n\techo c1-convex-bsd\n\texit ;;\n    c2*)\n\tif getsysinfo -f scalar_acc\n\tthen echo c32-convex-bsd\n\telse echo c2-convex-bsd\n\tfi\n\texit ;;\n    c34*)\n\techo c34-convex-bsd\n\texit ;;\n    c38*)\n\techo c38-convex-bsd\n\texit ;;\n    c4*)\n\techo c4-convex-bsd\n\texit ;;\n    esac\nfi\n\ncat >&2 <<EOF\n$0: unable to guess system type\n\nThis script, last modified $timestamp, has failed to recognize\nthe operating system you are using. It is advised that you\ndownload the most up to date version of the config scripts from\n\n  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD\nand\n  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD\n\nIf the version you run ($0) is already up to date, please\nsend the following data and any information you think might be\npertinent to <config-patches@gnu.org> in order to provide the needed\ninformation to handle your system.\n\nconfig.guess timestamp = $timestamp\n\nuname -m = `(uname -m) 2>/dev/null || echo unknown`\nuname -r = `(uname -r) 2>/dev/null || echo unknown`\nuname -s = `(uname -s) 2>/dev/null || echo unknown`\nuname -v = `(uname -v) 2>/dev/null || echo unknown`\n\n/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`\n/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`\n\nhostinfo               = `(hostinfo) 2>/dev/null`\n/bin/universe          = `(/bin/universe) 2>/dev/null`\n/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`\n/bin/arch              = `(/bin/arch) 2>/dev/null`\n/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`\n/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`\n\nUNAME_MACHINE = ${UNAME_MACHINE}\nUNAME_RELEASE = ${UNAME_RELEASE}\nUNAME_SYSTEM  = ${UNAME_SYSTEM}\nUNAME_VERSION = ${UNAME_VERSION}\nEOF\n\nexit 1\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"
  },
  {
    "path": "Tests/gtest/build-aux/config.h.in",
    "content": "/* build-aux/config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#undef HAVE_DLFCN_H\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#undef HAVE_INTTYPES_H\n\n/* Define to 1 if you have the <memory.h> header file. */\n#undef HAVE_MEMORY_H\n\n/* Define if you have POSIX threads libraries and header files. */\n#undef HAVE_PTHREAD\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#undef HAVE_STDINT_H\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#undef HAVE_STDLIB_H\n\n/* Define to 1 if you have the <strings.h> header file. */\n#undef HAVE_STRINGS_H\n\n/* Define to 1 if you have the <string.h> header file. */\n#undef HAVE_STRING_H\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#undef HAVE_SYS_STAT_H\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#undef HAVE_SYS_TYPES_H\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#undef HAVE_UNISTD_H\n\n/* Define to the sub-directory in which libtool stores uninstalled libraries.\n   */\n#undef LT_OBJDIR\n\n/* Name of package */\n#undef PACKAGE\n\n/* Define to the address where bug reports for this package should be sent. */\n#undef PACKAGE_BUGREPORT\n\n/* Define to the full name of this package. */\n#undef PACKAGE_NAME\n\n/* Define to the full name and version of this package. */\n#undef PACKAGE_STRING\n\n/* Define to the one symbol short name of this package. */\n#undef PACKAGE_TARNAME\n\n/* Define to the home page for this package. */\n#undef PACKAGE_URL\n\n/* Define to the version of this package. */\n#undef PACKAGE_VERSION\n\n/* Define to necessary symbol if this constant uses a non-standard name on\n   your system. */\n#undef PTHREAD_CREATE_JOINABLE\n\n/* Define to 1 if you have the ANSI C header files. */\n#undef STDC_HEADERS\n\n/* Version number of package */\n#undef VERSION\n"
  },
  {
    "path": "Tests/gtest/build-aux/config.sub",
    "content": "#! /bin/sh\n# Configuration validation subroutine script.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,\n#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n#   2011, 2012 Free Software Foundation, Inc.\n\ntimestamp='2012-02-10'\n\n# This file is (in principle) common to ALL GNU software.\n# The presence of a machine in this file suggests that SOME GNU software\n# can handle that machine.  It does not imply ALL GNU software can.\n#\n# This file is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <http://www.gnu.org/licenses/>.\n#\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n\n# Please send patches to <config-patches@gnu.org>.  Submit a context\n# diff and a properly formatted GNU ChangeLog entry.\n#\n# Configuration subroutine to validate and canonicalize a configuration type.\n# Supply the specified configuration type as an argument.\n# If it is invalid, we print an error message on stderr and exit with code 1.\n# Otherwise, we print the canonical config type on stdout and succeed.\n\n# You can get the latest version of this script from:\n# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD\n\n# This file is supposed to be the same for all GNU packages\n# and recognize all the CPU types, system types and aliases\n# that are meaningful with *any* GNU software.\n# Each package is responsible for reporting which valid configurations\n# it does not support.  The user should be able to distinguish\n# a failure to support a valid configuration from a meaningless\n# configuration.\n\n# The goal of this file is to map all the various variations of a given\n# machine specification into a single specification in the form:\n#\tCPU_TYPE-MANUFACTURER-OPERATING_SYSTEM\n# or in some cases, the newer four-part form:\n#\tCPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM\n# It is wrong to echo any other type of specification.\n\nme=`echo \"$0\" | sed -e 's,.*/,,'`\n\nusage=\"\\\nUsage: $0 [OPTION] CPU-MFR-OPSYS\n       $0 [OPTION] ALIAS\n\nCanonicalize a configuration name.\n\nOperation modes:\n  -h, --help         print this help, then exit\n  -t, --time-stamp   print date of last modification, then exit\n  -v, --version      print version number, then exit\n\nReport bugs and patches to <config-patches@gnu.org>.\"\n\nversion=\"\\\nGNU config.sub ($timestamp)\n\nCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,\n2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012\nFree Software Foundation, Inc.\n\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\"\n\nhelp=\"\nTry \\`$me --help' for more information.\"\n\n# Parse command line\nwhile test $# -gt 0 ; do\n  case $1 in\n    --time-stamp | --time* | -t )\n       echo \"$timestamp\" ; exit ;;\n    --version | -v )\n       echo \"$version\" ; exit ;;\n    --help | --h* | -h )\n       echo \"$usage\"; exit ;;\n    -- )     # Stop option processing\n       shift; break ;;\n    - )\t# Use stdin as input.\n       break ;;\n    -* )\n       echo \"$me: invalid option $1$help\"\n       exit 1 ;;\n\n    *local*)\n       # First pass through any local machine types.\n       echo $1\n       exit ;;\n\n    * )\n       break ;;\n  esac\ndone\n\ncase $# in\n 0) echo \"$me: missing argument$help\" >&2\n    exit 1;;\n 1) ;;\n *) echo \"$me: too many arguments$help\" >&2\n    exit 1;;\nesac\n\n# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).\n# Here we must recognize all the valid KERNEL-OS combinations.\nmaybe_os=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\2/'`\ncase $maybe_os in\n  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \\\n  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \\\n  knetbsd*-gnu* | netbsd*-gnu* | \\\n  kopensolaris*-gnu* | \\\n  storm-chaos* | os2-emx* | rtmk-nova*)\n    os=-$maybe_os\n    basic_machine=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\1/'`\n    ;;\n  android-linux)\n    os=-linux-android\n    basic_machine=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\1/'`-unknown\n    ;;\n  *)\n    basic_machine=`echo $1 | sed 's/-[^-]*$//'`\n    if [ $basic_machine != $1 ]\n    then os=`echo $1 | sed 's/.*-/-/'`\n    else os=; fi\n    ;;\nesac\n\n### Let's recognize common machines as not being operating systems so\n### that things like config.sub decstation-3100 work.  We also\n### recognize some manufacturers as not being operating systems, so we\n### can provide default operating systems below.\ncase $os in\n\t-sun*os*)\n\t\t# Prevent following clause from handling this invalid input.\n\t\t;;\n\t-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \\\n\t-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \\\n\t-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \\\n\t-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\\\n\t-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \\\n\t-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \\\n\t-apple | -axis | -knuth | -cray | -microblaze)\n\t\tos=\n\t\tbasic_machine=$1\n\t\t;;\n\t-bluegene*)\n\t\tos=-cnk\n\t\t;;\n\t-sim | -cisco | -oki | -wec | -winbond)\n\t\tos=\n\t\tbasic_machine=$1\n\t\t;;\n\t-scout)\n\t\t;;\n\t-wrs)\n\t\tos=-vxworks\n\t\tbasic_machine=$1\n\t\t;;\n\t-chorusos*)\n\t\tos=-chorusos\n\t\tbasic_machine=$1\n\t\t;;\n\t-chorusrdb)\n\t\tos=-chorusrdb\n\t\tbasic_machine=$1\n\t\t;;\n\t-hiux*)\n\t\tos=-hiuxwe2\n\t\t;;\n\t-sco6)\n\t\tos=-sco5v6\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco5)\n\t\tos=-sco3.2v5\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco4)\n\t\tos=-sco3.2v4\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco3.2.[4-9]*)\n\t\tos=`echo $os | sed -e 's/sco3.2./sco3.2v/'`\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco3.2v[4-9]*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco5v6*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco*)\n\t\tos=-sco3.2v2\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-udk*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-isc)\n\t\tos=-isc2.2\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-clix*)\n\t\tbasic_machine=clipper-intergraph\n\t\t;;\n\t-isc*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-lynx*)\n\t\tos=-lynxos\n\t\t;;\n\t-ptx*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`\n\t\t;;\n\t-windowsnt*)\n\t\tos=`echo $os | sed -e 's/windowsnt/winnt/'`\n\t\t;;\n\t-psos*)\n\t\tos=-psos\n\t\t;;\n\t-mint | -mint[0-9]*)\n\t\tbasic_machine=m68k-atari\n\t\tos=-mint\n\t\t;;\nesac\n\n# Decode aliases for certain CPU-COMPANY combinations.\ncase $basic_machine in\n\t# Recognize the basic CPU types without company name.\n\t# Some are omitted here because they have special meanings below.\n\t1750a | 580 \\\n\t| a29k \\\n\t| aarch64 | aarch64_be \\\n\t| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \\\n\t| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \\\n\t| am33_2.0 \\\n\t| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \\\n        | be32 | be64 \\\n\t| bfin \\\n\t| c4x | clipper \\\n\t| d10v | d30v | dlx | dsp16xx \\\n\t| epiphany \\\n\t| fido | fr30 | frv \\\n\t| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \\\n\t| hexagon \\\n\t| i370 | i860 | i960 | ia64 \\\n\t| ip2k | iq2000 \\\n\t| le32 | le64 \\\n\t| lm32 \\\n\t| m32c | m32r | m32rle | m68000 | m68k | m88k \\\n\t| maxq | mb | microblaze | mcore | mep | metag \\\n\t| mips | mipsbe | mipseb | mipsel | mipsle \\\n\t| mips16 \\\n\t| mips64 | mips64el \\\n\t| mips64octeon | mips64octeonel \\\n\t| mips64orion | mips64orionel \\\n\t| mips64r5900 | mips64r5900el \\\n\t| mips64vr | mips64vrel \\\n\t| mips64vr4100 | mips64vr4100el \\\n\t| mips64vr4300 | mips64vr4300el \\\n\t| mips64vr5000 | mips64vr5000el \\\n\t| mips64vr5900 | mips64vr5900el \\\n\t| mipsisa32 | mipsisa32el \\\n\t| mipsisa32r2 | mipsisa32r2el \\\n\t| mipsisa64 | mipsisa64el \\\n\t| mipsisa64r2 | mipsisa64r2el \\\n\t| mipsisa64sb1 | mipsisa64sb1el \\\n\t| mipsisa64sr71k | mipsisa64sr71kel \\\n\t| mipstx39 | mipstx39el \\\n\t| mn10200 | mn10300 \\\n\t| moxie \\\n\t| mt \\\n\t| msp430 \\\n\t| nds32 | nds32le | nds32be \\\n\t| nios | nios2 \\\n\t| ns16k | ns32k \\\n\t| open8 \\\n\t| or32 \\\n\t| pdp10 | pdp11 | pj | pjl \\\n\t| powerpc | powerpc64 | powerpc64le | powerpcle \\\n\t| pyramid \\\n\t| rl78 | rx \\\n\t| score \\\n\t| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \\\n\t| sh64 | sh64le \\\n\t| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \\\n\t| sparcv8 | sparcv9 | sparcv9b | sparcv9v \\\n\t| spu \\\n\t| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \\\n\t| ubicom32 \\\n\t| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \\\n\t| we32k \\\n\t| x86 | xc16x | xstormy16 | xtensa \\\n\t| z8k | z80)\n\t\tbasic_machine=$basic_machine-unknown\n\t\t;;\n\tc54x)\n\t\tbasic_machine=tic54x-unknown\n\t\t;;\n\tc55x)\n\t\tbasic_machine=tic55x-unknown\n\t\t;;\n\tc6x)\n\t\tbasic_machine=tic6x-unknown\n\t\t;;\n\tm6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=-none\n\t\t;;\n\tm88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)\n\t\t;;\n\tms1)\n\t\tbasic_machine=mt-unknown\n\t\t;;\n\n\tstrongarm | thumb | xscale)\n\t\tbasic_machine=arm-unknown\n\t\t;;\n\txgate)\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=-none\n\t\t;;\n\txscaleeb)\n\t\tbasic_machine=armeb-unknown\n\t\t;;\n\n\txscaleel)\n\t\tbasic_machine=armel-unknown\n\t\t;;\n\n\t# We use `pc' rather than `unknown'\n\t# because (1) that's what they normally are, and\n\t# (2) the word \"unknown\" tends to confuse beginning users.\n\ti*86 | x86_64)\n\t  basic_machine=$basic_machine-pc\n\t  ;;\n\t# Object if more than one company name word.\n\t*-*-*)\n\t\techo Invalid configuration \\`$1\\': machine \\`$basic_machine\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\n\t# Recognize the basic CPU types with company name.\n\t580-* \\\n\t| a29k-* \\\n\t| aarch64-* | aarch64_be-* \\\n\t| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \\\n\t| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \\\n\t| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \\\n\t| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \\\n\t| avr-* | avr32-* \\\n\t| be32-* | be64-* \\\n\t| bfin-* | bs2000-* \\\n\t| c[123]* | c30-* | [cjt]90-* | c4x-* \\\n\t| clipper-* | craynv-* | cydra-* \\\n\t| d10v-* | d30v-* | dlx-* \\\n\t| elxsi-* \\\n\t| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \\\n\t| h8300-* | h8500-* \\\n\t| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \\\n\t| hexagon-* \\\n\t| i*86-* | i860-* | i960-* | ia64-* \\\n\t| ip2k-* | iq2000-* \\\n\t| le32-* | le64-* \\\n\t| lm32-* \\\n\t| m32c-* | m32r-* | m32rle-* \\\n\t| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \\\n\t| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \\\n\t| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \\\n\t| mips16-* \\\n\t| mips64-* | mips64el-* \\\n\t| mips64octeon-* | mips64octeonel-* \\\n\t| mips64orion-* | mips64orionel-* \\\n\t| mips64r5900-* | mips64r5900el-* \\\n\t| mips64vr-* | mips64vrel-* \\\n\t| mips64vr4100-* | mips64vr4100el-* \\\n\t| mips64vr4300-* | mips64vr4300el-* \\\n\t| mips64vr5000-* | mips64vr5000el-* \\\n\t| mips64vr5900-* | mips64vr5900el-* \\\n\t| mipsisa32-* | mipsisa32el-* \\\n\t| mipsisa32r2-* | mipsisa32r2el-* \\\n\t| mipsisa64-* | mipsisa64el-* \\\n\t| mipsisa64r2-* | mipsisa64r2el-* \\\n\t| mipsisa64sb1-* | mipsisa64sb1el-* \\\n\t| mipsisa64sr71k-* | mipsisa64sr71kel-* \\\n\t| mipstx39-* | mipstx39el-* \\\n\t| mmix-* \\\n\t| mt-* \\\n\t| msp430-* \\\n\t| nds32-* | nds32le-* | nds32be-* \\\n\t| nios-* | nios2-* \\\n\t| none-* | np1-* | ns16k-* | ns32k-* \\\n\t| open8-* \\\n\t| orion-* \\\n\t| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \\\n\t| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \\\n\t| pyramid-* \\\n\t| rl78-* | romp-* | rs6000-* | rx-* \\\n\t| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \\\n\t| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \\\n\t| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \\\n\t| sparclite-* \\\n\t| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \\\n\t| tahoe-* \\\n\t| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \\\n\t| tile*-* \\\n\t| tron-* \\\n\t| ubicom32-* \\\n\t| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \\\n\t| vax-* \\\n\t| we32k-* \\\n\t| x86-* | x86_64-* | xc16x-* | xps100-* \\\n\t| xstormy16-* | xtensa*-* \\\n\t| ymp-* \\\n\t| z8k-* | z80-*)\n\t\t;;\n\t# Recognize the basic CPU types without company name, with glob match.\n\txtensa*)\n\t\tbasic_machine=$basic_machine-unknown\n\t\t;;\n\t# Recognize the various machine names and aliases which stand\n\t# for a CPU type and a company and sometimes even an OS.\n\t386bsd)\n\t\tbasic_machine=i386-unknown\n\t\tos=-bsd\n\t\t;;\n\t3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)\n\t\tbasic_machine=m68000-att\n\t\t;;\n\t3b*)\n\t\tbasic_machine=we32k-att\n\t\t;;\n\ta29khif)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tabacus)\n\t\tbasic_machine=abacus-unknown\n\t\t;;\n\tadobe68k)\n\t\tbasic_machine=m68010-adobe\n\t\tos=-scout\n\t\t;;\n\talliant | fx80)\n\t\tbasic_machine=fx80-alliant\n\t\t;;\n\taltos | altos3068)\n\t\tbasic_machine=m68k-altos\n\t\t;;\n\tam29k)\n\t\tbasic_machine=a29k-none\n\t\tos=-bsd\n\t\t;;\n\tamd64)\n\t\tbasic_machine=x86_64-pc\n\t\t;;\n\tamd64-*)\n\t\tbasic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tamdahl)\n\t\tbasic_machine=580-amdahl\n\t\tos=-sysv\n\t\t;;\n\tamiga | amiga-*)\n\t\tbasic_machine=m68k-unknown\n\t\t;;\n\tamigaos | amigados)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-amigaos\n\t\t;;\n\tamigaunix | amix)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-sysv4\n\t\t;;\n\tapollo68)\n\t\tbasic_machine=m68k-apollo\n\t\tos=-sysv\n\t\t;;\n\tapollo68bsd)\n\t\tbasic_machine=m68k-apollo\n\t\tos=-bsd\n\t\t;;\n\taros)\n\t\tbasic_machine=i386-pc\n\t\tos=-aros\n\t\t;;\n\taux)\n\t\tbasic_machine=m68k-apple\n\t\tos=-aux\n\t\t;;\n\tbalance)\n\t\tbasic_machine=ns32k-sequent\n\t\tos=-dynix\n\t\t;;\n\tblackfin)\n\t\tbasic_machine=bfin-unknown\n\t\tos=-linux\n\t\t;;\n\tblackfin-*)\n\t\tbasic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\tos=-linux\n\t\t;;\n\tbluegene*)\n\t\tbasic_machine=powerpc-ibm\n\t\tos=-cnk\n\t\t;;\n\tc54x-*)\n\t\tbasic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tc55x-*)\n\t\tbasic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tc6x-*)\n\t\tbasic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tc90)\n\t\tbasic_machine=c90-cray\n\t\tos=-unicos\n\t\t;;\n\tcegcc)\n\t\tbasic_machine=arm-unknown\n\t\tos=-cegcc\n\t\t;;\n\tconvex-c1)\n\t\tbasic_machine=c1-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c2)\n\t\tbasic_machine=c2-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c32)\n\t\tbasic_machine=c32-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c34)\n\t\tbasic_machine=c34-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c38)\n\t\tbasic_machine=c38-convex\n\t\tos=-bsd\n\t\t;;\n\tcray | j90)\n\t\tbasic_machine=j90-cray\n\t\tos=-unicos\n\t\t;;\n\tcraynv)\n\t\tbasic_machine=craynv-cray\n\t\tos=-unicosmp\n\t\t;;\n\tcr16 | cr16-*)\n\t\tbasic_machine=cr16-unknown\n\t\tos=-elf\n\t\t;;\n\tcrds | unos)\n\t\tbasic_machine=m68k-crds\n\t\t;;\n\tcrisv32 | crisv32-* | etraxfs*)\n\t\tbasic_machine=crisv32-axis\n\t\t;;\n\tcris | cris-* | etrax*)\n\t\tbasic_machine=cris-axis\n\t\t;;\n\tcrx)\n\t\tbasic_machine=crx-unknown\n\t\tos=-elf\n\t\t;;\n\tda30 | da30-*)\n\t\tbasic_machine=m68k-da30\n\t\t;;\n\tdecstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)\n\t\tbasic_machine=mips-dec\n\t\t;;\n\tdecsystem10* | dec10*)\n\t\tbasic_machine=pdp10-dec\n\t\tos=-tops10\n\t\t;;\n\tdecsystem20* | dec20*)\n\t\tbasic_machine=pdp10-dec\n\t\tos=-tops20\n\t\t;;\n\tdelta | 3300 | motorola-3300 | motorola-delta \\\n\t      | 3300-motorola | delta-motorola)\n\t\tbasic_machine=m68k-motorola\n\t\t;;\n\tdelta88)\n\t\tbasic_machine=m88k-motorola\n\t\tos=-sysv3\n\t\t;;\n\tdicos)\n\t\tbasic_machine=i686-pc\n\t\tos=-dicos\n\t\t;;\n\tdjgpp)\n\t\tbasic_machine=i586-pc\n\t\tos=-msdosdjgpp\n\t\t;;\n\tdpx20 | dpx20-*)\n\t\tbasic_machine=rs6000-bull\n\t\tos=-bosx\n\t\t;;\n\tdpx2* | dpx2*-bull)\n\t\tbasic_machine=m68k-bull\n\t\tos=-sysv3\n\t\t;;\n\tebmon29k)\n\t\tbasic_machine=a29k-amd\n\t\tos=-ebmon\n\t\t;;\n\telxsi)\n\t\tbasic_machine=elxsi-elxsi\n\t\tos=-bsd\n\t\t;;\n\tencore | umax | mmax)\n\t\tbasic_machine=ns32k-encore\n\t\t;;\n\tes1800 | OSE68k | ose68k | ose | OSE)\n\t\tbasic_machine=m68k-ericsson\n\t\tos=-ose\n\t\t;;\n\tfx2800)\n\t\tbasic_machine=i860-alliant\n\t\t;;\n\tgenix)\n\t\tbasic_machine=ns32k-ns\n\t\t;;\n\tgmicro)\n\t\tbasic_machine=tron-gmicro\n\t\tos=-sysv\n\t\t;;\n\tgo32)\n\t\tbasic_machine=i386-pc\n\t\tos=-go32\n\t\t;;\n\th3050r* | hiux*)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=-hiuxwe2\n\t\t;;\n\th8300hms)\n\t\tbasic_machine=h8300-hitachi\n\t\tos=-hms\n\t\t;;\n\th8300xray)\n\t\tbasic_machine=h8300-hitachi\n\t\tos=-xray\n\t\t;;\n\th8500hms)\n\t\tbasic_machine=h8500-hitachi\n\t\tos=-hms\n\t\t;;\n\tharris)\n\t\tbasic_machine=m88k-harris\n\t\tos=-sysv3\n\t\t;;\n\thp300-*)\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp300bsd)\n\t\tbasic_machine=m68k-hp\n\t\tos=-bsd\n\t\t;;\n\thp300hpux)\n\t\tbasic_machine=m68k-hp\n\t\tos=-hpux\n\t\t;;\n\thp3k9[0-9][0-9] | hp9[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thp9k2[0-9][0-9] | hp9k31[0-9])\n\t\tbasic_machine=m68000-hp\n\t\t;;\n\thp9k3[2-9][0-9])\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp9k6[0-9][0-9] | hp6[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thp9k7[0-79][0-9] | hp7[0-79][0-9])\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k78[0-9] | hp78[0-9])\n\t\t# FIXME: really hppa2.0-hp\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)\n\t\t# FIXME: really hppa2.0-hp\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[0-9][13679] | hp8[0-9][13679])\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[0-9][0-9] | hp8[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thppa-next)\n\t\tos=-nextstep3\n\t\t;;\n\thppaosf)\n\t\tbasic_machine=hppa1.1-hp\n\t\tos=-osf\n\t\t;;\n\thppro)\n\t\tbasic_machine=hppa1.1-hp\n\t\tos=-proelf\n\t\t;;\n\ti370-ibm* | ibm*)\n\t\tbasic_machine=i370-ibm\n\t\t;;\n\ti*86v32)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-sysv32\n\t\t;;\n\ti*86v4*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-sysv4\n\t\t;;\n\ti*86v)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-sysv\n\t\t;;\n\ti*86sol2)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-solaris2\n\t\t;;\n\ti386mach)\n\t\tbasic_machine=i386-mach\n\t\tos=-mach\n\t\t;;\n\ti386-vsta | vsta)\n\t\tbasic_machine=i386-unknown\n\t\tos=-vsta\n\t\t;;\n\tiris | iris4d)\n\t\tbasic_machine=mips-sgi\n\t\tcase $os in\n\t\t    -irix*)\n\t\t\t;;\n\t\t    *)\n\t\t\tos=-irix4\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tisi68 | isi)\n\t\tbasic_machine=m68k-isi\n\t\tos=-sysv\n\t\t;;\n\tm68knommu)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-linux\n\t\t;;\n\tm68knommu-*)\n\t\tbasic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\tos=-linux\n\t\t;;\n\tm88k-omron*)\n\t\tbasic_machine=m88k-omron\n\t\t;;\n\tmagnum | m3230)\n\t\tbasic_machine=mips-mips\n\t\tos=-sysv\n\t\t;;\n\tmerlin)\n\t\tbasic_machine=ns32k-utek\n\t\tos=-sysv\n\t\t;;\n\tmicroblaze)\n\t\tbasic_machine=microblaze-xilinx\n\t\t;;\n\tmingw32)\n\t\tbasic_machine=i386-pc\n\t\tos=-mingw32\n\t\t;;\n\tmingw32ce)\n\t\tbasic_machine=arm-unknown\n\t\tos=-mingw32ce\n\t\t;;\n\tminiframe)\n\t\tbasic_machine=m68000-convergent\n\t\t;;\n\t*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)\n\t\tbasic_machine=m68k-atari\n\t\tos=-mint\n\t\t;;\n\tmips3*-*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`\n\t\t;;\n\tmips3*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown\n\t\t;;\n\tmonitor)\n\t\tbasic_machine=m68k-rom68k\n\t\tos=-coff\n\t\t;;\n\tmorphos)\n\t\tbasic_machine=powerpc-unknown\n\t\tos=-morphos\n\t\t;;\n\tmsdos)\n\t\tbasic_machine=i386-pc\n\t\tos=-msdos\n\t\t;;\n\tms1-*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`\n\t\t;;\n\tmsys)\n\t\tbasic_machine=i386-pc\n\t\tos=-msys\n\t\t;;\n\tmvs)\n\t\tbasic_machine=i370-ibm\n\t\tos=-mvs\n\t\t;;\n\tnacl)\n\t\tbasic_machine=le32-unknown\n\t\tos=-nacl\n\t\t;;\n\tncr3000)\n\t\tbasic_machine=i486-ncr\n\t\tos=-sysv4\n\t\t;;\n\tnetbsd386)\n\t\tbasic_machine=i386-unknown\n\t\tos=-netbsd\n\t\t;;\n\tnetwinder)\n\t\tbasic_machine=armv4l-rebel\n\t\tos=-linux\n\t\t;;\n\tnews | news700 | news800 | news900)\n\t\tbasic_machine=m68k-sony\n\t\tos=-newsos\n\t\t;;\n\tnews1000)\n\t\tbasic_machine=m68030-sony\n\t\tos=-newsos\n\t\t;;\n\tnews-3600 | risc-news)\n\t\tbasic_machine=mips-sony\n\t\tos=-newsos\n\t\t;;\n\tnecv70)\n\t\tbasic_machine=v70-nec\n\t\tos=-sysv\n\t\t;;\n\tnext | m*-next )\n\t\tbasic_machine=m68k-next\n\t\tcase $os in\n\t\t    -nextstep* )\n\t\t\t;;\n\t\t    -ns2*)\n\t\t      os=-nextstep2\n\t\t\t;;\n\t\t    *)\n\t\t      os=-nextstep3\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tnh3000)\n\t\tbasic_machine=m68k-harris\n\t\tos=-cxux\n\t\t;;\n\tnh[45]000)\n\t\tbasic_machine=m88k-harris\n\t\tos=-cxux\n\t\t;;\n\tnindy960)\n\t\tbasic_machine=i960-intel\n\t\tos=-nindy\n\t\t;;\n\tmon960)\n\t\tbasic_machine=i960-intel\n\t\tos=-mon960\n\t\t;;\n\tnonstopux)\n\t\tbasic_machine=mips-compaq\n\t\tos=-nonstopux\n\t\t;;\n\tnp1)\n\t\tbasic_machine=np1-gould\n\t\t;;\n\tneo-tandem)\n\t\tbasic_machine=neo-tandem\n\t\t;;\n\tnse-tandem)\n\t\tbasic_machine=nse-tandem\n\t\t;;\n\tnsr-tandem)\n\t\tbasic_machine=nsr-tandem\n\t\t;;\n\top50n-* | op60c-*)\n\t\tbasic_machine=hppa1.1-oki\n\t\tos=-proelf\n\t\t;;\n\topenrisc | openrisc-*)\n\t\tbasic_machine=or32-unknown\n\t\t;;\n\tos400)\n\t\tbasic_machine=powerpc-ibm\n\t\tos=-os400\n\t\t;;\n\tOSE68000 | ose68000)\n\t\tbasic_machine=m68000-ericsson\n\t\tos=-ose\n\t\t;;\n\tos68k)\n\t\tbasic_machine=m68k-none\n\t\tos=-os68k\n\t\t;;\n\tpa-hitachi)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=-hiuxwe2\n\t\t;;\n\tparagon)\n\t\tbasic_machine=i860-intel\n\t\tos=-osf\n\t\t;;\n\tparisc)\n\t\tbasic_machine=hppa-unknown\n\t\tos=-linux\n\t\t;;\n\tparisc-*)\n\t\tbasic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\tos=-linux\n\t\t;;\n\tpbd)\n\t\tbasic_machine=sparc-tti\n\t\t;;\n\tpbb)\n\t\tbasic_machine=m68k-tti\n\t\t;;\n\tpc532 | pc532-*)\n\t\tbasic_machine=ns32k-pc532\n\t\t;;\n\tpc98)\n\t\tbasic_machine=i386-pc\n\t\t;;\n\tpc98-*)\n\t\tbasic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentium | p5 | k5 | k6 | nexgen | viac3)\n\t\tbasic_machine=i586-pc\n\t\t;;\n\tpentiumpro | p6 | 6x86 | athlon | athlon_*)\n\t\tbasic_machine=i686-pc\n\t\t;;\n\tpentiumii | pentium2 | pentiumiii | pentium3)\n\t\tbasic_machine=i686-pc\n\t\t;;\n\tpentium4)\n\t\tbasic_machine=i786-pc\n\t\t;;\n\tpentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)\n\t\tbasic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentiumpro-* | p6-* | 6x86-* | athlon-*)\n\t\tbasic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)\n\t\tbasic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentium4-*)\n\t\tbasic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpn)\n\t\tbasic_machine=pn-gould\n\t\t;;\n\tpower)\tbasic_machine=power-ibm\n\t\t;;\n\tppc | ppcbe)\tbasic_machine=powerpc-unknown\n\t\t;;\n\tppc-* | ppcbe-*)\n\t\tbasic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tppcle | powerpclittle | ppc-le | powerpc-little)\n\t\tbasic_machine=powerpcle-unknown\n\t\t;;\n\tppcle-* | powerpclittle-*)\n\t\tbasic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tppc64)\tbasic_machine=powerpc64-unknown\n\t\t;;\n\tppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tppc64le | powerpc64little | ppc64-le | powerpc64-little)\n\t\tbasic_machine=powerpc64le-unknown\n\t\t;;\n\tppc64le-* | powerpc64little-*)\n\t\tbasic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tps2)\n\t\tbasic_machine=i386-ibm\n\t\t;;\n\tpw32)\n\t\tbasic_machine=i586-unknown\n\t\tos=-pw32\n\t\t;;\n\trdos)\n\t\tbasic_machine=i386-pc\n\t\tos=-rdos\n\t\t;;\n\trom68k)\n\t\tbasic_machine=m68k-rom68k\n\t\tos=-coff\n\t\t;;\n\trm[46]00)\n\t\tbasic_machine=mips-siemens\n\t\t;;\n\trtpc | rtpc-*)\n\t\tbasic_machine=romp-ibm\n\t\t;;\n\ts390 | s390-*)\n\t\tbasic_machine=s390-ibm\n\t\t;;\n\ts390x | s390x-*)\n\t\tbasic_machine=s390x-ibm\n\t\t;;\n\tsa29200)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tsb1)\n\t\tbasic_machine=mipsisa64sb1-unknown\n\t\t;;\n\tsb1el)\n\t\tbasic_machine=mipsisa64sb1el-unknown\n\t\t;;\n\tsde)\n\t\tbasic_machine=mipsisa32-sde\n\t\tos=-elf\n\t\t;;\n\tsei)\n\t\tbasic_machine=mips-sei\n\t\tos=-seiux\n\t\t;;\n\tsequent)\n\t\tbasic_machine=i386-sequent\n\t\t;;\n\tsh)\n\t\tbasic_machine=sh-hitachi\n\t\tos=-hms\n\t\t;;\n\tsh5el)\n\t\tbasic_machine=sh5le-unknown\n\t\t;;\n\tsh64)\n\t\tbasic_machine=sh64-unknown\n\t\t;;\n\tsparclite-wrs | simso-wrs)\n\t\tbasic_machine=sparclite-wrs\n\t\tos=-vxworks\n\t\t;;\n\tsps7)\n\t\tbasic_machine=m68k-bull\n\t\tos=-sysv2\n\t\t;;\n\tspur)\n\t\tbasic_machine=spur-unknown\n\t\t;;\n\tst2000)\n\t\tbasic_machine=m68k-tandem\n\t\t;;\n\tstratus)\n\t\tbasic_machine=i860-stratus\n\t\tos=-sysv4\n\t\t;;\n\tstrongarm-* | thumb-*)\n\t\tbasic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tsun2)\n\t\tbasic_machine=m68000-sun\n\t\t;;\n\tsun2os3)\n\t\tbasic_machine=m68000-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun2os4)\n\t\tbasic_machine=m68000-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun3os3)\n\t\tbasic_machine=m68k-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun3os4)\n\t\tbasic_machine=m68k-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun4os3)\n\t\tbasic_machine=sparc-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun4os4)\n\t\tbasic_machine=sparc-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun4sol2)\n\t\tbasic_machine=sparc-sun\n\t\tos=-solaris2\n\t\t;;\n\tsun3 | sun3-*)\n\t\tbasic_machine=m68k-sun\n\t\t;;\n\tsun4)\n\t\tbasic_machine=sparc-sun\n\t\t;;\n\tsun386 | sun386i | roadrunner)\n\t\tbasic_machine=i386-sun\n\t\t;;\n\tsv1)\n\t\tbasic_machine=sv1-cray\n\t\tos=-unicos\n\t\t;;\n\tsymmetry)\n\t\tbasic_machine=i386-sequent\n\t\tos=-dynix\n\t\t;;\n\tt3e)\n\t\tbasic_machine=alphaev5-cray\n\t\tos=-unicos\n\t\t;;\n\tt90)\n\t\tbasic_machine=t90-cray\n\t\tos=-unicos\n\t\t;;\n\ttile*)\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=-linux-gnu\n\t\t;;\n\ttx39)\n\t\tbasic_machine=mipstx39-unknown\n\t\t;;\n\ttx39el)\n\t\tbasic_machine=mipstx39el-unknown\n\t\t;;\n\ttoad1)\n\t\tbasic_machine=pdp10-xkl\n\t\tos=-tops20\n\t\t;;\n\ttower | tower-32)\n\t\tbasic_machine=m68k-ncr\n\t\t;;\n\ttpf)\n\t\tbasic_machine=s390x-ibm\n\t\tos=-tpf\n\t\t;;\n\tudi29k)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tultra3)\n\t\tbasic_machine=a29k-nyu\n\t\tos=-sym1\n\t\t;;\n\tv810 | necv810)\n\t\tbasic_machine=v810-nec\n\t\tos=-none\n\t\t;;\n\tvaxv)\n\t\tbasic_machine=vax-dec\n\t\tos=-sysv\n\t\t;;\n\tvms)\n\t\tbasic_machine=vax-dec\n\t\tos=-vms\n\t\t;;\n\tvpp*|vx|vx-*)\n\t\tbasic_machine=f301-fujitsu\n\t\t;;\n\tvxworks960)\n\t\tbasic_machine=i960-wrs\n\t\tos=-vxworks\n\t\t;;\n\tvxworks68)\n\t\tbasic_machine=m68k-wrs\n\t\tos=-vxworks\n\t\t;;\n\tvxworks29k)\n\t\tbasic_machine=a29k-wrs\n\t\tos=-vxworks\n\t\t;;\n\tw65*)\n\t\tbasic_machine=w65-wdc\n\t\tos=-none\n\t\t;;\n\tw89k-*)\n\t\tbasic_machine=hppa1.1-winbond\n\t\tos=-proelf\n\t\t;;\n\txbox)\n\t\tbasic_machine=i686-pc\n\t\tos=-mingw32\n\t\t;;\n\txps | xps100)\n\t\tbasic_machine=xps100-honeywell\n\t\t;;\n\txscale-* | xscalee[bl]-*)\n\t\tbasic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`\n\t\t;;\n\tymp)\n\t\tbasic_machine=ymp-cray\n\t\tos=-unicos\n\t\t;;\n\tz8k-*-coff)\n\t\tbasic_machine=z8k-unknown\n\t\tos=-sim\n\t\t;;\n\tz80-*-coff)\n\t\tbasic_machine=z80-unknown\n\t\tos=-sim\n\t\t;;\n\tnone)\n\t\tbasic_machine=none-none\n\t\tos=-none\n\t\t;;\n\n# Here we handle the default manufacturer of certain CPU types.  It is in\n# some cases the only manufacturer, in others, it is the most popular.\n\tw89k)\n\t\tbasic_machine=hppa1.1-winbond\n\t\t;;\n\top50n)\n\t\tbasic_machine=hppa1.1-oki\n\t\t;;\n\top60c)\n\t\tbasic_machine=hppa1.1-oki\n\t\t;;\n\tromp)\n\t\tbasic_machine=romp-ibm\n\t\t;;\n\tmmix)\n\t\tbasic_machine=mmix-knuth\n\t\t;;\n\trs6000)\n\t\tbasic_machine=rs6000-ibm\n\t\t;;\n\tvax)\n\t\tbasic_machine=vax-dec\n\t\t;;\n\tpdp10)\n\t\t# there are many clones, so DEC is not a safe bet\n\t\tbasic_machine=pdp10-unknown\n\t\t;;\n\tpdp11)\n\t\tbasic_machine=pdp11-dec\n\t\t;;\n\twe32k)\n\t\tbasic_machine=we32k-att\n\t\t;;\n\tsh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)\n\t\tbasic_machine=sh-unknown\n\t\t;;\n\tsparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)\n\t\tbasic_machine=sparc-sun\n\t\t;;\n\tcydra)\n\t\tbasic_machine=cydra-cydrome\n\t\t;;\n\torion)\n\t\tbasic_machine=orion-highlevel\n\t\t;;\n\torion105)\n\t\tbasic_machine=clipper-highlevel\n\t\t;;\n\tmac | mpw | mac-mpw)\n\t\tbasic_machine=m68k-apple\n\t\t;;\n\tpmac | pmac-mpw)\n\t\tbasic_machine=powerpc-apple\n\t\t;;\n\t*-unknown)\n\t\t# Make sure to match an already-canonicalized machine name.\n\t\t;;\n\t*)\n\t\techo Invalid configuration \\`$1\\': machine \\`$basic_machine\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\nesac\n\n# Here we canonicalize certain aliases for manufacturers.\ncase $basic_machine in\n\t*-digital*)\n\t\tbasic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`\n\t\t;;\n\t*-commodore*)\n\t\tbasic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`\n\t\t;;\n\t*)\n\t\t;;\nesac\n\n# Decode manufacturer-specific aliases for certain operating systems.\n\nif [ x\"$os\" != x\"\" ]\nthen\ncase $os in\n\t# First match some system type aliases\n\t# that might get confused with valid system types.\n\t# -solaris* is a basic system type, with this one exception.\n\t-auroraux)\n\t\tos=-auroraux\n\t\t;;\n\t-solaris1 | -solaris1.*)\n\t\tos=`echo $os | sed -e 's|solaris1|sunos4|'`\n\t\t;;\n\t-solaris)\n\t\tos=-solaris2\n\t\t;;\n\t-svr4*)\n\t\tos=-sysv4\n\t\t;;\n\t-unixware*)\n\t\tos=-sysv4.2uw\n\t\t;;\n\t-gnu/linux*)\n\t\tos=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`\n\t\t;;\n\t# First accept the basic system types.\n\t# The portable systems comes first.\n\t# Each alternative MUST END IN A *, to match a version number.\n\t# -sysv* is not here because it comes later, after sysvr4.\n\t-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \\\n\t      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\\\n\t      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \\\n\t      | -sym* | -kopensolaris* \\\n\t      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \\\n\t      | -aos* | -aros* \\\n\t      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \\\n\t      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \\\n\t      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \\\n\t      | -openbsd* | -solidbsd* \\\n\t      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \\\n\t      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \\\n\t      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \\\n\t      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \\\n\t      | -chorusos* | -chorusrdb* | -cegcc* \\\n\t      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \\\n\t      | -mingw32* | -linux-gnu* | -linux-android* \\\n\t      | -linux-newlib* | -linux-uclibc* \\\n\t      | -uxpv* | -beos* | -mpeix* | -udk* \\\n\t      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \\\n\t      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \\\n\t      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \\\n\t      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \\\n\t      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \\\n\t      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \\\n\t      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)\n\t# Remember, each alternative MUST END IN *, to match a version number.\n\t\t;;\n\t-qnx*)\n\t\tcase $basic_machine in\n\t\t    x86-* | i*86-*)\n\t\t\t;;\n\t\t    *)\n\t\t\tos=-nto$os\n\t\t\t;;\n\t\tesac\n\t\t;;\n\t-nto-qnx*)\n\t\t;;\n\t-nto*)\n\t\tos=`echo $os | sed -e 's|nto|nto-qnx|'`\n\t\t;;\n\t-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \\\n\t      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \\\n\t      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)\n\t\t;;\n\t-mac*)\n\t\tos=`echo $os | sed -e 's|mac|macos|'`\n\t\t;;\n\t-linux-dietlibc)\n\t\tos=-linux-dietlibc\n\t\t;;\n\t-linux*)\n\t\tos=`echo $os | sed -e 's|linux|linux-gnu|'`\n\t\t;;\n\t-sunos5*)\n\t\tos=`echo $os | sed -e 's|sunos5|solaris2|'`\n\t\t;;\n\t-sunos6*)\n\t\tos=`echo $os | sed -e 's|sunos6|solaris3|'`\n\t\t;;\n\t-opened*)\n\t\tos=-openedition\n\t\t;;\n\t-os400*)\n\t\tos=-os400\n\t\t;;\n\t-wince*)\n\t\tos=-wince\n\t\t;;\n\t-osfrose*)\n\t\tos=-osfrose\n\t\t;;\n\t-osf*)\n\t\tos=-osf\n\t\t;;\n\t-utek*)\n\t\tos=-bsd\n\t\t;;\n\t-dynix*)\n\t\tos=-bsd\n\t\t;;\n\t-acis*)\n\t\tos=-aos\n\t\t;;\n\t-atheos*)\n\t\tos=-atheos\n\t\t;;\n\t-syllable*)\n\t\tos=-syllable\n\t\t;;\n\t-386bsd)\n\t\tos=-bsd\n\t\t;;\n\t-ctix* | -uts*)\n\t\tos=-sysv\n\t\t;;\n\t-nova*)\n\t\tos=-rtmk-nova\n\t\t;;\n\t-ns2 )\n\t\tos=-nextstep2\n\t\t;;\n\t-nsk*)\n\t\tos=-nsk\n\t\t;;\n\t# Preserve the version number of sinix5.\n\t-sinix5.*)\n\t\tos=`echo $os | sed -e 's|sinix|sysv|'`\n\t\t;;\n\t-sinix*)\n\t\tos=-sysv4\n\t\t;;\n\t-tpf*)\n\t\tos=-tpf\n\t\t;;\n\t-triton*)\n\t\tos=-sysv3\n\t\t;;\n\t-oss*)\n\t\tos=-sysv3\n\t\t;;\n\t-svr4)\n\t\tos=-sysv4\n\t\t;;\n\t-svr3)\n\t\tos=-sysv3\n\t\t;;\n\t-sysvr4)\n\t\tos=-sysv4\n\t\t;;\n\t# This must come after -sysvr4.\n\t-sysv*)\n\t\t;;\n\t-ose*)\n\t\tos=-ose\n\t\t;;\n\t-es1800*)\n\t\tos=-ose\n\t\t;;\n\t-xenix)\n\t\tos=-xenix\n\t\t;;\n\t-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)\n\t\tos=-mint\n\t\t;;\n\t-aros*)\n\t\tos=-aros\n\t\t;;\n\t-kaos*)\n\t\tos=-kaos\n\t\t;;\n\t-zvmoe)\n\t\tos=-zvmoe\n\t\t;;\n\t-dicos*)\n\t\tos=-dicos\n\t\t;;\n\t-nacl*)\n\t\t;;\n\t-none)\n\t\t;;\n\t*)\n\t\t# Get rid of the `-' at the beginning of $os.\n\t\tos=`echo $os | sed 's/[^-]*-//'`\n\t\techo Invalid configuration \\`$1\\': system \\`$os\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\nesac\nelse\n\n# Here we handle the default operating systems that come with various machines.\n# The value should be what the vendor currently ships out the door with their\n# machine or put another way, the most popular os provided with the machine.\n\n# Note that if you're going to try to match \"-MANUFACTURER\" here (say,\n# \"-sun\"), then you have to tell the case statement up towards the top\n# that MANUFACTURER isn't an operating system.  Otherwise, code above\n# will signal an error saying that MANUFACTURER isn't an operating\n# system, and we'll never get to this point.\n\ncase $basic_machine in\n\tscore-*)\n\t\tos=-elf\n\t\t;;\n\tspu-*)\n\t\tos=-elf\n\t\t;;\n\t*-acorn)\n\t\tos=-riscix1.2\n\t\t;;\n\tarm*-rebel)\n\t\tos=-linux\n\t\t;;\n\tarm*-semi)\n\t\tos=-aout\n\t\t;;\n\tc4x-* | tic4x-*)\n\t\tos=-coff\n\t\t;;\n\ttic54x-*)\n\t\tos=-coff\n\t\t;;\n\ttic55x-*)\n\t\tos=-coff\n\t\t;;\n\ttic6x-*)\n\t\tos=-coff\n\t\t;;\n\t# This must come before the *-dec entry.\n\tpdp10-*)\n\t\tos=-tops20\n\t\t;;\n\tpdp11-*)\n\t\tos=-none\n\t\t;;\n\t*-dec | vax-*)\n\t\tos=-ultrix4.2\n\t\t;;\n\tm68*-apollo)\n\t\tos=-domain\n\t\t;;\n\ti386-sun)\n\t\tos=-sunos4.0.2\n\t\t;;\n\tm68000-sun)\n\t\tos=-sunos3\n\t\t;;\n\tm68*-cisco)\n\t\tos=-aout\n\t\t;;\n\tmep-*)\n\t\tos=-elf\n\t\t;;\n\tmips*-cisco)\n\t\tos=-elf\n\t\t;;\n\tmips*-*)\n\t\tos=-elf\n\t\t;;\n\tor32-*)\n\t\tos=-coff\n\t\t;;\n\t*-tti)\t# must be before sparc entry or we get the wrong os.\n\t\tos=-sysv3\n\t\t;;\n\tsparc-* | *-sun)\n\t\tos=-sunos4.1.1\n\t\t;;\n\t*-be)\n\t\tos=-beos\n\t\t;;\n\t*-haiku)\n\t\tos=-haiku\n\t\t;;\n\t*-ibm)\n\t\tos=-aix\n\t\t;;\n\t*-knuth)\n\t\tos=-mmixware\n\t\t;;\n\t*-wec)\n\t\tos=-proelf\n\t\t;;\n\t*-winbond)\n\t\tos=-proelf\n\t\t;;\n\t*-oki)\n\t\tos=-proelf\n\t\t;;\n\t*-hp)\n\t\tos=-hpux\n\t\t;;\n\t*-hitachi)\n\t\tos=-hiux\n\t\t;;\n\ti860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)\n\t\tos=-sysv\n\t\t;;\n\t*-cbm)\n\t\tos=-amigaos\n\t\t;;\n\t*-dg)\n\t\tos=-dgux\n\t\t;;\n\t*-dolphin)\n\t\tos=-sysv3\n\t\t;;\n\tm68k-ccur)\n\t\tos=-rtu\n\t\t;;\n\tm88k-omron*)\n\t\tos=-luna\n\t\t;;\n\t*-next )\n\t\tos=-nextstep\n\t\t;;\n\t*-sequent)\n\t\tos=-ptx\n\t\t;;\n\t*-crds)\n\t\tos=-unos\n\t\t;;\n\t*-ns)\n\t\tos=-genix\n\t\t;;\n\ti370-*)\n\t\tos=-mvs\n\t\t;;\n\t*-next)\n\t\tos=-nextstep3\n\t\t;;\n\t*-gould)\n\t\tos=-sysv\n\t\t;;\n\t*-highlevel)\n\t\tos=-bsd\n\t\t;;\n\t*-encore)\n\t\tos=-bsd\n\t\t;;\n\t*-sgi)\n\t\tos=-irix\n\t\t;;\n\t*-siemens)\n\t\tos=-sysv4\n\t\t;;\n\t*-masscomp)\n\t\tos=-rtu\n\t\t;;\n\tf30[01]-fujitsu | f700-fujitsu)\n\t\tos=-uxpv\n\t\t;;\n\t*-rom68k)\n\t\tos=-coff\n\t\t;;\n\t*-*bug)\n\t\tos=-coff\n\t\t;;\n\t*-apple)\n\t\tos=-macos\n\t\t;;\n\t*-atari*)\n\t\tos=-mint\n\t\t;;\n\t*)\n\t\tos=-none\n\t\t;;\nesac\nfi\n\n# Here we handle the case where we know the os, and the CPU type, but not the\n# manufacturer.  We pick the logical manufacturer.\nvendor=unknown\ncase $basic_machine in\n\t*-unknown)\n\t\tcase $os in\n\t\t\t-riscix*)\n\t\t\t\tvendor=acorn\n\t\t\t\t;;\n\t\t\t-sunos*)\n\t\t\t\tvendor=sun\n\t\t\t\t;;\n\t\t\t-cnk*|-aix*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-beos*)\n\t\t\t\tvendor=be\n\t\t\t\t;;\n\t\t\t-hpux*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\t-mpeix*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\t-hiux*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\t-unos*)\n\t\t\t\tvendor=crds\n\t\t\t\t;;\n\t\t\t-dgux*)\n\t\t\t\tvendor=dg\n\t\t\t\t;;\n\t\t\t-luna*)\n\t\t\t\tvendor=omron\n\t\t\t\t;;\n\t\t\t-genix*)\n\t\t\t\tvendor=ns\n\t\t\t\t;;\n\t\t\t-mvs* | -opened*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-os400*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-ptx*)\n\t\t\t\tvendor=sequent\n\t\t\t\t;;\n\t\t\t-tpf*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-vxsim* | -vxworks* | -windiss*)\n\t\t\t\tvendor=wrs\n\t\t\t\t;;\n\t\t\t-aux*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\t-hms*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\t-mpw* | -macos*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\t-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)\n\t\t\t\tvendor=atari\n\t\t\t\t;;\n\t\t\t-vos*)\n\t\t\t\tvendor=stratus\n\t\t\t\t;;\n\t\tesac\n\t\tbasic_machine=`echo $basic_machine | sed \"s/unknown/$vendor/\"`\n\t\t;;\nesac\n\necho $basic_machine$os\nexit\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"
  },
  {
    "path": "Tests/gtest/build-aux/depcomp",
    "content": "#! /bin/sh\n# depcomp - compile a program generating dependencies as side-effects\n\nscriptversion=2011-12-04.11; # UTC\n\n# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,\n# 2011 Free Software Foundation, Inc.\n\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2, or (at your option)\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.\n\ncase $1 in\n  '')\n     echo \"$0: No command.  Try \\`$0 --help' for more information.\" 1>&2\n     exit 1;\n     ;;\n  -h | --h*)\n    cat <<\\EOF\nUsage: depcomp [--help] [--version] PROGRAM [ARGS]\n\nRun PROGRAMS ARGS to compile a file, generating dependencies\nas side-effects.\n\nEnvironment variables:\n  depmode     Dependency tracking mode.\n  source      Source file read by `PROGRAMS ARGS'.\n  object      Object file output by `PROGRAMS ARGS'.\n  DEPDIR      directory where to store dependencies.\n  depfile     Dependency file to output.\n  tmpdepfile  Temporary file to use when outputting dependencies.\n  libtool     Whether libtool is used (yes/no).\n\nReport bugs to <bug-automake@gnu.org>.\nEOF\n    exit $?\n    ;;\n  -v | --v*)\n    echo \"depcomp $scriptversion\"\n    exit $?\n    ;;\nesac\n\nif test -z \"$depmode\" || test -z \"$source\" || test -z \"$object\"; then\n  echo \"depcomp: Variables source, object and depmode must be set\" 1>&2\n  exit 1\nfi\n\n# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.\ndepfile=${depfile-`echo \"$object\" |\n  sed 's|[^\\\\/]*$|'${DEPDIR-.deps}'/&|;s|\\.\\([^.]*\\)$|.P\\1|;s|Pobj$|Po|'`}\ntmpdepfile=${tmpdepfile-`echo \"$depfile\" | sed 's/\\.\\([^.]*\\)$/.T\\1/'`}\n\nrm -f \"$tmpdepfile\"\n\n# Some modes work just like other modes, but use different flags.  We\n# parameterize here, but still list the modes in the big case below,\n# to make depend.m4 easier to write.  Note that we *cannot* use a case\n# here, because this file can only contain one case statement.\nif test \"$depmode\" = hp; then\n  # HP compiler uses -M and no extra arg.\n  gccflag=-M\n  depmode=gcc\nfi\n\nif test \"$depmode\" = dashXmstdout; then\n   # This is just like dashmstdout with a different argument.\n   dashmflag=-xM\n   depmode=dashmstdout\nfi\n\ncygpath_u=\"cygpath -u -f -\"\nif test \"$depmode\" = msvcmsys; then\n   # This is just like msvisualcpp but w/o cygpath translation.\n   # Just convert the backslash-escaped backslashes to single forward\n   # slashes to satisfy depend.m4\n   cygpath_u='sed s,\\\\\\\\,/,g'\n   depmode=msvisualcpp\nfi\n\nif test \"$depmode\" = msvc7msys; then\n   # This is just like msvc7 but w/o cygpath translation.\n   # Just convert the backslash-escaped backslashes to single forward\n   # slashes to satisfy depend.m4\n   cygpath_u='sed s,\\\\\\\\,/,g'\n   depmode=msvc7\nfi\n\ncase \"$depmode\" in\ngcc3)\n## gcc 3 implements dependency tracking that does exactly what\n## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like\n## it if -MD -MP comes after the -MF stuff.  Hmm.\n## Unfortunately, FreeBSD c89 acceptance of flags depends upon\n## the command line argument order; so add the flags where they\n## appear in depend2.am.  Note that the slowdown incurred here\n## affects only configure: in makefiles, %FASTDEP% shortcuts this.\n  for arg\n  do\n    case $arg in\n    -c) set fnord \"$@\" -MT \"$object\" -MD -MP -MF \"$tmpdepfile\" \"$arg\" ;;\n    *)  set fnord \"$@\" \"$arg\" ;;\n    esac\n    shift # fnord\n    shift # $arg\n  done\n  \"$@\"\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  mv \"$tmpdepfile\" \"$depfile\"\n  ;;\n\ngcc)\n## There are various ways to get dependency output from gcc.  Here's\n## why we pick this rather obscure method:\n## - Don't want to use -MD because we'd like the dependencies to end\n##   up in a subdir.  Having to rename by hand is ugly.\n##   (We might end up doing this anyway to support other compilers.)\n## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like\n##   -MM, not -M (despite what the docs say).\n## - Using -M directly means running the compiler twice (even worse\n##   than renaming).\n  if test -z \"$gccflag\"; then\n    gccflag=-MD,\n  fi\n  \"$@\" -Wp,\"$gccflag$tmpdepfile\"\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n## The second -e expression handles DOS-style file names with drive letters.\n  sed -e 's/^[^:]*: / /' \\\n      -e 's/^['$alpha']:\\/[^:]*: / /' < \"$tmpdepfile\" >> \"$depfile\"\n## This next piece of magic avoids the `deleted header file' problem.\n## The problem is that when a header file which appears in a .P file\n## is deleted, the dependency causes make to die (because there is\n## typically no way to rebuild the header).  We avoid this by adding\n## dummy dependencies for each header file.  Too bad gcc doesn't do\n## this for us directly.\n  tr ' ' '\n' < \"$tmpdepfile\" |\n## Some versions of gcc put a space before the `:'.  On the theory\n## that the space means something, we add a space to the output as\n## well.  hp depmode also adds that space, but also prefixes the VPATH\n## to the object.  Take care to not repeat it in the output.\n## Some versions of the HPUX 10.20 sed can't process this invocation\n## correctly.  Breaking it into two sed invocations is a workaround.\n    sed -e 's/^\\\\$//' -e '/^$/d' -e \"s|.*$object$||\" -e '/:$/d' \\\n      | sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nhp)\n  # This case exists only to let depend.m4 do its work.  It works by\n  # looking at the text of this script.  This case will never be run,\n  # since it is checked for above.\n  exit 1\n  ;;\n\nsgi)\n  if test \"$libtool\" = yes; then\n    \"$@\" \"-Wp,-MDupdate,$tmpdepfile\"\n  else\n    \"$@\" -MDupdate \"$tmpdepfile\"\n  fi\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n\n  if test -f \"$tmpdepfile\"; then  # yes, the sourcefile depend on other files\n    echo \"$object : \\\\\" > \"$depfile\"\n\n    # Clip off the initial element (the dependent).  Don't try to be\n    # clever and replace this with sed code, as IRIX sed won't handle\n    # lines with more than a fixed number of characters (4096 in\n    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;\n    # the IRIX cc adds comments like `#:fec' to the end of the\n    # dependency line.\n    tr ' ' '\n' < \"$tmpdepfile\" \\\n    | sed -e 's/^.*\\.o://' -e 's/#.*$//' -e '/^$/ d' | \\\n    tr '\n' ' ' >> \"$depfile\"\n    echo >> \"$depfile\"\n\n    # The second pass generates a dummy entry for each header file.\n    tr ' ' '\n' < \"$tmpdepfile\" \\\n   | sed -e 's/^.*\\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \\\n   >> \"$depfile\"\n  else\n    # The sourcefile does not contain any dependencies, so just\n    # store a dummy comment line, to avoid errors with the Makefile\n    # \"include basename.Plo\" scheme.\n    echo \"#dummy\" > \"$depfile\"\n  fi\n  rm -f \"$tmpdepfile\"\n  ;;\n\naix)\n  # The C for AIX Compiler uses -M and outputs the dependencies\n  # in a .u file.  In older versions, this file always lives in the\n  # current directory.  Also, the AIX compiler puts `$object:' at the\n  # start of each line; $object doesn't have directory information.\n  # Version 6 uses the directory in both cases.\n  dir=`echo \"$object\" | sed -e 's|/[^/]*$|/|'`\n  test \"x$dir\" = \"x$object\" && dir=\n  base=`echo \"$object\" | sed -e 's|^.*/||' -e 's/\\.o$//' -e 's/\\.lo$//'`\n  if test \"$libtool\" = yes; then\n    tmpdepfile1=$dir$base.u\n    tmpdepfile2=$base.u\n    tmpdepfile3=$dir.libs/$base.u\n    \"$@\" -Wc,-M\n  else\n    tmpdepfile1=$dir$base.u\n    tmpdepfile2=$dir$base.u\n    tmpdepfile3=$dir$base.u\n    \"$@\" -M\n  fi\n  stat=$?\n\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile1\" \"$tmpdepfile2\" \"$tmpdepfile3\"\n    exit $stat\n  fi\n\n  for tmpdepfile in \"$tmpdepfile1\" \"$tmpdepfile2\" \"$tmpdepfile3\"\n  do\n    test -f \"$tmpdepfile\" && break\n  done\n  if test -f \"$tmpdepfile\"; then\n    # Each line is of the form `foo.o: dependent.h'.\n    # Do two passes, one to just change these to\n    # `$object: dependent.h' and one to simply `dependent.h:'.\n    sed -e \"s,^.*\\.[a-z]*:,$object:,\" < \"$tmpdepfile\" > \"$depfile\"\n    # That's a tab and a space in the [].\n    sed -e 's,^.*\\.[a-z]*:[\t ]*,,' -e 's,$,:,' < \"$tmpdepfile\" >> \"$depfile\"\n  else\n    # The sourcefile does not contain any dependencies, so just\n    # store a dummy comment line, to avoid errors with the Makefile\n    # \"include basename.Plo\" scheme.\n    echo \"#dummy\" > \"$depfile\"\n  fi\n  rm -f \"$tmpdepfile\"\n  ;;\n\nicc)\n  # Intel's C compiler understands `-MD -MF file'.  However on\n  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c\n  # ICC 7.0 will fill foo.d with something like\n  #    foo.o: sub/foo.c\n  #    foo.o: sub/foo.h\n  # which is wrong.  We want:\n  #    sub/foo.o: sub/foo.c\n  #    sub/foo.o: sub/foo.h\n  #    sub/foo.c:\n  #    sub/foo.h:\n  # ICC 7.1 will output\n  #    foo.o: sub/foo.c sub/foo.h\n  # and will wrap long lines using \\ :\n  #    foo.o: sub/foo.c ... \\\n  #     sub/foo.h ... \\\n  #     ...\n\n  \"$@\" -MD -MF \"$tmpdepfile\"\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n  # Each line is of the form `foo.o: dependent.h',\n  # or `foo.o: dep1.h dep2.h \\', or ` dep3.h dep4.h \\'.\n  # Do two passes, one to just change these to\n  # `$object: dependent.h' and one to simply `dependent.h:'.\n  sed \"s,^[^:]*:,$object :,\" < \"$tmpdepfile\" > \"$depfile\"\n  # Some versions of the HPUX 10.20 sed can't process this invocation\n  # correctly.  Breaking it into two sed invocations is a workaround.\n  sed 's,^[^:]*: \\(.*\\)$,\\1,;s/^\\\\$//;/^$/d;/:$/d' < \"$tmpdepfile\" |\n    sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nhp2)\n  # The \"hp\" stanza above does not work with aCC (C++) and HP's ia64\n  # compilers, which have integrated preprocessors.  The correct option\n  # to use with these is +Maked; it writes dependencies to a file named\n  # 'foo.d', which lands next to the object file, wherever that\n  # happens to be.\n  # Much of this is similar to the tru64 case; see comments there.\n  dir=`echo \"$object\" | sed -e 's|/[^/]*$|/|'`\n  test \"x$dir\" = \"x$object\" && dir=\n  base=`echo \"$object\" | sed -e 's|^.*/||' -e 's/\\.o$//' -e 's/\\.lo$//'`\n  if test \"$libtool\" = yes; then\n    tmpdepfile1=$dir$base.d\n    tmpdepfile2=$dir.libs/$base.d\n    \"$@\" -Wc,+Maked\n  else\n    tmpdepfile1=$dir$base.d\n    tmpdepfile2=$dir$base.d\n    \"$@\" +Maked\n  fi\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n     rm -f \"$tmpdepfile1\" \"$tmpdepfile2\"\n     exit $stat\n  fi\n\n  for tmpdepfile in \"$tmpdepfile1\" \"$tmpdepfile2\"\n  do\n    test -f \"$tmpdepfile\" && break\n  done\n  if test -f \"$tmpdepfile\"; then\n    sed -e \"s,^.*\\.[a-z]*:,$object:,\" \"$tmpdepfile\" > \"$depfile\"\n    # Add `dependent.h:' lines.\n    sed -ne '2,${\n\t       s/^ *//\n\t       s/ \\\\*$//\n\t       s/$/:/\n\t       p\n\t     }' \"$tmpdepfile\" >> \"$depfile\"\n  else\n    echo \"#dummy\" > \"$depfile\"\n  fi\n  rm -f \"$tmpdepfile\" \"$tmpdepfile2\"\n  ;;\n\ntru64)\n   # The Tru64 compiler uses -MD to generate dependencies as a side\n   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.\n   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put\n   # dependencies in `foo.d' instead, so we check for that too.\n   # Subdirectories are respected.\n   dir=`echo \"$object\" | sed -e 's|/[^/]*$|/|'`\n   test \"x$dir\" = \"x$object\" && dir=\n   base=`echo \"$object\" | sed -e 's|^.*/||' -e 's/\\.o$//' -e 's/\\.lo$//'`\n\n   if test \"$libtool\" = yes; then\n      # With Tru64 cc, shared objects can also be used to make a\n      # static library.  This mechanism is used in libtool 1.4 series to\n      # handle both shared and static libraries in a single compilation.\n      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.\n      #\n      # With libtool 1.5 this exception was removed, and libtool now\n      # generates 2 separate objects for the 2 libraries.  These two\n      # compilations output dependencies in $dir.libs/$base.o.d and\n      # in $dir$base.o.d.  We have to check for both files, because\n      # one of the two compilations can be disabled.  We should prefer\n      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is\n      # automatically cleaned when .libs/ is deleted, while ignoring\n      # the former would cause a distcleancheck panic.\n      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4\n      tmpdepfile2=$dir$base.o.d          # libtool 1.5\n      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5\n      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504\n      \"$@\" -Wc,-MD\n   else\n      tmpdepfile1=$dir$base.o.d\n      tmpdepfile2=$dir$base.d\n      tmpdepfile3=$dir$base.d\n      tmpdepfile4=$dir$base.d\n      \"$@\" -MD\n   fi\n\n   stat=$?\n   if test $stat -eq 0; then :\n   else\n      rm -f \"$tmpdepfile1\" \"$tmpdepfile2\" \"$tmpdepfile3\" \"$tmpdepfile4\"\n      exit $stat\n   fi\n\n   for tmpdepfile in \"$tmpdepfile1\" \"$tmpdepfile2\" \"$tmpdepfile3\" \"$tmpdepfile4\"\n   do\n     test -f \"$tmpdepfile\" && break\n   done\n   if test -f \"$tmpdepfile\"; then\n      sed -e \"s,^.*\\.[a-z]*:,$object:,\" < \"$tmpdepfile\" > \"$depfile\"\n      # That's a tab and a space in the [].\n      sed -e 's,^.*\\.[a-z]*:[\t ]*,,' -e 's,$,:,' < \"$tmpdepfile\" >> \"$depfile\"\n   else\n      echo \"#dummy\" > \"$depfile\"\n   fi\n   rm -f \"$tmpdepfile\"\n   ;;\n\nmsvc7)\n  if test \"$libtool\" = yes; then\n    showIncludes=-Wc,-showIncludes\n  else\n    showIncludes=-showIncludes\n  fi\n  \"$@\" $showIncludes > \"$tmpdepfile\"\n  stat=$?\n  grep -v '^Note: including file: ' \"$tmpdepfile\"\n  if test \"$stat\" = 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  # The first sed program below extracts the file names and escapes\n  # backslashes for cygpath.  The second sed program outputs the file\n  # name when reading, but also accumulates all include files in the\n  # hold buffer in order to output them again at the end.  This only\n  # works with sed implementations that can handle large buffers.\n  sed < \"$tmpdepfile\" -n '\n/^Note: including file:  *\\(.*\\)/ {\n  s//\\1/\n  s/\\\\/\\\\\\\\/g\n  p\n}' | $cygpath_u | sort -u | sed -n '\ns/ /\\\\ /g\ns/\\(.*\\)/\t\\1 \\\\/p\ns/.\\(.*\\) \\\\/\\1:/\nH\n$ {\n  s/.*/\t/\n  G\n  p\n}' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nmsvc7msys)\n  # This case exists only to let depend.m4 do its work.  It works by\n  # looking at the text of this script.  This case will never be run,\n  # since it is checked for above.\n  exit 1\n  ;;\n\n#nosideeffect)\n  # This comment above is used by automake to tell side-effect\n  # dependency tracking mechanisms from slower ones.\n\ndashmstdout)\n  # Important note: in order to support this mode, a compiler *must*\n  # always write the preprocessed file to stdout, regardless of -o.\n  \"$@\" || exit $?\n\n  # Remove the call to Libtool.\n  if test \"$libtool\" = yes; then\n    while test \"X$1\" != 'X--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n\n  # Remove `-o $object'.\n  IFS=\" \"\n  for arg\n  do\n    case $arg in\n    -o)\n      shift\n      ;;\n    $object)\n      shift\n      ;;\n    *)\n      set fnord \"$@\" \"$arg\"\n      shift # fnord\n      shift # $arg\n      ;;\n    esac\n  done\n\n  test -z \"$dashmflag\" && dashmflag=-M\n  # Require at least two characters before searching for `:'\n  # in the target name.  This is to cope with DOS-style filenames:\n  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.\n  \"$@\" $dashmflag |\n    sed 's:^[  ]*[^: ][^:][^:]*\\:[    ]*:'\"$object\"'\\: :' > \"$tmpdepfile\"\n  rm -f \"$depfile\"\n  cat < \"$tmpdepfile\" > \"$depfile\"\n  tr ' ' '\n' < \"$tmpdepfile\" | \\\n## Some versions of the HPUX 10.20 sed can't process this invocation\n## correctly.  Breaking it into two sed invocations is a workaround.\n    sed -e 's/^\\\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\ndashXmstdout)\n  # This case only exists to satisfy depend.m4.  It is never actually\n  # run, as this mode is specially recognized in the preamble.\n  exit 1\n  ;;\n\nmakedepend)\n  \"$@\" || exit $?\n  # Remove any Libtool call\n  if test \"$libtool\" = yes; then\n    while test \"X$1\" != 'X--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n  # X makedepend\n  shift\n  cleared=no eat=no\n  for arg\n  do\n    case $cleared in\n    no)\n      set \"\"; shift\n      cleared=yes ;;\n    esac\n    if test $eat = yes; then\n      eat=no\n      continue\n    fi\n    case \"$arg\" in\n    -D*|-I*)\n      set fnord \"$@\" \"$arg\"; shift ;;\n    # Strip any option that makedepend may not understand.  Remove\n    # the object too, otherwise makedepend will parse it as a source file.\n    -arch)\n      eat=yes ;;\n    -*|$object)\n      ;;\n    *)\n      set fnord \"$@\" \"$arg\"; shift ;;\n    esac\n  done\n  obj_suffix=`echo \"$object\" | sed 's/^.*\\././'`\n  touch \"$tmpdepfile\"\n  ${MAKEDEPEND-makedepend} -o\"$obj_suffix\" -f\"$tmpdepfile\" \"$@\"\n  rm -f \"$depfile\"\n  # makedepend may prepend the VPATH from the source file name to the object.\n  # No need to regex-escape $object, excess matching of '.' is harmless.\n  sed \"s|^.*\\($object *:\\)|\\1|\" \"$tmpdepfile\" > \"$depfile\"\n  sed '1,2d' \"$tmpdepfile\" | tr ' ' '\n' | \\\n## Some versions of the HPUX 10.20 sed can't process this invocation\n## correctly.  Breaking it into two sed invocations is a workaround.\n    sed -e 's/^\\\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\" \"$tmpdepfile\".bak\n  ;;\n\ncpp)\n  # Important note: in order to support this mode, a compiler *must*\n  # always write the preprocessed file to stdout.\n  \"$@\" || exit $?\n\n  # Remove the call to Libtool.\n  if test \"$libtool\" = yes; then\n    while test \"X$1\" != 'X--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n\n  # Remove `-o $object'.\n  IFS=\" \"\n  for arg\n  do\n    case $arg in\n    -o)\n      shift\n      ;;\n    $object)\n      shift\n      ;;\n    *)\n      set fnord \"$@\" \"$arg\"\n      shift # fnord\n      shift # $arg\n      ;;\n    esac\n  done\n\n  \"$@\" -E |\n    sed -n -e '/^# [0-9][0-9]* \"\\([^\"]*\\)\".*/ s:: \\1 \\\\:p' \\\n       -e '/^#line [0-9][0-9]* \"\\([^\"]*\\)\".*/ s:: \\1 \\\\:p' |\n    sed '$ s: \\\\$::' > \"$tmpdepfile\"\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  cat < \"$tmpdepfile\" >> \"$depfile\"\n  sed < \"$tmpdepfile\" '/^$/d;s/^ //;s/ \\\\$//;s/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nmsvisualcpp)\n  # Important note: in order to support this mode, a compiler *must*\n  # always write the preprocessed file to stdout.\n  \"$@\" || exit $?\n\n  # Remove the call to Libtool.\n  if test \"$libtool\" = yes; then\n    while test \"X$1\" != 'X--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n\n  IFS=\" \"\n  for arg\n  do\n    case \"$arg\" in\n    -o)\n      shift\n      ;;\n    $object)\n      shift\n      ;;\n    \"-Gm\"|\"/Gm\"|\"-Gi\"|\"/Gi\"|\"-ZI\"|\"/ZI\")\n\tset fnord \"$@\"\n\tshift\n\tshift\n\t;;\n    *)\n\tset fnord \"$@\" \"$arg\"\n\tshift\n\tshift\n\t;;\n    esac\n  done\n  \"$@\" -E 2>/dev/null |\n  sed -n '/^#line [0-9][0-9]* \"\\([^\"]*\\)\"/ s::\\1:p' | $cygpath_u | sort -u > \"$tmpdepfile\"\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  sed < \"$tmpdepfile\" -n -e 's% %\\\\ %g' -e '/^\\(.*\\)$/ s::\t\\1 \\\\:p' >> \"$depfile\"\n  echo \"\t\" >> \"$depfile\"\n  sed < \"$tmpdepfile\" -n -e 's% %\\\\ %g' -e '/^\\(.*\\)$/ s::\\1\\::p' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nmsvcmsys)\n  # This case exists only to let depend.m4 do its work.  It works by\n  # looking at the text of this script.  This case will never be run,\n  # since it is checked for above.\n  exit 1\n  ;;\n\nnone)\n  exec \"$@\"\n  ;;\n\n*)\n  echo \"Unknown depmode $depmode\" 1>&2\n  exit 1\n  ;;\nesac\n\nexit 0\n\n# Local Variables:\n# mode: shell-script\n# sh-indentation: 2\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-time-zone: \"UTC\"\n# time-stamp-end: \"; # UTC\"\n# End:\n"
  },
  {
    "path": "Tests/gtest/build-aux/install-sh",
    "content": "#!/bin/sh\n# install - install a program, script, or datafile\n\nscriptversion=2011-01-19.21; # UTC\n\n# This originates from X11R5 (mit/util/scripts/install.sh), which was\n# later released in X11R6 (xc/config/util/install.sh) with the\n# following copyright and license.\n#\n# Copyright (C) 1994 X Consortium\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to\n# deal in the Software without restriction, including without limitation the\n# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n# sell copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\n# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-\n# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n#\n# Except as contained in this notice, the name of the X Consortium shall not\n# be used in advertising or otherwise to promote the sale, use or other deal-\n# ings in this Software without prior written authorization from the X Consor-\n# tium.\n#\n#\n# FSF changes to this file are in the public domain.\n#\n# Calling this script install-sh is preferred over install.sh, to prevent\n# `make' implicit rules from creating a file called install from it\n# when there is no Makefile.\n#\n# This script is compatible with the BSD install script, but was written\n# from scratch.\n\nnl='\n'\nIFS=\" \"\"\t$nl\"\n\n# set DOITPROG to echo to test this script\n\n# Don't use :- since 4.3BSD and earlier shells don't like it.\ndoit=${DOITPROG-}\nif test -z \"$doit\"; then\n  doit_exec=exec\nelse\n  doit_exec=$doit\nfi\n\n# Put in absolute file names if you don't have them in your path;\n# or use environment vars.\n\nchgrpprog=${CHGRPPROG-chgrp}\nchmodprog=${CHMODPROG-chmod}\nchownprog=${CHOWNPROG-chown}\ncmpprog=${CMPPROG-cmp}\ncpprog=${CPPROG-cp}\nmkdirprog=${MKDIRPROG-mkdir}\nmvprog=${MVPROG-mv}\nrmprog=${RMPROG-rm}\nstripprog=${STRIPPROG-strip}\n\nposix_glob='?'\ninitialize_posix_glob='\n  test \"$posix_glob\" != \"?\" || {\n    if (set -f) 2>/dev/null; then\n      posix_glob=\n    else\n      posix_glob=:\n    fi\n  }\n'\n\nposix_mkdir=\n\n# Desired mode of installed file.\nmode=0755\n\nchgrpcmd=\nchmodcmd=$chmodprog\nchowncmd=\nmvcmd=$mvprog\nrmcmd=\"$rmprog -f\"\nstripcmd=\n\nsrc=\ndst=\ndir_arg=\ndst_arg=\n\ncopy_on_change=false\nno_target_directory=\n\nusage=\"\\\nUsage: $0 [OPTION]... [-T] SRCFILE DSTFILE\n   or: $0 [OPTION]... SRCFILES... DIRECTORY\n   or: $0 [OPTION]... -t DIRECTORY SRCFILES...\n   or: $0 [OPTION]... -d DIRECTORIES...\n\nIn the 1st form, copy SRCFILE to DSTFILE.\nIn the 2nd and 3rd, copy all SRCFILES to DIRECTORY.\nIn the 4th, create DIRECTORIES.\n\nOptions:\n     --help     display this help and exit.\n     --version  display version info and exit.\n\n  -c            (ignored)\n  -C            install only if different (preserve the last data modification time)\n  -d            create directories instead of installing files.\n  -g GROUP      $chgrpprog installed files to GROUP.\n  -m MODE       $chmodprog installed files to MODE.\n  -o USER       $chownprog installed files to USER.\n  -s            $stripprog installed files.\n  -t DIRECTORY  install into DIRECTORY.\n  -T            report an error if DSTFILE is a directory.\n\nEnvironment variables override the default commands:\n  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG\n  RMPROG STRIPPROG\n\"\n\nwhile test $# -ne 0; do\n  case $1 in\n    -c) ;;\n\n    -C) copy_on_change=true;;\n\n    -d) dir_arg=true;;\n\n    -g) chgrpcmd=\"$chgrpprog $2\"\n\tshift;;\n\n    --help) echo \"$usage\"; exit $?;;\n\n    -m) mode=$2\n\tcase $mode in\n\t  *' '* | *'\t'* | *'\n'*\t  | *'*'* | *'?'* | *'['*)\n\t    echo \"$0: invalid mode: $mode\" >&2\n\t    exit 1;;\n\tesac\n\tshift;;\n\n    -o) chowncmd=\"$chownprog $2\"\n\tshift;;\n\n    -s) stripcmd=$stripprog;;\n\n    -t) dst_arg=$2\n\t# Protect names problematic for `test' and other utilities.\n\tcase $dst_arg in\n\t  -* | [=\\(\\)!]) dst_arg=./$dst_arg;;\n\tesac\n\tshift;;\n\n    -T) no_target_directory=true;;\n\n    --version) echo \"$0 $scriptversion\"; exit $?;;\n\n    --)\tshift\n\tbreak;;\n\n    -*)\techo \"$0: invalid option: $1\" >&2\n\texit 1;;\n\n    *)  break;;\n  esac\n  shift\ndone\n\nif test $# -ne 0 && test -z \"$dir_arg$dst_arg\"; then\n  # When -d is used, all remaining arguments are directories to create.\n  # When -t is used, the destination is already specified.\n  # Otherwise, the last argument is the destination.  Remove it from $@.\n  for arg\n  do\n    if test -n \"$dst_arg\"; then\n      # $@ is not empty: it contains at least $arg.\n      set fnord \"$@\" \"$dst_arg\"\n      shift # fnord\n    fi\n    shift # arg\n    dst_arg=$arg\n    # Protect names problematic for `test' and other utilities.\n    case $dst_arg in\n      -* | [=\\(\\)!]) dst_arg=./$dst_arg;;\n    esac\n  done\nfi\n\nif test $# -eq 0; then\n  if test -z \"$dir_arg\"; then\n    echo \"$0: no input file specified.\" >&2\n    exit 1\n  fi\n  # It's OK to call `install-sh -d' without argument.\n  # This can happen when creating conditional directories.\n  exit 0\nfi\n\nif test -z \"$dir_arg\"; then\n  do_exit='(exit $ret); exit $ret'\n  trap \"ret=129; $do_exit\" 1\n  trap \"ret=130; $do_exit\" 2\n  trap \"ret=141; $do_exit\" 13\n  trap \"ret=143; $do_exit\" 15\n\n  # Set umask so as not to create temps with too-generous modes.\n  # However, 'strip' requires both read and write access to temps.\n  case $mode in\n    # Optimize common cases.\n    *644) cp_umask=133;;\n    *755) cp_umask=22;;\n\n    *[0-7])\n      if test -z \"$stripcmd\"; then\n\tu_plus_rw=\n      else\n\tu_plus_rw='% 200'\n      fi\n      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;\n    *)\n      if test -z \"$stripcmd\"; then\n\tu_plus_rw=\n      else\n\tu_plus_rw=,u+rw\n      fi\n      cp_umask=$mode$u_plus_rw;;\n  esac\nfi\n\nfor src\ndo\n  # Protect names problematic for `test' and other utilities.\n  case $src in\n    -* | [=\\(\\)!]) src=./$src;;\n  esac\n\n  if test -n \"$dir_arg\"; then\n    dst=$src\n    dstdir=$dst\n    test -d \"$dstdir\"\n    dstdir_status=$?\n  else\n\n    # Waiting for this to be detected by the \"$cpprog $src $dsttmp\" command\n    # might cause directories to be created, which would be especially bad\n    # if $src (and thus $dsttmp) contains '*'.\n    if test ! -f \"$src\" && test ! -d \"$src\"; then\n      echo \"$0: $src does not exist.\" >&2\n      exit 1\n    fi\n\n    if test -z \"$dst_arg\"; then\n      echo \"$0: no destination specified.\" >&2\n      exit 1\n    fi\n    dst=$dst_arg\n\n    # If destination is a directory, append the input filename; won't work\n    # if double slashes aren't ignored.\n    if test -d \"$dst\"; then\n      if test -n \"$no_target_directory\"; then\n\techo \"$0: $dst_arg: Is a directory\" >&2\n\texit 1\n      fi\n      dstdir=$dst\n      dst=$dstdir/`basename \"$src\"`\n      dstdir_status=0\n    else\n      # Prefer dirname, but fall back on a substitute if dirname fails.\n      dstdir=`\n\t(dirname \"$dst\") 2>/dev/null ||\n\texpr X\"$dst\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t     X\"$dst\" : 'X\\(//\\)[^/]' \\| \\\n\t     X\"$dst\" : 'X\\(//\\)$' \\| \\\n\t     X\"$dst\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n\techo X\"$dst\" |\n\t    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t /^X\\(\\/\\/\\)[^/].*/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t /^X\\(\\/\\/\\)$/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t /^X\\(\\/\\).*/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t s/.*/./; q'\n      `\n\n      test -d \"$dstdir\"\n      dstdir_status=$?\n    fi\n  fi\n\n  obsolete_mkdir_used=false\n\n  if test $dstdir_status != 0; then\n    case $posix_mkdir in\n      '')\n\t# Create intermediate dirs using mode 755 as modified by the umask.\n\t# This is like FreeBSD 'install' as of 1997-10-28.\n\tumask=`umask`\n\tcase $stripcmd.$umask in\n\t  # Optimize common cases.\n\t  *[2367][2367]) mkdir_umask=$umask;;\n\t  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;\n\n\t  *[0-7])\n\t    mkdir_umask=`expr $umask + 22 \\\n\t      - $umask % 100 % 40 + $umask % 20 \\\n\t      - $umask % 10 % 4 + $umask % 2\n\t    `;;\n\t  *) mkdir_umask=$umask,go-w;;\n\tesac\n\n\t# With -d, create the new directory with the user-specified mode.\n\t# Otherwise, rely on $mkdir_umask.\n\tif test -n \"$dir_arg\"; then\n\t  mkdir_mode=-m$mode\n\telse\n\t  mkdir_mode=\n\tfi\n\n\tposix_mkdir=false\n\tcase $umask in\n\t  *[123567][0-7][0-7])\n\t    # POSIX mkdir -p sets u+wx bits regardless of umask, which\n\t    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.\n\t    ;;\n\t  *)\n\t    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$\n\t    trap 'ret=$?; rmdir \"$tmpdir/d\" \"$tmpdir\" 2>/dev/null; exit $ret' 0\n\n\t    if (umask $mkdir_umask &&\n\t\texec $mkdirprog $mkdir_mode -p -- \"$tmpdir/d\") >/dev/null 2>&1\n\t    then\n\t      if test -z \"$dir_arg\" || {\n\t\t   # Check for POSIX incompatibilities with -m.\n\t\t   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or\n\t\t   # other-writeable bit of parent directory when it shouldn't.\n\t\t   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.\n\t\t   ls_ld_tmpdir=`ls -ld \"$tmpdir\"`\n\t\t   case $ls_ld_tmpdir in\n\t\t     d????-?r-*) different_mode=700;;\n\t\t     d????-?--*) different_mode=755;;\n\t\t     *) false;;\n\t\t   esac &&\n\t\t   $mkdirprog -m$different_mode -p -- \"$tmpdir\" && {\n\t\t     ls_ld_tmpdir_1=`ls -ld \"$tmpdir\"`\n\t\t     test \"$ls_ld_tmpdir\" = \"$ls_ld_tmpdir_1\"\n\t\t   }\n\t\t }\n\t      then posix_mkdir=:\n\t      fi\n\t      rmdir \"$tmpdir/d\" \"$tmpdir\"\n\t    else\n\t      # Remove any dirs left behind by ancient mkdir implementations.\n\t      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null\n\t    fi\n\t    trap '' 0;;\n\tesac;;\n    esac\n\n    if\n      $posix_mkdir && (\n\tumask $mkdir_umask &&\n\t$doit_exec $mkdirprog $mkdir_mode -p -- \"$dstdir\"\n      )\n    then :\n    else\n\n      # The umask is ridiculous, or mkdir does not conform to POSIX,\n      # or it failed possibly due to a race condition.  Create the\n      # directory the slow way, step by step, checking for races as we go.\n\n      case $dstdir in\n\t/*) prefix='/';;\n\t[-=\\(\\)!]*) prefix='./';;\n\t*)  prefix='';;\n      esac\n\n      eval \"$initialize_posix_glob\"\n\n      oIFS=$IFS\n      IFS=/\n      $posix_glob set -f\n      set fnord $dstdir\n      shift\n      $posix_glob set +f\n      IFS=$oIFS\n\n      prefixes=\n\n      for d\n      do\n\ttest X\"$d\" = X && continue\n\n\tprefix=$prefix$d\n\tif test -d \"$prefix\"; then\n\t  prefixes=\n\telse\n\t  if $posix_mkdir; then\n\t    (umask=$mkdir_umask &&\n\t     $doit_exec $mkdirprog $mkdir_mode -p -- \"$dstdir\") && break\n\t    # Don't fail if two instances are running concurrently.\n\t    test -d \"$prefix\" || exit 1\n\t  else\n\t    case $prefix in\n\t      *\\'*) qprefix=`echo \"$prefix\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;;\n\t      *) qprefix=$prefix;;\n\t    esac\n\t    prefixes=\"$prefixes '$qprefix'\"\n\t  fi\n\tfi\n\tprefix=$prefix/\n      done\n\n      if test -n \"$prefixes\"; then\n\t# Don't fail if two instances are running concurrently.\n\t(umask $mkdir_umask &&\n\t eval \"\\$doit_exec \\$mkdirprog $prefixes\") ||\n\t  test -d \"$dstdir\" || exit 1\n\tobsolete_mkdir_used=true\n      fi\n    fi\n  fi\n\n  if test -n \"$dir_arg\"; then\n    { test -z \"$chowncmd\" || $doit $chowncmd \"$dst\"; } &&\n    { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dst\"; } &&\n    { test \"$obsolete_mkdir_used$chowncmd$chgrpcmd\" = false ||\n      test -z \"$chmodcmd\" || $doit $chmodcmd $mode \"$dst\"; } || exit 1\n  else\n\n    # Make a couple of temp file names in the proper directory.\n    dsttmp=$dstdir/_inst.$$_\n    rmtmp=$dstdir/_rm.$$_\n\n    # Trap to clean up those temp files at exit.\n    trap 'ret=$?; rm -f \"$dsttmp\" \"$rmtmp\" && exit $ret' 0\n\n    # Copy the file name to the temp name.\n    (umask $cp_umask && $doit_exec $cpprog \"$src\" \"$dsttmp\") &&\n\n    # and set any options; do chmod last to preserve setuid bits.\n    #\n    # If any of these fail, we abort the whole thing.  If we want to\n    # ignore errors from any of these, just make sure not to ignore\n    # errors from the above \"$doit $cpprog $src $dsttmp\" command.\n    #\n    { test -z \"$chowncmd\" || $doit $chowncmd \"$dsttmp\"; } &&\n    { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dsttmp\"; } &&\n    { test -z \"$stripcmd\" || $doit $stripcmd \"$dsttmp\"; } &&\n    { test -z \"$chmodcmd\" || $doit $chmodcmd $mode \"$dsttmp\"; } &&\n\n    # If -C, don't bother to copy if it wouldn't change the file.\n    if $copy_on_change &&\n       old=`LC_ALL=C ls -dlL \"$dst\"\t2>/dev/null` &&\n       new=`LC_ALL=C ls -dlL \"$dsttmp\"\t2>/dev/null` &&\n\n       eval \"$initialize_posix_glob\" &&\n       $posix_glob set -f &&\n       set X $old && old=:$2:$4:$5:$6 &&\n       set X $new && new=:$2:$4:$5:$6 &&\n       $posix_glob set +f &&\n\n       test \"$old\" = \"$new\" &&\n       $cmpprog \"$dst\" \"$dsttmp\" >/dev/null 2>&1\n    then\n      rm -f \"$dsttmp\"\n    else\n      # Rename the file to the real destination.\n      $doit $mvcmd -f \"$dsttmp\" \"$dst\" 2>/dev/null ||\n\n      # The rename failed, perhaps because mv can't rename something else\n      # to itself, or perhaps because mv is so ancient that it does not\n      # support -f.\n      {\n\t# Now remove or move aside any old file at destination location.\n\t# We try this two ways since rm can't unlink itself on some\n\t# systems and the destination file might be busy for other\n\t# reasons.  In this case, the final cleanup might fail but the new\n\t# file should still install successfully.\n\t{\n\t  test ! -f \"$dst\" ||\n\t  $doit $rmcmd -f \"$dst\" 2>/dev/null ||\n\t  { $doit $mvcmd -f \"$dst\" \"$rmtmp\" 2>/dev/null &&\n\t    { $doit $rmcmd -f \"$rmtmp\" 2>/dev/null; :; }\n\t  } ||\n\t  { echo \"$0: cannot unlink or rename $dst\" >&2\n\t    (exit 1); exit 1\n\t  }\n\t} &&\n\n\t# Now rename the file to the real destination.\n\t$doit $mvcmd \"$dsttmp\" \"$dst\"\n      }\n    fi || exit 1\n\n    trap '' 0\n  fi\ndone\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-time-zone: \"UTC\"\n# time-stamp-end: \"; # UTC\"\n# End:\n"
  },
  {
    "path": "Tests/gtest/build-aux/ltmain.sh",
    "content": "\n# libtool (GNU libtool) 2.4.2\n# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,\n# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.\n# This is free software; see the source for copying conditions.  There is NO\n# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n# GNU Libtool is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html,\n# or obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n# Usage: $progname [OPTION]... [MODE-ARG]...\n#\n# Provide generalized library-building support services.\n#\n#       --config             show all configuration variables\n#       --debug              enable verbose shell tracing\n#   -n, --dry-run            display commands without modifying any files\n#       --features           display basic configuration information and exit\n#       --mode=MODE          use operation mode MODE\n#       --preserve-dup-deps  don't remove duplicate dependency libraries\n#       --quiet, --silent    don't print informational messages\n#       --no-quiet, --no-silent\n#                            print informational messages (default)\n#       --no-warn            don't display warning messages\n#       --tag=TAG            use configuration variables from tag TAG\n#   -v, --verbose            print more informational messages than default\n#       --no-verbose         don't print the extra informational messages\n#       --version            print version information\n#   -h, --help, --help-all   print short, long, or detailed help message\n#\n# MODE must be one of the following:\n#\n#         clean              remove files from the build directory\n#         compile            compile a source file into a libtool object\n#         execute            automatically set library path, then run a program\n#         finish             complete the installation of libtool libraries\n#         install            install libraries or executables\n#         link               create a library or an executable\n#         uninstall          remove libraries from an installed directory\n#\n# MODE-ARGS vary depending on the MODE.  When passed as first option,\n# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.\n# Try `$progname --help --mode=MODE' for a more detailed description of MODE.\n#\n# When reporting a bug, please describe a test case to reproduce it and\n# include the following information:\n#\n#         host-triplet:\t$host\n#         shell:\t\t$SHELL\n#         compiler:\t\t$LTCC\n#         compiler flags:\t\t$LTCFLAGS\n#         linker:\t\t$LD (gnu? $with_gnu_ld)\n#         $progname:\t(GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1\n#         automake:\t$automake_version\n#         autoconf:\t$autoconf_version\n#\n# Report bugs to <bug-libtool@gnu.org>.\n# GNU libtool home page: <http://www.gnu.org/software/libtool/>.\n# General help using GNU software: <http://www.gnu.org/gethelp/>.\n\nPROGRAM=libtool\nPACKAGE=libtool\nVERSION=\"2.4.2 Debian-2.4.2-1ubuntu1\"\nTIMESTAMP=\"\"\npackage_revision=1.3337\n\n# Be Bourne compatible\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then\n  emulate sh\n  NULLCMD=:\n  # Zsh 3.x and 4.x performs word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac\nfi\nBIN_SH=xpg4; export BIN_SH # for Tru64\nDUALCASE=1; export DUALCASE # for MKS sh\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n$1\n_LTECHO_EOF'\n}\n\n# NLS nuisances: We save the old values to restore during execute mode.\nlt_user_locale=\nlt_safe_locale=\nfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES\ndo\n  eval \"if test \\\"\\${$lt_var+set}\\\" = set; then\n          save_$lt_var=\\$$lt_var\n          $lt_var=C\n\t  export $lt_var\n\t  lt_user_locale=\\\"$lt_var=\\\\\\$save_\\$lt_var; \\$lt_user_locale\\\"\n\t  lt_safe_locale=\\\"$lt_var=C; \\$lt_safe_locale\\\"\n\tfi\"\ndone\nLC_ALL=C\nLANGUAGE=C\nexport LANGUAGE LC_ALL\n\n$lt_unset CDPATH\n\n\n# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh\n# is ksh but when the shell is invoked as \"sh\" and the current value of\n# the _XPG environment variable is not equal to 1 (one), the special\n# positional parameter $0, within a function call, is the name of the\n# function.\nprogpath=\"$0\"\n\n\n\n: ${CP=\"cp -f\"}\ntest \"${ECHO+set}\" = set || ECHO=${as_echo-'printf %s\\n'}\n: ${MAKE=\"make\"}\n: ${MKDIR=\"mkdir\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n: ${SHELL=\"${CONFIG_SHELL-/bin/sh}\"}\n: ${Xsed=\"$SED -e 1s/^X//\"}\n\n# Global variables:\nEXIT_SUCCESS=0\nEXIT_FAILURE=1\nEXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.\nEXIT_SKIP=77\t  # $? = 77 is used to indicate a skipped test to automake.\n\nexit_status=$EXIT_SUCCESS\n\n# Make sure IFS has a sensible default\nlt_nl='\n'\nIFS=\" \t$lt_nl\"\n\ndirname=\"s,/[^/]*$,,\"\nbasename=\"s,^.*/,,\"\n\n# func_dirname file append nondir_replacement\n# Compute the dirname of FILE.  If nonempty, add APPEND to the result,\n# otherwise set result to NONDIR_REPLACEMENT.\nfunc_dirname ()\n{\n    func_dirname_result=`$ECHO \"${1}\" | $SED \"$dirname\"`\n    if test \"X$func_dirname_result\" = \"X${1}\"; then\n      func_dirname_result=\"${3}\"\n    else\n      func_dirname_result=\"$func_dirname_result${2}\"\n    fi\n} # func_dirname may be replaced by extended shell implementation\n\n\n# func_basename file\nfunc_basename ()\n{\n    func_basename_result=`$ECHO \"${1}\" | $SED \"$basename\"`\n} # func_basename may be replaced by extended shell implementation\n\n\n# func_dirname_and_basename file append nondir_replacement\n# perform func_basename and func_dirname in a single function\n# call:\n#   dirname:  Compute the dirname of FILE.  If nonempty,\n#             add APPEND to the result, otherwise set result\n#             to NONDIR_REPLACEMENT.\n#             value returned in \"$func_dirname_result\"\n#   basename: Compute filename of FILE.\n#             value retuned in \"$func_basename_result\"\n# Implementation must be kept synchronized with func_dirname\n# and func_basename. For efficiency, we do not delegate to\n# those functions but instead duplicate the functionality here.\nfunc_dirname_and_basename ()\n{\n    # Extract subdirectory from the argument.\n    func_dirname_result=`$ECHO \"${1}\" | $SED -e \"$dirname\"`\n    if test \"X$func_dirname_result\" = \"X${1}\"; then\n      func_dirname_result=\"${3}\"\n    else\n      func_dirname_result=\"$func_dirname_result${2}\"\n    fi\n    func_basename_result=`$ECHO \"${1}\" | $SED -e \"$basename\"`\n} # func_dirname_and_basename may be replaced by extended shell implementation\n\n\n# func_stripname prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n# func_strip_suffix prefix name\nfunc_stripname ()\n{\n    case ${2} in\n      .*) func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%\\\\\\\\${2}\\$%%\"`;;\n      *)  func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%${2}\\$%%\"`;;\n    esac\n} # func_stripname may be replaced by extended shell implementation\n\n\n# These SED scripts presuppose an absolute path with a trailing slash.\npathcar='s,^/\\([^/]*\\).*$,\\1,'\npathcdr='s,^/[^/]*,,'\nremovedotparts=':dotsl\n\t\ts@/\\./@/@g\n\t\tt dotsl\n\t\ts,/\\.$,/,'\ncollapseslashes='s@/\\{1,\\}@/@g'\nfinalslash='s,/*$,/,'\n\n# func_normal_abspath PATH\n# Remove doubled-up and trailing slashes, \".\" path components,\n# and cancel out any \"..\" path components in PATH after making\n# it an absolute path.\n#             value returned in \"$func_normal_abspath_result\"\nfunc_normal_abspath ()\n{\n  # Start from root dir and reassemble the path.\n  func_normal_abspath_result=\n  func_normal_abspath_tpath=$1\n  func_normal_abspath_altnamespace=\n  case $func_normal_abspath_tpath in\n    \"\")\n      # Empty path, that just means $cwd.\n      func_stripname '' '/' \"`pwd`\"\n      func_normal_abspath_result=$func_stripname_result\n      return\n    ;;\n    # The next three entries are used to spot a run of precisely\n    # two leading slashes without using negated character classes;\n    # we take advantage of case's first-match behaviour.\n    ///*)\n      # Unusual form of absolute path, do nothing.\n    ;;\n    //*)\n      # Not necessarily an ordinary path; POSIX reserves leading '//'\n      # and for example Cygwin uses it to access remote file shares\n      # over CIFS/SMB, so we conserve a leading double slash if found.\n      func_normal_abspath_altnamespace=/\n    ;;\n    /*)\n      # Absolute path, do nothing.\n    ;;\n    *)\n      # Relative path, prepend $cwd.\n      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath\n    ;;\n  esac\n  # Cancel out all the simple stuff to save iterations.  We also want\n  # the path to end with a slash for ease of parsing, so make sure\n  # there is one (and only one) here.\n  func_normal_abspath_tpath=`$ECHO \"$func_normal_abspath_tpath\" | $SED \\\n        -e \"$removedotparts\" -e \"$collapseslashes\" -e \"$finalslash\"`\n  while :; do\n    # Processed it all yet?\n    if test \"$func_normal_abspath_tpath\" = / ; then\n      # If we ascended to the root using \"..\" the result may be empty now.\n      if test -z \"$func_normal_abspath_result\" ; then\n        func_normal_abspath_result=/\n      fi\n      break\n    fi\n    func_normal_abspath_tcomponent=`$ECHO \"$func_normal_abspath_tpath\" | $SED \\\n        -e \"$pathcar\"`\n    func_normal_abspath_tpath=`$ECHO \"$func_normal_abspath_tpath\" | $SED \\\n        -e \"$pathcdr\"`\n    # Figure out what to do with it\n    case $func_normal_abspath_tcomponent in\n      \"\")\n        # Trailing empty path component, ignore it.\n      ;;\n      ..)\n        # Parent dir; strip last assembled component from result.\n        func_dirname \"$func_normal_abspath_result\"\n        func_normal_abspath_result=$func_dirname_result\n      ;;\n      *)\n        # Actual path component, append it.\n        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent\n      ;;\n    esac\n  done\n  # Restore leading double-slash if one was found on entry.\n  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result\n}\n\n# func_relative_path SRCDIR DSTDIR\n# generates a relative path from SRCDIR to DSTDIR, with a trailing\n# slash if non-empty, suitable for immediately appending a filename\n# without needing to append a separator.\n#             value returned in \"$func_relative_path_result\"\nfunc_relative_path ()\n{\n  func_relative_path_result=\n  func_normal_abspath \"$1\"\n  func_relative_path_tlibdir=$func_normal_abspath_result\n  func_normal_abspath \"$2\"\n  func_relative_path_tbindir=$func_normal_abspath_result\n\n  # Ascend the tree starting from libdir\n  while :; do\n    # check if we have found a prefix of bindir\n    case $func_relative_path_tbindir in\n      $func_relative_path_tlibdir)\n        # found an exact match\n        func_relative_path_tcancelled=\n        break\n        ;;\n      $func_relative_path_tlibdir*)\n        # found a matching prefix\n        func_stripname \"$func_relative_path_tlibdir\" '' \"$func_relative_path_tbindir\"\n        func_relative_path_tcancelled=$func_stripname_result\n        if test -z \"$func_relative_path_result\"; then\n          func_relative_path_result=.\n        fi\n        break\n        ;;\n      *)\n        func_dirname $func_relative_path_tlibdir\n        func_relative_path_tlibdir=${func_dirname_result}\n        if test \"x$func_relative_path_tlibdir\" = x ; then\n          # Have to descend all the way to the root!\n          func_relative_path_result=../$func_relative_path_result\n          func_relative_path_tcancelled=$func_relative_path_tbindir\n          break\n        fi\n        func_relative_path_result=../$func_relative_path_result\n        ;;\n    esac\n  done\n\n  # Now calculate path; take care to avoid doubling-up slashes.\n  func_stripname '' '/' \"$func_relative_path_result\"\n  func_relative_path_result=$func_stripname_result\n  func_stripname '/' '/' \"$func_relative_path_tcancelled\"\n  if test \"x$func_stripname_result\" != x ; then\n    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}\n  fi\n\n  # Normalisation. If bindir is libdir, return empty string,\n  # else relative path ending with a slash; either way, target\n  # file name can be directly appended.\n  if test ! -z \"$func_relative_path_result\"; then\n    func_stripname './' '' \"$func_relative_path_result/\"\n    func_relative_path_result=$func_stripname_result\n  fi\n}\n\n# The name of this program:\nfunc_dirname_and_basename \"$progpath\"\nprogname=$func_basename_result\n\n# Make sure we have an absolute path for reexecution:\ncase $progpath in\n  [\\\\/]*|[A-Za-z]:\\\\*) ;;\n  *[\\\\/]*)\n     progdir=$func_dirname_result\n     progdir=`cd \"$progdir\" && pwd`\n     progpath=\"$progdir/$progname\"\n     ;;\n  *)\n     save_IFS=\"$IFS\"\n     IFS=${PATH_SEPARATOR-:}\n     for progdir in $PATH; do\n       IFS=\"$save_IFS\"\n       test -x \"$progdir/$progname\" && break\n     done\n     IFS=\"$save_IFS\"\n     test -n \"$progdir\" || progdir=`pwd`\n     progpath=\"$progdir/$progname\"\n     ;;\nesac\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nXsed=\"${SED}\"' -e 1s/^X//'\nsed_quote_subst='s/\\([`\"$\\\\]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([\"`\\\\]\\)/\\\\\\1/g'\n\n# Sed substitution that turns a string into a regex matching for the\n# string literally.\nsed_make_literal_regex='s,[].[^$\\\\*\\/],\\\\&,g'\n\n# Sed substitution that converts a w32 file name or path\n# which contains forward slashes, into one that contains\n# (escaped) backslashes.  A very naive implementation.\nlt_sed_naive_backslashify='s|\\\\\\\\*|\\\\|g;s|/|\\\\|g;s|\\\\|\\\\\\\\|g'\n\n# Re-`\\' parameter expansions in output of double_quote_subst that were\n# `\\'-ed in input to the same.  If an odd number of `\\' preceded a '$'\n# in input to double_quote_subst, that '$' was protected from expansion.\n# Since each input `\\' is now two `\\'s, look for any number of runs of\n# four `\\'s followed by two `\\'s and then a '$'.  `\\' that '$'.\nbs='\\\\'\nbs2='\\\\\\\\'\nbs4='\\\\\\\\\\\\\\\\'\ndollar='\\$'\nsed_double_backslash=\"\\\n  s/$bs4/&\\\\\n/g\n  s/^$bs2$dollar/$bs&/\n  s/\\\\([^$bs]\\\\)$bs2$dollar/\\\\1$bs2$bs$dollar/g\n  s/\\n//g\"\n\n# Standard options:\nopt_dry_run=false\nopt_help=false\nopt_quiet=false\nopt_verbose=false\nopt_warning=:\n\n# func_echo arg...\n# Echo program name prefixed message, along with the current mode\n# name if it has been set yet.\nfunc_echo ()\n{\n    $ECHO \"$progname: ${opt_mode+$opt_mode: }$*\"\n}\n\n# func_verbose arg...\n# Echo program name prefixed message in verbose mode only.\nfunc_verbose ()\n{\n    $opt_verbose && func_echo ${1+\"$@\"}\n\n    # A bug in bash halts the script if the last line of a function\n    # fails when set -e is in force, so we need another command to\n    # work around that:\n    :\n}\n\n# func_echo_all arg...\n# Invoke $ECHO with all args, space-separated.\nfunc_echo_all ()\n{\n    $ECHO \"$*\"\n}\n\n# func_error arg...\n# Echo program name prefixed message to standard error.\nfunc_error ()\n{\n    $ECHO \"$progname: ${opt_mode+$opt_mode: }\"${1+\"$@\"} 1>&2\n}\n\n# func_warning arg...\n# Echo program name prefixed warning message to standard error.\nfunc_warning ()\n{\n    $opt_warning && $ECHO \"$progname: ${opt_mode+$opt_mode: }warning: \"${1+\"$@\"} 1>&2\n\n    # bash bug again:\n    :\n}\n\n# func_fatal_error arg...\n# Echo program name prefixed message to standard error, and exit.\nfunc_fatal_error ()\n{\n    func_error ${1+\"$@\"}\n    exit $EXIT_FAILURE\n}\n\n# func_fatal_help arg...\n# Echo program name prefixed message to standard error, followed by\n# a help hint, and exit.\nfunc_fatal_help ()\n{\n    func_error ${1+\"$@\"}\n    func_fatal_error \"$help\"\n}\nhelp=\"Try \\`$progname --help' for more information.\"  ## default\n\n\n# func_grep expression filename\n# Check whether EXPRESSION matches any line of FILENAME, without output.\nfunc_grep ()\n{\n    $GREP \"$1\" \"$2\" >/dev/null 2>&1\n}\n\n\n# func_mkdir_p directory-path\n# Make sure the entire path to DIRECTORY-PATH is available.\nfunc_mkdir_p ()\n{\n    my_directory_path=\"$1\"\n    my_dir_list=\n\n    if test -n \"$my_directory_path\" && test \"$opt_dry_run\" != \":\"; then\n\n      # Protect directory names starting with `-'\n      case $my_directory_path in\n        -*) my_directory_path=\"./$my_directory_path\" ;;\n      esac\n\n      # While some portion of DIR does not yet exist...\n      while test ! -d \"$my_directory_path\"; do\n        # ...make a list in topmost first order.  Use a colon delimited\n\t# list incase some portion of path contains whitespace.\n        my_dir_list=\"$my_directory_path:$my_dir_list\"\n\n        # If the last portion added has no slash in it, the list is done\n        case $my_directory_path in */*) ;; *) break ;; esac\n\n        # ...otherwise throw away the child directory and loop\n        my_directory_path=`$ECHO \"$my_directory_path\" | $SED -e \"$dirname\"`\n      done\n      my_dir_list=`$ECHO \"$my_dir_list\" | $SED 's,:*$,,'`\n\n      save_mkdir_p_IFS=\"$IFS\"; IFS=':'\n      for my_dir in $my_dir_list; do\n\tIFS=\"$save_mkdir_p_IFS\"\n        # mkdir can fail with a `File exist' error if two processes\n        # try to create one of the directories concurrently.  Don't\n        # stop in that case!\n        $MKDIR \"$my_dir\" 2>/dev/null || :\n      done\n      IFS=\"$save_mkdir_p_IFS\"\n\n      # Bail out if we (or some other process) failed to create a directory.\n      test -d \"$my_directory_path\" || \\\n        func_fatal_error \"Failed to create \\`$1'\"\n    fi\n}\n\n\n# func_mktempdir [string]\n# Make a temporary directory that won't clash with other running\n# libtool processes, and avoids race conditions if possible.  If\n# given, STRING is the basename for that directory.\nfunc_mktempdir ()\n{\n    my_template=\"${TMPDIR-/tmp}/${1-$progname}\"\n\n    if test \"$opt_dry_run\" = \":\"; then\n      # Return a directory name, but don't create it in dry-run mode\n      my_tmpdir=\"${my_template}-$$\"\n    else\n\n      # If mktemp works, use that first and foremost\n      my_tmpdir=`mktemp -d \"${my_template}-XXXXXXXX\" 2>/dev/null`\n\n      if test ! -d \"$my_tmpdir\"; then\n        # Failing that, at least try and use $RANDOM to avoid a race\n        my_tmpdir=\"${my_template}-${RANDOM-0}$$\"\n\n        save_mktempdir_umask=`umask`\n        umask 0077\n        $MKDIR \"$my_tmpdir\"\n        umask $save_mktempdir_umask\n      fi\n\n      # If we're not in dry-run mode, bomb out on failure\n      test -d \"$my_tmpdir\" || \\\n        func_fatal_error \"cannot create temporary directory \\`$my_tmpdir'\"\n    fi\n\n    $ECHO \"$my_tmpdir\"\n}\n\n\n# func_quote_for_eval arg\n# Aesthetically quote ARG to be evaled later.\n# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT\n# is double-quoted, suitable for a subsequent eval, whereas\n# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters\n# which are still active within double quotes backslashified.\nfunc_quote_for_eval ()\n{\n    case $1 in\n      *[\\\\\\`\\\"\\$]*)\n\tfunc_quote_for_eval_unquoted_result=`$ECHO \"$1\" | $SED \"$sed_quote_subst\"` ;;\n      *)\n        func_quote_for_eval_unquoted_result=\"$1\" ;;\n    esac\n\n    case $func_quote_for_eval_unquoted_result in\n      # Double-quote args containing shell metacharacters to delay\n      # word splitting, command substitution and and variable\n      # expansion for a subsequent eval.\n      # Many Bourne shells cannot handle close brackets correctly\n      # in scan sets, so we specify it separately.\n      *[\\[\\~\\#\\^\\&\\*\\(\\)\\{\\}\\|\\;\\<\\>\\?\\'\\ \\\t]*|*]*|\"\")\n        func_quote_for_eval_result=\"\\\"$func_quote_for_eval_unquoted_result\\\"\"\n        ;;\n      *)\n        func_quote_for_eval_result=\"$func_quote_for_eval_unquoted_result\"\n    esac\n}\n\n\n# func_quote_for_expand arg\n# Aesthetically quote ARG to be evaled later; same as above,\n# but do not quote variable references.\nfunc_quote_for_expand ()\n{\n    case $1 in\n      *[\\\\\\`\\\"]*)\n\tmy_arg=`$ECHO \"$1\" | $SED \\\n\t    -e \"$double_quote_subst\" -e \"$sed_double_backslash\"` ;;\n      *)\n        my_arg=\"$1\" ;;\n    esac\n\n    case $my_arg in\n      # Double-quote args containing shell metacharacters to delay\n      # word splitting and command substitution for a subsequent eval.\n      # Many Bourne shells cannot handle close brackets correctly\n      # in scan sets, so we specify it separately.\n      *[\\[\\~\\#\\^\\&\\*\\(\\)\\{\\}\\|\\;\\<\\>\\?\\'\\ \\\t]*|*]*|\"\")\n        my_arg=\"\\\"$my_arg\\\"\"\n        ;;\n    esac\n\n    func_quote_for_expand_result=\"$my_arg\"\n}\n\n\n# func_show_eval cmd [fail_exp]\n# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is\n# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP\n# is given, then evaluate it.\nfunc_show_eval ()\n{\n    my_cmd=\"$1\"\n    my_fail_exp=\"${2-:}\"\n\n    ${opt_silent-false} || {\n      func_quote_for_expand \"$my_cmd\"\n      eval \"func_echo $func_quote_for_expand_result\"\n    }\n\n    if ${opt_dry_run-false}; then :; else\n      eval \"$my_cmd\"\n      my_status=$?\n      if test \"$my_status\" -eq 0; then :; else\n\teval \"(exit $my_status); $my_fail_exp\"\n      fi\n    fi\n}\n\n\n# func_show_eval_locale cmd [fail_exp]\n# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is\n# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP\n# is given, then evaluate it.  Use the saved locale for evaluation.\nfunc_show_eval_locale ()\n{\n    my_cmd=\"$1\"\n    my_fail_exp=\"${2-:}\"\n\n    ${opt_silent-false} || {\n      func_quote_for_expand \"$my_cmd\"\n      eval \"func_echo $func_quote_for_expand_result\"\n    }\n\n    if ${opt_dry_run-false}; then :; else\n      eval \"$lt_user_locale\n\t    $my_cmd\"\n      my_status=$?\n      eval \"$lt_safe_locale\"\n      if test \"$my_status\" -eq 0; then :; else\n\teval \"(exit $my_status); $my_fail_exp\"\n      fi\n    fi\n}\n\n# func_tr_sh\n# Turn $1 into a string suitable for a shell variable name.\n# Result is stored in $func_tr_sh_result.  All characters\n# not in the set a-zA-Z0-9_ are replaced with '_'. Further,\n# if $1 begins with a digit, a '_' is prepended as well.\nfunc_tr_sh ()\n{\n  case $1 in\n  [0-9]* | *[!a-zA-Z0-9_]*)\n    func_tr_sh_result=`$ECHO \"$1\" | $SED 's/^\\([0-9]\\)/_\\1/; s/[^a-zA-Z0-9_]/_/g'`\n    ;;\n  * )\n    func_tr_sh_result=$1\n    ;;\n  esac\n}\n\n\n# func_version\n# Echo version message to standard output and exit.\nfunc_version ()\n{\n    $opt_debug\n\n    $SED -n '/(C)/!b go\n\t:more\n\t/\\./!{\n\t  N\n\t  s/\\n# / /\n\t  b more\n\t}\n\t:go\n\t/^# '$PROGRAM' (GNU /,/# warranty; / {\n        s/^# //\n\ts/^# *$//\n        s/\\((C)\\)[ 0-9,-]*\\( [1-9][0-9]*\\)/\\1\\2/\n        p\n     }' < \"$progpath\"\n     exit $?\n}\n\n# func_usage\n# Echo short help message to standard output and exit.\nfunc_usage ()\n{\n    $opt_debug\n\n    $SED -n '/^# Usage:/,/^#  *.*--help/ {\n        s/^# //\n\ts/^# *$//\n\ts/\\$progname/'$progname'/\n\tp\n    }' < \"$progpath\"\n    echo\n    $ECHO \"run \\`$progname --help | more' for full usage\"\n    exit $?\n}\n\n# func_help [NOEXIT]\n# Echo long help message to standard output and exit,\n# unless 'noexit' is passed as argument.\nfunc_help ()\n{\n    $opt_debug\n\n    $SED -n '/^# Usage:/,/# Report bugs to/ {\n\t:print\n        s/^# //\n\ts/^# *$//\n\ts*\\$progname*'$progname'*\n\ts*\\$host*'\"$host\"'*\n\ts*\\$SHELL*'\"$SHELL\"'*\n\ts*\\$LTCC*'\"$LTCC\"'*\n\ts*\\$LTCFLAGS*'\"$LTCFLAGS\"'*\n\ts*\\$LD*'\"$LD\"'*\n\ts/\\$with_gnu_ld/'\"$with_gnu_ld\"'/\n\ts/\\$automake_version/'\"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`\"'/\n\ts/\\$autoconf_version/'\"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`\"'/\n\tp\n\td\n     }\n     /^# .* home page:/b print\n     /^# General help using/b print\n     ' < \"$progpath\"\n    ret=$?\n    if test -z \"$1\"; then\n      exit $ret\n    fi\n}\n\n# func_missing_arg argname\n# Echo program name prefixed message to standard error and set global\n# exit_cmd.\nfunc_missing_arg ()\n{\n    $opt_debug\n\n    func_error \"missing argument for $1.\"\n    exit_cmd=exit\n}\n\n\n# func_split_short_opt shortopt\n# Set func_split_short_opt_name and func_split_short_opt_arg shell\n# variables after splitting SHORTOPT after the 2nd character.\nfunc_split_short_opt ()\n{\n    my_sed_short_opt='1s/^\\(..\\).*$/\\1/;q'\n    my_sed_short_rest='1s/^..\\(.*\\)$/\\1/;q'\n\n    func_split_short_opt_name=`$ECHO \"$1\" | $SED \"$my_sed_short_opt\"`\n    func_split_short_opt_arg=`$ECHO \"$1\" | $SED \"$my_sed_short_rest\"`\n} # func_split_short_opt may be replaced by extended shell implementation\n\n\n# func_split_long_opt longopt\n# Set func_split_long_opt_name and func_split_long_opt_arg shell\n# variables after splitting LONGOPT at the `=' sign.\nfunc_split_long_opt ()\n{\n    my_sed_long_opt='1s/^\\(--[^=]*\\)=.*/\\1/;q'\n    my_sed_long_arg='1s/^--[^=]*=//'\n\n    func_split_long_opt_name=`$ECHO \"$1\" | $SED \"$my_sed_long_opt\"`\n    func_split_long_opt_arg=`$ECHO \"$1\" | $SED \"$my_sed_long_arg\"`\n} # func_split_long_opt may be replaced by extended shell implementation\n\nexit_cmd=:\n\n\n\n\n\nmagic=\"%%%MAGIC variable%%%\"\nmagic_exe=\"%%%MAGIC EXE variable%%%\"\n\n# Global variables.\nnonopt=\npreserve_args=\nlo2o=\"s/\\\\.lo\\$/.${objext}/\"\no2lo=\"s/\\\\.${objext}\\$/.lo/\"\nextracted_archives=\nextracted_serial=0\n\n# If this variable is set in any of the actions, the command in it\n# will be execed at the end.  This prevents here-documents from being\n# left over by shells.\nexec_cmd=\n\n# func_append var value\n# Append VALUE to the end of shell variable VAR.\nfunc_append ()\n{\n    eval \"${1}=\\$${1}\\${2}\"\n} # func_append may be replaced by extended shell implementation\n\n# func_append_quoted var value\n# Quote VALUE and append to the end of shell variable VAR, separated\n# by a space.\nfunc_append_quoted ()\n{\n    func_quote_for_eval \"${2}\"\n    eval \"${1}=\\$${1}\\\\ \\$func_quote_for_eval_result\"\n} # func_append_quoted may be replaced by extended shell implementation\n\n\n# func_arith arithmetic-term...\nfunc_arith ()\n{\n    func_arith_result=`expr \"${@}\"`\n} # func_arith may be replaced by extended shell implementation\n\n\n# func_len string\n# STRING may not start with a hyphen.\nfunc_len ()\n{\n    func_len_result=`expr \"${1}\" : \".*\" 2>/dev/null || echo $max_cmd_len`\n} # func_len may be replaced by extended shell implementation\n\n\n# func_lo2o object\nfunc_lo2o ()\n{\n    func_lo2o_result=`$ECHO \"${1}\" | $SED \"$lo2o\"`\n} # func_lo2o may be replaced by extended shell implementation\n\n\n# func_xform libobj-or-source\nfunc_xform ()\n{\n    func_xform_result=`$ECHO \"${1}\" | $SED 's/\\.[^.]*$/.lo/'`\n} # func_xform may be replaced by extended shell implementation\n\n\n# func_fatal_configuration arg...\n# Echo program name prefixed message to standard error, followed by\n# a configuration failure hint, and exit.\nfunc_fatal_configuration ()\n{\n    func_error ${1+\"$@\"}\n    func_error \"See the $PACKAGE documentation for more information.\"\n    func_fatal_error \"Fatal configuration error.\"\n}\n\n\n# func_config\n# Display the configuration for all the tags in this script.\nfunc_config ()\n{\n    re_begincf='^# ### BEGIN LIBTOOL'\n    re_endcf='^# ### END LIBTOOL'\n\n    # Default configuration.\n    $SED \"1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\\$d\" < \"$progpath\"\n\n    # Now print the configurations for the tags.\n    for tagname in $taglist; do\n      $SED -n \"/$re_begincf TAG CONFIG: $tagname\\$/,/$re_endcf TAG CONFIG: $tagname\\$/p\" < \"$progpath\"\n    done\n\n    exit $?\n}\n\n# func_features\n# Display the features supported by this script.\nfunc_features ()\n{\n    echo \"host: $host\"\n    if test \"$build_libtool_libs\" = yes; then\n      echo \"enable shared libraries\"\n    else\n      echo \"disable shared libraries\"\n    fi\n    if test \"$build_old_libs\" = yes; then\n      echo \"enable static libraries\"\n    else\n      echo \"disable static libraries\"\n    fi\n\n    exit $?\n}\n\n# func_enable_tag tagname\n# Verify that TAGNAME is valid, and either flag an error and exit, or\n# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist\n# variable here.\nfunc_enable_tag ()\n{\n  # Global variable:\n  tagname=\"$1\"\n\n  re_begincf=\"^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\\$\"\n  re_endcf=\"^# ### END LIBTOOL TAG CONFIG: $tagname\\$\"\n  sed_extractcf=\"/$re_begincf/,/$re_endcf/p\"\n\n  # Validate tagname.\n  case $tagname in\n    *[!-_A-Za-z0-9,/]*)\n      func_fatal_error \"invalid tag name: $tagname\"\n      ;;\n  esac\n\n  # Don't test for the \"default\" C tag, as we know it's\n  # there but not specially marked.\n  case $tagname in\n    CC) ;;\n    *)\n      if $GREP \"$re_begincf\" \"$progpath\" >/dev/null 2>&1; then\n\ttaglist=\"$taglist $tagname\"\n\n\t# Evaluate the configuration.  Be careful to quote the path\n\t# and the sed script, to avoid splitting on whitespace, but\n\t# also don't use non-portable quotes within backquotes within\n\t# quotes we have to do it in 2 steps:\n\textractedcf=`$SED -n -e \"$sed_extractcf\" < \"$progpath\"`\n\teval \"$extractedcf\"\n      else\n\tfunc_error \"ignoring unknown tag $tagname\"\n      fi\n      ;;\n  esac\n}\n\n# func_check_version_match\n# Ensure that we are using m4 macros, and libtool script from the same\n# release of libtool.\nfunc_check_version_match ()\n{\n  if test \"$package_revision\" != \"$macro_revision\"; then\n    if test \"$VERSION\" != \"$macro_version\"; then\n      if test -z \"$macro_version\"; then\n        cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the\n$progname: definition of this LT_INIT comes from an older release.\n$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION\n$progname: and run autoconf again.\n_LT_EOF\n      else\n        cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the\n$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.\n$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION\n$progname: and run autoconf again.\n_LT_EOF\n      fi\n    else\n      cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,\n$progname: but the definition of this LT_INIT comes from revision $macro_revision.\n$progname: You should recreate aclocal.m4 with macros from revision $package_revision\n$progname: of $PACKAGE $VERSION and run autoconf again.\n_LT_EOF\n    fi\n\n    exit $EXIT_MISMATCH\n  fi\n}\n\n\n# Shorthand for --mode=foo, only valid as the first argument\ncase $1 in\nclean|clea|cle|cl)\n  shift; set dummy --mode clean ${1+\"$@\"}; shift\n  ;;\ncompile|compil|compi|comp|com|co|c)\n  shift; set dummy --mode compile ${1+\"$@\"}; shift\n  ;;\nexecute|execut|execu|exec|exe|ex|e)\n  shift; set dummy --mode execute ${1+\"$@\"}; shift\n  ;;\nfinish|finis|fini|fin|fi|f)\n  shift; set dummy --mode finish ${1+\"$@\"}; shift\n  ;;\ninstall|instal|insta|inst|ins|in|i)\n  shift; set dummy --mode install ${1+\"$@\"}; shift\n  ;;\nlink|lin|li|l)\n  shift; set dummy --mode link ${1+\"$@\"}; shift\n  ;;\nuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)\n  shift; set dummy --mode uninstall ${1+\"$@\"}; shift\n  ;;\nesac\n\n\n\n# Option defaults:\nopt_debug=:\nopt_dry_run=false\nopt_config=false\nopt_preserve_dup_deps=false\nopt_features=false\nopt_finish=false\nopt_help=false\nopt_help_all=false\nopt_silent=:\nopt_warning=:\nopt_verbose=:\nopt_silent=false\nopt_verbose=false\n\n\n# Parse options once, thoroughly.  This comes as soon as possible in the\n# script to make things like `--version' happen as quickly as we can.\n{\n  # this just eases exit handling\n  while test $# -gt 0; do\n    opt=\"$1\"\n    shift\n    case $opt in\n      --debug|-x)\topt_debug='set -x'\n\t\t\tfunc_echo \"enabling shell trace mode\"\n\t\t\t$opt_debug\n\t\t\t;;\n      --dry-run|--dryrun|-n)\n\t\t\topt_dry_run=:\n\t\t\t;;\n      --config)\n\t\t\topt_config=:\nfunc_config\n\t\t\t;;\n      --dlopen|-dlopen)\n\t\t\toptarg=\"$1\"\n\t\t\topt_dlopen=\"${opt_dlopen+$opt_dlopen\n}$optarg\"\n\t\t\tshift\n\t\t\t;;\n      --preserve-dup-deps)\n\t\t\topt_preserve_dup_deps=:\n\t\t\t;;\n      --features)\n\t\t\topt_features=:\nfunc_features\n\t\t\t;;\n      --finish)\n\t\t\topt_finish=:\nset dummy --mode finish ${1+\"$@\"}; shift\n\t\t\t;;\n      --help)\n\t\t\topt_help=:\n\t\t\t;;\n      --help-all)\n\t\t\topt_help_all=:\nopt_help=': help-all'\n\t\t\t;;\n      --mode)\n\t\t\ttest $# = 0 && func_missing_arg $opt && break\n\t\t\toptarg=\"$1\"\n\t\t\topt_mode=\"$optarg\"\ncase $optarg in\n  # Valid mode arguments:\n  clean|compile|execute|finish|install|link|relink|uninstall) ;;\n\n  # Catch anything else as an error\n  *) func_error \"invalid argument for $opt\"\n     exit_cmd=exit\n     break\n     ;;\nesac\n\t\t\tshift\n\t\t\t;;\n      --no-silent|--no-quiet)\n\t\t\topt_silent=false\nfunc_append preserve_args \" $opt\"\n\t\t\t;;\n      --no-warning|--no-warn)\n\t\t\topt_warning=false\nfunc_append preserve_args \" $opt\"\n\t\t\t;;\n      --no-verbose)\n\t\t\topt_verbose=false\nfunc_append preserve_args \" $opt\"\n\t\t\t;;\n      --silent|--quiet)\n\t\t\topt_silent=:\nfunc_append preserve_args \" $opt\"\n        opt_verbose=false\n\t\t\t;;\n      --verbose|-v)\n\t\t\topt_verbose=:\nfunc_append preserve_args \" $opt\"\nopt_silent=false\n\t\t\t;;\n      --tag)\n\t\t\ttest $# = 0 && func_missing_arg $opt && break\n\t\t\toptarg=\"$1\"\n\t\t\topt_tag=\"$optarg\"\nfunc_append preserve_args \" $opt $optarg\"\nfunc_enable_tag \"$optarg\"\n\t\t\tshift\n\t\t\t;;\n\n      -\\?|-h)\t\tfunc_usage\t\t\t\t;;\n      --help)\t\tfunc_help\t\t\t\t;;\n      --version)\tfunc_version\t\t\t\t;;\n\n      # Separate optargs to long options:\n      --*=*)\n\t\t\tfunc_split_long_opt \"$opt\"\n\t\t\tset dummy \"$func_split_long_opt_name\" \"$func_split_long_opt_arg\" ${1+\"$@\"}\n\t\t\tshift\n\t\t\t;;\n\n      # Separate non-argument short options:\n      -\\?*|-h*|-n*|-v*)\n\t\t\tfunc_split_short_opt \"$opt\"\n\t\t\tset dummy \"$func_split_short_opt_name\" \"-$func_split_short_opt_arg\" ${1+\"$@\"}\n\t\t\tshift\n\t\t\t;;\n\n      --)\t\tbreak\t\t\t\t\t;;\n      -*)\t\tfunc_fatal_help \"unrecognized option \\`$opt'\" ;;\n      *)\t\tset dummy \"$opt\" ${1+\"$@\"};\tshift; break  ;;\n    esac\n  done\n\n  # Validate options:\n\n  # save first non-option argument\n  if test \"$#\" -gt 0; then\n    nonopt=\"$opt\"\n    shift\n  fi\n\n  # preserve --debug\n  test \"$opt_debug\" = : || func_append preserve_args \" --debug\"\n\n  case $host in\n    *cygwin* | *mingw* | *pw32* | *cegcc*)\n      # don't eliminate duplications in $postdeps and $predeps\n      opt_duplicate_compiler_generated_deps=:\n      ;;\n    *)\n      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps\n      ;;\n  esac\n\n  $opt_help || {\n    # Sanity checks first:\n    func_check_version_match\n\n    if test \"$build_libtool_libs\" != yes && test \"$build_old_libs\" != yes; then\n      func_fatal_configuration \"not configured to build any kind of library\"\n    fi\n\n    # Darwin sucks\n    eval std_shrext=\\\"$shrext_cmds\\\"\n\n    # Only execute mode is allowed to have -dlopen flags.\n    if test -n \"$opt_dlopen\" && test \"$opt_mode\" != execute; then\n      func_error \"unrecognized option \\`-dlopen'\"\n      $ECHO \"$help\" 1>&2\n      exit $EXIT_FAILURE\n    fi\n\n    # Change the help message to a mode-specific one.\n    generic_help=\"$help\"\n    help=\"Try \\`$progname --help --mode=$opt_mode' for more information.\"\n  }\n\n\n  # Bail if the options were screwed\n  $exit_cmd $EXIT_FAILURE\n}\n\n\n\n\n## ----------- ##\n##    Main.    ##\n## ----------- ##\n\n# func_lalib_p file\n# True iff FILE is a libtool `.la' library or `.lo' object file.\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_lalib_p ()\n{\n    test -f \"$1\" &&\n      $SED -e 4q \"$1\" 2>/dev/null \\\n        | $GREP \"^# Generated by .*$PACKAGE\" > /dev/null 2>&1\n}\n\n# func_lalib_unsafe_p file\n# True iff FILE is a libtool `.la' library or `.lo' object file.\n# This function implements the same check as func_lalib_p without\n# resorting to external programs.  To this end, it redirects stdin and\n# closes it afterwards, without saving the original file descriptor.\n# As a safety measure, use it only where a negative result would be\n# fatal anyway.  Works if `file' does not exist.\nfunc_lalib_unsafe_p ()\n{\n    lalib_p=no\n    if test -f \"$1\" && test -r \"$1\" && exec 5<&0 <\"$1\"; then\n\tfor lalib_p_l in 1 2 3 4\n\tdo\n\t    read lalib_p_line\n\t    case \"$lalib_p_line\" in\n\t\t\\#\\ Generated\\ by\\ *$PACKAGE* ) lalib_p=yes; break;;\n\t    esac\n\tdone\n\texec 0<&5 5<&-\n    fi\n    test \"$lalib_p\" = yes\n}\n\n# func_ltwrapper_script_p file\n# True iff FILE is a libtool wrapper script\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_script_p ()\n{\n    func_lalib_p \"$1\"\n}\n\n# func_ltwrapper_executable_p file\n# True iff FILE is a libtool wrapper executable\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_executable_p ()\n{\n    func_ltwrapper_exec_suffix=\n    case $1 in\n    *.exe) ;;\n    *) func_ltwrapper_exec_suffix=.exe ;;\n    esac\n    $GREP \"$magic_exe\" \"$1$func_ltwrapper_exec_suffix\" >/dev/null 2>&1\n}\n\n# func_ltwrapper_scriptname file\n# Assumes file is an ltwrapper_executable\n# uses $file to determine the appropriate filename for a\n# temporary ltwrapper_script.\nfunc_ltwrapper_scriptname ()\n{\n    func_dirname_and_basename \"$1\" \"\" \".\"\n    func_stripname '' '.exe' \"$func_basename_result\"\n    func_ltwrapper_scriptname_result=\"$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper\"\n}\n\n# func_ltwrapper_p file\n# True iff FILE is a libtool wrapper script or wrapper executable\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_p ()\n{\n    func_ltwrapper_script_p \"$1\" || func_ltwrapper_executable_p \"$1\"\n}\n\n\n# func_execute_cmds commands fail_cmd\n# Execute tilde-delimited COMMANDS.\n# If FAIL_CMD is given, eval that upon failure.\n# FAIL_CMD may read-access the current command in variable CMD!\nfunc_execute_cmds ()\n{\n    $opt_debug\n    save_ifs=$IFS; IFS='~'\n    for cmd in $1; do\n      IFS=$save_ifs\n      eval cmd=\\\"$cmd\\\"\n      func_show_eval \"$cmd\" \"${2-:}\"\n    done\n    IFS=$save_ifs\n}\n\n\n# func_source file\n# Source FILE, adding directory component if necessary.\n# Note that it is not necessary on cygwin/mingw to append a dot to\n# FILE even if both FILE and FILE.exe exist: automatic-append-.exe\n# behavior happens only for exec(3), not for open(2)!  Also, sourcing\n# `FILE.' does not work on cygwin managed mounts.\nfunc_source ()\n{\n    $opt_debug\n    case $1 in\n    */* | *\\\\*)\t. \"$1\" ;;\n    *)\t\t. \"./$1\" ;;\n    esac\n}\n\n\n# func_resolve_sysroot PATH\n# Replace a leading = in PATH with a sysroot.  Store the result into\n# func_resolve_sysroot_result\nfunc_resolve_sysroot ()\n{\n  func_resolve_sysroot_result=$1\n  case $func_resolve_sysroot_result in\n  =*)\n    func_stripname '=' '' \"$func_resolve_sysroot_result\"\n    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result\n    ;;\n  esac\n}\n\n# func_replace_sysroot PATH\n# If PATH begins with the sysroot, replace it with = and\n# store the result into func_replace_sysroot_result.\nfunc_replace_sysroot ()\n{\n  case \"$lt_sysroot:$1\" in\n  ?*:\"$lt_sysroot\"*)\n    func_stripname \"$lt_sysroot\" '' \"$1\"\n    func_replace_sysroot_result=\"=$func_stripname_result\"\n    ;;\n  *)\n    # Including no sysroot.\n    func_replace_sysroot_result=$1\n    ;;\n  esac\n}\n\n# func_infer_tag arg\n# Infer tagged configuration to use if any are available and\n# if one wasn't chosen via the \"--tag\" command line option.\n# Only attempt this if the compiler in the base compile\n# command doesn't match the default compiler.\n# arg is usually of the form 'gcc ...'\nfunc_infer_tag ()\n{\n    $opt_debug\n    if test -n \"$available_tags\" && test -z \"$tagname\"; then\n      CC_quoted=\n      for arg in $CC; do\n\tfunc_append_quoted CC_quoted \"$arg\"\n      done\n      CC_expanded=`func_echo_all $CC`\n      CC_quoted_expanded=`func_echo_all $CC_quoted`\n      case $@ in\n      # Blanks in the command may have been stripped by the calling shell,\n      # but not from the CC environment variable when configure was run.\n      \" $CC \"* | \"$CC \"* | \" $CC_expanded \"* | \"$CC_expanded \"* | \\\n      \" $CC_quoted\"* | \"$CC_quoted \"* | \" $CC_quoted_expanded \"* | \"$CC_quoted_expanded \"*) ;;\n      # Blanks at the start of $base_compile will cause this to fail\n      # if we don't check for them as well.\n      *)\n\tfor z in $available_tags; do\n\t  if $GREP \"^# ### BEGIN LIBTOOL TAG CONFIG: $z$\" < \"$progpath\" > /dev/null; then\n\t    # Evaluate the configuration.\n\t    eval \"`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`\"\n\t    CC_quoted=\n\t    for arg in $CC; do\n\t      # Double-quote args containing other shell metacharacters.\n\t      func_append_quoted CC_quoted \"$arg\"\n\t    done\n\t    CC_expanded=`func_echo_all $CC`\n\t    CC_quoted_expanded=`func_echo_all $CC_quoted`\n\t    case \"$@ \" in\n\t    \" $CC \"* | \"$CC \"* | \" $CC_expanded \"* | \"$CC_expanded \"* | \\\n\t    \" $CC_quoted\"* | \"$CC_quoted \"* | \" $CC_quoted_expanded \"* | \"$CC_quoted_expanded \"*)\n\t      # The compiler in the base compile command matches\n\t      # the one in the tagged configuration.\n\t      # Assume this is the tagged configuration we want.\n\t      tagname=$z\n\t      break\n\t      ;;\n\t    esac\n\t  fi\n\tdone\n\t# If $tagname still isn't set, then no tagged configuration\n\t# was found and let the user know that the \"--tag\" command\n\t# line option must be used.\n\tif test -z \"$tagname\"; then\n\t  func_echo \"unable to infer tagged configuration\"\n\t  func_fatal_error \"specify a tag with \\`--tag'\"\n#\telse\n#\t  func_verbose \"using $tagname tagged configuration\"\n\tfi\n\t;;\n      esac\n    fi\n}\n\n\n\n# func_write_libtool_object output_name pic_name nonpic_name\n# Create a libtool object file (analogous to a \".la\" file),\n# but don't create it if we're doing a dry run.\nfunc_write_libtool_object ()\n{\n    write_libobj=${1}\n    if test \"$build_libtool_libs\" = yes; then\n      write_lobj=\\'${2}\\'\n    else\n      write_lobj=none\n    fi\n\n    if test \"$build_old_libs\" = yes; then\n      write_oldobj=\\'${3}\\'\n    else\n      write_oldobj=none\n    fi\n\n    $opt_dry_run || {\n      cat >${write_libobj}T <<EOF\n# $write_libobj - a libtool object file\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# Name of the PIC object.\npic_object=$write_lobj\n\n# Name of the non-PIC object\nnon_pic_object=$write_oldobj\n\nEOF\n      $MV \"${write_libobj}T\" \"${write_libobj}\"\n    }\n}\n\n\n##################################################\n# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #\n##################################################\n\n# func_convert_core_file_wine_to_w32 ARG\n# Helper function used by file name conversion functions when $build is *nix,\n# and $host is mingw, cygwin, or some other w32 environment. Relies on a\n# correctly configured wine environment available, with the winepath program\n# in $build's $PATH.\n#\n# ARG is the $build file name to be converted to w32 format.\n# Result is available in $func_convert_core_file_wine_to_w32_result, and will\n# be empty on error (or when ARG is empty)\nfunc_convert_core_file_wine_to_w32 ()\n{\n  $opt_debug\n  func_convert_core_file_wine_to_w32_result=\"$1\"\n  if test -n \"$1\"; then\n    # Unfortunately, winepath does not exit with a non-zero error code, so we\n    # are forced to check the contents of stdout. On the other hand, if the\n    # command is not found, the shell will set an exit code of 127 and print\n    # *an error message* to stdout. So we must check for both error code of\n    # zero AND non-empty stdout, which explains the odd construction:\n    func_convert_core_file_wine_to_w32_tmp=`winepath -w \"$1\" 2>/dev/null`\n    if test \"$?\" -eq 0 && test -n \"${func_convert_core_file_wine_to_w32_tmp}\"; then\n      func_convert_core_file_wine_to_w32_result=`$ECHO \"$func_convert_core_file_wine_to_w32_tmp\" |\n        $SED -e \"$lt_sed_naive_backslashify\"`\n    else\n      func_convert_core_file_wine_to_w32_result=\n    fi\n  fi\n}\n# end: func_convert_core_file_wine_to_w32\n\n\n# func_convert_core_path_wine_to_w32 ARG\n# Helper function used by path conversion functions when $build is *nix, and\n# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly\n# configured wine environment available, with the winepath program in $build's\n# $PATH. Assumes ARG has no leading or trailing path separator characters.\n#\n# ARG is path to be converted from $build format to win32.\n# Result is available in $func_convert_core_path_wine_to_w32_result.\n# Unconvertible file (directory) names in ARG are skipped; if no directory names\n# are convertible, then the result may be empty.\nfunc_convert_core_path_wine_to_w32 ()\n{\n  $opt_debug\n  # unfortunately, winepath doesn't convert paths, only file names\n  func_convert_core_path_wine_to_w32_result=\"\"\n  if test -n \"$1\"; then\n    oldIFS=$IFS\n    IFS=:\n    for func_convert_core_path_wine_to_w32_f in $1; do\n      IFS=$oldIFS\n      func_convert_core_file_wine_to_w32 \"$func_convert_core_path_wine_to_w32_f\"\n      if test -n \"$func_convert_core_file_wine_to_w32_result\" ; then\n        if test -z \"$func_convert_core_path_wine_to_w32_result\"; then\n          func_convert_core_path_wine_to_w32_result=\"$func_convert_core_file_wine_to_w32_result\"\n        else\n          func_append func_convert_core_path_wine_to_w32_result \";$func_convert_core_file_wine_to_w32_result\"\n        fi\n      fi\n    done\n    IFS=$oldIFS\n  fi\n}\n# end: func_convert_core_path_wine_to_w32\n\n\n# func_cygpath ARGS...\n# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when\n# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)\n# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or\n# (2), returns the Cygwin file name or path in func_cygpath_result (input\n# file name or path is assumed to be in w32 format, as previously converted\n# from $build's *nix or MSYS format). In case (3), returns the w32 file name\n# or path in func_cygpath_result (input file name or path is assumed to be in\n# Cygwin format). Returns an empty string on error.\n#\n# ARGS are passed to cygpath, with the last one being the file name or path to\n# be converted.\n#\n# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH\n# environment variable; do not put it in $PATH.\nfunc_cygpath ()\n{\n  $opt_debug\n  if test -n \"$LT_CYGPATH\" && test -f \"$LT_CYGPATH\"; then\n    func_cygpath_result=`$LT_CYGPATH \"$@\" 2>/dev/null`\n    if test \"$?\" -ne 0; then\n      # on failure, ensure result is empty\n      func_cygpath_result=\n    fi\n  else\n    func_cygpath_result=\n    func_error \"LT_CYGPATH is empty or specifies non-existent file: \\`$LT_CYGPATH'\"\n  fi\n}\n#end: func_cygpath\n\n\n# func_convert_core_msys_to_w32 ARG\n# Convert file name or path ARG from MSYS format to w32 format.  Return\n# result in func_convert_core_msys_to_w32_result.\nfunc_convert_core_msys_to_w32 ()\n{\n  $opt_debug\n  # awkward: cmd appends spaces to result\n  func_convert_core_msys_to_w32_result=`( cmd //c echo \"$1\" ) 2>/dev/null |\n    $SED -e 's/[ ]*$//' -e \"$lt_sed_naive_backslashify\"`\n}\n#end: func_convert_core_msys_to_w32\n\n\n# func_convert_file_check ARG1 ARG2\n# Verify that ARG1 (a file name in $build format) was converted to $host\n# format in ARG2. Otherwise, emit an error message, but continue (resetting\n# func_to_host_file_result to ARG1).\nfunc_convert_file_check ()\n{\n  $opt_debug\n  if test -z \"$2\" && test -n \"$1\" ; then\n    func_error \"Could not determine host file name corresponding to\"\n    func_error \"  \\`$1'\"\n    func_error \"Continuing, but uninstalled executables may not work.\"\n    # Fallback:\n    func_to_host_file_result=\"$1\"\n  fi\n}\n# end func_convert_file_check\n\n\n# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH\n# Verify that FROM_PATH (a path in $build format) was converted to $host\n# format in TO_PATH. Otherwise, emit an error message, but continue, resetting\n# func_to_host_file_result to a simplistic fallback value (see below).\nfunc_convert_path_check ()\n{\n  $opt_debug\n  if test -z \"$4\" && test -n \"$3\"; then\n    func_error \"Could not determine the host path corresponding to\"\n    func_error \"  \\`$3'\"\n    func_error \"Continuing, but uninstalled executables may not work.\"\n    # Fallback.  This is a deliberately simplistic \"conversion\" and\n    # should not be \"improved\".  See libtool.info.\n    if test \"x$1\" != \"x$2\"; then\n      lt_replace_pathsep_chars=\"s|$1|$2|g\"\n      func_to_host_path_result=`echo \"$3\" |\n        $SED -e \"$lt_replace_pathsep_chars\"`\n    else\n      func_to_host_path_result=\"$3\"\n    fi\n  fi\n}\n# end func_convert_path_check\n\n\n# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG\n# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT\n# and appending REPL if ORIG matches BACKPAT.\nfunc_convert_path_front_back_pathsep ()\n{\n  $opt_debug\n  case $4 in\n  $1 ) func_to_host_path_result=\"$3$func_to_host_path_result\"\n    ;;\n  esac\n  case $4 in\n  $2 ) func_append func_to_host_path_result \"$3\"\n    ;;\n  esac\n}\n# end func_convert_path_front_back_pathsep\n\n\n##################################################\n# $build to $host FILE NAME CONVERSION FUNCTIONS #\n##################################################\n# invoked via `$to_host_file_cmd ARG'\n#\n# In each case, ARG is the path to be converted from $build to $host format.\n# Result will be available in $func_to_host_file_result.\n\n\n# func_to_host_file ARG\n# Converts the file name ARG from $build format to $host format. Return result\n# in func_to_host_file_result.\nfunc_to_host_file ()\n{\n  $opt_debug\n  $to_host_file_cmd \"$1\"\n}\n# end func_to_host_file\n\n\n# func_to_tool_file ARG LAZY\n# converts the file name ARG from $build format to toolchain format. Return\n# result in func_to_tool_file_result.  If the conversion in use is listed\n# in (the comma separated) LAZY, no conversion takes place.\nfunc_to_tool_file ()\n{\n  $opt_debug\n  case ,$2, in\n    *,\"$to_tool_file_cmd\",*)\n      func_to_tool_file_result=$1\n      ;;\n    *)\n      $to_tool_file_cmd \"$1\"\n      func_to_tool_file_result=$func_to_host_file_result\n      ;;\n  esac\n}\n# end func_to_tool_file\n\n\n# func_convert_file_noop ARG\n# Copy ARG to func_to_host_file_result.\nfunc_convert_file_noop ()\n{\n  func_to_host_file_result=\"$1\"\n}\n# end func_convert_file_noop\n\n\n# func_convert_file_msys_to_w32 ARG\n# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic\n# conversion to w32 is not available inside the cwrapper.  Returns result in\n# func_to_host_file_result.\nfunc_convert_file_msys_to_w32 ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    func_convert_core_msys_to_w32 \"$1\"\n    func_to_host_file_result=\"$func_convert_core_msys_to_w32_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_msys_to_w32\n\n\n# func_convert_file_cygwin_to_w32 ARG\n# Convert file name ARG from Cygwin to w32 format.  Returns result in\n# func_to_host_file_result.\nfunc_convert_file_cygwin_to_w32 ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    # because $build is cygwin, we call \"the\" cygpath in $PATH; no need to use\n    # LT_CYGPATH in this case.\n    func_to_host_file_result=`cygpath -m \"$1\"`\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_cygwin_to_w32\n\n\n# func_convert_file_nix_to_w32 ARG\n# Convert file name ARG from *nix to w32 format.  Requires a wine environment\n# and a working winepath. Returns result in func_to_host_file_result.\nfunc_convert_file_nix_to_w32 ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    func_convert_core_file_wine_to_w32 \"$1\"\n    func_to_host_file_result=\"$func_convert_core_file_wine_to_w32_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_nix_to_w32\n\n\n# func_convert_file_msys_to_cygwin ARG\n# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.\n# Returns result in func_to_host_file_result.\nfunc_convert_file_msys_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    func_convert_core_msys_to_w32 \"$1\"\n    func_cygpath -u \"$func_convert_core_msys_to_w32_result\"\n    func_to_host_file_result=\"$func_cygpath_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_msys_to_cygwin\n\n\n# func_convert_file_nix_to_cygwin ARG\n# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed\n# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result\n# in func_to_host_file_result.\nfunc_convert_file_nix_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.\n    func_convert_core_file_wine_to_w32 \"$1\"\n    func_cygpath -u \"$func_convert_core_file_wine_to_w32_result\"\n    func_to_host_file_result=\"$func_cygpath_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_nix_to_cygwin\n\n\n#############################################\n# $build to $host PATH CONVERSION FUNCTIONS #\n#############################################\n# invoked via `$to_host_path_cmd ARG'\n#\n# In each case, ARG is the path to be converted from $build to $host format.\n# The result will be available in $func_to_host_path_result.\n#\n# Path separators are also converted from $build format to $host format.  If\n# ARG begins or ends with a path separator character, it is preserved (but\n# converted to $host format) on output.\n#\n# All path conversion functions are named using the following convention:\n#   file name conversion function    : func_convert_file_X_to_Y ()\n#   path conversion function         : func_convert_path_X_to_Y ()\n# where, for any given $build/$host combination the 'X_to_Y' value is the\n# same.  If conversion functions are added for new $build/$host combinations,\n# the two new functions must follow this pattern, or func_init_to_host_path_cmd\n# will break.\n\n\n# func_init_to_host_path_cmd\n# Ensures that function \"pointer\" variable $to_host_path_cmd is set to the\n# appropriate value, based on the value of $to_host_file_cmd.\nto_host_path_cmd=\nfunc_init_to_host_path_cmd ()\n{\n  $opt_debug\n  if test -z \"$to_host_path_cmd\"; then\n    func_stripname 'func_convert_file_' '' \"$to_host_file_cmd\"\n    to_host_path_cmd=\"func_convert_path_${func_stripname_result}\"\n  fi\n}\n\n\n# func_to_host_path ARG\n# Converts the path ARG from $build format to $host format. Return result\n# in func_to_host_path_result.\nfunc_to_host_path ()\n{\n  $opt_debug\n  func_init_to_host_path_cmd\n  $to_host_path_cmd \"$1\"\n}\n# end func_to_host_path\n\n\n# func_convert_path_noop ARG\n# Copy ARG to func_to_host_path_result.\nfunc_convert_path_noop ()\n{\n  func_to_host_path_result=\"$1\"\n}\n# end func_convert_path_noop\n\n\n# func_convert_path_msys_to_w32 ARG\n# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic\n# conversion to w32 is not available inside the cwrapper.  Returns result in\n# func_to_host_path_result.\nfunc_convert_path_msys_to_w32 ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # Remove leading and trailing path separator characters from ARG.  MSYS\n    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';\n    # and winepath ignores them completely.\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_msys_to_w32 \"$func_to_host_path_tmp1\"\n    func_to_host_path_result=\"$func_convert_core_msys_to_w32_result\"\n    func_convert_path_check : \";\" \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" \";\" \"$1\"\n  fi\n}\n# end func_convert_path_msys_to_w32\n\n\n# func_convert_path_cygwin_to_w32 ARG\n# Convert path ARG from Cygwin to w32 format.  Returns result in\n# func_to_host_file_result.\nfunc_convert_path_cygwin_to_w32 ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # See func_convert_path_msys_to_w32:\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_to_host_path_result=`cygpath -m -p \"$func_to_host_path_tmp1\"`\n    func_convert_path_check : \";\" \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" \";\" \"$1\"\n  fi\n}\n# end func_convert_path_cygwin_to_w32\n\n\n# func_convert_path_nix_to_w32 ARG\n# Convert path ARG from *nix to w32 format.  Requires a wine environment and\n# a working winepath.  Returns result in func_to_host_file_result.\nfunc_convert_path_nix_to_w32 ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # See func_convert_path_msys_to_w32:\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_path_wine_to_w32 \"$func_to_host_path_tmp1\"\n    func_to_host_path_result=\"$func_convert_core_path_wine_to_w32_result\"\n    func_convert_path_check : \";\" \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" \";\" \"$1\"\n  fi\n}\n# end func_convert_path_nix_to_w32\n\n\n# func_convert_path_msys_to_cygwin ARG\n# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.\n# Returns result in func_to_host_file_result.\nfunc_convert_path_msys_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # See func_convert_path_msys_to_w32:\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_msys_to_w32 \"$func_to_host_path_tmp1\"\n    func_cygpath -u -p \"$func_convert_core_msys_to_w32_result\"\n    func_to_host_path_result=\"$func_cygpath_result\"\n    func_convert_path_check : : \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" : \"$1\"\n  fi\n}\n# end func_convert_path_msys_to_cygwin\n\n\n# func_convert_path_nix_to_cygwin ARG\n# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a\n# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in\n# func_to_host_file_result.\nfunc_convert_path_nix_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # Remove leading and trailing path separator characters from\n    # ARG. msys behavior is inconsistent here, cygpath turns them\n    # into '.;' and ';.', and winepath ignores them completely.\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_path_wine_to_w32 \"$func_to_host_path_tmp1\"\n    func_cygpath -u -p \"$func_convert_core_path_wine_to_w32_result\"\n    func_to_host_path_result=\"$func_cygpath_result\"\n    func_convert_path_check : : \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" : \"$1\"\n  fi\n}\n# end func_convert_path_nix_to_cygwin\n\n\n# func_mode_compile arg...\nfunc_mode_compile ()\n{\n    $opt_debug\n    # Get the compilation command and the source file.\n    base_compile=\n    srcfile=\"$nonopt\"  #  always keep a non-empty value in \"srcfile\"\n    suppress_opt=yes\n    suppress_output=\n    arg_mode=normal\n    libobj=\n    later=\n    pie_flag=\n\n    for arg\n    do\n      case $arg_mode in\n      arg  )\n\t# do not \"continue\".  Instead, add this to base_compile\n\tlastarg=\"$arg\"\n\targ_mode=normal\n\t;;\n\n      target )\n\tlibobj=\"$arg\"\n\targ_mode=normal\n\tcontinue\n\t;;\n\n      normal )\n\t# Accept any command-line options.\n\tcase $arg in\n\t-o)\n\t  test -n \"$libobj\" && \\\n\t    func_fatal_error \"you cannot specify \\`-o' more than once\"\n\t  arg_mode=target\n\t  continue\n\t  ;;\n\n\t-pie | -fpie | -fPIE)\n          func_append pie_flag \" $arg\"\n\t  continue\n\t  ;;\n\n\t-shared | -static | -prefer-pic | -prefer-non-pic)\n\t  func_append later \" $arg\"\n\t  continue\n\t  ;;\n\n\t-no-suppress)\n\t  suppress_opt=no\n\t  continue\n\t  ;;\n\n\t-Xcompiler)\n\t  arg_mode=arg  #  the next one goes into the \"base_compile\" arg list\n\t  continue      #  The current \"srcfile\" will either be retained or\n\t  ;;            #  replaced later.  I would guess that would be a bug.\n\n\t-Wc,*)\n\t  func_stripname '-Wc,' '' \"$arg\"\n\t  args=$func_stripname_result\n\t  lastarg=\n\t  save_ifs=\"$IFS\"; IFS=','\n\t  for arg in $args; do\n\t    IFS=\"$save_ifs\"\n\t    func_append_quoted lastarg \"$arg\"\n\t  done\n\t  IFS=\"$save_ifs\"\n\t  func_stripname ' ' '' \"$lastarg\"\n\t  lastarg=$func_stripname_result\n\n\t  # Add the arguments to base_compile.\n\t  func_append base_compile \" $lastarg\"\n\t  continue\n\t  ;;\n\n\t*)\n\t  # Accept the current argument as the source file.\n\t  # The previous \"srcfile\" becomes the current argument.\n\t  #\n\t  lastarg=\"$srcfile\"\n\t  srcfile=\"$arg\"\n\t  ;;\n\tesac  #  case $arg\n\t;;\n      esac    #  case $arg_mode\n\n      # Aesthetically quote the previous argument.\n      func_append_quoted base_compile \"$lastarg\"\n    done # for arg\n\n    case $arg_mode in\n    arg)\n      func_fatal_error \"you must specify an argument for -Xcompile\"\n      ;;\n    target)\n      func_fatal_error \"you must specify a target with \\`-o'\"\n      ;;\n    *)\n      # Get the name of the library object.\n      test -z \"$libobj\" && {\n\tfunc_basename \"$srcfile\"\n\tlibobj=\"$func_basename_result\"\n      }\n      ;;\n    esac\n\n    # Recognize several different file suffixes.\n    # If the user specifies -o file.o, it is replaced with file.lo\n    case $libobj in\n    *.[cCFSifmso] | \\\n    *.ada | *.adb | *.ads | *.asm | \\\n    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \\\n    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)\n      func_xform \"$libobj\"\n      libobj=$func_xform_result\n      ;;\n    esac\n\n    case $libobj in\n    *.lo) func_lo2o \"$libobj\"; obj=$func_lo2o_result ;;\n    *)\n      func_fatal_error \"cannot determine name of library object from \\`$libobj'\"\n      ;;\n    esac\n\n    func_infer_tag $base_compile\n\n    for arg in $later; do\n      case $arg in\n      -shared)\n\ttest \"$build_libtool_libs\" != yes && \\\n\t  func_fatal_configuration \"can not build a shared library\"\n\tbuild_old_libs=no\n\tcontinue\n\t;;\n\n      -static)\n\tbuild_libtool_libs=no\n\tbuild_old_libs=yes\n\tcontinue\n\t;;\n\n      -prefer-pic)\n\tpic_mode=yes\n\tcontinue\n\t;;\n\n      -prefer-non-pic)\n\tpic_mode=no\n\tcontinue\n\t;;\n      esac\n    done\n\n    func_quote_for_eval \"$libobj\"\n    test \"X$libobj\" != \"X$func_quote_for_eval_result\" \\\n      && $ECHO \"X$libobj\" | $GREP '[]~#^*{};<>?\"'\"'\"'\t &()|`$[]' \\\n      && func_warning \"libobj name \\`$libobj' may not contain shell special characters.\"\n    func_dirname_and_basename \"$obj\" \"/\" \"\"\n    objname=\"$func_basename_result\"\n    xdir=\"$func_dirname_result\"\n    lobj=${xdir}$objdir/$objname\n\n    test -z \"$base_compile\" && \\\n      func_fatal_help \"you must specify a compilation command\"\n\n    # Delete any leftover library objects.\n    if test \"$build_old_libs\" = yes; then\n      removelist=\"$obj $lobj $libobj ${libobj}T\"\n    else\n      removelist=\"$lobj $libobj ${libobj}T\"\n    fi\n\n    # On Cygwin there's no \"real\" PIC flag so we must build both object types\n    case $host_os in\n    cygwin* | mingw* | pw32* | os2* | cegcc*)\n      pic_mode=default\n      ;;\n    esac\n    if test \"$pic_mode\" = no && test \"$deplibs_check_method\" != pass_all; then\n      # non-PIC code in shared libraries is not supported\n      pic_mode=default\n    fi\n\n    # Calculate the filename of the output object if compiler does\n    # not support -o with -c\n    if test \"$compiler_c_o\" = no; then\n      output_obj=`$ECHO \"$srcfile\" | $SED 's%^.*/%%; s%\\.[^.]*$%%'`.${objext}\n      lockfile=\"$output_obj.lock\"\n    else\n      output_obj=\n      need_locks=no\n      lockfile=\n    fi\n\n    # Lock this critical section if it is needed\n    # We use this script file to make the link, it avoids creating a new file\n    if test \"$need_locks\" = yes; then\n      until $opt_dry_run || ln \"$progpath\" \"$lockfile\" 2>/dev/null; do\n\tfunc_echo \"Waiting for $lockfile to be removed\"\n\tsleep 2\n      done\n    elif test \"$need_locks\" = warn; then\n      if test -f \"$lockfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile exists and contains:\n`cat $lockfile 2>/dev/null`\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n      func_append removelist \" $output_obj\"\n      $ECHO \"$srcfile\" > \"$lockfile\"\n    fi\n\n    $opt_dry_run || $RM $removelist\n    func_append removelist \" $lockfile\"\n    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15\n\n    func_to_tool_file \"$srcfile\" func_convert_file_msys_to_w32\n    srcfile=$func_to_tool_file_result\n    func_quote_for_eval \"$srcfile\"\n    qsrcfile=$func_quote_for_eval_result\n\n    # Only build a PIC object if we are building libtool libraries.\n    if test \"$build_libtool_libs\" = yes; then\n      # Without this assignment, base_compile gets emptied.\n      fbsd_hideous_sh_bug=$base_compile\n\n      if test \"$pic_mode\" != no; then\n\tcommand=\"$base_compile $qsrcfile $pic_flag\"\n      else\n\t# Don't build PIC code\n\tcommand=\"$base_compile $qsrcfile\"\n      fi\n\n      func_mkdir_p \"$xdir$objdir\"\n\n      if test -z \"$output_obj\"; then\n\t# Place PIC objects in $objdir\n\tfunc_append command \" -o $lobj\"\n      fi\n\n      func_show_eval_locale \"$command\"\t\\\n          'test -n \"$output_obj\" && $RM $removelist; exit $EXIT_FAILURE'\n\n      if test \"$need_locks\" = warn &&\n\t test \"X`cat $lockfile 2>/dev/null`\" != \"X$srcfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile contains:\n`cat $lockfile 2>/dev/null`\n\nbut it should contain:\n$srcfile\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n\n      # Just move the object if needed, then go on to compile the next one\n      if test -n \"$output_obj\" && test \"X$output_obj\" != \"X$lobj\"; then\n\tfunc_show_eval '$MV \"$output_obj\" \"$lobj\"' \\\n\t  'error=$?; $opt_dry_run || $RM $removelist; exit $error'\n      fi\n\n      # Allow error messages only from the first compilation.\n      if test \"$suppress_opt\" = yes; then\n\tsuppress_output=' >/dev/null 2>&1'\n      fi\n    fi\n\n    # Only build a position-dependent object if we build old libraries.\n    if test \"$build_old_libs\" = yes; then\n      if test \"$pic_mode\" != yes; then\n\t# Don't build PIC code\n\tcommand=\"$base_compile $qsrcfile$pie_flag\"\n      else\n\tcommand=\"$base_compile $qsrcfile $pic_flag\"\n      fi\n      if test \"$compiler_c_o\" = yes; then\n\tfunc_append command \" -o $obj\"\n      fi\n\n      # Suppress compiler output if we already did a PIC compilation.\n      func_append command \"$suppress_output\"\n      func_show_eval_locale \"$command\" \\\n        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'\n\n      if test \"$need_locks\" = warn &&\n\t test \"X`cat $lockfile 2>/dev/null`\" != \"X$srcfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile contains:\n`cat $lockfile 2>/dev/null`\n\nbut it should contain:\n$srcfile\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n\n      # Just move the object if needed\n      if test -n \"$output_obj\" && test \"X$output_obj\" != \"X$obj\"; then\n\tfunc_show_eval '$MV \"$output_obj\" \"$obj\"' \\\n\t  'error=$?; $opt_dry_run || $RM $removelist; exit $error'\n      fi\n    fi\n\n    $opt_dry_run || {\n      func_write_libtool_object \"$libobj\" \"$objdir/$objname\" \"$objname\"\n\n      # Unlock the critical section if it was locked\n      if test \"$need_locks\" != no; then\n\tremovelist=$lockfile\n        $RM \"$lockfile\"\n      fi\n    }\n\n    exit $EXIT_SUCCESS\n}\n\n$opt_help || {\n  test \"$opt_mode\" = compile && func_mode_compile ${1+\"$@\"}\n}\n\nfunc_mode_help ()\n{\n    # We need to display help for each of the modes.\n    case $opt_mode in\n      \"\")\n        # Generic help is extracted from the usage comments\n        # at the start of this file.\n        func_help\n        ;;\n\n      clean)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...\n\nRemove files from the build directory.\n\nRM is the name of the program to use to delete files associated with each FILE\n(typically \\`/bin/rm').  RM-OPTIONS are options (such as \\`-f') to be passed\nto RM.\n\nIf FILE is a libtool library, object or program, all the files associated\nwith it are deleted. Otherwise, only FILE itself is deleted using RM.\"\n        ;;\n\n      compile)\n      $ECHO \\\n\"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE\n\nCompile a source file into a libtool library object.\n\nThis mode accepts the following additional options:\n\n  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE\n  -no-suppress      do not suppress compiler output for multiple passes\n  -prefer-pic       try to build PIC objects only\n  -prefer-non-pic   try to build non-PIC objects only\n  -shared           do not build a \\`.o' file suitable for static linking\n  -static           only build a \\`.o' file suitable for static linking\n  -Wc,FLAG          pass FLAG directly to the compiler\n\nCOMPILE-COMMAND is a command to be used in creating a \\`standard' object file\nfrom the given SOURCEFILE.\n\nThe output file name is determined by removing the directory component from\nSOURCEFILE, then substituting the C source code suffix \\`.c' with the\nlibrary object suffix, \\`.lo'.\"\n        ;;\n\n      execute)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...\n\nAutomatically set library path, then run a program.\n\nThis mode accepts the following additional options:\n\n  -dlopen FILE      add the directory containing FILE to the library path\n\nThis mode sets the library path environment variable according to \\`-dlopen'\nflags.\n\nIf any of the ARGS are libtool executable wrappers, then they are translated\ninto their corresponding uninstalled binary, and any of their required library\ndirectories are added to the library path.\n\nThen, COMMAND is executed, with ARGS as arguments.\"\n        ;;\n\n      finish)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...\n\nComplete the installation of libtool libraries.\n\nEach LIBDIR is a directory that contains libtool libraries.\n\nThe commands that this mode executes may require superuser privileges.  Use\nthe \\`--dry-run' option if you just want to see what would be executed.\"\n        ;;\n\n      install)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...\n\nInstall executables or libraries.\n\nINSTALL-COMMAND is the installation command.  The first component should be\neither the \\`install' or \\`cp' program.\n\nThe following components of INSTALL-COMMAND are treated specially:\n\n  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation\n\nThe rest of the components are interpreted as arguments to that command (only\nBSD-compatible install options are recognized).\"\n        ;;\n\n      link)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...\n\nLink object files or libraries together to form another library, or to\ncreate an executable program.\n\nLINK-COMMAND is a command using the C compiler that you would use to create\na program from several object files.\n\nThe following components of LINK-COMMAND are treated specially:\n\n  -all-static       do not do any dynamic linking at all\n  -avoid-version    do not add a version suffix if possible\n  -bindir BINDIR    specify path to binaries directory (for systems where\n                    libraries must be found in the PATH setting at runtime)\n  -dlopen FILE      \\`-dlpreopen' FILE if it cannot be dlopened at runtime\n  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols\n  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)\n  -export-symbols SYMFILE\n                    try to export only the symbols listed in SYMFILE\n  -export-symbols-regex REGEX\n                    try to export only the symbols matching REGEX\n  -LLIBDIR          search LIBDIR for required installed libraries\n  -lNAME            OUTPUT-FILE requires the installed library libNAME\n  -module           build a library that can dlopened\n  -no-fast-install  disable the fast-install mode\n  -no-install       link a not-installable executable\n  -no-undefined     declare that a library does not refer to external symbols\n  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects\n  -objectlist FILE  Use a list of object files found in FILE to specify objects\n  -precious-files-regex REGEX\n                    don't remove output files matching REGEX\n  -release RELEASE  specify package release information\n  -rpath LIBDIR     the created library will eventually be installed in LIBDIR\n  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries\n  -shared           only do dynamic linking of libtool libraries\n  -shrext SUFFIX    override the standard shared library file extension\n  -static           do not do any dynamic linking of uninstalled libtool libraries\n  -static-libtool-libs\n                    do not do any dynamic linking of libtool libraries\n  -version-info CURRENT[:REVISION[:AGE]]\n                    specify library version info [each variable defaults to 0]\n  -weak LIBNAME     declare that the target provides the LIBNAME interface\n  -Wc,FLAG\n  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler\n  -Wl,FLAG\n  -Xlinker FLAG     pass linker-specific FLAG directly to the linker\n  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)\n\nAll other options (arguments beginning with \\`-') are ignored.\n\nEvery other argument is treated as a filename.  Files ending in \\`.la' are\ntreated as uninstalled libtool libraries, other files are standard or library\nobject files.\n\nIf the OUTPUT-FILE ends in \\`.la', then a libtool library is created,\nonly library objects (\\`.lo' files) may be specified, and \\`-rpath' is\nrequired, except when creating a convenience library.\n\nIf OUTPUT-FILE ends in \\`.a' or \\`.lib', then a standard library is created\nusing \\`ar' and \\`ranlib', or on Windows using \\`lib'.\n\nIf OUTPUT-FILE ends in \\`.lo' or \\`.${objext}', then a reloadable object file\nis created, otherwise an executable program is created.\"\n        ;;\n\n      uninstall)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...\n\nRemove libraries from an installation directory.\n\nRM is the name of the program to use to delete files associated with each FILE\n(typically \\`/bin/rm').  RM-OPTIONS are options (such as \\`-f') to be passed\nto RM.\n\nIf FILE is a libtool library, all the files associated with it are deleted.\nOtherwise, only FILE itself is deleted using RM.\"\n        ;;\n\n      *)\n        func_fatal_help \"invalid operation mode \\`$opt_mode'\"\n        ;;\n    esac\n\n    echo\n    $ECHO \"Try \\`$progname --help' for more information about other modes.\"\n}\n\n# Now that we've collected a possible --mode arg, show help if necessary\nif $opt_help; then\n  if test \"$opt_help\" = :; then\n    func_mode_help\n  else\n    {\n      func_help noexit\n      for opt_mode in compile link execute install finish uninstall clean; do\n\tfunc_mode_help\n      done\n    } | sed -n '1p; 2,$s/^Usage:/  or: /p'\n    {\n      func_help noexit\n      for opt_mode in compile link execute install finish uninstall clean; do\n\techo\n\tfunc_mode_help\n      done\n    } |\n    sed '1d\n      /^When reporting/,/^Report/{\n\tH\n\td\n      }\n      $x\n      /information about other modes/d\n      /more detailed .*MODE/d\n      s/^Usage:.*--mode=\\([^ ]*\\) .*/Description of \\1 mode:/'\n  fi\n  exit $?\nfi\n\n\n# func_mode_execute arg...\nfunc_mode_execute ()\n{\n    $opt_debug\n    # The first argument is the command name.\n    cmd=\"$nonopt\"\n    test -z \"$cmd\" && \\\n      func_fatal_help \"you must specify a COMMAND\"\n\n    # Handle -dlopen flags immediately.\n    for file in $opt_dlopen; do\n      test -f \"$file\" \\\n\t|| func_fatal_help \"\\`$file' is not a file\"\n\n      dir=\n      case $file in\n      *.la)\n\tfunc_resolve_sysroot \"$file\"\n\tfile=$func_resolve_sysroot_result\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$file\" \\\n\t  || func_fatal_help \"\\`$lib' is not a valid libtool archive\"\n\n\t# Read the libtool library.\n\tdlname=\n\tlibrary_names=\n\tfunc_source \"$file\"\n\n\t# Skip this library if it cannot be dlopened.\n\tif test -z \"$dlname\"; then\n\t  # Warn if it was a shared library.\n\t  test -n \"$library_names\" && \\\n\t    func_warning \"\\`$file' was not linked with \\`-export-dynamic'\"\n\t  continue\n\tfi\n\n\tfunc_dirname \"$file\" \"\" \".\"\n\tdir=\"$func_dirname_result\"\n\n\tif test -f \"$dir/$objdir/$dlname\"; then\n\t  func_append dir \"/$objdir\"\n\telse\n\t  if test ! -f \"$dir/$dlname\"; then\n\t    func_fatal_error \"cannot find \\`$dlname' in \\`$dir' or \\`$dir/$objdir'\"\n\t  fi\n\tfi\n\t;;\n\n      *.lo)\n\t# Just add the directory containing the .lo file.\n\tfunc_dirname \"$file\" \"\" \".\"\n\tdir=\"$func_dirname_result\"\n\t;;\n\n      *)\n\tfunc_warning \"\\`-dlopen' is ignored for non-libtool libraries and objects\"\n\tcontinue\n\t;;\n      esac\n\n      # Get the absolute pathname.\n      absdir=`cd \"$dir\" && pwd`\n      test -n \"$absdir\" && dir=\"$absdir\"\n\n      # Now add the directory to shlibpath_var.\n      if eval \"test -z \\\"\\$$shlibpath_var\\\"\"; then\n\teval \"$shlibpath_var=\\\"\\$dir\\\"\"\n      else\n\teval \"$shlibpath_var=\\\"\\$dir:\\$$shlibpath_var\\\"\"\n      fi\n    done\n\n    # This variable tells wrapper scripts just to set shlibpath_var\n    # rather than running their programs.\n    libtool_execute_magic=\"$magic\"\n\n    # Check if any of the arguments is a wrapper script.\n    args=\n    for file\n    do\n      case $file in\n      -* | *.la | *.lo ) ;;\n      *)\n\t# Do a test to see if this is really a libtool program.\n\tif func_ltwrapper_script_p \"$file\"; then\n\t  func_source \"$file\"\n\t  # Transform arg to wrapped name.\n\t  file=\"$progdir/$program\"\n\telif func_ltwrapper_executable_p \"$file\"; then\n\t  func_ltwrapper_scriptname \"$file\"\n\t  func_source \"$func_ltwrapper_scriptname_result\"\n\t  # Transform arg to wrapped name.\n\t  file=\"$progdir/$program\"\n\tfi\n\t;;\n      esac\n      # Quote arguments (to preserve shell metacharacters).\n      func_append_quoted args \"$file\"\n    done\n\n    if test \"X$opt_dry_run\" = Xfalse; then\n      if test -n \"$shlibpath_var\"; then\n\t# Export the shlibpath_var.\n\teval \"export $shlibpath_var\"\n      fi\n\n      # Restore saved environment variables\n      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES\n      do\n\teval \"if test \\\"\\${save_$lt_var+set}\\\" = set; then\n                $lt_var=\\$save_$lt_var; export $lt_var\n\t      else\n\t\t$lt_unset $lt_var\n\t      fi\"\n      done\n\n      # Now prepare to actually exec the command.\n      exec_cmd=\"\\$cmd$args\"\n    else\n      # Display what would be done.\n      if test -n \"$shlibpath_var\"; then\n\teval \"\\$ECHO \\\"\\$shlibpath_var=\\$$shlibpath_var\\\"\"\n\techo \"export $shlibpath_var\"\n      fi\n      $ECHO \"$cmd$args\"\n      exit $EXIT_SUCCESS\n    fi\n}\n\ntest \"$opt_mode\" = execute && func_mode_execute ${1+\"$@\"}\n\n\n# func_mode_finish arg...\nfunc_mode_finish ()\n{\n    $opt_debug\n    libs=\n    libdirs=\n    admincmds=\n\n    for opt in \"$nonopt\" ${1+\"$@\"}\n    do\n      if test -d \"$opt\"; then\n\tfunc_append libdirs \" $opt\"\n\n      elif test -f \"$opt\"; then\n\tif func_lalib_unsafe_p \"$opt\"; then\n\t  func_append libs \" $opt\"\n\telse\n\t  func_warning \"\\`$opt' is not a valid libtool archive\"\n\tfi\n\n      else\n\tfunc_fatal_error \"invalid argument \\`$opt'\"\n      fi\n    done\n\n    if test -n \"$libs\"; then\n      if test -n \"$lt_sysroot\"; then\n        sysroot_regex=`$ECHO \"$lt_sysroot\" | $SED \"$sed_make_literal_regex\"`\n        sysroot_cmd=\"s/\\([ ']\\)$sysroot_regex/\\1/g;\"\n      else\n        sysroot_cmd=\n      fi\n\n      # Remove sysroot references\n      if $opt_dry_run; then\n        for lib in $libs; do\n          echo \"removing references to $lt_sysroot and \\`=' prefixes from $lib\"\n        done\n      else\n        tmpdir=`func_mktempdir`\n        for lib in $libs; do\n\t  sed -e \"${sysroot_cmd} s/\\([ ']-[LR]\\)=/\\1/g; s/\\([ ']\\)=/\\1/g\" $lib \\\n\t    > $tmpdir/tmp-la\n\t  mv -f $tmpdir/tmp-la $lib\n\tdone\n        ${RM}r \"$tmpdir\"\n      fi\n    fi\n\n    if test -n \"$finish_cmds$finish_eval\" && test -n \"$libdirs\"; then\n      for libdir in $libdirs; do\n\tif test -n \"$finish_cmds\"; then\n\t  # Do each command in the finish commands.\n\t  func_execute_cmds \"$finish_cmds\" 'admincmds=\"$admincmds\n'\"$cmd\"'\"'\n\tfi\n\tif test -n \"$finish_eval\"; then\n\t  # Do the single finish_eval.\n\t  eval cmds=\\\"$finish_eval\\\"\n\t  $opt_dry_run || eval \"$cmds\" || func_append admincmds \"\n       $cmds\"\n\tfi\n      done\n    fi\n\n    # Exit here if they wanted silent mode.\n    $opt_silent && exit $EXIT_SUCCESS\n\n    if test -n \"$finish_cmds$finish_eval\" && test -n \"$libdirs\"; then\n      echo \"----------------------------------------------------------------------\"\n      echo \"Libraries have been installed in:\"\n      for libdir in $libdirs; do\n\t$ECHO \"   $libdir\"\n      done\n      echo\n      echo \"If you ever happen to want to link against installed libraries\"\n      echo \"in a given directory, LIBDIR, you must either use libtool, and\"\n      echo \"specify the full pathname of the library, or use the \\`-LLIBDIR'\"\n      echo \"flag during linking and do at least one of the following:\"\n      if test -n \"$shlibpath_var\"; then\n\techo \"   - add LIBDIR to the \\`$shlibpath_var' environment variable\"\n\techo \"     during execution\"\n      fi\n      if test -n \"$runpath_var\"; then\n\techo \"   - add LIBDIR to the \\`$runpath_var' environment variable\"\n\techo \"     during linking\"\n      fi\n      if test -n \"$hardcode_libdir_flag_spec\"; then\n\tlibdir=LIBDIR\n\teval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\n\t$ECHO \"   - use the \\`$flag' linker flag\"\n      fi\n      if test -n \"$admincmds\"; then\n\t$ECHO \"   - have your system administrator run these commands:$admincmds\"\n      fi\n      if test -f /etc/ld.so.conf; then\n\techo \"   - have your system administrator add LIBDIR to \\`/etc/ld.so.conf'\"\n      fi\n      echo\n\n      echo \"See any operating system documentation about shared libraries for\"\n      case $host in\n\tsolaris2.[6789]|solaris2.1[0-9])\n\t  echo \"more information, such as the ld(1), crle(1) and ld.so(8) manual\"\n\t  echo \"pages.\"\n\t  ;;\n\t*)\n\t  echo \"more information, such as the ld(1) and ld.so(8) manual pages.\"\n\t  ;;\n      esac\n      echo \"----------------------------------------------------------------------\"\n    fi\n    exit $EXIT_SUCCESS\n}\n\ntest \"$opt_mode\" = finish && func_mode_finish ${1+\"$@\"}\n\n\n# func_mode_install arg...\nfunc_mode_install ()\n{\n    $opt_debug\n    # There may be an optional sh(1) argument at the beginning of\n    # install_prog (especially on Windows NT).\n    if test \"$nonopt\" = \"$SHELL\" || test \"$nonopt\" = /bin/sh ||\n       # Allow the use of GNU shtool's install command.\n       case $nonopt in *shtool*) :;; *) false;; esac; then\n      # Aesthetically quote it.\n      func_quote_for_eval \"$nonopt\"\n      install_prog=\"$func_quote_for_eval_result \"\n      arg=$1\n      shift\n    else\n      install_prog=\n      arg=$nonopt\n    fi\n\n    # The real first argument should be the name of the installation program.\n    # Aesthetically quote it.\n    func_quote_for_eval \"$arg\"\n    func_append install_prog \"$func_quote_for_eval_result\"\n    install_shared_prog=$install_prog\n    case \" $install_prog \" in\n      *[\\\\\\ /]cp\\ *) install_cp=: ;;\n      *) install_cp=false ;;\n    esac\n\n    # We need to accept at least all the BSD install flags.\n    dest=\n    files=\n    opts=\n    prev=\n    install_type=\n    isdir=no\n    stripme=\n    no_mode=:\n    for arg\n    do\n      arg2=\n      if test -n \"$dest\"; then\n\tfunc_append files \" $dest\"\n\tdest=$arg\n\tcontinue\n      fi\n\n      case $arg in\n      -d) isdir=yes ;;\n      -f)\n\tif $install_cp; then :; else\n\t  prev=$arg\n\tfi\n\t;;\n      -g | -m | -o)\n\tprev=$arg\n\t;;\n      -s)\n\tstripme=\" -s\"\n\tcontinue\n\t;;\n      -*)\n\t;;\n      *)\n\t# If the previous option needed an argument, then skip it.\n\tif test -n \"$prev\"; then\n\t  if test \"x$prev\" = x-m && test -n \"$install_override_mode\"; then\n\t    arg2=$install_override_mode\n\t    no_mode=false\n\t  fi\n\t  prev=\n\telse\n\t  dest=$arg\n\t  continue\n\tfi\n\t;;\n      esac\n\n      # Aesthetically quote the argument.\n      func_quote_for_eval \"$arg\"\n      func_append install_prog \" $func_quote_for_eval_result\"\n      if test -n \"$arg2\"; then\n\tfunc_quote_for_eval \"$arg2\"\n      fi\n      func_append install_shared_prog \" $func_quote_for_eval_result\"\n    done\n\n    test -z \"$install_prog\" && \\\n      func_fatal_help \"you must specify an install program\"\n\n    test -n \"$prev\" && \\\n      func_fatal_help \"the \\`$prev' option requires an argument\"\n\n    if test -n \"$install_override_mode\" && $no_mode; then\n      if $install_cp; then :; else\n\tfunc_quote_for_eval \"$install_override_mode\"\n\tfunc_append install_shared_prog \" -m $func_quote_for_eval_result\"\n      fi\n    fi\n\n    if test -z \"$files\"; then\n      if test -z \"$dest\"; then\n\tfunc_fatal_help \"no file or destination specified\"\n      else\n\tfunc_fatal_help \"you must specify a destination\"\n      fi\n    fi\n\n    # Strip any trailing slash from the destination.\n    func_stripname '' '/' \"$dest\"\n    dest=$func_stripname_result\n\n    # Check to see that the destination is a directory.\n    test -d \"$dest\" && isdir=yes\n    if test \"$isdir\" = yes; then\n      destdir=\"$dest\"\n      destname=\n    else\n      func_dirname_and_basename \"$dest\" \"\" \".\"\n      destdir=\"$func_dirname_result\"\n      destname=\"$func_basename_result\"\n\n      # Not a directory, so check to see that there is only one file specified.\n      set dummy $files; shift\n      test \"$#\" -gt 1 && \\\n\tfunc_fatal_help \"\\`$dest' is not a directory\"\n    fi\n    case $destdir in\n    [\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n    *)\n      for file in $files; do\n\tcase $file in\n\t*.lo) ;;\n\t*)\n\t  func_fatal_help \"\\`$destdir' must be an absolute directory name\"\n\t  ;;\n\tesac\n      done\n      ;;\n    esac\n\n    # This variable tells wrapper scripts just to set variables rather\n    # than running their programs.\n    libtool_install_magic=\"$magic\"\n\n    staticlibs=\n    future_libdirs=\n    current_libdirs=\n    for file in $files; do\n\n      # Do each installation.\n      case $file in\n      *.$libext)\n\t# Do the static libraries later.\n\tfunc_append staticlibs \" $file\"\n\t;;\n\n      *.la)\n\tfunc_resolve_sysroot \"$file\"\n\tfile=$func_resolve_sysroot_result\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$file\" \\\n\t  || func_fatal_help \"\\`$file' is not a valid libtool archive\"\n\n\tlibrary_names=\n\told_library=\n\trelink_command=\n\tfunc_source \"$file\"\n\n\t# Add the libdir to current_libdirs if it is the destination.\n\tif test \"X$destdir\" = \"X$libdir\"; then\n\t  case \"$current_libdirs \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append current_libdirs \" $libdir\" ;;\n\t  esac\n\telse\n\t  # Note the libdir as a future libdir.\n\t  case \"$future_libdirs \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append future_libdirs \" $libdir\" ;;\n\t  esac\n\tfi\n\n\tfunc_dirname \"$file\" \"/\" \"\"\n\tdir=\"$func_dirname_result\"\n\tfunc_append dir \"$objdir\"\n\n\tif test -n \"$relink_command\"; then\n\t  # Determine the prefix the user has applied to our future dir.\n\t  inst_prefix_dir=`$ECHO \"$destdir\" | $SED -e \"s%$libdir\\$%%\"`\n\n\t  # Don't allow the user to place us outside of our expected\n\t  # location b/c this prevents finding dependent libraries that\n\t  # are installed to the same prefix.\n\t  # At present, this check doesn't affect windows .dll's that\n\t  # are installed into $libdir/../bin (currently, that works fine)\n\t  # but it's something to keep an eye on.\n\t  test \"$inst_prefix_dir\" = \"$destdir\" && \\\n\t    func_fatal_error \"error: cannot install \\`$file' to a directory not ending in $libdir\"\n\n\t  if test -n \"$inst_prefix_dir\"; then\n\t    # Stick the inst_prefix_dir data into the link command.\n\t    relink_command=`$ECHO \"$relink_command\" | $SED \"s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%\"`\n\t  else\n\t    relink_command=`$ECHO \"$relink_command\" | $SED \"s%@inst_prefix_dir@%%\"`\n\t  fi\n\n\t  func_warning \"relinking \\`$file'\"\n\t  func_show_eval \"$relink_command\" \\\n\t    'func_fatal_error \"error: relink \\`$file'\\'' with the above command before installing it\"'\n\tfi\n\n\t# See the names of the shared library.\n\tset dummy $library_names; shift\n\tif test -n \"$1\"; then\n\t  realname=\"$1\"\n\t  shift\n\n\t  srcname=\"$realname\"\n\t  test -n \"$relink_command\" && srcname=\"$realname\"T\n\n\t  # Install the shared library and build the symlinks.\n\t  func_show_eval \"$install_shared_prog $dir/$srcname $destdir/$realname\" \\\n\t      'exit $?'\n\t  tstripme=\"$stripme\"\n\t  case $host_os in\n\t  cygwin* | mingw* | pw32* | cegcc*)\n\t    case $realname in\n\t    *.dll.a)\n\t      tstripme=\"\"\n\t      ;;\n\t    esac\n\t    ;;\n\t  esac\n\t  if test -n \"$tstripme\" && test -n \"$striplib\"; then\n\t    func_show_eval \"$striplib $destdir/$realname\" 'exit $?'\n\t  fi\n\n\t  if test \"$#\" -gt 0; then\n\t    # Delete the old symlinks, and create new ones.\n\t    # Try `ln -sf' first, because the `ln' binary might depend on\n\t    # the symlink we replace!  Solaris /bin/ln does not understand -f,\n\t    # so we also need to try rm && ln -s.\n\t    for linkname\n\t    do\n\t      test \"$linkname\" != \"$realname\" \\\n\t\t&& func_show_eval \"(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })\"\n\t    done\n\t  fi\n\n\t  # Do each command in the postinstall commands.\n\t  lib=\"$destdir/$realname\"\n\t  func_execute_cmds \"$postinstall_cmds\" 'exit $?'\n\tfi\n\n\t# Install the pseudo-library for information purposes.\n\tfunc_basename \"$file\"\n\tname=\"$func_basename_result\"\n\tinstname=\"$dir/$name\"i\n\tfunc_show_eval \"$install_prog $instname $destdir/$name\" 'exit $?'\n\n\t# Maybe install the static library, too.\n\ttest -n \"$old_library\" && func_append staticlibs \" $dir/$old_library\"\n\t;;\n\n      *.lo)\n\t# Install (i.e. copy) a libtool object.\n\n\t# Figure out destination file name, if it wasn't already specified.\n\tif test -n \"$destname\"; then\n\t  destfile=\"$destdir/$destname\"\n\telse\n\t  func_basename \"$file\"\n\t  destfile=\"$func_basename_result\"\n\t  destfile=\"$destdir/$destfile\"\n\tfi\n\n\t# Deduce the name of the destination old-style object file.\n\tcase $destfile in\n\t*.lo)\n\t  func_lo2o \"$destfile\"\n\t  staticdest=$func_lo2o_result\n\t  ;;\n\t*.$objext)\n\t  staticdest=\"$destfile\"\n\t  destfile=\n\t  ;;\n\t*)\n\t  func_fatal_help \"cannot copy a libtool object to \\`$destfile'\"\n\t  ;;\n\tesac\n\n\t# Install the libtool object if requested.\n\ttest -n \"$destfile\" && \\\n\t  func_show_eval \"$install_prog $file $destfile\" 'exit $?'\n\n\t# Install the old object if enabled.\n\tif test \"$build_old_libs\" = yes; then\n\t  # Deduce the name of the old-style object file.\n\t  func_lo2o \"$file\"\n\t  staticobj=$func_lo2o_result\n\t  func_show_eval \"$install_prog \\$staticobj \\$staticdest\" 'exit $?'\n\tfi\n\texit $EXIT_SUCCESS\n\t;;\n\n      *)\n\t# Figure out destination file name, if it wasn't already specified.\n\tif test -n \"$destname\"; then\n\t  destfile=\"$destdir/$destname\"\n\telse\n\t  func_basename \"$file\"\n\t  destfile=\"$func_basename_result\"\n\t  destfile=\"$destdir/$destfile\"\n\tfi\n\n\t# If the file is missing, and there is a .exe on the end, strip it\n\t# because it is most likely a libtool script we actually want to\n\t# install\n\tstripped_ext=\"\"\n\tcase $file in\n\t  *.exe)\n\t    if test ! -f \"$file\"; then\n\t      func_stripname '' '.exe' \"$file\"\n\t      file=$func_stripname_result\n\t      stripped_ext=\".exe\"\n\t    fi\n\t    ;;\n\tesac\n\n\t# Do a test to see if this is really a libtool program.\n\tcase $host in\n\t*cygwin* | *mingw*)\n\t    if func_ltwrapper_executable_p \"$file\"; then\n\t      func_ltwrapper_scriptname \"$file\"\n\t      wrapper=$func_ltwrapper_scriptname_result\n\t    else\n\t      func_stripname '' '.exe' \"$file\"\n\t      wrapper=$func_stripname_result\n\t    fi\n\t    ;;\n\t*)\n\t    wrapper=$file\n\t    ;;\n\tesac\n\tif func_ltwrapper_script_p \"$wrapper\"; then\n\t  notinst_deplibs=\n\t  relink_command=\n\n\t  func_source \"$wrapper\"\n\n\t  # Check the variables that should have been set.\n\t  test -z \"$generated_by_libtool_version\" && \\\n\t    func_fatal_error \"invalid libtool wrapper script \\`$wrapper'\"\n\n\t  finalize=yes\n\t  for lib in $notinst_deplibs; do\n\t    # Check to see that each library is installed.\n\t    libdir=\n\t    if test -f \"$lib\"; then\n\t      func_source \"$lib\"\n\t    fi\n\t    libfile=\"$libdir/\"`$ECHO \"$lib\" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test\n\t    if test -n \"$libdir\" && test ! -f \"$libfile\"; then\n\t      func_warning \"\\`$lib' has not been installed in \\`$libdir'\"\n\t      finalize=no\n\t    fi\n\t  done\n\n\t  relink_command=\n\t  func_source \"$wrapper\"\n\n\t  outputname=\n\t  if test \"$fast_install\" = no && test -n \"$relink_command\"; then\n\t    $opt_dry_run || {\n\t      if test \"$finalize\" = yes; then\n\t        tmpdir=`func_mktempdir`\n\t\tfunc_basename \"$file$stripped_ext\"\n\t\tfile=\"$func_basename_result\"\n\t        outputname=\"$tmpdir/$file\"\n\t        # Replace the output file specification.\n\t        relink_command=`$ECHO \"$relink_command\" | $SED 's%@OUTPUT@%'\"$outputname\"'%g'`\n\n\t        $opt_silent || {\n\t          func_quote_for_expand \"$relink_command\"\n\t\t  eval \"func_echo $func_quote_for_expand_result\"\n\t        }\n\t        if eval \"$relink_command\"; then :\n\t          else\n\t\t  func_error \"error: relink \\`$file' with the above command before installing it\"\n\t\t  $opt_dry_run || ${RM}r \"$tmpdir\"\n\t\t  continue\n\t        fi\n\t        file=\"$outputname\"\n\t      else\n\t        func_warning \"cannot relink \\`$file'\"\n\t      fi\n\t    }\n\t  else\n\t    # Install the binary that we compiled earlier.\n\t    file=`$ECHO \"$file$stripped_ext\" | $SED \"s%\\([^/]*\\)$%$objdir/\\1%\"`\n\t  fi\n\tfi\n\n\t# remove .exe since cygwin /usr/bin/install will append another\n\t# one anyway\n\tcase $install_prog,$host in\n\t*/usr/bin/install*,*cygwin*)\n\t  case $file:$destfile in\n\t  *.exe:*.exe)\n\t    # this is ok\n\t    ;;\n\t  *.exe:*)\n\t    destfile=$destfile.exe\n\t    ;;\n\t  *:*.exe)\n\t    func_stripname '' '.exe' \"$destfile\"\n\t    destfile=$func_stripname_result\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tfunc_show_eval \"$install_prog\\$stripme \\$file \\$destfile\" 'exit $?'\n\t$opt_dry_run || if test -n \"$outputname\"; then\n\t  ${RM}r \"$tmpdir\"\n\tfi\n\t;;\n      esac\n    done\n\n    for file in $staticlibs; do\n      func_basename \"$file\"\n      name=\"$func_basename_result\"\n\n      # Set up the ranlib parameters.\n      oldlib=\"$destdir/$name\"\n      func_to_tool_file \"$oldlib\" func_convert_file_msys_to_w32\n      tool_oldlib=$func_to_tool_file_result\n\n      func_show_eval \"$install_prog \\$file \\$oldlib\" 'exit $?'\n\n      if test -n \"$stripme\" && test -n \"$old_striplib\"; then\n\tfunc_show_eval \"$old_striplib $tool_oldlib\" 'exit $?'\n      fi\n\n      # Do each command in the postinstall commands.\n      func_execute_cmds \"$old_postinstall_cmds\" 'exit $?'\n    done\n\n    test -n \"$future_libdirs\" && \\\n      func_warning \"remember to run \\`$progname --finish$future_libdirs'\"\n\n    if test -n \"$current_libdirs\"; then\n      # Maybe just do a dry run.\n      $opt_dry_run && current_libdirs=\" -n$current_libdirs\"\n      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'\n    else\n      exit $EXIT_SUCCESS\n    fi\n}\n\ntest \"$opt_mode\" = install && func_mode_install ${1+\"$@\"}\n\n\n# func_generate_dlsyms outputname originator pic_p\n# Extract symbols from dlprefiles and create ${outputname}S.o with\n# a dlpreopen symbol table.\nfunc_generate_dlsyms ()\n{\n    $opt_debug\n    my_outputname=\"$1\"\n    my_originator=\"$2\"\n    my_pic_p=\"${3-no}\"\n    my_prefix=`$ECHO \"$my_originator\" | sed 's%[^a-zA-Z0-9]%_%g'`\n    my_dlsyms=\n\n    if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n      if test -n \"$NM\" && test -n \"$global_symbol_pipe\"; then\n\tmy_dlsyms=\"${my_outputname}S.c\"\n      else\n\tfunc_error \"not configured to extract global symbols from dlpreopened files\"\n      fi\n    fi\n\n    if test -n \"$my_dlsyms\"; then\n      case $my_dlsyms in\n      \"\") ;;\n      *.c)\n\t# Discover the nlist of each of the dlfiles.\n\tnlist=\"$output_objdir/${my_outputname}.nm\"\n\n\tfunc_show_eval \"$RM $nlist ${nlist}S ${nlist}T\"\n\n\t# Parse the name list into a source file.\n\tfunc_verbose \"creating $output_objdir/$my_dlsyms\"\n\n\t$opt_dry_run || $ECHO > \"$output_objdir/$my_dlsyms\" \"\\\n/* $my_dlsyms - symbol resolution table for \\`$my_outputname' dlsym emulation. */\n/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */\n\n#ifdef __cplusplus\nextern \\\"C\\\" {\n#endif\n\n#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))\n#pragma GCC diagnostic ignored \\\"-Wstrict-prototypes\\\"\n#endif\n\n/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */\n#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)\n/* DATA imports from DLLs on WIN32 con't be const, because runtime\n   relocations are performed -- see ld's documentation on pseudo-relocs.  */\n# define LT_DLSYM_CONST\n#elif defined(__osf__)\n/* This system does not cope well with relocations in const data.  */\n# define LT_DLSYM_CONST\n#else\n# define LT_DLSYM_CONST const\n#endif\n\n/* External symbol declarations for the compiler. */\\\n\"\n\n\tif test \"$dlself\" = yes; then\n\t  func_verbose \"generating symbol list for \\`$output'\"\n\n\t  $opt_dry_run || echo ': @PROGRAM@ ' > \"$nlist\"\n\n\t  # Add our own program objects to the symbol list.\n\t  progfiles=`$ECHO \"$objs$old_deplibs\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n\t  for progfile in $progfiles; do\n\t    func_to_tool_file \"$progfile\" func_convert_file_msys_to_w32\n\t    func_verbose \"extracting global C symbols from \\`$func_to_tool_file_result'\"\n\t    $opt_dry_run || eval \"$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'\"\n\t  done\n\n\t  if test -n \"$exclude_expsyms\"; then\n\t    $opt_dry_run || {\n\t      eval '$EGREP -v \" ($exclude_expsyms)$\" \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t    }\n\t  fi\n\n\t  if test -n \"$export_symbols_regex\"; then\n\t    $opt_dry_run || {\n\t      eval '$EGREP -e \"$export_symbols_regex\" \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t    }\n\t  fi\n\n\t  # Prepare the list of exported symbols\n\t  if test -z \"$export_symbols\"; then\n\t    export_symbols=\"$output_objdir/$outputname.exp\"\n\t    $opt_dry_run || {\n\t      $RM $export_symbols\n\t      eval \"${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \\(.*\\)$/\\1/p' \"'< \"$nlist\" > \"$export_symbols\"'\n\t      case $host in\n\t      *cygwin* | *mingw* | *cegcc* )\n                eval \"echo EXPORTS \"'> \"$output_objdir/$outputname.def\"'\n                eval 'cat \"$export_symbols\" >> \"$output_objdir/$outputname.def\"'\n\t        ;;\n\t      esac\n\t    }\n\t  else\n\t    $opt_dry_run || {\n\t      eval \"${SED} -e 's/\\([].[*^$]\\)/\\\\\\\\\\1/g' -e 's/^/ /' -e 's/$/$/'\"' < \"$export_symbols\" > \"$output_objdir/$outputname.exp\"'\n\t      eval '$GREP -f \"$output_objdir/$outputname.exp\" < \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t      case $host in\n\t        *cygwin* | *mingw* | *cegcc* )\n\t          eval \"echo EXPORTS \"'> \"$output_objdir/$outputname.def\"'\n\t          eval 'cat \"$nlist\" >> \"$output_objdir/$outputname.def\"'\n\t          ;;\n\t      esac\n\t    }\n\t  fi\n\tfi\n\n\tfor dlprefile in $dlprefiles; do\n\t  func_verbose \"extracting global C symbols from \\`$dlprefile'\"\n\t  func_basename \"$dlprefile\"\n\t  name=\"$func_basename_result\"\n          case $host in\n\t    *cygwin* | *mingw* | *cegcc* )\n\t      # if an import library, we need to obtain dlname\n\t      if func_win32_import_lib_p \"$dlprefile\"; then\n\t        func_tr_sh \"$dlprefile\"\n\t        eval \"curr_lafile=\\$libfile_$func_tr_sh_result\"\n\t        dlprefile_dlbasename=\"\"\n\t        if test -n \"$curr_lafile\" && func_lalib_p \"$curr_lafile\"; then\n\t          # Use subshell, to avoid clobbering current variable values\n\t          dlprefile_dlname=`source \"$curr_lafile\" && echo \"$dlname\"`\n\t          if test -n \"$dlprefile_dlname\" ; then\n\t            func_basename \"$dlprefile_dlname\"\n\t            dlprefile_dlbasename=\"$func_basename_result\"\n\t          else\n\t            # no lafile. user explicitly requested -dlpreopen <import library>.\n\t            $sharedlib_from_linklib_cmd \"$dlprefile\"\n\t            dlprefile_dlbasename=$sharedlib_from_linklib_result\n\t          fi\n\t        fi\n\t        $opt_dry_run || {\n\t          if test -n \"$dlprefile_dlbasename\" ; then\n\t            eval '$ECHO \": $dlprefile_dlbasename\" >> \"$nlist\"'\n\t          else\n\t            func_warning \"Could not compute DLL name from $name\"\n\t            eval '$ECHO \": $name \" >> \"$nlist\"'\n\t          fi\n\t          func_to_tool_file \"$dlprefile\" func_convert_file_msys_to_w32\n\t          eval \"$NM \\\"$func_to_tool_file_result\\\" 2>/dev/null | $global_symbol_pipe |\n\t            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'\"\n\t        }\n\t      else # not an import lib\n\t        $opt_dry_run || {\n\t          eval '$ECHO \": $name \" >> \"$nlist\"'\n\t          func_to_tool_file \"$dlprefile\" func_convert_file_msys_to_w32\n\t          eval \"$NM \\\"$func_to_tool_file_result\\\" 2>/dev/null | $global_symbol_pipe >> '$nlist'\"\n\t        }\n\t      fi\n\t    ;;\n\t    *)\n\t      $opt_dry_run || {\n\t        eval '$ECHO \": $name \" >> \"$nlist\"'\n\t        func_to_tool_file \"$dlprefile\" func_convert_file_msys_to_w32\n\t        eval \"$NM \\\"$func_to_tool_file_result\\\" 2>/dev/null | $global_symbol_pipe >> '$nlist'\"\n\t      }\n\t    ;;\n          esac\n\tdone\n\n\t$opt_dry_run || {\n\t  # Make sure we have at least an empty file.\n\t  test -f \"$nlist\" || : > \"$nlist\"\n\n\t  if test -n \"$exclude_expsyms\"; then\n\t    $EGREP -v \" ($exclude_expsyms)$\" \"$nlist\" > \"$nlist\"T\n\t    $MV \"$nlist\"T \"$nlist\"\n\t  fi\n\n\t  # Try sorting and uniquifying the output.\n\t  if $GREP -v \"^: \" < \"$nlist\" |\n\t      if sort -k 3 </dev/null >/dev/null 2>&1; then\n\t\tsort -k 3\n\t      else\n\t\tsort +2\n\t      fi |\n\t      uniq > \"$nlist\"S; then\n\t    :\n\t  else\n\t    $GREP -v \"^: \" < \"$nlist\" > \"$nlist\"S\n\t  fi\n\n\t  if test -f \"$nlist\"S; then\n\t    eval \"$global_symbol_to_cdecl\"' < \"$nlist\"S >> \"$output_objdir/$my_dlsyms\"'\n\t  else\n\t    echo '/* NONE */' >> \"$output_objdir/$my_dlsyms\"\n\t  fi\n\n\t  echo >> \"$output_objdir/$my_dlsyms\" \"\\\n\n/* The mapping between symbol names and symbols.  */\ntypedef struct {\n  const char *name;\n  void *address;\n} lt_dlsymlist;\nextern LT_DLSYM_CONST lt_dlsymlist\nlt_${my_prefix}_LTX_preloaded_symbols[];\nLT_DLSYM_CONST lt_dlsymlist\nlt_${my_prefix}_LTX_preloaded_symbols[] =\n{\\\n  { \\\"$my_originator\\\", (void *) 0 },\"\n\n\t  case $need_lib_prefix in\n\t  no)\n\t    eval \"$global_symbol_to_c_name_address\" < \"$nlist\" >> \"$output_objdir/$my_dlsyms\"\n\t    ;;\n\t  *)\n\t    eval \"$global_symbol_to_c_name_address_lib_prefix\" < \"$nlist\" >> \"$output_objdir/$my_dlsyms\"\n\t    ;;\n\t  esac\n\t  echo >> \"$output_objdir/$my_dlsyms\" \"\\\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt_${my_prefix}_LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\\\n\"\n\t} # !$opt_dry_run\n\n\tpic_flag_for_symtable=\n\tcase \"$compile_command \" in\n\t*\" -static \"*) ;;\n\t*)\n\t  case $host in\n\t  # compiling the symbol table file with pic_flag works around\n\t  # a FreeBSD bug that causes programs to crash when -lm is\n\t  # linked before any other PIC object.  But we must not use\n\t  # pic_flag when linking with -static.  The problem exists in\n\t  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.\n\t  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)\n\t    pic_flag_for_symtable=\" $pic_flag -DFREEBSD_WORKAROUND\" ;;\n\t  *-*-hpux*)\n\t    pic_flag_for_symtable=\" $pic_flag\"  ;;\n\t  *)\n\t    if test \"X$my_pic_p\" != Xno; then\n\t      pic_flag_for_symtable=\" $pic_flag\"\n\t    fi\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tsymtab_cflags=\n\tfor arg in $LTCFLAGS; do\n\t  case $arg in\n\t  -pie | -fpie | -fPIE) ;;\n\t  *) func_append symtab_cflags \" $arg\" ;;\n\t  esac\n\tdone\n\n\t# Now compile the dynamic symbol file.\n\tfunc_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")' 'exit $?'\n\n\t# Clean up the generated files.\n\tfunc_show_eval '$RM \"$output_objdir/$my_dlsyms\" \"$nlist\" \"${nlist}S\" \"${nlist}T\"'\n\n\t# Transform the symbol file into the correct name.\n\tsymfileobj=\"$output_objdir/${my_outputname}S.$objext\"\n\tcase $host in\n\t*cygwin* | *mingw* | *cegcc* )\n\t  if test -f \"$output_objdir/$my_outputname.def\"; then\n\t    compile_command=`$ECHO \"$compile_command\" | $SED \"s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%\"`\n\t    finalize_command=`$ECHO \"$finalize_command\" | $SED \"s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%\"`\n\t  else\n\t    compile_command=`$ECHO \"$compile_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t    finalize_command=`$ECHO \"$finalize_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t  fi\n\t  ;;\n\t*)\n\t  compile_command=`$ECHO \"$compile_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t  finalize_command=`$ECHO \"$finalize_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t  ;;\n\tesac\n\t;;\n      *)\n\tfunc_fatal_error \"unknown suffix for \\`$my_dlsyms'\"\n\t;;\n      esac\n    else\n      # We keep going just in case the user didn't refer to\n      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe\n      # really was required.\n\n      # Nullify the symbol file.\n      compile_command=`$ECHO \"$compile_command\" | $SED \"s% @SYMFILE@%%\"`\n      finalize_command=`$ECHO \"$finalize_command\" | $SED \"s% @SYMFILE@%%\"`\n    fi\n}\n\n# func_win32_libid arg\n# return the library type of file 'arg'\n#\n# Need a lot of goo to handle *both* DLLs and import libs\n# Has to be a shell function in order to 'eat' the argument\n# that is supplied when $file_magic_command is called.\n# Despite the name, also deal with 64 bit binaries.\nfunc_win32_libid ()\n{\n  $opt_debug\n  win32_libid_type=\"unknown\"\n  win32_fileres=`file -L $1 2>/dev/null`\n  case $win32_fileres in\n  *ar\\ archive\\ import\\ library*) # definitely import\n    win32_libid_type=\"x86 archive import\"\n    ;;\n  *ar\\ archive*) # could be an import, or static\n    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.\n    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |\n       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then\n      func_to_tool_file \"$1\" func_convert_file_msys_to_w32\n      win32_nmres=`eval $NM -f posix -A \\\"$func_to_tool_file_result\\\" |\n\t$SED -n -e '\n\t    1,100{\n\t\t/ I /{\n\t\t    s,.*,import,\n\t\t    p\n\t\t    q\n\t\t}\n\t    }'`\n      case $win32_nmres in\n      import*)  win32_libid_type=\"x86 archive import\";;\n      *)        win32_libid_type=\"x86 archive static\";;\n      esac\n    fi\n    ;;\n  *DLL*)\n    win32_libid_type=\"x86 DLL\"\n    ;;\n  *executable*) # but shell scripts are \"executable\" too...\n    case $win32_fileres in\n    *MS\\ Windows\\ PE\\ Intel*)\n      win32_libid_type=\"x86 DLL\"\n      ;;\n    esac\n    ;;\n  esac\n  $ECHO \"$win32_libid_type\"\n}\n\n# func_cygming_dll_for_implib ARG\n#\n# Platform-specific function to extract the\n# name of the DLL associated with the specified\n# import library ARG.\n# Invoked by eval'ing the libtool variable\n#    $sharedlib_from_linklib_cmd\n# Result is available in the variable\n#    $sharedlib_from_linklib_result\nfunc_cygming_dll_for_implib ()\n{\n  $opt_debug\n  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify \"$1\"`\n}\n\n# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs\n#\n# The is the core of a fallback implementation of a\n# platform-specific function to extract the name of the\n# DLL associated with the specified import library LIBNAME.\n#\n# SECTION_NAME is either .idata$6 or .idata$7, depending\n# on the platform and compiler that created the implib.\n#\n# Echos the name of the DLL associated with the\n# specified import library.\nfunc_cygming_dll_for_implib_fallback_core ()\n{\n  $opt_debug\n  match_literal=`$ECHO \"$1\" | $SED \"$sed_make_literal_regex\"`\n  $OBJDUMP -s --section \"$1\" \"$2\" 2>/dev/null |\n    $SED '/^Contents of section '\"$match_literal\"':/{\n      # Place marker at beginning of archive member dllname section\n      s/.*/====MARK====/\n      p\n      d\n    }\n    # These lines can sometimes be longer than 43 characters, but\n    # are always uninteresting\n    /:[\t ]*file format pe[i]\\{,1\\}-/d\n    /^In archive [^:]*:/d\n    # Ensure marker is printed\n    /^====MARK====/p\n    # Remove all lines with less than 43 characters\n    /^.\\{43\\}/!d\n    # From remaining lines, remove first 43 characters\n    s/^.\\{43\\}//' |\n    $SED -n '\n      # Join marker and all lines until next marker into a single line\n      /^====MARK====/ b para\n      H\n      $ b para\n      b\n      :para\n      x\n      s/\\n//g\n      # Remove the marker\n      s/^====MARK====//\n      # Remove trailing dots and whitespace\n      s/[\\. \\t]*$//\n      # Print\n      /./p' |\n    # we now have a list, one entry per line, of the stringified\n    # contents of the appropriate section of all members of the\n    # archive which possess that section. Heuristic: eliminate\n    # all those which have a first or second character that is\n    # a '.' (that is, objdump's representation of an unprintable\n    # character.) This should work for all archives with less than\n    # 0x302f exports -- but will fail for DLLs whose name actually\n    # begins with a literal '.' or a single character followed by\n    # a '.'.\n    #\n    # Of those that remain, print the first one.\n    $SED -e '/^\\./d;/^.\\./d;q'\n}\n\n# func_cygming_gnu_implib_p ARG\n# This predicate returns with zero status (TRUE) if\n# ARG is a GNU/binutils-style import library. Returns\n# with nonzero status (FALSE) otherwise.\nfunc_cygming_gnu_implib_p ()\n{\n  $opt_debug\n  func_to_tool_file \"$1\" func_convert_file_msys_to_w32\n  func_cygming_gnu_implib_tmp=`$NM \"$func_to_tool_file_result\" | eval \"$global_symbol_pipe\" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`\n  test -n \"$func_cygming_gnu_implib_tmp\"\n}\n\n# func_cygming_ms_implib_p ARG\n# This predicate returns with zero status (TRUE) if\n# ARG is an MS-style import library. Returns\n# with nonzero status (FALSE) otherwise.\nfunc_cygming_ms_implib_p ()\n{\n  $opt_debug\n  func_to_tool_file \"$1\" func_convert_file_msys_to_w32\n  func_cygming_ms_implib_tmp=`$NM \"$func_to_tool_file_result\" | eval \"$global_symbol_pipe\" | $GREP '_NULL_IMPORT_DESCRIPTOR'`\n  test -n \"$func_cygming_ms_implib_tmp\"\n}\n\n# func_cygming_dll_for_implib_fallback ARG\n# Platform-specific function to extract the\n# name of the DLL associated with the specified\n# import library ARG.\n#\n# This fallback implementation is for use when $DLLTOOL\n# does not support the --identify-strict option.\n# Invoked by eval'ing the libtool variable\n#    $sharedlib_from_linklib_cmd\n# Result is available in the variable\n#    $sharedlib_from_linklib_result\nfunc_cygming_dll_for_implib_fallback ()\n{\n  $opt_debug\n  if func_cygming_gnu_implib_p \"$1\" ; then\n    # binutils import library\n    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' \"$1\"`\n  elif func_cygming_ms_implib_p \"$1\" ; then\n    # ms-generated import library\n    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' \"$1\"`\n  else\n    # unknown\n    sharedlib_from_linklib_result=\"\"\n  fi\n}\n\n\n# func_extract_an_archive dir oldlib\nfunc_extract_an_archive ()\n{\n    $opt_debug\n    f_ex_an_ar_dir=\"$1\"; shift\n    f_ex_an_ar_oldlib=\"$1\"\n    if test \"$lock_old_archive_extraction\" = yes; then\n      lockfile=$f_ex_an_ar_oldlib.lock\n      until $opt_dry_run || ln \"$progpath\" \"$lockfile\" 2>/dev/null; do\n\tfunc_echo \"Waiting for $lockfile to be removed\"\n\tsleep 2\n      done\n    fi\n    func_show_eval \"(cd \\$f_ex_an_ar_dir && $AR x \\\"\\$f_ex_an_ar_oldlib\\\")\" \\\n\t\t   'stat=$?; rm -f \"$lockfile\"; exit $stat'\n    if test \"$lock_old_archive_extraction\" = yes; then\n      $opt_dry_run || rm -f \"$lockfile\"\n    fi\n    if ($AR t \"$f_ex_an_ar_oldlib\" | sort | sort -uc >/dev/null 2>&1); then\n     :\n    else\n      func_fatal_error \"object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib\"\n    fi\n}\n\n\n# func_extract_archives gentop oldlib ...\nfunc_extract_archives ()\n{\n    $opt_debug\n    my_gentop=\"$1\"; shift\n    my_oldlibs=${1+\"$@\"}\n    my_oldobjs=\"\"\n    my_xlib=\"\"\n    my_xabs=\"\"\n    my_xdir=\"\"\n\n    for my_xlib in $my_oldlibs; do\n      # Extract the objects.\n      case $my_xlib in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) my_xabs=\"$my_xlib\" ;;\n\t*) my_xabs=`pwd`\"/$my_xlib\" ;;\n      esac\n      func_basename \"$my_xlib\"\n      my_xlib=\"$func_basename_result\"\n      my_xlib_u=$my_xlib\n      while :; do\n        case \" $extracted_archives \" in\n\t*\" $my_xlib_u \"*)\n\t  func_arith $extracted_serial + 1\n\t  extracted_serial=$func_arith_result\n\t  my_xlib_u=lt$extracted_serial-$my_xlib ;;\n\t*) break ;;\n\tesac\n      done\n      extracted_archives=\"$extracted_archives $my_xlib_u\"\n      my_xdir=\"$my_gentop/$my_xlib_u\"\n\n      func_mkdir_p \"$my_xdir\"\n\n      case $host in\n      *-darwin*)\n\tfunc_verbose \"Extracting $my_xabs\"\n\t# Do not bother doing anything if just a dry run\n\t$opt_dry_run || {\n\t  darwin_orig_dir=`pwd`\n\t  cd $my_xdir || exit $?\n\t  darwin_archive=$my_xabs\n\t  darwin_curdir=`pwd`\n\t  darwin_base_archive=`basename \"$darwin_archive\"`\n\t  darwin_arches=`$LIPO -info \"$darwin_archive\" 2>/dev/null | $GREP Architectures 2>/dev/null || true`\n\t  if test -n \"$darwin_arches\"; then\n\t    darwin_arches=`$ECHO \"$darwin_arches\" | $SED -e 's/.*are://'`\n\t    darwin_arch=\n\t    func_verbose \"$darwin_base_archive has multiple architectures $darwin_arches\"\n\t    for darwin_arch in  $darwin_arches ; do\n\t      func_mkdir_p \"unfat-$$/${darwin_base_archive}-${darwin_arch}\"\n\t      $LIPO -thin $darwin_arch -output \"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}\" \"${darwin_archive}\"\n\t      cd \"unfat-$$/${darwin_base_archive}-${darwin_arch}\"\n\t      func_extract_an_archive \"`pwd`\" \"${darwin_base_archive}\"\n\t      cd \"$darwin_curdir\"\n\t      $RM \"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}\"\n\t    done # $darwin_arches\n            ## Okay now we've a bunch of thin objects, gotta fatten them up :)\n\t    darwin_filelist=`find unfat-$$ -type f -name \\*.o -print -o -name \\*.lo -print | $SED -e \"$basename\" | sort -u`\n\t    darwin_file=\n\t    darwin_files=\n\t    for darwin_file in $darwin_filelist; do\n\t      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`\n\t      $LIPO -create -output \"$darwin_file\" $darwin_files\n\t    done # $darwin_filelist\n\t    $RM -rf unfat-$$\n\t    cd \"$darwin_orig_dir\"\n\t  else\n\t    cd $darwin_orig_dir\n\t    func_extract_an_archive \"$my_xdir\" \"$my_xabs\"\n\t  fi # $darwin_arches\n\t} # !$opt_dry_run\n\t;;\n      *)\n        func_extract_an_archive \"$my_xdir\" \"$my_xabs\"\n\t;;\n      esac\n      my_oldobjs=\"$my_oldobjs \"`find $my_xdir -name \\*.$objext -print -o -name \\*.lo -print | sort | $NL2SP`\n    done\n\n    func_extract_archives_result=\"$my_oldobjs\"\n}\n\n\n# func_emit_wrapper [arg=no]\n#\n# Emit a libtool wrapper script on stdout.\n# Don't directly open a file because we may want to\n# incorporate the script contents within a cygwin/mingw\n# wrapper executable.  Must ONLY be called from within\n# func_mode_link because it depends on a number of variables\n# set therein.\n#\n# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\n# variable will take.  If 'yes', then the emitted script\n# will assume that the directory in which it is stored is\n# the $objdir directory.  This is a cygwin/mingw-specific\n# behavior.\nfunc_emit_wrapper ()\n{\n\tfunc_emit_wrapper_arg1=${1-no}\n\n\t$ECHO \"\\\n#! $SHELL\n\n# $output - temporary wrapper script for $objdir/$outputname\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# The $output program cannot be directly executed until all the libtool\n# libraries that it depends on are installed.\n#\n# This wrapper script should never be moved out of the build directory.\n# If it is, it will not operate correctly.\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nsed_quote_subst='$sed_quote_subst'\n\n# Be Bourne compatible\nif test -n \\\"\\${ZSH_VERSION+set}\\\" && (emulate sh) >/dev/null 2>&1; then\n  emulate sh\n  NULLCMD=:\n  # Zsh 3.x and 4.x performs word splitting on \\${1+\\\"\\$@\\\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '\\${1+\\\"\\$@\\\"}'='\\\"\\$@\\\"'\n  setopt NO_GLOB_SUBST\nelse\n  case \\`(set -o) 2>/dev/null\\` in *posix*) set -o posix;; esac\nfi\nBIN_SH=xpg4; export BIN_SH # for Tru64\nDUALCASE=1; export DUALCASE # for MKS sh\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nrelink_command=\\\"$relink_command\\\"\n\n# This environment variable determines our operation mode.\nif test \\\"\\$libtool_install_magic\\\" = \\\"$magic\\\"; then\n  # install mode needs the following variables:\n  generated_by_libtool_version='$macro_version'\n  notinst_deplibs='$notinst_deplibs'\nelse\n  # When we are sourced in execute mode, \\$file and \\$ECHO are already set.\n  if test \\\"\\$libtool_execute_magic\\\" != \\\"$magic\\\"; then\n    file=\\\"\\$0\\\"\"\n\n    qECHO=`$ECHO \"$ECHO\" | $SED \"$sed_quote_subst\"`\n    $ECHO \"\\\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n\\$1\n_LTECHO_EOF'\n}\n    ECHO=\\\"$qECHO\\\"\n  fi\n\n# Very basic option parsing. These options are (a) specific to\n# the libtool wrapper, (b) are identical between the wrapper\n# /script/ and the wrapper /executable/ which is used only on\n# windows platforms, and (c) all begin with the string \"--lt-\"\n# (application programs are unlikely to have options which match\n# this pattern).\n#\n# There are only two supported options: --lt-debug and\n# --lt-dump-script. There is, deliberately, no --lt-help.\n#\n# The first argument to this parsing function should be the\n# script's $0 value, followed by \"$@\".\nlt_option_debug=\nfunc_parse_lt_options ()\n{\n  lt_script_arg0=\\$0\n  shift\n  for lt_opt\n  do\n    case \\\"\\$lt_opt\\\" in\n    --lt-debug) lt_option_debug=1 ;;\n    --lt-dump-script)\n        lt_dump_D=\\`\\$ECHO \\\"X\\$lt_script_arg0\\\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\\`\n        test \\\"X\\$lt_dump_D\\\" = \\\"X\\$lt_script_arg0\\\" && lt_dump_D=.\n        lt_dump_F=\\`\\$ECHO \\\"X\\$lt_script_arg0\\\" | $SED -e 's/^X//' -e 's%^.*/%%'\\`\n        cat \\\"\\$lt_dump_D/\\$lt_dump_F\\\"\n        exit 0\n      ;;\n    --lt-*)\n        \\$ECHO \\\"Unrecognized --lt- option: '\\$lt_opt'\\\" 1>&2\n        exit 1\n      ;;\n    esac\n  done\n\n  # Print the debug banner immediately:\n  if test -n \\\"\\$lt_option_debug\\\"; then\n    echo \\\"${outputname}:${output}:\\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\\\" 1>&2\n  fi\n}\n\n# Used when --lt-debug. Prints its arguments to stdout\n# (redirection is the responsibility of the caller)\nfunc_lt_dump_args ()\n{\n  lt_dump_args_N=1;\n  for lt_arg\n  do\n    \\$ECHO \\\"${outputname}:${output}:\\${LINENO}: newargv[\\$lt_dump_args_N]: \\$lt_arg\\\"\n    lt_dump_args_N=\\`expr \\$lt_dump_args_N + 1\\`\n  done\n}\n\n# Core function for launching the target application\nfunc_exec_program_core ()\n{\n\"\n  case $host in\n  # Backslashes separate directories on plain windows\n  *-*-mingw | *-*-os2* | *-cegcc*)\n    $ECHO \"\\\n      if test -n \\\"\\$lt_option_debug\\\"; then\n        \\$ECHO \\\"${outputname}:${output}:\\${LINENO}: newargv[0]: \\$progdir\\\\\\\\\\$program\\\" 1>&2\n        func_lt_dump_args \\${1+\\\"\\$@\\\"} 1>&2\n      fi\n      exec \\\"\\$progdir\\\\\\\\\\$program\\\" \\${1+\\\"\\$@\\\"}\n\"\n    ;;\n\n  *)\n    $ECHO \"\\\n      if test -n \\\"\\$lt_option_debug\\\"; then\n        \\$ECHO \\\"${outputname}:${output}:\\${LINENO}: newargv[0]: \\$progdir/\\$program\\\" 1>&2\n        func_lt_dump_args \\${1+\\\"\\$@\\\"} 1>&2\n      fi\n      exec \\\"\\$progdir/\\$program\\\" \\${1+\\\"\\$@\\\"}\n\"\n    ;;\n  esac\n  $ECHO \"\\\n      \\$ECHO \\\"\\$0: cannot exec \\$program \\$*\\\" 1>&2\n      exit 1\n}\n\n# A function to encapsulate launching the target application\n# Strips options in the --lt-* namespace from \\$@ and\n# launches target application with the remaining arguments.\nfunc_exec_program ()\n{\n  case \\\" \\$* \\\" in\n  *\\\\ --lt-*)\n    for lt_wr_arg\n    do\n      case \\$lt_wr_arg in\n      --lt-*) ;;\n      *) set x \\\"\\$@\\\" \\\"\\$lt_wr_arg\\\"; shift;;\n      esac\n      shift\n    done ;;\n  esac\n  func_exec_program_core \\${1+\\\"\\$@\\\"}\n}\n\n  # Parse options\n  func_parse_lt_options \\\"\\$0\\\" \\${1+\\\"\\$@\\\"}\n\n  # Find the directory that this script lives in.\n  thisdir=\\`\\$ECHO \\\"\\$file\\\" | $SED 's%/[^/]*$%%'\\`\n  test \\\"x\\$thisdir\\\" = \\\"x\\$file\\\" && thisdir=.\n\n  # Follow symbolic links until we get to the real thisdir.\n  file=\\`ls -ld \\\"\\$file\\\" | $SED -n 's/.*-> //p'\\`\n  while test -n \\\"\\$file\\\"; do\n    destdir=\\`\\$ECHO \\\"\\$file\\\" | $SED 's%/[^/]*\\$%%'\\`\n\n    # If there was a directory component, then change thisdir.\n    if test \\\"x\\$destdir\\\" != \\\"x\\$file\\\"; then\n      case \\\"\\$destdir\\\" in\n      [\\\\\\\\/]* | [A-Za-z]:[\\\\\\\\/]*) thisdir=\\\"\\$destdir\\\" ;;\n      *) thisdir=\\\"\\$thisdir/\\$destdir\\\" ;;\n      esac\n    fi\n\n    file=\\`\\$ECHO \\\"\\$file\\\" | $SED 's%^.*/%%'\\`\n    file=\\`ls -ld \\\"\\$thisdir/\\$file\\\" | $SED -n 's/.*-> //p'\\`\n  done\n\n  # Usually 'no', except on cygwin/mingw when embedded into\n  # the cwrapper.\n  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1\n  if test \\\"\\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\\\" = \\\"yes\\\"; then\n    # special case for '.'\n    if test \\\"\\$thisdir\\\" = \\\".\\\"; then\n      thisdir=\\`pwd\\`\n    fi\n    # remove .libs from thisdir\n    case \\\"\\$thisdir\\\" in\n    *[\\\\\\\\/]$objdir ) thisdir=\\`\\$ECHO \\\"\\$thisdir\\\" | $SED 's%[\\\\\\\\/][^\\\\\\\\/]*$%%'\\` ;;\n    $objdir )   thisdir=. ;;\n    esac\n  fi\n\n  # Try to get the absolute directory name.\n  absdir=\\`cd \\\"\\$thisdir\\\" && pwd\\`\n  test -n \\\"\\$absdir\\\" && thisdir=\\\"\\$absdir\\\"\n\"\n\n\tif test \"$fast_install\" = yes; then\n\t  $ECHO \"\\\n  program=lt-'$outputname'$exeext\n  progdir=\\\"\\$thisdir/$objdir\\\"\n\n  if test ! -f \\\"\\$progdir/\\$program\\\" ||\n     { file=\\`ls -1dt \\\"\\$progdir/\\$program\\\" \\\"\\$progdir/../\\$program\\\" 2>/dev/null | ${SED} 1q\\`; \\\\\n       test \\\"X\\$file\\\" != \\\"X\\$progdir/\\$program\\\"; }; then\n\n    file=\\\"\\$\\$-\\$program\\\"\n\n    if test ! -d \\\"\\$progdir\\\"; then\n      $MKDIR \\\"\\$progdir\\\"\n    else\n      $RM \\\"\\$progdir/\\$file\\\"\n    fi\"\n\n\t  $ECHO \"\\\n\n    # relink executable if necessary\n    if test -n \\\"\\$relink_command\\\"; then\n      if relink_command_output=\\`eval \\$relink_command 2>&1\\`; then :\n      else\n\t$ECHO \\\"\\$relink_command_output\\\" >&2\n\t$RM \\\"\\$progdir/\\$file\\\"\n\texit 1\n      fi\n    fi\n\n    $MV \\\"\\$progdir/\\$file\\\" \\\"\\$progdir/\\$program\\\" 2>/dev/null ||\n    { $RM \\\"\\$progdir/\\$program\\\";\n      $MV \\\"\\$progdir/\\$file\\\" \\\"\\$progdir/\\$program\\\"; }\n    $RM \\\"\\$progdir/\\$file\\\"\n  fi\"\n\telse\n\t  $ECHO \"\\\n  program='$outputname'\n  progdir=\\\"\\$thisdir/$objdir\\\"\n\"\n\tfi\n\n\t$ECHO \"\\\n\n  if test -f \\\"\\$progdir/\\$program\\\"; then\"\n\n\t# fixup the dll searchpath if we need to.\n\t#\n\t# Fix the DLL searchpath if we need to.  Do this before prepending\n\t# to shlibpath, because on Windows, both are PATH and uninstalled\n\t# libraries must come first.\n\tif test -n \"$dllsearchpath\"; then\n\t  $ECHO \"\\\n    # Add the dll search path components to the executable PATH\n    PATH=$dllsearchpath:\\$PATH\n\"\n\tfi\n\n\t# Export our shlibpath_var if we have one.\n\tif test \"$shlibpath_overrides_runpath\" = yes && test -n \"$shlibpath_var\" && test -n \"$temp_rpath\"; then\n\t  $ECHO \"\\\n    # Add our own library path to $shlibpath_var\n    $shlibpath_var=\\\"$temp_rpath\\$$shlibpath_var\\\"\n\n    # Some systems cannot cope with colon-terminated $shlibpath_var\n    # The second colon is a workaround for a bug in BeOS R4 sed\n    $shlibpath_var=\\`\\$ECHO \\\"\\$$shlibpath_var\\\" | $SED 's/::*\\$//'\\`\n\n    export $shlibpath_var\n\"\n\tfi\n\n\t$ECHO \"\\\n    if test \\\"\\$libtool_execute_magic\\\" != \\\"$magic\\\"; then\n      # Run the actual program with our arguments.\n      func_exec_program \\${1+\\\"\\$@\\\"}\n    fi\n  else\n    # The program doesn't exist.\n    \\$ECHO \\\"\\$0: error: \\\\\\`\\$progdir/\\$program' does not exist\\\" 1>&2\n    \\$ECHO \\\"This script is just a wrapper for \\$program.\\\" 1>&2\n    \\$ECHO \\\"See the $PACKAGE documentation for more information.\\\" 1>&2\n    exit 1\n  fi\nfi\\\n\"\n}\n\n\n# func_emit_cwrapperexe_src\n# emit the source code for a wrapper executable on stdout\n# Must ONLY be called from within func_mode_link because\n# it depends on a number of variable set therein.\nfunc_emit_cwrapperexe_src ()\n{\n\tcat <<EOF\n\n/* $cwrappersource - temporary wrapper executable for $objdir/$outputname\n   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n\n   The $output program cannot be directly executed until all the libtool\n   libraries that it depends on are installed.\n\n   This wrapper executable should never be moved out of the build directory.\n   If it is, it will not operate correctly.\n*/\nEOF\n\t    cat <<\"EOF\"\n#ifdef _MSC_VER\n# define _CRT_SECURE_NO_DEPRECATE 1\n#endif\n#include <stdio.h>\n#include <stdlib.h>\n#ifdef _MSC_VER\n# include <direct.h>\n# include <process.h>\n# include <io.h>\n#else\n# include <unistd.h>\n# include <stdint.h>\n# ifdef __CYGWIN__\n#  include <io.h>\n# endif\n#endif\n#include <malloc.h>\n#include <stdarg.h>\n#include <assert.h>\n#include <string.h>\n#include <ctype.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <sys/stat.h>\n\n/* declarations of non-ANSI functions */\n#if defined(__MINGW32__)\n# ifdef __STRICT_ANSI__\nint _putenv (const char *);\n# endif\n#elif defined(__CYGWIN__)\n# ifdef __STRICT_ANSI__\nchar *realpath (const char *, char *);\nint putenv (char *);\nint setenv (const char *, const char *, int);\n# endif\n/* #elif defined (other platforms) ... */\n#endif\n\n/* portability defines, excluding path handling macros */\n#if defined(_MSC_VER)\n# define setmode _setmode\n# define stat    _stat\n# define chmod   _chmod\n# define getcwd  _getcwd\n# define putenv  _putenv\n# define S_IXUSR _S_IEXEC\n# ifndef _INTPTR_T_DEFINED\n#  define _INTPTR_T_DEFINED\n#  define intptr_t int\n# endif\n#elif defined(__MINGW32__)\n# define setmode _setmode\n# define stat    _stat\n# define chmod   _chmod\n# define getcwd  _getcwd\n# define putenv  _putenv\n#elif defined(__CYGWIN__)\n# define HAVE_SETENV\n# define FOPEN_WB \"wb\"\n/* #elif defined (other platforms) ... */\n#endif\n\n#if defined(PATH_MAX)\n# define LT_PATHMAX PATH_MAX\n#elif defined(MAXPATHLEN)\n# define LT_PATHMAX MAXPATHLEN\n#else\n# define LT_PATHMAX 1024\n#endif\n\n#ifndef S_IXOTH\n# define S_IXOTH 0\n#endif\n#ifndef S_IXGRP\n# define S_IXGRP 0\n#endif\n\n/* path handling portability macros */\n#ifndef DIR_SEPARATOR\n# define DIR_SEPARATOR '/'\n# define PATH_SEPARATOR ':'\n#endif\n\n#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \\\n  defined (__OS2__)\n# define HAVE_DOS_BASED_FILE_SYSTEM\n# define FOPEN_WB \"wb\"\n# ifndef DIR_SEPARATOR_2\n#  define DIR_SEPARATOR_2 '\\\\'\n# endif\n# ifndef PATH_SEPARATOR_2\n#  define PATH_SEPARATOR_2 ';'\n# endif\n#endif\n\n#ifndef DIR_SEPARATOR_2\n# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)\n#else /* DIR_SEPARATOR_2 */\n# define IS_DIR_SEPARATOR(ch) \\\n\t(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))\n#endif /* DIR_SEPARATOR_2 */\n\n#ifndef PATH_SEPARATOR_2\n# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)\n#else /* PATH_SEPARATOR_2 */\n# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)\n#endif /* PATH_SEPARATOR_2 */\n\n#ifndef FOPEN_WB\n# define FOPEN_WB \"w\"\n#endif\n#ifndef _O_BINARY\n# define _O_BINARY 0\n#endif\n\n#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))\n#define XFREE(stale) do { \\\n  if (stale) { free ((void *) stale); stale = 0; } \\\n} while (0)\n\n#if defined(LT_DEBUGWRAPPER)\nstatic int lt_debug = 1;\n#else\nstatic int lt_debug = 0;\n#endif\n\nconst char *program_name = \"libtool-wrapper\"; /* in case xstrdup fails */\n\nvoid *xmalloc (size_t num);\nchar *xstrdup (const char *string);\nconst char *base_name (const char *name);\nchar *find_executable (const char *wrapper);\nchar *chase_symlinks (const char *pathspec);\nint make_executable (const char *path);\nint check_executable (const char *path);\nchar *strendzap (char *str, const char *pat);\nvoid lt_debugprintf (const char *file, int line, const char *fmt, ...);\nvoid lt_fatal (const char *file, int line, const char *message, ...);\nstatic const char *nonnull (const char *s);\nstatic const char *nonempty (const char *s);\nvoid lt_setenv (const char *name, const char *value);\nchar *lt_extend_str (const char *orig_value, const char *add, int to_end);\nvoid lt_update_exe_path (const char *name, const char *value);\nvoid lt_update_lib_path (const char *name, const char *value);\nchar **prepare_spawn (char **argv);\nvoid lt_dump_script (FILE *f);\nEOF\n\n\t    cat <<EOF\nvolatile const char * MAGIC_EXE = \"$magic_exe\";\nconst char * LIB_PATH_VARNAME = \"$shlibpath_var\";\nEOF\n\n\t    if test \"$shlibpath_overrides_runpath\" = yes && test -n \"$shlibpath_var\" && test -n \"$temp_rpath\"; then\n              func_to_host_path \"$temp_rpath\"\n\t      cat <<EOF\nconst char * LIB_PATH_VALUE   = \"$func_to_host_path_result\";\nEOF\n\t    else\n\t      cat <<\"EOF\"\nconst char * LIB_PATH_VALUE   = \"\";\nEOF\n\t    fi\n\n\t    if test -n \"$dllsearchpath\"; then\n              func_to_host_path \"$dllsearchpath:\"\n\t      cat <<EOF\nconst char * EXE_PATH_VARNAME = \"PATH\";\nconst char * EXE_PATH_VALUE   = \"$func_to_host_path_result\";\nEOF\n\t    else\n\t      cat <<\"EOF\"\nconst char * EXE_PATH_VARNAME = \"\";\nconst char * EXE_PATH_VALUE   = \"\";\nEOF\n\t    fi\n\n\t    if test \"$fast_install\" = yes; then\n\t      cat <<EOF\nconst char * TARGET_PROGRAM_NAME = \"lt-$outputname\"; /* hopefully, no .exe */\nEOF\n\t    else\n\t      cat <<EOF\nconst char * TARGET_PROGRAM_NAME = \"$outputname\"; /* hopefully, no .exe */\nEOF\n\t    fi\n\n\n\t    cat <<\"EOF\"\n\n#define LTWRAPPER_OPTION_PREFIX         \"--lt-\"\n\nstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;\nstatic const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX \"dump-script\";\nstatic const char *debug_opt            = LTWRAPPER_OPTION_PREFIX \"debug\";\n\nint\nmain (int argc, char *argv[])\n{\n  char **newargz;\n  int  newargc;\n  char *tmp_pathspec;\n  char *actual_cwrapper_path;\n  char *actual_cwrapper_name;\n  char *target_name;\n  char *lt_argv_zero;\n  intptr_t rval = 127;\n\n  int i;\n\n  program_name = (char *) xstrdup (base_name (argv[0]));\n  newargz = XMALLOC (char *, argc + 1);\n\n  /* very simple arg parsing; don't want to rely on getopt\n   * also, copy all non cwrapper options to newargz, except\n   * argz[0], which is handled differently\n   */\n  newargc=0;\n  for (i = 1; i < argc; i++)\n    {\n      if (strcmp (argv[i], dumpscript_opt) == 0)\n\t{\nEOF\n\t    case \"$host\" in\n\t      *mingw* | *cygwin* )\n\t\t# make stdout use \"unix\" line endings\n\t\techo \"          setmode(1,_O_BINARY);\"\n\t\t;;\n\t      esac\n\n\t    cat <<\"EOF\"\n\t  lt_dump_script (stdout);\n\t  return 0;\n\t}\n      if (strcmp (argv[i], debug_opt) == 0)\n\t{\n          lt_debug = 1;\n          continue;\n\t}\n      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)\n        {\n          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX\n             namespace, but it is not one of the ones we know about and\n             have already dealt with, above (inluding dump-script), then\n             report an error. Otherwise, targets might begin to believe\n             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX\n             namespace. The first time any user complains about this, we'll\n             need to make LTWRAPPER_OPTION_PREFIX a configure-time option\n             or a configure.ac-settable value.\n           */\n          lt_fatal (__FILE__, __LINE__,\n\t\t    \"unrecognized %s option: '%s'\",\n                    ltwrapper_option_prefix, argv[i]);\n        }\n      /* otherwise ... */\n      newargz[++newargc] = xstrdup (argv[i]);\n    }\n  newargz[++newargc] = NULL;\n\nEOF\n\t    cat <<EOF\n  /* The GNU banner must be the first non-error debug message */\n  lt_debugprintf (__FILE__, __LINE__, \"libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\\n\");\nEOF\n\t    cat <<\"EOF\"\n  lt_debugprintf (__FILE__, __LINE__, \"(main) argv[0]: %s\\n\", argv[0]);\n  lt_debugprintf (__FILE__, __LINE__, \"(main) program_name: %s\\n\", program_name);\n\n  tmp_pathspec = find_executable (argv[0]);\n  if (tmp_pathspec == NULL)\n    lt_fatal (__FILE__, __LINE__, \"couldn't find %s\", argv[0]);\n  lt_debugprintf (__FILE__, __LINE__,\n                  \"(main) found exe (before symlink chase) at: %s\\n\",\n\t\t  tmp_pathspec);\n\n  actual_cwrapper_path = chase_symlinks (tmp_pathspec);\n  lt_debugprintf (__FILE__, __LINE__,\n                  \"(main) found exe (after symlink chase) at: %s\\n\",\n\t\t  actual_cwrapper_path);\n  XFREE (tmp_pathspec);\n\n  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));\n  strendzap (actual_cwrapper_path, actual_cwrapper_name);\n\n  /* wrapper name transforms */\n  strendzap (actual_cwrapper_name, \".exe\");\n  tmp_pathspec = lt_extend_str (actual_cwrapper_name, \".exe\", 1);\n  XFREE (actual_cwrapper_name);\n  actual_cwrapper_name = tmp_pathspec;\n  tmp_pathspec = 0;\n\n  /* target_name transforms -- use actual target program name; might have lt- prefix */\n  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));\n  strendzap (target_name, \".exe\");\n  tmp_pathspec = lt_extend_str (target_name, \".exe\", 1);\n  XFREE (target_name);\n  target_name = tmp_pathspec;\n  tmp_pathspec = 0;\n\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(main) libtool target name: %s\\n\",\n\t\t  target_name);\nEOF\n\n\t    cat <<EOF\n  newargz[0] =\n    XMALLOC (char, (strlen (actual_cwrapper_path) +\n\t\t    strlen (\"$objdir\") + 1 + strlen (actual_cwrapper_name) + 1));\n  strcpy (newargz[0], actual_cwrapper_path);\n  strcat (newargz[0], \"$objdir\");\n  strcat (newargz[0], \"/\");\nEOF\n\n\t    cat <<\"EOF\"\n  /* stop here, and copy so we don't have to do this twice */\n  tmp_pathspec = xstrdup (newargz[0]);\n\n  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */\n  strcat (newargz[0], actual_cwrapper_name);\n\n  /* DO want the lt- prefix here if it exists, so use target_name */\n  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);\n  XFREE (tmp_pathspec);\n  tmp_pathspec = NULL;\nEOF\n\n\t    case $host_os in\n\t      mingw*)\n\t    cat <<\"EOF\"\n  {\n    char* p;\n    while ((p = strchr (newargz[0], '\\\\')) != NULL)\n      {\n\t*p = '/';\n      }\n    while ((p = strchr (lt_argv_zero, '\\\\')) != NULL)\n      {\n\t*p = '/';\n      }\n  }\nEOF\n\t    ;;\n\t    esac\n\n\t    cat <<\"EOF\"\n  XFREE (target_name);\n  XFREE (actual_cwrapper_path);\n  XFREE (actual_cwrapper_name);\n\n  lt_setenv (\"BIN_SH\", \"xpg4\"); /* for Tru64 */\n  lt_setenv (\"DUALCASE\", \"1\");  /* for MSK sh */\n  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must\n     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)\n     because on Windows, both *_VARNAMEs are PATH but uninstalled\n     libraries must come first. */\n  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);\n  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);\n\n  lt_debugprintf (__FILE__, __LINE__, \"(main) lt_argv_zero: %s\\n\",\n\t\t  nonnull (lt_argv_zero));\n  for (i = 0; i < newargc; i++)\n    {\n      lt_debugprintf (__FILE__, __LINE__, \"(main) newargz[%d]: %s\\n\",\n\t\t      i, nonnull (newargz[i]));\n    }\n\nEOF\n\n\t    case $host_os in\n\t      mingw*)\n\t\tcat <<\"EOF\"\n  /* execv doesn't actually work on mingw as expected on unix */\n  newargz = prepare_spawn (newargz);\n  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);\n  if (rval == -1)\n    {\n      /* failed to start process */\n      lt_debugprintf (__FILE__, __LINE__,\n\t\t      \"(main) failed to launch target \\\"%s\\\": %s\\n\",\n\t\t      lt_argv_zero, nonnull (strerror (errno)));\n      return 127;\n    }\n  return rval;\nEOF\n\t\t;;\n\t      *)\n\t\tcat <<\"EOF\"\n  execv (lt_argv_zero, newargz);\n  return rval; /* =127, but avoids unused variable warning */\nEOF\n\t\t;;\n\t    esac\n\n\t    cat <<\"EOF\"\n}\n\nvoid *\nxmalloc (size_t num)\n{\n  void *p = (void *) malloc (num);\n  if (!p)\n    lt_fatal (__FILE__, __LINE__, \"memory exhausted\");\n\n  return p;\n}\n\nchar *\nxstrdup (const char *string)\n{\n  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),\n\t\t\t  string) : NULL;\n}\n\nconst char *\nbase_name (const char *name)\n{\n  const char *base;\n\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n  /* Skip over the disk name in MSDOS pathnames. */\n  if (isalpha ((unsigned char) name[0]) && name[1] == ':')\n    name += 2;\n#endif\n\n  for (base = name; *name; name++)\n    if (IS_DIR_SEPARATOR (*name))\n      base = name + 1;\n  return base;\n}\n\nint\ncheck_executable (const char *path)\n{\n  struct stat st;\n\n  lt_debugprintf (__FILE__, __LINE__, \"(check_executable): %s\\n\",\n                  nonempty (path));\n  if ((!path) || (!*path))\n    return 0;\n\n  if ((stat (path, &st) >= 0)\n      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))\n    return 1;\n  else\n    return 0;\n}\n\nint\nmake_executable (const char *path)\n{\n  int rval = 0;\n  struct stat st;\n\n  lt_debugprintf (__FILE__, __LINE__, \"(make_executable): %s\\n\",\n                  nonempty (path));\n  if ((!path) || (!*path))\n    return 0;\n\n  if (stat (path, &st) >= 0)\n    {\n      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);\n    }\n  return rval;\n}\n\n/* Searches for the full path of the wrapper.  Returns\n   newly allocated full path name if found, NULL otherwise\n   Does not chase symlinks, even on platforms that support them.\n*/\nchar *\nfind_executable (const char *wrapper)\n{\n  int has_slash = 0;\n  const char *p;\n  const char *p_next;\n  /* static buffer for getcwd */\n  char tmp[LT_PATHMAX + 1];\n  int tmp_len;\n  char *concat_name;\n\n  lt_debugprintf (__FILE__, __LINE__, \"(find_executable): %s\\n\",\n                  nonempty (wrapper));\n\n  if ((wrapper == NULL) || (*wrapper == '\\0'))\n    return NULL;\n\n  /* Absolute path? */\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')\n    {\n      concat_name = xstrdup (wrapper);\n      if (check_executable (concat_name))\n\treturn concat_name;\n      XFREE (concat_name);\n    }\n  else\n    {\n#endif\n      if (IS_DIR_SEPARATOR (wrapper[0]))\n\t{\n\t  concat_name = xstrdup (wrapper);\n\t  if (check_executable (concat_name))\n\t    return concat_name;\n\t  XFREE (concat_name);\n\t}\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n    }\n#endif\n\n  for (p = wrapper; *p; p++)\n    if (*p == '/')\n      {\n\thas_slash = 1;\n\tbreak;\n      }\n  if (!has_slash)\n    {\n      /* no slashes; search PATH */\n      const char *path = getenv (\"PATH\");\n      if (path != NULL)\n\t{\n\t  for (p = path; *p; p = p_next)\n\t    {\n\t      const char *q;\n\t      size_t p_len;\n\t      for (q = p; *q; q++)\n\t\tif (IS_PATH_SEPARATOR (*q))\n\t\t  break;\n\t      p_len = q - p;\n\t      p_next = (*q == '\\0' ? q : q + 1);\n\t      if (p_len == 0)\n\t\t{\n\t\t  /* empty path: current directory */\n\t\t  if (getcwd (tmp, LT_PATHMAX) == NULL)\n\t\t    lt_fatal (__FILE__, __LINE__, \"getcwd failed: %s\",\n                              nonnull (strerror (errno)));\n\t\t  tmp_len = strlen (tmp);\n\t\t  concat_name =\n\t\t    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);\n\t\t  memcpy (concat_name, tmp, tmp_len);\n\t\t  concat_name[tmp_len] = '/';\n\t\t  strcpy (concat_name + tmp_len + 1, wrapper);\n\t\t}\n\t      else\n\t\t{\n\t\t  concat_name =\n\t\t    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);\n\t\t  memcpy (concat_name, p, p_len);\n\t\t  concat_name[p_len] = '/';\n\t\t  strcpy (concat_name + p_len + 1, wrapper);\n\t\t}\n\t      if (check_executable (concat_name))\n\t\treturn concat_name;\n\t      XFREE (concat_name);\n\t    }\n\t}\n      /* not found in PATH; assume curdir */\n    }\n  /* Relative path | not found in path: prepend cwd */\n  if (getcwd (tmp, LT_PATHMAX) == NULL)\n    lt_fatal (__FILE__, __LINE__, \"getcwd failed: %s\",\n              nonnull (strerror (errno)));\n  tmp_len = strlen (tmp);\n  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);\n  memcpy (concat_name, tmp, tmp_len);\n  concat_name[tmp_len] = '/';\n  strcpy (concat_name + tmp_len + 1, wrapper);\n\n  if (check_executable (concat_name))\n    return concat_name;\n  XFREE (concat_name);\n  return NULL;\n}\n\nchar *\nchase_symlinks (const char *pathspec)\n{\n#ifndef S_ISLNK\n  return xstrdup (pathspec);\n#else\n  char buf[LT_PATHMAX];\n  struct stat s;\n  char *tmp_pathspec = xstrdup (pathspec);\n  char *p;\n  int has_symlinks = 0;\n  while (strlen (tmp_pathspec) && !has_symlinks)\n    {\n      lt_debugprintf (__FILE__, __LINE__,\n\t\t      \"checking path component for symlinks: %s\\n\",\n\t\t      tmp_pathspec);\n      if (lstat (tmp_pathspec, &s) == 0)\n\t{\n\t  if (S_ISLNK (s.st_mode) != 0)\n\t    {\n\t      has_symlinks = 1;\n\t      break;\n\t    }\n\n\t  /* search backwards for last DIR_SEPARATOR */\n\t  p = tmp_pathspec + strlen (tmp_pathspec) - 1;\n\t  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))\n\t    p--;\n\t  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))\n\t    {\n\t      /* no more DIR_SEPARATORS left */\n\t      break;\n\t    }\n\t  *p = '\\0';\n\t}\n      else\n\t{\n\t  lt_fatal (__FILE__, __LINE__,\n\t\t    \"error accessing file \\\"%s\\\": %s\",\n\t\t    tmp_pathspec, nonnull (strerror (errno)));\n\t}\n    }\n  XFREE (tmp_pathspec);\n\n  if (!has_symlinks)\n    {\n      return xstrdup (pathspec);\n    }\n\n  tmp_pathspec = realpath (pathspec, buf);\n  if (tmp_pathspec == 0)\n    {\n      lt_fatal (__FILE__, __LINE__,\n\t\t\"could not follow symlinks for %s\", pathspec);\n    }\n  return xstrdup (tmp_pathspec);\n#endif\n}\n\nchar *\nstrendzap (char *str, const char *pat)\n{\n  size_t len, patlen;\n\n  assert (str != NULL);\n  assert (pat != NULL);\n\n  len = strlen (str);\n  patlen = strlen (pat);\n\n  if (patlen <= len)\n    {\n      str += len - patlen;\n      if (strcmp (str, pat) == 0)\n\t*str = '\\0';\n    }\n  return str;\n}\n\nvoid\nlt_debugprintf (const char *file, int line, const char *fmt, ...)\n{\n  va_list args;\n  if (lt_debug)\n    {\n      (void) fprintf (stderr, \"%s:%s:%d: \", program_name, file, line);\n      va_start (args, fmt);\n      (void) vfprintf (stderr, fmt, args);\n      va_end (args);\n    }\n}\n\nstatic void\nlt_error_core (int exit_status, const char *file,\n\t       int line, const char *mode,\n\t       const char *message, va_list ap)\n{\n  fprintf (stderr, \"%s:%s:%d: %s: \", program_name, file, line, mode);\n  vfprintf (stderr, message, ap);\n  fprintf (stderr, \".\\n\");\n\n  if (exit_status >= 0)\n    exit (exit_status);\n}\n\nvoid\nlt_fatal (const char *file, int line, const char *message, ...)\n{\n  va_list ap;\n  va_start (ap, message);\n  lt_error_core (EXIT_FAILURE, file, line, \"FATAL\", message, ap);\n  va_end (ap);\n}\n\nstatic const char *\nnonnull (const char *s)\n{\n  return s ? s : \"(null)\";\n}\n\nstatic const char *\nnonempty (const char *s)\n{\n  return (s && !*s) ? \"(empty)\" : nonnull (s);\n}\n\nvoid\nlt_setenv (const char *name, const char *value)\n{\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(lt_setenv) setting '%s' to '%s'\\n\",\n                  nonnull (name), nonnull (value));\n  {\n#ifdef HAVE_SETENV\n    /* always make a copy, for consistency with !HAVE_SETENV */\n    char *str = xstrdup (value);\n    setenv (name, str, 1);\n#else\n    int len = strlen (name) + 1 + strlen (value) + 1;\n    char *str = XMALLOC (char, len);\n    sprintf (str, \"%s=%s\", name, value);\n    if (putenv (str) != EXIT_SUCCESS)\n      {\n        XFREE (str);\n      }\n#endif\n  }\n}\n\nchar *\nlt_extend_str (const char *orig_value, const char *add, int to_end)\n{\n  char *new_value;\n  if (orig_value && *orig_value)\n    {\n      int orig_value_len = strlen (orig_value);\n      int add_len = strlen (add);\n      new_value = XMALLOC (char, add_len + orig_value_len + 1);\n      if (to_end)\n        {\n          strcpy (new_value, orig_value);\n          strcpy (new_value + orig_value_len, add);\n        }\n      else\n        {\n          strcpy (new_value, add);\n          strcpy (new_value + add_len, orig_value);\n        }\n    }\n  else\n    {\n      new_value = xstrdup (add);\n    }\n  return new_value;\n}\n\nvoid\nlt_update_exe_path (const char *name, const char *value)\n{\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(lt_update_exe_path) modifying '%s' by prepending '%s'\\n\",\n                  nonnull (name), nonnull (value));\n\n  if (name && *name && value && *value)\n    {\n      char *new_value = lt_extend_str (getenv (name), value, 0);\n      /* some systems can't cope with a ':'-terminated path #' */\n      int len = strlen (new_value);\n      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))\n        {\n          new_value[len-1] = '\\0';\n        }\n      lt_setenv (name, new_value);\n      XFREE (new_value);\n    }\n}\n\nvoid\nlt_update_lib_path (const char *name, const char *value)\n{\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(lt_update_lib_path) modifying '%s' by prepending '%s'\\n\",\n                  nonnull (name), nonnull (value));\n\n  if (name && *name && value && *value)\n    {\n      char *new_value = lt_extend_str (getenv (name), value, 0);\n      lt_setenv (name, new_value);\n      XFREE (new_value);\n    }\n}\n\nEOF\n\t    case $host_os in\n\t      mingw*)\n\t\tcat <<\"EOF\"\n\n/* Prepares an argument vector before calling spawn().\n   Note that spawn() does not by itself call the command interpreter\n     (getenv (\"COMSPEC\") != NULL ? getenv (\"COMSPEC\") :\n      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);\n         GetVersionEx(&v);\n         v.dwPlatformId == VER_PLATFORM_WIN32_NT;\n      }) ? \"cmd.exe\" : \"command.com\").\n   Instead it simply concatenates the arguments, separated by ' ', and calls\n   CreateProcess().  We must quote the arguments since Win32 CreateProcess()\n   interprets characters like ' ', '\\t', '\\\\', '\"' (but not '<' and '>') in a\n   special way:\n   - Space and tab are interpreted as delimiters. They are not treated as\n     delimiters if they are surrounded by double quotes: \"...\".\n   - Unescaped double quotes are removed from the input. Their only effect is\n     that within double quotes, space and tab are treated like normal\n     characters.\n   - Backslashes not followed by double quotes are not special.\n   - But 2*n+1 backslashes followed by a double quote become\n     n backslashes followed by a double quote (n >= 0):\n       \\\" -> \"\n       \\\\\\\" -> \\\"\n       \\\\\\\\\\\" -> \\\\\"\n */\n#define SHELL_SPECIAL_CHARS \"\\\"\\\\ \\001\\002\\003\\004\\005\\006\\007\\010\\011\\012\\013\\014\\015\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037\"\n#define SHELL_SPACE_CHARS \" \\001\\002\\003\\004\\005\\006\\007\\010\\011\\012\\013\\014\\015\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037\"\nchar **\nprepare_spawn (char **argv)\n{\n  size_t argc;\n  char **new_argv;\n  size_t i;\n\n  /* Count number of arguments.  */\n  for (argc = 0; argv[argc] != NULL; argc++)\n    ;\n\n  /* Allocate new argument vector.  */\n  new_argv = XMALLOC (char *, argc + 1);\n\n  /* Put quoted arguments into the new argument vector.  */\n  for (i = 0; i < argc; i++)\n    {\n      const char *string = argv[i];\n\n      if (string[0] == '\\0')\n\tnew_argv[i] = xstrdup (\"\\\"\\\"\");\n      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)\n\t{\n\t  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);\n\t  size_t length;\n\t  unsigned int backslashes;\n\t  const char *s;\n\t  char *quoted_string;\n\t  char *p;\n\n\t  length = 0;\n\t  backslashes = 0;\n\t  if (quote_around)\n\t    length++;\n\t  for (s = string; *s != '\\0'; s++)\n\t    {\n\t      char c = *s;\n\t      if (c == '\"')\n\t\tlength += backslashes + 1;\n\t      length++;\n\t      if (c == '\\\\')\n\t\tbackslashes++;\n\t      else\n\t\tbackslashes = 0;\n\t    }\n\t  if (quote_around)\n\t    length += backslashes + 1;\n\n\t  quoted_string = XMALLOC (char, length + 1);\n\n\t  p = quoted_string;\n\t  backslashes = 0;\n\t  if (quote_around)\n\t    *p++ = '\"';\n\t  for (s = string; *s != '\\0'; s++)\n\t    {\n\t      char c = *s;\n\t      if (c == '\"')\n\t\t{\n\t\t  unsigned int j;\n\t\t  for (j = backslashes + 1; j > 0; j--)\n\t\t    *p++ = '\\\\';\n\t\t}\n\t      *p++ = c;\n\t      if (c == '\\\\')\n\t\tbackslashes++;\n\t      else\n\t\tbackslashes = 0;\n\t    }\n\t  if (quote_around)\n\t    {\n\t      unsigned int j;\n\t      for (j = backslashes; j > 0; j--)\n\t\t*p++ = '\\\\';\n\t      *p++ = '\"';\n\t    }\n\t  *p = '\\0';\n\n\t  new_argv[i] = quoted_string;\n\t}\n      else\n\tnew_argv[i] = (char *) string;\n    }\n  new_argv[argc] = NULL;\n\n  return new_argv;\n}\nEOF\n\t\t;;\n\t    esac\n\n            cat <<\"EOF\"\nvoid lt_dump_script (FILE* f)\n{\nEOF\n\t    func_emit_wrapper yes |\n\t      $SED -n -e '\ns/^\\(.\\{79\\}\\)\\(..*\\)/\\1\\\n\\2/\nh\ns/\\([\\\\\"]\\)/\\\\\\1/g\ns/$/\\\\n/\ns/\\([^\\n]*\\).*/  fputs (\"\\1\", f);/p\ng\nD'\n            cat <<\"EOF\"\n}\nEOF\n}\n# end: func_emit_cwrapperexe_src\n\n# func_win32_import_lib_p ARG\n# True if ARG is an import lib, as indicated by $file_magic_cmd\nfunc_win32_import_lib_p ()\n{\n    $opt_debug\n    case `eval $file_magic_cmd \\\"\\$1\\\" 2>/dev/null | $SED -e 10q` in\n    *import*) : ;;\n    *) false ;;\n    esac\n}\n\n# func_mode_link arg...\nfunc_mode_link ()\n{\n    $opt_debug\n    case $host in\n    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n      # It is impossible to link a dll without this setting, and\n      # we shouldn't force the makefile maintainer to figure out\n      # which system we are compiling for in order to pass an extra\n      # flag for every libtool invocation.\n      # allow_undefined=no\n\n      # FIXME: Unfortunately, there are problems with the above when trying\n      # to make a dll which has undefined symbols, in which case not\n      # even a static library is built.  For now, we need to specify\n      # -no-undefined on the libtool link line when we can be certain\n      # that all symbols are satisfied, otherwise we get a static library.\n      allow_undefined=yes\n      ;;\n    *)\n      allow_undefined=yes\n      ;;\n    esac\n    libtool_args=$nonopt\n    base_compile=\"$nonopt $@\"\n    compile_command=$nonopt\n    finalize_command=$nonopt\n\n    compile_rpath=\n    finalize_rpath=\n    compile_shlibpath=\n    finalize_shlibpath=\n    convenience=\n    old_convenience=\n    deplibs=\n    old_deplibs=\n    compiler_flags=\n    linker_flags=\n    dllsearchpath=\n    lib_search_path=`pwd`\n    inst_prefix_dir=\n    new_inherited_linker_flags=\n\n    avoid_version=no\n    bindir=\n    dlfiles=\n    dlprefiles=\n    dlself=no\n    export_dynamic=no\n    export_symbols=\n    export_symbols_regex=\n    generated=\n    libobjs=\n    ltlibs=\n    module=no\n    no_install=no\n    objs=\n    non_pic_objects=\n    precious_files_regex=\n    prefer_static_libs=no\n    preload=no\n    prev=\n    prevarg=\n    release=\n    rpath=\n    xrpath=\n    perm_rpath=\n    temp_rpath=\n    thread_safe=no\n    vinfo=\n    vinfo_number=no\n    weak_libs=\n    single_module=\"${wl}-single_module\"\n    func_infer_tag $base_compile\n\n    # We need to know -static, to get the right output filenames.\n    for arg\n    do\n      case $arg in\n      -shared)\n\ttest \"$build_libtool_libs\" != yes && \\\n\t  func_fatal_configuration \"can not build a shared library\"\n\tbuild_old_libs=no\n\tbreak\n\t;;\n      -all-static | -static | -static-libtool-libs)\n\tcase $arg in\n\t-all-static)\n\t  if test \"$build_libtool_libs\" = yes && test -z \"$link_static_flag\"; then\n\t    func_warning \"complete static linking is impossible in this configuration\"\n\t  fi\n\t  if test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=yes\n\t  ;;\n\t-static)\n\t  if test -z \"$pic_flag\" && test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=built\n\t  ;;\n\t-static-libtool-libs)\n\t  if test -z \"$pic_flag\" && test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=yes\n\t  ;;\n\tesac\n\tbuild_libtool_libs=no\n\tbuild_old_libs=yes\n\tbreak\n\t;;\n      esac\n    done\n\n    # See if our shared archives depend on static archives.\n    test -n \"$old_archive_from_new_cmds\" && build_old_libs=yes\n\n    # Go through the arguments, transforming them on the way.\n    while test \"$#\" -gt 0; do\n      arg=\"$1\"\n      shift\n      func_quote_for_eval \"$arg\"\n      qarg=$func_quote_for_eval_unquoted_result\n      func_append libtool_args \" $func_quote_for_eval_result\"\n\n      # If the previous option needs an argument, assign it.\n      if test -n \"$prev\"; then\n\tcase $prev in\n\toutput)\n\t  func_append compile_command \" @OUTPUT@\"\n\t  func_append finalize_command \" @OUTPUT@\"\n\t  ;;\n\tesac\n\n\tcase $prev in\n\tbindir)\n\t  bindir=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tdlfiles|dlprefiles)\n\t  if test \"$preload\" = no; then\n\t    # Add the symbol object into the linking commands.\n\t    func_append compile_command \" @SYMFILE@\"\n\t    func_append finalize_command \" @SYMFILE@\"\n\t    preload=yes\n\t  fi\n\t  case $arg in\n\t  *.la | *.lo) ;;  # We handle these cases below.\n\t  force)\n\t    if test \"$dlself\" = no; then\n\t      dlself=needless\n\t      export_dynamic=yes\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  self)\n\t    if test \"$prev\" = dlprefiles; then\n\t      dlself=yes\n\t    elif test \"$prev\" = dlfiles && test \"$dlopen_self\" != yes; then\n\t      dlself=yes\n\t    else\n\t      dlself=needless\n\t      export_dynamic=yes\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  *)\n\t    if test \"$prev\" = dlfiles; then\n\t      func_append dlfiles \" $arg\"\n\t    else\n\t      func_append dlprefiles \" $arg\"\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  esac\n\t  ;;\n\texpsyms)\n\t  export_symbols=\"$arg\"\n\t  test -f \"$arg\" \\\n\t    || func_fatal_error \"symbol file \\`$arg' does not exist\"\n\t  prev=\n\t  continue\n\t  ;;\n\texpsyms_regex)\n\t  export_symbols_regex=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tframework)\n\t  case $host in\n\t    *-*-darwin*)\n\t      case \"$deplibs \" in\n\t\t*\" $qarg.ltframework \"*) ;;\n\t\t*) func_append deplibs \" $qarg.ltframework\" # this is fixed later\n\t\t   ;;\n\t      esac\n\t      ;;\n\t  esac\n\t  prev=\n\t  continue\n\t  ;;\n\tinst_prefix)\n\t  inst_prefix_dir=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tobjectlist)\n\t  if test -f \"$arg\"; then\n\t    save_arg=$arg\n\t    moreargs=\n\t    for fil in `cat \"$save_arg\"`\n\t    do\n#\t      func_append moreargs \" $fil\"\n\t      arg=$fil\n\t      # A libtool-controlled object.\n\n\t      # Check to see that this really is a libtool object.\n\t      if func_lalib_unsafe_p \"$arg\"; then\n\t\tpic_object=\n\t\tnon_pic_object=\n\n\t\t# Read the .lo file\n\t\tfunc_source \"$arg\"\n\n\t\tif test -z \"$pic_object\" ||\n\t\t   test -z \"$non_pic_object\" ||\n\t\t   test \"$pic_object\" = none &&\n\t\t   test \"$non_pic_object\" = none; then\n\t\t  func_fatal_error \"cannot find name of object for \\`$arg'\"\n\t\tfi\n\n\t\t# Extract subdirectory from the argument.\n\t\tfunc_dirname \"$arg\" \"/\" \"\"\n\t\txdir=\"$func_dirname_result\"\n\n\t\tif test \"$pic_object\" != none; then\n\t\t  # Prepend the subdirectory the object is found in.\n\t\t  pic_object=\"$xdir$pic_object\"\n\n\t\t  if test \"$prev\" = dlfiles; then\n\t\t    if test \"$build_libtool_libs\" = yes && test \"$dlopen_support\" = yes; then\n\t\t      func_append dlfiles \" $pic_object\"\n\t\t      prev=\n\t\t      continue\n\t\t    else\n\t\t      # If libtool objects are unsupported, then we need to preload.\n\t\t      prev=dlprefiles\n\t\t    fi\n\t\t  fi\n\n\t\t  # CHECK ME:  I think I busted this.  -Ossama\n\t\t  if test \"$prev\" = dlprefiles; then\n\t\t    # Preload the old-style object.\n\t\t    func_append dlprefiles \" $pic_object\"\n\t\t    prev=\n\t\t  fi\n\n\t\t  # A PIC object.\n\t\t  func_append libobjs \" $pic_object\"\n\t\t  arg=\"$pic_object\"\n\t\tfi\n\n\t\t# Non-PIC object.\n\t\tif test \"$non_pic_object\" != none; then\n\t\t  # Prepend the subdirectory the object is found in.\n\t\t  non_pic_object=\"$xdir$non_pic_object\"\n\n\t\t  # A standard non-PIC object\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t\t  if test -z \"$pic_object\" || test \"$pic_object\" = none ; then\n\t\t    arg=\"$non_pic_object\"\n\t\t  fi\n\t\telse\n\t\t  # If the PIC object exists, use it instead.\n\t\t  # $xdir was prepended to $pic_object above.\n\t\t  non_pic_object=\"$pic_object\"\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t\tfi\n\t      else\n\t\t# Only an error if not doing a dry-run.\n\t\tif $opt_dry_run; then\n\t\t  # Extract subdirectory from the argument.\n\t\t  func_dirname \"$arg\" \"/\" \"\"\n\t\t  xdir=\"$func_dirname_result\"\n\n\t\t  func_lo2o \"$arg\"\n\t\t  pic_object=$xdir$objdir/$func_lo2o_result\n\t\t  non_pic_object=$xdir$func_lo2o_result\n\t\t  func_append libobjs \" $pic_object\"\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t        else\n\t\t  func_fatal_error \"\\`$arg' is not a valid libtool object\"\n\t\tfi\n\t      fi\n\t    done\n\t  else\n\t    func_fatal_error \"link input file \\`$arg' does not exist\"\n\t  fi\n\t  arg=$save_arg\n\t  prev=\n\t  continue\n\t  ;;\n\tprecious_regex)\n\t  precious_files_regex=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\trelease)\n\t  release=\"-$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\trpath | xrpath)\n\t  # We need an absolute path.\n\t  case $arg in\n\t  [\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t  *)\n\t    func_fatal_error \"only absolute run-paths are allowed\"\n\t    ;;\n\t  esac\n\t  if test \"$prev\" = rpath; then\n\t    case \"$rpath \" in\n\t    *\" $arg \"*) ;;\n\t    *) func_append rpath \" $arg\" ;;\n\t    esac\n\t  else\n\t    case \"$xrpath \" in\n\t    *\" $arg \"*) ;;\n\t    *) func_append xrpath \" $arg\" ;;\n\t    esac\n\t  fi\n\t  prev=\n\t  continue\n\t  ;;\n\tshrext)\n\t  shrext_cmds=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tweak)\n\t  func_append weak_libs \" $arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\txcclinker)\n\t  func_append linker_flags \" $qarg\"\n\t  func_append compiler_flags \" $qarg\"\n\t  prev=\n\t  func_append compile_command \" $qarg\"\n\t  func_append finalize_command \" $qarg\"\n\t  continue\n\t  ;;\n\txcompiler)\n\t  func_append compiler_flags \" $qarg\"\n\t  prev=\n\t  func_append compile_command \" $qarg\"\n\t  func_append finalize_command \" $qarg\"\n\t  continue\n\t  ;;\n\txlinker)\n\t  func_append linker_flags \" $qarg\"\n\t  func_append compiler_flags \" $wl$qarg\"\n\t  prev=\n\t  func_append compile_command \" $wl$qarg\"\n\t  func_append finalize_command \" $wl$qarg\"\n\t  continue\n\t  ;;\n\t*)\n\t  eval \"$prev=\\\"\\$arg\\\"\"\n\t  prev=\n\t  continue\n\t  ;;\n\tesac\n      fi # test -n \"$prev\"\n\n      prevarg=\"$arg\"\n\n      case $arg in\n      -all-static)\n\tif test -n \"$link_static_flag\"; then\n\t  # See comment for -static flag below, for more details.\n\t  func_append compile_command \" $link_static_flag\"\n\t  func_append finalize_command \" $link_static_flag\"\n\tfi\n\tcontinue\n\t;;\n\n      -allow-undefined)\n\t# FIXME: remove this flag sometime in the future.\n\tfunc_fatal_error \"\\`-allow-undefined' must not be used because it is the default\"\n\t;;\n\n      -avoid-version)\n\tavoid_version=yes\n\tcontinue\n\t;;\n\n      -bindir)\n\tprev=bindir\n\tcontinue\n\t;;\n\n      -dlopen)\n\tprev=dlfiles\n\tcontinue\n\t;;\n\n      -dlpreopen)\n\tprev=dlprefiles\n\tcontinue\n\t;;\n\n      -export-dynamic)\n\texport_dynamic=yes\n\tcontinue\n\t;;\n\n      -export-symbols | -export-symbols-regex)\n\tif test -n \"$export_symbols\" || test -n \"$export_symbols_regex\"; then\n\t  func_fatal_error \"more than one -exported-symbols argument is not allowed\"\n\tfi\n\tif test \"X$arg\" = \"X-export-symbols\"; then\n\t  prev=expsyms\n\telse\n\t  prev=expsyms_regex\n\tfi\n\tcontinue\n\t;;\n\n      -framework)\n\tprev=framework\n\tcontinue\n\t;;\n\n      -inst-prefix-dir)\n\tprev=inst_prefix\n\tcontinue\n\t;;\n\n      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*\n      # so, if we see these flags be careful not to treat them like -L\n      -L[A-Z][A-Z]*:*)\n\tcase $with_gcc/$host in\n\tno/*-*-irix* | /*-*-irix*)\n\t  func_append compile_command \" $arg\"\n\t  func_append finalize_command \" $arg\"\n\t  ;;\n\tesac\n\tcontinue\n\t;;\n\n      -L*)\n\tfunc_stripname \"-L\" '' \"$arg\"\n\tif test -z \"$func_stripname_result\"; then\n\t  if test \"$#\" -gt 0; then\n\t    func_fatal_error \"require no space between \\`-L' and \\`$1'\"\n\t  else\n\t    func_fatal_error \"need path for \\`-L' option\"\n\t  fi\n\tfi\n\tfunc_resolve_sysroot \"$func_stripname_result\"\n\tdir=$func_resolve_sysroot_result\n\t# We need an absolute path.\n\tcase $dir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t*)\n\t  absdir=`cd \"$dir\" && pwd`\n\t  test -z \"$absdir\" && \\\n\t    func_fatal_error \"cannot determine absolute directory name of \\`$dir'\"\n\t  dir=\"$absdir\"\n\t  ;;\n\tesac\n\tcase \"$deplibs \" in\n\t*\" -L$dir \"* | *\" $arg \"*)\n\t  # Will only happen for absolute or sysroot arguments\n\t  ;;\n\t*)\n\t  # Preserve sysroot, but never include relative directories\n\t  case $dir in\n\t    [\\\\/]* | [A-Za-z]:[\\\\/]* | =*) func_append deplibs \" $arg\" ;;\n\t    *) func_append deplibs \" -L$dir\" ;;\n\t  esac\n\t  func_append lib_search_path \" $dir\"\n\t  ;;\n\tesac\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n\t  testbindir=`$ECHO \"$dir\" | $SED 's*/lib$*/bin*'`\n\t  case :$dllsearchpath: in\n\t  *\":$dir:\"*) ;;\n\t  ::) dllsearchpath=$dir;;\n\t  *) func_append dllsearchpath \":$dir\";;\n\t  esac\n\t  case :$dllsearchpath: in\n\t  *\":$testbindir:\"*) ;;\n\t  ::) dllsearchpath=$testbindir;;\n\t  *) func_append dllsearchpath \":$testbindir\";;\n\t  esac\n\t  ;;\n\tesac\n\tcontinue\n\t;;\n\n      -l*)\n\tif test \"X$arg\" = \"X-lc\" || test \"X$arg\" = \"X-lm\"; then\n\t  case $host in\n\t  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)\n\t    # These systems don't actually have a C or math library (as such)\n\t    continue\n\t    ;;\n\t  *-*-os2*)\n\t    # These systems don't actually have a C library (as such)\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t    # Do not include libc due to us having libc/libc_r.\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-rhapsody* | *-*-darwin1.[012])\n\t    # Rhapsody C and math libraries are in the System framework\n\t    func_append deplibs \" System.ltframework\"\n\t    continue\n\t    ;;\n\t  *-*-sco3.2v5* | *-*-sco5v6*)\n\t    # Causes problems with __ctype\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)\n\t    # Compiler inserts libc in the correct place for threads to work\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  esac\n\telif test \"X$arg\" = \"X-lc_r\"; then\n\t case $host in\n\t *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t   # Do not include libc_r directly, use -pthread flag.\n\t   continue\n\t   ;;\n\t esac\n\tfi\n\tfunc_append deplibs \" $arg\"\n\tcontinue\n\t;;\n\n      -module)\n\tmodule=yes\n\tcontinue\n\t;;\n\n      # Tru64 UNIX uses -model [arg] to determine the layout of C++\n      # classes, name mangling, and exception handling.\n      # Darwin uses the -arch flag to determine output architecture.\n      -model|-arch|-isysroot|--sysroot)\n\tfunc_append compiler_flags \" $arg\"\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n\tprev=xcompiler\n\tcontinue\n\t;;\n\n      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \\\n      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)\n\tfunc_append compiler_flags \" $arg\"\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n\tcase \"$new_inherited_linker_flags \" in\n\t    *\" $arg \"*) ;;\n\t    * ) func_append new_inherited_linker_flags \" $arg\" ;;\n\tesac\n\tcontinue\n\t;;\n\n      -multi_module)\n\tsingle_module=\"${wl}-multi_module\"\n\tcontinue\n\t;;\n\n      -no-fast-install)\n\tfast_install=no\n\tcontinue\n\t;;\n\n      -no-install)\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)\n\t  # The PATH hackery in wrapper scripts is required on Windows\n\t  # and Darwin in order for the loader to find any dlls it needs.\n\t  func_warning \"\\`-no-install' is ignored for $host\"\n\t  func_warning \"assuming \\`-no-fast-install' instead\"\n\t  fast_install=no\n\t  ;;\n\t*) no_install=yes ;;\n\tesac\n\tcontinue\n\t;;\n\n      -no-undefined)\n\tallow_undefined=no\n\tcontinue\n\t;;\n\n      -objectlist)\n\tprev=objectlist\n\tcontinue\n\t;;\n\n      -o) prev=output ;;\n\n      -precious-files-regex)\n\tprev=precious_regex\n\tcontinue\n\t;;\n\n      -release)\n\tprev=release\n\tcontinue\n\t;;\n\n      -rpath)\n\tprev=rpath\n\tcontinue\n\t;;\n\n      -R)\n\tprev=xrpath\n\tcontinue\n\t;;\n\n      -R*)\n\tfunc_stripname '-R' '' \"$arg\"\n\tdir=$func_stripname_result\n\t# We need an absolute path.\n\tcase $dir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t=*)\n\t  func_stripname '=' '' \"$dir\"\n\t  dir=$lt_sysroot$func_stripname_result\n\t  ;;\n\t*)\n\t  func_fatal_error \"only absolute run-paths are allowed\"\n\t  ;;\n\tesac\n\tcase \"$xrpath \" in\n\t*\" $dir \"*) ;;\n\t*) func_append xrpath \" $dir\" ;;\n\tesac\n\tcontinue\n\t;;\n\n      -shared)\n\t# The effects of -shared are defined in a previous loop.\n\tcontinue\n\t;;\n\n      -shrext)\n\tprev=shrext\n\tcontinue\n\t;;\n\n      -static | -static-libtool-libs)\n\t# The effects of -static are defined in a previous loop.\n\t# We used to do the same as -all-static on platforms that\n\t# didn't have a PIC flag, but the assumption that the effects\n\t# would be equivalent was wrong.  It would break on at least\n\t# Digital Unix and AIX.\n\tcontinue\n\t;;\n\n      -thread-safe)\n\tthread_safe=yes\n\tcontinue\n\t;;\n\n      -version-info)\n\tprev=vinfo\n\tcontinue\n\t;;\n\n      -version-number)\n\tprev=vinfo\n\tvinfo_number=yes\n\tcontinue\n\t;;\n\n      -weak)\n        prev=weak\n\tcontinue\n\t;;\n\n      -Wc,*)\n\tfunc_stripname '-Wc,' '' \"$arg\"\n\targs=$func_stripname_result\n\targ=\n\tsave_ifs=\"$IFS\"; IFS=','\n\tfor flag in $args; do\n\t  IFS=\"$save_ifs\"\n          func_quote_for_eval \"$flag\"\n\t  func_append arg \" $func_quote_for_eval_result\"\n\t  func_append compiler_flags \" $func_quote_for_eval_result\"\n\tdone\n\tIFS=\"$save_ifs\"\n\tfunc_stripname ' ' '' \"$arg\"\n\targ=$func_stripname_result\n\t;;\n\n      -Wl,*)\n\tfunc_stripname '-Wl,' '' \"$arg\"\n\targs=$func_stripname_result\n\targ=\n\tsave_ifs=\"$IFS\"; IFS=','\n\tfor flag in $args; do\n\t  IFS=\"$save_ifs\"\n          func_quote_for_eval \"$flag\"\n\t  func_append arg \" $wl$func_quote_for_eval_result\"\n\t  func_append compiler_flags \" $wl$func_quote_for_eval_result\"\n\t  func_append linker_flags \" $func_quote_for_eval_result\"\n\tdone\n\tIFS=\"$save_ifs\"\n\tfunc_stripname ' ' '' \"$arg\"\n\targ=$func_stripname_result\n\t;;\n\n      -Xcompiler)\n\tprev=xcompiler\n\tcontinue\n\t;;\n\n      -Xlinker)\n\tprev=xlinker\n\tcontinue\n\t;;\n\n      -XCClinker)\n\tprev=xcclinker\n\tcontinue\n\t;;\n\n      # -msg_* for osf cc\n      -msg_*)\n\tfunc_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n\n      # Flags to be passed through unchanged, with rationale:\n      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler\n      # -r[0-9][0-9]*        specify processor for the SGI compiler\n      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler\n      # +DA*, +DD*           enable 64-bit mode for the HP compiler\n      # -q*                  compiler args for the IBM compiler\n      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC\n      # -F/path              path to uninstalled frameworks, gcc on darwin\n      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC\n      # @file                GCC response files\n      # -tp=*                Portland pgcc target processor selection\n      # --sysroot=*          for sysroot support\n      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization\n      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \\\n      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \\\n      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)\n        func_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n        func_append compile_command \" $arg\"\n        func_append finalize_command \" $arg\"\n        func_append compiler_flags \" $arg\"\n        continue\n        ;;\n\n      # Some other compiler flag.\n      -* | +*)\n        func_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n\n      *.$objext)\n\t# A standard object.\n\tfunc_append objs \" $arg\"\n\t;;\n\n      *.lo)\n\t# A libtool-controlled object.\n\n\t# Check to see that this really is a libtool object.\n\tif func_lalib_unsafe_p \"$arg\"; then\n\t  pic_object=\n\t  non_pic_object=\n\n\t  # Read the .lo file\n\t  func_source \"$arg\"\n\n\t  if test -z \"$pic_object\" ||\n\t     test -z \"$non_pic_object\" ||\n\t     test \"$pic_object\" = none &&\n\t     test \"$non_pic_object\" = none; then\n\t    func_fatal_error \"cannot find name of object for \\`$arg'\"\n\t  fi\n\n\t  # Extract subdirectory from the argument.\n\t  func_dirname \"$arg\" \"/\" \"\"\n\t  xdir=\"$func_dirname_result\"\n\n\t  if test \"$pic_object\" != none; then\n\t    # Prepend the subdirectory the object is found in.\n\t    pic_object=\"$xdir$pic_object\"\n\n\t    if test \"$prev\" = dlfiles; then\n\t      if test \"$build_libtool_libs\" = yes && test \"$dlopen_support\" = yes; then\n\t\tfunc_append dlfiles \" $pic_object\"\n\t\tprev=\n\t\tcontinue\n\t      else\n\t\t# If libtool objects are unsupported, then we need to preload.\n\t\tprev=dlprefiles\n\t      fi\n\t    fi\n\n\t    # CHECK ME:  I think I busted this.  -Ossama\n\t    if test \"$prev\" = dlprefiles; then\n\t      # Preload the old-style object.\n\t      func_append dlprefiles \" $pic_object\"\n\t      prev=\n\t    fi\n\n\t    # A PIC object.\n\t    func_append libobjs \" $pic_object\"\n\t    arg=\"$pic_object\"\n\t  fi\n\n\t  # Non-PIC object.\n\t  if test \"$non_pic_object\" != none; then\n\t    # Prepend the subdirectory the object is found in.\n\t    non_pic_object=\"$xdir$non_pic_object\"\n\n\t    # A standard non-PIC object\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t    if test -z \"$pic_object\" || test \"$pic_object\" = none ; then\n\t      arg=\"$non_pic_object\"\n\t    fi\n\t  else\n\t    # If the PIC object exists, use it instead.\n\t    # $xdir was prepended to $pic_object above.\n\t    non_pic_object=\"$pic_object\"\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t  fi\n\telse\n\t  # Only an error if not doing a dry-run.\n\t  if $opt_dry_run; then\n\t    # Extract subdirectory from the argument.\n\t    func_dirname \"$arg\" \"/\" \"\"\n\t    xdir=\"$func_dirname_result\"\n\n\t    func_lo2o \"$arg\"\n\t    pic_object=$xdir$objdir/$func_lo2o_result\n\t    non_pic_object=$xdir$func_lo2o_result\n\t    func_append libobjs \" $pic_object\"\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t  else\n\t    func_fatal_error \"\\`$arg' is not a valid libtool object\"\n\t  fi\n\tfi\n\t;;\n\n      *.$libext)\n\t# An archive.\n\tfunc_append deplibs \" $arg\"\n\tfunc_append old_deplibs \" $arg\"\n\tcontinue\n\t;;\n\n      *.la)\n\t# A libtool-controlled library.\n\n\tfunc_resolve_sysroot \"$arg\"\n\tif test \"$prev\" = dlfiles; then\n\t  # This library was specified with -dlopen.\n\t  func_append dlfiles \" $func_resolve_sysroot_result\"\n\t  prev=\n\telif test \"$prev\" = dlprefiles; then\n\t  # The library was specified with -dlpreopen.\n\t  func_append dlprefiles \" $func_resolve_sysroot_result\"\n\t  prev=\n\telse\n\t  func_append deplibs \" $func_resolve_sysroot_result\"\n\tfi\n\tcontinue\n\t;;\n\n      # Some other compiler argument.\n      *)\n\t# Unknown arguments in both finalize_command and compile_command need\n\t# to be aesthetically quoted because they are evaled later.\n\tfunc_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n      esac # arg\n\n      # Now actually substitute the argument into the commands.\n      if test -n \"$arg\"; then\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n      fi\n    done # argument parsing loop\n\n    test -n \"$prev\" && \\\n      func_fatal_help \"the \\`$prevarg' option requires an argument\"\n\n    if test \"$export_dynamic\" = yes && test -n \"$export_dynamic_flag_spec\"; then\n      eval arg=\\\"$export_dynamic_flag_spec\\\"\n      func_append compile_command \" $arg\"\n      func_append finalize_command \" $arg\"\n    fi\n\n    oldlibs=\n    # calculate the name of the file, without its directory\n    func_basename \"$output\"\n    outputname=\"$func_basename_result\"\n    libobjs_save=\"$libobjs\"\n\n    if test -n \"$shlibpath_var\"; then\n      # get the directories listed in $shlibpath_var\n      eval shlib_search_path=\\`\\$ECHO \\\"\\${$shlibpath_var}\\\" \\| \\$SED \\'s/:/ /g\\'\\`\n    else\n      shlib_search_path=\n    fi\n    eval sys_lib_search_path=\\\"$sys_lib_search_path_spec\\\"\n    eval sys_lib_dlsearch_path=\\\"$sys_lib_dlsearch_path_spec\\\"\n\n    func_dirname \"$output\" \"/\" \"\"\n    output_objdir=\"$func_dirname_result$objdir\"\n    func_to_tool_file \"$output_objdir/\"\n    tool_output_objdir=$func_to_tool_file_result\n    # Create the object directory.\n    func_mkdir_p \"$output_objdir\"\n\n    # Determine the type of output\n    case $output in\n    \"\")\n      func_fatal_help \"you must specify an output file\"\n      ;;\n    *.$libext) linkmode=oldlib ;;\n    *.lo | *.$objext) linkmode=obj ;;\n    *.la) linkmode=lib ;;\n    *) linkmode=prog ;; # Anything else should be a program.\n    esac\n\n    specialdeplibs=\n\n    libs=\n    # Find all interdependent deplibs by searching for libraries\n    # that are linked more than once (e.g. -la -lb -la)\n    for deplib in $deplibs; do\n      if $opt_preserve_dup_deps ; then\n\tcase \"$libs \" in\n\t*\" $deplib \"*) func_append specialdeplibs \" $deplib\" ;;\n\tesac\n      fi\n      func_append libs \" $deplib\"\n    done\n\n    if test \"$linkmode\" = lib; then\n      libs=\"$predeps $libs $compiler_lib_search_path $postdeps\"\n\n      # Compute libraries that are listed more than once in $predeps\n      # $postdeps and mark them as special (i.e., whose duplicates are\n      # not to be eliminated).\n      pre_post_deps=\n      if $opt_duplicate_compiler_generated_deps; then\n\tfor pre_post_dep in $predeps $postdeps; do\n\t  case \"$pre_post_deps \" in\n\t  *\" $pre_post_dep \"*) func_append specialdeplibs \" $pre_post_deps\" ;;\n\t  esac\n\t  func_append pre_post_deps \" $pre_post_dep\"\n\tdone\n      fi\n      pre_post_deps=\n    fi\n\n    deplibs=\n    newdependency_libs=\n    newlib_search_path=\n    need_relink=no # whether we're linking any uninstalled libtool libraries\n    notinst_deplibs= # not-installed libtool libraries\n    notinst_path= # paths that contain not-installed libtool libraries\n\n    case $linkmode in\n    lib)\n\tpasses=\"conv dlpreopen link\"\n\tfor file in $dlfiles $dlprefiles; do\n\t  case $file in\n\t  *.la) ;;\n\t  *)\n\t    func_fatal_help \"libraries can \\`-dlopen' only libtool libraries: $file\"\n\t    ;;\n\t  esac\n\tdone\n\t;;\n    prog)\n\tcompile_deplibs=\n\tfinalize_deplibs=\n\talldeplibs=no\n\tnewdlfiles=\n\tnewdlprefiles=\n\tpasses=\"conv scan dlopen dlpreopen link\"\n\t;;\n    *)  passes=\"conv\"\n\t;;\n    esac\n\n    for pass in $passes; do\n      # The preopen pass in lib mode reverses $deplibs; put it back here\n      # so that -L comes before libs that need it for instance...\n      if test \"$linkmode,$pass\" = \"lib,link\"; then\n\t## FIXME: Find the place where the list is rebuilt in the wrong\n\t##        order, and fix it there properly\n        tmp_deplibs=\n\tfor deplib in $deplibs; do\n\t  tmp_deplibs=\"$deplib $tmp_deplibs\"\n\tdone\n\tdeplibs=\"$tmp_deplibs\"\n      fi\n\n      if test \"$linkmode,$pass\" = \"lib,link\" ||\n\t test \"$linkmode,$pass\" = \"prog,scan\"; then\n\tlibs=\"$deplibs\"\n\tdeplibs=\n      fi\n      if test \"$linkmode\" = prog; then\n\tcase $pass in\n\tdlopen) libs=\"$dlfiles\" ;;\n\tdlpreopen) libs=\"$dlprefiles\" ;;\n\tlink)\n\t  libs=\"$deplibs %DEPLIBS%\"\n\t  test \"X$link_all_deplibs\" != Xno && libs=\"$libs $dependency_libs\"\n\t  ;;\n\tesac\n      fi\n      if test \"$linkmode,$pass\" = \"lib,dlpreopen\"; then\n\t# Collect and forward deplibs of preopened libtool libs\n\tfor lib in $dlprefiles; do\n\t  # Ignore non-libtool-libs\n\t  dependency_libs=\n\t  func_resolve_sysroot \"$lib\"\n\t  case $lib in\n\t  *.la)\tfunc_source \"$func_resolve_sysroot_result\" ;;\n\t  esac\n\n\t  # Collect preopened libtool deplibs, except any this library\n\t  # has declared as weak libs\n\t  for deplib in $dependency_libs; do\n\t    func_basename \"$deplib\"\n            deplib_base=$func_basename_result\n\t    case \" $weak_libs \" in\n\t    *\" $deplib_base \"*) ;;\n\t    *) func_append deplibs \" $deplib\" ;;\n\t    esac\n\t  done\n\tdone\n\tlibs=\"$dlprefiles\"\n      fi\n      if test \"$pass\" = dlopen; then\n\t# Collect dlpreopened libraries\n\tsave_deplibs=\"$deplibs\"\n\tdeplibs=\n      fi\n\n      for deplib in $libs; do\n\tlib=\n\tfound=no\n\tcase $deplib in\n\t-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \\\n        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)\n\t  if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$deplib $compile_deplibs\"\n\t    finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t  else\n\t    func_append compiler_flags \" $deplib\"\n\t    if test \"$linkmode\" = lib ; then\n\t\tcase \"$new_inherited_linker_flags \" in\n\t\t    *\" $deplib \"*) ;;\n\t\t    * ) func_append new_inherited_linker_flags \" $deplib\" ;;\n\t\tesac\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t-l*)\n\t  if test \"$linkmode\" != lib && test \"$linkmode\" != prog; then\n\t    func_warning \"\\`-l' is ignored for archives/objects\"\n\t    continue\n\t  fi\n\t  func_stripname '-l' '' \"$deplib\"\n\t  name=$func_stripname_result\n\t  if test \"$linkmode\" = lib; then\n\t    searchdirs=\"$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path\"\n\t  else\n\t    searchdirs=\"$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path\"\n\t  fi\n\t  for searchdir in $searchdirs; do\n\t    for search_ext in .la $std_shrext .so .a; do\n\t      # Search the libtool library\n\t      lib=\"$searchdir/lib${name}${search_ext}\"\n\t      if test -f \"$lib\"; then\n\t\tif test \"$search_ext\" = \".la\"; then\n\t\t  found=yes\n\t\telse\n\t\t  found=no\n\t\tfi\n\t\tbreak 2\n\t      fi\n\t    done\n\t  done\n\t  if test \"$found\" != yes; then\n\t    # deplib doesn't seem to be a libtool library\n\t    if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    else\n\t      deplibs=\"$deplib $deplibs\"\n\t      test \"$linkmode\" = lib && newdependency_libs=\"$deplib $newdependency_libs\"\n\t    fi\n\t    continue\n\t  else # deplib is a libtool library\n\t    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,\n\t    # We need to do some special things here, and not later.\n\t    if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t      case \" $predeps $postdeps \" in\n\t      *\" $deplib \"*)\n\t\tif func_lalib_p \"$lib\"; then\n\t\t  library_names=\n\t\t  old_library=\n\t\t  func_source \"$lib\"\n\t\t  for l in $old_library $library_names; do\n\t\t    ll=\"$l\"\n\t\t  done\n\t\t  if test \"X$ll\" = \"X$old_library\" ; then # only static version available\n\t\t    found=no\n\t\t    func_dirname \"$lib\" \"\" \".\"\n\t\t    ladir=\"$func_dirname_result\"\n\t\t    lib=$ladir/$old_library\n\t\t    if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t\t    else\n\t\t      deplibs=\"$deplib $deplibs\"\n\t\t      test \"$linkmode\" = lib && newdependency_libs=\"$deplib $newdependency_libs\"\n\t\t    fi\n\t\t    continue\n\t\t  fi\n\t\tfi\n\t\t;;\n\t      *) ;;\n\t      esac\n\t    fi\n\t  fi\n\t  ;; # -l\n\t*.ltframework)\n\t  if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$deplib $compile_deplibs\"\n\t    finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t  else\n\t    deplibs=\"$deplib $deplibs\"\n\t    if test \"$linkmode\" = lib ; then\n\t\tcase \"$new_inherited_linker_flags \" in\n\t\t    *\" $deplib \"*) ;;\n\t\t    * ) func_append new_inherited_linker_flags \" $deplib\" ;;\n\t\tesac\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t-L*)\n\t  case $linkmode in\n\t  lib)\n\t    deplibs=\"$deplib $deplibs\"\n\t    test \"$pass\" = conv && continue\n\t    newdependency_libs=\"$deplib $newdependency_libs\"\n\t    func_stripname '-L' '' \"$deplib\"\n\t    func_resolve_sysroot \"$func_stripname_result\"\n\t    func_append newlib_search_path \" $func_resolve_sysroot_result\"\n\t    ;;\n\t  prog)\n\t    if test \"$pass\" = conv; then\n\t      deplibs=\"$deplib $deplibs\"\n\t      continue\n\t    fi\n\t    if test \"$pass\" = scan; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    fi\n\t    func_stripname '-L' '' \"$deplib\"\n\t    func_resolve_sysroot \"$func_stripname_result\"\n\t    func_append newlib_search_path \" $func_resolve_sysroot_result\"\n\t    ;;\n\t  *)\n\t    func_warning \"\\`-L' is ignored for archives/objects\"\n\t    ;;\n\t  esac # linkmode\n\t  continue\n\t  ;; # -L\n\t-R*)\n\t  if test \"$pass\" = link; then\n\t    func_stripname '-R' '' \"$deplib\"\n\t    func_resolve_sysroot \"$func_stripname_result\"\n\t    dir=$func_resolve_sysroot_result\n\t    # Make sure the xrpath contains only unique directories.\n\t    case \"$xrpath \" in\n\t    *\" $dir \"*) ;;\n\t    *) func_append xrpath \" $dir\" ;;\n\t    esac\n\t  fi\n\t  deplibs=\"$deplib $deplibs\"\n\t  continue\n\t  ;;\n\t*.la)\n\t  func_resolve_sysroot \"$deplib\"\n\t  lib=$func_resolve_sysroot_result\n\t  ;;\n\t*.$libext)\n\t  if test \"$pass\" = conv; then\n\t    deplibs=\"$deplib $deplibs\"\n\t    continue\n\t  fi\n\t  case $linkmode in\n\t  lib)\n\t    # Linking convenience modules into shared libraries is allowed,\n\t    # but linking other static libraries is non-portable.\n\t    case \" $dlpreconveniencelibs \" in\n\t    *\" $deplib \"*) ;;\n\t    *)\n\t      valid_a_lib=no\n\t      case $deplibs_check_method in\n\t\tmatch_pattern*)\n\t\t  set dummy $deplibs_check_method; shift\n\t\t  match_pattern_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t\t  if eval \"\\$ECHO \\\"$deplib\\\"\" 2>/dev/null | $SED 10q \\\n\t\t    | $EGREP \"$match_pattern_regex\" > /dev/null; then\n\t\t    valid_a_lib=yes\n\t\t  fi\n\t\t;;\n\t\tpass_all)\n\t\t  valid_a_lib=yes\n\t\t;;\n\t      esac\n\t      if test \"$valid_a_lib\" != yes; then\n\t\techo\n\t\t$ECHO \"*** Warning: Trying to link with static lib archive $deplib.\"\n\t\techo \"*** I have the capability to make that library automatically link in when\"\n\t\techo \"*** you link to this library.  But I can only do this if you have a\"\n\t\techo \"*** shared version of the library, which you do not appear to have\"\n\t\techo \"*** because the file extensions .$libext of this argument makes me believe\"\n\t\techo \"*** that it is just a static archive that I should not use here.\"\n\t      else\n\t\techo\n\t\t$ECHO \"*** Warning: Linking the shared library $output against the\"\n\t\t$ECHO \"*** static library $deplib is not portable!\"\n\t\tdeplibs=\"$deplib $deplibs\"\n\t      fi\n\t      ;;\n\t    esac\n\t    continue\n\t    ;;\n\t  prog)\n\t    if test \"$pass\" != link; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    fi\n\t    continue\n\t    ;;\n\t  esac # linkmode\n\t  ;; # *.$libext\n\t*.lo | *.$objext)\n\t  if test \"$pass\" = conv; then\n\t    deplibs=\"$deplib $deplibs\"\n\t  elif test \"$linkmode\" = prog; then\n\t    if test \"$pass\" = dlpreopen || test \"$dlopen_support\" != yes || test \"$build_libtool_libs\" = no; then\n\t      # If there is no dlopen support or we're linking statically,\n\t      # we need to preload.\n\t      func_append newdlprefiles \" $deplib\"\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    else\n\t      func_append newdlfiles \" $deplib\"\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t%DEPLIBS%)\n\t  alldeplibs=yes\n\t  continue\n\t  ;;\n\tesac # case $deplib\n\n\tif test \"$found\" = yes || test -f \"$lib\"; then :\n\telse\n\t  func_fatal_error \"cannot find the library \\`$lib' or unhandled argument \\`$deplib'\"\n\tfi\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$lib\" \\\n\t  || func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\n\tfunc_dirname \"$lib\" \"\" \".\"\n\tladir=\"$func_dirname_result\"\n\n\tdlname=\n\tdlopen=\n\tdlpreopen=\n\tlibdir=\n\tlibrary_names=\n\told_library=\n\tinherited_linker_flags=\n\t# If the library was installed with an old release of libtool,\n\t# it will not redefine variables installed, or shouldnotlink\n\tinstalled=yes\n\tshouldnotlink=no\n\tavoidtemprpath=\n\n\n\t# Read the .la file\n\tfunc_source \"$lib\"\n\n\t# Convert \"-framework foo\" to \"foo.ltframework\"\n\tif test -n \"$inherited_linker_flags\"; then\n\t  tmp_inherited_linker_flags=`$ECHO \"$inherited_linker_flags\" | $SED 's/-framework \\([^ $]*\\)/\\1.ltframework/g'`\n\t  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do\n\t    case \" $new_inherited_linker_flags \" in\n\t      *\" $tmp_inherited_linker_flag \"*) ;;\n\t      *) func_append new_inherited_linker_flags \" $tmp_inherited_linker_flag\";;\n\t    esac\n\t  done\n\tfi\n\tdependency_libs=`$ECHO \" $dependency_libs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tif test \"$linkmode,$pass\" = \"lib,link\" ||\n\t   test \"$linkmode,$pass\" = \"prog,scan\" ||\n\t   { test \"$linkmode\" != prog && test \"$linkmode\" != lib; }; then\n\t  test -n \"$dlopen\" && func_append dlfiles \" $dlopen\"\n\t  test -n \"$dlpreopen\" && func_append dlprefiles \" $dlpreopen\"\n\tfi\n\n\tif test \"$pass\" = conv; then\n\t  # Only check for convenience libraries\n\t  deplibs=\"$lib $deplibs\"\n\t  if test -z \"$libdir\"; then\n\t    if test -z \"$old_library\"; then\n\t      func_fatal_error \"cannot find name of link library for \\`$lib'\"\n\t    fi\n\t    # It is a libtool convenience library, so add in its objects.\n\t    func_append convenience \" $ladir/$objdir/$old_library\"\n\t    func_append old_convenience \" $ladir/$objdir/$old_library\"\n\t    tmp_libs=\n\t    for deplib in $dependency_libs; do\n\t      deplibs=\"$deplib $deplibs\"\n\t      if $opt_preserve_dup_deps ; then\n\t\tcase \"$tmp_libs \" in\n\t\t*\" $deplib \"*) func_append specialdeplibs \" $deplib\" ;;\n\t\tesac\n\t      fi\n\t      func_append tmp_libs \" $deplib\"\n\t    done\n\t  elif test \"$linkmode\" != prog && test \"$linkmode\" != lib; then\n\t    func_fatal_error \"\\`$lib' is not a convenience library\"\n\t  fi\n\t  continue\n\tfi # $pass = conv\n\n\n\t# Get the name of the library we link against.\n\tlinklib=\n\tif test -n \"$old_library\" &&\n\t   { test \"$prefer_static_libs\" = yes ||\n\t     test \"$prefer_static_libs,$installed\" = \"built,no\"; }; then\n\t  linklib=$old_library\n\telse\n\t  for l in $old_library $library_names; do\n\t    linklib=\"$l\"\n\t  done\n\tfi\n\tif test -z \"$linklib\"; then\n\t  func_fatal_error \"cannot find name of link library for \\`$lib'\"\n\tfi\n\n\t# This library was specified with -dlopen.\n\tif test \"$pass\" = dlopen; then\n\t  if test -z \"$libdir\"; then\n\t    func_fatal_error \"cannot -dlopen a convenience library: \\`$lib'\"\n\t  fi\n\t  if test -z \"$dlname\" ||\n\t     test \"$dlopen_support\" != yes ||\n\t     test \"$build_libtool_libs\" = no; then\n\t    # If there is no dlname, no dlopen support or we're linking\n\t    # statically, we need to preload.  We also need to preload any\n\t    # dependent libraries so libltdl's deplib preloader doesn't\n\t    # bomb out in the load deplibs phase.\n\t    func_append dlprefiles \" $lib $dependency_libs\"\n\t  else\n\t    func_append newdlfiles \" $lib\"\n\t  fi\n\t  continue\n\tfi # $pass = dlopen\n\n\t# We need an absolute path.\n\tcase $ladir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs_ladir=\"$ladir\" ;;\n\t*)\n\t  abs_ladir=`cd \"$ladir\" && pwd`\n\t  if test -z \"$abs_ladir\"; then\n\t    func_warning \"cannot determine absolute directory name of \\`$ladir'\"\n\t    func_warning \"passing it literally to the linker, although it might fail\"\n\t    abs_ladir=\"$ladir\"\n\t  fi\n\t  ;;\n\tesac\n\tfunc_basename \"$lib\"\n\tlaname=\"$func_basename_result\"\n\n\t# Find the relevant object directory and library name.\n\tif test \"X$installed\" = Xyes; then\n\t  if test ! -f \"$lt_sysroot$libdir/$linklib\" && test -f \"$abs_ladir/$linklib\"; then\n\t    func_warning \"library \\`$lib' was moved.\"\n\t    dir=\"$ladir\"\n\t    absdir=\"$abs_ladir\"\n\t    libdir=\"$abs_ladir\"\n\t  else\n\t    dir=\"$lt_sysroot$libdir\"\n\t    absdir=\"$lt_sysroot$libdir\"\n\t  fi\n\t  test \"X$hardcode_automatic\" = Xyes && avoidtemprpath=yes\n\telse\n\t  if test ! -f \"$ladir/$objdir/$linklib\" && test -f \"$abs_ladir/$linklib\"; then\n\t    dir=\"$ladir\"\n\t    absdir=\"$abs_ladir\"\n\t    # Remove this search path later\n\t    func_append notinst_path \" $abs_ladir\"\n\t  else\n\t    dir=\"$ladir/$objdir\"\n\t    absdir=\"$abs_ladir/$objdir\"\n\t    # Remove this search path later\n\t    func_append notinst_path \" $abs_ladir\"\n\t  fi\n\tfi # $installed = yes\n\tfunc_stripname 'lib' '.la' \"$laname\"\n\tname=$func_stripname_result\n\n\t# This library was specified with -dlpreopen.\n\tif test \"$pass\" = dlpreopen; then\n\t  if test -z \"$libdir\" && test \"$linkmode\" = prog; then\n\t    func_fatal_error \"only libraries may -dlpreopen a convenience library: \\`$lib'\"\n\t  fi\n\t  case \"$host\" in\n\t    # special handling for platforms with PE-DLLs.\n\t    *cygwin* | *mingw* | *cegcc* )\n\t      # Linker will automatically link against shared library if both\n\t      # static and shared are present.  Therefore, ensure we extract\n\t      # symbols from the import library if a shared library is present\n\t      # (otherwise, the dlopen module name will be incorrect).  We do\n\t      # this by putting the import library name into $newdlprefiles.\n\t      # We recover the dlopen module name by 'saving' the la file\n\t      # name in a special purpose variable, and (later) extracting the\n\t      # dlname from the la file.\n\t      if test -n \"$dlname\"; then\n\t        func_tr_sh \"$dir/$linklib\"\n\t        eval \"libfile_$func_tr_sh_result=\\$abs_ladir/\\$laname\"\n\t        func_append newdlprefiles \" $dir/$linklib\"\n\t      else\n\t        func_append newdlprefiles \" $dir/$old_library\"\n\t        # Keep a list of preopened convenience libraries to check\n\t        # that they are being used correctly in the link pass.\n\t        test -z \"$libdir\" && \\\n\t          func_append dlpreconveniencelibs \" $dir/$old_library\"\n\t      fi\n\t    ;;\n\t    * )\n\t      # Prefer using a static library (so that no silly _DYNAMIC symbols\n\t      # are required to link).\n\t      if test -n \"$old_library\"; then\n\t        func_append newdlprefiles \" $dir/$old_library\"\n\t        # Keep a list of preopened convenience libraries to check\n\t        # that they are being used correctly in the link pass.\n\t        test -z \"$libdir\" && \\\n\t          func_append dlpreconveniencelibs \" $dir/$old_library\"\n\t      # Otherwise, use the dlname, so that lt_dlopen finds it.\n\t      elif test -n \"$dlname\"; then\n\t        func_append newdlprefiles \" $dir/$dlname\"\n\t      else\n\t        func_append newdlprefiles \" $dir/$linklib\"\n\t      fi\n\t    ;;\n\t  esac\n\tfi # $pass = dlpreopen\n\n\tif test -z \"$libdir\"; then\n\t  # Link the convenience library\n\t  if test \"$linkmode\" = lib; then\n\t    deplibs=\"$dir/$old_library $deplibs\"\n\t  elif test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$dir/$old_library $compile_deplibs\"\n\t    finalize_deplibs=\"$dir/$old_library $finalize_deplibs\"\n\t  else\n\t    deplibs=\"$lib $deplibs\" # used for prog,scan pass\n\t  fi\n\t  continue\n\tfi\n\n\n\tif test \"$linkmode\" = prog && test \"$pass\" != link; then\n\t  func_append newlib_search_path \" $ladir\"\n\t  deplibs=\"$lib $deplibs\"\n\n\t  linkalldeplibs=no\n\t  if test \"$link_all_deplibs\" != no || test -z \"$library_names\" ||\n\t     test \"$build_libtool_libs\" = no; then\n\t    linkalldeplibs=yes\n\t  fi\n\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    case $deplib in\n\t    -L*) func_stripname '-L' '' \"$deplib\"\n\t         func_resolve_sysroot \"$func_stripname_result\"\n\t         func_append newlib_search_path \" $func_resolve_sysroot_result\"\n\t\t ;;\n\t    esac\n\t    # Need to link against all dependency_libs?\n\t    if test \"$linkalldeplibs\" = yes; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      # Need to hardcode shared library paths\n\t      # or/and link against static libraries\n\t      newdependency_libs=\"$deplib $newdependency_libs\"\n\t    fi\n\t    if $opt_preserve_dup_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $deplib \"*) func_append specialdeplibs \" $deplib\" ;;\n\t      esac\n\t    fi\n\t    func_append tmp_libs \" $deplib\"\n\t  done # for deplib\n\t  continue\n\tfi # $linkmode = prog...\n\n\tif test \"$linkmode,$pass\" = \"prog,link\"; then\n\t  if test -n \"$library_names\" &&\n\t     { { test \"$prefer_static_libs\" = no ||\n\t         test \"$prefer_static_libs,$installed\" = \"built,yes\"; } ||\n\t       test -z \"$old_library\"; }; then\n\t    # We need to hardcode the library path\n\t    if test -n \"$shlibpath_var\" && test -z \"$avoidtemprpath\" ; then\n\t      # Make sure the rpath contains only unique directories.\n\t      case \"$temp_rpath:\" in\n\t      *\"$absdir:\"*) ;;\n\t      *) func_append temp_rpath \"$absdir:\" ;;\n\t      esac\n\t    fi\n\n\t    # Hardcode the library path.\n\t    # Skip directories that are in the system default run-time\n\t    # search path.\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $absdir \"*) ;;\n\t    *)\n\t      case \"$compile_rpath \" in\n\t      *\" $absdir \"*) ;;\n\t      *) func_append compile_rpath \" $absdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $libdir \"*) ;;\n\t    *)\n\t      case \"$finalize_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) func_append finalize_rpath \" $libdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t  fi # $linkmode,$pass = prog,link...\n\n\t  if test \"$alldeplibs\" = yes &&\n\t     { test \"$deplibs_check_method\" = pass_all ||\n\t       { test \"$build_libtool_libs\" = yes &&\n\t\t test -n \"$library_names\"; }; }; then\n\t    # We only need to search for static libraries\n\t    continue\n\t  fi\n\tfi\n\n\tlink_static=no # Whether the deplib will be linked statically\n\tuse_static_libs=$prefer_static_libs\n\tif test \"$use_static_libs\" = built && test \"$installed\" = yes; then\n\t  use_static_libs=no\n\tfi\n\tif test -n \"$library_names\" &&\n\t   { test \"$use_static_libs\" = no || test -z \"$old_library\"; }; then\n\t  case $host in\n\t  *cygwin* | *mingw* | *cegcc*)\n\t      # No point in relinking DLLs because paths are not encoded\n\t      func_append notinst_deplibs \" $lib\"\n\t      need_relink=no\n\t    ;;\n\t  *)\n\t    if test \"$installed\" = no; then\n\t      func_append notinst_deplibs \" $lib\"\n\t      need_relink=yes\n\t    fi\n\t    ;;\n\t  esac\n\t  # This is a shared library\n\n\t  # Warn about portability, can't link against -module's on some\n\t  # systems (darwin).  Don't bleat about dlopened modules though!\n\t  dlopenmodule=\"\"\n\t  for dlpremoduletest in $dlprefiles; do\n\t    if test \"X$dlpremoduletest\" = \"X$lib\"; then\n\t      dlopenmodule=\"$dlpremoduletest\"\n\t      break\n\t    fi\n\t  done\n\t  if test -z \"$dlopenmodule\" && test \"$shouldnotlink\" = yes && test \"$pass\" = link; then\n\t    echo\n\t    if test \"$linkmode\" = prog; then\n\t      $ECHO \"*** Warning: Linking the executable $output against the loadable module\"\n\t    else\n\t      $ECHO \"*** Warning: Linking the shared library $output against the loadable module\"\n\t    fi\n\t    $ECHO \"*** $linklib is not portable!\"\n\t  fi\n\t  if test \"$linkmode\" = lib &&\n\t     test \"$hardcode_into_libs\" = yes; then\n\t    # Hardcode the library path.\n\t    # Skip directories that are in the system default run-time\n\t    # search path.\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $absdir \"*) ;;\n\t    *)\n\t      case \"$compile_rpath \" in\n\t      *\" $absdir \"*) ;;\n\t      *) func_append compile_rpath \" $absdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $libdir \"*) ;;\n\t    *)\n\t      case \"$finalize_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) func_append finalize_rpath \" $libdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t  fi\n\n\t  if test -n \"$old_archive_from_expsyms_cmds\"; then\n\t    # figure out the soname\n\t    set dummy $library_names\n\t    shift\n\t    realname=\"$1\"\n\t    shift\n\t    libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t    # use dlname if we got it. it's perfectly good, no?\n\t    if test -n \"$dlname\"; then\n\t      soname=\"$dlname\"\n\t    elif test -n \"$soname_spec\"; then\n\t      # bleh windows\n\t      case $host in\n\t      *cygwin* | mingw* | *cegcc*)\n\t        func_arith $current - $age\n\t\tmajor=$func_arith_result\n\t\tversuffix=\"-$major\"\n\t\t;;\n\t      esac\n\t      eval soname=\\\"$soname_spec\\\"\n\t    else\n\t      soname=\"$realname\"\n\t    fi\n\n\t    # Make a new name for the extract_expsyms_cmds to use\n\t    soroot=\"$soname\"\n\t    func_basename \"$soroot\"\n\t    soname=\"$func_basename_result\"\n\t    func_stripname 'lib' '.dll' \"$soname\"\n\t    newlib=libimp-$func_stripname_result.a\n\n\t    # If the library has no export list, then create one now\n\t    if test -f \"$output_objdir/$soname-def\"; then :\n\t    else\n\t      func_verbose \"extracting exported symbol list from \\`$soname'\"\n\t      func_execute_cmds \"$extract_expsyms_cmds\" 'exit $?'\n\t    fi\n\n\t    # Create $newlib\n\t    if test -f \"$output_objdir/$newlib\"; then :; else\n\t      func_verbose \"generating import library for \\`$soname'\"\n\t      func_execute_cmds \"$old_archive_from_expsyms_cmds\" 'exit $?'\n\t    fi\n\t    # make sure the library variables are pointing to the new library\n\t    dir=$output_objdir\n\t    linklib=$newlib\n\t  fi # test -n \"$old_archive_from_expsyms_cmds\"\n\n\t  if test \"$linkmode\" = prog || test \"$opt_mode\" != relink; then\n\t    add_shlibpath=\n\t    add_dir=\n\t    add=\n\t    lib_linked=yes\n\t    case $hardcode_action in\n\t    immediate | unsupported)\n\t      if test \"$hardcode_direct\" = no; then\n\t\tadd=\"$dir/$linklib\"\n\t\tcase $host in\n\t\t  *-*-sco3.2v5.0.[024]*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-sysv4*uw2*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \\\n\t\t    *-*-unixware7*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-darwin* )\n\t\t    # if the lib is a (non-dlopened) module then we can not\n\t\t    # link against it, someone is ignoring the earlier warnings\n\t\t    if /usr/bin/file -L $add 2> /dev/null |\n\t\t\t $GREP \": [^:]* bundle\" >/dev/null ; then\n\t\t      if test \"X$dlopenmodule\" != \"X$lib\"; then\n\t\t\t$ECHO \"*** Warning: lib $linklib is a module, not a shared library\"\n\t\t\tif test -z \"$old_library\" ; then\n\t\t\t  echo\n\t\t\t  echo \"*** And there doesn't seem to be a static archive available\"\n\t\t\t  echo \"*** The link will probably fail, sorry\"\n\t\t\telse\n\t\t\t  add=\"$dir/$old_library\"\n\t\t\tfi\n\t\t      elif test -n \"$old_library\"; then\n\t\t\tadd=\"$dir/$old_library\"\n\t\t      fi\n\t\t    fi\n\t\tesac\n\t      elif test \"$hardcode_minus_L\" = no; then\n\t\tcase $host in\n\t\t*-*-sunos*) add_shlibpath=\"$dir\" ;;\n\t\tesac\n\t\tadd_dir=\"-L$dir\"\n\t\tadd=\"-l$name\"\n\t      elif test \"$hardcode_shlibpath_var\" = no; then\n\t\tadd_shlibpath=\"$dir\"\n\t\tadd=\"-l$name\"\n\t      else\n\t\tlib_linked=no\n\t      fi\n\t      ;;\n\t    relink)\n\t      if test \"$hardcode_direct\" = yes &&\n\t         test \"$hardcode_direct_absolute\" = no; then\n\t\tadd=\"$dir/$linklib\"\n\t      elif test \"$hardcode_minus_L\" = yes; then\n\t\tadd_dir=\"-L$absdir\"\n\t\t# Try looking first in the location we're being installed to.\n\t\tif test -n \"$inst_prefix_dir\"; then\n\t\t  case $libdir in\n\t\t    [\\\\/]*)\n\t\t      func_append add_dir \" -L$inst_prefix_dir$libdir\"\n\t\t      ;;\n\t\t  esac\n\t\tfi\n\t\tadd=\"-l$name\"\n\t      elif test \"$hardcode_shlibpath_var\" = yes; then\n\t\tadd_shlibpath=\"$dir\"\n\t\tadd=\"-l$name\"\n\t      else\n\t\tlib_linked=no\n\t      fi\n\t      ;;\n\t    *) lib_linked=no ;;\n\t    esac\n\n\t    if test \"$lib_linked\" != yes; then\n\t      func_fatal_configuration \"unsupported hardcode properties\"\n\t    fi\n\n\t    if test -n \"$add_shlibpath\"; then\n\t      case :$compile_shlibpath: in\n\t      *\":$add_shlibpath:\"*) ;;\n\t      *) func_append compile_shlibpath \"$add_shlibpath:\" ;;\n\t      esac\n\t    fi\n\t    if test \"$linkmode\" = prog; then\n\t      test -n \"$add_dir\" && compile_deplibs=\"$add_dir $compile_deplibs\"\n\t      test -n \"$add\" && compile_deplibs=\"$add $compile_deplibs\"\n\t    else\n\t      test -n \"$add_dir\" && deplibs=\"$add_dir $deplibs\"\n\t      test -n \"$add\" && deplibs=\"$add $deplibs\"\n\t      if test \"$hardcode_direct\" != yes &&\n\t\t test \"$hardcode_minus_L\" != yes &&\n\t\t test \"$hardcode_shlibpath_var\" = yes; then\n\t\tcase :$finalize_shlibpath: in\n\t\t*\":$libdir:\"*) ;;\n\t\t*) func_append finalize_shlibpath \"$libdir:\" ;;\n\t\tesac\n\t      fi\n\t    fi\n\t  fi\n\n\t  if test \"$linkmode\" = prog || test \"$opt_mode\" = relink; then\n\t    add_shlibpath=\n\t    add_dir=\n\t    add=\n\t    # Finalize command for both is simple: just hardcode it.\n\t    if test \"$hardcode_direct\" = yes &&\n\t       test \"$hardcode_direct_absolute\" = no; then\n\t      add=\"$libdir/$linklib\"\n\t    elif test \"$hardcode_minus_L\" = yes; then\n\t      add_dir=\"-L$libdir\"\n\t      add=\"-l$name\"\n\t    elif test \"$hardcode_shlibpath_var\" = yes; then\n\t      case :$finalize_shlibpath: in\n\t      *\":$libdir:\"*) ;;\n\t      *) func_append finalize_shlibpath \"$libdir:\" ;;\n\t      esac\n\t      add=\"-l$name\"\n\t    elif test \"$hardcode_automatic\" = yes; then\n\t      if test -n \"$inst_prefix_dir\" &&\n\t\t test -f \"$inst_prefix_dir$libdir/$linklib\" ; then\n\t\tadd=\"$inst_prefix_dir$libdir/$linklib\"\n\t      else\n\t\tadd=\"$libdir/$linklib\"\n\t      fi\n\t    else\n\t      # We cannot seem to hardcode it, guess we'll fake it.\n\t      add_dir=\"-L$libdir\"\n\t      # Try looking first in the location we're being installed to.\n\t      if test -n \"$inst_prefix_dir\"; then\n\t\tcase $libdir in\n\t\t  [\\\\/]*)\n\t\t    func_append add_dir \" -L$inst_prefix_dir$libdir\"\n\t\t    ;;\n\t\tesac\n\t      fi\n\t      add=\"-l$name\"\n\t    fi\n\n\t    if test \"$linkmode\" = prog; then\n\t      test -n \"$add_dir\" && finalize_deplibs=\"$add_dir $finalize_deplibs\"\n\t      test -n \"$add\" && finalize_deplibs=\"$add $finalize_deplibs\"\n\t    else\n\t      test -n \"$add_dir\" && deplibs=\"$add_dir $deplibs\"\n\t      test -n \"$add\" && deplibs=\"$add $deplibs\"\n\t    fi\n\t  fi\n\telif test \"$linkmode\" = prog; then\n\t  # Here we assume that one of hardcode_direct or hardcode_minus_L\n\t  # is not unsupported.  This is valid on all known static and\n\t  # shared platforms.\n\t  if test \"$hardcode_direct\" != unsupported; then\n\t    test -n \"$old_library\" && linklib=\"$old_library\"\n\t    compile_deplibs=\"$dir/$linklib $compile_deplibs\"\n\t    finalize_deplibs=\"$dir/$linklib $finalize_deplibs\"\n\t  else\n\t    compile_deplibs=\"-l$name -L$dir $compile_deplibs\"\n\t    finalize_deplibs=\"-l$name -L$dir $finalize_deplibs\"\n\t  fi\n\telif test \"$build_libtool_libs\" = yes; then\n\t  # Not a shared library\n\t  if test \"$deplibs_check_method\" != pass_all; then\n\t    # We're trying link a shared library against a static one\n\t    # but the system doesn't support it.\n\n\t    # Just print a warning and add the library to dependency_libs so\n\t    # that the program can be linked against the static library.\n\t    echo\n\t    $ECHO \"*** Warning: This system can not link to static lib archive $lib.\"\n\t    echo \"*** I have the capability to make that library automatically link in when\"\n\t    echo \"*** you link to this library.  But I can only do this if you have a\"\n\t    echo \"*** shared version of the library, which you do not appear to have.\"\n\t    if test \"$module\" = yes; then\n\t      echo \"*** But as you try to build a module library, libtool will still create \"\n\t      echo \"*** a static module, that should work as long as the dlopening application\"\n\t      echo \"*** is linked with the -dlopen flag to resolve symbols at runtime.\"\n\t      if test -z \"$global_symbol_pipe\"; then\n\t\techo\n\t\techo \"*** However, this would only work if libtool was able to extract symbol\"\n\t\techo \"*** lists from a program, using \\`nm' or equivalent, but libtool could\"\n\t\techo \"*** not find such a program.  So, this module is probably useless.\"\n\t\techo \"*** \\`nm' from GNU binutils and a full rebuild may help.\"\n\t      fi\n\t      if test \"$build_old_libs\" = no; then\n\t\tbuild_libtool_libs=module\n\t\tbuild_old_libs=yes\n\t      else\n\t\tbuild_libtool_libs=no\n\t      fi\n\t    fi\n\t  else\n\t    deplibs=\"$dir/$old_library $deplibs\"\n\t    link_static=yes\n\t  fi\n\tfi # link shared/static library?\n\n\tif test \"$linkmode\" = lib; then\n\t  if test -n \"$dependency_libs\" &&\n\t     { test \"$hardcode_into_libs\" != yes ||\n\t       test \"$build_old_libs\" = yes ||\n\t       test \"$link_static\" = yes; }; then\n\t    # Extract -R from dependency_libs\n\t    temp_deplibs=\n\t    for libdir in $dependency_libs; do\n\t      case $libdir in\n\t      -R*) func_stripname '-R' '' \"$libdir\"\n\t           temp_xrpath=$func_stripname_result\n\t\t   case \" $xrpath \" in\n\t\t   *\" $temp_xrpath \"*) ;;\n\t\t   *) func_append xrpath \" $temp_xrpath\";;\n\t\t   esac;;\n\t      *) func_append temp_deplibs \" $libdir\";;\n\t      esac\n\t    done\n\t    dependency_libs=\"$temp_deplibs\"\n\t  fi\n\n\t  func_append newlib_search_path \" $absdir\"\n\t  # Link against this library\n\t  test \"$link_static\" = no && newdependency_libs=\"$abs_ladir/$laname $newdependency_libs\"\n\t  # ... and its dependency_libs\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    newdependency_libs=\"$deplib $newdependency_libs\"\n\t    case $deplib in\n              -L*) func_stripname '-L' '' \"$deplib\"\n                   func_resolve_sysroot \"$func_stripname_result\";;\n              *) func_resolve_sysroot \"$deplib\" ;;\n            esac\n\t    if $opt_preserve_dup_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $func_resolve_sysroot_result \"*)\n                func_append specialdeplibs \" $func_resolve_sysroot_result\" ;;\n\t      esac\n\t    fi\n\t    func_append tmp_libs \" $func_resolve_sysroot_result\"\n\t  done\n\n\t  if test \"$link_all_deplibs\" != no; then\n\t    # Add the search paths of all dependency libraries\n\t    for deplib in $dependency_libs; do\n\t      path=\n\t      case $deplib in\n\t      -L*) path=\"$deplib\" ;;\n\t      *.la)\n\t        func_resolve_sysroot \"$deplib\"\n\t        deplib=$func_resolve_sysroot_result\n\t        func_dirname \"$deplib\" \"\" \".\"\n\t\tdir=$func_dirname_result\n\t\t# We need an absolute path.\n\t\tcase $dir in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) absdir=\"$dir\" ;;\n\t\t*)\n\t\t  absdir=`cd \"$dir\" && pwd`\n\t\t  if test -z \"$absdir\"; then\n\t\t    func_warning \"cannot determine absolute directory name of \\`$dir'\"\n\t\t    absdir=\"$dir\"\n\t\t  fi\n\t\t  ;;\n\t\tesac\n\t\tif $GREP \"^installed=no\" $deplib > /dev/null; then\n\t\tcase $host in\n\t\t*-*-darwin*)\n\t\t  depdepl=\n\t\t  eval deplibrary_names=`${SED} -n -e 's/^library_names=\\(.*\\)$/\\1/p' $deplib`\n\t\t  if test -n \"$deplibrary_names\" ; then\n\t\t    for tmp in $deplibrary_names ; do\n\t\t      depdepl=$tmp\n\t\t    done\n\t\t    if test -f \"$absdir/$objdir/$depdepl\" ; then\n\t\t      depdepl=\"$absdir/$objdir/$depdepl\"\n\t\t      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`\n                      if test -z \"$darwin_install_name\"; then\n                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`\n                      fi\n\t\t      func_append compiler_flags \" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}\"\n\t\t      func_append linker_flags \" -dylib_file ${darwin_install_name}:${depdepl}\"\n\t\t      path=\n\t\t    fi\n\t\t  fi\n\t\t  ;;\n\t\t*)\n\t\t  path=\"-L$absdir/$objdir\"\n\t\t  ;;\n\t\tesac\n\t\telse\n\t\t  eval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $deplib`\n\t\t  test -z \"$libdir\" && \\\n\t\t    func_fatal_error \"\\`$deplib' is not a valid libtool archive\"\n\t\t  test \"$absdir\" != \"$libdir\" && \\\n\t\t    func_warning \"\\`$deplib' seems to be moved\"\n\n\t\t  path=\"-L$absdir\"\n\t\tfi\n\t\t;;\n\t      esac\n\t      case \" $deplibs \" in\n\t      *\" $path \"*) ;;\n\t      *) deplibs=\"$path $deplibs\" ;;\n\t      esac\n\t    done\n\t  fi # link_all_deplibs != no\n\tfi # linkmode = lib\n      done # for deplib in $libs\n      if test \"$pass\" = link; then\n\tif test \"$linkmode\" = \"prog\"; then\n\t  compile_deplibs=\"$new_inherited_linker_flags $compile_deplibs\"\n\t  finalize_deplibs=\"$new_inherited_linker_flags $finalize_deplibs\"\n\telse\n\t  compiler_flags=\"$compiler_flags \"`$ECHO \" $new_inherited_linker_flags\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tfi\n      fi\n      dependency_libs=\"$newdependency_libs\"\n      if test \"$pass\" = dlpreopen; then\n\t# Link the dlpreopened libraries before other libraries\n\tfor deplib in $save_deplibs; do\n\t  deplibs=\"$deplib $deplibs\"\n\tdone\n      fi\n      if test \"$pass\" != dlopen; then\n\tif test \"$pass\" != conv; then\n\t  # Make sure lib_search_path contains only unique directories.\n\t  lib_search_path=\n\t  for dir in $newlib_search_path; do\n\t    case \"$lib_search_path \" in\n\t    *\" $dir \"*) ;;\n\t    *) func_append lib_search_path \" $dir\" ;;\n\t    esac\n\t  done\n\t  newlib_search_path=\n\tfi\n\n\tif test \"$linkmode,$pass\" != \"prog,link\"; then\n\t  vars=\"deplibs\"\n\telse\n\t  vars=\"compile_deplibs finalize_deplibs\"\n\tfi\n\tfor var in $vars dependency_libs; do\n\t  # Add libraries to $var in reverse order\n\t  eval tmp_libs=\\\"\\$$var\\\"\n\t  new_libs=\n\t  for deplib in $tmp_libs; do\n\t    # FIXME: Pedantically, this is the right thing to do, so\n\t    #        that some nasty dependency loop isn't accidentally\n\t    #        broken:\n\t    #new_libs=\"$deplib $new_libs\"\n\t    # Pragmatically, this seems to cause very few problems in\n\t    # practice:\n\t    case $deplib in\n\t    -L*) new_libs=\"$deplib $new_libs\" ;;\n\t    -R*) ;;\n\t    *)\n\t      # And here is the reason: when a library appears more\n\t      # than once as an explicit dependence of a library, or\n\t      # is implicitly linked in more than once by the\n\t      # compiler, it is considered special, and multiple\n\t      # occurrences thereof are not removed.  Compare this\n\t      # with having the same library being listed as a\n\t      # dependency of multiple other libraries: in this case,\n\t      # we know (pedantically, we assume) the library does not\n\t      # need to be listed more than once, so we keep only the\n\t      # last copy.  This is not always right, but it is rare\n\t      # enough that we require users that really mean to play\n\t      # such unportable linking tricks to link the library\n\t      # using -Wl,-lname, so that libtool does not consider it\n\t      # for duplicate removal.\n\t      case \" $specialdeplibs \" in\n\t      *\" $deplib \"*) new_libs=\"$deplib $new_libs\" ;;\n\t      *)\n\t\tcase \" $new_libs \" in\n\t\t*\" $deplib \"*) ;;\n\t\t*) new_libs=\"$deplib $new_libs\" ;;\n\t\tesac\n\t\t;;\n\t      esac\n\t      ;;\n\t    esac\n\t  done\n\t  tmp_libs=\n\t  for deplib in $new_libs; do\n\t    case $deplib in\n\t    -L*)\n\t      case \" $tmp_libs \" in\n\t      *\" $deplib \"*) ;;\n\t      *) func_append tmp_libs \" $deplib\" ;;\n\t      esac\n\t      ;;\n\t    *) func_append tmp_libs \" $deplib\" ;;\n\t    esac\n\t  done\n\t  eval $var=\\\"$tmp_libs\\\"\n\tdone # for var\n      fi\n      # Last step: remove runtime libs from dependency_libs\n      # (they stay in deplibs)\n      tmp_libs=\n      for i in $dependency_libs ; do\n\tcase \" $predeps $postdeps $compiler_lib_search_path \" in\n\t*\" $i \"*)\n\t  i=\"\"\n\t  ;;\n\tesac\n\tif test -n \"$i\" ; then\n\t  func_append tmp_libs \" $i\"\n\tfi\n      done\n      dependency_libs=$tmp_libs\n    done # for pass\n    if test \"$linkmode\" = prog; then\n      dlfiles=\"$newdlfiles\"\n    fi\n    if test \"$linkmode\" = prog || test \"$linkmode\" = lib; then\n      dlprefiles=\"$newdlprefiles\"\n    fi\n\n    case $linkmode in\n    oldlib)\n      if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n\tfunc_warning \"\\`-dlopen' is ignored for archives\"\n      fi\n\n      case \" $deplibs\" in\n      *\\ -l* | *\\ -L*)\n\tfunc_warning \"\\`-l' and \\`-L' are ignored for archives\" ;;\n      esac\n\n      test -n \"$rpath\" && \\\n\tfunc_warning \"\\`-rpath' is ignored for archives\"\n\n      test -n \"$xrpath\" && \\\n\tfunc_warning \"\\`-R' is ignored for archives\"\n\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info/-version-number' is ignored for archives\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for archives\"\n\n      test -n \"$export_symbols$export_symbols_regex\" && \\\n\tfunc_warning \"\\`-export-symbols' is ignored for archives\"\n\n      # Now set the variables for building old libraries.\n      build_libtool_libs=no\n      oldlibs=\"$output\"\n      func_append objs \"$old_deplibs\"\n      ;;\n\n    lib)\n      # Make sure we only generate libraries of the form `libNAME.la'.\n      case $outputname in\n      lib*)\n\tfunc_stripname 'lib' '.la' \"$outputname\"\n\tname=$func_stripname_result\n\teval shared_ext=\\\"$shrext_cmds\\\"\n\teval libname=\\\"$libname_spec\\\"\n\t;;\n      *)\n\ttest \"$module\" = no && \\\n\t  func_fatal_help \"libtool library \\`$output' must begin with \\`lib'\"\n\n\tif test \"$need_lib_prefix\" != no; then\n\t  # Add the \"lib\" prefix for modules if required\n\t  func_stripname '' '.la' \"$outputname\"\n\t  name=$func_stripname_result\n\t  eval shared_ext=\\\"$shrext_cmds\\\"\n\t  eval libname=\\\"$libname_spec\\\"\n\telse\n\t  func_stripname '' '.la' \"$outputname\"\n\t  libname=$func_stripname_result\n\tfi\n\t;;\n      esac\n\n      if test -n \"$objs\"; then\n\tif test \"$deplibs_check_method\" != pass_all; then\n\t  func_fatal_error \"cannot build libtool library \\`$output' from non-libtool objects on this host:$objs\"\n\telse\n\t  echo\n\t  $ECHO \"*** Warning: Linking the shared library $output against the non-libtool\"\n\t  $ECHO \"*** objects $objs is not portable!\"\n\t  func_append libobjs \" $objs\"\n\tfi\n      fi\n\n      test \"$dlself\" != no && \\\n\tfunc_warning \"\\`-dlopen self' is ignored for libtool libraries\"\n\n      set dummy $rpath\n      shift\n      test \"$#\" -gt 1 && \\\n\tfunc_warning \"ignoring multiple \\`-rpath's for a libtool library\"\n\n      install_libdir=\"$1\"\n\n      oldlibs=\n      if test -z \"$rpath\"; then\n\tif test \"$build_libtool_libs\" = yes; then\n\t  # Building a libtool convenience library.\n\t  # Some compilers have problems with a `.al' extension so\n\t  # convenience libraries should have the same extension an\n\t  # archive normally would.\n\t  oldlibs=\"$output_objdir/$libname.$libext $oldlibs\"\n\t  build_libtool_libs=convenience\n\t  build_old_libs=yes\n\tfi\n\n\ttest -n \"$vinfo\" && \\\n\t  func_warning \"\\`-version-info/-version-number' is ignored for convenience libraries\"\n\n\ttest -n \"$release\" && \\\n\t  func_warning \"\\`-release' is ignored for convenience libraries\"\n      else\n\n\t# Parse the version information argument.\n\tsave_ifs=\"$IFS\"; IFS=':'\n\tset dummy $vinfo 0 0 0\n\tshift\n\tIFS=\"$save_ifs\"\n\n\ttest -n \"$7\" && \\\n\t  func_fatal_help \"too many parameters to \\`-version-info'\"\n\n\t# convert absolute version numbers to libtool ages\n\t# this retains compatibility with .la files and attempts\n\t# to make the code below a bit more comprehensible\n\n\tcase $vinfo_number in\n\tyes)\n\t  number_major=\"$1\"\n\t  number_minor=\"$2\"\n\t  number_revision=\"$3\"\n\t  #\n\t  # There are really only two kinds -- those that\n\t  # use the current revision as the major version\n\t  # and those that subtract age and use age as\n\t  # a minor version.  But, then there is irix\n\t  # which has an extra 1 added just for fun\n\t  #\n\t  case $version_type in\n\t  # correct linux to gnu/linux during the next big refactor\n\t  darwin|linux|osf|windows|none)\n\t    func_arith $number_major + $number_minor\n\t    current=$func_arith_result\n\t    age=\"$number_minor\"\n\t    revision=\"$number_revision\"\n\t    ;;\n\t  freebsd-aout|freebsd-elf|qnx|sunos)\n\t    current=\"$number_major\"\n\t    revision=\"$number_minor\"\n\t    age=\"0\"\n\t    ;;\n\t  irix|nonstopux)\n\t    func_arith $number_major + $number_minor\n\t    current=$func_arith_result\n\t    age=\"$number_minor\"\n\t    revision=\"$number_minor\"\n\t    lt_irix_increment=no\n\t    ;;\n\t  *)\n\t    func_fatal_configuration \"$modename: unknown library version type \\`$version_type'\"\n\t    ;;\n\t  esac\n\t  ;;\n\tno)\n\t  current=\"$1\"\n\t  revision=\"$2\"\n\t  age=\"$3\"\n\t  ;;\n\tesac\n\n\t# Check that each of the things are valid numbers.\n\tcase $current in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"CURRENT \\`$current' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tcase $revision in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"REVISION \\`$revision' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tcase $age in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"AGE \\`$age' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tif test \"$age\" -gt \"$current\"; then\n\t  func_error \"AGE \\`$age' is greater than the current interface number \\`$current'\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\tfi\n\n\t# Calculate the version variables.\n\tmajor=\n\tversuffix=\n\tverstring=\n\tcase $version_type in\n\tnone) ;;\n\n\tdarwin)\n\t  # Like Linux, but with the current version available in\n\t  # verstring for coding it into the library header\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\"$major.$age.$revision\"\n\t  # Darwin ld doesn't like 0 for these options...\n\t  func_arith $current + 1\n\t  minor_current=$func_arith_result\n\t  xlcverstring=\"${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision\"\n\t  verstring=\"-compatibility_version $minor_current -current_version $minor_current.$revision\"\n\t  ;;\n\n\tfreebsd-aout)\n\t  major=\".$current\"\n\t  versuffix=\".$current.$revision\";\n\t  ;;\n\n\tfreebsd-elf)\n\t  major=\".$current\"\n\t  versuffix=\".$current\"\n\t  ;;\n\n\tirix | nonstopux)\n\t  if test \"X$lt_irix_increment\" = \"Xno\"; then\n\t    func_arith $current - $age\n\t  else\n\t    func_arith $current - $age + 1\n\t  fi\n\t  major=$func_arith_result\n\n\t  case $version_type in\n\t    nonstopux) verstring_prefix=nonstopux ;;\n\t    *)         verstring_prefix=sgi ;;\n\t  esac\n\t  verstring=\"$verstring_prefix$major.$revision\"\n\n\t  # Add in all the interfaces that we are compatible with.\n\t  loop=$revision\n\t  while test \"$loop\" -ne 0; do\n\t    func_arith $revision - $loop\n\t    iface=$func_arith_result\n\t    func_arith $loop - 1\n\t    loop=$func_arith_result\n\t    verstring=\"$verstring_prefix$major.$iface:$verstring\"\n\t  done\n\n\t  # Before this point, $major must not contain `.'.\n\t  major=.$major\n\t  versuffix=\"$major.$revision\"\n\t  ;;\n\n\tlinux) # correct to gnu/linux during the next big refactor\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\"$major.$age.$revision\"\n\t  ;;\n\n\tosf)\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\".$current.$age.$revision\"\n\t  verstring=\"$current.$age.$revision\"\n\n\t  # Add in all the interfaces that we are compatible with.\n\t  loop=$age\n\t  while test \"$loop\" -ne 0; do\n\t    func_arith $current - $loop\n\t    iface=$func_arith_result\n\t    func_arith $loop - 1\n\t    loop=$func_arith_result\n\t    verstring=\"$verstring:${iface}.0\"\n\t  done\n\n\t  # Make executables depend on our current version.\n\t  func_append verstring \":${current}.0\"\n\t  ;;\n\n\tqnx)\n\t  major=\".$current\"\n\t  versuffix=\".$current\"\n\t  ;;\n\n\tsunos)\n\t  major=\".$current\"\n\t  versuffix=\".$current.$revision\"\n\t  ;;\n\n\twindows)\n\t  # Use '-' rather than '.', since we only want one\n\t  # extension on DOS 8.3 filesystems.\n\t  func_arith $current - $age\n\t  major=$func_arith_result\n\t  versuffix=\"-$major\"\n\t  ;;\n\n\t*)\n\t  func_fatal_configuration \"unknown library version type \\`$version_type'\"\n\t  ;;\n\tesac\n\n\t# Clear the version info if we defaulted, and they specified a release.\n\tif test -z \"$vinfo\" && test -n \"$release\"; then\n\t  major=\n\t  case $version_type in\n\t  darwin)\n\t    # we can't check for \"0.0\" in archive_cmds due to quoting\n\t    # problems, so we reset it completely\n\t    verstring=\n\t    ;;\n\t  *)\n\t    verstring=\"0.0\"\n\t    ;;\n\t  esac\n\t  if test \"$need_version\" = no; then\n\t    versuffix=\n\t  else\n\t    versuffix=\".0.0\"\n\t  fi\n\tfi\n\n\t# Remove version info from name if versioning should be avoided\n\tif test \"$avoid_version\" = yes && test \"$need_version\" = no; then\n\t  major=\n\t  versuffix=\n\t  verstring=\"\"\n\tfi\n\n\t# Check to see if the archive will have undefined symbols.\n\tif test \"$allow_undefined\" = yes; then\n\t  if test \"$allow_undefined_flag\" = unsupported; then\n\t    func_warning \"undefined symbols not allowed in $host shared libraries\"\n\t    build_libtool_libs=no\n\t    build_old_libs=yes\n\t  fi\n\telse\n\t  # Don't allow undefined symbols.\n\t  allow_undefined_flag=\"$no_undefined_flag\"\n\tfi\n\n      fi\n\n      func_generate_dlsyms \"$libname\" \"$libname\" \"yes\"\n      func_append libobjs \" $symfileobj\"\n      test \"X$libobjs\" = \"X \" && libobjs=\n\n      if test \"$opt_mode\" != relink; then\n\t# Remove our outputs, but don't remove object files since they\n\t# may have been created when compiling PIC objects.\n\tremovelist=\n\ttempremovelist=`$ECHO \"$output_objdir/*\"`\n\tfor p in $tempremovelist; do\n\t  case $p in\n\t    *.$objext | *.gcno)\n\t       ;;\n\t    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)\n\t       if test \"X$precious_files_regex\" != \"X\"; then\n\t\t if $ECHO \"$p\" | $EGREP -e \"$precious_files_regex\" >/dev/null 2>&1\n\t\t then\n\t\t   continue\n\t\t fi\n\t       fi\n\t       func_append removelist \" $p\"\n\t       ;;\n\t    *) ;;\n\t  esac\n\tdone\n\ttest -n \"$removelist\" && \\\n\t  func_show_eval \"${RM}r \\$removelist\"\n      fi\n\n      # Now set the variables for building old libraries.\n      if test \"$build_old_libs\" = yes && test \"$build_libtool_libs\" != convenience ; then\n\tfunc_append oldlibs \" $output_objdir/$libname.$libext\"\n\n\t# Transform .lo files to .o files.\n\toldobjs=\"$objs \"`$ECHO \"$libobjs\" | $SP2NL | $SED \"/\\.${libext}$/d; $lo2o\" | $NL2SP`\n      fi\n\n      # Eliminate all temporary directories.\n      #for path in $notinst_path; do\n      #\tlib_search_path=`$ECHO \"$lib_search_path \" | $SED \"s% $path % %g\"`\n      #\tdeplibs=`$ECHO \"$deplibs \" | $SED \"s% -L$path % %g\"`\n      #\tdependency_libs=`$ECHO \"$dependency_libs \" | $SED \"s% -L$path % %g\"`\n      #done\n\n      if test -n \"$xrpath\"; then\n\t# If the user specified any rpath flags, then add them.\n\ttemp_xrpath=\n\tfor libdir in $xrpath; do\n\t  func_replace_sysroot \"$libdir\"\n\t  func_append temp_xrpath \" -R$func_replace_sysroot_result\"\n\t  case \"$finalize_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append finalize_rpath \" $libdir\" ;;\n\t  esac\n\tdone\n\tif test \"$hardcode_into_libs\" != yes || test \"$build_old_libs\" = yes; then\n\t  dependency_libs=\"$temp_xrpath $dependency_libs\"\n\tfi\n      fi\n\n      # Make sure dlfiles contains only unique files that won't be dlpreopened\n      old_dlfiles=\"$dlfiles\"\n      dlfiles=\n      for lib in $old_dlfiles; do\n\tcase \" $dlprefiles $dlfiles \" in\n\t*\" $lib \"*) ;;\n\t*) func_append dlfiles \" $lib\" ;;\n\tesac\n      done\n\n      # Make sure dlprefiles contains only unique files\n      old_dlprefiles=\"$dlprefiles\"\n      dlprefiles=\n      for lib in $old_dlprefiles; do\n\tcase \"$dlprefiles \" in\n\t*\" $lib \"*) ;;\n\t*) func_append dlprefiles \" $lib\" ;;\n\tesac\n      done\n\n      if test \"$build_libtool_libs\" = yes; then\n\tif test -n \"$rpath\"; then\n\t  case $host in\n\t  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)\n\t    # these systems don't actually have a c library (as such)!\n\t    ;;\n\t  *-*-rhapsody* | *-*-darwin1.[012])\n\t    # Rhapsody C library is in the System framework\n\t    func_append deplibs \" System.ltframework\"\n\t    ;;\n\t  *-*-netbsd*)\n\t    # Don't link with libc until the a.out ld.so is fixed.\n\t    ;;\n\t  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t    # Do not include libc due to us having libc/libc_r.\n\t    ;;\n\t  *-*-sco3.2v5* | *-*-sco5v6*)\n\t    # Causes problems with __ctype\n\t    ;;\n\t  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)\n\t    # Compiler inserts libc in the correct place for threads to work\n\t    ;;\n\t  *)\n\t    # Add libc to deplibs on all other systems if necessary.\n\t    if test \"$build_libtool_need_lc\" = \"yes\"; then\n\t      func_append deplibs \" -lc\"\n\t    fi\n\t    ;;\n\t  esac\n\tfi\n\n\t# Transform deplibs into only deplibs that can be linked in shared.\n\tname_save=$name\n\tlibname_save=$libname\n\trelease_save=$release\n\tversuffix_save=$versuffix\n\tmajor_save=$major\n\t# I'm not sure if I'm treating the release correctly.  I think\n\t# release should show up in the -l (ie -lgmp5) so we don't want to\n\t# add it in twice.  Is that correct?\n\trelease=\"\"\n\tversuffix=\"\"\n\tmajor=\"\"\n\tnewdeplibs=\n\tdroppeddeps=no\n\tcase $deplibs_check_method in\n\tpass_all)\n\t  # Don't check for shared/static.  Everything works.\n\t  # This might be a little naive.  We might want to check\n\t  # whether the library exists or not.  But this is on\n\t  # osf3 & osf4 and I'm not really sure... Just\n\t  # implementing what was already the behavior.\n\t  newdeplibs=$deplibs\n\t  ;;\n\ttest_compile)\n\t  # This code stresses the \"libraries are programs\" paradigm to its\n\t  # limits. Maybe even breaks it.  We compile a program, linking it\n\t  # against the deplibs as a proxy for the library.  Then we can check\n\t  # whether they linked in statically or dynamically with ldd.\n\t  $opt_dry_run || $RM conftest.c\n\t  cat > conftest.c <<EOF\n\t  int main() { return 0; }\nEOF\n\t  $opt_dry_run || $RM conftest\n\t  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then\n\t    ldd_output=`ldd conftest`\n\t    for i in $deplibs; do\n\t      case $i in\n\t      -l*)\n\t\tfunc_stripname -l '' \"$i\"\n\t\tname=$func_stripname_result\n\t\tif test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\t  case \" $predeps $postdeps \" in\n\t\t  *\" $i \"*)\n\t\t    func_append newdeplibs \" $i\"\n\t\t    i=\"\"\n\t\t    ;;\n\t\t  esac\n\t\tfi\n\t\tif test -n \"$i\" ; then\n\t\t  libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\t  deplib_matches=`eval \"\\\\$ECHO \\\"$library_names_spec\\\"\"`\n\t\t  set dummy $deplib_matches; shift\n\t\t  deplib_match=$1\n\t\t  if test `expr \"$ldd_output\" : \".*$deplib_match\"` -ne 0 ; then\n\t\t    func_append newdeplibs \" $i\"\n\t\t  else\n\t\t    droppeddeps=yes\n\t\t    echo\n\t\t    $ECHO \"*** Warning: dynamic linker does not accept needed library $i.\"\n\t\t    echo \"*** I have the capability to make that library automatically link in when\"\n\t\t    echo \"*** you link to this library.  But I can only do this if you have a\"\n\t\t    echo \"*** shared version of the library, which I believe you do not have\"\n\t\t    echo \"*** because a test_compile did reveal that the linker did not use it for\"\n\t\t    echo \"*** its dynamic dependency list that programs get resolved with at runtime.\"\n\t\t  fi\n\t\tfi\n\t\t;;\n\t      *)\n\t\tfunc_append newdeplibs \" $i\"\n\t\t;;\n\t      esac\n\t    done\n\t  else\n\t    # Error occurred in the first compile.  Let's try to salvage\n\t    # the situation: Compile a separate program for each library.\n\t    for i in $deplibs; do\n\t      case $i in\n\t      -l*)\n\t\tfunc_stripname -l '' \"$i\"\n\t\tname=$func_stripname_result\n\t\t$opt_dry_run || $RM conftest\n\t\tif $LTCC $LTCFLAGS -o conftest conftest.c $i; then\n\t\t  ldd_output=`ldd conftest`\n\t\t  if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\t    case \" $predeps $postdeps \" in\n\t\t    *\" $i \"*)\n\t\t      func_append newdeplibs \" $i\"\n\t\t      i=\"\"\n\t\t      ;;\n\t\t    esac\n\t\t  fi\n\t\t  if test -n \"$i\" ; then\n\t\t    libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\t    deplib_matches=`eval \"\\\\$ECHO \\\"$library_names_spec\\\"\"`\n\t\t    set dummy $deplib_matches; shift\n\t\t    deplib_match=$1\n\t\t    if test `expr \"$ldd_output\" : \".*$deplib_match\"` -ne 0 ; then\n\t\t      func_append newdeplibs \" $i\"\n\t\t    else\n\t\t      droppeddeps=yes\n\t\t      echo\n\t\t      $ECHO \"*** Warning: dynamic linker does not accept needed library $i.\"\n\t\t      echo \"*** I have the capability to make that library automatically link in when\"\n\t\t      echo \"*** you link to this library.  But I can only do this if you have a\"\n\t\t      echo \"*** shared version of the library, which you do not appear to have\"\n\t\t      echo \"*** because a test_compile did reveal that the linker did not use this one\"\n\t\t      echo \"*** as a dynamic dependency that programs can get resolved with at runtime.\"\n\t\t    fi\n\t\t  fi\n\t\telse\n\t\t  droppeddeps=yes\n\t\t  echo\n\t\t  $ECHO \"*** Warning!  Library $i is needed by this library but I was not able to\"\n\t\t  echo \"*** make it link in!  You will probably need to install it or some\"\n\t\t  echo \"*** library that it depends on before this library will be fully\"\n\t\t  echo \"*** functional.  Installing it before continuing would be even better.\"\n\t\tfi\n\t\t;;\n\t      *)\n\t\tfunc_append newdeplibs \" $i\"\n\t\t;;\n\t      esac\n\t    done\n\t  fi\n\t  ;;\n\tfile_magic*)\n\t  set dummy $deplibs_check_method; shift\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t  for a_deplib in $deplibs; do\n\t    case $a_deplib in\n\t    -l*)\n\t      func_stripname -l '' \"$a_deplib\"\n\t      name=$func_stripname_result\n\t      if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\tcase \" $predeps $postdeps \" in\n\t\t*\" $a_deplib \"*)\n\t\t  func_append newdeplibs \" $a_deplib\"\n\t\t  a_deplib=\"\"\n\t\t  ;;\n\t\tesac\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tlibname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\tif test -n \"$file_magic_glob\"; then\n\t\t  libnameglob=`func_echo_all \"$libname\" | $SED -e $file_magic_glob`\n\t\telse\n\t\t  libnameglob=$libname\n\t\tfi\n\t\ttest \"$want_nocaseglob\" = yes && nocaseglob=`shopt -p nocaseglob`\n\t\tfor i in $lib_search_path $sys_lib_search_path $shlib_search_path; do\n\t\t  if test \"$want_nocaseglob\" = yes; then\n\t\t    shopt -s nocaseglob\n\t\t    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`\n\t\t    $nocaseglob\n\t\t  else\n\t\t    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`\n\t\t  fi\n\t\t  for potent_lib in $potential_libs; do\n\t\t      # Follow soft links.\n\t\t      if ls -lLd \"$potent_lib\" 2>/dev/null |\n\t\t\t $GREP \" -> \" >/dev/null; then\n\t\t\tcontinue\n\t\t      fi\n\t\t      # The statement above tries to avoid entering an\n\t\t      # endless loop below, in case of cyclic links.\n\t\t      # We might still enter an endless loop, since a link\n\t\t      # loop can be closed while we follow links,\n\t\t      # but so what?\n\t\t      potlib=\"$potent_lib\"\n\t\t      while test -h \"$potlib\" 2>/dev/null; do\n\t\t\tpotliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`\n\t\t\tcase $potliblink in\n\t\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) potlib=\"$potliblink\";;\n\t\t\t*) potlib=`$ECHO \"$potlib\" | $SED 's,[^/]*$,,'`\"$potliblink\";;\n\t\t\tesac\n\t\t      done\n\t\t      if eval $file_magic_cmd \\\"\\$potlib\\\" 2>/dev/null |\n\t\t\t $SED -e 10q |\n\t\t\t $EGREP \"$file_magic_regex\" > /dev/null; then\n\t\t\tfunc_append newdeplibs \" $a_deplib\"\n\t\t\ta_deplib=\"\"\n\t\t\tbreak 2\n\t\t      fi\n\t\t  done\n\t\tdone\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tdroppeddeps=yes\n\t\techo\n\t\t$ECHO \"*** Warning: linker path does not have real file for library $a_deplib.\"\n\t\techo \"*** I have the capability to make that library automatically link in when\"\n\t\techo \"*** you link to this library.  But I can only do this if you have a\"\n\t\techo \"*** shared version of the library, which you do not appear to have\"\n\t\techo \"*** because I did check the linker path looking for a file starting\"\n\t\tif test -z \"$potlib\" ; then\n\t\t  $ECHO \"*** with $libname but no candidates were found. (...for file magic test)\"\n\t\telse\n\t\t  $ECHO \"*** with $libname and none of the candidates passed a file format test\"\n\t\t  $ECHO \"*** using a file magic. Last file checked: $potlib\"\n\t\tfi\n\t      fi\n\t      ;;\n\t    *)\n\t      # Add a -L argument.\n\t      func_append newdeplibs \" $a_deplib\"\n\t      ;;\n\t    esac\n\t  done # Gone through all deplibs.\n\t  ;;\n\tmatch_pattern*)\n\t  set dummy $deplibs_check_method; shift\n\t  match_pattern_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t  for a_deplib in $deplibs; do\n\t    case $a_deplib in\n\t    -l*)\n\t      func_stripname -l '' \"$a_deplib\"\n\t      name=$func_stripname_result\n\t      if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\tcase \" $predeps $postdeps \" in\n\t\t*\" $a_deplib \"*)\n\t\t  func_append newdeplibs \" $a_deplib\"\n\t\t  a_deplib=\"\"\n\t\t  ;;\n\t\tesac\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tlibname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\tfor i in $lib_search_path $sys_lib_search_path $shlib_search_path; do\n\t\t  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`\n\t\t  for potent_lib in $potential_libs; do\n\t\t    potlib=\"$potent_lib\" # see symlink-check above in file_magic test\n\t\t    if eval \"\\$ECHO \\\"$potent_lib\\\"\" 2>/dev/null | $SED 10q | \\\n\t\t       $EGREP \"$match_pattern_regex\" > /dev/null; then\n\t\t      func_append newdeplibs \" $a_deplib\"\n\t\t      a_deplib=\"\"\n\t\t      break 2\n\t\t    fi\n\t\t  done\n\t\tdone\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tdroppeddeps=yes\n\t\techo\n\t\t$ECHO \"*** Warning: linker path does not have real file for library $a_deplib.\"\n\t\techo \"*** I have the capability to make that library automatically link in when\"\n\t\techo \"*** you link to this library.  But I can only do this if you have a\"\n\t\techo \"*** shared version of the library, which you do not appear to have\"\n\t\techo \"*** because I did check the linker path looking for a file starting\"\n\t\tif test -z \"$potlib\" ; then\n\t\t  $ECHO \"*** with $libname but no candidates were found. (...for regex pattern test)\"\n\t\telse\n\t\t  $ECHO \"*** with $libname and none of the candidates passed a file format test\"\n\t\t  $ECHO \"*** using a regex pattern. Last file checked: $potlib\"\n\t\tfi\n\t      fi\n\t      ;;\n\t    *)\n\t      # Add a -L argument.\n\t      func_append newdeplibs \" $a_deplib\"\n\t      ;;\n\t    esac\n\t  done # Gone through all deplibs.\n\t  ;;\n\tnone | unknown | *)\n\t  newdeplibs=\"\"\n\t  tmp_deplibs=`$ECHO \" $deplibs\" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`\n\t  if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t    for i in $predeps $postdeps ; do\n\t      # can't use Xsed below, because $i might contain '/'\n\t      tmp_deplibs=`$ECHO \" $tmp_deplibs\" | $SED \"s,$i,,\"`\n\t    done\n\t  fi\n\t  case $tmp_deplibs in\n\t  *[!\\\t\\ ]*)\n\t    echo\n\t    if test \"X$deplibs_check_method\" = \"Xnone\"; then\n\t      echo \"*** Warning: inter-library dependencies are not supported in this platform.\"\n\t    else\n\t      echo \"*** Warning: inter-library dependencies are not known to be supported.\"\n\t    fi\n\t    echo \"*** All declared inter-library dependencies are being dropped.\"\n\t    droppeddeps=yes\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tversuffix=$versuffix_save\n\tmajor=$major_save\n\trelease=$release_save\n\tlibname=$libname_save\n\tname=$name_save\n\n\tcase $host in\n\t*-*-rhapsody* | *-*-darwin1.[012])\n\t  # On Rhapsody replace the C library with the System framework\n\t  newdeplibs=`$ECHO \" $newdeplibs\" | $SED 's/ -lc / System.ltframework /'`\n\t  ;;\n\tesac\n\n\tif test \"$droppeddeps\" = yes; then\n\t  if test \"$module\" = yes; then\n\t    echo\n\t    echo \"*** Warning: libtool could not satisfy all declared inter-library\"\n\t    $ECHO \"*** dependencies of module $libname.  Therefore, libtool will create\"\n\t    echo \"*** a static module, that should work as long as the dlopening\"\n\t    echo \"*** application is linked with the -dlopen flag.\"\n\t    if test -z \"$global_symbol_pipe\"; then\n\t      echo\n\t      echo \"*** However, this would only work if libtool was able to extract symbol\"\n\t      echo \"*** lists from a program, using \\`nm' or equivalent, but libtool could\"\n\t      echo \"*** not find such a program.  So, this module is probably useless.\"\n\t      echo \"*** \\`nm' from GNU binutils and a full rebuild may help.\"\n\t    fi\n\t    if test \"$build_old_libs\" = no; then\n\t      oldlibs=\"$output_objdir/$libname.$libext\"\n\t      build_libtool_libs=module\n\t      build_old_libs=yes\n\t    else\n\t      build_libtool_libs=no\n\t    fi\n\t  else\n\t    echo \"*** The inter-library dependencies that have been dropped here will be\"\n\t    echo \"*** automatically added whenever a program is linked with this library\"\n\t    echo \"*** or is declared to -dlopen it.\"\n\n\t    if test \"$allow_undefined\" = no; then\n\t      echo\n\t      echo \"*** Since this library must not contain undefined symbols,\"\n\t      echo \"*** because either the platform does not support them or\"\n\t      echo \"*** it was explicitly requested with -no-undefined,\"\n\t      echo \"*** libtool will only create a static version of it.\"\n\t      if test \"$build_old_libs\" = no; then\n\t\toldlibs=\"$output_objdir/$libname.$libext\"\n\t\tbuild_libtool_libs=module\n\t\tbuild_old_libs=yes\n\t      else\n\t\tbuild_libtool_libs=no\n\t      fi\n\t    fi\n\t  fi\n\tfi\n\t# Done checking deplibs!\n\tdeplibs=$newdeplibs\n      fi\n      # Time to change all our \"foo.ltframework\" stuff back to \"-framework foo\"\n      case $host in\n\t*-*-darwin*)\n\t  newdeplibs=`$ECHO \" $newdeplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  new_inherited_linker_flags=`$ECHO \" $new_inherited_linker_flags\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  deplibs=`$ECHO \" $deplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  ;;\n      esac\n\n      # move library search paths that coincide with paths to not yet\n      # installed libraries to the beginning of the library search list\n      new_libs=\n      for path in $notinst_path; do\n\tcase \" $new_libs \" in\n\t*\" -L$path/$objdir \"*) ;;\n\t*)\n\t  case \" $deplibs \" in\n\t  *\" -L$path/$objdir \"*)\n\t    func_append new_libs \" -L$path/$objdir\" ;;\n\t  esac\n\t  ;;\n\tesac\n      done\n      for deplib in $deplibs; do\n\tcase $deplib in\n\t-L*)\n\t  case \" $new_libs \" in\n\t  *\" $deplib \"*) ;;\n\t  *) func_append new_libs \" $deplib\" ;;\n\t  esac\n\t  ;;\n\t*) func_append new_libs \" $deplib\" ;;\n\tesac\n      done\n      deplibs=\"$new_libs\"\n\n      # All the library-specific variables (install_libdir is set above).\n      library_names=\n      old_library=\n      dlname=\n\n      # Test again, we may have decided not to build it any more\n      if test \"$build_libtool_libs\" = yes; then\n\t# Remove ${wl} instances when linking with ld.\n\t# FIXME: should test the right _cmds variable.\n\tcase $archive_cmds in\n\t  *\\$LD\\ *) wl= ;;\n        esac\n\tif test \"$hardcode_into_libs\" = yes; then\n\t  # Hardcode the library paths\n\t  hardcode_libdirs=\n\t  dep_rpath=\n\t  rpath=\"$finalize_rpath\"\n\t  test \"$opt_mode\" != relink && rpath=\"$compile_rpath$rpath\"\n\t  for libdir in $rpath; do\n\t    if test -n \"$hardcode_libdir_flag_spec\"; then\n\t      if test -n \"$hardcode_libdir_separator\"; then\n\t\tfunc_replace_sysroot \"$libdir\"\n\t\tlibdir=$func_replace_sysroot_result\n\t\tif test -z \"$hardcode_libdirs\"; then\n\t\t  hardcode_libdirs=\"$libdir\"\n\t\telse\n\t\t  # Just accumulate the unique libdirs.\n\t\t  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t\t  *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t    ;;\n\t\t  *)\n\t\t    func_append hardcode_libdirs \"$hardcode_libdir_separator$libdir\"\n\t\t    ;;\n\t\t  esac\n\t\tfi\n\t      else\n\t\teval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t\tfunc_append dep_rpath \" $flag\"\n\t      fi\n\t    elif test -n \"$runpath_var\"; then\n\t      case \"$perm_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) func_append perm_rpath \" $libdir\" ;;\n\t      esac\n\t    fi\n\t  done\n\t  # Substitute the hardcoded libdirs into the rpath.\n\t  if test -n \"$hardcode_libdir_separator\" &&\n\t     test -n \"$hardcode_libdirs\"; then\n\t    libdir=\"$hardcode_libdirs\"\n\t    eval \"dep_rpath=\\\"$hardcode_libdir_flag_spec\\\"\"\n\t  fi\n\t  if test -n \"$runpath_var\" && test -n \"$perm_rpath\"; then\n\t    # We should set the runpath_var.\n\t    rpath=\n\t    for dir in $perm_rpath; do\n\t      func_append rpath \"$dir:\"\n\t    done\n\t    eval \"$runpath_var='$rpath\\$$runpath_var'; export $runpath_var\"\n\t  fi\n\t  test -n \"$dep_rpath\" && deplibs=\"$dep_rpath $deplibs\"\n\tfi\n\n\tshlibpath=\"$finalize_shlibpath\"\n\ttest \"$opt_mode\" != relink && shlibpath=\"$compile_shlibpath$shlibpath\"\n\tif test -n \"$shlibpath\"; then\n\t  eval \"$shlibpath_var='$shlibpath\\$$shlibpath_var'; export $shlibpath_var\"\n\tfi\n\n\t# Get the real and link names of the library.\n\teval shared_ext=\\\"$shrext_cmds\\\"\n\teval library_names=\\\"$library_names_spec\\\"\n\tset dummy $library_names\n\tshift\n\trealname=\"$1\"\n\tshift\n\n\tif test -n \"$soname_spec\"; then\n\t  eval soname=\\\"$soname_spec\\\"\n\telse\n\t  soname=\"$realname\"\n\tfi\n\tif test -z \"$dlname\"; then\n\t  dlname=$soname\n\tfi\n\n\tlib=\"$output_objdir/$realname\"\n\tlinknames=\n\tfor link\n\tdo\n\t  func_append linknames \" $link\"\n\tdone\n\n\t# Use standard objects if they are pic\n\ttest -z \"$pic_flag\" && libobjs=`$ECHO \"$libobjs\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n\ttest \"X$libobjs\" = \"X \" && libobjs=\n\n\tdelfiles=\n\tif test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t  $opt_dry_run || cp \"$export_symbols\" \"$output_objdir/$libname.uexp\"\n\t  export_symbols=\"$output_objdir/$libname.uexp\"\n\t  func_append delfiles \" $export_symbols\"\n\tfi\n\n\torig_export_symbols=\n\tcase $host_os in\n\tcygwin* | mingw* | cegcc*)\n\t  if test -n \"$export_symbols\" && test -z \"$export_symbols_regex\"; then\n\t    # exporting using user supplied symfile\n\t    if test \"x`$SED 1q $export_symbols`\" != xEXPORTS; then\n\t      # and it's NOT already a .def file. Must figure out\n\t      # which of the given symbols are data symbols and tag\n\t      # them as such. So, trigger use of export_symbols_cmds.\n\t      # export_symbols gets reassigned inside the \"prepare\n\t      # the list of exported symbols\" if statement, so the\n\t      # include_expsyms logic still works.\n\t      orig_export_symbols=\"$export_symbols\"\n\t      export_symbols=\n\t      always_export_symbols=yes\n\t    fi\n\t  fi\n\t  ;;\n\tesac\n\n\t# Prepare the list of exported symbols\n\tif test -z \"$export_symbols\"; then\n\t  if test \"$always_export_symbols\" = yes || test -n \"$export_symbols_regex\"; then\n\t    func_verbose \"generating symbol list for \\`$libname.la'\"\n\t    export_symbols=\"$output_objdir/$libname.exp\"\n\t    $opt_dry_run || $RM $export_symbols\n\t    cmds=$export_symbols_cmds\n\t    save_ifs=\"$IFS\"; IFS='~'\n\t    for cmd1 in $cmds; do\n\t      IFS=\"$save_ifs\"\n\t      # Take the normal branch if the nm_file_list_spec branch\n\t      # doesn't work or if tool conversion is not needed.\n\t      case $nm_file_list_spec~$to_tool_file_cmd in\n\t\t*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)\n\t\t  try_normal_branch=yes\n\t\t  eval cmd=\\\"$cmd1\\\"\n\t\t  func_len \" $cmd\"\n\t\t  len=$func_len_result\n\t\t  ;;\n\t\t*)\n\t\t  try_normal_branch=no\n\t\t  ;;\n\t      esac\n\t      if test \"$try_normal_branch\" = yes \\\n\t\t && { test \"$len\" -lt \"$max_cmd_len\" \\\n\t\t      || test \"$max_cmd_len\" -le -1; }\n\t      then\n\t\tfunc_show_eval \"$cmd\" 'exit $?'\n\t\tskipped_export=false\n\t      elif test -n \"$nm_file_list_spec\"; then\n\t\tfunc_basename \"$output\"\n\t\toutput_la=$func_basename_result\n\t\tsave_libobjs=$libobjs\n\t\tsave_output=$output\n\t\toutput=${output_objdir}/${output_la}.nm\n\t\tfunc_to_tool_file \"$output\"\n\t\tlibobjs=$nm_file_list_spec$func_to_tool_file_result\n\t\tfunc_append delfiles \" $output\"\n\t\tfunc_verbose \"creating $NM input file list: $output\"\n\t\tfor obj in $save_libobjs; do\n\t\t  func_to_tool_file \"$obj\"\n\t\t  $ECHO \"$func_to_tool_file_result\"\n\t\tdone > \"$output\"\n\t\teval cmd=\\\"$cmd1\\\"\n\t\tfunc_show_eval \"$cmd\" 'exit $?'\n\t\toutput=$save_output\n\t\tlibobjs=$save_libobjs\n\t\tskipped_export=false\n\t      else\n\t\t# The command line is too long to execute in one step.\n\t\tfunc_verbose \"using reloadable object file for export list...\"\n\t\tskipped_export=:\n\t\t# Break out early, otherwise skipped_export may be\n\t\t# set to false by a later but shorter cmd.\n\t\tbreak\n\t      fi\n\t    done\n\t    IFS=\"$save_ifs\"\n\t    if test -n \"$export_symbols_regex\" && test \"X$skipped_export\" != \"X:\"; then\n\t      func_show_eval '$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"'\n\t      func_show_eval '$MV \"${export_symbols}T\" \"$export_symbols\"'\n\t    fi\n\t  fi\n\tfi\n\n\tif test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t  tmp_export_symbols=\"$export_symbols\"\n\t  test -n \"$orig_export_symbols\" && tmp_export_symbols=\"$orig_export_symbols\"\n\t  $opt_dry_run || eval '$ECHO \"$include_expsyms\" | $SP2NL >> \"$tmp_export_symbols\"'\n\tfi\n\n\tif test \"X$skipped_export\" != \"X:\" && test -n \"$orig_export_symbols\"; then\n\t  # The given exports_symbols file has to be filtered, so filter it.\n\t  func_verbose \"filter symbol list for \\`$libname.la' to tag DATA exports\"\n\t  # FIXME: $output_objdir/$libname.filter potentially contains lots of\n\t  # 's' commands which not all seds can handle. GNU sed should be fine\n\t  # though. Also, the filter scales superlinearly with the number of\n\t  # global variables. join(1) would be nice here, but unfortunately\n\t  # isn't a blessed tool.\n\t  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\\(.*\\)\\([ \\,].*\\),s|^\\1$|\\1\\2|,' < $export_symbols > $output_objdir/$libname.filter\n\t  func_append delfiles \" $export_symbols $output_objdir/$libname.filter\"\n\t  export_symbols=$output_objdir/$libname.def\n\t  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols\n\tfi\n\n\ttmp_deplibs=\n\tfor test_deplib in $deplibs; do\n\t  case \" $convenience \" in\n\t  *\" $test_deplib \"*) ;;\n\t  *)\n\t    func_append tmp_deplibs \" $test_deplib\"\n\t    ;;\n\t  esac\n\tdone\n\tdeplibs=\"$tmp_deplibs\"\n\n\tif test -n \"$convenience\"; then\n\t  if test -n \"$whole_archive_flag_spec\" &&\n\t    test \"$compiler_needs_object\" = yes &&\n\t    test -z \"$libobjs\"; then\n\t    # extract the archives, so we have objects to list.\n\t    # TODO: could optimize this to just extract one archive.\n\t    whole_archive_flag_spec=\n\t  fi\n\t  if test -n \"$whole_archive_flag_spec\"; then\n\t    save_libobjs=$libobjs\n\t    eval libobjs=\\\"\\$libobjs $whole_archive_flag_spec\\\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  else\n\t    gentop=\"$output_objdir/${outputname}x\"\n\t    func_append generated \" $gentop\"\n\n\t    func_extract_archives $gentop $convenience\n\t    func_append libobjs \" $func_extract_archives_result\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  fi\n\tfi\n\n\tif test \"$thread_safe\" = yes && test -n \"$thread_safe_flag_spec\"; then\n\t  eval flag=\\\"$thread_safe_flag_spec\\\"\n\t  func_append linker_flags \" $flag\"\n\tfi\n\n\t# Make a backup of the uninstalled library when relinking\n\tif test \"$opt_mode\" = relink; then\n\t  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?\n\tfi\n\n\t# Do each of the archive commands.\n\tif test \"$module\" = yes && test -n \"$module_cmds\" ; then\n\t  if test -n \"$export_symbols\" && test -n \"$module_expsym_cmds\"; then\n\t    eval test_cmds=\\\"$module_expsym_cmds\\\"\n\t    cmds=$module_expsym_cmds\n\t  else\n\t    eval test_cmds=\\\"$module_cmds\\\"\n\t    cmds=$module_cmds\n\t  fi\n\telse\n\t  if test -n \"$export_symbols\" && test -n \"$archive_expsym_cmds\"; then\n\t    eval test_cmds=\\\"$archive_expsym_cmds\\\"\n\t    cmds=$archive_expsym_cmds\n\t  else\n\t    eval test_cmds=\\\"$archive_cmds\\\"\n\t    cmds=$archive_cmds\n\t  fi\n\tfi\n\n\tif test \"X$skipped_export\" != \"X:\" &&\n\t   func_len \" $test_cmds\" &&\n\t   len=$func_len_result &&\n\t   test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t  :\n\telse\n\t  # The command line is too long to link in one step, link piecewise\n\t  # or, if using GNU ld and skipped_export is not :, use a linker\n\t  # script.\n\n\t  # Save the value of $output and $libobjs because we want to\n\t  # use them later.  If we have whole_archive_flag_spec, we\n\t  # want to use save_libobjs as it was before\n\t  # whole_archive_flag_spec was expanded, because we can't\n\t  # assume the linker understands whole_archive_flag_spec.\n\t  # This may have to be revisited, in case too many\n\t  # convenience libraries get linked in and end up exceeding\n\t  # the spec.\n\t  if test -z \"$convenience\" || test -z \"$whole_archive_flag_spec\"; then\n\t    save_libobjs=$libobjs\n\t  fi\n\t  save_output=$output\n\t  func_basename \"$output\"\n\t  output_la=$func_basename_result\n\n\t  # Clear the reloadable object creation command queue and\n\t  # initialize k to one.\n\t  test_cmds=\n\t  concat_cmds=\n\t  objlist=\n\t  last_robj=\n\t  k=1\n\n\t  if test -n \"$save_libobjs\" && test \"X$skipped_export\" != \"X:\" && test \"$with_gnu_ld\" = yes; then\n\t    output=${output_objdir}/${output_la}.lnkscript\n\t    func_verbose \"creating GNU ld script: $output\"\n\t    echo 'INPUT (' > $output\n\t    for obj in $save_libobjs\n\t    do\n\t      func_to_tool_file \"$obj\"\n\t      $ECHO \"$func_to_tool_file_result\" >> $output\n\t    done\n\t    echo ')' >> $output\n\t    func_append delfiles \" $output\"\n\t    func_to_tool_file \"$output\"\n\t    output=$func_to_tool_file_result\n\t  elif test -n \"$save_libobjs\" && test \"X$skipped_export\" != \"X:\" && test \"X$file_list_spec\" != X; then\n\t    output=${output_objdir}/${output_la}.lnk\n\t    func_verbose \"creating linker input file list: $output\"\n\t    : > $output\n\t    set x $save_libobjs\n\t    shift\n\t    firstobj=\n\t    if test \"$compiler_needs_object\" = yes; then\n\t      firstobj=\"$1 \"\n\t      shift\n\t    fi\n\t    for obj\n\t    do\n\t      func_to_tool_file \"$obj\"\n\t      $ECHO \"$func_to_tool_file_result\" >> $output\n\t    done\n\t    func_append delfiles \" $output\"\n\t    func_to_tool_file \"$output\"\n\t    output=$firstobj\\\"$file_list_spec$func_to_tool_file_result\\\"\n\t  else\n\t    if test -n \"$save_libobjs\"; then\n\t      func_verbose \"creating reloadable object files...\"\n\t      output=$output_objdir/$output_la-${k}.$objext\n\t      eval test_cmds=\\\"$reload_cmds\\\"\n\t      func_len \" $test_cmds\"\n\t      len0=$func_len_result\n\t      len=$len0\n\n\t      # Loop over the list of objects to be linked.\n\t      for obj in $save_libobjs\n\t      do\n\t\tfunc_len \" $obj\"\n\t\tfunc_arith $len + $func_len_result\n\t\tlen=$func_arith_result\n\t\tif test \"X$objlist\" = X ||\n\t\t   test \"$len\" -lt \"$max_cmd_len\"; then\n\t\t  func_append objlist \" $obj\"\n\t\telse\n\t\t  # The command $test_cmds is almost too long, add a\n\t\t  # command to the queue.\n\t\t  if test \"$k\" -eq 1 ; then\n\t\t    # The first file doesn't have a previous command to add.\n\t\t    reload_objs=$objlist\n\t\t    eval concat_cmds=\\\"$reload_cmds\\\"\n\t\t  else\n\t\t    # All subsequent reloadable object files will link in\n\t\t    # the last one created.\n\t\t    reload_objs=\"$objlist $last_robj\"\n\t\t    eval concat_cmds=\\\"\\$concat_cmds~$reload_cmds~\\$RM $last_robj\\\"\n\t\t  fi\n\t\t  last_robj=$output_objdir/$output_la-${k}.$objext\n\t\t  func_arith $k + 1\n\t\t  k=$func_arith_result\n\t\t  output=$output_objdir/$output_la-${k}.$objext\n\t\t  objlist=\" $obj\"\n\t\t  func_len \" $last_robj\"\n\t\t  func_arith $len0 + $func_len_result\n\t\t  len=$func_arith_result\n\t\tfi\n\t      done\n\t      # Handle the remaining objects by creating one last\n\t      # reloadable object file.  All subsequent reloadable object\n\t      # files will link in the last one created.\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      reload_objs=\"$objlist $last_robj\"\n\t      eval concat_cmds=\\\"\\${concat_cmds}$reload_cmds\\\"\n\t      if test -n \"$last_robj\"; then\n\t        eval concat_cmds=\\\"\\${concat_cmds}~\\$RM $last_robj\\\"\n\t      fi\n\t      func_append delfiles \" $output\"\n\n\t    else\n\t      output=\n\t    fi\n\n\t    if ${skipped_export-false}; then\n\t      func_verbose \"generating symbol list for \\`$libname.la'\"\n\t      export_symbols=\"$output_objdir/$libname.exp\"\n\t      $opt_dry_run || $RM $export_symbols\n\t      libobjs=$output\n\t      # Append the command to create the export file.\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\$concat_cmds$export_symbols_cmds\\\"\n\t      if test -n \"$last_robj\"; then\n\t\teval concat_cmds=\\\"\\$concat_cmds~\\$RM $last_robj\\\"\n\t      fi\n\t    fi\n\n\t    test -n \"$save_libobjs\" &&\n\t      func_verbose \"creating a temporary reloadable object file: $output\"\n\n\t    # Loop through the commands generated above and execute them.\n\t    save_ifs=\"$IFS\"; IFS='~'\n\t    for cmd in $concat_cmds; do\n\t      IFS=\"$save_ifs\"\n\t      $opt_silent || {\n\t\t  func_quote_for_expand \"$cmd\"\n\t\t  eval \"func_echo $func_quote_for_expand_result\"\n\t      }\n\t      $opt_dry_run || eval \"$cmd\" || {\n\t\tlt_exit=$?\n\n\t\t# Restore the uninstalled library and exit\n\t\tif test \"$opt_mode\" = relink; then\n\t\t  ( cd \"$output_objdir\" && \\\n\t\t    $RM \"${realname}T\" && \\\n\t\t    $MV \"${realname}U\" \"$realname\" )\n\t\tfi\n\n\t\texit $lt_exit\n\t      }\n\t    done\n\t    IFS=\"$save_ifs\"\n\n\t    if test -n \"$export_symbols_regex\" && ${skipped_export-false}; then\n\t      func_show_eval '$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"'\n\t      func_show_eval '$MV \"${export_symbols}T\" \"$export_symbols\"'\n\t    fi\n\t  fi\n\n          if ${skipped_export-false}; then\n\t    if test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t      tmp_export_symbols=\"$export_symbols\"\n\t      test -n \"$orig_export_symbols\" && tmp_export_symbols=\"$orig_export_symbols\"\n\t      $opt_dry_run || eval '$ECHO \"$include_expsyms\" | $SP2NL >> \"$tmp_export_symbols\"'\n\t    fi\n\n\t    if test -n \"$orig_export_symbols\"; then\n\t      # The given exports_symbols file has to be filtered, so filter it.\n\t      func_verbose \"filter symbol list for \\`$libname.la' to tag DATA exports\"\n\t      # FIXME: $output_objdir/$libname.filter potentially contains lots of\n\t      # 's' commands which not all seds can handle. GNU sed should be fine\n\t      # though. Also, the filter scales superlinearly with the number of\n\t      # global variables. join(1) would be nice here, but unfortunately\n\t      # isn't a blessed tool.\n\t      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\\(.*\\)\\([ \\,].*\\),s|^\\1$|\\1\\2|,' < $export_symbols > $output_objdir/$libname.filter\n\t      func_append delfiles \" $export_symbols $output_objdir/$libname.filter\"\n\t      export_symbols=$output_objdir/$libname.def\n\t      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols\n\t    fi\n\t  fi\n\n\t  libobjs=$output\n\t  # Restore the value of output.\n\t  output=$save_output\n\n\t  if test -n \"$convenience\" && test -n \"$whole_archive_flag_spec\"; then\n\t    eval libobjs=\\\"\\$libobjs $whole_archive_flag_spec\\\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  fi\n\t  # Expand the library linking commands again to reset the\n\t  # value of $libobjs for piecewise linking.\n\n\t  # Do each of the archive commands.\n\t  if test \"$module\" = yes && test -n \"$module_cmds\" ; then\n\t    if test -n \"$export_symbols\" && test -n \"$module_expsym_cmds\"; then\n\t      cmds=$module_expsym_cmds\n\t    else\n\t      cmds=$module_cmds\n\t    fi\n\t  else\n\t    if test -n \"$export_symbols\" && test -n \"$archive_expsym_cmds\"; then\n\t      cmds=$archive_expsym_cmds\n\t    else\n\t      cmds=$archive_cmds\n\t    fi\n\t  fi\n\tfi\n\n\tif test -n \"$delfiles\"; then\n\t  # Append the command to remove temporary files to $cmds.\n\t  eval cmds=\\\"\\$cmds~\\$RM $delfiles\\\"\n\tfi\n\n\t# Add any objects from preloaded convenience libraries\n\tif test -n \"$dlprefiles\"; then\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  func_append generated \" $gentop\"\n\n\t  func_extract_archives $gentop $dlprefiles\n\t  func_append libobjs \" $func_extract_archives_result\"\n\t  test \"X$libobjs\" = \"X \" && libobjs=\n\tfi\n\n\tsave_ifs=\"$IFS\"; IFS='~'\n\tfor cmd in $cmds; do\n\t  IFS=\"$save_ifs\"\n\t  eval cmd=\\\"$cmd\\\"\n\t  $opt_silent || {\n\t    func_quote_for_expand \"$cmd\"\n\t    eval \"func_echo $func_quote_for_expand_result\"\n\t  }\n\t  $opt_dry_run || eval \"$cmd\" || {\n\t    lt_exit=$?\n\n\t    # Restore the uninstalled library and exit\n\t    if test \"$opt_mode\" = relink; then\n\t      ( cd \"$output_objdir\" && \\\n\t        $RM \"${realname}T\" && \\\n\t\t$MV \"${realname}U\" \"$realname\" )\n\t    fi\n\n\t    exit $lt_exit\n\t  }\n\tdone\n\tIFS=\"$save_ifs\"\n\n\t# Restore the uninstalled library and exit\n\tif test \"$opt_mode\" = relink; then\n\t  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?\n\n\t  if test -n \"$convenience\"; then\n\t    if test -z \"$whole_archive_flag_spec\"; then\n\t      func_show_eval '${RM}r \"$gentop\"'\n\t    fi\n\t  fi\n\n\t  exit $EXIT_SUCCESS\n\tfi\n\n\t# Create links to the real library.\n\tfor linkname in $linknames; do\n\t  if test \"$realname\" != \"$linkname\"; then\n\t    func_show_eval '(cd \"$output_objdir\" && $RM \"$linkname\" && $LN_S \"$realname\" \"$linkname\")' 'exit $?'\n\t  fi\n\tdone\n\n\t# If -module or -export-dynamic was specified, set the dlname.\n\tif test \"$module\" = yes || test \"$export_dynamic\" = yes; then\n\t  # On all known operating systems, these are identical.\n\t  dlname=\"$soname\"\n\tfi\n      fi\n      ;;\n\n    obj)\n      if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n\tfunc_warning \"\\`-dlopen' is ignored for objects\"\n      fi\n\n      case \" $deplibs\" in\n      *\\ -l* | *\\ -L*)\n\tfunc_warning \"\\`-l' and \\`-L' are ignored for objects\" ;;\n      esac\n\n      test -n \"$rpath\" && \\\n\tfunc_warning \"\\`-rpath' is ignored for objects\"\n\n      test -n \"$xrpath\" && \\\n\tfunc_warning \"\\`-R' is ignored for objects\"\n\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info' is ignored for objects\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for objects\"\n\n      case $output in\n      *.lo)\n\ttest -n \"$objs$old_deplibs\" && \\\n\t  func_fatal_error \"cannot build library object \\`$output' from non-libtool objects\"\n\n\tlibobj=$output\n\tfunc_lo2o \"$libobj\"\n\tobj=$func_lo2o_result\n\t;;\n      *)\n\tlibobj=\n\tobj=\"$output\"\n\t;;\n      esac\n\n      # Delete the old objects.\n      $opt_dry_run || $RM $obj $libobj\n\n      # Objects from convenience libraries.  This assumes\n      # single-version convenience libraries.  Whenever we create\n      # different ones for PIC/non-PIC, this we'll have to duplicate\n      # the extraction.\n      reload_conv_objs=\n      gentop=\n      # reload_cmds runs $LD directly, so let us get rid of\n      # -Wl from whole_archive_flag_spec and hope we can get by with\n      # turning comma into space..\n      wl=\n\n      if test -n \"$convenience\"; then\n\tif test -n \"$whole_archive_flag_spec\"; then\n\t  eval tmp_whole_archive_flags=\\\"$whole_archive_flag_spec\\\"\n\t  reload_conv_objs=$reload_objs\\ `$ECHO \"$tmp_whole_archive_flags\" | $SED 's|,| |g'`\n\telse\n\t  gentop=\"$output_objdir/${obj}x\"\n\t  func_append generated \" $gentop\"\n\n\t  func_extract_archives $gentop $convenience\n\t  reload_conv_objs=\"$reload_objs $func_extract_archives_result\"\n\tfi\n      fi\n\n      # If we're not building shared, we need to use non_pic_objs\n      test \"$build_libtool_libs\" != yes && libobjs=\"$non_pic_objects\"\n\n      # Create the old-style object.\n      reload_objs=\"$objs$old_deplibs \"`$ECHO \"$libobjs\" | $SP2NL | $SED \"/\\.${libext}$/d; /\\.lib$/d; $lo2o\" | $NL2SP`\" $reload_conv_objs\" ### testsuite: skip nested quoting test\n\n      output=\"$obj\"\n      func_execute_cmds \"$reload_cmds\" 'exit $?'\n\n      # Exit if we aren't doing a library object file.\n      if test -z \"$libobj\"; then\n\tif test -n \"$gentop\"; then\n\t  func_show_eval '${RM}r \"$gentop\"'\n\tfi\n\n\texit $EXIT_SUCCESS\n      fi\n\n      if test \"$build_libtool_libs\" != yes; then\n\tif test -n \"$gentop\"; then\n\t  func_show_eval '${RM}r \"$gentop\"'\n\tfi\n\n\t# Create an invalid libtool object if no PIC, so that we don't\n\t# accidentally link it into a program.\n\t# $show \"echo timestamp > $libobj\"\n\t# $opt_dry_run || eval \"echo timestamp > $libobj\" || exit $?\n\texit $EXIT_SUCCESS\n      fi\n\n      if test -n \"$pic_flag\" || test \"$pic_mode\" != default; then\n\t# Only do commands if we really have different PIC objects.\n\treload_objs=\"$libobjs $reload_conv_objs\"\n\toutput=\"$libobj\"\n\tfunc_execute_cmds \"$reload_cmds\" 'exit $?'\n      fi\n\n      if test -n \"$gentop\"; then\n\tfunc_show_eval '${RM}r \"$gentop\"'\n      fi\n\n      exit $EXIT_SUCCESS\n      ;;\n\n    prog)\n      case $host in\n\t*cygwin*) func_stripname '' '.exe' \"$output\"\n\t          output=$func_stripname_result.exe;;\n      esac\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info' is ignored for programs\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for programs\"\n\n      test \"$preload\" = yes \\\n        && test \"$dlopen_support\" = unknown \\\n\t&& test \"$dlopen_self\" = unknown \\\n\t&& test \"$dlopen_self_static\" = unknown && \\\n\t  func_warning \"\\`LT_INIT([dlopen])' not used. Assuming no dlopen support.\"\n\n      case $host in\n      *-*-rhapsody* | *-*-darwin1.[012])\n\t# On Rhapsody replace the C library is the System framework\n\tcompile_deplibs=`$ECHO \" $compile_deplibs\" | $SED 's/ -lc / System.ltframework /'`\n\tfinalize_deplibs=`$ECHO \" $finalize_deplibs\" | $SED 's/ -lc / System.ltframework /'`\n\t;;\n      esac\n\n      case $host in\n      *-*-darwin*)\n\t# Don't allow lazy linking, it breaks C++ global constructors\n\t# But is supposedly fixed on 10.4 or later (yay!).\n\tif test \"$tagname\" = CXX ; then\n\t  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in\n\t    10.[0123])\n\t      func_append compile_command \" ${wl}-bind_at_load\"\n\t      func_append finalize_command \" ${wl}-bind_at_load\"\n\t    ;;\n\t  esac\n\tfi\n\t# Time to change all our \"foo.ltframework\" stuff back to \"-framework foo\"\n\tcompile_deplibs=`$ECHO \" $compile_deplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tfinalize_deplibs=`$ECHO \" $finalize_deplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t;;\n      esac\n\n\n      # move library search paths that coincide with paths to not yet\n      # installed libraries to the beginning of the library search list\n      new_libs=\n      for path in $notinst_path; do\n\tcase \" $new_libs \" in\n\t*\" -L$path/$objdir \"*) ;;\n\t*)\n\t  case \" $compile_deplibs \" in\n\t  *\" -L$path/$objdir \"*)\n\t    func_append new_libs \" -L$path/$objdir\" ;;\n\t  esac\n\t  ;;\n\tesac\n      done\n      for deplib in $compile_deplibs; do\n\tcase $deplib in\n\t-L*)\n\t  case \" $new_libs \" in\n\t  *\" $deplib \"*) ;;\n\t  *) func_append new_libs \" $deplib\" ;;\n\t  esac\n\t  ;;\n\t*) func_append new_libs \" $deplib\" ;;\n\tesac\n      done\n      compile_deplibs=\"$new_libs\"\n\n\n      func_append compile_command \" $compile_deplibs\"\n      func_append finalize_command \" $finalize_deplibs\"\n\n      if test -n \"$rpath$xrpath\"; then\n\t# If the user specified any rpath flags, then add them.\n\tfor libdir in $rpath $xrpath; do\n\t  # This is the magic to use -rpath.\n\t  case \"$finalize_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append finalize_rpath \" $libdir\" ;;\n\t  esac\n\tdone\n      fi\n\n      # Now hardcode the library paths\n      rpath=\n      hardcode_libdirs=\n      for libdir in $compile_rpath $finalize_rpath; do\n\tif test -n \"$hardcode_libdir_flag_spec\"; then\n\t  if test -n \"$hardcode_libdir_separator\"; then\n\t    if test -z \"$hardcode_libdirs\"; then\n\t      hardcode_libdirs=\"$libdir\"\n\t    else\n\t      # Just accumulate the unique libdirs.\n\t      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t      *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t;;\n\t      *)\n\t\tfunc_append hardcode_libdirs \"$hardcode_libdir_separator$libdir\"\n\t\t;;\n\t      esac\n\t    fi\n\t  else\n\t    eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t    func_append rpath \" $flag\"\n\t  fi\n\telif test -n \"$runpath_var\"; then\n\t  case \"$perm_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append perm_rpath \" $libdir\" ;;\n\t  esac\n\tfi\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n\t  testbindir=`${ECHO} \"$libdir\" | ${SED} -e 's*/lib$*/bin*'`\n\t  case :$dllsearchpath: in\n\t  *\":$libdir:\"*) ;;\n\t  ::) dllsearchpath=$libdir;;\n\t  *) func_append dllsearchpath \":$libdir\";;\n\t  esac\n\t  case :$dllsearchpath: in\n\t  *\":$testbindir:\"*) ;;\n\t  ::) dllsearchpath=$testbindir;;\n\t  *) func_append dllsearchpath \":$testbindir\";;\n\t  esac\n\t  ;;\n\tesac\n      done\n      # Substitute the hardcoded libdirs into the rpath.\n      if test -n \"$hardcode_libdir_separator\" &&\n\t test -n \"$hardcode_libdirs\"; then\n\tlibdir=\"$hardcode_libdirs\"\n\teval rpath=\\\" $hardcode_libdir_flag_spec\\\"\n      fi\n      compile_rpath=\"$rpath\"\n\n      rpath=\n      hardcode_libdirs=\n      for libdir in $finalize_rpath; do\n\tif test -n \"$hardcode_libdir_flag_spec\"; then\n\t  if test -n \"$hardcode_libdir_separator\"; then\n\t    if test -z \"$hardcode_libdirs\"; then\n\t      hardcode_libdirs=\"$libdir\"\n\t    else\n\t      # Just accumulate the unique libdirs.\n\t      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t      *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t;;\n\t      *)\n\t\tfunc_append hardcode_libdirs \"$hardcode_libdir_separator$libdir\"\n\t\t;;\n\t      esac\n\t    fi\n\t  else\n\t    eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t    func_append rpath \" $flag\"\n\t  fi\n\telif test -n \"$runpath_var\"; then\n\t  case \"$finalize_perm_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append finalize_perm_rpath \" $libdir\" ;;\n\t  esac\n\tfi\n      done\n      # Substitute the hardcoded libdirs into the rpath.\n      if test -n \"$hardcode_libdir_separator\" &&\n\t test -n \"$hardcode_libdirs\"; then\n\tlibdir=\"$hardcode_libdirs\"\n\teval rpath=\\\" $hardcode_libdir_flag_spec\\\"\n      fi\n      finalize_rpath=\"$rpath\"\n\n      if test -n \"$libobjs\" && test \"$build_old_libs\" = yes; then\n\t# Transform all the library objects into standard objects.\n\tcompile_command=`$ECHO \"$compile_command\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n\tfinalize_command=`$ECHO \"$finalize_command\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n      fi\n\n      func_generate_dlsyms \"$outputname\" \"@PROGRAM@\" \"no\"\n\n      # template prelinking step\n      if test -n \"$prelink_cmds\"; then\n\tfunc_execute_cmds \"$prelink_cmds\" 'exit $?'\n      fi\n\n      wrappers_required=yes\n      case $host in\n      *cegcc* | *mingw32ce*)\n        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.\n        wrappers_required=no\n        ;;\n      *cygwin* | *mingw* )\n        if test \"$build_libtool_libs\" != yes; then\n          wrappers_required=no\n        fi\n        ;;\n      *)\n        if test \"$need_relink\" = no || test \"$build_libtool_libs\" != yes; then\n          wrappers_required=no\n        fi\n        ;;\n      esac\n      if test \"$wrappers_required\" = no; then\n\t# Replace the output file specification.\n\tcompile_command=`$ECHO \"$compile_command\" | $SED 's%@OUTPUT@%'\"$output\"'%g'`\n\tlink_command=\"$compile_command$compile_rpath\"\n\n\t# We have no uninstalled library dependencies, so finalize right now.\n\texit_status=0\n\tfunc_show_eval \"$link_command\" 'exit_status=$?'\n\n\tif test -n \"$postlink_cmds\"; then\n\t  func_to_tool_file \"$output\"\n\t  postlink_cmds=`func_echo_all \"$postlink_cmds\" | $SED -e 's%@OUTPUT@%'\"$output\"'%g' -e 's%@TOOL_OUTPUT@%'\"$func_to_tool_file_result\"'%g'`\n\t  func_execute_cmds \"$postlink_cmds\" 'exit $?'\n\tfi\n\n\t# Delete the generated files.\n\tif test -f \"$output_objdir/${outputname}S.${objext}\"; then\n\t  func_show_eval '$RM \"$output_objdir/${outputname}S.${objext}\"'\n\tfi\n\n\texit $exit_status\n      fi\n\n      if test -n \"$compile_shlibpath$finalize_shlibpath\"; then\n\tcompile_command=\"$shlibpath_var=\\\"$compile_shlibpath$finalize_shlibpath\\$$shlibpath_var\\\" $compile_command\"\n      fi\n      if test -n \"$finalize_shlibpath\"; then\n\tfinalize_command=\"$shlibpath_var=\\\"$finalize_shlibpath\\$$shlibpath_var\\\" $finalize_command\"\n      fi\n\n      compile_var=\n      finalize_var=\n      if test -n \"$runpath_var\"; then\n\tif test -n \"$perm_rpath\"; then\n\t  # We should set the runpath_var.\n\t  rpath=\n\t  for dir in $perm_rpath; do\n\t    func_append rpath \"$dir:\"\n\t  done\n\t  compile_var=\"$runpath_var=\\\"$rpath\\$$runpath_var\\\" \"\n\tfi\n\tif test -n \"$finalize_perm_rpath\"; then\n\t  # We should set the runpath_var.\n\t  rpath=\n\t  for dir in $finalize_perm_rpath; do\n\t    func_append rpath \"$dir:\"\n\t  done\n\t  finalize_var=\"$runpath_var=\\\"$rpath\\$$runpath_var\\\" \"\n\tfi\n      fi\n\n      if test \"$no_install\" = yes; then\n\t# We don't need to create a wrapper script.\n\tlink_command=\"$compile_var$compile_command$compile_rpath\"\n\t# Replace the output file specification.\n\tlink_command=`$ECHO \"$link_command\" | $SED 's%@OUTPUT@%'\"$output\"'%g'`\n\t# Delete the old output file.\n\t$opt_dry_run || $RM $output\n\t# Link the executable and exit\n\tfunc_show_eval \"$link_command\" 'exit $?'\n\n\tif test -n \"$postlink_cmds\"; then\n\t  func_to_tool_file \"$output\"\n\t  postlink_cmds=`func_echo_all \"$postlink_cmds\" | $SED -e 's%@OUTPUT@%'\"$output\"'%g' -e 's%@TOOL_OUTPUT@%'\"$func_to_tool_file_result\"'%g'`\n\t  func_execute_cmds \"$postlink_cmds\" 'exit $?'\n\tfi\n\n\texit $EXIT_SUCCESS\n      fi\n\n      if test \"$hardcode_action\" = relink; then\n\t# Fast installation is not supported\n\tlink_command=\"$compile_var$compile_command$compile_rpath\"\n\trelink_command=\"$finalize_var$finalize_command$finalize_rpath\"\n\n\tfunc_warning \"this platform does not like uninstalled shared libraries\"\n\tfunc_warning \"\\`$output' will be relinked during installation\"\n      else\n\tif test \"$fast_install\" != no; then\n\t  link_command=\"$finalize_var$compile_command$finalize_rpath\"\n\t  if test \"$fast_install\" = yes; then\n\t    relink_command=`$ECHO \"$compile_var$compile_command$compile_rpath\" | $SED 's%@OUTPUT@%\\$progdir/\\$file%g'`\n\t  else\n\t    # fast_install is set to needless\n\t    relink_command=\n\t  fi\n\telse\n\t  link_command=\"$compile_var$compile_command$compile_rpath\"\n\t  relink_command=\"$finalize_var$finalize_command$finalize_rpath\"\n\tfi\n      fi\n\n      # Replace the output file specification.\n      link_command=`$ECHO \"$link_command\" | $SED 's%@OUTPUT@%'\"$output_objdir/$outputname\"'%g'`\n\n      # Delete the old output files.\n      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname\n\n      func_show_eval \"$link_command\" 'exit $?'\n\n      if test -n \"$postlink_cmds\"; then\n\tfunc_to_tool_file \"$output_objdir/$outputname\"\n\tpostlink_cmds=`func_echo_all \"$postlink_cmds\" | $SED -e 's%@OUTPUT@%'\"$output_objdir/$outputname\"'%g' -e 's%@TOOL_OUTPUT@%'\"$func_to_tool_file_result\"'%g'`\n\tfunc_execute_cmds \"$postlink_cmds\" 'exit $?'\n      fi\n\n      # Now create the wrapper script.\n      func_verbose \"creating $output\"\n\n      # Quote the relink command for shipping.\n      if test -n \"$relink_command\"; then\n\t# Preserve any variables that may affect compiler behavior\n\tfor var in $variables_saved_for_relink; do\n\t  if eval test -z \\\"\\${$var+set}\\\"; then\n\t    relink_command=\"{ test -z \\\"\\${$var+set}\\\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command\"\n\t  elif eval var_value=\\$$var; test -z \"$var_value\"; then\n\t    relink_command=\"$var=; export $var; $relink_command\"\n\t  else\n\t    func_quote_for_eval \"$var_value\"\n\t    relink_command=\"$var=$func_quote_for_eval_result; export $var; $relink_command\"\n\t  fi\n\tdone\n\trelink_command=\"(cd `pwd`; $relink_command)\"\n\trelink_command=`$ECHO \"$relink_command\" | $SED \"$sed_quote_subst\"`\n      fi\n\n      # Only actually do things if not in dry run mode.\n      $opt_dry_run || {\n\t# win32 will think the script is a binary if it has\n\t# a .exe suffix, so we strip it off here.\n\tcase $output in\n\t  *.exe) func_stripname '' '.exe' \"$output\"\n\t         output=$func_stripname_result ;;\n\tesac\n\t# test for cygwin because mv fails w/o .exe extensions\n\tcase $host in\n\t  *cygwin*)\n\t    exeext=.exe\n\t    func_stripname '' '.exe' \"$outputname\"\n\t    outputname=$func_stripname_result ;;\n\t  *) exeext= ;;\n\tesac\n\tcase $host in\n\t  *cygwin* | *mingw* )\n\t    func_dirname_and_basename \"$output\" \"\" \".\"\n\t    output_name=$func_basename_result\n\t    output_path=$func_dirname_result\n\t    cwrappersource=\"$output_path/$objdir/lt-$output_name.c\"\n\t    cwrapper=\"$output_path/$output_name.exe\"\n\t    $RM $cwrappersource $cwrapper\n\t    trap \"$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE\" 1 2 15\n\n\t    func_emit_cwrapperexe_src > $cwrappersource\n\n\t    # The wrapper executable is built using the $host compiler,\n\t    # because it contains $host paths and files. If cross-\n\t    # compiling, it, like the target executable, must be\n\t    # executed on the $host or under an emulation environment.\n\t    $opt_dry_run || {\n\t      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource\n\t      $STRIP $cwrapper\n\t    }\n\n\t    # Now, create the wrapper script for func_source use:\n\t    func_ltwrapper_scriptname $cwrapper\n\t    $RM $func_ltwrapper_scriptname_result\n\t    trap \"$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE\" 1 2 15\n\t    $opt_dry_run || {\n\t      # note: this script will not be executed, so do not chmod.\n\t      if test \"x$build\" = \"x$host\" ; then\n\t\t$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result\n\t      else\n\t\tfunc_emit_wrapper no > $func_ltwrapper_scriptname_result\n\t      fi\n\t    }\n\t  ;;\n\t  * )\n\t    $RM $output\n\t    trap \"$RM $output; exit $EXIT_FAILURE\" 1 2 15\n\n\t    func_emit_wrapper no > $output\n\t    chmod +x $output\n\t  ;;\n\tesac\n      }\n      exit $EXIT_SUCCESS\n      ;;\n    esac\n\n    # See if we need to build an old-fashioned archive.\n    for oldlib in $oldlibs; do\n\n      if test \"$build_libtool_libs\" = convenience; then\n\toldobjs=\"$libobjs_save $symfileobj\"\n\taddlibs=\"$convenience\"\n\tbuild_libtool_libs=no\n      else\n\tif test \"$build_libtool_libs\" = module; then\n\t  oldobjs=\"$libobjs_save\"\n\t  build_libtool_libs=no\n\telse\n\t  oldobjs=\"$old_deplibs $non_pic_objects\"\n\t  if test \"$preload\" = yes && test -f \"$symfileobj\"; then\n\t    func_append oldobjs \" $symfileobj\"\n\t  fi\n\tfi\n\taddlibs=\"$old_convenience\"\n      fi\n\n      if test -n \"$addlibs\"; then\n\tgentop=\"$output_objdir/${outputname}x\"\n\tfunc_append generated \" $gentop\"\n\n\tfunc_extract_archives $gentop $addlibs\n\tfunc_append oldobjs \" $func_extract_archives_result\"\n      fi\n\n      # Do each command in the archive commands.\n      if test -n \"$old_archive_from_new_cmds\" && test \"$build_libtool_libs\" = yes; then\n\tcmds=$old_archive_from_new_cmds\n      else\n\n\t# Add any objects from preloaded convenience libraries\n\tif test -n \"$dlprefiles\"; then\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  func_append generated \" $gentop\"\n\n\t  func_extract_archives $gentop $dlprefiles\n\t  func_append oldobjs \" $func_extract_archives_result\"\n\tfi\n\n\t# POSIX demands no paths to be encoded in archives.  We have\n\t# to avoid creating archives with duplicate basenames if we\n\t# might have to extract them afterwards, e.g., when creating a\n\t# static archive out of a convenience library, or when linking\n\t# the entirety of a libtool archive into another (currently\n\t# not supported by libtool).\n\tif (for obj in $oldobjs\n\t    do\n\t      func_basename \"$obj\"\n\t      $ECHO \"$func_basename_result\"\n\t    done | sort | sort -uc >/dev/null 2>&1); then\n\t  :\n\telse\n\t  echo \"copying selected object files to avoid basename conflicts...\"\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  func_append generated \" $gentop\"\n\t  func_mkdir_p \"$gentop\"\n\t  save_oldobjs=$oldobjs\n\t  oldobjs=\n\t  counter=1\n\t  for obj in $save_oldobjs\n\t  do\n\t    func_basename \"$obj\"\n\t    objbase=\"$func_basename_result\"\n\t    case \" $oldobjs \" in\n\t    \" \") oldobjs=$obj ;;\n\t    *[\\ /]\"$objbase \"*)\n\t      while :; do\n\t\t# Make sure we don't pick an alternate name that also\n\t\t# overlaps.\n\t\tnewobj=lt$counter-$objbase\n\t\tfunc_arith $counter + 1\n\t\tcounter=$func_arith_result\n\t\tcase \" $oldobjs \" in\n\t\t*[\\ /]\"$newobj \"*) ;;\n\t\t*) if test ! -f \"$gentop/$newobj\"; then break; fi ;;\n\t\tesac\n\t      done\n\t      func_show_eval \"ln $obj $gentop/$newobj || cp $obj $gentop/$newobj\"\n\t      func_append oldobjs \" $gentop/$newobj\"\n\t      ;;\n\t    *) func_append oldobjs \" $obj\" ;;\n\t    esac\n\t  done\n\tfi\n\tfunc_to_tool_file \"$oldlib\" func_convert_file_msys_to_w32\n\ttool_oldlib=$func_to_tool_file_result\n\teval cmds=\\\"$old_archive_cmds\\\"\n\n\tfunc_len \" $cmds\"\n\tlen=$func_len_result\n\tif test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t  cmds=$old_archive_cmds\n\telif test -n \"$archiver_list_spec\"; then\n\t  func_verbose \"using command file archive linking...\"\n\t  for obj in $oldobjs\n\t  do\n\t    func_to_tool_file \"$obj\"\n\t    $ECHO \"$func_to_tool_file_result\"\n\t  done > $output_objdir/$libname.libcmd\n\t  func_to_tool_file \"$output_objdir/$libname.libcmd\"\n\t  oldobjs=\" $archiver_list_spec$func_to_tool_file_result\"\n\t  cmds=$old_archive_cmds\n\telse\n\t  # the command line is too long to link in one step, link in parts\n\t  func_verbose \"using piecewise archive linking...\"\n\t  save_RANLIB=$RANLIB\n\t  RANLIB=:\n\t  objlist=\n\t  concat_cmds=\n\t  save_oldobjs=$oldobjs\n\t  oldobjs=\n\t  # Is there a better way of finding the last object in the list?\n\t  for obj in $save_oldobjs\n\t  do\n\t    last_oldobj=$obj\n\t  done\n\t  eval test_cmds=\\\"$old_archive_cmds\\\"\n\t  func_len \" $test_cmds\"\n\t  len0=$func_len_result\n\t  len=$len0\n\t  for obj in $save_oldobjs\n\t  do\n\t    func_len \" $obj\"\n\t    func_arith $len + $func_len_result\n\t    len=$func_arith_result\n\t    func_append objlist \" $obj\"\n\t    if test \"$len\" -lt \"$max_cmd_len\"; then\n\t      :\n\t    else\n\t      # the above command should be used before it gets too long\n\t      oldobjs=$objlist\n\t      if test \"$obj\" = \"$last_oldobj\" ; then\n\t\tRANLIB=$save_RANLIB\n\t      fi\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\${concat_cmds}$old_archive_cmds\\\"\n\t      objlist=\n\t      len=$len0\n\t    fi\n\t  done\n\t  RANLIB=$save_RANLIB\n\t  oldobjs=$objlist\n\t  if test \"X$oldobjs\" = \"X\" ; then\n\t    eval cmds=\\\"\\$concat_cmds\\\"\n\t  else\n\t    eval cmds=\\\"\\$concat_cmds~\\$old_archive_cmds\\\"\n\t  fi\n\tfi\n      fi\n      func_execute_cmds \"$cmds\" 'exit $?'\n    done\n\n    test -n \"$generated\" && \\\n      func_show_eval \"${RM}r$generated\"\n\n    # Now create the libtool archive.\n    case $output in\n    *.la)\n      old_library=\n      test \"$build_old_libs\" = yes && old_library=\"$libname.$libext\"\n      func_verbose \"creating $output\"\n\n      # Preserve any variables that may affect compiler behavior\n      for var in $variables_saved_for_relink; do\n\tif eval test -z \\\"\\${$var+set}\\\"; then\n\t  relink_command=\"{ test -z \\\"\\${$var+set}\\\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command\"\n\telif eval var_value=\\$$var; test -z \"$var_value\"; then\n\t  relink_command=\"$var=; export $var; $relink_command\"\n\telse\n\t  func_quote_for_eval \"$var_value\"\n\t  relink_command=\"$var=$func_quote_for_eval_result; export $var; $relink_command\"\n\tfi\n      done\n      # Quote the link command for shipping.\n      relink_command=\"(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)\"\n      relink_command=`$ECHO \"$relink_command\" | $SED \"$sed_quote_subst\"`\n      if test \"$hardcode_automatic\" = yes ; then\n\trelink_command=\n      fi\n\n      # Only create the output if not a dry run.\n      $opt_dry_run || {\n\tfor installed in no yes; do\n\t  if test \"$installed\" = yes; then\n\t    if test -z \"$install_libdir\"; then\n\t      break\n\t    fi\n\t    output=\"$output_objdir/$outputname\"i\n\t    # Replace all uninstalled libtool libraries with the installed ones\n\t    newdependency_libs=\n\t    for deplib in $dependency_libs; do\n\t      case $deplib in\n\t      *.la)\n\t\tfunc_basename \"$deplib\"\n\t\tname=\"$func_basename_result\"\n\t\tfunc_resolve_sysroot \"$deplib\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $func_resolve_sysroot_result`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$deplib' is not a valid libtool archive\"\n\t\tfunc_append newdependency_libs \" ${lt_sysroot:+=}$libdir/$name\"\n\t\t;;\n\t      -L*)\n\t\tfunc_stripname -L '' \"$deplib\"\n\t\tfunc_replace_sysroot \"$func_stripname_result\"\n\t\tfunc_append newdependency_libs \" -L$func_replace_sysroot_result\"\n\t\t;;\n\t      -R*)\n\t\tfunc_stripname -R '' \"$deplib\"\n\t\tfunc_replace_sysroot \"$func_stripname_result\"\n\t\tfunc_append newdependency_libs \" -R$func_replace_sysroot_result\"\n\t\t;;\n\t      *) func_append newdependency_libs \" $deplib\" ;;\n\t      esac\n\t    done\n\t    dependency_libs=\"$newdependency_libs\"\n\t    newdlfiles=\n\n\t    for lib in $dlfiles; do\n\t      case $lib in\n\t      *.la)\n\t        func_basename \"$lib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $lib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\t\tfunc_append newdlfiles \" ${lt_sysroot:+=}$libdir/$name\"\n\t\t;;\n\t      *) func_append newdlfiles \" $lib\" ;;\n\t      esac\n\t    done\n\t    dlfiles=\"$newdlfiles\"\n\t    newdlprefiles=\n\t    for lib in $dlprefiles; do\n\t      case $lib in\n\t      *.la)\n\t\t# Only pass preopened files to the pseudo-archive (for\n\t\t# eventual linking with the app. that links it) if we\n\t\t# didn't already link the preopened objects directly into\n\t\t# the library:\n\t\tfunc_basename \"$lib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $lib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\t\tfunc_append newdlprefiles \" ${lt_sysroot:+=}$libdir/$name\"\n\t\t;;\n\t      esac\n\t    done\n\t    dlprefiles=\"$newdlprefiles\"\n\t  else\n\t    newdlfiles=\n\t    for lib in $dlfiles; do\n\t      case $lib in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs=\"$lib\" ;;\n\t\t*) abs=`pwd`\"/$lib\" ;;\n\t      esac\n\t      func_append newdlfiles \" $abs\"\n\t    done\n\t    dlfiles=\"$newdlfiles\"\n\t    newdlprefiles=\n\t    for lib in $dlprefiles; do\n\t      case $lib in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs=\"$lib\" ;;\n\t\t*) abs=`pwd`\"/$lib\" ;;\n\t      esac\n\t      func_append newdlprefiles \" $abs\"\n\t    done\n\t    dlprefiles=\"$newdlprefiles\"\n\t  fi\n\t  $RM $output\n\t  # place dlname in correct position for cygwin\n\t  # In fact, it would be nice if we could use this code for all target\n\t  # systems that can't hard-code library paths into their executables\n\t  # and that have no shared library path variable independent of PATH,\n\t  # but it turns out we can't easily determine that from inspecting\n\t  # libtool variables, so we have to hard-code the OSs to which it\n\t  # applies here; at the moment, that means platforms that use the PE\n\t  # object format with DLL files.  See the long comment at the top of\n\t  # tests/bindir.at for full details.\n\t  tdlname=$dlname\n\t  case $host,$output,$installed,$module,$dlname in\n\t    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)\n\t      # If a -bindir argument was supplied, place the dll there.\n\t      if test \"x$bindir\" != x ;\n\t      then\n\t\tfunc_relative_path \"$install_libdir\" \"$bindir\"\n\t\ttdlname=$func_relative_path_result$dlname\n\t      else\n\t\t# Otherwise fall back on heuristic.\n\t\ttdlname=../bin/$dlname\n\t      fi\n\t      ;;\n\t  esac\n\t  $ECHO > $output \"\\\n# $outputname - a libtool library file\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# The name that we can dlopen(3).\ndlname='$tdlname'\n\n# Names of this library.\nlibrary_names='$library_names'\n\n# The name of the static archive.\nold_library='$old_library'\n\n# Linker flags that can not go in dependency_libs.\ninherited_linker_flags='$new_inherited_linker_flags'\n\n# Libraries that this one depends upon.\ndependency_libs='$dependency_libs'\n\n# Names of additional weak libraries provided by this library\nweak_library_names='$weak_libs'\n\n# Version information for $libname.\ncurrent=$current\nage=$age\nrevision=$revision\n\n# Is this an already installed library?\ninstalled=$installed\n\n# Should we warn about portability when linking against -modules?\nshouldnotlink=$module\n\n# Files to dlopen/dlpreopen\ndlopen='$dlfiles'\ndlpreopen='$dlprefiles'\n\n# Directory that this library needs to be installed in:\nlibdir='$install_libdir'\"\n\t  if test \"$installed\" = no && test \"$need_relink\" = yes; then\n\t    $ECHO >> $output \"\\\nrelink_command=\\\"$relink_command\\\"\"\n\t  fi\n\tdone\n      }\n\n      # Do a symbolic link so that the libtool archive can be found in\n      # LD_LIBRARY_PATH before the program is installed.\n      func_show_eval '( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )' 'exit $?'\n      ;;\n    esac\n    exit $EXIT_SUCCESS\n}\n\n{ test \"$opt_mode\" = link || test \"$opt_mode\" = relink; } &&\n    func_mode_link ${1+\"$@\"}\n\n\n# func_mode_uninstall arg...\nfunc_mode_uninstall ()\n{\n    $opt_debug\n    RM=\"$nonopt\"\n    files=\n    rmforce=\n    exit_status=0\n\n    # This variable tells wrapper scripts just to set variables rather\n    # than running their programs.\n    libtool_install_magic=\"$magic\"\n\n    for arg\n    do\n      case $arg in\n      -f) func_append RM \" $arg\"; rmforce=yes ;;\n      -*) func_append RM \" $arg\" ;;\n      *) func_append files \" $arg\" ;;\n      esac\n    done\n\n    test -z \"$RM\" && \\\n      func_fatal_help \"you must specify an RM program\"\n\n    rmdirs=\n\n    for file in $files; do\n      func_dirname \"$file\" \"\" \".\"\n      dir=\"$func_dirname_result\"\n      if test \"X$dir\" = X.; then\n\todir=\"$objdir\"\n      else\n\todir=\"$dir/$objdir\"\n      fi\n      func_basename \"$file\"\n      name=\"$func_basename_result\"\n      test \"$opt_mode\" = uninstall && odir=\"$dir\"\n\n      # Remember odir for removal later, being careful to avoid duplicates\n      if test \"$opt_mode\" = clean; then\n\tcase \" $rmdirs \" in\n\t  *\" $odir \"*) ;;\n\t  *) func_append rmdirs \" $odir\" ;;\n\tesac\n      fi\n\n      # Don't error if the file doesn't exist and rm -f was used.\n      if { test -L \"$file\"; } >/dev/null 2>&1 ||\n\t { test -h \"$file\"; } >/dev/null 2>&1 ||\n\t test -f \"$file\"; then\n\t:\n      elif test -d \"$file\"; then\n\texit_status=1\n\tcontinue\n      elif test \"$rmforce\" = yes; then\n\tcontinue\n      fi\n\n      rmfiles=\"$file\"\n\n      case $name in\n      *.la)\n\t# Possibly a libtool archive, so verify it.\n\tif func_lalib_p \"$file\"; then\n\t  func_source $dir/$name\n\n\t  # Delete the libtool libraries and symlinks.\n\t  for n in $library_names; do\n\t    func_append rmfiles \" $odir/$n\"\n\t  done\n\t  test -n \"$old_library\" && func_append rmfiles \" $odir/$old_library\"\n\n\t  case \"$opt_mode\" in\n\t  clean)\n\t    case \" $library_names \" in\n\t    *\" $dlname \"*) ;;\n\t    *) test -n \"$dlname\" && func_append rmfiles \" $odir/$dlname\" ;;\n\t    esac\n\t    test -n \"$libdir\" && func_append rmfiles \" $odir/$name $odir/${name}i\"\n\t    ;;\n\t  uninstall)\n\t    if test -n \"$library_names\"; then\n\t      # Do each command in the postuninstall commands.\n\t      func_execute_cmds \"$postuninstall_cmds\" 'test \"$rmforce\" = yes || exit_status=1'\n\t    fi\n\n\t    if test -n \"$old_library\"; then\n\t      # Do each command in the old_postuninstall commands.\n\t      func_execute_cmds \"$old_postuninstall_cmds\" 'test \"$rmforce\" = yes || exit_status=1'\n\t    fi\n\t    # FIXME: should reinstall the best remaining shared library.\n\t    ;;\n\t  esac\n\tfi\n\t;;\n\n      *.lo)\n\t# Possibly a libtool object, so verify it.\n\tif func_lalib_p \"$file\"; then\n\n\t  # Read the .lo file\n\t  func_source $dir/$name\n\n\t  # Add PIC object to the list of files to remove.\n\t  if test -n \"$pic_object\" &&\n\t     test \"$pic_object\" != none; then\n\t    func_append rmfiles \" $dir/$pic_object\"\n\t  fi\n\n\t  # Add non-PIC object to the list of files to remove.\n\t  if test -n \"$non_pic_object\" &&\n\t     test \"$non_pic_object\" != none; then\n\t    func_append rmfiles \" $dir/$non_pic_object\"\n\t  fi\n\tfi\n\t;;\n\n      *)\n\tif test \"$opt_mode\" = clean ; then\n\t  noexename=$name\n\t  case $file in\n\t  *.exe)\n\t    func_stripname '' '.exe' \"$file\"\n\t    file=$func_stripname_result\n\t    func_stripname '' '.exe' \"$name\"\n\t    noexename=$func_stripname_result\n\t    # $file with .exe has already been added to rmfiles,\n\t    # add $file without .exe\n\t    func_append rmfiles \" $file\"\n\t    ;;\n\t  esac\n\t  # Do a test to see if this is a libtool program.\n\t  if func_ltwrapper_p \"$file\"; then\n\t    if func_ltwrapper_executable_p \"$file\"; then\n\t      func_ltwrapper_scriptname \"$file\"\n\t      relink_command=\n\t      func_source $func_ltwrapper_scriptname_result\n\t      func_append rmfiles \" $func_ltwrapper_scriptname_result\"\n\t    else\n\t      relink_command=\n\t      func_source $dir/$noexename\n\t    fi\n\n\t    # note $name still contains .exe if it was in $file originally\n\t    # as does the version of $file that was added into $rmfiles\n\t    func_append rmfiles \" $odir/$name $odir/${name}S.${objext}\"\n\t    if test \"$fast_install\" = yes && test -n \"$relink_command\"; then\n\t      func_append rmfiles \" $odir/lt-$name\"\n\t    fi\n\t    if test \"X$noexename\" != \"X$name\" ; then\n\t      func_append rmfiles \" $odir/lt-${noexename}.c\"\n\t    fi\n\t  fi\n\tfi\n\t;;\n      esac\n      func_show_eval \"$RM $rmfiles\" 'exit_status=1'\n    done\n\n    # Try to remove the ${objdir}s in the directories where we deleted files\n    for dir in $rmdirs; do\n      if test -d \"$dir\"; then\n\tfunc_show_eval \"rmdir $dir >/dev/null 2>&1\"\n      fi\n    done\n\n    exit $exit_status\n}\n\n{ test \"$opt_mode\" = uninstall || test \"$opt_mode\" = clean; } &&\n    func_mode_uninstall ${1+\"$@\"}\n\ntest -z \"$opt_mode\" && {\n  help=\"$generic_help\"\n  func_fatal_help \"you must specify a MODE\"\n}\n\ntest -z \"$exec_cmd\" && \\\n  func_fatal_help \"invalid operation mode \\`$opt_mode'\"\n\nif test -n \"$exec_cmd\"; then\n  eval exec \"$exec_cmd\"\n  exit $EXIT_FAILURE\nfi\n\nexit $exit_status\n\n\n# The TAGs below are defined such that we never get into a situation\n# in which we disable both kinds of libraries.  Given conflicting\n# choices, we go for a static library, that is the most portable,\n# since we can't tell whether shared libraries were disabled because\n# the user asked for that or because the platform doesn't support\n# them.  This is particularly important on AIX, because we don't\n# support having both static and shared libraries enabled at the same\n# time on that platform, so we default to a shared-only configuration.\n# If a disable-shared tag is given, we'll fallback to a static-only\n# configuration.  But we'll never go from static-only to shared-only.\n\n# ### BEGIN LIBTOOL TAG CONFIG: disable-shared\nbuild_libtool_libs=no\nbuild_old_libs=yes\n# ### END LIBTOOL TAG CONFIG: disable-shared\n\n# ### BEGIN LIBTOOL TAG CONFIG: disable-static\nbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`\n# ### END LIBTOOL TAG CONFIG: disable-static\n\n# Local Variables:\n# mode:shell-script\n# sh-indentation:2\n# End:\n# vi:sw=2\n\n"
  },
  {
    "path": "Tests/gtest/build-aux/missing",
    "content": "#! /bin/sh\n# Common stub for a few missing GNU programs while installing.\n\nscriptversion=2012-01-06.13; # UTC\n\n# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,\n# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.\n# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.\n\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2, or (at your option)\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\nif test $# -eq 0; then\n  echo 1>&2 \"Try \\`$0 --help' for more information\"\n  exit 1\nfi\n\nrun=:\nsed_output='s/.* --output[ =]\\([^ ]*\\).*/\\1/p'\nsed_minuso='s/.* -o \\([^ ]*\\).*/\\1/p'\n\n# In the cases where this matters, `missing' is being run in the\n# srcdir already.\nif test -f configure.ac; then\n  configure_ac=configure.ac\nelse\n  configure_ac=configure.in\nfi\n\nmsg=\"missing on your system\"\n\ncase $1 in\n--run)\n  # Try to run requested program, and just exit if it succeeds.\n  run=\n  shift\n  \"$@\" && exit 0\n  # Exit code 63 means version mismatch.  This often happens\n  # when the user try to use an ancient version of a tool on\n  # a file that requires a minimum version.  In this case we\n  # we should proceed has if the program had been absent, or\n  # if --run hadn't been passed.\n  if test $? = 63; then\n    run=:\n    msg=\"probably too old\"\n  fi\n  ;;\n\n  -h|--h|--he|--hel|--help)\n    echo \"\\\n$0 [OPTION]... PROGRAM [ARGUMENT]...\n\nHandle \\`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an\nerror status if there is no known handling for PROGRAM.\n\nOptions:\n  -h, --help      display this help and exit\n  -v, --version   output version information and exit\n  --run           try to run the given command, and emulate it if it fails\n\nSupported PROGRAM values:\n  aclocal      touch file \\`aclocal.m4'\n  autoconf     touch file \\`configure'\n  autoheader   touch file \\`config.h.in'\n  autom4te     touch the output file, or create a stub one\n  automake     touch all \\`Makefile.in' files\n  bison        create \\`y.tab.[ch]', if possible, from existing .[ch]\n  flex         create \\`lex.yy.c', if possible, from existing .c\n  help2man     touch the output file\n  lex          create \\`lex.yy.c', if possible, from existing .c\n  makeinfo     touch the output file\n  yacc         create \\`y.tab.[ch]', if possible, from existing .[ch]\n\nVersion suffixes to PROGRAM as well as the prefixes \\`gnu-', \\`gnu', and\n\\`g' are ignored when checking the name.\n\nSend bug reports to <bug-automake@gnu.org>.\"\n    exit $?\n    ;;\n\n  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)\n    echo \"missing $scriptversion (GNU Automake)\"\n    exit $?\n    ;;\n\n  -*)\n    echo 1>&2 \"$0: Unknown \\`$1' option\"\n    echo 1>&2 \"Try \\`$0 --help' for more information\"\n    exit 1\n    ;;\n\nesac\n\n# normalize program name to check for.\nprogram=`echo \"$1\" | sed '\n  s/^gnu-//; t\n  s/^gnu//; t\n  s/^g//; t'`\n\n# Now exit if we have it, but it failed.  Also exit now if we\n# don't have it and --version was passed (most likely to detect\n# the program).  This is about non-GNU programs, so use $1 not\n# $program.\ncase $1 in\n  lex*|yacc*)\n    # Not GNU programs, they don't have --version.\n    ;;\n\n  *)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    elif test \"x$2\" = \"x--version\" || test \"x$2\" = \"x--help\"; then\n       # Could not run --version or --help.  This is probably someone\n       # running `$TOOL --version' or `$TOOL --help' to check whether\n       # $TOOL exists and not knowing $TOOL uses missing.\n       exit 1\n    fi\n    ;;\nesac\n\n# If it does not exist, or fails to run (possibly an outdated version),\n# try to emulate it.\ncase $program in\n  aclocal*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`acinclude.m4' or \\`${configure_ac}'.  You might want\n         to install the \\`Automake' and \\`Perl' packages.  Grab them from\n         any GNU archive site.\"\n    touch aclocal.m4\n    ;;\n\n  autoconf*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`${configure_ac}'.  You might want to install the\n         \\`Autoconf' and \\`GNU m4' packages.  Grab them from any GNU\n         archive site.\"\n    touch configure\n    ;;\n\n  autoheader*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`acconfig.h' or \\`${configure_ac}'.  You might want\n         to install the \\`Autoconf' and \\`GNU m4' packages.  Grab them\n         from any GNU archive site.\"\n    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\\([^)]*\\)).*/\\1/p' ${configure_ac}`\n    test -z \"$files\" && files=\"config.h\"\n    touch_files=\n    for f in $files; do\n      case $f in\n      *:*) touch_files=\"$touch_files \"`echo \"$f\" |\n\t\t\t\t       sed -e 's/^[^:]*://' -e 's/:.*//'`;;\n      *) touch_files=\"$touch_files $f.in\";;\n      esac\n    done\n    touch $touch_files\n    ;;\n\n  automake*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`Makefile.am', \\`acinclude.m4' or \\`${configure_ac}'.\n         You might want to install the \\`Automake' and \\`Perl' packages.\n         Grab them from any GNU archive site.\"\n    find . -type f -name Makefile.am -print |\n\t   sed 's/\\.am$/.in/' |\n\t   while read f; do touch \"$f\"; done\n    ;;\n\n  autom4te*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is needed, but is $msg.\n         You might have modified some files without having the\n         proper tools for further handling them.\n         You can get \\`$1' as part of \\`Autoconf' from any GNU\n         archive site.\"\n\n    file=`echo \"$*\" | sed -n \"$sed_output\"`\n    test -z \"$file\" && file=`echo \"$*\" | sed -n \"$sed_minuso\"`\n    if test -f \"$file\"; then\n\ttouch $file\n    else\n\ttest -z \"$file\" || exec >$file\n\techo \"#! /bin/sh\"\n\techo \"# Created by GNU Automake missing as a replacement of\"\n\techo \"#  $ $@\"\n\techo \"exit 0\"\n\tchmod +x $file\n\texit 1\n    fi\n    ;;\n\n  bison*|yacc*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' $msg.  You should only need it if\n         you modified a \\`.y' file.  You may need the \\`Bison' package\n         in order for those modifications to take effect.  You can get\n         \\`Bison' from any GNU archive site.\"\n    rm -f y.tab.c y.tab.h\n    if test $# -ne 1; then\n        eval LASTARG=\\${$#}\n\tcase $LASTARG in\n\t*.y)\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/y$/c/'`\n\t    if test -f \"$SRCFILE\"; then\n\t         cp \"$SRCFILE\" y.tab.c\n\t    fi\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/y$/h/'`\n\t    if test -f \"$SRCFILE\"; then\n\t         cp \"$SRCFILE\" y.tab.h\n\t    fi\n\t  ;;\n\tesac\n    fi\n    if test ! -f y.tab.h; then\n\techo >y.tab.h\n    fi\n    if test ! -f y.tab.c; then\n\techo 'main() { return 0; }' >y.tab.c\n    fi\n    ;;\n\n  lex*|flex*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified a \\`.l' file.  You may need the \\`Flex' package\n         in order for those modifications to take effect.  You can get\n         \\`Flex' from any GNU archive site.\"\n    rm -f lex.yy.c\n    if test $# -ne 1; then\n        eval LASTARG=\\${$#}\n\tcase $LASTARG in\n\t*.l)\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/l$/c/'`\n\t    if test -f \"$SRCFILE\"; then\n\t         cp \"$SRCFILE\" lex.yy.c\n\t    fi\n\t  ;;\n\tesac\n    fi\n    if test ! -f lex.yy.c; then\n\techo 'main() { return 0; }' >lex.yy.c\n    fi\n    ;;\n\n  help2man*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n\t you modified a dependency of a manual page.  You may need the\n\t \\`Help2man' package in order for those modifications to take\n\t effect.  You can get \\`Help2man' from any GNU archive site.\"\n\n    file=`echo \"$*\" | sed -n \"$sed_output\"`\n    test -z \"$file\" && file=`echo \"$*\" | sed -n \"$sed_minuso\"`\n    if test -f \"$file\"; then\n\ttouch $file\n    else\n\ttest -z \"$file\" || exec >$file\n\techo \".ab help2man is required to generate this page\"\n\texit $?\n    fi\n    ;;\n\n  makeinfo*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified a \\`.texi' or \\`.texinfo' file, or any other file\n         indirectly affecting the aspect of the manual.  The spurious\n         call might also be the consequence of using a buggy \\`make' (AIX,\n         DU, IRIX).  You might want to install the \\`Texinfo' package or\n         the \\`GNU make' package.  Grab either from any GNU archive site.\"\n    # The file to touch is that specified with -o ...\n    file=`echo \"$*\" | sed -n \"$sed_output\"`\n    test -z \"$file\" && file=`echo \"$*\" | sed -n \"$sed_minuso\"`\n    if test -z \"$file\"; then\n      # ... or it is the one specified with @setfilename ...\n      infile=`echo \"$*\" | sed 's/.* \\([^ ]*\\) *$/\\1/'`\n      file=`sed -n '\n\t/^@setfilename/{\n\t  s/.* \\([^ ]*\\) *$/\\1/\n\t  p\n\t  q\n\t}' $infile`\n      # ... or it is derived from the source name (dir/f.texi becomes f.info)\n      test -z \"$file\" && file=`echo \"$infile\" | sed 's,.*/,,;s,.[^.]*$,,'`.info\n    fi\n    # If the file does not exist, the user really needs makeinfo;\n    # let's fail without touching anything.\n    test -f $file || exit 1\n    touch $file\n    ;;\n\n  *)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is needed, and is $msg.\n         You might have modified some files without having the\n         proper tools for further handling them.  Check the \\`README' file,\n         it often tells you about the needed prerequisites for installing\n         this package.  You may also peek at any GNU archive site, in case\n         some other package would contain this missing \\`$1' program.\"\n    exit 1\n    ;;\nesac\n\nexit 0\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-time-zone: \"UTC\"\n# time-stamp-end: \"; # UTC\"\n# End:\n"
  },
  {
    "path": "Tests/gtest/cmake/internal_utils.cmake",
    "content": "# Defines functions and macros useful for building Google Test and\n# Google Mock.\n#\n# Note:\n#\n# - This file will be run twice when building Google Mock (once via\n#   Google Test's CMakeLists.txt, and once via Google Mock's).\n#   Therefore it shouldn't have any side effects other than defining\n#   the functions and macros.\n#\n# - The functions/macros defined in this file may depend on Google\n#   Test and Google Mock's option() definitions, and thus must be\n#   called *after* the options have been defined.\n\n# Tweaks CMake's default compiler/linker settings to suit Google Test's needs.\n#\n# This must be a macro(), as inside a function string() can only\n# update variables in the function scope.\nmacro(fix_default_compiler_settings_)\n  if (MSVC)\n    # For MSVC, CMake sets certain flags to defaults we want to override.\n    # This replacement code is taken from sample in the CMake Wiki at\n    # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace.\n    foreach (flag_var\n             CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE\n             CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)\n      if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)\n        # When Google Test is built as a shared library, it should also use\n        # shared runtime libraries.  Otherwise, it may end up with multiple\n        # copies of runtime library data in different modules, resulting in\n        # hard-to-find crashes. When it is built as a static library, it is\n        # preferable to use CRT as static libraries, as we don't have to rely\n        # on CRT DLLs being available. CMake always defaults to using shared\n        # CRT libraries, so we override that default here.\n        string(REPLACE \"/MD\" \"-MT\" ${flag_var} \"${${flag_var}}\")\n      endif()\n\n      # We prefer more strict warning checking for building Google Test.\n      # Replaces /W3 with /W4 in defaults.\n      string(REPLACE \"/W3\" \"-W4\" ${flag_var} \"${${flag_var}}\")\n    endforeach()\n  endif()\nendmacro()\n\n# Defines the compiler/linker flags used to build Google Test and\n# Google Mock.  You can tweak these definitions to suit your need.  A\n# variable's value is empty before it's explicitly assigned to.\nmacro(config_compiler_and_linker)\n  if (NOT gtest_disable_pthreads)\n    # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.\n    find_package(Threads)\n  endif()\n\n  fix_default_compiler_settings_()\n  if (MSVC)\n    # Newlines inside flags variables break CMake's NMake generator.\n    # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.\n    set(cxx_base_flags \"-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi\")\n    if (MSVC_VERSION LESS 1400)\n      # Suppress spurious warnings MSVC 7.1 sometimes issues.\n      # Forcing value to bool.\n      set(cxx_base_flags \"${cxx_base_flags} -wd4800\")\n      # Copy constructor and assignment operator could not be generated.\n      set(cxx_base_flags \"${cxx_base_flags} -wd4511 -wd4512\")\n      # Compatibility warnings not applicable to Google Test.\n      # Resolved overload was found by argument-dependent lookup.\n      set(cxx_base_flags \"${cxx_base_flags} -wd4675\")\n    endif()\n    set(cxx_base_flags \"${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32\")\n    set(cxx_base_flags \"${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN\")\n    set(cxx_exception_flags \"-EHsc -D_HAS_EXCEPTIONS=1\")\n    set(cxx_no_exception_flags \"-D_HAS_EXCEPTIONS=0\")\n    set(cxx_no_rtti_flags \"-GR-\")\n  elseif (CMAKE_COMPILER_IS_GNUCXX)\n    set(cxx_base_flags \"-Wall -Wshadow\")\n    set(cxx_exception_flags \"-fexceptions\")\n    set(cxx_no_exception_flags \"-fno-exceptions\")\n    # Until version 4.3.2, GCC doesn't define a macro to indicate\n    # whether RTTI is enabled.  Therefore we define GTEST_HAS_RTTI\n    # explicitly.\n    set(cxx_no_rtti_flags \"-fno-rtti -DGTEST_HAS_RTTI=0\")\n    set(cxx_strict_flags\n      \"-Wextra -Wno-unused-parameter -Wno-missing-field-initializers\")\n  elseif (CMAKE_CXX_COMPILER_ID STREQUAL \"SunPro\")\n    set(cxx_exception_flags \"-features=except\")\n    # Sun Pro doesn't provide macros to indicate whether exceptions and\n    # RTTI are enabled, so we define GTEST_HAS_* explicitly.\n    set(cxx_no_exception_flags \"-features=no%except -DGTEST_HAS_EXCEPTIONS=0\")\n    set(cxx_no_rtti_flags \"-features=no%rtti -DGTEST_HAS_RTTI=0\")\n  elseif (CMAKE_CXX_COMPILER_ID STREQUAL \"VisualAge\" OR\n      CMAKE_CXX_COMPILER_ID STREQUAL \"XL\")\n    # CMake 2.8 changes Visual Age's compiler ID to \"XL\".\n    set(cxx_exception_flags \"-qeh\")\n    set(cxx_no_exception_flags \"-qnoeh\")\n    # Until version 9.0, Visual Age doesn't define a macro to indicate\n    # whether RTTI is enabled.  Therefore we define GTEST_HAS_RTTI\n    # explicitly.\n    set(cxx_no_rtti_flags \"-qnortti -DGTEST_HAS_RTTI=0\")\n  elseif (CMAKE_CXX_COMPILER_ID STREQUAL \"HP\")\n    set(cxx_base_flags \"-AA -mt\")\n    set(cxx_exception_flags \"-DGTEST_HAS_EXCEPTIONS=1\")\n    set(cxx_no_exception_flags \"+noeh -DGTEST_HAS_EXCEPTIONS=0\")\n    # RTTI can not be disabled in HP aCC compiler.\n    set(cxx_no_rtti_flags \"\")\n  endif()\n\n  if (CMAKE_USE_PTHREADS_INIT)  # The pthreads library is available and allowed.\n    set(cxx_base_flags \"${cxx_base_flags} -DGTEST_HAS_PTHREAD=1\")\n  else()\n    set(cxx_base_flags \"${cxx_base_flags} -DGTEST_HAS_PTHREAD=0\")\n  endif()\n\n  # For building gtest's own tests and samples.\n  set(cxx_exception \"${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_exception_flags}\")\n  set(cxx_no_exception\n    \"${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}\")\n  set(cxx_default \"${cxx_exception}\")\n  set(cxx_no_rtti \"${cxx_default} ${cxx_no_rtti_flags}\")\n  set(cxx_use_own_tuple \"${cxx_default} -DGTEST_USE_OWN_TR1_TUPLE=1\")\n\n  # For building the gtest libraries.\n  set(cxx_strict \"${cxx_default} ${cxx_strict_flags}\")\nendmacro()\n\n# Defines the gtest & gtest_main libraries.  User tests should link\n# with one of them.\nfunction(cxx_library_with_type name type cxx_flags)\n  # type can be either STATIC or SHARED to denote a static or shared library.\n  # ARGN refers to additional arguments after 'cxx_flags'.\n  add_library(${name} ${type} ${ARGN})\n  set_target_properties(${name}\n    PROPERTIES\n    COMPILE_FLAGS \"${cxx_flags}\")\n  if (BUILD_SHARED_LIBS OR type STREQUAL \"SHARED\")\n    set_target_properties(${name}\n      PROPERTIES\n      COMPILE_DEFINITIONS \"GTEST_CREATE_SHARED_LIBRARY=1\")\n  endif()\n  if (CMAKE_USE_PTHREADS_INIT)\n    target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})\n  endif()\nendfunction()\n\n########################################################################\n#\n# Helper functions for creating build targets.\n\nfunction(cxx_shared_library name cxx_flags)\n  cxx_library_with_type(${name} SHARED \"${cxx_flags}\" ${ARGN})\nendfunction()\n\nfunction(cxx_library name cxx_flags)\n  cxx_library_with_type(${name} \"\" \"${cxx_flags}\" ${ARGN})\nendfunction()\n\n# cxx_executable_with_flags(name cxx_flags libs srcs...)\n#\n# creates a named C++ executable that depends on the given libraries and\n# is built from the given source files with the given compiler flags.\nfunction(cxx_executable_with_flags name cxx_flags libs)\n  add_executable(${name} ${ARGN})\n  if (cxx_flags)\n    set_target_properties(${name}\n      PROPERTIES\n      COMPILE_FLAGS \"${cxx_flags}\")\n  endif()\n  if (BUILD_SHARED_LIBS)\n    set_target_properties(${name}\n      PROPERTIES\n      COMPILE_DEFINITIONS \"GTEST_LINKED_AS_SHARED_LIBRARY=1\")\n  endif()\n  # To support mixing linking in static and dynamic libraries, link each\n  # library in with an extra call to target_link_libraries.\n  foreach (lib \"${libs}\")\n    target_link_libraries(${name} ${lib})\n  endforeach()\nendfunction()\n\n# cxx_executable(name dir lib srcs...)\n#\n# creates a named target that depends on the given libs and is built\n# from the given source files.  dir/name.cc is implicitly included in\n# the source file list.\nfunction(cxx_executable name dir libs)\n  cxx_executable_with_flags(\n    ${name} \"${cxx_default}\" \"${libs}\" \"${dir}/${name}.cc\" ${ARGN})\nendfunction()\n\n# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.\nfind_package(PythonInterp)\n\n# cxx_test_with_flags(name cxx_flags libs srcs...)\n#\n# creates a named C++ test that depends on the given libs and is built\n# from the given source files with the given compiler flags.\nfunction(cxx_test_with_flags name cxx_flags libs)\n  cxx_executable_with_flags(${name} \"${cxx_flags}\" \"${libs}\" ${ARGN})\n  add_test(${name} ${name})\nendfunction()\n\n# cxx_test(name libs srcs...)\n#\n# creates a named test target that depends on the given libs and is\n# built from the given source files.  Unlike cxx_test_with_flags,\n# test/name.cc is already implicitly included in the source file list.\nfunction(cxx_test name libs)\n  cxx_test_with_flags(\"${name}\" \"${cxx_default}\" \"${libs}\"\n    \"test/${name}.cc\" ${ARGN})\nendfunction()\n\n# py_test(name)\n#\n# creates a Python test with the given name whose main module is in\n# test/name.py.  It does nothing if Python is not installed.\nfunction(py_test name)\n  # We are not supporting Python tests on Linux yet as they consider\n  # all Linux environments to be google3 and try to use google3 features.\n  if (PYTHONINTERP_FOUND)\n    # ${CMAKE_BINARY_DIR} is known at configuration time, so we can\n    # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known\n    # only at ctest runtime (by calling ctest -c <Configuration>), so\n    # we have to escape $ to delay variable substitution here.\n    add_test(${name}\n      ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py\n          --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\\${CTEST_CONFIGURATION_TYPE})\n  endif()\nendfunction()\n"
  },
  {
    "path": "Tests/gtest/codegear/gtest.cbproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>\n    <Config Condition=\"'$(Config)'==''\">Release</Config>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Base' or '$(Base)'!=''\">\n    <Base>true</Base>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Debug' or '$(Cfg_1)'!=''\">\n    <Base>true</Base>\n    <Cfg_1>true</Cfg_1>\n    <CfgParent>Base</CfgParent>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Release' or '$(Cfg_2)'!=''\">\n    <Base>true</Base>\n    <Cfg_2>true</Cfg_2>\n    <CfgParent>Base</CfgParent>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Base)'!=''\">\n    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>\n    <OutputExt>lib</OutputExt>\n    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>\n    <Defines>NO_STRICT</Defines>\n    <DynamicRTL>true</DynamicRTL>\n    <UsePackages>true</UsePackages>\n    <ProjectType>CppStaticLibrary</ProjectType>\n    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>\n    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>\n    <BCC_wpar>false</BCC_wpar>\n    <IncludePath>$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\include;..</IncludePath>\n    <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>\n    <TLIB_PageSize>32</TLIB_PageSize>\n    <ILINK_LibraryPath>$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk</ILINK_LibraryPath>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Cfg_1)'!=''\">\n    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>\n    <DCC_Optimize>false</DCC_Optimize>\n    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\n    <Defines>_DEBUG;$(Defines)</Defines>\n    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>\n    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>\n    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>\n    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>\n    <DCC_Define>DEBUG</DCC_Define>\n    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>\n    <IntermediateOutputDir>Debug</IntermediateOutputDir>\n    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>\n    <BCC_StackFrames>true</BCC_StackFrames>\n    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>\n    <ILINK_LibraryPath>$(BDS)\\lib\\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>\n    <TASM_Debugging>Full</TASM_Debugging>\n    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Cfg_2)'!=''\">\n    <Defines>NDEBUG;$(Defines)</Defines>\n    <IntermediateOutputDir>Release</IntermediateOutputDir>\n    <ILINK_LibraryPath>$(BDS)\\lib\\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>\n    <TASM_Debugging>None</TASM_Debugging>\n  </PropertyGroup>\n  <ProjectExtensions>\n    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>\n    <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>\n    <BorlandProject>\n<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name=\"IncludeVerInfo\">False</VersionInfo><VersionInfo Name=\"AutoIncBuild\">False</VersionInfo><VersionInfo Name=\"MajorVer\">1</VersionInfo><VersionInfo Name=\"MinorVer\">0</VersionInfo><VersionInfo Name=\"Release\">0</VersionInfo><VersionInfo Name=\"Build\">0</VersionInfo><VersionInfo Name=\"Debug\">False</VersionInfo><VersionInfo Name=\"PreRelease\">False</VersionInfo><VersionInfo Name=\"Special\">False</VersionInfo><VersionInfo Name=\"Private\">False</VersionInfo><VersionInfo Name=\"DLL\">False</VersionInfo><VersionInfo Name=\"Locale\">1033</VersionInfo><VersionInfo Name=\"CodePage\">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name=\"CompanyName\"></VersionInfoKeys><VersionInfoKeys Name=\"FileDescription\"></VersionInfoKeys><VersionInfoKeys Name=\"FileVersion\">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name=\"InternalName\"></VersionInfoKeys><VersionInfoKeys Name=\"LegalCopyright\"></VersionInfoKeys><VersionInfoKeys Name=\"LegalTrademarks\"></VersionInfoKeys><VersionInfoKeys Name=\"OriginalFilename\"></VersionInfoKeys><VersionInfoKeys Name=\"ProductName\"></VersionInfoKeys><VersionInfoKeys Name=\"ProductVersion\">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name=\"Comments\"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name=\"DebugSourceDirs\"></Debugging></Debugging><Parameters><Parameters Name=\"RunParams\"></Parameters><Parameters Name=\"Launcher\"></Parameters><Parameters Name=\"UseLauncher\">False</Parameters><Parameters Name=\"DebugCWD\"></Parameters><Parameters Name=\"HostApplication\"></Parameters><Parameters Name=\"RemoteHost\"></Parameters><Parameters Name=\"RemotePath\"></Parameters><Parameters Name=\"RemoteParams\"></Parameters><Parameters Name=\"RemoteLauncher\"></Parameters><Parameters Name=\"UseRemoteLauncher\">False</Parameters><Parameters Name=\"RemoteCWD\"></Parameters><Parameters Name=\"RemoteDebug\">False</Parameters><Parameters Name=\"Debug Symbols Search Path\"></Parameters><Parameters Name=\"LoadAllSymbols\">True</Parameters><Parameters Name=\"LoadUnspecifiedSymbols\">False</Parameters></Parameters><Excluded_Packages>\n      \n      \n      <Excluded_Packages Name=\"$(BDS)\\bin\\bcboffice2k100.bpl\">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>\n      <Excluded_Packages Name=\"$(BDS)\\bin\\bcbofficexp100.bpl\">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>\n    </Excluded_Packages><Linker><Linker Name=\"LibPrefix\"></Linker><Linker Name=\"LibSuffix\"></Linker><Linker Name=\"LibVersion\"></Linker></Linker><ProjectProperties><ProjectProperties Name=\"AutoShowDeps\">False</ProjectProperties><ProjectProperties Name=\"ManagePaths\">True</ProjectProperties><ProjectProperties Name=\"VerifyPackages\">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Count\">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item0\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item1\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item2\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\src;..\\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Count\">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Item0\">$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Count\">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Item0\">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name=\"Count\">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name=\"Item0\">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name=\"Item1\">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>\n  </ProjectExtensions>\n  <Import Project=\"$(MSBuildBinPath)\\Borland.Cpp.Targets\" />\n  <ItemGroup>\n    <None Include=\"..\\include\\gtest\\gtest-death-test.h\">\n      <BuildOrder>3</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest-message.h\">\n      <BuildOrder>4</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest-param-test.h\">\n      <BuildOrder>5</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest-spi.h\">\n      <BuildOrder>6</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest-test-part.h\">\n      <BuildOrder>7</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest-typed-test.h\">\n      <BuildOrder>8</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest.h\">\n      <BuildOrder>0</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest_pred_impl.h\">\n      <BuildOrder>1</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\gtest_prod.h\">\n      <BuildOrder>2</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-death-test-internal.h\">\n      <BuildOrder>9</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-filepath.h\">\n      <BuildOrder>10</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-internal.h\">\n      <BuildOrder>11</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-linked_ptr.h\">\n      <BuildOrder>12</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-param-util-generated.h\">\n      <BuildOrder>14</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-param-util.h\">\n      <BuildOrder>13</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-port.h\">\n      <BuildOrder>15</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-string.h\">\n      <BuildOrder>16</BuildOrder>\n    </None>\n    <None Include=\"..\\include\\gtest\\internal\\gtest-type-util.h\">\n      <BuildOrder>17</BuildOrder>\n    </None>\n    <CppCompile Include=\"gtest_all.cc\">\n      <BuildOrder>18</BuildOrder>\n    </CppCompile>\n    <BuildConfiguration Include=\"Debug\">\n      <Key>Cfg_1</Key>\n    </BuildConfiguration>\n    <BuildConfiguration Include=\"Release\">\n      <Key>Cfg_2</Key>\n    </BuildConfiguration>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "Tests/gtest/codegear/gtest.groupproj",
    "content": "﻿<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <ProjectGuid>{c1d923e0-6cba-4332-9b6f-3420acbf5091}</ProjectGuid>\n  </PropertyGroup>\n  <ItemGroup />\n  <ItemGroup>\n    <Projects Include=\"gtest.cbproj\" />\n    <Projects Include=\"gtest_main.cbproj\" />\n    <Projects Include=\"gtest_unittest.cbproj\" />\n  </ItemGroup>\n  <ProjectExtensions>\n    <Borland.Personality>Default.Personality</Borland.Personality>\n    <Borland.ProjectType />\n    <BorlandProject>\n<BorlandProject xmlns=\"\"><Default.Personality></Default.Personality></BorlandProject></BorlandProject>\n  </ProjectExtensions>\n  <Target Name=\"gtest\">\n    <MSBuild Projects=\"gtest.cbproj\" Targets=\"\" />\n  </Target>\n  <Target Name=\"gtest:Clean\">\n    <MSBuild Projects=\"gtest.cbproj\" Targets=\"Clean\" />\n  </Target>\n  <Target Name=\"gtest:Make\">\n    <MSBuild Projects=\"gtest.cbproj\" Targets=\"Make\" />\n  </Target>\n  <Target Name=\"gtest_main\">\n    <MSBuild Projects=\"gtest_main.cbproj\" Targets=\"\" />\n  </Target>\n  <Target Name=\"gtest_main:Clean\">\n    <MSBuild Projects=\"gtest_main.cbproj\" Targets=\"Clean\" />\n  </Target>\n  <Target Name=\"gtest_main:Make\">\n    <MSBuild Projects=\"gtest_main.cbproj\" Targets=\"Make\" />\n  </Target>\n  <Target Name=\"gtest_unittest\">\n    <MSBuild Projects=\"gtest_unittest.cbproj\" Targets=\"\" />\n  </Target>\n  <Target Name=\"gtest_unittest:Clean\">\n    <MSBuild Projects=\"gtest_unittest.cbproj\" Targets=\"Clean\" />\n  </Target>\n  <Target Name=\"gtest_unittest:Make\">\n    <MSBuild Projects=\"gtest_unittest.cbproj\" Targets=\"Make\" />\n  </Target>\n  <Target Name=\"Build\">\n    <CallTarget Targets=\"gtest;gtest_main;gtest_unittest\" />\n  </Target>\n  <Target Name=\"Clean\">\n    <CallTarget Targets=\"gtest:Clean;gtest_main:Clean;gtest_unittest:Clean\" />\n  </Target>\n  <Target Name=\"Make\">\n    <CallTarget Targets=\"gtest:Make;gtest_main:Make;gtest_unittest:Make\" />\n  </Target>\n  <Import Condition=\"Exists('$(MSBuildBinPath)\\Borland.Group.Targets')\" Project=\"$(MSBuildBinPath)\\Borland.Group.Targets\" />\n</Project>"
  },
  {
    "path": "Tests/gtest/codegear/gtest_all.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: Josh Kelley (joshkel@gmail.com)\n//\n// Google C++ Testing Framework (Google Test)\n//\n// C++Builder's IDE cannot build a static library from files with hyphens\n// in their name.  See http://qc.codegear.com/wc/qcmain.aspx?d=70977 .\n// This file serves as a workaround.\n\n#include \"src/gtest-all.cc\"\n"
  },
  {
    "path": "Tests/gtest/codegear/gtest_link.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: Josh Kelley (joshkel@gmail.com)\n//\n// Google C++ Testing Framework (Google Test)\n//\n// Links gtest.lib and gtest_main.lib into the current project in C++Builder.\n// This means that these libraries can't be renamed, but it's the only way to\n// ensure that Debug versus Release test builds are linked against the\n// appropriate Debug or Release build of the libraries.\n\n#pragma link \"gtest.lib\"\n#pragma link \"gtest_main.lib\"\n"
  },
  {
    "path": "Tests/gtest/codegear/gtest_main.cbproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>\n    <Config Condition=\"'$(Config)'==''\">Release</Config>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Base' or '$(Base)'!=''\">\n    <Base>true</Base>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Debug' or '$(Cfg_1)'!=''\">\n    <Base>true</Base>\n    <Cfg_1>true</Cfg_1>\n    <CfgParent>Base</CfgParent>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Release' or '$(Cfg_2)'!=''\">\n    <Base>true</Base>\n    <Cfg_2>true</Cfg_2>\n    <CfgParent>Base</CfgParent>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Base)'!=''\">\n    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>\n    <OutputExt>lib</OutputExt>\n    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>\n    <Defines>NO_STRICT</Defines>\n    <DynamicRTL>true</DynamicRTL>\n    <UsePackages>true</UsePackages>\n    <ProjectType>CppStaticLibrary</ProjectType>\n    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>\n    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>\n    <BCC_wpar>false</BCC_wpar>\n    <IncludePath>$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\include;..</IncludePath>\n    <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>\n    <TLIB_PageSize>32</TLIB_PageSize>\n    <ILINK_LibraryPath>$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk</ILINK_LibraryPath>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Cfg_1)'!=''\">\n    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>\n    <DCC_Optimize>false</DCC_Optimize>\n    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\n    <Defines>_DEBUG;$(Defines)</Defines>\n    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>\n    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>\n    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>\n    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>\n    <DCC_Define>DEBUG</DCC_Define>\n    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>\n    <IntermediateOutputDir>Debug</IntermediateOutputDir>\n    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>\n    <BCC_StackFrames>true</BCC_StackFrames>\n    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>\n    <ILINK_LibraryPath>$(BDS)\\lib\\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>\n    <TASM_Debugging>Full</TASM_Debugging>\n    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Cfg_2)'!=''\">\n    <Defines>NDEBUG;$(Defines)</Defines>\n    <IntermediateOutputDir>Release</IntermediateOutputDir>\n    <ILINK_LibraryPath>$(BDS)\\lib\\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>\n    <TASM_Debugging>None</TASM_Debugging>\n  </PropertyGroup>\n  <ProjectExtensions>\n    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>\n    <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>\n    <BorlandProject>\n<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name=\"IncludeVerInfo\">False</VersionInfo><VersionInfo Name=\"AutoIncBuild\">False</VersionInfo><VersionInfo Name=\"MajorVer\">1</VersionInfo><VersionInfo Name=\"MinorVer\">0</VersionInfo><VersionInfo Name=\"Release\">0</VersionInfo><VersionInfo Name=\"Build\">0</VersionInfo><VersionInfo Name=\"Debug\">False</VersionInfo><VersionInfo Name=\"PreRelease\">False</VersionInfo><VersionInfo Name=\"Special\">False</VersionInfo><VersionInfo Name=\"Private\">False</VersionInfo><VersionInfo Name=\"DLL\">False</VersionInfo><VersionInfo Name=\"Locale\">1033</VersionInfo><VersionInfo Name=\"CodePage\">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name=\"CompanyName\"></VersionInfoKeys><VersionInfoKeys Name=\"FileDescription\"></VersionInfoKeys><VersionInfoKeys Name=\"FileVersion\">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name=\"InternalName\"></VersionInfoKeys><VersionInfoKeys Name=\"LegalCopyright\"></VersionInfoKeys><VersionInfoKeys Name=\"LegalTrademarks\"></VersionInfoKeys><VersionInfoKeys Name=\"OriginalFilename\"></VersionInfoKeys><VersionInfoKeys Name=\"ProductName\"></VersionInfoKeys><VersionInfoKeys Name=\"ProductVersion\">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name=\"Comments\"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name=\"DebugSourceDirs\"></Debugging></Debugging><Parameters><Parameters Name=\"RunParams\"></Parameters><Parameters Name=\"Launcher\"></Parameters><Parameters Name=\"UseLauncher\">False</Parameters><Parameters Name=\"DebugCWD\"></Parameters><Parameters Name=\"HostApplication\"></Parameters><Parameters Name=\"RemoteHost\"></Parameters><Parameters Name=\"RemotePath\"></Parameters><Parameters Name=\"RemoteParams\"></Parameters><Parameters Name=\"RemoteLauncher\"></Parameters><Parameters Name=\"UseRemoteLauncher\">False</Parameters><Parameters Name=\"RemoteCWD\"></Parameters><Parameters Name=\"RemoteDebug\">False</Parameters><Parameters Name=\"Debug Symbols Search Path\"></Parameters><Parameters Name=\"LoadAllSymbols\">True</Parameters><Parameters Name=\"LoadUnspecifiedSymbols\">False</Parameters></Parameters><Excluded_Packages>\n      <Excluded_Packages Name=\"$(BDS)\\bin\\bcboffice2k100.bpl\">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>\n      <Excluded_Packages Name=\"$(BDS)\\bin\\bcbofficexp100.bpl\">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>\n    </Excluded_Packages><Linker><Linker Name=\"LibPrefix\"></Linker><Linker Name=\"LibSuffix\"></Linker><Linker Name=\"LibVersion\"></Linker></Linker><ProjectProperties><ProjectProperties Name=\"AutoShowDeps\">False</ProjectProperties><ProjectProperties Name=\"ManagePaths\">True</ProjectProperties><ProjectProperties Name=\"VerifyPackages\">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Count\">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item0\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item1\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item2\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\src;..\\src;..\\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Count\">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Item0\">$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Count\">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Item0\">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name=\"Count\">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name=\"Item0\">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name=\"Item1\">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>\n  </ProjectExtensions>\n  <Import Project=\"$(MSBuildBinPath)\\Borland.Cpp.Targets\" />\n  <ItemGroup>\n    <CppCompile Include=\"..\\src\\gtest_main.cc\">\n      <BuildOrder>0</BuildOrder>\n    </CppCompile>\n    <BuildConfiguration Include=\"Debug\">\n      <Key>Cfg_1</Key>\n    </BuildConfiguration>\n    <BuildConfiguration Include=\"Release\">\n      <Key>Cfg_2</Key>\n    </BuildConfiguration>\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "Tests/gtest/codegear/gtest_unittest.cbproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <ProjectGuid>{eea63393-5ac5-4b9c-8909-d75fef2daa41}</ProjectGuid>\n    <Config Condition=\"'$(Config)'==''\">Release</Config>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Base' or '$(Base)'!=''\">\n    <Base>true</Base>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Debug' or '$(Cfg_1)'!=''\">\n    <Base>true</Base>\n    <Cfg_1>true</Cfg_1>\n    <CfgParent>Base</CfgParent>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Config)'=='Release' or '$(Cfg_2)'!=''\">\n    <Base>true</Base>\n    <Cfg_2>true</Cfg_2>\n    <CfgParent>Base</CfgParent>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Base)'!=''\">\n    <OutputExt>exe</OutputExt>\n    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>\n    <Defines>NO_STRICT</Defines>\n    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>\n    <DynamicRTL>true</DynamicRTL>\n    <ILINK_ObjectSearchPath>..\\test</ILINK_ObjectSearchPath>\n    <UsePackages>true</UsePackages>\n    <ProjectType>CppConsoleApplication</ProjectType>\n    <NoVCL>true</NoVCL>\n    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>\n    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi</PackageImports>\n    <BCC_wpar>false</BCC_wpar>\n    <IncludePath>$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\include;..\\test;..</IncludePath>\n    <ILINK_LibraryPath>$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk;..\\test</ILINK_LibraryPath>\n    <Multithreaded>true</Multithreaded>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Cfg_1)'!=''\">\n    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>\n    <DCC_Optimize>false</DCC_Optimize>\n    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\n    <Defines>_DEBUG;$(Defines)</Defines>\n    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>\n    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>\n    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>\n    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>\n    <DCC_Define>DEBUG</DCC_Define>\n    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>\n    <IntermediateOutputDir>Debug</IntermediateOutputDir>\n    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>\n    <BCC_StackFrames>true</BCC_StackFrames>\n    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>\n    <ILINK_LibraryPath>$(BDS)\\lib\\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>\n    <TASM_Debugging>Full</TASM_Debugging>\n    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Cfg_2)'!=''\">\n    <Defines>NDEBUG;$(Defines)</Defines>\n    <IntermediateOutputDir>Release</IntermediateOutputDir>\n    <ILINK_LibraryPath>$(BDS)\\lib\\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>\n    <TASM_Debugging>None</TASM_Debugging>\n  </PropertyGroup>\n  <ProjectExtensions>\n    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>\n    <Borland.ProjectType>CppConsoleApplication</Borland.ProjectType>\n    <BorlandProject>\n<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name=\"IncludeVerInfo\">False</VersionInfo><VersionInfo Name=\"AutoIncBuild\">False</VersionInfo><VersionInfo Name=\"MajorVer\">1</VersionInfo><VersionInfo Name=\"MinorVer\">0</VersionInfo><VersionInfo Name=\"Release\">0</VersionInfo><VersionInfo Name=\"Build\">0</VersionInfo><VersionInfo Name=\"Debug\">False</VersionInfo><VersionInfo Name=\"PreRelease\">False</VersionInfo><VersionInfo Name=\"Special\">False</VersionInfo><VersionInfo Name=\"Private\">False</VersionInfo><VersionInfo Name=\"DLL\">False</VersionInfo><VersionInfo Name=\"Locale\">1033</VersionInfo><VersionInfo Name=\"CodePage\">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name=\"CompanyName\"></VersionInfoKeys><VersionInfoKeys Name=\"FileDescription\"></VersionInfoKeys><VersionInfoKeys Name=\"FileVersion\">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name=\"InternalName\"></VersionInfoKeys><VersionInfoKeys Name=\"LegalCopyright\"></VersionInfoKeys><VersionInfoKeys Name=\"LegalTrademarks\"></VersionInfoKeys><VersionInfoKeys Name=\"OriginalFilename\"></VersionInfoKeys><VersionInfoKeys Name=\"ProductName\"></VersionInfoKeys><VersionInfoKeys Name=\"ProductVersion\">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name=\"Comments\"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name=\"DebugSourceDirs\"></Debugging></Debugging><Parameters><Parameters Name=\"RunParams\"></Parameters><Parameters Name=\"Launcher\"></Parameters><Parameters Name=\"UseLauncher\">False</Parameters><Parameters Name=\"DebugCWD\"></Parameters><Parameters Name=\"HostApplication\"></Parameters><Parameters Name=\"RemoteHost\"></Parameters><Parameters Name=\"RemotePath\"></Parameters><Parameters Name=\"RemoteParams\"></Parameters><Parameters Name=\"RemoteLauncher\"></Parameters><Parameters Name=\"UseRemoteLauncher\">False</Parameters><Parameters Name=\"RemoteCWD\"></Parameters><Parameters Name=\"RemoteDebug\">False</Parameters><Parameters Name=\"Debug Symbols Search Path\"></Parameters><Parameters Name=\"LoadAllSymbols\">True</Parameters><Parameters Name=\"LoadUnspecifiedSymbols\">False</Parameters></Parameters><Excluded_Packages>\n      \n      \n      <Excluded_Packages Name=\"$(BDS)\\bin\\bcboffice2k100.bpl\">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>\n      <Excluded_Packages Name=\"$(BDS)\\bin\\bcbofficexp100.bpl\">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>\n    </Excluded_Packages><Linker><Linker Name=\"LibPrefix\"></Linker><Linker Name=\"LibSuffix\"></Linker><Linker Name=\"LibVersion\"></Linker></Linker><ProjectProperties><ProjectProperties Name=\"AutoShowDeps\">False</ProjectProperties><ProjectProperties Name=\"ManagePaths\">True</ProjectProperties><ProjectProperties Name=\"VerifyPackages\">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Count\">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item0\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\include;..\\test;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item1\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\include;..\\test</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name=\"Item2\">$(BDS)\\include;$(BDS)\\include\\dinkumware;$(BDS)\\include\\vcl;..\\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Count\">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Item0\">$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk;..\\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Item1\">$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk;..\\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name=\"Item2\">$(BDS)\\lib;$(BDS)\\lib\\obj;$(BDS)\\lib\\psdk;$(OUTPUTDIR);..\\test</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Count\">2</HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Item0\">NO_STRICT</HistoryLists_hlDefines><HistoryLists_hlDefines Name=\"Item1\">STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>\n  </ProjectExtensions>\n  <Import Project=\"$(MSBuildBinPath)\\Borland.Cpp.Targets\" />\n  <ItemGroup>\n    <CppCompile Include=\"..\\test\\gtest_unittest.cc\">\n      <BuildOrder>0</BuildOrder>\n    </CppCompile>\n    <CppCompile Include=\"gtest_link.cc\">\n      <BuildOrder>1</BuildOrder>\n    </CppCompile>\n    <BuildConfiguration Include=\"Debug\">\n      <Key>Cfg_1</Key>\n    </BuildConfiguration>\n    <BuildConfiguration Include=\"Release\">\n      <Key>Cfg_2</Key>\n    </BuildConfiguration>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "Tests/gtest/configure",
    "content": "#! /bin/sh\n# Guess values for system-dependent variables and create Makefiles.\n# Generated by GNU Autoconf 2.68 for Google C++ Testing Framework 1.7.0.\n#\n# Report bugs to <googletestframework@googlegroups.com>.\n#\n#\n# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,\n# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software\n# Foundation, Inc.\n#\n#\n# This configure script is free software; the Free Software Foundation\n# gives unlimited permission to copy, distribute and modify it.\n## -------------------- ##\n## M4sh Initialization. ##\n## -------------------- ##\n\n# Be more Bourne compatible\nDUALCASE=1; export DUALCASE # for MKS sh\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :\n  emulate sh\n  NULLCMD=:\n  # Pre-4.2 versions of Zsh do word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in #(\n  *posix*) :\n    set -o posix ;; #(\n  *) :\n     ;;\nesac\nfi\n\n\nas_nl='\n'\nexport as_nl\n# Printing a long string crashes Solaris 7 /usr/bin/printf.\nas_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo\n# Prefer a ksh shell builtin over an external printf program on Solaris,\n# but without wasting forks for bash or zsh.\nif test -z \"$BASH_VERSION$ZSH_VERSION\" \\\n    && (test \"X`print -r -- $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='print -r --'\n  as_echo_n='print -rn --'\nelif (test \"X`printf %s $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='printf %s\\n'\n  as_echo_n='printf %s'\nelse\n  if test \"X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`\" = \"X-n $as_echo\"; then\n    as_echo_body='eval /usr/ucb/echo -n \"$1$as_nl\"'\n    as_echo_n='/usr/ucb/echo -n'\n  else\n    as_echo_body='eval expr \"X$1\" : \"X\\\\(.*\\\\)\"'\n    as_echo_n_body='eval\n      arg=$1;\n      case $arg in #(\n      *\"$as_nl\"*)\n\texpr \"X$arg\" : \"X\\\\(.*\\\\)$as_nl\";\n\targ=`expr \"X$arg\" : \".*$as_nl\\\\(.*\\\\)\"`;;\n      esac;\n      expr \"X$arg\" : \"X\\\\(.*\\\\)\" | tr -d \"$as_nl\"\n    '\n    export as_echo_n_body\n    as_echo_n='sh -c $as_echo_n_body as_echo'\n  fi\n  export as_echo_body\n  as_echo='sh -c $as_echo_body as_echo'\nfi\n\n# The user is always right.\nif test \"${PATH_SEPARATOR+set}\" != set; then\n  PATH_SEPARATOR=:\n  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {\n    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||\n      PATH_SEPARATOR=';'\n  }\nfi\n\n\n# IFS\n# We need space, tab and new line, in precisely that order.  Quoting is\n# there to prevent editors from complaining about space-tab.\n# (If _AS_PATH_WALK were called with IFS unset, it would disable word\n# splitting by setting IFS to empty value.)\nIFS=\" \"\"\t$as_nl\"\n\n# Find who we are.  Look in the path if we contain no directory separator.\nas_myself=\ncase $0 in #((\n  *[\\\\/]* ) as_myself=$0 ;;\n  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    test -r \"$as_dir/$0\" && as_myself=$as_dir/$0 && break\n  done\nIFS=$as_save_IFS\n\n     ;;\nesac\n# We did not find ourselves, most probably we were run as `sh COMMAND'\n# in which case we are not to be found in the path.\nif test \"x$as_myself\" = x; then\n  as_myself=$0\nfi\nif test ! -f \"$as_myself\"; then\n  $as_echo \"$as_myself: error: cannot find myself; rerun with an absolute file name\" >&2\n  exit 1\nfi\n\n# Unset variables that we do not need and which cause bugs (e.g. in\n# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the \"|| exit 1\"\n# suppresses any \"Segmentation fault\" message there.  '((' could\n# trigger a bug in pdksh 5.2.14.\nfor as_var in BASH_ENV ENV MAIL MAILPATH\ndo eval test x\\${$as_var+set} = xset \\\n  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :\ndone\nPS1='$ '\nPS2='> '\nPS4='+ '\n\n# NLS nuisances.\nLC_ALL=C\nexport LC_ALL\nLANGUAGE=C\nexport LANGUAGE\n\n# CDPATH.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nif test \"x$CONFIG_SHELL\" = x; then\n  as_bourne_compatible=\"if test -n \\\"\\${ZSH_VERSION+set}\\\" && (emulate sh) >/dev/null 2>&1; then :\n  emulate sh\n  NULLCMD=:\n  # Pre-4.2 versions of Zsh do word splitting on \\${1+\\\"\\$@\\\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '\\${1+\\\"\\$@\\\"}'='\\\"\\$@\\\"'\n  setopt NO_GLOB_SUBST\nelse\n  case \\`(set -o) 2>/dev/null\\` in #(\n  *posix*) :\n    set -o posix ;; #(\n  *) :\n     ;;\nesac\nfi\n\"\n  as_required=\"as_fn_return () { (exit \\$1); }\nas_fn_success () { as_fn_return 0; }\nas_fn_failure () { as_fn_return 1; }\nas_fn_ret_success () { return 0; }\nas_fn_ret_failure () { return 1; }\n\nexitcode=0\nas_fn_success || { exitcode=1; echo as_fn_success failed.; }\nas_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }\nas_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }\nas_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }\nif ( set x; as_fn_ret_success y && test x = \\\"\\$1\\\" ); then :\n\nelse\n  exitcode=1; echo positional parameters were not saved.\nfi\ntest x\\$exitcode = x0 || exit 1\"\n  as_suggested=\"  as_lineno_1=\";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested\" as_lineno_1a=\\$LINENO\n  as_lineno_2=\";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested\" as_lineno_2a=\\$LINENO\n  eval 'test \\\"x\\$as_lineno_1'\\$as_run'\\\" != \\\"x\\$as_lineno_2'\\$as_run'\\\" &&\n  test \\\"x\\`expr \\$as_lineno_1'\\$as_run' + 1\\`\\\" = \\\"x\\$as_lineno_2'\\$as_run'\\\"' || exit 1\n\n  test -n \\\"\\${ZSH_VERSION+set}\\${BASH_VERSION+set}\\\" || (\n    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\n    ECHO=\\$ECHO\\$ECHO\\$ECHO\\$ECHO\\$ECHO\n    ECHO=\\$ECHO\\$ECHO\\$ECHO\\$ECHO\\$ECHO\\$ECHO\n    PATH=/empty FPATH=/empty; export PATH FPATH\n    test \\\"X\\`printf %s \\$ECHO\\`\\\" = \\\"X\\$ECHO\\\" \\\\\n      || test \\\"X\\`print -r -- \\$ECHO\\`\\\" = \\\"X\\$ECHO\\\" ) || exit 1\ntest \\$(( 1 + 1 )) = 2 || exit 1\"\n  if (eval \"$as_required\") 2>/dev/null; then :\n  as_have_required=yes\nelse\n  as_have_required=no\nfi\n  if test x$as_have_required = xyes && (eval \"$as_suggested\") 2>/dev/null; then :\n\nelse\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nas_found=false\nfor as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n  as_found=:\n  case $as_dir in #(\n\t /*)\n\t   for as_base in sh bash ksh sh5; do\n\t     # Try only shells that exist, to save several forks.\n\t     as_shell=$as_dir/$as_base\n\t     if { test -f \"$as_shell\" || test -f \"$as_shell.exe\"; } &&\n\t\t    { $as_echo \"$as_bourne_compatible\"\"$as_required\" | as_run=a \"$as_shell\"; } 2>/dev/null; then :\n  CONFIG_SHELL=$as_shell as_have_required=yes\n\t\t   if { $as_echo \"$as_bourne_compatible\"\"$as_suggested\" | as_run=a \"$as_shell\"; } 2>/dev/null; then :\n  break 2\nfi\nfi\n\t   done;;\n       esac\n  as_found=false\ndone\n$as_found || { if { test -f \"$SHELL\" || test -f \"$SHELL.exe\"; } &&\n\t      { $as_echo \"$as_bourne_compatible\"\"$as_required\" | as_run=a \"$SHELL\"; } 2>/dev/null; then :\n  CONFIG_SHELL=$SHELL as_have_required=yes\nfi; }\nIFS=$as_save_IFS\n\n\n      if test \"x$CONFIG_SHELL\" != x; then :\n  # We cannot yet assume a decent shell, so we have to provide a\n\t# neutralization value for shells without unset; and this also\n\t# works around shells that cannot unset nonexistent variables.\n\t# Preserve -v and -x to the replacement shell.\n\tBASH_ENV=/dev/null\n\tENV=/dev/null\n\t(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV\n\texport CONFIG_SHELL\n\tcase $- in # ((((\n\t  *v*x* | *x*v* ) as_opts=-vx ;;\n\t  *v* ) as_opts=-v ;;\n\t  *x* ) as_opts=-x ;;\n\t  * ) as_opts= ;;\n\tesac\n\texec \"$CONFIG_SHELL\" $as_opts \"$as_myself\" ${1+\"$@\"}\nfi\n\n    if test x$as_have_required = xno; then :\n  $as_echo \"$0: This script requires a shell more modern than all\"\n  $as_echo \"$0: the shells that I found on your system.\"\n  if test x${ZSH_VERSION+set} = xset ; then\n    $as_echo \"$0: In particular, zsh $ZSH_VERSION has bugs and should\"\n    $as_echo \"$0: be upgraded to zsh 4.3.4 or later.\"\n  else\n    $as_echo \"$0: Please tell bug-autoconf@gnu.org and\n$0: googletestframework@googlegroups.com about your system,\n$0: including any error possibly output before this\n$0: message. Then install a modern shell, or manually run\n$0: the script under such a shell if you do have one.\"\n  fi\n  exit 1\nfi\nfi\nfi\nSHELL=${CONFIG_SHELL-/bin/sh}\nexport SHELL\n# Unset more variables known to interfere with behavior of common tools.\nCLICOLOR_FORCE= GREP_OPTIONS=\nunset CLICOLOR_FORCE GREP_OPTIONS\n\n## --------------------- ##\n## M4sh Shell Functions. ##\n## --------------------- ##\n# as_fn_unset VAR\n# ---------------\n# Portably unset VAR.\nas_fn_unset ()\n{\n  { eval $1=; unset $1;}\n}\nas_unset=as_fn_unset\n\n# as_fn_set_status STATUS\n# -----------------------\n# Set $? to STATUS, without forking.\nas_fn_set_status ()\n{\n  return $1\n} # as_fn_set_status\n\n# as_fn_exit STATUS\n# -----------------\n# Exit the shell with STATUS, even in a \"trap 0\" or \"set -e\" context.\nas_fn_exit ()\n{\n  set +e\n  as_fn_set_status $1\n  exit $1\n} # as_fn_exit\n\n# as_fn_mkdir_p\n# -------------\n# Create \"$as_dir\" as a directory, including parents if necessary.\nas_fn_mkdir_p ()\n{\n\n  case $as_dir in #(\n  -*) as_dir=./$as_dir;;\n  esac\n  test -d \"$as_dir\" || eval $as_mkdir_p || {\n    as_dirs=\n    while :; do\n      case $as_dir in #(\n      *\\'*) as_qdir=`$as_echo \"$as_dir\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;; #'(\n      *) as_qdir=$as_dir;;\n      esac\n      as_dirs=\"'$as_qdir' $as_dirs\"\n      as_dir=`$as_dirname -- \"$as_dir\" ||\n$as_expr X\"$as_dir\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)$' \\| \\\n\t X\"$as_dir\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$as_dir\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n      test -d \"$as_dir\" && break\n    done\n    test -z \"$as_dirs\" || eval \"mkdir $as_dirs\"\n  } || test -d \"$as_dir\" || as_fn_error $? \"cannot create directory $as_dir\"\n\n\n} # as_fn_mkdir_p\n# as_fn_append VAR VALUE\n# ----------------------\n# Append the text in VALUE to the end of the definition contained in VAR. Take\n# advantage of any shell optimizations that allow amortized linear growth over\n# repeated appends, instead of the typical quadratic growth present in naive\n# implementations.\nif (eval \"as_var=1; as_var+=2; test x\\$as_var = x12\") 2>/dev/null; then :\n  eval 'as_fn_append ()\n  {\n    eval $1+=\\$2\n  }'\nelse\n  as_fn_append ()\n  {\n    eval $1=\\$$1\\$2\n  }\nfi # as_fn_append\n\n# as_fn_arith ARG...\n# ------------------\n# Perform arithmetic evaluation on the ARGs, and store the result in the\n# global $as_val. Take advantage of shells that can avoid forks. The arguments\n# must be portable across $(()) and expr.\nif (eval \"test \\$(( 1 + 1 )) = 2\") 2>/dev/null; then :\n  eval 'as_fn_arith ()\n  {\n    as_val=$(( $* ))\n  }'\nelse\n  as_fn_arith ()\n  {\n    as_val=`expr \"$@\" || test $? -eq 1`\n  }\nfi # as_fn_arith\n\n\n# as_fn_error STATUS ERROR [LINENO LOG_FD]\n# ----------------------------------------\n# Output \"`basename $0`: error: ERROR\" to stderr. If LINENO and LOG_FD are\n# provided, also output the error to LOG_FD, referencing LINENO. Then exit the\n# script with STATUS, using 1 if that was 0.\nas_fn_error ()\n{\n  as_status=$1; test $as_status -eq 0 && as_status=1\n  if test \"$4\"; then\n    as_lineno=${as_lineno-\"$3\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n    $as_echo \"$as_me:${as_lineno-$LINENO}: error: $2\" >&$4\n  fi\n  $as_echo \"$as_me: error: $2\" >&2\n  as_fn_exit $as_status\n} # as_fn_error\n\nif expr a : '\\(a\\)' >/dev/null 2>&1 &&\n   test \"X`expr 00001 : '.*\\(...\\)'`\" = X001; then\n  as_expr=expr\nelse\n  as_expr=false\nfi\n\nif (basename -- /) >/dev/null 2>&1 && test \"X`basename -- / 2>&1`\" = \"X/\"; then\n  as_basename=basename\nelse\n  as_basename=false\nfi\n\nif (as_dir=`dirname -- /` && test \"X$as_dir\" = X/) >/dev/null 2>&1; then\n  as_dirname=dirname\nelse\n  as_dirname=false\nfi\n\nas_me=`$as_basename -- \"$0\" ||\n$as_expr X/\"$0\" : '.*/\\([^/][^/]*\\)/*$' \\| \\\n\t X\"$0\" : 'X\\(//\\)$' \\| \\\n\t X\"$0\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X/\"$0\" |\n    sed '/^.*\\/\\([^/][^/]*\\)\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n\n# Avoid depending upon Character Ranges.\nas_cr_letters='abcdefghijklmnopqrstuvwxyz'\nas_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nas_cr_Letters=$as_cr_letters$as_cr_LETTERS\nas_cr_digits='0123456789'\nas_cr_alnum=$as_cr_Letters$as_cr_digits\n\n\n  as_lineno_1=$LINENO as_lineno_1a=$LINENO\n  as_lineno_2=$LINENO as_lineno_2a=$LINENO\n  eval 'test \"x$as_lineno_1'$as_run'\" != \"x$as_lineno_2'$as_run'\" &&\n  test \"x`expr $as_lineno_1'$as_run' + 1`\" = \"x$as_lineno_2'$as_run'\"' || {\n  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)\n  sed -n '\n    p\n    /[$]LINENO/=\n  ' <$as_myself |\n    sed '\n      s/[$]LINENO.*/&-/\n      t lineno\n      b\n      :lineno\n      N\n      :loop\n      s/[$]LINENO\\([^'$as_cr_alnum'_].*\\n\\)\\(.*\\)/\\2\\1\\2/\n      t loop\n      s/-\\n.*//\n    ' >$as_me.lineno &&\n  chmod +x \"$as_me.lineno\" ||\n    { $as_echo \"$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell\" >&2; as_fn_exit 1; }\n\n  # Don't try to exec as it changes $[0], causing all sort of problems\n  # (the dirname of $[0] is not the place where we might find the\n  # original and so on.  Autoconf is especially sensitive to this).\n  . \"./$as_me.lineno\"\n  # Exit status is that of the last command.\n  exit\n}\n\nECHO_C= ECHO_N= ECHO_T=\ncase `echo -n x` in #(((((\n-n*)\n  case `echo 'xy\\c'` in\n  *c*) ECHO_T='\t';;\t# ECHO_T is single tab character.\n  xy)  ECHO_C='\\c';;\n  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null\n       ECHO_T='\t';;\n  esac;;\n*)\n  ECHO_N='-n';;\nesac\n\nrm -f conf$$ conf$$.exe conf$$.file\nif test -d conf$$.dir; then\n  rm -f conf$$.dir/conf$$.file\nelse\n  rm -f conf$$.dir\n  mkdir conf$$.dir 2>/dev/null\nfi\nif (echo >conf$$.file) 2>/dev/null; then\n  if ln -s conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s='ln -s'\n    # ... but there are two gotchas:\n    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.\n    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.\n    # In both cases, we have to default to `cp -p'.\n    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||\n      as_ln_s='cp -p'\n  elif ln conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s=ln\n  else\n    as_ln_s='cp -p'\n  fi\nelse\n  as_ln_s='cp -p'\nfi\nrm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file\nrmdir conf$$.dir 2>/dev/null\n\nif mkdir -p . 2>/dev/null; then\n  as_mkdir_p='mkdir -p \"$as_dir\"'\nelse\n  test -d ./-p && rmdir ./-p\n  as_mkdir_p=false\nfi\n\nif test -x / >/dev/null 2>&1; then\n  as_test_x='test -x'\nelse\n  if ls -dL / >/dev/null 2>&1; then\n    as_ls_L_option=L\n  else\n    as_ls_L_option=\n  fi\n  as_test_x='\n    eval sh -c '\\''\n      if test -d \"$1\"; then\n\ttest -d \"$1/.\";\n      else\n\tcase $1 in #(\n\t-*)set \"./$1\";;\n\tesac;\n\tcase `ls -ld'$as_ls_L_option' \"$1\" 2>/dev/null` in #((\n\t???[sx]*):;;*)false;;esac;fi\n    '\\'' sh\n  '\nfi\nas_executable_p=$as_test_x\n\n# Sed expression to map a string onto a valid CPP name.\nas_tr_cpp=\"eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'\"\n\n# Sed expression to map a string onto a valid variable name.\nas_tr_sh=\"eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'\"\n\nSHELL=${CONFIG_SHELL-/bin/sh}\n\n\ntest -n \"$DJDIR\" || exec 7<&0 </dev/null\nexec 6>&1\n\n# Name of the host.\n# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,\n# so uname gets run too.\nac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`\n\n#\n# Initializations.\n#\nac_default_prefix=/usr/local\nac_clean_files=\nac_config_libobj_dir=.\nLIBOBJS=\ncross_compiling=no\nsubdirs=\nMFLAGS=\nMAKEFLAGS=\n\n# Identity of this package.\nPACKAGE_NAME='Google C++ Testing Framework'\nPACKAGE_TARNAME='gtest'\nPACKAGE_VERSION='1.7.0'\nPACKAGE_STRING='Google C++ Testing Framework 1.7.0'\nPACKAGE_BUGREPORT='googletestframework@googlegroups.com'\nPACKAGE_URL=''\n\nac_unique_file=\"./LICENSE\"\n# Factoring default headers for most tests.\nac_includes_default=\"\\\n#include <stdio.h>\n#ifdef HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n#ifdef HAVE_SYS_STAT_H\n# include <sys/stat.h>\n#endif\n#ifdef STDC_HEADERS\n# include <stdlib.h>\n# include <stddef.h>\n#else\n# ifdef HAVE_STDLIB_H\n#  include <stdlib.h>\n# endif\n#endif\n#ifdef HAVE_STRING_H\n# if !defined STDC_HEADERS && defined HAVE_MEMORY_H\n#  include <memory.h>\n# endif\n# include <string.h>\n#endif\n#ifdef HAVE_STRINGS_H\n# include <strings.h>\n#endif\n#ifdef HAVE_INTTYPES_H\n# include <inttypes.h>\n#endif\n#ifdef HAVE_STDINT_H\n# include <stdint.h>\n#endif\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\"\n\nac_subst_vars='am__EXEEXT_FALSE\nam__EXEEXT_TRUE\nLTLIBOBJS\nLIBOBJS\nHAVE_PTHREADS_FALSE\nHAVE_PTHREADS_TRUE\nPTHREAD_CFLAGS\nPTHREAD_LIBS\nPTHREAD_CC\nacx_pthread_config\nHAVE_PYTHON_FALSE\nHAVE_PYTHON_TRUE\nPYTHON\nCXXCPP\nCPP\nOTOOL64\nOTOOL\nLIPO\nNMEDIT\nDSYMUTIL\nMANIFEST_TOOL\nRANLIB\nac_ct_AR\nAR\nDLLTOOL\nOBJDUMP\nLN_S\nNM\nac_ct_DUMPBIN\nDUMPBIN\nLD\nFGREP\nEGREP\nGREP\nSED\nhost_os\nhost_vendor\nhost_cpu\nhost\nbuild_os\nbuild_vendor\nbuild_cpu\nbuild\nLIBTOOL\nam__fastdepCXX_FALSE\nam__fastdepCXX_TRUE\nCXXDEPMODE\nac_ct_CXX\nCXXFLAGS\nCXX\nam__fastdepCC_FALSE\nam__fastdepCC_TRUE\nCCDEPMODE\nam__nodep\nAMDEPBACKSLASH\nAMDEP_FALSE\nAMDEP_TRUE\nam__quote\nam__include\nDEPDIR\nOBJEXT\nEXEEXT\nac_ct_CC\nCPPFLAGS\nLDFLAGS\nCFLAGS\nCC\nam__untar\nam__tar\nAMTAR\nam__leading_dot\nSET_MAKE\nAWK\nmkdir_p\nMKDIR_P\nINSTALL_STRIP_PROGRAM\nSTRIP\ninstall_sh\nMAKEINFO\nAUTOHEADER\nAUTOMAKE\nAUTOCONF\nACLOCAL\nVERSION\nPACKAGE\nCYGPATH_W\nam__isrc\nINSTALL_DATA\nINSTALL_SCRIPT\nINSTALL_PROGRAM\ntarget_alias\nhost_alias\nbuild_alias\nLIBS\nECHO_T\nECHO_N\nECHO_C\nDEFS\nmandir\nlocaledir\nlibdir\npsdir\npdfdir\ndvidir\nhtmldir\ninfodir\ndocdir\noldincludedir\nincludedir\nlocalstatedir\nsharedstatedir\nsysconfdir\ndatadir\ndatarootdir\nlibexecdir\nsbindir\nbindir\nprogram_transform_name\nprefix\nexec_prefix\nPACKAGE_URL\nPACKAGE_BUGREPORT\nPACKAGE_STRING\nPACKAGE_VERSION\nPACKAGE_TARNAME\nPACKAGE_NAME\nPATH_SEPARATOR\nSHELL'\nac_subst_files=''\nac_user_opts='\nenable_option_checking\nenable_dependency_tracking\nenable_shared\nenable_static\nwith_pic\nenable_fast_install\nwith_gnu_ld\nwith_sysroot\nenable_libtool_lock\nwith_pthreads\n'\n      ac_precious_vars='build_alias\nhost_alias\ntarget_alias\nCC\nCFLAGS\nLDFLAGS\nLIBS\nCPPFLAGS\nCXX\nCXXFLAGS\nCCC\nCPP\nCXXCPP'\n\n\n# Initialize some variables set by options.\nac_init_help=\nac_init_version=false\nac_unrecognized_opts=\nac_unrecognized_sep=\n# The variables have the same names as the options, with\n# dashes changed to underlines.\ncache_file=/dev/null\nexec_prefix=NONE\nno_create=\nno_recursion=\nprefix=NONE\nprogram_prefix=NONE\nprogram_suffix=NONE\nprogram_transform_name=s,x,x,\nsilent=\nsite=\nsrcdir=\nverbose=\nx_includes=NONE\nx_libraries=NONE\n\n# Installation directory options.\n# These are left unexpanded so users can \"make install exec_prefix=/foo\"\n# and all the variables that are supposed to be based on exec_prefix\n# by default will actually change.\n# Use braces instead of parens because sh, perl, etc. also accept them.\n# (The list follows the same order as the GNU Coding Standards.)\nbindir='${exec_prefix}/bin'\nsbindir='${exec_prefix}/sbin'\nlibexecdir='${exec_prefix}/libexec'\ndatarootdir='${prefix}/share'\ndatadir='${datarootdir}'\nsysconfdir='${prefix}/etc'\nsharedstatedir='${prefix}/com'\nlocalstatedir='${prefix}/var'\nincludedir='${prefix}/include'\noldincludedir='/usr/include'\ndocdir='${datarootdir}/doc/${PACKAGE_TARNAME}'\ninfodir='${datarootdir}/info'\nhtmldir='${docdir}'\ndvidir='${docdir}'\npdfdir='${docdir}'\npsdir='${docdir}'\nlibdir='${exec_prefix}/lib'\nlocaledir='${datarootdir}/locale'\nmandir='${datarootdir}/man'\n\nac_prev=\nac_dashdash=\nfor ac_option\ndo\n  # If the previous option needs an argument, assign it.\n  if test -n \"$ac_prev\"; then\n    eval $ac_prev=\\$ac_option\n    ac_prev=\n    continue\n  fi\n\n  case $ac_option in\n  *=?*) ac_optarg=`expr \"X$ac_option\" : '[^=]*=\\(.*\\)'` ;;\n  *=)   ac_optarg= ;;\n  *)    ac_optarg=yes ;;\n  esac\n\n  # Accept the important Cygnus configure options, so we can diagnose typos.\n\n  case $ac_dashdash$ac_option in\n  --)\n    ac_dashdash=yes ;;\n\n  -bindir | --bindir | --bindi | --bind | --bin | --bi)\n    ac_prev=bindir ;;\n  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)\n    bindir=$ac_optarg ;;\n\n  -build | --build | --buil | --bui | --bu)\n    ac_prev=build_alias ;;\n  -build=* | --build=* | --buil=* | --bui=* | --bu=*)\n    build_alias=$ac_optarg ;;\n\n  -cache-file | --cache-file | --cache-fil | --cache-fi \\\n  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)\n    ac_prev=cache_file ;;\n  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \\\n  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)\n    cache_file=$ac_optarg ;;\n\n  --config-cache | -C)\n    cache_file=config.cache ;;\n\n  -datadir | --datadir | --datadi | --datad)\n    ac_prev=datadir ;;\n  -datadir=* | --datadir=* | --datadi=* | --datad=*)\n    datadir=$ac_optarg ;;\n\n  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \\\n  | --dataroo | --dataro | --datar)\n    ac_prev=datarootdir ;;\n  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \\\n  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)\n    datarootdir=$ac_optarg ;;\n\n  -disable-* | --disable-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*disable-\\(.*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error $? \"invalid feature name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"enable_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval enable_$ac_useropt=no ;;\n\n  -docdir | --docdir | --docdi | --doc | --do)\n    ac_prev=docdir ;;\n  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)\n    docdir=$ac_optarg ;;\n\n  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)\n    ac_prev=dvidir ;;\n  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)\n    dvidir=$ac_optarg ;;\n\n  -enable-* | --enable-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*enable-\\([^=]*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error $? \"invalid feature name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"enable_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval enable_$ac_useropt=\\$ac_optarg ;;\n\n  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \\\n  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \\\n  | --exec | --exe | --ex)\n    ac_prev=exec_prefix ;;\n  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \\\n  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \\\n  | --exec=* | --exe=* | --ex=*)\n    exec_prefix=$ac_optarg ;;\n\n  -gas | --gas | --ga | --g)\n    # Obsolete; use --with-gas.\n    with_gas=yes ;;\n\n  -help | --help | --hel | --he | -h)\n    ac_init_help=long ;;\n  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)\n    ac_init_help=recursive ;;\n  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)\n    ac_init_help=short ;;\n\n  -host | --host | --hos | --ho)\n    ac_prev=host_alias ;;\n  -host=* | --host=* | --hos=* | --ho=*)\n    host_alias=$ac_optarg ;;\n\n  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)\n    ac_prev=htmldir ;;\n  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \\\n  | --ht=*)\n    htmldir=$ac_optarg ;;\n\n  -includedir | --includedir | --includedi | --included | --include \\\n  | --includ | --inclu | --incl | --inc)\n    ac_prev=includedir ;;\n  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \\\n  | --includ=* | --inclu=* | --incl=* | --inc=*)\n    includedir=$ac_optarg ;;\n\n  -infodir | --infodir | --infodi | --infod | --info | --inf)\n    ac_prev=infodir ;;\n  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)\n    infodir=$ac_optarg ;;\n\n  -libdir | --libdir | --libdi | --libd)\n    ac_prev=libdir ;;\n  -libdir=* | --libdir=* | --libdi=* | --libd=*)\n    libdir=$ac_optarg ;;\n\n  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \\\n  | --libexe | --libex | --libe)\n    ac_prev=libexecdir ;;\n  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \\\n  | --libexe=* | --libex=* | --libe=*)\n    libexecdir=$ac_optarg ;;\n\n  -localedir | --localedir | --localedi | --localed | --locale)\n    ac_prev=localedir ;;\n  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)\n    localedir=$ac_optarg ;;\n\n  -localstatedir | --localstatedir | --localstatedi | --localstated \\\n  | --localstate | --localstat | --localsta | --localst | --locals)\n    ac_prev=localstatedir ;;\n  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \\\n  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)\n    localstatedir=$ac_optarg ;;\n\n  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)\n    ac_prev=mandir ;;\n  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)\n    mandir=$ac_optarg ;;\n\n  -nfp | --nfp | --nf)\n    # Obsolete; use --without-fp.\n    with_fp=no ;;\n\n  -no-create | --no-create | --no-creat | --no-crea | --no-cre \\\n  | --no-cr | --no-c | -n)\n    no_create=yes ;;\n\n  -no-recursion | --no-recursion | --no-recursio | --no-recursi \\\n  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)\n    no_recursion=yes ;;\n\n  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \\\n  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \\\n  | --oldin | --oldi | --old | --ol | --o)\n    ac_prev=oldincludedir ;;\n  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \\\n  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \\\n  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)\n    oldincludedir=$ac_optarg ;;\n\n  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)\n    ac_prev=prefix ;;\n  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)\n    prefix=$ac_optarg ;;\n\n  -program-prefix | --program-prefix | --program-prefi | --program-pref \\\n  | --program-pre | --program-pr | --program-p)\n    ac_prev=program_prefix ;;\n  -program-prefix=* | --program-prefix=* | --program-prefi=* \\\n  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)\n    program_prefix=$ac_optarg ;;\n\n  -program-suffix | --program-suffix | --program-suffi | --program-suff \\\n  | --program-suf | --program-su | --program-s)\n    ac_prev=program_suffix ;;\n  -program-suffix=* | --program-suffix=* | --program-suffi=* \\\n  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)\n    program_suffix=$ac_optarg ;;\n\n  -program-transform-name | --program-transform-name \\\n  | --program-transform-nam | --program-transform-na \\\n  | --program-transform-n | --program-transform- \\\n  | --program-transform | --program-transfor \\\n  | --program-transfo | --program-transf \\\n  | --program-trans | --program-tran \\\n  | --progr-tra | --program-tr | --program-t)\n    ac_prev=program_transform_name ;;\n  -program-transform-name=* | --program-transform-name=* \\\n  | --program-transform-nam=* | --program-transform-na=* \\\n  | --program-transform-n=* | --program-transform-=* \\\n  | --program-transform=* | --program-transfor=* \\\n  | --program-transfo=* | --program-transf=* \\\n  | --program-trans=* | --program-tran=* \\\n  | --progr-tra=* | --program-tr=* | --program-t=*)\n    program_transform_name=$ac_optarg ;;\n\n  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)\n    ac_prev=pdfdir ;;\n  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)\n    pdfdir=$ac_optarg ;;\n\n  -psdir | --psdir | --psdi | --psd | --ps)\n    ac_prev=psdir ;;\n  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)\n    psdir=$ac_optarg ;;\n\n  -q | -quiet | --quiet | --quie | --qui | --qu | --q \\\n  | -silent | --silent | --silen | --sile | --sil)\n    silent=yes ;;\n\n  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)\n    ac_prev=sbindir ;;\n  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \\\n  | --sbi=* | --sb=*)\n    sbindir=$ac_optarg ;;\n\n  -sharedstatedir | --sharedstatedir | --sharedstatedi \\\n  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \\\n  | --sharedst | --shareds | --shared | --share | --shar \\\n  | --sha | --sh)\n    ac_prev=sharedstatedir ;;\n  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \\\n  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \\\n  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \\\n  | --sha=* | --sh=*)\n    sharedstatedir=$ac_optarg ;;\n\n  -site | --site | --sit)\n    ac_prev=site ;;\n  -site=* | --site=* | --sit=*)\n    site=$ac_optarg ;;\n\n  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)\n    ac_prev=srcdir ;;\n  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)\n    srcdir=$ac_optarg ;;\n\n  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \\\n  | --syscon | --sysco | --sysc | --sys | --sy)\n    ac_prev=sysconfdir ;;\n  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \\\n  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)\n    sysconfdir=$ac_optarg ;;\n\n  -target | --target | --targe | --targ | --tar | --ta | --t)\n    ac_prev=target_alias ;;\n  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)\n    target_alias=$ac_optarg ;;\n\n  -v | -verbose | --verbose | --verbos | --verbo | --verb)\n    verbose=yes ;;\n\n  -version | --version | --versio | --versi | --vers | -V)\n    ac_init_version=: ;;\n\n  -with-* | --with-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*with-\\([^=]*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error $? \"invalid package name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"with_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval with_$ac_useropt=\\$ac_optarg ;;\n\n  -without-* | --without-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*without-\\(.*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error $? \"invalid package name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"with_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval with_$ac_useropt=no ;;\n\n  --x)\n    # Obsolete; use --with-x.\n    with_x=yes ;;\n\n  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \\\n  | --x-incl | --x-inc | --x-in | --x-i)\n    ac_prev=x_includes ;;\n  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \\\n  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)\n    x_includes=$ac_optarg ;;\n\n  -x-libraries | --x-libraries | --x-librarie | --x-librari \\\n  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)\n    ac_prev=x_libraries ;;\n  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \\\n  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)\n    x_libraries=$ac_optarg ;;\n\n  -*) as_fn_error $? \"unrecognized option: \\`$ac_option'\nTry \\`$0 --help' for more information\"\n    ;;\n\n  *=*)\n    ac_envvar=`expr \"x$ac_option\" : 'x\\([^=]*\\)='`\n    # Reject names that are not valid shell variable names.\n    case $ac_envvar in #(\n      '' | [0-9]* | *[!_$as_cr_alnum]* )\n      as_fn_error $? \"invalid variable name: \\`$ac_envvar'\" ;;\n    esac\n    eval $ac_envvar=\\$ac_optarg\n    export $ac_envvar ;;\n\n  *)\n    # FIXME: should be removed in autoconf 3.0.\n    $as_echo \"$as_me: WARNING: you should use --build, --host, --target\" >&2\n    expr \"x$ac_option\" : \".*[^-._$as_cr_alnum]\" >/dev/null &&\n      $as_echo \"$as_me: WARNING: invalid host type: $ac_option\" >&2\n    : \"${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}\"\n    ;;\n\n  esac\ndone\n\nif test -n \"$ac_prev\"; then\n  ac_option=--`echo $ac_prev | sed 's/_/-/g'`\n  as_fn_error $? \"missing argument to $ac_option\"\nfi\n\nif test -n \"$ac_unrecognized_opts\"; then\n  case $enable_option_checking in\n    no) ;;\n    fatal) as_fn_error $? \"unrecognized options: $ac_unrecognized_opts\" ;;\n    *)     $as_echo \"$as_me: WARNING: unrecognized options: $ac_unrecognized_opts\" >&2 ;;\n  esac\nfi\n\n# Check all directory arguments for consistency.\nfor ac_var in\texec_prefix prefix bindir sbindir libexecdir datarootdir \\\n\t\tdatadir sysconfdir sharedstatedir localstatedir includedir \\\n\t\toldincludedir docdir infodir htmldir dvidir pdfdir psdir \\\n\t\tlibdir localedir mandir\ndo\n  eval ac_val=\\$$ac_var\n  # Remove trailing slashes.\n  case $ac_val in\n    */ )\n      ac_val=`expr \"X$ac_val\" : 'X\\(.*[^/]\\)' \\| \"X$ac_val\" : 'X\\(.*\\)'`\n      eval $ac_var=\\$ac_val;;\n  esac\n  # Be sure to have absolute directory names.\n  case $ac_val in\n    [\\\\/$]* | ?:[\\\\/]* )  continue;;\n    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;\n  esac\n  as_fn_error $? \"expected an absolute directory name for --$ac_var: $ac_val\"\ndone\n\n# There might be people who depend on the old broken behavior: `$host'\n# used to hold the argument of --host etc.\n# FIXME: To remove some day.\nbuild=$build_alias\nhost=$host_alias\ntarget=$target_alias\n\n# FIXME: To remove some day.\nif test \"x$host_alias\" != x; then\n  if test \"x$build_alias\" = x; then\n    cross_compiling=maybe\n    $as_echo \"$as_me: WARNING: if you wanted to set the --build type, don't use --host.\n    If a cross compiler is detected then cross compile mode will be used\" >&2\n  elif test \"x$build_alias\" != \"x$host_alias\"; then\n    cross_compiling=yes\n  fi\nfi\n\nac_tool_prefix=\ntest -n \"$host_alias\" && ac_tool_prefix=$host_alias-\n\ntest \"$silent\" = yes && exec 6>/dev/null\n\n\nac_pwd=`pwd` && test -n \"$ac_pwd\" &&\nac_ls_di=`ls -di .` &&\nac_pwd_ls_di=`cd \"$ac_pwd\" && ls -di .` ||\n  as_fn_error $? \"working directory cannot be determined\"\ntest \"X$ac_ls_di\" = \"X$ac_pwd_ls_di\" ||\n  as_fn_error $? \"pwd does not report name of working directory\"\n\n\n# Find the source files, if location was not specified.\nif test -z \"$srcdir\"; then\n  ac_srcdir_defaulted=yes\n  # Try the directory containing this script, then the parent directory.\n  ac_confdir=`$as_dirname -- \"$as_myself\" ||\n$as_expr X\"$as_myself\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$as_myself\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$as_myself\" : 'X\\(//\\)$' \\| \\\n\t X\"$as_myself\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$as_myself\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n  srcdir=$ac_confdir\n  if test ! -r \"$srcdir/$ac_unique_file\"; then\n    srcdir=..\n  fi\nelse\n  ac_srcdir_defaulted=no\nfi\nif test ! -r \"$srcdir/$ac_unique_file\"; then\n  test \"$ac_srcdir_defaulted\" = yes && srcdir=\"$ac_confdir or ..\"\n  as_fn_error $? \"cannot find sources ($ac_unique_file) in $srcdir\"\nfi\nac_msg=\"sources are in $srcdir, but \\`cd $srcdir' does not work\"\nac_abs_confdir=`(\n\tcd \"$srcdir\" && test -r \"./$ac_unique_file\" || as_fn_error $? \"$ac_msg\"\n\tpwd)`\n# When building in place, set srcdir=.\nif test \"$ac_abs_confdir\" = \"$ac_pwd\"; then\n  srcdir=.\nfi\n# Remove unnecessary trailing slashes from srcdir.\n# Double slashes in file names in object file debugging info\n# mess up M-x gdb in Emacs.\ncase $srcdir in\n*/) srcdir=`expr \"X$srcdir\" : 'X\\(.*[^/]\\)' \\| \"X$srcdir\" : 'X\\(.*\\)'`;;\nesac\nfor ac_var in $ac_precious_vars; do\n  eval ac_env_${ac_var}_set=\\${${ac_var}+set}\n  eval ac_env_${ac_var}_value=\\$${ac_var}\n  eval ac_cv_env_${ac_var}_set=\\${${ac_var}+set}\n  eval ac_cv_env_${ac_var}_value=\\$${ac_var}\ndone\n\n#\n# Report the --help message.\n#\nif test \"$ac_init_help\" = \"long\"; then\n  # Omit some internal or obsolete options to make the list less imposing.\n  # This message is too long to be a string in the A/UX 3.1 sh.\n  cat <<_ACEOF\n\\`configure' configures Google C++ Testing Framework 1.7.0 to adapt to many kinds of systems.\n\nUsage: $0 [OPTION]... [VAR=VALUE]...\n\nTo assign environment variables (e.g., CC, CFLAGS...), specify them as\nVAR=VALUE.  See below for descriptions of some of the useful variables.\n\nDefaults for the options are specified in brackets.\n\nConfiguration:\n  -h, --help              display this help and exit\n      --help=short        display options specific to this package\n      --help=recursive    display the short help of all the included packages\n  -V, --version           display version information and exit\n  -q, --quiet, --silent   do not print \\`checking ...' messages\n      --cache-file=FILE   cache test results in FILE [disabled]\n  -C, --config-cache      alias for \\`--cache-file=config.cache'\n  -n, --no-create         do not create output files\n      --srcdir=DIR        find the sources in DIR [configure dir or \\`..']\n\nInstallation directories:\n  --prefix=PREFIX         install architecture-independent files in PREFIX\n                          [$ac_default_prefix]\n  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX\n                          [PREFIX]\n\nBy default, \\`make install' will install all the files in\n\\`$ac_default_prefix/bin', \\`$ac_default_prefix/lib' etc.  You can specify\nan installation prefix other than \\`$ac_default_prefix' using \\`--prefix',\nfor instance \\`--prefix=\\$HOME'.\n\nFor better control, use the options below.\n\nFine tuning of the installation directories:\n  --bindir=DIR            user executables [EPREFIX/bin]\n  --sbindir=DIR           system admin executables [EPREFIX/sbin]\n  --libexecdir=DIR        program executables [EPREFIX/libexec]\n  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]\n  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]\n  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]\n  --libdir=DIR            object code libraries [EPREFIX/lib]\n  --includedir=DIR        C header files [PREFIX/include]\n  --oldincludedir=DIR     C header files for non-gcc [/usr/include]\n  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]\n  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]\n  --infodir=DIR           info documentation [DATAROOTDIR/info]\n  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]\n  --mandir=DIR            man documentation [DATAROOTDIR/man]\n  --docdir=DIR            documentation root [DATAROOTDIR/doc/gtest]\n  --htmldir=DIR           html documentation [DOCDIR]\n  --dvidir=DIR            dvi documentation [DOCDIR]\n  --pdfdir=DIR            pdf documentation [DOCDIR]\n  --psdir=DIR             ps documentation [DOCDIR]\n_ACEOF\n\n  cat <<\\_ACEOF\n\nProgram names:\n  --program-prefix=PREFIX            prepend PREFIX to installed program names\n  --program-suffix=SUFFIX            append SUFFIX to installed program names\n  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names\n\nSystem types:\n  --build=BUILD     configure for building on BUILD [guessed]\n  --host=HOST       cross-compile to build programs to run on HOST [BUILD]\n_ACEOF\nfi\n\nif test -n \"$ac_init_help\"; then\n  case $ac_init_help in\n     short | recursive ) echo \"Configuration of Google C++ Testing Framework 1.7.0:\";;\n   esac\n  cat <<\\_ACEOF\n\nOptional Features:\n  --disable-option-checking  ignore unrecognized --enable/--with options\n  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)\n  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]\n  --disable-dependency-tracking  speeds up one-time build\n  --enable-dependency-tracking   do not reject slow dependency extractors\n  --enable-shared[=PKGS]  build shared libraries [default=yes]\n  --enable-static[=PKGS]  build static libraries [default=yes]\n  --enable-fast-install[=PKGS]\n                          optimize for fast installation [default=yes]\n  --disable-libtool-lock  avoid locking (might break parallel builds)\n\nOptional Packages:\n  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]\n  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)\n  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use\n                          both]\n  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]\n  --with-sysroot=DIR Search for dependent libraries within DIR\n                        (or the compiler's sysroot if not specified).\n  --with-pthreads         use pthreads (default is yes)\n\nSome influential environment variables:\n  CC          C compiler command\n  CFLAGS      C compiler flags\n  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a\n              nonstandard directory <lib dir>\n  LIBS        libraries to pass to the linker, e.g. -l<library>\n  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if\n              you have headers in a nonstandard directory <include dir>\n  CXX         C++ compiler command\n  CXXFLAGS    C++ compiler flags\n  CPP         C preprocessor\n  CXXCPP      C++ preprocessor\n\nUse these variables to override the choices made by `configure' or to help\nit to find libraries and programs with nonstandard names/locations.\n\nReport bugs to <googletestframework@googlegroups.com>.\n_ACEOF\nac_status=$?\nfi\n\nif test \"$ac_init_help\" = \"recursive\"; then\n  # If there are subdirs, report their specific --help.\n  for ac_dir in : $ac_subdirs_all; do test \"x$ac_dir\" = x: && continue\n    test -d \"$ac_dir\" ||\n      { cd \"$srcdir\" && ac_pwd=`pwd` && srcdir=. && test -d \"$ac_dir\"; } ||\n      continue\n    ac_builddir=.\n\ncase \"$ac_dir\" in\n.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;\n*)\n  ac_dir_suffix=/`$as_echo \"$ac_dir\" | sed 's|^\\.[\\\\/]||'`\n  # A \"..\" for each directory in $ac_dir_suffix.\n  ac_top_builddir_sub=`$as_echo \"$ac_dir_suffix\" | sed 's|/[^\\\\/]*|/..|g;s|/||'`\n  case $ac_top_builddir_sub in\n  \"\") ac_top_builddir_sub=. ac_top_build_prefix= ;;\n  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;\n  esac ;;\nesac\nac_abs_top_builddir=$ac_pwd\nac_abs_builddir=$ac_pwd$ac_dir_suffix\n# for backward compatibility:\nac_top_builddir=$ac_top_build_prefix\n\ncase $srcdir in\n  .)  # We are building in place.\n    ac_srcdir=.\n    ac_top_srcdir=$ac_top_builddir_sub\n    ac_abs_top_srcdir=$ac_pwd ;;\n  [\\\\/]* | ?:[\\\\/]* )  # Absolute name.\n    ac_srcdir=$srcdir$ac_dir_suffix;\n    ac_top_srcdir=$srcdir\n    ac_abs_top_srcdir=$srcdir ;;\n  *) # Relative name.\n    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix\n    ac_top_srcdir=$ac_top_build_prefix$srcdir\n    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;\nesac\nac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix\n\n    cd \"$ac_dir\" || { ac_status=$?; continue; }\n    # Check for guested configure.\n    if test -f \"$ac_srcdir/configure.gnu\"; then\n      echo &&\n      $SHELL \"$ac_srcdir/configure.gnu\" --help=recursive\n    elif test -f \"$ac_srcdir/configure\"; then\n      echo &&\n      $SHELL \"$ac_srcdir/configure\" --help=recursive\n    else\n      $as_echo \"$as_me: WARNING: no configuration information is in $ac_dir\" >&2\n    fi || ac_status=$?\n    cd \"$ac_pwd\" || { ac_status=$?; break; }\n  done\nfi\n\ntest -n \"$ac_init_help\" && exit $ac_status\nif $ac_init_version; then\n  cat <<\\_ACEOF\nGoogle C++ Testing Framework configure 1.7.0\ngenerated by GNU Autoconf 2.68\n\nCopyright (C) 2010 Free Software Foundation, Inc.\nThis configure script is free software; the Free Software Foundation\ngives unlimited permission to copy, distribute and modify it.\n_ACEOF\n  exit\nfi\n\n## ------------------------ ##\n## Autoconf initialization. ##\n## ------------------------ ##\n\n# ac_fn_c_try_compile LINENO\n# --------------------------\n# Try to compile conftest.$ac_ext, and return whether this succeeded.\nac_fn_c_try_compile ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext\n  if { { ac_try=\"$ac_compile\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compile\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_c_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest.$ac_objext; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_c_try_compile\n\n# ac_fn_cxx_try_compile LINENO\n# ----------------------------\n# Try to compile conftest.$ac_ext, and return whether this succeeded.\nac_fn_cxx_try_compile ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext\n  if { { ac_try=\"$ac_compile\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compile\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_cxx_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest.$ac_objext; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_cxx_try_compile\n\n# ac_fn_c_try_link LINENO\n# -----------------------\n# Try to link conftest.$ac_ext, and return whether this succeeded.\nac_fn_c_try_link ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext conftest$ac_exeext\n  if { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_c_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest$ac_exeext && {\n\t test \"$cross_compiling\" = yes ||\n\t $as_test_x conftest$ac_exeext\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information\n  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would\n  # interfere with the next link command; also delete a directory that is\n  # left behind by Apple's compiler.  We do this before executing the actions.\n  rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_c_try_link\n\n# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES\n# -------------------------------------------------------\n# Tests whether HEADER exists and can be compiled using the include files in\n# INCLUDES, setting the cache variable VAR accordingly.\nac_fn_c_check_header_compile ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif eval \\${$3+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\n#include <$2>\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  eval \"$3=yes\"\nelse\n  eval \"$3=no\"\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n\n} # ac_fn_c_check_header_compile\n\n# ac_fn_c_try_cpp LINENO\n# ----------------------\n# Try to preprocess conftest.$ac_ext, and return whether this succeeded.\nac_fn_c_try_cpp ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { { ac_try=\"$ac_cpp conftest.$ac_ext\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_cpp conftest.$ac_ext\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } > conftest.i && {\n\t test -z \"$ac_c_preproc_warn_flag$ac_c_werror_flag\" ||\n\t test ! -s conftest.err\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n    ac_retval=1\nfi\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_c_try_cpp\n\n# ac_fn_c_try_run LINENO\n# ----------------------\n# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes\n# that executables *can* be run.\nac_fn_c_try_run ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'\n  { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: program exited with status $ac_status\" >&5\n       $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n       ac_retval=$ac_status\nfi\n  rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_c_try_run\n\n# ac_fn_c_check_func LINENO FUNC VAR\n# ----------------------------------\n# Tests whether FUNC exists, setting the cache variable VAR accordingly\nac_fn_c_check_func ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif eval \\${$3+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n/* Define $2 to an innocuous variant, in case <limits.h> declares $2.\n   For example, HP-UX 11i <limits.h> declares gettimeofday.  */\n#define $2 innocuous_$2\n\n/* System header to define __stub macros and hopefully few prototypes,\n    which can conflict with char $2 (); below.\n    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n    <limits.h> exists even on freestanding compilers.  */\n\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\n#undef $2\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar $2 ();\n/* The GNU C library defines this for functions which it implements\n    to always fail with ENOSYS.  Some functions are actually named\n    something starting with __ and the normal name is an alias.  */\n#if defined __stub_$2 || defined __stub___$2\nchoke me\n#endif\n\nint\nmain ()\n{\nreturn $2 ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  eval \"$3=yes\"\nelse\n  eval \"$3=no\"\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n\n} # ac_fn_c_check_func\n\n# ac_fn_cxx_try_cpp LINENO\n# ------------------------\n# Try to preprocess conftest.$ac_ext, and return whether this succeeded.\nac_fn_cxx_try_cpp ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { { ac_try=\"$ac_cpp conftest.$ac_ext\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_cpp conftest.$ac_ext\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } > conftest.i && {\n\t test -z \"$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag\" ||\n\t test ! -s conftest.err\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n    ac_retval=1\nfi\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_cxx_try_cpp\n\n# ac_fn_cxx_try_link LINENO\n# -------------------------\n# Try to link conftest.$ac_ext, and return whether this succeeded.\nac_fn_cxx_try_link ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext conftest$ac_exeext\n  if { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_cxx_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest$ac_exeext && {\n\t test \"$cross_compiling\" = yes ||\n\t $as_test_x conftest$ac_exeext\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information\n  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would\n  # interfere with the next link command; also delete a directory that is\n  # left behind by Apple's compiler.  We do this before executing the actions.\n  rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno\n  as_fn_set_status $ac_retval\n\n} # ac_fn_cxx_try_link\ncat >config.log <<_ACEOF\nThis file contains any messages produced by compilers while\nrunning configure, to aid debugging if configure makes a mistake.\n\nIt was created by Google C++ Testing Framework $as_me 1.7.0, which was\ngenerated by GNU Autoconf 2.68.  Invocation command line was\n\n  $ $0 $@\n\n_ACEOF\nexec 5>>config.log\n{\ncat <<_ASUNAME\n## --------- ##\n## Platform. ##\n## --------- ##\n\nhostname = `(hostname || uname -n) 2>/dev/null | sed 1q`\nuname -m = `(uname -m) 2>/dev/null || echo unknown`\nuname -r = `(uname -r) 2>/dev/null || echo unknown`\nuname -s = `(uname -s) 2>/dev/null || echo unknown`\nuname -v = `(uname -v) 2>/dev/null || echo unknown`\n\n/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`\n/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`\n\n/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`\n/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`\n/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`\n/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`\n/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`\n/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`\n/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`\n\n_ASUNAME\n\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    $as_echo \"PATH: $as_dir\"\n  done\nIFS=$as_save_IFS\n\n} >&5\n\ncat >&5 <<_ACEOF\n\n\n## ----------- ##\n## Core tests. ##\n## ----------- ##\n\n_ACEOF\n\n\n# Keep a trace of the command line.\n# Strip out --no-create and --no-recursion so they do not pile up.\n# Strip out --silent because we don't want to record it for future runs.\n# Also quote any args containing shell meta-characters.\n# Make two passes to allow for proper duplicate-argument suppression.\nac_configure_args=\nac_configure_args0=\nac_configure_args1=\nac_must_keep_next=false\nfor ac_pass in 1 2\ndo\n  for ac_arg\n  do\n    case $ac_arg in\n    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;\n    -q | -quiet | --quiet | --quie | --qui | --qu | --q \\\n    | -silent | --silent | --silen | --sile | --sil)\n      continue ;;\n    *\\'*)\n      ac_arg=`$as_echo \"$ac_arg\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    esac\n    case $ac_pass in\n    1) as_fn_append ac_configure_args0 \" '$ac_arg'\" ;;\n    2)\n      as_fn_append ac_configure_args1 \" '$ac_arg'\"\n      if test $ac_must_keep_next = true; then\n\tac_must_keep_next=false # Got value, back to normal.\n      else\n\tcase $ac_arg in\n\t  *=* | --config-cache | -C | -disable-* | --disable-* \\\n\t  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \\\n\t  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \\\n\t  | -with-* | --with-* | -without-* | --without-* | --x)\n\t    case \"$ac_configure_args0 \" in\n\t      \"$ac_configure_args1\"*\" '$ac_arg' \"* ) continue ;;\n\t    esac\n\t    ;;\n\t  -* ) ac_must_keep_next=true ;;\n\tesac\n      fi\n      as_fn_append ac_configure_args \" '$ac_arg'\"\n      ;;\n    esac\n  done\ndone\n{ ac_configure_args0=; unset ac_configure_args0;}\n{ ac_configure_args1=; unset ac_configure_args1;}\n\n# When interrupted or exit'd, cleanup temporary files, and complete\n# config.log.  We remove comments because anyway the quotes in there\n# would cause problems or look ugly.\n# WARNING: Use '\\'' to represent an apostrophe within the trap.\n# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.\ntrap 'exit_status=$?\n  # Save into config.log some information that might help in debugging.\n  {\n    echo\n\n    $as_echo \"## ---------------- ##\n## Cache variables. ##\n## ---------------- ##\"\n    echo\n    # The following way of writing the cache mishandles newlines in values,\n(\n  for ac_var in `(set) 2>&1 | sed -n '\\''s/^\\([a-zA-Z_][a-zA-Z0-9_]*\\)=.*/\\1/p'\\''`; do\n    eval ac_val=\\$$ac_var\n    case $ac_val in #(\n    *${as_nl}*)\n      case $ac_var in #(\n      *_cv_*) { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline\" >&5\n$as_echo \"$as_me: WARNING: cache variable $ac_var contains a newline\" >&2;} ;;\n      esac\n      case $ac_var in #(\n      _ | IFS | as_nl) ;; #(\n      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(\n      *) { eval $ac_var=; unset $ac_var;} ;;\n      esac ;;\n    esac\n  done\n  (set) 2>&1 |\n    case $as_nl`(ac_space='\\'' '\\''; set) 2>&1` in #(\n    *${as_nl}ac_space=\\ *)\n      sed -n \\\n\t\"s/'\\''/'\\''\\\\\\\\'\\'''\\''/g;\n\t  s/^\\\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\\\)=\\\\(.*\\\\)/\\\\1='\\''\\\\2'\\''/p\"\n      ;; #(\n    *)\n      sed -n \"/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p\"\n      ;;\n    esac |\n    sort\n)\n    echo\n\n    $as_echo \"## ----------------- ##\n## Output variables. ##\n## ----------------- ##\"\n    echo\n    for ac_var in $ac_subst_vars\n    do\n      eval ac_val=\\$$ac_var\n      case $ac_val in\n      *\\'\\''*) ac_val=`$as_echo \"$ac_val\" | sed \"s/'\\''/'\\''\\\\\\\\\\\\\\\\'\\'''\\''/g\"`;;\n      esac\n      $as_echo \"$ac_var='\\''$ac_val'\\''\"\n    done | sort\n    echo\n\n    if test -n \"$ac_subst_files\"; then\n      $as_echo \"## ------------------- ##\n## File substitutions. ##\n## ------------------- ##\"\n      echo\n      for ac_var in $ac_subst_files\n      do\n\teval ac_val=\\$$ac_var\n\tcase $ac_val in\n\t*\\'\\''*) ac_val=`$as_echo \"$ac_val\" | sed \"s/'\\''/'\\''\\\\\\\\\\\\\\\\'\\'''\\''/g\"`;;\n\tesac\n\t$as_echo \"$ac_var='\\''$ac_val'\\''\"\n      done | sort\n      echo\n    fi\n\n    if test -s confdefs.h; then\n      $as_echo \"## ----------- ##\n## confdefs.h. ##\n## ----------- ##\"\n      echo\n      cat confdefs.h\n      echo\n    fi\n    test \"$ac_signal\" != 0 &&\n      $as_echo \"$as_me: caught signal $ac_signal\"\n    $as_echo \"$as_me: exit $exit_status\"\n  } >&5\n  rm -f core *.core core.conftest.* &&\n    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&\n    exit $exit_status\n' 0\nfor ac_signal in 1 2 13 15; do\n  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal\ndone\nac_signal=0\n\n# confdefs.h avoids OS command line length limits that DEFS can exceed.\nrm -f -r conftest* confdefs.h\n\n$as_echo \"/* confdefs.h */\" > confdefs.h\n\n# Predefined preprocessor variables.\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_NAME \"$PACKAGE_NAME\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_VERSION \"$PACKAGE_VERSION\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_STRING \"$PACKAGE_STRING\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_URL \"$PACKAGE_URL\"\n_ACEOF\n\n\n# Let the site file select an alternate cache file if it wants to.\n# Prefer an explicitly selected file to automatically selected ones.\nac_site_file1=NONE\nac_site_file2=NONE\nif test -n \"$CONFIG_SITE\"; then\n  # We do not want a PATH search for config.site.\n  case $CONFIG_SITE in #((\n    -*)  ac_site_file1=./$CONFIG_SITE;;\n    */*) ac_site_file1=$CONFIG_SITE;;\n    *)   ac_site_file1=./$CONFIG_SITE;;\n  esac\nelif test \"x$prefix\" != xNONE; then\n  ac_site_file1=$prefix/share/config.site\n  ac_site_file2=$prefix/etc/config.site\nelse\n  ac_site_file1=$ac_default_prefix/share/config.site\n  ac_site_file2=$ac_default_prefix/etc/config.site\nfi\nfor ac_site_file in \"$ac_site_file1\" \"$ac_site_file2\"\ndo\n  test \"x$ac_site_file\" = xNONE && continue\n  if test /dev/null != \"$ac_site_file\" && test -r \"$ac_site_file\"; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file\" >&5\n$as_echo \"$as_me: loading site script $ac_site_file\" >&6;}\n    sed 's/^/| /' \"$ac_site_file\" >&5\n    . \"$ac_site_file\" \\\n      || { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"failed to load site script $ac_site_file\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\n  fi\ndone\n\nif test -r \"$cache_file\"; then\n  # Some versions of bash will fail to source /dev/null (special files\n  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.\n  if test /dev/null != \"$cache_file\" && test -f \"$cache_file\"; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: loading cache $cache_file\" >&5\n$as_echo \"$as_me: loading cache $cache_file\" >&6;}\n    case $cache_file in\n      [\\\\/]* | ?:[\\\\/]* ) . \"$cache_file\";;\n      *)                      . \"./$cache_file\";;\n    esac\n  fi\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: creating cache $cache_file\" >&5\n$as_echo \"$as_me: creating cache $cache_file\" >&6;}\n  >$cache_file\nfi\n\n# Check that the precious variables saved in the cache have kept the same\n# value.\nac_cache_corrupted=false\nfor ac_var in $ac_precious_vars; do\n  eval ac_old_set=\\$ac_cv_env_${ac_var}_set\n  eval ac_new_set=\\$ac_env_${ac_var}_set\n  eval ac_old_val=\\$ac_cv_env_${ac_var}_value\n  eval ac_new_val=\\$ac_env_${ac_var}_value\n  case $ac_old_set,$ac_new_set in\n    set,)\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: error: \\`$ac_var' was set to \\`$ac_old_val' in the previous run\" >&5\n$as_echo \"$as_me: error: \\`$ac_var' was set to \\`$ac_old_val' in the previous run\" >&2;}\n      ac_cache_corrupted=: ;;\n    ,set)\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: error: \\`$ac_var' was not set in the previous run\" >&5\n$as_echo \"$as_me: error: \\`$ac_var' was not set in the previous run\" >&2;}\n      ac_cache_corrupted=: ;;\n    ,);;\n    *)\n      if test \"x$ac_old_val\" != \"x$ac_new_val\"; then\n\t# differences in whitespace do not lead to failure.\n\tac_old_val_w=`echo x $ac_old_val`\n\tac_new_val_w=`echo x $ac_new_val`\n\tif test \"$ac_old_val_w\" != \"$ac_new_val_w\"; then\n\t  { $as_echo \"$as_me:${as_lineno-$LINENO}: error: \\`$ac_var' has changed since the previous run:\" >&5\n$as_echo \"$as_me: error: \\`$ac_var' has changed since the previous run:\" >&2;}\n\t  ac_cache_corrupted=:\n\telse\n\t  { $as_echo \"$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \\`$ac_var' since the previous run:\" >&5\n$as_echo \"$as_me: warning: ignoring whitespace changes in \\`$ac_var' since the previous run:\" >&2;}\n\t  eval $ac_var=\\$ac_old_val\n\tfi\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}:   former value:  \\`$ac_old_val'\" >&5\n$as_echo \"$as_me:   former value:  \\`$ac_old_val'\" >&2;}\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}:   current value: \\`$ac_new_val'\" >&5\n$as_echo \"$as_me:   current value: \\`$ac_new_val'\" >&2;}\n      fi;;\n  esac\n  # Pass precious variables to config.status.\n  if test \"$ac_new_set\" = set; then\n    case $ac_new_val in\n    *\\'*) ac_arg=$ac_var=`$as_echo \"$ac_new_val\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    *) ac_arg=$ac_var=$ac_new_val ;;\n    esac\n    case \" $ac_configure_args \" in\n      *\" '$ac_arg' \"*) ;; # Avoid dups.  Use of quotes ensures accuracy.\n      *) as_fn_append ac_configure_args \" '$ac_arg'\" ;;\n    esac\n  fi\ndone\nif $ac_cache_corrupted; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build\" >&5\n$as_echo \"$as_me: error: changes in the environment can compromise the build\" >&2;}\n  as_fn_error $? \"run \\`make distclean' and/or \\`rm $cache_file' and start over\" \"$LINENO\" 5\nfi\n## -------------------- ##\n## Main body of script. ##\n## -------------------- ##\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n\n# Provide various options to initialize the Autoconf and configure processes.\n\n\n\nac_aux_dir=\nfor ac_dir in build-aux \"$srcdir\"/build-aux; do\n  if test -f \"$ac_dir/install-sh\"; then\n    ac_aux_dir=$ac_dir\n    ac_install_sh=\"$ac_aux_dir/install-sh -c\"\n    break\n  elif test -f \"$ac_dir/install.sh\"; then\n    ac_aux_dir=$ac_dir\n    ac_install_sh=\"$ac_aux_dir/install.sh -c\"\n    break\n  elif test -f \"$ac_dir/shtool\"; then\n    ac_aux_dir=$ac_dir\n    ac_install_sh=\"$ac_aux_dir/shtool install -c\"\n    break\n  fi\ndone\nif test -z \"$ac_aux_dir\"; then\n  as_fn_error $? \"cannot find install-sh, install.sh, or shtool in build-aux \\\"$srcdir\\\"/build-aux\" \"$LINENO\" 5\nfi\n\n# These three variables are undocumented and unsupported,\n# and are intended to be withdrawn in a future Autoconf release.\n# They can cause serious problems if a builder's source tree is in a directory\n# whose full name contains unusual characters.\nac_config_guess=\"$SHELL $ac_aux_dir/config.guess\"  # Please don't use this var.\nac_config_sub=\"$SHELL $ac_aux_dir/config.sub\"  # Please don't use this var.\nac_configure=\"$SHELL $ac_aux_dir/configure\"  # Please don't use this var.\n\n\nac_config_headers=\"$ac_config_headers build-aux/config.h\"\n\nac_config_files=\"$ac_config_files Makefile\"\n\nac_config_files=\"$ac_config_files scripts/gtest-config\"\n\n\n# Initialize Automake with various options. We require at least v1.9, prevent\n# pedantic complaints about package files, and enable various distribution\n# targets.\nam__api_version='1.11'\n\n# Find a good install program.  We prefer a C program (faster),\n# so one script is as good as another.  But avoid the broken or\n# incompatible versions:\n# SysV /etc/install, /usr/sbin/install\n# SunOS /usr/etc/install\n# IRIX /sbin/install\n# AIX /bin/install\n# AmigaOS /C/install, which installs bootblocks on floppy discs\n# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag\n# AFS /usr/afsws/bin/install, which mishandles nonexistent args\n# SVR4 /usr/ucb/install, which tries to use the nonexistent group \"staff\"\n# OS/2's system install, which has a completely different semantic\n# ./install, which can be erroneously created by make from ./install.sh.\n# Reject install programs that cannot install multiple files.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install\" >&5\n$as_echo_n \"checking for a BSD-compatible install... \" >&6; }\nif test -z \"$INSTALL\"; then\nif ${ac_cv_path_install+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    # Account for people who put trailing slashes in PATH elements.\ncase $as_dir/ in #((\n  ./ | .// | /[cC]/* | \\\n  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \\\n  ?:[\\\\/]os2[\\\\/]install[\\\\/]* | ?:[\\\\/]OS2[\\\\/]INSTALL[\\\\/]* | \\\n  /usr/ucb/* ) ;;\n  *)\n    # OSF1 and SCO ODT 3.0 have their own names for install.\n    # Don't use installbsd from OSF since it installs stuff as root\n    # by default.\n    for ac_prog in ginstall scoinst install; do\n      for ac_exec_ext in '' $ac_executable_extensions; do\n\tif { test -f \"$as_dir/$ac_prog$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_prog$ac_exec_ext\"; }; then\n\t  if test $ac_prog = install &&\n\t    grep dspmsg \"$as_dir/$ac_prog$ac_exec_ext\" >/dev/null 2>&1; then\n\t    # AIX install.  It has an incompatible calling convention.\n\t    :\n\t  elif test $ac_prog = install &&\n\t    grep pwplus \"$as_dir/$ac_prog$ac_exec_ext\" >/dev/null 2>&1; then\n\t    # program-specific install script used by HP pwplus--don't use.\n\t    :\n\t  else\n\t    rm -rf conftest.one conftest.two conftest.dir\n\t    echo one > conftest.one\n\t    echo two > conftest.two\n\t    mkdir conftest.dir\n\t    if \"$as_dir/$ac_prog$ac_exec_ext\" -c conftest.one conftest.two \"`pwd`/conftest.dir\" &&\n\t      test -s conftest.one && test -s conftest.two &&\n\t      test -s conftest.dir/conftest.one &&\n\t      test -s conftest.dir/conftest.two\n\t    then\n\t      ac_cv_path_install=\"$as_dir/$ac_prog$ac_exec_ext -c\"\n\t      break 3\n\t    fi\n\t  fi\n\tfi\n      done\n    done\n    ;;\nesac\n\n  done\nIFS=$as_save_IFS\n\nrm -rf conftest.one conftest.two conftest.dir\n\nfi\n  if test \"${ac_cv_path_install+set}\" = set; then\n    INSTALL=$ac_cv_path_install\n  else\n    # As a last resort, use the slow shell script.  Don't cache a\n    # value for INSTALL within a source directory, because that will\n    # break other packages using the cache if that directory is\n    # removed, or if the value is a relative name.\n    INSTALL=$ac_install_sh\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $INSTALL\" >&5\n$as_echo \"$INSTALL\" >&6; }\n\n# Use test -z because SunOS4 sh mishandles braces in ${var-val}.\n# It thinks the first close brace ends the variable substitution.\ntest -z \"$INSTALL_PROGRAM\" && INSTALL_PROGRAM='${INSTALL}'\n\ntest -z \"$INSTALL_SCRIPT\" && INSTALL_SCRIPT='${INSTALL}'\n\ntest -z \"$INSTALL_DATA\" && INSTALL_DATA='${INSTALL} -m 644'\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether build environment is sane\" >&5\n$as_echo_n \"checking whether build environment is sane... \" >&6; }\n# Just in case\nsleep 1\necho timestamp > conftest.file\n# Reject unsafe characters in $srcdir or the absolute working directory\n# name.  Accept space and tab only in the latter.\nam_lf='\n'\ncase `pwd` in\n  *[\\\\\\\"\\#\\$\\&\\'\\`$am_lf]*)\n    as_fn_error $? \"unsafe absolute working directory name\" \"$LINENO\" 5;;\nesac\ncase $srcdir in\n  *[\\\\\\\"\\#\\$\\&\\'\\`$am_lf\\ \\\t]*)\n    as_fn_error $? \"unsafe srcdir value: \\`$srcdir'\" \"$LINENO\" 5;;\nesac\n\n# Do `set' in a subshell so we don't clobber the current shell's\n# arguments.  Must try -L first in case configure is actually a\n# symlink; some systems play weird games with the mod time of symlinks\n# (eg FreeBSD returns the mod time of the symlink's containing\n# directory).\nif (\n   set X `ls -Lt \"$srcdir/configure\" conftest.file 2> /dev/null`\n   if test \"$*\" = \"X\"; then\n      # -L didn't work.\n      set X `ls -t \"$srcdir/configure\" conftest.file`\n   fi\n   rm -f conftest.file\n   if test \"$*\" != \"X $srcdir/configure conftest.file\" \\\n      && test \"$*\" != \"X conftest.file $srcdir/configure\"; then\n\n      # If neither matched, then we have a broken ls.  This can happen\n      # if, for instance, CONFIG_SHELL is bash and it inherits a\n      # broken ls alias from the environment.  This has actually\n      # happened.  Such a system could not be considered \"sane\".\n      as_fn_error $? \"ls -t appears to fail.  Make sure there is not a broken\nalias in your environment\" \"$LINENO\" 5\n   fi\n\n   test \"$2\" = conftest.file\n   )\nthen\n   # Ok.\n   :\nelse\n   as_fn_error $? \"newly created file is older than distributed files!\nCheck your system clock\" \"$LINENO\" 5\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\ntest \"$program_prefix\" != NONE &&\n  program_transform_name=\"s&^&$program_prefix&;$program_transform_name\"\n# Use a double $ so make ignores it.\ntest \"$program_suffix\" != NONE &&\n  program_transform_name=\"s&\\$&$program_suffix&;$program_transform_name\"\n# Double any \\ or $.\n# By default was `s,x,x', remove it if useless.\nac_script='s/[\\\\$]/&&/g;s/;s,x,x,$//'\nprogram_transform_name=`$as_echo \"$program_transform_name\" | sed \"$ac_script\"`\n\n# expand $ac_aux_dir to an absolute path\nam_aux_dir=`cd $ac_aux_dir && pwd`\n\nif test x\"${MISSING+set}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    MISSING=\"\\${SHELL} \\\"$am_aux_dir/missing\\\"\" ;;\n  *)\n    MISSING=\"\\${SHELL} $am_aux_dir/missing\" ;;\n  esac\nfi\n# Use eval to expand $SHELL\nif eval \"$MISSING --run true\"; then\n  am_missing_run=\"$MISSING --run \"\nelse\n  am_missing_run=\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: \\`missing' script is too old or missing\" >&5\n$as_echo \"$as_me: WARNING: \\`missing' script is too old or missing\" >&2;}\nfi\n\nif test x\"${install_sh}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    install_sh=\"\\${SHELL} '$am_aux_dir/install-sh'\" ;;\n  *)\n    install_sh=\"\\${SHELL} $am_aux_dir/install-sh\"\n  esac\nfi\n\n# Installed binaries are usually stripped using `strip' when the user\n# run `make install-strip'.  However `strip' might not be the right\n# tool to use in cross-compilation environments, therefore Automake\n# will honor the `STRIP' environment variable to overrule this program.\nif test \"$cross_compiling\" != no; then\n  if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}strip\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_STRIP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$STRIP\"; then\n  ac_cv_prog_STRIP=\"$STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_STRIP=\"${ac_tool_prefix}strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nSTRIP=$ac_cv_prog_STRIP\nif test -n \"$STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $STRIP\" >&5\n$as_echo \"$STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_STRIP\"; then\n  ac_ct_STRIP=$STRIP\n  # Extract the first word of \"strip\", so it can be a program name with args.\nset dummy strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_STRIP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_STRIP\"; then\n  ac_cv_prog_ac_ct_STRIP=\"$ac_ct_STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_STRIP=\"strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP\nif test -n \"$ac_ct_STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP\" >&5\n$as_echo \"$ac_ct_STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_STRIP\" = x; then\n    STRIP=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    STRIP=$ac_ct_STRIP\n  fi\nelse\n  STRIP=\"$ac_cv_prog_STRIP\"\nfi\n\nfi\nINSTALL_STRIP_PROGRAM=\"\\$(install_sh) -c -s\"\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p\" >&5\n$as_echo_n \"checking for a thread-safe mkdir -p... \" >&6; }\nif test -z \"$MKDIR_P\"; then\n  if ${ac_cv_path_mkdir+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in mkdir gmkdir; do\n\t for ac_exec_ext in '' $ac_executable_extensions; do\n\t   { test -f \"$as_dir/$ac_prog$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_prog$ac_exec_ext\"; } || continue\n\t   case `\"$as_dir/$ac_prog$ac_exec_ext\" --version 2>&1` in #(\n\t     'mkdir (GNU coreutils) '* | \\\n\t     'mkdir (coreutils) '* | \\\n\t     'mkdir (fileutils) '4.1*)\n\t       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext\n\t       break 3;;\n\t   esac\n\t done\n       done\n  done\nIFS=$as_save_IFS\n\nfi\n\n  test -d ./--version && rmdir ./--version\n  if test \"${ac_cv_path_mkdir+set}\" = set; then\n    MKDIR_P=\"$ac_cv_path_mkdir -p\"\n  else\n    # As a last resort, use the slow shell script.  Don't cache a\n    # value for MKDIR_P within a source directory, because that will\n    # break other packages using the cache if that directory is\n    # removed, or if the value is a relative name.\n    MKDIR_P=\"$ac_install_sh -d\"\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MKDIR_P\" >&5\n$as_echo \"$MKDIR_P\" >&6; }\n\nmkdir_p=\"$MKDIR_P\"\ncase $mkdir_p in\n  [\\\\/$]* | ?:[\\\\/]*) ;;\n  */*) mkdir_p=\"\\$(top_builddir)/$mkdir_p\" ;;\nesac\n\nfor ac_prog in gawk mawk nawk awk\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_AWK+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$AWK\"; then\n  ac_cv_prog_AWK=\"$AWK\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_AWK=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nAWK=$ac_cv_prog_AWK\nif test -n \"$AWK\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $AWK\" >&5\n$as_echo \"$AWK\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$AWK\" && break\ndone\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \\$(MAKE)\" >&5\n$as_echo_n \"checking whether ${MAKE-make} sets \\$(MAKE)... \" >&6; }\nset x ${MAKE-make}\nac_make=`$as_echo \"$2\" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`\nif eval \\${ac_cv_prog_make_${ac_make}_set+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat >conftest.make <<\\_ACEOF\nSHELL = /bin/sh\nall:\n\t@echo '@@@%%%=$(MAKE)=@@@%%%'\n_ACEOF\n# GNU make sometimes prints \"make[1]: Entering ...\", which would confuse us.\ncase `${MAKE-make} -f conftest.make 2>/dev/null` in\n  *@@@%%%=?*=@@@%%%*)\n    eval ac_cv_prog_make_${ac_make}_set=yes;;\n  *)\n    eval ac_cv_prog_make_${ac_make}_set=no;;\nesac\nrm -f conftest.make\nfi\nif eval test \\$ac_cv_prog_make_${ac_make}_set = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n  SET_MAKE=\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n  SET_MAKE=\"MAKE=${MAKE-make}\"\nfi\n\nrm -rf .tst 2>/dev/null\nmkdir .tst 2>/dev/null\nif test -d .tst; then\n  am__leading_dot=.\nelse\n  am__leading_dot=_\nfi\nrmdir .tst 2>/dev/null\n\nif test \"`cd $srcdir && pwd`\" != \"`pwd`\"; then\n  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output\n  # is not polluted with repeated \"-I.\"\n  am__isrc=' -I$(srcdir)'\n  # test to see if srcdir already configured\n  if test -f $srcdir/config.status; then\n    as_fn_error $? \"source directory already configured; run \\\"make distclean\\\" there first\" \"$LINENO\" 5\n  fi\nfi\n\n# test whether we have cygpath\nif test -z \"$CYGPATH_W\"; then\n  if (cygpath --version) >/dev/null 2>/dev/null; then\n    CYGPATH_W='cygpath -w'\n  else\n    CYGPATH_W=echo\n  fi\nfi\n\n\n# Define the identity of the package.\n PACKAGE='gtest'\n VERSION='1.7.0'\n\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE \"$PACKAGE\"\n_ACEOF\n\n\ncat >>confdefs.h <<_ACEOF\n#define VERSION \"$VERSION\"\n_ACEOF\n\n# Some tools Automake needs.\n\nACLOCAL=${ACLOCAL-\"${am_missing_run}aclocal-${am__api_version}\"}\n\n\nAUTOCONF=${AUTOCONF-\"${am_missing_run}autoconf\"}\n\n\nAUTOMAKE=${AUTOMAKE-\"${am_missing_run}automake-${am__api_version}\"}\n\n\nAUTOHEADER=${AUTOHEADER-\"${am_missing_run}autoheader\"}\n\n\nMAKEINFO=${MAKEINFO-\"${am_missing_run}makeinfo\"}\n\n# We need awk for the \"check\" target.  The system \"awk\" is bad on\n# some platforms.\n# Always define AMTAR for backward compatibility.  Yes, it's still used\n# in the wild :-(  We should find a proper way to deprecate it ...\nAMTAR='$${TAR-tar}'\n\nam__tar='$${TAR-tar} chof - \"$$tardir\"' am__untar='$${TAR-tar} xf -'\n\n\n\n\n\n\n# Check for programs used in building Google Test.\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}gcc\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}gcc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CC=\"${ac_tool_prefix}gcc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_CC\"; then\n  ac_ct_CC=$CC\n  # Extract the first word of \"gcc\", so it can be a program name with args.\nset dummy gcc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_CC\"; then\n  ac_cv_prog_ac_ct_CC=\"$ac_ct_CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_CC=\"gcc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_CC=$ac_cv_prog_ac_ct_CC\nif test -n \"$ac_ct_CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC\" >&5\n$as_echo \"$ac_ct_CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_CC\" = x; then\n    CC=\"\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    CC=$ac_ct_CC\n  fi\nelse\n  CC=\"$ac_cv_prog_CC\"\nfi\n\nif test -z \"$CC\"; then\n          if test -n \"$ac_tool_prefix\"; then\n    # Extract the first word of \"${ac_tool_prefix}cc\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}cc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CC=\"${ac_tool_prefix}cc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  fi\nfi\nif test -z \"$CC\"; then\n  # Extract the first word of \"cc\", so it can be a program name with args.\nset dummy cc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\n  ac_prog_rejected=no\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    if test \"$as_dir/$ac_word$ac_exec_ext\" = \"/usr/ucb/cc\"; then\n       ac_prog_rejected=yes\n       continue\n     fi\n    ac_cv_prog_CC=\"cc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nif test $ac_prog_rejected = yes; then\n  # We found a bogon in the path, so make sure we never use it.\n  set dummy $ac_cv_prog_CC\n  shift\n  if test $# != 0; then\n    # We chose a different compiler from the bogus one.\n    # However, it has the same basename, so the bogon will be chosen\n    # first if we set CC to just the basename; use the full file name.\n    shift\n    ac_cv_prog_CC=\"$as_dir/$ac_word${1+' '}$@\"\n  fi\nfi\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$CC\"; then\n  if test -n \"$ac_tool_prefix\"; then\n  for ac_prog in cl.exe\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CC=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$CC\" && break\n  done\nfi\nif test -z \"$CC\"; then\n  ac_ct_CC=$CC\n  for ac_prog in cl.exe\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_CC\"; then\n  ac_cv_prog_ac_ct_CC=\"$ac_ct_CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_CC=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_CC=$ac_cv_prog_ac_ct_CC\nif test -n \"$ac_ct_CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC\" >&5\n$as_echo \"$ac_ct_CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_CC\" && break\ndone\n\n  if test \"x$ac_ct_CC\" = x; then\n    CC=\"\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    CC=$ac_ct_CC\n  fi\nfi\n\nfi\n\n\ntest -z \"$CC\" && { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"no acceptable C compiler found in \\$PATH\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\n\n# Provide some information about the compiler.\n$as_echo \"$as_me:${as_lineno-$LINENO}: checking for C compiler version\" >&5\nset X $ac_compile\nac_compiler=$2\nfor ac_option in --version -v -V -qversion; do\n  { { ac_try=\"$ac_compiler $ac_option >&5\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compiler $ac_option >&5\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    sed '10a\\\n... rest of stderr output deleted ...\n         10q' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n  fi\n  rm -f conftest.er1 conftest.err\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\ndone\n\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nac_clean_files_save=$ac_clean_files\nac_clean_files=\"$ac_clean_files a.out a.out.dSYM a.exe b.out\"\n# Try to create an executable without -o first, disregard a.out.\n# It will help us diagnose broken compilers, and finding out an intuition\n# of exeext.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the C compiler works\" >&5\n$as_echo_n \"checking whether the C compiler works... \" >&6; }\nac_link_default=`$as_echo \"$ac_link\" | sed 's/ -o *conftest[^ ]*//'`\n\n# The possible output files:\nac_files=\"a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*\"\n\nac_rmfiles=\nfor ac_file in $ac_files\ndo\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;\n    * ) ac_rmfiles=\"$ac_rmfiles $ac_file\";;\n  esac\ndone\nrm -f $ac_rmfiles\n\nif { { ac_try=\"$ac_link_default\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link_default\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then :\n  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.\n# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'\n# in a Makefile.  We should not override ac_cv_exeext if it was cached,\n# so that the user can short-circuit this test for compilers unknown to\n# Autoconf.\nfor ac_file in $ac_files ''\ndo\n  test -f \"$ac_file\" || continue\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )\n\t;;\n    [ab].out )\n\t# We found the default executable, but exeext='' is most\n\t# certainly right.\n\tbreak;;\n    *.* )\n\tif test \"${ac_cv_exeext+set}\" = set && test \"$ac_cv_exeext\" != no;\n\tthen :; else\n\t   ac_cv_exeext=`expr \"$ac_file\" : '[^.]*\\(\\..*\\)'`\n\tfi\n\t# We set ac_cv_exeext here because the later test for it is not\n\t# safe: cross compilers may not add the suffix if given an `-o'\n\t# argument, so we may need to know it at that point already.\n\t# Even if this section looks crufty: it has the advantage of\n\t# actually working.\n\tbreak;;\n    * )\n\tbreak;;\n  esac\ndone\ntest \"$ac_cv_exeext\" = no && ac_cv_exeext=\n\nelse\n  ac_file=''\nfi\nif test -z \"$ac_file\"; then :\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n$as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n{ { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error 77 \"C compiler cannot create executables\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name\" >&5\n$as_echo_n \"checking for C compiler default output file name... \" >&6; }\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_file\" >&5\n$as_echo \"$ac_file\" >&6; }\nac_exeext=$ac_cv_exeext\n\nrm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out\nac_clean_files=$ac_clean_files_save\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for suffix of executables\" >&5\n$as_echo_n \"checking for suffix of executables... \" >&6; }\nif { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then :\n  # If both `conftest.exe' and `conftest' are `present' (well, observable)\n# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will\n# work properly (i.e., refer to `conftest.exe'), while it won't with\n# `rm'.\nfor ac_file in conftest.exe conftest conftest.*; do\n  test -f \"$ac_file\" || continue\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;\n    *.* ) ac_cv_exeext=`expr \"$ac_file\" : '[^.]*\\(\\..*\\)'`\n\t  break;;\n    * ) break;;\n  esac\ndone\nelse\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"cannot compute suffix of executables: cannot compile and link\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\nfi\nrm -f conftest conftest$ac_cv_exeext\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext\" >&5\n$as_echo \"$ac_cv_exeext\" >&6; }\n\nrm -f conftest.$ac_ext\nEXEEXT=$ac_cv_exeext\nac_exeext=$EXEEXT\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdio.h>\nint\nmain ()\n{\nFILE *f = fopen (\"conftest.out\", \"w\");\n return ferror (f) || fclose (f) != 0;\n\n  ;\n  return 0;\n}\n_ACEOF\nac_clean_files=\"$ac_clean_files conftest.out\"\n# Check that the compiler produces executables we can run.  If not, either\n# the compiler is broken, or we cross compile.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling\" >&5\n$as_echo_n \"checking whether we are cross compiling... \" >&6; }\nif test \"$cross_compiling\" != yes; then\n  { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n  if { ac_try='./conftest$ac_cv_exeext'\n  { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; }; then\n    cross_compiling=no\n  else\n    if test \"$cross_compiling\" = maybe; then\n\tcross_compiling=yes\n    else\n\t{ { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"cannot run C compiled programs.\nIf you meant to cross compile, use \\`--host'.\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\n    fi\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $cross_compiling\" >&5\n$as_echo \"$cross_compiling\" >&6; }\n\nrm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out\nac_clean_files=$ac_clean_files_save\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for suffix of object files\" >&5\n$as_echo_n \"checking for suffix of object files... \" >&6; }\nif ${ac_cv_objext+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nrm -f conftest.o conftest.obj\nif { { ac_try=\"$ac_compile\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compile\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then :\n  for ac_file in conftest.o conftest.obj conftest.*; do\n  test -f \"$ac_file\" || continue;\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;\n    *) ac_cv_objext=`expr \"$ac_file\" : '.*\\.\\(.*\\)'`\n       break;;\n  esac\ndone\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n{ { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"cannot compute suffix of object files: cannot compile\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\nfi\nrm -f conftest.$ac_cv_objext conftest.$ac_ext\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext\" >&5\n$as_echo \"$ac_cv_objext\" >&6; }\nOBJEXT=$ac_cv_objext\nac_objext=$OBJEXT\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler\" >&5\n$as_echo_n \"checking whether we are using the GNU C compiler... \" >&6; }\nif ${ac_cv_c_compiler_gnu+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n#ifndef __GNUC__\n       choke me\n#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_compiler_gnu=yes\nelse\n  ac_compiler_gnu=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nac_cv_c_compiler_gnu=$ac_compiler_gnu\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu\" >&5\n$as_echo \"$ac_cv_c_compiler_gnu\" >&6; }\nif test $ac_compiler_gnu = yes; then\n  GCC=yes\nelse\n  GCC=\nfi\nac_test_CFLAGS=${CFLAGS+set}\nac_save_CFLAGS=$CFLAGS\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g\" >&5\n$as_echo_n \"checking whether $CC accepts -g... \" >&6; }\nif ${ac_cv_prog_cc_g+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_save_c_werror_flag=$ac_c_werror_flag\n   ac_c_werror_flag=yes\n   ac_cv_prog_cc_g=no\n   CFLAGS=\"-g\"\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_g=yes\nelse\n  CFLAGS=\"\"\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n\nelse\n  ac_c_werror_flag=$ac_save_c_werror_flag\n\t CFLAGS=\"-g\"\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_g=yes\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n   ac_c_werror_flag=$ac_save_c_werror_flag\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g\" >&5\n$as_echo \"$ac_cv_prog_cc_g\" >&6; }\nif test \"$ac_test_CFLAGS\" = set; then\n  CFLAGS=$ac_save_CFLAGS\nelif test $ac_cv_prog_cc_g = yes; then\n  if test \"$GCC\" = yes; then\n    CFLAGS=\"-g -O2\"\n  else\n    CFLAGS=\"-g\"\n  fi\nelse\n  if test \"$GCC\" = yes; then\n    CFLAGS=\"-O2\"\n  else\n    CFLAGS=\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89\" >&5\n$as_echo_n \"checking for $CC option to accept ISO C89... \" >&6; }\nif ${ac_cv_prog_cc_c89+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_prog_cc_c89=no\nac_save_CC=$CC\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdarg.h>\n#include <stdio.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */\nstruct buf { int x; };\nFILE * (*rcsopen) (struct buf *, struct stat *, int);\nstatic char *e (p, i)\n     char **p;\n     int i;\n{\n  return p[i];\n}\nstatic char *f (char * (*g) (char **, int), char **p, ...)\n{\n  char *s;\n  va_list v;\n  va_start (v,p);\n  s = g (p, va_arg (v,int));\n  va_end (v);\n  return s;\n}\n\n/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has\n   function prototypes and stuff, but not '\\xHH' hex character constants.\n   These don't provoke an error unfortunately, instead are silently treated\n   as 'x'.  The following induces an error, until -std is added to get\n   proper ANSI mode.  Curiously '\\x00'!='x' always comes out true, for an\n   array size at least.  It's necessary to write '\\x00'==0 to get something\n   that's true only with -std.  */\nint osf4_cc_array ['\\x00' == 0 ? 1 : -1];\n\n/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters\n   inside strings and character constants.  */\n#define FOO(x) 'x'\nint xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];\n\nint test (int i, double x);\nstruct s1 {int (*f) (int a);};\nstruct s2 {int (*f) (double a);};\nint pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);\nint argc;\nchar **argv;\nint\nmain ()\n{\nreturn f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];\n  ;\n  return 0;\n}\n_ACEOF\nfor ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \\\n\t-Ae \"-Aa -D_HPUX_SOURCE\" \"-Xc -D__EXTENSIONS__\"\ndo\n  CC=\"$ac_save_CC $ac_arg\"\n  if ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_c89=$ac_arg\nfi\nrm -f core conftest.err conftest.$ac_objext\n  test \"x$ac_cv_prog_cc_c89\" != \"xno\" && break\ndone\nrm -f conftest.$ac_ext\nCC=$ac_save_CC\n\nfi\n# AC_CACHE_VAL\ncase \"x$ac_cv_prog_cc_c89\" in\n  x)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none needed\" >&5\n$as_echo \"none needed\" >&6; } ;;\n  xno)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: unsupported\" >&5\n$as_echo \"unsupported\" >&6; } ;;\n  *)\n    CC=\"$CC $ac_cv_prog_cc_c89\"\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89\" >&5\n$as_echo \"$ac_cv_prog_cc_c89\" >&6; } ;;\nesac\nif test \"x$ac_cv_prog_cc_c89\" != xno; then :\n\nfi\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\nDEPDIR=\"${am__leading_dot}deps\"\n\nac_config_commands=\"$ac_config_commands depfiles\"\n\n\nam_make=${MAKE-make}\ncat > confinc << 'END'\nam__doit:\n\t@echo this is the am__doit target\n.PHONY: am__doit\nEND\n# If we don't find an include directive, just comment out the code.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make\" >&5\n$as_echo_n \"checking for style of include used by $am_make... \" >&6; }\nam__include=\"#\"\nam__quote=\n_am_result=none\n# First try GNU make style include.\necho \"include confinc\" > confmf\n# Ignore all kinds of additional output from `make'.\ncase `$am_make -s -f confmf 2> /dev/null` in #(\n*the\\ am__doit\\ target*)\n  am__include=include\n  am__quote=\n  _am_result=GNU\n  ;;\nesac\n# Now try BSD make style include.\nif test \"$am__include\" = \"#\"; then\n   echo '.include \"confinc\"' > confmf\n   case `$am_make -s -f confmf 2> /dev/null` in #(\n   *the\\ am__doit\\ target*)\n     am__include=.include\n     am__quote=\"\\\"\"\n     _am_result=BSD\n     ;;\n   esac\nfi\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $_am_result\" >&5\n$as_echo \"$_am_result\" >&6; }\nrm -f confinc confmf\n\n# Check whether --enable-dependency-tracking was given.\nif test \"${enable_dependency_tracking+set}\" = set; then :\n  enableval=$enable_dependency_tracking;\nfi\n\nif test \"x$enable_dependency_tracking\" != xno; then\n  am_depcomp=\"$ac_aux_dir/depcomp\"\n  AMDEPBACKSLASH='\\'\n  am__nodep='_no'\nfi\n if test \"x$enable_dependency_tracking\" != xno; then\n  AMDEP_TRUE=\n  AMDEP_FALSE='#'\nelse\n  AMDEP_TRUE='#'\n  AMDEP_FALSE=\nfi\n\n\n\ndepcc=\"$CC\"   am_compiler_list=\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc\" >&5\n$as_echo_n \"checking dependency style of $depcc... \" >&6; }\nif ${am_cv_CC_dependencies_compiler_type+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$AMDEP_TRUE\" && test -f \"$am_depcomp\"; then\n  # We make a subdir and do the tests there.  Otherwise we can end up\n  # making bogus files that we don't know about and never remove.  For\n  # instance it was reported that on HP-UX the gcc test will end up\n  # making a dummy file named `D' -- because `-MD' means `put the output\n  # in D'.\n  rm -rf conftest.dir\n  mkdir conftest.dir\n  # Copy depcomp to subdir because otherwise we won't find it if we're\n  # using a relative directory.\n  cp \"$am_depcomp\" conftest.dir\n  cd conftest.dir\n  # We will build objects and dependencies in a subdirectory because\n  # it helps to detect inapplicable dependency modes.  For instance\n  # both Tru64's cc and ICC support -MD to output dependencies as a\n  # side effect of compilation, but ICC will put the dependencies in\n  # the current directory while Tru64 will put them in the object\n  # directory.\n  mkdir sub\n\n  am_cv_CC_dependencies_compiler_type=none\n  if test \"$am_compiler_list\" = \"\"; then\n     am_compiler_list=`sed -n 's/^#*\\([a-zA-Z0-9]*\\))$/\\1/p' < ./depcomp`\n  fi\n  am__universal=false\n  case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac\n\n  for depmode in $am_compiler_list; do\n    # Setup a source with many dependencies, because some compilers\n    # like to wrap large dependency lists on column 80 (with \\), and\n    # we should not choose a depcomp mode which is confused by this.\n    #\n    # We need to recreate these files for each test, as the compiler may\n    # overwrite some of them when testing with obscure command lines.\n    # This happens at least with the AIX C compiler.\n    : > sub/conftest.c\n    for i in 1 2 3 4 5 6; do\n      echo '#include \"conftst'$i'.h\"' >> sub/conftest.c\n      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with\n      # Solaris 8's {/usr,}/bin/sh.\n      touch sub/conftst$i.h\n    done\n    echo \"${am__include} ${am__quote}sub/conftest.Po${am__quote}\" > confmf\n\n    # We check with `-c' and `-o' for the sake of the \"dashmstdout\"\n    # mode.  It turns out that the SunPro C++ compiler does not properly\n    # handle `-M -o', and we need to detect this.  Also, some Intel\n    # versions had trouble with output in subdirs\n    am__obj=sub/conftest.${OBJEXT-o}\n    am__minus_obj=\"-o $am__obj\"\n    case $depmode in\n    gcc)\n      # This depmode causes a compiler race in universal mode.\n      test \"$am__universal\" = false || continue\n      ;;\n    nosideeffect)\n      # after this tag, mechanisms are not by side-effect, so they'll\n      # only be used when explicitly requested\n      if test \"x$enable_dependency_tracking\" = xyes; then\n\tcontinue\n      else\n\tbreak\n      fi\n      ;;\n    msvc7 | msvc7msys | msvisualcpp | msvcmsys)\n      # This compiler won't grok `-c -o', but also, the minuso test has\n      # not run yet.  These depmodes are late enough in the game, and\n      # so weak that their functioning should not be impacted.\n      am__obj=conftest.${OBJEXT-o}\n      am__minus_obj=\n      ;;\n    none) break ;;\n    esac\n    if depmode=$depmode \\\n       source=sub/conftest.c object=$am__obj \\\n       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \\\n       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \\\n         >/dev/null 2>conftest.err &&\n       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&\n       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then\n      # icc doesn't choke on unknown options, it will just issue warnings\n      # or remarks (even with -Werror).  So we grep stderr for any message\n      # that says an option was ignored or not supported.\n      # When given -MP, icc 7.0 and 7.1 complain thusly:\n      #   icc: Command line warning: ignoring option '-M'; no argument required\n      # The diagnosis changed in icc 8.0:\n      #   icc: Command line remark: option '-MP' not supported\n      if (grep 'ignoring option' conftest.err ||\n          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else\n        am_cv_CC_dependencies_compiler_type=$depmode\n        break\n      fi\n    fi\n  done\n\n  cd ..\n  rm -rf conftest.dir\nelse\n  am_cv_CC_dependencies_compiler_type=none\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type\" >&5\n$as_echo \"$am_cv_CC_dependencies_compiler_type\" >&6; }\nCCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type\n\n if\n  test \"x$enable_dependency_tracking\" != xno \\\n  && test \"$am_cv_CC_dependencies_compiler_type\" = gcc3; then\n  am__fastdepCC_TRUE=\n  am__fastdepCC_FALSE='#'\nelse\n  am__fastdepCC_TRUE='#'\n  am__fastdepCC_FALSE=\nfi\n\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\nif test -z \"$CXX\"; then\n  if test -n \"$CCC\"; then\n    CXX=$CCC\n  else\n    if test -n \"$ac_tool_prefix\"; then\n  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CXX\"; then\n  ac_cv_prog_CXX=\"$CXX\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CXX=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCXX=$ac_cv_prog_CXX\nif test -n \"$CXX\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CXX\" >&5\n$as_echo \"$CXX\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$CXX\" && break\n  done\nfi\nif test -z \"$CXX\"; then\n  ac_ct_CXX=$CXX\n  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_CXX\"; then\n  ac_cv_prog_ac_ct_CXX=\"$ac_ct_CXX\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_CXX=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_CXX=$ac_cv_prog_ac_ct_CXX\nif test -n \"$ac_ct_CXX\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX\" >&5\n$as_echo \"$ac_ct_CXX\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_CXX\" && break\ndone\n\n  if test \"x$ac_ct_CXX\" = x; then\n    CXX=\"g++\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    CXX=$ac_ct_CXX\n  fi\nfi\n\n  fi\nfi\n# Provide some information about the compiler.\n$as_echo \"$as_me:${as_lineno-$LINENO}: checking for C++ compiler version\" >&5\nset X $ac_compile\nac_compiler=$2\nfor ac_option in --version -v -V -qversion; do\n  { { ac_try=\"$ac_compiler $ac_option >&5\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compiler $ac_option >&5\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    sed '10a\\\n... rest of stderr output deleted ...\n         10q' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n  fi\n  rm -f conftest.er1 conftest.err\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\ndone\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler\" >&5\n$as_echo_n \"checking whether we are using the GNU C++ compiler... \" >&6; }\nif ${ac_cv_cxx_compiler_gnu+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n#ifndef __GNUC__\n       choke me\n#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  ac_compiler_gnu=yes\nelse\n  ac_compiler_gnu=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nac_cv_cxx_compiler_gnu=$ac_compiler_gnu\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu\" >&5\n$as_echo \"$ac_cv_cxx_compiler_gnu\" >&6; }\nif test $ac_compiler_gnu = yes; then\n  GXX=yes\nelse\n  GXX=\nfi\nac_test_CXXFLAGS=${CXXFLAGS+set}\nac_save_CXXFLAGS=$CXXFLAGS\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g\" >&5\n$as_echo_n \"checking whether $CXX accepts -g... \" >&6; }\nif ${ac_cv_prog_cxx_g+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_save_cxx_werror_flag=$ac_cxx_werror_flag\n   ac_cxx_werror_flag=yes\n   ac_cv_prog_cxx_g=no\n   CXXFLAGS=\"-g\"\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cxx_g=yes\nelse\n  CXXFLAGS=\"\"\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n\nelse\n  ac_cxx_werror_flag=$ac_save_cxx_werror_flag\n\t CXXFLAGS=\"-g\"\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cxx_g=yes\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n   ac_cxx_werror_flag=$ac_save_cxx_werror_flag\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g\" >&5\n$as_echo \"$ac_cv_prog_cxx_g\" >&6; }\nif test \"$ac_test_CXXFLAGS\" = set; then\n  CXXFLAGS=$ac_save_CXXFLAGS\nelif test $ac_cv_prog_cxx_g = yes; then\n  if test \"$GXX\" = yes; then\n    CXXFLAGS=\"-g -O2\"\n  else\n    CXXFLAGS=\"-g\"\n  fi\nelse\n  if test \"$GXX\" = yes; then\n    CXXFLAGS=\"-O2\"\n  else\n    CXXFLAGS=\n  fi\nfi\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\ndepcc=\"$CXX\"  am_compiler_list=\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc\" >&5\n$as_echo_n \"checking dependency style of $depcc... \" >&6; }\nif ${am_cv_CXX_dependencies_compiler_type+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$AMDEP_TRUE\" && test -f \"$am_depcomp\"; then\n  # We make a subdir and do the tests there.  Otherwise we can end up\n  # making bogus files that we don't know about and never remove.  For\n  # instance it was reported that on HP-UX the gcc test will end up\n  # making a dummy file named `D' -- because `-MD' means `put the output\n  # in D'.\n  rm -rf conftest.dir\n  mkdir conftest.dir\n  # Copy depcomp to subdir because otherwise we won't find it if we're\n  # using a relative directory.\n  cp \"$am_depcomp\" conftest.dir\n  cd conftest.dir\n  # We will build objects and dependencies in a subdirectory because\n  # it helps to detect inapplicable dependency modes.  For instance\n  # both Tru64's cc and ICC support -MD to output dependencies as a\n  # side effect of compilation, but ICC will put the dependencies in\n  # the current directory while Tru64 will put them in the object\n  # directory.\n  mkdir sub\n\n  am_cv_CXX_dependencies_compiler_type=none\n  if test \"$am_compiler_list\" = \"\"; then\n     am_compiler_list=`sed -n 's/^#*\\([a-zA-Z0-9]*\\))$/\\1/p' < ./depcomp`\n  fi\n  am__universal=false\n  case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac\n\n  for depmode in $am_compiler_list; do\n    # Setup a source with many dependencies, because some compilers\n    # like to wrap large dependency lists on column 80 (with \\), and\n    # we should not choose a depcomp mode which is confused by this.\n    #\n    # We need to recreate these files for each test, as the compiler may\n    # overwrite some of them when testing with obscure command lines.\n    # This happens at least with the AIX C compiler.\n    : > sub/conftest.c\n    for i in 1 2 3 4 5 6; do\n      echo '#include \"conftst'$i'.h\"' >> sub/conftest.c\n      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with\n      # Solaris 8's {/usr,}/bin/sh.\n      touch sub/conftst$i.h\n    done\n    echo \"${am__include} ${am__quote}sub/conftest.Po${am__quote}\" > confmf\n\n    # We check with `-c' and `-o' for the sake of the \"dashmstdout\"\n    # mode.  It turns out that the SunPro C++ compiler does not properly\n    # handle `-M -o', and we need to detect this.  Also, some Intel\n    # versions had trouble with output in subdirs\n    am__obj=sub/conftest.${OBJEXT-o}\n    am__minus_obj=\"-o $am__obj\"\n    case $depmode in\n    gcc)\n      # This depmode causes a compiler race in universal mode.\n      test \"$am__universal\" = false || continue\n      ;;\n    nosideeffect)\n      # after this tag, mechanisms are not by side-effect, so they'll\n      # only be used when explicitly requested\n      if test \"x$enable_dependency_tracking\" = xyes; then\n\tcontinue\n      else\n\tbreak\n      fi\n      ;;\n    msvc7 | msvc7msys | msvisualcpp | msvcmsys)\n      # This compiler won't grok `-c -o', but also, the minuso test has\n      # not run yet.  These depmodes are late enough in the game, and\n      # so weak that their functioning should not be impacted.\n      am__obj=conftest.${OBJEXT-o}\n      am__minus_obj=\n      ;;\n    none) break ;;\n    esac\n    if depmode=$depmode \\\n       source=sub/conftest.c object=$am__obj \\\n       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \\\n       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \\\n         >/dev/null 2>conftest.err &&\n       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&\n       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then\n      # icc doesn't choke on unknown options, it will just issue warnings\n      # or remarks (even with -Werror).  So we grep stderr for any message\n      # that says an option was ignored or not supported.\n      # When given -MP, icc 7.0 and 7.1 complain thusly:\n      #   icc: Command line warning: ignoring option '-M'; no argument required\n      # The diagnosis changed in icc 8.0:\n      #   icc: Command line remark: option '-MP' not supported\n      if (grep 'ignoring option' conftest.err ||\n          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else\n        am_cv_CXX_dependencies_compiler_type=$depmode\n        break\n      fi\n    fi\n  done\n\n  cd ..\n  rm -rf conftest.dir\nelse\n  am_cv_CXX_dependencies_compiler_type=none\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type\" >&5\n$as_echo \"$am_cv_CXX_dependencies_compiler_type\" >&6; }\nCXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type\n\n if\n  test \"x$enable_dependency_tracking\" != xno \\\n  && test \"$am_cv_CXX_dependencies_compiler_type\" = gcc3; then\n  am__fastdepCXX_TRUE=\n  am__fastdepCXX_FALSE='#'\nelse\n  am__fastdepCXX_TRUE='#'\n  am__fastdepCXX_FALSE=\nfi\n\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\ncase `pwd` in\n  *\\ * | *\\\t*)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \\`pwd\\`\" >&5\n$as_echo \"$as_me: WARNING: Libtool does not cope well with whitespace in \\`pwd\\`\" >&2;} ;;\nesac\n\n\n\nmacro_version='2.4.2'\nmacro_revision='1.3337'\n\n\n\n\n\n\n\n\n\n\n\n\n\nltmain=\"$ac_aux_dir/ltmain.sh\"\n\n# Make sure we can run config.sub.\n$SHELL \"$ac_aux_dir/config.sub\" sun4 >/dev/null 2>&1 ||\n  as_fn_error $? \"cannot run $SHELL $ac_aux_dir/config.sub\" \"$LINENO\" 5\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking build system type\" >&5\n$as_echo_n \"checking build system type... \" >&6; }\nif ${ac_cv_build+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_build_alias=$build_alias\ntest \"x$ac_build_alias\" = x &&\n  ac_build_alias=`$SHELL \"$ac_aux_dir/config.guess\"`\ntest \"x$ac_build_alias\" = x &&\n  as_fn_error $? \"cannot guess build type; you must specify one\" \"$LINENO\" 5\nac_cv_build=`$SHELL \"$ac_aux_dir/config.sub\" $ac_build_alias` ||\n  as_fn_error $? \"$SHELL $ac_aux_dir/config.sub $ac_build_alias failed\" \"$LINENO\" 5\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_build\" >&5\n$as_echo \"$ac_cv_build\" >&6; }\ncase $ac_cv_build in\n*-*-*) ;;\n*) as_fn_error $? \"invalid value of canonical build\" \"$LINENO\" 5;;\nesac\nbuild=$ac_cv_build\nac_save_IFS=$IFS; IFS='-'\nset x $ac_cv_build\nshift\nbuild_cpu=$1\nbuild_vendor=$2\nshift; shift\n# Remember, the first character of IFS is used to create $*,\n# except with old shells:\nbuild_os=$*\nIFS=$ac_save_IFS\ncase $build_os in *\\ *) build_os=`echo \"$build_os\" | sed 's/ /-/g'`;; esac\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking host system type\" >&5\n$as_echo_n \"checking host system type... \" >&6; }\nif ${ac_cv_host+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test \"x$host_alias\" = x; then\n  ac_cv_host=$ac_cv_build\nelse\n  ac_cv_host=`$SHELL \"$ac_aux_dir/config.sub\" $host_alias` ||\n    as_fn_error $? \"$SHELL $ac_aux_dir/config.sub $host_alias failed\" \"$LINENO\" 5\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_host\" >&5\n$as_echo \"$ac_cv_host\" >&6; }\ncase $ac_cv_host in\n*-*-*) ;;\n*) as_fn_error $? \"invalid value of canonical host\" \"$LINENO\" 5;;\nesac\nhost=$ac_cv_host\nac_save_IFS=$IFS; IFS='-'\nset x $ac_cv_host\nshift\nhost_cpu=$1\nhost_vendor=$2\nshift; shift\n# Remember, the first character of IFS is used to create $*,\n# except with old shells:\nhost_os=$*\nIFS=$ac_save_IFS\ncase $host_os in *\\ *) host_os=`echo \"$host_os\" | sed 's/ /-/g'`;; esac\n\n\n# Backslashify metacharacters that are still active within\n# double-quoted strings.\nsed_quote_subst='s/\\([\"`$\\\\]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([\"`\\\\]\\)/\\\\\\1/g'\n\n# Sed substitution to delay expansion of an escaped shell variable in a\n# double_quote_subst'ed string.\ndelay_variable_subst='s/\\\\\\\\\\\\\\\\\\\\\\$/\\\\\\\\\\\\$/g'\n\n# Sed substitution to delay expansion of an escaped single quote.\ndelay_single_quote_subst='s/'\\''/'\\'\\\\\\\\\\\\\\'\\''/g'\n\n# Sed substitution to avoid accidental globbing in evaled expressions\nno_glob_subst='s/\\*/\\\\\\*/g'\n\nECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to print strings\" >&5\n$as_echo_n \"checking how to print strings... \" >&6; }\n# Test print first, because it will be a builtin if present.\nif test \"X`( print -r -- -n ) 2>/dev/null`\" = X-n && \\\n   test \"X`print -r -- $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='print -r --'\nelif test \"X`printf %s $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='printf %s\\n'\nelse\n  # Use this function as a fallback that always works.\n  func_fallback_echo ()\n  {\n    eval 'cat <<_LTECHO_EOF\n$1\n_LTECHO_EOF'\n  }\n  ECHO='func_fallback_echo'\nfi\n\n# func_echo_all arg...\n# Invoke $ECHO with all args, space-separated.\nfunc_echo_all ()\n{\n    $ECHO \"\"\n}\n\ncase \"$ECHO\" in\n  printf*) { $as_echo \"$as_me:${as_lineno-$LINENO}: result: printf\" >&5\n$as_echo \"printf\" >&6; } ;;\n  print*) { $as_echo \"$as_me:${as_lineno-$LINENO}: result: print -r\" >&5\n$as_echo \"print -r\" >&6; } ;;\n  *) { $as_echo \"$as_me:${as_lineno-$LINENO}: result: cat\" >&5\n$as_echo \"cat\" >&6; } ;;\nesac\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output\" >&5\n$as_echo_n \"checking for a sed that does not truncate output... \" >&6; }\nif ${ac_cv_path_SED+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/\n     for ac_i in 1 2 3 4 5 6 7; do\n       ac_script=\"$ac_script$as_nl$ac_script\"\n     done\n     echo \"$ac_script\" 2>/dev/null | sed 99q >conftest.sed\n     { ac_script=; unset ac_script;}\n     if test -z \"$SED\"; then\n  ac_path_SED_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in sed gsed; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_SED=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_SED\" && $as_test_x \"$ac_path_SED\"; } || continue\n# Check for GNU ac_path_SED and select it if it is found.\n  # Check for GNU $ac_path_SED\ncase `\"$ac_path_SED\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_SED=\"$ac_path_SED\" ac_path_SED_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo '' >> \"conftest.nl\"\n    \"$ac_path_SED\" -f conftest.sed < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_SED_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_SED=\"$ac_path_SED\"\n      ac_path_SED_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_SED_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_SED\"; then\n    as_fn_error $? \"no acceptable sed could be found in \\$PATH\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_SED=$SED\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED\" >&5\n$as_echo \"$ac_cv_path_SED\" >&6; }\n SED=\"$ac_cv_path_SED\"\n  rm -f conftest.sed\n\ntest -z \"$SED\" && SED=sed\nXsed=\"$SED -e 1s/^X//\"\n\n\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e\" >&5\n$as_echo_n \"checking for grep that handles long lines and -e... \" >&6; }\nif ${ac_cv_path_GREP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$GREP\"; then\n  ac_path_GREP_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in grep ggrep; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_GREP=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_GREP\" && $as_test_x \"$ac_path_GREP\"; } || continue\n# Check for GNU ac_path_GREP and select it if it is found.\n  # Check for GNU $ac_path_GREP\ncase `\"$ac_path_GREP\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_GREP=\"$ac_path_GREP\" ac_path_GREP_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo 'GREP' >> \"conftest.nl\"\n    \"$ac_path_GREP\" -e 'GREP$' -e '-(cannot match)-' < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_GREP_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_GREP=\"$ac_path_GREP\"\n      ac_path_GREP_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_GREP_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_GREP\"; then\n    as_fn_error $? \"no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_GREP=$GREP\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP\" >&5\n$as_echo \"$ac_cv_path_GREP\" >&6; }\n GREP=\"$ac_cv_path_GREP\"\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for egrep\" >&5\n$as_echo_n \"checking for egrep... \" >&6; }\nif ${ac_cv_path_EGREP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1\n   then ac_cv_path_EGREP=\"$GREP -E\"\n   else\n     if test -z \"$EGREP\"; then\n  ac_path_EGREP_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in egrep; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_EGREP=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_EGREP\" && $as_test_x \"$ac_path_EGREP\"; } || continue\n# Check for GNU ac_path_EGREP and select it if it is found.\n  # Check for GNU $ac_path_EGREP\ncase `\"$ac_path_EGREP\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_EGREP=\"$ac_path_EGREP\" ac_path_EGREP_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo 'EGREP' >> \"conftest.nl\"\n    \"$ac_path_EGREP\" 'EGREP$' < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_EGREP_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_EGREP=\"$ac_path_EGREP\"\n      ac_path_EGREP_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_EGREP_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_EGREP\"; then\n    as_fn_error $? \"no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_EGREP=$EGREP\nfi\n\n   fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP\" >&5\n$as_echo \"$ac_cv_path_EGREP\" >&6; }\n EGREP=\"$ac_cv_path_EGREP\"\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for fgrep\" >&5\n$as_echo_n \"checking for fgrep... \" >&6; }\nif ${ac_cv_path_FGREP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1\n   then ac_cv_path_FGREP=\"$GREP -F\"\n   else\n     if test -z \"$FGREP\"; then\n  ac_path_FGREP_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in fgrep; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_FGREP=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_FGREP\" && $as_test_x \"$ac_path_FGREP\"; } || continue\n# Check for GNU ac_path_FGREP and select it if it is found.\n  # Check for GNU $ac_path_FGREP\ncase `\"$ac_path_FGREP\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_FGREP=\"$ac_path_FGREP\" ac_path_FGREP_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo 'FGREP' >> \"conftest.nl\"\n    \"$ac_path_FGREP\" FGREP < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_FGREP_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_FGREP=\"$ac_path_FGREP\"\n      ac_path_FGREP_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_FGREP_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_FGREP\"; then\n    as_fn_error $? \"no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_FGREP=$FGREP\nfi\n\n   fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP\" >&5\n$as_echo \"$ac_cv_path_FGREP\" >&6; }\n FGREP=\"$ac_cv_path_FGREP\"\n\n\ntest -z \"$GREP\" && GREP=grep\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Check whether --with-gnu-ld was given.\nif test \"${with_gnu_ld+set}\" = set; then :\n  withval=$with_gnu_ld; test \"$withval\" = no || with_gnu_ld=yes\nelse\n  with_gnu_ld=no\nfi\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ld used by $CC\" >&5\n$as_echo_n \"checking for ld used by $CC... \" >&6; }\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [\\\\/]* | ?:[\\\\/]*)\n      re_direlt='/[^/][^/]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for GNU ld\" >&5\n$as_echo_n \"checking for GNU ld... \" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for non-GNU ld\" >&5\n$as_echo_n \"checking for non-GNU ld... \" >&6; }\nfi\nif ${lt_cv_path_LD+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi\nfi\n\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LD\" >&5\n$as_echo \"$LD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\ntest -z \"$LD\" && as_fn_error $? \"no acceptable ld found in \\$PATH\" \"$LINENO\" 5\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld\" >&5\n$as_echo_n \"checking if the linker ($LD) is GNU ld... \" >&6; }\nif ${lt_cv_prog_gnu_ld+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  # I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld\" >&5\n$as_echo \"$lt_cv_prog_gnu_ld\" >&6; }\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)\" >&5\n$as_echo_n \"checking for BSD- or MS-compatible name lister (nm)... \" >&6; }\nif ${lt_cv_path_NM+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$NM\"; then\n  # Let the user override the test.\n  lt_cv_path_NM=\"$NM\"\nelse\n  lt_nm_to_check=\"${ac_tool_prefix}nm\"\n  if test -n \"$ac_tool_prefix\" && test \"$build\" = \"$host\"; then\n    lt_nm_to_check=\"$lt_nm_to_check nm\"\n  fi\n  for lt_tmp_nm in $lt_nm_to_check; do\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do\n      IFS=\"$lt_save_ifs\"\n      test -z \"$ac_dir\" && ac_dir=.\n      tmp_nm=\"$ac_dir/$lt_tmp_nm\"\n      if test -f \"$tmp_nm\" || test -f \"$tmp_nm$ac_exeext\" ; then\n\t# Check to see if the nm accepts a BSD-compat flag.\n\t# Adding the `sed 1q' prevents false positives on HP-UX, which says:\n\t#   nm: unknown option \"B\" ignored\n\t# Tru64's nm complains that /dev/null is an invalid object file\n\tcase `\"$tmp_nm\" -B /dev/null 2>&1 | sed '1q'` in\n\t*/dev/null* | *'Invalid file or object type'*)\n\t  lt_cv_path_NM=\"$tmp_nm -B\"\n\t  break\n\t  ;;\n\t*)\n\t  case `\"$tmp_nm\" -p /dev/null 2>&1 | sed '1q'` in\n\t  */dev/null*)\n\t    lt_cv_path_NM=\"$tmp_nm -p\"\n\t    break\n\t    ;;\n\t  *)\n\t    lt_cv_path_NM=${lt_cv_path_NM=\"$tmp_nm\"} # keep the first match, but\n\t    continue # so that we can try to find one that supports BSD flags\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n  done\n  : ${lt_cv_path_NM=no}\nfi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM\" >&5\n$as_echo \"$lt_cv_path_NM\" >&6; }\nif test \"$lt_cv_path_NM\" != \"no\"; then\n  NM=\"$lt_cv_path_NM\"\nelse\n  # Didn't find any BSD compatible name lister, look for dumpbin.\n  if test -n \"$DUMPBIN\"; then :\n    # Let the user override the test.\n  else\n    if test -n \"$ac_tool_prefix\"; then\n  for ac_prog in dumpbin \"link -dump\"\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_DUMPBIN+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$DUMPBIN\"; then\n  ac_cv_prog_DUMPBIN=\"$DUMPBIN\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_DUMPBIN=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nDUMPBIN=$ac_cv_prog_DUMPBIN\nif test -n \"$DUMPBIN\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $DUMPBIN\" >&5\n$as_echo \"$DUMPBIN\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$DUMPBIN\" && break\n  done\nfi\nif test -z \"$DUMPBIN\"; then\n  ac_ct_DUMPBIN=$DUMPBIN\n  for ac_prog in dumpbin \"link -dump\"\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_DUMPBIN\"; then\n  ac_cv_prog_ac_ct_DUMPBIN=\"$ac_ct_DUMPBIN\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_DUMPBIN=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN\nif test -n \"$ac_ct_DUMPBIN\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN\" >&5\n$as_echo \"$ac_ct_DUMPBIN\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_DUMPBIN\" && break\ndone\n\n  if test \"x$ac_ct_DUMPBIN\" = x; then\n    DUMPBIN=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    DUMPBIN=$ac_ct_DUMPBIN\n  fi\nfi\n\n    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in\n    *COFF*)\n      DUMPBIN=\"$DUMPBIN -symbols\"\n      ;;\n    *)\n      DUMPBIN=:\n      ;;\n    esac\n  fi\n\n  if test \"$DUMPBIN\" != \":\"; then\n    NM=\"$DUMPBIN\"\n  fi\nfi\ntest -z \"$NM\" && NM=nm\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface\" >&5\n$as_echo_n \"checking the name lister ($NM) interface... \" >&6; }\nif ${lt_cv_nm_interface+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_nm_interface=\"BSD nm\"\n  echo \"int some_variable = 0;\" > conftest.$ac_ext\n  (eval echo \"\\\"\\$as_me:$LINENO: $ac_compile\\\"\" >&5)\n  (eval \"$ac_compile\" 2>conftest.err)\n  cat conftest.err >&5\n  (eval echo \"\\\"\\$as_me:$LINENO: $NM \\\\\\\"conftest.$ac_objext\\\\\\\"\\\"\" >&5)\n  (eval \"$NM \\\"conftest.$ac_objext\\\"\" 2>conftest.err > conftest.out)\n  cat conftest.err >&5\n  (eval echo \"\\\"\\$as_me:$LINENO: output\\\"\" >&5)\n  cat conftest.out >&5\n  if $GREP 'External.*some_variable' conftest.out > /dev/null; then\n    lt_cv_nm_interface=\"MS dumpbin\"\n  fi\n  rm -f conftest*\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface\" >&5\n$as_echo \"$lt_cv_nm_interface\" >&6; }\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether ln -s works\" >&5\n$as_echo_n \"checking whether ln -s works... \" >&6; }\nLN_S=$as_ln_s\nif test \"$LN_S\" = \"ln -s\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no, using $LN_S\" >&5\n$as_echo \"no, using $LN_S\" >&6; }\nfi\n\n# find the maximum length of command line arguments\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments\" >&5\n$as_echo_n \"checking the maximum length of command line arguments... \" >&6; }\nif ${lt_cv_sys_max_cmd_len+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n    i=0\n  teststring=\"ABCD\"\n\n  case $build_os in\n  msdosdjgpp*)\n    # On DJGPP, this test can blow up pretty badly due to problems in libc\n    # (any single argument exceeding 2000 bytes causes a buffer overrun\n    # during glob expansion).  Even if it were fixed, the result of this\n    # check would be larger than it should be.\n    lt_cv_sys_max_cmd_len=12288;    # 12K is about right\n    ;;\n\n  gnu*)\n    # Under GNU Hurd, this test is not required because there is\n    # no limit to the length of command line arguments.\n    # Libtool will interpret -1 as no limit whatsoever\n    lt_cv_sys_max_cmd_len=-1;\n    ;;\n\n  cygwin* | mingw* | cegcc*)\n    # On Win9x/ME, this test blows up -- it succeeds, but takes\n    # about 5 minutes as the teststring grows exponentially.\n    # Worse, since 9x/ME are not pre-emptively multitasking,\n    # you end up with a \"frozen\" computer, even though with patience\n    # the test eventually succeeds (with a max line length of 256k).\n    # Instead, let's just punt: use the minimum linelength reported by\n    # all of the supported platforms: 8192 (on NT/2K/XP).\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  mint*)\n    # On MiNT this can take a long time and run out of memory.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  amigaos*)\n    # On AmigaOS with pdksh, this test takes hours, literally.\n    # So we just punt and use a minimum line length of 8192.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)\n    # This has been around since 386BSD, at least.  Likely further.\n    if test -x /sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`\n    elif test -x /usr/sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`\n    else\n      lt_cv_sys_max_cmd_len=65536\t# usable default for all BSDs\n    fi\n    # And add a safety zone\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    ;;\n\n  interix*)\n    # We know the value 262144 and hardcode it with a safety zone (like BSD)\n    lt_cv_sys_max_cmd_len=196608\n    ;;\n\n  os2*)\n    # The test takes a long time on OS/2.\n    lt_cv_sys_max_cmd_len=8192\n    ;;\n\n  osf*)\n    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure\n    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not\n    # nice to cause kernel panics so lets avoid the loop below.\n    # First set a reasonable default.\n    lt_cv_sys_max_cmd_len=16384\n    #\n    if test -x /sbin/sysconfig; then\n      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in\n        *1*) lt_cv_sys_max_cmd_len=-1 ;;\n      esac\n    fi\n    ;;\n  sco3.2v5*)\n    lt_cv_sys_max_cmd_len=102400\n    ;;\n  sysv5* | sco5v6* | sysv4.2uw2*)\n    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`\n    if test -n \"$kargmax\"; then\n      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[\t ]//'`\n    else\n      lt_cv_sys_max_cmd_len=32768\n    fi\n    ;;\n  *)\n    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`\n    if test -n \"$lt_cv_sys_max_cmd_len\"; then\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    else\n      # Make teststring a little bigger before we do anything with it.\n      # a 1K string should be a reasonable start.\n      for i in 1 2 3 4 5 6 7 8 ; do\n        teststring=$teststring$teststring\n      done\n      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}\n      # If test is not a shell built-in, we'll probably end up computing a\n      # maximum length that is only half of the actual maximum length, but\n      # we can't tell.\n      while { test \"X\"`env echo \"$teststring$teststring\" 2>/dev/null` \\\n\t         = \"X$teststring$teststring\"; } >/dev/null 2>&1 &&\n\t      test $i != 17 # 1/2 MB should be enough\n      do\n        i=`expr $i + 1`\n        teststring=$teststring$teststring\n      done\n      # Only check the string length outside the loop.\n      lt_cv_sys_max_cmd_len=`expr \"X$teststring\" : \".*\" 2>&1`\n      teststring=\n      # Add a significant safety factor because C++ compilers can tack on\n      # massive amounts of additional arguments before passing them to the\n      # linker.  It appears as though 1/2 is a usable value.\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 2`\n    fi\n    ;;\n  esac\n\nfi\n\nif test -n $lt_cv_sys_max_cmd_len ; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len\" >&5\n$as_echo \"$lt_cv_sys_max_cmd_len\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none\" >&5\n$as_echo \"none\" >&6; }\nfi\nmax_cmd_len=$lt_cv_sys_max_cmd_len\n\n\n\n\n\n\n: ${CP=\"cp -f\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs\" >&5\n$as_echo_n \"checking whether the shell understands some XSI constructs... \" >&6; }\n# Try some XSI features\nxsi_shell=no\n( _lt_dummy=\"a/b/c\"\n  test \"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}\"${_lt_dummy%\"$_lt_dummy\"}, \\\n      = c,a/b,b/c, \\\n    && eval 'test $(( 1 + 1 )) -eq 2 \\\n    && test \"${#_lt_dummy}\" -eq 5' ) >/dev/null 2>&1 \\\n  && xsi_shell=yes\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $xsi_shell\" >&5\n$as_echo \"$xsi_shell\" >&6; }\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the shell understands \\\"+=\\\"\" >&5\n$as_echo_n \"checking whether the shell understands \\\"+=\\\"... \" >&6; }\nlt_shell_append=no\n( foo=bar; set foo baz; eval \"$1+=\\$2\" && test \"$foo\" = barbaz ) \\\n    >/dev/null 2>&1 \\\n  && lt_shell_append=yes\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_shell_append\" >&5\n$as_echo \"$lt_shell_append\" >&6; }\n\n\nif ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then\n  lt_unset=unset\nelse\n  lt_unset=false\nfi\n\n\n\n\n\n# test EBCDIC or ASCII\ncase `echo X|tr X '\\101'` in\n A) # ASCII based system\n    # \\n is not interpreted correctly by Solaris 8 /usr/ucb/tr\n  lt_SP2NL='tr \\040 \\012'\n  lt_NL2SP='tr \\015\\012 \\040\\040'\n  ;;\n *) # EBCDIC based system\n  lt_SP2NL='tr \\100 \\n'\n  lt_NL2SP='tr \\r\\n \\100\\100'\n  ;;\nesac\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format\" >&5\n$as_echo_n \"checking how to convert $build file names to $host format... \" >&6; }\nif ${lt_cv_to_host_file_cmd+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  case $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32\n        ;;\n    esac\n    ;;\n  *-*-cygwin* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_noop\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin\n        ;;\n    esac\n    ;;\n  * ) # unhandled hosts (and \"normal\" native builds)\n    lt_cv_to_host_file_cmd=func_convert_file_noop\n    ;;\nesac\n\nfi\n\nto_host_file_cmd=$lt_cv_to_host_file_cmd\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd\" >&5\n$as_echo \"$lt_cv_to_host_file_cmd\" >&6; }\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format\" >&5\n$as_echo_n \"checking how to convert $build file names to toolchain format... \" >&6; }\nif ${lt_cv_to_tool_file_cmd+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  #assume ordinary cross tools, or native build.\nlt_cv_to_tool_file_cmd=func_convert_file_noop\ncase $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32\n        ;;\n    esac\n    ;;\nesac\n\nfi\n\nto_tool_file_cmd=$lt_cv_to_tool_file_cmd\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd\" >&5\n$as_echo \"$lt_cv_to_tool_file_cmd\" >&6; }\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files\" >&5\n$as_echo_n \"checking for $LD option to reload object files... \" >&6; }\nif ${lt_cv_ld_reload_flag+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_ld_reload_flag='-r'\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag\" >&5\n$as_echo \"$lt_cv_ld_reload_flag\" >&6; }\nreload_flag=$lt_cv_ld_reload_flag\ncase $reload_flag in\n\"\" | \" \"*) ;;\n*) reload_flag=\" $reload_flag\" ;;\nesac\nreload_cmds='$LD$reload_flag -o $output$reload_objs'\ncase $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    if test \"$GCC\" != yes; then\n      reload_cmds=false\n    fi\n    ;;\n  darwin*)\n    if test \"$GCC\" = yes; then\n      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'\n    else\n      reload_cmds='$LD$reload_flag -o $output$reload_objs'\n    fi\n    ;;\nesac\n\n\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}objdump\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}objdump; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_OBJDUMP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OBJDUMP\"; then\n  ac_cv_prog_OBJDUMP=\"$OBJDUMP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OBJDUMP=\"${ac_tool_prefix}objdump\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOBJDUMP=$ac_cv_prog_OBJDUMP\nif test -n \"$OBJDUMP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OBJDUMP\" >&5\n$as_echo \"$OBJDUMP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OBJDUMP\"; then\n  ac_ct_OBJDUMP=$OBJDUMP\n  # Extract the first word of \"objdump\", so it can be a program name with args.\nset dummy objdump; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OBJDUMP\"; then\n  ac_cv_prog_ac_ct_OBJDUMP=\"$ac_ct_OBJDUMP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OBJDUMP=\"objdump\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP\nif test -n \"$ac_ct_OBJDUMP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP\" >&5\n$as_echo \"$ac_ct_OBJDUMP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OBJDUMP\" = x; then\n    OBJDUMP=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OBJDUMP=$ac_ct_OBJDUMP\n  fi\nelse\n  OBJDUMP=\"$ac_cv_prog_OBJDUMP\"\nfi\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries\" >&5\n$as_echo_n \"checking how to recognize dependent libraries... \" >&6; }\nif ${lt_cv_deplibs_check_method+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_file_magic_cmd='$MAGIC_CMD'\nlt_cv_file_magic_test_file=\nlt_cv_deplibs_check_method='unknown'\n# Need to set the preceding variable on all platforms that support\n# interlibrary dependencies.\n# 'none' -- dependencies not supported.\n# `unknown' -- same as none, but documents that we really don't know.\n# 'pass_all' -- all dependencies passed with no checks.\n# 'test_compile' -- check by making test program.\n# 'file_magic [[regex]]' -- check by looking for files in library path\n# which responds to the $file_magic_cmd with a given extended regex.\n# If you have `file' or equivalent on your system and you're not sure\n# whether `pass_all' will *always* work, you probably want this one.\n\ncase $host_os in\naix[4-9]*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbeos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbsdi[45]*)\n  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'\n  lt_cv_file_magic_cmd='/usr/bin/file -L'\n  lt_cv_file_magic_test_file=/shlib/libc.so\n  ;;\n\ncygwin*)\n  # func_win32_libid is a shell function defined in ltmain.sh\n  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n  lt_cv_file_magic_cmd='func_win32_libid'\n  ;;\n\nmingw* | pw32*)\n  # Base MSYS/MinGW do not provide the 'file' command needed by\n  # func_win32_libid shell function, so use a weaker test based on 'objdump',\n  # unless we find 'file', for example because we are cross-compiling.\n  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.\n  if ( test \"$lt_cv_nm_interface\" = \"BSD nm\" && file / ) >/dev/null 2>&1; then\n    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n    lt_cv_file_magic_cmd='func_win32_libid'\n  else\n    # Keep this pattern in sync with the one in func_win32_libid.\n    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'\n    lt_cv_file_magic_cmd='$OBJDUMP -f'\n  fi\n  ;;\n\ncegcc*)\n  # use the weaker test based on 'objdump'. See mingw*.\n  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'\n  lt_cv_file_magic_cmd='$OBJDUMP -f'\n  ;;\n\ndarwin* | rhapsody*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nfreebsd* | dragonfly*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    case $host_cpu in\n    i*86 )\n      # Not sure whether the presence of OpenBSD here was a mistake.\n      # Let's accept both of them until this is cleared up.\n      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'\n      lt_cv_file_magic_cmd=/usr/bin/file\n      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`\n      ;;\n    esac\n  else\n    lt_cv_deplibs_check_method=pass_all\n  fi\n  ;;\n\ngnu*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhaiku*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhpux10.20* | hpux11*)\n  lt_cv_file_magic_cmd=/usr/bin/file\n  case $host_cpu in\n  ia64*)\n    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'\n    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so\n    ;;\n  hppa*64*)\n    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\\.[0-9]'\n    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl\n    ;;\n  *)\n    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\\.[0-9]) shared library'\n    lt_cv_file_magic_test_file=/usr/lib/libc.sl\n    ;;\n  esac\n  ;;\n\ninterix[3-9]*)\n  # PIC code is broken on Interix 3.x, that's why |\\.a not |_pic\\.a here\n  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so|\\.a)$'\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $LD in\n  *-32|*\"-32 \") libmagic=32-bit;;\n  *-n32|*\"-n32 \") libmagic=N32;;\n  *-64|*\"-64 \") libmagic=64-bit;;\n  *) libmagic=never-match;;\n  esac\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\n# This must be glibc/ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nnetbsd* | netbsdelf*-gnu)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so\\.[0-9]+\\.[0-9]+|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so|_pic\\.a)$'\n  fi\n  ;;\n\nnewos6*)\n  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'\n  lt_cv_file_magic_cmd=/usr/bin/file\n  lt_cv_file_magic_test_file=/usr/lib/libnls.so\n  ;;\n\n*nto* | *qnx*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nopenbsd*)\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so\\.[0-9]+\\.[0-9]+|\\.so|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so\\.[0-9]+\\.[0-9]+|_pic\\.a)$'\n  fi\n  ;;\n\nosf3* | osf4* | osf5*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nrdos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsolaris*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv4 | sysv4.3*)\n  case $host_vendor in\n  motorola)\n    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'\n    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`\n    ;;\n  ncr)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  sequent)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'\n    ;;\n  sni)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method=\"file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib\"\n    lt_cv_file_magic_test_file=/lib/libc.so\n    ;;\n  siemens)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  pc)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  esac\n  ;;\n\ntpf*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\nesac\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method\" >&5\n$as_echo \"$lt_cv_deplibs_check_method\" >&6; }\n\nfile_magic_glob=\nwant_nocaseglob=no\nif test \"$build\" = \"$host\"; then\n  case $host_os in\n  mingw* | pw32*)\n    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then\n      want_nocaseglob=yes\n    else\n      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e \"s/\\(..\\)/s\\/[\\1]\\/[\\1]\\/g;/g\"`\n    fi\n    ;;\n  esac\nfi\n\nfile_magic_cmd=$lt_cv_file_magic_cmd\ndeplibs_check_method=$lt_cv_deplibs_check_method\ntest -z \"$deplibs_check_method\" && deplibs_check_method=unknown\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}dlltool\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}dlltool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_DLLTOOL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$DLLTOOL\"; then\n  ac_cv_prog_DLLTOOL=\"$DLLTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_DLLTOOL=\"${ac_tool_prefix}dlltool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nDLLTOOL=$ac_cv_prog_DLLTOOL\nif test -n \"$DLLTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $DLLTOOL\" >&5\n$as_echo \"$DLLTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_DLLTOOL\"; then\n  ac_ct_DLLTOOL=$DLLTOOL\n  # Extract the first word of \"dlltool\", so it can be a program name with args.\nset dummy dlltool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_DLLTOOL\"; then\n  ac_cv_prog_ac_ct_DLLTOOL=\"$ac_ct_DLLTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_DLLTOOL=\"dlltool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL\nif test -n \"$ac_ct_DLLTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL\" >&5\n$as_echo \"$ac_ct_DLLTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_DLLTOOL\" = x; then\n    DLLTOOL=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    DLLTOOL=$ac_ct_DLLTOOL\n  fi\nelse\n  DLLTOOL=\"$ac_cv_prog_DLLTOOL\"\nfi\n\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries\" >&5\n$as_echo_n \"checking how to associate runtime and link libraries... \" >&6; }\nif ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_sharedlib_from_linklib_cmd='unknown'\n\ncase $host_os in\ncygwin* | mingw* | pw32* | cegcc*)\n  # two different shell functions defined in ltmain.sh\n  # decide which to use based on capabilities of $DLLTOOL\n  case `$DLLTOOL --help 2>&1` in\n  *--identify-strict*)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib\n    ;;\n  *)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback\n    ;;\n  esac\n  ;;\n*)\n  # fallback: assume linklib IS sharedlib\n  lt_cv_sharedlib_from_linklib_cmd=\"$ECHO\"\n  ;;\nesac\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd\" >&5\n$as_echo \"$lt_cv_sharedlib_from_linklib_cmd\" >&6; }\nsharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd\ntest -z \"$sharedlib_from_linklib_cmd\" && sharedlib_from_linklib_cmd=$ECHO\n\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  for ac_prog in ar\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_AR+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$AR\"; then\n  ac_cv_prog_AR=\"$AR\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_AR=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nAR=$ac_cv_prog_AR\nif test -n \"$AR\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $AR\" >&5\n$as_echo \"$AR\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$AR\" && break\n  done\nfi\nif test -z \"$AR\"; then\n  ac_ct_AR=$AR\n  for ac_prog in ar\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_AR+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_AR\"; then\n  ac_cv_prog_ac_ct_AR=\"$ac_ct_AR\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_AR=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_AR=$ac_cv_prog_ac_ct_AR\nif test -n \"$ac_ct_AR\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR\" >&5\n$as_echo \"$ac_ct_AR\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_AR\" && break\ndone\n\n  if test \"x$ac_ct_AR\" = x; then\n    AR=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    AR=$ac_ct_AR\n  fi\nfi\n\n: ${AR=ar}\n: ${AR_FLAGS=cru}\n\n\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support\" >&5\n$as_echo_n \"checking for archiver @FILE support... \" >&6; }\nif ${lt_cv_ar_at_file+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_ar_at_file=no\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  echo conftest.$ac_objext > conftest.lst\n      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'\n      { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$lt_ar_try\\\"\"; } >&5\n  (eval $lt_ar_try) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n      if test \"$ac_status\" -eq 0; then\n\t# Ensure the archiver fails upon bogus file names.\n\trm -f conftest.$ac_objext libconftest.a\n\t{ { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$lt_ar_try\\\"\"; } >&5\n  (eval $lt_ar_try) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n\tif test \"$ac_status\" -ne 0; then\n          lt_cv_ar_at_file=@\n        fi\n      fi\n      rm -f conftest.* libconftest.a\n\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file\" >&5\n$as_echo \"$lt_cv_ar_at_file\" >&6; }\n\nif test \"x$lt_cv_ar_at_file\" = xno; then\n  archiver_list_spec=\nelse\n  archiver_list_spec=$lt_cv_ar_at_file\nfi\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}strip\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_STRIP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$STRIP\"; then\n  ac_cv_prog_STRIP=\"$STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_STRIP=\"${ac_tool_prefix}strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nSTRIP=$ac_cv_prog_STRIP\nif test -n \"$STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $STRIP\" >&5\n$as_echo \"$STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_STRIP\"; then\n  ac_ct_STRIP=$STRIP\n  # Extract the first word of \"strip\", so it can be a program name with args.\nset dummy strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_STRIP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_STRIP\"; then\n  ac_cv_prog_ac_ct_STRIP=\"$ac_ct_STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_STRIP=\"strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP\nif test -n \"$ac_ct_STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP\" >&5\n$as_echo \"$ac_ct_STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_STRIP\" = x; then\n    STRIP=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    STRIP=$ac_ct_STRIP\n  fi\nelse\n  STRIP=\"$ac_cv_prog_STRIP\"\nfi\n\ntest -z \"$STRIP\" && STRIP=:\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}ranlib\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}ranlib; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_RANLIB+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$RANLIB\"; then\n  ac_cv_prog_RANLIB=\"$RANLIB\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_RANLIB=\"${ac_tool_prefix}ranlib\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nRANLIB=$ac_cv_prog_RANLIB\nif test -n \"$RANLIB\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $RANLIB\" >&5\n$as_echo \"$RANLIB\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_RANLIB\"; then\n  ac_ct_RANLIB=$RANLIB\n  # Extract the first word of \"ranlib\", so it can be a program name with args.\nset dummy ranlib; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_RANLIB+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_RANLIB\"; then\n  ac_cv_prog_ac_ct_RANLIB=\"$ac_ct_RANLIB\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_RANLIB=\"ranlib\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB\nif test -n \"$ac_ct_RANLIB\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB\" >&5\n$as_echo \"$ac_ct_RANLIB\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_RANLIB\" = x; then\n    RANLIB=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    RANLIB=$ac_ct_RANLIB\n  fi\nelse\n  RANLIB=\"$ac_cv_prog_RANLIB\"\nfi\n\ntest -z \"$RANLIB\" && RANLIB=:\n\n\n\n\n\n\n# Determine commands to create old-style static archives.\nold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'\nold_postinstall_cmds='chmod 644 $oldlib'\nold_postuninstall_cmds=\n\nif test -n \"$RANLIB\"; then\n  case $host_os in\n  openbsd*)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB -t \\$tool_oldlib\"\n    ;;\n  *)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB \\$tool_oldlib\"\n    ;;\n  esac\n  old_archive_cmds=\"$old_archive_cmds~\\$RANLIB \\$tool_oldlib\"\nfi\n\ncase $host_os in\n  darwin*)\n    lock_old_archive_extraction=yes ;;\n  *)\n    lock_old_archive_extraction=no ;;\nesac\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n\n\n# Check for command to grab the raw symbol name followed by C symbol from nm.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object\" >&5\n$as_echo_n \"checking command to parse $NM output from $compiler object... \" >&6; }\nif ${lt_cv_sys_global_symbol_pipe+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n\n# These are sane defaults that work on at least a few old systems.\n# [They come from Ultrix.  What could be older than Ultrix?!! ;)]\n\n# Character class describing NM global symbol codes.\nsymcode='[BCDEGRST]'\n\n# Regexp to match symbols that can be accessed directly from C.\nsympat='\\([_A-Za-z][_A-Za-z0-9]*\\)'\n\n# Define system-specific variables.\ncase $host_os in\naix*)\n  symcode='[BCDT]'\n  ;;\ncygwin* | mingw* | pw32* | cegcc*)\n  symcode='[ABCDGISTW]'\n  ;;\nhpux*)\n  if test \"$host_cpu\" = ia64; then\n    symcode='[ABCDEGRST]'\n  fi\n  ;;\nirix* | nonstopux*)\n  symcode='[BCDEGRST]'\n  ;;\nosf*)\n  symcode='[BCDEGQRST]'\n  ;;\nsolaris*)\n  symcode='[BDRT]'\n  ;;\nsco3.2v5*)\n  symcode='[DT]'\n  ;;\nsysv4.2uw2*)\n  symcode='[DT]'\n  ;;\nsysv5* | sco5v6* | unixware* | OpenUNIX*)\n  symcode='[ABDT]'\n  ;;\nsysv4)\n  symcode='[DFNSTU]'\n  ;;\nesac\n\n# If we're using GNU nm, then use its standard symbol codes.\ncase `$NM -V 2>&1` in\n*GNU* | *'with BFD'*)\n  symcode='[ABCDGIRSTW]' ;;\nesac\n\n# Transform an extracted symbol line into a proper C declaration.\n# Some systems (esp. on ia64) link data and code symbols differently,\n# so use this general approach.\nlt_cv_sys_global_symbol_to_cdecl=\"sed -n -e 's/^T .* \\(.*\\)$/extern int \\1();/p' -e 's/^$symcode* .* \\(.*\\)$/extern char \\1;/p'\"\n\n# Transform an extracted symbol line into symbol name and symbol address\nlt_cv_sys_global_symbol_to_c_name_address=\"sed -n -e 's/^: \\([^ ]*\\)[ ]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([^ ]*\\) \\([^ ]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p'\"\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix=\"sed -n -e 's/^: \\([^ ]*\\)[ ]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([^ ]*\\) \\(lib[^ ]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p' -e 's/^$symcode* \\([^ ]*\\) \\([^ ]*\\)$/  {\\\"lib\\2\\\", (void *) \\&\\2},/p'\"\n\n# Handle CRLF in mingw tool chain\nopt_cr=\ncase $build_os in\nmingw*)\n  opt_cr=`$ECHO 'x\\{0,1\\}' | tr x '\\015'` # option cr in regexp\n  ;;\nesac\n\n# Try without a prefix underscore, then with it.\nfor ac_symprfx in \"\" \"_\"; do\n\n  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.\n  symxfrm=\"\\\\1 $ac_symprfx\\\\2 \\\\2\"\n\n  # Write the raw and C identifiers.\n  if test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n    # Fake it for dumpbin and say T for any non-static function\n    # and D for any global variable.\n    # Also find C++ and __fastcall symbols from MSVC++,\n    # which start with @ or ?.\n    lt_cv_sys_global_symbol_pipe=\"$AWK '\"\\\n\"     {last_section=section; section=\\$ 3};\"\\\n\"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};\"\\\n\"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};\"\\\n\"     \\$ 0!~/External *\\|/{next};\"\\\n\"     / 0+ UNDEF /{next}; / UNDEF \\([^|]\\)*()/{next};\"\\\n\"     {if(hide[section]) next};\"\\\n\"     {f=0}; \\$ 0~/\\(\\).*\\|/{f=1}; {printf f ? \\\"T \\\" : \\\"D \\\"};\"\\\n\"     {split(\\$ 0, a, /\\||\\r/); split(a[2], s)};\"\\\n\"     s[1]~/^[@?]/{print s[1], s[1]; next};\"\\\n\"     s[1]~prfx {split(s[1],t,\\\"@\\\"); print t[1], substr(t[1],length(prfx))}\"\\\n\"     ' prfx=^$ac_symprfx\"\n  else\n    lt_cv_sys_global_symbol_pipe=\"sed -n -e 's/^.*[\t ]\\($symcode$symcode*\\)[\t ][\t ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'\"\n  fi\n  lt_cv_sys_global_symbol_pipe=\"$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'\"\n\n  # Check to see that the pipe works correctly.\n  pipe_works=no\n\n  rm -f conftest*\n  cat > conftest.$ac_ext <<_LT_EOF\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nchar nm_test_var;\nvoid nm_test_func(void);\nvoid nm_test_func(void){}\n#ifdef __cplusplus\n}\n#endif\nint main(){nm_test_var='a';nm_test_func();return(0);}\n_LT_EOF\n\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    # Now try to grab the symbols.\n    nlist=conftest.nm\n    if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$NM conftest.$ac_objext \\| \"$lt_cv_sys_global_symbol_pipe\" \\> $nlist\\\"\"; } >&5\n  (eval $NM conftest.$ac_objext \\| \"$lt_cv_sys_global_symbol_pipe\" \\> $nlist) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s \"$nlist\"; then\n      # Try sorting and uniquifying the output.\n      if sort \"$nlist\" | uniq > \"$nlist\"T; then\n\tmv -f \"$nlist\"T \"$nlist\"\n      else\n\trm -f \"$nlist\"T\n      fi\n\n      # Make sure that we snagged all the symbols we need.\n      if $GREP ' nm_test_var$' \"$nlist\" >/dev/null; then\n\tif $GREP ' nm_test_func$' \"$nlist\" >/dev/null; then\n\t  cat <<_LT_EOF > conftest.$ac_ext\n/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */\n#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)\n/* DATA imports from DLLs on WIN32 con't be const, because runtime\n   relocations are performed -- see ld's documentation on pseudo-relocs.  */\n# define LT_DLSYM_CONST\n#elif defined(__osf__)\n/* This system does not cope well with relocations in const data.  */\n# define LT_DLSYM_CONST\n#else\n# define LT_DLSYM_CONST const\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n_LT_EOF\n\t  # Now generate the symbol file.\n\t  eval \"$lt_cv_sys_global_symbol_to_cdecl\"' < \"$nlist\" | $GREP -v main >> conftest.$ac_ext'\n\n\t  cat <<_LT_EOF >> conftest.$ac_ext\n\n/* The mapping between symbol names and symbols.  */\nLT_DLSYM_CONST struct {\n  const char *name;\n  void       *address;\n}\nlt__PROGRAM__LTX_preloaded_symbols[] =\n{\n  { \"@PROGRAM@\", (void *) 0 },\n_LT_EOF\n\t  $SED \"s/^$symcode$symcode* \\(.*\\) \\(.*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/\" < \"$nlist\" | $GREP -v main >> conftest.$ac_ext\n\t  cat <<\\_LT_EOF >> conftest.$ac_ext\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt__PROGRAM__LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n_LT_EOF\n\t  # Now try linking the two files.\n\t  mv conftest.$ac_objext conftstm.$ac_objext\n\t  lt_globsym_save_LIBS=$LIBS\n\t  lt_globsym_save_CFLAGS=$CFLAGS\n\t  LIBS=\"conftstm.$ac_objext\"\n\t  CFLAGS=\"$CFLAGS$lt_prog_compiler_no_builtin_flag\"\n\t  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_link\\\"\"; } >&5\n  (eval $ac_link) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s conftest${ac_exeext}; then\n\t    pipe_works=yes\n\t  fi\n\t  LIBS=$lt_globsym_save_LIBS\n\t  CFLAGS=$lt_globsym_save_CFLAGS\n\telse\n\t  echo \"cannot find nm_test_func in $nlist\" >&5\n\tfi\n      else\n\techo \"cannot find nm_test_var in $nlist\" >&5\n      fi\n    else\n      echo \"cannot run $lt_cv_sys_global_symbol_pipe\" >&5\n    fi\n  else\n    echo \"$progname: failed program was:\" >&5\n    cat conftest.$ac_ext >&5\n  fi\n  rm -rf conftest* conftst*\n\n  # Do not use the global_symbol_pipe unless it works.\n  if test \"$pipe_works\" = yes; then\n    break\n  else\n    lt_cv_sys_global_symbol_pipe=\n  fi\ndone\n\nfi\n\nif test -z \"$lt_cv_sys_global_symbol_pipe\"; then\n  lt_cv_sys_global_symbol_to_cdecl=\nfi\nif test -z \"$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: failed\" >&5\n$as_echo \"failed\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: ok\" >&5\n$as_echo \"ok\" >&6; }\nfi\n\n# Response file support.\nif test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n  nm_file_list_spec='@'\nelif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then\n  nm_file_list_spec='@'\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for sysroot\" >&5\n$as_echo_n \"checking for sysroot... \" >&6; }\n\n# Check whether --with-sysroot was given.\nif test \"${with_sysroot+set}\" = set; then :\n  withval=$with_sysroot;\nelse\n  with_sysroot=no\nfi\n\n\nlt_sysroot=\ncase ${with_sysroot} in #(\n yes)\n   if test \"$GCC\" = yes; then\n     lt_sysroot=`$CC --print-sysroot 2>/dev/null`\n   fi\n   ;; #(\n /*)\n   lt_sysroot=`echo \"$with_sysroot\" | sed -e \"$sed_quote_subst\"`\n   ;; #(\n no|'')\n   ;; #(\n *)\n   { $as_echo \"$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}\" >&5\n$as_echo \"${with_sysroot}\" >&6; }\n   as_fn_error $? \"The sysroot must be an absolute path.\" \"$LINENO\" 5\n   ;;\nesac\n\n { $as_echo \"$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}\" >&5\n$as_echo \"${lt_sysroot:-no}\" >&6; }\n\n\n\n\n\n\n# Check whether --enable-libtool-lock was given.\nif test \"${enable_libtool_lock+set}\" = set; then :\n  enableval=$enable_libtool_lock;\nfi\n\ntest \"x$enable_libtool_lock\" != xno && enable_libtool_lock=yes\n\n# Some flags need to be propagated to the compiler or linker for good\n# libtool support.\ncase $host in\nia64-*-hpux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    case `/usr/bin/file conftest.$ac_objext` in\n      *ELF-32*)\n\tHPUX_IA64_MODE=\"32\"\n\t;;\n      *ELF-64*)\n\tHPUX_IA64_MODE=\"64\"\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n*-*-irix6*)\n  # Find out which ABI we are using.\n  echo '#line '$LINENO' \"configure\"' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    if test \"$lt_cv_prog_gnu_ld\" = yes; then\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -melf32bsmip\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -melf32bmipn32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -melf64bmip\"\n\t;;\n      esac\n    else\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -32\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -n32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -64\"\n\t  ;;\n      esac\n    fi\n  fi\n  rm -rf conftest*\n  ;;\n\nx86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \\\ns390*-*linux*|s390*-*tpf*|sparc*-*linux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    case `/usr/bin/file conftest.o` in\n      *32-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_i386_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_i386\"\n\t    ;;\n\t  ppc64-*linux*|powerpc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32ppclinux\"\n\t    ;;\n\t  s390x-*linux*)\n\t    LD=\"${LD-ld} -m elf_s390\"\n\t    ;;\n\t  sparc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32_sparc\"\n\t    ;;\n\tesac\n\t;;\n      *64-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_x86_64_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_x86_64\"\n\t    ;;\n\t  ppc*-*linux*|powerpc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64ppc\"\n\t    ;;\n\t  s390*-*linux*|s390*-*tpf*)\n\t    LD=\"${LD-ld} -m elf64_s390\"\n\t    ;;\n\t  sparc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64_sparc\"\n\t    ;;\n\tesac\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n\n*-*-sco3.2v5*)\n  # On SCO OpenServer 5, we need -belf to get full-featured binaries.\n  SAVE_CFLAGS=\"$CFLAGS\"\n  CFLAGS=\"$CFLAGS -belf\"\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf\" >&5\n$as_echo_n \"checking whether the C compiler needs -belf... \" >&6; }\nif ${lt_cv_cc_needs_belf+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n     cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  lt_cv_cc_needs_belf=yes\nelse\n  lt_cv_cc_needs_belf=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n     ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf\" >&5\n$as_echo \"$lt_cv_cc_needs_belf\" >&6; }\n  if test x\"$lt_cv_cc_needs_belf\" != x\"yes\"; then\n    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf\n    CFLAGS=\"$SAVE_CFLAGS\"\n  fi\n  ;;\n*-*solaris*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    case `/usr/bin/file conftest.o` in\n    *64-bit*)\n      case $lt_cv_prog_gnu_ld in\n      yes*)\n        case $host in\n        i?86-*-solaris*)\n          LD=\"${LD-ld} -m elf_x86_64\"\n          ;;\n        sparc*-*-solaris*)\n          LD=\"${LD-ld} -m elf64_sparc\"\n          ;;\n        esac\n        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.\n        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then\n          LD=\"${LD-ld}_sol2\"\n        fi\n        ;;\n      *)\n\tif ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then\n\t  LD=\"${LD-ld} -64\"\n\tfi\n\t;;\n      esac\n      ;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\nesac\n\nneed_locks=\"$enable_libtool_lock\"\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}mt\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}mt; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_MANIFEST_TOOL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$MANIFEST_TOOL\"; then\n  ac_cv_prog_MANIFEST_TOOL=\"$MANIFEST_TOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_MANIFEST_TOOL=\"${ac_tool_prefix}mt\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nMANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL\nif test -n \"$MANIFEST_TOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL\" >&5\n$as_echo \"$MANIFEST_TOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_MANIFEST_TOOL\"; then\n  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL\n  # Extract the first word of \"mt\", so it can be a program name with args.\nset dummy mt; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_MANIFEST_TOOL\"; then\n  ac_cv_prog_ac_ct_MANIFEST_TOOL=\"$ac_ct_MANIFEST_TOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_MANIFEST_TOOL=\"mt\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL\nif test -n \"$ac_ct_MANIFEST_TOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL\" >&5\n$as_echo \"$ac_ct_MANIFEST_TOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_MANIFEST_TOOL\" = x; then\n    MANIFEST_TOOL=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL\n  fi\nelse\n  MANIFEST_TOOL=\"$ac_cv_prog_MANIFEST_TOOL\"\nfi\n\ntest -z \"$MANIFEST_TOOL\" && MANIFEST_TOOL=mt\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool\" >&5\n$as_echo_n \"checking if $MANIFEST_TOOL is a manifest tool... \" >&6; }\nif ${lt_cv_path_mainfest_tool+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_path_mainfest_tool=no\n  echo \"$as_me:$LINENO: $MANIFEST_TOOL '-?'\" >&5\n  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out\n  cat conftest.err >&5\n  if $GREP 'Manifest Tool' conftest.out > /dev/null; then\n    lt_cv_path_mainfest_tool=yes\n  fi\n  rm -f conftest*\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool\" >&5\n$as_echo \"$lt_cv_path_mainfest_tool\" >&6; }\nif test \"x$lt_cv_path_mainfest_tool\" != xyes; then\n  MANIFEST_TOOL=:\nfi\n\n\n\n\n\n\n  case $host_os in\n    rhapsody* | darwin*)\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}dsymutil\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}dsymutil; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_DSYMUTIL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$DSYMUTIL\"; then\n  ac_cv_prog_DSYMUTIL=\"$DSYMUTIL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_DSYMUTIL=\"${ac_tool_prefix}dsymutil\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nDSYMUTIL=$ac_cv_prog_DSYMUTIL\nif test -n \"$DSYMUTIL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL\" >&5\n$as_echo \"$DSYMUTIL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_DSYMUTIL\"; then\n  ac_ct_DSYMUTIL=$DSYMUTIL\n  # Extract the first word of \"dsymutil\", so it can be a program name with args.\nset dummy dsymutil; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_DSYMUTIL\"; then\n  ac_cv_prog_ac_ct_DSYMUTIL=\"$ac_ct_DSYMUTIL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_DSYMUTIL=\"dsymutil\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL\nif test -n \"$ac_ct_DSYMUTIL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL\" >&5\n$as_echo \"$ac_ct_DSYMUTIL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_DSYMUTIL\" = x; then\n    DSYMUTIL=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    DSYMUTIL=$ac_ct_DSYMUTIL\n  fi\nelse\n  DSYMUTIL=\"$ac_cv_prog_DSYMUTIL\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}nmedit\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}nmedit; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_NMEDIT+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$NMEDIT\"; then\n  ac_cv_prog_NMEDIT=\"$NMEDIT\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_NMEDIT=\"${ac_tool_prefix}nmedit\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nNMEDIT=$ac_cv_prog_NMEDIT\nif test -n \"$NMEDIT\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $NMEDIT\" >&5\n$as_echo \"$NMEDIT\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_NMEDIT\"; then\n  ac_ct_NMEDIT=$NMEDIT\n  # Extract the first word of \"nmedit\", so it can be a program name with args.\nset dummy nmedit; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_NMEDIT\"; then\n  ac_cv_prog_ac_ct_NMEDIT=\"$ac_ct_NMEDIT\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_NMEDIT=\"nmedit\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT\nif test -n \"$ac_ct_NMEDIT\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT\" >&5\n$as_echo \"$ac_ct_NMEDIT\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_NMEDIT\" = x; then\n    NMEDIT=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    NMEDIT=$ac_ct_NMEDIT\n  fi\nelse\n  NMEDIT=\"$ac_cv_prog_NMEDIT\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}lipo\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}lipo; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_LIPO+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$LIPO\"; then\n  ac_cv_prog_LIPO=\"$LIPO\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_LIPO=\"${ac_tool_prefix}lipo\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nLIPO=$ac_cv_prog_LIPO\nif test -n \"$LIPO\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LIPO\" >&5\n$as_echo \"$LIPO\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_LIPO\"; then\n  ac_ct_LIPO=$LIPO\n  # Extract the first word of \"lipo\", so it can be a program name with args.\nset dummy lipo; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_LIPO+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_LIPO\"; then\n  ac_cv_prog_ac_ct_LIPO=\"$ac_ct_LIPO\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_LIPO=\"lipo\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO\nif test -n \"$ac_ct_LIPO\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO\" >&5\n$as_echo \"$ac_ct_LIPO\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_LIPO\" = x; then\n    LIPO=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    LIPO=$ac_ct_LIPO\n  fi\nelse\n  LIPO=\"$ac_cv_prog_LIPO\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}otool\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}otool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_OTOOL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OTOOL\"; then\n  ac_cv_prog_OTOOL=\"$OTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OTOOL=\"${ac_tool_prefix}otool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOTOOL=$ac_cv_prog_OTOOL\nif test -n \"$OTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OTOOL\" >&5\n$as_echo \"$OTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OTOOL\"; then\n  ac_ct_OTOOL=$OTOOL\n  # Extract the first word of \"otool\", so it can be a program name with args.\nset dummy otool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_OTOOL+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OTOOL\"; then\n  ac_cv_prog_ac_ct_OTOOL=\"$ac_ct_OTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OTOOL=\"otool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL\nif test -n \"$ac_ct_OTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL\" >&5\n$as_echo \"$ac_ct_OTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OTOOL\" = x; then\n    OTOOL=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OTOOL=$ac_ct_OTOOL\n  fi\nelse\n  OTOOL=\"$ac_cv_prog_OTOOL\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}otool64\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}otool64; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_OTOOL64+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OTOOL64\"; then\n  ac_cv_prog_OTOOL64=\"$OTOOL64\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OTOOL64=\"${ac_tool_prefix}otool64\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOTOOL64=$ac_cv_prog_OTOOL64\nif test -n \"$OTOOL64\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OTOOL64\" >&5\n$as_echo \"$OTOOL64\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OTOOL64\"; then\n  ac_ct_OTOOL64=$OTOOL64\n  # Extract the first word of \"otool64\", so it can be a program name with args.\nset dummy otool64; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OTOOL64\"; then\n  ac_cv_prog_ac_ct_OTOOL64=\"$ac_ct_OTOOL64\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OTOOL64=\"otool64\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64\nif test -n \"$ac_ct_OTOOL64\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64\" >&5\n$as_echo \"$ac_ct_OTOOL64\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OTOOL64\" = x; then\n    OTOOL64=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OTOOL64=$ac_ct_OTOOL64\n  fi\nelse\n  OTOOL64=\"$ac_cv_prog_OTOOL64\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag\" >&5\n$as_echo_n \"checking for -single_module linker flag... \" >&6; }\nif ${lt_cv_apple_cc_single_mod+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_apple_cc_single_mod=no\n      if test -z \"${LT_MULTI_MODULE}\"; then\n\t# By default we will add the -single_module flag. You can override\n\t# by either setting the environment variable LT_MULTI_MODULE\n\t# non-empty at configure time, or by adding -multi_module to the\n\t# link flags.\n\trm -rf libconftest.dylib*\n\techo \"int foo(void){return 1;}\" > conftest.c\n\techo \"$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n-dynamiclib -Wl,-single_module conftest.c\" >&5\n\t$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n\t  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err\n        _lt_result=$?\n\t# If there is a non-empty error log, and \"single_module\"\n\t# appears in it, assume the flag caused a linker warning\n        if test -s conftest.err && $GREP single_module conftest.err; then\n\t  cat conftest.err >&5\n\t# Otherwise, if the output was created with a 0 exit code from\n\t# the compiler, it worked.\n\telif test -f libconftest.dylib && test $_lt_result -eq 0; then\n\t  lt_cv_apple_cc_single_mod=yes\n\telse\n\t  cat conftest.err >&5\n\tfi\n\trm -rf libconftest.dylib*\n\trm -f conftest.*\n      fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod\" >&5\n$as_echo \"$lt_cv_apple_cc_single_mod\" >&6; }\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag\" >&5\n$as_echo_n \"checking for -exported_symbols_list linker flag... \" >&6; }\nif ${lt_cv_ld_exported_symbols_list+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_ld_exported_symbols_list=no\n      save_LDFLAGS=$LDFLAGS\n      echo \"_main\" > conftest.sym\n      LDFLAGS=\"$LDFLAGS -Wl,-exported_symbols_list,conftest.sym\"\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  lt_cv_ld_exported_symbols_list=yes\nelse\n  lt_cv_ld_exported_symbols_list=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\tLDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list\" >&5\n$as_echo \"$lt_cv_ld_exported_symbols_list\" >&6; }\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag\" >&5\n$as_echo_n \"checking for -force_load linker flag... \" >&6; }\nif ${lt_cv_ld_force_load+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_ld_force_load=no\n      cat > conftest.c << _LT_EOF\nint forced_loaded() { return 2;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS -c -o conftest.o conftest.c\" >&5\n      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5\n      echo \"$AR cru libconftest.a conftest.o\" >&5\n      $AR cru libconftest.a conftest.o 2>&5\n      echo \"$RANLIB libconftest.a\" >&5\n      $RANLIB libconftest.a 2>&5\n      cat > conftest.c << _LT_EOF\nint main() { return 0;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a\" >&5\n      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err\n      _lt_result=$?\n      if test -s conftest.err && $GREP force_load conftest.err; then\n\tcat conftest.err >&5\n      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then\n\tlt_cv_ld_force_load=yes\n      else\n\tcat conftest.err >&5\n      fi\n        rm -f conftest.err libconftest.a conftest conftest.c\n        rm -rf conftest.dSYM\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load\" >&5\n$as_echo \"$lt_cv_ld_force_load\" >&6; }\n    case $host_os in\n    rhapsody* | darwin1.[012])\n      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;\n    darwin1.*)\n      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n    darwin*) # darwin 5.x on\n      # if running on 10.5 or later, the deployment target defaults\n      # to the OS version, if on x86, and 10.4, the deployment\n      # target defaults to 10.4. Don't you love it?\n      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in\n\t10.0,*86*-darwin8*|10.0,*-darwin[91]*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n\t10.[012]*)\n\t  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n\t10.*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n      esac\n    ;;\n  esac\n    if test \"$lt_cv_apple_cc_single_mod\" = \"yes\"; then\n      _lt_dar_single_mod='$single_module'\n    fi\n    if test \"$lt_cv_ld_exported_symbols_list\" = \"yes\"; then\n      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'\n    else\n      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'\n    fi\n    if test \"$DSYMUTIL\" != \":\" && test \"$lt_cv_ld_force_load\" = \"no\"; then\n      _lt_dsymutil='~$DSYMUTIL $lib || :'\n    else\n      _lt_dsymutil=\n    fi\n    ;;\n  esac\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor\" >&5\n$as_echo_n \"checking how to run the C preprocessor... \" >&6; }\n# On Suns, sometimes $CPP names a directory.\nif test -n \"$CPP\" && test -d \"$CPP\"; then\n  CPP=\nfi\nif test -z \"$CPP\"; then\n  if ${ac_cv_prog_CPP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n      # Double quotes because CPP needs to be expanded\n    for CPP in \"$CC -E\" \"$CC -E -traditional-cpp\" \"/lib/cpp\"\n    do\n      ac_preproc_ok=false\nfor ac_c_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.i conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n  break\nfi\n\n    done\n    ac_cv_prog_CPP=$CPP\n\nfi\n  CPP=$ac_cv_prog_CPP\nelse\n  ac_cv_prog_CPP=$CPP\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CPP\" >&5\n$as_echo \"$CPP\" >&6; }\nac_preproc_ok=false\nfor ac_c_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.i conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n\nelse\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"C preprocessor \\\"$CPP\\\" fails sanity check\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\nfi\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ANSI C header files\" >&5\n$as_echo_n \"checking for ANSI C header files... \" >&6; }\nif ${ac_cv_header_stdc+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdlib.h>\n#include <stdarg.h>\n#include <string.h>\n#include <float.h>\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_header_stdc=yes\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n\nif test $ac_cv_header_stdc = yes; then\n  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <string.h>\n\n_ACEOF\nif (eval \"$ac_cpp conftest.$ac_ext\") 2>&5 |\n  $EGREP \"memchr\" >/dev/null 2>&1; then :\n\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f conftest*\n\nfi\n\nif test $ac_cv_header_stdc = yes; then\n  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdlib.h>\n\n_ACEOF\nif (eval \"$ac_cpp conftest.$ac_ext\") 2>&5 |\n  $EGREP \"free\" >/dev/null 2>&1; then :\n\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f conftest*\n\nfi\n\nif test $ac_cv_header_stdc = yes; then\n  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.\n  if test \"$cross_compiling\" = yes; then :\n  :\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ctype.h>\n#include <stdlib.h>\n#if ((' ' & 0x0FF) == 0x020)\n# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')\n# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))\n#else\n# define ISLOWER(c) \\\n\t\t   (('a' <= (c) && (c) <= 'i') \\\n\t\t     || ('j' <= (c) && (c) <= 'r') \\\n\t\t     || ('s' <= (c) && (c) <= 'z'))\n# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))\n#endif\n\n#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))\nint\nmain ()\n{\n  int i;\n  for (i = 0; i < 256; i++)\n    if (XOR (islower (i), ISLOWER (i))\n\t|| toupper (i) != TOUPPER (i))\n      return 2;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_run \"$LINENO\"; then :\n\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \\\n  conftest.$ac_objext conftest.beam conftest.$ac_ext\nfi\n\nfi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc\" >&5\n$as_echo \"$ac_cv_header_stdc\" >&6; }\nif test $ac_cv_header_stdc = yes; then\n\n$as_echo \"#define STDC_HEADERS 1\" >>confdefs.h\n\nfi\n\n# On IRIX 5.3, sys/types and inttypes.h are conflicting.\nfor ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \\\n\t\t  inttypes.h stdint.h unistd.h\ndo :\n  as_ac_Header=`$as_echo \"ac_cv_header_$ac_header\" | $as_tr_sh`\nac_fn_c_check_header_compile \"$LINENO\" \"$ac_header\" \"$as_ac_Header\" \"$ac_includes_default\n\"\nif eval test \\\"x\\$\"$as_ac_Header\"\\\" = x\"yes\"; then :\n  cat >>confdefs.h <<_ACEOF\n#define `$as_echo \"HAVE_$ac_header\" | $as_tr_cpp` 1\n_ACEOF\n\nfi\n\ndone\n\n\nfor ac_header in dlfcn.h\ndo :\n  ac_fn_c_check_header_compile \"$LINENO\" \"dlfcn.h\" \"ac_cv_header_dlfcn_h\" \"$ac_includes_default\n\"\nif test \"x$ac_cv_header_dlfcn_h\" = xyes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_DLFCN_H 1\n_ACEOF\n\nfi\n\ndone\n\n\n\nfunc_stripname_cnf ()\n{\n  case ${2} in\n  .*) func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%\\\\\\\\${2}\\$%%\"`;;\n  *)  func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%${2}\\$%%\"`;;\n  esac\n} # func_stripname_cnf\n\n\n\n\n\n# Set options\n\n\n\n        enable_dlopen=no\n\n\n  enable_win32_dll=no\n\n\n            # Check whether --enable-shared was given.\nif test \"${enable_shared+set}\" = set; then :\n  enableval=$enable_shared; p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_shared=yes ;;\n    no) enable_shared=no ;;\n    *)\n      enable_shared=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_shared=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  enable_shared=yes\nfi\n\n\n\n\n\n\n\n\n\n  # Check whether --enable-static was given.\nif test \"${enable_static+set}\" = set; then :\n  enableval=$enable_static; p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_static=yes ;;\n    no) enable_static=no ;;\n    *)\n     enable_static=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_static=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  enable_static=yes\nfi\n\n\n\n\n\n\n\n\n\n\n# Check whether --with-pic was given.\nif test \"${with_pic+set}\" = set; then :\n  withval=$with_pic; lt_p=${PACKAGE-default}\n    case $withval in\n    yes|no) pic_mode=$withval ;;\n    *)\n      pic_mode=default\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for lt_pkg in $withval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$lt_pkg\" = \"X$lt_p\"; then\n\t  pic_mode=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  pic_mode=default\nfi\n\n\ntest -z \"$pic_mode\" && pic_mode=default\n\n\n\n\n\n\n\n  # Check whether --enable-fast-install was given.\nif test \"${enable_fast_install+set}\" = set; then :\n  enableval=$enable_fast_install; p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_fast_install=yes ;;\n    no) enable_fast_install=no ;;\n    *)\n      enable_fast_install=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_fast_install=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  enable_fast_install=yes\nfi\n\n\n\n\n\n\n\n\n\n\n\n# This can be used to rebuild libtool when needed\nLIBTOOL_DEPS=\"$ltmain\"\n\n# Always use our own libtool.\nLIBTOOL='$(SHELL) $(top_builddir)/libtool'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ntest -z \"$LN_S\" && LN_S=\"ln -s\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif test -n \"${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for objdir\" >&5\n$as_echo_n \"checking for objdir... \" >&6; }\nif ${lt_cv_objdir+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  rm -f .libs 2>/dev/null\nmkdir .libs 2>/dev/null\nif test -d .libs; then\n  lt_cv_objdir=.libs\nelse\n  # MS-DOS does not allow filenames that begin with a dot.\n  lt_cv_objdir=_libs\nfi\nrmdir .libs 2>/dev/null\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir\" >&5\n$as_echo \"$lt_cv_objdir\" >&6; }\nobjdir=$lt_cv_objdir\n\n\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define LT_OBJDIR \"$lt_cv_objdir/\"\n_ACEOF\n\n\n\n\ncase $host_os in\naix3*)\n  # AIX sometimes has problems with the GCC collect2 program.  For some\n  # reason, if we set the COLLECT_NAMES environment variable, the problems\n  # vanish in a puff of smoke.\n  if test \"X${COLLECT_NAMES+set}\" != Xset; then\n    COLLECT_NAMES=\n    export COLLECT_NAMES\n  fi\n  ;;\nesac\n\n# Global variables:\nofile=libtool\ncan_build_shared=yes\n\n# All known linkers require a `.a' archive for static linking (except MSVC,\n# which needs '.lib').\nlibext=a\n\nwith_gnu_ld=\"$lt_cv_prog_gnu_ld\"\n\nold_CC=\"$CC\"\nold_CFLAGS=\"$CFLAGS\"\n\n# Set sane defaults for various variables\ntest -z \"$CC\" && CC=cc\ntest -z \"$LTCC\" && LTCC=$CC\ntest -z \"$LTCFLAGS\" && LTCFLAGS=$CFLAGS\ntest -z \"$LD\" && LD=ld\ntest -z \"$ac_objext\" && ac_objext=o\n\nfor cc_temp in $compiler\"\"; do\n  case $cc_temp in\n    compile | *[\\\\/]compile | ccache | *[\\\\/]ccache ) ;;\n    distcc | *[\\\\/]distcc | purify | *[\\\\/]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"$cc_temp\" | $SED \"s%.*/%%; s%^$host_alias-%%\"`\n\n\n# Only perform the check for file, if the check method requires it\ntest -z \"$MAGIC_CMD\" && MAGIC_CMD=file\ncase $deplibs_check_method in\nfile_magic*)\n  if test \"$file_magic_cmd\" = '$MAGIC_CMD'; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file\" >&5\n$as_echo_n \"checking for ${ac_tool_prefix}file... \" >&6; }\nif ${lt_cv_path_MAGIC_CMD+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  case $MAGIC_CMD in\n[\\\\/*] |  ?:[\\\\/]*)\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  ac_dummy=\"/usr/bin$PATH_SEPARATOR$PATH\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/${ac_tool_prefix}file; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/${ac_tool_prefix}file\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac\nfi\n\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD\" >&5\n$as_echo \"$MAGIC_CMD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n\n\n\nif test -z \"$lt_cv_path_MAGIC_CMD\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for file\" >&5\n$as_echo_n \"checking for file... \" >&6; }\nif ${lt_cv_path_MAGIC_CMD+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  case $MAGIC_CMD in\n[\\\\/*] |  ?:[\\\\/]*)\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  ac_dummy=\"/usr/bin$PATH_SEPARATOR$PATH\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/file; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/file\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac\nfi\n\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD\" >&5\n$as_echo \"$MAGIC_CMD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  else\n    MAGIC_CMD=:\n  fi\nfi\n\n  fi\n  ;;\nesac\n\n# Use C for the default configuration in the libtool script\n\nlt_save_CC=\"$CC\"\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n# Source file extension for C test sources.\nac_ext=c\n\n# Object file extension for compiled C test sources.\nobjext=o\nobjext=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"int some_variable = 0;\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='int main(){return(0);}'\n\n\n\n\n\n\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n\n# Save the default compiler, since it gets overwritten when the other\n# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.\ncompiler_DEFAULT=$CC\n\n# save warnings/boilerplate of simple test code\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n\nlt_prog_compiler_no_builtin_flag=\n\nif test \"$GCC\" = yes; then\n  case $cc_basename in\n  nvcc*)\n    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;\n  *)\n    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;\n  esac\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions\" >&5\n$as_echo_n \"checking if $compiler supports -fno-rtti -fno-exceptions... \" >&6; }\nif ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_rtti_exceptions=no\n   ac_outfile=conftest.$ac_objext\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"-fno-rtti -fno-exceptions\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_rtti_exceptions=yes\n     fi\n   fi\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions\" >&5\n$as_echo \"$lt_cv_prog_compiler_rtti_exceptions\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_rtti_exceptions\" = xyes; then\n    lt_prog_compiler_no_builtin_flag=\"$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions\"\nelse\n    :\nfi\n\nfi\n\n\n\n\n\n\n  lt_prog_compiler_wl=\nlt_prog_compiler_pic=\nlt_prog_compiler_static=\n\n\n  if test \"$GCC\" = yes; then\n    lt_prog_compiler_wl='-Wl,'\n    lt_prog_compiler_static='-static'\n\n    case $host_os in\n      aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\tlt_prog_compiler_static='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            lt_prog_compiler_pic='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      lt_prog_compiler_pic='-DDLL_EXPORT'\n      ;;\n\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      lt_prog_compiler_pic='-fno-common'\n      ;;\n\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      lt_prog_compiler_static=\n      ;;\n\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t# +Z the default\n\t;;\n      *)\n\tlt_prog_compiler_pic='-fPIC'\n\t;;\n      esac\n      ;;\n\n    interix[3-9]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n\n    msdosdjgpp*)\n      # Just because we use GCC doesn't mean we suddenly get shared libraries\n      # on systems that don't support them.\n      lt_prog_compiler_can_build_shared=no\n      enable_shared=no\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      lt_prog_compiler_pic='-fPIC -shared'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\tlt_prog_compiler_pic=-Kconform_pic\n      fi\n      ;;\n\n    *)\n      lt_prog_compiler_pic='-fPIC'\n      ;;\n    esac\n\n    case $cc_basename in\n    nvcc*) # Cuda Compiler Driver 2.2\n      lt_prog_compiler_wl='-Xlinker '\n      if test -n \"$lt_prog_compiler_pic\"; then\n        lt_prog_compiler_pic=\"-Xcompiler $lt_prog_compiler_pic\"\n      fi\n      ;;\n    esac\n  else\n    # PORTME Check for flag to pass linker flags through the system compiler.\n    case $host_os in\n    aix*)\n      lt_prog_compiler_wl='-Wl,'\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\tlt_prog_compiler_static='-Bstatic'\n      else\n\tlt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'\n      fi\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      lt_prog_compiler_pic='-DDLL_EXPORT'\n      ;;\n\n    hpux9* | hpux10* | hpux11*)\n      lt_prog_compiler_wl='-Wl,'\n      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but\n      # not for PA HP-UX.\n      case $host_cpu in\n      hppa*64*|ia64*)\n\t# +Z the default\n\t;;\n      *)\n\tlt_prog_compiler_pic='+Z'\n\t;;\n      esac\n      # Is there a better lt_prog_compiler_static that works with the bundled CC?\n      lt_prog_compiler_static='${wl}-a ${wl}archive'\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      lt_prog_compiler_wl='-Wl,'\n      # PIC (with -KPIC) is the default.\n      lt_prog_compiler_static='-non_shared'\n      ;;\n\n    linux* | k*bsd*-gnu | kopensolaris*-gnu)\n      case $cc_basename in\n      # old Intel for x86_64 which still supported -KPIC.\n      ecc*)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-KPIC'\n\tlt_prog_compiler_static='-static'\n        ;;\n      # icc used to be incompatible with GCC.\n      # ICC 10 doesn't accept -KPIC any more.\n      icc* | ifort*)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-fPIC'\n\tlt_prog_compiler_static='-static'\n        ;;\n      # Lahey Fortran 8.1.\n      lf95*)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='--shared'\n\tlt_prog_compiler_static='--static'\n\t;;\n      nagfor*)\n\t# NAG Fortran compiler\n\tlt_prog_compiler_wl='-Wl,-Wl,,'\n\tlt_prog_compiler_pic='-PIC'\n\tlt_prog_compiler_static='-Bstatic'\n\t;;\n      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)\n        # Portland Group compilers (*not* the Pentium gcc compiler,\n\t# which looks to be a dead project)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-fpic'\n\tlt_prog_compiler_static='-Bstatic'\n        ;;\n      ccc*)\n        lt_prog_compiler_wl='-Wl,'\n        # All Alpha code is PIC.\n        lt_prog_compiler_static='-non_shared'\n        ;;\n      xl* | bgxl* | bgf* | mpixl*)\n\t# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-qpic'\n\tlt_prog_compiler_static='-qstaticlink'\n\t;;\n      *)\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ Ceres\\ Fortran* | *Sun*Fortran*\\ [1-7].* | *Sun*Fortran*\\ 8.[0-3]*)\n\t  # Sun Fortran 8.3 passes all unrecognized flags to the linker\n\t  lt_prog_compiler_pic='-KPIC'\n\t  lt_prog_compiler_static='-Bstatic'\n\t  lt_prog_compiler_wl=''\n\t  ;;\n\t*Sun\\ F* | *Sun*Fortran*)\n\t  lt_prog_compiler_pic='-KPIC'\n\t  lt_prog_compiler_static='-Bstatic'\n\t  lt_prog_compiler_wl='-Qoption ld '\n\t  ;;\n\t*Sun\\ C*)\n\t  # Sun C 5.9\n\t  lt_prog_compiler_pic='-KPIC'\n\t  lt_prog_compiler_static='-Bstatic'\n\t  lt_prog_compiler_wl='-Wl,'\n\t  ;;\n        *Intel*\\ [CF]*Compiler*)\n\t  lt_prog_compiler_wl='-Wl,'\n\t  lt_prog_compiler_pic='-fPIC'\n\t  lt_prog_compiler_static='-static'\n\t  ;;\n\t*Portland\\ Group*)\n\t  lt_prog_compiler_wl='-Wl,'\n\t  lt_prog_compiler_pic='-fpic'\n\t  lt_prog_compiler_static='-Bstatic'\n\t  ;;\n\tesac\n\t;;\n      esac\n      ;;\n\n    newsos6)\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      lt_prog_compiler_pic='-fPIC -shared'\n      ;;\n\n    osf3* | osf4* | osf5*)\n      lt_prog_compiler_wl='-Wl,'\n      # All OSF/1 code is PIC.\n      lt_prog_compiler_static='-non_shared'\n      ;;\n\n    rdos*)\n      lt_prog_compiler_static='-non_shared'\n      ;;\n\n    solaris*)\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      case $cc_basename in\n      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)\n\tlt_prog_compiler_wl='-Qoption ld ';;\n      *)\n\tlt_prog_compiler_wl='-Wl,';;\n      esac\n      ;;\n\n    sunos4*)\n      lt_prog_compiler_wl='-Qoption ld '\n      lt_prog_compiler_pic='-PIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    sysv4 | sysv4.2uw2* | sysv4.3*)\n      lt_prog_compiler_wl='-Wl,'\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec ;then\n\tlt_prog_compiler_pic='-Kconform_pic'\n\tlt_prog_compiler_static='-Bstatic'\n      fi\n      ;;\n\n    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n      lt_prog_compiler_wl='-Wl,'\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    unicos*)\n      lt_prog_compiler_wl='-Wl,'\n      lt_prog_compiler_can_build_shared=no\n      ;;\n\n    uts4*)\n      lt_prog_compiler_pic='-pic'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    *)\n      lt_prog_compiler_can_build_shared=no\n      ;;\n    esac\n  fi\n\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    lt_prog_compiler_pic=\n    ;;\n  *)\n    lt_prog_compiler_pic=\"$lt_prog_compiler_pic -DPIC\"\n    ;;\nesac\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC\" >&5\n$as_echo_n \"checking for $compiler option to produce PIC... \" >&6; }\nif ${lt_cv_prog_compiler_pic+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic\" >&5\n$as_echo \"$lt_cv_prog_compiler_pic\" >&6; }\nlt_prog_compiler_pic=$lt_cv_prog_compiler_pic\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$lt_prog_compiler_pic\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works\" >&5\n$as_echo_n \"checking if $compiler PIC flag $lt_prog_compiler_pic works... \" >&6; }\nif ${lt_cv_prog_compiler_pic_works+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_pic_works=no\n   ac_outfile=conftest.$ac_objext\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$lt_prog_compiler_pic -DPIC\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_pic_works=yes\n     fi\n   fi\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works\" >&5\n$as_echo \"$lt_cv_prog_compiler_pic_works\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_pic_works\" = xyes; then\n    case $lt_prog_compiler_pic in\n     \"\" | \" \"*) ;;\n     *) lt_prog_compiler_pic=\" $lt_prog_compiler_pic\" ;;\n     esac\nelse\n    lt_prog_compiler_pic=\n     lt_prog_compiler_can_build_shared=no\nfi\n\nfi\n\n\n\n\n\n\n\n\n\n\n\n#\n# Check to make sure the static flag actually works.\n#\nwl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\\\"$lt_prog_compiler_static\\\"\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works\" >&5\n$as_echo_n \"checking if $compiler static flag $lt_tmp_static_flag works... \" >&6; }\nif ${lt_cv_prog_compiler_static_works+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_static_works=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $lt_tmp_static_flag\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&5\n       $ECHO \"$_lt_linker_boilerplate\" | $SED '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         lt_cv_prog_compiler_static_works=yes\n       fi\n     else\n       lt_cv_prog_compiler_static_works=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works\" >&5\n$as_echo \"$lt_cv_prog_compiler_static_works\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_static_works\" = xyes; then\n    :\nelse\n    lt_prog_compiler_static=\nfi\n\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif ${lt_cv_prog_compiler_c_o+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o\" >&6; }\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif ${lt_cv_prog_compiler_c_o+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o\" >&6; }\n\n\n\n\nhard_links=\"nottested\"\nif test \"$lt_cv_prog_compiler_c_o\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links\" >&5\n$as_echo_n \"checking if we can lock with hard links... \" >&6; }\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hard_links\" >&5\n$as_echo \"$hard_links\" >&6; }\n  if test \"$hard_links\" = no; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&5\n$as_echo \"$as_me: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&2;}\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries\" >&5\n$as_echo_n \"checking whether the $compiler linker ($LD) supports shared libraries... \" >&6; }\n\n  runpath_var=\n  allow_undefined_flag=\n  always_export_symbols=no\n  archive_cmds=\n  archive_expsym_cmds=\n  compiler_needs_object=no\n  enable_shared_with_static_runtimes=no\n  export_dynamic_flag_spec=\n  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  hardcode_automatic=no\n  hardcode_direct=no\n  hardcode_direct_absolute=no\n  hardcode_libdir_flag_spec=\n  hardcode_libdir_separator=\n  hardcode_minus_L=no\n  hardcode_shlibpath_var=unsupported\n  inherit_rpath=no\n  link_all_deplibs=unknown\n  module_cmds=\n  module_expsym_cmds=\n  old_archive_from_new_cmds=\n  old_archive_from_expsyms_cmds=\n  thread_safe_flag_spec=\n  whole_archive_flag_spec=\n  # include_expsyms should be a list of space-separated symbols to be *always*\n  # included in the symbol list\n  include_expsyms=\n  # exclude_expsyms can be an extended regexp of symbols to exclude\n  # it will be wrapped by ` (' and `)$', so one must not match beginning or\n  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',\n  # as well as any symbol that contains `d'.\n  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'\n  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out\n  # platforms (ab)use it in PIC code, but their linkers get confused if\n  # the symbol is explicitly referenced.  Since portable code cannot\n  # rely on this symbol name, it's probably fine to never include it in\n  # preloaded symbol tables.\n  # Exclude shared library initialization/finalization symbols.\n  extract_expsyms_cmds=\n\n  case $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    # FIXME: the MSVC++ port hasn't been tested in a loooong time\n    # When not using gcc, we currently assume that we are using\n    # Microsoft Visual C++.\n    if test \"$GCC\" != yes; then\n      with_gnu_ld=no\n    fi\n    ;;\n  interix*)\n    # we just hope/assume this is gcc and not c89 (= MSVC++)\n    with_gnu_ld=yes\n    ;;\n  openbsd*)\n    with_gnu_ld=no\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    link_all_deplibs=no\n    ;;\n  esac\n\n  ld_shlibs=yes\n\n  # On some targets, GNU ld is compatible enough with the native linker\n  # that we're better off using the native interface for both.\n  lt_use_gnu_ld_interface=no\n  if test \"$with_gnu_ld\" = yes; then\n    case $host_os in\n      aix*)\n\t# The AIX port of GNU ld has always aspired to compatibility\n\t# with the native linker.  However, as the warning in the GNU ld\n\t# block says, versions before 2.19.5* couldn't really create working\n\t# shared libraries, regardless of the interface used.\n\tcase `$LD -v 2>&1` in\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.19.5*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.[2-9]*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ [3-9]*) ;;\n\t  *)\n\t    lt_use_gnu_ld_interface=yes\n\t    ;;\n\tesac\n\t;;\n      *)\n\tlt_use_gnu_ld_interface=yes\n\t;;\n    esac\n  fi\n\n  if test \"$lt_use_gnu_ld_interface\" = yes; then\n    # If archive_cmds runs LD, not CC, wlarc should be empty\n    wlarc='${wl}'\n\n    # Set some defaults for GNU ld with shared library support. These\n    # are reset later if shared libraries are not supported. Putting them\n    # here allows them to be overridden if necessary.\n    runpath_var=LD_RUN_PATH\n    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n    export_dynamic_flag_spec='${wl}--export-dynamic'\n    # ancient GNU ld didn't support --whole-archive et. al.\n    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then\n      whole_archive_flag_spec=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n    else\n      whole_archive_flag_spec=\n    fi\n    supports_anon_versioning=no\n    case `$LD -v 2>&1` in\n      *GNU\\ gold*) supports_anon_versioning=yes ;;\n      *\\ [01].* | *\\ 2.[0-9].* | *\\ 2.10.*) ;; # catch versions < 2.11\n      *\\ 2.11.93.0.2\\ *) supports_anon_versioning=yes ;; # RH7.3 ...\n      *\\ 2.11.92.0.12\\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...\n      *\\ 2.11.*) ;; # other 2.11 versions\n      *) supports_anon_versioning=yes ;;\n    esac\n\n    # See if GNU ld supports shared libraries.\n    case $host_os in\n    aix[3-9]*)\n      # On AIX/PPC, the GNU linker is very broken\n      if test \"$host_cpu\" != ia64; then\n\tld_shlibs=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: the GNU linker, at least up to release 2.19, is reported\n*** to be unable to reliably create shared libraries on AIX.\n*** Therefore, libtool is disabling shared libraries support.  If you\n*** really care for shared libraries, you may want to install binutils\n*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.\n*** You will then need to restart the configuration process.\n\n_LT_EOF\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            archive_expsym_cmds=''\n        ;;\n      m68k)\n            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            hardcode_libdir_flag_spec='-L$libdir'\n            hardcode_minus_L=yes\n        ;;\n      esac\n      ;;\n\n    beos*)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\tallow_undefined_flag=unsupported\n\t# Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t# support --undefined.  This deserves some investigation.  FIXME\n\tarchive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,\n      # as there is no search path for DLLs.\n      hardcode_libdir_flag_spec='-L$libdir'\n      export_dynamic_flag_spec='${wl}--export-all-symbols'\n      allow_undefined_flag=unsupported\n      always_export_symbols=no\n      enable_shared_with_static_runtimes=yes\n      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[BCDGRS][ ]/s/.*[ ]\\([^ ]*\\)/\\1 DATA/;s/^.*[ ]__nm__\\([^ ]*\\)[ ][^ ]*/\\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'\n\n      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t# If the export-symbols file already is a .def file (1st line\n\t# is EXPORTS), use it as is; otherwise, prepend...\n\tarchive_expsym_cmds='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t  cp $export_symbols $output_objdir/$soname.def;\n\telse\n\t  echo EXPORTS > $output_objdir/$soname.def;\n\t  cat $export_symbols >> $output_objdir/$soname.def;\n\tfi~\n\t$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    haiku*)\n      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      link_all_deplibs=yes\n      ;;\n\n    interix[3-9]*)\n      hardcode_direct=no\n      hardcode_shlibpath_var=no\n      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'\n      export_dynamic_flag_spec='${wl}-E'\n      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n      # Instead, shared libraries are loaded at an image base (0x10000000 by\n      # default) and relocated if they conflict, which is a slow very memory\n      # consuming and fragmenting process.  To avoid this, we pick a random,\n      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      archive_expsym_cmds='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      ;;\n\n    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)\n      tmp_diet=no\n      if test \"$host_os\" = linux-dietlibc; then\n\tcase $cc_basename in\n\t  diet\\ *) tmp_diet=yes;;\t# linux-dietlibc with static linking (!diet-dyn)\n\tesac\n      fi\n      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \\\n\t && test \"$tmp_diet\" = no\n      then\n\ttmp_addflag=' $pic_flag'\n\ttmp_sharedflag='-shared'\n\tcase $cc_basename,$host_cpu in\n        pgcc*)\t\t\t\t# Portland Group C compiler\n\t  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag'\n\t  ;;\n\tpgf77* | pgf90* | pgf95* | pgfortran*)\n\t\t\t\t\t# Portland Group f77 and f90 compilers\n\t  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag -Mnomain' ;;\n\tecc*,ia64* | icc*,ia64*)\t# Intel C compiler on ia64\n\t  tmp_addflag=' -i_dynamic' ;;\n\tefc*,ia64* | ifort*,ia64*)\t# Intel Fortran compiler on ia64\n\t  tmp_addflag=' -i_dynamic -nofor_main' ;;\n\tifc* | ifort*)\t\t\t# Intel Fortran compiler\n\t  tmp_addflag=' -nofor_main' ;;\n\tlf95*)\t\t\t\t# Lahey Fortran 8.1\n\t  whole_archive_flag_spec=\n\t  tmp_sharedflag='--shared' ;;\n\txl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)\n\t  tmp_sharedflag='-qmkshrobj'\n\t  tmp_addflag= ;;\n\tnvcc*)\t# Cuda Compiler Driver 2.2\n\t  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  compiler_needs_object=yes\n\t  ;;\n\tesac\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\t\t\t# Sun C 5.9\n\t  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  compiler_needs_object=yes\n\t  tmp_sharedflag='-G' ;;\n\t*Sun\\ F*)\t\t\t# Sun Fortran 8.3\n\t  tmp_sharedflag='-G' ;;\n\tesac\n\tarchive_cmds='$CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\n        if test \"x$supports_anon_versioning\" = xyes; then\n          archive_expsym_cmds='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t    cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t    echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t    $CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n        fi\n\n\tcase $cc_basename in\n\txlf* | bgf* | bgxlf* | mpixlf*)\n\t  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself\n\t  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'\n\t  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n\t  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'\n\t  if test \"x$supports_anon_versioning\" = xyes; then\n\t    archive_expsym_cmds='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t      cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t      echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'\n\t  fi\n\t  ;;\n\tesac\n      else\n        ld_shlibs=no\n      fi\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\tarchive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'\n\twlarc=\n      else\n\tarchive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\tarchive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      fi\n      ;;\n\n    solaris*)\n      if $LD -v 2>&1 | $GREP 'BFD 2\\.8' > /dev/null; then\n\tld_shlibs=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: The releases 2.8.* of the GNU linker cannot reliably\n*** create shared libraries on Solaris systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.9.1 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\tarchive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\tarchive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)\n      case `$LD -v 2>&1` in\n        *\\ [01].* | *\\ 2.[0-9].* | *\\ 2.1[0-5].*)\n\tld_shlibs=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not\n*** reliably create shared libraries on SCO systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n\t;;\n\t*)\n\t  # For security reasons, it is highly recommended that you always\n\t  # use absolute paths for naming shared libraries, and exclude the\n\t  # DT_RUNPATH tag from executables and libraries.  But doing so\n\t  # requires that you compile everything twice, which is a pain.\n\t  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n\t    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t  else\n\t    ld_shlibs=no\n\t  fi\n\t;;\n      esac\n      ;;\n\n    sunos4*)\n      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      wlarc=\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    *)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\tarchive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\tarchive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n    esac\n\n    if test \"$ld_shlibs\" = no; then\n      runpath_var=\n      hardcode_libdir_flag_spec=\n      export_dynamic_flag_spec=\n      whole_archive_flag_spec=\n    fi\n  else\n    # PORTME fill in a description of your system's linker (not GNU ld)\n    case $host_os in\n    aix3*)\n      allow_undefined_flag=unsupported\n      always_export_symbols=yes\n      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'\n      # Note: this linker hardcodes the directories in LIBPATH if there\n      # are no directories specified by -L.\n      hardcode_minus_L=yes\n      if test \"$GCC\" = yes && test -z \"$lt_prog_compiler_static\"; then\n\t# Neither direct hardcoding nor static linking is supported with a\n\t# broken collect2.\n\thardcode_direct=unsupported\n      fi\n      ;;\n\n    aix[4-9]*)\n      if test \"$host_cpu\" = ia64; then\n\t# On IA64, the linker does run time linking by default, so we don't\n\t# have to do anything special.\n\taix_use_runtimelinking=no\n\texp_sym_flag='-Bexport'\n\tno_entry_flag=\"\"\n      else\n\t# If we're using GNU nm, then we don't want the \"-C\" option.\n\t# -C means demangle to AIX nm, but means don't demangle with GNU nm\n\t# Also, AIX nm treats weak defined symbols like other global\n\t# defined symbols, whereas GNU nm marks them as \"W\".\n\tif $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n\t  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\telse\n\t  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\tfi\n\taix_use_runtimelinking=no\n\n\t# Test if we are trying to use run time linking or normal\n\t# AIX style linking. If -brtl is somewhere in LDFLAGS, we\n\t# need to do runtime linking.\n\tcase $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)\n\t  for ld_flag in $LDFLAGS; do\n\t  if (test $ld_flag = \"-brtl\" || test $ld_flag = \"-Wl,-brtl\"); then\n\t    aix_use_runtimelinking=yes\n\t    break\n\t  fi\n\t  done\n\t  ;;\n\tesac\n\n\texp_sym_flag='-bexport'\n\tno_entry_flag='-bnoentry'\n      fi\n\n      # When large executables or shared objects are built, AIX ld can\n      # have problems creating the table of contents.  If linking a library\n      # or program results in \"error TOC overflow\" add -mminimal-toc to\n      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n      archive_cmds=''\n      hardcode_direct=yes\n      hardcode_direct_absolute=yes\n      hardcode_libdir_separator=':'\n      link_all_deplibs=yes\n      file_list_spec='${wl}-f,'\n\n      if test \"$GCC\" = yes; then\n\tcase $host_os in aix4.[012]|aix4.[012].*)\n\t# We only want to do this on AIX 4.2 and lower, the check\n\t# below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t   strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t  # We have reworked collect2\n\t  :\n\t  else\n\t  # We have old collect2\n\t  hardcode_direct=unsupported\n\t  # It fails to find uninstalled libraries when the uninstalled\n\t  # path is not listed in the libpath.  Setting hardcode_minus_L\n\t  # to unsupported forces relinking\n\t  hardcode_minus_L=yes\n\t  hardcode_libdir_flag_spec='-L$libdir'\n\t  hardcode_libdir_separator=\n\t  fi\n\t  ;;\n\tesac\n\tshared_flag='-shared'\n\tif test \"$aix_use_runtimelinking\" = yes; then\n\t  shared_flag=\"$shared_flag \"'${wl}-G'\n\tfi\n\tlink_all_deplibs=no\n      else\n\t# not using gcc\n\tif test \"$host_cpu\" = ia64; then\n\t# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t# chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n\telse\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag='${wl}-G'\n\t  else\n\t    shared_flag='${wl}-bM:SRE'\n\t  fi\n\tfi\n      fi\n\n      export_dynamic_flag_spec='${wl}-bexpall'\n      # It seems that -bexpall does not export symbols beginning with\n      # underscore (_), so it is better to generate a list of symbols to export.\n      always_export_symbols=yes\n      if test \"$aix_use_runtimelinking\" = yes; then\n\t# Warning - without using the other runtime loading flags (-brtl),\n\t# -berok will link without error, but may produce a broken library.\n\tallow_undefined_flag='-berok'\n        # Determine the default libpath from the value encoded in an\n        # empty executable.\n        if test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  if ${lt_cv_aix_libpath_+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n\n  lt_aix_libpath_sed='\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }'\n  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$lt_cv_aix_libpath_\"; then\n    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  if test -z \"$lt_cv_aix_libpath_\"; then\n    lt_cv_aix_libpath_=\"/usr/lib:/lib\"\n  fi\n\nfi\n\n  aix_libpath=$lt_cv_aix_libpath_\nfi\n\n        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n      else\n\tif test \"$host_cpu\" = ia64; then\n\t  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'\n\t  allow_undefined_flag=\"-z nodefs\"\n\t  archive_expsym_cmds=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n\telse\n\t # Determine the default libpath from the value encoded in an\n\t # empty executable.\n\t if test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  if ${lt_cv_aix_libpath_+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n\n  lt_aix_libpath_sed='\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }'\n  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$lt_cv_aix_libpath_\"; then\n    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  if test -z \"$lt_cv_aix_libpath_\"; then\n    lt_cv_aix_libpath_=\"/usr/lib:/lib\"\n  fi\n\nfi\n\n  aix_libpath=$lt_cv_aix_libpath_\nfi\n\n\t hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t  # Warning - without using the other run time loading flags,\n\t  # -berok will link without error, but may produce a broken library.\n\t  no_undefined_flag=' ${wl}-bernotok'\n\t  allow_undefined_flag=' ${wl}-berok'\n\t  if test \"$with_gnu_ld\" = yes; then\n\t    # We only use this code for GNU lds that support --whole-archive.\n\t    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t  else\n\t    # Exported symbols can be pulled into shared objects from archives\n\t    whole_archive_flag_spec='$convenience'\n\t  fi\n\t  archive_cmds_need_lc=yes\n\t  # This is similar to how AIX traditionally builds its shared libraries.\n\t  archive_expsym_cmds=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n\tfi\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            archive_expsym_cmds=''\n        ;;\n      m68k)\n            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            hardcode_libdir_flag_spec='-L$libdir'\n            hardcode_minus_L=yes\n        ;;\n      esac\n      ;;\n\n    bsdi[45]*)\n      export_dynamic_flag_spec=-rdynamic\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # When not using gcc, we currently assume that we are using\n      # Microsoft Visual C++.\n      # hardcode_libdir_flag_spec is actually meaningless, as there is\n      # no search path for DLLs.\n      case $cc_basename in\n      cl*)\n\t# Native MSVC\n\thardcode_libdir_flag_spec=' '\n\tallow_undefined_flag=unsupported\n\talways_export_symbols=yes\n\tfile_list_spec='@'\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\tarchive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\tarchive_expsym_cmds='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t    sed -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t  else\n\t    sed -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t  fi~\n\t  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t  linknames='\n\t# The linker will not automatically build a static lib if we build a DLL.\n\t# _LT_TAGVAR(old_archive_from_new_cmds, )='true'\n\tenable_shared_with_static_runtimes=yes\n\texclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'\n\texport_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[BCDGRS][ ]/s/.*[ ]\\([^ ]*\\)/\\1,DATA/'\\'' | $SED -e '\\''/^[AITW][ ]/s/.*[ ]//'\\'' | sort | uniq > $export_symbols'\n\t# Don't use ranlib\n\told_postinstall_cmds='chmod 644 $oldlib'\n\tpostlink_cmds='lt_outputfile=\"@OUTPUT@\"~\n\t  lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t  case $lt_outputfile in\n\t    *.exe|*.EXE) ;;\n\t    *)\n\t      lt_outputfile=\"$lt_outputfile.exe\"\n\t      lt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t      ;;\n\t  esac~\n\t  if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t    $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t    $RM \"$lt_outputfile.manifest\";\n\t  fi'\n\t;;\n      *)\n\t# Assume MSVC wrapper\n\thardcode_libdir_flag_spec=' '\n\tallow_undefined_flag=unsupported\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\tarchive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all \"$deplibs\" | $SED '\\''s/ -lc$//'\\''` -link -dll~linknames='\n\t# The linker will automatically build a .lib file if we build a DLL.\n\told_archive_from_new_cmds='true'\n\t# FIXME: Should let the user specify the lib program.\n\told_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'\n\tenable_shared_with_static_runtimes=yes\n\t;;\n      esac\n      ;;\n\n    darwin* | rhapsody*)\n\n\n  archive_cmds_need_lc=no\n  hardcode_direct=no\n  hardcode_automatic=yes\n  hardcode_shlibpath_var=unsupported\n  if test \"$lt_cv_ld_force_load\" = \"yes\"; then\n    whole_archive_flag_spec='`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience ${wl}-force_load,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"`'\n\n  else\n    whole_archive_flag_spec=''\n  fi\n  link_all_deplibs=yes\n  allow_undefined_flag=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=func_echo_all\n    archive_cmds=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    module_cmds=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    archive_expsym_cmds=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    module_expsym_cmds=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n\n  else\n  ld_shlibs=no\n  fi\n\n      ;;\n\n    dgux*)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_shlibpath_var=no\n      ;;\n\n    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor\n    # support.  Future versions do this automatically, but an explicit c++rt0.o\n    # does not break anything, and helps significantly (at the cost of a little\n    # extra space).\n    freebsd2.2*)\n      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    # Unfortunately, older versions of FreeBSD 2 do not have this feature.\n    freebsd2.*)\n      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_direct=yes\n      hardcode_minus_L=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.\n    freebsd* | dragonfly*)\n      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    hpux9*)\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      else\n\tarchive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      fi\n      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'\n      hardcode_libdir_separator=:\n      hardcode_direct=yes\n\n      # hardcode_minus_L: Not really in the search PATH,\n      # but as the default location of the library.\n      hardcode_minus_L=yes\n      export_dynamic_flag_spec='${wl}-E'\n      ;;\n\n    hpux10*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\tarchive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\thardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'\n\thardcode_libdir_separator=:\n\thardcode_direct=yes\n\thardcode_direct_absolute=yes\n\texport_dynamic_flag_spec='${wl}-E'\n\t# hardcode_minus_L: Not really in the search PATH,\n\t# but as the default location of the library.\n\thardcode_minus_L=yes\n      fi\n      ;;\n\n    hpux11*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\tcase $host_cpu in\n\thppa*64*)\n\t  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      else\n\tcase $host_cpu in\n\thppa*64*)\n\t  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\n\t  # Older versions of the 11.00 compiler do not understand -b yet\n\t  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)\n\t  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $CC understands -b\" >&5\n$as_echo_n \"checking if $CC understands -b... \" >&6; }\nif ${lt_cv_prog_compiler__b+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler__b=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS -b\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&5\n       $ECHO \"$_lt_linker_boilerplate\" | $SED '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         lt_cv_prog_compiler__b=yes\n       fi\n     else\n       lt_cv_prog_compiler__b=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b\" >&5\n$as_echo \"$lt_cv_prog_compiler__b\" >&6; }\n\nif test x\"$lt_cv_prog_compiler__b\" = xyes; then\n    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\nelse\n    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\nfi\n\n\t  ;;\n\tesac\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\thardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'\n\thardcode_libdir_separator=:\n\n\tcase $host_cpu in\n\thppa*64*|ia64*)\n\t  hardcode_direct=no\n\t  hardcode_shlibpath_var=no\n\t  ;;\n\t*)\n\t  hardcode_direct=yes\n\t  hardcode_direct_absolute=yes\n\t  export_dynamic_flag_spec='${wl}-E'\n\n\t  # hardcode_minus_L: Not really in the search PATH,\n\t  # but as the default location of the library.\n\t  hardcode_minus_L=yes\n\t  ;;\n\tesac\n      fi\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t# Try to use the -exported_symbol ld option, if it does not\n\t# work, assume that -exports_file does not work either and\n\t# implicitly export all symbols.\n\t# This should be the same for all languages, so no per-tag cache variable.\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol\" >&5\n$as_echo_n \"checking whether the $host_os linker accepts -exported_symbol... \" >&6; }\nif ${lt_cv_irix_exported_symbol+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  save_LDFLAGS=\"$LDFLAGS\"\n\t   LDFLAGS=\"$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null\"\n\t   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\nint foo (void) { return 0; }\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  lt_cv_irix_exported_symbol=yes\nelse\n  lt_cv_irix_exported_symbol=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n           LDFLAGS=\"$save_LDFLAGS\"\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol\" >&5\n$as_echo \"$lt_cv_irix_exported_symbol\" >&6; }\n\tif test \"$lt_cv_irix_exported_symbol\" = yes; then\n          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'\n\tfi\n      else\n\tarchive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\tarchive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'\n      fi\n      archive_cmds_need_lc='no'\n      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      hardcode_libdir_separator=:\n      inherit_rpath=yes\n      link_all_deplibs=yes\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\tarchive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out\n      else\n\tarchive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF\n      fi\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    newsos6)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_direct=yes\n      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      hardcode_libdir_separator=:\n      hardcode_shlibpath_var=no\n      ;;\n\n    *nto* | *qnx*)\n      ;;\n\n    openbsd*)\n      if test -f /usr/libexec/ld.so; then\n\thardcode_direct=yes\n\thardcode_shlibpath_var=no\n\thardcode_direct_absolute=yes\n\tif test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'\n\t  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'\n\t  export_dynamic_flag_spec='${wl}-E'\n\telse\n\t  case $host_os in\n\t   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)\n\t     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n\t     hardcode_libdir_flag_spec='-R$libdir'\n\t     ;;\n\t   *)\n\t     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'\n\t     ;;\n\t  esac\n\tfi\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    os2*)\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_minus_L=yes\n      allow_undefined_flag=unsupported\n      archive_cmds='$ECHO \"LIBRARY $libname INITINSTANCE\" > $output_objdir/$libname.def~$ECHO \"DESCRIPTION \\\"$libname\\\"\" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo \" SINGLE NONSHARED\" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'\n      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'\n      ;;\n\n    osf3*)\n      if test \"$GCC\" = yes; then\n\tallow_undefined_flag=' ${wl}-expect_unresolved ${wl}\\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n      else\n\tallow_undefined_flag=' -expect_unresolved \\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n      fi\n      archive_cmds_need_lc='no'\n      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      hardcode_libdir_separator=:\n      ;;\n\n    osf4* | osf5*)\t# as osf3* with the addition of -msym flag\n      if test \"$GCC\" = yes; then\n\tallow_undefined_flag=' ${wl}-expect_unresolved ${wl}\\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\thardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      else\n\tallow_undefined_flag=' -expect_unresolved \\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\tarchive_expsym_cmds='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done; printf \"%s\\\\n\" \"-hidden\">> $lib.exp~\n\t$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'\n\n\t# Both c and cxx compiler support -rpath directly\n\thardcode_libdir_flag_spec='-rpath $libdir'\n      fi\n      archive_cmds_need_lc='no'\n      hardcode_libdir_separator=:\n      ;;\n\n    solaris*)\n      no_undefined_flag=' -z defs'\n      if test \"$GCC\" = yes; then\n\twlarc='${wl}'\n\tarchive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n      else\n\tcase `$CC -V 2>&1` in\n\t*\"Compilers 5.0\"*)\n\t  wlarc=''\n\t  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  archive_expsym_cmds='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'\n\t  ;;\n\t*)\n\t  wlarc='${wl}'\n\t  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n\t  ;;\n\tesac\n      fi\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_shlibpath_var=no\n      case $host_os in\n      solaris2.[0-5] | solaris2.[0-5].*) ;;\n      *)\n\t# The compiler driver will combine and reorder linker options,\n\t# but understands `-z linker_flag'.  GCC discards it without `$wl',\n\t# but is careful enough not to reorder.\n\t# Supported since Solaris 2.6 (maybe 2.5.1?)\n\tif test \"$GCC\" = yes; then\n\t  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\telse\n\t  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'\n\tfi\n\t;;\n      esac\n      link_all_deplibs=yes\n      ;;\n\n    sunos4*)\n      if test \"x$host_vendor\" = xsequent; then\n\t# Use $CC to link under sequent, because it throws in some extra .o\n\t# files that make .init and .fini sections work.\n\tarchive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_direct=yes\n      hardcode_minus_L=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    sysv4)\n      case $host_vendor in\n\tsni)\n\t  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  hardcode_direct=yes # is this really true???\n\t;;\n\tsiemens)\n\t  ## LD is ld it makes a PLAMLIB\n\t  ## CC just makes a GrossModule.\n\t  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'\n\t  reload_cmds='$CC -r -o $output$reload_objs'\n\t  hardcode_direct=no\n        ;;\n\tmotorola)\n\t  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  hardcode_direct=no #Motorola manual says yes, but my tests say they lie\n\t;;\n      esac\n      runpath_var='LD_RUN_PATH'\n      hardcode_shlibpath_var=no\n      ;;\n\n    sysv4.3*)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_shlibpath_var=no\n      export_dynamic_flag_spec='-Bexport'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\tarchive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\thardcode_shlibpath_var=no\n\trunpath_var=LD_RUN_PATH\n\thardcode_runpath_var=yes\n\tld_shlibs=yes\n      fi\n      ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)\n      no_undefined_flag='${wl}-z,text'\n      archive_cmds_need_lc=no\n      hardcode_shlibpath_var=no\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6*)\n      # Note: We can NOT use -z defs as we might desire, because we do not\n      # link with -lc, and that would cause any symbols used from libc to\n      # always be unresolved, which means just about no library would\n      # ever link correctly.  If we're not using GNU ld we use -z text\n      # though, which does catch some bad symbols but isn't as heavy-handed\n      # as -z defs.\n      no_undefined_flag='${wl}-z,text'\n      allow_undefined_flag='${wl}-z,nodefs'\n      archive_cmds_need_lc=no\n      hardcode_shlibpath_var=no\n      hardcode_libdir_flag_spec='${wl}-R,$libdir'\n      hardcode_libdir_separator=':'\n      link_all_deplibs=yes\n      export_dynamic_flag_spec='${wl}-Bexport'\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    uts4*)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_shlibpath_var=no\n      ;;\n\n    *)\n      ld_shlibs=no\n      ;;\n    esac\n\n    if test x$host_vendor = xsni; then\n      case $host in\n      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)\n\texport_dynamic_flag_spec='${wl}-Blargedynsym'\n\t;;\n      esac\n    fi\n  fi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ld_shlibs\" >&5\n$as_echo \"$ld_shlibs\" >&6; }\ntest \"$ld_shlibs\" = no && can_build_shared=no\n\nwith_gnu_ld=$with_gnu_ld\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$archive_cmds_need_lc\" in\nx|xyes)\n  # Assume -lc should be added\n  archive_cmds_need_lc=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $archive_cmds in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in\" >&5\n$as_echo_n \"checking whether -lc should be explicitly linked in... \" >&6; }\nif ${lt_cv_archive_cmds_need_lc+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  $RM conftest*\n\techo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n\tif { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } 2>conftest.err; then\n\t  soname=conftest\n\t  lib=conftest\n\t  libobjs=conftest.$ac_objext\n\t  deplibs=\n\t  wl=$lt_prog_compiler_wl\n\t  pic_flag=$lt_prog_compiler_pic\n\t  compiler_flags=-v\n\t  linker_flags=-v\n\t  verstring=\n\t  output_objdir=.\n\t  libname=conftest\n\t  lt_save_allow_undefined_flag=$allow_undefined_flag\n\t  allow_undefined_flag=\n\t  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$archive_cmds 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1\\\"\"; } >&5\n  (eval $archive_cmds 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n\t  then\n\t    lt_cv_archive_cmds_need_lc=no\n\t  else\n\t    lt_cv_archive_cmds_need_lc=yes\n\t  fi\n\t  allow_undefined_flag=$lt_save_allow_undefined_flag\n\telse\n\t  cat conftest.err 1>&5\n\tfi\n\t$RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc\" >&5\n$as_echo \"$lt_cv_archive_cmds_need_lc\" >&6; }\n      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics\" >&5\n$as_echo_n \"checking dynamic linker characteristics... \" >&6; }\n\nif test \"$GCC\" = yes; then\n  case $host_os in\n    darwin*) lt_awk_arg=\"/^libraries:/,/LR/\" ;;\n    *) lt_awk_arg=\"/^libraries:/\" ;;\n  esac\n  case $host_os in\n    mingw* | cegcc*) lt_sed_strip_eq=\"s,=\\([A-Za-z]:\\),\\1,g\" ;;\n    *) lt_sed_strip_eq=\"s,=/,/,g\" ;;\n  esac\n  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e \"s/^libraries://\" -e $lt_sed_strip_eq`\n  case $lt_search_path_spec in\n  *\\;*)\n    # if the path contains \";\" then we assume it to be the separator\n    # otherwise default to the standard path separator (i.e. \":\") - it is\n    # assumed that no part of a normal pathname contains \";\" but that should\n    # okay in the real world where \";\" in dirpaths is itself problematic.\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED 's/;/ /g'`\n    ;;\n  *)\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED \"s/$PATH_SEPARATOR/ /g\"`\n    ;;\n  esac\n  # Ok, now we have the path, separated by spaces, we can step through it\n  # and add multilib dir if necessary.\n  lt_tmp_lt_search_path_spec=\n  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`\n  for lt_sys_path in $lt_search_path_spec; do\n    if test -d \"$lt_sys_path/$lt_multi_os_dir\"; then\n      lt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir\"\n    else\n      test -d \"$lt_sys_path\" && \\\n\tlt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path\"\n    fi\n  done\n  lt_search_path_spec=`$ECHO \"$lt_tmp_lt_search_path_spec\" | awk '\nBEGIN {RS=\" \"; FS=\"/|\\n\";} {\n  lt_foo=\"\";\n  lt_count=0;\n  for (lt_i = NF; lt_i > 0; lt_i--) {\n    if ($lt_i != \"\" && $lt_i != \".\") {\n      if ($lt_i == \"..\") {\n        lt_count++;\n      } else {\n        if (lt_count == 0) {\n          lt_foo=\"/\" $lt_i lt_foo;\n        } else {\n          lt_count--;\n        }\n      }\n    }\n  }\n  if (lt_foo != \"\") { lt_freq[lt_foo]++; }\n  if (lt_freq[lt_foo] == 1) { print lt_foo; }\n}'`\n  # AWK program above erroneously prepends '/' to C:/dos/paths\n  # for these hosts.\n  case $host_os in\n    mingw* | cegcc*) lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" |\\\n      $SED 's,/\\([A-Za-z]:\\),\\1,g'` ;;\n  esac\n  sys_lib_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $lt_NL2SP`\nelse\n  sys_lib_search_path_spec=\"/lib /usr/lib /usr/local/lib\"\nfi\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[4-9]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[01] | aix4.[01].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all \"$lib\" | $SED '\\''s%^.*/\\([^/]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[45]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$cc_basename in\n  yes,*)\n    # gcc\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n\n      sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/lib/w32api\"\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    dynamic_linker='Win32 ld.exe'\n    ;;\n\n  *,cl*)\n    # Native MSVC\n    libname_spec='$name'\n    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n    library_names_spec='${libname}.dll.lib'\n\n    case $build_os in\n    mingw*)\n      sys_lib_search_path_spec=\n      lt_save_ifs=$IFS\n      IFS=';'\n      for lt_path in $LIB\n      do\n        IFS=$lt_save_ifs\n        # Let DOS variable expansion print the short 8.3 style file name.\n        lt_path=`cd \"$lt_path\" 2>/dev/null && cmd //C \"for %i in (\".\") do @echo %~si\"`\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec $lt_path\"\n      done\n      IFS=$lt_save_ifs\n      # Convert to MSYS style.\n      sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | sed -e 's|\\\\\\\\|/|g' -e 's| \\\\([a-zA-Z]\\\\):| /\\\\1|g' -e 's|^ ||'`\n      ;;\n    cygwin*)\n      # Convert to unix form, then to dos form, then back to unix form\n      # but this time dos style (no spaces!) so that the unix form looks\n      # like /cygdrive/c/PROGRA~1:/cygdr...\n      sys_lib_search_path_spec=`cygpath --path --unix \"$LIB\"`\n      sys_lib_search_path_spec=`cygpath --path --dos \"$sys_lib_search_path_spec\" 2>/dev/null`\n      sys_lib_search_path_spec=`cygpath --path --unix \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      ;;\n    *)\n      sys_lib_search_path_spec=\"$LIB\"\n      if $ECHO \"$sys_lib_search_path_spec\" | $GREP ';[c-zC-Z]:/' >/dev/null; then\n        # It is most probably a Windows format PATH.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      # FIXME: find the short name or the path components, as spaces are\n      # common. (e.g. \"Program Files\" -> \"PROGRA~1\")\n      ;;\n    esac\n\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n    dynamic_linker='Win32 link.exe'\n    ;;\n\n  *)\n    # Assume MSVC wrapper\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    dynamic_linker='Win32 ld.exe'\n    ;;\n  esac\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\n\n  sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/local/lib\"\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[23].*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2.*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[01]* | freebsdelf3.[01]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \\\n  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nhaiku*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  dynamic_linker=\"$host_os runtime_loader\"\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...\n  postinstall_cmds='chmod 555 $lib'\n  # or fails outright, so override atomically:\n  install_override_mode=555\n  ;;\n\ninterix[3-9]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux # correct to gnu/linux during the next big refactor\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be glibc/ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n\n  # Some binutils ld are patched to set DT_RUNPATH\n  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_shlibpath_overrides_runpath=no\n    save_LDFLAGS=$LDFLAGS\n    save_libdir=$libdir\n    eval \"libdir=/foo; wl=\\\"$lt_prog_compiler_wl\\\"; \\\n\t LDFLAGS=\\\"\\$LDFLAGS $hardcode_libdir_flag_spec\\\"\"\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null; then :\n  lt_cv_shlibpath_overrides_runpath=yes\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n    LDFLAGS=$save_LDFLAGS\n    libdir=$save_libdir\n\nfi\n\n  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\$2)); skip = 1; } { if (!skip) print \\$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/\"//g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsdelf*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='NetBSD ld.elf_so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[89] | openbsd2.[89].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux # correct to gnu/linux during the next big refactor\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $dynamic_linker\" >&5\n$as_echo \"$dynamic_linker\" >&6; }\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs\" >&5\n$as_echo_n \"checking how to hardcode library paths into programs... \" >&6; }\nhardcode_action=\nif test -n \"$hardcode_libdir_flag_spec\" ||\n   test -n \"$runpath_var\" ||\n   test \"X$hardcode_automatic\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$hardcode_direct\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, )\" != no &&\n     test \"$hardcode_minus_L\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    hardcode_action=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    hardcode_action=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  hardcode_action=unsupported\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hardcode_action\" >&5\n$as_echo \"$hardcode_action\" >&6; }\n\nif test \"$hardcode_action\" = relink ||\n   test \"$inherit_rpath\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n\n\n\n\n\n\n  if test \"x$enable_dlopen\" != xyes; then\n  enable_dlopen=unknown\n  enable_dlopen_self=unknown\n  enable_dlopen_self_static=unknown\nelse\n  lt_cv_dlopen=no\n  lt_cv_dlopen_libs=\n\n  case $host_os in\n  beos*)\n    lt_cv_dlopen=\"load_add_on\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ;;\n\n  mingw* | pw32* | cegcc*)\n    lt_cv_dlopen=\"LoadLibrary\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  cygwin*)\n    lt_cv_dlopen=\"dlopen\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  darwin*)\n  # if libdl is installed we need to link against it\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl\" >&5\n$as_echo_n \"checking for dlopen in -ldl... \" >&6; }\nif ${ac_cv_lib_dl_dlopen+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldl  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dlopen ();\nint\nmain ()\n{\nreturn dlopen ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dl_dlopen=yes\nelse\n  ac_cv_lib_dl_dlopen=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen\" >&5\n$as_echo \"$ac_cv_lib_dl_dlopen\" >&6; }\nif test \"x$ac_cv_lib_dl_dlopen\" = xyes; then :\n  lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"\nelse\n\n    lt_cv_dlopen=\"dyld\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n\nfi\n\n    ;;\n\n  *)\n    ac_fn_c_check_func \"$LINENO\" \"shl_load\" \"ac_cv_func_shl_load\"\nif test \"x$ac_cv_func_shl_load\" = xyes; then :\n  lt_cv_dlopen=\"shl_load\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld\" >&5\n$as_echo_n \"checking for shl_load in -ldld... \" >&6; }\nif ${ac_cv_lib_dld_shl_load+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldld  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar shl_load ();\nint\nmain ()\n{\nreturn shl_load ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dld_shl_load=yes\nelse\n  ac_cv_lib_dld_shl_load=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load\" >&5\n$as_echo \"$ac_cv_lib_dld_shl_load\" >&6; }\nif test \"x$ac_cv_lib_dld_shl_load\" = xyes; then :\n  lt_cv_dlopen=\"shl_load\" lt_cv_dlopen_libs=\"-ldld\"\nelse\n  ac_fn_c_check_func \"$LINENO\" \"dlopen\" \"ac_cv_func_dlopen\"\nif test \"x$ac_cv_func_dlopen\" = xyes; then :\n  lt_cv_dlopen=\"dlopen\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl\" >&5\n$as_echo_n \"checking for dlopen in -ldl... \" >&6; }\nif ${ac_cv_lib_dl_dlopen+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldl  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dlopen ();\nint\nmain ()\n{\nreturn dlopen ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dl_dlopen=yes\nelse\n  ac_cv_lib_dl_dlopen=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen\" >&5\n$as_echo \"$ac_cv_lib_dl_dlopen\" >&6; }\nif test \"x$ac_cv_lib_dl_dlopen\" = xyes; then :\n  lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld\" >&5\n$as_echo_n \"checking for dlopen in -lsvld... \" >&6; }\nif ${ac_cv_lib_svld_dlopen+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lsvld  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dlopen ();\nint\nmain ()\n{\nreturn dlopen ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_svld_dlopen=yes\nelse\n  ac_cv_lib_svld_dlopen=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen\" >&5\n$as_echo \"$ac_cv_lib_svld_dlopen\" >&6; }\nif test \"x$ac_cv_lib_svld_dlopen\" = xyes; then :\n  lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-lsvld\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld\" >&5\n$as_echo_n \"checking for dld_link in -ldld... \" >&6; }\nif ${ac_cv_lib_dld_dld_link+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldld  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dld_link ();\nint\nmain ()\n{\nreturn dld_link ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dld_dld_link=yes\nelse\n  ac_cv_lib_dld_dld_link=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link\" >&5\n$as_echo \"$ac_cv_lib_dld_dld_link\" >&6; }\nif test \"x$ac_cv_lib_dld_dld_link\" = xyes; then :\n  lt_cv_dlopen=\"dld_link\" lt_cv_dlopen_libs=\"-ldld\"\nfi\n\n\nfi\n\n\nfi\n\n\nfi\n\n\nfi\n\n\nfi\n\n    ;;\n  esac\n\n  if test \"x$lt_cv_dlopen\" != xno; then\n    enable_dlopen=yes\n  else\n    enable_dlopen=no\n  fi\n\n  case $lt_cv_dlopen in\n  dlopen)\n    save_CPPFLAGS=\"$CPPFLAGS\"\n    test \"x$ac_cv_header_dlfcn_h\" = xyes && CPPFLAGS=\"$CPPFLAGS -DHAVE_DLFCN_H\"\n\n    save_LDFLAGS=\"$LDFLAGS\"\n    wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $export_dynamic_flag_spec\\\"\n\n    save_LIBS=\"$LIBS\"\n    LIBS=\"$lt_cv_dlopen_libs $LIBS\"\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself\" >&5\n$as_echo_n \"checking whether a program can dlopen itself... \" >&6; }\nif ${lt_cv_dlopen_self+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  \t  if test \"$cross_compiling\" = yes; then :\n  lt_cv_dlopen_self=cross\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n#line $LINENO \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\n/* When -fvisbility=hidden is used, assume the code has been annotated\n   correspondingly for the symbols needed.  */\n#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))\nint fnord () __attribute__((visibility(\"default\")));\n#endif\n\nint fnord () { return 42; }\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else\n        {\n\t  if (dlsym( self,\"_fnord\"))  status = $lt_dlneed_uscore;\n          else puts (dlerror ());\n\t}\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}\n_LT_EOF\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_link\\\"\"; } >&5\n  (eval $ac_link) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&5 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;\n      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;\n      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;\n    esac\n  else :\n    # compilation failed\n    lt_cv_dlopen_self=no\n  fi\nfi\nrm -fr conftest*\n\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self\" >&5\n$as_echo \"$lt_cv_dlopen_self\" >&6; }\n\n    if test \"x$lt_cv_dlopen_self\" = xyes; then\n      wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $lt_prog_compiler_static\\\"\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself\" >&5\n$as_echo_n \"checking whether a statically linked program can dlopen itself... \" >&6; }\nif ${lt_cv_dlopen_self_static+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  \t  if test \"$cross_compiling\" = yes; then :\n  lt_cv_dlopen_self_static=cross\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n#line $LINENO \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\n/* When -fvisbility=hidden is used, assume the code has been annotated\n   correspondingly for the symbols needed.  */\n#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))\nint fnord () __attribute__((visibility(\"default\")));\n#endif\n\nint fnord () { return 42; }\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else\n        {\n\t  if (dlsym( self,\"_fnord\"))  status = $lt_dlneed_uscore;\n          else puts (dlerror ());\n\t}\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}\n_LT_EOF\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_link\\\"\"; } >&5\n  (eval $ac_link) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&5 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;\n      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;\n      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;\n    esac\n  else :\n    # compilation failed\n    lt_cv_dlopen_self_static=no\n  fi\nfi\nrm -fr conftest*\n\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static\" >&5\n$as_echo \"$lt_cv_dlopen_self_static\" >&6; }\n    fi\n\n    CPPFLAGS=\"$save_CPPFLAGS\"\n    LDFLAGS=\"$save_LDFLAGS\"\n    LIBS=\"$save_LIBS\"\n    ;;\n  esac\n\n  case $lt_cv_dlopen_self in\n  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;\n  *) enable_dlopen_self=unknown ;;\n  esac\n\n  case $lt_cv_dlopen_self_static in\n  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;\n  *) enable_dlopen_self_static=unknown ;;\n  esac\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nstriplib=\nold_striplib=\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible\" >&5\n$as_echo_n \"checking whether stripping libraries is possible... \" >&6; }\nif test -n \"$STRIP\" && $STRIP -V 2>&1 | $GREP \"GNU strip\" >/dev/null; then\n  test -z \"$old_striplib\" && old_striplib=\"$STRIP --strip-debug\"\n  test -z \"$striplib\" && striplib=\"$STRIP --strip-unneeded\"\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\nelse\n# FIXME - insert some real tests, host_os isn't really good enough\n  case $host_os in\n  darwin*)\n    if test -n \"$STRIP\" ; then\n      striplib=\"$STRIP -x\"\n      old_striplib=\"$STRIP -S\"\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n    else\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n    fi\n    ;;\n  *)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n    ;;\n  esac\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n  # Report which library types will actually be built\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries\" >&5\n$as_echo_n \"checking if libtool supports shared libraries... \" >&6; }\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $can_build_shared\" >&5\n$as_echo \"$can_build_shared\" >&6; }\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries\" >&5\n$as_echo_n \"checking whether to build shared libraries... \" >&6; }\n  test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n  # On AIX, shared libraries and static libraries use the same namespace, and\n  # are all built from PIC.\n  case $host_os in\n  aix3*)\n    test \"$enable_shared\" = yes && enable_static=no\n    if test -n \"$RANLIB\"; then\n      archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n      postinstall_cmds='$RANLIB $lib'\n    fi\n    ;;\n\n  aix[4-9]*)\n    if test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n      test \"$enable_shared\" = yes && enable_static=no\n    fi\n    ;;\n  esac\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $enable_shared\" >&5\n$as_echo \"$enable_shared\" >&6; }\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether to build static libraries\" >&5\n$as_echo_n \"checking whether to build static libraries... \" >&6; }\n  # Make sure either enable_shared or enable_static is yes.\n  test \"$enable_shared\" = yes || enable_static=yes\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $enable_static\" >&5\n$as_echo \"$enable_static\" >&6; }\n\n\n\n\nfi\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\nCC=\"$lt_save_CC\"\n\n      if test -n \"$CXX\" && ( test \"X$CXX\" != \"Xno\" &&\n    ( (test \"X$CXX\" = \"Xg++\" && `g++ -v >/dev/null 2>&1` ) ||\n    (test \"X$CXX\" != \"Xg++\"))) ; then\n  ac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor\" >&5\n$as_echo_n \"checking how to run the C++ preprocessor... \" >&6; }\nif test -z \"$CXXCPP\"; then\n  if ${ac_cv_prog_CXXCPP+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n      # Double quotes because CXXCPP needs to be expanded\n    for CXXCPP in \"$CXX -E\" \"/lib/cpp\"\n    do\n      ac_preproc_ok=false\nfor ac_cxx_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.i conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n  break\nfi\n\n    done\n    ac_cv_prog_CXXCPP=$CXXCPP\n\nfi\n  CXXCPP=$ac_cv_prog_CXXCPP\nelse\n  ac_cv_prog_CXXCPP=$CXXCPP\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CXXCPP\" >&5\n$as_echo \"$CXXCPP\" >&6; }\nac_preproc_ok=false\nfor ac_cxx_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.i conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.i conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n\nelse\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"C++ preprocessor \\\"$CXXCPP\\\" fails sanity check\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\nfi\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\nelse\n  _lt_caught_CXX_error=yes\nfi\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\narchive_cmds_need_lc_CXX=no\nallow_undefined_flag_CXX=\nalways_export_symbols_CXX=no\narchive_expsym_cmds_CXX=\ncompiler_needs_object_CXX=no\nexport_dynamic_flag_spec_CXX=\nhardcode_direct_CXX=no\nhardcode_direct_absolute_CXX=no\nhardcode_libdir_flag_spec_CXX=\nhardcode_libdir_separator_CXX=\nhardcode_minus_L_CXX=no\nhardcode_shlibpath_var_CXX=unsupported\nhardcode_automatic_CXX=no\ninherit_rpath_CXX=no\nmodule_cmds_CXX=\nmodule_expsym_cmds_CXX=\nlink_all_deplibs_CXX=unknown\nold_archive_cmds_CXX=$old_archive_cmds\nreload_flag_CXX=$reload_flag\nreload_cmds_CXX=$reload_cmds\nno_undefined_flag_CXX=\nwhole_archive_flag_spec_CXX=\nenable_shared_with_static_runtimes_CXX=no\n\n# Source file extension for C++ test sources.\nac_ext=cpp\n\n# Object file extension for compiled C++ test sources.\nobjext=o\nobjext_CXX=$objext\n\n# No sense in running all these tests if we already determined that\n# the CXX compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_caught_CXX_error\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"int some_variable = 0;\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n\n\n\n\n\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n\n\n  # save warnings/boilerplate of simple test code\n  ac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n\n  ac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=$CC\n  lt_save_CFLAGS=$CFLAGS\n  lt_save_LD=$LD\n  lt_save_GCC=$GCC\n  GCC=$GXX\n  lt_save_with_gnu_ld=$with_gnu_ld\n  lt_save_path_LD=$lt_cv_path_LD\n  if test -n \"${lt_cv_prog_gnu_ldcxx+set}\"; then\n    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx\n  else\n    $as_unset lt_cv_prog_gnu_ld\n  fi\n  if test -n \"${lt_cv_path_LDCXX+set}\"; then\n    lt_cv_path_LD=$lt_cv_path_LDCXX\n  else\n    $as_unset lt_cv_path_LD\n  fi\n  test -z \"${LDCXX+set}\" || LD=$LDCXX\n  CC=${CXX-\"c++\"}\n  CFLAGS=$CXXFLAGS\n  compiler=$CC\n  compiler_CXX=$CC\n  for cc_temp in $compiler\"\"; do\n  case $cc_temp in\n    compile | *[\\\\/]compile | ccache | *[\\\\/]ccache ) ;;\n    distcc | *[\\\\/]distcc | purify | *[\\\\/]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"$cc_temp\" | $SED \"s%.*/%%; s%^$host_alias-%%\"`\n\n\n  if test -n \"$compiler\"; then\n    # We don't want -fno-exception when compiling C++ code, so set the\n    # no_builtin_flag separately\n    if test \"$GXX\" = yes; then\n      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'\n    else\n      lt_prog_compiler_no_builtin_flag_CXX=\n    fi\n\n    if test \"$GXX\" = yes; then\n      # Set up default GNU C++ configuration\n\n\n\n# Check whether --with-gnu-ld was given.\nif test \"${with_gnu_ld+set}\" = set; then :\n  withval=$with_gnu_ld; test \"$withval\" = no || with_gnu_ld=yes\nelse\n  with_gnu_ld=no\nfi\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ld used by $CC\" >&5\n$as_echo_n \"checking for ld used by $CC... \" >&6; }\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [\\\\/]* | ?:[\\\\/]*)\n      re_direlt='/[^/][^/]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for GNU ld\" >&5\n$as_echo_n \"checking for GNU ld... \" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for non-GNU ld\" >&5\n$as_echo_n \"checking for non-GNU ld... \" >&6; }\nfi\nif ${lt_cv_path_LD+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi\nfi\n\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LD\" >&5\n$as_echo \"$LD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\ntest -z \"$LD\" && as_fn_error $? \"no acceptable ld found in \\$PATH\" \"$LINENO\" 5\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld\" >&5\n$as_echo_n \"checking if the linker ($LD) is GNU ld... \" >&6; }\nif ${lt_cv_prog_gnu_ld+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  # I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld\" >&5\n$as_echo \"$lt_cv_prog_gnu_ld\" >&6; }\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n\n\n\n\n\n\n\n      # Check if GNU C++ uses GNU ld as the underlying linker, since the\n      # archiving commands below assume that GNU ld is being used.\n      if test \"$with_gnu_ld\" = yes; then\n        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\n        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\n        # If archive_cmds runs LD, not CC, wlarc should be empty\n        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to\n        #     investigate it a little bit more. (MM)\n        wlarc='${wl}'\n\n        # ancient GNU ld didn't support --whole-archive et. al.\n        if eval \"`$CC -print-prog-name=ld` --help 2>&1\" |\n\t  $GREP 'no-whole-archive' > /dev/null; then\n          whole_archive_flag_spec_CXX=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n        else\n          whole_archive_flag_spec_CXX=\n        fi\n      else\n        with_gnu_ld=no\n        wlarc=\n\n        # A generic and very simple default shared library creation\n        # command for GNU C++ for the case where it uses the native\n        # linker, instead of GNU ld.  If possible, this setting should\n        # overridden to take advantage of the native linker features on\n        # the platform it is being used on.\n        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n      fi\n\n      # Commands to make compiler produce verbose output that lists\n      # what \"hidden\" libraries, object files and flags are used when\n      # linking a shared library.\n      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n    else\n      GXX=no\n      with_gnu_ld=no\n      wlarc=\n    fi\n\n    # PORTME: fill in a description of your system's C++ link characteristics\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries\" >&5\n$as_echo_n \"checking whether the $compiler linker ($LD) supports shared libraries... \" >&6; }\n    ld_shlibs_CXX=yes\n    case $host_os in\n      aix3*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n      aix[4-9]*)\n        if test \"$host_cpu\" = ia64; then\n          # On IA64, the linker does run time linking by default, so we don't\n          # have to do anything special.\n          aix_use_runtimelinking=no\n          exp_sym_flag='-Bexport'\n          no_entry_flag=\"\"\n        else\n          aix_use_runtimelinking=no\n\n          # Test if we are trying to use run time linking or normal\n          # AIX style linking. If -brtl is somewhere in LDFLAGS, we\n          # need to do runtime linking.\n          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)\n\t    for ld_flag in $LDFLAGS; do\n\t      case $ld_flag in\n\t      *-brtl*)\n\t        aix_use_runtimelinking=yes\n\t        break\n\t        ;;\n\t      esac\n\t    done\n\t    ;;\n          esac\n\n          exp_sym_flag='-bexport'\n          no_entry_flag='-bnoentry'\n        fi\n\n        # When large executables or shared objects are built, AIX ld can\n        # have problems creating the table of contents.  If linking a library\n        # or program results in \"error TOC overflow\" add -mminimal-toc to\n        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n        archive_cmds_CXX=''\n        hardcode_direct_CXX=yes\n        hardcode_direct_absolute_CXX=yes\n        hardcode_libdir_separator_CXX=':'\n        link_all_deplibs_CXX=yes\n        file_list_spec_CXX='${wl}-f,'\n\n        if test \"$GXX\" = yes; then\n          case $host_os in aix4.[012]|aix4.[012].*)\n          # We only want to do this on AIX 4.2 and lower, the check\n          # below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t     strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t    # We have reworked collect2\n\t    :\n\t  else\n\t    # We have old collect2\n\t    hardcode_direct_CXX=unsupported\n\t    # It fails to find uninstalled libraries when the uninstalled\n\t    # path is not listed in the libpath.  Setting hardcode_minus_L\n\t    # to unsupported forces relinking\n\t    hardcode_minus_L_CXX=yes\n\t    hardcode_libdir_flag_spec_CXX='-L$libdir'\n\t    hardcode_libdir_separator_CXX=\n\t  fi\n          esac\n          shared_flag='-shared'\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag=\"$shared_flag \"'${wl}-G'\n\t  fi\n        else\n          # not using gcc\n          if test \"$host_cpu\" = ia64; then\n\t  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t  # chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n          else\n\t    if test \"$aix_use_runtimelinking\" = yes; then\n\t      shared_flag='${wl}-G'\n\t    else\n\t      shared_flag='${wl}-bM:SRE'\n\t    fi\n          fi\n        fi\n\n        export_dynamic_flag_spec_CXX='${wl}-bexpall'\n        # It seems that -bexpall does not export symbols beginning with\n        # underscore (_), so it is better to generate a list of symbols to\n\t# export.\n        always_export_symbols_CXX=yes\n        if test \"$aix_use_runtimelinking\" = yes; then\n          # Warning - without using the other runtime loading flags (-brtl),\n          # -berok will link without error, but may produce a broken library.\n          allow_undefined_flag_CXX='-berok'\n          # Determine the default libpath from the value encoded in an empty\n          # executable.\n          if test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  if ${lt_cv_aix_libpath__CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_link \"$LINENO\"; then :\n\n  lt_aix_libpath_sed='\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }'\n  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$lt_cv_aix_libpath__CXX\"; then\n    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  if test -z \"$lt_cv_aix_libpath__CXX\"; then\n    lt_cv_aix_libpath__CXX=\"/usr/lib:/lib\"\n  fi\n\nfi\n\n  aix_libpath=$lt_cv_aix_libpath__CXX\nfi\n\n          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\n          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n        else\n          if test \"$host_cpu\" = ia64; then\n\t    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'\n\t    allow_undefined_flag_CXX=\"-z nodefs\"\n\t    archive_expsym_cmds_CXX=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n          else\n\t    # Determine the default libpath from the value encoded in an\n\t    # empty executable.\n\t    if test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  if ${lt_cv_aix_libpath__CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_link \"$LINENO\"; then :\n\n  lt_aix_libpath_sed='\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }'\n  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$lt_cv_aix_libpath__CXX\"; then\n    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  if test -z \"$lt_cv_aix_libpath__CXX\"; then\n    lt_cv_aix_libpath__CXX=\"/usr/lib:/lib\"\n  fi\n\nfi\n\n  aix_libpath=$lt_cv_aix_libpath__CXX\nfi\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t    # Warning - without using the other run time loading flags,\n\t    # -berok will link without error, but may produce a broken library.\n\t    no_undefined_flag_CXX=' ${wl}-bernotok'\n\t    allow_undefined_flag_CXX=' ${wl}-berok'\n\t    if test \"$with_gnu_ld\" = yes; then\n\t      # We only use this code for GNU lds that support --whole-archive.\n\t      whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    else\n\t      # Exported symbols can be pulled into shared objects from archives\n\t      whole_archive_flag_spec_CXX='$convenience'\n\t    fi\n\t    archive_cmds_need_lc_CXX=yes\n\t    # This is similar to how AIX traditionally builds its shared\n\t    # libraries.\n\t    archive_expsym_cmds_CXX=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n          fi\n        fi\n        ;;\n\n      beos*)\n\tif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t  allow_undefined_flag_CXX=unsupported\n\t  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t  # support --undefined.  This deserves some investigation.  FIXME\n\t  archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\telse\n\t  ld_shlibs_CXX=no\n\tfi\n\t;;\n\n      chorus*)\n        case $cc_basename in\n          *)\n\t  # FIXME: insert proper C++ library support\n\t  ld_shlibs_CXX=no\n\t  ;;\n        esac\n        ;;\n\n      cygwin* | mingw* | pw32* | cegcc*)\n\tcase $GXX,$cc_basename in\n\t,cl* | no,cl*)\n\t  # Native MSVC\n\t  # hardcode_libdir_flag_spec is actually meaningless, as there is\n\t  # no search path for DLLs.\n\t  hardcode_libdir_flag_spec_CXX=' '\n\t  allow_undefined_flag_CXX=unsupported\n\t  always_export_symbols_CXX=yes\n\t  file_list_spec_CXX='@'\n\t  # Tell ltmain to make .lib files, not .a files.\n\t  libext=lib\n\t  # Tell ltmain to make .dll files, not .so files.\n\t  shrext_cmds=\".dll\"\n\t  # FIXME: Setting linknames here is a bad hack.\n\t  archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t  archive_expsym_cmds_CXX='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      $SED -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t    else\n\t      $SED -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t    fi~\n\t    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t    linknames='\n\t  # The linker will not automatically build a static lib if we build a DLL.\n\t  # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'\n\t  enable_shared_with_static_runtimes_CXX=yes\n\t  # Don't use ranlib\n\t  old_postinstall_cmds_CXX='chmod 644 $oldlib'\n\t  postlink_cmds_CXX='lt_outputfile=\"@OUTPUT@\"~\n\t    lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t    case $lt_outputfile in\n\t      *.exe|*.EXE) ;;\n\t      *)\n\t\tlt_outputfile=\"$lt_outputfile.exe\"\n\t\tlt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t\t;;\n\t    esac~\n\t    func_to_tool_file \"$lt_outputfile\"~\n\t    if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t      $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t      $RM \"$lt_outputfile.manifest\";\n\t    fi'\n\t  ;;\n\t*)\n\t  # g++\n\t  # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,\n\t  # as there is no search path for DLLs.\n\t  hardcode_libdir_flag_spec_CXX='-L$libdir'\n\t  export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'\n\t  allow_undefined_flag_CXX=unsupported\n\t  always_export_symbols_CXX=no\n\t  enable_shared_with_static_runtimes_CXX=yes\n\n\t  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n\t    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t    # If the export-symbols file already is a .def file (1st line\n\t    # is EXPORTS), use it as is; otherwise, prepend...\n\t    archive_expsym_cmds_CXX='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      cp $export_symbols $output_objdir/$soname.def;\n\t    else\n\t      echo EXPORTS > $output_objdir/$soname.def;\n\t      cat $export_symbols >> $output_objdir/$soname.def;\n\t    fi~\n\t    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t  else\n\t    ld_shlibs_CXX=no\n\t  fi\n\t  ;;\n\tesac\n\t;;\n      darwin* | rhapsody*)\n\n\n  archive_cmds_need_lc_CXX=no\n  hardcode_direct_CXX=no\n  hardcode_automatic_CXX=yes\n  hardcode_shlibpath_var_CXX=unsupported\n  if test \"$lt_cv_ld_force_load\" = \"yes\"; then\n    whole_archive_flag_spec_CXX='`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience ${wl}-force_load,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"`'\n\n  else\n    whole_archive_flag_spec_CXX=''\n  fi\n  link_all_deplibs_CXX=yes\n  allow_undefined_flag_CXX=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=func_echo_all\n    archive_cmds_CXX=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    module_cmds_CXX=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    archive_expsym_cmds_CXX=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    module_expsym_cmds_CXX=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n       if test \"$lt_cv_apple_cc_single_mod\" != \"yes\"; then\n      archive_cmds_CXX=\"\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dsymutil}\"\n      archive_expsym_cmds_CXX=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dar_export_syms}${_lt_dsymutil}\"\n    fi\n\n  else\n  ld_shlibs_CXX=no\n  fi\n\n\t;;\n\n      dgux*)\n        case $cc_basename in\n          ec++*)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          ghcx*)\n\t    # Green Hills C++ Compiler\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n        esac\n        ;;\n\n      freebsd2.*)\n        # C++ shared libraries reported to be fairly broken before\n\t# switch to ELF\n        ld_shlibs_CXX=no\n        ;;\n\n      freebsd-elf*)\n        archive_cmds_need_lc_CXX=no\n        ;;\n\n      freebsd* | dragonfly*)\n        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF\n        # conventions\n        ld_shlibs_CXX=yes\n        ;;\n\n      gnu*)\n        ;;\n\n      haiku*)\n        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        link_all_deplibs_CXX=yes\n        ;;\n\n      hpux9*)\n        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'\n        hardcode_libdir_separator_CXX=:\n        export_dynamic_flag_spec_CXX='${wl}-E'\n        hardcode_direct_CXX=yes\n        hardcode_minus_L_CXX=yes # Not in the search PATH,\n\t\t\t\t             # but as the default\n\t\t\t\t             # location of the library.\n\n        case $cc_basename in\n          CC*)\n            # FIXME: insert proper C++ library support\n            ld_shlibs_CXX=no\n            ;;\n          aCC*)\n            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            # Commands to make compiler produce verbose output that lists\n            # what \"hidden\" libraries, object files and flags are used when\n            # linking a shared library.\n            #\n            # There doesn't appear to be a way to prevent this compiler from\n            # explicitly linking system object files so we need to strip them\n            # from the output so that they don't get included in the library\n            # dependencies.\n            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n            ;;\n          *)\n            if test \"$GXX\" = yes; then\n              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            else\n              # FIXME: insert proper C++ library support\n              ld_shlibs_CXX=no\n            fi\n            ;;\n        esac\n        ;;\n\n      hpux10*|hpux11*)\n        if test $with_gnu_ld = no; then\n\t  hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'\n\t  hardcode_libdir_separator_CXX=:\n\n          case $host_cpu in\n            hppa*64*|ia64*)\n              ;;\n            *)\n\t      export_dynamic_flag_spec_CXX='${wl}-E'\n              ;;\n          esac\n        fi\n        case $host_cpu in\n          hppa*64*|ia64*)\n            hardcode_direct_CXX=no\n            hardcode_shlibpath_var_CXX=no\n            ;;\n          *)\n            hardcode_direct_CXX=yes\n            hardcode_direct_absolute_CXX=yes\n            hardcode_minus_L_CXX=yes # Not in the search PATH,\n\t\t\t\t\t         # but as the default\n\t\t\t\t\t         # location of the library.\n            ;;\n        esac\n\n        case $cc_basename in\n          CC*)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          aCC*)\n\t    case $host_cpu in\n\t      hppa*64*)\n\t        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      ia64*)\n\t        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      *)\n\t        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t    esac\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test $with_gnu_ld = no; then\n\t        case $host_cpu in\n\t          hppa*64*)\n\t            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          ia64*)\n\t            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          *)\n\t            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t        esac\n\t      fi\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      ld_shlibs_CXX=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      interix[3-9]*)\n\thardcode_direct_CXX=no\n\thardcode_shlibpath_var_CXX=no\n\thardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\texport_dynamic_flag_spec_CXX='${wl}-E'\n\t# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n\t# Instead, shared libraries are loaded at an image base (0x10000000 by\n\t# default) and relocated if they conflict, which is a slow very memory\n\t# consuming and fragmenting process.  To avoid this, we pick a random,\n\t# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n\t# time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n\tarchive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\tarchive_expsym_cmds_CXX='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t;;\n      irix5* | irix6*)\n        case $cc_basename in\n          CC*)\n\t    # SGI C++\n\t    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -ar\", where \"CC\" is the IRIX C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test \"$with_gnu_ld\" = no; then\n\t        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t      else\n\t        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` -o $lib'\n\t      fi\n\t    fi\n\t    link_all_deplibs_CXX=yes\n\t    ;;\n        esac\n        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n        hardcode_libdir_separator_CXX=:\n        inherit_rpath_CXX=yes\n        ;;\n\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\\''s/\\([^()0-9A-Za-z{}]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\t    archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\\''s/\\([^()0-9A-Za-z{}]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib ${wl}-retain-symbols-file,$export_symbols; mv \\$templib $lib'\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP \"ld\"`; rm -f libconftest$shared_ext; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -Bstatic\", where \"CC\" is the KAI C++ compiler.\n\t    old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'\n\t    ;;\n\t  icpc* | ecpc* )\n\t    # Intel C++\n\t    with_gnu_ld=yes\n\t    # version 8.0 and above of icpc choke on multiply defined symbols\n\t    # if we add $predep_objects and $postdep_objects, however 7.1 and\n\t    # earlier do not add the objects themselves.\n\t    case `$CC -V 2>&1` in\n\t      *\"Version 7.\"*)\n\t        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\tarchive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t      *)  # Version 8.0 or newer\n\t        tmp_idyn=\n\t        case $host_cpu in\n\t\t  ia64*) tmp_idyn=' -i_dynamic';;\n\t\tesac\n\t        archive_cmds_CXX='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\tarchive_expsym_cmds_CXX='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t    esac\n\t    archive_cmds_need_lc_CXX=no\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\t    whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    ;;\n          pgCC* | pgcpp*)\n            # Portland Group C++ compiler\n\t    case `$CC -V` in\n\t    *pgCC\\ [1-5].* | *pgcpp\\ [1-5].*)\n\t      prelink_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~\n\t\tcompile_command=\"$compile_command `find $tpldir -name \\*.o | sort | $NL2SP`\"'\n\t      old_archive_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~\n\t\t$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \\*.o | sort | $NL2SP`~\n\t\t$RANLIB $oldlib'\n\t      archive_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      archive_expsym_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    *) # Version 6 and above use weak symbols\n\t      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    esac\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\t    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n            ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'\n\n\t    runpath_var=LD_RUN_PATH\n\t    hardcode_libdir_flag_spec_CXX='-rpath $libdir'\n\t    hardcode_libdir_separator_CXX=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld .*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"X$list\" | $Xsed'\n\t    ;;\n\t  xl* | mpixl* | bgxl*)\n\t    # IBM XL 8.0 on PPC, with GNU ld\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\t    archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    if test \"x$supports_anon_versioning\" = xyes; then\n\t      archive_expsym_cmds_CXX='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t\tcat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t\techo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t\t$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n\t    fi\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      no_undefined_flag_CXX=' -zdefs'\n\t      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'\n\t      hardcode_libdir_flag_spec_CXX='-R$libdir'\n\t      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t      compiler_needs_object_CXX=yes\n\n\t      # Not sure whether something based on\n\t      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1\n\t      # would be better.\n\t      output_verbose_link_cmd='func_echo_all'\n\n\t      # Archives containing C++ object files must be created using\n\t      # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t      # necessary to make sure instantiated templates are included\n\t      # in the archive.\n\t      old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n\n      lynxos*)\n        # FIXME: insert proper C++ library support\n\tld_shlibs_CXX=no\n\t;;\n\n      m88k*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n\t;;\n\n      mvs*)\n        case $cc_basename in\n          cxx*)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n\t  *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n\tesac\n\t;;\n\n      netbsd*)\n        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t  archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'\n\t  wlarc=\n\t  hardcode_libdir_flag_spec_CXX='-R$libdir'\n\t  hardcode_direct_CXX=yes\n\t  hardcode_shlibpath_var_CXX=no\n\tfi\n\t# Workaround some broken pre-1.5 toolchains\n\toutput_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e \"s:-lgcc -lc -lgcc::\"'\n\t;;\n\n      *nto* | *qnx*)\n        ld_shlibs_CXX=yes\n\t;;\n\n      openbsd2*)\n        # C++ shared libraries are fairly broken\n\tld_shlibs_CXX=no\n\t;;\n\n      openbsd*)\n\tif test -f /usr/libexec/ld.so; then\n\t  hardcode_direct_CXX=yes\n\t  hardcode_shlibpath_var_CXX=no\n\t  hardcode_direct_absolute_CXX=yes\n\t  archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n\t  hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t  if test -z \"`echo __ELF__ | $CC -E - | grep __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t    archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'\n\t    export_dynamic_flag_spec_CXX='${wl}-E'\n\t    whole_archive_flag_spec_CXX=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n\t  fi\n\t  output_verbose_link_cmd=func_echo_all\n\telse\n\t  ld_shlibs_CXX=no\n\tfi\n\t;;\n\n      osf3* | osf4* | osf5*)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\\''s/\\([^()0-9A-Za-z{}]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo \"$lib\" | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t    hardcode_libdir_separator_CXX=:\n\n\t    # Archives containing C++ object files must be created using\n\t    # the KAI C++ compiler.\n\t    case $host in\n\t      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;\n\t      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;\n\t    esac\n\t    ;;\n          RCC*)\n\t    # Rational C++ 2.4.1\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          cxx*)\n\t    case $host in\n\t      osf3*)\n\t        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\\*'\n\t        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n\t\t;;\n\t      *)\n\t        allow_undefined_flag_CXX=' -expect_unresolved \\*'\n\t        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done~\n\t          echo \"-hidden\">> $lib.exp~\n\t          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~\n\t          $RM $lib.exp'\n\t        hardcode_libdir_flag_spec_CXX='-rpath $libdir'\n\t\t;;\n\t    esac\n\n\t    hardcode_libdir_separator_CXX=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\" | $GREP -v \"ld:\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld.*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n\t  *)\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\\*'\n\t      case $host in\n\t        osf3*)\n\t          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t        *)\n\t          archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t      esac\n\n\t      hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n\t      hardcode_libdir_separator_CXX=:\n\n\t      # Commands to make compiler produce verbose output that lists\n\t      # what \"hidden\" libraries, object files and flags are used when\n\t      # linking a shared library.\n\t      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      ld_shlibs_CXX=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      psos*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n\n      sunos4*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.x\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          lcc*)\n\t    # Lucid\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n        esac\n        ;;\n\n      solaris*)\n        case $cc_basename in\n          CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n            archive_cmds_need_lc_CXX=yes\n\t    no_undefined_flag_CXX=' -zdefs'\n\t    archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t    archive_expsym_cmds_CXX='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t    hardcode_libdir_flag_spec_CXX='-R$libdir'\n\t    hardcode_shlibpath_var_CXX=no\n\t    case $host_os in\n\t      solaris2.[0-5] | solaris2.[0-5].*) ;;\n\t      *)\n\t\t# The compiler driver will combine and reorder linker options,\n\t\t# but understands `-z linker_flag'.\n\t        # Supported since Solaris 2.6 (maybe 2.5.1?)\n\t\twhole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'\n\t        ;;\n\t    esac\n\t    link_all_deplibs_CXX=yes\n\n\t    output_verbose_link_cmd='func_echo_all'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'\n\t    ;;\n          gcx*)\n\t    # Green Hills C++ Compiler\n\t    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\n\t    # The C++ compiler must be used to create the archive.\n\t    old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    # GNU C++ compiler with Solaris linker\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'\n\t      if $CC --version | $GREP -v '^2\\.7' > /dev/null; then\n\t        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        archive_expsym_cmds_CXX='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      else\n\t        # g++ 2.7 appears to require `-G' NOT `-shared' on this\n\t        # platform.\n\t        archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        archive_expsym_cmds_CXX='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      fi\n\n\t      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'\n\t      case $host_os in\n\t\tsolaris2.[0-5] | solaris2.[0-5].*) ;;\n\t\t*)\n\t\t  whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\t\t  ;;\n\t      esac\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)\n      no_undefined_flag_CXX='${wl}-z,text'\n      archive_cmds_need_lc_CXX=no\n      hardcode_shlibpath_var_CXX=no\n      runpath_var='LD_RUN_PATH'\n\n      case $cc_basename in\n        CC*)\n\t  archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n      esac\n      ;;\n\n      sysv5* | sco3.2v5* | sco5v6*)\n\t# Note: We can NOT use -z defs as we might desire, because we do not\n\t# link with -lc, and that would cause any symbols used from libc to\n\t# always be unresolved, which means just about no library would\n\t# ever link correctly.  If we're not using GNU ld we use -z text\n\t# though, which does catch some bad symbols but isn't as heavy-handed\n\t# as -z defs.\n\tno_undefined_flag_CXX='${wl}-z,text'\n\tallow_undefined_flag_CXX='${wl}-z,nodefs'\n\tarchive_cmds_need_lc_CXX=no\n\thardcode_shlibpath_var_CXX=no\n\thardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'\n\thardcode_libdir_separator_CXX=':'\n\tlink_all_deplibs_CXX=yes\n\texport_dynamic_flag_spec_CXX='${wl}-Bexport'\n\trunpath_var='LD_RUN_PATH'\n\n\tcase $cc_basename in\n          CC*)\n\t    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~\n\t      '\"$old_archive_cmds_CXX\"\n\t    reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~\n\t      '\"$reload_cmds_CXX\"\n\t    ;;\n\t  *)\n\t    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\tesac\n      ;;\n\n      tandem*)\n        case $cc_basename in\n          NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n        esac\n        ;;\n\n      vxworks*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n\n      *)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n    esac\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX\" >&5\n$as_echo \"$ld_shlibs_CXX\" >&6; }\n    test \"$ld_shlibs_CXX\" = no && can_build_shared=no\n\n    GCC_CXX=\"$GXX\"\n    LD_CXX=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    # Dependencies to place before and after the object being linked:\npredep_objects_CXX=\npostdep_objects_CXX=\npredeps_CXX=\npostdeps_CXX=\ncompiler_lib_search_path_CXX=\n\ncat > conftest.$ac_ext <<_LT_EOF\nclass Foo\n{\npublic:\n  Foo (void) { a = 0; }\nprivate:\n  int a;\n};\n_LT_EOF\n\n\n_lt_libdeps_save_CFLAGS=$CFLAGS\ncase \"$CC $CFLAGS \" in #(\n*\\ -flto*\\ *) CFLAGS=\"$CFLAGS -fno-lto\" ;;\n*\\ -fwhopr*\\ *) CFLAGS=\"$CFLAGS -fno-whopr\" ;;\n*\\ -fuse-linker-plugin*\\ *) CFLAGS=\"$CFLAGS -fno-use-linker-plugin\" ;;\nesac\n\nif { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n  # Parse the compiler output and extract the necessary\n  # objects, libraries and library flags.\n\n  # Sentinel used to keep track of whether or not we are before\n  # the conftest object file.\n  pre_test_object_deps_done=no\n\n  for p in `eval \"$output_verbose_link_cmd\"`; do\n    case ${prev}${p} in\n\n    -L* | -R* | -l*)\n       # Some compilers place space between \"-{L,R}\" and the path.\n       # Remove the space.\n       if test $p = \"-L\" ||\n          test $p = \"-R\"; then\n\t prev=$p\n\t continue\n       fi\n\n       # Expand the sysroot to ease extracting the directories later.\n       if test -z \"$prev\"; then\n         case $p in\n         -L*) func_stripname_cnf '-L' '' \"$p\"; prev=-L; p=$func_stripname_result ;;\n         -R*) func_stripname_cnf '-R' '' \"$p\"; prev=-R; p=$func_stripname_result ;;\n         -l*) func_stripname_cnf '-l' '' \"$p\"; prev=-l; p=$func_stripname_result ;;\n         esac\n       fi\n       case $p in\n       =*) func_stripname_cnf '=' '' \"$p\"; p=$lt_sysroot$func_stripname_result ;;\n       esac\n       if test \"$pre_test_object_deps_done\" = no; then\n\t case ${prev} in\n\t -L | -R)\n\t   # Internal compiler library paths should come after those\n\t   # provided the user.  The postdeps already come after the\n\t   # user supplied libs so there is no need to process them.\n\t   if test -z \"$compiler_lib_search_path_CXX\"; then\n\t     compiler_lib_search_path_CXX=\"${prev}${p}\"\n\t   else\n\t     compiler_lib_search_path_CXX=\"${compiler_lib_search_path_CXX} ${prev}${p}\"\n\t   fi\n\t   ;;\n\t # The \"-l\" case would never come before the object being\n\t # linked, so don't bother handling this case.\n\t esac\n       else\n\t if test -z \"$postdeps_CXX\"; then\n\t   postdeps_CXX=\"${prev}${p}\"\n\t else\n\t   postdeps_CXX=\"${postdeps_CXX} ${prev}${p}\"\n\t fi\n       fi\n       prev=\n       ;;\n\n    *.lto.$objext) ;; # Ignore GCC LTO objects\n    *.$objext)\n       # This assumes that the test object file only shows up\n       # once in the compiler output.\n       if test \"$p\" = \"conftest.$objext\"; then\n\t pre_test_object_deps_done=yes\n\t continue\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t if test -z \"$predep_objects_CXX\"; then\n\t   predep_objects_CXX=\"$p\"\n\t else\n\t   predep_objects_CXX=\"$predep_objects_CXX $p\"\n\t fi\n       else\n\t if test -z \"$postdep_objects_CXX\"; then\n\t   postdep_objects_CXX=\"$p\"\n\t else\n\t   postdep_objects_CXX=\"$postdep_objects_CXX $p\"\n\t fi\n       fi\n       ;;\n\n    *) ;; # Ignore the rest.\n\n    esac\n  done\n\n  # Clean up.\n  rm -f a.out a.exe\nelse\n  echo \"libtool.m4: error: problem compiling CXX test program\"\nfi\n\n$RM -f confest.$objext\nCFLAGS=$_lt_libdeps_save_CFLAGS\n\n# PORTME: override above test on systems where it is broken\ncase $host_os in\ninterix[3-9]*)\n  # Interix 3.5 installs completely hosed .la files for C++, so rather than\n  # hack all around it, let's just trust \"g++\" to DTRT.\n  predep_objects_CXX=\n  postdep_objects_CXX=\n  postdeps_CXX=\n  ;;\n\nlinux*)\n  case `$CC -V 2>&1 | sed 5q` in\n  *Sun\\ C*)\n    # Sun C++ 5.9\n\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    if test \"$solaris_use_stlport4\" != yes; then\n      postdeps_CXX='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\n\nsolaris*)\n  case $cc_basename in\n  CC* | sunCC*)\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    # Adding this requires a known-good setup of shared libraries for\n    # Sun compiler versions before 5.6, else PIC objects from an old\n    # archive will be linked into the output, leading to subtle bugs.\n    if test \"$solaris_use_stlport4\" != yes; then\n      postdeps_CXX='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\nesac\n\n\ncase \" $postdeps_CXX \" in\n*\" -lc \"*) archive_cmds_need_lc_CXX=no ;;\nesac\n compiler_lib_search_dirs_CXX=\nif test -n \"${compiler_lib_search_path_CXX}\"; then\n compiler_lib_search_dirs_CXX=`echo \" ${compiler_lib_search_path_CXX}\" | ${SED} -e 's! -L! !g' -e 's!^ !!'`\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    lt_prog_compiler_wl_CXX=\nlt_prog_compiler_pic_CXX=\nlt_prog_compiler_static_CXX=\n\n\n  # C++ specific cases for pic, static, wl, etc.\n  if test \"$GXX\" = yes; then\n    lt_prog_compiler_wl_CXX='-Wl,'\n    lt_prog_compiler_static_CXX='-static'\n\n    case $host_os in\n    aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\tlt_prog_compiler_static_CXX='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            lt_prog_compiler_pic_CXX='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n    mingw* | cygwin* | os2* | pw32* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'\n      ;;\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      lt_prog_compiler_pic_CXX='-fno-common'\n      ;;\n    *djgpp*)\n      # DJGPP does not support shared libraries at all\n      lt_prog_compiler_pic_CXX=\n      ;;\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      lt_prog_compiler_static_CXX=\n      ;;\n    interix[3-9]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\tlt_prog_compiler_pic_CXX=-Kconform_pic\n      fi\n      ;;\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t;;\n      *)\n\tlt_prog_compiler_pic_CXX='-fPIC'\n\t;;\n      esac\n      ;;\n    *qnx* | *nto*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      lt_prog_compiler_pic_CXX='-fPIC -shared'\n      ;;\n    *)\n      lt_prog_compiler_pic_CXX='-fPIC'\n      ;;\n    esac\n  else\n    case $host_os in\n      aix[4-9]*)\n\t# All AIX code is PIC.\n\tif test \"$host_cpu\" = ia64; then\n\t  # AIX 5 now supports IA64 processor\n\t  lt_prog_compiler_static_CXX='-Bstatic'\n\telse\n\t  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'\n\tfi\n\t;;\n      chorus*)\n\tcase $cc_basename in\n\tcxch68*)\n\t  # Green Hills C++ Compiler\n\t  # _LT_TAGVAR(lt_prog_compiler_static, CXX)=\"--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a\"\n\t  ;;\n\tesac\n\t;;\n      mingw* | cygwin* | os2* | pw32* | cegcc*)\n\t# This hack is so that the source file can tell whether it is being\n\t# built for inclusion in a dll (and should export symbols for example).\n\tlt_prog_compiler_pic_CXX='-DDLL_EXPORT'\n\t;;\n      dgux*)\n\tcase $cc_basename in\n\t  ec++*)\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    ;;\n\t  ghcx*)\n\t    # Green Hills C++ Compiler\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      freebsd* | dragonfly*)\n\t# FreeBSD uses GNU C++\n\t;;\n      hpux9* | hpux10* | hpux11*)\n\tcase $cc_basename in\n\t  CC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'\n\t    if test \"$host_cpu\" != ia64; then\n\t      lt_prog_compiler_pic_CXX='+Z'\n\t    fi\n\t    ;;\n\t  aCC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'\n\t    case $host_cpu in\n\t    hppa*64*|ia64*)\n\t      # +Z the default\n\t      ;;\n\t    *)\n\t      lt_prog_compiler_pic_CXX='+Z'\n\t      ;;\n\t    esac\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      interix*)\n\t# This is c89, which is MS Visual C++ (no shared libs)\n\t# Anyone wants to do a port?\n\t;;\n      irix5* | irix6* | nonstopux*)\n\tcase $cc_basename in\n\t  CC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_static_CXX='-non_shared'\n\t    # CC pic flag -KPIC is the default.\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n\tcase $cc_basename in\n\t  KCC*)\n\t    # KAI C++ Compiler\n\t    lt_prog_compiler_wl_CXX='--backend -Wl,'\n\t    lt_prog_compiler_pic_CXX='-fPIC'\n\t    ;;\n\t  ecpc* )\n\t    # old Intel C++ for x86_64 which still supported -KPIC.\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    lt_prog_compiler_static_CXX='-static'\n\t    ;;\n\t  icpc* )\n\t    # Intel C++, used to be incompatible with GCC.\n\t    # ICC 10 doesn't accept -KPIC any more.\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-fPIC'\n\t    lt_prog_compiler_static_CXX='-static'\n\t    ;;\n\t  pgCC* | pgcpp*)\n\t    # Portland Group C++ compiler\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-fpic'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    lt_prog_compiler_pic_CXX=\n\t    lt_prog_compiler_static_CXX='-non_shared'\n\t    ;;\n\t  xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)\n\t    # IBM XL 8.0, 9.0 on PPC and BlueGene\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-qpic'\n\t    lt_prog_compiler_static_CXX='-qstaticlink'\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      lt_prog_compiler_pic_CXX='-KPIC'\n\t      lt_prog_compiler_static_CXX='-Bstatic'\n\t      lt_prog_compiler_wl_CXX='-Qoption ld '\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n      lynxos*)\n\t;;\n      m88k*)\n\t;;\n      mvs*)\n\tcase $cc_basename in\n\t  cxx*)\n\t    lt_prog_compiler_pic_CXX='-W c,exportall'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      netbsd* | netbsdelf*-gnu)\n\t;;\n      *qnx* | *nto*)\n        # QNX uses GNU C++, but need to define -shared option too, otherwise\n        # it will coredump.\n        lt_prog_compiler_pic_CXX='-fPIC -shared'\n        ;;\n      osf3* | osf4* | osf5*)\n\tcase $cc_basename in\n\t  KCC*)\n\t    lt_prog_compiler_wl_CXX='--backend -Wl,'\n\t    ;;\n\t  RCC*)\n\t    # Rational C++ 2.4.1\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    ;;\n\t  cxx*)\n\t    # Digital/Compaq C++\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    lt_prog_compiler_pic_CXX=\n\t    lt_prog_compiler_static_CXX='-non_shared'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      psos*)\n\t;;\n      solaris*)\n\tcase $cc_basename in\n\t  CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    lt_prog_compiler_wl_CXX='-Qoption ld '\n\t    ;;\n\t  gcx*)\n\t    # Green Hills C++ Compiler\n\t    lt_prog_compiler_pic_CXX='-PIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sunos4*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.x\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    ;;\n\t  lcc*)\n\t    # Lucid\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n\tcase $cc_basename in\n\t  CC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    ;;\n\tesac\n\t;;\n      tandem*)\n\tcase $cc_basename in\n\t  NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      vxworks*)\n\t;;\n      *)\n\tlt_prog_compiler_can_build_shared_CXX=no\n\t;;\n    esac\n  fi\n\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    lt_prog_compiler_pic_CXX=\n    ;;\n  *)\n    lt_prog_compiler_pic_CXX=\"$lt_prog_compiler_pic_CXX -DPIC\"\n    ;;\nesac\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC\" >&5\n$as_echo_n \"checking for $compiler option to produce PIC... \" >&6; }\nif ${lt_cv_prog_compiler_pic_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_pic_CXX\" >&6; }\nlt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$lt_prog_compiler_pic_CXX\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works\" >&5\n$as_echo_n \"checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... \" >&6; }\nif ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_pic_works_CXX=no\n   ac_outfile=conftest.$ac_objext\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$lt_prog_compiler_pic_CXX -DPIC\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_pic_works_CXX=yes\n     fi\n   fi\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_pic_works_CXX\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_pic_works_CXX\" = xyes; then\n    case $lt_prog_compiler_pic_CXX in\n     \"\" | \" \"*) ;;\n     *) lt_prog_compiler_pic_CXX=\" $lt_prog_compiler_pic_CXX\" ;;\n     esac\nelse\n    lt_prog_compiler_pic_CXX=\n     lt_prog_compiler_can_build_shared_CXX=no\nfi\n\nfi\n\n\n\n\n\n#\n# Check to make sure the static flag actually works.\n#\nwl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\\\"$lt_prog_compiler_static_CXX\\\"\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works\" >&5\n$as_echo_n \"checking if $compiler static flag $lt_tmp_static_flag works... \" >&6; }\nif ${lt_cv_prog_compiler_static_works_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_static_works_CXX=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $lt_tmp_static_flag\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&5\n       $ECHO \"$_lt_linker_boilerplate\" | $SED '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         lt_cv_prog_compiler_static_works_CXX=yes\n       fi\n     else\n       lt_cv_prog_compiler_static_works_CXX=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_static_works_CXX\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_static_works_CXX\" = xyes; then\n    :\nelse\n    lt_prog_compiler_static_CXX=\nfi\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif ${lt_cv_prog_compiler_c_o_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o_CXX=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o_CXX=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o_CXX\" >&6; }\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif ${lt_cv_prog_compiler_c_o_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o_CXX=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o_CXX=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o_CXX\" >&6; }\n\n\n\n\nhard_links=\"nottested\"\nif test \"$lt_cv_prog_compiler_c_o_CXX\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links\" >&5\n$as_echo_n \"checking if we can lock with hard links... \" >&6; }\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hard_links\" >&5\n$as_echo \"$hard_links\" >&6; }\n  if test \"$hard_links\" = no; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&5\n$as_echo \"$as_me: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&2;}\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries\" >&5\n$as_echo_n \"checking whether the $compiler linker ($LD) supports shared libraries... \" >&6; }\n\n  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'\n  case $host_os in\n  aix[4-9]*)\n    # If we're using GNU nm, then we don't want the \"-C\" option.\n    # -C means demangle to AIX nm, but means don't demangle with GNU nm\n    # Also, AIX nm treats weak defined symbols like other global defined\n    # symbols, whereas GNU nm marks them as \"W\".\n    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    else\n      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    fi\n    ;;\n  pw32*)\n    export_symbols_cmds_CXX=\"$ltdll_cmds\"\n    ;;\n  cygwin* | mingw* | cegcc*)\n    case $cc_basename in\n    cl*)\n      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'\n      ;;\n    *)\n      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[BCDGRS][ ]/s/.*[ ]\\([^ ]*\\)/\\1 DATA/;s/^.*[ ]__nm__\\([^ ]*\\)[ ][^ ]*/\\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'\n      ;;\n    esac\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    link_all_deplibs_CXX=no\n    ;;\n  *)\n    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n    ;;\n  esac\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX\" >&5\n$as_echo \"$ld_shlibs_CXX\" >&6; }\ntest \"$ld_shlibs_CXX\" = no && can_build_shared=no\n\nwith_gnu_ld_CXX=$with_gnu_ld\n\n\n\n\n\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$archive_cmds_need_lc_CXX\" in\nx|xyes)\n  # Assume -lc should be added\n  archive_cmds_need_lc_CXX=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $archive_cmds_CXX in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in\" >&5\n$as_echo_n \"checking whether -lc should be explicitly linked in... \" >&6; }\nif ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  $RM conftest*\n\techo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n\tif { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } 2>conftest.err; then\n\t  soname=conftest\n\t  lib=conftest\n\t  libobjs=conftest.$ac_objext\n\t  deplibs=\n\t  wl=$lt_prog_compiler_wl_CXX\n\t  pic_flag=$lt_prog_compiler_pic_CXX\n\t  compiler_flags=-v\n\t  linker_flags=-v\n\t  verstring=\n\t  output_objdir=.\n\t  libname=conftest\n\t  lt_save_allow_undefined_flag=$allow_undefined_flag_CXX\n\t  allow_undefined_flag_CXX=\n\t  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$archive_cmds_CXX 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1\\\"\"; } >&5\n  (eval $archive_cmds_CXX 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n\t  then\n\t    lt_cv_archive_cmds_need_lc_CXX=no\n\t  else\n\t    lt_cv_archive_cmds_need_lc_CXX=yes\n\t  fi\n\t  allow_undefined_flag_CXX=$lt_save_allow_undefined_flag\n\telse\n\t  cat conftest.err 1>&5\n\tfi\n\t$RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX\" >&5\n$as_echo \"$lt_cv_archive_cmds_need_lc_CXX\" >&6; }\n      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics\" >&5\n$as_echo_n \"checking dynamic linker characteristics... \" >&6; }\n\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[4-9]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[01] | aix4.[01].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all \"$lib\" | $SED '\\''s%^.*/\\([^/]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[45]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$cc_basename in\n  yes,*)\n    # gcc\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    dynamic_linker='Win32 ld.exe'\n    ;;\n\n  *,cl*)\n    # Native MSVC\n    libname_spec='$name'\n    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n    library_names_spec='${libname}.dll.lib'\n\n    case $build_os in\n    mingw*)\n      sys_lib_search_path_spec=\n      lt_save_ifs=$IFS\n      IFS=';'\n      for lt_path in $LIB\n      do\n        IFS=$lt_save_ifs\n        # Let DOS variable expansion print the short 8.3 style file name.\n        lt_path=`cd \"$lt_path\" 2>/dev/null && cmd //C \"for %i in (\".\") do @echo %~si\"`\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec $lt_path\"\n      done\n      IFS=$lt_save_ifs\n      # Convert to MSYS style.\n      sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | sed -e 's|\\\\\\\\|/|g' -e 's| \\\\([a-zA-Z]\\\\):| /\\\\1|g' -e 's|^ ||'`\n      ;;\n    cygwin*)\n      # Convert to unix form, then to dos form, then back to unix form\n      # but this time dos style (no spaces!) so that the unix form looks\n      # like /cygdrive/c/PROGRA~1:/cygdr...\n      sys_lib_search_path_spec=`cygpath --path --unix \"$LIB\"`\n      sys_lib_search_path_spec=`cygpath --path --dos \"$sys_lib_search_path_spec\" 2>/dev/null`\n      sys_lib_search_path_spec=`cygpath --path --unix \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      ;;\n    *)\n      sys_lib_search_path_spec=\"$LIB\"\n      if $ECHO \"$sys_lib_search_path_spec\" | $GREP ';[c-zC-Z]:/' >/dev/null; then\n        # It is most probably a Windows format PATH.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      # FIXME: find the short name or the path components, as spaces are\n      # common. (e.g. \"Program Files\" -> \"PROGRA~1\")\n      ;;\n    esac\n\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n    dynamic_linker='Win32 link.exe'\n    ;;\n\n  *)\n    # Assume MSVC wrapper\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    dynamic_linker='Win32 ld.exe'\n    ;;\n  esac\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\n\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[23].*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2.*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[01]* | freebsdelf3.[01]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \\\n  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nhaiku*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  dynamic_linker=\"$host_os runtime_loader\"\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...\n  postinstall_cmds='chmod 555 $lib'\n  # or fails outright, so override atomically:\n  install_override_mode=555\n  ;;\n\ninterix[3-9]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux # correct to gnu/linux during the next big refactor\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be glibc/ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n\n  # Some binutils ld are patched to set DT_RUNPATH\n  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_shlibpath_overrides_runpath=no\n    save_LDFLAGS=$LDFLAGS\n    save_libdir=$libdir\n    eval \"libdir=/foo; wl=\\\"$lt_prog_compiler_wl_CXX\\\"; \\\n\t LDFLAGS=\\\"\\$LDFLAGS $hardcode_libdir_flag_spec_CXX\\\"\"\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_link \"$LINENO\"; then :\n  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null; then :\n  lt_cv_shlibpath_overrides_runpath=yes\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n    LDFLAGS=$save_LDFLAGS\n    libdir=$save_libdir\n\nfi\n\n  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\$2)); skip = 1; } { if (!skip) print \\$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/\"//g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsdelf*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='NetBSD ld.elf_so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[89] | openbsd2.[89].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux # correct to gnu/linux during the next big refactor\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $dynamic_linker\" >&5\n$as_echo \"$dynamic_linker\" >&6; }\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs\" >&5\n$as_echo_n \"checking how to hardcode library paths into programs... \" >&6; }\nhardcode_action_CXX=\nif test -n \"$hardcode_libdir_flag_spec_CXX\" ||\n   test -n \"$runpath_var_CXX\" ||\n   test \"X$hardcode_automatic_CXX\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$hardcode_direct_CXX\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, CXX)\" != no &&\n     test \"$hardcode_minus_L_CXX\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    hardcode_action_CXX=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    hardcode_action_CXX=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  hardcode_action_CXX=unsupported\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX\" >&5\n$as_echo \"$hardcode_action_CXX\" >&6; }\n\nif test \"$hardcode_action_CXX\" = relink ||\n   test \"$inherit_rpath_CXX\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n\n\n\n\n\n\n\n  fi # test -n \"$compiler\"\n\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\n  LDCXX=$LD\n  LD=$lt_save_LD\n  GCC=$lt_save_GCC\n  with_gnu_ld=$lt_save_with_gnu_ld\n  lt_cv_path_LDCXX=$lt_cv_path_LD\n  lt_cv_path_LD=$lt_save_path_LD\n  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld\n  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld\nfi # test \"$_lt_caught_CXX_error\" != yes\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n        ac_config_commands=\"$ac_config_commands libtool\"\n\n\n\n\n# Only expand once:\n\n\n\n# TODO(chandlerc@google.com): Currently we aren't running the Python tests\n# against the interpreter detected by AM_PATH_PYTHON, and so we condition\n# HAVE_PYTHON by requiring \"python\" to be in the PATH, and that interpreter's\n# version to be >= 2.3. This will allow the scripts to use a \"/usr/bin/env\"\n# hashbang.\nPYTHON=  # We *do not* allow the user to specify a python interpreter\n# Extract the first word of \"python\", so it can be a program name with args.\nset dummy python; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_path_PYTHON+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  case $PYTHON in\n  [\\\\/]* | ?:[\\\\/]*)\n  ac_cv_path_PYTHON=\"$PYTHON\" # Let the user override the test with a path.\n  ;;\n  *)\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_path_PYTHON=\"$as_dir/$ac_word$ac_exec_ext\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\n  test -z \"$ac_cv_path_PYTHON\" && ac_cv_path_PYTHON=\":\"\n  ;;\nesac\nfi\nPYTHON=$ac_cv_path_PYTHON\nif test -n \"$PYTHON\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $PYTHON\" >&5\n$as_echo \"$PYTHON\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nif test \"$PYTHON\" != \":\"; then :\n  prog=\"import sys\n# split strings by '.' and convert to numeric.  Append some zeros\n# because we need at least 4 digits for the hex conversion.\n# map returns an iterator in Python 3.0 and a list in 2.x\nminver = list(map(int, '2.3'.split('.'))) + [0, 0, 0]\nminverhex = 0\n# xrange is not present in Python 3.0 and range returns an iterator\nfor i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]\nsys.exit(sys.hexversion < minverhex)\"\n  if { echo \"$as_me:$LINENO: $PYTHON -c \"$prog\"\" >&5\n   ($PYTHON -c \"$prog\") >&5 2>&5\n   ac_status=$?\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&5\n   (exit $ac_status); }; then :\n  :\nelse\n  PYTHON=\":\"\nfi\nfi\n if test \"$PYTHON\" != \":\"; then\n  HAVE_PYTHON_TRUE=\n  HAVE_PYTHON_FALSE='#'\nelse\n  HAVE_PYTHON_TRUE='#'\n  HAVE_PYTHON_FALSE=\nfi\n\n\n# Configure pthreads.\n\n# Check whether --with-pthreads was given.\nif test \"${with_pthreads+set}\" = set; then :\n  withval=$with_pthreads; with_pthreads=$withval\nelse\n  with_pthreads=check\nfi\n\n\nhave_pthreads=no\nif test \"x$with_pthreads\" != \"xno\"; then :\n\n\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nacx_pthread_ok=no\n\n# We used to check for pthread.h first, but this fails if pthread.h\n# requires special compiler flags (e.g. on True64 or Sequent).\n# It gets checked for in the link test anyway.\n\n# First of all, check if the user has set any of the PTHREAD_LIBS,\n# etcetera environment variables, and if threads linking works using\n# them:\nif test x\"$PTHREAD_LIBS$PTHREAD_CFLAGS\" != x; then\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS\" >&5\n$as_echo_n \"checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... \" >&6; }\n        cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar pthread_join ();\nint\nmain ()\n{\nreturn pthread_join ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  acx_pthread_ok=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok\" >&5\n$as_echo \"$acx_pthread_ok\" >&6; }\n        if test x\"$acx_pthread_ok\" = xno; then\n                PTHREAD_LIBS=\"\"\n                PTHREAD_CFLAGS=\"\"\n        fi\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\nfi\n\n# We must check for the threads library under a number of different\n# names; the ordering is very important because some systems\n# (e.g. DEC) have both -lpthread and -lpthreads, where one of the\n# libraries is broken (non-POSIX).\n\n# Create a list of thread flags to try.  Items starting with a \"-\" are\n# C compiler flags, and other items are library names, except for \"none\"\n# which indicates that we try without any flags at all, and \"pthread-config\"\n# which is a program returning the flags for the Pth emulation library.\n\nacx_pthread_flags=\"pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config\"\n\n# The ordering *is* (sometimes) important.  Some notes on the\n# individual items follow:\n\n# pthreads: AIX (must check this before -lpthread)\n# none: in case threads are in libc; should be tried before -Kthread and\n#       other compiler flags to prevent continual compiler warnings\n# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)\n# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)\n# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)\n# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)\n# -pthreads: Solaris/gcc\n# -mthreads: Mingw32/gcc, Lynx/gcc\n# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it\n#      doesn't hurt to check since this sometimes defines pthreads too;\n#      also defines -D_REENTRANT)\n#      ... -mt is also the pthreads flag for HP/aCC\n# pthread: Linux, etcetera\n# --thread-safe: KAI C++\n# pthread-config: use pthread-config program (for GNU Pth library)\n\ncase \"${host_cpu}-${host_os}\" in\n        *solaris*)\n\n        # On Solaris (at least, for some versions), libc contains stubbed\n        # (non-functional) versions of the pthreads routines, so link-based\n        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/\n        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather\n        # a function called by this macro, so we could check for that, but\n        # who knows whether they'll stub that too in a future libc.)  So,\n        # we'll just look for -pthreads and -lpthread first:\n\n        acx_pthread_flags=\"-pthreads pthread -mt -pthread $acx_pthread_flags\"\n        ;;\nesac\n\nif test x\"$acx_pthread_ok\" = xno; then\nfor flag in $acx_pthread_flags; do\n\n        case $flag in\n                none)\n                { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags\" >&5\n$as_echo_n \"checking whether pthreads work without any flags... \" >&6; }\n                ;;\n\n                -*)\n                { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag\" >&5\n$as_echo_n \"checking whether pthreads work with $flag... \" >&6; }\n                PTHREAD_CFLAGS=\"$flag\"\n                ;;\n\n\t\tpthread-config)\n\t\t# Extract the first word of \"pthread-config\", so it can be a program name with args.\nset dummy pthread-config; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_acx_pthread_config+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$acx_pthread_config\"; then\n  ac_cv_prog_acx_pthread_config=\"$acx_pthread_config\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_acx_pthread_config=\"yes\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\n  test -z \"$ac_cv_prog_acx_pthread_config\" && ac_cv_prog_acx_pthread_config=\"no\"\nfi\nfi\nacx_pthread_config=$ac_cv_prog_acx_pthread_config\nif test -n \"$acx_pthread_config\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config\" >&5\n$as_echo \"$acx_pthread_config\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n\t\tif test x\"$acx_pthread_config\" = xno; then continue; fi\n\t\tPTHREAD_CFLAGS=\"`pthread-config --cflags`\"\n\t\tPTHREAD_LIBS=\"`pthread-config --ldflags` `pthread-config --libs`\"\n\t\t;;\n\n                *)\n                { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag\" >&5\n$as_echo_n \"checking for the pthreads library -l$flag... \" >&6; }\n                PTHREAD_LIBS=\"-l$flag\"\n                ;;\n        esac\n\n        save_LIBS=\"$LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Check for various functions.  We must include pthread.h,\n        # since some functions may be macros.  (On the Sequent, we\n        # need a special flag -Kthread to make this header compile.)\n        # We check for pthread_join because it is in -lpthread on IRIX\n        # while pthread_create is in libc.  We check for pthread_attr_init\n        # due to DEC craziness with -lpthreads.  We check for\n        # pthread_cleanup_push because it is one of the few pthread\n        # functions on Solaris that doesn't have a non-functional libc stub.\n        # We try pthread_create on general principles.\n        cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\npthread_t th; pthread_join(th, 0);\n                     pthread_attr_init(0); pthread_cleanup_push(0, 0);\n                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  acx_pthread_ok=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok\" >&5\n$as_echo \"$acx_pthread_ok\" >&6; }\n        if test \"x$acx_pthread_ok\" = xyes; then\n                break;\n        fi\n\n        PTHREAD_LIBS=\"\"\n        PTHREAD_CFLAGS=\"\"\ndone\nfi\n\n# Various other checks:\nif test \"x$acx_pthread_ok\" = xyes; then\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute\" >&5\n$as_echo_n \"checking for joinable pthread attribute... \" >&6; }\n\tattr_name=unknown\n\tfor attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do\n\t    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\nint attr=$attr; return attr;\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  attr_name=$attr; break\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\tdone\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $attr_name\" >&5\n$as_echo \"$attr_name\" >&6; }\n        if test \"$attr_name\" != PTHREAD_CREATE_JOINABLE; then\n\ncat >>confdefs.h <<_ACEOF\n#define PTHREAD_CREATE_JOINABLE $attr_name\n_ACEOF\n\n        fi\n\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads\" >&5\n$as_echo_n \"checking if more special flags are required for pthreads... \" >&6; }\n        flag=no\n        case \"${host_cpu}-${host_os}\" in\n            *-aix* | *-freebsd* | *-darwin*) flag=\"-D_THREAD_SAFE\";;\n            *solaris* | *-osf* | *-hpux*) flag=\"-D_REENTRANT\";;\n        esac\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: ${flag}\" >&5\n$as_echo \"${flag}\" >&6; }\n        if test \"x$flag\" != xno; then\n            PTHREAD_CFLAGS=\"$flag $PTHREAD_CFLAGS\"\n        fi\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n        # More AIX lossage: must compile with xlc_r or cc_r\n\tif test x\"$GCC\" != xyes; then\n          for ac_prog in xlc_r cc_r\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif ${ac_cv_prog_PTHREAD_CC+:} false; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$PTHREAD_CC\"; then\n  ac_cv_prog_PTHREAD_CC=\"$PTHREAD_CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_PTHREAD_CC=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nPTHREAD_CC=$ac_cv_prog_PTHREAD_CC\nif test -n \"$PTHREAD_CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC\" >&5\n$as_echo \"$PTHREAD_CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$PTHREAD_CC\" && break\ndone\ntest -n \"$PTHREAD_CC\" || PTHREAD_CC=\"${CC}\"\n\n        else\n          PTHREAD_CC=$CC\n\tfi\n\n\t# The next part tries to detect GCC inconsistency with -shared on some\n\t# architectures and systems. The problem is that in certain\n\t# configurations, when -shared is specified, GCC \"forgets\" to\n\t# internally use various flags which are still necessary.\n\n\t#\n\t# Prepare the flags\n\t#\n\tsave_CFLAGS=\"$CFLAGS\"\n\tsave_LIBS=\"$LIBS\"\n\tsave_CC=\"$CC\"\n\n\t# Try with the flags determined by the earlier checks.\n\t#\n\t# -Wl,-z,defs forces link-time symbol resolution, so that the\n\t# linking checks with -shared actually have any value\n\t#\n\t# FIXME: -fPIC is required for -shared on many architectures,\n\t# so we specify it here, but the right way would probably be to\n\t# properly detect whether it is actually required.\n\tCFLAGS=\"-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS\"\n\tLIBS=\"$PTHREAD_LIBS $LIBS\"\n\tCC=\"$PTHREAD_CC\"\n\n\t# In order not to create several levels of indentation, we test\n\t# the value of \"$done\" until we find the cure or run out of ideas.\n\tdone=\"no\"\n\n\t# First, make sure the CFLAGS we added are actually accepted by our\n\t# compiler.  If not (and OS X's ld, for instance, does not accept -z),\n\t# then we can't do this test.\n\tif test x\"$done\" = xno; then\n\t   { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether to check for GCC pthread/shared inconsistencies\" >&5\n$as_echo_n \"checking whether to check for GCC pthread/shared inconsistencies... \" >&6; }\n\t   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n\nelse\n  done=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n\t   if test \"x$done\" = xyes ; then\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n\t   else\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\t   fi\n\tfi\n\n\tif test x\"$done\" = xno; then\n\t   { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -pthread is sufficient with -shared\" >&5\n$as_echo_n \"checking whether -pthread is sufficient with -shared... \" >&6; }\n\t   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\npthread_t th; pthread_join(th, 0);\n\t      pthread_attr_init(0); pthread_cleanup_push(0, 0);\n\t      pthread_create(0,0,0,0); pthread_cleanup_pop(0);\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  done=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n\t   if test \"x$done\" = xyes; then\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\t   else\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n\t   fi\n\tfi\n\n\t#\n\t# Linux gcc on some architectures such as mips/mipsel forgets\n\t# about -lpthread\n\t#\n\tif test x\"$done\" = xno; then\n\t   { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -lpthread fixes that\" >&5\n$as_echo_n \"checking whether -lpthread fixes that... \" >&6; }\n\t   LIBS=\"-lpthread $PTHREAD_LIBS $save_LIBS\"\n\t   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\npthread_t th; pthread_join(th, 0);\n\t      pthread_attr_init(0); pthread_cleanup_push(0, 0);\n\t      pthread_create(0,0,0,0); pthread_cleanup_pop(0);\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  done=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n\t   if test \"x$done\" = xyes; then\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\t      PTHREAD_LIBS=\"-lpthread $PTHREAD_LIBS\"\n\t   else\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n\t   fi\n\tfi\n\t#\n\t# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc\n\t#\n\tif test x\"$done\" = xno; then\n\t   { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -lc_r fixes that\" >&5\n$as_echo_n \"checking whether -lc_r fixes that... \" >&6; }\n\t   LIBS=\"-lc_r $PTHREAD_LIBS $save_LIBS\"\n\t   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\npthread_t th; pthread_join(th, 0);\n\t        pthread_attr_init(0); pthread_cleanup_push(0, 0);\n\t        pthread_create(0,0,0,0); pthread_cleanup_pop(0);\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  done=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n\t   if test \"x$done\" = xyes; then\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\t      PTHREAD_LIBS=\"-lc_r $PTHREAD_LIBS\"\n\t   else\n\t      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n\t   fi\n\tfi\n\tif test x\"$done\" = xno; then\n\t   # OK, we have run out of ideas\n\t   { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: Impossible to determine how to use pthreads with shared libraries\" >&5\n$as_echo \"$as_me: WARNING: Impossible to determine how to use pthreads with shared libraries\" >&2;}\n\n\t   # so it's not safe to assume that we may use pthreads\n\t   acx_pthread_ok=no\n\tfi\n\n\tCFLAGS=\"$save_CFLAGS\"\n\tLIBS=\"$save_LIBS\"\n\tCC=\"$save_CC\"\nelse\n        PTHREAD_CC=\"$CC\"\nfi\n\n\n\n\n\n# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:\nif test x\"$acx_pthread_ok\" = xyes; then\n\n$as_echo \"#define HAVE_PTHREAD 1\" >>confdefs.h\n\n        :\nelse\n        acx_pthread_ok=no\n        if test \"x$with_pthreads\" != \"xcheck\"; then :\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error $? \"--with-pthreads was specified, but unable to be used\nSee \\`config.log' for more details\" \"$LINENO\" 5; }\nfi\nfi\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\n\n       have_pthreads=\"$acx_pthread_ok\"\nfi\n if test \"x$have_pthreads\" = \"xyes\"; then\n  HAVE_PTHREADS_TRUE=\n  HAVE_PTHREADS_FALSE='#'\nelse\n  HAVE_PTHREADS_TRUE='#'\n  HAVE_PTHREADS_FALSE=\nfi\n\n\n\n\n# TODO(chandlerc@google.com) Check for the necessary system headers.\n\n# TODO(chandlerc@google.com) Check the types, structures, and other compiler\n# and architecture characteristics.\n\n# Output the generated files. No further autoconf macros may be used.\ncat >confcache <<\\_ACEOF\n# This file is a shell script that caches the results of configure\n# tests run on this system so they can be shared between configure\n# scripts and configure runs, see configure's option --config-cache.\n# It is not useful on other systems.  If it contains results you don't\n# want to keep, you may remove or edit it.\n#\n# config.status only pays attention to the cache file if you give it\n# the --recheck option to rerun configure.\n#\n# `ac_cv_env_foo' variables (set or unset) will be overridden when\n# loading this file, other *unset* `ac_cv_foo' will be assigned the\n# following values.\n\n_ACEOF\n\n# The following way of writing the cache mishandles newlines in values,\n# but we know of no workaround that is simple, portable, and efficient.\n# So, we kill variables containing newlines.\n# Ultrix sh set writes to stderr and can't be redirected directly,\n# and sets the high bit in the cache file unless we assign to the vars.\n(\n  for ac_var in `(set) 2>&1 | sed -n 's/^\\([a-zA-Z_][a-zA-Z0-9_]*\\)=.*/\\1/p'`; do\n    eval ac_val=\\$$ac_var\n    case $ac_val in #(\n    *${as_nl}*)\n      case $ac_var in #(\n      *_cv_*) { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline\" >&5\n$as_echo \"$as_me: WARNING: cache variable $ac_var contains a newline\" >&2;} ;;\n      esac\n      case $ac_var in #(\n      _ | IFS | as_nl) ;; #(\n      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(\n      *) { eval $ac_var=; unset $ac_var;} ;;\n      esac ;;\n    esac\n  done\n\n  (set) 2>&1 |\n    case $as_nl`(ac_space=' '; set) 2>&1` in #(\n    *${as_nl}ac_space=\\ *)\n      # `set' does not quote correctly, so add quotes: double-quote\n      # substitution turns \\\\\\\\ into \\\\, and sed turns \\\\ into \\.\n      sed -n \\\n\t\"s/'/'\\\\\\\\''/g;\n\t  s/^\\\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\\\)=\\\\(.*\\\\)/\\\\1='\\\\2'/p\"\n      ;; #(\n    *)\n      # `set' quotes correctly as required by POSIX, so do not add quotes.\n      sed -n \"/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p\"\n      ;;\n    esac |\n    sort\n) |\n  sed '\n     /^ac_cv_env_/b end\n     t clear\n     :clear\n     s/^\\([^=]*\\)=\\(.*[{}].*\\)$/test \"${\\1+set}\" = set || &/\n     t end\n     s/^\\([^=]*\\)=\\(.*\\)$/\\1=${\\1=\\2}/\n     :end' >>confcache\nif diff \"$cache_file\" confcache >/dev/null 2>&1; then :; else\n  if test -w \"$cache_file\"; then\n    if test \"x$cache_file\" != \"x/dev/null\"; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: updating cache $cache_file\" >&5\n$as_echo \"$as_me: updating cache $cache_file\" >&6;}\n      if test ! -f \"$cache_file\" || test -h \"$cache_file\"; then\n\tcat confcache >\"$cache_file\"\n      else\n        case $cache_file in #(\n        */* | ?:*)\n\t  mv -f confcache \"$cache_file\"$$ &&\n\t  mv -f \"$cache_file\"$$ \"$cache_file\" ;; #(\n        *)\n\t  mv -f confcache \"$cache_file\" ;;\n\tesac\n      fi\n    fi\n  else\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file\" >&5\n$as_echo \"$as_me: not updating unwritable cache $cache_file\" >&6;}\n  fi\nfi\nrm -f confcache\n\ntest \"x$prefix\" = xNONE && prefix=$ac_default_prefix\n# Let make expand exec_prefix.\ntest \"x$exec_prefix\" = xNONE && exec_prefix='${prefix}'\n\nDEFS=-DHAVE_CONFIG_H\n\nac_libobjs=\nac_ltlibobjs=\nU=\nfor ac_i in : $LIBOBJS; do test \"x$ac_i\" = x: && continue\n  # 1. Remove the extension, and $U if already installed.\n  ac_script='s/\\$U\\././;s/\\.o$//;s/\\.obj$//'\n  ac_i=`$as_echo \"$ac_i\" | sed \"$ac_script\"`\n  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR\n  #    will be set to the directory where LIBOBJS objects are built.\n  as_fn_append ac_libobjs \" \\${LIBOBJDIR}$ac_i\\$U.$ac_objext\"\n  as_fn_append ac_ltlibobjs \" \\${LIBOBJDIR}$ac_i\"'$U.lo'\ndone\nLIBOBJS=$ac_libobjs\n\nLTLIBOBJS=$ac_ltlibobjs\n\n\n if test -n \"$EXEEXT\"; then\n  am__EXEEXT_TRUE=\n  am__EXEEXT_FALSE='#'\nelse\n  am__EXEEXT_TRUE='#'\n  am__EXEEXT_FALSE=\nfi\n\nif test -z \"${AMDEP_TRUE}\" && test -z \"${AMDEP_FALSE}\"; then\n  as_fn_error $? \"conditional \\\"AMDEP\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${am__fastdepCC_TRUE}\" && test -z \"${am__fastdepCC_FALSE}\"; then\n  as_fn_error $? \"conditional \\\"am__fastdepCC\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${am__fastdepCXX_TRUE}\" && test -z \"${am__fastdepCXX_FALSE}\"; then\n  as_fn_error $? \"conditional \\\"am__fastdepCXX\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${HAVE_PYTHON_TRUE}\" && test -z \"${HAVE_PYTHON_FALSE}\"; then\n  as_fn_error $? \"conditional \\\"HAVE_PYTHON\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${HAVE_PTHREADS_TRUE}\" && test -z \"${HAVE_PTHREADS_FALSE}\"; then\n  as_fn_error $? \"conditional \\\"HAVE_PTHREADS\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\n\n: \"${CONFIG_STATUS=./config.status}\"\nac_write_fail=0\nac_clean_files_save=$ac_clean_files\nac_clean_files=\"$ac_clean_files $CONFIG_STATUS\"\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS\" >&5\n$as_echo \"$as_me: creating $CONFIG_STATUS\" >&6;}\nas_write_fail=0\ncat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1\n#! $SHELL\n# Generated by $as_me.\n# Run this file to recreate the current configuration.\n# Compiler output produced by configure, useful for debugging\n# configure, is in config.log if it exists.\n\ndebug=false\nac_cs_recheck=false\nac_cs_silent=false\n\nSHELL=\\${CONFIG_SHELL-$SHELL}\nexport SHELL\n_ASEOF\ncat >>$CONFIG_STATUS <<\\_ASEOF || as_write_fail=1\n## -------------------- ##\n## M4sh Initialization. ##\n## -------------------- ##\n\n# Be more Bourne compatible\nDUALCASE=1; export DUALCASE # for MKS sh\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :\n  emulate sh\n  NULLCMD=:\n  # Pre-4.2 versions of Zsh do word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in #(\n  *posix*) :\n    set -o posix ;; #(\n  *) :\n     ;;\nesac\nfi\n\n\nas_nl='\n'\nexport as_nl\n# Printing a long string crashes Solaris 7 /usr/bin/printf.\nas_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo\n# Prefer a ksh shell builtin over an external printf program on Solaris,\n# but without wasting forks for bash or zsh.\nif test -z \"$BASH_VERSION$ZSH_VERSION\" \\\n    && (test \"X`print -r -- $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='print -r --'\n  as_echo_n='print -rn --'\nelif (test \"X`printf %s $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='printf %s\\n'\n  as_echo_n='printf %s'\nelse\n  if test \"X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`\" = \"X-n $as_echo\"; then\n    as_echo_body='eval /usr/ucb/echo -n \"$1$as_nl\"'\n    as_echo_n='/usr/ucb/echo -n'\n  else\n    as_echo_body='eval expr \"X$1\" : \"X\\\\(.*\\\\)\"'\n    as_echo_n_body='eval\n      arg=$1;\n      case $arg in #(\n      *\"$as_nl\"*)\n\texpr \"X$arg\" : \"X\\\\(.*\\\\)$as_nl\";\n\targ=`expr \"X$arg\" : \".*$as_nl\\\\(.*\\\\)\"`;;\n      esac;\n      expr \"X$arg\" : \"X\\\\(.*\\\\)\" | tr -d \"$as_nl\"\n    '\n    export as_echo_n_body\n    as_echo_n='sh -c $as_echo_n_body as_echo'\n  fi\n  export as_echo_body\n  as_echo='sh -c $as_echo_body as_echo'\nfi\n\n# The user is always right.\nif test \"${PATH_SEPARATOR+set}\" != set; then\n  PATH_SEPARATOR=:\n  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {\n    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||\n      PATH_SEPARATOR=';'\n  }\nfi\n\n\n# IFS\n# We need space, tab and new line, in precisely that order.  Quoting is\n# there to prevent editors from complaining about space-tab.\n# (If _AS_PATH_WALK were called with IFS unset, it would disable word\n# splitting by setting IFS to empty value.)\nIFS=\" \"\"\t$as_nl\"\n\n# Find who we are.  Look in the path if we contain no directory separator.\nas_myself=\ncase $0 in #((\n  *[\\\\/]* ) as_myself=$0 ;;\n  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    test -r \"$as_dir/$0\" && as_myself=$as_dir/$0 && break\n  done\nIFS=$as_save_IFS\n\n     ;;\nesac\n# We did not find ourselves, most probably we were run as `sh COMMAND'\n# in which case we are not to be found in the path.\nif test \"x$as_myself\" = x; then\n  as_myself=$0\nfi\nif test ! -f \"$as_myself\"; then\n  $as_echo \"$as_myself: error: cannot find myself; rerun with an absolute file name\" >&2\n  exit 1\nfi\n\n# Unset variables that we do not need and which cause bugs (e.g. in\n# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the \"|| exit 1\"\n# suppresses any \"Segmentation fault\" message there.  '((' could\n# trigger a bug in pdksh 5.2.14.\nfor as_var in BASH_ENV ENV MAIL MAILPATH\ndo eval test x\\${$as_var+set} = xset \\\n  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :\ndone\nPS1='$ '\nPS2='> '\nPS4='+ '\n\n# NLS nuisances.\nLC_ALL=C\nexport LC_ALL\nLANGUAGE=C\nexport LANGUAGE\n\n# CDPATH.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\n\n# as_fn_error STATUS ERROR [LINENO LOG_FD]\n# ----------------------------------------\n# Output \"`basename $0`: error: ERROR\" to stderr. If LINENO and LOG_FD are\n# provided, also output the error to LOG_FD, referencing LINENO. Then exit the\n# script with STATUS, using 1 if that was 0.\nas_fn_error ()\n{\n  as_status=$1; test $as_status -eq 0 && as_status=1\n  if test \"$4\"; then\n    as_lineno=${as_lineno-\"$3\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n    $as_echo \"$as_me:${as_lineno-$LINENO}: error: $2\" >&$4\n  fi\n  $as_echo \"$as_me: error: $2\" >&2\n  as_fn_exit $as_status\n} # as_fn_error\n\n\n# as_fn_set_status STATUS\n# -----------------------\n# Set $? to STATUS, without forking.\nas_fn_set_status ()\n{\n  return $1\n} # as_fn_set_status\n\n# as_fn_exit STATUS\n# -----------------\n# Exit the shell with STATUS, even in a \"trap 0\" or \"set -e\" context.\nas_fn_exit ()\n{\n  set +e\n  as_fn_set_status $1\n  exit $1\n} # as_fn_exit\n\n# as_fn_unset VAR\n# ---------------\n# Portably unset VAR.\nas_fn_unset ()\n{\n  { eval $1=; unset $1;}\n}\nas_unset=as_fn_unset\n# as_fn_append VAR VALUE\n# ----------------------\n# Append the text in VALUE to the end of the definition contained in VAR. Take\n# advantage of any shell optimizations that allow amortized linear growth over\n# repeated appends, instead of the typical quadratic growth present in naive\n# implementations.\nif (eval \"as_var=1; as_var+=2; test x\\$as_var = x12\") 2>/dev/null; then :\n  eval 'as_fn_append ()\n  {\n    eval $1+=\\$2\n  }'\nelse\n  as_fn_append ()\n  {\n    eval $1=\\$$1\\$2\n  }\nfi # as_fn_append\n\n# as_fn_arith ARG...\n# ------------------\n# Perform arithmetic evaluation on the ARGs, and store the result in the\n# global $as_val. Take advantage of shells that can avoid forks. The arguments\n# must be portable across $(()) and expr.\nif (eval \"test \\$(( 1 + 1 )) = 2\") 2>/dev/null; then :\n  eval 'as_fn_arith ()\n  {\n    as_val=$(( $* ))\n  }'\nelse\n  as_fn_arith ()\n  {\n    as_val=`expr \"$@\" || test $? -eq 1`\n  }\nfi # as_fn_arith\n\n\nif expr a : '\\(a\\)' >/dev/null 2>&1 &&\n   test \"X`expr 00001 : '.*\\(...\\)'`\" = X001; then\n  as_expr=expr\nelse\n  as_expr=false\nfi\n\nif (basename -- /) >/dev/null 2>&1 && test \"X`basename -- / 2>&1`\" = \"X/\"; then\n  as_basename=basename\nelse\n  as_basename=false\nfi\n\nif (as_dir=`dirname -- /` && test \"X$as_dir\" = X/) >/dev/null 2>&1; then\n  as_dirname=dirname\nelse\n  as_dirname=false\nfi\n\nas_me=`$as_basename -- \"$0\" ||\n$as_expr X/\"$0\" : '.*/\\([^/][^/]*\\)/*$' \\| \\\n\t X\"$0\" : 'X\\(//\\)$' \\| \\\n\t X\"$0\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X/\"$0\" |\n    sed '/^.*\\/\\([^/][^/]*\\)\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n\n# Avoid depending upon Character Ranges.\nas_cr_letters='abcdefghijklmnopqrstuvwxyz'\nas_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nas_cr_Letters=$as_cr_letters$as_cr_LETTERS\nas_cr_digits='0123456789'\nas_cr_alnum=$as_cr_Letters$as_cr_digits\n\nECHO_C= ECHO_N= ECHO_T=\ncase `echo -n x` in #(((((\n-n*)\n  case `echo 'xy\\c'` in\n  *c*) ECHO_T='\t';;\t# ECHO_T is single tab character.\n  xy)  ECHO_C='\\c';;\n  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null\n       ECHO_T='\t';;\n  esac;;\n*)\n  ECHO_N='-n';;\nesac\n\nrm -f conf$$ conf$$.exe conf$$.file\nif test -d conf$$.dir; then\n  rm -f conf$$.dir/conf$$.file\nelse\n  rm -f conf$$.dir\n  mkdir conf$$.dir 2>/dev/null\nfi\nif (echo >conf$$.file) 2>/dev/null; then\n  if ln -s conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s='ln -s'\n    # ... but there are two gotchas:\n    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.\n    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.\n    # In both cases, we have to default to `cp -p'.\n    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||\n      as_ln_s='cp -p'\n  elif ln conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s=ln\n  else\n    as_ln_s='cp -p'\n  fi\nelse\n  as_ln_s='cp -p'\nfi\nrm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file\nrmdir conf$$.dir 2>/dev/null\n\n\n# as_fn_mkdir_p\n# -------------\n# Create \"$as_dir\" as a directory, including parents if necessary.\nas_fn_mkdir_p ()\n{\n\n  case $as_dir in #(\n  -*) as_dir=./$as_dir;;\n  esac\n  test -d \"$as_dir\" || eval $as_mkdir_p || {\n    as_dirs=\n    while :; do\n      case $as_dir in #(\n      *\\'*) as_qdir=`$as_echo \"$as_dir\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;; #'(\n      *) as_qdir=$as_dir;;\n      esac\n      as_dirs=\"'$as_qdir' $as_dirs\"\n      as_dir=`$as_dirname -- \"$as_dir\" ||\n$as_expr X\"$as_dir\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)$' \\| \\\n\t X\"$as_dir\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$as_dir\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n      test -d \"$as_dir\" && break\n    done\n    test -z \"$as_dirs\" || eval \"mkdir $as_dirs\"\n  } || test -d \"$as_dir\" || as_fn_error $? \"cannot create directory $as_dir\"\n\n\n} # as_fn_mkdir_p\nif mkdir -p . 2>/dev/null; then\n  as_mkdir_p='mkdir -p \"$as_dir\"'\nelse\n  test -d ./-p && rmdir ./-p\n  as_mkdir_p=false\nfi\n\nif test -x / >/dev/null 2>&1; then\n  as_test_x='test -x'\nelse\n  if ls -dL / >/dev/null 2>&1; then\n    as_ls_L_option=L\n  else\n    as_ls_L_option=\n  fi\n  as_test_x='\n    eval sh -c '\\''\n      if test -d \"$1\"; then\n\ttest -d \"$1/.\";\n      else\n\tcase $1 in #(\n\t-*)set \"./$1\";;\n\tesac;\n\tcase `ls -ld'$as_ls_L_option' \"$1\" 2>/dev/null` in #((\n\t???[sx]*):;;*)false;;esac;fi\n    '\\'' sh\n  '\nfi\nas_executable_p=$as_test_x\n\n# Sed expression to map a string onto a valid CPP name.\nas_tr_cpp=\"eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'\"\n\n# Sed expression to map a string onto a valid variable name.\nas_tr_sh=\"eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'\"\n\n\nexec 6>&1\n## ----------------------------------- ##\n## Main body of $CONFIG_STATUS script. ##\n## ----------------------------------- ##\n_ASEOF\ntest $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n# Save the log message, to keep $0 and so on meaningful, and to\n# report actual input values of CONFIG_FILES etc. instead of their\n# values after options handling.\nac_log=\"\nThis file was extended by Google C++ Testing Framework $as_me 1.7.0, which was\ngenerated by GNU Autoconf 2.68.  Invocation command line was\n\n  CONFIG_FILES    = $CONFIG_FILES\n  CONFIG_HEADERS  = $CONFIG_HEADERS\n  CONFIG_LINKS    = $CONFIG_LINKS\n  CONFIG_COMMANDS = $CONFIG_COMMANDS\n  $ $0 $@\n\non `(hostname || uname -n) 2>/dev/null | sed 1q`\n\"\n\n_ACEOF\n\ncase $ac_config_files in *\"\n\"*) set x $ac_config_files; shift; ac_config_files=$*;;\nesac\n\ncase $ac_config_headers in *\"\n\"*) set x $ac_config_headers; shift; ac_config_headers=$*;;\nesac\n\n\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n# Files that config.status was made for.\nconfig_files=\"$ac_config_files\"\nconfig_headers=\"$ac_config_headers\"\nconfig_commands=\"$ac_config_commands\"\n\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nac_cs_usage=\"\\\n\\`$as_me' instantiates files and other configuration actions\nfrom templates according to the current configuration.  Unless the files\nand actions are specified as TAGs, all are instantiated by default.\n\nUsage: $0 [OPTION]... [TAG]...\n\n  -h, --help       print this help, then exit\n  -V, --version    print version number and configuration settings, then exit\n      --config     print configuration, then exit\n  -q, --quiet, --silent\n                   do not print progress messages\n  -d, --debug      don't remove temporary files\n      --recheck    update $as_me by reconfiguring in the same conditions\n      --file=FILE[:TEMPLATE]\n                   instantiate the configuration file FILE\n      --header=FILE[:TEMPLATE]\n                   instantiate the configuration header FILE\n\nConfiguration files:\n$config_files\n\nConfiguration headers:\n$config_headers\n\nConfiguration commands:\n$config_commands\n\nReport bugs to <googletestframework@googlegroups.com>.\"\n\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\nac_cs_config=\"`$as_echo \"$ac_configure_args\" | sed 's/^ //; s/[\\\\\"\"\\`\\$]/\\\\\\\\&/g'`\"\nac_cs_version=\"\\\\\nGoogle C++ Testing Framework config.status 1.7.0\nconfigured by $0, generated by GNU Autoconf 2.68,\n  with options \\\\\"\\$ac_cs_config\\\\\"\n\nCopyright (C) 2010 Free Software Foundation, Inc.\nThis config.status script is free software; the Free Software Foundation\ngives unlimited permission to copy, distribute and modify it.\"\n\nac_pwd='$ac_pwd'\nsrcdir='$srcdir'\nINSTALL='$INSTALL'\nMKDIR_P='$MKDIR_P'\nAWK='$AWK'\ntest -n \"\\$AWK\" || AWK=awk\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n# The default lists apply if the user does not specify any file.\nac_need_defaults=:\nwhile test $# != 0\ndo\n  case $1 in\n  --*=?*)\n    ac_option=`expr \"X$1\" : 'X\\([^=]*\\)='`\n    ac_optarg=`expr \"X$1\" : 'X[^=]*=\\(.*\\)'`\n    ac_shift=:\n    ;;\n  --*=)\n    ac_option=`expr \"X$1\" : 'X\\([^=]*\\)='`\n    ac_optarg=\n    ac_shift=:\n    ;;\n  *)\n    ac_option=$1\n    ac_optarg=$2\n    ac_shift=shift\n    ;;\n  esac\n\n  case $ac_option in\n  # Handling of the options.\n  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)\n    ac_cs_recheck=: ;;\n  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )\n    $as_echo \"$ac_cs_version\"; exit ;;\n  --config | --confi | --conf | --con | --co | --c )\n    $as_echo \"$ac_cs_config\"; exit ;;\n  --debug | --debu | --deb | --de | --d | -d )\n    debug=: ;;\n  --file | --fil | --fi | --f )\n    $ac_shift\n    case $ac_optarg in\n    *\\'*) ac_optarg=`$as_echo \"$ac_optarg\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    '') as_fn_error $? \"missing file argument\" ;;\n    esac\n    as_fn_append CONFIG_FILES \" '$ac_optarg'\"\n    ac_need_defaults=false;;\n  --header | --heade | --head | --hea )\n    $ac_shift\n    case $ac_optarg in\n    *\\'*) ac_optarg=`$as_echo \"$ac_optarg\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    esac\n    as_fn_append CONFIG_HEADERS \" '$ac_optarg'\"\n    ac_need_defaults=false;;\n  --he | --h)\n    # Conflict between --help and --header\n    as_fn_error $? \"ambiguous option: \\`$1'\nTry \\`$0 --help' for more information.\";;\n  --help | --hel | -h )\n    $as_echo \"$ac_cs_usage\"; exit ;;\n  -q | -quiet | --quiet | --quie | --qui | --qu | --q \\\n  | -silent | --silent | --silen | --sile | --sil | --si | --s)\n    ac_cs_silent=: ;;\n\n  # This is an error.\n  -*) as_fn_error $? \"unrecognized option: \\`$1'\nTry \\`$0 --help' for more information.\" ;;\n\n  *) as_fn_append ac_config_targets \" $1\"\n     ac_need_defaults=false ;;\n\n  esac\n  shift\ndone\n\nac_configure_extra_args=\n\nif $ac_cs_silent; then\n  exec 6>/dev/null\n  ac_configure_extra_args=\"$ac_configure_extra_args --silent\"\nfi\n\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\nif \\$ac_cs_recheck; then\n  set X '$SHELL' '$0' $ac_configure_args \\$ac_configure_extra_args --no-create --no-recursion\n  shift\n  \\$as_echo \"running CONFIG_SHELL=$SHELL \\$*\" >&6\n  CONFIG_SHELL='$SHELL'\n  export CONFIG_SHELL\n  exec \"\\$@\"\nfi\n\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nexec 5>>config.log\n{\n  echo\n  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX\n## Running $as_me. ##\n_ASBOX\n  $as_echo \"$ac_log\"\n} >&5\n\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n#\n# INIT-COMMANDS\n#\nAMDEP_TRUE=\"$AMDEP_TRUE\" ac_aux_dir=\"$ac_aux_dir\"\n\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nsed_quote_subst='$sed_quote_subst'\ndouble_quote_subst='$double_quote_subst'\ndelay_variable_subst='$delay_variable_subst'\nmacro_version='`$ECHO \"$macro_version\" | $SED \"$delay_single_quote_subst\"`'\nmacro_revision='`$ECHO \"$macro_revision\" | $SED \"$delay_single_quote_subst\"`'\nenable_shared='`$ECHO \"$enable_shared\" | $SED \"$delay_single_quote_subst\"`'\nenable_static='`$ECHO \"$enable_static\" | $SED \"$delay_single_quote_subst\"`'\npic_mode='`$ECHO \"$pic_mode\" | $SED \"$delay_single_quote_subst\"`'\nenable_fast_install='`$ECHO \"$enable_fast_install\" | $SED \"$delay_single_quote_subst\"`'\nSHELL='`$ECHO \"$SHELL\" | $SED \"$delay_single_quote_subst\"`'\nECHO='`$ECHO \"$ECHO\" | $SED \"$delay_single_quote_subst\"`'\nPATH_SEPARATOR='`$ECHO \"$PATH_SEPARATOR\" | $SED \"$delay_single_quote_subst\"`'\nhost_alias='`$ECHO \"$host_alias\" | $SED \"$delay_single_quote_subst\"`'\nhost='`$ECHO \"$host\" | $SED \"$delay_single_quote_subst\"`'\nhost_os='`$ECHO \"$host_os\" | $SED \"$delay_single_quote_subst\"`'\nbuild_alias='`$ECHO \"$build_alias\" | $SED \"$delay_single_quote_subst\"`'\nbuild='`$ECHO \"$build\" | $SED \"$delay_single_quote_subst\"`'\nbuild_os='`$ECHO \"$build_os\" | $SED \"$delay_single_quote_subst\"`'\nSED='`$ECHO \"$SED\" | $SED \"$delay_single_quote_subst\"`'\nXsed='`$ECHO \"$Xsed\" | $SED \"$delay_single_quote_subst\"`'\nGREP='`$ECHO \"$GREP\" | $SED \"$delay_single_quote_subst\"`'\nEGREP='`$ECHO \"$EGREP\" | $SED \"$delay_single_quote_subst\"`'\nFGREP='`$ECHO \"$FGREP\" | $SED \"$delay_single_quote_subst\"`'\nLD='`$ECHO \"$LD\" | $SED \"$delay_single_quote_subst\"`'\nNM='`$ECHO \"$NM\" | $SED \"$delay_single_quote_subst\"`'\nLN_S='`$ECHO \"$LN_S\" | $SED \"$delay_single_quote_subst\"`'\nmax_cmd_len='`$ECHO \"$max_cmd_len\" | $SED \"$delay_single_quote_subst\"`'\nac_objext='`$ECHO \"$ac_objext\" | $SED \"$delay_single_quote_subst\"`'\nexeext='`$ECHO \"$exeext\" | $SED \"$delay_single_quote_subst\"`'\nlt_unset='`$ECHO \"$lt_unset\" | $SED \"$delay_single_quote_subst\"`'\nlt_SP2NL='`$ECHO \"$lt_SP2NL\" | $SED \"$delay_single_quote_subst\"`'\nlt_NL2SP='`$ECHO \"$lt_NL2SP\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_to_host_file_cmd='`$ECHO \"$lt_cv_to_host_file_cmd\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_to_tool_file_cmd='`$ECHO \"$lt_cv_to_tool_file_cmd\" | $SED \"$delay_single_quote_subst\"`'\nreload_flag='`$ECHO \"$reload_flag\" | $SED \"$delay_single_quote_subst\"`'\nreload_cmds='`$ECHO \"$reload_cmds\" | $SED \"$delay_single_quote_subst\"`'\nOBJDUMP='`$ECHO \"$OBJDUMP\" | $SED \"$delay_single_quote_subst\"`'\ndeplibs_check_method='`$ECHO \"$deplibs_check_method\" | $SED \"$delay_single_quote_subst\"`'\nfile_magic_cmd='`$ECHO \"$file_magic_cmd\" | $SED \"$delay_single_quote_subst\"`'\nfile_magic_glob='`$ECHO \"$file_magic_glob\" | $SED \"$delay_single_quote_subst\"`'\nwant_nocaseglob='`$ECHO \"$want_nocaseglob\" | $SED \"$delay_single_quote_subst\"`'\nDLLTOOL='`$ECHO \"$DLLTOOL\" | $SED \"$delay_single_quote_subst\"`'\nsharedlib_from_linklib_cmd='`$ECHO \"$sharedlib_from_linklib_cmd\" | $SED \"$delay_single_quote_subst\"`'\nAR='`$ECHO \"$AR\" | $SED \"$delay_single_quote_subst\"`'\nAR_FLAGS='`$ECHO \"$AR_FLAGS\" | $SED \"$delay_single_quote_subst\"`'\narchiver_list_spec='`$ECHO \"$archiver_list_spec\" | $SED \"$delay_single_quote_subst\"`'\nSTRIP='`$ECHO \"$STRIP\" | $SED \"$delay_single_quote_subst\"`'\nRANLIB='`$ECHO \"$RANLIB\" | $SED \"$delay_single_quote_subst\"`'\nold_postinstall_cmds='`$ECHO \"$old_postinstall_cmds\" | $SED \"$delay_single_quote_subst\"`'\nold_postuninstall_cmds='`$ECHO \"$old_postuninstall_cmds\" | $SED \"$delay_single_quote_subst\"`'\nold_archive_cmds='`$ECHO \"$old_archive_cmds\" | $SED \"$delay_single_quote_subst\"`'\nlock_old_archive_extraction='`$ECHO \"$lock_old_archive_extraction\" | $SED \"$delay_single_quote_subst\"`'\nCC='`$ECHO \"$CC\" | $SED \"$delay_single_quote_subst\"`'\nCFLAGS='`$ECHO \"$CFLAGS\" | $SED \"$delay_single_quote_subst\"`'\ncompiler='`$ECHO \"$compiler\" | $SED \"$delay_single_quote_subst\"`'\nGCC='`$ECHO \"$GCC\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_pipe='`$ECHO \"$lt_cv_sys_global_symbol_pipe\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_to_cdecl='`$ECHO \"$lt_cv_sys_global_symbol_to_cdecl\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_to_c_name_address='`$ECHO \"$lt_cv_sys_global_symbol_to_c_name_address\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO \"$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix\" | $SED \"$delay_single_quote_subst\"`'\nnm_file_list_spec='`$ECHO \"$nm_file_list_spec\" | $SED \"$delay_single_quote_subst\"`'\nlt_sysroot='`$ECHO \"$lt_sysroot\" | $SED \"$delay_single_quote_subst\"`'\nobjdir='`$ECHO \"$objdir\" | $SED \"$delay_single_quote_subst\"`'\nMAGIC_CMD='`$ECHO \"$MAGIC_CMD\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_no_builtin_flag='`$ECHO \"$lt_prog_compiler_no_builtin_flag\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_pic='`$ECHO \"$lt_prog_compiler_pic\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_wl='`$ECHO \"$lt_prog_compiler_wl\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_static='`$ECHO \"$lt_prog_compiler_static\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_prog_compiler_c_o='`$ECHO \"$lt_cv_prog_compiler_c_o\" | $SED \"$delay_single_quote_subst\"`'\nneed_locks='`$ECHO \"$need_locks\" | $SED \"$delay_single_quote_subst\"`'\nMANIFEST_TOOL='`$ECHO \"$MANIFEST_TOOL\" | $SED \"$delay_single_quote_subst\"`'\nDSYMUTIL='`$ECHO \"$DSYMUTIL\" | $SED \"$delay_single_quote_subst\"`'\nNMEDIT='`$ECHO \"$NMEDIT\" | $SED \"$delay_single_quote_subst\"`'\nLIPO='`$ECHO \"$LIPO\" | $SED \"$delay_single_quote_subst\"`'\nOTOOL='`$ECHO \"$OTOOL\" | $SED \"$delay_single_quote_subst\"`'\nOTOOL64='`$ECHO \"$OTOOL64\" | $SED \"$delay_single_quote_subst\"`'\nlibext='`$ECHO \"$libext\" | $SED \"$delay_single_quote_subst\"`'\nshrext_cmds='`$ECHO \"$shrext_cmds\" | $SED \"$delay_single_quote_subst\"`'\nextract_expsyms_cmds='`$ECHO \"$extract_expsyms_cmds\" | $SED \"$delay_single_quote_subst\"`'\narchive_cmds_need_lc='`$ECHO \"$archive_cmds_need_lc\" | $SED \"$delay_single_quote_subst\"`'\nenable_shared_with_static_runtimes='`$ECHO \"$enable_shared_with_static_runtimes\" | $SED \"$delay_single_quote_subst\"`'\nexport_dynamic_flag_spec='`$ECHO \"$export_dynamic_flag_spec\" | $SED \"$delay_single_quote_subst\"`'\nwhole_archive_flag_spec='`$ECHO \"$whole_archive_flag_spec\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_needs_object='`$ECHO \"$compiler_needs_object\" | $SED \"$delay_single_quote_subst\"`'\nold_archive_from_new_cmds='`$ECHO \"$old_archive_from_new_cmds\" | $SED \"$delay_single_quote_subst\"`'\nold_archive_from_expsyms_cmds='`$ECHO \"$old_archive_from_expsyms_cmds\" | $SED \"$delay_single_quote_subst\"`'\narchive_cmds='`$ECHO \"$archive_cmds\" | $SED \"$delay_single_quote_subst\"`'\narchive_expsym_cmds='`$ECHO \"$archive_expsym_cmds\" | $SED \"$delay_single_quote_subst\"`'\nmodule_cmds='`$ECHO \"$module_cmds\" | $SED \"$delay_single_quote_subst\"`'\nmodule_expsym_cmds='`$ECHO \"$module_expsym_cmds\" | $SED \"$delay_single_quote_subst\"`'\nwith_gnu_ld='`$ECHO \"$with_gnu_ld\" | $SED \"$delay_single_quote_subst\"`'\nallow_undefined_flag='`$ECHO \"$allow_undefined_flag\" | $SED \"$delay_single_quote_subst\"`'\nno_undefined_flag='`$ECHO \"$no_undefined_flag\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_libdir_flag_spec='`$ECHO \"$hardcode_libdir_flag_spec\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_libdir_separator='`$ECHO \"$hardcode_libdir_separator\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_direct='`$ECHO \"$hardcode_direct\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_direct_absolute='`$ECHO \"$hardcode_direct_absolute\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_minus_L='`$ECHO \"$hardcode_minus_L\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_shlibpath_var='`$ECHO \"$hardcode_shlibpath_var\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_automatic='`$ECHO \"$hardcode_automatic\" | $SED \"$delay_single_quote_subst\"`'\ninherit_rpath='`$ECHO \"$inherit_rpath\" | $SED \"$delay_single_quote_subst\"`'\nlink_all_deplibs='`$ECHO \"$link_all_deplibs\" | $SED \"$delay_single_quote_subst\"`'\nalways_export_symbols='`$ECHO \"$always_export_symbols\" | $SED \"$delay_single_quote_subst\"`'\nexport_symbols_cmds='`$ECHO \"$export_symbols_cmds\" | $SED \"$delay_single_quote_subst\"`'\nexclude_expsyms='`$ECHO \"$exclude_expsyms\" | $SED \"$delay_single_quote_subst\"`'\ninclude_expsyms='`$ECHO \"$include_expsyms\" | $SED \"$delay_single_quote_subst\"`'\nprelink_cmds='`$ECHO \"$prelink_cmds\" | $SED \"$delay_single_quote_subst\"`'\npostlink_cmds='`$ECHO \"$postlink_cmds\" | $SED \"$delay_single_quote_subst\"`'\nfile_list_spec='`$ECHO \"$file_list_spec\" | $SED \"$delay_single_quote_subst\"`'\nvariables_saved_for_relink='`$ECHO \"$variables_saved_for_relink\" | $SED \"$delay_single_quote_subst\"`'\nneed_lib_prefix='`$ECHO \"$need_lib_prefix\" | $SED \"$delay_single_quote_subst\"`'\nneed_version='`$ECHO \"$need_version\" | $SED \"$delay_single_quote_subst\"`'\nversion_type='`$ECHO \"$version_type\" | $SED \"$delay_single_quote_subst\"`'\nrunpath_var='`$ECHO \"$runpath_var\" | $SED \"$delay_single_quote_subst\"`'\nshlibpath_var='`$ECHO \"$shlibpath_var\" | $SED \"$delay_single_quote_subst\"`'\nshlibpath_overrides_runpath='`$ECHO \"$shlibpath_overrides_runpath\" | $SED \"$delay_single_quote_subst\"`'\nlibname_spec='`$ECHO \"$libname_spec\" | $SED \"$delay_single_quote_subst\"`'\nlibrary_names_spec='`$ECHO \"$library_names_spec\" | $SED \"$delay_single_quote_subst\"`'\nsoname_spec='`$ECHO \"$soname_spec\" | $SED \"$delay_single_quote_subst\"`'\ninstall_override_mode='`$ECHO \"$install_override_mode\" | $SED \"$delay_single_quote_subst\"`'\npostinstall_cmds='`$ECHO \"$postinstall_cmds\" | $SED \"$delay_single_quote_subst\"`'\npostuninstall_cmds='`$ECHO \"$postuninstall_cmds\" | $SED \"$delay_single_quote_subst\"`'\nfinish_cmds='`$ECHO \"$finish_cmds\" | $SED \"$delay_single_quote_subst\"`'\nfinish_eval='`$ECHO \"$finish_eval\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_into_libs='`$ECHO \"$hardcode_into_libs\" | $SED \"$delay_single_quote_subst\"`'\nsys_lib_search_path_spec='`$ECHO \"$sys_lib_search_path_spec\" | $SED \"$delay_single_quote_subst\"`'\nsys_lib_dlsearch_path_spec='`$ECHO \"$sys_lib_dlsearch_path_spec\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_action='`$ECHO \"$hardcode_action\" | $SED \"$delay_single_quote_subst\"`'\nenable_dlopen='`$ECHO \"$enable_dlopen\" | $SED \"$delay_single_quote_subst\"`'\nenable_dlopen_self='`$ECHO \"$enable_dlopen_self\" | $SED \"$delay_single_quote_subst\"`'\nenable_dlopen_self_static='`$ECHO \"$enable_dlopen_self_static\" | $SED \"$delay_single_quote_subst\"`'\nold_striplib='`$ECHO \"$old_striplib\" | $SED \"$delay_single_quote_subst\"`'\nstriplib='`$ECHO \"$striplib\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_lib_search_dirs='`$ECHO \"$compiler_lib_search_dirs\" | $SED \"$delay_single_quote_subst\"`'\npredep_objects='`$ECHO \"$predep_objects\" | $SED \"$delay_single_quote_subst\"`'\npostdep_objects='`$ECHO \"$postdep_objects\" | $SED \"$delay_single_quote_subst\"`'\npredeps='`$ECHO \"$predeps\" | $SED \"$delay_single_quote_subst\"`'\npostdeps='`$ECHO \"$postdeps\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_lib_search_path='`$ECHO \"$compiler_lib_search_path\" | $SED \"$delay_single_quote_subst\"`'\nLD_CXX='`$ECHO \"$LD_CXX\" | $SED \"$delay_single_quote_subst\"`'\nreload_flag_CXX='`$ECHO \"$reload_flag_CXX\" | $SED \"$delay_single_quote_subst\"`'\nreload_cmds_CXX='`$ECHO \"$reload_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nold_archive_cmds_CXX='`$ECHO \"$old_archive_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_CXX='`$ECHO \"$compiler_CXX\" | $SED \"$delay_single_quote_subst\"`'\nGCC_CXX='`$ECHO \"$GCC_CXX\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_no_builtin_flag_CXX='`$ECHO \"$lt_prog_compiler_no_builtin_flag_CXX\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_pic_CXX='`$ECHO \"$lt_prog_compiler_pic_CXX\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_wl_CXX='`$ECHO \"$lt_prog_compiler_wl_CXX\" | $SED \"$delay_single_quote_subst\"`'\nlt_prog_compiler_static_CXX='`$ECHO \"$lt_prog_compiler_static_CXX\" | $SED \"$delay_single_quote_subst\"`'\nlt_cv_prog_compiler_c_o_CXX='`$ECHO \"$lt_cv_prog_compiler_c_o_CXX\" | $SED \"$delay_single_quote_subst\"`'\narchive_cmds_need_lc_CXX='`$ECHO \"$archive_cmds_need_lc_CXX\" | $SED \"$delay_single_quote_subst\"`'\nenable_shared_with_static_runtimes_CXX='`$ECHO \"$enable_shared_with_static_runtimes_CXX\" | $SED \"$delay_single_quote_subst\"`'\nexport_dynamic_flag_spec_CXX='`$ECHO \"$export_dynamic_flag_spec_CXX\" | $SED \"$delay_single_quote_subst\"`'\nwhole_archive_flag_spec_CXX='`$ECHO \"$whole_archive_flag_spec_CXX\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_needs_object_CXX='`$ECHO \"$compiler_needs_object_CXX\" | $SED \"$delay_single_quote_subst\"`'\nold_archive_from_new_cmds_CXX='`$ECHO \"$old_archive_from_new_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nold_archive_from_expsyms_cmds_CXX='`$ECHO \"$old_archive_from_expsyms_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\narchive_cmds_CXX='`$ECHO \"$archive_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\narchive_expsym_cmds_CXX='`$ECHO \"$archive_expsym_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nmodule_cmds_CXX='`$ECHO \"$module_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nmodule_expsym_cmds_CXX='`$ECHO \"$module_expsym_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nwith_gnu_ld_CXX='`$ECHO \"$with_gnu_ld_CXX\" | $SED \"$delay_single_quote_subst\"`'\nallow_undefined_flag_CXX='`$ECHO \"$allow_undefined_flag_CXX\" | $SED \"$delay_single_quote_subst\"`'\nno_undefined_flag_CXX='`$ECHO \"$no_undefined_flag_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_libdir_flag_spec_CXX='`$ECHO \"$hardcode_libdir_flag_spec_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_libdir_separator_CXX='`$ECHO \"$hardcode_libdir_separator_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_direct_CXX='`$ECHO \"$hardcode_direct_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_direct_absolute_CXX='`$ECHO \"$hardcode_direct_absolute_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_minus_L_CXX='`$ECHO \"$hardcode_minus_L_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_shlibpath_var_CXX='`$ECHO \"$hardcode_shlibpath_var_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_automatic_CXX='`$ECHO \"$hardcode_automatic_CXX\" | $SED \"$delay_single_quote_subst\"`'\ninherit_rpath_CXX='`$ECHO \"$inherit_rpath_CXX\" | $SED \"$delay_single_quote_subst\"`'\nlink_all_deplibs_CXX='`$ECHO \"$link_all_deplibs_CXX\" | $SED \"$delay_single_quote_subst\"`'\nalways_export_symbols_CXX='`$ECHO \"$always_export_symbols_CXX\" | $SED \"$delay_single_quote_subst\"`'\nexport_symbols_cmds_CXX='`$ECHO \"$export_symbols_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nexclude_expsyms_CXX='`$ECHO \"$exclude_expsyms_CXX\" | $SED \"$delay_single_quote_subst\"`'\ninclude_expsyms_CXX='`$ECHO \"$include_expsyms_CXX\" | $SED \"$delay_single_quote_subst\"`'\nprelink_cmds_CXX='`$ECHO \"$prelink_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\npostlink_cmds_CXX='`$ECHO \"$postlink_cmds_CXX\" | $SED \"$delay_single_quote_subst\"`'\nfile_list_spec_CXX='`$ECHO \"$file_list_spec_CXX\" | $SED \"$delay_single_quote_subst\"`'\nhardcode_action_CXX='`$ECHO \"$hardcode_action_CXX\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_lib_search_dirs_CXX='`$ECHO \"$compiler_lib_search_dirs_CXX\" | $SED \"$delay_single_quote_subst\"`'\npredep_objects_CXX='`$ECHO \"$predep_objects_CXX\" | $SED \"$delay_single_quote_subst\"`'\npostdep_objects_CXX='`$ECHO \"$postdep_objects_CXX\" | $SED \"$delay_single_quote_subst\"`'\npredeps_CXX='`$ECHO \"$predeps_CXX\" | $SED \"$delay_single_quote_subst\"`'\npostdeps_CXX='`$ECHO \"$postdeps_CXX\" | $SED \"$delay_single_quote_subst\"`'\ncompiler_lib_search_path_CXX='`$ECHO \"$compiler_lib_search_path_CXX\" | $SED \"$delay_single_quote_subst\"`'\n\nLTCC='$LTCC'\nLTCFLAGS='$LTCFLAGS'\ncompiler='$compiler_DEFAULT'\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n\\$1\n_LTECHO_EOF'\n}\n\n# Quote evaled strings.\nfor var in SHELL \\\nECHO \\\nPATH_SEPARATOR \\\nSED \\\nGREP \\\nEGREP \\\nFGREP \\\nLD \\\nNM \\\nLN_S \\\nlt_SP2NL \\\nlt_NL2SP \\\nreload_flag \\\nOBJDUMP \\\ndeplibs_check_method \\\nfile_magic_cmd \\\nfile_magic_glob \\\nwant_nocaseglob \\\nDLLTOOL \\\nsharedlib_from_linklib_cmd \\\nAR \\\nAR_FLAGS \\\narchiver_list_spec \\\nSTRIP \\\nRANLIB \\\nCC \\\nCFLAGS \\\ncompiler \\\nlt_cv_sys_global_symbol_pipe \\\nlt_cv_sys_global_symbol_to_cdecl \\\nlt_cv_sys_global_symbol_to_c_name_address \\\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix \\\nnm_file_list_spec \\\nlt_prog_compiler_no_builtin_flag \\\nlt_prog_compiler_pic \\\nlt_prog_compiler_wl \\\nlt_prog_compiler_static \\\nlt_cv_prog_compiler_c_o \\\nneed_locks \\\nMANIFEST_TOOL \\\nDSYMUTIL \\\nNMEDIT \\\nLIPO \\\nOTOOL \\\nOTOOL64 \\\nshrext_cmds \\\nexport_dynamic_flag_spec \\\nwhole_archive_flag_spec \\\ncompiler_needs_object \\\nwith_gnu_ld \\\nallow_undefined_flag \\\nno_undefined_flag \\\nhardcode_libdir_flag_spec \\\nhardcode_libdir_separator \\\nexclude_expsyms \\\ninclude_expsyms \\\nfile_list_spec \\\nvariables_saved_for_relink \\\nlibname_spec \\\nlibrary_names_spec \\\nsoname_spec \\\ninstall_override_mode \\\nfinish_eval \\\nold_striplib \\\nstriplib \\\ncompiler_lib_search_dirs \\\npredep_objects \\\npostdep_objects \\\npredeps \\\npostdeps \\\ncompiler_lib_search_path \\\nLD_CXX \\\nreload_flag_CXX \\\ncompiler_CXX \\\nlt_prog_compiler_no_builtin_flag_CXX \\\nlt_prog_compiler_pic_CXX \\\nlt_prog_compiler_wl_CXX \\\nlt_prog_compiler_static_CXX \\\nlt_cv_prog_compiler_c_o_CXX \\\nexport_dynamic_flag_spec_CXX \\\nwhole_archive_flag_spec_CXX \\\ncompiler_needs_object_CXX \\\nwith_gnu_ld_CXX \\\nallow_undefined_flag_CXX \\\nno_undefined_flag_CXX \\\nhardcode_libdir_flag_spec_CXX \\\nhardcode_libdir_separator_CXX \\\nexclude_expsyms_CXX \\\ninclude_expsyms_CXX \\\nfile_list_spec_CXX \\\ncompiler_lib_search_dirs_CXX \\\npredep_objects_CXX \\\npostdep_objects_CXX \\\npredeps_CXX \\\npostdeps_CXX \\\ncompiler_lib_search_path_CXX; do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED \\\\\"\\\\\\$sed_quote_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Double-quote double-evaled strings.\nfor var in reload_cmds \\\nold_postinstall_cmds \\\nold_postuninstall_cmds \\\nold_archive_cmds \\\nextract_expsyms_cmds \\\nold_archive_from_new_cmds \\\nold_archive_from_expsyms_cmds \\\narchive_cmds \\\narchive_expsym_cmds \\\nmodule_cmds \\\nmodule_expsym_cmds \\\nexport_symbols_cmds \\\nprelink_cmds \\\npostlink_cmds \\\npostinstall_cmds \\\npostuninstall_cmds \\\nfinish_cmds \\\nsys_lib_search_path_spec \\\nsys_lib_dlsearch_path_spec \\\nreload_cmds_CXX \\\nold_archive_cmds_CXX \\\nold_archive_from_new_cmds_CXX \\\nold_archive_from_expsyms_cmds_CXX \\\narchive_cmds_CXX \\\narchive_expsym_cmds_CXX \\\nmodule_cmds_CXX \\\nmodule_expsym_cmds_CXX \\\nexport_symbols_cmds_CXX \\\nprelink_cmds_CXX \\\npostlink_cmds_CXX; do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED -e \\\\\"\\\\\\$double_quote_subst\\\\\" -e \\\\\"\\\\\\$sed_quote_subst\\\\\" -e \\\\\"\\\\\\$delay_variable_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\nac_aux_dir='$ac_aux_dir'\nxsi_shell='$xsi_shell'\nlt_shell_append='$lt_shell_append'\n\n# See if we are running on zsh, and set the options which allow our\n# commands through without removal of \\ escapes INIT.\nif test -n \"\\${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n\n    PACKAGE='$PACKAGE'\n    VERSION='$VERSION'\n    TIMESTAMP='$TIMESTAMP'\n    RM='$RM'\n    ofile='$ofile'\n\n\n\n\n\n\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n\n# Handling of arguments.\nfor ac_config_target in $ac_config_targets\ndo\n  case $ac_config_target in\n    \"build-aux/config.h\") CONFIG_HEADERS=\"$CONFIG_HEADERS build-aux/config.h\" ;;\n    \"Makefile\") CONFIG_FILES=\"$CONFIG_FILES Makefile\" ;;\n    \"scripts/gtest-config\") CONFIG_FILES=\"$CONFIG_FILES scripts/gtest-config\" ;;\n    \"depfiles\") CONFIG_COMMANDS=\"$CONFIG_COMMANDS depfiles\" ;;\n    \"libtool\") CONFIG_COMMANDS=\"$CONFIG_COMMANDS libtool\" ;;\n\n  *) as_fn_error $? \"invalid argument: \\`$ac_config_target'\" \"$LINENO\" 5;;\n  esac\ndone\n\n\n# If the user did not use the arguments to specify the items to instantiate,\n# then the envvar interface is used.  Set only those that are not.\n# We use the long form for the default assignment because of an extremely\n# bizarre bug on SunOS 4.1.3.\nif $ac_need_defaults; then\n  test \"${CONFIG_FILES+set}\" = set || CONFIG_FILES=$config_files\n  test \"${CONFIG_HEADERS+set}\" = set || CONFIG_HEADERS=$config_headers\n  test \"${CONFIG_COMMANDS+set}\" = set || CONFIG_COMMANDS=$config_commands\nfi\n\n# Have a temporary directory for convenience.  Make it in the build tree\n# simply because there is no reason against having it here, and in addition,\n# creating and moving files from /tmp can sometimes cause problems.\n# Hook for its removal unless debugging.\n# Note that there is a small window in which the directory will not be cleaned:\n# after its creation but before its name has been assigned to `$tmp'.\n$debug ||\n{\n  tmp= ac_tmp=\n  trap 'exit_status=$?\n  : \"${ac_tmp:=$tmp}\"\n  { test ! -d \"$ac_tmp\" || rm -fr \"$ac_tmp\"; } && exit $exit_status\n' 0\n  trap 'as_fn_exit 1' 1 2 13 15\n}\n# Create a (secure) tmp directory for tmp files.\n\n{\n  tmp=`(umask 077 && mktemp -d \"./confXXXXXX\") 2>/dev/null` &&\n  test -d \"$tmp\"\n}  ||\n{\n  tmp=./conf$$-$RANDOM\n  (umask 077 && mkdir \"$tmp\")\n} || as_fn_error $? \"cannot create a temporary directory in .\" \"$LINENO\" 5\nac_tmp=$tmp\n\n# Set up the scripts for CONFIG_FILES section.\n# No need to generate them if there are no CONFIG_FILES.\n# This happens for instance with `./config.status config.h'.\nif test -n \"$CONFIG_FILES\"; then\n\n\nac_cr=`echo X | tr X '\\015'`\n# On cygwin, bash can eat \\r inside `` if the user requested igncr.\n# But we know of no other shell where ac_cr would be empty at this\n# point, so we can use a bashism as a fallback.\nif test \"x$ac_cr\" = x; then\n  eval ac_cr=\\$\\'\\\\r\\'\nfi\nac_cs_awk_cr=`$AWK 'BEGIN { print \"a\\rb\" }' </dev/null 2>/dev/null`\nif test \"$ac_cs_awk_cr\" = \"a${ac_cr}b\"; then\n  ac_cs_awk_cr='\\\\r'\nelse\n  ac_cs_awk_cr=$ac_cr\nfi\n\necho 'BEGIN {' >\"$ac_tmp/subs1.awk\" &&\n_ACEOF\n\n\n{\n  echo \"cat >conf$$subs.awk <<_ACEOF\" &&\n  echo \"$ac_subst_vars\" | sed 's/.*/&!$&$ac_delim/' &&\n  echo \"_ACEOF\"\n} >conf$$subs.sh ||\n  as_fn_error $? \"could not make $CONFIG_STATUS\" \"$LINENO\" 5\nac_delim_num=`echo \"$ac_subst_vars\" | grep -c '^'`\nac_delim='%!_!# '\nfor ac_last_try in false false false false false :; do\n  . ./conf$$subs.sh ||\n    as_fn_error $? \"could not make $CONFIG_STATUS\" \"$LINENO\" 5\n\n  ac_delim_n=`sed -n \"s/.*$ac_delim\\$/X/p\" conf$$subs.awk | grep -c X`\n  if test $ac_delim_n = $ac_delim_num; then\n    break\n  elif $ac_last_try; then\n    as_fn_error $? \"could not make $CONFIG_STATUS\" \"$LINENO\" 5\n  else\n    ac_delim=\"$ac_delim!$ac_delim _$ac_delim!! \"\n  fi\ndone\nrm -f conf$$subs.sh\n\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\ncat >>\"\\$ac_tmp/subs1.awk\" <<\\\\_ACAWK &&\n_ACEOF\nsed -n '\nh\ns/^/S[\"/; s/!.*/\"]=/\np\ng\ns/^[^!]*!//\n:repl\nt repl\ns/'\"$ac_delim\"'$//\nt delim\n:nl\nh\ns/\\(.\\{148\\}\\)..*/\\1/\nt more1\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\\\\n\"\\\\/\np\nn\nb repl\n:more1\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"\\\\/\np\ng\ns/.\\{148\\}//\nt nl\n:delim\nh\ns/\\(.\\{148\\}\\)..*/\\1/\nt more2\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"/\np\nb\n:more2\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"\\\\/\np\ng\ns/.\\{148\\}//\nt delim\n' <conf$$subs.awk | sed '\n/^[^\"\"]/{\n  N\n  s/\\n//\n}\n' >>$CONFIG_STATUS || ac_write_fail=1\nrm -f conf$$subs.awk\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n_ACAWK\ncat >>\"\\$ac_tmp/subs1.awk\" <<_ACAWK &&\n  for (key in S) S_is_set[key] = 1\n  FS = \"\u0007\"\n\n}\n{\n  line = $ 0\n  nfields = split(line, field, \"@\")\n  substed = 0\n  len = length(field[1])\n  for (i = 2; i < nfields; i++) {\n    key = field[i]\n    keylen = length(key)\n    if (S_is_set[key]) {\n      value = S[key]\n      line = substr(line, 1, len) \"\" value \"\" substr(line, len + keylen + 3)\n      len += length(value) + length(field[++i])\n      substed = 1\n    } else\n      len += 1 + keylen\n  }\n\n  print line\n}\n\n_ACAWK\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nif sed \"s/$ac_cr//\" < /dev/null > /dev/null 2>&1; then\n  sed \"s/$ac_cr\\$//; s/$ac_cr/$ac_cs_awk_cr/g\"\nelse\n  cat\nfi < \"$ac_tmp/subs1.awk\" > \"$ac_tmp/subs.awk\" \\\n  || as_fn_error $? \"could not setup config files machinery\" \"$LINENO\" 5\n_ACEOF\n\n# VPATH may cause trouble with some makes, so we remove sole $(srcdir),\n# ${srcdir} and @srcdir@ entries from VPATH if srcdir is \".\", strip leading and\n# trailing colons and then remove the whole line if VPATH becomes empty\n# (actually we leave an empty line to preserve line numbers).\nif test \"x$srcdir\" = x.; then\n  ac_vpsub='/^[\t ]*VPATH[\t ]*=[\t ]*/{\nh\ns///\ns/^/:/\ns/[\t ]*$/:/\ns/:\\$(srcdir):/:/g\ns/:\\${srcdir}:/:/g\ns/:@srcdir@:/:/g\ns/^:*//\ns/:*$//\nx\ns/\\(=[\t ]*\\).*/\\1/\nG\ns/\\n//\ns/^[^=]*=[\t ]*$//\n}'\nfi\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nfi # test -n \"$CONFIG_FILES\"\n\n# Set up the scripts for CONFIG_HEADERS section.\n# No need to generate them if there are no CONFIG_HEADERS.\n# This happens for instance with `./config.status Makefile'.\nif test -n \"$CONFIG_HEADERS\"; then\ncat >\"$ac_tmp/defines.awk\" <<\\_ACAWK ||\nBEGIN {\n_ACEOF\n\n# Transform confdefs.h into an awk script `defines.awk', embedded as\n# here-document in config.status, that substitutes the proper values into\n# config.h.in to produce config.h.\n\n# Create a delimiter string that does not exist in confdefs.h, to ease\n# handling of long lines.\nac_delim='%!_!# '\nfor ac_last_try in false false :; do\n  ac_tt=`sed -n \"/$ac_delim/p\" confdefs.h`\n  if test -z \"$ac_tt\"; then\n    break\n  elif $ac_last_try; then\n    as_fn_error $? \"could not make $CONFIG_HEADERS\" \"$LINENO\" 5\n  else\n    ac_delim=\"$ac_delim!$ac_delim _$ac_delim!! \"\n  fi\ndone\n\n# For the awk script, D is an array of macro values keyed by name,\n# likewise P contains macro parameters if any.  Preserve backslash\n# newline sequences.\n\nac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*\nsed -n '\ns/.\\{148\\}/&'\"$ac_delim\"'/g\nt rset\n:rset\ns/^[\t ]*#[\t ]*define[\t ][\t ]*/ /\nt def\nd\n:def\ns/\\\\$//\nt bsnl\ns/[\"\\\\]/\\\\&/g\ns/^ \\('\"$ac_word_re\"'\\)\\(([^()]*)\\)[\t ]*\\(.*\\)/P[\"\\1\"]=\"\\2\"\\\nD[\"\\1\"]=\" \\3\"/p\ns/^ \\('\"$ac_word_re\"'\\)[\t ]*\\(.*\\)/D[\"\\1\"]=\" \\2\"/p\nd\n:bsnl\ns/[\"\\\\]/\\\\&/g\ns/^ \\('\"$ac_word_re\"'\\)\\(([^()]*)\\)[\t ]*\\(.*\\)/P[\"\\1\"]=\"\\2\"\\\nD[\"\\1\"]=\" \\3\\\\\\\\\\\\n\"\\\\/p\nt cont\ns/^ \\('\"$ac_word_re\"'\\)[\t ]*\\(.*\\)/D[\"\\1\"]=\" \\2\\\\\\\\\\\\n\"\\\\/p\nt cont\nd\n:cont\nn\ns/.\\{148\\}/&'\"$ac_delim\"'/g\nt clear\n:clear\ns/\\\\$//\nt bsnlc\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"/p\nd\n:bsnlc\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\\\\\\\\\\\\n\"\\\\/p\nb cont\n' <confdefs.h | sed '\ns/'\"$ac_delim\"'/\"\\\\\\\n\"/g' >>$CONFIG_STATUS || ac_write_fail=1\n\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n  for (key in D) D_is_set[key] = 1\n  FS = \"\u0007\"\n}\n/^[\\t ]*#[\\t ]*(define|undef)[\\t ]+$ac_word_re([\\t (]|\\$)/ {\n  line = \\$ 0\n  split(line, arg, \" \")\n  if (arg[1] == \"#\") {\n    defundef = arg[2]\n    mac1 = arg[3]\n  } else {\n    defundef = substr(arg[1], 2)\n    mac1 = arg[2]\n  }\n  split(mac1, mac2, \"(\") #)\n  macro = mac2[1]\n  prefix = substr(line, 1, index(line, defundef) - 1)\n  if (D_is_set[macro]) {\n    # Preserve the white space surrounding the \"#\".\n    print prefix \"define\", macro P[macro] D[macro]\n    next\n  } else {\n    # Replace #undef with comments.  This is necessary, for example,\n    # in the case of _POSIX_SOURCE, which is predefined and required\n    # on some systems where configure will not decide to define it.\n    if (defundef == \"undef\") {\n      print \"/*\", prefix defundef, macro, \"*/\"\n      next\n    }\n  }\n}\n{ print }\n_ACAWK\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n  as_fn_error $? \"could not setup config headers machinery\" \"$LINENO\" 5\nfi # test -n \"$CONFIG_HEADERS\"\n\n\neval set X \"  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS\"\nshift\nfor ac_tag\ndo\n  case $ac_tag in\n  :[FHLC]) ac_mode=$ac_tag; continue;;\n  esac\n  case $ac_mode$ac_tag in\n  :[FHL]*:*);;\n  :L* | :C*:*) as_fn_error $? \"invalid tag \\`$ac_tag'\" \"$LINENO\" 5;;\n  :[FH]-) ac_tag=-:-;;\n  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;\n  esac\n  ac_save_IFS=$IFS\n  IFS=:\n  set x $ac_tag\n  IFS=$ac_save_IFS\n  shift\n  ac_file=$1\n  shift\n\n  case $ac_mode in\n  :L) ac_source=$1;;\n  :[FH])\n    ac_file_inputs=\n    for ac_f\n    do\n      case $ac_f in\n      -) ac_f=\"$ac_tmp/stdin\";;\n      *) # Look for the file first in the build tree, then in the source tree\n\t # (if the path is not absolute).  The absolute path cannot be DOS-style,\n\t # because $ac_f cannot contain `:'.\n\t test -f \"$ac_f\" ||\n\t   case $ac_f in\n\t   [\\\\/$]*) false;;\n\t   *) test -f \"$srcdir/$ac_f\" && ac_f=\"$srcdir/$ac_f\";;\n\t   esac ||\n\t   as_fn_error 1 \"cannot find input file: \\`$ac_f'\" \"$LINENO\" 5;;\n      esac\n      case $ac_f in *\\'*) ac_f=`$as_echo \"$ac_f\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;; esac\n      as_fn_append ac_file_inputs \" '$ac_f'\"\n    done\n\n    # Let's still pretend it is `configure' which instantiates (i.e., don't\n    # use $as_me), people would be surprised to read:\n    #    /* config.h.  Generated by config.status.  */\n    configure_input='Generated from '`\n\t  $as_echo \"$*\" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'\n\t`' by configure.'\n    if test x\"$ac_file\" != x-; then\n      configure_input=\"$ac_file.  $configure_input\"\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: creating $ac_file\" >&5\n$as_echo \"$as_me: creating $ac_file\" >&6;}\n    fi\n    # Neutralize special characters interpreted by sed in replacement strings.\n    case $configure_input in #(\n    *\\&* | *\\|* | *\\\\* )\n       ac_sed_conf_input=`$as_echo \"$configure_input\" |\n       sed 's/[\\\\\\\\&|]/\\\\\\\\&/g'`;; #(\n    *) ac_sed_conf_input=$configure_input;;\n    esac\n\n    case $ac_tag in\n    *:-:* | *:-) cat >\"$ac_tmp/stdin\" \\\n      || as_fn_error $? \"could not create $ac_file\" \"$LINENO\" 5 ;;\n    esac\n    ;;\n  esac\n\n  ac_dir=`$as_dirname -- \"$ac_file\" ||\n$as_expr X\"$ac_file\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$ac_file\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$ac_file\" : 'X\\(//\\)$' \\| \\\n\t X\"$ac_file\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$ac_file\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n  as_dir=\"$ac_dir\"; as_fn_mkdir_p\n  ac_builddir=.\n\ncase \"$ac_dir\" in\n.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;\n*)\n  ac_dir_suffix=/`$as_echo \"$ac_dir\" | sed 's|^\\.[\\\\/]||'`\n  # A \"..\" for each directory in $ac_dir_suffix.\n  ac_top_builddir_sub=`$as_echo \"$ac_dir_suffix\" | sed 's|/[^\\\\/]*|/..|g;s|/||'`\n  case $ac_top_builddir_sub in\n  \"\") ac_top_builddir_sub=. ac_top_build_prefix= ;;\n  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;\n  esac ;;\nesac\nac_abs_top_builddir=$ac_pwd\nac_abs_builddir=$ac_pwd$ac_dir_suffix\n# for backward compatibility:\nac_top_builddir=$ac_top_build_prefix\n\ncase $srcdir in\n  .)  # We are building in place.\n    ac_srcdir=.\n    ac_top_srcdir=$ac_top_builddir_sub\n    ac_abs_top_srcdir=$ac_pwd ;;\n  [\\\\/]* | ?:[\\\\/]* )  # Absolute name.\n    ac_srcdir=$srcdir$ac_dir_suffix;\n    ac_top_srcdir=$srcdir\n    ac_abs_top_srcdir=$srcdir ;;\n  *) # Relative name.\n    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix\n    ac_top_srcdir=$ac_top_build_prefix$srcdir\n    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;\nesac\nac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix\n\n\n  case $ac_mode in\n  :F)\n  #\n  # CONFIG_FILE\n  #\n\n  case $INSTALL in\n  [\\\\/$]* | ?:[\\\\/]* ) ac_INSTALL=$INSTALL ;;\n  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;\n  esac\n  ac_MKDIR_P=$MKDIR_P\n  case $MKDIR_P in\n  [\\\\/$]* | ?:[\\\\/]* ) ;;\n  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;\n  esac\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n# If the template does not know about datarootdir, expand it.\n# FIXME: This hack should be removed a few years after 2.60.\nac_datarootdir_hack=; ac_datarootdir_seen=\nac_sed_dataroot='\n/datarootdir/ {\n  p\n  q\n}\n/@datadir@/p\n/@docdir@/p\n/@infodir@/p\n/@localedir@/p\n/@mandir@/p'\ncase `eval \"sed -n \\\"\\$ac_sed_dataroot\\\" $ac_file_inputs\"` in\n*datarootdir*) ac_datarootdir_seen=yes;;\n*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting\" >&5\n$as_echo \"$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting\" >&2;}\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n  ac_datarootdir_hack='\n  s&@datadir@&$datadir&g\n  s&@docdir@&$docdir&g\n  s&@infodir@&$infodir&g\n  s&@localedir@&$localedir&g\n  s&@mandir@&$mandir&g\n  s&\\\\\\${datarootdir}&$datarootdir&g' ;;\nesac\n_ACEOF\n\n# Neutralize VPATH when `$srcdir' = `.'.\n# Shell code in configure.ac might set extrasub.\n# FIXME: do we really want to maintain this feature?\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\nac_sed_extra=\"$ac_vpsub\n$extrasub\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n:t\n/@[a-zA-Z_][a-zA-Z_0-9]*@/!b\ns|@configure_input@|$ac_sed_conf_input|;t t\ns&@top_builddir@&$ac_top_builddir_sub&;t t\ns&@top_build_prefix@&$ac_top_build_prefix&;t t\ns&@srcdir@&$ac_srcdir&;t t\ns&@abs_srcdir@&$ac_abs_srcdir&;t t\ns&@top_srcdir@&$ac_top_srcdir&;t t\ns&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t\ns&@builddir@&$ac_builddir&;t t\ns&@abs_builddir@&$ac_abs_builddir&;t t\ns&@abs_top_builddir@&$ac_abs_top_builddir&;t t\ns&@INSTALL@&$ac_INSTALL&;t t\ns&@MKDIR_P@&$ac_MKDIR_P&;t t\n$ac_datarootdir_hack\n\"\neval sed \\\"\\$ac_sed_extra\\\" \"$ac_file_inputs\" | $AWK -f \"$ac_tmp/subs.awk\" \\\n  >$ac_tmp/out || as_fn_error $? \"could not create $ac_file\" \"$LINENO\" 5\n\ntest -z \"$ac_datarootdir_hack$ac_datarootdir_seen\" &&\n  { ac_out=`sed -n '/\\${datarootdir}/p' \"$ac_tmp/out\"`; test -n \"$ac_out\"; } &&\n  { ac_out=`sed -n '/^[\t ]*datarootdir[\t ]*:*=/p' \\\n      \"$ac_tmp/out\"`; test -z \"$ac_out\"; } &&\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \\`datarootdir'\nwhich seems to be undefined.  Please make sure it is defined\" >&5\n$as_echo \"$as_me: WARNING: $ac_file contains a reference to the variable \\`datarootdir'\nwhich seems to be undefined.  Please make sure it is defined\" >&2;}\n\n  rm -f \"$ac_tmp/stdin\"\n  case $ac_file in\n  -) cat \"$ac_tmp/out\" && rm -f \"$ac_tmp/out\";;\n  *) rm -f \"$ac_file\" && mv \"$ac_tmp/out\" \"$ac_file\";;\n  esac \\\n  || as_fn_error $? \"could not create $ac_file\" \"$LINENO\" 5\n ;;\n  :H)\n  #\n  # CONFIG_HEADER\n  #\n  if test x\"$ac_file\" != x-; then\n    {\n      $as_echo \"/* $configure_input  */\" \\\n      && eval '$AWK -f \"$ac_tmp/defines.awk\"' \"$ac_file_inputs\"\n    } >\"$ac_tmp/config.h\" \\\n      || as_fn_error $? \"could not create $ac_file\" \"$LINENO\" 5\n    if diff \"$ac_file\" \"$ac_tmp/config.h\" >/dev/null 2>&1; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: $ac_file is unchanged\" >&5\n$as_echo \"$as_me: $ac_file is unchanged\" >&6;}\n    else\n      rm -f \"$ac_file\"\n      mv \"$ac_tmp/config.h\" \"$ac_file\" \\\n\t|| as_fn_error $? \"could not create $ac_file\" \"$LINENO\" 5\n    fi\n  else\n    $as_echo \"/* $configure_input  */\" \\\n      && eval '$AWK -f \"$ac_tmp/defines.awk\"' \"$ac_file_inputs\" \\\n      || as_fn_error $? \"could not create -\" \"$LINENO\" 5\n  fi\n# Compute \"$ac_file\"'s index in $config_headers.\n_am_arg=\"$ac_file\"\n_am_stamp_count=1\nfor _am_header in $config_headers :; do\n  case $_am_header in\n    $_am_arg | $_am_arg:* )\n      break ;;\n    * )\n      _am_stamp_count=`expr $_am_stamp_count + 1` ;;\n  esac\ndone\necho \"timestamp for $_am_arg\" >`$as_dirname -- \"$_am_arg\" ||\n$as_expr X\"$_am_arg\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$_am_arg\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$_am_arg\" : 'X\\(//\\)$' \\| \\\n\t X\"$_am_arg\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$_am_arg\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`/stamp-h$_am_stamp_count\n ;;\n\n  :C)  { $as_echo \"$as_me:${as_lineno-$LINENO}: executing $ac_file commands\" >&5\n$as_echo \"$as_me: executing $ac_file commands\" >&6;}\n ;;\n  esac\n\n\n  case $ac_file$ac_mode in\n    \"scripts/gtest-config\":F) chmod +x scripts/gtest-config ;;\n    \"depfiles\":C) test x\"$AMDEP_TRUE\" != x\"\" || {\n  # Autoconf 2.62 quotes --file arguments for eval, but not when files\n  # are listed without --file.  Let's play safe and only enable the eval\n  # if we detect the quoting.\n  case $CONFIG_FILES in\n  *\\'*) eval set x \"$CONFIG_FILES\" ;;\n  *)   set x $CONFIG_FILES ;;\n  esac\n  shift\n  for mf\n  do\n    # Strip MF so we end up with the name of the file.\n    mf=`echo \"$mf\" | sed -e 's/:.*$//'`\n    # Check whether this is an Automake generated Makefile or not.\n    # We used to match only the files named `Makefile.in', but\n    # some people rename them; so instead we look at the file content.\n    # Grep'ing the first line is not enough: some people post-process\n    # each Makefile.in and add a new line on top of each file to say so.\n    # Grep'ing the whole file is not good either: AIX grep has a line\n    # limit of 2048, but all sed's we know have understand at least 4000.\n    if sed -n 's,^#.*generated by automake.*,X,p' \"$mf\" | grep X >/dev/null 2>&1; then\n      dirpart=`$as_dirname -- \"$mf\" ||\n$as_expr X\"$mf\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$mf\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$mf\" : 'X\\(//\\)$' \\| \\\n\t X\"$mf\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$mf\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n    else\n      continue\n    fi\n    # Extract the definition of DEPDIR, am__include, and am__quote\n    # from the Makefile without running `make'.\n    DEPDIR=`sed -n 's/^DEPDIR = //p' < \"$mf\"`\n    test -z \"$DEPDIR\" && continue\n    am__include=`sed -n 's/^am__include = //p' < \"$mf\"`\n    test -z \"am__include\" && continue\n    am__quote=`sed -n 's/^am__quote = //p' < \"$mf\"`\n    # When using ansi2knr, U may be empty or an underscore; expand it\n    U=`sed -n 's/^U = //p' < \"$mf\"`\n    # Find all dependency output files, they are included files with\n    # $(DEPDIR) in their names.  We invoke sed twice because it is the\n    # simplest approach to changing $(DEPDIR) to its actual value in the\n    # expansion.\n    for file in `sed -n \"\n      s/^$am__include $am__quote\\(.*(DEPDIR).*\\)$am__quote\"'$/\\1/p' <\"$mf\" | \\\n\t sed -e 's/\\$(DEPDIR)/'\"$DEPDIR\"'/g' -e 's/\\$U/'\"$U\"'/g'`; do\n      # Make sure the directory exists.\n      test -f \"$dirpart/$file\" && continue\n      fdir=`$as_dirname -- \"$file\" ||\n$as_expr X\"$file\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$file\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$file\" : 'X\\(//\\)$' \\| \\\n\t X\"$file\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$file\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n      as_dir=$dirpart/$fdir; as_fn_mkdir_p\n      # echo \"creating $dirpart/$file\"\n      echo '# dummy' > \"$dirpart/$file\"\n    done\n  done\n}\n ;;\n    \"libtool\":C)\n\n    # See if we are running on zsh, and set the options which allow our\n    # commands through without removal of \\ escapes.\n    if test -n \"${ZSH_VERSION+set}\" ; then\n      setopt NO_GLOB_SUBST\n    fi\n\n    cfgfile=\"${ofile}T\"\n    trap \"$RM \\\"$cfgfile\\\"; exit 1\" 1 2 15\n    $RM \"$cfgfile\"\n\n    cat <<_LT_EOF >> \"$cfgfile\"\n#! $SHELL\n\n# `$ECHO \"$ofile\" | sed 's%^.*/%%'` - Provide generalized library-building support services.\n# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION\n# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:\n# NOTE: Changes made to this file will be lost: look at ltmain.sh.\n#\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software\n#                 Foundation, Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n#   This file is part of GNU Libtool.\n#\n# GNU Libtool is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 2 of\n# the License, or (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html, or\n# obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n\n# The names of the tagged configurations supported by this script.\navailable_tags=\"CXX \"\n\n# ### BEGIN LIBTOOL CONFIG\n\n# Which release of libtool.m4 was used?\nmacro_version=$macro_version\nmacro_revision=$macro_revision\n\n# Whether or not to build shared libraries.\nbuild_libtool_libs=$enable_shared\n\n# Whether or not to build static libraries.\nbuild_old_libs=$enable_static\n\n# What type of objects to build.\npic_mode=$pic_mode\n\n# Whether or not to optimize for fast installation.\nfast_install=$enable_fast_install\n\n# Shell to use when invoking shell scripts.\nSHELL=$lt_SHELL\n\n# An echo program that protects backslashes.\nECHO=$lt_ECHO\n\n# The PATH separator for the build system.\nPATH_SEPARATOR=$lt_PATH_SEPARATOR\n\n# The host system.\nhost_alias=$host_alias\nhost=$host\nhost_os=$host_os\n\n# The build system.\nbuild_alias=$build_alias\nbuild=$build\nbuild_os=$build_os\n\n# A sed program that does not truncate output.\nSED=$lt_SED\n\n# Sed that helps us avoid accidentally triggering echo(1) options like -n.\nXsed=\"\\$SED -e 1s/^X//\"\n\n# A grep program that handles long lines.\nGREP=$lt_GREP\n\n# An ERE matcher.\nEGREP=$lt_EGREP\n\n# A literal string matcher.\nFGREP=$lt_FGREP\n\n# A BSD- or MS-compatible name lister.\nNM=$lt_NM\n\n# Whether we need soft or hard links.\nLN_S=$lt_LN_S\n\n# What is the maximum length of a command?\nmax_cmd_len=$max_cmd_len\n\n# Object file suffix (normally \"o\").\nobjext=$ac_objext\n\n# Executable file suffix (normally \"\").\nexeext=$exeext\n\n# whether the shell understands \"unset\".\nlt_unset=$lt_unset\n\n# turn spaces into newlines.\nSP2NL=$lt_lt_SP2NL\n\n# turn newlines into spaces.\nNL2SP=$lt_lt_NL2SP\n\n# convert \\$build file names to \\$host format.\nto_host_file_cmd=$lt_cv_to_host_file_cmd\n\n# convert \\$build files to toolchain format.\nto_tool_file_cmd=$lt_cv_to_tool_file_cmd\n\n# An object symbol dumper.\nOBJDUMP=$lt_OBJDUMP\n\n# Method to check whether dependent libraries are shared objects.\ndeplibs_check_method=$lt_deplibs_check_method\n\n# Command to use when deplibs_check_method = \"file_magic\".\nfile_magic_cmd=$lt_file_magic_cmd\n\n# How to find potential files when deplibs_check_method = \"file_magic\".\nfile_magic_glob=$lt_file_magic_glob\n\n# Find potential files using nocaseglob when deplibs_check_method = \"file_magic\".\nwant_nocaseglob=$lt_want_nocaseglob\n\n# DLL creation program.\nDLLTOOL=$lt_DLLTOOL\n\n# Command to associate shared and link libraries.\nsharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd\n\n# The archiver.\nAR=$lt_AR\n\n# Flags to create an archive.\nAR_FLAGS=$lt_AR_FLAGS\n\n# How to feed a file listing to the archiver.\narchiver_list_spec=$lt_archiver_list_spec\n\n# A symbol stripping program.\nSTRIP=$lt_STRIP\n\n# Commands used to install an old-style archive.\nRANLIB=$lt_RANLIB\nold_postinstall_cmds=$lt_old_postinstall_cmds\nold_postuninstall_cmds=$lt_old_postuninstall_cmds\n\n# Whether to use a lock for old archive extraction.\nlock_old_archive_extraction=$lock_old_archive_extraction\n\n# A C compiler.\nLTCC=$lt_CC\n\n# LTCC compiler flags.\nLTCFLAGS=$lt_CFLAGS\n\n# Take the output of nm and produce a listing of raw symbols and C names.\nglobal_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe\n\n# Transform the output of nm in a proper C declaration.\nglobal_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl\n\n# Transform the output of nm in a C name address pair.\nglobal_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address\n\n# Transform the output of nm in a C name address pair when lib prefix is needed.\nglobal_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix\n\n# Specify filename containing input files for \\$NM.\nnm_file_list_spec=$lt_nm_file_list_spec\n\n# The root where to search for dependent libraries,and in which our libraries should be installed.\nlt_sysroot=$lt_sysroot\n\n# The name of the directory that contains temporary libtool files.\nobjdir=$objdir\n\n# Used to examine libraries when file_magic_cmd begins with \"file\".\nMAGIC_CMD=$MAGIC_CMD\n\n# Must we lock files when doing compilation?\nneed_locks=$lt_need_locks\n\n# Manifest tool.\nMANIFEST_TOOL=$lt_MANIFEST_TOOL\n\n# Tool to manipulate archived DWARF debug symbol files on Mac OS X.\nDSYMUTIL=$lt_DSYMUTIL\n\n# Tool to change global to local symbols on Mac OS X.\nNMEDIT=$lt_NMEDIT\n\n# Tool to manipulate fat objects and archives on Mac OS X.\nLIPO=$lt_LIPO\n\n# ldd/readelf like tool for Mach-O binaries on Mac OS X.\nOTOOL=$lt_OTOOL\n\n# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.\nOTOOL64=$lt_OTOOL64\n\n# Old archive suffix (normally \"a\").\nlibext=$libext\n\n# Shared library suffix (normally \".so\").\nshrext_cmds=$lt_shrext_cmds\n\n# The commands to extract the exported symbol list from a shared archive.\nextract_expsyms_cmds=$lt_extract_expsyms_cmds\n\n# Variables whose values should be saved in libtool wrapper scripts and\n# restored at link time.\nvariables_saved_for_relink=$lt_variables_saved_for_relink\n\n# Do we need the \"lib\" prefix for modules?\nneed_lib_prefix=$need_lib_prefix\n\n# Do we need a version for libraries?\nneed_version=$need_version\n\n# Library versioning type.\nversion_type=$version_type\n\n# Shared library runtime path variable.\nrunpath_var=$runpath_var\n\n# Shared library path variable.\nshlibpath_var=$shlibpath_var\n\n# Is shlibpath searched before the hard-coded library search path?\nshlibpath_overrides_runpath=$shlibpath_overrides_runpath\n\n# Format of library name prefix.\nlibname_spec=$lt_libname_spec\n\n# List of archive names.  First name is the real one, the rest are links.\n# The last name is the one that the linker finds with -lNAME\nlibrary_names_spec=$lt_library_names_spec\n\n# The coded name of the library, if different from the real name.\nsoname_spec=$lt_soname_spec\n\n# Permission mode override for installation of shared libraries.\ninstall_override_mode=$lt_install_override_mode\n\n# Command to use after installation of a shared archive.\npostinstall_cmds=$lt_postinstall_cmds\n\n# Command to use after uninstallation of a shared archive.\npostuninstall_cmds=$lt_postuninstall_cmds\n\n# Commands used to finish a libtool library installation in a directory.\nfinish_cmds=$lt_finish_cmds\n\n# As \"finish_cmds\", except a single script fragment to be evaled but\n# not shown.\nfinish_eval=$lt_finish_eval\n\n# Whether we should hardcode library paths into libraries.\nhardcode_into_libs=$hardcode_into_libs\n\n# Compile-time system search path for libraries.\nsys_lib_search_path_spec=$lt_sys_lib_search_path_spec\n\n# Run-time system search path for libraries.\nsys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec\n\n# Whether dlopen is supported.\ndlopen_support=$enable_dlopen\n\n# Whether dlopen of programs is supported.\ndlopen_self=$enable_dlopen_self\n\n# Whether dlopen of statically linked programs is supported.\ndlopen_self_static=$enable_dlopen_self_static\n\n# Commands to strip libraries.\nold_striplib=$lt_old_striplib\nstriplib=$lt_striplib\n\n\n# The linker used to build libraries.\nLD=$lt_LD\n\n# How to create reloadable object files.\nreload_flag=$lt_reload_flag\nreload_cmds=$lt_reload_cmds\n\n# Commands used to build an old-style archive.\nold_archive_cmds=$lt_old_archive_cmds\n\n# A language specific compiler.\nCC=$lt_compiler\n\n# Is the compiler the GNU compiler?\nwith_gcc=$GCC\n\n# Compiler flag to turn off builtin functions.\nno_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag\n\n# Additional compiler flags for building library objects.\npic_flag=$lt_lt_prog_compiler_pic\n\n# How to pass a linker flag through the compiler.\nwl=$lt_lt_prog_compiler_wl\n\n# Compiler flag to prevent dynamic linking.\nlink_static_flag=$lt_lt_prog_compiler_static\n\n# Does compiler simultaneously support -c and -o options?\ncompiler_c_o=$lt_lt_cv_prog_compiler_c_o\n\n# Whether or not to add -lc for building shared libraries.\nbuild_libtool_need_lc=$archive_cmds_need_lc\n\n# Whether or not to disallow shared libs when runtime libs are static.\nallow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes\n\n# Compiler flag to allow reflexive dlopens.\nexport_dynamic_flag_spec=$lt_export_dynamic_flag_spec\n\n# Compiler flag to generate shared objects directly from archives.\nwhole_archive_flag_spec=$lt_whole_archive_flag_spec\n\n# Whether the compiler copes with passing no objects directly.\ncompiler_needs_object=$lt_compiler_needs_object\n\n# Create an old-style archive from a shared archive.\nold_archive_from_new_cmds=$lt_old_archive_from_new_cmds\n\n# Create a temporary old-style archive to link instead of a shared archive.\nold_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds\n\n# Commands used to build a shared archive.\narchive_cmds=$lt_archive_cmds\narchive_expsym_cmds=$lt_archive_expsym_cmds\n\n# Commands used to build a loadable module if different from building\n# a shared archive.\nmodule_cmds=$lt_module_cmds\nmodule_expsym_cmds=$lt_module_expsym_cmds\n\n# Whether we are building with GNU ld or not.\nwith_gnu_ld=$lt_with_gnu_ld\n\n# Flag that allows shared libraries with undefined symbols to be built.\nallow_undefined_flag=$lt_allow_undefined_flag\n\n# Flag that enforces no undefined symbols.\nno_undefined_flag=$lt_no_undefined_flag\n\n# Flag to hardcode \\$libdir into a binary during linking.\n# This must work even if \\$libdir does not exist\nhardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec\n\n# Whether we need a single \"-rpath\" flag with a separated argument.\nhardcode_libdir_separator=$lt_hardcode_libdir_separator\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary.\nhardcode_direct=$hardcode_direct\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary and the resulting library dependency is\n# \"absolute\",i.e impossible to change by setting \\${shlibpath_var} if the\n# library is relocated.\nhardcode_direct_absolute=$hardcode_direct_absolute\n\n# Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n# into the resulting binary.\nhardcode_minus_L=$hardcode_minus_L\n\n# Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n# into the resulting binary.\nhardcode_shlibpath_var=$hardcode_shlibpath_var\n\n# Set to \"yes\" if building a shared library automatically hardcodes DIR\n# into the library and all subsequent libraries and executables linked\n# against it.\nhardcode_automatic=$hardcode_automatic\n\n# Set to yes if linker adds runtime paths of dependent libraries\n# to runtime path list.\ninherit_rpath=$inherit_rpath\n\n# Whether libtool must link a program against all its dependency libraries.\nlink_all_deplibs=$link_all_deplibs\n\n# Set to \"yes\" if exported symbols are required.\nalways_export_symbols=$always_export_symbols\n\n# The commands to list exported symbols.\nexport_symbols_cmds=$lt_export_symbols_cmds\n\n# Symbols that should not be listed in the preloaded symbols.\nexclude_expsyms=$lt_exclude_expsyms\n\n# Symbols that must always be exported.\ninclude_expsyms=$lt_include_expsyms\n\n# Commands necessary for linking programs (against libraries) with templates.\nprelink_cmds=$lt_prelink_cmds\n\n# Commands necessary for finishing linking programs.\npostlink_cmds=$lt_postlink_cmds\n\n# Specify filename containing input files.\nfile_list_spec=$lt_file_list_spec\n\n# How to hardcode a shared library path into an executable.\nhardcode_action=$hardcode_action\n\n# The directories searched by this compiler when creating a shared library.\ncompiler_lib_search_dirs=$lt_compiler_lib_search_dirs\n\n# Dependencies to place before and after the objects being linked to\n# create a shared library.\npredep_objects=$lt_predep_objects\npostdep_objects=$lt_postdep_objects\npredeps=$lt_predeps\npostdeps=$lt_postdeps\n\n# The library search path used internally by the compiler when linking\n# a shared library.\ncompiler_lib_search_path=$lt_compiler_lib_search_path\n\n# ### END LIBTOOL CONFIG\n\n_LT_EOF\n\n  case $host_os in\n  aix3*)\n    cat <<\\_LT_EOF >> \"$cfgfile\"\n# AIX sometimes has problems with the GCC collect2 program.  For some\n# reason, if we set the COLLECT_NAMES environment variable, the problems\n# vanish in a puff of smoke.\nif test \"X${COLLECT_NAMES+set}\" != Xset; then\n  COLLECT_NAMES=\n  export COLLECT_NAMES\nfi\n_LT_EOF\n    ;;\n  esac\n\n\nltmain=\"$ac_aux_dir/ltmain.sh\"\n\n\n  # We use sed instead of cat because bash on DJGPP gets confused if\n  # if finds mixed CR/LF and LF-only lines.  Since sed operates in\n  # text mode, it properly converts lines to CR/LF.  This bash problem\n  # is reportedly fixed, but why not run on old versions too?\n  sed '$q' \"$ltmain\" >> \"$cfgfile\" \\\n     || (rm -f \"$cfgfile\"; exit 1)\n\n  if test x\"$xsi_shell\" = xyes; then\n  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\\\nfunc_dirname ()\\\n{\\\n\\    case ${1} in\\\n\\      */*) func_dirname_result=\"${1%/*}${2}\" ;;\\\n\\      *  ) func_dirname_result=\"${3}\" ;;\\\n\\    esac\\\n} # Extended-shell func_dirname implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_basename ()$/,/^} # func_basename /c\\\nfunc_basename ()\\\n{\\\n\\    func_basename_result=\"${1##*/}\"\\\n} # Extended-shell func_basename implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\\\nfunc_dirname_and_basename ()\\\n{\\\n\\    case ${1} in\\\n\\      */*) func_dirname_result=\"${1%/*}${2}\" ;;\\\n\\      *  ) func_dirname_result=\"${3}\" ;;\\\n\\    esac\\\n\\    func_basename_result=\"${1##*/}\"\\\n} # Extended-shell func_dirname_and_basename implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\\\nfunc_stripname ()\\\n{\\\n\\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\\\n\\    # positional parameters, so assign one to ordinary parameter first.\\\n\\    func_stripname_result=${3}\\\n\\    func_stripname_result=${func_stripname_result#\"${1}\"}\\\n\\    func_stripname_result=${func_stripname_result%\"${2}\"}\\\n} # Extended-shell func_stripname implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\\\nfunc_split_long_opt ()\\\n{\\\n\\    func_split_long_opt_name=${1%%=*}\\\n\\    func_split_long_opt_arg=${1#*=}\\\n} # Extended-shell func_split_long_opt implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\\\nfunc_split_short_opt ()\\\n{\\\n\\    func_split_short_opt_arg=${1#??}\\\n\\    func_split_short_opt_name=${1%\"$func_split_short_opt_arg\"}\\\n} # Extended-shell func_split_short_opt implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\\\nfunc_lo2o ()\\\n{\\\n\\    case ${1} in\\\n\\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\\\n\\      *)    func_lo2o_result=${1} ;;\\\n\\    esac\\\n} # Extended-shell func_lo2o implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_xform ()$/,/^} # func_xform /c\\\nfunc_xform ()\\\n{\\\n    func_xform_result=${1%.*}.lo\\\n} # Extended-shell func_xform implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_arith ()$/,/^} # func_arith /c\\\nfunc_arith ()\\\n{\\\n    func_arith_result=$(( $* ))\\\n} # Extended-shell func_arith implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_len ()$/,/^} # func_len /c\\\nfunc_len ()\\\n{\\\n    func_len_result=${#1}\\\n} # Extended-shell func_len implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\nfi\n\nif test x\"$lt_shell_append\" = xyes; then\n  sed -e '/^func_append ()$/,/^} # func_append /c\\\nfunc_append ()\\\n{\\\n    eval \"${1}+=\\\\${2}\"\\\n} # Extended-shell func_append implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\\\nfunc_append_quoted ()\\\n{\\\n\\    func_quote_for_eval \"${2}\"\\\n\\    eval \"${1}+=\\\\\\\\ \\\\$func_quote_for_eval_result\"\\\n} # Extended-shell func_append_quoted implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n\n\n  # Save a `func_append' function call where possible by direct use of '+='\n  sed -e 's%func_append \\([a-zA-Z_]\\{1,\\}\\) \"%\\1+=\"%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nelse\n  # Save a `func_append' function call even when '+=' is not available\n  sed -e 's%func_append \\([a-zA-Z_]\\{1,\\}\\) \"%\\1=\"$\\1%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nfi\n\nif test x\"$_lt_function_replace_fail\" = x\":\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile\" >&5\n$as_echo \"$as_me: WARNING: Unable to substitute extended shell functions in $ofile\" >&2;}\nfi\n\n\n   mv -f \"$cfgfile\" \"$ofile\" ||\n    (rm -f \"$ofile\" && cp \"$cfgfile\" \"$ofile\" && rm -f \"$cfgfile\")\n  chmod +x \"$ofile\"\n\n\n    cat <<_LT_EOF >> \"$ofile\"\n\n# ### BEGIN LIBTOOL TAG CONFIG: CXX\n\n# The linker used to build libraries.\nLD=$lt_LD_CXX\n\n# How to create reloadable object files.\nreload_flag=$lt_reload_flag_CXX\nreload_cmds=$lt_reload_cmds_CXX\n\n# Commands used to build an old-style archive.\nold_archive_cmds=$lt_old_archive_cmds_CXX\n\n# A language specific compiler.\nCC=$lt_compiler_CXX\n\n# Is the compiler the GNU compiler?\nwith_gcc=$GCC_CXX\n\n# Compiler flag to turn off builtin functions.\nno_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX\n\n# Additional compiler flags for building library objects.\npic_flag=$lt_lt_prog_compiler_pic_CXX\n\n# How to pass a linker flag through the compiler.\nwl=$lt_lt_prog_compiler_wl_CXX\n\n# Compiler flag to prevent dynamic linking.\nlink_static_flag=$lt_lt_prog_compiler_static_CXX\n\n# Does compiler simultaneously support -c and -o options?\ncompiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX\n\n# Whether or not to add -lc for building shared libraries.\nbuild_libtool_need_lc=$archive_cmds_need_lc_CXX\n\n# Whether or not to disallow shared libs when runtime libs are static.\nallow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX\n\n# Compiler flag to allow reflexive dlopens.\nexport_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX\n\n# Compiler flag to generate shared objects directly from archives.\nwhole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX\n\n# Whether the compiler copes with passing no objects directly.\ncompiler_needs_object=$lt_compiler_needs_object_CXX\n\n# Create an old-style archive from a shared archive.\nold_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX\n\n# Create a temporary old-style archive to link instead of a shared archive.\nold_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX\n\n# Commands used to build a shared archive.\narchive_cmds=$lt_archive_cmds_CXX\narchive_expsym_cmds=$lt_archive_expsym_cmds_CXX\n\n# Commands used to build a loadable module if different from building\n# a shared archive.\nmodule_cmds=$lt_module_cmds_CXX\nmodule_expsym_cmds=$lt_module_expsym_cmds_CXX\n\n# Whether we are building with GNU ld or not.\nwith_gnu_ld=$lt_with_gnu_ld_CXX\n\n# Flag that allows shared libraries with undefined symbols to be built.\nallow_undefined_flag=$lt_allow_undefined_flag_CXX\n\n# Flag that enforces no undefined symbols.\nno_undefined_flag=$lt_no_undefined_flag_CXX\n\n# Flag to hardcode \\$libdir into a binary during linking.\n# This must work even if \\$libdir does not exist\nhardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX\n\n# Whether we need a single \"-rpath\" flag with a separated argument.\nhardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary.\nhardcode_direct=$hardcode_direct_CXX\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary and the resulting library dependency is\n# \"absolute\",i.e impossible to change by setting \\${shlibpath_var} if the\n# library is relocated.\nhardcode_direct_absolute=$hardcode_direct_absolute_CXX\n\n# Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n# into the resulting binary.\nhardcode_minus_L=$hardcode_minus_L_CXX\n\n# Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n# into the resulting binary.\nhardcode_shlibpath_var=$hardcode_shlibpath_var_CXX\n\n# Set to \"yes\" if building a shared library automatically hardcodes DIR\n# into the library and all subsequent libraries and executables linked\n# against it.\nhardcode_automatic=$hardcode_automatic_CXX\n\n# Set to yes if linker adds runtime paths of dependent libraries\n# to runtime path list.\ninherit_rpath=$inherit_rpath_CXX\n\n# Whether libtool must link a program against all its dependency libraries.\nlink_all_deplibs=$link_all_deplibs_CXX\n\n# Set to \"yes\" if exported symbols are required.\nalways_export_symbols=$always_export_symbols_CXX\n\n# The commands to list exported symbols.\nexport_symbols_cmds=$lt_export_symbols_cmds_CXX\n\n# Symbols that should not be listed in the preloaded symbols.\nexclude_expsyms=$lt_exclude_expsyms_CXX\n\n# Symbols that must always be exported.\ninclude_expsyms=$lt_include_expsyms_CXX\n\n# Commands necessary for linking programs (against libraries) with templates.\nprelink_cmds=$lt_prelink_cmds_CXX\n\n# Commands necessary for finishing linking programs.\npostlink_cmds=$lt_postlink_cmds_CXX\n\n# Specify filename containing input files.\nfile_list_spec=$lt_file_list_spec_CXX\n\n# How to hardcode a shared library path into an executable.\nhardcode_action=$hardcode_action_CXX\n\n# The directories searched by this compiler when creating a shared library.\ncompiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX\n\n# Dependencies to place before and after the objects being linked to\n# create a shared library.\npredep_objects=$lt_predep_objects_CXX\npostdep_objects=$lt_postdep_objects_CXX\npredeps=$lt_predeps_CXX\npostdeps=$lt_postdeps_CXX\n\n# The library search path used internally by the compiler when linking\n# a shared library.\ncompiler_lib_search_path=$lt_compiler_lib_search_path_CXX\n\n# ### END LIBTOOL TAG CONFIG: CXX\n_LT_EOF\n\n ;;\n\n  esac\ndone # for ac_tag\n\n\nas_fn_exit 0\n_ACEOF\nac_clean_files=$ac_clean_files_save\n\ntest $ac_write_fail = 0 ||\n  as_fn_error $? \"write failure creating $CONFIG_STATUS\" \"$LINENO\" 5\n\n\n# configure is writing to config.log, and then calls config.status.\n# config.status does its own redirection, appending to config.log.\n# Unfortunately, on DOS this fails, as config.log is still kept open\n# by configure, so config.status won't be able to write to it; its\n# output is simply discarded.  So we exec the FD to /dev/null,\n# effectively closing config.log, so it can be properly (re)opened and\n# appended to by config.status.  When coming back to configure, we\n# need to make the FD available again.\nif test \"$no_create\" != yes; then\n  ac_cs_success=:\n  ac_config_status_args=\n  test \"$silent\" = yes &&\n    ac_config_status_args=\"$ac_config_status_args --quiet\"\n  exec 5>/dev/null\n  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false\n  exec 5>>config.log\n  # Use ||, not &&, to avoid exiting from the if with $? = 1, which\n  # would make configure fail if this is the last instruction.\n  $ac_cs_success || as_fn_exit 1\nfi\nif test -n \"$ac_unrecognized_opts\" && test \"$enable_option_checking\" != no; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts\" >&5\n$as_echo \"$as_me: WARNING: unrecognized options: $ac_unrecognized_opts\" >&2;}\nfi\n\n"
  },
  {
    "path": "Tests/gtest/configure.ac",
    "content": "m4_include(m4/acx_pthread.m4)\n\n# At this point, the Xcode project assumes the version string will be three\n# integers separated by periods and surrounded by square brackets (e.g.\n# \"[1.0.1]\"). It also asumes that there won't be any closing parenthesis\n# between \"AC_INIT(\" and the closing \")\" including comments and strings.\nAC_INIT([Google C++ Testing Framework],\n        [1.7.0],\n        [googletestframework@googlegroups.com],\n        [gtest])\n\n# Provide various options to initialize the Autoconf and configure processes.\nAC_PREREQ([2.59])\nAC_CONFIG_SRCDIR([./LICENSE])\nAC_CONFIG_MACRO_DIR([m4])\nAC_CONFIG_AUX_DIR([build-aux])\nAC_CONFIG_HEADERS([build-aux/config.h])\nAC_CONFIG_FILES([Makefile])\nAC_CONFIG_FILES([scripts/gtest-config], [chmod +x scripts/gtest-config])\n\n# Initialize Automake with various options. We require at least v1.9, prevent\n# pedantic complaints about package files, and enable various distribution\n# targets.\nAM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects])\n\n# Check for programs used in building Google Test.\nAC_PROG_CC\nAC_PROG_CXX\nAC_LANG([C++])\nAC_PROG_LIBTOOL\n\n# TODO(chandlerc@google.com): Currently we aren't running the Python tests\n# against the interpreter detected by AM_PATH_PYTHON, and so we condition\n# HAVE_PYTHON by requiring \"python\" to be in the PATH, and that interpreter's\n# version to be >= 2.3. This will allow the scripts to use a \"/usr/bin/env\"\n# hashbang.\nPYTHON=  # We *do not* allow the user to specify a python interpreter\nAC_PATH_PROG([PYTHON],[python],[:])\nAS_IF([test \"$PYTHON\" != \":\"],\n      [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=\":\"])])\nAM_CONDITIONAL([HAVE_PYTHON],[test \"$PYTHON\" != \":\"])\n\n# Configure pthreads.\nAC_ARG_WITH([pthreads],\n            [AS_HELP_STRING([--with-pthreads],\n               [use pthreads (default is yes)])],\n            [with_pthreads=$withval],\n            [with_pthreads=check])\n\nhave_pthreads=no\nAS_IF([test \"x$with_pthreads\" != \"xno\"],\n      [ACX_PTHREAD(\n        [],\n        [AS_IF([test \"x$with_pthreads\" != \"xcheck\"],\n               [AC_MSG_FAILURE(\n                 [--with-pthreads was specified, but unable to be used])])])\n       have_pthreads=\"$acx_pthread_ok\"])\nAM_CONDITIONAL([HAVE_PTHREADS],[test \"x$have_pthreads\" = \"xyes\"])\nAC_SUBST(PTHREAD_CFLAGS)\nAC_SUBST(PTHREAD_LIBS)\n\n# TODO(chandlerc@google.com) Check for the necessary system headers.\n\n# TODO(chandlerc@google.com) Check the types, structures, and other compiler\n# and architecture characteristics.\n\n# Output the generated files. No further autoconf macros may be used.\nAC_OUTPUT\n"
  },
  {
    "path": "Tests/gtest/fused-src/gtest/gtest-all.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n// Google C++ Testing Framework (Google Test)\n//\n// Sometimes it's desirable to build Google Test by compiling a single file.\n// This file serves this purpose.\n\n// This line ensures that gtest.h can be compiled on its own, even\n// when it's fused.\n#include \"gtest/gtest.h\"\n\n// The following lines pull in the real gtest *.cc files.\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n\n// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Utilities for testing Google Test itself and code that uses Google Test\n// (e.g. frameworks built on top of Google Test).\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_\n#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_\n\n\nnamespace testing {\n\n// This helper class can be used to mock out Google Test failure reporting\n// so that we can test Google Test or code that builds on Google Test.\n//\n// An object of this class appends a TestPartResult object to the\n// TestPartResultArray object given in the constructor whenever a Google Test\n// failure is reported. It can either intercept only failures that are\n// generated in the same thread that created this object or it can intercept\n// all generated failures. The scope of this mock object can be controlled with\n// the second argument to the two arguments constructor.\nclass GTEST_API_ ScopedFakeTestPartResultReporter\n    : public TestPartResultReporterInterface {\n public:\n  // The two possible mocking modes of this object.\n  enum InterceptMode {\n    INTERCEPT_ONLY_CURRENT_THREAD,  // Intercepts only thread local failures.\n    INTERCEPT_ALL_THREADS           // Intercepts all failures.\n  };\n\n  // The c'tor sets this object as the test part result reporter used\n  // by Google Test.  The 'result' parameter specifies where to report the\n  // results. This reporter will only catch failures generated in the current\n  // thread. DEPRECATED\n  explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);\n\n  // Same as above, but you can choose the interception scope of this object.\n  ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,\n                                   TestPartResultArray* result);\n\n  // The d'tor restores the previous test part result reporter.\n  virtual ~ScopedFakeTestPartResultReporter();\n\n  // Appends the TestPartResult object to the TestPartResultArray\n  // received in the constructor.\n  //\n  // This method is from the TestPartResultReporterInterface\n  // interface.\n  virtual void ReportTestPartResult(const TestPartResult& result);\n private:\n  void Init();\n\n  const InterceptMode intercept_mode_;\n  TestPartResultReporterInterface* old_reporter_;\n  TestPartResultArray* const result_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);\n};\n\nnamespace internal {\n\n// A helper class for implementing EXPECT_FATAL_FAILURE() and\n// EXPECT_NONFATAL_FAILURE().  Its destructor verifies that the given\n// TestPartResultArray contains exactly one failure that has the given\n// type and contains the given substring.  If that's not the case, a\n// non-fatal failure will be generated.\nclass GTEST_API_ SingleFailureChecker {\n public:\n  // The constructor remembers the arguments.\n  SingleFailureChecker(const TestPartResultArray* results,\n                       TestPartResult::Type type,\n                       const string& substr);\n  ~SingleFailureChecker();\n private:\n  const TestPartResultArray* const results_;\n  const TestPartResult::Type type_;\n  const string substr_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);\n};\n\n}  // namespace internal\n\n}  // namespace testing\n\n// A set of macros for testing Google Test assertions or code that's expected\n// to generate Google Test fatal failures.  It verifies that the given\n// statement will cause exactly one fatal Google Test failure with 'substr'\n// being part of the failure message.\n//\n// There are two different versions of this macro. EXPECT_FATAL_FAILURE only\n// affects and considers failures generated in the current thread and\n// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.\n//\n// The verification of the assertion is done correctly even when the statement\n// throws an exception or aborts the current function.\n//\n// Known restrictions:\n//   - 'statement' cannot reference local non-static variables or\n//     non-static members of the current object.\n//   - 'statement' cannot return a value.\n//   - You cannot stream a failure message to this macro.\n//\n// Note that even though the implementations of the following two\n// macros are much alike, we cannot refactor them to use a common\n// helper macro, due to some peculiarity in how the preprocessor\n// works.  The AcceptsMacroThatExpandsToUnprotectedComma test in\n// gtest_unittest.cc will fail to compile if we do that.\n#define EXPECT_FATAL_FAILURE(statement, substr) \\\n  do { \\\n    class GTestExpectFatalFailureHelper {\\\n     public:\\\n      static void Execute() { statement; }\\\n    };\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter:: \\\n          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\\\n      GTestExpectFatalFailureHelper::Execute();\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \\\n  do { \\\n    class GTestExpectFatalFailureHelper {\\\n     public:\\\n      static void Execute() { statement; }\\\n    };\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter:: \\\n          INTERCEPT_ALL_THREADS, &gtest_failures);\\\n      GTestExpectFatalFailureHelper::Execute();\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n// A macro for testing Google Test assertions or code that's expected to\n// generate Google Test non-fatal failures.  It asserts that the given\n// statement will cause exactly one non-fatal Google Test failure with 'substr'\n// being part of the failure message.\n//\n// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only\n// affects and considers failures generated in the current thread and\n// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.\n//\n// 'statement' is allowed to reference local variables and members of\n// the current object.\n//\n// The verification of the assertion is done correctly even when the statement\n// throws an exception or aborts the current function.\n//\n// Known restrictions:\n//   - You cannot stream a failure message to this macro.\n//\n// Note that even though the implementations of the following two\n// macros are much alike, we cannot refactor them to use a common\n// helper macro, due to some peculiarity in how the preprocessor\n// works.  If we do that, the code won't compile when the user gives\n// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that\n// expands to code containing an unprotected comma.  The\n// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc\n// catches that.\n//\n// For the same reason, we have to write\n//   if (::testing::internal::AlwaysTrue()) { statement; }\n// instead of\n//   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)\n// to avoid an MSVC warning on unreachable code.\n#define EXPECT_NONFATAL_FAILURE(statement, substr) \\\n  do {\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \\\n        (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter:: \\\n          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\\\n      if (::testing::internal::AlwaysTrue()) { statement; }\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \\\n  do {\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \\\n        (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \\\n          &gtest_failures);\\\n      if (::testing::internal::AlwaysTrue()) { statement; }\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_SPI_H_\n\n#include <ctype.h>\n#include <math.h>\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n#include <wchar.h>\n#include <wctype.h>\n\n#include <algorithm>\n#include <iomanip>\n#include <limits>\n#include <ostream>  // NOLINT\n#include <sstream>\n#include <vector>\n\n#if GTEST_OS_LINUX\n\n// TODO(kenton@google.com): Use autoconf to detect availability of\n// gettimeofday().\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n\n# include <fcntl.h>  // NOLINT\n# include <limits.h>  // NOLINT\n# include <sched.h>  // NOLINT\n// Declares vsnprintf().  This header is not available on Windows.\n# include <strings.h>  // NOLINT\n# include <sys/mman.h>  // NOLINT\n# include <sys/time.h>  // NOLINT\n# include <unistd.h>  // NOLINT\n# include <string>\n\n#elif GTEST_OS_SYMBIAN\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n# include <sys/time.h>  // NOLINT\n\n#elif GTEST_OS_ZOS\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n# include <sys/time.h>  // NOLINT\n\n// On z/OS we additionally need strings.h for strcasecmp.\n# include <strings.h>  // NOLINT\n\n#elif GTEST_OS_WINDOWS_MOBILE  // We are on Windows CE.\n\n# include <windows.h>  // NOLINT\n\n#elif GTEST_OS_WINDOWS  // We are on Windows proper.\n\n# include <io.h>  // NOLINT\n# include <sys/timeb.h>  // NOLINT\n# include <sys/types.h>  // NOLINT\n# include <sys/stat.h>  // NOLINT\n\n# if GTEST_OS_WINDOWS_MINGW\n// MinGW has gettimeofday() but not _ftime64().\n// TODO(kenton@google.com): Use autoconf to detect availability of\n//   gettimeofday().\n// TODO(kenton@google.com): There are other ways to get the time on\n//   Windows, like GetTickCount() or GetSystemTimeAsFileTime().  MinGW\n//   supports these.  consider using them instead.\n#  define GTEST_HAS_GETTIMEOFDAY_ 1\n#  include <sys/time.h>  // NOLINT\n# endif  // GTEST_OS_WINDOWS_MINGW\n\n// cpplint thinks that the header is already included, so we want to\n// silence it.\n# include <windows.h>  // NOLINT\n\n#else\n\n// Assume other platforms have gettimeofday().\n// TODO(kenton@google.com): Use autoconf to detect availability of\n//   gettimeofday().\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n\n// cpplint thinks that the header is already included, so we want to\n// silence it.\n# include <sys/time.h>  // NOLINT\n# include <unistd.h>  // NOLINT\n\n#endif  // GTEST_OS_LINUX\n\n#if GTEST_HAS_EXCEPTIONS\n# include <stdexcept>\n#endif\n\n#if GTEST_CAN_STREAM_RESULTS_\n# include <arpa/inet.h>  // NOLINT\n# include <netdb.h>  // NOLINT\n#endif\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Utility functions and classes used by the Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// This file contains purely Google Test's internal implementation.  Please\n// DO NOT #INCLUDE IT IN A USER PROGRAM.\n\n#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_\n#define GTEST_SRC_GTEST_INTERNAL_INL_H_\n\n// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is\n// part of Google Test's implementation; otherwise it's undefined.\n#if !GTEST_IMPLEMENTATION_\n// A user is trying to include this from his code - just say no.\n# error \"gtest-internal-inl.h is part of Google Test's internal implementation.\"\n# error \"It must not be included except by Google Test itself.\"\n#endif  // GTEST_IMPLEMENTATION_\n\n#ifndef _WIN32_WCE\n# include <errno.h>\n#endif  // !_WIN32_WCE\n#include <stddef.h>\n#include <stdlib.h>  // For strtoll/_strtoul64/malloc/free.\n#include <string.h>  // For memmove.\n\n#include <algorithm>\n#include <string>\n#include <vector>\n\n\n#if GTEST_CAN_STREAM_RESULTS_\n# include <arpa/inet.h>  // NOLINT\n# include <netdb.h>  // NOLINT\n#endif\n\n#if GTEST_OS_WINDOWS\n# include <windows.h>  // NOLINT\n#endif  // GTEST_OS_WINDOWS\n\n\nnamespace testing {\n\n// Declares the flags.\n//\n// We don't want the users to modify this flag in the code, but want\n// Google Test's own unit tests to be able to access it. Therefore we\n// declare it here as opposed to in gtest.h.\nGTEST_DECLARE_bool_(death_test_use_fork);\n\nnamespace internal {\n\n// The value of GetTestTypeId() as seen from within the Google Test\n// library.  This is solely for testing GetTestTypeId().\nGTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;\n\n// Names of the flags (needed for parsing Google Test flags).\nconst char kAlsoRunDisabledTestsFlag[] = \"also_run_disabled_tests\";\nconst char kBreakOnFailureFlag[] = \"break_on_failure\";\nconst char kCatchExceptionsFlag[] = \"catch_exceptions\";\nconst char kColorFlag[] = \"color\";\nconst char kFilterFlag[] = \"filter\";\nconst char kListTestsFlag[] = \"list_tests\";\nconst char kOutputFlag[] = \"output\";\nconst char kPrintTimeFlag[] = \"print_time\";\nconst char kRandomSeedFlag[] = \"random_seed\";\nconst char kRepeatFlag[] = \"repeat\";\nconst char kShuffleFlag[] = \"shuffle\";\nconst char kStackTraceDepthFlag[] = \"stack_trace_depth\";\nconst char kStreamResultToFlag[] = \"stream_result_to\";\nconst char kThrowOnFailureFlag[] = \"throw_on_failure\";\n\n// A valid random seed must be in [1, kMaxRandomSeed].\nconst int kMaxRandomSeed = 99999;\n\n// g_help_flag is true iff the --help flag or an equivalent form is\n// specified on the command line.\nGTEST_API_ extern bool g_help_flag;\n\n// Returns the current time in milliseconds.\nGTEST_API_ TimeInMillis GetTimeInMillis();\n\n// Returns true iff Google Test should use colors in the output.\nGTEST_API_ bool ShouldUseColor(bool stdout_is_tty);\n\n// Formats the given time in milliseconds as seconds.\nGTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);\n\n// Converts the given time in milliseconds to a date string in the ISO 8601\n// format, without the timezone information.  N.B.: due to the use the\n// non-reentrant localtime() function, this function is not thread safe.  Do\n// not use it in any code that can be called from multiple threads.\nGTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);\n\n// Parses a string for an Int32 flag, in the form of \"--flag=value\".\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nGTEST_API_ bool ParseInt32Flag(\n    const char* str, const char* flag, Int32* value);\n\n// Returns a random seed in range [1, kMaxRandomSeed] based on the\n// given --gtest_random_seed flag value.\ninline int GetRandomSeedFromFlag(Int32 random_seed_flag) {\n  const unsigned int raw_seed = (random_seed_flag == 0) ?\n      static_cast<unsigned int>(GetTimeInMillis()) :\n      static_cast<unsigned int>(random_seed_flag);\n\n  // Normalizes the actual seed to range [1, kMaxRandomSeed] such that\n  // it's easy to type.\n  const int normalized_seed =\n      static_cast<int>((raw_seed - 1U) %\n                       static_cast<unsigned int>(kMaxRandomSeed)) + 1;\n  return normalized_seed;\n}\n\n// Returns the first valid random seed after 'seed'.  The behavior is\n// undefined if 'seed' is invalid.  The seed after kMaxRandomSeed is\n// considered to be 1.\ninline int GetNextRandomSeed(int seed) {\n  GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)\n      << \"Invalid random seed \" << seed << \" - must be in [1, \"\n      << kMaxRandomSeed << \"].\";\n  const int next_seed = seed + 1;\n  return (next_seed > kMaxRandomSeed) ? 1 : next_seed;\n}\n\n// This class saves the values of all Google Test flags in its c'tor, and\n// restores them in its d'tor.\nclass GTestFlagSaver {\n public:\n  // The c'tor.\n  GTestFlagSaver() {\n    also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);\n    break_on_failure_ = GTEST_FLAG(break_on_failure);\n    catch_exceptions_ = GTEST_FLAG(catch_exceptions);\n    color_ = GTEST_FLAG(color);\n    death_test_style_ = GTEST_FLAG(death_test_style);\n    death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);\n    filter_ = GTEST_FLAG(filter);\n    internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);\n    list_tests_ = GTEST_FLAG(list_tests);\n    output_ = GTEST_FLAG(output);\n    print_time_ = GTEST_FLAG(print_time);\n    random_seed_ = GTEST_FLAG(random_seed);\n    repeat_ = GTEST_FLAG(repeat);\n    shuffle_ = GTEST_FLAG(shuffle);\n    stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);\n    stream_result_to_ = GTEST_FLAG(stream_result_to);\n    throw_on_failure_ = GTEST_FLAG(throw_on_failure);\n  }\n\n  // The d'tor is not virtual.  DO NOT INHERIT FROM THIS CLASS.\n  ~GTestFlagSaver() {\n    GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;\n    GTEST_FLAG(break_on_failure) = break_on_failure_;\n    GTEST_FLAG(catch_exceptions) = catch_exceptions_;\n    GTEST_FLAG(color) = color_;\n    GTEST_FLAG(death_test_style) = death_test_style_;\n    GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;\n    GTEST_FLAG(filter) = filter_;\n    GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;\n    GTEST_FLAG(list_tests) = list_tests_;\n    GTEST_FLAG(output) = output_;\n    GTEST_FLAG(print_time) = print_time_;\n    GTEST_FLAG(random_seed) = random_seed_;\n    GTEST_FLAG(repeat) = repeat_;\n    GTEST_FLAG(shuffle) = shuffle_;\n    GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;\n    GTEST_FLAG(stream_result_to) = stream_result_to_;\n    GTEST_FLAG(throw_on_failure) = throw_on_failure_;\n  }\n\n private:\n  // Fields for saving the original values of flags.\n  bool also_run_disabled_tests_;\n  bool break_on_failure_;\n  bool catch_exceptions_;\n  std::string color_;\n  std::string death_test_style_;\n  bool death_test_use_fork_;\n  std::string filter_;\n  std::string internal_run_death_test_;\n  bool list_tests_;\n  std::string output_;\n  bool print_time_;\n  internal::Int32 random_seed_;\n  internal::Int32 repeat_;\n  bool shuffle_;\n  internal::Int32 stack_trace_depth_;\n  std::string stream_result_to_;\n  bool throw_on_failure_;\n} GTEST_ATTRIBUTE_UNUSED_;\n\n// Converts a Unicode code point to a narrow string in UTF-8 encoding.\n// code_point parameter is of type UInt32 because wchar_t may not be\n// wide enough to contain a code point.\n// If the code_point is not a valid Unicode code point\n// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted\n// to \"(Invalid Unicode 0xXXXXXXXX)\".\nGTEST_API_ std::string CodePointToUtf8(UInt32 code_point);\n\n// Converts a wide string to a narrow string in UTF-8 encoding.\n// The wide string is assumed to have the following encoding:\n//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)\n//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)\n// Parameter str points to a null-terminated wide string.\n// Parameter num_chars may additionally limit the number\n// of wchar_t characters processed. -1 is used when the entire string\n// should be processed.\n// If the string contains code points that are not valid Unicode code points\n// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output\n// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding\n// and contains invalid UTF-16 surrogate pairs, values in those pairs\n// will be encoded as individual Unicode characters from Basic Normal Plane.\nGTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);\n\n// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file\n// if the variable is present. If a file already exists at this location, this\n// function will write over it. If the variable is present, but the file cannot\n// be created, prints an error and exits.\nvoid WriteToShardStatusFileIfNeeded();\n\n// Checks whether sharding is enabled by examining the relevant\n// environment variable values. If the variables are present,\n// but inconsistent (e.g., shard_index >= total_shards), prints\n// an error and exits. If in_subprocess_for_death_test, sharding is\n// disabled because it must only be applied to the original test\n// process. Otherwise, we could filter out death tests we intended to execute.\nGTEST_API_ bool ShouldShard(const char* total_shards_str,\n                            const char* shard_index_str,\n                            bool in_subprocess_for_death_test);\n\n// Parses the environment variable var as an Int32. If it is unset,\n// returns default_val. If it is not an Int32, prints an error and\n// and aborts.\nGTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);\n\n// Given the total number of shards, the shard index, and the test id,\n// returns true iff the test should be run on this shard. The test id is\n// some arbitrary but unique non-negative integer assigned to each test\n// method. Assumes that 0 <= shard_index < total_shards.\nGTEST_API_ bool ShouldRunTestOnShard(\n    int total_shards, int shard_index, int test_id);\n\n// STL container utilities.\n\n// Returns the number of elements in the given container that satisfy\n// the given predicate.\ntemplate <class Container, typename Predicate>\ninline int CountIf(const Container& c, Predicate predicate) {\n  // Implemented as an explicit loop since std::count_if() in libCstd on\n  // Solaris has a non-standard signature.\n  int count = 0;\n  for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {\n    if (predicate(*it))\n      ++count;\n  }\n  return count;\n}\n\n// Applies a function/functor to each element in the container.\ntemplate <class Container, typename Functor>\nvoid ForEach(const Container& c, Functor functor) {\n  std::for_each(c.begin(), c.end(), functor);\n}\n\n// Returns the i-th element of the vector, or default_value if i is not\n// in range [0, v.size()).\ntemplate <typename E>\ninline E GetElementOr(const std::vector<E>& v, int i, E default_value) {\n  return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];\n}\n\n// Performs an in-place shuffle of a range of the vector's elements.\n// 'begin' and 'end' are element indices as an STL-style range;\n// i.e. [begin, end) are shuffled, where 'end' == size() means to\n// shuffle to the end of the vector.\ntemplate <typename E>\nvoid ShuffleRange(internal::Random* random, int begin, int end,\n                  std::vector<E>* v) {\n  const int size = static_cast<int>(v->size());\n  GTEST_CHECK_(0 <= begin && begin <= size)\n      << \"Invalid shuffle range start \" << begin << \": must be in range [0, \"\n      << size << \"].\";\n  GTEST_CHECK_(begin <= end && end <= size)\n      << \"Invalid shuffle range finish \" << end << \": must be in range [\"\n      << begin << \", \" << size << \"].\";\n\n  // Fisher-Yates shuffle, from\n  // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle\n  for (int range_width = end - begin; range_width >= 2; range_width--) {\n    const int last_in_range = begin + range_width - 1;\n    const int selected = begin + random->Generate(range_width);\n    std::swap((*v)[selected], (*v)[last_in_range]);\n  }\n}\n\n// Performs an in-place shuffle of the vector's elements.\ntemplate <typename E>\ninline void Shuffle(internal::Random* random, std::vector<E>* v) {\n  ShuffleRange(random, 0, static_cast<int>(v->size()), v);\n}\n\n// A function for deleting an object.  Handy for being used as a\n// functor.\ntemplate <typename T>\nstatic void Delete(T* x) {\n  delete x;\n}\n\n// A predicate that checks the key of a TestProperty against a known key.\n//\n// TestPropertyKeyIs is copyable.\nclass TestPropertyKeyIs {\n public:\n  // Constructor.\n  //\n  // TestPropertyKeyIs has NO default constructor.\n  explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}\n\n  // Returns true iff the test name of test property matches on key_.\n  bool operator()(const TestProperty& test_property) const {\n    return test_property.key() == key_;\n  }\n\n private:\n  std::string key_;\n};\n\n// Class UnitTestOptions.\n//\n// This class contains functions for processing options the user\n// specifies when running the tests.  It has only static members.\n//\n// In most cases, the user can specify an option using either an\n// environment variable or a command line flag.  E.g. you can set the\n// test filter using either GTEST_FILTER or --gtest_filter.  If both\n// the variable and the flag are present, the latter overrides the\n// former.\nclass GTEST_API_ UnitTestOptions {\n public:\n  // Functions for processing the gtest_output flag.\n\n  // Returns the output format, or \"\" for normal printed output.\n  static std::string GetOutputFormat();\n\n  // Returns the absolute path of the requested output file, or the\n  // default (test_detail.xml in the original working directory) if\n  // none was explicitly specified.\n  static std::string GetAbsolutePathToOutputFile();\n\n  // Functions for processing the gtest_filter flag.\n\n  // Returns true iff the wildcard pattern matches the string.  The\n  // first ':' or '\\0' character in pattern marks the end of it.\n  //\n  // This recursive algorithm isn't very efficient, but is clear and\n  // works well enough for matching test names, which are short.\n  static bool PatternMatchesString(const char *pattern, const char *str);\n\n  // Returns true iff the user-specified filter matches the test case\n  // name and the test name.\n  static bool FilterMatchesTest(const std::string &test_case_name,\n                                const std::string &test_name);\n\n#if GTEST_OS_WINDOWS\n  // Function for supporting the gtest_catch_exception flag.\n\n  // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the\n  // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.\n  // This function is useful as an __except condition.\n  static int GTestShouldProcessSEH(DWORD exception_code);\n#endif  // GTEST_OS_WINDOWS\n\n  // Returns true if \"name\" matches the ':' separated list of glob-style\n  // filters in \"filter\".\n  static bool MatchesFilter(const std::string& name, const char* filter);\n};\n\n// Returns the current application's name, removing directory path if that\n// is present.  Used by UnitTestOptions::GetOutputFile.\nGTEST_API_ FilePath GetCurrentExecutableName();\n\n// The role interface for getting the OS stack trace as a string.\nclass OsStackTraceGetterInterface {\n public:\n  OsStackTraceGetterInterface() {}\n  virtual ~OsStackTraceGetterInterface() {}\n\n  // Returns the current OS stack trace as an std::string.  Parameters:\n  //\n  //   max_depth  - the maximum number of stack frames to be included\n  //                in the trace.\n  //   skip_count - the number of top frames to be skipped; doesn't count\n  //                against max_depth.\n  virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;\n\n  // UponLeavingGTest() should be called immediately before Google Test calls\n  // user code. It saves some information about the current stack that\n  // CurrentStackTrace() will use to find and hide Google Test stack frames.\n  virtual void UponLeavingGTest() = 0;\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);\n};\n\n// A working implementation of the OsStackTraceGetterInterface interface.\nclass OsStackTraceGetter : public OsStackTraceGetterInterface {\n public:\n  OsStackTraceGetter() : caller_frame_(NULL) {}\n\n  virtual string CurrentStackTrace(int max_depth, int skip_count)\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // This string is inserted in place of stack frames that are part of\n  // Google Test's implementation.\n  static const char* const kElidedFramesMarker;\n\n private:\n  Mutex mutex_;  // protects all internal state\n\n  // We save the stack frame below the frame that calls user code.\n  // We do this because the address of the frame immediately below\n  // the user code changes between the call to UponLeavingGTest()\n  // and any calls to CurrentStackTrace() from within the user code.\n  void* caller_frame_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);\n};\n\n// Information about a Google Test trace point.\nstruct TraceInfo {\n  const char* file;\n  int line;\n  std::string message;\n};\n\n// This is the default global test part result reporter used in UnitTestImpl.\n// This class should only be used by UnitTestImpl.\nclass DefaultGlobalTestPartResultReporter\n  : public TestPartResultReporterInterface {\n public:\n  explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);\n  // Implements the TestPartResultReporterInterface. Reports the test part\n  // result in the current test.\n  virtual void ReportTestPartResult(const TestPartResult& result);\n\n private:\n  UnitTestImpl* const unit_test_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);\n};\n\n// This is the default per thread test part result reporter used in\n// UnitTestImpl. This class should only be used by UnitTestImpl.\nclass DefaultPerThreadTestPartResultReporter\n    : public TestPartResultReporterInterface {\n public:\n  explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);\n  // Implements the TestPartResultReporterInterface. The implementation just\n  // delegates to the current global test part result reporter of *unit_test_.\n  virtual void ReportTestPartResult(const TestPartResult& result);\n\n private:\n  UnitTestImpl* const unit_test_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);\n};\n\n// The private implementation of the UnitTest class.  We don't protect\n// the methods under a mutex, as this class is not accessible by a\n// user and the UnitTest class that delegates work to this class does\n// proper locking.\nclass GTEST_API_ UnitTestImpl {\n public:\n  explicit UnitTestImpl(UnitTest* parent);\n  virtual ~UnitTestImpl();\n\n  // There are two different ways to register your own TestPartResultReporter.\n  // You can register your own repoter to listen either only for test results\n  // from the current thread or for results from all threads.\n  // By default, each per-thread test result repoter just passes a new\n  // TestPartResult to the global test result reporter, which registers the\n  // test part result for the currently running test.\n\n  // Returns the global test part result reporter.\n  TestPartResultReporterInterface* GetGlobalTestPartResultReporter();\n\n  // Sets the global test part result reporter.\n  void SetGlobalTestPartResultReporter(\n      TestPartResultReporterInterface* reporter);\n\n  // Returns the test part result reporter for the current thread.\n  TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();\n\n  // Sets the test part result reporter for the current thread.\n  void SetTestPartResultReporterForCurrentThread(\n      TestPartResultReporterInterface* reporter);\n\n  // Gets the number of successful test cases.\n  int successful_test_case_count() const;\n\n  // Gets the number of failed test cases.\n  int failed_test_case_count() const;\n\n  // Gets the number of all test cases.\n  int total_test_case_count() const;\n\n  // Gets the number of all test cases that contain at least one test\n  // that should run.\n  int test_case_to_run_count() const;\n\n  // Gets the number of successful tests.\n  int successful_test_count() const;\n\n  // Gets the number of failed tests.\n  int failed_test_count() const;\n\n  // Gets the number of disabled tests that will be reported in the XML report.\n  int reportable_disabled_test_count() const;\n\n  // Gets the number of disabled tests.\n  int disabled_test_count() const;\n\n  // Gets the number of tests to be printed in the XML report.\n  int reportable_test_count() const;\n\n  // Gets the number of all tests.\n  int total_test_count() const;\n\n  // Gets the number of tests that should run.\n  int test_to_run_count() const;\n\n  // Gets the time of the test program start, in ms from the start of the\n  // UNIX epoch.\n  TimeInMillis start_timestamp() const { return start_timestamp_; }\n\n  // Gets the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const { return elapsed_time_; }\n\n  // Returns true iff the unit test passed (i.e. all test cases passed).\n  bool Passed() const { return !Failed(); }\n\n  // Returns true iff the unit test failed (i.e. some test case failed\n  // or something outside of all tests failed).\n  bool Failed() const {\n    return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();\n  }\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  const TestCase* GetTestCase(int i) const {\n    const int index = GetElementOr(test_case_indices_, i, -1);\n    return index < 0 ? NULL : test_cases_[i];\n  }\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  TestCase* GetMutableTestCase(int i) {\n    const int index = GetElementOr(test_case_indices_, i, -1);\n    return index < 0 ? NULL : test_cases_[index];\n  }\n\n  // Provides access to the event listener list.\n  TestEventListeners* listeners() { return &listeners_; }\n\n  // Returns the TestResult for the test that's currently running, or\n  // the TestResult for the ad hoc test if no test is running.\n  TestResult* current_test_result();\n\n  // Returns the TestResult for the ad hoc test.\n  const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }\n\n  // Sets the OS stack trace getter.\n  //\n  // Does nothing if the input and the current OS stack trace getter\n  // are the same; otherwise, deletes the old getter and makes the\n  // input the current getter.\n  void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);\n\n  // Returns the current OS stack trace getter if it is not NULL;\n  // otherwise, creates an OsStackTraceGetter, makes it the current\n  // getter, and returns it.\n  OsStackTraceGetterInterface* os_stack_trace_getter();\n\n  // Returns the current OS stack trace as an std::string.\n  //\n  // The maximum number of stack frames to be included is specified by\n  // the gtest_stack_trace_depth flag.  The skip_count parameter\n  // specifies the number of top frames to be skipped, which doesn't\n  // count against the number of frames to be included.\n  //\n  // For example, if Foo() calls Bar(), which in turn calls\n  // CurrentOsStackTraceExceptTop(1), Foo() will be included in the\n  // trace but Bar() and CurrentOsStackTraceExceptTop() won't.\n  std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;\n\n  // Finds and returns a TestCase with the given name.  If one doesn't\n  // exist, creates one and returns it.\n  //\n  // Arguments:\n  //\n  //   test_case_name: name of the test case\n  //   type_param:     the name of the test's type parameter, or NULL if\n  //                   this is not a typed or a type-parameterized test.\n  //   set_up_tc:      pointer to the function that sets up the test case\n  //   tear_down_tc:   pointer to the function that tears down the test case\n  TestCase* GetTestCase(const char* test_case_name,\n                        const char* type_param,\n                        Test::SetUpTestCaseFunc set_up_tc,\n                        Test::TearDownTestCaseFunc tear_down_tc);\n\n  // Adds a TestInfo to the unit test.\n  //\n  // Arguments:\n  //\n  //   set_up_tc:    pointer to the function that sets up the test case\n  //   tear_down_tc: pointer to the function that tears down the test case\n  //   test_info:    the TestInfo object\n  void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,\n                   Test::TearDownTestCaseFunc tear_down_tc,\n                   TestInfo* test_info) {\n    // In order to support thread-safe death tests, we need to\n    // remember the original working directory when the test program\n    // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as\n    // the user may have changed the current directory before calling\n    // RUN_ALL_TESTS().  Therefore we capture the current directory in\n    // AddTestInfo(), which is called to register a TEST or TEST_F\n    // before main() is reached.\n    if (original_working_dir_.IsEmpty()) {\n      original_working_dir_.Set(FilePath::GetCurrentDir());\n      GTEST_CHECK_(!original_working_dir_.IsEmpty())\n          << \"Failed to get the current working directory.\";\n    }\n\n    GetTestCase(test_info->test_case_name(),\n                test_info->type_param(),\n                set_up_tc,\n                tear_down_tc)->AddTestInfo(test_info);\n  }\n\n#if GTEST_HAS_PARAM_TEST\n  // Returns ParameterizedTestCaseRegistry object used to keep track of\n  // value-parameterized tests and instantiate and register them.\n  internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {\n    return parameterized_test_registry_;\n  }\n#endif  // GTEST_HAS_PARAM_TEST\n\n  // Sets the TestCase object for the test that's currently running.\n  void set_current_test_case(TestCase* a_current_test_case) {\n    current_test_case_ = a_current_test_case;\n  }\n\n  // Sets the TestInfo object for the test that's currently running.  If\n  // current_test_info is NULL, the assertion results will be stored in\n  // ad_hoc_test_result_.\n  void set_current_test_info(TestInfo* a_current_test_info) {\n    current_test_info_ = a_current_test_info;\n  }\n\n  // Registers all parameterized tests defined using TEST_P and\n  // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter\n  // combination. This method can be called more then once; it has guards\n  // protecting from registering the tests more then once.  If\n  // value-parameterized tests are disabled, RegisterParameterizedTests is\n  // present but does nothing.\n  void RegisterParameterizedTests();\n\n  // Runs all tests in this UnitTest object, prints the result, and\n  // returns true if all tests are successful.  If any exception is\n  // thrown during a test, this test is considered to be failed, but\n  // the rest of the tests will still be run.\n  bool RunAllTests();\n\n  // Clears the results of all tests, except the ad hoc tests.\n  void ClearNonAdHocTestResult() {\n    ForEach(test_cases_, TestCase::ClearTestCaseResult);\n  }\n\n  // Clears the results of ad-hoc test assertions.\n  void ClearAdHocTestResult() {\n    ad_hoc_test_result_.Clear();\n  }\n\n  // Adds a TestProperty to the current TestResult object when invoked in a\n  // context of a test or a test case, or to the global property set. If the\n  // result already contains a property with the same key, the value will be\n  // updated.\n  void RecordProperty(const TestProperty& test_property);\n\n  enum ReactionToSharding {\n    HONOR_SHARDING_PROTOCOL,\n    IGNORE_SHARDING_PROTOCOL\n  };\n\n  // Matches the full name of each test against the user-specified\n  // filter to decide whether the test should run, then records the\n  // result in each TestCase and TestInfo object.\n  // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests\n  // based on sharding variables in the environment.\n  // Returns the number of tests that should run.\n  int FilterTests(ReactionToSharding shard_tests);\n\n  // Prints the names of the tests matching the user-specified filter flag.\n  void ListTestsMatchingFilter();\n\n  const TestCase* current_test_case() const { return current_test_case_; }\n  TestInfo* current_test_info() { return current_test_info_; }\n  const TestInfo* current_test_info() const { return current_test_info_; }\n\n  // Returns the vector of environments that need to be set-up/torn-down\n  // before/after the tests are run.\n  std::vector<Environment*>& environments() { return environments_; }\n\n  // Getters for the per-thread Google Test trace stack.\n  std::vector<TraceInfo>& gtest_trace_stack() {\n    return *(gtest_trace_stack_.pointer());\n  }\n  const std::vector<TraceInfo>& gtest_trace_stack() const {\n    return gtest_trace_stack_.get();\n  }\n\n#if GTEST_HAS_DEATH_TEST\n  void InitDeathTestSubprocessControlInfo() {\n    internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());\n  }\n  // Returns a pointer to the parsed --gtest_internal_run_death_test\n  // flag, or NULL if that flag was not specified.\n  // This information is useful only in a death test child process.\n  // Must not be called before a call to InitGoogleTest.\n  const InternalRunDeathTestFlag* internal_run_death_test_flag() const {\n    return internal_run_death_test_flag_.get();\n  }\n\n  // Returns a pointer to the current death test factory.\n  internal::DeathTestFactory* death_test_factory() {\n    return death_test_factory_.get();\n  }\n\n  void SuppressTestEventsIfInSubprocess();\n\n  friend class ReplaceDeathTestFactory;\n#endif  // GTEST_HAS_DEATH_TEST\n\n  // Initializes the event listener performing XML output as specified by\n  // UnitTestOptions. Must not be called before InitGoogleTest.\n  void ConfigureXmlOutput();\n\n#if GTEST_CAN_STREAM_RESULTS_\n  // Initializes the event listener for streaming test results to a socket.\n  // Must not be called before InitGoogleTest.\n  void ConfigureStreamingOutput();\n#endif\n\n  // Performs initialization dependent upon flag values obtained in\n  // ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to\n  // ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest\n  // this function is also called from RunAllTests.  Since this function can be\n  // called more than once, it has to be idempotent.\n  void PostFlagParsingInit();\n\n  // Gets the random seed used at the start of the current test iteration.\n  int random_seed() const { return random_seed_; }\n\n  // Gets the random number generator.\n  internal::Random* random() { return &random_; }\n\n  // Shuffles all test cases, and the tests within each test case,\n  // making sure that death tests are still run first.\n  void ShuffleTests();\n\n  // Restores the test cases and tests to their order before the first shuffle.\n  void UnshuffleTests();\n\n  // Returns the value of GTEST_FLAG(catch_exceptions) at the moment\n  // UnitTest::Run() starts.\n  bool catch_exceptions() const { return catch_exceptions_; }\n\n private:\n  friend class ::testing::UnitTest;\n\n  // Used by UnitTest::Run() to capture the state of\n  // GTEST_FLAG(catch_exceptions) at the moment it starts.\n  void set_catch_exceptions(bool value) { catch_exceptions_ = value; }\n\n  // The UnitTest object that owns this implementation object.\n  UnitTest* const parent_;\n\n  // The working directory when the first TEST() or TEST_F() was\n  // executed.\n  internal::FilePath original_working_dir_;\n\n  // The default test part result reporters.\n  DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;\n  DefaultPerThreadTestPartResultReporter\n      default_per_thread_test_part_result_reporter_;\n\n  // Points to (but doesn't own) the global test part result reporter.\n  TestPartResultReporterInterface* global_test_part_result_repoter_;\n\n  // Protects read and write access to global_test_part_result_reporter_.\n  internal::Mutex global_test_part_result_reporter_mutex_;\n\n  // Points to (but doesn't own) the per-thread test part result reporter.\n  internal::ThreadLocal<TestPartResultReporterInterface*>\n      per_thread_test_part_result_reporter_;\n\n  // The vector of environments that need to be set-up/torn-down\n  // before/after the tests are run.\n  std::vector<Environment*> environments_;\n\n  // The vector of TestCases in their original order.  It owns the\n  // elements in the vector.\n  std::vector<TestCase*> test_cases_;\n\n  // Provides a level of indirection for the test case list to allow\n  // easy shuffling and restoring the test case order.  The i-th\n  // element of this vector is the index of the i-th test case in the\n  // shuffled order.\n  std::vector<int> test_case_indices_;\n\n#if GTEST_HAS_PARAM_TEST\n  // ParameterizedTestRegistry object used to register value-parameterized\n  // tests.\n  internal::ParameterizedTestCaseRegistry parameterized_test_registry_;\n\n  // Indicates whether RegisterParameterizedTests() has been called already.\n  bool parameterized_tests_registered_;\n#endif  // GTEST_HAS_PARAM_TEST\n\n  // Index of the last death test case registered.  Initially -1.\n  int last_death_test_case_;\n\n  // This points to the TestCase for the currently running test.  It\n  // changes as Google Test goes through one test case after another.\n  // When no test is running, this is set to NULL and Google Test\n  // stores assertion results in ad_hoc_test_result_.  Initially NULL.\n  TestCase* current_test_case_;\n\n  // This points to the TestInfo for the currently running test.  It\n  // changes as Google Test goes through one test after another.  When\n  // no test is running, this is set to NULL and Google Test stores\n  // assertion results in ad_hoc_test_result_.  Initially NULL.\n  TestInfo* current_test_info_;\n\n  // Normally, a user only writes assertions inside a TEST or TEST_F,\n  // or inside a function called by a TEST or TEST_F.  Since Google\n  // Test keeps track of which test is current running, it can\n  // associate such an assertion with the test it belongs to.\n  //\n  // If an assertion is encountered when no TEST or TEST_F is running,\n  // Google Test attributes the assertion result to an imaginary \"ad hoc\"\n  // test, and records the result in ad_hoc_test_result_.\n  TestResult ad_hoc_test_result_;\n\n  // The list of event listeners that can be used to track events inside\n  // Google Test.\n  TestEventListeners listeners_;\n\n  // The OS stack trace getter.  Will be deleted when the UnitTest\n  // object is destructed.  By default, an OsStackTraceGetter is used,\n  // but the user can set this field to use a custom getter if that is\n  // desired.\n  OsStackTraceGetterInterface* os_stack_trace_getter_;\n\n  // True iff PostFlagParsingInit() has been called.\n  bool post_flag_parse_init_performed_;\n\n  // The random number seed used at the beginning of the test run.\n  int random_seed_;\n\n  // Our random number generator.\n  internal::Random random_;\n\n  // The time of the test program start, in ms from the start of the\n  // UNIX epoch.\n  TimeInMillis start_timestamp_;\n\n  // How long the test took to run, in milliseconds.\n  TimeInMillis elapsed_time_;\n\n#if GTEST_HAS_DEATH_TEST\n  // The decomposed components of the gtest_internal_run_death_test flag,\n  // parsed when RUN_ALL_TESTS is called.\n  internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;\n  internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;\n#endif  // GTEST_HAS_DEATH_TEST\n\n  // A per-thread stack of traces created by the SCOPED_TRACE() macro.\n  internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;\n\n  // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()\n  // starts.\n  bool catch_exceptions_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);\n};  // class UnitTestImpl\n\n// Convenience function for accessing the global UnitTest\n// implementation object.\ninline UnitTestImpl* GetUnitTestImpl() {\n  return UnitTest::GetInstance()->impl();\n}\n\n#if GTEST_USES_SIMPLE_RE\n\n// Internal helper functions for implementing the simple regular\n// expression matcher.\nGTEST_API_ bool IsInSet(char ch, const char* str);\nGTEST_API_ bool IsAsciiDigit(char ch);\nGTEST_API_ bool IsAsciiPunct(char ch);\nGTEST_API_ bool IsRepeat(char ch);\nGTEST_API_ bool IsAsciiWhiteSpace(char ch);\nGTEST_API_ bool IsAsciiWordChar(char ch);\nGTEST_API_ bool IsValidEscape(char ch);\nGTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);\nGTEST_API_ bool ValidateRegex(const char* regex);\nGTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);\nGTEST_API_ bool MatchRepetitionAndRegexAtHead(\n    bool escaped, char ch, char repeat, const char* regex, const char* str);\nGTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);\n\n#endif  // GTEST_USES_SIMPLE_RE\n\n// Parses the command line for Google Test flags, without initializing\n// other parts of Google Test.\nGTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);\nGTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);\n\n#if GTEST_HAS_DEATH_TEST\n\n// Returns the message describing the last system error, regardless of the\n// platform.\nGTEST_API_ std::string GetLastErrnoDescription();\n\n# if GTEST_OS_WINDOWS\n// Provides leak-safe Windows kernel handle ownership.\nclass AutoHandle {\n public:\n  AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}\n  explicit AutoHandle(HANDLE handle) : handle_(handle) {}\n\n  ~AutoHandle() { Reset(); }\n\n  HANDLE Get() const { return handle_; }\n  void Reset() { Reset(INVALID_HANDLE_VALUE); }\n  void Reset(HANDLE handle) {\n    if (handle != handle_) {\n      if (handle_ != INVALID_HANDLE_VALUE)\n        ::CloseHandle(handle_);\n      handle_ = handle;\n    }\n  }\n\n private:\n  HANDLE handle_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);\n};\n# endif  // GTEST_OS_WINDOWS\n\n// Attempts to parse a string into a positive integer pointed to by the\n// number parameter.  Returns true if that is possible.\n// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use\n// it here.\ntemplate <typename Integer>\nbool ParseNaturalNumber(const ::std::string& str, Integer* number) {\n  // Fail fast if the given string does not begin with a digit;\n  // this bypasses strtoXXX's \"optional leading whitespace and plus\n  // or minus sign\" semantics, which are undesirable here.\n  if (str.empty() || !IsDigit(str[0])) {\n    return false;\n  }\n  errno = 0;\n\n  char* end;\n  // BiggestConvertible is the largest integer type that system-provided\n  // string-to-number conversion routines can return.\n\n# if GTEST_OS_WINDOWS && !defined(__GNUC__)\n\n  // MSVC and C++ Builder define __int64 instead of the standard long long.\n  typedef unsigned __int64 BiggestConvertible;\n  const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);\n\n# else\n\n  typedef unsigned long long BiggestConvertible;  // NOLINT\n  const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);\n\n# endif  // GTEST_OS_WINDOWS && !defined(__GNUC__)\n\n  const bool parse_success = *end == '\\0' && errno == 0;\n\n  // TODO(vladl@google.com): Convert this to compile time assertion when it is\n  // available.\n  GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));\n\n  const Integer result = static_cast<Integer>(parsed);\n  if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {\n    *number = result;\n    return true;\n  }\n  return false;\n}\n#endif  // GTEST_HAS_DEATH_TEST\n\n// TestResult contains some private methods that should be hidden from\n// Google Test user but are required for testing. This class allow our tests\n// to access them.\n//\n// This class is supplied only for the purpose of testing Google Test's own\n// constructs. Do not use it in user tests, either directly or indirectly.\nclass TestResultAccessor {\n public:\n  static void RecordProperty(TestResult* test_result,\n                             const std::string& xml_element,\n                             const TestProperty& property) {\n    test_result->RecordProperty(xml_element, property);\n  }\n\n  static void ClearTestPartResults(TestResult* test_result) {\n    test_result->ClearTestPartResults();\n  }\n\n  static const std::vector<testing::TestPartResult>& test_part_results(\n      const TestResult& test_result) {\n    return test_result.test_part_results();\n  }\n};\n\n#if GTEST_CAN_STREAM_RESULTS_\n\n// Streams test results to the given port on the given host machine.\nclass StreamingListener : public EmptyTestEventListener {\n public:\n  // Abstract base class for writing strings to a socket.\n  class AbstractSocketWriter {\n   public:\n    virtual ~AbstractSocketWriter() {}\n\n    // Sends a string to the socket.\n    virtual void Send(const string& message) = 0;\n\n    // Closes the socket.\n    virtual void CloseConnection() {}\n\n    // Sends a string and a newline to the socket.\n    void SendLn(const string& message) {\n      Send(message + \"\\n\");\n    }\n  };\n\n  // Concrete class for actually writing strings to a socket.\n  class SocketWriter : public AbstractSocketWriter {\n   public:\n    SocketWriter(const string& host, const string& port)\n        : sockfd_(-1), host_name_(host), port_num_(port) {\n      MakeConnection();\n    }\n\n    virtual ~SocketWriter() {\n      if (sockfd_ != -1)\n        CloseConnection();\n    }\n\n    // Sends a string to the socket.\n    virtual void Send(const string& message) {\n      GTEST_CHECK_(sockfd_ != -1)\n          << \"Send() can be called only when there is a connection.\";\n\n      const int len = static_cast<int>(message.length());\n      if (write(sockfd_, message.c_str(), len) != len) {\n        GTEST_LOG_(WARNING)\n            << \"stream_result_to: failed to stream to \"\n            << host_name_ << \":\" << port_num_;\n      }\n    }\n\n   private:\n    // Creates a client socket and connects to the server.\n    void MakeConnection();\n\n    // Closes the socket.\n    void CloseConnection() {\n      GTEST_CHECK_(sockfd_ != -1)\n          << \"CloseConnection() can be called only when there is a connection.\";\n\n      close(sockfd_);\n      sockfd_ = -1;\n    }\n\n    int sockfd_;  // socket file descriptor\n    const string host_name_;\n    const string port_num_;\n\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);\n  };  // class SocketWriter\n\n  // Escapes '=', '&', '%', and '\\n' characters in str as \"%xx\".\n  static string UrlEncode(const char* str);\n\n  StreamingListener(const string& host, const string& port)\n      : socket_writer_(new SocketWriter(host, port)) { Start(); }\n\n  explicit StreamingListener(AbstractSocketWriter* socket_writer)\n      : socket_writer_(socket_writer) { Start(); }\n\n  void OnTestProgramStart(const UnitTest& /* unit_test */) {\n    SendLn(\"event=TestProgramStart\");\n  }\n\n  void OnTestProgramEnd(const UnitTest& unit_test) {\n    // Note that Google Test current only report elapsed time for each\n    // test iteration, not for the entire test program.\n    SendLn(\"event=TestProgramEnd&passed=\" + FormatBool(unit_test.Passed()));\n\n    // Notify the streaming server to stop.\n    socket_writer_->CloseConnection();\n  }\n\n  void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {\n    SendLn(\"event=TestIterationStart&iteration=\" +\n           StreamableToString(iteration));\n  }\n\n  void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {\n    SendLn(\"event=TestIterationEnd&passed=\" +\n           FormatBool(unit_test.Passed()) + \"&elapsed_time=\" +\n           StreamableToString(unit_test.elapsed_time()) + \"ms\");\n  }\n\n  void OnTestCaseStart(const TestCase& test_case) {\n    SendLn(std::string(\"event=TestCaseStart&name=\") + test_case.name());\n  }\n\n  void OnTestCaseEnd(const TestCase& test_case) {\n    SendLn(\"event=TestCaseEnd&passed=\" + FormatBool(test_case.Passed())\n           + \"&elapsed_time=\" + StreamableToString(test_case.elapsed_time())\n           + \"ms\");\n  }\n\n  void OnTestStart(const TestInfo& test_info) {\n    SendLn(std::string(\"event=TestStart&name=\") + test_info.name());\n  }\n\n  void OnTestEnd(const TestInfo& test_info) {\n    SendLn(\"event=TestEnd&passed=\" +\n           FormatBool((test_info.result())->Passed()) +\n           \"&elapsed_time=\" +\n           StreamableToString((test_info.result())->elapsed_time()) + \"ms\");\n  }\n\n  void OnTestPartResult(const TestPartResult& test_part_result) {\n    const char* file_name = test_part_result.file_name();\n    if (file_name == NULL)\n      file_name = \"\";\n    SendLn(\"event=TestPartResult&file=\" + UrlEncode(file_name) +\n           \"&line=\" + StreamableToString(test_part_result.line_number()) +\n           \"&message=\" + UrlEncode(test_part_result.message()));\n  }\n\n private:\n  // Sends the given message and a newline to the socket.\n  void SendLn(const string& message) { socket_writer_->SendLn(message); }\n\n  // Called at the start of streaming to notify the receiver what\n  // protocol we are using.\n  void Start() { SendLn(\"gtest_streaming_protocol_version=1.0\"); }\n\n  string FormatBool(bool value) { return value ? \"1\" : \"0\"; }\n\n  const scoped_ptr<AbstractSocketWriter> socket_writer_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);\n};  // class StreamingListener\n\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_SRC_GTEST_INTERNAL_INL_H_\n#undef GTEST_IMPLEMENTATION_\n\n#if GTEST_OS_WINDOWS\n# define vsnprintf _vsnprintf\n#endif  // GTEST_OS_WINDOWS\n\nnamespace testing {\n\nusing internal::CountIf;\nusing internal::ForEach;\nusing internal::GetElementOr;\nusing internal::Shuffle;\n\n// Constants.\n\n// A test whose test case name or test name matches this filter is\n// disabled and not run.\nstatic const char kDisableTestFilter[] = \"DISABLED_*:*/DISABLED_*\";\n\n// A test case whose name matches this filter is considered a death\n// test case and will be run before test cases whose name doesn't\n// match this filter.\nstatic const char kDeathTestCaseFilter[] = \"*DeathTest:*DeathTest/*\";\n\n// A test filter that matches everything.\nstatic const char kUniversalFilter[] = \"*\";\n\n// The default output file for XML output.\nstatic const char kDefaultOutputFile[] = \"test_detail.xml\";\n\n// The environment variable name for the test shard index.\nstatic const char kTestShardIndex[] = \"GTEST_SHARD_INDEX\";\n// The environment variable name for the total number of test shards.\nstatic const char kTestTotalShards[] = \"GTEST_TOTAL_SHARDS\";\n// The environment variable name for the test shard status file.\nstatic const char kTestShardStatusFile[] = \"GTEST_SHARD_STATUS_FILE\";\n\nnamespace internal {\n\n// The text used in failure messages to indicate the start of the\n// stack trace.\nconst char kStackTraceMarker[] = \"\\nStack trace:\\n\";\n\n// g_help_flag is true iff the --help flag or an equivalent form is\n// specified on the command line.\nbool g_help_flag = false;\n\n}  // namespace internal\n\nstatic const char* GetDefaultFilter() {\n  return kUniversalFilter;\n}\n\nGTEST_DEFINE_bool_(\n    also_run_disabled_tests,\n    internal::BoolFromGTestEnv(\"also_run_disabled_tests\", false),\n    \"Run disabled tests too, in addition to the tests normally being run.\");\n\nGTEST_DEFINE_bool_(\n    break_on_failure,\n    internal::BoolFromGTestEnv(\"break_on_failure\", false),\n    \"True iff a failed assertion should be a debugger break-point.\");\n\nGTEST_DEFINE_bool_(\n    catch_exceptions,\n    internal::BoolFromGTestEnv(\"catch_exceptions\", true),\n    \"True iff \" GTEST_NAME_\n    \" should catch exceptions and treat them as test failures.\");\n\nGTEST_DEFINE_string_(\n    color,\n    internal::StringFromGTestEnv(\"color\", \"auto\"),\n    \"Whether to use colors in the output.  Valid values: yes, no, \"\n    \"and auto.  'auto' means to use colors if the output is \"\n    \"being sent to a terminal and the TERM environment variable \"\n    \"is set to a terminal type that supports colors.\");\n\nGTEST_DEFINE_string_(\n    filter,\n    internal::StringFromGTestEnv(\"filter\", GetDefaultFilter()),\n    \"A colon-separated list of glob (not regex) patterns \"\n    \"for filtering the tests to run, optionally followed by a \"\n    \"'-' and a : separated list of negative patterns (tests to \"\n    \"exclude).  A test is run if it matches one of the positive \"\n    \"patterns and does not match any of the negative patterns.\");\n\nGTEST_DEFINE_bool_(list_tests, false,\n                   \"List all tests without running them.\");\n\nGTEST_DEFINE_string_(\n    output,\n    internal::StringFromGTestEnv(\"output\", \"\"),\n    \"A format (currently must be \\\"xml\\\"), optionally followed \"\n    \"by a colon and an output file name or directory. A directory \"\n    \"is indicated by a trailing pathname separator. \"\n    \"Examples: \\\"xml:filename.xml\\\", \\\"xml::directoryname/\\\". \"\n    \"If a directory is specified, output files will be created \"\n    \"within that directory, with file-names based on the test \"\n    \"executable's name and, if necessary, made unique by adding \"\n    \"digits.\");\n\nGTEST_DEFINE_bool_(\n    print_time,\n    internal::BoolFromGTestEnv(\"print_time\", true),\n    \"True iff \" GTEST_NAME_\n    \" should display elapsed time in text output.\");\n\nGTEST_DEFINE_int32_(\n    random_seed,\n    internal::Int32FromGTestEnv(\"random_seed\", 0),\n    \"Random number seed to use when shuffling test orders.  Must be in range \"\n    \"[1, 99999], or 0 to use a seed based on the current time.\");\n\nGTEST_DEFINE_int32_(\n    repeat,\n    internal::Int32FromGTestEnv(\"repeat\", 1),\n    \"How many times to repeat each test.  Specify a negative number \"\n    \"for repeating forever.  Useful for shaking out flaky tests.\");\n\nGTEST_DEFINE_bool_(\n    show_internal_stack_frames, false,\n    \"True iff \" GTEST_NAME_ \" should include internal stack frames when \"\n    \"printing test failure stack traces.\");\n\nGTEST_DEFINE_bool_(\n    shuffle,\n    internal::BoolFromGTestEnv(\"shuffle\", false),\n    \"True iff \" GTEST_NAME_\n    \" should randomize tests' order on every run.\");\n\nGTEST_DEFINE_int32_(\n    stack_trace_depth,\n    internal::Int32FromGTestEnv(\"stack_trace_depth\", kMaxStackTraceDepth),\n    \"The maximum number of stack frames to print when an \"\n    \"assertion fails.  The valid range is 0 through 100, inclusive.\");\n\nGTEST_DEFINE_string_(\n    stream_result_to,\n    internal::StringFromGTestEnv(\"stream_result_to\", \"\"),\n    \"This flag specifies the host name and the port number on which to stream \"\n    \"test results. Example: \\\"localhost:555\\\". The flag is effective only on \"\n    \"Linux.\");\n\nGTEST_DEFINE_bool_(\n    throw_on_failure,\n    internal::BoolFromGTestEnv(\"throw_on_failure\", false),\n    \"When this flag is specified, a failed assertion will throw an exception \"\n    \"if exceptions are enabled or exit the program with a non-zero code \"\n    \"otherwise.\");\n\nnamespace internal {\n\n// Generates a random number from [0, range), using a Linear\n// Congruential Generator (LCG).  Crashes if 'range' is 0 or greater\n// than kMaxRange.\nUInt32 Random::Generate(UInt32 range) {\n  // These constants are the same as are used in glibc's rand(3).\n  state_ = (1103515245U*state_ + 12345U) % kMaxRange;\n\n  GTEST_CHECK_(range > 0)\n      << \"Cannot generate a number in the range [0, 0).\";\n  GTEST_CHECK_(range <= kMaxRange)\n      << \"Generation of a number in [0, \" << range << \") was requested, \"\n      << \"but this can only generate numbers in [0, \" << kMaxRange << \").\";\n\n  // Converting via modulus introduces a bit of downward bias, but\n  // it's simple, and a linear congruential generator isn't too good\n  // to begin with.\n  return state_ % range;\n}\n\n// GTestIsInitialized() returns true iff the user has initialized\n// Google Test.  Useful for catching the user mistake of not initializing\n// Google Test before calling RUN_ALL_TESTS().\n//\n// A user must call testing::InitGoogleTest() to initialize Google\n// Test.  g_init_gtest_count is set to the number of times\n// InitGoogleTest() has been called.  We don't protect this variable\n// under a mutex as it is only accessed in the main thread.\nGTEST_API_ int g_init_gtest_count = 0;\nstatic bool GTestIsInitialized() { return g_init_gtest_count != 0; }\n\n// Iterates over a vector of TestCases, keeping a running sum of the\n// results of calling a given int-returning method on each.\n// Returns the sum.\nstatic int SumOverTestCaseList(const std::vector<TestCase*>& case_list,\n                               int (TestCase::*method)() const) {\n  int sum = 0;\n  for (size_t i = 0; i < case_list.size(); i++) {\n    sum += (case_list[i]->*method)();\n  }\n  return sum;\n}\n\n// Returns true iff the test case passed.\nstatic bool TestCasePassed(const TestCase* test_case) {\n  return test_case->should_run() && test_case->Passed();\n}\n\n// Returns true iff the test case failed.\nstatic bool TestCaseFailed(const TestCase* test_case) {\n  return test_case->should_run() && test_case->Failed();\n}\n\n// Returns true iff test_case contains at least one test that should\n// run.\nstatic bool ShouldRunTestCase(const TestCase* test_case) {\n  return test_case->should_run();\n}\n\n// AssertHelper constructor.\nAssertHelper::AssertHelper(TestPartResult::Type type,\n                           const char* file,\n                           int line,\n                           const char* message)\n    : data_(new AssertHelperData(type, file, line, message)) {\n}\n\nAssertHelper::~AssertHelper() {\n  delete data_;\n}\n\n// Message assignment, for assertion streaming support.\nvoid AssertHelper::operator=(const Message& message) const {\n  UnitTest::GetInstance()->\n    AddTestPartResult(data_->type, data_->file, data_->line,\n                      AppendUserMessage(data_->message, message),\n                      UnitTest::GetInstance()->impl()\n                      ->CurrentOsStackTraceExceptTop(1)\n                      // Skips the stack frame for this function itself.\n                      );  // NOLINT\n}\n\n// Mutex for linked pointers.\nGTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);\n\n// Application pathname gotten in InitGoogleTest.\nstd::string g_executable_path;\n\n// Returns the current application's name, removing directory path if that\n// is present.\nFilePath GetCurrentExecutableName() {\n  FilePath result;\n\n#if GTEST_OS_WINDOWS\n  result.Set(FilePath(g_executable_path).RemoveExtension(\"exe\"));\n#else\n  result.Set(FilePath(g_executable_path));\n#endif  // GTEST_OS_WINDOWS\n\n  return result.RemoveDirectoryName();\n}\n\n// Functions for processing the gtest_output flag.\n\n// Returns the output format, or \"\" for normal printed output.\nstd::string UnitTestOptions::GetOutputFormat() {\n  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();\n  if (gtest_output_flag == NULL) return std::string(\"\");\n\n  const char* const colon = strchr(gtest_output_flag, ':');\n  return (colon == NULL) ?\n      std::string(gtest_output_flag) :\n      std::string(gtest_output_flag, colon - gtest_output_flag);\n}\n\n// Returns the name of the requested output file, or the default if none\n// was explicitly specified.\nstd::string UnitTestOptions::GetAbsolutePathToOutputFile() {\n  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();\n  if (gtest_output_flag == NULL)\n    return \"\";\n\n  const char* const colon = strchr(gtest_output_flag, ':');\n  if (colon == NULL)\n    return internal::FilePath::ConcatPaths(\n        internal::FilePath(\n            UnitTest::GetInstance()->original_working_dir()),\n        internal::FilePath(kDefaultOutputFile)).string();\n\n  internal::FilePath output_name(colon + 1);\n  if (!output_name.IsAbsolutePath())\n    // TODO(wan@google.com): on Windows \\some\\path is not an absolute\n    // path (as its meaning depends on the current drive), yet the\n    // following logic for turning it into an absolute path is wrong.\n    // Fix it.\n    output_name = internal::FilePath::ConcatPaths(\n        internal::FilePath(UnitTest::GetInstance()->original_working_dir()),\n        internal::FilePath(colon + 1));\n\n  if (!output_name.IsDirectory())\n    return output_name.string();\n\n  internal::FilePath result(internal::FilePath::GenerateUniqueFileName(\n      output_name, internal::GetCurrentExecutableName(),\n      GetOutputFormat().c_str()));\n  return result.string();\n}\n\n// Returns true iff the wildcard pattern matches the string.  The\n// first ':' or '\\0' character in pattern marks the end of it.\n//\n// This recursive algorithm isn't very efficient, but is clear and\n// works well enough for matching test names, which are short.\nbool UnitTestOptions::PatternMatchesString(const char *pattern,\n                                           const char *str) {\n  switch (*pattern) {\n    case '\\0':\n    case ':':  // Either ':' or '\\0' marks the end of the pattern.\n      return *str == '\\0';\n    case '?':  // Matches any single character.\n      return *str != '\\0' && PatternMatchesString(pattern + 1, str + 1);\n    case '*':  // Matches any string (possibly empty) of characters.\n      return (*str != '\\0' && PatternMatchesString(pattern, str + 1)) ||\n          PatternMatchesString(pattern + 1, str);\n    default:  // Non-special character.  Matches itself.\n      return *pattern == *str &&\n          PatternMatchesString(pattern + 1, str + 1);\n  }\n}\n\nbool UnitTestOptions::MatchesFilter(\n    const std::string& name, const char* filter) {\n  const char *cur_pattern = filter;\n  for (;;) {\n    if (PatternMatchesString(cur_pattern, name.c_str())) {\n      return true;\n    }\n\n    // Finds the next pattern in the filter.\n    cur_pattern = strchr(cur_pattern, ':');\n\n    // Returns if no more pattern can be found.\n    if (cur_pattern == NULL) {\n      return false;\n    }\n\n    // Skips the pattern separater (the ':' character).\n    cur_pattern++;\n  }\n}\n\n// Returns true iff the user-specified filter matches the test case\n// name and the test name.\nbool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name,\n                                        const std::string &test_name) {\n  const std::string& full_name = test_case_name + \".\" + test_name.c_str();\n\n  // Split --gtest_filter at '-', if there is one, to separate into\n  // positive filter and negative filter portions\n  const char* const p = GTEST_FLAG(filter).c_str();\n  const char* const dash = strchr(p, '-');\n  std::string positive;\n  std::string negative;\n  if (dash == NULL) {\n    positive = GTEST_FLAG(filter).c_str();  // Whole string is a positive filter\n    negative = \"\";\n  } else {\n    positive = std::string(p, dash);   // Everything up to the dash\n    negative = std::string(dash + 1);  // Everything after the dash\n    if (positive.empty()) {\n      // Treat '-test1' as the same as '*-test1'\n      positive = kUniversalFilter;\n    }\n  }\n\n  // A filter is a colon-separated list of patterns.  It matches a\n  // test if any pattern in it matches the test.\n  return (MatchesFilter(full_name, positive.c_str()) &&\n          !MatchesFilter(full_name, negative.c_str()));\n}\n\n#if GTEST_HAS_SEH\n// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the\n// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.\n// This function is useful as an __except condition.\nint UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {\n  // Google Test should handle a SEH exception if:\n  //   1. the user wants it to, AND\n  //   2. this is not a breakpoint exception, AND\n  //   3. this is not a C++ exception (VC++ implements them via SEH,\n  //      apparently).\n  //\n  // SEH exception code for C++ exceptions.\n  // (see http://support.microsoft.com/kb/185294 for more information).\n  const DWORD kCxxExceptionCode = 0xe06d7363;\n\n  bool should_handle = true;\n\n  if (!GTEST_FLAG(catch_exceptions))\n    should_handle = false;\n  else if (exception_code == EXCEPTION_BREAKPOINT)\n    should_handle = false;\n  else if (exception_code == kCxxExceptionCode)\n    should_handle = false;\n\n  return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;\n}\n#endif  // GTEST_HAS_SEH\n\n}  // namespace internal\n\n// The c'tor sets this object as the test part result reporter used by\n// Google Test.  The 'result' parameter specifies where to report the\n// results. Intercepts only failures from the current thread.\nScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(\n    TestPartResultArray* result)\n    : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),\n      result_(result) {\n  Init();\n}\n\n// The c'tor sets this object as the test part result reporter used by\n// Google Test.  The 'result' parameter specifies where to report the\n// results.\nScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(\n    InterceptMode intercept_mode, TestPartResultArray* result)\n    : intercept_mode_(intercept_mode),\n      result_(result) {\n  Init();\n}\n\nvoid ScopedFakeTestPartResultReporter::Init() {\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {\n    old_reporter_ = impl->GetGlobalTestPartResultReporter();\n    impl->SetGlobalTestPartResultReporter(this);\n  } else {\n    old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();\n    impl->SetTestPartResultReporterForCurrentThread(this);\n  }\n}\n\n// The d'tor restores the test part result reporter used by Google Test\n// before.\nScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {\n    impl->SetGlobalTestPartResultReporter(old_reporter_);\n  } else {\n    impl->SetTestPartResultReporterForCurrentThread(old_reporter_);\n  }\n}\n\n// Increments the test part result count and remembers the result.\n// This method is from the TestPartResultReporterInterface interface.\nvoid ScopedFakeTestPartResultReporter::ReportTestPartResult(\n    const TestPartResult& result) {\n  result_->Append(result);\n}\n\nnamespace internal {\n\n// Returns the type ID of ::testing::Test.  We should always call this\n// instead of GetTypeId< ::testing::Test>() to get the type ID of\n// testing::Test.  This is to work around a suspected linker bug when\n// using Google Test as a framework on Mac OS X.  The bug causes\n// GetTypeId< ::testing::Test>() to return different values depending\n// on whether the call is from the Google Test framework itself or\n// from user test code.  GetTestTypeId() is guaranteed to always\n// return the same value, as it always calls GetTypeId<>() from the\n// gtest.cc, which is within the Google Test framework.\nTypeId GetTestTypeId() {\n  return GetTypeId<Test>();\n}\n\n// The value of GetTestTypeId() as seen from within the Google Test\n// library.  This is solely for testing GetTestTypeId().\nextern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();\n\n// This predicate-formatter checks that 'results' contains a test part\n// failure of the given type and that the failure message contains the\n// given substring.\nAssertionResult HasOneFailure(const char* /* results_expr */,\n                              const char* /* type_expr */,\n                              const char* /* substr_expr */,\n                              const TestPartResultArray& results,\n                              TestPartResult::Type type,\n                              const string& substr) {\n  const std::string expected(type == TestPartResult::kFatalFailure ?\n                        \"1 fatal failure\" :\n                        \"1 non-fatal failure\");\n  Message msg;\n  if (results.size() != 1) {\n    msg << \"Expected: \" << expected << \"\\n\"\n        << \"  Actual: \" << results.size() << \" failures\";\n    for (int i = 0; i < results.size(); i++) {\n      msg << \"\\n\" << results.GetTestPartResult(i);\n    }\n    return AssertionFailure() << msg;\n  }\n\n  const TestPartResult& r = results.GetTestPartResult(0);\n  if (r.type() != type) {\n    return AssertionFailure() << \"Expected: \" << expected << \"\\n\"\n                              << \"  Actual:\\n\"\n                              << r;\n  }\n\n  if (strstr(r.message(), substr.c_str()) == NULL) {\n    return AssertionFailure() << \"Expected: \" << expected << \" containing \\\"\"\n                              << substr << \"\\\"\\n\"\n                              << \"  Actual:\\n\"\n                              << r;\n  }\n\n  return AssertionSuccess();\n}\n\n// The constructor of SingleFailureChecker remembers where to look up\n// test part results, what type of failure we expect, and what\n// substring the failure message should contain.\nSingleFailureChecker:: SingleFailureChecker(\n    const TestPartResultArray* results,\n    TestPartResult::Type type,\n    const string& substr)\n    : results_(results),\n      type_(type),\n      substr_(substr) {}\n\n// The destructor of SingleFailureChecker verifies that the given\n// TestPartResultArray contains exactly one failure that has the given\n// type and contains the given substring.  If that's not the case, a\n// non-fatal failure will be generated.\nSingleFailureChecker::~SingleFailureChecker() {\n  EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_);\n}\n\nDefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(\n    UnitTestImpl* unit_test) : unit_test_(unit_test) {}\n\nvoid DefaultGlobalTestPartResultReporter::ReportTestPartResult(\n    const TestPartResult& result) {\n  unit_test_->current_test_result()->AddTestPartResult(result);\n  unit_test_->listeners()->repeater()->OnTestPartResult(result);\n}\n\nDefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(\n    UnitTestImpl* unit_test) : unit_test_(unit_test) {}\n\nvoid DefaultPerThreadTestPartResultReporter::ReportTestPartResult(\n    const TestPartResult& result) {\n  unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);\n}\n\n// Returns the global test part result reporter.\nTestPartResultReporterInterface*\nUnitTestImpl::GetGlobalTestPartResultReporter() {\n  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);\n  return global_test_part_result_repoter_;\n}\n\n// Sets the global test part result reporter.\nvoid UnitTestImpl::SetGlobalTestPartResultReporter(\n    TestPartResultReporterInterface* reporter) {\n  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);\n  global_test_part_result_repoter_ = reporter;\n}\n\n// Returns the test part result reporter for the current thread.\nTestPartResultReporterInterface*\nUnitTestImpl::GetTestPartResultReporterForCurrentThread() {\n  return per_thread_test_part_result_reporter_.get();\n}\n\n// Sets the test part result reporter for the current thread.\nvoid UnitTestImpl::SetTestPartResultReporterForCurrentThread(\n    TestPartResultReporterInterface* reporter) {\n  per_thread_test_part_result_reporter_.set(reporter);\n}\n\n// Gets the number of successful test cases.\nint UnitTestImpl::successful_test_case_count() const {\n  return CountIf(test_cases_, TestCasePassed);\n}\n\n// Gets the number of failed test cases.\nint UnitTestImpl::failed_test_case_count() const {\n  return CountIf(test_cases_, TestCaseFailed);\n}\n\n// Gets the number of all test cases.\nint UnitTestImpl::total_test_case_count() const {\n  return static_cast<int>(test_cases_.size());\n}\n\n// Gets the number of all test cases that contain at least one test\n// that should run.\nint UnitTestImpl::test_case_to_run_count() const {\n  return CountIf(test_cases_, ShouldRunTestCase);\n}\n\n// Gets the number of successful tests.\nint UnitTestImpl::successful_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);\n}\n\n// Gets the number of failed tests.\nint UnitTestImpl::failed_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);\n}\n\n// Gets the number of disabled tests that will be reported in the XML report.\nint UnitTestImpl::reportable_disabled_test_count() const {\n  return SumOverTestCaseList(test_cases_,\n                             &TestCase::reportable_disabled_test_count);\n}\n\n// Gets the number of disabled tests.\nint UnitTestImpl::disabled_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);\n}\n\n// Gets the number of tests to be printed in the XML report.\nint UnitTestImpl::reportable_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count);\n}\n\n// Gets the number of all tests.\nint UnitTestImpl::total_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);\n}\n\n// Gets the number of tests that should run.\nint UnitTestImpl::test_to_run_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);\n}\n\n// Returns the current OS stack trace as an std::string.\n//\n// The maximum number of stack frames to be included is specified by\n// the gtest_stack_trace_depth flag.  The skip_count parameter\n// specifies the number of top frames to be skipped, which doesn't\n// count against the number of frames to be included.\n//\n// For example, if Foo() calls Bar(), which in turn calls\n// CurrentOsStackTraceExceptTop(1), Foo() will be included in the\n// trace but Bar() and CurrentOsStackTraceExceptTop() won't.\nstd::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {\n  (void)skip_count;\n  return \"\";\n}\n\n// Returns the current time in milliseconds.\nTimeInMillis GetTimeInMillis() {\n#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)\n  // Difference between 1970-01-01 and 1601-01-01 in milliseconds.\n  // http://analogous.blogspot.com/2005/04/epoch.html\n  const TimeInMillis kJavaEpochToWinFileTimeDelta =\n    static_cast<TimeInMillis>(116444736UL) * 100000UL;\n  const DWORD kTenthMicrosInMilliSecond = 10000;\n\n  SYSTEMTIME now_systime;\n  FILETIME now_filetime;\n  ULARGE_INTEGER now_int64;\n  // TODO(kenton@google.com): Shouldn't this just use\n  //   GetSystemTimeAsFileTime()?\n  GetSystemTime(&now_systime);\n  if (SystemTimeToFileTime(&now_systime, &now_filetime)) {\n    now_int64.LowPart = now_filetime.dwLowDateTime;\n    now_int64.HighPart = now_filetime.dwHighDateTime;\n    now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -\n      kJavaEpochToWinFileTimeDelta;\n    return now_int64.QuadPart;\n  }\n  return 0;\n#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_\n  __timeb64 now;\n\n# ifdef _MSC_VER\n\n  // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996\n  // (deprecated function) there.\n  // TODO(kenton@google.com): Use GetTickCount()?  Or use\n  //   SystemTimeToFileTime()\n#  pragma warning(push)          // Saves the current warning state.\n#  pragma warning(disable:4996)  // Temporarily disables warning 4996.\n  _ftime64(&now);\n#  pragma warning(pop)           // Restores the warning state.\n# else\n\n  _ftime64(&now);\n\n# endif  // _MSC_VER\n\n  return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;\n#elif GTEST_HAS_GETTIMEOFDAY_\n  struct timeval now;\n  gettimeofday(&now, NULL);\n  return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;\n#else\n# error \"Don't know how to get the current time on your system.\"\n#endif\n}\n\n// Utilities\n\n// class String.\n\n#if GTEST_OS_WINDOWS_MOBILE\n// Creates a UTF-16 wide string from the given ANSI string, allocating\n// memory using new. The caller is responsible for deleting the return\n// value using delete[]. Returns the wide string, or NULL if the\n// input is NULL.\nLPCWSTR String::AnsiToUtf16(const char* ansi) {\n  if (!ansi) return NULL;\n  const int length = strlen(ansi);\n  const int unicode_length =\n      MultiByteToWideChar(CP_ACP, 0, ansi, length,\n                          NULL, 0);\n  WCHAR* unicode = new WCHAR[unicode_length + 1];\n  MultiByteToWideChar(CP_ACP, 0, ansi, length,\n                      unicode, unicode_length);\n  unicode[unicode_length] = 0;\n  return unicode;\n}\n\n// Creates an ANSI string from the given wide string, allocating\n// memory using new. The caller is responsible for deleting the return\n// value using delete[]. Returns the ANSI string, or NULL if the\n// input is NULL.\nconst char* String::Utf16ToAnsi(LPCWSTR utf16_str)  {\n  if (!utf16_str) return NULL;\n  const int ansi_length =\n      WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,\n                          NULL, 0, NULL, NULL);\n  char* ansi = new char[ansi_length + 1];\n  WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,\n                      ansi, ansi_length, NULL, NULL);\n  ansi[ansi_length] = 0;\n  return ansi;\n}\n\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n// Compares two C strings.  Returns true iff they have the same content.\n//\n// Unlike strcmp(), this function can handle NULL argument(s).  A NULL\n// C string is considered different to any non-NULL C string,\n// including the empty string.\nbool String::CStringEquals(const char * lhs, const char * rhs) {\n  if ( lhs == NULL ) return rhs == NULL;\n\n  if ( rhs == NULL ) return false;\n\n  return strcmp(lhs, rhs) == 0;\n}\n\n#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING\n\n// Converts an array of wide chars to a narrow string using the UTF-8\n// encoding, and streams the result to the given Message object.\nstatic void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,\n                                     Message* msg) {\n  for (size_t i = 0; i != length; ) {  // NOLINT\n    if (wstr[i] != L'\\0') {\n      *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));\n      while (i != length && wstr[i] != L'\\0')\n        i++;\n    } else {\n      *msg << '\\0';\n      i++;\n    }\n  }\n}\n\n#endif  // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING\n\n}  // namespace internal\n\n// Constructs an empty Message.\n// We allocate the stringstream separately because otherwise each use of\n// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's\n// stack frame leading to huge stack frames in some cases; gcc does not reuse\n// the stack space.\nMessage::Message() : ss_(new ::std::stringstream) {\n  // By default, we want there to be enough precision when printing\n  // a double to a Message.\n  *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);\n}\n\n// These two overloads allow streaming a wide C string to a Message\n// using the UTF-8 encoding.\nMessage& Message::operator <<(const wchar_t* wide_c_str) {\n  return *this << internal::String::ShowWideCString(wide_c_str);\n}\nMessage& Message::operator <<(wchar_t* wide_c_str) {\n  return *this << internal::String::ShowWideCString(wide_c_str);\n}\n\n#if GTEST_HAS_STD_WSTRING\n// Converts the given wide string to a narrow string using the UTF-8\n// encoding, and streams the result to this Message object.\nMessage& Message::operator <<(const ::std::wstring& wstr) {\n  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);\n  return *this;\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\n// Converts the given wide string to a narrow string using the UTF-8\n// encoding, and streams the result to this Message object.\nMessage& Message::operator <<(const ::wstring& wstr) {\n  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);\n  return *this;\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// Gets the text streamed to this object so far as an std::string.\n// Each '\\0' character in the buffer is replaced with \"\\\\0\".\nstd::string Message::GetString() const {\n  return internal::StringStreamToString(ss_.get());\n}\n\n// AssertionResult constructors.\n// Used in EXPECT_TRUE/FALSE(assertion_result).\nAssertionResult::AssertionResult(const AssertionResult& other)\n    : success_(other.success_),\n      message_(other.message_.get() != NULL ?\n               new ::std::string(*other.message_) :\n               static_cast< ::std::string*>(NULL)) {\n}\n\n// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.\nAssertionResult AssertionResult::operator!() const {\n  AssertionResult negation(!success_);\n  if (message_.get() != NULL)\n    negation << *message_;\n  return negation;\n}\n\n// Makes a successful assertion result.\nAssertionResult AssertionSuccess() {\n  return AssertionResult(true);\n}\n\n// Makes a failed assertion result.\nAssertionResult AssertionFailure() {\n  return AssertionResult(false);\n}\n\n// Makes a failed assertion result with the given failure message.\n// Deprecated; use AssertionFailure() << message.\nAssertionResult AssertionFailure(const Message& message) {\n  return AssertionFailure() << message;\n}\n\nnamespace internal {\n\n// Constructs and returns the message for an equality assertion\n// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.\n//\n// The first four parameters are the expressions used in the assertion\n// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)\n// where foo is 5 and bar is 6, we have:\n//\n//   expected_expression: \"foo\"\n//   actual_expression:   \"bar\"\n//   expected_value:      \"5\"\n//   actual_value:        \"6\"\n//\n// The ignoring_case parameter is true iff the assertion is a\n// *_STRCASEEQ*.  When it's true, the string \" (ignoring case)\" will\n// be inserted into the message.\nAssertionResult EqFailure(const char* expected_expression,\n                          const char* actual_expression,\n                          const std::string& expected_value,\n                          const std::string& actual_value,\n                          bool ignoring_case) {\n  Message msg;\n  msg << \"Value of: \" << actual_expression;\n  if (actual_value != actual_expression) {\n    msg << \"\\n  Actual: \" << actual_value;\n  }\n\n  msg << \"\\nExpected: \" << expected_expression;\n  if (ignoring_case) {\n    msg << \" (ignoring case)\";\n  }\n  if (expected_value != expected_expression) {\n    msg << \"\\nWhich is: \" << expected_value;\n  }\n\n  return AssertionFailure() << msg;\n}\n\n// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.\nstd::string GetBoolAssertionFailureMessage(\n    const AssertionResult& assertion_result,\n    const char* expression_text,\n    const char* actual_predicate_value,\n    const char* expected_predicate_value) {\n  const char* actual_message = assertion_result.message();\n  Message msg;\n  msg << \"Value of: \" << expression_text\n      << \"\\n  Actual: \" << actual_predicate_value;\n  if (actual_message[0] != '\\0')\n    msg << \" (\" << actual_message << \")\";\n  msg << \"\\nExpected: \" << expected_predicate_value;\n  return msg.GetString();\n}\n\n// Helper function for implementing ASSERT_NEAR.\nAssertionResult DoubleNearPredFormat(const char* expr1,\n                                     const char* expr2,\n                                     const char* abs_error_expr,\n                                     double val1,\n                                     double val2,\n                                     double abs_error) {\n  const double diff = fabs(val1 - val2);\n  if (diff <= abs_error) return AssertionSuccess();\n\n  // TODO(wan): do not print the value of an expression if it's\n  // already a literal.\n  return AssertionFailure()\n      << \"The difference between \" << expr1 << \" and \" << expr2\n      << \" is \" << diff << \", which exceeds \" << abs_error_expr << \", where\\n\"\n      << expr1 << \" evaluates to \" << val1 << \",\\n\"\n      << expr2 << \" evaluates to \" << val2 << \", and\\n\"\n      << abs_error_expr << \" evaluates to \" << abs_error << \".\";\n}\n\n\n// Helper template for implementing FloatLE() and DoubleLE().\ntemplate <typename RawType>\nAssertionResult FloatingPointLE(const char* expr1,\n                                const char* expr2,\n                                RawType val1,\n                                RawType val2) {\n  // Returns success if val1 is less than val2,\n  if (val1 < val2) {\n    return AssertionSuccess();\n  }\n\n  // or if val1 is almost equal to val2.\n  const FloatingPoint<RawType> lhs(val1), rhs(val2);\n  if (lhs.AlmostEquals(rhs)) {\n    return AssertionSuccess();\n  }\n\n  // Note that the above two checks will both fail if either val1 or\n  // val2 is NaN, as the IEEE floating-point standard requires that\n  // any predicate involving a NaN must return false.\n\n  ::std::stringstream val1_ss;\n  val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n          << val1;\n\n  ::std::stringstream val2_ss;\n  val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n          << val2;\n\n  return AssertionFailure()\n      << \"Expected: (\" << expr1 << \") <= (\" << expr2 << \")\\n\"\n      << \"  Actual: \" << StringStreamToString(&val1_ss) << \" vs \"\n      << StringStreamToString(&val2_ss);\n}\n\n}  // namespace internal\n\n// Asserts that val1 is less than, or almost equal to, val2.  Fails\n// otherwise.  In particular, it fails if either val1 or val2 is NaN.\nAssertionResult FloatLE(const char* expr1, const char* expr2,\n                        float val1, float val2) {\n  return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);\n}\n\n// Asserts that val1 is less than, or almost equal to, val2.  Fails\n// otherwise.  In particular, it fails if either val1 or val2 is NaN.\nAssertionResult DoubleLE(const char* expr1, const char* expr2,\n                         double val1, double val2) {\n  return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);\n}\n\nnamespace internal {\n\n// The helper function for {ASSERT|EXPECT}_EQ with int or enum\n// arguments.\nAssertionResult CmpHelperEQ(const char* expected_expression,\n                            const char* actual_expression,\n                            BiggestInt expected,\n                            BiggestInt actual) {\n  if (expected == actual) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   FormatForComparisonFailureMessage(expected, actual),\n                   FormatForComparisonFailureMessage(actual, expected),\n                   false);\n}\n\n// A macro for implementing the helper functions needed to implement\n// ASSERT_?? and EXPECT_?? with integer or enum arguments.  It is here\n// just to avoid copy-and-paste of similar code.\n#define GTEST_IMPL_CMP_HELPER_(op_name, op)\\\nAssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \\\n                                   BiggestInt val1, BiggestInt val2) {\\\n  if (val1 op val2) {\\\n    return AssertionSuccess();\\\n  } else {\\\n    return AssertionFailure() \\\n        << \"Expected: (\" << expr1 << \") \" #op \" (\" << expr2\\\n        << \"), actual: \" << FormatForComparisonFailureMessage(val1, val2)\\\n        << \" vs \" << FormatForComparisonFailureMessage(val2, val1);\\\n  }\\\n}\n\n// Implements the helper function for {ASSERT|EXPECT}_NE with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(NE, !=)\n// Implements the helper function for {ASSERT|EXPECT}_LE with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(LE, <=)\n// Implements the helper function for {ASSERT|EXPECT}_LT with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(LT, < )\n// Implements the helper function for {ASSERT|EXPECT}_GE with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(GE, >=)\n// Implements the helper function for {ASSERT|EXPECT}_GT with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(GT, > )\n\n#undef GTEST_IMPL_CMP_HELPER_\n\n// The helper function for {ASSERT|EXPECT}_STREQ.\nAssertionResult CmpHelperSTREQ(const char* expected_expression,\n                               const char* actual_expression,\n                               const char* expected,\n                               const char* actual) {\n  if (String::CStringEquals(expected, actual)) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   PrintToString(expected),\n                   PrintToString(actual),\n                   false);\n}\n\n// The helper function for {ASSERT|EXPECT}_STRCASEEQ.\nAssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,\n                                   const char* actual_expression,\n                                   const char* expected,\n                                   const char* actual) {\n  if (String::CaseInsensitiveCStringEquals(expected, actual)) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   PrintToString(expected),\n                   PrintToString(actual),\n                   true);\n}\n\n// The helper function for {ASSERT|EXPECT}_STRNE.\nAssertionResult CmpHelperSTRNE(const char* s1_expression,\n                               const char* s2_expression,\n                               const char* s1,\n                               const char* s2) {\n  if (!String::CStringEquals(s1, s2)) {\n    return AssertionSuccess();\n  } else {\n    return AssertionFailure() << \"Expected: (\" << s1_expression << \") != (\"\n                              << s2_expression << \"), actual: \\\"\"\n                              << s1 << \"\\\" vs \\\"\" << s2 << \"\\\"\";\n  }\n}\n\n// The helper function for {ASSERT|EXPECT}_STRCASENE.\nAssertionResult CmpHelperSTRCASENE(const char* s1_expression,\n                                   const char* s2_expression,\n                                   const char* s1,\n                                   const char* s2) {\n  if (!String::CaseInsensitiveCStringEquals(s1, s2)) {\n    return AssertionSuccess();\n  } else {\n    return AssertionFailure()\n        << \"Expected: (\" << s1_expression << \") != (\"\n        << s2_expression << \") (ignoring case), actual: \\\"\"\n        << s1 << \"\\\" vs \\\"\" << s2 << \"\\\"\";\n  }\n}\n\n}  // namespace internal\n\nnamespace {\n\n// Helper functions for implementing IsSubString() and IsNotSubstring().\n\n// This group of overloaded functions return true iff needle is a\n// substring of haystack.  NULL is considered a substring of itself\n// only.\n\nbool IsSubstringPred(const char* needle, const char* haystack) {\n  if (needle == NULL || haystack == NULL)\n    return needle == haystack;\n\n  return strstr(haystack, needle) != NULL;\n}\n\nbool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {\n  if (needle == NULL || haystack == NULL)\n    return needle == haystack;\n\n  return wcsstr(haystack, needle) != NULL;\n}\n\n// StringType here can be either ::std::string or ::std::wstring.\ntemplate <typename StringType>\nbool IsSubstringPred(const StringType& needle,\n                     const StringType& haystack) {\n  return haystack.find(needle) != StringType::npos;\n}\n\n// This function implements either IsSubstring() or IsNotSubstring(),\n// depending on the value of the expected_to_be_substring parameter.\n// StringType here can be const char*, const wchar_t*, ::std::string,\n// or ::std::wstring.\ntemplate <typename StringType>\nAssertionResult IsSubstringImpl(\n    bool expected_to_be_substring,\n    const char* needle_expr, const char* haystack_expr,\n    const StringType& needle, const StringType& haystack) {\n  if (IsSubstringPred(needle, haystack) == expected_to_be_substring)\n    return AssertionSuccess();\n\n  const bool is_wide_string = sizeof(needle[0]) > 1;\n  const char* const begin_string_quote = is_wide_string ? \"L\\\"\" : \"\\\"\";\n  return AssertionFailure()\n      << \"Value of: \" << needle_expr << \"\\n\"\n      << \"  Actual: \" << begin_string_quote << needle << \"\\\"\\n\"\n      << \"Expected: \" << (expected_to_be_substring ? \"\" : \"not \")\n      << \"a substring of \" << haystack_expr << \"\\n\"\n      << \"Which is: \" << begin_string_quote << haystack << \"\\\"\";\n}\n\n}  // namespace\n\n// IsSubstring() and IsNotSubstring() check whether needle is a\n// substring of haystack (NULL is considered a substring of itself\n// only), and return an appropriate error message when they fail.\n\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n\n#if GTEST_HAS_STD_WSTRING\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\nnamespace internal {\n\n#if GTEST_OS_WINDOWS\n\nnamespace {\n\n// Helper function for IsHRESULT{SuccessFailure} predicates\nAssertionResult HRESULTFailureHelper(const char* expr,\n                                     const char* expected,\n                                     long hr) {  // NOLINT\n# if GTEST_OS_WINDOWS_MOBILE\n\n  // Windows CE doesn't support FormatMessage.\n  const char error_text[] = \"\";\n\n# else\n\n  // Looks up the human-readable system message for the HRESULT code\n  // and since we're not passing any params to FormatMessage, we don't\n  // want inserts expanded.\n  const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |\n                       FORMAT_MESSAGE_IGNORE_INSERTS;\n  const DWORD kBufSize = 4096;\n  // Gets the system's human readable message string for this HRESULT.\n  char error_text[kBufSize] = { '\\0' };\n  DWORD message_length = ::FormatMessageA(kFlags,\n                                          0,  // no source, we're asking system\n                                          hr,  // the error\n                                          0,  // no line width restrictions\n                                          error_text,  // output buffer\n                                          kBufSize,  // buf size\n                                          NULL);  // no arguments for inserts\n  // Trims tailing white space (FormatMessage leaves a trailing CR-LF)\n  for (; message_length && IsSpace(error_text[message_length - 1]);\n          --message_length) {\n    error_text[message_length - 1] = '\\0';\n  }\n\n# endif  // GTEST_OS_WINDOWS_MOBILE\n\n  const std::string error_hex(\"0x\" + String::FormatHexInt(hr));\n  return ::testing::AssertionFailure()\n      << \"Expected: \" << expr << \" \" << expected << \".\\n\"\n      << \"  Actual: \" << error_hex << \" \" << error_text << \"\\n\";\n}\n\n}  // namespace\n\nAssertionResult IsHRESULTSuccess(const char* expr, long hr) {  // NOLINT\n  if (SUCCEEDED(hr)) {\n    return AssertionSuccess();\n  }\n  return HRESULTFailureHelper(expr, \"succeeds\", hr);\n}\n\nAssertionResult IsHRESULTFailure(const char* expr, long hr) {  // NOLINT\n  if (FAILED(hr)) {\n    return AssertionSuccess();\n  }\n  return HRESULTFailureHelper(expr, \"fails\", hr);\n}\n\n#endif  // GTEST_OS_WINDOWS\n\n// Utility functions for encoding Unicode text (wide strings) in\n// UTF-8.\n\n// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8\n// like this:\n//\n// Code-point length   Encoding\n//   0 -  7 bits       0xxxxxxx\n//   8 - 11 bits       110xxxxx 10xxxxxx\n//  12 - 16 bits       1110xxxx 10xxxxxx 10xxxxxx\n//  17 - 21 bits       11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n\n// The maximum code-point a one-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) <<  7) - 1;\n\n// The maximum code-point a two-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;\n\n// The maximum code-point a three-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;\n\n// The maximum code-point a four-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;\n\n// Chops off the n lowest bits from a bit pattern.  Returns the n\n// lowest bits.  As a side effect, the original bit pattern will be\n// shifted to the right by n bits.\ninline UInt32 ChopLowBits(UInt32* bits, int n) {\n  const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);\n  *bits >>= n;\n  return low_bits;\n}\n\n// Converts a Unicode code point to a narrow string in UTF-8 encoding.\n// code_point parameter is of type UInt32 because wchar_t may not be\n// wide enough to contain a code point.\n// If the code_point is not a valid Unicode code point\n// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted\n// to \"(Invalid Unicode 0xXXXXXXXX)\".\nstd::string CodePointToUtf8(UInt32 code_point) {\n  if (code_point > kMaxCodePoint4) {\n    return \"(Invalid Unicode 0x\" + String::FormatHexInt(code_point) + \")\";\n  }\n\n  char str[5];  // Big enough for the largest valid code point.\n  if (code_point <= kMaxCodePoint1) {\n    str[1] = '\\0';\n    str[0] = static_cast<char>(code_point);                          // 0xxxxxxx\n  } else if (code_point <= kMaxCodePoint2) {\n    str[2] = '\\0';\n    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[0] = static_cast<char>(0xC0 | code_point);                   // 110xxxxx\n  } else if (code_point <= kMaxCodePoint3) {\n    str[3] = '\\0';\n    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[0] = static_cast<char>(0xE0 | code_point);                   // 1110xxxx\n  } else {  // code_point <= kMaxCodePoint4\n    str[4] = '\\0';\n    str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[0] = static_cast<char>(0xF0 | code_point);                   // 11110xxx\n  }\n  return str;\n}\n\n// The following two functions only make sense if the the system\n// uses UTF-16 for wide string encoding. All supported systems\n// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.\n\n// Determines if the arguments constitute UTF-16 surrogate pair\n// and thus should be combined into a single Unicode code point\n// using CreateCodePointFromUtf16SurrogatePair.\ninline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {\n  return sizeof(wchar_t) == 2 &&\n      (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;\n}\n\n// Creates a Unicode code point from UTF16 surrogate pair.\ninline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,\n                                                    wchar_t second) {\n  const UInt32 mask = (1 << 10) - 1;\n  return (sizeof(wchar_t) == 2) ?\n      (((first & mask) << 10) | (second & mask)) + 0x10000 :\n      // This function should not be called when the condition is\n      // false, but we provide a sensible default in case it is.\n      static_cast<UInt32>(first);\n}\n\n// Converts a wide string to a narrow string in UTF-8 encoding.\n// The wide string is assumed to have the following encoding:\n//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)\n//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)\n// Parameter str points to a null-terminated wide string.\n// Parameter num_chars may additionally limit the number\n// of wchar_t characters processed. -1 is used when the entire string\n// should be processed.\n// If the string contains code points that are not valid Unicode code points\n// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output\n// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding\n// and contains invalid UTF-16 surrogate pairs, values in those pairs\n// will be encoded as individual Unicode characters from Basic Normal Plane.\nstd::string WideStringToUtf8(const wchar_t* str, int num_chars) {\n  if (num_chars == -1)\n    num_chars = static_cast<int>(wcslen(str));\n\n  ::std::stringstream stream;\n  for (int i = 0; i < num_chars; ++i) {\n    UInt32 unicode_code_point;\n\n    if (str[i] == L'\\0') {\n      break;\n    } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {\n      unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],\n                                                                 str[i + 1]);\n      i++;\n    } else {\n      unicode_code_point = static_cast<UInt32>(str[i]);\n    }\n\n    stream << CodePointToUtf8(unicode_code_point);\n  }\n  return StringStreamToString(&stream);\n}\n\n// Converts a wide C string to an std::string using the UTF-8 encoding.\n// NULL will be converted to \"(null)\".\nstd::string String::ShowWideCString(const wchar_t * wide_c_str) {\n  if (wide_c_str == NULL)  return \"(null)\";\n\n  return internal::WideStringToUtf8(wide_c_str, -1);\n}\n\n// Compares two wide C strings.  Returns true iff they have the same\n// content.\n//\n// Unlike wcscmp(), this function can handle NULL argument(s).  A NULL\n// C string is considered different to any non-NULL C string,\n// including the empty string.\nbool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {\n  if (lhs == NULL) return rhs == NULL;\n\n  if (rhs == NULL) return false;\n\n  return wcscmp(lhs, rhs) == 0;\n}\n\n// Helper function for *_STREQ on wide strings.\nAssertionResult CmpHelperSTREQ(const char* expected_expression,\n                               const char* actual_expression,\n                               const wchar_t* expected,\n                               const wchar_t* actual) {\n  if (String::WideCStringEquals(expected, actual)) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   PrintToString(expected),\n                   PrintToString(actual),\n                   false);\n}\n\n// Helper function for *_STRNE on wide strings.\nAssertionResult CmpHelperSTRNE(const char* s1_expression,\n                               const char* s2_expression,\n                               const wchar_t* s1,\n                               const wchar_t* s2) {\n  if (!String::WideCStringEquals(s1, s2)) {\n    return AssertionSuccess();\n  }\n\n  return AssertionFailure() << \"Expected: (\" << s1_expression << \") != (\"\n                            << s2_expression << \"), actual: \"\n                            << PrintToString(s1)\n                            << \" vs \" << PrintToString(s2);\n}\n\n// Compares two C strings, ignoring case.  Returns true iff they have\n// the same content.\n//\n// Unlike strcasecmp(), this function can handle NULL argument(s).  A\n// NULL C string is considered different to any non-NULL C string,\n// including the empty string.\nbool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {\n  if (lhs == NULL)\n    return rhs == NULL;\n  if (rhs == NULL)\n    return false;\n  return posix::StrCaseCmp(lhs, rhs) == 0;\n}\n\n  // Compares two wide C strings, ignoring case.  Returns true iff they\n  // have the same content.\n  //\n  // Unlike wcscasecmp(), this function can handle NULL argument(s).\n  // A NULL C string is considered different to any non-NULL wide C string,\n  // including the empty string.\n  // NB: The implementations on different platforms slightly differ.\n  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE\n  // environment variable. On GNU platform this method uses wcscasecmp\n  // which compares according to LC_CTYPE category of the current locale.\n  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the\n  // current locale.\nbool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,\n                                              const wchar_t* rhs) {\n  if (lhs == NULL) return rhs == NULL;\n\n  if (rhs == NULL) return false;\n\n#if GTEST_OS_WINDOWS\n  return _wcsicmp(lhs, rhs) == 0;\n#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID\n  return wcscasecmp(lhs, rhs) == 0;\n#else\n  // Android, Mac OS X and Cygwin don't define wcscasecmp.\n  // Other unknown OSes may not define it either.\n  wint_t left, right;\n  do {\n    left = towlower(*lhs++);\n    right = towlower(*rhs++);\n  } while (left && left == right);\n  return left == right;\n#endif  // OS selector\n}\n\n// Returns true iff str ends with the given suffix, ignoring case.\n// Any string is considered to end with an empty suffix.\nbool String::EndsWithCaseInsensitive(\n    const std::string& str, const std::string& suffix) {\n  const size_t str_len = str.length();\n  const size_t suffix_len = suffix.length();\n  return (str_len >= suffix_len) &&\n         CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,\n                                      suffix.c_str());\n}\n\n// Formats an int value as \"%02d\".\nstd::string String::FormatIntWidth2(int value) {\n  std::stringstream ss;\n  ss << std::setfill('0') << std::setw(2) << value;\n  return ss.str();\n}\n\n// Formats an int value as \"%X\".\nstd::string String::FormatHexInt(int value) {\n  std::stringstream ss;\n  ss << std::hex << std::uppercase << value;\n  return ss.str();\n}\n\n// Formats a byte as \"%02X\".\nstd::string String::FormatByte(unsigned char value) {\n  std::stringstream ss;\n  ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase\n     << static_cast<unsigned int>(value);\n  return ss.str();\n}\n\n// Converts the buffer in a stringstream to an std::string, converting NUL\n// bytes to \"\\\\0\" along the way.\nstd::string StringStreamToString(::std::stringstream* ss) {\n  const ::std::string& str = ss->str();\n  const char* const start = str.c_str();\n  const char* const end = start + str.length();\n\n  std::string result;\n  result.reserve(2 * (end - start));\n  for (const char* ch = start; ch != end; ++ch) {\n    if (*ch == '\\0') {\n      result += \"\\\\0\";  // Replaces NUL with \"\\\\0\";\n    } else {\n      result += *ch;\n    }\n  }\n\n  return result;\n}\n\n// Appends the user-supplied message to the Google-Test-generated message.\nstd::string AppendUserMessage(const std::string& gtest_msg,\n                              const Message& user_msg) {\n  // Appends the user message if it's non-empty.\n  const std::string user_msg_string = user_msg.GetString();\n  if (user_msg_string.empty()) {\n    return gtest_msg;\n  }\n\n  return gtest_msg + \"\\n\" + user_msg_string;\n}\n\n}  // namespace internal\n\n// class TestResult\n\n// Creates an empty TestResult.\nTestResult::TestResult()\n    : death_test_count_(0),\n      elapsed_time_(0) {\n}\n\n// D'tor.\nTestResult::~TestResult() {\n}\n\n// Returns the i-th test part result among all the results. i can\n// range from 0 to total_part_count() - 1. If i is not in that range,\n// aborts the program.\nconst TestPartResult& TestResult::GetTestPartResult(int i) const {\n  if (i < 0 || i >= total_part_count())\n    internal::posix::Abort();\n  return test_part_results_.at(i);\n}\n\n// Returns the i-th test property. i can range from 0 to\n// test_property_count() - 1. If i is not in that range, aborts the\n// program.\nconst TestProperty& TestResult::GetTestProperty(int i) const {\n  if (i < 0 || i >= test_property_count())\n    internal::posix::Abort();\n  return test_properties_.at(i);\n}\n\n// Clears the test part results.\nvoid TestResult::ClearTestPartResults() {\n  test_part_results_.clear();\n}\n\n// Adds a test part result to the list.\nvoid TestResult::AddTestPartResult(const TestPartResult& test_part_result) {\n  test_part_results_.push_back(test_part_result);\n}\n\n// Adds a test property to the list. If a property with the same key as the\n// supplied property is already represented, the value of this test_property\n// replaces the old value for that key.\nvoid TestResult::RecordProperty(const std::string& xml_element,\n                                const TestProperty& test_property) {\n  if (!ValidateTestProperty(xml_element, test_property)) {\n    return;\n  }\n  internal::MutexLock lock(&test_properites_mutex_);\n  const std::vector<TestProperty>::iterator property_with_matching_key =\n      std::find_if(test_properties_.begin(), test_properties_.end(),\n                   internal::TestPropertyKeyIs(test_property.key()));\n  if (property_with_matching_key == test_properties_.end()) {\n    test_properties_.push_back(test_property);\n    return;\n  }\n  property_with_matching_key->SetValue(test_property.value());\n}\n\n// The list of reserved attributes used in the <testsuites> element of XML\n// output.\nstatic const char* const kReservedTestSuitesAttributes[] = {\n  \"disabled\",\n  \"errors\",\n  \"failures\",\n  \"name\",\n  \"random_seed\",\n  \"tests\",\n  \"time\",\n  \"timestamp\"\n};\n\n// The list of reserved attributes used in the <testsuite> element of XML\n// output.\nstatic const char* const kReservedTestSuiteAttributes[] = {\n  \"disabled\",\n  \"errors\",\n  \"failures\",\n  \"name\",\n  \"tests\",\n  \"time\"\n};\n\n// The list of reserved attributes used in the <testcase> element of XML output.\nstatic const char* const kReservedTestCaseAttributes[] = {\n  \"classname\",\n  \"name\",\n  \"status\",\n  \"time\",\n  \"type_param\",\n  \"value_param\"\n};\n\ntemplate <int kSize>\nstd::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {\n  return std::vector<std::string>(array, array + kSize);\n}\n\nstatic std::vector<std::string> GetReservedAttributesForElement(\n    const std::string& xml_element) {\n  if (xml_element == \"testsuites\") {\n    return ArrayAsVector(kReservedTestSuitesAttributes);\n  } else if (xml_element == \"testsuite\") {\n    return ArrayAsVector(kReservedTestSuiteAttributes);\n  } else if (xml_element == \"testcase\") {\n    return ArrayAsVector(kReservedTestCaseAttributes);\n  } else {\n    GTEST_CHECK_(false) << \"Unrecognized xml_element provided: \" << xml_element;\n  }\n  // This code is unreachable but some compilers may not realizes that.\n  return std::vector<std::string>();\n}\n\nstatic std::string FormatWordList(const std::vector<std::string>& words) {\n  Message word_list;\n  for (size_t i = 0; i < words.size(); ++i) {\n    if (i > 0 && words.size() > 2) {\n      word_list << \", \";\n    }\n    if (i == words.size() - 1) {\n      word_list << \"and \";\n    }\n    word_list << \"'\" << words[i] << \"'\";\n  }\n  return word_list.GetString();\n}\n\nbool ValidateTestPropertyName(const std::string& property_name,\n                              const std::vector<std::string>& reserved_names) {\n  if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=\n          reserved_names.end()) {\n    ADD_FAILURE() << \"Reserved key used in RecordProperty(): \" << property_name\n                  << \" (\" << FormatWordList(reserved_names)\n                  << \" are reserved by \" << GTEST_NAME_ << \")\";\n    return false;\n  }\n  return true;\n}\n\n// Adds a failure if the key is a reserved attribute of the element named\n// xml_element.  Returns true if the property is valid.\nbool TestResult::ValidateTestProperty(const std::string& xml_element,\n                                      const TestProperty& test_property) {\n  return ValidateTestPropertyName(test_property.key(),\n                                  GetReservedAttributesForElement(xml_element));\n}\n\n// Clears the object.\nvoid TestResult::Clear() {\n  test_part_results_.clear();\n  test_properties_.clear();\n  death_test_count_ = 0;\n  elapsed_time_ = 0;\n}\n\n// Returns true iff the test failed.\nbool TestResult::Failed() const {\n  for (int i = 0; i < total_part_count(); ++i) {\n    if (GetTestPartResult(i).failed())\n      return true;\n  }\n  return false;\n}\n\n// Returns true iff the test part fatally failed.\nstatic bool TestPartFatallyFailed(const TestPartResult& result) {\n  return result.fatally_failed();\n}\n\n// Returns true iff the test fatally failed.\nbool TestResult::HasFatalFailure() const {\n  return CountIf(test_part_results_, TestPartFatallyFailed) > 0;\n}\n\n// Returns true iff the test part non-fatally failed.\nstatic bool TestPartNonfatallyFailed(const TestPartResult& result) {\n  return result.nonfatally_failed();\n}\n\n// Returns true iff the test has a non-fatal failure.\nbool TestResult::HasNonfatalFailure() const {\n  return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;\n}\n\n// Gets the number of all test parts.  This is the sum of the number\n// of successful test parts and the number of failed test parts.\nint TestResult::total_part_count() const {\n  return static_cast<int>(test_part_results_.size());\n}\n\n// Returns the number of the test properties.\nint TestResult::test_property_count() const {\n  return static_cast<int>(test_properties_.size());\n}\n\n// class Test\n\n// Creates a Test object.\n\n// The c'tor saves the values of all Google Test flags.\nTest::Test()\n    : gtest_flag_saver_(new internal::GTestFlagSaver) {\n}\n\n// The d'tor restores the values of all Google Test flags.\nTest::~Test() {\n  delete gtest_flag_saver_;\n}\n\n// Sets up the test fixture.\n//\n// A sub-class may override this.\nvoid Test::SetUp() {\n}\n\n// Tears down the test fixture.\n//\n// A sub-class may override this.\nvoid Test::TearDown() {\n}\n\n// Allows user supplied key value pairs to be recorded for later output.\nvoid Test::RecordProperty(const std::string& key, const std::string& value) {\n  UnitTest::GetInstance()->RecordProperty(key, value);\n}\n\n// Allows user supplied key value pairs to be recorded for later output.\nvoid Test::RecordProperty(const std::string& key, int value) {\n  Message value_message;\n  value_message << value;\n  RecordProperty(key, value_message.GetString().c_str());\n}\n\nnamespace internal {\n\nvoid ReportFailureInUnknownLocation(TestPartResult::Type result_type,\n                                    const std::string& message) {\n  // This function is a friend of UnitTest and as such has access to\n  // AddTestPartResult.\n  UnitTest::GetInstance()->AddTestPartResult(\n      result_type,\n      NULL,  // No info about the source file where the exception occurred.\n      -1,    // We have no info on which line caused the exception.\n      message,\n      \"\");   // No stack trace, either.\n}\n\n}  // namespace internal\n\n// Google Test requires all tests in the same test case to use the same test\n// fixture class.  This function checks if the current test has the\n// same fixture class as the first test in the current test case.  If\n// yes, it returns true; otherwise it generates a Google Test failure and\n// returns false.\nbool Test::HasSameFixtureClass() {\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  const TestCase* const test_case = impl->current_test_case();\n\n  // Info about the first test in the current test case.\n  const TestInfo* const first_test_info = test_case->test_info_list()[0];\n  const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_;\n  const char* const first_test_name = first_test_info->name();\n\n  // Info about the current test.\n  const TestInfo* const this_test_info = impl->current_test_info();\n  const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_;\n  const char* const this_test_name = this_test_info->name();\n\n  if (this_fixture_id != first_fixture_id) {\n    // Is the first test defined using TEST?\n    const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();\n    // Is this test defined using TEST?\n    const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();\n\n    if (first_is_TEST || this_is_TEST) {\n      // The user mixed TEST and TEST_F in this test case - we'll tell\n      // him/her how to fix it.\n\n      // Gets the name of the TEST and the name of the TEST_F.  Note\n      // that first_is_TEST and this_is_TEST cannot both be true, as\n      // the fixture IDs are different for the two tests.\n      const char* const TEST_name =\n          first_is_TEST ? first_test_name : this_test_name;\n      const char* const TEST_F_name =\n          first_is_TEST ? this_test_name : first_test_name;\n\n      ADD_FAILURE()\n          << \"All tests in the same test case must use the same test fixture\\n\"\n          << \"class, so mixing TEST_F and TEST in the same test case is\\n\"\n          << \"illegal.  In test case \" << this_test_info->test_case_name()\n          << \",\\n\"\n          << \"test \" << TEST_F_name << \" is defined using TEST_F but\\n\"\n          << \"test \" << TEST_name << \" is defined using TEST.  You probably\\n\"\n          << \"want to change the TEST to TEST_F or move it to another test\\n\"\n          << \"case.\";\n    } else {\n      // The user defined two fixture classes with the same name in\n      // two namespaces - we'll tell him/her how to fix it.\n      ADD_FAILURE()\n          << \"All tests in the same test case must use the same test fixture\\n\"\n          << \"class.  However, in test case \"\n          << this_test_info->test_case_name() << \",\\n\"\n          << \"you defined test \" << first_test_name\n          << \" and test \" << this_test_name << \"\\n\"\n          << \"using two different test fixture classes.  This can happen if\\n\"\n          << \"the two classes are from different namespaces or translation\\n\"\n          << \"units and have the same name.  You should probably rename one\\n\"\n          << \"of the classes to put the tests into different test cases.\";\n    }\n    return false;\n  }\n\n  return true;\n}\n\n#if GTEST_HAS_SEH\n\n// Adds an \"exception thrown\" fatal failure to the current test.  This\n// function returns its result via an output parameter pointer because VC++\n// prohibits creation of objects with destructors on stack in functions\n// using __try (see error C2712).\nstatic std::string* FormatSehExceptionMessage(DWORD exception_code,\n                                              const char* location) {\n  Message message;\n  message << \"SEH exception with code 0x\" << std::setbase(16) <<\n    exception_code << std::setbase(10) << \" thrown in \" << location << \".\";\n\n  return new std::string(message.GetString());\n}\n\n#endif  // GTEST_HAS_SEH\n\nnamespace internal {\n\n#if GTEST_HAS_EXCEPTIONS\n\n// Adds an \"exception thrown\" fatal failure to the current test.\nstatic std::string FormatCxxExceptionMessage(const char* description,\n                                             const char* location) {\n  Message message;\n  if (description != NULL) {\n    message << \"C++ exception with description \\\"\" << description << \"\\\"\";\n  } else {\n    message << \"Unknown C++ exception\";\n  }\n  message << \" thrown in \" << location << \".\";\n\n  return message.GetString();\n}\n\nstatic std::string PrintTestPartResultToString(\n    const TestPartResult& test_part_result);\n\nGoogleTestFailureException::GoogleTestFailureException(\n    const TestPartResult& failure)\n    : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// We put these helper functions in the internal namespace as IBM's xlC\n// compiler rejects the code if they were declared static.\n\n// Runs the given method and handles SEH exceptions it throws, when\n// SEH is supported; returns the 0-value for type Result in case of an\n// SEH exception.  (Microsoft compilers cannot handle SEH and C++\n// exceptions in the same function.  Therefore, we provide a separate\n// wrapper function for handling SEH exceptions.)\ntemplate <class T, typename Result>\nResult HandleSehExceptionsInMethodIfSupported(\n    T* object, Result (T::*method)(), const char* location) {\n#if GTEST_HAS_SEH\n  __try {\n    return (object->*method)();\n  } __except (internal::UnitTestOptions::GTestShouldProcessSEH(  // NOLINT\n      GetExceptionCode())) {\n    // We create the exception message on the heap because VC++ prohibits\n    // creation of objects with destructors on stack in functions using __try\n    // (see error C2712).\n    std::string* exception_message = FormatSehExceptionMessage(\n        GetExceptionCode(), location);\n    internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,\n                                             *exception_message);\n    delete exception_message;\n    return static_cast<Result>(0);\n  }\n#else\n  (void)location;\n  return (object->*method)();\n#endif  // GTEST_HAS_SEH\n}\n\n// Runs the given method and catches and reports C++ and/or SEH-style\n// exceptions, if they are supported; returns the 0-value for type\n// Result in case of an SEH exception.\ntemplate <class T, typename Result>\nResult HandleExceptionsInMethodIfSupported(\n    T* object, Result (T::*method)(), const char* location) {\n  // NOTE: The user code can affect the way in which Google Test handles\n  // exceptions by setting GTEST_FLAG(catch_exceptions), but only before\n  // RUN_ALL_TESTS() starts. It is technically possible to check the flag\n  // after the exception is caught and either report or re-throw the\n  // exception based on the flag's value:\n  //\n  // try {\n  //   // Perform the test method.\n  // } catch (...) {\n  //   if (GTEST_FLAG(catch_exceptions))\n  //     // Report the exception as failure.\n  //   else\n  //     throw;  // Re-throws the original exception.\n  // }\n  //\n  // However, the purpose of this flag is to allow the program to drop into\n  // the debugger when the exception is thrown. On most platforms, once the\n  // control enters the catch block, the exception origin information is\n  // lost and the debugger will stop the program at the point of the\n  // re-throw in this function -- instead of at the point of the original\n  // throw statement in the code under test.  For this reason, we perform\n  // the check early, sacrificing the ability to affect Google Test's\n  // exception handling in the method where the exception is thrown.\n  if (internal::GetUnitTestImpl()->catch_exceptions()) {\n#if GTEST_HAS_EXCEPTIONS\n    try {\n      return HandleSehExceptionsInMethodIfSupported(object, method, location);\n    } catch (const internal::GoogleTestFailureException&) {  // NOLINT\n      // This exception type can only be thrown by a failed Google\n      // Test assertion with the intention of letting another testing\n      // framework catch it.  Therefore we just re-throw it.\n      throw;\n    } catch (const std::exception& e) {  // NOLINT\n      internal::ReportFailureInUnknownLocation(\n          TestPartResult::kFatalFailure,\n          FormatCxxExceptionMessage(e.what(), location));\n    } catch (...) {  // NOLINT\n      internal::ReportFailureInUnknownLocation(\n          TestPartResult::kFatalFailure,\n          FormatCxxExceptionMessage(NULL, location));\n    }\n    return static_cast<Result>(0);\n#else\n    return HandleSehExceptionsInMethodIfSupported(object, method, location);\n#endif  // GTEST_HAS_EXCEPTIONS\n  } else {\n    return (object->*method)();\n  }\n}\n\n}  // namespace internal\n\n// Runs the test and updates the test result.\nvoid Test::Run() {\n  if (!HasSameFixtureClass()) return;\n\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, \"SetUp()\");\n  // We will run the test only if SetUp() was successful.\n  if (!HasFatalFailure()) {\n    impl->os_stack_trace_getter()->UponLeavingGTest();\n    internal::HandleExceptionsInMethodIfSupported(\n        this, &Test::TestBody, \"the test body\");\n  }\n\n  // However, we want to clean up as much as possible.  Hence we will\n  // always call TearDown(), even if SetUp() or the test body has\n  // failed.\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      this, &Test::TearDown, \"TearDown()\");\n}\n\n// Returns true iff the current test has a fatal failure.\nbool Test::HasFatalFailure() {\n  return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();\n}\n\n// Returns true iff the current test has a non-fatal failure.\nbool Test::HasNonfatalFailure() {\n  return internal::GetUnitTestImpl()->current_test_result()->\n      HasNonfatalFailure();\n}\n\n// class TestInfo\n\n// Constructs a TestInfo object. It assumes ownership of the test factory\n// object.\nTestInfo::TestInfo(const std::string& a_test_case_name,\n                   const std::string& a_name,\n                   const char* a_type_param,\n                   const char* a_value_param,\n                   internal::TypeId fixture_class_id,\n                   internal::TestFactoryBase* factory)\n    : test_case_name_(a_test_case_name),\n      name_(a_name),\n      type_param_(a_type_param ? new std::string(a_type_param) : NULL),\n      value_param_(a_value_param ? new std::string(a_value_param) : NULL),\n      fixture_class_id_(fixture_class_id),\n      should_run_(false),\n      is_disabled_(false),\n      matches_filter_(false),\n      factory_(factory),\n      result_() {}\n\n// Destructs a TestInfo object.\nTestInfo::~TestInfo() { delete factory_; }\n\nnamespace internal {\n\n// Creates a new TestInfo object and registers it with Google Test;\n// returns the created object.\n//\n// Arguments:\n//\n//   test_case_name:   name of the test case\n//   name:             name of the test\n//   type_param:       the name of the test's type parameter, or NULL if\n//                     this is not a typed or a type-parameterized test.\n//   value_param:      text representation of the test's value parameter,\n//                     or NULL if this is not a value-parameterized test.\n//   fixture_class_id: ID of the test fixture class\n//   set_up_tc:        pointer to the function that sets up the test case\n//   tear_down_tc:     pointer to the function that tears down the test case\n//   factory:          pointer to the factory that creates a test object.\n//                     The newly created TestInfo instance will assume\n//                     ownership of the factory object.\nTestInfo* MakeAndRegisterTestInfo(\n    const char* test_case_name,\n    const char* name,\n    const char* type_param,\n    const char* value_param,\n    TypeId fixture_class_id,\n    SetUpTestCaseFunc set_up_tc,\n    TearDownTestCaseFunc tear_down_tc,\n    TestFactoryBase* factory) {\n  TestInfo* const test_info =\n      new TestInfo(test_case_name, name, type_param, value_param,\n                   fixture_class_id, factory);\n  GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);\n  return test_info;\n}\n\n#if GTEST_HAS_PARAM_TEST\nvoid ReportInvalidTestCaseType(const char* test_case_name,\n                               const char* file, int line) {\n  Message errors;\n  errors\n      << \"Attempted redefinition of test case \" << test_case_name << \".\\n\"\n      << \"All tests in the same test case must use the same test fixture\\n\"\n      << \"class.  However, in test case \" << test_case_name << \", you tried\\n\"\n      << \"to define a test using a fixture class different from the one\\n\"\n      << \"used earlier. This can happen if the two fixture classes are\\n\"\n      << \"from different namespaces and have the same name. You should\\n\"\n      << \"probably rename one of the classes to put the tests into different\\n\"\n      << \"test cases.\";\n\n  fprintf(stderr, \"%s %s\", FormatFileLocation(file, line).c_str(),\n          errors.GetString().c_str());\n}\n#endif  // GTEST_HAS_PARAM_TEST\n\n}  // namespace internal\n\nnamespace {\n\n// A predicate that checks the test name of a TestInfo against a known\n// value.\n//\n// This is used for implementation of the TestCase class only.  We put\n// it in the anonymous namespace to prevent polluting the outer\n// namespace.\n//\n// TestNameIs is copyable.\nclass TestNameIs {\n public:\n  // Constructor.\n  //\n  // TestNameIs has NO default constructor.\n  explicit TestNameIs(const char* name)\n      : name_(name) {}\n\n  // Returns true iff the test name of test_info matches name_.\n  bool operator()(const TestInfo * test_info) const {\n    return test_info && test_info->name() == name_;\n  }\n\n private:\n  std::string name_;\n};\n\n}  // namespace\n\nnamespace internal {\n\n// This method expands all parameterized tests registered with macros TEST_P\n// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.\n// This will be done just once during the program runtime.\nvoid UnitTestImpl::RegisterParameterizedTests() {\n#if GTEST_HAS_PARAM_TEST\n  if (!parameterized_tests_registered_) {\n    parameterized_test_registry_.RegisterTests();\n    parameterized_tests_registered_ = true;\n  }\n#endif\n}\n\n}  // namespace internal\n\n// Creates the test object, runs it, records its result, and then\n// deletes it.\nvoid TestInfo::Run() {\n  if (!should_run_) return;\n\n  // Tells UnitTest where to store test result.\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  impl->set_current_test_info(this);\n\n  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();\n\n  // Notifies the unit test event listeners that a test is about to start.\n  repeater->OnTestStart(*this);\n\n  const TimeInMillis start = internal::GetTimeInMillis();\n\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n\n  // Creates the test object.\n  Test* const test = internal::HandleExceptionsInMethodIfSupported(\n      factory_, &internal::TestFactoryBase::CreateTest,\n      \"the test fixture's constructor\");\n\n  // Runs the test only if the test object was created and its\n  // constructor didn't generate a fatal failure.\n  if ((test != NULL) && !Test::HasFatalFailure()) {\n    // This doesn't throw as all user code that can throw are wrapped into\n    // exception handling code.\n    test->Run();\n  }\n\n  // Deletes the test object.\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      test, &Test::DeleteSelf_, \"the test fixture's destructor\");\n\n  result_.set_elapsed_time(internal::GetTimeInMillis() - start);\n\n  // Notifies the unit test event listener that a test has just finished.\n  repeater->OnTestEnd(*this);\n\n  // Tells UnitTest to stop associating assertion results to this\n  // test.\n  impl->set_current_test_info(NULL);\n}\n\n// class TestCase\n\n// Gets the number of successful tests in this test case.\nint TestCase::successful_test_count() const {\n  return CountIf(test_info_list_, TestPassed);\n}\n\n// Gets the number of failed tests in this test case.\nint TestCase::failed_test_count() const {\n  return CountIf(test_info_list_, TestFailed);\n}\n\n// Gets the number of disabled tests that will be reported in the XML report.\nint TestCase::reportable_disabled_test_count() const {\n  return CountIf(test_info_list_, TestReportableDisabled);\n}\n\n// Gets the number of disabled tests in this test case.\nint TestCase::disabled_test_count() const {\n  return CountIf(test_info_list_, TestDisabled);\n}\n\n// Gets the number of tests to be printed in the XML report.\nint TestCase::reportable_test_count() const {\n  return CountIf(test_info_list_, TestReportable);\n}\n\n// Get the number of tests in this test case that should run.\nint TestCase::test_to_run_count() const {\n  return CountIf(test_info_list_, ShouldRunTest);\n}\n\n// Gets the number of all tests.\nint TestCase::total_test_count() const {\n  return static_cast<int>(test_info_list_.size());\n}\n\n// Creates a TestCase with the given name.\n//\n// Arguments:\n//\n//   name:         name of the test case\n//   a_type_param: the name of the test case's type parameter, or NULL if\n//                 this is not a typed or a type-parameterized test case.\n//   set_up_tc:    pointer to the function that sets up the test case\n//   tear_down_tc: pointer to the function that tears down the test case\nTestCase::TestCase(const char* a_name, const char* a_type_param,\n                   Test::SetUpTestCaseFunc set_up_tc,\n                   Test::TearDownTestCaseFunc tear_down_tc)\n    : name_(a_name),\n      type_param_(a_type_param ? new std::string(a_type_param) : NULL),\n      set_up_tc_(set_up_tc),\n      tear_down_tc_(tear_down_tc),\n      should_run_(false),\n      elapsed_time_(0) {\n}\n\n// Destructor of TestCase.\nTestCase::~TestCase() {\n  // Deletes every Test in the collection.\n  ForEach(test_info_list_, internal::Delete<TestInfo>);\n}\n\n// Returns the i-th test among all the tests. i can range from 0 to\n// total_test_count() - 1. If i is not in that range, returns NULL.\nconst TestInfo* TestCase::GetTestInfo(int i) const {\n  const int index = GetElementOr(test_indices_, i, -1);\n  return index < 0 ? NULL : test_info_list_[index];\n}\n\n// Returns the i-th test among all the tests. i can range from 0 to\n// total_test_count() - 1. If i is not in that range, returns NULL.\nTestInfo* TestCase::GetMutableTestInfo(int i) {\n  const int index = GetElementOr(test_indices_, i, -1);\n  return index < 0 ? NULL : test_info_list_[index];\n}\n\n// Adds a test to this test case.  Will delete the test upon\n// destruction of the TestCase object.\nvoid TestCase::AddTestInfo(TestInfo * test_info) {\n  test_info_list_.push_back(test_info);\n  test_indices_.push_back(static_cast<int>(test_indices_.size()));\n}\n\n// Runs every test in this TestCase.\nvoid TestCase::Run() {\n  if (!should_run_) return;\n\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  impl->set_current_test_case(this);\n\n  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();\n\n  repeater->OnTestCaseStart(*this);\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      this, &TestCase::RunSetUpTestCase, \"SetUpTestCase()\");\n\n  const internal::TimeInMillis start = internal::GetTimeInMillis();\n  for (int i = 0; i < total_test_count(); i++) {\n    GetMutableTestInfo(i)->Run();\n  }\n  elapsed_time_ = internal::GetTimeInMillis() - start;\n\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      this, &TestCase::RunTearDownTestCase, \"TearDownTestCase()\");\n\n  repeater->OnTestCaseEnd(*this);\n  impl->set_current_test_case(NULL);\n}\n\n// Clears the results of all tests in this test case.\nvoid TestCase::ClearResult() {\n  ad_hoc_test_result_.Clear();\n  ForEach(test_info_list_, TestInfo::ClearTestResult);\n}\n\n// Shuffles the tests in this test case.\nvoid TestCase::ShuffleTests(internal::Random* random) {\n  Shuffle(random, &test_indices_);\n}\n\n// Restores the test order to before the first shuffle.\nvoid TestCase::UnshuffleTests() {\n  for (size_t i = 0; i < test_indices_.size(); i++) {\n    test_indices_[i] = static_cast<int>(i);\n  }\n}\n\n// Formats a countable noun.  Depending on its quantity, either the\n// singular form or the plural form is used. e.g.\n//\n// FormatCountableNoun(1, \"formula\", \"formuli\") returns \"1 formula\".\n// FormatCountableNoun(5, \"book\", \"books\") returns \"5 books\".\nstatic std::string FormatCountableNoun(int count,\n                                       const char * singular_form,\n                                       const char * plural_form) {\n  return internal::StreamableToString(count) + \" \" +\n      (count == 1 ? singular_form : plural_form);\n}\n\n// Formats the count of tests.\nstatic std::string FormatTestCount(int test_count) {\n  return FormatCountableNoun(test_count, \"test\", \"tests\");\n}\n\n// Formats the count of test cases.\nstatic std::string FormatTestCaseCount(int test_case_count) {\n  return FormatCountableNoun(test_case_count, \"test case\", \"test cases\");\n}\n\n// Converts a TestPartResult::Type enum to human-friendly string\n// representation.  Both kNonFatalFailure and kFatalFailure are translated\n// to \"Failure\", as the user usually doesn't care about the difference\n// between the two when viewing the test result.\nstatic const char * TestPartResultTypeToString(TestPartResult::Type type) {\n  switch (type) {\n    case TestPartResult::kSuccess:\n      return \"Success\";\n\n    case TestPartResult::kNonFatalFailure:\n    case TestPartResult::kFatalFailure:\n#ifdef _MSC_VER\n      return \"error: \";\n#else\n      return \"Failure\\n\";\n#endif\n    default:\n      return \"Unknown result type\";\n  }\n}\n\nnamespace internal {\n\n// Prints a TestPartResult to an std::string.\nstatic std::string PrintTestPartResultToString(\n    const TestPartResult& test_part_result) {\n  return (Message()\n          << internal::FormatFileLocation(test_part_result.file_name(),\n                                          test_part_result.line_number())\n          << \" \" << TestPartResultTypeToString(test_part_result.type())\n          << test_part_result.message()).GetString();\n}\n\n// Prints a TestPartResult.\nstatic void PrintTestPartResult(const TestPartResult& test_part_result) {\n  const std::string& result =\n      PrintTestPartResultToString(test_part_result);\n  printf(\"%s\\n\", result.c_str());\n  fflush(stdout);\n  // If the test program runs in Visual Studio or a debugger, the\n  // following statements add the test part result message to the Output\n  // window such that the user can double-click on it to jump to the\n  // corresponding source code location; otherwise they do nothing.\n#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n  // We don't call OutputDebugString*() on Windows Mobile, as printing\n  // to stdout is done by OutputDebugString() there already - we don't\n  // want the same message printed twice.\n  ::OutputDebugStringA(result.c_str());\n  ::OutputDebugStringA(\"\\n\");\n#endif\n}\n\n// class PrettyUnitTestResultPrinter\n\nenum GTestColor {\n  COLOR_DEFAULT,\n  COLOR_RED,\n  COLOR_GREEN,\n  COLOR_YELLOW\n};\n\n#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n\n// Returns the character attribute for the given color.\nWORD GetColorAttribute(GTestColor color) {\n  switch (color) {\n    case COLOR_RED:    return FOREGROUND_RED;\n    case COLOR_GREEN:  return FOREGROUND_GREEN;\n    case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;\n    default:           return 0;\n  }\n}\n\n#else\n\n// Returns the ANSI color code for the given color.  COLOR_DEFAULT is\n// an invalid input.\nconst char* GetAnsiColorCode(GTestColor color) {\n  switch (color) {\n    case COLOR_RED:     return \"1\";\n    case COLOR_GREEN:   return \"2\";\n    case COLOR_YELLOW:  return \"3\";\n    default:            return NULL;\n  };\n}\n\n#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n\n// Returns true iff Google Test should use colors in the output.\nbool ShouldUseColor(bool stdout_is_tty) {\n  const char* const gtest_color = GTEST_FLAG(color).c_str();\n\n  if (String::CaseInsensitiveCStringEquals(gtest_color, \"auto\")) {\n#if GTEST_OS_WINDOWS\n    // On Windows the TERM variable is usually not set, but the\n    // console there does support colors.\n    return stdout_is_tty;\n#else\n    // On non-Windows platforms, we rely on the TERM variable.\n    const char* const term = posix::GetEnv(\"TERM\");\n    const bool term_supports_color =\n        String::CStringEquals(term, \"xterm\") ||\n        String::CStringEquals(term, \"xterm-color\") ||\n        String::CStringEquals(term, \"xterm-256color\") ||\n        String::CStringEquals(term, \"screen\") ||\n        String::CStringEquals(term, \"screen-256color\") ||\n        String::CStringEquals(term, \"linux\") ||\n        String::CStringEquals(term, \"cygwin\");\n    return stdout_is_tty && term_supports_color;\n#endif  // GTEST_OS_WINDOWS\n  }\n\n  return String::CaseInsensitiveCStringEquals(gtest_color, \"yes\") ||\n      String::CaseInsensitiveCStringEquals(gtest_color, \"true\") ||\n      String::CaseInsensitiveCStringEquals(gtest_color, \"t\") ||\n      String::CStringEquals(gtest_color, \"1\");\n  // We take \"yes\", \"true\", \"t\", and \"1\" as meaning \"yes\".  If the\n  // value is neither one of these nor \"auto\", we treat it as \"no\" to\n  // be conservative.\n}\n\n// Helpers for printing colored strings to stdout. Note that on Windows, we\n// cannot simply emit special characters and have the terminal change colors.\n// This routine must actually emit the characters rather than return a string\n// that would be colored when printed, as can be done on Linux.\nvoid ColoredPrintf(GTestColor color, const char* fmt, ...) {\n  va_list args;\n  va_start(args, fmt);\n\n#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || GTEST_OS_IOS\n  const bool use_color = false;\n#else\n  static const bool in_color_mode =\n      ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);\n  const bool use_color = in_color_mode && (color != COLOR_DEFAULT);\n#endif  // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS\n  // The '!= 0' comparison is necessary to satisfy MSVC 7.1.\n\n  if (!use_color) {\n    vprintf(fmt, args);\n    va_end(args);\n    return;\n  }\n\n#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n  const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);\n\n  // Gets the current text color.\n  CONSOLE_SCREEN_BUFFER_INFO buffer_info;\n  GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);\n  const WORD old_color_attrs = buffer_info.wAttributes;\n\n  // We need to flush the stream buffers into the console before each\n  // SetConsoleTextAttribute call lest it affect the text that is already\n  // printed but has not yet reached the console.\n  fflush(stdout);\n  SetConsoleTextAttribute(stdout_handle,\n                          GetColorAttribute(color) | FOREGROUND_INTENSITY);\n  vprintf(fmt, args);\n\n  fflush(stdout);\n  // Restores the text color.\n  SetConsoleTextAttribute(stdout_handle, old_color_attrs);\n#else\n  printf(\"\\033[0;3%sm\", GetAnsiColorCode(color));\n  vprintf(fmt, args);\n  printf(\"\\033[m\");  // Resets the terminal to default.\n#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n  va_end(args);\n}\n\n// Text printed in Google Test's text output and --gunit_list_tests\n// output to label the type parameter and value parameter for a test.\nstatic const char kTypeParamLabel[] = \"TypeParam\";\nstatic const char kValueParamLabel[] = \"GetParam()\";\n\nvoid PrintFullTestCommentIfPresent(const TestInfo& test_info) {\n  const char* const type_param = test_info.type_param();\n  const char* const value_param = test_info.value_param();\n\n  if (type_param != NULL || value_param != NULL) {\n    printf(\", where \");\n    if (type_param != NULL) {\n      printf(\"%s = %s\", kTypeParamLabel, type_param);\n      if (value_param != NULL)\n        printf(\" and \");\n    }\n    if (value_param != NULL) {\n      printf(\"%s = %s\", kValueParamLabel, value_param);\n    }\n  }\n}\n\n// This class implements the TestEventListener interface.\n//\n// Class PrettyUnitTestResultPrinter is copyable.\nclass PrettyUnitTestResultPrinter : public TestEventListener {\n public:\n  PrettyUnitTestResultPrinter() {}\n  static void PrintTestName(const char * test_case, const char * test) {\n    printf(\"%s.%s\", test_case, test);\n  }\n\n  // The following methods override what's in the TestEventListener class.\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestCaseStart(const TestCase& test_case);\n  virtual void OnTestStart(const TestInfo& test_info);\n  virtual void OnTestPartResult(const TestPartResult& result);\n  virtual void OnTestEnd(const TestInfo& test_info);\n  virtual void OnTestCaseEnd(const TestCase& test_case);\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);\n  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}\n\n private:\n  static void PrintFailedTests(const UnitTest& unit_test);\n};\n\n  // Fired before each iteration of tests starts.\nvoid PrettyUnitTestResultPrinter::OnTestIterationStart(\n    const UnitTest& unit_test, int iteration) {\n  if (GTEST_FLAG(repeat) != 1)\n    printf(\"\\nRepeating all tests (iteration %d) . . .\\n\\n\", iteration + 1);\n\n  const char* const filter = GTEST_FLAG(filter).c_str();\n\n  // Prints the filter if it's not *.  This reminds the user that some\n  // tests may be skipped.\n  if (!String::CStringEquals(filter, kUniversalFilter)) {\n    ColoredPrintf(COLOR_YELLOW,\n                  \"Note: %s filter = %s\\n\", GTEST_NAME_, filter);\n  }\n\n  if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {\n    const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);\n    ColoredPrintf(COLOR_YELLOW,\n                  \"Note: This is test shard %d of %s.\\n\",\n                  static_cast<int>(shard_index) + 1,\n                  internal::posix::GetEnv(kTestTotalShards));\n  }\n\n  if (GTEST_FLAG(shuffle)) {\n    ColoredPrintf(COLOR_YELLOW,\n                  \"Note: Randomizing tests' orders with a seed of %d .\\n\",\n                  unit_test.random_seed());\n  }\n\n  ColoredPrintf(COLOR_GREEN,  \"[==========] \");\n  printf(\"Running %s from %s.\\n\",\n         FormatTestCount(unit_test.test_to_run_count()).c_str(),\n         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(\n    const UnitTest& /*unit_test*/) {\n  ColoredPrintf(COLOR_GREEN,  \"[----------] \");\n  printf(\"Global test environment set-up.\\n\");\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {\n  const std::string counts =\n      FormatCountableNoun(test_case.test_to_run_count(), \"test\", \"tests\");\n  ColoredPrintf(COLOR_GREEN, \"[----------] \");\n  printf(\"%s from %s\", counts.c_str(), test_case.name());\n  if (test_case.type_param() == NULL) {\n    printf(\"\\n\");\n  } else {\n    printf(\", where %s = %s\\n\", kTypeParamLabel, test_case.type_param());\n  }\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {\n  ColoredPrintf(COLOR_GREEN,  \"[ RUN      ] \");\n  PrintTestName(test_info.test_case_name(), test_info.name());\n  printf(\"\\n\");\n  fflush(stdout);\n}\n\n// Called after an assertion failure.\nvoid PrettyUnitTestResultPrinter::OnTestPartResult(\n    const TestPartResult& result) {\n  // If the test part succeeded, we don't need to do anything.\n  if (result.type() == TestPartResult::kSuccess)\n    return;\n\n  // Print failure message from the assertion (e.g. expected this and got that).\n  PrintTestPartResult(result);\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {\n  if (test_info.result()->Passed()) {\n    ColoredPrintf(COLOR_GREEN, \"[       OK ] \");\n  } else {\n    ColoredPrintf(COLOR_RED, \"[  FAILED  ] \");\n  }\n  PrintTestName(test_info.test_case_name(), test_info.name());\n  if (test_info.result()->Failed())\n    PrintFullTestCommentIfPresent(test_info);\n\n  if (GTEST_FLAG(print_time)) {\n    printf(\" (%s ms)\\n\", internal::StreamableToString(\n           test_info.result()->elapsed_time()).c_str());\n  } else {\n    printf(\"\\n\");\n  }\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {\n  if (!GTEST_FLAG(print_time)) return;\n\n  const std::string counts =\n      FormatCountableNoun(test_case.test_to_run_count(), \"test\", \"tests\");\n  ColoredPrintf(COLOR_GREEN, \"[----------] \");\n  printf(\"%s from %s (%s ms total)\\n\\n\",\n         counts.c_str(), test_case.name(),\n         internal::StreamableToString(test_case.elapsed_time()).c_str());\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(\n    const UnitTest& /*unit_test*/) {\n  ColoredPrintf(COLOR_GREEN,  \"[----------] \");\n  printf(\"Global test environment tear-down\\n\");\n  fflush(stdout);\n}\n\n// Internal helper for printing the list of failed tests.\nvoid PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {\n  const int failed_test_count = unit_test.failed_test_count();\n  if (failed_test_count == 0) {\n    return;\n  }\n\n  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {\n    const TestCase& test_case = *unit_test.GetTestCase(i);\n    if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {\n      continue;\n    }\n    for (int j = 0; j < test_case.total_test_count(); ++j) {\n      const TestInfo& test_info = *test_case.GetTestInfo(j);\n      if (!test_info.should_run() || test_info.result()->Passed()) {\n        continue;\n      }\n      ColoredPrintf(COLOR_RED, \"[  FAILED  ] \");\n      printf(\"%s.%s\", test_case.name(), test_info.name());\n      PrintFullTestCommentIfPresent(test_info);\n      printf(\"\\n\");\n    }\n  }\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,\n                                                     int /*iteration*/) {\n  ColoredPrintf(COLOR_GREEN,  \"[==========] \");\n  printf(\"%s from %s ran.\",\n         FormatTestCount(unit_test.test_to_run_count()).c_str(),\n         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());\n  if (GTEST_FLAG(print_time)) {\n    printf(\" (%s ms total)\",\n           internal::StreamableToString(unit_test.elapsed_time()).c_str());\n  }\n  printf(\"\\n\");\n  ColoredPrintf(COLOR_GREEN,  \"[  PASSED  ] \");\n  printf(\"%s.\\n\", FormatTestCount(unit_test.successful_test_count()).c_str());\n\n  int num_failures = unit_test.failed_test_count();\n  if (!unit_test.Passed()) {\n    const int failed_test_count = unit_test.failed_test_count();\n    ColoredPrintf(COLOR_RED,  \"[  FAILED  ] \");\n    printf(\"%s, listed below:\\n\", FormatTestCount(failed_test_count).c_str());\n    PrintFailedTests(unit_test);\n    printf(\"\\n%2d FAILED %s\\n\", num_failures,\n                        num_failures == 1 ? \"TEST\" : \"TESTS\");\n  }\n\n  int num_disabled = unit_test.reportable_disabled_test_count();\n  if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {\n    if (!num_failures) {\n      printf(\"\\n\");  // Add a spacer if no FAILURE banner is displayed.\n    }\n    ColoredPrintf(COLOR_YELLOW,\n                  \"  YOU HAVE %d DISABLED %s\\n\\n\",\n                  num_disabled,\n                  num_disabled == 1 ? \"TEST\" : \"TESTS\");\n  }\n  // Ensure that Google Test output is printed before, e.g., heapchecker output.\n  fflush(stdout);\n}\n\n// End PrettyUnitTestResultPrinter\n\n// class TestEventRepeater\n//\n// This class forwards events to other event listeners.\nclass TestEventRepeater : public TestEventListener {\n public:\n  TestEventRepeater() : forwarding_enabled_(true) {}\n  virtual ~TestEventRepeater();\n  void Append(TestEventListener *listener);\n  TestEventListener* Release(TestEventListener* listener);\n\n  // Controls whether events will be forwarded to listeners_. Set to false\n  // in death test child processes.\n  bool forwarding_enabled() const { return forwarding_enabled_; }\n  void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }\n\n  virtual void OnTestProgramStart(const UnitTest& unit_test);\n  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);\n  virtual void OnTestCaseStart(const TestCase& test_case);\n  virtual void OnTestStart(const TestInfo& test_info);\n  virtual void OnTestPartResult(const TestPartResult& result);\n  virtual void OnTestEnd(const TestInfo& test_info);\n  virtual void OnTestCaseEnd(const TestCase& test_case);\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);\n  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);\n  virtual void OnTestProgramEnd(const UnitTest& unit_test);\n\n private:\n  // Controls whether events will be forwarded to listeners_. Set to false\n  // in death test child processes.\n  bool forwarding_enabled_;\n  // The list of listeners that receive events.\n  std::vector<TestEventListener*> listeners_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);\n};\n\nTestEventRepeater::~TestEventRepeater() {\n  ForEach(listeners_, Delete<TestEventListener>);\n}\n\nvoid TestEventRepeater::Append(TestEventListener *listener) {\n  listeners_.push_back(listener);\n}\n\n// TODO(vladl@google.com): Factor the search functionality into Vector::Find.\nTestEventListener* TestEventRepeater::Release(TestEventListener *listener) {\n  for (size_t i = 0; i < listeners_.size(); ++i) {\n    if (listeners_[i] == listener) {\n      listeners_.erase(listeners_.begin() + i);\n      return listener;\n    }\n  }\n\n  return NULL;\n}\n\n// Since most methods are very similar, use macros to reduce boilerplate.\n// This defines a member that forwards the call to all listeners.\n#define GTEST_REPEATER_METHOD_(Name, Type) \\\nvoid TestEventRepeater::Name(const Type& parameter) { \\\n  if (forwarding_enabled_) { \\\n    for (size_t i = 0; i < listeners_.size(); i++) { \\\n      listeners_[i]->Name(parameter); \\\n    } \\\n  } \\\n}\n// This defines a member that forwards the call to all listeners in reverse\n// order.\n#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \\\nvoid TestEventRepeater::Name(const Type& parameter) { \\\n  if (forwarding_enabled_) { \\\n    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \\\n      listeners_[i]->Name(parameter); \\\n    } \\\n  } \\\n}\n\nGTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)\nGTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)\nGTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)\nGTEST_REPEATER_METHOD_(OnTestStart, TestInfo)\nGTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)\nGTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)\nGTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)\nGTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)\nGTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)\nGTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)\nGTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)\n\n#undef GTEST_REPEATER_METHOD_\n#undef GTEST_REVERSE_REPEATER_METHOD_\n\nvoid TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,\n                                             int iteration) {\n  if (forwarding_enabled_) {\n    for (size_t i = 0; i < listeners_.size(); i++) {\n      listeners_[i]->OnTestIterationStart(unit_test, iteration);\n    }\n  }\n}\n\nvoid TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,\n                                           int iteration) {\n  if (forwarding_enabled_) {\n    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {\n      listeners_[i]->OnTestIterationEnd(unit_test, iteration);\n    }\n  }\n}\n\n// End TestEventRepeater\n\n// This class generates an XML output file.\nclass XmlUnitTestResultPrinter : public EmptyTestEventListener {\n public:\n  explicit XmlUnitTestResultPrinter(const char* output_file);\n\n  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);\n\n private:\n  // Is c a whitespace character that is normalized to a space character\n  // when it appears in an XML attribute value?\n  static bool IsNormalizableWhitespace(char c) {\n    return c == 0x9 || c == 0xA || c == 0xD;\n  }\n\n  // May c appear in a well-formed XML document?\n  static bool IsValidXmlCharacter(char c) {\n    return IsNormalizableWhitespace(c) || c >= 0x20;\n  }\n\n  // Returns an XML-escaped copy of the input string str.  If\n  // is_attribute is true, the text is meant to appear as an attribute\n  // value, and normalizable whitespace is preserved by replacing it\n  // with character references.\n  static std::string EscapeXml(const std::string& str, bool is_attribute);\n\n  // Returns the given string with all characters invalid in XML removed.\n  static std::string RemoveInvalidXmlCharacters(const std::string& str);\n\n  // Convenience wrapper around EscapeXml when str is an attribute value.\n  static std::string EscapeXmlAttribute(const std::string& str) {\n    return EscapeXml(str, true);\n  }\n\n  // Convenience wrapper around EscapeXml when str is not an attribute value.\n  static std::string EscapeXmlText(const char* str) {\n    return EscapeXml(str, false);\n  }\n\n  // Verifies that the given attribute belongs to the given element and\n  // streams the attribute as XML.\n  static void OutputXmlAttribute(std::ostream* stream,\n                                 const std::string& element_name,\n                                 const std::string& name,\n                                 const std::string& value);\n\n  // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.\n  static void OutputXmlCDataSection(::std::ostream* stream, const char* data);\n\n  // Streams an XML representation of a TestInfo object.\n  static void OutputXmlTestInfo(::std::ostream* stream,\n                                const char* test_case_name,\n                                const TestInfo& test_info);\n\n  // Prints an XML representation of a TestCase object\n  static void PrintXmlTestCase(::std::ostream* stream,\n                               const TestCase& test_case);\n\n  // Prints an XML summary of unit_test to output stream out.\n  static void PrintXmlUnitTest(::std::ostream* stream,\n                               const UnitTest& unit_test);\n\n  // Produces a string representing the test properties in a result as space\n  // delimited XML attributes based on the property key=\"value\" pairs.\n  // When the std::string is not empty, it includes a space at the beginning,\n  // to delimit this attribute from prior attributes.\n  static std::string TestPropertiesAsXmlAttributes(const TestResult& result);\n\n  // The output file.\n  const std::string output_file_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);\n};\n\n// Creates a new XmlUnitTestResultPrinter.\nXmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)\n    : output_file_(output_file) {\n  if (output_file_.c_str() == NULL || output_file_.empty()) {\n    fprintf(stderr, \"XML output file may not be null\\n\");\n    fflush(stderr);\n    exit(EXIT_FAILURE);\n  }\n}\n\n// Called after the unit test ends.\nvoid XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,\n                                                  int /*iteration*/) {\n  FILE* xmlout = NULL;\n  FilePath output_file(output_file_);\n  FilePath output_dir(output_file.RemoveFileName());\n\n  if (output_dir.CreateDirectoriesRecursively()) {\n    xmlout = posix::FOpen(output_file_.c_str(), \"w\");\n  }\n  if (xmlout == NULL) {\n    // TODO(wan): report the reason of the failure.\n    //\n    // We don't do it for now as:\n    //\n    //   1. There is no urgent need for it.\n    //   2. It's a bit involved to make the errno variable thread-safe on\n    //      all three operating systems (Linux, Windows, and Mac OS).\n    //   3. To interpret the meaning of errno in a thread-safe way,\n    //      we need the strerror_r() function, which is not available on\n    //      Windows.\n    fprintf(stderr,\n            \"Unable to open file \\\"%s\\\"\\n\",\n            output_file_.c_str());\n    fflush(stderr);\n    exit(EXIT_FAILURE);\n  }\n  std::stringstream stream;\n  PrintXmlUnitTest(&stream, unit_test);\n  fprintf(xmlout, \"%s\", StringStreamToString(&stream).c_str());\n  fclose(xmlout);\n}\n\n// Returns an XML-escaped copy of the input string str.  If is_attribute\n// is true, the text is meant to appear as an attribute value, and\n// normalizable whitespace is preserved by replacing it with character\n// references.\n//\n// Invalid XML characters in str, if any, are stripped from the output.\n// It is expected that most, if not all, of the text processed by this\n// module will consist of ordinary English text.\n// If this module is ever modified to produce version 1.1 XML output,\n// most invalid characters can be retained using character references.\n// TODO(wan): It might be nice to have a minimally invasive, human-readable\n// escaping scheme for invalid characters, rather than dropping them.\nstd::string XmlUnitTestResultPrinter::EscapeXml(\n    const std::string& str, bool is_attribute) {\n  Message m;\n\n  for (size_t i = 0; i < str.size(); ++i) {\n    const char ch = str[i];\n    switch (ch) {\n      case '<':\n        m << \"&lt;\";\n        break;\n      case '>':\n        m << \"&gt;\";\n        break;\n      case '&':\n        m << \"&amp;\";\n        break;\n      case '\\'':\n        if (is_attribute)\n          m << \"&apos;\";\n        else\n          m << '\\'';\n        break;\n      case '\"':\n        if (is_attribute)\n          m << \"&quot;\";\n        else\n          m << '\"';\n        break;\n      default:\n        if (IsValidXmlCharacter(ch)) {\n          if (is_attribute && IsNormalizableWhitespace(ch))\n            m << \"&#x\" << String::FormatByte(static_cast<unsigned char>(ch))\n              << \";\";\n          else\n            m << ch;\n        }\n        break;\n    }\n  }\n\n  return m.GetString();\n}\n\n// Returns the given string with all characters invalid in XML removed.\n// Currently invalid characters are dropped from the string. An\n// alternative is to replace them with certain characters such as . or ?.\nstd::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(\n    const std::string& str) {\n  std::string output;\n  output.reserve(str.size());\n  for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)\n    if (IsValidXmlCharacter(*it))\n      output.push_back(*it);\n\n  return output;\n}\n\n// The following routines generate an XML representation of a UnitTest\n// object.\n//\n// This is how Google Test concepts map to the DTD:\n//\n// <testsuites name=\"AllTests\">        <-- corresponds to a UnitTest object\n//   <testsuite name=\"testcase-name\">  <-- corresponds to a TestCase object\n//     <testcase name=\"test-name\">     <-- corresponds to a TestInfo object\n//       <failure message=\"...\">...</failure>\n//       <failure message=\"...\">...</failure>\n//       <failure message=\"...\">...</failure>\n//                                     <-- individual assertion failures\n//     </testcase>\n//   </testsuite>\n// </testsuites>\n\n// Formats the given time in milliseconds as seconds.\nstd::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {\n  ::std::stringstream ss;\n  ss << ms/1000.0;\n  return ss.str();\n}\n\n// Converts the given epoch time in milliseconds to a date string in the ISO\n// 8601 format, without the timezone information.\nstd::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {\n  // Using non-reentrant version as localtime_r is not portable.\n  time_t seconds = static_cast<time_t>(ms / 1000);\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4996)  // Temporarily disables warning 4996\n                                // (function or variable may be unsafe).\n  const struct tm* const time_struct = localtime(&seconds);  // NOLINT\n# pragma warning(pop)           // Restores the warning state again.\n#else\n  const struct tm* const time_struct = localtime(&seconds);  // NOLINT\n#endif\n  if (time_struct == NULL)\n    return \"\";  // Invalid ms value\n\n  // YYYY-MM-DDThh:mm:ss\n  return StreamableToString(time_struct->tm_year + 1900) + \"-\" +\n      String::FormatIntWidth2(time_struct->tm_mon + 1) + \"-\" +\n      String::FormatIntWidth2(time_struct->tm_mday) + \"T\" +\n      String::FormatIntWidth2(time_struct->tm_hour) + \":\" +\n      String::FormatIntWidth2(time_struct->tm_min) + \":\" +\n      String::FormatIntWidth2(time_struct->tm_sec);\n}\n\n// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.\nvoid XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,\n                                                     const char* data) {\n  const char* segment = data;\n  *stream << \"<![CDATA[\";\n  for (;;) {\n    const char* const next_segment = strstr(segment, \"]]>\");\n    if (next_segment != NULL) {\n      stream->write(\n          segment, static_cast<std::streamsize>(next_segment - segment));\n      *stream << \"]]>]]&gt;<![CDATA[\";\n      segment = next_segment + strlen(\"]]>\");\n    } else {\n      *stream << segment;\n      break;\n    }\n  }\n  *stream << \"]]>\";\n}\n\nvoid XmlUnitTestResultPrinter::OutputXmlAttribute(\n    std::ostream* stream,\n    const std::string& element_name,\n    const std::string& name,\n    const std::string& value) {\n  const std::vector<std::string>& allowed_names =\n      GetReservedAttributesForElement(element_name);\n\n  GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) !=\n                   allowed_names.end())\n      << \"Attribute \" << name << \" is not allowed for element <\" << element_name\n      << \">.\";\n\n  *stream << \" \" << name << \"=\\\"\" << EscapeXmlAttribute(value) << \"\\\"\";\n}\n\n// Prints an XML representation of a TestInfo object.\n// TODO(wan): There is also value in printing properties with the plain printer.\nvoid XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,\n                                                 const char* test_case_name,\n                                                 const TestInfo& test_info) {\n  const TestResult& result = *test_info.result();\n  const std::string kTestcase = \"testcase\";\n\n  *stream << \"    <testcase\";\n  OutputXmlAttribute(stream, kTestcase, \"name\", test_info.name());\n\n  if (test_info.value_param() != NULL) {\n    OutputXmlAttribute(stream, kTestcase, \"value_param\",\n                       test_info.value_param());\n  }\n  if (test_info.type_param() != NULL) {\n    OutputXmlAttribute(stream, kTestcase, \"type_param\", test_info.type_param());\n  }\n\n  OutputXmlAttribute(stream, kTestcase, \"status\",\n                     test_info.should_run() ? \"run\" : \"notrun\");\n  OutputXmlAttribute(stream, kTestcase, \"time\",\n                     FormatTimeInMillisAsSeconds(result.elapsed_time()));\n  OutputXmlAttribute(stream, kTestcase, \"classname\", test_case_name);\n  *stream << TestPropertiesAsXmlAttributes(result);\n\n  int failures = 0;\n  for (int i = 0; i < result.total_part_count(); ++i) {\n    const TestPartResult& part = result.GetTestPartResult(i);\n    if (part.failed()) {\n      if (++failures == 1) {\n        *stream << \">\\n\";\n      }\n      const string location = internal::FormatCompilerIndependentFileLocation(\n          part.file_name(), part.line_number());\n      const string summary = location + \"\\n\" + part.summary();\n      *stream << \"      <failure message=\\\"\"\n              << EscapeXmlAttribute(summary.c_str())\n              << \"\\\" type=\\\"\\\">\";\n      const string detail = location + \"\\n\" + part.message();\n      OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());\n      *stream << \"</failure>\\n\";\n    }\n  }\n\n  if (failures == 0)\n    *stream << \" />\\n\";\n  else\n    *stream << \"    </testcase>\\n\";\n}\n\n// Prints an XML representation of a TestCase object\nvoid XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream,\n                                                const TestCase& test_case) {\n  const std::string kTestsuite = \"testsuite\";\n  *stream << \"  <\" << kTestsuite;\n  OutputXmlAttribute(stream, kTestsuite, \"name\", test_case.name());\n  OutputXmlAttribute(stream, kTestsuite, \"tests\",\n                     StreamableToString(test_case.reportable_test_count()));\n  OutputXmlAttribute(stream, kTestsuite, \"failures\",\n                     StreamableToString(test_case.failed_test_count()));\n  OutputXmlAttribute(\n      stream, kTestsuite, \"disabled\",\n      StreamableToString(test_case.reportable_disabled_test_count()));\n  OutputXmlAttribute(stream, kTestsuite, \"errors\", \"0\");\n  OutputXmlAttribute(stream, kTestsuite, \"time\",\n                     FormatTimeInMillisAsSeconds(test_case.elapsed_time()));\n  *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result())\n          << \">\\n\";\n\n  for (int i = 0; i < test_case.total_test_count(); ++i) {\n    if (test_case.GetTestInfo(i)->is_reportable())\n      OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i));\n  }\n  *stream << \"  </\" << kTestsuite << \">\\n\";\n}\n\n// Prints an XML summary of unit_test to output stream out.\nvoid XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,\n                                                const UnitTest& unit_test) {\n  const std::string kTestsuites = \"testsuites\";\n\n  *stream << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\";\n  *stream << \"<\" << kTestsuites;\n\n  OutputXmlAttribute(stream, kTestsuites, \"tests\",\n                     StreamableToString(unit_test.reportable_test_count()));\n  OutputXmlAttribute(stream, kTestsuites, \"failures\",\n                     StreamableToString(unit_test.failed_test_count()));\n  OutputXmlAttribute(\n      stream, kTestsuites, \"disabled\",\n      StreamableToString(unit_test.reportable_disabled_test_count()));\n  OutputXmlAttribute(stream, kTestsuites, \"errors\", \"0\");\n  OutputXmlAttribute(\n      stream, kTestsuites, \"timestamp\",\n      FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));\n  OutputXmlAttribute(stream, kTestsuites, \"time\",\n                     FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));\n\n  if (GTEST_FLAG(shuffle)) {\n    OutputXmlAttribute(stream, kTestsuites, \"random_seed\",\n                       StreamableToString(unit_test.random_seed()));\n  }\n\n  *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());\n\n  OutputXmlAttribute(stream, kTestsuites, \"name\", \"AllTests\");\n  *stream << \">\\n\";\n\n  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {\n    if (unit_test.GetTestCase(i)->reportable_test_count() > 0)\n      PrintXmlTestCase(stream, *unit_test.GetTestCase(i));\n  }\n  *stream << \"</\" << kTestsuites << \">\\n\";\n}\n\n// Produces a string representing the test properties in a result as space\n// delimited XML attributes based on the property key=\"value\" pairs.\nstd::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(\n    const TestResult& result) {\n  Message attributes;\n  for (int i = 0; i < result.test_property_count(); ++i) {\n    const TestProperty& property = result.GetTestProperty(i);\n    attributes << \" \" << property.key() << \"=\"\n        << \"\\\"\" << EscapeXmlAttribute(property.value()) << \"\\\"\";\n  }\n  return attributes.GetString();\n}\n\n// End XmlUnitTestResultPrinter\n\n#if GTEST_CAN_STREAM_RESULTS_\n\n// Checks if str contains '=', '&', '%' or '\\n' characters. If yes,\n// replaces them by \"%xx\" where xx is their hexadecimal value. For\n// example, replaces \"=\" with \"%3D\".  This algorithm is O(strlen(str))\n// in both time and space -- important as the input str may contain an\n// arbitrarily long test failure message and stack trace.\nstring StreamingListener::UrlEncode(const char* str) {\n  string result;\n  result.reserve(strlen(str) + 1);\n  for (char ch = *str; ch != '\\0'; ch = *++str) {\n    switch (ch) {\n      case '%':\n      case '=':\n      case '&':\n      case '\\n':\n        result.append(\"%\" + String::FormatByte(static_cast<unsigned char>(ch)));\n        break;\n      default:\n        result.push_back(ch);\n        break;\n    }\n  }\n  return result;\n}\n\nvoid StreamingListener::SocketWriter::MakeConnection() {\n  GTEST_CHECK_(sockfd_ == -1)\n      << \"MakeConnection() can't be called when there is already a connection.\";\n\n  addrinfo hints;\n  memset(&hints, 0, sizeof(hints));\n  hints.ai_family = AF_UNSPEC;    // To allow both IPv4 and IPv6 addresses.\n  hints.ai_socktype = SOCK_STREAM;\n  addrinfo* servinfo = NULL;\n\n  // Use the getaddrinfo() to get a linked list of IP addresses for\n  // the given host name.\n  const int error_num = getaddrinfo(\n      host_name_.c_str(), port_num_.c_str(), &hints, &servinfo);\n  if (error_num != 0) {\n    GTEST_LOG_(WARNING) << \"stream_result_to: getaddrinfo() failed: \"\n                        << gai_strerror(error_num);\n  }\n\n  // Loop through all the results and connect to the first we can.\n  for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != NULL;\n       cur_addr = cur_addr->ai_next) {\n    sockfd_ = socket(\n        cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol);\n    if (sockfd_ != -1) {\n      // Connect the client socket to the server socket.\n      if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) {\n        close(sockfd_);\n        sockfd_ = -1;\n      }\n    }\n  }\n\n  freeaddrinfo(servinfo);  // all done with this structure\n\n  if (sockfd_ == -1) {\n    GTEST_LOG_(WARNING) << \"stream_result_to: failed to connect to \"\n                        << host_name_ << \":\" << port_num_;\n  }\n}\n\n// End of class Streaming Listener\n#endif  // GTEST_CAN_STREAM_RESULTS__\n\n// Class ScopedTrace\n\n// Pushes the given source file location and message onto a per-thread\n// trace stack maintained by Google Test.\nScopedTrace::ScopedTrace(const char* file, int line, const Message& message)\n    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {\n  TraceInfo trace;\n  trace.file = file;\n  trace.line = line;\n  trace.message = message.GetString();\n\n  UnitTest::GetInstance()->PushGTestTrace(trace);\n}\n\n// Pops the info pushed by the c'tor.\nScopedTrace::~ScopedTrace()\n    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {\n  UnitTest::GetInstance()->PopGTestTrace();\n}\n\n\n// class OsStackTraceGetter\n\n// Returns the current OS stack trace as an std::string.  Parameters:\n//\n//   max_depth  - the maximum number of stack frames to be included\n//                in the trace.\n//   skip_count - the number of top frames to be skipped; doesn't count\n//                against max_depth.\n//\nstring OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,\n                                             int /* skip_count */)\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  return \"\";\n}\n\nvoid OsStackTraceGetter::UponLeavingGTest()\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n}\n\nconst char* const\nOsStackTraceGetter::kElidedFramesMarker =\n    \"... \" GTEST_NAME_ \" internal frames ...\";\n\n// A helper class that creates the premature-exit file in its\n// constructor and deletes the file in its destructor.\nclass ScopedPrematureExitFile {\n public:\n  explicit ScopedPrematureExitFile(const char* premature_exit_filepath)\n      : premature_exit_filepath_(premature_exit_filepath) {\n    // If a path to the premature-exit file is specified...\n    if (premature_exit_filepath != NULL && *premature_exit_filepath != '\\0') {\n      // create the file with a single \"0\" character in it.  I/O\n      // errors are ignored as there's nothing better we can do and we\n      // don't want to fail the test because of this.\n      FILE* pfile = posix::FOpen(premature_exit_filepath, \"w\");\n      fwrite(\"0\", 1, 1, pfile);\n      fclose(pfile);\n    }\n  }\n\n  ~ScopedPrematureExitFile() {\n    if (premature_exit_filepath_ != NULL && *premature_exit_filepath_ != '\\0') {\n      remove(premature_exit_filepath_);\n    }\n  }\n\n private:\n  const char* const premature_exit_filepath_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile);\n};\n\n}  // namespace internal\n\n// class TestEventListeners\n\nTestEventListeners::TestEventListeners()\n    : repeater_(new internal::TestEventRepeater()),\n      default_result_printer_(NULL),\n      default_xml_generator_(NULL) {\n}\n\nTestEventListeners::~TestEventListeners() { delete repeater_; }\n\n// Returns the standard listener responsible for the default console\n// output.  Can be removed from the listeners list to shut down default\n// console output.  Note that removing this object from the listener list\n// with Release transfers its ownership to the user.\nvoid TestEventListeners::Append(TestEventListener* listener) {\n  repeater_->Append(listener);\n}\n\n// Removes the given event listener from the list and returns it.  It then\n// becomes the caller's responsibility to delete the listener. Returns\n// NULL if the listener is not found in the list.\nTestEventListener* TestEventListeners::Release(TestEventListener* listener) {\n  if (listener == default_result_printer_)\n    default_result_printer_ = NULL;\n  else if (listener == default_xml_generator_)\n    default_xml_generator_ = NULL;\n  return repeater_->Release(listener);\n}\n\n// Returns repeater that broadcasts the TestEventListener events to all\n// subscribers.\nTestEventListener* TestEventListeners::repeater() { return repeater_; }\n\n// Sets the default_result_printer attribute to the provided listener.\n// The listener is also added to the listener list and previous\n// default_result_printer is removed from it and deleted. The listener can\n// also be NULL in which case it will not be added to the list. Does\n// nothing if the previous and the current listener objects are the same.\nvoid TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {\n  if (default_result_printer_ != listener) {\n    // It is an error to pass this method a listener that is already in the\n    // list.\n    delete Release(default_result_printer_);\n    default_result_printer_ = listener;\n    if (listener != NULL)\n      Append(listener);\n  }\n}\n\n// Sets the default_xml_generator attribute to the provided listener.  The\n// listener is also added to the listener list and previous\n// default_xml_generator is removed from it and deleted. The listener can\n// also be NULL in which case it will not be added to the list. Does\n// nothing if the previous and the current listener objects are the same.\nvoid TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {\n  if (default_xml_generator_ != listener) {\n    // It is an error to pass this method a listener that is already in the\n    // list.\n    delete Release(default_xml_generator_);\n    default_xml_generator_ = listener;\n    if (listener != NULL)\n      Append(listener);\n  }\n}\n\n// Controls whether events will be forwarded by the repeater to the\n// listeners in the list.\nbool TestEventListeners::EventForwardingEnabled() const {\n  return repeater_->forwarding_enabled();\n}\n\nvoid TestEventListeners::SuppressEventForwarding() {\n  repeater_->set_forwarding_enabled(false);\n}\n\n// class UnitTest\n\n// Gets the singleton UnitTest object.  The first time this method is\n// called, a UnitTest object is constructed and returned.  Consecutive\n// calls will return the same object.\n//\n// We don't protect this under mutex_ as a user is not supposed to\n// call this before main() starts, from which point on the return\n// value will never change.\nUnitTest* UnitTest::GetInstance() {\n  // When compiled with MSVC 7.1 in optimized mode, destroying the\n  // UnitTest object upon exiting the program messes up the exit code,\n  // causing successful tests to appear failed.  We have to use a\n  // different implementation in this case to bypass the compiler bug.\n  // This implementation makes the compiler happy, at the cost of\n  // leaking the UnitTest object.\n\n  // CodeGear C++Builder insists on a public destructor for the\n  // default implementation.  Use this implementation to keep good OO\n  // design with private destructor.\n\n#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)\n  static UnitTest* const instance = new UnitTest;\n  return instance;\n#else\n  static UnitTest instance;\n  return &instance;\n#endif  // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)\n}\n\n// Gets the number of successful test cases.\nint UnitTest::successful_test_case_count() const {\n  return impl()->successful_test_case_count();\n}\n\n// Gets the number of failed test cases.\nint UnitTest::failed_test_case_count() const {\n  return impl()->failed_test_case_count();\n}\n\n// Gets the number of all test cases.\nint UnitTest::total_test_case_count() const {\n  return impl()->total_test_case_count();\n}\n\n// Gets the number of all test cases that contain at least one test\n// that should run.\nint UnitTest::test_case_to_run_count() const {\n  return impl()->test_case_to_run_count();\n}\n\n// Gets the number of successful tests.\nint UnitTest::successful_test_count() const {\n  return impl()->successful_test_count();\n}\n\n// Gets the number of failed tests.\nint UnitTest::failed_test_count() const { return impl()->failed_test_count(); }\n\n// Gets the number of disabled tests that will be reported in the XML report.\nint UnitTest::reportable_disabled_test_count() const {\n  return impl()->reportable_disabled_test_count();\n}\n\n// Gets the number of disabled tests.\nint UnitTest::disabled_test_count() const {\n  return impl()->disabled_test_count();\n}\n\n// Gets the number of tests to be printed in the XML report.\nint UnitTest::reportable_test_count() const {\n  return impl()->reportable_test_count();\n}\n\n// Gets the number of all tests.\nint UnitTest::total_test_count() const { return impl()->total_test_count(); }\n\n// Gets the number of tests that should run.\nint UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }\n\n// Gets the time of the test program start, in ms from the start of the\n// UNIX epoch.\ninternal::TimeInMillis UnitTest::start_timestamp() const {\n    return impl()->start_timestamp();\n}\n\n// Gets the elapsed time, in milliseconds.\ninternal::TimeInMillis UnitTest::elapsed_time() const {\n  return impl()->elapsed_time();\n}\n\n// Returns true iff the unit test passed (i.e. all test cases passed).\nbool UnitTest::Passed() const { return impl()->Passed(); }\n\n// Returns true iff the unit test failed (i.e. some test case failed\n// or something outside of all tests failed).\nbool UnitTest::Failed() const { return impl()->Failed(); }\n\n// Gets the i-th test case among all the test cases. i can range from 0 to\n// total_test_case_count() - 1. If i is not in that range, returns NULL.\nconst TestCase* UnitTest::GetTestCase(int i) const {\n  return impl()->GetTestCase(i);\n}\n\n// Returns the TestResult containing information on test failures and\n// properties logged outside of individual test cases.\nconst TestResult& UnitTest::ad_hoc_test_result() const {\n  return *impl()->ad_hoc_test_result();\n}\n\n// Gets the i-th test case among all the test cases. i can range from 0 to\n// total_test_case_count() - 1. If i is not in that range, returns NULL.\nTestCase* UnitTest::GetMutableTestCase(int i) {\n  return impl()->GetMutableTestCase(i);\n}\n\n// Returns the list of event listeners that can be used to track events\n// inside Google Test.\nTestEventListeners& UnitTest::listeners() {\n  return *impl()->listeners();\n}\n\n// Registers and returns a global test environment.  When a test\n// program is run, all global test environments will be set-up in the\n// order they were registered.  After all tests in the program have\n// finished, all global test environments will be torn-down in the\n// *reverse* order they were registered.\n//\n// The UnitTest object takes ownership of the given environment.\n//\n// We don't protect this under mutex_, as we only support calling it\n// from the main thread.\nEnvironment* UnitTest::AddEnvironment(Environment* env) {\n  if (env == NULL) {\n    return NULL;\n  }\n\n  impl_->environments().push_back(env);\n  return env;\n}\n\n// Adds a TestPartResult to the current TestResult object.  All Google Test\n// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call\n// this to report their results.  The user code should use the\n// assertion macros instead of calling this directly.\nvoid UnitTest::AddTestPartResult(\n    TestPartResult::Type result_type,\n    const char* file_name,\n    int line_number,\n    const std::string& message,\n    const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) {\n  Message msg;\n  msg << message;\n\n  internal::MutexLock lock(&mutex_);\n  if (impl_->gtest_trace_stack().size() > 0) {\n    msg << \"\\n\" << GTEST_NAME_ << \" trace:\";\n\n    for (int i = static_cast<int>(impl_->gtest_trace_stack().size());\n         i > 0; --i) {\n      const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];\n      msg << \"\\n\" << internal::FormatFileLocation(trace.file, trace.line)\n          << \" \" << trace.message;\n    }\n  }\n\n  if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {\n    msg << internal::kStackTraceMarker << os_stack_trace;\n  }\n\n  const TestPartResult result =\n    TestPartResult(result_type, file_name, line_number,\n                   msg.GetString().c_str());\n  impl_->GetTestPartResultReporterForCurrentThread()->\n      ReportTestPartResult(result);\n\n  if (result_type != TestPartResult::kSuccess) {\n    // gtest_break_on_failure takes precedence over\n    // gtest_throw_on_failure.  This allows a user to set the latter\n    // in the code (perhaps in order to use Google Test assertions\n    // with another testing framework) and specify the former on the\n    // command line for debugging.\n    if (GTEST_FLAG(break_on_failure)) {\n#if GTEST_OS_WINDOWS\n      // Using DebugBreak on Windows allows gtest to still break into a debugger\n      // when a failure happens and both the --gtest_break_on_failure and\n      // the --gtest_catch_exceptions flags are specified.\n      DebugBreak();\n#else\n      // Dereference NULL through a volatile pointer to prevent the compiler\n      // from removing. We use this rather than abort() or __builtin_trap() for\n      // portability: Symbian doesn't implement abort() well, and some debuggers\n      // don't correctly trap abort().\n      *static_cast<volatile int*>(NULL) = 1;\n#endif  // GTEST_OS_WINDOWS\n    } else if (GTEST_FLAG(throw_on_failure)) {\n#if GTEST_HAS_EXCEPTIONS\n      throw internal::GoogleTestFailureException(result);\n#else\n      // We cannot call abort() as it generates a pop-up in debug mode\n      // that cannot be suppressed in VC 7.1 or below.\n      exit(1);\n#endif\n    }\n  }\n}\n\n// Adds a TestProperty to the current TestResult object when invoked from\n// inside a test, to current TestCase's ad_hoc_test_result_ when invoked\n// from SetUpTestCase or TearDownTestCase, or to the global property set\n// when invoked elsewhere.  If the result already contains a property with\n// the same key, the value will be updated.\nvoid UnitTest::RecordProperty(const std::string& key,\n                              const std::string& value) {\n  impl_->RecordProperty(TestProperty(key, value));\n}\n\n// Runs all tests in this UnitTest object and prints the result.\n// Returns 0 if successful, or 1 otherwise.\n//\n// We don't protect this under mutex_, as we only support calling it\n// from the main thread.\nint UnitTest::Run() {\n  const bool in_death_test_child_process =\n      internal::GTEST_FLAG(internal_run_death_test).length() > 0;\n\n  // Google Test implements this protocol for catching that a test\n  // program exits before returning control to Google Test:\n  //\n  //   1. Upon start, Google Test creates a file whose absolute path\n  //      is specified by the environment variable\n  //      TEST_PREMATURE_EXIT_FILE.\n  //   2. When Google Test has finished its work, it deletes the file.\n  //\n  // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before\n  // running a Google-Test-based test program and check the existence\n  // of the file at the end of the test execution to see if it has\n  // exited prematurely.\n\n  // If we are in the child process of a death test, don't\n  // create/delete the premature exit file, as doing so is unnecessary\n  // and will confuse the parent process.  Otherwise, create/delete\n  // the file upon entering/leaving this function.  If the program\n  // somehow exits before this function has a chance to return, the\n  // premature-exit file will be left undeleted, causing a test runner\n  // that understands the premature-exit-file protocol to report the\n  // test as having failed.\n  const internal::ScopedPrematureExitFile premature_exit_file(\n      in_death_test_child_process ?\n      NULL : internal::posix::GetEnv(\"TEST_PREMATURE_EXIT_FILE\"));\n\n  // Captures the value of GTEST_FLAG(catch_exceptions).  This value will be\n  // used for the duration of the program.\n  impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions));\n\n#if GTEST_HAS_SEH\n  // Either the user wants Google Test to catch exceptions thrown by the\n  // tests or this is executing in the context of death test child\n  // process. In either case the user does not want to see pop-up dialogs\n  // about crashes - they are expected.\n  if (impl()->catch_exceptions() || in_death_test_child_process) {\n# if !GTEST_OS_WINDOWS_MOBILE\n    // SetErrorMode doesn't exist on CE.\n    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |\n                 SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\n# endif  // !GTEST_OS_WINDOWS_MOBILE\n\n# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE\n    // Death test children can be terminated with _abort().  On Windows,\n    // _abort() can show a dialog with a warning message.  This forces the\n    // abort message to go to stderr instead.\n    _set_error_mode(_OUT_TO_STDERR);\n# endif\n\n# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE\n    // In the debug version, Visual Studio pops up a separate dialog\n    // offering a choice to debug the aborted program. We need to suppress\n    // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement\n    // executed. Google Test will notify the user of any unexpected\n    // failure via stderr.\n    //\n    // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.\n    // Users of prior VC versions shall suffer the agony and pain of\n    // clicking through the countless debug dialogs.\n    // TODO(vladl@google.com): find a way to suppress the abort dialog() in the\n    // debug mode when compiled with VC 7.1 or lower.\n    if (!GTEST_FLAG(break_on_failure))\n      _set_abort_behavior(\n          0x0,                                    // Clear the following flags:\n          _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.\n# endif\n  }\n#endif  // GTEST_HAS_SEH\n\n  return internal::HandleExceptionsInMethodIfSupported(\n      impl(),\n      &internal::UnitTestImpl::RunAllTests,\n      \"auxiliary test code (environments or event listeners)\") ? 0 : 1;\n}\n\n// Returns the working directory when the first TEST() or TEST_F() was\n// executed.\nconst char* UnitTest::original_working_dir() const {\n  return impl_->original_working_dir_.c_str();\n}\n\n// Returns the TestCase object for the test that's currently running,\n// or NULL if no test is running.\nconst TestCase* UnitTest::current_test_case() const\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  return impl_->current_test_case();\n}\n\n// Returns the TestInfo object for the test that's currently running,\n// or NULL if no test is running.\nconst TestInfo* UnitTest::current_test_info() const\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  return impl_->current_test_info();\n}\n\n// Returns the random seed used at the start of the current test run.\nint UnitTest::random_seed() const { return impl_->random_seed(); }\n\n#if GTEST_HAS_PARAM_TEST\n// Returns ParameterizedTestCaseRegistry object used to keep track of\n// value-parameterized tests and instantiate and register them.\ninternal::ParameterizedTestCaseRegistry&\n    UnitTest::parameterized_test_registry()\n        GTEST_LOCK_EXCLUDED_(mutex_) {\n  return impl_->parameterized_test_registry();\n}\n#endif  // GTEST_HAS_PARAM_TEST\n\n// Creates an empty UnitTest.\nUnitTest::UnitTest() {\n  impl_ = new internal::UnitTestImpl(this);\n}\n\n// Destructor of UnitTest.\nUnitTest::~UnitTest() {\n  delete impl_;\n}\n\n// Pushes a trace defined by SCOPED_TRACE() on to the per-thread\n// Google Test trace stack.\nvoid UnitTest::PushGTestTrace(const internal::TraceInfo& trace)\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  impl_->gtest_trace_stack().push_back(trace);\n}\n\n// Pops a trace from the per-thread Google Test trace stack.\nvoid UnitTest::PopGTestTrace()\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  impl_->gtest_trace_stack().pop_back();\n}\n\nnamespace internal {\n\nUnitTestImpl::UnitTestImpl(UnitTest* parent)\n    : parent_(parent),\n#ifdef _MSC_VER\n# pragma warning(push)                    // Saves the current warning state.\n# pragma warning(disable:4355)            // Temporarily disables warning 4355\n                                         // (using this in initializer).\n      default_global_test_part_result_reporter_(this),\n      default_per_thread_test_part_result_reporter_(this),\n# pragma warning(pop)                     // Restores the warning state again.\n#else\n      default_global_test_part_result_reporter_(this),\n      default_per_thread_test_part_result_reporter_(this),\n#endif  // _MSC_VER\n      global_test_part_result_repoter_(\n          &default_global_test_part_result_reporter_),\n      per_thread_test_part_result_reporter_(\n          &default_per_thread_test_part_result_reporter_),\n#if GTEST_HAS_PARAM_TEST\n      parameterized_test_registry_(),\n      parameterized_tests_registered_(false),\n#endif  // GTEST_HAS_PARAM_TEST\n      last_death_test_case_(-1),\n      current_test_case_(NULL),\n      current_test_info_(NULL),\n      ad_hoc_test_result_(),\n      os_stack_trace_getter_(NULL),\n      post_flag_parse_init_performed_(false),\n      random_seed_(0),  // Will be overridden by the flag before first use.\n      random_(0),  // Will be reseeded before first use.\n      start_timestamp_(0),\n      elapsed_time_(0),\n#if GTEST_HAS_DEATH_TEST\n      death_test_factory_(new DefaultDeathTestFactory),\n#endif\n      // Will be overridden by the flag before first use.\n      catch_exceptions_(false) {\n  listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);\n}\n\nUnitTestImpl::~UnitTestImpl() {\n  // Deletes every TestCase.\n  ForEach(test_cases_, internal::Delete<TestCase>);\n\n  // Deletes every Environment.\n  ForEach(environments_, internal::Delete<Environment>);\n\n  delete os_stack_trace_getter_;\n}\n\n// Adds a TestProperty to the current TestResult object when invoked in a\n// context of a test, to current test case's ad_hoc_test_result when invoke\n// from SetUpTestCase/TearDownTestCase, or to the global property set\n// otherwise.  If the result already contains a property with the same key,\n// the value will be updated.\nvoid UnitTestImpl::RecordProperty(const TestProperty& test_property) {\n  std::string xml_element;\n  TestResult* test_result;  // TestResult appropriate for property recording.\n\n  if (current_test_info_ != NULL) {\n    xml_element = \"testcase\";\n    test_result = &(current_test_info_->result_);\n  } else if (current_test_case_ != NULL) {\n    xml_element = \"testsuite\";\n    test_result = &(current_test_case_->ad_hoc_test_result_);\n  } else {\n    xml_element = \"testsuites\";\n    test_result = &ad_hoc_test_result_;\n  }\n  test_result->RecordProperty(xml_element, test_property);\n}\n\n#if GTEST_HAS_DEATH_TEST\n// Disables event forwarding if the control is currently in a death test\n// subprocess. Must not be called before InitGoogleTest.\nvoid UnitTestImpl::SuppressTestEventsIfInSubprocess() {\n  if (internal_run_death_test_flag_.get() != NULL)\n    listeners()->SuppressEventForwarding();\n}\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Initializes event listeners performing XML output as specified by\n// UnitTestOptions. Must not be called before InitGoogleTest.\nvoid UnitTestImpl::ConfigureXmlOutput() {\n  const std::string& output_format = UnitTestOptions::GetOutputFormat();\n  if (output_format == \"xml\") {\n    listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(\n        UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));\n  } else if (output_format != \"\") {\n    printf(\"WARNING: unrecognized output format \\\"%s\\\" ignored.\\n\",\n           output_format.c_str());\n    fflush(stdout);\n  }\n}\n\n#if GTEST_CAN_STREAM_RESULTS_\n// Initializes event listeners for streaming test results in string form.\n// Must not be called before InitGoogleTest.\nvoid UnitTestImpl::ConfigureStreamingOutput() {\n  const std::string& target = GTEST_FLAG(stream_result_to);\n  if (!target.empty()) {\n    const size_t pos = target.find(':');\n    if (pos != std::string::npos) {\n      listeners()->Append(new StreamingListener(target.substr(0, pos),\n                                                target.substr(pos+1)));\n    } else {\n      printf(\"WARNING: unrecognized streaming target \\\"%s\\\" ignored.\\n\",\n             target.c_str());\n      fflush(stdout);\n    }\n  }\n}\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\n// Performs initialization dependent upon flag values obtained in\n// ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to\n// ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest\n// this function is also called from RunAllTests.  Since this function can be\n// called more than once, it has to be idempotent.\nvoid UnitTestImpl::PostFlagParsingInit() {\n  // Ensures that this function does not execute more than once.\n  if (!post_flag_parse_init_performed_) {\n    post_flag_parse_init_performed_ = true;\n\n#if GTEST_HAS_DEATH_TEST\n    InitDeathTestSubprocessControlInfo();\n    SuppressTestEventsIfInSubprocess();\n#endif  // GTEST_HAS_DEATH_TEST\n\n    // Registers parameterized tests. This makes parameterized tests\n    // available to the UnitTest reflection API without running\n    // RUN_ALL_TESTS.\n    RegisterParameterizedTests();\n\n    // Configures listeners for XML output. This makes it possible for users\n    // to shut down the default XML output before invoking RUN_ALL_TESTS.\n    ConfigureXmlOutput();\n\n#if GTEST_CAN_STREAM_RESULTS_\n    // Configures listeners for streaming test results to the specified server.\n    ConfigureStreamingOutput();\n#endif  // GTEST_CAN_STREAM_RESULTS_\n  }\n}\n\n// A predicate that checks the name of a TestCase against a known\n// value.\n//\n// This is used for implementation of the UnitTest class only.  We put\n// it in the anonymous namespace to prevent polluting the outer\n// namespace.\n//\n// TestCaseNameIs is copyable.\nclass TestCaseNameIs {\n public:\n  // Constructor.\n  explicit TestCaseNameIs(const std::string& name)\n      : name_(name) {}\n\n  // Returns true iff the name of test_case matches name_.\n  bool operator()(const TestCase* test_case) const {\n    return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;\n  }\n\n private:\n  std::string name_;\n};\n\n// Finds and returns a TestCase with the given name.  If one doesn't\n// exist, creates one and returns it.  It's the CALLER'S\n// RESPONSIBILITY to ensure that this function is only called WHEN THE\n// TESTS ARE NOT SHUFFLED.\n//\n// Arguments:\n//\n//   test_case_name: name of the test case\n//   type_param:     the name of the test case's type parameter, or NULL if\n//                   this is not a typed or a type-parameterized test case.\n//   set_up_tc:      pointer to the function that sets up the test case\n//   tear_down_tc:   pointer to the function that tears down the test case\nTestCase* UnitTestImpl::GetTestCase(const char* test_case_name,\n                                    const char* type_param,\n                                    Test::SetUpTestCaseFunc set_up_tc,\n                                    Test::TearDownTestCaseFunc tear_down_tc) {\n  // Can we find a TestCase with the given name?\n  const std::vector<TestCase*>::const_iterator test_case =\n      std::find_if(test_cases_.begin(), test_cases_.end(),\n                   TestCaseNameIs(test_case_name));\n\n  if (test_case != test_cases_.end())\n    return *test_case;\n\n  // No.  Let's create one.\n  TestCase* const new_test_case =\n      new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc);\n\n  // Is this a death test case?\n  if (internal::UnitTestOptions::MatchesFilter(test_case_name,\n                                               kDeathTestCaseFilter)) {\n    // Yes.  Inserts the test case after the last death test case\n    // defined so far.  This only works when the test cases haven't\n    // been shuffled.  Otherwise we may end up running a death test\n    // after a non-death test.\n    ++last_death_test_case_;\n    test_cases_.insert(test_cases_.begin() + last_death_test_case_,\n                       new_test_case);\n  } else {\n    // No.  Appends to the end of the list.\n    test_cases_.push_back(new_test_case);\n  }\n\n  test_case_indices_.push_back(static_cast<int>(test_case_indices_.size()));\n  return new_test_case;\n}\n\n// Helpers for setting up / tearing down the given environment.  They\n// are for use in the ForEach() function.\nstatic void SetUpEnvironment(Environment* env) { env->SetUp(); }\nstatic void TearDownEnvironment(Environment* env) { env->TearDown(); }\n\n// Runs all tests in this UnitTest object, prints the result, and\n// returns true if all tests are successful.  If any exception is\n// thrown during a test, the test is considered to be failed, but the\n// rest of the tests will still be run.\n//\n// When parameterized tests are enabled, it expands and registers\n// parameterized tests first in RegisterParameterizedTests().\n// All other functions called from RunAllTests() may safely assume that\n// parameterized tests are ready to be counted and run.\nbool UnitTestImpl::RunAllTests() {\n  // Makes sure InitGoogleTest() was called.\n  if (!GTestIsInitialized()) {\n    printf(\"%s\",\n           \"\\nThis test program did NOT call ::testing::InitGoogleTest \"\n           \"before calling RUN_ALL_TESTS().  Please fix it.\\n\");\n    return false;\n  }\n\n  // Do not run any test if the --help flag was specified.\n  if (g_help_flag)\n    return true;\n\n  // Repeats the call to the post-flag parsing initialization in case the\n  // user didn't call InitGoogleTest.\n  PostFlagParsingInit();\n\n  // Even if sharding is not on, test runners may want to use the\n  // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding\n  // protocol.\n  internal::WriteToShardStatusFileIfNeeded();\n\n  // True iff we are in a subprocess for running a thread-safe-style\n  // death test.\n  bool in_subprocess_for_death_test = false;\n\n#if GTEST_HAS_DEATH_TEST\n  in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);\n#endif  // GTEST_HAS_DEATH_TEST\n\n  const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,\n                                        in_subprocess_for_death_test);\n\n  // Compares the full test names with the filter to decide which\n  // tests to run.\n  const bool has_tests_to_run = FilterTests(should_shard\n                                              ? HONOR_SHARDING_PROTOCOL\n                                              : IGNORE_SHARDING_PROTOCOL) > 0;\n\n  // Lists the tests and exits if the --gtest_list_tests flag was specified.\n  if (GTEST_FLAG(list_tests)) {\n    // This must be called *after* FilterTests() has been called.\n    ListTestsMatchingFilter();\n    return true;\n  }\n\n  random_seed_ = GTEST_FLAG(shuffle) ?\n      GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;\n\n  // True iff at least one test has failed.\n  bool failed = false;\n\n  TestEventListener* repeater = listeners()->repeater();\n\n  start_timestamp_ = GetTimeInMillis();\n  repeater->OnTestProgramStart(*parent_);\n\n  // How many times to repeat the tests?  We don't want to repeat them\n  // when we are inside the subprocess of a death test.\n  const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);\n  // Repeats forever if the repeat count is negative.\n  const bool forever = repeat < 0;\n  for (int i = 0; forever || i != repeat; i++) {\n    // We want to preserve failures generated by ad-hoc test\n    // assertions executed before RUN_ALL_TESTS().\n    ClearNonAdHocTestResult();\n\n    const TimeInMillis start = GetTimeInMillis();\n\n    // Shuffles test cases and tests if requested.\n    if (has_tests_to_run && GTEST_FLAG(shuffle)) {\n      random()->Reseed(random_seed_);\n      // This should be done before calling OnTestIterationStart(),\n      // such that a test event listener can see the actual test order\n      // in the event.\n      ShuffleTests();\n    }\n\n    // Tells the unit test event listeners that the tests are about to start.\n    repeater->OnTestIterationStart(*parent_, i);\n\n    // Runs each test case if there is at least one test to run.\n    if (has_tests_to_run) {\n      // Sets up all environments beforehand.\n      repeater->OnEnvironmentsSetUpStart(*parent_);\n      ForEach(environments_, SetUpEnvironment);\n      repeater->OnEnvironmentsSetUpEnd(*parent_);\n\n      // Runs the tests only if there was no fatal failure during global\n      // set-up.\n      if (!Test::HasFatalFailure()) {\n        for (int test_index = 0; test_index < total_test_case_count();\n             test_index++) {\n          GetMutableTestCase(test_index)->Run();\n        }\n      }\n\n      // Tears down all environments in reverse order afterwards.\n      repeater->OnEnvironmentsTearDownStart(*parent_);\n      std::for_each(environments_.rbegin(), environments_.rend(),\n                    TearDownEnvironment);\n      repeater->OnEnvironmentsTearDownEnd(*parent_);\n    }\n\n    elapsed_time_ = GetTimeInMillis() - start;\n\n    // Tells the unit test event listener that the tests have just finished.\n    repeater->OnTestIterationEnd(*parent_, i);\n\n    // Gets the result and clears it.\n    if (!Passed()) {\n      failed = true;\n    }\n\n    // Restores the original test order after the iteration.  This\n    // allows the user to quickly repro a failure that happens in the\n    // N-th iteration without repeating the first (N - 1) iterations.\n    // This is not enclosed in \"if (GTEST_FLAG(shuffle)) { ... }\", in\n    // case the user somehow changes the value of the flag somewhere\n    // (it's always safe to unshuffle the tests).\n    UnshuffleTests();\n\n    if (GTEST_FLAG(shuffle)) {\n      // Picks a new random seed for each iteration.\n      random_seed_ = GetNextRandomSeed(random_seed_);\n    }\n  }\n\n  repeater->OnTestProgramEnd(*parent_);\n\n  return !failed;\n}\n\n// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file\n// if the variable is present. If a file already exists at this location, this\n// function will write over it. If the variable is present, but the file cannot\n// be created, prints an error and exits.\nvoid WriteToShardStatusFileIfNeeded() {\n  const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);\n  if (test_shard_file != NULL) {\n    FILE* const file = posix::FOpen(test_shard_file, \"w\");\n    if (file == NULL) {\n      ColoredPrintf(COLOR_RED,\n                    \"Could not write to the test shard status file \\\"%s\\\" \"\n                    \"specified by the %s environment variable.\\n\",\n                    test_shard_file, kTestShardStatusFile);\n      fflush(stdout);\n      exit(EXIT_FAILURE);\n    }\n    fclose(file);\n  }\n}\n\n// Checks whether sharding is enabled by examining the relevant\n// environment variable values. If the variables are present,\n// but inconsistent (i.e., shard_index >= total_shards), prints\n// an error and exits. If in_subprocess_for_death_test, sharding is\n// disabled because it must only be applied to the original test\n// process. Otherwise, we could filter out death tests we intended to execute.\nbool ShouldShard(const char* total_shards_env,\n                 const char* shard_index_env,\n                 bool in_subprocess_for_death_test) {\n  if (in_subprocess_for_death_test) {\n    return false;\n  }\n\n  const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);\n  const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);\n\n  if (total_shards == -1 && shard_index == -1) {\n    return false;\n  } else if (total_shards == -1 && shard_index != -1) {\n    const Message msg = Message()\n      << \"Invalid environment variables: you have \"\n      << kTestShardIndex << \" = \" << shard_index\n      << \", but have left \" << kTestTotalShards << \" unset.\\n\";\n    ColoredPrintf(COLOR_RED, msg.GetString().c_str());\n    fflush(stdout);\n    exit(EXIT_FAILURE);\n  } else if (total_shards != -1 && shard_index == -1) {\n    const Message msg = Message()\n      << \"Invalid environment variables: you have \"\n      << kTestTotalShards << \" = \" << total_shards\n      << \", but have left \" << kTestShardIndex << \" unset.\\n\";\n    ColoredPrintf(COLOR_RED, msg.GetString().c_str());\n    fflush(stdout);\n    exit(EXIT_FAILURE);\n  } else if (shard_index < 0 || shard_index >= total_shards) {\n    const Message msg = Message()\n      << \"Invalid environment variables: we require 0 <= \"\n      << kTestShardIndex << \" < \" << kTestTotalShards\n      << \", but you have \" << kTestShardIndex << \"=\" << shard_index\n      << \", \" << kTestTotalShards << \"=\" << total_shards << \".\\n\";\n    ColoredPrintf(COLOR_RED, msg.GetString().c_str());\n    fflush(stdout);\n    exit(EXIT_FAILURE);\n  }\n\n  return total_shards > 1;\n}\n\n// Parses the environment variable var as an Int32. If it is unset,\n// returns default_val. If it is not an Int32, prints an error\n// and aborts.\nInt32 Int32FromEnvOrDie(const char* var, Int32 default_val) {\n  const char* str_val = posix::GetEnv(var);\n  if (str_val == NULL) {\n    return default_val;\n  }\n\n  Int32 result;\n  if (!ParseInt32(Message() << \"The value of environment variable \" << var,\n                  str_val, &result)) {\n    exit(EXIT_FAILURE);\n  }\n  return result;\n}\n\n// Given the total number of shards, the shard index, and the test id,\n// returns true iff the test should be run on this shard. The test id is\n// some arbitrary but unique non-negative integer assigned to each test\n// method. Assumes that 0 <= shard_index < total_shards.\nbool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {\n  return (test_id % total_shards) == shard_index;\n}\n\n// Compares the name of each test with the user-specified filter to\n// decide whether the test should be run, then records the result in\n// each TestCase and TestInfo object.\n// If shard_tests == true, further filters tests based on sharding\n// variables in the environment - see\n// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.\n// Returns the number of tests that should run.\nint UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {\n  const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?\n      Int32FromEnvOrDie(kTestTotalShards, -1) : -1;\n  const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?\n      Int32FromEnvOrDie(kTestShardIndex, -1) : -1;\n\n  // num_runnable_tests are the number of tests that will\n  // run across all shards (i.e., match filter and are not disabled).\n  // num_selected_tests are the number of tests to be run on\n  // this shard.\n  int num_runnable_tests = 0;\n  int num_selected_tests = 0;\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    TestCase* const test_case = test_cases_[i];\n    const std::string &test_case_name = test_case->name();\n    test_case->set_should_run(false);\n\n    for (size_t j = 0; j < test_case->test_info_list().size(); j++) {\n      TestInfo* const test_info = test_case->test_info_list()[j];\n      const std::string test_name(test_info->name());\n      // A test is disabled if test case name or test name matches\n      // kDisableTestFilter.\n      const bool is_disabled =\n          internal::UnitTestOptions::MatchesFilter(test_case_name,\n                                                   kDisableTestFilter) ||\n          internal::UnitTestOptions::MatchesFilter(test_name,\n                                                   kDisableTestFilter);\n      test_info->is_disabled_ = is_disabled;\n\n      const bool matches_filter =\n          internal::UnitTestOptions::FilterMatchesTest(test_case_name,\n                                                       test_name);\n      test_info->matches_filter_ = matches_filter;\n\n      const bool is_runnable =\n          (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&\n          matches_filter;\n\n      const bool is_selected = is_runnable &&\n          (shard_tests == IGNORE_SHARDING_PROTOCOL ||\n           ShouldRunTestOnShard(total_shards, shard_index,\n                                num_runnable_tests));\n\n      num_runnable_tests += is_runnable;\n      num_selected_tests += is_selected;\n\n      test_info->should_run_ = is_selected;\n      test_case->set_should_run(test_case->should_run() || is_selected);\n    }\n  }\n  return num_selected_tests;\n}\n\n// Prints the given C-string on a single line by replacing all '\\n'\n// characters with string \"\\\\n\".  If the output takes more than\n// max_length characters, only prints the first max_length characters\n// and \"...\".\nstatic void PrintOnOneLine(const char* str, int max_length) {\n  if (str != NULL) {\n    for (int i = 0; *str != '\\0'; ++str) {\n      if (i >= max_length) {\n        printf(\"...\");\n        break;\n      }\n      if (*str == '\\n') {\n        printf(\"\\\\n\");\n        i += 2;\n      } else {\n        printf(\"%c\", *str);\n        ++i;\n      }\n    }\n  }\n}\n\n// Prints the names of the tests matching the user-specified filter flag.\nvoid UnitTestImpl::ListTestsMatchingFilter() {\n  // Print at most this many characters for each type/value parameter.\n  const int kMaxParamLength = 250;\n\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    const TestCase* const test_case = test_cases_[i];\n    bool printed_test_case_name = false;\n\n    for (size_t j = 0; j < test_case->test_info_list().size(); j++) {\n      const TestInfo* const test_info =\n          test_case->test_info_list()[j];\n      if (test_info->matches_filter_) {\n        if (!printed_test_case_name) {\n          printed_test_case_name = true;\n          printf(\"%s.\", test_case->name());\n          if (test_case->type_param() != NULL) {\n            printf(\"  # %s = \", kTypeParamLabel);\n            // We print the type parameter on a single line to make\n            // the output easy to parse by a program.\n            PrintOnOneLine(test_case->type_param(), kMaxParamLength);\n          }\n          printf(\"\\n\");\n        }\n        printf(\"  %s\", test_info->name());\n        if (test_info->value_param() != NULL) {\n          printf(\"  # %s = \", kValueParamLabel);\n          // We print the value parameter on a single line to make the\n          // output easy to parse by a program.\n          PrintOnOneLine(test_info->value_param(), kMaxParamLength);\n        }\n        printf(\"\\n\");\n      }\n    }\n  }\n  fflush(stdout);\n}\n\n// Sets the OS stack trace getter.\n//\n// Does nothing if the input and the current OS stack trace getter are\n// the same; otherwise, deletes the old getter and makes the input the\n// current getter.\nvoid UnitTestImpl::set_os_stack_trace_getter(\n    OsStackTraceGetterInterface* getter) {\n  if (os_stack_trace_getter_ != getter) {\n    delete os_stack_trace_getter_;\n    os_stack_trace_getter_ = getter;\n  }\n}\n\n// Returns the current OS stack trace getter if it is not NULL;\n// otherwise, creates an OsStackTraceGetter, makes it the current\n// getter, and returns it.\nOsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {\n  if (os_stack_trace_getter_ == NULL) {\n    os_stack_trace_getter_ = new OsStackTraceGetter;\n  }\n\n  return os_stack_trace_getter_;\n}\n\n// Returns the TestResult for the test that's currently running, or\n// the TestResult for the ad hoc test if no test is running.\nTestResult* UnitTestImpl::current_test_result() {\n  return current_test_info_ ?\n      &(current_test_info_->result_) : &ad_hoc_test_result_;\n}\n\n// Shuffles all test cases, and the tests within each test case,\n// making sure that death tests are still run first.\nvoid UnitTestImpl::ShuffleTests() {\n  // Shuffles the death test cases.\n  ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);\n\n  // Shuffles the non-death test cases.\n  ShuffleRange(random(), last_death_test_case_ + 1,\n               static_cast<int>(test_cases_.size()), &test_case_indices_);\n\n  // Shuffles the tests inside each test case.\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    test_cases_[i]->ShuffleTests(random());\n  }\n}\n\n// Restores the test cases and tests to their order before the first shuffle.\nvoid UnitTestImpl::UnshuffleTests() {\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    // Unshuffles the tests in each test case.\n    test_cases_[i]->UnshuffleTests();\n    // Resets the index of each test case.\n    test_case_indices_[i] = static_cast<int>(i);\n  }\n}\n\n// Returns the current OS stack trace as an std::string.\n//\n// The maximum number of stack frames to be included is specified by\n// the gtest_stack_trace_depth flag.  The skip_count parameter\n// specifies the number of top frames to be skipped, which doesn't\n// count against the number of frames to be included.\n//\n// For example, if Foo() calls Bar(), which in turn calls\n// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in\n// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.\nstd::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,\n                                            int skip_count) {\n  // We pass skip_count + 1 to skip this wrapper function in addition\n  // to what the user really wants to skip.\n  return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);\n}\n\n// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to\n// suppress unreachable code warnings.\nnamespace {\nclass ClassUniqueToAlwaysTrue {};\n}\n\nbool IsTrue(bool condition) { return condition; }\n\nbool AlwaysTrue() {\n#if GTEST_HAS_EXCEPTIONS\n  // This condition is always false so AlwaysTrue() never actually throws,\n  // but it makes the compiler think that it may throw.\n  if (IsTrue(false))\n    throw ClassUniqueToAlwaysTrue();\n#endif  // GTEST_HAS_EXCEPTIONS\n  return true;\n}\n\n// If *pstr starts with the given prefix, modifies *pstr to be right\n// past the prefix and returns true; otherwise leaves *pstr unchanged\n// and returns false.  None of pstr, *pstr, and prefix can be NULL.\nbool SkipPrefix(const char* prefix, const char** pstr) {\n  const size_t prefix_len = strlen(prefix);\n  if (strncmp(*pstr, prefix, prefix_len) == 0) {\n    *pstr += prefix_len;\n    return true;\n  }\n  return false;\n}\n\n// Parses a string as a command line flag.  The string should have\n// the format \"--flag=value\".  When def_optional is true, the \"=value\"\n// part can be omitted.\n//\n// Returns the value of the flag, or NULL if the parsing failed.\nconst char* ParseFlagValue(const char* str,\n                           const char* flag,\n                           bool def_optional) {\n  // str and flag must not be NULL.\n  if (str == NULL || flag == NULL) return NULL;\n\n  // The flag must start with \"--\" followed by GTEST_FLAG_PREFIX_.\n  const std::string flag_str = std::string(\"--\") + GTEST_FLAG_PREFIX_ + flag;\n  const size_t flag_len = flag_str.length();\n  if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;\n\n  // Skips the flag name.\n  const char* flag_end = str + flag_len;\n\n  // When def_optional is true, it's OK to not have a \"=value\" part.\n  if (def_optional && (flag_end[0] == '\\0')) {\n    return flag_end;\n  }\n\n  // If def_optional is true and there are more characters after the\n  // flag name, or if def_optional is false, there must be a '=' after\n  // the flag name.\n  if (flag_end[0] != '=') return NULL;\n\n  // Returns the string after \"=\".\n  return flag_end + 1;\n}\n\n// Parses a string for a bool flag, in the form of either\n// \"--flag=value\" or \"--flag\".\n//\n// In the former case, the value is taken as true as long as it does\n// not start with '0', 'f', or 'F'.\n//\n// In the latter case, the value is taken as true.\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nbool ParseBoolFlag(const char* str, const char* flag, bool* value) {\n  // Gets the value of the flag as a string.\n  const char* const value_str = ParseFlagValue(str, flag, true);\n\n  // Aborts if the parsing failed.\n  if (value_str == NULL) return false;\n\n  // Converts the string value to a bool.\n  *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');\n  return true;\n}\n\n// Parses a string for an Int32 flag, in the form of\n// \"--flag=value\".\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nbool ParseInt32Flag(const char* str, const char* flag, Int32* value) {\n  // Gets the value of the flag as a string.\n  const char* const value_str = ParseFlagValue(str, flag, false);\n\n  // Aborts if the parsing failed.\n  if (value_str == NULL) return false;\n\n  // Sets *value to the value of the flag.\n  return ParseInt32(Message() << \"The value of flag --\" << flag,\n                    value_str, value);\n}\n\n// Parses a string for a string flag, in the form of\n// \"--flag=value\".\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nbool ParseStringFlag(const char* str, const char* flag, std::string* value) {\n  // Gets the value of the flag as a string.\n  const char* const value_str = ParseFlagValue(str, flag, false);\n\n  // Aborts if the parsing failed.\n  if (value_str == NULL) return false;\n\n  // Sets *value to the value of the flag.\n  *value = value_str;\n  return true;\n}\n\n// Determines whether a string has a prefix that Google Test uses for its\n// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.\n// If Google Test detects that a command line flag has its prefix but is not\n// recognized, it will print its help message. Flags starting with\n// GTEST_INTERNAL_PREFIX_ followed by \"internal_\" are considered Google Test\n// internal flags and do not trigger the help message.\nstatic bool HasGoogleTestFlagPrefix(const char* str) {\n  return (SkipPrefix(\"--\", &str) ||\n          SkipPrefix(\"-\", &str) ||\n          SkipPrefix(\"/\", &str)) &&\n         !SkipPrefix(GTEST_FLAG_PREFIX_ \"internal_\", &str) &&\n         (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||\n          SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));\n}\n\n// Prints a string containing code-encoded text.  The following escape\n// sequences can be used in the string to control the text color:\n//\n//   @@    prints a single '@' character.\n//   @R    changes the color to red.\n//   @G    changes the color to green.\n//   @Y    changes the color to yellow.\n//   @D    changes to the default terminal text color.\n//\n// TODO(wan@google.com): Write tests for this once we add stdout\n// capturing to Google Test.\nstatic void PrintColorEncoded(const char* str) {\n  GTestColor color = COLOR_DEFAULT;  // The current color.\n\n  // Conceptually, we split the string into segments divided by escape\n  // sequences.  Then we print one segment at a time.  At the end of\n  // each iteration, the str pointer advances to the beginning of the\n  // next segment.\n  for (;;) {\n    const char* p = strchr(str, '@');\n    if (p == NULL) {\n      ColoredPrintf(color, \"%s\", str);\n      return;\n    }\n\n    ColoredPrintf(color, \"%s\", std::string(str, p).c_str());\n\n    const char ch = p[1];\n    str = p + 2;\n    if (ch == '@') {\n      ColoredPrintf(color, \"@\");\n    } else if (ch == 'D') {\n      color = COLOR_DEFAULT;\n    } else if (ch == 'R') {\n      color = COLOR_RED;\n    } else if (ch == 'G') {\n      color = COLOR_GREEN;\n    } else if (ch == 'Y') {\n      color = COLOR_YELLOW;\n    } else {\n      --str;\n    }\n  }\n}\n\nstatic const char kColorEncodedHelpMessage[] =\n\"This program contains tests written using \" GTEST_NAME_ \". You can use the\\n\"\n\"following command line flags to control its behavior:\\n\"\n\"\\n\"\n\"Test Selection:\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"list_tests@D\\n\"\n\"      List the names of all tests instead of running them. The name of\\n\"\n\"      TEST(Foo, Bar) is \\\"Foo.Bar\\\".\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"filter=@YPOSTIVE_PATTERNS\"\n    \"[@G-@YNEGATIVE_PATTERNS]@D\\n\"\n\"      Run only the tests whose name matches one of the positive patterns but\\n\"\n\"      none of the negative patterns. '?' matches any single character; '*'\\n\"\n\"      matches any substring; ':' separates two patterns.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"also_run_disabled_tests@D\\n\"\n\"      Run all disabled tests too.\\n\"\n\"\\n\"\n\"Test Execution:\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"repeat=@Y[COUNT]@D\\n\"\n\"      Run the tests repeatedly; use a negative count to repeat forever.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"shuffle@D\\n\"\n\"      Randomize tests' orders on every iteration.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"random_seed=@Y[NUMBER]@D\\n\"\n\"      Random number seed to use for shuffling test orders (between 1 and\\n\"\n\"      99999, or 0 to use a seed based on the current time).\\n\"\n\"\\n\"\n\"Test Output:\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\\n\"\n\"      Enable/disable colored output. The default is @Gauto@D.\\n\"\n\"  -@G-\" GTEST_FLAG_PREFIX_ \"print_time=0@D\\n\"\n\"      Don't print the elapsed time of each test.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"output=xml@Y[@G:@YDIRECTORY_PATH@G\"\n    GTEST_PATH_SEP_ \"@Y|@G:@YFILE_PATH]@D\\n\"\n\"      Generate an XML report in the given directory or with the given file\\n\"\n\"      name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\\n\"\n#if GTEST_CAN_STREAM_RESULTS_\n\"  @G--\" GTEST_FLAG_PREFIX_ \"stream_result_to=@YHOST@G:@YPORT@D\\n\"\n\"      Stream test results to the given server.\\n\"\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\"\\n\"\n\"Assertion Behavior:\\n\"\n#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS\n\"  @G--\" GTEST_FLAG_PREFIX_ \"death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\\n\"\n\"      Set the default death test style.\\n\"\n#endif  // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS\n\"  @G--\" GTEST_FLAG_PREFIX_ \"break_on_failure@D\\n\"\n\"      Turn assertion failures into debugger break-points.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"throw_on_failure@D\\n\"\n\"      Turn assertion failures into C++ exceptions.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"catch_exceptions=0@D\\n\"\n\"      Do not report exceptions as test failures. Instead, allow them\\n\"\n\"      to crash the program or throw a pop-up (on Windows).\\n\"\n\"\\n\"\n\"Except for @G--\" GTEST_FLAG_PREFIX_ \"list_tests@D, you can alternatively set \"\n    \"the corresponding\\n\"\n\"environment variable of a flag (all letters in upper-case). For example, to\\n\"\n\"disable colored text output, you can either specify @G--\" GTEST_FLAG_PREFIX_\n    \"color=no@D or set\\n\"\n\"the @G\" GTEST_FLAG_PREFIX_UPPER_ \"COLOR@D environment variable to @Gno@D.\\n\"\n\"\\n\"\n\"For more information, please read the \" GTEST_NAME_ \" documentation at\\n\"\n\"@G\" GTEST_PROJECT_URL_ \"@D. If you find a bug in \" GTEST_NAME_ \"\\n\"\n\"(not one in your own code or tests), please report it to\\n\"\n\"@G<\" GTEST_DEV_EMAIL_ \">@D.\\n\";\n\n// Parses the command line for Google Test flags, without initializing\n// other parts of Google Test.  The type parameter CharType can be\n// instantiated to either char or wchar_t.\ntemplate <typename CharType>\nvoid ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {\n  for (int i = 1; i < *argc; i++) {\n    const std::string arg_string = StreamableToString(argv[i]);\n    const char* const arg = arg_string.c_str();\n\n    using internal::ParseBoolFlag;\n    using internal::ParseInt32Flag;\n    using internal::ParseStringFlag;\n\n    // Do we see a Google Test flag?\n    if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,\n                      &GTEST_FLAG(also_run_disabled_tests)) ||\n        ParseBoolFlag(arg, kBreakOnFailureFlag,\n                      &GTEST_FLAG(break_on_failure)) ||\n        ParseBoolFlag(arg, kCatchExceptionsFlag,\n                      &GTEST_FLAG(catch_exceptions)) ||\n        ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||\n        ParseStringFlag(arg, kDeathTestStyleFlag,\n                        &GTEST_FLAG(death_test_style)) ||\n        ParseBoolFlag(arg, kDeathTestUseFork,\n                      &GTEST_FLAG(death_test_use_fork)) ||\n        ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||\n        ParseStringFlag(arg, kInternalRunDeathTestFlag,\n                        &GTEST_FLAG(internal_run_death_test)) ||\n        ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||\n        ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||\n        ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||\n        ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||\n        ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||\n        ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||\n        ParseInt32Flag(arg, kStackTraceDepthFlag,\n                       &GTEST_FLAG(stack_trace_depth)) ||\n        ParseStringFlag(arg, kStreamResultToFlag,\n                        &GTEST_FLAG(stream_result_to)) ||\n        ParseBoolFlag(arg, kThrowOnFailureFlag,\n                      &GTEST_FLAG(throw_on_failure))\n        ) {\n      // Yes.  Shift the remainder of the argv list left by one.  Note\n      // that argv has (*argc + 1) elements, the last one always being\n      // NULL.  The following loop moves the trailing NULL element as\n      // well.\n      for (int j = i; j != *argc; j++) {\n        argv[j] = argv[j + 1];\n      }\n\n      // Decrements the argument count.\n      (*argc)--;\n\n      // We also need to decrement the iterator as we just removed\n      // an element.\n      i--;\n    } else if (arg_string == \"--help\" || arg_string == \"-h\" ||\n               arg_string == \"-?\" || arg_string == \"/?\" ||\n               HasGoogleTestFlagPrefix(arg)) {\n      // Both help flag and unrecognized Google Test flags (excluding\n      // internal ones) trigger help display.\n      g_help_flag = true;\n    }\n  }\n\n  if (g_help_flag) {\n    // We print the help here instead of in RUN_ALL_TESTS(), as the\n    // latter may not be called at all if the user is using Google\n    // Test with another testing framework.\n    PrintColorEncoded(kColorEncodedHelpMessage);\n  }\n}\n\n// Parses the command line for Google Test flags, without initializing\n// other parts of Google Test.\nvoid ParseGoogleTestFlagsOnly(int* argc, char** argv) {\n  ParseGoogleTestFlagsOnlyImpl(argc, argv);\n}\nvoid ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {\n  ParseGoogleTestFlagsOnlyImpl(argc, argv);\n}\n\n// The internal implementation of InitGoogleTest().\n//\n// The type parameter CharType can be instantiated to either char or\n// wchar_t.\ntemplate <typename CharType>\nvoid InitGoogleTestImpl(int* argc, CharType** argv) {\n  g_init_gtest_count++;\n\n  // We don't want to run the initialization code twice.\n  if (g_init_gtest_count != 1) return;\n\n  if (*argc <= 0) return;\n\n  internal::g_executable_path = internal::StreamableToString(argv[0]);\n\n#if GTEST_HAS_DEATH_TEST\n\n  g_argvs.clear();\n  for (int i = 0; i != *argc; i++) {\n    g_argvs.push_back(StreamableToString(argv[i]));\n  }\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n  ParseGoogleTestFlagsOnly(argc, argv);\n  GetUnitTestImpl()->PostFlagParsingInit();\n}\n\n}  // namespace internal\n\n// Initializes Google Test.  This must be called before calling\n// RUN_ALL_TESTS().  In particular, it parses a command line for the\n// flags that Google Test recognizes.  Whenever a Google Test flag is\n// seen, it is removed from argv, and *argc is decremented.\n//\n// No value is returned.  Instead, the Google Test flag variables are\n// updated.\n//\n// Calling the function for the second time has no user-visible effect.\nvoid InitGoogleTest(int* argc, char** argv) {\n  internal::InitGoogleTestImpl(argc, argv);\n}\n\n// This overloaded version can be used in Windows programs compiled in\n// UNICODE mode.\nvoid InitGoogleTest(int* argc, wchar_t** argv) {\n  internal::InitGoogleTestImpl(argc, argv);\n}\n\n}  // namespace testing\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)\n//\n// This file implements death tests.\n\n\n#if GTEST_HAS_DEATH_TEST\n\n# if GTEST_OS_MAC\n#  include <crt_externs.h>\n# endif  // GTEST_OS_MAC\n\n# include <errno.h>\n# include <fcntl.h>\n# include <limits.h>\n\n# if GTEST_OS_LINUX\n#  include <signal.h>\n# endif  // GTEST_OS_LINUX\n\n# include <stdarg.h>\n\n# if GTEST_OS_WINDOWS\n#  include <windows.h>\n# else\n#  include <sys/mman.h>\n#  include <sys/wait.h>\n# endif  // GTEST_OS_WINDOWS\n\n# if GTEST_OS_QNX\n#  include <spawn.h>\n# endif  // GTEST_OS_QNX\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\n\n// Constants.\n\n// The default death test style.\nstatic const char kDefaultDeathTestStyle[] = \"fast\";\n\nGTEST_DEFINE_string_(\n    death_test_style,\n    internal::StringFromGTestEnv(\"death_test_style\", kDefaultDeathTestStyle),\n    \"Indicates how to run a death test in a forked child process: \"\n    \"\\\"threadsafe\\\" (child process re-executes the test binary \"\n    \"from the beginning, running only the specific death test) or \"\n    \"\\\"fast\\\" (child process runs the death test immediately \"\n    \"after forking).\");\n\nGTEST_DEFINE_bool_(\n    death_test_use_fork,\n    internal::BoolFromGTestEnv(\"death_test_use_fork\", false),\n    \"Instructs to use fork()/_exit() instead of clone() in death tests. \"\n    \"Ignored and always uses fork() on POSIX systems where clone() is not \"\n    \"implemented. Useful when running under valgrind or similar tools if \"\n    \"those do not support clone(). Valgrind 3.3.1 will just fail if \"\n    \"it sees an unsupported combination of clone() flags. \"\n    \"It is not recommended to use this flag w/o valgrind though it will \"\n    \"work in 99% of the cases. Once valgrind is fixed, this flag will \"\n    \"most likely be removed.\");\n\nnamespace internal {\nGTEST_DEFINE_string_(\n    internal_run_death_test, \"\",\n    \"Indicates the file, line number, temporal index of \"\n    \"the single death test to run, and a file descriptor to \"\n    \"which a success code may be sent, all separated by \"\n    \"the '|' characters.  This flag is specified if and only if the current \"\n    \"process is a sub-process launched for running a thread-safe \"\n    \"death test.  FOR INTERNAL USE ONLY.\");\n}  // namespace internal\n\n#if GTEST_HAS_DEATH_TEST\n\nnamespace internal {\n\n// Valid only for fast death tests. Indicates the code is running in the\n// child process of a fast style death test.\nstatic bool g_in_fast_death_test_child = false;\n\n// Returns a Boolean value indicating whether the caller is currently\n// executing in the context of the death test child process.  Tools such as\n// Valgrind heap checkers may need this to modify their behavior in death\n// tests.  IMPORTANT: This is an internal utility.  Using it may break the\n// implementation of death tests.  User code MUST NOT use it.\nbool InDeathTestChild() {\n# if GTEST_OS_WINDOWS\n\n  // On Windows, death tests are thread-safe regardless of the value of the\n  // death_test_style flag.\n  return !GTEST_FLAG(internal_run_death_test).empty();\n\n# else\n\n  if (GTEST_FLAG(death_test_style) == \"threadsafe\")\n    return !GTEST_FLAG(internal_run_death_test).empty();\n  else\n    return g_in_fast_death_test_child;\n#endif\n}\n\n}  // namespace internal\n\n// ExitedWithCode constructor.\nExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {\n}\n\n// ExitedWithCode function-call operator.\nbool ExitedWithCode::operator()(int exit_status) const {\n# if GTEST_OS_WINDOWS\n\n  return exit_status == exit_code_;\n\n# else\n\n  return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;\n\n# endif  // GTEST_OS_WINDOWS\n}\n\n# if !GTEST_OS_WINDOWS\n// KilledBySignal constructor.\nKilledBySignal::KilledBySignal(int signum) : signum_(signum) {\n}\n\n// KilledBySignal function-call operator.\nbool KilledBySignal::operator()(int exit_status) const {\n  return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;\n}\n# endif  // !GTEST_OS_WINDOWS\n\nnamespace internal {\n\n// Utilities needed for death tests.\n\n// Generates a textual description of a given exit code, in the format\n// specified by wait(2).\nstatic std::string ExitSummary(int exit_code) {\n  Message m;\n\n# if GTEST_OS_WINDOWS\n\n  m << \"Exited with exit status \" << exit_code;\n\n# else\n\n  if (WIFEXITED(exit_code)) {\n    m << \"Exited with exit status \" << WEXITSTATUS(exit_code);\n  } else if (WIFSIGNALED(exit_code)) {\n    m << \"Terminated by signal \" << WTERMSIG(exit_code);\n  }\n#  ifdef WCOREDUMP\n  if (WCOREDUMP(exit_code)) {\n    m << \" (core dumped)\";\n  }\n#  endif\n# endif  // GTEST_OS_WINDOWS\n\n  return m.GetString();\n}\n\n// Returns true if exit_status describes a process that was terminated\n// by a signal, or exited normally with a nonzero exit code.\nbool ExitedUnsuccessfully(int exit_status) {\n  return !ExitedWithCode(0)(exit_status);\n}\n\n# if !GTEST_OS_WINDOWS\n// Generates a textual failure message when a death test finds more than\n// one thread running, or cannot determine the number of threads, prior\n// to executing the given statement.  It is the responsibility of the\n// caller not to pass a thread_count of 1.\nstatic std::string DeathTestThreadWarning(size_t thread_count) {\n  Message msg;\n  msg << \"Death tests use fork(), which is unsafe particularly\"\n      << \" in a threaded context. For this test, \" << GTEST_NAME_ << \" \";\n  if (thread_count == 0)\n    msg << \"couldn't detect the number of threads.\";\n  else\n    msg << \"detected \" << thread_count << \" threads.\";\n  return msg.GetString();\n}\n# endif  // !GTEST_OS_WINDOWS\n\n// Flag characters for reporting a death test that did not die.\nstatic const char kDeathTestLived = 'L';\nstatic const char kDeathTestReturned = 'R';\nstatic const char kDeathTestThrew = 'T';\nstatic const char kDeathTestInternalError = 'I';\n\n// An enumeration describing all of the possible ways that a death test can\n// conclude.  DIED means that the process died while executing the test\n// code; LIVED means that process lived beyond the end of the test code;\n// RETURNED means that the test statement attempted to execute a return\n// statement, which is not allowed; THREW means that the test statement\n// returned control by throwing an exception.  IN_PROGRESS means the test\n// has not yet concluded.\n// TODO(vladl@google.com): Unify names and possibly values for\n// AbortReason, DeathTestOutcome, and flag characters above.\nenum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };\n\n// Routine for aborting the program which is safe to call from an\n// exec-style death test child process, in which case the error\n// message is propagated back to the parent process.  Otherwise, the\n// message is simply printed to stderr.  In either case, the program\n// then exits with status 1.\nvoid DeathTestAbort(const std::string& message) {\n  // On a POSIX system, this function may be called from a threadsafe-style\n  // death test child process, which operates on a very small stack.  Use\n  // the heap for any additional non-minuscule memory requirements.\n  const InternalRunDeathTestFlag* const flag =\n      GetUnitTestImpl()->internal_run_death_test_flag();\n  if (flag != NULL) {\n    FILE* parent = posix::FDOpen(flag->write_fd(), \"w\");\n    fputc(kDeathTestInternalError, parent);\n    fprintf(parent, \"%s\", message.c_str());\n    fflush(parent);\n    _exit(1);\n  } else {\n    fprintf(stderr, \"%s\", message.c_str());\n    fflush(stderr);\n    posix::Abort();\n  }\n}\n\n// A replacement for CHECK that calls DeathTestAbort if the assertion\n// fails.\n# define GTEST_DEATH_TEST_CHECK_(expression) \\\n  do { \\\n    if (!::testing::internal::IsTrue(expression)) { \\\n      DeathTestAbort( \\\n          ::std::string(\"CHECK failed: File \") + __FILE__ +  \", line \" \\\n          + ::testing::internal::StreamableToString(__LINE__) + \": \" \\\n          + #expression); \\\n    } \\\n  } while (::testing::internal::AlwaysFalse())\n\n// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for\n// evaluating any system call that fulfills two conditions: it must return\n// -1 on failure, and set errno to EINTR when it is interrupted and\n// should be tried again.  The macro expands to a loop that repeatedly\n// evaluates the expression as long as it evaluates to -1 and sets\n// errno to EINTR.  If the expression evaluates to -1 but errno is\n// something other than EINTR, DeathTestAbort is called.\n# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \\\n  do { \\\n    int gtest_retval; \\\n    do { \\\n      gtest_retval = (expression); \\\n    } while (gtest_retval == -1 && errno == EINTR); \\\n    if (gtest_retval == -1) { \\\n      DeathTestAbort( \\\n          ::std::string(\"CHECK failed: File \") + __FILE__ + \", line \" \\\n          + ::testing::internal::StreamableToString(__LINE__) + \": \" \\\n          + #expression + \" != -1\"); \\\n    } \\\n  } while (::testing::internal::AlwaysFalse())\n\n// Returns the message describing the last system error in errno.\nstd::string GetLastErrnoDescription() {\n    return errno == 0 ? \"\" : posix::StrError(errno);\n}\n\n// This is called from a death test parent process to read a failure\n// message from the death test child process and log it with the FATAL\n// severity. On Windows, the message is read from a pipe handle. On other\n// platforms, it is read from a file descriptor.\nstatic void FailFromInternalError(int fd) {\n  Message error;\n  char buffer[256];\n  int num_read;\n\n  do {\n    while ((num_read = posix::Read(fd, buffer, 255)) > 0) {\n      buffer[num_read] = '\\0';\n      error << buffer;\n    }\n  } while (num_read == -1 && errno == EINTR);\n\n  if (num_read == 0) {\n    GTEST_LOG_(FATAL) << error.GetString();\n  } else {\n    const int last_error = errno;\n    GTEST_LOG_(FATAL) << \"Error while reading death test internal: \"\n                      << GetLastErrnoDescription() << \" [\" << last_error << \"]\";\n  }\n}\n\n// Death test constructor.  Increments the running death test count\n// for the current test.\nDeathTest::DeathTest() {\n  TestInfo* const info = GetUnitTestImpl()->current_test_info();\n  if (info == NULL) {\n    DeathTestAbort(\"Cannot run a death test outside of a TEST or \"\n                   \"TEST_F construct\");\n  }\n}\n\n// Creates and returns a death test by dispatching to the current\n// death test factory.\nbool DeathTest::Create(const char* statement, const RE* regex,\n                       const char* file, int line, DeathTest** test) {\n  return GetUnitTestImpl()->death_test_factory()->Create(\n      statement, regex, file, line, test);\n}\n\nconst char* DeathTest::LastMessage() {\n  return last_death_test_message_.c_str();\n}\n\nvoid DeathTest::set_last_death_test_message(const std::string& message) {\n  last_death_test_message_ = message;\n}\n\nstd::string DeathTest::last_death_test_message_;\n\n// Provides cross platform implementation for some death functionality.\nclass DeathTestImpl : public DeathTest {\n protected:\n  DeathTestImpl(const char* a_statement, const RE* a_regex)\n      : statement_(a_statement),\n        regex_(a_regex),\n        spawned_(false),\n        status_(-1),\n        outcome_(IN_PROGRESS),\n        read_fd_(-1),\n        write_fd_(-1) {}\n\n  // read_fd_ is expected to be closed and cleared by a derived class.\n  ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }\n\n  void Abort(AbortReason reason);\n  virtual bool Passed(bool status_ok);\n\n  const char* statement() const { return statement_; }\n  const RE* regex() const { return regex_; }\n  bool spawned() const { return spawned_; }\n  void set_spawned(bool is_spawned) { spawned_ = is_spawned; }\n  int status() const { return status_; }\n  void set_status(int a_status) { status_ = a_status; }\n  DeathTestOutcome outcome() const { return outcome_; }\n  void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }\n  int read_fd() const { return read_fd_; }\n  void set_read_fd(int fd) { read_fd_ = fd; }\n  int write_fd() const { return write_fd_; }\n  void set_write_fd(int fd) { write_fd_ = fd; }\n\n  // Called in the parent process only. Reads the result code of the death\n  // test child process via a pipe, interprets it to set the outcome_\n  // member, and closes read_fd_.  Outputs diagnostics and terminates in\n  // case of unexpected codes.\n  void ReadAndInterpretStatusByte();\n\n private:\n  // The textual content of the code this object is testing.  This class\n  // doesn't own this string and should not attempt to delete it.\n  const char* const statement_;\n  // The regular expression which test output must match.  DeathTestImpl\n  // doesn't own this object and should not attempt to delete it.\n  const RE* const regex_;\n  // True if the death test child process has been successfully spawned.\n  bool spawned_;\n  // The exit status of the child process.\n  int status_;\n  // How the death test concluded.\n  DeathTestOutcome outcome_;\n  // Descriptor to the read end of the pipe to the child process.  It is\n  // always -1 in the child process.  The child keeps its write end of the\n  // pipe in write_fd_.\n  int read_fd_;\n  // Descriptor to the child's write end of the pipe to the parent process.\n  // It is always -1 in the parent process.  The parent keeps its end of the\n  // pipe in read_fd_.\n  int write_fd_;\n};\n\n// Called in the parent process only. Reads the result code of the death\n// test child process via a pipe, interprets it to set the outcome_\n// member, and closes read_fd_.  Outputs diagnostics and terminates in\n// case of unexpected codes.\nvoid DeathTestImpl::ReadAndInterpretStatusByte() {\n  char flag;\n  int bytes_read;\n\n  // The read() here blocks until data is available (signifying the\n  // failure of the death test) or until the pipe is closed (signifying\n  // its success), so it's okay to call this in the parent before\n  // the child process has exited.\n  do {\n    bytes_read = posix::Read(read_fd(), &flag, 1);\n  } while (bytes_read == -1 && errno == EINTR);\n\n  if (bytes_read == 0) {\n    set_outcome(DIED);\n  } else if (bytes_read == 1) {\n    switch (flag) {\n      case kDeathTestReturned:\n        set_outcome(RETURNED);\n        break;\n      case kDeathTestThrew:\n        set_outcome(THREW);\n        break;\n      case kDeathTestLived:\n        set_outcome(LIVED);\n        break;\n      case kDeathTestInternalError:\n        FailFromInternalError(read_fd());  // Does not return.\n        break;\n      default:\n        GTEST_LOG_(FATAL) << \"Death test child process reported \"\n                          << \"unexpected status byte (\"\n                          << static_cast<unsigned int>(flag) << \")\";\n    }\n  } else {\n    GTEST_LOG_(FATAL) << \"Read from death test child process failed: \"\n                      << GetLastErrnoDescription();\n  }\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));\n  set_read_fd(-1);\n}\n\n// Signals that the death test code which should have exited, didn't.\n// Should be called only in a death test child process.\n// Writes a status byte to the child's status file descriptor, then\n// calls _exit(1).\nvoid DeathTestImpl::Abort(AbortReason reason) {\n  // The parent process considers the death test to be a failure if\n  // it finds any data in our pipe.  So, here we write a single flag byte\n  // to the pipe, then exit.\n  const char status_ch =\n      reason == TEST_DID_NOT_DIE ? kDeathTestLived :\n      reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned;\n\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));\n  // We are leaking the descriptor here because on some platforms (i.e.,\n  // when built as Windows DLL), destructors of global objects will still\n  // run after calling _exit(). On such systems, write_fd_ will be\n  // indirectly closed from the destructor of UnitTestImpl, causing double\n  // close if it is also closed here. On debug configurations, double close\n  // may assert. As there are no in-process buffers to flush here, we are\n  // relying on the OS to close the descriptor after the process terminates\n  // when the destructors are not run.\n  _exit(1);  // Exits w/o any normal exit hooks (we were supposed to crash)\n}\n\n// Returns an indented copy of stderr output for a death test.\n// This makes distinguishing death test output lines from regular log lines\n// much easier.\nstatic ::std::string FormatDeathTestOutput(const ::std::string& output) {\n  ::std::string ret;\n  for (size_t at = 0; ; ) {\n    const size_t line_end = output.find('\\n', at);\n    ret += \"[  DEATH   ] \";\n    if (line_end == ::std::string::npos) {\n      ret += output.substr(at);\n      break;\n    }\n    ret += output.substr(at, line_end + 1 - at);\n    at = line_end + 1;\n  }\n  return ret;\n}\n\n// Assesses the success or failure of a death test, using both private\n// members which have previously been set, and one argument:\n//\n// Private data members:\n//   outcome:  An enumeration describing how the death test\n//             concluded: DIED, LIVED, THREW, or RETURNED.  The death test\n//             fails in the latter three cases.\n//   status:   The exit status of the child process. On *nix, it is in the\n//             in the format specified by wait(2). On Windows, this is the\n//             value supplied to the ExitProcess() API or a numeric code\n//             of the exception that terminated the program.\n//   regex:    A regular expression object to be applied to\n//             the test's captured standard error output; the death test\n//             fails if it does not match.\n//\n// Argument:\n//   status_ok: true if exit_status is acceptable in the context of\n//              this particular death test, which fails if it is false\n//\n// Returns true iff all of the above conditions are met.  Otherwise, the\n// first failing condition, in the order given above, is the one that is\n// reported. Also sets the last death test message string.\nbool DeathTestImpl::Passed(bool status_ok) {\n  if (!spawned())\n    return false;\n\n  const std::string error_message = GetCapturedStderr();\n\n  bool success = false;\n  Message buffer;\n\n  buffer << \"Death test: \" << statement() << \"\\n\";\n  switch (outcome()) {\n    case LIVED:\n      buffer << \"    Result: failed to die.\\n\"\n             << \" Error msg:\\n\" << FormatDeathTestOutput(error_message);\n      break;\n    case THREW:\n      buffer << \"    Result: threw an exception.\\n\"\n             << \" Error msg:\\n\" << FormatDeathTestOutput(error_message);\n      break;\n    case RETURNED:\n      buffer << \"    Result: illegal return in test statement.\\n\"\n             << \" Error msg:\\n\" << FormatDeathTestOutput(error_message);\n      break;\n    case DIED:\n      if (status_ok) {\n        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());\n        if (matched) {\n          success = true;\n        } else {\n          buffer << \"    Result: died but not with expected error.\\n\"\n                 << \"  Expected: \" << regex()->pattern() << \"\\n\"\n                 << \"Actual msg:\\n\" << FormatDeathTestOutput(error_message);\n        }\n      } else {\n        buffer << \"    Result: died but not with expected exit code:\\n\"\n               << \"            \" << ExitSummary(status()) << \"\\n\"\n               << \"Actual msg:\\n\" << FormatDeathTestOutput(error_message);\n      }\n      break;\n    case IN_PROGRESS:\n    default:\n      GTEST_LOG_(FATAL)\n          << \"DeathTest::Passed somehow called before conclusion of test\";\n  }\n\n  DeathTest::set_last_death_test_message(buffer.GetString());\n  return success;\n}\n\n# if GTEST_OS_WINDOWS\n// WindowsDeathTest implements death tests on Windows. Due to the\n// specifics of starting new processes on Windows, death tests there are\n// always threadsafe, and Google Test considers the\n// --gtest_death_test_style=fast setting to be equivalent to\n// --gtest_death_test_style=threadsafe there.\n//\n// A few implementation notes:  Like the Linux version, the Windows\n// implementation uses pipes for child-to-parent communication. But due to\n// the specifics of pipes on Windows, some extra steps are required:\n//\n// 1. The parent creates a communication pipe and stores handles to both\n//    ends of it.\n// 2. The parent starts the child and provides it with the information\n//    necessary to acquire the handle to the write end of the pipe.\n// 3. The child acquires the write end of the pipe and signals the parent\n//    using a Windows event.\n// 4. Now the parent can release the write end of the pipe on its side. If\n//    this is done before step 3, the object's reference count goes down to\n//    0 and it is destroyed, preventing the child from acquiring it. The\n//    parent now has to release it, or read operations on the read end of\n//    the pipe will not return when the child terminates.\n// 5. The parent reads child's output through the pipe (outcome code and\n//    any possible error messages) from the pipe, and its stderr and then\n//    determines whether to fail the test.\n//\n// Note: to distinguish Win32 API calls from the local method and function\n// calls, the former are explicitly resolved in the global namespace.\n//\nclass WindowsDeathTest : public DeathTestImpl {\n public:\n  WindowsDeathTest(const char* a_statement,\n                   const RE* a_regex,\n                   const char* file,\n                   int line)\n      : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {}\n\n  // All of these virtual functions are inherited from DeathTest.\n  virtual int Wait();\n  virtual TestRole AssumeRole();\n\n private:\n  // The name of the file in which the death test is located.\n  const char* const file_;\n  // The line number on which the death test is located.\n  const int line_;\n  // Handle to the write end of the pipe to the child process.\n  AutoHandle write_handle_;\n  // Child process handle.\n  AutoHandle child_handle_;\n  // Event the child process uses to signal the parent that it has\n  // acquired the handle to the write end of the pipe. After seeing this\n  // event the parent can release its own handles to make sure its\n  // ReadFile() calls return when the child terminates.\n  AutoHandle event_handle_;\n};\n\n// Waits for the child in a death test to exit, returning its exit\n// status, or 0 if no child process exists.  As a side effect, sets the\n// outcome data member.\nint WindowsDeathTest::Wait() {\n  if (!spawned())\n    return 0;\n\n  // Wait until the child either signals that it has acquired the write end\n  // of the pipe or it dies.\n  const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };\n  switch (::WaitForMultipleObjects(2,\n                                   wait_handles,\n                                   FALSE,  // Waits for any of the handles.\n                                   INFINITE)) {\n    case WAIT_OBJECT_0:\n    case WAIT_OBJECT_0 + 1:\n      break;\n    default:\n      GTEST_DEATH_TEST_CHECK_(false);  // Should not get here.\n  }\n\n  // The child has acquired the write end of the pipe or exited.\n  // We release the handle on our side and continue.\n  write_handle_.Reset();\n  event_handle_.Reset();\n\n  ReadAndInterpretStatusByte();\n\n  // Waits for the child process to exit if it haven't already. This\n  // returns immediately if the child has already exited, regardless of\n  // whether previous calls to WaitForMultipleObjects synchronized on this\n  // handle or not.\n  GTEST_DEATH_TEST_CHECK_(\n      WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),\n                                             INFINITE));\n  DWORD status_code;\n  GTEST_DEATH_TEST_CHECK_(\n      ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);\n  child_handle_.Reset();\n  set_status(static_cast<int>(status_code));\n  return status();\n}\n\n// The AssumeRole process for a Windows death test.  It creates a child\n// process with the same executable as the current process to run the\n// death test.  The child process is given the --gtest_filter and\n// --gtest_internal_run_death_test flags such that it knows to run the\n// current death test only.\nDeathTest::TestRole WindowsDeathTest::AssumeRole() {\n  const UnitTestImpl* const impl = GetUnitTestImpl();\n  const InternalRunDeathTestFlag* const flag =\n      impl->internal_run_death_test_flag();\n  const TestInfo* const info = impl->current_test_info();\n  const int death_test_index = info->result()->death_test_count();\n\n  if (flag != NULL) {\n    // ParseInternalRunDeathTestFlag() has performed all the necessary\n    // processing.\n    set_write_fd(flag->write_fd());\n    return EXECUTE_TEST;\n  }\n\n  // WindowsDeathTest uses an anonymous pipe to communicate results of\n  // a death test.\n  SECURITY_ATTRIBUTES handles_are_inheritable = {\n    sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };\n  HANDLE read_handle, write_handle;\n  GTEST_DEATH_TEST_CHECK_(\n      ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,\n                   0)  // Default buffer size.\n      != FALSE);\n  set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),\n                                O_RDONLY));\n  write_handle_.Reset(write_handle);\n  event_handle_.Reset(::CreateEvent(\n      &handles_are_inheritable,\n      TRUE,    // The event will automatically reset to non-signaled state.\n      FALSE,   // The initial state is non-signalled.\n      NULL));  // The even is unnamed.\n  GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);\n  const std::string filter_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kFilterFlag + \"=\" +\n      info->test_case_name() + \".\" + info->name();\n  const std::string internal_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +\n      \"=\" + file_ + \"|\" + StreamableToString(line_) + \"|\" +\n      StreamableToString(death_test_index) + \"|\" +\n      StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +\n      // size_t has the same width as pointers on both 32-bit and 64-bit\n      // Windows platforms.\n      // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.\n      \"|\" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +\n      \"|\" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));\n\n  char executable_path[_MAX_PATH + 1];  // NOLINT\n  GTEST_DEATH_TEST_CHECK_(\n      _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,\n                                            executable_path,\n                                            _MAX_PATH));\n\n  std::string command_line =\n      std::string(::GetCommandLineA()) + \" \" + filter_flag + \" \\\"\" +\n      internal_flag + \"\\\"\";\n\n  DeathTest::set_last_death_test_message(\"\");\n\n  CaptureStderr();\n  // Flush the log buffers since the log streams are shared with the child.\n  FlushInfoLog();\n\n  // The child process will share the standard handles with the parent.\n  STARTUPINFOA startup_info;\n  memset(&startup_info, 0, sizeof(STARTUPINFO));\n  startup_info.dwFlags = STARTF_USESTDHANDLES;\n  startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);\n  startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);\n  startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);\n\n  PROCESS_INFORMATION process_info;\n  GTEST_DEATH_TEST_CHECK_(::CreateProcessA(\n      executable_path,\n      const_cast<char*>(command_line.c_str()),\n      NULL,   // Retuned process handle is not inheritable.\n      NULL,   // Retuned thread handle is not inheritable.\n      TRUE,   // Child inherits all inheritable handles (for write_handle_).\n      0x0,    // Default creation flags.\n      NULL,   // Inherit the parent's environment.\n      UnitTest::GetInstance()->original_working_dir(),\n      &startup_info,\n      &process_info) != FALSE);\n  child_handle_.Reset(process_info.hProcess);\n  ::CloseHandle(process_info.hThread);\n  set_spawned(true);\n  return OVERSEE_TEST;\n}\n# else  // We are not on Windows.\n\n// ForkingDeathTest provides implementations for most of the abstract\n// methods of the DeathTest interface.  Only the AssumeRole method is\n// left undefined.\nclass ForkingDeathTest : public DeathTestImpl {\n public:\n  ForkingDeathTest(const char* statement, const RE* regex);\n\n  // All of these virtual functions are inherited from DeathTest.\n  virtual int Wait();\n\n protected:\n  void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }\n\n private:\n  // PID of child process during death test; 0 in the child process itself.\n  pid_t child_pid_;\n};\n\n// Constructs a ForkingDeathTest.\nForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex)\n    : DeathTestImpl(a_statement, a_regex),\n      child_pid_(-1) {}\n\n// Waits for the child in a death test to exit, returning its exit\n// status, or 0 if no child process exists.  As a side effect, sets the\n// outcome data member.\nint ForkingDeathTest::Wait() {\n  if (!spawned())\n    return 0;\n\n  ReadAndInterpretStatusByte();\n\n  int status_value;\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));\n  set_status(status_value);\n  return status_value;\n}\n\n// A concrete death test class that forks, then immediately runs the test\n// in the child process.\nclass NoExecDeathTest : public ForkingDeathTest {\n public:\n  NoExecDeathTest(const char* a_statement, const RE* a_regex) :\n      ForkingDeathTest(a_statement, a_regex) { }\n  virtual TestRole AssumeRole();\n};\n\n// The AssumeRole process for a fork-and-run death test.  It implements a\n// straightforward fork, with a simple pipe to transmit the status byte.\nDeathTest::TestRole NoExecDeathTest::AssumeRole() {\n  const size_t thread_count = GetThreadCount();\n  if (thread_count != 1) {\n    GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);\n  }\n\n  int pipe_fd[2];\n  GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);\n\n  DeathTest::set_last_death_test_message(\"\");\n  CaptureStderr();\n  // When we fork the process below, the log file buffers are copied, but the\n  // file descriptors are shared.  We flush all log files here so that closing\n  // the file descriptors in the child process doesn't throw off the\n  // synchronization between descriptors and buffers in the parent process.\n  // This is as close to the fork as possible to avoid a race condition in case\n  // there are multiple threads running before the death test, and another\n  // thread writes to the log file.\n  FlushInfoLog();\n\n  const pid_t child_pid = fork();\n  GTEST_DEATH_TEST_CHECK_(child_pid != -1);\n  set_child_pid(child_pid);\n  if (child_pid == 0) {\n    GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));\n    set_write_fd(pipe_fd[1]);\n    // Redirects all logging to stderr in the child process to prevent\n    // concurrent writes to the log files.  We capture stderr in the parent\n    // process and append the child process' output to a log.\n    LogToStderr();\n    // Event forwarding to the listeners of event listener API mush be shut\n    // down in death test subprocesses.\n    GetUnitTestImpl()->listeners()->SuppressEventForwarding();\n    g_in_fast_death_test_child = true;\n    return EXECUTE_TEST;\n  } else {\n    GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));\n    set_read_fd(pipe_fd[0]);\n    set_spawned(true);\n    return OVERSEE_TEST;\n  }\n}\n\n// A concrete death test class that forks and re-executes the main\n// program from the beginning, with command-line flags set that cause\n// only this specific death test to be run.\nclass ExecDeathTest : public ForkingDeathTest {\n public:\n  ExecDeathTest(const char* a_statement, const RE* a_regex,\n                const char* file, int line) :\n      ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }\n  virtual TestRole AssumeRole();\n private:\n  static ::std::vector<testing::internal::string>\n  GetArgvsForDeathTestChildProcess() {\n    ::std::vector<testing::internal::string> args = GetInjectableArgvs();\n    return args;\n  }\n  // The name of the file in which the death test is located.\n  const char* const file_;\n  // The line number on which the death test is located.\n  const int line_;\n};\n\n// Utility class for accumulating command-line arguments.\nclass Arguments {\n public:\n  Arguments() {\n    args_.push_back(NULL);\n  }\n\n  ~Arguments() {\n    for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();\n         ++i) {\n      free(*i);\n    }\n  }\n  void AddArgument(const char* argument) {\n    args_.insert(args_.end() - 1, posix::StrDup(argument));\n  }\n\n  template <typename Str>\n  void AddArguments(const ::std::vector<Str>& arguments) {\n    for (typename ::std::vector<Str>::const_iterator i = arguments.begin();\n         i != arguments.end();\n         ++i) {\n      args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));\n    }\n  }\n  char* const* Argv() {\n    return &args_[0];\n  }\n\n private:\n  std::vector<char*> args_;\n};\n\n// A struct that encompasses the arguments to the child process of a\n// threadsafe-style death test process.\nstruct ExecDeathTestArgs {\n  char* const* argv;  // Command-line arguments for the child's call to exec\n  int close_fd;       // File descriptor to close; the read end of a pipe\n};\n\n#  if GTEST_OS_MAC\ninline char** GetEnviron() {\n  // When Google Test is built as a framework on MacOS X, the environ variable\n  // is unavailable. Apple's documentation (man environ) recommends using\n  // _NSGetEnviron() instead.\n  return *_NSGetEnviron();\n}\n#  else\n// Some POSIX platforms expect you to declare environ. extern \"C\" makes\n// it reside in the global namespace.\nextern \"C\" char** environ;\ninline char** GetEnviron() { return environ; }\n#  endif  // GTEST_OS_MAC\n\n#  if !GTEST_OS_QNX\n// The main function for a threadsafe-style death test child process.\n// This function is called in a clone()-ed process and thus must avoid\n// any potentially unsafe operations like malloc or libc functions.\nstatic int ExecDeathTestChildMain(void* child_arg) {\n  ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));\n\n  // We need to execute the test program in the same environment where\n  // it was originally invoked.  Therefore we change to the original\n  // working directory first.\n  const char* const original_dir =\n      UnitTest::GetInstance()->original_working_dir();\n  // We can safely call chdir() as it's a direct system call.\n  if (chdir(original_dir) != 0) {\n    DeathTestAbort(std::string(\"chdir(\\\"\") + original_dir + \"\\\") failed: \" +\n                   GetLastErrnoDescription());\n    return EXIT_FAILURE;\n  }\n\n  // We can safely call execve() as it's a direct system call.  We\n  // cannot use execvp() as it's a libc function and thus potentially\n  // unsafe.  Since execve() doesn't search the PATH, the user must\n  // invoke the test program via a valid path that contains at least\n  // one path separator.\n  execve(args->argv[0], args->argv, GetEnviron());\n  DeathTestAbort(std::string(\"execve(\") + args->argv[0] + \", ...) in \" +\n                 original_dir + \" failed: \" +\n                 GetLastErrnoDescription());\n  return EXIT_FAILURE;\n}\n#  endif  // !GTEST_OS_QNX\n\n// Two utility routines that together determine the direction the stack\n// grows.\n// This could be accomplished more elegantly by a single recursive\n// function, but we want to guard against the unlikely possibility of\n// a smart compiler optimizing the recursion away.\n//\n// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining\n// StackLowerThanAddress into StackGrowsDown, which then doesn't give\n// correct answer.\nvoid StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;\nvoid StackLowerThanAddress(const void* ptr, bool* result) {\n  int dummy;\n  *result = (&dummy < ptr);\n}\n\nbool StackGrowsDown() {\n  int dummy;\n  bool result;\n  StackLowerThanAddress(&dummy, &result);\n  return result;\n}\n\n// Spawns a child process with the same executable as the current process in\n// a thread-safe manner and instructs it to run the death test.  The\n// implementation uses fork(2) + exec.  On systems where clone(2) is\n// available, it is used instead, being slightly more thread-safe.  On QNX,\n// fork supports only single-threaded environments, so this function uses\n// spawn(2) there instead.  The function dies with an error message if\n// anything goes wrong.\nstatic pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {\n  ExecDeathTestArgs args = { argv, close_fd };\n  pid_t child_pid = -1;\n\n#  if GTEST_OS_QNX\n  // Obtains the current directory and sets it to be closed in the child\n  // process.\n  const int cwd_fd = open(\".\", O_RDONLY);\n  GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));\n  // We need to execute the test program in the same environment where\n  // it was originally invoked.  Therefore we change to the original\n  // working directory first.\n  const char* const original_dir =\n      UnitTest::GetInstance()->original_working_dir();\n  // We can safely call chdir() as it's a direct system call.\n  if (chdir(original_dir) != 0) {\n    DeathTestAbort(std::string(\"chdir(\\\"\") + original_dir + \"\\\") failed: \" +\n                   GetLastErrnoDescription());\n    return EXIT_FAILURE;\n  }\n\n  int fd_flags;\n  // Set close_fd to be closed after spawn.\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,\n                                        fd_flags | FD_CLOEXEC));\n  struct inheritance inherit = {0};\n  // spawn is a system call.\n  child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());\n  // Restores the current working directory.\n  GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));\n\n#  else   // GTEST_OS_QNX\n#   if GTEST_OS_LINUX\n  // When a SIGPROF signal is received while fork() or clone() are executing,\n  // the process may hang. To avoid this, we ignore SIGPROF here and re-enable\n  // it after the call to fork()/clone() is complete.\n  struct sigaction saved_sigprof_action;\n  struct sigaction ignore_sigprof_action;\n  memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));\n  sigemptyset(&ignore_sigprof_action.sa_mask);\n  ignore_sigprof_action.sa_handler = SIG_IGN;\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(\n      SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));\n#   endif  // GTEST_OS_LINUX\n\n#   if GTEST_HAS_CLONE\n  const bool use_fork = GTEST_FLAG(death_test_use_fork);\n\n  if (!use_fork) {\n    static const bool stack_grows_down = StackGrowsDown();\n    const size_t stack_size = getpagesize();\n    // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.\n    void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,\n                             MAP_ANON | MAP_PRIVATE, -1, 0);\n    GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);\n\n    // Maximum stack alignment in bytes:  For a downward-growing stack, this\n    // amount is subtracted from size of the stack space to get an address\n    // that is within the stack space and is aligned on all systems we care\n    // about.  As far as I know there is no ABI with stack alignment greater\n    // than 64.  We assume stack and stack_size already have alignment of\n    // kMaxStackAlignment.\n    const size_t kMaxStackAlignment = 64;\n    void* const stack_top =\n        static_cast<char*>(stack) +\n            (stack_grows_down ? stack_size - kMaxStackAlignment : 0);\n    GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment &&\n        reinterpret_cast<intptr_t>(stack_top) % kMaxStackAlignment == 0);\n\n    child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);\n\n    GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);\n  }\n#   else\n  const bool use_fork = true;\n#   endif  // GTEST_HAS_CLONE\n\n  if (use_fork && (child_pid = fork()) == 0) {\n      ExecDeathTestChildMain(&args);\n      _exit(0);\n  }\n#  endif  // GTEST_OS_QNX\n#  if GTEST_OS_LINUX\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(\n      sigaction(SIGPROF, &saved_sigprof_action, NULL));\n#  endif  // GTEST_OS_LINUX\n\n  GTEST_DEATH_TEST_CHECK_(child_pid != -1);\n  return child_pid;\n}\n\n// The AssumeRole process for a fork-and-exec death test.  It re-executes the\n// main program from the beginning, setting the --gtest_filter\n// and --gtest_internal_run_death_test flags to cause only the current\n// death test to be re-run.\nDeathTest::TestRole ExecDeathTest::AssumeRole() {\n  const UnitTestImpl* const impl = GetUnitTestImpl();\n  const InternalRunDeathTestFlag* const flag =\n      impl->internal_run_death_test_flag();\n  const TestInfo* const info = impl->current_test_info();\n  const int death_test_index = info->result()->death_test_count();\n\n  if (flag != NULL) {\n    set_write_fd(flag->write_fd());\n    return EXECUTE_TEST;\n  }\n\n  int pipe_fd[2];\n  GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);\n  // Clear the close-on-exec flag on the write end of the pipe, lest\n  // it be closed when the child process does an exec:\n  GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);\n\n  const std::string filter_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kFilterFlag + \"=\"\n      + info->test_case_name() + \".\" + info->name();\n  const std::string internal_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + \"=\"\n      + file_ + \"|\" + StreamableToString(line_) + \"|\"\n      + StreamableToString(death_test_index) + \"|\"\n      + StreamableToString(pipe_fd[1]);\n  Arguments args;\n  args.AddArguments(GetArgvsForDeathTestChildProcess());\n  args.AddArgument(filter_flag.c_str());\n  args.AddArgument(internal_flag.c_str());\n\n  DeathTest::set_last_death_test_message(\"\");\n\n  CaptureStderr();\n  // See the comment in NoExecDeathTest::AssumeRole for why the next line\n  // is necessary.\n  FlushInfoLog();\n\n  const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));\n  set_child_pid(child_pid);\n  set_read_fd(pipe_fd[0]);\n  set_spawned(true);\n  return OVERSEE_TEST;\n}\n\n# endif  // !GTEST_OS_WINDOWS\n\n// Creates a concrete DeathTest-derived class that depends on the\n// --gtest_death_test_style flag, and sets the pointer pointed to\n// by the \"test\" argument to its address.  If the test should be\n// skipped, sets that pointer to NULL.  Returns true, unless the\n// flag is set to an invalid value.\nbool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,\n                                     const char* file, int line,\n                                     DeathTest** test) {\n  UnitTestImpl* const impl = GetUnitTestImpl();\n  const InternalRunDeathTestFlag* const flag =\n      impl->internal_run_death_test_flag();\n  const int death_test_index = impl->current_test_info()\n      ->increment_death_test_count();\n\n  if (flag != NULL) {\n    if (death_test_index > flag->index()) {\n      DeathTest::set_last_death_test_message(\n          \"Death test count (\" + StreamableToString(death_test_index)\n          + \") somehow exceeded expected maximum (\"\n          + StreamableToString(flag->index()) + \")\");\n      return false;\n    }\n\n    if (!(flag->file() == file && flag->line() == line &&\n          flag->index() == death_test_index)) {\n      *test = NULL;\n      return true;\n    }\n  }\n\n# if GTEST_OS_WINDOWS\n\n  if (GTEST_FLAG(death_test_style) == \"threadsafe\" ||\n      GTEST_FLAG(death_test_style) == \"fast\") {\n    *test = new WindowsDeathTest(statement, regex, file, line);\n  }\n\n# else\n\n  if (GTEST_FLAG(death_test_style) == \"threadsafe\") {\n    *test = new ExecDeathTest(statement, regex, file, line);\n  } else if (GTEST_FLAG(death_test_style) == \"fast\") {\n    *test = new NoExecDeathTest(statement, regex);\n  }\n\n# endif  // GTEST_OS_WINDOWS\n\n  else {  // NOLINT - this is more readable than unbalanced brackets inside #if.\n    DeathTest::set_last_death_test_message(\n        \"Unknown death test style \\\"\" + GTEST_FLAG(death_test_style)\n        + \"\\\" encountered\");\n    return false;\n  }\n\n  return true;\n}\n\n// Splits a given string on a given delimiter, populating a given\n// vector with the fields.  GTEST_HAS_DEATH_TEST implies that we have\n// ::std::string, so we can use it here.\nstatic void SplitString(const ::std::string& str, char delimiter,\n                        ::std::vector< ::std::string>* dest) {\n  ::std::vector< ::std::string> parsed;\n  ::std::string::size_type pos = 0;\n  while (::testing::internal::AlwaysTrue()) {\n    const ::std::string::size_type colon = str.find(delimiter, pos);\n    if (colon == ::std::string::npos) {\n      parsed.push_back(str.substr(pos));\n      break;\n    } else {\n      parsed.push_back(str.substr(pos, colon - pos));\n      pos = colon + 1;\n    }\n  }\n  dest->swap(parsed);\n}\n\n# if GTEST_OS_WINDOWS\n// Recreates the pipe and event handles from the provided parameters,\n// signals the event, and returns a file descriptor wrapped around the pipe\n// handle. This function is called in the child process only.\nint GetStatusFileDescriptor(unsigned int parent_process_id,\n                            size_t write_handle_as_size_t,\n                            size_t event_handle_as_size_t) {\n  AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,\n                                                   FALSE,  // Non-inheritable.\n                                                   parent_process_id));\n  if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {\n    DeathTestAbort(\"Unable to open parent process \" +\n                   StreamableToString(parent_process_id));\n  }\n\n  // TODO(vladl@google.com): Replace the following check with a\n  // compile-time assertion when available.\n  GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));\n\n  const HANDLE write_handle =\n      reinterpret_cast<HANDLE>(write_handle_as_size_t);\n  HANDLE dup_write_handle;\n\n  // The newly initialized handle is accessible only in in the parent\n  // process. To obtain one accessible within the child, we need to use\n  // DuplicateHandle.\n  if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,\n                         ::GetCurrentProcess(), &dup_write_handle,\n                         0x0,    // Requested privileges ignored since\n                                 // DUPLICATE_SAME_ACCESS is used.\n                         FALSE,  // Request non-inheritable handler.\n                         DUPLICATE_SAME_ACCESS)) {\n    DeathTestAbort(\"Unable to duplicate the pipe handle \" +\n                   StreamableToString(write_handle_as_size_t) +\n                   \" from the parent process \" +\n                   StreamableToString(parent_process_id));\n  }\n\n  const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);\n  HANDLE dup_event_handle;\n\n  if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,\n                         ::GetCurrentProcess(), &dup_event_handle,\n                         0x0,\n                         FALSE,\n                         DUPLICATE_SAME_ACCESS)) {\n    DeathTestAbort(\"Unable to duplicate the event handle \" +\n                   StreamableToString(event_handle_as_size_t) +\n                   \" from the parent process \" +\n                   StreamableToString(parent_process_id));\n  }\n\n  const int write_fd =\n      ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);\n  if (write_fd == -1) {\n    DeathTestAbort(\"Unable to convert pipe handle \" +\n                   StreamableToString(write_handle_as_size_t) +\n                   \" to a file descriptor\");\n  }\n\n  // Signals the parent that the write end of the pipe has been acquired\n  // so the parent can release its own write end.\n  ::SetEvent(dup_event_handle);\n\n  return write_fd;\n}\n# endif  // GTEST_OS_WINDOWS\n\n// Returns a newly created InternalRunDeathTestFlag object with fields\n// initialized from the GTEST_FLAG(internal_run_death_test) flag if\n// the flag is specified; otherwise returns NULL.\nInternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {\n  if (GTEST_FLAG(internal_run_death_test) == \"\") return NULL;\n\n  // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we\n  // can use it here.\n  int line = -1;\n  int index = -1;\n  ::std::vector< ::std::string> fields;\n  SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);\n  int write_fd = -1;\n\n# if GTEST_OS_WINDOWS\n\n  unsigned int parent_process_id = 0;\n  size_t write_handle_as_size_t = 0;\n  size_t event_handle_as_size_t = 0;\n\n  if (fields.size() != 6\n      || !ParseNaturalNumber(fields[1], &line)\n      || !ParseNaturalNumber(fields[2], &index)\n      || !ParseNaturalNumber(fields[3], &parent_process_id)\n      || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)\n      || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {\n    DeathTestAbort(\"Bad --gtest_internal_run_death_test flag: \" +\n                   GTEST_FLAG(internal_run_death_test));\n  }\n  write_fd = GetStatusFileDescriptor(parent_process_id,\n                                     write_handle_as_size_t,\n                                     event_handle_as_size_t);\n# else\n\n  if (fields.size() != 4\n      || !ParseNaturalNumber(fields[1], &line)\n      || !ParseNaturalNumber(fields[2], &index)\n      || !ParseNaturalNumber(fields[3], &write_fd)) {\n    DeathTestAbort(\"Bad --gtest_internal_run_death_test flag: \"\n        + GTEST_FLAG(internal_run_death_test));\n  }\n\n# endif  // GTEST_OS_WINDOWS\n\n  return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);\n}\n\n}  // namespace internal\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n}  // namespace testing\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: keith.ray@gmail.com (Keith Ray)\n\n\n#include <stdlib.h>\n\n#if GTEST_OS_WINDOWS_MOBILE\n# include <windows.h>\n#elif GTEST_OS_WINDOWS\n# include <direct.h>\n# include <io.h>\n#elif GTEST_OS_SYMBIAN\n// Symbian OpenC has PATH_MAX in sys/syslimits.h\n# include <sys/syslimits.h>\n#else\n# include <limits.h>\n# include <climits>  // Some Linux distributions define PATH_MAX here.\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n#if GTEST_OS_WINDOWS\n# define GTEST_PATH_MAX_ _MAX_PATH\n#elif defined(PATH_MAX)\n# define GTEST_PATH_MAX_ PATH_MAX\n#elif defined(_XOPEN_PATH_MAX)\n# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX\n#else\n# define GTEST_PATH_MAX_ _POSIX_PATH_MAX\n#endif  // GTEST_OS_WINDOWS\n\n\nnamespace testing {\nnamespace internal {\n\n#if GTEST_OS_WINDOWS\n// On Windows, '\\\\' is the standard path separator, but many tools and the\n// Windows API also accept '/' as an alternate path separator. Unless otherwise\n// noted, a file path can contain either kind of path separators, or a mixture\n// of them.\nconst char kPathSeparator = '\\\\';\nconst char kAlternatePathSeparator = '/';\nconst char kPathSeparatorString[] = \"\\\\\";\nconst char kAlternatePathSeparatorString[] = \"/\";\n# if GTEST_OS_WINDOWS_MOBILE\n// Windows CE doesn't have a current directory. You should not use\n// the current directory in tests on Windows CE, but this at least\n// provides a reasonable fallback.\nconst char kCurrentDirectoryString[] = \"\\\\\";\n// Windows CE doesn't define INVALID_FILE_ATTRIBUTES\nconst DWORD kInvalidFileAttributes = 0xffffffff;\n# else\nconst char kCurrentDirectoryString[] = \".\\\\\";\n# endif  // GTEST_OS_WINDOWS_MOBILE\n#else\nconst char kPathSeparator = '/';\nconst char kPathSeparatorString[] = \"/\";\nconst char kCurrentDirectoryString[] = \"./\";\n#endif  // GTEST_OS_WINDOWS\n\n// Returns whether the given character is a valid path separator.\nstatic bool IsPathSeparator(char c) {\n#if GTEST_HAS_ALT_PATH_SEP_\n  return (c == kPathSeparator) || (c == kAlternatePathSeparator);\n#else\n  return c == kPathSeparator;\n#endif\n}\n\n// Returns the current working directory, or \"\" if unsuccessful.\nFilePath FilePath::GetCurrentDir() {\n#if GTEST_OS_WINDOWS_MOBILE\n  // Windows CE doesn't have a current directory, so we just return\n  // something reasonable.\n  return FilePath(kCurrentDirectoryString);\n#elif GTEST_OS_WINDOWS\n  char cwd[GTEST_PATH_MAX_ + 1] = { '\\0' };\n  return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? \"\" : cwd);\n#else\n  char cwd[GTEST_PATH_MAX_ + 1] = { '\\0' };\n  return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? \"\" : cwd);\n#endif  // GTEST_OS_WINDOWS_MOBILE\n}\n\n// Returns a copy of the FilePath with the case-insensitive extension removed.\n// Example: FilePath(\"dir/file.exe\").RemoveExtension(\"EXE\") returns\n// FilePath(\"dir/file\"). If a case-insensitive extension is not\n// found, returns a copy of the original FilePath.\nFilePath FilePath::RemoveExtension(const char* extension) const {\n  const std::string dot_extension = std::string(\".\") + extension;\n  if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {\n    return FilePath(pathname_.substr(\n        0, pathname_.length() - dot_extension.length()));\n  }\n  return *this;\n}\n\n// Returns a pointer to the last occurence of a valid path separator in\n// the FilePath. On Windows, for example, both '/' and '\\' are valid path\n// separators. Returns NULL if no path separator was found.\nconst char* FilePath::FindLastPathSeparator() const {\n  const char* const last_sep = strrchr(c_str(), kPathSeparator);\n#if GTEST_HAS_ALT_PATH_SEP_\n  const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);\n  // Comparing two pointers of which only one is NULL is undefined.\n  if (last_alt_sep != NULL &&\n      (last_sep == NULL || last_alt_sep > last_sep)) {\n    return last_alt_sep;\n  }\n#endif\n  return last_sep;\n}\n\n// Returns a copy of the FilePath with the directory part removed.\n// Example: FilePath(\"path/to/file\").RemoveDirectoryName() returns\n// FilePath(\"file\"). If there is no directory part (\"just_a_file\"), it returns\n// the FilePath unmodified. If there is no file part (\"just_a_dir/\") it\n// returns an empty FilePath (\"\").\n// On Windows platform, '\\' is the path separator, otherwise it is '/'.\nFilePath FilePath::RemoveDirectoryName() const {\n  const char* const last_sep = FindLastPathSeparator();\n  return last_sep ? FilePath(last_sep + 1) : *this;\n}\n\n// RemoveFileName returns the directory path with the filename removed.\n// Example: FilePath(\"path/to/file\").RemoveFileName() returns \"path/to/\".\n// If the FilePath is \"a_file\" or \"/a_file\", RemoveFileName returns\n// FilePath(\"./\") or, on Windows, FilePath(\".\\\\\"). If the filepath does\n// not have a file, like \"just/a/dir/\", it returns the FilePath unmodified.\n// On Windows platform, '\\' is the path separator, otherwise it is '/'.\nFilePath FilePath::RemoveFileName() const {\n  const char* const last_sep = FindLastPathSeparator();\n  std::string dir;\n  if (last_sep) {\n    dir = std::string(c_str(), last_sep + 1 - c_str());\n  } else {\n    dir = kCurrentDirectoryString;\n  }\n  return FilePath(dir);\n}\n\n// Helper functions for naming files in a directory for xml output.\n\n// Given directory = \"dir\", base_name = \"test\", number = 0,\n// extension = \"xml\", returns \"dir/test.xml\". If number is greater\n// than zero (e.g., 12), returns \"dir/test_12.xml\".\n// On Windows platform, uses \\ as the separator rather than /.\nFilePath FilePath::MakeFileName(const FilePath& directory,\n                                const FilePath& base_name,\n                                int number,\n                                const char* extension) {\n  std::string file;\n  if (number == 0) {\n    file = base_name.string() + \".\" + extension;\n  } else {\n    file = base_name.string() + \"_\" + StreamableToString(number)\n        + \".\" + extension;\n  }\n  return ConcatPaths(directory, FilePath(file));\n}\n\n// Given directory = \"dir\", relative_path = \"test.xml\", returns \"dir/test.xml\".\n// On Windows, uses \\ as the separator rather than /.\nFilePath FilePath::ConcatPaths(const FilePath& directory,\n                               const FilePath& relative_path) {\n  if (directory.IsEmpty())\n    return relative_path;\n  const FilePath dir(directory.RemoveTrailingPathSeparator());\n  return FilePath(dir.string() + kPathSeparator + relative_path.string());\n}\n\n// Returns true if pathname describes something findable in the file-system,\n// either a file, directory, or whatever.\nbool FilePath::FileOrDirectoryExists() const {\n#if GTEST_OS_WINDOWS_MOBILE\n  LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());\n  const DWORD attributes = GetFileAttributes(unicode);\n  delete [] unicode;\n  return attributes != kInvalidFileAttributes;\n#else\n  posix::StatStruct file_stat;\n  return posix::Stat(pathname_.c_str(), &file_stat) == 0;\n#endif  // GTEST_OS_WINDOWS_MOBILE\n}\n\n// Returns true if pathname describes a directory in the file-system\n// that exists.\nbool FilePath::DirectoryExists() const {\n  bool result = false;\n#if GTEST_OS_WINDOWS\n  // Don't strip off trailing separator if path is a root directory on\n  // Windows (like \"C:\\\\\").\n  const FilePath& path(IsRootDirectory() ? *this :\n                                           RemoveTrailingPathSeparator());\n#else\n  const FilePath& path(*this);\n#endif\n\n#if GTEST_OS_WINDOWS_MOBILE\n  LPCWSTR unicode = String::AnsiToUtf16(path.c_str());\n  const DWORD attributes = GetFileAttributes(unicode);\n  delete [] unicode;\n  if ((attributes != kInvalidFileAttributes) &&\n      (attributes & FILE_ATTRIBUTE_DIRECTORY)) {\n    result = true;\n  }\n#else\n  posix::StatStruct file_stat;\n  result = posix::Stat(path.c_str(), &file_stat) == 0 &&\n      posix::IsDir(file_stat);\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n  return result;\n}\n\n// Returns true if pathname describes a root directory. (Windows has one\n// root directory per disk drive.)\nbool FilePath::IsRootDirectory() const {\n#if GTEST_OS_WINDOWS\n  // TODO(wan@google.com): on Windows a network share like\n  // \\\\server\\share can be a root directory, although it cannot be the\n  // current directory.  Handle this properly.\n  return pathname_.length() == 3 && IsAbsolutePath();\n#else\n  return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);\n#endif\n}\n\n// Returns true if pathname describes an absolute path.\nbool FilePath::IsAbsolutePath() const {\n  const char* const name = pathname_.c_str();\n#if GTEST_OS_WINDOWS\n  return pathname_.length() >= 3 &&\n     ((name[0] >= 'a' && name[0] <= 'z') ||\n      (name[0] >= 'A' && name[0] <= 'Z')) &&\n     name[1] == ':' &&\n     IsPathSeparator(name[2]);\n#else\n  return IsPathSeparator(name[0]);\n#endif\n}\n\n// Returns a pathname for a file that does not currently exist. The pathname\n// will be directory/base_name.extension or\n// directory/base_name_<number>.extension if directory/base_name.extension\n// already exists. The number will be incremented until a pathname is found\n// that does not already exist.\n// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.\n// There could be a race condition if two or more processes are calling this\n// function at the same time -- they could both pick the same filename.\nFilePath FilePath::GenerateUniqueFileName(const FilePath& directory,\n                                          const FilePath& base_name,\n                                          const char* extension) {\n  FilePath full_pathname;\n  int number = 0;\n  do {\n    full_pathname.Set(MakeFileName(directory, base_name, number++, extension));\n  } while (full_pathname.FileOrDirectoryExists());\n  return full_pathname;\n}\n\n// Returns true if FilePath ends with a path separator, which indicates that\n// it is intended to represent a directory. Returns false otherwise.\n// This does NOT check that a directory (or file) actually exists.\nbool FilePath::IsDirectory() const {\n  return !pathname_.empty() &&\n         IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);\n}\n\n// Create directories so that path exists. Returns true if successful or if\n// the directories already exist; returns false if unable to create directories\n// for any reason.\nbool FilePath::CreateDirectoriesRecursively() const {\n  if (!this->IsDirectory()) {\n    return false;\n  }\n\n  if (pathname_.length() == 0 || this->DirectoryExists()) {\n    return true;\n  }\n\n  const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());\n  return parent.CreateDirectoriesRecursively() && this->CreateFolder();\n}\n\n// Create the directory so that path exists. Returns true if successful or\n// if the directory already exists; returns false if unable to create the\n// directory for any reason, including if the parent directory does not\n// exist. Not named \"CreateDirectory\" because that's a macro on Windows.\nbool FilePath::CreateFolder() const {\n#if GTEST_OS_WINDOWS_MOBILE\n  FilePath removed_sep(this->RemoveTrailingPathSeparator());\n  LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());\n  int result = CreateDirectory(unicode, NULL) ? 0 : -1;\n  delete [] unicode;\n#elif GTEST_OS_WINDOWS\n  int result = _mkdir(pathname_.c_str());\n#else\n  int result = mkdir(pathname_.c_str(), 0777);\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n  if (result == -1) {\n    return this->DirectoryExists();  // An error is OK if the directory exists.\n  }\n  return true;  // No error.\n}\n\n// If input name has a trailing separator character, remove it and return the\n// name, otherwise return the name string unmodified.\n// On Windows platform, uses \\ as the separator, other platforms use /.\nFilePath FilePath::RemoveTrailingPathSeparator() const {\n  return IsDirectory()\n      ? FilePath(pathname_.substr(0, pathname_.length() - 1))\n      : *this;\n}\n\n// Removes any redundant separators that might be in the pathname.\n// For example, \"bar///foo\" becomes \"bar/foo\". Does not eliminate other\n// redundancies that might be in a pathname involving \".\" or \"..\".\n// TODO(wan@google.com): handle Windows network shares (e.g. \\\\server\\share).\nvoid FilePath::Normalize() {\n  if (pathname_.c_str() == NULL) {\n    pathname_ = \"\";\n    return;\n  }\n  const char* src = pathname_.c_str();\n  char* const dest = new char[pathname_.length() + 1];\n  char* dest_ptr = dest;\n  memset(dest_ptr, 0, pathname_.length() + 1);\n\n  while (*src != '\\0') {\n    *dest_ptr = *src;\n    if (!IsPathSeparator(*src)) {\n      src++;\n    } else {\n#if GTEST_HAS_ALT_PATH_SEP_\n      if (*dest_ptr == kAlternatePathSeparator) {\n        *dest_ptr = kPathSeparator;\n      }\n#endif\n      while (IsPathSeparator(*src))\n        src++;\n    }\n    dest_ptr++;\n  }\n  *dest_ptr = '\\0';\n  pathname_ = dest;\n  delete[] dest;\n}\n\n}  // namespace internal\n}  // namespace testing\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n\n#include <limits.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#if GTEST_OS_WINDOWS_MOBILE\n# include <windows.h>  // For TerminateProcess()\n#elif GTEST_OS_WINDOWS\n# include <io.h>\n# include <sys/stat.h>\n#else\n# include <unistd.h>\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n#if GTEST_OS_MAC\n# include <mach/mach_init.h>\n# include <mach/task.h>\n# include <mach/vm_map.h>\n#endif  // GTEST_OS_MAC\n\n#if GTEST_OS_QNX\n# include <devctl.h>\n# include <sys/procfs.h>\n#endif  // GTEST_OS_QNX\n\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\nnamespace internal {\n\n#if defined(_MSC_VER) || defined(__BORLANDC__)\n// MSVC and C++Builder do not provide a definition of STDERR_FILENO.\nconst int kStdOutFileno = 1;\nconst int kStdErrFileno = 2;\n#else\nconst int kStdOutFileno = STDOUT_FILENO;\nconst int kStdErrFileno = STDERR_FILENO;\n#endif  // _MSC_VER\n\n#if GTEST_OS_MAC\n\n// Returns the number of threads running in the process, or 0 to indicate that\n// we cannot detect it.\nsize_t GetThreadCount() {\n  const task_t task = mach_task_self();\n  mach_msg_type_number_t thread_count;\n  thread_act_array_t thread_list;\n  const kern_return_t status = task_threads(task, &thread_list, &thread_count);\n  if (status == KERN_SUCCESS) {\n    // task_threads allocates resources in thread_list and we need to free them\n    // to avoid leaks.\n    vm_deallocate(task,\n                  reinterpret_cast<vm_address_t>(thread_list),\n                  sizeof(thread_t) * thread_count);\n    return static_cast<size_t>(thread_count);\n  } else {\n    return 0;\n  }\n}\n\n#elif GTEST_OS_QNX\n\n// Returns the number of threads running in the process, or 0 to indicate that\n// we cannot detect it.\nsize_t GetThreadCount() {\n  const int fd = open(\"/proc/self/as\", O_RDONLY);\n  if (fd < 0) {\n    return 0;\n  }\n  procfs_info process_info;\n  const int status =\n      devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);\n  close(fd);\n  if (status == EOK) {\n    return static_cast<size_t>(process_info.num_threads);\n  } else {\n    return 0;\n  }\n}\n\n#else\n\nsize_t GetThreadCount() {\n  // There's no portable way to detect the number of threads, so we just\n  // return 0 to indicate that we cannot detect it.\n  return 0;\n}\n\n#endif  // GTEST_OS_MAC\n\n#if GTEST_USES_POSIX_RE\n\n// Implements RE.  Currently only needed for death tests.\n\nRE::~RE() {\n  if (is_valid_) {\n    // regfree'ing an invalid regex might crash because the content\n    // of the regex is undefined. Since the regex's are essentially\n    // the same, one cannot be valid (or invalid) without the other\n    // being so too.\n    regfree(&partial_regex_);\n    regfree(&full_regex_);\n  }\n  free(const_cast<char*>(pattern_));\n}\n\n// Returns true iff regular expression re matches the entire str.\nbool RE::FullMatch(const char* str, const RE& re) {\n  if (!re.is_valid_) return false;\n\n  regmatch_t match;\n  return regexec(&re.full_regex_, str, 1, &match, 0) == 0;\n}\n\n// Returns true iff regular expression re matches a substring of str\n// (including str itself).\nbool RE::PartialMatch(const char* str, const RE& re) {\n  if (!re.is_valid_) return false;\n\n  regmatch_t match;\n  return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;\n}\n\n// Initializes an RE from its string representation.\nvoid RE::Init(const char* regex) {\n  pattern_ = posix::StrDup(regex);\n\n  // Reserves enough bytes to hold the regular expression used for a\n  // full match.\n  const size_t full_regex_len = strlen(regex) + 10;\n  char* const full_pattern = new char[full_regex_len];\n\n  snprintf(full_pattern, full_regex_len, \"^(%s)$\", regex);\n  is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;\n  // We want to call regcomp(&partial_regex_, ...) even if the\n  // previous expression returns false.  Otherwise partial_regex_ may\n  // not be properly initialized can may cause trouble when it's\n  // freed.\n  //\n  // Some implementation of POSIX regex (e.g. on at least some\n  // versions of Cygwin) doesn't accept the empty string as a valid\n  // regex.  We change it to an equivalent form \"()\" to be safe.\n  if (is_valid_) {\n    const char* const partial_regex = (*regex == '\\0') ? \"()\" : regex;\n    is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0;\n  }\n  EXPECT_TRUE(is_valid_)\n      << \"Regular expression \\\"\" << regex\n      << \"\\\" is not a valid POSIX Extended regular expression.\";\n\n  delete[] full_pattern;\n}\n\n#elif GTEST_USES_SIMPLE_RE\n\n// Returns true iff ch appears anywhere in str (excluding the\n// terminating '\\0' character).\nbool IsInSet(char ch, const char* str) {\n  return ch != '\\0' && strchr(str, ch) != NULL;\n}\n\n// Returns true iff ch belongs to the given classification.  Unlike\n// similar functions in <ctype.h>, these aren't affected by the\n// current locale.\nbool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }\nbool IsAsciiPunct(char ch) {\n  return IsInSet(ch, \"^-!\\\"#$%&'()*+,./:;<=>?@[\\\\]_`{|}~\");\n}\nbool IsRepeat(char ch) { return IsInSet(ch, \"?*+\"); }\nbool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, \" \\f\\n\\r\\t\\v\"); }\nbool IsAsciiWordChar(char ch) {\n  return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||\n      ('0' <= ch && ch <= '9') || ch == '_';\n}\n\n// Returns true iff \"\\\\c\" is a supported escape sequence.\nbool IsValidEscape(char c) {\n  return (IsAsciiPunct(c) || IsInSet(c, \"dDfnrsStvwW\"));\n}\n\n// Returns true iff the given atom (specified by escaped and pattern)\n// matches ch.  The result is undefined if the atom is invalid.\nbool AtomMatchesChar(bool escaped, char pattern_char, char ch) {\n  if (escaped) {  // \"\\\\p\" where p is pattern_char.\n    switch (pattern_char) {\n      case 'd': return IsAsciiDigit(ch);\n      case 'D': return !IsAsciiDigit(ch);\n      case 'f': return ch == '\\f';\n      case 'n': return ch == '\\n';\n      case 'r': return ch == '\\r';\n      case 's': return IsAsciiWhiteSpace(ch);\n      case 'S': return !IsAsciiWhiteSpace(ch);\n      case 't': return ch == '\\t';\n      case 'v': return ch == '\\v';\n      case 'w': return IsAsciiWordChar(ch);\n      case 'W': return !IsAsciiWordChar(ch);\n    }\n    return IsAsciiPunct(pattern_char) && pattern_char == ch;\n  }\n\n  return (pattern_char == '.' && ch != '\\n') || pattern_char == ch;\n}\n\n// Helper function used by ValidateRegex() to format error messages.\nstd::string FormatRegexSyntaxError(const char* regex, int index) {\n  return (Message() << \"Syntax error at index \" << index\n          << \" in simple regular expression \\\"\" << regex << \"\\\": \").GetString();\n}\n\n// Generates non-fatal failures and returns false if regex is invalid;\n// otherwise returns true.\nbool ValidateRegex(const char* regex) {\n  if (regex == NULL) {\n    // TODO(wan@google.com): fix the source file location in the\n    // assertion failures to match where the regex is used in user\n    // code.\n    ADD_FAILURE() << \"NULL is not a valid simple regular expression.\";\n    return false;\n  }\n\n  bool is_valid = true;\n\n  // True iff ?, *, or + can follow the previous atom.\n  bool prev_repeatable = false;\n  for (int i = 0; regex[i]; i++) {\n    if (regex[i] == '\\\\') {  // An escape sequence\n      i++;\n      if (regex[i] == '\\0') {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)\n                      << \"'\\\\' cannot appear at the end.\";\n        return false;\n      }\n\n      if (!IsValidEscape(regex[i])) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)\n                      << \"invalid escape sequence \\\"\\\\\" << regex[i] << \"\\\".\";\n        is_valid = false;\n      }\n      prev_repeatable = true;\n    } else {  // Not an escape sequence.\n      const char ch = regex[i];\n\n      if (ch == '^' && i > 0) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'^' can only appear at the beginning.\";\n        is_valid = false;\n      } else if (ch == '$' && regex[i + 1] != '\\0') {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'$' can only appear at the end.\";\n        is_valid = false;\n      } else if (IsInSet(ch, \"()[]{}|\")) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'\" << ch << \"' is unsupported.\";\n        is_valid = false;\n      } else if (IsRepeat(ch) && !prev_repeatable) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'\" << ch << \"' can only follow a repeatable token.\";\n        is_valid = false;\n      }\n\n      prev_repeatable = !IsInSet(ch, \"^$?*+\");\n    }\n  }\n\n  return is_valid;\n}\n\n// Matches a repeated regex atom followed by a valid simple regular\n// expression.  The regex atom is defined as c if escaped is false,\n// or \\c otherwise.  repeat is the repetition meta character (?, *,\n// or +).  The behavior is undefined if str contains too many\n// characters to be indexable by size_t, in which case the test will\n// probably time out anyway.  We are fine with this limitation as\n// std::string has it too.\nbool MatchRepetitionAndRegexAtHead(\n    bool escaped, char c, char repeat, const char* regex,\n    const char* str) {\n  const size_t min_count = (repeat == '+') ? 1 : 0;\n  const size_t max_count = (repeat == '?') ? 1 :\n      static_cast<size_t>(-1) - 1;\n  // We cannot call numeric_limits::max() as it conflicts with the\n  // max() macro on Windows.\n\n  for (size_t i = 0; i <= max_count; ++i) {\n    // We know that the atom matches each of the first i characters in str.\n    if (i >= min_count && MatchRegexAtHead(regex, str + i)) {\n      // We have enough matches at the head, and the tail matches too.\n      // Since we only care about *whether* the pattern matches str\n      // (as opposed to *how* it matches), there is no need to find a\n      // greedy match.\n      return true;\n    }\n    if (str[i] == '\\0' || !AtomMatchesChar(escaped, c, str[i]))\n      return false;\n  }\n  return false;\n}\n\n// Returns true iff regex matches a prefix of str.  regex must be a\n// valid simple regular expression and not start with \"^\", or the\n// result is undefined.\nbool MatchRegexAtHead(const char* regex, const char* str) {\n  if (*regex == '\\0')  // An empty regex matches a prefix of anything.\n    return true;\n\n  // \"$\" only matches the end of a string.  Note that regex being\n  // valid guarantees that there's nothing after \"$\" in it.\n  if (*regex == '$')\n    return *str == '\\0';\n\n  // Is the first thing in regex an escape sequence?\n  const bool escaped = *regex == '\\\\';\n  if (escaped)\n    ++regex;\n  if (IsRepeat(regex[1])) {\n    // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so\n    // here's an indirect recursion.  It terminates as the regex gets\n    // shorter in each recursion.\n    return MatchRepetitionAndRegexAtHead(\n        escaped, regex[0], regex[1], regex + 2, str);\n  } else {\n    // regex isn't empty, isn't \"$\", and doesn't start with a\n    // repetition.  We match the first atom of regex with the first\n    // character of str and recurse.\n    return (*str != '\\0') && AtomMatchesChar(escaped, *regex, *str) &&\n        MatchRegexAtHead(regex + 1, str + 1);\n  }\n}\n\n// Returns true iff regex matches any substring of str.  regex must be\n// a valid simple regular expression, or the result is undefined.\n//\n// The algorithm is recursive, but the recursion depth doesn't exceed\n// the regex length, so we won't need to worry about running out of\n// stack space normally.  In rare cases the time complexity can be\n// exponential with respect to the regex length + the string length,\n// but usually it's must faster (often close to linear).\nbool MatchRegexAnywhere(const char* regex, const char* str) {\n  if (regex == NULL || str == NULL)\n    return false;\n\n  if (*regex == '^')\n    return MatchRegexAtHead(regex + 1, str);\n\n  // A successful match can be anywhere in str.\n  do {\n    if (MatchRegexAtHead(regex, str))\n      return true;\n  } while (*str++ != '\\0');\n  return false;\n}\n\n// Implements the RE class.\n\nRE::~RE() {\n  free(const_cast<char*>(pattern_));\n  free(const_cast<char*>(full_pattern_));\n}\n\n// Returns true iff regular expression re matches the entire str.\nbool RE::FullMatch(const char* str, const RE& re) {\n  return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);\n}\n\n// Returns true iff regular expression re matches a substring of str\n// (including str itself).\nbool RE::PartialMatch(const char* str, const RE& re) {\n  return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);\n}\n\n// Initializes an RE from its string representation.\nvoid RE::Init(const char* regex) {\n  pattern_ = full_pattern_ = NULL;\n  if (regex != NULL) {\n    pattern_ = posix::StrDup(regex);\n  }\n\n  is_valid_ = ValidateRegex(regex);\n  if (!is_valid_) {\n    // No need to calculate the full pattern when the regex is invalid.\n    return;\n  }\n\n  const size_t len = strlen(regex);\n  // Reserves enough bytes to hold the regular expression used for a\n  // full match: we need space to prepend a '^', append a '$', and\n  // terminate the string with '\\0'.\n  char* buffer = static_cast<char*>(malloc(len + 3));\n  full_pattern_ = buffer;\n\n  if (*regex != '^')\n    *buffer++ = '^';  // Makes sure full_pattern_ starts with '^'.\n\n  // We don't use snprintf or strncpy, as they trigger a warning when\n  // compiled with VC++ 8.0.\n  memcpy(buffer, regex, len);\n  buffer += len;\n\n  if (len == 0 || regex[len - 1] != '$')\n    *buffer++ = '$';  // Makes sure full_pattern_ ends with '$'.\n\n  *buffer = '\\0';\n}\n\n#endif  // GTEST_USES_POSIX_RE\n\nconst char kUnknownFile[] = \"unknown file\";\n\n// Formats a source file path and a line number as they would appear\n// in an error message from the compiler used to compile this code.\nGTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {\n  const std::string file_name(file == NULL ? kUnknownFile : file);\n\n  if (line < 0) {\n    return file_name + \":\";\n  }\n#ifdef _MSC_VER\n  return file_name + \"(\" + StreamableToString(line) + \"):\";\n#else\n  return file_name + \":\" + StreamableToString(line) + \":\";\n#endif  // _MSC_VER\n}\n\n// Formats a file location for compiler-independent XML output.\n// Although this function is not platform dependent, we put it next to\n// FormatFileLocation in order to contrast the two functions.\n// Note that FormatCompilerIndependentFileLocation() does NOT append colon\n// to the file location it produces, unlike FormatFileLocation().\nGTEST_API_ ::std::string FormatCompilerIndependentFileLocation(\n    const char* file, int line) {\n  const std::string file_name(file == NULL ? kUnknownFile : file);\n\n  if (line < 0)\n    return file_name;\n  else\n    return file_name + \":\" + StreamableToString(line);\n}\n\n\nGTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)\n    : severity_(severity) {\n  const char* const marker =\n      severity == GTEST_INFO ?    \"[  INFO ]\" :\n      severity == GTEST_WARNING ? \"[WARNING]\" :\n      severity == GTEST_ERROR ?   \"[ ERROR ]\" : \"[ FATAL ]\";\n  GetStream() << ::std::endl << marker << \" \"\n              << FormatFileLocation(file, line).c_str() << \": \";\n}\n\n// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.\nGTestLog::~GTestLog() {\n  GetStream() << ::std::endl;\n  if (severity_ == GTEST_FATAL) {\n    fflush(stderr);\n    posix::Abort();\n  }\n}\n// Disable Microsoft deprecation warnings for POSIX functions called from\n// this class (creat, dup, dup2, and close)\n#ifdef _MSC_VER\n# pragma warning(push)\n# pragma warning(disable: 4996)\n#endif  // _MSC_VER\n\n#if GTEST_HAS_STREAM_REDIRECTION\n\n// Object that captures an output stream (stdout/stderr).\nclass CapturedStream {\n public:\n  // The ctor redirects the stream to a temporary file.\n  explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {\n# if GTEST_OS_WINDOWS\n    char temp_dir_path[MAX_PATH + 1] = { '\\0' };  // NOLINT\n    char temp_file_path[MAX_PATH + 1] = { '\\0' };  // NOLINT\n\n    ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);\n    const UINT success = ::GetTempFileNameA(temp_dir_path,\n                                            \"gtest_redir\",\n                                            0,  // Generate unique file name.\n                                            temp_file_path);\n    GTEST_CHECK_(success != 0)\n        << \"Unable to create a temporary file in \" << temp_dir_path;\n    const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);\n    GTEST_CHECK_(captured_fd != -1) << \"Unable to open temporary file \"\n                                    << temp_file_path;\n    filename_ = temp_file_path;\n# else\n    // There's no guarantee that a test has write access to the current\n    // directory, so we create the temporary file in the /tmp directory\n    // instead. We use /tmp on most systems, and /sdcard on Android.\n    // That's because Android doesn't have /tmp.\n#  if GTEST_OS_LINUX_ANDROID\n    // Note: Android applications are expected to call the framework's\n    // Context.getExternalStorageDirectory() method through JNI to get\n    // the location of the world-writable SD Card directory. However,\n    // this requires a Context handle, which cannot be retrieved\n    // globally from native code. Doing so also precludes running the\n    // code as part of a regular standalone executable, which doesn't\n    // run in a Dalvik process (e.g. when running it through 'adb shell').\n    //\n    // The location /sdcard is directly accessible from native code\n    // and is the only location (unofficially) supported by the Android\n    // team. It's generally a symlink to the real SD Card mount point\n    // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or\n    // other OEM-customized locations. Never rely on these, and always\n    // use /sdcard.\n    char name_template[] = \"/sdcard/gtest_captured_stream.XXXXXX\";\n#  else\n    char name_template[] = \"/tmp/captured_stream.XXXXXX\";\n#  endif  // GTEST_OS_LINUX_ANDROID\n    const int captured_fd = mkstemp(name_template);\n    filename_ = name_template;\n# endif  // GTEST_OS_WINDOWS\n    fflush(NULL);\n    dup2(captured_fd, fd_);\n    close(captured_fd);\n  }\n\n  ~CapturedStream() {\n    remove(filename_.c_str());\n  }\n\n  std::string GetCapturedString() {\n    if (uncaptured_fd_ != -1) {\n      // Restores the original stream.\n      fflush(NULL);\n      dup2(uncaptured_fd_, fd_);\n      close(uncaptured_fd_);\n      uncaptured_fd_ = -1;\n    }\n\n    FILE* const file = posix::FOpen(filename_.c_str(), \"r\");\n    const std::string content = ReadEntireFile(file);\n    posix::FClose(file);\n    return content;\n  }\n\n private:\n  // Reads the entire content of a file as an std::string.\n  static std::string ReadEntireFile(FILE* file);\n\n  // Returns the size (in bytes) of a file.\n  static size_t GetFileSize(FILE* file);\n\n  const int fd_;  // A stream to capture.\n  int uncaptured_fd_;\n  // Name of the temporary file holding the stderr output.\n  ::std::string filename_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);\n};\n\n// Returns the size (in bytes) of a file.\nsize_t CapturedStream::GetFileSize(FILE* file) {\n  fseek(file, 0, SEEK_END);\n  return static_cast<size_t>(ftell(file));\n}\n\n// Reads the entire content of a file as a string.\nstd::string CapturedStream::ReadEntireFile(FILE* file) {\n  const size_t file_size = GetFileSize(file);\n  char* const buffer = new char[file_size];\n\n  size_t bytes_last_read = 0;  // # of bytes read in the last fread()\n  size_t bytes_read = 0;       // # of bytes read so far\n\n  fseek(file, 0, SEEK_SET);\n\n  // Keeps reading the file until we cannot read further or the\n  // pre-determined file size is reached.\n  do {\n    bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);\n    bytes_read += bytes_last_read;\n  } while (bytes_last_read > 0 && bytes_read < file_size);\n\n  const std::string content(buffer, bytes_read);\n  delete[] buffer;\n\n  return content;\n}\n\n# ifdef _MSC_VER\n#  pragma warning(pop)\n# endif  // _MSC_VER\n\nstatic CapturedStream* g_captured_stderr = NULL;\nstatic CapturedStream* g_captured_stdout = NULL;\n\n// Starts capturing an output stream (stdout/stderr).\nvoid CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {\n  if (*stream != NULL) {\n    GTEST_LOG_(FATAL) << \"Only one \" << stream_name\n                      << \" capturer can exist at a time.\";\n  }\n  *stream = new CapturedStream(fd);\n}\n\n// Stops capturing the output stream and returns the captured string.\nstd::string GetCapturedStream(CapturedStream** captured_stream) {\n  const std::string content = (*captured_stream)->GetCapturedString();\n\n  delete *captured_stream;\n  *captured_stream = NULL;\n\n  return content;\n}\n\n// Starts capturing stdout.\nvoid CaptureStdout() {\n  CaptureStream(kStdOutFileno, \"stdout\", &g_captured_stdout);\n}\n\n// Starts capturing stderr.\nvoid CaptureStderr() {\n  CaptureStream(kStdErrFileno, \"stderr\", &g_captured_stderr);\n}\n\n// Stops capturing stdout and returns the captured string.\nstd::string GetCapturedStdout() {\n  return GetCapturedStream(&g_captured_stdout);\n}\n\n// Stops capturing stderr and returns the captured string.\nstd::string GetCapturedStderr() {\n  return GetCapturedStream(&g_captured_stderr);\n}\n\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n#if GTEST_HAS_DEATH_TEST\n\n// A copy of all command line arguments.  Set by InitGoogleTest().\n::std::vector<testing::internal::string> g_argvs;\n\nstatic const ::std::vector<testing::internal::string>* g_injected_test_argvs =\n                                        NULL;  // Owned.\n\nvoid SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {\n  if (g_injected_test_argvs != argvs)\n    delete g_injected_test_argvs;\n  g_injected_test_argvs = argvs;\n}\n\nconst ::std::vector<testing::internal::string>& GetInjectableArgvs() {\n  if (g_injected_test_argvs != NULL) {\n    return *g_injected_test_argvs;\n  }\n  return g_argvs;\n}\n#endif  // GTEST_HAS_DEATH_TEST\n\n#if GTEST_OS_WINDOWS_MOBILE\nnamespace posix {\nvoid Abort() {\n  DebugBreak();\n  TerminateProcess(GetCurrentProcess(), 1);\n}\n}  // namespace posix\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n// Returns the name of the environment variable corresponding to the\n// given flag.  For example, FlagToEnvVar(\"foo\") will return\n// \"GTEST_FOO\" in the open-source version.\nstatic std::string FlagToEnvVar(const char* flag) {\n  const std::string full_flag =\n      (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();\n\n  Message env_var;\n  for (size_t i = 0; i != full_flag.length(); i++) {\n    env_var << ToUpper(full_flag.c_str()[i]);\n  }\n\n  return env_var.GetString();\n}\n\n// Parses 'str' for a 32-bit signed integer.  If successful, writes\n// the result to *value and returns true; otherwise leaves *value\n// unchanged and returns false.\nbool ParseInt32(const Message& src_text, const char* str, Int32* value) {\n  // Parses the environment variable as a decimal integer.\n  char* end = NULL;\n  const long long_value = strtol(str, &end, 10);  // NOLINT\n\n  // Has strtol() consumed all characters in the string?\n  if (*end != '\\0') {\n    // No - an invalid character was encountered.\n    Message msg;\n    msg << \"WARNING: \" << src_text\n        << \" is expected to be a 32-bit integer, but actually\"\n        << \" has value \\\"\" << str << \"\\\".\\n\";\n    printf(\"%s\", msg.GetString().c_str());\n    fflush(stdout);\n    return false;\n  }\n\n  // Is the parsed value in the range of an Int32?\n  const Int32 result = static_cast<Int32>(long_value);\n  if (long_value == LONG_MAX || long_value == LONG_MIN ||\n      // The parsed value overflows as a long.  (strtol() returns\n      // LONG_MAX or LONG_MIN when the input overflows.)\n      result != long_value\n      // The parsed value overflows as an Int32.\n      ) {\n    Message msg;\n    msg << \"WARNING: \" << src_text\n        << \" is expected to be a 32-bit integer, but actually\"\n        << \" has value \" << str << \", which overflows.\\n\";\n    printf(\"%s\", msg.GetString().c_str());\n    fflush(stdout);\n    return false;\n  }\n\n  *value = result;\n  return true;\n}\n\n// Reads and returns the Boolean environment variable corresponding to\n// the given flag; if it's not set, returns default_value.\n//\n// The value is considered true iff it's not \"0\".\nbool BoolFromGTestEnv(const char* flag, bool default_value) {\n  const std::string env_var = FlagToEnvVar(flag);\n  const char* const string_value = posix::GetEnv(env_var.c_str());\n  return string_value == NULL ?\n      default_value : strcmp(string_value, \"0\") != 0;\n}\n\n// Reads and returns a 32-bit integer stored in the environment\n// variable corresponding to the given flag; if it isn't set or\n// doesn't represent a valid 32-bit integer, returns default_value.\nInt32 Int32FromGTestEnv(const char* flag, Int32 default_value) {\n  const std::string env_var = FlagToEnvVar(flag);\n  const char* const string_value = posix::GetEnv(env_var.c_str());\n  if (string_value == NULL) {\n    // The environment variable is not set.\n    return default_value;\n  }\n\n  Int32 result = default_value;\n  if (!ParseInt32(Message() << \"Environment variable \" << env_var,\n                  string_value, &result)) {\n    printf(\"The default value %s is used.\\n\",\n           (Message() << default_value).GetString().c_str());\n    fflush(stdout);\n    return default_value;\n  }\n\n  return result;\n}\n\n// Reads and returns the string environment variable corresponding to\n// the given flag; if it's not set, returns default_value.\nconst char* StringFromGTestEnv(const char* flag, const char* default_value) {\n  const std::string env_var = FlagToEnvVar(flag);\n  const char* const value = posix::GetEnv(env_var.c_str());\n  return value == NULL ? default_value : value;\n}\n\n}  // namespace internal\n}  // namespace testing\n// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Google Test - The Google C++ Testing Framework\n//\n// This file implements a universal value printer that can print a\n// value of any type T:\n//\n//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);\n//\n// It uses the << operator when possible, and prints the bytes in the\n// object otherwise.  A user can override its behavior for a class\n// type Foo by defining either operator<<(::std::ostream&, const Foo&)\n// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that\n// defines Foo.\n\n#include <ctype.h>\n#include <stdio.h>\n#include <ostream>  // NOLINT\n#include <string>\n\nnamespace testing {\n\nnamespace {\n\nusing ::std::ostream;\n\n// Prints a segment of bytes in the given object.\nvoid PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,\n                                size_t count, ostream* os) {\n  char text[5] = \"\";\n  for (size_t i = 0; i != count; i++) {\n    const size_t j = start + i;\n    if (i != 0) {\n      // Organizes the bytes into groups of 2 for easy parsing by\n      // human.\n      if ((j % 2) == 0)\n        *os << ' ';\n      else\n        *os << '-';\n    }\n    GTEST_SNPRINTF_(text, sizeof(text), \"%02X\", obj_bytes[j]);\n    *os << text;\n  }\n}\n\n// Prints the bytes in the given value to the given ostream.\nvoid PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,\n                              ostream* os) {\n  // Tells the user how big the object is.\n  *os << count << \"-byte object <\";\n\n  const size_t kThreshold = 132;\n  const size_t kChunkSize = 64;\n  // If the object size is bigger than kThreshold, we'll have to omit\n  // some details by printing only the first and the last kChunkSize\n  // bytes.\n  // TODO(wan): let the user control the threshold using a flag.\n  if (count < kThreshold) {\n    PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);\n  } else {\n    PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);\n    *os << \" ... \";\n    // Rounds up to 2-byte boundary.\n    const size_t resume_pos = (count - kChunkSize + 1)/2*2;\n    PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);\n  }\n  *os << \">\";\n}\n\n}  // namespace\n\nnamespace internal2 {\n\n// Delegates to PrintBytesInObjectToImpl() to print the bytes in the\n// given object.  The delegation simplifies the implementation, which\n// uses the << operator and thus is easier done outside of the\n// ::testing::internal namespace, which contains a << operator that\n// sometimes conflicts with the one in STL.\nvoid PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,\n                          ostream* os) {\n  PrintBytesInObjectToImpl(obj_bytes, count, os);\n}\n\n}  // namespace internal2\n\nnamespace internal {\n\n// Depending on the value of a char (or wchar_t), we print it in one\n// of three formats:\n//   - as is if it's a printable ASCII (e.g. 'a', '2', ' '),\n//   - as a hexidecimal escape sequence (e.g. '\\x7F'), or\n//   - as a special escape sequence (e.g. '\\r', '\\n').\nenum CharFormat {\n  kAsIs,\n  kHexEscape,\n  kSpecialEscape\n};\n\n// Returns true if c is a printable ASCII character.  We test the\n// value of c directly instead of calling isprint(), which is buggy on\n// Windows Mobile.\ninline bool IsPrintableAscii(wchar_t c) {\n  return 0x20 <= c && c <= 0x7E;\n}\n\n// Prints a wide or narrow char c as a character literal without the\n// quotes, escaping it when necessary; returns how c was formatted.\n// The template argument UnsignedChar is the unsigned version of Char,\n// which is the type of c.\ntemplate <typename UnsignedChar, typename Char>\nstatic CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {\n  switch (static_cast<wchar_t>(c)) {\n    case L'\\0':\n      *os << \"\\\\0\";\n      break;\n    case L'\\'':\n      *os << \"\\\\'\";\n      break;\n    case L'\\\\':\n      *os << \"\\\\\\\\\";\n      break;\n    case L'\\a':\n      *os << \"\\\\a\";\n      break;\n    case L'\\b':\n      *os << \"\\\\b\";\n      break;\n    case L'\\f':\n      *os << \"\\\\f\";\n      break;\n    case L'\\n':\n      *os << \"\\\\n\";\n      break;\n    case L'\\r':\n      *os << \"\\\\r\";\n      break;\n    case L'\\t':\n      *os << \"\\\\t\";\n      break;\n    case L'\\v':\n      *os << \"\\\\v\";\n      break;\n    default:\n      if (IsPrintableAscii(c)) {\n        *os << static_cast<char>(c);\n        return kAsIs;\n      } else {\n        *os << \"\\\\x\" + String::FormatHexInt(static_cast<UnsignedChar>(c));\n        return kHexEscape;\n      }\n  }\n  return kSpecialEscape;\n}\n\n// Prints a wchar_t c as if it's part of a string literal, escaping it when\n// necessary; returns how c was formatted.\nstatic CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {\n  switch (c) {\n    case L'\\'':\n      *os << \"'\";\n      return kAsIs;\n    case L'\"':\n      *os << \"\\\\\\\"\";\n      return kSpecialEscape;\n    default:\n      return PrintAsCharLiteralTo<wchar_t>(c, os);\n  }\n}\n\n// Prints a char c as if it's part of a string literal, escaping it when\n// necessary; returns how c was formatted.\nstatic CharFormat PrintAsStringLiteralTo(char c, ostream* os) {\n  return PrintAsStringLiteralTo(\n      static_cast<wchar_t>(static_cast<unsigned char>(c)), os);\n}\n\n// Prints a wide or narrow character c and its code.  '\\0' is printed\n// as \"'\\\\0'\", other unprintable characters are also properly escaped\n// using the standard C++ escape sequence.  The template argument\n// UnsignedChar is the unsigned version of Char, which is the type of c.\ntemplate <typename UnsignedChar, typename Char>\nvoid PrintCharAndCodeTo(Char c, ostream* os) {\n  // First, print c as a literal in the most readable form we can find.\n  *os << ((sizeof(c) > 1) ? \"L'\" : \"'\");\n  const CharFormat format = PrintAsCharLiteralTo<UnsignedChar>(c, os);\n  *os << \"'\";\n\n  // To aid user debugging, we also print c's code in decimal, unless\n  // it's 0 (in which case c was printed as '\\\\0', making the code\n  // obvious).\n  if (c == 0)\n    return;\n  *os << \" (\" << static_cast<int>(c);\n\n  // For more convenience, we print c's code again in hexidecimal,\n  // unless c was already printed in the form '\\x##' or the code is in\n  // [1, 9].\n  if (format == kHexEscape || (1 <= c && c <= 9)) {\n    // Do nothing.\n  } else {\n    *os << \", 0x\" << String::FormatHexInt(static_cast<UnsignedChar>(c));\n  }\n  *os << \")\";\n}\n\nvoid PrintTo(unsigned char c, ::std::ostream* os) {\n  PrintCharAndCodeTo<unsigned char>(c, os);\n}\nvoid PrintTo(signed char c, ::std::ostream* os) {\n  PrintCharAndCodeTo<unsigned char>(c, os);\n}\n\n// Prints a wchar_t as a symbol if it is printable or as its internal\n// code otherwise and also as its code.  L'\\0' is printed as \"L'\\\\0'\".\nvoid PrintTo(wchar_t wc, ostream* os) {\n  PrintCharAndCodeTo<wchar_t>(wc, os);\n}\n\n// Prints the given array of characters to the ostream.  CharType must be either\n// char or wchar_t.\n// The array starts at begin, the length is len, it may include '\\0' characters\n// and may not be NUL-terminated.\ntemplate <typename CharType>\nstatic void PrintCharsAsStringTo(\n    const CharType* begin, size_t len, ostream* os) {\n  const char* const kQuoteBegin = sizeof(CharType) == 1 ? \"\\\"\" : \"L\\\"\";\n  *os << kQuoteBegin;\n  bool is_previous_hex = false;\n  for (size_t index = 0; index < len; ++index) {\n    const CharType cur = begin[index];\n    if (is_previous_hex && IsXDigit(cur)) {\n      // Previous character is of '\\x..' form and this character can be\n      // interpreted as another hexadecimal digit in its number. Break string to\n      // disambiguate.\n      *os << \"\\\" \" << kQuoteBegin;\n    }\n    is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;\n  }\n  *os << \"\\\"\";\n}\n\n// Prints a (const) char/wchar_t array of 'len' elements, starting at address\n// 'begin'.  CharType must be either char or wchar_t.\ntemplate <typename CharType>\nstatic void UniversalPrintCharArray(\n    const CharType* begin, size_t len, ostream* os) {\n  // The code\n  //   const char kFoo[] = \"foo\";\n  // generates an array of 4, not 3, elements, with the last one being '\\0'.\n  //\n  // Therefore when printing a char array, we don't print the last element if\n  // it's '\\0', such that the output matches the string literal as it's\n  // written in the source code.\n  if (len > 0 && begin[len - 1] == '\\0') {\n    PrintCharsAsStringTo(begin, len - 1, os);\n    return;\n  }\n\n  // If, however, the last element in the array is not '\\0', e.g.\n  //    const char kFoo[] = { 'f', 'o', 'o' };\n  // we must print the entire array.  We also print a message to indicate\n  // that the array is not NUL-terminated.\n  PrintCharsAsStringTo(begin, len, os);\n  *os << \" (no terminating NUL)\";\n}\n\n// Prints a (const) char array of 'len' elements, starting at address 'begin'.\nvoid UniversalPrintArray(const char* begin, size_t len, ostream* os) {\n  UniversalPrintCharArray(begin, len, os);\n}\n\n// Prints a (const) wchar_t array of 'len' elements, starting at address\n// 'begin'.\nvoid UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {\n  UniversalPrintCharArray(begin, len, os);\n}\n\n// Prints the given C string to the ostream.\nvoid PrintTo(const char* s, ostream* os) {\n  if (s == NULL) {\n    *os << \"NULL\";\n  } else {\n    *os << ImplicitCast_<const void*>(s) << \" pointing to \";\n    PrintCharsAsStringTo(s, strlen(s), os);\n  }\n}\n\n// MSVC compiler can be configured to define whar_t as a typedef\n// of unsigned short. Defining an overload for const wchar_t* in that case\n// would cause pointers to unsigned shorts be printed as wide strings,\n// possibly accessing more memory than intended and causing invalid\n// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when\n// wchar_t is implemented as a native type.\n#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)\n// Prints the given wide C string to the ostream.\nvoid PrintTo(const wchar_t* s, ostream* os) {\n  if (s == NULL) {\n    *os << \"NULL\";\n  } else {\n    *os << ImplicitCast_<const void*>(s) << \" pointing to \";\n    PrintCharsAsStringTo(s, wcslen(s), os);\n  }\n}\n#endif  // wchar_t is native\n\n// Prints a ::string object.\n#if GTEST_HAS_GLOBAL_STRING\nvoid PrintStringTo(const ::string& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n#endif  // GTEST_HAS_GLOBAL_STRING\n\nvoid PrintStringTo(const ::std::string& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n\n// Prints a ::wstring object.\n#if GTEST_HAS_GLOBAL_WSTRING\nvoid PrintWideStringTo(const ::wstring& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n#if GTEST_HAS_STD_WSTRING\nvoid PrintWideStringTo(const ::std::wstring& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n}  // namespace internal\n\n}  // namespace testing\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n// The Google C++ Testing Framework (Google Test)\n\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\n\nusing internal::GetUnitTestImpl;\n\n// Gets the summary of the failure message by omitting the stack trace\n// in it.\nstd::string TestPartResult::ExtractSummary(const char* message) {\n  const char* const stack_trace = strstr(message, internal::kStackTraceMarker);\n  return stack_trace == NULL ? message :\n      std::string(message, stack_trace);\n}\n\n// Prints a TestPartResult object.\nstd::ostream& operator<<(std::ostream& os, const TestPartResult& result) {\n  return os\n      << result.file_name() << \":\" << result.line_number() << \": \"\n      << (result.type() == TestPartResult::kSuccess ? \"Success\" :\n          result.type() == TestPartResult::kFatalFailure ? \"Fatal failure\" :\n          \"Non-fatal failure\") << \":\\n\"\n      << result.message() << std::endl;\n}\n\n// Appends a TestPartResult to the array.\nvoid TestPartResultArray::Append(const TestPartResult& result) {\n  array_.push_back(result);\n}\n\n// Returns the TestPartResult at the given index (0-based).\nconst TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {\n  if (index < 0 || index >= size()) {\n    printf(\"\\nInvalid index (%d) into TestPartResultArray.\\n\", index);\n    internal::posix::Abort();\n  }\n\n  return array_[index];\n}\n\n// Returns the number of TestPartResult objects in the array.\nint TestPartResultArray::size() const {\n  return static_cast<int>(array_.size());\n}\n\nnamespace internal {\n\nHasNewFatalFailureHelper::HasNewFatalFailureHelper()\n    : has_new_fatal_failure_(false),\n      original_reporter_(GetUnitTestImpl()->\n                         GetTestPartResultReporterForCurrentThread()) {\n  GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);\n}\n\nHasNewFatalFailureHelper::~HasNewFatalFailureHelper() {\n  GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(\n      original_reporter_);\n}\n\nvoid HasNewFatalFailureHelper::ReportTestPartResult(\n    const TestPartResult& result) {\n  if (result.fatally_failed())\n    has_new_fatal_failure_ = true;\n  original_reporter_->ReportTestPartResult(result);\n}\n\n}  // namespace internal\n\n}  // namespace testing\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n\nnamespace testing {\nnamespace internal {\n\n#if GTEST_HAS_TYPED_TEST_P\n\n// Skips to the first non-space char in str. Returns an empty string if str\n// contains only whitespace characters.\nstatic const char* SkipSpaces(const char* str) {\n  while (IsSpace(*str))\n    str++;\n  return str;\n}\n\n// Verifies that registered_tests match the test names in\n// defined_test_names_; returns registered_tests if successful, or\n// aborts the program otherwise.\nconst char* TypedTestCasePState::VerifyRegisteredTestNames(\n    const char* file, int line, const char* registered_tests) {\n  typedef ::std::set<const char*>::const_iterator DefinedTestIter;\n  registered_ = true;\n\n  // Skip initial whitespace in registered_tests since some\n  // preprocessors prefix stringizied literals with whitespace.\n  registered_tests = SkipSpaces(registered_tests);\n\n  Message errors;\n  ::std::set<std::string> tests;\n  for (const char* names = registered_tests; names != NULL;\n       names = SkipComma(names)) {\n    const std::string name = GetPrefixUntilComma(names);\n    if (tests.count(name) != 0) {\n      errors << \"Test \" << name << \" is listed more than once.\\n\";\n      continue;\n    }\n\n    bool found = false;\n    for (DefinedTestIter it = defined_test_names_.begin();\n         it != defined_test_names_.end();\n         ++it) {\n      if (name == *it) {\n        found = true;\n        break;\n      }\n    }\n\n    if (found) {\n      tests.insert(name);\n    } else {\n      errors << \"No test named \" << name\n             << \" can be found in this test case.\\n\";\n    }\n  }\n\n  for (DefinedTestIter it = defined_test_names_.begin();\n       it != defined_test_names_.end();\n       ++it) {\n    if (tests.count(*it) == 0) {\n      errors << \"You forgot to list test \" << *it << \".\\n\";\n    }\n  }\n\n  const std::string& errors_str = errors.GetString();\n  if (errors_str != \"\") {\n    fprintf(stderr, \"%s %s\", FormatFileLocation(file, line).c_str(),\n            errors_str.c_str());\n    fflush(stderr);\n    posix::Abort();\n  }\n\n  return registered_tests;\n}\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/fused-src/gtest/gtest.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines the public API for Google Test.  It should be\n// included by any test program that uses Google Test.\n//\n// IMPORTANT NOTE: Due to limitation of the C++ language, we have to\n// leave some internal implementation details in this header file.\n// They are clearly marked by comments like this:\n//\n//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n//\n// Such code is NOT meant to be used by a user directly, and is subject\n// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user\n// program!\n//\n// Acknowledgment: Google Test borrowed the idea of automatic test\n// registration from Barthelemy Dagenais' (barthelemy@prologique.com)\n// easyUnit framework.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_H_\n\n#include <limits>\n#include <ostream>\n#include <vector>\n\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file declares functions and macros used internally by\n// Google Test.  They are subject to change without notice.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_\n\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan)\n//\n// Low-level types and utilities for porting Google Test to various\n// platforms.  They are subject to change without notice.  DO NOT USE\n// THEM IN USER CODE.\n//\n// This file is fundamental to Google Test.  All other Google Test source\n// files are expected to #include this.  Therefore, it cannot #include\n// any other Google Test header.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_\n\n// The user can define the following macros in the build script to\n// control Google Test's behavior.  If the user doesn't define a macro\n// in this list, Google Test will define it.\n//\n//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)\n//                              is/isn't available.\n//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions\n//                              are enabled.\n//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string\n//                              is/isn't available (some systems define\n//                              ::string, which is different to std::string).\n//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string\n//                              is/isn't available (some systems define\n//                              ::wstring, which is different to std::wstring).\n//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular\n//                              expressions are/aren't available.\n//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>\n//                              is/isn't available.\n//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't\n//                              enabled.\n//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that\n//                              std::wstring does/doesn't work (Google Test can\n//                              be used where std::wstring is unavailable).\n//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple\n//                              is/isn't available.\n//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the\n//                              compiler supports Microsoft's \"Structured\n//                              Exception Handling\".\n//   GTEST_HAS_STREAM_REDIRECTION\n//                            - Define it to 1/0 to indicate whether the\n//                              platform supports I/O stream redirection using\n//                              dup() and dup2().\n//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google\n//                              Test's own tr1 tuple implementation should be\n//                              used.  Unused when the user sets\n//                              GTEST_HAS_TR1_TUPLE to 0.\n//   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test\n//                              is building in C++11/C++98 mode.\n//   GTEST_LINKED_AS_SHARED_LIBRARY\n//                            - Define to 1 when compiling tests that use\n//                              Google Test as a shared library (known as\n//                              DLL on Windows).\n//   GTEST_CREATE_SHARED_LIBRARY\n//                            - Define to 1 when compiling Google Test itself\n//                              as a shared library.\n\n// This header defines the following utilities:\n//\n// Macros indicating the current platform (defined to 1 if compiled on\n// the given platform; otherwise undefined):\n//   GTEST_OS_AIX      - IBM AIX\n//   GTEST_OS_CYGWIN   - Cygwin\n//   GTEST_OS_HPUX     - HP-UX\n//   GTEST_OS_LINUX    - Linux\n//     GTEST_OS_LINUX_ANDROID - Google Android\n//   GTEST_OS_MAC      - Mac OS X\n//     GTEST_OS_IOS    - iOS\n//       GTEST_OS_IOS_SIMULATOR - iOS simulator\n//   GTEST_OS_NACL     - Google Native Client (NaCl)\n//   GTEST_OS_OPENBSD  - OpenBSD\n//   GTEST_OS_QNX      - QNX\n//   GTEST_OS_SOLARIS  - Sun Solaris\n//   GTEST_OS_SYMBIAN  - Symbian\n//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)\n//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop\n//     GTEST_OS_WINDOWS_MINGW    - MinGW\n//     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile\n//   GTEST_OS_ZOS      - z/OS\n//\n// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the\n// most stable support.  Since core members of the Google Test project\n// don't have access to other platforms, support for them may be less\n// stable.  If you notice any problems on your platform, please notify\n// googletestframework@googlegroups.com (patches for fixing them are\n// even more welcome!).\n//\n// Note that it is possible that none of the GTEST_OS_* macros are defined.\n//\n// Macros indicating available Google Test features (defined to 1 if\n// the corresponding feature is supported; otherwise undefined):\n//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized\n//                            tests)\n//   GTEST_HAS_DEATH_TEST   - death tests\n//   GTEST_HAS_PARAM_TEST   - value-parameterized tests\n//   GTEST_HAS_TYPED_TEST   - typed tests\n//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests\n//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with\n//                            GTEST_HAS_POSIX_RE (see above) which users can\n//                            define themselves.\n//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;\n//                            the above two are mutually exclusive.\n//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().\n//\n// Macros for basic C++ coding:\n//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.\n//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a\n//                              variable don't have to be used.\n//   GTEST_DISALLOW_ASSIGN_   - disables operator=.\n//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.\n//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.\n//\n// Synchronization:\n//   Mutex, MutexLock, ThreadLocal, GetThreadCount()\n//                  - synchronization primitives.\n//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above\n//                         synchronization primitives have real implementations\n//                         and Google Test is thread-safe; or 0 otherwise.\n//\n// Template meta programming:\n//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.\n//   IteratorTraits - partial implementation of std::iterator_traits, which\n//                    is not available in libCstd when compiled with Sun C++.\n//\n// Smart pointers:\n//   scoped_ptr     - as in TR2.\n//\n// Regular expressions:\n//   RE             - a simple regular expression class using the POSIX\n//                    Extended Regular Expression syntax on UNIX-like\n//                    platforms, or a reduced regular exception syntax on\n//                    other platforms, including Windows.\n//\n// Logging:\n//   GTEST_LOG_()   - logs messages at the specified severity level.\n//   LogToStderr()  - directs all log messages to stderr.\n//   FlushInfoLog() - flushes informational log messages.\n//\n// Stdout and stderr capturing:\n//   CaptureStdout()     - starts capturing stdout.\n//   GetCapturedStdout() - stops capturing stdout and returns the captured\n//                         string.\n//   CaptureStderr()     - starts capturing stderr.\n//   GetCapturedStderr() - stops capturing stderr and returns the captured\n//                         string.\n//\n// Integer types:\n//   TypeWithSize   - maps an integer to a int type.\n//   Int32, UInt32, Int64, UInt64, TimeInMillis\n//                  - integers of known sizes.\n//   BiggestInt     - the biggest signed integer type.\n//\n// Command-line utilities:\n//   GTEST_FLAG()       - references a flag.\n//   GTEST_DECLARE_*()  - declares a flag.\n//   GTEST_DEFINE_*()   - defines a flag.\n//   GetInjectableArgvs() - returns the command line as a vector of strings.\n//\n// Environment variable utilities:\n//   GetEnv()             - gets the value of an environment variable.\n//   BoolFromGTestEnv()   - parses a bool environment variable.\n//   Int32FromGTestEnv()  - parses an Int32 environment variable.\n//   StringFromGTestEnv() - parses a string environment variable.\n\n#include <ctype.h>   // for isspace, etc\n#include <stddef.h>  // for ptrdiff_t\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#ifndef _WIN32_WCE\n# include <sys/types.h>\n# include <sys/stat.h>\n#endif  // !_WIN32_WCE\n\n#if defined __APPLE__\n# include <AvailabilityMacros.h>\n# include <TargetConditionals.h>\n#endif\n\n#include <iostream>  // NOLINT\n#include <sstream>  // NOLINT\n#include <string>  // NOLINT\n\n#define GTEST_DEV_EMAIL_ \"googletestframework@@googlegroups.com\"\n#define GTEST_FLAG_PREFIX_ \"gtest_\"\n#define GTEST_FLAG_PREFIX_DASH_ \"gtest-\"\n#define GTEST_FLAG_PREFIX_UPPER_ \"GTEST_\"\n#define GTEST_NAME_ \"Google Test\"\n#define GTEST_PROJECT_URL_ \"http://code.google.com/p/googletest/\"\n\n// Determines the version of gcc that is used to compile this.\n#ifdef __GNUC__\n// 40302 means version 4.3.2.\n# define GTEST_GCC_VER_ \\\n    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)\n#endif  // __GNUC__\n\n// Determines the platform on which Google Test is compiled.\n#ifdef __CYGWIN__\n# define GTEST_OS_CYGWIN 1\n#elif defined __SYMBIAN32__\n# define GTEST_OS_SYMBIAN 1\n#elif defined _WIN32\n# define GTEST_OS_WINDOWS 1\n# ifdef _WIN32_WCE\n#  define GTEST_OS_WINDOWS_MOBILE 1\n# elif defined(__MINGW__) || defined(__MINGW32__)\n#  define GTEST_OS_WINDOWS_MINGW 1\n# else\n#  define GTEST_OS_WINDOWS_DESKTOP 1\n# endif  // _WIN32_WCE\n#elif defined __APPLE__\n# define GTEST_OS_MAC 1\n# if TARGET_OS_IPHONE\n#  define GTEST_OS_IOS 1\n#  if TARGET_IPHONE_SIMULATOR\n#   define GTEST_OS_IOS_SIMULATOR 1\n#  endif\n# endif\n#elif defined __linux__\n# define GTEST_OS_LINUX 1\n# if defined __ANDROID__\n#  define GTEST_OS_LINUX_ANDROID 1\n# endif\n#elif defined __MVS__\n# define GTEST_OS_ZOS 1\n#elif defined(__sun) && defined(__SVR4)\n# define GTEST_OS_SOLARIS 1\n#elif defined(_AIX)\n# define GTEST_OS_AIX 1\n#elif defined(__hpux)\n# define GTEST_OS_HPUX 1\n#elif defined __native_client__\n# define GTEST_OS_NACL 1\n#elif defined __OpenBSD__\n# define GTEST_OS_OPENBSD 1\n#elif defined __QNX__\n# define GTEST_OS_QNX 1\n#endif  // __CYGWIN__\n\n#ifndef GTEST_LANG_CXX11\n// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when\n// -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a\n// value for __cplusplus, and recent versions of clang, gcc, and\n// probably other compilers set that too in C++11 mode.\n# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L\n// Compiling in at least C++11 mode.\n#  define GTEST_LANG_CXX11 1\n# else\n#  define GTEST_LANG_CXX11 0\n# endif\n#endif\n\n// Brings in definitions for functions used in the testing::internal::posix\n// namespace (read, write, close, chdir, isatty, stat). We do not currently\n// use them on Windows Mobile.\n#if !GTEST_OS_WINDOWS\n// This assumes that non-Windows OSes provide unistd.h. For OSes where this\n// is not the case, we need to include headers that provide the functions\n// mentioned above.\n# include <unistd.h>\n# include <strings.h>\n#elif !GTEST_OS_WINDOWS_MOBILE\n# include <direct.h>\n# include <io.h>\n#endif\n\n#if GTEST_OS_LINUX_ANDROID\n// Used to define __ANDROID_API__ matching the target NDK API level.\n#  include <android/api-level.h>  // NOLINT\n#endif\n\n// Defines this to true iff Google Test can use POSIX regular expressions.\n#ifndef GTEST_HAS_POSIX_RE\n# if GTEST_OS_LINUX_ANDROID\n// On Android, <regex.h> is only available starting with Gingerbread.\n#  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)\n# else\n#  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)\n# endif\n#endif\n\n#if GTEST_HAS_POSIX_RE\n\n// On some platforms, <regex.h> needs someone to define size_t, and\n// won't compile otherwise.  We can #include it here as we already\n// included <stdlib.h>, which is guaranteed to define size_t through\n// <stddef.h>.\n# include <regex.h>  // NOLINT\n\n# define GTEST_USES_POSIX_RE 1\n\n#elif GTEST_OS_WINDOWS\n\n// <regex.h> is not available on Windows.  Use our own simple regex\n// implementation instead.\n# define GTEST_USES_SIMPLE_RE 1\n\n#else\n\n// <regex.h> may not be available on this platform.  Use our own\n// simple regex implementation instead.\n# define GTEST_USES_SIMPLE_RE 1\n\n#endif  // GTEST_HAS_POSIX_RE\n\n#ifndef GTEST_HAS_EXCEPTIONS\n// The user didn't tell us whether exceptions are enabled, so we need\n// to figure it out.\n# if defined(_MSC_VER) || defined(__BORLANDC__)\n// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS\n// macro to enable exceptions, so we'll do the same.\n// Assumes that exceptions are enabled by default.\n#  ifndef _HAS_EXCEPTIONS\n#   define _HAS_EXCEPTIONS 1\n#  endif  // _HAS_EXCEPTIONS\n#  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS\n# elif defined(__GNUC__) && __EXCEPTIONS\n// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.\n#  define GTEST_HAS_EXCEPTIONS 1\n# elif defined(__SUNPRO_CC)\n// Sun Pro CC supports exceptions.  However, there is no compile-time way of\n// detecting whether they are enabled or not.  Therefore, we assume that\n// they are enabled unless the user tells us otherwise.\n#  define GTEST_HAS_EXCEPTIONS 1\n# elif defined(__IBMCPP__) && __EXCEPTIONS\n// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.\n#  define GTEST_HAS_EXCEPTIONS 1\n# elif defined(__HP_aCC)\n// Exception handling is in effect by default in HP aCC compiler. It has to\n// be turned of by +noeh compiler option if desired.\n#  define GTEST_HAS_EXCEPTIONS 1\n# else\n// For other compilers, we assume exceptions are disabled to be\n// conservative.\n#  define GTEST_HAS_EXCEPTIONS 0\n# endif  // defined(_MSC_VER) || defined(__BORLANDC__)\n#endif  // GTEST_HAS_EXCEPTIONS\n\n#if !defined(GTEST_HAS_STD_STRING)\n// Even though we don't use this macro any longer, we keep it in case\n// some clients still depend on it.\n# define GTEST_HAS_STD_STRING 1\n#elif !GTEST_HAS_STD_STRING\n// The user told us that ::std::string isn't available.\n# error \"Google Test cannot be used where ::std::string isn't available.\"\n#endif  // !defined(GTEST_HAS_STD_STRING)\n\n#ifndef GTEST_HAS_GLOBAL_STRING\n// The user didn't tell us whether ::string is available, so we need\n// to figure it out.\n\n# define GTEST_HAS_GLOBAL_STRING 0\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n#ifndef GTEST_HAS_STD_WSTRING\n// The user didn't tell us whether ::std::wstring is available, so we need\n// to figure it out.\n// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring\n//   is available.\n\n// Cygwin 1.7 and below doesn't support ::std::wstring.\n// Solaris' libc++ doesn't support it either.  Android has\n// no support for it at least as recent as Froyo (2.2).\n# define GTEST_HAS_STD_WSTRING \\\n    (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))\n\n#endif  // GTEST_HAS_STD_WSTRING\n\n#ifndef GTEST_HAS_GLOBAL_WSTRING\n// The user didn't tell us whether ::wstring is available, so we need\n// to figure it out.\n# define GTEST_HAS_GLOBAL_WSTRING \\\n    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// Determines whether RTTI is available.\n#ifndef GTEST_HAS_RTTI\n// The user didn't tell us whether RTTI is enabled, so we need to\n// figure it out.\n\n# ifdef _MSC_VER\n\n#  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.\n#   define GTEST_HAS_RTTI 1\n#  else\n#   define GTEST_HAS_RTTI 0\n#  endif\n\n// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.\n# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)\n\n#  ifdef __GXX_RTTI\n// When building against STLport with the Android NDK and with\n// -frtti -fno-exceptions, the build fails at link time with undefined\n// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,\n// so disable RTTI when detected.\n#   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \\\n       !defined(__EXCEPTIONS)\n#    define GTEST_HAS_RTTI 0\n#   else\n#    define GTEST_HAS_RTTI 1\n#   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS\n#  else\n#   define GTEST_HAS_RTTI 0\n#  endif  // __GXX_RTTI\n\n// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends\n// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the\n// first version with C++ support.\n# elif defined(__clang__)\n\n#  define GTEST_HAS_RTTI __has_feature(cxx_rtti)\n\n// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if\n// both the typeid and dynamic_cast features are present.\n# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)\n\n#  ifdef __RTTI_ALL__\n#   define GTEST_HAS_RTTI 1\n#  else\n#   define GTEST_HAS_RTTI 0\n#  endif\n\n# else\n\n// For all other compilers, we assume RTTI is enabled.\n#  define GTEST_HAS_RTTI 1\n\n# endif  // _MSC_VER\n\n#endif  // GTEST_HAS_RTTI\n\n// It's this header's responsibility to #include <typeinfo> when RTTI\n// is enabled.\n#if GTEST_HAS_RTTI\n# include <typeinfo>\n#endif\n\n// Determines whether Google Test can use the pthreads library.\n#ifndef GTEST_HAS_PTHREAD\n// The user didn't tell us explicitly, so we assume pthreads support is\n// available on Linux and Mac.\n//\n// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0\n// to your compiler flags.\n# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \\\n    || GTEST_OS_QNX)\n#endif  // GTEST_HAS_PTHREAD\n\n#if GTEST_HAS_PTHREAD\n// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is\n// true.\n# include <pthread.h>  // NOLINT\n\n// For timespec and nanosleep, used below.\n# include <time.h>  // NOLINT\n#endif\n\n// Determines whether Google Test can use tr1/tuple.  You can define\n// this macro to 0 to prevent Google Test from using tuple (any\n// feature depending on tuple with be disabled in this mode).\n#ifndef GTEST_HAS_TR1_TUPLE\n# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)\n// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.\n#  define GTEST_HAS_TR1_TUPLE 0\n# else\n// The user didn't tell us not to do it, so we assume it's OK.\n#  define GTEST_HAS_TR1_TUPLE 1\n# endif\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Determines whether Google Test's own tr1 tuple implementation\n// should be used.\n#ifndef GTEST_USE_OWN_TR1_TUPLE\n// The user didn't tell us, so we need to figure it out.\n\n// We use our own TR1 tuple if we aren't sure the user has an\n// implementation of it already.  At this time, libstdc++ 4.0.0+ and\n// MSVC 2010 are the only mainstream standard libraries that come\n// with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler\n// pretends to be GCC by defining __GNUC__ and friends, but cannot\n// compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1\n// tuple in a 323 MB Feature Pack download, which we cannot assume the\n// user has.  QNX's QCC compiler is a modified GCC but it doesn't\n// support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,\n// and it can be used with some compilers that define __GNUC__.\n# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \\\n      && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600\n#  define GTEST_ENV_HAS_TR1_TUPLE_ 1\n# endif\n\n// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used\n// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6\n// can build with clang but need to use gcc4.2's libstdc++).\n# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)\n#  define GTEST_ENV_HAS_STD_TUPLE_ 1\n# endif\n\n# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_\n#  define GTEST_USE_OWN_TR1_TUPLE 0\n# else\n#  define GTEST_USE_OWN_TR1_TUPLE 1\n# endif\n\n#endif  // GTEST_USE_OWN_TR1_TUPLE\n\n// To avoid conditional compilation everywhere, we make it\n// gtest-port.h's responsibility to #include the header implementing\n// tr1/tuple.\n#if GTEST_HAS_TR1_TUPLE\n\n# if GTEST_USE_OWN_TR1_TUPLE\n// This file was GENERATED by command:\n//     pump.py gtest-tuple.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2009 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Implements a subset of TR1 tuple needed by Google Test and Google Mock.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n\n#include <utility>  // For ::std::pair.\n\n// The compiler used in Symbian has a bug that prevents us from declaring the\n// tuple template as a friend (it complains that tuple is redefined).  This\n// hack bypasses the bug by declaring the members that should otherwise be\n// private as public.\n// Sun Studio versions < 12 also have the above bug.\n#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)\n# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:\n#else\n# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \\\n    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \\\n   private:\n#endif\n\n// GTEST_n_TUPLE_(T) is the type of an n-tuple.\n#define GTEST_0_TUPLE_(T) tuple<>\n#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \\\n    void, void, void>\n#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \\\n    void, void, void>\n#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \\\n    void, void, void>\n#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \\\n    void, void, void>\n#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \\\n    void, void, void>\n#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \\\n    void, void, void>\n#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    void, void, void>\n#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    T##7, void, void>\n#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    T##7, T##8, void>\n#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    T##7, T##8, T##9>\n\n// GTEST_n_TYPENAMES_(T) declares a list of n typenames.\n#define GTEST_0_TYPENAMES_(T)\n#define GTEST_1_TYPENAMES_(T) typename T##0\n#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1\n#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2\n#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3\n#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4\n#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5\n#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6\n#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7\n#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6, \\\n    typename T##7, typename T##8\n#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6, \\\n    typename T##7, typename T##8, typename T##9\n\n// In theory, defining stuff in the ::std namespace is undefined\n// behavior.  We can do this as we are playing the role of a standard\n// library vendor.\nnamespace std {\nnamespace tr1 {\n\ntemplate <typename T0 = void, typename T1 = void, typename T2 = void,\n    typename T3 = void, typename T4 = void, typename T5 = void,\n    typename T6 = void, typename T7 = void, typename T8 = void,\n    typename T9 = void>\nclass tuple;\n\n// Anything in namespace gtest_internal is Google Test's INTERNAL\n// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.\nnamespace gtest_internal {\n\n// ByRef<T>::type is T if T is a reference; otherwise it's const T&.\ntemplate <typename T>\nstruct ByRef { typedef const T& type; };  // NOLINT\ntemplate <typename T>\nstruct ByRef<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper for ByRef.\n#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type\n\n// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This\n// is the same as tr1::add_reference<T>::type.\ntemplate <typename T>\nstruct AddRef { typedef T& type; };  // NOLINT\ntemplate <typename T>\nstruct AddRef<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper for AddRef.\n#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type\n\n// A helper for implementing get<k>().\ntemplate <int k> class Get;\n\n// A helper for implementing tuple_element<k, T>.  kIndexValid is true\n// iff k < the number of fields in tuple type T.\ntemplate <bool kIndexValid, int kIndex, class Tuple>\nstruct TupleElement;\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {\n  typedef T0 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {\n  typedef T1 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {\n  typedef T2 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {\n  typedef T3 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {\n  typedef T4 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {\n  typedef T5 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {\n  typedef T6 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {\n  typedef T7 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {\n  typedef T8 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {\n  typedef T9 type;\n};\n\n}  // namespace gtest_internal\n\ntemplate <>\nclass tuple<> {\n public:\n  tuple() {}\n  tuple(const tuple& /* t */)  {}\n  tuple& operator=(const tuple& /* t */) { return *this; }\n};\n\ntemplate <GTEST_1_TYPENAMES_(T)>\nclass GTEST_1_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}\n\n  tuple(const tuple& t) : f0_(t.f0_) {}\n\n  template <GTEST_1_TYPENAMES_(U)>\n  tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_1_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_1_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_1_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    return *this;\n  }\n\n  T0 f0_;\n};\n\ntemplate <GTEST_2_TYPENAMES_(T)>\nclass GTEST_2_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),\n      f1_(f1) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}\n\n  template <GTEST_2_TYPENAMES_(U)>\n  tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}\n  template <typename U0, typename U1>\n  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_2_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_2_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n  template <typename U0, typename U1>\n  tuple& operator=(const ::std::pair<U0, U1>& p) {\n    f0_ = p.first;\n    f1_ = p.second;\n    return *this;\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_2_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n};\n\ntemplate <GTEST_3_TYPENAMES_(T)>\nclass GTEST_3_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}\n\n  template <GTEST_3_TYPENAMES_(U)>\n  tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_3_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_3_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_3_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n};\n\ntemplate <GTEST_4_TYPENAMES_(T)>\nclass GTEST_4_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),\n      f3_(f3) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}\n\n  template <GTEST_4_TYPENAMES_(U)>\n  tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_4_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_4_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_4_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n};\n\ntemplate <GTEST_5_TYPENAMES_(T)>\nclass GTEST_5_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,\n      GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_) {}\n\n  template <GTEST_5_TYPENAMES_(U)>\n  tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_5_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_5_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_5_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n};\n\ntemplate <GTEST_6_TYPENAMES_(T)>\nclass GTEST_6_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),\n      f5_(f5) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_) {}\n\n  template <GTEST_6_TYPENAMES_(U)>\n  tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_6_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_6_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_6_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n};\n\ntemplate <GTEST_7_TYPENAMES_(T)>\nclass GTEST_7_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),\n      f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}\n\n  template <GTEST_7_TYPENAMES_(U)>\n  tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_7_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_7_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_7_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n};\n\ntemplate <GTEST_8_TYPENAMES_(T)>\nclass GTEST_8_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,\n      GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),\n      f5_(f5), f6_(f6), f7_(f7) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}\n\n  template <GTEST_8_TYPENAMES_(U)>\n  tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_8_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_8_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_8_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    f7_ = t.f7_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n  T7 f7_;\n};\n\ntemplate <GTEST_9_TYPENAMES_(T)>\nclass GTEST_9_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,\n      GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),\n      f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}\n\n  template <GTEST_9_TYPENAMES_(U)>\n  tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_9_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_9_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_9_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    f7_ = t.f7_;\n    f8_ = t.f8_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n  T7 f7_;\n  T8 f8_;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nclass tuple {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),\n      f9_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,\n      GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),\n      f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}\n\n  template <GTEST_10_TYPENAMES_(U)>\n  tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),\n      f9_(t.f9_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_10_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_10_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_10_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    f7_ = t.f7_;\n    f8_ = t.f8_;\n    f9_ = t.f9_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n  T7 f7_;\n  T8 f8_;\n  T9 f9_;\n};\n\n// 6.1.3.2 Tuple creation functions.\n\n// Known limitations: we don't support passing an\n// std::tr1::reference_wrapper<T> to make_tuple().  And we don't\n// implement tie().\n\ninline tuple<> make_tuple() { return tuple<>(); }\n\ntemplate <GTEST_1_TYPENAMES_(T)>\ninline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {\n  return GTEST_1_TUPLE_(T)(f0);\n}\n\ntemplate <GTEST_2_TYPENAMES_(T)>\ninline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {\n  return GTEST_2_TUPLE_(T)(f0, f1);\n}\n\ntemplate <GTEST_3_TYPENAMES_(T)>\ninline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {\n  return GTEST_3_TUPLE_(T)(f0, f1, f2);\n}\n\ntemplate <GTEST_4_TYPENAMES_(T)>\ninline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3) {\n  return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);\n}\n\ntemplate <GTEST_5_TYPENAMES_(T)>\ninline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4) {\n  return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);\n}\n\ntemplate <GTEST_6_TYPENAMES_(T)>\ninline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5) {\n  return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);\n}\n\ntemplate <GTEST_7_TYPENAMES_(T)>\ninline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6) {\n  return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);\n}\n\ntemplate <GTEST_8_TYPENAMES_(T)>\ninline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {\n  return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);\n}\n\ntemplate <GTEST_9_TYPENAMES_(T)>\ninline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,\n    const T8& f8) {\n  return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);\n}\n\ntemplate <GTEST_10_TYPENAMES_(T)>\ninline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,\n    const T8& f8, const T9& f9) {\n  return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);\n}\n\n// 6.1.3.3 Tuple helper classes.\n\ntemplate <typename Tuple> struct tuple_size;\n\ntemplate <GTEST_0_TYPENAMES_(T)>\nstruct tuple_size<GTEST_0_TUPLE_(T) > {\n  static const int value = 0;\n};\n\ntemplate <GTEST_1_TYPENAMES_(T)>\nstruct tuple_size<GTEST_1_TUPLE_(T) > {\n  static const int value = 1;\n};\n\ntemplate <GTEST_2_TYPENAMES_(T)>\nstruct tuple_size<GTEST_2_TUPLE_(T) > {\n  static const int value = 2;\n};\n\ntemplate <GTEST_3_TYPENAMES_(T)>\nstruct tuple_size<GTEST_3_TUPLE_(T) > {\n  static const int value = 3;\n};\n\ntemplate <GTEST_4_TYPENAMES_(T)>\nstruct tuple_size<GTEST_4_TUPLE_(T) > {\n  static const int value = 4;\n};\n\ntemplate <GTEST_5_TYPENAMES_(T)>\nstruct tuple_size<GTEST_5_TUPLE_(T) > {\n  static const int value = 5;\n};\n\ntemplate <GTEST_6_TYPENAMES_(T)>\nstruct tuple_size<GTEST_6_TUPLE_(T) > {\n  static const int value = 6;\n};\n\ntemplate <GTEST_7_TYPENAMES_(T)>\nstruct tuple_size<GTEST_7_TUPLE_(T) > {\n  static const int value = 7;\n};\n\ntemplate <GTEST_8_TYPENAMES_(T)>\nstruct tuple_size<GTEST_8_TUPLE_(T) > {\n  static const int value = 8;\n};\n\ntemplate <GTEST_9_TYPENAMES_(T)>\nstruct tuple_size<GTEST_9_TUPLE_(T) > {\n  static const int value = 9;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct tuple_size<GTEST_10_TUPLE_(T) > {\n  static const int value = 10;\n};\n\ntemplate <int k, class Tuple>\nstruct tuple_element {\n  typedef typename gtest_internal::TupleElement<\n      k < (tuple_size<Tuple>::value), k, Tuple>::type type;\n};\n\n#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type\n\n// 6.1.3.4 Element access.\n\nnamespace gtest_internal {\n\ntemplate <>\nclass Get<0> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))\n  Field(Tuple& t) { return t.f0_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))\n  ConstField(const Tuple& t) { return t.f0_; }\n};\n\ntemplate <>\nclass Get<1> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))\n  Field(Tuple& t) { return t.f1_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))\n  ConstField(const Tuple& t) { return t.f1_; }\n};\n\ntemplate <>\nclass Get<2> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))\n  Field(Tuple& t) { return t.f2_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))\n  ConstField(const Tuple& t) { return t.f2_; }\n};\n\ntemplate <>\nclass Get<3> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))\n  Field(Tuple& t) { return t.f3_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))\n  ConstField(const Tuple& t) { return t.f3_; }\n};\n\ntemplate <>\nclass Get<4> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))\n  Field(Tuple& t) { return t.f4_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))\n  ConstField(const Tuple& t) { return t.f4_; }\n};\n\ntemplate <>\nclass Get<5> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))\n  Field(Tuple& t) { return t.f5_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))\n  ConstField(const Tuple& t) { return t.f5_; }\n};\n\ntemplate <>\nclass Get<6> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))\n  Field(Tuple& t) { return t.f6_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))\n  ConstField(const Tuple& t) { return t.f6_; }\n};\n\ntemplate <>\nclass Get<7> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))\n  Field(Tuple& t) { return t.f7_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))\n  ConstField(const Tuple& t) { return t.f7_; }\n};\n\ntemplate <>\nclass Get<8> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))\n  Field(Tuple& t) { return t.f8_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))\n  ConstField(const Tuple& t) { return t.f8_; }\n};\n\ntemplate <>\nclass Get<9> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))\n  Field(Tuple& t) { return t.f9_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))\n  ConstField(const Tuple& t) { return t.f9_; }\n};\n\n}  // namespace gtest_internal\n\ntemplate <int k, GTEST_10_TYPENAMES_(T)>\nGTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))\nget(GTEST_10_TUPLE_(T)& t) {\n  return gtest_internal::Get<k>::Field(t);\n}\n\ntemplate <int k, GTEST_10_TYPENAMES_(T)>\nGTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))\nget(const GTEST_10_TUPLE_(T)& t) {\n  return gtest_internal::Get<k>::ConstField(t);\n}\n\n// 6.1.3.5 Relational operators\n\n// We only implement == and !=, as we don't have a need for the rest yet.\n\nnamespace gtest_internal {\n\n// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the\n// first k fields of t1 equals the first k fields of t2.\n// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if\n// k1 != k2.\ntemplate <int kSize1, int kSize2>\nstruct SameSizeTuplePrefixComparator;\n\ntemplate <>\nstruct SameSizeTuplePrefixComparator<0, 0> {\n  template <class Tuple1, class Tuple2>\n  static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {\n    return true;\n  }\n};\n\ntemplate <int k>\nstruct SameSizeTuplePrefixComparator<k, k> {\n  template <class Tuple1, class Tuple2>\n  static bool Eq(const Tuple1& t1, const Tuple2& t2) {\n    return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&\n        ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);\n  }\n};\n\n}  // namespace gtest_internal\n\ntemplate <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>\ninline bool operator==(const GTEST_10_TUPLE_(T)& t,\n                       const GTEST_10_TUPLE_(U)& u) {\n  return gtest_internal::SameSizeTuplePrefixComparator<\n      tuple_size<GTEST_10_TUPLE_(T) >::value,\n      tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);\n}\n\ntemplate <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>\ninline bool operator!=(const GTEST_10_TUPLE_(T)& t,\n                       const GTEST_10_TUPLE_(U)& u) { return !(t == u); }\n\n// 6.1.4 Pairs.\n// Unimplemented.\n\n}  // namespace tr1\n}  // namespace std\n\n#undef GTEST_0_TUPLE_\n#undef GTEST_1_TUPLE_\n#undef GTEST_2_TUPLE_\n#undef GTEST_3_TUPLE_\n#undef GTEST_4_TUPLE_\n#undef GTEST_5_TUPLE_\n#undef GTEST_6_TUPLE_\n#undef GTEST_7_TUPLE_\n#undef GTEST_8_TUPLE_\n#undef GTEST_9_TUPLE_\n#undef GTEST_10_TUPLE_\n\n#undef GTEST_0_TYPENAMES_\n#undef GTEST_1_TYPENAMES_\n#undef GTEST_2_TYPENAMES_\n#undef GTEST_3_TYPENAMES_\n#undef GTEST_4_TYPENAMES_\n#undef GTEST_5_TYPENAMES_\n#undef GTEST_6_TYPENAMES_\n#undef GTEST_7_TYPENAMES_\n#undef GTEST_8_TYPENAMES_\n#undef GTEST_9_TYPENAMES_\n#undef GTEST_10_TYPENAMES_\n\n#undef GTEST_DECLARE_TUPLE_AS_FRIEND_\n#undef GTEST_BY_REF_\n#undef GTEST_ADD_REF_\n#undef GTEST_TUPLE_ELEMENT_\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n# elif GTEST_ENV_HAS_STD_TUPLE_\n#  include <tuple>\n// C++11 puts its tuple into the ::std namespace rather than\n// ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.\n// This causes undefined behavior, but supported compilers react in\n// the way we intend.\nnamespace std {\nnamespace tr1 {\nusing ::std::get;\nusing ::std::make_tuple;\nusing ::std::tuple;\nusing ::std::tuple_element;\nusing ::std::tuple_size;\n}\n}\n\n# elif GTEST_OS_SYMBIAN\n\n// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to\n// use STLport's tuple implementation, which unfortunately doesn't\n// work as the copy of STLport distributed with Symbian is incomplete.\n// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to\n// use its own tuple implementation.\n#  ifdef BOOST_HAS_TR1_TUPLE\n#   undef BOOST_HAS_TR1_TUPLE\n#  endif  // BOOST_HAS_TR1_TUPLE\n\n// This prevents <boost/tr1/detail/config.hpp>, which defines\n// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.\n#  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED\n#  include <tuple>\n\n# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)\n// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does\n// not conform to the TR1 spec, which requires the header to be <tuple>.\n\n#  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302\n// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,\n// which is #included by <tr1/tuple>, to not compile when RTTI is\n// disabled.  _TR1_FUNCTIONAL is the header guard for\n// <tr1/functional>.  Hence the following #define is a hack to prevent\n// <tr1/functional> from being included.\n#   define _TR1_FUNCTIONAL 1\n#   include <tr1/tuple>\n#   undef _TR1_FUNCTIONAL  // Allows the user to #include\n                        // <tr1/functional> if he chooses to.\n#  else\n#   include <tr1/tuple>  // NOLINT\n#  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302\n\n# else\n// If the compiler is not GCC 4.0+, we assume the user is using a\n// spec-conforming TR1 implementation.\n#  include <tuple>  // NOLINT\n# endif  // GTEST_USE_OWN_TR1_TUPLE\n\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Determines whether clone(2) is supported.\n// Usually it will only be available on Linux, excluding\n// Linux on the Itanium architecture.\n// Also see http://linux.die.net/man/2/clone.\n#ifndef GTEST_HAS_CLONE\n// The user didn't tell us, so we need to figure it out.\n\n# if GTEST_OS_LINUX && !defined(__ia64__)\n#  if GTEST_OS_LINUX_ANDROID\n// On Android, clone() is only available on ARM starting with Gingerbread.\n#    if defined(__arm__) && __ANDROID_API__ >= 9\n#     define GTEST_HAS_CLONE 1\n#    else\n#     define GTEST_HAS_CLONE 0\n#    endif\n#  else\n#   define GTEST_HAS_CLONE 1\n#  endif\n# else\n#  define GTEST_HAS_CLONE 0\n# endif  // GTEST_OS_LINUX && !defined(__ia64__)\n\n#endif  // GTEST_HAS_CLONE\n\n// Determines whether to support stream redirection. This is used to test\n// output correctness and to implement death tests.\n#ifndef GTEST_HAS_STREAM_REDIRECTION\n// By default, we assume that stream redirection is supported on all\n// platforms except known mobile ones.\n# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN\n#  define GTEST_HAS_STREAM_REDIRECTION 0\n# else\n#  define GTEST_HAS_STREAM_REDIRECTION 1\n# endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n// Determines whether to support death tests.\n// Google Test does not support death tests for VC 7.1 and earlier as\n// abort() in a VC 7.1 application compiled as GUI in debug config\n// pops up a dialog window that cannot be suppressed programmatically.\n#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \\\n     (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \\\n     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \\\n     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \\\n     GTEST_OS_OPENBSD || GTEST_OS_QNX)\n# define GTEST_HAS_DEATH_TEST 1\n# include <vector>  // NOLINT\n#endif\n\n// We don't support MSVC 7.1 with exceptions disabled now.  Therefore\n// all the compilers we care about are adequate for supporting\n// value-parameterized tests.\n#define GTEST_HAS_PARAM_TEST 1\n\n// Determines whether to support type-driven tests.\n\n// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,\n// Sun Pro CC, IBM Visual Age, and HP aCC support.\n#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \\\n    defined(__IBMCPP__) || defined(__HP_aCC)\n# define GTEST_HAS_TYPED_TEST 1\n# define GTEST_HAS_TYPED_TEST_P 1\n#endif\n\n// Determines whether to support Combine(). This only makes sense when\n// value-parameterized tests are enabled.  The implementation doesn't\n// work on Sun Studio since it doesn't understand templated conversion\n// operators.\n#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)\n# define GTEST_HAS_COMBINE 1\n#endif\n\n// Determines whether the system compiler uses UTF-16 for encoding wide strings.\n#define GTEST_WIDE_STRING_USES_UTF16_ \\\n    (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)\n\n// Determines whether test results can be streamed to a socket.\n#if GTEST_OS_LINUX\n# define GTEST_CAN_STREAM_RESULTS_ 1\n#endif\n\n// Defines some utility macros.\n\n// The GNU compiler emits a warning if nested \"if\" statements are followed by\n// an \"else\" statement and braces are not used to explicitly disambiguate the\n// \"else\" binding.  This leads to problems with code like:\n//\n//   if (gate)\n//     ASSERT_*(condition) << \"Some message\";\n//\n// The \"switch (0) case 0:\" idiom is used to suppress this.\n#ifdef __INTEL_COMPILER\n# define GTEST_AMBIGUOUS_ELSE_BLOCKER_\n#else\n# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT\n#endif\n\n// Use this annotation at the end of a struct/class definition to\n// prevent the compiler from optimizing away instances that are never\n// used.  This is useful when all interesting logic happens inside the\n// c'tor and / or d'tor.  Example:\n//\n//   struct Foo {\n//     Foo() { ... }\n//   } GTEST_ATTRIBUTE_UNUSED_;\n//\n// Also use it after a variable or parameter declaration to tell the\n// compiler the variable/parameter does not have to be used.\n#if defined(__GNUC__) && !defined(COMPILER_ICC)\n# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))\n#else\n# define GTEST_ATTRIBUTE_UNUSED_\n#endif\n\n// A macro to disallow operator=\n// This should be used in the private: declarations for a class.\n#define GTEST_DISALLOW_ASSIGN_(type)\\\n  void operator=(type const &)\n\n// A macro to disallow copy constructor and operator=\n// This should be used in the private: declarations for a class.\n#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\\\n  type(type const &);\\\n  GTEST_DISALLOW_ASSIGN_(type)\n\n// Tell the compiler to warn about unused return values for functions declared\n// with this macro.  The macro should be used on function declarations\n// following the argument list:\n//\n//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;\n#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)\n# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))\n#else\n# define GTEST_MUST_USE_RESULT_\n#endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC\n\n// Determine whether the compiler supports Microsoft's Structured Exception\n// Handling.  This is supported by several Windows compilers but generally\n// does not exist on any other system.\n#ifndef GTEST_HAS_SEH\n// The user didn't tell us, so we need to figure it out.\n\n# if defined(_MSC_VER) || defined(__BORLANDC__)\n// These two compilers are known to support SEH.\n#  define GTEST_HAS_SEH 1\n# else\n// Assume no SEH.\n#  define GTEST_HAS_SEH 0\n# endif\n\n#endif  // GTEST_HAS_SEH\n\n#ifdef _MSC_VER\n\n# if GTEST_LINKED_AS_SHARED_LIBRARY\n#  define GTEST_API_ __declspec(dllimport)\n# elif GTEST_CREATE_SHARED_LIBRARY\n#  define GTEST_API_ __declspec(dllexport)\n# endif\n\n#endif  // _MSC_VER\n\n#ifndef GTEST_API_\n# define GTEST_API_\n#endif\n\n#ifdef __GNUC__\n// Ask the compiler to never inline a given function.\n# define GTEST_NO_INLINE_ __attribute__((noinline))\n#else\n# define GTEST_NO_INLINE_\n#endif\n\n// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.\n#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)\n# define GTEST_HAS_CXXABI_H_ 1\n#else\n# define GTEST_HAS_CXXABI_H_ 0\n#endif\n\nnamespace testing {\n\nclass Message;\n\nnamespace internal {\n\n// A secret type that Google Test users don't know about.  It has no\n// definition on purpose.  Therefore it's impossible to create a\n// Secret object, which is what we want.\nclass Secret;\n\n// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time\n// expression is true. For example, you could use it to verify the\n// size of a static array:\n//\n//   GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,\n//                         content_type_names_incorrect_size);\n//\n// or to make sure a struct is smaller than a certain size:\n//\n//   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);\n//\n// The second argument to the macro is the name of the variable. If\n// the expression is false, most compilers will issue a warning/error\n// containing the name of the variable.\n\ntemplate <bool>\nstruct CompileAssert {\n};\n\n#define GTEST_COMPILE_ASSERT_(expr, msg) \\\n  typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \\\n      msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_\n\n// Implementation details of GTEST_COMPILE_ASSERT_:\n//\n// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1\n//   elements (and thus is invalid) when the expression is false.\n//\n// - The simpler definition\n//\n//    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]\n//\n//   does not work, as gcc supports variable-length arrays whose sizes\n//   are determined at run-time (this is gcc's extension and not part\n//   of the C++ standard).  As a result, gcc fails to reject the\n//   following code with the simple definition:\n//\n//     int foo;\n//     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is\n//                                      // not a compile-time constant.\n//\n// - By using the type CompileAssert<(bool(expr))>, we ensures that\n//   expr is a compile-time constant.  (Template arguments must be\n//   determined at compile-time.)\n//\n// - The outter parentheses in CompileAssert<(bool(expr))> are necessary\n//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written\n//\n//     CompileAssert<bool(expr)>\n//\n//   instead, these compilers will refuse to compile\n//\n//     GTEST_COMPILE_ASSERT_(5 > 0, some_message);\n//\n//   (They seem to think the \">\" in \"5 > 0\" marks the end of the\n//   template argument list.)\n//\n// - The array size is (bool(expr) ? 1 : -1), instead of simply\n//\n//     ((expr) ? 1 : -1).\n//\n//   This is to avoid running into a bug in MS VC 7.1, which\n//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.\n\n// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.\n//\n// This template is declared, but intentionally undefined.\ntemplate <typename T1, typename T2>\nstruct StaticAssertTypeEqHelper;\n\ntemplate <typename T>\nstruct StaticAssertTypeEqHelper<T, T> {};\n\n#if GTEST_HAS_GLOBAL_STRING\ntypedef ::string string;\n#else\ntypedef ::std::string string;\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\ntypedef ::wstring wstring;\n#elif GTEST_HAS_STD_WSTRING\ntypedef ::std::wstring wstring;\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// A helper for suppressing warnings on constant condition.  It just\n// returns 'condition'.\nGTEST_API_ bool IsTrue(bool condition);\n\n// Defines scoped_ptr.\n\n// This implementation of scoped_ptr is PARTIAL - it only contains\n// enough stuff to satisfy Google Test's need.\ntemplate <typename T>\nclass scoped_ptr {\n public:\n  typedef T element_type;\n\n  explicit scoped_ptr(T* p = NULL) : ptr_(p) {}\n  ~scoped_ptr() { reset(); }\n\n  T& operator*() const { return *ptr_; }\n  T* operator->() const { return ptr_; }\n  T* get() const { return ptr_; }\n\n  T* release() {\n    T* const ptr = ptr_;\n    ptr_ = NULL;\n    return ptr;\n  }\n\n  void reset(T* p = NULL) {\n    if (p != ptr_) {\n      if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.\n        delete ptr_;\n      }\n      ptr_ = p;\n    }\n  }\n\n private:\n  T* ptr_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);\n};\n\n// Defines RE.\n\n// A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended\n// Regular Expression syntax.\nclass GTEST_API_ RE {\n public:\n  // A copy constructor is required by the Standard to initialize object\n  // references from r-values.\n  RE(const RE& other) { Init(other.pattern()); }\n\n  // Constructs an RE from a string.\n  RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT\n\n#if GTEST_HAS_GLOBAL_STRING\n\n  RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n  RE(const char* regex) { Init(regex); }  // NOLINT\n  ~RE();\n\n  // Returns the string representation of the regex.\n  const char* pattern() const { return pattern_; }\n\n  // FullMatch(str, re) returns true iff regular expression re matches\n  // the entire str.\n  // PartialMatch(str, re) returns true iff regular expression re\n  // matches a substring of str (including str itself).\n  //\n  // TODO(wan@google.com): make FullMatch() and PartialMatch() work\n  // when str contains NUL characters.\n  static bool FullMatch(const ::std::string& str, const RE& re) {\n    return FullMatch(str.c_str(), re);\n  }\n  static bool PartialMatch(const ::std::string& str, const RE& re) {\n    return PartialMatch(str.c_str(), re);\n  }\n\n#if GTEST_HAS_GLOBAL_STRING\n\n  static bool FullMatch(const ::string& str, const RE& re) {\n    return FullMatch(str.c_str(), re);\n  }\n  static bool PartialMatch(const ::string& str, const RE& re) {\n    return PartialMatch(str.c_str(), re);\n  }\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n  static bool FullMatch(const char* str, const RE& re);\n  static bool PartialMatch(const char* str, const RE& re);\n\n private:\n  void Init(const char* regex);\n\n  // We use a const char* instead of an std::string, as Google Test used to be\n  // used where std::string is not available.  TODO(wan@google.com): change to\n  // std::string.\n  const char* pattern_;\n  bool is_valid_;\n\n#if GTEST_USES_POSIX_RE\n\n  regex_t full_regex_;     // For FullMatch().\n  regex_t partial_regex_;  // For PartialMatch().\n\n#else  // GTEST_USES_SIMPLE_RE\n\n  const char* full_pattern_;  // For FullMatch();\n\n#endif\n\n  GTEST_DISALLOW_ASSIGN_(RE);\n};\n\n// Formats a source file path and a line number as they would appear\n// in an error message from the compiler used to compile this code.\nGTEST_API_ ::std::string FormatFileLocation(const char* file, int line);\n\n// Formats a file location for compiler-independent XML output.\n// Although this function is not platform dependent, we put it next to\n// FormatFileLocation in order to contrast the two functions.\nGTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,\n                                                               int line);\n\n// Defines logging utilities:\n//   GTEST_LOG_(severity) - logs messages at the specified severity level. The\n//                          message itself is streamed into the macro.\n//   LogToStderr()  - directs all log messages to stderr.\n//   FlushInfoLog() - flushes informational log messages.\n\nenum GTestLogSeverity {\n  GTEST_INFO,\n  GTEST_WARNING,\n  GTEST_ERROR,\n  GTEST_FATAL\n};\n\n// Formats log entry severity, provides a stream object for streaming the\n// log message, and terminates the message with a newline when going out of\n// scope.\nclass GTEST_API_ GTestLog {\n public:\n  GTestLog(GTestLogSeverity severity, const char* file, int line);\n\n  // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.\n  ~GTestLog();\n\n  ::std::ostream& GetStream() { return ::std::cerr; }\n\n private:\n  const GTestLogSeverity severity_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);\n};\n\n#define GTEST_LOG_(severity) \\\n    ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \\\n                                  __FILE__, __LINE__).GetStream()\n\ninline void LogToStderr() {}\ninline void FlushInfoLog() { fflush(NULL); }\n\n// INTERNAL IMPLEMENTATION - DO NOT USE.\n//\n// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition\n// is not satisfied.\n//  Synopsys:\n//    GTEST_CHECK_(boolean_condition);\n//     or\n//    GTEST_CHECK_(boolean_condition) << \"Additional message\";\n//\n//    This checks the condition and if the condition is not satisfied\n//    it prints message about the condition violation, including the\n//    condition itself, plus additional message streamed into it, if any,\n//    and then it aborts the program. It aborts the program irrespective of\n//    whether it is built in the debug mode or not.\n#define GTEST_CHECK_(condition) \\\n    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n    if (::testing::internal::IsTrue(condition)) \\\n      ; \\\n    else \\\n      GTEST_LOG_(FATAL) << \"Condition \" #condition \" failed. \"\n\n// An all-mode assert to verify that the given POSIX-style function\n// call returns 0 (indicating success).  Known limitation: this\n// doesn't expand to a balanced 'if' statement, so enclose the macro\n// in {} if you need to use it as the only statement in an 'if'\n// branch.\n#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \\\n  if (const int gtest_error = (posix_call)) \\\n    GTEST_LOG_(FATAL) << #posix_call << \"failed with error \" \\\n                      << gtest_error\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Use ImplicitCast_ as a safe version of static_cast for upcasting in\n// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a\n// const Foo*).  When you use ImplicitCast_, the compiler checks that\n// the cast is safe.  Such explicit ImplicitCast_s are necessary in\n// surprisingly many situations where C++ demands an exact type match\n// instead of an argument type convertable to a target type.\n//\n// The syntax for using ImplicitCast_ is the same as for static_cast:\n//\n//   ImplicitCast_<ToType>(expr)\n//\n// ImplicitCast_ would have been part of the C++ standard library,\n// but the proposal was submitted too late.  It will probably make\n// its way into the language in the future.\n//\n// This relatively ugly name is intentional. It prevents clashes with\n// similar functions users may have (e.g., implicit_cast). The internal\n// namespace alone is not enough because the function can be found by ADL.\ntemplate<typename To>\ninline To ImplicitCast_(To x) { return x; }\n\n// When you upcast (that is, cast a pointer from type Foo to type\n// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts\n// always succeed.  When you downcast (that is, cast a pointer from\n// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because\n// how do you know the pointer is really of type SubclassOfFoo?  It\n// could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,\n// when you downcast, you should use this macro.  In debug mode, we\n// use dynamic_cast<> to double-check the downcast is legal (we die\n// if it's not).  In normal mode, we do the efficient static_cast<>\n// instead.  Thus, it's important to test in debug mode to make sure\n// the cast is legal!\n//    This is the only place in the code we should use dynamic_cast<>.\n// In particular, you SHOULDN'T be using dynamic_cast<> in order to\n// do RTTI (eg code like this:\n//    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);\n//    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);\n// You should design the code some other way not to need this.\n//\n// This relatively ugly name is intentional. It prevents clashes with\n// similar functions users may have (e.g., down_cast). The internal\n// namespace alone is not enough because the function can be found by ADL.\ntemplate<typename To, typename From>  // use like this: DownCast_<T*>(foo);\ninline To DownCast_(From* f) {  // so we only accept pointers\n  // Ensures that To is a sub-type of From *.  This test is here only\n  // for compile-time type checking, and has no overhead in an\n  // optimized build at run-time, as it will be optimized away\n  // completely.\n  if (false) {\n    const To to = NULL;\n    ::testing::internal::ImplicitCast_<From*>(to);\n  }\n\n#if GTEST_HAS_RTTI\n  // RTTI: debug mode only!\n  GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);\n#endif\n  return static_cast<To>(f);\n}\n\n// Downcasts the pointer of type Base to Derived.\n// Derived must be a subclass of Base. The parameter MUST\n// point to a class of type Derived, not any subclass of it.\n// When RTTI is available, the function performs a runtime\n// check to enforce this.\ntemplate <class Derived, class Base>\nDerived* CheckedDowncastToActualType(Base* base) {\n#if GTEST_HAS_RTTI\n  GTEST_CHECK_(typeid(*base) == typeid(Derived));\n  return dynamic_cast<Derived*>(base);  // NOLINT\n#else\n  return static_cast<Derived*>(base);  // Poor man's downcast.\n#endif\n}\n\n#if GTEST_HAS_STREAM_REDIRECTION\n\n// Defines the stderr capturer:\n//   CaptureStdout     - starts capturing stdout.\n//   GetCapturedStdout - stops capturing stdout and returns the captured string.\n//   CaptureStderr     - starts capturing stderr.\n//   GetCapturedStderr - stops capturing stderr and returns the captured string.\n//\nGTEST_API_ void CaptureStdout();\nGTEST_API_ std::string GetCapturedStdout();\nGTEST_API_ void CaptureStderr();\nGTEST_API_ std::string GetCapturedStderr();\n\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n\n#if GTEST_HAS_DEATH_TEST\n\nconst ::std::vector<testing::internal::string>& GetInjectableArgvs();\nvoid SetInjectableArgvs(const ::std::vector<testing::internal::string>*\n                             new_argvs);\n\n// A copy of all command line arguments.  Set by InitGoogleTest().\nextern ::std::vector<testing::internal::string> g_argvs;\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Defines synchronization primitives.\n\n#if GTEST_HAS_PTHREAD\n\n// Sleeps for (roughly) n milli-seconds.  This function is only for\n// testing Google Test's own constructs.  Don't use it in user tests,\n// either directly or indirectly.\ninline void SleepMilliseconds(int n) {\n  const timespec time = {\n    0,                  // 0 seconds.\n    n * 1000L * 1000L,  // And n ms.\n  };\n  nanosleep(&time, NULL);\n}\n\n// Allows a controller thread to pause execution of newly created\n// threads until notified.  Instances of this class must be created\n// and destroyed in the controller thread.\n//\n// This class is only for testing Google Test's own constructs. Do not\n// use it in user tests, either directly or indirectly.\nclass Notification {\n public:\n  Notification() : notified_(false) {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));\n  }\n  ~Notification() {\n    pthread_mutex_destroy(&mutex_);\n  }\n\n  // Notifies all threads created with this notification to start. Must\n  // be called from the controller thread.\n  void Notify() {\n    pthread_mutex_lock(&mutex_);\n    notified_ = true;\n    pthread_mutex_unlock(&mutex_);\n  }\n\n  // Blocks until the controller thread notifies. Must be called from a test\n  // thread.\n  void WaitForNotification() {\n    for (;;) {\n      pthread_mutex_lock(&mutex_);\n      const bool notified = notified_;\n      pthread_mutex_unlock(&mutex_);\n      if (notified)\n        break;\n      SleepMilliseconds(10);\n    }\n  }\n\n private:\n  pthread_mutex_t mutex_;\n  bool notified_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);\n};\n\n// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.\n// Consequently, it cannot select a correct instantiation of ThreadWithParam\n// in order to call its Run(). Introducing ThreadWithParamBase as a\n// non-templated base class for ThreadWithParam allows us to bypass this\n// problem.\nclass ThreadWithParamBase {\n public:\n  virtual ~ThreadWithParamBase() {}\n  virtual void Run() = 0;\n};\n\n// pthread_create() accepts a pointer to a function type with the C linkage.\n// According to the Standard (7.5/1), function types with different linkages\n// are different even if they are otherwise identical.  Some compilers (for\n// example, SunStudio) treat them as different types.  Since class methods\n// cannot be defined with C-linkage we need to define a free C-function to\n// pass into pthread_create().\nextern \"C\" inline void* ThreadFuncWithCLinkage(void* thread) {\n  static_cast<ThreadWithParamBase*>(thread)->Run();\n  return NULL;\n}\n\n// Helper class for testing Google Test's multi-threading constructs.\n// To use it, write:\n//\n//   void ThreadFunc(int param) { /* Do things with param */ }\n//   Notification thread_can_start;\n//   ...\n//   // The thread_can_start parameter is optional; you can supply NULL.\n//   ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);\n//   thread_can_start.Notify();\n//\n// These classes are only for testing Google Test's own constructs. Do\n// not use them in user tests, either directly or indirectly.\ntemplate <typename T>\nclass ThreadWithParam : public ThreadWithParamBase {\n public:\n  typedef void (*UserThreadFunc)(T);\n\n  ThreadWithParam(\n      UserThreadFunc func, T param, Notification* thread_can_start)\n      : func_(func),\n        param_(param),\n        thread_can_start_(thread_can_start),\n        finished_(false) {\n    ThreadWithParamBase* const base = this;\n    // The thread can be created only after all fields except thread_\n    // have been initialized.\n    GTEST_CHECK_POSIX_SUCCESS_(\n        pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));\n  }\n  ~ThreadWithParam() { Join(); }\n\n  void Join() {\n    if (!finished_) {\n      GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));\n      finished_ = true;\n    }\n  }\n\n  virtual void Run() {\n    if (thread_can_start_ != NULL)\n      thread_can_start_->WaitForNotification();\n    func_(param_);\n  }\n\n private:\n  const UserThreadFunc func_;  // User-supplied thread function.\n  const T param_;  // User-supplied parameter to the thread function.\n  // When non-NULL, used to block execution until the controller thread\n  // notifies.\n  Notification* const thread_can_start_;\n  bool finished_;  // true iff we know that the thread function has finished.\n  pthread_t thread_;  // The native thread object.\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);\n};\n\n// MutexBase and Mutex implement mutex on pthreads-based platforms. They\n// are used in conjunction with class MutexLock:\n//\n//   Mutex mutex;\n//   ...\n//   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the end\n//                            // of the current scope.\n//\n// MutexBase implements behavior for both statically and dynamically\n// allocated mutexes.  Do not use MutexBase directly.  Instead, write\n// the following to define a static mutex:\n//\n//   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);\n//\n// You can forward declare a static mutex like this:\n//\n//   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);\n//\n// To create a dynamic mutex, just define an object of type Mutex.\nclass MutexBase {\n public:\n  // Acquires this mutex.\n  void Lock() {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));\n    owner_ = pthread_self();\n    has_owner_ = true;\n  }\n\n  // Releases this mutex.\n  void Unlock() {\n    // Since the lock is being released the owner_ field should no longer be\n    // considered valid. We don't protect writing to has_owner_ here, as it's\n    // the caller's responsibility to ensure that the current thread holds the\n    // mutex when this is called.\n    has_owner_ = false;\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));\n  }\n\n  // Does nothing if the current thread holds the mutex. Otherwise, crashes\n  // with high probability.\n  void AssertHeld() const {\n    GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))\n        << \"The current thread is not holding the mutex @\" << this;\n  }\n\n  // A static mutex may be used before main() is entered.  It may even\n  // be used before the dynamic initialization stage.  Therefore we\n  // must be able to initialize a static mutex object at link time.\n  // This means MutexBase has to be a POD and its member variables\n  // have to be public.\n public:\n  pthread_mutex_t mutex_;  // The underlying pthread mutex.\n  // has_owner_ indicates whether the owner_ field below contains a valid thread\n  // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All\n  // accesses to the owner_ field should be protected by a check of this field.\n  // An alternative might be to memset() owner_ to all zeros, but there's no\n  // guarantee that a zero'd pthread_t is necessarily invalid or even different\n  // from pthread_self().\n  bool has_owner_;\n  pthread_t owner_;  // The thread holding the mutex.\n};\n\n// Forward-declares a static mutex.\n# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \\\n    extern ::testing::internal::MutexBase mutex\n\n// Defines and statically (i.e. at link time) initializes a static mutex.\n// The initialization list here does not explicitly initialize each field,\n// instead relying on default initialization for the unspecified fields. In\n// particular, the owner_ field (a pthread_t) is not explicitly initialized.\n// This allows initialization to work whether pthread_t is a scalar or struct.\n// The flag -Wmissing-field-initializers must not be specified for this to work.\n# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \\\n    ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }\n\n// The Mutex class can only be used for mutexes created at runtime. It\n// shares its API with MutexBase otherwise.\nclass Mutex : public MutexBase {\n public:\n  Mutex() {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));\n    has_owner_ = false;\n  }\n  ~Mutex() {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));\n  }\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);\n};\n\n// We cannot name this class MutexLock as the ctor declaration would\n// conflict with a macro named MutexLock, which is defined on some\n// platforms.  Hence the typedef trick below.\nclass GTestMutexLock {\n public:\n  explicit GTestMutexLock(MutexBase* mutex)\n      : mutex_(mutex) { mutex_->Lock(); }\n\n  ~GTestMutexLock() { mutex_->Unlock(); }\n\n private:\n  MutexBase* const mutex_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);\n};\n\ntypedef GTestMutexLock MutexLock;\n\n// Helpers for ThreadLocal.\n\n// pthread_key_create() requires DeleteThreadLocalValue() to have\n// C-linkage.  Therefore it cannot be templatized to access\n// ThreadLocal<T>.  Hence the need for class\n// ThreadLocalValueHolderBase.\nclass ThreadLocalValueHolderBase {\n public:\n  virtual ~ThreadLocalValueHolderBase() {}\n};\n\n// Called by pthread to delete thread-local data stored by\n// pthread_setspecific().\nextern \"C\" inline void DeleteThreadLocalValue(void* value_holder) {\n  delete static_cast<ThreadLocalValueHolderBase*>(value_holder);\n}\n\n// Implements thread-local storage on pthreads-based systems.\n//\n//   // Thread 1\n//   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.\n//\n//   // Thread 2\n//   tl.set(150);  // Changes the value for thread 2 only.\n//   EXPECT_EQ(150, tl.get());\n//\n//   // Thread 1\n//   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.\n//   tl.set(200);\n//   EXPECT_EQ(200, tl.get());\n//\n// The template type argument T must have a public copy constructor.\n// In addition, the default ThreadLocal constructor requires T to have\n// a public default constructor.\n//\n// An object managed for a thread by a ThreadLocal instance is deleted\n// when the thread exits.  Or, if the ThreadLocal instance dies in\n// that thread, when the ThreadLocal dies.  It's the user's\n// responsibility to ensure that all other threads using a ThreadLocal\n// have exited when it dies, or the per-thread objects for those\n// threads will not be deleted.\n//\n// Google Test only uses global ThreadLocal objects.  That means they\n// will die after main() has returned.  Therefore, no per-thread\n// object managed by Google Test will be leaked as long as all threads\n// using Google Test have exited when main() returns.\ntemplate <typename T>\nclass ThreadLocal {\n public:\n  ThreadLocal() : key_(CreateKey()),\n                  default_() {}\n  explicit ThreadLocal(const T& value) : key_(CreateKey()),\n                                         default_(value) {}\n\n  ~ThreadLocal() {\n    // Destroys the managed object for the current thread, if any.\n    DeleteThreadLocalValue(pthread_getspecific(key_));\n\n    // Releases resources associated with the key.  This will *not*\n    // delete managed objects for other threads.\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));\n  }\n\n  T* pointer() { return GetOrCreateValue(); }\n  const T* pointer() const { return GetOrCreateValue(); }\n  const T& get() const { return *pointer(); }\n  void set(const T& value) { *pointer() = value; }\n\n private:\n  // Holds a value of type T.\n  class ValueHolder : public ThreadLocalValueHolderBase {\n   public:\n    explicit ValueHolder(const T& value) : value_(value) {}\n\n    T* pointer() { return &value_; }\n\n   private:\n    T value_;\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);\n  };\n\n  static pthread_key_t CreateKey() {\n    pthread_key_t key;\n    // When a thread exits, DeleteThreadLocalValue() will be called on\n    // the object managed for that thread.\n    GTEST_CHECK_POSIX_SUCCESS_(\n        pthread_key_create(&key, &DeleteThreadLocalValue));\n    return key;\n  }\n\n  T* GetOrCreateValue() const {\n    ThreadLocalValueHolderBase* const holder =\n        static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));\n    if (holder != NULL) {\n      return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();\n    }\n\n    ValueHolder* const new_holder = new ValueHolder(default_);\n    ThreadLocalValueHolderBase* const holder_base = new_holder;\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));\n    return new_holder->pointer();\n  }\n\n  // A key pthreads uses for looking up per-thread values.\n  const pthread_key_t key_;\n  const T default_;  // The default value for each thread.\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);\n};\n\n# define GTEST_IS_THREADSAFE 1\n\n#else  // GTEST_HAS_PTHREAD\n\n// A dummy implementation of synchronization primitives (mutex, lock,\n// and thread-local variable).  Necessary for compiling Google Test where\n// mutex is not supported - using Google Test in multiple threads is not\n// supported on such platforms.\n\nclass Mutex {\n public:\n  Mutex() {}\n  void Lock() {}\n  void Unlock() {}\n  void AssertHeld() const {}\n};\n\n# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \\\n  extern ::testing::internal::Mutex mutex\n\n# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex\n\nclass GTestMutexLock {\n public:\n  explicit GTestMutexLock(Mutex*) {}  // NOLINT\n};\n\ntypedef GTestMutexLock MutexLock;\n\ntemplate <typename T>\nclass ThreadLocal {\n public:\n  ThreadLocal() : value_() {}\n  explicit ThreadLocal(const T& value) : value_(value) {}\n  T* pointer() { return &value_; }\n  const T* pointer() const { return &value_; }\n  const T& get() const { return value_; }\n  void set(const T& value) { value_ = value; }\n private:\n  T value_;\n};\n\n// The above synchronization primitives have dummy implementations.\n// Therefore Google Test is not thread-safe.\n# define GTEST_IS_THREADSAFE 0\n\n#endif  // GTEST_HAS_PTHREAD\n\n// Returns the number of threads running in the process, or 0 to indicate that\n// we cannot detect it.\nGTEST_API_ size_t GetThreadCount();\n\n// Passing non-POD classes through ellipsis (...) crashes the ARM\n// compiler and generates a warning in Sun Studio.  The Nokia Symbian\n// and the IBM XL C/C++ compiler try to instantiate a copy constructor\n// for objects passed through ellipsis (...), failing for uncopyable\n// objects.  We define this to ensure that only POD is passed through\n// ellipsis on these systems.\n#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)\n// We lose support for NULL detection where the compiler doesn't like\n// passing non-POD classes through ellipsis (...).\n# define GTEST_ELLIPSIS_NEEDS_POD_ 1\n#else\n# define GTEST_CAN_COMPARE_NULL 1\n#endif\n\n// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between\n// const T& and const T* in a function template.  These compilers\n// _can_ decide between class template specializations for T and T*,\n// so a tr1::type_traits-like is_pointer works.\n#if defined(__SYMBIAN32__) || defined(__IBMCPP__)\n# define GTEST_NEEDS_IS_POINTER_ 1\n#endif\n\ntemplate <bool bool_value>\nstruct bool_constant {\n  typedef bool_constant<bool_value> type;\n  static const bool value = bool_value;\n};\ntemplate <bool bool_value> const bool bool_constant<bool_value>::value;\n\ntypedef bool_constant<false> false_type;\ntypedef bool_constant<true> true_type;\n\ntemplate <typename T>\nstruct is_pointer : public false_type {};\n\ntemplate <typename T>\nstruct is_pointer<T*> : public true_type {};\n\ntemplate <typename Iterator>\nstruct IteratorTraits {\n  typedef typename Iterator::value_type value_type;\n};\n\ntemplate <typename T>\nstruct IteratorTraits<T*> {\n  typedef T value_type;\n};\n\ntemplate <typename T>\nstruct IteratorTraits<const T*> {\n  typedef T value_type;\n};\n\n#if GTEST_OS_WINDOWS\n# define GTEST_PATH_SEP_ \"\\\\\"\n# define GTEST_HAS_ALT_PATH_SEP_ 1\n// The biggest signed integer type the compiler supports.\ntypedef __int64 BiggestInt;\n#else\n# define GTEST_PATH_SEP_ \"/\"\n# define GTEST_HAS_ALT_PATH_SEP_ 0\ntypedef long long BiggestInt;  // NOLINT\n#endif  // GTEST_OS_WINDOWS\n\n// Utilities for char.\n\n// isspace(int ch) and friends accept an unsigned char or EOF.  char\n// may be signed, depending on the compiler (or compiler flags).\n// Therefore we need to cast a char to unsigned char before calling\n// isspace(), etc.\n\ninline bool IsAlpha(char ch) {\n  return isalpha(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsAlNum(char ch) {\n  return isalnum(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsDigit(char ch) {\n  return isdigit(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsLower(char ch) {\n  return islower(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsSpace(char ch) {\n  return isspace(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsUpper(char ch) {\n  return isupper(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsXDigit(char ch) {\n  return isxdigit(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsXDigit(wchar_t ch) {\n  const unsigned char low_byte = static_cast<unsigned char>(ch);\n  return ch == low_byte && isxdigit(low_byte) != 0;\n}\n\ninline char ToLower(char ch) {\n  return static_cast<char>(tolower(static_cast<unsigned char>(ch)));\n}\ninline char ToUpper(char ch) {\n  return static_cast<char>(toupper(static_cast<unsigned char>(ch)));\n}\n\n// The testing::internal::posix namespace holds wrappers for common\n// POSIX functions.  These wrappers hide the differences between\n// Windows/MSVC and POSIX systems.  Since some compilers define these\n// standard functions as macros, the wrapper cannot have the same name\n// as the wrapped function.\n\nnamespace posix {\n\n// Functions with a different name on Windows.\n\n#if GTEST_OS_WINDOWS\n\ntypedef struct _stat StatStruct;\n\n# ifdef __BORLANDC__\ninline int IsATTY(int fd) { return isatty(fd); }\ninline int StrCaseCmp(const char* s1, const char* s2) {\n  return stricmp(s1, s2);\n}\ninline char* StrDup(const char* src) { return strdup(src); }\n# else  // !__BORLANDC__\n#  if GTEST_OS_WINDOWS_MOBILE\ninline int IsATTY(int /* fd */) { return 0; }\n#  else\ninline int IsATTY(int fd) { return _isatty(fd); }\n#  endif  // GTEST_OS_WINDOWS_MOBILE\ninline int StrCaseCmp(const char* s1, const char* s2) {\n  return _stricmp(s1, s2);\n}\ninline char* StrDup(const char* src) { return _strdup(src); }\n# endif  // __BORLANDC__\n\n# if GTEST_OS_WINDOWS_MOBILE\ninline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }\n// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this\n// time and thus not defined there.\n# else\ninline int FileNo(FILE* file) { return _fileno(file); }\ninline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }\ninline int RmDir(const char* dir) { return _rmdir(dir); }\ninline bool IsDir(const StatStruct& st) {\n  return (_S_IFDIR & st.st_mode) != 0;\n}\n# endif  // GTEST_OS_WINDOWS_MOBILE\n\n#else\n\ntypedef struct stat StatStruct;\n\ninline int FileNo(FILE* file) { return fileno(file); }\ninline int IsATTY(int fd) { return isatty(fd); }\ninline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }\ninline int StrCaseCmp(const char* s1, const char* s2) {\n  return strcasecmp(s1, s2);\n}\ninline char* StrDup(const char* src) { return strdup(src); }\ninline int RmDir(const char* dir) { return rmdir(dir); }\ninline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }\n\n#endif  // GTEST_OS_WINDOWS\n\n// Functions deprecated by MSVC 8.0.\n\n#ifdef _MSC_VER\n// Temporarily disable warning 4996 (deprecated function).\n# pragma warning(push)\n# pragma warning(disable:4996)\n#endif\n\ninline const char* StrNCpy(char* dest, const char* src, size_t n) {\n  return strncpy(dest, src, n);\n}\n\n// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and\n// StrError() aren't needed on Windows CE at this time and thus not\n// defined there.\n\n#if !GTEST_OS_WINDOWS_MOBILE\ninline int ChDir(const char* dir) { return chdir(dir); }\n#endif\ninline FILE* FOpen(const char* path, const char* mode) {\n  return fopen(path, mode);\n}\n#if !GTEST_OS_WINDOWS_MOBILE\ninline FILE *FReopen(const char* path, const char* mode, FILE* stream) {\n  return freopen(path, mode, stream);\n}\ninline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }\n#endif\ninline int FClose(FILE* fp) { return fclose(fp); }\n#if !GTEST_OS_WINDOWS_MOBILE\ninline int Read(int fd, void* buf, unsigned int count) {\n  return static_cast<int>(read(fd, buf, count));\n}\ninline int Write(int fd, const void* buf, unsigned int count) {\n  return static_cast<int>(write(fd, buf, count));\n}\ninline int Close(int fd) { return close(fd); }\ninline const char* StrError(int errnum) { return strerror(errnum); }\n#endif\ninline const char* GetEnv(const char* name) {\n#if GTEST_OS_WINDOWS_MOBILE\n  // We are on Windows CE, which has no environment variables.\n  return NULL;\n#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)\n  // Environment variables which we programmatically clear will be set to the\n  // empty string rather than unset (NULL).  Handle that case.\n  const char* const env = getenv(name);\n  return (env != NULL && env[0] != '\\0') ? env : NULL;\n#else\n  return getenv(name);\n#endif\n}\n\n#ifdef _MSC_VER\n# pragma warning(pop)  // Restores the warning state.\n#endif\n\n#if GTEST_OS_WINDOWS_MOBILE\n// Windows CE has no C library. The abort() function is used in\n// several places in Google Test. This implementation provides a reasonable\n// imitation of standard behaviour.\nvoid Abort();\n#else\ninline void Abort() { abort(); }\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n}  // namespace posix\n\n// MSVC \"deprecates\" snprintf and issues warnings wherever it is used.  In\n// order to avoid these warnings, we need to use _snprintf or _snprintf_s on\n// MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate\n// function in order to achieve that.  We use macro definition here because\n// snprintf is a variadic function.\n#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE\n// MSVC 2005 and above support variadic macros.\n# define GTEST_SNPRINTF_(buffer, size, format, ...) \\\n     _snprintf_s(buffer, size, size, format, __VA_ARGS__)\n#elif defined(_MSC_VER)\n// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't\n// complain about _snprintf.\n# define GTEST_SNPRINTF_ _snprintf\n#else\n# define GTEST_SNPRINTF_ snprintf\n#endif\n\n// The maximum number a BiggestInt can represent.  This definition\n// works no matter BiggestInt is represented in one's complement or\n// two's complement.\n//\n// We cannot rely on numeric_limits in STL, as __int64 and long long\n// are not part of standard C++ and numeric_limits doesn't need to be\n// defined for them.\nconst BiggestInt kMaxBiggestInt =\n    ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));\n\n// This template class serves as a compile-time function from size to\n// type.  It maps a size in bytes to a primitive type with that\n// size. e.g.\n//\n//   TypeWithSize<4>::UInt\n//\n// is typedef-ed to be unsigned int (unsigned integer made up of 4\n// bytes).\n//\n// Such functionality should belong to STL, but I cannot find it\n// there.\n//\n// Google Test uses this class in the implementation of floating-point\n// comparison.\n//\n// For now it only handles UInt (unsigned int) as that's all Google Test\n// needs.  Other types can be easily added in the future if need\n// arises.\ntemplate <size_t size>\nclass TypeWithSize {\n public:\n  // This prevents the user from using TypeWithSize<N> with incorrect\n  // values of N.\n  typedef void UInt;\n};\n\n// The specialization for size 4.\ntemplate <>\nclass TypeWithSize<4> {\n public:\n  // unsigned int has size 4 in both gcc and MSVC.\n  //\n  // As base/basictypes.h doesn't compile on Windows, we cannot use\n  // uint32, uint64, and etc here.\n  typedef int Int;\n  typedef unsigned int UInt;\n};\n\n// The specialization for size 8.\ntemplate <>\nclass TypeWithSize<8> {\n public:\n#if GTEST_OS_WINDOWS\n  typedef __int64 Int;\n  typedef unsigned __int64 UInt;\n#else\n  typedef long long Int;  // NOLINT\n  typedef unsigned long long UInt;  // NOLINT\n#endif  // GTEST_OS_WINDOWS\n};\n\n// Integer types of known sizes.\ntypedef TypeWithSize<4>::Int Int32;\ntypedef TypeWithSize<4>::UInt UInt32;\ntypedef TypeWithSize<8>::Int Int64;\ntypedef TypeWithSize<8>::UInt UInt64;\ntypedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.\n\n// Utilities for command line flags and environment variables.\n\n// Macro for referencing flags.\n#define GTEST_FLAG(name) FLAGS_gtest_##name\n\n// Macros for declaring flags.\n#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)\n#define GTEST_DECLARE_int32_(name) \\\n    GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)\n#define GTEST_DECLARE_string_(name) \\\n    GTEST_API_ extern ::std::string GTEST_FLAG(name)\n\n// Macros for defining flags.\n#define GTEST_DEFINE_bool_(name, default_val, doc) \\\n    GTEST_API_ bool GTEST_FLAG(name) = (default_val)\n#define GTEST_DEFINE_int32_(name, default_val, doc) \\\n    GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)\n#define GTEST_DEFINE_string_(name, default_val, doc) \\\n    GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)\n\n// Thread annotations\n#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)\n#define GTEST_LOCK_EXCLUDED_(locks)\n\n// Parses 'str' for a 32-bit signed integer.  If successful, writes the result\n// to *value and returns true; otherwise leaves *value unchanged and returns\n// false.\n// TODO(chandlerc): Find a better way to refactor flag and environment parsing\n// out of both gtest-port.cc and gtest.cc to avoid exporting this utility\n// function.\nbool ParseInt32(const Message& src_text, const char* str, Int32* value);\n\n// Parses a bool/Int32/string from the environment variable\n// corresponding to the given Google Test flag.\nbool BoolFromGTestEnv(const char* flag, bool default_val);\nGTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);\nconst char* StringFromGTestEnv(const char* flag, const char* default_val);\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_\n\n#if GTEST_OS_LINUX\n# include <stdlib.h>\n# include <sys/types.h>\n# include <sys/wait.h>\n# include <unistd.h>\n#endif  // GTEST_OS_LINUX\n\n#if GTEST_HAS_EXCEPTIONS\n# include <stdexcept>\n#endif\n\n#include <ctype.h>\n#include <float.h>\n#include <string.h>\n#include <iomanip>\n#include <limits>\n#include <set>\n\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines the Message class.\n//\n// IMPORTANT NOTE: Due to limitation of the C++ language, we have to\n// leave some internal implementation details in this header file.\n// They are clearly marked by comments like this:\n//\n//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n//\n// Such code is NOT meant to be used by a user directly, and is subject\n// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user\n// program!\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_\n#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_\n\n#include <limits>\n\n\n// Ensures that there is at least one operator<< in the global namespace.\n// See Message& operator<<(...) below for why.\nvoid operator<<(const testing::internal::Secret&, int);\n\nnamespace testing {\n\n// The Message class works like an ostream repeater.\n//\n// Typical usage:\n//\n//   1. You stream a bunch of values to a Message object.\n//      It will remember the text in a stringstream.\n//   2. Then you stream the Message object to an ostream.\n//      This causes the text in the Message to be streamed\n//      to the ostream.\n//\n// For example;\n//\n//   testing::Message foo;\n//   foo << 1 << \" != \" << 2;\n//   std::cout << foo;\n//\n// will print \"1 != 2\".\n//\n// Message is not intended to be inherited from.  In particular, its\n// destructor is not virtual.\n//\n// Note that stringstream behaves differently in gcc and in MSVC.  You\n// can stream a NULL char pointer to it in the former, but not in the\n// latter (it causes an access violation if you do).  The Message\n// class hides this difference by treating a NULL char pointer as\n// \"(null)\".\nclass GTEST_API_ Message {\n private:\n  // The type of basic IO manipulators (endl, ends, and flush) for\n  // narrow streams.\n  typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);\n\n public:\n  // Constructs an empty Message.\n  Message();\n\n  // Copy constructor.\n  Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT\n    *ss_ << msg.GetString();\n  }\n\n  // Constructs a Message from a C-string.\n  explicit Message(const char* str) : ss_(new ::std::stringstream) {\n    *ss_ << str;\n  }\n\n#if GTEST_OS_SYMBIAN\n  // Streams a value (either a pointer or not) to this object.\n  template <typename T>\n  inline Message& operator <<(const T& value) {\n    StreamHelper(typename internal::is_pointer<T>::type(), value);\n    return *this;\n  }\n#else\n  // Streams a non-pointer value to this object.\n  template <typename T>\n  inline Message& operator <<(const T& val) {\n    // Some libraries overload << for STL containers.  These\n    // overloads are defined in the global namespace instead of ::std.\n    //\n    // C++'s symbol lookup rule (i.e. Koenig lookup) says that these\n    // overloads are visible in either the std namespace or the global\n    // namespace, but not other namespaces, including the testing\n    // namespace which Google Test's Message class is in.\n    //\n    // To allow STL containers (and other types that has a << operator\n    // defined in the global namespace) to be used in Google Test\n    // assertions, testing::Message must access the custom << operator\n    // from the global namespace.  With this using declaration,\n    // overloads of << defined in the global namespace and those\n    // visible via Koenig lookup are both exposed in this function.\n    using ::operator <<;\n    *ss_ << val;\n    return *this;\n  }\n\n  // Streams a pointer value to this object.\n  //\n  // This function is an overload of the previous one.  When you\n  // stream a pointer to a Message, this definition will be used as it\n  // is more specialized.  (The C++ Standard, section\n  // [temp.func.order].)  If you stream a non-pointer, then the\n  // previous definition will be used.\n  //\n  // The reason for this overload is that streaming a NULL pointer to\n  // ostream is undefined behavior.  Depending on the compiler, you\n  // may get \"0\", \"(nil)\", \"(null)\", or an access violation.  To\n  // ensure consistent result across compilers, we always treat NULL\n  // as \"(null)\".\n  template <typename T>\n  inline Message& operator <<(T* const& pointer) {  // NOLINT\n    if (pointer == NULL) {\n      *ss_ << \"(null)\";\n    } else {\n      *ss_ << pointer;\n    }\n    return *this;\n  }\n#endif  // GTEST_OS_SYMBIAN\n\n  // Since the basic IO manipulators are overloaded for both narrow\n  // and wide streams, we have to provide this specialized definition\n  // of operator <<, even though its body is the same as the\n  // templatized version above.  Without this definition, streaming\n  // endl or other basic IO manipulators to Message will confuse the\n  // compiler.\n  Message& operator <<(BasicNarrowIoManip val) {\n    *ss_ << val;\n    return *this;\n  }\n\n  // Instead of 1/0, we want to see true/false for bool values.\n  Message& operator <<(bool b) {\n    return *this << (b ? \"true\" : \"false\");\n  }\n\n  // These two overloads allow streaming a wide C string to a Message\n  // using the UTF-8 encoding.\n  Message& operator <<(const wchar_t* wide_c_str);\n  Message& operator <<(wchar_t* wide_c_str);\n\n#if GTEST_HAS_STD_WSTRING\n  // Converts the given wide string to a narrow string using the UTF-8\n  // encoding, and streams the result to this Message object.\n  Message& operator <<(const ::std::wstring& wstr);\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\n  // Converts the given wide string to a narrow string using the UTF-8\n  // encoding, and streams the result to this Message object.\n  Message& operator <<(const ::wstring& wstr);\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n  // Gets the text streamed to this object so far as an std::string.\n  // Each '\\0' character in the buffer is replaced with \"\\\\0\".\n  //\n  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n  std::string GetString() const;\n\n private:\n\n#if GTEST_OS_SYMBIAN\n  // These are needed as the Nokia Symbian Compiler cannot decide between\n  // const T& and const T* in a function template. The Nokia compiler _can_\n  // decide between class template specializations for T and T*, so a\n  // tr1::type_traits-like is_pointer works, and we can overload on that.\n  template <typename T>\n  inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {\n    if (pointer == NULL) {\n      *ss_ << \"(null)\";\n    } else {\n      *ss_ << pointer;\n    }\n  }\n  template <typename T>\n  inline void StreamHelper(internal::false_type /*is_pointer*/,\n                           const T& value) {\n    // See the comments in Message& operator <<(const T&) above for why\n    // we need this using statement.\n    using ::operator <<;\n    *ss_ << value;\n  }\n#endif  // GTEST_OS_SYMBIAN\n\n  // We'll hold the text streamed to this object here.\n  const internal::scoped_ptr< ::std::stringstream> ss_;\n\n  // We declare (but don't implement) this to prevent the compiler\n  // from implementing the assignment operator.\n  void operator=(const Message&);\n};\n\n// Streams a Message to an ostream.\ninline std::ostream& operator <<(std::ostream& os, const Message& sb) {\n  return os << sb.GetString();\n}\n\nnamespace internal {\n\n// Converts a streamable value to an std::string.  A NULL pointer is\n// converted to \"(null)\".  When the input value is a ::string,\n// ::std::string, ::wstring, or ::std::wstring object, each NUL\n// character in it is replaced with \"\\\\0\".\ntemplate <typename T>\nstd::string StreamableToString(const T& streamable) {\n  return (Message() << streamable).GetString();\n}\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file declares the String class and functions used internally by\n// Google Test.  They are subject to change without notice. They should not used\n// by code external to Google Test.\n//\n// This header file is #included by <gtest/internal/gtest-internal.h>.\n// It should not be #included by other files.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_\n\n#ifdef __BORLANDC__\n// string.h is not guaranteed to provide strcpy on C++ Builder.\n# include <mem.h>\n#endif\n\n#include <string.h>\n#include <string>\n\n\nnamespace testing {\nnamespace internal {\n\n// String - an abstract class holding static string utilities.\nclass GTEST_API_ String {\n public:\n  // Static utility methods\n\n  // Clones a 0-terminated C string, allocating memory using new.  The\n  // caller is responsible for deleting the return value using\n  // delete[].  Returns the cloned string, or NULL if the input is\n  // NULL.\n  //\n  // This is different from strdup() in string.h, which allocates\n  // memory using malloc().\n  static const char* CloneCString(const char* c_str);\n\n#if GTEST_OS_WINDOWS_MOBILE\n  // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be\n  // able to pass strings to Win32 APIs on CE we need to convert them\n  // to 'Unicode', UTF-16.\n\n  // Creates a UTF-16 wide string from the given ANSI string, allocating\n  // memory using new. The caller is responsible for deleting the return\n  // value using delete[]. Returns the wide string, or NULL if the\n  // input is NULL.\n  //\n  // The wide string is created using the ANSI codepage (CP_ACP) to\n  // match the behaviour of the ANSI versions of Win32 calls and the\n  // C runtime.\n  static LPCWSTR AnsiToUtf16(const char* c_str);\n\n  // Creates an ANSI string from the given wide string, allocating\n  // memory using new. The caller is responsible for deleting the return\n  // value using delete[]. Returns the ANSI string, or NULL if the\n  // input is NULL.\n  //\n  // The returned string is created using the ANSI codepage (CP_ACP) to\n  // match the behaviour of the ANSI versions of Win32 calls and the\n  // C runtime.\n  static const char* Utf16ToAnsi(LPCWSTR utf16_str);\n#endif\n\n  // Compares two C strings.  Returns true iff they have the same content.\n  //\n  // Unlike strcmp(), this function can handle NULL argument(s).  A\n  // NULL C string is considered different to any non-NULL C string,\n  // including the empty string.\n  static bool CStringEquals(const char* lhs, const char* rhs);\n\n  // Converts a wide C string to a String using the UTF-8 encoding.\n  // NULL will be converted to \"(null)\".  If an error occurred during\n  // the conversion, \"(failed to convert from wide string)\" is\n  // returned.\n  static std::string ShowWideCString(const wchar_t* wide_c_str);\n\n  // Compares two wide C strings.  Returns true iff they have the same\n  // content.\n  //\n  // Unlike wcscmp(), this function can handle NULL argument(s).  A\n  // NULL C string is considered different to any non-NULL C string,\n  // including the empty string.\n  static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);\n\n  // Compares two C strings, ignoring case.  Returns true iff they\n  // have the same content.\n  //\n  // Unlike strcasecmp(), this function can handle NULL argument(s).\n  // A NULL C string is considered different to any non-NULL C string,\n  // including the empty string.\n  static bool CaseInsensitiveCStringEquals(const char* lhs,\n                                           const char* rhs);\n\n  // Compares two wide C strings, ignoring case.  Returns true iff they\n  // have the same content.\n  //\n  // Unlike wcscasecmp(), this function can handle NULL argument(s).\n  // A NULL C string is considered different to any non-NULL wide C string,\n  // including the empty string.\n  // NB: The implementations on different platforms slightly differ.\n  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE\n  // environment variable. On GNU platform this method uses wcscasecmp\n  // which compares according to LC_CTYPE category of the current locale.\n  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the\n  // current locale.\n  static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,\n                                               const wchar_t* rhs);\n\n  // Returns true iff the given string ends with the given suffix, ignoring\n  // case. Any string is considered to end with an empty suffix.\n  static bool EndsWithCaseInsensitive(\n      const std::string& str, const std::string& suffix);\n\n  // Formats an int value as \"%02d\".\n  static std::string FormatIntWidth2(int value);  // \"%02d\" for width == 2\n\n  // Formats an int value as \"%X\".\n  static std::string FormatHexInt(int value);\n\n  // Formats a byte as \"%02X\".\n  static std::string FormatByte(unsigned char value);\n\n private:\n  String();  // Not meant to be instantiated.\n};  // class String\n\n// Gets the content of the stringstream's buffer as an std::string.  Each '\\0'\n// character in the buffer is replaced with \"\\\\0\".\nGTEST_API_ std::string StringStreamToString(::std::stringstream* stream);\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: keith.ray@gmail.com (Keith Ray)\n//\n// Google Test filepath utilities\n//\n// This header file declares classes and functions used internally by\n// Google Test.  They are subject to change without notice.\n//\n// This file is #included in <gtest/internal/gtest-internal.h>.\n// Do not include this header file separately!\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_\n\n\nnamespace testing {\nnamespace internal {\n\n// FilePath - a class for file and directory pathname manipulation which\n// handles platform-specific conventions (like the pathname separator).\n// Used for helper functions for naming files in a directory for xml output.\n// Except for Set methods, all methods are const or static, which provides an\n// \"immutable value object\" -- useful for peace of mind.\n// A FilePath with a value ending in a path separator (\"like/this/\") represents\n// a directory, otherwise it is assumed to represent a file. In either case,\n// it may or may not represent an actual file or directory in the file system.\n// Names are NOT checked for syntax correctness -- no checking for illegal\n// characters, malformed paths, etc.\n\nclass GTEST_API_ FilePath {\n public:\n  FilePath() : pathname_(\"\") { }\n  FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }\n\n  explicit FilePath(const std::string& pathname) : pathname_(pathname) {\n    Normalize();\n  }\n\n  FilePath& operator=(const FilePath& rhs) {\n    Set(rhs);\n    return *this;\n  }\n\n  void Set(const FilePath& rhs) {\n    pathname_ = rhs.pathname_;\n  }\n\n  const std::string& string() const { return pathname_; }\n  const char* c_str() const { return pathname_.c_str(); }\n\n  // Returns the current working directory, or \"\" if unsuccessful.\n  static FilePath GetCurrentDir();\n\n  // Given directory = \"dir\", base_name = \"test\", number = 0,\n  // extension = \"xml\", returns \"dir/test.xml\". If number is greater\n  // than zero (e.g., 12), returns \"dir/test_12.xml\".\n  // On Windows platform, uses \\ as the separator rather than /.\n  static FilePath MakeFileName(const FilePath& directory,\n                               const FilePath& base_name,\n                               int number,\n                               const char* extension);\n\n  // Given directory = \"dir\", relative_path = \"test.xml\",\n  // returns \"dir/test.xml\".\n  // On Windows, uses \\ as the separator rather than /.\n  static FilePath ConcatPaths(const FilePath& directory,\n                              const FilePath& relative_path);\n\n  // Returns a pathname for a file that does not currently exist. The pathname\n  // will be directory/base_name.extension or\n  // directory/base_name_<number>.extension if directory/base_name.extension\n  // already exists. The number will be incremented until a pathname is found\n  // that does not already exist.\n  // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.\n  // There could be a race condition if two or more processes are calling this\n  // function at the same time -- they could both pick the same filename.\n  static FilePath GenerateUniqueFileName(const FilePath& directory,\n                                         const FilePath& base_name,\n                                         const char* extension);\n\n  // Returns true iff the path is \"\".\n  bool IsEmpty() const { return pathname_.empty(); }\n\n  // If input name has a trailing separator character, removes it and returns\n  // the name, otherwise return the name string unmodified.\n  // On Windows platform, uses \\ as the separator, other platforms use /.\n  FilePath RemoveTrailingPathSeparator() const;\n\n  // Returns a copy of the FilePath with the directory part removed.\n  // Example: FilePath(\"path/to/file\").RemoveDirectoryName() returns\n  // FilePath(\"file\"). If there is no directory part (\"just_a_file\"), it returns\n  // the FilePath unmodified. If there is no file part (\"just_a_dir/\") it\n  // returns an empty FilePath (\"\").\n  // On Windows platform, '\\' is the path separator, otherwise it is '/'.\n  FilePath RemoveDirectoryName() const;\n\n  // RemoveFileName returns the directory path with the filename removed.\n  // Example: FilePath(\"path/to/file\").RemoveFileName() returns \"path/to/\".\n  // If the FilePath is \"a_file\" or \"/a_file\", RemoveFileName returns\n  // FilePath(\"./\") or, on Windows, FilePath(\".\\\\\"). If the filepath does\n  // not have a file, like \"just/a/dir/\", it returns the FilePath unmodified.\n  // On Windows platform, '\\' is the path separator, otherwise it is '/'.\n  FilePath RemoveFileName() const;\n\n  // Returns a copy of the FilePath with the case-insensitive extension removed.\n  // Example: FilePath(\"dir/file.exe\").RemoveExtension(\"EXE\") returns\n  // FilePath(\"dir/file\"). If a case-insensitive extension is not\n  // found, returns a copy of the original FilePath.\n  FilePath RemoveExtension(const char* extension) const;\n\n  // Creates directories so that path exists. Returns true if successful or if\n  // the directories already exist; returns false if unable to create\n  // directories for any reason. Will also return false if the FilePath does\n  // not represent a directory (that is, it doesn't end with a path separator).\n  bool CreateDirectoriesRecursively() const;\n\n  // Create the directory so that path exists. Returns true if successful or\n  // if the directory already exists; returns false if unable to create the\n  // directory for any reason, including if the parent directory does not\n  // exist. Not named \"CreateDirectory\" because that's a macro on Windows.\n  bool CreateFolder() const;\n\n  // Returns true if FilePath describes something in the file-system,\n  // either a file, directory, or whatever, and that something exists.\n  bool FileOrDirectoryExists() const;\n\n  // Returns true if pathname describes a directory in the file-system\n  // that exists.\n  bool DirectoryExists() const;\n\n  // Returns true if FilePath ends with a path separator, which indicates that\n  // it is intended to represent a directory. Returns false otherwise.\n  // This does NOT check that a directory (or file) actually exists.\n  bool IsDirectory() const;\n\n  // Returns true if pathname describes a root directory. (Windows has one\n  // root directory per disk drive.)\n  bool IsRootDirectory() const;\n\n  // Returns true if pathname describes an absolute path.\n  bool IsAbsolutePath() const;\n\n private:\n  // Replaces multiple consecutive separators with a single separator.\n  // For example, \"bar///foo\" becomes \"bar/foo\". Does not eliminate other\n  // redundancies that might be in a pathname involving \".\" or \"..\".\n  //\n  // A pathname with multiple consecutive separators may occur either through\n  // user error or as a result of some scripts or APIs that generate a pathname\n  // with a trailing separator. On other platforms the same API or script\n  // may NOT generate a pathname with a trailing \"/\". Then elsewhere that\n  // pathname may have another \"/\" and pathname components added to it,\n  // without checking for the separator already being there.\n  // The script language and operating system may allow paths like \"foo//bar\"\n  // but some of the functions in FilePath will not handle that correctly. In\n  // particular, RemoveTrailingPathSeparator() only removes one separator, and\n  // it is called in CreateDirectoriesRecursively() assuming that it will change\n  // a pathname from directory syntax (trailing separator) to filename syntax.\n  //\n  // On Windows this method also replaces the alternate path separator '/' with\n  // the primary path separator '\\\\', so that for example \"bar\\\\/\\\\foo\" becomes\n  // \"bar\\\\foo\".\n\n  void Normalize();\n\n  // Returns a pointer to the last occurence of a valid path separator in\n  // the FilePath. On Windows, for example, both '/' and '\\' are valid path\n  // separators. Returns NULL if no path separator was found.\n  const char* FindLastPathSeparator() const;\n\n  std::string pathname_;\n};  // class FilePath\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_\n// This file was GENERATED by command:\n//     pump.py gtest-type-util.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Type utilities needed for implementing typed and type-parameterized\n// tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n// Currently we support at most 50 types in a list, and at most 50\n// type-parameterized tests in one type-parameterized test case.\n// Please contact googletestframework@googlegroups.com if you need\n// more.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n\n\n// #ifdef __GNUC__ is too general here.  It is possible to use gcc without using\n// libstdc++ (which is where cxxabi.h comes from).\n# if GTEST_HAS_CXXABI_H_\n#  include <cxxabi.h>\n# elif defined(__HP_aCC)\n#  include <acxx_demangle.h>\n# endif  // GTEST_HASH_CXXABI_H_\n\nnamespace testing {\nnamespace internal {\n\n// GetTypeName<T>() returns a human-readable name of type T.\n// NB: This function is also used in Google Mock, so don't move it inside of\n// the typed-test-only section below.\ntemplate <typename T>\nstd::string GetTypeName() {\n# if GTEST_HAS_RTTI\n\n  const char* const name = typeid(T).name();\n#  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)\n  int status = 0;\n  // gcc's implementation of typeid(T).name() mangles the type name,\n  // so we have to demangle it.\n#   if GTEST_HAS_CXXABI_H_\n  using abi::__cxa_demangle;\n#   endif  // GTEST_HAS_CXXABI_H_\n  char* const readable_name = __cxa_demangle(name, 0, 0, &status);\n  const std::string name_str(status == 0 ? readable_name : name);\n  free(readable_name);\n  return name_str;\n#  else\n  return name;\n#  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC\n\n# else\n\n  return \"<type>\";\n\n# endif  // GTEST_HAS_RTTI\n}\n\n#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same\n// type.  This can be used as a compile-time assertion to ensure that\n// two types are equal.\n\ntemplate <typename T1, typename T2>\nstruct AssertTypeEq;\n\ntemplate <typename T>\nstruct AssertTypeEq<T, T> {\n  typedef bool type;\n};\n\n// A unique type used as the default value for the arguments of class\n// template Types.  This allows us to simulate variadic templates\n// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't\n// support directly.\nstruct None {};\n\n// The following family of struct and struct templates are used to\n// represent type lists.  In particular, TypesN<T1, T2, ..., TN>\n// represents a type list with N types (T1, T2, ..., and TN) in it.\n// Except for Types0, every struct in the family has two member types:\n// Head for the first type in the list, and Tail for the rest of the\n// list.\n\n// The empty type list.\nstruct Types0 {};\n\n// Type lists of length 1, 2, 3, and so on.\n\ntemplate <typename T1>\nstruct Types1 {\n  typedef T1 Head;\n  typedef Types0 Tail;\n};\ntemplate <typename T1, typename T2>\nstruct Types2 {\n  typedef T1 Head;\n  typedef Types1<T2> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3>\nstruct Types3 {\n  typedef T1 Head;\n  typedef Types2<T2, T3> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nstruct Types4 {\n  typedef T1 Head;\n  typedef Types3<T2, T3, T4> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nstruct Types5 {\n  typedef T1 Head;\n  typedef Types4<T2, T3, T4, T5> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nstruct Types6 {\n  typedef T1 Head;\n  typedef Types5<T2, T3, T4, T5, T6> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nstruct Types7 {\n  typedef T1 Head;\n  typedef Types6<T2, T3, T4, T5, T6, T7> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nstruct Types8 {\n  typedef T1 Head;\n  typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nstruct Types9 {\n  typedef T1 Head;\n  typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nstruct Types10 {\n  typedef T1 Head;\n  typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\nstruct Types11 {\n  typedef T1 Head;\n  typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\nstruct Types12 {\n  typedef T1 Head;\n  typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\nstruct Types13 {\n  typedef T1 Head;\n  typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\nstruct Types14 {\n  typedef T1 Head;\n  typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\nstruct Types15 {\n  typedef T1 Head;\n  typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\nstruct Types16 {\n  typedef T1 Head;\n  typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\nstruct Types17 {\n  typedef T1 Head;\n  typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\nstruct Types18 {\n  typedef T1 Head;\n  typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\nstruct Types19 {\n  typedef T1 Head;\n  typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\nstruct Types20 {\n  typedef T1 Head;\n  typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\nstruct Types21 {\n  typedef T1 Head;\n  typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\nstruct Types22 {\n  typedef T1 Head;\n  typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\nstruct Types23 {\n  typedef T1 Head;\n  typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\nstruct Types24 {\n  typedef T1 Head;\n  typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\nstruct Types25 {\n  typedef T1 Head;\n  typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\nstruct Types26 {\n  typedef T1 Head;\n  typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\nstruct Types27 {\n  typedef T1 Head;\n  typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\nstruct Types28 {\n  typedef T1 Head;\n  typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\nstruct Types29 {\n  typedef T1 Head;\n  typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\nstruct Types30 {\n  typedef T1 Head;\n  typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\nstruct Types31 {\n  typedef T1 Head;\n  typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\nstruct Types32 {\n  typedef T1 Head;\n  typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\nstruct Types33 {\n  typedef T1 Head;\n  typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\nstruct Types34 {\n  typedef T1 Head;\n  typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\nstruct Types35 {\n  typedef T1 Head;\n  typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\nstruct Types36 {\n  typedef T1 Head;\n  typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\nstruct Types37 {\n  typedef T1 Head;\n  typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\nstruct Types38 {\n  typedef T1 Head;\n  typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\nstruct Types39 {\n  typedef T1 Head;\n  typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\nstruct Types40 {\n  typedef T1 Head;\n  typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\nstruct Types41 {\n  typedef T1 Head;\n  typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\nstruct Types42 {\n  typedef T1 Head;\n  typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\nstruct Types43 {\n  typedef T1 Head;\n  typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\nstruct Types44 {\n  typedef T1 Head;\n  typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\nstruct Types45 {\n  typedef T1 Head;\n  typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\nstruct Types46 {\n  typedef T1 Head;\n  typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\nstruct Types47 {\n  typedef T1 Head;\n  typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\nstruct Types48 {\n  typedef T1 Head;\n  typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47, T48> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\nstruct Types49 {\n  typedef T1 Head;\n  typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47, T48, T49> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\nstruct Types50 {\n  typedef T1 Head;\n  typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47, T48, T49, T50> Tail;\n};\n\n\n}  // namespace internal\n\n// We don't want to require the users to write TypesN<...> directly,\n// as that would require them to count the length.  Types<...> is much\n// easier to write, but generates horrible messages when there is a\n// compiler error, as gcc insists on printing out each template\n// argument, even if it has the default value (this means Types<int>\n// will appear as Types<int, None, None, ..., None> in the compiler\n// errors).\n//\n// Our solution is to combine the best part of the two approaches: a\n// user would write Types<T1, ..., TN>, and Google Test will translate\n// that to TypesN<T1, ..., TN> internally to make error messages\n// readable.  The translation is done by the 'type' member of the\n// Types template.\ntemplate <typename T1 = internal::None, typename T2 = internal::None,\n    typename T3 = internal::None, typename T4 = internal::None,\n    typename T5 = internal::None, typename T6 = internal::None,\n    typename T7 = internal::None, typename T8 = internal::None,\n    typename T9 = internal::None, typename T10 = internal::None,\n    typename T11 = internal::None, typename T12 = internal::None,\n    typename T13 = internal::None, typename T14 = internal::None,\n    typename T15 = internal::None, typename T16 = internal::None,\n    typename T17 = internal::None, typename T18 = internal::None,\n    typename T19 = internal::None, typename T20 = internal::None,\n    typename T21 = internal::None, typename T22 = internal::None,\n    typename T23 = internal::None, typename T24 = internal::None,\n    typename T25 = internal::None, typename T26 = internal::None,\n    typename T27 = internal::None, typename T28 = internal::None,\n    typename T29 = internal::None, typename T30 = internal::None,\n    typename T31 = internal::None, typename T32 = internal::None,\n    typename T33 = internal::None, typename T34 = internal::None,\n    typename T35 = internal::None, typename T36 = internal::None,\n    typename T37 = internal::None, typename T38 = internal::None,\n    typename T39 = internal::None, typename T40 = internal::None,\n    typename T41 = internal::None, typename T42 = internal::None,\n    typename T43 = internal::None, typename T44 = internal::None,\n    typename T45 = internal::None, typename T46 = internal::None,\n    typename T47 = internal::None, typename T48 = internal::None,\n    typename T49 = internal::None, typename T50 = internal::None>\nstruct Types {\n  typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;\n};\n\ntemplate <>\nstruct Types<internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types0 type;\n};\ntemplate <typename T1>\nstruct Types<T1, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types1<T1> type;\n};\ntemplate <typename T1, typename T2>\nstruct Types<T1, T2, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types2<T1, T2> type;\n};\ntemplate <typename T1, typename T2, typename T3>\nstruct Types<T1, T2, T3, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types3<T1, T2, T3> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4>\nstruct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types4<T1, T2, T3, T4> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nstruct Types<T1, T2, T3, T4, T5, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types5<T1, T2, T3, T4, T5> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nstruct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, T47, internal::None, internal::None, internal::None> {\n  typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, T47, T48, internal::None, internal::None> {\n  typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, T47, T48, T49, internal::None> {\n  typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48, T49> type;\n};\n\nnamespace internal {\n\n# define GTEST_TEMPLATE_ template <typename T> class\n\n// The template \"selector\" struct TemplateSel<Tmpl> is used to\n// represent Tmpl, which must be a class template with one type\n// parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined\n// as the type Tmpl<T>.  This allows us to actually instantiate the\n// template \"selected\" by TemplateSel<Tmpl>.\n//\n// This trick is necessary for simulating typedef for class templates,\n// which C++ doesn't support directly.\ntemplate <GTEST_TEMPLATE_ Tmpl>\nstruct TemplateSel {\n  template <typename T>\n  struct Bind {\n    typedef Tmpl<T> type;\n  };\n};\n\n# define GTEST_BIND_(TmplSel, T) \\\n  TmplSel::template Bind<T>::type\n\n// A unique struct template used as the default value for the\n// arguments of class template Templates.  This allows us to simulate\n// variadic templates (e.g. Templates<int>, Templates<int, double>,\n// and etc), which C++ doesn't support directly.\ntemplate <typename T>\nstruct NoneT {};\n\n// The following family of struct and struct templates are used to\n// represent template lists.  In particular, TemplatesN<T1, T2, ...,\n// TN> represents a list of N templates (T1, T2, ..., and TN).  Except\n// for Templates0, every struct in the family has two member types:\n// Head for the selector of the first template in the list, and Tail\n// for the rest of the list.\n\n// The empty template list.\nstruct Templates0 {};\n\n// Template lists of length 1, 2, 3, and so on.\n\ntemplate <GTEST_TEMPLATE_ T1>\nstruct Templates1 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates0 Tail;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>\nstruct Templates2 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates1<T2> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>\nstruct Templates3 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates2<T2, T3> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4>\nstruct Templates4 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates3<T2, T3, T4> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>\nstruct Templates5 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates4<T2, T3, T4, T5> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>\nstruct Templates6 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates5<T2, T3, T4, T5, T6> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7>\nstruct Templates7 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>\nstruct Templates8 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>\nstruct Templates9 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10>\nstruct Templates10 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>\nstruct Templates11 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>\nstruct Templates12 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13>\nstruct Templates13 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>\nstruct Templates14 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>\nstruct Templates15 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16>\nstruct Templates16 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>\nstruct Templates17 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>\nstruct Templates18 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19>\nstruct Templates19 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>\nstruct Templates20 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>\nstruct Templates21 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22>\nstruct Templates22 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>\nstruct Templates23 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>\nstruct Templates24 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25>\nstruct Templates25 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>\nstruct Templates26 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>\nstruct Templates27 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28>\nstruct Templates28 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>\nstruct Templates29 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>\nstruct Templates30 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31>\nstruct Templates31 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>\nstruct Templates32 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>\nstruct Templates33 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34>\nstruct Templates34 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>\nstruct Templates35 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>\nstruct Templates36 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37>\nstruct Templates37 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>\nstruct Templates38 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>\nstruct Templates39 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40>\nstruct Templates40 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>\nstruct Templates41 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>\nstruct Templates42 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43>\nstruct Templates43 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>\nstruct Templates44 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>\nstruct Templates45 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46>\nstruct Templates46 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>\nstruct Templates47 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>\nstruct Templates48 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47, T48> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,\n    GTEST_TEMPLATE_ T49>\nstruct Templates49 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47, T48, T49> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,\n    GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>\nstruct Templates50 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47, T48, T49, T50> Tail;\n};\n\n\n// We don't want to require the users to write TemplatesN<...> directly,\n// as that would require them to count the length.  Templates<...> is much\n// easier to write, but generates horrible messages when there is a\n// compiler error, as gcc insists on printing out each template\n// argument, even if it has the default value (this means Templates<list>\n// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler\n// errors).\n//\n// Our solution is to combine the best part of the two approaches: a\n// user would write Templates<T1, ..., TN>, and Google Test will translate\n// that to TemplatesN<T1, ..., TN> internally to make error messages\n// readable.  The translation is done by the 'type' member of the\n// Templates template.\ntemplate <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,\n    GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,\n    GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,\n    GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,\n    GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,\n    GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,\n    GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,\n    GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,\n    GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,\n    GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,\n    GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,\n    GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,\n    GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,\n    GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,\n    GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,\n    GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,\n    GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,\n    GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,\n    GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,\n    GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,\n    GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,\n    GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,\n    GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,\n    GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,\n    GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>\nstruct Templates {\n  typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47, T48, T49, T50> type;\n};\n\ntemplate <>\nstruct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates0 type;\n};\ntemplate <GTEST_TEMPLATE_ T1>\nstruct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates1<T1> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>\nstruct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates2<T1, T2> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>\nstruct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates3<T1, T2, T3> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4>\nstruct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates4<T1, T2, T3, T4> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>\nstruct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates5<T1, T2, T3, T4, T5> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>\nstruct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates6<T1, T2, T3, T4, T5, T6> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT> {\n  typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT> {\n  typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT> {\n  typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, T47, NoneT, NoneT, NoneT> {\n  typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, T47, T48, NoneT, NoneT> {\n  typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47, T48> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,\n    GTEST_TEMPLATE_ T49>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, T47, T48, T49, NoneT> {\n  typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47, T48, T49> type;\n};\n\n// The TypeList template makes it possible to use either a single type\n// or a Types<...> list in TYPED_TEST_CASE() and\n// INSTANTIATE_TYPED_TEST_CASE_P().\n\ntemplate <typename T>\nstruct TypeList {\n  typedef Types1<T> type;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\nstruct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48, T49, T50> > {\n  typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;\n};\n\n#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n\n// Due to C++ preprocessor weirdness, we need double indirection to\n// concatenate two tokens when one of them is __LINE__.  Writing\n//\n//   foo ## __LINE__\n//\n// will result in the token foo__LINE__, instead of foo followed by\n// the current line number.  For more details, see\n// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6\n#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)\n#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar\n\nclass ProtocolMessage;\nnamespace proto2 { class Message; }\n\nnamespace testing {\n\n// Forward declarations.\n\nclass AssertionResult;                 // Result of an assertion.\nclass Message;                         // Represents a failure message.\nclass Test;                            // Represents a test.\nclass TestInfo;                        // Information about a test.\nclass TestPartResult;                  // Result of a test part.\nclass UnitTest;                        // A collection of test cases.\n\ntemplate <typename T>\n::std::string PrintToString(const T& value);\n\nnamespace internal {\n\nstruct TraceInfo;                      // Information about a trace point.\nclass ScopedTrace;                     // Implements scoped trace.\nclass TestInfoImpl;                    // Opaque implementation of TestInfo\nclass UnitTestImpl;                    // Opaque implementation of UnitTest\n\n// How many times InitGoogleTest() has been called.\nGTEST_API_ extern int g_init_gtest_count;\n\n// The text used in failure messages to indicate the start of the\n// stack trace.\nGTEST_API_ extern const char kStackTraceMarker[];\n\n// Two overloaded helpers for checking at compile time whether an\n// expression is a null pointer literal (i.e. NULL or any 0-valued\n// compile-time integral constant).  Their return values have\n// different sizes, so we can use sizeof() to test which version is\n// picked by the compiler.  These helpers have no implementations, as\n// we only need their signatures.\n//\n// Given IsNullLiteralHelper(x), the compiler will pick the first\n// version if x can be implicitly converted to Secret*, and pick the\n// second version otherwise.  Since Secret is a secret and incomplete\n// type, the only expression a user can write that has type Secret* is\n// a null pointer literal.  Therefore, we know that x is a null\n// pointer literal if and only if the first version is picked by the\n// compiler.\nchar IsNullLiteralHelper(Secret* p);\nchar (&IsNullLiteralHelper(...))[2];  // NOLINT\n\n// A compile-time bool constant that is true if and only if x is a\n// null pointer literal (i.e. NULL or any 0-valued compile-time\n// integral constant).\n#ifdef GTEST_ELLIPSIS_NEEDS_POD_\n// We lose support for NULL detection where the compiler doesn't like\n// passing non-POD classes through ellipsis (...).\n# define GTEST_IS_NULL_LITERAL_(x) false\n#else\n# define GTEST_IS_NULL_LITERAL_(x) \\\n    (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)\n#endif  // GTEST_ELLIPSIS_NEEDS_POD_\n\n// Appends the user-supplied message to the Google-Test-generated message.\nGTEST_API_ std::string AppendUserMessage(\n    const std::string& gtest_msg, const Message& user_msg);\n\n#if GTEST_HAS_EXCEPTIONS\n\n// This exception is thrown by (and only by) a failed Google Test\n// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions\n// are enabled).  We derive it from std::runtime_error, which is for\n// errors presumably detectable only at run time.  Since\n// std::runtime_error inherits from std::exception, many testing\n// frameworks know how to extract and print the message inside it.\nclass GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {\n public:\n  explicit GoogleTestFailureException(const TestPartResult& failure);\n};\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// A helper class for creating scoped traces in user programs.\nclass GTEST_API_ ScopedTrace {\n public:\n  // The c'tor pushes the given source file location and message onto\n  // a trace stack maintained by Google Test.\n  ScopedTrace(const char* file, int line, const Message& message);\n\n  // The d'tor pops the info pushed by the c'tor.\n  //\n  // Note that the d'tor is not virtual in order to be efficient.\n  // Don't inherit from ScopedTrace!\n  ~ScopedTrace();\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);\n} GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its\n                            // c'tor and d'tor.  Therefore it doesn't\n                            // need to be used otherwise.\n\n// Constructs and returns the message for an equality assertion\n// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.\n//\n// The first four parameters are the expressions used in the assertion\n// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)\n// where foo is 5 and bar is 6, we have:\n//\n//   expected_expression: \"foo\"\n//   actual_expression:   \"bar\"\n//   expected_value:      \"5\"\n//   actual_value:        \"6\"\n//\n// The ignoring_case parameter is true iff the assertion is a\n// *_STRCASEEQ*.  When it's true, the string \" (ignoring case)\" will\n// be inserted into the message.\nGTEST_API_ AssertionResult EqFailure(const char* expected_expression,\n                                     const char* actual_expression,\n                                     const std::string& expected_value,\n                                     const std::string& actual_value,\n                                     bool ignoring_case);\n\n// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.\nGTEST_API_ std::string GetBoolAssertionFailureMessage(\n    const AssertionResult& assertion_result,\n    const char* expression_text,\n    const char* actual_predicate_value,\n    const char* expected_predicate_value);\n\n// This template class represents an IEEE floating-point number\n// (either single-precision or double-precision, depending on the\n// template parameters).\n//\n// The purpose of this class is to do more sophisticated number\n// comparison.  (Due to round-off error, etc, it's very unlikely that\n// two floating-points will be equal exactly.  Hence a naive\n// comparison by the == operation often doesn't work.)\n//\n// Format of IEEE floating-point:\n//\n//   The most-significant bit being the leftmost, an IEEE\n//   floating-point looks like\n//\n//     sign_bit exponent_bits fraction_bits\n//\n//   Here, sign_bit is a single bit that designates the sign of the\n//   number.\n//\n//   For float, there are 8 exponent bits and 23 fraction bits.\n//\n//   For double, there are 11 exponent bits and 52 fraction bits.\n//\n//   More details can be found at\n//   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.\n//\n// Template parameter:\n//\n//   RawType: the raw floating-point type (either float or double)\ntemplate <typename RawType>\nclass FloatingPoint {\n public:\n  // Defines the unsigned integer type that has the same size as the\n  // floating point number.\n  typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;\n\n  // Constants.\n\n  // # of bits in a number.\n  static const size_t kBitCount = 8*sizeof(RawType);\n\n  // # of fraction bits in a number.\n  static const size_t kFractionBitCount =\n    std::numeric_limits<RawType>::digits - 1;\n\n  // # of exponent bits in a number.\n  static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;\n\n  // The mask for the sign bit.\n  static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);\n\n  // The mask for the fraction bits.\n  static const Bits kFractionBitMask =\n    ~static_cast<Bits>(0) >> (kExponentBitCount + 1);\n\n  // The mask for the exponent bits.\n  static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);\n\n  // How many ULP's (Units in the Last Place) we want to tolerate when\n  // comparing two numbers.  The larger the value, the more error we\n  // allow.  A 0 value means that two numbers must be exactly the same\n  // to be considered equal.\n  //\n  // The maximum error of a single floating-point operation is 0.5\n  // units in the last place.  On Intel CPU's, all floating-point\n  // calculations are done with 80-bit precision, while double has 64\n  // bits.  Therefore, 4 should be enough for ordinary use.\n  //\n  // See the following article for more details on ULP:\n  // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/\n  static const size_t kMaxUlps = 4;\n\n  // Constructs a FloatingPoint from a raw floating-point number.\n  //\n  // On an Intel CPU, passing a non-normalized NAN (Not a Number)\n  // around may change its bits, although the new value is guaranteed\n  // to be also a NAN.  Therefore, don't expect this constructor to\n  // preserve the bits in x when x is a NAN.\n  explicit FloatingPoint(const RawType& x) { u_.value_ = x; }\n\n  // Static methods\n\n  // Reinterprets a bit pattern as a floating-point number.\n  //\n  // This function is needed to test the AlmostEquals() method.\n  static RawType ReinterpretBits(const Bits bits) {\n    FloatingPoint fp(0);\n    fp.u_.bits_ = bits;\n    return fp.u_.value_;\n  }\n\n  // Returns the floating-point number that represent positive infinity.\n  static RawType Infinity() {\n    return ReinterpretBits(kExponentBitMask);\n  }\n\n  // Returns the maximum representable finite floating-point number.\n  static RawType Max();\n\n  // Non-static methods\n\n  // Returns the bits that represents this number.\n  const Bits &bits() const { return u_.bits_; }\n\n  // Returns the exponent bits of this number.\n  Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }\n\n  // Returns the fraction bits of this number.\n  Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }\n\n  // Returns the sign bit of this number.\n  Bits sign_bit() const { return kSignBitMask & u_.bits_; }\n\n  // Returns true iff this is NAN (not a number).\n  bool is_nan() const {\n    // It's a NAN if the exponent bits are all ones and the fraction\n    // bits are not entirely zeros.\n    return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);\n  }\n\n  // Returns true iff this number is at most kMaxUlps ULP's away from\n  // rhs.  In particular, this function:\n  //\n  //   - returns false if either number is (or both are) NAN.\n  //   - treats really large numbers as almost equal to infinity.\n  //   - thinks +0.0 and -0.0 are 0 DLP's apart.\n  bool AlmostEquals(const FloatingPoint& rhs) const {\n    // The IEEE standard says that any comparison operation involving\n    // a NAN must return false.\n    if (is_nan() || rhs.is_nan()) return false;\n\n    return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)\n        <= kMaxUlps;\n  }\n\n private:\n  // The data type used to store the actual floating-point number.\n  union FloatingPointUnion {\n    RawType value_;  // The raw floating-point number.\n    Bits bits_;      // The bits that represent the number.\n  };\n\n  // Converts an integer from the sign-and-magnitude representation to\n  // the biased representation.  More precisely, let N be 2 to the\n  // power of (kBitCount - 1), an integer x is represented by the\n  // unsigned number x + N.\n  //\n  // For instance,\n  //\n  //   -N + 1 (the most negative number representable using\n  //          sign-and-magnitude) is represented by 1;\n  //   0      is represented by N; and\n  //   N - 1  (the biggest number representable using\n  //          sign-and-magnitude) is represented by 2N - 1.\n  //\n  // Read http://en.wikipedia.org/wiki/Signed_number_representations\n  // for more details on signed number representations.\n  static Bits SignAndMagnitudeToBiased(const Bits &sam) {\n    if (kSignBitMask & sam) {\n      // sam represents a negative number.\n      return ~sam + 1;\n    } else {\n      // sam represents a positive number.\n      return kSignBitMask | sam;\n    }\n  }\n\n  // Given two numbers in the sign-and-magnitude representation,\n  // returns the distance between them as an unsigned number.\n  static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,\n                                                     const Bits &sam2) {\n    const Bits biased1 = SignAndMagnitudeToBiased(sam1);\n    const Bits biased2 = SignAndMagnitudeToBiased(sam2);\n    return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);\n  }\n\n  FloatingPointUnion u_;\n};\n\n// We cannot use std::numeric_limits<T>::max() as it clashes with the max()\n// macro defined by <windows.h>.\ntemplate <>\ninline float FloatingPoint<float>::Max() { return FLT_MAX; }\ntemplate <>\ninline double FloatingPoint<double>::Max() { return DBL_MAX; }\n\n// Typedefs the instances of the FloatingPoint template class that we\n// care to use.\ntypedef FloatingPoint<float> Float;\ntypedef FloatingPoint<double> Double;\n\n// In order to catch the mistake of putting tests that use different\n// test fixture classes in the same test case, we need to assign\n// unique IDs to fixture classes and compare them.  The TypeId type is\n// used to hold such IDs.  The user should treat TypeId as an opaque\n// type: the only operation allowed on TypeId values is to compare\n// them for equality using the == operator.\ntypedef const void* TypeId;\n\ntemplate <typename T>\nclass TypeIdHelper {\n public:\n  // dummy_ must not have a const type.  Otherwise an overly eager\n  // compiler (e.g. MSVC 7.1 & 8.0) may try to merge\n  // TypeIdHelper<T>::dummy_ for different Ts as an \"optimization\".\n  static bool dummy_;\n};\n\ntemplate <typename T>\nbool TypeIdHelper<T>::dummy_ = false;\n\n// GetTypeId<T>() returns the ID of type T.  Different values will be\n// returned for different types.  Calling the function twice with the\n// same type argument is guaranteed to return the same ID.\ntemplate <typename T>\nTypeId GetTypeId() {\n  // The compiler is required to allocate a different\n  // TypeIdHelper<T>::dummy_ variable for each T used to instantiate\n  // the template.  Therefore, the address of dummy_ is guaranteed to\n  // be unique.\n  return &(TypeIdHelper<T>::dummy_);\n}\n\n// Returns the type ID of ::testing::Test.  Always call this instead\n// of GetTypeId< ::testing::Test>() to get the type ID of\n// ::testing::Test, as the latter may give the wrong result due to a\n// suspected linker bug when compiling Google Test as a Mac OS X\n// framework.\nGTEST_API_ TypeId GetTestTypeId();\n\n// Defines the abstract factory interface that creates instances\n// of a Test object.\nclass TestFactoryBase {\n public:\n  virtual ~TestFactoryBase() {}\n\n  // Creates a test instance to run. The instance is both created and destroyed\n  // within TestInfoImpl::Run()\n  virtual Test* CreateTest() = 0;\n\n protected:\n  TestFactoryBase() {}\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);\n};\n\n// This class provides implementation of TeastFactoryBase interface.\n// It is used in TEST and TEST_F macros.\ntemplate <class TestClass>\nclass TestFactoryImpl : public TestFactoryBase {\n public:\n  virtual Test* CreateTest() { return new TestClass; }\n};\n\n#if GTEST_OS_WINDOWS\n\n// Predicate-formatters for implementing the HRESULT checking macros\n// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}\n// We pass a long instead of HRESULT to avoid causing an\n// include dependency for the HRESULT type.\nGTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,\n                                            long hr);  // NOLINT\nGTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,\n                                            long hr);  // NOLINT\n\n#endif  // GTEST_OS_WINDOWS\n\n// Types of SetUpTestCase() and TearDownTestCase() functions.\ntypedef void (*SetUpTestCaseFunc)();\ntypedef void (*TearDownTestCaseFunc)();\n\n// Creates a new TestInfo object and registers it with Google Test;\n// returns the created object.\n//\n// Arguments:\n//\n//   test_case_name:   name of the test case\n//   name:             name of the test\n//   type_param        the name of the test's type parameter, or NULL if\n//                     this is not a typed or a type-parameterized test.\n//   value_param       text representation of the test's value parameter,\n//                     or NULL if this is not a type-parameterized test.\n//   fixture_class_id: ID of the test fixture class\n//   set_up_tc:        pointer to the function that sets up the test case\n//   tear_down_tc:     pointer to the function that tears down the test case\n//   factory:          pointer to the factory that creates a test object.\n//                     The newly created TestInfo instance will assume\n//                     ownership of the factory object.\nGTEST_API_ TestInfo* MakeAndRegisterTestInfo(\n    const char* test_case_name,\n    const char* name,\n    const char* type_param,\n    const char* value_param,\n    TypeId fixture_class_id,\n    SetUpTestCaseFunc set_up_tc,\n    TearDownTestCaseFunc tear_down_tc,\n    TestFactoryBase* factory);\n\n// If *pstr starts with the given prefix, modifies *pstr to be right\n// past the prefix and returns true; otherwise leaves *pstr unchanged\n// and returns false.  None of pstr, *pstr, and prefix can be NULL.\nGTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);\n\n#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// State of the definition of a type-parameterized test case.\nclass GTEST_API_ TypedTestCasePState {\n public:\n  TypedTestCasePState() : registered_(false) {}\n\n  // Adds the given test name to defined_test_names_ and return true\n  // if the test case hasn't been registered; otherwise aborts the\n  // program.\n  bool AddTestName(const char* file, int line, const char* case_name,\n                   const char* test_name) {\n    if (registered_) {\n      fprintf(stderr, \"%s Test %s must be defined before \"\n              \"REGISTER_TYPED_TEST_CASE_P(%s, ...).\\n\",\n              FormatFileLocation(file, line).c_str(), test_name, case_name);\n      fflush(stderr);\n      posix::Abort();\n    }\n    defined_test_names_.insert(test_name);\n    return true;\n  }\n\n  // Verifies that registered_tests match the test names in\n  // defined_test_names_; returns registered_tests if successful, or\n  // aborts the program otherwise.\n  const char* VerifyRegisteredTestNames(\n      const char* file, int line, const char* registered_tests);\n\n private:\n  bool registered_;\n  ::std::set<const char*> defined_test_names_;\n};\n\n// Skips to the first non-space char after the first comma in 'str';\n// returns NULL if no comma is found in 'str'.\ninline const char* SkipComma(const char* str) {\n  const char* comma = strchr(str, ',');\n  if (comma == NULL) {\n    return NULL;\n  }\n  while (IsSpace(*(++comma))) {}\n  return comma;\n}\n\n// Returns the prefix of 'str' before the first comma in it; returns\n// the entire string if it contains no comma.\ninline std::string GetPrefixUntilComma(const char* str) {\n  const char* comma = strchr(str, ',');\n  return comma == NULL ? str : std::string(str, comma);\n}\n\n// TypeParameterizedTest<Fixture, TestSel, Types>::Register()\n// registers a list of type-parameterized tests with Google Test.  The\n// return value is insignificant - we just need to return something\n// such that we can call this function in a namespace scope.\n//\n// Implementation note: The GTEST_TEMPLATE_ macro declares a template\n// template parameter.  It's defined in gtest-type-util.h.\ntemplate <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>\nclass TypeParameterizedTest {\n public:\n  // 'index' is the index of the test in the type list 'Types'\n  // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,\n  // Types).  Valid values for 'index' are [0, N - 1] where N is the\n  // length of Types.\n  static bool Register(const char* prefix, const char* case_name,\n                       const char* test_names, int index) {\n    typedef typename Types::Head Type;\n    typedef Fixture<Type> FixtureClass;\n    typedef typename GTEST_BIND_(TestSel, Type) TestClass;\n\n    // First, registers the first type-parameterized test in the type\n    // list.\n    MakeAndRegisterTestInfo(\n        (std::string(prefix) + (prefix[0] == '\\0' ? \"\" : \"/\") + case_name + \"/\"\n         + StreamableToString(index)).c_str(),\n        GetPrefixUntilComma(test_names).c_str(),\n        GetTypeName<Type>().c_str(),\n        NULL,  // No value parameter.\n        GetTypeId<FixtureClass>(),\n        TestClass::SetUpTestCase,\n        TestClass::TearDownTestCase,\n        new TestFactoryImpl<TestClass>);\n\n    // Next, recurses (at compile time) with the tail of the type list.\n    return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>\n        ::Register(prefix, case_name, test_names, index + 1);\n  }\n};\n\n// The base case for the compile time recursion.\ntemplate <GTEST_TEMPLATE_ Fixture, class TestSel>\nclass TypeParameterizedTest<Fixture, TestSel, Types0> {\n public:\n  static bool Register(const char* /*prefix*/, const char* /*case_name*/,\n                       const char* /*test_names*/, int /*index*/) {\n    return true;\n  }\n};\n\n// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()\n// registers *all combinations* of 'Tests' and 'Types' with Google\n// Test.  The return value is insignificant - we just need to return\n// something such that we can call this function in a namespace scope.\ntemplate <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>\nclass TypeParameterizedTestCase {\n public:\n  static bool Register(const char* prefix, const char* case_name,\n                       const char* test_names) {\n    typedef typename Tests::Head Head;\n\n    // First, register the first test in 'Test' for each type in 'Types'.\n    TypeParameterizedTest<Fixture, Head, Types>::Register(\n        prefix, case_name, test_names, 0);\n\n    // Next, recurses (at compile time) with the tail of the test list.\n    return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>\n        ::Register(prefix, case_name, SkipComma(test_names));\n  }\n};\n\n// The base case for the compile time recursion.\ntemplate <GTEST_TEMPLATE_ Fixture, typename Types>\nclass TypeParameterizedTestCase<Fixture, Templates0, Types> {\n public:\n  static bool Register(const char* /*prefix*/, const char* /*case_name*/,\n                       const char* /*test_names*/) {\n    return true;\n  }\n};\n\n#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// Returns the current OS stack trace as an std::string.\n//\n// The maximum number of stack frames to be included is specified by\n// the gtest_stack_trace_depth flag.  The skip_count parameter\n// specifies the number of top frames to be skipped, which doesn't\n// count against the number of frames to be included.\n//\n// For example, if Foo() calls Bar(), which in turn calls\n// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in\n// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.\nGTEST_API_ std::string GetCurrentOsStackTraceExceptTop(\n    UnitTest* unit_test, int skip_count);\n\n// Helpers for suppressing warnings on unreachable code or constant\n// condition.\n\n// Always returns true.\nGTEST_API_ bool AlwaysTrue();\n\n// Always returns false.\ninline bool AlwaysFalse() { return !AlwaysTrue(); }\n\n// Helper for suppressing false warning from Clang on a const char*\n// variable declared in a conditional expression always being NULL in\n// the else branch.\nstruct GTEST_API_ ConstCharPtr {\n  ConstCharPtr(const char* str) : value(str) {}\n  operator bool() const { return true; }\n  const char* value;\n};\n\n// A simple Linear Congruential Generator for generating random\n// numbers with a uniform distribution.  Unlike rand() and srand(), it\n// doesn't use global state (and therefore can't interfere with user\n// code).  Unlike rand_r(), it's portable.  An LCG isn't very random,\n// but it's good enough for our purposes.\nclass GTEST_API_ Random {\n public:\n  static const UInt32 kMaxRange = 1u << 31;\n\n  explicit Random(UInt32 seed) : state_(seed) {}\n\n  void Reseed(UInt32 seed) { state_ = seed; }\n\n  // Generates a random number from [0, range).  Crashes if 'range' is\n  // 0 or greater than kMaxRange.\n  UInt32 Generate(UInt32 range);\n\n private:\n  UInt32 state_;\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);\n};\n\n// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a\n// compiler error iff T1 and T2 are different types.\ntemplate <typename T1, typename T2>\nstruct CompileAssertTypesEqual;\n\ntemplate <typename T>\nstruct CompileAssertTypesEqual<T, T> {\n};\n\n// Removes the reference from a type if it is a reference type,\n// otherwise leaves it unchanged.  This is the same as\n// tr1::remove_reference, which is not widely available yet.\ntemplate <typename T>\nstruct RemoveReference { typedef T type; };  // NOLINT\ntemplate <typename T>\nstruct RemoveReference<T&> { typedef T type; };  // NOLINT\n\n// A handy wrapper around RemoveReference that works when the argument\n// T depends on template parameters.\n#define GTEST_REMOVE_REFERENCE_(T) \\\n    typename ::testing::internal::RemoveReference<T>::type\n\n// Removes const from a type if it is a const type, otherwise leaves\n// it unchanged.  This is the same as tr1::remove_const, which is not\n// widely available yet.\ntemplate <typename T>\nstruct RemoveConst { typedef T type; };  // NOLINT\ntemplate <typename T>\nstruct RemoveConst<const T> { typedef T type; };  // NOLINT\n\n// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above\n// definition to fail to remove the const in 'const int[3]' and 'const\n// char[3][4]'.  The following specialization works around the bug.\ntemplate <typename T, size_t N>\nstruct RemoveConst<const T[N]> {\n  typedef typename RemoveConst<T>::type type[N];\n};\n\n#if defined(_MSC_VER) && _MSC_VER < 1400\n// This is the only specialization that allows VC++ 7.1 to remove const in\n// 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC\n// and thus needs to be conditionally compiled.\ntemplate <typename T, size_t N>\nstruct RemoveConst<T[N]> {\n  typedef typename RemoveConst<T>::type type[N];\n};\n#endif\n\n// A handy wrapper around RemoveConst that works when the argument\n// T depends on template parameters.\n#define GTEST_REMOVE_CONST_(T) \\\n    typename ::testing::internal::RemoveConst<T>::type\n\n// Turns const U&, U&, const U, and U all into U.\n#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \\\n    GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))\n\n// Adds reference to a type if it is not a reference type,\n// otherwise leaves it unchanged.  This is the same as\n// tr1::add_reference, which is not widely available yet.\ntemplate <typename T>\nstruct AddReference { typedef T& type; };  // NOLINT\ntemplate <typename T>\nstruct AddReference<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper around AddReference that works when the argument T\n// depends on template parameters.\n#define GTEST_ADD_REFERENCE_(T) \\\n    typename ::testing::internal::AddReference<T>::type\n\n// Adds a reference to const on top of T as necessary.  For example,\n// it transforms\n//\n//   char         ==> const char&\n//   const char   ==> const char&\n//   char&        ==> const char&\n//   const char&  ==> const char&\n//\n// The argument T must depend on some template parameters.\n#define GTEST_REFERENCE_TO_CONST_(T) \\\n    GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))\n\n// ImplicitlyConvertible<From, To>::value is a compile-time bool\n// constant that's true iff type From can be implicitly converted to\n// type To.\ntemplate <typename From, typename To>\nclass ImplicitlyConvertible {\n private:\n  // We need the following helper functions only for their types.\n  // They have no implementations.\n\n  // MakeFrom() is an expression whose type is From.  We cannot simply\n  // use From(), as the type From may not have a public default\n  // constructor.\n  static From MakeFrom();\n\n  // These two functions are overloaded.  Given an expression\n  // Helper(x), the compiler will pick the first version if x can be\n  // implicitly converted to type To; otherwise it will pick the\n  // second version.\n  //\n  // The first version returns a value of size 1, and the second\n  // version returns a value of size 2.  Therefore, by checking the\n  // size of Helper(x), which can be done at compile time, we can tell\n  // which version of Helper() is used, and hence whether x can be\n  // implicitly converted to type To.\n  static char Helper(To);\n  static char (&Helper(...))[2];  // NOLINT\n\n  // We have to put the 'public' section after the 'private' section,\n  // or MSVC refuses to compile the code.\n public:\n  // MSVC warns about implicitly converting from double to int for\n  // possible loss of data, so we need to temporarily disable the\n  // warning.\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4244)  // Temporarily disables warning 4244.\n\n  static const bool value =\n      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;\n# pragma warning(pop)           // Restores the warning state.\n#elif defined(__BORLANDC__)\n  // C++Builder cannot use member overload resolution during template\n  // instantiation.  The simplest workaround is to use its C++0x type traits\n  // functions (C++Builder 2009 and above only).\n  static const bool value = __is_convertible(From, To);\n#else\n  static const bool value =\n      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;\n#endif  // _MSV_VER\n};\ntemplate <typename From, typename To>\nconst bool ImplicitlyConvertible<From, To>::value;\n\n// IsAProtocolMessage<T>::value is a compile-time bool constant that's\n// true iff T is type ProtocolMessage, proto2::Message, or a subclass\n// of those.\ntemplate <typename T>\nstruct IsAProtocolMessage\n    : public bool_constant<\n  ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||\n  ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {\n};\n\n// When the compiler sees expression IsContainerTest<C>(0), if C is an\n// STL-style container class, the first overload of IsContainerTest\n// will be viable (since both C::iterator* and C::const_iterator* are\n// valid types and NULL can be implicitly converted to them).  It will\n// be picked over the second overload as 'int' is a perfect match for\n// the type of argument 0.  If C::iterator or C::const_iterator is not\n// a valid type, the first overload is not viable, and the second\n// overload will be picked.  Therefore, we can determine whether C is\n// a container class by checking the type of IsContainerTest<C>(0).\n// The value of the expression is insignificant.\n//\n// Note that we look for both C::iterator and C::const_iterator.  The\n// reason is that C++ injects the name of a class as a member of the\n// class itself (e.g. you can refer to class iterator as either\n// 'iterator' or 'iterator::iterator').  If we look for C::iterator\n// only, for example, we would mistakenly think that a class named\n// iterator is an STL container.\n//\n// Also note that the simpler approach of overloading\n// IsContainerTest(typename C::const_iterator*) and\n// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.\ntypedef int IsContainer;\ntemplate <class C>\nIsContainer IsContainerTest(int /* dummy */,\n                            typename C::iterator* /* it */ = NULL,\n                            typename C::const_iterator* /* const_it */ = NULL) {\n  return 0;\n}\n\ntypedef char IsNotContainer;\ntemplate <class C>\nIsNotContainer IsContainerTest(long /* dummy */) { return '\\0'; }\n\n// EnableIf<condition>::type is void when 'Cond' is true, and\n// undefined when 'Cond' is false.  To use SFINAE to make a function\n// overload only apply when a particular expression is true, add\n// \"typename EnableIf<expression>::type* = 0\" as the last parameter.\ntemplate<bool> struct EnableIf;\ntemplate<> struct EnableIf<true> { typedef void type; };  // NOLINT\n\n// Utilities for native arrays.\n\n// ArrayEq() compares two k-dimensional native arrays using the\n// elements' operator==, where k can be any integer >= 0.  When k is\n// 0, ArrayEq() degenerates into comparing a single pair of values.\n\ntemplate <typename T, typename U>\nbool ArrayEq(const T* lhs, size_t size, const U* rhs);\n\n// This generic version is used when k is 0.\ntemplate <typename T, typename U>\ninline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }\n\n// This overload is used when k >= 1.\ntemplate <typename T, typename U, size_t N>\ninline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {\n  return internal::ArrayEq(lhs, N, rhs);\n}\n\n// This helper reduces code bloat.  If we instead put its logic inside\n// the previous ArrayEq() function, arrays with different sizes would\n// lead to different copies of the template code.\ntemplate <typename T, typename U>\nbool ArrayEq(const T* lhs, size_t size, const U* rhs) {\n  for (size_t i = 0; i != size; i++) {\n    if (!internal::ArrayEq(lhs[i], rhs[i]))\n      return false;\n  }\n  return true;\n}\n\n// Finds the first element in the iterator range [begin, end) that\n// equals elem.  Element may be a native array type itself.\ntemplate <typename Iter, typename Element>\nIter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {\n  for (Iter it = begin; it != end; ++it) {\n    if (internal::ArrayEq(*it, elem))\n      return it;\n  }\n  return end;\n}\n\n// CopyArray() copies a k-dimensional native array using the elements'\n// operator=, where k can be any integer >= 0.  When k is 0,\n// CopyArray() degenerates into copying a single value.\n\ntemplate <typename T, typename U>\nvoid CopyArray(const T* from, size_t size, U* to);\n\n// This generic version is used when k is 0.\ntemplate <typename T, typename U>\ninline void CopyArray(const T& from, U* to) { *to = from; }\n\n// This overload is used when k >= 1.\ntemplate <typename T, typename U, size_t N>\ninline void CopyArray(const T(&from)[N], U(*to)[N]) {\n  internal::CopyArray(from, N, *to);\n}\n\n// This helper reduces code bloat.  If we instead put its logic inside\n// the previous CopyArray() function, arrays with different sizes\n// would lead to different copies of the template code.\ntemplate <typename T, typename U>\nvoid CopyArray(const T* from, size_t size, U* to) {\n  for (size_t i = 0; i != size; i++) {\n    internal::CopyArray(from[i], to + i);\n  }\n}\n\n// The relation between an NativeArray object (see below) and the\n// native array it represents.\nenum RelationToSource {\n  kReference,  // The NativeArray references the native array.\n  kCopy        // The NativeArray makes a copy of the native array and\n               // owns the copy.\n};\n\n// Adapts a native array to a read-only STL-style container.  Instead\n// of the complete STL container concept, this adaptor only implements\n// members useful for Google Mock's container matchers.  New members\n// should be added as needed.  To simplify the implementation, we only\n// support Element being a raw type (i.e. having no top-level const or\n// reference modifier).  It's the client's responsibility to satisfy\n// this requirement.  Element can be an array type itself (hence\n// multi-dimensional arrays are supported).\ntemplate <typename Element>\nclass NativeArray {\n public:\n  // STL-style container typedefs.\n  typedef Element value_type;\n  typedef Element* iterator;\n  typedef const Element* const_iterator;\n\n  // Constructs from a native array.\n  NativeArray(const Element* array, size_t count, RelationToSource relation) {\n    Init(array, count, relation);\n  }\n\n  // Copy constructor.\n  NativeArray(const NativeArray& rhs) {\n    Init(rhs.array_, rhs.size_, rhs.relation_to_source_);\n  }\n\n  ~NativeArray() {\n    // Ensures that the user doesn't instantiate NativeArray with a\n    // const or reference type.\n    static_cast<void>(StaticAssertTypeEqHelper<Element,\n        GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());\n    if (relation_to_source_ == kCopy)\n      delete[] array_;\n  }\n\n  // STL-style container methods.\n  size_t size() const { return size_; }\n  const_iterator begin() const { return array_; }\n  const_iterator end() const { return array_ + size_; }\n  bool operator==(const NativeArray& rhs) const {\n    return size() == rhs.size() &&\n        ArrayEq(begin(), size(), rhs.begin());\n  }\n\n private:\n  // Initializes this object; makes a copy of the input array if\n  // 'relation' is kCopy.\n  void Init(const Element* array, size_t a_size, RelationToSource relation) {\n    if (relation == kReference) {\n      array_ = array;\n    } else {\n      Element* const copy = new Element[a_size];\n      CopyArray(array, a_size, copy);\n      array_ = copy;\n    }\n    size_ = a_size;\n    relation_to_source_ = relation;\n  }\n\n  const Element* array_;\n  size_t size_;\n  RelationToSource relation_to_source_;\n\n  GTEST_DISALLOW_ASSIGN_(NativeArray);\n};\n\n}  // namespace internal\n}  // namespace testing\n\n#define GTEST_MESSAGE_AT_(file, line, message, result_type) \\\n  ::testing::internal::AssertHelper(result_type, file, line, message) \\\n    = ::testing::Message()\n\n#define GTEST_MESSAGE_(message, result_type) \\\n  GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)\n\n#define GTEST_FATAL_FAILURE_(message) \\\n  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)\n\n#define GTEST_NONFATAL_FAILURE_(message) \\\n  GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)\n\n#define GTEST_SUCCESS_(message) \\\n  GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)\n\n// Suppresses MSVC warnings 4072 (unreachable code) for the code following\n// statement if it returns or throws (or doesn't return or throw in some\n// situations).\n#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \\\n  if (::testing::internal::AlwaysTrue()) { statement; }\n\n#define GTEST_TEST_THROW_(statement, expected_exception, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::ConstCharPtr gtest_msg = \"\") { \\\n    bool gtest_caught_expected = false; \\\n    try { \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    } \\\n    catch (expected_exception const&) { \\\n      gtest_caught_expected = true; \\\n    } \\\n    catch (...) { \\\n      gtest_msg.value = \\\n          \"Expected: \" #statement \" throws an exception of type \" \\\n          #expected_exception \".\\n  Actual: it throws a different type.\"; \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \\\n    } \\\n    if (!gtest_caught_expected) { \\\n      gtest_msg.value = \\\n          \"Expected: \" #statement \" throws an exception of type \" \\\n          #expected_exception \".\\n  Actual: it throws nothing.\"; \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \\\n      fail(gtest_msg.value)\n\n#define GTEST_TEST_NO_THROW_(statement, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    try { \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    } \\\n    catch (...) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \\\n      fail(\"Expected: \" #statement \" doesn't throw an exception.\\n\" \\\n           \"  Actual: it throws.\")\n\n#define GTEST_TEST_ANY_THROW_(statement, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    bool gtest_caught_any = false; \\\n    try { \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    } \\\n    catch (...) { \\\n      gtest_caught_any = true; \\\n    } \\\n    if (!gtest_caught_any) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \\\n      fail(\"Expected: \" #statement \" throws an exception.\\n\" \\\n           \"  Actual: it doesn't.\")\n\n\n// Implements Boolean test assertions such as EXPECT_TRUE. expression can be\n// either a boolean expression or an AssertionResult. text is a textual\n// represenation of expression as it was passed into the EXPECT_TRUE.\n#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (const ::testing::AssertionResult gtest_ar_ = \\\n      ::testing::AssertionResult(expression)) \\\n    ; \\\n  else \\\n    fail(::testing::internal::GetBoolAssertionFailureMessage(\\\n        gtest_ar_, text, #actual, #expected).c_str())\n\n#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \\\n    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \\\n      fail(\"Expected: \" #statement \" doesn't generate new fatal \" \\\n           \"failures in the current thread.\\n\" \\\n           \"  Actual: it does.\")\n\n// Expands to the name of the class that implements the given test.\n#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \\\n  test_case_name##_##test_name##_Test\n\n// Helper macro for defining tests.\n#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\\\nclass GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\\\n public:\\\n  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\\\n private:\\\n  virtual void TestBody();\\\n  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\\\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(\\\n      GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\\\n};\\\n\\\n::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\\\n  ::test_info_ =\\\n    ::testing::internal::MakeAndRegisterTestInfo(\\\n        #test_case_name, #test_name, NULL, NULL, \\\n        (parent_id), \\\n        parent_class::SetUpTestCase, \\\n        parent_class::TearDownTestCase, \\\n        new ::testing::internal::TestFactoryImpl<\\\n            GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\\\nvoid GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines the public API for death tests.  It is\n// #included by gtest.h so a user doesn't need to include this\n// directly.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_\n\n// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines internal utilities needed for implementing\n// death tests.  They are subject to change without notice.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_\n\n\n#include <stdio.h>\n\nnamespace testing {\nnamespace internal {\n\nGTEST_DECLARE_string_(internal_run_death_test);\n\n// Names of the flags (needed for parsing Google Test flags).\nconst char kDeathTestStyleFlag[] = \"death_test_style\";\nconst char kDeathTestUseFork[] = \"death_test_use_fork\";\nconst char kInternalRunDeathTestFlag[] = \"internal_run_death_test\";\n\n#if GTEST_HAS_DEATH_TEST\n\n// DeathTest is a class that hides much of the complexity of the\n// GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method\n// returns a concrete class that depends on the prevailing death test\n// style, as defined by the --gtest_death_test_style and/or\n// --gtest_internal_run_death_test flags.\n\n// In describing the results of death tests, these terms are used with\n// the corresponding definitions:\n//\n// exit status:  The integer exit information in the format specified\n//               by wait(2)\n// exit code:    The integer code passed to exit(3), _exit(2), or\n//               returned from main()\nclass GTEST_API_ DeathTest {\n public:\n  // Create returns false if there was an error determining the\n  // appropriate action to take for the current death test; for example,\n  // if the gtest_death_test_style flag is set to an invalid value.\n  // The LastMessage method will return a more detailed message in that\n  // case.  Otherwise, the DeathTest pointer pointed to by the \"test\"\n  // argument is set.  If the death test should be skipped, the pointer\n  // is set to NULL; otherwise, it is set to the address of a new concrete\n  // DeathTest object that controls the execution of the current test.\n  static bool Create(const char* statement, const RE* regex,\n                     const char* file, int line, DeathTest** test);\n  DeathTest();\n  virtual ~DeathTest() { }\n\n  // A helper class that aborts a death test when it's deleted.\n  class ReturnSentinel {\n   public:\n    explicit ReturnSentinel(DeathTest* test) : test_(test) { }\n    ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }\n   private:\n    DeathTest* const test_;\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);\n  } GTEST_ATTRIBUTE_UNUSED_;\n\n  // An enumeration of possible roles that may be taken when a death\n  // test is encountered.  EXECUTE means that the death test logic should\n  // be executed immediately.  OVERSEE means that the program should prepare\n  // the appropriate environment for a child process to execute the death\n  // test, then wait for it to complete.\n  enum TestRole { OVERSEE_TEST, EXECUTE_TEST };\n\n  // An enumeration of the three reasons that a test might be aborted.\n  enum AbortReason {\n    TEST_ENCOUNTERED_RETURN_STATEMENT,\n    TEST_THREW_EXCEPTION,\n    TEST_DID_NOT_DIE\n  };\n\n  // Assumes one of the above roles.\n  virtual TestRole AssumeRole() = 0;\n\n  // Waits for the death test to finish and returns its status.\n  virtual int Wait() = 0;\n\n  // Returns true if the death test passed; that is, the test process\n  // exited during the test, its exit status matches a user-supplied\n  // predicate, and its stderr output matches a user-supplied regular\n  // expression.\n  // The user-supplied predicate may be a macro expression rather\n  // than a function pointer or functor, or else Wait and Passed could\n  // be combined.\n  virtual bool Passed(bool exit_status_ok) = 0;\n\n  // Signals that the death test did not die as expected.\n  virtual void Abort(AbortReason reason) = 0;\n\n  // Returns a human-readable outcome message regarding the outcome of\n  // the last death test.\n  static const char* LastMessage();\n\n  static void set_last_death_test_message(const std::string& message);\n\n private:\n  // A string containing a description of the outcome of the last death test.\n  static std::string last_death_test_message_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);\n};\n\n// Factory interface for death tests.  May be mocked out for testing.\nclass DeathTestFactory {\n public:\n  virtual ~DeathTestFactory() { }\n  virtual bool Create(const char* statement, const RE* regex,\n                      const char* file, int line, DeathTest** test) = 0;\n};\n\n// A concrete DeathTestFactory implementation for normal use.\nclass DefaultDeathTestFactory : public DeathTestFactory {\n public:\n  virtual bool Create(const char* statement, const RE* regex,\n                      const char* file, int line, DeathTest** test);\n};\n\n// Returns true if exit_status describes a process that was terminated\n// by a signal, or exited normally with a nonzero exit code.\nGTEST_API_ bool ExitedUnsuccessfully(int exit_status);\n\n// Traps C++ exceptions escaping statement and reports them as test\n// failures. Note that trapping SEH exceptions is not implemented here.\n# if GTEST_HAS_EXCEPTIONS\n#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \\\n  try { \\\n    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n  } catch (const ::std::exception& gtest_exception) { \\\n    fprintf(\\\n        stderr, \\\n        \"\\n%s: Caught std::exception-derived exception escaping the \" \\\n        \"death test statement. Exception message: %s\\n\", \\\n        ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \\\n        gtest_exception.what()); \\\n    fflush(stderr); \\\n    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \\\n  } catch (...) { \\\n    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \\\n  }\n\n# else\n#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \\\n  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)\n\n# endif\n\n// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,\n// ASSERT_EXIT*, and EXPECT_EXIT*.\n# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    const ::testing::internal::RE& gtest_regex = (regex); \\\n    ::testing::internal::DeathTest* gtest_dt; \\\n    if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \\\n        __FILE__, __LINE__, &gtest_dt)) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \\\n    } \\\n    if (gtest_dt != NULL) { \\\n      ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \\\n          gtest_dt_ptr(gtest_dt); \\\n      switch (gtest_dt->AssumeRole()) { \\\n        case ::testing::internal::DeathTest::OVERSEE_TEST: \\\n          if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \\\n            goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \\\n          } \\\n          break; \\\n        case ::testing::internal::DeathTest::EXECUTE_TEST: { \\\n          ::testing::internal::DeathTest::ReturnSentinel \\\n              gtest_sentinel(gtest_dt); \\\n          GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \\\n          gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \\\n          break; \\\n        } \\\n        default: \\\n          break; \\\n      } \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \\\n      fail(::testing::internal::DeathTest::LastMessage())\n// The symbol \"fail\" here expands to something into which a message\n// can be streamed.\n\n// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in\n// NDEBUG mode. In this case we need the statements to be executed, the regex is\n// ignored, and the macro must accept a streamed message even though the message\n// is never printed.\n# define GTEST_EXECUTE_STATEMENT_(statement, regex) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n  } else \\\n    ::testing::Message()\n\n// A class representing the parsed contents of the\n// --gtest_internal_run_death_test flag, as it existed when\n// RUN_ALL_TESTS was called.\nclass InternalRunDeathTestFlag {\n public:\n  InternalRunDeathTestFlag(const std::string& a_file,\n                           int a_line,\n                           int an_index,\n                           int a_write_fd)\n      : file_(a_file), line_(a_line), index_(an_index),\n        write_fd_(a_write_fd) {}\n\n  ~InternalRunDeathTestFlag() {\n    if (write_fd_ >= 0)\n      posix::Close(write_fd_);\n  }\n\n  const std::string& file() const { return file_; }\n  int line() const { return line_; }\n  int index() const { return index_; }\n  int write_fd() const { return write_fd_; }\n\n private:\n  std::string file_;\n  int line_;\n  int index_;\n  int write_fd_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);\n};\n\n// Returns a newly created InternalRunDeathTestFlag object with fields\n// initialized from the GTEST_FLAG(internal_run_death_test) flag if\n// the flag is specified; otherwise returns NULL.\nInternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();\n\n#else  // GTEST_HAS_DEATH_TEST\n\n// This macro is used for implementing macros such as\n// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where\n// death tests are not supported. Those macros must compile on such systems\n// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on\n// systems that support death tests. This allows one to write such a macro\n// on a system that does not support death tests and be sure that it will\n// compile on a death-test supporting system.\n//\n// Parameters:\n//   statement -  A statement that a macro such as EXPECT_DEATH would test\n//                for program termination. This macro has to make sure this\n//                statement is compiled but not executed, to ensure that\n//                EXPECT_DEATH_IF_SUPPORTED compiles with a certain\n//                parameter iff EXPECT_DEATH compiles with it.\n//   regex     -  A regex that a macro such as EXPECT_DEATH would use to test\n//                the output of statement.  This parameter has to be\n//                compiled but not evaluated by this macro, to ensure that\n//                this macro only accepts expressions that a macro such as\n//                EXPECT_DEATH would accept.\n//   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED\n//                and a return statement for ASSERT_DEATH_IF_SUPPORTED.\n//                This ensures that ASSERT_DEATH_IF_SUPPORTED will not\n//                compile inside functions where ASSERT_DEATH doesn't\n//                compile.\n//\n//  The branch that has an always false condition is used to ensure that\n//  statement and regex are compiled (and thus syntactically correct) but\n//  never executed. The unreachable code macro protects the terminator\n//  statement from generating an 'unreachable code' warning in case\n//  statement unconditionally returns or throws. The Message constructor at\n//  the end allows the syntax of streaming additional messages into the\n//  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.\n# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \\\n    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n    if (::testing::internal::AlwaysTrue()) { \\\n      GTEST_LOG_(WARNING) \\\n          << \"Death tests are not supported on this platform.\\n\" \\\n          << \"Statement '\" #statement \"' cannot be verified.\"; \\\n    } else if (::testing::internal::AlwaysFalse()) { \\\n      ::testing::internal::RE::PartialMatch(\".*\", (regex)); \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n      terminator; \\\n    } else \\\n      ::testing::Message()\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_\n\nnamespace testing {\n\n// This flag controls the style of death tests.  Valid values are \"threadsafe\",\n// meaning that the death test child process will re-execute the test binary\n// from the start, running only a single death test, or \"fast\",\n// meaning that the child process will execute the test logic immediately\n// after forking.\nGTEST_DECLARE_string_(death_test_style);\n\n#if GTEST_HAS_DEATH_TEST\n\nnamespace internal {\n\n// Returns a Boolean value indicating whether the caller is currently\n// executing in the context of the death test child process.  Tools such as\n// Valgrind heap checkers may need this to modify their behavior in death\n// tests.  IMPORTANT: This is an internal utility.  Using it may break the\n// implementation of death tests.  User code MUST NOT use it.\nGTEST_API_ bool InDeathTestChild();\n\n}  // namespace internal\n\n// The following macros are useful for writing death tests.\n\n// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is\n// executed:\n//\n//   1. It generates a warning if there is more than one active\n//   thread.  This is because it's safe to fork() or clone() only\n//   when there is a single thread.\n//\n//   2. The parent process clone()s a sub-process and runs the death\n//   test in it; the sub-process exits with code 0 at the end of the\n//   death test, if it hasn't exited already.\n//\n//   3. The parent process waits for the sub-process to terminate.\n//\n//   4. The parent process checks the exit code and error message of\n//   the sub-process.\n//\n// Examples:\n//\n//   ASSERT_DEATH(server.SendMessage(56, \"Hello\"), \"Invalid port number\");\n//   for (int i = 0; i < 5; i++) {\n//     EXPECT_DEATH(server.ProcessRequest(i),\n//                  \"Invalid request .* in ProcessRequest()\")\n//                  << \"Failed to die on request \" << i;\n//   }\n//\n//   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), \"Exiting\");\n//\n//   bool KilledBySIGHUP(int exit_code) {\n//     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;\n//   }\n//\n//   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, \"Hanging up!\");\n//\n// On the regular expressions used in death tests:\n//\n//   On POSIX-compliant systems (*nix), we use the <regex.h> library,\n//   which uses the POSIX extended regex syntax.\n//\n//   On other platforms (e.g. Windows), we only support a simple regex\n//   syntax implemented as part of Google Test.  This limited\n//   implementation should be enough most of the time when writing\n//   death tests; though it lacks many features you can find in PCRE\n//   or POSIX extended regex syntax.  For example, we don't support\n//   union (\"x|y\"), grouping (\"(xy)\"), brackets (\"[xy]\"), and\n//   repetition count (\"x{5,7}\"), among others.\n//\n//   Below is the syntax that we do support.  We chose it to be a\n//   subset of both PCRE and POSIX extended regex, so it's easy to\n//   learn wherever you come from.  In the following: 'A' denotes a\n//   literal character, period (.), or a single \\\\ escape sequence;\n//   'x' and 'y' denote regular expressions; 'm' and 'n' are for\n//   natural numbers.\n//\n//     c     matches any literal character c\n//     \\\\d   matches any decimal digit\n//     \\\\D   matches any character that's not a decimal digit\n//     \\\\f   matches \\f\n//     \\\\n   matches \\n\n//     \\\\r   matches \\r\n//     \\\\s   matches any ASCII whitespace, including \\n\n//     \\\\S   matches any character that's not a whitespace\n//     \\\\t   matches \\t\n//     \\\\v   matches \\v\n//     \\\\w   matches any letter, _, or decimal digit\n//     \\\\W   matches any character that \\\\w doesn't match\n//     \\\\c   matches any literal character c, which must be a punctuation\n//     .     matches any single character except \\n\n//     A?    matches 0 or 1 occurrences of A\n//     A*    matches 0 or many occurrences of A\n//     A+    matches 1 or many occurrences of A\n//     ^     matches the beginning of a string (not that of each line)\n//     $     matches the end of a string (not that of each line)\n//     xy    matches x followed by y\n//\n//   If you accidentally use PCRE or POSIX extended regex features\n//   not implemented by us, you will get a run-time failure.  In that\n//   case, please try to rewrite your regular expression within the\n//   above syntax.\n//\n//   This implementation is *not* meant to be as highly tuned or robust\n//   as a compiled regex library, but should perform well enough for a\n//   death test, which already incurs significant overhead by launching\n//   a child process.\n//\n// Known caveats:\n//\n//   A \"threadsafe\" style death test obtains the path to the test\n//   program from argv[0] and re-executes it in the sub-process.  For\n//   simplicity, the current implementation doesn't search the PATH\n//   when launching the sub-process.  This means that the user must\n//   invoke the test program via a path that contains at least one\n//   path separator (e.g. path/to/foo_test and\n//   /absolute/path/to/bar_test are fine, but foo_test is not).  This\n//   is rarely a problem as people usually don't put the test binary\n//   directory in PATH.\n//\n// TODO(wan@google.com): make thread-safe death tests search the PATH.\n\n// Asserts that a given statement causes the program to exit, with an\n// integer exit status that satisfies predicate, and emitting error output\n// that matches regex.\n# define ASSERT_EXIT(statement, predicate, regex) \\\n    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)\n\n// Like ASSERT_EXIT, but continues on to successive tests in the\n// test case, if any:\n# define EXPECT_EXIT(statement, predicate, regex) \\\n    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)\n\n// Asserts that a given statement causes the program to exit, either by\n// explicitly exiting with a nonzero exit code or being killed by a\n// signal, and emitting error output that matches regex.\n# define ASSERT_DEATH(statement, regex) \\\n    ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)\n\n// Like ASSERT_DEATH, but continues on to successive tests in the\n// test case, if any:\n# define EXPECT_DEATH(statement, regex) \\\n    EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)\n\n// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:\n\n// Tests that an exit code describes a normal exit with a given exit code.\nclass GTEST_API_ ExitedWithCode {\n public:\n  explicit ExitedWithCode(int exit_code);\n  bool operator()(int exit_status) const;\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ExitedWithCode& other);\n\n  const int exit_code_;\n};\n\n# if !GTEST_OS_WINDOWS\n// Tests that an exit code describes an exit due to termination by a\n// given signal.\nclass GTEST_API_ KilledBySignal {\n public:\n  explicit KilledBySignal(int signum);\n  bool operator()(int exit_status) const;\n private:\n  const int signum_;\n};\n# endif  // !GTEST_OS_WINDOWS\n\n// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.\n// The death testing framework causes this to have interesting semantics,\n// since the sideeffects of the call are only visible in opt mode, and not\n// in debug mode.\n//\n// In practice, this can be used to test functions that utilize the\n// LOG(DFATAL) macro using the following style:\n//\n// int DieInDebugOr12(int* sideeffect) {\n//   if (sideeffect) {\n//     *sideeffect = 12;\n//   }\n//   LOG(DFATAL) << \"death\";\n//   return 12;\n// }\n//\n// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {\n//   int sideeffect = 0;\n//   // Only asserts in dbg.\n//   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), \"death\");\n//\n// #ifdef NDEBUG\n//   // opt-mode has sideeffect visible.\n//   EXPECT_EQ(12, sideeffect);\n// #else\n//   // dbg-mode no visible sideeffect.\n//   EXPECT_EQ(0, sideeffect);\n// #endif\n// }\n//\n// This will assert that DieInDebugReturn12InOpt() crashes in debug\n// mode, usually due to a DCHECK or LOG(DFATAL), but returns the\n// appropriate fallback value (12 in this case) in opt mode. If you\n// need to test that a function has appropriate side-effects in opt\n// mode, include assertions against the side-effects.  A general\n// pattern for this is:\n//\n// EXPECT_DEBUG_DEATH({\n//   // Side-effects here will have an effect after this statement in\n//   // opt mode, but none in debug mode.\n//   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));\n// }, \"death\");\n//\n# ifdef NDEBUG\n\n#  define EXPECT_DEBUG_DEATH(statement, regex) \\\n  GTEST_EXECUTE_STATEMENT_(statement, regex)\n\n#  define ASSERT_DEBUG_DEATH(statement, regex) \\\n  GTEST_EXECUTE_STATEMENT_(statement, regex)\n\n# else\n\n#  define EXPECT_DEBUG_DEATH(statement, regex) \\\n  EXPECT_DEATH(statement, regex)\n\n#  define ASSERT_DEBUG_DEATH(statement, regex) \\\n  ASSERT_DEATH(statement, regex)\n\n# endif  // NDEBUG for EXPECT_DEBUG_DEATH\n#endif  // GTEST_HAS_DEATH_TEST\n\n// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and\n// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if\n// death tests are supported; otherwise they just issue a warning.  This is\n// useful when you are combining death test assertions with normal test\n// assertions in one test.\n#if GTEST_HAS_DEATH_TEST\n# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \\\n    EXPECT_DEATH(statement, regex)\n# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \\\n    ASSERT_DEATH(statement, regex)\n#else\n# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \\\n    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )\n# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \\\n    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)\n#endif\n\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_\n// This file was GENERATED by command:\n//     pump.py gtest-param-test.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: vladl@google.com (Vlad Losev)\n//\n// Macros and functions for implementing parameterized tests\n// in Google C++ Testing Framework (Google Test)\n//\n// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n\n\n// Value-parameterized tests allow you to test your code with different\n// parameters without writing multiple copies of the same test.\n//\n// Here is how you use value-parameterized tests:\n\n#if 0\n\n// To write value-parameterized tests, first you should define a fixture\n// class. It is usually derived from testing::TestWithParam<T> (see below for\n// another inheritance scheme that's sometimes useful in more complicated\n// class hierarchies), where the type of your parameter values.\n// TestWithParam<T> is itself derived from testing::Test. T can be any\n// copyable type. If it's a raw pointer, you are responsible for managing the\n// lifespan of the pointed values.\n\nclass FooTest : public ::testing::TestWithParam<const char*> {\n  // You can implement all the usual class fixture members here.\n};\n\n// Then, use the TEST_P macro to define as many parameterized tests\n// for this fixture as you want. The _P suffix is for \"parameterized\"\n// or \"pattern\", whichever you prefer to think.\n\nTEST_P(FooTest, DoesBlah) {\n  // Inside a test, access the test parameter with the GetParam() method\n  // of the TestWithParam<T> class:\n  EXPECT_TRUE(foo.Blah(GetParam()));\n  ...\n}\n\nTEST_P(FooTest, HasBlahBlah) {\n  ...\n}\n\n// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test\n// case with any set of parameters you want. Google Test defines a number\n// of functions for generating test parameters. They return what we call\n// (surprise!) parameter generators. Here is a  summary of them, which\n// are all in the testing namespace:\n//\n//\n//  Range(begin, end [, step]) - Yields values {begin, begin+step,\n//                               begin+step+step, ...}. The values do not\n//                               include end. step defaults to 1.\n//  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.\n//  ValuesIn(container)        - Yields values from a C-style array, an STL\n//  ValuesIn(begin,end)          container, or an iterator range [begin, end).\n//  Bool()                     - Yields sequence {false, true}.\n//  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product\n//                               for the math savvy) of the values generated\n//                               by the N generators.\n//\n// For more details, see comments at the definitions of these functions below\n// in this file.\n//\n// The following statement will instantiate tests from the FooTest test case\n// each with parameter values \"meeny\", \"miny\", and \"moe\".\n\nINSTANTIATE_TEST_CASE_P(InstantiationName,\n                        FooTest,\n                        Values(\"meeny\", \"miny\", \"moe\"));\n\n// To distinguish different instances of the pattern, (yes, you\n// can instantiate it more then once) the first argument to the\n// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the\n// actual test case name. Remember to pick unique prefixes for different\n// instantiations. The tests from the instantiation above will have\n// these names:\n//\n//    * InstantiationName/FooTest.DoesBlah/0 for \"meeny\"\n//    * InstantiationName/FooTest.DoesBlah/1 for \"miny\"\n//    * InstantiationName/FooTest.DoesBlah/2 for \"moe\"\n//    * InstantiationName/FooTest.HasBlahBlah/0 for \"meeny\"\n//    * InstantiationName/FooTest.HasBlahBlah/1 for \"miny\"\n//    * InstantiationName/FooTest.HasBlahBlah/2 for \"moe\"\n//\n// You can use these names in --gtest_filter.\n//\n// This statement will instantiate all tests from FooTest again, each\n// with parameter values \"cat\" and \"dog\":\n\nconst char* pets[] = {\"cat\", \"dog\"};\nINSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));\n\n// The tests from the instantiation above will have these names:\n//\n//    * AnotherInstantiationName/FooTest.DoesBlah/0 for \"cat\"\n//    * AnotherInstantiationName/FooTest.DoesBlah/1 for \"dog\"\n//    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for \"cat\"\n//    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for \"dog\"\n//\n// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests\n// in the given test case, whether their definitions come before or\n// AFTER the INSTANTIATE_TEST_CASE_P statement.\n//\n// Please also note that generator expressions (including parameters to the\n// generators) are evaluated in InitGoogleTest(), after main() has started.\n// This allows the user on one hand, to adjust generator parameters in order\n// to dynamically determine a set of tests to run and on the other hand,\n// give the user a chance to inspect the generated tests with Google Test\n// reflection API before RUN_ALL_TESTS() is executed.\n//\n// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc\n// for more examples.\n//\n// In the future, we plan to publish the API for defining new parameter\n// generators. But for now this interface remains part of the internal\n// implementation and is subject to change.\n//\n//\n// A parameterized test fixture must be derived from testing::Test and from\n// testing::WithParamInterface<T>, where T is the type of the parameter\n// values. Inheriting from TestWithParam<T> satisfies that requirement because\n// TestWithParam<T> inherits from both Test and WithParamInterface. In more\n// complicated hierarchies, however, it is occasionally useful to inherit\n// separately from Test and WithParamInterface. For example:\n\nclass BaseTest : public ::testing::Test {\n  // You can inherit all the usual members for a non-parameterized test\n  // fixture here.\n};\n\nclass DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {\n  // The usual test fixture members go here too.\n};\n\nTEST_F(BaseTest, HasFoo) {\n  // This is an ordinary non-parameterized test.\n}\n\nTEST_P(DerivedTest, DoesBlah) {\n  // GetParam works just the same here as if you inherit from TestWithParam.\n  EXPECT_TRUE(foo.Blah(GetParam()));\n}\n\n#endif  // 0\n\n\n#if !GTEST_OS_SYMBIAN\n# include <utility>\n#endif\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// Type and function utilities for implementing parameterized tests.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_\n\n#include <iterator>\n#include <utility>\n#include <vector>\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n// Copyright 2003 Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: Dan Egnor (egnor@google.com)\n//\n// A \"smart\" pointer type with reference tracking.  Every pointer to a\n// particular object is kept on a circular linked list.  When the last pointer\n// to an object is destroyed or reassigned, the object is deleted.\n//\n// Used properly, this deletes the object when the last reference goes away.\n// There are several caveats:\n// - Like all reference counting schemes, cycles lead to leaks.\n// - Each smart pointer is actually two pointers (8 bytes instead of 4).\n// - Every time a pointer is assigned, the entire list of pointers to that\n//   object is traversed.  This class is therefore NOT SUITABLE when there\n//   will often be more than two or three pointers to a particular object.\n// - References are only tracked as long as linked_ptr<> objects are copied.\n//   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS\n//   will happen (double deletion).\n//\n// A good use of this class is storing object references in STL containers.\n// You can safely put linked_ptr<> in a vector<>.\n// Other uses may not be as good.\n//\n// Note: If you use an incomplete type with linked_ptr<>, the class\n// *containing* linked_ptr<> must have a constructor and destructor (even\n// if they do nothing!).\n//\n// Bill Gibbons suggested we use something like this.\n//\n// Thread Safety:\n//   Unlike other linked_ptr implementations, in this implementation\n//   a linked_ptr object is thread-safe in the sense that:\n//     - it's safe to copy linked_ptr objects concurrently,\n//     - it's safe to copy *from* a linked_ptr and read its underlying\n//       raw pointer (e.g. via get()) concurrently, and\n//     - it's safe to write to two linked_ptrs that point to the same\n//       shared object concurrently.\n// TODO(wan@google.com): rename this to safe_linked_ptr to avoid\n// confusion with normal linked_ptr.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_\n\n#include <stdlib.h>\n#include <assert.h>\n\n\nnamespace testing {\nnamespace internal {\n\n// Protects copying of all linked_ptr objects.\nGTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);\n\n// This is used internally by all instances of linked_ptr<>.  It needs to be\n// a non-template class because different types of linked_ptr<> can refer to\n// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).\n// So, it needs to be possible for different types of linked_ptr to participate\n// in the same circular linked list, so we need a single class type here.\n//\n// DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.\nclass linked_ptr_internal {\n public:\n  // Create a new circle that includes only this instance.\n  void join_new() {\n    next_ = this;\n  }\n\n  // Many linked_ptr operations may change p.link_ for some linked_ptr\n  // variable p in the same circle as this object.  Therefore we need\n  // to prevent two such operations from occurring concurrently.\n  //\n  // Note that different types of linked_ptr objects can coexist in a\n  // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and\n  // linked_ptr<Derived2>).  Therefore we must use a single mutex to\n  // protect all linked_ptr objects.  This can create serious\n  // contention in production code, but is acceptable in a testing\n  // framework.\n\n  // Join an existing circle.\n  void join(linked_ptr_internal const* ptr)\n      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {\n    MutexLock lock(&g_linked_ptr_mutex);\n\n    linked_ptr_internal const* p = ptr;\n    while (p->next_ != ptr) p = p->next_;\n    p->next_ = this;\n    next_ = ptr;\n  }\n\n  // Leave whatever circle we're part of.  Returns true if we were the\n  // last member of the circle.  Once this is done, you can join() another.\n  bool depart()\n      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {\n    MutexLock lock(&g_linked_ptr_mutex);\n\n    if (next_ == this) return true;\n    linked_ptr_internal const* p = next_;\n    while (p->next_ != this) p = p->next_;\n    p->next_ = next_;\n    return false;\n  }\n\n private:\n  mutable linked_ptr_internal const* next_;\n};\n\ntemplate <typename T>\nclass linked_ptr {\n public:\n  typedef T element_type;\n\n  // Take over ownership of a raw pointer.  This should happen as soon as\n  // possible after the object is created.\n  explicit linked_ptr(T* ptr = NULL) { capture(ptr); }\n  ~linked_ptr() { depart(); }\n\n  // Copy an existing linked_ptr<>, adding ourselves to the list of references.\n  template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }\n  linked_ptr(linked_ptr const& ptr) {  // NOLINT\n    assert(&ptr != this);\n    copy(&ptr);\n  }\n\n  // Assignment releases the old value and acquires the new.\n  template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {\n    depart();\n    copy(&ptr);\n    return *this;\n  }\n\n  linked_ptr& operator=(linked_ptr const& ptr) {\n    if (&ptr != this) {\n      depart();\n      copy(&ptr);\n    }\n    return *this;\n  }\n\n  // Smart pointer members.\n  void reset(T* ptr = NULL) {\n    depart();\n    capture(ptr);\n  }\n  T* get() const { return value_; }\n  T* operator->() const { return value_; }\n  T& operator*() const { return *value_; }\n\n  bool operator==(T* p) const { return value_ == p; }\n  bool operator!=(T* p) const { return value_ != p; }\n  template <typename U>\n  bool operator==(linked_ptr<U> const& ptr) const {\n    return value_ == ptr.get();\n  }\n  template <typename U>\n  bool operator!=(linked_ptr<U> const& ptr) const {\n    return value_ != ptr.get();\n  }\n\n private:\n  template <typename U>\n  friend class linked_ptr;\n\n  T* value_;\n  linked_ptr_internal link_;\n\n  void depart() {\n    if (link_.depart()) delete value_;\n  }\n\n  void capture(T* ptr) {\n    value_ = ptr;\n    link_.join_new();\n  }\n\n  template <typename U> void copy(linked_ptr<U> const* ptr) {\n    value_ = ptr->get();\n    if (value_)\n      link_.join(&ptr->link_);\n    else\n      link_.join_new();\n  }\n};\n\ntemplate<typename T> inline\nbool operator==(T* ptr, const linked_ptr<T>& x) {\n  return ptr == x.get();\n}\n\ntemplate<typename T> inline\nbool operator!=(T* ptr, const linked_ptr<T>& x) {\n  return ptr != x.get();\n}\n\n// A function to convert T* into linked_ptr<T>\n// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation\n// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))\ntemplate <typename T>\nlinked_ptr<T> make_linked_ptr(T* ptr) {\n  return linked_ptr<T>(ptr);\n}\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_\n// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Google Test - The Google C++ Testing Framework\n//\n// This file implements a universal value printer that can print a\n// value of any type T:\n//\n//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);\n//\n// A user can teach this function how to print a class type T by\n// defining either operator<<() or PrintTo() in the namespace that\n// defines T.  More specifically, the FIRST defined function in the\n// following list will be used (assuming T is defined in namespace\n// foo):\n//\n//   1. foo::PrintTo(const T&, ostream*)\n//   2. operator<<(ostream&, const T&) defined in either foo or the\n//      global namespace.\n//\n// If none of the above is defined, it will print the debug string of\n// the value if it is a protocol buffer, or print the raw bytes in the\n// value otherwise.\n//\n// To aid debugging: when T is a reference type, the address of the\n// value is also printed; when T is a (const) char pointer, both the\n// pointer value and the NUL-terminated string it points to are\n// printed.\n//\n// We also provide some convenient wrappers:\n//\n//   // Prints a value to a string.  For a (const or not) char\n//   // pointer, the NUL-terminated string (but not the pointer) is\n//   // printed.\n//   std::string ::testing::PrintToString(const T& value);\n//\n//   // Prints a value tersely: for a reference type, the referenced\n//   // value (but not the address) is printed; for a (const or not) char\n//   // pointer, the NUL-terminated string (but not the pointer) is\n//   // printed.\n//   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);\n//\n//   // Prints value using the type inferred by the compiler.  The difference\n//   // from UniversalTersePrint() is that this function prints both the\n//   // pointer and the NUL-terminated string for a (const or not) char pointer.\n//   void ::testing::internal::UniversalPrint(const T& value, ostream*);\n//\n//   // Prints the fields of a tuple tersely to a string vector, one\n//   // element for each field. Tuple support must be enabled in\n//   // gtest-port.h.\n//   std::vector<string> UniversalTersePrintTupleFieldsToStrings(\n//       const Tuple& value);\n//\n// Known limitation:\n//\n// The print primitives print the elements of an STL-style container\n// using the compiler-inferred type of *iter where iter is a\n// const_iterator of the container.  When const_iterator is an input\n// iterator but not a forward iterator, this inferred type may not\n// match value_type, and the print output may be incorrect.  In\n// practice, this is rarely a problem as for most containers\n// const_iterator is a forward iterator.  We'll fix this if there's an\n// actual need for it.  Note that this fix cannot rely on value_type\n// being defined as many user-defined container types don't have\n// value_type.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_\n\n#include <ostream>  // NOLINT\n#include <sstream>\n#include <string>\n#include <utility>\n#include <vector>\n\nnamespace testing {\n\n// Definitions in the 'internal' and 'internal2' name spaces are\n// subject to change without notice.  DO NOT USE THEM IN USER CODE!\nnamespace internal2 {\n\n// Prints the given number of bytes in the given object to the given\n// ostream.\nGTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,\n                                     size_t count,\n                                     ::std::ostream* os);\n\n// For selecting which printer to use when a given type has neither <<\n// nor PrintTo().\nenum TypeKind {\n  kProtobuf,              // a protobuf type\n  kConvertibleToInteger,  // a type implicitly convertible to BiggestInt\n                          // (e.g. a named or unnamed enum type)\n  kOtherType              // anything else\n};\n\n// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called\n// by the universal printer to print a value of type T when neither\n// operator<< nor PrintTo() is defined for T, where kTypeKind is the\n// \"kind\" of T as defined by enum TypeKind.\ntemplate <typename T, TypeKind kTypeKind>\nclass TypeWithoutFormatter {\n public:\n  // This default version is called when kTypeKind is kOtherType.\n  static void PrintValue(const T& value, ::std::ostream* os) {\n    PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),\n                         sizeof(value), os);\n  }\n};\n\n// We print a protobuf using its ShortDebugString() when the string\n// doesn't exceed this many characters; otherwise we print it using\n// DebugString() for better readability.\nconst size_t kProtobufOneLinerMaxLength = 50;\n\ntemplate <typename T>\nclass TypeWithoutFormatter<T, kProtobuf> {\n public:\n  static void PrintValue(const T& value, ::std::ostream* os) {\n    const ::testing::internal::string short_str = value.ShortDebugString();\n    const ::testing::internal::string pretty_str =\n        short_str.length() <= kProtobufOneLinerMaxLength ?\n        short_str : (\"\\n\" + value.DebugString());\n    *os << (\"<\" + pretty_str + \">\");\n  }\n};\n\ntemplate <typename T>\nclass TypeWithoutFormatter<T, kConvertibleToInteger> {\n public:\n  // Since T has no << operator or PrintTo() but can be implicitly\n  // converted to BiggestInt, we print it as a BiggestInt.\n  //\n  // Most likely T is an enum type (either named or unnamed), in which\n  // case printing it as an integer is the desired behavior.  In case\n  // T is not an enum, printing it as an integer is the best we can do\n  // given that it has no user-defined printer.\n  static void PrintValue(const T& value, ::std::ostream* os) {\n    const internal::BiggestInt kBigInt = value;\n    *os << kBigInt;\n  }\n};\n\n// Prints the given value to the given ostream.  If the value is a\n// protocol message, its debug string is printed; if it's an enum or\n// of a type implicitly convertible to BiggestInt, it's printed as an\n// integer; otherwise the bytes in the value are printed.  This is\n// what UniversalPrinter<T>::Print() does when it knows nothing about\n// type T and T has neither << operator nor PrintTo().\n//\n// A user can override this behavior for a class type Foo by defining\n// a << operator in the namespace where Foo is defined.\n//\n// We put this operator in namespace 'internal2' instead of 'internal'\n// to simplify the implementation, as much code in 'internal' needs to\n// use << in STL, which would conflict with our own << were it defined\n// in 'internal'.\n//\n// Note that this operator<< takes a generic std::basic_ostream<Char,\n// CharTraits> type instead of the more restricted std::ostream.  If\n// we define it to take an std::ostream instead, we'll get an\n// \"ambiguous overloads\" compiler error when trying to print a type\n// Foo that supports streaming to std::basic_ostream<Char,\n// CharTraits>, as the compiler cannot tell whether\n// operator<<(std::ostream&, const T&) or\n// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more\n// specific.\ntemplate <typename Char, typename CharTraits, typename T>\n::std::basic_ostream<Char, CharTraits>& operator<<(\n    ::std::basic_ostream<Char, CharTraits>& os, const T& x) {\n  TypeWithoutFormatter<T,\n      (internal::IsAProtocolMessage<T>::value ? kProtobuf :\n       internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?\n       kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);\n  return os;\n}\n\n}  // namespace internal2\n}  // namespace testing\n\n// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up\n// magic needed for implementing UniversalPrinter won't work.\nnamespace testing_internal {\n\n// Used to print a value that is not an STL-style container when the\n// user doesn't define PrintTo() for it.\ntemplate <typename T>\nvoid DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {\n  // With the following statement, during unqualified name lookup,\n  // testing::internal2::operator<< appears as if it was declared in\n  // the nearest enclosing namespace that contains both\n  // ::testing_internal and ::testing::internal2, i.e. the global\n  // namespace.  For more details, refer to the C++ Standard section\n  // 7.3.4-1 [namespace.udir].  This allows us to fall back onto\n  // testing::internal2::operator<< in case T doesn't come with a <<\n  // operator.\n  //\n  // We cannot write 'using ::testing::internal2::operator<<;', which\n  // gcc 3.3 fails to compile due to a compiler bug.\n  using namespace ::testing::internal2;  // NOLINT\n\n  // Assuming T is defined in namespace foo, in the next statement,\n  // the compiler will consider all of:\n  //\n  //   1. foo::operator<< (thanks to Koenig look-up),\n  //   2. ::operator<< (as the current namespace is enclosed in ::),\n  //   3. testing::internal2::operator<< (thanks to the using statement above).\n  //\n  // The operator<< whose type matches T best will be picked.\n  //\n  // We deliberately allow #2 to be a candidate, as sometimes it's\n  // impossible to define #1 (e.g. when foo is ::std, defining\n  // anything in it is undefined behavior unless you are a compiler\n  // vendor.).\n  *os << value;\n}\n\n}  // namespace testing_internal\n\nnamespace testing {\nnamespace internal {\n\n// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given\n// value to the given ostream.  The caller must ensure that\n// 'ostream_ptr' is not NULL, or the behavior is undefined.\n//\n// We define UniversalPrinter as a class template (as opposed to a\n// function template), as we need to partially specialize it for\n// reference types, which cannot be done with function templates.\ntemplate <typename T>\nclass UniversalPrinter;\n\ntemplate <typename T>\nvoid UniversalPrint(const T& value, ::std::ostream* os);\n\n// Used to print an STL-style container when the user doesn't define\n// a PrintTo() for it.\ntemplate <typename C>\nvoid DefaultPrintTo(IsContainer /* dummy */,\n                    false_type /* is not a pointer */,\n                    const C& container, ::std::ostream* os) {\n  const size_t kMaxCount = 32;  // The maximum number of elements to print.\n  *os << '{';\n  size_t count = 0;\n  for (typename C::const_iterator it = container.begin();\n       it != container.end(); ++it, ++count) {\n    if (count > 0) {\n      *os << ',';\n      if (count == kMaxCount) {  // Enough has been printed.\n        *os << \" ...\";\n        break;\n      }\n    }\n    *os << ' ';\n    // We cannot call PrintTo(*it, os) here as PrintTo() doesn't\n    // handle *it being a native array.\n    internal::UniversalPrint(*it, os);\n  }\n\n  if (count > 0) {\n    *os << ' ';\n  }\n  *os << '}';\n}\n\n// Used to print a pointer that is neither a char pointer nor a member\n// pointer, when the user doesn't define PrintTo() for it.  (A member\n// variable pointer or member function pointer doesn't really point to\n// a location in the address space.  Their representation is\n// implementation-defined.  Therefore they will be printed as raw\n// bytes.)\ntemplate <typename T>\nvoid DefaultPrintTo(IsNotContainer /* dummy */,\n                    true_type /* is a pointer */,\n                    T* p, ::std::ostream* os) {\n  if (p == NULL) {\n    *os << \"NULL\";\n  } else {\n    // C++ doesn't allow casting from a function pointer to any object\n    // pointer.\n    //\n    // IsTrue() silences warnings: \"Condition is always true\",\n    // \"unreachable code\".\n    if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {\n      // T is not a function type.  We just call << to print p,\n      // relying on ADL to pick up user-defined << for their pointer\n      // types, if any.\n      *os << p;\n    } else {\n      // T is a function type, so '*os << p' doesn't do what we want\n      // (it just prints p as bool).  We want to print p as a const\n      // void*.  However, we cannot cast it to const void* directly,\n      // even using reinterpret_cast, as earlier versions of gcc\n      // (e.g. 3.4.5) cannot compile the cast when p is a function\n      // pointer.  Casting to UInt64 first solves the problem.\n      *os << reinterpret_cast<const void*>(\n          reinterpret_cast<internal::UInt64>(p));\n    }\n  }\n}\n\n// Used to print a non-container, non-pointer value when the user\n// doesn't define PrintTo() for it.\ntemplate <typename T>\nvoid DefaultPrintTo(IsNotContainer /* dummy */,\n                    false_type /* is not a pointer */,\n                    const T& value, ::std::ostream* os) {\n  ::testing_internal::DefaultPrintNonContainerTo(value, os);\n}\n\n// Prints the given value using the << operator if it has one;\n// otherwise prints the bytes in it.  This is what\n// UniversalPrinter<T>::Print() does when PrintTo() is not specialized\n// or overloaded for type T.\n//\n// A user can override this behavior for a class type Foo by defining\n// an overload of PrintTo() in the namespace where Foo is defined.  We\n// give the user this option as sometimes defining a << operator for\n// Foo is not desirable (e.g. the coding style may prevent doing it,\n// or there is already a << operator but it doesn't do what the user\n// wants).\ntemplate <typename T>\nvoid PrintTo(const T& value, ::std::ostream* os) {\n  // DefaultPrintTo() is overloaded.  The type of its first two\n  // arguments determine which version will be picked.  If T is an\n  // STL-style container, the version for container will be called; if\n  // T is a pointer, the pointer version will be called; otherwise the\n  // generic version will be called.\n  //\n  // Note that we check for container types here, prior to we check\n  // for protocol message types in our operator<<.  The rationale is:\n  //\n  // For protocol messages, we want to give people a chance to\n  // override Google Mock's format by defining a PrintTo() or\n  // operator<<.  For STL containers, other formats can be\n  // incompatible with Google Mock's format for the container\n  // elements; therefore we check for container types here to ensure\n  // that our format is used.\n  //\n  // The second argument of DefaultPrintTo() is needed to bypass a bug\n  // in Symbian's C++ compiler that prevents it from picking the right\n  // overload between:\n  //\n  //   PrintTo(const T& x, ...);\n  //   PrintTo(T* x, ...);\n  DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);\n}\n\n// The following list of PrintTo() overloads tells\n// UniversalPrinter<T>::Print() how to print standard types (built-in\n// types, strings, plain arrays, and pointers).\n\n// Overloads for various char types.\nGTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);\nGTEST_API_ void PrintTo(signed char c, ::std::ostream* os);\ninline void PrintTo(char c, ::std::ostream* os) {\n  // When printing a plain char, we always treat it as unsigned.  This\n  // way, the output won't be affected by whether the compiler thinks\n  // char is signed or not.\n  PrintTo(static_cast<unsigned char>(c), os);\n}\n\n// Overloads for other simple built-in types.\ninline void PrintTo(bool x, ::std::ostream* os) {\n  *os << (x ? \"true\" : \"false\");\n}\n\n// Overload for wchar_t type.\n// Prints a wchar_t as a symbol if it is printable or as its internal\n// code otherwise and also as its decimal code (except for L'\\0').\n// The L'\\0' char is printed as \"L'\\\\0'\". The decimal code is printed\n// as signed integer when wchar_t is implemented by the compiler\n// as a signed type and is printed as an unsigned integer when wchar_t\n// is implemented as an unsigned type.\nGTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);\n\n// Overloads for C strings.\nGTEST_API_ void PrintTo(const char* s, ::std::ostream* os);\ninline void PrintTo(char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const char*>(s), os);\n}\n\n// signed/unsigned char is often used for representing binary data, so\n// we print pointers to it as void* to be safe.\ninline void PrintTo(const signed char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\ninline void PrintTo(signed char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\ninline void PrintTo(const unsigned char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\ninline void PrintTo(unsigned char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\n\n// MSVC can be configured to define wchar_t as a typedef of unsigned\n// short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native\n// type.  When wchar_t is a typedef, defining an overload for const\n// wchar_t* would cause unsigned short* be printed as a wide string,\n// possibly causing invalid memory accesses.\n#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)\n// Overloads for wide C strings\nGTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);\ninline void PrintTo(wchar_t* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const wchar_t*>(s), os);\n}\n#endif\n\n// Overload for C arrays.  Multi-dimensional arrays are printed\n// properly.\n\n// Prints the given number of elements in an array, without printing\n// the curly braces.\ntemplate <typename T>\nvoid PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {\n  UniversalPrint(a[0], os);\n  for (size_t i = 1; i != count; i++) {\n    *os << \", \";\n    UniversalPrint(a[i], os);\n  }\n}\n\n// Overloads for ::string and ::std::string.\n#if GTEST_HAS_GLOBAL_STRING\nGTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);\ninline void PrintTo(const ::string& s, ::std::ostream* os) {\n  PrintStringTo(s, os);\n}\n#endif  // GTEST_HAS_GLOBAL_STRING\n\nGTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);\ninline void PrintTo(const ::std::string& s, ::std::ostream* os) {\n  PrintStringTo(s, os);\n}\n\n// Overloads for ::wstring and ::std::wstring.\n#if GTEST_HAS_GLOBAL_WSTRING\nGTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);\ninline void PrintTo(const ::wstring& s, ::std::ostream* os) {\n  PrintWideStringTo(s, os);\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n#if GTEST_HAS_STD_WSTRING\nGTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);\ninline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {\n  PrintWideStringTo(s, os);\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_TR1_TUPLE\n// Overload for ::std::tr1::tuple.  Needed for printing function arguments,\n// which are packed as tuples.\n\n// Helper function for printing a tuple.  T must be instantiated with\n// a tuple type.\ntemplate <typename T>\nvoid PrintTupleTo(const T& t, ::std::ostream* os);\n\n// Overloaded PrintTo() for tuples of various arities.  We support\n// tuples of up-to 10 fields.  The following implementation works\n// regardless of whether tr1::tuple is implemented using the\n// non-standard variadic template feature or not.\n\ninline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1>\nvoid PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8, typename T9>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8, typename T9, typename T10>\nvoid PrintTo(\n    const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,\n    ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Overload for std::pair.\ntemplate <typename T1, typename T2>\nvoid PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {\n  *os << '(';\n  // We cannot use UniversalPrint(value.first, os) here, as T1 may be\n  // a reference type.  The same for printing value.second.\n  UniversalPrinter<T1>::Print(value.first, os);\n  *os << \", \";\n  UniversalPrinter<T2>::Print(value.second, os);\n  *os << ')';\n}\n\n// Implements printing a non-reference type T by letting the compiler\n// pick the right overload of PrintTo() for T.\ntemplate <typename T>\nclass UniversalPrinter {\n public:\n  // MSVC warns about adding const to a function type, so we want to\n  // disable the warning.\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4180)  // Temporarily disables warning 4180.\n#endif  // _MSC_VER\n\n  // Note: we deliberately don't call this PrintTo(), as that name\n  // conflicts with ::testing::internal::PrintTo in the body of the\n  // function.\n  static void Print(const T& value, ::std::ostream* os) {\n    // By default, ::testing::internal::PrintTo() is used for printing\n    // the value.\n    //\n    // Thanks to Koenig look-up, if T is a class and has its own\n    // PrintTo() function defined in its namespace, that function will\n    // be visible here.  Since it is more specific than the generic ones\n    // in ::testing::internal, it will be picked by the compiler in the\n    // following statement - exactly what we want.\n    PrintTo(value, os);\n  }\n\n#ifdef _MSC_VER\n# pragma warning(pop)           // Restores the warning state.\n#endif  // _MSC_VER\n};\n\n// UniversalPrintArray(begin, len, os) prints an array of 'len'\n// elements, starting at address 'begin'.\ntemplate <typename T>\nvoid UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {\n  if (len == 0) {\n    *os << \"{}\";\n  } else {\n    *os << \"{ \";\n    const size_t kThreshold = 18;\n    const size_t kChunkSize = 8;\n    // If the array has more than kThreshold elements, we'll have to\n    // omit some details by printing only the first and the last\n    // kChunkSize elements.\n    // TODO(wan@google.com): let the user control the threshold using a flag.\n    if (len <= kThreshold) {\n      PrintRawArrayTo(begin, len, os);\n    } else {\n      PrintRawArrayTo(begin, kChunkSize, os);\n      *os << \", ..., \";\n      PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);\n    }\n    *os << \" }\";\n  }\n}\n// This overload prints a (const) char array compactly.\nGTEST_API_ void UniversalPrintArray(\n    const char* begin, size_t len, ::std::ostream* os);\n\n// This overload prints a (const) wchar_t array compactly.\nGTEST_API_ void UniversalPrintArray(\n    const wchar_t* begin, size_t len, ::std::ostream* os);\n\n// Implements printing an array type T[N].\ntemplate <typename T, size_t N>\nclass UniversalPrinter<T[N]> {\n public:\n  // Prints the given array, omitting some elements when there are too\n  // many.\n  static void Print(const T (&a)[N], ::std::ostream* os) {\n    UniversalPrintArray(a, N, os);\n  }\n};\n\n// Implements printing a reference type T&.\ntemplate <typename T>\nclass UniversalPrinter<T&> {\n public:\n  // MSVC warns about adding const to a function type, so we want to\n  // disable the warning.\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4180)  // Temporarily disables warning 4180.\n#endif  // _MSC_VER\n\n  static void Print(const T& value, ::std::ostream* os) {\n    // Prints the address of the value.  We use reinterpret_cast here\n    // as static_cast doesn't compile when T is a function type.\n    *os << \"@\" << reinterpret_cast<const void*>(&value) << \" \";\n\n    // Then prints the value itself.\n    UniversalPrint(value, os);\n  }\n\n#ifdef _MSC_VER\n# pragma warning(pop)           // Restores the warning state.\n#endif  // _MSC_VER\n};\n\n// Prints a value tersely: for a reference type, the referenced value\n// (but not the address) is printed; for a (const) char pointer, the\n// NUL-terminated string (but not the pointer) is printed.\n\ntemplate <typename T>\nclass UniversalTersePrinter {\n public:\n  static void Print(const T& value, ::std::ostream* os) {\n    UniversalPrint(value, os);\n  }\n};\ntemplate <typename T>\nclass UniversalTersePrinter<T&> {\n public:\n  static void Print(const T& value, ::std::ostream* os) {\n    UniversalPrint(value, os);\n  }\n};\ntemplate <typename T, size_t N>\nclass UniversalTersePrinter<T[N]> {\n public:\n  static void Print(const T (&value)[N], ::std::ostream* os) {\n    UniversalPrinter<T[N]>::Print(value, os);\n  }\n};\ntemplate <>\nclass UniversalTersePrinter<const char*> {\n public:\n  static void Print(const char* str, ::std::ostream* os) {\n    if (str == NULL) {\n      *os << \"NULL\";\n    } else {\n      UniversalPrint(string(str), os);\n    }\n  }\n};\ntemplate <>\nclass UniversalTersePrinter<char*> {\n public:\n  static void Print(char* str, ::std::ostream* os) {\n    UniversalTersePrinter<const char*>::Print(str, os);\n  }\n};\n\n#if GTEST_HAS_STD_WSTRING\ntemplate <>\nclass UniversalTersePrinter<const wchar_t*> {\n public:\n  static void Print(const wchar_t* str, ::std::ostream* os) {\n    if (str == NULL) {\n      *os << \"NULL\";\n    } else {\n      UniversalPrint(::std::wstring(str), os);\n    }\n  }\n};\n#endif\n\ntemplate <>\nclass UniversalTersePrinter<wchar_t*> {\n public:\n  static void Print(wchar_t* str, ::std::ostream* os) {\n    UniversalTersePrinter<const wchar_t*>::Print(str, os);\n  }\n};\n\ntemplate <typename T>\nvoid UniversalTersePrint(const T& value, ::std::ostream* os) {\n  UniversalTersePrinter<T>::Print(value, os);\n}\n\n// Prints a value using the type inferred by the compiler.  The\n// difference between this and UniversalTersePrint() is that for a\n// (const) char pointer, this prints both the pointer and the\n// NUL-terminated string.\ntemplate <typename T>\nvoid UniversalPrint(const T& value, ::std::ostream* os) {\n  // A workarond for the bug in VC++ 7.1 that prevents us from instantiating\n  // UniversalPrinter with T directly.\n  typedef T T1;\n  UniversalPrinter<T1>::Print(value, os);\n}\n\n#if GTEST_HAS_TR1_TUPLE\ntypedef ::std::vector<string> Strings;\n\n// This helper template allows PrintTo() for tuples and\n// UniversalTersePrintTupleFieldsToStrings() to be defined by\n// induction on the number of tuple fields.  The idea is that\n// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N\n// fields in tuple t, and can be defined in terms of\n// TuplePrefixPrinter<N - 1>.\n\n// The inductive case.\ntemplate <size_t N>\nstruct TuplePrefixPrinter {\n  // Prints the first N fields of a tuple.\n  template <typename Tuple>\n  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {\n    TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);\n    *os << \", \";\n    UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>\n        ::Print(::std::tr1::get<N - 1>(t), os);\n  }\n\n  // Tersely prints the first N fields of a tuple to a string vector,\n  // one element for each field.\n  template <typename Tuple>\n  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {\n    TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);\n    ::std::stringstream ss;\n    UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);\n    strings->push_back(ss.str());\n  }\n};\n\n// Base cases.\ntemplate <>\nstruct TuplePrefixPrinter<0> {\n  template <typename Tuple>\n  static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}\n\n  template <typename Tuple>\n  static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}\n};\n// We have to specialize the entire TuplePrefixPrinter<> class\n// template here, even though the definition of\n// TersePrintPrefixToStrings() is the same as the generic version, as\n// Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't\n// support specializing a method template of a class template.\ntemplate <>\nstruct TuplePrefixPrinter<1> {\n  template <typename Tuple>\n  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {\n    UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::\n        Print(::std::tr1::get<0>(t), os);\n  }\n\n  template <typename Tuple>\n  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {\n    ::std::stringstream ss;\n    UniversalTersePrint(::std::tr1::get<0>(t), &ss);\n    strings->push_back(ss.str());\n  }\n};\n\n// Helper function for printing a tuple.  T must be instantiated with\n// a tuple type.\ntemplate <typename T>\nvoid PrintTupleTo(const T& t, ::std::ostream* os) {\n  *os << \"(\";\n  TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::\n      PrintPrefixTo(t, os);\n  *os << \")\";\n}\n\n// Prints the fields of a tuple tersely to a string vector, one\n// element for each field.  See the comment before\n// UniversalTersePrint() for how we define \"tersely\".\ntemplate <typename Tuple>\nStrings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {\n  Strings result;\n  TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::\n      TersePrintPrefixToStrings(value, &result);\n  return result;\n}\n#endif  // GTEST_HAS_TR1_TUPLE\n\n}  // namespace internal\n\ntemplate <typename T>\n::std::string PrintToString(const T& value) {\n  ::std::stringstream ss;\n  internal::UniversalTersePrinter<T>::Print(value, &ss);\n  return ss.str();\n}\n\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\nnamespace internal {\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Outputs a message explaining invalid registration of different\n// fixture class for the same test case. This may happen when\n// TEST_P macro is used to define two tests with the same name\n// but in different namespaces.\nGTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,\n                                          const char* file, int line);\n\ntemplate <typename> class ParamGeneratorInterface;\ntemplate <typename> class ParamGenerator;\n\n// Interface for iterating over elements provided by an implementation\n// of ParamGeneratorInterface<T>.\ntemplate <typename T>\nclass ParamIteratorInterface {\n public:\n  virtual ~ParamIteratorInterface() {}\n  // A pointer to the base generator instance.\n  // Used only for the purposes of iterator comparison\n  // to make sure that two iterators belong to the same generator.\n  virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;\n  // Advances iterator to point to the next element\n  // provided by the generator. The caller is responsible\n  // for not calling Advance() on an iterator equal to\n  // BaseGenerator()->End().\n  virtual void Advance() = 0;\n  // Clones the iterator object. Used for implementing copy semantics\n  // of ParamIterator<T>.\n  virtual ParamIteratorInterface* Clone() const = 0;\n  // Dereferences the current iterator and provides (read-only) access\n  // to the pointed value. It is the caller's responsibility not to call\n  // Current() on an iterator equal to BaseGenerator()->End().\n  // Used for implementing ParamGenerator<T>::operator*().\n  virtual const T* Current() const = 0;\n  // Determines whether the given iterator and other point to the same\n  // element in the sequence generated by the generator.\n  // Used for implementing ParamGenerator<T>::operator==().\n  virtual bool Equals(const ParamIteratorInterface& other) const = 0;\n};\n\n// Class iterating over elements provided by an implementation of\n// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>\n// and implements the const forward iterator concept.\ntemplate <typename T>\nclass ParamIterator {\n public:\n  typedef T value_type;\n  typedef const T& reference;\n  typedef ptrdiff_t difference_type;\n\n  // ParamIterator assumes ownership of the impl_ pointer.\n  ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}\n  ParamIterator& operator=(const ParamIterator& other) {\n    if (this != &other)\n      impl_.reset(other.impl_->Clone());\n    return *this;\n  }\n\n  const T& operator*() const { return *impl_->Current(); }\n  const T* operator->() const { return impl_->Current(); }\n  // Prefix version of operator++.\n  ParamIterator& operator++() {\n    impl_->Advance();\n    return *this;\n  }\n  // Postfix version of operator++.\n  ParamIterator operator++(int /*unused*/) {\n    ParamIteratorInterface<T>* clone = impl_->Clone();\n    impl_->Advance();\n    return ParamIterator(clone);\n  }\n  bool operator==(const ParamIterator& other) const {\n    return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);\n  }\n  bool operator!=(const ParamIterator& other) const {\n    return !(*this == other);\n  }\n\n private:\n  friend class ParamGenerator<T>;\n  explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}\n  scoped_ptr<ParamIteratorInterface<T> > impl_;\n};\n\n// ParamGeneratorInterface<T> is the binary interface to access generators\n// defined in other translation units.\ntemplate <typename T>\nclass ParamGeneratorInterface {\n public:\n  typedef T ParamType;\n\n  virtual ~ParamGeneratorInterface() {}\n\n  // Generator interface definition\n  virtual ParamIteratorInterface<T>* Begin() const = 0;\n  virtual ParamIteratorInterface<T>* End() const = 0;\n};\n\n// Wraps ParamGeneratorInterface<T> and provides general generator syntax\n// compatible with the STL Container concept.\n// This class implements copy initialization semantics and the contained\n// ParamGeneratorInterface<T> instance is shared among all copies\n// of the original object. This is possible because that instance is immutable.\ntemplate<typename T>\nclass ParamGenerator {\n public:\n  typedef ParamIterator<T> iterator;\n\n  explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}\n  ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}\n\n  ParamGenerator& operator=(const ParamGenerator& other) {\n    impl_ = other.impl_;\n    return *this;\n  }\n\n  iterator begin() const { return iterator(impl_->Begin()); }\n  iterator end() const { return iterator(impl_->End()); }\n\n private:\n  linked_ptr<const ParamGeneratorInterface<T> > impl_;\n};\n\n// Generates values from a range of two comparable values. Can be used to\n// generate sequences of user-defined types that implement operator+() and\n// operator<().\n// This class is used in the Range() function.\ntemplate <typename T, typename IncrementT>\nclass RangeGenerator : public ParamGeneratorInterface<T> {\n public:\n  RangeGenerator(T begin, T end, IncrementT step)\n      : begin_(begin), end_(end),\n        step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}\n  virtual ~RangeGenerator() {}\n\n  virtual ParamIteratorInterface<T>* Begin() const {\n    return new Iterator(this, begin_, 0, step_);\n  }\n  virtual ParamIteratorInterface<T>* End() const {\n    return new Iterator(this, end_, end_index_, step_);\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<T> {\n   public:\n    Iterator(const ParamGeneratorInterface<T>* base, T value, int index,\n             IncrementT step)\n        : base_(base), value_(value), index_(index), step_(step) {}\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {\n      return base_;\n    }\n    virtual void Advance() {\n      value_ = value_ + step_;\n      index_++;\n    }\n    virtual ParamIteratorInterface<T>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const T* Current() const { return &value_; }\n    virtual bool Equals(const ParamIteratorInterface<T>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const int other_index =\n          CheckedDowncastToActualType<const Iterator>(&other)->index_;\n      return index_ == other_index;\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : ParamIteratorInterface<T>(),\n          base_(other.base_), value_(other.value_), index_(other.index_),\n          step_(other.step_) {}\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<T>* const base_;\n    T value_;\n    int index_;\n    const IncrementT step_;\n  };  // class RangeGenerator::Iterator\n\n  static int CalculateEndIndex(const T& begin,\n                               const T& end,\n                               const IncrementT& step) {\n    int end_index = 0;\n    for (T i = begin; i < end; i = i + step)\n      end_index++;\n    return end_index;\n  }\n\n  // No implementation - assignment is unsupported.\n  void operator=(const RangeGenerator& other);\n\n  const T begin_;\n  const T end_;\n  const IncrementT step_;\n  // The index for the end() iterator. All the elements in the generated\n  // sequence are indexed (0-based) to aid iterator comparison.\n  const int end_index_;\n};  // class RangeGenerator\n\n\n// Generates values from a pair of STL-style iterators. Used in the\n// ValuesIn() function. The elements are copied from the source range\n// since the source can be located on the stack, and the generator\n// is likely to persist beyond that stack frame.\ntemplate <typename T>\nclass ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {\n public:\n  template <typename ForwardIterator>\n  ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)\n      : container_(begin, end) {}\n  virtual ~ValuesInIteratorRangeGenerator() {}\n\n  virtual ParamIteratorInterface<T>* Begin() const {\n    return new Iterator(this, container_.begin());\n  }\n  virtual ParamIteratorInterface<T>* End() const {\n    return new Iterator(this, container_.end());\n  }\n\n private:\n  typedef typename ::std::vector<T> ContainerType;\n\n  class Iterator : public ParamIteratorInterface<T> {\n   public:\n    Iterator(const ParamGeneratorInterface<T>* base,\n             typename ContainerType::const_iterator iterator)\n        : base_(base), iterator_(iterator) {}\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {\n      return base_;\n    }\n    virtual void Advance() {\n      ++iterator_;\n      value_.reset();\n    }\n    virtual ParamIteratorInterface<T>* Clone() const {\n      return new Iterator(*this);\n    }\n    // We need to use cached value referenced by iterator_ because *iterator_\n    // can return a temporary object (and of type other then T), so just\n    // having \"return &*iterator_;\" doesn't work.\n    // value_ is updated here and not in Advance() because Advance()\n    // can advance iterator_ beyond the end of the range, and we cannot\n    // detect that fact. The client code, on the other hand, is\n    // responsible for not calling Current() on an out-of-range iterator.\n    virtual const T* Current() const {\n      if (value_.get() == NULL)\n        value_.reset(new T(*iterator_));\n      return value_.get();\n    }\n    virtual bool Equals(const ParamIteratorInterface<T>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      return iterator_ ==\n          CheckedDowncastToActualType<const Iterator>(&other)->iterator_;\n    }\n\n   private:\n    Iterator(const Iterator& other)\n          // The explicit constructor call suppresses a false warning\n          // emitted by gcc when supplied with the -Wextra option.\n        : ParamIteratorInterface<T>(),\n          base_(other.base_),\n          iterator_(other.iterator_) {}\n\n    const ParamGeneratorInterface<T>* const base_;\n    typename ContainerType::const_iterator iterator_;\n    // A cached value of *iterator_. We keep it here to allow access by\n    // pointer in the wrapping iterator's operator->().\n    // value_ needs to be mutable to be accessed in Current().\n    // Use of scoped_ptr helps manage cached value's lifetime,\n    // which is bound by the lifespan of the iterator itself.\n    mutable scoped_ptr<const T> value_;\n  };  // class ValuesInIteratorRangeGenerator::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const ValuesInIteratorRangeGenerator& other);\n\n  const ContainerType container_;\n};  // class ValuesInIteratorRangeGenerator\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Stores a parameter value and later creates tests parameterized with that\n// value.\ntemplate <class TestClass>\nclass ParameterizedTestFactory : public TestFactoryBase {\n public:\n  typedef typename TestClass::ParamType ParamType;\n  explicit ParameterizedTestFactory(ParamType parameter) :\n      parameter_(parameter) {}\n  virtual Test* CreateTest() {\n    TestClass::SetParam(&parameter_);\n    return new TestClass();\n  }\n\n private:\n  const ParamType parameter_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// TestMetaFactoryBase is a base class for meta-factories that create\n// test factories for passing into MakeAndRegisterTestInfo function.\ntemplate <class ParamType>\nclass TestMetaFactoryBase {\n public:\n  virtual ~TestMetaFactoryBase() {}\n\n  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// TestMetaFactory creates test factories for passing into\n// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives\n// ownership of test factory pointer, same factory object cannot be passed\n// into that method twice. But ParameterizedTestCaseInfo is going to call\n// it for each Test/Parameter value combination. Thus it needs meta factory\n// creator class.\ntemplate <class TestCase>\nclass TestMetaFactory\n    : public TestMetaFactoryBase<typename TestCase::ParamType> {\n public:\n  typedef typename TestCase::ParamType ParamType;\n\n  TestMetaFactory() {}\n\n  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {\n    return new ParameterizedTestFactory<TestCase>(parameter);\n  }\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// ParameterizedTestCaseInfoBase is a generic interface\n// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase\n// accumulates test information provided by TEST_P macro invocations\n// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations\n// and uses that information to register all resulting test instances\n// in RegisterTests method. The ParameterizeTestCaseRegistry class holds\n// a collection of pointers to the ParameterizedTestCaseInfo objects\n// and calls RegisterTests() on each of them when asked.\nclass ParameterizedTestCaseInfoBase {\n public:\n  virtual ~ParameterizedTestCaseInfoBase() {}\n\n  // Base part of test case name for display purposes.\n  virtual const string& GetTestCaseName() const = 0;\n  // Test case id to verify identity.\n  virtual TypeId GetTestCaseTypeId() const = 0;\n  // UnitTest class invokes this method to register tests in this\n  // test case right before running them in RUN_ALL_TESTS macro.\n  // This method should not be called more then once on any single\n  // instance of a ParameterizedTestCaseInfoBase derived class.\n  virtual void RegisterTests() = 0;\n\n protected:\n  ParameterizedTestCaseInfoBase() {}\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P\n// macro invocations for a particular test case and generators\n// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that\n// test case. It registers tests with all values generated by all\n// generators when asked.\ntemplate <class TestCase>\nclass ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {\n public:\n  // ParamType and GeneratorCreationFunc are private types but are required\n  // for declarations of public methods AddTestPattern() and\n  // AddTestCaseInstantiation().\n  typedef typename TestCase::ParamType ParamType;\n  // A function that returns an instance of appropriate generator type.\n  typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();\n\n  explicit ParameterizedTestCaseInfo(const char* name)\n      : test_case_name_(name) {}\n\n  // Test case base name for display purposes.\n  virtual const string& GetTestCaseName() const { return test_case_name_; }\n  // Test case id to verify identity.\n  virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }\n  // TEST_P macro uses AddTestPattern() to record information\n  // about a single test in a LocalTestInfo structure.\n  // test_case_name is the base name of the test case (without invocation\n  // prefix). test_base_name is the name of an individual test without\n  // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is\n  // test case base name and DoBar is test base name.\n  void AddTestPattern(const char* test_case_name,\n                      const char* test_base_name,\n                      TestMetaFactoryBase<ParamType>* meta_factory) {\n    tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,\n                                                       test_base_name,\n                                                       meta_factory)));\n  }\n  // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information\n  // about a generator.\n  int AddTestCaseInstantiation(const string& instantiation_name,\n                               GeneratorCreationFunc* func,\n                               const char* /* file */,\n                               int /* line */) {\n    instantiations_.push_back(::std::make_pair(instantiation_name, func));\n    return 0;  // Return value used only to run this method in namespace scope.\n  }\n  // UnitTest class invokes this method to register tests in this test case\n  // test cases right before running tests in RUN_ALL_TESTS macro.\n  // This method should not be called more then once on any single\n  // instance of a ParameterizedTestCaseInfoBase derived class.\n  // UnitTest has a guard to prevent from calling this method more then once.\n  virtual void RegisterTests() {\n    for (typename TestInfoContainer::iterator test_it = tests_.begin();\n         test_it != tests_.end(); ++test_it) {\n      linked_ptr<TestInfo> test_info = *test_it;\n      for (typename InstantiationContainer::iterator gen_it =\n               instantiations_.begin(); gen_it != instantiations_.end();\n               ++gen_it) {\n        const string& instantiation_name = gen_it->first;\n        ParamGenerator<ParamType> generator((*gen_it->second)());\n\n        string test_case_name;\n        if ( !instantiation_name.empty() )\n          test_case_name = instantiation_name + \"/\";\n        test_case_name += test_info->test_case_base_name;\n\n        int i = 0;\n        for (typename ParamGenerator<ParamType>::iterator param_it =\n                 generator.begin();\n             param_it != generator.end(); ++param_it, ++i) {\n          Message test_name_stream;\n          test_name_stream << test_info->test_base_name << \"/\" << i;\n          MakeAndRegisterTestInfo(\n              test_case_name.c_str(),\n              test_name_stream.GetString().c_str(),\n              NULL,  // No type parameter.\n              PrintToString(*param_it).c_str(),\n              GetTestCaseTypeId(),\n              TestCase::SetUpTestCase,\n              TestCase::TearDownTestCase,\n              test_info->test_meta_factory->CreateTestFactory(*param_it));\n        }  // for param_it\n      }  // for gen_it\n    }  // for test_it\n  }  // RegisterTests\n\n private:\n  // LocalTestInfo structure keeps information about a single test registered\n  // with TEST_P macro.\n  struct TestInfo {\n    TestInfo(const char* a_test_case_base_name,\n             const char* a_test_base_name,\n             TestMetaFactoryBase<ParamType>* a_test_meta_factory) :\n        test_case_base_name(a_test_case_base_name),\n        test_base_name(a_test_base_name),\n        test_meta_factory(a_test_meta_factory) {}\n\n    const string test_case_base_name;\n    const string test_base_name;\n    const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;\n  };\n  typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;\n  // Keeps pairs of <Instantiation name, Sequence generator creation function>\n  // received from INSTANTIATE_TEST_CASE_P macros.\n  typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >\n      InstantiationContainer;\n\n  const string test_case_name_;\n  TestInfoContainer tests_;\n  InstantiationContainer instantiations_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);\n};  // class ParameterizedTestCaseInfo\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase\n// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P\n// macros use it to locate their corresponding ParameterizedTestCaseInfo\n// descriptors.\nclass ParameterizedTestCaseRegistry {\n public:\n  ParameterizedTestCaseRegistry() {}\n  ~ParameterizedTestCaseRegistry() {\n    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();\n         it != test_case_infos_.end(); ++it) {\n      delete *it;\n    }\n  }\n\n  // Looks up or creates and returns a structure containing information about\n  // tests and instantiations of a particular test case.\n  template <class TestCase>\n  ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(\n      const char* test_case_name,\n      const char* file,\n      int line) {\n    ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;\n    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();\n         it != test_case_infos_.end(); ++it) {\n      if ((*it)->GetTestCaseName() == test_case_name) {\n        if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {\n          // Complain about incorrect usage of Google Test facilities\n          // and terminate the program since we cannot guaranty correct\n          // test case setup and tear-down in this case.\n          ReportInvalidTestCaseType(test_case_name,  file, line);\n          posix::Abort();\n        } else {\n          // At this point we are sure that the object we found is of the same\n          // type we are looking for, so we downcast it to that type\n          // without further checks.\n          typed_test_info = CheckedDowncastToActualType<\n              ParameterizedTestCaseInfo<TestCase> >(*it);\n        }\n        break;\n      }\n    }\n    if (typed_test_info == NULL) {\n      typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);\n      test_case_infos_.push_back(typed_test_info);\n    }\n    return typed_test_info;\n  }\n  void RegisterTests() {\n    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();\n         it != test_case_infos_.end(); ++it) {\n      (*it)->RegisterTests();\n    }\n  }\n\n private:\n  typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;\n\n  TestCaseInfoContainer test_case_infos_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);\n};\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  //  GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_\n// This file was GENERATED by command:\n//     pump.py gtest-param-util-generated.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// Type and function utilities for implementing parameterized tests.\n// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n// Currently Google Test supports at most 50 arguments in Values,\n// and at most 10 arguments in Combine. Please contact\n// googletestframework@googlegroups.com if you need more.\n// Please note that the number of arguments to Combine is limited\n// by the maximum arity of the implementation of tr1::tuple which is\n// currently set at 10.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\n\n// Forward declarations of ValuesIn(), which is implemented in\n// include/gtest/gtest-param-test.h.\ntemplate <typename ForwardIterator>\ninternal::ParamGenerator<\n  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>\nValuesIn(ForwardIterator begin, ForwardIterator end);\n\ntemplate <typename T, size_t N>\ninternal::ParamGenerator<T> ValuesIn(const T (&array)[N]);\n\ntemplate <class Container>\ninternal::ParamGenerator<typename Container::value_type> ValuesIn(\n    const Container& container);\n\nnamespace internal {\n\n// Used in the Values() function to provide polymorphic capabilities.\ntemplate <typename T1>\nclass ValueArray1 {\n public:\n  explicit ValueArray1(T1 v1) : v1_(v1) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray1& other);\n\n  const T1 v1_;\n};\n\ntemplate <typename T1, typename T2>\nclass ValueArray2 {\n public:\n  ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray2& other);\n\n  const T1 v1_;\n  const T2 v2_;\n};\n\ntemplate <typename T1, typename T2, typename T3>\nclass ValueArray3 {\n public:\n  ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray3& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nclass ValueArray4 {\n public:\n  ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray4& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nclass ValueArray5 {\n public:\n  ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray5& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nclass ValueArray6 {\n public:\n  ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray6& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nclass ValueArray7 {\n public:\n  ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray7& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nclass ValueArray8 {\n public:\n  ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n      T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray8& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nclass ValueArray9 {\n public:\n  ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n      T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray9& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nclass ValueArray10 {\n public:\n  ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray10& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\nclass ValueArray11 {\n public:\n  ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray11& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\nclass ValueArray12 {\n public:\n  ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray12& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\nclass ValueArray13 {\n public:\n  ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray13& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\nclass ValueArray14 {\n public:\n  ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray14& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\nclass ValueArray15 {\n public:\n  ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray15& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\nclass ValueArray16 {\n public:\n  ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray16& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\nclass ValueArray17 {\n public:\n  ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,\n      T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray17& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\nclass ValueArray18 {\n public:\n  ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray18& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\nclass ValueArray19 {\n public:\n  ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray19& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\nclass ValueArray20 {\n public:\n  ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray20& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\nclass ValueArray21 {\n public:\n  ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray21& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\nclass ValueArray22 {\n public:\n  ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray22& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\nclass ValueArray23 {\n public:\n  ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray23& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\nclass ValueArray24 {\n public:\n  ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray24& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\nclass ValueArray25 {\n public:\n  ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,\n      T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray25& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\nclass ValueArray26 {\n public:\n  ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray26& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\nclass ValueArray27 {\n public:\n  ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),\n      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),\n      v26_(v26), v27_(v27) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray27& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\nclass ValueArray28 {\n public:\n  ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),\n      v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray28& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\nclass ValueArray29 {\n public:\n  ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),\n      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray29& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\nclass ValueArray30 {\n public:\n  ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray30& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\nclass ValueArray31 {\n public:\n  ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray31& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\nclass ValueArray32 {\n public:\n  ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),\n      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray32& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\nclass ValueArray33 {\n public:\n  ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,\n      T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray33& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\nclass ValueArray34 {\n public:\n  ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray34& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\nclass ValueArray35 {\n public:\n  ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),\n      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),\n      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),\n      v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray35& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\nclass ValueArray36 {\n public:\n  ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),\n      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),\n      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray36& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\nclass ValueArray37 {\n public:\n  ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),\n      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),\n      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),\n      v36_(v36), v37_(v37) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray37& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\nclass ValueArray38 {\n public:\n  ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray38& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\nclass ValueArray39 {\n public:\n  ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray39& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\nclass ValueArray40 {\n public:\n  ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),\n      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),\n      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),\n      v40_(v40) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray40& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\nclass ValueArray41 {\n public:\n  ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,\n      T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray41& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\nclass ValueArray42 {\n public:\n  ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray42& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\nclass ValueArray43 {\n public:\n  ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),\n      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),\n      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),\n      v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),\n      v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray43& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\nclass ValueArray44 {\n public:\n  ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),\n      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),\n      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),\n      v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),\n      v43_(v43), v44_(v44) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray44& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\nclass ValueArray45 {\n public:\n  ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),\n      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),\n      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),\n      v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),\n      v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray45& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\nclass ValueArray46 {\n public:\n  ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),\n      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray46& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\nclass ValueArray47 {\n public:\n  ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),\n      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),\n      v47_(v47) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray47& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\nclass ValueArray48 {\n public:\n  ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),\n      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),\n      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),\n      v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),\n      v46_(v46), v47_(v47), v48_(v48) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),\n        static_cast<T>(v48_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray48& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n  const T48 v48_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\nclass ValueArray49 {\n public:\n  ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,\n      T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),\n      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),\n        static_cast<T>(v48_), static_cast<T>(v49_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray49& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n  const T48 v48_;\n  const T49 v49_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\nclass ValueArray50 {\n public:\n  ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,\n      T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),\n      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),\n        static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray50& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n  const T48 v48_;\n  const T49 v49_;\n  const T50 v50_;\n};\n\n# if GTEST_HAS_COMBINE\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Generates values from the Cartesian product of values produced\n// by the argument generators.\n//\ntemplate <typename T1, typename T2>\nclass CartesianProductGenerator2\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2> ParamType;\n\n  CartesianProductGenerator2(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2)\n      : g1_(g1), g2_(g2) {}\n  virtual ~CartesianProductGenerator2() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current2_;\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator2::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator2& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n};  // class CartesianProductGenerator2\n\n\ntemplate <typename T1, typename T2, typename T3>\nclass CartesianProductGenerator3\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3> ParamType;\n\n  CartesianProductGenerator3(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)\n      : g1_(g1), g2_(g2), g3_(g3) {}\n  virtual ~CartesianProductGenerator3() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current3_;\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator3::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator3& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n};  // class CartesianProductGenerator3\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nclass CartesianProductGenerator4\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;\n\n  CartesianProductGenerator4(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}\n  virtual ~CartesianProductGenerator4() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current4_;\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator4::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator4& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n};  // class CartesianProductGenerator4\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nclass CartesianProductGenerator5\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;\n\n  CartesianProductGenerator5(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}\n  virtual ~CartesianProductGenerator5() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current5_;\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator5::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator5& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n};  // class CartesianProductGenerator5\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nclass CartesianProductGenerator6\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,\n        T6> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;\n\n  CartesianProductGenerator6(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}\n  virtual ~CartesianProductGenerator6() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current6_;\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator6::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator6& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n};  // class CartesianProductGenerator6\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nclass CartesianProductGenerator7\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;\n\n  CartesianProductGenerator7(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}\n  virtual ~CartesianProductGenerator7() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current7_;\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator7::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator7& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n};  // class CartesianProductGenerator7\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nclass CartesianProductGenerator8\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7, T8> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;\n\n  CartesianProductGenerator8(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,\n      const ParamGenerator<T8>& g8)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),\n          g8_(g8) {}\n  virtual ~CartesianProductGenerator8() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin(), g8_, g8_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,\n        g8_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7,\n      const ParamGenerator<T8>& g8,\n      const typename ParamGenerator<T8>::iterator& current8)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),\n          begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current8_;\n      if (current8_ == end8_) {\n        current8_ = begin8_;\n        ++current7_;\n      }\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_ &&\n          current8_ == typed_other->current8_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_),\n        begin8_(other.begin8_),\n        end8_(other.end8_),\n        current8_(other.current8_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_, *current8_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_ ||\n          current8_ == end8_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    const typename ParamGenerator<T8>::iterator begin8_;\n    const typename ParamGenerator<T8>::iterator end8_;\n    typename ParamGenerator<T8>::iterator current8_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator8::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator8& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n  const ParamGenerator<T8> g8_;\n};  // class CartesianProductGenerator8\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nclass CartesianProductGenerator9\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7, T8, T9> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;\n\n  CartesianProductGenerator9(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,\n      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9) {}\n  virtual ~CartesianProductGenerator9() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,\n        g8_.end(), g9_, g9_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7,\n      const ParamGenerator<T8>& g8,\n      const typename ParamGenerator<T8>::iterator& current8,\n      const ParamGenerator<T9>& g9,\n      const typename ParamGenerator<T9>::iterator& current9)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),\n          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),\n          begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current9_;\n      if (current9_ == end9_) {\n        current9_ = begin9_;\n        ++current8_;\n      }\n      if (current8_ == end8_) {\n        current8_ = begin8_;\n        ++current7_;\n      }\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_ &&\n          current8_ == typed_other->current8_ &&\n          current9_ == typed_other->current9_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_),\n        begin8_(other.begin8_),\n        end8_(other.end8_),\n        current8_(other.current8_),\n        begin9_(other.begin9_),\n        end9_(other.end9_),\n        current9_(other.current9_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_, *current8_,\n            *current9_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_ ||\n          current8_ == end8_ ||\n          current9_ == end9_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    const typename ParamGenerator<T8>::iterator begin8_;\n    const typename ParamGenerator<T8>::iterator end8_;\n    typename ParamGenerator<T8>::iterator current8_;\n    const typename ParamGenerator<T9>::iterator begin9_;\n    const typename ParamGenerator<T9>::iterator end9_;\n    typename ParamGenerator<T9>::iterator current9_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator9::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator9& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n  const ParamGenerator<T8> g8_;\n  const ParamGenerator<T9> g9_;\n};  // class CartesianProductGenerator9\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nclass CartesianProductGenerator10\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7, T8, T9, T10> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;\n\n  CartesianProductGenerator10(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,\n      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,\n      const ParamGenerator<T10>& g10)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9), g10_(g10) {}\n  virtual ~CartesianProductGenerator10() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,\n        g8_.end(), g9_, g9_.end(), g10_, g10_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7,\n      const ParamGenerator<T8>& g8,\n      const typename ParamGenerator<T8>::iterator& current8,\n      const ParamGenerator<T9>& g9,\n      const typename ParamGenerator<T9>::iterator& current9,\n      const ParamGenerator<T10>& g10,\n      const typename ParamGenerator<T10>::iterator& current10)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),\n          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),\n          begin9_(g9.begin()), end9_(g9.end()), current9_(current9),\n          begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current10_;\n      if (current10_ == end10_) {\n        current10_ = begin10_;\n        ++current9_;\n      }\n      if (current9_ == end9_) {\n        current9_ = begin9_;\n        ++current8_;\n      }\n      if (current8_ == end8_) {\n        current8_ = begin8_;\n        ++current7_;\n      }\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_ &&\n          current8_ == typed_other->current8_ &&\n          current9_ == typed_other->current9_ &&\n          current10_ == typed_other->current10_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_),\n        begin8_(other.begin8_),\n        end8_(other.end8_),\n        current8_(other.current8_),\n        begin9_(other.begin9_),\n        end9_(other.end9_),\n        current9_(other.current9_),\n        begin10_(other.begin10_),\n        end10_(other.end10_),\n        current10_(other.current10_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_, *current8_,\n            *current9_, *current10_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_ ||\n          current8_ == end8_ ||\n          current9_ == end9_ ||\n          current10_ == end10_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    const typename ParamGenerator<T8>::iterator begin8_;\n    const typename ParamGenerator<T8>::iterator end8_;\n    typename ParamGenerator<T8>::iterator current8_;\n    const typename ParamGenerator<T9>::iterator begin9_;\n    const typename ParamGenerator<T9>::iterator end9_;\n    typename ParamGenerator<T9>::iterator current9_;\n    const typename ParamGenerator<T10>::iterator begin10_;\n    const typename ParamGenerator<T10>::iterator end10_;\n    typename ParamGenerator<T10>::iterator current10_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator10::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator10& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n  const ParamGenerator<T8> g8_;\n  const ParamGenerator<T9> g9_;\n  const ParamGenerator<T10> g10_;\n};  // class CartesianProductGenerator10\n\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Helper classes providing Combine() with polymorphic features. They allow\n// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is\n// convertible to U.\n//\ntemplate <class Generator1, class Generator2>\nclass CartesianProductHolder2 {\n public:\nCartesianProductHolder2(const Generator1& g1, const Generator2& g2)\n      : g1_(g1), g2_(g2) {}\n  template <typename T1, typename T2>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2> >(\n        new CartesianProductGenerator2<T1, T2>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder2& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n};  // class CartesianProductHolder2\n\ntemplate <class Generator1, class Generator2, class Generator3>\nclass CartesianProductHolder3 {\n public:\nCartesianProductHolder3(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3)\n      : g1_(g1), g2_(g2), g3_(g3) {}\n  template <typename T1, typename T2, typename T3>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(\n        new CartesianProductGenerator3<T1, T2, T3>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder3& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n};  // class CartesianProductHolder3\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4>\nclass CartesianProductHolder4 {\n public:\nCartesianProductHolder4(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}\n  template <typename T1, typename T2, typename T3, typename T4>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(\n        new CartesianProductGenerator4<T1, T2, T3, T4>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder4& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n};  // class CartesianProductHolder4\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5>\nclass CartesianProductHolder5 {\n public:\nCartesianProductHolder5(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(\n        new CartesianProductGenerator5<T1, T2, T3, T4, T5>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder5& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n};  // class CartesianProductHolder5\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6>\nclass CartesianProductHolder6 {\n public:\nCartesianProductHolder6(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(\n        new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder6& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n};  // class CartesianProductHolder6\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7>\nclass CartesianProductHolder7 {\n public:\nCartesianProductHolder7(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n      T7> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(\n        new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder7& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n};  // class CartesianProductHolder7\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7,\n    class Generator8>\nclass CartesianProductHolder8 {\n public:\nCartesianProductHolder8(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7, const Generator8& g8)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),\n          g8_(g8) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7, typename T8>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,\n      T8> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(\n        new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_),\n        static_cast<ParamGenerator<T8> >(g8_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder8& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n  const Generator8 g8_;\n};  // class CartesianProductHolder8\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7,\n    class Generator8, class Generator9>\nclass CartesianProductHolder9 {\n public:\nCartesianProductHolder9(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7, const Generator8& g8,\n    const Generator9& g9)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7, typename T8, typename T9>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n      T9> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n        T9> >(\n        new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_),\n        static_cast<ParamGenerator<T8> >(g8_),\n        static_cast<ParamGenerator<T9> >(g9_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder9& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n  const Generator8 g8_;\n  const Generator9 g9_;\n};  // class CartesianProductHolder9\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7,\n    class Generator8, class Generator9, class Generator10>\nclass CartesianProductHolder10 {\n public:\nCartesianProductHolder10(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7, const Generator8& g8,\n    const Generator9& g9, const Generator10& g10)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9), g10_(g10) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7, typename T8, typename T9, typename T10>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n      T9, T10> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n        T9, T10> >(\n        new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,\n            T10>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_),\n        static_cast<ParamGenerator<T8> >(g8_),\n        static_cast<ParamGenerator<T9> >(g9_),\n        static_cast<ParamGenerator<T10> >(g10_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder10& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n  const Generator8 g8_;\n  const Generator9 g9_;\n  const Generator10 g10_;\n};  // class CartesianProductHolder10\n\n# endif  // GTEST_HAS_COMBINE\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  //  GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\n\n// Functions producing parameter generators.\n//\n// Google Test uses these generators to produce parameters for value-\n// parameterized tests. When a parameterized test case is instantiated\n// with a particular generator, Google Test creates and runs tests\n// for each element in the sequence produced by the generator.\n//\n// In the following sample, tests from test case FooTest are instantiated\n// each three times with parameter values 3, 5, and 8:\n//\n// class FooTest : public TestWithParam<int> { ... };\n//\n// TEST_P(FooTest, TestThis) {\n// }\n// TEST_P(FooTest, TestThat) {\n// }\n// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));\n//\n\n// Range() returns generators providing sequences of values in a range.\n//\n// Synopsis:\n// Range(start, end)\n//   - returns a generator producing a sequence of values {start, start+1,\n//     start+2, ..., }.\n// Range(start, end, step)\n//   - returns a generator producing a sequence of values {start, start+step,\n//     start+step+step, ..., }.\n// Notes:\n//   * The generated sequences never include end. For example, Range(1, 5)\n//     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)\n//     returns a generator producing {1, 3, 5, 7}.\n//   * start and end must have the same type. That type may be any integral or\n//     floating-point type or a user defined type satisfying these conditions:\n//     * It must be assignable (have operator=() defined).\n//     * It must have operator+() (operator+(int-compatible type) for\n//       two-operand version).\n//     * It must have operator<() defined.\n//     Elements in the resulting sequences will also have that type.\n//   * Condition start < end must be satisfied in order for resulting sequences\n//     to contain any elements.\n//\ntemplate <typename T, typename IncrementT>\ninternal::ParamGenerator<T> Range(T start, T end, IncrementT step) {\n  return internal::ParamGenerator<T>(\n      new internal::RangeGenerator<T, IncrementT>(start, end, step));\n}\n\ntemplate <typename T>\ninternal::ParamGenerator<T> Range(T start, T end) {\n  return Range(start, end, 1);\n}\n\n// ValuesIn() function allows generation of tests with parameters coming from\n// a container.\n//\n// Synopsis:\n// ValuesIn(const T (&array)[N])\n//   - returns a generator producing sequences with elements from\n//     a C-style array.\n// ValuesIn(const Container& container)\n//   - returns a generator producing sequences with elements from\n//     an STL-style container.\n// ValuesIn(Iterator begin, Iterator end)\n//   - returns a generator producing sequences with elements from\n//     a range [begin, end) defined by a pair of STL-style iterators. These\n//     iterators can also be plain C pointers.\n//\n// Please note that ValuesIn copies the values from the containers\n// passed in and keeps them to generate tests in RUN_ALL_TESTS().\n//\n// Examples:\n//\n// This instantiates tests from test case StringTest\n// each with C-string values of \"foo\", \"bar\", and \"baz\":\n//\n// const char* strings[] = {\"foo\", \"bar\", \"baz\"};\n// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));\n//\n// This instantiates tests from test case StlStringTest\n// each with STL strings with values \"a\" and \"b\":\n//\n// ::std::vector< ::std::string> GetParameterStrings() {\n//   ::std::vector< ::std::string> v;\n//   v.push_back(\"a\");\n//   v.push_back(\"b\");\n//   return v;\n// }\n//\n// INSTANTIATE_TEST_CASE_P(CharSequence,\n//                         StlStringTest,\n//                         ValuesIn(GetParameterStrings()));\n//\n//\n// This will also instantiate tests from CharTest\n// each with parameter values 'a' and 'b':\n//\n// ::std::list<char> GetParameterChars() {\n//   ::std::list<char> list;\n//   list.push_back('a');\n//   list.push_back('b');\n//   return list;\n// }\n// ::std::list<char> l = GetParameterChars();\n// INSTANTIATE_TEST_CASE_P(CharSequence2,\n//                         CharTest,\n//                         ValuesIn(l.begin(), l.end()));\n//\ntemplate <typename ForwardIterator>\ninternal::ParamGenerator<\n  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>\nValuesIn(ForwardIterator begin, ForwardIterator end) {\n  typedef typename ::testing::internal::IteratorTraits<ForwardIterator>\n      ::value_type ParamType;\n  return internal::ParamGenerator<ParamType>(\n      new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));\n}\n\ntemplate <typename T, size_t N>\ninternal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {\n  return ValuesIn(array, array + N);\n}\n\ntemplate <class Container>\ninternal::ParamGenerator<typename Container::value_type> ValuesIn(\n    const Container& container) {\n  return ValuesIn(container.begin(), container.end());\n}\n\n// Values() allows generating tests from explicitly specified list of\n// parameters.\n//\n// Synopsis:\n// Values(T v1, T v2, ..., T vN)\n//   - returns a generator producing sequences with elements v1, v2, ..., vN.\n//\n// For example, this instantiates tests from test case BarTest each\n// with values \"one\", \"two\", and \"three\":\n//\n// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values(\"one\", \"two\", \"three\"));\n//\n// This instantiates tests from test case BazTest each with values 1, 2, 3.5.\n// The exact type of values will depend on the type of parameter in BazTest.\n//\n// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));\n//\n// Currently, Values() supports from 1 to 50 parameters.\n//\ntemplate <typename T1>\ninternal::ValueArray1<T1> Values(T1 v1) {\n  return internal::ValueArray1<T1>(v1);\n}\n\ntemplate <typename T1, typename T2>\ninternal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {\n  return internal::ValueArray2<T1, T2>(v1, v2);\n}\n\ntemplate <typename T1, typename T2, typename T3>\ninternal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {\n  return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\ninternal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {\n  return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\ninternal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5) {\n  return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\ninternal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6) {\n  return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\ninternal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6, T7 v7) {\n  return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,\n      v6, v7);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\ninternal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {\n  return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,\n      v5, v6, v7, v8);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\ninternal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {\n  return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,\n      v4, v5, v6, v7, v8, v9);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\ninternal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,\n    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {\n  return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,\n      v2, v3, v4, v5, v6, v7, v8, v9, v10);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\ninternal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,\n    T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11) {\n  return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,\n      T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\ninternal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n    T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12) {\n  return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\ninternal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n    T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13) {\n  return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\ninternal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {\n  return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,\n      v14);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\ninternal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {\n  return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,\n      v13, v14, v15);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\ninternal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16) {\n  return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,\n      v12, v13, v14, v15, v16);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\ninternal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17) {\n  return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,\n      v11, v12, v13, v14, v15, v16, v17);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\ninternal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,\n    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18) {\n  return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,\n      v10, v11, v12, v13, v14, v15, v16, v17, v18);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\ninternal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,\n    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,\n    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {\n  return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,\n      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\ninternal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {\n  return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,\n      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\ninternal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {\n  return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,\n      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\ninternal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22) {\n  return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,\n      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\ninternal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23) {\n  return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,\n      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\ninternal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24) {\n  return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,\n      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,\n      v19, v20, v21, v22, v23, v24);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\ninternal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,\n    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,\n    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,\n    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {\n  return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,\n      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,\n      v18, v19, v20, v21, v22, v23, v24, v25);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\ninternal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n    T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26) {\n  return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,\n      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\ninternal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n    T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27) {\n  return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,\n      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\ninternal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n    T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28) {\n  return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,\n      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,\n      v28);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\ninternal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29) {\n  return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,\n      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,\n      v27, v28, v29);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\ninternal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,\n    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,\n    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {\n  return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,\n      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,\n      v26, v27, v28, v29, v30);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\ninternal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {\n  return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,\n      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,\n      v25, v26, v27, v28, v29, v30, v31);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\ninternal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32) {\n  return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,\n      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\ninternal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,\n    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33) {\n  return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,\n      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\ninternal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,\n    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,\n    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,\n    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,\n    T31 v31, T32 v32, T33 v33, T34 v34) {\n  return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,\n      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,\n      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\ninternal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,\n    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,\n    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {\n  return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,\n      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,\n      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\ninternal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,\n    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,\n    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {\n  return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,\n      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,\n      v34, v35, v36);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\ninternal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,\n    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,\n    T37 v37) {\n  return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,\n      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,\n      v34, v35, v36, v37);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\ninternal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,\n    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,\n    T37 v37, T38 v38) {\n  return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,\n      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,\n      v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,\n      v33, v34, v35, v36, v37, v38);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\ninternal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,\n    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,\n    T37 v37, T38 v38, T39 v39) {\n  return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,\n      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,\n      v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,\n      v32, v33, v34, v35, v36, v37, v38, v39);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\ninternal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,\n    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,\n    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,\n    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,\n    T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,\n    T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {\n  return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,\n      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,\n      v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\ninternal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n    T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {\n  return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,\n      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,\n      v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\ninternal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n    T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n    T42 v42) {\n  return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,\n      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,\n      v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,\n      v42);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\ninternal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n    T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n    T42 v42, T43 v43) {\n  return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,\n      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,\n      v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,\n      v41, v42, v43);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\ninternal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n    T42 v42, T43 v43, T44 v44) {\n  return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,\n      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,\n      v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,\n      v40, v41, v42, v43, v44);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\ninternal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,\n    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,\n    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,\n    T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,\n    T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {\n  return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,\n      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,\n      v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,\n      v39, v40, v41, v42, v43, v44, v45);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\ninternal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,\n    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {\n  return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,\n      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,\n      v38, v39, v40, v41, v42, v43, v44, v45, v46);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\ninternal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,\n    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {\n  return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,\n      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,\n      v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\ninternal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,\n    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,\n    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,\n    T48 v48) {\n  return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,\n      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,\n      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,\n      v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\ninternal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,\n    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,\n    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,\n    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,\n    T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,\n    T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,\n    T47 v47, T48 v48, T49 v49) {\n  return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,\n      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,\n      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,\n      v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\ninternal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,\n    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,\n    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,\n    T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,\n    T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {\n  return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,\n      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,\n      v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,\n      v48, v49, v50);\n}\n\n// Bool() allows generating tests with parameters in a set of (false, true).\n//\n// Synopsis:\n// Bool()\n//   - returns a generator producing sequences with elements {false, true}.\n//\n// It is useful when testing code that depends on Boolean flags. Combinations\n// of multiple flags can be tested when several Bool()'s are combined using\n// Combine() function.\n//\n// In the following example all tests in the test case FlagDependentTest\n// will be instantiated twice with parameters false and true.\n//\n// class FlagDependentTest : public testing::TestWithParam<bool> {\n//   virtual void SetUp() {\n//     external_flag = GetParam();\n//   }\n// }\n// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());\n//\ninline internal::ParamGenerator<bool> Bool() {\n  return Values(false, true);\n}\n\n# if GTEST_HAS_COMBINE\n// Combine() allows the user to combine two or more sequences to produce\n// values of a Cartesian product of those sequences' elements.\n//\n// Synopsis:\n// Combine(gen1, gen2, ..., genN)\n//   - returns a generator producing sequences with elements coming from\n//     the Cartesian product of elements from the sequences generated by\n//     gen1, gen2, ..., genN. The sequence elements will have a type of\n//     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types\n//     of elements from sequences produces by gen1, gen2, ..., genN.\n//\n// Combine can have up to 10 arguments. This number is currently limited\n// by the maximum number of elements in the tuple implementation used by Google\n// Test.\n//\n// Example:\n//\n// This will instantiate tests in test case AnimalTest each one with\n// the parameter values tuple(\"cat\", BLACK), tuple(\"cat\", WHITE),\n// tuple(\"dog\", BLACK), and tuple(\"dog\", WHITE):\n//\n// enum Color { BLACK, GRAY, WHITE };\n// class AnimalTest\n//     : public testing::TestWithParam<tuple<const char*, Color> > {...};\n//\n// TEST_P(AnimalTest, AnimalLooksNice) {...}\n//\n// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,\n//                         Combine(Values(\"cat\", \"dog\"),\n//                                 Values(BLACK, WHITE)));\n//\n// This will instantiate tests in FlagDependentTest with all variations of two\n// Boolean flags:\n//\n// class FlagDependentTest\n//     : public testing::TestWithParam<tuple<bool, bool> > {\n//   virtual void SetUp() {\n//     // Assigns external_flag_1 and external_flag_2 values from the tuple.\n//     tie(external_flag_1, external_flag_2) = GetParam();\n//   }\n// };\n//\n// TEST_P(FlagDependentTest, TestFeature1) {\n//   // Test your code using external_flag_1 and external_flag_2 here.\n// }\n// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,\n//                         Combine(Bool(), Bool()));\n//\ntemplate <typename Generator1, typename Generator2>\ninternal::CartesianProductHolder2<Generator1, Generator2> Combine(\n    const Generator1& g1, const Generator2& g2) {\n  return internal::CartesianProductHolder2<Generator1, Generator2>(\n      g1, g2);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3>\ninternal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3) {\n  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(\n      g1, g2, g3);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4>\ninternal::CartesianProductHolder4<Generator1, Generator2, Generator3,\n    Generator4> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4) {\n  return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,\n      Generator4>(\n      g1, g2, g3, g4);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5>\ninternal::CartesianProductHolder5<Generator1, Generator2, Generator3,\n    Generator4, Generator5> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5) {\n  return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,\n      Generator4, Generator5>(\n      g1, g2, g3, g4, g5);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6>\ninternal::CartesianProductHolder6<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6) {\n  return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6>(\n      g1, g2, g3, g4, g5, g6);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7>\ninternal::CartesianProductHolder7<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7) {\n  return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7>(\n      g1, g2, g3, g4, g5, g6, g7);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7, typename Generator8>\ninternal::CartesianProductHolder8<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7, Generator8> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7, const Generator8& g8) {\n  return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7, Generator8>(\n      g1, g2, g3, g4, g5, g6, g7, g8);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7, typename Generator8, typename Generator9>\ninternal::CartesianProductHolder9<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7, Generator8,\n    Generator9> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7, const Generator8& g8, const Generator9& g9) {\n  return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(\n      g1, g2, g3, g4, g5, g6, g7, g8, g9);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7, typename Generator8, typename Generator9,\n    typename Generator10>\ninternal::CartesianProductHolder10<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,\n    Generator10> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7, const Generator8& g8, const Generator9& g9,\n        const Generator10& g10) {\n  return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,\n      Generator10>(\n      g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);\n}\n# endif  // GTEST_HAS_COMBINE\n\n\n\n# define TEST_P(test_case_name, test_name) \\\n  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \\\n      : public test_case_name { \\\n   public: \\\n    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \\\n    virtual void TestBody(); \\\n   private: \\\n    static int AddToRegistry() { \\\n      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \\\n          GetTestCasePatternHolder<test_case_name>(\\\n              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\\\n                  #test_case_name, \\\n                  #test_name, \\\n                  new ::testing::internal::TestMetaFactory< \\\n                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \\\n      return 0; \\\n    } \\\n    static int gtest_registering_dummy_; \\\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(\\\n        GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \\\n  }; \\\n  int GTEST_TEST_CLASS_NAME_(test_case_name, \\\n                             test_name)::gtest_registering_dummy_ = \\\n      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \\\n  void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\n\n# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \\\n  ::testing::internal::ParamGenerator<test_case_name::ParamType> \\\n      gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \\\n  int gtest_##prefix##test_case_name##_dummy_ = \\\n      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \\\n          GetTestCasePatternHolder<test_case_name>(\\\n              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\\\n                  #prefix, \\\n                  &gtest_##prefix##test_case_name##_EvalGenerator_, \\\n                  __FILE__, __LINE__)\n\n}  // namespace testing\n\n#endif  // GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Google C++ Testing Framework definitions useful in production code.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_\n\n// When you need to test the private or protected members of a class,\n// use the FRIEND_TEST macro to declare your tests as friends of the\n// class.  For example:\n//\n// class MyClass {\n//  private:\n//   void MyMethod();\n//   FRIEND_TEST(MyClassTest, MyMethod);\n// };\n//\n// class MyClassTest : public testing::Test {\n//   // ...\n// };\n//\n// TEST_F(MyClassTest, MyMethod) {\n//   // Can call MyClass::MyMethod() here.\n// }\n\n#define FRIEND_TEST(test_case_name, test_name)\\\nfriend class test_case_name##_##test_name##_Test\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_\n#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_\n\n#include <iosfwd>\n#include <vector>\n\nnamespace testing {\n\n// A copyable object representing the result of a test part (i.e. an\n// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).\n//\n// Don't inherit from TestPartResult as its destructor is not virtual.\nclass GTEST_API_ TestPartResult {\n public:\n  // The possible outcomes of a test part (i.e. an assertion or an\n  // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).\n  enum Type {\n    kSuccess,          // Succeeded.\n    kNonFatalFailure,  // Failed but the test can continue.\n    kFatalFailure      // Failed and the test should be terminated.\n  };\n\n  // C'tor.  TestPartResult does NOT have a default constructor.\n  // Always use this constructor (with parameters) to create a\n  // TestPartResult object.\n  TestPartResult(Type a_type,\n                 const char* a_file_name,\n                 int a_line_number,\n                 const char* a_message)\n      : type_(a_type),\n        file_name_(a_file_name == NULL ? \"\" : a_file_name),\n        line_number_(a_line_number),\n        summary_(ExtractSummary(a_message)),\n        message_(a_message) {\n  }\n\n  // Gets the outcome of the test part.\n  Type type() const { return type_; }\n\n  // Gets the name of the source file where the test part took place, or\n  // NULL if it's unknown.\n  const char* file_name() const {\n    return file_name_.empty() ? NULL : file_name_.c_str();\n  }\n\n  // Gets the line in the source file where the test part took place,\n  // or -1 if it's unknown.\n  int line_number() const { return line_number_; }\n\n  // Gets the summary of the failure message.\n  const char* summary() const { return summary_.c_str(); }\n\n  // Gets the message associated with the test part.\n  const char* message() const { return message_.c_str(); }\n\n  // Returns true iff the test part passed.\n  bool passed() const { return type_ == kSuccess; }\n\n  // Returns true iff the test part failed.\n  bool failed() const { return type_ != kSuccess; }\n\n  // Returns true iff the test part non-fatally failed.\n  bool nonfatally_failed() const { return type_ == kNonFatalFailure; }\n\n  // Returns true iff the test part fatally failed.\n  bool fatally_failed() const { return type_ == kFatalFailure; }\n\n private:\n  Type type_;\n\n  // Gets the summary of the failure message by omitting the stack\n  // trace in it.\n  static std::string ExtractSummary(const char* message);\n\n  // The name of the source file where the test part took place, or\n  // \"\" if the source file is unknown.\n  std::string file_name_;\n  // The line in the source file where the test part took place, or -1\n  // if the line number is unknown.\n  int line_number_;\n  std::string summary_;  // The test failure summary.\n  std::string message_;  // The test failure message.\n};\n\n// Prints a TestPartResult object.\nstd::ostream& operator<<(std::ostream& os, const TestPartResult& result);\n\n// An array of TestPartResult objects.\n//\n// Don't inherit from TestPartResultArray as its destructor is not\n// virtual.\nclass GTEST_API_ TestPartResultArray {\n public:\n  TestPartResultArray() {}\n\n  // Appends the given TestPartResult to the array.\n  void Append(const TestPartResult& result);\n\n  // Returns the TestPartResult at the given index (0-based).\n  const TestPartResult& GetTestPartResult(int index) const;\n\n  // Returns the number of TestPartResult objects in the array.\n  int size() const;\n\n private:\n  std::vector<TestPartResult> array_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);\n};\n\n// This interface knows how to report a test part result.\nclass TestPartResultReporterInterface {\n public:\n  virtual ~TestPartResultReporterInterface() {}\n\n  virtual void ReportTestPartResult(const TestPartResult& result) = 0;\n};\n\nnamespace internal {\n\n// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a\n// statement generates new fatal failures. To do so it registers itself as the\n// current test part result reporter. Besides checking if fatal failures were\n// reported, it only delegates the reporting to the former result reporter.\n// The original result reporter is restored in the destructor.\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nclass GTEST_API_ HasNewFatalFailureHelper\n    : public TestPartResultReporterInterface {\n public:\n  HasNewFatalFailureHelper();\n  virtual ~HasNewFatalFailureHelper();\n  virtual void ReportTestPartResult(const TestPartResult& result);\n  bool has_new_fatal_failure() const { return has_new_fatal_failure_; }\n private:\n  bool has_new_fatal_failure_;\n  TestPartResultReporterInterface* original_reporter_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);\n};\n\n}  // namespace internal\n\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_\n\n// This header implements typed tests and type-parameterized tests.\n\n// Typed (aka type-driven) tests repeat the same test for types in a\n// list.  You must know which types you want to test with when writing\n// typed tests. Here's how you do it:\n\n#if 0\n\n// First, define a fixture class template.  It should be parameterized\n// by a type.  Remember to derive it from testing::Test.\ntemplate <typename T>\nclass FooTest : public testing::Test {\n public:\n  ...\n  typedef std::list<T> List;\n  static T shared_;\n  T value_;\n};\n\n// Next, associate a list of types with the test case, which will be\n// repeated for each type in the list.  The typedef is necessary for\n// the macro to parse correctly.\ntypedef testing::Types<char, int, unsigned int> MyTypes;\nTYPED_TEST_CASE(FooTest, MyTypes);\n\n// If the type list contains only one type, you can write that type\n// directly without Types<...>:\n//   TYPED_TEST_CASE(FooTest, int);\n\n// Then, use TYPED_TEST() instead of TEST_F() to define as many typed\n// tests for this test case as you want.\nTYPED_TEST(FooTest, DoesBlah) {\n  // Inside a test, refer to TypeParam to get the type parameter.\n  // Since we are inside a derived class template, C++ requires use to\n  // visit the members of FooTest via 'this'.\n  TypeParam n = this->value_;\n\n  // To visit static members of the fixture, add the TestFixture::\n  // prefix.\n  n += TestFixture::shared_;\n\n  // To refer to typedefs in the fixture, add the \"typename\n  // TestFixture::\" prefix.\n  typename TestFixture::List values;\n  values.push_back(n);\n  ...\n}\n\nTYPED_TEST(FooTest, HasPropertyA) { ... }\n\n#endif  // 0\n\n// Type-parameterized tests are abstract test patterns parameterized\n// by a type.  Compared with typed tests, type-parameterized tests\n// allow you to define the test pattern without knowing what the type\n// parameters are.  The defined pattern can be instantiated with\n// different types any number of times, in any number of translation\n// units.\n//\n// If you are designing an interface or concept, you can define a\n// suite of type-parameterized tests to verify properties that any\n// valid implementation of the interface/concept should have.  Then,\n// each implementation can easily instantiate the test suite to verify\n// that it conforms to the requirements, without having to write\n// similar tests repeatedly.  Here's an example:\n\n#if 0\n\n// First, define a fixture class template.  It should be parameterized\n// by a type.  Remember to derive it from testing::Test.\ntemplate <typename T>\nclass FooTest : public testing::Test {\n  ...\n};\n\n// Next, declare that you will define a type-parameterized test case\n// (the _P suffix is for \"parameterized\" or \"pattern\", whichever you\n// prefer):\nTYPED_TEST_CASE_P(FooTest);\n\n// Then, use TYPED_TEST_P() to define as many type-parameterized tests\n// for this type-parameterized test case as you want.\nTYPED_TEST_P(FooTest, DoesBlah) {\n  // Inside a test, refer to TypeParam to get the type parameter.\n  TypeParam n = 0;\n  ...\n}\n\nTYPED_TEST_P(FooTest, HasPropertyA) { ... }\n\n// Now the tricky part: you need to register all test patterns before\n// you can instantiate them.  The first argument of the macro is the\n// test case name; the rest are the names of the tests in this test\n// case.\nREGISTER_TYPED_TEST_CASE_P(FooTest,\n                           DoesBlah, HasPropertyA);\n\n// Finally, you are free to instantiate the pattern with the types you\n// want.  If you put the above code in a header file, you can #include\n// it in multiple C++ source files and instantiate it multiple times.\n//\n// To distinguish different instances of the pattern, the first\n// argument to the INSTANTIATE_* macro is a prefix that will be added\n// to the actual test case name.  Remember to pick unique prefixes for\n// different instances.\ntypedef testing::Types<char, int, unsigned int> MyTypes;\nINSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);\n\n// If the type list contains only one type, you can write that type\n// directly without Types<...>:\n//   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);\n\n#endif  // 0\n\n\n// Implements typed tests.\n\n#if GTEST_HAS_TYPED_TEST\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Expands to the name of the typedef for the type parameters of the\n// given test case.\n# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_\n\n// The 'Types' template argument below must have spaces around it\n// since some compilers may choke on '>>' when passing a template\n// instance (e.g. Types<int>)\n# define TYPED_TEST_CASE(CaseName, Types) \\\n  typedef ::testing::internal::TypeList< Types >::type \\\n      GTEST_TYPE_PARAMS_(CaseName)\n\n# define TYPED_TEST(CaseName, TestName) \\\n  template <typename gtest_TypeParam_> \\\n  class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \\\n      : public CaseName<gtest_TypeParam_> { \\\n   private: \\\n    typedef CaseName<gtest_TypeParam_> TestFixture; \\\n    typedef gtest_TypeParam_ TypeParam; \\\n    virtual void TestBody(); \\\n  }; \\\n  bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \\\n      ::testing::internal::TypeParameterizedTest< \\\n          CaseName, \\\n          ::testing::internal::TemplateSel< \\\n              GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \\\n          GTEST_TYPE_PARAMS_(CaseName)>::Register(\\\n              \"\", #CaseName, #TestName, 0); \\\n  template <typename gtest_TypeParam_> \\\n  void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()\n\n#endif  // GTEST_HAS_TYPED_TEST\n\n// Implements type-parameterized tests.\n\n#if GTEST_HAS_TYPED_TEST_P\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Expands to the namespace name that the type-parameterized tests for\n// the given type-parameterized test case are defined in.  The exact\n// name of the namespace is subject to change without notice.\n# define GTEST_CASE_NAMESPACE_(TestCaseName) \\\n  gtest_case_##TestCaseName##_\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Expands to the name of the variable used to remember the names of\n// the defined tests in the given test case.\n# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \\\n  gtest_typed_test_case_p_state_##TestCaseName##_\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.\n//\n// Expands to the name of the variable used to remember the names of\n// the registered tests in the given test case.\n# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \\\n  gtest_registered_test_names_##TestCaseName##_\n\n// The variables defined in the type-parameterized test macros are\n// static as typically these macros are used in a .h file that can be\n// #included in multiple translation units linked together.\n# define TYPED_TEST_CASE_P(CaseName) \\\n  static ::testing::internal::TypedTestCasePState \\\n      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)\n\n# define TYPED_TEST_P(CaseName, TestName) \\\n  namespace GTEST_CASE_NAMESPACE_(CaseName) { \\\n  template <typename gtest_TypeParam_> \\\n  class TestName : public CaseName<gtest_TypeParam_> { \\\n   private: \\\n    typedef CaseName<gtest_TypeParam_> TestFixture; \\\n    typedef gtest_TypeParam_ TypeParam; \\\n    virtual void TestBody(); \\\n  }; \\\n  static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \\\n      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\\\n          __FILE__, __LINE__, #CaseName, #TestName); \\\n  } \\\n  template <typename gtest_TypeParam_> \\\n  void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()\n\n# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \\\n  namespace GTEST_CASE_NAMESPACE_(CaseName) { \\\n  typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \\\n  } \\\n  static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \\\n      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\\\n          __FILE__, __LINE__, #__VA_ARGS__)\n\n// The 'Types' template argument below must have spaces around it\n// since some compilers may choke on '>>' when passing a template\n// instance (e.g. Types<int>)\n# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \\\n  bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \\\n      ::testing::internal::TypeParameterizedTestCase<CaseName, \\\n          GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \\\n          ::testing::internal::TypeList< Types >::type>::Register(\\\n              #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_\n\n// Depending on the platform, different string classes are available.\n// On Linux, in addition to ::std::string, Google also makes use of\n// class ::string, which has the same interface as ::std::string, but\n// has a different implementation.\n//\n// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that\n// ::string is available AND is a distinct type to ::std::string, or\n// define it to 0 to indicate otherwise.\n//\n// If the user's ::std::string and ::string are the same class due to\n// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.\n//\n// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined\n// heuristically.\n\nnamespace testing {\n\n// Declares the flags.\n\n// This flag temporary enables the disabled tests.\nGTEST_DECLARE_bool_(also_run_disabled_tests);\n\n// This flag brings the debugger on an assertion failure.\nGTEST_DECLARE_bool_(break_on_failure);\n\n// This flag controls whether Google Test catches all test-thrown exceptions\n// and logs them as failures.\nGTEST_DECLARE_bool_(catch_exceptions);\n\n// This flag enables using colors in terminal output. Available values are\n// \"yes\" to enable colors, \"no\" (disable colors), or \"auto\" (the default)\n// to let Google Test decide.\nGTEST_DECLARE_string_(color);\n\n// This flag sets up the filter to select by name using a glob pattern\n// the tests to run. If the filter is not given all tests are executed.\nGTEST_DECLARE_string_(filter);\n\n// This flag causes the Google Test to list tests. None of the tests listed\n// are actually run if the flag is provided.\nGTEST_DECLARE_bool_(list_tests);\n\n// This flag controls whether Google Test emits a detailed XML report to a file\n// in addition to its normal textual output.\nGTEST_DECLARE_string_(output);\n\n// This flags control whether Google Test prints the elapsed time for each\n// test.\nGTEST_DECLARE_bool_(print_time);\n\n// This flag specifies the random number seed.\nGTEST_DECLARE_int32_(random_seed);\n\n// This flag sets how many times the tests are repeated. The default value\n// is 1. If the value is -1 the tests are repeating forever.\nGTEST_DECLARE_int32_(repeat);\n\n// This flag controls whether Google Test includes Google Test internal\n// stack frames in failure stack traces.\nGTEST_DECLARE_bool_(show_internal_stack_frames);\n\n// When this flag is specified, tests' order is randomized on every iteration.\nGTEST_DECLARE_bool_(shuffle);\n\n// This flag specifies the maximum number of stack frames to be\n// printed in a failure message.\nGTEST_DECLARE_int32_(stack_trace_depth);\n\n// When this flag is specified, a failed assertion will throw an\n// exception if exceptions are enabled, or exit the program with a\n// non-zero code otherwise.\nGTEST_DECLARE_bool_(throw_on_failure);\n\n// When this flag is set with a \"host:port\" string, on supported\n// platforms test results are streamed to the specified port on\n// the specified host machine.\nGTEST_DECLARE_string_(stream_result_to);\n\n// The upper limit for valid stack trace depths.\nconst int kMaxStackTraceDepth = 100;\n\nnamespace internal {\n\nclass AssertHelper;\nclass DefaultGlobalTestPartResultReporter;\nclass ExecDeathTest;\nclass NoExecDeathTest;\nclass FinalSuccessChecker;\nclass GTestFlagSaver;\nclass StreamingListenerTest;\nclass TestResultAccessor;\nclass TestEventListenersAccessor;\nclass TestEventRepeater;\nclass UnitTestRecordPropertyTestHelper;\nclass WindowsDeathTest;\nclass UnitTestImpl* GetUnitTestImpl();\nvoid ReportFailureInUnknownLocation(TestPartResult::Type result_type,\n                                    const std::string& message);\n\n}  // namespace internal\n\n// The friend relationship of some of these classes is cyclic.\n// If we don't forward declare them the compiler might confuse the classes\n// in friendship clauses with same named classes on the scope.\nclass Test;\nclass TestCase;\nclass TestInfo;\nclass UnitTest;\n\n// A class for indicating whether an assertion was successful.  When\n// the assertion wasn't successful, the AssertionResult object\n// remembers a non-empty message that describes how it failed.\n//\n// To create an instance of this class, use one of the factory functions\n// (AssertionSuccess() and AssertionFailure()).\n//\n// This class is useful for two purposes:\n//   1. Defining predicate functions to be used with Boolean test assertions\n//      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts\n//   2. Defining predicate-format functions to be\n//      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).\n//\n// For example, if you define IsEven predicate:\n//\n//   testing::AssertionResult IsEven(int n) {\n//     if ((n % 2) == 0)\n//       return testing::AssertionSuccess();\n//     else\n//       return testing::AssertionFailure() << n << \" is odd\";\n//   }\n//\n// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))\n// will print the message\n//\n//   Value of: IsEven(Fib(5))\n//     Actual: false (5 is odd)\n//   Expected: true\n//\n// instead of a more opaque\n//\n//   Value of: IsEven(Fib(5))\n//     Actual: false\n//   Expected: true\n//\n// in case IsEven is a simple Boolean predicate.\n//\n// If you expect your predicate to be reused and want to support informative\n// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up\n// about half as often as positive ones in our tests), supply messages for\n// both success and failure cases:\n//\n//   testing::AssertionResult IsEven(int n) {\n//     if ((n % 2) == 0)\n//       return testing::AssertionSuccess() << n << \" is even\";\n//     else\n//       return testing::AssertionFailure() << n << \" is odd\";\n//   }\n//\n// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print\n//\n//   Value of: IsEven(Fib(6))\n//     Actual: true (8 is even)\n//   Expected: false\n//\n// NB: Predicates that support negative Boolean assertions have reduced\n// performance in positive ones so be careful not to use them in tests\n// that have lots (tens of thousands) of positive Boolean assertions.\n//\n// To use this class with EXPECT_PRED_FORMAT assertions such as:\n//\n//   // Verifies that Foo() returns an even number.\n//   EXPECT_PRED_FORMAT1(IsEven, Foo());\n//\n// you need to define:\n//\n//   testing::AssertionResult IsEven(const char* expr, int n) {\n//     if ((n % 2) == 0)\n//       return testing::AssertionSuccess();\n//     else\n//       return testing::AssertionFailure()\n//         << \"Expected: \" << expr << \" is even\\n  Actual: it's \" << n;\n//   }\n//\n// If Foo() returns 5, you will see the following message:\n//\n//   Expected: Foo() is even\n//     Actual: it's 5\n//\nclass GTEST_API_ AssertionResult {\n public:\n  // Copy constructor.\n  // Used in EXPECT_TRUE/FALSE(assertion_result).\n  AssertionResult(const AssertionResult& other);\n  // Used in the EXPECT_TRUE/FALSE(bool_expression).\n  explicit AssertionResult(bool success) : success_(success) {}\n\n  // Returns true iff the assertion succeeded.\n  operator bool() const { return success_; }  // NOLINT\n\n  // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.\n  AssertionResult operator!() const;\n\n  // Returns the text streamed into this AssertionResult. Test assertions\n  // use it when they fail (i.e., the predicate's outcome doesn't match the\n  // assertion's expectation). When nothing has been streamed into the\n  // object, returns an empty string.\n  const char* message() const {\n    return message_.get() != NULL ?  message_->c_str() : \"\";\n  }\n  // TODO(vladl@google.com): Remove this after making sure no clients use it.\n  // Deprecated; please use message() instead.\n  const char* failure_message() const { return message(); }\n\n  // Streams a custom failure message into this object.\n  template <typename T> AssertionResult& operator<<(const T& value) {\n    AppendMessage(Message() << value);\n    return *this;\n  }\n\n  // Allows streaming basic output manipulators such as endl or flush into\n  // this object.\n  AssertionResult& operator<<(\n      ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {\n    AppendMessage(Message() << basic_manipulator);\n    return *this;\n  }\n\n private:\n  // Appends the contents of message to message_.\n  void AppendMessage(const Message& a_message) {\n    if (message_.get() == NULL)\n      message_.reset(new ::std::string);\n    message_->append(a_message.GetString().c_str());\n  }\n\n  // Stores result of the assertion predicate.\n  bool success_;\n  // Stores the message describing the condition in case the expectation\n  // construct is not satisfied with the predicate's outcome.\n  // Referenced via a pointer to avoid taking too much stack frame space\n  // with test assertions.\n  internal::scoped_ptr< ::std::string> message_;\n\n  GTEST_DISALLOW_ASSIGN_(AssertionResult);\n};\n\n// Makes a successful assertion result.\nGTEST_API_ AssertionResult AssertionSuccess();\n\n// Makes a failed assertion result.\nGTEST_API_ AssertionResult AssertionFailure();\n\n// Makes a failed assertion result with the given failure message.\n// Deprecated; use AssertionFailure() << msg.\nGTEST_API_ AssertionResult AssertionFailure(const Message& msg);\n\n// The abstract class that all tests inherit from.\n//\n// In Google Test, a unit test program contains one or many TestCases, and\n// each TestCase contains one or many Tests.\n//\n// When you define a test using the TEST macro, you don't need to\n// explicitly derive from Test - the TEST macro automatically does\n// this for you.\n//\n// The only time you derive from Test is when defining a test fixture\n// to be used a TEST_F.  For example:\n//\n//   class FooTest : public testing::Test {\n//    protected:\n//     virtual void SetUp() { ... }\n//     virtual void TearDown() { ... }\n//     ...\n//   };\n//\n//   TEST_F(FooTest, Bar) { ... }\n//   TEST_F(FooTest, Baz) { ... }\n//\n// Test is not copyable.\nclass GTEST_API_ Test {\n public:\n  friend class TestInfo;\n\n  // Defines types for pointers to functions that set up and tear down\n  // a test case.\n  typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;\n  typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;\n\n  // The d'tor is virtual as we intend to inherit from Test.\n  virtual ~Test();\n\n  // Sets up the stuff shared by all tests in this test case.\n  //\n  // Google Test will call Foo::SetUpTestCase() before running the first\n  // test in test case Foo.  Hence a sub-class can define its own\n  // SetUpTestCase() method to shadow the one defined in the super\n  // class.\n  static void SetUpTestCase() {}\n\n  // Tears down the stuff shared by all tests in this test case.\n  //\n  // Google Test will call Foo::TearDownTestCase() after running the last\n  // test in test case Foo.  Hence a sub-class can define its own\n  // TearDownTestCase() method to shadow the one defined in the super\n  // class.\n  static void TearDownTestCase() {}\n\n  // Returns true iff the current test has a fatal failure.\n  static bool HasFatalFailure();\n\n  // Returns true iff the current test has a non-fatal failure.\n  static bool HasNonfatalFailure();\n\n  // Returns true iff the current test has a (either fatal or\n  // non-fatal) failure.\n  static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }\n\n  // Logs a property for the current test, test case, or for the entire\n  // invocation of the test program when used outside of the context of a\n  // test case.  Only the last value for a given key is remembered.  These\n  // are public static so they can be called from utility functions that are\n  // not members of the test fixture.  Calls to RecordProperty made during\n  // lifespan of the test (from the moment its constructor starts to the\n  // moment its destructor finishes) will be output in XML as attributes of\n  // the <testcase> element.  Properties recorded from fixture's\n  // SetUpTestCase or TearDownTestCase are logged as attributes of the\n  // corresponding <testsuite> element.  Calls to RecordProperty made in the\n  // global context (before or after invocation of RUN_ALL_TESTS and from\n  // SetUp/TearDown method of Environment objects registered with Google\n  // Test) will be output as attributes of the <testsuites> element.\n  static void RecordProperty(const std::string& key, const std::string& value);\n  static void RecordProperty(const std::string& key, int value);\n\n protected:\n  // Creates a Test object.\n  Test();\n\n  // Sets up the test fixture.\n  virtual void SetUp();\n\n  // Tears down the test fixture.\n  virtual void TearDown();\n\n private:\n  // Returns true iff the current test has the same fixture class as\n  // the first test in the current test case.\n  static bool HasSameFixtureClass();\n\n  // Runs the test after the test fixture has been set up.\n  //\n  // A sub-class must implement this to define the test logic.\n  //\n  // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.\n  // Instead, use the TEST or TEST_F macro.\n  virtual void TestBody() = 0;\n\n  // Sets up, executes, and tears down the test.\n  void Run();\n\n  // Deletes self.  We deliberately pick an unusual name for this\n  // internal method to avoid clashing with names used in user TESTs.\n  void DeleteSelf_() { delete this; }\n\n  // Uses a GTestFlagSaver to save and restore all Google Test flags.\n  const internal::GTestFlagSaver* const gtest_flag_saver_;\n\n  // Often a user mis-spells SetUp() as Setup() and spends a long time\n  // wondering why it is never called by Google Test.  The declaration of\n  // the following method is solely for catching such an error at\n  // compile time:\n  //\n  //   - The return type is deliberately chosen to be not void, so it\n  //   will be a conflict if a user declares void Setup() in his test\n  //   fixture.\n  //\n  //   - This method is private, so it will be another compiler error\n  //   if a user calls it from his test fixture.\n  //\n  // DO NOT OVERRIDE THIS FUNCTION.\n  //\n  // If you see an error about overriding the following function or\n  // about it being private, you have mis-spelled SetUp() as Setup().\n  struct Setup_should_be_spelled_SetUp {};\n  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }\n\n  // We disallow copying Tests.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);\n};\n\ntypedef internal::TimeInMillis TimeInMillis;\n\n// A copyable object representing a user specified test property which can be\n// output as a key/value string pair.\n//\n// Don't inherit from TestProperty as its destructor is not virtual.\nclass TestProperty {\n public:\n  // C'tor.  TestProperty does NOT have a default constructor.\n  // Always use this constructor (with parameters) to create a\n  // TestProperty object.\n  TestProperty(const std::string& a_key, const std::string& a_value) :\n    key_(a_key), value_(a_value) {\n  }\n\n  // Gets the user supplied key.\n  const char* key() const {\n    return key_.c_str();\n  }\n\n  // Gets the user supplied value.\n  const char* value() const {\n    return value_.c_str();\n  }\n\n  // Sets a new value, overriding the one supplied in the constructor.\n  void SetValue(const std::string& new_value) {\n    value_ = new_value;\n  }\n\n private:\n  // The key supplied by the user.\n  std::string key_;\n  // The value supplied by the user.\n  std::string value_;\n};\n\n// The result of a single Test.  This includes a list of\n// TestPartResults, a list of TestProperties, a count of how many\n// death tests there are in the Test, and how much time it took to run\n// the Test.\n//\n// TestResult is not copyable.\nclass GTEST_API_ TestResult {\n public:\n  // Creates an empty TestResult.\n  TestResult();\n\n  // D'tor.  Do not inherit from TestResult.\n  ~TestResult();\n\n  // Gets the number of all test parts.  This is the sum of the number\n  // of successful test parts and the number of failed test parts.\n  int total_part_count() const;\n\n  // Returns the number of the test properties.\n  int test_property_count() const;\n\n  // Returns true iff the test passed (i.e. no test part failed).\n  bool Passed() const { return !Failed(); }\n\n  // Returns true iff the test failed.\n  bool Failed() const;\n\n  // Returns true iff the test fatally failed.\n  bool HasFatalFailure() const;\n\n  // Returns true iff the test has a non-fatal failure.\n  bool HasNonfatalFailure() const;\n\n  // Returns the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const { return elapsed_time_; }\n\n  // Returns the i-th test part result among all the results. i can range\n  // from 0 to test_property_count() - 1. If i is not in that range, aborts\n  // the program.\n  const TestPartResult& GetTestPartResult(int i) const;\n\n  // Returns the i-th test property. i can range from 0 to\n  // test_property_count() - 1. If i is not in that range, aborts the\n  // program.\n  const TestProperty& GetTestProperty(int i) const;\n\n private:\n  friend class TestInfo;\n  friend class TestCase;\n  friend class UnitTest;\n  friend class internal::DefaultGlobalTestPartResultReporter;\n  friend class internal::ExecDeathTest;\n  friend class internal::TestResultAccessor;\n  friend class internal::UnitTestImpl;\n  friend class internal::WindowsDeathTest;\n\n  // Gets the vector of TestPartResults.\n  const std::vector<TestPartResult>& test_part_results() const {\n    return test_part_results_;\n  }\n\n  // Gets the vector of TestProperties.\n  const std::vector<TestProperty>& test_properties() const {\n    return test_properties_;\n  }\n\n  // Sets the elapsed time.\n  void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }\n\n  // Adds a test property to the list. The property is validated and may add\n  // a non-fatal failure if invalid (e.g., if it conflicts with reserved\n  // key names). If a property is already recorded for the same key, the\n  // value will be updated, rather than storing multiple values for the same\n  // key.  xml_element specifies the element for which the property is being\n  // recorded and is used for validation.\n  void RecordProperty(const std::string& xml_element,\n                      const TestProperty& test_property);\n\n  // Adds a failure if the key is a reserved attribute of Google Test\n  // testcase tags.  Returns true if the property is valid.\n  // TODO(russr): Validate attribute names are legal and human readable.\n  static bool ValidateTestProperty(const std::string& xml_element,\n                                   const TestProperty& test_property);\n\n  // Adds a test part result to the list.\n  void AddTestPartResult(const TestPartResult& test_part_result);\n\n  // Returns the death test count.\n  int death_test_count() const { return death_test_count_; }\n\n  // Increments the death test count, returning the new count.\n  int increment_death_test_count() { return ++death_test_count_; }\n\n  // Clears the test part results.\n  void ClearTestPartResults();\n\n  // Clears the object.\n  void Clear();\n\n  // Protects mutable state of the property vector and of owned\n  // properties, whose values may be updated.\n  internal::Mutex test_properites_mutex_;\n\n  // The vector of TestPartResults\n  std::vector<TestPartResult> test_part_results_;\n  // The vector of TestProperties\n  std::vector<TestProperty> test_properties_;\n  // Running count of death tests.\n  int death_test_count_;\n  // The elapsed time, in milliseconds.\n  TimeInMillis elapsed_time_;\n\n  // We disallow copying TestResult.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);\n};  // class TestResult\n\n// A TestInfo object stores the following information about a test:\n//\n//   Test case name\n//   Test name\n//   Whether the test should be run\n//   A function pointer that creates the test object when invoked\n//   Test result\n//\n// The constructor of TestInfo registers itself with the UnitTest\n// singleton such that the RUN_ALL_TESTS() macro knows which tests to\n// run.\nclass GTEST_API_ TestInfo {\n public:\n  // Destructs a TestInfo object.  This function is not virtual, so\n  // don't inherit from TestInfo.\n  ~TestInfo();\n\n  // Returns the test case name.\n  const char* test_case_name() const { return test_case_name_.c_str(); }\n\n  // Returns the test name.\n  const char* name() const { return name_.c_str(); }\n\n  // Returns the name of the parameter type, or NULL if this is not a typed\n  // or a type-parameterized test.\n  const char* type_param() const {\n    if (type_param_.get() != NULL)\n      return type_param_->c_str();\n    return NULL;\n  }\n\n  // Returns the text representation of the value parameter, or NULL if this\n  // is not a value-parameterized test.\n  const char* value_param() const {\n    if (value_param_.get() != NULL)\n      return value_param_->c_str();\n    return NULL;\n  }\n\n  // Returns true if this test should run, that is if the test is not\n  // disabled (or it is disabled but the also_run_disabled_tests flag has\n  // been specified) and its full name matches the user-specified filter.\n  //\n  // Google Test allows the user to filter the tests by their full names.\n  // The full name of a test Bar in test case Foo is defined as\n  // \"Foo.Bar\".  Only the tests that match the filter will run.\n  //\n  // A filter is a colon-separated list of glob (not regex) patterns,\n  // optionally followed by a '-' and a colon-separated list of\n  // negative patterns (tests to exclude).  A test is run if it\n  // matches one of the positive patterns and does not match any of\n  // the negative patterns.\n  //\n  // For example, *A*:Foo.* is a filter that matches any string that\n  // contains the character 'A' or starts with \"Foo.\".\n  bool should_run() const { return should_run_; }\n\n  // Returns true iff this test will appear in the XML report.\n  bool is_reportable() const {\n    // For now, the XML report includes all tests matching the filter.\n    // In the future, we may trim tests that are excluded because of\n    // sharding.\n    return matches_filter_;\n  }\n\n  // Returns the result of the test.\n  const TestResult* result() const { return &result_; }\n\n private:\n#if GTEST_HAS_DEATH_TEST\n  friend class internal::DefaultDeathTestFactory;\n#endif  // GTEST_HAS_DEATH_TEST\n  friend class Test;\n  friend class TestCase;\n  friend class internal::UnitTestImpl;\n  friend class internal::StreamingListenerTest;\n  friend TestInfo* internal::MakeAndRegisterTestInfo(\n      const char* test_case_name,\n      const char* name,\n      const char* type_param,\n      const char* value_param,\n      internal::TypeId fixture_class_id,\n      Test::SetUpTestCaseFunc set_up_tc,\n      Test::TearDownTestCaseFunc tear_down_tc,\n      internal::TestFactoryBase* factory);\n\n  // Constructs a TestInfo object. The newly constructed instance assumes\n  // ownership of the factory object.\n  TestInfo(const std::string& test_case_name,\n           const std::string& name,\n           const char* a_type_param,   // NULL if not a type-parameterized test\n           const char* a_value_param,  // NULL if not a value-parameterized test\n           internal::TypeId fixture_class_id,\n           internal::TestFactoryBase* factory);\n\n  // Increments the number of death tests encountered in this test so\n  // far.\n  int increment_death_test_count() {\n    return result_.increment_death_test_count();\n  }\n\n  // Creates the test object, runs it, records its result, and then\n  // deletes it.\n  void Run();\n\n  static void ClearTestResult(TestInfo* test_info) {\n    test_info->result_.Clear();\n  }\n\n  // These fields are immutable properties of the test.\n  const std::string test_case_name_;     // Test case name\n  const std::string name_;               // Test name\n  // Name of the parameter type, or NULL if this is not a typed or a\n  // type-parameterized test.\n  const internal::scoped_ptr<const ::std::string> type_param_;\n  // Text representation of the value parameter, or NULL if this is not a\n  // value-parameterized test.\n  const internal::scoped_ptr<const ::std::string> value_param_;\n  const internal::TypeId fixture_class_id_;   // ID of the test fixture class\n  bool should_run_;                 // True iff this test should run\n  bool is_disabled_;                // True iff this test is disabled\n  bool matches_filter_;             // True if this test matches the\n                                    // user-specified filter.\n  internal::TestFactoryBase* const factory_;  // The factory that creates\n                                              // the test object\n\n  // This field is mutable and needs to be reset before running the\n  // test for the second time.\n  TestResult result_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);\n};\n\n// A test case, which consists of a vector of TestInfos.\n//\n// TestCase is not copyable.\nclass GTEST_API_ TestCase {\n public:\n  // Creates a TestCase with the given name.\n  //\n  // TestCase does NOT have a default constructor.  Always use this\n  // constructor to create a TestCase object.\n  //\n  // Arguments:\n  //\n  //   name:         name of the test case\n  //   a_type_param: the name of the test's type parameter, or NULL if\n  //                 this is not a type-parameterized test.\n  //   set_up_tc:    pointer to the function that sets up the test case\n  //   tear_down_tc: pointer to the function that tears down the test case\n  TestCase(const char* name, const char* a_type_param,\n           Test::SetUpTestCaseFunc set_up_tc,\n           Test::TearDownTestCaseFunc tear_down_tc);\n\n  // Destructor of TestCase.\n  virtual ~TestCase();\n\n  // Gets the name of the TestCase.\n  const char* name() const { return name_.c_str(); }\n\n  // Returns the name of the parameter type, or NULL if this is not a\n  // type-parameterized test case.\n  const char* type_param() const {\n    if (type_param_.get() != NULL)\n      return type_param_->c_str();\n    return NULL;\n  }\n\n  // Returns true if any test in this test case should run.\n  bool should_run() const { return should_run_; }\n\n  // Gets the number of successful tests in this test case.\n  int successful_test_count() const;\n\n  // Gets the number of failed tests in this test case.\n  int failed_test_count() const;\n\n  // Gets the number of disabled tests that will be reported in the XML report.\n  int reportable_disabled_test_count() const;\n\n  // Gets the number of disabled tests in this test case.\n  int disabled_test_count() const;\n\n  // Gets the number of tests to be printed in the XML report.\n  int reportable_test_count() const;\n\n  // Get the number of tests in this test case that should run.\n  int test_to_run_count() const;\n\n  // Gets the number of all tests in this test case.\n  int total_test_count() const;\n\n  // Returns true iff the test case passed.\n  bool Passed() const { return !Failed(); }\n\n  // Returns true iff the test case failed.\n  bool Failed() const { return failed_test_count() > 0; }\n\n  // Returns the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const { return elapsed_time_; }\n\n  // Returns the i-th test among all the tests. i can range from 0 to\n  // total_test_count() - 1. If i is not in that range, returns NULL.\n  const TestInfo* GetTestInfo(int i) const;\n\n  // Returns the TestResult that holds test properties recorded during\n  // execution of SetUpTestCase and TearDownTestCase.\n  const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }\n\n private:\n  friend class Test;\n  friend class internal::UnitTestImpl;\n\n  // Gets the (mutable) vector of TestInfos in this TestCase.\n  std::vector<TestInfo*>& test_info_list() { return test_info_list_; }\n\n  // Gets the (immutable) vector of TestInfos in this TestCase.\n  const std::vector<TestInfo*>& test_info_list() const {\n    return test_info_list_;\n  }\n\n  // Returns the i-th test among all the tests. i can range from 0 to\n  // total_test_count() - 1. If i is not in that range, returns NULL.\n  TestInfo* GetMutableTestInfo(int i);\n\n  // Sets the should_run member.\n  void set_should_run(bool should) { should_run_ = should; }\n\n  // Adds a TestInfo to this test case.  Will delete the TestInfo upon\n  // destruction of the TestCase object.\n  void AddTestInfo(TestInfo * test_info);\n\n  // Clears the results of all tests in this test case.\n  void ClearResult();\n\n  // Clears the results of all tests in the given test case.\n  static void ClearTestCaseResult(TestCase* test_case) {\n    test_case->ClearResult();\n  }\n\n  // Runs every test in this TestCase.\n  void Run();\n\n  // Runs SetUpTestCase() for this TestCase.  This wrapper is needed\n  // for catching exceptions thrown from SetUpTestCase().\n  void RunSetUpTestCase() { (*set_up_tc_)(); }\n\n  // Runs TearDownTestCase() for this TestCase.  This wrapper is\n  // needed for catching exceptions thrown from TearDownTestCase().\n  void RunTearDownTestCase() { (*tear_down_tc_)(); }\n\n  // Returns true iff test passed.\n  static bool TestPassed(const TestInfo* test_info) {\n    return test_info->should_run() && test_info->result()->Passed();\n  }\n\n  // Returns true iff test failed.\n  static bool TestFailed(const TestInfo* test_info) {\n    return test_info->should_run() && test_info->result()->Failed();\n  }\n\n  // Returns true iff the test is disabled and will be reported in the XML\n  // report.\n  static bool TestReportableDisabled(const TestInfo* test_info) {\n    return test_info->is_reportable() && test_info->is_disabled_;\n  }\n\n  // Returns true iff test is disabled.\n  static bool TestDisabled(const TestInfo* test_info) {\n    return test_info->is_disabled_;\n  }\n\n  // Returns true iff this test will appear in the XML report.\n  static bool TestReportable(const TestInfo* test_info) {\n    return test_info->is_reportable();\n  }\n\n  // Returns true if the given test should run.\n  static bool ShouldRunTest(const TestInfo* test_info) {\n    return test_info->should_run();\n  }\n\n  // Shuffles the tests in this test case.\n  void ShuffleTests(internal::Random* random);\n\n  // Restores the test order to before the first shuffle.\n  void UnshuffleTests();\n\n  // Name of the test case.\n  std::string name_;\n  // Name of the parameter type, or NULL if this is not a typed or a\n  // type-parameterized test.\n  const internal::scoped_ptr<const ::std::string> type_param_;\n  // The vector of TestInfos in their original order.  It owns the\n  // elements in the vector.\n  std::vector<TestInfo*> test_info_list_;\n  // Provides a level of indirection for the test list to allow easy\n  // shuffling and restoring the test order.  The i-th element in this\n  // vector is the index of the i-th test in the shuffled test list.\n  std::vector<int> test_indices_;\n  // Pointer to the function that sets up the test case.\n  Test::SetUpTestCaseFunc set_up_tc_;\n  // Pointer to the function that tears down the test case.\n  Test::TearDownTestCaseFunc tear_down_tc_;\n  // True iff any test in this test case should run.\n  bool should_run_;\n  // Elapsed time, in milliseconds.\n  TimeInMillis elapsed_time_;\n  // Holds test properties recorded during execution of SetUpTestCase and\n  // TearDownTestCase.\n  TestResult ad_hoc_test_result_;\n\n  // We disallow copying TestCases.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);\n};\n\n// An Environment object is capable of setting up and tearing down an\n// environment.  The user should subclass this to define his own\n// environment(s).\n//\n// An Environment object does the set-up and tear-down in virtual\n// methods SetUp() and TearDown() instead of the constructor and the\n// destructor, as:\n//\n//   1. You cannot safely throw from a destructor.  This is a problem\n//      as in some cases Google Test is used where exceptions are enabled, and\n//      we may want to implement ASSERT_* using exceptions where they are\n//      available.\n//   2. You cannot use ASSERT_* directly in a constructor or\n//      destructor.\nclass Environment {\n public:\n  // The d'tor is virtual as we need to subclass Environment.\n  virtual ~Environment() {}\n\n  // Override this to define how to set up the environment.\n  virtual void SetUp() {}\n\n  // Override this to define how to tear down the environment.\n  virtual void TearDown() {}\n private:\n  // If you see an error about overriding the following function or\n  // about it being private, you have mis-spelled SetUp() as Setup().\n  struct Setup_should_be_spelled_SetUp {};\n  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }\n};\n\n// The interface for tracing execution of tests. The methods are organized in\n// the order the corresponding events are fired.\nclass TestEventListener {\n public:\n  virtual ~TestEventListener() {}\n\n  // Fired before any test activity starts.\n  virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;\n\n  // Fired before each iteration of tests starts.  There may be more than\n  // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration\n  // index, starting from 0.\n  virtual void OnTestIterationStart(const UnitTest& unit_test,\n                                    int iteration) = 0;\n\n  // Fired before environment set-up for each iteration of tests starts.\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;\n\n  // Fired after environment set-up for each iteration of tests ends.\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;\n\n  // Fired before the test case starts.\n  virtual void OnTestCaseStart(const TestCase& test_case) = 0;\n\n  // Fired before the test starts.\n  virtual void OnTestStart(const TestInfo& test_info) = 0;\n\n  // Fired after a failed assertion or a SUCCEED() invocation.\n  virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;\n\n  // Fired after the test ends.\n  virtual void OnTestEnd(const TestInfo& test_info) = 0;\n\n  // Fired after the test case ends.\n  virtual void OnTestCaseEnd(const TestCase& test_case) = 0;\n\n  // Fired before environment tear-down for each iteration of tests starts.\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;\n\n  // Fired after environment tear-down for each iteration of tests ends.\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;\n\n  // Fired after each iteration of tests finishes.\n  virtual void OnTestIterationEnd(const UnitTest& unit_test,\n                                  int iteration) = 0;\n\n  // Fired after all test activities have ended.\n  virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;\n};\n\n// The convenience class for users who need to override just one or two\n// methods and are not concerned that a possible change to a signature of\n// the methods they override will not be caught during the build.  For\n// comments about each method please see the definition of TestEventListener\n// above.\nclass EmptyTestEventListener : public TestEventListener {\n public:\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,\n                                    int /*iteration*/) {}\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}\n  virtual void OnTestStart(const TestInfo& /*test_info*/) {}\n  virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}\n  virtual void OnTestEnd(const TestInfo& /*test_info*/) {}\n  virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,\n                                  int /*iteration*/) {}\n  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}\n};\n\n// TestEventListeners lets users add listeners to track events in Google Test.\nclass GTEST_API_ TestEventListeners {\n public:\n  TestEventListeners();\n  ~TestEventListeners();\n\n  // Appends an event listener to the end of the list. Google Test assumes\n  // the ownership of the listener (i.e. it will delete the listener when\n  // the test program finishes).\n  void Append(TestEventListener* listener);\n\n  // Removes the given event listener from the list and returns it.  It then\n  // becomes the caller's responsibility to delete the listener. Returns\n  // NULL if the listener is not found in the list.\n  TestEventListener* Release(TestEventListener* listener);\n\n  // Returns the standard listener responsible for the default console\n  // output.  Can be removed from the listeners list to shut down default\n  // console output.  Note that removing this object from the listener list\n  // with Release transfers its ownership to the caller and makes this\n  // function return NULL the next time.\n  TestEventListener* default_result_printer() const {\n    return default_result_printer_;\n  }\n\n  // Returns the standard listener responsible for the default XML output\n  // controlled by the --gtest_output=xml flag.  Can be removed from the\n  // listeners list by users who want to shut down the default XML output\n  // controlled by this flag and substitute it with custom one.  Note that\n  // removing this object from the listener list with Release transfers its\n  // ownership to the caller and makes this function return NULL the next\n  // time.\n  TestEventListener* default_xml_generator() const {\n    return default_xml_generator_;\n  }\n\n private:\n  friend class TestCase;\n  friend class TestInfo;\n  friend class internal::DefaultGlobalTestPartResultReporter;\n  friend class internal::NoExecDeathTest;\n  friend class internal::TestEventListenersAccessor;\n  friend class internal::UnitTestImpl;\n\n  // Returns repeater that broadcasts the TestEventListener events to all\n  // subscribers.\n  TestEventListener* repeater();\n\n  // Sets the default_result_printer attribute to the provided listener.\n  // The listener is also added to the listener list and previous\n  // default_result_printer is removed from it and deleted. The listener can\n  // also be NULL in which case it will not be added to the list. Does\n  // nothing if the previous and the current listener objects are the same.\n  void SetDefaultResultPrinter(TestEventListener* listener);\n\n  // Sets the default_xml_generator attribute to the provided listener.  The\n  // listener is also added to the listener list and previous\n  // default_xml_generator is removed from it and deleted. The listener can\n  // also be NULL in which case it will not be added to the list. Does\n  // nothing if the previous and the current listener objects are the same.\n  void SetDefaultXmlGenerator(TestEventListener* listener);\n\n  // Controls whether events will be forwarded by the repeater to the\n  // listeners in the list.\n  bool EventForwardingEnabled() const;\n  void SuppressEventForwarding();\n\n  // The actual list of listeners.\n  internal::TestEventRepeater* repeater_;\n  // Listener responsible for the standard result output.\n  TestEventListener* default_result_printer_;\n  // Listener responsible for the creation of the XML output file.\n  TestEventListener* default_xml_generator_;\n\n  // We disallow copying TestEventListeners.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);\n};\n\n// A UnitTest consists of a vector of TestCases.\n//\n// This is a singleton class.  The only instance of UnitTest is\n// created when UnitTest::GetInstance() is first called.  This\n// instance is never deleted.\n//\n// UnitTest is not copyable.\n//\n// This class is thread-safe as long as the methods are called\n// according to their specification.\nclass GTEST_API_ UnitTest {\n public:\n  // Gets the singleton UnitTest object.  The first time this method\n  // is called, a UnitTest object is constructed and returned.\n  // Consecutive calls will return the same object.\n  static UnitTest* GetInstance();\n\n  // Runs all tests in this UnitTest object and prints the result.\n  // Returns 0 if successful, or 1 otherwise.\n  //\n  // This method can only be called from the main thread.\n  //\n  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n  int Run() GTEST_MUST_USE_RESULT_;\n\n  // Returns the working directory when the first TEST() or TEST_F()\n  // was executed.  The UnitTest object owns the string.\n  const char* original_working_dir() const;\n\n  // Returns the TestCase object for the test that's currently running,\n  // or NULL if no test is running.\n  const TestCase* current_test_case() const\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Returns the TestInfo object for the test that's currently running,\n  // or NULL if no test is running.\n  const TestInfo* current_test_info() const\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Returns the random seed used at the start of the current test run.\n  int random_seed() const;\n\n#if GTEST_HAS_PARAM_TEST\n  // Returns the ParameterizedTestCaseRegistry object used to keep track of\n  // value-parameterized tests and instantiate and register them.\n  //\n  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n  internal::ParameterizedTestCaseRegistry& parameterized_test_registry()\n      GTEST_LOCK_EXCLUDED_(mutex_);\n#endif  // GTEST_HAS_PARAM_TEST\n\n  // Gets the number of successful test cases.\n  int successful_test_case_count() const;\n\n  // Gets the number of failed test cases.\n  int failed_test_case_count() const;\n\n  // Gets the number of all test cases.\n  int total_test_case_count() const;\n\n  // Gets the number of all test cases that contain at least one test\n  // that should run.\n  int test_case_to_run_count() const;\n\n  // Gets the number of successful tests.\n  int successful_test_count() const;\n\n  // Gets the number of failed tests.\n  int failed_test_count() const;\n\n  // Gets the number of disabled tests that will be reported in the XML report.\n  int reportable_disabled_test_count() const;\n\n  // Gets the number of disabled tests.\n  int disabled_test_count() const;\n\n  // Gets the number of tests to be printed in the XML report.\n  int reportable_test_count() const;\n\n  // Gets the number of all tests.\n  int total_test_count() const;\n\n  // Gets the number of tests that should run.\n  int test_to_run_count() const;\n\n  // Gets the time of the test program start, in ms from the start of the\n  // UNIX epoch.\n  TimeInMillis start_timestamp() const;\n\n  // Gets the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const;\n\n  // Returns true iff the unit test passed (i.e. all test cases passed).\n  bool Passed() const;\n\n  // Returns true iff the unit test failed (i.e. some test case failed\n  // or something outside of all tests failed).\n  bool Failed() const;\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  const TestCase* GetTestCase(int i) const;\n\n  // Returns the TestResult containing information on test failures and\n  // properties logged outside of individual test cases.\n  const TestResult& ad_hoc_test_result() const;\n\n  // Returns the list of event listeners that can be used to track events\n  // inside Google Test.\n  TestEventListeners& listeners();\n\n private:\n  // Registers and returns a global test environment.  When a test\n  // program is run, all global test environments will be set-up in\n  // the order they were registered.  After all tests in the program\n  // have finished, all global test environments will be torn-down in\n  // the *reverse* order they were registered.\n  //\n  // The UnitTest object takes ownership of the given environment.\n  //\n  // This method can only be called from the main thread.\n  Environment* AddEnvironment(Environment* env);\n\n  // Adds a TestPartResult to the current TestResult object.  All\n  // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)\n  // eventually call this to report their results.  The user code\n  // should use the assertion macros instead of calling this directly.\n  void AddTestPartResult(TestPartResult::Type result_type,\n                         const char* file_name,\n                         int line_number,\n                         const std::string& message,\n                         const std::string& os_stack_trace)\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Adds a TestProperty to the current TestResult object when invoked from\n  // inside a test, to current TestCase's ad_hoc_test_result_ when invoked\n  // from SetUpTestCase or TearDownTestCase, or to the global property set\n  // when invoked elsewhere.  If the result already contains a property with\n  // the same key, the value will be updated.\n  void RecordProperty(const std::string& key, const std::string& value);\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  TestCase* GetMutableTestCase(int i);\n\n  // Accessors for the implementation object.\n  internal::UnitTestImpl* impl() { return impl_; }\n  const internal::UnitTestImpl* impl() const { return impl_; }\n\n  // These classes and funcions are friends as they need to access private\n  // members of UnitTest.\n  friend class Test;\n  friend class internal::AssertHelper;\n  friend class internal::ScopedTrace;\n  friend class internal::StreamingListenerTest;\n  friend class internal::UnitTestRecordPropertyTestHelper;\n  friend Environment* AddGlobalTestEnvironment(Environment* env);\n  friend internal::UnitTestImpl* internal::GetUnitTestImpl();\n  friend void internal::ReportFailureInUnknownLocation(\n      TestPartResult::Type result_type,\n      const std::string& message);\n\n  // Creates an empty UnitTest.\n  UnitTest();\n\n  // D'tor\n  virtual ~UnitTest();\n\n  // Pushes a trace defined by SCOPED_TRACE() on to the per-thread\n  // Google Test trace stack.\n  void PushGTestTrace(const internal::TraceInfo& trace)\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Pops a trace from the per-thread Google Test trace stack.\n  void PopGTestTrace()\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Protects mutable state in *impl_.  This is mutable as some const\n  // methods need to lock it too.\n  mutable internal::Mutex mutex_;\n\n  // Opaque implementation object.  This field is never changed once\n  // the object is constructed.  We don't mark it as const here, as\n  // doing so will cause a warning in the constructor of UnitTest.\n  // Mutable state in *impl_ is protected by mutex_.\n  internal::UnitTestImpl* impl_;\n\n  // We disallow copying UnitTest.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);\n};\n\n// A convenient wrapper for adding an environment for the test\n// program.\n//\n// You should call this before RUN_ALL_TESTS() is called, probably in\n// main().  If you use gtest_main, you need to call this before main()\n// starts for it to take effect.  For example, you can define a global\n// variable like this:\n//\n//   testing::Environment* const foo_env =\n//       testing::AddGlobalTestEnvironment(new FooEnvironment);\n//\n// However, we strongly recommend you to write your own main() and\n// call AddGlobalTestEnvironment() there, as relying on initialization\n// of global variables makes the code harder to read and may cause\n// problems when you register multiple environments from different\n// translation units and the environments have dependencies among them\n// (remember that the compiler doesn't guarantee the order in which\n// global variables from different translation units are initialized).\ninline Environment* AddGlobalTestEnvironment(Environment* env) {\n  return UnitTest::GetInstance()->AddEnvironment(env);\n}\n\n// Initializes Google Test.  This must be called before calling\n// RUN_ALL_TESTS().  In particular, it parses a command line for the\n// flags that Google Test recognizes.  Whenever a Google Test flag is\n// seen, it is removed from argv, and *argc is decremented.\n//\n// No value is returned.  Instead, the Google Test flag variables are\n// updated.\n//\n// Calling the function for the second time has no user-visible effect.\nGTEST_API_ void InitGoogleTest(int* argc, char** argv);\n\n// This overloaded version can be used in Windows programs compiled in\n// UNICODE mode.\nGTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);\n\nnamespace internal {\n\n// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a\n// value of type ToPrint that is an operand of a comparison assertion\n// (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in\n// the comparison, and is used to help determine the best way to\n// format the value.  In particular, when the value is a C string\n// (char pointer) and the other operand is an STL string object, we\n// want to format the C string as a string, since we know it is\n// compared by value with the string object.  If the value is a char\n// pointer but the other operand is not an STL string object, we don't\n// know whether the pointer is supposed to point to a NUL-terminated\n// string, and thus want to print it as a pointer to be safe.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n\n// The default case.\ntemplate <typename ToPrint, typename OtherOperand>\nclass FormatForComparison {\n public:\n  static ::std::string Format(const ToPrint& value) {\n    return ::testing::PrintToString(value);\n  }\n};\n\n// Array.\ntemplate <typename ToPrint, size_t N, typename OtherOperand>\nclass FormatForComparison<ToPrint[N], OtherOperand> {\n public:\n  static ::std::string Format(const ToPrint* value) {\n    return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);\n  }\n};\n\n// By default, print C string as pointers to be safe, as we don't know\n// whether they actually point to a NUL-terminated string.\n\n#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \\\n  template <typename OtherOperand>                                      \\\n  class FormatForComparison<CharType*, OtherOperand> {                  \\\n   public:                                                              \\\n    static ::std::string Format(CharType* value) {                      \\\n      return ::testing::PrintToString(static_cast<const void*>(value)); \\\n    }                                                                   \\\n  }\n\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);\n\n#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_\n\n// If a C string is compared with an STL string object, we know it's meant\n// to point to a NUL-terminated string, and thus can print it as a string.\n\n#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \\\n  template <>                                                           \\\n  class FormatForComparison<CharType*, OtherStringType> {               \\\n   public:                                                              \\\n    static ::std::string Format(CharType* value) {                      \\\n      return ::testing::PrintToString(value);                           \\\n    }                                                                   \\\n  }\n\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);\n\n#if GTEST_HAS_GLOBAL_STRING\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);\n#endif\n\n#if GTEST_HAS_GLOBAL_WSTRING\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);\n#endif\n\n#if GTEST_HAS_STD_WSTRING\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);\n#endif\n\n#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_\n\n// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)\n// operand to be used in a failure message.  The type (but not value)\n// of the other operand may affect the format.  This allows us to\n// print a char* as a raw pointer when it is compared against another\n// char* or void*, and print it as a C string when it is compared\n// against an std::string object, for example.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\ntemplate <typename T1, typename T2>\nstd::string FormatForComparisonFailureMessage(\n    const T1& value, const T2& /* other_operand */) {\n  return FormatForComparison<T1, T2>::Format(value);\n}\n\n// The helper function for {ASSERT|EXPECT}_EQ.\ntemplate <typename T1, typename T2>\nAssertionResult CmpHelperEQ(const char* expected_expression,\n                            const char* actual_expression,\n                            const T1& expected,\n                            const T2& actual) {\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4389)  // Temporarily disables warning on\n                                // signed/unsigned mismatch.\n#endif\n\n  if (expected == actual) {\n    return AssertionSuccess();\n  }\n\n#ifdef _MSC_VER\n# pragma warning(pop)          // Restores the warning state.\n#endif\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   FormatForComparisonFailureMessage(expected, actual),\n                   FormatForComparisonFailureMessage(actual, expected),\n                   false);\n}\n\n// With this overloaded version, we allow anonymous enums to be used\n// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums\n// can be implicitly cast to BiggestInt.\nGTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,\n                                       const char* actual_expression,\n                                       BiggestInt expected,\n                                       BiggestInt actual);\n\n// The helper class for {ASSERT|EXPECT}_EQ.  The template argument\n// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()\n// is a null pointer literal.  The following default implementation is\n// for lhs_is_null_literal being false.\ntemplate <bool lhs_is_null_literal>\nclass EqHelper {\n public:\n  // This templatized version is for the general case.\n  template <typename T1, typename T2>\n  static AssertionResult Compare(const char* expected_expression,\n                                 const char* actual_expression,\n                                 const T1& expected,\n                                 const T2& actual) {\n    return CmpHelperEQ(expected_expression, actual_expression, expected,\n                       actual);\n  }\n\n  // With this overloaded version, we allow anonymous enums to be used\n  // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous\n  // enums can be implicitly cast to BiggestInt.\n  //\n  // Even though its body looks the same as the above version, we\n  // cannot merge the two, as it will make anonymous enums unhappy.\n  static AssertionResult Compare(const char* expected_expression,\n                                 const char* actual_expression,\n                                 BiggestInt expected,\n                                 BiggestInt actual) {\n    return CmpHelperEQ(expected_expression, actual_expression, expected,\n                       actual);\n  }\n};\n\n// This specialization is used when the first argument to ASSERT_EQ()\n// is a null pointer literal, like NULL, false, or 0.\ntemplate <>\nclass EqHelper<true> {\n public:\n  // We define two overloaded versions of Compare().  The first\n  // version will be picked when the second argument to ASSERT_EQ() is\n  // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or\n  // EXPECT_EQ(false, a_bool).\n  template <typename T1, typename T2>\n  static AssertionResult Compare(\n      const char* expected_expression,\n      const char* actual_expression,\n      const T1& expected,\n      const T2& actual,\n      // The following line prevents this overload from being considered if T2\n      // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)\n      // expands to Compare(\"\", \"\", NULL, my_ptr), which requires a conversion\n      // to match the Secret* in the other overload, which would otherwise make\n      // this template match better.\n      typename EnableIf<!is_pointer<T2>::value>::type* = 0) {\n    return CmpHelperEQ(expected_expression, actual_expression, expected,\n                       actual);\n  }\n\n  // This version will be picked when the second argument to ASSERT_EQ() is a\n  // pointer, e.g. ASSERT_EQ(NULL, a_pointer).\n  template <typename T>\n  static AssertionResult Compare(\n      const char* expected_expression,\n      const char* actual_expression,\n      // We used to have a second template parameter instead of Secret*.  That\n      // template parameter would deduce to 'long', making this a better match\n      // than the first overload even without the first overload's EnableIf.\n      // Unfortunately, gcc with -Wconversion-null warns when \"passing NULL to\n      // non-pointer argument\" (even a deduced integral argument), so the old\n      // implementation caused warnings in user code.\n      Secret* /* expected (NULL) */,\n      T* actual) {\n    // We already know that 'expected' is a null pointer.\n    return CmpHelperEQ(expected_expression, actual_expression,\n                       static_cast<T*>(NULL), actual);\n  }\n};\n\n// A macro for implementing the helper functions needed to implement\n// ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste\n// of similar code.\n//\n// For each templatized helper function, we also define an overloaded\n// version for BiggestInt in order to reduce code bloat and allow\n// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled\n// with gcc 4.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n#define GTEST_IMPL_CMP_HELPER_(op_name, op)\\\ntemplate <typename T1, typename T2>\\\nAssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \\\n                                   const T1& val1, const T2& val2) {\\\n  if (val1 op val2) {\\\n    return AssertionSuccess();\\\n  } else {\\\n    return AssertionFailure() \\\n        << \"Expected: (\" << expr1 << \") \" #op \" (\" << expr2\\\n        << \"), actual: \" << FormatForComparisonFailureMessage(val1, val2)\\\n        << \" vs \" << FormatForComparisonFailureMessage(val2, val1);\\\n  }\\\n}\\\nGTEST_API_ AssertionResult CmpHelper##op_name(\\\n    const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n\n// Implements the helper function for {ASSERT|EXPECT}_NE\nGTEST_IMPL_CMP_HELPER_(NE, !=);\n// Implements the helper function for {ASSERT|EXPECT}_LE\nGTEST_IMPL_CMP_HELPER_(LE, <=);\n// Implements the helper function for {ASSERT|EXPECT}_LT\nGTEST_IMPL_CMP_HELPER_(LT, <);\n// Implements the helper function for {ASSERT|EXPECT}_GE\nGTEST_IMPL_CMP_HELPER_(GE, >=);\n// Implements the helper function for {ASSERT|EXPECT}_GT\nGTEST_IMPL_CMP_HELPER_(GT, >);\n\n#undef GTEST_IMPL_CMP_HELPER_\n\n// The helper function for {ASSERT|EXPECT}_STREQ.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,\n                                          const char* actual_expression,\n                                          const char* expected,\n                                          const char* actual);\n\n// The helper function for {ASSERT|EXPECT}_STRCASEEQ.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,\n                                              const char* actual_expression,\n                                              const char* expected,\n                                              const char* actual);\n\n// The helper function for {ASSERT|EXPECT}_STRNE.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,\n                                          const char* s2_expression,\n                                          const char* s1,\n                                          const char* s2);\n\n// The helper function for {ASSERT|EXPECT}_STRCASENE.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,\n                                              const char* s2_expression,\n                                              const char* s1,\n                                              const char* s2);\n\n\n// Helper function for *_STREQ on wide strings.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,\n                                          const char* actual_expression,\n                                          const wchar_t* expected,\n                                          const wchar_t* actual);\n\n// Helper function for *_STRNE on wide strings.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,\n                                          const char* s2_expression,\n                                          const wchar_t* s1,\n                                          const wchar_t* s2);\n\n}  // namespace internal\n\n// IsSubstring() and IsNotSubstring() are intended to be used as the\n// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by\n// themselves.  They check whether needle is a substring of haystack\n// (NULL is considered a substring of itself only), and return an\n// appropriate error message when they fail.\n//\n// The {needle,haystack}_expr arguments are the stringified\n// expressions that generated the two real arguments.\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack);\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack);\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack);\n\n#if GTEST_HAS_STD_WSTRING\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack);\n#endif  // GTEST_HAS_STD_WSTRING\n\nnamespace internal {\n\n// Helper template function for comparing floating-points.\n//\n// Template parameter:\n//\n//   RawType: the raw floating-point type (either float or double)\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\ntemplate <typename RawType>\nAssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,\n                                         const char* actual_expression,\n                                         RawType expected,\n                                         RawType actual) {\n  const FloatingPoint<RawType> lhs(expected), rhs(actual);\n\n  if (lhs.AlmostEquals(rhs)) {\n    return AssertionSuccess();\n  }\n\n  ::std::stringstream expected_ss;\n  expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n              << expected;\n\n  ::std::stringstream actual_ss;\n  actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n            << actual;\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   StringStreamToString(&expected_ss),\n                   StringStreamToString(&actual_ss),\n                   false);\n}\n\n// Helper function for implementing ASSERT_NEAR.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,\n                                                const char* expr2,\n                                                const char* abs_error_expr,\n                                                double val1,\n                                                double val2,\n                                                double abs_error);\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n// A class that enables one to stream messages to assertion macros\nclass GTEST_API_ AssertHelper {\n public:\n  // Constructor.\n  AssertHelper(TestPartResult::Type type,\n               const char* file,\n               int line,\n               const char* message);\n  ~AssertHelper();\n\n  // Message assignment is a semantic trick to enable assertion\n  // streaming; see the GTEST_MESSAGE_ macro below.\n  void operator=(const Message& message) const;\n\n private:\n  // We put our data in a struct so that the size of the AssertHelper class can\n  // be as small as possible.  This is important because gcc is incapable of\n  // re-using stack space even for temporary variables, so every EXPECT_EQ\n  // reserves stack space for another AssertHelper.\n  struct AssertHelperData {\n    AssertHelperData(TestPartResult::Type t,\n                     const char* srcfile,\n                     int line_num,\n                     const char* msg)\n        : type(t), file(srcfile), line(line_num), message(msg) { }\n\n    TestPartResult::Type const type;\n    const char* const file;\n    int const line;\n    std::string const message;\n\n   private:\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);\n  };\n\n  AssertHelperData* const data_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);\n};\n\n}  // namespace internal\n\n#if GTEST_HAS_PARAM_TEST\n// The pure interface class that all value-parameterized tests inherit from.\n// A value-parameterized class must inherit from both ::testing::Test and\n// ::testing::WithParamInterface. In most cases that just means inheriting\n// from ::testing::TestWithParam, but more complicated test hierarchies\n// may need to inherit from Test and WithParamInterface at different levels.\n//\n// This interface has support for accessing the test parameter value via\n// the GetParam() method.\n//\n// Use it with one of the parameter generator defining functions, like Range(),\n// Values(), ValuesIn(), Bool(), and Combine().\n//\n// class FooTest : public ::testing::TestWithParam<int> {\n//  protected:\n//   FooTest() {\n//     // Can use GetParam() here.\n//   }\n//   virtual ~FooTest() {\n//     // Can use GetParam() here.\n//   }\n//   virtual void SetUp() {\n//     // Can use GetParam() here.\n//   }\n//   virtual void TearDown {\n//     // Can use GetParam() here.\n//   }\n// };\n// TEST_P(FooTest, DoesBar) {\n//   // Can use GetParam() method here.\n//   Foo foo;\n//   ASSERT_TRUE(foo.DoesBar(GetParam()));\n// }\n// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));\n\ntemplate <typename T>\nclass WithParamInterface {\n public:\n  typedef T ParamType;\n  virtual ~WithParamInterface() {}\n\n  // The current parameter value. Is also available in the test fixture's\n  // constructor. This member function is non-static, even though it only\n  // references static data, to reduce the opportunity for incorrect uses\n  // like writing 'WithParamInterface<bool>::GetParam()' for a test that\n  // uses a fixture whose parameter type is int.\n  const ParamType& GetParam() const {\n    GTEST_CHECK_(parameter_ != NULL)\n        << \"GetParam() can only be called inside a value-parameterized test \"\n        << \"-- did you intend to write TEST_P instead of TEST_F?\";\n    return *parameter_;\n  }\n\n private:\n  // Sets parameter value. The caller is responsible for making sure the value\n  // remains alive and unchanged throughout the current test.\n  static void SetParam(const ParamType* parameter) {\n    parameter_ = parameter;\n  }\n\n  // Static value used for accessing parameter during a test lifetime.\n  static const ParamType* parameter_;\n\n  // TestClass must be a subclass of WithParamInterface<T> and Test.\n  template <class TestClass> friend class internal::ParameterizedTestFactory;\n};\n\ntemplate <typename T>\nconst T* WithParamInterface<T>::parameter_ = NULL;\n\n// Most value-parameterized classes can ignore the existence of\n// WithParamInterface, and can just inherit from ::testing::TestWithParam.\n\ntemplate <typename T>\nclass TestWithParam : public Test, public WithParamInterface<T> {\n};\n\n#endif  // GTEST_HAS_PARAM_TEST\n\n// Macros for indicating success/failure in test code.\n\n// ADD_FAILURE unconditionally adds a failure to the current test.\n// SUCCEED generates a success - it doesn't automatically make the\n// current test successful, as a test is only successful when it has\n// no failure.\n//\n// EXPECT_* verifies that a certain condition is satisfied.  If not,\n// it behaves like ADD_FAILURE.  In particular:\n//\n//   EXPECT_TRUE  verifies that a Boolean condition is true.\n//   EXPECT_FALSE verifies that a Boolean condition is false.\n//\n// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except\n// that they will also abort the current function on failure.  People\n// usually want the fail-fast behavior of FAIL and ASSERT_*, but those\n// writing data-driven tests often find themselves using ADD_FAILURE\n// and EXPECT_* more.\n\n// Generates a nonfatal failure with a generic message.\n#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_(\"Failed\")\n\n// Generates a nonfatal failure at the given source file location with\n// a generic message.\n#define ADD_FAILURE_AT(file, line) \\\n  GTEST_MESSAGE_AT_(file, line, \"Failed\", \\\n                    ::testing::TestPartResult::kNonFatalFailure)\n\n// Generates a fatal failure with a generic message.\n#define GTEST_FAIL() GTEST_FATAL_FAILURE_(\"Failed\")\n\n// Define this macro to 1 to omit the definition of FAIL(), which is a\n// generic name and clashes with some other libraries.\n#if !GTEST_DONT_DEFINE_FAIL\n# define FAIL() GTEST_FAIL()\n#endif\n\n// Generates a success with a generic message.\n#define GTEST_SUCCEED() GTEST_SUCCESS_(\"Succeeded\")\n\n// Define this macro to 1 to omit the definition of SUCCEED(), which\n// is a generic name and clashes with some other libraries.\n#if !GTEST_DONT_DEFINE_SUCCEED\n# define SUCCEED() GTEST_SUCCEED()\n#endif\n\n// Macros for testing exceptions.\n//\n//    * {ASSERT|EXPECT}_THROW(statement, expected_exception):\n//         Tests that the statement throws the expected exception.\n//    * {ASSERT|EXPECT}_NO_THROW(statement):\n//         Tests that the statement doesn't throw any exception.\n//    * {ASSERT|EXPECT}_ANY_THROW(statement):\n//         Tests that the statement throws an exception.\n\n#define EXPECT_THROW(statement, expected_exception) \\\n  GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_NO_THROW(statement) \\\n  GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_ANY_THROW(statement) \\\n  GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_THROW(statement, expected_exception) \\\n  GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)\n#define ASSERT_NO_THROW(statement) \\\n  GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)\n#define ASSERT_ANY_THROW(statement) \\\n  GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)\n\n// Boolean assertions. Condition can be either a Boolean expression or an\n// AssertionResult. For more information on how to use AssertionResult with\n// these macros see comments on that class.\n#define EXPECT_TRUE(condition) \\\n  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \\\n                      GTEST_NONFATAL_FAILURE_)\n#define EXPECT_FALSE(condition) \\\n  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \\\n                      GTEST_NONFATAL_FAILURE_)\n#define ASSERT_TRUE(condition) \\\n  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \\\n                      GTEST_FATAL_FAILURE_)\n#define ASSERT_FALSE(condition) \\\n  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \\\n                      GTEST_FATAL_FAILURE_)\n\n// Includes the auto-generated header that implements a family of\n// generic predicate assertion macros.\n// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command\n// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!\n//\n// Implements a family of generic predicate assertion macros.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n\n// Makes sure this header is not included before gtest.h.\n#ifndef GTEST_INCLUDE_GTEST_GTEST_H_\n# error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.\n#endif  // GTEST_INCLUDE_GTEST_GTEST_H_\n\n// This header implements a family of generic predicate assertion\n// macros:\n//\n//   ASSERT_PRED_FORMAT1(pred_format, v1)\n//   ASSERT_PRED_FORMAT2(pred_format, v1, v2)\n//   ...\n//\n// where pred_format is a function or functor that takes n (in the\n// case of ASSERT_PRED_FORMATn) values and their source expression\n// text, and returns a testing::AssertionResult.  See the definition\n// of ASSERT_EQ in gtest.h for an example.\n//\n// If you don't care about formatting, you can use the more\n// restrictive version:\n//\n//   ASSERT_PRED1(pred, v1)\n//   ASSERT_PRED2(pred, v1, v2)\n//   ...\n//\n// where pred is an n-ary function or functor that returns bool,\n// and the values v1, v2, ..., must support the << operator for\n// streaming to std::ostream.\n//\n// We also define the EXPECT_* variations.\n//\n// For now we only support predicates whose arity is at most 5.\n// Please email googletestframework@googlegroups.com if you need\n// support for higher arities.\n\n// GTEST_ASSERT_ is the basic statement to which all of the assertions\n// in this file reduce.  Don't use this in your code.\n\n#define GTEST_ASSERT_(expression, on_failure) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (const ::testing::AssertionResult gtest_ar = (expression)) \\\n    ; \\\n  else \\\n    on_failure(gtest_ar.failure_message())\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1>\nAssertionResult AssertPred1Helper(const char* pred_text,\n                                  const char* e1,\n                                  Pred pred,\n                                  const T1& v1) {\n  if (pred(v1)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, v1), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use\n// this in your code.\n#define GTEST_PRED1_(pred, v1, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \\\n                                             #v1, \\\n                                             pred, \\\n                                             v1), on_failure)\n\n// Unary predicate assertion macros.\n#define EXPECT_PRED_FORMAT1(pred_format, v1) \\\n  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED1(pred, v1) \\\n  GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT1(pred_format, v1) \\\n  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED1(pred, v1) \\\n  GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2>\nAssertionResult AssertPred2Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2) {\n  if (pred(v1, v2)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use\n// this in your code.\n#define GTEST_PRED2_(pred, v1, v2, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2), on_failure)\n\n// Binary predicate assertion macros.\n#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \\\n  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED2(pred, v1, v2) \\\n  GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \\\n  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED2(pred, v1, v2) \\\n  GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2,\n          typename T3>\nAssertionResult AssertPred3Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  const char* e3,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2,\n                                  const T3& v3) {\n  if (pred(v1, v2, v3)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \", \"\n                            << e3 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2\n                            << \"\\n\" << e3 << \" evaluates to \" << v3;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use\n// this in your code.\n#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             #v3, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2, \\\n                                             v3), on_failure)\n\n// Ternary predicate assertion macros.\n#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \\\n  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED3(pred, v1, v2, v3) \\\n  GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \\\n  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED3(pred, v1, v2, v3) \\\n  GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2,\n          typename T3,\n          typename T4>\nAssertionResult AssertPred4Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  const char* e3,\n                                  const char* e4,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2,\n                                  const T3& v3,\n                                  const T4& v4) {\n  if (pred(v1, v2, v3, v4)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \", \"\n                            << e3 << \", \"\n                            << e4 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2\n                            << \"\\n\" << e3 << \" evaluates to \" << v3\n                            << \"\\n\" << e4 << \" evaluates to \" << v4;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use\n// this in your code.\n#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             #v3, \\\n                                             #v4, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2, \\\n                                             v3, \\\n                                             v4), on_failure)\n\n// 4-ary predicate assertion macros.\n#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \\\n  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED4(pred, v1, v2, v3, v4) \\\n  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \\\n  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED4(pred, v1, v2, v3, v4) \\\n  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2,\n          typename T3,\n          typename T4,\n          typename T5>\nAssertionResult AssertPred5Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  const char* e3,\n                                  const char* e4,\n                                  const char* e5,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2,\n                                  const T3& v3,\n                                  const T4& v4,\n                                  const T5& v5) {\n  if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \", \"\n                            << e3 << \", \"\n                            << e4 << \", \"\n                            << e5 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2\n                            << \"\\n\" << e3 << \" evaluates to \" << v3\n                            << \"\\n\" << e4 << \" evaluates to \" << v4\n                            << \"\\n\" << e5 << \" evaluates to \" << v5;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use\n// this in your code.\n#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             #v3, \\\n                                             #v4, \\\n                                             #v5, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2, \\\n                                             v3, \\\n                                             v4, \\\n                                             v5), on_failure)\n\n// 5-ary predicate assertion macros.\n#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \\\n  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \\\n  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \\\n  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \\\n  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)\n\n\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n\n// Macros for testing equalities and inequalities.\n//\n//    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual\n//    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2\n//    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 < v2\n//    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 <= v2\n//    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 > v2\n//    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 >= v2\n//\n// When they are not, Google Test prints both the tested expressions and\n// their actual values.  The values must be compatible built-in types,\n// or you will get a compiler error.  By \"compatible\" we mean that the\n// values can be compared by the respective operator.\n//\n// Note:\n//\n//   1. It is possible to make a user-defined type work with\n//   {ASSERT|EXPECT}_??(), but that requires overloading the\n//   comparison operators and is thus discouraged by the Google C++\n//   Usage Guide.  Therefore, you are advised to use the\n//   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are\n//   equal.\n//\n//   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on\n//   pointers (in particular, C strings).  Therefore, if you use it\n//   with two C strings, you are testing how their locations in memory\n//   are related, not how their content is related.  To compare two C\n//   strings by content, use {ASSERT|EXPECT}_STR*().\n//\n//   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to\n//   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you\n//   what the actual value is when it fails, and similarly for the\n//   other comparisons.\n//\n//   4. Do not depend on the order in which {ASSERT|EXPECT}_??()\n//   evaluate their arguments, which is undefined.\n//\n//   5. These macros evaluate their arguments exactly once.\n//\n// Examples:\n//\n//   EXPECT_NE(5, Foo());\n//   EXPECT_EQ(NULL, a_pointer);\n//   ASSERT_LT(i, array_size);\n//   ASSERT_GT(records.size(), 0) << \"There is no record left.\";\n\n#define EXPECT_EQ(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal:: \\\n                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \\\n                      expected, actual)\n#define EXPECT_NE(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)\n#define EXPECT_LE(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)\n#define EXPECT_LT(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)\n#define EXPECT_GE(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)\n#define EXPECT_GT(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)\n\n#define GTEST_ASSERT_EQ(expected, actual) \\\n  ASSERT_PRED_FORMAT2(::testing::internal:: \\\n                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \\\n                      expected, actual)\n#define GTEST_ASSERT_NE(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)\n#define GTEST_ASSERT_LE(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)\n#define GTEST_ASSERT_LT(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)\n#define GTEST_ASSERT_GE(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)\n#define GTEST_ASSERT_GT(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)\n\n// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of\n// ASSERT_XY(), which clashes with some users' own code.\n\n#if !GTEST_DONT_DEFINE_ASSERT_EQ\n# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_NE\n# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_LE\n# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_LT\n# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_GE\n# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_GT\n# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)\n#endif\n\n// C-string Comparisons.  All tests treat NULL and any non-NULL string\n// as different.  Two NULLs are equal.\n//\n//    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2\n//    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2\n//    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case\n//    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case\n//\n// For wide or narrow string objects, you can use the\n// {ASSERT|EXPECT}_??() macros.\n//\n// Don't depend on the order in which the arguments are evaluated,\n// which is undefined.\n//\n// These macros evaluate their arguments exactly once.\n\n#define EXPECT_STREQ(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)\n#define EXPECT_STRNE(s1, s2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)\n#define EXPECT_STRCASEEQ(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)\n#define EXPECT_STRCASENE(s1, s2)\\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)\n\n#define ASSERT_STREQ(expected, actual) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)\n#define ASSERT_STRNE(s1, s2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)\n#define ASSERT_STRCASEEQ(expected, actual) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)\n#define ASSERT_STRCASENE(s1, s2)\\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)\n\n// Macros for comparing floating-point numbers.\n//\n//    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):\n//         Tests that two float values are almost equal.\n//    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):\n//         Tests that two double values are almost equal.\n//    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):\n//         Tests that v1 and v2 are within the given distance to each other.\n//\n// Google Test uses ULP-based comparison to automatically pick a default\n// error bound that is appropriate for the operands.  See the\n// FloatingPoint template class in gtest-internal.h if you are\n// interested in the implementation details.\n\n#define EXPECT_FLOAT_EQ(expected, actual)\\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \\\n                      expected, actual)\n\n#define EXPECT_DOUBLE_EQ(expected, actual)\\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \\\n                      expected, actual)\n\n#define ASSERT_FLOAT_EQ(expected, actual)\\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \\\n                      expected, actual)\n\n#define ASSERT_DOUBLE_EQ(expected, actual)\\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \\\n                      expected, actual)\n\n#define EXPECT_NEAR(val1, val2, abs_error)\\\n  EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \\\n                      val1, val2, abs_error)\n\n#define ASSERT_NEAR(val1, val2, abs_error)\\\n  ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \\\n                      val1, val2, abs_error)\n\n// These predicate format functions work on floating-point values, and\n// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.\n//\n//   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);\n\n// Asserts that val1 is less than, or almost equal to, val2.  Fails\n// otherwise.  In particular, it fails if either val1 or val2 is NaN.\nGTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,\n                                   float val1, float val2);\nGTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,\n                                    double val1, double val2);\n\n\n#if GTEST_OS_WINDOWS\n\n// Macros that test for HRESULT failure and success, these are only useful\n// on Windows, and rely on Windows SDK macros and APIs to compile.\n//\n//    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)\n//\n// When expr unexpectedly fails or succeeds, Google Test prints the\n// expected result and the actual result with both a human-readable\n// string representation of the error, if available, as well as the\n// hex result code.\n# define EXPECT_HRESULT_SUCCEEDED(expr) \\\n    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))\n\n# define ASSERT_HRESULT_SUCCEEDED(expr) \\\n    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))\n\n# define EXPECT_HRESULT_FAILED(expr) \\\n    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))\n\n# define ASSERT_HRESULT_FAILED(expr) \\\n    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))\n\n#endif  // GTEST_OS_WINDOWS\n\n// Macros that execute statement and check that it doesn't generate new fatal\n// failures in the current thread.\n//\n//   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);\n//\n// Examples:\n//\n//   EXPECT_NO_FATAL_FAILURE(Process());\n//   ASSERT_NO_FATAL_FAILURE(Process()) << \"Process() failed\";\n//\n#define ASSERT_NO_FATAL_FAILURE(statement) \\\n    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)\n#define EXPECT_NO_FATAL_FAILURE(statement) \\\n    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)\n\n// Causes a trace (including the source file path, the current line\n// number, and the given message) to be included in every test failure\n// message generated by code in the current scope.  The effect is\n// undone when the control leaves the current scope.\n//\n// The message argument can be anything streamable to std::ostream.\n//\n// In the implementation, we include the current line number as part\n// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s\n// to appear in the same block - as long as they are on different\n// lines.\n#define SCOPED_TRACE(message) \\\n  ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\\\n    __FILE__, __LINE__, ::testing::Message() << (message))\n\n// Compile-time assertion for type equality.\n// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are\n// the same type.  The value it returns is not interesting.\n//\n// Instead of making StaticAssertTypeEq a class template, we make it a\n// function template that invokes a helper class template.  This\n// prevents a user from misusing StaticAssertTypeEq<T1, T2> by\n// defining objects of that type.\n//\n// CAVEAT:\n//\n// When used inside a method of a class template,\n// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is\n// instantiated.  For example, given:\n//\n//   template <typename T> class Foo {\n//    public:\n//     void Bar() { testing::StaticAssertTypeEq<int, T>(); }\n//   };\n//\n// the code:\n//\n//   void Test1() { Foo<bool> foo; }\n//\n// will NOT generate a compiler error, as Foo<bool>::Bar() is never\n// actually instantiated.  Instead, you need:\n//\n//   void Test2() { Foo<bool> foo; foo.Bar(); }\n//\n// to cause a compiler error.\ntemplate <typename T1, typename T2>\nbool StaticAssertTypeEq() {\n  (void)internal::StaticAssertTypeEqHelper<T1, T2>();\n  return true;\n}\n\n// Defines a test.\n//\n// The first parameter is the name of the test case, and the second\n// parameter is the name of the test within the test case.\n//\n// The convention is to end the test case name with \"Test\".  For\n// example, a test case for the Foo class can be named FooTest.\n//\n// The user should put his test code between braces after using this\n// macro.  Example:\n//\n//   TEST(FooTest, InitializesCorrectly) {\n//     Foo foo;\n//     EXPECT_TRUE(foo.StatusIsOK());\n//   }\n\n// Note that we call GetTestTypeId() instead of GetTypeId<\n// ::testing::Test>() here to get the type ID of testing::Test.  This\n// is to work around a suspected linker bug when using Google Test as\n// a framework on Mac OS X.  The bug causes GetTypeId<\n// ::testing::Test>() to return different values depending on whether\n// the call is from the Google Test framework itself or from user test\n// code.  GetTestTypeId() is guaranteed to always return the same\n// value, as it always calls GetTypeId<>() from the Google Test\n// framework.\n#define GTEST_TEST(test_case_name, test_name)\\\n  GTEST_TEST_(test_case_name, test_name, \\\n              ::testing::Test, ::testing::internal::GetTestTypeId())\n\n// Define this macro to 1 to omit the definition of TEST(), which\n// is a generic name and clashes with some other libraries.\n#if !GTEST_DONT_DEFINE_TEST\n# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)\n#endif\n\n// Defines a test that uses a test fixture.\n//\n// The first parameter is the name of the test fixture class, which\n// also doubles as the test case name.  The second parameter is the\n// name of the test within the test case.\n//\n// A test fixture class must be declared earlier.  The user should put\n// his test code between braces after using this macro.  Example:\n//\n//   class FooTest : public testing::Test {\n//    protected:\n//     virtual void SetUp() { b_.AddElement(3); }\n//\n//     Foo a_;\n//     Foo b_;\n//   };\n//\n//   TEST_F(FooTest, InitializesCorrectly) {\n//     EXPECT_TRUE(a_.StatusIsOK());\n//   }\n//\n//   TEST_F(FooTest, ReturnsElementCountCorrectly) {\n//     EXPECT_EQ(0, a_.size());\n//     EXPECT_EQ(1, b_.size());\n//   }\n\n#define TEST_F(test_fixture, test_name)\\\n  GTEST_TEST_(test_fixture, test_name, test_fixture, \\\n              ::testing::internal::GetTypeId<test_fixture>())\n\n}  // namespace testing\n\n// Use this function in main() to run all tests.  It returns 0 if all\n// tests are successful, or 1 otherwise.\n//\n// RUN_ALL_TESTS() should be invoked after the command line has been\n// parsed by InitGoogleTest().\n//\n// This function was formerly a macro; thus, it is in the global\n// namespace and has an all-caps name.\nint RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;\n\ninline int RUN_ALL_TESTS() {\n  return ::testing::UnitTest::GetInstance()->Run();\n}\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_H_\n"
  },
  {
    "path": "Tests/gtest/fused-src/gtest/gtest_main.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#include <stdio.h>\n\n#include \"gtest/gtest.h\"\n\nGTEST_API_ int main(int argc, char **argv) {\n  printf(\"Running main() from gtest_main.cc\\n\");\n  testing::InitGoogleTest(&argc, argv);\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-death-test.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines the public API for death tests.  It is\n// #included by gtest.h so a user doesn't need to include this\n// directly.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_\n\n#include \"gtest/internal/gtest-death-test-internal.h\"\n\nnamespace testing {\n\n// This flag controls the style of death tests.  Valid values are \"threadsafe\",\n// meaning that the death test child process will re-execute the test binary\n// from the start, running only a single death test, or \"fast\",\n// meaning that the child process will execute the test logic immediately\n// after forking.\nGTEST_DECLARE_string_(death_test_style);\n\n#if GTEST_HAS_DEATH_TEST\n\nnamespace internal {\n\n// Returns a Boolean value indicating whether the caller is currently\n// executing in the context of the death test child process.  Tools such as\n// Valgrind heap checkers may need this to modify their behavior in death\n// tests.  IMPORTANT: This is an internal utility.  Using it may break the\n// implementation of death tests.  User code MUST NOT use it.\nGTEST_API_ bool InDeathTestChild();\n\n}  // namespace internal\n\n// The following macros are useful for writing death tests.\n\n// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is\n// executed:\n//\n//   1. It generates a warning if there is more than one active\n//   thread.  This is because it's safe to fork() or clone() only\n//   when there is a single thread.\n//\n//   2. The parent process clone()s a sub-process and runs the death\n//   test in it; the sub-process exits with code 0 at the end of the\n//   death test, if it hasn't exited already.\n//\n//   3. The parent process waits for the sub-process to terminate.\n//\n//   4. The parent process checks the exit code and error message of\n//   the sub-process.\n//\n// Examples:\n//\n//   ASSERT_DEATH(server.SendMessage(56, \"Hello\"), \"Invalid port number\");\n//   for (int i = 0; i < 5; i++) {\n//     EXPECT_DEATH(server.ProcessRequest(i),\n//                  \"Invalid request .* in ProcessRequest()\")\n//                  << \"Failed to die on request \" << i;\n//   }\n//\n//   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), \"Exiting\");\n//\n//   bool KilledBySIGHUP(int exit_code) {\n//     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;\n//   }\n//\n//   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, \"Hanging up!\");\n//\n// On the regular expressions used in death tests:\n//\n//   On POSIX-compliant systems (*nix), we use the <regex.h> library,\n//   which uses the POSIX extended regex syntax.\n//\n//   On other platforms (e.g. Windows), we only support a simple regex\n//   syntax implemented as part of Google Test.  This limited\n//   implementation should be enough most of the time when writing\n//   death tests; though it lacks many features you can find in PCRE\n//   or POSIX extended regex syntax.  For example, we don't support\n//   union (\"x|y\"), grouping (\"(xy)\"), brackets (\"[xy]\"), and\n//   repetition count (\"x{5,7}\"), among others.\n//\n//   Below is the syntax that we do support.  We chose it to be a\n//   subset of both PCRE and POSIX extended regex, so it's easy to\n//   learn wherever you come from.  In the following: 'A' denotes a\n//   literal character, period (.), or a single \\\\ escape sequence;\n//   'x' and 'y' denote regular expressions; 'm' and 'n' are for\n//   natural numbers.\n//\n//     c     matches any literal character c\n//     \\\\d   matches any decimal digit\n//     \\\\D   matches any character that's not a decimal digit\n//     \\\\f   matches \\f\n//     \\\\n   matches \\n\n//     \\\\r   matches \\r\n//     \\\\s   matches any ASCII whitespace, including \\n\n//     \\\\S   matches any character that's not a whitespace\n//     \\\\t   matches \\t\n//     \\\\v   matches \\v\n//     \\\\w   matches any letter, _, or decimal digit\n//     \\\\W   matches any character that \\\\w doesn't match\n//     \\\\c   matches any literal character c, which must be a punctuation\n//     .     matches any single character except \\n\n//     A?    matches 0 or 1 occurrences of A\n//     A*    matches 0 or many occurrences of A\n//     A+    matches 1 or many occurrences of A\n//     ^     matches the beginning of a string (not that of each line)\n//     $     matches the end of a string (not that of each line)\n//     xy    matches x followed by y\n//\n//   If you accidentally use PCRE or POSIX extended regex features\n//   not implemented by us, you will get a run-time failure.  In that\n//   case, please try to rewrite your regular expression within the\n//   above syntax.\n//\n//   This implementation is *not* meant to be as highly tuned or robust\n//   as a compiled regex library, but should perform well enough for a\n//   death test, which already incurs significant overhead by launching\n//   a child process.\n//\n// Known caveats:\n//\n//   A \"threadsafe\" style death test obtains the path to the test\n//   program from argv[0] and re-executes it in the sub-process.  For\n//   simplicity, the current implementation doesn't search the PATH\n//   when launching the sub-process.  This means that the user must\n//   invoke the test program via a path that contains at least one\n//   path separator (e.g. path/to/foo_test and\n//   /absolute/path/to/bar_test are fine, but foo_test is not).  This\n//   is rarely a problem as people usually don't put the test binary\n//   directory in PATH.\n//\n// TODO(wan@google.com): make thread-safe death tests search the PATH.\n\n// Asserts that a given statement causes the program to exit, with an\n// integer exit status that satisfies predicate, and emitting error output\n// that matches regex.\n# define ASSERT_EXIT(statement, predicate, regex) \\\n    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)\n\n// Like ASSERT_EXIT, but continues on to successive tests in the\n// test case, if any:\n# define EXPECT_EXIT(statement, predicate, regex) \\\n    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)\n\n// Asserts that a given statement causes the program to exit, either by\n// explicitly exiting with a nonzero exit code or being killed by a\n// signal, and emitting error output that matches regex.\n# define ASSERT_DEATH(statement, regex) \\\n    ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)\n\n// Like ASSERT_DEATH, but continues on to successive tests in the\n// test case, if any:\n# define EXPECT_DEATH(statement, regex) \\\n    EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)\n\n// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:\n\n// Tests that an exit code describes a normal exit with a given exit code.\nclass GTEST_API_ ExitedWithCode {\n public:\n  explicit ExitedWithCode(int exit_code);\n  bool operator()(int exit_status) const;\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ExitedWithCode& other);\n\n  const int exit_code_;\n};\n\n# if !GTEST_OS_WINDOWS\n// Tests that an exit code describes an exit due to termination by a\n// given signal.\nclass GTEST_API_ KilledBySignal {\n public:\n  explicit KilledBySignal(int signum);\n  bool operator()(int exit_status) const;\n private:\n  const int signum_;\n};\n# endif  // !GTEST_OS_WINDOWS\n\n// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.\n// The death testing framework causes this to have interesting semantics,\n// since the sideeffects of the call are only visible in opt mode, and not\n// in debug mode.\n//\n// In practice, this can be used to test functions that utilize the\n// LOG(DFATAL) macro using the following style:\n//\n// int DieInDebugOr12(int* sideeffect) {\n//   if (sideeffect) {\n//     *sideeffect = 12;\n//   }\n//   LOG(DFATAL) << \"death\";\n//   return 12;\n// }\n//\n// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {\n//   int sideeffect = 0;\n//   // Only asserts in dbg.\n//   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), \"death\");\n//\n// #ifdef NDEBUG\n//   // opt-mode has sideeffect visible.\n//   EXPECT_EQ(12, sideeffect);\n// #else\n//   // dbg-mode no visible sideeffect.\n//   EXPECT_EQ(0, sideeffect);\n// #endif\n// }\n//\n// This will assert that DieInDebugReturn12InOpt() crashes in debug\n// mode, usually due to a DCHECK or LOG(DFATAL), but returns the\n// appropriate fallback value (12 in this case) in opt mode. If you\n// need to test that a function has appropriate side-effects in opt\n// mode, include assertions against the side-effects.  A general\n// pattern for this is:\n//\n// EXPECT_DEBUG_DEATH({\n//   // Side-effects here will have an effect after this statement in\n//   // opt mode, but none in debug mode.\n//   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));\n// }, \"death\");\n//\n# ifdef NDEBUG\n\n#  define EXPECT_DEBUG_DEATH(statement, regex) \\\n  GTEST_EXECUTE_STATEMENT_(statement, regex)\n\n#  define ASSERT_DEBUG_DEATH(statement, regex) \\\n  GTEST_EXECUTE_STATEMENT_(statement, regex)\n\n# else\n\n#  define EXPECT_DEBUG_DEATH(statement, regex) \\\n  EXPECT_DEATH(statement, regex)\n\n#  define ASSERT_DEBUG_DEATH(statement, regex) \\\n  ASSERT_DEATH(statement, regex)\n\n# endif  // NDEBUG for EXPECT_DEBUG_DEATH\n#endif  // GTEST_HAS_DEATH_TEST\n\n// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and\n// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if\n// death tests are supported; otherwise they just issue a warning.  This is\n// useful when you are combining death test assertions with normal test\n// assertions in one test.\n#if GTEST_HAS_DEATH_TEST\n# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \\\n    EXPECT_DEATH(statement, regex)\n# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \\\n    ASSERT_DEATH(statement, regex)\n#else\n# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \\\n    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )\n# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \\\n    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)\n#endif\n\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-message.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines the Message class.\n//\n// IMPORTANT NOTE: Due to limitation of the C++ language, we have to\n// leave some internal implementation details in this header file.\n// They are clearly marked by comments like this:\n//\n//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n//\n// Such code is NOT meant to be used by a user directly, and is subject\n// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user\n// program!\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_\n#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_\n\n#include <limits>\n\n#include \"gtest/internal/gtest-port.h\"\n\n// Ensures that there is at least one operator<< in the global namespace.\n// See Message& operator<<(...) below for why.\nvoid operator<<(const testing::internal::Secret&, int);\n\nnamespace testing {\n\n// The Message class works like an ostream repeater.\n//\n// Typical usage:\n//\n//   1. You stream a bunch of values to a Message object.\n//      It will remember the text in a stringstream.\n//   2. Then you stream the Message object to an ostream.\n//      This causes the text in the Message to be streamed\n//      to the ostream.\n//\n// For example;\n//\n//   testing::Message foo;\n//   foo << 1 << \" != \" << 2;\n//   std::cout << foo;\n//\n// will print \"1 != 2\".\n//\n// Message is not intended to be inherited from.  In particular, its\n// destructor is not virtual.\n//\n// Note that stringstream behaves differently in gcc and in MSVC.  You\n// can stream a NULL char pointer to it in the former, but not in the\n// latter (it causes an access violation if you do).  The Message\n// class hides this difference by treating a NULL char pointer as\n// \"(null)\".\nclass GTEST_API_ Message {\n private:\n  // The type of basic IO manipulators (endl, ends, and flush) for\n  // narrow streams.\n  typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);\n\n public:\n  // Constructs an empty Message.\n  Message();\n\n  // Copy constructor.\n  Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT\n    *ss_ << msg.GetString();\n  }\n\n  // Constructs a Message from a C-string.\n  explicit Message(const char* str) : ss_(new ::std::stringstream) {\n    *ss_ << str;\n  }\n\n#if GTEST_OS_SYMBIAN\n  // Streams a value (either a pointer or not) to this object.\n  template <typename T>\n  inline Message& operator <<(const T& value) {\n    StreamHelper(typename internal::is_pointer<T>::type(), value);\n    return *this;\n  }\n#else\n  // Streams a non-pointer value to this object.\n  template <typename T>\n  inline Message& operator <<(const T& val) {\n    // Some libraries overload << for STL containers.  These\n    // overloads are defined in the global namespace instead of ::std.\n    //\n    // C++'s symbol lookup rule (i.e. Koenig lookup) says that these\n    // overloads are visible in either the std namespace or the global\n    // namespace, but not other namespaces, including the testing\n    // namespace which Google Test's Message class is in.\n    //\n    // To allow STL containers (and other types that has a << operator\n    // defined in the global namespace) to be used in Google Test\n    // assertions, testing::Message must access the custom << operator\n    // from the global namespace.  With this using declaration,\n    // overloads of << defined in the global namespace and those\n    // visible via Koenig lookup are both exposed in this function.\n    using ::operator <<;\n    *ss_ << val;\n    return *this;\n  }\n\n  // Streams a pointer value to this object.\n  //\n  // This function is an overload of the previous one.  When you\n  // stream a pointer to a Message, this definition will be used as it\n  // is more specialized.  (The C++ Standard, section\n  // [temp.func.order].)  If you stream a non-pointer, then the\n  // previous definition will be used.\n  //\n  // The reason for this overload is that streaming a NULL pointer to\n  // ostream is undefined behavior.  Depending on the compiler, you\n  // may get \"0\", \"(nil)\", \"(null)\", or an access violation.  To\n  // ensure consistent result across compilers, we always treat NULL\n  // as \"(null)\".\n  template <typename T>\n  inline Message& operator <<(T* const& pointer) {  // NOLINT\n    if (pointer == NULL) {\n      *ss_ << \"(null)\";\n    } else {\n      *ss_ << pointer;\n    }\n    return *this;\n  }\n#endif  // GTEST_OS_SYMBIAN\n\n  // Since the basic IO manipulators are overloaded for both narrow\n  // and wide streams, we have to provide this specialized definition\n  // of operator <<, even though its body is the same as the\n  // templatized version above.  Without this definition, streaming\n  // endl or other basic IO manipulators to Message will confuse the\n  // compiler.\n  Message& operator <<(BasicNarrowIoManip val) {\n    *ss_ << val;\n    return *this;\n  }\n\n  // Instead of 1/0, we want to see true/false for bool values.\n  Message& operator <<(bool b) {\n    return *this << (b ? \"true\" : \"false\");\n  }\n\n  // These two overloads allow streaming a wide C string to a Message\n  // using the UTF-8 encoding.\n  Message& operator <<(const wchar_t* wide_c_str);\n  Message& operator <<(wchar_t* wide_c_str);\n\n#if GTEST_HAS_STD_WSTRING\n  // Converts the given wide string to a narrow string using the UTF-8\n  // encoding, and streams the result to this Message object.\n  Message& operator <<(const ::std::wstring& wstr);\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\n  // Converts the given wide string to a narrow string using the UTF-8\n  // encoding, and streams the result to this Message object.\n  Message& operator <<(const ::wstring& wstr);\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n  // Gets the text streamed to this object so far as an std::string.\n  // Each '\\0' character in the buffer is replaced with \"\\\\0\".\n  //\n  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n  std::string GetString() const;\n\n private:\n\n#if GTEST_OS_SYMBIAN\n  // These are needed as the Nokia Symbian Compiler cannot decide between\n  // const T& and const T* in a function template. The Nokia compiler _can_\n  // decide between class template specializations for T and T*, so a\n  // tr1::type_traits-like is_pointer works, and we can overload on that.\n  template <typename T>\n  inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {\n    if (pointer == NULL) {\n      *ss_ << \"(null)\";\n    } else {\n      *ss_ << pointer;\n    }\n  }\n  template <typename T>\n  inline void StreamHelper(internal::false_type /*is_pointer*/,\n                           const T& value) {\n    // See the comments in Message& operator <<(const T&) above for why\n    // we need this using statement.\n    using ::operator <<;\n    *ss_ << value;\n  }\n#endif  // GTEST_OS_SYMBIAN\n\n  // We'll hold the text streamed to this object here.\n  const internal::scoped_ptr< ::std::stringstream> ss_;\n\n  // We declare (but don't implement) this to prevent the compiler\n  // from implementing the assignment operator.\n  void operator=(const Message&);\n};\n\n// Streams a Message to an ostream.\ninline std::ostream& operator <<(std::ostream& os, const Message& sb) {\n  return os << sb.GetString();\n}\n\nnamespace internal {\n\n// Converts a streamable value to an std::string.  A NULL pointer is\n// converted to \"(null)\".  When the input value is a ::string,\n// ::std::string, ::wstring, or ::std::wstring object, each NUL\n// character in it is replaced with \"\\\\0\".\ntemplate <typename T>\nstd::string StreamableToString(const T& streamable) {\n  return (Message() << streamable).GetString();\n}\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-param-test.h",
    "content": "// This file was GENERATED by command:\n//     pump.py gtest-param-test.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: vladl@google.com (Vlad Losev)\n//\n// Macros and functions for implementing parameterized tests\n// in Google C++ Testing Framework (Google Test)\n//\n// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n\n\n// Value-parameterized tests allow you to test your code with different\n// parameters without writing multiple copies of the same test.\n//\n// Here is how you use value-parameterized tests:\n\n#if 0\n\n// To write value-parameterized tests, first you should define a fixture\n// class. It is usually derived from testing::TestWithParam<T> (see below for\n// another inheritance scheme that's sometimes useful in more complicated\n// class hierarchies), where the type of your parameter values.\n// TestWithParam<T> is itself derived from testing::Test. T can be any\n// copyable type. If it's a raw pointer, you are responsible for managing the\n// lifespan of the pointed values.\n\nclass FooTest : public ::testing::TestWithParam<const char*> {\n  // You can implement all the usual class fixture members here.\n};\n\n// Then, use the TEST_P macro to define as many parameterized tests\n// for this fixture as you want. The _P suffix is for \"parameterized\"\n// or \"pattern\", whichever you prefer to think.\n\nTEST_P(FooTest, DoesBlah) {\n  // Inside a test, access the test parameter with the GetParam() method\n  // of the TestWithParam<T> class:\n  EXPECT_TRUE(foo.Blah(GetParam()));\n  ...\n}\n\nTEST_P(FooTest, HasBlahBlah) {\n  ...\n}\n\n// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test\n// case with any set of parameters you want. Google Test defines a number\n// of functions for generating test parameters. They return what we call\n// (surprise!) parameter generators. Here is a  summary of them, which\n// are all in the testing namespace:\n//\n//\n//  Range(begin, end [, step]) - Yields values {begin, begin+step,\n//                               begin+step+step, ...}. The values do not\n//                               include end. step defaults to 1.\n//  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.\n//  ValuesIn(container)        - Yields values from a C-style array, an STL\n//  ValuesIn(begin,end)          container, or an iterator range [begin, end).\n//  Bool()                     - Yields sequence {false, true}.\n//  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product\n//                               for the math savvy) of the values generated\n//                               by the N generators.\n//\n// For more details, see comments at the definitions of these functions below\n// in this file.\n//\n// The following statement will instantiate tests from the FooTest test case\n// each with parameter values \"meeny\", \"miny\", and \"moe\".\n\nINSTANTIATE_TEST_CASE_P(InstantiationName,\n                        FooTest,\n                        Values(\"meeny\", \"miny\", \"moe\"));\n\n// To distinguish different instances of the pattern, (yes, you\n// can instantiate it more then once) the first argument to the\n// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the\n// actual test case name. Remember to pick unique prefixes for different\n// instantiations. The tests from the instantiation above will have\n// these names:\n//\n//    * InstantiationName/FooTest.DoesBlah/0 for \"meeny\"\n//    * InstantiationName/FooTest.DoesBlah/1 for \"miny\"\n//    * InstantiationName/FooTest.DoesBlah/2 for \"moe\"\n//    * InstantiationName/FooTest.HasBlahBlah/0 for \"meeny\"\n//    * InstantiationName/FooTest.HasBlahBlah/1 for \"miny\"\n//    * InstantiationName/FooTest.HasBlahBlah/2 for \"moe\"\n//\n// You can use these names in --gtest_filter.\n//\n// This statement will instantiate all tests from FooTest again, each\n// with parameter values \"cat\" and \"dog\":\n\nconst char* pets[] = {\"cat\", \"dog\"};\nINSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));\n\n// The tests from the instantiation above will have these names:\n//\n//    * AnotherInstantiationName/FooTest.DoesBlah/0 for \"cat\"\n//    * AnotherInstantiationName/FooTest.DoesBlah/1 for \"dog\"\n//    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for \"cat\"\n//    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for \"dog\"\n//\n// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests\n// in the given test case, whether their definitions come before or\n// AFTER the INSTANTIATE_TEST_CASE_P statement.\n//\n// Please also note that generator expressions (including parameters to the\n// generators) are evaluated in InitGoogleTest(), after main() has started.\n// This allows the user on one hand, to adjust generator parameters in order\n// to dynamically determine a set of tests to run and on the other hand,\n// give the user a chance to inspect the generated tests with Google Test\n// reflection API before RUN_ALL_TESTS() is executed.\n//\n// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc\n// for more examples.\n//\n// In the future, we plan to publish the API for defining new parameter\n// generators. But for now this interface remains part of the internal\n// implementation and is subject to change.\n//\n//\n// A parameterized test fixture must be derived from testing::Test and from\n// testing::WithParamInterface<T>, where T is the type of the parameter\n// values. Inheriting from TestWithParam<T> satisfies that requirement because\n// TestWithParam<T> inherits from both Test and WithParamInterface. In more\n// complicated hierarchies, however, it is occasionally useful to inherit\n// separately from Test and WithParamInterface. For example:\n\nclass BaseTest : public ::testing::Test {\n  // You can inherit all the usual members for a non-parameterized test\n  // fixture here.\n};\n\nclass DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {\n  // The usual test fixture members go here too.\n};\n\nTEST_F(BaseTest, HasFoo) {\n  // This is an ordinary non-parameterized test.\n}\n\nTEST_P(DerivedTest, DoesBlah) {\n  // GetParam works just the same here as if you inherit from TestWithParam.\n  EXPECT_TRUE(foo.Blah(GetParam()));\n}\n\n#endif  // 0\n\n#include \"gtest/internal/gtest-port.h\"\n\n#if !GTEST_OS_SYMBIAN\n# include <utility>\n#endif\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n#include \"gtest/internal/gtest-internal.h\"\n#include \"gtest/internal/gtest-param-util.h\"\n#include \"gtest/internal/gtest-param-util-generated.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\n\n// Functions producing parameter generators.\n//\n// Google Test uses these generators to produce parameters for value-\n// parameterized tests. When a parameterized test case is instantiated\n// with a particular generator, Google Test creates and runs tests\n// for each element in the sequence produced by the generator.\n//\n// In the following sample, tests from test case FooTest are instantiated\n// each three times with parameter values 3, 5, and 8:\n//\n// class FooTest : public TestWithParam<int> { ... };\n//\n// TEST_P(FooTest, TestThis) {\n// }\n// TEST_P(FooTest, TestThat) {\n// }\n// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));\n//\n\n// Range() returns generators providing sequences of values in a range.\n//\n// Synopsis:\n// Range(start, end)\n//   - returns a generator producing a sequence of values {start, start+1,\n//     start+2, ..., }.\n// Range(start, end, step)\n//   - returns a generator producing a sequence of values {start, start+step,\n//     start+step+step, ..., }.\n// Notes:\n//   * The generated sequences never include end. For example, Range(1, 5)\n//     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)\n//     returns a generator producing {1, 3, 5, 7}.\n//   * start and end must have the same type. That type may be any integral or\n//     floating-point type or a user defined type satisfying these conditions:\n//     * It must be assignable (have operator=() defined).\n//     * It must have operator+() (operator+(int-compatible type) for\n//       two-operand version).\n//     * It must have operator<() defined.\n//     Elements in the resulting sequences will also have that type.\n//   * Condition start < end must be satisfied in order for resulting sequences\n//     to contain any elements.\n//\ntemplate <typename T, typename IncrementT>\ninternal::ParamGenerator<T> Range(T start, T end, IncrementT step) {\n  return internal::ParamGenerator<T>(\n      new internal::RangeGenerator<T, IncrementT>(start, end, step));\n}\n\ntemplate <typename T>\ninternal::ParamGenerator<T> Range(T start, T end) {\n  return Range(start, end, 1);\n}\n\n// ValuesIn() function allows generation of tests with parameters coming from\n// a container.\n//\n// Synopsis:\n// ValuesIn(const T (&array)[N])\n//   - returns a generator producing sequences with elements from\n//     a C-style array.\n// ValuesIn(const Container& container)\n//   - returns a generator producing sequences with elements from\n//     an STL-style container.\n// ValuesIn(Iterator begin, Iterator end)\n//   - returns a generator producing sequences with elements from\n//     a range [begin, end) defined by a pair of STL-style iterators. These\n//     iterators can also be plain C pointers.\n//\n// Please note that ValuesIn copies the values from the containers\n// passed in and keeps them to generate tests in RUN_ALL_TESTS().\n//\n// Examples:\n//\n// This instantiates tests from test case StringTest\n// each with C-string values of \"foo\", \"bar\", and \"baz\":\n//\n// const char* strings[] = {\"foo\", \"bar\", \"baz\"};\n// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));\n//\n// This instantiates tests from test case StlStringTest\n// each with STL strings with values \"a\" and \"b\":\n//\n// ::std::vector< ::std::string> GetParameterStrings() {\n//   ::std::vector< ::std::string> v;\n//   v.push_back(\"a\");\n//   v.push_back(\"b\");\n//   return v;\n// }\n//\n// INSTANTIATE_TEST_CASE_P(CharSequence,\n//                         StlStringTest,\n//                         ValuesIn(GetParameterStrings()));\n//\n//\n// This will also instantiate tests from CharTest\n// each with parameter values 'a' and 'b':\n//\n// ::std::list<char> GetParameterChars() {\n//   ::std::list<char> list;\n//   list.push_back('a');\n//   list.push_back('b');\n//   return list;\n// }\n// ::std::list<char> l = GetParameterChars();\n// INSTANTIATE_TEST_CASE_P(CharSequence2,\n//                         CharTest,\n//                         ValuesIn(l.begin(), l.end()));\n//\ntemplate <typename ForwardIterator>\ninternal::ParamGenerator<\n  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>\nValuesIn(ForwardIterator begin, ForwardIterator end) {\n  typedef typename ::testing::internal::IteratorTraits<ForwardIterator>\n      ::value_type ParamType;\n  return internal::ParamGenerator<ParamType>(\n      new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));\n}\n\ntemplate <typename T, size_t N>\ninternal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {\n  return ValuesIn(array, array + N);\n}\n\ntemplate <class Container>\ninternal::ParamGenerator<typename Container::value_type> ValuesIn(\n    const Container& container) {\n  return ValuesIn(container.begin(), container.end());\n}\n\n// Values() allows generating tests from explicitly specified list of\n// parameters.\n//\n// Synopsis:\n// Values(T v1, T v2, ..., T vN)\n//   - returns a generator producing sequences with elements v1, v2, ..., vN.\n//\n// For example, this instantiates tests from test case BarTest each\n// with values \"one\", \"two\", and \"three\":\n//\n// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values(\"one\", \"two\", \"three\"));\n//\n// This instantiates tests from test case BazTest each with values 1, 2, 3.5.\n// The exact type of values will depend on the type of parameter in BazTest.\n//\n// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));\n//\n// Currently, Values() supports from 1 to 50 parameters.\n//\ntemplate <typename T1>\ninternal::ValueArray1<T1> Values(T1 v1) {\n  return internal::ValueArray1<T1>(v1);\n}\n\ntemplate <typename T1, typename T2>\ninternal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {\n  return internal::ValueArray2<T1, T2>(v1, v2);\n}\n\ntemplate <typename T1, typename T2, typename T3>\ninternal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {\n  return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\ninternal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {\n  return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\ninternal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5) {\n  return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\ninternal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6) {\n  return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\ninternal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6, T7 v7) {\n  return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,\n      v6, v7);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\ninternal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {\n  return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,\n      v5, v6, v7, v8);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\ninternal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {\n  return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,\n      v4, v5, v6, v7, v8, v9);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\ninternal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,\n    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {\n  return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,\n      v2, v3, v4, v5, v6, v7, v8, v9, v10);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\ninternal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,\n    T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11) {\n  return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,\n      T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\ninternal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n    T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12) {\n  return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\ninternal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n    T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13) {\n  return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\ninternal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {\n  return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,\n      v14);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\ninternal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {\n  return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,\n      v13, v14, v15);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\ninternal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16) {\n  return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,\n      v12, v13, v14, v15, v16);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\ninternal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17) {\n  return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,\n      v11, v12, v13, v14, v15, v16, v17);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\ninternal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,\n    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18) {\n  return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,\n      v10, v11, v12, v13, v14, v15, v16, v17, v18);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\ninternal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,\n    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,\n    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {\n  return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,\n      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\ninternal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {\n  return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,\n      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\ninternal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {\n  return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,\n      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\ninternal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22) {\n  return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,\n      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\ninternal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23) {\n  return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,\n      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\ninternal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24) {\n  return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,\n      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,\n      v19, v20, v21, v22, v23, v24);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\ninternal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,\n    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,\n    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,\n    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {\n  return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,\n      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,\n      v18, v19, v20, v21, v22, v23, v24, v25);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\ninternal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n    T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26) {\n  return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,\n      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\ninternal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n    T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27) {\n  return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,\n      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\ninternal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n    T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28) {\n  return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,\n      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,\n      v28);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\ninternal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29) {\n  return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,\n      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,\n      v27, v28, v29);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\ninternal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,\n    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,\n    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {\n  return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,\n      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,\n      v26, v27, v28, v29, v30);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\ninternal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {\n  return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,\n      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,\n      v25, v26, v27, v28, v29, v30, v31);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\ninternal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32) {\n  return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,\n      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\ninternal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,\n    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33) {\n  return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,\n      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\ninternal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,\n    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,\n    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,\n    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,\n    T31 v31, T32 v32, T33 v33, T34 v34) {\n  return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,\n      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,\n      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\ninternal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,\n    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,\n    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {\n  return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,\n      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,\n      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\ninternal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,\n    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,\n    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {\n  return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,\n      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,\n      v34, v35, v36);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\ninternal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,\n    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,\n    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,\n    T37 v37) {\n  return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,\n      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,\n      v34, v35, v36, v37);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\ninternal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,\n    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,\n    T37 v37, T38 v38) {\n  return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,\n      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,\n      v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,\n      v33, v34, v35, v36, v37, v38);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\ninternal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,\n    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,\n    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,\n    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,\n    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,\n    T37 v37, T38 v38, T39 v39) {\n  return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,\n      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,\n      v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,\n      v32, v33, v34, v35, v36, v37, v38, v39);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\ninternal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,\n    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,\n    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,\n    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,\n    T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,\n    T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {\n  return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,\n      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,\n      v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\ninternal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n    T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {\n  return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,\n      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,\n      v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\ninternal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n    T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n    T42 v42) {\n  return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,\n      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,\n      v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,\n      v42);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\ninternal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n    T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n    T42 v42, T43 v43) {\n  return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,\n      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,\n      v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,\n      v41, v42, v43);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\ninternal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n    T42 v42, T43 v43, T44 v44) {\n  return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,\n      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,\n      v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,\n      v40, v41, v42, v43, v44);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\ninternal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,\n    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,\n    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,\n    T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,\n    T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {\n  return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,\n      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,\n      v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,\n      v39, v40, v41, v42, v43, v44, v45);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\ninternal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,\n    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {\n  return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,\n      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,\n      v38, v39, v40, v41, v42, v43, v44, v45, v46);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\ninternal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,\n    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {\n  return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,\n      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,\n      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,\n      v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\ninternal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,\n    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,\n    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,\n    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,\n    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,\n    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,\n    T48 v48) {\n  return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,\n      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,\n      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,\n      v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\ninternal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,\n    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,\n    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,\n    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,\n    T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,\n    T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,\n    T47 v47, T48 v48, T49 v49) {\n  return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,\n      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,\n      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,\n      v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\ninternal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,\n    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,\n    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,\n    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,\n    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,\n    T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,\n    T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {\n  return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,\n      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,\n      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,\n      v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,\n      v48, v49, v50);\n}\n\n// Bool() allows generating tests with parameters in a set of (false, true).\n//\n// Synopsis:\n// Bool()\n//   - returns a generator producing sequences with elements {false, true}.\n//\n// It is useful when testing code that depends on Boolean flags. Combinations\n// of multiple flags can be tested when several Bool()'s are combined using\n// Combine() function.\n//\n// In the following example all tests in the test case FlagDependentTest\n// will be instantiated twice with parameters false and true.\n//\n// class FlagDependentTest : public testing::TestWithParam<bool> {\n//   virtual void SetUp() {\n//     external_flag = GetParam();\n//   }\n// }\n// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());\n//\ninline internal::ParamGenerator<bool> Bool() {\n  return Values(false, true);\n}\n\n# if GTEST_HAS_COMBINE\n// Combine() allows the user to combine two or more sequences to produce\n// values of a Cartesian product of those sequences' elements.\n//\n// Synopsis:\n// Combine(gen1, gen2, ..., genN)\n//   - returns a generator producing sequences with elements coming from\n//     the Cartesian product of elements from the sequences generated by\n//     gen1, gen2, ..., genN. The sequence elements will have a type of\n//     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types\n//     of elements from sequences produces by gen1, gen2, ..., genN.\n//\n// Combine can have up to 10 arguments. This number is currently limited\n// by the maximum number of elements in the tuple implementation used by Google\n// Test.\n//\n// Example:\n//\n// This will instantiate tests in test case AnimalTest each one with\n// the parameter values tuple(\"cat\", BLACK), tuple(\"cat\", WHITE),\n// tuple(\"dog\", BLACK), and tuple(\"dog\", WHITE):\n//\n// enum Color { BLACK, GRAY, WHITE };\n// class AnimalTest\n//     : public testing::TestWithParam<tuple<const char*, Color> > {...};\n//\n// TEST_P(AnimalTest, AnimalLooksNice) {...}\n//\n// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,\n//                         Combine(Values(\"cat\", \"dog\"),\n//                                 Values(BLACK, WHITE)));\n//\n// This will instantiate tests in FlagDependentTest with all variations of two\n// Boolean flags:\n//\n// class FlagDependentTest\n//     : public testing::TestWithParam<tuple<bool, bool> > {\n//   virtual void SetUp() {\n//     // Assigns external_flag_1 and external_flag_2 values from the tuple.\n//     tie(external_flag_1, external_flag_2) = GetParam();\n//   }\n// };\n//\n// TEST_P(FlagDependentTest, TestFeature1) {\n//   // Test your code using external_flag_1 and external_flag_2 here.\n// }\n// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,\n//                         Combine(Bool(), Bool()));\n//\ntemplate <typename Generator1, typename Generator2>\ninternal::CartesianProductHolder2<Generator1, Generator2> Combine(\n    const Generator1& g1, const Generator2& g2) {\n  return internal::CartesianProductHolder2<Generator1, Generator2>(\n      g1, g2);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3>\ninternal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3) {\n  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(\n      g1, g2, g3);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4>\ninternal::CartesianProductHolder4<Generator1, Generator2, Generator3,\n    Generator4> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4) {\n  return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,\n      Generator4>(\n      g1, g2, g3, g4);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5>\ninternal::CartesianProductHolder5<Generator1, Generator2, Generator3,\n    Generator4, Generator5> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5) {\n  return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,\n      Generator4, Generator5>(\n      g1, g2, g3, g4, g5);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6>\ninternal::CartesianProductHolder6<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6) {\n  return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6>(\n      g1, g2, g3, g4, g5, g6);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7>\ninternal::CartesianProductHolder7<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7) {\n  return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7>(\n      g1, g2, g3, g4, g5, g6, g7);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7, typename Generator8>\ninternal::CartesianProductHolder8<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7, Generator8> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7, const Generator8& g8) {\n  return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7, Generator8>(\n      g1, g2, g3, g4, g5, g6, g7, g8);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7, typename Generator8, typename Generator9>\ninternal::CartesianProductHolder9<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7, Generator8,\n    Generator9> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7, const Generator8& g8, const Generator9& g9) {\n  return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(\n      g1, g2, g3, g4, g5, g6, g7, g8, g9);\n}\n\ntemplate <typename Generator1, typename Generator2, typename Generator3,\n    typename Generator4, typename Generator5, typename Generator6,\n    typename Generator7, typename Generator8, typename Generator9,\n    typename Generator10>\ninternal::CartesianProductHolder10<Generator1, Generator2, Generator3,\n    Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,\n    Generator10> Combine(\n    const Generator1& g1, const Generator2& g2, const Generator3& g3,\n        const Generator4& g4, const Generator5& g5, const Generator6& g6,\n        const Generator7& g7, const Generator8& g8, const Generator9& g9,\n        const Generator10& g10) {\n  return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,\n      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,\n      Generator10>(\n      g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);\n}\n# endif  // GTEST_HAS_COMBINE\n\n\n\n# define TEST_P(test_case_name, test_name) \\\n  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \\\n      : public test_case_name { \\\n   public: \\\n    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \\\n    virtual void TestBody(); \\\n   private: \\\n    static int AddToRegistry() { \\\n      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \\\n          GetTestCasePatternHolder<test_case_name>(\\\n              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\\\n                  #test_case_name, \\\n                  #test_name, \\\n                  new ::testing::internal::TestMetaFactory< \\\n                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \\\n      return 0; \\\n    } \\\n    static int gtest_registering_dummy_; \\\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(\\\n        GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \\\n  }; \\\n  int GTEST_TEST_CLASS_NAME_(test_case_name, \\\n                             test_name)::gtest_registering_dummy_ = \\\n      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \\\n  void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\n\n# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \\\n  ::testing::internal::ParamGenerator<test_case_name::ParamType> \\\n      gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \\\n  int gtest_##prefix##test_case_name##_dummy_ = \\\n      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \\\n          GetTestCasePatternHolder<test_case_name>(\\\n              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\\\n                  #prefix, \\\n                  &gtest_##prefix##test_case_name##_EvalGenerator_, \\\n                  __FILE__, __LINE__)\n\n}  // namespace testing\n\n#endif  // GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-param-test.h.pump",
    "content": "$$ -*- mode: c++; -*-\n$var n = 50  $$ Maximum length of Values arguments we want to support.\n$var maxtuple = 10  $$ Maximum number of Combine arguments we want to support.\n// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: vladl@google.com (Vlad Losev)\n//\n// Macros and functions for implementing parameterized tests\n// in Google C++ Testing Framework (Google Test)\n//\n// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n\n\n// Value-parameterized tests allow you to test your code with different\n// parameters without writing multiple copies of the same test.\n//\n// Here is how you use value-parameterized tests:\n\n#if 0\n\n// To write value-parameterized tests, first you should define a fixture\n// class. It is usually derived from testing::TestWithParam<T> (see below for\n// another inheritance scheme that's sometimes useful in more complicated\n// class hierarchies), where the type of your parameter values.\n// TestWithParam<T> is itself derived from testing::Test. T can be any\n// copyable type. If it's a raw pointer, you are responsible for managing the\n// lifespan of the pointed values.\n\nclass FooTest : public ::testing::TestWithParam<const char*> {\n  // You can implement all the usual class fixture members here.\n};\n\n// Then, use the TEST_P macro to define as many parameterized tests\n// for this fixture as you want. The _P suffix is for \"parameterized\"\n// or \"pattern\", whichever you prefer to think.\n\nTEST_P(FooTest, DoesBlah) {\n  // Inside a test, access the test parameter with the GetParam() method\n  // of the TestWithParam<T> class:\n  EXPECT_TRUE(foo.Blah(GetParam()));\n  ...\n}\n\nTEST_P(FooTest, HasBlahBlah) {\n  ...\n}\n\n// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test\n// case with any set of parameters you want. Google Test defines a number\n// of functions for generating test parameters. They return what we call\n// (surprise!) parameter generators. Here is a  summary of them, which\n// are all in the testing namespace:\n//\n//\n//  Range(begin, end [, step]) - Yields values {begin, begin+step,\n//                               begin+step+step, ...}. The values do not\n//                               include end. step defaults to 1.\n//  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.\n//  ValuesIn(container)        - Yields values from a C-style array, an STL\n//  ValuesIn(begin,end)          container, or an iterator range [begin, end).\n//  Bool()                     - Yields sequence {false, true}.\n//  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product\n//                               for the math savvy) of the values generated\n//                               by the N generators.\n//\n// For more details, see comments at the definitions of these functions below\n// in this file.\n//\n// The following statement will instantiate tests from the FooTest test case\n// each with parameter values \"meeny\", \"miny\", and \"moe\".\n\nINSTANTIATE_TEST_CASE_P(InstantiationName,\n                        FooTest,\n                        Values(\"meeny\", \"miny\", \"moe\"));\n\n// To distinguish different instances of the pattern, (yes, you\n// can instantiate it more then once) the first argument to the\n// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the\n// actual test case name. Remember to pick unique prefixes for different\n// instantiations. The tests from the instantiation above will have\n// these names:\n//\n//    * InstantiationName/FooTest.DoesBlah/0 for \"meeny\"\n//    * InstantiationName/FooTest.DoesBlah/1 for \"miny\"\n//    * InstantiationName/FooTest.DoesBlah/2 for \"moe\"\n//    * InstantiationName/FooTest.HasBlahBlah/0 for \"meeny\"\n//    * InstantiationName/FooTest.HasBlahBlah/1 for \"miny\"\n//    * InstantiationName/FooTest.HasBlahBlah/2 for \"moe\"\n//\n// You can use these names in --gtest_filter.\n//\n// This statement will instantiate all tests from FooTest again, each\n// with parameter values \"cat\" and \"dog\":\n\nconst char* pets[] = {\"cat\", \"dog\"};\nINSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));\n\n// The tests from the instantiation above will have these names:\n//\n//    * AnotherInstantiationName/FooTest.DoesBlah/0 for \"cat\"\n//    * AnotherInstantiationName/FooTest.DoesBlah/1 for \"dog\"\n//    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for \"cat\"\n//    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for \"dog\"\n//\n// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests\n// in the given test case, whether their definitions come before or\n// AFTER the INSTANTIATE_TEST_CASE_P statement.\n//\n// Please also note that generator expressions (including parameters to the\n// generators) are evaluated in InitGoogleTest(), after main() has started.\n// This allows the user on one hand, to adjust generator parameters in order\n// to dynamically determine a set of tests to run and on the other hand,\n// give the user a chance to inspect the generated tests with Google Test\n// reflection API before RUN_ALL_TESTS() is executed.\n//\n// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc\n// for more examples.\n//\n// In the future, we plan to publish the API for defining new parameter\n// generators. But for now this interface remains part of the internal\n// implementation and is subject to change.\n//\n//\n// A parameterized test fixture must be derived from testing::Test and from\n// testing::WithParamInterface<T>, where T is the type of the parameter\n// values. Inheriting from TestWithParam<T> satisfies that requirement because\n// TestWithParam<T> inherits from both Test and WithParamInterface. In more\n// complicated hierarchies, however, it is occasionally useful to inherit\n// separately from Test and WithParamInterface. For example:\n\nclass BaseTest : public ::testing::Test {\n  // You can inherit all the usual members for a non-parameterized test\n  // fixture here.\n};\n\nclass DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {\n  // The usual test fixture members go here too.\n};\n\nTEST_F(BaseTest, HasFoo) {\n  // This is an ordinary non-parameterized test.\n}\n\nTEST_P(DerivedTest, DoesBlah) {\n  // GetParam works just the same here as if you inherit from TestWithParam.\n  EXPECT_TRUE(foo.Blah(GetParam()));\n}\n\n#endif  // 0\n\n#include \"gtest/internal/gtest-port.h\"\n\n#if !GTEST_OS_SYMBIAN\n# include <utility>\n#endif\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n#include \"gtest/internal/gtest-internal.h\"\n#include \"gtest/internal/gtest-param-util.h\"\n#include \"gtest/internal/gtest-param-util-generated.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\n\n// Functions producing parameter generators.\n//\n// Google Test uses these generators to produce parameters for value-\n// parameterized tests. When a parameterized test case is instantiated\n// with a particular generator, Google Test creates and runs tests\n// for each element in the sequence produced by the generator.\n//\n// In the following sample, tests from test case FooTest are instantiated\n// each three times with parameter values 3, 5, and 8:\n//\n// class FooTest : public TestWithParam<int> { ... };\n//\n// TEST_P(FooTest, TestThis) {\n// }\n// TEST_P(FooTest, TestThat) {\n// }\n// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));\n//\n\n// Range() returns generators providing sequences of values in a range.\n//\n// Synopsis:\n// Range(start, end)\n//   - returns a generator producing a sequence of values {start, start+1,\n//     start+2, ..., }.\n// Range(start, end, step)\n//   - returns a generator producing a sequence of values {start, start+step,\n//     start+step+step, ..., }.\n// Notes:\n//   * The generated sequences never include end. For example, Range(1, 5)\n//     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)\n//     returns a generator producing {1, 3, 5, 7}.\n//   * start and end must have the same type. That type may be any integral or\n//     floating-point type or a user defined type satisfying these conditions:\n//     * It must be assignable (have operator=() defined).\n//     * It must have operator+() (operator+(int-compatible type) for\n//       two-operand version).\n//     * It must have operator<() defined.\n//     Elements in the resulting sequences will also have that type.\n//   * Condition start < end must be satisfied in order for resulting sequences\n//     to contain any elements.\n//\ntemplate <typename T, typename IncrementT>\ninternal::ParamGenerator<T> Range(T start, T end, IncrementT step) {\n  return internal::ParamGenerator<T>(\n      new internal::RangeGenerator<T, IncrementT>(start, end, step));\n}\n\ntemplate <typename T>\ninternal::ParamGenerator<T> Range(T start, T end) {\n  return Range(start, end, 1);\n}\n\n// ValuesIn() function allows generation of tests with parameters coming from\n// a container.\n//\n// Synopsis:\n// ValuesIn(const T (&array)[N])\n//   - returns a generator producing sequences with elements from\n//     a C-style array.\n// ValuesIn(const Container& container)\n//   - returns a generator producing sequences with elements from\n//     an STL-style container.\n// ValuesIn(Iterator begin, Iterator end)\n//   - returns a generator producing sequences with elements from\n//     a range [begin, end) defined by a pair of STL-style iterators. These\n//     iterators can also be plain C pointers.\n//\n// Please note that ValuesIn copies the values from the containers\n// passed in and keeps them to generate tests in RUN_ALL_TESTS().\n//\n// Examples:\n//\n// This instantiates tests from test case StringTest\n// each with C-string values of \"foo\", \"bar\", and \"baz\":\n//\n// const char* strings[] = {\"foo\", \"bar\", \"baz\"};\n// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));\n//\n// This instantiates tests from test case StlStringTest\n// each with STL strings with values \"a\" and \"b\":\n//\n// ::std::vector< ::std::string> GetParameterStrings() {\n//   ::std::vector< ::std::string> v;\n//   v.push_back(\"a\");\n//   v.push_back(\"b\");\n//   return v;\n// }\n//\n// INSTANTIATE_TEST_CASE_P(CharSequence,\n//                         StlStringTest,\n//                         ValuesIn(GetParameterStrings()));\n//\n//\n// This will also instantiate tests from CharTest\n// each with parameter values 'a' and 'b':\n//\n// ::std::list<char> GetParameterChars() {\n//   ::std::list<char> list;\n//   list.push_back('a');\n//   list.push_back('b');\n//   return list;\n// }\n// ::std::list<char> l = GetParameterChars();\n// INSTANTIATE_TEST_CASE_P(CharSequence2,\n//                         CharTest,\n//                         ValuesIn(l.begin(), l.end()));\n//\ntemplate <typename ForwardIterator>\ninternal::ParamGenerator<\n  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>\nValuesIn(ForwardIterator begin, ForwardIterator end) {\n  typedef typename ::testing::internal::IteratorTraits<ForwardIterator>\n      ::value_type ParamType;\n  return internal::ParamGenerator<ParamType>(\n      new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));\n}\n\ntemplate <typename T, size_t N>\ninternal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {\n  return ValuesIn(array, array + N);\n}\n\ntemplate <class Container>\ninternal::ParamGenerator<typename Container::value_type> ValuesIn(\n    const Container& container) {\n  return ValuesIn(container.begin(), container.end());\n}\n\n// Values() allows generating tests from explicitly specified list of\n// parameters.\n//\n// Synopsis:\n// Values(T v1, T v2, ..., T vN)\n//   - returns a generator producing sequences with elements v1, v2, ..., vN.\n//\n// For example, this instantiates tests from test case BarTest each\n// with values \"one\", \"two\", and \"three\":\n//\n// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values(\"one\", \"two\", \"three\"));\n//\n// This instantiates tests from test case BazTest each with values 1, 2, 3.5.\n// The exact type of values will depend on the type of parameter in BazTest.\n//\n// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));\n//\n// Currently, Values() supports from 1 to $n parameters.\n//\n$range i 1..n\n$for i [[\n$range j 1..i\n\ntemplate <$for j, [[typename T$j]]>\ninternal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) {\n  return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]);\n}\n\n]]\n\n// Bool() allows generating tests with parameters in a set of (false, true).\n//\n// Synopsis:\n// Bool()\n//   - returns a generator producing sequences with elements {false, true}.\n//\n// It is useful when testing code that depends on Boolean flags. Combinations\n// of multiple flags can be tested when several Bool()'s are combined using\n// Combine() function.\n//\n// In the following example all tests in the test case FlagDependentTest\n// will be instantiated twice with parameters false and true.\n//\n// class FlagDependentTest : public testing::TestWithParam<bool> {\n//   virtual void SetUp() {\n//     external_flag = GetParam();\n//   }\n// }\n// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());\n//\ninline internal::ParamGenerator<bool> Bool() {\n  return Values(false, true);\n}\n\n# if GTEST_HAS_COMBINE\n// Combine() allows the user to combine two or more sequences to produce\n// values of a Cartesian product of those sequences' elements.\n//\n// Synopsis:\n// Combine(gen1, gen2, ..., genN)\n//   - returns a generator producing sequences with elements coming from\n//     the Cartesian product of elements from the sequences generated by\n//     gen1, gen2, ..., genN. The sequence elements will have a type of\n//     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types\n//     of elements from sequences produces by gen1, gen2, ..., genN.\n//\n// Combine can have up to $maxtuple arguments. This number is currently limited\n// by the maximum number of elements in the tuple implementation used by Google\n// Test.\n//\n// Example:\n//\n// This will instantiate tests in test case AnimalTest each one with\n// the parameter values tuple(\"cat\", BLACK), tuple(\"cat\", WHITE),\n// tuple(\"dog\", BLACK), and tuple(\"dog\", WHITE):\n//\n// enum Color { BLACK, GRAY, WHITE };\n// class AnimalTest\n//     : public testing::TestWithParam<tuple<const char*, Color> > {...};\n//\n// TEST_P(AnimalTest, AnimalLooksNice) {...}\n//\n// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,\n//                         Combine(Values(\"cat\", \"dog\"),\n//                                 Values(BLACK, WHITE)));\n//\n// This will instantiate tests in FlagDependentTest with all variations of two\n// Boolean flags:\n//\n// class FlagDependentTest\n//     : public testing::TestWithParam<tuple<bool, bool> > {\n//   virtual void SetUp() {\n//     // Assigns external_flag_1 and external_flag_2 values from the tuple.\n//     tie(external_flag_1, external_flag_2) = GetParam();\n//   }\n// };\n//\n// TEST_P(FlagDependentTest, TestFeature1) {\n//   // Test your code using external_flag_1 and external_flag_2 here.\n// }\n// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,\n//                         Combine(Bool(), Bool()));\n//\n$range i 2..maxtuple\n$for i [[\n$range j 1..i\n\ntemplate <$for j, [[typename Generator$j]]>\ninternal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(\n    $for j, [[const Generator$j& g$j]]) {\n  return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>(\n      $for j, [[g$j]]);\n}\n\n]]\n# endif  // GTEST_HAS_COMBINE\n\n\n\n# define TEST_P(test_case_name, test_name) \\\n  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \\\n      : public test_case_name { \\\n   public: \\\n    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \\\n    virtual void TestBody(); \\\n   private: \\\n    static int AddToRegistry() { \\\n      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \\\n          GetTestCasePatternHolder<test_case_name>(\\\n              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\\\n                  #test_case_name, \\\n                  #test_name, \\\n                  new ::testing::internal::TestMetaFactory< \\\n                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \\\n      return 0; \\\n    } \\\n    static int gtest_registering_dummy_; \\\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(\\\n        GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \\\n  }; \\\n  int GTEST_TEST_CLASS_NAME_(test_case_name, \\\n                             test_name)::gtest_registering_dummy_ = \\\n      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \\\n  void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\n\n# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \\\n  ::testing::internal::ParamGenerator<test_case_name::ParamType> \\\n      gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \\\n  int gtest_##prefix##test_case_name##_dummy_ = \\\n      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \\\n          GetTestCasePatternHolder<test_case_name>(\\\n              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\\\n                  #prefix, \\\n                  &gtest_##prefix##test_case_name##_EvalGenerator_, \\\n                  __FILE__, __LINE__)\n\n}  // namespace testing\n\n#endif  // GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-printers.h",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Google Test - The Google C++ Testing Framework\n//\n// This file implements a universal value printer that can print a\n// value of any type T:\n//\n//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);\n//\n// A user can teach this function how to print a class type T by\n// defining either operator<<() or PrintTo() in the namespace that\n// defines T.  More specifically, the FIRST defined function in the\n// following list will be used (assuming T is defined in namespace\n// foo):\n//\n//   1. foo::PrintTo(const T&, ostream*)\n//   2. operator<<(ostream&, const T&) defined in either foo or the\n//      global namespace.\n//\n// If none of the above is defined, it will print the debug string of\n// the value if it is a protocol buffer, or print the raw bytes in the\n// value otherwise.\n//\n// To aid debugging: when T is a reference type, the address of the\n// value is also printed; when T is a (const) char pointer, both the\n// pointer value and the NUL-terminated string it points to are\n// printed.\n//\n// We also provide some convenient wrappers:\n//\n//   // Prints a value to a string.  For a (const or not) char\n//   // pointer, the NUL-terminated string (but not the pointer) is\n//   // printed.\n//   std::string ::testing::PrintToString(const T& value);\n//\n//   // Prints a value tersely: for a reference type, the referenced\n//   // value (but not the address) is printed; for a (const or not) char\n//   // pointer, the NUL-terminated string (but not the pointer) is\n//   // printed.\n//   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);\n//\n//   // Prints value using the type inferred by the compiler.  The difference\n//   // from UniversalTersePrint() is that this function prints both the\n//   // pointer and the NUL-terminated string for a (const or not) char pointer.\n//   void ::testing::internal::UniversalPrint(const T& value, ostream*);\n//\n//   // Prints the fields of a tuple tersely to a string vector, one\n//   // element for each field. Tuple support must be enabled in\n//   // gtest-port.h.\n//   std::vector<string> UniversalTersePrintTupleFieldsToStrings(\n//       const Tuple& value);\n//\n// Known limitation:\n//\n// The print primitives print the elements of an STL-style container\n// using the compiler-inferred type of *iter where iter is a\n// const_iterator of the container.  When const_iterator is an input\n// iterator but not a forward iterator, this inferred type may not\n// match value_type, and the print output may be incorrect.  In\n// practice, this is rarely a problem as for most containers\n// const_iterator is a forward iterator.  We'll fix this if there's an\n// actual need for it.  Note that this fix cannot rely on value_type\n// being defined as many user-defined container types don't have\n// value_type.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_\n\n#include <ostream>  // NOLINT\n#include <sstream>\n#include <string>\n#include <utility>\n#include <vector>\n#include \"gtest/internal/gtest-port.h\"\n#include \"gtest/internal/gtest-internal.h\"\n\nnamespace testing {\n\n// Definitions in the 'internal' and 'internal2' name spaces are\n// subject to change without notice.  DO NOT USE THEM IN USER CODE!\nnamespace internal2 {\n\n// Prints the given number of bytes in the given object to the given\n// ostream.\nGTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,\n                                     size_t count,\n                                     ::std::ostream* os);\n\n// For selecting which printer to use when a given type has neither <<\n// nor PrintTo().\nenum TypeKind {\n  kProtobuf,              // a protobuf type\n  kConvertibleToInteger,  // a type implicitly convertible to BiggestInt\n                          // (e.g. a named or unnamed enum type)\n  kOtherType              // anything else\n};\n\n// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called\n// by the universal printer to print a value of type T when neither\n// operator<< nor PrintTo() is defined for T, where kTypeKind is the\n// \"kind\" of T as defined by enum TypeKind.\ntemplate <typename T, TypeKind kTypeKind>\nclass TypeWithoutFormatter {\n public:\n  // This default version is called when kTypeKind is kOtherType.\n  static void PrintValue(const T& value, ::std::ostream* os) {\n    PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),\n                         sizeof(value), os);\n  }\n};\n\n// We print a protobuf using its ShortDebugString() when the string\n// doesn't exceed this many characters; otherwise we print it using\n// DebugString() for better readability.\nconst size_t kProtobufOneLinerMaxLength = 50;\n\ntemplate <typename T>\nclass TypeWithoutFormatter<T, kProtobuf> {\n public:\n  static void PrintValue(const T& value, ::std::ostream* os) {\n    const ::testing::internal::string short_str = value.ShortDebugString();\n    const ::testing::internal::string pretty_str =\n        short_str.length() <= kProtobufOneLinerMaxLength ?\n        short_str : (\"\\n\" + value.DebugString());\n    *os << (\"<\" + pretty_str + \">\");\n  }\n};\n\ntemplate <typename T>\nclass TypeWithoutFormatter<T, kConvertibleToInteger> {\n public:\n  // Since T has no << operator or PrintTo() but can be implicitly\n  // converted to BiggestInt, we print it as a BiggestInt.\n  //\n  // Most likely T is an enum type (either named or unnamed), in which\n  // case printing it as an integer is the desired behavior.  In case\n  // T is not an enum, printing it as an integer is the best we can do\n  // given that it has no user-defined printer.\n  static void PrintValue(const T& value, ::std::ostream* os) {\n    const internal::BiggestInt kBigInt = value;\n    *os << kBigInt;\n  }\n};\n\n// Prints the given value to the given ostream.  If the value is a\n// protocol message, its debug string is printed; if it's an enum or\n// of a type implicitly convertible to BiggestInt, it's printed as an\n// integer; otherwise the bytes in the value are printed.  This is\n// what UniversalPrinter<T>::Print() does when it knows nothing about\n// type T and T has neither << operator nor PrintTo().\n//\n// A user can override this behavior for a class type Foo by defining\n// a << operator in the namespace where Foo is defined.\n//\n// We put this operator in namespace 'internal2' instead of 'internal'\n// to simplify the implementation, as much code in 'internal' needs to\n// use << in STL, which would conflict with our own << were it defined\n// in 'internal'.\n//\n// Note that this operator<< takes a generic std::basic_ostream<Char,\n// CharTraits> type instead of the more restricted std::ostream.  If\n// we define it to take an std::ostream instead, we'll get an\n// \"ambiguous overloads\" compiler error when trying to print a type\n// Foo that supports streaming to std::basic_ostream<Char,\n// CharTraits>, as the compiler cannot tell whether\n// operator<<(std::ostream&, const T&) or\n// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more\n// specific.\ntemplate <typename Char, typename CharTraits, typename T>\n::std::basic_ostream<Char, CharTraits>& operator<<(\n    ::std::basic_ostream<Char, CharTraits>& os, const T& x) {\n  TypeWithoutFormatter<T,\n      (internal::IsAProtocolMessage<T>::value ? kProtobuf :\n       internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?\n       kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);\n  return os;\n}\n\n}  // namespace internal2\n}  // namespace testing\n\n// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up\n// magic needed for implementing UniversalPrinter won't work.\nnamespace testing_internal {\n\n// Used to print a value that is not an STL-style container when the\n// user doesn't define PrintTo() for it.\ntemplate <typename T>\nvoid DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {\n  // With the following statement, during unqualified name lookup,\n  // testing::internal2::operator<< appears as if it was declared in\n  // the nearest enclosing namespace that contains both\n  // ::testing_internal and ::testing::internal2, i.e. the global\n  // namespace.  For more details, refer to the C++ Standard section\n  // 7.3.4-1 [namespace.udir].  This allows us to fall back onto\n  // testing::internal2::operator<< in case T doesn't come with a <<\n  // operator.\n  //\n  // We cannot write 'using ::testing::internal2::operator<<;', which\n  // gcc 3.3 fails to compile due to a compiler bug.\n  using namespace ::testing::internal2;  // NOLINT\n\n  // Assuming T is defined in namespace foo, in the next statement,\n  // the compiler will consider all of:\n  //\n  //   1. foo::operator<< (thanks to Koenig look-up),\n  //   2. ::operator<< (as the current namespace is enclosed in ::),\n  //   3. testing::internal2::operator<< (thanks to the using statement above).\n  //\n  // The operator<< whose type matches T best will be picked.\n  //\n  // We deliberately allow #2 to be a candidate, as sometimes it's\n  // impossible to define #1 (e.g. when foo is ::std, defining\n  // anything in it is undefined behavior unless you are a compiler\n  // vendor.).\n  *os << value;\n}\n\n}  // namespace testing_internal\n\nnamespace testing {\nnamespace internal {\n\n// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given\n// value to the given ostream.  The caller must ensure that\n// 'ostream_ptr' is not NULL, or the behavior is undefined.\n//\n// We define UniversalPrinter as a class template (as opposed to a\n// function template), as we need to partially specialize it for\n// reference types, which cannot be done with function templates.\ntemplate <typename T>\nclass UniversalPrinter;\n\ntemplate <typename T>\nvoid UniversalPrint(const T& value, ::std::ostream* os);\n\n// Used to print an STL-style container when the user doesn't define\n// a PrintTo() for it.\ntemplate <typename C>\nvoid DefaultPrintTo(IsContainer /* dummy */,\n                    false_type /* is not a pointer */,\n                    const C& container, ::std::ostream* os) {\n  const size_t kMaxCount = 32;  // The maximum number of elements to print.\n  *os << '{';\n  size_t count = 0;\n  for (typename C::const_iterator it = container.begin();\n       it != container.end(); ++it, ++count) {\n    if (count > 0) {\n      *os << ',';\n      if (count == kMaxCount) {  // Enough has been printed.\n        *os << \" ...\";\n        break;\n      }\n    }\n    *os << ' ';\n    // We cannot call PrintTo(*it, os) here as PrintTo() doesn't\n    // handle *it being a native array.\n    internal::UniversalPrint(*it, os);\n  }\n\n  if (count > 0) {\n    *os << ' ';\n  }\n  *os << '}';\n}\n\n// Used to print a pointer that is neither a char pointer nor a member\n// pointer, when the user doesn't define PrintTo() for it.  (A member\n// variable pointer or member function pointer doesn't really point to\n// a location in the address space.  Their representation is\n// implementation-defined.  Therefore they will be printed as raw\n// bytes.)\ntemplate <typename T>\nvoid DefaultPrintTo(IsNotContainer /* dummy */,\n                    true_type /* is a pointer */,\n                    T* p, ::std::ostream* os) {\n  if (p == NULL) {\n    *os << \"NULL\";\n  } else {\n    // C++ doesn't allow casting from a function pointer to any object\n    // pointer.\n    //\n    // IsTrue() silences warnings: \"Condition is always true\",\n    // \"unreachable code\".\n    if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {\n      // T is not a function type.  We just call << to print p,\n      // relying on ADL to pick up user-defined << for their pointer\n      // types, if any.\n      *os << p;\n    } else {\n      // T is a function type, so '*os << p' doesn't do what we want\n      // (it just prints p as bool).  We want to print p as a const\n      // void*.  However, we cannot cast it to const void* directly,\n      // even using reinterpret_cast, as earlier versions of gcc\n      // (e.g. 3.4.5) cannot compile the cast when p is a function\n      // pointer.  Casting to UInt64 first solves the problem.\n      *os << reinterpret_cast<const void*>(\n          reinterpret_cast<internal::UInt64>(p));\n    }\n  }\n}\n\n// Used to print a non-container, non-pointer value when the user\n// doesn't define PrintTo() for it.\ntemplate <typename T>\nvoid DefaultPrintTo(IsNotContainer /* dummy */,\n                    false_type /* is not a pointer */,\n                    const T& value, ::std::ostream* os) {\n  ::testing_internal::DefaultPrintNonContainerTo(value, os);\n}\n\n// Prints the given value using the << operator if it has one;\n// otherwise prints the bytes in it.  This is what\n// UniversalPrinter<T>::Print() does when PrintTo() is not specialized\n// or overloaded for type T.\n//\n// A user can override this behavior for a class type Foo by defining\n// an overload of PrintTo() in the namespace where Foo is defined.  We\n// give the user this option as sometimes defining a << operator for\n// Foo is not desirable (e.g. the coding style may prevent doing it,\n// or there is already a << operator but it doesn't do what the user\n// wants).\ntemplate <typename T>\nvoid PrintTo(const T& value, ::std::ostream* os) {\n  // DefaultPrintTo() is overloaded.  The type of its first two\n  // arguments determine which version will be picked.  If T is an\n  // STL-style container, the version for container will be called; if\n  // T is a pointer, the pointer version will be called; otherwise the\n  // generic version will be called.\n  //\n  // Note that we check for container types here, prior to we check\n  // for protocol message types in our operator<<.  The rationale is:\n  //\n  // For protocol messages, we want to give people a chance to\n  // override Google Mock's format by defining a PrintTo() or\n  // operator<<.  For STL containers, other formats can be\n  // incompatible with Google Mock's format for the container\n  // elements; therefore we check for container types here to ensure\n  // that our format is used.\n  //\n  // The second argument of DefaultPrintTo() is needed to bypass a bug\n  // in Symbian's C++ compiler that prevents it from picking the right\n  // overload between:\n  //\n  //   PrintTo(const T& x, ...);\n  //   PrintTo(T* x, ...);\n  DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);\n}\n\n// The following list of PrintTo() overloads tells\n// UniversalPrinter<T>::Print() how to print standard types (built-in\n// types, strings, plain arrays, and pointers).\n\n// Overloads for various char types.\nGTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);\nGTEST_API_ void PrintTo(signed char c, ::std::ostream* os);\ninline void PrintTo(char c, ::std::ostream* os) {\n  // When printing a plain char, we always treat it as unsigned.  This\n  // way, the output won't be affected by whether the compiler thinks\n  // char is signed or not.\n  PrintTo(static_cast<unsigned char>(c), os);\n}\n\n// Overloads for other simple built-in types.\ninline void PrintTo(bool x, ::std::ostream* os) {\n  *os << (x ? \"true\" : \"false\");\n}\n\n// Overload for wchar_t type.\n// Prints a wchar_t as a symbol if it is printable or as its internal\n// code otherwise and also as its decimal code (except for L'\\0').\n// The L'\\0' char is printed as \"L'\\\\0'\". The decimal code is printed\n// as signed integer when wchar_t is implemented by the compiler\n// as a signed type and is printed as an unsigned integer when wchar_t\n// is implemented as an unsigned type.\nGTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);\n\n// Overloads for C strings.\nGTEST_API_ void PrintTo(const char* s, ::std::ostream* os);\ninline void PrintTo(char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const char*>(s), os);\n}\n\n// signed/unsigned char is often used for representing binary data, so\n// we print pointers to it as void* to be safe.\ninline void PrintTo(const signed char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\ninline void PrintTo(signed char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\ninline void PrintTo(const unsigned char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\ninline void PrintTo(unsigned char* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const void*>(s), os);\n}\n\n// MSVC can be configured to define wchar_t as a typedef of unsigned\n// short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native\n// type.  When wchar_t is a typedef, defining an overload for const\n// wchar_t* would cause unsigned short* be printed as a wide string,\n// possibly causing invalid memory accesses.\n#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)\n// Overloads for wide C strings\nGTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);\ninline void PrintTo(wchar_t* s, ::std::ostream* os) {\n  PrintTo(ImplicitCast_<const wchar_t*>(s), os);\n}\n#endif\n\n// Overload for C arrays.  Multi-dimensional arrays are printed\n// properly.\n\n// Prints the given number of elements in an array, without printing\n// the curly braces.\ntemplate <typename T>\nvoid PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {\n  UniversalPrint(a[0], os);\n  for (size_t i = 1; i != count; i++) {\n    *os << \", \";\n    UniversalPrint(a[i], os);\n  }\n}\n\n// Overloads for ::string and ::std::string.\n#if GTEST_HAS_GLOBAL_STRING\nGTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);\ninline void PrintTo(const ::string& s, ::std::ostream* os) {\n  PrintStringTo(s, os);\n}\n#endif  // GTEST_HAS_GLOBAL_STRING\n\nGTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);\ninline void PrintTo(const ::std::string& s, ::std::ostream* os) {\n  PrintStringTo(s, os);\n}\n\n// Overloads for ::wstring and ::std::wstring.\n#if GTEST_HAS_GLOBAL_WSTRING\nGTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);\ninline void PrintTo(const ::wstring& s, ::std::ostream* os) {\n  PrintWideStringTo(s, os);\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n#if GTEST_HAS_STD_WSTRING\nGTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);\ninline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {\n  PrintWideStringTo(s, os);\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_TR1_TUPLE\n// Overload for ::std::tr1::tuple.  Needed for printing function arguments,\n// which are packed as tuples.\n\n// Helper function for printing a tuple.  T must be instantiated with\n// a tuple type.\ntemplate <typename T>\nvoid PrintTupleTo(const T& t, ::std::ostream* os);\n\n// Overloaded PrintTo() for tuples of various arities.  We support\n// tuples of up-to 10 fields.  The following implementation works\n// regardless of whether tr1::tuple is implemented using the\n// non-standard variadic template feature or not.\n\ninline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1>\nvoid PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8, typename T9>\nvoid PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,\n             ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8, typename T9, typename T10>\nvoid PrintTo(\n    const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,\n    ::std::ostream* os) {\n  PrintTupleTo(t, os);\n}\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Overload for std::pair.\ntemplate <typename T1, typename T2>\nvoid PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {\n  *os << '(';\n  // We cannot use UniversalPrint(value.first, os) here, as T1 may be\n  // a reference type.  The same for printing value.second.\n  UniversalPrinter<T1>::Print(value.first, os);\n  *os << \", \";\n  UniversalPrinter<T2>::Print(value.second, os);\n  *os << ')';\n}\n\n// Implements printing a non-reference type T by letting the compiler\n// pick the right overload of PrintTo() for T.\ntemplate <typename T>\nclass UniversalPrinter {\n public:\n  // MSVC warns about adding const to a function type, so we want to\n  // disable the warning.\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4180)  // Temporarily disables warning 4180.\n#endif  // _MSC_VER\n\n  // Note: we deliberately don't call this PrintTo(), as that name\n  // conflicts with ::testing::internal::PrintTo in the body of the\n  // function.\n  static void Print(const T& value, ::std::ostream* os) {\n    // By default, ::testing::internal::PrintTo() is used for printing\n    // the value.\n    //\n    // Thanks to Koenig look-up, if T is a class and has its own\n    // PrintTo() function defined in its namespace, that function will\n    // be visible here.  Since it is more specific than the generic ones\n    // in ::testing::internal, it will be picked by the compiler in the\n    // following statement - exactly what we want.\n    PrintTo(value, os);\n  }\n\n#ifdef _MSC_VER\n# pragma warning(pop)           // Restores the warning state.\n#endif  // _MSC_VER\n};\n\n// UniversalPrintArray(begin, len, os) prints an array of 'len'\n// elements, starting at address 'begin'.\ntemplate <typename T>\nvoid UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {\n  if (len == 0) {\n    *os << \"{}\";\n  } else {\n    *os << \"{ \";\n    const size_t kThreshold = 18;\n    const size_t kChunkSize = 8;\n    // If the array has more than kThreshold elements, we'll have to\n    // omit some details by printing only the first and the last\n    // kChunkSize elements.\n    // TODO(wan@google.com): let the user control the threshold using a flag.\n    if (len <= kThreshold) {\n      PrintRawArrayTo(begin, len, os);\n    } else {\n      PrintRawArrayTo(begin, kChunkSize, os);\n      *os << \", ..., \";\n      PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);\n    }\n    *os << \" }\";\n  }\n}\n// This overload prints a (const) char array compactly.\nGTEST_API_ void UniversalPrintArray(\n    const char* begin, size_t len, ::std::ostream* os);\n\n// This overload prints a (const) wchar_t array compactly.\nGTEST_API_ void UniversalPrintArray(\n    const wchar_t* begin, size_t len, ::std::ostream* os);\n\n// Implements printing an array type T[N].\ntemplate <typename T, size_t N>\nclass UniversalPrinter<T[N]> {\n public:\n  // Prints the given array, omitting some elements when there are too\n  // many.\n  static void Print(const T (&a)[N], ::std::ostream* os) {\n    UniversalPrintArray(a, N, os);\n  }\n};\n\n// Implements printing a reference type T&.\ntemplate <typename T>\nclass UniversalPrinter<T&> {\n public:\n  // MSVC warns about adding const to a function type, so we want to\n  // disable the warning.\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4180)  // Temporarily disables warning 4180.\n#endif  // _MSC_VER\n\n  static void Print(const T& value, ::std::ostream* os) {\n    // Prints the address of the value.  We use reinterpret_cast here\n    // as static_cast doesn't compile when T is a function type.\n    *os << \"@\" << reinterpret_cast<const void*>(&value) << \" \";\n\n    // Then prints the value itself.\n    UniversalPrint(value, os);\n  }\n\n#ifdef _MSC_VER\n# pragma warning(pop)           // Restores the warning state.\n#endif  // _MSC_VER\n};\n\n// Prints a value tersely: for a reference type, the referenced value\n// (but not the address) is printed; for a (const) char pointer, the\n// NUL-terminated string (but not the pointer) is printed.\n\ntemplate <typename T>\nclass UniversalTersePrinter {\n public:\n  static void Print(const T& value, ::std::ostream* os) {\n    UniversalPrint(value, os);\n  }\n};\ntemplate <typename T>\nclass UniversalTersePrinter<T&> {\n public:\n  static void Print(const T& value, ::std::ostream* os) {\n    UniversalPrint(value, os);\n  }\n};\ntemplate <typename T, size_t N>\nclass UniversalTersePrinter<T[N]> {\n public:\n  static void Print(const T (&value)[N], ::std::ostream* os) {\n    UniversalPrinter<T[N]>::Print(value, os);\n  }\n};\ntemplate <>\nclass UniversalTersePrinter<const char*> {\n public:\n  static void Print(const char* str, ::std::ostream* os) {\n    if (str == NULL) {\n      *os << \"NULL\";\n    } else {\n      UniversalPrint(string(str), os);\n    }\n  }\n};\ntemplate <>\nclass UniversalTersePrinter<char*> {\n public:\n  static void Print(char* str, ::std::ostream* os) {\n    UniversalTersePrinter<const char*>::Print(str, os);\n  }\n};\n\n#if GTEST_HAS_STD_WSTRING\ntemplate <>\nclass UniversalTersePrinter<const wchar_t*> {\n public:\n  static void Print(const wchar_t* str, ::std::ostream* os) {\n    if (str == NULL) {\n      *os << \"NULL\";\n    } else {\n      UniversalPrint(::std::wstring(str), os);\n    }\n  }\n};\n#endif\n\ntemplate <>\nclass UniversalTersePrinter<wchar_t*> {\n public:\n  static void Print(wchar_t* str, ::std::ostream* os) {\n    UniversalTersePrinter<const wchar_t*>::Print(str, os);\n  }\n};\n\ntemplate <typename T>\nvoid UniversalTersePrint(const T& value, ::std::ostream* os) {\n  UniversalTersePrinter<T>::Print(value, os);\n}\n\n// Prints a value using the type inferred by the compiler.  The\n// difference between this and UniversalTersePrint() is that for a\n// (const) char pointer, this prints both the pointer and the\n// NUL-terminated string.\ntemplate <typename T>\nvoid UniversalPrint(const T& value, ::std::ostream* os) {\n  // A workarond for the bug in VC++ 7.1 that prevents us from instantiating\n  // UniversalPrinter with T directly.\n  typedef T T1;\n  UniversalPrinter<T1>::Print(value, os);\n}\n\n#if GTEST_HAS_TR1_TUPLE\ntypedef ::std::vector<string> Strings;\n\n// This helper template allows PrintTo() for tuples and\n// UniversalTersePrintTupleFieldsToStrings() to be defined by\n// induction on the number of tuple fields.  The idea is that\n// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N\n// fields in tuple t, and can be defined in terms of\n// TuplePrefixPrinter<N - 1>.\n\n// The inductive case.\ntemplate <size_t N>\nstruct TuplePrefixPrinter {\n  // Prints the first N fields of a tuple.\n  template <typename Tuple>\n  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {\n    TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);\n    *os << \", \";\n    UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>\n        ::Print(::std::tr1::get<N - 1>(t), os);\n  }\n\n  // Tersely prints the first N fields of a tuple to a string vector,\n  // one element for each field.\n  template <typename Tuple>\n  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {\n    TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);\n    ::std::stringstream ss;\n    UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);\n    strings->push_back(ss.str());\n  }\n};\n\n// Base cases.\ntemplate <>\nstruct TuplePrefixPrinter<0> {\n  template <typename Tuple>\n  static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}\n\n  template <typename Tuple>\n  static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}\n};\n// We have to specialize the entire TuplePrefixPrinter<> class\n// template here, even though the definition of\n// TersePrintPrefixToStrings() is the same as the generic version, as\n// Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't\n// support specializing a method template of a class template.\ntemplate <>\nstruct TuplePrefixPrinter<1> {\n  template <typename Tuple>\n  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {\n    UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::\n        Print(::std::tr1::get<0>(t), os);\n  }\n\n  template <typename Tuple>\n  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {\n    ::std::stringstream ss;\n    UniversalTersePrint(::std::tr1::get<0>(t), &ss);\n    strings->push_back(ss.str());\n  }\n};\n\n// Helper function for printing a tuple.  T must be instantiated with\n// a tuple type.\ntemplate <typename T>\nvoid PrintTupleTo(const T& t, ::std::ostream* os) {\n  *os << \"(\";\n  TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::\n      PrintPrefixTo(t, os);\n  *os << \")\";\n}\n\n// Prints the fields of a tuple tersely to a string vector, one\n// element for each field.  See the comment before\n// UniversalTersePrint() for how we define \"tersely\".\ntemplate <typename Tuple>\nStrings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {\n  Strings result;\n  TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::\n      TersePrintPrefixToStrings(value, &result);\n  return result;\n}\n#endif  // GTEST_HAS_TR1_TUPLE\n\n}  // namespace internal\n\ntemplate <typename T>\n::std::string PrintToString(const T& value) {\n  ::std::stringstream ss;\n  internal::UniversalTersePrinter<T>::Print(value, &ss);\n  return ss.str();\n}\n\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-spi.h",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Utilities for testing Google Test itself and code that uses Google Test\n// (e.g. frameworks built on top of Google Test).\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_\n#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_\n\n#include \"gtest/gtest.h\"\n\nnamespace testing {\n\n// This helper class can be used to mock out Google Test failure reporting\n// so that we can test Google Test or code that builds on Google Test.\n//\n// An object of this class appends a TestPartResult object to the\n// TestPartResultArray object given in the constructor whenever a Google Test\n// failure is reported. It can either intercept only failures that are\n// generated in the same thread that created this object or it can intercept\n// all generated failures. The scope of this mock object can be controlled with\n// the second argument to the two arguments constructor.\nclass GTEST_API_ ScopedFakeTestPartResultReporter\n    : public TestPartResultReporterInterface {\n public:\n  // The two possible mocking modes of this object.\n  enum InterceptMode {\n    INTERCEPT_ONLY_CURRENT_THREAD,  // Intercepts only thread local failures.\n    INTERCEPT_ALL_THREADS           // Intercepts all failures.\n  };\n\n  // The c'tor sets this object as the test part result reporter used\n  // by Google Test.  The 'result' parameter specifies where to report the\n  // results. This reporter will only catch failures generated in the current\n  // thread. DEPRECATED\n  explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);\n\n  // Same as above, but you can choose the interception scope of this object.\n  ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,\n                                   TestPartResultArray* result);\n\n  // The d'tor restores the previous test part result reporter.\n  virtual ~ScopedFakeTestPartResultReporter();\n\n  // Appends the TestPartResult object to the TestPartResultArray\n  // received in the constructor.\n  //\n  // This method is from the TestPartResultReporterInterface\n  // interface.\n  virtual void ReportTestPartResult(const TestPartResult& result);\n private:\n  void Init();\n\n  const InterceptMode intercept_mode_;\n  TestPartResultReporterInterface* old_reporter_;\n  TestPartResultArray* const result_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);\n};\n\nnamespace internal {\n\n// A helper class for implementing EXPECT_FATAL_FAILURE() and\n// EXPECT_NONFATAL_FAILURE().  Its destructor verifies that the given\n// TestPartResultArray contains exactly one failure that has the given\n// type and contains the given substring.  If that's not the case, a\n// non-fatal failure will be generated.\nclass GTEST_API_ SingleFailureChecker {\n public:\n  // The constructor remembers the arguments.\n  SingleFailureChecker(const TestPartResultArray* results,\n                       TestPartResult::Type type,\n                       const string& substr);\n  ~SingleFailureChecker();\n private:\n  const TestPartResultArray* const results_;\n  const TestPartResult::Type type_;\n  const string substr_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);\n};\n\n}  // namespace internal\n\n}  // namespace testing\n\n// A set of macros for testing Google Test assertions or code that's expected\n// to generate Google Test fatal failures.  It verifies that the given\n// statement will cause exactly one fatal Google Test failure with 'substr'\n// being part of the failure message.\n//\n// There are two different versions of this macro. EXPECT_FATAL_FAILURE only\n// affects and considers failures generated in the current thread and\n// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.\n//\n// The verification of the assertion is done correctly even when the statement\n// throws an exception or aborts the current function.\n//\n// Known restrictions:\n//   - 'statement' cannot reference local non-static variables or\n//     non-static members of the current object.\n//   - 'statement' cannot return a value.\n//   - You cannot stream a failure message to this macro.\n//\n// Note that even though the implementations of the following two\n// macros are much alike, we cannot refactor them to use a common\n// helper macro, due to some peculiarity in how the preprocessor\n// works.  The AcceptsMacroThatExpandsToUnprotectedComma test in\n// gtest_unittest.cc will fail to compile if we do that.\n#define EXPECT_FATAL_FAILURE(statement, substr) \\\n  do { \\\n    class GTestExpectFatalFailureHelper {\\\n     public:\\\n      static void Execute() { statement; }\\\n    };\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter:: \\\n          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\\\n      GTestExpectFatalFailureHelper::Execute();\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \\\n  do { \\\n    class GTestExpectFatalFailureHelper {\\\n     public:\\\n      static void Execute() { statement; }\\\n    };\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter:: \\\n          INTERCEPT_ALL_THREADS, &gtest_failures);\\\n      GTestExpectFatalFailureHelper::Execute();\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n// A macro for testing Google Test assertions or code that's expected to\n// generate Google Test non-fatal failures.  It asserts that the given\n// statement will cause exactly one non-fatal Google Test failure with 'substr'\n// being part of the failure message.\n//\n// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only\n// affects and considers failures generated in the current thread and\n// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.\n//\n// 'statement' is allowed to reference local variables and members of\n// the current object.\n//\n// The verification of the assertion is done correctly even when the statement\n// throws an exception or aborts the current function.\n//\n// Known restrictions:\n//   - You cannot stream a failure message to this macro.\n//\n// Note that even though the implementations of the following two\n// macros are much alike, we cannot refactor them to use a common\n// helper macro, due to some peculiarity in how the preprocessor\n// works.  If we do that, the code won't compile when the user gives\n// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that\n// expands to code containing an unprotected comma.  The\n// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc\n// catches that.\n//\n// For the same reason, we have to write\n//   if (::testing::internal::AlwaysTrue()) { statement; }\n// instead of\n//   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)\n// to avoid an MSVC warning on unreachable code.\n#define EXPECT_NONFATAL_FAILURE(statement, substr) \\\n  do {\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \\\n        (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter:: \\\n          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\\\n      if (::testing::internal::AlwaysTrue()) { statement; }\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \\\n  do {\\\n    ::testing::TestPartResultArray gtest_failures;\\\n    ::testing::internal::SingleFailureChecker gtest_checker(\\\n        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \\\n        (substr));\\\n    {\\\n      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\\\n          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \\\n          &gtest_failures);\\\n      if (::testing::internal::AlwaysTrue()) { statement; }\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_SPI_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-test-part.h",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_\n#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_\n\n#include <iosfwd>\n#include <vector>\n#include \"gtest/internal/gtest-internal.h\"\n#include \"gtest/internal/gtest-string.h\"\n\nnamespace testing {\n\n// A copyable object representing the result of a test part (i.e. an\n// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).\n//\n// Don't inherit from TestPartResult as its destructor is not virtual.\nclass GTEST_API_ TestPartResult {\n public:\n  // The possible outcomes of a test part (i.e. an assertion or an\n  // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).\n  enum Type {\n    kSuccess,          // Succeeded.\n    kNonFatalFailure,  // Failed but the test can continue.\n    kFatalFailure      // Failed and the test should be terminated.\n  };\n\n  // C'tor.  TestPartResult does NOT have a default constructor.\n  // Always use this constructor (with parameters) to create a\n  // TestPartResult object.\n  TestPartResult(Type a_type,\n                 const char* a_file_name,\n                 int a_line_number,\n                 const char* a_message)\n      : type_(a_type),\n        file_name_(a_file_name == NULL ? \"\" : a_file_name),\n        line_number_(a_line_number),\n        summary_(ExtractSummary(a_message)),\n        message_(a_message) {\n  }\n\n  // Gets the outcome of the test part.\n  Type type() const { return type_; }\n\n  // Gets the name of the source file where the test part took place, or\n  // NULL if it's unknown.\n  const char* file_name() const {\n    return file_name_.empty() ? NULL : file_name_.c_str();\n  }\n\n  // Gets the line in the source file where the test part took place,\n  // or -1 if it's unknown.\n  int line_number() const { return line_number_; }\n\n  // Gets the summary of the failure message.\n  const char* summary() const { return summary_.c_str(); }\n\n  // Gets the message associated with the test part.\n  const char* message() const { return message_.c_str(); }\n\n  // Returns true iff the test part passed.\n  bool passed() const { return type_ == kSuccess; }\n\n  // Returns true iff the test part failed.\n  bool failed() const { return type_ != kSuccess; }\n\n  // Returns true iff the test part non-fatally failed.\n  bool nonfatally_failed() const { return type_ == kNonFatalFailure; }\n\n  // Returns true iff the test part fatally failed.\n  bool fatally_failed() const { return type_ == kFatalFailure; }\n\n private:\n  Type type_;\n\n  // Gets the summary of the failure message by omitting the stack\n  // trace in it.\n  static std::string ExtractSummary(const char* message);\n\n  // The name of the source file where the test part took place, or\n  // \"\" if the source file is unknown.\n  std::string file_name_;\n  // The line in the source file where the test part took place, or -1\n  // if the line number is unknown.\n  int line_number_;\n  std::string summary_;  // The test failure summary.\n  std::string message_;  // The test failure message.\n};\n\n// Prints a TestPartResult object.\nstd::ostream& operator<<(std::ostream& os, const TestPartResult& result);\n\n// An array of TestPartResult objects.\n//\n// Don't inherit from TestPartResultArray as its destructor is not\n// virtual.\nclass GTEST_API_ TestPartResultArray {\n public:\n  TestPartResultArray() {}\n\n  // Appends the given TestPartResult to the array.\n  void Append(const TestPartResult& result);\n\n  // Returns the TestPartResult at the given index (0-based).\n  const TestPartResult& GetTestPartResult(int index) const;\n\n  // Returns the number of TestPartResult objects in the array.\n  int size() const;\n\n private:\n  std::vector<TestPartResult> array_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);\n};\n\n// This interface knows how to report a test part result.\nclass TestPartResultReporterInterface {\n public:\n  virtual ~TestPartResultReporterInterface() {}\n\n  virtual void ReportTestPartResult(const TestPartResult& result) = 0;\n};\n\nnamespace internal {\n\n// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a\n// statement generates new fatal failures. To do so it registers itself as the\n// current test part result reporter. Besides checking if fatal failures were\n// reported, it only delegates the reporting to the former result reporter.\n// The original result reporter is restored in the destructor.\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nclass GTEST_API_ HasNewFatalFailureHelper\n    : public TestPartResultReporterInterface {\n public:\n  HasNewFatalFailureHelper();\n  virtual ~HasNewFatalFailureHelper();\n  virtual void ReportTestPartResult(const TestPartResult& result);\n  bool has_new_fatal_failure() const { return has_new_fatal_failure_; }\n private:\n  bool has_new_fatal_failure_;\n  TestPartResultReporterInterface* original_reporter_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);\n};\n\n}  // namespace internal\n\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest-typed-test.h",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_\n\n// This header implements typed tests and type-parameterized tests.\n\n// Typed (aka type-driven) tests repeat the same test for types in a\n// list.  You must know which types you want to test with when writing\n// typed tests. Here's how you do it:\n\n#if 0\n\n// First, define a fixture class template.  It should be parameterized\n// by a type.  Remember to derive it from testing::Test.\ntemplate <typename T>\nclass FooTest : public testing::Test {\n public:\n  ...\n  typedef std::list<T> List;\n  static T shared_;\n  T value_;\n};\n\n// Next, associate a list of types with the test case, which will be\n// repeated for each type in the list.  The typedef is necessary for\n// the macro to parse correctly.\ntypedef testing::Types<char, int, unsigned int> MyTypes;\nTYPED_TEST_CASE(FooTest, MyTypes);\n\n// If the type list contains only one type, you can write that type\n// directly without Types<...>:\n//   TYPED_TEST_CASE(FooTest, int);\n\n// Then, use TYPED_TEST() instead of TEST_F() to define as many typed\n// tests for this test case as you want.\nTYPED_TEST(FooTest, DoesBlah) {\n  // Inside a test, refer to TypeParam to get the type parameter.\n  // Since we are inside a derived class template, C++ requires use to\n  // visit the members of FooTest via 'this'.\n  TypeParam n = this->value_;\n\n  // To visit static members of the fixture, add the TestFixture::\n  // prefix.\n  n += TestFixture::shared_;\n\n  // To refer to typedefs in the fixture, add the \"typename\n  // TestFixture::\" prefix.\n  typename TestFixture::List values;\n  values.push_back(n);\n  ...\n}\n\nTYPED_TEST(FooTest, HasPropertyA) { ... }\n\n#endif  // 0\n\n// Type-parameterized tests are abstract test patterns parameterized\n// by a type.  Compared with typed tests, type-parameterized tests\n// allow you to define the test pattern without knowing what the type\n// parameters are.  The defined pattern can be instantiated with\n// different types any number of times, in any number of translation\n// units.\n//\n// If you are designing an interface or concept, you can define a\n// suite of type-parameterized tests to verify properties that any\n// valid implementation of the interface/concept should have.  Then,\n// each implementation can easily instantiate the test suite to verify\n// that it conforms to the requirements, without having to write\n// similar tests repeatedly.  Here's an example:\n\n#if 0\n\n// First, define a fixture class template.  It should be parameterized\n// by a type.  Remember to derive it from testing::Test.\ntemplate <typename T>\nclass FooTest : public testing::Test {\n  ...\n};\n\n// Next, declare that you will define a type-parameterized test case\n// (the _P suffix is for \"parameterized\" or \"pattern\", whichever you\n// prefer):\nTYPED_TEST_CASE_P(FooTest);\n\n// Then, use TYPED_TEST_P() to define as many type-parameterized tests\n// for this type-parameterized test case as you want.\nTYPED_TEST_P(FooTest, DoesBlah) {\n  // Inside a test, refer to TypeParam to get the type parameter.\n  TypeParam n = 0;\n  ...\n}\n\nTYPED_TEST_P(FooTest, HasPropertyA) { ... }\n\n// Now the tricky part: you need to register all test patterns before\n// you can instantiate them.  The first argument of the macro is the\n// test case name; the rest are the names of the tests in this test\n// case.\nREGISTER_TYPED_TEST_CASE_P(FooTest,\n                           DoesBlah, HasPropertyA);\n\n// Finally, you are free to instantiate the pattern with the types you\n// want.  If you put the above code in a header file, you can #include\n// it in multiple C++ source files and instantiate it multiple times.\n//\n// To distinguish different instances of the pattern, the first\n// argument to the INSTANTIATE_* macro is a prefix that will be added\n// to the actual test case name.  Remember to pick unique prefixes for\n// different instances.\ntypedef testing::Types<char, int, unsigned int> MyTypes;\nINSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);\n\n// If the type list contains only one type, you can write that type\n// directly without Types<...>:\n//   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);\n\n#endif  // 0\n\n#include \"gtest/internal/gtest-port.h\"\n#include \"gtest/internal/gtest-type-util.h\"\n\n// Implements typed tests.\n\n#if GTEST_HAS_TYPED_TEST\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Expands to the name of the typedef for the type parameters of the\n// given test case.\n# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_\n\n// The 'Types' template argument below must have spaces around it\n// since some compilers may choke on '>>' when passing a template\n// instance (e.g. Types<int>)\n# define TYPED_TEST_CASE(CaseName, Types) \\\n  typedef ::testing::internal::TypeList< Types >::type \\\n      GTEST_TYPE_PARAMS_(CaseName)\n\n# define TYPED_TEST(CaseName, TestName) \\\n  template <typename gtest_TypeParam_> \\\n  class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \\\n      : public CaseName<gtest_TypeParam_> { \\\n   private: \\\n    typedef CaseName<gtest_TypeParam_> TestFixture; \\\n    typedef gtest_TypeParam_ TypeParam; \\\n    virtual void TestBody(); \\\n  }; \\\n  bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \\\n      ::testing::internal::TypeParameterizedTest< \\\n          CaseName, \\\n          ::testing::internal::TemplateSel< \\\n              GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \\\n          GTEST_TYPE_PARAMS_(CaseName)>::Register(\\\n              \"\", #CaseName, #TestName, 0); \\\n  template <typename gtest_TypeParam_> \\\n  void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()\n\n#endif  // GTEST_HAS_TYPED_TEST\n\n// Implements type-parameterized tests.\n\n#if GTEST_HAS_TYPED_TEST_P\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Expands to the namespace name that the type-parameterized tests for\n// the given type-parameterized test case are defined in.  The exact\n// name of the namespace is subject to change without notice.\n# define GTEST_CASE_NAMESPACE_(TestCaseName) \\\n  gtest_case_##TestCaseName##_\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Expands to the name of the variable used to remember the names of\n// the defined tests in the given test case.\n# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \\\n  gtest_typed_test_case_p_state_##TestCaseName##_\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.\n//\n// Expands to the name of the variable used to remember the names of\n// the registered tests in the given test case.\n# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \\\n  gtest_registered_test_names_##TestCaseName##_\n\n// The variables defined in the type-parameterized test macros are\n// static as typically these macros are used in a .h file that can be\n// #included in multiple translation units linked together.\n# define TYPED_TEST_CASE_P(CaseName) \\\n  static ::testing::internal::TypedTestCasePState \\\n      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)\n\n# define TYPED_TEST_P(CaseName, TestName) \\\n  namespace GTEST_CASE_NAMESPACE_(CaseName) { \\\n  template <typename gtest_TypeParam_> \\\n  class TestName : public CaseName<gtest_TypeParam_> { \\\n   private: \\\n    typedef CaseName<gtest_TypeParam_> TestFixture; \\\n    typedef gtest_TypeParam_ TypeParam; \\\n    virtual void TestBody(); \\\n  }; \\\n  static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \\\n      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\\\n          __FILE__, __LINE__, #CaseName, #TestName); \\\n  } \\\n  template <typename gtest_TypeParam_> \\\n  void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()\n\n# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \\\n  namespace GTEST_CASE_NAMESPACE_(CaseName) { \\\n  typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \\\n  } \\\n  static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \\\n      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\\\n          __FILE__, __LINE__, #__VA_ARGS__)\n\n// The 'Types' template argument below must have spaces around it\n// since some compilers may choke on '>>' when passing a template\n// instance (e.g. Types<int>)\n# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \\\n  bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \\\n      ::testing::internal::TypeParameterizedTestCase<CaseName, \\\n          GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \\\n          ::testing::internal::TypeList< Types >::type>::Register(\\\n              #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines the public API for Google Test.  It should be\n// included by any test program that uses Google Test.\n//\n// IMPORTANT NOTE: Due to limitation of the C++ language, we have to\n// leave some internal implementation details in this header file.\n// They are clearly marked by comments like this:\n//\n//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n//\n// Such code is NOT meant to be used by a user directly, and is subject\n// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user\n// program!\n//\n// Acknowledgment: Google Test borrowed the idea of automatic test\n// registration from Barthelemy Dagenais' (barthelemy@prologique.com)\n// easyUnit framework.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_H_\n#define GTEST_INCLUDE_GTEST_GTEST_H_\n\n#include <limits>\n#include <ostream>\n#include <vector>\n\n#include \"gtest/internal/gtest-internal.h\"\n#include \"gtest/internal/gtest-string.h\"\n#include \"gtest/gtest-death-test.h\"\n#include \"gtest/gtest-message.h\"\n#include \"gtest/gtest-param-test.h\"\n#include \"gtest/gtest-printers.h\"\n#include \"gtest/gtest_prod.h\"\n#include \"gtest/gtest-test-part.h\"\n#include \"gtest/gtest-typed-test.h\"\n\n// Depending on the platform, different string classes are available.\n// On Linux, in addition to ::std::string, Google also makes use of\n// class ::string, which has the same interface as ::std::string, but\n// has a different implementation.\n//\n// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that\n// ::string is available AND is a distinct type to ::std::string, or\n// define it to 0 to indicate otherwise.\n//\n// If the user's ::std::string and ::string are the same class due to\n// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.\n//\n// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined\n// heuristically.\n\nnamespace testing {\n\n// Declares the flags.\n\n// This flag temporary enables the disabled tests.\nGTEST_DECLARE_bool_(also_run_disabled_tests);\n\n// This flag brings the debugger on an assertion failure.\nGTEST_DECLARE_bool_(break_on_failure);\n\n// This flag controls whether Google Test catches all test-thrown exceptions\n// and logs them as failures.\nGTEST_DECLARE_bool_(catch_exceptions);\n\n// This flag enables using colors in terminal output. Available values are\n// \"yes\" to enable colors, \"no\" (disable colors), or \"auto\" (the default)\n// to let Google Test decide.\nGTEST_DECLARE_string_(color);\n\n// This flag sets up the filter to select by name using a glob pattern\n// the tests to run. If the filter is not given all tests are executed.\nGTEST_DECLARE_string_(filter);\n\n// This flag causes the Google Test to list tests. None of the tests listed\n// are actually run if the flag is provided.\nGTEST_DECLARE_bool_(list_tests);\n\n// This flag controls whether Google Test emits a detailed XML report to a file\n// in addition to its normal textual output.\nGTEST_DECLARE_string_(output);\n\n// This flags control whether Google Test prints the elapsed time for each\n// test.\nGTEST_DECLARE_bool_(print_time);\n\n// This flag specifies the random number seed.\nGTEST_DECLARE_int32_(random_seed);\n\n// This flag sets how many times the tests are repeated. The default value\n// is 1. If the value is -1 the tests are repeating forever.\nGTEST_DECLARE_int32_(repeat);\n\n// This flag controls whether Google Test includes Google Test internal\n// stack frames in failure stack traces.\nGTEST_DECLARE_bool_(show_internal_stack_frames);\n\n// When this flag is specified, tests' order is randomized on every iteration.\nGTEST_DECLARE_bool_(shuffle);\n\n// This flag specifies the maximum number of stack frames to be\n// printed in a failure message.\nGTEST_DECLARE_int32_(stack_trace_depth);\n\n// When this flag is specified, a failed assertion will throw an\n// exception if exceptions are enabled, or exit the program with a\n// non-zero code otherwise.\nGTEST_DECLARE_bool_(throw_on_failure);\n\n// When this flag is set with a \"host:port\" string, on supported\n// platforms test results are streamed to the specified port on\n// the specified host machine.\nGTEST_DECLARE_string_(stream_result_to);\n\n// The upper limit for valid stack trace depths.\nconst int kMaxStackTraceDepth = 100;\n\nnamespace internal {\n\nclass AssertHelper;\nclass DefaultGlobalTestPartResultReporter;\nclass ExecDeathTest;\nclass NoExecDeathTest;\nclass FinalSuccessChecker;\nclass GTestFlagSaver;\nclass StreamingListenerTest;\nclass TestResultAccessor;\nclass TestEventListenersAccessor;\nclass TestEventRepeater;\nclass UnitTestRecordPropertyTestHelper;\nclass WindowsDeathTest;\nclass UnitTestImpl* GetUnitTestImpl();\nvoid ReportFailureInUnknownLocation(TestPartResult::Type result_type,\n                                    const std::string& message);\n\n}  // namespace internal\n\n// The friend relationship of some of these classes is cyclic.\n// If we don't forward declare them the compiler might confuse the classes\n// in friendship clauses with same named classes on the scope.\nclass Test;\nclass TestCase;\nclass TestInfo;\nclass UnitTest;\n\n// A class for indicating whether an assertion was successful.  When\n// the assertion wasn't successful, the AssertionResult object\n// remembers a non-empty message that describes how it failed.\n//\n// To create an instance of this class, use one of the factory functions\n// (AssertionSuccess() and AssertionFailure()).\n//\n// This class is useful for two purposes:\n//   1. Defining predicate functions to be used with Boolean test assertions\n//      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts\n//   2. Defining predicate-format functions to be\n//      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).\n//\n// For example, if you define IsEven predicate:\n//\n//   testing::AssertionResult IsEven(int n) {\n//     if ((n % 2) == 0)\n//       return testing::AssertionSuccess();\n//     else\n//       return testing::AssertionFailure() << n << \" is odd\";\n//   }\n//\n// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))\n// will print the message\n//\n//   Value of: IsEven(Fib(5))\n//     Actual: false (5 is odd)\n//   Expected: true\n//\n// instead of a more opaque\n//\n//   Value of: IsEven(Fib(5))\n//     Actual: false\n//   Expected: true\n//\n// in case IsEven is a simple Boolean predicate.\n//\n// If you expect your predicate to be reused and want to support informative\n// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up\n// about half as often as positive ones in our tests), supply messages for\n// both success and failure cases:\n//\n//   testing::AssertionResult IsEven(int n) {\n//     if ((n % 2) == 0)\n//       return testing::AssertionSuccess() << n << \" is even\";\n//     else\n//       return testing::AssertionFailure() << n << \" is odd\";\n//   }\n//\n// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print\n//\n//   Value of: IsEven(Fib(6))\n//     Actual: true (8 is even)\n//   Expected: false\n//\n// NB: Predicates that support negative Boolean assertions have reduced\n// performance in positive ones so be careful not to use them in tests\n// that have lots (tens of thousands) of positive Boolean assertions.\n//\n// To use this class with EXPECT_PRED_FORMAT assertions such as:\n//\n//   // Verifies that Foo() returns an even number.\n//   EXPECT_PRED_FORMAT1(IsEven, Foo());\n//\n// you need to define:\n//\n//   testing::AssertionResult IsEven(const char* expr, int n) {\n//     if ((n % 2) == 0)\n//       return testing::AssertionSuccess();\n//     else\n//       return testing::AssertionFailure()\n//         << \"Expected: \" << expr << \" is even\\n  Actual: it's \" << n;\n//   }\n//\n// If Foo() returns 5, you will see the following message:\n//\n//   Expected: Foo() is even\n//     Actual: it's 5\n//\nclass GTEST_API_ AssertionResult {\n public:\n  // Copy constructor.\n  // Used in EXPECT_TRUE/FALSE(assertion_result).\n  AssertionResult(const AssertionResult& other);\n  // Used in the EXPECT_TRUE/FALSE(bool_expression).\n  explicit AssertionResult(bool success) : success_(success) {}\n\n  // Returns true iff the assertion succeeded.\n  operator bool() const { return success_; }  // NOLINT\n\n  // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.\n  AssertionResult operator!() const;\n\n  // Returns the text streamed into this AssertionResult. Test assertions\n  // use it when they fail (i.e., the predicate's outcome doesn't match the\n  // assertion's expectation). When nothing has been streamed into the\n  // object, returns an empty string.\n  const char* message() const {\n    return message_.get() != NULL ?  message_->c_str() : \"\";\n  }\n  // TODO(vladl@google.com): Remove this after making sure no clients use it.\n  // Deprecated; please use message() instead.\n  const char* failure_message() const { return message(); }\n\n  // Streams a custom failure message into this object.\n  template <typename T> AssertionResult& operator<<(const T& value) {\n    AppendMessage(Message() << value);\n    return *this;\n  }\n\n  // Allows streaming basic output manipulators such as endl or flush into\n  // this object.\n  AssertionResult& operator<<(\n      ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {\n    AppendMessage(Message() << basic_manipulator);\n    return *this;\n  }\n\n private:\n  // Appends the contents of message to message_.\n  void AppendMessage(const Message& a_message) {\n    if (message_.get() == NULL)\n      message_.reset(new ::std::string);\n    message_->append(a_message.GetString().c_str());\n  }\n\n  // Stores result of the assertion predicate.\n  bool success_;\n  // Stores the message describing the condition in case the expectation\n  // construct is not satisfied with the predicate's outcome.\n  // Referenced via a pointer to avoid taking too much stack frame space\n  // with test assertions.\n  internal::scoped_ptr< ::std::string> message_;\n\n  GTEST_DISALLOW_ASSIGN_(AssertionResult);\n};\n\n// Makes a successful assertion result.\nGTEST_API_ AssertionResult AssertionSuccess();\n\n// Makes a failed assertion result.\nGTEST_API_ AssertionResult AssertionFailure();\n\n// Makes a failed assertion result with the given failure message.\n// Deprecated; use AssertionFailure() << msg.\nGTEST_API_ AssertionResult AssertionFailure(const Message& msg);\n\n// The abstract class that all tests inherit from.\n//\n// In Google Test, a unit test program contains one or many TestCases, and\n// each TestCase contains one or many Tests.\n//\n// When you define a test using the TEST macro, you don't need to\n// explicitly derive from Test - the TEST macro automatically does\n// this for you.\n//\n// The only time you derive from Test is when defining a test fixture\n// to be used a TEST_F.  For example:\n//\n//   class FooTest : public testing::Test {\n//    protected:\n//     virtual void SetUp() { ... }\n//     virtual void TearDown() { ... }\n//     ...\n//   };\n//\n//   TEST_F(FooTest, Bar) { ... }\n//   TEST_F(FooTest, Baz) { ... }\n//\n// Test is not copyable.\nclass GTEST_API_ Test {\n public:\n  friend class TestInfo;\n\n  // Defines types for pointers to functions that set up and tear down\n  // a test case.\n  typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;\n  typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;\n\n  // The d'tor is virtual as we intend to inherit from Test.\n  virtual ~Test();\n\n  // Sets up the stuff shared by all tests in this test case.\n  //\n  // Google Test will call Foo::SetUpTestCase() before running the first\n  // test in test case Foo.  Hence a sub-class can define its own\n  // SetUpTestCase() method to shadow the one defined in the super\n  // class.\n  static void SetUpTestCase() {}\n\n  // Tears down the stuff shared by all tests in this test case.\n  //\n  // Google Test will call Foo::TearDownTestCase() after running the last\n  // test in test case Foo.  Hence a sub-class can define its own\n  // TearDownTestCase() method to shadow the one defined in the super\n  // class.\n  static void TearDownTestCase() {}\n\n  // Returns true iff the current test has a fatal failure.\n  static bool HasFatalFailure();\n\n  // Returns true iff the current test has a non-fatal failure.\n  static bool HasNonfatalFailure();\n\n  // Returns true iff the current test has a (either fatal or\n  // non-fatal) failure.\n  static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }\n\n  // Logs a property for the current test, test case, or for the entire\n  // invocation of the test program when used outside of the context of a\n  // test case.  Only the last value for a given key is remembered.  These\n  // are public static so they can be called from utility functions that are\n  // not members of the test fixture.  Calls to RecordProperty made during\n  // lifespan of the test (from the moment its constructor starts to the\n  // moment its destructor finishes) will be output in XML as attributes of\n  // the <testcase> element.  Properties recorded from fixture's\n  // SetUpTestCase or TearDownTestCase are logged as attributes of the\n  // corresponding <testsuite> element.  Calls to RecordProperty made in the\n  // global context (before or after invocation of RUN_ALL_TESTS and from\n  // SetUp/TearDown method of Environment objects registered with Google\n  // Test) will be output as attributes of the <testsuites> element.\n  static void RecordProperty(const std::string& key, const std::string& value);\n  static void RecordProperty(const std::string& key, int value);\n\n protected:\n  // Creates a Test object.\n  Test();\n\n  // Sets up the test fixture.\n  virtual void SetUp();\n\n  // Tears down the test fixture.\n  virtual void TearDown();\n\n private:\n  // Returns true iff the current test has the same fixture class as\n  // the first test in the current test case.\n  static bool HasSameFixtureClass();\n\n  // Runs the test after the test fixture has been set up.\n  //\n  // A sub-class must implement this to define the test logic.\n  //\n  // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.\n  // Instead, use the TEST or TEST_F macro.\n  virtual void TestBody() = 0;\n\n  // Sets up, executes, and tears down the test.\n  void Run();\n\n  // Deletes self.  We deliberately pick an unusual name for this\n  // internal method to avoid clashing with names used in user TESTs.\n  void DeleteSelf_() { delete this; }\n\n  // Uses a GTestFlagSaver to save and restore all Google Test flags.\n  const internal::GTestFlagSaver* const gtest_flag_saver_;\n\n  // Often a user mis-spells SetUp() as Setup() and spends a long time\n  // wondering why it is never called by Google Test.  The declaration of\n  // the following method is solely for catching such an error at\n  // compile time:\n  //\n  //   - The return type is deliberately chosen to be not void, so it\n  //   will be a conflict if a user declares void Setup() in his test\n  //   fixture.\n  //\n  //   - This method is private, so it will be another compiler error\n  //   if a user calls it from his test fixture.\n  //\n  // DO NOT OVERRIDE THIS FUNCTION.\n  //\n  // If you see an error about overriding the following function or\n  // about it being private, you have mis-spelled SetUp() as Setup().\n  struct Setup_should_be_spelled_SetUp {};\n  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }\n\n  // We disallow copying Tests.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);\n};\n\ntypedef internal::TimeInMillis TimeInMillis;\n\n// A copyable object representing a user specified test property which can be\n// output as a key/value string pair.\n//\n// Don't inherit from TestProperty as its destructor is not virtual.\nclass TestProperty {\n public:\n  // C'tor.  TestProperty does NOT have a default constructor.\n  // Always use this constructor (with parameters) to create a\n  // TestProperty object.\n  TestProperty(const std::string& a_key, const std::string& a_value) :\n    key_(a_key), value_(a_value) {\n  }\n\n  // Gets the user supplied key.\n  const char* key() const {\n    return key_.c_str();\n  }\n\n  // Gets the user supplied value.\n  const char* value() const {\n    return value_.c_str();\n  }\n\n  // Sets a new value, overriding the one supplied in the constructor.\n  void SetValue(const std::string& new_value) {\n    value_ = new_value;\n  }\n\n private:\n  // The key supplied by the user.\n  std::string key_;\n  // The value supplied by the user.\n  std::string value_;\n};\n\n// The result of a single Test.  This includes a list of\n// TestPartResults, a list of TestProperties, a count of how many\n// death tests there are in the Test, and how much time it took to run\n// the Test.\n//\n// TestResult is not copyable.\nclass GTEST_API_ TestResult {\n public:\n  // Creates an empty TestResult.\n  TestResult();\n\n  // D'tor.  Do not inherit from TestResult.\n  ~TestResult();\n\n  // Gets the number of all test parts.  This is the sum of the number\n  // of successful test parts and the number of failed test parts.\n  int total_part_count() const;\n\n  // Returns the number of the test properties.\n  int test_property_count() const;\n\n  // Returns true iff the test passed (i.e. no test part failed).\n  bool Passed() const { return !Failed(); }\n\n  // Returns true iff the test failed.\n  bool Failed() const;\n\n  // Returns true iff the test fatally failed.\n  bool HasFatalFailure() const;\n\n  // Returns true iff the test has a non-fatal failure.\n  bool HasNonfatalFailure() const;\n\n  // Returns the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const { return elapsed_time_; }\n\n  // Returns the i-th test part result among all the results. i can range\n  // from 0 to test_property_count() - 1. If i is not in that range, aborts\n  // the program.\n  const TestPartResult& GetTestPartResult(int i) const;\n\n  // Returns the i-th test property. i can range from 0 to\n  // test_property_count() - 1. If i is not in that range, aborts the\n  // program.\n  const TestProperty& GetTestProperty(int i) const;\n\n private:\n  friend class TestInfo;\n  friend class TestCase;\n  friend class UnitTest;\n  friend class internal::DefaultGlobalTestPartResultReporter;\n  friend class internal::ExecDeathTest;\n  friend class internal::TestResultAccessor;\n  friend class internal::UnitTestImpl;\n  friend class internal::WindowsDeathTest;\n\n  // Gets the vector of TestPartResults.\n  const std::vector<TestPartResult>& test_part_results() const {\n    return test_part_results_;\n  }\n\n  // Gets the vector of TestProperties.\n  const std::vector<TestProperty>& test_properties() const {\n    return test_properties_;\n  }\n\n  // Sets the elapsed time.\n  void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }\n\n  // Adds a test property to the list. The property is validated and may add\n  // a non-fatal failure if invalid (e.g., if it conflicts with reserved\n  // key names). If a property is already recorded for the same key, the\n  // value will be updated, rather than storing multiple values for the same\n  // key.  xml_element specifies the element for which the property is being\n  // recorded and is used for validation.\n  void RecordProperty(const std::string& xml_element,\n                      const TestProperty& test_property);\n\n  // Adds a failure if the key is a reserved attribute of Google Test\n  // testcase tags.  Returns true if the property is valid.\n  // TODO(russr): Validate attribute names are legal and human readable.\n  static bool ValidateTestProperty(const std::string& xml_element,\n                                   const TestProperty& test_property);\n\n  // Adds a test part result to the list.\n  void AddTestPartResult(const TestPartResult& test_part_result);\n\n  // Returns the death test count.\n  int death_test_count() const { return death_test_count_; }\n\n  // Increments the death test count, returning the new count.\n  int increment_death_test_count() { return ++death_test_count_; }\n\n  // Clears the test part results.\n  void ClearTestPartResults();\n\n  // Clears the object.\n  void Clear();\n\n  // Protects mutable state of the property vector and of owned\n  // properties, whose values may be updated.\n  internal::Mutex test_properites_mutex_;\n\n  // The vector of TestPartResults\n  std::vector<TestPartResult> test_part_results_;\n  // The vector of TestProperties\n  std::vector<TestProperty> test_properties_;\n  // Running count of death tests.\n  int death_test_count_;\n  // The elapsed time, in milliseconds.\n  TimeInMillis elapsed_time_;\n\n  // We disallow copying TestResult.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);\n};  // class TestResult\n\n// A TestInfo object stores the following information about a test:\n//\n//   Test case name\n//   Test name\n//   Whether the test should be run\n//   A function pointer that creates the test object when invoked\n//   Test result\n//\n// The constructor of TestInfo registers itself with the UnitTest\n// singleton such that the RUN_ALL_TESTS() macro knows which tests to\n// run.\nclass GTEST_API_ TestInfo {\n public:\n  // Destructs a TestInfo object.  This function is not virtual, so\n  // don't inherit from TestInfo.\n  ~TestInfo();\n\n  // Returns the test case name.\n  const char* test_case_name() const { return test_case_name_.c_str(); }\n\n  // Returns the test name.\n  const char* name() const { return name_.c_str(); }\n\n  // Returns the name of the parameter type, or NULL if this is not a typed\n  // or a type-parameterized test.\n  const char* type_param() const {\n    if (type_param_.get() != NULL)\n      return type_param_->c_str();\n    return NULL;\n  }\n\n  // Returns the text representation of the value parameter, or NULL if this\n  // is not a value-parameterized test.\n  const char* value_param() const {\n    if (value_param_.get() != NULL)\n      return value_param_->c_str();\n    return NULL;\n  }\n\n  // Returns true if this test should run, that is if the test is not\n  // disabled (or it is disabled but the also_run_disabled_tests flag has\n  // been specified) and its full name matches the user-specified filter.\n  //\n  // Google Test allows the user to filter the tests by their full names.\n  // The full name of a test Bar in test case Foo is defined as\n  // \"Foo.Bar\".  Only the tests that match the filter will run.\n  //\n  // A filter is a colon-separated list of glob (not regex) patterns,\n  // optionally followed by a '-' and a colon-separated list of\n  // negative patterns (tests to exclude).  A test is run if it\n  // matches one of the positive patterns and does not match any of\n  // the negative patterns.\n  //\n  // For example, *A*:Foo.* is a filter that matches any string that\n  // contains the character 'A' or starts with \"Foo.\".\n  bool should_run() const { return should_run_; }\n\n  // Returns true iff this test will appear in the XML report.\n  bool is_reportable() const {\n    // For now, the XML report includes all tests matching the filter.\n    // In the future, we may trim tests that are excluded because of\n    // sharding.\n    return matches_filter_;\n  }\n\n  // Returns the result of the test.\n  const TestResult* result() const { return &result_; }\n\n private:\n#if GTEST_HAS_DEATH_TEST\n  friend class internal::DefaultDeathTestFactory;\n#endif  // GTEST_HAS_DEATH_TEST\n  friend class Test;\n  friend class TestCase;\n  friend class internal::UnitTestImpl;\n  friend class internal::StreamingListenerTest;\n  friend TestInfo* internal::MakeAndRegisterTestInfo(\n      const char* test_case_name,\n      const char* name,\n      const char* type_param,\n      const char* value_param,\n      internal::TypeId fixture_class_id,\n      Test::SetUpTestCaseFunc set_up_tc,\n      Test::TearDownTestCaseFunc tear_down_tc,\n      internal::TestFactoryBase* factory);\n\n  // Constructs a TestInfo object. The newly constructed instance assumes\n  // ownership of the factory object.\n  TestInfo(const std::string& test_case_name,\n           const std::string& name,\n           const char* a_type_param,   // NULL if not a type-parameterized test\n           const char* a_value_param,  // NULL if not a value-parameterized test\n           internal::TypeId fixture_class_id,\n           internal::TestFactoryBase* factory);\n\n  // Increments the number of death tests encountered in this test so\n  // far.\n  int increment_death_test_count() {\n    return result_.increment_death_test_count();\n  }\n\n  // Creates the test object, runs it, records its result, and then\n  // deletes it.\n  void Run();\n\n  static void ClearTestResult(TestInfo* test_info) {\n    test_info->result_.Clear();\n  }\n\n  // These fields are immutable properties of the test.\n  const std::string test_case_name_;     // Test case name\n  const std::string name_;               // Test name\n  // Name of the parameter type, or NULL if this is not a typed or a\n  // type-parameterized test.\n  const internal::scoped_ptr<const ::std::string> type_param_;\n  // Text representation of the value parameter, or NULL if this is not a\n  // value-parameterized test.\n  const internal::scoped_ptr<const ::std::string> value_param_;\n  const internal::TypeId fixture_class_id_;   // ID of the test fixture class\n  bool should_run_;                 // True iff this test should run\n  bool is_disabled_;                // True iff this test is disabled\n  bool matches_filter_;             // True if this test matches the\n                                    // user-specified filter.\n  internal::TestFactoryBase* const factory_;  // The factory that creates\n                                              // the test object\n\n  // This field is mutable and needs to be reset before running the\n  // test for the second time.\n  TestResult result_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);\n};\n\n// A test case, which consists of a vector of TestInfos.\n//\n// TestCase is not copyable.\nclass GTEST_API_ TestCase {\n public:\n  // Creates a TestCase with the given name.\n  //\n  // TestCase does NOT have a default constructor.  Always use this\n  // constructor to create a TestCase object.\n  //\n  // Arguments:\n  //\n  //   name:         name of the test case\n  //   a_type_param: the name of the test's type parameter, or NULL if\n  //                 this is not a type-parameterized test.\n  //   set_up_tc:    pointer to the function that sets up the test case\n  //   tear_down_tc: pointer to the function that tears down the test case\n  TestCase(const char* name, const char* a_type_param,\n           Test::SetUpTestCaseFunc set_up_tc,\n           Test::TearDownTestCaseFunc tear_down_tc);\n\n  // Destructor of TestCase.\n  virtual ~TestCase();\n\n  // Gets the name of the TestCase.\n  const char* name() const { return name_.c_str(); }\n\n  // Returns the name of the parameter type, or NULL if this is not a\n  // type-parameterized test case.\n  const char* type_param() const {\n    if (type_param_.get() != NULL)\n      return type_param_->c_str();\n    return NULL;\n  }\n\n  // Returns true if any test in this test case should run.\n  bool should_run() const { return should_run_; }\n\n  // Gets the number of successful tests in this test case.\n  int successful_test_count() const;\n\n  // Gets the number of failed tests in this test case.\n  int failed_test_count() const;\n\n  // Gets the number of disabled tests that will be reported in the XML report.\n  int reportable_disabled_test_count() const;\n\n  // Gets the number of disabled tests in this test case.\n  int disabled_test_count() const;\n\n  // Gets the number of tests to be printed in the XML report.\n  int reportable_test_count() const;\n\n  // Get the number of tests in this test case that should run.\n  int test_to_run_count() const;\n\n  // Gets the number of all tests in this test case.\n  int total_test_count() const;\n\n  // Returns true iff the test case passed.\n  bool Passed() const { return !Failed(); }\n\n  // Returns true iff the test case failed.\n  bool Failed() const { return failed_test_count() > 0; }\n\n  // Returns the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const { return elapsed_time_; }\n\n  // Returns the i-th test among all the tests. i can range from 0 to\n  // total_test_count() - 1. If i is not in that range, returns NULL.\n  const TestInfo* GetTestInfo(int i) const;\n\n  // Returns the TestResult that holds test properties recorded during\n  // execution of SetUpTestCase and TearDownTestCase.\n  const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }\n\n private:\n  friend class Test;\n  friend class internal::UnitTestImpl;\n\n  // Gets the (mutable) vector of TestInfos in this TestCase.\n  std::vector<TestInfo*>& test_info_list() { return test_info_list_; }\n\n  // Gets the (immutable) vector of TestInfos in this TestCase.\n  const std::vector<TestInfo*>& test_info_list() const {\n    return test_info_list_;\n  }\n\n  // Returns the i-th test among all the tests. i can range from 0 to\n  // total_test_count() - 1. If i is not in that range, returns NULL.\n  TestInfo* GetMutableTestInfo(int i);\n\n  // Sets the should_run member.\n  void set_should_run(bool should) { should_run_ = should; }\n\n  // Adds a TestInfo to this test case.  Will delete the TestInfo upon\n  // destruction of the TestCase object.\n  void AddTestInfo(TestInfo * test_info);\n\n  // Clears the results of all tests in this test case.\n  void ClearResult();\n\n  // Clears the results of all tests in the given test case.\n  static void ClearTestCaseResult(TestCase* test_case) {\n    test_case->ClearResult();\n  }\n\n  // Runs every test in this TestCase.\n  void Run();\n\n  // Runs SetUpTestCase() for this TestCase.  This wrapper is needed\n  // for catching exceptions thrown from SetUpTestCase().\n  void RunSetUpTestCase() { (*set_up_tc_)(); }\n\n  // Runs TearDownTestCase() for this TestCase.  This wrapper is\n  // needed for catching exceptions thrown from TearDownTestCase().\n  void RunTearDownTestCase() { (*tear_down_tc_)(); }\n\n  // Returns true iff test passed.\n  static bool TestPassed(const TestInfo* test_info) {\n    return test_info->should_run() && test_info->result()->Passed();\n  }\n\n  // Returns true iff test failed.\n  static bool TestFailed(const TestInfo* test_info) {\n    return test_info->should_run() && test_info->result()->Failed();\n  }\n\n  // Returns true iff the test is disabled and will be reported in the XML\n  // report.\n  static bool TestReportableDisabled(const TestInfo* test_info) {\n    return test_info->is_reportable() && test_info->is_disabled_;\n  }\n\n  // Returns true iff test is disabled.\n  static bool TestDisabled(const TestInfo* test_info) {\n    return test_info->is_disabled_;\n  }\n\n  // Returns true iff this test will appear in the XML report.\n  static bool TestReportable(const TestInfo* test_info) {\n    return test_info->is_reportable();\n  }\n\n  // Returns true if the given test should run.\n  static bool ShouldRunTest(const TestInfo* test_info) {\n    return test_info->should_run();\n  }\n\n  // Shuffles the tests in this test case.\n  void ShuffleTests(internal::Random* random);\n\n  // Restores the test order to before the first shuffle.\n  void UnshuffleTests();\n\n  // Name of the test case.\n  std::string name_;\n  // Name of the parameter type, or NULL if this is not a typed or a\n  // type-parameterized test.\n  const internal::scoped_ptr<const ::std::string> type_param_;\n  // The vector of TestInfos in their original order.  It owns the\n  // elements in the vector.\n  std::vector<TestInfo*> test_info_list_;\n  // Provides a level of indirection for the test list to allow easy\n  // shuffling and restoring the test order.  The i-th element in this\n  // vector is the index of the i-th test in the shuffled test list.\n  std::vector<int> test_indices_;\n  // Pointer to the function that sets up the test case.\n  Test::SetUpTestCaseFunc set_up_tc_;\n  // Pointer to the function that tears down the test case.\n  Test::TearDownTestCaseFunc tear_down_tc_;\n  // True iff any test in this test case should run.\n  bool should_run_;\n  // Elapsed time, in milliseconds.\n  TimeInMillis elapsed_time_;\n  // Holds test properties recorded during execution of SetUpTestCase and\n  // TearDownTestCase.\n  TestResult ad_hoc_test_result_;\n\n  // We disallow copying TestCases.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);\n};\n\n// An Environment object is capable of setting up and tearing down an\n// environment.  The user should subclass this to define his own\n// environment(s).\n//\n// An Environment object does the set-up and tear-down in virtual\n// methods SetUp() and TearDown() instead of the constructor and the\n// destructor, as:\n//\n//   1. You cannot safely throw from a destructor.  This is a problem\n//      as in some cases Google Test is used where exceptions are enabled, and\n//      we may want to implement ASSERT_* using exceptions where they are\n//      available.\n//   2. You cannot use ASSERT_* directly in a constructor or\n//      destructor.\nclass Environment {\n public:\n  // The d'tor is virtual as we need to subclass Environment.\n  virtual ~Environment() {}\n\n  // Override this to define how to set up the environment.\n  virtual void SetUp() {}\n\n  // Override this to define how to tear down the environment.\n  virtual void TearDown() {}\n private:\n  // If you see an error about overriding the following function or\n  // about it being private, you have mis-spelled SetUp() as Setup().\n  struct Setup_should_be_spelled_SetUp {};\n  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }\n};\n\n// The interface for tracing execution of tests. The methods are organized in\n// the order the corresponding events are fired.\nclass TestEventListener {\n public:\n  virtual ~TestEventListener() {}\n\n  // Fired before any test activity starts.\n  virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;\n\n  // Fired before each iteration of tests starts.  There may be more than\n  // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration\n  // index, starting from 0.\n  virtual void OnTestIterationStart(const UnitTest& unit_test,\n                                    int iteration) = 0;\n\n  // Fired before environment set-up for each iteration of tests starts.\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;\n\n  // Fired after environment set-up for each iteration of tests ends.\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;\n\n  // Fired before the test case starts.\n  virtual void OnTestCaseStart(const TestCase& test_case) = 0;\n\n  // Fired before the test starts.\n  virtual void OnTestStart(const TestInfo& test_info) = 0;\n\n  // Fired after a failed assertion or a SUCCEED() invocation.\n  virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;\n\n  // Fired after the test ends.\n  virtual void OnTestEnd(const TestInfo& test_info) = 0;\n\n  // Fired after the test case ends.\n  virtual void OnTestCaseEnd(const TestCase& test_case) = 0;\n\n  // Fired before environment tear-down for each iteration of tests starts.\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;\n\n  // Fired after environment tear-down for each iteration of tests ends.\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;\n\n  // Fired after each iteration of tests finishes.\n  virtual void OnTestIterationEnd(const UnitTest& unit_test,\n                                  int iteration) = 0;\n\n  // Fired after all test activities have ended.\n  virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;\n};\n\n// The convenience class for users who need to override just one or two\n// methods and are not concerned that a possible change to a signature of\n// the methods they override will not be caught during the build.  For\n// comments about each method please see the definition of TestEventListener\n// above.\nclass EmptyTestEventListener : public TestEventListener {\n public:\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,\n                                    int /*iteration*/) {}\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}\n  virtual void OnTestStart(const TestInfo& /*test_info*/) {}\n  virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}\n  virtual void OnTestEnd(const TestInfo& /*test_info*/) {}\n  virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,\n                                  int /*iteration*/) {}\n  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}\n};\n\n// TestEventListeners lets users add listeners to track events in Google Test.\nclass GTEST_API_ TestEventListeners {\n public:\n  TestEventListeners();\n  ~TestEventListeners();\n\n  // Appends an event listener to the end of the list. Google Test assumes\n  // the ownership of the listener (i.e. it will delete the listener when\n  // the test program finishes).\n  void Append(TestEventListener* listener);\n\n  // Removes the given event listener from the list and returns it.  It then\n  // becomes the caller's responsibility to delete the listener. Returns\n  // NULL if the listener is not found in the list.\n  TestEventListener* Release(TestEventListener* listener);\n\n  // Returns the standard listener responsible for the default console\n  // output.  Can be removed from the listeners list to shut down default\n  // console output.  Note that removing this object from the listener list\n  // with Release transfers its ownership to the caller and makes this\n  // function return NULL the next time.\n  TestEventListener* default_result_printer() const {\n    return default_result_printer_;\n  }\n\n  // Returns the standard listener responsible for the default XML output\n  // controlled by the --gtest_output=xml flag.  Can be removed from the\n  // listeners list by users who want to shut down the default XML output\n  // controlled by this flag and substitute it with custom one.  Note that\n  // removing this object from the listener list with Release transfers its\n  // ownership to the caller and makes this function return NULL the next\n  // time.\n  TestEventListener* default_xml_generator() const {\n    return default_xml_generator_;\n  }\n\n private:\n  friend class TestCase;\n  friend class TestInfo;\n  friend class internal::DefaultGlobalTestPartResultReporter;\n  friend class internal::NoExecDeathTest;\n  friend class internal::TestEventListenersAccessor;\n  friend class internal::UnitTestImpl;\n\n  // Returns repeater that broadcasts the TestEventListener events to all\n  // subscribers.\n  TestEventListener* repeater();\n\n  // Sets the default_result_printer attribute to the provided listener.\n  // The listener is also added to the listener list and previous\n  // default_result_printer is removed from it and deleted. The listener can\n  // also be NULL in which case it will not be added to the list. Does\n  // nothing if the previous and the current listener objects are the same.\n  void SetDefaultResultPrinter(TestEventListener* listener);\n\n  // Sets the default_xml_generator attribute to the provided listener.  The\n  // listener is also added to the listener list and previous\n  // default_xml_generator is removed from it and deleted. The listener can\n  // also be NULL in which case it will not be added to the list. Does\n  // nothing if the previous and the current listener objects are the same.\n  void SetDefaultXmlGenerator(TestEventListener* listener);\n\n  // Controls whether events will be forwarded by the repeater to the\n  // listeners in the list.\n  bool EventForwardingEnabled() const;\n  void SuppressEventForwarding();\n\n  // The actual list of listeners.\n  internal::TestEventRepeater* repeater_;\n  // Listener responsible for the standard result output.\n  TestEventListener* default_result_printer_;\n  // Listener responsible for the creation of the XML output file.\n  TestEventListener* default_xml_generator_;\n\n  // We disallow copying TestEventListeners.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);\n};\n\n// A UnitTest consists of a vector of TestCases.\n//\n// This is a singleton class.  The only instance of UnitTest is\n// created when UnitTest::GetInstance() is first called.  This\n// instance is never deleted.\n//\n// UnitTest is not copyable.\n//\n// This class is thread-safe as long as the methods are called\n// according to their specification.\nclass GTEST_API_ UnitTest {\n public:\n  // Gets the singleton UnitTest object.  The first time this method\n  // is called, a UnitTest object is constructed and returned.\n  // Consecutive calls will return the same object.\n  static UnitTest* GetInstance();\n\n  // Runs all tests in this UnitTest object and prints the result.\n  // Returns 0 if successful, or 1 otherwise.\n  //\n  // This method can only be called from the main thread.\n  //\n  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n  int Run() GTEST_MUST_USE_RESULT_;\n\n  // Returns the working directory when the first TEST() or TEST_F()\n  // was executed.  The UnitTest object owns the string.\n  const char* original_working_dir() const;\n\n  // Returns the TestCase object for the test that's currently running,\n  // or NULL if no test is running.\n  const TestCase* current_test_case() const\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Returns the TestInfo object for the test that's currently running,\n  // or NULL if no test is running.\n  const TestInfo* current_test_info() const\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Returns the random seed used at the start of the current test run.\n  int random_seed() const;\n\n#if GTEST_HAS_PARAM_TEST\n  // Returns the ParameterizedTestCaseRegistry object used to keep track of\n  // value-parameterized tests and instantiate and register them.\n  //\n  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n  internal::ParameterizedTestCaseRegistry& parameterized_test_registry()\n      GTEST_LOCK_EXCLUDED_(mutex_);\n#endif  // GTEST_HAS_PARAM_TEST\n\n  // Gets the number of successful test cases.\n  int successful_test_case_count() const;\n\n  // Gets the number of failed test cases.\n  int failed_test_case_count() const;\n\n  // Gets the number of all test cases.\n  int total_test_case_count() const;\n\n  // Gets the number of all test cases that contain at least one test\n  // that should run.\n  int test_case_to_run_count() const;\n\n  // Gets the number of successful tests.\n  int successful_test_count() const;\n\n  // Gets the number of failed tests.\n  int failed_test_count() const;\n\n  // Gets the number of disabled tests that will be reported in the XML report.\n  int reportable_disabled_test_count() const;\n\n  // Gets the number of disabled tests.\n  int disabled_test_count() const;\n\n  // Gets the number of tests to be printed in the XML report.\n  int reportable_test_count() const;\n\n  // Gets the number of all tests.\n  int total_test_count() const;\n\n  // Gets the number of tests that should run.\n  int test_to_run_count() const;\n\n  // Gets the time of the test program start, in ms from the start of the\n  // UNIX epoch.\n  TimeInMillis start_timestamp() const;\n\n  // Gets the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const;\n\n  // Returns true iff the unit test passed (i.e. all test cases passed).\n  bool Passed() const;\n\n  // Returns true iff the unit test failed (i.e. some test case failed\n  // or something outside of all tests failed).\n  bool Failed() const;\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  const TestCase* GetTestCase(int i) const;\n\n  // Returns the TestResult containing information on test failures and\n  // properties logged outside of individual test cases.\n  const TestResult& ad_hoc_test_result() const;\n\n  // Returns the list of event listeners that can be used to track events\n  // inside Google Test.\n  TestEventListeners& listeners();\n\n private:\n  // Registers and returns a global test environment.  When a test\n  // program is run, all global test environments will be set-up in\n  // the order they were registered.  After all tests in the program\n  // have finished, all global test environments will be torn-down in\n  // the *reverse* order they were registered.\n  //\n  // The UnitTest object takes ownership of the given environment.\n  //\n  // This method can only be called from the main thread.\n  Environment* AddEnvironment(Environment* env);\n\n  // Adds a TestPartResult to the current TestResult object.  All\n  // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)\n  // eventually call this to report their results.  The user code\n  // should use the assertion macros instead of calling this directly.\n  void AddTestPartResult(TestPartResult::Type result_type,\n                         const char* file_name,\n                         int line_number,\n                         const std::string& message,\n                         const std::string& os_stack_trace)\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Adds a TestProperty to the current TestResult object when invoked from\n  // inside a test, to current TestCase's ad_hoc_test_result_ when invoked\n  // from SetUpTestCase or TearDownTestCase, or to the global property set\n  // when invoked elsewhere.  If the result already contains a property with\n  // the same key, the value will be updated.\n  void RecordProperty(const std::string& key, const std::string& value);\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  TestCase* GetMutableTestCase(int i);\n\n  // Accessors for the implementation object.\n  internal::UnitTestImpl* impl() { return impl_; }\n  const internal::UnitTestImpl* impl() const { return impl_; }\n\n  // These classes and funcions are friends as they need to access private\n  // members of UnitTest.\n  friend class Test;\n  friend class internal::AssertHelper;\n  friend class internal::ScopedTrace;\n  friend class internal::StreamingListenerTest;\n  friend class internal::UnitTestRecordPropertyTestHelper;\n  friend Environment* AddGlobalTestEnvironment(Environment* env);\n  friend internal::UnitTestImpl* internal::GetUnitTestImpl();\n  friend void internal::ReportFailureInUnknownLocation(\n      TestPartResult::Type result_type,\n      const std::string& message);\n\n  // Creates an empty UnitTest.\n  UnitTest();\n\n  // D'tor\n  virtual ~UnitTest();\n\n  // Pushes a trace defined by SCOPED_TRACE() on to the per-thread\n  // Google Test trace stack.\n  void PushGTestTrace(const internal::TraceInfo& trace)\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Pops a trace from the per-thread Google Test trace stack.\n  void PopGTestTrace()\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // Protects mutable state in *impl_.  This is mutable as some const\n  // methods need to lock it too.\n  mutable internal::Mutex mutex_;\n\n  // Opaque implementation object.  This field is never changed once\n  // the object is constructed.  We don't mark it as const here, as\n  // doing so will cause a warning in the constructor of UnitTest.\n  // Mutable state in *impl_ is protected by mutex_.\n  internal::UnitTestImpl* impl_;\n\n  // We disallow copying UnitTest.\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);\n};\n\n// A convenient wrapper for adding an environment for the test\n// program.\n//\n// You should call this before RUN_ALL_TESTS() is called, probably in\n// main().  If you use gtest_main, you need to call this before main()\n// starts for it to take effect.  For example, you can define a global\n// variable like this:\n//\n//   testing::Environment* const foo_env =\n//       testing::AddGlobalTestEnvironment(new FooEnvironment);\n//\n// However, we strongly recommend you to write your own main() and\n// call AddGlobalTestEnvironment() there, as relying on initialization\n// of global variables makes the code harder to read and may cause\n// problems when you register multiple environments from different\n// translation units and the environments have dependencies among them\n// (remember that the compiler doesn't guarantee the order in which\n// global variables from different translation units are initialized).\ninline Environment* AddGlobalTestEnvironment(Environment* env) {\n  return UnitTest::GetInstance()->AddEnvironment(env);\n}\n\n// Initializes Google Test.  This must be called before calling\n// RUN_ALL_TESTS().  In particular, it parses a command line for the\n// flags that Google Test recognizes.  Whenever a Google Test flag is\n// seen, it is removed from argv, and *argc is decremented.\n//\n// No value is returned.  Instead, the Google Test flag variables are\n// updated.\n//\n// Calling the function for the second time has no user-visible effect.\nGTEST_API_ void InitGoogleTest(int* argc, char** argv);\n\n// This overloaded version can be used in Windows programs compiled in\n// UNICODE mode.\nGTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);\n\nnamespace internal {\n\n// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a\n// value of type ToPrint that is an operand of a comparison assertion\n// (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in\n// the comparison, and is used to help determine the best way to\n// format the value.  In particular, when the value is a C string\n// (char pointer) and the other operand is an STL string object, we\n// want to format the C string as a string, since we know it is\n// compared by value with the string object.  If the value is a char\n// pointer but the other operand is not an STL string object, we don't\n// know whether the pointer is supposed to point to a NUL-terminated\n// string, and thus want to print it as a pointer to be safe.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n\n// The default case.\ntemplate <typename ToPrint, typename OtherOperand>\nclass FormatForComparison {\n public:\n  static ::std::string Format(const ToPrint& value) {\n    return ::testing::PrintToString(value);\n  }\n};\n\n// Array.\ntemplate <typename ToPrint, size_t N, typename OtherOperand>\nclass FormatForComparison<ToPrint[N], OtherOperand> {\n public:\n  static ::std::string Format(const ToPrint* value) {\n    return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);\n  }\n};\n\n// By default, print C string as pointers to be safe, as we don't know\n// whether they actually point to a NUL-terminated string.\n\n#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \\\n  template <typename OtherOperand>                                      \\\n  class FormatForComparison<CharType*, OtherOperand> {                  \\\n   public:                                                              \\\n    static ::std::string Format(CharType* value) {                      \\\n      return ::testing::PrintToString(static_cast<const void*>(value)); \\\n    }                                                                   \\\n  }\n\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);\nGTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);\n\n#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_\n\n// If a C string is compared with an STL string object, we know it's meant\n// to point to a NUL-terminated string, and thus can print it as a string.\n\n#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \\\n  template <>                                                           \\\n  class FormatForComparison<CharType*, OtherStringType> {               \\\n   public:                                                              \\\n    static ::std::string Format(CharType* value) {                      \\\n      return ::testing::PrintToString(value);                           \\\n    }                                                                   \\\n  }\n\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);\n\n#if GTEST_HAS_GLOBAL_STRING\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);\n#endif\n\n#if GTEST_HAS_GLOBAL_WSTRING\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);\n#endif\n\n#if GTEST_HAS_STD_WSTRING\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);\nGTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);\n#endif\n\n#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_\n\n// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)\n// operand to be used in a failure message.  The type (but not value)\n// of the other operand may affect the format.  This allows us to\n// print a char* as a raw pointer when it is compared against another\n// char* or void*, and print it as a C string when it is compared\n// against an std::string object, for example.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\ntemplate <typename T1, typename T2>\nstd::string FormatForComparisonFailureMessage(\n    const T1& value, const T2& /* other_operand */) {\n  return FormatForComparison<T1, T2>::Format(value);\n}\n\n// The helper function for {ASSERT|EXPECT}_EQ.\ntemplate <typename T1, typename T2>\nAssertionResult CmpHelperEQ(const char* expected_expression,\n                            const char* actual_expression,\n                            const T1& expected,\n                            const T2& actual) {\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4389)  // Temporarily disables warning on\n                                // signed/unsigned mismatch.\n#endif\n\n  if (expected == actual) {\n    return AssertionSuccess();\n  }\n\n#ifdef _MSC_VER\n# pragma warning(pop)          // Restores the warning state.\n#endif\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   FormatForComparisonFailureMessage(expected, actual),\n                   FormatForComparisonFailureMessage(actual, expected),\n                   false);\n}\n\n// With this overloaded version, we allow anonymous enums to be used\n// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums\n// can be implicitly cast to BiggestInt.\nGTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,\n                                       const char* actual_expression,\n                                       BiggestInt expected,\n                                       BiggestInt actual);\n\n// The helper class for {ASSERT|EXPECT}_EQ.  The template argument\n// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()\n// is a null pointer literal.  The following default implementation is\n// for lhs_is_null_literal being false.\ntemplate <bool lhs_is_null_literal>\nclass EqHelper {\n public:\n  // This templatized version is for the general case.\n  template <typename T1, typename T2>\n  static AssertionResult Compare(const char* expected_expression,\n                                 const char* actual_expression,\n                                 const T1& expected,\n                                 const T2& actual) {\n    return CmpHelperEQ(expected_expression, actual_expression, expected,\n                       actual);\n  }\n\n  // With this overloaded version, we allow anonymous enums to be used\n  // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous\n  // enums can be implicitly cast to BiggestInt.\n  //\n  // Even though its body looks the same as the above version, we\n  // cannot merge the two, as it will make anonymous enums unhappy.\n  static AssertionResult Compare(const char* expected_expression,\n                                 const char* actual_expression,\n                                 BiggestInt expected,\n                                 BiggestInt actual) {\n    return CmpHelperEQ(expected_expression, actual_expression, expected,\n                       actual);\n  }\n};\n\n// This specialization is used when the first argument to ASSERT_EQ()\n// is a null pointer literal, like NULL, false, or 0.\ntemplate <>\nclass EqHelper<true> {\n public:\n  // We define two overloaded versions of Compare().  The first\n  // version will be picked when the second argument to ASSERT_EQ() is\n  // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or\n  // EXPECT_EQ(false, a_bool).\n  template <typename T1, typename T2>\n  static AssertionResult Compare(\n      const char* expected_expression,\n      const char* actual_expression,\n      const T1& expected,\n      const T2& actual,\n      // The following line prevents this overload from being considered if T2\n      // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)\n      // expands to Compare(\"\", \"\", NULL, my_ptr), which requires a conversion\n      // to match the Secret* in the other overload, which would otherwise make\n      // this template match better.\n      typename EnableIf<!is_pointer<T2>::value>::type* = 0) {\n    return CmpHelperEQ(expected_expression, actual_expression, expected,\n                       actual);\n  }\n\n  // This version will be picked when the second argument to ASSERT_EQ() is a\n  // pointer, e.g. ASSERT_EQ(NULL, a_pointer).\n  template <typename T>\n  static AssertionResult Compare(\n      const char* expected_expression,\n      const char* actual_expression,\n      // We used to have a second template parameter instead of Secret*.  That\n      // template parameter would deduce to 'long', making this a better match\n      // than the first overload even without the first overload's EnableIf.\n      // Unfortunately, gcc with -Wconversion-null warns when \"passing NULL to\n      // non-pointer argument\" (even a deduced integral argument), so the old\n      // implementation caused warnings in user code.\n      Secret* /* expected (NULL) */,\n      T* actual) {\n    // We already know that 'expected' is a null pointer.\n    return CmpHelperEQ(expected_expression, actual_expression,\n                       static_cast<T*>(NULL), actual);\n  }\n};\n\n// A macro for implementing the helper functions needed to implement\n// ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste\n// of similar code.\n//\n// For each templatized helper function, we also define an overloaded\n// version for BiggestInt in order to reduce code bloat and allow\n// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled\n// with gcc 4.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n#define GTEST_IMPL_CMP_HELPER_(op_name, op)\\\ntemplate <typename T1, typename T2>\\\nAssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \\\n                                   const T1& val1, const T2& val2) {\\\n  if (val1 op val2) {\\\n    return AssertionSuccess();\\\n  } else {\\\n    return AssertionFailure() \\\n        << \"Expected: (\" << expr1 << \") \" #op \" (\" << expr2\\\n        << \"), actual: \" << FormatForComparisonFailureMessage(val1, val2)\\\n        << \" vs \" << FormatForComparisonFailureMessage(val2, val1);\\\n  }\\\n}\\\nGTEST_API_ AssertionResult CmpHelper##op_name(\\\n    const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\n\n// Implements the helper function for {ASSERT|EXPECT}_NE\nGTEST_IMPL_CMP_HELPER_(NE, !=);\n// Implements the helper function for {ASSERT|EXPECT}_LE\nGTEST_IMPL_CMP_HELPER_(LE, <=);\n// Implements the helper function for {ASSERT|EXPECT}_LT\nGTEST_IMPL_CMP_HELPER_(LT, <);\n// Implements the helper function for {ASSERT|EXPECT}_GE\nGTEST_IMPL_CMP_HELPER_(GE, >=);\n// Implements the helper function for {ASSERT|EXPECT}_GT\nGTEST_IMPL_CMP_HELPER_(GT, >);\n\n#undef GTEST_IMPL_CMP_HELPER_\n\n// The helper function for {ASSERT|EXPECT}_STREQ.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,\n                                          const char* actual_expression,\n                                          const char* expected,\n                                          const char* actual);\n\n// The helper function for {ASSERT|EXPECT}_STRCASEEQ.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,\n                                              const char* actual_expression,\n                                              const char* expected,\n                                              const char* actual);\n\n// The helper function for {ASSERT|EXPECT}_STRNE.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,\n                                          const char* s2_expression,\n                                          const char* s1,\n                                          const char* s2);\n\n// The helper function for {ASSERT|EXPECT}_STRCASENE.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,\n                                              const char* s2_expression,\n                                              const char* s1,\n                                              const char* s2);\n\n\n// Helper function for *_STREQ on wide strings.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,\n                                          const char* actual_expression,\n                                          const wchar_t* expected,\n                                          const wchar_t* actual);\n\n// Helper function for *_STRNE on wide strings.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,\n                                          const char* s2_expression,\n                                          const wchar_t* s1,\n                                          const wchar_t* s2);\n\n}  // namespace internal\n\n// IsSubstring() and IsNotSubstring() are intended to be used as the\n// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by\n// themselves.  They check whether needle is a substring of haystack\n// (NULL is considered a substring of itself only), and return an\n// appropriate error message when they fail.\n//\n// The {needle,haystack}_expr arguments are the stringified\n// expressions that generated the two real arguments.\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack);\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack);\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack);\n\n#if GTEST_HAS_STD_WSTRING\nGTEST_API_ AssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack);\nGTEST_API_ AssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack);\n#endif  // GTEST_HAS_STD_WSTRING\n\nnamespace internal {\n\n// Helper template function for comparing floating-points.\n//\n// Template parameter:\n//\n//   RawType: the raw floating-point type (either float or double)\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\ntemplate <typename RawType>\nAssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,\n                                         const char* actual_expression,\n                                         RawType expected,\n                                         RawType actual) {\n  const FloatingPoint<RawType> lhs(expected), rhs(actual);\n\n  if (lhs.AlmostEquals(rhs)) {\n    return AssertionSuccess();\n  }\n\n  ::std::stringstream expected_ss;\n  expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n              << expected;\n\n  ::std::stringstream actual_ss;\n  actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n            << actual;\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   StringStreamToString(&expected_ss),\n                   StringStreamToString(&actual_ss),\n                   false);\n}\n\n// Helper function for implementing ASSERT_NEAR.\n//\n// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.\nGTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,\n                                                const char* expr2,\n                                                const char* abs_error_expr,\n                                                double val1,\n                                                double val2,\n                                                double abs_error);\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n// A class that enables one to stream messages to assertion macros\nclass GTEST_API_ AssertHelper {\n public:\n  // Constructor.\n  AssertHelper(TestPartResult::Type type,\n               const char* file,\n               int line,\n               const char* message);\n  ~AssertHelper();\n\n  // Message assignment is a semantic trick to enable assertion\n  // streaming; see the GTEST_MESSAGE_ macro below.\n  void operator=(const Message& message) const;\n\n private:\n  // We put our data in a struct so that the size of the AssertHelper class can\n  // be as small as possible.  This is important because gcc is incapable of\n  // re-using stack space even for temporary variables, so every EXPECT_EQ\n  // reserves stack space for another AssertHelper.\n  struct AssertHelperData {\n    AssertHelperData(TestPartResult::Type t,\n                     const char* srcfile,\n                     int line_num,\n                     const char* msg)\n        : type(t), file(srcfile), line(line_num), message(msg) { }\n\n    TestPartResult::Type const type;\n    const char* const file;\n    int const line;\n    std::string const message;\n\n   private:\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);\n  };\n\n  AssertHelperData* const data_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);\n};\n\n}  // namespace internal\n\n#if GTEST_HAS_PARAM_TEST\n// The pure interface class that all value-parameterized tests inherit from.\n// A value-parameterized class must inherit from both ::testing::Test and\n// ::testing::WithParamInterface. In most cases that just means inheriting\n// from ::testing::TestWithParam, but more complicated test hierarchies\n// may need to inherit from Test and WithParamInterface at different levels.\n//\n// This interface has support for accessing the test parameter value via\n// the GetParam() method.\n//\n// Use it with one of the parameter generator defining functions, like Range(),\n// Values(), ValuesIn(), Bool(), and Combine().\n//\n// class FooTest : public ::testing::TestWithParam<int> {\n//  protected:\n//   FooTest() {\n//     // Can use GetParam() here.\n//   }\n//   virtual ~FooTest() {\n//     // Can use GetParam() here.\n//   }\n//   virtual void SetUp() {\n//     // Can use GetParam() here.\n//   }\n//   virtual void TearDown {\n//     // Can use GetParam() here.\n//   }\n// };\n// TEST_P(FooTest, DoesBar) {\n//   // Can use GetParam() method here.\n//   Foo foo;\n//   ASSERT_TRUE(foo.DoesBar(GetParam()));\n// }\n// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));\n\ntemplate <typename T>\nclass WithParamInterface {\n public:\n  typedef T ParamType;\n  virtual ~WithParamInterface() {}\n\n  // The current parameter value. Is also available in the test fixture's\n  // constructor. This member function is non-static, even though it only\n  // references static data, to reduce the opportunity for incorrect uses\n  // like writing 'WithParamInterface<bool>::GetParam()' for a test that\n  // uses a fixture whose parameter type is int.\n  const ParamType& GetParam() const {\n    GTEST_CHECK_(parameter_ != NULL)\n        << \"GetParam() can only be called inside a value-parameterized test \"\n        << \"-- did you intend to write TEST_P instead of TEST_F?\";\n    return *parameter_;\n  }\n\n private:\n  // Sets parameter value. The caller is responsible for making sure the value\n  // remains alive and unchanged throughout the current test.\n  static void SetParam(const ParamType* parameter) {\n    parameter_ = parameter;\n  }\n\n  // Static value used for accessing parameter during a test lifetime.\n  static const ParamType* parameter_;\n\n  // TestClass must be a subclass of WithParamInterface<T> and Test.\n  template <class TestClass> friend class internal::ParameterizedTestFactory;\n};\n\ntemplate <typename T>\nconst T* WithParamInterface<T>::parameter_ = NULL;\n\n// Most value-parameterized classes can ignore the existence of\n// WithParamInterface, and can just inherit from ::testing::TestWithParam.\n\ntemplate <typename T>\nclass TestWithParam : public Test, public WithParamInterface<T> {\n};\n\n#endif  // GTEST_HAS_PARAM_TEST\n\n// Macros for indicating success/failure in test code.\n\n// ADD_FAILURE unconditionally adds a failure to the current test.\n// SUCCEED generates a success - it doesn't automatically make the\n// current test successful, as a test is only successful when it has\n// no failure.\n//\n// EXPECT_* verifies that a certain condition is satisfied.  If not,\n// it behaves like ADD_FAILURE.  In particular:\n//\n//   EXPECT_TRUE  verifies that a Boolean condition is true.\n//   EXPECT_FALSE verifies that a Boolean condition is false.\n//\n// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except\n// that they will also abort the current function on failure.  People\n// usually want the fail-fast behavior of FAIL and ASSERT_*, but those\n// writing data-driven tests often find themselves using ADD_FAILURE\n// and EXPECT_* more.\n\n// Generates a nonfatal failure with a generic message.\n#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_(\"Failed\")\n\n// Generates a nonfatal failure at the given source file location with\n// a generic message.\n#define ADD_FAILURE_AT(file, line) \\\n  GTEST_MESSAGE_AT_(file, line, \"Failed\", \\\n                    ::testing::TestPartResult::kNonFatalFailure)\n\n// Generates a fatal failure with a generic message.\n#define GTEST_FAIL() GTEST_FATAL_FAILURE_(\"Failed\")\n\n// Define this macro to 1 to omit the definition of FAIL(), which is a\n// generic name and clashes with some other libraries.\n#if !GTEST_DONT_DEFINE_FAIL\n# define FAIL() GTEST_FAIL()\n#endif\n\n// Generates a success with a generic message.\n#define GTEST_SUCCEED() GTEST_SUCCESS_(\"Succeeded\")\n\n// Define this macro to 1 to omit the definition of SUCCEED(), which\n// is a generic name and clashes with some other libraries.\n#if !GTEST_DONT_DEFINE_SUCCEED\n# define SUCCEED() GTEST_SUCCEED()\n#endif\n\n// Macros for testing exceptions.\n//\n//    * {ASSERT|EXPECT}_THROW(statement, expected_exception):\n//         Tests that the statement throws the expected exception.\n//    * {ASSERT|EXPECT}_NO_THROW(statement):\n//         Tests that the statement doesn't throw any exception.\n//    * {ASSERT|EXPECT}_ANY_THROW(statement):\n//         Tests that the statement throws an exception.\n\n#define EXPECT_THROW(statement, expected_exception) \\\n  GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_NO_THROW(statement) \\\n  GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_ANY_THROW(statement) \\\n  GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_THROW(statement, expected_exception) \\\n  GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)\n#define ASSERT_NO_THROW(statement) \\\n  GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)\n#define ASSERT_ANY_THROW(statement) \\\n  GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)\n\n// Boolean assertions. Condition can be either a Boolean expression or an\n// AssertionResult. For more information on how to use AssertionResult with\n// these macros see comments on that class.\n#define EXPECT_TRUE(condition) \\\n  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \\\n                      GTEST_NONFATAL_FAILURE_)\n#define EXPECT_FALSE(condition) \\\n  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \\\n                      GTEST_NONFATAL_FAILURE_)\n#define ASSERT_TRUE(condition) \\\n  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \\\n                      GTEST_FATAL_FAILURE_)\n#define ASSERT_FALSE(condition) \\\n  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \\\n                      GTEST_FATAL_FAILURE_)\n\n// Includes the auto-generated header that implements a family of\n// generic predicate assertion macros.\n#include \"gtest/gtest_pred_impl.h\"\n\n// Macros for testing equalities and inequalities.\n//\n//    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual\n//    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2\n//    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 < v2\n//    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 <= v2\n//    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 > v2\n//    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 >= v2\n//\n// When they are not, Google Test prints both the tested expressions and\n// their actual values.  The values must be compatible built-in types,\n// or you will get a compiler error.  By \"compatible\" we mean that the\n// values can be compared by the respective operator.\n//\n// Note:\n//\n//   1. It is possible to make a user-defined type work with\n//   {ASSERT|EXPECT}_??(), but that requires overloading the\n//   comparison operators and is thus discouraged by the Google C++\n//   Usage Guide.  Therefore, you are advised to use the\n//   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are\n//   equal.\n//\n//   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on\n//   pointers (in particular, C strings).  Therefore, if you use it\n//   with two C strings, you are testing how their locations in memory\n//   are related, not how their content is related.  To compare two C\n//   strings by content, use {ASSERT|EXPECT}_STR*().\n//\n//   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to\n//   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you\n//   what the actual value is when it fails, and similarly for the\n//   other comparisons.\n//\n//   4. Do not depend on the order in which {ASSERT|EXPECT}_??()\n//   evaluate their arguments, which is undefined.\n//\n//   5. These macros evaluate their arguments exactly once.\n//\n// Examples:\n//\n//   EXPECT_NE(5, Foo());\n//   EXPECT_EQ(NULL, a_pointer);\n//   ASSERT_LT(i, array_size);\n//   ASSERT_GT(records.size(), 0) << \"There is no record left.\";\n\n#define EXPECT_EQ(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal:: \\\n                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \\\n                      expected, actual)\n#define EXPECT_NE(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)\n#define EXPECT_LE(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)\n#define EXPECT_LT(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)\n#define EXPECT_GE(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)\n#define EXPECT_GT(val1, val2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)\n\n#define GTEST_ASSERT_EQ(expected, actual) \\\n  ASSERT_PRED_FORMAT2(::testing::internal:: \\\n                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \\\n                      expected, actual)\n#define GTEST_ASSERT_NE(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)\n#define GTEST_ASSERT_LE(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)\n#define GTEST_ASSERT_LT(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)\n#define GTEST_ASSERT_GE(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)\n#define GTEST_ASSERT_GT(val1, val2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)\n\n// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of\n// ASSERT_XY(), which clashes with some users' own code.\n\n#if !GTEST_DONT_DEFINE_ASSERT_EQ\n# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_NE\n# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_LE\n# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_LT\n# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_GE\n# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)\n#endif\n\n#if !GTEST_DONT_DEFINE_ASSERT_GT\n# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)\n#endif\n\n// C-string Comparisons.  All tests treat NULL and any non-NULL string\n// as different.  Two NULLs are equal.\n//\n//    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2\n//    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2\n//    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case\n//    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case\n//\n// For wide or narrow string objects, you can use the\n// {ASSERT|EXPECT}_??() macros.\n//\n// Don't depend on the order in which the arguments are evaluated,\n// which is undefined.\n//\n// These macros evaluate their arguments exactly once.\n\n#define EXPECT_STREQ(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)\n#define EXPECT_STRNE(s1, s2) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)\n#define EXPECT_STRCASEEQ(expected, actual) \\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)\n#define EXPECT_STRCASENE(s1, s2)\\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)\n\n#define ASSERT_STREQ(expected, actual) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)\n#define ASSERT_STRNE(s1, s2) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)\n#define ASSERT_STRCASEEQ(expected, actual) \\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)\n#define ASSERT_STRCASENE(s1, s2)\\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)\n\n// Macros for comparing floating-point numbers.\n//\n//    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):\n//         Tests that two float values are almost equal.\n//    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):\n//         Tests that two double values are almost equal.\n//    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):\n//         Tests that v1 and v2 are within the given distance to each other.\n//\n// Google Test uses ULP-based comparison to automatically pick a default\n// error bound that is appropriate for the operands.  See the\n// FloatingPoint template class in gtest-internal.h if you are\n// interested in the implementation details.\n\n#define EXPECT_FLOAT_EQ(expected, actual)\\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \\\n                      expected, actual)\n\n#define EXPECT_DOUBLE_EQ(expected, actual)\\\n  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \\\n                      expected, actual)\n\n#define ASSERT_FLOAT_EQ(expected, actual)\\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \\\n                      expected, actual)\n\n#define ASSERT_DOUBLE_EQ(expected, actual)\\\n  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \\\n                      expected, actual)\n\n#define EXPECT_NEAR(val1, val2, abs_error)\\\n  EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \\\n                      val1, val2, abs_error)\n\n#define ASSERT_NEAR(val1, val2, abs_error)\\\n  ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \\\n                      val1, val2, abs_error)\n\n// These predicate format functions work on floating-point values, and\n// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.\n//\n//   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);\n\n// Asserts that val1 is less than, or almost equal to, val2.  Fails\n// otherwise.  In particular, it fails if either val1 or val2 is NaN.\nGTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,\n                                   float val1, float val2);\nGTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,\n                                    double val1, double val2);\n\n\n#if GTEST_OS_WINDOWS\n\n// Macros that test for HRESULT failure and success, these are only useful\n// on Windows, and rely on Windows SDK macros and APIs to compile.\n//\n//    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)\n//\n// When expr unexpectedly fails or succeeds, Google Test prints the\n// expected result and the actual result with both a human-readable\n// string representation of the error, if available, as well as the\n// hex result code.\n# define EXPECT_HRESULT_SUCCEEDED(expr) \\\n    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))\n\n# define ASSERT_HRESULT_SUCCEEDED(expr) \\\n    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))\n\n# define EXPECT_HRESULT_FAILED(expr) \\\n    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))\n\n# define ASSERT_HRESULT_FAILED(expr) \\\n    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))\n\n#endif  // GTEST_OS_WINDOWS\n\n// Macros that execute statement and check that it doesn't generate new fatal\n// failures in the current thread.\n//\n//   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);\n//\n// Examples:\n//\n//   EXPECT_NO_FATAL_FAILURE(Process());\n//   ASSERT_NO_FATAL_FAILURE(Process()) << \"Process() failed\";\n//\n#define ASSERT_NO_FATAL_FAILURE(statement) \\\n    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)\n#define EXPECT_NO_FATAL_FAILURE(statement) \\\n    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)\n\n// Causes a trace (including the source file path, the current line\n// number, and the given message) to be included in every test failure\n// message generated by code in the current scope.  The effect is\n// undone when the control leaves the current scope.\n//\n// The message argument can be anything streamable to std::ostream.\n//\n// In the implementation, we include the current line number as part\n// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s\n// to appear in the same block - as long as they are on different\n// lines.\n#define SCOPED_TRACE(message) \\\n  ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\\\n    __FILE__, __LINE__, ::testing::Message() << (message))\n\n// Compile-time assertion for type equality.\n// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are\n// the same type.  The value it returns is not interesting.\n//\n// Instead of making StaticAssertTypeEq a class template, we make it a\n// function template that invokes a helper class template.  This\n// prevents a user from misusing StaticAssertTypeEq<T1, T2> by\n// defining objects of that type.\n//\n// CAVEAT:\n//\n// When used inside a method of a class template,\n// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is\n// instantiated.  For example, given:\n//\n//   template <typename T> class Foo {\n//    public:\n//     void Bar() { testing::StaticAssertTypeEq<int, T>(); }\n//   };\n//\n// the code:\n//\n//   void Test1() { Foo<bool> foo; }\n//\n// will NOT generate a compiler error, as Foo<bool>::Bar() is never\n// actually instantiated.  Instead, you need:\n//\n//   void Test2() { Foo<bool> foo; foo.Bar(); }\n//\n// to cause a compiler error.\ntemplate <typename T1, typename T2>\nbool StaticAssertTypeEq() {\n  (void)internal::StaticAssertTypeEqHelper<T1, T2>();\n  return true;\n}\n\n// Defines a test.\n//\n// The first parameter is the name of the test case, and the second\n// parameter is the name of the test within the test case.\n//\n// The convention is to end the test case name with \"Test\".  For\n// example, a test case for the Foo class can be named FooTest.\n//\n// The user should put his test code between braces after using this\n// macro.  Example:\n//\n//   TEST(FooTest, InitializesCorrectly) {\n//     Foo foo;\n//     EXPECT_TRUE(foo.StatusIsOK());\n//   }\n\n// Note that we call GetTestTypeId() instead of GetTypeId<\n// ::testing::Test>() here to get the type ID of testing::Test.  This\n// is to work around a suspected linker bug when using Google Test as\n// a framework on Mac OS X.  The bug causes GetTypeId<\n// ::testing::Test>() to return different values depending on whether\n// the call is from the Google Test framework itself or from user test\n// code.  GetTestTypeId() is guaranteed to always return the same\n// value, as it always calls GetTypeId<>() from the Google Test\n// framework.\n#define GTEST_TEST(test_case_name, test_name)\\\n  GTEST_TEST_(test_case_name, test_name, \\\n              ::testing::Test, ::testing::internal::GetTestTypeId())\n\n// Define this macro to 1 to omit the definition of TEST(), which\n// is a generic name and clashes with some other libraries.\n#if !GTEST_DONT_DEFINE_TEST\n# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)\n#endif\n\n// Defines a test that uses a test fixture.\n//\n// The first parameter is the name of the test fixture class, which\n// also doubles as the test case name.  The second parameter is the\n// name of the test within the test case.\n//\n// A test fixture class must be declared earlier.  The user should put\n// his test code between braces after using this macro.  Example:\n//\n//   class FooTest : public testing::Test {\n//    protected:\n//     virtual void SetUp() { b_.AddElement(3); }\n//\n//     Foo a_;\n//     Foo b_;\n//   };\n//\n//   TEST_F(FooTest, InitializesCorrectly) {\n//     EXPECT_TRUE(a_.StatusIsOK());\n//   }\n//\n//   TEST_F(FooTest, ReturnsElementCountCorrectly) {\n//     EXPECT_EQ(0, a_.size());\n//     EXPECT_EQ(1, b_.size());\n//   }\n\n#define TEST_F(test_fixture, test_name)\\\n  GTEST_TEST_(test_fixture, test_name, test_fixture, \\\n              ::testing::internal::GetTypeId<test_fixture>())\n\n}  // namespace testing\n\n// Use this function in main() to run all tests.  It returns 0 if all\n// tests are successful, or 1 otherwise.\n//\n// RUN_ALL_TESTS() should be invoked after the command line has been\n// parsed by InitGoogleTest().\n//\n// This function was formerly a macro; thus, it is in the global\n// namespace and has an all-caps name.\nint RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;\n\ninline int RUN_ALL_TESTS() {\n  return ::testing::UnitTest::GetInstance()->Run();\n}\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest_pred_impl.h",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command\n// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!\n//\n// Implements a family of generic predicate assertion macros.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n\n// Makes sure this header is not included before gtest.h.\n#ifndef GTEST_INCLUDE_GTEST_GTEST_H_\n# error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.\n#endif  // GTEST_INCLUDE_GTEST_GTEST_H_\n\n// This header implements a family of generic predicate assertion\n// macros:\n//\n//   ASSERT_PRED_FORMAT1(pred_format, v1)\n//   ASSERT_PRED_FORMAT2(pred_format, v1, v2)\n//   ...\n//\n// where pred_format is a function or functor that takes n (in the\n// case of ASSERT_PRED_FORMATn) values and their source expression\n// text, and returns a testing::AssertionResult.  See the definition\n// of ASSERT_EQ in gtest.h for an example.\n//\n// If you don't care about formatting, you can use the more\n// restrictive version:\n//\n//   ASSERT_PRED1(pred, v1)\n//   ASSERT_PRED2(pred, v1, v2)\n//   ...\n//\n// where pred is an n-ary function or functor that returns bool,\n// and the values v1, v2, ..., must support the << operator for\n// streaming to std::ostream.\n//\n// We also define the EXPECT_* variations.\n//\n// For now we only support predicates whose arity is at most 5.\n// Please email googletestframework@googlegroups.com if you need\n// support for higher arities.\n\n// GTEST_ASSERT_ is the basic statement to which all of the assertions\n// in this file reduce.  Don't use this in your code.\n\n#define GTEST_ASSERT_(expression, on_failure) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (const ::testing::AssertionResult gtest_ar = (expression)) \\\n    ; \\\n  else \\\n    on_failure(gtest_ar.failure_message())\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1>\nAssertionResult AssertPred1Helper(const char* pred_text,\n                                  const char* e1,\n                                  Pred pred,\n                                  const T1& v1) {\n  if (pred(v1)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, v1), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use\n// this in your code.\n#define GTEST_PRED1_(pred, v1, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \\\n                                             #v1, \\\n                                             pred, \\\n                                             v1), on_failure)\n\n// Unary predicate assertion macros.\n#define EXPECT_PRED_FORMAT1(pred_format, v1) \\\n  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED1(pred, v1) \\\n  GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT1(pred_format, v1) \\\n  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED1(pred, v1) \\\n  GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2>\nAssertionResult AssertPred2Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2) {\n  if (pred(v1, v2)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use\n// this in your code.\n#define GTEST_PRED2_(pred, v1, v2, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2), on_failure)\n\n// Binary predicate assertion macros.\n#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \\\n  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED2(pred, v1, v2) \\\n  GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \\\n  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED2(pred, v1, v2) \\\n  GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2,\n          typename T3>\nAssertionResult AssertPred3Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  const char* e3,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2,\n                                  const T3& v3) {\n  if (pred(v1, v2, v3)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \", \"\n                            << e3 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2\n                            << \"\\n\" << e3 << \" evaluates to \" << v3;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use\n// this in your code.\n#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             #v3, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2, \\\n                                             v3), on_failure)\n\n// Ternary predicate assertion macros.\n#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \\\n  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED3(pred, v1, v2, v3) \\\n  GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \\\n  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED3(pred, v1, v2, v3) \\\n  GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2,\n          typename T3,\n          typename T4>\nAssertionResult AssertPred4Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  const char* e3,\n                                  const char* e4,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2,\n                                  const T3& v3,\n                                  const T4& v4) {\n  if (pred(v1, v2, v3, v4)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \", \"\n                            << e3 << \", \"\n                            << e4 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2\n                            << \"\\n\" << e3 << \" evaluates to \" << v3\n                            << \"\\n\" << e4 << \" evaluates to \" << v4;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use\n// this in your code.\n#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             #v3, \\\n                                             #v4, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2, \\\n                                             v3, \\\n                                             v4), on_failure)\n\n// 4-ary predicate assertion macros.\n#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \\\n  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED4(pred, v1, v2, v3, v4) \\\n  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \\\n  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED4(pred, v1, v2, v3, v4) \\\n  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)\n\n\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use\n// this in your code.\ntemplate <typename Pred,\n          typename T1,\n          typename T2,\n          typename T3,\n          typename T4,\n          typename T5>\nAssertionResult AssertPred5Helper(const char* pred_text,\n                                  const char* e1,\n                                  const char* e2,\n                                  const char* e3,\n                                  const char* e4,\n                                  const char* e5,\n                                  Pred pred,\n                                  const T1& v1,\n                                  const T2& v2,\n                                  const T3& v3,\n                                  const T4& v4,\n                                  const T5& v5) {\n  if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();\n\n  return AssertionFailure() << pred_text << \"(\"\n                            << e1 << \", \"\n                            << e2 << \", \"\n                            << e3 << \", \"\n                            << e4 << \", \"\n                            << e5 << \") evaluates to false, where\"\n                            << \"\\n\" << e1 << \" evaluates to \" << v1\n                            << \"\\n\" << e2 << \" evaluates to \" << v2\n                            << \"\\n\" << e3 << \" evaluates to \" << v3\n                            << \"\\n\" << e4 << \" evaluates to \" << v4\n                            << \"\\n\" << e5 << \" evaluates to \" << v5;\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\\\n  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use\n// this in your code.\n#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\\\n  GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \\\n                                             #v1, \\\n                                             #v2, \\\n                                             #v3, \\\n                                             #v4, \\\n                                             #v5, \\\n                                             pred, \\\n                                             v1, \\\n                                             v2, \\\n                                             v3, \\\n                                             v4, \\\n                                             v5), on_failure)\n\n// 5-ary predicate assertion macros.\n#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \\\n  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \\\n  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \\\n  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \\\n  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)\n\n\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/gtest_prod.h",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Google C++ Testing Framework definitions useful in production code.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_\n\n// When you need to test the private or protected members of a class,\n// use the FRIEND_TEST macro to declare your tests as friends of the\n// class.  For example:\n//\n// class MyClass {\n//  private:\n//   void MyMethod();\n//   FRIEND_TEST(MyClassTest, MyMethod);\n// };\n//\n// class MyClassTest : public testing::Test {\n//   // ...\n// };\n//\n// TEST_F(MyClassTest, MyMethod) {\n//   // Can call MyClass::MyMethod() here.\n// }\n\n#define FRIEND_TEST(test_case_name, test_name)\\\nfriend class test_case_name##_##test_name##_Test\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-death-test-internal.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file defines internal utilities needed for implementing\n// death tests.  They are subject to change without notice.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_\n\n#include \"gtest/internal/gtest-internal.h\"\n\n#include <stdio.h>\n\nnamespace testing {\nnamespace internal {\n\nGTEST_DECLARE_string_(internal_run_death_test);\n\n// Names of the flags (needed for parsing Google Test flags).\nconst char kDeathTestStyleFlag[] = \"death_test_style\";\nconst char kDeathTestUseFork[] = \"death_test_use_fork\";\nconst char kInternalRunDeathTestFlag[] = \"internal_run_death_test\";\n\n#if GTEST_HAS_DEATH_TEST\n\n// DeathTest is a class that hides much of the complexity of the\n// GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method\n// returns a concrete class that depends on the prevailing death test\n// style, as defined by the --gtest_death_test_style and/or\n// --gtest_internal_run_death_test flags.\n\n// In describing the results of death tests, these terms are used with\n// the corresponding definitions:\n//\n// exit status:  The integer exit information in the format specified\n//               by wait(2)\n// exit code:    The integer code passed to exit(3), _exit(2), or\n//               returned from main()\nclass GTEST_API_ DeathTest {\n public:\n  // Create returns false if there was an error determining the\n  // appropriate action to take for the current death test; for example,\n  // if the gtest_death_test_style flag is set to an invalid value.\n  // The LastMessage method will return a more detailed message in that\n  // case.  Otherwise, the DeathTest pointer pointed to by the \"test\"\n  // argument is set.  If the death test should be skipped, the pointer\n  // is set to NULL; otherwise, it is set to the address of a new concrete\n  // DeathTest object that controls the execution of the current test.\n  static bool Create(const char* statement, const RE* regex,\n                     const char* file, int line, DeathTest** test);\n  DeathTest();\n  virtual ~DeathTest() { }\n\n  // A helper class that aborts a death test when it's deleted.\n  class ReturnSentinel {\n   public:\n    explicit ReturnSentinel(DeathTest* test) : test_(test) { }\n    ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }\n   private:\n    DeathTest* const test_;\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);\n  } GTEST_ATTRIBUTE_UNUSED_;\n\n  // An enumeration of possible roles that may be taken when a death\n  // test is encountered.  EXECUTE means that the death test logic should\n  // be executed immediately.  OVERSEE means that the program should prepare\n  // the appropriate environment for a child process to execute the death\n  // test, then wait for it to complete.\n  enum TestRole { OVERSEE_TEST, EXECUTE_TEST };\n\n  // An enumeration of the three reasons that a test might be aborted.\n  enum AbortReason {\n    TEST_ENCOUNTERED_RETURN_STATEMENT,\n    TEST_THREW_EXCEPTION,\n    TEST_DID_NOT_DIE\n  };\n\n  // Assumes one of the above roles.\n  virtual TestRole AssumeRole() = 0;\n\n  // Waits for the death test to finish and returns its status.\n  virtual int Wait() = 0;\n\n  // Returns true if the death test passed; that is, the test process\n  // exited during the test, its exit status matches a user-supplied\n  // predicate, and its stderr output matches a user-supplied regular\n  // expression.\n  // The user-supplied predicate may be a macro expression rather\n  // than a function pointer or functor, or else Wait and Passed could\n  // be combined.\n  virtual bool Passed(bool exit_status_ok) = 0;\n\n  // Signals that the death test did not die as expected.\n  virtual void Abort(AbortReason reason) = 0;\n\n  // Returns a human-readable outcome message regarding the outcome of\n  // the last death test.\n  static const char* LastMessage();\n\n  static void set_last_death_test_message(const std::string& message);\n\n private:\n  // A string containing a description of the outcome of the last death test.\n  static std::string last_death_test_message_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);\n};\n\n// Factory interface for death tests.  May be mocked out for testing.\nclass DeathTestFactory {\n public:\n  virtual ~DeathTestFactory() { }\n  virtual bool Create(const char* statement, const RE* regex,\n                      const char* file, int line, DeathTest** test) = 0;\n};\n\n// A concrete DeathTestFactory implementation for normal use.\nclass DefaultDeathTestFactory : public DeathTestFactory {\n public:\n  virtual bool Create(const char* statement, const RE* regex,\n                      const char* file, int line, DeathTest** test);\n};\n\n// Returns true if exit_status describes a process that was terminated\n// by a signal, or exited normally with a nonzero exit code.\nGTEST_API_ bool ExitedUnsuccessfully(int exit_status);\n\n// Traps C++ exceptions escaping statement and reports them as test\n// failures. Note that trapping SEH exceptions is not implemented here.\n# if GTEST_HAS_EXCEPTIONS\n#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \\\n  try { \\\n    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n  } catch (const ::std::exception& gtest_exception) { \\\n    fprintf(\\\n        stderr, \\\n        \"\\n%s: Caught std::exception-derived exception escaping the \" \\\n        \"death test statement. Exception message: %s\\n\", \\\n        ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \\\n        gtest_exception.what()); \\\n    fflush(stderr); \\\n    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \\\n  } catch (...) { \\\n    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \\\n  }\n\n# else\n#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \\\n  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)\n\n# endif\n\n// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,\n// ASSERT_EXIT*, and EXPECT_EXIT*.\n# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    const ::testing::internal::RE& gtest_regex = (regex); \\\n    ::testing::internal::DeathTest* gtest_dt; \\\n    if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \\\n        __FILE__, __LINE__, &gtest_dt)) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \\\n    } \\\n    if (gtest_dt != NULL) { \\\n      ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \\\n          gtest_dt_ptr(gtest_dt); \\\n      switch (gtest_dt->AssumeRole()) { \\\n        case ::testing::internal::DeathTest::OVERSEE_TEST: \\\n          if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \\\n            goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \\\n          } \\\n          break; \\\n        case ::testing::internal::DeathTest::EXECUTE_TEST: { \\\n          ::testing::internal::DeathTest::ReturnSentinel \\\n              gtest_sentinel(gtest_dt); \\\n          GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \\\n          gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \\\n          break; \\\n        } \\\n        default: \\\n          break; \\\n      } \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \\\n      fail(::testing::internal::DeathTest::LastMessage())\n// The symbol \"fail\" here expands to something into which a message\n// can be streamed.\n\n// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in\n// NDEBUG mode. In this case we need the statements to be executed, the regex is\n// ignored, and the macro must accept a streamed message even though the message\n// is never printed.\n# define GTEST_EXECUTE_STATEMENT_(statement, regex) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n  } else \\\n    ::testing::Message()\n\n// A class representing the parsed contents of the\n// --gtest_internal_run_death_test flag, as it existed when\n// RUN_ALL_TESTS was called.\nclass InternalRunDeathTestFlag {\n public:\n  InternalRunDeathTestFlag(const std::string& a_file,\n                           int a_line,\n                           int an_index,\n                           int a_write_fd)\n      : file_(a_file), line_(a_line), index_(an_index),\n        write_fd_(a_write_fd) {}\n\n  ~InternalRunDeathTestFlag() {\n    if (write_fd_ >= 0)\n      posix::Close(write_fd_);\n  }\n\n  const std::string& file() const { return file_; }\n  int line() const { return line_; }\n  int index() const { return index_; }\n  int write_fd() const { return write_fd_; }\n\n private:\n  std::string file_;\n  int line_;\n  int index_;\n  int write_fd_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);\n};\n\n// Returns a newly created InternalRunDeathTestFlag object with fields\n// initialized from the GTEST_FLAG(internal_run_death_test) flag if\n// the flag is specified; otherwise returns NULL.\nInternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();\n\n#else  // GTEST_HAS_DEATH_TEST\n\n// This macro is used for implementing macros such as\n// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where\n// death tests are not supported. Those macros must compile on such systems\n// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on\n// systems that support death tests. This allows one to write such a macro\n// on a system that does not support death tests and be sure that it will\n// compile on a death-test supporting system.\n//\n// Parameters:\n//   statement -  A statement that a macro such as EXPECT_DEATH would test\n//                for program termination. This macro has to make sure this\n//                statement is compiled but not executed, to ensure that\n//                EXPECT_DEATH_IF_SUPPORTED compiles with a certain\n//                parameter iff EXPECT_DEATH compiles with it.\n//   regex     -  A regex that a macro such as EXPECT_DEATH would use to test\n//                the output of statement.  This parameter has to be\n//                compiled but not evaluated by this macro, to ensure that\n//                this macro only accepts expressions that a macro such as\n//                EXPECT_DEATH would accept.\n//   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED\n//                and a return statement for ASSERT_DEATH_IF_SUPPORTED.\n//                This ensures that ASSERT_DEATH_IF_SUPPORTED will not\n//                compile inside functions where ASSERT_DEATH doesn't\n//                compile.\n//\n//  The branch that has an always false condition is used to ensure that\n//  statement and regex are compiled (and thus syntactically correct) but\n//  never executed. The unreachable code macro protects the terminator\n//  statement from generating an 'unreachable code' warning in case\n//  statement unconditionally returns or throws. The Message constructor at\n//  the end allows the syntax of streaming additional messages into the\n//  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.\n# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \\\n    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n    if (::testing::internal::AlwaysTrue()) { \\\n      GTEST_LOG_(WARNING) \\\n          << \"Death tests are not supported on this platform.\\n\" \\\n          << \"Statement '\" #statement \"' cannot be verified.\"; \\\n    } else if (::testing::internal::AlwaysFalse()) { \\\n      ::testing::internal::RE::PartialMatch(\".*\", (regex)); \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n      terminator; \\\n    } else \\\n      ::testing::Message()\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-filepath.h",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: keith.ray@gmail.com (Keith Ray)\n//\n// Google Test filepath utilities\n//\n// This header file declares classes and functions used internally by\n// Google Test.  They are subject to change without notice.\n//\n// This file is #included in <gtest/internal/gtest-internal.h>.\n// Do not include this header file separately!\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_\n\n#include \"gtest/internal/gtest-string.h\"\n\nnamespace testing {\nnamespace internal {\n\n// FilePath - a class for file and directory pathname manipulation which\n// handles platform-specific conventions (like the pathname separator).\n// Used for helper functions for naming files in a directory for xml output.\n// Except for Set methods, all methods are const or static, which provides an\n// \"immutable value object\" -- useful for peace of mind.\n// A FilePath with a value ending in a path separator (\"like/this/\") represents\n// a directory, otherwise it is assumed to represent a file. In either case,\n// it may or may not represent an actual file or directory in the file system.\n// Names are NOT checked for syntax correctness -- no checking for illegal\n// characters, malformed paths, etc.\n\nclass GTEST_API_ FilePath {\n public:\n  FilePath() : pathname_(\"\") { }\n  FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }\n\n  explicit FilePath(const std::string& pathname) : pathname_(pathname) {\n    Normalize();\n  }\n\n  FilePath& operator=(const FilePath& rhs) {\n    Set(rhs);\n    return *this;\n  }\n\n  void Set(const FilePath& rhs) {\n    pathname_ = rhs.pathname_;\n  }\n\n  const std::string& string() const { return pathname_; }\n  const char* c_str() const { return pathname_.c_str(); }\n\n  // Returns the current working directory, or \"\" if unsuccessful.\n  static FilePath GetCurrentDir();\n\n  // Given directory = \"dir\", base_name = \"test\", number = 0,\n  // extension = \"xml\", returns \"dir/test.xml\". If number is greater\n  // than zero (e.g., 12), returns \"dir/test_12.xml\".\n  // On Windows platform, uses \\ as the separator rather than /.\n  static FilePath MakeFileName(const FilePath& directory,\n                               const FilePath& base_name,\n                               int number,\n                               const char* extension);\n\n  // Given directory = \"dir\", relative_path = \"test.xml\",\n  // returns \"dir/test.xml\".\n  // On Windows, uses \\ as the separator rather than /.\n  static FilePath ConcatPaths(const FilePath& directory,\n                              const FilePath& relative_path);\n\n  // Returns a pathname for a file that does not currently exist. The pathname\n  // will be directory/base_name.extension or\n  // directory/base_name_<number>.extension if directory/base_name.extension\n  // already exists. The number will be incremented until a pathname is found\n  // that does not already exist.\n  // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.\n  // There could be a race condition if two or more processes are calling this\n  // function at the same time -- they could both pick the same filename.\n  static FilePath GenerateUniqueFileName(const FilePath& directory,\n                                         const FilePath& base_name,\n                                         const char* extension);\n\n  // Returns true iff the path is \"\".\n  bool IsEmpty() const { return pathname_.empty(); }\n\n  // If input name has a trailing separator character, removes it and returns\n  // the name, otherwise return the name string unmodified.\n  // On Windows platform, uses \\ as the separator, other platforms use /.\n  FilePath RemoveTrailingPathSeparator() const;\n\n  // Returns a copy of the FilePath with the directory part removed.\n  // Example: FilePath(\"path/to/file\").RemoveDirectoryName() returns\n  // FilePath(\"file\"). If there is no directory part (\"just_a_file\"), it returns\n  // the FilePath unmodified. If there is no file part (\"just_a_dir/\") it\n  // returns an empty FilePath (\"\").\n  // On Windows platform, '\\' is the path separator, otherwise it is '/'.\n  FilePath RemoveDirectoryName() const;\n\n  // RemoveFileName returns the directory path with the filename removed.\n  // Example: FilePath(\"path/to/file\").RemoveFileName() returns \"path/to/\".\n  // If the FilePath is \"a_file\" or \"/a_file\", RemoveFileName returns\n  // FilePath(\"./\") or, on Windows, FilePath(\".\\\\\"). If the filepath does\n  // not have a file, like \"just/a/dir/\", it returns the FilePath unmodified.\n  // On Windows platform, '\\' is the path separator, otherwise it is '/'.\n  FilePath RemoveFileName() const;\n\n  // Returns a copy of the FilePath with the case-insensitive extension removed.\n  // Example: FilePath(\"dir/file.exe\").RemoveExtension(\"EXE\") returns\n  // FilePath(\"dir/file\"). If a case-insensitive extension is not\n  // found, returns a copy of the original FilePath.\n  FilePath RemoveExtension(const char* extension) const;\n\n  // Creates directories so that path exists. Returns true if successful or if\n  // the directories already exist; returns false if unable to create\n  // directories for any reason. Will also return false if the FilePath does\n  // not represent a directory (that is, it doesn't end with a path separator).\n  bool CreateDirectoriesRecursively() const;\n\n  // Create the directory so that path exists. Returns true if successful or\n  // if the directory already exists; returns false if unable to create the\n  // directory for any reason, including if the parent directory does not\n  // exist. Not named \"CreateDirectory\" because that's a macro on Windows.\n  bool CreateFolder() const;\n\n  // Returns true if FilePath describes something in the file-system,\n  // either a file, directory, or whatever, and that something exists.\n  bool FileOrDirectoryExists() const;\n\n  // Returns true if pathname describes a directory in the file-system\n  // that exists.\n  bool DirectoryExists() const;\n\n  // Returns true if FilePath ends with a path separator, which indicates that\n  // it is intended to represent a directory. Returns false otherwise.\n  // This does NOT check that a directory (or file) actually exists.\n  bool IsDirectory() const;\n\n  // Returns true if pathname describes a root directory. (Windows has one\n  // root directory per disk drive.)\n  bool IsRootDirectory() const;\n\n  // Returns true if pathname describes an absolute path.\n  bool IsAbsolutePath() const;\n\n private:\n  // Replaces multiple consecutive separators with a single separator.\n  // For example, \"bar///foo\" becomes \"bar/foo\". Does not eliminate other\n  // redundancies that might be in a pathname involving \".\" or \"..\".\n  //\n  // A pathname with multiple consecutive separators may occur either through\n  // user error or as a result of some scripts or APIs that generate a pathname\n  // with a trailing separator. On other platforms the same API or script\n  // may NOT generate a pathname with a trailing \"/\". Then elsewhere that\n  // pathname may have another \"/\" and pathname components added to it,\n  // without checking for the separator already being there.\n  // The script language and operating system may allow paths like \"foo//bar\"\n  // but some of the functions in FilePath will not handle that correctly. In\n  // particular, RemoveTrailingPathSeparator() only removes one separator, and\n  // it is called in CreateDirectoriesRecursively() assuming that it will change\n  // a pathname from directory syntax (trailing separator) to filename syntax.\n  //\n  // On Windows this method also replaces the alternate path separator '/' with\n  // the primary path separator '\\\\', so that for example \"bar\\\\/\\\\foo\" becomes\n  // \"bar\\\\foo\".\n\n  void Normalize();\n\n  // Returns a pointer to the last occurence of a valid path separator in\n  // the FilePath. On Windows, for example, both '/' and '\\' are valid path\n  // separators. Returns NULL if no path separator was found.\n  const char* FindLastPathSeparator() const;\n\n  std::string pathname_;\n};  // class FilePath\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-internal.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file declares functions and macros used internally by\n// Google Test.  They are subject to change without notice.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_\n\n#include \"gtest/internal/gtest-port.h\"\n\n#if GTEST_OS_LINUX\n# include <stdlib.h>\n# include <sys/types.h>\n# include <sys/wait.h>\n# include <unistd.h>\n#endif  // GTEST_OS_LINUX\n\n#if GTEST_HAS_EXCEPTIONS\n# include <stdexcept>\n#endif\n\n#include <ctype.h>\n#include <float.h>\n#include <string.h>\n#include <iomanip>\n#include <limits>\n#include <set>\n\n#include \"gtest/gtest-message.h\"\n#include \"gtest/internal/gtest-string.h\"\n#include \"gtest/internal/gtest-filepath.h\"\n#include \"gtest/internal/gtest-type-util.h\"\n\n// Due to C++ preprocessor weirdness, we need double indirection to\n// concatenate two tokens when one of them is __LINE__.  Writing\n//\n//   foo ## __LINE__\n//\n// will result in the token foo__LINE__, instead of foo followed by\n// the current line number.  For more details, see\n// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6\n#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)\n#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar\n\nclass ProtocolMessage;\nnamespace proto2 { class Message; }\n\nnamespace testing {\n\n// Forward declarations.\n\nclass AssertionResult;                 // Result of an assertion.\nclass Message;                         // Represents a failure message.\nclass Test;                            // Represents a test.\nclass TestInfo;                        // Information about a test.\nclass TestPartResult;                  // Result of a test part.\nclass UnitTest;                        // A collection of test cases.\n\ntemplate <typename T>\n::std::string PrintToString(const T& value);\n\nnamespace internal {\n\nstruct TraceInfo;                      // Information about a trace point.\nclass ScopedTrace;                     // Implements scoped trace.\nclass TestInfoImpl;                    // Opaque implementation of TestInfo\nclass UnitTestImpl;                    // Opaque implementation of UnitTest\n\n// How many times InitGoogleTest() has been called.\nGTEST_API_ extern int g_init_gtest_count;\n\n// The text used in failure messages to indicate the start of the\n// stack trace.\nGTEST_API_ extern const char kStackTraceMarker[];\n\n// Two overloaded helpers for checking at compile time whether an\n// expression is a null pointer literal (i.e. NULL or any 0-valued\n// compile-time integral constant).  Their return values have\n// different sizes, so we can use sizeof() to test which version is\n// picked by the compiler.  These helpers have no implementations, as\n// we only need their signatures.\n//\n// Given IsNullLiteralHelper(x), the compiler will pick the first\n// version if x can be implicitly converted to Secret*, and pick the\n// second version otherwise.  Since Secret is a secret and incomplete\n// type, the only expression a user can write that has type Secret* is\n// a null pointer literal.  Therefore, we know that x is a null\n// pointer literal if and only if the first version is picked by the\n// compiler.\nchar IsNullLiteralHelper(Secret* p);\nchar (&IsNullLiteralHelper(...))[2];  // NOLINT\n\n// A compile-time bool constant that is true if and only if x is a\n// null pointer literal (i.e. NULL or any 0-valued compile-time\n// integral constant).\n#ifdef GTEST_ELLIPSIS_NEEDS_POD_\n// We lose support for NULL detection where the compiler doesn't like\n// passing non-POD classes through ellipsis (...).\n# define GTEST_IS_NULL_LITERAL_(x) false\n#else\n# define GTEST_IS_NULL_LITERAL_(x) \\\n    (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)\n#endif  // GTEST_ELLIPSIS_NEEDS_POD_\n\n// Appends the user-supplied message to the Google-Test-generated message.\nGTEST_API_ std::string AppendUserMessage(\n    const std::string& gtest_msg, const Message& user_msg);\n\n#if GTEST_HAS_EXCEPTIONS\n\n// This exception is thrown by (and only by) a failed Google Test\n// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions\n// are enabled).  We derive it from std::runtime_error, which is for\n// errors presumably detectable only at run time.  Since\n// std::runtime_error inherits from std::exception, many testing\n// frameworks know how to extract and print the message inside it.\nclass GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {\n public:\n  explicit GoogleTestFailureException(const TestPartResult& failure);\n};\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// A helper class for creating scoped traces in user programs.\nclass GTEST_API_ ScopedTrace {\n public:\n  // The c'tor pushes the given source file location and message onto\n  // a trace stack maintained by Google Test.\n  ScopedTrace(const char* file, int line, const Message& message);\n\n  // The d'tor pops the info pushed by the c'tor.\n  //\n  // Note that the d'tor is not virtual in order to be efficient.\n  // Don't inherit from ScopedTrace!\n  ~ScopedTrace();\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);\n} GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its\n                            // c'tor and d'tor.  Therefore it doesn't\n                            // need to be used otherwise.\n\n// Constructs and returns the message for an equality assertion\n// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.\n//\n// The first four parameters are the expressions used in the assertion\n// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)\n// where foo is 5 and bar is 6, we have:\n//\n//   expected_expression: \"foo\"\n//   actual_expression:   \"bar\"\n//   expected_value:      \"5\"\n//   actual_value:        \"6\"\n//\n// The ignoring_case parameter is true iff the assertion is a\n// *_STRCASEEQ*.  When it's true, the string \" (ignoring case)\" will\n// be inserted into the message.\nGTEST_API_ AssertionResult EqFailure(const char* expected_expression,\n                                     const char* actual_expression,\n                                     const std::string& expected_value,\n                                     const std::string& actual_value,\n                                     bool ignoring_case);\n\n// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.\nGTEST_API_ std::string GetBoolAssertionFailureMessage(\n    const AssertionResult& assertion_result,\n    const char* expression_text,\n    const char* actual_predicate_value,\n    const char* expected_predicate_value);\n\n// This template class represents an IEEE floating-point number\n// (either single-precision or double-precision, depending on the\n// template parameters).\n//\n// The purpose of this class is to do more sophisticated number\n// comparison.  (Due to round-off error, etc, it's very unlikely that\n// two floating-points will be equal exactly.  Hence a naive\n// comparison by the == operation often doesn't work.)\n//\n// Format of IEEE floating-point:\n//\n//   The most-significant bit being the leftmost, an IEEE\n//   floating-point looks like\n//\n//     sign_bit exponent_bits fraction_bits\n//\n//   Here, sign_bit is a single bit that designates the sign of the\n//   number.\n//\n//   For float, there are 8 exponent bits and 23 fraction bits.\n//\n//   For double, there are 11 exponent bits and 52 fraction bits.\n//\n//   More details can be found at\n//   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.\n//\n// Template parameter:\n//\n//   RawType: the raw floating-point type (either float or double)\ntemplate <typename RawType>\nclass FloatingPoint {\n public:\n  // Defines the unsigned integer type that has the same size as the\n  // floating point number.\n  typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;\n\n  // Constants.\n\n  // # of bits in a number.\n  static const size_t kBitCount = 8*sizeof(RawType);\n\n  // # of fraction bits in a number.\n  static const size_t kFractionBitCount =\n    std::numeric_limits<RawType>::digits - 1;\n\n  // # of exponent bits in a number.\n  static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;\n\n  // The mask for the sign bit.\n  static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);\n\n  // The mask for the fraction bits.\n  static const Bits kFractionBitMask =\n    ~static_cast<Bits>(0) >> (kExponentBitCount + 1);\n\n  // The mask for the exponent bits.\n  static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);\n\n  // How many ULP's (Units in the Last Place) we want to tolerate when\n  // comparing two numbers.  The larger the value, the more error we\n  // allow.  A 0 value means that two numbers must be exactly the same\n  // to be considered equal.\n  //\n  // The maximum error of a single floating-point operation is 0.5\n  // units in the last place.  On Intel CPU's, all floating-point\n  // calculations are done with 80-bit precision, while double has 64\n  // bits.  Therefore, 4 should be enough for ordinary use.\n  //\n  // See the following article for more details on ULP:\n  // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/\n  static const size_t kMaxUlps = 4;\n\n  // Constructs a FloatingPoint from a raw floating-point number.\n  //\n  // On an Intel CPU, passing a non-normalized NAN (Not a Number)\n  // around may change its bits, although the new value is guaranteed\n  // to be also a NAN.  Therefore, don't expect this constructor to\n  // preserve the bits in x when x is a NAN.\n  explicit FloatingPoint(const RawType& x) { u_.value_ = x; }\n\n  // Static methods\n\n  // Reinterprets a bit pattern as a floating-point number.\n  //\n  // This function is needed to test the AlmostEquals() method.\n  static RawType ReinterpretBits(const Bits bits) {\n    FloatingPoint fp(0);\n    fp.u_.bits_ = bits;\n    return fp.u_.value_;\n  }\n\n  // Returns the floating-point number that represent positive infinity.\n  static RawType Infinity() {\n    return ReinterpretBits(kExponentBitMask);\n  }\n\n  // Returns the maximum representable finite floating-point number.\n  static RawType Max();\n\n  // Non-static methods\n\n  // Returns the bits that represents this number.\n  const Bits &bits() const { return u_.bits_; }\n\n  // Returns the exponent bits of this number.\n  Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }\n\n  // Returns the fraction bits of this number.\n  Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }\n\n  // Returns the sign bit of this number.\n  Bits sign_bit() const { return kSignBitMask & u_.bits_; }\n\n  // Returns true iff this is NAN (not a number).\n  bool is_nan() const {\n    // It's a NAN if the exponent bits are all ones and the fraction\n    // bits are not entirely zeros.\n    return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);\n  }\n\n  // Returns true iff this number is at most kMaxUlps ULP's away from\n  // rhs.  In particular, this function:\n  //\n  //   - returns false if either number is (or both are) NAN.\n  //   - treats really large numbers as almost equal to infinity.\n  //   - thinks +0.0 and -0.0 are 0 DLP's apart.\n  bool AlmostEquals(const FloatingPoint& rhs) const {\n    // The IEEE standard says that any comparison operation involving\n    // a NAN must return false.\n    if (is_nan() || rhs.is_nan()) return false;\n\n    return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)\n        <= kMaxUlps;\n  }\n\n private:\n  // The data type used to store the actual floating-point number.\n  union FloatingPointUnion {\n    RawType value_;  // The raw floating-point number.\n    Bits bits_;      // The bits that represent the number.\n  };\n\n  // Converts an integer from the sign-and-magnitude representation to\n  // the biased representation.  More precisely, let N be 2 to the\n  // power of (kBitCount - 1), an integer x is represented by the\n  // unsigned number x + N.\n  //\n  // For instance,\n  //\n  //   -N + 1 (the most negative number representable using\n  //          sign-and-magnitude) is represented by 1;\n  //   0      is represented by N; and\n  //   N - 1  (the biggest number representable using\n  //          sign-and-magnitude) is represented by 2N - 1.\n  //\n  // Read http://en.wikipedia.org/wiki/Signed_number_representations\n  // for more details on signed number representations.\n  static Bits SignAndMagnitudeToBiased(const Bits &sam) {\n    if (kSignBitMask & sam) {\n      // sam represents a negative number.\n      return ~sam + 1;\n    } else {\n      // sam represents a positive number.\n      return kSignBitMask | sam;\n    }\n  }\n\n  // Given two numbers in the sign-and-magnitude representation,\n  // returns the distance between them as an unsigned number.\n  static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,\n                                                     const Bits &sam2) {\n    const Bits biased1 = SignAndMagnitudeToBiased(sam1);\n    const Bits biased2 = SignAndMagnitudeToBiased(sam2);\n    return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);\n  }\n\n  FloatingPointUnion u_;\n};\n\n// We cannot use std::numeric_limits<T>::max() as it clashes with the max()\n// macro defined by <windows.h>.\ntemplate <>\ninline float FloatingPoint<float>::Max() { return FLT_MAX; }\ntemplate <>\ninline double FloatingPoint<double>::Max() { return DBL_MAX; }\n\n// Typedefs the instances of the FloatingPoint template class that we\n// care to use.\ntypedef FloatingPoint<float> Float;\ntypedef FloatingPoint<double> Double;\n\n// In order to catch the mistake of putting tests that use different\n// test fixture classes in the same test case, we need to assign\n// unique IDs to fixture classes and compare them.  The TypeId type is\n// used to hold such IDs.  The user should treat TypeId as an opaque\n// type: the only operation allowed on TypeId values is to compare\n// them for equality using the == operator.\ntypedef const void* TypeId;\n\ntemplate <typename T>\nclass TypeIdHelper {\n public:\n  // dummy_ must not have a const type.  Otherwise an overly eager\n  // compiler (e.g. MSVC 7.1 & 8.0) may try to merge\n  // TypeIdHelper<T>::dummy_ for different Ts as an \"optimization\".\n  static bool dummy_;\n};\n\ntemplate <typename T>\nbool TypeIdHelper<T>::dummy_ = false;\n\n// GetTypeId<T>() returns the ID of type T.  Different values will be\n// returned for different types.  Calling the function twice with the\n// same type argument is guaranteed to return the same ID.\ntemplate <typename T>\nTypeId GetTypeId() {\n  // The compiler is required to allocate a different\n  // TypeIdHelper<T>::dummy_ variable for each T used to instantiate\n  // the template.  Therefore, the address of dummy_ is guaranteed to\n  // be unique.\n  return &(TypeIdHelper<T>::dummy_);\n}\n\n// Returns the type ID of ::testing::Test.  Always call this instead\n// of GetTypeId< ::testing::Test>() to get the type ID of\n// ::testing::Test, as the latter may give the wrong result due to a\n// suspected linker bug when compiling Google Test as a Mac OS X\n// framework.\nGTEST_API_ TypeId GetTestTypeId();\n\n// Defines the abstract factory interface that creates instances\n// of a Test object.\nclass TestFactoryBase {\n public:\n  virtual ~TestFactoryBase() {}\n\n  // Creates a test instance to run. The instance is both created and destroyed\n  // within TestInfoImpl::Run()\n  virtual Test* CreateTest() = 0;\n\n protected:\n  TestFactoryBase() {}\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);\n};\n\n// This class provides implementation of TeastFactoryBase interface.\n// It is used in TEST and TEST_F macros.\ntemplate <class TestClass>\nclass TestFactoryImpl : public TestFactoryBase {\n public:\n  virtual Test* CreateTest() { return new TestClass; }\n};\n\n#if GTEST_OS_WINDOWS\n\n// Predicate-formatters for implementing the HRESULT checking macros\n// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}\n// We pass a long instead of HRESULT to avoid causing an\n// include dependency for the HRESULT type.\nGTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,\n                                            long hr);  // NOLINT\nGTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,\n                                            long hr);  // NOLINT\n\n#endif  // GTEST_OS_WINDOWS\n\n// Types of SetUpTestCase() and TearDownTestCase() functions.\ntypedef void (*SetUpTestCaseFunc)();\ntypedef void (*TearDownTestCaseFunc)();\n\n// Creates a new TestInfo object and registers it with Google Test;\n// returns the created object.\n//\n// Arguments:\n//\n//   test_case_name:   name of the test case\n//   name:             name of the test\n//   type_param        the name of the test's type parameter, or NULL if\n//                     this is not a typed or a type-parameterized test.\n//   value_param       text representation of the test's value parameter,\n//                     or NULL if this is not a type-parameterized test.\n//   fixture_class_id: ID of the test fixture class\n//   set_up_tc:        pointer to the function that sets up the test case\n//   tear_down_tc:     pointer to the function that tears down the test case\n//   factory:          pointer to the factory that creates a test object.\n//                     The newly created TestInfo instance will assume\n//                     ownership of the factory object.\nGTEST_API_ TestInfo* MakeAndRegisterTestInfo(\n    const char* test_case_name,\n    const char* name,\n    const char* type_param,\n    const char* value_param,\n    TypeId fixture_class_id,\n    SetUpTestCaseFunc set_up_tc,\n    TearDownTestCaseFunc tear_down_tc,\n    TestFactoryBase* factory);\n\n// If *pstr starts with the given prefix, modifies *pstr to be right\n// past the prefix and returns true; otherwise leaves *pstr unchanged\n// and returns false.  None of pstr, *pstr, and prefix can be NULL.\nGTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);\n\n#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// State of the definition of a type-parameterized test case.\nclass GTEST_API_ TypedTestCasePState {\n public:\n  TypedTestCasePState() : registered_(false) {}\n\n  // Adds the given test name to defined_test_names_ and return true\n  // if the test case hasn't been registered; otherwise aborts the\n  // program.\n  bool AddTestName(const char* file, int line, const char* case_name,\n                   const char* test_name) {\n    if (registered_) {\n      fprintf(stderr, \"%s Test %s must be defined before \"\n              \"REGISTER_TYPED_TEST_CASE_P(%s, ...).\\n\",\n              FormatFileLocation(file, line).c_str(), test_name, case_name);\n      fflush(stderr);\n      posix::Abort();\n    }\n    defined_test_names_.insert(test_name);\n    return true;\n  }\n\n  // Verifies that registered_tests match the test names in\n  // defined_test_names_; returns registered_tests if successful, or\n  // aborts the program otherwise.\n  const char* VerifyRegisteredTestNames(\n      const char* file, int line, const char* registered_tests);\n\n private:\n  bool registered_;\n  ::std::set<const char*> defined_test_names_;\n};\n\n// Skips to the first non-space char after the first comma in 'str';\n// returns NULL if no comma is found in 'str'.\ninline const char* SkipComma(const char* str) {\n  const char* comma = strchr(str, ',');\n  if (comma == NULL) {\n    return NULL;\n  }\n  while (IsSpace(*(++comma))) {}\n  return comma;\n}\n\n// Returns the prefix of 'str' before the first comma in it; returns\n// the entire string if it contains no comma.\ninline std::string GetPrefixUntilComma(const char* str) {\n  const char* comma = strchr(str, ',');\n  return comma == NULL ? str : std::string(str, comma);\n}\n\n// TypeParameterizedTest<Fixture, TestSel, Types>::Register()\n// registers a list of type-parameterized tests with Google Test.  The\n// return value is insignificant - we just need to return something\n// such that we can call this function in a namespace scope.\n//\n// Implementation note: The GTEST_TEMPLATE_ macro declares a template\n// template parameter.  It's defined in gtest-type-util.h.\ntemplate <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>\nclass TypeParameterizedTest {\n public:\n  // 'index' is the index of the test in the type list 'Types'\n  // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,\n  // Types).  Valid values for 'index' are [0, N - 1] where N is the\n  // length of Types.\n  static bool Register(const char* prefix, const char* case_name,\n                       const char* test_names, int index) {\n    typedef typename Types::Head Type;\n    typedef Fixture<Type> FixtureClass;\n    typedef typename GTEST_BIND_(TestSel, Type) TestClass;\n\n    // First, registers the first type-parameterized test in the type\n    // list.\n    MakeAndRegisterTestInfo(\n        (std::string(prefix) + (prefix[0] == '\\0' ? \"\" : \"/\") + case_name + \"/\"\n         + StreamableToString(index)).c_str(),\n        GetPrefixUntilComma(test_names).c_str(),\n        GetTypeName<Type>().c_str(),\n        NULL,  // No value parameter.\n        GetTypeId<FixtureClass>(),\n        TestClass::SetUpTestCase,\n        TestClass::TearDownTestCase,\n        new TestFactoryImpl<TestClass>);\n\n    // Next, recurses (at compile time) with the tail of the type list.\n    return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>\n        ::Register(prefix, case_name, test_names, index + 1);\n  }\n};\n\n// The base case for the compile time recursion.\ntemplate <GTEST_TEMPLATE_ Fixture, class TestSel>\nclass TypeParameterizedTest<Fixture, TestSel, Types0> {\n public:\n  static bool Register(const char* /*prefix*/, const char* /*case_name*/,\n                       const char* /*test_names*/, int /*index*/) {\n    return true;\n  }\n};\n\n// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()\n// registers *all combinations* of 'Tests' and 'Types' with Google\n// Test.  The return value is insignificant - we just need to return\n// something such that we can call this function in a namespace scope.\ntemplate <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>\nclass TypeParameterizedTestCase {\n public:\n  static bool Register(const char* prefix, const char* case_name,\n                       const char* test_names) {\n    typedef typename Tests::Head Head;\n\n    // First, register the first test in 'Test' for each type in 'Types'.\n    TypeParameterizedTest<Fixture, Head, Types>::Register(\n        prefix, case_name, test_names, 0);\n\n    // Next, recurses (at compile time) with the tail of the test list.\n    return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>\n        ::Register(prefix, case_name, SkipComma(test_names));\n  }\n};\n\n// The base case for the compile time recursion.\ntemplate <GTEST_TEMPLATE_ Fixture, typename Types>\nclass TypeParameterizedTestCase<Fixture, Templates0, Types> {\n public:\n  static bool Register(const char* /*prefix*/, const char* /*case_name*/,\n                       const char* /*test_names*/) {\n    return true;\n  }\n};\n\n#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// Returns the current OS stack trace as an std::string.\n//\n// The maximum number of stack frames to be included is specified by\n// the gtest_stack_trace_depth flag.  The skip_count parameter\n// specifies the number of top frames to be skipped, which doesn't\n// count against the number of frames to be included.\n//\n// For example, if Foo() calls Bar(), which in turn calls\n// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in\n// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.\nGTEST_API_ std::string GetCurrentOsStackTraceExceptTop(\n    UnitTest* unit_test, int skip_count);\n\n// Helpers for suppressing warnings on unreachable code or constant\n// condition.\n\n// Always returns true.\nGTEST_API_ bool AlwaysTrue();\n\n// Always returns false.\ninline bool AlwaysFalse() { return !AlwaysTrue(); }\n\n// Helper for suppressing false warning from Clang on a const char*\n// variable declared in a conditional expression always being NULL in\n// the else branch.\nstruct GTEST_API_ ConstCharPtr {\n  ConstCharPtr(const char* str) : value(str) {}\n  operator bool() const { return true; }\n  const char* value;\n};\n\n// A simple Linear Congruential Generator for generating random\n// numbers with a uniform distribution.  Unlike rand() and srand(), it\n// doesn't use global state (and therefore can't interfere with user\n// code).  Unlike rand_r(), it's portable.  An LCG isn't very random,\n// but it's good enough for our purposes.\nclass GTEST_API_ Random {\n public:\n  static const UInt32 kMaxRange = 1u << 31;\n\n  explicit Random(UInt32 seed) : state_(seed) {}\n\n  void Reseed(UInt32 seed) { state_ = seed; }\n\n  // Generates a random number from [0, range).  Crashes if 'range' is\n  // 0 or greater than kMaxRange.\n  UInt32 Generate(UInt32 range);\n\n private:\n  UInt32 state_;\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);\n};\n\n// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a\n// compiler error iff T1 and T2 are different types.\ntemplate <typename T1, typename T2>\nstruct CompileAssertTypesEqual;\n\ntemplate <typename T>\nstruct CompileAssertTypesEqual<T, T> {\n};\n\n// Removes the reference from a type if it is a reference type,\n// otherwise leaves it unchanged.  This is the same as\n// tr1::remove_reference, which is not widely available yet.\ntemplate <typename T>\nstruct RemoveReference { typedef T type; };  // NOLINT\ntemplate <typename T>\nstruct RemoveReference<T&> { typedef T type; };  // NOLINT\n\n// A handy wrapper around RemoveReference that works when the argument\n// T depends on template parameters.\n#define GTEST_REMOVE_REFERENCE_(T) \\\n    typename ::testing::internal::RemoveReference<T>::type\n\n// Removes const from a type if it is a const type, otherwise leaves\n// it unchanged.  This is the same as tr1::remove_const, which is not\n// widely available yet.\ntemplate <typename T>\nstruct RemoveConst { typedef T type; };  // NOLINT\ntemplate <typename T>\nstruct RemoveConst<const T> { typedef T type; };  // NOLINT\n\n// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above\n// definition to fail to remove the const in 'const int[3]' and 'const\n// char[3][4]'.  The following specialization works around the bug.\ntemplate <typename T, size_t N>\nstruct RemoveConst<const T[N]> {\n  typedef typename RemoveConst<T>::type type[N];\n};\n\n#if defined(_MSC_VER) && _MSC_VER < 1400\n// This is the only specialization that allows VC++ 7.1 to remove const in\n// 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC\n// and thus needs to be conditionally compiled.\ntemplate <typename T, size_t N>\nstruct RemoveConst<T[N]> {\n  typedef typename RemoveConst<T>::type type[N];\n};\n#endif\n\n// A handy wrapper around RemoveConst that works when the argument\n// T depends on template parameters.\n#define GTEST_REMOVE_CONST_(T) \\\n    typename ::testing::internal::RemoveConst<T>::type\n\n// Turns const U&, U&, const U, and U all into U.\n#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \\\n    GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))\n\n// Adds reference to a type if it is not a reference type,\n// otherwise leaves it unchanged.  This is the same as\n// tr1::add_reference, which is not widely available yet.\ntemplate <typename T>\nstruct AddReference { typedef T& type; };  // NOLINT\ntemplate <typename T>\nstruct AddReference<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper around AddReference that works when the argument T\n// depends on template parameters.\n#define GTEST_ADD_REFERENCE_(T) \\\n    typename ::testing::internal::AddReference<T>::type\n\n// Adds a reference to const on top of T as necessary.  For example,\n// it transforms\n//\n//   char         ==> const char&\n//   const char   ==> const char&\n//   char&        ==> const char&\n//   const char&  ==> const char&\n//\n// The argument T must depend on some template parameters.\n#define GTEST_REFERENCE_TO_CONST_(T) \\\n    GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))\n\n// ImplicitlyConvertible<From, To>::value is a compile-time bool\n// constant that's true iff type From can be implicitly converted to\n// type To.\ntemplate <typename From, typename To>\nclass ImplicitlyConvertible {\n private:\n  // We need the following helper functions only for their types.\n  // They have no implementations.\n\n  // MakeFrom() is an expression whose type is From.  We cannot simply\n  // use From(), as the type From may not have a public default\n  // constructor.\n  static From MakeFrom();\n\n  // These two functions are overloaded.  Given an expression\n  // Helper(x), the compiler will pick the first version if x can be\n  // implicitly converted to type To; otherwise it will pick the\n  // second version.\n  //\n  // The first version returns a value of size 1, and the second\n  // version returns a value of size 2.  Therefore, by checking the\n  // size of Helper(x), which can be done at compile time, we can tell\n  // which version of Helper() is used, and hence whether x can be\n  // implicitly converted to type To.\n  static char Helper(To);\n  static char (&Helper(...))[2];  // NOLINT\n\n  // We have to put the 'public' section after the 'private' section,\n  // or MSVC refuses to compile the code.\n public:\n  // MSVC warns about implicitly converting from double to int for\n  // possible loss of data, so we need to temporarily disable the\n  // warning.\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4244)  // Temporarily disables warning 4244.\n\n  static const bool value =\n      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;\n# pragma warning(pop)           // Restores the warning state.\n#elif defined(__BORLANDC__)\n  // C++Builder cannot use member overload resolution during template\n  // instantiation.  The simplest workaround is to use its C++0x type traits\n  // functions (C++Builder 2009 and above only).\n  static const bool value = __is_convertible(From, To);\n#else\n  static const bool value =\n      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;\n#endif  // _MSV_VER\n};\ntemplate <typename From, typename To>\nconst bool ImplicitlyConvertible<From, To>::value;\n\n// IsAProtocolMessage<T>::value is a compile-time bool constant that's\n// true iff T is type ProtocolMessage, proto2::Message, or a subclass\n// of those.\ntemplate <typename T>\nstruct IsAProtocolMessage\n    : public bool_constant<\n  ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||\n  ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {\n};\n\n// When the compiler sees expression IsContainerTest<C>(0), if C is an\n// STL-style container class, the first overload of IsContainerTest\n// will be viable (since both C::iterator* and C::const_iterator* are\n// valid types and NULL can be implicitly converted to them).  It will\n// be picked over the second overload as 'int' is a perfect match for\n// the type of argument 0.  If C::iterator or C::const_iterator is not\n// a valid type, the first overload is not viable, and the second\n// overload will be picked.  Therefore, we can determine whether C is\n// a container class by checking the type of IsContainerTest<C>(0).\n// The value of the expression is insignificant.\n//\n// Note that we look for both C::iterator and C::const_iterator.  The\n// reason is that C++ injects the name of a class as a member of the\n// class itself (e.g. you can refer to class iterator as either\n// 'iterator' or 'iterator::iterator').  If we look for C::iterator\n// only, for example, we would mistakenly think that a class named\n// iterator is an STL container.\n//\n// Also note that the simpler approach of overloading\n// IsContainerTest(typename C::const_iterator*) and\n// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.\ntypedef int IsContainer;\ntemplate <class C>\nIsContainer IsContainerTest(int /* dummy */,\n                            typename C::iterator* /* it */ = NULL,\n                            typename C::const_iterator* /* const_it */ = NULL) {\n  return 0;\n}\n\ntypedef char IsNotContainer;\ntemplate <class C>\nIsNotContainer IsContainerTest(long /* dummy */) { return '\\0'; }\n\n// EnableIf<condition>::type is void when 'Cond' is true, and\n// undefined when 'Cond' is false.  To use SFINAE to make a function\n// overload only apply when a particular expression is true, add\n// \"typename EnableIf<expression>::type* = 0\" as the last parameter.\ntemplate<bool> struct EnableIf;\ntemplate<> struct EnableIf<true> { typedef void type; };  // NOLINT\n\n// Utilities for native arrays.\n\n// ArrayEq() compares two k-dimensional native arrays using the\n// elements' operator==, where k can be any integer >= 0.  When k is\n// 0, ArrayEq() degenerates into comparing a single pair of values.\n\ntemplate <typename T, typename U>\nbool ArrayEq(const T* lhs, size_t size, const U* rhs);\n\n// This generic version is used when k is 0.\ntemplate <typename T, typename U>\ninline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }\n\n// This overload is used when k >= 1.\ntemplate <typename T, typename U, size_t N>\ninline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {\n  return internal::ArrayEq(lhs, N, rhs);\n}\n\n// This helper reduces code bloat.  If we instead put its logic inside\n// the previous ArrayEq() function, arrays with different sizes would\n// lead to different copies of the template code.\ntemplate <typename T, typename U>\nbool ArrayEq(const T* lhs, size_t size, const U* rhs) {\n  for (size_t i = 0; i != size; i++) {\n    if (!internal::ArrayEq(lhs[i], rhs[i]))\n      return false;\n  }\n  return true;\n}\n\n// Finds the first element in the iterator range [begin, end) that\n// equals elem.  Element may be a native array type itself.\ntemplate <typename Iter, typename Element>\nIter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {\n  for (Iter it = begin; it != end; ++it) {\n    if (internal::ArrayEq(*it, elem))\n      return it;\n  }\n  return end;\n}\n\n// CopyArray() copies a k-dimensional native array using the elements'\n// operator=, where k can be any integer >= 0.  When k is 0,\n// CopyArray() degenerates into copying a single value.\n\ntemplate <typename T, typename U>\nvoid CopyArray(const T* from, size_t size, U* to);\n\n// This generic version is used when k is 0.\ntemplate <typename T, typename U>\ninline void CopyArray(const T& from, U* to) { *to = from; }\n\n// This overload is used when k >= 1.\ntemplate <typename T, typename U, size_t N>\ninline void CopyArray(const T(&from)[N], U(*to)[N]) {\n  internal::CopyArray(from, N, *to);\n}\n\n// This helper reduces code bloat.  If we instead put its logic inside\n// the previous CopyArray() function, arrays with different sizes\n// would lead to different copies of the template code.\ntemplate <typename T, typename U>\nvoid CopyArray(const T* from, size_t size, U* to) {\n  for (size_t i = 0; i != size; i++) {\n    internal::CopyArray(from[i], to + i);\n  }\n}\n\n// The relation between an NativeArray object (see below) and the\n// native array it represents.\nenum RelationToSource {\n  kReference,  // The NativeArray references the native array.\n  kCopy        // The NativeArray makes a copy of the native array and\n               // owns the copy.\n};\n\n// Adapts a native array to a read-only STL-style container.  Instead\n// of the complete STL container concept, this adaptor only implements\n// members useful for Google Mock's container matchers.  New members\n// should be added as needed.  To simplify the implementation, we only\n// support Element being a raw type (i.e. having no top-level const or\n// reference modifier).  It's the client's responsibility to satisfy\n// this requirement.  Element can be an array type itself (hence\n// multi-dimensional arrays are supported).\ntemplate <typename Element>\nclass NativeArray {\n public:\n  // STL-style container typedefs.\n  typedef Element value_type;\n  typedef Element* iterator;\n  typedef const Element* const_iterator;\n\n  // Constructs from a native array.\n  NativeArray(const Element* array, size_t count, RelationToSource relation) {\n    Init(array, count, relation);\n  }\n\n  // Copy constructor.\n  NativeArray(const NativeArray& rhs) {\n    Init(rhs.array_, rhs.size_, rhs.relation_to_source_);\n  }\n\n  ~NativeArray() {\n    // Ensures that the user doesn't instantiate NativeArray with a\n    // const or reference type.\n    static_cast<void>(StaticAssertTypeEqHelper<Element,\n        GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());\n    if (relation_to_source_ == kCopy)\n      delete[] array_;\n  }\n\n  // STL-style container methods.\n  size_t size() const { return size_; }\n  const_iterator begin() const { return array_; }\n  const_iterator end() const { return array_ + size_; }\n  bool operator==(const NativeArray& rhs) const {\n    return size() == rhs.size() &&\n        ArrayEq(begin(), size(), rhs.begin());\n  }\n\n private:\n  // Initializes this object; makes a copy of the input array if\n  // 'relation' is kCopy.\n  void Init(const Element* array, size_t a_size, RelationToSource relation) {\n    if (relation == kReference) {\n      array_ = array;\n    } else {\n      Element* const copy = new Element[a_size];\n      CopyArray(array, a_size, copy);\n      array_ = copy;\n    }\n    size_ = a_size;\n    relation_to_source_ = relation;\n  }\n\n  const Element* array_;\n  size_t size_;\n  RelationToSource relation_to_source_;\n\n  GTEST_DISALLOW_ASSIGN_(NativeArray);\n};\n\n}  // namespace internal\n}  // namespace testing\n\n#define GTEST_MESSAGE_AT_(file, line, message, result_type) \\\n  ::testing::internal::AssertHelper(result_type, file, line, message) \\\n    = ::testing::Message()\n\n#define GTEST_MESSAGE_(message, result_type) \\\n  GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)\n\n#define GTEST_FATAL_FAILURE_(message) \\\n  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)\n\n#define GTEST_NONFATAL_FAILURE_(message) \\\n  GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)\n\n#define GTEST_SUCCESS_(message) \\\n  GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)\n\n// Suppresses MSVC warnings 4072 (unreachable code) for the code following\n// statement if it returns or throws (or doesn't return or throw in some\n// situations).\n#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \\\n  if (::testing::internal::AlwaysTrue()) { statement; }\n\n#define GTEST_TEST_THROW_(statement, expected_exception, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::ConstCharPtr gtest_msg = \"\") { \\\n    bool gtest_caught_expected = false; \\\n    try { \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    } \\\n    catch (expected_exception const&) { \\\n      gtest_caught_expected = true; \\\n    } \\\n    catch (...) { \\\n      gtest_msg.value = \\\n          \"Expected: \" #statement \" throws an exception of type \" \\\n          #expected_exception \".\\n  Actual: it throws a different type.\"; \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \\\n    } \\\n    if (!gtest_caught_expected) { \\\n      gtest_msg.value = \\\n          \"Expected: \" #statement \" throws an exception of type \" \\\n          #expected_exception \".\\n  Actual: it throws nothing.\"; \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \\\n      fail(gtest_msg.value)\n\n#define GTEST_TEST_NO_THROW_(statement, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    try { \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    } \\\n    catch (...) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \\\n      fail(\"Expected: \" #statement \" doesn't throw an exception.\\n\" \\\n           \"  Actual: it throws.\")\n\n#define GTEST_TEST_ANY_THROW_(statement, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    bool gtest_caught_any = false; \\\n    try { \\\n      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    } \\\n    catch (...) { \\\n      gtest_caught_any = true; \\\n    } \\\n    if (!gtest_caught_any) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \\\n      fail(\"Expected: \" #statement \" throws an exception.\\n\" \\\n           \"  Actual: it doesn't.\")\n\n\n// Implements Boolean test assertions such as EXPECT_TRUE. expression can be\n// either a boolean expression or an AssertionResult. text is a textual\n// represenation of expression as it was passed into the EXPECT_TRUE.\n#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (const ::testing::AssertionResult gtest_ar_ = \\\n      ::testing::AssertionResult(expression)) \\\n    ; \\\n  else \\\n    fail(::testing::internal::GetBoolAssertionFailureMessage(\\\n        gtest_ar_, text, #actual, #expected).c_str())\n\n#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n  if (::testing::internal::AlwaysTrue()) { \\\n    ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \\\n    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \\\n    if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \\\n      goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \\\n    } \\\n  } else \\\n    GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \\\n      fail(\"Expected: \" #statement \" doesn't generate new fatal \" \\\n           \"failures in the current thread.\\n\" \\\n           \"  Actual: it does.\")\n\n// Expands to the name of the class that implements the given test.\n#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \\\n  test_case_name##_##test_name##_Test\n\n// Helper macro for defining tests.\n#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\\\nclass GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\\\n public:\\\n  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\\\n private:\\\n  virtual void TestBody();\\\n  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\\\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(\\\n      GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\\\n};\\\n\\\n::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\\\n  ::test_info_ =\\\n    ::testing::internal::MakeAndRegisterTestInfo(\\\n        #test_case_name, #test_name, NULL, NULL, \\\n        (parent_id), \\\n        parent_class::SetUpTestCase, \\\n        parent_class::TearDownTestCase, \\\n        new ::testing::internal::TestFactoryImpl<\\\n            GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\\\nvoid GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-linked_ptr.h",
    "content": "// Copyright 2003 Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: Dan Egnor (egnor@google.com)\n//\n// A \"smart\" pointer type with reference tracking.  Every pointer to a\n// particular object is kept on a circular linked list.  When the last pointer\n// to an object is destroyed or reassigned, the object is deleted.\n//\n// Used properly, this deletes the object when the last reference goes away.\n// There are several caveats:\n// - Like all reference counting schemes, cycles lead to leaks.\n// - Each smart pointer is actually two pointers (8 bytes instead of 4).\n// - Every time a pointer is assigned, the entire list of pointers to that\n//   object is traversed.  This class is therefore NOT SUITABLE when there\n//   will often be more than two or three pointers to a particular object.\n// - References are only tracked as long as linked_ptr<> objects are copied.\n//   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS\n//   will happen (double deletion).\n//\n// A good use of this class is storing object references in STL containers.\n// You can safely put linked_ptr<> in a vector<>.\n// Other uses may not be as good.\n//\n// Note: If you use an incomplete type with linked_ptr<>, the class\n// *containing* linked_ptr<> must have a constructor and destructor (even\n// if they do nothing!).\n//\n// Bill Gibbons suggested we use something like this.\n//\n// Thread Safety:\n//   Unlike other linked_ptr implementations, in this implementation\n//   a linked_ptr object is thread-safe in the sense that:\n//     - it's safe to copy linked_ptr objects concurrently,\n//     - it's safe to copy *from* a linked_ptr and read its underlying\n//       raw pointer (e.g. via get()) concurrently, and\n//     - it's safe to write to two linked_ptrs that point to the same\n//       shared object concurrently.\n// TODO(wan@google.com): rename this to safe_linked_ptr to avoid\n// confusion with normal linked_ptr.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_\n\n#include <stdlib.h>\n#include <assert.h>\n\n#include \"gtest/internal/gtest-port.h\"\n\nnamespace testing {\nnamespace internal {\n\n// Protects copying of all linked_ptr objects.\nGTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);\n\n// This is used internally by all instances of linked_ptr<>.  It needs to be\n// a non-template class because different types of linked_ptr<> can refer to\n// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).\n// So, it needs to be possible for different types of linked_ptr to participate\n// in the same circular linked list, so we need a single class type here.\n//\n// DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.\nclass linked_ptr_internal {\n public:\n  // Create a new circle that includes only this instance.\n  void join_new() {\n    next_ = this;\n  }\n\n  // Many linked_ptr operations may change p.link_ for some linked_ptr\n  // variable p in the same circle as this object.  Therefore we need\n  // to prevent two such operations from occurring concurrently.\n  //\n  // Note that different types of linked_ptr objects can coexist in a\n  // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and\n  // linked_ptr<Derived2>).  Therefore we must use a single mutex to\n  // protect all linked_ptr objects.  This can create serious\n  // contention in production code, but is acceptable in a testing\n  // framework.\n\n  // Join an existing circle.\n  void join(linked_ptr_internal const* ptr)\n      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {\n    MutexLock lock(&g_linked_ptr_mutex);\n\n    linked_ptr_internal const* p = ptr;\n    while (p->next_ != ptr) p = p->next_;\n    p->next_ = this;\n    next_ = ptr;\n  }\n\n  // Leave whatever circle we're part of.  Returns true if we were the\n  // last member of the circle.  Once this is done, you can join() another.\n  bool depart()\n      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {\n    MutexLock lock(&g_linked_ptr_mutex);\n\n    if (next_ == this) return true;\n    linked_ptr_internal const* p = next_;\n    while (p->next_ != this) p = p->next_;\n    p->next_ = next_;\n    return false;\n  }\n\n private:\n  mutable linked_ptr_internal const* next_;\n};\n\ntemplate <typename T>\nclass linked_ptr {\n public:\n  typedef T element_type;\n\n  // Take over ownership of a raw pointer.  This should happen as soon as\n  // possible after the object is created.\n  explicit linked_ptr(T* ptr = NULL) { capture(ptr); }\n  ~linked_ptr() { depart(); }\n\n  // Copy an existing linked_ptr<>, adding ourselves to the list of references.\n  template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }\n  linked_ptr(linked_ptr const& ptr) {  // NOLINT\n    assert(&ptr != this);\n    copy(&ptr);\n  }\n\n  // Assignment releases the old value and acquires the new.\n  template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {\n    depart();\n    copy(&ptr);\n    return *this;\n  }\n\n  linked_ptr& operator=(linked_ptr const& ptr) {\n    if (&ptr != this) {\n      depart();\n      copy(&ptr);\n    }\n    return *this;\n  }\n\n  // Smart pointer members.\n  void reset(T* ptr = NULL) {\n    depart();\n    capture(ptr);\n  }\n  T* get() const { return value_; }\n  T* operator->() const { return value_; }\n  T& operator*() const { return *value_; }\n\n  bool operator==(T* p) const { return value_ == p; }\n  bool operator!=(T* p) const { return value_ != p; }\n  template <typename U>\n  bool operator==(linked_ptr<U> const& ptr) const {\n    return value_ == ptr.get();\n  }\n  template <typename U>\n  bool operator!=(linked_ptr<U> const& ptr) const {\n    return value_ != ptr.get();\n  }\n\n private:\n  template <typename U>\n  friend class linked_ptr;\n\n  T* value_;\n  linked_ptr_internal link_;\n\n  void depart() {\n    if (link_.depart()) delete value_;\n  }\n\n  void capture(T* ptr) {\n    value_ = ptr;\n    link_.join_new();\n  }\n\n  template <typename U> void copy(linked_ptr<U> const* ptr) {\n    value_ = ptr->get();\n    if (value_)\n      link_.join(&ptr->link_);\n    else\n      link_.join_new();\n  }\n};\n\ntemplate<typename T> inline\nbool operator==(T* ptr, const linked_ptr<T>& x) {\n  return ptr == x.get();\n}\n\ntemplate<typename T> inline\nbool operator!=(T* ptr, const linked_ptr<T>& x) {\n  return ptr != x.get();\n}\n\n// A function to convert T* into linked_ptr<T>\n// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation\n// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))\ntemplate <typename T>\nlinked_ptr<T> make_linked_ptr(T* ptr) {\n  return linked_ptr<T>(ptr);\n}\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-param-util-generated.h",
    "content": "// This file was GENERATED by command:\n//     pump.py gtest-param-util-generated.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// Type and function utilities for implementing parameterized tests.\n// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n// Currently Google Test supports at most 50 arguments in Values,\n// and at most 10 arguments in Combine. Please contact\n// googletestframework@googlegroups.com if you need more.\n// Please note that the number of arguments to Combine is limited\n// by the maximum arity of the implementation of tr1::tuple which is\n// currently set at 10.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n#include \"gtest/internal/gtest-param-util.h\"\n#include \"gtest/internal/gtest-port.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\n\n// Forward declarations of ValuesIn(), which is implemented in\n// include/gtest/gtest-param-test.h.\ntemplate <typename ForwardIterator>\ninternal::ParamGenerator<\n  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>\nValuesIn(ForwardIterator begin, ForwardIterator end);\n\ntemplate <typename T, size_t N>\ninternal::ParamGenerator<T> ValuesIn(const T (&array)[N]);\n\ntemplate <class Container>\ninternal::ParamGenerator<typename Container::value_type> ValuesIn(\n    const Container& container);\n\nnamespace internal {\n\n// Used in the Values() function to provide polymorphic capabilities.\ntemplate <typename T1>\nclass ValueArray1 {\n public:\n  explicit ValueArray1(T1 v1) : v1_(v1) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray1& other);\n\n  const T1 v1_;\n};\n\ntemplate <typename T1, typename T2>\nclass ValueArray2 {\n public:\n  ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray2& other);\n\n  const T1 v1_;\n  const T2 v2_;\n};\n\ntemplate <typename T1, typename T2, typename T3>\nclass ValueArray3 {\n public:\n  ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray3& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nclass ValueArray4 {\n public:\n  ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray4& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nclass ValueArray5 {\n public:\n  ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray5& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nclass ValueArray6 {\n public:\n  ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray6& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nclass ValueArray7 {\n public:\n  ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray7& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nclass ValueArray8 {\n public:\n  ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,\n      T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray8& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nclass ValueArray9 {\n public:\n  ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,\n      T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray9& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nclass ValueArray10 {\n public:\n  ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray10& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\nclass ValueArray11 {\n public:\n  ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray11& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\nclass ValueArray12 {\n public:\n  ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray12& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\nclass ValueArray13 {\n public:\n  ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray13& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\nclass ValueArray14 {\n public:\n  ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray14& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\nclass ValueArray15 {\n public:\n  ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray15& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\nclass ValueArray16 {\n public:\n  ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray16& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\nclass ValueArray17 {\n public:\n  ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,\n      T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray17& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\nclass ValueArray18 {\n public:\n  ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray18& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\nclass ValueArray19 {\n public:\n  ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray19& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\nclass ValueArray20 {\n public:\n  ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray20& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\nclass ValueArray21 {\n public:\n  ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray21& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\nclass ValueArray22 {\n public:\n  ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray22& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\nclass ValueArray23 {\n public:\n  ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray23& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\nclass ValueArray24 {\n public:\n  ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray24& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\nclass ValueArray25 {\n public:\n  ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,\n      T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray25& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\nclass ValueArray26 {\n public:\n  ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray26& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\nclass ValueArray27 {\n public:\n  ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),\n      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),\n      v26_(v26), v27_(v27) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray27& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\nclass ValueArray28 {\n public:\n  ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),\n      v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray28& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\nclass ValueArray29 {\n public:\n  ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),\n      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray29& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\nclass ValueArray30 {\n public:\n  ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray30& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\nclass ValueArray31 {\n public:\n  ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray31& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\nclass ValueArray32 {\n public:\n  ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),\n      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray32& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\nclass ValueArray33 {\n public:\n  ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,\n      T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray33& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\nclass ValueArray34 {\n public:\n  ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray34& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\nclass ValueArray35 {\n public:\n  ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),\n      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),\n      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),\n      v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray35& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\nclass ValueArray36 {\n public:\n  ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),\n      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),\n      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray36& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\nclass ValueArray37 {\n public:\n  ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),\n      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),\n      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),\n      v36_(v36), v37_(v37) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray37& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\nclass ValueArray38 {\n public:\n  ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray38& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\nclass ValueArray39 {\n public:\n  ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray39& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\nclass ValueArray40 {\n public:\n  ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),\n      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),\n      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),\n      v40_(v40) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray40& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\nclass ValueArray41 {\n public:\n  ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,\n      T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray41& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\nclass ValueArray42 {\n public:\n  ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray42& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\nclass ValueArray43 {\n public:\n  ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),\n      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),\n      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),\n      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),\n      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),\n      v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),\n      v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray43& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\nclass ValueArray44 {\n public:\n  ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),\n      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),\n      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),\n      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),\n      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),\n      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),\n      v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),\n      v43_(v43), v44_(v44) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray44& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\nclass ValueArray45 {\n public:\n  ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),\n      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),\n      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),\n      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),\n      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),\n      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),\n      v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),\n      v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray45& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\nclass ValueArray46 {\n public:\n  ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),\n      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),\n      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray46& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\nclass ValueArray47 {\n public:\n  ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),\n      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),\n      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),\n      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),\n      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),\n      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),\n      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),\n      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),\n      v47_(v47) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray47& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\nclass ValueArray48 {\n public:\n  ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),\n      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),\n      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),\n      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),\n      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),\n      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),\n      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),\n      v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),\n      v46_(v46), v47_(v47), v48_(v48) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),\n        static_cast<T>(v48_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray48& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n  const T48 v48_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\nclass ValueArray49 {\n public:\n  ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,\n      T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),\n      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),\n        static_cast<T>(v48_), static_cast<T>(v49_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray49& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n  const T48 v48_;\n  const T49 v49_;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\nclass ValueArray50 {\n public:\n  ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,\n      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,\n      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,\n      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,\n      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,\n      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,\n      T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),\n      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),\n      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),\n      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),\n      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),\n      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),\n      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),\n      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),\n        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),\n        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),\n        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),\n        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),\n        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),\n        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),\n        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),\n        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),\n        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),\n        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),\n        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),\n        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),\n        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),\n        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),\n        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),\n        static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray50& other);\n\n  const T1 v1_;\n  const T2 v2_;\n  const T3 v3_;\n  const T4 v4_;\n  const T5 v5_;\n  const T6 v6_;\n  const T7 v7_;\n  const T8 v8_;\n  const T9 v9_;\n  const T10 v10_;\n  const T11 v11_;\n  const T12 v12_;\n  const T13 v13_;\n  const T14 v14_;\n  const T15 v15_;\n  const T16 v16_;\n  const T17 v17_;\n  const T18 v18_;\n  const T19 v19_;\n  const T20 v20_;\n  const T21 v21_;\n  const T22 v22_;\n  const T23 v23_;\n  const T24 v24_;\n  const T25 v25_;\n  const T26 v26_;\n  const T27 v27_;\n  const T28 v28_;\n  const T29 v29_;\n  const T30 v30_;\n  const T31 v31_;\n  const T32 v32_;\n  const T33 v33_;\n  const T34 v34_;\n  const T35 v35_;\n  const T36 v36_;\n  const T37 v37_;\n  const T38 v38_;\n  const T39 v39_;\n  const T40 v40_;\n  const T41 v41_;\n  const T42 v42_;\n  const T43 v43_;\n  const T44 v44_;\n  const T45 v45_;\n  const T46 v46_;\n  const T47 v47_;\n  const T48 v48_;\n  const T49 v49_;\n  const T50 v50_;\n};\n\n# if GTEST_HAS_COMBINE\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Generates values from the Cartesian product of values produced\n// by the argument generators.\n//\ntemplate <typename T1, typename T2>\nclass CartesianProductGenerator2\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2> ParamType;\n\n  CartesianProductGenerator2(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2)\n      : g1_(g1), g2_(g2) {}\n  virtual ~CartesianProductGenerator2() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current2_;\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator2::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator2& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n};  // class CartesianProductGenerator2\n\n\ntemplate <typename T1, typename T2, typename T3>\nclass CartesianProductGenerator3\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3> ParamType;\n\n  CartesianProductGenerator3(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)\n      : g1_(g1), g2_(g2), g3_(g3) {}\n  virtual ~CartesianProductGenerator3() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current3_;\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator3::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator3& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n};  // class CartesianProductGenerator3\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nclass CartesianProductGenerator4\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;\n\n  CartesianProductGenerator4(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}\n  virtual ~CartesianProductGenerator4() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current4_;\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator4::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator4& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n};  // class CartesianProductGenerator4\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nclass CartesianProductGenerator5\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;\n\n  CartesianProductGenerator5(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}\n  virtual ~CartesianProductGenerator5() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current5_;\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator5::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator5& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n};  // class CartesianProductGenerator5\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nclass CartesianProductGenerator6\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,\n        T6> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;\n\n  CartesianProductGenerator6(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}\n  virtual ~CartesianProductGenerator6() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current6_;\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator6::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator6& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n};  // class CartesianProductGenerator6\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nclass CartesianProductGenerator7\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;\n\n  CartesianProductGenerator7(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}\n  virtual ~CartesianProductGenerator7() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current7_;\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator7::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator7& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n};  // class CartesianProductGenerator7\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nclass CartesianProductGenerator8\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7, T8> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;\n\n  CartesianProductGenerator8(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,\n      const ParamGenerator<T8>& g8)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),\n          g8_(g8) {}\n  virtual ~CartesianProductGenerator8() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin(), g8_, g8_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,\n        g8_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7,\n      const ParamGenerator<T8>& g8,\n      const typename ParamGenerator<T8>::iterator& current8)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),\n          begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current8_;\n      if (current8_ == end8_) {\n        current8_ = begin8_;\n        ++current7_;\n      }\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_ &&\n          current8_ == typed_other->current8_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_),\n        begin8_(other.begin8_),\n        end8_(other.end8_),\n        current8_(other.current8_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_, *current8_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_ ||\n          current8_ == end8_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    const typename ParamGenerator<T8>::iterator begin8_;\n    const typename ParamGenerator<T8>::iterator end8_;\n    typename ParamGenerator<T8>::iterator current8_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator8::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator8& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n  const ParamGenerator<T8> g8_;\n};  // class CartesianProductGenerator8\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nclass CartesianProductGenerator9\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7, T8, T9> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;\n\n  CartesianProductGenerator9(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,\n      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9) {}\n  virtual ~CartesianProductGenerator9() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,\n        g8_.end(), g9_, g9_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7,\n      const ParamGenerator<T8>& g8,\n      const typename ParamGenerator<T8>::iterator& current8,\n      const ParamGenerator<T9>& g9,\n      const typename ParamGenerator<T9>::iterator& current9)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),\n          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),\n          begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current9_;\n      if (current9_ == end9_) {\n        current9_ = begin9_;\n        ++current8_;\n      }\n      if (current8_ == end8_) {\n        current8_ = begin8_;\n        ++current7_;\n      }\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_ &&\n          current8_ == typed_other->current8_ &&\n          current9_ == typed_other->current9_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_),\n        begin8_(other.begin8_),\n        end8_(other.end8_),\n        current8_(other.current8_),\n        begin9_(other.begin9_),\n        end9_(other.end9_),\n        current9_(other.current9_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_, *current8_,\n            *current9_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_ ||\n          current8_ == end8_ ||\n          current9_ == end9_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    const typename ParamGenerator<T8>::iterator begin8_;\n    const typename ParamGenerator<T8>::iterator end8_;\n    typename ParamGenerator<T8>::iterator current8_;\n    const typename ParamGenerator<T9>::iterator begin9_;\n    const typename ParamGenerator<T9>::iterator end9_;\n    typename ParamGenerator<T9>::iterator current9_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator9::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator9& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n  const ParamGenerator<T8> g8_;\n  const ParamGenerator<T9> g9_;\n};  // class CartesianProductGenerator9\n\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nclass CartesianProductGenerator10\n    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n        T7, T8, T9, T10> > {\n public:\n  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;\n\n  CartesianProductGenerator10(const ParamGenerator<T1>& g1,\n      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,\n      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,\n      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,\n      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,\n      const ParamGenerator<T10>& g10)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9), g10_(g10) {}\n  virtual ~CartesianProductGenerator10() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,\n        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,\n        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),\n        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,\n        g8_.end(), g9_, g9_.end(), g10_, g10_.end());\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base,\n      const ParamGenerator<T1>& g1,\n      const typename ParamGenerator<T1>::iterator& current1,\n      const ParamGenerator<T2>& g2,\n      const typename ParamGenerator<T2>::iterator& current2,\n      const ParamGenerator<T3>& g3,\n      const typename ParamGenerator<T3>::iterator& current3,\n      const ParamGenerator<T4>& g4,\n      const typename ParamGenerator<T4>::iterator& current4,\n      const ParamGenerator<T5>& g5,\n      const typename ParamGenerator<T5>::iterator& current5,\n      const ParamGenerator<T6>& g6,\n      const typename ParamGenerator<T6>::iterator& current6,\n      const ParamGenerator<T7>& g7,\n      const typename ParamGenerator<T7>::iterator& current7,\n      const ParamGenerator<T8>& g8,\n      const typename ParamGenerator<T8>::iterator& current8,\n      const ParamGenerator<T9>& g9,\n      const typename ParamGenerator<T9>::iterator& current9,\n      const ParamGenerator<T10>& g10,\n      const typename ParamGenerator<T10>::iterator& current10)\n        : base_(base),\n          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),\n          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),\n          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),\n          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),\n          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),\n          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),\n          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),\n          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),\n          begin9_(g9.begin()), end9_(g9.end()), current9_(current9),\n          begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current10_;\n      if (current10_ == end10_) {\n        current10_ = begin10_;\n        ++current9_;\n      }\n      if (current9_ == end9_) {\n        current9_ = begin9_;\n        ++current8_;\n      }\n      if (current8_ == end8_) {\n        current8_ = begin8_;\n        ++current7_;\n      }\n      if (current7_ == end7_) {\n        current7_ = begin7_;\n        ++current6_;\n      }\n      if (current6_ == end6_) {\n        current6_ = begin6_;\n        ++current5_;\n      }\n      if (current5_ == end5_) {\n        current5_ = begin5_;\n        ++current4_;\n      }\n      if (current4_ == end4_) {\n        current4_ = begin4_;\n        ++current3_;\n      }\n      if (current3_ == end3_) {\n        current3_ = begin3_;\n        ++current2_;\n      }\n      if (current2_ == end2_) {\n        current2_ = begin2_;\n        ++current1_;\n      }\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         (\n          current1_ == typed_other->current1_ &&\n          current2_ == typed_other->current2_ &&\n          current3_ == typed_other->current3_ &&\n          current4_ == typed_other->current4_ &&\n          current5_ == typed_other->current5_ &&\n          current6_ == typed_other->current6_ &&\n          current7_ == typed_other->current7_ &&\n          current8_ == typed_other->current8_ &&\n          current9_ == typed_other->current9_ &&\n          current10_ == typed_other->current10_);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_),\n        begin1_(other.begin1_),\n        end1_(other.end1_),\n        current1_(other.current1_),\n        begin2_(other.begin2_),\n        end2_(other.end2_),\n        current2_(other.current2_),\n        begin3_(other.begin3_),\n        end3_(other.end3_),\n        current3_(other.current3_),\n        begin4_(other.begin4_),\n        end4_(other.end4_),\n        current4_(other.current4_),\n        begin5_(other.begin5_),\n        end5_(other.end5_),\n        current5_(other.current5_),\n        begin6_(other.begin6_),\n        end6_(other.end6_),\n        current6_(other.current6_),\n        begin7_(other.begin7_),\n        end7_(other.end7_),\n        current7_(other.current7_),\n        begin8_(other.begin8_),\n        end8_(other.end8_),\n        current8_(other.current8_),\n        begin9_(other.begin9_),\n        end9_(other.end9_),\n        current9_(other.current9_),\n        begin10_(other.begin10_),\n        end10_(other.end10_),\n        current10_(other.current10_) {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType(*current1_, *current2_, *current3_,\n            *current4_, *current5_, *current6_, *current7_, *current8_,\n            *current9_, *current10_);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n          current1_ == end1_ ||\n          current2_ == end2_ ||\n          current3_ == end3_ ||\n          current4_ == end4_ ||\n          current5_ == end5_ ||\n          current6_ == end6_ ||\n          current7_ == end7_ ||\n          current8_ == end8_ ||\n          current9_ == end9_ ||\n          current10_ == end10_;\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n    const typename ParamGenerator<T1>::iterator begin1_;\n    const typename ParamGenerator<T1>::iterator end1_;\n    typename ParamGenerator<T1>::iterator current1_;\n    const typename ParamGenerator<T2>::iterator begin2_;\n    const typename ParamGenerator<T2>::iterator end2_;\n    typename ParamGenerator<T2>::iterator current2_;\n    const typename ParamGenerator<T3>::iterator begin3_;\n    const typename ParamGenerator<T3>::iterator end3_;\n    typename ParamGenerator<T3>::iterator current3_;\n    const typename ParamGenerator<T4>::iterator begin4_;\n    const typename ParamGenerator<T4>::iterator end4_;\n    typename ParamGenerator<T4>::iterator current4_;\n    const typename ParamGenerator<T5>::iterator begin5_;\n    const typename ParamGenerator<T5>::iterator end5_;\n    typename ParamGenerator<T5>::iterator current5_;\n    const typename ParamGenerator<T6>::iterator begin6_;\n    const typename ParamGenerator<T6>::iterator end6_;\n    typename ParamGenerator<T6>::iterator current6_;\n    const typename ParamGenerator<T7>::iterator begin7_;\n    const typename ParamGenerator<T7>::iterator end7_;\n    typename ParamGenerator<T7>::iterator current7_;\n    const typename ParamGenerator<T8>::iterator begin8_;\n    const typename ParamGenerator<T8>::iterator end8_;\n    typename ParamGenerator<T8>::iterator current8_;\n    const typename ParamGenerator<T9>::iterator begin9_;\n    const typename ParamGenerator<T9>::iterator end9_;\n    typename ParamGenerator<T9>::iterator current9_;\n    const typename ParamGenerator<T10>::iterator begin10_;\n    const typename ParamGenerator<T10>::iterator end10_;\n    typename ParamGenerator<T10>::iterator current10_;\n    ParamType current_value_;\n  };  // class CartesianProductGenerator10::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator10& other);\n\n  const ParamGenerator<T1> g1_;\n  const ParamGenerator<T2> g2_;\n  const ParamGenerator<T3> g3_;\n  const ParamGenerator<T4> g4_;\n  const ParamGenerator<T5> g5_;\n  const ParamGenerator<T6> g6_;\n  const ParamGenerator<T7> g7_;\n  const ParamGenerator<T8> g8_;\n  const ParamGenerator<T9> g9_;\n  const ParamGenerator<T10> g10_;\n};  // class CartesianProductGenerator10\n\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Helper classes providing Combine() with polymorphic features. They allow\n// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is\n// convertible to U.\n//\ntemplate <class Generator1, class Generator2>\nclass CartesianProductHolder2 {\n public:\nCartesianProductHolder2(const Generator1& g1, const Generator2& g2)\n      : g1_(g1), g2_(g2) {}\n  template <typename T1, typename T2>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2> >(\n        new CartesianProductGenerator2<T1, T2>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder2& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n};  // class CartesianProductHolder2\n\ntemplate <class Generator1, class Generator2, class Generator3>\nclass CartesianProductHolder3 {\n public:\nCartesianProductHolder3(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3)\n      : g1_(g1), g2_(g2), g3_(g3) {}\n  template <typename T1, typename T2, typename T3>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(\n        new CartesianProductGenerator3<T1, T2, T3>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder3& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n};  // class CartesianProductHolder3\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4>\nclass CartesianProductHolder4 {\n public:\nCartesianProductHolder4(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}\n  template <typename T1, typename T2, typename T3, typename T4>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(\n        new CartesianProductGenerator4<T1, T2, T3, T4>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder4& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n};  // class CartesianProductHolder4\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5>\nclass CartesianProductHolder5 {\n public:\nCartesianProductHolder5(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(\n        new CartesianProductGenerator5<T1, T2, T3, T4, T5>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder5& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n};  // class CartesianProductHolder5\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6>\nclass CartesianProductHolder6 {\n public:\nCartesianProductHolder6(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(\n        new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder6& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n};  // class CartesianProductHolder6\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7>\nclass CartesianProductHolder7 {\n public:\nCartesianProductHolder7(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,\n      T7> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(\n        new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder7& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n};  // class CartesianProductHolder7\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7,\n    class Generator8>\nclass CartesianProductHolder8 {\n public:\nCartesianProductHolder8(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7, const Generator8& g8)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),\n          g8_(g8) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7, typename T8>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,\n      T8> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(\n        new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_),\n        static_cast<ParamGenerator<T8> >(g8_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder8& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n  const Generator8 g8_;\n};  // class CartesianProductHolder8\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7,\n    class Generator8, class Generator9>\nclass CartesianProductHolder9 {\n public:\nCartesianProductHolder9(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7, const Generator8& g8,\n    const Generator9& g9)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7, typename T8, typename T9>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n      T9> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n        T9> >(\n        new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_),\n        static_cast<ParamGenerator<T8> >(g8_),\n        static_cast<ParamGenerator<T9> >(g9_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder9& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n  const Generator8 g8_;\n  const Generator9 g9_;\n};  // class CartesianProductHolder9\n\ntemplate <class Generator1, class Generator2, class Generator3,\n    class Generator4, class Generator5, class Generator6, class Generator7,\n    class Generator8, class Generator9, class Generator10>\nclass CartesianProductHolder10 {\n public:\nCartesianProductHolder10(const Generator1& g1, const Generator2& g2,\n    const Generator3& g3, const Generator4& g4, const Generator5& g5,\n    const Generator6& g6, const Generator7& g7, const Generator8& g8,\n    const Generator9& g9, const Generator10& g10)\n      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),\n          g9_(g9), g10_(g10) {}\n  template <typename T1, typename T2, typename T3, typename T4, typename T5,\n      typename T6, typename T7, typename T8, typename T9, typename T10>\n  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n      T9, T10> >() const {\n    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,\n        T9, T10> >(\n        new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,\n            T10>(\n        static_cast<ParamGenerator<T1> >(g1_),\n        static_cast<ParamGenerator<T2> >(g2_),\n        static_cast<ParamGenerator<T3> >(g3_),\n        static_cast<ParamGenerator<T4> >(g4_),\n        static_cast<ParamGenerator<T5> >(g5_),\n        static_cast<ParamGenerator<T6> >(g6_),\n        static_cast<ParamGenerator<T7> >(g7_),\n        static_cast<ParamGenerator<T8> >(g8_),\n        static_cast<ParamGenerator<T9> >(g9_),\n        static_cast<ParamGenerator<T10> >(g10_)));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder10& other);\n\n  const Generator1 g1_;\n  const Generator2 g2_;\n  const Generator3 g3_;\n  const Generator4 g4_;\n  const Generator5 g5_;\n  const Generator6 g6_;\n  const Generator7 g7_;\n  const Generator8 g8_;\n  const Generator9 g9_;\n  const Generator10 g10_;\n};  // class CartesianProductHolder10\n\n# endif  // GTEST_HAS_COMBINE\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  //  GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-param-util-generated.h.pump",
    "content": "$$ -*- mode: c++; -*-\n$var n = 50  $$ Maximum length of Values arguments we want to support.\n$var maxtuple = 10  $$ Maximum number of Combine arguments we want to support.\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// Type and function utilities for implementing parameterized tests.\n// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n// Currently Google Test supports at most $n arguments in Values,\n// and at most $maxtuple arguments in Combine. Please contact\n// googletestframework@googlegroups.com if you need more.\n// Please note that the number of arguments to Combine is limited\n// by the maximum arity of the implementation of tr1::tuple which is\n// currently set at $maxtuple.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n#include \"gtest/internal/gtest-param-util.h\"\n#include \"gtest/internal/gtest-port.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\n\n// Forward declarations of ValuesIn(), which is implemented in\n// include/gtest/gtest-param-test.h.\ntemplate <typename ForwardIterator>\ninternal::ParamGenerator<\n  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>\nValuesIn(ForwardIterator begin, ForwardIterator end);\n\ntemplate <typename T, size_t N>\ninternal::ParamGenerator<T> ValuesIn(const T (&array)[N]);\n\ntemplate <class Container>\ninternal::ParamGenerator<typename Container::value_type> ValuesIn(\n    const Container& container);\n\nnamespace internal {\n\n// Used in the Values() function to provide polymorphic capabilities.\ntemplate <typename T1>\nclass ValueArray1 {\n public:\n  explicit ValueArray1(T1 v1) : v1_(v1) {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray1& other);\n\n  const T1 v1_;\n};\n\n$range i 2..n\n$for i [[\n$range j 1..i\n\ntemplate <$for j, [[typename T$j]]>\nclass ValueArray$i {\n public:\n  ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}\n\n  template <typename T>\n  operator ParamGenerator<T>() const {\n    const T array[] = {$for j, [[static_cast<T>(v$(j)_)]]};\n    return ValuesIn(array);\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const ValueArray$i& other);\n\n$for j [[\n\n  const T$j v$(j)_;\n]]\n\n};\n\n]]\n\n# if GTEST_HAS_COMBINE\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Generates values from the Cartesian product of values produced\n// by the argument generators.\n//\n$range i 2..maxtuple\n$for i [[\n$range j 1..i\n$range k 2..i\n\ntemplate <$for j, [[typename T$j]]>\nclass CartesianProductGenerator$i\n    : public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > {\n public:\n  typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType;\n\n  CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])\n      : $for j, [[g$(j)_(g$j)]] {}\n  virtual ~CartesianProductGenerator$i() {}\n\n  virtual ParamIteratorInterface<ParamType>* Begin() const {\n    return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]);\n  }\n  virtual ParamIteratorInterface<ParamType>* End() const {\n    return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]);\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<ParamType> {\n   public:\n    Iterator(const ParamGeneratorInterface<ParamType>* base, $for j, [[\n\n      const ParamGenerator<T$j>& g$j,\n      const typename ParamGenerator<T$j>::iterator& current$(j)]])\n        : base_(base),\n$for j, [[\n\n          begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j)\n]]    {\n      ComputeCurrentValue();\n    }\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {\n      return base_;\n    }\n    // Advance should not be called on beyond-of-range iterators\n    // so no component iterators must be beyond end of range, either.\n    virtual void Advance() {\n      assert(!AtEnd());\n      ++current$(i)_;\n\n$for k [[\n      if (current$(i+2-k)_ == end$(i+2-k)_) {\n        current$(i+2-k)_ = begin$(i+2-k)_;\n        ++current$(i+2-k-1)_;\n      }\n\n]]\n      ComputeCurrentValue();\n    }\n    virtual ParamIteratorInterface<ParamType>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const ParamType* Current() const { return &current_value_; }\n    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const Iterator* typed_other =\n          CheckedDowncastToActualType<const Iterator>(&other);\n      // We must report iterators equal if they both point beyond their\n      // respective ranges. That can happen in a variety of fashions,\n      // so we have to consult AtEnd().\n      return (AtEnd() && typed_other->AtEnd()) ||\n         ($for j  && [[\n\n          current$(j)_ == typed_other->current$(j)_\n]]);\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : base_(other.base_), $for j, [[\n\n        begin$(j)_(other.begin$(j)_),\n        end$(j)_(other.end$(j)_),\n        current$(j)_(other.current$(j)_)\n]] {\n      ComputeCurrentValue();\n    }\n\n    void ComputeCurrentValue() {\n      if (!AtEnd())\n        current_value_ = ParamType($for j, [[*current$(j)_]]);\n    }\n    bool AtEnd() const {\n      // We must report iterator past the end of the range when either of the\n      // component iterators has reached the end of its range.\n      return\n$for j  || [[\n\n          current$(j)_ == end$(j)_\n]];\n    }\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<ParamType>* const base_;\n    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.\n    // current[i]_ is the actual traversing iterator.\n$for j [[\n\n    const typename ParamGenerator<T$j>::iterator begin$(j)_;\n    const typename ParamGenerator<T$j>::iterator end$(j)_;\n    typename ParamGenerator<T$j>::iterator current$(j)_;\n]]\n\n    ParamType current_value_;\n  };  // class CartesianProductGenerator$i::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductGenerator$i& other);\n\n\n$for j [[\n  const ParamGenerator<T$j> g$(j)_;\n\n]]\n};  // class CartesianProductGenerator$i\n\n\n]]\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Helper classes providing Combine() with polymorphic features. They allow\n// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is\n// convertible to U.\n//\n$range i 2..maxtuple\n$for i [[\n$range j 1..i\n\ntemplate <$for j, [[class Generator$j]]>\nclass CartesianProductHolder$i {\n public:\nCartesianProductHolder$i($for j, [[const Generator$j& g$j]])\n      : $for j, [[g$(j)_(g$j)]] {}\n  template <$for j, [[typename T$j]]>\n  operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const {\n    return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >(\n        new CartesianProductGenerator$i<$for j, [[T$j]]>(\n$for j,[[\n\n        static_cast<ParamGenerator<T$j> >(g$(j)_)\n]]));\n  }\n\n private:\n  // No implementation - assignment is unsupported.\n  void operator=(const CartesianProductHolder$i& other);\n\n\n$for j [[\n  const Generator$j g$(j)_;\n\n]]\n};  // class CartesianProductHolder$i\n\n]]\n\n# endif  // GTEST_HAS_COMBINE\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  //  GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-param-util.h",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// Type and function utilities for implementing parameterized tests.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_\n\n#include <iterator>\n#include <utility>\n#include <vector>\n\n// scripts/fuse_gtest.py depends on gtest's own header being #included\n// *unconditionally*.  Therefore these #includes cannot be moved\n// inside #if GTEST_HAS_PARAM_TEST.\n#include \"gtest/internal/gtest-internal.h\"\n#include \"gtest/internal/gtest-linked_ptr.h\"\n#include \"gtest/internal/gtest-port.h\"\n#include \"gtest/gtest-printers.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nnamespace testing {\nnamespace internal {\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Outputs a message explaining invalid registration of different\n// fixture class for the same test case. This may happen when\n// TEST_P macro is used to define two tests with the same name\n// but in different namespaces.\nGTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,\n                                          const char* file, int line);\n\ntemplate <typename> class ParamGeneratorInterface;\ntemplate <typename> class ParamGenerator;\n\n// Interface for iterating over elements provided by an implementation\n// of ParamGeneratorInterface<T>.\ntemplate <typename T>\nclass ParamIteratorInterface {\n public:\n  virtual ~ParamIteratorInterface() {}\n  // A pointer to the base generator instance.\n  // Used only for the purposes of iterator comparison\n  // to make sure that two iterators belong to the same generator.\n  virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;\n  // Advances iterator to point to the next element\n  // provided by the generator. The caller is responsible\n  // for not calling Advance() on an iterator equal to\n  // BaseGenerator()->End().\n  virtual void Advance() = 0;\n  // Clones the iterator object. Used for implementing copy semantics\n  // of ParamIterator<T>.\n  virtual ParamIteratorInterface* Clone() const = 0;\n  // Dereferences the current iterator and provides (read-only) access\n  // to the pointed value. It is the caller's responsibility not to call\n  // Current() on an iterator equal to BaseGenerator()->End().\n  // Used for implementing ParamGenerator<T>::operator*().\n  virtual const T* Current() const = 0;\n  // Determines whether the given iterator and other point to the same\n  // element in the sequence generated by the generator.\n  // Used for implementing ParamGenerator<T>::operator==().\n  virtual bool Equals(const ParamIteratorInterface& other) const = 0;\n};\n\n// Class iterating over elements provided by an implementation of\n// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>\n// and implements the const forward iterator concept.\ntemplate <typename T>\nclass ParamIterator {\n public:\n  typedef T value_type;\n  typedef const T& reference;\n  typedef ptrdiff_t difference_type;\n\n  // ParamIterator assumes ownership of the impl_ pointer.\n  ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}\n  ParamIterator& operator=(const ParamIterator& other) {\n    if (this != &other)\n      impl_.reset(other.impl_->Clone());\n    return *this;\n  }\n\n  const T& operator*() const { return *impl_->Current(); }\n  const T* operator->() const { return impl_->Current(); }\n  // Prefix version of operator++.\n  ParamIterator& operator++() {\n    impl_->Advance();\n    return *this;\n  }\n  // Postfix version of operator++.\n  ParamIterator operator++(int /*unused*/) {\n    ParamIteratorInterface<T>* clone = impl_->Clone();\n    impl_->Advance();\n    return ParamIterator(clone);\n  }\n  bool operator==(const ParamIterator& other) const {\n    return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);\n  }\n  bool operator!=(const ParamIterator& other) const {\n    return !(*this == other);\n  }\n\n private:\n  friend class ParamGenerator<T>;\n  explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}\n  scoped_ptr<ParamIteratorInterface<T> > impl_;\n};\n\n// ParamGeneratorInterface<T> is the binary interface to access generators\n// defined in other translation units.\ntemplate <typename T>\nclass ParamGeneratorInterface {\n public:\n  typedef T ParamType;\n\n  virtual ~ParamGeneratorInterface() {}\n\n  // Generator interface definition\n  virtual ParamIteratorInterface<T>* Begin() const = 0;\n  virtual ParamIteratorInterface<T>* End() const = 0;\n};\n\n// Wraps ParamGeneratorInterface<T> and provides general generator syntax\n// compatible with the STL Container concept.\n// This class implements copy initialization semantics and the contained\n// ParamGeneratorInterface<T> instance is shared among all copies\n// of the original object. This is possible because that instance is immutable.\ntemplate<typename T>\nclass ParamGenerator {\n public:\n  typedef ParamIterator<T> iterator;\n\n  explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}\n  ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}\n\n  ParamGenerator& operator=(const ParamGenerator& other) {\n    impl_ = other.impl_;\n    return *this;\n  }\n\n  iterator begin() const { return iterator(impl_->Begin()); }\n  iterator end() const { return iterator(impl_->End()); }\n\n private:\n  linked_ptr<const ParamGeneratorInterface<T> > impl_;\n};\n\n// Generates values from a range of two comparable values. Can be used to\n// generate sequences of user-defined types that implement operator+() and\n// operator<().\n// This class is used in the Range() function.\ntemplate <typename T, typename IncrementT>\nclass RangeGenerator : public ParamGeneratorInterface<T> {\n public:\n  RangeGenerator(T begin, T end, IncrementT step)\n      : begin_(begin), end_(end),\n        step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}\n  virtual ~RangeGenerator() {}\n\n  virtual ParamIteratorInterface<T>* Begin() const {\n    return new Iterator(this, begin_, 0, step_);\n  }\n  virtual ParamIteratorInterface<T>* End() const {\n    return new Iterator(this, end_, end_index_, step_);\n  }\n\n private:\n  class Iterator : public ParamIteratorInterface<T> {\n   public:\n    Iterator(const ParamGeneratorInterface<T>* base, T value, int index,\n             IncrementT step)\n        : base_(base), value_(value), index_(index), step_(step) {}\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {\n      return base_;\n    }\n    virtual void Advance() {\n      value_ = value_ + step_;\n      index_++;\n    }\n    virtual ParamIteratorInterface<T>* Clone() const {\n      return new Iterator(*this);\n    }\n    virtual const T* Current() const { return &value_; }\n    virtual bool Equals(const ParamIteratorInterface<T>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      const int other_index =\n          CheckedDowncastToActualType<const Iterator>(&other)->index_;\n      return index_ == other_index;\n    }\n\n   private:\n    Iterator(const Iterator& other)\n        : ParamIteratorInterface<T>(),\n          base_(other.base_), value_(other.value_), index_(other.index_),\n          step_(other.step_) {}\n\n    // No implementation - assignment is unsupported.\n    void operator=(const Iterator& other);\n\n    const ParamGeneratorInterface<T>* const base_;\n    T value_;\n    int index_;\n    const IncrementT step_;\n  };  // class RangeGenerator::Iterator\n\n  static int CalculateEndIndex(const T& begin,\n                               const T& end,\n                               const IncrementT& step) {\n    int end_index = 0;\n    for (T i = begin; i < end; i = i + step)\n      end_index++;\n    return end_index;\n  }\n\n  // No implementation - assignment is unsupported.\n  void operator=(const RangeGenerator& other);\n\n  const T begin_;\n  const T end_;\n  const IncrementT step_;\n  // The index for the end() iterator. All the elements in the generated\n  // sequence are indexed (0-based) to aid iterator comparison.\n  const int end_index_;\n};  // class RangeGenerator\n\n\n// Generates values from a pair of STL-style iterators. Used in the\n// ValuesIn() function. The elements are copied from the source range\n// since the source can be located on the stack, and the generator\n// is likely to persist beyond that stack frame.\ntemplate <typename T>\nclass ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {\n public:\n  template <typename ForwardIterator>\n  ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)\n      : container_(begin, end) {}\n  virtual ~ValuesInIteratorRangeGenerator() {}\n\n  virtual ParamIteratorInterface<T>* Begin() const {\n    return new Iterator(this, container_.begin());\n  }\n  virtual ParamIteratorInterface<T>* End() const {\n    return new Iterator(this, container_.end());\n  }\n\n private:\n  typedef typename ::std::vector<T> ContainerType;\n\n  class Iterator : public ParamIteratorInterface<T> {\n   public:\n    Iterator(const ParamGeneratorInterface<T>* base,\n             typename ContainerType::const_iterator iterator)\n        : base_(base), iterator_(iterator) {}\n    virtual ~Iterator() {}\n\n    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {\n      return base_;\n    }\n    virtual void Advance() {\n      ++iterator_;\n      value_.reset();\n    }\n    virtual ParamIteratorInterface<T>* Clone() const {\n      return new Iterator(*this);\n    }\n    // We need to use cached value referenced by iterator_ because *iterator_\n    // can return a temporary object (and of type other then T), so just\n    // having \"return &*iterator_;\" doesn't work.\n    // value_ is updated here and not in Advance() because Advance()\n    // can advance iterator_ beyond the end of the range, and we cannot\n    // detect that fact. The client code, on the other hand, is\n    // responsible for not calling Current() on an out-of-range iterator.\n    virtual const T* Current() const {\n      if (value_.get() == NULL)\n        value_.reset(new T(*iterator_));\n      return value_.get();\n    }\n    virtual bool Equals(const ParamIteratorInterface<T>& other) const {\n      // Having the same base generator guarantees that the other\n      // iterator is of the same type and we can downcast.\n      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())\n          << \"The program attempted to compare iterators \"\n          << \"from different generators.\" << std::endl;\n      return iterator_ ==\n          CheckedDowncastToActualType<const Iterator>(&other)->iterator_;\n    }\n\n   private:\n    Iterator(const Iterator& other)\n          // The explicit constructor call suppresses a false warning\n          // emitted by gcc when supplied with the -Wextra option.\n        : ParamIteratorInterface<T>(),\n          base_(other.base_),\n          iterator_(other.iterator_) {}\n\n    const ParamGeneratorInterface<T>* const base_;\n    typename ContainerType::const_iterator iterator_;\n    // A cached value of *iterator_. We keep it here to allow access by\n    // pointer in the wrapping iterator's operator->().\n    // value_ needs to be mutable to be accessed in Current().\n    // Use of scoped_ptr helps manage cached value's lifetime,\n    // which is bound by the lifespan of the iterator itself.\n    mutable scoped_ptr<const T> value_;\n  };  // class ValuesInIteratorRangeGenerator::Iterator\n\n  // No implementation - assignment is unsupported.\n  void operator=(const ValuesInIteratorRangeGenerator& other);\n\n  const ContainerType container_;\n};  // class ValuesInIteratorRangeGenerator\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Stores a parameter value and later creates tests parameterized with that\n// value.\ntemplate <class TestClass>\nclass ParameterizedTestFactory : public TestFactoryBase {\n public:\n  typedef typename TestClass::ParamType ParamType;\n  explicit ParameterizedTestFactory(ParamType parameter) :\n      parameter_(parameter) {}\n  virtual Test* CreateTest() {\n    TestClass::SetParam(&parameter_);\n    return new TestClass();\n  }\n\n private:\n  const ParamType parameter_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// TestMetaFactoryBase is a base class for meta-factories that create\n// test factories for passing into MakeAndRegisterTestInfo function.\ntemplate <class ParamType>\nclass TestMetaFactoryBase {\n public:\n  virtual ~TestMetaFactoryBase() {}\n\n  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// TestMetaFactory creates test factories for passing into\n// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives\n// ownership of test factory pointer, same factory object cannot be passed\n// into that method twice. But ParameterizedTestCaseInfo is going to call\n// it for each Test/Parameter value combination. Thus it needs meta factory\n// creator class.\ntemplate <class TestCase>\nclass TestMetaFactory\n    : public TestMetaFactoryBase<typename TestCase::ParamType> {\n public:\n  typedef typename TestCase::ParamType ParamType;\n\n  TestMetaFactory() {}\n\n  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {\n    return new ParameterizedTestFactory<TestCase>(parameter);\n  }\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// ParameterizedTestCaseInfoBase is a generic interface\n// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase\n// accumulates test information provided by TEST_P macro invocations\n// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations\n// and uses that information to register all resulting test instances\n// in RegisterTests method. The ParameterizeTestCaseRegistry class holds\n// a collection of pointers to the ParameterizedTestCaseInfo objects\n// and calls RegisterTests() on each of them when asked.\nclass ParameterizedTestCaseInfoBase {\n public:\n  virtual ~ParameterizedTestCaseInfoBase() {}\n\n  // Base part of test case name for display purposes.\n  virtual const string& GetTestCaseName() const = 0;\n  // Test case id to verify identity.\n  virtual TypeId GetTestCaseTypeId() const = 0;\n  // UnitTest class invokes this method to register tests in this\n  // test case right before running them in RUN_ALL_TESTS macro.\n  // This method should not be called more then once on any single\n  // instance of a ParameterizedTestCaseInfoBase derived class.\n  virtual void RegisterTests() = 0;\n\n protected:\n  ParameterizedTestCaseInfoBase() {}\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);\n};\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P\n// macro invocations for a particular test case and generators\n// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that\n// test case. It registers tests with all values generated by all\n// generators when asked.\ntemplate <class TestCase>\nclass ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {\n public:\n  // ParamType and GeneratorCreationFunc are private types but are required\n  // for declarations of public methods AddTestPattern() and\n  // AddTestCaseInstantiation().\n  typedef typename TestCase::ParamType ParamType;\n  // A function that returns an instance of appropriate generator type.\n  typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();\n\n  explicit ParameterizedTestCaseInfo(const char* name)\n      : test_case_name_(name) {}\n\n  // Test case base name for display purposes.\n  virtual const string& GetTestCaseName() const { return test_case_name_; }\n  // Test case id to verify identity.\n  virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }\n  // TEST_P macro uses AddTestPattern() to record information\n  // about a single test in a LocalTestInfo structure.\n  // test_case_name is the base name of the test case (without invocation\n  // prefix). test_base_name is the name of an individual test without\n  // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is\n  // test case base name and DoBar is test base name.\n  void AddTestPattern(const char* test_case_name,\n                      const char* test_base_name,\n                      TestMetaFactoryBase<ParamType>* meta_factory) {\n    tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,\n                                                       test_base_name,\n                                                       meta_factory)));\n  }\n  // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information\n  // about a generator.\n  int AddTestCaseInstantiation(const string& instantiation_name,\n                               GeneratorCreationFunc* func,\n                               const char* /* file */,\n                               int /* line */) {\n    instantiations_.push_back(::std::make_pair(instantiation_name, func));\n    return 0;  // Return value used only to run this method in namespace scope.\n  }\n  // UnitTest class invokes this method to register tests in this test case\n  // test cases right before running tests in RUN_ALL_TESTS macro.\n  // This method should not be called more then once on any single\n  // instance of a ParameterizedTestCaseInfoBase derived class.\n  // UnitTest has a guard to prevent from calling this method more then once.\n  virtual void RegisterTests() {\n    for (typename TestInfoContainer::iterator test_it = tests_.begin();\n         test_it != tests_.end(); ++test_it) {\n      linked_ptr<TestInfo> test_info = *test_it;\n      for (typename InstantiationContainer::iterator gen_it =\n               instantiations_.begin(); gen_it != instantiations_.end();\n               ++gen_it) {\n        const string& instantiation_name = gen_it->first;\n        ParamGenerator<ParamType> generator((*gen_it->second)());\n\n        string test_case_name;\n        if ( !instantiation_name.empty() )\n          test_case_name = instantiation_name + \"/\";\n        test_case_name += test_info->test_case_base_name;\n\n        int i = 0;\n        for (typename ParamGenerator<ParamType>::iterator param_it =\n                 generator.begin();\n             param_it != generator.end(); ++param_it, ++i) {\n          Message test_name_stream;\n          test_name_stream << test_info->test_base_name << \"/\" << i;\n          MakeAndRegisterTestInfo(\n              test_case_name.c_str(),\n              test_name_stream.GetString().c_str(),\n              NULL,  // No type parameter.\n              PrintToString(*param_it).c_str(),\n              GetTestCaseTypeId(),\n              TestCase::SetUpTestCase,\n              TestCase::TearDownTestCase,\n              test_info->test_meta_factory->CreateTestFactory(*param_it));\n        }  // for param_it\n      }  // for gen_it\n    }  // for test_it\n  }  // RegisterTests\n\n private:\n  // LocalTestInfo structure keeps information about a single test registered\n  // with TEST_P macro.\n  struct TestInfo {\n    TestInfo(const char* a_test_case_base_name,\n             const char* a_test_base_name,\n             TestMetaFactoryBase<ParamType>* a_test_meta_factory) :\n        test_case_base_name(a_test_case_base_name),\n        test_base_name(a_test_base_name),\n        test_meta_factory(a_test_meta_factory) {}\n\n    const string test_case_base_name;\n    const string test_base_name;\n    const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;\n  };\n  typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;\n  // Keeps pairs of <Instantiation name, Sequence generator creation function>\n  // received from INSTANTIATE_TEST_CASE_P macros.\n  typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >\n      InstantiationContainer;\n\n  const string test_case_name_;\n  TestInfoContainer tests_;\n  InstantiationContainer instantiations_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);\n};  // class ParameterizedTestCaseInfo\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase\n// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P\n// macros use it to locate their corresponding ParameterizedTestCaseInfo\n// descriptors.\nclass ParameterizedTestCaseRegistry {\n public:\n  ParameterizedTestCaseRegistry() {}\n  ~ParameterizedTestCaseRegistry() {\n    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();\n         it != test_case_infos_.end(); ++it) {\n      delete *it;\n    }\n  }\n\n  // Looks up or creates and returns a structure containing information about\n  // tests and instantiations of a particular test case.\n  template <class TestCase>\n  ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(\n      const char* test_case_name,\n      const char* file,\n      int line) {\n    ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;\n    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();\n         it != test_case_infos_.end(); ++it) {\n      if ((*it)->GetTestCaseName() == test_case_name) {\n        if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {\n          // Complain about incorrect usage of Google Test facilities\n          // and terminate the program since we cannot guaranty correct\n          // test case setup and tear-down in this case.\n          ReportInvalidTestCaseType(test_case_name,  file, line);\n          posix::Abort();\n        } else {\n          // At this point we are sure that the object we found is of the same\n          // type we are looking for, so we downcast it to that type\n          // without further checks.\n          typed_test_info = CheckedDowncastToActualType<\n              ParameterizedTestCaseInfo<TestCase> >(*it);\n        }\n        break;\n      }\n    }\n    if (typed_test_info == NULL) {\n      typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);\n      test_case_infos_.push_back(typed_test_info);\n    }\n    return typed_test_info;\n  }\n  void RegisterTests() {\n    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();\n         it != test_case_infos_.end(); ++it) {\n      (*it)->RegisterTests();\n    }\n  }\n\n private:\n  typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;\n\n  TestCaseInfoContainer test_case_infos_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);\n};\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  //  GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-port.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan)\n//\n// Low-level types and utilities for porting Google Test to various\n// platforms.  They are subject to change without notice.  DO NOT USE\n// THEM IN USER CODE.\n//\n// This file is fundamental to Google Test.  All other Google Test source\n// files are expected to #include this.  Therefore, it cannot #include\n// any other Google Test header.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_\n\n// The user can define the following macros in the build script to\n// control Google Test's behavior.  If the user doesn't define a macro\n// in this list, Google Test will define it.\n//\n//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)\n//                              is/isn't available.\n//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions\n//                              are enabled.\n//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string\n//                              is/isn't available (some systems define\n//                              ::string, which is different to std::string).\n//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string\n//                              is/isn't available (some systems define\n//                              ::wstring, which is different to std::wstring).\n//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular\n//                              expressions are/aren't available.\n//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>\n//                              is/isn't available.\n//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't\n//                              enabled.\n//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that\n//                              std::wstring does/doesn't work (Google Test can\n//                              be used where std::wstring is unavailable).\n//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple\n//                              is/isn't available.\n//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the\n//                              compiler supports Microsoft's \"Structured\n//                              Exception Handling\".\n//   GTEST_HAS_STREAM_REDIRECTION\n//                            - Define it to 1/0 to indicate whether the\n//                              platform supports I/O stream redirection using\n//                              dup() and dup2().\n//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google\n//                              Test's own tr1 tuple implementation should be\n//                              used.  Unused when the user sets\n//                              GTEST_HAS_TR1_TUPLE to 0.\n//   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test\n//                              is building in C++11/C++98 mode.\n//   GTEST_LINKED_AS_SHARED_LIBRARY\n//                            - Define to 1 when compiling tests that use\n//                              Google Test as a shared library (known as\n//                              DLL on Windows).\n//   GTEST_CREATE_SHARED_LIBRARY\n//                            - Define to 1 when compiling Google Test itself\n//                              as a shared library.\n\n// This header defines the following utilities:\n//\n// Macros indicating the current platform (defined to 1 if compiled on\n// the given platform; otherwise undefined):\n//   GTEST_OS_AIX      - IBM AIX\n//   GTEST_OS_CYGWIN   - Cygwin\n//   GTEST_OS_HPUX     - HP-UX\n//   GTEST_OS_LINUX    - Linux\n//     GTEST_OS_LINUX_ANDROID - Google Android\n//   GTEST_OS_MAC      - Mac OS X\n//     GTEST_OS_IOS    - iOS\n//       GTEST_OS_IOS_SIMULATOR - iOS simulator\n//   GTEST_OS_NACL     - Google Native Client (NaCl)\n//   GTEST_OS_OPENBSD  - OpenBSD\n//   GTEST_OS_QNX      - QNX\n//   GTEST_OS_SOLARIS  - Sun Solaris\n//   GTEST_OS_SYMBIAN  - Symbian\n//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)\n//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop\n//     GTEST_OS_WINDOWS_MINGW    - MinGW\n//     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile\n//   GTEST_OS_ZOS      - z/OS\n//\n// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the\n// most stable support.  Since core members of the Google Test project\n// don't have access to other platforms, support for them may be less\n// stable.  If you notice any problems on your platform, please notify\n// googletestframework@googlegroups.com (patches for fixing them are\n// even more welcome!).\n//\n// Note that it is possible that none of the GTEST_OS_* macros are defined.\n//\n// Macros indicating available Google Test features (defined to 1 if\n// the corresponding feature is supported; otherwise undefined):\n//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized\n//                            tests)\n//   GTEST_HAS_DEATH_TEST   - death tests\n//   GTEST_HAS_PARAM_TEST   - value-parameterized tests\n//   GTEST_HAS_TYPED_TEST   - typed tests\n//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests\n//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with\n//                            GTEST_HAS_POSIX_RE (see above) which users can\n//                            define themselves.\n//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;\n//                            the above two are mutually exclusive.\n//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().\n//\n// Macros for basic C++ coding:\n//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.\n//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a\n//                              variable don't have to be used.\n//   GTEST_DISALLOW_ASSIGN_   - disables operator=.\n//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.\n//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.\n//\n// Synchronization:\n//   Mutex, MutexLock, ThreadLocal, GetThreadCount()\n//                  - synchronization primitives.\n//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above\n//                         synchronization primitives have real implementations\n//                         and Google Test is thread-safe; or 0 otherwise.\n//\n// Template meta programming:\n//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.\n//   IteratorTraits - partial implementation of std::iterator_traits, which\n//                    is not available in libCstd when compiled with Sun C++.\n//\n// Smart pointers:\n//   scoped_ptr     - as in TR2.\n//\n// Regular expressions:\n//   RE             - a simple regular expression class using the POSIX\n//                    Extended Regular Expression syntax on UNIX-like\n//                    platforms, or a reduced regular exception syntax on\n//                    other platforms, including Windows.\n//\n// Logging:\n//   GTEST_LOG_()   - logs messages at the specified severity level.\n//   LogToStderr()  - directs all log messages to stderr.\n//   FlushInfoLog() - flushes informational log messages.\n//\n// Stdout and stderr capturing:\n//   CaptureStdout()     - starts capturing stdout.\n//   GetCapturedStdout() - stops capturing stdout and returns the captured\n//                         string.\n//   CaptureStderr()     - starts capturing stderr.\n//   GetCapturedStderr() - stops capturing stderr and returns the captured\n//                         string.\n//\n// Integer types:\n//   TypeWithSize   - maps an integer to a int type.\n//   Int32, UInt32, Int64, UInt64, TimeInMillis\n//                  - integers of known sizes.\n//   BiggestInt     - the biggest signed integer type.\n//\n// Command-line utilities:\n//   GTEST_FLAG()       - references a flag.\n//   GTEST_DECLARE_*()  - declares a flag.\n//   GTEST_DEFINE_*()   - defines a flag.\n//   GetInjectableArgvs() - returns the command line as a vector of strings.\n//\n// Environment variable utilities:\n//   GetEnv()             - gets the value of an environment variable.\n//   BoolFromGTestEnv()   - parses a bool environment variable.\n//   Int32FromGTestEnv()  - parses an Int32 environment variable.\n//   StringFromGTestEnv() - parses a string environment variable.\n\n#include <ctype.h>   // for isspace, etc\n#include <stddef.h>  // for ptrdiff_t\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#ifndef _WIN32_WCE\n# include <sys/types.h>\n# include <sys/stat.h>\n#endif  // !_WIN32_WCE\n\n#if defined __APPLE__\n# include <AvailabilityMacros.h>\n# include <TargetConditionals.h>\n#endif\n\n#include <iostream>  // NOLINT\n#include <sstream>  // NOLINT\n#include <string>  // NOLINT\n\n#define GTEST_DEV_EMAIL_ \"googletestframework@@googlegroups.com\"\n#define GTEST_FLAG_PREFIX_ \"gtest_\"\n#define GTEST_FLAG_PREFIX_DASH_ \"gtest-\"\n#define GTEST_FLAG_PREFIX_UPPER_ \"GTEST_\"\n#define GTEST_NAME_ \"Google Test\"\n#define GTEST_PROJECT_URL_ \"http://code.google.com/p/googletest/\"\n\n// Determines the version of gcc that is used to compile this.\n#ifdef __GNUC__\n// 40302 means version 4.3.2.\n# define GTEST_GCC_VER_ \\\n    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)\n#endif  // __GNUC__\n\n// Determines the platform on which Google Test is compiled.\n#ifdef __CYGWIN__\n# define GTEST_OS_CYGWIN 1\n#elif defined __SYMBIAN32__\n# define GTEST_OS_SYMBIAN 1\n#elif defined _WIN32\n# define GTEST_OS_WINDOWS 1\n# ifdef _WIN32_WCE\n#  define GTEST_OS_WINDOWS_MOBILE 1\n# elif defined(__MINGW__) || defined(__MINGW32__)\n#  define GTEST_OS_WINDOWS_MINGW 1\n# else\n#  define GTEST_OS_WINDOWS_DESKTOP 1\n# endif  // _WIN32_WCE\n#elif defined __APPLE__\n# define GTEST_OS_MAC 1\n# if TARGET_OS_IPHONE\n#  define GTEST_OS_IOS 1\n#  if TARGET_IPHONE_SIMULATOR\n#   define GTEST_OS_IOS_SIMULATOR 1\n#  endif\n# endif\n#elif defined __linux__\n# define GTEST_OS_LINUX 1\n# if defined __ANDROID__\n#  define GTEST_OS_LINUX_ANDROID 1\n# endif\n#elif defined __MVS__\n# define GTEST_OS_ZOS 1\n#elif defined(__sun) && defined(__SVR4)\n# define GTEST_OS_SOLARIS 1\n#elif defined(_AIX)\n# define GTEST_OS_AIX 1\n#elif defined(__hpux)\n# define GTEST_OS_HPUX 1\n#elif defined __native_client__\n# define GTEST_OS_NACL 1\n#elif defined __OpenBSD__\n# define GTEST_OS_OPENBSD 1\n#elif defined __QNX__\n# define GTEST_OS_QNX 1\n#endif  // __CYGWIN__\n\n#ifndef GTEST_LANG_CXX11\n// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when\n// -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a\n// value for __cplusplus, and recent versions of clang, gcc, and\n// probably other compilers set that too in C++11 mode.\n# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L\n// Compiling in at least C++11 mode.\n#  define GTEST_LANG_CXX11 1\n# else\n#  define GTEST_LANG_CXX11 0\n# endif\n#endif\n\n// Brings in definitions for functions used in the testing::internal::posix\n// namespace (read, write, close, chdir, isatty, stat). We do not currently\n// use them on Windows Mobile.\n#if !GTEST_OS_WINDOWS\n// This assumes that non-Windows OSes provide unistd.h. For OSes where this\n// is not the case, we need to include headers that provide the functions\n// mentioned above.\n# include <unistd.h>\n# include <strings.h>\n#elif !GTEST_OS_WINDOWS_MOBILE\n# include <direct.h>\n# include <io.h>\n#endif\n\n#if GTEST_OS_LINUX_ANDROID\n// Used to define __ANDROID_API__ matching the target NDK API level.\n#  include <android/api-level.h>  // NOLINT\n#endif\n\n// Defines this to true iff Google Test can use POSIX regular expressions.\n#ifndef GTEST_HAS_POSIX_RE\n# if GTEST_OS_LINUX_ANDROID\n// On Android, <regex.h> is only available starting with Gingerbread.\n#  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)\n# else\n#  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)\n# endif\n#endif\n\n#if GTEST_HAS_POSIX_RE\n\n// On some platforms, <regex.h> needs someone to define size_t, and\n// won't compile otherwise.  We can #include it here as we already\n// included <stdlib.h>, which is guaranteed to define size_t through\n// <stddef.h>.\n# include <regex.h>  // NOLINT\n\n# define GTEST_USES_POSIX_RE 1\n\n#elif GTEST_OS_WINDOWS\n\n// <regex.h> is not available on Windows.  Use our own simple regex\n// implementation instead.\n# define GTEST_USES_SIMPLE_RE 1\n\n#else\n\n// <regex.h> may not be available on this platform.  Use our own\n// simple regex implementation instead.\n# define GTEST_USES_SIMPLE_RE 1\n\n#endif  // GTEST_HAS_POSIX_RE\n\n#ifndef GTEST_HAS_EXCEPTIONS\n// The user didn't tell us whether exceptions are enabled, so we need\n// to figure it out.\n# if defined(_MSC_VER) || defined(__BORLANDC__)\n// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS\n// macro to enable exceptions, so we'll do the same.\n// Assumes that exceptions are enabled by default.\n#  ifndef _HAS_EXCEPTIONS\n#   define _HAS_EXCEPTIONS 1\n#  endif  // _HAS_EXCEPTIONS\n#  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS\n# elif defined(__GNUC__) && __EXCEPTIONS\n// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.\n#  define GTEST_HAS_EXCEPTIONS 1\n# elif defined(__SUNPRO_CC)\n// Sun Pro CC supports exceptions.  However, there is no compile-time way of\n// detecting whether they are enabled or not.  Therefore, we assume that\n// they are enabled unless the user tells us otherwise.\n#  define GTEST_HAS_EXCEPTIONS 1\n# elif defined(__IBMCPP__) && __EXCEPTIONS\n// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.\n#  define GTEST_HAS_EXCEPTIONS 1\n# elif defined(__HP_aCC)\n// Exception handling is in effect by default in HP aCC compiler. It has to\n// be turned of by +noeh compiler option if desired.\n#  define GTEST_HAS_EXCEPTIONS 1\n# else\n// For other compilers, we assume exceptions are disabled to be\n// conservative.\n#  define GTEST_HAS_EXCEPTIONS 0\n# endif  // defined(_MSC_VER) || defined(__BORLANDC__)\n#endif  // GTEST_HAS_EXCEPTIONS\n\n#if !defined(GTEST_HAS_STD_STRING)\n// Even though we don't use this macro any longer, we keep it in case\n// some clients still depend on it.\n# define GTEST_HAS_STD_STRING 1\n#elif !GTEST_HAS_STD_STRING\n// The user told us that ::std::string isn't available.\n# error \"Google Test cannot be used where ::std::string isn't available.\"\n#endif  // !defined(GTEST_HAS_STD_STRING)\n\n#ifndef GTEST_HAS_GLOBAL_STRING\n// The user didn't tell us whether ::string is available, so we need\n// to figure it out.\n\n# define GTEST_HAS_GLOBAL_STRING 0\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n#ifndef GTEST_HAS_STD_WSTRING\n// The user didn't tell us whether ::std::wstring is available, so we need\n// to figure it out.\n// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring\n//   is available.\n\n// Cygwin 1.7 and below doesn't support ::std::wstring.\n// Solaris' libc++ doesn't support it either.  Android has\n// no support for it at least as recent as Froyo (2.2).\n# define GTEST_HAS_STD_WSTRING \\\n    (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))\n\n#endif  // GTEST_HAS_STD_WSTRING\n\n#ifndef GTEST_HAS_GLOBAL_WSTRING\n// The user didn't tell us whether ::wstring is available, so we need\n// to figure it out.\n# define GTEST_HAS_GLOBAL_WSTRING \\\n    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// Determines whether RTTI is available.\n#ifndef GTEST_HAS_RTTI\n// The user didn't tell us whether RTTI is enabled, so we need to\n// figure it out.\n\n# ifdef _MSC_VER\n\n#  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.\n#   define GTEST_HAS_RTTI 1\n#  else\n#   define GTEST_HAS_RTTI 0\n#  endif\n\n// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.\n# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)\n\n#  ifdef __GXX_RTTI\n// When building against STLport with the Android NDK and with\n// -frtti -fno-exceptions, the build fails at link time with undefined\n// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,\n// so disable RTTI when detected.\n#   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \\\n       !defined(__EXCEPTIONS)\n#    define GTEST_HAS_RTTI 0\n#   else\n#    define GTEST_HAS_RTTI 1\n#   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS\n#  else\n#   define GTEST_HAS_RTTI 0\n#  endif  // __GXX_RTTI\n\n// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends\n// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the\n// first version with C++ support.\n# elif defined(__clang__)\n\n#  define GTEST_HAS_RTTI __has_feature(cxx_rtti)\n\n// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if\n// both the typeid and dynamic_cast features are present.\n# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)\n\n#  ifdef __RTTI_ALL__\n#   define GTEST_HAS_RTTI 1\n#  else\n#   define GTEST_HAS_RTTI 0\n#  endif\n\n# else\n\n// For all other compilers, we assume RTTI is enabled.\n#  define GTEST_HAS_RTTI 1\n\n# endif  // _MSC_VER\n\n#endif  // GTEST_HAS_RTTI\n\n// It's this header's responsibility to #include <typeinfo> when RTTI\n// is enabled.\n#if GTEST_HAS_RTTI\n# include <typeinfo>\n#endif\n\n// Determines whether Google Test can use the pthreads library.\n#ifndef GTEST_HAS_PTHREAD\n// The user didn't tell us explicitly, so we assume pthreads support is\n// available on Linux and Mac.\n//\n// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0\n// to your compiler flags.\n# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \\\n    || GTEST_OS_QNX)\n#endif  // GTEST_HAS_PTHREAD\n\n#if GTEST_HAS_PTHREAD\n// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is\n// true.\n# include <pthread.h>  // NOLINT\n\n// For timespec and nanosleep, used below.\n# include <time.h>  // NOLINT\n#endif\n\n// Determines whether Google Test can use tr1/tuple.  You can define\n// this macro to 0 to prevent Google Test from using tuple (any\n// feature depending on tuple with be disabled in this mode).\n#ifndef GTEST_HAS_TR1_TUPLE\n# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)\n// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.\n#  define GTEST_HAS_TR1_TUPLE 0\n# else\n// The user didn't tell us not to do it, so we assume it's OK.\n#  define GTEST_HAS_TR1_TUPLE 1\n# endif\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Determines whether Google Test's own tr1 tuple implementation\n// should be used.\n#ifndef GTEST_USE_OWN_TR1_TUPLE\n// The user didn't tell us, so we need to figure it out.\n\n// We use our own TR1 tuple if we aren't sure the user has an\n// implementation of it already.  At this time, libstdc++ 4.0.0+ and\n// MSVC 2010 are the only mainstream standard libraries that come\n// with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler\n// pretends to be GCC by defining __GNUC__ and friends, but cannot\n// compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1\n// tuple in a 323 MB Feature Pack download, which we cannot assume the\n// user has.  QNX's QCC compiler is a modified GCC but it doesn't\n// support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,\n// and it can be used with some compilers that define __GNUC__.\n# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \\\n      && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600\n#  define GTEST_ENV_HAS_TR1_TUPLE_ 1\n# endif\n\n// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used\n// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6\n// can build with clang but need to use gcc4.2's libstdc++).\n# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)\n#  define GTEST_ENV_HAS_STD_TUPLE_ 1\n# endif\n\n# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_\n#  define GTEST_USE_OWN_TR1_TUPLE 0\n# else\n#  define GTEST_USE_OWN_TR1_TUPLE 1\n# endif\n\n#endif  // GTEST_USE_OWN_TR1_TUPLE\n\n// To avoid conditional compilation everywhere, we make it\n// gtest-port.h's responsibility to #include the header implementing\n// tr1/tuple.\n#if GTEST_HAS_TR1_TUPLE\n\n# if GTEST_USE_OWN_TR1_TUPLE\n#  include \"gtest/internal/gtest-tuple.h\"\n# elif GTEST_ENV_HAS_STD_TUPLE_\n#  include <tuple>\n// C++11 puts its tuple into the ::std namespace rather than\n// ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.\n// This causes undefined behavior, but supported compilers react in\n// the way we intend.\nnamespace std {\nnamespace tr1 {\nusing ::std::get;\nusing ::std::make_tuple;\nusing ::std::tuple;\nusing ::std::tuple_element;\nusing ::std::tuple_size;\n}\n}\n\n# elif GTEST_OS_SYMBIAN\n\n// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to\n// use STLport's tuple implementation, which unfortunately doesn't\n// work as the copy of STLport distributed with Symbian is incomplete.\n// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to\n// use its own tuple implementation.\n#  ifdef BOOST_HAS_TR1_TUPLE\n#   undef BOOST_HAS_TR1_TUPLE\n#  endif  // BOOST_HAS_TR1_TUPLE\n\n// This prevents <boost/tr1/detail/config.hpp>, which defines\n// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.\n#  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED\n#  include <tuple>\n\n# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)\n// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does\n// not conform to the TR1 spec, which requires the header to be <tuple>.\n\n#  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302\n// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,\n// which is #included by <tr1/tuple>, to not compile when RTTI is\n// disabled.  _TR1_FUNCTIONAL is the header guard for\n// <tr1/functional>.  Hence the following #define is a hack to prevent\n// <tr1/functional> from being included.\n#   define _TR1_FUNCTIONAL 1\n#   include <tr1/tuple>\n#   undef _TR1_FUNCTIONAL  // Allows the user to #include\n                        // <tr1/functional> if he chooses to.\n#  else\n#   include <tr1/tuple>  // NOLINT\n#  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302\n\n# else\n// If the compiler is not GCC 4.0+, we assume the user is using a\n// spec-conforming TR1 implementation.\n#  include <tuple>  // NOLINT\n# endif  // GTEST_USE_OWN_TR1_TUPLE\n\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Determines whether clone(2) is supported.\n// Usually it will only be available on Linux, excluding\n// Linux on the Itanium architecture.\n// Also see http://linux.die.net/man/2/clone.\n#ifndef GTEST_HAS_CLONE\n// The user didn't tell us, so we need to figure it out.\n\n# if GTEST_OS_LINUX && !defined(__ia64__)\n#  if GTEST_OS_LINUX_ANDROID\n// On Android, clone() is only available on ARM starting with Gingerbread.\n#    if defined(__arm__) && __ANDROID_API__ >= 9\n#     define GTEST_HAS_CLONE 1\n#    else\n#     define GTEST_HAS_CLONE 0\n#    endif\n#  else\n#   define GTEST_HAS_CLONE 1\n#  endif\n# else\n#  define GTEST_HAS_CLONE 0\n# endif  // GTEST_OS_LINUX && !defined(__ia64__)\n\n#endif  // GTEST_HAS_CLONE\n\n// Determines whether to support stream redirection. This is used to test\n// output correctness and to implement death tests.\n#ifndef GTEST_HAS_STREAM_REDIRECTION\n// By default, we assume that stream redirection is supported on all\n// platforms except known mobile ones.\n# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN\n#  define GTEST_HAS_STREAM_REDIRECTION 0\n# else\n#  define GTEST_HAS_STREAM_REDIRECTION 1\n# endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n// Determines whether to support death tests.\n// Google Test does not support death tests for VC 7.1 and earlier as\n// abort() in a VC 7.1 application compiled as GUI in debug config\n// pops up a dialog window that cannot be suppressed programmatically.\n#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \\\n     (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \\\n     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \\\n     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \\\n     GTEST_OS_OPENBSD || GTEST_OS_QNX)\n# define GTEST_HAS_DEATH_TEST 1\n# include <vector>  // NOLINT\n#endif\n\n// We don't support MSVC 7.1 with exceptions disabled now.  Therefore\n// all the compilers we care about are adequate for supporting\n// value-parameterized tests.\n#define GTEST_HAS_PARAM_TEST 1\n\n// Determines whether to support type-driven tests.\n\n// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,\n// Sun Pro CC, IBM Visual Age, and HP aCC support.\n#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \\\n    defined(__IBMCPP__) || defined(__HP_aCC)\n# define GTEST_HAS_TYPED_TEST 1\n# define GTEST_HAS_TYPED_TEST_P 1\n#endif\n\n// Determines whether to support Combine(). This only makes sense when\n// value-parameterized tests are enabled.  The implementation doesn't\n// work on Sun Studio since it doesn't understand templated conversion\n// operators.\n#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)\n# define GTEST_HAS_COMBINE 1\n#endif\n\n// Determines whether the system compiler uses UTF-16 for encoding wide strings.\n#define GTEST_WIDE_STRING_USES_UTF16_ \\\n    (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)\n\n// Determines whether test results can be streamed to a socket.\n#if GTEST_OS_LINUX\n# define GTEST_CAN_STREAM_RESULTS_ 1\n#endif\n\n// Defines some utility macros.\n\n// The GNU compiler emits a warning if nested \"if\" statements are followed by\n// an \"else\" statement and braces are not used to explicitly disambiguate the\n// \"else\" binding.  This leads to problems with code like:\n//\n//   if (gate)\n//     ASSERT_*(condition) << \"Some message\";\n//\n// The \"switch (0) case 0:\" idiom is used to suppress this.\n#ifdef __INTEL_COMPILER\n# define GTEST_AMBIGUOUS_ELSE_BLOCKER_\n#else\n# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT\n#endif\n\n// Use this annotation at the end of a struct/class definition to\n// prevent the compiler from optimizing away instances that are never\n// used.  This is useful when all interesting logic happens inside the\n// c'tor and / or d'tor.  Example:\n//\n//   struct Foo {\n//     Foo() { ... }\n//   } GTEST_ATTRIBUTE_UNUSED_;\n//\n// Also use it after a variable or parameter declaration to tell the\n// compiler the variable/parameter does not have to be used.\n#if defined(__GNUC__) && !defined(COMPILER_ICC)\n# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))\n#else\n# define GTEST_ATTRIBUTE_UNUSED_\n#endif\n\n// A macro to disallow operator=\n// This should be used in the private: declarations for a class.\n#define GTEST_DISALLOW_ASSIGN_(type)\\\n  void operator=(type const &)\n\n// A macro to disallow copy constructor and operator=\n// This should be used in the private: declarations for a class.\n#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\\\n  type(type const &);\\\n  GTEST_DISALLOW_ASSIGN_(type)\n\n// Tell the compiler to warn about unused return values for functions declared\n// with this macro.  The macro should be used on function declarations\n// following the argument list:\n//\n//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;\n#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)\n# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))\n#else\n# define GTEST_MUST_USE_RESULT_\n#endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC\n\n// Determine whether the compiler supports Microsoft's Structured Exception\n// Handling.  This is supported by several Windows compilers but generally\n// does not exist on any other system.\n#ifndef GTEST_HAS_SEH\n// The user didn't tell us, so we need to figure it out.\n\n# if defined(_MSC_VER) || defined(__BORLANDC__)\n// These two compilers are known to support SEH.\n#  define GTEST_HAS_SEH 1\n# else\n// Assume no SEH.\n#  define GTEST_HAS_SEH 0\n# endif\n\n#endif  // GTEST_HAS_SEH\n\n#ifdef _MSC_VER\n\n# if GTEST_LINKED_AS_SHARED_LIBRARY\n#  define GTEST_API_ __declspec(dllimport)\n# elif GTEST_CREATE_SHARED_LIBRARY\n#  define GTEST_API_ __declspec(dllexport)\n# endif\n\n#endif  // _MSC_VER\n\n#ifndef GTEST_API_\n# define GTEST_API_\n#endif\n\n#ifdef __GNUC__\n// Ask the compiler to never inline a given function.\n# define GTEST_NO_INLINE_ __attribute__((noinline))\n#else\n# define GTEST_NO_INLINE_\n#endif\n\n// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.\n#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)\n# define GTEST_HAS_CXXABI_H_ 1\n#else\n# define GTEST_HAS_CXXABI_H_ 0\n#endif\n\nnamespace testing {\n\nclass Message;\n\nnamespace internal {\n\n// A secret type that Google Test users don't know about.  It has no\n// definition on purpose.  Therefore it's impossible to create a\n// Secret object, which is what we want.\nclass Secret;\n\n// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time\n// expression is true. For example, you could use it to verify the\n// size of a static array:\n//\n//   GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,\n//                         content_type_names_incorrect_size);\n//\n// or to make sure a struct is smaller than a certain size:\n//\n//   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);\n//\n// The second argument to the macro is the name of the variable. If\n// the expression is false, most compilers will issue a warning/error\n// containing the name of the variable.\n\ntemplate <bool>\nstruct CompileAssert {\n};\n\n#define GTEST_COMPILE_ASSERT_(expr, msg) \\\n  typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \\\n      msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_\n\n// Implementation details of GTEST_COMPILE_ASSERT_:\n//\n// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1\n//   elements (and thus is invalid) when the expression is false.\n//\n// - The simpler definition\n//\n//    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]\n//\n//   does not work, as gcc supports variable-length arrays whose sizes\n//   are determined at run-time (this is gcc's extension and not part\n//   of the C++ standard).  As a result, gcc fails to reject the\n//   following code with the simple definition:\n//\n//     int foo;\n//     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is\n//                                      // not a compile-time constant.\n//\n// - By using the type CompileAssert<(bool(expr))>, we ensures that\n//   expr is a compile-time constant.  (Template arguments must be\n//   determined at compile-time.)\n//\n// - The outter parentheses in CompileAssert<(bool(expr))> are necessary\n//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written\n//\n//     CompileAssert<bool(expr)>\n//\n//   instead, these compilers will refuse to compile\n//\n//     GTEST_COMPILE_ASSERT_(5 > 0, some_message);\n//\n//   (They seem to think the \">\" in \"5 > 0\" marks the end of the\n//   template argument list.)\n//\n// - The array size is (bool(expr) ? 1 : -1), instead of simply\n//\n//     ((expr) ? 1 : -1).\n//\n//   This is to avoid running into a bug in MS VC 7.1, which\n//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.\n\n// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.\n//\n// This template is declared, but intentionally undefined.\ntemplate <typename T1, typename T2>\nstruct StaticAssertTypeEqHelper;\n\ntemplate <typename T>\nstruct StaticAssertTypeEqHelper<T, T> {};\n\n#if GTEST_HAS_GLOBAL_STRING\ntypedef ::string string;\n#else\ntypedef ::std::string string;\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\ntypedef ::wstring wstring;\n#elif GTEST_HAS_STD_WSTRING\ntypedef ::std::wstring wstring;\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// A helper for suppressing warnings on constant condition.  It just\n// returns 'condition'.\nGTEST_API_ bool IsTrue(bool condition);\n\n// Defines scoped_ptr.\n\n// This implementation of scoped_ptr is PARTIAL - it only contains\n// enough stuff to satisfy Google Test's need.\ntemplate <typename T>\nclass scoped_ptr {\n public:\n  typedef T element_type;\n\n  explicit scoped_ptr(T* p = NULL) : ptr_(p) {}\n  ~scoped_ptr() { reset(); }\n\n  T& operator*() const { return *ptr_; }\n  T* operator->() const { return ptr_; }\n  T* get() const { return ptr_; }\n\n  T* release() {\n    T* const ptr = ptr_;\n    ptr_ = NULL;\n    return ptr;\n  }\n\n  void reset(T* p = NULL) {\n    if (p != ptr_) {\n      if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.\n        delete ptr_;\n      }\n      ptr_ = p;\n    }\n  }\n\n private:\n  T* ptr_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);\n};\n\n// Defines RE.\n\n// A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended\n// Regular Expression syntax.\nclass GTEST_API_ RE {\n public:\n  // A copy constructor is required by the Standard to initialize object\n  // references from r-values.\n  RE(const RE& other) { Init(other.pattern()); }\n\n  // Constructs an RE from a string.\n  RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT\n\n#if GTEST_HAS_GLOBAL_STRING\n\n  RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n  RE(const char* regex) { Init(regex); }  // NOLINT\n  ~RE();\n\n  // Returns the string representation of the regex.\n  const char* pattern() const { return pattern_; }\n\n  // FullMatch(str, re) returns true iff regular expression re matches\n  // the entire str.\n  // PartialMatch(str, re) returns true iff regular expression re\n  // matches a substring of str (including str itself).\n  //\n  // TODO(wan@google.com): make FullMatch() and PartialMatch() work\n  // when str contains NUL characters.\n  static bool FullMatch(const ::std::string& str, const RE& re) {\n    return FullMatch(str.c_str(), re);\n  }\n  static bool PartialMatch(const ::std::string& str, const RE& re) {\n    return PartialMatch(str.c_str(), re);\n  }\n\n#if GTEST_HAS_GLOBAL_STRING\n\n  static bool FullMatch(const ::string& str, const RE& re) {\n    return FullMatch(str.c_str(), re);\n  }\n  static bool PartialMatch(const ::string& str, const RE& re) {\n    return PartialMatch(str.c_str(), re);\n  }\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n  static bool FullMatch(const char* str, const RE& re);\n  static bool PartialMatch(const char* str, const RE& re);\n\n private:\n  void Init(const char* regex);\n\n  // We use a const char* instead of an std::string, as Google Test used to be\n  // used where std::string is not available.  TODO(wan@google.com): change to\n  // std::string.\n  const char* pattern_;\n  bool is_valid_;\n\n#if GTEST_USES_POSIX_RE\n\n  regex_t full_regex_;     // For FullMatch().\n  regex_t partial_regex_;  // For PartialMatch().\n\n#else  // GTEST_USES_SIMPLE_RE\n\n  const char* full_pattern_;  // For FullMatch();\n\n#endif\n\n  GTEST_DISALLOW_ASSIGN_(RE);\n};\n\n// Formats a source file path and a line number as they would appear\n// in an error message from the compiler used to compile this code.\nGTEST_API_ ::std::string FormatFileLocation(const char* file, int line);\n\n// Formats a file location for compiler-independent XML output.\n// Although this function is not platform dependent, we put it next to\n// FormatFileLocation in order to contrast the two functions.\nGTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,\n                                                               int line);\n\n// Defines logging utilities:\n//   GTEST_LOG_(severity) - logs messages at the specified severity level. The\n//                          message itself is streamed into the macro.\n//   LogToStderr()  - directs all log messages to stderr.\n//   FlushInfoLog() - flushes informational log messages.\n\nenum GTestLogSeverity {\n  GTEST_INFO,\n  GTEST_WARNING,\n  GTEST_ERROR,\n  GTEST_FATAL\n};\n\n// Formats log entry severity, provides a stream object for streaming the\n// log message, and terminates the message with a newline when going out of\n// scope.\nclass GTEST_API_ GTestLog {\n public:\n  GTestLog(GTestLogSeverity severity, const char* file, int line);\n\n  // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.\n  ~GTestLog();\n\n  ::std::ostream& GetStream() { return ::std::cerr; }\n\n private:\n  const GTestLogSeverity severity_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);\n};\n\n#define GTEST_LOG_(severity) \\\n    ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \\\n                                  __FILE__, __LINE__).GetStream()\n\ninline void LogToStderr() {}\ninline void FlushInfoLog() { fflush(NULL); }\n\n// INTERNAL IMPLEMENTATION - DO NOT USE.\n//\n// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition\n// is not satisfied.\n//  Synopsys:\n//    GTEST_CHECK_(boolean_condition);\n//     or\n//    GTEST_CHECK_(boolean_condition) << \"Additional message\";\n//\n//    This checks the condition and if the condition is not satisfied\n//    it prints message about the condition violation, including the\n//    condition itself, plus additional message streamed into it, if any,\n//    and then it aborts the program. It aborts the program irrespective of\n//    whether it is built in the debug mode or not.\n#define GTEST_CHECK_(condition) \\\n    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\n    if (::testing::internal::IsTrue(condition)) \\\n      ; \\\n    else \\\n      GTEST_LOG_(FATAL) << \"Condition \" #condition \" failed. \"\n\n// An all-mode assert to verify that the given POSIX-style function\n// call returns 0 (indicating success).  Known limitation: this\n// doesn't expand to a balanced 'if' statement, so enclose the macro\n// in {} if you need to use it as the only statement in an 'if'\n// branch.\n#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \\\n  if (const int gtest_error = (posix_call)) \\\n    GTEST_LOG_(FATAL) << #posix_call << \"failed with error \" \\\n                      << gtest_error\n\n// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.\n//\n// Use ImplicitCast_ as a safe version of static_cast for upcasting in\n// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a\n// const Foo*).  When you use ImplicitCast_, the compiler checks that\n// the cast is safe.  Such explicit ImplicitCast_s are necessary in\n// surprisingly many situations where C++ demands an exact type match\n// instead of an argument type convertable to a target type.\n//\n// The syntax for using ImplicitCast_ is the same as for static_cast:\n//\n//   ImplicitCast_<ToType>(expr)\n//\n// ImplicitCast_ would have been part of the C++ standard library,\n// but the proposal was submitted too late.  It will probably make\n// its way into the language in the future.\n//\n// This relatively ugly name is intentional. It prevents clashes with\n// similar functions users may have (e.g., implicit_cast). The internal\n// namespace alone is not enough because the function can be found by ADL.\ntemplate<typename To>\ninline To ImplicitCast_(To x) { return x; }\n\n// When you upcast (that is, cast a pointer from type Foo to type\n// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts\n// always succeed.  When you downcast (that is, cast a pointer from\n// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because\n// how do you know the pointer is really of type SubclassOfFoo?  It\n// could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,\n// when you downcast, you should use this macro.  In debug mode, we\n// use dynamic_cast<> to double-check the downcast is legal (we die\n// if it's not).  In normal mode, we do the efficient static_cast<>\n// instead.  Thus, it's important to test in debug mode to make sure\n// the cast is legal!\n//    This is the only place in the code we should use dynamic_cast<>.\n// In particular, you SHOULDN'T be using dynamic_cast<> in order to\n// do RTTI (eg code like this:\n//    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);\n//    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);\n// You should design the code some other way not to need this.\n//\n// This relatively ugly name is intentional. It prevents clashes with\n// similar functions users may have (e.g., down_cast). The internal\n// namespace alone is not enough because the function can be found by ADL.\ntemplate<typename To, typename From>  // use like this: DownCast_<T*>(foo);\ninline To DownCast_(From* f) {  // so we only accept pointers\n  // Ensures that To is a sub-type of From *.  This test is here only\n  // for compile-time type checking, and has no overhead in an\n  // optimized build at run-time, as it will be optimized away\n  // completely.\n  if (false) {\n    const To to = NULL;\n    ::testing::internal::ImplicitCast_<From*>(to);\n  }\n\n#if GTEST_HAS_RTTI\n  // RTTI: debug mode only!\n  GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);\n#endif\n  return static_cast<To>(f);\n}\n\n// Downcasts the pointer of type Base to Derived.\n// Derived must be a subclass of Base. The parameter MUST\n// point to a class of type Derived, not any subclass of it.\n// When RTTI is available, the function performs a runtime\n// check to enforce this.\ntemplate <class Derived, class Base>\nDerived* CheckedDowncastToActualType(Base* base) {\n#if GTEST_HAS_RTTI\n  GTEST_CHECK_(typeid(*base) == typeid(Derived));\n  return dynamic_cast<Derived*>(base);  // NOLINT\n#else\n  return static_cast<Derived*>(base);  // Poor man's downcast.\n#endif\n}\n\n#if GTEST_HAS_STREAM_REDIRECTION\n\n// Defines the stderr capturer:\n//   CaptureStdout     - starts capturing stdout.\n//   GetCapturedStdout - stops capturing stdout and returns the captured string.\n//   CaptureStderr     - starts capturing stderr.\n//   GetCapturedStderr - stops capturing stderr and returns the captured string.\n//\nGTEST_API_ void CaptureStdout();\nGTEST_API_ std::string GetCapturedStdout();\nGTEST_API_ void CaptureStderr();\nGTEST_API_ std::string GetCapturedStderr();\n\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n\n#if GTEST_HAS_DEATH_TEST\n\nconst ::std::vector<testing::internal::string>& GetInjectableArgvs();\nvoid SetInjectableArgvs(const ::std::vector<testing::internal::string>*\n                             new_argvs);\n\n// A copy of all command line arguments.  Set by InitGoogleTest().\nextern ::std::vector<testing::internal::string> g_argvs;\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Defines synchronization primitives.\n\n#if GTEST_HAS_PTHREAD\n\n// Sleeps for (roughly) n milli-seconds.  This function is only for\n// testing Google Test's own constructs.  Don't use it in user tests,\n// either directly or indirectly.\ninline void SleepMilliseconds(int n) {\n  const timespec time = {\n    0,                  // 0 seconds.\n    n * 1000L * 1000L,  // And n ms.\n  };\n  nanosleep(&time, NULL);\n}\n\n// Allows a controller thread to pause execution of newly created\n// threads until notified.  Instances of this class must be created\n// and destroyed in the controller thread.\n//\n// This class is only for testing Google Test's own constructs. Do not\n// use it in user tests, either directly or indirectly.\nclass Notification {\n public:\n  Notification() : notified_(false) {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));\n  }\n  ~Notification() {\n    pthread_mutex_destroy(&mutex_);\n  }\n\n  // Notifies all threads created with this notification to start. Must\n  // be called from the controller thread.\n  void Notify() {\n    pthread_mutex_lock(&mutex_);\n    notified_ = true;\n    pthread_mutex_unlock(&mutex_);\n  }\n\n  // Blocks until the controller thread notifies. Must be called from a test\n  // thread.\n  void WaitForNotification() {\n    for (;;) {\n      pthread_mutex_lock(&mutex_);\n      const bool notified = notified_;\n      pthread_mutex_unlock(&mutex_);\n      if (notified)\n        break;\n      SleepMilliseconds(10);\n    }\n  }\n\n private:\n  pthread_mutex_t mutex_;\n  bool notified_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);\n};\n\n// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.\n// Consequently, it cannot select a correct instantiation of ThreadWithParam\n// in order to call its Run(). Introducing ThreadWithParamBase as a\n// non-templated base class for ThreadWithParam allows us to bypass this\n// problem.\nclass ThreadWithParamBase {\n public:\n  virtual ~ThreadWithParamBase() {}\n  virtual void Run() = 0;\n};\n\n// pthread_create() accepts a pointer to a function type with the C linkage.\n// According to the Standard (7.5/1), function types with different linkages\n// are different even if they are otherwise identical.  Some compilers (for\n// example, SunStudio) treat them as different types.  Since class methods\n// cannot be defined with C-linkage we need to define a free C-function to\n// pass into pthread_create().\nextern \"C\" inline void* ThreadFuncWithCLinkage(void* thread) {\n  static_cast<ThreadWithParamBase*>(thread)->Run();\n  return NULL;\n}\n\n// Helper class for testing Google Test's multi-threading constructs.\n// To use it, write:\n//\n//   void ThreadFunc(int param) { /* Do things with param */ }\n//   Notification thread_can_start;\n//   ...\n//   // The thread_can_start parameter is optional; you can supply NULL.\n//   ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);\n//   thread_can_start.Notify();\n//\n// These classes are only for testing Google Test's own constructs. Do\n// not use them in user tests, either directly or indirectly.\ntemplate <typename T>\nclass ThreadWithParam : public ThreadWithParamBase {\n public:\n  typedef void (*UserThreadFunc)(T);\n\n  ThreadWithParam(\n      UserThreadFunc func, T param, Notification* thread_can_start)\n      : func_(func),\n        param_(param),\n        thread_can_start_(thread_can_start),\n        finished_(false) {\n    ThreadWithParamBase* const base = this;\n    // The thread can be created only after all fields except thread_\n    // have been initialized.\n    GTEST_CHECK_POSIX_SUCCESS_(\n        pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));\n  }\n  ~ThreadWithParam() { Join(); }\n\n  void Join() {\n    if (!finished_) {\n      GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));\n      finished_ = true;\n    }\n  }\n\n  virtual void Run() {\n    if (thread_can_start_ != NULL)\n      thread_can_start_->WaitForNotification();\n    func_(param_);\n  }\n\n private:\n  const UserThreadFunc func_;  // User-supplied thread function.\n  const T param_;  // User-supplied parameter to the thread function.\n  // When non-NULL, used to block execution until the controller thread\n  // notifies.\n  Notification* const thread_can_start_;\n  bool finished_;  // true iff we know that the thread function has finished.\n  pthread_t thread_;  // The native thread object.\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);\n};\n\n// MutexBase and Mutex implement mutex on pthreads-based platforms. They\n// are used in conjunction with class MutexLock:\n//\n//   Mutex mutex;\n//   ...\n//   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the end\n//                            // of the current scope.\n//\n// MutexBase implements behavior for both statically and dynamically\n// allocated mutexes.  Do not use MutexBase directly.  Instead, write\n// the following to define a static mutex:\n//\n//   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);\n//\n// You can forward declare a static mutex like this:\n//\n//   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);\n//\n// To create a dynamic mutex, just define an object of type Mutex.\nclass MutexBase {\n public:\n  // Acquires this mutex.\n  void Lock() {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));\n    owner_ = pthread_self();\n    has_owner_ = true;\n  }\n\n  // Releases this mutex.\n  void Unlock() {\n    // Since the lock is being released the owner_ field should no longer be\n    // considered valid. We don't protect writing to has_owner_ here, as it's\n    // the caller's responsibility to ensure that the current thread holds the\n    // mutex when this is called.\n    has_owner_ = false;\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));\n  }\n\n  // Does nothing if the current thread holds the mutex. Otherwise, crashes\n  // with high probability.\n  void AssertHeld() const {\n    GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))\n        << \"The current thread is not holding the mutex @\" << this;\n  }\n\n  // A static mutex may be used before main() is entered.  It may even\n  // be used before the dynamic initialization stage.  Therefore we\n  // must be able to initialize a static mutex object at link time.\n  // This means MutexBase has to be a POD and its member variables\n  // have to be public.\n public:\n  pthread_mutex_t mutex_;  // The underlying pthread mutex.\n  // has_owner_ indicates whether the owner_ field below contains a valid thread\n  // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All\n  // accesses to the owner_ field should be protected by a check of this field.\n  // An alternative might be to memset() owner_ to all zeros, but there's no\n  // guarantee that a zero'd pthread_t is necessarily invalid or even different\n  // from pthread_self().\n  bool has_owner_;\n  pthread_t owner_;  // The thread holding the mutex.\n};\n\n// Forward-declares a static mutex.\n# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \\\n    extern ::testing::internal::MutexBase mutex\n\n// Defines and statically (i.e. at link time) initializes a static mutex.\n// The initialization list here does not explicitly initialize each field,\n// instead relying on default initialization for the unspecified fields. In\n// particular, the owner_ field (a pthread_t) is not explicitly initialized.\n// This allows initialization to work whether pthread_t is a scalar or struct.\n// The flag -Wmissing-field-initializers must not be specified for this to work.\n# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \\\n    ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }\n\n// The Mutex class can only be used for mutexes created at runtime. It\n// shares its API with MutexBase otherwise.\nclass Mutex : public MutexBase {\n public:\n  Mutex() {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));\n    has_owner_ = false;\n  }\n  ~Mutex() {\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));\n  }\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);\n};\n\n// We cannot name this class MutexLock as the ctor declaration would\n// conflict with a macro named MutexLock, which is defined on some\n// platforms.  Hence the typedef trick below.\nclass GTestMutexLock {\n public:\n  explicit GTestMutexLock(MutexBase* mutex)\n      : mutex_(mutex) { mutex_->Lock(); }\n\n  ~GTestMutexLock() { mutex_->Unlock(); }\n\n private:\n  MutexBase* const mutex_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);\n};\n\ntypedef GTestMutexLock MutexLock;\n\n// Helpers for ThreadLocal.\n\n// pthread_key_create() requires DeleteThreadLocalValue() to have\n// C-linkage.  Therefore it cannot be templatized to access\n// ThreadLocal<T>.  Hence the need for class\n// ThreadLocalValueHolderBase.\nclass ThreadLocalValueHolderBase {\n public:\n  virtual ~ThreadLocalValueHolderBase() {}\n};\n\n// Called by pthread to delete thread-local data stored by\n// pthread_setspecific().\nextern \"C\" inline void DeleteThreadLocalValue(void* value_holder) {\n  delete static_cast<ThreadLocalValueHolderBase*>(value_holder);\n}\n\n// Implements thread-local storage on pthreads-based systems.\n//\n//   // Thread 1\n//   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.\n//\n//   // Thread 2\n//   tl.set(150);  // Changes the value for thread 2 only.\n//   EXPECT_EQ(150, tl.get());\n//\n//   // Thread 1\n//   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.\n//   tl.set(200);\n//   EXPECT_EQ(200, tl.get());\n//\n// The template type argument T must have a public copy constructor.\n// In addition, the default ThreadLocal constructor requires T to have\n// a public default constructor.\n//\n// An object managed for a thread by a ThreadLocal instance is deleted\n// when the thread exits.  Or, if the ThreadLocal instance dies in\n// that thread, when the ThreadLocal dies.  It's the user's\n// responsibility to ensure that all other threads using a ThreadLocal\n// have exited when it dies, or the per-thread objects for those\n// threads will not be deleted.\n//\n// Google Test only uses global ThreadLocal objects.  That means they\n// will die after main() has returned.  Therefore, no per-thread\n// object managed by Google Test will be leaked as long as all threads\n// using Google Test have exited when main() returns.\ntemplate <typename T>\nclass ThreadLocal {\n public:\n  ThreadLocal() : key_(CreateKey()),\n                  default_() {}\n  explicit ThreadLocal(const T& value) : key_(CreateKey()),\n                                         default_(value) {}\n\n  ~ThreadLocal() {\n    // Destroys the managed object for the current thread, if any.\n    DeleteThreadLocalValue(pthread_getspecific(key_));\n\n    // Releases resources associated with the key.  This will *not*\n    // delete managed objects for other threads.\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));\n  }\n\n  T* pointer() { return GetOrCreateValue(); }\n  const T* pointer() const { return GetOrCreateValue(); }\n  const T& get() const { return *pointer(); }\n  void set(const T& value) { *pointer() = value; }\n\n private:\n  // Holds a value of type T.\n  class ValueHolder : public ThreadLocalValueHolderBase {\n   public:\n    explicit ValueHolder(const T& value) : value_(value) {}\n\n    T* pointer() { return &value_; }\n\n   private:\n    T value_;\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);\n  };\n\n  static pthread_key_t CreateKey() {\n    pthread_key_t key;\n    // When a thread exits, DeleteThreadLocalValue() will be called on\n    // the object managed for that thread.\n    GTEST_CHECK_POSIX_SUCCESS_(\n        pthread_key_create(&key, &DeleteThreadLocalValue));\n    return key;\n  }\n\n  T* GetOrCreateValue() const {\n    ThreadLocalValueHolderBase* const holder =\n        static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));\n    if (holder != NULL) {\n      return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();\n    }\n\n    ValueHolder* const new_holder = new ValueHolder(default_);\n    ThreadLocalValueHolderBase* const holder_base = new_holder;\n    GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));\n    return new_holder->pointer();\n  }\n\n  // A key pthreads uses for looking up per-thread values.\n  const pthread_key_t key_;\n  const T default_;  // The default value for each thread.\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);\n};\n\n# define GTEST_IS_THREADSAFE 1\n\n#else  // GTEST_HAS_PTHREAD\n\n// A dummy implementation of synchronization primitives (mutex, lock,\n// and thread-local variable).  Necessary for compiling Google Test where\n// mutex is not supported - using Google Test in multiple threads is not\n// supported on such platforms.\n\nclass Mutex {\n public:\n  Mutex() {}\n  void Lock() {}\n  void Unlock() {}\n  void AssertHeld() const {}\n};\n\n# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \\\n  extern ::testing::internal::Mutex mutex\n\n# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex\n\nclass GTestMutexLock {\n public:\n  explicit GTestMutexLock(Mutex*) {}  // NOLINT\n};\n\ntypedef GTestMutexLock MutexLock;\n\ntemplate <typename T>\nclass ThreadLocal {\n public:\n  ThreadLocal() : value_() {}\n  explicit ThreadLocal(const T& value) : value_(value) {}\n  T* pointer() { return &value_; }\n  const T* pointer() const { return &value_; }\n  const T& get() const { return value_; }\n  void set(const T& value) { value_ = value; }\n private:\n  T value_;\n};\n\n// The above synchronization primitives have dummy implementations.\n// Therefore Google Test is not thread-safe.\n# define GTEST_IS_THREADSAFE 0\n\n#endif  // GTEST_HAS_PTHREAD\n\n// Returns the number of threads running in the process, or 0 to indicate that\n// we cannot detect it.\nGTEST_API_ size_t GetThreadCount();\n\n// Passing non-POD classes through ellipsis (...) crashes the ARM\n// compiler and generates a warning in Sun Studio.  The Nokia Symbian\n// and the IBM XL C/C++ compiler try to instantiate a copy constructor\n// for objects passed through ellipsis (...), failing for uncopyable\n// objects.  We define this to ensure that only POD is passed through\n// ellipsis on these systems.\n#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)\n// We lose support for NULL detection where the compiler doesn't like\n// passing non-POD classes through ellipsis (...).\n# define GTEST_ELLIPSIS_NEEDS_POD_ 1\n#else\n# define GTEST_CAN_COMPARE_NULL 1\n#endif\n\n// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between\n// const T& and const T* in a function template.  These compilers\n// _can_ decide between class template specializations for T and T*,\n// so a tr1::type_traits-like is_pointer works.\n#if defined(__SYMBIAN32__) || defined(__IBMCPP__)\n# define GTEST_NEEDS_IS_POINTER_ 1\n#endif\n\ntemplate <bool bool_value>\nstruct bool_constant {\n  typedef bool_constant<bool_value> type;\n  static const bool value = bool_value;\n};\ntemplate <bool bool_value> const bool bool_constant<bool_value>::value;\n\ntypedef bool_constant<false> false_type;\ntypedef bool_constant<true> true_type;\n\ntemplate <typename T>\nstruct is_pointer : public false_type {};\n\ntemplate <typename T>\nstruct is_pointer<T*> : public true_type {};\n\ntemplate <typename Iterator>\nstruct IteratorTraits {\n  typedef typename Iterator::value_type value_type;\n};\n\ntemplate <typename T>\nstruct IteratorTraits<T*> {\n  typedef T value_type;\n};\n\ntemplate <typename T>\nstruct IteratorTraits<const T*> {\n  typedef T value_type;\n};\n\n#if GTEST_OS_WINDOWS\n# define GTEST_PATH_SEP_ \"\\\\\"\n# define GTEST_HAS_ALT_PATH_SEP_ 1\n// The biggest signed integer type the compiler supports.\ntypedef __int64 BiggestInt;\n#else\n# define GTEST_PATH_SEP_ \"/\"\n# define GTEST_HAS_ALT_PATH_SEP_ 0\ntypedef long long BiggestInt;  // NOLINT\n#endif  // GTEST_OS_WINDOWS\n\n// Utilities for char.\n\n// isspace(int ch) and friends accept an unsigned char or EOF.  char\n// may be signed, depending on the compiler (or compiler flags).\n// Therefore we need to cast a char to unsigned char before calling\n// isspace(), etc.\n\ninline bool IsAlpha(char ch) {\n  return isalpha(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsAlNum(char ch) {\n  return isalnum(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsDigit(char ch) {\n  return isdigit(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsLower(char ch) {\n  return islower(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsSpace(char ch) {\n  return isspace(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsUpper(char ch) {\n  return isupper(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsXDigit(char ch) {\n  return isxdigit(static_cast<unsigned char>(ch)) != 0;\n}\ninline bool IsXDigit(wchar_t ch) {\n  const unsigned char low_byte = static_cast<unsigned char>(ch);\n  return ch == low_byte && isxdigit(low_byte) != 0;\n}\n\ninline char ToLower(char ch) {\n  return static_cast<char>(tolower(static_cast<unsigned char>(ch)));\n}\ninline char ToUpper(char ch) {\n  return static_cast<char>(toupper(static_cast<unsigned char>(ch)));\n}\n\n// The testing::internal::posix namespace holds wrappers for common\n// POSIX functions.  These wrappers hide the differences between\n// Windows/MSVC and POSIX systems.  Since some compilers define these\n// standard functions as macros, the wrapper cannot have the same name\n// as the wrapped function.\n\nnamespace posix {\n\n// Functions with a different name on Windows.\n\n#if GTEST_OS_WINDOWS\n\ntypedef struct _stat StatStruct;\n\n# ifdef __BORLANDC__\ninline int IsATTY(int fd) { return isatty(fd); }\ninline int StrCaseCmp(const char* s1, const char* s2) {\n  return stricmp(s1, s2);\n}\ninline char* StrDup(const char* src) { return strdup(src); }\n# else  // !__BORLANDC__\n#  if GTEST_OS_WINDOWS_MOBILE\ninline int IsATTY(int /* fd */) { return 0; }\n#  else\ninline int IsATTY(int fd) { return _isatty(fd); }\n#  endif  // GTEST_OS_WINDOWS_MOBILE\ninline int StrCaseCmp(const char* s1, const char* s2) {\n  return _stricmp(s1, s2);\n}\ninline char* StrDup(const char* src) { return _strdup(src); }\n# endif  // __BORLANDC__\n\n# if GTEST_OS_WINDOWS_MOBILE\ninline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }\n// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this\n// time and thus not defined there.\n# else\ninline int FileNo(FILE* file) { return _fileno(file); }\ninline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }\ninline int RmDir(const char* dir) { return _rmdir(dir); }\ninline bool IsDir(const StatStruct& st) {\n  return (_S_IFDIR & st.st_mode) != 0;\n}\n# endif  // GTEST_OS_WINDOWS_MOBILE\n\n#else\n\ntypedef struct stat StatStruct;\n\ninline int FileNo(FILE* file) { return fileno(file); }\ninline int IsATTY(int fd) { return isatty(fd); }\ninline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }\ninline int StrCaseCmp(const char* s1, const char* s2) {\n  return strcasecmp(s1, s2);\n}\ninline char* StrDup(const char* src) { return strdup(src); }\ninline int RmDir(const char* dir) { return rmdir(dir); }\ninline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }\n\n#endif  // GTEST_OS_WINDOWS\n\n// Functions deprecated by MSVC 8.0.\n\n#ifdef _MSC_VER\n// Temporarily disable warning 4996 (deprecated function).\n# pragma warning(push)\n# pragma warning(disable:4996)\n#endif\n\ninline const char* StrNCpy(char* dest, const char* src, size_t n) {\n  return strncpy(dest, src, n);\n}\n\n// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and\n// StrError() aren't needed on Windows CE at this time and thus not\n// defined there.\n\n#if !GTEST_OS_WINDOWS_MOBILE\ninline int ChDir(const char* dir) { return chdir(dir); }\n#endif\ninline FILE* FOpen(const char* path, const char* mode) {\n  return fopen(path, mode);\n}\n#if !GTEST_OS_WINDOWS_MOBILE\ninline FILE *FReopen(const char* path, const char* mode, FILE* stream) {\n  return freopen(path, mode, stream);\n}\ninline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }\n#endif\ninline int FClose(FILE* fp) { return fclose(fp); }\n#if !GTEST_OS_WINDOWS_MOBILE\ninline int Read(int fd, void* buf, unsigned int count) {\n  return static_cast<int>(read(fd, buf, count));\n}\ninline int Write(int fd, const void* buf, unsigned int count) {\n  return static_cast<int>(write(fd, buf, count));\n}\ninline int Close(int fd) { return close(fd); }\ninline const char* StrError(int errnum) { return strerror(errnum); }\n#endif\ninline const char* GetEnv(const char* name) {\n#if GTEST_OS_WINDOWS_MOBILE\n  // We are on Windows CE, which has no environment variables.\n  return NULL;\n#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)\n  // Environment variables which we programmatically clear will be set to the\n  // empty string rather than unset (NULL).  Handle that case.\n  const char* const env = getenv(name);\n  return (env != NULL && env[0] != '\\0') ? env : NULL;\n#else\n  return getenv(name);\n#endif\n}\n\n#ifdef _MSC_VER\n# pragma warning(pop)  // Restores the warning state.\n#endif\n\n#if GTEST_OS_WINDOWS_MOBILE\n// Windows CE has no C library. The abort() function is used in\n// several places in Google Test. This implementation provides a reasonable\n// imitation of standard behaviour.\nvoid Abort();\n#else\ninline void Abort() { abort(); }\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n}  // namespace posix\n\n// MSVC \"deprecates\" snprintf and issues warnings wherever it is used.  In\n// order to avoid these warnings, we need to use _snprintf or _snprintf_s on\n// MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate\n// function in order to achieve that.  We use macro definition here because\n// snprintf is a variadic function.\n#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE\n// MSVC 2005 and above support variadic macros.\n# define GTEST_SNPRINTF_(buffer, size, format, ...) \\\n     _snprintf_s(buffer, size, size, format, __VA_ARGS__)\n#elif defined(_MSC_VER)\n// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't\n// complain about _snprintf.\n# define GTEST_SNPRINTF_ _snprintf\n#else\n# define GTEST_SNPRINTF_ snprintf\n#endif\n\n// The maximum number a BiggestInt can represent.  This definition\n// works no matter BiggestInt is represented in one's complement or\n// two's complement.\n//\n// We cannot rely on numeric_limits in STL, as __int64 and long long\n// are not part of standard C++ and numeric_limits doesn't need to be\n// defined for them.\nconst BiggestInt kMaxBiggestInt =\n    ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));\n\n// This template class serves as a compile-time function from size to\n// type.  It maps a size in bytes to a primitive type with that\n// size. e.g.\n//\n//   TypeWithSize<4>::UInt\n//\n// is typedef-ed to be unsigned int (unsigned integer made up of 4\n// bytes).\n//\n// Such functionality should belong to STL, but I cannot find it\n// there.\n//\n// Google Test uses this class in the implementation of floating-point\n// comparison.\n//\n// For now it only handles UInt (unsigned int) as that's all Google Test\n// needs.  Other types can be easily added in the future if need\n// arises.\ntemplate <size_t size>\nclass TypeWithSize {\n public:\n  // This prevents the user from using TypeWithSize<N> with incorrect\n  // values of N.\n  typedef void UInt;\n};\n\n// The specialization for size 4.\ntemplate <>\nclass TypeWithSize<4> {\n public:\n  // unsigned int has size 4 in both gcc and MSVC.\n  //\n  // As base/basictypes.h doesn't compile on Windows, we cannot use\n  // uint32, uint64, and etc here.\n  typedef int Int;\n  typedef unsigned int UInt;\n};\n\n// The specialization for size 8.\ntemplate <>\nclass TypeWithSize<8> {\n public:\n#if GTEST_OS_WINDOWS\n  typedef __int64 Int;\n  typedef unsigned __int64 UInt;\n#else\n  typedef long long Int;  // NOLINT\n  typedef unsigned long long UInt;  // NOLINT\n#endif  // GTEST_OS_WINDOWS\n};\n\n// Integer types of known sizes.\ntypedef TypeWithSize<4>::Int Int32;\ntypedef TypeWithSize<4>::UInt UInt32;\ntypedef TypeWithSize<8>::Int Int64;\ntypedef TypeWithSize<8>::UInt UInt64;\ntypedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.\n\n// Utilities for command line flags and environment variables.\n\n// Macro for referencing flags.\n#define GTEST_FLAG(name) FLAGS_gtest_##name\n\n// Macros for declaring flags.\n#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)\n#define GTEST_DECLARE_int32_(name) \\\n    GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)\n#define GTEST_DECLARE_string_(name) \\\n    GTEST_API_ extern ::std::string GTEST_FLAG(name)\n\n// Macros for defining flags.\n#define GTEST_DEFINE_bool_(name, default_val, doc) \\\n    GTEST_API_ bool GTEST_FLAG(name) = (default_val)\n#define GTEST_DEFINE_int32_(name, default_val, doc) \\\n    GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)\n#define GTEST_DEFINE_string_(name, default_val, doc) \\\n    GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)\n\n// Thread annotations\n#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)\n#define GTEST_LOCK_EXCLUDED_(locks)\n\n// Parses 'str' for a 32-bit signed integer.  If successful, writes the result\n// to *value and returns true; otherwise leaves *value unchanged and returns\n// false.\n// TODO(chandlerc): Find a better way to refactor flag and environment parsing\n// out of both gtest-port.cc and gtest.cc to avoid exporting this utility\n// function.\nbool ParseInt32(const Message& src_text, const char* str, Int32* value);\n\n// Parses a bool/Int32/string from the environment variable\n// corresponding to the given Google Test flag.\nbool BoolFromGTestEnv(const char* flag, bool default_val);\nGTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);\nconst char* StringFromGTestEnv(const char* flag, const char* default_val);\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-string.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file declares the String class and functions used internally by\n// Google Test.  They are subject to change without notice. They should not used\n// by code external to Google Test.\n//\n// This header file is #included by <gtest/internal/gtest-internal.h>.\n// It should not be #included by other files.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_\n\n#ifdef __BORLANDC__\n// string.h is not guaranteed to provide strcpy on C++ Builder.\n# include <mem.h>\n#endif\n\n#include <string.h>\n#include <string>\n\n#include \"gtest/internal/gtest-port.h\"\n\nnamespace testing {\nnamespace internal {\n\n// String - an abstract class holding static string utilities.\nclass GTEST_API_ String {\n public:\n  // Static utility methods\n\n  // Clones a 0-terminated C string, allocating memory using new.  The\n  // caller is responsible for deleting the return value using\n  // delete[].  Returns the cloned string, or NULL if the input is\n  // NULL.\n  //\n  // This is different from strdup() in string.h, which allocates\n  // memory using malloc().\n  static const char* CloneCString(const char* c_str);\n\n#if GTEST_OS_WINDOWS_MOBILE\n  // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be\n  // able to pass strings to Win32 APIs on CE we need to convert them\n  // to 'Unicode', UTF-16.\n\n  // Creates a UTF-16 wide string from the given ANSI string, allocating\n  // memory using new. The caller is responsible for deleting the return\n  // value using delete[]. Returns the wide string, or NULL if the\n  // input is NULL.\n  //\n  // The wide string is created using the ANSI codepage (CP_ACP) to\n  // match the behaviour of the ANSI versions of Win32 calls and the\n  // C runtime.\n  static LPCWSTR AnsiToUtf16(const char* c_str);\n\n  // Creates an ANSI string from the given wide string, allocating\n  // memory using new. The caller is responsible for deleting the return\n  // value using delete[]. Returns the ANSI string, or NULL if the\n  // input is NULL.\n  //\n  // The returned string is created using the ANSI codepage (CP_ACP) to\n  // match the behaviour of the ANSI versions of Win32 calls and the\n  // C runtime.\n  static const char* Utf16ToAnsi(LPCWSTR utf16_str);\n#endif\n\n  // Compares two C strings.  Returns true iff they have the same content.\n  //\n  // Unlike strcmp(), this function can handle NULL argument(s).  A\n  // NULL C string is considered different to any non-NULL C string,\n  // including the empty string.\n  static bool CStringEquals(const char* lhs, const char* rhs);\n\n  // Converts a wide C string to a String using the UTF-8 encoding.\n  // NULL will be converted to \"(null)\".  If an error occurred during\n  // the conversion, \"(failed to convert from wide string)\" is\n  // returned.\n  static std::string ShowWideCString(const wchar_t* wide_c_str);\n\n  // Compares two wide C strings.  Returns true iff they have the same\n  // content.\n  //\n  // Unlike wcscmp(), this function can handle NULL argument(s).  A\n  // NULL C string is considered different to any non-NULL C string,\n  // including the empty string.\n  static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);\n\n  // Compares two C strings, ignoring case.  Returns true iff they\n  // have the same content.\n  //\n  // Unlike strcasecmp(), this function can handle NULL argument(s).\n  // A NULL C string is considered different to any non-NULL C string,\n  // including the empty string.\n  static bool CaseInsensitiveCStringEquals(const char* lhs,\n                                           const char* rhs);\n\n  // Compares two wide C strings, ignoring case.  Returns true iff they\n  // have the same content.\n  //\n  // Unlike wcscasecmp(), this function can handle NULL argument(s).\n  // A NULL C string is considered different to any non-NULL wide C string,\n  // including the empty string.\n  // NB: The implementations on different platforms slightly differ.\n  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE\n  // environment variable. On GNU platform this method uses wcscasecmp\n  // which compares according to LC_CTYPE category of the current locale.\n  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the\n  // current locale.\n  static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,\n                                               const wchar_t* rhs);\n\n  // Returns true iff the given string ends with the given suffix, ignoring\n  // case. Any string is considered to end with an empty suffix.\n  static bool EndsWithCaseInsensitive(\n      const std::string& str, const std::string& suffix);\n\n  // Formats an int value as \"%02d\".\n  static std::string FormatIntWidth2(int value);  // \"%02d\" for width == 2\n\n  // Formats an int value as \"%X\".\n  static std::string FormatHexInt(int value);\n\n  // Formats a byte as \"%02X\".\n  static std::string FormatByte(unsigned char value);\n\n private:\n  String();  // Not meant to be instantiated.\n};  // class String\n\n// Gets the content of the stringstream's buffer as an std::string.  Each '\\0'\n// character in the buffer is replaced with \"\\\\0\".\nGTEST_API_ std::string StringStreamToString(::std::stringstream* stream);\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-tuple.h",
    "content": "// This file was GENERATED by command:\n//     pump.py gtest-tuple.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2009 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Implements a subset of TR1 tuple needed by Google Test and Google Mock.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n\n#include <utility>  // For ::std::pair.\n\n// The compiler used in Symbian has a bug that prevents us from declaring the\n// tuple template as a friend (it complains that tuple is redefined).  This\n// hack bypasses the bug by declaring the members that should otherwise be\n// private as public.\n// Sun Studio versions < 12 also have the above bug.\n#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)\n# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:\n#else\n# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \\\n    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \\\n   private:\n#endif\n\n// GTEST_n_TUPLE_(T) is the type of an n-tuple.\n#define GTEST_0_TUPLE_(T) tuple<>\n#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \\\n    void, void, void>\n#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \\\n    void, void, void>\n#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \\\n    void, void, void>\n#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \\\n    void, void, void>\n#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \\\n    void, void, void>\n#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \\\n    void, void, void>\n#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    void, void, void>\n#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    T##7, void, void>\n#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    T##7, T##8, void>\n#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \\\n    T##7, T##8, T##9>\n\n// GTEST_n_TYPENAMES_(T) declares a list of n typenames.\n#define GTEST_0_TYPENAMES_(T)\n#define GTEST_1_TYPENAMES_(T) typename T##0\n#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1\n#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2\n#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3\n#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4\n#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5\n#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6\n#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7\n#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6, \\\n    typename T##7, typename T##8\n#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \\\n    typename T##3, typename T##4, typename T##5, typename T##6, \\\n    typename T##7, typename T##8, typename T##9\n\n// In theory, defining stuff in the ::std namespace is undefined\n// behavior.  We can do this as we are playing the role of a standard\n// library vendor.\nnamespace std {\nnamespace tr1 {\n\ntemplate <typename T0 = void, typename T1 = void, typename T2 = void,\n    typename T3 = void, typename T4 = void, typename T5 = void,\n    typename T6 = void, typename T7 = void, typename T8 = void,\n    typename T9 = void>\nclass tuple;\n\n// Anything in namespace gtest_internal is Google Test's INTERNAL\n// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.\nnamespace gtest_internal {\n\n// ByRef<T>::type is T if T is a reference; otherwise it's const T&.\ntemplate <typename T>\nstruct ByRef { typedef const T& type; };  // NOLINT\ntemplate <typename T>\nstruct ByRef<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper for ByRef.\n#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type\n\n// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This\n// is the same as tr1::add_reference<T>::type.\ntemplate <typename T>\nstruct AddRef { typedef T& type; };  // NOLINT\ntemplate <typename T>\nstruct AddRef<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper for AddRef.\n#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type\n\n// A helper for implementing get<k>().\ntemplate <int k> class Get;\n\n// A helper for implementing tuple_element<k, T>.  kIndexValid is true\n// iff k < the number of fields in tuple type T.\ntemplate <bool kIndexValid, int kIndex, class Tuple>\nstruct TupleElement;\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {\n  typedef T0 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {\n  typedef T1 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {\n  typedef T2 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {\n  typedef T3 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {\n  typedef T4 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {\n  typedef T5 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {\n  typedef T6 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {\n  typedef T7 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {\n  typedef T8 type;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {\n  typedef T9 type;\n};\n\n}  // namespace gtest_internal\n\ntemplate <>\nclass tuple<> {\n public:\n  tuple() {}\n  tuple(const tuple& /* t */)  {}\n  tuple& operator=(const tuple& /* t */) { return *this; }\n};\n\ntemplate <GTEST_1_TYPENAMES_(T)>\nclass GTEST_1_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}\n\n  tuple(const tuple& t) : f0_(t.f0_) {}\n\n  template <GTEST_1_TYPENAMES_(U)>\n  tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_1_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_1_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_1_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    return *this;\n  }\n\n  T0 f0_;\n};\n\ntemplate <GTEST_2_TYPENAMES_(T)>\nclass GTEST_2_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),\n      f1_(f1) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}\n\n  template <GTEST_2_TYPENAMES_(U)>\n  tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}\n  template <typename U0, typename U1>\n  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_2_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_2_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n  template <typename U0, typename U1>\n  tuple& operator=(const ::std::pair<U0, U1>& p) {\n    f0_ = p.first;\n    f1_ = p.second;\n    return *this;\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_2_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n};\n\ntemplate <GTEST_3_TYPENAMES_(T)>\nclass GTEST_3_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}\n\n  template <GTEST_3_TYPENAMES_(U)>\n  tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_3_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_3_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_3_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n};\n\ntemplate <GTEST_4_TYPENAMES_(T)>\nclass GTEST_4_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),\n      f3_(f3) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}\n\n  template <GTEST_4_TYPENAMES_(U)>\n  tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_4_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_4_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_4_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n};\n\ntemplate <GTEST_5_TYPENAMES_(T)>\nclass GTEST_5_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,\n      GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_) {}\n\n  template <GTEST_5_TYPENAMES_(U)>\n  tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_5_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_5_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_5_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n};\n\ntemplate <GTEST_6_TYPENAMES_(T)>\nclass GTEST_6_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),\n      f5_(f5) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_) {}\n\n  template <GTEST_6_TYPENAMES_(U)>\n  tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_6_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_6_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_6_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n};\n\ntemplate <GTEST_7_TYPENAMES_(T)>\nclass GTEST_7_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),\n      f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}\n\n  template <GTEST_7_TYPENAMES_(U)>\n  tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_7_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_7_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_7_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n};\n\ntemplate <GTEST_8_TYPENAMES_(T)>\nclass GTEST_8_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,\n      GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),\n      f5_(f5), f6_(f6), f7_(f7) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}\n\n  template <GTEST_8_TYPENAMES_(U)>\n  tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_8_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_8_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_8_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    f7_ = t.f7_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n  T7 f7_;\n};\n\ntemplate <GTEST_9_TYPENAMES_(T)>\nclass GTEST_9_TUPLE_(T) {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,\n      GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),\n      f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}\n\n  template <GTEST_9_TYPENAMES_(U)>\n  tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_9_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_9_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_9_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    f7_ = t.f7_;\n    f8_ = t.f8_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n  T7 f7_;\n  T8 f8_;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nclass tuple {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),\n      f9_() {}\n\n  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,\n      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,\n      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,\n      GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),\n      f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}\n\n  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),\n      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}\n\n  template <GTEST_10_TYPENAMES_(U)>\n  tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),\n      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),\n      f9_(t.f9_) {}\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_10_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_10_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_10_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {\n    f0_ = t.f0_;\n    f1_ = t.f1_;\n    f2_ = t.f2_;\n    f3_ = t.f3_;\n    f4_ = t.f4_;\n    f5_ = t.f5_;\n    f6_ = t.f6_;\n    f7_ = t.f7_;\n    f8_ = t.f8_;\n    f9_ = t.f9_;\n    return *this;\n  }\n\n  T0 f0_;\n  T1 f1_;\n  T2 f2_;\n  T3 f3_;\n  T4 f4_;\n  T5 f5_;\n  T6 f6_;\n  T7 f7_;\n  T8 f8_;\n  T9 f9_;\n};\n\n// 6.1.3.2 Tuple creation functions.\n\n// Known limitations: we don't support passing an\n// std::tr1::reference_wrapper<T> to make_tuple().  And we don't\n// implement tie().\n\ninline tuple<> make_tuple() { return tuple<>(); }\n\ntemplate <GTEST_1_TYPENAMES_(T)>\ninline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {\n  return GTEST_1_TUPLE_(T)(f0);\n}\n\ntemplate <GTEST_2_TYPENAMES_(T)>\ninline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {\n  return GTEST_2_TUPLE_(T)(f0, f1);\n}\n\ntemplate <GTEST_3_TYPENAMES_(T)>\ninline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {\n  return GTEST_3_TUPLE_(T)(f0, f1, f2);\n}\n\ntemplate <GTEST_4_TYPENAMES_(T)>\ninline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3) {\n  return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);\n}\n\ntemplate <GTEST_5_TYPENAMES_(T)>\ninline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4) {\n  return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);\n}\n\ntemplate <GTEST_6_TYPENAMES_(T)>\ninline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5) {\n  return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);\n}\n\ntemplate <GTEST_7_TYPENAMES_(T)>\ninline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6) {\n  return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);\n}\n\ntemplate <GTEST_8_TYPENAMES_(T)>\ninline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {\n  return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);\n}\n\ntemplate <GTEST_9_TYPENAMES_(T)>\ninline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,\n    const T8& f8) {\n  return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);\n}\n\ntemplate <GTEST_10_TYPENAMES_(T)>\ninline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,\n    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,\n    const T8& f8, const T9& f9) {\n  return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);\n}\n\n// 6.1.3.3 Tuple helper classes.\n\ntemplate <typename Tuple> struct tuple_size;\n\ntemplate <GTEST_0_TYPENAMES_(T)>\nstruct tuple_size<GTEST_0_TUPLE_(T) > {\n  static const int value = 0;\n};\n\ntemplate <GTEST_1_TYPENAMES_(T)>\nstruct tuple_size<GTEST_1_TUPLE_(T) > {\n  static const int value = 1;\n};\n\ntemplate <GTEST_2_TYPENAMES_(T)>\nstruct tuple_size<GTEST_2_TUPLE_(T) > {\n  static const int value = 2;\n};\n\ntemplate <GTEST_3_TYPENAMES_(T)>\nstruct tuple_size<GTEST_3_TUPLE_(T) > {\n  static const int value = 3;\n};\n\ntemplate <GTEST_4_TYPENAMES_(T)>\nstruct tuple_size<GTEST_4_TUPLE_(T) > {\n  static const int value = 4;\n};\n\ntemplate <GTEST_5_TYPENAMES_(T)>\nstruct tuple_size<GTEST_5_TUPLE_(T) > {\n  static const int value = 5;\n};\n\ntemplate <GTEST_6_TYPENAMES_(T)>\nstruct tuple_size<GTEST_6_TUPLE_(T) > {\n  static const int value = 6;\n};\n\ntemplate <GTEST_7_TYPENAMES_(T)>\nstruct tuple_size<GTEST_7_TUPLE_(T) > {\n  static const int value = 7;\n};\n\ntemplate <GTEST_8_TYPENAMES_(T)>\nstruct tuple_size<GTEST_8_TUPLE_(T) > {\n  static const int value = 8;\n};\n\ntemplate <GTEST_9_TYPENAMES_(T)>\nstruct tuple_size<GTEST_9_TUPLE_(T) > {\n  static const int value = 9;\n};\n\ntemplate <GTEST_10_TYPENAMES_(T)>\nstruct tuple_size<GTEST_10_TUPLE_(T) > {\n  static const int value = 10;\n};\n\ntemplate <int k, class Tuple>\nstruct tuple_element {\n  typedef typename gtest_internal::TupleElement<\n      k < (tuple_size<Tuple>::value), k, Tuple>::type type;\n};\n\n#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type\n\n// 6.1.3.4 Element access.\n\nnamespace gtest_internal {\n\ntemplate <>\nclass Get<0> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))\n  Field(Tuple& t) { return t.f0_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))\n  ConstField(const Tuple& t) { return t.f0_; }\n};\n\ntemplate <>\nclass Get<1> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))\n  Field(Tuple& t) { return t.f1_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))\n  ConstField(const Tuple& t) { return t.f1_; }\n};\n\ntemplate <>\nclass Get<2> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))\n  Field(Tuple& t) { return t.f2_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))\n  ConstField(const Tuple& t) { return t.f2_; }\n};\n\ntemplate <>\nclass Get<3> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))\n  Field(Tuple& t) { return t.f3_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))\n  ConstField(const Tuple& t) { return t.f3_; }\n};\n\ntemplate <>\nclass Get<4> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))\n  Field(Tuple& t) { return t.f4_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))\n  ConstField(const Tuple& t) { return t.f4_; }\n};\n\ntemplate <>\nclass Get<5> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))\n  Field(Tuple& t) { return t.f5_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))\n  ConstField(const Tuple& t) { return t.f5_; }\n};\n\ntemplate <>\nclass Get<6> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))\n  Field(Tuple& t) { return t.f6_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))\n  ConstField(const Tuple& t) { return t.f6_; }\n};\n\ntemplate <>\nclass Get<7> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))\n  Field(Tuple& t) { return t.f7_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))\n  ConstField(const Tuple& t) { return t.f7_; }\n};\n\ntemplate <>\nclass Get<8> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))\n  Field(Tuple& t) { return t.f8_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))\n  ConstField(const Tuple& t) { return t.f8_; }\n};\n\ntemplate <>\nclass Get<9> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))\n  Field(Tuple& t) { return t.f9_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))\n  ConstField(const Tuple& t) { return t.f9_; }\n};\n\n}  // namespace gtest_internal\n\ntemplate <int k, GTEST_10_TYPENAMES_(T)>\nGTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))\nget(GTEST_10_TUPLE_(T)& t) {\n  return gtest_internal::Get<k>::Field(t);\n}\n\ntemplate <int k, GTEST_10_TYPENAMES_(T)>\nGTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))\nget(const GTEST_10_TUPLE_(T)& t) {\n  return gtest_internal::Get<k>::ConstField(t);\n}\n\n// 6.1.3.5 Relational operators\n\n// We only implement == and !=, as we don't have a need for the rest yet.\n\nnamespace gtest_internal {\n\n// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the\n// first k fields of t1 equals the first k fields of t2.\n// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if\n// k1 != k2.\ntemplate <int kSize1, int kSize2>\nstruct SameSizeTuplePrefixComparator;\n\ntemplate <>\nstruct SameSizeTuplePrefixComparator<0, 0> {\n  template <class Tuple1, class Tuple2>\n  static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {\n    return true;\n  }\n};\n\ntemplate <int k>\nstruct SameSizeTuplePrefixComparator<k, k> {\n  template <class Tuple1, class Tuple2>\n  static bool Eq(const Tuple1& t1, const Tuple2& t2) {\n    return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&\n        ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);\n  }\n};\n\n}  // namespace gtest_internal\n\ntemplate <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>\ninline bool operator==(const GTEST_10_TUPLE_(T)& t,\n                       const GTEST_10_TUPLE_(U)& u) {\n  return gtest_internal::SameSizeTuplePrefixComparator<\n      tuple_size<GTEST_10_TUPLE_(T) >::value,\n      tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);\n}\n\ntemplate <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>\ninline bool operator!=(const GTEST_10_TUPLE_(T)& t,\n                       const GTEST_10_TUPLE_(U)& u) { return !(t == u); }\n\n// 6.1.4 Pairs.\n// Unimplemented.\n\n}  // namespace tr1\n}  // namespace std\n\n#undef GTEST_0_TUPLE_\n#undef GTEST_1_TUPLE_\n#undef GTEST_2_TUPLE_\n#undef GTEST_3_TUPLE_\n#undef GTEST_4_TUPLE_\n#undef GTEST_5_TUPLE_\n#undef GTEST_6_TUPLE_\n#undef GTEST_7_TUPLE_\n#undef GTEST_8_TUPLE_\n#undef GTEST_9_TUPLE_\n#undef GTEST_10_TUPLE_\n\n#undef GTEST_0_TYPENAMES_\n#undef GTEST_1_TYPENAMES_\n#undef GTEST_2_TYPENAMES_\n#undef GTEST_3_TYPENAMES_\n#undef GTEST_4_TYPENAMES_\n#undef GTEST_5_TYPENAMES_\n#undef GTEST_6_TYPENAMES_\n#undef GTEST_7_TYPENAMES_\n#undef GTEST_8_TYPENAMES_\n#undef GTEST_9_TYPENAMES_\n#undef GTEST_10_TYPENAMES_\n\n#undef GTEST_DECLARE_TUPLE_AS_FRIEND_\n#undef GTEST_BY_REF_\n#undef GTEST_ADD_REF_\n#undef GTEST_TUPLE_ELEMENT_\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-tuple.h.pump",
    "content": "$$ -*- mode: c++; -*-\n$var n = 10  $$ Maximum number of tuple fields we want to support.\n$$ This meta comment fixes auto-indentation in Emacs. }}\n// Copyright 2009 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Implements a subset of TR1 tuple needed by Google Test and Google Mock.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n\n#include <utility>  // For ::std::pair.\n\n// The compiler used in Symbian has a bug that prevents us from declaring the\n// tuple template as a friend (it complains that tuple is redefined).  This\n// hack bypasses the bug by declaring the members that should otherwise be\n// private as public.\n// Sun Studio versions < 12 also have the above bug.\n#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)\n# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:\n#else\n# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \\\n    template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \\\n   private:\n#endif\n\n\n$range i 0..n-1\n$range j 0..n\n$range k 1..n\n// GTEST_n_TUPLE_(T) is the type of an n-tuple.\n#define GTEST_0_TUPLE_(T) tuple<>\n\n$for k [[\n$range m 0..k-1\n$range m2 k..n-1\n#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>\n\n]]\n\n// GTEST_n_TYPENAMES_(T) declares a list of n typenames.\n\n$for j [[\n$range m 0..j-1\n#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]\n\n\n]]\n\n// In theory, defining stuff in the ::std namespace is undefined\n// behavior.  We can do this as we are playing the role of a standard\n// library vendor.\nnamespace std {\nnamespace tr1 {\n\ntemplate <$for i, [[typename T$i = void]]>\nclass tuple;\n\n// Anything in namespace gtest_internal is Google Test's INTERNAL\n// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.\nnamespace gtest_internal {\n\n// ByRef<T>::type is T if T is a reference; otherwise it's const T&.\ntemplate <typename T>\nstruct ByRef { typedef const T& type; };  // NOLINT\ntemplate <typename T>\nstruct ByRef<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper for ByRef.\n#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type\n\n// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This\n// is the same as tr1::add_reference<T>::type.\ntemplate <typename T>\nstruct AddRef { typedef T& type; };  // NOLINT\ntemplate <typename T>\nstruct AddRef<T&> { typedef T& type; };  // NOLINT\n\n// A handy wrapper for AddRef.\n#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type\n\n// A helper for implementing get<k>().\ntemplate <int k> class Get;\n\n// A helper for implementing tuple_element<k, T>.  kIndexValid is true\n// iff k < the number of fields in tuple type T.\ntemplate <bool kIndexValid, int kIndex, class Tuple>\nstruct TupleElement;\n\n\n$for i [[\ntemplate <GTEST_$(n)_TYPENAMES_(T)>\nstruct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T) > {\n  typedef T$i type;\n};\n\n\n]]\n}  // namespace gtest_internal\n\ntemplate <>\nclass tuple<> {\n public:\n  tuple() {}\n  tuple(const tuple& /* t */)  {}\n  tuple& operator=(const tuple& /* t */) { return *this; }\n};\n\n\n$for k [[\n$range m 0..k-1\ntemplate <GTEST_$(k)_TYPENAMES_(T)>\nclass $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {\n public:\n  template <int k> friend class gtest_internal::Get;\n\n  tuple() : $for m, [[f$(m)_()]] {}\n\n  explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]\n$for m, [[f$(m)_(f$m)]] {}\n\n  tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}\n\n  template <GTEST_$(k)_TYPENAMES_(U)>\n  tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}\n\n$if k == 2 [[\n  template <typename U0, typename U1>\n  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}\n\n]]\n\n  tuple& operator=(const tuple& t) { return CopyFrom(t); }\n\n  template <GTEST_$(k)_TYPENAMES_(U)>\n  tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) {\n    return CopyFrom(t);\n  }\n\n$if k == 2 [[\n  template <typename U0, typename U1>\n  tuple& operator=(const ::std::pair<U0, U1>& p) {\n    f0_ = p.first;\n    f1_ = p.second;\n    return *this;\n  }\n\n]]\n\n  GTEST_DECLARE_TUPLE_AS_FRIEND_\n\n  template <GTEST_$(k)_TYPENAMES_(U)>\n  tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) {\n\n$for m [[\n    f$(m)_ = t.f$(m)_;\n\n]]\n    return *this;\n  }\n\n\n$for m [[\n  T$m f$(m)_;\n\n]]\n};\n\n\n]]\n// 6.1.3.2 Tuple creation functions.\n\n// Known limitations: we don't support passing an\n// std::tr1::reference_wrapper<T> to make_tuple().  And we don't\n// implement tie().\n\ninline tuple<> make_tuple() { return tuple<>(); }\n\n$for k [[\n$range m 0..k-1\n\ntemplate <GTEST_$(k)_TYPENAMES_(T)>\ninline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) {\n  return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]);\n}\n\n]]\n\n// 6.1.3.3 Tuple helper classes.\n\ntemplate <typename Tuple> struct tuple_size;\n\n\n$for j [[\ntemplate <GTEST_$(j)_TYPENAMES_(T)>\nstruct tuple_size<GTEST_$(j)_TUPLE_(T) > {\n  static const int value = $j;\n};\n\n\n]]\ntemplate <int k, class Tuple>\nstruct tuple_element {\n  typedef typename gtest_internal::TupleElement<\n      k < (tuple_size<Tuple>::value), k, Tuple>::type type;\n};\n\n#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type\n\n// 6.1.3.4 Element access.\n\nnamespace gtest_internal {\n\n\n$for i [[\ntemplate <>\nclass Get<$i> {\n public:\n  template <class Tuple>\n  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))\n  Field(Tuple& t) { return t.f$(i)_; }  // NOLINT\n\n  template <class Tuple>\n  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))\n  ConstField(const Tuple& t) { return t.f$(i)_; }\n};\n\n\n]]\n}  // namespace gtest_internal\n\ntemplate <int k, GTEST_$(n)_TYPENAMES_(T)>\nGTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))\nget(GTEST_$(n)_TUPLE_(T)& t) {\n  return gtest_internal::Get<k>::Field(t);\n}\n\ntemplate <int k, GTEST_$(n)_TYPENAMES_(T)>\nGTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_$(n)_TUPLE_(T)))\nget(const GTEST_$(n)_TUPLE_(T)& t) {\n  return gtest_internal::Get<k>::ConstField(t);\n}\n\n// 6.1.3.5 Relational operators\n\n// We only implement == and !=, as we don't have a need for the rest yet.\n\nnamespace gtest_internal {\n\n// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the\n// first k fields of t1 equals the first k fields of t2.\n// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if\n// k1 != k2.\ntemplate <int kSize1, int kSize2>\nstruct SameSizeTuplePrefixComparator;\n\ntemplate <>\nstruct SameSizeTuplePrefixComparator<0, 0> {\n  template <class Tuple1, class Tuple2>\n  static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {\n    return true;\n  }\n};\n\ntemplate <int k>\nstruct SameSizeTuplePrefixComparator<k, k> {\n  template <class Tuple1, class Tuple2>\n  static bool Eq(const Tuple1& t1, const Tuple2& t2) {\n    return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&\n        ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);\n  }\n};\n\n}  // namespace gtest_internal\n\ntemplate <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>\ninline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,\n                       const GTEST_$(n)_TUPLE_(U)& u) {\n  return gtest_internal::SameSizeTuplePrefixComparator<\n      tuple_size<GTEST_$(n)_TUPLE_(T) >::value,\n      tuple_size<GTEST_$(n)_TUPLE_(U) >::value>::Eq(t, u);\n}\n\ntemplate <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>\ninline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,\n                       const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }\n\n// 6.1.4 Pairs.\n// Unimplemented.\n\n}  // namespace tr1\n}  // namespace std\n\n\n$for j [[\n#undef GTEST_$(j)_TUPLE_\n\n]]\n\n\n$for j [[\n#undef GTEST_$(j)_TYPENAMES_\n\n]]\n\n#undef GTEST_DECLARE_TUPLE_AS_FRIEND_\n#undef GTEST_BY_REF_\n#undef GTEST_ADD_REF_\n#undef GTEST_TUPLE_ELEMENT_\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-type-util.h",
    "content": "// This file was GENERATED by command:\n//     pump.py gtest-type-util.h.pump\n// DO NOT EDIT BY HAND!!!\n\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Type utilities needed for implementing typed and type-parameterized\n// tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n// Currently we support at most 50 types in a list, and at most 50\n// type-parameterized tests in one type-parameterized test case.\n// Please contact googletestframework@googlegroups.com if you need\n// more.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n\n#include \"gtest/internal/gtest-port.h\"\n\n// #ifdef __GNUC__ is too general here.  It is possible to use gcc without using\n// libstdc++ (which is where cxxabi.h comes from).\n# if GTEST_HAS_CXXABI_H_\n#  include <cxxabi.h>\n# elif defined(__HP_aCC)\n#  include <acxx_demangle.h>\n# endif  // GTEST_HASH_CXXABI_H_\n\nnamespace testing {\nnamespace internal {\n\n// GetTypeName<T>() returns a human-readable name of type T.\n// NB: This function is also used in Google Mock, so don't move it inside of\n// the typed-test-only section below.\ntemplate <typename T>\nstd::string GetTypeName() {\n# if GTEST_HAS_RTTI\n\n  const char* const name = typeid(T).name();\n#  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)\n  int status = 0;\n  // gcc's implementation of typeid(T).name() mangles the type name,\n  // so we have to demangle it.\n#   if GTEST_HAS_CXXABI_H_\n  using abi::__cxa_demangle;\n#   endif  // GTEST_HAS_CXXABI_H_\n  char* const readable_name = __cxa_demangle(name, 0, 0, &status);\n  const std::string name_str(status == 0 ? readable_name : name);\n  free(readable_name);\n  return name_str;\n#  else\n  return name;\n#  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC\n\n# else\n\n  return \"<type>\";\n\n# endif  // GTEST_HAS_RTTI\n}\n\n#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same\n// type.  This can be used as a compile-time assertion to ensure that\n// two types are equal.\n\ntemplate <typename T1, typename T2>\nstruct AssertTypeEq;\n\ntemplate <typename T>\nstruct AssertTypeEq<T, T> {\n  typedef bool type;\n};\n\n// A unique type used as the default value for the arguments of class\n// template Types.  This allows us to simulate variadic templates\n// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't\n// support directly.\nstruct None {};\n\n// The following family of struct and struct templates are used to\n// represent type lists.  In particular, TypesN<T1, T2, ..., TN>\n// represents a type list with N types (T1, T2, ..., and TN) in it.\n// Except for Types0, every struct in the family has two member types:\n// Head for the first type in the list, and Tail for the rest of the\n// list.\n\n// The empty type list.\nstruct Types0 {};\n\n// Type lists of length 1, 2, 3, and so on.\n\ntemplate <typename T1>\nstruct Types1 {\n  typedef T1 Head;\n  typedef Types0 Tail;\n};\ntemplate <typename T1, typename T2>\nstruct Types2 {\n  typedef T1 Head;\n  typedef Types1<T2> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3>\nstruct Types3 {\n  typedef T1 Head;\n  typedef Types2<T2, T3> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4>\nstruct Types4 {\n  typedef T1 Head;\n  typedef Types3<T2, T3, T4> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nstruct Types5 {\n  typedef T1 Head;\n  typedef Types4<T2, T3, T4, T5> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nstruct Types6 {\n  typedef T1 Head;\n  typedef Types5<T2, T3, T4, T5, T6> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nstruct Types7 {\n  typedef T1 Head;\n  typedef Types6<T2, T3, T4, T5, T6, T7> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nstruct Types8 {\n  typedef T1 Head;\n  typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nstruct Types9 {\n  typedef T1 Head;\n  typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nstruct Types10 {\n  typedef T1 Head;\n  typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\nstruct Types11 {\n  typedef T1 Head;\n  typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\nstruct Types12 {\n  typedef T1 Head;\n  typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\nstruct Types13 {\n  typedef T1 Head;\n  typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\nstruct Types14 {\n  typedef T1 Head;\n  typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\nstruct Types15 {\n  typedef T1 Head;\n  typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\nstruct Types16 {\n  typedef T1 Head;\n  typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\nstruct Types17 {\n  typedef T1 Head;\n  typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\nstruct Types18 {\n  typedef T1 Head;\n  typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\nstruct Types19 {\n  typedef T1 Head;\n  typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\nstruct Types20 {\n  typedef T1 Head;\n  typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\nstruct Types21 {\n  typedef T1 Head;\n  typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\nstruct Types22 {\n  typedef T1 Head;\n  typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\nstruct Types23 {\n  typedef T1 Head;\n  typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\nstruct Types24 {\n  typedef T1 Head;\n  typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\nstruct Types25 {\n  typedef T1 Head;\n  typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\nstruct Types26 {\n  typedef T1 Head;\n  typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\nstruct Types27 {\n  typedef T1 Head;\n  typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\nstruct Types28 {\n  typedef T1 Head;\n  typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\nstruct Types29 {\n  typedef T1 Head;\n  typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\nstruct Types30 {\n  typedef T1 Head;\n  typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\nstruct Types31 {\n  typedef T1 Head;\n  typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\nstruct Types32 {\n  typedef T1 Head;\n  typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\nstruct Types33 {\n  typedef T1 Head;\n  typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\nstruct Types34 {\n  typedef T1 Head;\n  typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\nstruct Types35 {\n  typedef T1 Head;\n  typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\nstruct Types36 {\n  typedef T1 Head;\n  typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\nstruct Types37 {\n  typedef T1 Head;\n  typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\nstruct Types38 {\n  typedef T1 Head;\n  typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\nstruct Types39 {\n  typedef T1 Head;\n  typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\nstruct Types40 {\n  typedef T1 Head;\n  typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\nstruct Types41 {\n  typedef T1 Head;\n  typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\nstruct Types42 {\n  typedef T1 Head;\n  typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\nstruct Types43 {\n  typedef T1 Head;\n  typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\nstruct Types44 {\n  typedef T1 Head;\n  typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\nstruct Types45 {\n  typedef T1 Head;\n  typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\nstruct Types46 {\n  typedef T1 Head;\n  typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\nstruct Types47 {\n  typedef T1 Head;\n  typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\nstruct Types48 {\n  typedef T1 Head;\n  typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47, T48> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\nstruct Types49 {\n  typedef T1 Head;\n  typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47, T48, T49> Tail;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\nstruct Types50 {\n  typedef T1 Head;\n  typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n      T44, T45, T46, T47, T48, T49, T50> Tail;\n};\n\n\n}  // namespace internal\n\n// We don't want to require the users to write TypesN<...> directly,\n// as that would require them to count the length.  Types<...> is much\n// easier to write, but generates horrible messages when there is a\n// compiler error, as gcc insists on printing out each template\n// argument, even if it has the default value (this means Types<int>\n// will appear as Types<int, None, None, ..., None> in the compiler\n// errors).\n//\n// Our solution is to combine the best part of the two approaches: a\n// user would write Types<T1, ..., TN>, and Google Test will translate\n// that to TypesN<T1, ..., TN> internally to make error messages\n// readable.  The translation is done by the 'type' member of the\n// Types template.\ntemplate <typename T1 = internal::None, typename T2 = internal::None,\n    typename T3 = internal::None, typename T4 = internal::None,\n    typename T5 = internal::None, typename T6 = internal::None,\n    typename T7 = internal::None, typename T8 = internal::None,\n    typename T9 = internal::None, typename T10 = internal::None,\n    typename T11 = internal::None, typename T12 = internal::None,\n    typename T13 = internal::None, typename T14 = internal::None,\n    typename T15 = internal::None, typename T16 = internal::None,\n    typename T17 = internal::None, typename T18 = internal::None,\n    typename T19 = internal::None, typename T20 = internal::None,\n    typename T21 = internal::None, typename T22 = internal::None,\n    typename T23 = internal::None, typename T24 = internal::None,\n    typename T25 = internal::None, typename T26 = internal::None,\n    typename T27 = internal::None, typename T28 = internal::None,\n    typename T29 = internal::None, typename T30 = internal::None,\n    typename T31 = internal::None, typename T32 = internal::None,\n    typename T33 = internal::None, typename T34 = internal::None,\n    typename T35 = internal::None, typename T36 = internal::None,\n    typename T37 = internal::None, typename T38 = internal::None,\n    typename T39 = internal::None, typename T40 = internal::None,\n    typename T41 = internal::None, typename T42 = internal::None,\n    typename T43 = internal::None, typename T44 = internal::None,\n    typename T45 = internal::None, typename T46 = internal::None,\n    typename T47 = internal::None, typename T48 = internal::None,\n    typename T49 = internal::None, typename T50 = internal::None>\nstruct Types {\n  typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;\n};\n\ntemplate <>\nstruct Types<internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types0 type;\n};\ntemplate <typename T1>\nstruct Types<T1, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types1<T1> type;\n};\ntemplate <typename T1, typename T2>\nstruct Types<T1, T2, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types2<T1, T2> type;\n};\ntemplate <typename T1, typename T2, typename T3>\nstruct Types<T1, T2, T3, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types3<T1, T2, T3> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4>\nstruct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types4<T1, T2, T3, T4> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nstruct Types<T1, T2, T3, T4, T5, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types5<T1, T2, T3, T4, T5> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6>\nstruct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,\n      T12> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,\n      T26> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,\n      T40> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None, internal::None> {\n  typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None, internal::None> {\n  typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    internal::None, internal::None, internal::None, internal::None,\n    internal::None> {\n  typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, internal::None, internal::None, internal::None, internal::None> {\n  typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, T47, internal::None, internal::None, internal::None> {\n  typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, T47, T48, internal::None, internal::None> {\n  typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48> type;\n};\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49>\nstruct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,\n    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,\n    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,\n    T46, T47, T48, T49, internal::None> {\n  typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48, T49> type;\n};\n\nnamespace internal {\n\n# define GTEST_TEMPLATE_ template <typename T> class\n\n// The template \"selector\" struct TemplateSel<Tmpl> is used to\n// represent Tmpl, which must be a class template with one type\n// parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined\n// as the type Tmpl<T>.  This allows us to actually instantiate the\n// template \"selected\" by TemplateSel<Tmpl>.\n//\n// This trick is necessary for simulating typedef for class templates,\n// which C++ doesn't support directly.\ntemplate <GTEST_TEMPLATE_ Tmpl>\nstruct TemplateSel {\n  template <typename T>\n  struct Bind {\n    typedef Tmpl<T> type;\n  };\n};\n\n# define GTEST_BIND_(TmplSel, T) \\\n  TmplSel::template Bind<T>::type\n\n// A unique struct template used as the default value for the\n// arguments of class template Templates.  This allows us to simulate\n// variadic templates (e.g. Templates<int>, Templates<int, double>,\n// and etc), which C++ doesn't support directly.\ntemplate <typename T>\nstruct NoneT {};\n\n// The following family of struct and struct templates are used to\n// represent template lists.  In particular, TemplatesN<T1, T2, ...,\n// TN> represents a list of N templates (T1, T2, ..., and TN).  Except\n// for Templates0, every struct in the family has two member types:\n// Head for the selector of the first template in the list, and Tail\n// for the rest of the list.\n\n// The empty template list.\nstruct Templates0 {};\n\n// Template lists of length 1, 2, 3, and so on.\n\ntemplate <GTEST_TEMPLATE_ T1>\nstruct Templates1 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates0 Tail;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>\nstruct Templates2 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates1<T2> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>\nstruct Templates3 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates2<T2, T3> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4>\nstruct Templates4 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates3<T2, T3, T4> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>\nstruct Templates5 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates4<T2, T3, T4, T5> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>\nstruct Templates6 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates5<T2, T3, T4, T5, T6> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7>\nstruct Templates7 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>\nstruct Templates8 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>\nstruct Templates9 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10>\nstruct Templates10 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>\nstruct Templates11 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>\nstruct Templates12 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13>\nstruct Templates13 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>\nstruct Templates14 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>\nstruct Templates15 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16>\nstruct Templates16 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>\nstruct Templates17 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>\nstruct Templates18 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19>\nstruct Templates19 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>\nstruct Templates20 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>\nstruct Templates21 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22>\nstruct Templates22 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>\nstruct Templates23 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>\nstruct Templates24 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25>\nstruct Templates25 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>\nstruct Templates26 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>\nstruct Templates27 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28>\nstruct Templates28 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>\nstruct Templates29 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>\nstruct Templates30 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31>\nstruct Templates31 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>\nstruct Templates32 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>\nstruct Templates33 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34>\nstruct Templates34 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>\nstruct Templates35 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>\nstruct Templates36 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37>\nstruct Templates37 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>\nstruct Templates38 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>\nstruct Templates39 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40>\nstruct Templates40 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>\nstruct Templates41 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>\nstruct Templates42 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43>\nstruct Templates43 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>\nstruct Templates44 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>\nstruct Templates45 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46>\nstruct Templates46 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>\nstruct Templates47 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>\nstruct Templates48 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47, T48> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,\n    GTEST_TEMPLATE_ T49>\nstruct Templates49 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47, T48, T49> Tail;\n};\n\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,\n    GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>\nstruct Templates50 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,\n      T43, T44, T45, T46, T47, T48, T49, T50> Tail;\n};\n\n\n// We don't want to require the users to write TemplatesN<...> directly,\n// as that would require them to count the length.  Templates<...> is much\n// easier to write, but generates horrible messages when there is a\n// compiler error, as gcc insists on printing out each template\n// argument, even if it has the default value (this means Templates<list>\n// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler\n// errors).\n//\n// Our solution is to combine the best part of the two approaches: a\n// user would write Templates<T1, ..., TN>, and Google Test will translate\n// that to TemplatesN<T1, ..., TN> internally to make error messages\n// readable.  The translation is done by the 'type' member of the\n// Templates template.\ntemplate <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,\n    GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,\n    GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,\n    GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,\n    GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,\n    GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,\n    GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,\n    GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,\n    GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,\n    GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,\n    GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,\n    GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,\n    GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,\n    GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,\n    GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,\n    GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,\n    GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,\n    GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,\n    GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,\n    GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,\n    GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,\n    GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,\n    GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,\n    GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,\n    GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>\nstruct Templates {\n  typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47, T48, T49, T50> type;\n};\n\ntemplate <>\nstruct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates0 type;\n};\ntemplate <GTEST_TEMPLATE_ T1>\nstruct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates1<T1> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>\nstruct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates2<T1, T2> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>\nstruct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates3<T1, T2, T3> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4>\nstruct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates4<T1, T2, T3, T4> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>\nstruct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates5<T1, T2, T3, T4, T5> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>\nstruct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates6<T1, T2, T3, T4, T5, T6> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT> {\n  typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT> {\n  typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT> {\n  typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT> {\n  typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT> {\n  typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, NoneT, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, NoneT, NoneT, NoneT, NoneT> {\n  typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, T47, NoneT, NoneT, NoneT> {\n  typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, T47, T48, NoneT, NoneT> {\n  typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47, T48> type;\n};\ntemplate <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,\n    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,\n    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,\n    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,\n    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,\n    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,\n    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,\n    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,\n    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,\n    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,\n    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,\n    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,\n    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,\n    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,\n    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,\n    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,\n    GTEST_TEMPLATE_ T49>\nstruct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,\n    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,\n    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,\n    T45, T46, T47, T48, T49, NoneT> {\n  typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,\n      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,\n      T42, T43, T44, T45, T46, T47, T48, T49> type;\n};\n\n// The TypeList template makes it possible to use either a single type\n// or a Types<...> list in TYPED_TEST_CASE() and\n// INSTANTIATE_TYPED_TEST_CASE_P().\n\ntemplate <typename T>\nstruct TypeList {\n  typedef Types1<T> type;\n};\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n    typename T6, typename T7, typename T8, typename T9, typename T10,\n    typename T11, typename T12, typename T13, typename T14, typename T15,\n    typename T16, typename T17, typename T18, typename T19, typename T20,\n    typename T21, typename T22, typename T23, typename T24, typename T25,\n    typename T26, typename T27, typename T28, typename T29, typename T30,\n    typename T31, typename T32, typename T33, typename T34, typename T35,\n    typename T36, typename T37, typename T38, typename T39, typename T40,\n    typename T41, typename T42, typename T43, typename T44, typename T45,\n    typename T46, typename T47, typename T48, typename T49, typename T50>\nstruct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,\n    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,\n    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,\n    T44, T45, T46, T47, T48, T49, T50> > {\n  typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,\n      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,\n      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,\n      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;\n};\n\n#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n"
  },
  {
    "path": "Tests/gtest/include/gtest/internal/gtest-type-util.h.pump",
    "content": "$$ -*- mode: c++; -*-\n$var n = 50  $$ Maximum length of type lists we want to support.\n// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Type utilities needed for implementing typed and type-parameterized\n// tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!\n//\n// Currently we support at most $n types in a list, and at most $n\n// type-parameterized tests in one type-parameterized test case.\n// Please contact googletestframework@googlegroups.com if you need\n// more.\n\n#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n\n#include \"gtest/internal/gtest-port.h\"\n\n// #ifdef __GNUC__ is too general here.  It is possible to use gcc without using\n// libstdc++ (which is where cxxabi.h comes from).\n# if GTEST_HAS_CXXABI_H_\n#  include <cxxabi.h>\n# elif defined(__HP_aCC)\n#  include <acxx_demangle.h>\n# endif  // GTEST_HASH_CXXABI_H_\n\nnamespace testing {\nnamespace internal {\n\n// GetTypeName<T>() returns a human-readable name of type T.\n// NB: This function is also used in Google Mock, so don't move it inside of\n// the typed-test-only section below.\ntemplate <typename T>\nstd::string GetTypeName() {\n# if GTEST_HAS_RTTI\n\n  const char* const name = typeid(T).name();\n#  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)\n  int status = 0;\n  // gcc's implementation of typeid(T).name() mangles the type name,\n  // so we have to demangle it.\n#   if GTEST_HAS_CXXABI_H_\n  using abi::__cxa_demangle;\n#   endif  // GTEST_HAS_CXXABI_H_\n  char* const readable_name = __cxa_demangle(name, 0, 0, &status);\n  const std::string name_str(status == 0 ? readable_name : name);\n  free(readable_name);\n  return name_str;\n#  else\n  return name;\n#  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC\n\n# else\n\n  return \"<type>\";\n\n# endif  // GTEST_HAS_RTTI\n}\n\n#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same\n// type.  This can be used as a compile-time assertion to ensure that\n// two types are equal.\n\ntemplate <typename T1, typename T2>\nstruct AssertTypeEq;\n\ntemplate <typename T>\nstruct AssertTypeEq<T, T> {\n  typedef bool type;\n};\n\n// A unique type used as the default value for the arguments of class\n// template Types.  This allows us to simulate variadic templates\n// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't\n// support directly.\nstruct None {};\n\n// The following family of struct and struct templates are used to\n// represent type lists.  In particular, TypesN<T1, T2, ..., TN>\n// represents a type list with N types (T1, T2, ..., and TN) in it.\n// Except for Types0, every struct in the family has two member types:\n// Head for the first type in the list, and Tail for the rest of the\n// list.\n\n// The empty type list.\nstruct Types0 {};\n\n// Type lists of length 1, 2, 3, and so on.\n\ntemplate <typename T1>\nstruct Types1 {\n  typedef T1 Head;\n  typedef Types0 Tail;\n};\n\n$range i 2..n\n\n$for i [[\n$range j 1..i\n$range k 2..i\ntemplate <$for j, [[typename T$j]]>\nstruct Types$i {\n  typedef T1 Head;\n  typedef Types$(i-1)<$for k, [[T$k]]> Tail;\n};\n\n\n]]\n\n}  // namespace internal\n\n// We don't want to require the users to write TypesN<...> directly,\n// as that would require them to count the length.  Types<...> is much\n// easier to write, but generates horrible messages when there is a\n// compiler error, as gcc insists on printing out each template\n// argument, even if it has the default value (this means Types<int>\n// will appear as Types<int, None, None, ..., None> in the compiler\n// errors).\n//\n// Our solution is to combine the best part of the two approaches: a\n// user would write Types<T1, ..., TN>, and Google Test will translate\n// that to TypesN<T1, ..., TN> internally to make error messages\n// readable.  The translation is done by the 'type' member of the\n// Types template.\n\n$range i 1..n\ntemplate <$for i, [[typename T$i = internal::None]]>\nstruct Types {\n  typedef internal::Types$n<$for i, [[T$i]]> type;\n};\n\ntemplate <>\nstruct Types<$for i, [[internal::None]]> {\n  typedef internal::Types0 type;\n};\n\n$range i 1..n-1\n$for i [[\n$range j 1..i\n$range k i+1..n\ntemplate <$for j, [[typename T$j]]>\nstruct Types<$for j, [[T$j]]$for k[[, internal::None]]> {\n  typedef internal::Types$i<$for j, [[T$j]]> type;\n};\n\n]]\n\nnamespace internal {\n\n# define GTEST_TEMPLATE_ template <typename T> class\n\n// The template \"selector\" struct TemplateSel<Tmpl> is used to\n// represent Tmpl, which must be a class template with one type\n// parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined\n// as the type Tmpl<T>.  This allows us to actually instantiate the\n// template \"selected\" by TemplateSel<Tmpl>.\n//\n// This trick is necessary for simulating typedef for class templates,\n// which C++ doesn't support directly.\ntemplate <GTEST_TEMPLATE_ Tmpl>\nstruct TemplateSel {\n  template <typename T>\n  struct Bind {\n    typedef Tmpl<T> type;\n  };\n};\n\n# define GTEST_BIND_(TmplSel, T) \\\n  TmplSel::template Bind<T>::type\n\n// A unique struct template used as the default value for the\n// arguments of class template Templates.  This allows us to simulate\n// variadic templates (e.g. Templates<int>, Templates<int, double>,\n// and etc), which C++ doesn't support directly.\ntemplate <typename T>\nstruct NoneT {};\n\n// The following family of struct and struct templates are used to\n// represent template lists.  In particular, TemplatesN<T1, T2, ...,\n// TN> represents a list of N templates (T1, T2, ..., and TN).  Except\n// for Templates0, every struct in the family has two member types:\n// Head for the selector of the first template in the list, and Tail\n// for the rest of the list.\n\n// The empty template list.\nstruct Templates0 {};\n\n// Template lists of length 1, 2, 3, and so on.\n\ntemplate <GTEST_TEMPLATE_ T1>\nstruct Templates1 {\n  typedef TemplateSel<T1> Head;\n  typedef Templates0 Tail;\n};\n\n$range i 2..n\n\n$for i [[\n$range j 1..i\n$range k 2..i\ntemplate <$for j, [[GTEST_TEMPLATE_ T$j]]>\nstruct Templates$i {\n  typedef TemplateSel<T1> Head;\n  typedef Templates$(i-1)<$for k, [[T$k]]> Tail;\n};\n\n\n]]\n\n// We don't want to require the users to write TemplatesN<...> directly,\n// as that would require them to count the length.  Templates<...> is much\n// easier to write, but generates horrible messages when there is a\n// compiler error, as gcc insists on printing out each template\n// argument, even if it has the default value (this means Templates<list>\n// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler\n// errors).\n//\n// Our solution is to combine the best part of the two approaches: a\n// user would write Templates<T1, ..., TN>, and Google Test will translate\n// that to TemplatesN<T1, ..., TN> internally to make error messages\n// readable.  The translation is done by the 'type' member of the\n// Templates template.\n\n$range i 1..n\ntemplate <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>\nstruct Templates {\n  typedef Templates$n<$for i, [[T$i]]> type;\n};\n\ntemplate <>\nstruct Templates<$for i, [[NoneT]]> {\n  typedef Templates0 type;\n};\n\n$range i 1..n-1\n$for i [[\n$range j 1..i\n$range k i+1..n\ntemplate <$for j, [[GTEST_TEMPLATE_ T$j]]>\nstruct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {\n  typedef Templates$i<$for j, [[T$j]]> type;\n};\n\n]]\n\n// The TypeList template makes it possible to use either a single type\n// or a Types<...> list in TYPED_TEST_CASE() and\n// INSTANTIATE_TYPED_TEST_CASE_P().\n\ntemplate <typename T>\nstruct TypeList {\n  typedef Types1<T> type;\n};\n\n\n$range i 1..n\ntemplate <$for i, [[typename T$i]]>\nstruct TypeList<Types<$for i, [[T$i]]> > {\n  typedef typename Types<$for i, [[T$i]]>::type type;\n};\n\n#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_\n"
  },
  {
    "path": "Tests/gtest/m4/acx_pthread.m4",
    "content": "# This was retrieved from\n#    http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi\n# See also (perhaps for new versions?)\n#    http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi\n#\n# We've rewritten the inconsistency check code (from avahi), to work\n# more broadly.  In particular, it no longer assumes ld accepts -zdefs.\n# This caused a restructing of the code, but the functionality has only\n# changed a little.\n\ndnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])\ndnl\ndnl @summary figure out how to build C programs using POSIX threads\ndnl\ndnl This macro figures out how to build C programs using POSIX threads.\ndnl It sets the PTHREAD_LIBS output variable to the threads library and\ndnl linker flags, and the PTHREAD_CFLAGS output variable to any special\ndnl C compiler flags that are needed. (The user can also force certain\ndnl compiler flags/libs to be tested by setting these environment\ndnl variables.)\ndnl\ndnl Also sets PTHREAD_CC to any special C compiler that is needed for\ndnl multi-threaded programs (defaults to the value of CC otherwise).\ndnl (This is necessary on AIX to use the special cc_r compiler alias.)\ndnl\ndnl NOTE: You are assumed to not only compile your program with these\ndnl flags, but also link it with them as well. e.g. you should link\ndnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS\ndnl $LIBS\ndnl\ndnl If you are only building threads programs, you may wish to use\ndnl these variables in your default LIBS, CFLAGS, and CC:\ndnl\ndnl        LIBS=\"$PTHREAD_LIBS $LIBS\"\ndnl        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\ndnl        CC=\"$PTHREAD_CC\"\ndnl\ndnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute\ndnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to\ndnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).\ndnl\ndnl ACTION-IF-FOUND is a list of shell commands to run if a threads\ndnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to\ndnl run it if it is not found. If ACTION-IF-FOUND is not specified, the\ndnl default action will define HAVE_PTHREAD.\ndnl\ndnl Please let the authors know if this macro fails on any platform, or\ndnl if you have any other suggestions or comments. This macro was based\ndnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with\ndnl help from M. Frigo), as well as ac_pthread and hb_pthread macros\ndnl posted by Alejandro Forero Cuervo to the autoconf macro repository.\ndnl We are also grateful for the helpful feedback of numerous users.\ndnl\ndnl @category InstalledPackages\ndnl @author Steven G. Johnson <stevenj@alum.mit.edu>\ndnl @version 2006-05-29\ndnl @license GPLWithACException\ndnl \ndnl Checks for GCC shared/pthread inconsistency based on work by\ndnl Marcin Owsiany <marcin@owsiany.pl>\n\n\nAC_DEFUN([ACX_PTHREAD], [\nAC_REQUIRE([AC_CANONICAL_HOST])\nAC_LANG_SAVE\nAC_LANG_C\nacx_pthread_ok=no\n\n# We used to check for pthread.h first, but this fails if pthread.h\n# requires special compiler flags (e.g. on True64 or Sequent).\n# It gets checked for in the link test anyway.\n\n# First of all, check if the user has set any of the PTHREAD_LIBS,\n# etcetera environment variables, and if threads linking works using\n# them:\nif test x\"$PTHREAD_LIBS$PTHREAD_CFLAGS\" != x; then\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])\n        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)\n        AC_MSG_RESULT($acx_pthread_ok)\n        if test x\"$acx_pthread_ok\" = xno; then\n                PTHREAD_LIBS=\"\"\n                PTHREAD_CFLAGS=\"\"\n        fi\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\nfi\n\n# We must check for the threads library under a number of different\n# names; the ordering is very important because some systems\n# (e.g. DEC) have both -lpthread and -lpthreads, where one of the\n# libraries is broken (non-POSIX).\n\n# Create a list of thread flags to try.  Items starting with a \"-\" are\n# C compiler flags, and other items are library names, except for \"none\"\n# which indicates that we try without any flags at all, and \"pthread-config\"\n# which is a program returning the flags for the Pth emulation library.\n\nacx_pthread_flags=\"pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config\"\n\n# The ordering *is* (sometimes) important.  Some notes on the\n# individual items follow:\n\n# pthreads: AIX (must check this before -lpthread)\n# none: in case threads are in libc; should be tried before -Kthread and\n#       other compiler flags to prevent continual compiler warnings\n# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)\n# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)\n# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)\n# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)\n# -pthreads: Solaris/gcc\n# -mthreads: Mingw32/gcc, Lynx/gcc\n# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it\n#      doesn't hurt to check since this sometimes defines pthreads too;\n#      also defines -D_REENTRANT)\n#      ... -mt is also the pthreads flag for HP/aCC\n# pthread: Linux, etcetera\n# --thread-safe: KAI C++\n# pthread-config: use pthread-config program (for GNU Pth library)\n\ncase \"${host_cpu}-${host_os}\" in\n        *solaris*)\n\n        # On Solaris (at least, for some versions), libc contains stubbed\n        # (non-functional) versions of the pthreads routines, so link-based\n        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/\n        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather\n        # a function called by this macro, so we could check for that, but\n        # who knows whether they'll stub that too in a future libc.)  So,\n        # we'll just look for -pthreads and -lpthread first:\n\n        acx_pthread_flags=\"-pthreads pthread -mt -pthread $acx_pthread_flags\"\n        ;;\nesac\n\nif test x\"$acx_pthread_ok\" = xno; then\nfor flag in $acx_pthread_flags; do\n\n        case $flag in\n                none)\n                AC_MSG_CHECKING([whether pthreads work without any flags])\n                ;;\n\n                -*)\n                AC_MSG_CHECKING([whether pthreads work with $flag])\n                PTHREAD_CFLAGS=\"$flag\"\n                ;;\n\n\t\tpthread-config)\n\t\tAC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)\n\t\tif test x\"$acx_pthread_config\" = xno; then continue; fi\n\t\tPTHREAD_CFLAGS=\"`pthread-config --cflags`\"\n\t\tPTHREAD_LIBS=\"`pthread-config --ldflags` `pthread-config --libs`\"\n\t\t;;\n\n                *)\n                AC_MSG_CHECKING([for the pthreads library -l$flag])\n                PTHREAD_LIBS=\"-l$flag\"\n                ;;\n        esac\n\n        save_LIBS=\"$LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Check for various functions.  We must include pthread.h,\n        # since some functions may be macros.  (On the Sequent, we\n        # need a special flag -Kthread to make this header compile.)\n        # We check for pthread_join because it is in -lpthread on IRIX\n        # while pthread_create is in libc.  We check for pthread_attr_init\n        # due to DEC craziness with -lpthreads.  We check for\n        # pthread_cleanup_push because it is one of the few pthread\n        # functions on Solaris that doesn't have a non-functional libc stub.\n        # We try pthread_create on general principles.\n        AC_TRY_LINK([#include <pthread.h>],\n                    [pthread_t th; pthread_join(th, 0);\n                     pthread_attr_init(0); pthread_cleanup_push(0, 0);\n                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],\n                    [acx_pthread_ok=yes])\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n\n        AC_MSG_RESULT($acx_pthread_ok)\n        if test \"x$acx_pthread_ok\" = xyes; then\n                break;\n        fi\n\n        PTHREAD_LIBS=\"\"\n        PTHREAD_CFLAGS=\"\"\ndone\nfi\n\n# Various other checks:\nif test \"x$acx_pthread_ok\" = xyes; then\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.\n\tAC_MSG_CHECKING([for joinable pthread attribute])\n\tattr_name=unknown\n\tfor attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do\n\t    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],\n                        [attr_name=$attr; break])\n\tdone\n        AC_MSG_RESULT($attr_name)\n        if test \"$attr_name\" != PTHREAD_CREATE_JOINABLE; then\n            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,\n                               [Define to necessary symbol if this constant\n                                uses a non-standard name on your system.])\n        fi\n\n        AC_MSG_CHECKING([if more special flags are required for pthreads])\n        flag=no\n        case \"${host_cpu}-${host_os}\" in\n            *-aix* | *-freebsd* | *-darwin*) flag=\"-D_THREAD_SAFE\";;\n            *solaris* | *-osf* | *-hpux*) flag=\"-D_REENTRANT\";;\n        esac\n        AC_MSG_RESULT(${flag})\n        if test \"x$flag\" != xno; then\n            PTHREAD_CFLAGS=\"$flag $PTHREAD_CFLAGS\"\n        fi\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n        # More AIX lossage: must compile with xlc_r or cc_r\n\tif test x\"$GCC\" != xyes; then\n          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})\n        else\n          PTHREAD_CC=$CC\n\tfi\n\n\t# The next part tries to detect GCC inconsistency with -shared on some\n\t# architectures and systems. The problem is that in certain\n\t# configurations, when -shared is specified, GCC \"forgets\" to\n\t# internally use various flags which are still necessary.\n\t\n\t#\n\t# Prepare the flags\n\t#\n\tsave_CFLAGS=\"$CFLAGS\"\n\tsave_LIBS=\"$LIBS\"\n\tsave_CC=\"$CC\"\n\t\n\t# Try with the flags determined by the earlier checks.\n\t#\n\t# -Wl,-z,defs forces link-time symbol resolution, so that the\n\t# linking checks with -shared actually have any value\n\t#\n\t# FIXME: -fPIC is required for -shared on many architectures,\n\t# so we specify it here, but the right way would probably be to\n\t# properly detect whether it is actually required.\n\tCFLAGS=\"-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS\"\n\tLIBS=\"$PTHREAD_LIBS $LIBS\"\n\tCC=\"$PTHREAD_CC\"\n\t\n\t# In order not to create several levels of indentation, we test\n\t# the value of \"$done\" until we find the cure or run out of ideas.\n\tdone=\"no\"\n\t\n\t# First, make sure the CFLAGS we added are actually accepted by our\n\t# compiler.  If not (and OS X's ld, for instance, does not accept -z),\n\t# then we can't do this test.\n\tif test x\"$done\" = xno; then\n\t   AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])\n\t   AC_TRY_LINK(,, , [done=yes])\n\t\n\t   if test \"x$done\" = xyes ; then\n\t      AC_MSG_RESULT([no])\n\t   else\n\t      AC_MSG_RESULT([yes])\n\t   fi\n\tfi\n\t\n\tif test x\"$done\" = xno; then\n\t   AC_MSG_CHECKING([whether -pthread is sufficient with -shared])\n\t   AC_TRY_LINK([#include <pthread.h>],\n\t      [pthread_t th; pthread_join(th, 0);\n\t      pthread_attr_init(0); pthread_cleanup_push(0, 0);\n\t      pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],\n\t      [done=yes])\n\t   \n\t   if test \"x$done\" = xyes; then\n\t      AC_MSG_RESULT([yes])\n\t   else\n\t      AC_MSG_RESULT([no])\n\t   fi\n\tfi\n\t\n\t#\n\t# Linux gcc on some architectures such as mips/mipsel forgets\n\t# about -lpthread\n\t#\n\tif test x\"$done\" = xno; then\n\t   AC_MSG_CHECKING([whether -lpthread fixes that])\n\t   LIBS=\"-lpthread $PTHREAD_LIBS $save_LIBS\"\n\t   AC_TRY_LINK([#include <pthread.h>],\n\t      [pthread_t th; pthread_join(th, 0);\n\t      pthread_attr_init(0); pthread_cleanup_push(0, 0);\n\t      pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],\n\t      [done=yes])\n\t\n\t   if test \"x$done\" = xyes; then\n\t      AC_MSG_RESULT([yes])\n\t      PTHREAD_LIBS=\"-lpthread $PTHREAD_LIBS\"\n\t   else\n\t      AC_MSG_RESULT([no])\n\t   fi\n\tfi\n\t#\n\t# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc\n\t#\n\tif test x\"$done\" = xno; then\n\t   AC_MSG_CHECKING([whether -lc_r fixes that])\n\t   LIBS=\"-lc_r $PTHREAD_LIBS $save_LIBS\"\n\t   AC_TRY_LINK([#include <pthread.h>],\n\t       [pthread_t th; pthread_join(th, 0);\n\t        pthread_attr_init(0); pthread_cleanup_push(0, 0);\n\t        pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],\n\t       [done=yes])\n\t\n\t   if test \"x$done\" = xyes; then\n\t      AC_MSG_RESULT([yes])\n\t      PTHREAD_LIBS=\"-lc_r $PTHREAD_LIBS\"\n\t   else\n\t      AC_MSG_RESULT([no])\n\t   fi\n\tfi\n\tif test x\"$done\" = xno; then\n\t   # OK, we have run out of ideas\n\t   AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])\n\t\n\t   # so it's not safe to assume that we may use pthreads\n\t   acx_pthread_ok=no\n\tfi\n\t\n\tCFLAGS=\"$save_CFLAGS\"\n\tLIBS=\"$save_LIBS\"\n\tCC=\"$save_CC\"\nelse\n        PTHREAD_CC=\"$CC\"\nfi\n\nAC_SUBST(PTHREAD_LIBS)\nAC_SUBST(PTHREAD_CFLAGS)\nAC_SUBST(PTHREAD_CC)\n\n# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:\nif test x\"$acx_pthread_ok\" = xyes; then\n        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])\n        :\nelse\n        acx_pthread_ok=no\n        $2\nfi\nAC_LANG_RESTORE\n])dnl ACX_PTHREAD\n"
  },
  {
    "path": "Tests/gtest/m4/gtest.m4",
    "content": "dnl GTEST_LIB_CHECK([minimum version [,\ndnl                  action if found [,action if not found]]])\ndnl\ndnl Check for the presence of the Google Test library, optionally at a minimum\ndnl version, and indicate a viable version with the HAVE_GTEST flag. It defines\ndnl standard variables for substitution including GTEST_CPPFLAGS,\ndnl GTEST_CXXFLAGS, GTEST_LDFLAGS, and GTEST_LIBS. It also defines\ndnl GTEST_VERSION as the version of Google Test found. Finally, it provides\ndnl optional custom action slots in the event GTEST is found or not.\nAC_DEFUN([GTEST_LIB_CHECK],\n[\ndnl Provide a flag to enable or disable Google Test usage.\nAC_ARG_ENABLE([gtest],\n  [AS_HELP_STRING([--enable-gtest],\n                  [Enable tests using the Google C++ Testing Framework.\n                  (Default is enabled.)])],\n  [],\n  [enable_gtest=])\nAC_ARG_VAR([GTEST_CONFIG],\n           [The exact path of Google Test's 'gtest-config' script.])\nAC_ARG_VAR([GTEST_CPPFLAGS],\n           [C-like preprocessor flags for Google Test.])\nAC_ARG_VAR([GTEST_CXXFLAGS],\n           [C++ compile flags for Google Test.])\nAC_ARG_VAR([GTEST_LDFLAGS],\n           [Linker path and option flags for Google Test.])\nAC_ARG_VAR([GTEST_LIBS],\n           [Library linking flags for Google Test.])\nAC_ARG_VAR([GTEST_VERSION],\n           [The version of Google Test available.])\nHAVE_GTEST=\"no\"\nAS_IF([test \"x${enable_gtest}\" != \"xno\"],\n  [AC_MSG_CHECKING([for 'gtest-config'])\n   AS_IF([test \"x${enable_gtest}\" != \"xyes\"],\n     [AS_IF([test -x \"${enable_gtest}/scripts/gtest-config\"],\n        [GTEST_CONFIG=\"${enable_gtest}/scripts/gtest-config\"],\n        [GTEST_CONFIG=\"${enable_gtest}/bin/gtest-config\"])\n      AS_IF([test -x \"${GTEST_CONFIG}\"], [],\n        [AC_MSG_RESULT([no])\n         AC_MSG_ERROR([dnl\nUnable to locate either a built or installed Google Test.\nThe specific location '${enable_gtest}' was provided for a built or installed\nGoogle Test, but no 'gtest-config' script could be found at this location.])\n         ])],\n     [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])\n   AS_IF([test -x \"${GTEST_CONFIG}\"],\n     [AC_MSG_RESULT([${GTEST_CONFIG}])\n      m4_ifval([$1],\n        [_gtest_min_version=\"--min-version=$1\"\n         AC_MSG_CHECKING([for Google Test at least version >= $1])],\n        [_gtest_min_version=\"--min-version=0\"\n         AC_MSG_CHECKING([for Google Test])])\n      AS_IF([${GTEST_CONFIG} ${_gtest_min_version}],\n        [AC_MSG_RESULT([yes])\n         HAVE_GTEST='yes'],\n        [AC_MSG_RESULT([no])])],\n     [AC_MSG_RESULT([no])])\n   AS_IF([test \"x${HAVE_GTEST}\" = \"xyes\"],\n     [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`\n      GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`\n      GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`\n      GTEST_LIBS=`${GTEST_CONFIG} --libs`\n      GTEST_VERSION=`${GTEST_CONFIG} --version`\n      AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])],\n     [AS_IF([test \"x${enable_gtest}\" = \"xyes\"],\n        [AC_MSG_ERROR([dnl\nGoogle Test was enabled, but no viable version could be found.])\n         ])])])\nAC_SUBST([HAVE_GTEST])\nAM_CONDITIONAL([HAVE_GTEST],[test \"x$HAVE_GTEST\" = \"xyes\"])\nAS_IF([test \"x$HAVE_GTEST\" = \"xyes\"],\n  [m4_ifval([$2], [$2])],\n  [m4_ifval([$3], [$3])])\n])\n"
  },
  {
    "path": "Tests/gtest/m4/libtool.m4",
    "content": "# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-\n#\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software\n#                 Foundation, Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\nm4_define([_LT_COPYING], [dnl\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software\n#                 Foundation, Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n#   This file is part of GNU Libtool.\n#\n# GNU Libtool is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 2 of\n# the License, or (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html, or\n# obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n])\n\n# serial 57 LT_INIT\n\n\n# LT_PREREQ(VERSION)\n# ------------------\n# Complain and exit if this libtool version is less that VERSION.\nm4_defun([LT_PREREQ],\n[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,\n       [m4_default([$3],\n\t\t   [m4_fatal([Libtool version $1 or higher is required],\n\t\t             63)])],\n       [$2])])\n\n\n# _LT_CHECK_BUILDDIR\n# ------------------\n# Complain if the absolute build directory name contains unusual characters\nm4_defun([_LT_CHECK_BUILDDIR],\n[case `pwd` in\n  *\\ * | *\\\t*)\n    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;\nesac\n])\n\n\n# LT_INIT([OPTIONS])\n# ------------------\nAC_DEFUN([LT_INIT],\n[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT\nAC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl\nAC_BEFORE([$0], [LT_LANG])dnl\nAC_BEFORE([$0], [LT_OUTPUT])dnl\nAC_BEFORE([$0], [LTDL_INIT])dnl\nm4_require([_LT_CHECK_BUILDDIR])dnl\n\ndnl Autoconf doesn't catch unexpanded LT_ macros by default:\nm4_pattern_forbid([^_?LT_[A-Z_]+$])dnl\nm4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl\ndnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4\ndnl unless we require an AC_DEFUNed macro:\nAC_REQUIRE([LTOPTIONS_VERSION])dnl\nAC_REQUIRE([LTSUGAR_VERSION])dnl\nAC_REQUIRE([LTVERSION_VERSION])dnl\nAC_REQUIRE([LTOBSOLETE_VERSION])dnl\nm4_require([_LT_PROG_LTMAIN])dnl\n\n_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])\n\ndnl Parse OPTIONS\n_LT_SET_OPTIONS([$0], [$1])\n\n# This can be used to rebuild libtool when needed\nLIBTOOL_DEPS=\"$ltmain\"\n\n# Always use our own libtool.\nLIBTOOL='$(SHELL) $(top_builddir)/libtool'\nAC_SUBST(LIBTOOL)dnl\n\n_LT_SETUP\n\n# Only expand once:\nm4_define([LT_INIT])\n])# LT_INIT\n\n# Old names:\nAU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])\nAU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PROG_LIBTOOL], [])\ndnl AC_DEFUN([AM_PROG_LIBTOOL], [])\n\n\n# _LT_CC_BASENAME(CC)\n# -------------------\n# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.\nm4_defun([_LT_CC_BASENAME],\n[for cc_temp in $1\"\"; do\n  case $cc_temp in\n    compile | *[[\\\\/]]compile | ccache | *[[\\\\/]]ccache ) ;;\n    distcc | *[[\\\\/]]distcc | purify | *[[\\\\/]]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"$cc_temp\" | $SED \"s%.*/%%; s%^$host_alias-%%\"`\n])\n\n\n# _LT_FILEUTILS_DEFAULTS\n# ----------------------\n# It is okay to use these file commands and assume they have been set\n# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.\nm4_defun([_LT_FILEUTILS_DEFAULTS],\n[: ${CP=\"cp -f\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n])# _LT_FILEUTILS_DEFAULTS\n\n\n# _LT_SETUP\n# ---------\nm4_defun([_LT_SETUP],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nAC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl\nAC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl\n\n_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl\ndnl\n_LT_DECL([], [host_alias], [0], [The host system])dnl\n_LT_DECL([], [host], [0])dnl\n_LT_DECL([], [host_os], [0])dnl\ndnl\n_LT_DECL([], [build_alias], [0], [The build system])dnl\n_LT_DECL([], [build], [0])dnl\n_LT_DECL([], [build_os], [0])dnl\ndnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\ndnl\nAC_REQUIRE([AC_PROG_LN_S])dnl\ntest -z \"$LN_S\" && LN_S=\"ln -s\"\n_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl\ndnl\nAC_REQUIRE([LT_CMD_MAX_LEN])dnl\n_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally \"o\")])dnl\n_LT_DECL([], [exeext], [0], [Executable file suffix (normally \"\")])dnl\ndnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nm4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl\nm4_require([_LT_CMD_RELOAD])dnl\nm4_require([_LT_CHECK_MAGIC_METHOD])dnl\nm4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl\nm4_require([_LT_CMD_OLD_ARCHIVE])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_WITH_SYSROOT])dnl\n\n_LT_CONFIG_LIBTOOL_INIT([\n# See if we are running on zsh, and set the options which allow our\n# commands through without removal of \\ escapes INIT.\nif test -n \"\\${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n])\nif test -n \"${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n_LT_CHECK_OBJDIR\n\nm4_require([_LT_TAG_COMPILER])dnl\n\ncase $host_os in\naix3*)\n  # AIX sometimes has problems with the GCC collect2 program.  For some\n  # reason, if we set the COLLECT_NAMES environment variable, the problems\n  # vanish in a puff of smoke.\n  if test \"X${COLLECT_NAMES+set}\" != Xset; then\n    COLLECT_NAMES=\n    export COLLECT_NAMES\n  fi\n  ;;\nesac\n\n# Global variables:\nofile=libtool\ncan_build_shared=yes\n\n# All known linkers require a `.a' archive for static linking (except MSVC,\n# which needs '.lib').\nlibext=a\n\nwith_gnu_ld=\"$lt_cv_prog_gnu_ld\"\n\nold_CC=\"$CC\"\nold_CFLAGS=\"$CFLAGS\"\n\n# Set sane defaults for various variables\ntest -z \"$CC\" && CC=cc\ntest -z \"$LTCC\" && LTCC=$CC\ntest -z \"$LTCFLAGS\" && LTCFLAGS=$CFLAGS\ntest -z \"$LD\" && LD=ld\ntest -z \"$ac_objext\" && ac_objext=o\n\n_LT_CC_BASENAME([$compiler])\n\n# Only perform the check for file, if the check method requires it\ntest -z \"$MAGIC_CMD\" && MAGIC_CMD=file\ncase $deplibs_check_method in\nfile_magic*)\n  if test \"$file_magic_cmd\" = '$MAGIC_CMD'; then\n    _LT_PATH_MAGIC\n  fi\n  ;;\nesac\n\n# Use C for the default configuration in the libtool script\nLT_SUPPORTED_TAG([CC])\n_LT_LANG_C_CONFIG\n_LT_LANG_DEFAULT_CONFIG\n_LT_CONFIG_COMMANDS\n])# _LT_SETUP\n\n\n# _LT_PREPARE_SED_QUOTE_VARS\n# --------------------------\n# Define a few sed substitution that help us do robust quoting.\nm4_defun([_LT_PREPARE_SED_QUOTE_VARS],\n[# Backslashify metacharacters that are still active within\n# double-quoted strings.\nsed_quote_subst='s/\\([[\"`$\\\\]]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([[\"`\\\\]]\\)/\\\\\\1/g'\n\n# Sed substitution to delay expansion of an escaped shell variable in a\n# double_quote_subst'ed string.\ndelay_variable_subst='s/\\\\\\\\\\\\\\\\\\\\\\$/\\\\\\\\\\\\$/g'\n\n# Sed substitution to delay expansion of an escaped single quote.\ndelay_single_quote_subst='s/'\\''/'\\'\\\\\\\\\\\\\\'\\''/g'\n\n# Sed substitution to avoid accidental globbing in evaled expressions\nno_glob_subst='s/\\*/\\\\\\*/g'\n])\n\n# _LT_PROG_LTMAIN\n# ---------------\n# Note that this code is called both from `configure', and `config.status'\n# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,\n# `config.status' has no value for ac_aux_dir unless we are using Automake,\n# so we pass a copy along to make sure it has a sensible value anyway.\nm4_defun([_LT_PROG_LTMAIN],\n[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl\n_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])\nltmain=\"$ac_aux_dir/ltmain.sh\"\n])# _LT_PROG_LTMAIN\n\n\n## ------------------------------------- ##\n## Accumulate code for creating libtool. ##\n## ------------------------------------- ##\n\n# So that we can recreate a full libtool script including additional\n# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS\n# in macros and then make a single call at the end using the `libtool'\n# label.\n\n\n# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])\n# ----------------------------------------\n# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL_INIT],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_INIT])\n\n\n# _LT_CONFIG_LIBTOOL([COMMANDS])\n# ------------------------------\n# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])\n\n\n# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])\n# -----------------------------------------------------\nm4_defun([_LT_CONFIG_SAVE_COMMANDS],\n[_LT_CONFIG_LIBTOOL([$1])\n_LT_CONFIG_LIBTOOL_INIT([$2])\n])\n\n\n# _LT_FORMAT_COMMENT([COMMENT])\n# -----------------------------\n# Add leading comment marks to the start of each line, and a trailing\n# full-stop to the whole comment if one is not present already.\nm4_define([_LT_FORMAT_COMMENT],\n[m4_ifval([$1], [\nm4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],\n              [['`$\\]], [\\\\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])\n)])\n\n\n\n## ------------------------ ##\n## FIXME: Eliminate VARNAME ##\n## ------------------------ ##\n\n\n# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])\n# -------------------------------------------------------------------\n# CONFIGNAME is the name given to the value in the libtool script.\n# VARNAME is the (base) name used in the configure script.\n# VALUE may be 0, 1 or 2 for a computed quote escaped value based on\n# VARNAME.  Any other value will be used directly.\nm4_define([_LT_DECL],\n[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],\n    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],\n\t[m4_ifval([$1], [$1], [$2])])\n    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])\n    m4_ifval([$4],\n\t[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])\n    lt_dict_add_subkey([lt_decl_dict], [$2],\n\t[tagged?], [m4_ifval([$5], [yes], [no])])])\n])\n\n\n# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])\n# --------------------------------------------------------\nm4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])\n\n\n# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_tag_varnames],\n[_lt_decl_filter([tagged?], [yes], $@)])\n\n\n# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])\n# ---------------------------------------------------------\nm4_define([_lt_decl_filter],\n[m4_case([$#],\n  [0], [m4_fatal([$0: too few arguments: $#])],\n  [1], [m4_fatal([$0: too few arguments: $#: $1])],\n  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],\n  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],\n  [lt_dict_filter([lt_decl_dict], $@)])[]dnl\n])\n\n\n# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])\n# --------------------------------------------------\nm4_define([lt_decl_quote_varnames],\n[_lt_decl_filter([value], [1], $@)])\n\n\n# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_dquote_varnames],\n[_lt_decl_filter([value], [2], $@)])\n\n\n# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_varnames_tagged],\n[m4_assert([$# <= 2])dnl\n_$0(m4_quote(m4_default([$1], [[, ]])),\n    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),\n    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])\nm4_define([_lt_decl_varnames_tagged],\n[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])\n\n\n# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_all_varnames],\n[_$0(m4_quote(m4_default([$1], [[, ]])),\n     m4_if([$2], [],\n\t   m4_quote(lt_decl_varnames),\n\tm4_quote(m4_shift($@))))[]dnl\n])\nm4_define([_lt_decl_all_varnames],\n[lt_join($@, lt_decl_varnames_tagged([$1],\n\t\t\tlt_decl_tag_varnames([[, ]], m4_shift($@))))dnl\n])\n\n\n# _LT_CONFIG_STATUS_DECLARE([VARNAME])\n# ------------------------------------\n# Quote a variable value, and forward it to `config.status' so that its\n# declaration there will have the same value as in `configure'.  VARNAME\n# must have a single quote delimited value for this to work.\nm4_define([_LT_CONFIG_STATUS_DECLARE],\n[$1='`$ECHO \"$][$1\" | $SED \"$delay_single_quote_subst\"`'])\n\n\n# _LT_CONFIG_STATUS_DECLARATIONS\n# ------------------------------\n# We delimit libtool config variables with single quotes, so when\n# we write them to config.status, we have to be sure to quote all\n# embedded single quotes properly.  In configure, this macro expands\n# each variable declared with _LT_DECL (and _LT_TAGDECL) into:\n#\n#    <var>='`$ECHO \"$<var>\" | $SED \"$delay_single_quote_subst\"`'\nm4_defun([_LT_CONFIG_STATUS_DECLARATIONS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),\n    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAGS\n# ----------------\n# Output comment and list of tags supported by the script\nm4_defun([_LT_LIBTOOL_TAGS],\n[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl\navailable_tags=\"_LT_TAGS\"dnl\n])\n\n\n# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])\n# -----------------------------------\n# Extract the dictionary values for VARNAME (optionally with TAG) and\n# expand to a commented shell variable setting:\n#\n#    # Some comment about what VAR is for.\n#    visible_name=$lt_internal_name\nm4_define([_LT_LIBTOOL_DECLARE],\n[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],\n\t\t\t\t\t   [description])))[]dnl\nm4_pushdef([_libtool_name],\n    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl\nm4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),\n    [0], [_libtool_name=[$]$1],\n    [1], [_libtool_name=$lt_[]$1],\n    [2], [_libtool_name=$lt_[]$1],\n    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl\nm4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl\n])\n\n\n# _LT_LIBTOOL_CONFIG_VARS\n# -----------------------\n# Produce commented declarations of non-tagged libtool config variables\n# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'\n# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG\n# section) are produced by _LT_LIBTOOL_TAG_VARS.\nm4_defun([_LT_LIBTOOL_CONFIG_VARS],\n[m4_foreach([_lt_var],\n    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAG_VARS(TAG)\n# -------------------------\nm4_define([_LT_LIBTOOL_TAG_VARS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])\n\n\n# _LT_TAGVAR(VARNAME, [TAGNAME])\n# ------------------------------\nm4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])\n\n\n# _LT_CONFIG_COMMANDS\n# -------------------\n# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of\n# variables for single and double quote escaping we saved from calls\n# to _LT_DECL, we can put quote escaped variables declarations\n# into `config.status', and then the shell code to quote escape them in\n# for loops in `config.status'.  Finally, any additional code accumulated\n# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.\nm4_defun([_LT_CONFIG_COMMANDS],\n[AC_PROVIDE_IFELSE([LT_OUTPUT],\n\tdnl If the libtool generation code has been placed in $CONFIG_LT,\n\tdnl instead of duplicating it all over again into config.status,\n\tdnl then we will have config.status run $CONFIG_LT later, so it\n\tdnl needs to know what name is stored there:\n        [AC_CONFIG_COMMANDS([libtool],\n            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],\n    dnl If the libtool generation code is destined for config.status,\n    dnl expand the accumulated commands and init code now:\n    [AC_CONFIG_COMMANDS([libtool],\n        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])\n])#_LT_CONFIG_COMMANDS\n\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],\n[\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nsed_quote_subst='$sed_quote_subst'\ndouble_quote_subst='$double_quote_subst'\ndelay_variable_subst='$delay_variable_subst'\n_LT_CONFIG_STATUS_DECLARATIONS\nLTCC='$LTCC'\nLTCFLAGS='$LTCFLAGS'\ncompiler='$compiler_DEFAULT'\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n\\$[]1\n_LTECHO_EOF'\n}\n\n# Quote evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_quote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED \\\\\"\\\\\\$sed_quote_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Double-quote double-evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_dquote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED -e \\\\\"\\\\\\$double_quote_subst\\\\\" -e \\\\\"\\\\\\$sed_quote_subst\\\\\" -e \\\\\"\\\\\\$delay_variable_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n_LT_OUTPUT_LIBTOOL_INIT\n])\n\n# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])\n# ------------------------------------\n# Generate a child script FILE with all initialization necessary to\n# reuse the environment learned by the parent script, and make the\n# file executable.  If COMMENT is supplied, it is inserted after the\n# `#!' sequence but before initialization text begins.  After this\n# macro, additional text can be appended to FILE to form the body of\n# the child script.  The macro ends with non-zero status if the\n# file could not be fully written (such as if the disk is full).\nm4_ifdef([AS_INIT_GENERATED],\n[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],\n[m4_defun([_LT_GENERATED_FILE_INIT],\n[m4_require([AS_PREPARE])]dnl\n[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl\n[lt_write_fail=0\ncat >$1 <<_ASEOF || lt_write_fail=1\n#! $SHELL\n# Generated by $as_me.\n$2\nSHELL=\\${CONFIG_SHELL-$SHELL}\nexport SHELL\n_ASEOF\ncat >>$1 <<\\_ASEOF || lt_write_fail=1\nAS_SHELL_SANITIZE\n_AS_PREPARE\nexec AS_MESSAGE_FD>&1\n_ASEOF\ntest $lt_write_fail = 0 && chmod +x $1[]dnl\nm4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT\n\n# LT_OUTPUT\n# ---------\n# This macro allows early generation of the libtool script (before\n# AC_OUTPUT is called), incase it is used in configure for compilation\n# tests.\nAC_DEFUN([LT_OUTPUT],\n[: ${CONFIG_LT=./config.lt}\nAC_MSG_NOTICE([creating $CONFIG_LT])\n_LT_GENERATED_FILE_INIT([\"$CONFIG_LT\"],\n[# Run this file to recreate a libtool stub with the current configuration.])\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nlt_cl_silent=false\nexec AS_MESSAGE_LOG_FD>>config.log\n{\n  echo\n  AS_BOX([Running $as_me.])\n} >&AS_MESSAGE_LOG_FD\n\nlt_cl_help=\"\\\n\\`$as_me' creates a local libtool stub from the current configuration,\nfor use in further configure time tests before the real libtool is\ngenerated.\n\nUsage: $[0] [[OPTIONS]]\n\n  -h, --help      print this help, then exit\n  -V, --version   print version number, then exit\n  -q, --quiet     do not print progress messages\n  -d, --debug     don't remove temporary files\n\nReport bugs to <bug-libtool@gnu.org>.\"\n\nlt_cl_version=\"\\\nm4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl\nm4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])\nconfigured by $[0], generated by m4_PACKAGE_STRING.\n\nCopyright (C) 2011 Free Software Foundation, Inc.\nThis config.lt script is free software; the Free Software Foundation\ngives unlimited permision to copy, distribute and modify it.\"\n\nwhile test $[#] != 0\ndo\n  case $[1] in\n    --version | --v* | -V )\n      echo \"$lt_cl_version\"; exit 0 ;;\n    --help | --h* | -h )\n      echo \"$lt_cl_help\"; exit 0 ;;\n    --debug | --d* | -d )\n      debug=: ;;\n    --quiet | --q* | --silent | --s* | -q )\n      lt_cl_silent=: ;;\n\n    -*) AC_MSG_ERROR([unrecognized option: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n\n    *) AC_MSG_ERROR([unrecognized argument: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n  esac\n  shift\ndone\n\nif $lt_cl_silent; then\n  exec AS_MESSAGE_FD>/dev/null\nfi\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<_LTEOF\n_LT_OUTPUT_LIBTOOL_COMMANDS_INIT\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nAC_MSG_NOTICE([creating $ofile])\n_LT_OUTPUT_LIBTOOL_COMMANDS\nAS_EXIT(0)\n_LTEOF\nchmod +x \"$CONFIG_LT\"\n\n# configure is writing to config.log, but config.lt does its own redirection,\n# appending to config.log, which fails on DOS, as config.log is still kept\n# open by configure.  Here we exec the FD to /dev/null, effectively closing\n# config.log, so it can be properly (re)opened and appended to by config.lt.\nlt_cl_success=:\ntest \"$silent\" = yes &&\n  lt_config_lt_args=\"$lt_config_lt_args --quiet\"\nexec AS_MESSAGE_LOG_FD>/dev/null\n$SHELL \"$CONFIG_LT\" $lt_config_lt_args || lt_cl_success=false\nexec AS_MESSAGE_LOG_FD>>config.log\n$lt_cl_success || AS_EXIT(1)\n])# LT_OUTPUT\n\n\n# _LT_CONFIG(TAG)\n# ---------------\n# If TAG is the built-in tag, create an initial libtool script with a\n# default configuration from the untagged config vars.  Otherwise add code\n# to config.status for appending the configuration named by TAG from the\n# matching tagged config vars.\nm4_defun([_LT_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_CONFIG_SAVE_COMMANDS([\n  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl\n  m4_if(_LT_TAG, [C], [\n    # See if we are running on zsh, and set the options which allow our\n    # commands through without removal of \\ escapes.\n    if test -n \"${ZSH_VERSION+set}\" ; then\n      setopt NO_GLOB_SUBST\n    fi\n\n    cfgfile=\"${ofile}T\"\n    trap \"$RM \\\"$cfgfile\\\"; exit 1\" 1 2 15\n    $RM \"$cfgfile\"\n\n    cat <<_LT_EOF >> \"$cfgfile\"\n#! $SHELL\n\n# `$ECHO \"$ofile\" | sed 's%^.*/%%'` - Provide generalized library-building support services.\n# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION\n# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:\n# NOTE: Changes made to this file will be lost: look at ltmain.sh.\n#\n_LT_COPYING\n_LT_LIBTOOL_TAGS\n\n# ### BEGIN LIBTOOL CONFIG\n_LT_LIBTOOL_CONFIG_VARS\n_LT_LIBTOOL_TAG_VARS\n# ### END LIBTOOL CONFIG\n\n_LT_EOF\n\n  case $host_os in\n  aix3*)\n    cat <<\\_LT_EOF >> \"$cfgfile\"\n# AIX sometimes has problems with the GCC collect2 program.  For some\n# reason, if we set the COLLECT_NAMES environment variable, the problems\n# vanish in a puff of smoke.\nif test \"X${COLLECT_NAMES+set}\" != Xset; then\n  COLLECT_NAMES=\n  export COLLECT_NAMES\nfi\n_LT_EOF\n    ;;\n  esac\n\n  _LT_PROG_LTMAIN\n\n  # We use sed instead of cat because bash on DJGPP gets confused if\n  # if finds mixed CR/LF and LF-only lines.  Since sed operates in\n  # text mode, it properly converts lines to CR/LF.  This bash problem\n  # is reportedly fixed, but why not run on old versions too?\n  sed '$q' \"$ltmain\" >> \"$cfgfile\" \\\n     || (rm -f \"$cfgfile\"; exit 1)\n\n  _LT_PROG_REPLACE_SHELLFNS\n\n   mv -f \"$cfgfile\" \"$ofile\" ||\n    (rm -f \"$ofile\" && cp \"$cfgfile\" \"$ofile\" && rm -f \"$cfgfile\")\n  chmod +x \"$ofile\"\n],\n[cat <<_LT_EOF >> \"$ofile\"\n\ndnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded\ndnl in a comment (ie after a #).\n# ### BEGIN LIBTOOL TAG CONFIG: $1\n_LT_LIBTOOL_TAG_VARS(_LT_TAG)\n# ### END LIBTOOL TAG CONFIG: $1\n_LT_EOF\n])dnl /m4_if\n],\n[m4_if([$1], [], [\n    PACKAGE='$PACKAGE'\n    VERSION='$VERSION'\n    TIMESTAMP='$TIMESTAMP'\n    RM='$RM'\n    ofile='$ofile'], [])\n])dnl /_LT_CONFIG_SAVE_COMMANDS\n])# _LT_CONFIG\n\n\n# LT_SUPPORTED_TAG(TAG)\n# ---------------------\n# Trace this macro to discover what tags are supported by the libtool\n# --tag option, using:\n#    autoconf --trace 'LT_SUPPORTED_TAG:$1'\nAC_DEFUN([LT_SUPPORTED_TAG], [])\n\n\n# C support is built-in for now\nm4_define([_LT_LANG_C_enabled], [])\nm4_define([_LT_TAGS], [])\n\n\n# LT_LANG(LANG)\n# -------------\n# Enable libtool support for the given language if not already enabled.\nAC_DEFUN([LT_LANG],\n[AC_BEFORE([$0], [LT_OUTPUT])dnl\nm4_case([$1],\n  [C],\t\t\t[_LT_LANG(C)],\n  [C++],\t\t[_LT_LANG(CXX)],\n  [Go],\t\t\t[_LT_LANG(GO)],\n  [Java],\t\t[_LT_LANG(GCJ)],\n  [Fortran 77],\t\t[_LT_LANG(F77)],\n  [Fortran],\t\t[_LT_LANG(FC)],\n  [Windows Resource],\t[_LT_LANG(RC)],\n  [m4_ifdef([_LT_LANG_]$1[_CONFIG],\n    [_LT_LANG($1)],\n    [m4_fatal([$0: unsupported language: \"$1\"])])])dnl\n])# LT_LANG\n\n\n# _LT_LANG(LANGNAME)\n# ------------------\nm4_defun([_LT_LANG],\n[m4_ifdef([_LT_LANG_]$1[_enabled], [],\n  [LT_SUPPORTED_TAG([$1])dnl\n  m4_append([_LT_TAGS], [$1 ])dnl\n  m4_define([_LT_LANG_]$1[_enabled], [])dnl\n  _LT_LANG_$1_CONFIG($1)])dnl\n])# _LT_LANG\n\n\nm4_ifndef([AC_PROG_GO], [\n############################################################\n# NOTE: This macro has been submitted for inclusion into   #\n#  GNU Autoconf as AC_PROG_GO.  When it is available in    #\n#  a released version of Autoconf we should remove this    #\n#  macro and use it instead.                               #\n############################################################\nm4_defun([AC_PROG_GO],\n[AC_LANG_PUSH(Go)dnl\nAC_ARG_VAR([GOC],     [Go compiler command])dnl\nAC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl\n_AC_ARG_VAR_LDFLAGS()dnl\nAC_CHECK_TOOL(GOC, gccgo)\nif test -z \"$GOC\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])\n  fi\nfi\nif test -z \"$GOC\"; then\n  AC_CHECK_PROG(GOC, gccgo, gccgo, false)\nfi\n])#m4_defun\n])#m4_ifndef\n\n\n# _LT_LANG_DEFAULT_CONFIG\n# -----------------------\nm4_defun([_LT_LANG_DEFAULT_CONFIG],\n[AC_PROVIDE_IFELSE([AC_PROG_CXX],\n  [LT_LANG(CXX)],\n  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_F77],\n  [LT_LANG(F77)],\n  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_FC],\n  [LT_LANG(FC)],\n  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])\n\ndnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal\ndnl pulling things in needlessly.\nAC_PROVIDE_IFELSE([AC_PROG_GCJ],\n  [LT_LANG(GCJ)],\n  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],\n    [LT_LANG(GCJ)],\n    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],\n      [LT_LANG(GCJ)],\n      [m4_ifdef([AC_PROG_GCJ],\n\t[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([A][M_PROG_GCJ],\n\t[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([LT_PROG_GCJ],\n\t[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])\n\nAC_PROVIDE_IFELSE([AC_PROG_GO],\n  [LT_LANG(GO)],\n  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])\n\nAC_PROVIDE_IFELSE([LT_PROG_RC],\n  [LT_LANG(RC)],\n  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])\n])# _LT_LANG_DEFAULT_CONFIG\n\n# Obsolete macros:\nAU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])\nAU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])\nAU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])\nAU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])\nAU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_CXX], [])\ndnl AC_DEFUN([AC_LIBTOOL_F77], [])\ndnl AC_DEFUN([AC_LIBTOOL_FC], [])\ndnl AC_DEFUN([AC_LIBTOOL_GCJ], [])\ndnl AC_DEFUN([AC_LIBTOOL_RC], [])\n\n\n# _LT_TAG_COMPILER\n# ----------------\nm4_defun([_LT_TAG_COMPILER],\n[AC_REQUIRE([AC_PROG_CC])dnl\n\n_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl\n_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl\n_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl\n_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n])# _LT_TAG_COMPILER\n\n\n# _LT_COMPILER_BOILERPLATE\n# ------------------------\n# Check for compiler boilerplate output or warnings with\n# the simple compiler test code.\nm4_defun([_LT_COMPILER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n])# _LT_COMPILER_BOILERPLATE\n\n\n# _LT_LINKER_BOILERPLATE\n# ----------------------\n# Check for linker boilerplate output or warnings with\n# the simple link test code.\nm4_defun([_LT_LINKER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n])# _LT_LINKER_BOILERPLATE\n\n# _LT_REQUIRED_DARWIN_CHECKS\n# -------------------------\nm4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[\n  case $host_os in\n    rhapsody* | darwin*)\n    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])\n    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])\n    AC_CHECK_TOOL([LIPO], [lipo], [:])\n    AC_CHECK_TOOL([OTOOL], [otool], [:])\n    AC_CHECK_TOOL([OTOOL64], [otool64], [:])\n    _LT_DECL([], [DSYMUTIL], [1],\n      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])\n    _LT_DECL([], [NMEDIT], [1],\n      [Tool to change global to local symbols on Mac OS X])\n    _LT_DECL([], [LIPO], [1],\n      [Tool to manipulate fat objects and archives on Mac OS X])\n    _LT_DECL([], [OTOOL], [1],\n      [ldd/readelf like tool for Mach-O binaries on Mac OS X])\n    _LT_DECL([], [OTOOL64], [1],\n      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])\n\n    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],\n      [lt_cv_apple_cc_single_mod=no\n      if test -z \"${LT_MULTI_MODULE}\"; then\n\t# By default we will add the -single_module flag. You can override\n\t# by either setting the environment variable LT_MULTI_MODULE\n\t# non-empty at configure time, or by adding -multi_module to the\n\t# link flags.\n\trm -rf libconftest.dylib*\n\techo \"int foo(void){return 1;}\" > conftest.c\n\techo \"$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n-dynamiclib -Wl,-single_module conftest.c\" >&AS_MESSAGE_LOG_FD\n\t$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n\t  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err\n        _lt_result=$?\n\t# If there is a non-empty error log, and \"single_module\"\n\t# appears in it, assume the flag caused a linker warning\n        if test -s conftest.err && $GREP single_module conftest.err; then\n\t  cat conftest.err >&AS_MESSAGE_LOG_FD\n\t# Otherwise, if the output was created with a 0 exit code from\n\t# the compiler, it worked.\n\telif test -f libconftest.dylib && test $_lt_result -eq 0; then\n\t  lt_cv_apple_cc_single_mod=yes\n\telse\n\t  cat conftest.err >&AS_MESSAGE_LOG_FD\n\tfi\n\trm -rf libconftest.dylib*\n\trm -f conftest.*\n      fi])\n\n    AC_CACHE_CHECK([for -exported_symbols_list linker flag],\n      [lt_cv_ld_exported_symbols_list],\n      [lt_cv_ld_exported_symbols_list=no\n      save_LDFLAGS=$LDFLAGS\n      echo \"_main\" > conftest.sym\n      LDFLAGS=\"$LDFLAGS -Wl,-exported_symbols_list,conftest.sym\"\n      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n\t[lt_cv_ld_exported_symbols_list=yes],\n\t[lt_cv_ld_exported_symbols_list=no])\n\tLDFLAGS=\"$save_LDFLAGS\"\n    ])\n\n    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],\n      [lt_cv_ld_force_load=no\n      cat > conftest.c << _LT_EOF\nint forced_loaded() { return 2;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS -c -o conftest.o conftest.c\" >&AS_MESSAGE_LOG_FD\n      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD\n      echo \"$AR cru libconftest.a conftest.o\" >&AS_MESSAGE_LOG_FD\n      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD\n      echo \"$RANLIB libconftest.a\" >&AS_MESSAGE_LOG_FD\n      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD\n      cat > conftest.c << _LT_EOF\nint main() { return 0;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a\" >&AS_MESSAGE_LOG_FD\n      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err\n      _lt_result=$?\n      if test -s conftest.err && $GREP force_load conftest.err; then\n\tcat conftest.err >&AS_MESSAGE_LOG_FD\n      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then\n\tlt_cv_ld_force_load=yes\n      else\n\tcat conftest.err >&AS_MESSAGE_LOG_FD\n      fi\n        rm -f conftest.err libconftest.a conftest conftest.c\n        rm -rf conftest.dSYM\n    ])\n    case $host_os in\n    rhapsody* | darwin1.[[012]])\n      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;\n    darwin1.*)\n      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n    darwin*) # darwin 5.x on\n      # if running on 10.5 or later, the deployment target defaults\n      # to the OS version, if on x86, and 10.4, the deployment\n      # target defaults to 10.4. Don't you love it?\n      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in\n\t10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n\t10.[[012]]*)\n\t  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n\t10.*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n      esac\n    ;;\n  esac\n    if test \"$lt_cv_apple_cc_single_mod\" = \"yes\"; then\n      _lt_dar_single_mod='$single_module'\n    fi\n    if test \"$lt_cv_ld_exported_symbols_list\" = \"yes\"; then\n      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'\n    else\n      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'\n    fi\n    if test \"$DSYMUTIL\" != \":\" && test \"$lt_cv_ld_force_load\" = \"no\"; then\n      _lt_dsymutil='~$DSYMUTIL $lib || :'\n    else\n      _lt_dsymutil=\n    fi\n    ;;\n  esac\n])\n\n\n# _LT_DARWIN_LINKER_FEATURES([TAG])\n# ---------------------------------\n# Checks for linker and compiler features on darwin\nm4_defun([_LT_DARWIN_LINKER_FEATURES],\n[\n  m4_require([_LT_REQUIRED_DARWIN_CHECKS])\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_automatic, $1)=yes\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  if test \"$lt_cv_ld_force_load\" = \"yes\"; then\n    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience ${wl}-force_load,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"`'\n    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],\n                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])\n  else\n    _LT_TAGVAR(whole_archive_flag_spec, $1)=''\n  fi\n  _LT_TAGVAR(link_all_deplibs, $1)=yes\n  _LT_TAGVAR(allow_undefined_flag, $1)=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=func_echo_all\n    _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    _LT_TAGVAR(module_cmds, $1)=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    _LT_TAGVAR(module_expsym_cmds, $1)=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n    m4_if([$1], [CXX],\n[   if test \"$lt_cv_apple_cc_single_mod\" != \"yes\"; then\n      _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dsymutil}\"\n      _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dar_export_syms}${_lt_dsymutil}\"\n    fi\n],[])\n  else\n  _LT_TAGVAR(ld_shlibs, $1)=no\n  fi\n])\n\n# _LT_SYS_MODULE_PATH_AIX([TAGNAME])\n# ----------------------------------\n# Links a minimal program and checks the executable\n# for the system default hardcoded library path. In most cases,\n# this is /usr/lib:/lib, but when the MPI compilers are used\n# the location of the communication and MPI libs are included too.\n# If we don't find anything, use the default library path according\n# to the aix ld manual.\n# Store the results from the different compilers for each TAGNAME.\n# Allow to override them for all tags through lt_cv_aix_libpath.\nm4_defun([_LT_SYS_MODULE_PATH_AIX],\n[m4_require([_LT_DECL_SED])dnl\nif test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],\n  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[\n  lt_aix_libpath_sed='[\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }]'\n  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\"; then\n    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi],[])\n  if test -z \"$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\"; then\n    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=\"/usr/lib:/lib\"\n  fi\n  ])\n  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\nfi\n])# _LT_SYS_MODULE_PATH_AIX\n\n\n# _LT_SHELL_INIT(ARG)\n# -------------------\nm4_define([_LT_SHELL_INIT],\n[m4_divert_text([M4SH-INIT], [$1\n])])# _LT_SHELL_INIT\n\n\n\n# _LT_PROG_ECHO_BACKSLASH\n# -----------------------\n# Find how we can fake an echo command that does not interpret backslash.\n# In particular, with Autoconf 2.60 or later we add some code to the start\n# of the generated configure script which will find a shell with a builtin\n# printf (which we can use as an echo command).\nm4_defun([_LT_PROG_ECHO_BACKSLASH],\n[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n\nAC_MSG_CHECKING([how to print strings])\n# Test print first, because it will be a builtin if present.\nif test \"X`( print -r -- -n ) 2>/dev/null`\" = X-n && \\\n   test \"X`print -r -- $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='print -r --'\nelif test \"X`printf %s $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='printf %s\\n'\nelse\n  # Use this function as a fallback that always works.\n  func_fallback_echo ()\n  {\n    eval 'cat <<_LTECHO_EOF\n$[]1\n_LTECHO_EOF'\n  }\n  ECHO='func_fallback_echo'\nfi\n\n# func_echo_all arg...\n# Invoke $ECHO with all args, space-separated.\nfunc_echo_all ()\n{\n    $ECHO \"$*\" \n}\n\ncase \"$ECHO\" in\n  printf*) AC_MSG_RESULT([printf]) ;;\n  print*) AC_MSG_RESULT([print -r]) ;;\n  *) AC_MSG_RESULT([cat]) ;;\nesac\n\nm4_ifdef([_AS_DETECT_SUGGESTED],\n[_AS_DETECT_SUGGESTED([\n  test -n \"${ZSH_VERSION+set}${BASH_VERSION+set}\" || (\n    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\n    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\n    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n    PATH=/empty FPATH=/empty; export PATH FPATH\n    test \"X`printf %s $ECHO`\" = \"X$ECHO\" \\\n      || test \"X`print -r -- $ECHO`\" = \"X$ECHO\" )])])\n\n_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])\n_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])\n])# _LT_PROG_ECHO_BACKSLASH\n\n\n# _LT_WITH_SYSROOT\n# ----------------\nAC_DEFUN([_LT_WITH_SYSROOT],\n[AC_MSG_CHECKING([for sysroot])\nAC_ARG_WITH([sysroot],\n[  --with-sysroot[=DIR] Search for dependent libraries within DIR\n                        (or the compiler's sysroot if not specified).],\n[], [with_sysroot=no])\n\ndnl lt_sysroot will always be passed unquoted.  We quote it here\ndnl in case the user passed a directory name.\nlt_sysroot=\ncase ${with_sysroot} in #(\n yes)\n   if test \"$GCC\" = yes; then\n     lt_sysroot=`$CC --print-sysroot 2>/dev/null`\n   fi\n   ;; #(\n /*)\n   lt_sysroot=`echo \"$with_sysroot\" | sed -e \"$sed_quote_subst\"`\n   ;; #(\n no|'')\n   ;; #(\n *)\n   AC_MSG_RESULT([${with_sysroot}])\n   AC_MSG_ERROR([The sysroot must be an absolute path.])\n   ;;\nesac\n\n AC_MSG_RESULT([${lt_sysroot:-no}])\n_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl\n[dependent libraries, and in which our libraries should be installed.])])\n\n# _LT_ENABLE_LOCK\n# ---------------\nm4_defun([_LT_ENABLE_LOCK],\n[AC_ARG_ENABLE([libtool-lock],\n  [AS_HELP_STRING([--disable-libtool-lock],\n    [avoid locking (might break parallel builds)])])\ntest \"x$enable_libtool_lock\" != xno && enable_libtool_lock=yes\n\n# Some flags need to be propagated to the compiler or linker for good\n# libtool support.\ncase $host in\nia64-*-hpux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.$ac_objext` in\n      *ELF-32*)\n\tHPUX_IA64_MODE=\"32\"\n\t;;\n      *ELF-64*)\n\tHPUX_IA64_MODE=\"64\"\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n*-*-irix6*)\n  # Find out which ABI we are using.\n  echo '[#]line '$LINENO' \"configure\"' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    if test \"$lt_cv_prog_gnu_ld\" = yes; then\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -melf32bsmip\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -melf32bmipn32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -melf64bmip\"\n\t;;\n      esac\n    else\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -32\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -n32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -64\"\n\t  ;;\n      esac\n    fi\n  fi\n  rm -rf conftest*\n  ;;\n\nx86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \\\ns390*-*linux*|s390*-*tpf*|sparc*-*linux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n      *32-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_i386_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_i386\"\n\t    ;;\n\t  ppc64-*linux*|powerpc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32ppclinux\"\n\t    ;;\n\t  s390x-*linux*)\n\t    LD=\"${LD-ld} -m elf_s390\"\n\t    ;;\n\t  sparc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32_sparc\"\n\t    ;;\n\tesac\n\t;;\n      *64-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_x86_64_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_x86_64\"\n\t    ;;\n\t  ppc*-*linux*|powerpc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64ppc\"\n\t    ;;\n\t  s390*-*linux*|s390*-*tpf*)\n\t    LD=\"${LD-ld} -m elf64_s390\"\n\t    ;;\n\t  sparc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64_sparc\"\n\t    ;;\n\tesac\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n\n*-*-sco3.2v5*)\n  # On SCO OpenServer 5, we need -belf to get full-featured binaries.\n  SAVE_CFLAGS=\"$CFLAGS\"\n  CFLAGS=\"$CFLAGS -belf\"\n  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,\n    [AC_LANG_PUSH(C)\n     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])\n     AC_LANG_POP])\n  if test x\"$lt_cv_cc_needs_belf\" != x\"yes\"; then\n    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf\n    CFLAGS=\"$SAVE_CFLAGS\"\n  fi\n  ;;\n*-*solaris*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n    *64-bit*)\n      case $lt_cv_prog_gnu_ld in\n      yes*)\n        case $host in\n        i?86-*-solaris*)\n          LD=\"${LD-ld} -m elf_x86_64\"\n          ;;\n        sparc*-*-solaris*)\n          LD=\"${LD-ld} -m elf64_sparc\"\n          ;;\n        esac\n        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.\n        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then\n          LD=\"${LD-ld}_sol2\"\n        fi\n        ;;\n      *)\n\tif ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then\n\t  LD=\"${LD-ld} -64\"\n\tfi\n\t;;\n      esac\n      ;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\nesac\n\nneed_locks=\"$enable_libtool_lock\"\n])# _LT_ENABLE_LOCK\n\n\n# _LT_PROG_AR\n# -----------\nm4_defun([_LT_PROG_AR],\n[AC_CHECK_TOOLS(AR, [ar], false)\n: ${AR=ar}\n: ${AR_FLAGS=cru}\n_LT_DECL([], [AR], [1], [The archiver])\n_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])\n\nAC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],\n  [lt_cv_ar_at_file=no\n   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],\n     [echo conftest.$ac_objext > conftest.lst\n      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'\n      AC_TRY_EVAL([lt_ar_try])\n      if test \"$ac_status\" -eq 0; then\n\t# Ensure the archiver fails upon bogus file names.\n\trm -f conftest.$ac_objext libconftest.a\n\tAC_TRY_EVAL([lt_ar_try])\n\tif test \"$ac_status\" -ne 0; then\n          lt_cv_ar_at_file=@\n        fi\n      fi\n      rm -f conftest.* libconftest.a\n     ])\n  ])\n\nif test \"x$lt_cv_ar_at_file\" = xno; then\n  archiver_list_spec=\nelse\n  archiver_list_spec=$lt_cv_ar_at_file\nfi\n_LT_DECL([], [archiver_list_spec], [1],\n  [How to feed a file listing to the archiver])\n])# _LT_PROG_AR\n\n\n# _LT_CMD_OLD_ARCHIVE\n# -------------------\nm4_defun([_LT_CMD_OLD_ARCHIVE],\n[_LT_PROG_AR\n\nAC_CHECK_TOOL(STRIP, strip, :)\ntest -z \"$STRIP\" && STRIP=:\n_LT_DECL([], [STRIP], [1], [A symbol stripping program])\n\nAC_CHECK_TOOL(RANLIB, ranlib, :)\ntest -z \"$RANLIB\" && RANLIB=:\n_LT_DECL([], [RANLIB], [1],\n    [Commands used to install an old-style archive])\n\n# Determine commands to create old-style static archives.\nold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'\nold_postinstall_cmds='chmod 644 $oldlib'\nold_postuninstall_cmds=\n\nif test -n \"$RANLIB\"; then\n  case $host_os in\n  openbsd*)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB -t \\$tool_oldlib\"\n    ;;\n  *)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB \\$tool_oldlib\"\n    ;;\n  esac\n  old_archive_cmds=\"$old_archive_cmds~\\$RANLIB \\$tool_oldlib\"\nfi\n\ncase $host_os in\n  darwin*)\n    lock_old_archive_extraction=yes ;;\n  *)\n    lock_old_archive_extraction=no ;;\nesac\n_LT_DECL([], [old_postinstall_cmds], [2])\n_LT_DECL([], [old_postuninstall_cmds], [2])\n_LT_TAGDECL([], [old_archive_cmds], [2],\n    [Commands used to build an old-style archive])\n_LT_DECL([], [lock_old_archive_extraction], [0],\n    [Whether to use a lock for old archive extraction])\n])# _LT_CMD_OLD_ARCHIVE\n\n\n# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#\t\t[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------------------\n# Check whether the given compiler option works\nAC_DEFUN([_LT_COMPILER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$3\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       $2=yes\n     fi\n   fi\n   $RM conftest*\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$5], , :, [$5])\nelse\n    m4_if([$6], , :, [$6])\nfi\n])# _LT_COMPILER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])\n\n\n# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#                  [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------\n# Check whether the given linker option works\nAC_DEFUN([_LT_LINKER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $3\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&AS_MESSAGE_LOG_FD\n       $ECHO \"$_lt_linker_boilerplate\" | $SED '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         $2=yes\n       fi\n     else\n       $2=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$4], , :, [$4])\nelse\n    m4_if([$5], , :, [$5])\nfi\n])# _LT_LINKER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])\n\n\n# LT_CMD_MAX_LEN\n#---------------\nAC_DEFUN([LT_CMD_MAX_LEN],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n# find the maximum length of command line arguments\nAC_MSG_CHECKING([the maximum length of command line arguments])\nAC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl\n  i=0\n  teststring=\"ABCD\"\n\n  case $build_os in\n  msdosdjgpp*)\n    # On DJGPP, this test can blow up pretty badly due to problems in libc\n    # (any single argument exceeding 2000 bytes causes a buffer overrun\n    # during glob expansion).  Even if it were fixed, the result of this\n    # check would be larger than it should be.\n    lt_cv_sys_max_cmd_len=12288;    # 12K is about right\n    ;;\n\n  gnu*)\n    # Under GNU Hurd, this test is not required because there is\n    # no limit to the length of command line arguments.\n    # Libtool will interpret -1 as no limit whatsoever\n    lt_cv_sys_max_cmd_len=-1;\n    ;;\n\n  cygwin* | mingw* | cegcc*)\n    # On Win9x/ME, this test blows up -- it succeeds, but takes\n    # about 5 minutes as the teststring grows exponentially.\n    # Worse, since 9x/ME are not pre-emptively multitasking,\n    # you end up with a \"frozen\" computer, even though with patience\n    # the test eventually succeeds (with a max line length of 256k).\n    # Instead, let's just punt: use the minimum linelength reported by\n    # all of the supported platforms: 8192 (on NT/2K/XP).\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  mint*)\n    # On MiNT this can take a long time and run out of memory.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  amigaos*)\n    # On AmigaOS with pdksh, this test takes hours, literally.\n    # So we just punt and use a minimum line length of 8192.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)\n    # This has been around since 386BSD, at least.  Likely further.\n    if test -x /sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`\n    elif test -x /usr/sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`\n    else\n      lt_cv_sys_max_cmd_len=65536\t# usable default for all BSDs\n    fi\n    # And add a safety zone\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    ;;\n\n  interix*)\n    # We know the value 262144 and hardcode it with a safety zone (like BSD)\n    lt_cv_sys_max_cmd_len=196608\n    ;;\n\n  os2*)\n    # The test takes a long time on OS/2.\n    lt_cv_sys_max_cmd_len=8192\n    ;;\n\n  osf*)\n    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure\n    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not\n    # nice to cause kernel panics so lets avoid the loop below.\n    # First set a reasonable default.\n    lt_cv_sys_max_cmd_len=16384\n    #\n    if test -x /sbin/sysconfig; then\n      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in\n        *1*) lt_cv_sys_max_cmd_len=-1 ;;\n      esac\n    fi\n    ;;\n  sco3.2v5*)\n    lt_cv_sys_max_cmd_len=102400\n    ;;\n  sysv5* | sco5v6* | sysv4.2uw2*)\n    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`\n    if test -n \"$kargmax\"; then\n      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[\t ]]//'`\n    else\n      lt_cv_sys_max_cmd_len=32768\n    fi\n    ;;\n  *)\n    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`\n    if test -n \"$lt_cv_sys_max_cmd_len\"; then\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    else\n      # Make teststring a little bigger before we do anything with it.\n      # a 1K string should be a reasonable start.\n      for i in 1 2 3 4 5 6 7 8 ; do\n        teststring=$teststring$teststring\n      done\n      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}\n      # If test is not a shell built-in, we'll probably end up computing a\n      # maximum length that is only half of the actual maximum length, but\n      # we can't tell.\n      while { test \"X\"`env echo \"$teststring$teststring\" 2>/dev/null` \\\n\t         = \"X$teststring$teststring\"; } >/dev/null 2>&1 &&\n\t      test $i != 17 # 1/2 MB should be enough\n      do\n        i=`expr $i + 1`\n        teststring=$teststring$teststring\n      done\n      # Only check the string length outside the loop.\n      lt_cv_sys_max_cmd_len=`expr \"X$teststring\" : \".*\" 2>&1`\n      teststring=\n      # Add a significant safety factor because C++ compilers can tack on\n      # massive amounts of additional arguments before passing them to the\n      # linker.  It appears as though 1/2 is a usable value.\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 2`\n    fi\n    ;;\n  esac\n])\nif test -n $lt_cv_sys_max_cmd_len ; then\n  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)\nelse\n  AC_MSG_RESULT(none)\nfi\nmax_cmd_len=$lt_cv_sys_max_cmd_len\n_LT_DECL([], [max_cmd_len], [0],\n    [What is the maximum length of a command?])\n])# LT_CMD_MAX_LEN\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])\n\n\n# _LT_HEADER_DLFCN\n# ----------------\nm4_defun([_LT_HEADER_DLFCN],\n[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl\n])# _LT_HEADER_DLFCN\n\n\n# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,\n#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)\n# ----------------------------------------------------------------\nm4_defun([_LT_TRY_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"$cross_compiling\" = yes; then :\n  [$4]\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n[#line $LINENO \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\n/* When -fvisbility=hidden is used, assume the code has been annotated\n   correspondingly for the symbols needed.  */\n#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))\nint fnord () __attribute__((visibility(\"default\")));\n#endif\n\nint fnord () { return 42; }\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else\n        {\n\t  if (dlsym( self,\"_fnord\"))  status = $lt_dlneed_uscore;\n          else puts (dlerror ());\n\t}\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}]\n_LT_EOF\n  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) $1 ;;\n      x$lt_dlneed_uscore) $2 ;;\n      x$lt_dlunknown|x*) $3 ;;\n    esac\n  else :\n    # compilation failed\n    $3\n  fi\nfi\nrm -fr conftest*\n])# _LT_TRY_DLOPEN_SELF\n\n\n# LT_SYS_DLOPEN_SELF\n# ------------------\nAC_DEFUN([LT_SYS_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"x$enable_dlopen\" != xyes; then\n  enable_dlopen=unknown\n  enable_dlopen_self=unknown\n  enable_dlopen_self_static=unknown\nelse\n  lt_cv_dlopen=no\n  lt_cv_dlopen_libs=\n\n  case $host_os in\n  beos*)\n    lt_cv_dlopen=\"load_add_on\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ;;\n\n  mingw* | pw32* | cegcc*)\n    lt_cv_dlopen=\"LoadLibrary\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  cygwin*)\n    lt_cv_dlopen=\"dlopen\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  darwin*)\n  # if libdl is installed we need to link against it\n    AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],[\n    lt_cv_dlopen=\"dyld\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ])\n    ;;\n\n  *)\n    AC_CHECK_FUNC([shl_load],\n\t  [lt_cv_dlopen=\"shl_load\"],\n      [AC_CHECK_LIB([dld], [shl_load],\n\t    [lt_cv_dlopen=\"shl_load\" lt_cv_dlopen_libs=\"-ldld\"],\n\t[AC_CHECK_FUNC([dlopen],\n\t      [lt_cv_dlopen=\"dlopen\"],\n\t  [AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],\n\t    [AC_CHECK_LIB([svld], [dlopen],\n\t\t  [lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-lsvld\"],\n\t      [AC_CHECK_LIB([dld], [dld_link],\n\t\t    [lt_cv_dlopen=\"dld_link\" lt_cv_dlopen_libs=\"-ldld\"])\n\t      ])\n\t    ])\n\t  ])\n\t])\n      ])\n    ;;\n  esac\n\n  if test \"x$lt_cv_dlopen\" != xno; then\n    enable_dlopen=yes\n  else\n    enable_dlopen=no\n  fi\n\n  case $lt_cv_dlopen in\n  dlopen)\n    save_CPPFLAGS=\"$CPPFLAGS\"\n    test \"x$ac_cv_header_dlfcn_h\" = xyes && CPPFLAGS=\"$CPPFLAGS -DHAVE_DLFCN_H\"\n\n    save_LDFLAGS=\"$LDFLAGS\"\n    wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $export_dynamic_flag_spec\\\"\n\n    save_LIBS=\"$LIBS\"\n    LIBS=\"$lt_cv_dlopen_libs $LIBS\"\n\n    AC_CACHE_CHECK([whether a program can dlopen itself],\n\t  lt_cv_dlopen_self, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,\n\t    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)\n    ])\n\n    if test \"x$lt_cv_dlopen_self\" = xyes; then\n      wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $lt_prog_compiler_static\\\"\n      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],\n\t  lt_cv_dlopen_self_static, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,\n\t    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)\n      ])\n    fi\n\n    CPPFLAGS=\"$save_CPPFLAGS\"\n    LDFLAGS=\"$save_LDFLAGS\"\n    LIBS=\"$save_LIBS\"\n    ;;\n  esac\n\n  case $lt_cv_dlopen_self in\n  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;\n  *) enable_dlopen_self=unknown ;;\n  esac\n\n  case $lt_cv_dlopen_self_static in\n  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;\n  *) enable_dlopen_self_static=unknown ;;\n  esac\nfi\n_LT_DECL([dlopen_support], [enable_dlopen], [0],\n\t [Whether dlopen is supported])\n_LT_DECL([dlopen_self], [enable_dlopen_self], [0],\n\t [Whether dlopen of programs is supported])\n_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],\n\t [Whether dlopen of statically linked programs is supported])\n])# LT_SYS_DLOPEN_SELF\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])\n\n\n# _LT_COMPILER_C_O([TAGNAME])\n# ---------------------------\n# Check to see if options -c and -o are simultaneously supported by compiler.\n# This macro does not hard code the compiler like AC_PROG_CC_C_O.\nm4_defun([_LT_COMPILER_C_O],\n[m4_require([_LT_DECL_SED])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n     fi\n   fi\n   chmod u+w . 2>&AS_MESSAGE_LOG_FD\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n])\n_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],\n\t[Does compiler simultaneously support -c and -o options?])\n])# _LT_COMPILER_C_O\n\n\n# _LT_COMPILER_FILE_LOCKS([TAGNAME])\n# ----------------------------------\n# Check to see if we can do hard links to lock some files if needed\nm4_defun([_LT_COMPILER_FILE_LOCKS],\n[m4_require([_LT_ENABLE_LOCK])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_COMPILER_C_O([$1])\n\nhard_links=\"nottested\"\nif test \"$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  AC_MSG_CHECKING([if we can lock with hard links])\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  AC_MSG_RESULT([$hard_links])\n  if test \"$hard_links\" = no; then\n    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])\n])# _LT_COMPILER_FILE_LOCKS\n\n\n# _LT_CHECK_OBJDIR\n# ----------------\nm4_defun([_LT_CHECK_OBJDIR],\n[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],\n[rm -f .libs 2>/dev/null\nmkdir .libs 2>/dev/null\nif test -d .libs; then\n  lt_cv_objdir=.libs\nelse\n  # MS-DOS does not allow filenames that begin with a dot.\n  lt_cv_objdir=_libs\nfi\nrmdir .libs 2>/dev/null])\nobjdir=$lt_cv_objdir\n_LT_DECL([], [objdir], [0],\n         [The name of the directory that contains temporary libtool files])dnl\nm4_pattern_allow([LT_OBJDIR])dnl\nAC_DEFINE_UNQUOTED(LT_OBJDIR, \"$lt_cv_objdir/\",\n  [Define to the sub-directory in which libtool stores uninstalled libraries.])\n])# _LT_CHECK_OBJDIR\n\n\n# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])\n# --------------------------------------\n# Check hardcoding attributes.\nm4_defun([_LT_LINKER_HARDCODE_LIBPATH],\n[AC_MSG_CHECKING([how to hardcode library paths into programs])\n_LT_TAGVAR(hardcode_action, $1)=\nif test -n \"$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\" ||\n   test -n \"$_LT_TAGVAR(runpath_var, $1)\" ||\n   test \"X$_LT_TAGVAR(hardcode_automatic, $1)\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$_LT_TAGVAR(hardcode_direct, $1)\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, $1)\" != no &&\n     test \"$_LT_TAGVAR(hardcode_minus_L, $1)\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    _LT_TAGVAR(hardcode_action, $1)=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    _LT_TAGVAR(hardcode_action, $1)=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  _LT_TAGVAR(hardcode_action, $1)=unsupported\nfi\nAC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])\n\nif test \"$_LT_TAGVAR(hardcode_action, $1)\" = relink ||\n   test \"$_LT_TAGVAR(inherit_rpath, $1)\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n_LT_TAGDECL([], [hardcode_action], [0],\n    [How to hardcode a shared library path into an executable])\n])# _LT_LINKER_HARDCODE_LIBPATH\n\n\n# _LT_CMD_STRIPLIB\n# ----------------\nm4_defun([_LT_CMD_STRIPLIB],\n[m4_require([_LT_DECL_EGREP])\nstriplib=\nold_striplib=\nAC_MSG_CHECKING([whether stripping libraries is possible])\nif test -n \"$STRIP\" && $STRIP -V 2>&1 | $GREP \"GNU strip\" >/dev/null; then\n  test -z \"$old_striplib\" && old_striplib=\"$STRIP --strip-debug\"\n  test -z \"$striplib\" && striplib=\"$STRIP --strip-unneeded\"\n  AC_MSG_RESULT([yes])\nelse\n# FIXME - insert some real tests, host_os isn't really good enough\n  case $host_os in\n  darwin*)\n    if test -n \"$STRIP\" ; then\n      striplib=\"$STRIP -x\"\n      old_striplib=\"$STRIP -S\"\n      AC_MSG_RESULT([yes])\n    else\n      AC_MSG_RESULT([no])\n    fi\n    ;;\n  *)\n    AC_MSG_RESULT([no])\n    ;;\n  esac\nfi\n_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])\n_LT_DECL([], [striplib], [1])\n])# _LT_CMD_STRIPLIB\n\n\n# _LT_SYS_DYNAMIC_LINKER([TAG])\n# -----------------------------\n# PORTME Fill in your ld.so characteristics\nm4_defun([_LT_SYS_DYNAMIC_LINKER],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_OBJDUMP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nAC_MSG_CHECKING([dynamic linker characteristics])\nm4_if([$1],\n\t[], [\nif test \"$GCC\" = yes; then\n  case $host_os in\n    darwin*) lt_awk_arg=\"/^libraries:/,/LR/\" ;;\n    *) lt_awk_arg=\"/^libraries:/\" ;;\n  esac\n  case $host_os in\n    mingw* | cegcc*) lt_sed_strip_eq=\"s,=\\([[A-Za-z]]:\\),\\1,g\" ;;\n    *) lt_sed_strip_eq=\"s,=/,/,g\" ;;\n  esac\n  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e \"s/^libraries://\" -e $lt_sed_strip_eq`\n  case $lt_search_path_spec in\n  *\\;*)\n    # if the path contains \";\" then we assume it to be the separator\n    # otherwise default to the standard path separator (i.e. \":\") - it is\n    # assumed that no part of a normal pathname contains \";\" but that should\n    # okay in the real world where \";\" in dirpaths is itself problematic.\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED 's/;/ /g'`\n    ;;\n  *)\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED \"s/$PATH_SEPARATOR/ /g\"`\n    ;;\n  esac\n  # Ok, now we have the path, separated by spaces, we can step through it\n  # and add multilib dir if necessary.\n  lt_tmp_lt_search_path_spec=\n  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`\n  for lt_sys_path in $lt_search_path_spec; do\n    if test -d \"$lt_sys_path/$lt_multi_os_dir\"; then\n      lt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir\"\n    else\n      test -d \"$lt_sys_path\" && \\\n\tlt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path\"\n    fi\n  done\n  lt_search_path_spec=`$ECHO \"$lt_tmp_lt_search_path_spec\" | awk '\nBEGIN {RS=\" \"; FS=\"/|\\n\";} {\n  lt_foo=\"\";\n  lt_count=0;\n  for (lt_i = NF; lt_i > 0; lt_i--) {\n    if ($lt_i != \"\" && $lt_i != \".\") {\n      if ($lt_i == \"..\") {\n        lt_count++;\n      } else {\n        if (lt_count == 0) {\n          lt_foo=\"/\" $lt_i lt_foo;\n        } else {\n          lt_count--;\n        }\n      }\n    }\n  }\n  if (lt_foo != \"\") { lt_freq[[lt_foo]]++; }\n  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }\n}'`\n  # AWK program above erroneously prepends '/' to C:/dos/paths\n  # for these hosts.\n  case $host_os in\n    mingw* | cegcc*) lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" |\\\n      $SED 's,/\\([[A-Za-z]]:\\),\\1,g'` ;;\n  esac\n  sys_lib_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $lt_NL2SP`\nelse\n  sys_lib_search_path_spec=\"/lib /usr/lib /usr/local/lib\"\nfi])\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[[4-9]]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[[01]] | aix4.[[01]].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all \"$lib\" | $SED '\\''s%^.*/\\([[^/]]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[[45]]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$cc_basename in\n  yes,*)\n    # gcc\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\nm4_if([$1], [],[\n      sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/lib/w32api\"])\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    dynamic_linker='Win32 ld.exe'\n    ;;\n\n  *,cl*)\n    # Native MSVC\n    libname_spec='$name'\n    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n    library_names_spec='${libname}.dll.lib'\n\n    case $build_os in\n    mingw*)\n      sys_lib_search_path_spec=\n      lt_save_ifs=$IFS\n      IFS=';'\n      for lt_path in $LIB\n      do\n        IFS=$lt_save_ifs\n        # Let DOS variable expansion print the short 8.3 style file name.\n        lt_path=`cd \"$lt_path\" 2>/dev/null && cmd //C \"for %i in (\".\") do @echo %~si\"`\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec $lt_path\"\n      done\n      IFS=$lt_save_ifs\n      # Convert to MSYS style.\n      sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | sed -e 's|\\\\\\\\|/|g' -e 's| \\\\([[a-zA-Z]]\\\\):| /\\\\1|g' -e 's|^ ||'`\n      ;;\n    cygwin*)\n      # Convert to unix form, then to dos form, then back to unix form\n      # but this time dos style (no spaces!) so that the unix form looks\n      # like /cygdrive/c/PROGRA~1:/cygdr...\n      sys_lib_search_path_spec=`cygpath --path --unix \"$LIB\"`\n      sys_lib_search_path_spec=`cygpath --path --dos \"$sys_lib_search_path_spec\" 2>/dev/null`\n      sys_lib_search_path_spec=`cygpath --path --unix \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      ;;\n    *)\n      sys_lib_search_path_spec=\"$LIB\"\n      if $ECHO \"$sys_lib_search_path_spec\" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then\n        # It is most probably a Windows format PATH.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      # FIXME: find the short name or the path components, as spaces are\n      # common. (e.g. \"Program Files\" -> \"PROGRA~1\")\n      ;;\n    esac\n\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n    dynamic_linker='Win32 link.exe'\n    ;;\n\n  *)\n    # Assume MSVC wrapper\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    dynamic_linker='Win32 ld.exe'\n    ;;\n  esac\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\nm4_if([$1], [],[\n  sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/local/lib\"])\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[[23]].*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2.*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[[01]]* | freebsdelf3.[[01]]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \\\n  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nhaiku*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  dynamic_linker=\"$host_os runtime_loader\"\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...\n  postinstall_cmds='chmod 555 $lib'\n  # or fails outright, so override atomically:\n  install_override_mode=555\n  ;;\n\ninterix[[3-9]]*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux # correct to gnu/linux during the next big refactor\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be glibc/ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n\n  # Some binutils ld are patched to set DT_RUNPATH\n  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],\n    [lt_cv_shlibpath_overrides_runpath=no\n    save_LDFLAGS=$LDFLAGS\n    save_libdir=$libdir\n    eval \"libdir=/foo; wl=\\\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\\\"; \\\n\t LDFLAGS=\\\"\\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\\\"\"\n    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null],\n\t [lt_cv_shlibpath_overrides_runpath=yes])])\n    LDFLAGS=$save_LDFLAGS\n    libdir=$save_libdir\n    ])\n  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\[$]2)); skip = 1; } { if (!skip) print \\[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/\"//g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsdelf*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='NetBSD ld.elf_so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[[89]] | openbsd2.[[89]].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux # correct to gnu/linux during the next big refactor\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux # correct to gnu/linux during the next big refactor\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux # correct to gnu/linux during the next big refactor\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\nAC_MSG_RESULT([$dynamic_linker])\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n_LT_DECL([], [variables_saved_for_relink], [1],\n    [Variables whose values should be saved in libtool wrapper scripts and\n    restored at link time])\n_LT_DECL([], [need_lib_prefix], [0],\n    [Do we need the \"lib\" prefix for modules?])\n_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])\n_LT_DECL([], [version_type], [0], [Library versioning type])\n_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])\n_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])\n_LT_DECL([], [shlibpath_overrides_runpath], [0],\n    [Is shlibpath searched before the hard-coded library search path?])\n_LT_DECL([], [libname_spec], [1], [Format of library name prefix])\n_LT_DECL([], [library_names_spec], [1],\n    [[List of archive names.  First name is the real one, the rest are links.\n    The last name is the one that the linker finds with -lNAME]])\n_LT_DECL([], [soname_spec], [1],\n    [[The coded name of the library, if different from the real name]])\n_LT_DECL([], [install_override_mode], [1],\n    [Permission mode override for installation of shared libraries])\n_LT_DECL([], [postinstall_cmds], [2],\n    [Command to use after installation of a shared archive])\n_LT_DECL([], [postuninstall_cmds], [2],\n    [Command to use after uninstallation of a shared archive])\n_LT_DECL([], [finish_cmds], [2],\n    [Commands used to finish a libtool library installation in a directory])\n_LT_DECL([], [finish_eval], [1],\n    [[As \"finish_cmds\", except a single script fragment to be evaled but\n    not shown]])\n_LT_DECL([], [hardcode_into_libs], [0],\n    [Whether we should hardcode library paths into libraries])\n_LT_DECL([], [sys_lib_search_path_spec], [2],\n    [Compile-time system search path for libraries])\n_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],\n    [Run-time system search path for libraries])\n])# _LT_SYS_DYNAMIC_LINKER\n\n\n# _LT_PATH_TOOL_PREFIX(TOOL)\n# --------------------------\n# find a file program which can recognize shared library\nAC_DEFUN([_LT_PATH_TOOL_PREFIX],\n[m4_require([_LT_DECL_EGREP])dnl\nAC_MSG_CHECKING([for $1])\nAC_CACHE_VAL(lt_cv_path_MAGIC_CMD,\n[case $MAGIC_CMD in\n[[\\\\/*] |  ?:[\\\\/]*])\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\ndnl $ac_dummy forces splitting on constant user-supplied paths.\ndnl POSIX.2 word splitting is done only on the output of word expansions,\ndnl not every word.  This closes a longstanding sh security hole.\n  ac_dummy=\"m4_if([$2], , $PATH, [$2])\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/$1; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/$1\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac])\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  AC_MSG_RESULT($MAGIC_CMD)\nelse\n  AC_MSG_RESULT(no)\nfi\n_LT_DECL([], [MAGIC_CMD], [0],\n\t [Used to examine libraries when file_magic_cmd begins with \"file\"])dnl\n])# _LT_PATH_TOOL_PREFIX\n\n# Old name:\nAU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])\n\n\n# _LT_PATH_MAGIC\n# --------------\n# find a file program which can recognize a shared library\nm4_defun([_LT_PATH_MAGIC],\n[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)\nif test -z \"$lt_cv_path_MAGIC_CMD\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)\n  else\n    MAGIC_CMD=:\n  fi\nfi\n])# _LT_PATH_MAGIC\n\n\n# LT_PATH_LD\n# ----------\n# find the pathname to the GNU or non-GNU linker\nAC_DEFUN([LT_PATH_LD],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_PROG_ECHO_BACKSLASH])dnl\n\nAC_ARG_WITH([gnu-ld],\n    [AS_HELP_STRING([--with-gnu-ld],\n\t[assume the C compiler uses GNU ld @<:@default=no@:>@])],\n    [test \"$withval\" = no || with_gnu_ld=yes],\n    [with_gnu_ld=no])dnl\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  AC_MSG_CHECKING([for ld used by $CC])\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [[\\\\/]]* | ?:[[\\\\/]]*)\n      re_direlt='/[[^/]][[^/]]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  AC_MSG_CHECKING([for GNU ld])\nelse\n  AC_MSG_CHECKING([for non-GNU ld])\nfi\nAC_CACHE_VAL(lt_cv_path_LD,\n[if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi])\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  AC_MSG_RESULT($LD)\nelse\n  AC_MSG_RESULT(no)\nfi\ntest -z \"$LD\" && AC_MSG_ERROR([no acceptable ld found in \\$PATH])\n_LT_PATH_LD_GNU\nAC_SUBST([LD])\n\n_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])\n])# LT_PATH_LD\n\n# Old names:\nAU_ALIAS([AM_PROG_LD], [LT_PATH_LD])\nAU_ALIAS([AC_PROG_LD], [LT_PATH_LD])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_LD], [])\ndnl AC_DEFUN([AC_PROG_LD], [])\n\n\n# _LT_PATH_LD_GNU\n#- --------------\nm4_defun([_LT_PATH_LD_GNU],\n[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,\n[# I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac])\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n])# _LT_PATH_LD_GNU\n\n\n# _LT_CMD_RELOAD\n# --------------\n# find reload flag for linker\n#   -- PORTME Some linkers may need a different reload flag.\nm4_defun([_LT_CMD_RELOAD],\n[AC_CACHE_CHECK([for $LD option to reload object files],\n  lt_cv_ld_reload_flag,\n  [lt_cv_ld_reload_flag='-r'])\nreload_flag=$lt_cv_ld_reload_flag\ncase $reload_flag in\n\"\" | \" \"*) ;;\n*) reload_flag=\" $reload_flag\" ;;\nesac\nreload_cmds='$LD$reload_flag -o $output$reload_objs'\ncase $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    if test \"$GCC\" != yes; then\n      reload_cmds=false\n    fi\n    ;;\n  darwin*)\n    if test \"$GCC\" = yes; then\n      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'\n    else\n      reload_cmds='$LD$reload_flag -o $output$reload_objs'\n    fi\n    ;;\nesac\n_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl\n_LT_TAGDECL([], [reload_cmds], [2])dnl\n])# _LT_CMD_RELOAD\n\n\n# _LT_CHECK_MAGIC_METHOD\n# ----------------------\n# how to check for library dependencies\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_MAGIC_METHOD],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nAC_CACHE_CHECK([how to recognize dependent libraries],\nlt_cv_deplibs_check_method,\n[lt_cv_file_magic_cmd='$MAGIC_CMD'\nlt_cv_file_magic_test_file=\nlt_cv_deplibs_check_method='unknown'\n# Need to set the preceding variable on all platforms that support\n# interlibrary dependencies.\n# 'none' -- dependencies not supported.\n# `unknown' -- same as none, but documents that we really don't know.\n# 'pass_all' -- all dependencies passed with no checks.\n# 'test_compile' -- check by making test program.\n# 'file_magic [[regex]]' -- check by looking for files in library path\n# which responds to the $file_magic_cmd with a given extended regex.\n# If you have `file' or equivalent on your system and you're not sure\n# whether `pass_all' will *always* work, you probably want this one.\n\ncase $host_os in\naix[[4-9]]*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbeos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbsdi[[45]]*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'\n  lt_cv_file_magic_cmd='/usr/bin/file -L'\n  lt_cv_file_magic_test_file=/shlib/libc.so\n  ;;\n\ncygwin*)\n  # func_win32_libid is a shell function defined in ltmain.sh\n  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n  lt_cv_file_magic_cmd='func_win32_libid'\n  ;;\n\nmingw* | pw32*)\n  # Base MSYS/MinGW do not provide the 'file' command needed by\n  # func_win32_libid shell function, so use a weaker test based on 'objdump',\n  # unless we find 'file', for example because we are cross-compiling.\n  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.\n  if ( test \"$lt_cv_nm_interface\" = \"BSD nm\" && file / ) >/dev/null 2>&1; then\n    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n    lt_cv_file_magic_cmd='func_win32_libid'\n  else\n    # Keep this pattern in sync with the one in func_win32_libid.\n    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'\n    lt_cv_file_magic_cmd='$OBJDUMP -f'\n  fi\n  ;;\n\ncegcc*)\n  # use the weaker test based on 'objdump'. See mingw*.\n  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'\n  lt_cv_file_magic_cmd='$OBJDUMP -f'\n  ;;\n\ndarwin* | rhapsody*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nfreebsd* | dragonfly*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    case $host_cpu in\n    i*86 )\n      # Not sure whether the presence of OpenBSD here was a mistake.\n      # Let's accept both of them until this is cleared up.\n      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'\n      lt_cv_file_magic_cmd=/usr/bin/file\n      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`\n      ;;\n    esac\n  else\n    lt_cv_deplibs_check_method=pass_all\n  fi\n  ;;\n\ngnu*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhaiku*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhpux10.20* | hpux11*)\n  lt_cv_file_magic_cmd=/usr/bin/file\n  case $host_cpu in\n  ia64*)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'\n    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so\n    ;;\n  hppa*64*)\n    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\\.[0-9]']\n    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl\n    ;;\n  *)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\\.[[0-9]]) shared library'\n    lt_cv_file_magic_test_file=/usr/lib/libc.sl\n    ;;\n  esac\n  ;;\n\ninterix[[3-9]]*)\n  # PIC code is broken on Interix 3.x, that's why |\\.a not |_pic\\.a here\n  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|\\.a)$'\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $LD in\n  *-32|*\"-32 \") libmagic=32-bit;;\n  *-n32|*\"-n32 \") libmagic=N32;;\n  *-64|*\"-64 \") libmagic=64-bit;;\n  *) libmagic=never-match;;\n  esac\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\n# This must be glibc/ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nnetbsd* | netbsdelf*-gnu)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|_pic\\.a)$'\n  fi\n  ;;\n\nnewos6*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'\n  lt_cv_file_magic_cmd=/usr/bin/file\n  lt_cv_file_magic_test_file=/usr/lib/libnls.so\n  ;;\n\n*nto* | *qnx*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nopenbsd*)\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|\\.so|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  fi\n  ;;\n\nosf3* | osf4* | osf5*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nrdos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsolaris*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv4 | sysv4.3*)\n  case $host_vendor in\n  motorola)\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'\n    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`\n    ;;\n  ncr)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  sequent)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'\n    ;;\n  sni)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method=\"file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib\"\n    lt_cv_file_magic_test_file=/lib/libc.so\n    ;;\n  siemens)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  pc)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  esac\n  ;;\n\ntpf*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\nesac\n])\n\nfile_magic_glob=\nwant_nocaseglob=no\nif test \"$build\" = \"$host\"; then\n  case $host_os in\n  mingw* | pw32*)\n    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then\n      want_nocaseglob=yes\n    else\n      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e \"s/\\(..\\)/s\\/[[\\1]]\\/[[\\1]]\\/g;/g\"`\n    fi\n    ;;\n  esac\nfi\n\nfile_magic_cmd=$lt_cv_file_magic_cmd\ndeplibs_check_method=$lt_cv_deplibs_check_method\ntest -z \"$deplibs_check_method\" && deplibs_check_method=unknown\n\n_LT_DECL([], [deplibs_check_method], [1],\n    [Method to check whether dependent libraries are shared objects])\n_LT_DECL([], [file_magic_cmd], [1],\n    [Command to use when deplibs_check_method = \"file_magic\"])\n_LT_DECL([], [file_magic_glob], [1],\n    [How to find potential files when deplibs_check_method = \"file_magic\"])\n_LT_DECL([], [want_nocaseglob], [1],\n    [Find potential files using nocaseglob when deplibs_check_method = \"file_magic\"])\n])# _LT_CHECK_MAGIC_METHOD\n\n\n# LT_PATH_NM\n# ----------\n# find the pathname to a BSD- or MS-compatible name lister\nAC_DEFUN([LT_PATH_NM],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,\n[if test -n \"$NM\"; then\n  # Let the user override the test.\n  lt_cv_path_NM=\"$NM\"\nelse\n  lt_nm_to_check=\"${ac_tool_prefix}nm\"\n  if test -n \"$ac_tool_prefix\" && test \"$build\" = \"$host\"; then\n    lt_nm_to_check=\"$lt_nm_to_check nm\"\n  fi\n  for lt_tmp_nm in $lt_nm_to_check; do\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do\n      IFS=\"$lt_save_ifs\"\n      test -z \"$ac_dir\" && ac_dir=.\n      tmp_nm=\"$ac_dir/$lt_tmp_nm\"\n      if test -f \"$tmp_nm\" || test -f \"$tmp_nm$ac_exeext\" ; then\n\t# Check to see if the nm accepts a BSD-compat flag.\n\t# Adding the `sed 1q' prevents false positives on HP-UX, which says:\n\t#   nm: unknown option \"B\" ignored\n\t# Tru64's nm complains that /dev/null is an invalid object file\n\tcase `\"$tmp_nm\" -B /dev/null 2>&1 | sed '1q'` in\n\t*/dev/null* | *'Invalid file or object type'*)\n\t  lt_cv_path_NM=\"$tmp_nm -B\"\n\t  break\n\t  ;;\n\t*)\n\t  case `\"$tmp_nm\" -p /dev/null 2>&1 | sed '1q'` in\n\t  */dev/null*)\n\t    lt_cv_path_NM=\"$tmp_nm -p\"\n\t    break\n\t    ;;\n\t  *)\n\t    lt_cv_path_NM=${lt_cv_path_NM=\"$tmp_nm\"} # keep the first match, but\n\t    continue # so that we can try to find one that supports BSD flags\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n  done\n  : ${lt_cv_path_NM=no}\nfi])\nif test \"$lt_cv_path_NM\" != \"no\"; then\n  NM=\"$lt_cv_path_NM\"\nelse\n  # Didn't find any BSD compatible name lister, look for dumpbin.\n  if test -n \"$DUMPBIN\"; then :\n    # Let the user override the test.\n  else\n    AC_CHECK_TOOLS(DUMPBIN, [dumpbin \"link -dump\"], :)\n    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in\n    *COFF*)\n      DUMPBIN=\"$DUMPBIN -symbols\"\n      ;;\n    *)\n      DUMPBIN=:\n      ;;\n    esac\n  fi\n  AC_SUBST([DUMPBIN])\n  if test \"$DUMPBIN\" != \":\"; then\n    NM=\"$DUMPBIN\"\n  fi\nfi\ntest -z \"$NM\" && NM=nm\nAC_SUBST([NM])\n_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl\n\nAC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],\n  [lt_cv_nm_interface=\"BSD nm\"\n  echo \"int some_variable = 0;\" > conftest.$ac_ext\n  (eval echo \"\\\"\\$as_me:$LINENO: $ac_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$ac_compile\" 2>conftest.err)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:$LINENO: $NM \\\\\\\"conftest.$ac_objext\\\\\\\"\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$NM \\\"conftest.$ac_objext\\\"\" 2>conftest.err > conftest.out)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:$LINENO: output\\\"\" >&AS_MESSAGE_LOG_FD)\n  cat conftest.out >&AS_MESSAGE_LOG_FD\n  if $GREP 'External.*some_variable' conftest.out > /dev/null; then\n    lt_cv_nm_interface=\"MS dumpbin\"\n  fi\n  rm -f conftest*])\n])# LT_PATH_NM\n\n# Old names:\nAU_ALIAS([AM_PROG_NM], [LT_PATH_NM])\nAU_ALIAS([AC_PROG_NM], [LT_PATH_NM])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_NM], [])\ndnl AC_DEFUN([AC_PROG_NM], [])\n\n# _LT_CHECK_SHAREDLIB_FROM_LINKLIB\n# --------------------------------\n# how to determine the name of the shared library\n# associated with a specific link library.\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nm4_require([_LT_DECL_DLLTOOL])\nAC_CACHE_CHECK([how to associate runtime and link libraries],\nlt_cv_sharedlib_from_linklib_cmd,\n[lt_cv_sharedlib_from_linklib_cmd='unknown'\n\ncase $host_os in\ncygwin* | mingw* | pw32* | cegcc*)\n  # two different shell functions defined in ltmain.sh\n  # decide which to use based on capabilities of $DLLTOOL\n  case `$DLLTOOL --help 2>&1` in\n  *--identify-strict*)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib\n    ;;\n  *)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback\n    ;;\n  esac\n  ;;\n*)\n  # fallback: assume linklib IS sharedlib\n  lt_cv_sharedlib_from_linklib_cmd=\"$ECHO\"\n  ;;\nesac\n])\nsharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd\ntest -z \"$sharedlib_from_linklib_cmd\" && sharedlib_from_linklib_cmd=$ECHO\n\n_LT_DECL([], [sharedlib_from_linklib_cmd], [1],\n    [Command to associate shared and link libraries])\n])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB\n\n\n# _LT_PATH_MANIFEST_TOOL\n# ----------------------\n# locate the manifest tool\nm4_defun([_LT_PATH_MANIFEST_TOOL],\n[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)\ntest -z \"$MANIFEST_TOOL\" && MANIFEST_TOOL=mt\nAC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],\n  [lt_cv_path_mainfest_tool=no\n  echo \"$as_me:$LINENO: $MANIFEST_TOOL '-?'\" >&AS_MESSAGE_LOG_FD\n  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  if $GREP 'Manifest Tool' conftest.out > /dev/null; then\n    lt_cv_path_mainfest_tool=yes\n  fi\n  rm -f conftest*])\nif test \"x$lt_cv_path_mainfest_tool\" != xyes; then\n  MANIFEST_TOOL=:\nfi\n_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl\n])# _LT_PATH_MANIFEST_TOOL\n\n\n# LT_LIB_M\n# --------\n# check for math library\nAC_DEFUN([LT_LIB_M],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nLIBM=\ncase $host in\n*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)\n  # These system don't have libm, or don't need it\n  ;;\n*-ncr-sysv4.3*)\n  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=\"-lmw\")\n  AC_CHECK_LIB(m, cos, LIBM=\"$LIBM -lm\")\n  ;;\n*)\n  AC_CHECK_LIB(m, cos, LIBM=\"-lm\")\n  ;;\nesac\nAC_SUBST([LIBM])\n])# LT_LIB_M\n\n# Old name:\nAU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_CHECK_LIBM], [])\n\n\n# _LT_COMPILER_NO_RTTI([TAGNAME])\n# -------------------------------\nm4_defun([_LT_COMPILER_NO_RTTI],\n[m4_require([_LT_TAG_COMPILER])dnl\n\n_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n\nif test \"$GCC\" = yes; then\n  case $cc_basename in\n  nvcc*)\n    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;\n  esac\n\n  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],\n    lt_cv_prog_compiler_rtti_exceptions,\n    [-fno-rtti -fno-exceptions], [],\n    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\"$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions\"])\nfi\n_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],\n\t[Compiler flag to turn off builtin functions])\n])# _LT_COMPILER_NO_RTTI\n\n\n# _LT_CMD_GLOBAL_SYMBOLS\n# ----------------------\nm4_defun([_LT_CMD_GLOBAL_SYMBOLS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_PROG_AWK])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_TAG_COMPILER])dnl\n\n# Check for command to grab the raw symbol name followed by C symbol from nm.\nAC_MSG_CHECKING([command to parse $NM output from $compiler object])\nAC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],\n[\n# These are sane defaults that work on at least a few old systems.\n# [They come from Ultrix.  What could be older than Ultrix?!! ;)]\n\n# Character class describing NM global symbol codes.\nsymcode='[[BCDEGRST]]'\n\n# Regexp to match symbols that can be accessed directly from C.\nsympat='\\([[_A-Za-z]][[_A-Za-z0-9]]*\\)'\n\n# Define system-specific variables.\ncase $host_os in\naix*)\n  symcode='[[BCDT]]'\n  ;;\ncygwin* | mingw* | pw32* | cegcc*)\n  symcode='[[ABCDGISTW]]'\n  ;;\nhpux*)\n  if test \"$host_cpu\" = ia64; then\n    symcode='[[ABCDEGRST]]'\n  fi\n  ;;\nirix* | nonstopux*)\n  symcode='[[BCDEGRST]]'\n  ;;\nosf*)\n  symcode='[[BCDEGQRST]]'\n  ;;\nsolaris*)\n  symcode='[[BDRT]]'\n  ;;\nsco3.2v5*)\n  symcode='[[DT]]'\n  ;;\nsysv4.2uw2*)\n  symcode='[[DT]]'\n  ;;\nsysv5* | sco5v6* | unixware* | OpenUNIX*)\n  symcode='[[ABDT]]'\n  ;;\nsysv4)\n  symcode='[[DFNSTU]]'\n  ;;\nesac\n\n# If we're using GNU nm, then use its standard symbol codes.\ncase `$NM -V 2>&1` in\n*GNU* | *'with BFD'*)\n  symcode='[[ABCDGIRSTW]]' ;;\nesac\n\n# Transform an extracted symbol line into a proper C declaration.\n# Some systems (esp. on ia64) link data and code symbols differently,\n# so use this general approach.\nlt_cv_sys_global_symbol_to_cdecl=\"sed -n -e 's/^T .* \\(.*\\)$/extern int \\1();/p' -e 's/^$symcode* .* \\(.*\\)$/extern char \\1;/p'\"\n\n# Transform an extracted symbol line into symbol name and symbol address\nlt_cv_sys_global_symbol_to_c_name_address=\"sed -n -e 's/^: \\([[^ ]]*\\)[[ ]]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p'\"\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix=\"sed -n -e 's/^: \\([[^ ]]*\\)[[ ]]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\(lib[[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"lib\\2\\\", (void *) \\&\\2},/p'\"\n\n# Handle CRLF in mingw tool chain\nopt_cr=\ncase $build_os in\nmingw*)\n  opt_cr=`$ECHO 'x\\{0,1\\}' | tr x '\\015'` # option cr in regexp\n  ;;\nesac\n\n# Try without a prefix underscore, then with it.\nfor ac_symprfx in \"\" \"_\"; do\n\n  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.\n  symxfrm=\"\\\\1 $ac_symprfx\\\\2 \\\\2\"\n\n  # Write the raw and C identifiers.\n  if test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n    # Fake it for dumpbin and say T for any non-static function\n    # and D for any global variable.\n    # Also find C++ and __fastcall symbols from MSVC++,\n    # which start with @ or ?.\n    lt_cv_sys_global_symbol_pipe=\"$AWK ['\"\\\n\"     {last_section=section; section=\\$ 3};\"\\\n\"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};\"\\\n\"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};\"\\\n\"     \\$ 0!~/External *\\|/{next};\"\\\n\"     / 0+ UNDEF /{next}; / UNDEF \\([^|]\\)*()/{next};\"\\\n\"     {if(hide[section]) next};\"\\\n\"     {f=0}; \\$ 0~/\\(\\).*\\|/{f=1}; {printf f ? \\\"T \\\" : \\\"D \\\"};\"\\\n\"     {split(\\$ 0, a, /\\||\\r/); split(a[2], s)};\"\\\n\"     s[1]~/^[@?]/{print s[1], s[1]; next};\"\\\n\"     s[1]~prfx {split(s[1],t,\\\"@\\\"); print t[1], substr(t[1],length(prfx))}\"\\\n\"     ' prfx=^$ac_symprfx]\"\n  else\n    lt_cv_sys_global_symbol_pipe=\"sed -n -e 's/^.*[[\t ]]\\($symcode$symcode*\\)[[\t ]][[\t ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'\"\n  fi\n  lt_cv_sys_global_symbol_pipe=\"$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'\"\n\n  # Check to see that the pipe works correctly.\n  pipe_works=no\n\n  rm -f conftest*\n  cat > conftest.$ac_ext <<_LT_EOF\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nchar nm_test_var;\nvoid nm_test_func(void);\nvoid nm_test_func(void){}\n#ifdef __cplusplus\n}\n#endif\nint main(){nm_test_var='a';nm_test_func();return(0);}\n_LT_EOF\n\n  if AC_TRY_EVAL(ac_compile); then\n    # Now try to grab the symbols.\n    nlist=conftest.nm\n    if AC_TRY_EVAL(NM conftest.$ac_objext \\| \"$lt_cv_sys_global_symbol_pipe\" \\> $nlist) && test -s \"$nlist\"; then\n      # Try sorting and uniquifying the output.\n      if sort \"$nlist\" | uniq > \"$nlist\"T; then\n\tmv -f \"$nlist\"T \"$nlist\"\n      else\n\trm -f \"$nlist\"T\n      fi\n\n      # Make sure that we snagged all the symbols we need.\n      if $GREP ' nm_test_var$' \"$nlist\" >/dev/null; then\n\tif $GREP ' nm_test_func$' \"$nlist\" >/dev/null; then\n\t  cat <<_LT_EOF > conftest.$ac_ext\n/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */\n#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)\n/* DATA imports from DLLs on WIN32 con't be const, because runtime\n   relocations are performed -- see ld's documentation on pseudo-relocs.  */\n# define LT@&t@_DLSYM_CONST\n#elif defined(__osf__)\n/* This system does not cope well with relocations in const data.  */\n# define LT@&t@_DLSYM_CONST\n#else\n# define LT@&t@_DLSYM_CONST const\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n_LT_EOF\n\t  # Now generate the symbol file.\n\t  eval \"$lt_cv_sys_global_symbol_to_cdecl\"' < \"$nlist\" | $GREP -v main >> conftest.$ac_ext'\n\n\t  cat <<_LT_EOF >> conftest.$ac_ext\n\n/* The mapping between symbol names and symbols.  */\nLT@&t@_DLSYM_CONST struct {\n  const char *name;\n  void       *address;\n}\nlt__PROGRAM__LTX_preloaded_symbols[[]] =\n{\n  { \"@PROGRAM@\", (void *) 0 },\n_LT_EOF\n\t  $SED \"s/^$symcode$symcode* \\(.*\\) \\(.*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/\" < \"$nlist\" | $GREP -v main >> conftest.$ac_ext\n\t  cat <<\\_LT_EOF >> conftest.$ac_ext\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt__PROGRAM__LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n_LT_EOF\n\t  # Now try linking the two files.\n\t  mv conftest.$ac_objext conftstm.$ac_objext\n\t  lt_globsym_save_LIBS=$LIBS\n\t  lt_globsym_save_CFLAGS=$CFLAGS\n\t  LIBS=\"conftstm.$ac_objext\"\n\t  CFLAGS=\"$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)\"\n\t  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then\n\t    pipe_works=yes\n\t  fi\n\t  LIBS=$lt_globsym_save_LIBS\n\t  CFLAGS=$lt_globsym_save_CFLAGS\n\telse\n\t  echo \"cannot find nm_test_func in $nlist\" >&AS_MESSAGE_LOG_FD\n\tfi\n      else\n\techo \"cannot find nm_test_var in $nlist\" >&AS_MESSAGE_LOG_FD\n      fi\n    else\n      echo \"cannot run $lt_cv_sys_global_symbol_pipe\" >&AS_MESSAGE_LOG_FD\n    fi\n  else\n    echo \"$progname: failed program was:\" >&AS_MESSAGE_LOG_FD\n    cat conftest.$ac_ext >&5\n  fi\n  rm -rf conftest* conftst*\n\n  # Do not use the global_symbol_pipe unless it works.\n  if test \"$pipe_works\" = yes; then\n    break\n  else\n    lt_cv_sys_global_symbol_pipe=\n  fi\ndone\n])\nif test -z \"$lt_cv_sys_global_symbol_pipe\"; then\n  lt_cv_sys_global_symbol_to_cdecl=\nfi\nif test -z \"$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl\"; then\n  AC_MSG_RESULT(failed)\nelse\n  AC_MSG_RESULT(ok)\nfi\n\n# Response file support.\nif test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n  nm_file_list_spec='@'\nelif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then\n  nm_file_list_spec='@'\nfi\n\n_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],\n    [Take the output of nm and produce a listing of raw symbols and C names])\n_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],\n    [Transform the output of nm in a proper C declaration])\n_LT_DECL([global_symbol_to_c_name_address],\n    [lt_cv_sys_global_symbol_to_c_name_address], [1],\n    [Transform the output of nm in a C name address pair])\n_LT_DECL([global_symbol_to_c_name_address_lib_prefix],\n    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],\n    [Transform the output of nm in a C name address pair when lib prefix is needed])\n_LT_DECL([], [nm_file_list_spec], [1],\n    [Specify filename containing input files for $NM])\n]) # _LT_CMD_GLOBAL_SYMBOLS\n\n\n# _LT_COMPILER_PIC([TAGNAME])\n# ---------------------------\nm4_defun([_LT_COMPILER_PIC],\n[m4_require([_LT_TAG_COMPILER])dnl\n_LT_TAGVAR(lt_prog_compiler_wl, $1)=\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n_LT_TAGVAR(lt_prog_compiler_static, $1)=\n\nm4_if([$1], [CXX], [\n  # C++ specific cases for pic, static, wl, etc.\n  if test \"$GXX\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n    aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n    mingw* | cygwin* | os2* | pw32* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n    *djgpp*)\n      # DJGPP does not support shared libraries at all\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n      ;;\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)=\n      ;;\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n    *qnx* | *nto*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n  else\n    case $host_os in\n      aix[[4-9]]*)\n\t# All AIX code is PIC.\n\tif test \"$host_cpu\" = ia64; then\n\t  # AIX 5 now supports IA64 processor\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\telse\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n\tfi\n\t;;\n      chorus*)\n\tcase $cc_basename in\n\tcxch68*)\n\t  # Green Hills C++ Compiler\n\t  # _LT_TAGVAR(lt_prog_compiler_static, $1)=\"--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a\"\n\t  ;;\n\tesac\n\t;;\n      mingw* | cygwin* | os2* | pw32* | cegcc*)\n\t# This hack is so that the source file can tell whether it is being\n\t# built for inclusion in a dll (and should export symbols for example).\n\tm4_if([$1], [GCJ], [],\n\t  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n\t;;\n      dgux*)\n\tcase $cc_basename in\n\t  ec++*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  ghcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      freebsd* | dragonfly*)\n\t# FreeBSD uses GNU C++\n\t;;\n      hpux9* | hpux10* | hpux11*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    if test \"$host_cpu\" != ia64; then\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t    fi\n\t    ;;\n\t  aCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    case $host_cpu in\n\t    hppa*64*|ia64*)\n\t      # +Z the default\n\t      ;;\n\t    *)\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t      ;;\n\t    esac\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      interix*)\n\t# This is c89, which is MS Visual C++ (no shared libs)\n\t# Anyone wants to do a port?\n\t;;\n      irix5* | irix6* | nonstopux*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    # CC pic flag -KPIC is the default.\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n\tcase $cc_basename in\n\t  KCC*)\n\t    # KAI C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    ;;\n\t  ecpc* )\n\t    # old Intel C++ for x86_64 which still supported -KPIC.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  icpc* )\n\t    # Intel C++, used to be incompatible with GCC.\n\t    # ICC 10 doesn't accept -KPIC any more.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  pgCC* | pgcpp*)\n\t    # Portland Group C++ compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)\n\t    # IBM XL 8.0, 9.0 on PPC and BlueGene\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n      lynxos*)\n\t;;\n      m88k*)\n\t;;\n      mvs*)\n\tcase $cc_basename in\n\t  cxx*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      netbsd* | netbsdelf*-gnu)\n\t;;\n      *qnx* | *nto*)\n        # QNX uses GNU C++, but need to define -shared option too, otherwise\n        # it will coredump.\n        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n        ;;\n      osf3* | osf4* | osf5*)\n\tcase $cc_basename in\n\t  KCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    ;;\n\t  RCC*)\n\t    # Rational C++ 2.4.1\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  cxx*)\n\t    # Digital/Compaq C++\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      psos*)\n\t;;\n      solaris*)\n\tcase $cc_basename in\n\t  CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t    ;;\n\t  gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sunos4*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.x\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  lcc*)\n\t    # Lucid\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\tesac\n\t;;\n      tandem*)\n\tcase $cc_basename in\n\t  NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      vxworks*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n\t;;\n    esac\n  fi\n],\n[\n  if test \"$GCC\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n      aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)=\n      ;;\n\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n\n    msdosdjgpp*)\n      # Just because we use GCC doesn't mean we suddenly get shared libraries\n      # on systems that don't support them.\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      enable_shared=no\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n\n    case $cc_basename in\n    nvcc*) # Cuda Compiler Driver 2.2\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '\n      if test -n \"$_LT_TAGVAR(lt_prog_compiler_pic, $1)\"; then\n        _LT_TAGVAR(lt_prog_compiler_pic, $1)=\"-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)\"\n      fi\n      ;;\n    esac\n  else\n    # PORTME Check for flag to pass linker flags through the system compiler.\n    case $host_os in\n    aix*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      else\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n      fi\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    hpux9* | hpux10* | hpux11*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but\n      # not for PA HP-UX.\n      case $host_cpu in\n      hppa*64*|ia64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t;;\n      esac\n      # Is there a better lt_prog_compiler_static that works with the bundled CC?\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC (with -KPIC) is the default.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    linux* | k*bsd*-gnu | kopensolaris*-gnu)\n      case $cc_basename in\n      # old Intel for x86_64 which still supported -KPIC.\n      ecc*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # icc used to be incompatible with GCC.\n      # ICC 10 doesn't accept -KPIC any more.\n      icc* | ifort*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # Lahey Fortran 8.1.\n      lf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'\n\t;;\n      nagfor*)\n\t# NAG Fortran compiler\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t;;\n      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)\n        # Portland Group compilers (*not* the Pentium gcc compiler,\n\t# which looks to be a dead project)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n        ;;\n      ccc*)\n        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n        # All Alpha code is PIC.\n        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n        ;;\n      xl* | bgxl* | bgf* | mpixl*)\n\t# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t;;\n      *)\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ Ceres\\ Fortran* | *Sun*Fortran*\\ [[1-7]].* | *Sun*Fortran*\\ 8.[[0-3]]*)\n\t  # Sun Fortran 8.3 passes all unrecognized flags to the linker\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''\n\t  ;;\n\t*Sun\\ F* | *Sun*Fortran*)\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t  ;;\n\t*Sun\\ C*)\n\t  # Sun C 5.9\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t  ;;\n        *Intel*\\ [[CF]]*Compiler*)\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t  ;;\n\t*Portland\\ Group*)\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  ;;\n\tesac\n\t;;\n      esac\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    osf3* | osf4* | osf5*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # All OSF/1 code is PIC.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    rdos*)\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      case $cc_basename in\n      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4 | sysv4.2uw2* | sysv4.3*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec ;then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    unicos*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n    esac\n  fi\n])\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n    ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\"$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])\"\n    ;;\nesac\n\nAC_CACHE_CHECK([for $compiler option to produce PIC],\n  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$_LT_TAGVAR(lt_prog_compiler_pic, $1)\"; then\n  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],\n    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],\n    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],\n    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in\n     \"\" | \" \"*) ;;\n     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=\" $_LT_TAGVAR(lt_prog_compiler_pic, $1)\" ;;\n     esac],\n    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])\nfi\n_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],\n\t[Additional compiler flags for building library objects])\n\n_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],\n\t[How to pass a linker flag through the compiler])\n#\n# Check to make sure the static flag actually works.\n#\nwl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\\\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\\\"\n_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],\n  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),\n  $lt_tmp_static_flag,\n  [],\n  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])\n_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],\n\t[Compiler flag to prevent dynamic linking])\n])# _LT_COMPILER_PIC\n\n\n# _LT_LINKER_SHLIBS([TAGNAME])\n# ----------------------------\n# See if the linker supports building shared libraries.\nm4_defun([_LT_LINKER_SHLIBS],\n[AC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nm4_require([_LT_PATH_MANIFEST_TOOL])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\nm4_if([$1], [CXX], [\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  case $host_os in\n  aix[[4-9]]*)\n    # If we're using GNU nm, then we don't want the \"-C\" option.\n    # -C means demangle to AIX nm, but means don't demangle with GNU nm\n    # Also, AIX nm treats weak defined symbols like other global defined\n    # symbols, whereas GNU nm marks them as \"W\".\n    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    else\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    fi\n    ;;\n  pw32*)\n    _LT_TAGVAR(export_symbols_cmds, $1)=\"$ltdll_cmds\"\n    ;;\n  cygwin* | mingw* | cegcc*)\n    case $cc_basename in\n    cl*)\n      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'\n      ;;\n    *)\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']\n      ;;\n    esac\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    _LT_TAGVAR(link_all_deplibs, $1)=no\n    ;;\n  *)\n    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n    ;;\n  esac\n], [\n  runpath_var=\n  _LT_TAGVAR(allow_undefined_flag, $1)=\n  _LT_TAGVAR(always_export_symbols, $1)=no\n  _LT_TAGVAR(archive_cmds, $1)=\n  _LT_TAGVAR(archive_expsym_cmds, $1)=\n  _LT_TAGVAR(compiler_needs_object, $1)=no\n  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n  _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(hardcode_automatic, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_direct_absolute, $1)=no\n  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n  _LT_TAGVAR(hardcode_minus_L, $1)=no\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  _LT_TAGVAR(inherit_rpath, $1)=no\n  _LT_TAGVAR(link_all_deplibs, $1)=unknown\n  _LT_TAGVAR(module_cmds, $1)=\n  _LT_TAGVAR(module_expsym_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_new_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=\n  _LT_TAGVAR(thread_safe_flag_spec, $1)=\n  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n  # include_expsyms should be a list of space-separated symbols to be *always*\n  # included in the symbol list\n  _LT_TAGVAR(include_expsyms, $1)=\n  # exclude_expsyms can be an extended regexp of symbols to exclude\n  # it will be wrapped by ` (' and `)$', so one must not match beginning or\n  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',\n  # as well as any symbol that contains `d'.\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out\n  # platforms (ab)use it in PIC code, but their linkers get confused if\n  # the symbol is explicitly referenced.  Since portable code cannot\n  # rely on this symbol name, it's probably fine to never include it in\n  # preloaded symbol tables.\n  # Exclude shared library initialization/finalization symbols.\ndnl Note also adjust exclude_expsyms for C++ above.\n  extract_expsyms_cmds=\n\n  case $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    # FIXME: the MSVC++ port hasn't been tested in a loooong time\n    # When not using gcc, we currently assume that we are using\n    # Microsoft Visual C++.\n    if test \"$GCC\" != yes; then\n      with_gnu_ld=no\n    fi\n    ;;\n  interix*)\n    # we just hope/assume this is gcc and not c89 (= MSVC++)\n    with_gnu_ld=yes\n    ;;\n  openbsd*)\n    with_gnu_ld=no\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    _LT_TAGVAR(link_all_deplibs, $1)=no\n    ;;\n  esac\n\n  _LT_TAGVAR(ld_shlibs, $1)=yes\n\n  # On some targets, GNU ld is compatible enough with the native linker\n  # that we're better off using the native interface for both.\n  lt_use_gnu_ld_interface=no\n  if test \"$with_gnu_ld\" = yes; then\n    case $host_os in\n      aix*)\n\t# The AIX port of GNU ld has always aspired to compatibility\n\t# with the native linker.  However, as the warning in the GNU ld\n\t# block says, versions before 2.19.5* couldn't really create working\n\t# shared libraries, regardless of the interface used.\n\tcase `$LD -v 2>&1` in\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.19.5*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.[[2-9]]*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ [[3-9]]*) ;;\n\t  *)\n\t    lt_use_gnu_ld_interface=yes\n\t    ;;\n\tesac\n\t;;\n      *)\n\tlt_use_gnu_ld_interface=yes\n\t;;\n    esac\n  fi\n\n  if test \"$lt_use_gnu_ld_interface\" = yes; then\n    # If archive_cmds runs LD, not CC, wlarc should be empty\n    wlarc='${wl}'\n\n    # Set some defaults for GNU ld with shared library support. These\n    # are reset later if shared libraries are not supported. Putting them\n    # here allows them to be overridden if necessary.\n    runpath_var=LD_RUN_PATH\n    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n    # ancient GNU ld didn't support --whole-archive et. al.\n    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n    else\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n    supports_anon_versioning=no\n    case `$LD -v 2>&1` in\n      *GNU\\ gold*) supports_anon_versioning=yes ;;\n      *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.10.*) ;; # catch versions < 2.11\n      *\\ 2.11.93.0.2\\ *) supports_anon_versioning=yes ;; # RH7.3 ...\n      *\\ 2.11.92.0.12\\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...\n      *\\ 2.11.*) ;; # other 2.11 versions\n      *) supports_anon_versioning=yes ;;\n    esac\n\n    # See if GNU ld supports shared libraries.\n    case $host_os in\n    aix[[3-9]]*)\n      # On AIX/PPC, the GNU linker is very broken\n      if test \"$host_cpu\" != ia64; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: the GNU linker, at least up to release 2.19, is reported\n*** to be unable to reliably create shared libraries on AIX.\n*** Therefore, libtool is disabling shared libraries support.  If you\n*** really care for shared libraries, you may want to install binutils\n*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.\n*** You will then need to restart the configuration process.\n\n_LT_EOF\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    beos*)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t# support --undefined.  This deserves some investigation.  FIXME\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n      # as there is no search path for DLLs.\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=no\n      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']\n\n      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t# If the export-symbols file already is a .def file (1st line\n\t# is EXPORTS), use it as is; otherwise, prepend...\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t  cp $export_symbols $output_objdir/$soname.def;\n\telse\n\t  echo EXPORTS > $output_objdir/$soname.def;\n\t  cat $export_symbols >> $output_objdir/$soname.def;\n\tfi~\n\t$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    haiku*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    interix[[3-9]]*)\n      _LT_TAGVAR(hardcode_direct, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n      # Instead, shared libraries are loaded at an image base (0x10000000 by\n      # default) and relocated if they conflict, which is a slow very memory\n      # consuming and fragmenting process.  To avoid this, we pick a random,\n      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      _LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      ;;\n\n    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)\n      tmp_diet=no\n      if test \"$host_os\" = linux-dietlibc; then\n\tcase $cc_basename in\n\t  diet\\ *) tmp_diet=yes;;\t# linux-dietlibc with static linking (!diet-dyn)\n\tesac\n      fi\n      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \\\n\t && test \"$tmp_diet\" = no\n      then\n\ttmp_addflag=' $pic_flag'\n\ttmp_sharedflag='-shared'\n\tcase $cc_basename,$host_cpu in\n        pgcc*)\t\t\t\t# Portland Group C compiler\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag'\n\t  ;;\n\tpgf77* | pgf90* | pgf95* | pgfortran*)\n\t\t\t\t\t# Portland Group f77 and f90 compilers\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag -Mnomain' ;;\n\tecc*,ia64* | icc*,ia64*)\t# Intel C compiler on ia64\n\t  tmp_addflag=' -i_dynamic' ;;\n\tefc*,ia64* | ifort*,ia64*)\t# Intel Fortran compiler on ia64\n\t  tmp_addflag=' -i_dynamic -nofor_main' ;;\n\tifc* | ifort*)\t\t\t# Intel Fortran compiler\n\t  tmp_addflag=' -nofor_main' ;;\n\tlf95*)\t\t\t\t# Lahey Fortran 8.1\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n\t  tmp_sharedflag='--shared' ;;\n\txl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)\n\t  tmp_sharedflag='-qmkshrobj'\n\t  tmp_addflag= ;;\n\tnvcc*)\t# Cuda Compiler Driver 2.2\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  ;;\n\tesac\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\t\t\t# Sun C 5.9\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  tmp_sharedflag='-G' ;;\n\t*Sun\\ F*)\t\t\t# Sun Fortran 8.3\n\t  tmp_sharedflag='-G' ;;\n\tesac\n\t_LT_TAGVAR(archive_cmds, $1)='$CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\n        if test \"x$supports_anon_versioning\" = xyes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t    cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t    echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t    $CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n        fi\n\n\tcase $cc_basename in\n\txlf* | bgf* | bgxlf* | mpixlf*)\n\t  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'\n\t  if test \"x$supports_anon_versioning\" = xyes; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t      cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t      echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'\n\t  fi\n\t  ;;\n\tesac\n      else\n        _LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'\n\twlarc=\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      fi\n      ;;\n\n    solaris*)\n      if $LD -v 2>&1 | $GREP 'BFD 2\\.8' > /dev/null; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: The releases 2.8.* of the GNU linker cannot reliably\n*** create shared libraries on Solaris systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.9.1 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)\n      case `$LD -v 2>&1` in\n        *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.1[[0-5]].*)\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not\n*** reliably create shared libraries on SCO systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n\t;;\n\t*)\n\t  # For security reasons, it is highly recommended that you always\n\t  # use absolute paths for naming shared libraries, and exclude the\n\t  # DT_RUNPATH tag from executables and libraries.  But doing so\n\t  # requires that you compile everything twice, which is a pain.\n\t  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t;;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      wlarc=\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n    esac\n\n    if test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no; then\n      runpath_var=\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n  else\n    # PORTME fill in a description of your system's linker (not GNU ld)\n    case $host_os in\n    aix3*)\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'\n      # Note: this linker hardcodes the directories in LIBPATH if there\n      # are no directories specified by -L.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      if test \"$GCC\" = yes && test -z \"$lt_prog_compiler_static\"; then\n\t# Neither direct hardcoding nor static linking is supported with a\n\t# broken collect2.\n\t_LT_TAGVAR(hardcode_direct, $1)=unsupported\n      fi\n      ;;\n\n    aix[[4-9]]*)\n      if test \"$host_cpu\" = ia64; then\n\t# On IA64, the linker does run time linking by default, so we don't\n\t# have to do anything special.\n\taix_use_runtimelinking=no\n\texp_sym_flag='-Bexport'\n\tno_entry_flag=\"\"\n      else\n\t# If we're using GNU nm, then we don't want the \"-C\" option.\n\t# -C means demangle to AIX nm, but means don't demangle with GNU nm\n\t# Also, AIX nm treats weak defined symbols like other global\n\t# defined symbols, whereas GNU nm marks them as \"W\".\n\tif $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\telse\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\tfi\n\taix_use_runtimelinking=no\n\n\t# Test if we are trying to use run time linking or normal\n\t# AIX style linking. If -brtl is somewhere in LDFLAGS, we\n\t# need to do runtime linking.\n\tcase $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t  for ld_flag in $LDFLAGS; do\n\t  if (test $ld_flag = \"-brtl\" || test $ld_flag = \"-Wl,-brtl\"); then\n\t    aix_use_runtimelinking=yes\n\t    break\n\t  fi\n\t  done\n\t  ;;\n\tesac\n\n\texp_sym_flag='-bexport'\n\tno_entry_flag='-bnoentry'\n      fi\n\n      # When large executables or shared objects are built, AIX ld can\n      # have problems creating the table of contents.  If linking a library\n      # or program results in \"error TOC overflow\" add -mminimal-toc to\n      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n      _LT_TAGVAR(archive_cmds, $1)=''\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n      if test \"$GCC\" = yes; then\n\tcase $host_os in aix4.[[012]]|aix4.[[012]].*)\n\t# We only want to do this on AIX 4.2 and lower, the check\n\t# below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t   strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t  # We have reworked collect2\n\t  :\n\t  else\n\t  # We have old collect2\n\t  _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t  # It fails to find uninstalled libraries when the uninstalled\n\t  # path is not listed in the libpath.  Setting hardcode_minus_L\n\t  # to unsupported forces relinking\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n\t  ;;\n\tesac\n\tshared_flag='-shared'\n\tif test \"$aix_use_runtimelinking\" = yes; then\n\t  shared_flag=\"$shared_flag \"'${wl}-G'\n\tfi\n\t_LT_TAGVAR(link_all_deplibs, $1)=no\n      else\n\t# not using gcc\n\tif test \"$host_cpu\" = ia64; then\n\t# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t# chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n\telse\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag='${wl}-G'\n\t  else\n\t    shared_flag='${wl}-bM:SRE'\n\t  fi\n\tfi\n      fi\n\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n      # It seems that -bexpall does not export symbols beginning with\n      # underscore (_), so it is better to generate a list of symbols to export.\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      if test \"$aix_use_runtimelinking\" = yes; then\n\t# Warning - without using the other runtime loading flags (-brtl),\n\t# -berok will link without error, but may produce a broken library.\n\t_LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n        # Determine the default libpath from the value encoded in an\n        # empty executable.\n        _LT_SYS_MODULE_PATH_AIX([$1])\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n      else\n\tif test \"$host_cpu\" = ia64; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n\telse\n\t # Determine the default libpath from the value encoded in an\n\t # empty executable.\n\t _LT_SYS_MODULE_PATH_AIX([$1])\n\t _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t  # Warning - without using the other run time loading flags,\n\t  # -berok will link without error, but may produce a broken library.\n\t  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t  if test \"$with_gnu_ld\" = yes; then\n\t    # We only use this code for GNU lds that support --whole-archive.\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t  else\n\t    # Exported symbols can be pulled into shared objects from archives\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t  fi\n\t  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  # This is similar to how AIX traditionally builds its shared libraries.\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n\tfi\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    bsdi[[45]]*)\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # When not using gcc, we currently assume that we are using\n      # Microsoft Visual C++.\n      # hardcode_libdir_flag_spec is actually meaningless, as there is\n      # no search path for DLLs.\n      case $cc_basename in\n      cl*)\n\t# Native MSVC\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t_LT_TAGVAR(always_export_symbols, $1)=yes\n\t_LT_TAGVAR(file_list_spec, $1)='@'\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t    sed -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t  else\n\t    sed -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t  fi~\n\t  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t  linknames='\n\t# The linker will not automatically build a static lib if we build a DLL.\n\t# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'\n\t_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1,DATA/'\\'' | $SED -e '\\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\\'' | sort | uniq > $export_symbols'\n\t# Don't use ranlib\n\t_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'\n\t_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile=\"@OUTPUT@\"~\n\t  lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t  case $lt_outputfile in\n\t    *.exe|*.EXE) ;;\n\t    *)\n\t      lt_outputfile=\"$lt_outputfile.exe\"\n\t      lt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t      ;;\n\t  esac~\n\t  if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t    $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t    $RM \"$lt_outputfile.manifest\";\n\t  fi'\n\t;;\n      *)\n\t# Assume MSVC wrapper\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all \"$deplibs\" | $SED '\\''s/ -lc$//'\\''` -link -dll~linknames='\n\t# The linker will automatically build a .lib file if we build a DLL.\n\t_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t# FIXME: Should let the user specify the lib program.\n\t_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'\n\t_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t;;\n      esac\n      ;;\n\n    darwin* | rhapsody*)\n      _LT_DARWIN_LINKER_FEATURES($1)\n      ;;\n\n    dgux*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor\n    # support.  Future versions do this automatically, but an explicit c++rt0.o\n    # does not break anything, and helps significantly (at the cost of a little\n    # extra space).\n    freebsd2.2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # Unfortunately, older versions of FreeBSD 2 do not have this feature.\n    freebsd2.*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.\n    freebsd* | dragonfly*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    hpux9*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n\n      # hardcode_minus_L: Not really in the search PATH,\n      # but as the default location of the library.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      ;;\n\n    hpux10*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# hardcode_minus_L: Not really in the search PATH,\n\t# but as the default location of the library.\n\t_LT_TAGVAR(hardcode_minus_L, $1)=yes\n      fi\n      ;;\n\n    hpux11*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      else\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\tm4_if($1, [], [\n\t  # Older versions of the 11.00 compiler do not understand -b yet\n\t  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)\n\t  _LT_LINKER_OPTION([if $CC understands -b],\n\t    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],\n\t    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],\n\t    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],\n\t  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])\n\t  ;;\n\tesac\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\tcase $host_cpu in\n\thppa*64*|ia64*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\n\t  # hardcode_minus_L: Not really in the search PATH,\n\t  # but as the default location of the library.\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  ;;\n\tesac\n      fi\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t# Try to use the -exported_symbol ld option, if it does not\n\t# work, assume that -exports_file does not work either and\n\t# implicitly export all symbols.\n\t# This should be the same for all languages, so no per-tag cache variable.\n\tAC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],\n\t  [lt_cv_irix_exported_symbol],\n\t  [save_LDFLAGS=\"$LDFLAGS\"\n\t   LDFLAGS=\"$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null\"\n\t   AC_LINK_IFELSE(\n\t     [AC_LANG_SOURCE(\n\t        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],\n\t\t\t      [C++], [[int foo (void) { return 0; }]],\n\t\t\t      [Fortran 77], [[\n      subroutine foo\n      end]],\n\t\t\t      [Fortran], [[\n      subroutine foo\n      end]])])],\n\t      [lt_cv_irix_exported_symbol=yes],\n\t      [lt_cv_irix_exported_symbol=no])\n           LDFLAGS=\"$save_LDFLAGS\"])\n\tif test \"$lt_cv_irix_exported_symbol\" = yes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'\n\tfi\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(inherit_rpath, $1)=yes\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *nto* | *qnx*)\n      ;;\n\n    openbsd*)\n      if test -f /usr/libexec/ld.so; then\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\tif test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\telse\n\t  case $host_os in\n\t   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)\n\t     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t     ;;\n\t   *)\n\t     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t     ;;\n\t  esac\n\tfi\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    os2*)\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(archive_cmds, $1)='$ECHO \"LIBRARY $libname INITINSTANCE\" > $output_objdir/$libname.def~$ECHO \"DESCRIPTION \\\"$libname\\\"\" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo \" SINGLE NONSHARED\" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'\n      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'\n      ;;\n\n    osf3*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    osf4* | osf5*)\t# as osf3* with the addition of -msym flag\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done; printf \"%s\\\\n\" \"-hidden\">> $lib.exp~\n\t$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'\n\n\t# Both c and cxx compiler support -rpath directly\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'\n      if test \"$GCC\" = yes; then\n\twlarc='${wl}'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n      else\n\tcase `$CC -V 2>&1` in\n\t*\"Compilers 5.0\"*)\n\t  wlarc=''\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'\n\t  ;;\n\t*)\n\t  wlarc='${wl}'\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n\t  ;;\n\tesac\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      case $host_os in\n      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n      *)\n\t# The compiler driver will combine and reorder linker options,\n\t# but understands `-z linker_flag'.  GCC discards it without `$wl',\n\t# but is careful enough not to reorder.\n\t# Supported since Solaris 2.6 (maybe 2.5.1?)\n\tif test \"$GCC\" = yes; then\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\telse\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\tfi\n\t;;\n      esac\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    sunos4*)\n      if test \"x$host_vendor\" = xsequent; then\n\t# Use $CC to link under sequent, because it throws in some extra .o\n\t# files that make .init and .fini sections work.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4)\n      case $host_vendor in\n\tsni)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???\n\t;;\n\tsiemens)\n\t  ## LD is ld it makes a PLAMLIB\n\t  ## CC just makes a GrossModule.\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n        ;;\n\tmotorola)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie\n\t;;\n      esac\n      runpath_var='LD_RUN_PATH'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4.3*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\trunpath_var=LD_RUN_PATH\n\thardcode_runpath_var=yes\n\t_LT_TAGVAR(ld_shlibs, $1)=yes\n      fi\n      ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6*)\n      # Note: We can NOT use -z defs as we might desire, because we do not\n      # link with -lc, and that would cause any symbols used from libc to\n      # always be unresolved, which means just about no library would\n      # ever link correctly.  If we're not using GNU ld we use -z text\n      # though, which does catch some bad symbols but isn't as heavy-handed\n      # as -z defs.\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n    esac\n\n    if test x$host_vendor = xsni; then\n      case $host in\n      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'\n\t;;\n      esac\n    fi\n  fi\n])\nAC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\ntest \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld\n\n_LT_DECL([], [libext], [0], [Old archive suffix (normally \"a\")])dnl\n_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally \".so\")])dnl\n_LT_DECL([], [extract_expsyms_cmds], [2],\n    [The commands to extract the exported symbol list from a shared archive])\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$_LT_TAGVAR(archive_cmds_need_lc, $1)\" in\nx|xyes)\n  # Assume -lc should be added\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $_LT_TAGVAR(archive_cmds, $1) in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      AC_CACHE_CHECK([whether -lc should be explicitly linked in],\n\t[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),\n\t[$RM conftest*\n\techo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n\tif AC_TRY_EVAL(ac_compile) 2>conftest.err; then\n\t  soname=conftest\n\t  lib=conftest\n\t  libobjs=conftest.$ac_objext\n\t  deplibs=\n\t  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)\n\t  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)\n\t  compiler_flags=-v\n\t  linker_flags=-v\n\t  verstring=\n\t  output_objdir=.\n\t  libname=conftest\n\t  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\n\t  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1)\n\t  then\n\t    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t  else\n\t    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  fi\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag\n\telse\n\t  cat conftest.err 1>&5\n\tfi\n\t$RM conftest*\n\t])\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],\n    [Whether or not to add -lc for building shared libraries])\n_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],\n    [enable_shared_with_static_runtimes], [0],\n    [Whether or not to disallow shared libs when runtime libs are static])\n_LT_TAGDECL([], [export_dynamic_flag_spec], [1],\n    [Compiler flag to allow reflexive dlopens])\n_LT_TAGDECL([], [whole_archive_flag_spec], [1],\n    [Compiler flag to generate shared objects directly from archives])\n_LT_TAGDECL([], [compiler_needs_object], [1],\n    [Whether the compiler copes with passing no objects directly])\n_LT_TAGDECL([], [old_archive_from_new_cmds], [2],\n    [Create an old-style archive from a shared archive])\n_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],\n    [Create a temporary old-style archive to link instead of a shared archive])\n_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])\n_LT_TAGDECL([], [archive_expsym_cmds], [2])\n_LT_TAGDECL([], [module_cmds], [2],\n    [Commands used to build a loadable module if different from building\n    a shared archive.])\n_LT_TAGDECL([], [module_expsym_cmds], [2])\n_LT_TAGDECL([], [with_gnu_ld], [1],\n    [Whether we are building with GNU ld or not])\n_LT_TAGDECL([], [allow_undefined_flag], [1],\n    [Flag that allows shared libraries with undefined symbols to be built])\n_LT_TAGDECL([], [no_undefined_flag], [1],\n    [Flag that enforces no undefined symbols])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],\n    [Flag to hardcode $libdir into a binary during linking.\n    This must work even if $libdir does not exist])\n_LT_TAGDECL([], [hardcode_libdir_separator], [1],\n    [Whether we need a single \"-rpath\" flag with a separated argument])\n_LT_TAGDECL([], [hardcode_direct], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary])\n_LT_TAGDECL([], [hardcode_direct_absolute], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary and the resulting library dependency is\n    \"absolute\", i.e impossible to change by setting ${shlibpath_var} if the\n    library is relocated])\n_LT_TAGDECL([], [hardcode_minus_L], [0],\n    [Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_shlibpath_var], [0],\n    [Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_automatic], [0],\n    [Set to \"yes\" if building a shared library automatically hardcodes DIR\n    into the library and all subsequent libraries and executables linked\n    against it])\n_LT_TAGDECL([], [inherit_rpath], [0],\n    [Set to yes if linker adds runtime paths of dependent libraries\n    to runtime path list])\n_LT_TAGDECL([], [link_all_deplibs], [0],\n    [Whether libtool must link a program against all its dependency libraries])\n_LT_TAGDECL([], [always_export_symbols], [0],\n    [Set to \"yes\" if exported symbols are required])\n_LT_TAGDECL([], [export_symbols_cmds], [2],\n    [The commands to list exported symbols])\n_LT_TAGDECL([], [exclude_expsyms], [1],\n    [Symbols that should not be listed in the preloaded symbols])\n_LT_TAGDECL([], [include_expsyms], [1],\n    [Symbols that must always be exported])\n_LT_TAGDECL([], [prelink_cmds], [2],\n    [Commands necessary for linking programs (against libraries) with templates])\n_LT_TAGDECL([], [postlink_cmds], [2],\n    [Commands necessary for finishing linking programs])\n_LT_TAGDECL([], [file_list_spec], [1],\n    [Specify filename containing input files])\ndnl FIXME: Not yet implemented\ndnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],\ndnl    [Compiler flag to generate thread safe objects])\n])# _LT_LINKER_SHLIBS\n\n\n# _LT_LANG_C_CONFIG([TAG])\n# ------------------------\n# Ensure that the configuration variables for a C compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_C_CONFIG],\n[m4_require([_LT_DECL_EGREP])dnl\nlt_save_CC=\"$CC\"\nAC_LANG_PUSH(C)\n\n# Source file extension for C test sources.\nac_ext=c\n\n# Object file extension for compiled C test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"int some_variable = 0;\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='int main(){return(0);}'\n\n_LT_TAG_COMPILER\n# Save the default compiler, since it gets overwritten when the other\n# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.\ncompiler_DEFAULT=$CC\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_SYS_DYNAMIC_LINKER($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n  LT_SYS_DLOPEN_SELF\n  _LT_CMD_STRIPLIB\n\n  # Report which library types will actually be built\n  AC_MSG_CHECKING([if libtool supports shared libraries])\n  AC_MSG_RESULT([$can_build_shared])\n\n  AC_MSG_CHECKING([whether to build shared libraries])\n  test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n  # On AIX, shared libraries and static libraries use the same namespace, and\n  # are all built from PIC.\n  case $host_os in\n  aix3*)\n    test \"$enable_shared\" = yes && enable_static=no\n    if test -n \"$RANLIB\"; then\n      archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n      postinstall_cmds='$RANLIB $lib'\n    fi\n    ;;\n\n  aix[[4-9]]*)\n    if test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n      test \"$enable_shared\" = yes && enable_static=no\n    fi\n    ;;\n  esac\n  AC_MSG_RESULT([$enable_shared])\n\n  AC_MSG_CHECKING([whether to build static libraries])\n  # Make sure either enable_shared or enable_static is yes.\n  test \"$enable_shared\" = yes || enable_static=yes\n  AC_MSG_RESULT([$enable_static])\n\n  _LT_CONFIG($1)\nfi\nAC_LANG_POP\nCC=\"$lt_save_CC\"\n])# _LT_LANG_C_CONFIG\n\n\n# _LT_LANG_CXX_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a C++ compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_CXX_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_PATH_MANIFEST_TOOL])dnl\nif test -n \"$CXX\" && ( test \"X$CXX\" != \"Xno\" &&\n    ( (test \"X$CXX\" = \"Xg++\" && `g++ -v >/dev/null 2>&1` ) ||\n    (test \"X$CXX\" != \"Xg++\"))) ; then\n  AC_PROG_CXXCPP\nelse\n  _lt_caught_CXX_error=yes\nfi\n\nAC_LANG_PUSH(C++)\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(compiler_needs_object, $1)=no\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for C++ test sources.\nac_ext=cpp\n\n# Object file extension for compiled C++ test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the CXX compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_caught_CXX_error\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"int some_variable = 0;\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=$CC\n  lt_save_CFLAGS=$CFLAGS\n  lt_save_LD=$LD\n  lt_save_GCC=$GCC\n  GCC=$GXX\n  lt_save_with_gnu_ld=$with_gnu_ld\n  lt_save_path_LD=$lt_cv_path_LD\n  if test -n \"${lt_cv_prog_gnu_ldcxx+set}\"; then\n    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx\n  else\n    $as_unset lt_cv_prog_gnu_ld\n  fi\n  if test -n \"${lt_cv_path_LDCXX+set}\"; then\n    lt_cv_path_LD=$lt_cv_path_LDCXX\n  else\n    $as_unset lt_cv_path_LD\n  fi\n  test -z \"${LDCXX+set}\" || LD=$LDCXX\n  CC=${CXX-\"c++\"}\n  CFLAGS=$CXXFLAGS\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    # We don't want -fno-exception when compiling C++ code, so set the\n    # no_builtin_flag separately\n    if test \"$GXX\" = yes; then\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'\n    else\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n    fi\n\n    if test \"$GXX\" = yes; then\n      # Set up default GNU C++ configuration\n\n      LT_PATH_LD\n\n      # Check if GNU C++ uses GNU ld as the underlying linker, since the\n      # archiving commands below assume that GNU ld is being used.\n      if test \"$with_gnu_ld\" = yes; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n        # If archive_cmds runs LD, not CC, wlarc should be empty\n        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to\n        #     investigate it a little bit more. (MM)\n        wlarc='${wl}'\n\n        # ancient GNU ld didn't support --whole-archive et. al.\n        if eval \"`$CC -print-prog-name=ld` --help 2>&1\" |\n\t  $GREP 'no-whole-archive' > /dev/null; then\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n        else\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\n        fi\n      else\n        with_gnu_ld=no\n        wlarc=\n\n        # A generic and very simple default shared library creation\n        # command for GNU C++ for the case where it uses the native\n        # linker, instead of GNU ld.  If possible, this setting should\n        # overridden to take advantage of the native linker features on\n        # the platform it is being used on.\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n      fi\n\n      # Commands to make compiler produce verbose output that lists\n      # what \"hidden\" libraries, object files and flags are used when\n      # linking a shared library.\n      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n    else\n      GXX=no\n      with_gnu_ld=no\n      wlarc=\n    fi\n\n    # PORTME: fill in a description of your system's C++ link characteristics\n    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\n    _LT_TAGVAR(ld_shlibs, $1)=yes\n    case $host_os in\n      aix3*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n      aix[[4-9]]*)\n        if test \"$host_cpu\" = ia64; then\n          # On IA64, the linker does run time linking by default, so we don't\n          # have to do anything special.\n          aix_use_runtimelinking=no\n          exp_sym_flag='-Bexport'\n          no_entry_flag=\"\"\n        else\n          aix_use_runtimelinking=no\n\n          # Test if we are trying to use run time linking or normal\n          # AIX style linking. If -brtl is somewhere in LDFLAGS, we\n          # need to do runtime linking.\n          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t    for ld_flag in $LDFLAGS; do\n\t      case $ld_flag in\n\t      *-brtl*)\n\t        aix_use_runtimelinking=yes\n\t        break\n\t        ;;\n\t      esac\n\t    done\n\t    ;;\n          esac\n\n          exp_sym_flag='-bexport'\n          no_entry_flag='-bnoentry'\n        fi\n\n        # When large executables or shared objects are built, AIX ld can\n        # have problems creating the table of contents.  If linking a library\n        # or program results in \"error TOC overflow\" add -mminimal-toc to\n        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n        _LT_TAGVAR(archive_cmds, $1)=''\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n        if test \"$GXX\" = yes; then\n          case $host_os in aix4.[[012]]|aix4.[[012]].*)\n          # We only want to do this on AIX 4.2 and lower, the check\n          # below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t     strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t    # We have reworked collect2\n\t    :\n\t  else\n\t    # We have old collect2\n\t    _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t    # It fails to find uninstalled libraries when the uninstalled\n\t    # path is not listed in the libpath.  Setting hardcode_minus_L\n\t    # to unsupported forces relinking\n\t    _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n          esac\n          shared_flag='-shared'\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag=\"$shared_flag \"'${wl}-G'\n\t  fi\n        else\n          # not using gcc\n          if test \"$host_cpu\" = ia64; then\n\t  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t  # chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n          else\n\t    if test \"$aix_use_runtimelinking\" = yes; then\n\t      shared_flag='${wl}-G'\n\t    else\n\t      shared_flag='${wl}-bM:SRE'\n\t    fi\n          fi\n        fi\n\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n        # It seems that -bexpall does not export symbols beginning with\n        # underscore (_), so it is better to generate a list of symbols to\n\t# export.\n        _LT_TAGVAR(always_export_symbols, $1)=yes\n        if test \"$aix_use_runtimelinking\" = yes; then\n          # Warning - without using the other runtime loading flags (-brtl),\n          # -berok will link without error, but may produce a broken library.\n          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n          # Determine the default libpath from the value encoded in an empty\n          # executable.\n          _LT_SYS_MODULE_PATH_AIX([$1])\n          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n        else\n          if test \"$host_cpu\" = ia64; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n          else\n\t    # Determine the default libpath from the value encoded in an\n\t    # empty executable.\n\t    _LT_SYS_MODULE_PATH_AIX([$1])\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t    # Warning - without using the other run time loading flags,\n\t    # -berok will link without error, but may produce a broken library.\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t    if test \"$with_gnu_ld\" = yes; then\n\t      # We only use this code for GNU lds that support --whole-archive.\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    else\n\t      # Exported symbols can be pulled into shared objects from archives\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t    fi\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t    # This is similar to how AIX traditionally builds its shared\n\t    # libraries.\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n          fi\n        fi\n        ;;\n\n      beos*)\n\tif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t  # support --undefined.  This deserves some investigation.  FIXME\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      chorus*)\n        case $cc_basename in\n          *)\n\t  # FIXME: insert proper C++ library support\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\t  ;;\n        esac\n        ;;\n\n      cygwin* | mingw* | pw32* | cegcc*)\n\tcase $GXX,$cc_basename in\n\t,cl* | no,cl*)\n\t  # Native MSVC\n\t  # hardcode_libdir_flag_spec is actually meaningless, as there is\n\t  # no search path for DLLs.\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  _LT_TAGVAR(always_export_symbols, $1)=yes\n\t  _LT_TAGVAR(file_list_spec, $1)='@'\n\t  # Tell ltmain to make .lib files, not .a files.\n\t  libext=lib\n\t  # Tell ltmain to make .dll files, not .so files.\n\t  shrext_cmds=\".dll\"\n\t  # FIXME: Setting linknames here is a bad hack.\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      $SED -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t    else\n\t      $SED -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t    fi~\n\t    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t    linknames='\n\t  # The linker will not automatically build a static lib if we build a DLL.\n\t  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t  # Don't use ranlib\n\t  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'\n\t  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile=\"@OUTPUT@\"~\n\t    lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t    case $lt_outputfile in\n\t      *.exe|*.EXE) ;;\n\t      *)\n\t\tlt_outputfile=\"$lt_outputfile.exe\"\n\t\tlt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t\t;;\n\t    esac~\n\t    func_to_tool_file \"$lt_outputfile\"~\n\t    if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t      $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t      $RM \"$lt_outputfile.manifest\";\n\t    fi'\n\t  ;;\n\t*)\n\t  # g++\n\t  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n\t  # as there is no search path for DLLs.\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  _LT_TAGVAR(always_export_symbols, $1)=no\n\t  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\n\t  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t    # If the export-symbols file already is a .def file (1st line\n\t    # is EXPORTS), use it as is; otherwise, prepend...\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      cp $export_symbols $output_objdir/$soname.def;\n\t    else\n\t      echo EXPORTS > $output_objdir/$soname.def;\n\t      cat $export_symbols >> $output_objdir/$soname.def;\n\t    fi~\n\t    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t  ;;\n\tesac\n\t;;\n      darwin* | rhapsody*)\n        _LT_DARWIN_LINKER_FEATURES($1)\n\t;;\n\n      dgux*)\n        case $cc_basename in\n          ec++*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          ghcx*)\n\t    # Green Hills C++ Compiler\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      freebsd2.*)\n        # C++ shared libraries reported to be fairly broken before\n\t# switch to ELF\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      freebsd-elf*)\n        _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n        ;;\n\n      freebsd* | dragonfly*)\n        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF\n        # conventions\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n        ;;\n\n      gnu*)\n        ;;\n\n      haiku*)\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        ;;\n\n      hpux9*)\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t             # but as the default\n\t\t\t\t             # location of the library.\n\n        case $cc_basename in\n          CC*)\n            # FIXME: insert proper C++ library support\n            _LT_TAGVAR(ld_shlibs, $1)=no\n            ;;\n          aCC*)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            # Commands to make compiler produce verbose output that lists\n            # what \"hidden\" libraries, object files and flags are used when\n            # linking a shared library.\n            #\n            # There doesn't appear to be a way to prevent this compiler from\n            # explicitly linking system object files so we need to strip them\n            # from the output so that they don't get included in the library\n            # dependencies.\n            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n            ;;\n          *)\n            if test \"$GXX\" = yes; then\n              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            else\n              # FIXME: insert proper C++ library support\n              _LT_TAGVAR(ld_shlibs, $1)=no\n            fi\n            ;;\n        esac\n        ;;\n\n      hpux10*|hpux11*)\n        if test $with_gnu_ld = no; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n          case $host_cpu in\n            hppa*64*|ia64*)\n              ;;\n            *)\n\t      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n              ;;\n          esac\n        fi\n        case $host_cpu in\n          hppa*64*|ia64*)\n            _LT_TAGVAR(hardcode_direct, $1)=no\n            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n            ;;\n          *)\n            _LT_TAGVAR(hardcode_direct, $1)=yes\n            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t\t         # but as the default\n\t\t\t\t\t         # location of the library.\n            ;;\n        esac\n\n        case $cc_basename in\n          CC*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          aCC*)\n\t    case $host_cpu in\n\t      hppa*64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      ia64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      *)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t    esac\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test $with_gnu_ld = no; then\n\t        case $host_cpu in\n\t          hppa*64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          ia64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          *)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t        esac\n\t      fi\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      interix[[3-9]]*)\n\t_LT_TAGVAR(hardcode_direct, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n\t# Instead, shared libraries are loaded at an image base (0x10000000 by\n\t# default) and relocated if they conflict, which is a slow very memory\n\t# consuming and fragmenting process.  To avoid this, we pick a random,\n\t# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n\t# time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t;;\n      irix5* | irix6*)\n        case $cc_basename in\n          CC*)\n\t    # SGI C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -ar\", where \"CC\" is the IRIX C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test \"$with_gnu_ld\" = no; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t      else\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` -o $lib'\n\t      fi\n\t    fi\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\t    ;;\n        esac\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(inherit_rpath, $1)=yes\n        ;;\n\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib ${wl}-retain-symbols-file,$export_symbols; mv \\$templib $lib'\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP \"ld\"`; rm -f libconftest$shared_ext; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -Bstatic\", where \"CC\" is the KAI C++ compiler.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'\n\t    ;;\n\t  icpc* | ecpc* )\n\t    # Intel C++\n\t    with_gnu_ld=yes\n\t    # version 8.0 and above of icpc choke on multiply defined symbols\n\t    # if we add $predep_objects and $postdep_objects, however 7.1 and\n\t    # earlier do not add the objects themselves.\n\t    case `$CC -V 2>&1` in\n\t      *\"Version 7.\"*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t      *)  # Version 8.0 or newer\n\t        tmp_idyn=\n\t        case $host_cpu in\n\t\t  ia64*) tmp_idyn=' -i_dynamic';;\n\t\tesac\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t    esac\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    ;;\n          pgCC* | pgcpp*)\n            # Portland Group C++ compiler\n\t    case `$CC -V` in\n\t    *pgCC\\ [[1-5]].* | *pgcpp\\ [[1-5]].*)\n\t      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~\n\t\tcompile_command=\"$compile_command `find $tpldir -name \\*.o | sort | $NL2SP`\"'\n\t      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~\n\t\t$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \\*.o | sort | $NL2SP`~\n\t\t$RANLIB $oldlib'\n\t      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    *) # Version 6 and above use weak symbols\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n            ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'\n\n\t    runpath_var=LD_RUN_PATH\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld .*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"X$list\" | $Xsed'\n\t    ;;\n\t  xl* | mpixl* | bgxl*)\n\t    # IBM XL 8.0 on PPC, with GNU ld\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    if test \"x$supports_anon_versioning\" = xyes; then\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t\tcat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t\techo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t\t$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n\t    fi\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t      _LT_TAGVAR(compiler_needs_object, $1)=yes\n\n\t      # Not sure whether something based on\n\t      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1\n\t      # would be better.\n\t      output_verbose_link_cmd='func_echo_all'\n\n\t      # Archives containing C++ object files must be created using\n\t      # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t      # necessary to make sure instantiated templates are included\n\t      # in the archive.\n\t      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n\n      lynxos*)\n        # FIXME: insert proper C++ library support\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      m88k*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      mvs*)\n        case $cc_basename in\n          cxx*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\t  *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\tesac\n\t;;\n\n      netbsd*)\n        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'\n\t  wlarc=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\tfi\n\t# Workaround some broken pre-1.5 toolchains\n\toutput_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e \"s:-lgcc -lc -lgcc::\"'\n\t;;\n\n      *nto* | *qnx*)\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n\t;;\n\n      openbsd2*)\n        # C++ shared libraries are fairly broken\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      openbsd*)\n\tif test -f /usr/libexec/ld.so; then\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  if test -z \"`echo __ELF__ | $CC -E - | grep __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n\t  fi\n\t  output_verbose_link_cmd=func_echo_all\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      osf3* | osf4* | osf5*)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo \"$lib\" | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Archives containing C++ object files must be created using\n\t    # the KAI C++ compiler.\n\t    case $host in\n\t      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;\n\t      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;\n\t    esac\n\t    ;;\n          RCC*)\n\t    # Rational C++ 2.4.1\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          cxx*)\n\t    case $host in\n\t      osf3*)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t\t;;\n\t      *)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done~\n\t          echo \"-hidden\">> $lib.exp~\n\t          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~\n\t          $RM $lib.exp'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t\t;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\" | $GREP -v \"ld:\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld.*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n\t  *)\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t      case $host in\n\t        osf3*)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t        *)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t      esac\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t      # Commands to make compiler produce verbose output that lists\n\t      # what \"hidden\" libraries, object files and flags are used when\n\t      # linking a shared library.\n\t      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      psos*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      sunos4*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.x\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          lcc*)\n\t    # Lucid\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      solaris*)\n        case $cc_basename in\n          CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t    case $host_os in\n\t      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t      *)\n\t\t# The compiler driver will combine and reorder linker options,\n\t\t# but understands `-z linker_flag'.\n\t        # Supported since Solaris 2.6 (maybe 2.5.1?)\n\t\t_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\t        ;;\n\t    esac\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\n\t    output_verbose_link_cmd='func_echo_all'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t    ;;\n          gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\n\t    # The C++ compiler must be used to create the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    # GNU C++ compiler with Solaris linker\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'\n\t      if $CC --version | $GREP -v '^2\\.7' > /dev/null; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      else\n\t        # g++ 2.7 appears to require `-G' NOT `-shared' on this\n\t        # platform.\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      fi\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'\n\t      case $host_os in\n\t\tsolaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t\t*)\n\t\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\t\t  ;;\n\t      esac\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      case $cc_basename in\n        CC*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n      esac\n      ;;\n\n      sysv5* | sco3.2v5* | sco5v6*)\n\t# Note: We can NOT use -z defs as we might desire, because we do not\n\t# link with -lc, and that would cause any symbols used from libc to\n\t# always be unresolved, which means just about no library would\n\t# ever link correctly.  If we're not using GNU ld we use -z text\n\t# though, which does catch some bad symbols but isn't as heavy-handed\n\t# as -z defs.\n\t_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n\t_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n\t_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n\t_LT_TAGVAR(link_all_deplibs, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n\trunpath_var='LD_RUN_PATH'\n\n\tcase $cc_basename in\n          CC*)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~\n\t      '\"$_LT_TAGVAR(old_archive_cmds, $1)\"\n\t    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~\n\t      '\"$_LT_TAGVAR(reload_cmds, $1)\"\n\t    ;;\n\t  *)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\tesac\n      ;;\n\n      tandem*)\n        case $cc_basename in\n          NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      vxworks*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      *)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n    esac\n\n    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\n    test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n    _LT_TAGVAR(GCC, $1)=\"$GXX\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\n  LDCXX=$LD\n  LD=$lt_save_LD\n  GCC=$lt_save_GCC\n  with_gnu_ld=$lt_save_with_gnu_ld\n  lt_cv_path_LDCXX=$lt_cv_path_LD\n  lt_cv_path_LD=$lt_save_path_LD\n  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld\n  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld\nfi # test \"$_lt_caught_CXX_error\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_CXX_CONFIG\n\n\n# _LT_FUNC_STRIPNAME_CNF\n# ----------------------\n# func_stripname_cnf prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n#\n# This function is identical to the (non-XSI) version of func_stripname,\n# except this one can be used by m4 code that may be executed by configure,\n# rather than the libtool script.\nm4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl\nAC_REQUIRE([_LT_DECL_SED])\nAC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])\nfunc_stripname_cnf ()\n{\n  case ${2} in\n  .*) func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%\\\\\\\\${2}\\$%%\"`;;\n  *)  func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%${2}\\$%%\"`;;\n  esac\n} # func_stripname_cnf\n])# _LT_FUNC_STRIPNAME_CNF\n\n# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])\n# ---------------------------------\n# Figure out \"hidden\" library dependencies from verbose\n# compiler output when linking a shared library.\n# Parse the compiler output and extract the necessary\n# objects, libraries and library flags.\nm4_defun([_LT_SYS_HIDDEN_LIBDEPS],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nAC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl\n# Dependencies to place before and after the object being linked:\n_LT_TAGVAR(predep_objects, $1)=\n_LT_TAGVAR(postdep_objects, $1)=\n_LT_TAGVAR(predeps, $1)=\n_LT_TAGVAR(postdeps, $1)=\n_LT_TAGVAR(compiler_lib_search_path, $1)=\n\ndnl we can't use the lt_simple_compile_test_code here,\ndnl because it contains code intended for an executable,\ndnl not a library.  It's possible we should let each\ndnl tag define a new lt_????_link_test_code variable,\ndnl but it's only used here...\nm4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF\nint a;\nvoid foo (void) { a = 0; }\n_LT_EOF\n], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF\nclass Foo\n{\npublic:\n  Foo (void) { a = 0; }\nprivate:\n  int a;\n};\n_LT_EOF\n], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer*4 a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF\npublic class foo {\n  private int a;\n  public void bar (void) {\n    a = 0;\n  }\n};\n_LT_EOF\n], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF\npackage foo\nfunc foo() {\n}\n_LT_EOF\n])\n\n_lt_libdeps_save_CFLAGS=$CFLAGS\ncase \"$CC $CFLAGS \" in #(\n*\\ -flto*\\ *) CFLAGS=\"$CFLAGS -fno-lto\" ;;\n*\\ -fwhopr*\\ *) CFLAGS=\"$CFLAGS -fno-whopr\" ;;\n*\\ -fuse-linker-plugin*\\ *) CFLAGS=\"$CFLAGS -fno-use-linker-plugin\" ;;\nesac\n\ndnl Parse the compiler output and extract the necessary\ndnl objects, libraries and library flags.\nif AC_TRY_EVAL(ac_compile); then\n  # Parse the compiler output and extract the necessary\n  # objects, libraries and library flags.\n\n  # Sentinel used to keep track of whether or not we are before\n  # the conftest object file.\n  pre_test_object_deps_done=no\n\n  for p in `eval \"$output_verbose_link_cmd\"`; do\n    case ${prev}${p} in\n\n    -L* | -R* | -l*)\n       # Some compilers place space between \"-{L,R}\" and the path.\n       # Remove the space.\n       if test $p = \"-L\" ||\n          test $p = \"-R\"; then\n\t prev=$p\n\t continue\n       fi\n\n       # Expand the sysroot to ease extracting the directories later.\n       if test -z \"$prev\"; then\n         case $p in\n         -L*) func_stripname_cnf '-L' '' \"$p\"; prev=-L; p=$func_stripname_result ;;\n         -R*) func_stripname_cnf '-R' '' \"$p\"; prev=-R; p=$func_stripname_result ;;\n         -l*) func_stripname_cnf '-l' '' \"$p\"; prev=-l; p=$func_stripname_result ;;\n         esac\n       fi\n       case $p in\n       =*) func_stripname_cnf '=' '' \"$p\"; p=$lt_sysroot$func_stripname_result ;;\n       esac\n       if test \"$pre_test_object_deps_done\" = no; then\n\t case ${prev} in\n\t -L | -R)\n\t   # Internal compiler library paths should come after those\n\t   # provided the user.  The postdeps already come after the\n\t   # user supplied libs so there is no need to process them.\n\t   if test -z \"$_LT_TAGVAR(compiler_lib_search_path, $1)\"; then\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${prev}${p}\"\n\t   else\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}\"\n\t   fi\n\t   ;;\n\t # The \"-l\" case would never come before the object being\n\t # linked, so don't bother handling this case.\n\t esac\n       else\n\t if test -z \"$_LT_TAGVAR(postdeps, $1)\"; then\n\t   _LT_TAGVAR(postdeps, $1)=\"${prev}${p}\"\n\t else\n\t   _LT_TAGVAR(postdeps, $1)=\"${_LT_TAGVAR(postdeps, $1)} ${prev}${p}\"\n\t fi\n       fi\n       prev=\n       ;;\n\n    *.lto.$objext) ;; # Ignore GCC LTO objects\n    *.$objext)\n       # This assumes that the test object file only shows up\n       # once in the compiler output.\n       if test \"$p\" = \"conftest.$objext\"; then\n\t pre_test_object_deps_done=yes\n\t continue\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t if test -z \"$_LT_TAGVAR(predep_objects, $1)\"; then\n\t   _LT_TAGVAR(predep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(predep_objects, $1)=\"$_LT_TAGVAR(predep_objects, $1) $p\"\n\t fi\n       else\n\t if test -z \"$_LT_TAGVAR(postdep_objects, $1)\"; then\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$_LT_TAGVAR(postdep_objects, $1) $p\"\n\t fi\n       fi\n       ;;\n\n    *) ;; # Ignore the rest.\n\n    esac\n  done\n\n  # Clean up.\n  rm -f a.out a.exe\nelse\n  echo \"libtool.m4: error: problem compiling $1 test program\"\nfi\n\n$RM -f confest.$objext\nCFLAGS=$_lt_libdeps_save_CFLAGS\n\n# PORTME: override above test on systems where it is broken\nm4_if([$1], [CXX],\n[case $host_os in\ninterix[[3-9]]*)\n  # Interix 3.5 installs completely hosed .la files for C++, so rather than\n  # hack all around it, let's just trust \"g++\" to DTRT.\n  _LT_TAGVAR(predep_objects,$1)=\n  _LT_TAGVAR(postdep_objects,$1)=\n  _LT_TAGVAR(postdeps,$1)=\n  ;;\n\nlinux*)\n  case `$CC -V 2>&1 | sed 5q` in\n  *Sun\\ C*)\n    # Sun C++ 5.9\n\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\n\nsolaris*)\n  case $cc_basename in\n  CC* | sunCC*)\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    # Adding this requires a known-good setup of shared libraries for\n    # Sun compiler versions before 5.6, else PIC objects from an old\n    # archive will be linked into the output, leading to subtle bugs.\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\nesac\n])\n\ncase \" $_LT_TAGVAR(postdeps, $1) \" in\n*\" -lc \"*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;\nesac\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=\nif test -n \"${_LT_TAGVAR(compiler_lib_search_path, $1)}\"; then\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo \" ${_LT_TAGVAR(compiler_lib_search_path, $1)}\" | ${SED} -e 's! -L! !g' -e 's!^ !!'`\nfi\n_LT_TAGDECL([], [compiler_lib_search_dirs], [1],\n    [The directories searched by this compiler when creating a shared library])\n_LT_TAGDECL([], [predep_objects], [1],\n    [Dependencies to place before and after the objects being linked to\n    create a shared library])\n_LT_TAGDECL([], [postdep_objects], [1])\n_LT_TAGDECL([], [predeps], [1])\n_LT_TAGDECL([], [postdeps], [1])\n_LT_TAGDECL([], [compiler_lib_search_path], [1],\n    [The library search path used internally by the compiler when linking\n    a shared library])\n])# _LT_SYS_HIDDEN_LIBDEPS\n\n\n# _LT_LANG_F77_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a Fortran 77 compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_F77_CONFIG],\n[AC_LANG_PUSH(Fortran 77)\nif test -z \"$F77\" || test \"X$F77\" = \"Xno\"; then\n  _lt_disable_F77=yes\nfi\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for f77 test sources.\nac_ext=f\n\n# Object file extension for compiled f77 test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the F77 compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_F77\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  lt_save_CFLAGS=$CFLAGS\n  CC=${F77-\"f77\"}\n  CFLAGS=$FFLAGS\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n  GCC=$G77\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$G77\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=\"$lt_save_CC\"\n  CFLAGS=\"$lt_save_CFLAGS\"\nfi # test \"$_lt_disable_F77\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_F77_CONFIG\n\n\n# _LT_LANG_FC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for a Fortran compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_FC_CONFIG],\n[AC_LANG_PUSH(Fortran)\n\nif test -z \"$FC\" || test \"X$FC\" = \"Xno\"; then\n  _lt_disable_FC=yes\nfi\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for fc test sources.\nac_ext=${ac_fc_srcext-f}\n\n# Object file extension for compiled fc test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the FC compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_FC\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  lt_save_CFLAGS=$CFLAGS\n  CC=${FC-\"f95\"}\n  CFLAGS=$FCFLAGS\n  compiler=$CC\n  GCC=$ac_cv_fc_compiler_gnu\n\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$ac_cv_fc_compiler_gnu\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\nfi # test \"$_lt_disable_FC\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_FC_CONFIG\n\n\n# _LT_LANG_GCJ_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for the GNU Java Compiler compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_GCJ_CONFIG],\n[AC_REQUIRE([LT_PROG_GCJ])dnl\nAC_LANG_SAVE\n\n# Source file extension for Java test sources.\nac_ext=java\n\n# Object file extension for compiled Java test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"class foo {}\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=$CC\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=yes\nCC=${GCJ-\"gcj\"}\nCFLAGS=$GCJFLAGS\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_TAGVAR(LD, $1)=\"$LD\"\n_LT_CC_BASENAME([$compiler])\n\n# GCJ did not exist at the time GCC didn't implicitly link libc in.\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n\n  _LT_CONFIG($1)\nfi\n\nAC_LANG_RESTORE\n\nGCC=$lt_save_GCC\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_GCJ_CONFIG\n\n\n# _LT_LANG_GO_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for the GNU Go compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_GO_CONFIG],\n[AC_REQUIRE([LT_PROG_GO])dnl\nAC_LANG_SAVE\n\n# Source file extension for Go test sources.\nac_ext=go\n\n# Object file extension for compiled Go test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"package main; func main() { }\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='package main; func main() { }'\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=$CC\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=yes\nCC=${GOC-\"gccgo\"}\nCFLAGS=$GOFLAGS\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_TAGVAR(LD, $1)=\"$LD\"\n_LT_CC_BASENAME([$compiler])\n\n# Go did not exist at the time GCC didn't implicitly link libc in.\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n\n  _LT_CONFIG($1)\nfi\n\nAC_LANG_RESTORE\n\nGCC=$lt_save_GCC\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_GO_CONFIG\n\n\n# _LT_LANG_RC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for the Windows resource compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_RC_CONFIG],\n[AC_REQUIRE([LT_PROG_RC])dnl\nAC_LANG_SAVE\n\n# Source file extension for RC test sources.\nac_ext=rc\n\n# Object file extension for compiled RC test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code='sample MENU { MENUITEM \"&Soup\", 100, CHECKED }'\n\n# Code to be used in simple link tests\nlt_simple_link_test_code=\"$lt_simple_compile_test_code\"\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=\"$CC\"\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=\nCC=${RC-\"windres\"}\nCFLAGS=\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_CC_BASENAME([$compiler])\n_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n\nif test -n \"$compiler\"; then\n  :\n  _LT_CONFIG($1)\nfi\n\nGCC=$lt_save_GCC\nAC_LANG_RESTORE\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_RC_CONFIG\n\n\n# LT_PROG_GCJ\n# -----------\nAC_DEFUN([LT_PROG_GCJ],\n[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],\n  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],\n    [AC_CHECK_TOOL(GCJ, gcj,)\n      test \"x${GCJFLAGS+set}\" = xset || GCJFLAGS=\"-g -O2\"\n      AC_SUBST(GCJFLAGS)])])[]dnl\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_GCJ], [])\n\n\n# LT_PROG_GO\n# ----------\nAC_DEFUN([LT_PROG_GO],\n[AC_CHECK_TOOL(GOC, gccgo,)\n])\n\n\n# LT_PROG_RC\n# ----------\nAC_DEFUN([LT_PROG_RC],\n[AC_CHECK_TOOL(RC, windres,)\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_RC], [])\n\n\n# _LT_DECL_EGREP\n# --------------\n# If we don't have a new enough Autoconf to choose the best grep\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_EGREP],\n[AC_REQUIRE([AC_PROG_EGREP])dnl\nAC_REQUIRE([AC_PROG_FGREP])dnl\ntest -z \"$GREP\" && GREP=grep\n_LT_DECL([], [GREP], [1], [A grep program that handles long lines])\n_LT_DECL([], [EGREP], [1], [An ERE matcher])\n_LT_DECL([], [FGREP], [1], [A literal string matcher])\ndnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too\nAC_SUBST([GREP])\n])\n\n\n# _LT_DECL_OBJDUMP\n# --------------\n# If we don't have a new enough Autoconf to choose the best objdump\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_OBJDUMP],\n[AC_CHECK_TOOL(OBJDUMP, objdump, false)\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])\nAC_SUBST([OBJDUMP])\n])\n\n# _LT_DECL_DLLTOOL\n# ----------------\n# Ensure DLLTOOL variable is set.\nm4_defun([_LT_DECL_DLLTOOL],\n[AC_CHECK_TOOL(DLLTOOL, dlltool, false)\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [1], [DLL creation program])\nAC_SUBST([DLLTOOL])\n])\n\n# _LT_DECL_SED\n# ------------\n# Check for a fully-functional sed program, that truncates\n# as few characters as possible.  Prefer GNU sed if found.\nm4_defun([_LT_DECL_SED],\n[AC_PROG_SED\ntest -z \"$SED\" && SED=sed\nXsed=\"$SED -e 1s/^X//\"\n_LT_DECL([], [SED], [1], [A sed program that does not truncate output])\n_LT_DECL([], [Xsed], [\"\\$SED -e 1s/^X//\"],\n    [Sed that helps us avoid accidentally triggering echo(1) options like -n])\n])# _LT_DECL_SED\n\nm4_ifndef([AC_PROG_SED], [\n############################################################\n# NOTE: This macro has been submitted for inclusion into   #\n#  GNU Autoconf as AC_PROG_SED.  When it is available in   #\n#  a released version of Autoconf we should remove this    #\n#  macro and use it instead.                               #\n############################################################\n\nm4_defun([AC_PROG_SED],\n[AC_MSG_CHECKING([for a sed that does not truncate output])\nAC_CACHE_VAL(lt_cv_path_SED,\n[# Loop through the user's path and test for sed and gsed.\n# Then use that list of sed's as ones to test for truncation.\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n  for lt_ac_prog in sed gsed; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      if $as_executable_p \"$as_dir/$lt_ac_prog$ac_exec_ext\"; then\n        lt_ac_sed_list=\"$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext\"\n      fi\n    done\n  done\ndone\nIFS=$as_save_IFS\nlt_ac_max=0\nlt_ac_count=0\n# Add /usr/xpg4/bin/sed as it is typically found on Solaris\n# along with /bin/sed that truncates output.\nfor lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do\n  test ! -f $lt_ac_sed && continue\n  cat /dev/null > conftest.in\n  lt_ac_count=0\n  echo $ECHO_N \"0123456789$ECHO_C\" >conftest.in\n  # Check for GNU sed and select it if it is found.\n  if \"$lt_ac_sed\" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then\n    lt_cv_path_SED=$lt_ac_sed\n    break\n  fi\n  while true; do\n    cat conftest.in conftest.in >conftest.tmp\n    mv conftest.tmp conftest.in\n    cp conftest.in conftest.nl\n    echo >>conftest.nl\n    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break\n    cmp -s conftest.out conftest.nl || break\n    # 10000 chars as input seems more than enough\n    test $lt_ac_count -gt 10 && break\n    lt_ac_count=`expr $lt_ac_count + 1`\n    if test $lt_ac_count -gt $lt_ac_max; then\n      lt_ac_max=$lt_ac_count\n      lt_cv_path_SED=$lt_ac_sed\n    fi\n  done\ndone\n])\nSED=$lt_cv_path_SED\nAC_SUBST([SED])\nAC_MSG_RESULT([$SED])\n])#AC_PROG_SED\n])#m4_ifndef\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_SED], [])\n\n\n# _LT_CHECK_SHELL_FEATURES\n# ------------------------\n# Find out whether the shell is Bourne or XSI compatible,\n# or has some other useful features.\nm4_defun([_LT_CHECK_SHELL_FEATURES],\n[AC_MSG_CHECKING([whether the shell understands some XSI constructs])\n# Try some XSI features\nxsi_shell=no\n( _lt_dummy=\"a/b/c\"\n  test \"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}\"${_lt_dummy%\"$_lt_dummy\"}, \\\n      = c,a/b,b/c, \\\n    && eval 'test $(( 1 + 1 )) -eq 2 \\\n    && test \"${#_lt_dummy}\" -eq 5' ) >/dev/null 2>&1 \\\n  && xsi_shell=yes\nAC_MSG_RESULT([$xsi_shell])\n_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])\n\nAC_MSG_CHECKING([whether the shell understands \"+=\"])\nlt_shell_append=no\n( foo=bar; set foo baz; eval \"$[1]+=\\$[2]\" && test \"$foo\" = barbaz ) \\\n    >/dev/null 2>&1 \\\n  && lt_shell_append=yes\nAC_MSG_RESULT([$lt_shell_append])\n_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])\n\nif ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then\n  lt_unset=unset\nelse\n  lt_unset=false\nfi\n_LT_DECL([], [lt_unset], [0], [whether the shell understands \"unset\"])dnl\n\n# test EBCDIC or ASCII\ncase `echo X|tr X '\\101'` in\n A) # ASCII based system\n    # \\n is not interpreted correctly by Solaris 8 /usr/ucb/tr\n  lt_SP2NL='tr \\040 \\012'\n  lt_NL2SP='tr \\015\\012 \\040\\040'\n  ;;\n *) # EBCDIC based system\n  lt_SP2NL='tr \\100 \\n'\n  lt_NL2SP='tr \\r\\n \\100\\100'\n  ;;\nesac\n_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl\n_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl\n])# _LT_CHECK_SHELL_FEATURES\n\n\n# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)\n# ------------------------------------------------------\n# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and\n# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.\nm4_defun([_LT_PROG_FUNCTION_REPLACE],\n[dnl {\nsed -e '/^$1 ()$/,/^} # $1 /c\\\n$1 ()\\\n{\\\nm4_bpatsubsts([$2], [$], [\\\\], [^\\([\t ]\\)], [\\\\\\1])\n} # Extended-shell $1 implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n])\n\n\n# _LT_PROG_REPLACE_SHELLFNS\n# -------------------------\n# Replace existing portable implementations of several shell functions with\n# equivalent extended shell implementations where those features are available..\nm4_defun([_LT_PROG_REPLACE_SHELLFNS],\n[if test x\"$xsi_shell\" = xyes; then\n  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl\n    case ${1} in\n      */*) func_dirname_result=\"${1%/*}${2}\" ;;\n      *  ) func_dirname_result=\"${3}\" ;;\n    esac])\n\n  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl\n    func_basename_result=\"${1##*/}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl\n    case ${1} in\n      */*) func_dirname_result=\"${1%/*}${2}\" ;;\n      *  ) func_dirname_result=\"${3}\" ;;\n    esac\n    func_basename_result=\"${1##*/}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl\n    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\n    # positional parameters, so assign one to ordinary parameter first.\n    func_stripname_result=${3}\n    func_stripname_result=${func_stripname_result#\"${1}\"}\n    func_stripname_result=${func_stripname_result%\"${2}\"}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl\n    func_split_long_opt_name=${1%%=*}\n    func_split_long_opt_arg=${1#*=}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl\n    func_split_short_opt_arg=${1#??}\n    func_split_short_opt_name=${1%\"$func_split_short_opt_arg\"}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl\n    case ${1} in\n      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\n      *)    func_lo2o_result=${1} ;;\n    esac])\n\n  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])\n\n  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])\n\n  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])\nfi\n\nif test x\"$lt_shell_append\" = xyes; then\n  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval \"${1}+=\\\\${2}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl\n    func_quote_for_eval \"${2}\"\ndnl m4 expansion turns \\\\\\\\ into \\\\, and then the shell eval turns that into \\\n    eval \"${1}+=\\\\\\\\ \\\\$func_quote_for_eval_result\"])\n\n  # Save a `func_append' function call where possible by direct use of '+='\n  sed -e 's%func_append \\([[a-zA-Z_]]\\{1,\\}\\) \"%\\1+=\"%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nelse\n  # Save a `func_append' function call even when '+=' is not available\n  sed -e 's%func_append \\([[a-zA-Z_]]\\{1,\\}\\) \"%\\1=\"$\\1%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nfi\n\nif test x\"$_lt_function_replace_fail\" = x\":\"; then\n  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])\nfi\n])\n\n# _LT_PATH_CONVERSION_FUNCTIONS\n# -----------------------------\n# Determine which file name conversion functions should be used by\n# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed\n# for certain cross-compile configurations and native mingw.\nm4_defun([_LT_PATH_CONVERSION_FUNCTIONS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nAC_MSG_CHECKING([how to convert $build file names to $host format])\nAC_CACHE_VAL(lt_cv_to_host_file_cmd,\n[case $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32\n        ;;\n    esac\n    ;;\n  *-*-cygwin* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_noop\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin\n        ;;\n    esac\n    ;;\n  * ) # unhandled hosts (and \"normal\" native builds)\n    lt_cv_to_host_file_cmd=func_convert_file_noop\n    ;;\nesac\n])\nto_host_file_cmd=$lt_cv_to_host_file_cmd\nAC_MSG_RESULT([$lt_cv_to_host_file_cmd])\n_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],\n         [0], [convert $build file names to $host format])dnl\n\nAC_MSG_CHECKING([how to convert $build file names to toolchain format])\nAC_CACHE_VAL(lt_cv_to_tool_file_cmd,\n[#assume ordinary cross tools, or native build.\nlt_cv_to_tool_file_cmd=func_convert_file_noop\ncase $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32\n        ;;\n    esac\n    ;;\nesac\n])\nto_tool_file_cmd=$lt_cv_to_tool_file_cmd\nAC_MSG_RESULT([$lt_cv_to_tool_file_cmd])\n_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],\n         [0], [convert $build files to toolchain format])dnl\n])# _LT_PATH_CONVERSION_FUNCTIONS\n"
  },
  {
    "path": "Tests/gtest/m4/ltoptions.m4",
    "content": "# Helper functions for option handling.                    -*- Autoconf -*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,\n#   Inc.\n#   Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 7 ltoptions.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])\n\n\n# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)\n# ------------------------------------------\nm4_define([_LT_MANGLE_OPTION],\n[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])\n\n\n# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)\n# ---------------------------------------\n# Set option OPTION-NAME for macro MACRO-NAME, and if there is a\n# matching handler defined, dispatch to it.  Other OPTION-NAMEs are\n# saved as a flag.\nm4_define([_LT_SET_OPTION],\n[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl\nm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),\n        _LT_MANGLE_DEFUN([$1], [$2]),\n    [m4_warning([Unknown $1 option `$2'])])[]dnl\n])\n\n\n# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])\n# ------------------------------------------------------------\n# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.\nm4_define([_LT_IF_OPTION],\n[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])\n\n\n# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)\n# -------------------------------------------------------\n# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME\n# are set.\nm4_define([_LT_UNLESS_OPTIONS],\n[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n\t    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),\n\t\t      [m4_define([$0_found])])])[]dnl\nm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3\n])[]dnl\n])\n\n\n# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)\n# ----------------------------------------\n# OPTION-LIST is a space-separated list of Libtool options associated\n# with MACRO-NAME.  If any OPTION has a matching handler declared with\n# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about\n# the unknown option and exit.\nm4_defun([_LT_SET_OPTIONS],\n[# Set options\nm4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n    [_LT_SET_OPTION([$1], _LT_Option)])\n\nm4_if([$1],[LT_INIT],[\n  dnl\n  dnl Simply set some default values (i.e off) if boolean options were not\n  dnl specified:\n  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no\n  ])\n  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no\n  ])\n  dnl\n  dnl If no reference was made to various pairs of opposing options, then\n  dnl we run the default mode handler for the pair.  For example, if neither\n  dnl `shared' nor `disable-shared' was passed, we enable building of shared\n  dnl archives by default:\n  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])\n  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],\n  \t\t   [_LT_ENABLE_FAST_INSTALL])\n  ])\n])# _LT_SET_OPTIONS\n\n\n## --------------------------------- ##\n## Macros to handle LT_INIT options. ##\n## --------------------------------- ##\n\n# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)\n# -----------------------------------------\nm4_define([_LT_MANGLE_DEFUN],\n[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])\n\n\n# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)\n# -----------------------------------------------\nm4_define([LT_OPTION_DEFINE],\n[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl\n])# LT_OPTION_DEFINE\n\n\n# dlopen\n# ------\nLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes\n])\n\nAU_DEFUN([AC_LIBTOOL_DLOPEN],\n[_LT_SET_OPTION([LT_INIT], [dlopen])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `dlopen' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])\n\n\n# win32-dll\n# ---------\n# Declare package support for building win32 dll's.\nLT_OPTION_DEFINE([LT_INIT], [win32-dll],\n[enable_win32_dll=yes\n\ncase $host in\n*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)\n  AC_CHECK_TOOL(AS, as, false)\n  AC_CHECK_TOOL(DLLTOOL, dlltool, false)\n  AC_CHECK_TOOL(OBJDUMP, objdump, false)\n  ;;\nesac\n\ntest -z \"$AS\" && AS=as\n_LT_DECL([], [AS],      [1], [Assembler program])dnl\n\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl\n])# win32-dll\n\nAU_DEFUN([AC_LIBTOOL_WIN32_DLL],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n_LT_SET_OPTION([LT_INIT], [win32-dll])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `win32-dll' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])\n\n\n# _LT_ENABLE_SHARED([DEFAULT])\n# ----------------------------\n# implement the --enable-shared flag, and supports the `shared' and\n# `disable-shared' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_SHARED],\n[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([shared],\n    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],\n\t[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_shared=yes ;;\n    no) enable_shared=no ;;\n    *)\n      enable_shared=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_shared=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)\n\n    _LT_DECL([build_libtool_libs], [enable_shared], [0],\n\t[Whether or not to build shared libraries])\n])# _LT_ENABLE_SHARED\n\nLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])\n])\n\nAC_DEFUN([AC_DISABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], [disable-shared])\n])\n\nAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])\nAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_SHARED], [])\ndnl AC_DEFUN([AM_DISABLE_SHARED], [])\n\n\n\n# _LT_ENABLE_STATIC([DEFAULT])\n# ----------------------------\n# implement the --enable-static flag, and support the `static' and\n# `disable-static' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_STATIC],\n[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([static],\n    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],\n\t[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_static=yes ;;\n    no) enable_static=no ;;\n    *)\n     enable_static=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_static=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)\n\n    _LT_DECL([build_old_libs], [enable_static], [0],\n\t[Whether or not to build static libraries])\n])# _LT_ENABLE_STATIC\n\nLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])\n])\n\nAC_DEFUN([AC_DISABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], [disable-static])\n])\n\nAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])\nAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_STATIC], [])\ndnl AC_DEFUN([AM_DISABLE_STATIC], [])\n\n\n\n# _LT_ENABLE_FAST_INSTALL([DEFAULT])\n# ----------------------------------\n# implement the --enable-fast-install flag, and support the `fast-install'\n# and `disable-fast-install' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_FAST_INSTALL],\n[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([fast-install],\n    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],\n    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_fast_install=yes ;;\n    no) enable_fast_install=no ;;\n    *)\n      enable_fast_install=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_fast_install=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)\n\n_LT_DECL([fast_install], [enable_fast_install], [0],\n\t [Whether or not to optimize for fast installation])dnl\n])# _LT_ENABLE_FAST_INSTALL\n\nLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])\n\n# Old names:\nAU_DEFUN([AC_ENABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `fast-install' option into LT_INIT's first parameter.])\n])\n\nAU_DEFUN([AC_DISABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], [disable-fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `disable-fast-install' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])\ndnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])\n\n\n# _LT_WITH_PIC([MODE])\n# --------------------\n# implement the --with-pic flag, and support the `pic-only' and `no-pic'\n# LT_INIT options.\n# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.\nm4_define([_LT_WITH_PIC],\n[AC_ARG_WITH([pic],\n    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],\n\t[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],\n    [lt_p=${PACKAGE-default}\n    case $withval in\n    yes|no) pic_mode=$withval ;;\n    *)\n      pic_mode=default\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for lt_pkg in $withval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$lt_pkg\" = \"X$lt_p\"; then\n\t  pic_mode=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [pic_mode=default])\n\ntest -z \"$pic_mode\" && pic_mode=m4_default([$1], [default])\n\n_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl\n])# _LT_WITH_PIC\n\nLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])\n\n# Old name:\nAU_DEFUN([AC_LIBTOOL_PICMODE],\n[_LT_SET_OPTION([LT_INIT], [pic-only])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `pic-only' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])\n\n## ----------------- ##\n## LTDL_INIT Options ##\n## ----------------- ##\n\nm4_define([_LTDL_MODE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],\n\t\t [m4_define([_LTDL_MODE], [nonrecursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [recursive],\n\t\t [m4_define([_LTDL_MODE], [recursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [subproject],\n\t\t [m4_define([_LTDL_MODE], [subproject])])\n\nm4_define([_LTDL_TYPE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [installable],\n\t\t [m4_define([_LTDL_TYPE], [installable])])\nLT_OPTION_DEFINE([LTDL_INIT], [convenience],\n\t\t [m4_define([_LTDL_TYPE], [convenience])])\n"
  },
  {
    "path": "Tests/gtest/m4/ltsugar.m4",
    "content": "# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-\n#\n# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.\n# Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 6 ltsugar.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])\n\n\n# lt_join(SEP, ARG1, [ARG2...])\n# -----------------------------\n# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their\n# associated separator.\n# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier\n# versions in m4sugar had bugs.\nm4_define([lt_join],\n[m4_if([$#], [1], [],\n       [$#], [2], [[$2]],\n       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])\nm4_define([_lt_join],\n[m4_if([$#$2], [2], [],\n       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])\n\n\n# lt_car(LIST)\n# lt_cdr(LIST)\n# ------------\n# Manipulate m4 lists.\n# These macros are necessary as long as will still need to support\n# Autoconf-2.59 which quotes differently.\nm4_define([lt_car], [[$1]])\nm4_define([lt_cdr],\n[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],\n       [$#], 1, [],\n       [m4_dquote(m4_shift($@))])])\nm4_define([lt_unquote], $1)\n\n\n# lt_append(MACRO-NAME, STRING, [SEPARATOR])\n# ------------------------------------------\n# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.\n# Note that neither SEPARATOR nor STRING are expanded; they are appended\n# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).\n# No SEPARATOR is output if MACRO-NAME was previously undefined (different\n# than defined and empty).\n#\n# This macro is needed until we can rely on Autoconf 2.62, since earlier\n# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.\nm4_define([lt_append],\n[m4_define([$1],\n\t   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])\n\n\n\n# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])\n# ----------------------------------------------------------\n# Produce a SEP delimited list of all paired combinations of elements of\n# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list\n# has the form PREFIXmINFIXSUFFIXn.\n# Needed until we can rely on m4_combine added in Autoconf 2.62.\nm4_define([lt_combine],\n[m4_if(m4_eval([$# > 3]), [1],\n       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl\n[[m4_foreach([_Lt_prefix], [$2],\n\t     [m4_foreach([_Lt_suffix],\n\t\t]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,\n\t[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])\n\n\n# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])\n# -----------------------------------------------------------------------\n# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited\n# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.\nm4_define([lt_if_append_uniq],\n[m4_ifdef([$1],\n\t  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],\n\t\t [lt_append([$1], [$2], [$3])$4],\n\t\t [$5])],\n\t  [lt_append([$1], [$2], [$3])$4])])\n\n\n# lt_dict_add(DICT, KEY, VALUE)\n# -----------------------------\nm4_define([lt_dict_add],\n[m4_define([$1($2)], [$3])])\n\n\n# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)\n# --------------------------------------------\nm4_define([lt_dict_add_subkey],\n[m4_define([$1($2:$3)], [$4])])\n\n\n# lt_dict_fetch(DICT, KEY, [SUBKEY])\n# ----------------------------------\nm4_define([lt_dict_fetch],\n[m4_ifval([$3],\n\tm4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),\n    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])\n\n\n# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])\n# -----------------------------------------------------------------\nm4_define([lt_if_dict_fetch],\n[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],\n\t[$5],\n    [$6])])\n\n\n# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])\n# --------------------------------------------------------------\nm4_define([lt_dict_filter],\n[m4_if([$5], [], [],\n  [lt_join(m4_quote(m4_default([$4], [[, ]])),\n           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),\n\t\t      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl\n])\n"
  },
  {
    "path": "Tests/gtest/m4/ltversion.m4",
    "content": "# ltversion.m4 -- version numbers\t\t\t-*- Autoconf -*-\n#\n#   Copyright (C) 2004 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# @configure_input@\n\n# serial 3337 ltversion.m4\n# This file is part of GNU Libtool\n\nm4_define([LT_PACKAGE_VERSION], [2.4.2])\nm4_define([LT_PACKAGE_REVISION], [1.3337])\n\nAC_DEFUN([LTVERSION_VERSION],\n[macro_version='2.4.2'\nmacro_revision='1.3337'\n_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])\n_LT_DECL(, macro_revision, 0)\n])\n"
  },
  {
    "path": "Tests/gtest/m4/lt~obsolete.m4",
    "content": "# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004.\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 5 lt~obsolete.m4\n\n# These exist entirely to fool aclocal when bootstrapping libtool.\n#\n# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)\n# which have later been changed to m4_define as they aren't part of the\n# exported API, or moved to Autoconf or Automake where they belong.\n#\n# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN\n# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us\n# using a macro with the same name in our local m4/libtool.m4 it'll\n# pull the old libtool.m4 in (it doesn't see our shiny new m4_define\n# and doesn't know about Autoconf macros at all.)\n#\n# So we provide this file, which has a silly filename so it's always\n# included after everything else.  This provides aclocal with the\n# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything\n# because those macros already exist, or will be overwritten later.\n# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. \n#\n# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.\n# Yes, that means every name once taken will need to remain here until\n# we give up compatibility with versions before 1.7, at which point\n# we need to keep only those names which we still refer to.\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])\n\nm4_ifndef([AC_LIBTOOL_LINKER_OPTION],\t[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])\nm4_ifndef([AC_PROG_EGREP],\t\t[AC_DEFUN([AC_PROG_EGREP])])\nm4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_AC_SHELL_INIT],\t\t[AC_DEFUN([_LT_AC_SHELL_INIT])])\nm4_ifndef([_LT_AC_SYS_LIBPATH_AIX],\t[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])\nm4_ifndef([_LT_PROG_LTMAIN],\t\t[AC_DEFUN([_LT_PROG_LTMAIN])])\nm4_ifndef([_LT_AC_TAGVAR],\t\t[AC_DEFUN([_LT_AC_TAGVAR])])\nm4_ifndef([AC_LTDL_ENABLE_INSTALL],\t[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])\nm4_ifndef([AC_LTDL_PREOPEN],\t\t[AC_DEFUN([AC_LTDL_PREOPEN])])\nm4_ifndef([_LT_AC_SYS_COMPILER],\t[AC_DEFUN([_LT_AC_SYS_COMPILER])])\nm4_ifndef([_LT_AC_LOCK],\t\t[AC_DEFUN([_LT_AC_LOCK])])\nm4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],\t[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])\nm4_ifndef([_LT_AC_TRY_DLOPEN_SELF],\t[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])\nm4_ifndef([AC_LIBTOOL_PROG_CC_C_O],\t[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])\nm4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])\nm4_ifndef([AC_LIBTOOL_OBJDIR],\t\t[AC_DEFUN([AC_LIBTOOL_OBJDIR])])\nm4_ifndef([AC_LTDL_OBJDIR],\t\t[AC_DEFUN([AC_LTDL_OBJDIR])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])\nm4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],\t[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])\nm4_ifndef([AC_PATH_MAGIC],\t\t[AC_DEFUN([AC_PATH_MAGIC])])\nm4_ifndef([AC_PROG_LD_GNU],\t\t[AC_DEFUN([AC_PROG_LD_GNU])])\nm4_ifndef([AC_PROG_LD_RELOAD_FLAG],\t[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])\nm4_ifndef([AC_DEPLIBS_CHECK_METHOD],\t[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])\nm4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],\t[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])\nm4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],\t[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])\nm4_ifndef([LT_AC_PROG_EGREP],\t\t[AC_DEFUN([LT_AC_PROG_EGREP])])\nm4_ifndef([LT_AC_PROG_SED],\t\t[AC_DEFUN([LT_AC_PROG_SED])])\nm4_ifndef([_LT_CC_BASENAME],\t\t[AC_DEFUN([_LT_CC_BASENAME])])\nm4_ifndef([_LT_COMPILER_BOILERPLATE],\t[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])\nm4_ifndef([_LT_LINKER_BOILERPLATE],\t[AC_DEFUN([_LT_LINKER_BOILERPLATE])])\nm4_ifndef([_AC_PROG_LIBTOOL],\t\t[AC_DEFUN([_AC_PROG_LIBTOOL])])\nm4_ifndef([AC_LIBTOOL_SETUP],\t\t[AC_DEFUN([AC_LIBTOOL_SETUP])])\nm4_ifndef([_LT_AC_CHECK_DLFCN],\t\t[AC_DEFUN([_LT_AC_CHECK_DLFCN])])\nm4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],\t[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])\nm4_ifndef([_LT_AC_TAGCONFIG],\t\t[AC_DEFUN([_LT_AC_TAGCONFIG])])\nm4_ifndef([AC_DISABLE_FAST_INSTALL],\t[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])\nm4_ifndef([_LT_AC_LANG_CXX],\t\t[AC_DEFUN([_LT_AC_LANG_CXX])])\nm4_ifndef([_LT_AC_LANG_F77],\t\t[AC_DEFUN([_LT_AC_LANG_F77])])\nm4_ifndef([_LT_AC_LANG_GCJ],\t\t[AC_DEFUN([_LT_AC_LANG_GCJ])])\nm4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])\nm4_ifndef([_LT_AC_LANG_C_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])\nm4_ifndef([_LT_AC_LANG_CXX_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])\nm4_ifndef([_LT_AC_LANG_F77_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])\nm4_ifndef([_LT_AC_LANG_GCJ_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])\nm4_ifndef([_LT_AC_LANG_RC_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])\nm4_ifndef([AC_LIBTOOL_CONFIG],\t\t[AC_DEFUN([AC_LIBTOOL_CONFIG])])\nm4_ifndef([_LT_AC_FILE_LTDLL_C],\t[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])\nm4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],\t[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])\nm4_ifndef([_LT_AC_PROG_CXXCPP],\t\t[AC_DEFUN([_LT_AC_PROG_CXXCPP])])\nm4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],\t[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])\nm4_ifndef([_LT_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_PROG_F77],\t\t[AC_DEFUN([_LT_PROG_F77])])\nm4_ifndef([_LT_PROG_FC],\t\t[AC_DEFUN([_LT_PROG_FC])])\nm4_ifndef([_LT_PROG_CXX],\t\t[AC_DEFUN([_LT_PROG_CXX])])\n"
  },
  {
    "path": "Tests/gtest/make/Makefile",
    "content": "# A sample Makefile for building Google Test and using it in user\n# tests.  Please tweak it to suit your environment and project.  You\n# may want to move it to your project's root directory.\n#\n# SYNOPSIS:\n#\n#   make [all]  - makes everything.\n#   make TARGET - makes the given target.\n#   make clean  - removes all files generated by make.\n\n# Please tweak the following variable definitions as needed by your\n# project, except GTEST_HEADERS, which you can use in your own targets\n# but shouldn't modify.\n\n# Points to the root of Google Test, relative to where this file is.\n# Remember to tweak this if you move this file.\nGTEST_DIR = ..\n\n# Where to find user code.\nUSER_DIR = ../samples\n\n# Flags passed to the preprocessor.\n# Set Google Test's header directory as a system directory, such that\n# the compiler doesn't generate warnings in Google Test headers.\nCPPFLAGS += -isystem $(GTEST_DIR)/include\n\n# Flags passed to the C++ compiler.\nCXXFLAGS += -g -Wall -Wextra -pthread\n\n# All tests produced by this Makefile.  Remember to add new tests you\n# created to the list.\nTESTS = sample1_unittest\n\n# All Google Test headers.  Usually you shouldn't change this\n# definition.\nGTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \\\n                $(GTEST_DIR)/include/gtest/internal/*.h\n\n# House-keeping build targets.\n\nall : $(TESTS)\n\nclean :\n\trm -f $(TESTS) gtest.a gtest_main.a *.o\n\n# Builds gtest.a and gtest_main.a.\n\n# Usually you shouldn't tweak such internal variables, indicated by a\n# trailing _.\nGTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)\n\n# For simplicity and to avoid depending on Google Test's\n# implementation details, the dependencies specified below are\n# conservative and not optimized.  This is fine as Google Test\n# compiles fast and for ordinary users its source rarely changes.\ngtest-all.o : $(GTEST_SRCS_)\n\t$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \\\n            $(GTEST_DIR)/src/gtest-all.cc\n\ngtest_main.o : $(GTEST_SRCS_)\n\t$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \\\n            $(GTEST_DIR)/src/gtest_main.cc\n\ngtest.a : gtest-all.o\n\t$(AR) $(ARFLAGS) $@ $^\n\ngtest_main.a : gtest-all.o gtest_main.o\n\t$(AR) $(ARFLAGS) $@ $^\n\n# Builds a sample test.  A test should link with either gtest.a or\n# gtest_main.a, depending on whether it defines its own main()\n# function.\n\nsample1.o : $(USER_DIR)/sample1.cc $(USER_DIR)/sample1.h $(GTEST_HEADERS)\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1.cc\n\nsample1_unittest.o : $(USER_DIR)/sample1_unittest.cc \\\n                     $(USER_DIR)/sample1.h $(GTEST_HEADERS)\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1_unittest.cc\n\nsample1_unittest : sample1.o sample1_unittest.o gtest_main.a\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@\n"
  },
  {
    "path": "Tests/gtest/samples/prime_tables.h",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n// Author: vladl@google.com (Vlad Losev)\n\n// This provides interface PrimeTable that determines whether a number is a\n// prime and determines a next prime number. This interface is used\n// in Google Test samples demonstrating use of parameterized tests.\n\n#ifndef GTEST_SAMPLES_PRIME_TABLES_H_\n#define GTEST_SAMPLES_PRIME_TABLES_H_\n\n#include <algorithm>\n\n// The prime table interface.\nclass PrimeTable {\n public:\n  virtual ~PrimeTable() {}\n\n  // Returns true iff n is a prime number.\n  virtual bool IsPrime(int n) const = 0;\n\n  // Returns the smallest prime number greater than p; or returns -1\n  // if the next prime is beyond the capacity of the table.\n  virtual int GetNextPrime(int p) const = 0;\n};\n\n// Implementation #1 calculates the primes on-the-fly.\nclass OnTheFlyPrimeTable : public PrimeTable {\n public:\n  virtual bool IsPrime(int n) const {\n    if (n <= 1) return false;\n\n    for (int i = 2; i*i <= n; i++) {\n      // n is divisible by an integer other than 1 and itself.\n      if ((n % i) == 0) return false;\n    }\n\n    return true;\n  }\n\n  virtual int GetNextPrime(int p) const {\n    for (int n = p + 1; n > 0; n++) {\n      if (IsPrime(n)) return n;\n    }\n\n    return -1;\n  }\n};\n\n// Implementation #2 pre-calculates the primes and stores the result\n// in an array.\nclass PreCalculatedPrimeTable : public PrimeTable {\n public:\n  // 'max' specifies the maximum number the prime table holds.\n  explicit PreCalculatedPrimeTable(int max)\n      : is_prime_size_(max + 1), is_prime_(new bool[max + 1]) {\n    CalculatePrimesUpTo(max);\n  }\n  virtual ~PreCalculatedPrimeTable() { delete[] is_prime_; }\n\n  virtual bool IsPrime(int n) const {\n    return 0 <= n && n < is_prime_size_ && is_prime_[n];\n  }\n\n  virtual int GetNextPrime(int p) const {\n    for (int n = p + 1; n < is_prime_size_; n++) {\n      if (is_prime_[n]) return n;\n    }\n\n    return -1;\n  }\n\n private:\n  void CalculatePrimesUpTo(int max) {\n    ::std::fill(is_prime_, is_prime_ + is_prime_size_, true);\n    is_prime_[0] = is_prime_[1] = false;\n\n    for (int i = 2; i <= max; i++) {\n      if (!is_prime_[i]) continue;\n\n      // Marks all multiples of i (except i itself) as non-prime.\n      for (int j = 2*i; j <= max; j += i) {\n        is_prime_[j] = false;\n      }\n    }\n  }\n\n  const int is_prime_size_;\n  bool* const is_prime_;\n\n  // Disables compiler warning \"assignment operator could not be generated.\"\n  void operator=(const PreCalculatedPrimeTable& rhs);\n};\n\n#endif  // GTEST_SAMPLES_PRIME_TABLES_H_\n"
  },
  {
    "path": "Tests/gtest/samples/sample1.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"sample1.h\"\n\n// Returns n! (the factorial of n).  For negative n, n! is defined to be 1.\nint Factorial(int n) {\n  int result = 1;\n  for (int i = 1; i <= n; i++) {\n    result *= i;\n  }\n\n  return result;\n}\n\n// Returns true iff n is a prime number.\nbool IsPrime(int n) {\n  // Trivial case 1: small numbers\n  if (n <= 1) return false;\n\n  // Trivial case 2: even numbers\n  if (n % 2 == 0) return n == 2;\n\n  // Now, we have that n is odd and n >= 3.\n\n  // Try to divide n by every odd number i, starting from 3\n  for (int i = 3; ; i += 2) {\n    // We only have to try i up to the squre root of n\n    if (i > n/i) break;\n\n    // Now, we have i <= n/i < n.\n    // If n is divisible by i, n is not prime.\n    if (n % i == 0) return false;\n  }\n\n  // n has no integer factor in the range (1, n), and thus is prime.\n  return true;\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample1.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_SAMPLES_SAMPLE1_H_\n#define GTEST_SAMPLES_SAMPLE1_H_\n\n// Returns n! (the factorial of n).  For negative n, n! is defined to be 1.\nint Factorial(int n);\n\n// Returns true iff n is a prime number.\nbool IsPrime(int n);\n\n#endif  // GTEST_SAMPLES_SAMPLE1_H_\n"
  },
  {
    "path": "Tests/gtest/samples/sample10_unittest.cc",
    "content": "// Copyright 2009 Google Inc. All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// This sample shows how to use Google Test listener API to implement\n// a primitive leak checker.\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"gtest/gtest.h\"\n\nusing ::testing::EmptyTestEventListener;\nusing ::testing::InitGoogleTest;\nusing ::testing::Test;\nusing ::testing::TestCase;\nusing ::testing::TestEventListeners;\nusing ::testing::TestInfo;\nusing ::testing::TestPartResult;\nusing ::testing::UnitTest;\n\nnamespace {\n\n// We will track memory used by this class.\nclass Water {\n public:\n  // Normal Water declarations go here.\n\n  // operator new and operator delete help us control water allocation.\n  void* operator new(size_t allocation_size) {\n    allocated_++;\n    return malloc(allocation_size);\n  }\n\n  void operator delete(void* block, size_t /* allocation_size */) {\n    allocated_--;\n    free(block);\n  }\n\n  static int allocated() { return allocated_; }\n\n private:\n  static int allocated_;\n};\n\nint Water::allocated_ = 0;\n\n// This event listener monitors how many Water objects are created and\n// destroyed by each test, and reports a failure if a test leaks some Water\n// objects. It does this by comparing the number of live Water objects at\n// the beginning of a test and at the end of a test.\nclass LeakChecker : public EmptyTestEventListener {\n private:\n  // Called before a test starts.\n  virtual void OnTestStart(const TestInfo& /* test_info */) {\n    initially_allocated_ = Water::allocated();\n  }\n\n  // Called after a test ends.\n  virtual void OnTestEnd(const TestInfo& /* test_info */) {\n    int difference = Water::allocated() - initially_allocated_;\n\n    // You can generate a failure in any event handler except\n    // OnTestPartResult. Just use an appropriate Google Test assertion to do\n    // it.\n    EXPECT_LE(difference, 0) << \"Leaked \" << difference << \" unit(s) of Water!\";\n  }\n\n  int initially_allocated_;\n};\n\nTEST(ListenersTest, DoesNotLeak) {\n  Water* water = new Water;\n  delete water;\n}\n\n// This should fail when the --check_for_leaks command line flag is\n// specified.\nTEST(ListenersTest, LeaksWater) {\n  Water* water = new Water;\n  EXPECT_TRUE(water != NULL);\n}\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  InitGoogleTest(&argc, argv);\n\n  bool check_for_leaks = false;\n  if (argc > 1 && strcmp(argv[1], \"--check_for_leaks\") == 0 )\n    check_for_leaks = true;\n  else\n    printf(\"%s\\n\", \"Run this program with --check_for_leaks to enable \"\n           \"custom leak checking in the tests.\");\n\n  // If we are given the --check_for_leaks command line flag, installs the\n  // leak checker.\n  if (check_for_leaks) {\n    TestEventListeners& listeners = UnitTest::GetInstance()->listeners();\n\n    // Adds the leak checker to the end of the test event listener list,\n    // after the default text output printer and the default XML report\n    // generator.\n    //\n    // The order is important - it ensures that failures generated in the\n    // leak checker's OnTestEnd() method are processed by the text and XML\n    // printers *before* their OnTestEnd() methods are called, such that\n    // they are attributed to the right test. Remember that a listener\n    // receives an OnXyzStart event *after* listeners preceding it in the\n    // list received that event, and receives an OnXyzEnd event *before*\n    // listeners preceding it.\n    //\n    // We don't need to worry about deleting the new listener later, as\n    // Google Test will do it.\n    listeners.Append(new LeakChecker);\n  }\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample1_unittest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n\n// This sample shows how to write a simple unit test for a function,\n// using Google C++ testing framework.\n//\n// Writing a unit test using Google C++ testing framework is easy as 1-2-3:\n\n\n// Step 1. Include necessary header files such that the stuff your\n// test logic needs is declared.\n//\n// Don't forget gtest.h, which declares the testing framework.\n\n#include <limits.h>\n#include \"sample1.h\"\n#include \"gtest/gtest.h\"\n\n\n// Step 2. Use the TEST macro to define your tests.\n//\n// TEST has two parameters: the test case name and the test name.\n// After using the macro, you should define your test logic between a\n// pair of braces.  You can use a bunch of macros to indicate the\n// success or failure of a test.  EXPECT_TRUE and EXPECT_EQ are\n// examples of such macros.  For a complete list, see gtest.h.\n//\n// <TechnicalDetails>\n//\n// In Google Test, tests are grouped into test cases.  This is how we\n// keep test code organized.  You should put logically related tests\n// into the same test case.\n//\n// The test case name and the test name should both be valid C++\n// identifiers.  And you should not use underscore (_) in the names.\n//\n// Google Test guarantees that each test you define is run exactly\n// once, but it makes no guarantee on the order the tests are\n// executed.  Therefore, you should write your tests in such a way\n// that their results don't depend on their order.\n//\n// </TechnicalDetails>\n\n\n// Tests Factorial().\n\n// Tests factorial of negative numbers.\nTEST(FactorialTest, Negative) {\n  // This test is named \"Negative\", and belongs to the \"FactorialTest\"\n  // test case.\n  EXPECT_EQ(1, Factorial(-5));\n  EXPECT_EQ(1, Factorial(-1));\n  EXPECT_GT(Factorial(-10), 0);\n\n  // <TechnicalDetails>\n  //\n  // EXPECT_EQ(expected, actual) is the same as\n  //\n  //   EXPECT_TRUE((expected) == (actual))\n  //\n  // except that it will print both the expected value and the actual\n  // value when the assertion fails.  This is very helpful for\n  // debugging.  Therefore in this case EXPECT_EQ is preferred.\n  //\n  // On the other hand, EXPECT_TRUE accepts any Boolean expression,\n  // and is thus more general.\n  //\n  // </TechnicalDetails>\n}\n\n// Tests factorial of 0.\nTEST(FactorialTest, Zero) {\n  EXPECT_EQ(1, Factorial(0));\n}\n\n// Tests factorial of positive numbers.\nTEST(FactorialTest, Positive) {\n  EXPECT_EQ(1, Factorial(1));\n  EXPECT_EQ(2, Factorial(2));\n  EXPECT_EQ(6, Factorial(3));\n  EXPECT_EQ(40320, Factorial(8));\n}\n\n\n// Tests IsPrime()\n\n// Tests negative input.\nTEST(IsPrimeTest, Negative) {\n  // This test belongs to the IsPrimeTest test case.\n\n  EXPECT_FALSE(IsPrime(-1));\n  EXPECT_FALSE(IsPrime(-2));\n  EXPECT_FALSE(IsPrime(INT_MIN));\n}\n\n// Tests some trivial cases.\nTEST(IsPrimeTest, Trivial) {\n  EXPECT_FALSE(IsPrime(0));\n  EXPECT_FALSE(IsPrime(1));\n  EXPECT_TRUE(IsPrime(2));\n  EXPECT_TRUE(IsPrime(3));\n}\n\n// Tests positive input.\nTEST(IsPrimeTest, Positive) {\n  EXPECT_FALSE(IsPrime(4));\n  EXPECT_TRUE(IsPrime(5));\n  EXPECT_FALSE(IsPrime(6));\n  EXPECT_TRUE(IsPrime(23));\n}\n\n// Step 3. Call RUN_ALL_TESTS() in main().\n//\n// We do this by linking in src/gtest_main.cc file, which consists of\n// a main() function which calls RUN_ALL_TESTS() for us.\n//\n// This runs all the tests you've defined, prints the result, and\n// returns 0 if successful, or 1 otherwise.\n//\n// Did you notice that we didn't register the tests?  The\n// RUN_ALL_TESTS() macro magically knows about all the tests we\n// defined.  Isn't this convenient?\n"
  },
  {
    "path": "Tests/gtest/samples/sample2.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"sample2.h\"\n\n#include <string.h>\n\n// Clones a 0-terminated C string, allocating memory using new.\nconst char* MyString::CloneCString(const char* a_c_string) {\n  if (a_c_string == NULL) return NULL;\n\n  const size_t len = strlen(a_c_string);\n  char* const clone = new char[ len + 1 ];\n  memcpy(clone, a_c_string, len + 1);\n\n  return clone;\n}\n\n// Sets the 0-terminated C string this MyString object\n// represents.\nvoid MyString::Set(const char* a_c_string) {\n  // Makes sure this works when c_string == c_string_\n  const char* const temp = MyString::CloneCString(a_c_string);\n  delete[] c_string_;\n  c_string_ = temp;\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample2.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_SAMPLES_SAMPLE2_H_\n#define GTEST_SAMPLES_SAMPLE2_H_\n\n#include <string.h>\n\n\n// A simple string class.\nclass MyString {\n private:\n  const char* c_string_;\n  const MyString& operator=(const MyString& rhs);\n\n public:\n  // Clones a 0-terminated C string, allocating memory using new.\n  static const char* CloneCString(const char* a_c_string);\n\n  ////////////////////////////////////////////////////////////\n  //\n  // C'tors\n\n  // The default c'tor constructs a NULL string.\n  MyString() : c_string_(NULL) {}\n\n  // Constructs a MyString by cloning a 0-terminated C string.\n  explicit MyString(const char* a_c_string) : c_string_(NULL) {\n    Set(a_c_string);\n  }\n\n  // Copy c'tor\n  MyString(const MyString& string) : c_string_(NULL) {\n    Set(string.c_string_);\n  }\n\n  ////////////////////////////////////////////////////////////\n  //\n  // D'tor.  MyString is intended to be a final class, so the d'tor\n  // doesn't need to be virtual.\n  ~MyString() { delete[] c_string_; }\n\n  // Gets the 0-terminated C string this MyString object represents.\n  const char* c_string() const { return c_string_; }\n\n  size_t Length() const {\n    return c_string_ == NULL ? 0 : strlen(c_string_);\n  }\n\n  // Sets the 0-terminated C string this MyString object represents.\n  void Set(const char* c_string);\n};\n\n\n#endif  // GTEST_SAMPLES_SAMPLE2_H_\n"
  },
  {
    "path": "Tests/gtest/samples/sample2_unittest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n\n// This sample shows how to write a more complex unit test for a class\n// that has multiple member functions.\n//\n// Usually, it's a good idea to have one test for each method in your\n// class.  You don't have to do that exactly, but it helps to keep\n// your tests organized.  You may also throw in additional tests as\n// needed.\n\n#include \"sample2.h\"\n#include \"gtest/gtest.h\"\n\n// In this example, we test the MyString class (a simple string).\n\n// Tests the default c'tor.\nTEST(MyString, DefaultConstructor) {\n  const MyString s;\n\n  // Asserts that s.c_string() returns NULL.\n  //\n  // <TechnicalDetails>\n  //\n  // If we write NULL instead of\n  //\n  //   static_cast<const char *>(NULL)\n  //\n  // in this assertion, it will generate a warning on gcc 3.4.  The\n  // reason is that EXPECT_EQ needs to know the types of its\n  // arguments in order to print them when it fails.  Since NULL is\n  // #defined as 0, the compiler will use the formatter function for\n  // int to print it.  However, gcc thinks that NULL should be used as\n  // a pointer, not an int, and therefore complains.\n  //\n  // The root of the problem is C++'s lack of distinction between the\n  // integer number 0 and the null pointer constant.  Unfortunately,\n  // we have to live with this fact.\n  //\n  // </TechnicalDetails>\n  EXPECT_STREQ(NULL, s.c_string());\n\n  EXPECT_EQ(0u, s.Length());\n}\n\nconst char kHelloString[] = \"Hello, world!\";\n\n// Tests the c'tor that accepts a C string.\nTEST(MyString, ConstructorFromCString) {\n  const MyString s(kHelloString);\n  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));\n  EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1,\n            s.Length());\n}\n\n// Tests the copy c'tor.\nTEST(MyString, CopyConstructor) {\n  const MyString s1(kHelloString);\n  const MyString s2 = s1;\n  EXPECT_EQ(0, strcmp(s2.c_string(), kHelloString));\n}\n\n// Tests the Set method.\nTEST(MyString, Set) {\n  MyString s;\n\n  s.Set(kHelloString);\n  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));\n\n  // Set should work when the input pointer is the same as the one\n  // already in the MyString object.\n  s.Set(s.c_string());\n  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));\n\n  // Can we set the MyString to NULL?\n  s.Set(NULL);\n  EXPECT_STREQ(NULL, s.c_string());\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample3-inl.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_\n#define GTEST_SAMPLES_SAMPLE3_INL_H_\n\n#include <stddef.h>\n\n\n// Queue is a simple queue implemented as a singled-linked list.\n//\n// The element type must support copy constructor.\ntemplate <typename E>  // E is the element type\nclass Queue;\n\n// QueueNode is a node in a Queue, which consists of an element of\n// type E and a pointer to the next node.\ntemplate <typename E>  // E is the element type\nclass QueueNode {\n  friend class Queue<E>;\n\n public:\n  // Gets the element in this node.\n  const E& element() const { return element_; }\n\n  // Gets the next node in the queue.\n  QueueNode* next() { return next_; }\n  const QueueNode* next() const { return next_; }\n\n private:\n  // Creates a node with a given element value.  The next pointer is\n  // set to NULL.\n  explicit QueueNode(const E& an_element) : element_(an_element), next_(NULL) {}\n\n  // We disable the default assignment operator and copy c'tor.\n  const QueueNode& operator = (const QueueNode&);\n  QueueNode(const QueueNode&);\n\n  E element_;\n  QueueNode* next_;\n};\n\ntemplate <typename E>  // E is the element type.\nclass Queue {\n public:\n  // Creates an empty queue.\n  Queue() : head_(NULL), last_(NULL), size_(0) {}\n\n  // D'tor.  Clears the queue.\n  ~Queue() { Clear(); }\n\n  // Clears the queue.\n  void Clear() {\n    if (size_ > 0) {\n      // 1. Deletes every node.\n      QueueNode<E>* node = head_;\n      QueueNode<E>* next = node->next();\n      for (; ;) {\n        delete node;\n        node = next;\n        if (node == NULL) break;\n        next = node->next();\n      }\n\n      // 2. Resets the member variables.\n      head_ = last_ = NULL;\n      size_ = 0;\n    }\n  }\n\n  // Gets the number of elements.\n  size_t Size() const { return size_; }\n\n  // Gets the first element of the queue, or NULL if the queue is empty.\n  QueueNode<E>* Head() { return head_; }\n  const QueueNode<E>* Head() const { return head_; }\n\n  // Gets the last element of the queue, or NULL if the queue is empty.\n  QueueNode<E>* Last() { return last_; }\n  const QueueNode<E>* Last() const { return last_; }\n\n  // Adds an element to the end of the queue.  A copy of the element is\n  // created using the copy constructor, and then stored in the queue.\n  // Changes made to the element in the queue doesn't affect the source\n  // object, and vice versa.\n  void Enqueue(const E& element) {\n    QueueNode<E>* new_node = new QueueNode<E>(element);\n\n    if (size_ == 0) {\n      head_ = last_ = new_node;\n      size_ = 1;\n    } else {\n      last_->next_ = new_node;\n      last_ = new_node;\n      size_++;\n    }\n  }\n\n  // Removes the head of the queue and returns it.  Returns NULL if\n  // the queue is empty.\n  E* Dequeue() {\n    if (size_ == 0) {\n      return NULL;\n    }\n\n    const QueueNode<E>* const old_head = head_;\n    head_ = head_->next_;\n    size_--;\n    if (size_ == 0) {\n      last_ = NULL;\n    }\n\n    E* element = new E(old_head->element());\n    delete old_head;\n\n    return element;\n  }\n\n  // Applies a function/functor on each element of the queue, and\n  // returns the result in a new queue.  The original queue is not\n  // affected.\n  template <typename F>\n  Queue* Map(F function) const {\n    Queue* new_queue = new Queue();\n    for (const QueueNode<E>* node = head_; node != NULL; node = node->next_) {\n      new_queue->Enqueue(function(node->element()));\n    }\n\n    return new_queue;\n  }\n\n private:\n  QueueNode<E>* head_;  // The first node of the queue.\n  QueueNode<E>* last_;  // The last node of the queue.\n  size_t size_;  // The number of elements in the queue.\n\n  // We disallow copying a queue.\n  Queue(const Queue&);\n  const Queue& operator = (const Queue&);\n};\n\n#endif  // GTEST_SAMPLES_SAMPLE3_INL_H_\n"
  },
  {
    "path": "Tests/gtest/samples/sample3_unittest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n\n// In this example, we use a more advanced feature of Google Test called\n// test fixture.\n//\n// A test fixture is a place to hold objects and functions shared by\n// all tests in a test case.  Using a test fixture avoids duplicating\n// the test code necessary to initialize and cleanup those common\n// objects for each test.  It is also useful for defining sub-routines\n// that your tests need to invoke a lot.\n//\n// <TechnicalDetails>\n//\n// The tests share the test fixture in the sense of code sharing, not\n// data sharing.  Each test is given its own fresh copy of the\n// fixture.  You cannot expect the data modified by one test to be\n// passed on to another test, which is a bad idea.\n//\n// The reason for this design is that tests should be independent and\n// repeatable.  In particular, a test should not fail as the result of\n// another test's failure.  If one test depends on info produced by\n// another test, then the two tests should really be one big test.\n//\n// The macros for indicating the success/failure of a test\n// (EXPECT_TRUE, FAIL, etc) need to know what the current test is\n// (when Google Test prints the test result, it tells you which test\n// each failure belongs to).  Technically, these macros invoke a\n// member function of the Test class.  Therefore, you cannot use them\n// in a global function.  That's why you should put test sub-routines\n// in a test fixture.\n//\n// </TechnicalDetails>\n\n#include \"sample3-inl.h\"\n#include \"gtest/gtest.h\"\n\n// To use a test fixture, derive a class from testing::Test.\nclass QueueTest : public testing::Test {\n protected:  // You should make the members protected s.t. they can be\n             // accessed from sub-classes.\n\n  // virtual void SetUp() will be called before each test is run.  You\n  // should define it if you need to initialize the varaibles.\n  // Otherwise, this can be skipped.\n  virtual void SetUp() {\n    q1_.Enqueue(1);\n    q2_.Enqueue(2);\n    q2_.Enqueue(3);\n  }\n\n  // virtual void TearDown() will be called after each test is run.\n  // You should define it if there is cleanup work to do.  Otherwise,\n  // you don't have to provide it.\n  //\n  // virtual void TearDown() {\n  // }\n\n  // A helper function that some test uses.\n  static int Double(int n) {\n    return 2*n;\n  }\n\n  // A helper function for testing Queue::Map().\n  void MapTester(const Queue<int> * q) {\n    // Creates a new queue, where each element is twice as big as the\n    // corresponding one in q.\n    const Queue<int> * const new_q = q->Map(Double);\n\n    // Verifies that the new queue has the same size as q.\n    ASSERT_EQ(q->Size(), new_q->Size());\n\n    // Verifies the relationship between the elements of the two queues.\n    for ( const QueueNode<int> * n1 = q->Head(), * n2 = new_q->Head();\n          n1 != NULL; n1 = n1->next(), n2 = n2->next() ) {\n      EXPECT_EQ(2 * n1->element(), n2->element());\n    }\n\n    delete new_q;\n  }\n\n  // Declares the variables your tests want to use.\n  Queue<int> q0_;\n  Queue<int> q1_;\n  Queue<int> q2_;\n};\n\n// When you have a test fixture, you define a test using TEST_F\n// instead of TEST.\n\n// Tests the default c'tor.\nTEST_F(QueueTest, DefaultConstructor) {\n  // You can access data in the test fixture here.\n  EXPECT_EQ(0u, q0_.Size());\n}\n\n// Tests Dequeue().\nTEST_F(QueueTest, Dequeue) {\n  int * n = q0_.Dequeue();\n  EXPECT_TRUE(n == NULL);\n\n  n = q1_.Dequeue();\n  ASSERT_TRUE(n != NULL);\n  EXPECT_EQ(1, *n);\n  EXPECT_EQ(0u, q1_.Size());\n  delete n;\n\n  n = q2_.Dequeue();\n  ASSERT_TRUE(n != NULL);\n  EXPECT_EQ(2, *n);\n  EXPECT_EQ(1u, q2_.Size());\n  delete n;\n}\n\n// Tests the Queue::Map() function.\nTEST_F(QueueTest, Map) {\n  MapTester(&q0_);\n  MapTester(&q1_);\n  MapTester(&q2_);\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample4.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include <stdio.h>\n\n#include \"sample4.h\"\n\n// Returns the current counter value, and increments it.\nint Counter::Increment() {\n  return counter_++;\n}\n\n// Prints the current counter value to STDOUT.\nvoid Counter::Print() const {\n  printf(\"%d\", counter_);\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample4.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A sample program demonstrating using Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_SAMPLES_SAMPLE4_H_\n#define GTEST_SAMPLES_SAMPLE4_H_\n\n// A simple monotonic counter.\nclass Counter {\n private:\n  int counter_;\n\n public:\n  // Creates a counter that starts at 0.\n  Counter() : counter_(0) {}\n\n  // Returns the current counter value, and increments it.\n  int Increment();\n\n  // Prints the current counter value to STDOUT.\n  void Print() const;\n};\n\n#endif  // GTEST_SAMPLES_SAMPLE4_H_\n"
  },
  {
    "path": "Tests/gtest/samples/sample4_unittest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/gtest.h\"\n#include \"sample4.h\"\n\n// Tests the Increment() method.\nTEST(Counter, Increment) {\n  Counter c;\n\n  // EXPECT_EQ() evaluates its arguments exactly once, so they\n  // can have side effects.\n\n  EXPECT_EQ(0, c.Increment());\n  EXPECT_EQ(1, c.Increment());\n  EXPECT_EQ(2, c.Increment());\n}\n"
  },
  {
    "path": "Tests/gtest/samples/sample5_unittest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// This sample teaches how to reuse a test fixture in multiple test\n// cases by deriving sub-fixtures from it.\n//\n// When you define a test fixture, you specify the name of the test\n// case that will use this fixture.  Therefore, a test fixture can\n// be used by only one test case.\n//\n// Sometimes, more than one test cases may want to use the same or\n// slightly different test fixtures.  For example, you may want to\n// make sure that all tests for a GUI library don't leak important\n// system resources like fonts and brushes.  In Google Test, you do\n// this by putting the shared logic in a super (as in \"super class\")\n// test fixture, and then have each test case use a fixture derived\n// from this super fixture.\n\n#include <limits.h>\n#include <time.h>\n#include \"sample3-inl.h\"\n#include \"gtest/gtest.h\"\n#include \"sample1.h\"\n\n// In this sample, we want to ensure that every test finishes within\n// ~5 seconds.  If a test takes longer to run, we consider it a\n// failure.\n//\n// We put the code for timing a test in a test fixture called\n// \"QuickTest\".  QuickTest is intended to be the super fixture that\n// other fixtures derive from, therefore there is no test case with\n// the name \"QuickTest\".  This is OK.\n//\n// Later, we will derive multiple test fixtures from QuickTest.\nclass QuickTest : public testing::Test {\n protected:\n  // Remember that SetUp() is run immediately before a test starts.\n  // This is a good place to record the start time.\n  virtual void SetUp() {\n    start_time_ = time(NULL);\n  }\n\n  // TearDown() is invoked immediately after a test finishes.  Here we\n  // check if the test was too slow.\n  virtual void TearDown() {\n    // Gets the time when the test finishes\n    const time_t end_time = time(NULL);\n\n    // Asserts that the test took no more than ~5 seconds.  Did you\n    // know that you can use assertions in SetUp() and TearDown() as\n    // well?\n    EXPECT_TRUE(end_time - start_time_ <= 5) << \"The test took too long.\";\n  }\n\n  // The UTC time (in seconds) when the test starts\n  time_t start_time_;\n};\n\n\n// We derive a fixture named IntegerFunctionTest from the QuickTest\n// fixture.  All tests using this fixture will be automatically\n// required to be quick.\nclass IntegerFunctionTest : public QuickTest {\n  // We don't need any more logic than already in the QuickTest fixture.\n  // Therefore the body is empty.\n};\n\n\n// Now we can write tests in the IntegerFunctionTest test case.\n\n// Tests Factorial()\nTEST_F(IntegerFunctionTest, Factorial) {\n  // Tests factorial of negative numbers.\n  EXPECT_EQ(1, Factorial(-5));\n  EXPECT_EQ(1, Factorial(-1));\n  EXPECT_GT(Factorial(-10), 0);\n\n  // Tests factorial of 0.\n  EXPECT_EQ(1, Factorial(0));\n\n  // Tests factorial of positive numbers.\n  EXPECT_EQ(1, Factorial(1));\n  EXPECT_EQ(2, Factorial(2));\n  EXPECT_EQ(6, Factorial(3));\n  EXPECT_EQ(40320, Factorial(8));\n}\n\n\n// Tests IsPrime()\nTEST_F(IntegerFunctionTest, IsPrime) {\n  // Tests negative input.\n  EXPECT_FALSE(IsPrime(-1));\n  EXPECT_FALSE(IsPrime(-2));\n  EXPECT_FALSE(IsPrime(INT_MIN));\n\n  // Tests some trivial cases.\n  EXPECT_FALSE(IsPrime(0));\n  EXPECT_FALSE(IsPrime(1));\n  EXPECT_TRUE(IsPrime(2));\n  EXPECT_TRUE(IsPrime(3));\n\n  // Tests positive input.\n  EXPECT_FALSE(IsPrime(4));\n  EXPECT_TRUE(IsPrime(5));\n  EXPECT_FALSE(IsPrime(6));\n  EXPECT_TRUE(IsPrime(23));\n}\n\n\n// The next test case (named \"QueueTest\") also needs to be quick, so\n// we derive another fixture from QuickTest.\n//\n// The QueueTest test fixture has some logic and shared objects in\n// addition to what's in QuickTest already.  We define the additional\n// stuff inside the body of the test fixture, as usual.\nclass QueueTest : public QuickTest {\n protected:\n  virtual void SetUp() {\n    // First, we need to set up the super fixture (QuickTest).\n    QuickTest::SetUp();\n\n    // Second, some additional setup for this fixture.\n    q1_.Enqueue(1);\n    q2_.Enqueue(2);\n    q2_.Enqueue(3);\n  }\n\n  // By default, TearDown() inherits the behavior of\n  // QuickTest::TearDown().  As we have no additional cleaning work\n  // for QueueTest, we omit it here.\n  //\n  // virtual void TearDown() {\n  //   QuickTest::TearDown();\n  // }\n\n  Queue<int> q0_;\n  Queue<int> q1_;\n  Queue<int> q2_;\n};\n\n\n// Now, let's write tests using the QueueTest fixture.\n\n// Tests the default constructor.\nTEST_F(QueueTest, DefaultConstructor) {\n  EXPECT_EQ(0u, q0_.Size());\n}\n\n// Tests Dequeue().\nTEST_F(QueueTest, Dequeue) {\n  int* n = q0_.Dequeue();\n  EXPECT_TRUE(n == NULL);\n\n  n = q1_.Dequeue();\n  EXPECT_TRUE(n != NULL);\n  EXPECT_EQ(1, *n);\n  EXPECT_EQ(0u, q1_.Size());\n  delete n;\n\n  n = q2_.Dequeue();\n  EXPECT_TRUE(n != NULL);\n  EXPECT_EQ(2, *n);\n  EXPECT_EQ(1u, q2_.Size());\n  delete n;\n}\n\n// If necessary, you can derive further test fixtures from a derived\n// fixture itself.  For example, you can derive another fixture from\n// QueueTest.  Google Test imposes no limit on how deep the hierarchy\n// can be.  In practice, however, you probably don't want it to be too\n// deep as to be confusing.\n"
  },
  {
    "path": "Tests/gtest/samples/sample6_unittest.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// This sample shows how to test common properties of multiple\n// implementations of the same interface (aka interface tests).\n\n// The interface and its implementations are in this header.\n#include \"prime_tables.h\"\n\n#include \"gtest/gtest.h\"\n\n// First, we define some factory functions for creating instances of\n// the implementations.  You may be able to skip this step if all your\n// implementations can be constructed the same way.\n\ntemplate <class T>\nPrimeTable* CreatePrimeTable();\n\ntemplate <>\nPrimeTable* CreatePrimeTable<OnTheFlyPrimeTable>() {\n  return new OnTheFlyPrimeTable;\n}\n\ntemplate <>\nPrimeTable* CreatePrimeTable<PreCalculatedPrimeTable>() {\n  return new PreCalculatedPrimeTable(10000);\n}\n\n// Then we define a test fixture class template.\ntemplate <class T>\nclass PrimeTableTest : public testing::Test {\n protected:\n  // The ctor calls the factory function to create a prime table\n  // implemented by T.\n  PrimeTableTest() : table_(CreatePrimeTable<T>()) {}\n\n  virtual ~PrimeTableTest() { delete table_; }\n\n  // Note that we test an implementation via the base interface\n  // instead of the actual implementation class.  This is important\n  // for keeping the tests close to the real world scenario, where the\n  // implementation is invoked via the base interface.  It avoids\n  // got-yas where the implementation class has a method that shadows\n  // a method with the same name (but slightly different argument\n  // types) in the base interface, for example.\n  PrimeTable* const table_;\n};\n\n#if GTEST_HAS_TYPED_TEST\n\nusing testing::Types;\n\n// Google Test offers two ways for reusing tests for different types.\n// The first is called \"typed tests\".  You should use it if you\n// already know *all* the types you are gonna exercise when you write\n// the tests.\n\n// To write a typed test case, first use\n//\n//   TYPED_TEST_CASE(TestCaseName, TypeList);\n//\n// to declare it and specify the type parameters.  As with TEST_F,\n// TestCaseName must match the test fixture name.\n\n// The list of types we want to test.\ntypedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable> Implementations;\n\nTYPED_TEST_CASE(PrimeTableTest, Implementations);\n\n// Then use TYPED_TEST(TestCaseName, TestName) to define a typed test,\n// similar to TEST_F.\nTYPED_TEST(PrimeTableTest, ReturnsFalseForNonPrimes) {\n  // Inside the test body, you can refer to the type parameter by\n  // TypeParam, and refer to the fixture class by TestFixture.  We\n  // don't need them in this example.\n\n  // Since we are in the template world, C++ requires explicitly\n  // writing 'this->' when referring to members of the fixture class.\n  // This is something you have to learn to live with.\n  EXPECT_FALSE(this->table_->IsPrime(-5));\n  EXPECT_FALSE(this->table_->IsPrime(0));\n  EXPECT_FALSE(this->table_->IsPrime(1));\n  EXPECT_FALSE(this->table_->IsPrime(4));\n  EXPECT_FALSE(this->table_->IsPrime(6));\n  EXPECT_FALSE(this->table_->IsPrime(100));\n}\n\nTYPED_TEST(PrimeTableTest, ReturnsTrueForPrimes) {\n  EXPECT_TRUE(this->table_->IsPrime(2));\n  EXPECT_TRUE(this->table_->IsPrime(3));\n  EXPECT_TRUE(this->table_->IsPrime(5));\n  EXPECT_TRUE(this->table_->IsPrime(7));\n  EXPECT_TRUE(this->table_->IsPrime(11));\n  EXPECT_TRUE(this->table_->IsPrime(131));\n}\n\nTYPED_TEST(PrimeTableTest, CanGetNextPrime) {\n  EXPECT_EQ(2, this->table_->GetNextPrime(0));\n  EXPECT_EQ(3, this->table_->GetNextPrime(2));\n  EXPECT_EQ(5, this->table_->GetNextPrime(3));\n  EXPECT_EQ(7, this->table_->GetNextPrime(5));\n  EXPECT_EQ(11, this->table_->GetNextPrime(7));\n  EXPECT_EQ(131, this->table_->GetNextPrime(128));\n}\n\n// That's it!  Google Test will repeat each TYPED_TEST for each type\n// in the type list specified in TYPED_TEST_CASE.  Sit back and be\n// happy that you don't have to define them multiple times.\n\n#endif  // GTEST_HAS_TYPED_TEST\n\n#if GTEST_HAS_TYPED_TEST_P\n\nusing testing::Types;\n\n// Sometimes, however, you don't yet know all the types that you want\n// to test when you write the tests.  For example, if you are the\n// author of an interface and expect other people to implement it, you\n// might want to write a set of tests to make sure each implementation\n// conforms to some basic requirements, but you don't know what\n// implementations will be written in the future.\n//\n// How can you write the tests without committing to the type\n// parameters?  That's what \"type-parameterized tests\" can do for you.\n// It is a bit more involved than typed tests, but in return you get a\n// test pattern that can be reused in many contexts, which is a big\n// win.  Here's how you do it:\n\n// First, define a test fixture class template.  Here we just reuse\n// the PrimeTableTest fixture defined earlier:\n\ntemplate <class T>\nclass PrimeTableTest2 : public PrimeTableTest<T> {\n};\n\n// Then, declare the test case.  The argument is the name of the test\n// fixture, and also the name of the test case (as usual).  The _P\n// suffix is for \"parameterized\" or \"pattern\".\nTYPED_TEST_CASE_P(PrimeTableTest2);\n\n// Next, use TYPED_TEST_P(TestCaseName, TestName) to define a test,\n// similar to what you do with TEST_F.\nTYPED_TEST_P(PrimeTableTest2, ReturnsFalseForNonPrimes) {\n  EXPECT_FALSE(this->table_->IsPrime(-5));\n  EXPECT_FALSE(this->table_->IsPrime(0));\n  EXPECT_FALSE(this->table_->IsPrime(1));\n  EXPECT_FALSE(this->table_->IsPrime(4));\n  EXPECT_FALSE(this->table_->IsPrime(6));\n  EXPECT_FALSE(this->table_->IsPrime(100));\n}\n\nTYPED_TEST_P(PrimeTableTest2, ReturnsTrueForPrimes) {\n  EXPECT_TRUE(this->table_->IsPrime(2));\n  EXPECT_TRUE(this->table_->IsPrime(3));\n  EXPECT_TRUE(this->table_->IsPrime(5));\n  EXPECT_TRUE(this->table_->IsPrime(7));\n  EXPECT_TRUE(this->table_->IsPrime(11));\n  EXPECT_TRUE(this->table_->IsPrime(131));\n}\n\nTYPED_TEST_P(PrimeTableTest2, CanGetNextPrime) {\n  EXPECT_EQ(2, this->table_->GetNextPrime(0));\n  EXPECT_EQ(3, this->table_->GetNextPrime(2));\n  EXPECT_EQ(5, this->table_->GetNextPrime(3));\n  EXPECT_EQ(7, this->table_->GetNextPrime(5));\n  EXPECT_EQ(11, this->table_->GetNextPrime(7));\n  EXPECT_EQ(131, this->table_->GetNextPrime(128));\n}\n\n// Type-parameterized tests involve one extra step: you have to\n// enumerate the tests you defined:\nREGISTER_TYPED_TEST_CASE_P(\n    PrimeTableTest2,  // The first argument is the test case name.\n    // The rest of the arguments are the test names.\n    ReturnsFalseForNonPrimes, ReturnsTrueForPrimes, CanGetNextPrime);\n\n// At this point the test pattern is done.  However, you don't have\n// any real test yet as you haven't said which types you want to run\n// the tests with.\n\n// To turn the abstract test pattern into real tests, you instantiate\n// it with a list of types.  Usually the test pattern will be defined\n// in a .h file, and anyone can #include and instantiate it.  You can\n// even instantiate it more than once in the same program.  To tell\n// different instances apart, you give each of them a name, which will\n// become part of the test case name and can be used in test filters.\n\n// The list of types we want to test.  Note that it doesn't have to be\n// defined at the time we write the TYPED_TEST_P()s.\ntypedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable>\n    PrimeTableImplementations;\nINSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated,    // Instance name\n                              PrimeTableTest2,             // Test case name\n                              PrimeTableImplementations);  // Type list\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n"
  },
  {
    "path": "Tests/gtest/samples/sample7_unittest.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// This sample shows how to test common properties of multiple\n// implementations of an interface (aka interface tests) using\n// value-parameterized tests. Each test in the test case has\n// a parameter that is an interface pointer to an implementation\n// tested.\n\n// The interface and its implementations are in this header.\n#include \"prime_tables.h\"\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nusing ::testing::TestWithParam;\nusing ::testing::Values;\n\n// As a general rule, to prevent a test from affecting the tests that come\n// after it, you should create and destroy the tested objects for each test\n// instead of reusing them.  In this sample we will define a simple factory\n// function for PrimeTable objects.  We will instantiate objects in test's\n// SetUp() method and delete them in TearDown() method.\ntypedef PrimeTable* CreatePrimeTableFunc();\n\nPrimeTable* CreateOnTheFlyPrimeTable() {\n  return new OnTheFlyPrimeTable();\n}\n\ntemplate <size_t max_precalculated>\nPrimeTable* CreatePreCalculatedPrimeTable() {\n  return new PreCalculatedPrimeTable(max_precalculated);\n}\n\n// Inside the test body, fixture constructor, SetUp(), and TearDown() you\n// can refer to the test parameter by GetParam().  In this case, the test\n// parameter is a factory function which we call in fixture's SetUp() to\n// create and store an instance of PrimeTable.\nclass PrimeTableTest : public TestWithParam<CreatePrimeTableFunc*> {\n public:\n  virtual ~PrimeTableTest() { delete table_; }\n  virtual void SetUp() { table_ = (*GetParam())(); }\n  virtual void TearDown() {\n    delete table_;\n    table_ = NULL;\n  }\n\n protected:\n  PrimeTable* table_;\n};\n\nTEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) {\n  EXPECT_FALSE(table_->IsPrime(-5));\n  EXPECT_FALSE(table_->IsPrime(0));\n  EXPECT_FALSE(table_->IsPrime(1));\n  EXPECT_FALSE(table_->IsPrime(4));\n  EXPECT_FALSE(table_->IsPrime(6));\n  EXPECT_FALSE(table_->IsPrime(100));\n}\n\nTEST_P(PrimeTableTest, ReturnsTrueForPrimes) {\n  EXPECT_TRUE(table_->IsPrime(2));\n  EXPECT_TRUE(table_->IsPrime(3));\n  EXPECT_TRUE(table_->IsPrime(5));\n  EXPECT_TRUE(table_->IsPrime(7));\n  EXPECT_TRUE(table_->IsPrime(11));\n  EXPECT_TRUE(table_->IsPrime(131));\n}\n\nTEST_P(PrimeTableTest, CanGetNextPrime) {\n  EXPECT_EQ(2, table_->GetNextPrime(0));\n  EXPECT_EQ(3, table_->GetNextPrime(2));\n  EXPECT_EQ(5, table_->GetNextPrime(3));\n  EXPECT_EQ(7, table_->GetNextPrime(5));\n  EXPECT_EQ(11, table_->GetNextPrime(7));\n  EXPECT_EQ(131, table_->GetNextPrime(128));\n}\n\n// In order to run value-parameterized tests, you need to instantiate them,\n// or bind them to a list of values which will be used as test parameters.\n// You can instantiate them in a different translation module, or even\n// instantiate them several times.\n//\n// Here, we instantiate our tests with a list of two PrimeTable object\n// factory functions:\nINSTANTIATE_TEST_CASE_P(\n    OnTheFlyAndPreCalculated,\n    PrimeTableTest,\n    Values(&CreateOnTheFlyPrimeTable, &CreatePreCalculatedPrimeTable<1000>));\n\n#else\n\n// Google Test may not support value-parameterized tests with some\n// compilers. If we use conditional compilation to compile out all\n// code referring to the gtest_main library, MSVC linker will not link\n// that library at all and consequently complain about missing entry\n// point defined in that library (fatal error LNK1561: entry point\n// must be defined). This dummy test keeps gtest_main linked in.\nTEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}\n\n#endif  // GTEST_HAS_PARAM_TEST\n"
  },
  {
    "path": "Tests/gtest/samples/sample8_unittest.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// This sample shows how to test code relying on some global flag variables.\n// Combine() helps with generating all possible combinations of such flags,\n// and each test is given one combination as a parameter.\n\n// Use class definitions to test from this header.\n#include \"prime_tables.h\"\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_COMBINE\n\n// Suppose we want to introduce a new, improved implementation of PrimeTable\n// which combines speed of PrecalcPrimeTable and versatility of\n// OnTheFlyPrimeTable (see prime_tables.h). Inside it instantiates both\n// PrecalcPrimeTable and OnTheFlyPrimeTable and uses the one that is more\n// appropriate under the circumstances. But in low memory conditions, it can be\n// told to instantiate without PrecalcPrimeTable instance at all and use only\n// OnTheFlyPrimeTable.\nclass HybridPrimeTable : public PrimeTable {\n public:\n  HybridPrimeTable(bool force_on_the_fly, int max_precalculated)\n      : on_the_fly_impl_(new OnTheFlyPrimeTable),\n        precalc_impl_(force_on_the_fly ? NULL :\n                          new PreCalculatedPrimeTable(max_precalculated)),\n        max_precalculated_(max_precalculated) {}\n  virtual ~HybridPrimeTable() {\n    delete on_the_fly_impl_;\n    delete precalc_impl_;\n  }\n\n  virtual bool IsPrime(int n) const {\n    if (precalc_impl_ != NULL && n < max_precalculated_)\n      return precalc_impl_->IsPrime(n);\n    else\n      return on_the_fly_impl_->IsPrime(n);\n  }\n\n  virtual int GetNextPrime(int p) const {\n    int next_prime = -1;\n    if (precalc_impl_ != NULL && p < max_precalculated_)\n      next_prime = precalc_impl_->GetNextPrime(p);\n\n    return next_prime != -1 ? next_prime : on_the_fly_impl_->GetNextPrime(p);\n  }\n\n private:\n  OnTheFlyPrimeTable* on_the_fly_impl_;\n  PreCalculatedPrimeTable* precalc_impl_;\n  int max_precalculated_;\n};\n\nusing ::testing::TestWithParam;\nusing ::testing::Bool;\nusing ::testing::Values;\nusing ::testing::Combine;\n\n// To test all code paths for HybridPrimeTable we must test it with numbers\n// both within and outside PreCalculatedPrimeTable's capacity and also with\n// PreCalculatedPrimeTable disabled. We do this by defining fixture which will\n// accept different combinations of parameters for instantiating a\n// HybridPrimeTable instance.\nclass PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > {\n protected:\n  virtual void SetUp() {\n    // This can be written as\n    //\n    // bool force_on_the_fly;\n    // int max_precalculated;\n    // tie(force_on_the_fly, max_precalculated) = GetParam();\n    //\n    // once the Google C++ Style Guide allows use of ::std::tr1::tie.\n    //\n    bool force_on_the_fly = ::std::tr1::get<0>(GetParam());\n    int max_precalculated = ::std::tr1::get<1>(GetParam());\n    table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated);\n  }\n  virtual void TearDown() {\n    delete table_;\n    table_ = NULL;\n  }\n  HybridPrimeTable* table_;\n};\n\nTEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) {\n  // Inside the test body, you can refer to the test parameter by GetParam().\n  // In this case, the test parameter is a PrimeTable interface pointer which\n  // we can use directly.\n  // Please note that you can also save it in the fixture's SetUp() method\n  // or constructor and use saved copy in the tests.\n\n  EXPECT_FALSE(table_->IsPrime(-5));\n  EXPECT_FALSE(table_->IsPrime(0));\n  EXPECT_FALSE(table_->IsPrime(1));\n  EXPECT_FALSE(table_->IsPrime(4));\n  EXPECT_FALSE(table_->IsPrime(6));\n  EXPECT_FALSE(table_->IsPrime(100));\n}\n\nTEST_P(PrimeTableTest, ReturnsTrueForPrimes) {\n  EXPECT_TRUE(table_->IsPrime(2));\n  EXPECT_TRUE(table_->IsPrime(3));\n  EXPECT_TRUE(table_->IsPrime(5));\n  EXPECT_TRUE(table_->IsPrime(7));\n  EXPECT_TRUE(table_->IsPrime(11));\n  EXPECT_TRUE(table_->IsPrime(131));\n}\n\nTEST_P(PrimeTableTest, CanGetNextPrime) {\n  EXPECT_EQ(2, table_->GetNextPrime(0));\n  EXPECT_EQ(3, table_->GetNextPrime(2));\n  EXPECT_EQ(5, table_->GetNextPrime(3));\n  EXPECT_EQ(7, table_->GetNextPrime(5));\n  EXPECT_EQ(11, table_->GetNextPrime(7));\n  EXPECT_EQ(131, table_->GetNextPrime(128));\n}\n\n// In order to run value-parameterized tests, you need to instantiate them,\n// or bind them to a list of values which will be used as test parameters.\n// You can instantiate them in a different translation module, or even\n// instantiate them several times.\n//\n// Here, we instantiate our tests with a list of parameters. We must combine\n// all variations of the boolean flag suppressing PrecalcPrimeTable and some\n// meaningful values for tests. We choose a small value (1), and a value that\n// will put some of the tested numbers beyond the capability of the\n// PrecalcPrimeTable instance and some inside it (10). Combine will produce all\n// possible combinations.\nINSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,\n                        PrimeTableTest,\n                        Combine(Bool(), Values(1, 10)));\n\n#else\n\n// Google Test may not support Combine() with some compilers. If we\n// use conditional compilation to compile out all code referring to\n// the gtest_main library, MSVC linker will not link that library at\n// all and consequently complain about missing entry point defined in\n// that library (fatal error LNK1561: entry point must be\n// defined). This dummy test keeps gtest_main linked in.\nTEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {}\n\n#endif  // GTEST_HAS_COMBINE\n"
  },
  {
    "path": "Tests/gtest/samples/sample9_unittest.cc",
    "content": "// Copyright 2009 Google Inc. All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n\n// This sample shows how to use Google Test listener API to implement\n// an alternative console output and how to use the UnitTest reflection API\n// to enumerate test cases and tests and to inspect their results.\n\n#include <stdio.h>\n\n#include \"gtest/gtest.h\"\n\nusing ::testing::EmptyTestEventListener;\nusing ::testing::InitGoogleTest;\nusing ::testing::Test;\nusing ::testing::TestCase;\nusing ::testing::TestEventListeners;\nusing ::testing::TestInfo;\nusing ::testing::TestPartResult;\nusing ::testing::UnitTest;\n\nnamespace {\n\n// Provides alternative output mode which produces minimal amount of\n// information about tests.\nclass TersePrinter : public EmptyTestEventListener {\n private:\n  // Called before any test activity starts.\n  virtual void OnTestProgramStart(const UnitTest& /* unit_test */) {}\n\n  // Called after all test activities have ended.\n  virtual void OnTestProgramEnd(const UnitTest& unit_test) {\n    fprintf(stdout, \"TEST %s\\n\", unit_test.Passed() ? \"PASSED\" : \"FAILED\");\n    fflush(stdout);\n  }\n\n  // Called before a test starts.\n  virtual void OnTestStart(const TestInfo& test_info) {\n    fprintf(stdout,\n            \"*** Test %s.%s starting.\\n\",\n            test_info.test_case_name(),\n            test_info.name());\n    fflush(stdout);\n  }\n\n  // Called after a failed assertion or a SUCCEED() invocation.\n  virtual void OnTestPartResult(const TestPartResult& test_part_result) {\n    fprintf(stdout,\n            \"%s in %s:%d\\n%s\\n\",\n            test_part_result.failed() ? \"*** Failure\" : \"Success\",\n            test_part_result.file_name(),\n            test_part_result.line_number(),\n            test_part_result.summary());\n    fflush(stdout);\n  }\n\n  // Called after a test ends.\n  virtual void OnTestEnd(const TestInfo& test_info) {\n    fprintf(stdout,\n            \"*** Test %s.%s ending.\\n\",\n            test_info.test_case_name(),\n            test_info.name());\n    fflush(stdout);\n  }\n};  // class TersePrinter\n\nTEST(CustomOutputTest, PrintsMessage) {\n  printf(\"Printing something from the test body...\\n\");\n}\n\nTEST(CustomOutputTest, Succeeds) {\n  SUCCEED() << \"SUCCEED() has been invoked from here\";\n}\n\nTEST(CustomOutputTest, Fails) {\n  EXPECT_EQ(1, 2)\n      << \"This test fails in order to demonstrate alternative failure messages\";\n}\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  InitGoogleTest(&argc, argv);\n\n  bool terse_output = false;\n  if (argc > 1 && strcmp(argv[1], \"--terse_output\") == 0 )\n    terse_output = true;\n  else\n    printf(\"%s\\n\", \"Run this program with --terse_output to change the way \"\n           \"it prints its output.\");\n\n  UnitTest& unit_test = *UnitTest::GetInstance();\n\n  // If we are given the --terse_output command line flag, suppresses the\n  // standard output and attaches own result printer.\n  if (terse_output) {\n    TestEventListeners& listeners = unit_test.listeners();\n\n    // Removes the default console output listener from the list so it will\n    // not receive events from Google Test and won't print any output. Since\n    // this operation transfers ownership of the listener to the caller we\n    // have to delete it as well.\n    delete listeners.Release(listeners.default_result_printer());\n\n    // Adds the custom output listener to the list. It will now receive\n    // events from Google Test and print the alternative output. We don't\n    // have to worry about deleting it since Google Test assumes ownership\n    // over it after adding it to the list.\n    listeners.Append(new TersePrinter);\n  }\n  int ret_val = RUN_ALL_TESTS();\n\n  // This is an example of using the UnitTest reflection API to inspect test\n  // results. Here we discount failures from the tests we expected to fail.\n  int unexpectedly_failed_tests = 0;\n  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {\n    const TestCase& test_case = *unit_test.GetTestCase(i);\n    for (int j = 0; j < test_case.total_test_count(); ++j) {\n      const TestInfo& test_info = *test_case.GetTestInfo(j);\n      // Counts failed tests that were not meant to fail (those without\n      // 'Fails' in the name).\n      if (test_info.result()->Failed() &&\n          strcmp(test_info.name(), \"Fails\") != 0) {\n        unexpectedly_failed_tests++;\n      }\n    }\n  }\n\n  // Test that were meant to fail should not affect the test program outcome.\n  if (unexpectedly_failed_tests == 0)\n    ret_val = 0;\n\n  return ret_val;\n}\n"
  },
  {
    "path": "Tests/gtest/scripts/fuse_gtest_files.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"fuse_gtest_files.py v0.2.0\nFuses Google Test source code into a .h file and a .cc file.\n\nSYNOPSIS\n       fuse_gtest_files.py [GTEST_ROOT_DIR] OUTPUT_DIR\n\n       Scans GTEST_ROOT_DIR for Google Test source code, and generates\n       two files: OUTPUT_DIR/gtest/gtest.h and OUTPUT_DIR/gtest/gtest-all.cc.\n       Then you can build your tests by adding OUTPUT_DIR to the include\n       search path and linking with OUTPUT_DIR/gtest/gtest-all.cc.  These\n       two files contain everything you need to use Google Test.  Hence\n       you can \"install\" Google Test by copying them to wherever you want.\n\n       GTEST_ROOT_DIR can be omitted and defaults to the parent\n       directory of the directory holding this script.\n\nEXAMPLES\n       ./fuse_gtest_files.py fused_gtest\n       ./fuse_gtest_files.py path/to/unpacked/gtest fused_gtest\n\nThis tool is experimental.  In particular, it assumes that there is no\nconditional inclusion of Google Test headers.  Please report any\nproblems to googletestframework@googlegroups.com.  You can read\nhttp://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for\nmore information.\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport re\nimport sets\nimport sys\n\n# We assume that this file is in the scripts/ directory in the Google\n# Test root directory.\nDEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')\n\n# Regex for matching '#include \"gtest/...\"'.\nINCLUDE_GTEST_FILE_REGEX = re.compile(r'^\\s*#\\s*include\\s*\"(gtest/.+)\"')\n\n# Regex for matching '#include \"src/...\"'.\nINCLUDE_SRC_FILE_REGEX = re.compile(r'^\\s*#\\s*include\\s*\"(src/.+)\"')\n\n# Where to find the source seed files.\nGTEST_H_SEED = 'include/gtest/gtest.h'\nGTEST_SPI_H_SEED = 'include/gtest/gtest-spi.h'\nGTEST_ALL_CC_SEED = 'src/gtest-all.cc'\n\n# Where to put the generated files.\nGTEST_H_OUTPUT = 'gtest/gtest.h'\nGTEST_ALL_CC_OUTPUT = 'gtest/gtest-all.cc'\n\n\ndef VerifyFileExists(directory, relative_path):\n  \"\"\"Verifies that the given file exists; aborts on failure.\n\n  relative_path is the file path relative to the given directory.\n  \"\"\"\n\n  if not os.path.isfile(os.path.join(directory, relative_path)):\n    print 'ERROR: Cannot find %s in directory %s.' % (relative_path,\n                                                      directory)\n    print ('Please either specify a valid project root directory '\n           'or omit it on the command line.')\n    sys.exit(1)\n\n\ndef ValidateGTestRootDir(gtest_root):\n  \"\"\"Makes sure gtest_root points to a valid gtest root directory.\n\n  The function aborts the program on failure.\n  \"\"\"\n\n  VerifyFileExists(gtest_root, GTEST_H_SEED)\n  VerifyFileExists(gtest_root, GTEST_ALL_CC_SEED)\n\n\ndef VerifyOutputFile(output_dir, relative_path):\n  \"\"\"Verifies that the given output file path is valid.\n\n  relative_path is relative to the output_dir directory.\n  \"\"\"\n\n  # Makes sure the output file either doesn't exist or can be overwritten.\n  output_file = os.path.join(output_dir, relative_path)\n  if os.path.exists(output_file):\n    # TODO(wan@google.com): The following user-interaction doesn't\n    # work with automated processes.  We should provide a way for the\n    # Makefile to force overwriting the files.\n    print ('%s already exists in directory %s - overwrite it? (y/N) ' %\n           (relative_path, output_dir))\n    answer = sys.stdin.readline().strip()\n    if answer not in ['y', 'Y']:\n      print 'ABORTED.'\n      sys.exit(1)\n\n  # Makes sure the directory holding the output file exists; creates\n  # it and all its ancestors if necessary.\n  parent_directory = os.path.dirname(output_file)\n  if not os.path.isdir(parent_directory):\n    os.makedirs(parent_directory)\n\n\ndef ValidateOutputDir(output_dir):\n  \"\"\"Makes sure output_dir points to a valid output directory.\n\n  The function aborts the program on failure.\n  \"\"\"\n\n  VerifyOutputFile(output_dir, GTEST_H_OUTPUT)\n  VerifyOutputFile(output_dir, GTEST_ALL_CC_OUTPUT)\n\n\ndef FuseGTestH(gtest_root, output_dir):\n  \"\"\"Scans folder gtest_root to generate gtest/gtest.h in output_dir.\"\"\"\n\n  output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')\n  processed_files = sets.Set()  # Holds all gtest headers we've processed.\n\n  def ProcessFile(gtest_header_path):\n    \"\"\"Processes the given gtest header file.\"\"\"\n\n    # We don't process the same header twice.\n    if gtest_header_path in processed_files:\n      return\n\n    processed_files.add(gtest_header_path)\n\n    # Reads each line in the given gtest header.\n    for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):\n      m = INCLUDE_GTEST_FILE_REGEX.match(line)\n      if m:\n        # It's '#include \"gtest/...\"' - let's process it recursively.\n        ProcessFile('include/' + m.group(1))\n      else:\n        # Otherwise we copy the line unchanged to the output file.\n        output_file.write(line)\n\n  ProcessFile(GTEST_H_SEED)\n  output_file.close()\n\n\ndef FuseGTestAllCcToFile(gtest_root, output_file):\n  \"\"\"Scans folder gtest_root to generate gtest/gtest-all.cc in output_file.\"\"\"\n\n  processed_files = sets.Set()\n\n  def ProcessFile(gtest_source_file):\n    \"\"\"Processes the given gtest source file.\"\"\"\n\n    # We don't process the same #included file twice.\n    if gtest_source_file in processed_files:\n      return\n\n    processed_files.add(gtest_source_file)\n\n    # Reads each line in the given gtest source file.\n    for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):\n      m = INCLUDE_GTEST_FILE_REGEX.match(line)\n      if m:\n        if 'include/' + m.group(1) == GTEST_SPI_H_SEED:\n          # It's '#include \"gtest/gtest-spi.h\"'.  This file is not\n          # #included by \"gtest/gtest.h\", so we need to process it.\n          ProcessFile(GTEST_SPI_H_SEED)\n        else:\n          # It's '#include \"gtest/foo.h\"' where foo is not gtest-spi.\n          # We treat it as '#include \"gtest/gtest.h\"', as all other\n          # gtest headers are being fused into gtest.h and cannot be\n          # #included directly.\n\n          # There is no need to #include \"gtest/gtest.h\" more than once.\n          if not GTEST_H_SEED in processed_files:\n            processed_files.add(GTEST_H_SEED)\n            output_file.write('#include \"%s\"\\n' % (GTEST_H_OUTPUT,))\n      else:\n        m = INCLUDE_SRC_FILE_REGEX.match(line)\n        if m:\n          # It's '#include \"src/foo\"' - let's process it recursively.\n          ProcessFile(m.group(1))\n        else:\n          output_file.write(line)\n\n  ProcessFile(GTEST_ALL_CC_SEED)\n\n\ndef FuseGTestAllCc(gtest_root, output_dir):\n  \"\"\"Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir.\"\"\"\n\n  output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')\n  FuseGTestAllCcToFile(gtest_root, output_file)\n  output_file.close()\n\n\ndef FuseGTest(gtest_root, output_dir):\n  \"\"\"Fuses gtest.h and gtest-all.cc.\"\"\"\n\n  ValidateGTestRootDir(gtest_root)\n  ValidateOutputDir(output_dir)\n\n  FuseGTestH(gtest_root, output_dir)\n  FuseGTestAllCc(gtest_root, output_dir)\n\n\ndef main():\n  argc = len(sys.argv)\n  if argc == 2:\n    # fuse_gtest_files.py OUTPUT_DIR\n    FuseGTest(DEFAULT_GTEST_ROOT_DIR, sys.argv[1])\n  elif argc == 3:\n    # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR\n    FuseGTest(sys.argv[1], sys.argv[2])\n  else:\n    print __doc__\n    sys.exit(1)\n\n\nif __name__ == '__main__':\n  main()\n"
  },
  {
    "path": "Tests/gtest/scripts/gen_gtest_pred_impl.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"gen_gtest_pred_impl.py v0.1\n\nGenerates the implementation of Google Test predicate assertions and\naccompanying tests.\n\nUsage:\n\n  gen_gtest_pred_impl.py MAX_ARITY\n\nwhere MAX_ARITY is a positive integer.\n\nThe command generates the implementation of up-to MAX_ARITY-ary\npredicate assertions, and writes it to file gtest_pred_impl.h in the\ndirectory where the script is.  It also generates the accompanying\nunit test in file gtest_pred_impl_unittest.cc.\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport sys\nimport time\n\n# Where this script is.\nSCRIPT_DIR = os.path.dirname(sys.argv[0])\n\n# Where to store the generated header.\nHEADER = os.path.join(SCRIPT_DIR, '../include/gtest/gtest_pred_impl.h')\n\n# Where to store the generated unit test.\nUNIT_TEST = os.path.join(SCRIPT_DIR, '../test/gtest_pred_impl_unittest.cc')\n\n\ndef HeaderPreamble(n):\n  \"\"\"Returns the preamble for the header file.\n\n  Args:\n    n:  the maximum arity of the predicate macros to be generated.\n  \"\"\"\n\n  # A map that defines the values used in the preamble template.\n  DEFS = {\n    'today' : time.strftime('%m/%d/%Y'),\n    'year' : time.strftime('%Y'),\n    'command' : '%s %s' % (os.path.basename(sys.argv[0]), n),\n    'n' : n\n    }\n\n  return (\n\"\"\"// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// This file is AUTOMATICALLY GENERATED on %(today)s by command\n// '%(command)s'.  DO NOT EDIT BY HAND!\n//\n// Implements a family of generic predicate assertion macros.\n\n#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n\n// Makes sure this header is not included before gtest.h.\n#ifndef GTEST_INCLUDE_GTEST_GTEST_H_\n# error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.\n#endif  // GTEST_INCLUDE_GTEST_GTEST_H_\n\n// This header implements a family of generic predicate assertion\n// macros:\n//\n//   ASSERT_PRED_FORMAT1(pred_format, v1)\n//   ASSERT_PRED_FORMAT2(pred_format, v1, v2)\n//   ...\n//\n// where pred_format is a function or functor that takes n (in the\n// case of ASSERT_PRED_FORMATn) values and their source expression\n// text, and returns a testing::AssertionResult.  See the definition\n// of ASSERT_EQ in gtest.h for an example.\n//\n// If you don't care about formatting, you can use the more\n// restrictive version:\n//\n//   ASSERT_PRED1(pred, v1)\n//   ASSERT_PRED2(pred, v1, v2)\n//   ...\n//\n// where pred is an n-ary function or functor that returns bool,\n// and the values v1, v2, ..., must support the << operator for\n// streaming to std::ostream.\n//\n// We also define the EXPECT_* variations.\n//\n// For now we only support predicates whose arity is at most %(n)s.\n// Please email googletestframework@googlegroups.com if you need\n// support for higher arities.\n\n// GTEST_ASSERT_ is the basic statement to which all of the assertions\n// in this file reduce.  Don't use this in your code.\n\n#define GTEST_ASSERT_(expression, on_failure) \\\\\n  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\\\\n  if (const ::testing::AssertionResult gtest_ar = (expression)) \\\\\n    ; \\\\\n  else \\\\\n    on_failure(gtest_ar.failure_message())\n\"\"\" % DEFS)\n\n\ndef Arity(n):\n  \"\"\"Returns the English name of the given arity.\"\"\"\n\n  if n < 0:\n    return None\n  elif n <= 3:\n    return ['nullary', 'unary', 'binary', 'ternary'][n]\n  else:\n    return '%s-ary' % n\n\n\ndef Title(word):\n  \"\"\"Returns the given word in title case.  The difference between\n  this and string's title() method is that Title('4-ary') is '4-ary'\n  while '4-ary'.title() is '4-Ary'.\"\"\"\n\n  return word[0].upper() + word[1:]\n\n\ndef OneTo(n):\n  \"\"\"Returns the list [1, 2, 3, ..., n].\"\"\"\n\n  return range(1, n + 1)\n\n\ndef Iter(n, format, sep=''):\n  \"\"\"Given a positive integer n, a format string that contains 0 or\n  more '%s' format specs, and optionally a separator string, returns\n  the join of n strings, each formatted with the format string on an\n  iterator ranged from 1 to n.\n\n  Example:\n\n  Iter(3, 'v%s', sep=', ') returns 'v1, v2, v3'.\n  \"\"\"\n\n  # How many '%s' specs are in format?\n  spec_count = len(format.split('%s')) - 1\n  return sep.join([format % (spec_count * (i,)) for i in OneTo(n)])\n\n\ndef ImplementationForArity(n):\n  \"\"\"Returns the implementation of n-ary predicate assertions.\"\"\"\n\n  # A map the defines the values used in the implementation template.\n  DEFS = {\n    'n' : str(n),\n    'vs' : Iter(n, 'v%s', sep=', '),\n    'vts' : Iter(n, '#v%s', sep=', '),\n    'arity' : Arity(n),\n    'Arity' : Title(Arity(n))\n    }\n\n  impl = \"\"\"\n\n// Helper function for implementing {EXPECT|ASSERT}_PRED%(n)s.  Don't use\n// this in your code.\ntemplate <typename Pred\"\"\" % DEFS\n\n  impl += Iter(n, \"\"\",\n          typename T%s\"\"\")\n\n  impl += \"\"\">\nAssertionResult AssertPred%(n)sHelper(const char* pred_text\"\"\" % DEFS\n\n  impl += Iter(n, \"\"\",\n                                  const char* e%s\"\"\")\n\n  impl += \"\"\",\n                                  Pred pred\"\"\"\n\n  impl += Iter(n, \"\"\",\n                                  const T%s& v%s\"\"\")\n\n  impl += \"\"\") {\n  if (pred(%(vs)s)) return AssertionSuccess();\n\n\"\"\" % DEFS\n\n  impl += '  return AssertionFailure() << pred_text << \"(\"'\n\n  impl += Iter(n, \"\"\"\n                            << e%s\"\"\", sep=' << \", \"')\n\n  impl += ' << \") evaluates to false, where\"'\n\n  impl += Iter(n, \"\"\"\n                            << \"\\\\n\" << e%s << \" evaluates to \" << v%s\"\"\")\n\n  impl += \"\"\";\n}\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.\n// Don't use this in your code.\n#define GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, on_failure)\\\\\n  GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s), \\\\\n                on_failure)\n\n// Internal macro for implementing {EXPECT|ASSERT}_PRED%(n)s.  Don't use\n// this in your code.\n#define GTEST_PRED%(n)s_(pred, %(vs)s, on_failure)\\\\\n  GTEST_ASSERT_(::testing::AssertPred%(n)sHelper(#pred\"\"\" % DEFS\n\n  impl += Iter(n, \"\"\", \\\\\n                                             #v%s\"\"\")\n\n  impl += \"\"\", \\\\\n                                             pred\"\"\"\n\n  impl += Iter(n, \"\"\", \\\\\n                                             v%s\"\"\")\n\n  impl += \"\"\"), on_failure)\n\n// %(Arity)s predicate assertion macros.\n#define EXPECT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\\\\n  GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, GTEST_NONFATAL_FAILURE_)\n#define EXPECT_PRED%(n)s(pred, %(vs)s) \\\\\n  GTEST_PRED%(n)s_(pred, %(vs)s, GTEST_NONFATAL_FAILURE_)\n#define ASSERT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\\\\n  GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, GTEST_FATAL_FAILURE_)\n#define ASSERT_PRED%(n)s(pred, %(vs)s) \\\\\n  GTEST_PRED%(n)s_(pred, %(vs)s, GTEST_FATAL_FAILURE_)\n\n\"\"\" % DEFS\n\n  return impl\n\n\ndef HeaderPostamble():\n  \"\"\"Returns the postamble for the header file.\"\"\"\n\n  return \"\"\"\n\n#endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_\n\"\"\"\n\n\ndef GenerateFile(path, content):\n  \"\"\"Given a file path and a content string, overwrites it with the\n  given content.\"\"\"\n\n  print 'Updating file %s . . .' % path\n\n  f = file(path, 'w+')\n  print >>f, content,\n  f.close()\n\n  print 'File %s has been updated.' % path\n\n\ndef GenerateHeader(n):\n  \"\"\"Given the maximum arity n, updates the header file that implements\n  the predicate assertions.\"\"\"\n\n  GenerateFile(HEADER,\n               HeaderPreamble(n)\n               + ''.join([ImplementationForArity(i) for i in OneTo(n)])\n               + HeaderPostamble())\n\n\ndef UnitTestPreamble():\n  \"\"\"Returns the preamble for the unit test file.\"\"\"\n\n  # A map that defines the values used in the preamble template.\n  DEFS = {\n    'today' : time.strftime('%m/%d/%Y'),\n    'year' : time.strftime('%Y'),\n    'command' : '%s %s' % (os.path.basename(sys.argv[0]), sys.argv[1]),\n    }\n\n  return (\n\"\"\"// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// This file is AUTOMATICALLY GENERATED on %(today)s by command\n// '%(command)s'.  DO NOT EDIT BY HAND!\n\n// Regression test for gtest_pred_impl.h\n//\n// This file is generated by a script and quite long.  If you intend to\n// learn how Google Test works by reading its unit tests, read\n// gtest_unittest.cc instead.\n//\n// This is intended as a regression test for the Google Test predicate\n// assertions.  We compile it as part of the gtest_unittest target\n// only to keep the implementation tidy and compact, as it is quite\n// involved to set up the stage for testing Google Test using Google\n// Test itself.\n//\n// Currently, gtest_unittest takes ~11 seconds to run in the testing\n// daemon.  In the future, if it grows too large and needs much more\n// time to finish, we should consider separating this file into a\n// stand-alone regression test.\n\n#include <iostream>\n\n#include \"gtest/gtest.h\"\n#include \"gtest/gtest-spi.h\"\n\n// A user-defined data type.\nstruct Bool {\n  explicit Bool(int val) : value(val != 0) {}\n\n  bool operator>(int n) const { return value > Bool(n).value; }\n\n  Bool operator+(const Bool& rhs) const { return Bool(value + rhs.value); }\n\n  bool operator==(const Bool& rhs) const { return value == rhs.value; }\n\n  bool value;\n};\n\n// Enables Bool to be used in assertions.\nstd::ostream& operator<<(std::ostream& os, const Bool& x) {\n  return os << (x.value ? \"true\" : \"false\");\n}\n\n\"\"\" % DEFS)\n\n\ndef TestsForArity(n):\n  \"\"\"Returns the tests for n-ary predicate assertions.\"\"\"\n\n  # A map that defines the values used in the template for the tests.\n  DEFS = {\n    'n' : n,\n    'es' : Iter(n, 'e%s', sep=', '),\n    'vs' : Iter(n, 'v%s', sep=', '),\n    'vts' : Iter(n, '#v%s', sep=', '),\n    'tvs' : Iter(n, 'T%s v%s', sep=', '),\n    'int_vs' : Iter(n, 'int v%s', sep=', '),\n    'Bool_vs' : Iter(n, 'Bool v%s', sep=', '),\n    'types' : Iter(n, 'typename T%s', sep=', '),\n    'v_sum' : Iter(n, 'v%s', sep=' + '),\n    'arity' : Arity(n),\n    'Arity' : Title(Arity(n)),\n    }\n\n  tests = (\n\"\"\"// Sample functions/functors for testing %(arity)s predicate assertions.\n\n// A %(arity)s predicate function.\ntemplate <%(types)s>\nbool PredFunction%(n)s(%(tvs)s) {\n  return %(v_sum)s > 0;\n}\n\n// The following two functions are needed to circumvent a bug in\n// gcc 2.95.3, which sometimes has problem with the above template\n// function.\nbool PredFunction%(n)sInt(%(int_vs)s) {\n  return %(v_sum)s > 0;\n}\nbool PredFunction%(n)sBool(%(Bool_vs)s) {\n  return %(v_sum)s > 0;\n}\n\"\"\" % DEFS)\n\n  tests += \"\"\"\n// A %(arity)s predicate functor.\nstruct PredFunctor%(n)s {\n  template <%(types)s>\n  bool operator()(\"\"\" % DEFS\n\n  tests += Iter(n, 'const T%s& v%s', sep=\"\"\",\n                  \"\"\")\n\n  tests += \"\"\") {\n    return %(v_sum)s > 0;\n  }\n};\n\"\"\" % DEFS\n\n  tests += \"\"\"\n// A %(arity)s predicate-formatter function.\ntemplate <%(types)s>\ntesting::AssertionResult PredFormatFunction%(n)s(\"\"\" % DEFS\n\n  tests += Iter(n, 'const char* e%s', sep=\"\"\",\n                                             \"\"\")\n\n  tests += Iter(n, \"\"\",\n                                             const T%s& v%s\"\"\")\n\n  tests += \"\"\") {\n  if (PredFunction%(n)s(%(vs)s))\n    return testing::AssertionSuccess();\n\n  return testing::AssertionFailure()\n      << \"\"\" % DEFS\n\n  tests += Iter(n, 'e%s', sep=' << \" + \" << ')\n\n  tests += \"\"\"\n      << \" is expected to be positive, but evaluates to \"\n      << %(v_sum)s << \".\";\n}\n\"\"\" % DEFS\n\n  tests += \"\"\"\n// A %(arity)s predicate-formatter functor.\nstruct PredFormatFunctor%(n)s {\n  template <%(types)s>\n  testing::AssertionResult operator()(\"\"\" % DEFS\n\n  tests += Iter(n, 'const char* e%s', sep=\"\"\",\n                                      \"\"\")\n\n  tests += Iter(n, \"\"\",\n                                      const T%s& v%s\"\"\")\n\n  tests += \"\"\") const {\n    return PredFormatFunction%(n)s(%(es)s, %(vs)s);\n  }\n};\n\"\"\" % DEFS\n\n  tests += \"\"\"\n// Tests for {EXPECT|ASSERT}_PRED_FORMAT%(n)s.\n\nclass Predicate%(n)sTest : public testing::Test {\n protected:\n  virtual void SetUp() {\n    expected_to_finish_ = true;\n    finished_ = false;\"\"\" % DEFS\n\n  tests += \"\"\"\n    \"\"\" + Iter(n, 'n%s_ = ') + \"\"\"0;\n  }\n\"\"\"\n\n  tests += \"\"\"\n  virtual void TearDown() {\n    // Verifies that each of the predicate's arguments was evaluated\n    // exactly once.\"\"\"\n\n  tests += ''.join([\"\"\"\n    EXPECT_EQ(1, n%s_) <<\n        \"The predicate assertion didn't evaluate argument %s \"\n        \"exactly once.\";\"\"\" % (i, i + 1) for i in OneTo(n)])\n\n  tests += \"\"\"\n\n    // Verifies that the control flow in the test function is expected.\n    if (expected_to_finish_ && !finished_) {\n      FAIL() << \"The predicate assertion unexpactedly aborted the test.\";\n    } else if (!expected_to_finish_ && finished_) {\n      FAIL() << \"The failed predicate assertion didn't abort the test \"\n                \"as expected.\";\n    }\n  }\n\n  // true iff the test function is expected to run to finish.\n  static bool expected_to_finish_;\n\n  // true iff the test function did run to finish.\n  static bool finished_;\n\"\"\" % DEFS\n\n  tests += Iter(n, \"\"\"\n  static int n%s_;\"\"\")\n\n  tests += \"\"\"\n};\n\nbool Predicate%(n)sTest::expected_to_finish_;\nbool Predicate%(n)sTest::finished_;\n\"\"\" % DEFS\n\n  tests += Iter(n, \"\"\"int Predicate%%(n)sTest::n%s_;\n\"\"\") % DEFS\n\n  tests += \"\"\"\ntypedef Predicate%(n)sTest EXPECT_PRED_FORMAT%(n)sTest;\ntypedef Predicate%(n)sTest ASSERT_PRED_FORMAT%(n)sTest;\ntypedef Predicate%(n)sTest EXPECT_PRED%(n)sTest;\ntypedef Predicate%(n)sTest ASSERT_PRED%(n)sTest;\n\"\"\" % DEFS\n\n  def GenTest(use_format, use_assert, expect_failure,\n              use_functor, use_user_type):\n    \"\"\"Returns the test for a predicate assertion macro.\n\n    Args:\n      use_format:     true iff the assertion is a *_PRED_FORMAT*.\n      use_assert:     true iff the assertion is a ASSERT_*.\n      expect_failure: true iff the assertion is expected to fail.\n      use_functor:    true iff the first argument of the assertion is\n                      a functor (as opposed to a function)\n      use_user_type:  true iff the predicate functor/function takes\n                      argument(s) of a user-defined type.\n\n    Example:\n\n      GenTest(1, 0, 0, 1, 0) returns a test that tests the behavior\n      of a successful EXPECT_PRED_FORMATn() that takes a functor\n      whose arguments have built-in types.\"\"\"\n\n    if use_assert:\n      assrt = 'ASSERT'  # 'assert' is reserved, so we cannot use\n                        # that identifier here.\n    else:\n      assrt = 'EXPECT'\n\n    assertion = assrt + '_PRED'\n\n    if use_format:\n      pred_format = 'PredFormat'\n      assertion += '_FORMAT'\n    else:\n      pred_format = 'Pred'\n\n    assertion += '%(n)s' % DEFS\n\n    if use_functor:\n      pred_format_type = 'functor'\n      pred_format += 'Functor%(n)s()'\n    else:\n      pred_format_type = 'function'\n      pred_format += 'Function%(n)s'\n      if not use_format:\n        if use_user_type:\n          pred_format += 'Bool'\n        else:\n          pred_format += 'Int'\n\n    test_name = pred_format_type.title()\n\n    if use_user_type:\n      arg_type = 'user-defined type (Bool)'\n      test_name += 'OnUserType'\n      if expect_failure:\n        arg = 'Bool(n%s_++)'\n      else:\n        arg = 'Bool(++n%s_)'\n    else:\n      arg_type = 'built-in type (int)'\n      test_name += 'OnBuiltInType'\n      if expect_failure:\n        arg = 'n%s_++'\n      else:\n        arg = '++n%s_'\n\n    if expect_failure:\n      successful_or_failed = 'failed'\n      expected_or_not = 'expected.'\n      test_name +=  'Failure'\n    else:\n      successful_or_failed = 'successful'\n      expected_or_not = 'UNEXPECTED!'\n      test_name +=  'Success'\n\n    # A map that defines the values used in the test template.\n    defs = DEFS.copy()\n    defs.update({\n      'assert' : assrt,\n      'assertion' : assertion,\n      'test_name' : test_name,\n      'pf_type' : pred_format_type,\n      'pf' : pred_format,\n      'arg_type' : arg_type,\n      'arg' : arg,\n      'successful' : successful_or_failed,\n      'expected' : expected_or_not,\n      })\n\n    test = \"\"\"\n// Tests a %(successful)s %(assertion)s where the\n// predicate-formatter is a %(pf_type)s on a %(arg_type)s.\nTEST_F(%(assertion)sTest, %(test_name)s) {\"\"\" % defs\n\n    indent = (len(assertion) + 3)*' '\n    extra_indent = ''\n\n    if expect_failure:\n      extra_indent = '  '\n      if use_assert:\n        test += \"\"\"\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\"\"\"\n      else:\n        test += \"\"\"\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\"\"\"\n\n    test += '\\n' + extra_indent + \"\"\"  %(assertion)s(%(pf)s\"\"\" % defs\n\n    test = test % defs\n    test += Iter(n, ',\\n' + indent + extra_indent + '%(arg)s' % defs)\n    test += ');\\n' + extra_indent + '  finished_ = true;\\n'\n\n    if expect_failure:\n      test += '  }, \"\");\\n'\n\n    test += '}\\n'\n    return test\n\n  # Generates tests for all 2**6 = 64 combinations.\n  tests += ''.join([GenTest(use_format, use_assert, expect_failure,\n                            use_functor, use_user_type)\n                    for use_format in [0, 1]\n                    for use_assert in [0, 1]\n                    for expect_failure in [0, 1]\n                    for use_functor in [0, 1]\n                    for use_user_type in [0, 1]\n                    ])\n\n  return tests\n\n\ndef UnitTestPostamble():\n  \"\"\"Returns the postamble for the tests.\"\"\"\n\n  return ''\n\n\ndef GenerateUnitTest(n):\n  \"\"\"Returns the tests for up-to n-ary predicate assertions.\"\"\"\n\n  GenerateFile(UNIT_TEST,\n               UnitTestPreamble()\n               + ''.join([TestsForArity(i) for i in OneTo(n)])\n               + UnitTestPostamble())\n\n\ndef _Main():\n  \"\"\"The entry point of the script.  Generates the header file and its\n  unit test.\"\"\"\n\n  if len(sys.argv) != 2:\n    print __doc__\n    print 'Author: ' + __author__\n    sys.exit(1)\n\n  n = int(sys.argv[1])\n  GenerateHeader(n)\n  GenerateUnitTest(n)\n\n\nif __name__ == '__main__':\n  _Main()\n"
  },
  {
    "path": "Tests/gtest/scripts/gtest-config.in",
    "content": "#!/bin/sh\n\n# These variables are automatically filled in by the configure script.\nname=\"@PACKAGE_TARNAME@\"\nversion=\"@PACKAGE_VERSION@\"\n\nshow_usage()\n{\n  echo \"Usage: gtest-config [OPTIONS...]\"\n}\n\nshow_help()\n{\n  show_usage\n  cat <<\\EOF\n\nThe `gtest-config' script provides access to the necessary compile and linking\nflags to connect with Google C++ Testing Framework, both in a build prior to\ninstallation, and on the system proper after installation. The installation\noverrides may be issued in combination with any other queries, but will only\naffect installation queries if called on a built but not installed gtest. The\ninstallation queries may not be issued with any other types of queries, and\nonly one installation query may be made at a time. The version queries and\ncompiler flag queries may be combined as desired but not mixed. Different\nversion queries are always combined with logical \"and\" semantics, and only the\nlast of any particular query is used while all previous ones ignored. All\nversions must be specified as a sequence of numbers separated by periods.\nCompiler flag queries output the union of the sets of flags when combined.\n\n Examples:\n  gtest-config --min-version=1.0 || echo \"Insufficient Google Test version.\"\n\n  g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp\n  g++ $(gtest-config --ldflags --libs) -o foo foo.o\n\n  # When using a built but not installed Google Test:\n  g++ $(../../my_gtest_build/scripts/gtest-config ...) ...\n\n  # When using an installed Google Test, but with installation overrides:\n  export GTEST_PREFIX=\"/opt\"\n  g++ $(gtest-config --libdir=\"/opt/lib64\" ...) ...\n\n Help:\n  --usage                    brief usage information\n  --help                     display this help message\n\n Installation Overrides:\n  --prefix=<dir>             overrides the installation prefix\n  --exec-prefix=<dir>        overrides the executable installation prefix\n  --libdir=<dir>             overrides the library installation prefix\n  --includedir=<dir>         overrides the header file installation prefix\n\n Installation Queries:\n  --prefix                   installation prefix\n  --exec-prefix              executable installation prefix\n  --libdir                   library installation directory\n  --includedir               header file installation directory\n  --version                  the version of the Google Test installation\n\n Version Queries:\n  --min-version=VERSION      return 0 if the version is at least VERSION\n  --exact-version=VERSION    return 0 if the version is exactly VERSION\n  --max-version=VERSION      return 0 if the version is at most VERSION\n\n Compilation Flag Queries:\n  --cppflags                 compile flags specific to the C-like preprocessors\n  --cxxflags                 compile flags appropriate for C++ programs\n  --ldflags                  linker flags\n  --libs                     libraries for linking\n\nEOF\n}\n\n# This function bounds our version with a min and a max. It uses some clever\n# POSIX-compliant variable expansion to portably do all the work in the shell\n# and avoid any dependency on a particular \"sed\" or \"awk\" implementation.\n# Notable is that it will only ever compare the first 3 components of versions.\n# Further components will be cleanly stripped off. All versions must be\n# unadorned, so \"v1.0\" will *not* work. The minimum version must be in $1, and\n# the max in $2. TODO(chandlerc@google.com): If this ever breaks, we should\n# investigate expanding this via autom4te from AS_VERSION_COMPARE rather than\n# continuing to maintain our own shell version.\ncheck_versions()\n{\n  major_version=${version%%.*}\n  minor_version=\"0\"\n  point_version=\"0\"\n  if test \"${version#*.}\" != \"${version}\"; then\n    minor_version=${version#*.}\n    minor_version=${minor_version%%.*}\n  fi\n  if test \"${version#*.*.}\" != \"${version}\"; then\n    point_version=${version#*.*.}\n    point_version=${point_version%%.*}\n  fi\n\n  min_version=\"$1\"\n  min_major_version=${min_version%%.*}\n  min_minor_version=\"0\"\n  min_point_version=\"0\"\n  if test \"${min_version#*.}\" != \"${min_version}\"; then\n    min_minor_version=${min_version#*.}\n    min_minor_version=${min_minor_version%%.*}\n  fi\n  if test \"${min_version#*.*.}\" != \"${min_version}\"; then\n    min_point_version=${min_version#*.*.}\n    min_point_version=${min_point_version%%.*}\n  fi\n\n  max_version=\"$2\"\n  max_major_version=${max_version%%.*}\n  max_minor_version=\"0\"\n  max_point_version=\"0\"\n  if test \"${max_version#*.}\" != \"${max_version}\"; then\n    max_minor_version=${max_version#*.}\n    max_minor_version=${max_minor_version%%.*}\n  fi\n  if test \"${max_version#*.*.}\" != \"${max_version}\"; then\n    max_point_version=${max_version#*.*.}\n    max_point_version=${max_point_version%%.*}\n  fi\n\n  test $(($major_version)) -lt $(($min_major_version)) && exit 1\n  if test $(($major_version)) -eq $(($min_major_version)); then\n    test $(($minor_version)) -lt $(($min_minor_version)) && exit 1\n    if test $(($minor_version)) -eq $(($min_minor_version)); then\n      test $(($point_version)) -lt $(($min_point_version)) && exit 1\n    fi\n  fi\n\n  test $(($major_version)) -gt $(($max_major_version)) && exit 1\n  if test $(($major_version)) -eq $(($max_major_version)); then\n    test $(($minor_version)) -gt $(($max_minor_version)) && exit 1\n    if test $(($minor_version)) -eq $(($max_minor_version)); then\n      test $(($point_version)) -gt $(($max_point_version)) && exit 1\n    fi\n  fi\n\n  exit 0\n}\n\n# Show the usage line when no arguments are specified.\nif test $# -eq 0; then\n  show_usage\n  exit 1\nfi\n\nwhile test $# -gt 0; do\n  case $1 in\n    --usage)          show_usage;         exit 0;;\n    --help)           show_help;          exit 0;;\n\n    # Installation overrides\n    --prefix=*)       GTEST_PREFIX=${1#--prefix=};;\n    --exec-prefix=*)  GTEST_EXEC_PREFIX=${1#--exec-prefix=};;\n    --libdir=*)       GTEST_LIBDIR=${1#--libdir=};;\n    --includedir=*)   GTEST_INCLUDEDIR=${1#--includedir=};;\n\n    # Installation queries\n    --prefix|--exec-prefix|--libdir|--includedir|--version)\n      if test -n \"${do_query}\"; then\n        show_usage\n        exit 1\n      fi\n      do_query=${1#--}\n      ;;\n\n    # Version checking\n    --min-version=*)\n      do_check_versions=yes\n      min_version=${1#--min-version=}\n      ;;\n    --max-version=*)\n      do_check_versions=yes\n      max_version=${1#--max-version=}\n      ;;\n    --exact-version=*)\n      do_check_versions=yes\n      exact_version=${1#--exact-version=}\n      ;;\n\n    # Compiler flag output\n    --cppflags)       echo_cppflags=yes;;\n    --cxxflags)       echo_cxxflags=yes;;\n    --ldflags)        echo_ldflags=yes;;\n    --libs)           echo_libs=yes;;\n\n    # Everything else is an error\n    *)                show_usage;         exit 1;;\n  esac\n  shift\ndone\n\n# These have defaults filled in by the configure script but can also be\n# overridden by environment variables or command line parameters.\nprefix=\"${GTEST_PREFIX:-@prefix@}\"\nexec_prefix=\"${GTEST_EXEC_PREFIX:-@exec_prefix@}\"\nlibdir=\"${GTEST_LIBDIR:-@libdir@}\"\nincludedir=\"${GTEST_INCLUDEDIR:-@includedir@}\"\n\n# We try and detect if our binary is not located at its installed location. If\n# it's not, we provide variables pointing to the source and build tree rather\n# than to the install tree. This allows building against a just-built gtest\n# rather than an installed gtest.\nbindir=\"@bindir@\"\nthis_relative_bindir=`dirname $0`\nthis_bindir=`cd ${this_relative_bindir}; pwd -P`\nif test \"${this_bindir}\" = \"${this_bindir%${bindir}}\"; then\n  # The path to the script doesn't end in the bindir sequence from Autoconf,\n  # assume that we are in a build tree.\n  build_dir=`dirname ${this_bindir}`\n  src_dir=`cd ${this_bindir}; cd @top_srcdir@; pwd -P`\n\n  # TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we\n  # should work to remove it, and/or remove libtool altogether, replacing it\n  # with direct references to the library and a link path.\n  gtest_libs=\"${build_dir}/lib/libgtest.la @PTHREAD_CFLAGS@ @PTHREAD_LIBS@\"\n  gtest_ldflags=\"\"\n\n  # We provide hooks to include from either the source or build dir, where the\n  # build dir is always preferred. This will potentially allow us to write\n  # build rules for generated headers and have them automatically be preferred\n  # over provided versions.\n  gtest_cppflags=\"-I${build_dir}/include -I${src_dir}/include\"\n  gtest_cxxflags=\"@PTHREAD_CFLAGS@\"\nelse\n  # We're using an installed gtest, although it may be staged under some\n  # prefix. Assume (as our own libraries do) that we can resolve the prefix,\n  # and are present in the dynamic link paths.\n  gtest_ldflags=\"-L${libdir}\"\n  gtest_libs=\"-l${name} @PTHREAD_CFLAGS@ @PTHREAD_LIBS@\"\n  gtest_cppflags=\"-I${includedir}\"\n  gtest_cxxflags=\"@PTHREAD_CFLAGS@\"\nfi\n\n# Do an installation query if requested.\nif test -n \"$do_query\"; then\n  case $do_query in\n    prefix)           echo $prefix;       exit 0;;\n    exec-prefix)      echo $exec_prefix;  exit 0;;\n    libdir)           echo $libdir;       exit 0;;\n    includedir)       echo $includedir;   exit 0;;\n    version)          echo $version;      exit 0;;\n    *)                show_usage;         exit 1;;\n  esac\nfi\n\n# Do a version check if requested.\nif test \"$do_check_versions\" = \"yes\"; then\n  # Make sure we didn't receive a bad combination of parameters.\n  test \"$echo_cppflags\" = \"yes\" && show_usage && exit 1\n  test \"$echo_cxxflags\" = \"yes\" && show_usage && exit 1\n  test \"$echo_ldflags\" = \"yes\"  && show_usage && exit 1\n  test \"$echo_libs\" = \"yes\"     && show_usage && exit 1\n\n  if test \"$exact_version\" != \"\"; then\n    check_versions $exact_version $exact_version\n    # unreachable\n  else\n    check_versions ${min_version:-0.0.0} ${max_version:-9999.9999.9999}\n    # unreachable\n  fi\nfi\n\n# Do the output in the correct order so that these can be used in-line of\n# a compiler invocation.\noutput=\"\"\ntest \"$echo_cppflags\" = \"yes\" && output=\"$output $gtest_cppflags\"\ntest \"$echo_cxxflags\" = \"yes\" && output=\"$output $gtest_cxxflags\"\ntest \"$echo_ldflags\" = \"yes\"  && output=\"$output $gtest_ldflags\"\ntest \"$echo_libs\" = \"yes\"     && output=\"$output $gtest_libs\"\necho $output\n\nexit 0\n"
  },
  {
    "path": "Tests/gtest/scripts/pump.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"pump v0.2.0 - Pretty Useful for Meta Programming.\n\nA tool for preprocessor meta programming.  Useful for generating\nrepetitive boilerplate code.  Especially useful for writing C++\nclasses, functions, macros, and templates that need to work with\nvarious number of arguments.\n\nUSAGE:\n       pump.py SOURCE_FILE\n\nEXAMPLES:\n       pump.py foo.cc.pump\n         Converts foo.cc.pump to foo.cc.\n\nGRAMMAR:\n       CODE ::= ATOMIC_CODE*\n       ATOMIC_CODE ::= $var ID = EXPRESSION\n           | $var ID = [[ CODE ]]\n           | $range ID EXPRESSION..EXPRESSION\n           | $for ID SEPARATOR [[ CODE ]]\n           | $($)\n           | $ID\n           | $(EXPRESSION)\n           | $if EXPRESSION [[ CODE ]] ELSE_BRANCH\n           | [[ CODE ]]\n           | RAW_CODE\n       SEPARATOR ::= RAW_CODE | EMPTY\n       ELSE_BRANCH ::= $else [[ CODE ]]\n           | $elif EXPRESSION [[ CODE ]] ELSE_BRANCH\n           | EMPTY\n       EXPRESSION has Python syntax.\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport re\nimport sys\n\n\nTOKEN_TABLE = [\n    (re.compile(r'\\$var\\s+'), '$var'),\n    (re.compile(r'\\$elif\\s+'), '$elif'),\n    (re.compile(r'\\$else\\s+'), '$else'),\n    (re.compile(r'\\$for\\s+'), '$for'),\n    (re.compile(r'\\$if\\s+'), '$if'),\n    (re.compile(r'\\$range\\s+'), '$range'),\n    (re.compile(r'\\$[_A-Za-z]\\w*'), '$id'),\n    (re.compile(r'\\$\\(\\$\\)'), '$($)'),\n    (re.compile(r'\\$'), '$'),\n    (re.compile(r'\\[\\[\\n?'), '[['),\n    (re.compile(r'\\]\\]\\n?'), ']]'),\n    ]\n\n\nclass Cursor:\n  \"\"\"Represents a position (line and column) in a text file.\"\"\"\n\n  def __init__(self, line=-1, column=-1):\n    self.line = line\n    self.column = column\n\n  def __eq__(self, rhs):\n    return self.line == rhs.line and self.column == rhs.column\n\n  def __ne__(self, rhs):\n    return not self == rhs\n\n  def __lt__(self, rhs):\n    return self.line < rhs.line or (\n        self.line == rhs.line and self.column < rhs.column)\n\n  def __le__(self, rhs):\n    return self < rhs or self == rhs\n\n  def __gt__(self, rhs):\n    return rhs < self\n\n  def __ge__(self, rhs):\n    return rhs <= self\n\n  def __str__(self):\n    if self == Eof():\n      return 'EOF'\n    else:\n      return '%s(%s)' % (self.line + 1, self.column)\n\n  def __add__(self, offset):\n    return Cursor(self.line, self.column + offset)\n\n  def __sub__(self, offset):\n    return Cursor(self.line, self.column - offset)\n\n  def Clone(self):\n    \"\"\"Returns a copy of self.\"\"\"\n\n    return Cursor(self.line, self.column)\n\n\n# Special cursor to indicate the end-of-file.\ndef Eof():\n  \"\"\"Returns the special cursor to denote the end-of-file.\"\"\"\n  return Cursor(-1, -1)\n\n\nclass Token:\n  \"\"\"Represents a token in a Pump source file.\"\"\"\n\n  def __init__(self, start=None, end=None, value=None, token_type=None):\n    if start is None:\n      self.start = Eof()\n    else:\n      self.start = start\n    if end is None:\n      self.end = Eof()\n    else:\n      self.end = end\n    self.value = value\n    self.token_type = token_type\n\n  def __str__(self):\n    return 'Token @%s: \\'%s\\' type=%s' % (\n        self.start, self.value, self.token_type)\n\n  def Clone(self):\n    \"\"\"Returns a copy of self.\"\"\"\n\n    return Token(self.start.Clone(), self.end.Clone(), self.value,\n                 self.token_type)\n\n\ndef StartsWith(lines, pos, string):\n  \"\"\"Returns True iff the given position in lines starts with 'string'.\"\"\"\n\n  return lines[pos.line][pos.column:].startswith(string)\n\n\ndef FindFirstInLine(line, token_table):\n  best_match_start = -1\n  for (regex, token_type) in token_table:\n    m = regex.search(line)\n    if m:\n      # We found regex in lines\n      if best_match_start < 0 or m.start() < best_match_start:\n        best_match_start = m.start()\n        best_match_length = m.end() - m.start()\n        best_match_token_type = token_type\n\n  if best_match_start < 0:\n    return None\n\n  return (best_match_start, best_match_length, best_match_token_type)\n\n\ndef FindFirst(lines, token_table, cursor):\n  \"\"\"Finds the first occurrence of any string in strings in lines.\"\"\"\n\n  start = cursor.Clone()\n  cur_line_number = cursor.line\n  for line in lines[start.line:]:\n    if cur_line_number == start.line:\n      line = line[start.column:]\n    m = FindFirstInLine(line, token_table)\n    if m:\n      # We found a regex in line.\n      (start_column, length, token_type) = m\n      if cur_line_number == start.line:\n        start_column += start.column\n      found_start = Cursor(cur_line_number, start_column)\n      found_end = found_start + length\n      return MakeToken(lines, found_start, found_end, token_type)\n    cur_line_number += 1\n  # We failed to find str in lines\n  return None\n\n\ndef SubString(lines, start, end):\n  \"\"\"Returns a substring in lines.\"\"\"\n\n  if end == Eof():\n    end = Cursor(len(lines) - 1, len(lines[-1]))\n\n  if start >= end:\n    return ''\n\n  if start.line == end.line:\n    return lines[start.line][start.column:end.column]\n\n  result_lines = ([lines[start.line][start.column:]] +\n                  lines[start.line + 1:end.line] +\n                  [lines[end.line][:end.column]])\n  return ''.join(result_lines)\n\n\ndef StripMetaComments(str):\n  \"\"\"Strip meta comments from each line in the given string.\"\"\"\n\n  # First, completely remove lines containing nothing but a meta\n  # comment, including the trailing \\n.\n  str = re.sub(r'^\\s*\\$\\$.*\\n', '', str)\n\n  # Then, remove meta comments from contentful lines.\n  return re.sub(r'\\s*\\$\\$.*', '', str)\n\n\ndef MakeToken(lines, start, end, token_type):\n  \"\"\"Creates a new instance of Token.\"\"\"\n\n  return Token(start, end, SubString(lines, start, end), token_type)\n\n\ndef ParseToken(lines, pos, regex, token_type):\n  line = lines[pos.line][pos.column:]\n  m = regex.search(line)\n  if m and not m.start():\n    return MakeToken(lines, pos, pos + m.end(), token_type)\n  else:\n    print 'ERROR: %s expected at %s.' % (token_type, pos)\n    sys.exit(1)\n\n\nID_REGEX = re.compile(r'[_A-Za-z]\\w*')\nEQ_REGEX = re.compile(r'=')\nREST_OF_LINE_REGEX = re.compile(r'.*?(?=$|\\$\\$)')\nOPTIONAL_WHITE_SPACES_REGEX = re.compile(r'\\s*')\nWHITE_SPACE_REGEX = re.compile(r'\\s')\nDOT_DOT_REGEX = re.compile(r'\\.\\.')\n\n\ndef Skip(lines, pos, regex):\n  line = lines[pos.line][pos.column:]\n  m = re.search(regex, line)\n  if m and not m.start():\n    return pos + m.end()\n  else:\n    return pos\n\n\ndef SkipUntil(lines, pos, regex, token_type):\n  line = lines[pos.line][pos.column:]\n  m = re.search(regex, line)\n  if m:\n    return pos + m.start()\n  else:\n    print ('ERROR: %s expected on line %s after column %s.' %\n           (token_type, pos.line + 1, pos.column))\n    sys.exit(1)\n\n\ndef ParseExpTokenInParens(lines, pos):\n  def ParseInParens(pos):\n    pos = Skip(lines, pos, OPTIONAL_WHITE_SPACES_REGEX)\n    pos = Skip(lines, pos, r'\\(')\n    pos = Parse(pos)\n    pos = Skip(lines, pos, r'\\)')\n    return pos\n\n  def Parse(pos):\n    pos = SkipUntil(lines, pos, r'\\(|\\)', ')')\n    if SubString(lines, pos, pos + 1) == '(':\n      pos = Parse(pos + 1)\n      pos = Skip(lines, pos, r'\\)')\n      return Parse(pos)\n    else:\n      return pos\n\n  start = pos.Clone()\n  pos = ParseInParens(pos)\n  return MakeToken(lines, start, pos, 'exp')\n\n\ndef RStripNewLineFromToken(token):\n  if token.value.endswith('\\n'):\n    return Token(token.start, token.end, token.value[:-1], token.token_type)\n  else:\n    return token\n\n\ndef TokenizeLines(lines, pos):\n  while True:\n    found = FindFirst(lines, TOKEN_TABLE, pos)\n    if not found:\n      yield MakeToken(lines, pos, Eof(), 'code')\n      return\n\n    if found.start == pos:\n      prev_token = None\n      prev_token_rstripped = None\n    else:\n      prev_token = MakeToken(lines, pos, found.start, 'code')\n      prev_token_rstripped = RStripNewLineFromToken(prev_token)\n\n    if found.token_type == '$var':\n      if prev_token_rstripped:\n        yield prev_token_rstripped\n      yield found\n      id_token = ParseToken(lines, found.end, ID_REGEX, 'id')\n      yield id_token\n      pos = Skip(lines, id_token.end, OPTIONAL_WHITE_SPACES_REGEX)\n\n      eq_token = ParseToken(lines, pos, EQ_REGEX, '=')\n      yield eq_token\n      pos = Skip(lines, eq_token.end, r'\\s*')\n\n      if SubString(lines, pos, pos + 2) != '[[':\n        exp_token = ParseToken(lines, pos, REST_OF_LINE_REGEX, 'exp')\n        yield exp_token\n        pos = Cursor(exp_token.end.line + 1, 0)\n    elif found.token_type == '$for':\n      if prev_token_rstripped:\n        yield prev_token_rstripped\n      yield found\n      id_token = ParseToken(lines, found.end, ID_REGEX, 'id')\n      yield id_token\n      pos = Skip(lines, id_token.end, WHITE_SPACE_REGEX)\n    elif found.token_type == '$range':\n      if prev_token_rstripped:\n        yield prev_token_rstripped\n      yield found\n      id_token = ParseToken(lines, found.end, ID_REGEX, 'id')\n      yield id_token\n      pos = Skip(lines, id_token.end, OPTIONAL_WHITE_SPACES_REGEX)\n\n      dots_pos = SkipUntil(lines, pos, DOT_DOT_REGEX, '..')\n      yield MakeToken(lines, pos, dots_pos, 'exp')\n      yield MakeToken(lines, dots_pos, dots_pos + 2, '..')\n      pos = dots_pos + 2\n      new_pos = Cursor(pos.line + 1, 0)\n      yield MakeToken(lines, pos, new_pos, 'exp')\n      pos = new_pos\n    elif found.token_type == '$':\n      if prev_token:\n        yield prev_token\n      yield found\n      exp_token = ParseExpTokenInParens(lines, found.end)\n      yield exp_token\n      pos = exp_token.end\n    elif (found.token_type == ']]' or found.token_type == '$if' or\n          found.token_type == '$elif' or found.token_type == '$else'):\n      if prev_token_rstripped:\n        yield prev_token_rstripped\n      yield found\n      pos = found.end\n    else:\n      if prev_token:\n        yield prev_token\n      yield found\n      pos = found.end\n\n\ndef Tokenize(s):\n  \"\"\"A generator that yields the tokens in the given string.\"\"\"\n  if s != '':\n    lines = s.splitlines(True)\n    for token in TokenizeLines(lines, Cursor(0, 0)):\n      yield token\n\n\nclass CodeNode:\n  def __init__(self, atomic_code_list=None):\n    self.atomic_code = atomic_code_list\n\n\nclass VarNode:\n  def __init__(self, identifier=None, atomic_code=None):\n    self.identifier = identifier\n    self.atomic_code = atomic_code\n\n\nclass RangeNode:\n  def __init__(self, identifier=None, exp1=None, exp2=None):\n    self.identifier = identifier\n    self.exp1 = exp1\n    self.exp2 = exp2\n\n\nclass ForNode:\n  def __init__(self, identifier=None, sep=None, code=None):\n    self.identifier = identifier\n    self.sep = sep\n    self.code = code\n\n\nclass ElseNode:\n  def __init__(self, else_branch=None):\n    self.else_branch = else_branch\n\n\nclass IfNode:\n  def __init__(self, exp=None, then_branch=None, else_branch=None):\n    self.exp = exp\n    self.then_branch = then_branch\n    self.else_branch = else_branch\n\n\nclass RawCodeNode:\n  def __init__(self, token=None):\n    self.raw_code = token\n\n\nclass LiteralDollarNode:\n  def __init__(self, token):\n    self.token = token\n\n\nclass ExpNode:\n  def __init__(self, token, python_exp):\n    self.token = token\n    self.python_exp = python_exp\n\n\ndef PopFront(a_list):\n  head = a_list[0]\n  a_list[:1] = []\n  return head\n\n\ndef PushFront(a_list, elem):\n  a_list[:0] = [elem]\n\n\ndef PopToken(a_list, token_type=None):\n  token = PopFront(a_list)\n  if token_type is not None and token.token_type != token_type:\n    print 'ERROR: %s expected at %s' % (token_type, token.start)\n    print 'ERROR: %s found instead' % (token,)\n    sys.exit(1)\n\n  return token\n\n\ndef PeekToken(a_list):\n  if not a_list:\n    return None\n\n  return a_list[0]\n\n\ndef ParseExpNode(token):\n  python_exp = re.sub(r'([_A-Za-z]\\w*)', r'self.GetValue(\"\\1\")', token.value)\n  return ExpNode(token, python_exp)\n\n\ndef ParseElseNode(tokens):\n  def Pop(token_type=None):\n    return PopToken(tokens, token_type)\n\n  next = PeekToken(tokens)\n  if not next:\n    return None\n  if next.token_type == '$else':\n    Pop('$else')\n    Pop('[[')\n    code_node = ParseCodeNode(tokens)\n    Pop(']]')\n    return code_node\n  elif next.token_type == '$elif':\n    Pop('$elif')\n    exp = Pop('code')\n    Pop('[[')\n    code_node = ParseCodeNode(tokens)\n    Pop(']]')\n    inner_else_node = ParseElseNode(tokens)\n    return CodeNode([IfNode(ParseExpNode(exp), code_node, inner_else_node)])\n  elif not next.value.strip():\n    Pop('code')\n    return ParseElseNode(tokens)\n  else:\n    return None\n\n\ndef ParseAtomicCodeNode(tokens):\n  def Pop(token_type=None):\n    return PopToken(tokens, token_type)\n\n  head = PopFront(tokens)\n  t = head.token_type\n  if t == 'code':\n    return RawCodeNode(head)\n  elif t == '$var':\n    id_token = Pop('id')\n    Pop('=')\n    next = PeekToken(tokens)\n    if next.token_type == 'exp':\n      exp_token = Pop()\n      return VarNode(id_token, ParseExpNode(exp_token))\n    Pop('[[')\n    code_node = ParseCodeNode(tokens)\n    Pop(']]')\n    return VarNode(id_token, code_node)\n  elif t == '$for':\n    id_token = Pop('id')\n    next_token = PeekToken(tokens)\n    if next_token.token_type == 'code':\n      sep_token = next_token\n      Pop('code')\n    else:\n      sep_token = None\n    Pop('[[')\n    code_node = ParseCodeNode(tokens)\n    Pop(']]')\n    return ForNode(id_token, sep_token, code_node)\n  elif t == '$if':\n    exp_token = Pop('code')\n    Pop('[[')\n    code_node = ParseCodeNode(tokens)\n    Pop(']]')\n    else_node = ParseElseNode(tokens)\n    return IfNode(ParseExpNode(exp_token), code_node, else_node)\n  elif t == '$range':\n    id_token = Pop('id')\n    exp1_token = Pop('exp')\n    Pop('..')\n    exp2_token = Pop('exp')\n    return RangeNode(id_token, ParseExpNode(exp1_token),\n                     ParseExpNode(exp2_token))\n  elif t == '$id':\n    return ParseExpNode(Token(head.start + 1, head.end, head.value[1:], 'id'))\n  elif t == '$($)':\n    return LiteralDollarNode(head)\n  elif t == '$':\n    exp_token = Pop('exp')\n    return ParseExpNode(exp_token)\n  elif t == '[[':\n    code_node = ParseCodeNode(tokens)\n    Pop(']]')\n    return code_node\n  else:\n    PushFront(tokens, head)\n    return None\n\n\ndef ParseCodeNode(tokens):\n  atomic_code_list = []\n  while True:\n    if not tokens:\n      break\n    atomic_code_node = ParseAtomicCodeNode(tokens)\n    if atomic_code_node:\n      atomic_code_list.append(atomic_code_node)\n    else:\n      break\n  return CodeNode(atomic_code_list)\n\n\ndef ParseToAST(pump_src_text):\n  \"\"\"Convert the given Pump source text into an AST.\"\"\"\n  tokens = list(Tokenize(pump_src_text))\n  code_node = ParseCodeNode(tokens)\n  return code_node\n\n\nclass Env:\n  def __init__(self):\n    self.variables = []\n    self.ranges = []\n\n  def Clone(self):\n    clone = Env()\n    clone.variables = self.variables[:]\n    clone.ranges = self.ranges[:]\n    return clone\n\n  def PushVariable(self, var, value):\n    # If value looks like an int, store it as an int.\n    try:\n      int_value = int(value)\n      if ('%s' % int_value) == value:\n        value = int_value\n    except Exception:\n      pass\n    self.variables[:0] = [(var, value)]\n\n  def PopVariable(self):\n    self.variables[:1] = []\n\n  def PushRange(self, var, lower, upper):\n    self.ranges[:0] = [(var, lower, upper)]\n\n  def PopRange(self):\n    self.ranges[:1] = []\n\n  def GetValue(self, identifier):\n    for (var, value) in self.variables:\n      if identifier == var:\n        return value\n\n    print 'ERROR: meta variable %s is undefined.' % (identifier,)\n    sys.exit(1)\n\n  def EvalExp(self, exp):\n    try:\n      result = eval(exp.python_exp)\n    except Exception, e:\n      print 'ERROR: caught exception %s: %s' % (e.__class__.__name__, e)\n      print ('ERROR: failed to evaluate meta expression %s at %s' %\n             (exp.python_exp, exp.token.start))\n      sys.exit(1)\n    return result\n\n  def GetRange(self, identifier):\n    for (var, lower, upper) in self.ranges:\n      if identifier == var:\n        return (lower, upper)\n\n    print 'ERROR: range %s is undefined.' % (identifier,)\n    sys.exit(1)\n\n\nclass Output:\n  def __init__(self):\n    self.string = ''\n\n  def GetLastLine(self):\n    index = self.string.rfind('\\n')\n    if index < 0:\n      return ''\n\n    return self.string[index + 1:]\n\n  def Append(self, s):\n    self.string += s\n\n\ndef RunAtomicCode(env, node, output):\n  if isinstance(node, VarNode):\n    identifier = node.identifier.value.strip()\n    result = Output()\n    RunAtomicCode(env.Clone(), node.atomic_code, result)\n    value = result.string\n    env.PushVariable(identifier, value)\n  elif isinstance(node, RangeNode):\n    identifier = node.identifier.value.strip()\n    lower = int(env.EvalExp(node.exp1))\n    upper = int(env.EvalExp(node.exp2))\n    env.PushRange(identifier, lower, upper)\n  elif isinstance(node, ForNode):\n    identifier = node.identifier.value.strip()\n    if node.sep is None:\n      sep = ''\n    else:\n      sep = node.sep.value\n    (lower, upper) = env.GetRange(identifier)\n    for i in range(lower, upper + 1):\n      new_env = env.Clone()\n      new_env.PushVariable(identifier, i)\n      RunCode(new_env, node.code, output)\n      if i != upper:\n        output.Append(sep)\n  elif isinstance(node, RawCodeNode):\n    output.Append(node.raw_code.value)\n  elif isinstance(node, IfNode):\n    cond = env.EvalExp(node.exp)\n    if cond:\n      RunCode(env.Clone(), node.then_branch, output)\n    elif node.else_branch is not None:\n      RunCode(env.Clone(), node.else_branch, output)\n  elif isinstance(node, ExpNode):\n    value = env.EvalExp(node)\n    output.Append('%s' % (value,))\n  elif isinstance(node, LiteralDollarNode):\n    output.Append('$')\n  elif isinstance(node, CodeNode):\n    RunCode(env.Clone(), node, output)\n  else:\n    print 'BAD'\n    print node\n    sys.exit(1)\n\n\ndef RunCode(env, code_node, output):\n  for atomic_code in code_node.atomic_code:\n    RunAtomicCode(env, atomic_code, output)\n\n\ndef IsSingleLineComment(cur_line):\n  return '//' in cur_line\n\n\ndef IsInPreprocessorDirective(prev_lines, cur_line):\n  if cur_line.lstrip().startswith('#'):\n    return True\n  return prev_lines and prev_lines[-1].endswith('\\\\')\n\n\ndef WrapComment(line, output):\n  loc = line.find('//')\n  before_comment = line[:loc].rstrip()\n  if before_comment == '':\n    indent = loc\n  else:\n    output.append(before_comment)\n    indent = len(before_comment) - len(before_comment.lstrip())\n  prefix = indent*' ' + '// '\n  max_len = 80 - len(prefix)\n  comment = line[loc + 2:].strip()\n  segs = [seg for seg in re.split(r'(\\w+\\W*)', comment) if seg != '']\n  cur_line = ''\n  for seg in segs:\n    if len((cur_line + seg).rstrip()) < max_len:\n      cur_line += seg\n    else:\n      if cur_line.strip() != '':\n        output.append(prefix + cur_line.rstrip())\n      cur_line = seg.lstrip()\n  if cur_line.strip() != '':\n    output.append(prefix + cur_line.strip())\n\n\ndef WrapCode(line, line_concat, output):\n  indent = len(line) - len(line.lstrip())\n  prefix = indent*' '  # Prefix of the current line\n  max_len = 80 - indent - len(line_concat)  # Maximum length of the current line\n  new_prefix = prefix + 4*' '  # Prefix of a continuation line\n  new_max_len = max_len - 4  # Maximum length of a continuation line\n  # Prefers to wrap a line after a ',' or ';'.\n  segs = [seg for seg in re.split(r'([^,;]+[,;]?)', line.strip()) if seg != '']\n  cur_line = ''  # The current line without leading spaces.\n  for seg in segs:\n    # If the line is still too long, wrap at a space.\n    while cur_line == '' and len(seg.strip()) > max_len:\n      seg = seg.lstrip()\n      split_at = seg.rfind(' ', 0, max_len)\n      output.append(prefix + seg[:split_at].strip() + line_concat)\n      seg = seg[split_at + 1:]\n      prefix = new_prefix\n      max_len = new_max_len\n\n    if len((cur_line + seg).rstrip()) < max_len:\n      cur_line = (cur_line + seg).lstrip()\n    else:\n      output.append(prefix + cur_line.rstrip() + line_concat)\n      prefix = new_prefix\n      max_len = new_max_len\n      cur_line = seg.lstrip()\n  if cur_line.strip() != '':\n    output.append(prefix + cur_line.strip())\n\n\ndef WrapPreprocessorDirective(line, output):\n  WrapCode(line, ' \\\\', output)\n\n\ndef WrapPlainCode(line, output):\n  WrapCode(line, '', output)\n\n\ndef IsMultiLineIWYUPragma(line):\n  return re.search(r'/\\* IWYU pragma: ', line)\n\n\ndef IsHeaderGuardIncludeOrOneLineIWYUPragma(line):\n  return (re.match(r'^#(ifndef|define|endif\\s*//)\\s*[\\w_]+\\s*$', line) or\n          re.match(r'^#include\\s', line) or\n          # Don't break IWYU pragmas, either; that causes iwyu.py problems.\n          re.search(r'// IWYU pragma: ', line))\n\n\ndef WrapLongLine(line, output):\n  line = line.rstrip()\n  if len(line) <= 80:\n    output.append(line)\n  elif IsSingleLineComment(line):\n    if IsHeaderGuardIncludeOrOneLineIWYUPragma(line):\n      # The style guide made an exception to allow long header guard lines,\n      # includes and IWYU pragmas.\n      output.append(line)\n    else:\n      WrapComment(line, output)\n  elif IsInPreprocessorDirective(output, line):\n    if IsHeaderGuardIncludeOrOneLineIWYUPragma(line):\n      # The style guide made an exception to allow long header guard lines,\n      # includes and IWYU pragmas.\n      output.append(line)\n    else:\n      WrapPreprocessorDirective(line, output)\n  elif IsMultiLineIWYUPragma(line):\n    output.append(line)\n  else:\n    WrapPlainCode(line, output)\n\n\ndef BeautifyCode(string):\n  lines = string.splitlines()\n  output = []\n  for line in lines:\n    WrapLongLine(line, output)\n  output2 = [line.rstrip() for line in output]\n  return '\\n'.join(output2) + '\\n'\n\n\ndef ConvertFromPumpSource(src_text):\n  \"\"\"Return the text generated from the given Pump source text.\"\"\"\n  ast = ParseToAST(StripMetaComments(src_text))\n  output = Output()\n  RunCode(Env(), ast, output)\n  return BeautifyCode(output.string)\n\n\ndef main(argv):\n  if len(argv) == 1:\n    print __doc__\n    sys.exit(1)\n\n  file_path = argv[-1]\n  output_str = ConvertFromPumpSource(file(file_path, 'r').read())\n  if file_path.endswith('.pump'):\n    output_file_path = file_path[:-5]\n  else:\n    output_file_path = '-'\n  if output_file_path == '-':\n    print output_str,\n  else:\n    output_file = file(output_file_path, 'w')\n    output_file.write('// This file was GENERATED by command:\\n')\n    output_file.write('//     %s %s\\n' %\n                      (os.path.basename(__file__), os.path.basename(file_path)))\n    output_file.write('// DO NOT EDIT BY HAND!!!\\n\\n')\n    output_file.write(output_str)\n    output_file.close()\n\n\nif __name__ == '__main__':\n  main(sys.argv)\n"
  },
  {
    "path": "Tests/gtest/scripts/test/Makefile",
    "content": "# A Makefile for fusing Google Test and building a sample test against it.\n#\n# SYNOPSIS:\n#\n#   make [all]  - makes everything.\n#   make TARGET - makes the given target.\n#   make check  - makes everything and runs the built sample test.\n#   make clean  - removes all files generated by make.\n\n# Points to the root of fused Google Test, relative to where this file is.\nFUSED_GTEST_DIR = output\n\n# Paths to the fused gtest files.\nFUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h\nFUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc\n\n# Where to find the sample test.\nSAMPLE_DIR = ../../samples\n\n# Where to find gtest_main.cc.\nGTEST_MAIN_CC = ../../src/gtest_main.cc\n\n# Flags passed to the preprocessor.\n# We have no idea here whether pthreads is available in the system, so\n# disable its use.\nCPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0\n\n# Flags passed to the C++ compiler.\nCXXFLAGS += -g\n\nall : sample1_unittest\n\ncheck : all\n\t./sample1_unittest\n\nclean :\n\trm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o\n\n$(FUSED_GTEST_H) :\n\t../fuse_gtest_files.py $(FUSED_GTEST_DIR)\n\n$(FUSED_GTEST_ALL_CC) :\n\t../fuse_gtest_files.py $(FUSED_GTEST_DIR)\n\ngtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC)\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc\n\ngtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC)\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC)\n\nsample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc\n\nsample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \\\n                     $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H)\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc\n\nsample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o\n\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@\n"
  },
  {
    "path": "Tests/gtest/src/gtest-all.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n// Google C++ Testing Framework (Google Test)\n//\n// Sometimes it's desirable to build Google Test by compiling a single file.\n// This file serves this purpose.\n\n// This line ensures that gtest.h can be compiled on its own, even\n// when it's fused.\n#include \"gtest/gtest.h\"\n\n// The following lines pull in the real gtest *.cc files.\n#include \"src/gtest.cc\"\n#include \"src/gtest-death-test.cc\"\n#include \"src/gtest-filepath.cc\"\n#include \"src/gtest-port.cc\"\n#include \"src/gtest-printers.cc\"\n#include \"src/gtest-test-part.cc\"\n#include \"src/gtest-typed-test.cc\"\n"
  },
  {
    "path": "Tests/gtest/src/gtest-death-test.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)\n//\n// This file implements death tests.\n\n#include \"gtest/gtest-death-test.h\"\n#include \"gtest/internal/gtest-port.h\"\n\n#if GTEST_HAS_DEATH_TEST\n\n# if GTEST_OS_MAC\n#  include <crt_externs.h>\n# endif  // GTEST_OS_MAC\n\n# include <errno.h>\n# include <fcntl.h>\n# include <limits.h>\n\n# if GTEST_OS_LINUX\n#  include <signal.h>\n# endif  // GTEST_OS_LINUX\n\n# include <stdarg.h>\n\n# if GTEST_OS_WINDOWS\n#  include <windows.h>\n# else\n#  include <sys/mman.h>\n#  include <sys/wait.h>\n# endif  // GTEST_OS_WINDOWS\n\n# if GTEST_OS_QNX\n#  include <spawn.h>\n# endif  // GTEST_OS_QNX\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n#include \"gtest/gtest-message.h\"\n#include \"gtest/internal/gtest-string.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\n\n// Constants.\n\n// The default death test style.\nstatic const char kDefaultDeathTestStyle[] = \"fast\";\n\nGTEST_DEFINE_string_(\n    death_test_style,\n    internal::StringFromGTestEnv(\"death_test_style\", kDefaultDeathTestStyle),\n    \"Indicates how to run a death test in a forked child process: \"\n    \"\\\"threadsafe\\\" (child process re-executes the test binary \"\n    \"from the beginning, running only the specific death test) or \"\n    \"\\\"fast\\\" (child process runs the death test immediately \"\n    \"after forking).\");\n\nGTEST_DEFINE_bool_(\n    death_test_use_fork,\n    internal::BoolFromGTestEnv(\"death_test_use_fork\", false),\n    \"Instructs to use fork()/_exit() instead of clone() in death tests. \"\n    \"Ignored and always uses fork() on POSIX systems where clone() is not \"\n    \"implemented. Useful when running under valgrind or similar tools if \"\n    \"those do not support clone(). Valgrind 3.3.1 will just fail if \"\n    \"it sees an unsupported combination of clone() flags. \"\n    \"It is not recommended to use this flag w/o valgrind though it will \"\n    \"work in 99% of the cases. Once valgrind is fixed, this flag will \"\n    \"most likely be removed.\");\n\nnamespace internal {\nGTEST_DEFINE_string_(\n    internal_run_death_test, \"\",\n    \"Indicates the file, line number, temporal index of \"\n    \"the single death test to run, and a file descriptor to \"\n    \"which a success code may be sent, all separated by \"\n    \"the '|' characters.  This flag is specified if and only if the current \"\n    \"process is a sub-process launched for running a thread-safe \"\n    \"death test.  FOR INTERNAL USE ONLY.\");\n}  // namespace internal\n\n#if GTEST_HAS_DEATH_TEST\n\nnamespace internal {\n\n// Valid only for fast death tests. Indicates the code is running in the\n// child process of a fast style death test.\nstatic bool g_in_fast_death_test_child = false;\n\n// Returns a Boolean value indicating whether the caller is currently\n// executing in the context of the death test child process.  Tools such as\n// Valgrind heap checkers may need this to modify their behavior in death\n// tests.  IMPORTANT: This is an internal utility.  Using it may break the\n// implementation of death tests.  User code MUST NOT use it.\nbool InDeathTestChild() {\n# if GTEST_OS_WINDOWS\n\n  // On Windows, death tests are thread-safe regardless of the value of the\n  // death_test_style flag.\n  return !GTEST_FLAG(internal_run_death_test).empty();\n\n# else\n\n  if (GTEST_FLAG(death_test_style) == \"threadsafe\")\n    return !GTEST_FLAG(internal_run_death_test).empty();\n  else\n    return g_in_fast_death_test_child;\n#endif\n}\n\n}  // namespace internal\n\n// ExitedWithCode constructor.\nExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {\n}\n\n// ExitedWithCode function-call operator.\nbool ExitedWithCode::operator()(int exit_status) const {\n# if GTEST_OS_WINDOWS\n\n  return exit_status == exit_code_;\n\n# else\n\n  return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;\n\n# endif  // GTEST_OS_WINDOWS\n}\n\n# if !GTEST_OS_WINDOWS\n// KilledBySignal constructor.\nKilledBySignal::KilledBySignal(int signum) : signum_(signum) {\n}\n\n// KilledBySignal function-call operator.\nbool KilledBySignal::operator()(int exit_status) const {\n  return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;\n}\n# endif  // !GTEST_OS_WINDOWS\n\nnamespace internal {\n\n// Utilities needed for death tests.\n\n// Generates a textual description of a given exit code, in the format\n// specified by wait(2).\nstatic std::string ExitSummary(int exit_code) {\n  Message m;\n\n# if GTEST_OS_WINDOWS\n\n  m << \"Exited with exit status \" << exit_code;\n\n# else\n\n  if (WIFEXITED(exit_code)) {\n    m << \"Exited with exit status \" << WEXITSTATUS(exit_code);\n  } else if (WIFSIGNALED(exit_code)) {\n    m << \"Terminated by signal \" << WTERMSIG(exit_code);\n  }\n#  ifdef WCOREDUMP\n  if (WCOREDUMP(exit_code)) {\n    m << \" (core dumped)\";\n  }\n#  endif\n# endif  // GTEST_OS_WINDOWS\n\n  return m.GetString();\n}\n\n// Returns true if exit_status describes a process that was terminated\n// by a signal, or exited normally with a nonzero exit code.\nbool ExitedUnsuccessfully(int exit_status) {\n  return !ExitedWithCode(0)(exit_status);\n}\n\n# if !GTEST_OS_WINDOWS\n// Generates a textual failure message when a death test finds more than\n// one thread running, or cannot determine the number of threads, prior\n// to executing the given statement.  It is the responsibility of the\n// caller not to pass a thread_count of 1.\nstatic std::string DeathTestThreadWarning(size_t thread_count) {\n  Message msg;\n  msg << \"Death tests use fork(), which is unsafe particularly\"\n      << \" in a threaded context. For this test, \" << GTEST_NAME_ << \" \";\n  if (thread_count == 0)\n    msg << \"couldn't detect the number of threads.\";\n  else\n    msg << \"detected \" << thread_count << \" threads.\";\n  return msg.GetString();\n}\n# endif  // !GTEST_OS_WINDOWS\n\n// Flag characters for reporting a death test that did not die.\nstatic const char kDeathTestLived = 'L';\nstatic const char kDeathTestReturned = 'R';\nstatic const char kDeathTestThrew = 'T';\nstatic const char kDeathTestInternalError = 'I';\n\n// An enumeration describing all of the possible ways that a death test can\n// conclude.  DIED means that the process died while executing the test\n// code; LIVED means that process lived beyond the end of the test code;\n// RETURNED means that the test statement attempted to execute a return\n// statement, which is not allowed; THREW means that the test statement\n// returned control by throwing an exception.  IN_PROGRESS means the test\n// has not yet concluded.\n// TODO(vladl@google.com): Unify names and possibly values for\n// AbortReason, DeathTestOutcome, and flag characters above.\nenum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };\n\n// Routine for aborting the program which is safe to call from an\n// exec-style death test child process, in which case the error\n// message is propagated back to the parent process.  Otherwise, the\n// message is simply printed to stderr.  In either case, the program\n// then exits with status 1.\nvoid DeathTestAbort(const std::string& message) {\n  // On a POSIX system, this function may be called from a threadsafe-style\n  // death test child process, which operates on a very small stack.  Use\n  // the heap for any additional non-minuscule memory requirements.\n  const InternalRunDeathTestFlag* const flag =\n      GetUnitTestImpl()->internal_run_death_test_flag();\n  if (flag != NULL) {\n    FILE* parent = posix::FDOpen(flag->write_fd(), \"w\");\n    fputc(kDeathTestInternalError, parent);\n    fprintf(parent, \"%s\", message.c_str());\n    fflush(parent);\n    _exit(1);\n  } else {\n    fprintf(stderr, \"%s\", message.c_str());\n    fflush(stderr);\n    posix::Abort();\n  }\n}\n\n// A replacement for CHECK that calls DeathTestAbort if the assertion\n// fails.\n# define GTEST_DEATH_TEST_CHECK_(expression) \\\n  do { \\\n    if (!::testing::internal::IsTrue(expression)) { \\\n      DeathTestAbort( \\\n          ::std::string(\"CHECK failed: File \") + __FILE__ +  \", line \" \\\n          + ::testing::internal::StreamableToString(__LINE__) + \": \" \\\n          + #expression); \\\n    } \\\n  } while (::testing::internal::AlwaysFalse())\n\n// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for\n// evaluating any system call that fulfills two conditions: it must return\n// -1 on failure, and set errno to EINTR when it is interrupted and\n// should be tried again.  The macro expands to a loop that repeatedly\n// evaluates the expression as long as it evaluates to -1 and sets\n// errno to EINTR.  If the expression evaluates to -1 but errno is\n// something other than EINTR, DeathTestAbort is called.\n# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \\\n  do { \\\n    int gtest_retval; \\\n    do { \\\n      gtest_retval = (expression); \\\n    } while (gtest_retval == -1 && errno == EINTR); \\\n    if (gtest_retval == -1) { \\\n      DeathTestAbort( \\\n          ::std::string(\"CHECK failed: File \") + __FILE__ + \", line \" \\\n          + ::testing::internal::StreamableToString(__LINE__) + \": \" \\\n          + #expression + \" != -1\"); \\\n    } \\\n  } while (::testing::internal::AlwaysFalse())\n\n// Returns the message describing the last system error in errno.\nstd::string GetLastErrnoDescription() {\n    return errno == 0 ? \"\" : posix::StrError(errno);\n}\n\n// This is called from a death test parent process to read a failure\n// message from the death test child process and log it with the FATAL\n// severity. On Windows, the message is read from a pipe handle. On other\n// platforms, it is read from a file descriptor.\nstatic void FailFromInternalError(int fd) {\n  Message error;\n  char buffer[256];\n  int num_read;\n\n  do {\n    while ((num_read = posix::Read(fd, buffer, 255)) > 0) {\n      buffer[num_read] = '\\0';\n      error << buffer;\n    }\n  } while (num_read == -1 && errno == EINTR);\n\n  if (num_read == 0) {\n    GTEST_LOG_(FATAL) << error.GetString();\n  } else {\n    const int last_error = errno;\n    GTEST_LOG_(FATAL) << \"Error while reading death test internal: \"\n                      << GetLastErrnoDescription() << \" [\" << last_error << \"]\";\n  }\n}\n\n// Death test constructor.  Increments the running death test count\n// for the current test.\nDeathTest::DeathTest() {\n  TestInfo* const info = GetUnitTestImpl()->current_test_info();\n  if (info == NULL) {\n    DeathTestAbort(\"Cannot run a death test outside of a TEST or \"\n                   \"TEST_F construct\");\n  }\n}\n\n// Creates and returns a death test by dispatching to the current\n// death test factory.\nbool DeathTest::Create(const char* statement, const RE* regex,\n                       const char* file, int line, DeathTest** test) {\n  return GetUnitTestImpl()->death_test_factory()->Create(\n      statement, regex, file, line, test);\n}\n\nconst char* DeathTest::LastMessage() {\n  return last_death_test_message_.c_str();\n}\n\nvoid DeathTest::set_last_death_test_message(const std::string& message) {\n  last_death_test_message_ = message;\n}\n\nstd::string DeathTest::last_death_test_message_;\n\n// Provides cross platform implementation for some death functionality.\nclass DeathTestImpl : public DeathTest {\n protected:\n  DeathTestImpl(const char* a_statement, const RE* a_regex)\n      : statement_(a_statement),\n        regex_(a_regex),\n        spawned_(false),\n        status_(-1),\n        outcome_(IN_PROGRESS),\n        read_fd_(-1),\n        write_fd_(-1) {}\n\n  // read_fd_ is expected to be closed and cleared by a derived class.\n  ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }\n\n  void Abort(AbortReason reason);\n  virtual bool Passed(bool status_ok);\n\n  const char* statement() const { return statement_; }\n  const RE* regex() const { return regex_; }\n  bool spawned() const { return spawned_; }\n  void set_spawned(bool is_spawned) { spawned_ = is_spawned; }\n  int status() const { return status_; }\n  void set_status(int a_status) { status_ = a_status; }\n  DeathTestOutcome outcome() const { return outcome_; }\n  void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }\n  int read_fd() const { return read_fd_; }\n  void set_read_fd(int fd) { read_fd_ = fd; }\n  int write_fd() const { return write_fd_; }\n  void set_write_fd(int fd) { write_fd_ = fd; }\n\n  // Called in the parent process only. Reads the result code of the death\n  // test child process via a pipe, interprets it to set the outcome_\n  // member, and closes read_fd_.  Outputs diagnostics and terminates in\n  // case of unexpected codes.\n  void ReadAndInterpretStatusByte();\n\n private:\n  // The textual content of the code this object is testing.  This class\n  // doesn't own this string and should not attempt to delete it.\n  const char* const statement_;\n  // The regular expression which test output must match.  DeathTestImpl\n  // doesn't own this object and should not attempt to delete it.\n  const RE* const regex_;\n  // True if the death test child process has been successfully spawned.\n  bool spawned_;\n  // The exit status of the child process.\n  int status_;\n  // How the death test concluded.\n  DeathTestOutcome outcome_;\n  // Descriptor to the read end of the pipe to the child process.  It is\n  // always -1 in the child process.  The child keeps its write end of the\n  // pipe in write_fd_.\n  int read_fd_;\n  // Descriptor to the child's write end of the pipe to the parent process.\n  // It is always -1 in the parent process.  The parent keeps its end of the\n  // pipe in read_fd_.\n  int write_fd_;\n};\n\n// Called in the parent process only. Reads the result code of the death\n// test child process via a pipe, interprets it to set the outcome_\n// member, and closes read_fd_.  Outputs diagnostics and terminates in\n// case of unexpected codes.\nvoid DeathTestImpl::ReadAndInterpretStatusByte() {\n  char flag;\n  int bytes_read;\n\n  // The read() here blocks until data is available (signifying the\n  // failure of the death test) or until the pipe is closed (signifying\n  // its success), so it's okay to call this in the parent before\n  // the child process has exited.\n  do {\n    bytes_read = posix::Read(read_fd(), &flag, 1);\n  } while (bytes_read == -1 && errno == EINTR);\n\n  if (bytes_read == 0) {\n    set_outcome(DIED);\n  } else if (bytes_read == 1) {\n    switch (flag) {\n      case kDeathTestReturned:\n        set_outcome(RETURNED);\n        break;\n      case kDeathTestThrew:\n        set_outcome(THREW);\n        break;\n      case kDeathTestLived:\n        set_outcome(LIVED);\n        break;\n      case kDeathTestInternalError:\n        FailFromInternalError(read_fd());  // Does not return.\n        break;\n      default:\n        GTEST_LOG_(FATAL) << \"Death test child process reported \"\n                          << \"unexpected status byte (\"\n                          << static_cast<unsigned int>(flag) << \")\";\n    }\n  } else {\n    GTEST_LOG_(FATAL) << \"Read from death test child process failed: \"\n                      << GetLastErrnoDescription();\n  }\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));\n  set_read_fd(-1);\n}\n\n// Signals that the death test code which should have exited, didn't.\n// Should be called only in a death test child process.\n// Writes a status byte to the child's status file descriptor, then\n// calls _exit(1).\nvoid DeathTestImpl::Abort(AbortReason reason) {\n  // The parent process considers the death test to be a failure if\n  // it finds any data in our pipe.  So, here we write a single flag byte\n  // to the pipe, then exit.\n  const char status_ch =\n      reason == TEST_DID_NOT_DIE ? kDeathTestLived :\n      reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned;\n\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));\n  // We are leaking the descriptor here because on some platforms (i.e.,\n  // when built as Windows DLL), destructors of global objects will still\n  // run after calling _exit(). On such systems, write_fd_ will be\n  // indirectly closed from the destructor of UnitTestImpl, causing double\n  // close if it is also closed here. On debug configurations, double close\n  // may assert. As there are no in-process buffers to flush here, we are\n  // relying on the OS to close the descriptor after the process terminates\n  // when the destructors are not run.\n  _exit(1);  // Exits w/o any normal exit hooks (we were supposed to crash)\n}\n\n// Returns an indented copy of stderr output for a death test.\n// This makes distinguishing death test output lines from regular log lines\n// much easier.\nstatic ::std::string FormatDeathTestOutput(const ::std::string& output) {\n  ::std::string ret;\n  for (size_t at = 0; ; ) {\n    const size_t line_end = output.find('\\n', at);\n    ret += \"[  DEATH   ] \";\n    if (line_end == ::std::string::npos) {\n      ret += output.substr(at);\n      break;\n    }\n    ret += output.substr(at, line_end + 1 - at);\n    at = line_end + 1;\n  }\n  return ret;\n}\n\n// Assesses the success or failure of a death test, using both private\n// members which have previously been set, and one argument:\n//\n// Private data members:\n//   outcome:  An enumeration describing how the death test\n//             concluded: DIED, LIVED, THREW, or RETURNED.  The death test\n//             fails in the latter three cases.\n//   status:   The exit status of the child process. On *nix, it is in the\n//             in the format specified by wait(2). On Windows, this is the\n//             value supplied to the ExitProcess() API or a numeric code\n//             of the exception that terminated the program.\n//   regex:    A regular expression object to be applied to\n//             the test's captured standard error output; the death test\n//             fails if it does not match.\n//\n// Argument:\n//   status_ok: true if exit_status is acceptable in the context of\n//              this particular death test, which fails if it is false\n//\n// Returns true iff all of the above conditions are met.  Otherwise, the\n// first failing condition, in the order given above, is the one that is\n// reported. Also sets the last death test message string.\nbool DeathTestImpl::Passed(bool status_ok) {\n  if (!spawned())\n    return false;\n\n  const std::string error_message = GetCapturedStderr();\n\n  bool success = false;\n  Message buffer;\n\n  buffer << \"Death test: \" << statement() << \"\\n\";\n  switch (outcome()) {\n    case LIVED:\n      buffer << \"    Result: failed to die.\\n\"\n             << \" Error msg:\\n\" << FormatDeathTestOutput(error_message);\n      break;\n    case THREW:\n      buffer << \"    Result: threw an exception.\\n\"\n             << \" Error msg:\\n\" << FormatDeathTestOutput(error_message);\n      break;\n    case RETURNED:\n      buffer << \"    Result: illegal return in test statement.\\n\"\n             << \" Error msg:\\n\" << FormatDeathTestOutput(error_message);\n      break;\n    case DIED:\n      if (status_ok) {\n        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());\n        if (matched) {\n          success = true;\n        } else {\n          buffer << \"    Result: died but not with expected error.\\n\"\n                 << \"  Expected: \" << regex()->pattern() << \"\\n\"\n                 << \"Actual msg:\\n\" << FormatDeathTestOutput(error_message);\n        }\n      } else {\n        buffer << \"    Result: died but not with expected exit code:\\n\"\n               << \"            \" << ExitSummary(status()) << \"\\n\"\n               << \"Actual msg:\\n\" << FormatDeathTestOutput(error_message);\n      }\n      break;\n    case IN_PROGRESS:\n    default:\n      GTEST_LOG_(FATAL)\n          << \"DeathTest::Passed somehow called before conclusion of test\";\n  }\n\n  DeathTest::set_last_death_test_message(buffer.GetString());\n  return success;\n}\n\n# if GTEST_OS_WINDOWS\n// WindowsDeathTest implements death tests on Windows. Due to the\n// specifics of starting new processes on Windows, death tests there are\n// always threadsafe, and Google Test considers the\n// --gtest_death_test_style=fast setting to be equivalent to\n// --gtest_death_test_style=threadsafe there.\n//\n// A few implementation notes:  Like the Linux version, the Windows\n// implementation uses pipes for child-to-parent communication. But due to\n// the specifics of pipes on Windows, some extra steps are required:\n//\n// 1. The parent creates a communication pipe and stores handles to both\n//    ends of it.\n// 2. The parent starts the child and provides it with the information\n//    necessary to acquire the handle to the write end of the pipe.\n// 3. The child acquires the write end of the pipe and signals the parent\n//    using a Windows event.\n// 4. Now the parent can release the write end of the pipe on its side. If\n//    this is done before step 3, the object's reference count goes down to\n//    0 and it is destroyed, preventing the child from acquiring it. The\n//    parent now has to release it, or read operations on the read end of\n//    the pipe will not return when the child terminates.\n// 5. The parent reads child's output through the pipe (outcome code and\n//    any possible error messages) from the pipe, and its stderr and then\n//    determines whether to fail the test.\n//\n// Note: to distinguish Win32 API calls from the local method and function\n// calls, the former are explicitly resolved in the global namespace.\n//\nclass WindowsDeathTest : public DeathTestImpl {\n public:\n  WindowsDeathTest(const char* a_statement,\n                   const RE* a_regex,\n                   const char* file,\n                   int line)\n      : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {}\n\n  // All of these virtual functions are inherited from DeathTest.\n  virtual int Wait();\n  virtual TestRole AssumeRole();\n\n private:\n  // The name of the file in which the death test is located.\n  const char* const file_;\n  // The line number on which the death test is located.\n  const int line_;\n  // Handle to the write end of the pipe to the child process.\n  AutoHandle write_handle_;\n  // Child process handle.\n  AutoHandle child_handle_;\n  // Event the child process uses to signal the parent that it has\n  // acquired the handle to the write end of the pipe. After seeing this\n  // event the parent can release its own handles to make sure its\n  // ReadFile() calls return when the child terminates.\n  AutoHandle event_handle_;\n};\n\n// Waits for the child in a death test to exit, returning its exit\n// status, or 0 if no child process exists.  As a side effect, sets the\n// outcome data member.\nint WindowsDeathTest::Wait() {\n  if (!spawned())\n    return 0;\n\n  // Wait until the child either signals that it has acquired the write end\n  // of the pipe or it dies.\n  const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };\n  switch (::WaitForMultipleObjects(2,\n                                   wait_handles,\n                                   FALSE,  // Waits for any of the handles.\n                                   INFINITE)) {\n    case WAIT_OBJECT_0:\n    case WAIT_OBJECT_0 + 1:\n      break;\n    default:\n      GTEST_DEATH_TEST_CHECK_(false);  // Should not get here.\n  }\n\n  // The child has acquired the write end of the pipe or exited.\n  // We release the handle on our side and continue.\n  write_handle_.Reset();\n  event_handle_.Reset();\n\n  ReadAndInterpretStatusByte();\n\n  // Waits for the child process to exit if it haven't already. This\n  // returns immediately if the child has already exited, regardless of\n  // whether previous calls to WaitForMultipleObjects synchronized on this\n  // handle or not.\n  GTEST_DEATH_TEST_CHECK_(\n      WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),\n                                             INFINITE));\n  DWORD status_code;\n  GTEST_DEATH_TEST_CHECK_(\n      ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);\n  child_handle_.Reset();\n  set_status(static_cast<int>(status_code));\n  return status();\n}\n\n// The AssumeRole process for a Windows death test.  It creates a child\n// process with the same executable as the current process to run the\n// death test.  The child process is given the --gtest_filter and\n// --gtest_internal_run_death_test flags such that it knows to run the\n// current death test only.\nDeathTest::TestRole WindowsDeathTest::AssumeRole() {\n  const UnitTestImpl* const impl = GetUnitTestImpl();\n  const InternalRunDeathTestFlag* const flag =\n      impl->internal_run_death_test_flag();\n  const TestInfo* const info = impl->current_test_info();\n  const int death_test_index = info->result()->death_test_count();\n\n  if (flag != NULL) {\n    // ParseInternalRunDeathTestFlag() has performed all the necessary\n    // processing.\n    set_write_fd(flag->write_fd());\n    return EXECUTE_TEST;\n  }\n\n  // WindowsDeathTest uses an anonymous pipe to communicate results of\n  // a death test.\n  SECURITY_ATTRIBUTES handles_are_inheritable = {\n    sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };\n  HANDLE read_handle, write_handle;\n  GTEST_DEATH_TEST_CHECK_(\n      ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,\n                   0)  // Default buffer size.\n      != FALSE);\n  set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),\n                                O_RDONLY));\n  write_handle_.Reset(write_handle);\n  event_handle_.Reset(::CreateEvent(\n      &handles_are_inheritable,\n      TRUE,    // The event will automatically reset to non-signaled state.\n      FALSE,   // The initial state is non-signalled.\n      NULL));  // The even is unnamed.\n  GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);\n  const std::string filter_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kFilterFlag + \"=\" +\n      info->test_case_name() + \".\" + info->name();\n  const std::string internal_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +\n      \"=\" + file_ + \"|\" + StreamableToString(line_) + \"|\" +\n      StreamableToString(death_test_index) + \"|\" +\n      StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +\n      // size_t has the same width as pointers on both 32-bit and 64-bit\n      // Windows platforms.\n      // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.\n      \"|\" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +\n      \"|\" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));\n\n  char executable_path[_MAX_PATH + 1];  // NOLINT\n  GTEST_DEATH_TEST_CHECK_(\n      _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,\n                                            executable_path,\n                                            _MAX_PATH));\n\n  std::string command_line =\n      std::string(::GetCommandLineA()) + \" \" + filter_flag + \" \\\"\" +\n      internal_flag + \"\\\"\";\n\n  DeathTest::set_last_death_test_message(\"\");\n\n  CaptureStderr();\n  // Flush the log buffers since the log streams are shared with the child.\n  FlushInfoLog();\n\n  // The child process will share the standard handles with the parent.\n  STARTUPINFOA startup_info;\n  memset(&startup_info, 0, sizeof(STARTUPINFO));\n  startup_info.dwFlags = STARTF_USESTDHANDLES;\n  startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);\n  startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);\n  startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);\n\n  PROCESS_INFORMATION process_info;\n  GTEST_DEATH_TEST_CHECK_(::CreateProcessA(\n      executable_path,\n      const_cast<char*>(command_line.c_str()),\n      NULL,   // Retuned process handle is not inheritable.\n      NULL,   // Retuned thread handle is not inheritable.\n      TRUE,   // Child inherits all inheritable handles (for write_handle_).\n      0x0,    // Default creation flags.\n      NULL,   // Inherit the parent's environment.\n      UnitTest::GetInstance()->original_working_dir(),\n      &startup_info,\n      &process_info) != FALSE);\n  child_handle_.Reset(process_info.hProcess);\n  ::CloseHandle(process_info.hThread);\n  set_spawned(true);\n  return OVERSEE_TEST;\n}\n# else  // We are not on Windows.\n\n// ForkingDeathTest provides implementations for most of the abstract\n// methods of the DeathTest interface.  Only the AssumeRole method is\n// left undefined.\nclass ForkingDeathTest : public DeathTestImpl {\n public:\n  ForkingDeathTest(const char* statement, const RE* regex);\n\n  // All of these virtual functions are inherited from DeathTest.\n  virtual int Wait();\n\n protected:\n  void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }\n\n private:\n  // PID of child process during death test; 0 in the child process itself.\n  pid_t child_pid_;\n};\n\n// Constructs a ForkingDeathTest.\nForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex)\n    : DeathTestImpl(a_statement, a_regex),\n      child_pid_(-1) {}\n\n// Waits for the child in a death test to exit, returning its exit\n// status, or 0 if no child process exists.  As a side effect, sets the\n// outcome data member.\nint ForkingDeathTest::Wait() {\n  if (!spawned())\n    return 0;\n\n  ReadAndInterpretStatusByte();\n\n  int status_value;\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));\n  set_status(status_value);\n  return status_value;\n}\n\n// A concrete death test class that forks, then immediately runs the test\n// in the child process.\nclass NoExecDeathTest : public ForkingDeathTest {\n public:\n  NoExecDeathTest(const char* a_statement, const RE* a_regex) :\n      ForkingDeathTest(a_statement, a_regex) { }\n  virtual TestRole AssumeRole();\n};\n\n// The AssumeRole process for a fork-and-run death test.  It implements a\n// straightforward fork, with a simple pipe to transmit the status byte.\nDeathTest::TestRole NoExecDeathTest::AssumeRole() {\n  const size_t thread_count = GetThreadCount();\n  if (thread_count != 1) {\n    GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);\n  }\n\n  int pipe_fd[2];\n  GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);\n\n  DeathTest::set_last_death_test_message(\"\");\n  CaptureStderr();\n  // When we fork the process below, the log file buffers are copied, but the\n  // file descriptors are shared.  We flush all log files here so that closing\n  // the file descriptors in the child process doesn't throw off the\n  // synchronization between descriptors and buffers in the parent process.\n  // This is as close to the fork as possible to avoid a race condition in case\n  // there are multiple threads running before the death test, and another\n  // thread writes to the log file.\n  FlushInfoLog();\n\n  const pid_t child_pid = fork();\n  GTEST_DEATH_TEST_CHECK_(child_pid != -1);\n  set_child_pid(child_pid);\n  if (child_pid == 0) {\n    GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));\n    set_write_fd(pipe_fd[1]);\n    // Redirects all logging to stderr in the child process to prevent\n    // concurrent writes to the log files.  We capture stderr in the parent\n    // process and append the child process' output to a log.\n    LogToStderr();\n    // Event forwarding to the listeners of event listener API mush be shut\n    // down in death test subprocesses.\n    GetUnitTestImpl()->listeners()->SuppressEventForwarding();\n    g_in_fast_death_test_child = true;\n    return EXECUTE_TEST;\n  } else {\n    GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));\n    set_read_fd(pipe_fd[0]);\n    set_spawned(true);\n    return OVERSEE_TEST;\n  }\n}\n\n// A concrete death test class that forks and re-executes the main\n// program from the beginning, with command-line flags set that cause\n// only this specific death test to be run.\nclass ExecDeathTest : public ForkingDeathTest {\n public:\n  ExecDeathTest(const char* a_statement, const RE* a_regex,\n                const char* file, int line) :\n      ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }\n  virtual TestRole AssumeRole();\n private:\n  static ::std::vector<testing::internal::string>\n  GetArgvsForDeathTestChildProcess() {\n    ::std::vector<testing::internal::string> args = GetInjectableArgvs();\n    return args;\n  }\n  // The name of the file in which the death test is located.\n  const char* const file_;\n  // The line number on which the death test is located.\n  const int line_;\n};\n\n// Utility class for accumulating command-line arguments.\nclass Arguments {\n public:\n  Arguments() {\n    args_.push_back(NULL);\n  }\n\n  ~Arguments() {\n    for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();\n         ++i) {\n      free(*i);\n    }\n  }\n  void AddArgument(const char* argument) {\n    args_.insert(args_.end() - 1, posix::StrDup(argument));\n  }\n\n  template <typename Str>\n  void AddArguments(const ::std::vector<Str>& arguments) {\n    for (typename ::std::vector<Str>::const_iterator i = arguments.begin();\n         i != arguments.end();\n         ++i) {\n      args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));\n    }\n  }\n  char* const* Argv() {\n    return &args_[0];\n  }\n\n private:\n  std::vector<char*> args_;\n};\n\n// A struct that encompasses the arguments to the child process of a\n// threadsafe-style death test process.\nstruct ExecDeathTestArgs {\n  char* const* argv;  // Command-line arguments for the child's call to exec\n  int close_fd;       // File descriptor to close; the read end of a pipe\n};\n\n#  if GTEST_OS_MAC\ninline char** GetEnviron() {\n  // When Google Test is built as a framework on MacOS X, the environ variable\n  // is unavailable. Apple's documentation (man environ) recommends using\n  // _NSGetEnviron() instead.\n  return *_NSGetEnviron();\n}\n#  else\n// Some POSIX platforms expect you to declare environ. extern \"C\" makes\n// it reside in the global namespace.\nextern \"C\" char** environ;\ninline char** GetEnviron() { return environ; }\n#  endif  // GTEST_OS_MAC\n\n#  if !GTEST_OS_QNX\n// The main function for a threadsafe-style death test child process.\n// This function is called in a clone()-ed process and thus must avoid\n// any potentially unsafe operations like malloc or libc functions.\nstatic int ExecDeathTestChildMain(void* child_arg) {\n  ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));\n\n  // We need to execute the test program in the same environment where\n  // it was originally invoked.  Therefore we change to the original\n  // working directory first.\n  const char* const original_dir =\n      UnitTest::GetInstance()->original_working_dir();\n  // We can safely call chdir() as it's a direct system call.\n  if (chdir(original_dir) != 0) {\n    DeathTestAbort(std::string(\"chdir(\\\"\") + original_dir + \"\\\") failed: \" +\n                   GetLastErrnoDescription());\n    return EXIT_FAILURE;\n  }\n\n  // We can safely call execve() as it's a direct system call.  We\n  // cannot use execvp() as it's a libc function and thus potentially\n  // unsafe.  Since execve() doesn't search the PATH, the user must\n  // invoke the test program via a valid path that contains at least\n  // one path separator.\n  execve(args->argv[0], args->argv, GetEnviron());\n  DeathTestAbort(std::string(\"execve(\") + args->argv[0] + \", ...) in \" +\n                 original_dir + \" failed: \" +\n                 GetLastErrnoDescription());\n  return EXIT_FAILURE;\n}\n#  endif  // !GTEST_OS_QNX\n\n// Two utility routines that together determine the direction the stack\n// grows.\n// This could be accomplished more elegantly by a single recursive\n// function, but we want to guard against the unlikely possibility of\n// a smart compiler optimizing the recursion away.\n//\n// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining\n// StackLowerThanAddress into StackGrowsDown, which then doesn't give\n// correct answer.\nvoid StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;\nvoid StackLowerThanAddress(const void* ptr, bool* result) {\n  int dummy;\n  *result = (&dummy < ptr);\n}\n\nbool StackGrowsDown() {\n  int dummy;\n  bool result;\n  StackLowerThanAddress(&dummy, &result);\n  return result;\n}\n\n// Spawns a child process with the same executable as the current process in\n// a thread-safe manner and instructs it to run the death test.  The\n// implementation uses fork(2) + exec.  On systems where clone(2) is\n// available, it is used instead, being slightly more thread-safe.  On QNX,\n// fork supports only single-threaded environments, so this function uses\n// spawn(2) there instead.  The function dies with an error message if\n// anything goes wrong.\nstatic pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {\n  ExecDeathTestArgs args = { argv, close_fd };\n  pid_t child_pid = -1;\n\n#  if GTEST_OS_QNX\n  // Obtains the current directory and sets it to be closed in the child\n  // process.\n  const int cwd_fd = open(\".\", O_RDONLY);\n  GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));\n  // We need to execute the test program in the same environment where\n  // it was originally invoked.  Therefore we change to the original\n  // working directory first.\n  const char* const original_dir =\n      UnitTest::GetInstance()->original_working_dir();\n  // We can safely call chdir() as it's a direct system call.\n  if (chdir(original_dir) != 0) {\n    DeathTestAbort(std::string(\"chdir(\\\"\") + original_dir + \"\\\") failed: \" +\n                   GetLastErrnoDescription());\n    return EXIT_FAILURE;\n  }\n\n  int fd_flags;\n  // Set close_fd to be closed after spawn.\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,\n                                        fd_flags | FD_CLOEXEC));\n  struct inheritance inherit = {0};\n  // spawn is a system call.\n  child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());\n  // Restores the current working directory.\n  GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));\n\n#  else   // GTEST_OS_QNX\n#   if GTEST_OS_LINUX\n  // When a SIGPROF signal is received while fork() or clone() are executing,\n  // the process may hang. To avoid this, we ignore SIGPROF here and re-enable\n  // it after the call to fork()/clone() is complete.\n  struct sigaction saved_sigprof_action;\n  struct sigaction ignore_sigprof_action;\n  memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));\n  sigemptyset(&ignore_sigprof_action.sa_mask);\n  ignore_sigprof_action.sa_handler = SIG_IGN;\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(\n      SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));\n#   endif  // GTEST_OS_LINUX\n\n#   if GTEST_HAS_CLONE\n  const bool use_fork = GTEST_FLAG(death_test_use_fork);\n\n  if (!use_fork) {\n    static const bool stack_grows_down = StackGrowsDown();\n    const size_t stack_size = getpagesize();\n    // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.\n    void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,\n                             MAP_ANON | MAP_PRIVATE, -1, 0);\n    GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);\n\n    // Maximum stack alignment in bytes:  For a downward-growing stack, this\n    // amount is subtracted from size of the stack space to get an address\n    // that is within the stack space and is aligned on all systems we care\n    // about.  As far as I know there is no ABI with stack alignment greater\n    // than 64.  We assume stack and stack_size already have alignment of\n    // kMaxStackAlignment.\n    const size_t kMaxStackAlignment = 64;\n    void* const stack_top =\n        static_cast<char*>(stack) +\n            (stack_grows_down ? stack_size - kMaxStackAlignment : 0);\n    GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment &&\n        reinterpret_cast<intptr_t>(stack_top) % kMaxStackAlignment == 0);\n\n    child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);\n\n    GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);\n  }\n#   else\n  const bool use_fork = true;\n#   endif  // GTEST_HAS_CLONE\n\n  if (use_fork && (child_pid = fork()) == 0) {\n      ExecDeathTestChildMain(&args);\n      _exit(0);\n  }\n#  endif  // GTEST_OS_QNX\n#  if GTEST_OS_LINUX\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(\n      sigaction(SIGPROF, &saved_sigprof_action, NULL));\n#  endif  // GTEST_OS_LINUX\n\n  GTEST_DEATH_TEST_CHECK_(child_pid != -1);\n  return child_pid;\n}\n\n// The AssumeRole process for a fork-and-exec death test.  It re-executes the\n// main program from the beginning, setting the --gtest_filter\n// and --gtest_internal_run_death_test flags to cause only the current\n// death test to be re-run.\nDeathTest::TestRole ExecDeathTest::AssumeRole() {\n  const UnitTestImpl* const impl = GetUnitTestImpl();\n  const InternalRunDeathTestFlag* const flag =\n      impl->internal_run_death_test_flag();\n  const TestInfo* const info = impl->current_test_info();\n  const int death_test_index = info->result()->death_test_count();\n\n  if (flag != NULL) {\n    set_write_fd(flag->write_fd());\n    return EXECUTE_TEST;\n  }\n\n  int pipe_fd[2];\n  GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);\n  // Clear the close-on-exec flag on the write end of the pipe, lest\n  // it be closed when the child process does an exec:\n  GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);\n\n  const std::string filter_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kFilterFlag + \"=\"\n      + info->test_case_name() + \".\" + info->name();\n  const std::string internal_flag =\n      std::string(\"--\") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + \"=\"\n      + file_ + \"|\" + StreamableToString(line_) + \"|\"\n      + StreamableToString(death_test_index) + \"|\"\n      + StreamableToString(pipe_fd[1]);\n  Arguments args;\n  args.AddArguments(GetArgvsForDeathTestChildProcess());\n  args.AddArgument(filter_flag.c_str());\n  args.AddArgument(internal_flag.c_str());\n\n  DeathTest::set_last_death_test_message(\"\");\n\n  CaptureStderr();\n  // See the comment in NoExecDeathTest::AssumeRole for why the next line\n  // is necessary.\n  FlushInfoLog();\n\n  const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);\n  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));\n  set_child_pid(child_pid);\n  set_read_fd(pipe_fd[0]);\n  set_spawned(true);\n  return OVERSEE_TEST;\n}\n\n# endif  // !GTEST_OS_WINDOWS\n\n// Creates a concrete DeathTest-derived class that depends on the\n// --gtest_death_test_style flag, and sets the pointer pointed to\n// by the \"test\" argument to its address.  If the test should be\n// skipped, sets that pointer to NULL.  Returns true, unless the\n// flag is set to an invalid value.\nbool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,\n                                     const char* file, int line,\n                                     DeathTest** test) {\n  UnitTestImpl* const impl = GetUnitTestImpl();\n  const InternalRunDeathTestFlag* const flag =\n      impl->internal_run_death_test_flag();\n  const int death_test_index = impl->current_test_info()\n      ->increment_death_test_count();\n\n  if (flag != NULL) {\n    if (death_test_index > flag->index()) {\n      DeathTest::set_last_death_test_message(\n          \"Death test count (\" + StreamableToString(death_test_index)\n          + \") somehow exceeded expected maximum (\"\n          + StreamableToString(flag->index()) + \")\");\n      return false;\n    }\n\n    if (!(flag->file() == file && flag->line() == line &&\n          flag->index() == death_test_index)) {\n      *test = NULL;\n      return true;\n    }\n  }\n\n# if GTEST_OS_WINDOWS\n\n  if (GTEST_FLAG(death_test_style) == \"threadsafe\" ||\n      GTEST_FLAG(death_test_style) == \"fast\") {\n    *test = new WindowsDeathTest(statement, regex, file, line);\n  }\n\n# else\n\n  if (GTEST_FLAG(death_test_style) == \"threadsafe\") {\n    *test = new ExecDeathTest(statement, regex, file, line);\n  } else if (GTEST_FLAG(death_test_style) == \"fast\") {\n    *test = new NoExecDeathTest(statement, regex);\n  }\n\n# endif  // GTEST_OS_WINDOWS\n\n  else {  // NOLINT - this is more readable than unbalanced brackets inside #if.\n    DeathTest::set_last_death_test_message(\n        \"Unknown death test style \\\"\" + GTEST_FLAG(death_test_style)\n        + \"\\\" encountered\");\n    return false;\n  }\n\n  return true;\n}\n\n// Splits a given string on a given delimiter, populating a given\n// vector with the fields.  GTEST_HAS_DEATH_TEST implies that we have\n// ::std::string, so we can use it here.\nstatic void SplitString(const ::std::string& str, char delimiter,\n                        ::std::vector< ::std::string>* dest) {\n  ::std::vector< ::std::string> parsed;\n  ::std::string::size_type pos = 0;\n  while (::testing::internal::AlwaysTrue()) {\n    const ::std::string::size_type colon = str.find(delimiter, pos);\n    if (colon == ::std::string::npos) {\n      parsed.push_back(str.substr(pos));\n      break;\n    } else {\n      parsed.push_back(str.substr(pos, colon - pos));\n      pos = colon + 1;\n    }\n  }\n  dest->swap(parsed);\n}\n\n# if GTEST_OS_WINDOWS\n// Recreates the pipe and event handles from the provided parameters,\n// signals the event, and returns a file descriptor wrapped around the pipe\n// handle. This function is called in the child process only.\nint GetStatusFileDescriptor(unsigned int parent_process_id,\n                            size_t write_handle_as_size_t,\n                            size_t event_handle_as_size_t) {\n  AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,\n                                                   FALSE,  // Non-inheritable.\n                                                   parent_process_id));\n  if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {\n    DeathTestAbort(\"Unable to open parent process \" +\n                   StreamableToString(parent_process_id));\n  }\n\n  // TODO(vladl@google.com): Replace the following check with a\n  // compile-time assertion when available.\n  GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));\n\n  const HANDLE write_handle =\n      reinterpret_cast<HANDLE>(write_handle_as_size_t);\n  HANDLE dup_write_handle;\n\n  // The newly initialized handle is accessible only in in the parent\n  // process. To obtain one accessible within the child, we need to use\n  // DuplicateHandle.\n  if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,\n                         ::GetCurrentProcess(), &dup_write_handle,\n                         0x0,    // Requested privileges ignored since\n                                 // DUPLICATE_SAME_ACCESS is used.\n                         FALSE,  // Request non-inheritable handler.\n                         DUPLICATE_SAME_ACCESS)) {\n    DeathTestAbort(\"Unable to duplicate the pipe handle \" +\n                   StreamableToString(write_handle_as_size_t) +\n                   \" from the parent process \" +\n                   StreamableToString(parent_process_id));\n  }\n\n  const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);\n  HANDLE dup_event_handle;\n\n  if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,\n                         ::GetCurrentProcess(), &dup_event_handle,\n                         0x0,\n                         FALSE,\n                         DUPLICATE_SAME_ACCESS)) {\n    DeathTestAbort(\"Unable to duplicate the event handle \" +\n                   StreamableToString(event_handle_as_size_t) +\n                   \" from the parent process \" +\n                   StreamableToString(parent_process_id));\n  }\n\n  const int write_fd =\n      ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);\n  if (write_fd == -1) {\n    DeathTestAbort(\"Unable to convert pipe handle \" +\n                   StreamableToString(write_handle_as_size_t) +\n                   \" to a file descriptor\");\n  }\n\n  // Signals the parent that the write end of the pipe has been acquired\n  // so the parent can release its own write end.\n  ::SetEvent(dup_event_handle);\n\n  return write_fd;\n}\n# endif  // GTEST_OS_WINDOWS\n\n// Returns a newly created InternalRunDeathTestFlag object with fields\n// initialized from the GTEST_FLAG(internal_run_death_test) flag if\n// the flag is specified; otherwise returns NULL.\nInternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {\n  if (GTEST_FLAG(internal_run_death_test) == \"\") return NULL;\n\n  // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we\n  // can use it here.\n  int line = -1;\n  int index = -1;\n  ::std::vector< ::std::string> fields;\n  SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);\n  int write_fd = -1;\n\n# if GTEST_OS_WINDOWS\n\n  unsigned int parent_process_id = 0;\n  size_t write_handle_as_size_t = 0;\n  size_t event_handle_as_size_t = 0;\n\n  if (fields.size() != 6\n      || !ParseNaturalNumber(fields[1], &line)\n      || !ParseNaturalNumber(fields[2], &index)\n      || !ParseNaturalNumber(fields[3], &parent_process_id)\n      || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)\n      || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {\n    DeathTestAbort(\"Bad --gtest_internal_run_death_test flag: \" +\n                   GTEST_FLAG(internal_run_death_test));\n  }\n  write_fd = GetStatusFileDescriptor(parent_process_id,\n                                     write_handle_as_size_t,\n                                     event_handle_as_size_t);\n# else\n\n  if (fields.size() != 4\n      || !ParseNaturalNumber(fields[1], &line)\n      || !ParseNaturalNumber(fields[2], &index)\n      || !ParseNaturalNumber(fields[3], &write_fd)) {\n    DeathTestAbort(\"Bad --gtest_internal_run_death_test flag: \"\n        + GTEST_FLAG(internal_run_death_test));\n  }\n\n# endif  // GTEST_OS_WINDOWS\n\n  return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);\n}\n\n}  // namespace internal\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest-filepath.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: keith.ray@gmail.com (Keith Ray)\n\n#include \"gtest/gtest-message.h\"\n#include \"gtest/internal/gtest-filepath.h\"\n#include \"gtest/internal/gtest-port.h\"\n\n#include <stdlib.h>\n\n#if GTEST_OS_WINDOWS_MOBILE\n# include <windows.h>\n#elif GTEST_OS_WINDOWS\n# include <direct.h>\n# include <io.h>\n#elif GTEST_OS_SYMBIAN\n// Symbian OpenC has PATH_MAX in sys/syslimits.h\n# include <sys/syslimits.h>\n#else\n# include <limits.h>\n# include <climits>  // Some Linux distributions define PATH_MAX here.\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n#if GTEST_OS_WINDOWS\n# define GTEST_PATH_MAX_ _MAX_PATH\n#elif defined(PATH_MAX)\n# define GTEST_PATH_MAX_ PATH_MAX\n#elif defined(_XOPEN_PATH_MAX)\n# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX\n#else\n# define GTEST_PATH_MAX_ _POSIX_PATH_MAX\n#endif  // GTEST_OS_WINDOWS\n\n#include \"gtest/internal/gtest-string.h\"\n\nnamespace testing {\nnamespace internal {\n\n#if GTEST_OS_WINDOWS\n// On Windows, '\\\\' is the standard path separator, but many tools and the\n// Windows API also accept '/' as an alternate path separator. Unless otherwise\n// noted, a file path can contain either kind of path separators, or a mixture\n// of them.\nconst char kPathSeparator = '\\\\';\nconst char kAlternatePathSeparator = '/';\nconst char kPathSeparatorString[] = \"\\\\\";\nconst char kAlternatePathSeparatorString[] = \"/\";\n# if GTEST_OS_WINDOWS_MOBILE\n// Windows CE doesn't have a current directory. You should not use\n// the current directory in tests on Windows CE, but this at least\n// provides a reasonable fallback.\nconst char kCurrentDirectoryString[] = \"\\\\\";\n// Windows CE doesn't define INVALID_FILE_ATTRIBUTES\nconst DWORD kInvalidFileAttributes = 0xffffffff;\n# else\nconst char kCurrentDirectoryString[] = \".\\\\\";\n# endif  // GTEST_OS_WINDOWS_MOBILE\n#else\nconst char kPathSeparator = '/';\nconst char kPathSeparatorString[] = \"/\";\nconst char kCurrentDirectoryString[] = \"./\";\n#endif  // GTEST_OS_WINDOWS\n\n// Returns whether the given character is a valid path separator.\nstatic bool IsPathSeparator(char c) {\n#if GTEST_HAS_ALT_PATH_SEP_\n  return (c == kPathSeparator) || (c == kAlternatePathSeparator);\n#else\n  return c == kPathSeparator;\n#endif\n}\n\n// Returns the current working directory, or \"\" if unsuccessful.\nFilePath FilePath::GetCurrentDir() {\n#if GTEST_OS_WINDOWS_MOBILE\n  // Windows CE doesn't have a current directory, so we just return\n  // something reasonable.\n  return FilePath(kCurrentDirectoryString);\n#elif GTEST_OS_WINDOWS\n  char cwd[GTEST_PATH_MAX_ + 1] = { '\\0' };\n  return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? \"\" : cwd);\n#else\n  char cwd[GTEST_PATH_MAX_ + 1] = { '\\0' };\n  return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? \"\" : cwd);\n#endif  // GTEST_OS_WINDOWS_MOBILE\n}\n\n// Returns a copy of the FilePath with the case-insensitive extension removed.\n// Example: FilePath(\"dir/file.exe\").RemoveExtension(\"EXE\") returns\n// FilePath(\"dir/file\"). If a case-insensitive extension is not\n// found, returns a copy of the original FilePath.\nFilePath FilePath::RemoveExtension(const char* extension) const {\n  const std::string dot_extension = std::string(\".\") + extension;\n  if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {\n    return FilePath(pathname_.substr(\n        0, pathname_.length() - dot_extension.length()));\n  }\n  return *this;\n}\n\n// Returns a pointer to the last occurence of a valid path separator in\n// the FilePath. On Windows, for example, both '/' and '\\' are valid path\n// separators. Returns NULL if no path separator was found.\nconst char* FilePath::FindLastPathSeparator() const {\n  const char* const last_sep = strrchr(c_str(), kPathSeparator);\n#if GTEST_HAS_ALT_PATH_SEP_\n  const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);\n  // Comparing two pointers of which only one is NULL is undefined.\n  if (last_alt_sep != NULL &&\n      (last_sep == NULL || last_alt_sep > last_sep)) {\n    return last_alt_sep;\n  }\n#endif\n  return last_sep;\n}\n\n// Returns a copy of the FilePath with the directory part removed.\n// Example: FilePath(\"path/to/file\").RemoveDirectoryName() returns\n// FilePath(\"file\"). If there is no directory part (\"just_a_file\"), it returns\n// the FilePath unmodified. If there is no file part (\"just_a_dir/\") it\n// returns an empty FilePath (\"\").\n// On Windows platform, '\\' is the path separator, otherwise it is '/'.\nFilePath FilePath::RemoveDirectoryName() const {\n  const char* const last_sep = FindLastPathSeparator();\n  return last_sep ? FilePath(last_sep + 1) : *this;\n}\n\n// RemoveFileName returns the directory path with the filename removed.\n// Example: FilePath(\"path/to/file\").RemoveFileName() returns \"path/to/\".\n// If the FilePath is \"a_file\" or \"/a_file\", RemoveFileName returns\n// FilePath(\"./\") or, on Windows, FilePath(\".\\\\\"). If the filepath does\n// not have a file, like \"just/a/dir/\", it returns the FilePath unmodified.\n// On Windows platform, '\\' is the path separator, otherwise it is '/'.\nFilePath FilePath::RemoveFileName() const {\n  const char* const last_sep = FindLastPathSeparator();\n  std::string dir;\n  if (last_sep) {\n    dir = std::string(c_str(), last_sep + 1 - c_str());\n  } else {\n    dir = kCurrentDirectoryString;\n  }\n  return FilePath(dir);\n}\n\n// Helper functions for naming files in a directory for xml output.\n\n// Given directory = \"dir\", base_name = \"test\", number = 0,\n// extension = \"xml\", returns \"dir/test.xml\". If number is greater\n// than zero (e.g., 12), returns \"dir/test_12.xml\".\n// On Windows platform, uses \\ as the separator rather than /.\nFilePath FilePath::MakeFileName(const FilePath& directory,\n                                const FilePath& base_name,\n                                int number,\n                                const char* extension) {\n  std::string file;\n  if (number == 0) {\n    file = base_name.string() + \".\" + extension;\n  } else {\n    file = base_name.string() + \"_\" + StreamableToString(number)\n        + \".\" + extension;\n  }\n  return ConcatPaths(directory, FilePath(file));\n}\n\n// Given directory = \"dir\", relative_path = \"test.xml\", returns \"dir/test.xml\".\n// On Windows, uses \\ as the separator rather than /.\nFilePath FilePath::ConcatPaths(const FilePath& directory,\n                               const FilePath& relative_path) {\n  if (directory.IsEmpty())\n    return relative_path;\n  const FilePath dir(directory.RemoveTrailingPathSeparator());\n  return FilePath(dir.string() + kPathSeparator + relative_path.string());\n}\n\n// Returns true if pathname describes something findable in the file-system,\n// either a file, directory, or whatever.\nbool FilePath::FileOrDirectoryExists() const {\n#if GTEST_OS_WINDOWS_MOBILE\n  LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());\n  const DWORD attributes = GetFileAttributes(unicode);\n  delete [] unicode;\n  return attributes != kInvalidFileAttributes;\n#else\n  posix::StatStruct file_stat;\n  return posix::Stat(pathname_.c_str(), &file_stat) == 0;\n#endif  // GTEST_OS_WINDOWS_MOBILE\n}\n\n// Returns true if pathname describes a directory in the file-system\n// that exists.\nbool FilePath::DirectoryExists() const {\n  bool result = false;\n#if GTEST_OS_WINDOWS\n  // Don't strip off trailing separator if path is a root directory on\n  // Windows (like \"C:\\\\\").\n  const FilePath& path(IsRootDirectory() ? *this :\n                                           RemoveTrailingPathSeparator());\n#else\n  const FilePath& path(*this);\n#endif\n\n#if GTEST_OS_WINDOWS_MOBILE\n  LPCWSTR unicode = String::AnsiToUtf16(path.c_str());\n  const DWORD attributes = GetFileAttributes(unicode);\n  delete [] unicode;\n  if ((attributes != kInvalidFileAttributes) &&\n      (attributes & FILE_ATTRIBUTE_DIRECTORY)) {\n    result = true;\n  }\n#else\n  posix::StatStruct file_stat;\n  result = posix::Stat(path.c_str(), &file_stat) == 0 &&\n      posix::IsDir(file_stat);\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n  return result;\n}\n\n// Returns true if pathname describes a root directory. (Windows has one\n// root directory per disk drive.)\nbool FilePath::IsRootDirectory() const {\n#if GTEST_OS_WINDOWS\n  // TODO(wan@google.com): on Windows a network share like\n  // \\\\server\\share can be a root directory, although it cannot be the\n  // current directory.  Handle this properly.\n  return pathname_.length() == 3 && IsAbsolutePath();\n#else\n  return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);\n#endif\n}\n\n// Returns true if pathname describes an absolute path.\nbool FilePath::IsAbsolutePath() const {\n  const char* const name = pathname_.c_str();\n#if GTEST_OS_WINDOWS\n  return pathname_.length() >= 3 &&\n     ((name[0] >= 'a' && name[0] <= 'z') ||\n      (name[0] >= 'A' && name[0] <= 'Z')) &&\n     name[1] == ':' &&\n     IsPathSeparator(name[2]);\n#else\n  return IsPathSeparator(name[0]);\n#endif\n}\n\n// Returns a pathname for a file that does not currently exist. The pathname\n// will be directory/base_name.extension or\n// directory/base_name_<number>.extension if directory/base_name.extension\n// already exists. The number will be incremented until a pathname is found\n// that does not already exist.\n// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.\n// There could be a race condition if two or more processes are calling this\n// function at the same time -- they could both pick the same filename.\nFilePath FilePath::GenerateUniqueFileName(const FilePath& directory,\n                                          const FilePath& base_name,\n                                          const char* extension) {\n  FilePath full_pathname;\n  int number = 0;\n  do {\n    full_pathname.Set(MakeFileName(directory, base_name, number++, extension));\n  } while (full_pathname.FileOrDirectoryExists());\n  return full_pathname;\n}\n\n// Returns true if FilePath ends with a path separator, which indicates that\n// it is intended to represent a directory. Returns false otherwise.\n// This does NOT check that a directory (or file) actually exists.\nbool FilePath::IsDirectory() const {\n  return !pathname_.empty() &&\n         IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);\n}\n\n// Create directories so that path exists. Returns true if successful or if\n// the directories already exist; returns false if unable to create directories\n// for any reason.\nbool FilePath::CreateDirectoriesRecursively() const {\n  if (!this->IsDirectory()) {\n    return false;\n  }\n\n  if (pathname_.length() == 0 || this->DirectoryExists()) {\n    return true;\n  }\n\n  const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());\n  return parent.CreateDirectoriesRecursively() && this->CreateFolder();\n}\n\n// Create the directory so that path exists. Returns true if successful or\n// if the directory already exists; returns false if unable to create the\n// directory for any reason, including if the parent directory does not\n// exist. Not named \"CreateDirectory\" because that's a macro on Windows.\nbool FilePath::CreateFolder() const {\n#if GTEST_OS_WINDOWS_MOBILE\n  FilePath removed_sep(this->RemoveTrailingPathSeparator());\n  LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());\n  int result = CreateDirectory(unicode, NULL) ? 0 : -1;\n  delete [] unicode;\n#elif GTEST_OS_WINDOWS\n  int result = _mkdir(pathname_.c_str());\n#else\n  int result = mkdir(pathname_.c_str(), 0777);\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n  if (result == -1) {\n    return this->DirectoryExists();  // An error is OK if the directory exists.\n  }\n  return true;  // No error.\n}\n\n// If input name has a trailing separator character, remove it and return the\n// name, otherwise return the name string unmodified.\n// On Windows platform, uses \\ as the separator, other platforms use /.\nFilePath FilePath::RemoveTrailingPathSeparator() const {\n  return IsDirectory()\n      ? FilePath(pathname_.substr(0, pathname_.length() - 1))\n      : *this;\n}\n\n// Removes any redundant separators that might be in the pathname.\n// For example, \"bar///foo\" becomes \"bar/foo\". Does not eliminate other\n// redundancies that might be in a pathname involving \".\" or \"..\".\n// TODO(wan@google.com): handle Windows network shares (e.g. \\\\server\\share).\nvoid FilePath::Normalize() {\n  if (pathname_.c_str() == NULL) {\n    pathname_ = \"\";\n    return;\n  }\n  const char* src = pathname_.c_str();\n  char* const dest = new char[pathname_.length() + 1];\n  char* dest_ptr = dest;\n  memset(dest_ptr, 0, pathname_.length() + 1);\n\n  while (*src != '\\0') {\n    *dest_ptr = *src;\n    if (!IsPathSeparator(*src)) {\n      src++;\n    } else {\n#if GTEST_HAS_ALT_PATH_SEP_\n      if (*dest_ptr == kAlternatePathSeparator) {\n        *dest_ptr = kPathSeparator;\n      }\n#endif\n      while (IsPathSeparator(*src))\n        src++;\n    }\n    dest_ptr++;\n  }\n  *dest_ptr = '\\0';\n  pathname_ = dest;\n  delete[] dest;\n}\n\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest-internal-inl.h",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Utility functions and classes used by the Google C++ testing framework.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// This file contains purely Google Test's internal implementation.  Please\n// DO NOT #INCLUDE IT IN A USER PROGRAM.\n\n#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_\n#define GTEST_SRC_GTEST_INTERNAL_INL_H_\n\n// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is\n// part of Google Test's implementation; otherwise it's undefined.\n#if !GTEST_IMPLEMENTATION_\n// A user is trying to include this from his code - just say no.\n# error \"gtest-internal-inl.h is part of Google Test's internal implementation.\"\n# error \"It must not be included except by Google Test itself.\"\n#endif  // GTEST_IMPLEMENTATION_\n\n#ifndef _WIN32_WCE\n# include <errno.h>\n#endif  // !_WIN32_WCE\n#include <stddef.h>\n#include <stdlib.h>  // For strtoll/_strtoul64/malloc/free.\n#include <string.h>  // For memmove.\n\n#include <algorithm>\n#include <string>\n#include <vector>\n\n#include \"gtest/internal/gtest-port.h\"\n\n#if GTEST_CAN_STREAM_RESULTS_\n# include <arpa/inet.h>  // NOLINT\n# include <netdb.h>  // NOLINT\n#endif\n\n#if GTEST_OS_WINDOWS\n# include <windows.h>  // NOLINT\n#endif  // GTEST_OS_WINDOWS\n\n#include \"gtest/gtest.h\"  // NOLINT\n#include \"gtest/gtest-spi.h\"\n\nnamespace testing {\n\n// Declares the flags.\n//\n// We don't want the users to modify this flag in the code, but want\n// Google Test's own unit tests to be able to access it. Therefore we\n// declare it here as opposed to in gtest.h.\nGTEST_DECLARE_bool_(death_test_use_fork);\n\nnamespace internal {\n\n// The value of GetTestTypeId() as seen from within the Google Test\n// library.  This is solely for testing GetTestTypeId().\nGTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;\n\n// Names of the flags (needed for parsing Google Test flags).\nconst char kAlsoRunDisabledTestsFlag[] = \"also_run_disabled_tests\";\nconst char kBreakOnFailureFlag[] = \"break_on_failure\";\nconst char kCatchExceptionsFlag[] = \"catch_exceptions\";\nconst char kColorFlag[] = \"color\";\nconst char kFilterFlag[] = \"filter\";\nconst char kListTestsFlag[] = \"list_tests\";\nconst char kOutputFlag[] = \"output\";\nconst char kPrintTimeFlag[] = \"print_time\";\nconst char kRandomSeedFlag[] = \"random_seed\";\nconst char kRepeatFlag[] = \"repeat\";\nconst char kShuffleFlag[] = \"shuffle\";\nconst char kStackTraceDepthFlag[] = \"stack_trace_depth\";\nconst char kStreamResultToFlag[] = \"stream_result_to\";\nconst char kThrowOnFailureFlag[] = \"throw_on_failure\";\n\n// A valid random seed must be in [1, kMaxRandomSeed].\nconst int kMaxRandomSeed = 99999;\n\n// g_help_flag is true iff the --help flag or an equivalent form is\n// specified on the command line.\nGTEST_API_ extern bool g_help_flag;\n\n// Returns the current time in milliseconds.\nGTEST_API_ TimeInMillis GetTimeInMillis();\n\n// Returns true iff Google Test should use colors in the output.\nGTEST_API_ bool ShouldUseColor(bool stdout_is_tty);\n\n// Formats the given time in milliseconds as seconds.\nGTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);\n\n// Converts the given time in milliseconds to a date string in the ISO 8601\n// format, without the timezone information.  N.B.: due to the use the\n// non-reentrant localtime() function, this function is not thread safe.  Do\n// not use it in any code that can be called from multiple threads.\nGTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);\n\n// Parses a string for an Int32 flag, in the form of \"--flag=value\".\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nGTEST_API_ bool ParseInt32Flag(\n    const char* str, const char* flag, Int32* value);\n\n// Returns a random seed in range [1, kMaxRandomSeed] based on the\n// given --gtest_random_seed flag value.\ninline int GetRandomSeedFromFlag(Int32 random_seed_flag) {\n  const unsigned int raw_seed = (random_seed_flag == 0) ?\n      static_cast<unsigned int>(GetTimeInMillis()) :\n      static_cast<unsigned int>(random_seed_flag);\n\n  // Normalizes the actual seed to range [1, kMaxRandomSeed] such that\n  // it's easy to type.\n  const int normalized_seed =\n      static_cast<int>((raw_seed - 1U) %\n                       static_cast<unsigned int>(kMaxRandomSeed)) + 1;\n  return normalized_seed;\n}\n\n// Returns the first valid random seed after 'seed'.  The behavior is\n// undefined if 'seed' is invalid.  The seed after kMaxRandomSeed is\n// considered to be 1.\ninline int GetNextRandomSeed(int seed) {\n  GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)\n      << \"Invalid random seed \" << seed << \" - must be in [1, \"\n      << kMaxRandomSeed << \"].\";\n  const int next_seed = seed + 1;\n  return (next_seed > kMaxRandomSeed) ? 1 : next_seed;\n}\n\n// This class saves the values of all Google Test flags in its c'tor, and\n// restores them in its d'tor.\nclass GTestFlagSaver {\n public:\n  // The c'tor.\n  GTestFlagSaver() {\n    also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);\n    break_on_failure_ = GTEST_FLAG(break_on_failure);\n    catch_exceptions_ = GTEST_FLAG(catch_exceptions);\n    color_ = GTEST_FLAG(color);\n    death_test_style_ = GTEST_FLAG(death_test_style);\n    death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);\n    filter_ = GTEST_FLAG(filter);\n    internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);\n    list_tests_ = GTEST_FLAG(list_tests);\n    output_ = GTEST_FLAG(output);\n    print_time_ = GTEST_FLAG(print_time);\n    random_seed_ = GTEST_FLAG(random_seed);\n    repeat_ = GTEST_FLAG(repeat);\n    shuffle_ = GTEST_FLAG(shuffle);\n    stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);\n    stream_result_to_ = GTEST_FLAG(stream_result_to);\n    throw_on_failure_ = GTEST_FLAG(throw_on_failure);\n  }\n\n  // The d'tor is not virtual.  DO NOT INHERIT FROM THIS CLASS.\n  ~GTestFlagSaver() {\n    GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;\n    GTEST_FLAG(break_on_failure) = break_on_failure_;\n    GTEST_FLAG(catch_exceptions) = catch_exceptions_;\n    GTEST_FLAG(color) = color_;\n    GTEST_FLAG(death_test_style) = death_test_style_;\n    GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;\n    GTEST_FLAG(filter) = filter_;\n    GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;\n    GTEST_FLAG(list_tests) = list_tests_;\n    GTEST_FLAG(output) = output_;\n    GTEST_FLAG(print_time) = print_time_;\n    GTEST_FLAG(random_seed) = random_seed_;\n    GTEST_FLAG(repeat) = repeat_;\n    GTEST_FLAG(shuffle) = shuffle_;\n    GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;\n    GTEST_FLAG(stream_result_to) = stream_result_to_;\n    GTEST_FLAG(throw_on_failure) = throw_on_failure_;\n  }\n\n private:\n  // Fields for saving the original values of flags.\n  bool also_run_disabled_tests_;\n  bool break_on_failure_;\n  bool catch_exceptions_;\n  std::string color_;\n  std::string death_test_style_;\n  bool death_test_use_fork_;\n  std::string filter_;\n  std::string internal_run_death_test_;\n  bool list_tests_;\n  std::string output_;\n  bool print_time_;\n  internal::Int32 random_seed_;\n  internal::Int32 repeat_;\n  bool shuffle_;\n  internal::Int32 stack_trace_depth_;\n  std::string stream_result_to_;\n  bool throw_on_failure_;\n} GTEST_ATTRIBUTE_UNUSED_;\n\n// Converts a Unicode code point to a narrow string in UTF-8 encoding.\n// code_point parameter is of type UInt32 because wchar_t may not be\n// wide enough to contain a code point.\n// If the code_point is not a valid Unicode code point\n// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted\n// to \"(Invalid Unicode 0xXXXXXXXX)\".\nGTEST_API_ std::string CodePointToUtf8(UInt32 code_point);\n\n// Converts a wide string to a narrow string in UTF-8 encoding.\n// The wide string is assumed to have the following encoding:\n//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)\n//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)\n// Parameter str points to a null-terminated wide string.\n// Parameter num_chars may additionally limit the number\n// of wchar_t characters processed. -1 is used when the entire string\n// should be processed.\n// If the string contains code points that are not valid Unicode code points\n// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output\n// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding\n// and contains invalid UTF-16 surrogate pairs, values in those pairs\n// will be encoded as individual Unicode characters from Basic Normal Plane.\nGTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);\n\n// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file\n// if the variable is present. If a file already exists at this location, this\n// function will write over it. If the variable is present, but the file cannot\n// be created, prints an error and exits.\nvoid WriteToShardStatusFileIfNeeded();\n\n// Checks whether sharding is enabled by examining the relevant\n// environment variable values. If the variables are present,\n// but inconsistent (e.g., shard_index >= total_shards), prints\n// an error and exits. If in_subprocess_for_death_test, sharding is\n// disabled because it must only be applied to the original test\n// process. Otherwise, we could filter out death tests we intended to execute.\nGTEST_API_ bool ShouldShard(const char* total_shards_str,\n                            const char* shard_index_str,\n                            bool in_subprocess_for_death_test);\n\n// Parses the environment variable var as an Int32. If it is unset,\n// returns default_val. If it is not an Int32, prints an error and\n// and aborts.\nGTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);\n\n// Given the total number of shards, the shard index, and the test id,\n// returns true iff the test should be run on this shard. The test id is\n// some arbitrary but unique non-negative integer assigned to each test\n// method. Assumes that 0 <= shard_index < total_shards.\nGTEST_API_ bool ShouldRunTestOnShard(\n    int total_shards, int shard_index, int test_id);\n\n// STL container utilities.\n\n// Returns the number of elements in the given container that satisfy\n// the given predicate.\ntemplate <class Container, typename Predicate>\ninline int CountIf(const Container& c, Predicate predicate) {\n  // Implemented as an explicit loop since std::count_if() in libCstd on\n  // Solaris has a non-standard signature.\n  int count = 0;\n  for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {\n    if (predicate(*it))\n      ++count;\n  }\n  return count;\n}\n\n// Applies a function/functor to each element in the container.\ntemplate <class Container, typename Functor>\nvoid ForEach(const Container& c, Functor functor) {\n  std::for_each(c.begin(), c.end(), functor);\n}\n\n// Returns the i-th element of the vector, or default_value if i is not\n// in range [0, v.size()).\ntemplate <typename E>\ninline E GetElementOr(const std::vector<E>& v, int i, E default_value) {\n  return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];\n}\n\n// Performs an in-place shuffle of a range of the vector's elements.\n// 'begin' and 'end' are element indices as an STL-style range;\n// i.e. [begin, end) are shuffled, where 'end' == size() means to\n// shuffle to the end of the vector.\ntemplate <typename E>\nvoid ShuffleRange(internal::Random* random, int begin, int end,\n                  std::vector<E>* v) {\n  const int size = static_cast<int>(v->size());\n  GTEST_CHECK_(0 <= begin && begin <= size)\n      << \"Invalid shuffle range start \" << begin << \": must be in range [0, \"\n      << size << \"].\";\n  GTEST_CHECK_(begin <= end && end <= size)\n      << \"Invalid shuffle range finish \" << end << \": must be in range [\"\n      << begin << \", \" << size << \"].\";\n\n  // Fisher-Yates shuffle, from\n  // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle\n  for (int range_width = end - begin; range_width >= 2; range_width--) {\n    const int last_in_range = begin + range_width - 1;\n    const int selected = begin + random->Generate(range_width);\n    std::swap((*v)[selected], (*v)[last_in_range]);\n  }\n}\n\n// Performs an in-place shuffle of the vector's elements.\ntemplate <typename E>\ninline void Shuffle(internal::Random* random, std::vector<E>* v) {\n  ShuffleRange(random, 0, static_cast<int>(v->size()), v);\n}\n\n// A function for deleting an object.  Handy for being used as a\n// functor.\ntemplate <typename T>\nstatic void Delete(T* x) {\n  delete x;\n}\n\n// A predicate that checks the key of a TestProperty against a known key.\n//\n// TestPropertyKeyIs is copyable.\nclass TestPropertyKeyIs {\n public:\n  // Constructor.\n  //\n  // TestPropertyKeyIs has NO default constructor.\n  explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}\n\n  // Returns true iff the test name of test property matches on key_.\n  bool operator()(const TestProperty& test_property) const {\n    return test_property.key() == key_;\n  }\n\n private:\n  std::string key_;\n};\n\n// Class UnitTestOptions.\n//\n// This class contains functions for processing options the user\n// specifies when running the tests.  It has only static members.\n//\n// In most cases, the user can specify an option using either an\n// environment variable or a command line flag.  E.g. you can set the\n// test filter using either GTEST_FILTER or --gtest_filter.  If both\n// the variable and the flag are present, the latter overrides the\n// former.\nclass GTEST_API_ UnitTestOptions {\n public:\n  // Functions for processing the gtest_output flag.\n\n  // Returns the output format, or \"\" for normal printed output.\n  static std::string GetOutputFormat();\n\n  // Returns the absolute path of the requested output file, or the\n  // default (test_detail.xml in the original working directory) if\n  // none was explicitly specified.\n  static std::string GetAbsolutePathToOutputFile();\n\n  // Functions for processing the gtest_filter flag.\n\n  // Returns true iff the wildcard pattern matches the string.  The\n  // first ':' or '\\0' character in pattern marks the end of it.\n  //\n  // This recursive algorithm isn't very efficient, but is clear and\n  // works well enough for matching test names, which are short.\n  static bool PatternMatchesString(const char *pattern, const char *str);\n\n  // Returns true iff the user-specified filter matches the test case\n  // name and the test name.\n  static bool FilterMatchesTest(const std::string &test_case_name,\n                                const std::string &test_name);\n\n#if GTEST_OS_WINDOWS\n  // Function for supporting the gtest_catch_exception flag.\n\n  // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the\n  // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.\n  // This function is useful as an __except condition.\n  static int GTestShouldProcessSEH(DWORD exception_code);\n#endif  // GTEST_OS_WINDOWS\n\n  // Returns true if \"name\" matches the ':' separated list of glob-style\n  // filters in \"filter\".\n  static bool MatchesFilter(const std::string& name, const char* filter);\n};\n\n// Returns the current application's name, removing directory path if that\n// is present.  Used by UnitTestOptions::GetOutputFile.\nGTEST_API_ FilePath GetCurrentExecutableName();\n\n// The role interface for getting the OS stack trace as a string.\nclass OsStackTraceGetterInterface {\n public:\n  OsStackTraceGetterInterface() {}\n  virtual ~OsStackTraceGetterInterface() {}\n\n  // Returns the current OS stack trace as an std::string.  Parameters:\n  //\n  //   max_depth  - the maximum number of stack frames to be included\n  //                in the trace.\n  //   skip_count - the number of top frames to be skipped; doesn't count\n  //                against max_depth.\n  virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;\n\n  // UponLeavingGTest() should be called immediately before Google Test calls\n  // user code. It saves some information about the current stack that\n  // CurrentStackTrace() will use to find and hide Google Test stack frames.\n  virtual void UponLeavingGTest() = 0;\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);\n};\n\n// A working implementation of the OsStackTraceGetterInterface interface.\nclass OsStackTraceGetter : public OsStackTraceGetterInterface {\n public:\n  OsStackTraceGetter() : caller_frame_(NULL) {}\n\n  virtual string CurrentStackTrace(int max_depth, int skip_count)\n      GTEST_LOCK_EXCLUDED_(mutex_);\n\n  virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);\n\n  // This string is inserted in place of stack frames that are part of\n  // Google Test's implementation.\n  static const char* const kElidedFramesMarker;\n\n private:\n  Mutex mutex_;  // protects all internal state\n\n  // We save the stack frame below the frame that calls user code.\n  // We do this because the address of the frame immediately below\n  // the user code changes between the call to UponLeavingGTest()\n  // and any calls to CurrentStackTrace() from within the user code.\n  void* caller_frame_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);\n};\n\n// Information about a Google Test trace point.\nstruct TraceInfo {\n  const char* file;\n  int line;\n  std::string message;\n};\n\n// This is the default global test part result reporter used in UnitTestImpl.\n// This class should only be used by UnitTestImpl.\nclass DefaultGlobalTestPartResultReporter\n  : public TestPartResultReporterInterface {\n public:\n  explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);\n  // Implements the TestPartResultReporterInterface. Reports the test part\n  // result in the current test.\n  virtual void ReportTestPartResult(const TestPartResult& result);\n\n private:\n  UnitTestImpl* const unit_test_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);\n};\n\n// This is the default per thread test part result reporter used in\n// UnitTestImpl. This class should only be used by UnitTestImpl.\nclass DefaultPerThreadTestPartResultReporter\n    : public TestPartResultReporterInterface {\n public:\n  explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);\n  // Implements the TestPartResultReporterInterface. The implementation just\n  // delegates to the current global test part result reporter of *unit_test_.\n  virtual void ReportTestPartResult(const TestPartResult& result);\n\n private:\n  UnitTestImpl* const unit_test_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);\n};\n\n// The private implementation of the UnitTest class.  We don't protect\n// the methods under a mutex, as this class is not accessible by a\n// user and the UnitTest class that delegates work to this class does\n// proper locking.\nclass GTEST_API_ UnitTestImpl {\n public:\n  explicit UnitTestImpl(UnitTest* parent);\n  virtual ~UnitTestImpl();\n\n  // There are two different ways to register your own TestPartResultReporter.\n  // You can register your own repoter to listen either only for test results\n  // from the current thread or for results from all threads.\n  // By default, each per-thread test result repoter just passes a new\n  // TestPartResult to the global test result reporter, which registers the\n  // test part result for the currently running test.\n\n  // Returns the global test part result reporter.\n  TestPartResultReporterInterface* GetGlobalTestPartResultReporter();\n\n  // Sets the global test part result reporter.\n  void SetGlobalTestPartResultReporter(\n      TestPartResultReporterInterface* reporter);\n\n  // Returns the test part result reporter for the current thread.\n  TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();\n\n  // Sets the test part result reporter for the current thread.\n  void SetTestPartResultReporterForCurrentThread(\n      TestPartResultReporterInterface* reporter);\n\n  // Gets the number of successful test cases.\n  int successful_test_case_count() const;\n\n  // Gets the number of failed test cases.\n  int failed_test_case_count() const;\n\n  // Gets the number of all test cases.\n  int total_test_case_count() const;\n\n  // Gets the number of all test cases that contain at least one test\n  // that should run.\n  int test_case_to_run_count() const;\n\n  // Gets the number of successful tests.\n  int successful_test_count() const;\n\n  // Gets the number of failed tests.\n  int failed_test_count() const;\n\n  // Gets the number of disabled tests that will be reported in the XML report.\n  int reportable_disabled_test_count() const;\n\n  // Gets the number of disabled tests.\n  int disabled_test_count() const;\n\n  // Gets the number of tests to be printed in the XML report.\n  int reportable_test_count() const;\n\n  // Gets the number of all tests.\n  int total_test_count() const;\n\n  // Gets the number of tests that should run.\n  int test_to_run_count() const;\n\n  // Gets the time of the test program start, in ms from the start of the\n  // UNIX epoch.\n  TimeInMillis start_timestamp() const { return start_timestamp_; }\n\n  // Gets the elapsed time, in milliseconds.\n  TimeInMillis elapsed_time() const { return elapsed_time_; }\n\n  // Returns true iff the unit test passed (i.e. all test cases passed).\n  bool Passed() const { return !Failed(); }\n\n  // Returns true iff the unit test failed (i.e. some test case failed\n  // or something outside of all tests failed).\n  bool Failed() const {\n    return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();\n  }\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  const TestCase* GetTestCase(int i) const {\n    const int index = GetElementOr(test_case_indices_, i, -1);\n    return index < 0 ? NULL : test_cases_[i];\n  }\n\n  // Gets the i-th test case among all the test cases. i can range from 0 to\n  // total_test_case_count() - 1. If i is not in that range, returns NULL.\n  TestCase* GetMutableTestCase(int i) {\n    const int index = GetElementOr(test_case_indices_, i, -1);\n    return index < 0 ? NULL : test_cases_[index];\n  }\n\n  // Provides access to the event listener list.\n  TestEventListeners* listeners() { return &listeners_; }\n\n  // Returns the TestResult for the test that's currently running, or\n  // the TestResult for the ad hoc test if no test is running.\n  TestResult* current_test_result();\n\n  // Returns the TestResult for the ad hoc test.\n  const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }\n\n  // Sets the OS stack trace getter.\n  //\n  // Does nothing if the input and the current OS stack trace getter\n  // are the same; otherwise, deletes the old getter and makes the\n  // input the current getter.\n  void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);\n\n  // Returns the current OS stack trace getter if it is not NULL;\n  // otherwise, creates an OsStackTraceGetter, makes it the current\n  // getter, and returns it.\n  OsStackTraceGetterInterface* os_stack_trace_getter();\n\n  // Returns the current OS stack trace as an std::string.\n  //\n  // The maximum number of stack frames to be included is specified by\n  // the gtest_stack_trace_depth flag.  The skip_count parameter\n  // specifies the number of top frames to be skipped, which doesn't\n  // count against the number of frames to be included.\n  //\n  // For example, if Foo() calls Bar(), which in turn calls\n  // CurrentOsStackTraceExceptTop(1), Foo() will be included in the\n  // trace but Bar() and CurrentOsStackTraceExceptTop() won't.\n  std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;\n\n  // Finds and returns a TestCase with the given name.  If one doesn't\n  // exist, creates one and returns it.\n  //\n  // Arguments:\n  //\n  //   test_case_name: name of the test case\n  //   type_param:     the name of the test's type parameter, or NULL if\n  //                   this is not a typed or a type-parameterized test.\n  //   set_up_tc:      pointer to the function that sets up the test case\n  //   tear_down_tc:   pointer to the function that tears down the test case\n  TestCase* GetTestCase(const char* test_case_name,\n                        const char* type_param,\n                        Test::SetUpTestCaseFunc set_up_tc,\n                        Test::TearDownTestCaseFunc tear_down_tc);\n\n  // Adds a TestInfo to the unit test.\n  //\n  // Arguments:\n  //\n  //   set_up_tc:    pointer to the function that sets up the test case\n  //   tear_down_tc: pointer to the function that tears down the test case\n  //   test_info:    the TestInfo object\n  void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,\n                   Test::TearDownTestCaseFunc tear_down_tc,\n                   TestInfo* test_info) {\n    // In order to support thread-safe death tests, we need to\n    // remember the original working directory when the test program\n    // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as\n    // the user may have changed the current directory before calling\n    // RUN_ALL_TESTS().  Therefore we capture the current directory in\n    // AddTestInfo(), which is called to register a TEST or TEST_F\n    // before main() is reached.\n    if (original_working_dir_.IsEmpty()) {\n      original_working_dir_.Set(FilePath::GetCurrentDir());\n      GTEST_CHECK_(!original_working_dir_.IsEmpty())\n          << \"Failed to get the current working directory.\";\n    }\n\n    GetTestCase(test_info->test_case_name(),\n                test_info->type_param(),\n                set_up_tc,\n                tear_down_tc)->AddTestInfo(test_info);\n  }\n\n#if GTEST_HAS_PARAM_TEST\n  // Returns ParameterizedTestCaseRegistry object used to keep track of\n  // value-parameterized tests and instantiate and register them.\n  internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {\n    return parameterized_test_registry_;\n  }\n#endif  // GTEST_HAS_PARAM_TEST\n\n  // Sets the TestCase object for the test that's currently running.\n  void set_current_test_case(TestCase* a_current_test_case) {\n    current_test_case_ = a_current_test_case;\n  }\n\n  // Sets the TestInfo object for the test that's currently running.  If\n  // current_test_info is NULL, the assertion results will be stored in\n  // ad_hoc_test_result_.\n  void set_current_test_info(TestInfo* a_current_test_info) {\n    current_test_info_ = a_current_test_info;\n  }\n\n  // Registers all parameterized tests defined using TEST_P and\n  // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter\n  // combination. This method can be called more then once; it has guards\n  // protecting from registering the tests more then once.  If\n  // value-parameterized tests are disabled, RegisterParameterizedTests is\n  // present but does nothing.\n  void RegisterParameterizedTests();\n\n  // Runs all tests in this UnitTest object, prints the result, and\n  // returns true if all tests are successful.  If any exception is\n  // thrown during a test, this test is considered to be failed, but\n  // the rest of the tests will still be run.\n  bool RunAllTests();\n\n  // Clears the results of all tests, except the ad hoc tests.\n  void ClearNonAdHocTestResult() {\n    ForEach(test_cases_, TestCase::ClearTestCaseResult);\n  }\n\n  // Clears the results of ad-hoc test assertions.\n  void ClearAdHocTestResult() {\n    ad_hoc_test_result_.Clear();\n  }\n\n  // Adds a TestProperty to the current TestResult object when invoked in a\n  // context of a test or a test case, or to the global property set. If the\n  // result already contains a property with the same key, the value will be\n  // updated.\n  void RecordProperty(const TestProperty& test_property);\n\n  enum ReactionToSharding {\n    HONOR_SHARDING_PROTOCOL,\n    IGNORE_SHARDING_PROTOCOL\n  };\n\n  // Matches the full name of each test against the user-specified\n  // filter to decide whether the test should run, then records the\n  // result in each TestCase and TestInfo object.\n  // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests\n  // based on sharding variables in the environment.\n  // Returns the number of tests that should run.\n  int FilterTests(ReactionToSharding shard_tests);\n\n  // Prints the names of the tests matching the user-specified filter flag.\n  void ListTestsMatchingFilter();\n\n  const TestCase* current_test_case() const { return current_test_case_; }\n  TestInfo* current_test_info() { return current_test_info_; }\n  const TestInfo* current_test_info() const { return current_test_info_; }\n\n  // Returns the vector of environments that need to be set-up/torn-down\n  // before/after the tests are run.\n  std::vector<Environment*>& environments() { return environments_; }\n\n  // Getters for the per-thread Google Test trace stack.\n  std::vector<TraceInfo>& gtest_trace_stack() {\n    return *(gtest_trace_stack_.pointer());\n  }\n  const std::vector<TraceInfo>& gtest_trace_stack() const {\n    return gtest_trace_stack_.get();\n  }\n\n#if GTEST_HAS_DEATH_TEST\n  void InitDeathTestSubprocessControlInfo() {\n    internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());\n  }\n  // Returns a pointer to the parsed --gtest_internal_run_death_test\n  // flag, or NULL if that flag was not specified.\n  // This information is useful only in a death test child process.\n  // Must not be called before a call to InitGoogleTest.\n  const InternalRunDeathTestFlag* internal_run_death_test_flag() const {\n    return internal_run_death_test_flag_.get();\n  }\n\n  // Returns a pointer to the current death test factory.\n  internal::DeathTestFactory* death_test_factory() {\n    return death_test_factory_.get();\n  }\n\n  void SuppressTestEventsIfInSubprocess();\n\n  friend class ReplaceDeathTestFactory;\n#endif  // GTEST_HAS_DEATH_TEST\n\n  // Initializes the event listener performing XML output as specified by\n  // UnitTestOptions. Must not be called before InitGoogleTest.\n  void ConfigureXmlOutput();\n\n#if GTEST_CAN_STREAM_RESULTS_\n  // Initializes the event listener for streaming test results to a socket.\n  // Must not be called before InitGoogleTest.\n  void ConfigureStreamingOutput();\n#endif\n\n  // Performs initialization dependent upon flag values obtained in\n  // ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to\n  // ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest\n  // this function is also called from RunAllTests.  Since this function can be\n  // called more than once, it has to be idempotent.\n  void PostFlagParsingInit();\n\n  // Gets the random seed used at the start of the current test iteration.\n  int random_seed() const { return random_seed_; }\n\n  // Gets the random number generator.\n  internal::Random* random() { return &random_; }\n\n  // Shuffles all test cases, and the tests within each test case,\n  // making sure that death tests are still run first.\n  void ShuffleTests();\n\n  // Restores the test cases and tests to their order before the first shuffle.\n  void UnshuffleTests();\n\n  // Returns the value of GTEST_FLAG(catch_exceptions) at the moment\n  // UnitTest::Run() starts.\n  bool catch_exceptions() const { return catch_exceptions_; }\n\n private:\n  friend class ::testing::UnitTest;\n\n  // Used by UnitTest::Run() to capture the state of\n  // GTEST_FLAG(catch_exceptions) at the moment it starts.\n  void set_catch_exceptions(bool value) { catch_exceptions_ = value; }\n\n  // The UnitTest object that owns this implementation object.\n  UnitTest* const parent_;\n\n  // The working directory when the first TEST() or TEST_F() was\n  // executed.\n  internal::FilePath original_working_dir_;\n\n  // The default test part result reporters.\n  DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;\n  DefaultPerThreadTestPartResultReporter\n      default_per_thread_test_part_result_reporter_;\n\n  // Points to (but doesn't own) the global test part result reporter.\n  TestPartResultReporterInterface* global_test_part_result_repoter_;\n\n  // Protects read and write access to global_test_part_result_reporter_.\n  internal::Mutex global_test_part_result_reporter_mutex_;\n\n  // Points to (but doesn't own) the per-thread test part result reporter.\n  internal::ThreadLocal<TestPartResultReporterInterface*>\n      per_thread_test_part_result_reporter_;\n\n  // The vector of environments that need to be set-up/torn-down\n  // before/after the tests are run.\n  std::vector<Environment*> environments_;\n\n  // The vector of TestCases in their original order.  It owns the\n  // elements in the vector.\n  std::vector<TestCase*> test_cases_;\n\n  // Provides a level of indirection for the test case list to allow\n  // easy shuffling and restoring the test case order.  The i-th\n  // element of this vector is the index of the i-th test case in the\n  // shuffled order.\n  std::vector<int> test_case_indices_;\n\n#if GTEST_HAS_PARAM_TEST\n  // ParameterizedTestRegistry object used to register value-parameterized\n  // tests.\n  internal::ParameterizedTestCaseRegistry parameterized_test_registry_;\n\n  // Indicates whether RegisterParameterizedTests() has been called already.\n  bool parameterized_tests_registered_;\n#endif  // GTEST_HAS_PARAM_TEST\n\n  // Index of the last death test case registered.  Initially -1.\n  int last_death_test_case_;\n\n  // This points to the TestCase for the currently running test.  It\n  // changes as Google Test goes through one test case after another.\n  // When no test is running, this is set to NULL and Google Test\n  // stores assertion results in ad_hoc_test_result_.  Initially NULL.\n  TestCase* current_test_case_;\n\n  // This points to the TestInfo for the currently running test.  It\n  // changes as Google Test goes through one test after another.  When\n  // no test is running, this is set to NULL and Google Test stores\n  // assertion results in ad_hoc_test_result_.  Initially NULL.\n  TestInfo* current_test_info_;\n\n  // Normally, a user only writes assertions inside a TEST or TEST_F,\n  // or inside a function called by a TEST or TEST_F.  Since Google\n  // Test keeps track of which test is current running, it can\n  // associate such an assertion with the test it belongs to.\n  //\n  // If an assertion is encountered when no TEST or TEST_F is running,\n  // Google Test attributes the assertion result to an imaginary \"ad hoc\"\n  // test, and records the result in ad_hoc_test_result_.\n  TestResult ad_hoc_test_result_;\n\n  // The list of event listeners that can be used to track events inside\n  // Google Test.\n  TestEventListeners listeners_;\n\n  // The OS stack trace getter.  Will be deleted when the UnitTest\n  // object is destructed.  By default, an OsStackTraceGetter is used,\n  // but the user can set this field to use a custom getter if that is\n  // desired.\n  OsStackTraceGetterInterface* os_stack_trace_getter_;\n\n  // True iff PostFlagParsingInit() has been called.\n  bool post_flag_parse_init_performed_;\n\n  // The random number seed used at the beginning of the test run.\n  int random_seed_;\n\n  // Our random number generator.\n  internal::Random random_;\n\n  // The time of the test program start, in ms from the start of the\n  // UNIX epoch.\n  TimeInMillis start_timestamp_;\n\n  // How long the test took to run, in milliseconds.\n  TimeInMillis elapsed_time_;\n\n#if GTEST_HAS_DEATH_TEST\n  // The decomposed components of the gtest_internal_run_death_test flag,\n  // parsed when RUN_ALL_TESTS is called.\n  internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;\n  internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;\n#endif  // GTEST_HAS_DEATH_TEST\n\n  // A per-thread stack of traces created by the SCOPED_TRACE() macro.\n  internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;\n\n  // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()\n  // starts.\n  bool catch_exceptions_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);\n};  // class UnitTestImpl\n\n// Convenience function for accessing the global UnitTest\n// implementation object.\ninline UnitTestImpl* GetUnitTestImpl() {\n  return UnitTest::GetInstance()->impl();\n}\n\n#if GTEST_USES_SIMPLE_RE\n\n// Internal helper functions for implementing the simple regular\n// expression matcher.\nGTEST_API_ bool IsInSet(char ch, const char* str);\nGTEST_API_ bool IsAsciiDigit(char ch);\nGTEST_API_ bool IsAsciiPunct(char ch);\nGTEST_API_ bool IsRepeat(char ch);\nGTEST_API_ bool IsAsciiWhiteSpace(char ch);\nGTEST_API_ bool IsAsciiWordChar(char ch);\nGTEST_API_ bool IsValidEscape(char ch);\nGTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);\nGTEST_API_ bool ValidateRegex(const char* regex);\nGTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);\nGTEST_API_ bool MatchRepetitionAndRegexAtHead(\n    bool escaped, char ch, char repeat, const char* regex, const char* str);\nGTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);\n\n#endif  // GTEST_USES_SIMPLE_RE\n\n// Parses the command line for Google Test flags, without initializing\n// other parts of Google Test.\nGTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);\nGTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);\n\n#if GTEST_HAS_DEATH_TEST\n\n// Returns the message describing the last system error, regardless of the\n// platform.\nGTEST_API_ std::string GetLastErrnoDescription();\n\n# if GTEST_OS_WINDOWS\n// Provides leak-safe Windows kernel handle ownership.\nclass AutoHandle {\n public:\n  AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}\n  explicit AutoHandle(HANDLE handle) : handle_(handle) {}\n\n  ~AutoHandle() { Reset(); }\n\n  HANDLE Get() const { return handle_; }\n  void Reset() { Reset(INVALID_HANDLE_VALUE); }\n  void Reset(HANDLE handle) {\n    if (handle != handle_) {\n      if (handle_ != INVALID_HANDLE_VALUE)\n        ::CloseHandle(handle_);\n      handle_ = handle;\n    }\n  }\n\n private:\n  HANDLE handle_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);\n};\n# endif  // GTEST_OS_WINDOWS\n\n// Attempts to parse a string into a positive integer pointed to by the\n// number parameter.  Returns true if that is possible.\n// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use\n// it here.\ntemplate <typename Integer>\nbool ParseNaturalNumber(const ::std::string& str, Integer* number) {\n  // Fail fast if the given string does not begin with a digit;\n  // this bypasses strtoXXX's \"optional leading whitespace and plus\n  // or minus sign\" semantics, which are undesirable here.\n  if (str.empty() || !IsDigit(str[0])) {\n    return false;\n  }\n  errno = 0;\n\n  char* end;\n  // BiggestConvertible is the largest integer type that system-provided\n  // string-to-number conversion routines can return.\n\n# if GTEST_OS_WINDOWS && !defined(__GNUC__)\n\n  // MSVC and C++ Builder define __int64 instead of the standard long long.\n  typedef unsigned __int64 BiggestConvertible;\n  const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);\n\n# else\n\n  typedef unsigned long long BiggestConvertible;  // NOLINT\n  const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);\n\n# endif  // GTEST_OS_WINDOWS && !defined(__GNUC__)\n\n  const bool parse_success = *end == '\\0' && errno == 0;\n\n  // TODO(vladl@google.com): Convert this to compile time assertion when it is\n  // available.\n  GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));\n\n  const Integer result = static_cast<Integer>(parsed);\n  if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {\n    *number = result;\n    return true;\n  }\n  return false;\n}\n#endif  // GTEST_HAS_DEATH_TEST\n\n// TestResult contains some private methods that should be hidden from\n// Google Test user but are required for testing. This class allow our tests\n// to access them.\n//\n// This class is supplied only for the purpose of testing Google Test's own\n// constructs. Do not use it in user tests, either directly or indirectly.\nclass TestResultAccessor {\n public:\n  static void RecordProperty(TestResult* test_result,\n                             const std::string& xml_element,\n                             const TestProperty& property) {\n    test_result->RecordProperty(xml_element, property);\n  }\n\n  static void ClearTestPartResults(TestResult* test_result) {\n    test_result->ClearTestPartResults();\n  }\n\n  static const std::vector<testing::TestPartResult>& test_part_results(\n      const TestResult& test_result) {\n    return test_result.test_part_results();\n  }\n};\n\n#if GTEST_CAN_STREAM_RESULTS_\n\n// Streams test results to the given port on the given host machine.\nclass StreamingListener : public EmptyTestEventListener {\n public:\n  // Abstract base class for writing strings to a socket.\n  class AbstractSocketWriter {\n   public:\n    virtual ~AbstractSocketWriter() {}\n\n    // Sends a string to the socket.\n    virtual void Send(const string& message) = 0;\n\n    // Closes the socket.\n    virtual void CloseConnection() {}\n\n    // Sends a string and a newline to the socket.\n    void SendLn(const string& message) {\n      Send(message + \"\\n\");\n    }\n  };\n\n  // Concrete class for actually writing strings to a socket.\n  class SocketWriter : public AbstractSocketWriter {\n   public:\n    SocketWriter(const string& host, const string& port)\n        : sockfd_(-1), host_name_(host), port_num_(port) {\n      MakeConnection();\n    }\n\n    virtual ~SocketWriter() {\n      if (sockfd_ != -1)\n        CloseConnection();\n    }\n\n    // Sends a string to the socket.\n    virtual void Send(const string& message) {\n      GTEST_CHECK_(sockfd_ != -1)\n          << \"Send() can be called only when there is a connection.\";\n\n      const int len = static_cast<int>(message.length());\n      if (write(sockfd_, message.c_str(), len) != len) {\n        GTEST_LOG_(WARNING)\n            << \"stream_result_to: failed to stream to \"\n            << host_name_ << \":\" << port_num_;\n      }\n    }\n\n   private:\n    // Creates a client socket and connects to the server.\n    void MakeConnection();\n\n    // Closes the socket.\n    void CloseConnection() {\n      GTEST_CHECK_(sockfd_ != -1)\n          << \"CloseConnection() can be called only when there is a connection.\";\n\n      close(sockfd_);\n      sockfd_ = -1;\n    }\n\n    int sockfd_;  // socket file descriptor\n    const string host_name_;\n    const string port_num_;\n\n    GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);\n  };  // class SocketWriter\n\n  // Escapes '=', '&', '%', and '\\n' characters in str as \"%xx\".\n  static string UrlEncode(const char* str);\n\n  StreamingListener(const string& host, const string& port)\n      : socket_writer_(new SocketWriter(host, port)) { Start(); }\n\n  explicit StreamingListener(AbstractSocketWriter* socket_writer)\n      : socket_writer_(socket_writer) { Start(); }\n\n  void OnTestProgramStart(const UnitTest& /* unit_test */) {\n    SendLn(\"event=TestProgramStart\");\n  }\n\n  void OnTestProgramEnd(const UnitTest& unit_test) {\n    // Note that Google Test current only report elapsed time for each\n    // test iteration, not for the entire test program.\n    SendLn(\"event=TestProgramEnd&passed=\" + FormatBool(unit_test.Passed()));\n\n    // Notify the streaming server to stop.\n    socket_writer_->CloseConnection();\n  }\n\n  void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {\n    SendLn(\"event=TestIterationStart&iteration=\" +\n           StreamableToString(iteration));\n  }\n\n  void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {\n    SendLn(\"event=TestIterationEnd&passed=\" +\n           FormatBool(unit_test.Passed()) + \"&elapsed_time=\" +\n           StreamableToString(unit_test.elapsed_time()) + \"ms\");\n  }\n\n  void OnTestCaseStart(const TestCase& test_case) {\n    SendLn(std::string(\"event=TestCaseStart&name=\") + test_case.name());\n  }\n\n  void OnTestCaseEnd(const TestCase& test_case) {\n    SendLn(\"event=TestCaseEnd&passed=\" + FormatBool(test_case.Passed())\n           + \"&elapsed_time=\" + StreamableToString(test_case.elapsed_time())\n           + \"ms\");\n  }\n\n  void OnTestStart(const TestInfo& test_info) {\n    SendLn(std::string(\"event=TestStart&name=\") + test_info.name());\n  }\n\n  void OnTestEnd(const TestInfo& test_info) {\n    SendLn(\"event=TestEnd&passed=\" +\n           FormatBool((test_info.result())->Passed()) +\n           \"&elapsed_time=\" +\n           StreamableToString((test_info.result())->elapsed_time()) + \"ms\");\n  }\n\n  void OnTestPartResult(const TestPartResult& test_part_result) {\n    const char* file_name = test_part_result.file_name();\n    if (file_name == NULL)\n      file_name = \"\";\n    SendLn(\"event=TestPartResult&file=\" + UrlEncode(file_name) +\n           \"&line=\" + StreamableToString(test_part_result.line_number()) +\n           \"&message=\" + UrlEncode(test_part_result.message()));\n  }\n\n private:\n  // Sends the given message and a newline to the socket.\n  void SendLn(const string& message) { socket_writer_->SendLn(message); }\n\n  // Called at the start of streaming to notify the receiver what\n  // protocol we are using.\n  void Start() { SendLn(\"gtest_streaming_protocol_version=1.0\"); }\n\n  string FormatBool(bool value) { return value ? \"1\" : \"0\"; }\n\n  const scoped_ptr<AbstractSocketWriter> socket_writer_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);\n};  // class StreamingListener\n\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\n}  // namespace internal\n}  // namespace testing\n\n#endif  // GTEST_SRC_GTEST_INTERNAL_INL_H_\n"
  },
  {
    "path": "Tests/gtest/src/gtest-port.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/internal/gtest-port.h\"\n\n#include <limits.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#if GTEST_OS_WINDOWS_MOBILE\n# include <windows.h>  // For TerminateProcess()\n#elif GTEST_OS_WINDOWS\n# include <io.h>\n# include <sys/stat.h>\n#else\n# include <unistd.h>\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n#if GTEST_OS_MAC\n# include <mach/mach_init.h>\n# include <mach/task.h>\n# include <mach/vm_map.h>\n#endif  // GTEST_OS_MAC\n\n#if GTEST_OS_QNX\n# include <devctl.h>\n# include <sys/procfs.h>\n#endif  // GTEST_OS_QNX\n\n#include \"gtest/gtest-spi.h\"\n#include \"gtest/gtest-message.h\"\n#include \"gtest/internal/gtest-internal.h\"\n#include \"gtest/internal/gtest-string.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\nnamespace internal {\n\n#if defined(_MSC_VER) || defined(__BORLANDC__)\n// MSVC and C++Builder do not provide a definition of STDERR_FILENO.\nconst int kStdOutFileno = 1;\nconst int kStdErrFileno = 2;\n#else\nconst int kStdOutFileno = STDOUT_FILENO;\nconst int kStdErrFileno = STDERR_FILENO;\n#endif  // _MSC_VER\n\n#if GTEST_OS_MAC\n\n// Returns the number of threads running in the process, or 0 to indicate that\n// we cannot detect it.\nsize_t GetThreadCount() {\n  const task_t task = mach_task_self();\n  mach_msg_type_number_t thread_count;\n  thread_act_array_t thread_list;\n  const kern_return_t status = task_threads(task, &thread_list, &thread_count);\n  if (status == KERN_SUCCESS) {\n    // task_threads allocates resources in thread_list and we need to free them\n    // to avoid leaks.\n    vm_deallocate(task,\n                  reinterpret_cast<vm_address_t>(thread_list),\n                  sizeof(thread_t) * thread_count);\n    return static_cast<size_t>(thread_count);\n  } else {\n    return 0;\n  }\n}\n\n#elif GTEST_OS_QNX\n\n// Returns the number of threads running in the process, or 0 to indicate that\n// we cannot detect it.\nsize_t GetThreadCount() {\n  const int fd = open(\"/proc/self/as\", O_RDONLY);\n  if (fd < 0) {\n    return 0;\n  }\n  procfs_info process_info;\n  const int status =\n      devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);\n  close(fd);\n  if (status == EOK) {\n    return static_cast<size_t>(process_info.num_threads);\n  } else {\n    return 0;\n  }\n}\n\n#else\n\nsize_t GetThreadCount() {\n  // There's no portable way to detect the number of threads, so we just\n  // return 0 to indicate that we cannot detect it.\n  return 0;\n}\n\n#endif  // GTEST_OS_MAC\n\n#if GTEST_USES_POSIX_RE\n\n// Implements RE.  Currently only needed for death tests.\n\nRE::~RE() {\n  if (is_valid_) {\n    // regfree'ing an invalid regex might crash because the content\n    // of the regex is undefined. Since the regex's are essentially\n    // the same, one cannot be valid (or invalid) without the other\n    // being so too.\n    regfree(&partial_regex_);\n    regfree(&full_regex_);\n  }\n  free(const_cast<char*>(pattern_));\n}\n\n// Returns true iff regular expression re matches the entire str.\nbool RE::FullMatch(const char* str, const RE& re) {\n  if (!re.is_valid_) return false;\n\n  regmatch_t match;\n  return regexec(&re.full_regex_, str, 1, &match, 0) == 0;\n}\n\n// Returns true iff regular expression re matches a substring of str\n// (including str itself).\nbool RE::PartialMatch(const char* str, const RE& re) {\n  if (!re.is_valid_) return false;\n\n  regmatch_t match;\n  return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;\n}\n\n// Initializes an RE from its string representation.\nvoid RE::Init(const char* regex) {\n  pattern_ = posix::StrDup(regex);\n\n  // Reserves enough bytes to hold the regular expression used for a\n  // full match.\n  const size_t full_regex_len = strlen(regex) + 10;\n  char* const full_pattern = new char[full_regex_len];\n\n  snprintf(full_pattern, full_regex_len, \"^(%s)$\", regex);\n  is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;\n  // We want to call regcomp(&partial_regex_, ...) even if the\n  // previous expression returns false.  Otherwise partial_regex_ may\n  // not be properly initialized can may cause trouble when it's\n  // freed.\n  //\n  // Some implementation of POSIX regex (e.g. on at least some\n  // versions of Cygwin) doesn't accept the empty string as a valid\n  // regex.  We change it to an equivalent form \"()\" to be safe.\n  if (is_valid_) {\n    const char* const partial_regex = (*regex == '\\0') ? \"()\" : regex;\n    is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0;\n  }\n  EXPECT_TRUE(is_valid_)\n      << \"Regular expression \\\"\" << regex\n      << \"\\\" is not a valid POSIX Extended regular expression.\";\n\n  delete[] full_pattern;\n}\n\n#elif GTEST_USES_SIMPLE_RE\n\n// Returns true iff ch appears anywhere in str (excluding the\n// terminating '\\0' character).\nbool IsInSet(char ch, const char* str) {\n  return ch != '\\0' && strchr(str, ch) != NULL;\n}\n\n// Returns true iff ch belongs to the given classification.  Unlike\n// similar functions in <ctype.h>, these aren't affected by the\n// current locale.\nbool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }\nbool IsAsciiPunct(char ch) {\n  return IsInSet(ch, \"^-!\\\"#$%&'()*+,./:;<=>?@[\\\\]_`{|}~\");\n}\nbool IsRepeat(char ch) { return IsInSet(ch, \"?*+\"); }\nbool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, \" \\f\\n\\r\\t\\v\"); }\nbool IsAsciiWordChar(char ch) {\n  return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||\n      ('0' <= ch && ch <= '9') || ch == '_';\n}\n\n// Returns true iff \"\\\\c\" is a supported escape sequence.\nbool IsValidEscape(char c) {\n  return (IsAsciiPunct(c) || IsInSet(c, \"dDfnrsStvwW\"));\n}\n\n// Returns true iff the given atom (specified by escaped and pattern)\n// matches ch.  The result is undefined if the atom is invalid.\nbool AtomMatchesChar(bool escaped, char pattern_char, char ch) {\n  if (escaped) {  // \"\\\\p\" where p is pattern_char.\n    switch (pattern_char) {\n      case 'd': return IsAsciiDigit(ch);\n      case 'D': return !IsAsciiDigit(ch);\n      case 'f': return ch == '\\f';\n      case 'n': return ch == '\\n';\n      case 'r': return ch == '\\r';\n      case 's': return IsAsciiWhiteSpace(ch);\n      case 'S': return !IsAsciiWhiteSpace(ch);\n      case 't': return ch == '\\t';\n      case 'v': return ch == '\\v';\n      case 'w': return IsAsciiWordChar(ch);\n      case 'W': return !IsAsciiWordChar(ch);\n    }\n    return IsAsciiPunct(pattern_char) && pattern_char == ch;\n  }\n\n  return (pattern_char == '.' && ch != '\\n') || pattern_char == ch;\n}\n\n// Helper function used by ValidateRegex() to format error messages.\nstd::string FormatRegexSyntaxError(const char* regex, int index) {\n  return (Message() << \"Syntax error at index \" << index\n          << \" in simple regular expression \\\"\" << regex << \"\\\": \").GetString();\n}\n\n// Generates non-fatal failures and returns false if regex is invalid;\n// otherwise returns true.\nbool ValidateRegex(const char* regex) {\n  if (regex == NULL) {\n    // TODO(wan@google.com): fix the source file location in the\n    // assertion failures to match where the regex is used in user\n    // code.\n    ADD_FAILURE() << \"NULL is not a valid simple regular expression.\";\n    return false;\n  }\n\n  bool is_valid = true;\n\n  // True iff ?, *, or + can follow the previous atom.\n  bool prev_repeatable = false;\n  for (int i = 0; regex[i]; i++) {\n    if (regex[i] == '\\\\') {  // An escape sequence\n      i++;\n      if (regex[i] == '\\0') {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)\n                      << \"'\\\\' cannot appear at the end.\";\n        return false;\n      }\n\n      if (!IsValidEscape(regex[i])) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)\n                      << \"invalid escape sequence \\\"\\\\\" << regex[i] << \"\\\".\";\n        is_valid = false;\n      }\n      prev_repeatable = true;\n    } else {  // Not an escape sequence.\n      const char ch = regex[i];\n\n      if (ch == '^' && i > 0) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'^' can only appear at the beginning.\";\n        is_valid = false;\n      } else if (ch == '$' && regex[i + 1] != '\\0') {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'$' can only appear at the end.\";\n        is_valid = false;\n      } else if (IsInSet(ch, \"()[]{}|\")) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'\" << ch << \"' is unsupported.\";\n        is_valid = false;\n      } else if (IsRepeat(ch) && !prev_repeatable) {\n        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)\n                      << \"'\" << ch << \"' can only follow a repeatable token.\";\n        is_valid = false;\n      }\n\n      prev_repeatable = !IsInSet(ch, \"^$?*+\");\n    }\n  }\n\n  return is_valid;\n}\n\n// Matches a repeated regex atom followed by a valid simple regular\n// expression.  The regex atom is defined as c if escaped is false,\n// or \\c otherwise.  repeat is the repetition meta character (?, *,\n// or +).  The behavior is undefined if str contains too many\n// characters to be indexable by size_t, in which case the test will\n// probably time out anyway.  We are fine with this limitation as\n// std::string has it too.\nbool MatchRepetitionAndRegexAtHead(\n    bool escaped, char c, char repeat, const char* regex,\n    const char* str) {\n  const size_t min_count = (repeat == '+') ? 1 : 0;\n  const size_t max_count = (repeat == '?') ? 1 :\n      static_cast<size_t>(-1) - 1;\n  // We cannot call numeric_limits::max() as it conflicts with the\n  // max() macro on Windows.\n\n  for (size_t i = 0; i <= max_count; ++i) {\n    // We know that the atom matches each of the first i characters in str.\n    if (i >= min_count && MatchRegexAtHead(regex, str + i)) {\n      // We have enough matches at the head, and the tail matches too.\n      // Since we only care about *whether* the pattern matches str\n      // (as opposed to *how* it matches), there is no need to find a\n      // greedy match.\n      return true;\n    }\n    if (str[i] == '\\0' || !AtomMatchesChar(escaped, c, str[i]))\n      return false;\n  }\n  return false;\n}\n\n// Returns true iff regex matches a prefix of str.  regex must be a\n// valid simple regular expression and not start with \"^\", or the\n// result is undefined.\nbool MatchRegexAtHead(const char* regex, const char* str) {\n  if (*regex == '\\0')  // An empty regex matches a prefix of anything.\n    return true;\n\n  // \"$\" only matches the end of a string.  Note that regex being\n  // valid guarantees that there's nothing after \"$\" in it.\n  if (*regex == '$')\n    return *str == '\\0';\n\n  // Is the first thing in regex an escape sequence?\n  const bool escaped = *regex == '\\\\';\n  if (escaped)\n    ++regex;\n  if (IsRepeat(regex[1])) {\n    // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so\n    // here's an indirect recursion.  It terminates as the regex gets\n    // shorter in each recursion.\n    return MatchRepetitionAndRegexAtHead(\n        escaped, regex[0], regex[1], regex + 2, str);\n  } else {\n    // regex isn't empty, isn't \"$\", and doesn't start with a\n    // repetition.  We match the first atom of regex with the first\n    // character of str and recurse.\n    return (*str != '\\0') && AtomMatchesChar(escaped, *regex, *str) &&\n        MatchRegexAtHead(regex + 1, str + 1);\n  }\n}\n\n// Returns true iff regex matches any substring of str.  regex must be\n// a valid simple regular expression, or the result is undefined.\n//\n// The algorithm is recursive, but the recursion depth doesn't exceed\n// the regex length, so we won't need to worry about running out of\n// stack space normally.  In rare cases the time complexity can be\n// exponential with respect to the regex length + the string length,\n// but usually it's must faster (often close to linear).\nbool MatchRegexAnywhere(const char* regex, const char* str) {\n  if (regex == NULL || str == NULL)\n    return false;\n\n  if (*regex == '^')\n    return MatchRegexAtHead(regex + 1, str);\n\n  // A successful match can be anywhere in str.\n  do {\n    if (MatchRegexAtHead(regex, str))\n      return true;\n  } while (*str++ != '\\0');\n  return false;\n}\n\n// Implements the RE class.\n\nRE::~RE() {\n  free(const_cast<char*>(pattern_));\n  free(const_cast<char*>(full_pattern_));\n}\n\n// Returns true iff regular expression re matches the entire str.\nbool RE::FullMatch(const char* str, const RE& re) {\n  return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);\n}\n\n// Returns true iff regular expression re matches a substring of str\n// (including str itself).\nbool RE::PartialMatch(const char* str, const RE& re) {\n  return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);\n}\n\n// Initializes an RE from its string representation.\nvoid RE::Init(const char* regex) {\n  pattern_ = full_pattern_ = NULL;\n  if (regex != NULL) {\n    pattern_ = posix::StrDup(regex);\n  }\n\n  is_valid_ = ValidateRegex(regex);\n  if (!is_valid_) {\n    // No need to calculate the full pattern when the regex is invalid.\n    return;\n  }\n\n  const size_t len = strlen(regex);\n  // Reserves enough bytes to hold the regular expression used for a\n  // full match: we need space to prepend a '^', append a '$', and\n  // terminate the string with '\\0'.\n  char* buffer = static_cast<char*>(malloc(len + 3));\n  full_pattern_ = buffer;\n\n  if (*regex != '^')\n    *buffer++ = '^';  // Makes sure full_pattern_ starts with '^'.\n\n  // We don't use snprintf or strncpy, as they trigger a warning when\n  // compiled with VC++ 8.0.\n  memcpy(buffer, regex, len);\n  buffer += len;\n\n  if (len == 0 || regex[len - 1] != '$')\n    *buffer++ = '$';  // Makes sure full_pattern_ ends with '$'.\n\n  *buffer = '\\0';\n}\n\n#endif  // GTEST_USES_POSIX_RE\n\nconst char kUnknownFile[] = \"unknown file\";\n\n// Formats a source file path and a line number as they would appear\n// in an error message from the compiler used to compile this code.\nGTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {\n  const std::string file_name(file == NULL ? kUnknownFile : file);\n\n  if (line < 0) {\n    return file_name + \":\";\n  }\n#ifdef _MSC_VER\n  return file_name + \"(\" + StreamableToString(line) + \"):\";\n#else\n  return file_name + \":\" + StreamableToString(line) + \":\";\n#endif  // _MSC_VER\n}\n\n// Formats a file location for compiler-independent XML output.\n// Although this function is not platform dependent, we put it next to\n// FormatFileLocation in order to contrast the two functions.\n// Note that FormatCompilerIndependentFileLocation() does NOT append colon\n// to the file location it produces, unlike FormatFileLocation().\nGTEST_API_ ::std::string FormatCompilerIndependentFileLocation(\n    const char* file, int line) {\n  const std::string file_name(file == NULL ? kUnknownFile : file);\n\n  if (line < 0)\n    return file_name;\n  else\n    return file_name + \":\" + StreamableToString(line);\n}\n\n\nGTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)\n    : severity_(severity) {\n  const char* const marker =\n      severity == GTEST_INFO ?    \"[  INFO ]\" :\n      severity == GTEST_WARNING ? \"[WARNING]\" :\n      severity == GTEST_ERROR ?   \"[ ERROR ]\" : \"[ FATAL ]\";\n  GetStream() << ::std::endl << marker << \" \"\n              << FormatFileLocation(file, line).c_str() << \": \";\n}\n\n// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.\nGTestLog::~GTestLog() {\n  GetStream() << ::std::endl;\n  if (severity_ == GTEST_FATAL) {\n    fflush(stderr);\n    posix::Abort();\n  }\n}\n// Disable Microsoft deprecation warnings for POSIX functions called from\n// this class (creat, dup, dup2, and close)\n#ifdef _MSC_VER\n# pragma warning(push)\n# pragma warning(disable: 4996)\n#endif  // _MSC_VER\n\n#if GTEST_HAS_STREAM_REDIRECTION\n\n// Object that captures an output stream (stdout/stderr).\nclass CapturedStream {\n public:\n  // The ctor redirects the stream to a temporary file.\n  explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {\n# if GTEST_OS_WINDOWS\n    char temp_dir_path[MAX_PATH + 1] = { '\\0' };  // NOLINT\n    char temp_file_path[MAX_PATH + 1] = { '\\0' };  // NOLINT\n\n    ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);\n    const UINT success = ::GetTempFileNameA(temp_dir_path,\n                                            \"gtest_redir\",\n                                            0,  // Generate unique file name.\n                                            temp_file_path);\n    GTEST_CHECK_(success != 0)\n        << \"Unable to create a temporary file in \" << temp_dir_path;\n    const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);\n    GTEST_CHECK_(captured_fd != -1) << \"Unable to open temporary file \"\n                                    << temp_file_path;\n    filename_ = temp_file_path;\n# else\n    // There's no guarantee that a test has write access to the current\n    // directory, so we create the temporary file in the /tmp directory\n    // instead. We use /tmp on most systems, and /sdcard on Android.\n    // That's because Android doesn't have /tmp.\n#  if GTEST_OS_LINUX_ANDROID\n    // Note: Android applications are expected to call the framework's\n    // Context.getExternalStorageDirectory() method through JNI to get\n    // the location of the world-writable SD Card directory. However,\n    // this requires a Context handle, which cannot be retrieved\n    // globally from native code. Doing so also precludes running the\n    // code as part of a regular standalone executable, which doesn't\n    // run in a Dalvik process (e.g. when running it through 'adb shell').\n    //\n    // The location /sdcard is directly accessible from native code\n    // and is the only location (unofficially) supported by the Android\n    // team. It's generally a symlink to the real SD Card mount point\n    // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or\n    // other OEM-customized locations. Never rely on these, and always\n    // use /sdcard.\n    char name_template[] = \"/sdcard/gtest_captured_stream.XXXXXX\";\n#  else\n    char name_template[] = \"/tmp/captured_stream.XXXXXX\";\n#  endif  // GTEST_OS_LINUX_ANDROID\n    const int captured_fd = mkstemp(name_template);\n    filename_ = name_template;\n# endif  // GTEST_OS_WINDOWS\n    fflush(NULL);\n    dup2(captured_fd, fd_);\n    close(captured_fd);\n  }\n\n  ~CapturedStream() {\n    remove(filename_.c_str());\n  }\n\n  std::string GetCapturedString() {\n    if (uncaptured_fd_ != -1) {\n      // Restores the original stream.\n      fflush(NULL);\n      dup2(uncaptured_fd_, fd_);\n      close(uncaptured_fd_);\n      uncaptured_fd_ = -1;\n    }\n\n    FILE* const file = posix::FOpen(filename_.c_str(), \"r\");\n    const std::string content = ReadEntireFile(file);\n    posix::FClose(file);\n    return content;\n  }\n\n private:\n  // Reads the entire content of a file as an std::string.\n  static std::string ReadEntireFile(FILE* file);\n\n  // Returns the size (in bytes) of a file.\n  static size_t GetFileSize(FILE* file);\n\n  const int fd_;  // A stream to capture.\n  int uncaptured_fd_;\n  // Name of the temporary file holding the stderr output.\n  ::std::string filename_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);\n};\n\n// Returns the size (in bytes) of a file.\nsize_t CapturedStream::GetFileSize(FILE* file) {\n  fseek(file, 0, SEEK_END);\n  return static_cast<size_t>(ftell(file));\n}\n\n// Reads the entire content of a file as a string.\nstd::string CapturedStream::ReadEntireFile(FILE* file) {\n  const size_t file_size = GetFileSize(file);\n  char* const buffer = new char[file_size];\n\n  size_t bytes_last_read = 0;  // # of bytes read in the last fread()\n  size_t bytes_read = 0;       // # of bytes read so far\n\n  fseek(file, 0, SEEK_SET);\n\n  // Keeps reading the file until we cannot read further or the\n  // pre-determined file size is reached.\n  do {\n    bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);\n    bytes_read += bytes_last_read;\n  } while (bytes_last_read > 0 && bytes_read < file_size);\n\n  const std::string content(buffer, bytes_read);\n  delete[] buffer;\n\n  return content;\n}\n\n# ifdef _MSC_VER\n#  pragma warning(pop)\n# endif  // _MSC_VER\n\nstatic CapturedStream* g_captured_stderr = NULL;\nstatic CapturedStream* g_captured_stdout = NULL;\n\n// Starts capturing an output stream (stdout/stderr).\nvoid CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {\n  if (*stream != NULL) {\n    GTEST_LOG_(FATAL) << \"Only one \" << stream_name\n                      << \" capturer can exist at a time.\";\n  }\n  *stream = new CapturedStream(fd);\n}\n\n// Stops capturing the output stream and returns the captured string.\nstd::string GetCapturedStream(CapturedStream** captured_stream) {\n  const std::string content = (*captured_stream)->GetCapturedString();\n\n  delete *captured_stream;\n  *captured_stream = NULL;\n\n  return content;\n}\n\n// Starts capturing stdout.\nvoid CaptureStdout() {\n  CaptureStream(kStdOutFileno, \"stdout\", &g_captured_stdout);\n}\n\n// Starts capturing stderr.\nvoid CaptureStderr() {\n  CaptureStream(kStdErrFileno, \"stderr\", &g_captured_stderr);\n}\n\n// Stops capturing stdout and returns the captured string.\nstd::string GetCapturedStdout() {\n  return GetCapturedStream(&g_captured_stdout);\n}\n\n// Stops capturing stderr and returns the captured string.\nstd::string GetCapturedStderr() {\n  return GetCapturedStream(&g_captured_stderr);\n}\n\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n#if GTEST_HAS_DEATH_TEST\n\n// A copy of all command line arguments.  Set by InitGoogleTest().\n::std::vector<testing::internal::string> g_argvs;\n\nstatic const ::std::vector<testing::internal::string>* g_injected_test_argvs =\n                                        NULL;  // Owned.\n\nvoid SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {\n  if (g_injected_test_argvs != argvs)\n    delete g_injected_test_argvs;\n  g_injected_test_argvs = argvs;\n}\n\nconst ::std::vector<testing::internal::string>& GetInjectableArgvs() {\n  if (g_injected_test_argvs != NULL) {\n    return *g_injected_test_argvs;\n  }\n  return g_argvs;\n}\n#endif  // GTEST_HAS_DEATH_TEST\n\n#if GTEST_OS_WINDOWS_MOBILE\nnamespace posix {\nvoid Abort() {\n  DebugBreak();\n  TerminateProcess(GetCurrentProcess(), 1);\n}\n}  // namespace posix\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n// Returns the name of the environment variable corresponding to the\n// given flag.  For example, FlagToEnvVar(\"foo\") will return\n// \"GTEST_FOO\" in the open-source version.\nstatic std::string FlagToEnvVar(const char* flag) {\n  const std::string full_flag =\n      (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();\n\n  Message env_var;\n  for (size_t i = 0; i != full_flag.length(); i++) {\n    env_var << ToUpper(full_flag.c_str()[i]);\n  }\n\n  return env_var.GetString();\n}\n\n// Parses 'str' for a 32-bit signed integer.  If successful, writes\n// the result to *value and returns true; otherwise leaves *value\n// unchanged and returns false.\nbool ParseInt32(const Message& src_text, const char* str, Int32* value) {\n  // Parses the environment variable as a decimal integer.\n  char* end = NULL;\n  const long long_value = strtol(str, &end, 10);  // NOLINT\n\n  // Has strtol() consumed all characters in the string?\n  if (*end != '\\0') {\n    // No - an invalid character was encountered.\n    Message msg;\n    msg << \"WARNING: \" << src_text\n        << \" is expected to be a 32-bit integer, but actually\"\n        << \" has value \\\"\" << str << \"\\\".\\n\";\n    printf(\"%s\", msg.GetString().c_str());\n    fflush(stdout);\n    return false;\n  }\n\n  // Is the parsed value in the range of an Int32?\n  const Int32 result = static_cast<Int32>(long_value);\n  if (long_value == LONG_MAX || long_value == LONG_MIN ||\n      // The parsed value overflows as a long.  (strtol() returns\n      // LONG_MAX or LONG_MIN when the input overflows.)\n      result != long_value\n      // The parsed value overflows as an Int32.\n      ) {\n    Message msg;\n    msg << \"WARNING: \" << src_text\n        << \" is expected to be a 32-bit integer, but actually\"\n        << \" has value \" << str << \", which overflows.\\n\";\n    printf(\"%s\", msg.GetString().c_str());\n    fflush(stdout);\n    return false;\n  }\n\n  *value = result;\n  return true;\n}\n\n// Reads and returns the Boolean environment variable corresponding to\n// the given flag; if it's not set, returns default_value.\n//\n// The value is considered true iff it's not \"0\".\nbool BoolFromGTestEnv(const char* flag, bool default_value) {\n  const std::string env_var = FlagToEnvVar(flag);\n  const char* const string_value = posix::GetEnv(env_var.c_str());\n  return string_value == NULL ?\n      default_value : strcmp(string_value, \"0\") != 0;\n}\n\n// Reads and returns a 32-bit integer stored in the environment\n// variable corresponding to the given flag; if it isn't set or\n// doesn't represent a valid 32-bit integer, returns default_value.\nInt32 Int32FromGTestEnv(const char* flag, Int32 default_value) {\n  const std::string env_var = FlagToEnvVar(flag);\n  const char* const string_value = posix::GetEnv(env_var.c_str());\n  if (string_value == NULL) {\n    // The environment variable is not set.\n    return default_value;\n  }\n\n  Int32 result = default_value;\n  if (!ParseInt32(Message() << \"Environment variable \" << env_var,\n                  string_value, &result)) {\n    printf(\"The default value %s is used.\\n\",\n           (Message() << default_value).GetString().c_str());\n    fflush(stdout);\n    return default_value;\n  }\n\n  return result;\n}\n\n// Reads and returns the string environment variable corresponding to\n// the given flag; if it's not set, returns default_value.\nconst char* StringFromGTestEnv(const char* flag, const char* default_value) {\n  const std::string env_var = FlagToEnvVar(flag);\n  const char* const value = posix::GetEnv(env_var.c_str());\n  return value == NULL ? default_value : value;\n}\n\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest-printers.cc",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Google Test - The Google C++ Testing Framework\n//\n// This file implements a universal value printer that can print a\n// value of any type T:\n//\n//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);\n//\n// It uses the << operator when possible, and prints the bytes in the\n// object otherwise.  A user can override its behavior for a class\n// type Foo by defining either operator<<(::std::ostream&, const Foo&)\n// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that\n// defines Foo.\n\n#include \"gtest/gtest-printers.h\"\n#include <ctype.h>\n#include <stdio.h>\n#include <ostream>  // NOLINT\n#include <string>\n#include \"gtest/internal/gtest-port.h\"\n\nnamespace testing {\n\nnamespace {\n\nusing ::std::ostream;\n\n// Prints a segment of bytes in the given object.\nvoid PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,\n                                size_t count, ostream* os) {\n  char text[5] = \"\";\n  for (size_t i = 0; i != count; i++) {\n    const size_t j = start + i;\n    if (i != 0) {\n      // Organizes the bytes into groups of 2 for easy parsing by\n      // human.\n      if ((j % 2) == 0)\n        *os << ' ';\n      else\n        *os << '-';\n    }\n    GTEST_SNPRINTF_(text, sizeof(text), \"%02X\", obj_bytes[j]);\n    *os << text;\n  }\n}\n\n// Prints the bytes in the given value to the given ostream.\nvoid PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,\n                              ostream* os) {\n  // Tells the user how big the object is.\n  *os << count << \"-byte object <\";\n\n  const size_t kThreshold = 132;\n  const size_t kChunkSize = 64;\n  // If the object size is bigger than kThreshold, we'll have to omit\n  // some details by printing only the first and the last kChunkSize\n  // bytes.\n  // TODO(wan): let the user control the threshold using a flag.\n  if (count < kThreshold) {\n    PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);\n  } else {\n    PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);\n    *os << \" ... \";\n    // Rounds up to 2-byte boundary.\n    const size_t resume_pos = (count - kChunkSize + 1)/2*2;\n    PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);\n  }\n  *os << \">\";\n}\n\n}  // namespace\n\nnamespace internal2 {\n\n// Delegates to PrintBytesInObjectToImpl() to print the bytes in the\n// given object.  The delegation simplifies the implementation, which\n// uses the << operator and thus is easier done outside of the\n// ::testing::internal namespace, which contains a << operator that\n// sometimes conflicts with the one in STL.\nvoid PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,\n                          ostream* os) {\n  PrintBytesInObjectToImpl(obj_bytes, count, os);\n}\n\n}  // namespace internal2\n\nnamespace internal {\n\n// Depending on the value of a char (or wchar_t), we print it in one\n// of three formats:\n//   - as is if it's a printable ASCII (e.g. 'a', '2', ' '),\n//   - as a hexidecimal escape sequence (e.g. '\\x7F'), or\n//   - as a special escape sequence (e.g. '\\r', '\\n').\nenum CharFormat {\n  kAsIs,\n  kHexEscape,\n  kSpecialEscape\n};\n\n// Returns true if c is a printable ASCII character.  We test the\n// value of c directly instead of calling isprint(), which is buggy on\n// Windows Mobile.\ninline bool IsPrintableAscii(wchar_t c) {\n  return 0x20 <= c && c <= 0x7E;\n}\n\n// Prints a wide or narrow char c as a character literal without the\n// quotes, escaping it when necessary; returns how c was formatted.\n// The template argument UnsignedChar is the unsigned version of Char,\n// which is the type of c.\ntemplate <typename UnsignedChar, typename Char>\nstatic CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {\n  switch (static_cast<wchar_t>(c)) {\n    case L'\\0':\n      *os << \"\\\\0\";\n      break;\n    case L'\\'':\n      *os << \"\\\\'\";\n      break;\n    case L'\\\\':\n      *os << \"\\\\\\\\\";\n      break;\n    case L'\\a':\n      *os << \"\\\\a\";\n      break;\n    case L'\\b':\n      *os << \"\\\\b\";\n      break;\n    case L'\\f':\n      *os << \"\\\\f\";\n      break;\n    case L'\\n':\n      *os << \"\\\\n\";\n      break;\n    case L'\\r':\n      *os << \"\\\\r\";\n      break;\n    case L'\\t':\n      *os << \"\\\\t\";\n      break;\n    case L'\\v':\n      *os << \"\\\\v\";\n      break;\n    default:\n      if (IsPrintableAscii(c)) {\n        *os << static_cast<char>(c);\n        return kAsIs;\n      } else {\n        *os << \"\\\\x\" + String::FormatHexInt(static_cast<UnsignedChar>(c));\n        return kHexEscape;\n      }\n  }\n  return kSpecialEscape;\n}\n\n// Prints a wchar_t c as if it's part of a string literal, escaping it when\n// necessary; returns how c was formatted.\nstatic CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {\n  switch (c) {\n    case L'\\'':\n      *os << \"'\";\n      return kAsIs;\n    case L'\"':\n      *os << \"\\\\\\\"\";\n      return kSpecialEscape;\n    default:\n      return PrintAsCharLiteralTo<wchar_t>(c, os);\n  }\n}\n\n// Prints a char c as if it's part of a string literal, escaping it when\n// necessary; returns how c was formatted.\nstatic CharFormat PrintAsStringLiteralTo(char c, ostream* os) {\n  return PrintAsStringLiteralTo(\n      static_cast<wchar_t>(static_cast<unsigned char>(c)), os);\n}\n\n// Prints a wide or narrow character c and its code.  '\\0' is printed\n// as \"'\\\\0'\", other unprintable characters are also properly escaped\n// using the standard C++ escape sequence.  The template argument\n// UnsignedChar is the unsigned version of Char, which is the type of c.\ntemplate <typename UnsignedChar, typename Char>\nvoid PrintCharAndCodeTo(Char c, ostream* os) {\n  // First, print c as a literal in the most readable form we can find.\n  *os << ((sizeof(c) > 1) ? \"L'\" : \"'\");\n  const CharFormat format = PrintAsCharLiteralTo<UnsignedChar>(c, os);\n  *os << \"'\";\n\n  // To aid user debugging, we also print c's code in decimal, unless\n  // it's 0 (in which case c was printed as '\\\\0', making the code\n  // obvious).\n  if (c == 0)\n    return;\n  *os << \" (\" << static_cast<int>(c);\n\n  // For more convenience, we print c's code again in hexidecimal,\n  // unless c was already printed in the form '\\x##' or the code is in\n  // [1, 9].\n  if (format == kHexEscape || (1 <= c && c <= 9)) {\n    // Do nothing.\n  } else {\n    *os << \", 0x\" << String::FormatHexInt(static_cast<UnsignedChar>(c));\n  }\n  *os << \")\";\n}\n\nvoid PrintTo(unsigned char c, ::std::ostream* os) {\n  PrintCharAndCodeTo<unsigned char>(c, os);\n}\nvoid PrintTo(signed char c, ::std::ostream* os) {\n  PrintCharAndCodeTo<unsigned char>(c, os);\n}\n\n// Prints a wchar_t as a symbol if it is printable or as its internal\n// code otherwise and also as its code.  L'\\0' is printed as \"L'\\\\0'\".\nvoid PrintTo(wchar_t wc, ostream* os) {\n  PrintCharAndCodeTo<wchar_t>(wc, os);\n}\n\n// Prints the given array of characters to the ostream.  CharType must be either\n// char or wchar_t.\n// The array starts at begin, the length is len, it may include '\\0' characters\n// and may not be NUL-terminated.\ntemplate <typename CharType>\nstatic void PrintCharsAsStringTo(\n    const CharType* begin, size_t len, ostream* os) {\n  const char* const kQuoteBegin = sizeof(CharType) == 1 ? \"\\\"\" : \"L\\\"\";\n  *os << kQuoteBegin;\n  bool is_previous_hex = false;\n  for (size_t index = 0; index < len; ++index) {\n    const CharType cur = begin[index];\n    if (is_previous_hex && IsXDigit(cur)) {\n      // Previous character is of '\\x..' form and this character can be\n      // interpreted as another hexadecimal digit in its number. Break string to\n      // disambiguate.\n      *os << \"\\\" \" << kQuoteBegin;\n    }\n    is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;\n  }\n  *os << \"\\\"\";\n}\n\n// Prints a (const) char/wchar_t array of 'len' elements, starting at address\n// 'begin'.  CharType must be either char or wchar_t.\ntemplate <typename CharType>\nstatic void UniversalPrintCharArray(\n    const CharType* begin, size_t len, ostream* os) {\n  // The code\n  //   const char kFoo[] = \"foo\";\n  // generates an array of 4, not 3, elements, with the last one being '\\0'.\n  //\n  // Therefore when printing a char array, we don't print the last element if\n  // it's '\\0', such that the output matches the string literal as it's\n  // written in the source code.\n  if (len > 0 && begin[len - 1] == '\\0') {\n    PrintCharsAsStringTo(begin, len - 1, os);\n    return;\n  }\n\n  // If, however, the last element in the array is not '\\0', e.g.\n  //    const char kFoo[] = { 'f', 'o', 'o' };\n  // we must print the entire array.  We also print a message to indicate\n  // that the array is not NUL-terminated.\n  PrintCharsAsStringTo(begin, len, os);\n  *os << \" (no terminating NUL)\";\n}\n\n// Prints a (const) char array of 'len' elements, starting at address 'begin'.\nvoid UniversalPrintArray(const char* begin, size_t len, ostream* os) {\n  UniversalPrintCharArray(begin, len, os);\n}\n\n// Prints a (const) wchar_t array of 'len' elements, starting at address\n// 'begin'.\nvoid UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {\n  UniversalPrintCharArray(begin, len, os);\n}\n\n// Prints the given C string to the ostream.\nvoid PrintTo(const char* s, ostream* os) {\n  if (s == NULL) {\n    *os << \"NULL\";\n  } else {\n    *os << ImplicitCast_<const void*>(s) << \" pointing to \";\n    PrintCharsAsStringTo(s, strlen(s), os);\n  }\n}\n\n// MSVC compiler can be configured to define whar_t as a typedef\n// of unsigned short. Defining an overload for const wchar_t* in that case\n// would cause pointers to unsigned shorts be printed as wide strings,\n// possibly accessing more memory than intended and causing invalid\n// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when\n// wchar_t is implemented as a native type.\n#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)\n// Prints the given wide C string to the ostream.\nvoid PrintTo(const wchar_t* s, ostream* os) {\n  if (s == NULL) {\n    *os << \"NULL\";\n  } else {\n    *os << ImplicitCast_<const void*>(s) << \" pointing to \";\n    PrintCharsAsStringTo(s, wcslen(s), os);\n  }\n}\n#endif  // wchar_t is native\n\n// Prints a ::string object.\n#if GTEST_HAS_GLOBAL_STRING\nvoid PrintStringTo(const ::string& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n#endif  // GTEST_HAS_GLOBAL_STRING\n\nvoid PrintStringTo(const ::std::string& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n\n// Prints a ::wstring object.\n#if GTEST_HAS_GLOBAL_WSTRING\nvoid PrintWideStringTo(const ::wstring& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n#if GTEST_HAS_STD_WSTRING\nvoid PrintWideStringTo(const ::std::wstring& s, ostream* os) {\n  PrintCharsAsStringTo(s.data(), s.size(), os);\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n}  // namespace internal\n\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest-test-part.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n// The Google C++ Testing Framework (Google Test)\n\n#include \"gtest/gtest-test-part.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\n\nusing internal::GetUnitTestImpl;\n\n// Gets the summary of the failure message by omitting the stack trace\n// in it.\nstd::string TestPartResult::ExtractSummary(const char* message) {\n  const char* const stack_trace = strstr(message, internal::kStackTraceMarker);\n  return stack_trace == NULL ? message :\n      std::string(message, stack_trace);\n}\n\n// Prints a TestPartResult object.\nstd::ostream& operator<<(std::ostream& os, const TestPartResult& result) {\n  return os\n      << result.file_name() << \":\" << result.line_number() << \": \"\n      << (result.type() == TestPartResult::kSuccess ? \"Success\" :\n          result.type() == TestPartResult::kFatalFailure ? \"Fatal failure\" :\n          \"Non-fatal failure\") << \":\\n\"\n      << result.message() << std::endl;\n}\n\n// Appends a TestPartResult to the array.\nvoid TestPartResultArray::Append(const TestPartResult& result) {\n  array_.push_back(result);\n}\n\n// Returns the TestPartResult at the given index (0-based).\nconst TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {\n  if (index < 0 || index >= size()) {\n    printf(\"\\nInvalid index (%d) into TestPartResultArray.\\n\", index);\n    internal::posix::Abort();\n  }\n\n  return array_[index];\n}\n\n// Returns the number of TestPartResult objects in the array.\nint TestPartResultArray::size() const {\n  return static_cast<int>(array_.size());\n}\n\nnamespace internal {\n\nHasNewFatalFailureHelper::HasNewFatalFailureHelper()\n    : has_new_fatal_failure_(false),\n      original_reporter_(GetUnitTestImpl()->\n                         GetTestPartResultReporterForCurrentThread()) {\n  GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);\n}\n\nHasNewFatalFailureHelper::~HasNewFatalFailureHelper() {\n  GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(\n      original_reporter_);\n}\n\nvoid HasNewFatalFailureHelper::ReportTestPartResult(\n    const TestPartResult& result) {\n  if (result.fatally_failed())\n    has_new_fatal_failure_ = true;\n  original_reporter_->ReportTestPartResult(result);\n}\n\n}  // namespace internal\n\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest-typed-test.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/gtest-typed-test.h\"\n#include \"gtest/gtest.h\"\n\nnamespace testing {\nnamespace internal {\n\n#if GTEST_HAS_TYPED_TEST_P\n\n// Skips to the first non-space char in str. Returns an empty string if str\n// contains only whitespace characters.\nstatic const char* SkipSpaces(const char* str) {\n  while (IsSpace(*str))\n    str++;\n  return str;\n}\n\n// Verifies that registered_tests match the test names in\n// defined_test_names_; returns registered_tests if successful, or\n// aborts the program otherwise.\nconst char* TypedTestCasePState::VerifyRegisteredTestNames(\n    const char* file, int line, const char* registered_tests) {\n  typedef ::std::set<const char*>::const_iterator DefinedTestIter;\n  registered_ = true;\n\n  // Skip initial whitespace in registered_tests since some\n  // preprocessors prefix stringizied literals with whitespace.\n  registered_tests = SkipSpaces(registered_tests);\n\n  Message errors;\n  ::std::set<std::string> tests;\n  for (const char* names = registered_tests; names != NULL;\n       names = SkipComma(names)) {\n    const std::string name = GetPrefixUntilComma(names);\n    if (tests.count(name) != 0) {\n      errors << \"Test \" << name << \" is listed more than once.\\n\";\n      continue;\n    }\n\n    bool found = false;\n    for (DefinedTestIter it = defined_test_names_.begin();\n         it != defined_test_names_.end();\n         ++it) {\n      if (name == *it) {\n        found = true;\n        break;\n      }\n    }\n\n    if (found) {\n      tests.insert(name);\n    } else {\n      errors << \"No test named \" << name\n             << \" can be found in this test case.\\n\";\n    }\n  }\n\n  for (DefinedTestIter it = defined_test_names_.begin();\n       it != defined_test_names_.end();\n       ++it) {\n    if (tests.count(*it) == 0) {\n      errors << \"You forgot to list test \" << *it << \".\\n\";\n    }\n  }\n\n  const std::string& errors_str = errors.GetString();\n  if (errors_str != \"\") {\n    fprintf(stderr, \"%s %s\", FormatFileLocation(file, line).c_str(),\n            errors_str.c_str());\n    fflush(stderr);\n    posix::Abort();\n  }\n\n  return registered_tests;\n}\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// The Google C++ Testing Framework (Google Test)\n\n#include \"gtest/gtest.h\"\n#include \"gtest/gtest-spi.h\"\n\n#include <ctype.h>\n#include <math.h>\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n#include <wchar.h>\n#include <wctype.h>\n\n#include <algorithm>\n#include <iomanip>\n#include <limits>\n#include <ostream>  // NOLINT\n#include <sstream>\n#include <vector>\n\n#if GTEST_OS_LINUX\n\n// TODO(kenton@google.com): Use autoconf to detect availability of\n// gettimeofday().\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n\n# include <fcntl.h>  // NOLINT\n# include <limits.h>  // NOLINT\n# include <sched.h>  // NOLINT\n// Declares vsnprintf().  This header is not available on Windows.\n# include <strings.h>  // NOLINT\n# include <sys/mman.h>  // NOLINT\n# include <sys/time.h>  // NOLINT\n# include <unistd.h>  // NOLINT\n# include <string>\n\n#elif GTEST_OS_SYMBIAN\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n# include <sys/time.h>  // NOLINT\n\n#elif GTEST_OS_ZOS\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n# include <sys/time.h>  // NOLINT\n\n// On z/OS we additionally need strings.h for strcasecmp.\n# include <strings.h>  // NOLINT\n\n#elif GTEST_OS_WINDOWS_MOBILE  // We are on Windows CE.\n\n# include <windows.h>  // NOLINT\n\n#elif GTEST_OS_WINDOWS  // We are on Windows proper.\n\n# include <io.h>  // NOLINT\n# include <sys/timeb.h>  // NOLINT\n# include <sys/types.h>  // NOLINT\n# include <sys/stat.h>  // NOLINT\n\n# if GTEST_OS_WINDOWS_MINGW\n// MinGW has gettimeofday() but not _ftime64().\n// TODO(kenton@google.com): Use autoconf to detect availability of\n//   gettimeofday().\n// TODO(kenton@google.com): There are other ways to get the time on\n//   Windows, like GetTickCount() or GetSystemTimeAsFileTime().  MinGW\n//   supports these.  consider using them instead.\n#  define GTEST_HAS_GETTIMEOFDAY_ 1\n#  include <sys/time.h>  // NOLINT\n# endif  // GTEST_OS_WINDOWS_MINGW\n\n// cpplint thinks that the header is already included, so we want to\n// silence it.\n# include <windows.h>  // NOLINT\n\n#else\n\n// Assume other platforms have gettimeofday().\n// TODO(kenton@google.com): Use autoconf to detect availability of\n//   gettimeofday().\n# define GTEST_HAS_GETTIMEOFDAY_ 1\n\n// cpplint thinks that the header is already included, so we want to\n// silence it.\n# include <sys/time.h>  // NOLINT\n# include <unistd.h>  // NOLINT\n\n#endif  // GTEST_OS_LINUX\n\n#if GTEST_HAS_EXCEPTIONS\n# include <stdexcept>\n#endif\n\n#if GTEST_CAN_STREAM_RESULTS_\n# include <arpa/inet.h>  // NOLINT\n# include <netdb.h>  // NOLINT\n#endif\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\n#if GTEST_OS_WINDOWS\n# define vsnprintf _vsnprintf\n#endif  // GTEST_OS_WINDOWS\n\nnamespace testing {\n\nusing internal::CountIf;\nusing internal::ForEach;\nusing internal::GetElementOr;\nusing internal::Shuffle;\n\n// Constants.\n\n// A test whose test case name or test name matches this filter is\n// disabled and not run.\nstatic const char kDisableTestFilter[] = \"DISABLED_*:*/DISABLED_*\";\n\n// A test case whose name matches this filter is considered a death\n// test case and will be run before test cases whose name doesn't\n// match this filter.\nstatic const char kDeathTestCaseFilter[] = \"*DeathTest:*DeathTest/*\";\n\n// A test filter that matches everything.\nstatic const char kUniversalFilter[] = \"*\";\n\n// The default output file for XML output.\nstatic const char kDefaultOutputFile[] = \"test_detail.xml\";\n\n// The environment variable name for the test shard index.\nstatic const char kTestShardIndex[] = \"GTEST_SHARD_INDEX\";\n// The environment variable name for the total number of test shards.\nstatic const char kTestTotalShards[] = \"GTEST_TOTAL_SHARDS\";\n// The environment variable name for the test shard status file.\nstatic const char kTestShardStatusFile[] = \"GTEST_SHARD_STATUS_FILE\";\n\nnamespace internal {\n\n// The text used in failure messages to indicate the start of the\n// stack trace.\nconst char kStackTraceMarker[] = \"\\nStack trace:\\n\";\n\n// g_help_flag is true iff the --help flag or an equivalent form is\n// specified on the command line.\nbool g_help_flag = false;\n\n}  // namespace internal\n\nstatic const char* GetDefaultFilter() {\n  return kUniversalFilter;\n}\n\nGTEST_DEFINE_bool_(\n    also_run_disabled_tests,\n    internal::BoolFromGTestEnv(\"also_run_disabled_tests\", false),\n    \"Run disabled tests too, in addition to the tests normally being run.\");\n\nGTEST_DEFINE_bool_(\n    break_on_failure,\n    internal::BoolFromGTestEnv(\"break_on_failure\", false),\n    \"True iff a failed assertion should be a debugger break-point.\");\n\nGTEST_DEFINE_bool_(\n    catch_exceptions,\n    internal::BoolFromGTestEnv(\"catch_exceptions\", true),\n    \"True iff \" GTEST_NAME_\n    \" should catch exceptions and treat them as test failures.\");\n\nGTEST_DEFINE_string_(\n    color,\n    internal::StringFromGTestEnv(\"color\", \"auto\"),\n    \"Whether to use colors in the output.  Valid values: yes, no, \"\n    \"and auto.  'auto' means to use colors if the output is \"\n    \"being sent to a terminal and the TERM environment variable \"\n    \"is set to a terminal type that supports colors.\");\n\nGTEST_DEFINE_string_(\n    filter,\n    internal::StringFromGTestEnv(\"filter\", GetDefaultFilter()),\n    \"A colon-separated list of glob (not regex) patterns \"\n    \"for filtering the tests to run, optionally followed by a \"\n    \"'-' and a : separated list of negative patterns (tests to \"\n    \"exclude).  A test is run if it matches one of the positive \"\n    \"patterns and does not match any of the negative patterns.\");\n\nGTEST_DEFINE_bool_(list_tests, false,\n                   \"List all tests without running them.\");\n\nGTEST_DEFINE_string_(\n    output,\n    internal::StringFromGTestEnv(\"output\", \"\"),\n    \"A format (currently must be \\\"xml\\\"), optionally followed \"\n    \"by a colon and an output file name or directory. A directory \"\n    \"is indicated by a trailing pathname separator. \"\n    \"Examples: \\\"xml:filename.xml\\\", \\\"xml::directoryname/\\\". \"\n    \"If a directory is specified, output files will be created \"\n    \"within that directory, with file-names based on the test \"\n    \"executable's name and, if necessary, made unique by adding \"\n    \"digits.\");\n\nGTEST_DEFINE_bool_(\n    print_time,\n    internal::BoolFromGTestEnv(\"print_time\", true),\n    \"True iff \" GTEST_NAME_\n    \" should display elapsed time in text output.\");\n\nGTEST_DEFINE_int32_(\n    random_seed,\n    internal::Int32FromGTestEnv(\"random_seed\", 0),\n    \"Random number seed to use when shuffling test orders.  Must be in range \"\n    \"[1, 99999], or 0 to use a seed based on the current time.\");\n\nGTEST_DEFINE_int32_(\n    repeat,\n    internal::Int32FromGTestEnv(\"repeat\", 1),\n    \"How many times to repeat each test.  Specify a negative number \"\n    \"for repeating forever.  Useful for shaking out flaky tests.\");\n\nGTEST_DEFINE_bool_(\n    show_internal_stack_frames, false,\n    \"True iff \" GTEST_NAME_ \" should include internal stack frames when \"\n    \"printing test failure stack traces.\");\n\nGTEST_DEFINE_bool_(\n    shuffle,\n    internal::BoolFromGTestEnv(\"shuffle\", false),\n    \"True iff \" GTEST_NAME_\n    \" should randomize tests' order on every run.\");\n\nGTEST_DEFINE_int32_(\n    stack_trace_depth,\n    internal::Int32FromGTestEnv(\"stack_trace_depth\", kMaxStackTraceDepth),\n    \"The maximum number of stack frames to print when an \"\n    \"assertion fails.  The valid range is 0 through 100, inclusive.\");\n\nGTEST_DEFINE_string_(\n    stream_result_to,\n    internal::StringFromGTestEnv(\"stream_result_to\", \"\"),\n    \"This flag specifies the host name and the port number on which to stream \"\n    \"test results. Example: \\\"localhost:555\\\". The flag is effective only on \"\n    \"Linux.\");\n\nGTEST_DEFINE_bool_(\n    throw_on_failure,\n    internal::BoolFromGTestEnv(\"throw_on_failure\", false),\n    \"When this flag is specified, a failed assertion will throw an exception \"\n    \"if exceptions are enabled or exit the program with a non-zero code \"\n    \"otherwise.\");\n\nnamespace internal {\n\n// Generates a random number from [0, range), using a Linear\n// Congruential Generator (LCG).  Crashes if 'range' is 0 or greater\n// than kMaxRange.\nUInt32 Random::Generate(UInt32 range) {\n  // These constants are the same as are used in glibc's rand(3).\n  state_ = (1103515245U*state_ + 12345U) % kMaxRange;\n\n  GTEST_CHECK_(range > 0)\n      << \"Cannot generate a number in the range [0, 0).\";\n  GTEST_CHECK_(range <= kMaxRange)\n      << \"Generation of a number in [0, \" << range << \") was requested, \"\n      << \"but this can only generate numbers in [0, \" << kMaxRange << \").\";\n\n  // Converting via modulus introduces a bit of downward bias, but\n  // it's simple, and a linear congruential generator isn't too good\n  // to begin with.\n  return state_ % range;\n}\n\n// GTestIsInitialized() returns true iff the user has initialized\n// Google Test.  Useful for catching the user mistake of not initializing\n// Google Test before calling RUN_ALL_TESTS().\n//\n// A user must call testing::InitGoogleTest() to initialize Google\n// Test.  g_init_gtest_count is set to the number of times\n// InitGoogleTest() has been called.  We don't protect this variable\n// under a mutex as it is only accessed in the main thread.\nGTEST_API_ int g_init_gtest_count = 0;\nstatic bool GTestIsInitialized() { return g_init_gtest_count != 0; }\n\n// Iterates over a vector of TestCases, keeping a running sum of the\n// results of calling a given int-returning method on each.\n// Returns the sum.\nstatic int SumOverTestCaseList(const std::vector<TestCase*>& case_list,\n                               int (TestCase::*method)() const) {\n  int sum = 0;\n  for (size_t i = 0; i < case_list.size(); i++) {\n    sum += (case_list[i]->*method)();\n  }\n  return sum;\n}\n\n// Returns true iff the test case passed.\nstatic bool TestCasePassed(const TestCase* test_case) {\n  return test_case->should_run() && test_case->Passed();\n}\n\n// Returns true iff the test case failed.\nstatic bool TestCaseFailed(const TestCase* test_case) {\n  return test_case->should_run() && test_case->Failed();\n}\n\n// Returns true iff test_case contains at least one test that should\n// run.\nstatic bool ShouldRunTestCase(const TestCase* test_case) {\n  return test_case->should_run();\n}\n\n// AssertHelper constructor.\nAssertHelper::AssertHelper(TestPartResult::Type type,\n                           const char* file,\n                           int line,\n                           const char* message)\n    : data_(new AssertHelperData(type, file, line, message)) {\n}\n\nAssertHelper::~AssertHelper() {\n  delete data_;\n}\n\n// Message assignment, for assertion streaming support.\nvoid AssertHelper::operator=(const Message& message) const {\n  UnitTest::GetInstance()->\n    AddTestPartResult(data_->type, data_->file, data_->line,\n                      AppendUserMessage(data_->message, message),\n                      UnitTest::GetInstance()->impl()\n                      ->CurrentOsStackTraceExceptTop(1)\n                      // Skips the stack frame for this function itself.\n                      );  // NOLINT\n}\n\n// Mutex for linked pointers.\nGTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);\n\n// Application pathname gotten in InitGoogleTest.\nstd::string g_executable_path;\n\n// Returns the current application's name, removing directory path if that\n// is present.\nFilePath GetCurrentExecutableName() {\n  FilePath result;\n\n#if GTEST_OS_WINDOWS\n  result.Set(FilePath(g_executable_path).RemoveExtension(\"exe\"));\n#else\n  result.Set(FilePath(g_executable_path));\n#endif  // GTEST_OS_WINDOWS\n\n  return result.RemoveDirectoryName();\n}\n\n// Functions for processing the gtest_output flag.\n\n// Returns the output format, or \"\" for normal printed output.\nstd::string UnitTestOptions::GetOutputFormat() {\n  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();\n  if (gtest_output_flag == NULL) return std::string(\"\");\n\n  const char* const colon = strchr(gtest_output_flag, ':');\n  return (colon == NULL) ?\n      std::string(gtest_output_flag) :\n      std::string(gtest_output_flag, colon - gtest_output_flag);\n}\n\n// Returns the name of the requested output file, or the default if none\n// was explicitly specified.\nstd::string UnitTestOptions::GetAbsolutePathToOutputFile() {\n  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();\n  if (gtest_output_flag == NULL)\n    return \"\";\n\n  const char* const colon = strchr(gtest_output_flag, ':');\n  if (colon == NULL)\n    return internal::FilePath::ConcatPaths(\n        internal::FilePath(\n            UnitTest::GetInstance()->original_working_dir()),\n        internal::FilePath(kDefaultOutputFile)).string();\n\n  internal::FilePath output_name(colon + 1);\n  if (!output_name.IsAbsolutePath())\n    // TODO(wan@google.com): on Windows \\some\\path is not an absolute\n    // path (as its meaning depends on the current drive), yet the\n    // following logic for turning it into an absolute path is wrong.\n    // Fix it.\n    output_name = internal::FilePath::ConcatPaths(\n        internal::FilePath(UnitTest::GetInstance()->original_working_dir()),\n        internal::FilePath(colon + 1));\n\n  if (!output_name.IsDirectory())\n    return output_name.string();\n\n  internal::FilePath result(internal::FilePath::GenerateUniqueFileName(\n      output_name, internal::GetCurrentExecutableName(),\n      GetOutputFormat().c_str()));\n  return result.string();\n}\n\n// Returns true iff the wildcard pattern matches the string.  The\n// first ':' or '\\0' character in pattern marks the end of it.\n//\n// This recursive algorithm isn't very efficient, but is clear and\n// works well enough for matching test names, which are short.\nbool UnitTestOptions::PatternMatchesString(const char *pattern,\n                                           const char *str) {\n  switch (*pattern) {\n    case '\\0':\n    case ':':  // Either ':' or '\\0' marks the end of the pattern.\n      return *str == '\\0';\n    case '?':  // Matches any single character.\n      return *str != '\\0' && PatternMatchesString(pattern + 1, str + 1);\n    case '*':  // Matches any string (possibly empty) of characters.\n      return (*str != '\\0' && PatternMatchesString(pattern, str + 1)) ||\n          PatternMatchesString(pattern + 1, str);\n    default:  // Non-special character.  Matches itself.\n      return *pattern == *str &&\n          PatternMatchesString(pattern + 1, str + 1);\n  }\n}\n\nbool UnitTestOptions::MatchesFilter(\n    const std::string& name, const char* filter) {\n  const char *cur_pattern = filter;\n  for (;;) {\n    if (PatternMatchesString(cur_pattern, name.c_str())) {\n      return true;\n    }\n\n    // Finds the next pattern in the filter.\n    cur_pattern = strchr(cur_pattern, ':');\n\n    // Returns if no more pattern can be found.\n    if (cur_pattern == NULL) {\n      return false;\n    }\n\n    // Skips the pattern separater (the ':' character).\n    cur_pattern++;\n  }\n}\n\n// Returns true iff the user-specified filter matches the test case\n// name and the test name.\nbool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name,\n                                        const std::string &test_name) {\n  const std::string& full_name = test_case_name + \".\" + test_name.c_str();\n\n  // Split --gtest_filter at '-', if there is one, to separate into\n  // positive filter and negative filter portions\n  const char* const p = GTEST_FLAG(filter).c_str();\n  const char* const dash = strchr(p, '-');\n  std::string positive;\n  std::string negative;\n  if (dash == NULL) {\n    positive = GTEST_FLAG(filter).c_str();  // Whole string is a positive filter\n    negative = \"\";\n  } else {\n    positive = std::string(p, dash);   // Everything up to the dash\n    negative = std::string(dash + 1);  // Everything after the dash\n    if (positive.empty()) {\n      // Treat '-test1' as the same as '*-test1'\n      positive = kUniversalFilter;\n    }\n  }\n\n  // A filter is a colon-separated list of patterns.  It matches a\n  // test if any pattern in it matches the test.\n  return (MatchesFilter(full_name, positive.c_str()) &&\n          !MatchesFilter(full_name, negative.c_str()));\n}\n\n#if GTEST_HAS_SEH\n// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the\n// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.\n// This function is useful as an __except condition.\nint UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {\n  // Google Test should handle a SEH exception if:\n  //   1. the user wants it to, AND\n  //   2. this is not a breakpoint exception, AND\n  //   3. this is not a C++ exception (VC++ implements them via SEH,\n  //      apparently).\n  //\n  // SEH exception code for C++ exceptions.\n  // (see http://support.microsoft.com/kb/185294 for more information).\n  const DWORD kCxxExceptionCode = 0xe06d7363;\n\n  bool should_handle = true;\n\n  if (!GTEST_FLAG(catch_exceptions))\n    should_handle = false;\n  else if (exception_code == EXCEPTION_BREAKPOINT)\n    should_handle = false;\n  else if (exception_code == kCxxExceptionCode)\n    should_handle = false;\n\n  return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;\n}\n#endif  // GTEST_HAS_SEH\n\n}  // namespace internal\n\n// The c'tor sets this object as the test part result reporter used by\n// Google Test.  The 'result' parameter specifies where to report the\n// results. Intercepts only failures from the current thread.\nScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(\n    TestPartResultArray* result)\n    : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),\n      result_(result) {\n  Init();\n}\n\n// The c'tor sets this object as the test part result reporter used by\n// Google Test.  The 'result' parameter specifies where to report the\n// results.\nScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(\n    InterceptMode intercept_mode, TestPartResultArray* result)\n    : intercept_mode_(intercept_mode),\n      result_(result) {\n  Init();\n}\n\nvoid ScopedFakeTestPartResultReporter::Init() {\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {\n    old_reporter_ = impl->GetGlobalTestPartResultReporter();\n    impl->SetGlobalTestPartResultReporter(this);\n  } else {\n    old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();\n    impl->SetTestPartResultReporterForCurrentThread(this);\n  }\n}\n\n// The d'tor restores the test part result reporter used by Google Test\n// before.\nScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {\n    impl->SetGlobalTestPartResultReporter(old_reporter_);\n  } else {\n    impl->SetTestPartResultReporterForCurrentThread(old_reporter_);\n  }\n}\n\n// Increments the test part result count and remembers the result.\n// This method is from the TestPartResultReporterInterface interface.\nvoid ScopedFakeTestPartResultReporter::ReportTestPartResult(\n    const TestPartResult& result) {\n  result_->Append(result);\n}\n\nnamespace internal {\n\n// Returns the type ID of ::testing::Test.  We should always call this\n// instead of GetTypeId< ::testing::Test>() to get the type ID of\n// testing::Test.  This is to work around a suspected linker bug when\n// using Google Test as a framework on Mac OS X.  The bug causes\n// GetTypeId< ::testing::Test>() to return different values depending\n// on whether the call is from the Google Test framework itself or\n// from user test code.  GetTestTypeId() is guaranteed to always\n// return the same value, as it always calls GetTypeId<>() from the\n// gtest.cc, which is within the Google Test framework.\nTypeId GetTestTypeId() {\n  return GetTypeId<Test>();\n}\n\n// The value of GetTestTypeId() as seen from within the Google Test\n// library.  This is solely for testing GetTestTypeId().\nextern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();\n\n// This predicate-formatter checks that 'results' contains a test part\n// failure of the given type and that the failure message contains the\n// given substring.\nAssertionResult HasOneFailure(const char* /* results_expr */,\n                              const char* /* type_expr */,\n                              const char* /* substr_expr */,\n                              const TestPartResultArray& results,\n                              TestPartResult::Type type,\n                              const string& substr) {\n  const std::string expected(type == TestPartResult::kFatalFailure ?\n                        \"1 fatal failure\" :\n                        \"1 non-fatal failure\");\n  Message msg;\n  if (results.size() != 1) {\n    msg << \"Expected: \" << expected << \"\\n\"\n        << \"  Actual: \" << results.size() << \" failures\";\n    for (int i = 0; i < results.size(); i++) {\n      msg << \"\\n\" << results.GetTestPartResult(i);\n    }\n    return AssertionFailure() << msg;\n  }\n\n  const TestPartResult& r = results.GetTestPartResult(0);\n  if (r.type() != type) {\n    return AssertionFailure() << \"Expected: \" << expected << \"\\n\"\n                              << \"  Actual:\\n\"\n                              << r;\n  }\n\n  if (strstr(r.message(), substr.c_str()) == NULL) {\n    return AssertionFailure() << \"Expected: \" << expected << \" containing \\\"\"\n                              << substr << \"\\\"\\n\"\n                              << \"  Actual:\\n\"\n                              << r;\n  }\n\n  return AssertionSuccess();\n}\n\n// The constructor of SingleFailureChecker remembers where to look up\n// test part results, what type of failure we expect, and what\n// substring the failure message should contain.\nSingleFailureChecker:: SingleFailureChecker(\n    const TestPartResultArray* results,\n    TestPartResult::Type type,\n    const string& substr)\n    : results_(results),\n      type_(type),\n      substr_(substr) {}\n\n// The destructor of SingleFailureChecker verifies that the given\n// TestPartResultArray contains exactly one failure that has the given\n// type and contains the given substring.  If that's not the case, a\n// non-fatal failure will be generated.\nSingleFailureChecker::~SingleFailureChecker() {\n  EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_);\n}\n\nDefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(\n    UnitTestImpl* unit_test) : unit_test_(unit_test) {}\n\nvoid DefaultGlobalTestPartResultReporter::ReportTestPartResult(\n    const TestPartResult& result) {\n  unit_test_->current_test_result()->AddTestPartResult(result);\n  unit_test_->listeners()->repeater()->OnTestPartResult(result);\n}\n\nDefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(\n    UnitTestImpl* unit_test) : unit_test_(unit_test) {}\n\nvoid DefaultPerThreadTestPartResultReporter::ReportTestPartResult(\n    const TestPartResult& result) {\n  unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);\n}\n\n// Returns the global test part result reporter.\nTestPartResultReporterInterface*\nUnitTestImpl::GetGlobalTestPartResultReporter() {\n  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);\n  return global_test_part_result_repoter_;\n}\n\n// Sets the global test part result reporter.\nvoid UnitTestImpl::SetGlobalTestPartResultReporter(\n    TestPartResultReporterInterface* reporter) {\n  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);\n  global_test_part_result_repoter_ = reporter;\n}\n\n// Returns the test part result reporter for the current thread.\nTestPartResultReporterInterface*\nUnitTestImpl::GetTestPartResultReporterForCurrentThread() {\n  return per_thread_test_part_result_reporter_.get();\n}\n\n// Sets the test part result reporter for the current thread.\nvoid UnitTestImpl::SetTestPartResultReporterForCurrentThread(\n    TestPartResultReporterInterface* reporter) {\n  per_thread_test_part_result_reporter_.set(reporter);\n}\n\n// Gets the number of successful test cases.\nint UnitTestImpl::successful_test_case_count() const {\n  return CountIf(test_cases_, TestCasePassed);\n}\n\n// Gets the number of failed test cases.\nint UnitTestImpl::failed_test_case_count() const {\n  return CountIf(test_cases_, TestCaseFailed);\n}\n\n// Gets the number of all test cases.\nint UnitTestImpl::total_test_case_count() const {\n  return static_cast<int>(test_cases_.size());\n}\n\n// Gets the number of all test cases that contain at least one test\n// that should run.\nint UnitTestImpl::test_case_to_run_count() const {\n  return CountIf(test_cases_, ShouldRunTestCase);\n}\n\n// Gets the number of successful tests.\nint UnitTestImpl::successful_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);\n}\n\n// Gets the number of failed tests.\nint UnitTestImpl::failed_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);\n}\n\n// Gets the number of disabled tests that will be reported in the XML report.\nint UnitTestImpl::reportable_disabled_test_count() const {\n  return SumOverTestCaseList(test_cases_,\n                             &TestCase::reportable_disabled_test_count);\n}\n\n// Gets the number of disabled tests.\nint UnitTestImpl::disabled_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);\n}\n\n// Gets the number of tests to be printed in the XML report.\nint UnitTestImpl::reportable_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count);\n}\n\n// Gets the number of all tests.\nint UnitTestImpl::total_test_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);\n}\n\n// Gets the number of tests that should run.\nint UnitTestImpl::test_to_run_count() const {\n  return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);\n}\n\n// Returns the current OS stack trace as an std::string.\n//\n// The maximum number of stack frames to be included is specified by\n// the gtest_stack_trace_depth flag.  The skip_count parameter\n// specifies the number of top frames to be skipped, which doesn't\n// count against the number of frames to be included.\n//\n// For example, if Foo() calls Bar(), which in turn calls\n// CurrentOsStackTraceExceptTop(1), Foo() will be included in the\n// trace but Bar() and CurrentOsStackTraceExceptTop() won't.\nstd::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {\n  (void)skip_count;\n  return \"\";\n}\n\n// Returns the current time in milliseconds.\nTimeInMillis GetTimeInMillis() {\n#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)\n  // Difference between 1970-01-01 and 1601-01-01 in milliseconds.\n  // http://analogous.blogspot.com/2005/04/epoch.html\n  const TimeInMillis kJavaEpochToWinFileTimeDelta =\n    static_cast<TimeInMillis>(116444736UL) * 100000UL;\n  const DWORD kTenthMicrosInMilliSecond = 10000;\n\n  SYSTEMTIME now_systime;\n  FILETIME now_filetime;\n  ULARGE_INTEGER now_int64;\n  // TODO(kenton@google.com): Shouldn't this just use\n  //   GetSystemTimeAsFileTime()?\n  GetSystemTime(&now_systime);\n  if (SystemTimeToFileTime(&now_systime, &now_filetime)) {\n    now_int64.LowPart = now_filetime.dwLowDateTime;\n    now_int64.HighPart = now_filetime.dwHighDateTime;\n    now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -\n      kJavaEpochToWinFileTimeDelta;\n    return now_int64.QuadPart;\n  }\n  return 0;\n#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_\n  __timeb64 now;\n\n# ifdef _MSC_VER\n\n  // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996\n  // (deprecated function) there.\n  // TODO(kenton@google.com): Use GetTickCount()?  Or use\n  //   SystemTimeToFileTime()\n#  pragma warning(push)          // Saves the current warning state.\n#  pragma warning(disable:4996)  // Temporarily disables warning 4996.\n  _ftime64(&now);\n#  pragma warning(pop)           // Restores the warning state.\n# else\n\n  _ftime64(&now);\n\n# endif  // _MSC_VER\n\n  return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;\n#elif GTEST_HAS_GETTIMEOFDAY_\n  struct timeval now;\n  gettimeofday(&now, NULL);\n  return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;\n#else\n# error \"Don't know how to get the current time on your system.\"\n#endif\n}\n\n// Utilities\n\n// class String.\n\n#if GTEST_OS_WINDOWS_MOBILE\n// Creates a UTF-16 wide string from the given ANSI string, allocating\n// memory using new. The caller is responsible for deleting the return\n// value using delete[]. Returns the wide string, or NULL if the\n// input is NULL.\nLPCWSTR String::AnsiToUtf16(const char* ansi) {\n  if (!ansi) return NULL;\n  const int length = strlen(ansi);\n  const int unicode_length =\n      MultiByteToWideChar(CP_ACP, 0, ansi, length,\n                          NULL, 0);\n  WCHAR* unicode = new WCHAR[unicode_length + 1];\n  MultiByteToWideChar(CP_ACP, 0, ansi, length,\n                      unicode, unicode_length);\n  unicode[unicode_length] = 0;\n  return unicode;\n}\n\n// Creates an ANSI string from the given wide string, allocating\n// memory using new. The caller is responsible for deleting the return\n// value using delete[]. Returns the ANSI string, or NULL if the\n// input is NULL.\nconst char* String::Utf16ToAnsi(LPCWSTR utf16_str)  {\n  if (!utf16_str) return NULL;\n  const int ansi_length =\n      WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,\n                          NULL, 0, NULL, NULL);\n  char* ansi = new char[ansi_length + 1];\n  WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,\n                      ansi, ansi_length, NULL, NULL);\n  ansi[ansi_length] = 0;\n  return ansi;\n}\n\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n// Compares two C strings.  Returns true iff they have the same content.\n//\n// Unlike strcmp(), this function can handle NULL argument(s).  A NULL\n// C string is considered different to any non-NULL C string,\n// including the empty string.\nbool String::CStringEquals(const char * lhs, const char * rhs) {\n  if ( lhs == NULL ) return rhs == NULL;\n\n  if ( rhs == NULL ) return false;\n\n  return strcmp(lhs, rhs) == 0;\n}\n\n#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING\n\n// Converts an array of wide chars to a narrow string using the UTF-8\n// encoding, and streams the result to the given Message object.\nstatic void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,\n                                     Message* msg) {\n  for (size_t i = 0; i != length; ) {  // NOLINT\n    if (wstr[i] != L'\\0') {\n      *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));\n      while (i != length && wstr[i] != L'\\0')\n        i++;\n    } else {\n      *msg << '\\0';\n      i++;\n    }\n  }\n}\n\n#endif  // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING\n\n}  // namespace internal\n\n// Constructs an empty Message.\n// We allocate the stringstream separately because otherwise each use of\n// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's\n// stack frame leading to huge stack frames in some cases; gcc does not reuse\n// the stack space.\nMessage::Message() : ss_(new ::std::stringstream) {\n  // By default, we want there to be enough precision when printing\n  // a double to a Message.\n  *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);\n}\n\n// These two overloads allow streaming a wide C string to a Message\n// using the UTF-8 encoding.\nMessage& Message::operator <<(const wchar_t* wide_c_str) {\n  return *this << internal::String::ShowWideCString(wide_c_str);\n}\nMessage& Message::operator <<(wchar_t* wide_c_str) {\n  return *this << internal::String::ShowWideCString(wide_c_str);\n}\n\n#if GTEST_HAS_STD_WSTRING\n// Converts the given wide string to a narrow string using the UTF-8\n// encoding, and streams the result to this Message object.\nMessage& Message::operator <<(const ::std::wstring& wstr) {\n  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);\n  return *this;\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\n// Converts the given wide string to a narrow string using the UTF-8\n// encoding, and streams the result to this Message object.\nMessage& Message::operator <<(const ::wstring& wstr) {\n  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);\n  return *this;\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// Gets the text streamed to this object so far as an std::string.\n// Each '\\0' character in the buffer is replaced with \"\\\\0\".\nstd::string Message::GetString() const {\n  return internal::StringStreamToString(ss_.get());\n}\n\n// AssertionResult constructors.\n// Used in EXPECT_TRUE/FALSE(assertion_result).\nAssertionResult::AssertionResult(const AssertionResult& other)\n    : success_(other.success_),\n      message_(other.message_.get() != NULL ?\n               new ::std::string(*other.message_) :\n               static_cast< ::std::string*>(NULL)) {\n}\n\n// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.\nAssertionResult AssertionResult::operator!() const {\n  AssertionResult negation(!success_);\n  if (message_.get() != NULL)\n    negation << *message_;\n  return negation;\n}\n\n// Makes a successful assertion result.\nAssertionResult AssertionSuccess() {\n  return AssertionResult(true);\n}\n\n// Makes a failed assertion result.\nAssertionResult AssertionFailure() {\n  return AssertionResult(false);\n}\n\n// Makes a failed assertion result with the given failure message.\n// Deprecated; use AssertionFailure() << message.\nAssertionResult AssertionFailure(const Message& message) {\n  return AssertionFailure() << message;\n}\n\nnamespace internal {\n\n// Constructs and returns the message for an equality assertion\n// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.\n//\n// The first four parameters are the expressions used in the assertion\n// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)\n// where foo is 5 and bar is 6, we have:\n//\n//   expected_expression: \"foo\"\n//   actual_expression:   \"bar\"\n//   expected_value:      \"5\"\n//   actual_value:        \"6\"\n//\n// The ignoring_case parameter is true iff the assertion is a\n// *_STRCASEEQ*.  When it's true, the string \" (ignoring case)\" will\n// be inserted into the message.\nAssertionResult EqFailure(const char* expected_expression,\n                          const char* actual_expression,\n                          const std::string& expected_value,\n                          const std::string& actual_value,\n                          bool ignoring_case) {\n  Message msg;\n  msg << \"Value of: \" << actual_expression;\n  if (actual_value != actual_expression) {\n    msg << \"\\n  Actual: \" << actual_value;\n  }\n\n  msg << \"\\nExpected: \" << expected_expression;\n  if (ignoring_case) {\n    msg << \" (ignoring case)\";\n  }\n  if (expected_value != expected_expression) {\n    msg << \"\\nWhich is: \" << expected_value;\n  }\n\n  return AssertionFailure() << msg;\n}\n\n// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.\nstd::string GetBoolAssertionFailureMessage(\n    const AssertionResult& assertion_result,\n    const char* expression_text,\n    const char* actual_predicate_value,\n    const char* expected_predicate_value) {\n  const char* actual_message = assertion_result.message();\n  Message msg;\n  msg << \"Value of: \" << expression_text\n      << \"\\n  Actual: \" << actual_predicate_value;\n  if (actual_message[0] != '\\0')\n    msg << \" (\" << actual_message << \")\";\n  msg << \"\\nExpected: \" << expected_predicate_value;\n  return msg.GetString();\n}\n\n// Helper function for implementing ASSERT_NEAR.\nAssertionResult DoubleNearPredFormat(const char* expr1,\n                                     const char* expr2,\n                                     const char* abs_error_expr,\n                                     double val1,\n                                     double val2,\n                                     double abs_error) {\n  const double diff = fabs(val1 - val2);\n  if (diff <= abs_error) return AssertionSuccess();\n\n  // TODO(wan): do not print the value of an expression if it's\n  // already a literal.\n  return AssertionFailure()\n      << \"The difference between \" << expr1 << \" and \" << expr2\n      << \" is \" << diff << \", which exceeds \" << abs_error_expr << \", where\\n\"\n      << expr1 << \" evaluates to \" << val1 << \",\\n\"\n      << expr2 << \" evaluates to \" << val2 << \", and\\n\"\n      << abs_error_expr << \" evaluates to \" << abs_error << \".\";\n}\n\n\n// Helper template for implementing FloatLE() and DoubleLE().\ntemplate <typename RawType>\nAssertionResult FloatingPointLE(const char* expr1,\n                                const char* expr2,\n                                RawType val1,\n                                RawType val2) {\n  // Returns success if val1 is less than val2,\n  if (val1 < val2) {\n    return AssertionSuccess();\n  }\n\n  // or if val1 is almost equal to val2.\n  const FloatingPoint<RawType> lhs(val1), rhs(val2);\n  if (lhs.AlmostEquals(rhs)) {\n    return AssertionSuccess();\n  }\n\n  // Note that the above two checks will both fail if either val1 or\n  // val2 is NaN, as the IEEE floating-point standard requires that\n  // any predicate involving a NaN must return false.\n\n  ::std::stringstream val1_ss;\n  val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n          << val1;\n\n  ::std::stringstream val2_ss;\n  val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)\n          << val2;\n\n  return AssertionFailure()\n      << \"Expected: (\" << expr1 << \") <= (\" << expr2 << \")\\n\"\n      << \"  Actual: \" << StringStreamToString(&val1_ss) << \" vs \"\n      << StringStreamToString(&val2_ss);\n}\n\n}  // namespace internal\n\n// Asserts that val1 is less than, or almost equal to, val2.  Fails\n// otherwise.  In particular, it fails if either val1 or val2 is NaN.\nAssertionResult FloatLE(const char* expr1, const char* expr2,\n                        float val1, float val2) {\n  return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);\n}\n\n// Asserts that val1 is less than, or almost equal to, val2.  Fails\n// otherwise.  In particular, it fails if either val1 or val2 is NaN.\nAssertionResult DoubleLE(const char* expr1, const char* expr2,\n                         double val1, double val2) {\n  return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);\n}\n\nnamespace internal {\n\n// The helper function for {ASSERT|EXPECT}_EQ with int or enum\n// arguments.\nAssertionResult CmpHelperEQ(const char* expected_expression,\n                            const char* actual_expression,\n                            BiggestInt expected,\n                            BiggestInt actual) {\n  if (expected == actual) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   FormatForComparisonFailureMessage(expected, actual),\n                   FormatForComparisonFailureMessage(actual, expected),\n                   false);\n}\n\n// A macro for implementing the helper functions needed to implement\n// ASSERT_?? and EXPECT_?? with integer or enum arguments.  It is here\n// just to avoid copy-and-paste of similar code.\n#define GTEST_IMPL_CMP_HELPER_(op_name, op)\\\nAssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \\\n                                   BiggestInt val1, BiggestInt val2) {\\\n  if (val1 op val2) {\\\n    return AssertionSuccess();\\\n  } else {\\\n    return AssertionFailure() \\\n        << \"Expected: (\" << expr1 << \") \" #op \" (\" << expr2\\\n        << \"), actual: \" << FormatForComparisonFailureMessage(val1, val2)\\\n        << \" vs \" << FormatForComparisonFailureMessage(val2, val1);\\\n  }\\\n}\n\n// Implements the helper function for {ASSERT|EXPECT}_NE with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(NE, !=)\n// Implements the helper function for {ASSERT|EXPECT}_LE with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(LE, <=)\n// Implements the helper function for {ASSERT|EXPECT}_LT with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(LT, < )\n// Implements the helper function for {ASSERT|EXPECT}_GE with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(GE, >=)\n// Implements the helper function for {ASSERT|EXPECT}_GT with int or\n// enum arguments.\nGTEST_IMPL_CMP_HELPER_(GT, > )\n\n#undef GTEST_IMPL_CMP_HELPER_\n\n// The helper function for {ASSERT|EXPECT}_STREQ.\nAssertionResult CmpHelperSTREQ(const char* expected_expression,\n                               const char* actual_expression,\n                               const char* expected,\n                               const char* actual) {\n  if (String::CStringEquals(expected, actual)) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   PrintToString(expected),\n                   PrintToString(actual),\n                   false);\n}\n\n// The helper function for {ASSERT|EXPECT}_STRCASEEQ.\nAssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,\n                                   const char* actual_expression,\n                                   const char* expected,\n                                   const char* actual) {\n  if (String::CaseInsensitiveCStringEquals(expected, actual)) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   PrintToString(expected),\n                   PrintToString(actual),\n                   true);\n}\n\n// The helper function for {ASSERT|EXPECT}_STRNE.\nAssertionResult CmpHelperSTRNE(const char* s1_expression,\n                               const char* s2_expression,\n                               const char* s1,\n                               const char* s2) {\n  if (!String::CStringEquals(s1, s2)) {\n    return AssertionSuccess();\n  } else {\n    return AssertionFailure() << \"Expected: (\" << s1_expression << \") != (\"\n                              << s2_expression << \"), actual: \\\"\"\n                              << s1 << \"\\\" vs \\\"\" << s2 << \"\\\"\";\n  }\n}\n\n// The helper function for {ASSERT|EXPECT}_STRCASENE.\nAssertionResult CmpHelperSTRCASENE(const char* s1_expression,\n                                   const char* s2_expression,\n                                   const char* s1,\n                                   const char* s2) {\n  if (!String::CaseInsensitiveCStringEquals(s1, s2)) {\n    return AssertionSuccess();\n  } else {\n    return AssertionFailure()\n        << \"Expected: (\" << s1_expression << \") != (\"\n        << s2_expression << \") (ignoring case), actual: \\\"\"\n        << s1 << \"\\\" vs \\\"\" << s2 << \"\\\"\";\n  }\n}\n\n}  // namespace internal\n\nnamespace {\n\n// Helper functions for implementing IsSubString() and IsNotSubstring().\n\n// This group of overloaded functions return true iff needle is a\n// substring of haystack.  NULL is considered a substring of itself\n// only.\n\nbool IsSubstringPred(const char* needle, const char* haystack) {\n  if (needle == NULL || haystack == NULL)\n    return needle == haystack;\n\n  return strstr(haystack, needle) != NULL;\n}\n\nbool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {\n  if (needle == NULL || haystack == NULL)\n    return needle == haystack;\n\n  return wcsstr(haystack, needle) != NULL;\n}\n\n// StringType here can be either ::std::string or ::std::wstring.\ntemplate <typename StringType>\nbool IsSubstringPred(const StringType& needle,\n                     const StringType& haystack) {\n  return haystack.find(needle) != StringType::npos;\n}\n\n// This function implements either IsSubstring() or IsNotSubstring(),\n// depending on the value of the expected_to_be_substring parameter.\n// StringType here can be const char*, const wchar_t*, ::std::string,\n// or ::std::wstring.\ntemplate <typename StringType>\nAssertionResult IsSubstringImpl(\n    bool expected_to_be_substring,\n    const char* needle_expr, const char* haystack_expr,\n    const StringType& needle, const StringType& haystack) {\n  if (IsSubstringPred(needle, haystack) == expected_to_be_substring)\n    return AssertionSuccess();\n\n  const bool is_wide_string = sizeof(needle[0]) > 1;\n  const char* const begin_string_quote = is_wide_string ? \"L\\\"\" : \"\\\"\";\n  return AssertionFailure()\n      << \"Value of: \" << needle_expr << \"\\n\"\n      << \"  Actual: \" << begin_string_quote << needle << \"\\\"\\n\"\n      << \"Expected: \" << (expected_to_be_substring ? \"\" : \"not \")\n      << \"a substring of \" << haystack_expr << \"\\n\"\n      << \"Which is: \" << begin_string_quote << haystack << \"\\\"\";\n}\n\n}  // namespace\n\n// IsSubstring() and IsNotSubstring() check whether needle is a\n// substring of haystack (NULL is considered a substring of itself\n// only), and return an appropriate error message when they fail.\n\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const char* needle, const char* haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const wchar_t* needle, const wchar_t* haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::string& needle, const ::std::string& haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n\n#if GTEST_HAS_STD_WSTRING\nAssertionResult IsSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack) {\n  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);\n}\n\nAssertionResult IsNotSubstring(\n    const char* needle_expr, const char* haystack_expr,\n    const ::std::wstring& needle, const ::std::wstring& haystack) {\n  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\nnamespace internal {\n\n#if GTEST_OS_WINDOWS\n\nnamespace {\n\n// Helper function for IsHRESULT{SuccessFailure} predicates\nAssertionResult HRESULTFailureHelper(const char* expr,\n                                     const char* expected,\n                                     long hr) {  // NOLINT\n# if GTEST_OS_WINDOWS_MOBILE\n\n  // Windows CE doesn't support FormatMessage.\n  const char error_text[] = \"\";\n\n# else\n\n  // Looks up the human-readable system message for the HRESULT code\n  // and since we're not passing any params to FormatMessage, we don't\n  // want inserts expanded.\n  const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |\n                       FORMAT_MESSAGE_IGNORE_INSERTS;\n  const DWORD kBufSize = 4096;\n  // Gets the system's human readable message string for this HRESULT.\n  char error_text[kBufSize] = { '\\0' };\n  DWORD message_length = ::FormatMessageA(kFlags,\n                                          0,  // no source, we're asking system\n                                          hr,  // the error\n                                          0,  // no line width restrictions\n                                          error_text,  // output buffer\n                                          kBufSize,  // buf size\n                                          NULL);  // no arguments for inserts\n  // Trims tailing white space (FormatMessage leaves a trailing CR-LF)\n  for (; message_length && IsSpace(error_text[message_length - 1]);\n          --message_length) {\n    error_text[message_length - 1] = '\\0';\n  }\n\n# endif  // GTEST_OS_WINDOWS_MOBILE\n\n  const std::string error_hex(\"0x\" + String::FormatHexInt(hr));\n  return ::testing::AssertionFailure()\n      << \"Expected: \" << expr << \" \" << expected << \".\\n\"\n      << \"  Actual: \" << error_hex << \" \" << error_text << \"\\n\";\n}\n\n}  // namespace\n\nAssertionResult IsHRESULTSuccess(const char* expr, long hr) {  // NOLINT\n  if (SUCCEEDED(hr)) {\n    return AssertionSuccess();\n  }\n  return HRESULTFailureHelper(expr, \"succeeds\", hr);\n}\n\nAssertionResult IsHRESULTFailure(const char* expr, long hr) {  // NOLINT\n  if (FAILED(hr)) {\n    return AssertionSuccess();\n  }\n  return HRESULTFailureHelper(expr, \"fails\", hr);\n}\n\n#endif  // GTEST_OS_WINDOWS\n\n// Utility functions for encoding Unicode text (wide strings) in\n// UTF-8.\n\n// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8\n// like this:\n//\n// Code-point length   Encoding\n//   0 -  7 bits       0xxxxxxx\n//   8 - 11 bits       110xxxxx 10xxxxxx\n//  12 - 16 bits       1110xxxx 10xxxxxx 10xxxxxx\n//  17 - 21 bits       11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n\n// The maximum code-point a one-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) <<  7) - 1;\n\n// The maximum code-point a two-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;\n\n// The maximum code-point a three-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;\n\n// The maximum code-point a four-byte UTF-8 sequence can represent.\nconst UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;\n\n// Chops off the n lowest bits from a bit pattern.  Returns the n\n// lowest bits.  As a side effect, the original bit pattern will be\n// shifted to the right by n bits.\ninline UInt32 ChopLowBits(UInt32* bits, int n) {\n  const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);\n  *bits >>= n;\n  return low_bits;\n}\n\n// Converts a Unicode code point to a narrow string in UTF-8 encoding.\n// code_point parameter is of type UInt32 because wchar_t may not be\n// wide enough to contain a code point.\n// If the code_point is not a valid Unicode code point\n// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted\n// to \"(Invalid Unicode 0xXXXXXXXX)\".\nstd::string CodePointToUtf8(UInt32 code_point) {\n  if (code_point > kMaxCodePoint4) {\n    return \"(Invalid Unicode 0x\" + String::FormatHexInt(code_point) + \")\";\n  }\n\n  char str[5];  // Big enough for the largest valid code point.\n  if (code_point <= kMaxCodePoint1) {\n    str[1] = '\\0';\n    str[0] = static_cast<char>(code_point);                          // 0xxxxxxx\n  } else if (code_point <= kMaxCodePoint2) {\n    str[2] = '\\0';\n    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[0] = static_cast<char>(0xC0 | code_point);                   // 110xxxxx\n  } else if (code_point <= kMaxCodePoint3) {\n    str[3] = '\\0';\n    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[0] = static_cast<char>(0xE0 | code_point);                   // 1110xxxx\n  } else {  // code_point <= kMaxCodePoint4\n    str[4] = '\\0';\n    str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx\n    str[0] = static_cast<char>(0xF0 | code_point);                   // 11110xxx\n  }\n  return str;\n}\n\n// The following two functions only make sense if the the system\n// uses UTF-16 for wide string encoding. All supported systems\n// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.\n\n// Determines if the arguments constitute UTF-16 surrogate pair\n// and thus should be combined into a single Unicode code point\n// using CreateCodePointFromUtf16SurrogatePair.\ninline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {\n  return sizeof(wchar_t) == 2 &&\n      (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;\n}\n\n// Creates a Unicode code point from UTF16 surrogate pair.\ninline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,\n                                                    wchar_t second) {\n  const UInt32 mask = (1 << 10) - 1;\n  return (sizeof(wchar_t) == 2) ?\n      (((first & mask) << 10) | (second & mask)) + 0x10000 :\n      // This function should not be called when the condition is\n      // false, but we provide a sensible default in case it is.\n      static_cast<UInt32>(first);\n}\n\n// Converts a wide string to a narrow string in UTF-8 encoding.\n// The wide string is assumed to have the following encoding:\n//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)\n//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)\n// Parameter str points to a null-terminated wide string.\n// Parameter num_chars may additionally limit the number\n// of wchar_t characters processed. -1 is used when the entire string\n// should be processed.\n// If the string contains code points that are not valid Unicode code points\n// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output\n// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding\n// and contains invalid UTF-16 surrogate pairs, values in those pairs\n// will be encoded as individual Unicode characters from Basic Normal Plane.\nstd::string WideStringToUtf8(const wchar_t* str, int num_chars) {\n  if (num_chars == -1)\n    num_chars = static_cast<int>(wcslen(str));\n\n  ::std::stringstream stream;\n  for (int i = 0; i < num_chars; ++i) {\n    UInt32 unicode_code_point;\n\n    if (str[i] == L'\\0') {\n      break;\n    } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {\n      unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],\n                                                                 str[i + 1]);\n      i++;\n    } else {\n      unicode_code_point = static_cast<UInt32>(str[i]);\n    }\n\n    stream << CodePointToUtf8(unicode_code_point);\n  }\n  return StringStreamToString(&stream);\n}\n\n// Converts a wide C string to an std::string using the UTF-8 encoding.\n// NULL will be converted to \"(null)\".\nstd::string String::ShowWideCString(const wchar_t * wide_c_str) {\n  if (wide_c_str == NULL)  return \"(null)\";\n\n  return internal::WideStringToUtf8(wide_c_str, -1);\n}\n\n// Compares two wide C strings.  Returns true iff they have the same\n// content.\n//\n// Unlike wcscmp(), this function can handle NULL argument(s).  A NULL\n// C string is considered different to any non-NULL C string,\n// including the empty string.\nbool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {\n  if (lhs == NULL) return rhs == NULL;\n\n  if (rhs == NULL) return false;\n\n  return wcscmp(lhs, rhs) == 0;\n}\n\n// Helper function for *_STREQ on wide strings.\nAssertionResult CmpHelperSTREQ(const char* expected_expression,\n                               const char* actual_expression,\n                               const wchar_t* expected,\n                               const wchar_t* actual) {\n  if (String::WideCStringEquals(expected, actual)) {\n    return AssertionSuccess();\n  }\n\n  return EqFailure(expected_expression,\n                   actual_expression,\n                   PrintToString(expected),\n                   PrintToString(actual),\n                   false);\n}\n\n// Helper function for *_STRNE on wide strings.\nAssertionResult CmpHelperSTRNE(const char* s1_expression,\n                               const char* s2_expression,\n                               const wchar_t* s1,\n                               const wchar_t* s2) {\n  if (!String::WideCStringEquals(s1, s2)) {\n    return AssertionSuccess();\n  }\n\n  return AssertionFailure() << \"Expected: (\" << s1_expression << \") != (\"\n                            << s2_expression << \"), actual: \"\n                            << PrintToString(s1)\n                            << \" vs \" << PrintToString(s2);\n}\n\n// Compares two C strings, ignoring case.  Returns true iff they have\n// the same content.\n//\n// Unlike strcasecmp(), this function can handle NULL argument(s).  A\n// NULL C string is considered different to any non-NULL C string,\n// including the empty string.\nbool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {\n  if (lhs == NULL)\n    return rhs == NULL;\n  if (rhs == NULL)\n    return false;\n  return posix::StrCaseCmp(lhs, rhs) == 0;\n}\n\n  // Compares two wide C strings, ignoring case.  Returns true iff they\n  // have the same content.\n  //\n  // Unlike wcscasecmp(), this function can handle NULL argument(s).\n  // A NULL C string is considered different to any non-NULL wide C string,\n  // including the empty string.\n  // NB: The implementations on different platforms slightly differ.\n  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE\n  // environment variable. On GNU platform this method uses wcscasecmp\n  // which compares according to LC_CTYPE category of the current locale.\n  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the\n  // current locale.\nbool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,\n                                              const wchar_t* rhs) {\n  if (lhs == NULL) return rhs == NULL;\n\n  if (rhs == NULL) return false;\n\n#if GTEST_OS_WINDOWS\n  return _wcsicmp(lhs, rhs) == 0;\n#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID\n  return wcscasecmp(lhs, rhs) == 0;\n#else\n  // Android, Mac OS X and Cygwin don't define wcscasecmp.\n  // Other unknown OSes may not define it either.\n  wint_t left, right;\n  do {\n    left = towlower(*lhs++);\n    right = towlower(*rhs++);\n  } while (left && left == right);\n  return left == right;\n#endif  // OS selector\n}\n\n// Returns true iff str ends with the given suffix, ignoring case.\n// Any string is considered to end with an empty suffix.\nbool String::EndsWithCaseInsensitive(\n    const std::string& str, const std::string& suffix) {\n  const size_t str_len = str.length();\n  const size_t suffix_len = suffix.length();\n  return (str_len >= suffix_len) &&\n         CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,\n                                      suffix.c_str());\n}\n\n// Formats an int value as \"%02d\".\nstd::string String::FormatIntWidth2(int value) {\n  std::stringstream ss;\n  ss << std::setfill('0') << std::setw(2) << value;\n  return ss.str();\n}\n\n// Formats an int value as \"%X\".\nstd::string String::FormatHexInt(int value) {\n  std::stringstream ss;\n  ss << std::hex << std::uppercase << value;\n  return ss.str();\n}\n\n// Formats a byte as \"%02X\".\nstd::string String::FormatByte(unsigned char value) {\n  std::stringstream ss;\n  ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase\n     << static_cast<unsigned int>(value);\n  return ss.str();\n}\n\n// Converts the buffer in a stringstream to an std::string, converting NUL\n// bytes to \"\\\\0\" along the way.\nstd::string StringStreamToString(::std::stringstream* ss) {\n  const ::std::string& str = ss->str();\n  const char* const start = str.c_str();\n  const char* const end = start + str.length();\n\n  std::string result;\n  result.reserve(2 * (end - start));\n  for (const char* ch = start; ch != end; ++ch) {\n    if (*ch == '\\0') {\n      result += \"\\\\0\";  // Replaces NUL with \"\\\\0\";\n    } else {\n      result += *ch;\n    }\n  }\n\n  return result;\n}\n\n// Appends the user-supplied message to the Google-Test-generated message.\nstd::string AppendUserMessage(const std::string& gtest_msg,\n                              const Message& user_msg) {\n  // Appends the user message if it's non-empty.\n  const std::string user_msg_string = user_msg.GetString();\n  if (user_msg_string.empty()) {\n    return gtest_msg;\n  }\n\n  return gtest_msg + \"\\n\" + user_msg_string;\n}\n\n}  // namespace internal\n\n// class TestResult\n\n// Creates an empty TestResult.\nTestResult::TestResult()\n    : death_test_count_(0),\n      elapsed_time_(0) {\n}\n\n// D'tor.\nTestResult::~TestResult() {\n}\n\n// Returns the i-th test part result among all the results. i can\n// range from 0 to total_part_count() - 1. If i is not in that range,\n// aborts the program.\nconst TestPartResult& TestResult::GetTestPartResult(int i) const {\n  if (i < 0 || i >= total_part_count())\n    internal::posix::Abort();\n  return test_part_results_.at(i);\n}\n\n// Returns the i-th test property. i can range from 0 to\n// test_property_count() - 1. If i is not in that range, aborts the\n// program.\nconst TestProperty& TestResult::GetTestProperty(int i) const {\n  if (i < 0 || i >= test_property_count())\n    internal::posix::Abort();\n  return test_properties_.at(i);\n}\n\n// Clears the test part results.\nvoid TestResult::ClearTestPartResults() {\n  test_part_results_.clear();\n}\n\n// Adds a test part result to the list.\nvoid TestResult::AddTestPartResult(const TestPartResult& test_part_result) {\n  test_part_results_.push_back(test_part_result);\n}\n\n// Adds a test property to the list. If a property with the same key as the\n// supplied property is already represented, the value of this test_property\n// replaces the old value for that key.\nvoid TestResult::RecordProperty(const std::string& xml_element,\n                                const TestProperty& test_property) {\n  if (!ValidateTestProperty(xml_element, test_property)) {\n    return;\n  }\n  internal::MutexLock lock(&test_properites_mutex_);\n  const std::vector<TestProperty>::iterator property_with_matching_key =\n      std::find_if(test_properties_.begin(), test_properties_.end(),\n                   internal::TestPropertyKeyIs(test_property.key()));\n  if (property_with_matching_key == test_properties_.end()) {\n    test_properties_.push_back(test_property);\n    return;\n  }\n  property_with_matching_key->SetValue(test_property.value());\n}\n\n// The list of reserved attributes used in the <testsuites> element of XML\n// output.\nstatic const char* const kReservedTestSuitesAttributes[] = {\n  \"disabled\",\n  \"errors\",\n  \"failures\",\n  \"name\",\n  \"random_seed\",\n  \"tests\",\n  \"time\",\n  \"timestamp\"\n};\n\n// The list of reserved attributes used in the <testsuite> element of XML\n// output.\nstatic const char* const kReservedTestSuiteAttributes[] = {\n  \"disabled\",\n  \"errors\",\n  \"failures\",\n  \"name\",\n  \"tests\",\n  \"time\"\n};\n\n// The list of reserved attributes used in the <testcase> element of XML output.\nstatic const char* const kReservedTestCaseAttributes[] = {\n  \"classname\",\n  \"name\",\n  \"status\",\n  \"time\",\n  \"type_param\",\n  \"value_param\"\n};\n\ntemplate <int kSize>\nstd::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {\n  return std::vector<std::string>(array, array + kSize);\n}\n\nstatic std::vector<std::string> GetReservedAttributesForElement(\n    const std::string& xml_element) {\n  if (xml_element == \"testsuites\") {\n    return ArrayAsVector(kReservedTestSuitesAttributes);\n  } else if (xml_element == \"testsuite\") {\n    return ArrayAsVector(kReservedTestSuiteAttributes);\n  } else if (xml_element == \"testcase\") {\n    return ArrayAsVector(kReservedTestCaseAttributes);\n  } else {\n    GTEST_CHECK_(false) << \"Unrecognized xml_element provided: \" << xml_element;\n  }\n  // This code is unreachable but some compilers may not realizes that.\n  return std::vector<std::string>();\n}\n\nstatic std::string FormatWordList(const std::vector<std::string>& words) {\n  Message word_list;\n  for (size_t i = 0; i < words.size(); ++i) {\n    if (i > 0 && words.size() > 2) {\n      word_list << \", \";\n    }\n    if (i == words.size() - 1) {\n      word_list << \"and \";\n    }\n    word_list << \"'\" << words[i] << \"'\";\n  }\n  return word_list.GetString();\n}\n\nbool ValidateTestPropertyName(const std::string& property_name,\n                              const std::vector<std::string>& reserved_names) {\n  if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=\n          reserved_names.end()) {\n    ADD_FAILURE() << \"Reserved key used in RecordProperty(): \" << property_name\n                  << \" (\" << FormatWordList(reserved_names)\n                  << \" are reserved by \" << GTEST_NAME_ << \")\";\n    return false;\n  }\n  return true;\n}\n\n// Adds a failure if the key is a reserved attribute of the element named\n// xml_element.  Returns true if the property is valid.\nbool TestResult::ValidateTestProperty(const std::string& xml_element,\n                                      const TestProperty& test_property) {\n  return ValidateTestPropertyName(test_property.key(),\n                                  GetReservedAttributesForElement(xml_element));\n}\n\n// Clears the object.\nvoid TestResult::Clear() {\n  test_part_results_.clear();\n  test_properties_.clear();\n  death_test_count_ = 0;\n  elapsed_time_ = 0;\n}\n\n// Returns true iff the test failed.\nbool TestResult::Failed() const {\n  for (int i = 0; i < total_part_count(); ++i) {\n    if (GetTestPartResult(i).failed())\n      return true;\n  }\n  return false;\n}\n\n// Returns true iff the test part fatally failed.\nstatic bool TestPartFatallyFailed(const TestPartResult& result) {\n  return result.fatally_failed();\n}\n\n// Returns true iff the test fatally failed.\nbool TestResult::HasFatalFailure() const {\n  return CountIf(test_part_results_, TestPartFatallyFailed) > 0;\n}\n\n// Returns true iff the test part non-fatally failed.\nstatic bool TestPartNonfatallyFailed(const TestPartResult& result) {\n  return result.nonfatally_failed();\n}\n\n// Returns true iff the test has a non-fatal failure.\nbool TestResult::HasNonfatalFailure() const {\n  return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;\n}\n\n// Gets the number of all test parts.  This is the sum of the number\n// of successful test parts and the number of failed test parts.\nint TestResult::total_part_count() const {\n  return static_cast<int>(test_part_results_.size());\n}\n\n// Returns the number of the test properties.\nint TestResult::test_property_count() const {\n  return static_cast<int>(test_properties_.size());\n}\n\n// class Test\n\n// Creates a Test object.\n\n// The c'tor saves the values of all Google Test flags.\nTest::Test()\n    : gtest_flag_saver_(new internal::GTestFlagSaver) {\n}\n\n// The d'tor restores the values of all Google Test flags.\nTest::~Test() {\n  delete gtest_flag_saver_;\n}\n\n// Sets up the test fixture.\n//\n// A sub-class may override this.\nvoid Test::SetUp() {\n}\n\n// Tears down the test fixture.\n//\n// A sub-class may override this.\nvoid Test::TearDown() {\n}\n\n// Allows user supplied key value pairs to be recorded for later output.\nvoid Test::RecordProperty(const std::string& key, const std::string& value) {\n  UnitTest::GetInstance()->RecordProperty(key, value);\n}\n\n// Allows user supplied key value pairs to be recorded for later output.\nvoid Test::RecordProperty(const std::string& key, int value) {\n  Message value_message;\n  value_message << value;\n  RecordProperty(key, value_message.GetString().c_str());\n}\n\nnamespace internal {\n\nvoid ReportFailureInUnknownLocation(TestPartResult::Type result_type,\n                                    const std::string& message) {\n  // This function is a friend of UnitTest and as such has access to\n  // AddTestPartResult.\n  UnitTest::GetInstance()->AddTestPartResult(\n      result_type,\n      NULL,  // No info about the source file where the exception occurred.\n      -1,    // We have no info on which line caused the exception.\n      message,\n      \"\");   // No stack trace, either.\n}\n\n}  // namespace internal\n\n// Google Test requires all tests in the same test case to use the same test\n// fixture class.  This function checks if the current test has the\n// same fixture class as the first test in the current test case.  If\n// yes, it returns true; otherwise it generates a Google Test failure and\n// returns false.\nbool Test::HasSameFixtureClass() {\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  const TestCase* const test_case = impl->current_test_case();\n\n  // Info about the first test in the current test case.\n  const TestInfo* const first_test_info = test_case->test_info_list()[0];\n  const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_;\n  const char* const first_test_name = first_test_info->name();\n\n  // Info about the current test.\n  const TestInfo* const this_test_info = impl->current_test_info();\n  const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_;\n  const char* const this_test_name = this_test_info->name();\n\n  if (this_fixture_id != first_fixture_id) {\n    // Is the first test defined using TEST?\n    const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();\n    // Is this test defined using TEST?\n    const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();\n\n    if (first_is_TEST || this_is_TEST) {\n      // The user mixed TEST and TEST_F in this test case - we'll tell\n      // him/her how to fix it.\n\n      // Gets the name of the TEST and the name of the TEST_F.  Note\n      // that first_is_TEST and this_is_TEST cannot both be true, as\n      // the fixture IDs are different for the two tests.\n      const char* const TEST_name =\n          first_is_TEST ? first_test_name : this_test_name;\n      const char* const TEST_F_name =\n          first_is_TEST ? this_test_name : first_test_name;\n\n      ADD_FAILURE()\n          << \"All tests in the same test case must use the same test fixture\\n\"\n          << \"class, so mixing TEST_F and TEST in the same test case is\\n\"\n          << \"illegal.  In test case \" << this_test_info->test_case_name()\n          << \",\\n\"\n          << \"test \" << TEST_F_name << \" is defined using TEST_F but\\n\"\n          << \"test \" << TEST_name << \" is defined using TEST.  You probably\\n\"\n          << \"want to change the TEST to TEST_F or move it to another test\\n\"\n          << \"case.\";\n    } else {\n      // The user defined two fixture classes with the same name in\n      // two namespaces - we'll tell him/her how to fix it.\n      ADD_FAILURE()\n          << \"All tests in the same test case must use the same test fixture\\n\"\n          << \"class.  However, in test case \"\n          << this_test_info->test_case_name() << \",\\n\"\n          << \"you defined test \" << first_test_name\n          << \" and test \" << this_test_name << \"\\n\"\n          << \"using two different test fixture classes.  This can happen if\\n\"\n          << \"the two classes are from different namespaces or translation\\n\"\n          << \"units and have the same name.  You should probably rename one\\n\"\n          << \"of the classes to put the tests into different test cases.\";\n    }\n    return false;\n  }\n\n  return true;\n}\n\n#if GTEST_HAS_SEH\n\n// Adds an \"exception thrown\" fatal failure to the current test.  This\n// function returns its result via an output parameter pointer because VC++\n// prohibits creation of objects with destructors on stack in functions\n// using __try (see error C2712).\nstatic std::string* FormatSehExceptionMessage(DWORD exception_code,\n                                              const char* location) {\n  Message message;\n  message << \"SEH exception with code 0x\" << std::setbase(16) <<\n    exception_code << std::setbase(10) << \" thrown in \" << location << \".\";\n\n  return new std::string(message.GetString());\n}\n\n#endif  // GTEST_HAS_SEH\n\nnamespace internal {\n\n#if GTEST_HAS_EXCEPTIONS\n\n// Adds an \"exception thrown\" fatal failure to the current test.\nstatic std::string FormatCxxExceptionMessage(const char* description,\n                                             const char* location) {\n  Message message;\n  if (description != NULL) {\n    message << \"C++ exception with description \\\"\" << description << \"\\\"\";\n  } else {\n    message << \"Unknown C++ exception\";\n  }\n  message << \" thrown in \" << location << \".\";\n\n  return message.GetString();\n}\n\nstatic std::string PrintTestPartResultToString(\n    const TestPartResult& test_part_result);\n\nGoogleTestFailureException::GoogleTestFailureException(\n    const TestPartResult& failure)\n    : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// We put these helper functions in the internal namespace as IBM's xlC\n// compiler rejects the code if they were declared static.\n\n// Runs the given method and handles SEH exceptions it throws, when\n// SEH is supported; returns the 0-value for type Result in case of an\n// SEH exception.  (Microsoft compilers cannot handle SEH and C++\n// exceptions in the same function.  Therefore, we provide a separate\n// wrapper function for handling SEH exceptions.)\ntemplate <class T, typename Result>\nResult HandleSehExceptionsInMethodIfSupported(\n    T* object, Result (T::*method)(), const char* location) {\n#if GTEST_HAS_SEH\n  __try {\n    return (object->*method)();\n  } __except (internal::UnitTestOptions::GTestShouldProcessSEH(  // NOLINT\n      GetExceptionCode())) {\n    // We create the exception message on the heap because VC++ prohibits\n    // creation of objects with destructors on stack in functions using __try\n    // (see error C2712).\n    std::string* exception_message = FormatSehExceptionMessage(\n        GetExceptionCode(), location);\n    internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,\n                                             *exception_message);\n    delete exception_message;\n    return static_cast<Result>(0);\n  }\n#else\n  (void)location;\n  return (object->*method)();\n#endif  // GTEST_HAS_SEH\n}\n\n// Runs the given method and catches and reports C++ and/or SEH-style\n// exceptions, if they are supported; returns the 0-value for type\n// Result in case of an SEH exception.\ntemplate <class T, typename Result>\nResult HandleExceptionsInMethodIfSupported(\n    T* object, Result (T::*method)(), const char* location) {\n  // NOTE: The user code can affect the way in which Google Test handles\n  // exceptions by setting GTEST_FLAG(catch_exceptions), but only before\n  // RUN_ALL_TESTS() starts. It is technically possible to check the flag\n  // after the exception is caught and either report or re-throw the\n  // exception based on the flag's value:\n  //\n  // try {\n  //   // Perform the test method.\n  // } catch (...) {\n  //   if (GTEST_FLAG(catch_exceptions))\n  //     // Report the exception as failure.\n  //   else\n  //     throw;  // Re-throws the original exception.\n  // }\n  //\n  // However, the purpose of this flag is to allow the program to drop into\n  // the debugger when the exception is thrown. On most platforms, once the\n  // control enters the catch block, the exception origin information is\n  // lost and the debugger will stop the program at the point of the\n  // re-throw in this function -- instead of at the point of the original\n  // throw statement in the code under test.  For this reason, we perform\n  // the check early, sacrificing the ability to affect Google Test's\n  // exception handling in the method where the exception is thrown.\n  if (internal::GetUnitTestImpl()->catch_exceptions()) {\n#if GTEST_HAS_EXCEPTIONS\n    try {\n      return HandleSehExceptionsInMethodIfSupported(object, method, location);\n    } catch (const internal::GoogleTestFailureException&) {  // NOLINT\n      // This exception type can only be thrown by a failed Google\n      // Test assertion with the intention of letting another testing\n      // framework catch it.  Therefore we just re-throw it.\n      throw;\n    } catch (const std::exception& e) {  // NOLINT\n      internal::ReportFailureInUnknownLocation(\n          TestPartResult::kFatalFailure,\n          FormatCxxExceptionMessage(e.what(), location));\n    } catch (...) {  // NOLINT\n      internal::ReportFailureInUnknownLocation(\n          TestPartResult::kFatalFailure,\n          FormatCxxExceptionMessage(NULL, location));\n    }\n    return static_cast<Result>(0);\n#else\n    return HandleSehExceptionsInMethodIfSupported(object, method, location);\n#endif  // GTEST_HAS_EXCEPTIONS\n  } else {\n    return (object->*method)();\n  }\n}\n\n}  // namespace internal\n\n// Runs the test and updates the test result.\nvoid Test::Run() {\n  if (!HasSameFixtureClass()) return;\n\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, \"SetUp()\");\n  // We will run the test only if SetUp() was successful.\n  if (!HasFatalFailure()) {\n    impl->os_stack_trace_getter()->UponLeavingGTest();\n    internal::HandleExceptionsInMethodIfSupported(\n        this, &Test::TestBody, \"the test body\");\n  }\n\n  // However, we want to clean up as much as possible.  Hence we will\n  // always call TearDown(), even if SetUp() or the test body has\n  // failed.\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      this, &Test::TearDown, \"TearDown()\");\n}\n\n// Returns true iff the current test has a fatal failure.\nbool Test::HasFatalFailure() {\n  return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();\n}\n\n// Returns true iff the current test has a non-fatal failure.\nbool Test::HasNonfatalFailure() {\n  return internal::GetUnitTestImpl()->current_test_result()->\n      HasNonfatalFailure();\n}\n\n// class TestInfo\n\n// Constructs a TestInfo object. It assumes ownership of the test factory\n// object.\nTestInfo::TestInfo(const std::string& a_test_case_name,\n                   const std::string& a_name,\n                   const char* a_type_param,\n                   const char* a_value_param,\n                   internal::TypeId fixture_class_id,\n                   internal::TestFactoryBase* factory)\n    : test_case_name_(a_test_case_name),\n      name_(a_name),\n      type_param_(a_type_param ? new std::string(a_type_param) : NULL),\n      value_param_(a_value_param ? new std::string(a_value_param) : NULL),\n      fixture_class_id_(fixture_class_id),\n      should_run_(false),\n      is_disabled_(false),\n      matches_filter_(false),\n      factory_(factory),\n      result_() {}\n\n// Destructs a TestInfo object.\nTestInfo::~TestInfo() { delete factory_; }\n\nnamespace internal {\n\n// Creates a new TestInfo object and registers it with Google Test;\n// returns the created object.\n//\n// Arguments:\n//\n//   test_case_name:   name of the test case\n//   name:             name of the test\n//   type_param:       the name of the test's type parameter, or NULL if\n//                     this is not a typed or a type-parameterized test.\n//   value_param:      text representation of the test's value parameter,\n//                     or NULL if this is not a value-parameterized test.\n//   fixture_class_id: ID of the test fixture class\n//   set_up_tc:        pointer to the function that sets up the test case\n//   tear_down_tc:     pointer to the function that tears down the test case\n//   factory:          pointer to the factory that creates a test object.\n//                     The newly created TestInfo instance will assume\n//                     ownership of the factory object.\nTestInfo* MakeAndRegisterTestInfo(\n    const char* test_case_name,\n    const char* name,\n    const char* type_param,\n    const char* value_param,\n    TypeId fixture_class_id,\n    SetUpTestCaseFunc set_up_tc,\n    TearDownTestCaseFunc tear_down_tc,\n    TestFactoryBase* factory) {\n  TestInfo* const test_info =\n      new TestInfo(test_case_name, name, type_param, value_param,\n                   fixture_class_id, factory);\n  GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);\n  return test_info;\n}\n\n#if GTEST_HAS_PARAM_TEST\nvoid ReportInvalidTestCaseType(const char* test_case_name,\n                               const char* file, int line) {\n  Message errors;\n  errors\n      << \"Attempted redefinition of test case \" << test_case_name << \".\\n\"\n      << \"All tests in the same test case must use the same test fixture\\n\"\n      << \"class.  However, in test case \" << test_case_name << \", you tried\\n\"\n      << \"to define a test using a fixture class different from the one\\n\"\n      << \"used earlier. This can happen if the two fixture classes are\\n\"\n      << \"from different namespaces and have the same name. You should\\n\"\n      << \"probably rename one of the classes to put the tests into different\\n\"\n      << \"test cases.\";\n\n  fprintf(stderr, \"%s %s\", FormatFileLocation(file, line).c_str(),\n          errors.GetString().c_str());\n}\n#endif  // GTEST_HAS_PARAM_TEST\n\n}  // namespace internal\n\nnamespace {\n\n// A predicate that checks the test name of a TestInfo against a known\n// value.\n//\n// This is used for implementation of the TestCase class only.  We put\n// it in the anonymous namespace to prevent polluting the outer\n// namespace.\n//\n// TestNameIs is copyable.\nclass TestNameIs {\n public:\n  // Constructor.\n  //\n  // TestNameIs has NO default constructor.\n  explicit TestNameIs(const char* name)\n      : name_(name) {}\n\n  // Returns true iff the test name of test_info matches name_.\n  bool operator()(const TestInfo * test_info) const {\n    return test_info && test_info->name() == name_;\n  }\n\n private:\n  std::string name_;\n};\n\n}  // namespace\n\nnamespace internal {\n\n// This method expands all parameterized tests registered with macros TEST_P\n// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.\n// This will be done just once during the program runtime.\nvoid UnitTestImpl::RegisterParameterizedTests() {\n#if GTEST_HAS_PARAM_TEST\n  if (!parameterized_tests_registered_) {\n    parameterized_test_registry_.RegisterTests();\n    parameterized_tests_registered_ = true;\n  }\n#endif\n}\n\n}  // namespace internal\n\n// Creates the test object, runs it, records its result, and then\n// deletes it.\nvoid TestInfo::Run() {\n  if (!should_run_) return;\n\n  // Tells UnitTest where to store test result.\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  impl->set_current_test_info(this);\n\n  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();\n\n  // Notifies the unit test event listeners that a test is about to start.\n  repeater->OnTestStart(*this);\n\n  const TimeInMillis start = internal::GetTimeInMillis();\n\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n\n  // Creates the test object.\n  Test* const test = internal::HandleExceptionsInMethodIfSupported(\n      factory_, &internal::TestFactoryBase::CreateTest,\n      \"the test fixture's constructor\");\n\n  // Runs the test only if the test object was created and its\n  // constructor didn't generate a fatal failure.\n  if ((test != NULL) && !Test::HasFatalFailure()) {\n    // This doesn't throw as all user code that can throw are wrapped into\n    // exception handling code.\n    test->Run();\n  }\n\n  // Deletes the test object.\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      test, &Test::DeleteSelf_, \"the test fixture's destructor\");\n\n  result_.set_elapsed_time(internal::GetTimeInMillis() - start);\n\n  // Notifies the unit test event listener that a test has just finished.\n  repeater->OnTestEnd(*this);\n\n  // Tells UnitTest to stop associating assertion results to this\n  // test.\n  impl->set_current_test_info(NULL);\n}\n\n// class TestCase\n\n// Gets the number of successful tests in this test case.\nint TestCase::successful_test_count() const {\n  return CountIf(test_info_list_, TestPassed);\n}\n\n// Gets the number of failed tests in this test case.\nint TestCase::failed_test_count() const {\n  return CountIf(test_info_list_, TestFailed);\n}\n\n// Gets the number of disabled tests that will be reported in the XML report.\nint TestCase::reportable_disabled_test_count() const {\n  return CountIf(test_info_list_, TestReportableDisabled);\n}\n\n// Gets the number of disabled tests in this test case.\nint TestCase::disabled_test_count() const {\n  return CountIf(test_info_list_, TestDisabled);\n}\n\n// Gets the number of tests to be printed in the XML report.\nint TestCase::reportable_test_count() const {\n  return CountIf(test_info_list_, TestReportable);\n}\n\n// Get the number of tests in this test case that should run.\nint TestCase::test_to_run_count() const {\n  return CountIf(test_info_list_, ShouldRunTest);\n}\n\n// Gets the number of all tests.\nint TestCase::total_test_count() const {\n  return static_cast<int>(test_info_list_.size());\n}\n\n// Creates a TestCase with the given name.\n//\n// Arguments:\n//\n//   name:         name of the test case\n//   a_type_param: the name of the test case's type parameter, or NULL if\n//                 this is not a typed or a type-parameterized test case.\n//   set_up_tc:    pointer to the function that sets up the test case\n//   tear_down_tc: pointer to the function that tears down the test case\nTestCase::TestCase(const char* a_name, const char* a_type_param,\n                   Test::SetUpTestCaseFunc set_up_tc,\n                   Test::TearDownTestCaseFunc tear_down_tc)\n    : name_(a_name),\n      type_param_(a_type_param ? new std::string(a_type_param) : NULL),\n      set_up_tc_(set_up_tc),\n      tear_down_tc_(tear_down_tc),\n      should_run_(false),\n      elapsed_time_(0) {\n}\n\n// Destructor of TestCase.\nTestCase::~TestCase() {\n  // Deletes every Test in the collection.\n  ForEach(test_info_list_, internal::Delete<TestInfo>);\n}\n\n// Returns the i-th test among all the tests. i can range from 0 to\n// total_test_count() - 1. If i is not in that range, returns NULL.\nconst TestInfo* TestCase::GetTestInfo(int i) const {\n  const int index = GetElementOr(test_indices_, i, -1);\n  return index < 0 ? NULL : test_info_list_[index];\n}\n\n// Returns the i-th test among all the tests. i can range from 0 to\n// total_test_count() - 1. If i is not in that range, returns NULL.\nTestInfo* TestCase::GetMutableTestInfo(int i) {\n  const int index = GetElementOr(test_indices_, i, -1);\n  return index < 0 ? NULL : test_info_list_[index];\n}\n\n// Adds a test to this test case.  Will delete the test upon\n// destruction of the TestCase object.\nvoid TestCase::AddTestInfo(TestInfo * test_info) {\n  test_info_list_.push_back(test_info);\n  test_indices_.push_back(static_cast<int>(test_indices_.size()));\n}\n\n// Runs every test in this TestCase.\nvoid TestCase::Run() {\n  if (!should_run_) return;\n\n  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();\n  impl->set_current_test_case(this);\n\n  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();\n\n  repeater->OnTestCaseStart(*this);\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      this, &TestCase::RunSetUpTestCase, \"SetUpTestCase()\");\n\n  const internal::TimeInMillis start = internal::GetTimeInMillis();\n  for (int i = 0; i < total_test_count(); i++) {\n    GetMutableTestInfo(i)->Run();\n  }\n  elapsed_time_ = internal::GetTimeInMillis() - start;\n\n  impl->os_stack_trace_getter()->UponLeavingGTest();\n  internal::HandleExceptionsInMethodIfSupported(\n      this, &TestCase::RunTearDownTestCase, \"TearDownTestCase()\");\n\n  repeater->OnTestCaseEnd(*this);\n  impl->set_current_test_case(NULL);\n}\n\n// Clears the results of all tests in this test case.\nvoid TestCase::ClearResult() {\n  ad_hoc_test_result_.Clear();\n  ForEach(test_info_list_, TestInfo::ClearTestResult);\n}\n\n// Shuffles the tests in this test case.\nvoid TestCase::ShuffleTests(internal::Random* random) {\n  Shuffle(random, &test_indices_);\n}\n\n// Restores the test order to before the first shuffle.\nvoid TestCase::UnshuffleTests() {\n  for (size_t i = 0; i < test_indices_.size(); i++) {\n    test_indices_[i] = static_cast<int>(i);\n  }\n}\n\n// Formats a countable noun.  Depending on its quantity, either the\n// singular form or the plural form is used. e.g.\n//\n// FormatCountableNoun(1, \"formula\", \"formuli\") returns \"1 formula\".\n// FormatCountableNoun(5, \"book\", \"books\") returns \"5 books\".\nstatic std::string FormatCountableNoun(int count,\n                                       const char * singular_form,\n                                       const char * plural_form) {\n  return internal::StreamableToString(count) + \" \" +\n      (count == 1 ? singular_form : plural_form);\n}\n\n// Formats the count of tests.\nstatic std::string FormatTestCount(int test_count) {\n  return FormatCountableNoun(test_count, \"test\", \"tests\");\n}\n\n// Formats the count of test cases.\nstatic std::string FormatTestCaseCount(int test_case_count) {\n  return FormatCountableNoun(test_case_count, \"test case\", \"test cases\");\n}\n\n// Converts a TestPartResult::Type enum to human-friendly string\n// representation.  Both kNonFatalFailure and kFatalFailure are translated\n// to \"Failure\", as the user usually doesn't care about the difference\n// between the two when viewing the test result.\nstatic const char * TestPartResultTypeToString(TestPartResult::Type type) {\n  switch (type) {\n    case TestPartResult::kSuccess:\n      return \"Success\";\n\n    case TestPartResult::kNonFatalFailure:\n    case TestPartResult::kFatalFailure:\n#ifdef _MSC_VER\n      return \"error: \";\n#else\n      return \"Failure\\n\";\n#endif\n    default:\n      return \"Unknown result type\";\n  }\n}\n\nnamespace internal {\n\n// Prints a TestPartResult to an std::string.\nstatic std::string PrintTestPartResultToString(\n    const TestPartResult& test_part_result) {\n  return (Message()\n          << internal::FormatFileLocation(test_part_result.file_name(),\n                                          test_part_result.line_number())\n          << \" \" << TestPartResultTypeToString(test_part_result.type())\n          << test_part_result.message()).GetString();\n}\n\n// Prints a TestPartResult.\nstatic void PrintTestPartResult(const TestPartResult& test_part_result) {\n  const std::string& result =\n      PrintTestPartResultToString(test_part_result);\n  printf(\"%s\\n\", result.c_str());\n  fflush(stdout);\n  // If the test program runs in Visual Studio or a debugger, the\n  // following statements add the test part result message to the Output\n  // window such that the user can double-click on it to jump to the\n  // corresponding source code location; otherwise they do nothing.\n#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n  // We don't call OutputDebugString*() on Windows Mobile, as printing\n  // to stdout is done by OutputDebugString() there already - we don't\n  // want the same message printed twice.\n  ::OutputDebugStringA(result.c_str());\n  ::OutputDebugStringA(\"\\n\");\n#endif\n}\n\n// class PrettyUnitTestResultPrinter\n\nenum GTestColor {\n  COLOR_DEFAULT,\n  COLOR_RED,\n  COLOR_GREEN,\n  COLOR_YELLOW\n};\n\n#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n\n// Returns the character attribute for the given color.\nWORD GetColorAttribute(GTestColor color) {\n  switch (color) {\n    case COLOR_RED:    return FOREGROUND_RED;\n    case COLOR_GREEN:  return FOREGROUND_GREEN;\n    case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;\n    default:           return 0;\n  }\n}\n\n#else\n\n// Returns the ANSI color code for the given color.  COLOR_DEFAULT is\n// an invalid input.\nconst char* GetAnsiColorCode(GTestColor color) {\n  switch (color) {\n    case COLOR_RED:     return \"1\";\n    case COLOR_GREEN:   return \"2\";\n    case COLOR_YELLOW:  return \"3\";\n    default:            return NULL;\n  };\n}\n\n#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n\n// Returns true iff Google Test should use colors in the output.\nbool ShouldUseColor(bool stdout_is_tty) {\n  const char* const gtest_color = GTEST_FLAG(color).c_str();\n\n  if (String::CaseInsensitiveCStringEquals(gtest_color, \"auto\")) {\n#if GTEST_OS_WINDOWS\n    // On Windows the TERM variable is usually not set, but the\n    // console there does support colors.\n    return stdout_is_tty;\n#else\n    // On non-Windows platforms, we rely on the TERM variable.\n    const char* const term = posix::GetEnv(\"TERM\");\n    const bool term_supports_color =\n        String::CStringEquals(term, \"xterm\") ||\n        String::CStringEquals(term, \"xterm-color\") ||\n        String::CStringEquals(term, \"xterm-256color\") ||\n        String::CStringEquals(term, \"screen\") ||\n        String::CStringEquals(term, \"screen-256color\") ||\n        String::CStringEquals(term, \"linux\") ||\n        String::CStringEquals(term, \"cygwin\");\n    return stdout_is_tty && term_supports_color;\n#endif  // GTEST_OS_WINDOWS\n  }\n\n  return String::CaseInsensitiveCStringEquals(gtest_color, \"yes\") ||\n      String::CaseInsensitiveCStringEquals(gtest_color, \"true\") ||\n      String::CaseInsensitiveCStringEquals(gtest_color, \"t\") ||\n      String::CStringEquals(gtest_color, \"1\");\n  // We take \"yes\", \"true\", \"t\", and \"1\" as meaning \"yes\".  If the\n  // value is neither one of these nor \"auto\", we treat it as \"no\" to\n  // be conservative.\n}\n\n// Helpers for printing colored strings to stdout. Note that on Windows, we\n// cannot simply emit special characters and have the terminal change colors.\n// This routine must actually emit the characters rather than return a string\n// that would be colored when printed, as can be done on Linux.\nvoid ColoredPrintf(GTestColor color, const char* fmt, ...) {\n  va_list args;\n  va_start(args, fmt);\n\n#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || GTEST_OS_IOS\n  const bool use_color = false;\n#else\n  static const bool in_color_mode =\n      ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);\n  const bool use_color = in_color_mode && (color != COLOR_DEFAULT);\n#endif  // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS\n  // The '!= 0' comparison is necessary to satisfy MSVC 7.1.\n\n  if (!use_color) {\n    vprintf(fmt, args);\n    va_end(args);\n    return;\n  }\n\n#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n  const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);\n\n  // Gets the current text color.\n  CONSOLE_SCREEN_BUFFER_INFO buffer_info;\n  GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);\n  const WORD old_color_attrs = buffer_info.wAttributes;\n\n  // We need to flush the stream buffers into the console before each\n  // SetConsoleTextAttribute call lest it affect the text that is already\n  // printed but has not yet reached the console.\n  fflush(stdout);\n  SetConsoleTextAttribute(stdout_handle,\n                          GetColorAttribute(color) | FOREGROUND_INTENSITY);\n  vprintf(fmt, args);\n\n  fflush(stdout);\n  // Restores the text color.\n  SetConsoleTextAttribute(stdout_handle, old_color_attrs);\n#else\n  printf(\"\\033[0;3%sm\", GetAnsiColorCode(color));\n  vprintf(fmt, args);\n  printf(\"\\033[m\");  // Resets the terminal to default.\n#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE\n  va_end(args);\n}\n\n// Text printed in Google Test's text output and --gunit_list_tests\n// output to label the type parameter and value parameter for a test.\nstatic const char kTypeParamLabel[] = \"TypeParam\";\nstatic const char kValueParamLabel[] = \"GetParam()\";\n\nvoid PrintFullTestCommentIfPresent(const TestInfo& test_info) {\n  const char* const type_param = test_info.type_param();\n  const char* const value_param = test_info.value_param();\n\n  if (type_param != NULL || value_param != NULL) {\n    printf(\", where \");\n    if (type_param != NULL) {\n      printf(\"%s = %s\", kTypeParamLabel, type_param);\n      if (value_param != NULL)\n        printf(\" and \");\n    }\n    if (value_param != NULL) {\n      printf(\"%s = %s\", kValueParamLabel, value_param);\n    }\n  }\n}\n\n// This class implements the TestEventListener interface.\n//\n// Class PrettyUnitTestResultPrinter is copyable.\nclass PrettyUnitTestResultPrinter : public TestEventListener {\n public:\n  PrettyUnitTestResultPrinter() {}\n  static void PrintTestName(const char * test_case, const char * test) {\n    printf(\"%s.%s\", test_case, test);\n  }\n\n  // The following methods override what's in the TestEventListener class.\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestCaseStart(const TestCase& test_case);\n  virtual void OnTestStart(const TestInfo& test_info);\n  virtual void OnTestPartResult(const TestPartResult& result);\n  virtual void OnTestEnd(const TestInfo& test_info);\n  virtual void OnTestCaseEnd(const TestCase& test_case);\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}\n  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);\n  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}\n\n private:\n  static void PrintFailedTests(const UnitTest& unit_test);\n};\n\n  // Fired before each iteration of tests starts.\nvoid PrettyUnitTestResultPrinter::OnTestIterationStart(\n    const UnitTest& unit_test, int iteration) {\n  if (GTEST_FLAG(repeat) != 1)\n    printf(\"\\nRepeating all tests (iteration %d) . . .\\n\\n\", iteration + 1);\n\n  const char* const filter = GTEST_FLAG(filter).c_str();\n\n  // Prints the filter if it's not *.  This reminds the user that some\n  // tests may be skipped.\n  if (!String::CStringEquals(filter, kUniversalFilter)) {\n    ColoredPrintf(COLOR_YELLOW,\n                  \"Note: %s filter = %s\\n\", GTEST_NAME_, filter);\n  }\n\n  if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {\n    const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);\n    ColoredPrintf(COLOR_YELLOW,\n                  \"Note: This is test shard %d of %s.\\n\",\n                  static_cast<int>(shard_index) + 1,\n                  internal::posix::GetEnv(kTestTotalShards));\n  }\n\n  if (GTEST_FLAG(shuffle)) {\n    ColoredPrintf(COLOR_YELLOW,\n                  \"Note: Randomizing tests' orders with a seed of %d .\\n\",\n                  unit_test.random_seed());\n  }\n\n  ColoredPrintf(COLOR_GREEN,  \"[==========] \");\n  printf(\"Running %s from %s.\\n\",\n         FormatTestCount(unit_test.test_to_run_count()).c_str(),\n         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(\n    const UnitTest& /*unit_test*/) {\n  ColoredPrintf(COLOR_GREEN,  \"[----------] \");\n  printf(\"Global test environment set-up.\\n\");\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {\n  const std::string counts =\n      FormatCountableNoun(test_case.test_to_run_count(), \"test\", \"tests\");\n  ColoredPrintf(COLOR_GREEN, \"[----------] \");\n  printf(\"%s from %s\", counts.c_str(), test_case.name());\n  if (test_case.type_param() == NULL) {\n    printf(\"\\n\");\n  } else {\n    printf(\", where %s = %s\\n\", kTypeParamLabel, test_case.type_param());\n  }\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {\n  ColoredPrintf(COLOR_GREEN,  \"[ RUN      ] \");\n  PrintTestName(test_info.test_case_name(), test_info.name());\n  printf(\"\\n\");\n  fflush(stdout);\n}\n\n// Called after an assertion failure.\nvoid PrettyUnitTestResultPrinter::OnTestPartResult(\n    const TestPartResult& result) {\n  // If the test part succeeded, we don't need to do anything.\n  if (result.type() == TestPartResult::kSuccess)\n    return;\n\n  // Print failure message from the assertion (e.g. expected this and got that).\n  PrintTestPartResult(result);\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {\n  if (test_info.result()->Passed()) {\n    ColoredPrintf(COLOR_GREEN, \"[       OK ] \");\n  } else {\n    ColoredPrintf(COLOR_RED, \"[  FAILED  ] \");\n  }\n  PrintTestName(test_info.test_case_name(), test_info.name());\n  if (test_info.result()->Failed())\n    PrintFullTestCommentIfPresent(test_info);\n\n  if (GTEST_FLAG(print_time)) {\n    printf(\" (%s ms)\\n\", internal::StreamableToString(\n           test_info.result()->elapsed_time()).c_str());\n  } else {\n    printf(\"\\n\");\n  }\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {\n  if (!GTEST_FLAG(print_time)) return;\n\n  const std::string counts =\n      FormatCountableNoun(test_case.test_to_run_count(), \"test\", \"tests\");\n  ColoredPrintf(COLOR_GREEN, \"[----------] \");\n  printf(\"%s from %s (%s ms total)\\n\\n\",\n         counts.c_str(), test_case.name(),\n         internal::StreamableToString(test_case.elapsed_time()).c_str());\n  fflush(stdout);\n}\n\nvoid PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(\n    const UnitTest& /*unit_test*/) {\n  ColoredPrintf(COLOR_GREEN,  \"[----------] \");\n  printf(\"Global test environment tear-down\\n\");\n  fflush(stdout);\n}\n\n// Internal helper for printing the list of failed tests.\nvoid PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {\n  const int failed_test_count = unit_test.failed_test_count();\n  if (failed_test_count == 0) {\n    return;\n  }\n\n  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {\n    const TestCase& test_case = *unit_test.GetTestCase(i);\n    if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {\n      continue;\n    }\n    for (int j = 0; j < test_case.total_test_count(); ++j) {\n      const TestInfo& test_info = *test_case.GetTestInfo(j);\n      if (!test_info.should_run() || test_info.result()->Passed()) {\n        continue;\n      }\n      ColoredPrintf(COLOR_RED, \"[  FAILED  ] \");\n      printf(\"%s.%s\", test_case.name(), test_info.name());\n      PrintFullTestCommentIfPresent(test_info);\n      printf(\"\\n\");\n    }\n  }\n}\n\nvoid PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,\n                                                     int /*iteration*/) {\n  ColoredPrintf(COLOR_GREEN,  \"[==========] \");\n  printf(\"%s from %s ran.\",\n         FormatTestCount(unit_test.test_to_run_count()).c_str(),\n         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());\n  if (GTEST_FLAG(print_time)) {\n    printf(\" (%s ms total)\",\n           internal::StreamableToString(unit_test.elapsed_time()).c_str());\n  }\n  printf(\"\\n\");\n  ColoredPrintf(COLOR_GREEN,  \"[  PASSED  ] \");\n  printf(\"%s.\\n\", FormatTestCount(unit_test.successful_test_count()).c_str());\n\n  int num_failures = unit_test.failed_test_count();\n  if (!unit_test.Passed()) {\n    const int failed_test_count = unit_test.failed_test_count();\n    ColoredPrintf(COLOR_RED,  \"[  FAILED  ] \");\n    printf(\"%s, listed below:\\n\", FormatTestCount(failed_test_count).c_str());\n    PrintFailedTests(unit_test);\n    printf(\"\\n%2d FAILED %s\\n\", num_failures,\n                        num_failures == 1 ? \"TEST\" : \"TESTS\");\n  }\n\n  int num_disabled = unit_test.reportable_disabled_test_count();\n  if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {\n    if (!num_failures) {\n      printf(\"\\n\");  // Add a spacer if no FAILURE banner is displayed.\n    }\n    ColoredPrintf(COLOR_YELLOW,\n                  \"  YOU HAVE %d DISABLED %s\\n\\n\",\n                  num_disabled,\n                  num_disabled == 1 ? \"TEST\" : \"TESTS\");\n  }\n  // Ensure that Google Test output is printed before, e.g., heapchecker output.\n  fflush(stdout);\n}\n\n// End PrettyUnitTestResultPrinter\n\n// class TestEventRepeater\n//\n// This class forwards events to other event listeners.\nclass TestEventRepeater : public TestEventListener {\n public:\n  TestEventRepeater() : forwarding_enabled_(true) {}\n  virtual ~TestEventRepeater();\n  void Append(TestEventListener *listener);\n  TestEventListener* Release(TestEventListener* listener);\n\n  // Controls whether events will be forwarded to listeners_. Set to false\n  // in death test child processes.\n  bool forwarding_enabled() const { return forwarding_enabled_; }\n  void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }\n\n  virtual void OnTestProgramStart(const UnitTest& unit_test);\n  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);\n  virtual void OnTestCaseStart(const TestCase& test_case);\n  virtual void OnTestStart(const TestInfo& test_info);\n  virtual void OnTestPartResult(const TestPartResult& result);\n  virtual void OnTestEnd(const TestInfo& test_info);\n  virtual void OnTestCaseEnd(const TestCase& test_case);\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);\n  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);\n  virtual void OnTestProgramEnd(const UnitTest& unit_test);\n\n private:\n  // Controls whether events will be forwarded to listeners_. Set to false\n  // in death test child processes.\n  bool forwarding_enabled_;\n  // The list of listeners that receive events.\n  std::vector<TestEventListener*> listeners_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);\n};\n\nTestEventRepeater::~TestEventRepeater() {\n  ForEach(listeners_, Delete<TestEventListener>);\n}\n\nvoid TestEventRepeater::Append(TestEventListener *listener) {\n  listeners_.push_back(listener);\n}\n\n// TODO(vladl@google.com): Factor the search functionality into Vector::Find.\nTestEventListener* TestEventRepeater::Release(TestEventListener *listener) {\n  for (size_t i = 0; i < listeners_.size(); ++i) {\n    if (listeners_[i] == listener) {\n      listeners_.erase(listeners_.begin() + i);\n      return listener;\n    }\n  }\n\n  return NULL;\n}\n\n// Since most methods are very similar, use macros to reduce boilerplate.\n// This defines a member that forwards the call to all listeners.\n#define GTEST_REPEATER_METHOD_(Name, Type) \\\nvoid TestEventRepeater::Name(const Type& parameter) { \\\n  if (forwarding_enabled_) { \\\n    for (size_t i = 0; i < listeners_.size(); i++) { \\\n      listeners_[i]->Name(parameter); \\\n    } \\\n  } \\\n}\n// This defines a member that forwards the call to all listeners in reverse\n// order.\n#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \\\nvoid TestEventRepeater::Name(const Type& parameter) { \\\n  if (forwarding_enabled_) { \\\n    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \\\n      listeners_[i]->Name(parameter); \\\n    } \\\n  } \\\n}\n\nGTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)\nGTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)\nGTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)\nGTEST_REPEATER_METHOD_(OnTestStart, TestInfo)\nGTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)\nGTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)\nGTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)\nGTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)\nGTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)\nGTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)\nGTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)\n\n#undef GTEST_REPEATER_METHOD_\n#undef GTEST_REVERSE_REPEATER_METHOD_\n\nvoid TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,\n                                             int iteration) {\n  if (forwarding_enabled_) {\n    for (size_t i = 0; i < listeners_.size(); i++) {\n      listeners_[i]->OnTestIterationStart(unit_test, iteration);\n    }\n  }\n}\n\nvoid TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,\n                                           int iteration) {\n  if (forwarding_enabled_) {\n    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {\n      listeners_[i]->OnTestIterationEnd(unit_test, iteration);\n    }\n  }\n}\n\n// End TestEventRepeater\n\n// This class generates an XML output file.\nclass XmlUnitTestResultPrinter : public EmptyTestEventListener {\n public:\n  explicit XmlUnitTestResultPrinter(const char* output_file);\n\n  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);\n\n private:\n  // Is c a whitespace character that is normalized to a space character\n  // when it appears in an XML attribute value?\n  static bool IsNormalizableWhitespace(char c) {\n    return c == 0x9 || c == 0xA || c == 0xD;\n  }\n\n  // May c appear in a well-formed XML document?\n  static bool IsValidXmlCharacter(char c) {\n    return IsNormalizableWhitespace(c) || c >= 0x20;\n  }\n\n  // Returns an XML-escaped copy of the input string str.  If\n  // is_attribute is true, the text is meant to appear as an attribute\n  // value, and normalizable whitespace is preserved by replacing it\n  // with character references.\n  static std::string EscapeXml(const std::string& str, bool is_attribute);\n\n  // Returns the given string with all characters invalid in XML removed.\n  static std::string RemoveInvalidXmlCharacters(const std::string& str);\n\n  // Convenience wrapper around EscapeXml when str is an attribute value.\n  static std::string EscapeXmlAttribute(const std::string& str) {\n    return EscapeXml(str, true);\n  }\n\n  // Convenience wrapper around EscapeXml when str is not an attribute value.\n  static std::string EscapeXmlText(const char* str) {\n    return EscapeXml(str, false);\n  }\n\n  // Verifies that the given attribute belongs to the given element and\n  // streams the attribute as XML.\n  static void OutputXmlAttribute(std::ostream* stream,\n                                 const std::string& element_name,\n                                 const std::string& name,\n                                 const std::string& value);\n\n  // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.\n  static void OutputXmlCDataSection(::std::ostream* stream, const char* data);\n\n  // Streams an XML representation of a TestInfo object.\n  static void OutputXmlTestInfo(::std::ostream* stream,\n                                const char* test_case_name,\n                                const TestInfo& test_info);\n\n  // Prints an XML representation of a TestCase object\n  static void PrintXmlTestCase(::std::ostream* stream,\n                               const TestCase& test_case);\n\n  // Prints an XML summary of unit_test to output stream out.\n  static void PrintXmlUnitTest(::std::ostream* stream,\n                               const UnitTest& unit_test);\n\n  // Produces a string representing the test properties in a result as space\n  // delimited XML attributes based on the property key=\"value\" pairs.\n  // When the std::string is not empty, it includes a space at the beginning,\n  // to delimit this attribute from prior attributes.\n  static std::string TestPropertiesAsXmlAttributes(const TestResult& result);\n\n  // The output file.\n  const std::string output_file_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);\n};\n\n// Creates a new XmlUnitTestResultPrinter.\nXmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)\n    : output_file_(output_file) {\n  if (output_file_.c_str() == NULL || output_file_.empty()) {\n    fprintf(stderr, \"XML output file may not be null\\n\");\n    fflush(stderr);\n    exit(EXIT_FAILURE);\n  }\n}\n\n// Called after the unit test ends.\nvoid XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,\n                                                  int /*iteration*/) {\n  FILE* xmlout = NULL;\n  FilePath output_file(output_file_);\n  FilePath output_dir(output_file.RemoveFileName());\n\n  if (output_dir.CreateDirectoriesRecursively()) {\n    xmlout = posix::FOpen(output_file_.c_str(), \"w\");\n  }\n  if (xmlout == NULL) {\n    // TODO(wan): report the reason of the failure.\n    //\n    // We don't do it for now as:\n    //\n    //   1. There is no urgent need for it.\n    //   2. It's a bit involved to make the errno variable thread-safe on\n    //      all three operating systems (Linux, Windows, and Mac OS).\n    //   3. To interpret the meaning of errno in a thread-safe way,\n    //      we need the strerror_r() function, which is not available on\n    //      Windows.\n    fprintf(stderr,\n            \"Unable to open file \\\"%s\\\"\\n\",\n            output_file_.c_str());\n    fflush(stderr);\n    exit(EXIT_FAILURE);\n  }\n  std::stringstream stream;\n  PrintXmlUnitTest(&stream, unit_test);\n  fprintf(xmlout, \"%s\", StringStreamToString(&stream).c_str());\n  fclose(xmlout);\n}\n\n// Returns an XML-escaped copy of the input string str.  If is_attribute\n// is true, the text is meant to appear as an attribute value, and\n// normalizable whitespace is preserved by replacing it with character\n// references.\n//\n// Invalid XML characters in str, if any, are stripped from the output.\n// It is expected that most, if not all, of the text processed by this\n// module will consist of ordinary English text.\n// If this module is ever modified to produce version 1.1 XML output,\n// most invalid characters can be retained using character references.\n// TODO(wan): It might be nice to have a minimally invasive, human-readable\n// escaping scheme for invalid characters, rather than dropping them.\nstd::string XmlUnitTestResultPrinter::EscapeXml(\n    const std::string& str, bool is_attribute) {\n  Message m;\n\n  for (size_t i = 0; i < str.size(); ++i) {\n    const char ch = str[i];\n    switch (ch) {\n      case '<':\n        m << \"&lt;\";\n        break;\n      case '>':\n        m << \"&gt;\";\n        break;\n      case '&':\n        m << \"&amp;\";\n        break;\n      case '\\'':\n        if (is_attribute)\n          m << \"&apos;\";\n        else\n          m << '\\'';\n        break;\n      case '\"':\n        if (is_attribute)\n          m << \"&quot;\";\n        else\n          m << '\"';\n        break;\n      default:\n        if (IsValidXmlCharacter(ch)) {\n          if (is_attribute && IsNormalizableWhitespace(ch))\n            m << \"&#x\" << String::FormatByte(static_cast<unsigned char>(ch))\n              << \";\";\n          else\n            m << ch;\n        }\n        break;\n    }\n  }\n\n  return m.GetString();\n}\n\n// Returns the given string with all characters invalid in XML removed.\n// Currently invalid characters are dropped from the string. An\n// alternative is to replace them with certain characters such as . or ?.\nstd::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(\n    const std::string& str) {\n  std::string output;\n  output.reserve(str.size());\n  for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)\n    if (IsValidXmlCharacter(*it))\n      output.push_back(*it);\n\n  return output;\n}\n\n// The following routines generate an XML representation of a UnitTest\n// object.\n//\n// This is how Google Test concepts map to the DTD:\n//\n// <testsuites name=\"AllTests\">        <-- corresponds to a UnitTest object\n//   <testsuite name=\"testcase-name\">  <-- corresponds to a TestCase object\n//     <testcase name=\"test-name\">     <-- corresponds to a TestInfo object\n//       <failure message=\"...\">...</failure>\n//       <failure message=\"...\">...</failure>\n//       <failure message=\"...\">...</failure>\n//                                     <-- individual assertion failures\n//     </testcase>\n//   </testsuite>\n// </testsuites>\n\n// Formats the given time in milliseconds as seconds.\nstd::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {\n  ::std::stringstream ss;\n  ss << ms/1000.0;\n  return ss.str();\n}\n\n// Converts the given epoch time in milliseconds to a date string in the ISO\n// 8601 format, without the timezone information.\nstd::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {\n  // Using non-reentrant version as localtime_r is not portable.\n  time_t seconds = static_cast<time_t>(ms / 1000);\n#ifdef _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4996)  // Temporarily disables warning 4996\n                                // (function or variable may be unsafe).\n  const struct tm* const time_struct = localtime(&seconds);  // NOLINT\n# pragma warning(pop)           // Restores the warning state again.\n#else\n  const struct tm* const time_struct = localtime(&seconds);  // NOLINT\n#endif\n  if (time_struct == NULL)\n    return \"\";  // Invalid ms value\n\n  // YYYY-MM-DDThh:mm:ss\n  return StreamableToString(time_struct->tm_year + 1900) + \"-\" +\n      String::FormatIntWidth2(time_struct->tm_mon + 1) + \"-\" +\n      String::FormatIntWidth2(time_struct->tm_mday) + \"T\" +\n      String::FormatIntWidth2(time_struct->tm_hour) + \":\" +\n      String::FormatIntWidth2(time_struct->tm_min) + \":\" +\n      String::FormatIntWidth2(time_struct->tm_sec);\n}\n\n// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.\nvoid XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,\n                                                     const char* data) {\n  const char* segment = data;\n  *stream << \"<![CDATA[\";\n  for (;;) {\n    const char* const next_segment = strstr(segment, \"]]>\");\n    if (next_segment != NULL) {\n      stream->write(\n          segment, static_cast<std::streamsize>(next_segment - segment));\n      *stream << \"]]>]]&gt;<![CDATA[\";\n      segment = next_segment + strlen(\"]]>\");\n    } else {\n      *stream << segment;\n      break;\n    }\n  }\n  *stream << \"]]>\";\n}\n\nvoid XmlUnitTestResultPrinter::OutputXmlAttribute(\n    std::ostream* stream,\n    const std::string& element_name,\n    const std::string& name,\n    const std::string& value) {\n  const std::vector<std::string>& allowed_names =\n      GetReservedAttributesForElement(element_name);\n\n  GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) !=\n                   allowed_names.end())\n      << \"Attribute \" << name << \" is not allowed for element <\" << element_name\n      << \">.\";\n\n  *stream << \" \" << name << \"=\\\"\" << EscapeXmlAttribute(value) << \"\\\"\";\n}\n\n// Prints an XML representation of a TestInfo object.\n// TODO(wan): There is also value in printing properties with the plain printer.\nvoid XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,\n                                                 const char* test_case_name,\n                                                 const TestInfo& test_info) {\n  const TestResult& result = *test_info.result();\n  const std::string kTestcase = \"testcase\";\n\n  *stream << \"    <testcase\";\n  OutputXmlAttribute(stream, kTestcase, \"name\", test_info.name());\n\n  if (test_info.value_param() != NULL) {\n    OutputXmlAttribute(stream, kTestcase, \"value_param\",\n                       test_info.value_param());\n  }\n  if (test_info.type_param() != NULL) {\n    OutputXmlAttribute(stream, kTestcase, \"type_param\", test_info.type_param());\n  }\n\n  OutputXmlAttribute(stream, kTestcase, \"status\",\n                     test_info.should_run() ? \"run\" : \"notrun\");\n  OutputXmlAttribute(stream, kTestcase, \"time\",\n                     FormatTimeInMillisAsSeconds(result.elapsed_time()));\n  OutputXmlAttribute(stream, kTestcase, \"classname\", test_case_name);\n  *stream << TestPropertiesAsXmlAttributes(result);\n\n  int failures = 0;\n  for (int i = 0; i < result.total_part_count(); ++i) {\n    const TestPartResult& part = result.GetTestPartResult(i);\n    if (part.failed()) {\n      if (++failures == 1) {\n        *stream << \">\\n\";\n      }\n      const string location = internal::FormatCompilerIndependentFileLocation(\n          part.file_name(), part.line_number());\n      const string summary = location + \"\\n\" + part.summary();\n      *stream << \"      <failure message=\\\"\"\n              << EscapeXmlAttribute(summary.c_str())\n              << \"\\\" type=\\\"\\\">\";\n      const string detail = location + \"\\n\" + part.message();\n      OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());\n      *stream << \"</failure>\\n\";\n    }\n  }\n\n  if (failures == 0)\n    *stream << \" />\\n\";\n  else\n    *stream << \"    </testcase>\\n\";\n}\n\n// Prints an XML representation of a TestCase object\nvoid XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream,\n                                                const TestCase& test_case) {\n  const std::string kTestsuite = \"testsuite\";\n  *stream << \"  <\" << kTestsuite;\n  OutputXmlAttribute(stream, kTestsuite, \"name\", test_case.name());\n  OutputXmlAttribute(stream, kTestsuite, \"tests\",\n                     StreamableToString(test_case.reportable_test_count()));\n  OutputXmlAttribute(stream, kTestsuite, \"failures\",\n                     StreamableToString(test_case.failed_test_count()));\n  OutputXmlAttribute(\n      stream, kTestsuite, \"disabled\",\n      StreamableToString(test_case.reportable_disabled_test_count()));\n  OutputXmlAttribute(stream, kTestsuite, \"errors\", \"0\");\n  OutputXmlAttribute(stream, kTestsuite, \"time\",\n                     FormatTimeInMillisAsSeconds(test_case.elapsed_time()));\n  *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result())\n          << \">\\n\";\n\n  for (int i = 0; i < test_case.total_test_count(); ++i) {\n    if (test_case.GetTestInfo(i)->is_reportable())\n      OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i));\n  }\n  *stream << \"  </\" << kTestsuite << \">\\n\";\n}\n\n// Prints an XML summary of unit_test to output stream out.\nvoid XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,\n                                                const UnitTest& unit_test) {\n  const std::string kTestsuites = \"testsuites\";\n\n  *stream << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\";\n  *stream << \"<\" << kTestsuites;\n\n  OutputXmlAttribute(stream, kTestsuites, \"tests\",\n                     StreamableToString(unit_test.reportable_test_count()));\n  OutputXmlAttribute(stream, kTestsuites, \"failures\",\n                     StreamableToString(unit_test.failed_test_count()));\n  OutputXmlAttribute(\n      stream, kTestsuites, \"disabled\",\n      StreamableToString(unit_test.reportable_disabled_test_count()));\n  OutputXmlAttribute(stream, kTestsuites, \"errors\", \"0\");\n  OutputXmlAttribute(\n      stream, kTestsuites, \"timestamp\",\n      FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));\n  OutputXmlAttribute(stream, kTestsuites, \"time\",\n                     FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));\n\n  if (GTEST_FLAG(shuffle)) {\n    OutputXmlAttribute(stream, kTestsuites, \"random_seed\",\n                       StreamableToString(unit_test.random_seed()));\n  }\n\n  *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());\n\n  OutputXmlAttribute(stream, kTestsuites, \"name\", \"AllTests\");\n  *stream << \">\\n\";\n\n  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {\n    if (unit_test.GetTestCase(i)->reportable_test_count() > 0)\n      PrintXmlTestCase(stream, *unit_test.GetTestCase(i));\n  }\n  *stream << \"</\" << kTestsuites << \">\\n\";\n}\n\n// Produces a string representing the test properties in a result as space\n// delimited XML attributes based on the property key=\"value\" pairs.\nstd::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(\n    const TestResult& result) {\n  Message attributes;\n  for (int i = 0; i < result.test_property_count(); ++i) {\n    const TestProperty& property = result.GetTestProperty(i);\n    attributes << \" \" << property.key() << \"=\"\n        << \"\\\"\" << EscapeXmlAttribute(property.value()) << \"\\\"\";\n  }\n  return attributes.GetString();\n}\n\n// End XmlUnitTestResultPrinter\n\n#if GTEST_CAN_STREAM_RESULTS_\n\n// Checks if str contains '=', '&', '%' or '\\n' characters. If yes,\n// replaces them by \"%xx\" where xx is their hexadecimal value. For\n// example, replaces \"=\" with \"%3D\".  This algorithm is O(strlen(str))\n// in both time and space -- important as the input str may contain an\n// arbitrarily long test failure message and stack trace.\nstring StreamingListener::UrlEncode(const char* str) {\n  string result;\n  result.reserve(strlen(str) + 1);\n  for (char ch = *str; ch != '\\0'; ch = *++str) {\n    switch (ch) {\n      case '%':\n      case '=':\n      case '&':\n      case '\\n':\n        result.append(\"%\" + String::FormatByte(static_cast<unsigned char>(ch)));\n        break;\n      default:\n        result.push_back(ch);\n        break;\n    }\n  }\n  return result;\n}\n\nvoid StreamingListener::SocketWriter::MakeConnection() {\n  GTEST_CHECK_(sockfd_ == -1)\n      << \"MakeConnection() can't be called when there is already a connection.\";\n\n  addrinfo hints;\n  memset(&hints, 0, sizeof(hints));\n  hints.ai_family = AF_UNSPEC;    // To allow both IPv4 and IPv6 addresses.\n  hints.ai_socktype = SOCK_STREAM;\n  addrinfo* servinfo = NULL;\n\n  // Use the getaddrinfo() to get a linked list of IP addresses for\n  // the given host name.\n  const int error_num = getaddrinfo(\n      host_name_.c_str(), port_num_.c_str(), &hints, &servinfo);\n  if (error_num != 0) {\n    GTEST_LOG_(WARNING) << \"stream_result_to: getaddrinfo() failed: \"\n                        << gai_strerror(error_num);\n  }\n\n  // Loop through all the results and connect to the first we can.\n  for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != NULL;\n       cur_addr = cur_addr->ai_next) {\n    sockfd_ = socket(\n        cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol);\n    if (sockfd_ != -1) {\n      // Connect the client socket to the server socket.\n      if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) {\n        close(sockfd_);\n        sockfd_ = -1;\n      }\n    }\n  }\n\n  freeaddrinfo(servinfo);  // all done with this structure\n\n  if (sockfd_ == -1) {\n    GTEST_LOG_(WARNING) << \"stream_result_to: failed to connect to \"\n                        << host_name_ << \":\" << port_num_;\n  }\n}\n\n// End of class Streaming Listener\n#endif  // GTEST_CAN_STREAM_RESULTS__\n\n// Class ScopedTrace\n\n// Pushes the given source file location and message onto a per-thread\n// trace stack maintained by Google Test.\nScopedTrace::ScopedTrace(const char* file, int line, const Message& message)\n    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {\n  TraceInfo trace;\n  trace.file = file;\n  trace.line = line;\n  trace.message = message.GetString();\n\n  UnitTest::GetInstance()->PushGTestTrace(trace);\n}\n\n// Pops the info pushed by the c'tor.\nScopedTrace::~ScopedTrace()\n    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {\n  UnitTest::GetInstance()->PopGTestTrace();\n}\n\n\n// class OsStackTraceGetter\n\n// Returns the current OS stack trace as an std::string.  Parameters:\n//\n//   max_depth  - the maximum number of stack frames to be included\n//                in the trace.\n//   skip_count - the number of top frames to be skipped; doesn't count\n//                against max_depth.\n//\nstring OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,\n                                             int /* skip_count */)\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  return \"\";\n}\n\nvoid OsStackTraceGetter::UponLeavingGTest()\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n}\n\nconst char* const\nOsStackTraceGetter::kElidedFramesMarker =\n    \"... \" GTEST_NAME_ \" internal frames ...\";\n\n// A helper class that creates the premature-exit file in its\n// constructor and deletes the file in its destructor.\nclass ScopedPrematureExitFile {\n public:\n  explicit ScopedPrematureExitFile(const char* premature_exit_filepath)\n      : premature_exit_filepath_(premature_exit_filepath) {\n    // If a path to the premature-exit file is specified...\n    if (premature_exit_filepath != NULL && *premature_exit_filepath != '\\0') {\n      // create the file with a single \"0\" character in it.  I/O\n      // errors are ignored as there's nothing better we can do and we\n      // don't want to fail the test because of this.\n      FILE* pfile = posix::FOpen(premature_exit_filepath, \"w\");\n      fwrite(\"0\", 1, 1, pfile);\n      fclose(pfile);\n    }\n  }\n\n  ~ScopedPrematureExitFile() {\n    if (premature_exit_filepath_ != NULL && *premature_exit_filepath_ != '\\0') {\n      remove(premature_exit_filepath_);\n    }\n  }\n\n private:\n  const char* const premature_exit_filepath_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile);\n};\n\n}  // namespace internal\n\n// class TestEventListeners\n\nTestEventListeners::TestEventListeners()\n    : repeater_(new internal::TestEventRepeater()),\n      default_result_printer_(NULL),\n      default_xml_generator_(NULL) {\n}\n\nTestEventListeners::~TestEventListeners() { delete repeater_; }\n\n// Returns the standard listener responsible for the default console\n// output.  Can be removed from the listeners list to shut down default\n// console output.  Note that removing this object from the listener list\n// with Release transfers its ownership to the user.\nvoid TestEventListeners::Append(TestEventListener* listener) {\n  repeater_->Append(listener);\n}\n\n// Removes the given event listener from the list and returns it.  It then\n// becomes the caller's responsibility to delete the listener. Returns\n// NULL if the listener is not found in the list.\nTestEventListener* TestEventListeners::Release(TestEventListener* listener) {\n  if (listener == default_result_printer_)\n    default_result_printer_ = NULL;\n  else if (listener == default_xml_generator_)\n    default_xml_generator_ = NULL;\n  return repeater_->Release(listener);\n}\n\n// Returns repeater that broadcasts the TestEventListener events to all\n// subscribers.\nTestEventListener* TestEventListeners::repeater() { return repeater_; }\n\n// Sets the default_result_printer attribute to the provided listener.\n// The listener is also added to the listener list and previous\n// default_result_printer is removed from it and deleted. The listener can\n// also be NULL in which case it will not be added to the list. Does\n// nothing if the previous and the current listener objects are the same.\nvoid TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {\n  if (default_result_printer_ != listener) {\n    // It is an error to pass this method a listener that is already in the\n    // list.\n    delete Release(default_result_printer_);\n    default_result_printer_ = listener;\n    if (listener != NULL)\n      Append(listener);\n  }\n}\n\n// Sets the default_xml_generator attribute to the provided listener.  The\n// listener is also added to the listener list and previous\n// default_xml_generator is removed from it and deleted. The listener can\n// also be NULL in which case it will not be added to the list. Does\n// nothing if the previous and the current listener objects are the same.\nvoid TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {\n  if (default_xml_generator_ != listener) {\n    // It is an error to pass this method a listener that is already in the\n    // list.\n    delete Release(default_xml_generator_);\n    default_xml_generator_ = listener;\n    if (listener != NULL)\n      Append(listener);\n  }\n}\n\n// Controls whether events will be forwarded by the repeater to the\n// listeners in the list.\nbool TestEventListeners::EventForwardingEnabled() const {\n  return repeater_->forwarding_enabled();\n}\n\nvoid TestEventListeners::SuppressEventForwarding() {\n  repeater_->set_forwarding_enabled(false);\n}\n\n// class UnitTest\n\n// Gets the singleton UnitTest object.  The first time this method is\n// called, a UnitTest object is constructed and returned.  Consecutive\n// calls will return the same object.\n//\n// We don't protect this under mutex_ as a user is not supposed to\n// call this before main() starts, from which point on the return\n// value will never change.\nUnitTest* UnitTest::GetInstance() {\n  // When compiled with MSVC 7.1 in optimized mode, destroying the\n  // UnitTest object upon exiting the program messes up the exit code,\n  // causing successful tests to appear failed.  We have to use a\n  // different implementation in this case to bypass the compiler bug.\n  // This implementation makes the compiler happy, at the cost of\n  // leaking the UnitTest object.\n\n  // CodeGear C++Builder insists on a public destructor for the\n  // default implementation.  Use this implementation to keep good OO\n  // design with private destructor.\n\n#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)\n  static UnitTest* const instance = new UnitTest;\n  return instance;\n#else\n  static UnitTest instance;\n  return &instance;\n#endif  // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)\n}\n\n// Gets the number of successful test cases.\nint UnitTest::successful_test_case_count() const {\n  return impl()->successful_test_case_count();\n}\n\n// Gets the number of failed test cases.\nint UnitTest::failed_test_case_count() const {\n  return impl()->failed_test_case_count();\n}\n\n// Gets the number of all test cases.\nint UnitTest::total_test_case_count() const {\n  return impl()->total_test_case_count();\n}\n\n// Gets the number of all test cases that contain at least one test\n// that should run.\nint UnitTest::test_case_to_run_count() const {\n  return impl()->test_case_to_run_count();\n}\n\n// Gets the number of successful tests.\nint UnitTest::successful_test_count() const {\n  return impl()->successful_test_count();\n}\n\n// Gets the number of failed tests.\nint UnitTest::failed_test_count() const { return impl()->failed_test_count(); }\n\n// Gets the number of disabled tests that will be reported in the XML report.\nint UnitTest::reportable_disabled_test_count() const {\n  return impl()->reportable_disabled_test_count();\n}\n\n// Gets the number of disabled tests.\nint UnitTest::disabled_test_count() const {\n  return impl()->disabled_test_count();\n}\n\n// Gets the number of tests to be printed in the XML report.\nint UnitTest::reportable_test_count() const {\n  return impl()->reportable_test_count();\n}\n\n// Gets the number of all tests.\nint UnitTest::total_test_count() const { return impl()->total_test_count(); }\n\n// Gets the number of tests that should run.\nint UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }\n\n// Gets the time of the test program start, in ms from the start of the\n// UNIX epoch.\ninternal::TimeInMillis UnitTest::start_timestamp() const {\n    return impl()->start_timestamp();\n}\n\n// Gets the elapsed time, in milliseconds.\ninternal::TimeInMillis UnitTest::elapsed_time() const {\n  return impl()->elapsed_time();\n}\n\n// Returns true iff the unit test passed (i.e. all test cases passed).\nbool UnitTest::Passed() const { return impl()->Passed(); }\n\n// Returns true iff the unit test failed (i.e. some test case failed\n// or something outside of all tests failed).\nbool UnitTest::Failed() const { return impl()->Failed(); }\n\n// Gets the i-th test case among all the test cases. i can range from 0 to\n// total_test_case_count() - 1. If i is not in that range, returns NULL.\nconst TestCase* UnitTest::GetTestCase(int i) const {\n  return impl()->GetTestCase(i);\n}\n\n// Returns the TestResult containing information on test failures and\n// properties logged outside of individual test cases.\nconst TestResult& UnitTest::ad_hoc_test_result() const {\n  return *impl()->ad_hoc_test_result();\n}\n\n// Gets the i-th test case among all the test cases. i can range from 0 to\n// total_test_case_count() - 1. If i is not in that range, returns NULL.\nTestCase* UnitTest::GetMutableTestCase(int i) {\n  return impl()->GetMutableTestCase(i);\n}\n\n// Returns the list of event listeners that can be used to track events\n// inside Google Test.\nTestEventListeners& UnitTest::listeners() {\n  return *impl()->listeners();\n}\n\n// Registers and returns a global test environment.  When a test\n// program is run, all global test environments will be set-up in the\n// order they were registered.  After all tests in the program have\n// finished, all global test environments will be torn-down in the\n// *reverse* order they were registered.\n//\n// The UnitTest object takes ownership of the given environment.\n//\n// We don't protect this under mutex_, as we only support calling it\n// from the main thread.\nEnvironment* UnitTest::AddEnvironment(Environment* env) {\n  if (env == NULL) {\n    return NULL;\n  }\n\n  impl_->environments().push_back(env);\n  return env;\n}\n\n// Adds a TestPartResult to the current TestResult object.  All Google Test\n// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call\n// this to report their results.  The user code should use the\n// assertion macros instead of calling this directly.\nvoid UnitTest::AddTestPartResult(\n    TestPartResult::Type result_type,\n    const char* file_name,\n    int line_number,\n    const std::string& message,\n    const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) {\n  Message msg;\n  msg << message;\n\n  internal::MutexLock lock(&mutex_);\n  if (impl_->gtest_trace_stack().size() > 0) {\n    msg << \"\\n\" << GTEST_NAME_ << \" trace:\";\n\n    for (int i = static_cast<int>(impl_->gtest_trace_stack().size());\n         i > 0; --i) {\n      const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];\n      msg << \"\\n\" << internal::FormatFileLocation(trace.file, trace.line)\n          << \" \" << trace.message;\n    }\n  }\n\n  if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {\n    msg << internal::kStackTraceMarker << os_stack_trace;\n  }\n\n  const TestPartResult result =\n    TestPartResult(result_type, file_name, line_number,\n                   msg.GetString().c_str());\n  impl_->GetTestPartResultReporterForCurrentThread()->\n      ReportTestPartResult(result);\n\n  if (result_type != TestPartResult::kSuccess) {\n    // gtest_break_on_failure takes precedence over\n    // gtest_throw_on_failure.  This allows a user to set the latter\n    // in the code (perhaps in order to use Google Test assertions\n    // with another testing framework) and specify the former on the\n    // command line for debugging.\n    if (GTEST_FLAG(break_on_failure)) {\n#if GTEST_OS_WINDOWS\n      // Using DebugBreak on Windows allows gtest to still break into a debugger\n      // when a failure happens and both the --gtest_break_on_failure and\n      // the --gtest_catch_exceptions flags are specified.\n      DebugBreak();\n#else\n      // Dereference NULL through a volatile pointer to prevent the compiler\n      // from removing. We use this rather than abort() or __builtin_trap() for\n      // portability: Symbian doesn't implement abort() well, and some debuggers\n      // don't correctly trap abort().\n      *static_cast<volatile int*>(NULL) = 1;\n#endif  // GTEST_OS_WINDOWS\n    } else if (GTEST_FLAG(throw_on_failure)) {\n#if GTEST_HAS_EXCEPTIONS\n      throw internal::GoogleTestFailureException(result);\n#else\n      // We cannot call abort() as it generates a pop-up in debug mode\n      // that cannot be suppressed in VC 7.1 or below.\n      exit(1);\n#endif\n    }\n  }\n}\n\n// Adds a TestProperty to the current TestResult object when invoked from\n// inside a test, to current TestCase's ad_hoc_test_result_ when invoked\n// from SetUpTestCase or TearDownTestCase, or to the global property set\n// when invoked elsewhere.  If the result already contains a property with\n// the same key, the value will be updated.\nvoid UnitTest::RecordProperty(const std::string& key,\n                              const std::string& value) {\n  impl_->RecordProperty(TestProperty(key, value));\n}\n\n// Runs all tests in this UnitTest object and prints the result.\n// Returns 0 if successful, or 1 otherwise.\n//\n// We don't protect this under mutex_, as we only support calling it\n// from the main thread.\nint UnitTest::Run() {\n  const bool in_death_test_child_process =\n      internal::GTEST_FLAG(internal_run_death_test).length() > 0;\n\n  // Google Test implements this protocol for catching that a test\n  // program exits before returning control to Google Test:\n  //\n  //   1. Upon start, Google Test creates a file whose absolute path\n  //      is specified by the environment variable\n  //      TEST_PREMATURE_EXIT_FILE.\n  //   2. When Google Test has finished its work, it deletes the file.\n  //\n  // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before\n  // running a Google-Test-based test program and check the existence\n  // of the file at the end of the test execution to see if it has\n  // exited prematurely.\n\n  // If we are in the child process of a death test, don't\n  // create/delete the premature exit file, as doing so is unnecessary\n  // and will confuse the parent process.  Otherwise, create/delete\n  // the file upon entering/leaving this function.  If the program\n  // somehow exits before this function has a chance to return, the\n  // premature-exit file will be left undeleted, causing a test runner\n  // that understands the premature-exit-file protocol to report the\n  // test as having failed.\n  const internal::ScopedPrematureExitFile premature_exit_file(\n      in_death_test_child_process ?\n      NULL : internal::posix::GetEnv(\"TEST_PREMATURE_EXIT_FILE\"));\n\n  // Captures the value of GTEST_FLAG(catch_exceptions).  This value will be\n  // used for the duration of the program.\n  impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions));\n\n#if GTEST_HAS_SEH\n  // Either the user wants Google Test to catch exceptions thrown by the\n  // tests or this is executing in the context of death test child\n  // process. In either case the user does not want to see pop-up dialogs\n  // about crashes - they are expected.\n  if (impl()->catch_exceptions() || in_death_test_child_process) {\n# if !GTEST_OS_WINDOWS_MOBILE\n    // SetErrorMode doesn't exist on CE.\n    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |\n                 SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\n# endif  // !GTEST_OS_WINDOWS_MOBILE\n\n# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE\n    // Death test children can be terminated with _abort().  On Windows,\n    // _abort() can show a dialog with a warning message.  This forces the\n    // abort message to go to stderr instead.\n    _set_error_mode(_OUT_TO_STDERR);\n# endif\n\n# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE\n    // In the debug version, Visual Studio pops up a separate dialog\n    // offering a choice to debug the aborted program. We need to suppress\n    // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement\n    // executed. Google Test will notify the user of any unexpected\n    // failure via stderr.\n    //\n    // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.\n    // Users of prior VC versions shall suffer the agony and pain of\n    // clicking through the countless debug dialogs.\n    // TODO(vladl@google.com): find a way to suppress the abort dialog() in the\n    // debug mode when compiled with VC 7.1 or lower.\n    if (!GTEST_FLAG(break_on_failure))\n      _set_abort_behavior(\n          0x0,                                    // Clear the following flags:\n          _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.\n# endif\n  }\n#endif  // GTEST_HAS_SEH\n\n  return internal::HandleExceptionsInMethodIfSupported(\n      impl(),\n      &internal::UnitTestImpl::RunAllTests,\n      \"auxiliary test code (environments or event listeners)\") ? 0 : 1;\n}\n\n// Returns the working directory when the first TEST() or TEST_F() was\n// executed.\nconst char* UnitTest::original_working_dir() const {\n  return impl_->original_working_dir_.c_str();\n}\n\n// Returns the TestCase object for the test that's currently running,\n// or NULL if no test is running.\nconst TestCase* UnitTest::current_test_case() const\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  return impl_->current_test_case();\n}\n\n// Returns the TestInfo object for the test that's currently running,\n// or NULL if no test is running.\nconst TestInfo* UnitTest::current_test_info() const\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  return impl_->current_test_info();\n}\n\n// Returns the random seed used at the start of the current test run.\nint UnitTest::random_seed() const { return impl_->random_seed(); }\n\n#if GTEST_HAS_PARAM_TEST\n// Returns ParameterizedTestCaseRegistry object used to keep track of\n// value-parameterized tests and instantiate and register them.\ninternal::ParameterizedTestCaseRegistry&\n    UnitTest::parameterized_test_registry()\n        GTEST_LOCK_EXCLUDED_(mutex_) {\n  return impl_->parameterized_test_registry();\n}\n#endif  // GTEST_HAS_PARAM_TEST\n\n// Creates an empty UnitTest.\nUnitTest::UnitTest() {\n  impl_ = new internal::UnitTestImpl(this);\n}\n\n// Destructor of UnitTest.\nUnitTest::~UnitTest() {\n  delete impl_;\n}\n\n// Pushes a trace defined by SCOPED_TRACE() on to the per-thread\n// Google Test trace stack.\nvoid UnitTest::PushGTestTrace(const internal::TraceInfo& trace)\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  impl_->gtest_trace_stack().push_back(trace);\n}\n\n// Pops a trace from the per-thread Google Test trace stack.\nvoid UnitTest::PopGTestTrace()\n    GTEST_LOCK_EXCLUDED_(mutex_) {\n  internal::MutexLock lock(&mutex_);\n  impl_->gtest_trace_stack().pop_back();\n}\n\nnamespace internal {\n\nUnitTestImpl::UnitTestImpl(UnitTest* parent)\n    : parent_(parent),\n#ifdef _MSC_VER\n# pragma warning(push)                    // Saves the current warning state.\n# pragma warning(disable:4355)            // Temporarily disables warning 4355\n                                         // (using this in initializer).\n      default_global_test_part_result_reporter_(this),\n      default_per_thread_test_part_result_reporter_(this),\n# pragma warning(pop)                     // Restores the warning state again.\n#else\n      default_global_test_part_result_reporter_(this),\n      default_per_thread_test_part_result_reporter_(this),\n#endif  // _MSC_VER\n      global_test_part_result_repoter_(\n          &default_global_test_part_result_reporter_),\n      per_thread_test_part_result_reporter_(\n          &default_per_thread_test_part_result_reporter_),\n#if GTEST_HAS_PARAM_TEST\n      parameterized_test_registry_(),\n      parameterized_tests_registered_(false),\n#endif  // GTEST_HAS_PARAM_TEST\n      last_death_test_case_(-1),\n      current_test_case_(NULL),\n      current_test_info_(NULL),\n      ad_hoc_test_result_(),\n      os_stack_trace_getter_(NULL),\n      post_flag_parse_init_performed_(false),\n      random_seed_(0),  // Will be overridden by the flag before first use.\n      random_(0),  // Will be reseeded before first use.\n      start_timestamp_(0),\n      elapsed_time_(0),\n#if GTEST_HAS_DEATH_TEST\n      death_test_factory_(new DefaultDeathTestFactory),\n#endif\n      // Will be overridden by the flag before first use.\n      catch_exceptions_(false) {\n  listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);\n}\n\nUnitTestImpl::~UnitTestImpl() {\n  // Deletes every TestCase.\n  ForEach(test_cases_, internal::Delete<TestCase>);\n\n  // Deletes every Environment.\n  ForEach(environments_, internal::Delete<Environment>);\n\n  delete os_stack_trace_getter_;\n}\n\n// Adds a TestProperty to the current TestResult object when invoked in a\n// context of a test, to current test case's ad_hoc_test_result when invoke\n// from SetUpTestCase/TearDownTestCase, or to the global property set\n// otherwise.  If the result already contains a property with the same key,\n// the value will be updated.\nvoid UnitTestImpl::RecordProperty(const TestProperty& test_property) {\n  std::string xml_element;\n  TestResult* test_result;  // TestResult appropriate for property recording.\n\n  if (current_test_info_ != NULL) {\n    xml_element = \"testcase\";\n    test_result = &(current_test_info_->result_);\n  } else if (current_test_case_ != NULL) {\n    xml_element = \"testsuite\";\n    test_result = &(current_test_case_->ad_hoc_test_result_);\n  } else {\n    xml_element = \"testsuites\";\n    test_result = &ad_hoc_test_result_;\n  }\n  test_result->RecordProperty(xml_element, test_property);\n}\n\n#if GTEST_HAS_DEATH_TEST\n// Disables event forwarding if the control is currently in a death test\n// subprocess. Must not be called before InitGoogleTest.\nvoid UnitTestImpl::SuppressTestEventsIfInSubprocess() {\n  if (internal_run_death_test_flag_.get() != NULL)\n    listeners()->SuppressEventForwarding();\n}\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Initializes event listeners performing XML output as specified by\n// UnitTestOptions. Must not be called before InitGoogleTest.\nvoid UnitTestImpl::ConfigureXmlOutput() {\n  const std::string& output_format = UnitTestOptions::GetOutputFormat();\n  if (output_format == \"xml\") {\n    listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(\n        UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));\n  } else if (output_format != \"\") {\n    printf(\"WARNING: unrecognized output format \\\"%s\\\" ignored.\\n\",\n           output_format.c_str());\n    fflush(stdout);\n  }\n}\n\n#if GTEST_CAN_STREAM_RESULTS_\n// Initializes event listeners for streaming test results in string form.\n// Must not be called before InitGoogleTest.\nvoid UnitTestImpl::ConfigureStreamingOutput() {\n  const std::string& target = GTEST_FLAG(stream_result_to);\n  if (!target.empty()) {\n    const size_t pos = target.find(':');\n    if (pos != std::string::npos) {\n      listeners()->Append(new StreamingListener(target.substr(0, pos),\n                                                target.substr(pos+1)));\n    } else {\n      printf(\"WARNING: unrecognized streaming target \\\"%s\\\" ignored.\\n\",\n             target.c_str());\n      fflush(stdout);\n    }\n  }\n}\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\n// Performs initialization dependent upon flag values obtained in\n// ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to\n// ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest\n// this function is also called from RunAllTests.  Since this function can be\n// called more than once, it has to be idempotent.\nvoid UnitTestImpl::PostFlagParsingInit() {\n  // Ensures that this function does not execute more than once.\n  if (!post_flag_parse_init_performed_) {\n    post_flag_parse_init_performed_ = true;\n\n#if GTEST_HAS_DEATH_TEST\n    InitDeathTestSubprocessControlInfo();\n    SuppressTestEventsIfInSubprocess();\n#endif  // GTEST_HAS_DEATH_TEST\n\n    // Registers parameterized tests. This makes parameterized tests\n    // available to the UnitTest reflection API without running\n    // RUN_ALL_TESTS.\n    RegisterParameterizedTests();\n\n    // Configures listeners for XML output. This makes it possible for users\n    // to shut down the default XML output before invoking RUN_ALL_TESTS.\n    ConfigureXmlOutput();\n\n#if GTEST_CAN_STREAM_RESULTS_\n    // Configures listeners for streaming test results to the specified server.\n    ConfigureStreamingOutput();\n#endif  // GTEST_CAN_STREAM_RESULTS_\n  }\n}\n\n// A predicate that checks the name of a TestCase against a known\n// value.\n//\n// This is used for implementation of the UnitTest class only.  We put\n// it in the anonymous namespace to prevent polluting the outer\n// namespace.\n//\n// TestCaseNameIs is copyable.\nclass TestCaseNameIs {\n public:\n  // Constructor.\n  explicit TestCaseNameIs(const std::string& name)\n      : name_(name) {}\n\n  // Returns true iff the name of test_case matches name_.\n  bool operator()(const TestCase* test_case) const {\n    return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;\n  }\n\n private:\n  std::string name_;\n};\n\n// Finds and returns a TestCase with the given name.  If one doesn't\n// exist, creates one and returns it.  It's the CALLER'S\n// RESPONSIBILITY to ensure that this function is only called WHEN THE\n// TESTS ARE NOT SHUFFLED.\n//\n// Arguments:\n//\n//   test_case_name: name of the test case\n//   type_param:     the name of the test case's type parameter, or NULL if\n//                   this is not a typed or a type-parameterized test case.\n//   set_up_tc:      pointer to the function that sets up the test case\n//   tear_down_tc:   pointer to the function that tears down the test case\nTestCase* UnitTestImpl::GetTestCase(const char* test_case_name,\n                                    const char* type_param,\n                                    Test::SetUpTestCaseFunc set_up_tc,\n                                    Test::TearDownTestCaseFunc tear_down_tc) {\n  // Can we find a TestCase with the given name?\n  const std::vector<TestCase*>::const_iterator test_case =\n      std::find_if(test_cases_.begin(), test_cases_.end(),\n                   TestCaseNameIs(test_case_name));\n\n  if (test_case != test_cases_.end())\n    return *test_case;\n\n  // No.  Let's create one.\n  TestCase* const new_test_case =\n      new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc);\n\n  // Is this a death test case?\n  if (internal::UnitTestOptions::MatchesFilter(test_case_name,\n                                               kDeathTestCaseFilter)) {\n    // Yes.  Inserts the test case after the last death test case\n    // defined so far.  This only works when the test cases haven't\n    // been shuffled.  Otherwise we may end up running a death test\n    // after a non-death test.\n    ++last_death_test_case_;\n    test_cases_.insert(test_cases_.begin() + last_death_test_case_,\n                       new_test_case);\n  } else {\n    // No.  Appends to the end of the list.\n    test_cases_.push_back(new_test_case);\n  }\n\n  test_case_indices_.push_back(static_cast<int>(test_case_indices_.size()));\n  return new_test_case;\n}\n\n// Helpers for setting up / tearing down the given environment.  They\n// are for use in the ForEach() function.\nstatic void SetUpEnvironment(Environment* env) { env->SetUp(); }\nstatic void TearDownEnvironment(Environment* env) { env->TearDown(); }\n\n// Runs all tests in this UnitTest object, prints the result, and\n// returns true if all tests are successful.  If any exception is\n// thrown during a test, the test is considered to be failed, but the\n// rest of the tests will still be run.\n//\n// When parameterized tests are enabled, it expands and registers\n// parameterized tests first in RegisterParameterizedTests().\n// All other functions called from RunAllTests() may safely assume that\n// parameterized tests are ready to be counted and run.\nbool UnitTestImpl::RunAllTests() {\n  // Makes sure InitGoogleTest() was called.\n  if (!GTestIsInitialized()) {\n    printf(\"%s\",\n           \"\\nThis test program did NOT call ::testing::InitGoogleTest \"\n           \"before calling RUN_ALL_TESTS().  Please fix it.\\n\");\n    return false;\n  }\n\n  // Do not run any test if the --help flag was specified.\n  if (g_help_flag)\n    return true;\n\n  // Repeats the call to the post-flag parsing initialization in case the\n  // user didn't call InitGoogleTest.\n  PostFlagParsingInit();\n\n  // Even if sharding is not on, test runners may want to use the\n  // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding\n  // protocol.\n  internal::WriteToShardStatusFileIfNeeded();\n\n  // True iff we are in a subprocess for running a thread-safe-style\n  // death test.\n  bool in_subprocess_for_death_test = false;\n\n#if GTEST_HAS_DEATH_TEST\n  in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);\n#endif  // GTEST_HAS_DEATH_TEST\n\n  const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,\n                                        in_subprocess_for_death_test);\n\n  // Compares the full test names with the filter to decide which\n  // tests to run.\n  const bool has_tests_to_run = FilterTests(should_shard\n                                              ? HONOR_SHARDING_PROTOCOL\n                                              : IGNORE_SHARDING_PROTOCOL) > 0;\n\n  // Lists the tests and exits if the --gtest_list_tests flag was specified.\n  if (GTEST_FLAG(list_tests)) {\n    // This must be called *after* FilterTests() has been called.\n    ListTestsMatchingFilter();\n    return true;\n  }\n\n  random_seed_ = GTEST_FLAG(shuffle) ?\n      GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;\n\n  // True iff at least one test has failed.\n  bool failed = false;\n\n  TestEventListener* repeater = listeners()->repeater();\n\n  start_timestamp_ = GetTimeInMillis();\n  repeater->OnTestProgramStart(*parent_);\n\n  // How many times to repeat the tests?  We don't want to repeat them\n  // when we are inside the subprocess of a death test.\n  const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);\n  // Repeats forever if the repeat count is negative.\n  const bool forever = repeat < 0;\n  for (int i = 0; forever || i != repeat; i++) {\n    // We want to preserve failures generated by ad-hoc test\n    // assertions executed before RUN_ALL_TESTS().\n    ClearNonAdHocTestResult();\n\n    const TimeInMillis start = GetTimeInMillis();\n\n    // Shuffles test cases and tests if requested.\n    if (has_tests_to_run && GTEST_FLAG(shuffle)) {\n      random()->Reseed(random_seed_);\n      // This should be done before calling OnTestIterationStart(),\n      // such that a test event listener can see the actual test order\n      // in the event.\n      ShuffleTests();\n    }\n\n    // Tells the unit test event listeners that the tests are about to start.\n    repeater->OnTestIterationStart(*parent_, i);\n\n    // Runs each test case if there is at least one test to run.\n    if (has_tests_to_run) {\n      // Sets up all environments beforehand.\n      repeater->OnEnvironmentsSetUpStart(*parent_);\n      ForEach(environments_, SetUpEnvironment);\n      repeater->OnEnvironmentsSetUpEnd(*parent_);\n\n      // Runs the tests only if there was no fatal failure during global\n      // set-up.\n      if (!Test::HasFatalFailure()) {\n        for (int test_index = 0; test_index < total_test_case_count();\n             test_index++) {\n          GetMutableTestCase(test_index)->Run();\n        }\n      }\n\n      // Tears down all environments in reverse order afterwards.\n      repeater->OnEnvironmentsTearDownStart(*parent_);\n      std::for_each(environments_.rbegin(), environments_.rend(),\n                    TearDownEnvironment);\n      repeater->OnEnvironmentsTearDownEnd(*parent_);\n    }\n\n    elapsed_time_ = GetTimeInMillis() - start;\n\n    // Tells the unit test event listener that the tests have just finished.\n    repeater->OnTestIterationEnd(*parent_, i);\n\n    // Gets the result and clears it.\n    if (!Passed()) {\n      failed = true;\n    }\n\n    // Restores the original test order after the iteration.  This\n    // allows the user to quickly repro a failure that happens in the\n    // N-th iteration without repeating the first (N - 1) iterations.\n    // This is not enclosed in \"if (GTEST_FLAG(shuffle)) { ... }\", in\n    // case the user somehow changes the value of the flag somewhere\n    // (it's always safe to unshuffle the tests).\n    UnshuffleTests();\n\n    if (GTEST_FLAG(shuffle)) {\n      // Picks a new random seed for each iteration.\n      random_seed_ = GetNextRandomSeed(random_seed_);\n    }\n  }\n\n  repeater->OnTestProgramEnd(*parent_);\n\n  return !failed;\n}\n\n// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file\n// if the variable is present. If a file already exists at this location, this\n// function will write over it. If the variable is present, but the file cannot\n// be created, prints an error and exits.\nvoid WriteToShardStatusFileIfNeeded() {\n  const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);\n  if (test_shard_file != NULL) {\n    FILE* const file = posix::FOpen(test_shard_file, \"w\");\n    if (file == NULL) {\n      ColoredPrintf(COLOR_RED,\n                    \"Could not write to the test shard status file \\\"%s\\\" \"\n                    \"specified by the %s environment variable.\\n\",\n                    test_shard_file, kTestShardStatusFile);\n      fflush(stdout);\n      exit(EXIT_FAILURE);\n    }\n    fclose(file);\n  }\n}\n\n// Checks whether sharding is enabled by examining the relevant\n// environment variable values. If the variables are present,\n// but inconsistent (i.e., shard_index >= total_shards), prints\n// an error and exits. If in_subprocess_for_death_test, sharding is\n// disabled because it must only be applied to the original test\n// process. Otherwise, we could filter out death tests we intended to execute.\nbool ShouldShard(const char* total_shards_env,\n                 const char* shard_index_env,\n                 bool in_subprocess_for_death_test) {\n  if (in_subprocess_for_death_test) {\n    return false;\n  }\n\n  const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);\n  const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);\n\n  if (total_shards == -1 && shard_index == -1) {\n    return false;\n  } else if (total_shards == -1 && shard_index != -1) {\n    const Message msg = Message()\n      << \"Invalid environment variables: you have \"\n      << kTestShardIndex << \" = \" << shard_index\n      << \", but have left \" << kTestTotalShards << \" unset.\\n\";\n    ColoredPrintf(COLOR_RED, msg.GetString().c_str());\n    fflush(stdout);\n    exit(EXIT_FAILURE);\n  } else if (total_shards != -1 && shard_index == -1) {\n    const Message msg = Message()\n      << \"Invalid environment variables: you have \"\n      << kTestTotalShards << \" = \" << total_shards\n      << \", but have left \" << kTestShardIndex << \" unset.\\n\";\n    ColoredPrintf(COLOR_RED, msg.GetString().c_str());\n    fflush(stdout);\n    exit(EXIT_FAILURE);\n  } else if (shard_index < 0 || shard_index >= total_shards) {\n    const Message msg = Message()\n      << \"Invalid environment variables: we require 0 <= \"\n      << kTestShardIndex << \" < \" << kTestTotalShards\n      << \", but you have \" << kTestShardIndex << \"=\" << shard_index\n      << \", \" << kTestTotalShards << \"=\" << total_shards << \".\\n\";\n    ColoredPrintf(COLOR_RED, msg.GetString().c_str());\n    fflush(stdout);\n    exit(EXIT_FAILURE);\n  }\n\n  return total_shards > 1;\n}\n\n// Parses the environment variable var as an Int32. If it is unset,\n// returns default_val. If it is not an Int32, prints an error\n// and aborts.\nInt32 Int32FromEnvOrDie(const char* var, Int32 default_val) {\n  const char* str_val = posix::GetEnv(var);\n  if (str_val == NULL) {\n    return default_val;\n  }\n\n  Int32 result;\n  if (!ParseInt32(Message() << \"The value of environment variable \" << var,\n                  str_val, &result)) {\n    exit(EXIT_FAILURE);\n  }\n  return result;\n}\n\n// Given the total number of shards, the shard index, and the test id,\n// returns true iff the test should be run on this shard. The test id is\n// some arbitrary but unique non-negative integer assigned to each test\n// method. Assumes that 0 <= shard_index < total_shards.\nbool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {\n  return (test_id % total_shards) == shard_index;\n}\n\n// Compares the name of each test with the user-specified filter to\n// decide whether the test should be run, then records the result in\n// each TestCase and TestInfo object.\n// If shard_tests == true, further filters tests based on sharding\n// variables in the environment - see\n// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.\n// Returns the number of tests that should run.\nint UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {\n  const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?\n      Int32FromEnvOrDie(kTestTotalShards, -1) : -1;\n  const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?\n      Int32FromEnvOrDie(kTestShardIndex, -1) : -1;\n\n  // num_runnable_tests are the number of tests that will\n  // run across all shards (i.e., match filter and are not disabled).\n  // num_selected_tests are the number of tests to be run on\n  // this shard.\n  int num_runnable_tests = 0;\n  int num_selected_tests = 0;\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    TestCase* const test_case = test_cases_[i];\n    const std::string &test_case_name = test_case->name();\n    test_case->set_should_run(false);\n\n    for (size_t j = 0; j < test_case->test_info_list().size(); j++) {\n      TestInfo* const test_info = test_case->test_info_list()[j];\n      const std::string test_name(test_info->name());\n      // A test is disabled if test case name or test name matches\n      // kDisableTestFilter.\n      const bool is_disabled =\n          internal::UnitTestOptions::MatchesFilter(test_case_name,\n                                                   kDisableTestFilter) ||\n          internal::UnitTestOptions::MatchesFilter(test_name,\n                                                   kDisableTestFilter);\n      test_info->is_disabled_ = is_disabled;\n\n      const bool matches_filter =\n          internal::UnitTestOptions::FilterMatchesTest(test_case_name,\n                                                       test_name);\n      test_info->matches_filter_ = matches_filter;\n\n      const bool is_runnable =\n          (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&\n          matches_filter;\n\n      const bool is_selected = is_runnable &&\n          (shard_tests == IGNORE_SHARDING_PROTOCOL ||\n           ShouldRunTestOnShard(total_shards, shard_index,\n                                num_runnable_tests));\n\n      num_runnable_tests += is_runnable;\n      num_selected_tests += is_selected;\n\n      test_info->should_run_ = is_selected;\n      test_case->set_should_run(test_case->should_run() || is_selected);\n    }\n  }\n  return num_selected_tests;\n}\n\n// Prints the given C-string on a single line by replacing all '\\n'\n// characters with string \"\\\\n\".  If the output takes more than\n// max_length characters, only prints the first max_length characters\n// and \"...\".\nstatic void PrintOnOneLine(const char* str, int max_length) {\n  if (str != NULL) {\n    for (int i = 0; *str != '\\0'; ++str) {\n      if (i >= max_length) {\n        printf(\"...\");\n        break;\n      }\n      if (*str == '\\n') {\n        printf(\"\\\\n\");\n        i += 2;\n      } else {\n        printf(\"%c\", *str);\n        ++i;\n      }\n    }\n  }\n}\n\n// Prints the names of the tests matching the user-specified filter flag.\nvoid UnitTestImpl::ListTestsMatchingFilter() {\n  // Print at most this many characters for each type/value parameter.\n  const int kMaxParamLength = 250;\n\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    const TestCase* const test_case = test_cases_[i];\n    bool printed_test_case_name = false;\n\n    for (size_t j = 0; j < test_case->test_info_list().size(); j++) {\n      const TestInfo* const test_info =\n          test_case->test_info_list()[j];\n      if (test_info->matches_filter_) {\n        if (!printed_test_case_name) {\n          printed_test_case_name = true;\n          printf(\"%s.\", test_case->name());\n          if (test_case->type_param() != NULL) {\n            printf(\"  # %s = \", kTypeParamLabel);\n            // We print the type parameter on a single line to make\n            // the output easy to parse by a program.\n            PrintOnOneLine(test_case->type_param(), kMaxParamLength);\n          }\n          printf(\"\\n\");\n        }\n        printf(\"  %s\", test_info->name());\n        if (test_info->value_param() != NULL) {\n          printf(\"  # %s = \", kValueParamLabel);\n          // We print the value parameter on a single line to make the\n          // output easy to parse by a program.\n          PrintOnOneLine(test_info->value_param(), kMaxParamLength);\n        }\n        printf(\"\\n\");\n      }\n    }\n  }\n  fflush(stdout);\n}\n\n// Sets the OS stack trace getter.\n//\n// Does nothing if the input and the current OS stack trace getter are\n// the same; otherwise, deletes the old getter and makes the input the\n// current getter.\nvoid UnitTestImpl::set_os_stack_trace_getter(\n    OsStackTraceGetterInterface* getter) {\n  if (os_stack_trace_getter_ != getter) {\n    delete os_stack_trace_getter_;\n    os_stack_trace_getter_ = getter;\n  }\n}\n\n// Returns the current OS stack trace getter if it is not NULL;\n// otherwise, creates an OsStackTraceGetter, makes it the current\n// getter, and returns it.\nOsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {\n  if (os_stack_trace_getter_ == NULL) {\n    os_stack_trace_getter_ = new OsStackTraceGetter;\n  }\n\n  return os_stack_trace_getter_;\n}\n\n// Returns the TestResult for the test that's currently running, or\n// the TestResult for the ad hoc test if no test is running.\nTestResult* UnitTestImpl::current_test_result() {\n  return current_test_info_ ?\n      &(current_test_info_->result_) : &ad_hoc_test_result_;\n}\n\n// Shuffles all test cases, and the tests within each test case,\n// making sure that death tests are still run first.\nvoid UnitTestImpl::ShuffleTests() {\n  // Shuffles the death test cases.\n  ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);\n\n  // Shuffles the non-death test cases.\n  ShuffleRange(random(), last_death_test_case_ + 1,\n               static_cast<int>(test_cases_.size()), &test_case_indices_);\n\n  // Shuffles the tests inside each test case.\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    test_cases_[i]->ShuffleTests(random());\n  }\n}\n\n// Restores the test cases and tests to their order before the first shuffle.\nvoid UnitTestImpl::UnshuffleTests() {\n  for (size_t i = 0; i < test_cases_.size(); i++) {\n    // Unshuffles the tests in each test case.\n    test_cases_[i]->UnshuffleTests();\n    // Resets the index of each test case.\n    test_case_indices_[i] = static_cast<int>(i);\n  }\n}\n\n// Returns the current OS stack trace as an std::string.\n//\n// The maximum number of stack frames to be included is specified by\n// the gtest_stack_trace_depth flag.  The skip_count parameter\n// specifies the number of top frames to be skipped, which doesn't\n// count against the number of frames to be included.\n//\n// For example, if Foo() calls Bar(), which in turn calls\n// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in\n// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.\nstd::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,\n                                            int skip_count) {\n  // We pass skip_count + 1 to skip this wrapper function in addition\n  // to what the user really wants to skip.\n  return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);\n}\n\n// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to\n// suppress unreachable code warnings.\nnamespace {\nclass ClassUniqueToAlwaysTrue {};\n}\n\nbool IsTrue(bool condition) { return condition; }\n\nbool AlwaysTrue() {\n#if GTEST_HAS_EXCEPTIONS\n  // This condition is always false so AlwaysTrue() never actually throws,\n  // but it makes the compiler think that it may throw.\n  if (IsTrue(false))\n    throw ClassUniqueToAlwaysTrue();\n#endif  // GTEST_HAS_EXCEPTIONS\n  return true;\n}\n\n// If *pstr starts with the given prefix, modifies *pstr to be right\n// past the prefix and returns true; otherwise leaves *pstr unchanged\n// and returns false.  None of pstr, *pstr, and prefix can be NULL.\nbool SkipPrefix(const char* prefix, const char** pstr) {\n  const size_t prefix_len = strlen(prefix);\n  if (strncmp(*pstr, prefix, prefix_len) == 0) {\n    *pstr += prefix_len;\n    return true;\n  }\n  return false;\n}\n\n// Parses a string as a command line flag.  The string should have\n// the format \"--flag=value\".  When def_optional is true, the \"=value\"\n// part can be omitted.\n//\n// Returns the value of the flag, or NULL if the parsing failed.\nconst char* ParseFlagValue(const char* str,\n                           const char* flag,\n                           bool def_optional) {\n  // str and flag must not be NULL.\n  if (str == NULL || flag == NULL) return NULL;\n\n  // The flag must start with \"--\" followed by GTEST_FLAG_PREFIX_.\n  const std::string flag_str = std::string(\"--\") + GTEST_FLAG_PREFIX_ + flag;\n  const size_t flag_len = flag_str.length();\n  if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;\n\n  // Skips the flag name.\n  const char* flag_end = str + flag_len;\n\n  // When def_optional is true, it's OK to not have a \"=value\" part.\n  if (def_optional && (flag_end[0] == '\\0')) {\n    return flag_end;\n  }\n\n  // If def_optional is true and there are more characters after the\n  // flag name, or if def_optional is false, there must be a '=' after\n  // the flag name.\n  if (flag_end[0] != '=') return NULL;\n\n  // Returns the string after \"=\".\n  return flag_end + 1;\n}\n\n// Parses a string for a bool flag, in the form of either\n// \"--flag=value\" or \"--flag\".\n//\n// In the former case, the value is taken as true as long as it does\n// not start with '0', 'f', or 'F'.\n//\n// In the latter case, the value is taken as true.\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nbool ParseBoolFlag(const char* str, const char* flag, bool* value) {\n  // Gets the value of the flag as a string.\n  const char* const value_str = ParseFlagValue(str, flag, true);\n\n  // Aborts if the parsing failed.\n  if (value_str == NULL) return false;\n\n  // Converts the string value to a bool.\n  *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');\n  return true;\n}\n\n// Parses a string for an Int32 flag, in the form of\n// \"--flag=value\".\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nbool ParseInt32Flag(const char* str, const char* flag, Int32* value) {\n  // Gets the value of the flag as a string.\n  const char* const value_str = ParseFlagValue(str, flag, false);\n\n  // Aborts if the parsing failed.\n  if (value_str == NULL) return false;\n\n  // Sets *value to the value of the flag.\n  return ParseInt32(Message() << \"The value of flag --\" << flag,\n                    value_str, value);\n}\n\n// Parses a string for a string flag, in the form of\n// \"--flag=value\".\n//\n// On success, stores the value of the flag in *value, and returns\n// true.  On failure, returns false without changing *value.\nbool ParseStringFlag(const char* str, const char* flag, std::string* value) {\n  // Gets the value of the flag as a string.\n  const char* const value_str = ParseFlagValue(str, flag, false);\n\n  // Aborts if the parsing failed.\n  if (value_str == NULL) return false;\n\n  // Sets *value to the value of the flag.\n  *value = value_str;\n  return true;\n}\n\n// Determines whether a string has a prefix that Google Test uses for its\n// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.\n// If Google Test detects that a command line flag has its prefix but is not\n// recognized, it will print its help message. Flags starting with\n// GTEST_INTERNAL_PREFIX_ followed by \"internal_\" are considered Google Test\n// internal flags and do not trigger the help message.\nstatic bool HasGoogleTestFlagPrefix(const char* str) {\n  return (SkipPrefix(\"--\", &str) ||\n          SkipPrefix(\"-\", &str) ||\n          SkipPrefix(\"/\", &str)) &&\n         !SkipPrefix(GTEST_FLAG_PREFIX_ \"internal_\", &str) &&\n         (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||\n          SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));\n}\n\n// Prints a string containing code-encoded text.  The following escape\n// sequences can be used in the string to control the text color:\n//\n//   @@    prints a single '@' character.\n//   @R    changes the color to red.\n//   @G    changes the color to green.\n//   @Y    changes the color to yellow.\n//   @D    changes to the default terminal text color.\n//\n// TODO(wan@google.com): Write tests for this once we add stdout\n// capturing to Google Test.\nstatic void PrintColorEncoded(const char* str) {\n  GTestColor color = COLOR_DEFAULT;  // The current color.\n\n  // Conceptually, we split the string into segments divided by escape\n  // sequences.  Then we print one segment at a time.  At the end of\n  // each iteration, the str pointer advances to the beginning of the\n  // next segment.\n  for (;;) {\n    const char* p = strchr(str, '@');\n    if (p == NULL) {\n      ColoredPrintf(color, \"%s\", str);\n      return;\n    }\n\n    ColoredPrintf(color, \"%s\", std::string(str, p).c_str());\n\n    const char ch = p[1];\n    str = p + 2;\n    if (ch == '@') {\n      ColoredPrintf(color, \"@\");\n    } else if (ch == 'D') {\n      color = COLOR_DEFAULT;\n    } else if (ch == 'R') {\n      color = COLOR_RED;\n    } else if (ch == 'G') {\n      color = COLOR_GREEN;\n    } else if (ch == 'Y') {\n      color = COLOR_YELLOW;\n    } else {\n      --str;\n    }\n  }\n}\n\nstatic const char kColorEncodedHelpMessage[] =\n\"This program contains tests written using \" GTEST_NAME_ \". You can use the\\n\"\n\"following command line flags to control its behavior:\\n\"\n\"\\n\"\n\"Test Selection:\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"list_tests@D\\n\"\n\"      List the names of all tests instead of running them. The name of\\n\"\n\"      TEST(Foo, Bar) is \\\"Foo.Bar\\\".\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"filter=@YPOSTIVE_PATTERNS\"\n    \"[@G-@YNEGATIVE_PATTERNS]@D\\n\"\n\"      Run only the tests whose name matches one of the positive patterns but\\n\"\n\"      none of the negative patterns. '?' matches any single character; '*'\\n\"\n\"      matches any substring; ':' separates two patterns.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"also_run_disabled_tests@D\\n\"\n\"      Run all disabled tests too.\\n\"\n\"\\n\"\n\"Test Execution:\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"repeat=@Y[COUNT]@D\\n\"\n\"      Run the tests repeatedly; use a negative count to repeat forever.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"shuffle@D\\n\"\n\"      Randomize tests' orders on every iteration.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"random_seed=@Y[NUMBER]@D\\n\"\n\"      Random number seed to use for shuffling test orders (between 1 and\\n\"\n\"      99999, or 0 to use a seed based on the current time).\\n\"\n\"\\n\"\n\"Test Output:\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\\n\"\n\"      Enable/disable colored output. The default is @Gauto@D.\\n\"\n\"  -@G-\" GTEST_FLAG_PREFIX_ \"print_time=0@D\\n\"\n\"      Don't print the elapsed time of each test.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"output=xml@Y[@G:@YDIRECTORY_PATH@G\"\n    GTEST_PATH_SEP_ \"@Y|@G:@YFILE_PATH]@D\\n\"\n\"      Generate an XML report in the given directory or with the given file\\n\"\n\"      name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\\n\"\n#if GTEST_CAN_STREAM_RESULTS_\n\"  @G--\" GTEST_FLAG_PREFIX_ \"stream_result_to=@YHOST@G:@YPORT@D\\n\"\n\"      Stream test results to the given server.\\n\"\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\"\\n\"\n\"Assertion Behavior:\\n\"\n#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS\n\"  @G--\" GTEST_FLAG_PREFIX_ \"death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\\n\"\n\"      Set the default death test style.\\n\"\n#endif  // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS\n\"  @G--\" GTEST_FLAG_PREFIX_ \"break_on_failure@D\\n\"\n\"      Turn assertion failures into debugger break-points.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"throw_on_failure@D\\n\"\n\"      Turn assertion failures into C++ exceptions.\\n\"\n\"  @G--\" GTEST_FLAG_PREFIX_ \"catch_exceptions=0@D\\n\"\n\"      Do not report exceptions as test failures. Instead, allow them\\n\"\n\"      to crash the program or throw a pop-up (on Windows).\\n\"\n\"\\n\"\n\"Except for @G--\" GTEST_FLAG_PREFIX_ \"list_tests@D, you can alternatively set \"\n    \"the corresponding\\n\"\n\"environment variable of a flag (all letters in upper-case). For example, to\\n\"\n\"disable colored text output, you can either specify @G--\" GTEST_FLAG_PREFIX_\n    \"color=no@D or set\\n\"\n\"the @G\" GTEST_FLAG_PREFIX_UPPER_ \"COLOR@D environment variable to @Gno@D.\\n\"\n\"\\n\"\n\"For more information, please read the \" GTEST_NAME_ \" documentation at\\n\"\n\"@G\" GTEST_PROJECT_URL_ \"@D. If you find a bug in \" GTEST_NAME_ \"\\n\"\n\"(not one in your own code or tests), please report it to\\n\"\n\"@G<\" GTEST_DEV_EMAIL_ \">@D.\\n\";\n\n// Parses the command line for Google Test flags, without initializing\n// other parts of Google Test.  The type parameter CharType can be\n// instantiated to either char or wchar_t.\ntemplate <typename CharType>\nvoid ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {\n  for (int i = 1; i < *argc; i++) {\n    const std::string arg_string = StreamableToString(argv[i]);\n    const char* const arg = arg_string.c_str();\n\n    using internal::ParseBoolFlag;\n    using internal::ParseInt32Flag;\n    using internal::ParseStringFlag;\n\n    // Do we see a Google Test flag?\n    if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,\n                      &GTEST_FLAG(also_run_disabled_tests)) ||\n        ParseBoolFlag(arg, kBreakOnFailureFlag,\n                      &GTEST_FLAG(break_on_failure)) ||\n        ParseBoolFlag(arg, kCatchExceptionsFlag,\n                      &GTEST_FLAG(catch_exceptions)) ||\n        ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||\n        ParseStringFlag(arg, kDeathTestStyleFlag,\n                        &GTEST_FLAG(death_test_style)) ||\n        ParseBoolFlag(arg, kDeathTestUseFork,\n                      &GTEST_FLAG(death_test_use_fork)) ||\n        ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||\n        ParseStringFlag(arg, kInternalRunDeathTestFlag,\n                        &GTEST_FLAG(internal_run_death_test)) ||\n        ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||\n        ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||\n        ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||\n        ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||\n        ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||\n        ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||\n        ParseInt32Flag(arg, kStackTraceDepthFlag,\n                       &GTEST_FLAG(stack_trace_depth)) ||\n        ParseStringFlag(arg, kStreamResultToFlag,\n                        &GTEST_FLAG(stream_result_to)) ||\n        ParseBoolFlag(arg, kThrowOnFailureFlag,\n                      &GTEST_FLAG(throw_on_failure))\n        ) {\n      // Yes.  Shift the remainder of the argv list left by one.  Note\n      // that argv has (*argc + 1) elements, the last one always being\n      // NULL.  The following loop moves the trailing NULL element as\n      // well.\n      for (int j = i; j != *argc; j++) {\n        argv[j] = argv[j + 1];\n      }\n\n      // Decrements the argument count.\n      (*argc)--;\n\n      // We also need to decrement the iterator as we just removed\n      // an element.\n      i--;\n    } else if (arg_string == \"--help\" || arg_string == \"-h\" ||\n               arg_string == \"-?\" || arg_string == \"/?\" ||\n               HasGoogleTestFlagPrefix(arg)) {\n      // Both help flag and unrecognized Google Test flags (excluding\n      // internal ones) trigger help display.\n      g_help_flag = true;\n    }\n  }\n\n  if (g_help_flag) {\n    // We print the help here instead of in RUN_ALL_TESTS(), as the\n    // latter may not be called at all if the user is using Google\n    // Test with another testing framework.\n    PrintColorEncoded(kColorEncodedHelpMessage);\n  }\n}\n\n// Parses the command line for Google Test flags, without initializing\n// other parts of Google Test.\nvoid ParseGoogleTestFlagsOnly(int* argc, char** argv) {\n  ParseGoogleTestFlagsOnlyImpl(argc, argv);\n}\nvoid ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {\n  ParseGoogleTestFlagsOnlyImpl(argc, argv);\n}\n\n// The internal implementation of InitGoogleTest().\n//\n// The type parameter CharType can be instantiated to either char or\n// wchar_t.\ntemplate <typename CharType>\nvoid InitGoogleTestImpl(int* argc, CharType** argv) {\n  g_init_gtest_count++;\n\n  // We don't want to run the initialization code twice.\n  if (g_init_gtest_count != 1) return;\n\n  if (*argc <= 0) return;\n\n  internal::g_executable_path = internal::StreamableToString(argv[0]);\n\n#if GTEST_HAS_DEATH_TEST\n\n  g_argvs.clear();\n  for (int i = 0; i != *argc; i++) {\n    g_argvs.push_back(StreamableToString(argv[i]));\n  }\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n  ParseGoogleTestFlagsOnly(argc, argv);\n  GetUnitTestImpl()->PostFlagParsingInit();\n}\n\n}  // namespace internal\n\n// Initializes Google Test.  This must be called before calling\n// RUN_ALL_TESTS().  In particular, it parses a command line for the\n// flags that Google Test recognizes.  Whenever a Google Test flag is\n// seen, it is removed from argv, and *argc is decremented.\n//\n// No value is returned.  Instead, the Google Test flag variables are\n// updated.\n//\n// Calling the function for the second time has no user-visible effect.\nvoid InitGoogleTest(int* argc, char** argv) {\n  internal::InitGoogleTestImpl(argc, argv);\n}\n\n// This overloaded version can be used in Windows programs compiled in\n// UNICODE mode.\nvoid InitGoogleTest(int* argc, wchar_t** argv) {\n  internal::InitGoogleTestImpl(argc, argv);\n}\n\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/src/gtest_main.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#include <stdio.h>\n\n#include \"gtest/gtest.h\"\n\nGTEST_API_ int main(int argc, char **argv) {\n  printf(\"Running main() from gtest_main.cc\\n\");\n  testing::InitGoogleTest(&argc, argv);\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest-death-test_ex_test.cc",
    "content": "// Copyright 2010, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n//\n// Tests that verify interaction of exceptions and death tests.\n\n#include \"gtest/gtest-death-test.h\"\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_DEATH_TEST\n\n# if GTEST_HAS_SEH\n#  include <windows.h>          // For RaiseException().\n# endif\n\n# include \"gtest/gtest-spi.h\"\n\n# if GTEST_HAS_EXCEPTIONS\n\n#  include <exception>  // For std::exception.\n\n// Tests that death tests report thrown exceptions as failures and that the\n// exceptions do not escape death test macros.\nTEST(CxxExceptionDeathTest, ExceptionIsFailure) {\n  try {\n    EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw 1, \"\"), \"threw an exception\");\n  } catch (...) {  // NOLINT\n    FAIL() << \"An exception escaped a death test macro invocation \"\n           << \"with catch_exceptions \"\n           << (testing::GTEST_FLAG(catch_exceptions) ? \"enabled\" : \"disabled\");\n  }\n}\n\nclass TestException : public std::exception {\n public:\n  virtual const char* what() const throw() { return \"exceptional message\"; }\n};\n\nTEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {\n  // Verifies that the exception message is quoted in the failure text.\n  EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), \"\"),\n                          \"exceptional message\");\n  // Verifies that the location is mentioned in the failure text.\n  EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), \"\"),\n                          \"gtest-death-test_ex_test.cc\");\n}\n# endif  // GTEST_HAS_EXCEPTIONS\n\n# if GTEST_HAS_SEH\n// Tests that enabling interception of SEH exceptions with the\n// catch_exceptions flag does not interfere with SEH exceptions being\n// treated as death by death tests.\nTEST(SehExceptionDeasTest, CatchExceptionsDoesNotInterfere) {\n  EXPECT_DEATH(RaiseException(42, 0x0, 0, NULL), \"\")\n      << \"with catch_exceptions \"\n      << (testing::GTEST_FLAG(catch_exceptions) ? \"enabled\" : \"disabled\");\n}\n# endif\n\n#endif  // GTEST_HAS_DEATH_TEST\n\nint main(int argc, char** argv) {\n  testing::InitGoogleTest(&argc, argv);\n  testing::GTEST_FLAG(catch_exceptions) = GTEST_ENABLE_CATCH_EXCEPTIONS_ != 0;\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest-death-test_test.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Tests for death tests.\n\n#include \"gtest/gtest-death-test.h\"\n#include \"gtest/gtest.h\"\n#include \"gtest/internal/gtest-filepath.h\"\n\nusing testing::internal::AlwaysFalse;\nusing testing::internal::AlwaysTrue;\n\n#if GTEST_HAS_DEATH_TEST\n\n# if GTEST_OS_WINDOWS\n#  include <direct.h>          // For chdir().\n# else\n#  include <unistd.h>\n#  include <sys/wait.h>        // For waitpid.\n# endif  // GTEST_OS_WINDOWS\n\n# include <limits.h>\n# include <signal.h>\n# include <stdio.h>\n\n# if GTEST_OS_LINUX\n#  include <sys/time.h>\n# endif  // GTEST_OS_LINUX\n\n# include \"gtest/gtest-spi.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n# define GTEST_IMPLEMENTATION_ 1\n# include \"src/gtest-internal-inl.h\"\n# undef GTEST_IMPLEMENTATION_\n\nnamespace posix = ::testing::internal::posix;\n\nusing testing::Message;\nusing testing::internal::DeathTest;\nusing testing::internal::DeathTestFactory;\nusing testing::internal::FilePath;\nusing testing::internal::GetLastErrnoDescription;\nusing testing::internal::GetUnitTestImpl;\nusing testing::internal::InDeathTestChild;\nusing testing::internal::ParseNaturalNumber;\n\nnamespace testing {\nnamespace internal {\n\n// A helper class whose objects replace the death test factory for a\n// single UnitTest object during their lifetimes.\nclass ReplaceDeathTestFactory {\n public:\n  explicit ReplaceDeathTestFactory(DeathTestFactory* new_factory)\n      : unit_test_impl_(GetUnitTestImpl()) {\n    old_factory_ = unit_test_impl_->death_test_factory_.release();\n    unit_test_impl_->death_test_factory_.reset(new_factory);\n  }\n\n  ~ReplaceDeathTestFactory() {\n    unit_test_impl_->death_test_factory_.release();\n    unit_test_impl_->death_test_factory_.reset(old_factory_);\n  }\n private:\n  // Prevents copying ReplaceDeathTestFactory objects.\n  ReplaceDeathTestFactory(const ReplaceDeathTestFactory&);\n  void operator=(const ReplaceDeathTestFactory&);\n\n  UnitTestImpl* unit_test_impl_;\n  DeathTestFactory* old_factory_;\n};\n\n}  // namespace internal\n}  // namespace testing\n\nvoid DieWithMessage(const ::std::string& message) {\n  fprintf(stderr, \"%s\", message.c_str());\n  fflush(stderr);  // Make sure the text is printed before the process exits.\n\n  // We call _exit() instead of exit(), as the former is a direct\n  // system call and thus safer in the presence of threads.  exit()\n  // will invoke user-defined exit-hooks, which may do dangerous\n  // things that conflict with death tests.\n  //\n  // Some compilers can recognize that _exit() never returns and issue the\n  // 'unreachable code' warning for code following this function, unless\n  // fooled by a fake condition.\n  if (AlwaysTrue())\n    _exit(1);\n}\n\nvoid DieInside(const ::std::string& function) {\n  DieWithMessage(\"death inside \" + function + \"().\");\n}\n\n// Tests that death tests work.\n\nclass TestForDeathTest : public testing::Test {\n protected:\n  TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}\n\n  virtual ~TestForDeathTest() {\n    posix::ChDir(original_dir_.c_str());\n  }\n\n  // A static member function that's expected to die.\n  static void StaticMemberFunction() { DieInside(\"StaticMemberFunction\"); }\n\n  // A method of the test fixture that may die.\n  void MemberFunction() {\n    if (should_die_)\n      DieInside(\"MemberFunction\");\n  }\n\n  // True iff MemberFunction() should die.\n  bool should_die_;\n  const FilePath original_dir_;\n};\n\n// A class with a member function that may die.\nclass MayDie {\n public:\n  explicit MayDie(bool should_die) : should_die_(should_die) {}\n\n  // A member function that may die.\n  void MemberFunction() const {\n    if (should_die_)\n      DieInside(\"MayDie::MemberFunction\");\n  }\n\n private:\n  // True iff MemberFunction() should die.\n  bool should_die_;\n};\n\n// A global function that's expected to die.\nvoid GlobalFunction() { DieInside(\"GlobalFunction\"); }\n\n// A non-void function that's expected to die.\nint NonVoidFunction() {\n  DieInside(\"NonVoidFunction\");\n  return 1;\n}\n\n// A unary function that may die.\nvoid DieIf(bool should_die) {\n  if (should_die)\n    DieInside(\"DieIf\");\n}\n\n// A binary function that may die.\nbool DieIfLessThan(int x, int y) {\n  if (x < y) {\n    DieInside(\"DieIfLessThan\");\n  }\n  return true;\n}\n\n// Tests that ASSERT_DEATH can be used outside a TEST, TEST_F, or test fixture.\nvoid DeathTestSubroutine() {\n  EXPECT_DEATH(GlobalFunction(), \"death.*GlobalFunction\");\n  ASSERT_DEATH(GlobalFunction(), \"death.*GlobalFunction\");\n}\n\n// Death in dbg, not opt.\nint DieInDebugElse12(int* sideeffect) {\n  if (sideeffect) *sideeffect = 12;\n\n# ifndef NDEBUG\n\n  DieInside(\"DieInDebugElse12\");\n\n# endif  // NDEBUG\n\n  return 12;\n}\n\n# if GTEST_OS_WINDOWS\n\n// Tests the ExitedWithCode predicate.\nTEST(ExitStatusPredicateTest, ExitedWithCode) {\n  // On Windows, the process's exit code is the same as its exit status,\n  // so the predicate just compares the its input with its parameter.\n  EXPECT_TRUE(testing::ExitedWithCode(0)(0));\n  EXPECT_TRUE(testing::ExitedWithCode(1)(1));\n  EXPECT_TRUE(testing::ExitedWithCode(42)(42));\n  EXPECT_FALSE(testing::ExitedWithCode(0)(1));\n  EXPECT_FALSE(testing::ExitedWithCode(1)(0));\n}\n\n# else\n\n// Returns the exit status of a process that calls _exit(2) with a\n// given exit code.  This is a helper function for the\n// ExitStatusPredicateTest test suite.\nstatic int NormalExitStatus(int exit_code) {\n  pid_t child_pid = fork();\n  if (child_pid == 0) {\n    _exit(exit_code);\n  }\n  int status;\n  waitpid(child_pid, &status, 0);\n  return status;\n}\n\n// Returns the exit status of a process that raises a given signal.\n// If the signal does not cause the process to die, then it returns\n// instead the exit status of a process that exits normally with exit\n// code 1.  This is a helper function for the ExitStatusPredicateTest\n// test suite.\nstatic int KilledExitStatus(int signum) {\n  pid_t child_pid = fork();\n  if (child_pid == 0) {\n    raise(signum);\n    _exit(1);\n  }\n  int status;\n  waitpid(child_pid, &status, 0);\n  return status;\n}\n\n// Tests the ExitedWithCode predicate.\nTEST(ExitStatusPredicateTest, ExitedWithCode) {\n  const int status0  = NormalExitStatus(0);\n  const int status1  = NormalExitStatus(1);\n  const int status42 = NormalExitStatus(42);\n  const testing::ExitedWithCode pred0(0);\n  const testing::ExitedWithCode pred1(1);\n  const testing::ExitedWithCode pred42(42);\n  EXPECT_PRED1(pred0,  status0);\n  EXPECT_PRED1(pred1,  status1);\n  EXPECT_PRED1(pred42, status42);\n  EXPECT_FALSE(pred0(status1));\n  EXPECT_FALSE(pred42(status0));\n  EXPECT_FALSE(pred1(status42));\n}\n\n// Tests the KilledBySignal predicate.\nTEST(ExitStatusPredicateTest, KilledBySignal) {\n  const int status_segv = KilledExitStatus(SIGSEGV);\n  const int status_kill = KilledExitStatus(SIGKILL);\n  const testing::KilledBySignal pred_segv(SIGSEGV);\n  const testing::KilledBySignal pred_kill(SIGKILL);\n  EXPECT_PRED1(pred_segv, status_segv);\n  EXPECT_PRED1(pred_kill, status_kill);\n  EXPECT_FALSE(pred_segv(status_kill));\n  EXPECT_FALSE(pred_kill(status_segv));\n}\n\n# endif  // GTEST_OS_WINDOWS\n\n// Tests that the death test macros expand to code which may or may not\n// be followed by operator<<, and that in either case the complete text\n// comprises only a single C++ statement.\nTEST_F(TestForDeathTest, SingleStatement) {\n  if (AlwaysFalse())\n    // This would fail if executed; this is a compilation test only\n    ASSERT_DEATH(return, \"\");\n\n  if (AlwaysTrue())\n    EXPECT_DEATH(_exit(1), \"\");\n  else\n    // This empty \"else\" branch is meant to ensure that EXPECT_DEATH\n    // doesn't expand into an \"if\" statement without an \"else\"\n    ;\n\n  if (AlwaysFalse())\n    ASSERT_DEATH(return, \"\") << \"did not die\";\n\n  if (AlwaysFalse())\n    ;\n  else\n    EXPECT_DEATH(_exit(1), \"\") << 1 << 2 << 3;\n}\n\nvoid DieWithEmbeddedNul() {\n  fprintf(stderr, \"Hello%cmy null world.\\n\", '\\0');\n  fflush(stderr);\n  _exit(1);\n}\n\n# if GTEST_USES_PCRE\n// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error\n// message has a NUL character in it.\nTEST_F(TestForDeathTest, EmbeddedNulInMessage) {\n  // TODO(wan@google.com): <regex.h> doesn't support matching strings\n  // with embedded NUL characters - find a way to workaround it.\n  EXPECT_DEATH(DieWithEmbeddedNul(), \"my null world\");\n  ASSERT_DEATH(DieWithEmbeddedNul(), \"my null world\");\n}\n# endif  // GTEST_USES_PCRE\n\n// Tests that death test macros expand to code which interacts well with switch\n// statements.\nTEST_F(TestForDeathTest, SwitchStatement) {\n// Microsoft compiler usually complains about switch statements without\n// case labels. We suppress that warning for this test.\n# ifdef _MSC_VER\n#  pragma warning(push)\n#  pragma warning(disable: 4065)\n# endif  // _MSC_VER\n\n  switch (0)\n    default:\n      ASSERT_DEATH(_exit(1), \"\") << \"exit in default switch handler\";\n\n  switch (0)\n    case 0:\n      EXPECT_DEATH(_exit(1), \"\") << \"exit in switch case\";\n\n# ifdef _MSC_VER\n#  pragma warning(pop)\n# endif  // _MSC_VER\n}\n\n// Tests that a static member function can be used in a \"fast\" style\n// death test.\nTEST_F(TestForDeathTest, StaticMemberFunctionFastStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  ASSERT_DEATH(StaticMemberFunction(), \"death.*StaticMember\");\n}\n\n// Tests that a method of the test fixture can be used in a \"fast\"\n// style death test.\nTEST_F(TestForDeathTest, MemberFunctionFastStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  should_die_ = true;\n  EXPECT_DEATH(MemberFunction(), \"inside.*MemberFunction\");\n}\n\nvoid ChangeToRootDir() { posix::ChDir(GTEST_PATH_SEP_); }\n\n// Tests that death tests work even if the current directory has been\n// changed.\nTEST_F(TestForDeathTest, FastDeathTestInChangedDir) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n\n  ChangeToRootDir();\n  EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), \"\");\n\n  ChangeToRootDir();\n  ASSERT_DEATH(_exit(1), \"\");\n}\n\n# if GTEST_OS_LINUX\nvoid SigprofAction(int, siginfo_t*, void*) { /* no op */ }\n\n// Sets SIGPROF action and ITIMER_PROF timer (interval: 1ms).\nvoid SetSigprofActionAndTimer() {\n  struct itimerval timer;\n  timer.it_interval.tv_sec = 0;\n  timer.it_interval.tv_usec = 1;\n  timer.it_value = timer.it_interval;\n  ASSERT_EQ(0, setitimer(ITIMER_PROF, &timer, NULL));\n  struct sigaction signal_action;\n  memset(&signal_action, 0, sizeof(signal_action));\n  sigemptyset(&signal_action.sa_mask);\n  signal_action.sa_sigaction = SigprofAction;\n  signal_action.sa_flags = SA_RESTART | SA_SIGINFO;\n  ASSERT_EQ(0, sigaction(SIGPROF, &signal_action, NULL));\n}\n\n// Disables ITIMER_PROF timer and ignores SIGPROF signal.\nvoid DisableSigprofActionAndTimer(struct sigaction* old_signal_action) {\n  struct itimerval timer;\n  timer.it_interval.tv_sec = 0;\n  timer.it_interval.tv_usec = 0;\n  timer.it_value = timer.it_interval;\n  ASSERT_EQ(0, setitimer(ITIMER_PROF, &timer, NULL));\n  struct sigaction signal_action;\n  memset(&signal_action, 0, sizeof(signal_action));\n  sigemptyset(&signal_action.sa_mask);\n  signal_action.sa_handler = SIG_IGN;\n  ASSERT_EQ(0, sigaction(SIGPROF, &signal_action, old_signal_action));\n}\n\n// Tests that death tests work when SIGPROF handler and timer are set.\nTEST_F(TestForDeathTest, FastSigprofActionSet) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  SetSigprofActionAndTimer();\n  EXPECT_DEATH(_exit(1), \"\");\n  struct sigaction old_signal_action;\n  DisableSigprofActionAndTimer(&old_signal_action);\n  EXPECT_TRUE(old_signal_action.sa_sigaction == SigprofAction);\n}\n\nTEST_F(TestForDeathTest, ThreadSafeSigprofActionSet) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n  SetSigprofActionAndTimer();\n  EXPECT_DEATH(_exit(1), \"\");\n  struct sigaction old_signal_action;\n  DisableSigprofActionAndTimer(&old_signal_action);\n  EXPECT_TRUE(old_signal_action.sa_sigaction == SigprofAction);\n}\n# endif  // GTEST_OS_LINUX\n\n// Repeats a representative sample of death tests in the \"threadsafe\" style:\n\nTEST_F(TestForDeathTest, StaticMemberFunctionThreadsafeStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n  ASSERT_DEATH(StaticMemberFunction(), \"death.*StaticMember\");\n}\n\nTEST_F(TestForDeathTest, MemberFunctionThreadsafeStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n  should_die_ = true;\n  EXPECT_DEATH(MemberFunction(), \"inside.*MemberFunction\");\n}\n\nTEST_F(TestForDeathTest, ThreadsafeDeathTestInLoop) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n\n  for (int i = 0; i < 3; ++i)\n    EXPECT_EXIT(_exit(i), testing::ExitedWithCode(i), \"\") << \": i = \" << i;\n}\n\nTEST_F(TestForDeathTest, ThreadsafeDeathTestInChangedDir) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n\n  ChangeToRootDir();\n  EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), \"\");\n\n  ChangeToRootDir();\n  ASSERT_DEATH(_exit(1), \"\");\n}\n\nTEST_F(TestForDeathTest, MixedStyles) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n  EXPECT_DEATH(_exit(1), \"\");\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_DEATH(_exit(1), \"\");\n}\n\n# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD\n\nnamespace {\n\nbool pthread_flag;\n\nvoid SetPthreadFlag() {\n  pthread_flag = true;\n}\n\n}  // namespace\n\nTEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {\n  if (!testing::GTEST_FLAG(death_test_use_fork)) {\n    testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n    pthread_flag = false;\n    ASSERT_EQ(0, pthread_atfork(&SetPthreadFlag, NULL, NULL));\n    ASSERT_DEATH(_exit(1), \"\");\n    ASSERT_FALSE(pthread_flag);\n  }\n}\n\n# endif  // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD\n\n// Tests that a method of another class can be used in a death test.\nTEST_F(TestForDeathTest, MethodOfAnotherClass) {\n  const MayDie x(true);\n  ASSERT_DEATH(x.MemberFunction(), \"MayDie\\\\:\\\\:MemberFunction\");\n}\n\n// Tests that a global function can be used in a death test.\nTEST_F(TestForDeathTest, GlobalFunction) {\n  EXPECT_DEATH(GlobalFunction(), \"GlobalFunction\");\n}\n\n// Tests that any value convertible to an RE works as a second\n// argument to EXPECT_DEATH.\nTEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {\n  static const char regex_c_str[] = \"GlobalFunction\";\n  EXPECT_DEATH(GlobalFunction(), regex_c_str);\n\n  const testing::internal::RE regex(regex_c_str);\n  EXPECT_DEATH(GlobalFunction(), regex);\n\n# if GTEST_HAS_GLOBAL_STRING\n\n  const string regex_str(regex_c_str);\n  EXPECT_DEATH(GlobalFunction(), regex_str);\n\n# endif  // GTEST_HAS_GLOBAL_STRING\n\n  const ::std::string regex_std_str(regex_c_str);\n  EXPECT_DEATH(GlobalFunction(), regex_std_str);\n}\n\n// Tests that a non-void function can be used in a death test.\nTEST_F(TestForDeathTest, NonVoidFunction) {\n  ASSERT_DEATH(NonVoidFunction(), \"NonVoidFunction\");\n}\n\n// Tests that functions that take parameter(s) can be used in a death test.\nTEST_F(TestForDeathTest, FunctionWithParameter) {\n  EXPECT_DEATH(DieIf(true), \"DieIf\\\\(\\\\)\");\n  EXPECT_DEATH(DieIfLessThan(2, 3), \"DieIfLessThan\");\n}\n\n// Tests that ASSERT_DEATH can be used outside a TEST, TEST_F, or test fixture.\nTEST_F(TestForDeathTest, OutsideFixture) {\n  DeathTestSubroutine();\n}\n\n// Tests that death tests can be done inside a loop.\nTEST_F(TestForDeathTest, InsideLoop) {\n  for (int i = 0; i < 5; i++) {\n    EXPECT_DEATH(DieIfLessThan(-1, i), \"DieIfLessThan\") << \"where i == \" << i;\n  }\n}\n\n// Tests that a compound statement can be used in a death test.\nTEST_F(TestForDeathTest, CompoundStatement) {\n  EXPECT_DEATH({  // NOLINT\n    const int x = 2;\n    const int y = x + 1;\n    DieIfLessThan(x, y);\n  },\n  \"DieIfLessThan\");\n}\n\n// Tests that code that doesn't die causes a death test to fail.\nTEST_F(TestForDeathTest, DoesNotDie) {\n  EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(DieIf(false), \"DieIf\"),\n                          \"failed to die\");\n}\n\n// Tests that a death test fails when the error message isn't expected.\nTEST_F(TestForDeathTest, ErrorMessageMismatch) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_DEATH(DieIf(true), \"DieIfLessThan\") << \"End of death test message.\";\n  }, \"died but not with expected error\");\n}\n\n// On exit, *aborted will be true iff the EXPECT_DEATH() statement\n// aborted the function.\nvoid ExpectDeathTestHelper(bool* aborted) {\n  *aborted = true;\n  EXPECT_DEATH(DieIf(false), \"DieIf\");  // This assertion should fail.\n  *aborted = false;\n}\n\n// Tests that EXPECT_DEATH doesn't abort the test on failure.\nTEST_F(TestForDeathTest, EXPECT_DEATH) {\n  bool aborted = true;\n  EXPECT_NONFATAL_FAILURE(ExpectDeathTestHelper(&aborted),\n                          \"failed to die\");\n  EXPECT_FALSE(aborted);\n}\n\n// Tests that ASSERT_DEATH does abort the test on failure.\nTEST_F(TestForDeathTest, ASSERT_DEATH) {\n  static bool aborted;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    aborted = true;\n    ASSERT_DEATH(DieIf(false), \"DieIf\");  // This assertion should fail.\n    aborted = false;\n  }, \"failed to die\");\n  EXPECT_TRUE(aborted);\n}\n\n// Tests that EXPECT_DEATH evaluates the arguments exactly once.\nTEST_F(TestForDeathTest, SingleEvaluation) {\n  int x = 3;\n  EXPECT_DEATH(DieIf((++x) == 4), \"DieIf\");\n\n  const char* regex = \"DieIf\";\n  const char* regex_save = regex;\n  EXPECT_DEATH(DieIfLessThan(3, 4), regex++);\n  EXPECT_EQ(regex_save + 1, regex);\n}\n\n// Tests that run-away death tests are reported as failures.\nTEST_F(TestForDeathTest, RunawayIsFailure) {\n  EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(static_cast<void>(0), \"Foo\"),\n                          \"failed to die.\");\n}\n\n// Tests that death tests report executing 'return' in the statement as\n// failure.\nTEST_F(TestForDeathTest, ReturnIsFailure) {\n  EXPECT_FATAL_FAILURE(ASSERT_DEATH(return, \"Bar\"),\n                       \"illegal return in test statement.\");\n}\n\n// Tests that EXPECT_DEBUG_DEATH works as expected, that is, you can stream a\n// message to it, and in debug mode it:\n// 1. Asserts on death.\n// 2. Has no side effect.\n//\n// And in opt mode, it:\n// 1.  Has side effects but does not assert.\nTEST_F(TestForDeathTest, TestExpectDebugDeath) {\n  int sideeffect = 0;\n\n  EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), \"death.*DieInDebugElse12\")\n      << \"Must accept a streamed message\";\n\n# ifdef NDEBUG\n\n  // Checks that the assignment occurs in opt mode (sideeffect).\n  EXPECT_EQ(12, sideeffect);\n\n# else\n\n  // Checks that the assignment does not occur in dbg mode (no sideeffect).\n  EXPECT_EQ(0, sideeffect);\n\n# endif\n}\n\n// Tests that ASSERT_DEBUG_DEATH works as expected, that is, you can stream a\n// message to it, and in debug mode it:\n// 1. Asserts on death.\n// 2. Has no side effect.\n//\n// And in opt mode, it:\n// 1.  Has side effects but does not assert.\nTEST_F(TestForDeathTest, TestAssertDebugDeath) {\n  int sideeffect = 0;\n\n  ASSERT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), \"death.*DieInDebugElse12\")\n      << \"Must accept a streamed message\";\n\n# ifdef NDEBUG\n\n  // Checks that the assignment occurs in opt mode (sideeffect).\n  EXPECT_EQ(12, sideeffect);\n\n# else\n\n  // Checks that the assignment does not occur in dbg mode (no sideeffect).\n  EXPECT_EQ(0, sideeffect);\n\n# endif\n}\n\n# ifndef NDEBUG\n\nvoid ExpectDebugDeathHelper(bool* aborted) {\n  *aborted = true;\n  EXPECT_DEBUG_DEATH(return, \"\") << \"This is expected to fail.\";\n  *aborted = false;\n}\n\n#  if GTEST_OS_WINDOWS\nTEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {\n  printf(\"This test should be considered failing if it shows \"\n         \"any pop-up dialogs.\\n\");\n  fflush(stdout);\n\n  EXPECT_DEATH({\n    testing::GTEST_FLAG(catch_exceptions) = false;\n    abort();\n  }, \"\");\n}\n#  endif  // GTEST_OS_WINDOWS\n\n// Tests that EXPECT_DEBUG_DEATH in debug mode does not abort\n// the function.\nTEST_F(TestForDeathTest, ExpectDebugDeathDoesNotAbort) {\n  bool aborted = true;\n  EXPECT_NONFATAL_FAILURE(ExpectDebugDeathHelper(&aborted), \"\");\n  EXPECT_FALSE(aborted);\n}\n\nvoid AssertDebugDeathHelper(bool* aborted) {\n  *aborted = true;\n  ASSERT_DEBUG_DEATH(return, \"\") << \"This is expected to fail.\";\n  *aborted = false;\n}\n\n// Tests that ASSERT_DEBUG_DEATH in debug mode aborts the function on\n// failure.\nTEST_F(TestForDeathTest, AssertDebugDeathAborts) {\n  static bool aborted;\n  aborted = false;\n  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), \"\");\n  EXPECT_TRUE(aborted);\n}\n\n# endif  // _NDEBUG\n\n// Tests the *_EXIT family of macros, using a variety of predicates.\nstatic void TestExitMacros() {\n  EXPECT_EXIT(_exit(1),  testing::ExitedWithCode(1),  \"\");\n  ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), \"\");\n\n# if GTEST_OS_WINDOWS\n\n  // Of all signals effects on the process exit code, only those of SIGABRT\n  // are documented on Windows.\n  // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.\n  EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), \"\") << \"b_ar\";\n\n# else\n\n  EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), \"\") << \"foo\";\n  ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), \"\") << \"bar\";\n\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), \"\")\n      << \"This failure is expected, too.\";\n  }, \"This failure is expected, too.\");\n\n# endif  // GTEST_OS_WINDOWS\n\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), \"\")\n      << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n}\n\nTEST_F(TestForDeathTest, ExitMacros) {\n  TestExitMacros();\n}\n\nTEST_F(TestForDeathTest, ExitMacrosUsingFork) {\n  testing::GTEST_FLAG(death_test_use_fork) = true;\n  TestExitMacros();\n}\n\nTEST_F(TestForDeathTest, InvalidStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"rococo\";\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_DEATH(_exit(0), \"\") << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n}\n\nTEST_F(TestForDeathTest, DeathTestFailedOutput) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_DEATH(DieWithMessage(\"death\\n\"),\n                   \"expected message\"),\n      \"Actual msg:\\n\"\n      \"[  DEATH   ] death\\n\");\n}\n\nTEST_F(TestForDeathTest, DeathTestUnexpectedReturnOutput) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_DEATH({\n          fprintf(stderr, \"returning\\n\");\n          fflush(stderr);\n          return;\n        }, \"\"),\n      \"    Result: illegal return in test statement.\\n\"\n      \" Error msg:\\n\"\n      \"[  DEATH   ] returning\\n\");\n}\n\nTEST_F(TestForDeathTest, DeathTestBadExitCodeOutput) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_EXIT(DieWithMessage(\"exiting with rc 1\\n\"),\n                  testing::ExitedWithCode(3),\n                  \"expected message\"),\n      \"    Result: died but not with expected exit code:\\n\"\n      \"            Exited with exit status 1\\n\"\n      \"Actual msg:\\n\"\n      \"[  DEATH   ] exiting with rc 1\\n\");\n}\n\nTEST_F(TestForDeathTest, DeathTestMultiLineMatchFail) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_DEATH(DieWithMessage(\"line 1\\nline 2\\nline 3\\n\"),\n                   \"line 1\\nxyz\\nline 3\\n\"),\n      \"Actual msg:\\n\"\n      \"[  DEATH   ] line 1\\n\"\n      \"[  DEATH   ] line 2\\n\"\n      \"[  DEATH   ] line 3\\n\");\n}\n\nTEST_F(TestForDeathTest, DeathTestMultiLineMatchPass) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_DEATH(DieWithMessage(\"line 1\\nline 2\\nline 3\\n\"),\n               \"line 1\\nline 2\\nline 3\\n\");\n}\n\n// A DeathTestFactory that returns MockDeathTests.\nclass MockDeathTestFactory : public DeathTestFactory {\n public:\n  MockDeathTestFactory();\n  virtual bool Create(const char* statement,\n                      const ::testing::internal::RE* regex,\n                      const char* file, int line, DeathTest** test);\n\n  // Sets the parameters for subsequent calls to Create.\n  void SetParameters(bool create, DeathTest::TestRole role,\n                     int status, bool passed);\n\n  // Accessors.\n  int AssumeRoleCalls() const { return assume_role_calls_; }\n  int WaitCalls() const { return wait_calls_; }\n  int PassedCalls() const { return passed_args_.size(); }\n  bool PassedArgument(int n) const { return passed_args_[n]; }\n  int AbortCalls() const { return abort_args_.size(); }\n  DeathTest::AbortReason AbortArgument(int n) const {\n    return abort_args_[n];\n  }\n  bool TestDeleted() const { return test_deleted_; }\n\n private:\n  friend class MockDeathTest;\n  // If true, Create will return a MockDeathTest; otherwise it returns\n  // NULL.\n  bool create_;\n  // The value a MockDeathTest will return from its AssumeRole method.\n  DeathTest::TestRole role_;\n  // The value a MockDeathTest will return from its Wait method.\n  int status_;\n  // The value a MockDeathTest will return from its Passed method.\n  bool passed_;\n\n  // Number of times AssumeRole was called.\n  int assume_role_calls_;\n  // Number of times Wait was called.\n  int wait_calls_;\n  // The arguments to the calls to Passed since the last call to\n  // SetParameters.\n  std::vector<bool> passed_args_;\n  // The arguments to the calls to Abort since the last call to\n  // SetParameters.\n  std::vector<DeathTest::AbortReason> abort_args_;\n  // True if the last MockDeathTest returned by Create has been\n  // deleted.\n  bool test_deleted_;\n};\n\n\n// A DeathTest implementation useful in testing.  It returns values set\n// at its creation from its various inherited DeathTest methods, and\n// reports calls to those methods to its parent MockDeathTestFactory\n// object.\nclass MockDeathTest : public DeathTest {\n public:\n  MockDeathTest(MockDeathTestFactory *parent,\n                TestRole role, int status, bool passed) :\n      parent_(parent), role_(role), status_(status), passed_(passed) {\n  }\n  virtual ~MockDeathTest() {\n    parent_->test_deleted_ = true;\n  }\n  virtual TestRole AssumeRole() {\n    ++parent_->assume_role_calls_;\n    return role_;\n  }\n  virtual int Wait() {\n    ++parent_->wait_calls_;\n    return status_;\n  }\n  virtual bool Passed(bool exit_status_ok) {\n    parent_->passed_args_.push_back(exit_status_ok);\n    return passed_;\n  }\n  virtual void Abort(AbortReason reason) {\n    parent_->abort_args_.push_back(reason);\n  }\n\n private:\n  MockDeathTestFactory* const parent_;\n  const TestRole role_;\n  const int status_;\n  const bool passed_;\n};\n\n\n// MockDeathTestFactory constructor.\nMockDeathTestFactory::MockDeathTestFactory()\n    : create_(true),\n      role_(DeathTest::OVERSEE_TEST),\n      status_(0),\n      passed_(true),\n      assume_role_calls_(0),\n      wait_calls_(0),\n      passed_args_(),\n      abort_args_() {\n}\n\n\n// Sets the parameters for subsequent calls to Create.\nvoid MockDeathTestFactory::SetParameters(bool create,\n                                         DeathTest::TestRole role,\n                                         int status, bool passed) {\n  create_ = create;\n  role_ = role;\n  status_ = status;\n  passed_ = passed;\n\n  assume_role_calls_ = 0;\n  wait_calls_ = 0;\n  passed_args_.clear();\n  abort_args_.clear();\n}\n\n\n// Sets test to NULL (if create_ is false) or to the address of a new\n// MockDeathTest object with parameters taken from the last call\n// to SetParameters (if create_ is true).  Always returns true.\nbool MockDeathTestFactory::Create(const char* /*statement*/,\n                                  const ::testing::internal::RE* /*regex*/,\n                                  const char* /*file*/,\n                                  int /*line*/,\n                                  DeathTest** test) {\n  test_deleted_ = false;\n  if (create_) {\n    *test = new MockDeathTest(this, role_, status_, passed_);\n  } else {\n    *test = NULL;\n  }\n  return true;\n}\n\n// A test fixture for testing the logic of the GTEST_DEATH_TEST_ macro.\n// It installs a MockDeathTestFactory that is used for the duration\n// of the test case.\nclass MacroLogicDeathTest : public testing::Test {\n protected:\n  static testing::internal::ReplaceDeathTestFactory* replacer_;\n  static MockDeathTestFactory* factory_;\n\n  static void SetUpTestCase() {\n    factory_ = new MockDeathTestFactory;\n    replacer_ = new testing::internal::ReplaceDeathTestFactory(factory_);\n  }\n\n  static void TearDownTestCase() {\n    delete replacer_;\n    replacer_ = NULL;\n    delete factory_;\n    factory_ = NULL;\n  }\n\n  // Runs a death test that breaks the rules by returning.  Such a death\n  // test cannot be run directly from a test routine that uses a\n  // MockDeathTest, or the remainder of the routine will not be executed.\n  static void RunReturningDeathTest(bool* flag) {\n    ASSERT_DEATH({  // NOLINT\n      *flag = true;\n      return;\n    }, \"\");\n  }\n};\n\ntesting::internal::ReplaceDeathTestFactory* MacroLogicDeathTest::replacer_\n    = NULL;\nMockDeathTestFactory* MacroLogicDeathTest::factory_ = NULL;\n\n\n// Test that nothing happens when the factory doesn't return a DeathTest:\nTEST_F(MacroLogicDeathTest, NothingHappens) {\n  bool flag = false;\n  factory_->SetParameters(false, DeathTest::OVERSEE_TEST, 0, true);\n  EXPECT_DEATH(flag = true, \"\");\n  EXPECT_FALSE(flag);\n  EXPECT_EQ(0, factory_->AssumeRoleCalls());\n  EXPECT_EQ(0, factory_->WaitCalls());\n  EXPECT_EQ(0, factory_->PassedCalls());\n  EXPECT_EQ(0, factory_->AbortCalls());\n  EXPECT_FALSE(factory_->TestDeleted());\n}\n\n// Test that the parent process doesn't run the death test code,\n// and that the Passed method returns false when the (simulated)\n// child process exits with status 0:\nTEST_F(MacroLogicDeathTest, ChildExitsSuccessfully) {\n  bool flag = false;\n  factory_->SetParameters(true, DeathTest::OVERSEE_TEST, 0, true);\n  EXPECT_DEATH(flag = true, \"\");\n  EXPECT_FALSE(flag);\n  EXPECT_EQ(1, factory_->AssumeRoleCalls());\n  EXPECT_EQ(1, factory_->WaitCalls());\n  ASSERT_EQ(1, factory_->PassedCalls());\n  EXPECT_FALSE(factory_->PassedArgument(0));\n  EXPECT_EQ(0, factory_->AbortCalls());\n  EXPECT_TRUE(factory_->TestDeleted());\n}\n\n// Tests that the Passed method was given the argument \"true\" when\n// the (simulated) child process exits with status 1:\nTEST_F(MacroLogicDeathTest, ChildExitsUnsuccessfully) {\n  bool flag = false;\n  factory_->SetParameters(true, DeathTest::OVERSEE_TEST, 1, true);\n  EXPECT_DEATH(flag = true, \"\");\n  EXPECT_FALSE(flag);\n  EXPECT_EQ(1, factory_->AssumeRoleCalls());\n  EXPECT_EQ(1, factory_->WaitCalls());\n  ASSERT_EQ(1, factory_->PassedCalls());\n  EXPECT_TRUE(factory_->PassedArgument(0));\n  EXPECT_EQ(0, factory_->AbortCalls());\n  EXPECT_TRUE(factory_->TestDeleted());\n}\n\n// Tests that the (simulated) child process executes the death test\n// code, and is aborted with the correct AbortReason if it\n// executes a return statement.\nTEST_F(MacroLogicDeathTest, ChildPerformsReturn) {\n  bool flag = false;\n  factory_->SetParameters(true, DeathTest::EXECUTE_TEST, 0, true);\n  RunReturningDeathTest(&flag);\n  EXPECT_TRUE(flag);\n  EXPECT_EQ(1, factory_->AssumeRoleCalls());\n  EXPECT_EQ(0, factory_->WaitCalls());\n  EXPECT_EQ(0, factory_->PassedCalls());\n  EXPECT_EQ(1, factory_->AbortCalls());\n  EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,\n            factory_->AbortArgument(0));\n  EXPECT_TRUE(factory_->TestDeleted());\n}\n\n// Tests that the (simulated) child process is aborted with the\n// correct AbortReason if it does not die.\nTEST_F(MacroLogicDeathTest, ChildDoesNotDie) {\n  bool flag = false;\n  factory_->SetParameters(true, DeathTest::EXECUTE_TEST, 0, true);\n  EXPECT_DEATH(flag = true, \"\");\n  EXPECT_TRUE(flag);\n  EXPECT_EQ(1, factory_->AssumeRoleCalls());\n  EXPECT_EQ(0, factory_->WaitCalls());\n  EXPECT_EQ(0, factory_->PassedCalls());\n  // This time there are two calls to Abort: one since the test didn't\n  // die, and another from the ReturnSentinel when it's destroyed.  The\n  // sentinel normally isn't destroyed if a test doesn't die, since\n  // _exit(2) is called in that case by ForkingDeathTest, but not by\n  // our MockDeathTest.\n  ASSERT_EQ(2, factory_->AbortCalls());\n  EXPECT_EQ(DeathTest::TEST_DID_NOT_DIE,\n            factory_->AbortArgument(0));\n  EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,\n            factory_->AbortArgument(1));\n  EXPECT_TRUE(factory_->TestDeleted());\n}\n\n// Tests that a successful death test does not register a successful\n// test part.\nTEST(SuccessRegistrationDeathTest, NoSuccessPart) {\n  EXPECT_DEATH(_exit(1), \"\");\n  EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());\n}\n\nTEST(StreamingAssertionsDeathTest, DeathTest) {\n  EXPECT_DEATH(_exit(1), \"\") << \"unexpected failure\";\n  ASSERT_DEATH(_exit(1), \"\") << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_DEATH(_exit(0), \"\") << \"expected failure\";\n  }, \"expected failure\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_DEATH(_exit(0), \"\") << \"expected failure\";\n  }, \"expected failure\");\n}\n\n// Tests that GetLastErrnoDescription returns an empty string when the\n// last error is 0 and non-empty string when it is non-zero.\nTEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {\n  errno = ENOENT;\n  EXPECT_STRNE(\"\", GetLastErrnoDescription().c_str());\n  errno = 0;\n  EXPECT_STREQ(\"\", GetLastErrnoDescription().c_str());\n}\n\n# if GTEST_OS_WINDOWS\nTEST(AutoHandleTest, AutoHandleWorks) {\n  HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);\n  ASSERT_NE(INVALID_HANDLE_VALUE, handle);\n\n  // Tests that the AutoHandle is correctly initialized with a handle.\n  testing::internal::AutoHandle auto_handle(handle);\n  EXPECT_EQ(handle, auto_handle.Get());\n\n  // Tests that Reset assigns INVALID_HANDLE_VALUE.\n  // Note that this cannot verify whether the original handle is closed.\n  auto_handle.Reset();\n  EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle.Get());\n\n  // Tests that Reset assigns the new handle.\n  // Note that this cannot verify whether the original handle is closed.\n  handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);\n  ASSERT_NE(INVALID_HANDLE_VALUE, handle);\n  auto_handle.Reset(handle);\n  EXPECT_EQ(handle, auto_handle.Get());\n\n  // Tests that AutoHandle contains INVALID_HANDLE_VALUE by default.\n  testing::internal::AutoHandle auto_handle2;\n  EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());\n}\n# endif  // GTEST_OS_WINDOWS\n\n# if GTEST_OS_WINDOWS\ntypedef unsigned __int64 BiggestParsable;\ntypedef signed __int64 BiggestSignedParsable;\n# else\ntypedef unsigned long long BiggestParsable;\ntypedef signed long long BiggestSignedParsable;\n# endif  // GTEST_OS_WINDOWS\n\n// We cannot use std::numeric_limits<T>::max() as it clashes with the\n// max() macro defined by <windows.h>.\nconst BiggestParsable kBiggestParsableMax = ULLONG_MAX;\nconst BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;\n\nTEST(ParseNaturalNumberTest, RejectsInvalidFormat) {\n  BiggestParsable result = 0;\n\n  // Rejects non-numbers.\n  EXPECT_FALSE(ParseNaturalNumber(\"non-number string\", &result));\n\n  // Rejects numbers with whitespace prefix.\n  EXPECT_FALSE(ParseNaturalNumber(\" 123\", &result));\n\n  // Rejects negative numbers.\n  EXPECT_FALSE(ParseNaturalNumber(\"-123\", &result));\n\n  // Rejects numbers starting with a plus sign.\n  EXPECT_FALSE(ParseNaturalNumber(\"+123\", &result));\n  errno = 0;\n}\n\nTEST(ParseNaturalNumberTest, RejectsOverflownNumbers) {\n  BiggestParsable result = 0;\n\n  EXPECT_FALSE(ParseNaturalNumber(\"99999999999999999999999\", &result));\n\n  signed char char_result = 0;\n  EXPECT_FALSE(ParseNaturalNumber(\"200\", &char_result));\n  errno = 0;\n}\n\nTEST(ParseNaturalNumberTest, AcceptsValidNumbers) {\n  BiggestParsable result = 0;\n\n  result = 0;\n  ASSERT_TRUE(ParseNaturalNumber(\"123\", &result));\n  EXPECT_EQ(123U, result);\n\n  // Check 0 as an edge case.\n  result = 1;\n  ASSERT_TRUE(ParseNaturalNumber(\"0\", &result));\n  EXPECT_EQ(0U, result);\n\n  result = 1;\n  ASSERT_TRUE(ParseNaturalNumber(\"00000\", &result));\n  EXPECT_EQ(0U, result);\n}\n\nTEST(ParseNaturalNumberTest, AcceptsTypeLimits) {\n  Message msg;\n  msg << kBiggestParsableMax;\n\n  BiggestParsable result = 0;\n  EXPECT_TRUE(ParseNaturalNumber(msg.GetString(), &result));\n  EXPECT_EQ(kBiggestParsableMax, result);\n\n  Message msg2;\n  msg2 << kBiggestSignedParsableMax;\n\n  BiggestSignedParsable signed_result = 0;\n  EXPECT_TRUE(ParseNaturalNumber(msg2.GetString(), &signed_result));\n  EXPECT_EQ(kBiggestSignedParsableMax, signed_result);\n\n  Message msg3;\n  msg3 << INT_MAX;\n\n  int int_result = 0;\n  EXPECT_TRUE(ParseNaturalNumber(msg3.GetString(), &int_result));\n  EXPECT_EQ(INT_MAX, int_result);\n\n  Message msg4;\n  msg4 << UINT_MAX;\n\n  unsigned int uint_result = 0;\n  EXPECT_TRUE(ParseNaturalNumber(msg4.GetString(), &uint_result));\n  EXPECT_EQ(UINT_MAX, uint_result);\n}\n\nTEST(ParseNaturalNumberTest, WorksForShorterIntegers) {\n  short short_result = 0;\n  ASSERT_TRUE(ParseNaturalNumber(\"123\", &short_result));\n  EXPECT_EQ(123, short_result);\n\n  signed char char_result = 0;\n  ASSERT_TRUE(ParseNaturalNumber(\"123\", &char_result));\n  EXPECT_EQ(123, char_result);\n}\n\n# if GTEST_OS_WINDOWS\nTEST(EnvironmentTest, HandleFitsIntoSizeT) {\n  // TODO(vladl@google.com): Remove this test after this condition is verified\n  // in a static assertion in gtest-death-test.cc in the function\n  // GetStatusFileDescriptor.\n  ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));\n}\n# endif  // GTEST_OS_WINDOWS\n\n// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED trigger\n// failures when death tests are available on the system.\nTEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailable) {\n  EXPECT_DEATH_IF_SUPPORTED(DieInside(\"CondDeathTestExpectMacro\"),\n                            \"death inside CondDeathTestExpectMacro\");\n  ASSERT_DEATH_IF_SUPPORTED(DieInside(\"CondDeathTestAssertMacro\"),\n                            \"death inside CondDeathTestAssertMacro\");\n\n  // Empty statement will not crash, which must trigger a failure.\n  EXPECT_NONFATAL_FAILURE(EXPECT_DEATH_IF_SUPPORTED(;, \"\"), \"\");\n  EXPECT_FATAL_FAILURE(ASSERT_DEATH_IF_SUPPORTED(;, \"\"), \"\");\n}\n\n#else\n\nusing testing::internal::CaptureStderr;\nusing testing::internal::GetCapturedStderr;\n\n// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED are still\n// defined but do not trigger failures when death tests are not available on\n// the system.\nTEST(ConditionalDeathMacrosTest, WarnsWhenDeathTestsNotAvailable) {\n  // Empty statement will not crash, but that should not trigger a failure\n  // when death tests are not supported.\n  CaptureStderr();\n  EXPECT_DEATH_IF_SUPPORTED(;, \"\");\n  std::string output = GetCapturedStderr();\n  ASSERT_TRUE(NULL != strstr(output.c_str(),\n                             \"Death tests are not supported on this platform\"));\n  ASSERT_TRUE(NULL != strstr(output.c_str(), \";\"));\n\n  // The streamed message should not be printed as there is no test failure.\n  CaptureStderr();\n  EXPECT_DEATH_IF_SUPPORTED(;, \"\") << \"streamed message\";\n  output = GetCapturedStderr();\n  ASSERT_TRUE(NULL == strstr(output.c_str(), \"streamed message\"));\n\n  CaptureStderr();\n  ASSERT_DEATH_IF_SUPPORTED(;, \"\");  // NOLINT\n  output = GetCapturedStderr();\n  ASSERT_TRUE(NULL != strstr(output.c_str(),\n                             \"Death tests are not supported on this platform\"));\n  ASSERT_TRUE(NULL != strstr(output.c_str(), \";\"));\n\n  CaptureStderr();\n  ASSERT_DEATH_IF_SUPPORTED(;, \"\") << \"streamed message\";  // NOLINT\n  output = GetCapturedStderr();\n  ASSERT_TRUE(NULL == strstr(output.c_str(), \"streamed message\"));\n}\n\nvoid FuncWithAssert(int* n) {\n  ASSERT_DEATH_IF_SUPPORTED(return;, \"\");\n  (*n)++;\n}\n\n// Tests that ASSERT_DEATH_IF_SUPPORTED does not return from the current\n// function (as ASSERT_DEATH does) if death tests are not supported.\nTEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) {\n  int n = 0;\n  FuncWithAssert(&n);\n  EXPECT_EQ(1, n);\n}\n\nTEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_FALSE(InDeathTestChild());\n  EXPECT_DEATH({\n    fprintf(stderr, InDeathTestChild() ? \"Inside\" : \"Outside\");\n    fflush(stderr);\n    _exit(1);\n  }, \"Inside\");\n}\n\nTEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeStyle) {\n  testing::GTEST_FLAG(death_test_style) = \"threadsafe\";\n  EXPECT_FALSE(InDeathTestChild());\n  EXPECT_DEATH({\n    fprintf(stderr, InDeathTestChild() ? \"Inside\" : \"Outside\");\n    fflush(stderr);\n    _exit(1);\n  }, \"Inside\");\n}\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Tests that the death test macros expand to code which may or may not\n// be followed by operator<<, and that in either case the complete text\n// comprises only a single C++ statement.\n//\n// The syntax should work whether death tests are available or not.\nTEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) {\n  if (AlwaysFalse())\n    // This would fail if executed; this is a compilation test only\n    ASSERT_DEATH_IF_SUPPORTED(return, \"\");\n\n  if (AlwaysTrue())\n    EXPECT_DEATH_IF_SUPPORTED(_exit(1), \"\");\n  else\n    // This empty \"else\" branch is meant to ensure that EXPECT_DEATH\n    // doesn't expand into an \"if\" statement without an \"else\"\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    ASSERT_DEATH_IF_SUPPORTED(return, \"\") << \"did not die\";\n\n  if (AlwaysFalse())\n    ;  // NOLINT\n  else\n    EXPECT_DEATH_IF_SUPPORTED(_exit(1), \"\") << 1 << 2 << 3;\n}\n\n// Tests that conditional death test macros expand to code which interacts\n// well with switch statements.\nTEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {\n// Microsoft compiler usually complains about switch statements without\n// case labels. We suppress that warning for this test.\n#ifdef _MSC_VER\n# pragma warning(push)\n# pragma warning(disable: 4065)\n#endif  // _MSC_VER\n\n  switch (0)\n    default:\n      ASSERT_DEATH_IF_SUPPORTED(_exit(1), \"\")\n          << \"exit in default switch handler\";\n\n  switch (0)\n    case 0:\n      EXPECT_DEATH_IF_SUPPORTED(_exit(1), \"\") << \"exit in switch case\";\n\n#ifdef _MSC_VER\n# pragma warning(pop)\n#endif  // _MSC_VER\n}\n\n// Tests that a test case whose name ends with \"DeathTest\" works fine\n// on Windows.\nTEST(NotADeathTest, Test) {\n  SUCCEED();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest-filepath_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: keith.ray@gmail.com (Keith Ray)\n//\n// Google Test filepath utilities\n//\n// This file tests classes and functions used internally by\n// Google Test.  They are subject to change without notice.\n//\n// This file is #included from gtest_unittest.cc, to avoid changing\n// build or make-files for some existing Google Test clients. Do not\n// #include this file anywhere else!\n\n#include \"gtest/internal/gtest-filepath.h\"\n#include \"gtest/gtest.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\n#if GTEST_OS_WINDOWS_MOBILE\n# include <windows.h>  // NOLINT\n#elif GTEST_OS_WINDOWS\n# include <direct.h>  // NOLINT\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\nnamespace testing {\nnamespace internal {\nnamespace {\n\n#if GTEST_OS_WINDOWS_MOBILE\n// TODO(wan@google.com): Move these to the POSIX adapter section in\n// gtest-port.h.\n\n// Windows CE doesn't have the remove C function.\nint remove(const char* path) {\n  LPCWSTR wpath = String::AnsiToUtf16(path);\n  int ret = DeleteFile(wpath) ? 0 : -1;\n  delete [] wpath;\n  return ret;\n}\n// Windows CE doesn't have the _rmdir C function.\nint _rmdir(const char* path) {\n  FilePath filepath(path);\n  LPCWSTR wpath = String::AnsiToUtf16(\n      filepath.RemoveTrailingPathSeparator().c_str());\n  int ret = RemoveDirectory(wpath) ? 0 : -1;\n  delete [] wpath;\n  return ret;\n}\n\n#else\n\nTEST(GetCurrentDirTest, ReturnsCurrentDir) {\n  const FilePath original_dir = FilePath::GetCurrentDir();\n  EXPECT_FALSE(original_dir.IsEmpty());\n\n  posix::ChDir(GTEST_PATH_SEP_);\n  const FilePath cwd = FilePath::GetCurrentDir();\n  posix::ChDir(original_dir.c_str());\n\n# if GTEST_OS_WINDOWS\n\n  // Skips the \":\".\n  const char* const cwd_without_drive = strchr(cwd.c_str(), ':');\n  ASSERT_TRUE(cwd_without_drive != NULL);\n  EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);\n\n# else\n\n  EXPECT_EQ(GTEST_PATH_SEP_, cwd.string());\n\n# endif\n}\n\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\nTEST(IsEmptyTest, ReturnsTrueForEmptyPath) {\n  EXPECT_TRUE(FilePath(\"\").IsEmpty());\n}\n\nTEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) {\n  EXPECT_FALSE(FilePath(\"a\").IsEmpty());\n  EXPECT_FALSE(FilePath(\".\").IsEmpty());\n  EXPECT_FALSE(FilePath(\"a/b\").IsEmpty());\n  EXPECT_FALSE(FilePath(\"a\\\\b\\\\\").IsEmpty());\n}\n\n// RemoveDirectoryName \"\" -> \"\"\nTEST(RemoveDirectoryNameTest, WhenEmptyName) {\n  EXPECT_EQ(\"\", FilePath(\"\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName \"afile\" -> \"afile\"\nTEST(RemoveDirectoryNameTest, ButNoDirectory) {\n  EXPECT_EQ(\"afile\",\n      FilePath(\"afile\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName \"/afile\" -> \"afile\"\nTEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {\n  EXPECT_EQ(\"afile\",\n      FilePath(GTEST_PATH_SEP_ \"afile\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName \"adir/\" -> \"\"\nTEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {\n  EXPECT_EQ(\"\",\n      FilePath(\"adir\" GTEST_PATH_SEP_).RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName \"adir/afile\" -> \"afile\"\nTEST(RemoveDirectoryNameTest, ShouldGiveFileName) {\n  EXPECT_EQ(\"afile\",\n      FilePath(\"adir\" GTEST_PATH_SEP_ \"afile\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName \"adir/subdir/afile\" -> \"afile\"\nTEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {\n  EXPECT_EQ(\"afile\",\n      FilePath(\"adir\" GTEST_PATH_SEP_ \"subdir\" GTEST_PATH_SEP_ \"afile\")\n      .RemoveDirectoryName().string());\n}\n\n#if GTEST_HAS_ALT_PATH_SEP_\n\n// Tests that RemoveDirectoryName() works with the alternate separator\n// on Windows.\n\n// RemoveDirectoryName(\"/afile\") -> \"afile\"\nTEST(RemoveDirectoryNameTest, RootFileShouldGiveFileNameForAlternateSeparator) {\n  EXPECT_EQ(\"afile\", FilePath(\"/afile\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName(\"adir/\") -> \"\"\nTEST(RemoveDirectoryNameTest, WhereThereIsNoFileNameForAlternateSeparator) {\n  EXPECT_EQ(\"\", FilePath(\"adir/\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName(\"adir/afile\") -> \"afile\"\nTEST(RemoveDirectoryNameTest, ShouldGiveFileNameForAlternateSeparator) {\n  EXPECT_EQ(\"afile\", FilePath(\"adir/afile\").RemoveDirectoryName().string());\n}\n\n// RemoveDirectoryName(\"adir/subdir/afile\") -> \"afile\"\nTEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) {\n  EXPECT_EQ(\"afile\",\n            FilePath(\"adir/subdir/afile\").RemoveDirectoryName().string());\n}\n\n#endif\n\n// RemoveFileName \"\" -> \"./\"\nTEST(RemoveFileNameTest, EmptyName) {\n#if GTEST_OS_WINDOWS_MOBILE\n  // On Windows CE, we use the root as the current directory.\n  EXPECT_EQ(GTEST_PATH_SEP_, FilePath(\"\").RemoveFileName().string());\n#else\n  EXPECT_EQ(\".\" GTEST_PATH_SEP_, FilePath(\"\").RemoveFileName().string());\n#endif\n}\n\n// RemoveFileName \"adir/\" -> \"adir/\"\nTEST(RemoveFileNameTest, ButNoFile) {\n  EXPECT_EQ(\"adir\" GTEST_PATH_SEP_,\n      FilePath(\"adir\" GTEST_PATH_SEP_).RemoveFileName().string());\n}\n\n// RemoveFileName \"adir/afile\" -> \"adir/\"\nTEST(RemoveFileNameTest, GivesDirName) {\n  EXPECT_EQ(\"adir\" GTEST_PATH_SEP_,\n            FilePath(\"adir\" GTEST_PATH_SEP_ \"afile\").RemoveFileName().string());\n}\n\n// RemoveFileName \"adir/subdir/afile\" -> \"adir/subdir/\"\nTEST(RemoveFileNameTest, GivesDirAndSubDirName) {\n  EXPECT_EQ(\"adir\" GTEST_PATH_SEP_ \"subdir\" GTEST_PATH_SEP_,\n      FilePath(\"adir\" GTEST_PATH_SEP_ \"subdir\" GTEST_PATH_SEP_ \"afile\")\n      .RemoveFileName().string());\n}\n\n// RemoveFileName \"/afile\" -> \"/\"\nTEST(RemoveFileNameTest, GivesRootDir) {\n  EXPECT_EQ(GTEST_PATH_SEP_,\n      FilePath(GTEST_PATH_SEP_ \"afile\").RemoveFileName().string());\n}\n\n#if GTEST_HAS_ALT_PATH_SEP_\n\n// Tests that RemoveFileName() works with the alternate separator on\n// Windows.\n\n// RemoveFileName(\"adir/\") -> \"adir/\"\nTEST(RemoveFileNameTest, ButNoFileForAlternateSeparator) {\n  EXPECT_EQ(\"adir\" GTEST_PATH_SEP_,\n            FilePath(\"adir/\").RemoveFileName().string());\n}\n\n// RemoveFileName(\"adir/afile\") -> \"adir/\"\nTEST(RemoveFileNameTest, GivesDirNameForAlternateSeparator) {\n  EXPECT_EQ(\"adir\" GTEST_PATH_SEP_,\n            FilePath(\"adir/afile\").RemoveFileName().string());\n}\n\n// RemoveFileName(\"adir/subdir/afile\") -> \"adir/subdir/\"\nTEST(RemoveFileNameTest, GivesDirAndSubDirNameForAlternateSeparator) {\n  EXPECT_EQ(\"adir\" GTEST_PATH_SEP_ \"subdir\" GTEST_PATH_SEP_,\n            FilePath(\"adir/subdir/afile\").RemoveFileName().string());\n}\n\n// RemoveFileName(\"/afile\") -> \"\\\"\nTEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) {\n  EXPECT_EQ(GTEST_PATH_SEP_, FilePath(\"/afile\").RemoveFileName().string());\n}\n\n#endif\n\nTEST(MakeFileNameTest, GenerateWhenNumberIsZero) {\n  FilePath actual = FilePath::MakeFileName(FilePath(\"foo\"), FilePath(\"bar\"),\n      0, \"xml\");\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar.xml\", actual.string());\n}\n\nTEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {\n  FilePath actual = FilePath::MakeFileName(FilePath(\"foo\"), FilePath(\"bar\"),\n      12, \"xml\");\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar_12.xml\", actual.string());\n}\n\nTEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {\n  FilePath actual = FilePath::MakeFileName(FilePath(\"foo\" GTEST_PATH_SEP_),\n      FilePath(\"bar\"), 0, \"xml\");\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar.xml\", actual.string());\n}\n\nTEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {\n  FilePath actual = FilePath::MakeFileName(FilePath(\"foo\" GTEST_PATH_SEP_),\n      FilePath(\"bar\"), 12, \"xml\");\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar_12.xml\", actual.string());\n}\n\nTEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {\n  FilePath actual = FilePath::MakeFileName(FilePath(\"\"), FilePath(\"bar\"),\n      0, \"xml\");\n  EXPECT_EQ(\"bar.xml\", actual.string());\n}\n\nTEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {\n  FilePath actual = FilePath::MakeFileName(FilePath(\"\"), FilePath(\"bar\"),\n      14, \"xml\");\n  EXPECT_EQ(\"bar_14.xml\", actual.string());\n}\n\nTEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"foo\"),\n                                          FilePath(\"bar.xml\"));\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar.xml\", actual.string());\n}\n\nTEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"foo\" GTEST_PATH_SEP_),\n                                          FilePath(\"bar.xml\"));\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar.xml\", actual.string());\n}\n\nTEST(ConcatPathsTest, Path1BeingEmpty) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"\"),\n                                          FilePath(\"bar.xml\"));\n  EXPECT_EQ(\"bar.xml\", actual.string());\n}\n\nTEST(ConcatPathsTest, Path2BeingEmpty) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"foo\"), FilePath(\"\"));\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_, actual.string());\n}\n\nTEST(ConcatPathsTest, BothPathBeingEmpty) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"\"),\n                                          FilePath(\"\"));\n  EXPECT_EQ(\"\", actual.string());\n}\n\nTEST(ConcatPathsTest, Path1ContainsPathSep) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"foo\" GTEST_PATH_SEP_ \"bar\"),\n                                          FilePath(\"foobar.xml\"));\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\" GTEST_PATH_SEP_ \"foobar.xml\",\n            actual.string());\n}\n\nTEST(ConcatPathsTest, Path2ContainsPathSep) {\n  FilePath actual = FilePath::ConcatPaths(\n      FilePath(\"foo\" GTEST_PATH_SEP_),\n      FilePath(\"bar\" GTEST_PATH_SEP_ \"bar.xml\"));\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\" GTEST_PATH_SEP_ \"bar.xml\",\n            actual.string());\n}\n\nTEST(ConcatPathsTest, Path2EndsWithPathSep) {\n  FilePath actual = FilePath::ConcatPaths(FilePath(\"foo\"),\n                                          FilePath(\"bar\" GTEST_PATH_SEP_));\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\" GTEST_PATH_SEP_, actual.string());\n}\n\n// RemoveTrailingPathSeparator \"\" -> \"\"\nTEST(RemoveTrailingPathSeparatorTest, EmptyString) {\n  EXPECT_EQ(\"\", FilePath(\"\").RemoveTrailingPathSeparator().string());\n}\n\n// RemoveTrailingPathSeparator \"foo\" -> \"foo\"\nTEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {\n  EXPECT_EQ(\"foo\", FilePath(\"foo\").RemoveTrailingPathSeparator().string());\n}\n\n// RemoveTrailingPathSeparator \"foo/\" -> \"foo\"\nTEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {\n  EXPECT_EQ(\"foo\",\n      FilePath(\"foo\" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().string());\n#if GTEST_HAS_ALT_PATH_SEP_\n  EXPECT_EQ(\"foo\", FilePath(\"foo/\").RemoveTrailingPathSeparator().string());\n#endif\n}\n\n// RemoveTrailingPathSeparator \"foo/bar/\" -> \"foo/bar/\"\nTEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\",\n            FilePath(\"foo\" GTEST_PATH_SEP_ \"bar\" GTEST_PATH_SEP_)\n                .RemoveTrailingPathSeparator().string());\n}\n\n// RemoveTrailingPathSeparator \"foo/bar\" -> \"foo/bar\"\nTEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\",\n            FilePath(\"foo\" GTEST_PATH_SEP_ \"bar\")\n                .RemoveTrailingPathSeparator().string());\n}\n\nTEST(DirectoryTest, RootDirectoryExists) {\n#if GTEST_OS_WINDOWS  // We are on Windows.\n  char current_drive[_MAX_PATH];  // NOLINT\n  current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1);\n  current_drive[1] = ':';\n  current_drive[2] = '\\\\';\n  current_drive[3] = '\\0';\n  EXPECT_TRUE(FilePath(current_drive).DirectoryExists());\n#else\n  EXPECT_TRUE(FilePath(\"/\").DirectoryExists());\n#endif  // GTEST_OS_WINDOWS\n}\n\n#if GTEST_OS_WINDOWS\nTEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {\n  const int saved_drive_ = _getdrive();\n  // Find a drive that doesn't exist. Start with 'Z' to avoid common ones.\n  for (char drive = 'Z'; drive >= 'A'; drive--)\n    if (_chdrive(drive - 'A' + 1) == -1) {\n      char non_drive[_MAX_PATH];  // NOLINT\n      non_drive[0] = drive;\n      non_drive[1] = ':';\n      non_drive[2] = '\\\\';\n      non_drive[3] = '\\0';\n      EXPECT_FALSE(FilePath(non_drive).DirectoryExists());\n      break;\n    }\n  _chdrive(saved_drive_);\n}\n#endif  // GTEST_OS_WINDOWS\n\n#if !GTEST_OS_WINDOWS_MOBILE\n// Windows CE _does_ consider an empty directory to exist.\nTEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {\n  EXPECT_FALSE(FilePath(\"\").DirectoryExists());\n}\n#endif  // !GTEST_OS_WINDOWS_MOBILE\n\nTEST(DirectoryTest, CurrentDirectoryExists) {\n#if GTEST_OS_WINDOWS  // We are on Windows.\n# ifndef _WIN32_CE  // Windows CE doesn't have a current directory.\n\n  EXPECT_TRUE(FilePath(\".\").DirectoryExists());\n  EXPECT_TRUE(FilePath(\".\\\\\").DirectoryExists());\n\n# endif  // _WIN32_CE\n#else\n  EXPECT_TRUE(FilePath(\".\").DirectoryExists());\n  EXPECT_TRUE(FilePath(\"./\").DirectoryExists());\n#endif  // GTEST_OS_WINDOWS\n}\n\n// \"foo/bar\" == foo//bar\" == \"foo///bar\"\nTEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\",\n            FilePath(\"foo\" GTEST_PATH_SEP_ \"bar\").string());\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\",\n            FilePath(\"foo\" GTEST_PATH_SEP_ GTEST_PATH_SEP_ \"bar\").string());\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_ \"bar\",\n            FilePath(\"foo\" GTEST_PATH_SEP_ GTEST_PATH_SEP_\n                     GTEST_PATH_SEP_ \"bar\").string());\n}\n\n// \"/bar\" == //bar\" == \"///bar\"\nTEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {\n  EXPECT_EQ(GTEST_PATH_SEP_ \"bar\",\n    FilePath(GTEST_PATH_SEP_ \"bar\").string());\n  EXPECT_EQ(GTEST_PATH_SEP_ \"bar\",\n    FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ \"bar\").string());\n  EXPECT_EQ(GTEST_PATH_SEP_ \"bar\",\n    FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ \"bar\").string());\n}\n\n// \"foo/\" == foo//\" == \"foo///\"\nTEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_,\n    FilePath(\"foo\" GTEST_PATH_SEP_).string());\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_,\n    FilePath(\"foo\" GTEST_PATH_SEP_ GTEST_PATH_SEP_).string());\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_,\n    FilePath(\"foo\" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).string());\n}\n\n#if GTEST_HAS_ALT_PATH_SEP_\n\n// Tests that separators at the end of the string are normalized\n// regardless of their combination (e.g. \"foo\\\" ==\"foo/\\\" ==\n// \"foo\\\\/\").\nTEST(NormalizeTest, MixAlternateSeparatorAtStringEnd) {\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_,\n            FilePath(\"foo/\").string());\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_,\n            FilePath(\"foo\" GTEST_PATH_SEP_ \"/\").string());\n  EXPECT_EQ(\"foo\" GTEST_PATH_SEP_,\n            FilePath(\"foo//\" GTEST_PATH_SEP_).string());\n}\n\n#endif\n\nTEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {\n  FilePath default_path;\n  FilePath non_default_path(\"path\");\n  non_default_path = default_path;\n  EXPECT_EQ(\"\", non_default_path.string());\n  EXPECT_EQ(\"\", default_path.string());  // RHS var is unchanged.\n}\n\nTEST(AssignmentOperatorTest, NonDefaultAssignedToDefault) {\n  FilePath non_default_path(\"path\");\n  FilePath default_path;\n  default_path = non_default_path;\n  EXPECT_EQ(\"path\", default_path.string());\n  EXPECT_EQ(\"path\", non_default_path.string());  // RHS var is unchanged.\n}\n\nTEST(AssignmentOperatorTest, ConstAssignedToNonConst) {\n  const FilePath const_default_path(\"const_path\");\n  FilePath non_default_path(\"path\");\n  non_default_path = const_default_path;\n  EXPECT_EQ(\"const_path\", non_default_path.string());\n}\n\nclass DirectoryCreationTest : public Test {\n protected:\n  virtual void SetUp() {\n    testdata_path_.Set(FilePath(\n        TempDir() + GetCurrentExecutableName().string() +\n        \"_directory_creation\" GTEST_PATH_SEP_ \"test\" GTEST_PATH_SEP_));\n    testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator());\n\n    unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath(\"unique\"),\n        0, \"txt\"));\n    unique_file1_.Set(FilePath::MakeFileName(testdata_path_, FilePath(\"unique\"),\n        1, \"txt\"));\n\n    remove(testdata_file_.c_str());\n    remove(unique_file0_.c_str());\n    remove(unique_file1_.c_str());\n    posix::RmDir(testdata_path_.c_str());\n  }\n\n  virtual void TearDown() {\n    remove(testdata_file_.c_str());\n    remove(unique_file0_.c_str());\n    remove(unique_file1_.c_str());\n    posix::RmDir(testdata_path_.c_str());\n  }\n\n  std::string TempDir() const {\n#if GTEST_OS_WINDOWS_MOBILE\n    return \"\\\\temp\\\\\";\n#elif GTEST_OS_WINDOWS\n    const char* temp_dir = posix::GetEnv(\"TEMP\");\n    if (temp_dir == NULL || temp_dir[0] == '\\0')\n      return \"\\\\temp\\\\\";\n    else if (temp_dir[strlen(temp_dir) - 1] == '\\\\')\n      return temp_dir;\n    else\n      return std::string(temp_dir) + \"\\\\\";\n#elif GTEST_OS_LINUX_ANDROID\n    return \"/sdcard/\";\n#else\n    return \"/tmp/\";\n#endif  // GTEST_OS_WINDOWS_MOBILE\n  }\n\n  void CreateTextFile(const char* filename) {\n    FILE* f = posix::FOpen(filename, \"w\");\n    fprintf(f, \"text\\n\");\n    fclose(f);\n  }\n\n  // Strings representing a directory and a file, with identical paths\n  // except for the trailing separator character that distinquishes\n  // a directory named 'test' from a file named 'test'. Example names:\n  FilePath testdata_path_;  // \"/tmp/directory_creation/test/\"\n  FilePath testdata_file_;  // \"/tmp/directory_creation/test\"\n  FilePath unique_file0_;  // \"/tmp/directory_creation/test/unique.txt\"\n  FilePath unique_file1_;  // \"/tmp/directory_creation/test/unique_1.txt\"\n};\n\nTEST_F(DirectoryCreationTest, CreateDirectoriesRecursively) {\n  EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.string();\n  EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());\n  EXPECT_TRUE(testdata_path_.DirectoryExists());\n}\n\nTEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPath) {\n  EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.string();\n  EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());\n  // Call 'create' again... should still succeed.\n  EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());\n}\n\nTEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) {\n  FilePath file_path(FilePath::GenerateUniqueFileName(testdata_path_,\n      FilePath(\"unique\"), \"txt\"));\n  EXPECT_EQ(unique_file0_.string(), file_path.string());\n  EXPECT_FALSE(file_path.FileOrDirectoryExists());  // file not there\n\n  testdata_path_.CreateDirectoriesRecursively();\n  EXPECT_FALSE(file_path.FileOrDirectoryExists());  // file still not there\n  CreateTextFile(file_path.c_str());\n  EXPECT_TRUE(file_path.FileOrDirectoryExists());\n\n  FilePath file_path2(FilePath::GenerateUniqueFileName(testdata_path_,\n      FilePath(\"unique\"), \"txt\"));\n  EXPECT_EQ(unique_file1_.string(), file_path2.string());\n  EXPECT_FALSE(file_path2.FileOrDirectoryExists());  // file not there\n  CreateTextFile(file_path2.c_str());\n  EXPECT_TRUE(file_path2.FileOrDirectoryExists());\n}\n\nTEST_F(DirectoryCreationTest, CreateDirectoriesFail) {\n  // force a failure by putting a file where we will try to create a directory.\n  CreateTextFile(testdata_file_.c_str());\n  EXPECT_TRUE(testdata_file_.FileOrDirectoryExists());\n  EXPECT_FALSE(testdata_file_.DirectoryExists());\n  EXPECT_FALSE(testdata_file_.CreateDirectoriesRecursively());\n}\n\nTEST(NoDirectoryCreationTest, CreateNoDirectoriesForDefaultXmlFile) {\n  const FilePath test_detail_xml(\"test_detail.xml\");\n  EXPECT_FALSE(test_detail_xml.CreateDirectoriesRecursively());\n}\n\nTEST(FilePathTest, DefaultConstructor) {\n  FilePath fp;\n  EXPECT_EQ(\"\", fp.string());\n}\n\nTEST(FilePathTest, CharAndCopyConstructors) {\n  const FilePath fp(\"spicy\");\n  EXPECT_EQ(\"spicy\", fp.string());\n\n  const FilePath fp_copy(fp);\n  EXPECT_EQ(\"spicy\", fp_copy.string());\n}\n\nTEST(FilePathTest, StringConstructor) {\n  const FilePath fp(std::string(\"cider\"));\n  EXPECT_EQ(\"cider\", fp.string());\n}\n\nTEST(FilePathTest, Set) {\n  const FilePath apple(\"apple\");\n  FilePath mac(\"mac\");\n  mac.Set(apple);  // Implement Set() since overloading operator= is forbidden.\n  EXPECT_EQ(\"apple\", mac.string());\n  EXPECT_EQ(\"apple\", apple.string());\n}\n\nTEST(FilePathTest, ToString) {\n  const FilePath file(\"drink\");\n  EXPECT_EQ(\"drink\", file.string());\n}\n\nTEST(FilePathTest, RemoveExtension) {\n  EXPECT_EQ(\"app\", FilePath(\"app.cc\").RemoveExtension(\"cc\").string());\n  EXPECT_EQ(\"app\", FilePath(\"app.exe\").RemoveExtension(\"exe\").string());\n  EXPECT_EQ(\"APP\", FilePath(\"APP.EXE\").RemoveExtension(\"exe\").string());\n}\n\nTEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {\n  EXPECT_EQ(\"app\", FilePath(\"app\").RemoveExtension(\"exe\").string());\n}\n\nTEST(FilePathTest, IsDirectory) {\n  EXPECT_FALSE(FilePath(\"cola\").IsDirectory());\n  EXPECT_TRUE(FilePath(\"koala\" GTEST_PATH_SEP_).IsDirectory());\n#if GTEST_HAS_ALT_PATH_SEP_\n  EXPECT_TRUE(FilePath(\"koala/\").IsDirectory());\n#endif\n}\n\nTEST(FilePathTest, IsAbsolutePath) {\n  EXPECT_FALSE(FilePath(\"is\" GTEST_PATH_SEP_ \"relative\").IsAbsolutePath());\n  EXPECT_FALSE(FilePath(\"\").IsAbsolutePath());\n#if GTEST_OS_WINDOWS\n  EXPECT_TRUE(FilePath(\"c:\\\\\" GTEST_PATH_SEP_ \"is_not\"\n                       GTEST_PATH_SEP_ \"relative\").IsAbsolutePath());\n  EXPECT_FALSE(FilePath(\"c:foo\" GTEST_PATH_SEP_ \"bar\").IsAbsolutePath());\n  EXPECT_TRUE(FilePath(\"c:/\" GTEST_PATH_SEP_ \"is_not\"\n                       GTEST_PATH_SEP_ \"relative\").IsAbsolutePath());\n#else\n  EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ \"is_not\" GTEST_PATH_SEP_ \"relative\")\n              .IsAbsolutePath());\n#endif  // GTEST_OS_WINDOWS\n}\n\nTEST(FilePathTest, IsRootDirectory) {\n#if GTEST_OS_WINDOWS\n  EXPECT_TRUE(FilePath(\"a:\\\\\").IsRootDirectory());\n  EXPECT_TRUE(FilePath(\"Z:/\").IsRootDirectory());\n  EXPECT_TRUE(FilePath(\"e://\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"b:\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"b:a\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"8:/\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"c|/\").IsRootDirectory());\n#else\n  EXPECT_TRUE(FilePath(\"/\").IsRootDirectory());\n  EXPECT_TRUE(FilePath(\"//\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"\\\\\").IsRootDirectory());\n  EXPECT_FALSE(FilePath(\"/x\").IsRootDirectory());\n#endif\n}\n\n}  // namespace\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/test/gtest-linked_ptr_test.cc",
    "content": "// Copyright 2003, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: Dan Egnor (egnor@google.com)\n// Ported to Windows: Vadim Berman (vadimb@google.com)\n\n#include \"gtest/internal/gtest-linked_ptr.h\"\n\n#include <stdlib.h>\n#include \"gtest/gtest.h\"\n\nnamespace {\n\nusing testing::Message;\nusing testing::internal::linked_ptr;\n\nint num;\nMessage* history = NULL;\n\n// Class which tracks allocation/deallocation\nclass A {\n public:\n  A(): mynum(num++) { *history << \"A\" << mynum << \" ctor\\n\"; }\n  virtual ~A() { *history << \"A\" << mynum << \" dtor\\n\"; }\n  virtual void Use() { *history << \"A\" << mynum << \" use\\n\"; }\n protected:\n  int mynum;\n};\n\n// Subclass\nclass B : public A {\n public:\n  B() { *history << \"B\" << mynum << \" ctor\\n\"; }\n  ~B() { *history << \"B\" << mynum << \" dtor\\n\"; }\n  virtual void Use() { *history << \"B\" << mynum << \" use\\n\"; }\n};\n\nclass LinkedPtrTest : public testing::Test {\n public:\n  LinkedPtrTest() {\n    num = 0;\n    history = new Message;\n  }\n\n  virtual ~LinkedPtrTest() {\n    delete history;\n    history = NULL;\n  }\n};\n\nTEST_F(LinkedPtrTest, GeneralTest) {\n  {\n    linked_ptr<A> a0, a1, a2;\n    // Use explicit function call notation here to suppress self-assign warning.\n    a0.operator=(a0);\n    a1 = a2;\n    ASSERT_EQ(a0.get(), static_cast<A*>(NULL));\n    ASSERT_EQ(a1.get(), static_cast<A*>(NULL));\n    ASSERT_EQ(a2.get(), static_cast<A*>(NULL));\n    ASSERT_TRUE(a0 == NULL);\n    ASSERT_TRUE(a1 == NULL);\n    ASSERT_TRUE(a2 == NULL);\n\n    {\n      linked_ptr<A> a3(new A);\n      a0 = a3;\n      ASSERT_TRUE(a0 == a3);\n      ASSERT_TRUE(a0 != NULL);\n      ASSERT_TRUE(a0.get() == a3);\n      ASSERT_TRUE(a0 == a3.get());\n      linked_ptr<A> a4(a0);\n      a1 = a4;\n      linked_ptr<A> a5(new A);\n      ASSERT_TRUE(a5.get() != a3);\n      ASSERT_TRUE(a5 != a3.get());\n      a2 = a5;\n      linked_ptr<B> b0(new B);\n      linked_ptr<A> a6(b0);\n      ASSERT_TRUE(b0 == a6);\n      ASSERT_TRUE(a6 == b0);\n      ASSERT_TRUE(b0 != NULL);\n      a5 = b0;\n      a5 = b0;\n      a3->Use();\n      a4->Use();\n      a5->Use();\n      a6->Use();\n      b0->Use();\n      (*b0).Use();\n      b0.get()->Use();\n    }\n\n    a0->Use();\n    a1->Use();\n    a2->Use();\n\n    a1 = a2;\n    a2.reset(new A);\n    a0.reset();\n\n    linked_ptr<A> a7;\n  }\n\n  ASSERT_STREQ(\n    \"A0 ctor\\n\"\n    \"A1 ctor\\n\"\n    \"A2 ctor\\n\"\n    \"B2 ctor\\n\"\n    \"A0 use\\n\"\n    \"A0 use\\n\"\n    \"B2 use\\n\"\n    \"B2 use\\n\"\n    \"B2 use\\n\"\n    \"B2 use\\n\"\n    \"B2 use\\n\"\n    \"B2 dtor\\n\"\n    \"A2 dtor\\n\"\n    \"A0 use\\n\"\n    \"A0 use\\n\"\n    \"A1 use\\n\"\n    \"A3 ctor\\n\"\n    \"A0 dtor\\n\"\n    \"A3 dtor\\n\"\n    \"A1 dtor\\n\",\n    history->GetString().c_str());\n}\n\n}  // Unnamed namespace\n"
  },
  {
    "path": "Tests/gtest/test/gtest-listener_test.cc",
    "content": "// Copyright 2009 Google Inc. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This file verifies Google Test event listeners receive events at the\n// right times.\n\n#include \"gtest/gtest.h\"\n#include <vector>\n\nusing ::testing::AddGlobalTestEnvironment;\nusing ::testing::Environment;\nusing ::testing::InitGoogleTest;\nusing ::testing::Test;\nusing ::testing::TestCase;\nusing ::testing::TestEventListener;\nusing ::testing::TestInfo;\nusing ::testing::TestPartResult;\nusing ::testing::UnitTest;\n\n// Used by tests to register their events.\nstd::vector<std::string>* g_events = NULL;\n\nnamespace testing {\nnamespace internal {\n\nclass EventRecordingListener : public TestEventListener {\n public:\n  explicit EventRecordingListener(const char* name) : name_(name) {}\n\n protected:\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestProgramStart\"));\n  }\n\n  virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,\n                                    int iteration) {\n    Message message;\n    message << GetFullMethodName(\"OnTestIterationStart\")\n            << \"(\" << iteration << \")\";\n    g_events->push_back(message.GetString());\n  }\n\n  virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {\n    g_events->push_back(GetFullMethodName(\"OnEnvironmentsSetUpStart\"));\n  }\n\n  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {\n    g_events->push_back(GetFullMethodName(\"OnEnvironmentsSetUpEnd\"));\n  }\n\n  virtual void OnTestCaseStart(const TestCase& /*test_case*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestCaseStart\"));\n  }\n\n  virtual void OnTestStart(const TestInfo& /*test_info*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestStart\"));\n  }\n\n  virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestPartResult\"));\n  }\n\n  virtual void OnTestEnd(const TestInfo& /*test_info*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestEnd\"));\n  }\n\n  virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestCaseEnd\"));\n  }\n\n  virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {\n    g_events->push_back(GetFullMethodName(\"OnEnvironmentsTearDownStart\"));\n  }\n\n  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {\n    g_events->push_back(GetFullMethodName(\"OnEnvironmentsTearDownEnd\"));\n  }\n\n  virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,\n                                  int iteration) {\n    Message message;\n    message << GetFullMethodName(\"OnTestIterationEnd\")\n            << \"(\"  << iteration << \")\";\n    g_events->push_back(message.GetString());\n  }\n\n  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {\n    g_events->push_back(GetFullMethodName(\"OnTestProgramEnd\"));\n  }\n\n private:\n  std::string GetFullMethodName(const char* name) {\n    return name_ + \".\" + name;\n  }\n\n  std::string name_;\n};\n\nclass EnvironmentInvocationCatcher : public Environment {\n protected:\n  virtual void SetUp() {\n    g_events->push_back(\"Environment::SetUp\");\n  }\n\n  virtual void TearDown() {\n    g_events->push_back(\"Environment::TearDown\");\n  }\n};\n\nclass ListenerTest : public Test {\n protected:\n  static void SetUpTestCase() {\n    g_events->push_back(\"ListenerTest::SetUpTestCase\");\n  }\n\n  static void TearDownTestCase() {\n    g_events->push_back(\"ListenerTest::TearDownTestCase\");\n  }\n\n  virtual void SetUp() {\n    g_events->push_back(\"ListenerTest::SetUp\");\n  }\n\n  virtual void TearDown() {\n    g_events->push_back(\"ListenerTest::TearDown\");\n  }\n};\n\nTEST_F(ListenerTest, DoesFoo) {\n  // Test execution order within a test case is not guaranteed so we are not\n  // recording the test name.\n  g_events->push_back(\"ListenerTest::* Test Body\");\n  SUCCEED();  // Triggers OnTestPartResult.\n}\n\nTEST_F(ListenerTest, DoesBar) {\n  g_events->push_back(\"ListenerTest::* Test Body\");\n  SUCCEED();  // Triggers OnTestPartResult.\n}\n\n}  // namespace internal\n\n}  // namespace testing\n\nusing ::testing::internal::EnvironmentInvocationCatcher;\nusing ::testing::internal::EventRecordingListener;\n\nvoid VerifyResults(const std::vector<std::string>& data,\n                   const char* const* expected_data,\n                   int expected_data_size) {\n  const int actual_size = data.size();\n  // If the following assertion fails, a new entry will be appended to\n  // data.  Hence we save data.size() first.\n  EXPECT_EQ(expected_data_size, actual_size);\n\n  // Compares the common prefix.\n  const int shorter_size = expected_data_size <= actual_size ?\n      expected_data_size : actual_size;\n  int i = 0;\n  for (; i < shorter_size; ++i) {\n    ASSERT_STREQ(expected_data[i], data[i].c_str())\n        << \"at position \" << i;\n  }\n\n  // Prints extra elements in the actual data.\n  for (; i < actual_size; ++i) {\n    printf(\"  Actual event #%d: %s\\n\", i, data[i].c_str());\n  }\n}\n\nint main(int argc, char **argv) {\n  std::vector<std::string> events;\n  g_events = &events;\n  InitGoogleTest(&argc, argv);\n\n  UnitTest::GetInstance()->listeners().Append(\n      new EventRecordingListener(\"1st\"));\n  UnitTest::GetInstance()->listeners().Append(\n      new EventRecordingListener(\"2nd\"));\n\n  AddGlobalTestEnvironment(new EnvironmentInvocationCatcher);\n\n  GTEST_CHECK_(events.size() == 0)\n      << \"AddGlobalTestEnvironment should not generate any events itself.\";\n\n  ::testing::GTEST_FLAG(repeat) = 2;\n  int ret_val = RUN_ALL_TESTS();\n\n  const char* const expected_events[] = {\n    \"1st.OnTestProgramStart\",\n    \"2nd.OnTestProgramStart\",\n    \"1st.OnTestIterationStart(0)\",\n    \"2nd.OnTestIterationStart(0)\",\n    \"1st.OnEnvironmentsSetUpStart\",\n    \"2nd.OnEnvironmentsSetUpStart\",\n    \"Environment::SetUp\",\n    \"2nd.OnEnvironmentsSetUpEnd\",\n    \"1st.OnEnvironmentsSetUpEnd\",\n    \"1st.OnTestCaseStart\",\n    \"2nd.OnTestCaseStart\",\n    \"ListenerTest::SetUpTestCase\",\n    \"1st.OnTestStart\",\n    \"2nd.OnTestStart\",\n    \"ListenerTest::SetUp\",\n    \"ListenerTest::* Test Body\",\n    \"1st.OnTestPartResult\",\n    \"2nd.OnTestPartResult\",\n    \"ListenerTest::TearDown\",\n    \"2nd.OnTestEnd\",\n    \"1st.OnTestEnd\",\n    \"1st.OnTestStart\",\n    \"2nd.OnTestStart\",\n    \"ListenerTest::SetUp\",\n    \"ListenerTest::* Test Body\",\n    \"1st.OnTestPartResult\",\n    \"2nd.OnTestPartResult\",\n    \"ListenerTest::TearDown\",\n    \"2nd.OnTestEnd\",\n    \"1st.OnTestEnd\",\n    \"ListenerTest::TearDownTestCase\",\n    \"2nd.OnTestCaseEnd\",\n    \"1st.OnTestCaseEnd\",\n    \"1st.OnEnvironmentsTearDownStart\",\n    \"2nd.OnEnvironmentsTearDownStart\",\n    \"Environment::TearDown\",\n    \"2nd.OnEnvironmentsTearDownEnd\",\n    \"1st.OnEnvironmentsTearDownEnd\",\n    \"2nd.OnTestIterationEnd(0)\",\n    \"1st.OnTestIterationEnd(0)\",\n    \"1st.OnTestIterationStart(1)\",\n    \"2nd.OnTestIterationStart(1)\",\n    \"1st.OnEnvironmentsSetUpStart\",\n    \"2nd.OnEnvironmentsSetUpStart\",\n    \"Environment::SetUp\",\n    \"2nd.OnEnvironmentsSetUpEnd\",\n    \"1st.OnEnvironmentsSetUpEnd\",\n    \"1st.OnTestCaseStart\",\n    \"2nd.OnTestCaseStart\",\n    \"ListenerTest::SetUpTestCase\",\n    \"1st.OnTestStart\",\n    \"2nd.OnTestStart\",\n    \"ListenerTest::SetUp\",\n    \"ListenerTest::* Test Body\",\n    \"1st.OnTestPartResult\",\n    \"2nd.OnTestPartResult\",\n    \"ListenerTest::TearDown\",\n    \"2nd.OnTestEnd\",\n    \"1st.OnTestEnd\",\n    \"1st.OnTestStart\",\n    \"2nd.OnTestStart\",\n    \"ListenerTest::SetUp\",\n    \"ListenerTest::* Test Body\",\n    \"1st.OnTestPartResult\",\n    \"2nd.OnTestPartResult\",\n    \"ListenerTest::TearDown\",\n    \"2nd.OnTestEnd\",\n    \"1st.OnTestEnd\",\n    \"ListenerTest::TearDownTestCase\",\n    \"2nd.OnTestCaseEnd\",\n    \"1st.OnTestCaseEnd\",\n    \"1st.OnEnvironmentsTearDownStart\",\n    \"2nd.OnEnvironmentsTearDownStart\",\n    \"Environment::TearDown\",\n    \"2nd.OnEnvironmentsTearDownEnd\",\n    \"1st.OnEnvironmentsTearDownEnd\",\n    \"2nd.OnTestIterationEnd(1)\",\n    \"1st.OnTestIterationEnd(1)\",\n    \"2nd.OnTestProgramEnd\",\n    \"1st.OnTestProgramEnd\"\n  };\n  VerifyResults(events,\n                expected_events,\n                sizeof(expected_events)/sizeof(expected_events[0]));\n\n  // We need to check manually for ad hoc test failures that happen after\n  // RUN_ALL_TESTS finishes.\n  if (UnitTest::GetInstance()->Failed())\n    ret_val = 1;\n\n  return ret_val;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest-message_test.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Tests for the Message class.\n\n#include \"gtest/gtest-message.h\"\n\n#include \"gtest/gtest.h\"\n\nnamespace {\n\nusing ::testing::Message;\n\n// Tests the testing::Message class\n\n// Tests the default constructor.\nTEST(MessageTest, DefaultConstructor) {\n  const Message msg;\n  EXPECT_EQ(\"\", msg.GetString());\n}\n\n// Tests the copy constructor.\nTEST(MessageTest, CopyConstructor) {\n  const Message msg1(\"Hello\");\n  const Message msg2(msg1);\n  EXPECT_EQ(\"Hello\", msg2.GetString());\n}\n\n// Tests constructing a Message from a C-string.\nTEST(MessageTest, ConstructsFromCString) {\n  Message msg(\"Hello\");\n  EXPECT_EQ(\"Hello\", msg.GetString());\n}\n\n// Tests streaming a float.\nTEST(MessageTest, StreamsFloat) {\n  const std::string s = (Message() << 1.23456F << \" \" << 2.34567F).GetString();\n  // Both numbers should be printed with enough precision.\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"1.234560\", s.c_str());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \" 2.345669\", s.c_str());\n}\n\n// Tests streaming a double.\nTEST(MessageTest, StreamsDouble) {\n  const std::string s = (Message() << 1260570880.4555497 << \" \"\n                                  << 1260572265.1954534).GetString();\n  // Both numbers should be printed with enough precision.\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"1260570880.45\", s.c_str());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \" 1260572265.19\", s.c_str());\n}\n\n// Tests streaming a non-char pointer.\nTEST(MessageTest, StreamsPointer) {\n  int n = 0;\n  int* p = &n;\n  EXPECT_NE(\"(null)\", (Message() << p).GetString());\n}\n\n// Tests streaming a NULL non-char pointer.\nTEST(MessageTest, StreamsNullPointer) {\n  int* p = NULL;\n  EXPECT_EQ(\"(null)\", (Message() << p).GetString());\n}\n\n// Tests streaming a C string.\nTEST(MessageTest, StreamsCString) {\n  EXPECT_EQ(\"Foo\", (Message() << \"Foo\").GetString());\n}\n\n// Tests streaming a NULL C string.\nTEST(MessageTest, StreamsNullCString) {\n  char* p = NULL;\n  EXPECT_EQ(\"(null)\", (Message() << p).GetString());\n}\n\n// Tests streaming std::string.\nTEST(MessageTest, StreamsString) {\n  const ::std::string str(\"Hello\");\n  EXPECT_EQ(\"Hello\", (Message() << str).GetString());\n}\n\n// Tests that we can output strings containing embedded NULs.\nTEST(MessageTest, StreamsStringWithEmbeddedNUL) {\n  const char char_array_with_nul[] =\n      \"Here's a NUL\\0 and some more string\";\n  const ::std::string string_with_nul(char_array_with_nul,\n                                      sizeof(char_array_with_nul) - 1);\n  EXPECT_EQ(\"Here's a NUL\\\\0 and some more string\",\n            (Message() << string_with_nul).GetString());\n}\n\n// Tests streaming a NUL char.\nTEST(MessageTest, StreamsNULChar) {\n  EXPECT_EQ(\"\\\\0\", (Message() << '\\0').GetString());\n}\n\n// Tests streaming int.\nTEST(MessageTest, StreamsInt) {\n  EXPECT_EQ(\"123\", (Message() << 123).GetString());\n}\n\n// Tests that basic IO manipulators (endl, ends, and flush) can be\n// streamed to Message.\nTEST(MessageTest, StreamsBasicIoManip) {\n  EXPECT_EQ(\"Line 1.\\nA NUL char \\\\0 in line 2.\",\n               (Message() << \"Line 1.\" << std::endl\n                         << \"A NUL char \" << std::ends << std::flush\n                         << \" in line 2.\").GetString());\n}\n\n// Tests Message::GetString()\nTEST(MessageTest, GetString) {\n  Message msg;\n  msg << 1 << \" lamb\";\n  EXPECT_EQ(\"1 lamb\", msg.GetString());\n}\n\n// Tests streaming a Message object to an ostream.\nTEST(MessageTest, StreamsToOStream) {\n  Message msg(\"Hello\");\n  ::std::stringstream ss;\n  ss << msg;\n  EXPECT_EQ(\"Hello\", testing::internal::StringStreamToString(&ss));\n}\n\n// Tests that a Message object doesn't take up too much stack space.\nTEST(MessageTest, DoesNotTakeUpMuchStackSpace) {\n  EXPECT_LE(sizeof(Message), 16U);\n}\n\n}  // namespace\n"
  },
  {
    "path": "Tests/gtest/test/gtest-options_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: keith.ray@gmail.com (Keith Ray)\n//\n// Google Test UnitTestOptions tests\n//\n// This file tests classes and functions used internally by\n// Google Test.  They are subject to change without notice.\n//\n// This file is #included from gtest.cc, to avoid changing build or\n// make-files on Windows and other platforms. Do not #include this file\n// anywhere else!\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_OS_WINDOWS_MOBILE\n# include <windows.h>\n#elif GTEST_OS_WINDOWS\n# include <direct.h>\n#endif  // GTEST_OS_WINDOWS_MOBILE\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\nnamespace internal {\nnamespace {\n\n// Turns the given relative path into an absolute path.\nFilePath GetAbsolutePathOf(const FilePath& relative_path) {\n  return FilePath::ConcatPaths(FilePath::GetCurrentDir(), relative_path);\n}\n\n// Testing UnitTestOptions::GetOutputFormat/GetOutputFile.\n\nTEST(XmlOutputTest, GetOutputFormatDefault) {\n  GTEST_FLAG(output) = \"\";\n  EXPECT_STREQ(\"\", UnitTestOptions::GetOutputFormat().c_str());\n}\n\nTEST(XmlOutputTest, GetOutputFormat) {\n  GTEST_FLAG(output) = \"xml:filename\";\n  EXPECT_STREQ(\"xml\", UnitTestOptions::GetOutputFormat().c_str());\n}\n\nTEST(XmlOutputTest, GetOutputFileDefault) {\n  GTEST_FLAG(output) = \"\";\n  EXPECT_EQ(GetAbsolutePathOf(FilePath(\"test_detail.xml\")).string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n}\n\nTEST(XmlOutputTest, GetOutputFileSingleFile) {\n  GTEST_FLAG(output) = \"xml:filename.abc\";\n  EXPECT_EQ(GetAbsolutePathOf(FilePath(\"filename.abc\")).string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n}\n\nTEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {\n  GTEST_FLAG(output) = \"xml:path\" GTEST_PATH_SEP_;\n  const std::string expected_output_file =\n      GetAbsolutePathOf(\n          FilePath(std::string(\"path\") + GTEST_PATH_SEP_ +\n                   GetCurrentExecutableName().string() + \".xml\")).string();\n  const std::string& output_file =\n      UnitTestOptions::GetAbsolutePathToOutputFile();\n#if GTEST_OS_WINDOWS\n  EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());\n#else\n  EXPECT_EQ(expected_output_file, output_file.c_str());\n#endif\n}\n\nTEST(OutputFileHelpersTest, GetCurrentExecutableName) {\n  const std::string exe_str = GetCurrentExecutableName().string();\n#if GTEST_OS_WINDOWS\n  const bool success =\n      _strcmpi(\"gtest-options_test\", exe_str.c_str()) == 0 ||\n      _strcmpi(\"gtest-options-ex_test\", exe_str.c_str()) == 0 ||\n      _strcmpi(\"gtest_all_test\", exe_str.c_str()) == 0 ||\n      _strcmpi(\"gtest_dll_test\", exe_str.c_str()) == 0;\n#else\n  // TODO(wan@google.com): remove the hard-coded \"lt-\" prefix when\n  //   Chandler Carruth's libtool replacement is ready.\n  const bool success =\n      exe_str == \"gtest-options_test\" ||\n      exe_str == \"gtest_all_test\" ||\n      exe_str == \"lt-gtest_all_test\" ||\n      exe_str == \"gtest_dll_test\";\n#endif  // GTEST_OS_WINDOWS\n  if (!success)\n    FAIL() << \"GetCurrentExecutableName() returns \" << exe_str;\n}\n\nclass XmlOutputChangeDirTest : public Test {\n protected:\n  virtual void SetUp() {\n    original_working_dir_ = FilePath::GetCurrentDir();\n    posix::ChDir(\"..\");\n    // This will make the test fail if run from the root directory.\n    EXPECT_NE(original_working_dir_.string(),\n              FilePath::GetCurrentDir().string());\n  }\n\n  virtual void TearDown() {\n    posix::ChDir(original_working_dir_.string().c_str());\n  }\n\n  FilePath original_working_dir_;\n};\n\nTEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {\n  GTEST_FLAG(output) = \"\";\n  EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,\n                                  FilePath(\"test_detail.xml\")).string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n}\n\nTEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {\n  GTEST_FLAG(output) = \"xml\";\n  EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,\n                                  FilePath(\"test_detail.xml\")).string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n}\n\nTEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {\n  GTEST_FLAG(output) = \"xml:filename.abc\";\n  EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,\n                                  FilePath(\"filename.abc\")).string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n}\n\nTEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {\n  GTEST_FLAG(output) = \"xml:path\" GTEST_PATH_SEP_;\n  const std::string expected_output_file =\n      FilePath::ConcatPaths(\n          original_working_dir_,\n          FilePath(std::string(\"path\") + GTEST_PATH_SEP_ +\n                   GetCurrentExecutableName().string() + \".xml\")).string();\n  const std::string& output_file =\n      UnitTestOptions::GetAbsolutePathToOutputFile();\n#if GTEST_OS_WINDOWS\n  EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());\n#else\n  EXPECT_EQ(expected_output_file, output_file.c_str());\n#endif\n}\n\nTEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {\n#if GTEST_OS_WINDOWS\n  GTEST_FLAG(output) = \"xml:c:\\\\tmp\\\\filename.abc\";\n  EXPECT_EQ(FilePath(\"c:\\\\tmp\\\\filename.abc\").string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n#else\n  GTEST_FLAG(output) =\"xml:/tmp/filename.abc\";\n  EXPECT_EQ(FilePath(\"/tmp/filename.abc\").string(),\n            UnitTestOptions::GetAbsolutePathToOutputFile());\n#endif\n}\n\nTEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {\n#if GTEST_OS_WINDOWS\n  const std::string path = \"c:\\\\tmp\\\\\";\n#else\n  const std::string path = \"/tmp/\";\n#endif\n\n  GTEST_FLAG(output) = \"xml:\" + path;\n  const std::string expected_output_file =\n      path + GetCurrentExecutableName().string() + \".xml\";\n  const std::string& output_file =\n      UnitTestOptions::GetAbsolutePathToOutputFile();\n\n#if GTEST_OS_WINDOWS\n  EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());\n#else\n  EXPECT_EQ(expected_output_file, output_file.c_str());\n#endif\n}\n\n}  // namespace\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/test/gtest-param-test2_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n//\n// Tests for Google Test itself.  This verifies that the basic constructs of\n// Google Test work.\n\n#include \"gtest/gtest.h\"\n\n#include \"test/gtest-param-test_test.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\nusing ::testing::Values;\nusing ::testing::internal::ParamGenerator;\n\n// Tests that generators defined in a different translation unit\n// are functional. The test using extern_gen is defined\n// in gtest-param-test_test.cc.\nParamGenerator<int> extern_gen = Values(33);\n\n// Tests that a parameterized test case can be defined in one translation unit\n// and instantiated in another. The test is defined in gtest-param-test_test.cc\n// and ExternalInstantiationTest fixture class is defined in\n// gtest-param-test_test.h.\nINSTANTIATE_TEST_CASE_P(MultiplesOf33,\n                        ExternalInstantiationTest,\n                        Values(33, 66));\n\n// Tests that a parameterized test case can be instantiated\n// in multiple translation units. Another instantiation is defined\n// in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest\n// fixture is defined in gtest-param-test_test.h\nINSTANTIATE_TEST_CASE_P(Sequence2,\n                        InstantiationInMultipleTranslaionUnitsTest,\n                        Values(42*3, 42*4, 42*5));\n\n#endif  // GTEST_HAS_PARAM_TEST\n"
  },
  {
    "path": "Tests/gtest/test/gtest-param-test_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n//\n// Tests for Google Test itself. This file verifies that the parameter\n// generators objects produce correct parameter sequences and that\n// Google Test runtime instantiates correct tests from those sequences.\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\n# include <algorithm>\n# include <iostream>\n# include <list>\n# include <sstream>\n# include <string>\n# include <vector>\n\n// To include gtest-internal-inl.h.\n# define GTEST_IMPLEMENTATION_ 1\n# include \"src/gtest-internal-inl.h\"  // for UnitTestOptions\n# undef GTEST_IMPLEMENTATION_\n\n# include \"test/gtest-param-test_test.h\"\n\nusing ::std::vector;\nusing ::std::sort;\n\nusing ::testing::AddGlobalTestEnvironment;\nusing ::testing::Bool;\nusing ::testing::Message;\nusing ::testing::Range;\nusing ::testing::TestWithParam;\nusing ::testing::Values;\nusing ::testing::ValuesIn;\n\n# if GTEST_HAS_COMBINE\nusing ::testing::Combine;\nusing ::std::tr1::get;\nusing ::std::tr1::make_tuple;\nusing ::std::tr1::tuple;\n# endif  // GTEST_HAS_COMBINE\n\nusing ::testing::internal::ParamGenerator;\nusing ::testing::internal::UnitTestOptions;\n\n// Prints a value to a string.\n//\n// TODO(wan@google.com): remove PrintValue() when we move matchers and\n// EXPECT_THAT() from Google Mock to Google Test.  At that time, we\n// can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as\n// EXPECT_THAT() and the matchers know how to print tuples.\ntemplate <typename T>\n::std::string PrintValue(const T& value) {\n  ::std::stringstream stream;\n  stream << value;\n  return stream.str();\n}\n\n# if GTEST_HAS_COMBINE\n\n// These overloads allow printing tuples in our tests.  We cannot\n// define an operator<< for tuples, as that definition needs to be in\n// the std namespace in order to be picked up by Google Test via\n// Argument-Dependent Lookup, yet defining anything in the std\n// namespace in non-STL code is undefined behavior.\n\ntemplate <typename T1, typename T2>\n::std::string PrintValue(const tuple<T1, T2>& value) {\n  ::std::stringstream stream;\n  stream << \"(\" << get<0>(value) << \", \" << get<1>(value) << \")\";\n  return stream.str();\n}\n\ntemplate <typename T1, typename T2, typename T3>\n::std::string PrintValue(const tuple<T1, T2, T3>& value) {\n  ::std::stringstream stream;\n  stream << \"(\" << get<0>(value) << \", \" << get<1>(value)\n         << \", \"<< get<2>(value) << \")\";\n  return stream.str();\n}\n\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5,\n          typename T6, typename T7, typename T8, typename T9, typename T10>\n::std::string PrintValue(\n    const tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& value) {\n  ::std::stringstream stream;\n  stream << \"(\" << get<0>(value) << \", \" << get<1>(value)\n         << \", \"<< get<2>(value) << \", \" << get<3>(value)\n         << \", \"<< get<4>(value) << \", \" << get<5>(value)\n         << \", \"<< get<6>(value) << \", \" << get<7>(value)\n         << \", \"<< get<8>(value) << \", \" << get<9>(value) << \")\";\n  return stream.str();\n}\n\n# endif  // GTEST_HAS_COMBINE\n\n// Verifies that a sequence generated by the generator and accessed\n// via the iterator object matches the expected one using Google Test\n// assertions.\ntemplate <typename T, size_t N>\nvoid VerifyGenerator(const ParamGenerator<T>& generator,\n                     const T (&expected_values)[N]) {\n  typename ParamGenerator<T>::iterator it = generator.begin();\n  for (size_t i = 0; i < N; ++i) {\n    ASSERT_FALSE(it == generator.end())\n        << \"At element \" << i << \" when accessing via an iterator \"\n        << \"created with the copy constructor.\\n\";\n    // We cannot use EXPECT_EQ() here as the values may be tuples,\n    // which don't support <<.\n    EXPECT_TRUE(expected_values[i] == *it)\n        << \"where i is \" << i\n        << \", expected_values[i] is \" << PrintValue(expected_values[i])\n        << \", *it is \" << PrintValue(*it)\n        << \", and 'it' is an iterator created with the copy constructor.\\n\";\n    it++;\n  }\n  EXPECT_TRUE(it == generator.end())\n        << \"At the presumed end of sequence when accessing via an iterator \"\n        << \"created with the copy constructor.\\n\";\n\n  // Test the iterator assignment. The following lines verify that\n  // the sequence accessed via an iterator initialized via the\n  // assignment operator (as opposed to a copy constructor) matches\n  // just the same.\n  it = generator.begin();\n  for (size_t i = 0; i < N; ++i) {\n    ASSERT_FALSE(it == generator.end())\n        << \"At element \" << i << \" when accessing via an iterator \"\n        << \"created with the assignment operator.\\n\";\n    EXPECT_TRUE(expected_values[i] == *it)\n        << \"where i is \" << i\n        << \", expected_values[i] is \" << PrintValue(expected_values[i])\n        << \", *it is \" << PrintValue(*it)\n        << \", and 'it' is an iterator created with the copy constructor.\\n\";\n    it++;\n  }\n  EXPECT_TRUE(it == generator.end())\n        << \"At the presumed end of sequence when accessing via an iterator \"\n        << \"created with the assignment operator.\\n\";\n}\n\ntemplate <typename T>\nvoid VerifyGeneratorIsEmpty(const ParamGenerator<T>& generator) {\n  typename ParamGenerator<T>::iterator it = generator.begin();\n  EXPECT_TRUE(it == generator.end());\n\n  it = generator.begin();\n  EXPECT_TRUE(it == generator.end());\n}\n\n// Generator tests. They test that each of the provided generator functions\n// generates an expected sequence of values. The general test pattern\n// instantiates a generator using one of the generator functions,\n// checks the sequence produced by the generator using its iterator API,\n// and then resets the iterator back to the beginning of the sequence\n// and checks the sequence again.\n\n// Tests that iterators produced by generator functions conform to the\n// ForwardIterator concept.\nTEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {\n  const ParamGenerator<int> gen = Range(0, 10);\n  ParamGenerator<int>::iterator it = gen.begin();\n\n  // Verifies that iterator initialization works as expected.\n  ParamGenerator<int>::iterator it2 = it;\n  EXPECT_TRUE(*it == *it2) << \"Initialized iterators must point to the \"\n                           << \"element same as its source points to\";\n\n  // Verifies that iterator assignment works as expected.\n  it++;\n  EXPECT_FALSE(*it == *it2);\n  it2 = it;\n  EXPECT_TRUE(*it == *it2) << \"Assigned iterators must point to the \"\n                           << \"element same as its source points to\";\n\n  // Verifies that prefix operator++() returns *this.\n  EXPECT_EQ(&it, &(++it)) << \"Result of the prefix operator++ must be \"\n                          << \"refer to the original object\";\n\n  // Verifies that the result of the postfix operator++ points to the value\n  // pointed to by the original iterator.\n  int original_value = *it;  // Have to compute it outside of macro call to be\n                             // unaffected by the parameter evaluation order.\n  EXPECT_EQ(original_value, *(it++));\n\n  // Verifies that prefix and postfix operator++() advance an iterator\n  // all the same.\n  it2 = it;\n  it++;\n  ++it2;\n  EXPECT_TRUE(*it == *it2);\n}\n\n// Tests that Range() generates the expected sequence.\nTEST(RangeTest, IntRangeWithDefaultStep) {\n  const ParamGenerator<int> gen = Range(0, 3);\n  const int expected_values[] = {0, 1, 2};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Edge case. Tests that Range() generates the single element sequence\n// as expected when provided with range limits that are equal.\nTEST(RangeTest, IntRangeSingleValue) {\n  const ParamGenerator<int> gen = Range(0, 1);\n  const int expected_values[] = {0};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Edge case. Tests that Range() with generates empty sequence when\n// supplied with an empty range.\nTEST(RangeTest, IntRangeEmpty) {\n  const ParamGenerator<int> gen = Range(0, 0);\n  VerifyGeneratorIsEmpty(gen);\n}\n\n// Tests that Range() with custom step (greater then one) generates\n// the expected sequence.\nTEST(RangeTest, IntRangeWithCustomStep) {\n  const ParamGenerator<int> gen = Range(0, 9, 3);\n  const int expected_values[] = {0, 3, 6};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that Range() with custom step (greater then one) generates\n// the expected sequence when the last element does not fall on the\n// upper range limit. Sequences generated by Range() must not have\n// elements beyond the range limits.\nTEST(RangeTest, IntRangeWithCustomStepOverUpperBound) {\n  const ParamGenerator<int> gen = Range(0, 4, 3);\n  const int expected_values[] = {0, 3};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Verifies that Range works with user-defined types that define\n// copy constructor, operator=(), operator+(), and operator<().\nclass DogAdder {\n public:\n  explicit DogAdder(const char* a_value) : value_(a_value) {}\n  DogAdder(const DogAdder& other) : value_(other.value_.c_str()) {}\n\n  DogAdder operator=(const DogAdder& other) {\n    if (this != &other)\n      value_ = other.value_;\n    return *this;\n  }\n  DogAdder operator+(const DogAdder& other) const {\n    Message msg;\n    msg << value_.c_str() << other.value_.c_str();\n    return DogAdder(msg.GetString().c_str());\n  }\n  bool operator<(const DogAdder& other) const {\n    return value_ < other.value_;\n  }\n  const std::string& value() const { return value_; }\n\n private:\n  std::string value_;\n};\n\nTEST(RangeTest, WorksWithACustomType) {\n  const ParamGenerator<DogAdder> gen =\n      Range(DogAdder(\"cat\"), DogAdder(\"catdogdog\"), DogAdder(\"dog\"));\n  ParamGenerator<DogAdder>::iterator it = gen.begin();\n\n  ASSERT_FALSE(it == gen.end());\n  EXPECT_STREQ(\"cat\", it->value().c_str());\n\n  ASSERT_FALSE(++it == gen.end());\n  EXPECT_STREQ(\"catdog\", it->value().c_str());\n\n  EXPECT_TRUE(++it == gen.end());\n}\n\nclass IntWrapper {\n public:\n  explicit IntWrapper(int a_value) : value_(a_value) {}\n  IntWrapper(const IntWrapper& other) : value_(other.value_) {}\n\n  IntWrapper operator=(const IntWrapper& other) {\n    value_ = other.value_;\n    return *this;\n  }\n  // operator+() adds a different type.\n  IntWrapper operator+(int other) const { return IntWrapper(value_ + other); }\n  bool operator<(const IntWrapper& other) const {\n    return value_ < other.value_;\n  }\n  int value() const { return value_; }\n\n private:\n  int value_;\n};\n\nTEST(RangeTest, WorksWithACustomTypeWithDifferentIncrementType) {\n  const ParamGenerator<IntWrapper> gen = Range(IntWrapper(0), IntWrapper(2));\n  ParamGenerator<IntWrapper>::iterator it = gen.begin();\n\n  ASSERT_FALSE(it == gen.end());\n  EXPECT_EQ(0, it->value());\n\n  ASSERT_FALSE(++it == gen.end());\n  EXPECT_EQ(1, it->value());\n\n  EXPECT_TRUE(++it == gen.end());\n}\n\n// Tests that ValuesIn() with an array parameter generates\n// the expected sequence.\nTEST(ValuesInTest, ValuesInArray) {\n  int array[] = {3, 5, 8};\n  const ParamGenerator<int> gen = ValuesIn(array);\n  VerifyGenerator(gen, array);\n}\n\n// Tests that ValuesIn() with a const array parameter generates\n// the expected sequence.\nTEST(ValuesInTest, ValuesInConstArray) {\n  const int array[] = {3, 5, 8};\n  const ParamGenerator<int> gen = ValuesIn(array);\n  VerifyGenerator(gen, array);\n}\n\n// Edge case. Tests that ValuesIn() with an array parameter containing a\n// single element generates the single element sequence.\nTEST(ValuesInTest, ValuesInSingleElementArray) {\n  int array[] = {42};\n  const ParamGenerator<int> gen = ValuesIn(array);\n  VerifyGenerator(gen, array);\n}\n\n// Tests that ValuesIn() generates the expected sequence for an STL\n// container (vector).\nTEST(ValuesInTest, ValuesInVector) {\n  typedef ::std::vector<int> ContainerType;\n  ContainerType values;\n  values.push_back(3);\n  values.push_back(5);\n  values.push_back(8);\n  const ParamGenerator<int> gen = ValuesIn(values);\n\n  const int expected_values[] = {3, 5, 8};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that ValuesIn() generates the expected sequence.\nTEST(ValuesInTest, ValuesInIteratorRange) {\n  typedef ::std::vector<int> ContainerType;\n  ContainerType values;\n  values.push_back(3);\n  values.push_back(5);\n  values.push_back(8);\n  const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());\n\n  const int expected_values[] = {3, 5, 8};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Edge case. Tests that ValuesIn() provided with an iterator range specifying a\n// single value generates a single-element sequence.\nTEST(ValuesInTest, ValuesInSingleElementIteratorRange) {\n  typedef ::std::vector<int> ContainerType;\n  ContainerType values;\n  values.push_back(42);\n  const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());\n\n  const int expected_values[] = {42};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Edge case. Tests that ValuesIn() provided with an empty iterator range\n// generates an empty sequence.\nTEST(ValuesInTest, ValuesInEmptyIteratorRange) {\n  typedef ::std::vector<int> ContainerType;\n  ContainerType values;\n  const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());\n\n  VerifyGeneratorIsEmpty(gen);\n}\n\n// Tests that the Values() generates the expected sequence.\nTEST(ValuesTest, ValuesWorks) {\n  const ParamGenerator<int> gen = Values(3, 5, 8);\n\n  const int expected_values[] = {3, 5, 8};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that Values() generates the expected sequences from elements of\n// different types convertible to ParamGenerator's parameter type.\nTEST(ValuesTest, ValuesWorksForValuesOfCompatibleTypes) {\n  const ParamGenerator<double> gen = Values(3, 5.0f, 8.0);\n\n  const double expected_values[] = {3.0, 5.0, 8.0};\n  VerifyGenerator(gen, expected_values);\n}\n\nTEST(ValuesTest, ValuesWorksForMaxLengthList) {\n  const ParamGenerator<int> gen = Values(\n      10, 20, 30, 40, 50, 60, 70, 80, 90, 100,\n      110, 120, 130, 140, 150, 160, 170, 180, 190, 200,\n      210, 220, 230, 240, 250, 260, 270, 280, 290, 300,\n      310, 320, 330, 340, 350, 360, 370, 380, 390, 400,\n      410, 420, 430, 440, 450, 460, 470, 480, 490, 500);\n\n  const int expected_values[] = {\n      10, 20, 30, 40, 50, 60, 70, 80, 90, 100,\n      110, 120, 130, 140, 150, 160, 170, 180, 190, 200,\n      210, 220, 230, 240, 250, 260, 270, 280, 290, 300,\n      310, 320, 330, 340, 350, 360, 370, 380, 390, 400,\n      410, 420, 430, 440, 450, 460, 470, 480, 490, 500};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Edge case test. Tests that single-parameter Values() generates the sequence\n// with the single value.\nTEST(ValuesTest, ValuesWithSingleParameter) {\n  const ParamGenerator<int> gen = Values(42);\n\n  const int expected_values[] = {42};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that Bool() generates sequence (false, true).\nTEST(BoolTest, BoolWorks) {\n  const ParamGenerator<bool> gen = Bool();\n\n  const bool expected_values[] = {false, true};\n  VerifyGenerator(gen, expected_values);\n}\n\n# if GTEST_HAS_COMBINE\n\n// Tests that Combine() with two parameters generates the expected sequence.\nTEST(CombineTest, CombineWithTwoParameters) {\n  const char* foo = \"foo\";\n  const char* bar = \"bar\";\n  const ParamGenerator<tuple<const char*, int> > gen =\n      Combine(Values(foo, bar), Values(3, 4));\n\n  tuple<const char*, int> expected_values[] = {\n    make_tuple(foo, 3), make_tuple(foo, 4),\n    make_tuple(bar, 3), make_tuple(bar, 4)};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that Combine() with three parameters generates the expected sequence.\nTEST(CombineTest, CombineWithThreeParameters) {\n  const ParamGenerator<tuple<int, int, int> > gen = Combine(Values(0, 1),\n                                                            Values(3, 4),\n                                                            Values(5, 6));\n  tuple<int, int, int> expected_values[] = {\n    make_tuple(0, 3, 5), make_tuple(0, 3, 6),\n    make_tuple(0, 4, 5), make_tuple(0, 4, 6),\n    make_tuple(1, 3, 5), make_tuple(1, 3, 6),\n    make_tuple(1, 4, 5), make_tuple(1, 4, 6)};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that the Combine() with the first parameter generating a single value\n// sequence generates a sequence with the number of elements equal to the\n// number of elements in the sequence generated by the second parameter.\nTEST(CombineTest, CombineWithFirstParameterSingleValue) {\n  const ParamGenerator<tuple<int, int> > gen = Combine(Values(42),\n                                                       Values(0, 1));\n\n  tuple<int, int> expected_values[] = {make_tuple(42, 0), make_tuple(42, 1)};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that the Combine() with the second parameter generating a single value\n// sequence generates a sequence with the number of elements equal to the\n// number of elements in the sequence generated by the first parameter.\nTEST(CombineTest, CombineWithSecondParameterSingleValue) {\n  const ParamGenerator<tuple<int, int> > gen = Combine(Values(0, 1),\n                                                       Values(42));\n\n  tuple<int, int> expected_values[] = {make_tuple(0, 42), make_tuple(1, 42)};\n  VerifyGenerator(gen, expected_values);\n}\n\n// Tests that when the first parameter produces an empty sequence,\n// Combine() produces an empty sequence, too.\nTEST(CombineTest, CombineWithFirstParameterEmptyRange) {\n  const ParamGenerator<tuple<int, int> > gen = Combine(Range(0, 0),\n                                                       Values(0, 1));\n  VerifyGeneratorIsEmpty(gen);\n}\n\n// Tests that when the second parameter produces an empty sequence,\n// Combine() produces an empty sequence, too.\nTEST(CombineTest, CombineWithSecondParameterEmptyRange) {\n  const ParamGenerator<tuple<int, int> > gen = Combine(Values(0, 1),\n                                                       Range(1, 1));\n  VerifyGeneratorIsEmpty(gen);\n}\n\n// Edge case. Tests that combine works with the maximum number\n// of parameters supported by Google Test (currently 10).\nTEST(CombineTest, CombineWithMaxNumberOfParameters) {\n  const char* foo = \"foo\";\n  const char* bar = \"bar\";\n  const ParamGenerator<tuple<const char*, int, int, int, int, int, int, int,\n                             int, int> > gen = Combine(Values(foo, bar),\n                                                       Values(1), Values(2),\n                                                       Values(3), Values(4),\n                                                       Values(5), Values(6),\n                                                       Values(7), Values(8),\n                                                       Values(9));\n\n  tuple<const char*, int, int, int, int, int, int, int, int, int>\n      expected_values[] = {make_tuple(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9),\n                           make_tuple(bar, 1, 2, 3, 4, 5, 6, 7, 8, 9)};\n  VerifyGenerator(gen, expected_values);\n}\n\n# endif  // GTEST_HAS_COMBINE\n\n// Tests that an generator produces correct sequence after being\n// assigned from another generator.\nTEST(ParamGeneratorTest, AssignmentWorks) {\n  ParamGenerator<int> gen = Values(1, 2);\n  const ParamGenerator<int> gen2 = Values(3, 4);\n  gen = gen2;\n\n  const int expected_values[] = {3, 4};\n  VerifyGenerator(gen, expected_values);\n}\n\n// This test verifies that the tests are expanded and run as specified:\n// one test per element from the sequence produced by the generator\n// specified in INSTANTIATE_TEST_CASE_P. It also verifies that the test's\n// fixture constructor, SetUp(), and TearDown() have run and have been\n// supplied with the correct parameters.\n\n// The use of environment object allows detection of the case where no test\n// case functionality is run at all. In this case TestCaseTearDown will not\n// be able to detect missing tests, naturally.\ntemplate <int kExpectedCalls>\nclass TestGenerationEnvironment : public ::testing::Environment {\n public:\n  static TestGenerationEnvironment* Instance() {\n    static TestGenerationEnvironment* instance = new TestGenerationEnvironment;\n    return instance;\n  }\n\n  void FixtureConstructorExecuted() { fixture_constructor_count_++; }\n  void SetUpExecuted() { set_up_count_++; }\n  void TearDownExecuted() { tear_down_count_++; }\n  void TestBodyExecuted() { test_body_count_++; }\n\n  virtual void TearDown() {\n    // If all MultipleTestGenerationTest tests have been de-selected\n    // by the filter flag, the following checks make no sense.\n    bool perform_check = false;\n\n    for (int i = 0; i < kExpectedCalls; ++i) {\n      Message msg;\n      msg << \"TestsExpandedAndRun/\" << i;\n      if (UnitTestOptions::FilterMatchesTest(\n             \"TestExpansionModule/MultipleTestGenerationTest\",\n              msg.GetString().c_str())) {\n        perform_check = true;\n      }\n    }\n    if (perform_check) {\n      EXPECT_EQ(kExpectedCalls, fixture_constructor_count_)\n          << \"Fixture constructor of ParamTestGenerationTest test case \"\n          << \"has not been run as expected.\";\n      EXPECT_EQ(kExpectedCalls, set_up_count_)\n          << \"Fixture SetUp method of ParamTestGenerationTest test case \"\n          << \"has not been run as expected.\";\n      EXPECT_EQ(kExpectedCalls, tear_down_count_)\n          << \"Fixture TearDown method of ParamTestGenerationTest test case \"\n          << \"has not been run as expected.\";\n      EXPECT_EQ(kExpectedCalls, test_body_count_)\n          << \"Test in ParamTestGenerationTest test case \"\n          << \"has not been run as expected.\";\n    }\n  }\n\n private:\n  TestGenerationEnvironment() : fixture_constructor_count_(0), set_up_count_(0),\n                                tear_down_count_(0), test_body_count_(0) {}\n\n  int fixture_constructor_count_;\n  int set_up_count_;\n  int tear_down_count_;\n  int test_body_count_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationEnvironment);\n};\n\nconst int test_generation_params[] = {36, 42, 72};\n\nclass TestGenerationTest : public TestWithParam<int> {\n public:\n  enum {\n    PARAMETER_COUNT =\n        sizeof(test_generation_params)/sizeof(test_generation_params[0])\n  };\n\n  typedef TestGenerationEnvironment<PARAMETER_COUNT> Environment;\n\n  TestGenerationTest() {\n    Environment::Instance()->FixtureConstructorExecuted();\n    current_parameter_ = GetParam();\n  }\n  virtual void SetUp() {\n    Environment::Instance()->SetUpExecuted();\n    EXPECT_EQ(current_parameter_, GetParam());\n  }\n  virtual void TearDown() {\n    Environment::Instance()->TearDownExecuted();\n    EXPECT_EQ(current_parameter_, GetParam());\n  }\n\n  static void SetUpTestCase() {\n    bool all_tests_in_test_case_selected = true;\n\n    for (int i = 0; i < PARAMETER_COUNT; ++i) {\n      Message test_name;\n      test_name << \"TestsExpandedAndRun/\" << i;\n      if ( !UnitTestOptions::FilterMatchesTest(\n                \"TestExpansionModule/MultipleTestGenerationTest\",\n                test_name.GetString())) {\n        all_tests_in_test_case_selected = false;\n      }\n    }\n    EXPECT_TRUE(all_tests_in_test_case_selected)\n        << \"When running the TestGenerationTest test case all of its tests\\n\"\n        << \"must be selected by the filter flag for the test case to pass.\\n\"\n        << \"If not all of them are enabled, we can't reliably conclude\\n\"\n        << \"that the correct number of tests have been generated.\";\n\n    collected_parameters_.clear();\n  }\n\n  static void TearDownTestCase() {\n    vector<int> expected_values(test_generation_params,\n                                test_generation_params + PARAMETER_COUNT);\n    // Test execution order is not guaranteed by Google Test,\n    // so the order of values in collected_parameters_ can be\n    // different and we have to sort to compare.\n    sort(expected_values.begin(), expected_values.end());\n    sort(collected_parameters_.begin(), collected_parameters_.end());\n\n    EXPECT_TRUE(collected_parameters_ == expected_values);\n  }\n\n protected:\n  int current_parameter_;\n  static vector<int> collected_parameters_;\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationTest);\n};\nvector<int> TestGenerationTest::collected_parameters_;\n\nTEST_P(TestGenerationTest, TestsExpandedAndRun) {\n  Environment::Instance()->TestBodyExecuted();\n  EXPECT_EQ(current_parameter_, GetParam());\n  collected_parameters_.push_back(GetParam());\n}\nINSTANTIATE_TEST_CASE_P(TestExpansionModule, TestGenerationTest,\n                        ValuesIn(test_generation_params));\n\n// This test verifies that the element sequence (third parameter of\n// INSTANTIATE_TEST_CASE_P) is evaluated in InitGoogleTest() and neither at\n// the call site of INSTANTIATE_TEST_CASE_P nor in RUN_ALL_TESTS().  For\n// that, we declare param_value_ to be a static member of\n// GeneratorEvaluationTest and initialize it to 0.  We set it to 1 in\n// main(), just before invocation of InitGoogleTest().  After calling\n// InitGoogleTest(), we set the value to 2.  If the sequence is evaluated\n// before or after InitGoogleTest, INSTANTIATE_TEST_CASE_P will create a\n// test with parameter other than 1, and the test body will fail the\n// assertion.\nclass GeneratorEvaluationTest : public TestWithParam<int> {\n public:\n  static int param_value() { return param_value_; }\n  static void set_param_value(int param_value) { param_value_ = param_value; }\n\n private:\n  static int param_value_;\n};\nint GeneratorEvaluationTest::param_value_ = 0;\n\nTEST_P(GeneratorEvaluationTest, GeneratorsEvaluatedInMain) {\n  EXPECT_EQ(1, GetParam());\n}\nINSTANTIATE_TEST_CASE_P(GenEvalModule,\n                        GeneratorEvaluationTest,\n                        Values(GeneratorEvaluationTest::param_value()));\n\n// Tests that generators defined in a different translation unit are\n// functional. Generator extern_gen is defined in gtest-param-test_test2.cc.\nextern ParamGenerator<int> extern_gen;\nclass ExternalGeneratorTest : public TestWithParam<int> {};\nTEST_P(ExternalGeneratorTest, ExternalGenerator) {\n  // Sequence produced by extern_gen contains only a single value\n  // which we verify here.\n  EXPECT_EQ(GetParam(), 33);\n}\nINSTANTIATE_TEST_CASE_P(ExternalGeneratorModule,\n                        ExternalGeneratorTest,\n                        extern_gen);\n\n// Tests that a parameterized test case can be defined in one translation\n// unit and instantiated in another. This test will be instantiated in\n// gtest-param-test_test2.cc. ExternalInstantiationTest fixture class is\n// defined in gtest-param-test_test.h.\nTEST_P(ExternalInstantiationTest, IsMultipleOf33) {\n  EXPECT_EQ(0, GetParam() % 33);\n}\n\n// Tests that a parameterized test case can be instantiated with multiple\n// generators.\nclass MultipleInstantiationTest : public TestWithParam<int> {};\nTEST_P(MultipleInstantiationTest, AllowsMultipleInstances) {\n}\nINSTANTIATE_TEST_CASE_P(Sequence1, MultipleInstantiationTest, Values(1, 2));\nINSTANTIATE_TEST_CASE_P(Sequence2, MultipleInstantiationTest, Range(3, 5));\n\n// Tests that a parameterized test case can be instantiated\n// in multiple translation units. This test will be instantiated\n// here and in gtest-param-test_test2.cc.\n// InstantiationInMultipleTranslationUnitsTest fixture class\n// is defined in gtest-param-test_test.h.\nTEST_P(InstantiationInMultipleTranslaionUnitsTest, IsMultipleOf42) {\n  EXPECT_EQ(0, GetParam() % 42);\n}\nINSTANTIATE_TEST_CASE_P(Sequence1,\n                        InstantiationInMultipleTranslaionUnitsTest,\n                        Values(42, 42*2));\n\n// Tests that each iteration of parameterized test runs in a separate test\n// object.\nclass SeparateInstanceTest : public TestWithParam<int> {\n public:\n  SeparateInstanceTest() : count_(0) {}\n\n  static void TearDownTestCase() {\n    EXPECT_GE(global_count_, 2)\n        << \"If some (but not all) SeparateInstanceTest tests have been \"\n        << \"filtered out this test will fail. Make sure that all \"\n        << \"GeneratorEvaluationTest are selected or de-selected together \"\n        << \"by the test filter.\";\n  }\n\n protected:\n  int count_;\n  static int global_count_;\n};\nint SeparateInstanceTest::global_count_ = 0;\n\nTEST_P(SeparateInstanceTest, TestsRunInSeparateInstances) {\n  EXPECT_EQ(0, count_++);\n  global_count_++;\n}\nINSTANTIATE_TEST_CASE_P(FourElemSequence, SeparateInstanceTest, Range(1, 4));\n\n// Tests that all instantiations of a test have named appropriately. Test\n// defined with TEST_P(TestCaseName, TestName) and instantiated with\n// INSTANTIATE_TEST_CASE_P(SequenceName, TestCaseName, generator) must be named\n// SequenceName/TestCaseName.TestName/i, where i is the 0-based index of the\n// sequence element used to instantiate the test.\nclass NamingTest : public TestWithParam<int> {};\n\nTEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {\n  const ::testing::TestInfo* const test_info =\n     ::testing::UnitTest::GetInstance()->current_test_info();\n\n  EXPECT_STREQ(\"ZeroToFiveSequence/NamingTest\", test_info->test_case_name());\n\n  Message index_stream;\n  index_stream << \"TestsReportCorrectNamesAndParameters/\" << GetParam();\n  EXPECT_STREQ(index_stream.GetString().c_str(), test_info->name());\n\n  EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());\n}\n\nINSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));\n\n// Class that cannot be streamed into an ostream.  It needs to be copyable\n// (and, in case of MSVC, also assignable) in order to be a test parameter\n// type.  Its default copy constructor and assignment operator do exactly\n// what we need.\nclass Unstreamable {\n public:\n  explicit Unstreamable(int value) : value_(value) {}\n\n private:\n  int value_;\n};\n\nclass CommentTest : public TestWithParam<Unstreamable> {};\n\nTEST_P(CommentTest, TestsCorrectlyReportUnstreamableParams) {\n  const ::testing::TestInfo* const test_info =\n     ::testing::UnitTest::GetInstance()->current_test_info();\n\n  EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());\n}\n\nINSTANTIATE_TEST_CASE_P(InstantiationWithComments,\n                        CommentTest,\n                        Values(Unstreamable(1)));\n\n// Verify that we can create a hierarchy of test fixtures, where the base\n// class fixture is not parameterized and the derived class is. In this case\n// ParameterizedDerivedTest inherits from NonParameterizedBaseTest.  We\n// perform simple tests on both.\nclass NonParameterizedBaseTest : public ::testing::Test {\n public:\n  NonParameterizedBaseTest() : n_(17) { }\n protected:\n  int n_;\n};\n\nclass ParameterizedDerivedTest : public NonParameterizedBaseTest,\n                                 public ::testing::WithParamInterface<int> {\n protected:\n  ParameterizedDerivedTest() : count_(0) { }\n  int count_;\n  static int global_count_;\n};\n\nint ParameterizedDerivedTest::global_count_ = 0;\n\nTEST_F(NonParameterizedBaseTest, FixtureIsInitialized) {\n  EXPECT_EQ(17, n_);\n}\n\nTEST_P(ParameterizedDerivedTest, SeesSequence) {\n  EXPECT_EQ(17, n_);\n  EXPECT_EQ(0, count_++);\n  EXPECT_EQ(GetParam(), global_count_++);\n}\n\nclass ParameterizedDeathTest : public ::testing::TestWithParam<int> { };\n\nTEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {\n  EXPECT_DEATH_IF_SUPPORTED(GetParam(),\n                            \".* value-parameterized test .*\");\n}\n\nINSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));\n\n#endif  // GTEST_HAS_PARAM_TEST\n\nTEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {\n#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST\n  FAIL() << \"GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\\n\"\n#endif\n}\n\nint main(int argc, char **argv) {\n#if GTEST_HAS_PARAM_TEST\n  // Used in TestGenerationTest test case.\n  AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());\n  // Used in GeneratorEvaluationTest test case. Tests that the updated value\n  // will be picked up for instantiating tests in GeneratorEvaluationTest.\n  GeneratorEvaluationTest::set_param_value(1);\n#endif  // GTEST_HAS_PARAM_TEST\n\n  ::testing::InitGoogleTest(&argc, argv);\n\n#if GTEST_HAS_PARAM_TEST\n  // Used in GeneratorEvaluationTest test case. Tests that value updated\n  // here will NOT be used for instantiating tests in\n  // GeneratorEvaluationTest.\n  GeneratorEvaluationTest::set_param_value(2);\n#endif  // GTEST_HAS_PARAM_TEST\n\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest-param-test_test.h",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: vladl@google.com (Vlad Losev)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This header file provides classes and functions used internally\n// for testing Google Test itself.\n\n#ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_\n#define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_PARAM_TEST\n\n// Test fixture for testing definition and instantiation of a test\n// in separate translation units.\nclass ExternalInstantiationTest : public ::testing::TestWithParam<int> {\n};\n\n// Test fixture for testing instantiation of a test in multiple\n// translation units.\nclass InstantiationInMultipleTranslaionUnitsTest\n    : public ::testing::TestWithParam<int> {\n};\n\n#endif  // GTEST_HAS_PARAM_TEST\n\n#endif  // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_\n"
  },
  {
    "path": "Tests/gtest/test/gtest-port_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Authors: vladl@google.com (Vlad Losev), wan@google.com (Zhanyong Wan)\n//\n// This file tests the internal cross-platform support utilities.\n\n#include \"gtest/internal/gtest-port.h\"\n\n#include <stdio.h>\n\n#if GTEST_OS_MAC\n# include <time.h>\n#endif  // GTEST_OS_MAC\n\n#include <list>\n#include <utility>  // For std::pair and std::make_pair.\n#include <vector>\n\n#include \"gtest/gtest.h\"\n#include \"gtest/gtest-spi.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nusing std::make_pair;\nusing std::pair;\n\nnamespace testing {\nnamespace internal {\n\nTEST(IsXDigitTest, WorksForNarrowAscii) {\n  EXPECT_TRUE(IsXDigit('0'));\n  EXPECT_TRUE(IsXDigit('9'));\n  EXPECT_TRUE(IsXDigit('A'));\n  EXPECT_TRUE(IsXDigit('F'));\n  EXPECT_TRUE(IsXDigit('a'));\n  EXPECT_TRUE(IsXDigit('f'));\n\n  EXPECT_FALSE(IsXDigit('-'));\n  EXPECT_FALSE(IsXDigit('g'));\n  EXPECT_FALSE(IsXDigit('G'));\n}\n\nTEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {\n  EXPECT_FALSE(IsXDigit(static_cast<char>(0x80)));\n  EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80)));\n}\n\nTEST(IsXDigitTest, WorksForWideAscii) {\n  EXPECT_TRUE(IsXDigit(L'0'));\n  EXPECT_TRUE(IsXDigit(L'9'));\n  EXPECT_TRUE(IsXDigit(L'A'));\n  EXPECT_TRUE(IsXDigit(L'F'));\n  EXPECT_TRUE(IsXDigit(L'a'));\n  EXPECT_TRUE(IsXDigit(L'f'));\n\n  EXPECT_FALSE(IsXDigit(L'-'));\n  EXPECT_FALSE(IsXDigit(L'g'));\n  EXPECT_FALSE(IsXDigit(L'G'));\n}\n\nTEST(IsXDigitTest, ReturnsFalseForWideNonAscii) {\n  EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80)));\n  EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80)));\n  EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100)));\n}\n\nclass Base {\n public:\n  // Copy constructor and assignment operator do exactly what we need, so we\n  // use them.\n  Base() : member_(0) {}\n  explicit Base(int n) : member_(n) {}\n  virtual ~Base() {}\n  int member() { return member_; }\n\n private:\n  int member_;\n};\n\nclass Derived : public Base {\n public:\n  explicit Derived(int n) : Base(n) {}\n};\n\nTEST(ImplicitCastTest, ConvertsPointers) {\n  Derived derived(0);\n  EXPECT_TRUE(&derived == ::testing::internal::ImplicitCast_<Base*>(&derived));\n}\n\nTEST(ImplicitCastTest, CanUseInheritance) {\n  Derived derived(1);\n  Base base = ::testing::internal::ImplicitCast_<Base>(derived);\n  EXPECT_EQ(derived.member(), base.member());\n}\n\nclass Castable {\n public:\n  explicit Castable(bool* converted) : converted_(converted) {}\n  operator Base() {\n    *converted_ = true;\n    return Base();\n  }\n\n private:\n  bool* converted_;\n};\n\nTEST(ImplicitCastTest, CanUseNonConstCastOperator) {\n  bool converted = false;\n  Castable castable(&converted);\n  Base base = ::testing::internal::ImplicitCast_<Base>(castable);\n  EXPECT_TRUE(converted);\n}\n\nclass ConstCastable {\n public:\n  explicit ConstCastable(bool* converted) : converted_(converted) {}\n  operator Base() const {\n    *converted_ = true;\n    return Base();\n  }\n\n private:\n  bool* converted_;\n};\n\nTEST(ImplicitCastTest, CanUseConstCastOperatorOnConstValues) {\n  bool converted = false;\n  const ConstCastable const_castable(&converted);\n  Base base = ::testing::internal::ImplicitCast_<Base>(const_castable);\n  EXPECT_TRUE(converted);\n}\n\nclass ConstAndNonConstCastable {\n public:\n  ConstAndNonConstCastable(bool* converted, bool* const_converted)\n      : converted_(converted), const_converted_(const_converted) {}\n  operator Base() {\n    *converted_ = true;\n    return Base();\n  }\n  operator Base() const {\n    *const_converted_ = true;\n    return Base();\n  }\n\n private:\n  bool* converted_;\n  bool* const_converted_;\n};\n\nTEST(ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropriately) {\n  bool converted = false;\n  bool const_converted = false;\n  ConstAndNonConstCastable castable(&converted, &const_converted);\n  Base base = ::testing::internal::ImplicitCast_<Base>(castable);\n  EXPECT_TRUE(converted);\n  EXPECT_FALSE(const_converted);\n\n  converted = false;\n  const_converted = false;\n  const ConstAndNonConstCastable const_castable(&converted, &const_converted);\n  base = ::testing::internal::ImplicitCast_<Base>(const_castable);\n  EXPECT_FALSE(converted);\n  EXPECT_TRUE(const_converted);\n}\n\nclass To {\n public:\n  To(bool* converted) { *converted = true; }  // NOLINT\n};\n\nTEST(ImplicitCastTest, CanUseImplicitConstructor) {\n  bool converted = false;\n  To to = ::testing::internal::ImplicitCast_<To>(&converted);\n  (void)to;\n  EXPECT_TRUE(converted);\n}\n\nTEST(IteratorTraitsTest, WorksForSTLContainerIterators) {\n  StaticAssertTypeEq<int,\n      IteratorTraits< ::std::vector<int>::const_iterator>::value_type>();\n  StaticAssertTypeEq<bool,\n      IteratorTraits< ::std::list<bool>::iterator>::value_type>();\n}\n\nTEST(IteratorTraitsTest, WorksForPointerToNonConst) {\n  StaticAssertTypeEq<char, IteratorTraits<char*>::value_type>();\n  StaticAssertTypeEq<const void*, IteratorTraits<const void**>::value_type>();\n}\n\nTEST(IteratorTraitsTest, WorksForPointerToConst) {\n  StaticAssertTypeEq<char, IteratorTraits<const char*>::value_type>();\n  StaticAssertTypeEq<const void*,\n      IteratorTraits<const void* const*>::value_type>();\n}\n\n// Tests that the element_type typedef is available in scoped_ptr and refers\n// to the parameter type.\nTEST(ScopedPtrTest, DefinesElementType) {\n  StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>();\n}\n\n// TODO(vladl@google.com): Implement THE REST of scoped_ptr tests.\n\nTEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {\n  if (AlwaysFalse())\n    GTEST_CHECK_(false) << \"This should never be executed; \"\n                           \"It's a compilation test only.\";\n\n  if (AlwaysTrue())\n    GTEST_CHECK_(true);\n  else\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    ;  // NOLINT\n  else\n    GTEST_CHECK_(true) << \"\";\n}\n\nTEST(GtestCheckSyntaxTest, WorksWithSwitch) {\n  switch (0) {\n    case 1:\n      break;\n    default:\n      GTEST_CHECK_(true);\n  }\n\n  switch (0)\n    case 0:\n      GTEST_CHECK_(true) << \"Check failed in switch case\";\n}\n\n// Verifies behavior of FormatFileLocation.\nTEST(FormatFileLocationTest, FormatsFileLocation) {\n  EXPECT_PRED_FORMAT2(IsSubstring, \"foo.cc\", FormatFileLocation(\"foo.cc\", 42));\n  EXPECT_PRED_FORMAT2(IsSubstring, \"42\", FormatFileLocation(\"foo.cc\", 42));\n}\n\nTEST(FormatFileLocationTest, FormatsUnknownFile) {\n  EXPECT_PRED_FORMAT2(\n      IsSubstring, \"unknown file\", FormatFileLocation(NULL, 42));\n  EXPECT_PRED_FORMAT2(IsSubstring, \"42\", FormatFileLocation(NULL, 42));\n}\n\nTEST(FormatFileLocationTest, FormatsUknownLine) {\n  EXPECT_EQ(\"foo.cc:\", FormatFileLocation(\"foo.cc\", -1));\n}\n\nTEST(FormatFileLocationTest, FormatsUknownFileAndLine) {\n  EXPECT_EQ(\"unknown file:\", FormatFileLocation(NULL, -1));\n}\n\n// Verifies behavior of FormatCompilerIndependentFileLocation.\nTEST(FormatCompilerIndependentFileLocationTest, FormatsFileLocation) {\n  EXPECT_EQ(\"foo.cc:42\", FormatCompilerIndependentFileLocation(\"foo.cc\", 42));\n}\n\nTEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFile) {\n  EXPECT_EQ(\"unknown file:42\",\n            FormatCompilerIndependentFileLocation(NULL, 42));\n}\n\nTEST(FormatCompilerIndependentFileLocationTest, FormatsUknownLine) {\n  EXPECT_EQ(\"foo.cc\", FormatCompilerIndependentFileLocation(\"foo.cc\", -1));\n}\n\nTEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) {\n  EXPECT_EQ(\"unknown file\", FormatCompilerIndependentFileLocation(NULL, -1));\n}\n\n#if GTEST_OS_MAC || GTEST_OS_QNX\nvoid* ThreadFunc(void* data) {\n  pthread_mutex_t* mutex = static_cast<pthread_mutex_t*>(data);\n  pthread_mutex_lock(mutex);\n  pthread_mutex_unlock(mutex);\n  return NULL;\n}\n\nTEST(GetThreadCountTest, ReturnsCorrectValue) {\n  EXPECT_EQ(1U, GetThreadCount());\n  pthread_mutex_t mutex;\n  pthread_attr_t  attr;\n  pthread_t       thread_id;\n\n  // TODO(vladl@google.com): turn mutex into internal::Mutex for automatic\n  // destruction.\n  pthread_mutex_init(&mutex, NULL);\n  pthread_mutex_lock(&mutex);\n  ASSERT_EQ(0, pthread_attr_init(&attr));\n  ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));\n\n  const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex);\n  ASSERT_EQ(0, pthread_attr_destroy(&attr));\n  ASSERT_EQ(0, status);\n  EXPECT_EQ(2U, GetThreadCount());\n  pthread_mutex_unlock(&mutex);\n\n  void* dummy;\n  ASSERT_EQ(0, pthread_join(thread_id, &dummy));\n\n# if GTEST_OS_MAC\n\n  // MacOS X may not immediately report the updated thread count after\n  // joining a thread, causing flakiness in this test. To counter that, we\n  // wait for up to .5 seconds for the OS to report the correct value.\n  for (int i = 0; i < 5; ++i) {\n    if (GetThreadCount() == 1)\n      break;\n\n    SleepMilliseconds(100);\n  }\n\n# endif  // GTEST_OS_MAC\n\n  EXPECT_EQ(1U, GetThreadCount());\n  pthread_mutex_destroy(&mutex);\n}\n#else\nTEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) {\n  EXPECT_EQ(0U, GetThreadCount());\n}\n#endif  // GTEST_OS_MAC || GTEST_OS_QNX\n\nTEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {\n  const bool a_false_condition = false;\n  const char regex[] =\n#ifdef _MSC_VER\n     \"gtest-port_test\\\\.cc\\\\(\\\\d+\\\\):\"\n#elif GTEST_USES_POSIX_RE\n     \"gtest-port_test\\\\.cc:[0-9]+\"\n#else\n     \"gtest-port_test\\\\.cc:\\\\d+\"\n#endif  // _MSC_VER\n     \".*a_false_condition.*Extra info.*\";\n\n  EXPECT_DEATH_IF_SUPPORTED(GTEST_CHECK_(a_false_condition) << \"Extra info\",\n                            regex);\n}\n\n#if GTEST_HAS_DEATH_TEST\n\nTEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {\n  EXPECT_EXIT({\n      GTEST_CHECK_(true) << \"Extra info\";\n      ::std::cerr << \"Success\\n\";\n      exit(0); },\n      ::testing::ExitedWithCode(0), \"Success\");\n}\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Verifies that Google Test choose regular expression engine appropriate to\n// the platform. The test will produce compiler errors in case of failure.\n// For simplicity, we only cover the most important platforms here.\nTEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {\n#if GTEST_HAS_POSIX_RE\n\n  EXPECT_TRUE(GTEST_USES_POSIX_RE);\n\n#else\n\n  EXPECT_TRUE(GTEST_USES_SIMPLE_RE);\n\n#endif\n}\n\n#if GTEST_USES_POSIX_RE\n\n# if GTEST_HAS_TYPED_TEST\n\ntemplate <typename Str>\nclass RETest : public ::testing::Test {};\n\n// Defines StringTypes as the list of all string types that class RE\n// supports.\ntypedef testing::Types<\n    ::std::string,\n#  if GTEST_HAS_GLOBAL_STRING\n    ::string,\n#  endif  // GTEST_HAS_GLOBAL_STRING\n    const char*> StringTypes;\n\nTYPED_TEST_CASE(RETest, StringTypes);\n\n// Tests RE's implicit constructors.\nTYPED_TEST(RETest, ImplicitConstructorWorks) {\n  const RE empty(TypeParam(\"\"));\n  EXPECT_STREQ(\"\", empty.pattern());\n\n  const RE simple(TypeParam(\"hello\"));\n  EXPECT_STREQ(\"hello\", simple.pattern());\n\n  const RE normal(TypeParam(\".*(\\\\w+)\"));\n  EXPECT_STREQ(\".*(\\\\w+)\", normal.pattern());\n}\n\n// Tests that RE's constructors reject invalid regular expressions.\nTYPED_TEST(RETest, RejectsInvalidRegex) {\n  EXPECT_NONFATAL_FAILURE({\n    const RE invalid(TypeParam(\"?\"));\n  }, \"\\\"?\\\" is not a valid POSIX Extended regular expression.\");\n}\n\n// Tests RE::FullMatch().\nTYPED_TEST(RETest, FullMatchWorks) {\n  const RE empty(TypeParam(\"\"));\n  EXPECT_TRUE(RE::FullMatch(TypeParam(\"\"), empty));\n  EXPECT_FALSE(RE::FullMatch(TypeParam(\"a\"), empty));\n\n  const RE re(TypeParam(\"a.*z\"));\n  EXPECT_TRUE(RE::FullMatch(TypeParam(\"az\"), re));\n  EXPECT_TRUE(RE::FullMatch(TypeParam(\"axyz\"), re));\n  EXPECT_FALSE(RE::FullMatch(TypeParam(\"baz\"), re));\n  EXPECT_FALSE(RE::FullMatch(TypeParam(\"azy\"), re));\n}\n\n// Tests RE::PartialMatch().\nTYPED_TEST(RETest, PartialMatchWorks) {\n  const RE empty(TypeParam(\"\"));\n  EXPECT_TRUE(RE::PartialMatch(TypeParam(\"\"), empty));\n  EXPECT_TRUE(RE::PartialMatch(TypeParam(\"a\"), empty));\n\n  const RE re(TypeParam(\"a.*z\"));\n  EXPECT_TRUE(RE::PartialMatch(TypeParam(\"az\"), re));\n  EXPECT_TRUE(RE::PartialMatch(TypeParam(\"axyz\"), re));\n  EXPECT_TRUE(RE::PartialMatch(TypeParam(\"baz\"), re));\n  EXPECT_TRUE(RE::PartialMatch(TypeParam(\"azy\"), re));\n  EXPECT_FALSE(RE::PartialMatch(TypeParam(\"zza\"), re));\n}\n\n# endif  // GTEST_HAS_TYPED_TEST\n\n#elif GTEST_USES_SIMPLE_RE\n\nTEST(IsInSetTest, NulCharIsNotInAnySet) {\n  EXPECT_FALSE(IsInSet('\\0', \"\"));\n  EXPECT_FALSE(IsInSet('\\0', \"\\0\"));\n  EXPECT_FALSE(IsInSet('\\0', \"a\"));\n}\n\nTEST(IsInSetTest, WorksForNonNulChars) {\n  EXPECT_FALSE(IsInSet('a', \"Ab\"));\n  EXPECT_FALSE(IsInSet('c', \"\"));\n\n  EXPECT_TRUE(IsInSet('b', \"bcd\"));\n  EXPECT_TRUE(IsInSet('b', \"ab\"));\n}\n\nTEST(IsAsciiDigitTest, IsFalseForNonDigit) {\n  EXPECT_FALSE(IsAsciiDigit('\\0'));\n  EXPECT_FALSE(IsAsciiDigit(' '));\n  EXPECT_FALSE(IsAsciiDigit('+'));\n  EXPECT_FALSE(IsAsciiDigit('-'));\n  EXPECT_FALSE(IsAsciiDigit('.'));\n  EXPECT_FALSE(IsAsciiDigit('a'));\n}\n\nTEST(IsAsciiDigitTest, IsTrueForDigit) {\n  EXPECT_TRUE(IsAsciiDigit('0'));\n  EXPECT_TRUE(IsAsciiDigit('1'));\n  EXPECT_TRUE(IsAsciiDigit('5'));\n  EXPECT_TRUE(IsAsciiDigit('9'));\n}\n\nTEST(IsAsciiPunctTest, IsFalseForNonPunct) {\n  EXPECT_FALSE(IsAsciiPunct('\\0'));\n  EXPECT_FALSE(IsAsciiPunct(' '));\n  EXPECT_FALSE(IsAsciiPunct('\\n'));\n  EXPECT_FALSE(IsAsciiPunct('a'));\n  EXPECT_FALSE(IsAsciiPunct('0'));\n}\n\nTEST(IsAsciiPunctTest, IsTrueForPunct) {\n  for (const char* p = \"^-!\\\"#$%&'()*+,./:;<=>?@[\\\\]_`{|}~\"; *p; p++) {\n    EXPECT_PRED1(IsAsciiPunct, *p);\n  }\n}\n\nTEST(IsRepeatTest, IsFalseForNonRepeatChar) {\n  EXPECT_FALSE(IsRepeat('\\0'));\n  EXPECT_FALSE(IsRepeat(' '));\n  EXPECT_FALSE(IsRepeat('a'));\n  EXPECT_FALSE(IsRepeat('1'));\n  EXPECT_FALSE(IsRepeat('-'));\n}\n\nTEST(IsRepeatTest, IsTrueForRepeatChar) {\n  EXPECT_TRUE(IsRepeat('?'));\n  EXPECT_TRUE(IsRepeat('*'));\n  EXPECT_TRUE(IsRepeat('+'));\n}\n\nTEST(IsAsciiWhiteSpaceTest, IsFalseForNonWhiteSpace) {\n  EXPECT_FALSE(IsAsciiWhiteSpace('\\0'));\n  EXPECT_FALSE(IsAsciiWhiteSpace('a'));\n  EXPECT_FALSE(IsAsciiWhiteSpace('1'));\n  EXPECT_FALSE(IsAsciiWhiteSpace('+'));\n  EXPECT_FALSE(IsAsciiWhiteSpace('_'));\n}\n\nTEST(IsAsciiWhiteSpaceTest, IsTrueForWhiteSpace) {\n  EXPECT_TRUE(IsAsciiWhiteSpace(' '));\n  EXPECT_TRUE(IsAsciiWhiteSpace('\\n'));\n  EXPECT_TRUE(IsAsciiWhiteSpace('\\r'));\n  EXPECT_TRUE(IsAsciiWhiteSpace('\\t'));\n  EXPECT_TRUE(IsAsciiWhiteSpace('\\v'));\n  EXPECT_TRUE(IsAsciiWhiteSpace('\\f'));\n}\n\nTEST(IsAsciiWordCharTest, IsFalseForNonWordChar) {\n  EXPECT_FALSE(IsAsciiWordChar('\\0'));\n  EXPECT_FALSE(IsAsciiWordChar('+'));\n  EXPECT_FALSE(IsAsciiWordChar('.'));\n  EXPECT_FALSE(IsAsciiWordChar(' '));\n  EXPECT_FALSE(IsAsciiWordChar('\\n'));\n}\n\nTEST(IsAsciiWordCharTest, IsTrueForLetter) {\n  EXPECT_TRUE(IsAsciiWordChar('a'));\n  EXPECT_TRUE(IsAsciiWordChar('b'));\n  EXPECT_TRUE(IsAsciiWordChar('A'));\n  EXPECT_TRUE(IsAsciiWordChar('Z'));\n}\n\nTEST(IsAsciiWordCharTest, IsTrueForDigit) {\n  EXPECT_TRUE(IsAsciiWordChar('0'));\n  EXPECT_TRUE(IsAsciiWordChar('1'));\n  EXPECT_TRUE(IsAsciiWordChar('7'));\n  EXPECT_TRUE(IsAsciiWordChar('9'));\n}\n\nTEST(IsAsciiWordCharTest, IsTrueForUnderscore) {\n  EXPECT_TRUE(IsAsciiWordChar('_'));\n}\n\nTEST(IsValidEscapeTest, IsFalseForNonPrintable) {\n  EXPECT_FALSE(IsValidEscape('\\0'));\n  EXPECT_FALSE(IsValidEscape('\\007'));\n}\n\nTEST(IsValidEscapeTest, IsFalseForDigit) {\n  EXPECT_FALSE(IsValidEscape('0'));\n  EXPECT_FALSE(IsValidEscape('9'));\n}\n\nTEST(IsValidEscapeTest, IsFalseForWhiteSpace) {\n  EXPECT_FALSE(IsValidEscape(' '));\n  EXPECT_FALSE(IsValidEscape('\\n'));\n}\n\nTEST(IsValidEscapeTest, IsFalseForSomeLetter) {\n  EXPECT_FALSE(IsValidEscape('a'));\n  EXPECT_FALSE(IsValidEscape('Z'));\n}\n\nTEST(IsValidEscapeTest, IsTrueForPunct) {\n  EXPECT_TRUE(IsValidEscape('.'));\n  EXPECT_TRUE(IsValidEscape('-'));\n  EXPECT_TRUE(IsValidEscape('^'));\n  EXPECT_TRUE(IsValidEscape('$'));\n  EXPECT_TRUE(IsValidEscape('('));\n  EXPECT_TRUE(IsValidEscape(']'));\n  EXPECT_TRUE(IsValidEscape('{'));\n  EXPECT_TRUE(IsValidEscape('|'));\n}\n\nTEST(IsValidEscapeTest, IsTrueForSomeLetter) {\n  EXPECT_TRUE(IsValidEscape('d'));\n  EXPECT_TRUE(IsValidEscape('D'));\n  EXPECT_TRUE(IsValidEscape('s'));\n  EXPECT_TRUE(IsValidEscape('S'));\n  EXPECT_TRUE(IsValidEscape('w'));\n  EXPECT_TRUE(IsValidEscape('W'));\n}\n\nTEST(AtomMatchesCharTest, EscapedPunct) {\n  EXPECT_FALSE(AtomMatchesChar(true, '\\\\', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, '\\\\', ' '));\n  EXPECT_FALSE(AtomMatchesChar(true, '_', '.'));\n  EXPECT_FALSE(AtomMatchesChar(true, '.', 'a'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, '\\\\', '\\\\'));\n  EXPECT_TRUE(AtomMatchesChar(true, '_', '_'));\n  EXPECT_TRUE(AtomMatchesChar(true, '+', '+'));\n  EXPECT_TRUE(AtomMatchesChar(true, '.', '.'));\n}\n\nTEST(AtomMatchesCharTest, Escaped_d) {\n  EXPECT_FALSE(AtomMatchesChar(true, 'd', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'd', 'a'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'd', '.'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 'd', '0'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'd', '9'));\n}\n\nTEST(AtomMatchesCharTest, Escaped_D) {\n  EXPECT_FALSE(AtomMatchesChar(true, 'D', '0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'D', '9'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 'D', '\\0'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'D', 'a'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'D', '-'));\n}\n\nTEST(AtomMatchesCharTest, Escaped_s) {\n  EXPECT_FALSE(AtomMatchesChar(true, 's', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 's', 'a'));\n  EXPECT_FALSE(AtomMatchesChar(true, 's', '.'));\n  EXPECT_FALSE(AtomMatchesChar(true, 's', '9'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 's', ' '));\n  EXPECT_TRUE(AtomMatchesChar(true, 's', '\\n'));\n  EXPECT_TRUE(AtomMatchesChar(true, 's', '\\t'));\n}\n\nTEST(AtomMatchesCharTest, Escaped_S) {\n  EXPECT_FALSE(AtomMatchesChar(true, 'S', ' '));\n  EXPECT_FALSE(AtomMatchesChar(true, 'S', '\\r'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 'S', '\\0'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'S', 'a'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'S', '9'));\n}\n\nTEST(AtomMatchesCharTest, Escaped_w) {\n  EXPECT_FALSE(AtomMatchesChar(true, 'w', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'w', '+'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'w', ' '));\n  EXPECT_FALSE(AtomMatchesChar(true, 'w', '\\n'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 'w', '0'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'w', 'b'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'w', 'C'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'w', '_'));\n}\n\nTEST(AtomMatchesCharTest, Escaped_W) {\n  EXPECT_FALSE(AtomMatchesChar(true, 'W', 'A'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'W', 'b'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'W', '9'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'W', '_'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 'W', '\\0'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'W', '*'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'W', '\\n'));\n}\n\nTEST(AtomMatchesCharTest, EscapedWhiteSpace) {\n  EXPECT_FALSE(AtomMatchesChar(true, 'f', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'f', '\\n'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'n', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'n', '\\r'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'r', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'r', 'a'));\n  EXPECT_FALSE(AtomMatchesChar(true, 't', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 't', 't'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'v', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(true, 'v', '\\f'));\n\n  EXPECT_TRUE(AtomMatchesChar(true, 'f', '\\f'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'n', '\\n'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'r', '\\r'));\n  EXPECT_TRUE(AtomMatchesChar(true, 't', '\\t'));\n  EXPECT_TRUE(AtomMatchesChar(true, 'v', '\\v'));\n}\n\nTEST(AtomMatchesCharTest, UnescapedDot) {\n  EXPECT_FALSE(AtomMatchesChar(false, '.', '\\n'));\n\n  EXPECT_TRUE(AtomMatchesChar(false, '.', '\\0'));\n  EXPECT_TRUE(AtomMatchesChar(false, '.', '.'));\n  EXPECT_TRUE(AtomMatchesChar(false, '.', 'a'));\n  EXPECT_TRUE(AtomMatchesChar(false, '.', ' '));\n}\n\nTEST(AtomMatchesCharTest, UnescapedChar) {\n  EXPECT_FALSE(AtomMatchesChar(false, 'a', '\\0'));\n  EXPECT_FALSE(AtomMatchesChar(false, 'a', 'b'));\n  EXPECT_FALSE(AtomMatchesChar(false, '$', 'a'));\n\n  EXPECT_TRUE(AtomMatchesChar(false, '$', '$'));\n  EXPECT_TRUE(AtomMatchesChar(false, '5', '5'));\n  EXPECT_TRUE(AtomMatchesChar(false, 'Z', 'Z'));\n}\n\nTEST(ValidateRegexTest, GeneratesFailureAndReturnsFalseForInvalid) {\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(NULL)),\n                          \"NULL is not a valid simple regular expression\");\n  EXPECT_NONFATAL_FAILURE(\n      ASSERT_FALSE(ValidateRegex(\"a\\\\\")),\n      \"Syntax error at index 1 in simple regular expression \\\"a\\\\\\\": \");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"a\\\\\")),\n                          \"'\\\\' cannot appear at the end\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"\\\\n\\\\\")),\n                          \"'\\\\' cannot appear at the end\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"\\\\s\\\\hb\")),\n                          \"invalid escape sequence \\\"\\\\h\\\"\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"^^\")),\n                          \"'^' can only appear at the beginning\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\".*^b\")),\n                          \"'^' can only appear at the beginning\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"$$\")),\n                          \"'$' can only appear at the end\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"^$a\")),\n                          \"'$' can only appear at the end\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"a(b\")),\n                          \"'(' is unsupported\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"ab)\")),\n                          \"')' is unsupported\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"[ab\")),\n                          \"'[' is unsupported\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"a{2\")),\n                          \"'{' is unsupported\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"?\")),\n                          \"'?' can only follow a repeatable token\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"^*\")),\n                          \"'*' can only follow a repeatable token\");\n  EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(\"5*+\")),\n                          \"'+' can only follow a repeatable token\");\n}\n\nTEST(ValidateRegexTest, ReturnsTrueForValid) {\n  EXPECT_TRUE(ValidateRegex(\"\"));\n  EXPECT_TRUE(ValidateRegex(\"a\"));\n  EXPECT_TRUE(ValidateRegex(\".*\"));\n  EXPECT_TRUE(ValidateRegex(\"^a_+\"));\n  EXPECT_TRUE(ValidateRegex(\"^a\\\\t\\\\&?\"));\n  EXPECT_TRUE(ValidateRegex(\"09*$\"));\n  EXPECT_TRUE(ValidateRegex(\"^Z$\"));\n  EXPECT_TRUE(ValidateRegex(\"a\\\\^Z\\\\$\\\\(\\\\)\\\\|\\\\[\\\\]\\\\{\\\\}\"));\n}\n\nTEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrOne) {\n  EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', \"a\", \"ba\"));\n  // Repeating more than once.\n  EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', \"b\", \"aab\"));\n\n  // Repeating zero times.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', \"b\", \"ba\"));\n  // Repeating once.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', \"b\", \"ab\"));\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '#', '?', \".\", \"##\"));\n}\n\nTEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrMany) {\n  EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '*', \"a$\", \"baab\"));\n\n  // Repeating zero times.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', \"b\", \"bc\"));\n  // Repeating once.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', \"b\", \"abc\"));\n  // Repeating more than once.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '*', \"-\", \"ab_1-g\"));\n}\n\nTEST(MatchRepetitionAndRegexAtHeadTest, WorksForOneOrMany) {\n  EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', \"a$\", \"baab\"));\n  // Repeating zero times.\n  EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', \"b\", \"bc\"));\n\n  // Repeating once.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '+', \"b\", \"abc\"));\n  // Repeating more than once.\n  EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '+', \"-\", \"ab_1-g\"));\n}\n\nTEST(MatchRegexAtHeadTest, ReturnsTrueForEmptyRegex) {\n  EXPECT_TRUE(MatchRegexAtHead(\"\", \"\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"\", \"ab\"));\n}\n\nTEST(MatchRegexAtHeadTest, WorksWhenDollarIsInRegex) {\n  EXPECT_FALSE(MatchRegexAtHead(\"$\", \"a\"));\n\n  EXPECT_TRUE(MatchRegexAtHead(\"$\", \"\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"a$\", \"a\"));\n}\n\nTEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithEscapeSequence) {\n  EXPECT_FALSE(MatchRegexAtHead(\"\\\\w\", \"+\"));\n  EXPECT_FALSE(MatchRegexAtHead(\"\\\\W\", \"ab\"));\n\n  EXPECT_TRUE(MatchRegexAtHead(\"\\\\sa\", \"\\nab\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"\\\\d\", \"1a\"));\n}\n\nTEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithRepetition) {\n  EXPECT_FALSE(MatchRegexAtHead(\".+a\", \"abc\"));\n  EXPECT_FALSE(MatchRegexAtHead(\"a?b\", \"aab\"));\n\n  EXPECT_TRUE(MatchRegexAtHead(\".*a\", \"bc12-ab\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"a?b\", \"b\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"a?b\", \"ab\"));\n}\n\nTEST(MatchRegexAtHeadTest,\n     WorksWhenRegexStartsWithRepetionOfEscapeSequence) {\n  EXPECT_FALSE(MatchRegexAtHead(\"\\\\.+a\", \"abc\"));\n  EXPECT_FALSE(MatchRegexAtHead(\"\\\\s?b\", \"  b\"));\n\n  EXPECT_TRUE(MatchRegexAtHead(\"\\\\(*a\", \"((((ab\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"\\\\^?b\", \"^b\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"\\\\\\\\?b\", \"b\"));\n  EXPECT_TRUE(MatchRegexAtHead(\"\\\\\\\\?b\", \"\\\\b\"));\n}\n\nTEST(MatchRegexAtHeadTest, MatchesSequentially) {\n  EXPECT_FALSE(MatchRegexAtHead(\"ab.*c\", \"acabc\"));\n\n  EXPECT_TRUE(MatchRegexAtHead(\"ab.*c\", \"ab-fsc\"));\n}\n\nTEST(MatchRegexAnywhereTest, ReturnsFalseWhenStringIsNull) {\n  EXPECT_FALSE(MatchRegexAnywhere(\"\", NULL));\n}\n\nTEST(MatchRegexAnywhereTest, WorksWhenRegexStartsWithCaret) {\n  EXPECT_FALSE(MatchRegexAnywhere(\"^a\", \"ba\"));\n  EXPECT_FALSE(MatchRegexAnywhere(\"^$\", \"a\"));\n\n  EXPECT_TRUE(MatchRegexAnywhere(\"^a\", \"ab\"));\n  EXPECT_TRUE(MatchRegexAnywhere(\"^\", \"ab\"));\n  EXPECT_TRUE(MatchRegexAnywhere(\"^$\", \"\"));\n}\n\nTEST(MatchRegexAnywhereTest, ReturnsFalseWhenNoMatch) {\n  EXPECT_FALSE(MatchRegexAnywhere(\"a\", \"bcde123\"));\n  EXPECT_FALSE(MatchRegexAnywhere(\"a.+a\", \"--aa88888888\"));\n}\n\nTEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingPrefix) {\n  EXPECT_TRUE(MatchRegexAnywhere(\"\\\\w+\", \"ab1_ - 5\"));\n  EXPECT_TRUE(MatchRegexAnywhere(\".*=\", \"=\"));\n  EXPECT_TRUE(MatchRegexAnywhere(\"x.*ab?.*bc\", \"xaaabc\"));\n}\n\nTEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingNonPrefix) {\n  EXPECT_TRUE(MatchRegexAnywhere(\"\\\\w+\", \"$$$ ab1_ - 5\"));\n  EXPECT_TRUE(MatchRegexAnywhere(\"\\\\.+=\", \"=  ...=\"));\n}\n\n// Tests RE's implicit constructors.\nTEST(RETest, ImplicitConstructorWorks) {\n  const RE empty(\"\");\n  EXPECT_STREQ(\"\", empty.pattern());\n\n  const RE simple(\"hello\");\n  EXPECT_STREQ(\"hello\", simple.pattern());\n}\n\n// Tests that RE's constructors reject invalid regular expressions.\nTEST(RETest, RejectsInvalidRegex) {\n  EXPECT_NONFATAL_FAILURE({\n    const RE normal(NULL);\n  }, \"NULL is not a valid simple regular expression\");\n\n  EXPECT_NONFATAL_FAILURE({\n    const RE normal(\".*(\\\\w+\");\n  }, \"'(' is unsupported\");\n\n  EXPECT_NONFATAL_FAILURE({\n    const RE invalid(\"^?\");\n  }, \"'?' can only follow a repeatable token\");\n}\n\n// Tests RE::FullMatch().\nTEST(RETest, FullMatchWorks) {\n  const RE empty(\"\");\n  EXPECT_TRUE(RE::FullMatch(\"\", empty));\n  EXPECT_FALSE(RE::FullMatch(\"a\", empty));\n\n  const RE re1(\"a\");\n  EXPECT_TRUE(RE::FullMatch(\"a\", re1));\n\n  const RE re(\"a.*z\");\n  EXPECT_TRUE(RE::FullMatch(\"az\", re));\n  EXPECT_TRUE(RE::FullMatch(\"axyz\", re));\n  EXPECT_FALSE(RE::FullMatch(\"baz\", re));\n  EXPECT_FALSE(RE::FullMatch(\"azy\", re));\n}\n\n// Tests RE::PartialMatch().\nTEST(RETest, PartialMatchWorks) {\n  const RE empty(\"\");\n  EXPECT_TRUE(RE::PartialMatch(\"\", empty));\n  EXPECT_TRUE(RE::PartialMatch(\"a\", empty));\n\n  const RE re(\"a.*z\");\n  EXPECT_TRUE(RE::PartialMatch(\"az\", re));\n  EXPECT_TRUE(RE::PartialMatch(\"axyz\", re));\n  EXPECT_TRUE(RE::PartialMatch(\"baz\", re));\n  EXPECT_TRUE(RE::PartialMatch(\"azy\", re));\n  EXPECT_FALSE(RE::PartialMatch(\"zza\", re));\n}\n\n#endif  // GTEST_USES_POSIX_RE\n\n#if !GTEST_OS_WINDOWS_MOBILE\n\nTEST(CaptureTest, CapturesStdout) {\n  CaptureStdout();\n  fprintf(stdout, \"abc\");\n  EXPECT_STREQ(\"abc\", GetCapturedStdout().c_str());\n\n  CaptureStdout();\n  fprintf(stdout, \"def%cghi\", '\\0');\n  EXPECT_EQ(::std::string(\"def\\0ghi\", 7), ::std::string(GetCapturedStdout()));\n}\n\nTEST(CaptureTest, CapturesStderr) {\n  CaptureStderr();\n  fprintf(stderr, \"jkl\");\n  EXPECT_STREQ(\"jkl\", GetCapturedStderr().c_str());\n\n  CaptureStderr();\n  fprintf(stderr, \"jkl%cmno\", '\\0');\n  EXPECT_EQ(::std::string(\"jkl\\0mno\", 7), ::std::string(GetCapturedStderr()));\n}\n\n// Tests that stdout and stderr capture don't interfere with each other.\nTEST(CaptureTest, CapturesStdoutAndStderr) {\n  CaptureStdout();\n  CaptureStderr();\n  fprintf(stdout, \"pqr\");\n  fprintf(stderr, \"stu\");\n  EXPECT_STREQ(\"pqr\", GetCapturedStdout().c_str());\n  EXPECT_STREQ(\"stu\", GetCapturedStderr().c_str());\n}\n\nTEST(CaptureDeathTest, CannotReenterStdoutCapture) {\n  CaptureStdout();\n  EXPECT_DEATH_IF_SUPPORTED(CaptureStdout(),\n                            \"Only one stdout capturer can exist at a time\");\n  GetCapturedStdout();\n\n  // We cannot test stderr capturing using death tests as they use it\n  // themselves.\n}\n\n#endif  // !GTEST_OS_WINDOWS_MOBILE\n\nTEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {\n  ThreadLocal<int> t1;\n  EXPECT_EQ(0, t1.get());\n\n  ThreadLocal<void*> t2;\n  EXPECT_TRUE(t2.get() == NULL);\n}\n\nTEST(ThreadLocalTest, SingleParamConstructorInitializesToParam) {\n  ThreadLocal<int> t1(123);\n  EXPECT_EQ(123, t1.get());\n\n  int i = 0;\n  ThreadLocal<int*> t2(&i);\n  EXPECT_EQ(&i, t2.get());\n}\n\nclass NoDefaultContructor {\n public:\n  explicit NoDefaultContructor(const char*) {}\n  NoDefaultContructor(const NoDefaultContructor&) {}\n};\n\nTEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) {\n  ThreadLocal<NoDefaultContructor> bar(NoDefaultContructor(\"foo\"));\n  bar.pointer();\n}\n\nTEST(ThreadLocalTest, GetAndPointerReturnSameValue) {\n  ThreadLocal<std::string> thread_local_string;\n\n  EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));\n\n  // Verifies the condition still holds after calling set.\n  thread_local_string.set(\"foo\");\n  EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));\n}\n\nTEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) {\n  ThreadLocal<std::string> thread_local_string;\n  const ThreadLocal<std::string>& const_thread_local_string =\n      thread_local_string;\n\n  EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());\n\n  thread_local_string.set(\"foo\");\n  EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());\n}\n\n#if GTEST_IS_THREADSAFE\n\nvoid AddTwo(int* param) { *param += 2; }\n\nTEST(ThreadWithParamTest, ConstructorExecutesThreadFunc) {\n  int i = 40;\n  ThreadWithParam<int*> thread(&AddTwo, &i, NULL);\n  thread.Join();\n  EXPECT_EQ(42, i);\n}\n\nTEST(MutexDeathTest, AssertHeldShouldAssertWhenNotLocked) {\n  // AssertHeld() is flaky only in the presence of multiple threads accessing\n  // the lock. In this case, the test is robust.\n  EXPECT_DEATH_IF_SUPPORTED({\n    Mutex m;\n    { MutexLock lock(&m); }\n    m.AssertHeld();\n  },\n  \"thread .*hold\");\n}\n\nTEST(MutexTest, AssertHeldShouldNotAssertWhenLocked) {\n  Mutex m;\n  MutexLock lock(&m);\n  m.AssertHeld();\n}\n\nclass AtomicCounterWithMutex {\n public:\n  explicit AtomicCounterWithMutex(Mutex* mutex) :\n    value_(0), mutex_(mutex), random_(42) {}\n\n  void Increment() {\n    MutexLock lock(mutex_);\n    int temp = value_;\n    {\n      // Locking a mutex puts up a memory barrier, preventing reads and\n      // writes to value_ rearranged when observed from other threads.\n      //\n      // We cannot use Mutex and MutexLock here or rely on their memory\n      // barrier functionality as we are testing them here.\n      pthread_mutex_t memory_barrier_mutex;\n      GTEST_CHECK_POSIX_SUCCESS_(\n          pthread_mutex_init(&memory_barrier_mutex, NULL));\n      GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&memory_barrier_mutex));\n\n      SleepMilliseconds(random_.Generate(30));\n\n      GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&memory_barrier_mutex));\n      GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&memory_barrier_mutex));\n    }\n    value_ = temp + 1;\n  }\n  int value() const { return value_; }\n\n private:\n  volatile int value_;\n  Mutex* const mutex_;  // Protects value_.\n  Random       random_;\n};\n\nvoid CountingThreadFunc(pair<AtomicCounterWithMutex*, int> param) {\n  for (int i = 0; i < param.second; ++i)\n      param.first->Increment();\n}\n\n// Tests that the mutex only lets one thread at a time to lock it.\nTEST(MutexTest, OnlyOneThreadCanLockAtATime) {\n  Mutex mutex;\n  AtomicCounterWithMutex locked_counter(&mutex);\n\n  typedef ThreadWithParam<pair<AtomicCounterWithMutex*, int> > ThreadType;\n  const int kCycleCount = 20;\n  const int kThreadCount = 7;\n  scoped_ptr<ThreadType> counting_threads[kThreadCount];\n  Notification threads_can_start;\n  // Creates and runs kThreadCount threads that increment locked_counter\n  // kCycleCount times each.\n  for (int i = 0; i < kThreadCount; ++i) {\n    counting_threads[i].reset(new ThreadType(&CountingThreadFunc,\n                                             make_pair(&locked_counter,\n                                                       kCycleCount),\n                                             &threads_can_start));\n  }\n  threads_can_start.Notify();\n  for (int i = 0; i < kThreadCount; ++i)\n    counting_threads[i]->Join();\n\n  // If the mutex lets more than one thread to increment the counter at a\n  // time, they are likely to encounter a race condition and have some\n  // increments overwritten, resulting in the lower then expected counter\n  // value.\n  EXPECT_EQ(kCycleCount * kThreadCount, locked_counter.value());\n}\n\ntemplate <typename T>\nvoid RunFromThread(void (func)(T), T param) {\n  ThreadWithParam<T> thread(func, param, NULL);\n  thread.Join();\n}\n\nvoid RetrieveThreadLocalValue(\n    pair<ThreadLocal<std::string>*, std::string*> param) {\n  *param.second = param.first->get();\n}\n\nTEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) {\n  ThreadLocal<std::string> thread_local_string(\"foo\");\n  EXPECT_STREQ(\"foo\", thread_local_string.get().c_str());\n\n  thread_local_string.set(\"bar\");\n  EXPECT_STREQ(\"bar\", thread_local_string.get().c_str());\n\n  std::string result;\n  RunFromThread(&RetrieveThreadLocalValue,\n                make_pair(&thread_local_string, &result));\n  EXPECT_STREQ(\"foo\", result.c_str());\n}\n\n// DestructorTracker keeps track of whether its instances have been\n// destroyed.\nstatic std::vector<bool> g_destroyed;\n\nclass DestructorTracker {\n public:\n  DestructorTracker() : index_(GetNewIndex()) {}\n  DestructorTracker(const DestructorTracker& /* rhs */)\n      : index_(GetNewIndex()) {}\n  ~DestructorTracker() {\n    // We never access g_destroyed concurrently, so we don't need to\n    // protect the write operation under a mutex.\n    g_destroyed[index_] = true;\n  }\n\n private:\n  static int GetNewIndex() {\n    g_destroyed.push_back(false);\n    return g_destroyed.size() - 1;\n  }\n  const int index_;\n};\n\ntypedef ThreadLocal<DestructorTracker>* ThreadParam;\n\nvoid CallThreadLocalGet(ThreadParam thread_local_param) {\n  thread_local_param->get();\n}\n\n// Tests that when a ThreadLocal object dies in a thread, it destroys\n// the managed object for that thread.\nTEST(ThreadLocalTest, DestroysManagedObjectForOwnThreadWhenDying) {\n  g_destroyed.clear();\n\n  {\n    // The next line default constructs a DestructorTracker object as\n    // the default value of objects managed by thread_local_tracker.\n    ThreadLocal<DestructorTracker> thread_local_tracker;\n    ASSERT_EQ(1U, g_destroyed.size());\n    ASSERT_FALSE(g_destroyed[0]);\n\n    // This creates another DestructorTracker object for the main thread.\n    thread_local_tracker.get();\n    ASSERT_EQ(2U, g_destroyed.size());\n    ASSERT_FALSE(g_destroyed[0]);\n    ASSERT_FALSE(g_destroyed[1]);\n  }\n\n  // Now thread_local_tracker has died.  It should have destroyed both the\n  // default value shared by all threads and the value for the main\n  // thread.\n  ASSERT_EQ(2U, g_destroyed.size());\n  EXPECT_TRUE(g_destroyed[0]);\n  EXPECT_TRUE(g_destroyed[1]);\n\n  g_destroyed.clear();\n}\n\n// Tests that when a thread exits, the thread-local object for that\n// thread is destroyed.\nTEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {\n  g_destroyed.clear();\n\n  {\n    // The next line default constructs a DestructorTracker object as\n    // the default value of objects managed by thread_local_tracker.\n    ThreadLocal<DestructorTracker> thread_local_tracker;\n    ASSERT_EQ(1U, g_destroyed.size());\n    ASSERT_FALSE(g_destroyed[0]);\n\n    // This creates another DestructorTracker object in the new thread.\n    ThreadWithParam<ThreadParam> thread(\n        &CallThreadLocalGet, &thread_local_tracker, NULL);\n    thread.Join();\n\n    // Now the new thread has exited.  The per-thread object for it\n    // should have been destroyed.\n    ASSERT_EQ(2U, g_destroyed.size());\n    ASSERT_FALSE(g_destroyed[0]);\n    ASSERT_TRUE(g_destroyed[1]);\n  }\n\n  // Now thread_local_tracker has died.  The default value should have been\n  // destroyed too.\n  ASSERT_EQ(2U, g_destroyed.size());\n  EXPECT_TRUE(g_destroyed[0]);\n  EXPECT_TRUE(g_destroyed[1]);\n\n  g_destroyed.clear();\n}\n\nTEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) {\n  ThreadLocal<std::string> thread_local_string;\n  thread_local_string.set(\"Foo\");\n  EXPECT_STREQ(\"Foo\", thread_local_string.get().c_str());\n\n  std::string result;\n  RunFromThread(&RetrieveThreadLocalValue,\n                make_pair(&thread_local_string, &result));\n  EXPECT_TRUE(result.empty());\n}\n\n#endif  // GTEST_IS_THREADSAFE\n\n}  // namespace internal\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/test/gtest-printers_test.cc",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Google Test - The Google C++ Testing Framework\n//\n// This file tests the universal value printer.\n\n#include \"gtest/gtest-printers.h\"\n\n#include <ctype.h>\n#include <limits.h>\n#include <string.h>\n#include <algorithm>\n#include <deque>\n#include <list>\n#include <map>\n#include <set>\n#include <sstream>\n#include <string>\n#include <utility>\n#include <vector>\n\n#include \"gtest/gtest.h\"\n\n// hash_map and hash_set are available under Visual C++.\n#if _MSC_VER\n# define GTEST_HAS_HASH_MAP_ 1  // Indicates that hash_map is available.\n# include <hash_map>            // NOLINT\n# define GTEST_HAS_HASH_SET_ 1  // Indicates that hash_set is available.\n# include <hash_set>            // NOLINT\n#endif  // GTEST_OS_WINDOWS\n\n// Some user-defined types for testing the universal value printer.\n\n// An anonymous enum type.\nenum AnonymousEnum {\n  kAE1 = -1,\n  kAE2 = 1\n};\n\n// An enum without a user-defined printer.\nenum EnumWithoutPrinter {\n  kEWP1 = -2,\n  kEWP2 = 42\n};\n\n// An enum with a << operator.\nenum EnumWithStreaming {\n  kEWS1 = 10\n};\n\nstd::ostream& operator<<(std::ostream& os, EnumWithStreaming e) {\n  return os << (e == kEWS1 ? \"kEWS1\" : \"invalid\");\n}\n\n// An enum with a PrintTo() function.\nenum EnumWithPrintTo {\n  kEWPT1 = 1\n};\n\nvoid PrintTo(EnumWithPrintTo e, std::ostream* os) {\n  *os << (e == kEWPT1 ? \"kEWPT1\" : \"invalid\");\n}\n\n// A class implicitly convertible to BiggestInt.\nclass BiggestIntConvertible {\n public:\n  operator ::testing::internal::BiggestInt() const { return 42; }\n};\n\n// A user-defined unprintable class template in the global namespace.\ntemplate <typename T>\nclass UnprintableTemplateInGlobal {\n public:\n  UnprintableTemplateInGlobal() : value_() {}\n private:\n  T value_;\n};\n\n// A user-defined streamable type in the global namespace.\nclass StreamableInGlobal {\n public:\n  virtual ~StreamableInGlobal() {}\n};\n\ninline void operator<<(::std::ostream& os, const StreamableInGlobal& /* x */) {\n  os << \"StreamableInGlobal\";\n}\n\nvoid operator<<(::std::ostream& os, const StreamableInGlobal* /* x */) {\n  os << \"StreamableInGlobal*\";\n}\n\nnamespace foo {\n\n// A user-defined unprintable type in a user namespace.\nclass UnprintableInFoo {\n public:\n  UnprintableInFoo() : z_(0) { memcpy(xy_, \"\\xEF\\x12\\x0\\x0\\x34\\xAB\\x0\\x0\", 8); }\n private:\n  char xy_[8];\n  double z_;\n};\n\n// A user-defined printable type in a user-chosen namespace.\nstruct PrintableViaPrintTo {\n  PrintableViaPrintTo() : value() {}\n  int value;\n};\n\nvoid PrintTo(const PrintableViaPrintTo& x, ::std::ostream* os) {\n  *os << \"PrintableViaPrintTo: \" << x.value;\n}\n\n// A type with a user-defined << for printing its pointer.\nstruct PointerPrintable {\n};\n\n::std::ostream& operator<<(::std::ostream& os,\n                           const PointerPrintable* /* x */) {\n  return os << \"PointerPrintable*\";\n}\n\n// A user-defined printable class template in a user-chosen namespace.\ntemplate <typename T>\nclass PrintableViaPrintToTemplate {\n public:\n  explicit PrintableViaPrintToTemplate(const T& a_value) : value_(a_value) {}\n\n  const T& value() const { return value_; }\n private:\n  T value_;\n};\n\ntemplate <typename T>\nvoid PrintTo(const PrintableViaPrintToTemplate<T>& x, ::std::ostream* os) {\n  *os << \"PrintableViaPrintToTemplate: \" << x.value();\n}\n\n// A user-defined streamable class template in a user namespace.\ntemplate <typename T>\nclass StreamableTemplateInFoo {\n public:\n  StreamableTemplateInFoo() : value_() {}\n\n  const T& value() const { return value_; }\n private:\n  T value_;\n};\n\ntemplate <typename T>\ninline ::std::ostream& operator<<(::std::ostream& os,\n                                  const StreamableTemplateInFoo<T>& x) {\n  return os << \"StreamableTemplateInFoo: \" << x.value();\n}\n\n}  // namespace foo\n\nnamespace testing {\nnamespace gtest_printers_test {\n\nusing ::std::deque;\nusing ::std::list;\nusing ::std::make_pair;\nusing ::std::map;\nusing ::std::multimap;\nusing ::std::multiset;\nusing ::std::pair;\nusing ::std::set;\nusing ::std::vector;\nusing ::testing::PrintToString;\nusing ::testing::internal::FormatForComparisonFailureMessage;\nusing ::testing::internal::ImplicitCast_;\nusing ::testing::internal::NativeArray;\nusing ::testing::internal::RE;\nusing ::testing::internal::Strings;\nusing ::testing::internal::UniversalPrint;\nusing ::testing::internal::UniversalPrinter;\nusing ::testing::internal::UniversalTersePrint;\nusing ::testing::internal::UniversalTersePrintTupleFieldsToStrings;\nusing ::testing::internal::kReference;\nusing ::testing::internal::string;\n\n#if GTEST_HAS_TR1_TUPLE\nusing ::std::tr1::make_tuple;\nusing ::std::tr1::tuple;\n#endif\n\n// The hash_* classes are not part of the C++ standard.  STLport\n// defines them in namespace std.  MSVC defines them in ::stdext.  GCC\n// defines them in ::.\n#ifdef _STLP_HASH_MAP  // We got <hash_map> from STLport.\nusing ::std::hash_map;\nusing ::std::hash_set;\nusing ::std::hash_multimap;\nusing ::std::hash_multiset;\n#elif _MSC_VER\nusing ::stdext::hash_map;\nusing ::stdext::hash_set;\nusing ::stdext::hash_multimap;\nusing ::stdext::hash_multiset;\n#endif\n\n// Prints a value to a string using the universal value printer.  This\n// is a helper for testing UniversalPrinter<T>::Print() for various types.\ntemplate <typename T>\nstring Print(const T& value) {\n  ::std::stringstream ss;\n  UniversalPrinter<T>::Print(value, &ss);\n  return ss.str();\n}\n\n// Prints a value passed by reference to a string, using the universal\n// value printer.  This is a helper for testing\n// UniversalPrinter<T&>::Print() for various types.\ntemplate <typename T>\nstring PrintByRef(const T& value) {\n  ::std::stringstream ss;\n  UniversalPrinter<T&>::Print(value, &ss);\n  return ss.str();\n}\n\n// Tests printing various enum types.\n\nTEST(PrintEnumTest, AnonymousEnum) {\n  EXPECT_EQ(\"-1\", Print(kAE1));\n  EXPECT_EQ(\"1\", Print(kAE2));\n}\n\nTEST(PrintEnumTest, EnumWithoutPrinter) {\n  EXPECT_EQ(\"-2\", Print(kEWP1));\n  EXPECT_EQ(\"42\", Print(kEWP2));\n}\n\nTEST(PrintEnumTest, EnumWithStreaming) {\n  EXPECT_EQ(\"kEWS1\", Print(kEWS1));\n  EXPECT_EQ(\"invalid\", Print(static_cast<EnumWithStreaming>(0)));\n}\n\nTEST(PrintEnumTest, EnumWithPrintTo) {\n  EXPECT_EQ(\"kEWPT1\", Print(kEWPT1));\n  EXPECT_EQ(\"invalid\", Print(static_cast<EnumWithPrintTo>(0)));\n}\n\n// Tests printing a class implicitly convertible to BiggestInt.\n\nTEST(PrintClassTest, BiggestIntConvertible) {\n  EXPECT_EQ(\"42\", Print(BiggestIntConvertible()));\n}\n\n// Tests printing various char types.\n\n// char.\nTEST(PrintCharTest, PlainChar) {\n  EXPECT_EQ(\"'\\\\0'\", Print('\\0'));\n  EXPECT_EQ(\"'\\\\'' (39, 0x27)\", Print('\\''));\n  EXPECT_EQ(\"'\\\"' (34, 0x22)\", Print('\"'));\n  EXPECT_EQ(\"'?' (63, 0x3F)\", Print('?'));\n  EXPECT_EQ(\"'\\\\\\\\' (92, 0x5C)\", Print('\\\\'));\n  EXPECT_EQ(\"'\\\\a' (7)\", Print('\\a'));\n  EXPECT_EQ(\"'\\\\b' (8)\", Print('\\b'));\n  EXPECT_EQ(\"'\\\\f' (12, 0xC)\", Print('\\f'));\n  EXPECT_EQ(\"'\\\\n' (10, 0xA)\", Print('\\n'));\n  EXPECT_EQ(\"'\\\\r' (13, 0xD)\", Print('\\r'));\n  EXPECT_EQ(\"'\\\\t' (9)\", Print('\\t'));\n  EXPECT_EQ(\"'\\\\v' (11, 0xB)\", Print('\\v'));\n  EXPECT_EQ(\"'\\\\x7F' (127)\", Print('\\x7F'));\n  EXPECT_EQ(\"'\\\\xFF' (255)\", Print('\\xFF'));\n  EXPECT_EQ(\"' ' (32, 0x20)\", Print(' '));\n  EXPECT_EQ(\"'a' (97, 0x61)\", Print('a'));\n}\n\n// signed char.\nTEST(PrintCharTest, SignedChar) {\n  EXPECT_EQ(\"'\\\\0'\", Print(static_cast<signed char>('\\0')));\n  EXPECT_EQ(\"'\\\\xCE' (-50)\",\n            Print(static_cast<signed char>(-50)));\n}\n\n// unsigned char.\nTEST(PrintCharTest, UnsignedChar) {\n  EXPECT_EQ(\"'\\\\0'\", Print(static_cast<unsigned char>('\\0')));\n  EXPECT_EQ(\"'b' (98, 0x62)\",\n            Print(static_cast<unsigned char>('b')));\n}\n\n// Tests printing other simple, built-in types.\n\n// bool.\nTEST(PrintBuiltInTypeTest, Bool) {\n  EXPECT_EQ(\"false\", Print(false));\n  EXPECT_EQ(\"true\", Print(true));\n}\n\n// wchar_t.\nTEST(PrintBuiltInTypeTest, Wchar_t) {\n  EXPECT_EQ(\"L'\\\\0'\", Print(L'\\0'));\n  EXPECT_EQ(\"L'\\\\'' (39, 0x27)\", Print(L'\\''));\n  EXPECT_EQ(\"L'\\\"' (34, 0x22)\", Print(L'\"'));\n  EXPECT_EQ(\"L'?' (63, 0x3F)\", Print(L'?'));\n  EXPECT_EQ(\"L'\\\\\\\\' (92, 0x5C)\", Print(L'\\\\'));\n  EXPECT_EQ(\"L'\\\\a' (7)\", Print(L'\\a'));\n  EXPECT_EQ(\"L'\\\\b' (8)\", Print(L'\\b'));\n  EXPECT_EQ(\"L'\\\\f' (12, 0xC)\", Print(L'\\f'));\n  EXPECT_EQ(\"L'\\\\n' (10, 0xA)\", Print(L'\\n'));\n  EXPECT_EQ(\"L'\\\\r' (13, 0xD)\", Print(L'\\r'));\n  EXPECT_EQ(\"L'\\\\t' (9)\", Print(L'\\t'));\n  EXPECT_EQ(\"L'\\\\v' (11, 0xB)\", Print(L'\\v'));\n  EXPECT_EQ(\"L'\\\\x7F' (127)\", Print(L'\\x7F'));\n  EXPECT_EQ(\"L'\\\\xFF' (255)\", Print(L'\\xFF'));\n  EXPECT_EQ(\"L' ' (32, 0x20)\", Print(L' '));\n  EXPECT_EQ(\"L'a' (97, 0x61)\", Print(L'a'));\n  EXPECT_EQ(\"L'\\\\x576' (1398)\", Print(static_cast<wchar_t>(0x576)));\n  EXPECT_EQ(\"L'\\\\xC74D' (51021)\", Print(static_cast<wchar_t>(0xC74D)));\n}\n\n// Test that Int64 provides more storage than wchar_t.\nTEST(PrintTypeSizeTest, Wchar_t) {\n  EXPECT_LT(sizeof(wchar_t), sizeof(testing::internal::Int64));\n}\n\n// Various integer types.\nTEST(PrintBuiltInTypeTest, Integer) {\n  EXPECT_EQ(\"'\\\\xFF' (255)\", Print(static_cast<unsigned char>(255)));  // uint8\n  EXPECT_EQ(\"'\\\\x80' (-128)\", Print(static_cast<signed char>(-128)));  // int8\n  EXPECT_EQ(\"65535\", Print(USHRT_MAX));  // uint16\n  EXPECT_EQ(\"-32768\", Print(SHRT_MIN));  // int16\n  EXPECT_EQ(\"4294967295\", Print(UINT_MAX));  // uint32\n  EXPECT_EQ(\"-2147483648\", Print(INT_MIN));  // int32\n  EXPECT_EQ(\"18446744073709551615\",\n            Print(static_cast<testing::internal::UInt64>(-1)));  // uint64\n  EXPECT_EQ(\"-9223372036854775808\",\n            Print(static_cast<testing::internal::Int64>(1) << 63));  // int64\n}\n\n// Size types.\nTEST(PrintBuiltInTypeTest, Size_t) {\n  EXPECT_EQ(\"1\", Print(sizeof('a')));  // size_t.\n#if !GTEST_OS_WINDOWS\n  // Windows has no ssize_t type.\n  EXPECT_EQ(\"-2\", Print(static_cast<ssize_t>(-2)));  // ssize_t.\n#endif  // !GTEST_OS_WINDOWS\n}\n\n// Floating-points.\nTEST(PrintBuiltInTypeTest, FloatingPoints) {\n  EXPECT_EQ(\"1.5\", Print(1.5f));   // float\n  EXPECT_EQ(\"-2.5\", Print(-2.5));  // double\n}\n\n// Since ::std::stringstream::operator<<(const void *) formats the pointer\n// output differently with different compilers, we have to create the expected\n// output first and use it as our expectation.\nstatic string PrintPointer(const void *p) {\n  ::std::stringstream expected_result_stream;\n  expected_result_stream << p;\n  return expected_result_stream.str();\n}\n\n// Tests printing C strings.\n\n// const char*.\nTEST(PrintCStringTest, Const) {\n  const char* p = \"World\";\n  EXPECT_EQ(PrintPointer(p) + \" pointing to \\\"World\\\"\", Print(p));\n}\n\n// char*.\nTEST(PrintCStringTest, NonConst) {\n  char p[] = \"Hi\";\n  EXPECT_EQ(PrintPointer(p) + \" pointing to \\\"Hi\\\"\",\n            Print(static_cast<char*>(p)));\n}\n\n// NULL C string.\nTEST(PrintCStringTest, Null) {\n  const char* p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// Tests that C strings are escaped properly.\nTEST(PrintCStringTest, EscapesProperly) {\n  const char* p = \"'\\\"?\\\\\\a\\b\\f\\n\\r\\t\\v\\x7F\\xFF a\";\n  EXPECT_EQ(PrintPointer(p) + \" pointing to \\\"'\\\\\\\"?\\\\\\\\\\\\a\\\\b\\\\f\"\n            \"\\\\n\\\\r\\\\t\\\\v\\\\x7F\\\\xFF a\\\"\",\n            Print(p));\n}\n\n\n\n// MSVC compiler can be configured to define whar_t as a typedef\n// of unsigned short. Defining an overload for const wchar_t* in that case\n// would cause pointers to unsigned shorts be printed as wide strings,\n// possibly accessing more memory than intended and causing invalid\n// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when\n// wchar_t is implemented as a native type.\n#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)\n\n// const wchar_t*.\nTEST(PrintWideCStringTest, Const) {\n  const wchar_t* p = L\"World\";\n  EXPECT_EQ(PrintPointer(p) + \" pointing to L\\\"World\\\"\", Print(p));\n}\n\n// wchar_t*.\nTEST(PrintWideCStringTest, NonConst) {\n  wchar_t p[] = L\"Hi\";\n  EXPECT_EQ(PrintPointer(p) + \" pointing to L\\\"Hi\\\"\",\n            Print(static_cast<wchar_t*>(p)));\n}\n\n// NULL wide C string.\nTEST(PrintWideCStringTest, Null) {\n  const wchar_t* p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// Tests that wide C strings are escaped properly.\nTEST(PrintWideCStringTest, EscapesProperly) {\n  const wchar_t s[] = {'\\'', '\"', '?', '\\\\', '\\a', '\\b', '\\f', '\\n', '\\r',\n                       '\\t', '\\v', 0xD3, 0x576, 0x8D3, 0xC74D, ' ', 'a', '\\0'};\n  EXPECT_EQ(PrintPointer(s) + \" pointing to L\\\"'\\\\\\\"?\\\\\\\\\\\\a\\\\b\\\\f\"\n            \"\\\\n\\\\r\\\\t\\\\v\\\\xD3\\\\x576\\\\x8D3\\\\xC74D a\\\"\",\n            Print(static_cast<const wchar_t*>(s)));\n}\n#endif  // native wchar_t\n\n// Tests printing pointers to other char types.\n\n// signed char*.\nTEST(PrintCharPointerTest, SignedChar) {\n  signed char* p = reinterpret_cast<signed char*>(0x1234);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// const signed char*.\nTEST(PrintCharPointerTest, ConstSignedChar) {\n  signed char* p = reinterpret_cast<signed char*>(0x1234);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// unsigned char*.\nTEST(PrintCharPointerTest, UnsignedChar) {\n  unsigned char* p = reinterpret_cast<unsigned char*>(0x1234);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// const unsigned char*.\nTEST(PrintCharPointerTest, ConstUnsignedChar) {\n  const unsigned char* p = reinterpret_cast<const unsigned char*>(0x1234);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// Tests printing pointers to simple, built-in types.\n\n// bool*.\nTEST(PrintPointerToBuiltInTypeTest, Bool) {\n  bool* p = reinterpret_cast<bool*>(0xABCD);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// void*.\nTEST(PrintPointerToBuiltInTypeTest, Void) {\n  void* p = reinterpret_cast<void*>(0xABCD);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// const void*.\nTEST(PrintPointerToBuiltInTypeTest, ConstVoid) {\n  const void* p = reinterpret_cast<const void*>(0xABCD);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// Tests printing pointers to pointers.\nTEST(PrintPointerToPointerTest, IntPointerPointer) {\n  int** p = reinterpret_cast<int**>(0xABCD);\n  EXPECT_EQ(PrintPointer(p), Print(p));\n  p = NULL;\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// Tests printing (non-member) function pointers.\n\nvoid MyFunction(int /* n */) {}\n\nTEST(PrintPointerTest, NonMemberFunctionPointer) {\n  // We cannot directly cast &MyFunction to const void* because the\n  // standard disallows casting between pointers to functions and\n  // pointers to objects, and some compilers (e.g. GCC 3.4) enforce\n  // this limitation.\n  EXPECT_EQ(\n      PrintPointer(reinterpret_cast<const void*>(\n          reinterpret_cast<internal::BiggestInt>(&MyFunction))),\n      Print(&MyFunction));\n  int (*p)(bool) = NULL;  // NOLINT\n  EXPECT_EQ(\"NULL\", Print(p));\n}\n\n// An assertion predicate determining whether a one string is a prefix for\n// another.\ntemplate <typename StringType>\nAssertionResult HasPrefix(const StringType& str, const StringType& prefix) {\n  if (str.find(prefix, 0) == 0)\n    return AssertionSuccess();\n\n  const bool is_wide_string = sizeof(prefix[0]) > 1;\n  const char* const begin_string_quote = is_wide_string ? \"L\\\"\" : \"\\\"\";\n  return AssertionFailure()\n      << begin_string_quote << prefix << \"\\\" is not a prefix of \"\n      << begin_string_quote << str << \"\\\"\\n\";\n}\n\n// Tests printing member variable pointers.  Although they are called\n// pointers, they don't point to a location in the address space.\n// Their representation is implementation-defined.  Thus they will be\n// printed as raw bytes.\n\nstruct Foo {\n public:\n  virtual ~Foo() {}\n  int MyMethod(char x) { return x + 1; }\n  virtual char MyVirtualMethod(int /* n */) { return 'a'; }\n\n  int value;\n};\n\nTEST(PrintPointerTest, MemberVariablePointer) {\n  EXPECT_TRUE(HasPrefix(Print(&Foo::value),\n                        Print(sizeof(&Foo::value)) + \"-byte object \"));\n  int (Foo::*p) = NULL;  // NOLINT\n  EXPECT_TRUE(HasPrefix(Print(p),\n                        Print(sizeof(p)) + \"-byte object \"));\n}\n\n// Tests printing member function pointers.  Although they are called\n// pointers, they don't point to a location in the address space.\n// Their representation is implementation-defined.  Thus they will be\n// printed as raw bytes.\nTEST(PrintPointerTest, MemberFunctionPointer) {\n  EXPECT_TRUE(HasPrefix(Print(&Foo::MyMethod),\n                        Print(sizeof(&Foo::MyMethod)) + \"-byte object \"));\n  EXPECT_TRUE(\n      HasPrefix(Print(&Foo::MyVirtualMethod),\n                Print(sizeof((&Foo::MyVirtualMethod))) + \"-byte object \"));\n  int (Foo::*p)(char) = NULL;  // NOLINT\n  EXPECT_TRUE(HasPrefix(Print(p),\n                        Print(sizeof(p)) + \"-byte object \"));\n}\n\n// Tests printing C arrays.\n\n// The difference between this and Print() is that it ensures that the\n// argument is a reference to an array.\ntemplate <typename T, size_t N>\nstring PrintArrayHelper(T (&a)[N]) {\n  return Print(a);\n}\n\n// One-dimensional array.\nTEST(PrintArrayTest, OneDimensionalArray) {\n  int a[5] = { 1, 2, 3, 4, 5 };\n  EXPECT_EQ(\"{ 1, 2, 3, 4, 5 }\", PrintArrayHelper(a));\n}\n\n// Two-dimensional array.\nTEST(PrintArrayTest, TwoDimensionalArray) {\n  int a[2][5] = {\n    { 1, 2, 3, 4, 5 },\n    { 6, 7, 8, 9, 0 }\n  };\n  EXPECT_EQ(\"{ { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 0 } }\", PrintArrayHelper(a));\n}\n\n// Array of const elements.\nTEST(PrintArrayTest, ConstArray) {\n  const bool a[1] = { false };\n  EXPECT_EQ(\"{ false }\", PrintArrayHelper(a));\n}\n\n// char array without terminating NUL.\nTEST(PrintArrayTest, CharArrayWithNoTerminatingNul) {\n  // Array a contains '\\0' in the middle and doesn't end with '\\0'.\n  char a[] = { 'H', '\\0', 'i' };\n  EXPECT_EQ(\"\\\"H\\\\0i\\\" (no terminating NUL)\", PrintArrayHelper(a));\n}\n\n// const char array with terminating NUL.\nTEST(PrintArrayTest, ConstCharArrayWithTerminatingNul) {\n  const char a[] = \"\\0Hi\";\n  EXPECT_EQ(\"\\\"\\\\0Hi\\\"\", PrintArrayHelper(a));\n}\n\n// const wchar_t array without terminating NUL.\nTEST(PrintArrayTest, WCharArrayWithNoTerminatingNul) {\n  // Array a contains '\\0' in the middle and doesn't end with '\\0'.\n  const wchar_t a[] = { L'H', L'\\0', L'i' };\n  EXPECT_EQ(\"L\\\"H\\\\0i\\\" (no terminating NUL)\", PrintArrayHelper(a));\n}\n\n// wchar_t array with terminating NUL.\nTEST(PrintArrayTest, WConstCharArrayWithTerminatingNul) {\n  const wchar_t a[] = L\"\\0Hi\";\n  EXPECT_EQ(\"L\\\"\\\\0Hi\\\"\", PrintArrayHelper(a));\n}\n\n// Array of objects.\nTEST(PrintArrayTest, ObjectArray) {\n  string a[3] = { \"Hi\", \"Hello\", \"Ni hao\" };\n  EXPECT_EQ(\"{ \\\"Hi\\\", \\\"Hello\\\", \\\"Ni hao\\\" }\", PrintArrayHelper(a));\n}\n\n// Array with many elements.\nTEST(PrintArrayTest, BigArray) {\n  int a[100] = { 1, 2, 3 };\n  EXPECT_EQ(\"{ 1, 2, 3, 0, 0, 0, 0, 0, ..., 0, 0, 0, 0, 0, 0, 0, 0 }\",\n            PrintArrayHelper(a));\n}\n\n// Tests printing ::string and ::std::string.\n\n#if GTEST_HAS_GLOBAL_STRING\n// ::string.\nTEST(PrintStringTest, StringInGlobalNamespace) {\n  const char s[] = \"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\x7F\\xFF a\";\n  const ::string str(s, sizeof(s));\n  EXPECT_EQ(\"\\\"'\\\\\\\"?\\\\\\\\\\\\a\\\\b\\\\f\\\\n\\\\0\\\\r\\\\t\\\\v\\\\x7F\\\\xFF a\\\\0\\\"\",\n            Print(str));\n}\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n// ::std::string.\nTEST(PrintStringTest, StringInStdNamespace) {\n  const char s[] = \"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\x7F\\xFF a\";\n  const ::std::string str(s, sizeof(s));\n  EXPECT_EQ(\"\\\"'\\\\\\\"?\\\\\\\\\\\\a\\\\b\\\\f\\\\n\\\\0\\\\r\\\\t\\\\v\\\\x7F\\\\xFF a\\\\0\\\"\",\n            Print(str));\n}\n\nTEST(PrintStringTest, StringAmbiguousHex) {\n  // \"\\x6BANANA\" is ambiguous, it can be interpreted as starting with either of:\n  // '\\x6', '\\x6B', or '\\x6BA'.\n\n  // a hex escaping sequence following by a decimal digit\n  EXPECT_EQ(\"\\\"0\\\\x12\\\" \\\"3\\\"\", Print(::std::string(\"0\\x12\" \"3\")));\n  // a hex escaping sequence following by a hex digit (lower-case)\n  EXPECT_EQ(\"\\\"mm\\\\x6\\\" \\\"bananas\\\"\", Print(::std::string(\"mm\\x6\" \"bananas\")));\n  // a hex escaping sequence following by a hex digit (upper-case)\n  EXPECT_EQ(\"\\\"NOM\\\\x6\\\" \\\"BANANA\\\"\", Print(::std::string(\"NOM\\x6\" \"BANANA\")));\n  // a hex escaping sequence following by a non-xdigit\n  EXPECT_EQ(\"\\\"!\\\\x5-!\\\"\", Print(::std::string(\"!\\x5-!\")));\n}\n\n// Tests printing ::wstring and ::std::wstring.\n\n#if GTEST_HAS_GLOBAL_WSTRING\n// ::wstring.\nTEST(PrintWideStringTest, StringInGlobalNamespace) {\n  const wchar_t s[] = L\"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\xD3\\x576\\x8D3\\xC74D a\";\n  const ::wstring str(s, sizeof(s)/sizeof(wchar_t));\n  EXPECT_EQ(\"L\\\"'\\\\\\\"?\\\\\\\\\\\\a\\\\b\\\\f\\\\n\\\\0\\\\r\\\\t\\\\v\"\n            \"\\\\xD3\\\\x576\\\\x8D3\\\\xC74D a\\\\0\\\"\",\n            Print(str));\n}\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n#if GTEST_HAS_STD_WSTRING\n// ::std::wstring.\nTEST(PrintWideStringTest, StringInStdNamespace) {\n  const wchar_t s[] = L\"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\xD3\\x576\\x8D3\\xC74D a\";\n  const ::std::wstring str(s, sizeof(s)/sizeof(wchar_t));\n  EXPECT_EQ(\"L\\\"'\\\\\\\"?\\\\\\\\\\\\a\\\\b\\\\f\\\\n\\\\0\\\\r\\\\t\\\\v\"\n            \"\\\\xD3\\\\x576\\\\x8D3\\\\xC74D a\\\\0\\\"\",\n            Print(str));\n}\n\nTEST(PrintWideStringTest, StringAmbiguousHex) {\n  // same for wide strings.\n  EXPECT_EQ(\"L\\\"0\\\\x12\\\" L\\\"3\\\"\", Print(::std::wstring(L\"0\\x12\" L\"3\")));\n  EXPECT_EQ(\"L\\\"mm\\\\x6\\\" L\\\"bananas\\\"\",\n            Print(::std::wstring(L\"mm\\x6\" L\"bananas\")));\n  EXPECT_EQ(\"L\\\"NOM\\\\x6\\\" L\\\"BANANA\\\"\",\n            Print(::std::wstring(L\"NOM\\x6\" L\"BANANA\")));\n  EXPECT_EQ(\"L\\\"!\\\\x5-!\\\"\", Print(::std::wstring(L\"!\\x5-!\")));\n}\n#endif  // GTEST_HAS_STD_WSTRING\n\n// Tests printing types that support generic streaming (i.e. streaming\n// to std::basic_ostream<Char, CharTraits> for any valid Char and\n// CharTraits types).\n\n// Tests printing a non-template type that supports generic streaming.\n\nclass AllowsGenericStreaming {};\n\ntemplate <typename Char, typename CharTraits>\nstd::basic_ostream<Char, CharTraits>& operator<<(\n    std::basic_ostream<Char, CharTraits>& os,\n    const AllowsGenericStreaming& /* a */) {\n  return os << \"AllowsGenericStreaming\";\n}\n\nTEST(PrintTypeWithGenericStreamingTest, NonTemplateType) {\n  AllowsGenericStreaming a;\n  EXPECT_EQ(\"AllowsGenericStreaming\", Print(a));\n}\n\n// Tests printing a template type that supports generic streaming.\n\ntemplate <typename T>\nclass AllowsGenericStreamingTemplate {};\n\ntemplate <typename Char, typename CharTraits, typename T>\nstd::basic_ostream<Char, CharTraits>& operator<<(\n    std::basic_ostream<Char, CharTraits>& os,\n    const AllowsGenericStreamingTemplate<T>& /* a */) {\n  return os << \"AllowsGenericStreamingTemplate\";\n}\n\nTEST(PrintTypeWithGenericStreamingTest, TemplateType) {\n  AllowsGenericStreamingTemplate<int> a;\n  EXPECT_EQ(\"AllowsGenericStreamingTemplate\", Print(a));\n}\n\n// Tests printing a type that supports generic streaming and can be\n// implicitly converted to another printable type.\n\ntemplate <typename T>\nclass AllowsGenericStreamingAndImplicitConversionTemplate {\n public:\n  operator bool() const { return false; }\n};\n\ntemplate <typename Char, typename CharTraits, typename T>\nstd::basic_ostream<Char, CharTraits>& operator<<(\n    std::basic_ostream<Char, CharTraits>& os,\n    const AllowsGenericStreamingAndImplicitConversionTemplate<T>& /* a */) {\n  return os << \"AllowsGenericStreamingAndImplicitConversionTemplate\";\n}\n\nTEST(PrintTypeWithGenericStreamingTest, TypeImplicitlyConvertible) {\n  AllowsGenericStreamingAndImplicitConversionTemplate<int> a;\n  EXPECT_EQ(\"AllowsGenericStreamingAndImplicitConversionTemplate\", Print(a));\n}\n\n#if GTEST_HAS_STRING_PIECE_\n\n// Tests printing StringPiece.\n\nTEST(PrintStringPieceTest, SimpleStringPiece) {\n  const StringPiece sp = \"Hello\";\n  EXPECT_EQ(\"\\\"Hello\\\"\", Print(sp));\n}\n\nTEST(PrintStringPieceTest, UnprintableCharacters) {\n  const char str[] = \"NUL (\\0) and \\r\\t\";\n  const StringPiece sp(str, sizeof(str) - 1);\n  EXPECT_EQ(\"\\\"NUL (\\\\0) and \\\\r\\\\t\\\"\", Print(sp));\n}\n\n#endif  // GTEST_HAS_STRING_PIECE_\n\n// Tests printing STL containers.\n\nTEST(PrintStlContainerTest, EmptyDeque) {\n  deque<char> empty;\n  EXPECT_EQ(\"{}\", Print(empty));\n}\n\nTEST(PrintStlContainerTest, NonEmptyDeque) {\n  deque<int> non_empty;\n  non_empty.push_back(1);\n  non_empty.push_back(3);\n  EXPECT_EQ(\"{ 1, 3 }\", Print(non_empty));\n}\n\n#if GTEST_HAS_HASH_MAP_\n\nTEST(PrintStlContainerTest, OneElementHashMap) {\n  hash_map<int, char> map1;\n  map1[1] = 'a';\n  EXPECT_EQ(\"{ (1, 'a' (97, 0x61)) }\", Print(map1));\n}\n\nTEST(PrintStlContainerTest, HashMultiMap) {\n  hash_multimap<int, bool> map1;\n  map1.insert(make_pair(5, true));\n  map1.insert(make_pair(5, false));\n\n  // Elements of hash_multimap can be printed in any order.\n  const string result = Print(map1);\n  EXPECT_TRUE(result == \"{ (5, true), (5, false) }\" ||\n              result == \"{ (5, false), (5, true) }\")\n                  << \" where Print(map1) returns \\\"\" << result << \"\\\".\";\n}\n\n#endif  // GTEST_HAS_HASH_MAP_\n\n#if GTEST_HAS_HASH_SET_\n\nTEST(PrintStlContainerTest, HashSet) {\n  hash_set<string> set1;\n  set1.insert(\"hello\");\n  EXPECT_EQ(\"{ \\\"hello\\\" }\", Print(set1));\n}\n\nTEST(PrintStlContainerTest, HashMultiSet) {\n  const int kSize = 5;\n  int a[kSize] = { 1, 1, 2, 5, 1 };\n  hash_multiset<int> set1(a, a + kSize);\n\n  // Elements of hash_multiset can be printed in any order.\n  const string result = Print(set1);\n  const string expected_pattern = \"{ d, d, d, d, d }\";  // d means a digit.\n\n  // Verifies the result matches the expected pattern; also extracts\n  // the numbers in the result.\n  ASSERT_EQ(expected_pattern.length(), result.length());\n  std::vector<int> numbers;\n  for (size_t i = 0; i != result.length(); i++) {\n    if (expected_pattern[i] == 'd') {\n      ASSERT_NE(isdigit(static_cast<unsigned char>(result[i])), 0);\n      numbers.push_back(result[i] - '0');\n    } else {\n      EXPECT_EQ(expected_pattern[i], result[i]) << \" where result is \"\n                                                << result;\n    }\n  }\n\n  // Makes sure the result contains the right numbers.\n  std::sort(numbers.begin(), numbers.end());\n  std::sort(a, a + kSize);\n  EXPECT_TRUE(std::equal(a, a + kSize, numbers.begin()));\n}\n\n#endif  // GTEST_HAS_HASH_SET_\n\nTEST(PrintStlContainerTest, List) {\n  const string a[] = {\n    \"hello\",\n    \"world\"\n  };\n  const list<string> strings(a, a + 2);\n  EXPECT_EQ(\"{ \\\"hello\\\", \\\"world\\\" }\", Print(strings));\n}\n\nTEST(PrintStlContainerTest, Map) {\n  map<int, bool> map1;\n  map1[1] = true;\n  map1[5] = false;\n  map1[3] = true;\n  EXPECT_EQ(\"{ (1, true), (3, true), (5, false) }\", Print(map1));\n}\n\nTEST(PrintStlContainerTest, MultiMap) {\n  multimap<bool, int> map1;\n  // The make_pair template function would deduce the type as\n  // pair<bool, int> here, and since the key part in a multimap has to\n  // be constant, without a templated ctor in the pair class (as in\n  // libCstd on Solaris), make_pair call would fail to compile as no\n  // implicit conversion is found.  Thus explicit typename is used\n  // here instead.\n  map1.insert(pair<const bool, int>(true, 0));\n  map1.insert(pair<const bool, int>(true, 1));\n  map1.insert(pair<const bool, int>(false, 2));\n  EXPECT_EQ(\"{ (false, 2), (true, 0), (true, 1) }\", Print(map1));\n}\n\nTEST(PrintStlContainerTest, Set) {\n  const unsigned int a[] = { 3, 0, 5 };\n  set<unsigned int> set1(a, a + 3);\n  EXPECT_EQ(\"{ 0, 3, 5 }\", Print(set1));\n}\n\nTEST(PrintStlContainerTest, MultiSet) {\n  const int a[] = { 1, 1, 2, 5, 1 };\n  multiset<int> set1(a, a + 5);\n  EXPECT_EQ(\"{ 1, 1, 1, 2, 5 }\", Print(set1));\n}\n\nTEST(PrintStlContainerTest, Pair) {\n  pair<const bool, int> p(true, 5);\n  EXPECT_EQ(\"(true, 5)\", Print(p));\n}\n\nTEST(PrintStlContainerTest, Vector) {\n  vector<int> v;\n  v.push_back(1);\n  v.push_back(2);\n  EXPECT_EQ(\"{ 1, 2 }\", Print(v));\n}\n\nTEST(PrintStlContainerTest, LongSequence) {\n  const int a[100] = { 1, 2, 3 };\n  const vector<int> v(a, a + 100);\n  EXPECT_EQ(\"{ 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \"\n            \"0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... }\", Print(v));\n}\n\nTEST(PrintStlContainerTest, NestedContainer) {\n  const int a1[] = { 1, 2 };\n  const int a2[] = { 3, 4, 5 };\n  const list<int> l1(a1, a1 + 2);\n  const list<int> l2(a2, a2 + 3);\n\n  vector<list<int> > v;\n  v.push_back(l1);\n  v.push_back(l2);\n  EXPECT_EQ(\"{ { 1, 2 }, { 3, 4, 5 } }\", Print(v));\n}\n\nTEST(PrintStlContainerTest, OneDimensionalNativeArray) {\n  const int a[3] = { 1, 2, 3 };\n  NativeArray<int> b(a, 3, kReference);\n  EXPECT_EQ(\"{ 1, 2, 3 }\", Print(b));\n}\n\nTEST(PrintStlContainerTest, TwoDimensionalNativeArray) {\n  const int a[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } };\n  NativeArray<int[3]> b(a, 2, kReference);\n  EXPECT_EQ(\"{ { 1, 2, 3 }, { 4, 5, 6 } }\", Print(b));\n}\n\n// Tests that a class named iterator isn't treated as a container.\n\nstruct iterator {\n  char x;\n};\n\nTEST(PrintStlContainerTest, Iterator) {\n  iterator it = {};\n  EXPECT_EQ(\"1-byte object <00>\", Print(it));\n}\n\n// Tests that a class named const_iterator isn't treated as a container.\n\nstruct const_iterator {\n  char x;\n};\n\nTEST(PrintStlContainerTest, ConstIterator) {\n  const_iterator it = {};\n  EXPECT_EQ(\"1-byte object <00>\", Print(it));\n}\n\n#if GTEST_HAS_TR1_TUPLE\n// Tests printing tuples.\n\n// Tuples of various arities.\nTEST(PrintTupleTest, VariousSizes) {\n  tuple<> t0;\n  EXPECT_EQ(\"()\", Print(t0));\n\n  tuple<int> t1(5);\n  EXPECT_EQ(\"(5)\", Print(t1));\n\n  tuple<char, bool> t2('a', true);\n  EXPECT_EQ(\"('a' (97, 0x61), true)\", Print(t2));\n\n  tuple<bool, int, int> t3(false, 2, 3);\n  EXPECT_EQ(\"(false, 2, 3)\", Print(t3));\n\n  tuple<bool, int, int, int> t4(false, 2, 3, 4);\n  EXPECT_EQ(\"(false, 2, 3, 4)\", Print(t4));\n\n  tuple<bool, int, int, int, bool> t5(false, 2, 3, 4, true);\n  EXPECT_EQ(\"(false, 2, 3, 4, true)\", Print(t5));\n\n  tuple<bool, int, int, int, bool, int> t6(false, 2, 3, 4, true, 6);\n  EXPECT_EQ(\"(false, 2, 3, 4, true, 6)\", Print(t6));\n\n  tuple<bool, int, int, int, bool, int, int> t7(false, 2, 3, 4, true, 6, 7);\n  EXPECT_EQ(\"(false, 2, 3, 4, true, 6, 7)\", Print(t7));\n\n  tuple<bool, int, int, int, bool, int, int, bool> t8(\n      false, 2, 3, 4, true, 6, 7, true);\n  EXPECT_EQ(\"(false, 2, 3, 4, true, 6, 7, true)\", Print(t8));\n\n  tuple<bool, int, int, int, bool, int, int, bool, int> t9(\n      false, 2, 3, 4, true, 6, 7, true, 9);\n  EXPECT_EQ(\"(false, 2, 3, 4, true, 6, 7, true, 9)\", Print(t9));\n\n  const char* const str = \"8\";\n  // VC++ 2010's implementation of tuple of C++0x is deficient, requiring\n  // an explicit type cast of NULL to be used.\n  tuple<bool, char, short, testing::internal::Int32,  // NOLINT\n      testing::internal::Int64, float, double, const char*, void*, string>\n      t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str,\n          ImplicitCast_<void*>(NULL), \"10\");\n  EXPECT_EQ(\"(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, \" + PrintPointer(str) +\n            \" pointing to \\\"8\\\", NULL, \\\"10\\\")\",\n            Print(t10));\n}\n\n// Nested tuples.\nTEST(PrintTupleTest, NestedTuple) {\n  tuple<tuple<int, bool>, char> nested(make_tuple(5, true), 'a');\n  EXPECT_EQ(\"((5, true), 'a' (97, 0x61))\", Print(nested));\n}\n\n#endif  // GTEST_HAS_TR1_TUPLE\n\n// Tests printing user-defined unprintable types.\n\n// Unprintable types in the global namespace.\nTEST(PrintUnprintableTypeTest, InGlobalNamespace) {\n  EXPECT_EQ(\"1-byte object <00>\",\n            Print(UnprintableTemplateInGlobal<char>()));\n}\n\n// Unprintable types in a user namespace.\nTEST(PrintUnprintableTypeTest, InUserNamespace) {\n  EXPECT_EQ(\"16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>\",\n            Print(::foo::UnprintableInFoo()));\n}\n\n// Unprintable types are that too big to be printed completely.\n\nstruct Big {\n  Big() { memset(array, 0, sizeof(array)); }\n  char array[257];\n};\n\nTEST(PrintUnpritableTypeTest, BigObject) {\n  EXPECT_EQ(\"257-byte object <00-00 00-00 00-00 00-00 00-00 00-00 \"\n            \"00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 \"\n            \"00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 \"\n            \"00-00 00-00 00-00 00-00 00-00 00-00 ... 00-00 00-00 00-00 \"\n            \"00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 \"\n            \"00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 \"\n            \"00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00>\",\n            Print(Big()));\n}\n\n// Tests printing user-defined streamable types.\n\n// Streamable types in the global namespace.\nTEST(PrintStreamableTypeTest, InGlobalNamespace) {\n  StreamableInGlobal x;\n  EXPECT_EQ(\"StreamableInGlobal\", Print(x));\n  EXPECT_EQ(\"StreamableInGlobal*\", Print(&x));\n}\n\n// Printable template types in a user namespace.\nTEST(PrintStreamableTypeTest, TemplateTypeInUserNamespace) {\n  EXPECT_EQ(\"StreamableTemplateInFoo: 0\",\n            Print(::foo::StreamableTemplateInFoo<int>()));\n}\n\n// Tests printing user-defined types that have a PrintTo() function.\nTEST(PrintPrintableTypeTest, InUserNamespace) {\n  EXPECT_EQ(\"PrintableViaPrintTo: 0\",\n            Print(::foo::PrintableViaPrintTo()));\n}\n\n// Tests printing a pointer to a user-defined type that has a <<\n// operator for its pointer.\nTEST(PrintPrintableTypeTest, PointerInUserNamespace) {\n  ::foo::PointerPrintable x;\n  EXPECT_EQ(\"PointerPrintable*\", Print(&x));\n}\n\n// Tests printing user-defined class template that have a PrintTo() function.\nTEST(PrintPrintableTypeTest, TemplateInUserNamespace) {\n  EXPECT_EQ(\"PrintableViaPrintToTemplate: 5\",\n            Print(::foo::PrintableViaPrintToTemplate<int>(5)));\n}\n\n#if GTEST_HAS_PROTOBUF_\n\n// Tests printing a protocol message.\nTEST(PrintProtocolMessageTest, PrintsShortDebugString) {\n  testing::internal::TestMessage msg;\n  msg.set_member(\"yes\");\n  EXPECT_EQ(\"<member:\\\"yes\\\">\", Print(msg));\n}\n\n// Tests printing a short proto2 message.\nTEST(PrintProto2MessageTest, PrintsShortDebugStringWhenItIsShort) {\n  testing::internal::FooMessage msg;\n  msg.set_int_field(2);\n  msg.set_string_field(\"hello\");\n  EXPECT_PRED2(RE::FullMatch, Print(msg),\n               \"<int_field:\\\\s*2\\\\s+string_field:\\\\s*\\\"hello\\\">\");\n}\n\n// Tests printing a long proto2 message.\nTEST(PrintProto2MessageTest, PrintsDebugStringWhenItIsLong) {\n  testing::internal::FooMessage msg;\n  msg.set_int_field(2);\n  msg.set_string_field(\"hello\");\n  msg.add_names(\"peter\");\n  msg.add_names(\"paul\");\n  msg.add_names(\"mary\");\n  EXPECT_PRED2(RE::FullMatch, Print(msg),\n               \"<\\n\"\n               \"int_field:\\\\s*2\\n\"\n               \"string_field:\\\\s*\\\"hello\\\"\\n\"\n               \"names:\\\\s*\\\"peter\\\"\\n\"\n               \"names:\\\\s*\\\"paul\\\"\\n\"\n               \"names:\\\\s*\\\"mary\\\"\\n\"\n               \">\");\n}\n\n#endif  // GTEST_HAS_PROTOBUF_\n\n// Tests that the universal printer prints both the address and the\n// value of a reference.\nTEST(PrintReferenceTest, PrintsAddressAndValue) {\n  int n = 5;\n  EXPECT_EQ(\"@\" + PrintPointer(&n) + \" 5\", PrintByRef(n));\n\n  int a[2][3] = {\n    { 0, 1, 2 },\n    { 3, 4, 5 }\n  };\n  EXPECT_EQ(\"@\" + PrintPointer(a) + \" { { 0, 1, 2 }, { 3, 4, 5 } }\",\n            PrintByRef(a));\n\n  const ::foo::UnprintableInFoo x;\n  EXPECT_EQ(\"@\" + PrintPointer(&x) + \" 16-byte object \"\n            \"<EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>\",\n            PrintByRef(x));\n}\n\n// Tests that the universal printer prints a function pointer passed by\n// reference.\nTEST(PrintReferenceTest, HandlesFunctionPointer) {\n  void (*fp)(int n) = &MyFunction;\n  const string fp_pointer_string =\n      PrintPointer(reinterpret_cast<const void*>(&fp));\n  // We cannot directly cast &MyFunction to const void* because the\n  // standard disallows casting between pointers to functions and\n  // pointers to objects, and some compilers (e.g. GCC 3.4) enforce\n  // this limitation.\n  const string fp_string = PrintPointer(reinterpret_cast<const void*>(\n      reinterpret_cast<internal::BiggestInt>(fp)));\n  EXPECT_EQ(\"@\" + fp_pointer_string + \" \" + fp_string,\n            PrintByRef(fp));\n}\n\n// Tests that the universal printer prints a member function pointer\n// passed by reference.\nTEST(PrintReferenceTest, HandlesMemberFunctionPointer) {\n  int (Foo::*p)(char ch) = &Foo::MyMethod;\n  EXPECT_TRUE(HasPrefix(\n      PrintByRef(p),\n      \"@\" + PrintPointer(reinterpret_cast<const void*>(&p)) + \" \" +\n          Print(sizeof(p)) + \"-byte object \"));\n\n  char (Foo::*p2)(int n) = &Foo::MyVirtualMethod;\n  EXPECT_TRUE(HasPrefix(\n      PrintByRef(p2),\n      \"@\" + PrintPointer(reinterpret_cast<const void*>(&p2)) + \" \" +\n          Print(sizeof(p2)) + \"-byte object \"));\n}\n\n// Tests that the universal printer prints a member variable pointer\n// passed by reference.\nTEST(PrintReferenceTest, HandlesMemberVariablePointer) {\n  int (Foo::*p) = &Foo::value;  // NOLINT\n  EXPECT_TRUE(HasPrefix(\n      PrintByRef(p),\n      \"@\" + PrintPointer(&p) + \" \" + Print(sizeof(p)) + \"-byte object \"));\n}\n\n// Tests that FormatForComparisonFailureMessage(), which is used to print\n// an operand in a comparison assertion (e.g. ASSERT_EQ) when the assertion\n// fails, formats the operand in the desired way.\n\n// scalar\nTEST(FormatForComparisonFailureMessageTest, WorksForScalar) {\n  EXPECT_STREQ(\"123\",\n               FormatForComparisonFailureMessage(123, 124).c_str());\n}\n\n// non-char pointer\nTEST(FormatForComparisonFailureMessageTest, WorksForNonCharPointer) {\n  int n = 0;\n  EXPECT_EQ(PrintPointer(&n),\n            FormatForComparisonFailureMessage(&n, &n).c_str());\n}\n\n// non-char array\nTEST(FormatForComparisonFailureMessageTest, FormatsNonCharArrayAsPointer) {\n  // In expression 'array == x', 'array' is compared by pointer.\n  // Therefore we want to print an array operand as a pointer.\n  int n[] = { 1, 2, 3 };\n  EXPECT_EQ(PrintPointer(n),\n            FormatForComparisonFailureMessage(n, n).c_str());\n}\n\n// Tests formatting a char pointer when it's compared with another pointer.\n// In this case we want to print it as a raw pointer, as the comparision is by\n// pointer.\n\n// char pointer vs pointer\nTEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsPointer) {\n  // In expression 'p == x', where 'p' and 'x' are (const or not) char\n  // pointers, the operands are compared by pointer.  Therefore we\n  // want to print 'p' as a pointer instead of a C string (we don't\n  // even know if it's supposed to point to a valid C string).\n\n  // const char*\n  const char* s = \"hello\";\n  EXPECT_EQ(PrintPointer(s),\n            FormatForComparisonFailureMessage(s, s).c_str());\n\n  // char*\n  char ch = 'a';\n  EXPECT_EQ(PrintPointer(&ch),\n            FormatForComparisonFailureMessage(&ch, &ch).c_str());\n}\n\n// wchar_t pointer vs pointer\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsPointer) {\n  // In expression 'p == x', where 'p' and 'x' are (const or not) char\n  // pointers, the operands are compared by pointer.  Therefore we\n  // want to print 'p' as a pointer instead of a wide C string (we don't\n  // even know if it's supposed to point to a valid wide C string).\n\n  // const wchar_t*\n  const wchar_t* s = L\"hello\";\n  EXPECT_EQ(PrintPointer(s),\n            FormatForComparisonFailureMessage(s, s).c_str());\n\n  // wchar_t*\n  wchar_t ch = L'a';\n  EXPECT_EQ(PrintPointer(&ch),\n            FormatForComparisonFailureMessage(&ch, &ch).c_str());\n}\n\n// Tests formatting a char pointer when it's compared to a string object.\n// In this case we want to print the char pointer as a C string.\n\n#if GTEST_HAS_GLOBAL_STRING\n// char pointer vs ::string\nTEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsString) {\n  const char* s = \"hello \\\"world\";\n  EXPECT_STREQ(\"\\\"hello \\\\\\\"world\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(s, ::string()).c_str());\n\n  // char*\n  char str[] = \"hi\\1\";\n  char* p = str;\n  EXPECT_STREQ(\"\\\"hi\\\\x1\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(p, ::string()).c_str());\n}\n#endif\n\n// char pointer vs std::string\nTEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsStdString) {\n  const char* s = \"hello \\\"world\";\n  EXPECT_STREQ(\"\\\"hello \\\\\\\"world\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(s, ::std::string()).c_str());\n\n  // char*\n  char str[] = \"hi\\1\";\n  char* p = str;\n  EXPECT_STREQ(\"\\\"hi\\\\x1\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(p, ::std::string()).c_str());\n}\n\n#if GTEST_HAS_GLOBAL_WSTRING\n// wchar_t pointer vs ::wstring\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsWString) {\n  const wchar_t* s = L\"hi \\\"world\";\n  EXPECT_STREQ(\"L\\\"hi \\\\\\\"world\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(s, ::wstring()).c_str());\n\n  // wchar_t*\n  wchar_t str[] = L\"hi\\1\";\n  wchar_t* p = str;\n  EXPECT_STREQ(\"L\\\"hi\\\\x1\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(p, ::wstring()).c_str());\n}\n#endif\n\n#if GTEST_HAS_STD_WSTRING\n// wchar_t pointer vs std::wstring\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsStdWString) {\n  const wchar_t* s = L\"hi \\\"world\";\n  EXPECT_STREQ(\"L\\\"hi \\\\\\\"world\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(s, ::std::wstring()).c_str());\n\n  // wchar_t*\n  wchar_t str[] = L\"hi\\1\";\n  wchar_t* p = str;\n  EXPECT_STREQ(\"L\\\"hi\\\\x1\\\"\",  // The string content should be escaped.\n               FormatForComparisonFailureMessage(p, ::std::wstring()).c_str());\n}\n#endif\n\n// Tests formatting a char array when it's compared with a pointer or array.\n// In this case we want to print the array as a row pointer, as the comparison\n// is by pointer.\n\n// char array vs pointer\nTEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsPointer) {\n  char str[] = \"hi \\\"world\\\"\";\n  char* p = NULL;\n  EXPECT_EQ(PrintPointer(str),\n            FormatForComparisonFailureMessage(str, p).c_str());\n}\n\n// char array vs char array\nTEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsCharArray) {\n  const char str[] = \"hi \\\"world\\\"\";\n  EXPECT_EQ(PrintPointer(str),\n            FormatForComparisonFailureMessage(str, str).c_str());\n}\n\n// wchar_t array vs pointer\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsPointer) {\n  wchar_t str[] = L\"hi \\\"world\\\"\";\n  wchar_t* p = NULL;\n  EXPECT_EQ(PrintPointer(str),\n            FormatForComparisonFailureMessage(str, p).c_str());\n}\n\n// wchar_t array vs wchar_t array\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWCharArray) {\n  const wchar_t str[] = L\"hi \\\"world\\\"\";\n  EXPECT_EQ(PrintPointer(str),\n            FormatForComparisonFailureMessage(str, str).c_str());\n}\n\n// Tests formatting a char array when it's compared with a string object.\n// In this case we want to print the array as a C string.\n\n#if GTEST_HAS_GLOBAL_STRING\n// char array vs string\nTEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsString) {\n  const char str[] = \"hi \\\"w\\0rld\\\"\";\n  EXPECT_STREQ(\"\\\"hi \\\\\\\"w\\\"\",  // The content should be escaped.\n                                // Embedded NUL terminates the string.\n               FormatForComparisonFailureMessage(str, ::string()).c_str());\n}\n#endif\n\n// char array vs std::string\nTEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsStdString) {\n  const char str[] = \"hi \\\"world\\\"\";\n  EXPECT_STREQ(\"\\\"hi \\\\\\\"world\\\\\\\"\\\"\",  // The content should be escaped.\n               FormatForComparisonFailureMessage(str, ::std::string()).c_str());\n}\n\n#if GTEST_HAS_GLOBAL_WSTRING\n// wchar_t array vs wstring\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWString) {\n  const wchar_t str[] = L\"hi \\\"world\\\"\";\n  EXPECT_STREQ(\"L\\\"hi \\\\\\\"world\\\\\\\"\\\"\",  // The content should be escaped.\n               FormatForComparisonFailureMessage(str, ::wstring()).c_str());\n}\n#endif\n\n#if GTEST_HAS_STD_WSTRING\n// wchar_t array vs std::wstring\nTEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsStdWString) {\n  const wchar_t str[] = L\"hi \\\"w\\0rld\\\"\";\n  EXPECT_STREQ(\n      \"L\\\"hi \\\\\\\"w\\\"\",  // The content should be escaped.\n                        // Embedded NUL terminates the string.\n      FormatForComparisonFailureMessage(str, ::std::wstring()).c_str());\n}\n#endif\n\n// Useful for testing PrintToString().  We cannot use EXPECT_EQ()\n// there as its implementation uses PrintToString().  The caller must\n// ensure that 'value' has no side effect.\n#define EXPECT_PRINT_TO_STRING_(value, expected_string)         \\\n  EXPECT_TRUE(PrintToString(value) == (expected_string))        \\\n      << \" where \" #value \" prints as \" << (PrintToString(value))\n\nTEST(PrintToStringTest, WorksForScalar) {\n  EXPECT_PRINT_TO_STRING_(123, \"123\");\n}\n\nTEST(PrintToStringTest, WorksForPointerToConstChar) {\n  const char* p = \"hello\";\n  EXPECT_PRINT_TO_STRING_(p, \"\\\"hello\\\"\");\n}\n\nTEST(PrintToStringTest, WorksForPointerToNonConstChar) {\n  char s[] = \"hello\";\n  char* p = s;\n  EXPECT_PRINT_TO_STRING_(p, \"\\\"hello\\\"\");\n}\n\nTEST(PrintToStringTest, EscapesForPointerToConstChar) {\n  const char* p = \"hello\\n\";\n  EXPECT_PRINT_TO_STRING_(p, \"\\\"hello\\\\n\\\"\");\n}\n\nTEST(PrintToStringTest, EscapesForPointerToNonConstChar) {\n  char s[] = \"hello\\1\";\n  char* p = s;\n  EXPECT_PRINT_TO_STRING_(p, \"\\\"hello\\\\x1\\\"\");\n}\n\nTEST(PrintToStringTest, WorksForArray) {\n  int n[3] = { 1, 2, 3 };\n  EXPECT_PRINT_TO_STRING_(n, \"{ 1, 2, 3 }\");\n}\n\nTEST(PrintToStringTest, WorksForCharArray) {\n  char s[] = \"hello\";\n  EXPECT_PRINT_TO_STRING_(s, \"\\\"hello\\\"\");\n}\n\nTEST(PrintToStringTest, WorksForCharArrayWithEmbeddedNul) {\n  const char str_with_nul[] = \"hello\\0 world\";\n  EXPECT_PRINT_TO_STRING_(str_with_nul, \"\\\"hello\\\\0 world\\\"\");\n\n  char mutable_str_with_nul[] = \"hello\\0 world\";\n  EXPECT_PRINT_TO_STRING_(mutable_str_with_nul, \"\\\"hello\\\\0 world\\\"\");\n}\n\n#undef EXPECT_PRINT_TO_STRING_\n\nTEST(UniversalTersePrintTest, WorksForNonReference) {\n  ::std::stringstream ss;\n  UniversalTersePrint(123, &ss);\n  EXPECT_EQ(\"123\", ss.str());\n}\n\nTEST(UniversalTersePrintTest, WorksForReference) {\n  const int& n = 123;\n  ::std::stringstream ss;\n  UniversalTersePrint(n, &ss);\n  EXPECT_EQ(\"123\", ss.str());\n}\n\nTEST(UniversalTersePrintTest, WorksForCString) {\n  const char* s1 = \"abc\";\n  ::std::stringstream ss1;\n  UniversalTersePrint(s1, &ss1);\n  EXPECT_EQ(\"\\\"abc\\\"\", ss1.str());\n\n  char* s2 = const_cast<char*>(s1);\n  ::std::stringstream ss2;\n  UniversalTersePrint(s2, &ss2);\n  EXPECT_EQ(\"\\\"abc\\\"\", ss2.str());\n\n  const char* s3 = NULL;\n  ::std::stringstream ss3;\n  UniversalTersePrint(s3, &ss3);\n  EXPECT_EQ(\"NULL\", ss3.str());\n}\n\nTEST(UniversalPrintTest, WorksForNonReference) {\n  ::std::stringstream ss;\n  UniversalPrint(123, &ss);\n  EXPECT_EQ(\"123\", ss.str());\n}\n\nTEST(UniversalPrintTest, WorksForReference) {\n  const int& n = 123;\n  ::std::stringstream ss;\n  UniversalPrint(n, &ss);\n  EXPECT_EQ(\"123\", ss.str());\n}\n\nTEST(UniversalPrintTest, WorksForCString) {\n  const char* s1 = \"abc\";\n  ::std::stringstream ss1;\n  UniversalPrint(s1, &ss1);\n  EXPECT_EQ(PrintPointer(s1) + \" pointing to \\\"abc\\\"\", string(ss1.str()));\n\n  char* s2 = const_cast<char*>(s1);\n  ::std::stringstream ss2;\n  UniversalPrint(s2, &ss2);\n  EXPECT_EQ(PrintPointer(s2) + \" pointing to \\\"abc\\\"\", string(ss2.str()));\n\n  const char* s3 = NULL;\n  ::std::stringstream ss3;\n  UniversalPrint(s3, &ss3);\n  EXPECT_EQ(\"NULL\", ss3.str());\n}\n\nTEST(UniversalPrintTest, WorksForCharArray) {\n  const char str[] = \"\\\"Line\\0 1\\\"\\nLine 2\";\n  ::std::stringstream ss1;\n  UniversalPrint(str, &ss1);\n  EXPECT_EQ(\"\\\"\\\\\\\"Line\\\\0 1\\\\\\\"\\\\nLine 2\\\"\", ss1.str());\n\n  const char mutable_str[] = \"\\\"Line\\0 1\\\"\\nLine 2\";\n  ::std::stringstream ss2;\n  UniversalPrint(mutable_str, &ss2);\n  EXPECT_EQ(\"\\\"\\\\\\\"Line\\\\0 1\\\\\\\"\\\\nLine 2\\\"\", ss2.str());\n}\n\n#if GTEST_HAS_TR1_TUPLE\n\nTEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsEmptyTuple) {\n  Strings result = UniversalTersePrintTupleFieldsToStrings(make_tuple());\n  EXPECT_EQ(0u, result.size());\n}\n\nTEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsOneTuple) {\n  Strings result = UniversalTersePrintTupleFieldsToStrings(make_tuple(1));\n  ASSERT_EQ(1u, result.size());\n  EXPECT_EQ(\"1\", result[0]);\n}\n\nTEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsTwoTuple) {\n  Strings result = UniversalTersePrintTupleFieldsToStrings(make_tuple(1, 'a'));\n  ASSERT_EQ(2u, result.size());\n  EXPECT_EQ(\"1\", result[0]);\n  EXPECT_EQ(\"'a' (97, 0x61)\", result[1]);\n}\n\nTEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsTersely) {\n  const int n = 1;\n  Strings result = UniversalTersePrintTupleFieldsToStrings(\n      tuple<const int&, const char*>(n, \"a\"));\n  ASSERT_EQ(2u, result.size());\n  EXPECT_EQ(\"1\", result[0]);\n  EXPECT_EQ(\"\\\"a\\\"\", result[1]);\n}\n\n#endif  // GTEST_HAS_TR1_TUPLE\n\n}  // namespace gtest_printers_test\n}  // namespace testing\n"
  },
  {
    "path": "Tests/gtest/test/gtest-test-part_test.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n\n#include \"gtest/gtest-test-part.h\"\n\n#include \"gtest/gtest.h\"\n\nusing testing::Message;\nusing testing::Test;\nusing testing::TestPartResult;\nusing testing::TestPartResultArray;\n\nnamespace {\n\n// Tests the TestPartResult class.\n\n// The test fixture for testing TestPartResult.\nclass TestPartResultTest : public Test {\n protected:\n  TestPartResultTest()\n      : r1_(TestPartResult::kSuccess, \"foo/bar.cc\", 10, \"Success!\"),\n        r2_(TestPartResult::kNonFatalFailure, \"foo/bar.cc\", -1, \"Failure!\"),\n        r3_(TestPartResult::kFatalFailure, NULL, -1, \"Failure!\") {}\n\n  TestPartResult r1_, r2_, r3_;\n};\n\n\nTEST_F(TestPartResultTest, ConstructorWorks) {\n  Message message;\n  message << \"something is terribly wrong\";\n  message << static_cast<const char*>(testing::internal::kStackTraceMarker);\n  message << \"some unimportant stack trace\";\n\n  const TestPartResult result(TestPartResult::kNonFatalFailure,\n                              \"some_file.cc\",\n                              42,\n                              message.GetString().c_str());\n\n  EXPECT_EQ(TestPartResult::kNonFatalFailure, result.type());\n  EXPECT_STREQ(\"some_file.cc\", result.file_name());\n  EXPECT_EQ(42, result.line_number());\n  EXPECT_STREQ(message.GetString().c_str(), result.message());\n  EXPECT_STREQ(\"something is terribly wrong\", result.summary());\n}\n\nTEST_F(TestPartResultTest, ResultAccessorsWork) {\n  const TestPartResult success(TestPartResult::kSuccess,\n                               \"file.cc\",\n                               42,\n                               \"message\");\n  EXPECT_TRUE(success.passed());\n  EXPECT_FALSE(success.failed());\n  EXPECT_FALSE(success.nonfatally_failed());\n  EXPECT_FALSE(success.fatally_failed());\n\n  const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure,\n                                        \"file.cc\",\n                                        42,\n                                        \"message\");\n  EXPECT_FALSE(nonfatal_failure.passed());\n  EXPECT_TRUE(nonfatal_failure.failed());\n  EXPECT_TRUE(nonfatal_failure.nonfatally_failed());\n  EXPECT_FALSE(nonfatal_failure.fatally_failed());\n\n  const TestPartResult fatal_failure(TestPartResult::kFatalFailure,\n                                     \"file.cc\",\n                                     42,\n                                     \"message\");\n  EXPECT_FALSE(fatal_failure.passed());\n  EXPECT_TRUE(fatal_failure.failed());\n  EXPECT_FALSE(fatal_failure.nonfatally_failed());\n  EXPECT_TRUE(fatal_failure.fatally_failed());\n}\n\n// Tests TestPartResult::type().\nTEST_F(TestPartResultTest, type) {\n  EXPECT_EQ(TestPartResult::kSuccess, r1_.type());\n  EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type());\n  EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type());\n}\n\n// Tests TestPartResult::file_name().\nTEST_F(TestPartResultTest, file_name) {\n  EXPECT_STREQ(\"foo/bar.cc\", r1_.file_name());\n  EXPECT_STREQ(NULL, r3_.file_name());\n}\n\n// Tests TestPartResult::line_number().\nTEST_F(TestPartResultTest, line_number) {\n  EXPECT_EQ(10, r1_.line_number());\n  EXPECT_EQ(-1, r2_.line_number());\n}\n\n// Tests TestPartResult::message().\nTEST_F(TestPartResultTest, message) {\n  EXPECT_STREQ(\"Success!\", r1_.message());\n}\n\n// Tests TestPartResult::passed().\nTEST_F(TestPartResultTest, Passed) {\n  EXPECT_TRUE(r1_.passed());\n  EXPECT_FALSE(r2_.passed());\n  EXPECT_FALSE(r3_.passed());\n}\n\n// Tests TestPartResult::failed().\nTEST_F(TestPartResultTest, Failed) {\n  EXPECT_FALSE(r1_.failed());\n  EXPECT_TRUE(r2_.failed());\n  EXPECT_TRUE(r3_.failed());\n}\n\n// Tests TestPartResult::fatally_failed().\nTEST_F(TestPartResultTest, FatallyFailed) {\n  EXPECT_FALSE(r1_.fatally_failed());\n  EXPECT_FALSE(r2_.fatally_failed());\n  EXPECT_TRUE(r3_.fatally_failed());\n}\n\n// Tests TestPartResult::nonfatally_failed().\nTEST_F(TestPartResultTest, NonfatallyFailed) {\n  EXPECT_FALSE(r1_.nonfatally_failed());\n  EXPECT_TRUE(r2_.nonfatally_failed());\n  EXPECT_FALSE(r3_.nonfatally_failed());\n}\n\n// Tests the TestPartResultArray class.\n\nclass TestPartResultArrayTest : public Test {\n protected:\n  TestPartResultArrayTest()\n      : r1_(TestPartResult::kNonFatalFailure, \"foo/bar.cc\", -1, \"Failure 1\"),\n        r2_(TestPartResult::kFatalFailure, \"foo/bar.cc\", -1, \"Failure 2\") {}\n\n  const TestPartResult r1_, r2_;\n};\n\n// Tests that TestPartResultArray initially has size 0.\nTEST_F(TestPartResultArrayTest, InitialSizeIsZero) {\n  TestPartResultArray results;\n  EXPECT_EQ(0, results.size());\n}\n\n// Tests that TestPartResultArray contains the given TestPartResult\n// after one Append() operation.\nTEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {\n  TestPartResultArray results;\n  results.Append(r1_);\n  EXPECT_EQ(1, results.size());\n  EXPECT_STREQ(\"Failure 1\", results.GetTestPartResult(0).message());\n}\n\n// Tests that TestPartResultArray contains the given TestPartResults\n// after two Append() operations.\nTEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {\n  TestPartResultArray results;\n  results.Append(r1_);\n  results.Append(r2_);\n  EXPECT_EQ(2, results.size());\n  EXPECT_STREQ(\"Failure 1\", results.GetTestPartResult(0).message());\n  EXPECT_STREQ(\"Failure 2\", results.GetTestPartResult(1).message());\n}\n\ntypedef TestPartResultArrayTest TestPartResultArrayDeathTest;\n\n// Tests that the program dies when GetTestPartResult() is called with\n// an invalid index.\nTEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {\n  TestPartResultArray results;\n  results.Append(r1_);\n\n  EXPECT_DEATH_IF_SUPPORTED(results.GetTestPartResult(-1), \"\");\n  EXPECT_DEATH_IF_SUPPORTED(results.GetTestPartResult(1), \"\");\n}\n\n// TODO(mheule@google.com): Add a test for the class HasNewFatalFailureHelper.\n\n}  // namespace\n"
  },
  {
    "path": "Tests/gtest/test/gtest-tuple_test.cc",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/internal/gtest-tuple.h\"\n#include <utility>\n#include \"gtest/gtest.h\"\n\nnamespace {\n\nusing ::std::tr1::get;\nusing ::std::tr1::make_tuple;\nusing ::std::tr1::tuple;\nusing ::std::tr1::tuple_element;\nusing ::std::tr1::tuple_size;\nusing ::testing::StaticAssertTypeEq;\n\n// Tests that tuple_element<K, tuple<T0, T1, ..., TN> >::type returns TK.\nTEST(tuple_element_Test, ReturnsElementType) {\n  StaticAssertTypeEq<int, tuple_element<0, tuple<int, char> >::type>();\n  StaticAssertTypeEq<int&, tuple_element<1, tuple<double, int&> >::type>();\n  StaticAssertTypeEq<bool, tuple_element<2, tuple<double, int, bool> >::type>();\n}\n\n// Tests that tuple_size<T>::value gives the number of fields in tuple\n// type T.\nTEST(tuple_size_Test, ReturnsNumberOfFields) {\n  EXPECT_EQ(0, +tuple_size<tuple<> >::value);\n  EXPECT_EQ(1, +tuple_size<tuple<void*> >::value);\n  EXPECT_EQ(1, +tuple_size<tuple<char> >::value);\n  EXPECT_EQ(1, +(tuple_size<tuple<tuple<int, double> > >::value));\n  EXPECT_EQ(2, +(tuple_size<tuple<int&, const char> >::value));\n  EXPECT_EQ(3, +(tuple_size<tuple<char*, void, const bool&> >::value));\n}\n\n// Tests comparing a tuple with itself.\nTEST(ComparisonTest, ComparesWithSelf) {\n  const tuple<int, char, bool> a(5, 'a', false);\n\n  EXPECT_TRUE(a == a);\n  EXPECT_FALSE(a != a);\n}\n\n// Tests comparing two tuples with the same value.\nTEST(ComparisonTest, ComparesEqualTuples) {\n  const tuple<int, bool> a(5, true), b(5, true);\n\n  EXPECT_TRUE(a == b);\n  EXPECT_FALSE(a != b);\n}\n\n// Tests comparing two different tuples that have no reference fields.\nTEST(ComparisonTest, ComparesUnequalTuplesWithoutReferenceFields) {\n  typedef tuple<const int, char> FooTuple;\n\n  const FooTuple a(0, 'x');\n  const FooTuple b(1, 'a');\n\n  EXPECT_TRUE(a != b);\n  EXPECT_FALSE(a == b);\n\n  const FooTuple c(1, 'b');\n\n  EXPECT_TRUE(b != c);\n  EXPECT_FALSE(b == c);\n}\n\n// Tests comparing two different tuples that have reference fields.\nTEST(ComparisonTest, ComparesUnequalTuplesWithReferenceFields) {\n  typedef tuple<int&, const char&> FooTuple;\n\n  int i = 5;\n  const char ch = 'a';\n  const FooTuple a(i, ch);\n\n  int j = 6;\n  const FooTuple b(j, ch);\n\n  EXPECT_TRUE(a != b);\n  EXPECT_FALSE(a == b);\n\n  j = 5;\n  const char ch2 = 'b';\n  const FooTuple c(j, ch2);\n\n  EXPECT_TRUE(b != c);\n  EXPECT_FALSE(b == c);\n}\n\n// Tests that a tuple field with a reference type is an alias of the\n// variable it's supposed to reference.\nTEST(ReferenceFieldTest, IsAliasOfReferencedVariable) {\n  int n = 0;\n  tuple<bool, int&> t(true, n);\n\n  n = 1;\n  EXPECT_EQ(n, get<1>(t))\n      << \"Changing a underlying variable should update the reference field.\";\n\n  // Makes sure that the implementation doesn't do anything funny with\n  // the & operator for the return type of get<>().\n  EXPECT_EQ(&n, &(get<1>(t)))\n      << \"The address of a reference field should equal the address of \"\n      << \"the underlying variable.\";\n\n  get<1>(t) = 2;\n  EXPECT_EQ(2, n)\n      << \"Changing a reference field should update the underlying variable.\";\n}\n\n// Tests that tuple's default constructor default initializes each field.\n// This test needs to compile without generating warnings.\nTEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) {\n  // The TR1 report requires that tuple's default constructor default\n  // initializes each field, even if it's a primitive type.  If the\n  // implementation forgets to do this, this test will catch it by\n  // generating warnings about using uninitialized variables (assuming\n  // a decent compiler).\n\n  tuple<> empty;\n\n  tuple<int> a1, b1;\n  b1 = a1;\n  EXPECT_EQ(0, get<0>(b1));\n\n  tuple<int, double> a2, b2;\n  b2 = a2;\n  EXPECT_EQ(0, get<0>(b2));\n  EXPECT_EQ(0.0, get<1>(b2));\n\n  tuple<double, char, bool*> a3, b3;\n  b3 = a3;\n  EXPECT_EQ(0.0, get<0>(b3));\n  EXPECT_EQ('\\0', get<1>(b3));\n  EXPECT_TRUE(get<2>(b3) == NULL);\n\n  tuple<int, int, int, int, int, int, int, int, int, int> a10, b10;\n  b10 = a10;\n  EXPECT_EQ(0, get<0>(b10));\n  EXPECT_EQ(0, get<1>(b10));\n  EXPECT_EQ(0, get<2>(b10));\n  EXPECT_EQ(0, get<3>(b10));\n  EXPECT_EQ(0, get<4>(b10));\n  EXPECT_EQ(0, get<5>(b10));\n  EXPECT_EQ(0, get<6>(b10));\n  EXPECT_EQ(0, get<7>(b10));\n  EXPECT_EQ(0, get<8>(b10));\n  EXPECT_EQ(0, get<9>(b10));\n}\n\n// Tests constructing a tuple from its fields.\nTEST(TupleConstructorTest, ConstructsFromFields) {\n  int n = 1;\n  // Reference field.\n  tuple<int&> a(n);\n  EXPECT_EQ(&n, &(get<0>(a)));\n\n  // Non-reference fields.\n  tuple<int, char> b(5, 'a');\n  EXPECT_EQ(5, get<0>(b));\n  EXPECT_EQ('a', get<1>(b));\n\n  // Const reference field.\n  const int m = 2;\n  tuple<bool, const int&> c(true, m);\n  EXPECT_TRUE(get<0>(c));\n  EXPECT_EQ(&m, &(get<1>(c)));\n}\n\n// Tests tuple's copy constructor.\nTEST(TupleConstructorTest, CopyConstructor) {\n  tuple<double, bool> a(0.0, true);\n  tuple<double, bool> b(a);\n\n  EXPECT_DOUBLE_EQ(0.0, get<0>(b));\n  EXPECT_TRUE(get<1>(b));\n}\n\n// Tests constructing a tuple from another tuple that has a compatible\n// but different type.\nTEST(TupleConstructorTest, ConstructsFromDifferentTupleType) {\n  tuple<int, int, char> a(0, 1, 'a');\n  tuple<double, long, int> b(a);\n\n  EXPECT_DOUBLE_EQ(0.0, get<0>(b));\n  EXPECT_EQ(1, get<1>(b));\n  EXPECT_EQ('a', get<2>(b));\n}\n\n// Tests constructing a 2-tuple from an std::pair.\nTEST(TupleConstructorTest, ConstructsFromPair) {\n  ::std::pair<int, char> a(1, 'a');\n  tuple<int, char> b(a);\n  tuple<int, const char&> c(a);\n}\n\n// Tests assigning a tuple to another tuple with the same type.\nTEST(TupleAssignmentTest, AssignsToSameTupleType) {\n  const tuple<int, long> a(5, 7L);\n  tuple<int, long> b;\n  b = a;\n  EXPECT_EQ(5, get<0>(b));\n  EXPECT_EQ(7L, get<1>(b));\n}\n\n// Tests assigning a tuple to another tuple with a different but\n// compatible type.\nTEST(TupleAssignmentTest, AssignsToDifferentTupleType) {\n  const tuple<int, long, bool> a(1, 7L, true);\n  tuple<long, int, bool> b;\n  b = a;\n  EXPECT_EQ(1L, get<0>(b));\n  EXPECT_EQ(7, get<1>(b));\n  EXPECT_TRUE(get<2>(b));\n}\n\n// Tests assigning an std::pair to a 2-tuple.\nTEST(TupleAssignmentTest, AssignsFromPair) {\n  const ::std::pair<int, bool> a(5, true);\n  tuple<int, bool> b;\n  b = a;\n  EXPECT_EQ(5, get<0>(b));\n  EXPECT_TRUE(get<1>(b));\n\n  tuple<long, bool> c;\n  c = a;\n  EXPECT_EQ(5L, get<0>(c));\n  EXPECT_TRUE(get<1>(c));\n}\n\n// A fixture for testing big tuples.\nclass BigTupleTest : public testing::Test {\n protected:\n  typedef tuple<int, int, int, int, int, int, int, int, int, int> BigTuple;\n\n  BigTupleTest() :\n      a_(1, 0, 0, 0, 0, 0, 0, 0, 0, 2),\n      b_(1, 0, 0, 0, 0, 0, 0, 0, 0, 3) {}\n\n  BigTuple a_, b_;\n};\n\n// Tests constructing big tuples.\nTEST_F(BigTupleTest, Construction) {\n  BigTuple a;\n  BigTuple b(b_);\n}\n\n// Tests that get<N>(t) returns the N-th (0-based) field of tuple t.\nTEST_F(BigTupleTest, get) {\n  EXPECT_EQ(1, get<0>(a_));\n  EXPECT_EQ(2, get<9>(a_));\n\n  // Tests that get() works on a const tuple too.\n  const BigTuple a(a_);\n  EXPECT_EQ(1, get<0>(a));\n  EXPECT_EQ(2, get<9>(a));\n}\n\n// Tests comparing big tuples.\nTEST_F(BigTupleTest, Comparisons) {\n  EXPECT_TRUE(a_ == a_);\n  EXPECT_FALSE(a_ != a_);\n\n  EXPECT_TRUE(a_ != b_);\n  EXPECT_FALSE(a_ == b_);\n}\n\nTEST(MakeTupleTest, WorksForScalarTypes) {\n  tuple<bool, int> a;\n  a = make_tuple(true, 5);\n  EXPECT_TRUE(get<0>(a));\n  EXPECT_EQ(5, get<1>(a));\n\n  tuple<char, int, long> b;\n  b = make_tuple('a', 'b', 5);\n  EXPECT_EQ('a', get<0>(b));\n  EXPECT_EQ('b', get<1>(b));\n  EXPECT_EQ(5, get<2>(b));\n}\n\nTEST(MakeTupleTest, WorksForPointers) {\n  int a[] = { 1, 2, 3, 4 };\n  const char* const str = \"hi\";\n  int* const p = a;\n\n  tuple<const char*, int*> t;\n  t = make_tuple(str, p);\n  EXPECT_EQ(str, get<0>(t));\n  EXPECT_EQ(p, get<1>(t));\n}\n\n}  // namespace\n"
  },
  {
    "path": "Tests/gtest/test/gtest-typed-test2_test.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include <vector>\n\n#include \"test/gtest-typed-test_test.h\"\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_TYPED_TEST_P\n\n// Tests that the same type-parameterized test case can be\n// instantiated in different translation units linked together.\n// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)\nINSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest,\n                              testing::Types<std::vector<int> >);\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n"
  },
  {
    "path": "Tests/gtest/test/gtest-typed-test_test.cc",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include <set>\n#include <vector>\n\n#include \"test/gtest-typed-test_test.h\"\n#include \"gtest/gtest.h\"\n\nusing testing::Test;\n\n// Used for testing that SetUpTestCase()/TearDownTestCase(), fixture\n// ctor/dtor, and SetUp()/TearDown() work correctly in typed tests and\n// type-parameterized test.\ntemplate <typename T>\nclass CommonTest : public Test {\n  // For some technical reason, SetUpTestCase() and TearDownTestCase()\n  // must be public.\n public:\n  static void SetUpTestCase() {\n    shared_ = new T(5);\n  }\n\n  static void TearDownTestCase() {\n    delete shared_;\n    shared_ = NULL;\n  }\n\n  // This 'protected:' is optional.  There's no harm in making all\n  // members of this fixture class template public.\n protected:\n  // We used to use std::list here, but switched to std::vector since\n  // MSVC's <list> doesn't compile cleanly with /W4.\n  typedef std::vector<T> Vector;\n  typedef std::set<int> IntSet;\n\n  CommonTest() : value_(1) {}\n\n  virtual ~CommonTest() { EXPECT_EQ(3, value_); }\n\n  virtual void SetUp() {\n    EXPECT_EQ(1, value_);\n    value_++;\n  }\n\n  virtual void TearDown() {\n    EXPECT_EQ(2, value_);\n    value_++;\n  }\n\n  T value_;\n  static T* shared_;\n};\n\ntemplate <typename T>\nT* CommonTest<T>::shared_ = NULL;\n\n// This #ifdef block tests typed tests.\n#if GTEST_HAS_TYPED_TEST\n\nusing testing::Types;\n\n// Tests that SetUpTestCase()/TearDownTestCase(), fixture ctor/dtor,\n// and SetUp()/TearDown() work correctly in typed tests\n\ntypedef Types<char, int> TwoTypes;\nTYPED_TEST_CASE(CommonTest, TwoTypes);\n\nTYPED_TEST(CommonTest, ValuesAreCorrect) {\n  // Static members of the fixture class template can be visited via\n  // the TestFixture:: prefix.\n  EXPECT_EQ(5, *TestFixture::shared_);\n\n  // Typedefs in the fixture class template can be visited via the\n  // \"typename TestFixture::\" prefix.\n  typename TestFixture::Vector empty;\n  EXPECT_EQ(0U, empty.size());\n\n  typename TestFixture::IntSet empty2;\n  EXPECT_EQ(0U, empty2.size());\n\n  // Non-static members of the fixture class must be visited via\n  // 'this', as required by C++ for class templates.\n  EXPECT_EQ(2, this->value_);\n}\n\n// The second test makes sure shared_ is not deleted after the first\n// test.\nTYPED_TEST(CommonTest, ValuesAreStillCorrect) {\n  // Static members of the fixture class template can also be visited\n  // via 'this'.\n  ASSERT_TRUE(this->shared_ != NULL);\n  EXPECT_EQ(5, *this->shared_);\n\n  // TypeParam can be used to refer to the type parameter.\n  EXPECT_EQ(static_cast<TypeParam>(2), this->value_);\n}\n\n// Tests that multiple TYPED_TEST_CASE's can be defined in the same\n// translation unit.\n\ntemplate <typename T>\nclass TypedTest1 : public Test {\n};\n\n// Verifies that the second argument of TYPED_TEST_CASE can be a\n// single type.\nTYPED_TEST_CASE(TypedTest1, int);\nTYPED_TEST(TypedTest1, A) {}\n\ntemplate <typename T>\nclass TypedTest2 : public Test {\n};\n\n// Verifies that the second argument of TYPED_TEST_CASE can be a\n// Types<...> type list.\nTYPED_TEST_CASE(TypedTest2, Types<int>);\n\n// This also verifies that tests from different typed test cases can\n// share the same name.\nTYPED_TEST(TypedTest2, A) {}\n\n// Tests that a typed test case can be defined in a namespace.\n\nnamespace library1 {\n\ntemplate <typename T>\nclass NumericTest : public Test {\n};\n\ntypedef Types<int, long> NumericTypes;\nTYPED_TEST_CASE(NumericTest, NumericTypes);\n\nTYPED_TEST(NumericTest, DefaultIsZero) {\n  EXPECT_EQ(0, TypeParam());\n}\n\n}  // namespace library1\n\n#endif  // GTEST_HAS_TYPED_TEST\n\n// This #ifdef block tests type-parameterized tests.\n#if GTEST_HAS_TYPED_TEST_P\n\nusing testing::Types;\nusing testing::internal::TypedTestCasePState;\n\n// Tests TypedTestCasePState.\n\nclass TypedTestCasePStateTest : public Test {\n protected:\n  virtual void SetUp() {\n    state_.AddTestName(\"foo.cc\", 0, \"FooTest\", \"A\");\n    state_.AddTestName(\"foo.cc\", 0, \"FooTest\", \"B\");\n    state_.AddTestName(\"foo.cc\", 0, \"FooTest\", \"C\");\n  }\n\n  TypedTestCasePState state_;\n};\n\nTEST_F(TypedTestCasePStateTest, SucceedsForMatchingList) {\n  const char* tests = \"A, B, C\";\n  EXPECT_EQ(tests,\n            state_.VerifyRegisteredTestNames(\"foo.cc\", 1, tests));\n}\n\n// Makes sure that the order of the tests and spaces around the names\n// don't matter.\nTEST_F(TypedTestCasePStateTest, IgnoresOrderAndSpaces) {\n  const char* tests = \"A,C,   B\";\n  EXPECT_EQ(tests,\n            state_.VerifyRegisteredTestNames(\"foo.cc\", 1, tests));\n}\n\ntypedef TypedTestCasePStateTest TypedTestCasePStateDeathTest;\n\nTEST_F(TypedTestCasePStateDeathTest, DetectsDuplicates) {\n  EXPECT_DEATH_IF_SUPPORTED(\n      state_.VerifyRegisteredTestNames(\"foo.cc\", 1, \"A, B, A, C\"),\n      \"foo\\\\.cc.1.?: Test A is listed more than once\\\\.\");\n}\n\nTEST_F(TypedTestCasePStateDeathTest, DetectsExtraTest) {\n  EXPECT_DEATH_IF_SUPPORTED(\n      state_.VerifyRegisteredTestNames(\"foo.cc\", 1, \"A, B, C, D\"),\n      \"foo\\\\.cc.1.?: No test named D can be found in this test case\\\\.\");\n}\n\nTEST_F(TypedTestCasePStateDeathTest, DetectsMissedTest) {\n  EXPECT_DEATH_IF_SUPPORTED(\n      state_.VerifyRegisteredTestNames(\"foo.cc\", 1, \"A, C\"),\n      \"foo\\\\.cc.1.?: You forgot to list test B\\\\.\");\n}\n\n// Tests that defining a test for a parameterized test case generates\n// a run-time error if the test case has been registered.\nTEST_F(TypedTestCasePStateDeathTest, DetectsTestAfterRegistration) {\n  state_.VerifyRegisteredTestNames(\"foo.cc\", 1, \"A, B, C\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      state_.AddTestName(\"foo.cc\", 2, \"FooTest\", \"D\"),\n      \"foo\\\\.cc.2.?: Test D must be defined before REGISTER_TYPED_TEST_CASE_P\"\n      \"\\\\(FooTest, \\\\.\\\\.\\\\.\\\\)\\\\.\");\n}\n\n// Tests that SetUpTestCase()/TearDownTestCase(), fixture ctor/dtor,\n// and SetUp()/TearDown() work correctly in type-parameterized tests.\n\ntemplate <typename T>\nclass DerivedTest : public CommonTest<T> {\n};\n\nTYPED_TEST_CASE_P(DerivedTest);\n\nTYPED_TEST_P(DerivedTest, ValuesAreCorrect) {\n  // Static members of the fixture class template can be visited via\n  // the TestFixture:: prefix.\n  EXPECT_EQ(5, *TestFixture::shared_);\n\n  // Non-static members of the fixture class must be visited via\n  // 'this', as required by C++ for class templates.\n  EXPECT_EQ(2, this->value_);\n}\n\n// The second test makes sure shared_ is not deleted after the first\n// test.\nTYPED_TEST_P(DerivedTest, ValuesAreStillCorrect) {\n  // Static members of the fixture class template can also be visited\n  // via 'this'.\n  ASSERT_TRUE(this->shared_ != NULL);\n  EXPECT_EQ(5, *this->shared_);\n  EXPECT_EQ(2, this->value_);\n}\n\nREGISTER_TYPED_TEST_CASE_P(DerivedTest,\n                           ValuesAreCorrect, ValuesAreStillCorrect);\n\ntypedef Types<short, long> MyTwoTypes;\nINSTANTIATE_TYPED_TEST_CASE_P(My, DerivedTest, MyTwoTypes);\n\n// Tests that multiple TYPED_TEST_CASE_P's can be defined in the same\n// translation unit.\n\ntemplate <typename T>\nclass TypedTestP1 : public Test {\n};\n\nTYPED_TEST_CASE_P(TypedTestP1);\n\n// For testing that the code between TYPED_TEST_CASE_P() and\n// TYPED_TEST_P() is not enclosed in a namespace.\ntypedef int IntAfterTypedTestCaseP;\n\nTYPED_TEST_P(TypedTestP1, A) {}\nTYPED_TEST_P(TypedTestP1, B) {}\n\n// For testing that the code between TYPED_TEST_P() and\n// REGISTER_TYPED_TEST_CASE_P() is not enclosed in a namespace.\ntypedef int IntBeforeRegisterTypedTestCaseP;\n\nREGISTER_TYPED_TEST_CASE_P(TypedTestP1, A, B);\n\ntemplate <typename T>\nclass TypedTestP2 : public Test {\n};\n\nTYPED_TEST_CASE_P(TypedTestP2);\n\n// This also verifies that tests from different type-parameterized\n// test cases can share the same name.\nTYPED_TEST_P(TypedTestP2, A) {}\n\nREGISTER_TYPED_TEST_CASE_P(TypedTestP2, A);\n\n// Verifies that the code between TYPED_TEST_CASE_P() and\n// REGISTER_TYPED_TEST_CASE_P() is not enclosed in a namespace.\nIntAfterTypedTestCaseP after = 0;\nIntBeforeRegisterTypedTestCaseP before = 0;\n\n// Verifies that the last argument of INSTANTIATE_TYPED_TEST_CASE_P()\n// can be either a single type or a Types<...> type list.\nINSTANTIATE_TYPED_TEST_CASE_P(Int, TypedTestP1, int);\nINSTANTIATE_TYPED_TEST_CASE_P(Int, TypedTestP2, Types<int>);\n\n// Tests that the same type-parameterized test case can be\n// instantiated more than once in the same translation unit.\nINSTANTIATE_TYPED_TEST_CASE_P(Double, TypedTestP2, Types<double>);\n\n// Tests that the same type-parameterized test case can be\n// instantiated in different translation units linked together.\n// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)\ntypedef Types<std::vector<double>, std::set<char> > MyContainers;\nINSTANTIATE_TYPED_TEST_CASE_P(My, ContainerTest, MyContainers);\n\n// Tests that a type-parameterized test case can be defined and\n// instantiated in a namespace.\n\nnamespace library2 {\n\ntemplate <typename T>\nclass NumericTest : public Test {\n};\n\nTYPED_TEST_CASE_P(NumericTest);\n\nTYPED_TEST_P(NumericTest, DefaultIsZero) {\n  EXPECT_EQ(0, TypeParam());\n}\n\nTYPED_TEST_P(NumericTest, ZeroIsLessThanOne) {\n  EXPECT_LT(TypeParam(0), TypeParam(1));\n}\n\nREGISTER_TYPED_TEST_CASE_P(NumericTest,\n                           DefaultIsZero, ZeroIsLessThanOne);\ntypedef Types<int, double> NumericTypes;\nINSTANTIATE_TYPED_TEST_CASE_P(My, NumericTest, NumericTypes);\n\n}  // namespace library2\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n#if !defined(GTEST_HAS_TYPED_TEST) && !defined(GTEST_HAS_TYPED_TEST_P)\n\n// Google Test may not support type-parameterized tests with some\n// compilers. If we use conditional compilation to compile out all\n// code referring to the gtest_main library, MSVC linker will not link\n// that library at all and consequently complain about missing entry\n// point defined in that library (fatal error LNK1561: entry point\n// must be defined). This dummy test keeps gtest_main linked in.\nTEST(DummyTest, TypedTestsAreNotSupportedOnThisPlatform) {}\n\n#endif  // #if !defined(GTEST_HAS_TYPED_TEST) && !defined(GTEST_HAS_TYPED_TEST_P)\n"
  },
  {
    "path": "Tests/gtest/test/gtest-typed-test_test.h",
    "content": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#ifndef GTEST_TEST_GTEST_TYPED_TEST_TEST_H_\n#define GTEST_TEST_GTEST_TYPED_TEST_TEST_H_\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_HAS_TYPED_TEST_P\n\nusing testing::Test;\n\n// For testing that the same type-parameterized test case can be\n// instantiated in different translation units linked together.\n// ContainerTest will be instantiated in both gtest-typed-test_test.cc\n// and gtest-typed-test2_test.cc.\n\ntemplate <typename T>\nclass ContainerTest : public Test {\n};\n\nTYPED_TEST_CASE_P(ContainerTest);\n\nTYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) {\n  TypeParam container;\n}\n\nTYPED_TEST_P(ContainerTest, InitialSizeIsZero) {\n  TypeParam container;\n  EXPECT_EQ(0U, container.size());\n}\n\nREGISTER_TYPED_TEST_CASE_P(ContainerTest,\n                           CanBeDefaultConstructed, InitialSizeIsZero);\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n#endif  // GTEST_TEST_GTEST_TYPED_TEST_TEST_H_\n"
  },
  {
    "path": "Tests/gtest/test/gtest-unittest-api_test.cc",
    "content": "// Copyright 2009 Google Inc.  All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n//\n// The Google C++ Testing Framework (Google Test)\n//\n// This file contains tests verifying correctness of data provided via\n// UnitTest's public methods.\n\n#include \"gtest/gtest.h\"\n\n#include <string.h>  // For strcmp.\n#include <algorithm>\n\nusing ::testing::InitGoogleTest;\n\nnamespace testing {\nnamespace internal {\n\ntemplate <typename T>\nstruct LessByName {\n  bool operator()(const T* a, const T* b) {\n    return strcmp(a->name(), b->name()) < 0;\n  }\n};\n\nclass UnitTestHelper {\n public:\n  // Returns the array of pointers to all test cases sorted by the test case\n  // name.  The caller is responsible for deleting the array.\n  static TestCase const** const GetSortedTestCases() {\n    UnitTest& unit_test = *UnitTest::GetInstance();\n    TestCase const** const test_cases =\n        new const TestCase*[unit_test.total_test_case_count()];\n\n    for (int i = 0; i < unit_test.total_test_case_count(); ++i)\n      test_cases[i] = unit_test.GetTestCase(i);\n\n    std::sort(test_cases,\n              test_cases + unit_test.total_test_case_count(),\n              LessByName<TestCase>());\n    return test_cases;\n  }\n\n  // Returns the test case by its name.  The caller doesn't own the returned\n  // pointer.\n  static const TestCase* FindTestCase(const char* name) {\n    UnitTest& unit_test = *UnitTest::GetInstance();\n    for (int i = 0; i < unit_test.total_test_case_count(); ++i) {\n      const TestCase* test_case = unit_test.GetTestCase(i);\n      if (0 == strcmp(test_case->name(), name))\n        return test_case;\n    }\n    return NULL;\n  }\n\n  // Returns the array of pointers to all tests in a particular test case\n  // sorted by the test name.  The caller is responsible for deleting the\n  // array.\n  static TestInfo const** const GetSortedTests(const TestCase* test_case) {\n    TestInfo const** const tests =\n        new const TestInfo*[test_case->total_test_count()];\n\n    for (int i = 0; i < test_case->total_test_count(); ++i)\n      tests[i] = test_case->GetTestInfo(i);\n\n    std::sort(tests, tests + test_case->total_test_count(),\n              LessByName<TestInfo>());\n    return tests;\n  }\n};\n\n#if GTEST_HAS_TYPED_TEST\ntemplate <typename T> class TestCaseWithCommentTest : public Test {};\nTYPED_TEST_CASE(TestCaseWithCommentTest, Types<int>);\nTYPED_TEST(TestCaseWithCommentTest, Dummy) {}\n\nconst int kTypedTestCases = 1;\nconst int kTypedTests = 1;\n#else\nconst int kTypedTestCases = 0;\nconst int kTypedTests = 0;\n#endif  // GTEST_HAS_TYPED_TEST\n\n// We can only test the accessors that do not change value while tests run.\n// Since tests can be run in any order, the values the accessors that track\n// test execution (such as failed_test_count) can not be predicted.\nTEST(ApiTest, UnitTestImmutableAccessorsWork) {\n  UnitTest* unit_test = UnitTest::GetInstance();\n\n  ASSERT_EQ(2 + kTypedTestCases, unit_test->total_test_case_count());\n  EXPECT_EQ(1 + kTypedTestCases, unit_test->test_case_to_run_count());\n  EXPECT_EQ(2, unit_test->disabled_test_count());\n  EXPECT_EQ(5 + kTypedTests, unit_test->total_test_count());\n  EXPECT_EQ(3 + kTypedTests, unit_test->test_to_run_count());\n\n  const TestCase** const test_cases = UnitTestHelper::GetSortedTestCases();\n\n  EXPECT_STREQ(\"ApiTest\", test_cases[0]->name());\n  EXPECT_STREQ(\"DISABLED_Test\", test_cases[1]->name());\n#if GTEST_HAS_TYPED_TEST\n  EXPECT_STREQ(\"TestCaseWithCommentTest/0\", test_cases[2]->name());\n#endif  // GTEST_HAS_TYPED_TEST\n\n  delete[] test_cases;\n\n  // The following lines initiate actions to verify certain methods in\n  // FinalSuccessChecker::TearDown.\n\n  // Records a test property to verify TestResult::GetTestProperty().\n  RecordProperty(\"key\", \"value\");\n}\n\nAssertionResult IsNull(const char* str) {\n  if (str != NULL) {\n    return testing::AssertionFailure() << \"argument is \" << str;\n  }\n  return AssertionSuccess();\n}\n\nTEST(ApiTest, TestCaseImmutableAccessorsWork) {\n  const TestCase* test_case = UnitTestHelper::FindTestCase(\"ApiTest\");\n  ASSERT_TRUE(test_case != NULL);\n\n  EXPECT_STREQ(\"ApiTest\", test_case->name());\n  EXPECT_TRUE(IsNull(test_case->type_param()));\n  EXPECT_TRUE(test_case->should_run());\n  EXPECT_EQ(1, test_case->disabled_test_count());\n  EXPECT_EQ(3, test_case->test_to_run_count());\n  ASSERT_EQ(4, test_case->total_test_count());\n\n  const TestInfo** tests = UnitTestHelper::GetSortedTests(test_case);\n\n  EXPECT_STREQ(\"DISABLED_Dummy1\", tests[0]->name());\n  EXPECT_STREQ(\"ApiTest\", tests[0]->test_case_name());\n  EXPECT_TRUE(IsNull(tests[0]->value_param()));\n  EXPECT_TRUE(IsNull(tests[0]->type_param()));\n  EXPECT_FALSE(tests[0]->should_run());\n\n  EXPECT_STREQ(\"TestCaseDisabledAccessorsWork\", tests[1]->name());\n  EXPECT_STREQ(\"ApiTest\", tests[1]->test_case_name());\n  EXPECT_TRUE(IsNull(tests[1]->value_param()));\n  EXPECT_TRUE(IsNull(tests[1]->type_param()));\n  EXPECT_TRUE(tests[1]->should_run());\n\n  EXPECT_STREQ(\"TestCaseImmutableAccessorsWork\", tests[2]->name());\n  EXPECT_STREQ(\"ApiTest\", tests[2]->test_case_name());\n  EXPECT_TRUE(IsNull(tests[2]->value_param()));\n  EXPECT_TRUE(IsNull(tests[2]->type_param()));\n  EXPECT_TRUE(tests[2]->should_run());\n\n  EXPECT_STREQ(\"UnitTestImmutableAccessorsWork\", tests[3]->name());\n  EXPECT_STREQ(\"ApiTest\", tests[3]->test_case_name());\n  EXPECT_TRUE(IsNull(tests[3]->value_param()));\n  EXPECT_TRUE(IsNull(tests[3]->type_param()));\n  EXPECT_TRUE(tests[3]->should_run());\n\n  delete[] tests;\n  tests = NULL;\n\n#if GTEST_HAS_TYPED_TEST\n  test_case = UnitTestHelper::FindTestCase(\"TestCaseWithCommentTest/0\");\n  ASSERT_TRUE(test_case != NULL);\n\n  EXPECT_STREQ(\"TestCaseWithCommentTest/0\", test_case->name());\n  EXPECT_STREQ(GetTypeName<int>().c_str(), test_case->type_param());\n  EXPECT_TRUE(test_case->should_run());\n  EXPECT_EQ(0, test_case->disabled_test_count());\n  EXPECT_EQ(1, test_case->test_to_run_count());\n  ASSERT_EQ(1, test_case->total_test_count());\n\n  tests = UnitTestHelper::GetSortedTests(test_case);\n\n  EXPECT_STREQ(\"Dummy\", tests[0]->name());\n  EXPECT_STREQ(\"TestCaseWithCommentTest/0\", tests[0]->test_case_name());\n  EXPECT_TRUE(IsNull(tests[0]->value_param()));\n  EXPECT_STREQ(GetTypeName<int>().c_str(), tests[0]->type_param());\n  EXPECT_TRUE(tests[0]->should_run());\n\n  delete[] tests;\n#endif  // GTEST_HAS_TYPED_TEST\n}\n\nTEST(ApiTest, TestCaseDisabledAccessorsWork) {\n  const TestCase* test_case = UnitTestHelper::FindTestCase(\"DISABLED_Test\");\n  ASSERT_TRUE(test_case != NULL);\n\n  EXPECT_STREQ(\"DISABLED_Test\", test_case->name());\n  EXPECT_TRUE(IsNull(test_case->type_param()));\n  EXPECT_FALSE(test_case->should_run());\n  EXPECT_EQ(1, test_case->disabled_test_count());\n  EXPECT_EQ(0, test_case->test_to_run_count());\n  ASSERT_EQ(1, test_case->total_test_count());\n\n  const TestInfo* const test_info = test_case->GetTestInfo(0);\n  EXPECT_STREQ(\"Dummy2\", test_info->name());\n  EXPECT_STREQ(\"DISABLED_Test\", test_info->test_case_name());\n  EXPECT_TRUE(IsNull(test_info->value_param()));\n  EXPECT_TRUE(IsNull(test_info->type_param()));\n  EXPECT_FALSE(test_info->should_run());\n}\n\n// These two tests are here to provide support for testing\n// test_case_to_run_count, disabled_test_count, and test_to_run_count.\nTEST(ApiTest, DISABLED_Dummy1) {}\nTEST(DISABLED_Test, Dummy2) {}\n\nclass FinalSuccessChecker : public Environment {\n protected:\n  virtual void TearDown() {\n    UnitTest* unit_test = UnitTest::GetInstance();\n\n    EXPECT_EQ(1 + kTypedTestCases, unit_test->successful_test_case_count());\n    EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());\n    EXPECT_EQ(0, unit_test->failed_test_case_count());\n    EXPECT_EQ(0, unit_test->failed_test_count());\n    EXPECT_TRUE(unit_test->Passed());\n    EXPECT_FALSE(unit_test->Failed());\n    ASSERT_EQ(2 + kTypedTestCases, unit_test->total_test_case_count());\n\n    const TestCase** const test_cases = UnitTestHelper::GetSortedTestCases();\n\n    EXPECT_STREQ(\"ApiTest\", test_cases[0]->name());\n    EXPECT_TRUE(IsNull(test_cases[0]->type_param()));\n    EXPECT_TRUE(test_cases[0]->should_run());\n    EXPECT_EQ(1, test_cases[0]->disabled_test_count());\n    ASSERT_EQ(4, test_cases[0]->total_test_count());\n    EXPECT_EQ(3, test_cases[0]->successful_test_count());\n    EXPECT_EQ(0, test_cases[0]->failed_test_count());\n    EXPECT_TRUE(test_cases[0]->Passed());\n    EXPECT_FALSE(test_cases[0]->Failed());\n\n    EXPECT_STREQ(\"DISABLED_Test\", test_cases[1]->name());\n    EXPECT_TRUE(IsNull(test_cases[1]->type_param()));\n    EXPECT_FALSE(test_cases[1]->should_run());\n    EXPECT_EQ(1, test_cases[1]->disabled_test_count());\n    ASSERT_EQ(1, test_cases[1]->total_test_count());\n    EXPECT_EQ(0, test_cases[1]->successful_test_count());\n    EXPECT_EQ(0, test_cases[1]->failed_test_count());\n\n#if GTEST_HAS_TYPED_TEST\n    EXPECT_STREQ(\"TestCaseWithCommentTest/0\", test_cases[2]->name());\n    EXPECT_STREQ(GetTypeName<int>().c_str(), test_cases[2]->type_param());\n    EXPECT_TRUE(test_cases[2]->should_run());\n    EXPECT_EQ(0, test_cases[2]->disabled_test_count());\n    ASSERT_EQ(1, test_cases[2]->total_test_count());\n    EXPECT_EQ(1, test_cases[2]->successful_test_count());\n    EXPECT_EQ(0, test_cases[2]->failed_test_count());\n    EXPECT_TRUE(test_cases[2]->Passed());\n    EXPECT_FALSE(test_cases[2]->Failed());\n#endif  // GTEST_HAS_TYPED_TEST\n\n    const TestCase* test_case = UnitTestHelper::FindTestCase(\"ApiTest\");\n    const TestInfo** tests = UnitTestHelper::GetSortedTests(test_case);\n    EXPECT_STREQ(\"DISABLED_Dummy1\", tests[0]->name());\n    EXPECT_STREQ(\"ApiTest\", tests[0]->test_case_name());\n    EXPECT_FALSE(tests[0]->should_run());\n\n    EXPECT_STREQ(\"TestCaseDisabledAccessorsWork\", tests[1]->name());\n    EXPECT_STREQ(\"ApiTest\", tests[1]->test_case_name());\n    EXPECT_TRUE(IsNull(tests[1]->value_param()));\n    EXPECT_TRUE(IsNull(tests[1]->type_param()));\n    EXPECT_TRUE(tests[1]->should_run());\n    EXPECT_TRUE(tests[1]->result()->Passed());\n    EXPECT_EQ(0, tests[1]->result()->test_property_count());\n\n    EXPECT_STREQ(\"TestCaseImmutableAccessorsWork\", tests[2]->name());\n    EXPECT_STREQ(\"ApiTest\", tests[2]->test_case_name());\n    EXPECT_TRUE(IsNull(tests[2]->value_param()));\n    EXPECT_TRUE(IsNull(tests[2]->type_param()));\n    EXPECT_TRUE(tests[2]->should_run());\n    EXPECT_TRUE(tests[2]->result()->Passed());\n    EXPECT_EQ(0, tests[2]->result()->test_property_count());\n\n    EXPECT_STREQ(\"UnitTestImmutableAccessorsWork\", tests[3]->name());\n    EXPECT_STREQ(\"ApiTest\", tests[3]->test_case_name());\n    EXPECT_TRUE(IsNull(tests[3]->value_param()));\n    EXPECT_TRUE(IsNull(tests[3]->type_param()));\n    EXPECT_TRUE(tests[3]->should_run());\n    EXPECT_TRUE(tests[3]->result()->Passed());\n    EXPECT_EQ(1, tests[3]->result()->test_property_count());\n    const TestProperty& property = tests[3]->result()->GetTestProperty(0);\n    EXPECT_STREQ(\"key\", property.key());\n    EXPECT_STREQ(\"value\", property.value());\n\n    delete[] tests;\n\n#if GTEST_HAS_TYPED_TEST\n    test_case = UnitTestHelper::FindTestCase(\"TestCaseWithCommentTest/0\");\n    tests = UnitTestHelper::GetSortedTests(test_case);\n\n    EXPECT_STREQ(\"Dummy\", tests[0]->name());\n    EXPECT_STREQ(\"TestCaseWithCommentTest/0\", tests[0]->test_case_name());\n    EXPECT_TRUE(IsNull(tests[0]->value_param()));\n    EXPECT_STREQ(GetTypeName<int>().c_str(), tests[0]->type_param());\n    EXPECT_TRUE(tests[0]->should_run());\n    EXPECT_TRUE(tests[0]->result()->Passed());\n    EXPECT_EQ(0, tests[0]->result()->test_property_count());\n\n    delete[] tests;\n#endif  // GTEST_HAS_TYPED_TEST\n    delete[] test_cases;\n  }\n};\n\n}  // namespace internal\n}  // namespace testing\n\nint main(int argc, char **argv) {\n  InitGoogleTest(&argc, argv);\n\n  AddGlobalTestEnvironment(new testing::internal::FinalSuccessChecker());\n\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_all_test.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Tests for Google C++ Testing Framework (Google Test)\n//\n// Sometimes it's desirable to build most of Google Test's own tests\n// by compiling a single file.  This file serves this purpose.\n#include \"test/gtest-filepath_test.cc\"\n#include \"test/gtest-linked_ptr_test.cc\"\n#include \"test/gtest-message_test.cc\"\n#include \"test/gtest-options_test.cc\"\n#include \"test/gtest-port_test.cc\"\n#include \"test/gtest_pred_impl_unittest.cc\"\n#include \"test/gtest_prod_test.cc\"\n#include \"test/gtest-test-part_test.cc\"\n#include \"test/gtest-typed-test_test.cc\"\n#include \"test/gtest-typed-test2_test.cc\"\n#include \"test/gtest_unittest.cc\"\n#include \"test/production.cc\"\n"
  },
  {
    "path": "Tests/gtest/test/gtest_break_on_failure_unittest.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test for Google Test's break-on-failure mode.\n\nA user can ask Google Test to seg-fault when an assertion fails, using\neither the GTEST_BREAK_ON_FAILURE environment variable or the\n--gtest_break_on_failure flag.  This script tests such functionality\nby invoking gtest_break_on_failure_unittest_ (a program written with\nGoogle Test) with different environments and command line flags.\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport gtest_test_utils\nimport os\nimport sys\n\n\n# Constants.\n\nIS_WINDOWS = os.name == 'nt'\n\n# The environment variable for enabling/disabling the break-on-failure mode.\nBREAK_ON_FAILURE_ENV_VAR = 'GTEST_BREAK_ON_FAILURE'\n\n# The command line flag for enabling/disabling the break-on-failure mode.\nBREAK_ON_FAILURE_FLAG = 'gtest_break_on_failure'\n\n# The environment variable for enabling/disabling the throw-on-failure mode.\nTHROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE'\n\n# The environment variable for enabling/disabling the catch-exceptions mode.\nCATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS'\n\n# Path to the gtest_break_on_failure_unittest_ program.\nEXE_PATH = gtest_test_utils.GetTestExecutablePath(\n    'gtest_break_on_failure_unittest_')\n\n\nenviron = gtest_test_utils.environ\nSetEnvVar = gtest_test_utils.SetEnvVar\n\n# Tests in this file run a Google-Test-based test program and expect it\n# to terminate prematurely.  Therefore they are incompatible with\n# the premature-exit-file protocol by design.  Unset the\n# premature-exit filepath to prevent Google Test from creating\n# the file.\nSetEnvVar(gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR, None)\n\n\ndef Run(command):\n  \"\"\"Runs a command; returns 1 if it was killed by a signal, or 0 otherwise.\"\"\"\n\n  p = gtest_test_utils.Subprocess(command, env=environ)\n  if p.terminated_by_signal:\n    return 1\n  else:\n    return 0\n\n\n# The tests.\n\n\nclass GTestBreakOnFailureUnitTest(gtest_test_utils.TestCase):\n  \"\"\"Tests using the GTEST_BREAK_ON_FAILURE environment variable or\n  the --gtest_break_on_failure flag to turn assertion failures into\n  segmentation faults.\n  \"\"\"\n\n  def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):\n    \"\"\"Runs gtest_break_on_failure_unittest_ and verifies that it does\n    (or does not) have a seg-fault.\n\n    Args:\n      env_var_value:    value of the GTEST_BREAK_ON_FAILURE environment\n                        variable; None if the variable should be unset.\n      flag_value:       value of the --gtest_break_on_failure flag;\n                        None if the flag should not be present.\n      expect_seg_fault: 1 if the program is expected to generate a seg-fault;\n                        0 otherwise.\n    \"\"\"\n\n    SetEnvVar(BREAK_ON_FAILURE_ENV_VAR, env_var_value)\n\n    if env_var_value is None:\n      env_var_value_msg = ' is not set'\n    else:\n      env_var_value_msg = '=' + env_var_value\n\n    if flag_value is None:\n      flag = ''\n    elif flag_value == '0':\n      flag = '--%s=0' % BREAK_ON_FAILURE_FLAG\n    else:\n      flag = '--%s' % BREAK_ON_FAILURE_FLAG\n\n    command = [EXE_PATH]\n    if flag:\n      command.append(flag)\n\n    if expect_seg_fault:\n      should_or_not = 'should'\n    else:\n      should_or_not = 'should not'\n\n    has_seg_fault = Run(command)\n\n    SetEnvVar(BREAK_ON_FAILURE_ENV_VAR, None)\n\n    msg = ('when %s%s, an assertion failure in \"%s\" %s cause a seg-fault.' %\n           (BREAK_ON_FAILURE_ENV_VAR, env_var_value_msg, ' '.join(command),\n            should_or_not))\n    self.assert_(has_seg_fault == expect_seg_fault, msg)\n\n  def testDefaultBehavior(self):\n    \"\"\"Tests the behavior of the default mode.\"\"\"\n\n    self.RunAndVerify(env_var_value=None,\n                      flag_value=None,\n                      expect_seg_fault=0)\n\n  def testEnvVar(self):\n    \"\"\"Tests using the GTEST_BREAK_ON_FAILURE environment variable.\"\"\"\n\n    self.RunAndVerify(env_var_value='0',\n                      flag_value=None,\n                      expect_seg_fault=0)\n    self.RunAndVerify(env_var_value='1',\n                      flag_value=None,\n                      expect_seg_fault=1)\n\n  def testFlag(self):\n    \"\"\"Tests using the --gtest_break_on_failure flag.\"\"\"\n\n    self.RunAndVerify(env_var_value=None,\n                      flag_value='0',\n                      expect_seg_fault=0)\n    self.RunAndVerify(env_var_value=None,\n                      flag_value='1',\n                      expect_seg_fault=1)\n\n  def testFlagOverridesEnvVar(self):\n    \"\"\"Tests that the flag overrides the environment variable.\"\"\"\n\n    self.RunAndVerify(env_var_value='0',\n                      flag_value='0',\n                      expect_seg_fault=0)\n    self.RunAndVerify(env_var_value='0',\n                      flag_value='1',\n                      expect_seg_fault=1)\n    self.RunAndVerify(env_var_value='1',\n                      flag_value='0',\n                      expect_seg_fault=0)\n    self.RunAndVerify(env_var_value='1',\n                      flag_value='1',\n                      expect_seg_fault=1)\n\n  def testBreakOnFailureOverridesThrowOnFailure(self):\n    \"\"\"Tests that gtest_break_on_failure overrides gtest_throw_on_failure.\"\"\"\n\n    SetEnvVar(THROW_ON_FAILURE_ENV_VAR, '1')\n    try:\n      self.RunAndVerify(env_var_value=None,\n                        flag_value='1',\n                        expect_seg_fault=1)\n    finally:\n      SetEnvVar(THROW_ON_FAILURE_ENV_VAR, None)\n\n  if IS_WINDOWS:\n    def testCatchExceptionsDoesNotInterfere(self):\n      \"\"\"Tests that gtest_catch_exceptions doesn't interfere.\"\"\"\n\n      SetEnvVar(CATCH_EXCEPTIONS_ENV_VAR, '1')\n      try:\n        self.RunAndVerify(env_var_value='1',\n                          flag_value='1',\n                          expect_seg_fault=1)\n      finally:\n        SetEnvVar(CATCH_EXCEPTIONS_ENV_VAR, None)\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_break_on_failure_unittest_.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Unit test for Google Test's break-on-failure mode.\n//\n// A user can ask Google Test to seg-fault when an assertion fails, using\n// either the GTEST_BREAK_ON_FAILURE environment variable or the\n// --gtest_break_on_failure flag.  This file is used for testing such\n// functionality.\n//\n// This program will be invoked from a Python unit test.  It is\n// expected to fail.  Don't run it directly.\n\n#include \"gtest/gtest.h\"\n\n#if GTEST_OS_WINDOWS\n# include <windows.h>\n# include <stdlib.h>\n#endif\n\nnamespace {\n\n// A test that's expected to fail.\nTEST(Foo, Bar) {\n  EXPECT_EQ(2, 3);\n}\n\n#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE\n// On Windows Mobile global exception handlers are not supported.\nLONG WINAPI ExitWithExceptionCode(\n    struct _EXCEPTION_POINTERS* exception_pointers) {\n  exit(exception_pointers->ExceptionRecord->ExceptionCode);\n}\n#endif\n\n}  // namespace\n\nint main(int argc, char **argv) {\n#if GTEST_OS_WINDOWS\n  // Suppresses display of the Windows error dialog upon encountering\n  // a general protection fault (segment violation).\n  SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);\n\n# if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE\n\n  // The default unhandled exception filter does not always exit\n  // with the exception code as exit code - for example it exits with\n  // 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT\n  // if the application is compiled in debug mode. Thus we use our own\n  // filter which always exits with the exception code for unhandled\n  // exceptions.\n  SetUnhandledExceptionFilter(ExitWithExceptionCode);\n\n# endif\n#endif\n\n  testing::InitGoogleTest(&argc, argv);\n\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_catch_exceptions_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2010 Google Inc.  All Rights Reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Tests Google Test's exception catching behavior.\n\nThis script invokes gtest_catch_exceptions_test_ and\ngtest_catch_exceptions_ex_test_ (programs written with\nGoogle Test) and verifies their output.\n\"\"\"\n\n__author__ = 'vladl@google.com (Vlad Losev)'\n\nimport os\n\nimport gtest_test_utils\n\n# Constants.\nFLAG_PREFIX = '--gtest_'\nLIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests'\nNO_CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions=0'\nFILTER_FLAG = FLAG_PREFIX + 'filter'\n\n# Path to the gtest_catch_exceptions_ex_test_ binary, compiled with\n# exceptions enabled.\nEX_EXE_PATH = gtest_test_utils.GetTestExecutablePath(\n    'gtest_catch_exceptions_ex_test_')\n\n# Path to the gtest_catch_exceptions_test_ binary, compiled with\n# exceptions disabled.\nEXE_PATH = gtest_test_utils.GetTestExecutablePath(\n    'gtest_catch_exceptions_no_ex_test_')\n\nenviron = gtest_test_utils.environ\nSetEnvVar = gtest_test_utils.SetEnvVar\n\n# Tests in this file run a Google-Test-based test program and expect it\n# to terminate prematurely.  Therefore they are incompatible with\n# the premature-exit-file protocol by design.  Unset the\n# premature-exit filepath to prevent Google Test from creating\n# the file.\nSetEnvVar(gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR, None)\n\nTEST_LIST = gtest_test_utils.Subprocess(\n    [EXE_PATH, LIST_TESTS_FLAG], env=environ).output\n\nSUPPORTS_SEH_EXCEPTIONS = 'ThrowsSehException' in TEST_LIST\n\nif SUPPORTS_SEH_EXCEPTIONS:\n  BINARY_OUTPUT = gtest_test_utils.Subprocess([EXE_PATH], env=environ).output\n\nEX_BINARY_OUTPUT = gtest_test_utils.Subprocess(\n    [EX_EXE_PATH], env=environ).output\n\n\n# The tests.\nif SUPPORTS_SEH_EXCEPTIONS:\n  # pylint:disable-msg=C6302\n  class CatchSehExceptionsTest(gtest_test_utils.TestCase):\n    \"\"\"Tests exception-catching behavior.\"\"\"\n\n\n    def TestSehExceptions(self, test_output):\n      self.assert_('SEH exception with code 0x2a thrown '\n                   'in the test fixture\\'s constructor'\n                   in test_output)\n      self.assert_('SEH exception with code 0x2a thrown '\n                   'in the test fixture\\'s destructor'\n                   in test_output)\n      self.assert_('SEH exception with code 0x2a thrown in SetUpTestCase()'\n                   in test_output)\n      self.assert_('SEH exception with code 0x2a thrown in TearDownTestCase()'\n                   in test_output)\n      self.assert_('SEH exception with code 0x2a thrown in SetUp()'\n                   in test_output)\n      self.assert_('SEH exception with code 0x2a thrown in TearDown()'\n                   in test_output)\n      self.assert_('SEH exception with code 0x2a thrown in the test body'\n                   in test_output)\n\n    def testCatchesSehExceptionsWithCxxExceptionsEnabled(self):\n      self.TestSehExceptions(EX_BINARY_OUTPUT)\n\n    def testCatchesSehExceptionsWithCxxExceptionsDisabled(self):\n      self.TestSehExceptions(BINARY_OUTPUT)\n\n\nclass CatchCxxExceptionsTest(gtest_test_utils.TestCase):\n  \"\"\"Tests C++ exception-catching behavior.\n\n     Tests in this test case verify that:\n     * C++ exceptions are caught and logged as C++ (not SEH) exceptions\n     * Exception thrown affect the remainder of the test work flow in the\n       expected manner.\n  \"\"\"\n\n  def testCatchesCxxExceptionsInFixtureConstructor(self):\n    self.assert_('C++ exception with description '\n                 '\"Standard C++ exception\" thrown '\n                 'in the test fixture\\'s constructor'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('unexpected' not in EX_BINARY_OUTPUT,\n                 'This failure belongs in this test only if '\n                 '\"CxxExceptionInConstructorTest\" (no quotes) '\n                 'appears on the same line as words \"called unexpectedly\"')\n\n  if ('CxxExceptionInDestructorTest.ThrowsExceptionInDestructor' in\n      EX_BINARY_OUTPUT):\n\n    def testCatchesCxxExceptionsInFixtureDestructor(self):\n      self.assert_('C++ exception with description '\n                   '\"Standard C++ exception\" thrown '\n                   'in the test fixture\\'s destructor'\n                   in EX_BINARY_OUTPUT)\n      self.assert_('CxxExceptionInDestructorTest::TearDownTestCase() '\n                   'called as expected.'\n                   in EX_BINARY_OUTPUT)\n\n  def testCatchesCxxExceptionsInSetUpTestCase(self):\n    self.assert_('C++ exception with description \"Standard C++ exception\"'\n                 ' thrown in SetUpTestCase()'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInConstructorTest::TearDownTestCase() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTestCaseTest constructor '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTestCaseTest destructor '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTestCaseTest::SetUp() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTestCaseTest::TearDown() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTestCaseTest test body '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n\n  def testCatchesCxxExceptionsInTearDownTestCase(self):\n    self.assert_('C++ exception with description \"Standard C++ exception\"'\n                 ' thrown in TearDownTestCase()'\n                 in EX_BINARY_OUTPUT)\n\n  def testCatchesCxxExceptionsInSetUp(self):\n    self.assert_('C++ exception with description \"Standard C++ exception\"'\n                 ' thrown in SetUp()'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTest::TearDownTestCase() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTest destructor '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInSetUpTest::TearDown() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('unexpected' not in EX_BINARY_OUTPUT,\n                 'This failure belongs in this test only if '\n                 '\"CxxExceptionInSetUpTest\" (no quotes) '\n                 'appears on the same line as words \"called unexpectedly\"')\n\n  def testCatchesCxxExceptionsInTearDown(self):\n    self.assert_('C++ exception with description \"Standard C++ exception\"'\n                 ' thrown in TearDown()'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInTearDownTest::TearDownTestCase() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInTearDownTest destructor '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n\n  def testCatchesCxxExceptionsInTestBody(self):\n    self.assert_('C++ exception with description \"Standard C++ exception\"'\n                 ' thrown in the test body'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInTestBodyTest::TearDownTestCase() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInTestBodyTest destructor '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n    self.assert_('CxxExceptionInTestBodyTest::TearDown() '\n                 'called as expected.'\n                 in EX_BINARY_OUTPUT)\n\n  def testCatchesNonStdCxxExceptions(self):\n    self.assert_('Unknown C++ exception thrown in the test body'\n                 in EX_BINARY_OUTPUT)\n\n  def testUnhandledCxxExceptionsAbortTheProgram(self):\n    # Filters out SEH exception tests on Windows. Unhandled SEH exceptions\n    # cause tests to show pop-up windows there.\n    FITLER_OUT_SEH_TESTS_FLAG = FILTER_FLAG + '=-*Seh*'\n    # By default, Google Test doesn't catch the exceptions.\n    uncaught_exceptions_ex_binary_output = gtest_test_utils.Subprocess(\n        [EX_EXE_PATH,\n         NO_CATCH_EXCEPTIONS_FLAG,\n         FITLER_OUT_SEH_TESTS_FLAG],\n        env=environ).output\n\n    self.assert_('Unhandled C++ exception terminating the program'\n                 in uncaught_exceptions_ex_binary_output)\n    self.assert_('unexpected' not in uncaught_exceptions_ex_binary_output)\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_catch_exceptions_test_.cc",
    "content": "// Copyright 2010, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: vladl@google.com (Vlad Losev)\n//\n// Tests for Google Test itself. Tests in this file throw C++ or SEH\n// exceptions, and the output is verified by gtest_catch_exceptions_test.py.\n\n#include \"gtest/gtest.h\"\n\n#include <stdio.h>  // NOLINT\n#include <stdlib.h>  // For exit().\n\n#if GTEST_HAS_SEH\n# include <windows.h>\n#endif\n\n#if GTEST_HAS_EXCEPTIONS\n# include <exception>  // For set_terminate().\n# include <stdexcept>\n#endif\n\nusing testing::Test;\n\n#if GTEST_HAS_SEH\n\nclass SehExceptionInConstructorTest : public Test {\n public:\n  SehExceptionInConstructorTest() { RaiseException(42, 0, 0, NULL); }\n};\n\nTEST_F(SehExceptionInConstructorTest, ThrowsExceptionInConstructor) {}\n\nclass SehExceptionInDestructorTest : public Test {\n public:\n  ~SehExceptionInDestructorTest() { RaiseException(42, 0, 0, NULL); }\n};\n\nTEST_F(SehExceptionInDestructorTest, ThrowsExceptionInDestructor) {}\n\nclass SehExceptionInSetUpTestCaseTest : public Test {\n public:\n  static void SetUpTestCase() { RaiseException(42, 0, 0, NULL); }\n};\n\nTEST_F(SehExceptionInSetUpTestCaseTest, ThrowsExceptionInSetUpTestCase) {}\n\nclass SehExceptionInTearDownTestCaseTest : public Test {\n public:\n  static void TearDownTestCase() { RaiseException(42, 0, 0, NULL); }\n};\n\nTEST_F(SehExceptionInTearDownTestCaseTest, ThrowsExceptionInTearDownTestCase) {}\n\nclass SehExceptionInSetUpTest : public Test {\n protected:\n  virtual void SetUp() { RaiseException(42, 0, 0, NULL); }\n};\n\nTEST_F(SehExceptionInSetUpTest, ThrowsExceptionInSetUp) {}\n\nclass SehExceptionInTearDownTest : public Test {\n protected:\n  virtual void TearDown() { RaiseException(42, 0, 0, NULL); }\n};\n\nTEST_F(SehExceptionInTearDownTest, ThrowsExceptionInTearDown) {}\n\nTEST(SehExceptionTest, ThrowsSehException) {\n  RaiseException(42, 0, 0, NULL);\n}\n\n#endif  // GTEST_HAS_SEH\n\n#if GTEST_HAS_EXCEPTIONS\n\nclass CxxExceptionInConstructorTest : public Test {\n public:\n  CxxExceptionInConstructorTest() {\n    // Without this macro VC++ complains about unreachable code at the end of\n    // the constructor.\n    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(\n        throw std::runtime_error(\"Standard C++ exception\"));\n  }\n\n  static void TearDownTestCase() {\n    printf(\"%s\",\n           \"CxxExceptionInConstructorTest::TearDownTestCase() \"\n           \"called as expected.\\n\");\n  }\n\n protected:\n  ~CxxExceptionInConstructorTest() {\n    ADD_FAILURE() << \"CxxExceptionInConstructorTest destructor \"\n                  << \"called unexpectedly.\";\n  }\n\n  virtual void SetUp() {\n    ADD_FAILURE() << \"CxxExceptionInConstructorTest::SetUp() \"\n                  << \"called unexpectedly.\";\n  }\n\n  virtual void TearDown() {\n    ADD_FAILURE() << \"CxxExceptionInConstructorTest::TearDown() \"\n                  << \"called unexpectedly.\";\n  }\n};\n\nTEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {\n  ADD_FAILURE() << \"CxxExceptionInConstructorTest test body \"\n                << \"called unexpectedly.\";\n}\n\n// Exceptions in destructors are not supported in C++11.\n#if !defined(__GXX_EXPERIMENTAL_CXX0X__) &&  __cplusplus < 201103L\nclass CxxExceptionInDestructorTest : public Test {\n public:\n  static void TearDownTestCase() {\n    printf(\"%s\",\n           \"CxxExceptionInDestructorTest::TearDownTestCase() \"\n           \"called as expected.\\n\");\n  }\n\n protected:\n  ~CxxExceptionInDestructorTest() {\n    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(\n        throw std::runtime_error(\"Standard C++ exception\"));\n  }\n};\n\nTEST_F(CxxExceptionInDestructorTest, ThrowsExceptionInDestructor) {}\n#endif  // C++11 mode\n\nclass CxxExceptionInSetUpTestCaseTest : public Test {\n public:\n  CxxExceptionInSetUpTestCaseTest() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTestCaseTest constructor \"\n           \"called as expected.\\n\");\n  }\n\n  static void SetUpTestCase() {\n    throw std::runtime_error(\"Standard C++ exception\");\n  }\n\n  static void TearDownTestCase() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTestCaseTest::TearDownTestCase() \"\n           \"called as expected.\\n\");\n  }\n\n protected:\n  ~CxxExceptionInSetUpTestCaseTest() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTestCaseTest destructor \"\n           \"called as expected.\\n\");\n  }\n\n  virtual void SetUp() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTestCaseTest::SetUp() \"\n           \"called as expected.\\n\");\n  }\n\n  virtual void TearDown() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTestCaseTest::TearDown() \"\n           \"called as expected.\\n\");\n  }\n};\n\nTEST_F(CxxExceptionInSetUpTestCaseTest, ThrowsExceptionInSetUpTestCase) {\n  printf(\"%s\",\n         \"CxxExceptionInSetUpTestCaseTest test body \"\n         \"called as expected.\\n\");\n}\n\nclass CxxExceptionInTearDownTestCaseTest : public Test {\n public:\n  static void TearDownTestCase() {\n    throw std::runtime_error(\"Standard C++ exception\");\n  }\n};\n\nTEST_F(CxxExceptionInTearDownTestCaseTest, ThrowsExceptionInTearDownTestCase) {}\n\nclass CxxExceptionInSetUpTest : public Test {\n public:\n  static void TearDownTestCase() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTest::TearDownTestCase() \"\n           \"called as expected.\\n\");\n  }\n\n protected:\n  ~CxxExceptionInSetUpTest() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTest destructor \"\n           \"called as expected.\\n\");\n  }\n\n  virtual void SetUp() { throw std::runtime_error(\"Standard C++ exception\"); }\n\n  virtual void TearDown() {\n    printf(\"%s\",\n           \"CxxExceptionInSetUpTest::TearDown() \"\n           \"called as expected.\\n\");\n  }\n};\n\nTEST_F(CxxExceptionInSetUpTest, ThrowsExceptionInSetUp) {\n  ADD_FAILURE() << \"CxxExceptionInSetUpTest test body \"\n                << \"called unexpectedly.\";\n}\n\nclass CxxExceptionInTearDownTest : public Test {\n public:\n  static void TearDownTestCase() {\n    printf(\"%s\",\n           \"CxxExceptionInTearDownTest::TearDownTestCase() \"\n           \"called as expected.\\n\");\n  }\n\n protected:\n  ~CxxExceptionInTearDownTest() {\n    printf(\"%s\",\n           \"CxxExceptionInTearDownTest destructor \"\n           \"called as expected.\\n\");\n  }\n\n  virtual void TearDown() {\n    throw std::runtime_error(\"Standard C++ exception\");\n  }\n};\n\nTEST_F(CxxExceptionInTearDownTest, ThrowsExceptionInTearDown) {}\n\nclass CxxExceptionInTestBodyTest : public Test {\n public:\n  static void TearDownTestCase() {\n    printf(\"%s\",\n           \"CxxExceptionInTestBodyTest::TearDownTestCase() \"\n           \"called as expected.\\n\");\n  }\n\n protected:\n  ~CxxExceptionInTestBodyTest() {\n    printf(\"%s\",\n           \"CxxExceptionInTestBodyTest destructor \"\n           \"called as expected.\\n\");\n  }\n\n  virtual void TearDown() {\n    printf(\"%s\",\n           \"CxxExceptionInTestBodyTest::TearDown() \"\n           \"called as expected.\\n\");\n  }\n};\n\nTEST_F(CxxExceptionInTestBodyTest, ThrowsStdCxxException) {\n  throw std::runtime_error(\"Standard C++ exception\");\n}\n\nTEST(CxxExceptionTest, ThrowsNonStdCxxException) {\n  throw \"C-string\";\n}\n\n// This terminate handler aborts the program using exit() rather than abort().\n// This avoids showing pop-ups on Windows systems and core dumps on Unix-like\n// ones.\nvoid TerminateHandler() {\n  fprintf(stderr, \"%s\\n\", \"Unhandled C++ exception terminating the program.\");\n  fflush(NULL);\n  exit(3);\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\nint main(int argc, char** argv) {\n#if GTEST_HAS_EXCEPTIONS\n  std::set_terminate(&TerminateHandler);\n#endif\n  testing::InitGoogleTest(&argc, argv);\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_color_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Verifies that Google Test correctly determines whether to use colors.\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport gtest_test_utils\n\n\nIS_WINDOWS = os.name = 'nt'\n\nCOLOR_ENV_VAR = 'GTEST_COLOR'\nCOLOR_FLAG = 'gtest_color'\nCOMMAND = gtest_test_utils.GetTestExecutablePath('gtest_color_test_')\n\n\ndef SetEnvVar(env_var, value):\n  \"\"\"Sets the env variable to 'value'; unsets it when 'value' is None.\"\"\"\n\n  if value is not None:\n    os.environ[env_var] = value\n  elif env_var in os.environ:\n    del os.environ[env_var]\n\n\ndef UsesColor(term, color_env_var, color_flag):\n  \"\"\"Runs gtest_color_test_ and returns its exit code.\"\"\"\n\n  SetEnvVar('TERM', term)\n  SetEnvVar(COLOR_ENV_VAR, color_env_var)\n\n  if color_flag is None:\n    args = []\n  else:\n    args = ['--%s=%s' % (COLOR_FLAG, color_flag)]\n  p = gtest_test_utils.Subprocess([COMMAND] + args)\n  return not p.exited or p.exit_code\n\n\nclass GTestColorTest(gtest_test_utils.TestCase):\n  def testNoEnvVarNoFlag(self):\n    \"\"\"Tests the case when there's neither GTEST_COLOR nor --gtest_color.\"\"\"\n\n    if not IS_WINDOWS:\n      self.assert_(not UsesColor('dumb', None, None))\n      self.assert_(not UsesColor('emacs', None, None))\n      self.assert_(not UsesColor('xterm-mono', None, None))\n      self.assert_(not UsesColor('unknown', None, None))\n      self.assert_(not UsesColor(None, None, None))\n    self.assert_(UsesColor('linux', None, None))\n    self.assert_(UsesColor('cygwin', None, None))\n    self.assert_(UsesColor('xterm', None, None))\n    self.assert_(UsesColor('xterm-color', None, None))\n    self.assert_(UsesColor('xterm-256color', None, None))\n\n  def testFlagOnly(self):\n    \"\"\"Tests the case when there's --gtest_color but not GTEST_COLOR.\"\"\"\n\n    self.assert_(not UsesColor('dumb', None, 'no'))\n    self.assert_(not UsesColor('xterm-color', None, 'no'))\n    if not IS_WINDOWS:\n      self.assert_(not UsesColor('emacs', None, 'auto'))\n    self.assert_(UsesColor('xterm', None, 'auto'))\n    self.assert_(UsesColor('dumb', None, 'yes'))\n    self.assert_(UsesColor('xterm', None, 'yes'))\n\n  def testEnvVarOnly(self):\n    \"\"\"Tests the case when there's GTEST_COLOR but not --gtest_color.\"\"\"\n\n    self.assert_(not UsesColor('dumb', 'no', None))\n    self.assert_(not UsesColor('xterm-color', 'no', None))\n    if not IS_WINDOWS:\n      self.assert_(not UsesColor('dumb', 'auto', None))\n    self.assert_(UsesColor('xterm-color', 'auto', None))\n    self.assert_(UsesColor('dumb', 'yes', None))\n    self.assert_(UsesColor('xterm-color', 'yes', None))\n\n  def testEnvVarAndFlag(self):\n    \"\"\"Tests the case when there are both GTEST_COLOR and --gtest_color.\"\"\"\n\n    self.assert_(not UsesColor('xterm-color', 'no', 'no'))\n    self.assert_(UsesColor('dumb', 'no', 'yes'))\n    self.assert_(UsesColor('xterm-color', 'no', 'auto'))\n\n  def testAliasesOfYesAndNo(self):\n    \"\"\"Tests using aliases in specifying --gtest_color.\"\"\"\n\n    self.assert_(UsesColor('dumb', None, 'true'))\n    self.assert_(UsesColor('dumb', None, 'YES'))\n    self.assert_(UsesColor('dumb', None, 'T'))\n    self.assert_(UsesColor('dumb', None, '1'))\n\n    self.assert_(not UsesColor('xterm', None, 'f'))\n    self.assert_(not UsesColor('xterm', None, 'false'))\n    self.assert_(not UsesColor('xterm', None, '0'))\n    self.assert_(not UsesColor('xterm', None, 'unknown'))\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_color_test_.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// A helper program for testing how Google Test determines whether to use\n// colors in the output.  It prints \"YES\" and returns 1 if Google Test\n// decides to use colors, and prints \"NO\" and returns 0 otherwise.\n\n#include <stdio.h>\n\n#include \"gtest/gtest.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nusing testing::internal::ShouldUseColor;\n\n// The purpose of this is to ensure that the UnitTest singleton is\n// created before main() is entered, and thus that ShouldUseColor()\n// works the same way as in a real Google-Test-based test.  We don't actual\n// run the TEST itself.\nTEST(GTestColorTest, Dummy) {\n}\n\nint main(int argc, char** argv) {\n  testing::InitGoogleTest(&argc, argv);\n\n  if (ShouldUseColor(true)) {\n    // Google Test decides to use colors in the output (assuming it\n    // goes to a TTY).\n    printf(\"YES\\n\");\n    return 1;\n  } else {\n    // Google Test decides not to use colors in the output.\n    printf(\"NO\\n\");\n    return 0;\n  }\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_env_var_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Verifies that Google Test correctly parses environment variables.\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport gtest_test_utils\n\n\nIS_WINDOWS = os.name == 'nt'\nIS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'\n\nCOMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_')\n\nenviron = os.environ.copy()\n\n\ndef AssertEq(expected, actual):\n  if expected != actual:\n    print 'Expected: %s' % (expected,)\n    print '  Actual: %s' % (actual,)\n    raise AssertionError\n\n\ndef SetEnvVar(env_var, value):\n  \"\"\"Sets the env variable to 'value'; unsets it when 'value' is None.\"\"\"\n\n  if value is not None:\n    environ[env_var] = value\n  elif env_var in environ:\n    del environ[env_var]\n\n\ndef GetFlag(flag):\n  \"\"\"Runs gtest_env_var_test_ and returns its output.\"\"\"\n\n  args = [COMMAND]\n  if flag is not None:\n    args += [flag]\n  return gtest_test_utils.Subprocess(args, env=environ).output\n\n\ndef TestFlag(flag, test_val, default_val):\n  \"\"\"Verifies that the given flag is affected by the corresponding env var.\"\"\"\n\n  env_var = 'GTEST_' + flag.upper()\n  SetEnvVar(env_var, test_val)\n  AssertEq(test_val, GetFlag(flag))\n  SetEnvVar(env_var, None)\n  AssertEq(default_val, GetFlag(flag))\n\n\nclass GTestEnvVarTest(gtest_test_utils.TestCase):\n  def testEnvVarAffectsFlag(self):\n    \"\"\"Tests that environment variable should affect the corresponding flag.\"\"\"\n\n    TestFlag('break_on_failure', '1', '0')\n    TestFlag('color', 'yes', 'auto')\n    TestFlag('filter', 'FooTest.Bar', '*')\n    TestFlag('output', 'xml:tmp/foo.xml', '')\n    TestFlag('print_time', '0', '1')\n    TestFlag('repeat', '999', '1')\n    TestFlag('throw_on_failure', '1', '0')\n    TestFlag('death_test_style', 'threadsafe', 'fast')\n    TestFlag('catch_exceptions', '0', '1')\n\n    if IS_LINUX:\n      TestFlag('death_test_use_fork', '1', '0')\n      TestFlag('stack_trace_depth', '0', '100')\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_env_var_test_.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// A helper program for testing that Google Test parses the environment\n// variables correctly.\n\n#include \"gtest/gtest.h\"\n\n#include <iostream>\n\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nusing ::std::cout;\n\nnamespace testing {\n\n// The purpose of this is to make the test more realistic by ensuring\n// that the UnitTest singleton is created before main() is entered.\n// We don't actual run the TEST itself.\nTEST(GTestEnvVarTest, Dummy) {\n}\n\nvoid PrintFlag(const char* flag) {\n  if (strcmp(flag, \"break_on_failure\") == 0) {\n    cout << GTEST_FLAG(break_on_failure);\n    return;\n  }\n\n  if (strcmp(flag, \"catch_exceptions\") == 0) {\n    cout << GTEST_FLAG(catch_exceptions);\n    return;\n  }\n\n  if (strcmp(flag, \"color\") == 0) {\n    cout << GTEST_FLAG(color);\n    return;\n  }\n\n  if (strcmp(flag, \"death_test_style\") == 0) {\n    cout << GTEST_FLAG(death_test_style);\n    return;\n  }\n\n  if (strcmp(flag, \"death_test_use_fork\") == 0) {\n    cout << GTEST_FLAG(death_test_use_fork);\n    return;\n  }\n\n  if (strcmp(flag, \"filter\") == 0) {\n    cout << GTEST_FLAG(filter);\n    return;\n  }\n\n  if (strcmp(flag, \"output\") == 0) {\n    cout << GTEST_FLAG(output);\n    return;\n  }\n\n  if (strcmp(flag, \"print_time\") == 0) {\n    cout << GTEST_FLAG(print_time);\n    return;\n  }\n\n  if (strcmp(flag, \"repeat\") == 0) {\n    cout << GTEST_FLAG(repeat);\n    return;\n  }\n\n  if (strcmp(flag, \"stack_trace_depth\") == 0) {\n    cout << GTEST_FLAG(stack_trace_depth);\n    return;\n  }\n\n  if (strcmp(flag, \"throw_on_failure\") == 0) {\n    cout << GTEST_FLAG(throw_on_failure);\n    return;\n  }\n\n  cout << \"Invalid flag name \" << flag\n       << \".  Valid names are break_on_failure, color, filter, etc.\\n\";\n  exit(1);\n}\n\n}  // namespace testing\n\nint main(int argc, char** argv) {\n  testing::InitGoogleTest(&argc, argv);\n\n  if (argc != 2) {\n    cout << \"Usage: gtest_env_var_test_ NAME_OF_FLAG\\n\";\n    return 1;\n  }\n\n  testing::PrintFlag(argv[1]);\n  return 0;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_environment_test.cc",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Tests using global test environments.\n\n#include <stdlib.h>\n#include <stdio.h>\n#include \"gtest/gtest.h\"\n\n#define GTEST_IMPLEMENTATION_ 1  // Required for the next #include.\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\nGTEST_DECLARE_string_(filter);\n}\n\nnamespace {\n\nenum FailureType {\n  NO_FAILURE, NON_FATAL_FAILURE, FATAL_FAILURE\n};\n\n// For testing using global test environments.\nclass MyEnvironment : public testing::Environment {\n public:\n  MyEnvironment() { Reset(); }\n\n  // Depending on the value of failure_in_set_up_, SetUp() will\n  // generate a non-fatal failure, generate a fatal failure, or\n  // succeed.\n  virtual void SetUp() {\n    set_up_was_run_ = true;\n\n    switch (failure_in_set_up_) {\n      case NON_FATAL_FAILURE:\n        ADD_FAILURE() << \"Expected non-fatal failure in global set-up.\";\n        break;\n      case FATAL_FAILURE:\n        FAIL() << \"Expected fatal failure in global set-up.\";\n        break;\n      default:\n        break;\n    }\n  }\n\n  // Generates a non-fatal failure.\n  virtual void TearDown() {\n    tear_down_was_run_ = true;\n    ADD_FAILURE() << \"Expected non-fatal failure in global tear-down.\";\n  }\n\n  // Resets the state of the environment s.t. it can be reused.\n  void Reset() {\n    failure_in_set_up_ = NO_FAILURE;\n    set_up_was_run_ = false;\n    tear_down_was_run_ = false;\n  }\n\n  // We call this function to set the type of failure SetUp() should\n  // generate.\n  void set_failure_in_set_up(FailureType type) {\n    failure_in_set_up_ = type;\n  }\n\n  // Was SetUp() run?\n  bool set_up_was_run() const { return set_up_was_run_; }\n\n  // Was TearDown() run?\n  bool tear_down_was_run() const { return tear_down_was_run_; }\n\n private:\n  FailureType failure_in_set_up_;\n  bool set_up_was_run_;\n  bool tear_down_was_run_;\n};\n\n// Was the TEST run?\nbool test_was_run;\n\n// The sole purpose of this TEST is to enable us to check whether it\n// was run.\nTEST(FooTest, Bar) {\n  test_was_run = true;\n}\n\n// Prints the message and aborts the program if condition is false.\nvoid Check(bool condition, const char* msg) {\n  if (!condition) {\n    printf(\"FAILED: %s\\n\", msg);\n    testing::internal::posix::Abort();\n  }\n}\n\n// Runs the tests.  Return true iff successful.\n//\n// The 'failure' parameter specifies the type of failure that should\n// be generated by the global set-up.\nint RunAllTests(MyEnvironment* env, FailureType failure) {\n  env->Reset();\n  env->set_failure_in_set_up(failure);\n  test_was_run = false;\n  testing::internal::GetUnitTestImpl()->ClearAdHocTestResult();\n  return RUN_ALL_TESTS();\n}\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  testing::InitGoogleTest(&argc, argv);\n\n  // Registers a global test environment, and verifies that the\n  // registration function returns its argument.\n  MyEnvironment* const env = new MyEnvironment;\n  Check(testing::AddGlobalTestEnvironment(env) == env,\n        \"AddGlobalTestEnvironment() should return its argument.\");\n\n  // Verifies that RUN_ALL_TESTS() runs the tests when the global\n  // set-up is successful.\n  Check(RunAllTests(env, NO_FAILURE) != 0,\n        \"RUN_ALL_TESTS() should return non-zero, as the global tear-down \"\n        \"should generate a failure.\");\n  Check(test_was_run,\n        \"The tests should run, as the global set-up should generate no \"\n        \"failure\");\n  Check(env->tear_down_was_run(),\n        \"The global tear-down should run, as the global set-up was run.\");\n\n  // Verifies that RUN_ALL_TESTS() runs the tests when the global\n  // set-up generates no fatal failure.\n  Check(RunAllTests(env, NON_FATAL_FAILURE) != 0,\n        \"RUN_ALL_TESTS() should return non-zero, as both the global set-up \"\n        \"and the global tear-down should generate a non-fatal failure.\");\n  Check(test_was_run,\n        \"The tests should run, as the global set-up should generate no \"\n        \"fatal failure.\");\n  Check(env->tear_down_was_run(),\n        \"The global tear-down should run, as the global set-up was run.\");\n\n  // Verifies that RUN_ALL_TESTS() runs no test when the global set-up\n  // generates a fatal failure.\n  Check(RunAllTests(env, FATAL_FAILURE) != 0,\n        \"RUN_ALL_TESTS() should return non-zero, as the global set-up \"\n        \"should generate a fatal failure.\");\n  Check(!test_was_run,\n        \"The tests should not run, as the global set-up should generate \"\n        \"a fatal failure.\");\n  Check(env->tear_down_was_run(),\n        \"The global tear-down should run, as the global set-up was run.\");\n\n  // Verifies that RUN_ALL_TESTS() doesn't do global set-up or\n  // tear-down when there is no test to run.\n  testing::GTEST_FLAG(filter) = \"-*\";\n  Check(RunAllTests(env, NO_FAILURE) == 0,\n        \"RUN_ALL_TESTS() should return zero, as there is no test to run.\");\n  Check(!env->set_up_was_run(),\n        \"The global set-up should not run, as there is no test to run.\");\n  Check(!env->tear_down_was_run(),\n        \"The global tear-down should not run, \"\n        \"as the global set-up was not run.\");\n\n  printf(\"PASS\\n\");\n  return 0;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_filter_unittest.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2005 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test for Google Test test filters.\n\nA user can specify which test(s) in a Google Test program to run via either\nthe GTEST_FILTER environment variable or the --gtest_filter flag.\nThis script tests such functionality by invoking\ngtest_filter_unittest_ (a program written with Google Test) with different\nenvironments and command line flags.\n\nNote that test sharding may also influence which tests are filtered. Therefore,\nwe test that here also.\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport re\nimport sets\nimport sys\n\nimport gtest_test_utils\n\n# Constants.\n\n# Checks if this platform can pass empty environment variables to child\n# processes.  We set an env variable to an empty string and invoke a python\n# script in a subprocess to print whether the variable is STILL in\n# os.environ.  We then use 'eval' to parse the child's output so that an\n# exception is thrown if the input is anything other than 'True' nor 'False'.\nos.environ['EMPTY_VAR'] = ''\nchild = gtest_test_utils.Subprocess(\n    [sys.executable, '-c', 'import os; print \\'EMPTY_VAR\\' in os.environ'])\nCAN_PASS_EMPTY_ENV = eval(child.output)\n\n\n# Check if this platform can unset environment variables in child processes.\n# We set an env variable to a non-empty string, unset it, and invoke\n# a python script in a subprocess to print whether the variable\n# is NO LONGER in os.environ.\n# We use 'eval' to parse the child's output so that an exception\n# is thrown if the input is neither 'True' nor 'False'.\nos.environ['UNSET_VAR'] = 'X'\ndel os.environ['UNSET_VAR']\nchild = gtest_test_utils.Subprocess(\n    [sys.executable, '-c', 'import os; print \\'UNSET_VAR\\' not in os.environ'])\nCAN_UNSET_ENV = eval(child.output)\n\n\n# Checks if we should test with an empty filter. This doesn't\n# make sense on platforms that cannot pass empty env variables (Win32)\n# and on platforms that cannot unset variables (since we cannot tell\n# the difference between \"\" and NULL -- Borland and Solaris < 5.10)\nCAN_TEST_EMPTY_FILTER = (CAN_PASS_EMPTY_ENV and CAN_UNSET_ENV)\n\n\n# The environment variable for specifying the test filters.\nFILTER_ENV_VAR = 'GTEST_FILTER'\n\n# The environment variables for test sharding.\nTOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'\nSHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX'\nSHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'\n\n# The command line flag for specifying the test filters.\nFILTER_FLAG = 'gtest_filter'\n\n# The command line flag for including disabled tests.\nALSO_RUN_DISABED_TESTS_FLAG = 'gtest_also_run_disabled_tests'\n\n# Command to run the gtest_filter_unittest_ program.\nCOMMAND = gtest_test_utils.GetTestExecutablePath('gtest_filter_unittest_')\n\n# Regex for determining whether parameterized tests are enabled in the binary.\nPARAM_TEST_REGEX = re.compile(r'/ParamTest')\n\n# Regex for parsing test case names from Google Test's output.\nTEST_CASE_REGEX = re.compile(r'^\\[\\-+\\] \\d+ tests? from (\\w+(/\\w+)?)')\n\n# Regex for parsing test names from Google Test's output.\nTEST_REGEX = re.compile(r'^\\[\\s*RUN\\s*\\].*\\.(\\w+(/\\w+)?)')\n\n# The command line flag to tell Google Test to output the list of tests it\n# will run.\nLIST_TESTS_FLAG = '--gtest_list_tests'\n\n# Indicates whether Google Test supports death tests.\nSUPPORTS_DEATH_TESTS = 'HasDeathTest' in gtest_test_utils.Subprocess(\n    [COMMAND, LIST_TESTS_FLAG]).output\n\n# Full names of all tests in gtest_filter_unittests_.\nPARAM_TESTS = [\n    'SeqP/ParamTest.TestX/0',\n    'SeqP/ParamTest.TestX/1',\n    'SeqP/ParamTest.TestY/0',\n    'SeqP/ParamTest.TestY/1',\n    'SeqQ/ParamTest.TestX/0',\n    'SeqQ/ParamTest.TestX/1',\n    'SeqQ/ParamTest.TestY/0',\n    'SeqQ/ParamTest.TestY/1',\n    ]\n\nDISABLED_TESTS = [\n    'BarTest.DISABLED_TestFour',\n    'BarTest.DISABLED_TestFive',\n    'BazTest.DISABLED_TestC',\n    'DISABLED_FoobarTest.Test1',\n    'DISABLED_FoobarTest.DISABLED_Test2',\n    'DISABLED_FoobarbazTest.TestA',\n    ]\n\nif SUPPORTS_DEATH_TESTS:\n  DEATH_TESTS = [\n    'HasDeathTest.Test1',\n    'HasDeathTest.Test2',\n    ]\nelse:\n  DEATH_TESTS = []\n\n# All the non-disabled tests.\nACTIVE_TESTS = [\n    'FooTest.Abc',\n    'FooTest.Xyz',\n\n    'BarTest.TestOne',\n    'BarTest.TestTwo',\n    'BarTest.TestThree',\n\n    'BazTest.TestOne',\n    'BazTest.TestA',\n    'BazTest.TestB',\n    ] + DEATH_TESTS + PARAM_TESTS\n\nparam_tests_present = None\n\n# Utilities.\n\nenviron = os.environ.copy()\n\n\ndef SetEnvVar(env_var, value):\n  \"\"\"Sets the env variable to 'value'; unsets it when 'value' is None.\"\"\"\n\n  if value is not None:\n    environ[env_var] = value\n  elif env_var in environ:\n    del environ[env_var]\n\n\ndef RunAndReturnOutput(args = None):\n  \"\"\"Runs the test program and returns its output.\"\"\"\n\n  return gtest_test_utils.Subprocess([COMMAND] + (args or []),\n                                     env=environ).output\n\n\ndef RunAndExtractTestList(args = None):\n  \"\"\"Runs the test program and returns its exit code and a list of tests run.\"\"\"\n\n  p = gtest_test_utils.Subprocess([COMMAND] + (args or []), env=environ)\n  tests_run = []\n  test_case = ''\n  test = ''\n  for line in p.output.split('\\n'):\n    match = TEST_CASE_REGEX.match(line)\n    if match is not None:\n      test_case = match.group(1)\n    else:\n      match = TEST_REGEX.match(line)\n      if match is not None:\n        test = match.group(1)\n        tests_run.append(test_case + '.' + test)\n  return (tests_run, p.exit_code)\n\n\ndef InvokeWithModifiedEnv(extra_env, function, *args, **kwargs):\n  \"\"\"Runs the given function and arguments in a modified environment.\"\"\"\n  try:\n    original_env = environ.copy()\n    environ.update(extra_env)\n    return function(*args, **kwargs)\n  finally:\n    environ.clear()\n    environ.update(original_env)\n\n\ndef RunWithSharding(total_shards, shard_index, command):\n  \"\"\"Runs a test program shard and returns exit code and a list of tests run.\"\"\"\n\n  extra_env = {SHARD_INDEX_ENV_VAR: str(shard_index),\n               TOTAL_SHARDS_ENV_VAR: str(total_shards)}\n  return InvokeWithModifiedEnv(extra_env, RunAndExtractTestList, command)\n\n# The unit test.\n\n\nclass GTestFilterUnitTest(gtest_test_utils.TestCase):\n  \"\"\"Tests the env variable or the command line flag to filter tests.\"\"\"\n\n  # Utilities.\n\n  def AssertSetEqual(self, lhs, rhs):\n    \"\"\"Asserts that two sets are equal.\"\"\"\n\n    for elem in lhs:\n      self.assert_(elem in rhs, '%s in %s' % (elem, rhs))\n\n    for elem in rhs:\n      self.assert_(elem in lhs, '%s in %s' % (elem, lhs))\n\n  def AssertPartitionIsValid(self, set_var, list_of_sets):\n    \"\"\"Asserts that list_of_sets is a valid partition of set_var.\"\"\"\n\n    full_partition = []\n    for slice_var in list_of_sets:\n      full_partition.extend(slice_var)\n    self.assertEqual(len(set_var), len(full_partition))\n    self.assertEqual(sets.Set(set_var), sets.Set(full_partition))\n\n  def AdjustForParameterizedTests(self, tests_to_run):\n    \"\"\"Adjust tests_to_run in case value parameterized tests are disabled.\"\"\"\n\n    global param_tests_present\n    if not param_tests_present:\n      return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS))\n    else:\n      return tests_to_run\n\n  def RunAndVerify(self, gtest_filter, tests_to_run):\n    \"\"\"Checks that the binary runs correct set of tests for a given filter.\"\"\"\n\n    tests_to_run = self.AdjustForParameterizedTests(tests_to_run)\n\n    # First, tests using the environment variable.\n\n    # Windows removes empty variables from the environment when passing it\n    # to a new process.  This means it is impossible to pass an empty filter\n    # into a process using the environment variable.  However, we can still\n    # test the case when the variable is not supplied (i.e., gtest_filter is\n    # None).\n    # pylint: disable-msg=C6403\n    if CAN_TEST_EMPTY_FILTER or gtest_filter != '':\n      SetEnvVar(FILTER_ENV_VAR, gtest_filter)\n      tests_run = RunAndExtractTestList()[0]\n      SetEnvVar(FILTER_ENV_VAR, None)\n      self.AssertSetEqual(tests_run, tests_to_run)\n    # pylint: enable-msg=C6403\n\n    # Next, tests using the command line flag.\n\n    if gtest_filter is None:\n      args = []\n    else:\n      args = ['--%s=%s' % (FILTER_FLAG, gtest_filter)]\n\n    tests_run = RunAndExtractTestList(args)[0]\n    self.AssertSetEqual(tests_run, tests_to_run)\n\n  def RunAndVerifyWithSharding(self, gtest_filter, total_shards, tests_to_run,\n                               args=None, check_exit_0=False):\n    \"\"\"Checks that binary runs correct tests for the given filter and shard.\n\n    Runs all shards of gtest_filter_unittest_ with the given filter, and\n    verifies that the right set of tests were run. The union of tests run\n    on each shard should be identical to tests_to_run, without duplicates.\n\n    Args:\n      gtest_filter: A filter to apply to the tests.\n      total_shards: A total number of shards to split test run into.\n      tests_to_run: A set of tests expected to run.\n      args   :      Arguments to pass to the to the test binary.\n      check_exit_0: When set to a true value, make sure that all shards\n                    return 0.\n    \"\"\"\n\n    tests_to_run = self.AdjustForParameterizedTests(tests_to_run)\n\n    # Windows removes empty variables from the environment when passing it\n    # to a new process.  This means it is impossible to pass an empty filter\n    # into a process using the environment variable.  However, we can still\n    # test the case when the variable is not supplied (i.e., gtest_filter is\n    # None).\n    # pylint: disable-msg=C6403\n    if CAN_TEST_EMPTY_FILTER or gtest_filter != '':\n      SetEnvVar(FILTER_ENV_VAR, gtest_filter)\n      partition = []\n      for i in range(0, total_shards):\n        (tests_run, exit_code) = RunWithSharding(total_shards, i, args)\n        if check_exit_0:\n          self.assertEqual(0, exit_code)\n        partition.append(tests_run)\n\n      self.AssertPartitionIsValid(tests_to_run, partition)\n      SetEnvVar(FILTER_ENV_VAR, None)\n    # pylint: enable-msg=C6403\n\n  def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run):\n    \"\"\"Checks that the binary runs correct set of tests for the given filter.\n\n    Runs gtest_filter_unittest_ with the given filter, and enables\n    disabled tests. Verifies that the right set of tests were run.\n\n    Args:\n      gtest_filter: A filter to apply to the tests.\n      tests_to_run: A set of tests expected to run.\n    \"\"\"\n\n    tests_to_run = self.AdjustForParameterizedTests(tests_to_run)\n\n    # Construct the command line.\n    args = ['--%s' % ALSO_RUN_DISABED_TESTS_FLAG]\n    if gtest_filter is not None:\n      args.append('--%s=%s' % (FILTER_FLAG, gtest_filter))\n\n    tests_run = RunAndExtractTestList(args)[0]\n    self.AssertSetEqual(tests_run, tests_to_run)\n\n  def setUp(self):\n    \"\"\"Sets up test case.\n\n    Determines whether value-parameterized tests are enabled in the binary and\n    sets the flags accordingly.\n    \"\"\"\n\n    global param_tests_present\n    if param_tests_present is None:\n      param_tests_present = PARAM_TEST_REGEX.search(\n          RunAndReturnOutput()) is not None\n\n  def testDefaultBehavior(self):\n    \"\"\"Tests the behavior of not specifying the filter.\"\"\"\n\n    self.RunAndVerify(None, ACTIVE_TESTS)\n\n  def testDefaultBehaviorWithShards(self):\n    \"\"\"Tests the behavior without the filter, with sharding enabled.\"\"\"\n\n    self.RunAndVerifyWithSharding(None, 1, ACTIVE_TESTS)\n    self.RunAndVerifyWithSharding(None, 2, ACTIVE_TESTS)\n    self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) - 1, ACTIVE_TESTS)\n    self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS), ACTIVE_TESTS)\n    self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) + 1, ACTIVE_TESTS)\n\n  def testEmptyFilter(self):\n    \"\"\"Tests an empty filter.\"\"\"\n\n    self.RunAndVerify('', [])\n    self.RunAndVerifyWithSharding('', 1, [])\n    self.RunAndVerifyWithSharding('', 2, [])\n\n  def testBadFilter(self):\n    \"\"\"Tests a filter that matches nothing.\"\"\"\n\n    self.RunAndVerify('BadFilter', [])\n    self.RunAndVerifyAllowingDisabled('BadFilter', [])\n\n  def testFullName(self):\n    \"\"\"Tests filtering by full name.\"\"\"\n\n    self.RunAndVerify('FooTest.Xyz', ['FooTest.Xyz'])\n    self.RunAndVerifyAllowingDisabled('FooTest.Xyz', ['FooTest.Xyz'])\n    self.RunAndVerifyWithSharding('FooTest.Xyz', 5, ['FooTest.Xyz'])\n\n  def testUniversalFilters(self):\n    \"\"\"Tests filters that match everything.\"\"\"\n\n    self.RunAndVerify('*', ACTIVE_TESTS)\n    self.RunAndVerify('*.*', ACTIVE_TESTS)\n    self.RunAndVerifyWithSharding('*.*', len(ACTIVE_TESTS) - 3, ACTIVE_TESTS)\n    self.RunAndVerifyAllowingDisabled('*', ACTIVE_TESTS + DISABLED_TESTS)\n    self.RunAndVerifyAllowingDisabled('*.*', ACTIVE_TESTS + DISABLED_TESTS)\n\n  def testFilterByTestCase(self):\n    \"\"\"Tests filtering by test case name.\"\"\"\n\n    self.RunAndVerify('FooTest.*', ['FooTest.Abc', 'FooTest.Xyz'])\n\n    BAZ_TESTS = ['BazTest.TestOne', 'BazTest.TestA', 'BazTest.TestB']\n    self.RunAndVerify('BazTest.*', BAZ_TESTS)\n    self.RunAndVerifyAllowingDisabled('BazTest.*',\n                                      BAZ_TESTS + ['BazTest.DISABLED_TestC'])\n\n  def testFilterByTest(self):\n    \"\"\"Tests filtering by test name.\"\"\"\n\n    self.RunAndVerify('*.TestOne', ['BarTest.TestOne', 'BazTest.TestOne'])\n\n  def testFilterDisabledTests(self):\n    \"\"\"Select only the disabled tests to run.\"\"\"\n\n    self.RunAndVerify('DISABLED_FoobarTest.Test1', [])\n    self.RunAndVerifyAllowingDisabled('DISABLED_FoobarTest.Test1',\n                                      ['DISABLED_FoobarTest.Test1'])\n\n    self.RunAndVerify('*DISABLED_*', [])\n    self.RunAndVerifyAllowingDisabled('*DISABLED_*', DISABLED_TESTS)\n\n    self.RunAndVerify('*.DISABLED_*', [])\n    self.RunAndVerifyAllowingDisabled('*.DISABLED_*', [\n        'BarTest.DISABLED_TestFour',\n        'BarTest.DISABLED_TestFive',\n        'BazTest.DISABLED_TestC',\n        'DISABLED_FoobarTest.DISABLED_Test2',\n        ])\n\n    self.RunAndVerify('DISABLED_*', [])\n    self.RunAndVerifyAllowingDisabled('DISABLED_*', [\n        'DISABLED_FoobarTest.Test1',\n        'DISABLED_FoobarTest.DISABLED_Test2',\n        'DISABLED_FoobarbazTest.TestA',\n        ])\n\n  def testWildcardInTestCaseName(self):\n    \"\"\"Tests using wildcard in the test case name.\"\"\"\n\n    self.RunAndVerify('*a*.*', [\n        'BarTest.TestOne',\n        'BarTest.TestTwo',\n        'BarTest.TestThree',\n\n        'BazTest.TestOne',\n        'BazTest.TestA',\n        'BazTest.TestB', ] + DEATH_TESTS + PARAM_TESTS)\n\n  def testWildcardInTestName(self):\n    \"\"\"Tests using wildcard in the test name.\"\"\"\n\n    self.RunAndVerify('*.*A*', ['FooTest.Abc', 'BazTest.TestA'])\n\n  def testFilterWithoutDot(self):\n    \"\"\"Tests a filter that has no '.' in it.\"\"\"\n\n    self.RunAndVerify('*z*', [\n        'FooTest.Xyz',\n\n        'BazTest.TestOne',\n        'BazTest.TestA',\n        'BazTest.TestB',\n        ])\n\n  def testTwoPatterns(self):\n    \"\"\"Tests filters that consist of two patterns.\"\"\"\n\n    self.RunAndVerify('Foo*.*:*A*', [\n        'FooTest.Abc',\n        'FooTest.Xyz',\n\n        'BazTest.TestA',\n        ])\n\n    # An empty pattern + a non-empty one\n    self.RunAndVerify(':*A*', ['FooTest.Abc', 'BazTest.TestA'])\n\n  def testThreePatterns(self):\n    \"\"\"Tests filters that consist of three patterns.\"\"\"\n\n    self.RunAndVerify('*oo*:*A*:*One', [\n        'FooTest.Abc',\n        'FooTest.Xyz',\n\n        'BarTest.TestOne',\n\n        'BazTest.TestOne',\n        'BazTest.TestA',\n        ])\n\n    # The 2nd pattern is empty.\n    self.RunAndVerify('*oo*::*One', [\n        'FooTest.Abc',\n        'FooTest.Xyz',\n\n        'BarTest.TestOne',\n\n        'BazTest.TestOne',\n        ])\n\n    # The last 2 patterns are empty.\n    self.RunAndVerify('*oo*::', [\n        'FooTest.Abc',\n        'FooTest.Xyz',\n        ])\n\n  def testNegativeFilters(self):\n    self.RunAndVerify('*-BazTest.TestOne', [\n        'FooTest.Abc',\n        'FooTest.Xyz',\n\n        'BarTest.TestOne',\n        'BarTest.TestTwo',\n        'BarTest.TestThree',\n\n        'BazTest.TestA',\n        'BazTest.TestB',\n        ] + DEATH_TESTS + PARAM_TESTS)\n\n    self.RunAndVerify('*-FooTest.Abc:BazTest.*', [\n        'FooTest.Xyz',\n\n        'BarTest.TestOne',\n        'BarTest.TestTwo',\n        'BarTest.TestThree',\n        ] + DEATH_TESTS + PARAM_TESTS)\n\n    self.RunAndVerify('BarTest.*-BarTest.TestOne', [\n        'BarTest.TestTwo',\n        'BarTest.TestThree',\n        ])\n\n    # Tests without leading '*'.\n    self.RunAndVerify('-FooTest.Abc:FooTest.Xyz:BazTest.*', [\n        'BarTest.TestOne',\n        'BarTest.TestTwo',\n        'BarTest.TestThree',\n        ] + DEATH_TESTS + PARAM_TESTS)\n\n    # Value parameterized tests.\n    self.RunAndVerify('*/*', PARAM_TESTS)\n\n    # Value parameterized tests filtering by the sequence name.\n    self.RunAndVerify('SeqP/*', [\n        'SeqP/ParamTest.TestX/0',\n        'SeqP/ParamTest.TestX/1',\n        'SeqP/ParamTest.TestY/0',\n        'SeqP/ParamTest.TestY/1',\n        ])\n\n    # Value parameterized tests filtering by the test name.\n    self.RunAndVerify('*/0', [\n        'SeqP/ParamTest.TestX/0',\n        'SeqP/ParamTest.TestY/0',\n        'SeqQ/ParamTest.TestX/0',\n        'SeqQ/ParamTest.TestY/0',\n        ])\n\n  def testFlagOverridesEnvVar(self):\n    \"\"\"Tests that the filter flag overrides the filtering env. variable.\"\"\"\n\n    SetEnvVar(FILTER_ENV_VAR, 'Foo*')\n    args = ['--%s=%s' % (FILTER_FLAG, '*One')]\n    tests_run = RunAndExtractTestList(args)[0]\n    SetEnvVar(FILTER_ENV_VAR, None)\n\n    self.AssertSetEqual(tests_run, ['BarTest.TestOne', 'BazTest.TestOne'])\n\n  def testShardStatusFileIsCreated(self):\n    \"\"\"Tests that the shard file is created if specified in the environment.\"\"\"\n\n    shard_status_file = os.path.join(gtest_test_utils.GetTempDir(),\n                                     'shard_status_file')\n    self.assert_(not os.path.exists(shard_status_file))\n\n    extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file}\n    try:\n      InvokeWithModifiedEnv(extra_env, RunAndReturnOutput)\n    finally:\n      self.assert_(os.path.exists(shard_status_file))\n      os.remove(shard_status_file)\n\n  def testShardStatusFileIsCreatedWithListTests(self):\n    \"\"\"Tests that the shard file is created with the \"list_tests\" flag.\"\"\"\n\n    shard_status_file = os.path.join(gtest_test_utils.GetTempDir(),\n                                     'shard_status_file2')\n    self.assert_(not os.path.exists(shard_status_file))\n\n    extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file}\n    try:\n      output = InvokeWithModifiedEnv(extra_env,\n                                     RunAndReturnOutput,\n                                     [LIST_TESTS_FLAG])\n    finally:\n      # This assertion ensures that Google Test enumerated the tests as\n      # opposed to running them.\n      self.assert_('[==========]' not in output,\n                   'Unexpected output during test enumeration.\\n'\n                   'Please ensure that LIST_TESTS_FLAG is assigned the\\n'\n                   'correct flag value for listing Google Test tests.')\n\n      self.assert_(os.path.exists(shard_status_file))\n      os.remove(shard_status_file)\n\n  if SUPPORTS_DEATH_TESTS:\n    def testShardingWorksWithDeathTests(self):\n      \"\"\"Tests integration with death tests and sharding.\"\"\"\n\n      gtest_filter = 'HasDeathTest.*:SeqP/*'\n      expected_tests = [\n          'HasDeathTest.Test1',\n          'HasDeathTest.Test2',\n\n          'SeqP/ParamTest.TestX/0',\n          'SeqP/ParamTest.TestX/1',\n          'SeqP/ParamTest.TestY/0',\n          'SeqP/ParamTest.TestY/1',\n          ]\n\n      for flag in ['--gtest_death_test_style=threadsafe',\n                   '--gtest_death_test_style=fast']:\n        self.RunAndVerifyWithSharding(gtest_filter, 3, expected_tests,\n                                      check_exit_0=True, args=[flag])\n        self.RunAndVerifyWithSharding(gtest_filter, 5, expected_tests,\n                                      check_exit_0=True, args=[flag])\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_filter_unittest_.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Unit test for Google Test test filters.\n//\n// A user can specify which test(s) in a Google Test program to run via\n// either the GTEST_FILTER environment variable or the --gtest_filter\n// flag.  This is used for testing such functionality.\n//\n// The program will be invoked from a Python unit test.  Don't run it\n// directly.\n\n#include \"gtest/gtest.h\"\n\nnamespace {\n\n// Test case FooTest.\n\nclass FooTest : public testing::Test {\n};\n\nTEST_F(FooTest, Abc) {\n}\n\nTEST_F(FooTest, Xyz) {\n  FAIL() << \"Expected failure.\";\n}\n\n// Test case BarTest.\n\nTEST(BarTest, TestOne) {\n}\n\nTEST(BarTest, TestTwo) {\n}\n\nTEST(BarTest, TestThree) {\n}\n\nTEST(BarTest, DISABLED_TestFour) {\n  FAIL() << \"Expected failure.\";\n}\n\nTEST(BarTest, DISABLED_TestFive) {\n  FAIL() << \"Expected failure.\";\n}\n\n// Test case BazTest.\n\nTEST(BazTest, TestOne) {\n  FAIL() << \"Expected failure.\";\n}\n\nTEST(BazTest, TestA) {\n}\n\nTEST(BazTest, TestB) {\n}\n\nTEST(BazTest, DISABLED_TestC) {\n  FAIL() << \"Expected failure.\";\n}\n\n// Test case HasDeathTest\n\nTEST(HasDeathTest, Test1) {\n  EXPECT_DEATH_IF_SUPPORTED(exit(1), \".*\");\n}\n\n// We need at least two death tests to make sure that the all death tests\n// aren't on the first shard.\nTEST(HasDeathTest, Test2) {\n  EXPECT_DEATH_IF_SUPPORTED(exit(1), \".*\");\n}\n\n// Test case FoobarTest\n\nTEST(DISABLED_FoobarTest, Test1) {\n  FAIL() << \"Expected failure.\";\n}\n\nTEST(DISABLED_FoobarTest, DISABLED_Test2) {\n  FAIL() << \"Expected failure.\";\n}\n\n// Test case FoobarbazTest\n\nTEST(DISABLED_FoobarbazTest, TestA) {\n  FAIL() << \"Expected failure.\";\n}\n\n#if GTEST_HAS_PARAM_TEST\nclass ParamTest : public testing::TestWithParam<int> {\n};\n\nTEST_P(ParamTest, TestX) {\n}\n\nTEST_P(ParamTest, TestY) {\n}\n\nINSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));\nINSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));\n#endif  // GTEST_HAS_PARAM_TEST\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  ::testing::InitGoogleTest(&argc, argv);\n\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_help_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Tests the --help flag of Google C++ Testing Framework.\n\nSYNOPSIS\n       gtest_help_test.py --build_dir=BUILD/DIR\n         # where BUILD/DIR contains the built gtest_help_test_ file.\n       gtest_help_test.py\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport re\nimport gtest_test_utils\n\n\nIS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'\nIS_WINDOWS = os.name == 'nt'\n\nPROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_help_test_')\nFLAG_PREFIX = '--gtest_'\nDEATH_TEST_STYLE_FLAG = FLAG_PREFIX + 'death_test_style'\nSTREAM_RESULT_TO_FLAG = FLAG_PREFIX + 'stream_result_to'\nUNKNOWN_FLAG = FLAG_PREFIX + 'unknown_flag_for_testing'\nLIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests'\nINCORRECT_FLAG_VARIANTS = [re.sub('^--', '-', LIST_TESTS_FLAG),\n                           re.sub('^--', '/', LIST_TESTS_FLAG),\n                           re.sub('_', '-', LIST_TESTS_FLAG)]\nINTERNAL_FLAG_FOR_TESTING = FLAG_PREFIX + 'internal_flag_for_testing'\n\nSUPPORTS_DEATH_TESTS = \"DeathTest\" in gtest_test_utils.Subprocess(\n    [PROGRAM_PATH, LIST_TESTS_FLAG]).output\n\n# The help message must match this regex.\nHELP_REGEX = re.compile(\n    FLAG_PREFIX + r'list_tests.*' +\n    FLAG_PREFIX + r'filter=.*' +\n    FLAG_PREFIX + r'also_run_disabled_tests.*' +\n    FLAG_PREFIX + r'repeat=.*' +\n    FLAG_PREFIX + r'shuffle.*' +\n    FLAG_PREFIX + r'random_seed=.*' +\n    FLAG_PREFIX + r'color=.*' +\n    FLAG_PREFIX + r'print_time.*' +\n    FLAG_PREFIX + r'output=.*' +\n    FLAG_PREFIX + r'break_on_failure.*' +\n    FLAG_PREFIX + r'throw_on_failure.*' +\n    FLAG_PREFIX + r'catch_exceptions=0.*',\n    re.DOTALL)\n\n\ndef RunWithFlag(flag):\n  \"\"\"Runs gtest_help_test_ with the given flag.\n\n  Returns:\n    the exit code and the text output as a tuple.\n  Args:\n    flag: the command-line flag to pass to gtest_help_test_, or None.\n  \"\"\"\n\n  if flag is None:\n    command = [PROGRAM_PATH]\n  else:\n    command = [PROGRAM_PATH, flag]\n  child = gtest_test_utils.Subprocess(command)\n  return child.exit_code, child.output\n\n\nclass GTestHelpTest(gtest_test_utils.TestCase):\n  \"\"\"Tests the --help flag and its equivalent forms.\"\"\"\n\n  def TestHelpFlag(self, flag):\n    \"\"\"Verifies correct behavior when help flag is specified.\n\n    The right message must be printed and the tests must\n    skipped when the given flag is specified.\n\n    Args:\n      flag:  A flag to pass to the binary or None.\n    \"\"\"\n\n    exit_code, output = RunWithFlag(flag)\n    self.assertEquals(0, exit_code)\n    self.assert_(HELP_REGEX.search(output), output)\n\n    if IS_LINUX:\n      self.assert_(STREAM_RESULT_TO_FLAG in output, output)\n    else:\n      self.assert_(STREAM_RESULT_TO_FLAG not in output, output)\n\n    if SUPPORTS_DEATH_TESTS and not IS_WINDOWS:\n      self.assert_(DEATH_TEST_STYLE_FLAG in output, output)\n    else:\n      self.assert_(DEATH_TEST_STYLE_FLAG not in output, output)\n\n  def TestNonHelpFlag(self, flag):\n    \"\"\"Verifies correct behavior when no help flag is specified.\n\n    Verifies that when no help flag is specified, the tests are run\n    and the help message is not printed.\n\n    Args:\n      flag:  A flag to pass to the binary or None.\n    \"\"\"\n\n    exit_code, output = RunWithFlag(flag)\n    self.assert_(exit_code != 0)\n    self.assert_(not HELP_REGEX.search(output), output)\n\n  def testPrintsHelpWithFullFlag(self):\n    self.TestHelpFlag('--help')\n\n  def testPrintsHelpWithShortFlag(self):\n    self.TestHelpFlag('-h')\n\n  def testPrintsHelpWithQuestionFlag(self):\n    self.TestHelpFlag('-?')\n\n  def testPrintsHelpWithWindowsStyleQuestionFlag(self):\n    self.TestHelpFlag('/?')\n\n  def testPrintsHelpWithUnrecognizedGoogleTestFlag(self):\n    self.TestHelpFlag(UNKNOWN_FLAG)\n\n  def testPrintsHelpWithIncorrectFlagStyle(self):\n    for incorrect_flag in INCORRECT_FLAG_VARIANTS:\n      self.TestHelpFlag(incorrect_flag)\n\n  def testRunsTestsWithoutHelpFlag(self):\n    \"\"\"Verifies that when no help flag is specified, the tests are run\n    and the help message is not printed.\"\"\"\n\n    self.TestNonHelpFlag(None)\n\n  def testRunsTestsWithGtestInternalFlag(self):\n    \"\"\"Verifies that the tests are run and no help message is printed when\n    a flag starting with Google Test prefix and 'internal_' is supplied.\"\"\"\n\n    self.TestNonHelpFlag(INTERNAL_FLAG_FOR_TESTING)\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_help_test_.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// This program is meant to be run by gtest_help_test.py.  Do not run\n// it directly.\n\n#include \"gtest/gtest.h\"\n\n// When a help flag is specified, this program should skip the tests\n// and exit with 0; otherwise the following test will be executed,\n// causing this program to exit with a non-zero code.\nTEST(HelpFlagTest, ShouldNotBeRun) {\n  ASSERT_TRUE(false) << \"Tests shouldn't be run when --help is specified.\";\n}\n\n#if GTEST_HAS_DEATH_TEST\nTEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {}\n#endif\n"
  },
  {
    "path": "Tests/gtest/test/gtest_list_tests_unittest.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test for Google Test's --gtest_list_tests flag.\n\nA user can ask Google Test to list all tests by specifying the\n--gtest_list_tests flag.  This script tests such functionality\nby invoking gtest_list_tests_unittest_ (a program written with\nGoogle Test) the command line flags.\n\"\"\"\n\n__author__ = 'phanna@google.com (Patrick Hanna)'\n\nimport gtest_test_utils\nimport re\n\n\n# Constants.\n\n# The command line flag for enabling/disabling listing all tests.\nLIST_TESTS_FLAG = 'gtest_list_tests'\n\n# Path to the gtest_list_tests_unittest_ program.\nEXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_list_tests_unittest_')\n\n# The expected output when running gtest_list_tests_unittest_ with\n# --gtest_list_tests\nEXPECTED_OUTPUT_NO_FILTER_RE = re.compile(r\"\"\"FooDeathTest\\.\n  Test1\nFoo\\.\n  Bar1\n  Bar2\n  DISABLED_Bar3\nAbc\\.\n  Xyz\n  Def\nFooBar\\.\n  Baz\nFooTest\\.\n  Test1\n  DISABLED_Test2\n  Test3\nTypedTest/0\\.  # TypeParam = (VeryLo{245}|class VeryLo{239})\\.\\.\\.\n  TestA\n  TestB\nTypedTest/1\\.  # TypeParam = int\\s*\\*\n  TestA\n  TestB\nTypedTest/2\\.  # TypeParam = .*MyArray<bool,\\s*42>\n  TestA\n  TestB\nMy/TypeParamTest/0\\.  # TypeParam = (VeryLo{245}|class VeryLo{239})\\.\\.\\.\n  TestA\n  TestB\nMy/TypeParamTest/1\\.  # TypeParam = int\\s*\\*\n  TestA\n  TestB\nMy/TypeParamTest/2\\.  # TypeParam = .*MyArray<bool,\\s*42>\n  TestA\n  TestB\nMyInstantiation/ValueParamTest\\.\n  TestA/0  # GetParam\\(\\) = one line\n  TestA/1  # GetParam\\(\\) = two\\\\nlines\n  TestA/2  # GetParam\\(\\) = a very\\\\nlo{241}\\.\\.\\.\n  TestB/0  # GetParam\\(\\) = one line\n  TestB/1  # GetParam\\(\\) = two\\\\nlines\n  TestB/2  # GetParam\\(\\) = a very\\\\nlo{241}\\.\\.\\.\n\"\"\")\n\n# The expected output when running gtest_list_tests_unittest_ with\n# --gtest_list_tests and --gtest_filter=Foo*.\nEXPECTED_OUTPUT_FILTER_FOO_RE = re.compile(r\"\"\"FooDeathTest\\.\n  Test1\nFoo\\.\n  Bar1\n  Bar2\n  DISABLED_Bar3\nFooBar\\.\n  Baz\nFooTest\\.\n  Test1\n  DISABLED_Test2\n  Test3\n\"\"\")\n\n# Utilities.\n\n\ndef Run(args):\n  \"\"\"Runs gtest_list_tests_unittest_ and returns the list of tests printed.\"\"\"\n\n  return gtest_test_utils.Subprocess([EXE_PATH] + args,\n                                     capture_stderr=False).output\n\n\n# The unit test.\n\nclass GTestListTestsUnitTest(gtest_test_utils.TestCase):\n  \"\"\"Tests using the --gtest_list_tests flag to list all tests.\"\"\"\n\n  def RunAndVerify(self, flag_value, expected_output_re, other_flag):\n    \"\"\"Runs gtest_list_tests_unittest_ and verifies that it prints\n    the correct tests.\n\n    Args:\n      flag_value:         value of the --gtest_list_tests flag;\n                          None if the flag should not be present.\n      expected_output_re: regular expression that matches the expected\n                          output after running command;\n      other_flag:         a different flag to be passed to command\n                          along with gtest_list_tests;\n                          None if the flag should not be present.\n    \"\"\"\n\n    if flag_value is None:\n      flag = ''\n      flag_expression = 'not set'\n    elif flag_value == '0':\n      flag = '--%s=0' % LIST_TESTS_FLAG\n      flag_expression = '0'\n    else:\n      flag = '--%s' % LIST_TESTS_FLAG\n      flag_expression = '1'\n\n    args = [flag]\n\n    if other_flag is not None:\n      args += [other_flag]\n\n    output = Run(args)\n\n    if expected_output_re:\n      self.assert_(\n          expected_output_re.match(output),\n          ('when %s is %s, the output of \"%s\" is \"%s\",\\n'\n           'which does not match regex \"%s\"' %\n           (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output,\n            expected_output_re.pattern)))\n    else:\n      self.assert_(\n          not EXPECTED_OUTPUT_NO_FILTER_RE.match(output),\n          ('when %s is %s, the output of \"%s\" is \"%s\"'%\n           (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output)))\n\n  def testDefaultBehavior(self):\n    \"\"\"Tests the behavior of the default mode.\"\"\"\n\n    self.RunAndVerify(flag_value=None,\n                      expected_output_re=None,\n                      other_flag=None)\n\n  def testFlag(self):\n    \"\"\"Tests using the --gtest_list_tests flag.\"\"\"\n\n    self.RunAndVerify(flag_value='0',\n                      expected_output_re=None,\n                      other_flag=None)\n    self.RunAndVerify(flag_value='1',\n                      expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,\n                      other_flag=None)\n\n  def testOverrideNonFilterFlags(self):\n    \"\"\"Tests that --gtest_list_tests overrides the non-filter flags.\"\"\"\n\n    self.RunAndVerify(flag_value='1',\n                      expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,\n                      other_flag='--gtest_break_on_failure')\n\n  def testWithFilterFlags(self):\n    \"\"\"Tests that --gtest_list_tests takes into account the\n    --gtest_filter flag.\"\"\"\n\n    self.RunAndVerify(flag_value='1',\n                      expected_output_re=EXPECTED_OUTPUT_FILTER_FOO_RE,\n                      other_flag='--gtest_filter=Foo*')\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_list_tests_unittest_.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: phanna@google.com (Patrick Hanna)\n\n// Unit test for Google Test's --gtest_list_tests flag.\n//\n// A user can ask Google Test to list all tests that will run\n// so that when using a filter, a user will know what\n// tests to look for. The tests will not be run after listing.\n//\n// This program will be invoked from a Python unit test.\n// Don't run it directly.\n\n#include \"gtest/gtest.h\"\n\n// Several different test cases and tests that will be listed.\nTEST(Foo, Bar1) {\n}\n\nTEST(Foo, Bar2) {\n}\n\nTEST(Foo, DISABLED_Bar3) {\n}\n\nTEST(Abc, Xyz) {\n}\n\nTEST(Abc, Def) {\n}\n\nTEST(FooBar, Baz) {\n}\n\nclass FooTest : public testing::Test {\n};\n\nTEST_F(FooTest, Test1) {\n}\n\nTEST_F(FooTest, DISABLED_Test2) {\n}\n\nTEST_F(FooTest, Test3) {\n}\n\nTEST(FooDeathTest, Test1) {\n}\n\n// A group of value-parameterized tests.\n\nclass MyType {\n public:\n  explicit MyType(const std::string& a_value) : value_(a_value) {}\n\n  const std::string& value() const { return value_; }\n\n private:\n  std::string value_;\n};\n\n// Teaches Google Test how to print a MyType.\nvoid PrintTo(const MyType& x, std::ostream* os) {\n  *os << x.value();\n}\n\nclass ValueParamTest : public testing::TestWithParam<MyType> {\n};\n\nTEST_P(ValueParamTest, TestA) {\n}\n\nTEST_P(ValueParamTest, TestB) {\n}\n\nINSTANTIATE_TEST_CASE_P(\n    MyInstantiation, ValueParamTest,\n    testing::Values(MyType(\"one line\"),\n                    MyType(\"two\\nlines\"),\n                    MyType(\"a very\\nloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line\")));  // NOLINT\n\n// A group of typed tests.\n\n// A deliberately long type name for testing the line-truncating\n// behavior when printing a type parameter.\nclass VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName {  // NOLINT\n};\n\ntemplate <typename T>\nclass TypedTest : public testing::Test {\n};\n\ntemplate <typename T, int kSize>\nclass MyArray {\n};\n\ntypedef testing::Types<VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName,  // NOLINT\n                       int*, MyArray<bool, 42> > MyTypes;\n\nTYPED_TEST_CASE(TypedTest, MyTypes);\n\nTYPED_TEST(TypedTest, TestA) {\n}\n\nTYPED_TEST(TypedTest, TestB) {\n}\n\n// A group of type-parameterized tests.\n\ntemplate <typename T>\nclass TypeParamTest : public testing::Test {\n};\n\nTYPED_TEST_CASE_P(TypeParamTest);\n\nTYPED_TEST_P(TypeParamTest, TestA) {\n}\n\nTYPED_TEST_P(TypeParamTest, TestB) {\n}\n\nREGISTER_TYPED_TEST_CASE_P(TypeParamTest, TestA, TestB);\n\nINSTANTIATE_TYPED_TEST_CASE_P(My, TypeParamTest, MyTypes);\n\nint main(int argc, char **argv) {\n  ::testing::InitGoogleTest(&argc, argv);\n\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_main_unittest.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/gtest.h\"\n\n// Tests that we don't have to define main() when we link to\n// gtest_main instead of gtest.\n\nnamespace {\n\nTEST(GTestMainTest, ShouldSucceed) {\n}\n\n}  // namespace\n\n// We are using the main() function defined in src/gtest_main.cc, so\n// we don't define it here.\n"
  },
  {
    "path": "Tests/gtest/test/gtest_no_test_unittest.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Tests that a Google Test program that has no test defined can run\n// successfully.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/gtest.h\"\n\nint main(int argc, char **argv) {\n  testing::InitGoogleTest(&argc, argv);\n\n  // An ad-hoc assertion outside of all tests.\n  //\n  // This serves three purposes:\n  //\n  // 1. It verifies that an ad-hoc assertion can be executed even if\n  //    no test is defined.\n  // 2. It verifies that a failed ad-hoc assertion causes the test\n  //    program to fail.\n  // 3. We had a bug where the XML output won't be generated if an\n  //    assertion is executed before RUN_ALL_TESTS() is called, even\n  //    though --gtest_output=xml is specified.  This makes sure the\n  //    bug is fixed and doesn't regress.\n  EXPECT_EQ(1, 2);\n\n  // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero.\n  return RUN_ALL_TESTS() ? 0 : 1;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_output_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Tests the text output of Google C++ Testing Framework.\n\nSYNOPSIS\n       gtest_output_test.py --build_dir=BUILD/DIR --gengolden\n         # where BUILD/DIR contains the built gtest_output_test_ file.\n       gtest_output_test.py --gengolden\n       gtest_output_test.py\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport re\nimport sys\nimport gtest_test_utils\n\n\n# The flag for generating the golden file\nGENGOLDEN_FLAG = '--gengolden'\nCATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS'\n\nIS_WINDOWS = os.name == 'nt'\n\n# TODO(vladl@google.com): remove the _lin suffix.\nGOLDEN_NAME = 'gtest_output_test_golden_lin.txt'\n\nPROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_')\n\n# At least one command we exercise must not have the\n# --gtest_internal_skip_environment_and_ad_hoc_tests flag.\nCOMMAND_LIST_TESTS = ({}, [PROGRAM_PATH, '--gtest_list_tests'])\nCOMMAND_WITH_COLOR = ({}, [PROGRAM_PATH, '--gtest_color=yes'])\nCOMMAND_WITH_TIME = ({}, [PROGRAM_PATH,\n                          '--gtest_print_time',\n                          '--gtest_internal_skip_environment_and_ad_hoc_tests',\n                          '--gtest_filter=FatalFailureTest.*:LoggingTest.*'])\nCOMMAND_WITH_DISABLED = (\n    {}, [PROGRAM_PATH,\n         '--gtest_also_run_disabled_tests',\n         '--gtest_internal_skip_environment_and_ad_hoc_tests',\n         '--gtest_filter=*DISABLED_*'])\nCOMMAND_WITH_SHARDING = (\n    {'GTEST_SHARD_INDEX': '1', 'GTEST_TOTAL_SHARDS': '2'},\n    [PROGRAM_PATH,\n     '--gtest_internal_skip_environment_and_ad_hoc_tests',\n     '--gtest_filter=PassingTest.*'])\n\nGOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), GOLDEN_NAME)\n\n\ndef ToUnixLineEnding(s):\n  \"\"\"Changes all Windows/Mac line endings in s to UNIX line endings.\"\"\"\n\n  return s.replace('\\r\\n', '\\n').replace('\\r', '\\n')\n\n\ndef RemoveLocations(test_output):\n  \"\"\"Removes all file location info from a Google Test program's output.\n\n  Args:\n       test_output:  the output of a Google Test program.\n\n  Returns:\n       output with all file location info (in the form of\n       'DIRECTORY/FILE_NAME:LINE_NUMBER: 'or\n       'DIRECTORY\\\\FILE_NAME(LINE_NUMBER): ') replaced by\n       'FILE_NAME:#: '.\n  \"\"\"\n\n  return re.sub(r'.*[/\\\\](.+)(\\:\\d+|\\(\\d+\\))\\: ', r'\\1:#: ', test_output)\n\n\ndef RemoveStackTraceDetails(output):\n  \"\"\"Removes all stack traces from a Google Test program's output.\"\"\"\n\n  # *? means \"find the shortest string that matches\".\n  return re.sub(r'Stack trace:(.|\\n)*?\\n\\n',\n                'Stack trace: (omitted)\\n\\n', output)\n\n\ndef RemoveStackTraces(output):\n  \"\"\"Removes all traces of stack traces from a Google Test program's output.\"\"\"\n\n  # *? means \"find the shortest string that matches\".\n  return re.sub(r'Stack trace:(.|\\n)*?\\n\\n', '', output)\n\n\ndef RemoveTime(output):\n  \"\"\"Removes all time information from a Google Test program's output.\"\"\"\n\n  return re.sub(r'\\(\\d+ ms', '(? ms', output)\n\n\ndef RemoveTypeInfoDetails(test_output):\n  \"\"\"Removes compiler-specific type info from Google Test program's output.\n\n  Args:\n       test_output:  the output of a Google Test program.\n\n  Returns:\n       output with type information normalized to canonical form.\n  \"\"\"\n\n  # some compilers output the name of type 'unsigned int' as 'unsigned'\n  return re.sub(r'unsigned int', 'unsigned', test_output)\n\n\ndef NormalizeToCurrentPlatform(test_output):\n  \"\"\"Normalizes platform specific output details for easier comparison.\"\"\"\n\n  if IS_WINDOWS:\n    # Removes the color information that is not present on Windows.\n    test_output = re.sub('\\x1b\\\\[(0;3\\d)?m', '', test_output)\n    # Changes failure message headers into the Windows format.\n    test_output = re.sub(r': Failure\\n', r': error: ', test_output)\n    # Changes file(line_number) to file:line_number.\n    test_output = re.sub(r'((\\w|\\.)+)\\((\\d+)\\):', r'\\1:\\3:', test_output)\n\n  return test_output\n\n\ndef RemoveTestCounts(output):\n  \"\"\"Removes test counts from a Google Test program's output.\"\"\"\n\n  output = re.sub(r'\\d+ tests?, listed below',\n                  '? tests, listed below', output)\n  output = re.sub(r'\\d+ FAILED TESTS',\n                  '? FAILED TESTS', output)\n  output = re.sub(r'\\d+ tests? from \\d+ test cases?',\n                  '? tests from ? test cases', output)\n  output = re.sub(r'\\d+ tests? from ([a-zA-Z_])',\n                  r'? tests from \\1', output)\n  return re.sub(r'\\d+ tests?\\.', '? tests.', output)\n\n\ndef RemoveMatchingTests(test_output, pattern):\n  \"\"\"Removes output of specified tests from a Google Test program's output.\n\n  This function strips not only the beginning and the end of a test but also\n  all output in between.\n\n  Args:\n    test_output:       A string containing the test output.\n    pattern:           A regex string that matches names of test cases or\n                       tests to remove.\n\n  Returns:\n    Contents of test_output with tests whose names match pattern removed.\n  \"\"\"\n\n  test_output = re.sub(\n      r'.*\\[ RUN      \\] .*%s(.|\\n)*?\\[(  FAILED  |       OK )\\] .*%s.*\\n' % (\n          pattern, pattern),\n      '',\n      test_output)\n  return re.sub(r'.*%s.*\\n' % pattern, '', test_output)\n\n\ndef NormalizeOutput(output):\n  \"\"\"Normalizes output (the output of gtest_output_test_.exe).\"\"\"\n\n  output = ToUnixLineEnding(output)\n  output = RemoveLocations(output)\n  output = RemoveStackTraceDetails(output)\n  output = RemoveTime(output)\n  return output\n\n\ndef GetShellCommandOutput(env_cmd):\n  \"\"\"Runs a command in a sub-process, and returns its output in a string.\n\n  Args:\n    env_cmd: The shell command. A 2-tuple where element 0 is a dict of extra\n             environment variables to set, and element 1 is a string with\n             the command and any flags.\n\n  Returns:\n    A string with the command's combined standard and diagnostic output.\n  \"\"\"\n\n  # Spawns cmd in a sub-process, and gets its standard I/O file objects.\n  # Set and save the environment properly.\n  environ = os.environ.copy()\n  environ.update(env_cmd[0])\n  p = gtest_test_utils.Subprocess(env_cmd[1], env=environ)\n\n  return p.output\n\n\ndef GetCommandOutput(env_cmd):\n  \"\"\"Runs a command and returns its output with all file location\n  info stripped off.\n\n  Args:\n    env_cmd:  The shell command. A 2-tuple where element 0 is a dict of extra\n              environment variables to set, and element 1 is a string with\n              the command and any flags.\n  \"\"\"\n\n  # Disables exception pop-ups on Windows.\n  environ, cmdline = env_cmd\n  environ = dict(environ)  # Ensures we are modifying a copy.\n  environ[CATCH_EXCEPTIONS_ENV_VAR_NAME] = '1'\n  return NormalizeOutput(GetShellCommandOutput((environ, cmdline)))\n\n\ndef GetOutputOfAllCommands():\n  \"\"\"Returns concatenated output from several representative commands.\"\"\"\n\n  return (GetCommandOutput(COMMAND_WITH_COLOR) +\n          GetCommandOutput(COMMAND_WITH_TIME) +\n          GetCommandOutput(COMMAND_WITH_DISABLED) +\n          GetCommandOutput(COMMAND_WITH_SHARDING))\n\n\ntest_list = GetShellCommandOutput(COMMAND_LIST_TESTS)\nSUPPORTS_DEATH_TESTS = 'DeathTest' in test_list\nSUPPORTS_TYPED_TESTS = 'TypedTest' in test_list\nSUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list\nSUPPORTS_STACK_TRACES = False\n\nCAN_GENERATE_GOLDEN_FILE = (SUPPORTS_DEATH_TESTS and\n                            SUPPORTS_TYPED_TESTS and\n                            SUPPORTS_THREADS)\n\n\nclass GTestOutputTest(gtest_test_utils.TestCase):\n  def RemoveUnsupportedTests(self, test_output):\n    if not SUPPORTS_DEATH_TESTS:\n      test_output = RemoveMatchingTests(test_output, 'DeathTest')\n    if not SUPPORTS_TYPED_TESTS:\n      test_output = RemoveMatchingTests(test_output, 'TypedTest')\n      test_output = RemoveMatchingTests(test_output, 'TypedDeathTest')\n      test_output = RemoveMatchingTests(test_output, 'TypeParamDeathTest')\n    if not SUPPORTS_THREADS:\n      test_output = RemoveMatchingTests(test_output,\n                                        'ExpectFailureWithThreadsTest')\n      test_output = RemoveMatchingTests(test_output,\n                                        'ScopedFakeTestPartResultReporterTest')\n      test_output = RemoveMatchingTests(test_output,\n                                        'WorksConcurrently')\n    if not SUPPORTS_STACK_TRACES:\n      test_output = RemoveStackTraces(test_output)\n\n    return test_output\n\n  def testOutput(self):\n    output = GetOutputOfAllCommands()\n\n    golden_file = open(GOLDEN_PATH, 'rb')\n    # A mis-configured source control system can cause \\r appear in EOL\n    # sequences when we read the golden file irrespective of an operating\n    # system used. Therefore, we need to strip those \\r's from newlines\n    # unconditionally.\n    golden = ToUnixLineEnding(golden_file.read())\n    golden_file.close()\n\n    # We want the test to pass regardless of certain features being\n    # supported or not.\n\n    # We still have to remove type name specifics in all cases.\n    normalized_actual = RemoveTypeInfoDetails(output)\n    normalized_golden = RemoveTypeInfoDetails(golden)\n\n    if CAN_GENERATE_GOLDEN_FILE:\n      self.assertEqual(normalized_golden, normalized_actual)\n    else:\n      normalized_actual = NormalizeToCurrentPlatform(\n          RemoveTestCounts(normalized_actual))\n      normalized_golden = NormalizeToCurrentPlatform(\n          RemoveTestCounts(self.RemoveUnsupportedTests(normalized_golden)))\n\n      # This code is very handy when debugging golden file differences:\n      if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):\n        open(os.path.join(\n            gtest_test_utils.GetSourceDir(),\n            '_gtest_output_test_normalized_actual.txt'), 'wb').write(\n                normalized_actual)\n        open(os.path.join(\n            gtest_test_utils.GetSourceDir(),\n            '_gtest_output_test_normalized_golden.txt'), 'wb').write(\n                normalized_golden)\n\n      self.assertEqual(normalized_golden, normalized_actual)\n\n\nif __name__ == '__main__':\n  if sys.argv[1:] == [GENGOLDEN_FLAG]:\n    if CAN_GENERATE_GOLDEN_FILE:\n      output = GetOutputOfAllCommands()\n      golden_file = open(GOLDEN_PATH, 'wb')\n      golden_file.write(output)\n      golden_file.close()\n    else:\n      message = (\n          \"\"\"Unable to write a golden file when compiled in an environment\nthat does not support all the required features (death tests, typed tests,\nand multiple threads).  Please generate the golden file using a binary built\nwith those features enabled.\"\"\")\n\n      sys.stderr.write(message)\n      sys.exit(1)\n  else:\n    gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_output_test_.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// The purpose of this file is to generate Google Test output under\n// various conditions.  The output will then be verified by\n// gtest_output_test.py to ensure that Google Test generates the\n// desired messages.  Therefore, most tests in this file are MEANT TO\n// FAIL.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/gtest-spi.h\"\n#include \"gtest/gtest.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\n#include <stdlib.h>\n\n#if GTEST_IS_THREADSAFE\nusing testing::ScopedFakeTestPartResultReporter;\nusing testing::TestPartResultArray;\n\nusing testing::internal::Notification;\nusing testing::internal::ThreadWithParam;\n#endif\n\nnamespace posix = ::testing::internal::posix;\nusing testing::internal::scoped_ptr;\n\n// Tests catching fatal failures.\n\n// A subroutine used by the following test.\nvoid TestEq1(int x) {\n  ASSERT_EQ(1, x);\n}\n\n// This function calls a test subroutine, catches the fatal failure it\n// generates, and then returns early.\nvoid TryTestSubroutine() {\n  // Calls a subrountine that yields a fatal failure.\n  TestEq1(2);\n\n  // Catches the fatal failure and aborts the test.\n  //\n  // The testing::Test:: prefix is necessary when calling\n  // HasFatalFailure() outside of a TEST, TEST_F, or test fixture.\n  if (testing::Test::HasFatalFailure()) return;\n\n  // If we get here, something is wrong.\n  FAIL() << \"This should never be reached.\";\n}\n\nTEST(PassingTest, PassingTest1) {\n}\n\nTEST(PassingTest, PassingTest2) {\n}\n\n// Tests that parameters of failing parameterized tests are printed in the\n// failing test summary.\nclass FailingParamTest : public testing::TestWithParam<int> {};\n\nTEST_P(FailingParamTest, Fails) {\n  EXPECT_EQ(1, GetParam());\n}\n\n// This generates a test which will fail. Google Test is expected to print\n// its parameter when it outputs the list of all failed tests.\nINSTANTIATE_TEST_CASE_P(PrintingFailingParams,\n                        FailingParamTest,\n                        testing::Values(2));\n\nstatic const char kGoldenString[] = \"\\\"Line\\0 1\\\"\\nLine 2\";\n\nTEST(NonfatalFailureTest, EscapesStringOperands) {\n  std::string actual = \"actual \\\"string\\\"\";\n  EXPECT_EQ(kGoldenString, actual);\n\n  const char* golden = kGoldenString;\n  EXPECT_EQ(golden, actual);\n}\n\n// Tests catching a fatal failure in a subroutine.\nTEST(FatalFailureTest, FatalFailureInSubroutine) {\n  printf(\"(expecting a failure that x should be 1)\\n\");\n\n  TryTestSubroutine();\n}\n\n// Tests catching a fatal failure in a nested subroutine.\nTEST(FatalFailureTest, FatalFailureInNestedSubroutine) {\n  printf(\"(expecting a failure that x should be 1)\\n\");\n\n  // Calls a subrountine that yields a fatal failure.\n  TryTestSubroutine();\n\n  // Catches the fatal failure and aborts the test.\n  //\n  // When calling HasFatalFailure() inside a TEST, TEST_F, or test\n  // fixture, the testing::Test:: prefix is not needed.\n  if (HasFatalFailure()) return;\n\n  // If we get here, something is wrong.\n  FAIL() << \"This should never be reached.\";\n}\n\n// Tests HasFatalFailure() after a failed EXPECT check.\nTEST(FatalFailureTest, NonfatalFailureInSubroutine) {\n  printf(\"(expecting a failure on false)\\n\");\n  EXPECT_TRUE(false);  // Generates a nonfatal failure\n  ASSERT_FALSE(HasFatalFailure());  // This should succeed.\n}\n\n// Tests interleaving user logging and Google Test assertions.\nTEST(LoggingTest, InterleavingLoggingAndAssertions) {\n  static const int a[4] = {\n    3, 9, 2, 6\n  };\n\n  printf(\"(expecting 2 failures on (3) >= (a[i]))\\n\");\n  for (int i = 0; i < static_cast<int>(sizeof(a)/sizeof(*a)); i++) {\n    printf(\"i == %d\\n\", i);\n    EXPECT_GE(3, a[i]);\n  }\n}\n\n// Tests the SCOPED_TRACE macro.\n\n// A helper function for testing SCOPED_TRACE.\nvoid SubWithoutTrace(int n) {\n  EXPECT_EQ(1, n);\n  ASSERT_EQ(2, n);\n}\n\n// Another helper function for testing SCOPED_TRACE.\nvoid SubWithTrace(int n) {\n  SCOPED_TRACE(testing::Message() << \"n = \" << n);\n\n  SubWithoutTrace(n);\n}\n\n// Tests that SCOPED_TRACE() obeys lexical scopes.\nTEST(SCOPED_TRACETest, ObeysScopes) {\n  printf(\"(expected to fail)\\n\");\n\n  // There should be no trace before SCOPED_TRACE() is invoked.\n  ADD_FAILURE() << \"This failure is expected, and shouldn't have a trace.\";\n\n  {\n    SCOPED_TRACE(\"Expected trace\");\n    // After SCOPED_TRACE(), a failure in the current scope should contain\n    // the trace.\n    ADD_FAILURE() << \"This failure is expected, and should have a trace.\";\n  }\n\n  // Once the control leaves the scope of the SCOPED_TRACE(), there\n  // should be no trace again.\n  ADD_FAILURE() << \"This failure is expected, and shouldn't have a trace.\";\n}\n\n// Tests that SCOPED_TRACE works inside a loop.\nTEST(SCOPED_TRACETest, WorksInLoop) {\n  printf(\"(expected to fail)\\n\");\n\n  for (int i = 1; i <= 2; i++) {\n    SCOPED_TRACE(testing::Message() << \"i = \" << i);\n\n    SubWithoutTrace(i);\n  }\n}\n\n// Tests that SCOPED_TRACE works in a subroutine.\nTEST(SCOPED_TRACETest, WorksInSubroutine) {\n  printf(\"(expected to fail)\\n\");\n\n  SubWithTrace(1);\n  SubWithTrace(2);\n}\n\n// Tests that SCOPED_TRACE can be nested.\nTEST(SCOPED_TRACETest, CanBeNested) {\n  printf(\"(expected to fail)\\n\");\n\n  SCOPED_TRACE(\"\");  // A trace without a message.\n\n  SubWithTrace(2);\n}\n\n// Tests that multiple SCOPED_TRACEs can be used in the same scope.\nTEST(SCOPED_TRACETest, CanBeRepeated) {\n  printf(\"(expected to fail)\\n\");\n\n  SCOPED_TRACE(\"A\");\n  ADD_FAILURE()\n      << \"This failure is expected, and should contain trace point A.\";\n\n  SCOPED_TRACE(\"B\");\n  ADD_FAILURE()\n      << \"This failure is expected, and should contain trace point A and B.\";\n\n  {\n    SCOPED_TRACE(\"C\");\n    ADD_FAILURE() << \"This failure is expected, and should \"\n                  << \"contain trace point A, B, and C.\";\n  }\n\n  SCOPED_TRACE(\"D\");\n  ADD_FAILURE() << \"This failure is expected, and should \"\n                << \"contain trace point A, B, and D.\";\n}\n\n#if GTEST_IS_THREADSAFE\n// Tests that SCOPED_TRACE()s can be used concurrently from multiple\n// threads.  Namely, an assertion should be affected by\n// SCOPED_TRACE()s in its own thread only.\n\n// Here's the sequence of actions that happen in the test:\n//\n//   Thread A (main)                | Thread B (spawned)\n//   ===============================|================================\n//   spawns thread B                |\n//   -------------------------------+--------------------------------\n//   waits for n1                   | SCOPED_TRACE(\"Trace B\");\n//                                  | generates failure #1\n//                                  | notifies n1\n//   -------------------------------+--------------------------------\n//   SCOPED_TRACE(\"Trace A\");       | waits for n2\n//   generates failure #2           |\n//   notifies n2                    |\n//   -------------------------------|--------------------------------\n//   waits for n3                   | generates failure #3\n//                                  | trace B dies\n//                                  | generates failure #4\n//                                  | notifies n3\n//   -------------------------------|--------------------------------\n//   generates failure #5           | finishes\n//   trace A dies                   |\n//   generates failure #6           |\n//   -------------------------------|--------------------------------\n//   waits for thread B to finish   |\n\nstruct CheckPoints {\n  Notification n1;\n  Notification n2;\n  Notification n3;\n};\n\nstatic void ThreadWithScopedTrace(CheckPoints* check_points) {\n  {\n    SCOPED_TRACE(\"Trace B\");\n    ADD_FAILURE()\n        << \"Expected failure #1 (in thread B, only trace B alive).\";\n    check_points->n1.Notify();\n    check_points->n2.WaitForNotification();\n\n    ADD_FAILURE()\n        << \"Expected failure #3 (in thread B, trace A & B both alive).\";\n  }  // Trace B dies here.\n  ADD_FAILURE()\n      << \"Expected failure #4 (in thread B, only trace A alive).\";\n  check_points->n3.Notify();\n}\n\nTEST(SCOPED_TRACETest, WorksConcurrently) {\n  printf(\"(expecting 6 failures)\\n\");\n\n  CheckPoints check_points;\n  ThreadWithParam<CheckPoints*> thread(&ThreadWithScopedTrace,\n                                       &check_points,\n                                       NULL);\n  check_points.n1.WaitForNotification();\n\n  {\n    SCOPED_TRACE(\"Trace A\");\n    ADD_FAILURE()\n        << \"Expected failure #2 (in thread A, trace A & B both alive).\";\n    check_points.n2.Notify();\n    check_points.n3.WaitForNotification();\n\n    ADD_FAILURE()\n        << \"Expected failure #5 (in thread A, only trace A alive).\";\n  }  // Trace A dies here.\n  ADD_FAILURE()\n      << \"Expected failure #6 (in thread A, no trace alive).\";\n  thread.Join();\n}\n#endif  // GTEST_IS_THREADSAFE\n\nTEST(DisabledTestsWarningTest,\n     DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {\n  // This test body is intentionally empty.  Its sole purpose is for\n  // verifying that the --gtest_also_run_disabled_tests flag\n  // suppresses the \"YOU HAVE 12 DISABLED TESTS\" warning at the end of\n  // the test output.\n}\n\n// Tests using assertions outside of TEST and TEST_F.\n//\n// This function creates two failures intentionally.\nvoid AdHocTest() {\n  printf(\"The non-test part of the code is expected to have 2 failures.\\n\\n\");\n  EXPECT_TRUE(false);\n  EXPECT_EQ(2, 3);\n}\n\n// Runs all TESTs, all TEST_Fs, and the ad hoc test.\nint RunAllTests() {\n  AdHocTest();\n  return RUN_ALL_TESTS();\n}\n\n// Tests non-fatal failures in the fixture constructor.\nclass NonFatalFailureInFixtureConstructorTest : public testing::Test {\n protected:\n  NonFatalFailureInFixtureConstructorTest() {\n    printf(\"(expecting 5 failures)\\n\");\n    ADD_FAILURE() << \"Expected failure #1, in the test fixture c'tor.\";\n  }\n\n  ~NonFatalFailureInFixtureConstructorTest() {\n    ADD_FAILURE() << \"Expected failure #5, in the test fixture d'tor.\";\n  }\n\n  virtual void SetUp() {\n    ADD_FAILURE() << \"Expected failure #2, in SetUp().\";\n  }\n\n  virtual void TearDown() {\n    ADD_FAILURE() << \"Expected failure #4, in TearDown.\";\n  }\n};\n\nTEST_F(NonFatalFailureInFixtureConstructorTest, FailureInConstructor) {\n  ADD_FAILURE() << \"Expected failure #3, in the test body.\";\n}\n\n// Tests fatal failures in the fixture constructor.\nclass FatalFailureInFixtureConstructorTest : public testing::Test {\n protected:\n  FatalFailureInFixtureConstructorTest() {\n    printf(\"(expecting 2 failures)\\n\");\n    Init();\n  }\n\n  ~FatalFailureInFixtureConstructorTest() {\n    ADD_FAILURE() << \"Expected failure #2, in the test fixture d'tor.\";\n  }\n\n  virtual void SetUp() {\n    ADD_FAILURE() << \"UNEXPECTED failure in SetUp().  \"\n                  << \"We should never get here, as the test fixture c'tor \"\n                  << \"had a fatal failure.\";\n  }\n\n  virtual void TearDown() {\n    ADD_FAILURE() << \"UNEXPECTED failure in TearDown().  \"\n                  << \"We should never get here, as the test fixture c'tor \"\n                  << \"had a fatal failure.\";\n  }\n\n private:\n  void Init() {\n    FAIL() << \"Expected failure #1, in the test fixture c'tor.\";\n  }\n};\n\nTEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) {\n  ADD_FAILURE() << \"UNEXPECTED failure in the test body.  \"\n                << \"We should never get here, as the test fixture c'tor \"\n                << \"had a fatal failure.\";\n}\n\n// Tests non-fatal failures in SetUp().\nclass NonFatalFailureInSetUpTest : public testing::Test {\n protected:\n  virtual ~NonFatalFailureInSetUpTest() {\n    Deinit();\n  }\n\n  virtual void SetUp() {\n    printf(\"(expecting 4 failures)\\n\");\n    ADD_FAILURE() << \"Expected failure #1, in SetUp().\";\n  }\n\n  virtual void TearDown() {\n    FAIL() << \"Expected failure #3, in TearDown().\";\n  }\n private:\n  void Deinit() {\n    FAIL() << \"Expected failure #4, in the test fixture d'tor.\";\n  }\n};\n\nTEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) {\n  FAIL() << \"Expected failure #2, in the test function.\";\n}\n\n// Tests fatal failures in SetUp().\nclass FatalFailureInSetUpTest : public testing::Test {\n protected:\n  virtual ~FatalFailureInSetUpTest() {\n    Deinit();\n  }\n\n  virtual void SetUp() {\n    printf(\"(expecting 3 failures)\\n\");\n    FAIL() << \"Expected failure #1, in SetUp().\";\n  }\n\n  virtual void TearDown() {\n    FAIL() << \"Expected failure #2, in TearDown().\";\n  }\n private:\n  void Deinit() {\n    FAIL() << \"Expected failure #3, in the test fixture d'tor.\";\n  }\n};\n\nTEST_F(FatalFailureInSetUpTest, FailureInSetUp) {\n  FAIL() << \"UNEXPECTED failure in the test function.  \"\n         << \"We should never get here, as SetUp() failed.\";\n}\n\nTEST(AddFailureAtTest, MessageContainsSpecifiedFileAndLineNumber) {\n  ADD_FAILURE_AT(\"foo.cc\", 42) << \"Expected failure in foo.cc\";\n}\n\n#if GTEST_IS_THREADSAFE\n\n// A unary function that may die.\nvoid DieIf(bool should_die) {\n  GTEST_CHECK_(!should_die) << \" - death inside DieIf().\";\n}\n\n// Tests running death tests in a multi-threaded context.\n\n// Used for coordination between the main and the spawn thread.\nstruct SpawnThreadNotifications {\n  SpawnThreadNotifications() {}\n\n  Notification spawn_thread_started;\n  Notification spawn_thread_ok_to_terminate;\n\n private:\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(SpawnThreadNotifications);\n};\n\n// The function to be executed in the thread spawn by the\n// MultipleThreads test (below).\nstatic void ThreadRoutine(SpawnThreadNotifications* notifications) {\n  // Signals the main thread that this thread has started.\n  notifications->spawn_thread_started.Notify();\n\n  // Waits for permission to finish from the main thread.\n  notifications->spawn_thread_ok_to_terminate.WaitForNotification();\n}\n\n// This is a death-test test, but it's not named with a DeathTest\n// suffix.  It starts threads which might interfere with later\n// death tests, so it must run after all other death tests.\nclass DeathTestAndMultiThreadsTest : public testing::Test {\n protected:\n  // Starts a thread and waits for it to begin.\n  virtual void SetUp() {\n    thread_.reset(new ThreadWithParam<SpawnThreadNotifications*>(\n        &ThreadRoutine, &notifications_, NULL));\n    notifications_.spawn_thread_started.WaitForNotification();\n  }\n  // Tells the thread to finish, and reaps it.\n  // Depending on the version of the thread library in use,\n  // a manager thread might still be left running that will interfere\n  // with later death tests.  This is unfortunate, but this class\n  // cleans up after itself as best it can.\n  virtual void TearDown() {\n    notifications_.spawn_thread_ok_to_terminate.Notify();\n  }\n\n private:\n  SpawnThreadNotifications notifications_;\n  scoped_ptr<ThreadWithParam<SpawnThreadNotifications*> > thread_;\n};\n\n#endif  // GTEST_IS_THREADSAFE\n\n// The MixedUpTestCaseTest test case verifies that Google Test will fail a\n// test if it uses a different fixture class than what other tests in\n// the same test case use.  It deliberately contains two fixture\n// classes with the same name but defined in different namespaces.\n\n// The MixedUpTestCaseWithSameTestNameTest test case verifies that\n// when the user defines two tests with the same test case name AND\n// same test name (but in different namespaces), the second test will\n// fail.\n\nnamespace foo {\n\nclass MixedUpTestCaseTest : public testing::Test {\n};\n\nTEST_F(MixedUpTestCaseTest, FirstTestFromNamespaceFoo) {}\nTEST_F(MixedUpTestCaseTest, SecondTestFromNamespaceFoo) {}\n\nclass MixedUpTestCaseWithSameTestNameTest : public testing::Test {\n};\n\nTEST_F(MixedUpTestCaseWithSameTestNameTest,\n       TheSecondTestWithThisNameShouldFail) {}\n\n}  // namespace foo\n\nnamespace bar {\n\nclass MixedUpTestCaseTest : public testing::Test {\n};\n\n// The following two tests are expected to fail.  We rely on the\n// golden file to check that Google Test generates the right error message.\nTEST_F(MixedUpTestCaseTest, ThisShouldFail) {}\nTEST_F(MixedUpTestCaseTest, ThisShouldFailToo) {}\n\nclass MixedUpTestCaseWithSameTestNameTest : public testing::Test {\n};\n\n// Expected to fail.  We rely on the golden file to check that Google Test\n// generates the right error message.\nTEST_F(MixedUpTestCaseWithSameTestNameTest,\n       TheSecondTestWithThisNameShouldFail) {}\n\n}  // namespace bar\n\n// The following two test cases verify that Google Test catches the user\n// error of mixing TEST and TEST_F in the same test case.  The first\n// test case checks the scenario where TEST_F appears before TEST, and\n// the second one checks where TEST appears before TEST_F.\n\nclass TEST_F_before_TEST_in_same_test_case : public testing::Test {\n};\n\nTEST_F(TEST_F_before_TEST_in_same_test_case, DefinedUsingTEST_F) {}\n\n// Expected to fail.  We rely on the golden file to check that Google Test\n// generates the right error message.\nTEST(TEST_F_before_TEST_in_same_test_case, DefinedUsingTESTAndShouldFail) {}\n\nclass TEST_before_TEST_F_in_same_test_case : public testing::Test {\n};\n\nTEST(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST) {}\n\n// Expected to fail.  We rely on the golden file to check that Google Test\n// generates the right error message.\nTEST_F(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST_FAndShouldFail) {\n}\n\n// Used for testing EXPECT_NONFATAL_FAILURE() and EXPECT_FATAL_FAILURE().\nint global_integer = 0;\n\n// Tests that EXPECT_NONFATAL_FAILURE() can reference global variables.\nTEST(ExpectNonfatalFailureTest, CanReferenceGlobalVariables) {\n  global_integer = 0;\n  EXPECT_NONFATAL_FAILURE({\n    EXPECT_EQ(1, global_integer) << \"Expected non-fatal failure.\";\n  }, \"Expected non-fatal failure.\");\n}\n\n// Tests that EXPECT_NONFATAL_FAILURE() can reference local variables\n// (static or not).\nTEST(ExpectNonfatalFailureTest, CanReferenceLocalVariables) {\n  int m = 0;\n  static int n;\n  n = 1;\n  EXPECT_NONFATAL_FAILURE({\n    EXPECT_EQ(m, n) << \"Expected non-fatal failure.\";\n  }, \"Expected non-fatal failure.\");\n}\n\n// Tests that EXPECT_NONFATAL_FAILURE() succeeds when there is exactly\n// one non-fatal failure and no fatal failure.\nTEST(ExpectNonfatalFailureTest, SucceedsWhenThereIsOneNonfatalFailure) {\n  EXPECT_NONFATAL_FAILURE({\n    ADD_FAILURE() << \"Expected non-fatal failure.\";\n  }, \"Expected non-fatal failure.\");\n}\n\n// Tests that EXPECT_NONFATAL_FAILURE() fails when there is no\n// non-fatal failure.\nTEST(ExpectNonfatalFailureTest, FailsWhenThereIsNoNonfatalFailure) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_NONFATAL_FAILURE({\n  }, \"\");\n}\n\n// Tests that EXPECT_NONFATAL_FAILURE() fails when there are two\n// non-fatal failures.\nTEST(ExpectNonfatalFailureTest, FailsWhenThereAreTwoNonfatalFailures) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_NONFATAL_FAILURE({\n    ADD_FAILURE() << \"Expected non-fatal failure 1.\";\n    ADD_FAILURE() << \"Expected non-fatal failure 2.\";\n  }, \"\");\n}\n\n// Tests that EXPECT_NONFATAL_FAILURE() fails when there is one fatal\n// failure.\nTEST(ExpectNonfatalFailureTest, FailsWhenThereIsOneFatalFailure) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_NONFATAL_FAILURE({\n    FAIL() << \"Expected fatal failure.\";\n  }, \"\");\n}\n\n// Tests that EXPECT_NONFATAL_FAILURE() fails when the statement being\n// tested returns.\nTEST(ExpectNonfatalFailureTest, FailsWhenStatementReturns) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_NONFATAL_FAILURE({\n    return;\n  }, \"\");\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\n// Tests that EXPECT_NONFATAL_FAILURE() fails when the statement being\n// tested throws.\nTEST(ExpectNonfatalFailureTest, FailsWhenStatementThrows) {\n  printf(\"(expecting a failure)\\n\");\n  try {\n    EXPECT_NONFATAL_FAILURE({\n      throw 0;\n    }, \"\");\n  } catch(int) {  // NOLINT\n  }\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// Tests that EXPECT_FATAL_FAILURE() can reference global variables.\nTEST(ExpectFatalFailureTest, CanReferenceGlobalVariables) {\n  global_integer = 0;\n  EXPECT_FATAL_FAILURE({\n    ASSERT_EQ(1, global_integer) << \"Expected fatal failure.\";\n  }, \"Expected fatal failure.\");\n}\n\n// Tests that EXPECT_FATAL_FAILURE() can reference local static\n// variables.\nTEST(ExpectFatalFailureTest, CanReferenceLocalStaticVariables) {\n  static int n;\n  n = 1;\n  EXPECT_FATAL_FAILURE({\n    ASSERT_EQ(0, n) << \"Expected fatal failure.\";\n  }, \"Expected fatal failure.\");\n}\n\n// Tests that EXPECT_FATAL_FAILURE() succeeds when there is exactly\n// one fatal failure and no non-fatal failure.\nTEST(ExpectFatalFailureTest, SucceedsWhenThereIsOneFatalFailure) {\n  EXPECT_FATAL_FAILURE({\n    FAIL() << \"Expected fatal failure.\";\n  }, \"Expected fatal failure.\");\n}\n\n// Tests that EXPECT_FATAL_FAILURE() fails when there is no fatal\n// failure.\nTEST(ExpectFatalFailureTest, FailsWhenThereIsNoFatalFailure) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_FATAL_FAILURE({\n  }, \"\");\n}\n\n// A helper for generating a fatal failure.\nvoid FatalFailure() {\n  FAIL() << \"Expected fatal failure.\";\n}\n\n// Tests that EXPECT_FATAL_FAILURE() fails when there are two\n// fatal failures.\nTEST(ExpectFatalFailureTest, FailsWhenThereAreTwoFatalFailures) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_FATAL_FAILURE({\n    FatalFailure();\n    FatalFailure();\n  }, \"\");\n}\n\n// Tests that EXPECT_FATAL_FAILURE() fails when there is one non-fatal\n// failure.\nTEST(ExpectFatalFailureTest, FailsWhenThereIsOneNonfatalFailure) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_FATAL_FAILURE({\n    ADD_FAILURE() << \"Expected non-fatal failure.\";\n  }, \"\");\n}\n\n// Tests that EXPECT_FATAL_FAILURE() fails when the statement being\n// tested returns.\nTEST(ExpectFatalFailureTest, FailsWhenStatementReturns) {\n  printf(\"(expecting a failure)\\n\");\n  EXPECT_FATAL_FAILURE({\n    return;\n  }, \"\");\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\n// Tests that EXPECT_FATAL_FAILURE() fails when the statement being\n// tested throws.\nTEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {\n  printf(\"(expecting a failure)\\n\");\n  try {\n    EXPECT_FATAL_FAILURE({\n      throw 0;\n    }, \"\");\n  } catch(int) {  // NOLINT\n  }\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// This #ifdef block tests the output of typed tests.\n#if GTEST_HAS_TYPED_TEST\n\ntemplate <typename T>\nclass TypedTest : public testing::Test {\n};\n\nTYPED_TEST_CASE(TypedTest, testing::Types<int>);\n\nTYPED_TEST(TypedTest, Success) {\n  EXPECT_EQ(0, TypeParam());\n}\n\nTYPED_TEST(TypedTest, Failure) {\n  EXPECT_EQ(1, TypeParam()) << \"Expected failure\";\n}\n\n#endif  // GTEST_HAS_TYPED_TEST\n\n// This #ifdef block tests the output of type-parameterized tests.\n#if GTEST_HAS_TYPED_TEST_P\n\ntemplate <typename T>\nclass TypedTestP : public testing::Test {\n};\n\nTYPED_TEST_CASE_P(TypedTestP);\n\nTYPED_TEST_P(TypedTestP, Success) {\n  EXPECT_EQ(0U, TypeParam());\n}\n\nTYPED_TEST_P(TypedTestP, Failure) {\n  EXPECT_EQ(1U, TypeParam()) << \"Expected failure\";\n}\n\nREGISTER_TYPED_TEST_CASE_P(TypedTestP, Success, Failure);\n\ntypedef testing::Types<unsigned char, unsigned int> UnsignedTypes;\nINSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n#if GTEST_HAS_DEATH_TEST\n\n// We rely on the golden file to verify that tests whose test case\n// name ends with DeathTest are run first.\n\nTEST(ADeathTest, ShouldRunFirst) {\n}\n\n# if GTEST_HAS_TYPED_TEST\n\n// We rely on the golden file to verify that typed tests whose test\n// case name ends with DeathTest are run first.\n\ntemplate <typename T>\nclass ATypedDeathTest : public testing::Test {\n};\n\ntypedef testing::Types<int, double> NumericTypes;\nTYPED_TEST_CASE(ATypedDeathTest, NumericTypes);\n\nTYPED_TEST(ATypedDeathTest, ShouldRunFirst) {\n}\n\n# endif  // GTEST_HAS_TYPED_TEST\n\n# if GTEST_HAS_TYPED_TEST_P\n\n\n// We rely on the golden file to verify that type-parameterized tests\n// whose test case name ends with DeathTest are run first.\n\ntemplate <typename T>\nclass ATypeParamDeathTest : public testing::Test {\n};\n\nTYPED_TEST_CASE_P(ATypeParamDeathTest);\n\nTYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {\n}\n\nREGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);\n\nINSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);\n\n# endif  // GTEST_HAS_TYPED_TEST_P\n\n#endif  // GTEST_HAS_DEATH_TEST\n\n// Tests various failure conditions of\n// EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS}.\nclass ExpectFailureTest : public testing::Test {\n public:  // Must be public and not protected due to a bug in g++ 3.4.2.\n  enum FailureMode {\n    FATAL_FAILURE,\n    NONFATAL_FAILURE\n  };\n  static void AddFailure(FailureMode failure) {\n    if (failure == FATAL_FAILURE) {\n      FAIL() << \"Expected fatal failure.\";\n    } else {\n      ADD_FAILURE() << \"Expected non-fatal failure.\";\n    }\n  }\n};\n\nTEST_F(ExpectFailureTest, ExpectFatalFailure) {\n  // Expected fatal failure, but succeeds.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_FATAL_FAILURE(SUCCEED(), \"Expected fatal failure.\");\n  // Expected fatal failure, but got a non-fatal failure.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_FATAL_FAILURE(AddFailure(NONFATAL_FAILURE), \"Expected non-fatal \"\n                       \"failure.\");\n  // Wrong message.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), \"Some other fatal failure \"\n                       \"expected.\");\n}\n\nTEST_F(ExpectFailureTest, ExpectNonFatalFailure) {\n  // Expected non-fatal failure, but succeeds.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_NONFATAL_FAILURE(SUCCEED(), \"Expected non-fatal failure.\");\n  // Expected non-fatal failure, but got a fatal failure.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_NONFATAL_FAILURE(AddFailure(FATAL_FAILURE), \"Expected fatal failure.\");\n  // Wrong message.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE), \"Some other non-fatal \"\n                          \"failure.\");\n}\n\n#if GTEST_IS_THREADSAFE\n\nclass ExpectFailureWithThreadsTest : public ExpectFailureTest {\n protected:\n  static void AddFailureInOtherThread(FailureMode failure) {\n    ThreadWithParam<FailureMode> thread(&AddFailure, failure, NULL);\n    thread.Join();\n  }\n};\n\nTEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailure) {\n  // We only intercept the current thread.\n  printf(\"(expecting 2 failures)\\n\");\n  EXPECT_FATAL_FAILURE(AddFailureInOtherThread(FATAL_FAILURE),\n                       \"Expected fatal failure.\");\n}\n\nTEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailure) {\n  // We only intercept the current thread.\n  printf(\"(expecting 2 failures)\\n\");\n  EXPECT_NONFATAL_FAILURE(AddFailureInOtherThread(NONFATAL_FAILURE),\n                          \"Expected non-fatal failure.\");\n}\n\ntypedef ExpectFailureWithThreadsTest ScopedFakeTestPartResultReporterTest;\n\n// Tests that the ScopedFakeTestPartResultReporter only catches failures from\n// the current thread if it is instantiated with INTERCEPT_ONLY_CURRENT_THREAD.\nTEST_F(ScopedFakeTestPartResultReporterTest, InterceptOnlyCurrentThread) {\n  printf(\"(expecting 2 failures)\\n\");\n  TestPartResultArray results;\n  {\n    ScopedFakeTestPartResultReporter reporter(\n        ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,\n        &results);\n    AddFailureInOtherThread(FATAL_FAILURE);\n    AddFailureInOtherThread(NONFATAL_FAILURE);\n  }\n  // The two failures should not have been intercepted.\n  EXPECT_EQ(0, results.size()) << \"This shouldn't fail.\";\n}\n\n#endif  // GTEST_IS_THREADSAFE\n\nTEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {\n  // Expected fatal failure, but succeeds.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), \"Expected fatal failure.\");\n  // Expected fatal failure, but got a non-fatal failure.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),\n                                      \"Expected non-fatal failure.\");\n  // Wrong message.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),\n                                      \"Some other fatal failure expected.\");\n}\n\nTEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {\n  // Expected non-fatal failure, but succeeds.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), \"Expected non-fatal \"\n                                         \"failure.\");\n  // Expected non-fatal failure, but got a fatal failure.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),\n                                         \"Expected fatal failure.\");\n  // Wrong message.\n  printf(\"(expecting 1 failure)\\n\");\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),\n                                         \"Some other non-fatal failure.\");\n}\n\n\n// Two test environments for testing testing::AddGlobalTestEnvironment().\n\nclass FooEnvironment : public testing::Environment {\n public:\n  virtual void SetUp() {\n    printf(\"%s\", \"FooEnvironment::SetUp() called.\\n\");\n  }\n\n  virtual void TearDown() {\n    printf(\"%s\", \"FooEnvironment::TearDown() called.\\n\");\n    FAIL() << \"Expected fatal failure.\";\n  }\n};\n\nclass BarEnvironment : public testing::Environment {\n public:\n  virtual void SetUp() {\n    printf(\"%s\", \"BarEnvironment::SetUp() called.\\n\");\n  }\n\n  virtual void TearDown() {\n    printf(\"%s\", \"BarEnvironment::TearDown() called.\\n\");\n    ADD_FAILURE() << \"Expected non-fatal failure.\";\n  }\n};\n\nbool GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = false;\n\n// The main function.\n//\n// The idea is to use Google Test to run all the tests we have defined (some\n// of them are intended to fail), and then compare the test results\n// with the \"golden\" file.\nint main(int argc, char **argv) {\n  testing::GTEST_FLAG(print_time) = false;\n\n  // We just run the tests, knowing some of them are intended to fail.\n  // We will use a separate Python script to compare the output of\n  // this program with the golden file.\n\n  // It's hard to test InitGoogleTest() directly, as it has many\n  // global side effects.  The following line serves as a sanity test\n  // for it.\n  testing::InitGoogleTest(&argc, argv);\n  if (argc >= 2 &&\n      (std::string(argv[1]) ==\n       \"--gtest_internal_skip_environment_and_ad_hoc_tests\"))\n    GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = true;\n\n#if GTEST_HAS_DEATH_TEST\n  if (testing::internal::GTEST_FLAG(internal_run_death_test) != \"\") {\n    // Skip the usual output capturing if we're running as the child\n    // process of an threadsafe-style death test.\n# if GTEST_OS_WINDOWS\n    posix::FReopen(\"nul:\", \"w\", stdout);\n# else\n    posix::FReopen(\"/dev/null\", \"w\", stdout);\n# endif  // GTEST_OS_WINDOWS\n    return RUN_ALL_TESTS();\n  }\n#endif  // GTEST_HAS_DEATH_TEST\n\n  if (GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests))\n    return RUN_ALL_TESTS();\n\n  // Registers two global test environments.\n  // The golden file verifies that they are set up in the order they\n  // are registered, and torn down in the reverse order.\n  testing::AddGlobalTestEnvironment(new FooEnvironment);\n  testing::AddGlobalTestEnvironment(new BarEnvironment);\n\n  return RunAllTests();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_output_test_golden_lin.txt",
    "content": "The non-test part of the code is expected to have 2 failures.\n\ngtest_output_test_.cc:#: Failure\nValue of: false\n  Actual: false\nExpected: true\ngtest_output_test_.cc:#: Failure\nValue of: 3\nExpected: 2\n\u001b[0;32m[==========] \u001b[mRunning 63 tests from 28 test cases.\n\u001b[0;32m[----------] \u001b[mGlobal test environment set-up.\nFooEnvironment::SetUp() called.\nBarEnvironment::SetUp() called.\n\u001b[0;32m[----------] \u001b[m1 test from ADeathTest\n\u001b[0;32m[ RUN      ] \u001b[mADeathTest.ShouldRunFirst\n\u001b[0;32m[       OK ] \u001b[mADeathTest.ShouldRunFirst\n\u001b[0;32m[----------] \u001b[m1 test from ATypedDeathTest/0, where TypeParam = int\n\u001b[0;32m[ RUN      ] \u001b[mATypedDeathTest/0.ShouldRunFirst\n\u001b[0;32m[       OK ] \u001b[mATypedDeathTest/0.ShouldRunFirst\n\u001b[0;32m[----------] \u001b[m1 test from ATypedDeathTest/1, where TypeParam = double\n\u001b[0;32m[ RUN      ] \u001b[mATypedDeathTest/1.ShouldRunFirst\n\u001b[0;32m[       OK ] \u001b[mATypedDeathTest/1.ShouldRunFirst\n\u001b[0;32m[----------] \u001b[m1 test from My/ATypeParamDeathTest/0, where TypeParam = int\n\u001b[0;32m[ RUN      ] \u001b[mMy/ATypeParamDeathTest/0.ShouldRunFirst\n\u001b[0;32m[       OK ] \u001b[mMy/ATypeParamDeathTest/0.ShouldRunFirst\n\u001b[0;32m[----------] \u001b[m1 test from My/ATypeParamDeathTest/1, where TypeParam = double\n\u001b[0;32m[ RUN      ] \u001b[mMy/ATypeParamDeathTest/1.ShouldRunFirst\n\u001b[0;32m[       OK ] \u001b[mMy/ATypeParamDeathTest/1.ShouldRunFirst\n\u001b[0;32m[----------] \u001b[m2 tests from PassingTest\n\u001b[0;32m[ RUN      ] \u001b[mPassingTest.PassingTest1\n\u001b[0;32m[       OK ] \u001b[mPassingTest.PassingTest1\n\u001b[0;32m[ RUN      ] \u001b[mPassingTest.PassingTest2\n\u001b[0;32m[       OK ] \u001b[mPassingTest.PassingTest2\n\u001b[0;32m[----------] \u001b[m1 test from NonfatalFailureTest\n\u001b[0;32m[ RUN      ] \u001b[mNonfatalFailureTest.EscapesStringOperands\ngtest_output_test_.cc:#: Failure\nValue of: actual\n  Actual: \"actual \\\"string\\\"\"\nExpected: kGoldenString\nWhich is: \"\\\"Line\"\ngtest_output_test_.cc:#: Failure\nValue of: actual\n  Actual: \"actual \\\"string\\\"\"\nExpected: golden\nWhich is: \"\\\"Line\"\n\u001b[0;31m[  FAILED  ] \u001b[mNonfatalFailureTest.EscapesStringOperands\n\u001b[0;32m[----------] \u001b[m3 tests from FatalFailureTest\n\u001b[0;32m[ RUN      ] \u001b[mFatalFailureTest.FatalFailureInSubroutine\n(expecting a failure that x should be 1)\ngtest_output_test_.cc:#: Failure\nValue of: x\n  Actual: 2\nExpected: 1\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureTest.FatalFailureInSubroutine\n\u001b[0;32m[ RUN      ] \u001b[mFatalFailureTest.FatalFailureInNestedSubroutine\n(expecting a failure that x should be 1)\ngtest_output_test_.cc:#: Failure\nValue of: x\n  Actual: 2\nExpected: 1\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureTest.FatalFailureInNestedSubroutine\n\u001b[0;32m[ RUN      ] \u001b[mFatalFailureTest.NonfatalFailureInSubroutine\n(expecting a failure on false)\ngtest_output_test_.cc:#: Failure\nValue of: false\n  Actual: false\nExpected: true\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureTest.NonfatalFailureInSubroutine\n\u001b[0;32m[----------] \u001b[m1 test from LoggingTest\n\u001b[0;32m[ RUN      ] \u001b[mLoggingTest.InterleavingLoggingAndAssertions\n(expecting 2 failures on (3) >= (a[i]))\ni == 0\ni == 1\ngtest_output_test_.cc:#: Failure\nExpected: (3) >= (a[i]), actual: 3 vs 9\ni == 2\ni == 3\ngtest_output_test_.cc:#: Failure\nExpected: (3) >= (a[i]), actual: 3 vs 6\n\u001b[0;31m[  FAILED  ] \u001b[mLoggingTest.InterleavingLoggingAndAssertions\n\u001b[0;32m[----------] \u001b[m6 tests from SCOPED_TRACETest\n\u001b[0;32m[ RUN      ] \u001b[mSCOPED_TRACETest.ObeysScopes\n(expected to fail)\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and shouldn't have a trace.\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and should have a trace.\nGoogle Test trace:\ngtest_output_test_.cc:#: Expected trace\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and shouldn't have a trace.\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.ObeysScopes\n\u001b[0;32m[ RUN      ] \u001b[mSCOPED_TRACETest.WorksInLoop\n(expected to fail)\ngtest_output_test_.cc:#: Failure\nValue of: n\n  Actual: 1\nExpected: 2\nGoogle Test trace:\ngtest_output_test_.cc:#: i = 1\ngtest_output_test_.cc:#: Failure\nValue of: n\n  Actual: 2\nExpected: 1\nGoogle Test trace:\ngtest_output_test_.cc:#: i = 2\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.WorksInLoop\n\u001b[0;32m[ RUN      ] \u001b[mSCOPED_TRACETest.WorksInSubroutine\n(expected to fail)\ngtest_output_test_.cc:#: Failure\nValue of: n\n  Actual: 1\nExpected: 2\nGoogle Test trace:\ngtest_output_test_.cc:#: n = 1\ngtest_output_test_.cc:#: Failure\nValue of: n\n  Actual: 2\nExpected: 1\nGoogle Test trace:\ngtest_output_test_.cc:#: n = 2\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.WorksInSubroutine\n\u001b[0;32m[ RUN      ] \u001b[mSCOPED_TRACETest.CanBeNested\n(expected to fail)\ngtest_output_test_.cc:#: Failure\nValue of: n\n  Actual: 2\nExpected: 1\nGoogle Test trace:\ngtest_output_test_.cc:#: n = 2\ngtest_output_test_.cc:#: \n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.CanBeNested\n\u001b[0;32m[ RUN      ] \u001b[mSCOPED_TRACETest.CanBeRepeated\n(expected to fail)\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and should contain trace point A.\nGoogle Test trace:\ngtest_output_test_.cc:#: A\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and should contain trace point A and B.\nGoogle Test trace:\ngtest_output_test_.cc:#: B\ngtest_output_test_.cc:#: A\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and should contain trace point A, B, and C.\nGoogle Test trace:\ngtest_output_test_.cc:#: C\ngtest_output_test_.cc:#: B\ngtest_output_test_.cc:#: A\ngtest_output_test_.cc:#: Failure\nFailed\nThis failure is expected, and should contain trace point A, B, and D.\nGoogle Test trace:\ngtest_output_test_.cc:#: D\ngtest_output_test_.cc:#: B\ngtest_output_test_.cc:#: A\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.CanBeRepeated\n\u001b[0;32m[ RUN      ] \u001b[mSCOPED_TRACETest.WorksConcurrently\n(expecting 6 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #1 (in thread B, only trace B alive).\nGoogle Test trace:\ngtest_output_test_.cc:#: Trace B\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #2 (in thread A, trace A & B both alive).\nGoogle Test trace:\ngtest_output_test_.cc:#: Trace A\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #3 (in thread B, trace A & B both alive).\nGoogle Test trace:\ngtest_output_test_.cc:#: Trace B\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #4 (in thread B, only trace A alive).\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #5 (in thread A, only trace A alive).\nGoogle Test trace:\ngtest_output_test_.cc:#: Trace A\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #6 (in thread A, no trace alive).\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.WorksConcurrently\n\u001b[0;32m[----------] \u001b[m1 test from NonFatalFailureInFixtureConstructorTest\n\u001b[0;32m[ RUN      ] \u001b[mNonFatalFailureInFixtureConstructorTest.FailureInConstructor\n(expecting 5 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #1, in the test fixture c'tor.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #2, in SetUp().\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #3, in the test body.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #4, in TearDown.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #5, in the test fixture d'tor.\n\u001b[0;31m[  FAILED  ] \u001b[mNonFatalFailureInFixtureConstructorTest.FailureInConstructor\n\u001b[0;32m[----------] \u001b[m1 test from FatalFailureInFixtureConstructorTest\n\u001b[0;32m[ RUN      ] \u001b[mFatalFailureInFixtureConstructorTest.FailureInConstructor\n(expecting 2 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #1, in the test fixture c'tor.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #2, in the test fixture d'tor.\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureInFixtureConstructorTest.FailureInConstructor\n\u001b[0;32m[----------] \u001b[m1 test from NonFatalFailureInSetUpTest\n\u001b[0;32m[ RUN      ] \u001b[mNonFatalFailureInSetUpTest.FailureInSetUp\n(expecting 4 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #1, in SetUp().\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #2, in the test function.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #3, in TearDown().\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #4, in the test fixture d'tor.\n\u001b[0;31m[  FAILED  ] \u001b[mNonFatalFailureInSetUpTest.FailureInSetUp\n\u001b[0;32m[----------] \u001b[m1 test from FatalFailureInSetUpTest\n\u001b[0;32m[ RUN      ] \u001b[mFatalFailureInSetUpTest.FailureInSetUp\n(expecting 3 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #1, in SetUp().\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #2, in TearDown().\ngtest_output_test_.cc:#: Failure\nFailed\nExpected failure #3, in the test fixture d'tor.\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureInSetUpTest.FailureInSetUp\n\u001b[0;32m[----------] \u001b[m1 test from AddFailureAtTest\n\u001b[0;32m[ RUN      ] \u001b[mAddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber\nfoo.cc:42: Failure\nFailed\nExpected failure in foo.cc\n\u001b[0;31m[  FAILED  ] \u001b[mAddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber\n\u001b[0;32m[----------] \u001b[m4 tests from MixedUpTestCaseTest\n\u001b[0;32m[ RUN      ] \u001b[mMixedUpTestCaseTest.FirstTestFromNamespaceFoo\n\u001b[0;32m[       OK ] \u001b[mMixedUpTestCaseTest.FirstTestFromNamespaceFoo\n\u001b[0;32m[ RUN      ] \u001b[mMixedUpTestCaseTest.SecondTestFromNamespaceFoo\n\u001b[0;32m[       OK ] \u001b[mMixedUpTestCaseTest.SecondTestFromNamespaceFoo\n\u001b[0;32m[ RUN      ] \u001b[mMixedUpTestCaseTest.ThisShouldFail\ngtest.cc:#: Failure\nFailed\nAll tests in the same test case must use the same test fixture\nclass.  However, in test case MixedUpTestCaseTest,\nyou defined test FirstTestFromNamespaceFoo and test ThisShouldFail\nusing two different test fixture classes.  This can happen if\nthe two classes are from different namespaces or translation\nunits and have the same name.  You should probably rename one\nof the classes to put the tests into different test cases.\n\u001b[0;31m[  FAILED  ] \u001b[mMixedUpTestCaseTest.ThisShouldFail\n\u001b[0;32m[ RUN      ] \u001b[mMixedUpTestCaseTest.ThisShouldFailToo\ngtest.cc:#: Failure\nFailed\nAll tests in the same test case must use the same test fixture\nclass.  However, in test case MixedUpTestCaseTest,\nyou defined test FirstTestFromNamespaceFoo and test ThisShouldFailToo\nusing two different test fixture classes.  This can happen if\nthe two classes are from different namespaces or translation\nunits and have the same name.  You should probably rename one\nof the classes to put the tests into different test cases.\n\u001b[0;31m[  FAILED  ] \u001b[mMixedUpTestCaseTest.ThisShouldFailToo\n\u001b[0;32m[----------] \u001b[m2 tests from MixedUpTestCaseWithSameTestNameTest\n\u001b[0;32m[ RUN      ] \u001b[mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail\n\u001b[0;32m[       OK ] \u001b[mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail\n\u001b[0;32m[ RUN      ] \u001b[mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail\ngtest.cc:#: Failure\nFailed\nAll tests in the same test case must use the same test fixture\nclass.  However, in test case MixedUpTestCaseWithSameTestNameTest,\nyou defined test TheSecondTestWithThisNameShouldFail and test TheSecondTestWithThisNameShouldFail\nusing two different test fixture classes.  This can happen if\nthe two classes are from different namespaces or translation\nunits and have the same name.  You should probably rename one\nof the classes to put the tests into different test cases.\n\u001b[0;31m[  FAILED  ] \u001b[mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail\n\u001b[0;32m[----------] \u001b[m2 tests from TEST_F_before_TEST_in_same_test_case\n\u001b[0;32m[ RUN      ] \u001b[mTEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F\n\u001b[0;32m[       OK ] \u001b[mTEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F\n\u001b[0;32m[ RUN      ] \u001b[mTEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail\ngtest.cc:#: Failure\nFailed\nAll tests in the same test case must use the same test fixture\nclass, so mixing TEST_F and TEST in the same test case is\nillegal.  In test case TEST_F_before_TEST_in_same_test_case,\ntest DefinedUsingTEST_F is defined using TEST_F but\ntest DefinedUsingTESTAndShouldFail is defined using TEST.  You probably\nwant to change the TEST to TEST_F or move it to another test\ncase.\n\u001b[0;31m[  FAILED  ] \u001b[mTEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail\n\u001b[0;32m[----------] \u001b[m2 tests from TEST_before_TEST_F_in_same_test_case\n\u001b[0;32m[ RUN      ] \u001b[mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST\n\u001b[0;32m[       OK ] \u001b[mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST\n\u001b[0;32m[ RUN      ] \u001b[mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail\ngtest.cc:#: Failure\nFailed\nAll tests in the same test case must use the same test fixture\nclass, so mixing TEST_F and TEST in the same test case is\nillegal.  In test case TEST_before_TEST_F_in_same_test_case,\ntest DefinedUsingTEST_FAndShouldFail is defined using TEST_F but\ntest DefinedUsingTEST is defined using TEST.  You probably\nwant to change the TEST to TEST_F or move it to another test\ncase.\n\u001b[0;31m[  FAILED  ] \u001b[mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail\n\u001b[0;32m[----------] \u001b[m8 tests from ExpectNonfatalFailureTest\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.CanReferenceGlobalVariables\n\u001b[0;32m[       OK ] \u001b[mExpectNonfatalFailureTest.CanReferenceGlobalVariables\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.CanReferenceLocalVariables\n\u001b[0;32m[       OK ] \u001b[mExpectNonfatalFailureTest.CanReferenceLocalVariables\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure\n\u001b[0;32m[       OK ] \u001b[mExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual: 2 failures\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure 1.\n\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure 2.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual:\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.FailsWhenStatementReturns\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenStatementReturns\n\u001b[0;32m[ RUN      ] \u001b[mExpectNonfatalFailureTest.FailsWhenStatementThrows\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenStatementThrows\n\u001b[0;32m[----------] \u001b[m8 tests from ExpectFatalFailureTest\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.CanReferenceGlobalVariables\n\u001b[0;32m[       OK ] \u001b[mExpectFatalFailureTest.CanReferenceGlobalVariables\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.CanReferenceLocalStaticVariables\n\u001b[0;32m[       OK ] \u001b[mExpectFatalFailureTest.CanReferenceLocalStaticVariables\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure\n\u001b[0;32m[       OK ] \u001b[mExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual: 2 failures\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual:\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.FailsWhenStatementReturns\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenStatementReturns\n\u001b[0;32m[ RUN      ] \u001b[mExpectFatalFailureTest.FailsWhenStatementThrows\n(expecting a failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenStatementThrows\n\u001b[0;32m[----------] \u001b[m2 tests from TypedTest/0, where TypeParam = int\n\u001b[0;32m[ RUN      ] \u001b[mTypedTest/0.Success\n\u001b[0;32m[       OK ] \u001b[mTypedTest/0.Success\n\u001b[0;32m[ RUN      ] \u001b[mTypedTest/0.Failure\ngtest_output_test_.cc:#: Failure\nValue of: TypeParam()\n  Actual: 0\nExpected: 1\nExpected failure\n\u001b[0;31m[  FAILED  ] \u001b[mTypedTest/0.Failure, where TypeParam = int\n\u001b[0;32m[----------] \u001b[m2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char\n\u001b[0;32m[ RUN      ] \u001b[mUnsigned/TypedTestP/0.Success\n\u001b[0;32m[       OK ] \u001b[mUnsigned/TypedTestP/0.Success\n\u001b[0;32m[ RUN      ] \u001b[mUnsigned/TypedTestP/0.Failure\ngtest_output_test_.cc:#: Failure\nValue of: TypeParam()\n  Actual: '\\0'\nExpected: 1U\nWhich is: 1\nExpected failure\n\u001b[0;31m[  FAILED  ] \u001b[mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char\n\u001b[0;32m[----------] \u001b[m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int\n\u001b[0;32m[ RUN      ] \u001b[mUnsigned/TypedTestP/1.Success\n\u001b[0;32m[       OK ] \u001b[mUnsigned/TypedTestP/1.Success\n\u001b[0;32m[ RUN      ] \u001b[mUnsigned/TypedTestP/1.Failure\ngtest_output_test_.cc:#: Failure\nValue of: TypeParam()\n  Actual: 0\nExpected: 1U\nWhich is: 1\nExpected failure\n\u001b[0;31m[  FAILED  ] \u001b[mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int\n\u001b[0;32m[----------] \u001b[m4 tests from ExpectFailureTest\n\u001b[0;32m[ RUN      ] \u001b[mExpectFailureTest.ExpectFatalFailure\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual:\ngtest_output_test_.cc:#: Success:\nSucceeded\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual:\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure.\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure containing \"Some other fatal failure expected.\"\n  Actual:\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectFatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectFailureTest.ExpectNonFatalFailure\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual:\ngtest_output_test_.cc:#: Success:\nSucceeded\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual:\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure containing \"Some other non-fatal failure.\"\n  Actual:\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectNonFatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectFailureTest.ExpectFatalFailureOnAllThreads\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual:\ngtest_output_test_.cc:#: Success:\nSucceeded\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual:\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure.\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 fatal failure containing \"Some other fatal failure expected.\"\n  Actual:\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectFatalFailureOnAllThreads\n\u001b[0;32m[ RUN      ] \u001b[mExpectFailureTest.ExpectNonFatalFailureOnAllThreads\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual:\ngtest_output_test_.cc:#: Success:\nSucceeded\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual:\ngtest_output_test_.cc:#: Fatal failure:\nFailed\nExpected fatal failure.\n\n(expecting 1 failure)\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure containing \"Some other non-fatal failure.\"\n  Actual:\ngtest_output_test_.cc:#: Non-fatal failure:\nFailed\nExpected non-fatal failure.\n\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectNonFatalFailureOnAllThreads\n\u001b[0;32m[----------] \u001b[m2 tests from ExpectFailureWithThreadsTest\n\u001b[0;32m[ RUN      ] \u001b[mExpectFailureWithThreadsTest.ExpectFatalFailure\n(expecting 2 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected fatal failure.\ngtest.cc:#: Failure\nExpected: 1 fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureWithThreadsTest.ExpectFatalFailure\n\u001b[0;32m[ RUN      ] \u001b[mExpectFailureWithThreadsTest.ExpectNonFatalFailure\n(expecting 2 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected non-fatal failure.\ngtest.cc:#: Failure\nExpected: 1 non-fatal failure\n  Actual: 0 failures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureWithThreadsTest.ExpectNonFatalFailure\n\u001b[0;32m[----------] \u001b[m1 test from ScopedFakeTestPartResultReporterTest\n\u001b[0;32m[ RUN      ] \u001b[mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread\n(expecting 2 failures)\ngtest_output_test_.cc:#: Failure\nFailed\nExpected fatal failure.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected non-fatal failure.\n\u001b[0;31m[  FAILED  ] \u001b[mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread\n\u001b[0;32m[----------] \u001b[m1 test from PrintingFailingParams/FailingParamTest\n\u001b[0;32m[ RUN      ] \u001b[mPrintingFailingParams/FailingParamTest.Fails/0\ngtest_output_test_.cc:#: Failure\nValue of: GetParam()\n  Actual: 2\nExpected: 1\n\u001b[0;31m[  FAILED  ] \u001b[mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2\n\u001b[0;32m[----------] \u001b[mGlobal test environment tear-down\nBarEnvironment::TearDown() called.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected non-fatal failure.\nFooEnvironment::TearDown() called.\ngtest_output_test_.cc:#: Failure\nFailed\nExpected fatal failure.\n\u001b[0;32m[==========] \u001b[m63 tests from 28 test cases ran.\n\u001b[0;32m[  PASSED  ] \u001b[m21 tests.\n\u001b[0;31m[  FAILED  ] \u001b[m42 tests, listed below:\n\u001b[0;31m[  FAILED  ] \u001b[mNonfatalFailureTest.EscapesStringOperands\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureTest.FatalFailureInSubroutine\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureTest.FatalFailureInNestedSubroutine\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureTest.NonfatalFailureInSubroutine\n\u001b[0;31m[  FAILED  ] \u001b[mLoggingTest.InterleavingLoggingAndAssertions\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.ObeysScopes\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.WorksInLoop\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.WorksInSubroutine\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.CanBeNested\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.CanBeRepeated\n\u001b[0;31m[  FAILED  ] \u001b[mSCOPED_TRACETest.WorksConcurrently\n\u001b[0;31m[  FAILED  ] \u001b[mNonFatalFailureInFixtureConstructorTest.FailureInConstructor\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureInFixtureConstructorTest.FailureInConstructor\n\u001b[0;31m[  FAILED  ] \u001b[mNonFatalFailureInSetUpTest.FailureInSetUp\n\u001b[0;31m[  FAILED  ] \u001b[mFatalFailureInSetUpTest.FailureInSetUp\n\u001b[0;31m[  FAILED  ] \u001b[mAddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber\n\u001b[0;31m[  FAILED  ] \u001b[mMixedUpTestCaseTest.ThisShouldFail\n\u001b[0;31m[  FAILED  ] \u001b[mMixedUpTestCaseTest.ThisShouldFailToo\n\u001b[0;31m[  FAILED  ] \u001b[mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail\n\u001b[0;31m[  FAILED  ] \u001b[mTEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail\n\u001b[0;31m[  FAILED  ] \u001b[mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenStatementReturns\n\u001b[0;31m[  FAILED  ] \u001b[mExpectNonfatalFailureTest.FailsWhenStatementThrows\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenStatementReturns\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFatalFailureTest.FailsWhenStatementThrows\n\u001b[0;31m[  FAILED  ] \u001b[mTypedTest/0.Failure, where TypeParam = int\n\u001b[0;31m[  FAILED  ] \u001b[mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char\n\u001b[0;31m[  FAILED  ] \u001b[mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectFatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectNonFatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectFatalFailureOnAllThreads\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureTest.ExpectNonFatalFailureOnAllThreads\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureWithThreadsTest.ExpectFatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mExpectFailureWithThreadsTest.ExpectNonFatalFailure\n\u001b[0;31m[  FAILED  ] \u001b[mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread\n\u001b[0;31m[  FAILED  ] \u001b[mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2\n\n42 FAILED TESTS\n\u001b[0;33m  YOU HAVE 1 DISABLED TEST\n\n\u001b[mNote: Google Test filter = FatalFailureTest.*:LoggingTest.*\n[==========] Running 4 tests from 2 test cases.\n[----------] Global test environment set-up.\n[----------] 3 tests from FatalFailureTest\n[ RUN      ] FatalFailureTest.FatalFailureInSubroutine\n(expecting a failure that x should be 1)\ngtest_output_test_.cc:#: Failure\nValue of: x\n  Actual: 2\nExpected: 1\n[  FAILED  ] FatalFailureTest.FatalFailureInSubroutine (? ms)\n[ RUN      ] FatalFailureTest.FatalFailureInNestedSubroutine\n(expecting a failure that x should be 1)\ngtest_output_test_.cc:#: Failure\nValue of: x\n  Actual: 2\nExpected: 1\n[  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)\n[ RUN      ] FatalFailureTest.NonfatalFailureInSubroutine\n(expecting a failure on false)\ngtest_output_test_.cc:#: Failure\nValue of: false\n  Actual: false\nExpected: true\n[  FAILED  ] FatalFailureTest.NonfatalFailureInSubroutine (? ms)\n[----------] 3 tests from FatalFailureTest (? ms total)\n\n[----------] 1 test from LoggingTest\n[ RUN      ] LoggingTest.InterleavingLoggingAndAssertions\n(expecting 2 failures on (3) >= (a[i]))\ni == 0\ni == 1\ngtest_output_test_.cc:#: Failure\nExpected: (3) >= (a[i]), actual: 3 vs 9\ni == 2\ni == 3\ngtest_output_test_.cc:#: Failure\nExpected: (3) >= (a[i]), actual: 3 vs 6\n[  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions (? ms)\n[----------] 1 test from LoggingTest (? ms total)\n\n[----------] Global test environment tear-down\n[==========] 4 tests from 2 test cases ran. (? ms total)\n[  PASSED  ] 0 tests.\n[  FAILED  ] 4 tests, listed below:\n[  FAILED  ] FatalFailureTest.FatalFailureInSubroutine\n[  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine\n[  FAILED  ] FatalFailureTest.NonfatalFailureInSubroutine\n[  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions\n\n 4 FAILED TESTS\nNote: Google Test filter = *DISABLED_*\n[==========] Running 1 test from 1 test case.\n[----------] Global test environment set-up.\n[----------] 1 test from DisabledTestsWarningTest\n[ RUN      ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning\n[       OK ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning\n[----------] Global test environment tear-down\n[==========] 1 test from 1 test case ran.\n[  PASSED  ] 1 test.\nNote: Google Test filter = PassingTest.*\nNote: This is test shard 2 of 2.\n[==========] Running 1 test from 1 test case.\n[----------] Global test environment set-up.\n[----------] 1 test from PassingTest\n[ RUN      ] PassingTest.PassingTest2\n[       OK ] PassingTest.PassingTest2\n[----------] Global test environment tear-down\n[==========] 1 test from 1 test case ran.\n[  PASSED  ] 1 test.\n"
  },
  {
    "path": "Tests/gtest/test/gtest_pred_impl_unittest.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command\n// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!\n\n// Regression test for gtest_pred_impl.h\n//\n// This file is generated by a script and quite long.  If you intend to\n// learn how Google Test works by reading its unit tests, read\n// gtest_unittest.cc instead.\n//\n// This is intended as a regression test for the Google Test predicate\n// assertions.  We compile it as part of the gtest_unittest target\n// only to keep the implementation tidy and compact, as it is quite\n// involved to set up the stage for testing Google Test using Google\n// Test itself.\n//\n// Currently, gtest_unittest takes ~11 seconds to run in the testing\n// daemon.  In the future, if it grows too large and needs much more\n// time to finish, we should consider separating this file into a\n// stand-alone regression test.\n\n#include <iostream>\n\n#include \"gtest/gtest.h\"\n#include \"gtest/gtest-spi.h\"\n\n// A user-defined data type.\nstruct Bool {\n  explicit Bool(int val) : value(val != 0) {}\n\n  bool operator>(int n) const { return value > Bool(n).value; }\n\n  Bool operator+(const Bool& rhs) const { return Bool(value + rhs.value); }\n\n  bool operator==(const Bool& rhs) const { return value == rhs.value; }\n\n  bool value;\n};\n\n// Enables Bool to be used in assertions.\nstd::ostream& operator<<(std::ostream& os, const Bool& x) {\n  return os << (x.value ? \"true\" : \"false\");\n}\n\n// Sample functions/functors for testing unary predicate assertions.\n\n// A unary predicate function.\ntemplate <typename T1>\nbool PredFunction1(T1 v1) {\n  return v1 > 0;\n}\n\n// The following two functions are needed to circumvent a bug in\n// gcc 2.95.3, which sometimes has problem with the above template\n// function.\nbool PredFunction1Int(int v1) {\n  return v1 > 0;\n}\nbool PredFunction1Bool(Bool v1) {\n  return v1 > 0;\n}\n\n// A unary predicate functor.\nstruct PredFunctor1 {\n  template <typename T1>\n  bool operator()(const T1& v1) {\n    return v1 > 0;\n  }\n};\n\n// A unary predicate-formatter function.\ntemplate <typename T1>\ntesting::AssertionResult PredFormatFunction1(const char* e1,\n                                             const T1& v1) {\n  if (PredFunction1(v1))\n    return testing::AssertionSuccess();\n\n  return testing::AssertionFailure()\n      << e1\n      << \" is expected to be positive, but evaluates to \"\n      << v1 << \".\";\n}\n\n// A unary predicate-formatter functor.\nstruct PredFormatFunctor1 {\n  template <typename T1>\n  testing::AssertionResult operator()(const char* e1,\n                                      const T1& v1) const {\n    return PredFormatFunction1(e1, v1);\n  }\n};\n\n// Tests for {EXPECT|ASSERT}_PRED_FORMAT1.\n\nclass Predicate1Test : public testing::Test {\n protected:\n  virtual void SetUp() {\n    expected_to_finish_ = true;\n    finished_ = false;\n    n1_ = 0;\n  }\n\n  virtual void TearDown() {\n    // Verifies that each of the predicate's arguments was evaluated\n    // exactly once.\n    EXPECT_EQ(1, n1_) <<\n        \"The predicate assertion didn't evaluate argument 2 \"\n        \"exactly once.\";\n\n    // Verifies that the control flow in the test function is expected.\n    if (expected_to_finish_ && !finished_) {\n      FAIL() << \"The predicate assertion unexpactedly aborted the test.\";\n    } else if (!expected_to_finish_ && finished_) {\n      FAIL() << \"The failed predicate assertion didn't abort the test \"\n                \"as expected.\";\n    }\n  }\n\n  // true iff the test function is expected to run to finish.\n  static bool expected_to_finish_;\n\n  // true iff the test function did run to finish.\n  static bool finished_;\n\n  static int n1_;\n};\n\nbool Predicate1Test::expected_to_finish_;\nbool Predicate1Test::finished_;\nint Predicate1Test::n1_;\n\ntypedef Predicate1Test EXPECT_PRED_FORMAT1Test;\ntypedef Predicate1Test ASSERT_PRED_FORMAT1Test;\ntypedef Predicate1Test EXPECT_PRED1Test;\ntypedef Predicate1Test ASSERT_PRED1Test;\n\n// Tests a successful EXPECT_PRED1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED1Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED1(PredFunction1Int,\n               ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED1Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED1(PredFunction1Bool,\n               Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED1Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED1(PredFunctor1(),\n               ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED1Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED1(PredFunctor1(),\n               Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED1Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED1(PredFunction1Int,\n                 n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED1Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED1(PredFunction1Bool,\n                 Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED1Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED1(PredFunctor1(),\n                 n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED1Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED1(PredFunctor1(),\n                 Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED1Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED1(PredFunction1Int,\n               ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED1Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED1(PredFunction1Bool,\n               Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED1Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED1(PredFunctor1(),\n               ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED1Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED1(PredFunctor1(),\n               Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED1Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED1(PredFunction1Int,\n                 n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED1Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED1(PredFunction1Bool,\n                 Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED1Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED1(PredFunctor1(),\n                 n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED1Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED1(PredFunctor1(),\n                 Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT1(PredFormatFunction1,\n                      ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT1(PredFormatFunction1,\n                      Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT1(PredFormatFunctor1(),\n                      ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT1(PredFormatFunctor1(),\n                      Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT1(PredFormatFunction1,\n                        n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT1(PredFormatFunction1,\n                        Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT1(PredFormatFunctor1(),\n                        n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT1(PredFormatFunctor1(),\n                        Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT1(PredFormatFunction1,\n                      ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT1(PredFormatFunction1,\n                      Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT1(PredFormatFunctor1(),\n                      ++n1_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT1(PredFormatFunctor1(),\n                      Bool(++n1_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT1(PredFormatFunction1,\n                        n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT1(PredFormatFunction1,\n                        Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT1(PredFormatFunctor1(),\n                        n1_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT1 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT1(PredFormatFunctor1(),\n                        Bool(n1_++));\n    finished_ = true;\n  }, \"\");\n}\n// Sample functions/functors for testing binary predicate assertions.\n\n// A binary predicate function.\ntemplate <typename T1, typename T2>\nbool PredFunction2(T1 v1, T2 v2) {\n  return v1 + v2 > 0;\n}\n\n// The following two functions are needed to circumvent a bug in\n// gcc 2.95.3, which sometimes has problem with the above template\n// function.\nbool PredFunction2Int(int v1, int v2) {\n  return v1 + v2 > 0;\n}\nbool PredFunction2Bool(Bool v1, Bool v2) {\n  return v1 + v2 > 0;\n}\n\n// A binary predicate functor.\nstruct PredFunctor2 {\n  template <typename T1, typename T2>\n  bool operator()(const T1& v1,\n                  const T2& v2) {\n    return v1 + v2 > 0;\n  }\n};\n\n// A binary predicate-formatter function.\ntemplate <typename T1, typename T2>\ntesting::AssertionResult PredFormatFunction2(const char* e1,\n                                             const char* e2,\n                                             const T1& v1,\n                                             const T2& v2) {\n  if (PredFunction2(v1, v2))\n    return testing::AssertionSuccess();\n\n  return testing::AssertionFailure()\n      << e1 << \" + \" << e2\n      << \" is expected to be positive, but evaluates to \"\n      << v1 + v2 << \".\";\n}\n\n// A binary predicate-formatter functor.\nstruct PredFormatFunctor2 {\n  template <typename T1, typename T2>\n  testing::AssertionResult operator()(const char* e1,\n                                      const char* e2,\n                                      const T1& v1,\n                                      const T2& v2) const {\n    return PredFormatFunction2(e1, e2, v1, v2);\n  }\n};\n\n// Tests for {EXPECT|ASSERT}_PRED_FORMAT2.\n\nclass Predicate2Test : public testing::Test {\n protected:\n  virtual void SetUp() {\n    expected_to_finish_ = true;\n    finished_ = false;\n    n1_ = n2_ = 0;\n  }\n\n  virtual void TearDown() {\n    // Verifies that each of the predicate's arguments was evaluated\n    // exactly once.\n    EXPECT_EQ(1, n1_) <<\n        \"The predicate assertion didn't evaluate argument 2 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n2_) <<\n        \"The predicate assertion didn't evaluate argument 3 \"\n        \"exactly once.\";\n\n    // Verifies that the control flow in the test function is expected.\n    if (expected_to_finish_ && !finished_) {\n      FAIL() << \"The predicate assertion unexpactedly aborted the test.\";\n    } else if (!expected_to_finish_ && finished_) {\n      FAIL() << \"The failed predicate assertion didn't abort the test \"\n                \"as expected.\";\n    }\n  }\n\n  // true iff the test function is expected to run to finish.\n  static bool expected_to_finish_;\n\n  // true iff the test function did run to finish.\n  static bool finished_;\n\n  static int n1_;\n  static int n2_;\n};\n\nbool Predicate2Test::expected_to_finish_;\nbool Predicate2Test::finished_;\nint Predicate2Test::n1_;\nint Predicate2Test::n2_;\n\ntypedef Predicate2Test EXPECT_PRED_FORMAT2Test;\ntypedef Predicate2Test ASSERT_PRED_FORMAT2Test;\ntypedef Predicate2Test EXPECT_PRED2Test;\ntypedef Predicate2Test ASSERT_PRED2Test;\n\n// Tests a successful EXPECT_PRED2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED2Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED2(PredFunction2Int,\n               ++n1_,\n               ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED2Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED2(PredFunction2Bool,\n               Bool(++n1_),\n               Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED2Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED2(PredFunctor2(),\n               ++n1_,\n               ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED2Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED2(PredFunctor2(),\n               Bool(++n1_),\n               Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED2Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED2(PredFunction2Int,\n                 n1_++,\n                 n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED2Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED2(PredFunction2Bool,\n                 Bool(n1_++),\n                 Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED2Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED2(PredFunctor2(),\n                 n1_++,\n                 n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED2Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED2(PredFunctor2(),\n                 Bool(n1_++),\n                 Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED2Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED2(PredFunction2Int,\n               ++n1_,\n               ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED2Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED2(PredFunction2Bool,\n               Bool(++n1_),\n               Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED2Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED2(PredFunctor2(),\n               ++n1_,\n               ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED2Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED2(PredFunctor2(),\n               Bool(++n1_),\n               Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED2Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED2(PredFunction2Int,\n                 n1_++,\n                 n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED2Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED2(PredFunction2Bool,\n                 Bool(n1_++),\n                 Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED2Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED2(PredFunctor2(),\n                 n1_++,\n                 n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED2Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED2(PredFunctor2(),\n                 Bool(n1_++),\n                 Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT2(PredFormatFunction2,\n                      ++n1_,\n                      ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT2(PredFormatFunction2,\n                      Bool(++n1_),\n                      Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT2(PredFormatFunctor2(),\n                      ++n1_,\n                      ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT2(PredFormatFunctor2(),\n                      Bool(++n1_),\n                      Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(PredFormatFunction2,\n                        n1_++,\n                        n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(PredFormatFunction2,\n                        Bool(n1_++),\n                        Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(PredFormatFunctor2(),\n                        n1_++,\n                        n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(PredFormatFunctor2(),\n                        Bool(n1_++),\n                        Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT2(PredFormatFunction2,\n                      ++n1_,\n                      ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT2(PredFormatFunction2,\n                      Bool(++n1_),\n                      Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT2(PredFormatFunctor2(),\n                      ++n1_,\n                      ++n2_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT2(PredFormatFunctor2(),\n                      Bool(++n1_),\n                      Bool(++n2_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT2(PredFormatFunction2,\n                        n1_++,\n                        n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT2(PredFormatFunction2,\n                        Bool(n1_++),\n                        Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT2(PredFormatFunctor2(),\n                        n1_++,\n                        n2_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT2 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT2(PredFormatFunctor2(),\n                        Bool(n1_++),\n                        Bool(n2_++));\n    finished_ = true;\n  }, \"\");\n}\n// Sample functions/functors for testing ternary predicate assertions.\n\n// A ternary predicate function.\ntemplate <typename T1, typename T2, typename T3>\nbool PredFunction3(T1 v1, T2 v2, T3 v3) {\n  return v1 + v2 + v3 > 0;\n}\n\n// The following two functions are needed to circumvent a bug in\n// gcc 2.95.3, which sometimes has problem with the above template\n// function.\nbool PredFunction3Int(int v1, int v2, int v3) {\n  return v1 + v2 + v3 > 0;\n}\nbool PredFunction3Bool(Bool v1, Bool v2, Bool v3) {\n  return v1 + v2 + v3 > 0;\n}\n\n// A ternary predicate functor.\nstruct PredFunctor3 {\n  template <typename T1, typename T2, typename T3>\n  bool operator()(const T1& v1,\n                  const T2& v2,\n                  const T3& v3) {\n    return v1 + v2 + v3 > 0;\n  }\n};\n\n// A ternary predicate-formatter function.\ntemplate <typename T1, typename T2, typename T3>\ntesting::AssertionResult PredFormatFunction3(const char* e1,\n                                             const char* e2,\n                                             const char* e3,\n                                             const T1& v1,\n                                             const T2& v2,\n                                             const T3& v3) {\n  if (PredFunction3(v1, v2, v3))\n    return testing::AssertionSuccess();\n\n  return testing::AssertionFailure()\n      << e1 << \" + \" << e2 << \" + \" << e3\n      << \" is expected to be positive, but evaluates to \"\n      << v1 + v2 + v3 << \".\";\n}\n\n// A ternary predicate-formatter functor.\nstruct PredFormatFunctor3 {\n  template <typename T1, typename T2, typename T3>\n  testing::AssertionResult operator()(const char* e1,\n                                      const char* e2,\n                                      const char* e3,\n                                      const T1& v1,\n                                      const T2& v2,\n                                      const T3& v3) const {\n    return PredFormatFunction3(e1, e2, e3, v1, v2, v3);\n  }\n};\n\n// Tests for {EXPECT|ASSERT}_PRED_FORMAT3.\n\nclass Predicate3Test : public testing::Test {\n protected:\n  virtual void SetUp() {\n    expected_to_finish_ = true;\n    finished_ = false;\n    n1_ = n2_ = n3_ = 0;\n  }\n\n  virtual void TearDown() {\n    // Verifies that each of the predicate's arguments was evaluated\n    // exactly once.\n    EXPECT_EQ(1, n1_) <<\n        \"The predicate assertion didn't evaluate argument 2 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n2_) <<\n        \"The predicate assertion didn't evaluate argument 3 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n3_) <<\n        \"The predicate assertion didn't evaluate argument 4 \"\n        \"exactly once.\";\n\n    // Verifies that the control flow in the test function is expected.\n    if (expected_to_finish_ && !finished_) {\n      FAIL() << \"The predicate assertion unexpactedly aborted the test.\";\n    } else if (!expected_to_finish_ && finished_) {\n      FAIL() << \"The failed predicate assertion didn't abort the test \"\n                \"as expected.\";\n    }\n  }\n\n  // true iff the test function is expected to run to finish.\n  static bool expected_to_finish_;\n\n  // true iff the test function did run to finish.\n  static bool finished_;\n\n  static int n1_;\n  static int n2_;\n  static int n3_;\n};\n\nbool Predicate3Test::expected_to_finish_;\nbool Predicate3Test::finished_;\nint Predicate3Test::n1_;\nint Predicate3Test::n2_;\nint Predicate3Test::n3_;\n\ntypedef Predicate3Test EXPECT_PRED_FORMAT3Test;\ntypedef Predicate3Test ASSERT_PRED_FORMAT3Test;\ntypedef Predicate3Test EXPECT_PRED3Test;\ntypedef Predicate3Test ASSERT_PRED3Test;\n\n// Tests a successful EXPECT_PRED3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED3Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED3(PredFunction3Int,\n               ++n1_,\n               ++n2_,\n               ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED3Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED3(PredFunction3Bool,\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED3Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED3(PredFunctor3(),\n               ++n1_,\n               ++n2_,\n               ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED3Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED3(PredFunctor3(),\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED3Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED3(PredFunction3Int,\n                 n1_++,\n                 n2_++,\n                 n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED3Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED3(PredFunction3Bool,\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED3Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED3(PredFunctor3(),\n                 n1_++,\n                 n2_++,\n                 n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED3Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED3(PredFunctor3(),\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED3Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED3(PredFunction3Int,\n               ++n1_,\n               ++n2_,\n               ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED3Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED3(PredFunction3Bool,\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED3Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED3(PredFunctor3(),\n               ++n1_,\n               ++n2_,\n               ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED3Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED3(PredFunctor3(),\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED3Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED3(PredFunction3Int,\n                 n1_++,\n                 n2_++,\n                 n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED3Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED3(PredFunction3Bool,\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED3Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED3(PredFunctor3(),\n                 n1_++,\n                 n2_++,\n                 n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED3Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED3(PredFunctor3(),\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT3(PredFormatFunction3,\n                      ++n1_,\n                      ++n2_,\n                      ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT3(PredFormatFunction3,\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT3(PredFormatFunctor3(),\n                      ++n1_,\n                      ++n2_,\n                      ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT3(PredFormatFunctor3(),\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT3(PredFormatFunction3,\n                        n1_++,\n                        n2_++,\n                        n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT3(PredFormatFunction3,\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT3(PredFormatFunctor3(),\n                        n1_++,\n                        n2_++,\n                        n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT3(PredFormatFunctor3(),\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT3(PredFormatFunction3,\n                      ++n1_,\n                      ++n2_,\n                      ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT3(PredFormatFunction3,\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT3(PredFormatFunctor3(),\n                      ++n1_,\n                      ++n2_,\n                      ++n3_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT3(PredFormatFunctor3(),\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT3(PredFormatFunction3,\n                        n1_++,\n                        n2_++,\n                        n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT3(PredFormatFunction3,\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT3(PredFormatFunctor3(),\n                        n1_++,\n                        n2_++,\n                        n3_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT3 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT3(PredFormatFunctor3(),\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++));\n    finished_ = true;\n  }, \"\");\n}\n// Sample functions/functors for testing 4-ary predicate assertions.\n\n// A 4-ary predicate function.\ntemplate <typename T1, typename T2, typename T3, typename T4>\nbool PredFunction4(T1 v1, T2 v2, T3 v3, T4 v4) {\n  return v1 + v2 + v3 + v4 > 0;\n}\n\n// The following two functions are needed to circumvent a bug in\n// gcc 2.95.3, which sometimes has problem with the above template\n// function.\nbool PredFunction4Int(int v1, int v2, int v3, int v4) {\n  return v1 + v2 + v3 + v4 > 0;\n}\nbool PredFunction4Bool(Bool v1, Bool v2, Bool v3, Bool v4) {\n  return v1 + v2 + v3 + v4 > 0;\n}\n\n// A 4-ary predicate functor.\nstruct PredFunctor4 {\n  template <typename T1, typename T2, typename T3, typename T4>\n  bool operator()(const T1& v1,\n                  const T2& v2,\n                  const T3& v3,\n                  const T4& v4) {\n    return v1 + v2 + v3 + v4 > 0;\n  }\n};\n\n// A 4-ary predicate-formatter function.\ntemplate <typename T1, typename T2, typename T3, typename T4>\ntesting::AssertionResult PredFormatFunction4(const char* e1,\n                                             const char* e2,\n                                             const char* e3,\n                                             const char* e4,\n                                             const T1& v1,\n                                             const T2& v2,\n                                             const T3& v3,\n                                             const T4& v4) {\n  if (PredFunction4(v1, v2, v3, v4))\n    return testing::AssertionSuccess();\n\n  return testing::AssertionFailure()\n      << e1 << \" + \" << e2 << \" + \" << e3 << \" + \" << e4\n      << \" is expected to be positive, but evaluates to \"\n      << v1 + v2 + v3 + v4 << \".\";\n}\n\n// A 4-ary predicate-formatter functor.\nstruct PredFormatFunctor4 {\n  template <typename T1, typename T2, typename T3, typename T4>\n  testing::AssertionResult operator()(const char* e1,\n                                      const char* e2,\n                                      const char* e3,\n                                      const char* e4,\n                                      const T1& v1,\n                                      const T2& v2,\n                                      const T3& v3,\n                                      const T4& v4) const {\n    return PredFormatFunction4(e1, e2, e3, e4, v1, v2, v3, v4);\n  }\n};\n\n// Tests for {EXPECT|ASSERT}_PRED_FORMAT4.\n\nclass Predicate4Test : public testing::Test {\n protected:\n  virtual void SetUp() {\n    expected_to_finish_ = true;\n    finished_ = false;\n    n1_ = n2_ = n3_ = n4_ = 0;\n  }\n\n  virtual void TearDown() {\n    // Verifies that each of the predicate's arguments was evaluated\n    // exactly once.\n    EXPECT_EQ(1, n1_) <<\n        \"The predicate assertion didn't evaluate argument 2 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n2_) <<\n        \"The predicate assertion didn't evaluate argument 3 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n3_) <<\n        \"The predicate assertion didn't evaluate argument 4 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n4_) <<\n        \"The predicate assertion didn't evaluate argument 5 \"\n        \"exactly once.\";\n\n    // Verifies that the control flow in the test function is expected.\n    if (expected_to_finish_ && !finished_) {\n      FAIL() << \"The predicate assertion unexpactedly aborted the test.\";\n    } else if (!expected_to_finish_ && finished_) {\n      FAIL() << \"The failed predicate assertion didn't abort the test \"\n                \"as expected.\";\n    }\n  }\n\n  // true iff the test function is expected to run to finish.\n  static bool expected_to_finish_;\n\n  // true iff the test function did run to finish.\n  static bool finished_;\n\n  static int n1_;\n  static int n2_;\n  static int n3_;\n  static int n4_;\n};\n\nbool Predicate4Test::expected_to_finish_;\nbool Predicate4Test::finished_;\nint Predicate4Test::n1_;\nint Predicate4Test::n2_;\nint Predicate4Test::n3_;\nint Predicate4Test::n4_;\n\ntypedef Predicate4Test EXPECT_PRED_FORMAT4Test;\ntypedef Predicate4Test ASSERT_PRED_FORMAT4Test;\ntypedef Predicate4Test EXPECT_PRED4Test;\ntypedef Predicate4Test ASSERT_PRED4Test;\n\n// Tests a successful EXPECT_PRED4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED4Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED4(PredFunction4Int,\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED4Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED4(PredFunction4Bool,\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED4Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED4(PredFunctor4(),\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED4Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED4(PredFunctor4(),\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED4Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED4(PredFunction4Int,\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED4Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED4(PredFunction4Bool,\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED4Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED4(PredFunctor4(),\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED4Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED4(PredFunctor4(),\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED4Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED4(PredFunction4Int,\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED4Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED4(PredFunction4Bool,\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED4Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED4(PredFunctor4(),\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED4Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED4(PredFunctor4(),\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED4Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED4(PredFunction4Int,\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED4Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED4(PredFunction4Bool,\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED4Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED4(PredFunctor4(),\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED4Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED4(PredFunctor4(),\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT4(PredFormatFunction4,\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT4(PredFormatFunction4,\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT4(PredFormatFunctor4(),\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT4(PredFormatFunctor4(),\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT4(PredFormatFunction4,\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT4(PredFormatFunction4,\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT4(PredFormatFunctor4(),\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT4(PredFormatFunctor4(),\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT4(PredFormatFunction4,\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT4(PredFormatFunction4,\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT4(PredFormatFunctor4(),\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT4(PredFormatFunctor4(),\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT4(PredFormatFunction4,\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT4(PredFormatFunction4,\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT4(PredFormatFunctor4(),\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT4 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT4(PredFormatFunctor4(),\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++));\n    finished_ = true;\n  }, \"\");\n}\n// Sample functions/functors for testing 5-ary predicate assertions.\n\n// A 5-ary predicate function.\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\nbool PredFunction5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) {\n  return v1 + v2 + v3 + v4 + v5 > 0;\n}\n\n// The following two functions are needed to circumvent a bug in\n// gcc 2.95.3, which sometimes has problem with the above template\n// function.\nbool PredFunction5Int(int v1, int v2, int v3, int v4, int v5) {\n  return v1 + v2 + v3 + v4 + v5 > 0;\n}\nbool PredFunction5Bool(Bool v1, Bool v2, Bool v3, Bool v4, Bool v5) {\n  return v1 + v2 + v3 + v4 + v5 > 0;\n}\n\n// A 5-ary predicate functor.\nstruct PredFunctor5 {\n  template <typename T1, typename T2, typename T3, typename T4, typename T5>\n  bool operator()(const T1& v1,\n                  const T2& v2,\n                  const T3& v3,\n                  const T4& v4,\n                  const T5& v5) {\n    return v1 + v2 + v3 + v4 + v5 > 0;\n  }\n};\n\n// A 5-ary predicate-formatter function.\ntemplate <typename T1, typename T2, typename T3, typename T4, typename T5>\ntesting::AssertionResult PredFormatFunction5(const char* e1,\n                                             const char* e2,\n                                             const char* e3,\n                                             const char* e4,\n                                             const char* e5,\n                                             const T1& v1,\n                                             const T2& v2,\n                                             const T3& v3,\n                                             const T4& v4,\n                                             const T5& v5) {\n  if (PredFunction5(v1, v2, v3, v4, v5))\n    return testing::AssertionSuccess();\n\n  return testing::AssertionFailure()\n      << e1 << \" + \" << e2 << \" + \" << e3 << \" + \" << e4 << \" + \" << e5\n      << \" is expected to be positive, but evaluates to \"\n      << v1 + v2 + v3 + v4 + v5 << \".\";\n}\n\n// A 5-ary predicate-formatter functor.\nstruct PredFormatFunctor5 {\n  template <typename T1, typename T2, typename T3, typename T4, typename T5>\n  testing::AssertionResult operator()(const char* e1,\n                                      const char* e2,\n                                      const char* e3,\n                                      const char* e4,\n                                      const char* e5,\n                                      const T1& v1,\n                                      const T2& v2,\n                                      const T3& v3,\n                                      const T4& v4,\n                                      const T5& v5) const {\n    return PredFormatFunction5(e1, e2, e3, e4, e5, v1, v2, v3, v4, v5);\n  }\n};\n\n// Tests for {EXPECT|ASSERT}_PRED_FORMAT5.\n\nclass Predicate5Test : public testing::Test {\n protected:\n  virtual void SetUp() {\n    expected_to_finish_ = true;\n    finished_ = false;\n    n1_ = n2_ = n3_ = n4_ = n5_ = 0;\n  }\n\n  virtual void TearDown() {\n    // Verifies that each of the predicate's arguments was evaluated\n    // exactly once.\n    EXPECT_EQ(1, n1_) <<\n        \"The predicate assertion didn't evaluate argument 2 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n2_) <<\n        \"The predicate assertion didn't evaluate argument 3 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n3_) <<\n        \"The predicate assertion didn't evaluate argument 4 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n4_) <<\n        \"The predicate assertion didn't evaluate argument 5 \"\n        \"exactly once.\";\n    EXPECT_EQ(1, n5_) <<\n        \"The predicate assertion didn't evaluate argument 6 \"\n        \"exactly once.\";\n\n    // Verifies that the control flow in the test function is expected.\n    if (expected_to_finish_ && !finished_) {\n      FAIL() << \"The predicate assertion unexpactedly aborted the test.\";\n    } else if (!expected_to_finish_ && finished_) {\n      FAIL() << \"The failed predicate assertion didn't abort the test \"\n                \"as expected.\";\n    }\n  }\n\n  // true iff the test function is expected to run to finish.\n  static bool expected_to_finish_;\n\n  // true iff the test function did run to finish.\n  static bool finished_;\n\n  static int n1_;\n  static int n2_;\n  static int n3_;\n  static int n4_;\n  static int n5_;\n};\n\nbool Predicate5Test::expected_to_finish_;\nbool Predicate5Test::finished_;\nint Predicate5Test::n1_;\nint Predicate5Test::n2_;\nint Predicate5Test::n3_;\nint Predicate5Test::n4_;\nint Predicate5Test::n5_;\n\ntypedef Predicate5Test EXPECT_PRED_FORMAT5Test;\ntypedef Predicate5Test ASSERT_PRED_FORMAT5Test;\ntypedef Predicate5Test EXPECT_PRED5Test;\ntypedef Predicate5Test ASSERT_PRED5Test;\n\n// Tests a successful EXPECT_PRED5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED5Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED5(PredFunction5Int,\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_,\n               ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED5Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED5(PredFunction5Bool,\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_),\n               Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED5Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED5(PredFunctor5(),\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_,\n               ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED5Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED5(PredFunctor5(),\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_),\n               Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED5Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED5(PredFunction5Int,\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++,\n                 n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED5Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED5(PredFunction5Bool,\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++),\n                 Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED5Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED5(PredFunctor5(),\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++,\n                 n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED5Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED5(PredFunctor5(),\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++),\n                 Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED5Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED5(PredFunction5Int,\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_,\n               ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED5Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED5(PredFunction5Bool,\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_),\n               Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED5Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED5(PredFunctor5(),\n               ++n1_,\n               ++n2_,\n               ++n3_,\n               ++n4_,\n               ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED5Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED5(PredFunctor5(),\n               Bool(++n1_),\n               Bool(++n2_),\n               Bool(++n3_),\n               Bool(++n4_),\n               Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED5Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED5(PredFunction5Int,\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++,\n                 n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED5Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED5(PredFunction5Bool,\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++),\n                 Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED5Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED5(PredFunctor5(),\n                 n1_++,\n                 n2_++,\n                 n3_++,\n                 n4_++,\n                 n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED5Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED5(PredFunctor5(),\n                 Bool(n1_++),\n                 Bool(n2_++),\n                 Bool(n3_++),\n                 Bool(n4_++),\n                 Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT5(PredFormatFunction5,\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_,\n                      ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT5(PredFormatFunction5,\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_),\n                      Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnBuiltInTypeSuccess) {\n  EXPECT_PRED_FORMAT5(PredFormatFunctor5(),\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_,\n                      ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnUserTypeSuccess) {\n  EXPECT_PRED_FORMAT5(PredFormatFunctor5(),\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_),\n                      Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a failed EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT5(PredFormatFunction5,\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++,\n                        n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT5(PredFormatFunction5,\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++),\n                        Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnBuiltInTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT5(PredFormatFunctor5(),\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++,\n                        n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed EXPECT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnUserTypeFailure) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT5(PredFormatFunctor5(),\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++),\n                        Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a successful ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT5(PredFormatFunction5,\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_,\n                      ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT5(PredFormatFunction5,\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_),\n                      Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnBuiltInTypeSuccess) {\n  ASSERT_PRED_FORMAT5(PredFormatFunctor5(),\n                      ++n1_,\n                      ++n2_,\n                      ++n3_,\n                      ++n4_,\n                      ++n5_);\n  finished_ = true;\n}\n\n// Tests a successful ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnUserTypeSuccess) {\n  ASSERT_PRED_FORMAT5(PredFormatFunctor5(),\n                      Bool(++n1_),\n                      Bool(++n2_),\n                      Bool(++n3_),\n                      Bool(++n4_),\n                      Bool(++n5_));\n  finished_ = true;\n}\n\n// Tests a failed ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT5(PredFormatFunction5,\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++,\n                        n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a function on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT5(PredFormatFunction5,\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++),\n                        Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a built-in type (int).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnBuiltInTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT5(PredFormatFunctor5(),\n                        n1_++,\n                        n2_++,\n                        n3_++,\n                        n4_++,\n                        n5_++);\n    finished_ = true;\n  }, \"\");\n}\n\n// Tests a failed ASSERT_PRED_FORMAT5 where the\n// predicate-formatter is a functor on a user-defined type (Bool).\nTEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnUserTypeFailure) {\n  expected_to_finish_ = false;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT5(PredFormatFunctor5(),\n                        Bool(n1_++),\n                        Bool(n2_++),\n                        Bool(n3_++),\n                        Bool(n4_++),\n                        Bool(n5_++));\n    finished_ = true;\n  }, \"\");\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_premature_exit_test.cc",
    "content": "// Copyright 2013, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Tests that Google Test manipulates the premature-exit-detection\n// file correctly.\n\n#include <stdio.h>\n\n#include \"gtest/gtest.h\"\n\nusing ::testing::InitGoogleTest;\nusing ::testing::Test;\nusing ::testing::internal::posix::GetEnv;\nusing ::testing::internal::posix::Stat;\nusing ::testing::internal::posix::StatStruct;\n\nnamespace {\n\n// Is the TEST_PREMATURE_EXIT_FILE environment variable expected to be\n// set?\nconst bool kTestPrematureExitFileEnvVarShouldBeSet = false;\n\nclass PrematureExitTest : public Test {\n public:\n  // Returns true iff the given file exists.\n  static bool FileExists(const char* filepath) {\n    StatStruct stat;\n    return Stat(filepath, &stat) == 0;\n  }\n\n protected:\n  PrematureExitTest() {\n    premature_exit_file_path_ = GetEnv(\"TEST_PREMATURE_EXIT_FILE\");\n\n    // Normalize NULL to \"\" for ease of handling.\n    if (premature_exit_file_path_ == NULL) {\n      premature_exit_file_path_ = \"\";\n    }\n  }\n\n  // Returns true iff the premature-exit file exists.\n  bool PrematureExitFileExists() const {\n    return FileExists(premature_exit_file_path_);\n  }\n\n  const char* premature_exit_file_path_;\n};\n\ntypedef PrematureExitTest PrematureExitDeathTest;\n\n// Tests that:\n//   - the premature-exit file exists during the execution of a\n//     death test (EXPECT_DEATH*), and\n//   - a death test doesn't interfere with the main test process's\n//     handling of the premature-exit file.\nTEST_F(PrematureExitDeathTest, FileExistsDuringExecutionOfDeathTest) {\n  if (*premature_exit_file_path_ == '\\0') {\n    return;\n  }\n\n  EXPECT_DEATH_IF_SUPPORTED({\n      // If the file exists, crash the process such that the main test\n      // process will catch the (expected) crash and report a success;\n      // otherwise don't crash, which will cause the main test process\n      // to report that the death test has failed.\n      if (PrematureExitFileExists()) {\n        exit(1);\n      }\n    }, \"\");\n}\n\n// Tests that TEST_PREMATURE_EXIT_FILE is set where it's expected to\n// be set.\nTEST_F(PrematureExitTest, TestPrematureExitFileEnvVarIsSet) {\n  if (kTestPrematureExitFileEnvVarShouldBeSet) {\n    const char* const filepath = GetEnv(\"TEST_PREMATURE_EXIT_FILE\");\n    ASSERT_TRUE(filepath != NULL);\n    ASSERT_NE(*filepath, '\\0');\n  }\n}\n\n// Tests that the premature-exit file exists during the execution of a\n// normal (non-death) test.\nTEST_F(PrematureExitTest, PrematureExitFileExistsDuringTestExecution) {\n  if (*premature_exit_file_path_ == '\\0') {\n    return;\n  }\n\n  EXPECT_TRUE(PrematureExitFileExists())\n      << \" file \" << premature_exit_file_path_\n      << \" should exist during test execution, but doesn't.\";\n}\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  InitGoogleTest(&argc, argv);\n  const int exit_code = RUN_ALL_TESTS();\n\n  // Test that the premature-exit file is deleted upon return from\n  // RUN_ALL_TESTS().\n  const char* const filepath = GetEnv(\"TEST_PREMATURE_EXIT_FILE\");\n  if (filepath != NULL && *filepath != '\\0') {\n    if (PrematureExitTest::FileExists(filepath)) {\n      printf(\n          \"File %s shouldn't exist after the test program finishes, but does.\",\n          filepath);\n      return 1;\n    }\n  }\n\n  return exit_code;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_prod_test.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Unit test for include/gtest/gtest_prod.h.\n\n#include \"gtest/gtest.h\"\n#include \"test/production.h\"\n\n// Tests that private members can be accessed from a TEST declared as\n// a friend of the class.\nTEST(PrivateCodeTest, CanAccessPrivateMembers) {\n  PrivateCode a;\n  EXPECT_EQ(0, a.x_);\n\n  a.set_x(1);\n  EXPECT_EQ(1, a.x_);\n}\n\ntypedef testing::Test PrivateCodeFixtureTest;\n\n// Tests that private members can be accessed from a TEST_F declared\n// as a friend of the class.\nTEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) {\n  PrivateCode a;\n  EXPECT_EQ(0, a.x_);\n\n  a.set_x(2);\n  EXPECT_EQ(2, a.x_);\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_repeat_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Tests the --gtest_repeat=number flag.\n\n#include <stdlib.h>\n#include <iostream>\n#include \"gtest/gtest.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\n\nGTEST_DECLARE_string_(death_test_style);\nGTEST_DECLARE_string_(filter);\nGTEST_DECLARE_int32_(repeat);\n\n}  // namespace testing\n\nusing testing::GTEST_FLAG(death_test_style);\nusing testing::GTEST_FLAG(filter);\nusing testing::GTEST_FLAG(repeat);\n\nnamespace {\n\n// We need this when we are testing Google Test itself and therefore\n// cannot use Google Test assertions.\n#define GTEST_CHECK_INT_EQ_(expected, actual) \\\n  do {\\\n    const int expected_val = (expected);\\\n    const int actual_val = (actual);\\\n    if (::testing::internal::IsTrue(expected_val != actual_val)) {\\\n      ::std::cout << \"Value of: \" #actual \"\\n\"\\\n                  << \"  Actual: \" << actual_val << \"\\n\"\\\n                  << \"Expected: \" #expected \"\\n\"\\\n                  << \"Which is: \" << expected_val << \"\\n\";\\\n      ::testing::internal::posix::Abort();\\\n    }\\\n  } while (::testing::internal::AlwaysFalse())\n\n\n// Used for verifying that global environment set-up and tear-down are\n// inside the gtest_repeat loop.\n\nint g_environment_set_up_count = 0;\nint g_environment_tear_down_count = 0;\n\nclass MyEnvironment : public testing::Environment {\n public:\n  MyEnvironment() {}\n  virtual void SetUp() { g_environment_set_up_count++; }\n  virtual void TearDown() { g_environment_tear_down_count++; }\n};\n\n// A test that should fail.\n\nint g_should_fail_count = 0;\n\nTEST(FooTest, ShouldFail) {\n  g_should_fail_count++;\n  EXPECT_EQ(0, 1) << \"Expected failure.\";\n}\n\n// A test that should pass.\n\nint g_should_pass_count = 0;\n\nTEST(FooTest, ShouldPass) {\n  g_should_pass_count++;\n}\n\n// A test that contains a thread-safe death test and a fast death\n// test.  It should pass.\n\nint g_death_test_count = 0;\n\nTEST(BarDeathTest, ThreadSafeAndFast) {\n  g_death_test_count++;\n\n  GTEST_FLAG(death_test_style) = \"threadsafe\";\n  EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), \"\");\n\n  GTEST_FLAG(death_test_style) = \"fast\";\n  EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), \"\");\n}\n\n#if GTEST_HAS_PARAM_TEST\nint g_param_test_count = 0;\n\nconst int kNumberOfParamTests = 10;\n\nclass MyParamTest : public testing::TestWithParam<int> {};\n\nTEST_P(MyParamTest, ShouldPass) {\n  // TODO(vladl@google.com): Make parameter value checking robust\n  //                         WRT order of tests.\n  GTEST_CHECK_INT_EQ_(g_param_test_count % kNumberOfParamTests, GetParam());\n  g_param_test_count++;\n}\nINSTANTIATE_TEST_CASE_P(MyParamSequence,\n                        MyParamTest,\n                        testing::Range(0, kNumberOfParamTests));\n#endif  // GTEST_HAS_PARAM_TEST\n\n// Resets the count for each test.\nvoid ResetCounts() {\n  g_environment_set_up_count = 0;\n  g_environment_tear_down_count = 0;\n  g_should_fail_count = 0;\n  g_should_pass_count = 0;\n  g_death_test_count = 0;\n#if GTEST_HAS_PARAM_TEST\n  g_param_test_count = 0;\n#endif  // GTEST_HAS_PARAM_TEST\n}\n\n// Checks that the count for each test is expected.\nvoid CheckCounts(int expected) {\n  GTEST_CHECK_INT_EQ_(expected, g_environment_set_up_count);\n  GTEST_CHECK_INT_EQ_(expected, g_environment_tear_down_count);\n  GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);\n  GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);\n  GTEST_CHECK_INT_EQ_(expected, g_death_test_count);\n#if GTEST_HAS_PARAM_TEST\n  GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);\n#endif  // GTEST_HAS_PARAM_TEST\n}\n\n// Tests the behavior of Google Test when --gtest_repeat is not specified.\nvoid TestRepeatUnspecified() {\n  ResetCounts();\n  GTEST_CHECK_INT_EQ_(1, RUN_ALL_TESTS());\n  CheckCounts(1);\n}\n\n// Tests the behavior of Google Test when --gtest_repeat has the given value.\nvoid TestRepeat(int repeat) {\n  GTEST_FLAG(repeat) = repeat;\n\n  ResetCounts();\n  GTEST_CHECK_INT_EQ_(repeat > 0 ? 1 : 0, RUN_ALL_TESTS());\n  CheckCounts(repeat);\n}\n\n// Tests using --gtest_repeat when --gtest_filter specifies an empty\n// set of tests.\nvoid TestRepeatWithEmptyFilter(int repeat) {\n  GTEST_FLAG(repeat) = repeat;\n  GTEST_FLAG(filter) = \"None\";\n\n  ResetCounts();\n  GTEST_CHECK_INT_EQ_(0, RUN_ALL_TESTS());\n  CheckCounts(0);\n}\n\n// Tests using --gtest_repeat when --gtest_filter specifies a set of\n// successful tests.\nvoid TestRepeatWithFilterForSuccessfulTests(int repeat) {\n  GTEST_FLAG(repeat) = repeat;\n  GTEST_FLAG(filter) = \"*-*ShouldFail\";\n\n  ResetCounts();\n  GTEST_CHECK_INT_EQ_(0, RUN_ALL_TESTS());\n  GTEST_CHECK_INT_EQ_(repeat, g_environment_set_up_count);\n  GTEST_CHECK_INT_EQ_(repeat, g_environment_tear_down_count);\n  GTEST_CHECK_INT_EQ_(0, g_should_fail_count);\n  GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);\n  GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);\n#if GTEST_HAS_PARAM_TEST\n  GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);\n#endif  // GTEST_HAS_PARAM_TEST\n}\n\n// Tests using --gtest_repeat when --gtest_filter specifies a set of\n// failed tests.\nvoid TestRepeatWithFilterForFailedTests(int repeat) {\n  GTEST_FLAG(repeat) = repeat;\n  GTEST_FLAG(filter) = \"*ShouldFail\";\n\n  ResetCounts();\n  GTEST_CHECK_INT_EQ_(1, RUN_ALL_TESTS());\n  GTEST_CHECK_INT_EQ_(repeat, g_environment_set_up_count);\n  GTEST_CHECK_INT_EQ_(repeat, g_environment_tear_down_count);\n  GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);\n  GTEST_CHECK_INT_EQ_(0, g_should_pass_count);\n  GTEST_CHECK_INT_EQ_(0, g_death_test_count);\n#if GTEST_HAS_PARAM_TEST\n  GTEST_CHECK_INT_EQ_(0, g_param_test_count);\n#endif  // GTEST_HAS_PARAM_TEST\n}\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  testing::InitGoogleTest(&argc, argv);\n  testing::AddGlobalTestEnvironment(new MyEnvironment);\n\n  TestRepeatUnspecified();\n  TestRepeat(0);\n  TestRepeat(1);\n  TestRepeat(5);\n\n  TestRepeatWithEmptyFilter(2);\n  TestRepeatWithEmptyFilter(3);\n\n  TestRepeatWithFilterForSuccessfulTests(3);\n\n  TestRepeatWithFilterForFailedTests(4);\n\n  // It would be nice to verify that the tests indeed loop forever\n  // when GTEST_FLAG(repeat) is negative, but this test will be quite\n  // complicated to write.  Since this flag is for interactive\n  // debugging only and doesn't affect the normal test result, such a\n  // test would be an overkill.\n\n  printf(\"PASS\\n\");\n  return 0;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_shuffle_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Verifies that test shuffling works.\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport gtest_test_utils\n\n# Command to run the gtest_shuffle_test_ program.\nCOMMAND = gtest_test_utils.GetTestExecutablePath('gtest_shuffle_test_')\n\n# The environment variables for test sharding.\nTOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'\nSHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX'\n\nTEST_FILTER = 'A*.A:A*.B:C*'\n\nALL_TESTS = []\nACTIVE_TESTS = []\nFILTERED_TESTS = []\nSHARDED_TESTS = []\n\nSHUFFLED_ALL_TESTS = []\nSHUFFLED_ACTIVE_TESTS = []\nSHUFFLED_FILTERED_TESTS = []\nSHUFFLED_SHARDED_TESTS = []\n\n\ndef AlsoRunDisabledTestsFlag():\n  return '--gtest_also_run_disabled_tests'\n\n\ndef FilterFlag(test_filter):\n  return '--gtest_filter=%s' % (test_filter,)\n\n\ndef RepeatFlag(n):\n  return '--gtest_repeat=%s' % (n,)\n\n\ndef ShuffleFlag():\n  return '--gtest_shuffle'\n\n\ndef RandomSeedFlag(n):\n  return '--gtest_random_seed=%s' % (n,)\n\n\ndef RunAndReturnOutput(extra_env, args):\n  \"\"\"Runs the test program and returns its output.\"\"\"\n\n  environ_copy = os.environ.copy()\n  environ_copy.update(extra_env)\n\n  return gtest_test_utils.Subprocess([COMMAND] + args, env=environ_copy).output\n\n\ndef GetTestsForAllIterations(extra_env, args):\n  \"\"\"Runs the test program and returns a list of test lists.\n\n  Args:\n    extra_env: a map from environment variables to their values\n    args: command line flags to pass to gtest_shuffle_test_\n\n  Returns:\n    A list where the i-th element is the list of tests run in the i-th\n    test iteration.\n  \"\"\"\n\n  test_iterations = []\n  for line in RunAndReturnOutput(extra_env, args).split('\\n'):\n    if line.startswith('----'):\n      tests = []\n      test_iterations.append(tests)\n    elif line.strip():\n      tests.append(line.strip())  # 'TestCaseName.TestName'\n\n  return test_iterations\n\n\ndef GetTestCases(tests):\n  \"\"\"Returns a list of test cases in the given full test names.\n\n  Args:\n    tests: a list of full test names\n\n  Returns:\n    A list of test cases from 'tests', in their original order.\n    Consecutive duplicates are removed.\n  \"\"\"\n\n  test_cases = []\n  for test in tests:\n    test_case = test.split('.')[0]\n    if not test_case in test_cases:\n      test_cases.append(test_case)\n\n  return test_cases\n\n\ndef CalculateTestLists():\n  \"\"\"Calculates the list of tests run under different flags.\"\"\"\n\n  if not ALL_TESTS:\n    ALL_TESTS.extend(\n        GetTestsForAllIterations({}, [AlsoRunDisabledTestsFlag()])[0])\n\n  if not ACTIVE_TESTS:\n    ACTIVE_TESTS.extend(GetTestsForAllIterations({}, [])[0])\n\n  if not FILTERED_TESTS:\n    FILTERED_TESTS.extend(\n        GetTestsForAllIterations({}, [FilterFlag(TEST_FILTER)])[0])\n\n  if not SHARDED_TESTS:\n    SHARDED_TESTS.extend(\n        GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',\n                                  SHARD_INDEX_ENV_VAR: '1'},\n                                 [])[0])\n\n  if not SHUFFLED_ALL_TESTS:\n    SHUFFLED_ALL_TESTS.extend(GetTestsForAllIterations(\n        {}, [AlsoRunDisabledTestsFlag(), ShuffleFlag(), RandomSeedFlag(1)])[0])\n\n  if not SHUFFLED_ACTIVE_TESTS:\n    SHUFFLED_ACTIVE_TESTS.extend(GetTestsForAllIterations(\n        {}, [ShuffleFlag(), RandomSeedFlag(1)])[0])\n\n  if not SHUFFLED_FILTERED_TESTS:\n    SHUFFLED_FILTERED_TESTS.extend(GetTestsForAllIterations(\n        {}, [ShuffleFlag(), RandomSeedFlag(1), FilterFlag(TEST_FILTER)])[0])\n\n  if not SHUFFLED_SHARDED_TESTS:\n    SHUFFLED_SHARDED_TESTS.extend(\n        GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',\n                                  SHARD_INDEX_ENV_VAR: '1'},\n                                 [ShuffleFlag(), RandomSeedFlag(1)])[0])\n\n\nclass GTestShuffleUnitTest(gtest_test_utils.TestCase):\n  \"\"\"Tests test shuffling.\"\"\"\n\n  def setUp(self):\n    CalculateTestLists()\n\n  def testShufflePreservesNumberOfTests(self):\n    self.assertEqual(len(ALL_TESTS), len(SHUFFLED_ALL_TESTS))\n    self.assertEqual(len(ACTIVE_TESTS), len(SHUFFLED_ACTIVE_TESTS))\n    self.assertEqual(len(FILTERED_TESTS), len(SHUFFLED_FILTERED_TESTS))\n    self.assertEqual(len(SHARDED_TESTS), len(SHUFFLED_SHARDED_TESTS))\n\n  def testShuffleChangesTestOrder(self):\n    self.assert_(SHUFFLED_ALL_TESTS != ALL_TESTS, SHUFFLED_ALL_TESTS)\n    self.assert_(SHUFFLED_ACTIVE_TESTS != ACTIVE_TESTS, SHUFFLED_ACTIVE_TESTS)\n    self.assert_(SHUFFLED_FILTERED_TESTS != FILTERED_TESTS,\n                 SHUFFLED_FILTERED_TESTS)\n    self.assert_(SHUFFLED_SHARDED_TESTS != SHARDED_TESTS,\n                 SHUFFLED_SHARDED_TESTS)\n\n  def testShuffleChangesTestCaseOrder(self):\n    self.assert_(GetTestCases(SHUFFLED_ALL_TESTS) != GetTestCases(ALL_TESTS),\n                 GetTestCases(SHUFFLED_ALL_TESTS))\n    self.assert_(\n        GetTestCases(SHUFFLED_ACTIVE_TESTS) != GetTestCases(ACTIVE_TESTS),\n        GetTestCases(SHUFFLED_ACTIVE_TESTS))\n    self.assert_(\n        GetTestCases(SHUFFLED_FILTERED_TESTS) != GetTestCases(FILTERED_TESTS),\n        GetTestCases(SHUFFLED_FILTERED_TESTS))\n    self.assert_(\n        GetTestCases(SHUFFLED_SHARDED_TESTS) != GetTestCases(SHARDED_TESTS),\n        GetTestCases(SHUFFLED_SHARDED_TESTS))\n\n  def testShuffleDoesNotRepeatTest(self):\n    for test in SHUFFLED_ALL_TESTS:\n      self.assertEqual(1, SHUFFLED_ALL_TESTS.count(test),\n                       '%s appears more than once' % (test,))\n    for test in SHUFFLED_ACTIVE_TESTS:\n      self.assertEqual(1, SHUFFLED_ACTIVE_TESTS.count(test),\n                       '%s appears more than once' % (test,))\n    for test in SHUFFLED_FILTERED_TESTS:\n      self.assertEqual(1, SHUFFLED_FILTERED_TESTS.count(test),\n                       '%s appears more than once' % (test,))\n    for test in SHUFFLED_SHARDED_TESTS:\n      self.assertEqual(1, SHUFFLED_SHARDED_TESTS.count(test),\n                       '%s appears more than once' % (test,))\n\n  def testShuffleDoesNotCreateNewTest(self):\n    for test in SHUFFLED_ALL_TESTS:\n      self.assert_(test in ALL_TESTS, '%s is an invalid test' % (test,))\n    for test in SHUFFLED_ACTIVE_TESTS:\n      self.assert_(test in ACTIVE_TESTS, '%s is an invalid test' % (test,))\n    for test in SHUFFLED_FILTERED_TESTS:\n      self.assert_(test in FILTERED_TESTS, '%s is an invalid test' % (test,))\n    for test in SHUFFLED_SHARDED_TESTS:\n      self.assert_(test in SHARDED_TESTS, '%s is an invalid test' % (test,))\n\n  def testShuffleIncludesAllTests(self):\n    for test in ALL_TESTS:\n      self.assert_(test in SHUFFLED_ALL_TESTS, '%s is missing' % (test,))\n    for test in ACTIVE_TESTS:\n      self.assert_(test in SHUFFLED_ACTIVE_TESTS, '%s is missing' % (test,))\n    for test in FILTERED_TESTS:\n      self.assert_(test in SHUFFLED_FILTERED_TESTS, '%s is missing' % (test,))\n    for test in SHARDED_TESTS:\n      self.assert_(test in SHUFFLED_SHARDED_TESTS, '%s is missing' % (test,))\n\n  def testShuffleLeavesDeathTestsAtFront(self):\n    non_death_test_found = False\n    for test in SHUFFLED_ACTIVE_TESTS:\n      if 'DeathTest.' in test:\n        self.assert_(not non_death_test_found,\n                     '%s appears after a non-death test' % (test,))\n      else:\n        non_death_test_found = True\n\n  def _VerifyTestCasesDoNotInterleave(self, tests):\n    test_cases = []\n    for test in tests:\n      [test_case, _] = test.split('.')\n      if test_cases and test_cases[-1] != test_case:\n        test_cases.append(test_case)\n        self.assertEqual(1, test_cases.count(test_case),\n                         'Test case %s is not grouped together in %s' %\n                         (test_case, tests))\n\n  def testShuffleDoesNotInterleaveTestCases(self):\n    self._VerifyTestCasesDoNotInterleave(SHUFFLED_ALL_TESTS)\n    self._VerifyTestCasesDoNotInterleave(SHUFFLED_ACTIVE_TESTS)\n    self._VerifyTestCasesDoNotInterleave(SHUFFLED_FILTERED_TESTS)\n    self._VerifyTestCasesDoNotInterleave(SHUFFLED_SHARDED_TESTS)\n\n  def testShuffleRestoresOrderAfterEachIteration(self):\n    # Get the test lists in all 3 iterations, using random seed 1, 2,\n    # and 3 respectively.  Google Test picks a different seed in each\n    # iteration, and this test depends on the current implementation\n    # picking successive numbers.  This dependency is not ideal, but\n    # makes the test much easier to write.\n    [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (\n        GetTestsForAllIterations(\n            {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))\n\n    # Make sure running the tests with random seed 1 gets the same\n    # order as in iteration 1 above.\n    [tests_with_seed1] = GetTestsForAllIterations(\n        {}, [ShuffleFlag(), RandomSeedFlag(1)])\n    self.assertEqual(tests_in_iteration1, tests_with_seed1)\n\n    # Make sure running the tests with random seed 2 gets the same\n    # order as in iteration 2 above.  Success means that Google Test\n    # correctly restores the test order before re-shuffling at the\n    # beginning of iteration 2.\n    [tests_with_seed2] = GetTestsForAllIterations(\n        {}, [ShuffleFlag(), RandomSeedFlag(2)])\n    self.assertEqual(tests_in_iteration2, tests_with_seed2)\n\n    # Make sure running the tests with random seed 3 gets the same\n    # order as in iteration 3 above.  Success means that Google Test\n    # correctly restores the test order before re-shuffling at the\n    # beginning of iteration 3.\n    [tests_with_seed3] = GetTestsForAllIterations(\n        {}, [ShuffleFlag(), RandomSeedFlag(3)])\n    self.assertEqual(tests_in_iteration3, tests_with_seed3)\n\n  def testShuffleGeneratesNewOrderInEachIteration(self):\n    [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (\n        GetTestsForAllIterations(\n            {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))\n\n    self.assert_(tests_in_iteration1 != tests_in_iteration2,\n                 tests_in_iteration1)\n    self.assert_(tests_in_iteration1 != tests_in_iteration3,\n                 tests_in_iteration1)\n    self.assert_(tests_in_iteration2 != tests_in_iteration3,\n                 tests_in_iteration2)\n\n  def testShuffleShardedTestsPreservesPartition(self):\n    # If we run M tests on N shards, the same M tests should be run in\n    # total, regardless of the random seeds used by the shards.\n    [tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',\n                                         SHARD_INDEX_ENV_VAR: '0'},\n                                        [ShuffleFlag(), RandomSeedFlag(1)])\n    [tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',\n                                         SHARD_INDEX_ENV_VAR: '1'},\n                                        [ShuffleFlag(), RandomSeedFlag(20)])\n    [tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',\n                                         SHARD_INDEX_ENV_VAR: '2'},\n                                        [ShuffleFlag(), RandomSeedFlag(25)])\n    sorted_sharded_tests = tests1 + tests2 + tests3\n    sorted_sharded_tests.sort()\n    sorted_active_tests = []\n    sorted_active_tests.extend(ACTIVE_TESTS)\n    sorted_active_tests.sort()\n    self.assertEqual(sorted_active_tests, sorted_sharded_tests)\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_shuffle_test_.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Verifies that test shuffling works.\n\n#include \"gtest/gtest.h\"\n\nnamespace {\n\nusing ::testing::EmptyTestEventListener;\nusing ::testing::InitGoogleTest;\nusing ::testing::Message;\nusing ::testing::Test;\nusing ::testing::TestEventListeners;\nusing ::testing::TestInfo;\nusing ::testing::UnitTest;\nusing ::testing::internal::scoped_ptr;\n\n// The test methods are empty, as the sole purpose of this program is\n// to print the test names before/after shuffling.\n\nclass A : public Test {};\nTEST_F(A, A) {}\nTEST_F(A, B) {}\n\nTEST(ADeathTest, A) {}\nTEST(ADeathTest, B) {}\nTEST(ADeathTest, C) {}\n\nTEST(B, A) {}\nTEST(B, B) {}\nTEST(B, C) {}\nTEST(B, DISABLED_D) {}\nTEST(B, DISABLED_E) {}\n\nTEST(BDeathTest, A) {}\nTEST(BDeathTest, B) {}\n\nTEST(C, A) {}\nTEST(C, B) {}\nTEST(C, C) {}\nTEST(C, DISABLED_D) {}\n\nTEST(CDeathTest, A) {}\n\nTEST(DISABLED_D, A) {}\nTEST(DISABLED_D, DISABLED_B) {}\n\n// This printer prints the full test names only, starting each test\n// iteration with a \"----\" marker.\nclass TestNamePrinter : public EmptyTestEventListener {\n public:\n  virtual void OnTestIterationStart(const UnitTest& /* unit_test */,\n                                    int /* iteration */) {\n    printf(\"----\\n\");\n  }\n\n  virtual void OnTestStart(const TestInfo& test_info) {\n    printf(\"%s.%s\\n\", test_info.test_case_name(), test_info.name());\n  }\n};\n\n}  // namespace\n\nint main(int argc, char **argv) {\n  InitGoogleTest(&argc, argv);\n\n  // Replaces the default printer with TestNamePrinter, which prints\n  // the test name only.\n  TestEventListeners& listeners = UnitTest::GetInstance()->listeners();\n  delete listeners.Release(listeners.default_result_printer());\n  listeners.Append(new TestNamePrinter);\n\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_sole_header_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: mheule@google.com (Markus Heule)\n//\n// This test verifies that it's possible to use Google Test by including\n// the gtest.h header file alone.\n\n#include \"gtest/gtest.h\"\n\nnamespace {\n\nvoid Subroutine() {\n  EXPECT_EQ(42, 42);\n}\n\nTEST(NoFatalFailureTest, ExpectNoFatalFailure) {\n  EXPECT_NO_FATAL_FAILURE(;);\n  EXPECT_NO_FATAL_FAILURE(SUCCEED());\n  EXPECT_NO_FATAL_FAILURE(Subroutine());\n  EXPECT_NO_FATAL_FAILURE({ SUCCEED(); });\n}\n\nTEST(NoFatalFailureTest, AssertNoFatalFailure) {\n  ASSERT_NO_FATAL_FAILURE(;);\n  ASSERT_NO_FATAL_FAILURE(SUCCEED());\n  ASSERT_NO_FATAL_FAILURE(Subroutine());\n  ASSERT_NO_FATAL_FAILURE({ SUCCEED(); });\n}\n\n}  // namespace\n"
  },
  {
    "path": "Tests/gtest/test/gtest_stress_test.cc",
    "content": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Tests that SCOPED_TRACE() and various Google Test assertions can be\n// used in a large number of threads concurrently.\n\n#include \"gtest/gtest.h\"\n\n#include <iostream>\n#include <vector>\n\n// We must define this macro in order to #include\n// gtest-internal-inl.h.  This is how Google Test prevents a user from\n// accidentally depending on its internal implementation.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\n#if GTEST_IS_THREADSAFE\n\nnamespace testing {\nnamespace {\n\nusing internal::Notification;\nusing internal::TestPropertyKeyIs;\nusing internal::ThreadWithParam;\nusing internal::scoped_ptr;\n\n// In order to run tests in this file, for platforms where Google Test is\n// thread safe, implement ThreadWithParam. See the description of its API\n// in gtest-port.h, where it is defined for already supported platforms.\n\n// How many threads to create?\nconst int kThreadCount = 50;\n\nstd::string IdToKey(int id, const char* suffix) {\n  Message key;\n  key << \"key_\" << id << \"_\" << suffix;\n  return key.GetString();\n}\n\nstd::string IdToString(int id) {\n  Message id_message;\n  id_message << id;\n  return id_message.GetString();\n}\n\nvoid ExpectKeyAndValueWereRecordedForId(\n    const std::vector<TestProperty>& properties,\n    int id, const char* suffix) {\n  TestPropertyKeyIs matches_key(IdToKey(id, suffix).c_str());\n  const std::vector<TestProperty>::const_iterator property =\n      std::find_if(properties.begin(), properties.end(), matches_key);\n  ASSERT_TRUE(property != properties.end())\n      << \"expecting \" << suffix << \" value for id \" << id;\n  EXPECT_STREQ(IdToString(id).c_str(), property->value());\n}\n\n// Calls a large number of Google Test assertions, where exactly one of them\n// will fail.\nvoid ManyAsserts(int id) {\n  GTEST_LOG_(INFO) << \"Thread #\" << id << \" running...\";\n\n  SCOPED_TRACE(Message() << \"Thread #\" << id);\n\n  for (int i = 0; i < kThreadCount; i++) {\n    SCOPED_TRACE(Message() << \"Iteration #\" << i);\n\n    // A bunch of assertions that should succeed.\n    EXPECT_TRUE(true);\n    ASSERT_FALSE(false) << \"This shouldn't fail.\";\n    EXPECT_STREQ(\"a\", \"a\");\n    ASSERT_LE(5, 6);\n    EXPECT_EQ(i, i) << \"This shouldn't fail.\";\n\n    // RecordProperty() should interact safely with other threads as well.\n    // The shared_key forces property updates.\n    Test::RecordProperty(IdToKey(id, \"string\").c_str(), IdToString(id).c_str());\n    Test::RecordProperty(IdToKey(id, \"int\").c_str(), id);\n    Test::RecordProperty(\"shared_key\", IdToString(id).c_str());\n\n    // This assertion should fail kThreadCount times per thread.  It\n    // is for testing whether Google Test can handle failed assertions in a\n    // multi-threaded context.\n    EXPECT_LT(i, 0) << \"This should always fail.\";\n  }\n}\n\nvoid CheckTestFailureCount(int expected_failures) {\n  const TestInfo* const info = UnitTest::GetInstance()->current_test_info();\n  const TestResult* const result = info->result();\n  GTEST_CHECK_(expected_failures == result->total_part_count())\n      << \"Logged \" << result->total_part_count() << \" failures \"\n      << \" vs. \" << expected_failures << \" expected\";\n}\n\n// Tests using SCOPED_TRACE() and Google Test assertions in many threads\n// concurrently.\nTEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) {\n  {\n    scoped_ptr<ThreadWithParam<int> > threads[kThreadCount];\n    Notification threads_can_start;\n    for (int i = 0; i != kThreadCount; i++)\n      threads[i].reset(new ThreadWithParam<int>(&ManyAsserts,\n                                                i,\n                                                &threads_can_start));\n\n    threads_can_start.Notify();\n\n    // Blocks until all the threads are done.\n    for (int i = 0; i != kThreadCount; i++)\n      threads[i]->Join();\n  }\n\n  // Ensures that kThreadCount*kThreadCount failures have been reported.\n  const TestInfo* const info = UnitTest::GetInstance()->current_test_info();\n  const TestResult* const result = info->result();\n\n  std::vector<TestProperty> properties;\n  // We have no access to the TestResult's list of properties but we can\n  // copy them one by one.\n  for (int i = 0; i < result->test_property_count(); ++i)\n    properties.push_back(result->GetTestProperty(i));\n\n  EXPECT_EQ(kThreadCount * 2 + 1, result->test_property_count())\n      << \"String and int values recorded on each thread, \"\n      << \"as well as one shared_key\";\n  for (int i = 0; i < kThreadCount; ++i) {\n    ExpectKeyAndValueWereRecordedForId(properties, i, \"string\");\n    ExpectKeyAndValueWereRecordedForId(properties, i, \"int\");\n  }\n  CheckTestFailureCount(kThreadCount*kThreadCount);\n}\n\nvoid FailingThread(bool is_fatal) {\n  if (is_fatal)\n    FAIL() << \"Fatal failure in some other thread. \"\n           << \"(This failure is expected.)\";\n  else\n    ADD_FAILURE() << \"Non-fatal failure in some other thread. \"\n                  << \"(This failure is expected.)\";\n}\n\nvoid GenerateFatalFailureInAnotherThread(bool is_fatal) {\n  ThreadWithParam<bool> thread(&FailingThread, is_fatal, NULL);\n  thread.Join();\n}\n\nTEST(NoFatalFailureTest, ExpectNoFatalFailureIgnoresFailuresInOtherThreads) {\n  EXPECT_NO_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true));\n  // We should only have one failure (the one from\n  // GenerateFatalFailureInAnotherThread()), since the EXPECT_NO_FATAL_FAILURE\n  // should succeed.\n  CheckTestFailureCount(1);\n}\n\nvoid AssertNoFatalFailureIgnoresFailuresInOtherThreads() {\n  ASSERT_NO_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true));\n}\nTEST(NoFatalFailureTest, AssertNoFatalFailureIgnoresFailuresInOtherThreads) {\n  // Using a subroutine, to make sure, that the test continues.\n  AssertNoFatalFailureIgnoresFailuresInOtherThreads();\n  // We should only have one failure (the one from\n  // GenerateFatalFailureInAnotherThread()), since the EXPECT_NO_FATAL_FAILURE\n  // should succeed.\n  CheckTestFailureCount(1);\n}\n\nTEST(FatalFailureTest, ExpectFatalFailureIgnoresFailuresInOtherThreads) {\n  // This statement should fail, since the current thread doesn't generate a\n  // fatal failure, only another one does.\n  EXPECT_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true), \"expected\");\n  CheckTestFailureCount(2);\n}\n\nTEST(FatalFailureOnAllThreadsTest, ExpectFatalFailureOnAllThreads) {\n  // This statement should succeed, because failures in all threads are\n  // considered.\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(\n      GenerateFatalFailureInAnotherThread(true), \"expected\");\n  CheckTestFailureCount(0);\n  // We need to add a failure, because main() checks that there are failures.\n  // But when only this test is run, we shouldn't have any failures.\n  ADD_FAILURE() << \"This is an expected non-fatal failure.\";\n}\n\nTEST(NonFatalFailureTest, ExpectNonFatalFailureIgnoresFailuresInOtherThreads) {\n  // This statement should fail, since the current thread doesn't generate a\n  // fatal failure, only another one does.\n  EXPECT_NONFATAL_FAILURE(GenerateFatalFailureInAnotherThread(false),\n                          \"expected\");\n  CheckTestFailureCount(2);\n}\n\nTEST(NonFatalFailureOnAllThreadsTest, ExpectNonFatalFailureOnAllThreads) {\n  // This statement should succeed, because failures in all threads are\n  // considered.\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(\n      GenerateFatalFailureInAnotherThread(false), \"expected\");\n  CheckTestFailureCount(0);\n  // We need to add a failure, because main() checks that there are failures,\n  // But when only this test is run, we shouldn't have any failures.\n  ADD_FAILURE() << \"This is an expected non-fatal failure.\";\n}\n\n}  // namespace\n}  // namespace testing\n\nint main(int argc, char **argv) {\n  testing::InitGoogleTest(&argc, argv);\n\n  const int result = RUN_ALL_TESTS();  // Expected to fail.\n  GTEST_CHECK_(result == 1) << \"RUN_ALL_TESTS() did not fail as expected\";\n\n  printf(\"\\nPASS\\n\");\n  return 0;\n}\n\n#else\nTEST(StressTest,\n     DISABLED_ThreadSafetyTestsAreSkippedWhenGoogleTestIsNotThreadSafe) {\n}\n\nint main(int argc, char **argv) {\n  testing::InitGoogleTest(&argc, argv);\n  return RUN_ALL_TESTS();\n}\n#endif  // GTEST_IS_THREADSAFE\n"
  },
  {
    "path": "Tests/gtest/test/gtest_test_utils.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test utilities for Google C++ Testing Framework.\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport atexit\nimport os\nimport shutil\nimport sys\nimport tempfile\nimport unittest\n_test_module = unittest\n\n# Suppresses the 'Import not at the top of the file' lint complaint.\n# pylint: disable-msg=C6204\ntry:\n  import subprocess\n  _SUBPROCESS_MODULE_AVAILABLE = True\nexcept:\n  import popen2\n  _SUBPROCESS_MODULE_AVAILABLE = False\n# pylint: enable-msg=C6204\n\nGTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'\n\nIS_WINDOWS = os.name == 'nt'\nIS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]\n\n# The environment variable for specifying the path to the premature-exit file.\nPREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'\n\nenviron = os.environ.copy()\n\n\ndef SetEnvVar(env_var, value):\n  \"\"\"Sets/unsets an environment variable to a given value.\"\"\"\n\n  if value is not None:\n    environ[env_var] = value\n  elif env_var in environ:\n    del environ[env_var]\n\n\n# Here we expose a class from a particular module, depending on the\n# environment. The comment suppresses the 'Invalid variable name' lint\n# complaint.\nTestCase = _test_module.TestCase  # pylint: disable-msg=C6409\n\n# Initially maps a flag to its default value. After\n# _ParseAndStripGTestFlags() is called, maps a flag to its actual value.\n_flag_map = {'source_dir': os.path.dirname(sys.argv[0]),\n             'build_dir': os.path.dirname(sys.argv[0])}\n_gtest_flags_are_parsed = False\n\n\ndef _ParseAndStripGTestFlags(argv):\n  \"\"\"Parses and strips Google Test flags from argv.  This is idempotent.\"\"\"\n\n  # Suppresses the lint complaint about a global variable since we need it\n  # here to maintain module-wide state.\n  global _gtest_flags_are_parsed  # pylint: disable-msg=W0603\n  if _gtest_flags_are_parsed:\n    return\n\n  _gtest_flags_are_parsed = True\n  for flag in _flag_map:\n    # The environment variable overrides the default value.\n    if flag.upper() in os.environ:\n      _flag_map[flag] = os.environ[flag.upper()]\n\n    # The command line flag overrides the environment variable.\n    i = 1  # Skips the program name.\n    while i < len(argv):\n      prefix = '--' + flag + '='\n      if argv[i].startswith(prefix):\n        _flag_map[flag] = argv[i][len(prefix):]\n        del argv[i]\n        break\n      else:\n        # We don't increment i in case we just found a --gtest_* flag\n        # and removed it from argv.\n        i += 1\n\n\ndef GetFlag(flag):\n  \"\"\"Returns the value of the given flag.\"\"\"\n\n  # In case GetFlag() is called before Main(), we always call\n  # _ParseAndStripGTestFlags() here to make sure the --gtest_* flags\n  # are parsed.\n  _ParseAndStripGTestFlags(sys.argv)\n\n  return _flag_map[flag]\n\n\ndef GetSourceDir():\n  \"\"\"Returns the absolute path of the directory where the .py files are.\"\"\"\n\n  return os.path.abspath(GetFlag('source_dir'))\n\n\ndef GetBuildDir():\n  \"\"\"Returns the absolute path of the directory where the test binaries are.\"\"\"\n\n  return os.path.abspath(GetFlag('build_dir'))\n\n\n_temp_dir = None\n\ndef _RemoveTempDir():\n  if _temp_dir:\n    shutil.rmtree(_temp_dir, ignore_errors=True)\n\natexit.register(_RemoveTempDir)\n\n\ndef GetTempDir():\n  \"\"\"Returns a directory for temporary files.\"\"\"\n\n  global _temp_dir\n  if not _temp_dir:\n    _temp_dir = tempfile.mkdtemp()\n  return _temp_dir\n\n\ndef GetTestExecutablePath(executable_name, build_dir=None):\n  \"\"\"Returns the absolute path of the test binary given its name.\n\n  The function will print a message and abort the program if the resulting file\n  doesn't exist.\n\n  Args:\n    executable_name: name of the test binary that the test script runs.\n    build_dir:       directory where to look for executables, by default\n                     the result of GetBuildDir().\n\n  Returns:\n    The absolute path of the test binary.\n  \"\"\"\n\n  path = os.path.abspath(os.path.join(build_dir or GetBuildDir(),\n                                      executable_name))\n  if (IS_WINDOWS or IS_CYGWIN) and not path.endswith('.exe'):\n    path += '.exe'\n\n  if not os.path.exists(path):\n    message = (\n        'Unable to find the test binary. Please make sure to provide path\\n'\n        'to the binary via the --build_dir flag or the BUILD_DIR\\n'\n        'environment variable.')\n    print >> sys.stderr, message\n    sys.exit(1)\n\n  return path\n\n\ndef GetExitStatus(exit_code):\n  \"\"\"Returns the argument to exit(), or -1 if exit() wasn't called.\n\n  Args:\n    exit_code: the result value of os.system(command).\n  \"\"\"\n\n  if os.name == 'nt':\n    # On Windows, os.WEXITSTATUS() doesn't work and os.system() returns\n    # the argument to exit() directly.\n    return exit_code\n  else:\n    # On Unix, os.WEXITSTATUS() must be used to extract the exit status\n    # from the result of os.system().\n    if os.WIFEXITED(exit_code):\n      return os.WEXITSTATUS(exit_code)\n    else:\n      return -1\n\n\nclass Subprocess:\n  def __init__(self, command, working_dir=None, capture_stderr=True, env=None):\n    \"\"\"Changes into a specified directory, if provided, and executes a command.\n\n    Restores the old directory afterwards.\n\n    Args:\n      command:        The command to run, in the form of sys.argv.\n      working_dir:    The directory to change into.\n      capture_stderr: Determines whether to capture stderr in the output member\n                      or to discard it.\n      env:            Dictionary with environment to pass to the subprocess.\n\n    Returns:\n      An object that represents outcome of the executed process. It has the\n      following attributes:\n        terminated_by_signal   True iff the child process has been terminated\n                               by a signal.\n        signal                 Sygnal that terminated the child process.\n        exited                 True iff the child process exited normally.\n        exit_code              The code with which the child process exited.\n        output                 Child process's stdout and stderr output\n                               combined in a string.\n    \"\"\"\n\n    # The subprocess module is the preferrable way of running programs\n    # since it is available and behaves consistently on all platforms,\n    # including Windows. But it is only available starting in python 2.4.\n    # In earlier python versions, we revert to the popen2 module, which is\n    # available in python 2.0 and later but doesn't provide required\n    # functionality (Popen4) under Windows. This allows us to support Mac\n    # OS X 10.4 Tiger, which has python 2.3 installed.\n    if _SUBPROCESS_MODULE_AVAILABLE:\n      if capture_stderr:\n        stderr = subprocess.STDOUT\n      else:\n        stderr = subprocess.PIPE\n\n      p = subprocess.Popen(command,\n                           stdout=subprocess.PIPE, stderr=stderr,\n                           cwd=working_dir, universal_newlines=True, env=env)\n      # communicate returns a tuple with the file obect for the child's\n      # output.\n      self.output = p.communicate()[0]\n      self._return_code = p.returncode\n    else:\n      old_dir = os.getcwd()\n\n      def _ReplaceEnvDict(dest, src):\n        # Changes made by os.environ.clear are not inheritable by child\n        # processes until Python 2.6. To produce inheritable changes we have\n        # to delete environment items with the del statement.\n        for key in dest.keys():\n          del dest[key]\n        dest.update(src)\n\n      # When 'env' is not None, backup the environment variables and replace\n      # them with the passed 'env'. When 'env' is None, we simply use the\n      # current 'os.environ' for compatibility with the subprocess.Popen\n      # semantics used above.\n      if env is not None:\n        old_environ = os.environ.copy()\n        _ReplaceEnvDict(os.environ, env)\n\n      try:\n        if working_dir is not None:\n          os.chdir(working_dir)\n        if capture_stderr:\n          p = popen2.Popen4(command)\n        else:\n          p = popen2.Popen3(command)\n        p.tochild.close()\n        self.output = p.fromchild.read()\n        ret_code = p.wait()\n      finally:\n        os.chdir(old_dir)\n\n        # Restore the old environment variables\n        # if they were replaced.\n        if env is not None:\n          _ReplaceEnvDict(os.environ, old_environ)\n\n      # Converts ret_code to match the semantics of\n      # subprocess.Popen.returncode.\n      if os.WIFSIGNALED(ret_code):\n        self._return_code = -os.WTERMSIG(ret_code)\n      else:  # os.WIFEXITED(ret_code) should return True here.\n        self._return_code = os.WEXITSTATUS(ret_code)\n\n    if self._return_code < 0:\n      self.terminated_by_signal = True\n      self.exited = False\n      self.signal = -self._return_code\n    else:\n      self.terminated_by_signal = False\n      self.exited = True\n      self.exit_code = self._return_code\n\n\ndef Main():\n  \"\"\"Runs the unit test.\"\"\"\n\n  # We must call _ParseAndStripGTestFlags() before calling\n  # unittest.main().  Otherwise the latter will be confused by the\n  # --gtest_* flags.\n  _ParseAndStripGTestFlags(sys.argv)\n  # The tested binaries should not be writing XML output files unless the\n  # script explicitly instructs them to.\n  # TODO(vladl@google.com): Move this into Subprocess when we implement\n  # passing environment into it as a parameter.\n  if GTEST_OUTPUT_VAR_NAME in os.environ:\n    del os.environ[GTEST_OUTPUT_VAR_NAME]\n\n  _test_module.main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_throw_on_failure_ex_test.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Tests Google Test's throw-on-failure mode with exceptions enabled.\n\n#include \"gtest/gtest.h\"\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdexcept>\n\n// Prints the given failure message and exits the program with\n// non-zero.  We use this instead of a Google Test assertion to\n// indicate a failure, as the latter is been tested and cannot be\n// relied on.\nvoid Fail(const char* msg) {\n  printf(\"FAILURE: %s\\n\", msg);\n  fflush(stdout);\n  exit(1);\n}\n\n// Tests that an assertion failure throws a subclass of\n// std::runtime_error.\nvoid TestFailureThrowsRuntimeError() {\n  testing::GTEST_FLAG(throw_on_failure) = true;\n\n  // A successful assertion shouldn't throw.\n  try {\n    EXPECT_EQ(3, 3);\n  } catch(...) {\n    Fail(\"A successful assertion wrongfully threw.\");\n  }\n\n  // A failed assertion should throw a subclass of std::runtime_error.\n  try {\n    EXPECT_EQ(2, 3) << \"Expected failure\";\n  } catch(const std::runtime_error& e) {\n    if (strstr(e.what(), \"Expected failure\") != NULL)\n      return;\n\n    printf(\"%s\",\n           \"A failed assertion did throw an exception of the right type, \"\n           \"but the message is incorrect.  Instead of containing \\\"Expected \"\n           \"failure\\\", it is:\\n\");\n    Fail(e.what());\n  } catch(...) {\n    Fail(\"A failed assertion threw the wrong type of exception.\");\n  }\n  Fail(\"A failed assertion should've thrown but didn't.\");\n}\n\nint main(int argc, char** argv) {\n  testing::InitGoogleTest(&argc, argv);\n\n  // We want to ensure that people can use Google Test assertions in\n  // other testing frameworks, as long as they initialize Google Test\n  // properly and set the thrown-on-failure mode.  Therefore, we don't\n  // use Google Test's constructs for defining and running tests\n  // (e.g. TEST and RUN_ALL_TESTS) here.\n\n  TestFailureThrowsRuntimeError();\n  return 0;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_throw_on_failure_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Tests Google Test's throw-on-failure mode with exceptions disabled.\n\nThis script invokes gtest_throw_on_failure_test_ (a program written with\nGoogle Test) with different environments and command line flags.\n\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport os\nimport gtest_test_utils\n\n\n# Constants.\n\n# The command line flag for enabling/disabling the throw-on-failure mode.\nTHROW_ON_FAILURE = 'gtest_throw_on_failure'\n\n# Path to the gtest_throw_on_failure_test_ program, compiled with\n# exceptions disabled.\nEXE_PATH = gtest_test_utils.GetTestExecutablePath(\n    'gtest_throw_on_failure_test_')\n\n\n# Utilities.\n\n\ndef SetEnvVar(env_var, value):\n  \"\"\"Sets an environment variable to a given value; unsets it when the\n  given value is None.\n  \"\"\"\n\n  env_var = env_var.upper()\n  if value is not None:\n    os.environ[env_var] = value\n  elif env_var in os.environ:\n    del os.environ[env_var]\n\n\ndef Run(command):\n  \"\"\"Runs a command; returns True/False if its exit code is/isn't 0.\"\"\"\n\n  print 'Running \"%s\". . .' % ' '.join(command)\n  p = gtest_test_utils.Subprocess(command)\n  return p.exited and p.exit_code == 0\n\n\n# The tests.  TODO(wan@google.com): refactor the class to share common\n# logic with code in gtest_break_on_failure_unittest.py.\nclass ThrowOnFailureTest(gtest_test_utils.TestCase):\n  \"\"\"Tests the throw-on-failure mode.\"\"\"\n\n  def RunAndVerify(self, env_var_value, flag_value, should_fail):\n    \"\"\"Runs gtest_throw_on_failure_test_ and verifies that it does\n    (or does not) exit with a non-zero code.\n\n    Args:\n      env_var_value:    value of the GTEST_BREAK_ON_FAILURE environment\n                        variable; None if the variable should be unset.\n      flag_value:       value of the --gtest_break_on_failure flag;\n                        None if the flag should not be present.\n      should_fail:      True iff the program is expected to fail.\n    \"\"\"\n\n    SetEnvVar(THROW_ON_FAILURE, env_var_value)\n\n    if env_var_value is None:\n      env_var_value_msg = ' is not set'\n    else:\n      env_var_value_msg = '=' + env_var_value\n\n    if flag_value is None:\n      flag = ''\n    elif flag_value == '0':\n      flag = '--%s=0' % THROW_ON_FAILURE\n    else:\n      flag = '--%s' % THROW_ON_FAILURE\n\n    command = [EXE_PATH]\n    if flag:\n      command.append(flag)\n\n    if should_fail:\n      should_or_not = 'should'\n    else:\n      should_or_not = 'should not'\n\n    failed = not Run(command)\n\n    SetEnvVar(THROW_ON_FAILURE, None)\n\n    msg = ('when %s%s, an assertion failure in \"%s\" %s cause a non-zero '\n           'exit code.' %\n           (THROW_ON_FAILURE, env_var_value_msg, ' '.join(command),\n            should_or_not))\n    self.assert_(failed == should_fail, msg)\n\n  def testDefaultBehavior(self):\n    \"\"\"Tests the behavior of the default mode.\"\"\"\n\n    self.RunAndVerify(env_var_value=None, flag_value=None, should_fail=False)\n\n  def testThrowOnFailureEnvVar(self):\n    \"\"\"Tests using the GTEST_THROW_ON_FAILURE environment variable.\"\"\"\n\n    self.RunAndVerify(env_var_value='0',\n                      flag_value=None,\n                      should_fail=False)\n    self.RunAndVerify(env_var_value='1',\n                      flag_value=None,\n                      should_fail=True)\n\n  def testThrowOnFailureFlag(self):\n    \"\"\"Tests using the --gtest_throw_on_failure flag.\"\"\"\n\n    self.RunAndVerify(env_var_value=None,\n                      flag_value='0',\n                      should_fail=False)\n    self.RunAndVerify(env_var_value=None,\n                      flag_value='1',\n                      should_fail=True)\n\n  def testThrowOnFailureFlagOverridesEnvVar(self):\n    \"\"\"Tests that --gtest_throw_on_failure overrides GTEST_THROW_ON_FAILURE.\"\"\"\n\n    self.RunAndVerify(env_var_value='0',\n                      flag_value='0',\n                      should_fail=False)\n    self.RunAndVerify(env_var_value='0',\n                      flag_value='1',\n                      should_fail=True)\n    self.RunAndVerify(env_var_value='1',\n                      flag_value='0',\n                      should_fail=False)\n    self.RunAndVerify(env_var_value='1',\n                      flag_value='1',\n                      should_fail=True)\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_throw_on_failure_test_.cc",
    "content": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n// Tests Google Test's throw-on-failure mode with exceptions disabled.\n//\n// This program must be compiled with exceptions disabled.  It will be\n// invoked by gtest_throw_on_failure_test.py, and is expected to exit\n// with non-zero in the throw-on-failure mode or 0 otherwise.\n\n#include \"gtest/gtest.h\"\n\n#include <stdio.h>                      // for fflush, fprintf, NULL, etc.\n#include <stdlib.h>                     // for exit\n#include <exception>                    // for set_terminate\n\n// This terminate handler aborts the program using exit() rather than abort().\n// This avoids showing pop-ups on Windows systems and core dumps on Unix-like\n// ones.\nvoid TerminateHandler() {\n  fprintf(stderr, \"%s\\n\", \"Unhandled C++ exception terminating the program.\");\n  fflush(NULL);\n  exit(1);\n}\n\nint main(int argc, char** argv) {\n#if GTEST_HAS_EXCEPTIONS\n  std::set_terminate(&TerminateHandler);\n#endif\n  testing::InitGoogleTest(&argc, argv);\n\n  // We want to ensure that people can use Google Test assertions in\n  // other testing frameworks, as long as they initialize Google Test\n  // properly and set the throw-on-failure mode.  Therefore, we don't\n  // use Google Test's constructs for defining and running tests\n  // (e.g. TEST and RUN_ALL_TESTS) here.\n\n  // In the throw-on-failure mode with exceptions disabled, this\n  // assertion will cause the program to exit with a non-zero code.\n  EXPECT_EQ(2, 3);\n\n  // When not in the throw-on-failure mode, the control will reach\n  // here.\n  return 0;\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_uninitialized_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Verifies that Google Test warns the user when not initialized properly.\"\"\"\n\n__author__ = 'wan@google.com (Zhanyong Wan)'\n\nimport gtest_test_utils\n\n\nCOMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_')\n\n\ndef Assert(condition):\n  if not condition:\n    raise AssertionError\n\n\ndef AssertEq(expected, actual):\n  if expected != actual:\n    print 'Expected: %s' % (expected,)\n    print '  Actual: %s' % (actual,)\n    raise AssertionError\n\n\ndef TestExitCodeAndOutput(command):\n  \"\"\"Runs the given command and verifies its exit code and output.\"\"\"\n\n  # Verifies that 'command' exits with code 1.\n  p = gtest_test_utils.Subprocess(command)\n  Assert(p.exited)\n  AssertEq(1, p.exit_code)\n  Assert('InitGoogleTest' in p.output)\n\n\nclass GTestUninitializedTest(gtest_test_utils.TestCase):\n  def testExitCodeAndOutput(self):\n    TestExitCodeAndOutput(COMMAND)\n\n\nif __name__ == '__main__':\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_uninitialized_test_.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n\n#include \"gtest/gtest.h\"\n\nTEST(DummyTest, Dummy) {\n  // This test doesn't verify anything.  We just need it to create a\n  // realistic stage for testing the behavior of Google Test when\n  // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being\n  // called first.\n}\n\nint main() {\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_unittest.cc",
    "content": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// Tests for Google Test itself.  This verifies that the basic constructs of\n// Google Test work.\n\n#include \"gtest/gtest.h\"\n\n// Verifies that the command line flag variables can be accessed\n// in code once <gtest/gtest.h> has been #included.\n// Do not move it after other #includes.\nTEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {\n  bool dummy = testing::GTEST_FLAG(also_run_disabled_tests)\n      || testing::GTEST_FLAG(break_on_failure)\n      || testing::GTEST_FLAG(catch_exceptions)\n      || testing::GTEST_FLAG(color) != \"unknown\"\n      || testing::GTEST_FLAG(filter) != \"unknown\"\n      || testing::GTEST_FLAG(list_tests)\n      || testing::GTEST_FLAG(output) != \"unknown\"\n      || testing::GTEST_FLAG(print_time)\n      || testing::GTEST_FLAG(random_seed)\n      || testing::GTEST_FLAG(repeat) > 0\n      || testing::GTEST_FLAG(show_internal_stack_frames)\n      || testing::GTEST_FLAG(shuffle)\n      || testing::GTEST_FLAG(stack_trace_depth) > 0\n      || testing::GTEST_FLAG(stream_result_to) != \"unknown\"\n      || testing::GTEST_FLAG(throw_on_failure);\n  EXPECT_TRUE(dummy || !dummy);  // Suppresses warning that dummy is unused.\n}\n\n#include <limits.h>  // For INT_MAX.\n#include <stdlib.h>\n#include <string.h>\n#include <time.h>\n\n#include <map>\n#include <vector>\n#include <ostream>\n\n#include \"gtest/gtest-spi.h\"\n\n// Indicates that this translation unit is part of Google Test's\n// implementation.  It must come before gtest-internal-inl.h is\n// included, or there will be a compiler error.  This trick is to\n// prevent a user from accidentally including gtest-internal-inl.h in\n// his code.\n#define GTEST_IMPLEMENTATION_ 1\n#include \"src/gtest-internal-inl.h\"\n#undef GTEST_IMPLEMENTATION_\n\nnamespace testing {\nnamespace internal {\n\n#if GTEST_CAN_STREAM_RESULTS_\n\nclass StreamingListenerTest : public Test {\n public:\n  class FakeSocketWriter : public StreamingListener::AbstractSocketWriter {\n   public:\n    // Sends a string to the socket.\n    virtual void Send(const string& message) { output_ += message; }\n\n    string output_;\n  };\n\n  StreamingListenerTest()\n      : fake_sock_writer_(new FakeSocketWriter),\n        streamer_(fake_sock_writer_),\n        test_info_obj_(\"FooTest\", \"Bar\", NULL, NULL, 0, NULL) {}\n\n protected:\n  string* output() { return &(fake_sock_writer_->output_); }\n\n  FakeSocketWriter* const fake_sock_writer_;\n  StreamingListener streamer_;\n  UnitTest unit_test_;\n  TestInfo test_info_obj_;  // The name test_info_ was taken by testing::Test.\n};\n\nTEST_F(StreamingListenerTest, OnTestProgramEnd) {\n  *output() = \"\";\n  streamer_.OnTestProgramEnd(unit_test_);\n  EXPECT_EQ(\"event=TestProgramEnd&passed=1\\n\", *output());\n}\n\nTEST_F(StreamingListenerTest, OnTestIterationEnd) {\n  *output() = \"\";\n  streamer_.OnTestIterationEnd(unit_test_, 42);\n  EXPECT_EQ(\"event=TestIterationEnd&passed=1&elapsed_time=0ms\\n\", *output());\n}\n\nTEST_F(StreamingListenerTest, OnTestCaseStart) {\n  *output() = \"\";\n  streamer_.OnTestCaseStart(TestCase(\"FooTest\", \"Bar\", NULL, NULL));\n  EXPECT_EQ(\"event=TestCaseStart&name=FooTest\\n\", *output());\n}\n\nTEST_F(StreamingListenerTest, OnTestCaseEnd) {\n  *output() = \"\";\n  streamer_.OnTestCaseEnd(TestCase(\"FooTest\", \"Bar\", NULL, NULL));\n  EXPECT_EQ(\"event=TestCaseEnd&passed=1&elapsed_time=0ms\\n\", *output());\n}\n\nTEST_F(StreamingListenerTest, OnTestStart) {\n  *output() = \"\";\n  streamer_.OnTestStart(test_info_obj_);\n  EXPECT_EQ(\"event=TestStart&name=Bar\\n\", *output());\n}\n\nTEST_F(StreamingListenerTest, OnTestEnd) {\n  *output() = \"\";\n  streamer_.OnTestEnd(test_info_obj_);\n  EXPECT_EQ(\"event=TestEnd&passed=1&elapsed_time=0ms\\n\", *output());\n}\n\nTEST_F(StreamingListenerTest, OnTestPartResult) {\n  *output() = \"\";\n  streamer_.OnTestPartResult(TestPartResult(\n      TestPartResult::kFatalFailure, \"foo.cc\", 42, \"failed=\\n&%\"));\n\n  // Meta characters in the failure message should be properly escaped.\n  EXPECT_EQ(\n      \"event=TestPartResult&file=foo.cc&line=42&message=failed%3D%0A%26%25\\n\",\n      *output());\n}\n\n#endif  // GTEST_CAN_STREAM_RESULTS_\n\n// Provides access to otherwise private parts of the TestEventListeners class\n// that are needed to test it.\nclass TestEventListenersAccessor {\n public:\n  static TestEventListener* GetRepeater(TestEventListeners* listeners) {\n    return listeners->repeater();\n  }\n\n  static void SetDefaultResultPrinter(TestEventListeners* listeners,\n                                      TestEventListener* listener) {\n    listeners->SetDefaultResultPrinter(listener);\n  }\n  static void SetDefaultXmlGenerator(TestEventListeners* listeners,\n                                     TestEventListener* listener) {\n    listeners->SetDefaultXmlGenerator(listener);\n  }\n\n  static bool EventForwardingEnabled(const TestEventListeners& listeners) {\n    return listeners.EventForwardingEnabled();\n  }\n\n  static void SuppressEventForwarding(TestEventListeners* listeners) {\n    listeners->SuppressEventForwarding();\n  }\n};\n\nclass UnitTestRecordPropertyTestHelper : public Test {\n protected:\n  UnitTestRecordPropertyTestHelper() {}\n\n  // Forwards to UnitTest::RecordProperty() to bypass access controls.\n  void UnitTestRecordProperty(const char* key, const std::string& value) {\n    unit_test_.RecordProperty(key, value);\n  }\n\n  UnitTest unit_test_;\n};\n\n}  // namespace internal\n}  // namespace testing\n\nusing testing::AssertionFailure;\nusing testing::AssertionResult;\nusing testing::AssertionSuccess;\nusing testing::DoubleLE;\nusing testing::EmptyTestEventListener;\nusing testing::Environment;\nusing testing::FloatLE;\nusing testing::GTEST_FLAG(also_run_disabled_tests);\nusing testing::GTEST_FLAG(break_on_failure);\nusing testing::GTEST_FLAG(catch_exceptions);\nusing testing::GTEST_FLAG(color);\nusing testing::GTEST_FLAG(death_test_use_fork);\nusing testing::GTEST_FLAG(filter);\nusing testing::GTEST_FLAG(list_tests);\nusing testing::GTEST_FLAG(output);\nusing testing::GTEST_FLAG(print_time);\nusing testing::GTEST_FLAG(random_seed);\nusing testing::GTEST_FLAG(repeat);\nusing testing::GTEST_FLAG(show_internal_stack_frames);\nusing testing::GTEST_FLAG(shuffle);\nusing testing::GTEST_FLAG(stack_trace_depth);\nusing testing::GTEST_FLAG(stream_result_to);\nusing testing::GTEST_FLAG(throw_on_failure);\nusing testing::IsNotSubstring;\nusing testing::IsSubstring;\nusing testing::Message;\nusing testing::ScopedFakeTestPartResultReporter;\nusing testing::StaticAssertTypeEq;\nusing testing::Test;\nusing testing::TestCase;\nusing testing::TestEventListeners;\nusing testing::TestInfo;\nusing testing::TestPartResult;\nusing testing::TestPartResultArray;\nusing testing::TestProperty;\nusing testing::TestResult;\nusing testing::TimeInMillis;\nusing testing::UnitTest;\nusing testing::kMaxStackTraceDepth;\nusing testing::internal::AddReference;\nusing testing::internal::AlwaysFalse;\nusing testing::internal::AlwaysTrue;\nusing testing::internal::AppendUserMessage;\nusing testing::internal::ArrayAwareFind;\nusing testing::internal::ArrayEq;\nusing testing::internal::CodePointToUtf8;\nusing testing::internal::CompileAssertTypesEqual;\nusing testing::internal::CopyArray;\nusing testing::internal::CountIf;\nusing testing::internal::EqFailure;\nusing testing::internal::FloatingPoint;\nusing testing::internal::ForEach;\nusing testing::internal::FormatEpochTimeInMillisAsIso8601;\nusing testing::internal::FormatTimeInMillisAsSeconds;\nusing testing::internal::GTestFlagSaver;\nusing testing::internal::GetCurrentOsStackTraceExceptTop;\nusing testing::internal::GetElementOr;\nusing testing::internal::GetNextRandomSeed;\nusing testing::internal::GetRandomSeedFromFlag;\nusing testing::internal::GetTestTypeId;\nusing testing::internal::GetTimeInMillis;\nusing testing::internal::GetTypeId;\nusing testing::internal::GetUnitTestImpl;\nusing testing::internal::ImplicitlyConvertible;\nusing testing::internal::Int32;\nusing testing::internal::Int32FromEnvOrDie;\nusing testing::internal::IsAProtocolMessage;\nusing testing::internal::IsContainer;\nusing testing::internal::IsContainerTest;\nusing testing::internal::IsNotContainer;\nusing testing::internal::NativeArray;\nusing testing::internal::ParseInt32Flag;\nusing testing::internal::RemoveConst;\nusing testing::internal::RemoveReference;\nusing testing::internal::ShouldRunTestOnShard;\nusing testing::internal::ShouldShard;\nusing testing::internal::ShouldUseColor;\nusing testing::internal::Shuffle;\nusing testing::internal::ShuffleRange;\nusing testing::internal::SkipPrefix;\nusing testing::internal::StreamableToString;\nusing testing::internal::String;\nusing testing::internal::TestEventListenersAccessor;\nusing testing::internal::TestResultAccessor;\nusing testing::internal::UInt32;\nusing testing::internal::WideStringToUtf8;\nusing testing::internal::kCopy;\nusing testing::internal::kMaxRandomSeed;\nusing testing::internal::kReference;\nusing testing::internal::kTestTypeIdInGoogleTest;\nusing testing::internal::scoped_ptr;\n\n#if GTEST_HAS_STREAM_REDIRECTION\nusing testing::internal::CaptureStdout;\nusing testing::internal::GetCapturedStdout;\n#endif\n\n#if GTEST_IS_THREADSAFE\nusing testing::internal::ThreadWithParam;\n#endif\n\nclass TestingVector : public std::vector<int> {\n};\n\n::std::ostream& operator<<(::std::ostream& os,\n                           const TestingVector& vector) {\n  os << \"{ \";\n  for (size_t i = 0; i < vector.size(); i++) {\n    os << vector[i] << \" \";\n  }\n  os << \"}\";\n  return os;\n}\n\n// This line tests that we can define tests in an unnamed namespace.\nnamespace {\n\nTEST(GetRandomSeedFromFlagTest, HandlesZero) {\n  const int seed = GetRandomSeedFromFlag(0);\n  EXPECT_LE(1, seed);\n  EXPECT_LE(seed, static_cast<int>(kMaxRandomSeed));\n}\n\nTEST(GetRandomSeedFromFlagTest, PreservesValidSeed) {\n  EXPECT_EQ(1, GetRandomSeedFromFlag(1));\n  EXPECT_EQ(2, GetRandomSeedFromFlag(2));\n  EXPECT_EQ(kMaxRandomSeed - 1, GetRandomSeedFromFlag(kMaxRandomSeed - 1));\n  EXPECT_EQ(static_cast<int>(kMaxRandomSeed),\n            GetRandomSeedFromFlag(kMaxRandomSeed));\n}\n\nTEST(GetRandomSeedFromFlagTest, NormalizesInvalidSeed) {\n  const int seed1 = GetRandomSeedFromFlag(-1);\n  EXPECT_LE(1, seed1);\n  EXPECT_LE(seed1, static_cast<int>(kMaxRandomSeed));\n\n  const int seed2 = GetRandomSeedFromFlag(kMaxRandomSeed + 1);\n  EXPECT_LE(1, seed2);\n  EXPECT_LE(seed2, static_cast<int>(kMaxRandomSeed));\n}\n\nTEST(GetNextRandomSeedTest, WorksForValidInput) {\n  EXPECT_EQ(2, GetNextRandomSeed(1));\n  EXPECT_EQ(3, GetNextRandomSeed(2));\n  EXPECT_EQ(static_cast<int>(kMaxRandomSeed),\n            GetNextRandomSeed(kMaxRandomSeed - 1));\n  EXPECT_EQ(1, GetNextRandomSeed(kMaxRandomSeed));\n\n  // We deliberately don't test GetNextRandomSeed() with invalid\n  // inputs, as that requires death tests, which are expensive.  This\n  // is fine as GetNextRandomSeed() is internal and has a\n  // straightforward definition.\n}\n\nstatic void ClearCurrentTestPartResults() {\n  TestResultAccessor::ClearTestPartResults(\n      GetUnitTestImpl()->current_test_result());\n}\n\n// Tests GetTypeId.\n\nTEST(GetTypeIdTest, ReturnsSameValueForSameType) {\n  EXPECT_EQ(GetTypeId<int>(), GetTypeId<int>());\n  EXPECT_EQ(GetTypeId<Test>(), GetTypeId<Test>());\n}\n\nclass SubClassOfTest : public Test {};\nclass AnotherSubClassOfTest : public Test {};\n\nTEST(GetTypeIdTest, ReturnsDifferentValuesForDifferentTypes) {\n  EXPECT_NE(GetTypeId<int>(), GetTypeId<const int>());\n  EXPECT_NE(GetTypeId<int>(), GetTypeId<char>());\n  EXPECT_NE(GetTypeId<int>(), GetTestTypeId());\n  EXPECT_NE(GetTypeId<SubClassOfTest>(), GetTestTypeId());\n  EXPECT_NE(GetTypeId<AnotherSubClassOfTest>(), GetTestTypeId());\n  EXPECT_NE(GetTypeId<AnotherSubClassOfTest>(), GetTypeId<SubClassOfTest>());\n}\n\n// Verifies that GetTestTypeId() returns the same value, no matter it\n// is called from inside Google Test or outside of it.\nTEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) {\n  EXPECT_EQ(kTestTypeIdInGoogleTest, GetTestTypeId());\n}\n\n// Tests FormatTimeInMillisAsSeconds().\n\nTEST(FormatTimeInMillisAsSecondsTest, FormatsZero) {\n  EXPECT_EQ(\"0\", FormatTimeInMillisAsSeconds(0));\n}\n\nTEST(FormatTimeInMillisAsSecondsTest, FormatsPositiveNumber) {\n  EXPECT_EQ(\"0.003\", FormatTimeInMillisAsSeconds(3));\n  EXPECT_EQ(\"0.01\", FormatTimeInMillisAsSeconds(10));\n  EXPECT_EQ(\"0.2\", FormatTimeInMillisAsSeconds(200));\n  EXPECT_EQ(\"1.2\", FormatTimeInMillisAsSeconds(1200));\n  EXPECT_EQ(\"3\", FormatTimeInMillisAsSeconds(3000));\n}\n\nTEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {\n  EXPECT_EQ(\"-0.003\", FormatTimeInMillisAsSeconds(-3));\n  EXPECT_EQ(\"-0.01\", FormatTimeInMillisAsSeconds(-10));\n  EXPECT_EQ(\"-0.2\", FormatTimeInMillisAsSeconds(-200));\n  EXPECT_EQ(\"-1.2\", FormatTimeInMillisAsSeconds(-1200));\n  EXPECT_EQ(\"-3\", FormatTimeInMillisAsSeconds(-3000));\n}\n\n// Tests FormatEpochTimeInMillisAsIso8601().  The correctness of conversion\n// for particular dates below was verified in Python using\n// datetime.datetime.fromutctimestamp(<timetamp>/1000).\n\n// FormatEpochTimeInMillisAsIso8601 depends on the current timezone, so we\n// have to set up a particular timezone to obtain predictable results.\nclass FormatEpochTimeInMillisAsIso8601Test : public Test {\n public:\n  // On Cygwin, GCC doesn't allow unqualified integer literals to exceed\n  // 32 bits, even when 64-bit integer types are available.  We have to\n  // force the constants to have a 64-bit type here.\n  static const TimeInMillis kMillisPerSec = 1000;\n\n private:\n  virtual void SetUp() {\n    saved_tz_ = NULL;\n#if _MSC_VER\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4996)  // Temporarily disables warning 4996\n                                // (function or variable may be unsafe\n                                // for getenv, function is deprecated for\n                                // strdup).\n    if (getenv(\"TZ\"))\n      saved_tz_ = strdup(getenv(\"TZ\"));\n# pragma warning(pop)           // Restores the warning state again.\n#else\n    if (getenv(\"TZ\"))\n      saved_tz_ = strdup(getenv(\"TZ\"));\n#endif\n\n    // Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use.  We\n    // cannot use the local time zone because the function's output depends\n    // on the time zone.\n    SetTimeZone(\"UTC+00\");\n  }\n\n  virtual void TearDown() {\n    SetTimeZone(saved_tz_);\n    free(const_cast<char*>(saved_tz_));\n    saved_tz_ = NULL;\n  }\n\n  static void SetTimeZone(const char* time_zone) {\n    // tzset() distinguishes between the TZ variable being present and empty\n    // and not being present, so we have to consider the case of time_zone\n    // being NULL.\n#if _MSC_VER\n    // ...Unless it's MSVC, whose standard library's _putenv doesn't\n    // distinguish between an empty and a missing variable.\n    const std::string env_var =\n        std::string(\"TZ=\") + (time_zone ? time_zone : \"\");\n    _putenv(env_var.c_str());\n# pragma warning(push)          // Saves the current warning state.\n# pragma warning(disable:4996)  // Temporarily disables warning 4996\n                                // (function is deprecated).\n    tzset();\n# pragma warning(pop)           // Restores the warning state again.\n#else\n    if (time_zone) {\n      setenv((\"TZ\"), time_zone, 1);\n    } else {\n      unsetenv(\"TZ\");\n    }\n    tzset();\n#endif\n  }\n\n  const char* saved_tz_;\n};\n\nconst TimeInMillis FormatEpochTimeInMillisAsIso8601Test::kMillisPerSec;\n\nTEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsTwoDigitSegments) {\n  EXPECT_EQ(\"2011-10-31T18:52:42\",\n            FormatEpochTimeInMillisAsIso8601(1320087162 * kMillisPerSec));\n}\n\nTEST_F(FormatEpochTimeInMillisAsIso8601Test, MillisecondsDoNotAffectResult) {\n  EXPECT_EQ(\n      \"2011-10-31T18:52:42\",\n      FormatEpochTimeInMillisAsIso8601(1320087162 * kMillisPerSec + 234));\n}\n\nTEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsLeadingZeroes) {\n  EXPECT_EQ(\"2011-09-03T05:07:02\",\n            FormatEpochTimeInMillisAsIso8601(1315026422 * kMillisPerSec));\n}\n\nTEST_F(FormatEpochTimeInMillisAsIso8601Test, Prints24HourTime) {\n  EXPECT_EQ(\"2011-09-28T17:08:22\",\n            FormatEpochTimeInMillisAsIso8601(1317229702 * kMillisPerSec));\n}\n\nTEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) {\n  EXPECT_EQ(\"1970-01-01T00:00:00\", FormatEpochTimeInMillisAsIso8601(0));\n}\n\n#if GTEST_CAN_COMPARE_NULL\n\n# ifdef __BORLANDC__\n// Silences warnings: \"Condition is always true\", \"Unreachable code\"\n#  pragma option push -w-ccc -w-rch\n# endif\n\n// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null\n// pointer literal.\nTEST(NullLiteralTest, IsTrueForNullLiterals) {\n  EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(NULL));\n  EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));\n  EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));\n  EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));\n}\n\n// Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null\n// pointer literal.\nTEST(NullLiteralTest, IsFalseForNonNullLiterals) {\n  EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(1));\n  EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(0.0));\n  EXPECT_FALSE(GTEST_IS_NULL_LITERAL_('a'));\n  EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));\n}\n\n# ifdef __BORLANDC__\n// Restores warnings after previous \"#pragma option push\" suppressed them.\n#  pragma option pop\n# endif\n\n#endif  // GTEST_CAN_COMPARE_NULL\n//\n// Tests CodePointToUtf8().\n\n// Tests that the NUL character L'\\0' is encoded correctly.\nTEST(CodePointToUtf8Test, CanEncodeNul) {\n  EXPECT_EQ(\"\", CodePointToUtf8(L'\\0'));\n}\n\n// Tests that ASCII characters are encoded correctly.\nTEST(CodePointToUtf8Test, CanEncodeAscii) {\n  EXPECT_EQ(\"a\", CodePointToUtf8(L'a'));\n  EXPECT_EQ(\"Z\", CodePointToUtf8(L'Z'));\n  EXPECT_EQ(\"&\", CodePointToUtf8(L'&'));\n  EXPECT_EQ(\"\\x7F\", CodePointToUtf8(L'\\x7F'));\n}\n\n// Tests that Unicode code-points that have 8 to 11 bits are encoded\n// as 110xxxxx 10xxxxxx.\nTEST(CodePointToUtf8Test, CanEncode8To11Bits) {\n  // 000 1101 0011 => 110-00011 10-010011\n  EXPECT_EQ(\"\\xC3\\x93\", CodePointToUtf8(L'\\xD3'));\n\n  // 101 0111 0110 => 110-10101 10-110110\n  // Some compilers (e.g., GCC on MinGW) cannot handle non-ASCII codepoints\n  // in wide strings and wide chars. In order to accomodate them, we have to\n  // introduce such character constants as integers.\n  EXPECT_EQ(\"\\xD5\\xB6\",\n            CodePointToUtf8(static_cast<wchar_t>(0x576)));\n}\n\n// Tests that Unicode code-points that have 12 to 16 bits are encoded\n// as 1110xxxx 10xxxxxx 10xxxxxx.\nTEST(CodePointToUtf8Test, CanEncode12To16Bits) {\n  // 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011\n  EXPECT_EQ(\"\\xE0\\xA3\\x93\",\n            CodePointToUtf8(static_cast<wchar_t>(0x8D3)));\n\n  // 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101\n  EXPECT_EQ(\"\\xEC\\x9D\\x8D\",\n            CodePointToUtf8(static_cast<wchar_t>(0xC74D)));\n}\n\n#if !GTEST_WIDE_STRING_USES_UTF16_\n// Tests in this group require a wchar_t to hold > 16 bits, and thus\n// are skipped on Windows, Cygwin, and Symbian, where a wchar_t is\n// 16-bit wide. This code may not compile on those systems.\n\n// Tests that Unicode code-points that have 17 to 21 bits are encoded\n// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx.\nTEST(CodePointToUtf8Test, CanEncode17To21Bits) {\n  // 0 0001 0000 1000 1101 0011 => 11110-000 10-010000 10-100011 10-010011\n  EXPECT_EQ(\"\\xF0\\x90\\xA3\\x93\", CodePointToUtf8(L'\\x108D3'));\n\n  // 0 0001 0000 0100 0000 0000 => 11110-000 10-010000 10-010000 10-000000\n  EXPECT_EQ(\"\\xF0\\x90\\x90\\x80\", CodePointToUtf8(L'\\x10400'));\n\n  // 1 0000 1000 0110 0011 0100 => 11110-100 10-001000 10-011000 10-110100\n  EXPECT_EQ(\"\\xF4\\x88\\x98\\xB4\", CodePointToUtf8(L'\\x108634'));\n}\n\n// Tests that encoding an invalid code-point generates the expected result.\nTEST(CodePointToUtf8Test, CanEncodeInvalidCodePoint) {\n  EXPECT_EQ(\"(Invalid Unicode 0x1234ABCD)\", CodePointToUtf8(L'\\x1234ABCD'));\n}\n\n#endif  // !GTEST_WIDE_STRING_USES_UTF16_\n\n// Tests WideStringToUtf8().\n\n// Tests that the NUL character L'\\0' is encoded correctly.\nTEST(WideStringToUtf8Test, CanEncodeNul) {\n  EXPECT_STREQ(\"\", WideStringToUtf8(L\"\", 0).c_str());\n  EXPECT_STREQ(\"\", WideStringToUtf8(L\"\", -1).c_str());\n}\n\n// Tests that ASCII strings are encoded correctly.\nTEST(WideStringToUtf8Test, CanEncodeAscii) {\n  EXPECT_STREQ(\"a\", WideStringToUtf8(L\"a\", 1).c_str());\n  EXPECT_STREQ(\"ab\", WideStringToUtf8(L\"ab\", 2).c_str());\n  EXPECT_STREQ(\"a\", WideStringToUtf8(L\"a\", -1).c_str());\n  EXPECT_STREQ(\"ab\", WideStringToUtf8(L\"ab\", -1).c_str());\n}\n\n// Tests that Unicode code-points that have 8 to 11 bits are encoded\n// as 110xxxxx 10xxxxxx.\nTEST(WideStringToUtf8Test, CanEncode8To11Bits) {\n  // 000 1101 0011 => 110-00011 10-010011\n  EXPECT_STREQ(\"\\xC3\\x93\", WideStringToUtf8(L\"\\xD3\", 1).c_str());\n  EXPECT_STREQ(\"\\xC3\\x93\", WideStringToUtf8(L\"\\xD3\", -1).c_str());\n\n  // 101 0111 0110 => 110-10101 10-110110\n  const wchar_t s[] = { 0x576, '\\0' };\n  EXPECT_STREQ(\"\\xD5\\xB6\", WideStringToUtf8(s, 1).c_str());\n  EXPECT_STREQ(\"\\xD5\\xB6\", WideStringToUtf8(s, -1).c_str());\n}\n\n// Tests that Unicode code-points that have 12 to 16 bits are encoded\n// as 1110xxxx 10xxxxxx 10xxxxxx.\nTEST(WideStringToUtf8Test, CanEncode12To16Bits) {\n  // 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011\n  const wchar_t s1[] = { 0x8D3, '\\0' };\n  EXPECT_STREQ(\"\\xE0\\xA3\\x93\", WideStringToUtf8(s1, 1).c_str());\n  EXPECT_STREQ(\"\\xE0\\xA3\\x93\", WideStringToUtf8(s1, -1).c_str());\n\n  // 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101\n  const wchar_t s2[] = { 0xC74D, '\\0' };\n  EXPECT_STREQ(\"\\xEC\\x9D\\x8D\", WideStringToUtf8(s2, 1).c_str());\n  EXPECT_STREQ(\"\\xEC\\x9D\\x8D\", WideStringToUtf8(s2, -1).c_str());\n}\n\n// Tests that the conversion stops when the function encounters \\0 character.\nTEST(WideStringToUtf8Test, StopsOnNulCharacter) {\n  EXPECT_STREQ(\"ABC\", WideStringToUtf8(L\"ABC\\0XYZ\", 100).c_str());\n}\n\n// Tests that the conversion stops when the function reaches the limit\n// specified by the 'length' parameter.\nTEST(WideStringToUtf8Test, StopsWhenLengthLimitReached) {\n  EXPECT_STREQ(\"ABC\", WideStringToUtf8(L\"ABCDEF\", 3).c_str());\n}\n\n#if !GTEST_WIDE_STRING_USES_UTF16_\n// Tests that Unicode code-points that have 17 to 21 bits are encoded\n// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. This code may not compile\n// on the systems using UTF-16 encoding.\nTEST(WideStringToUtf8Test, CanEncode17To21Bits) {\n  // 0 0001 0000 1000 1101 0011 => 11110-000 10-010000 10-100011 10-010011\n  EXPECT_STREQ(\"\\xF0\\x90\\xA3\\x93\", WideStringToUtf8(L\"\\x108D3\", 1).c_str());\n  EXPECT_STREQ(\"\\xF0\\x90\\xA3\\x93\", WideStringToUtf8(L\"\\x108D3\", -1).c_str());\n\n  // 1 0000 1000 0110 0011 0100 => 11110-100 10-001000 10-011000 10-110100\n  EXPECT_STREQ(\"\\xF4\\x88\\x98\\xB4\", WideStringToUtf8(L\"\\x108634\", 1).c_str());\n  EXPECT_STREQ(\"\\xF4\\x88\\x98\\xB4\", WideStringToUtf8(L\"\\x108634\", -1).c_str());\n}\n\n// Tests that encoding an invalid code-point generates the expected result.\nTEST(WideStringToUtf8Test, CanEncodeInvalidCodePoint) {\n  EXPECT_STREQ(\"(Invalid Unicode 0xABCDFF)\",\n               WideStringToUtf8(L\"\\xABCDFF\", -1).c_str());\n}\n#else  // !GTEST_WIDE_STRING_USES_UTF16_\n// Tests that surrogate pairs are encoded correctly on the systems using\n// UTF-16 encoding in the wide strings.\nTEST(WideStringToUtf8Test, CanEncodeValidUtf16SUrrogatePairs) {\n  const wchar_t s[] = { 0xD801, 0xDC00, '\\0' };\n  EXPECT_STREQ(\"\\xF0\\x90\\x90\\x80\", WideStringToUtf8(s, -1).c_str());\n}\n\n// Tests that encoding an invalid UTF-16 surrogate pair\n// generates the expected result.\nTEST(WideStringToUtf8Test, CanEncodeInvalidUtf16SurrogatePair) {\n  // Leading surrogate is at the end of the string.\n  const wchar_t s1[] = { 0xD800, '\\0' };\n  EXPECT_STREQ(\"\\xED\\xA0\\x80\", WideStringToUtf8(s1, -1).c_str());\n  // Leading surrogate is not followed by the trailing surrogate.\n  const wchar_t s2[] = { 0xD800, 'M', '\\0' };\n  EXPECT_STREQ(\"\\xED\\xA0\\x80M\", WideStringToUtf8(s2, -1).c_str());\n  // Trailing surrogate appearas without a leading surrogate.\n  const wchar_t s3[] = { 0xDC00, 'P', 'Q', 'R', '\\0' };\n  EXPECT_STREQ(\"\\xED\\xB0\\x80PQR\", WideStringToUtf8(s3, -1).c_str());\n}\n#endif  // !GTEST_WIDE_STRING_USES_UTF16_\n\n// Tests that codepoint concatenation works correctly.\n#if !GTEST_WIDE_STRING_USES_UTF16_\nTEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {\n  const wchar_t s[] = { 0x108634, 0xC74D, '\\n', 0x576, 0x8D3, 0x108634, '\\0'};\n  EXPECT_STREQ(\n      \"\\xF4\\x88\\x98\\xB4\"\n          \"\\xEC\\x9D\\x8D\"\n          \"\\n\"\n          \"\\xD5\\xB6\"\n          \"\\xE0\\xA3\\x93\"\n          \"\\xF4\\x88\\x98\\xB4\",\n      WideStringToUtf8(s, -1).c_str());\n}\n#else\nTEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {\n  const wchar_t s[] = { 0xC74D, '\\n', 0x576, 0x8D3, '\\0'};\n  EXPECT_STREQ(\n      \"\\xEC\\x9D\\x8D\" \"\\n\" \"\\xD5\\xB6\" \"\\xE0\\xA3\\x93\",\n      WideStringToUtf8(s, -1).c_str());\n}\n#endif  // !GTEST_WIDE_STRING_USES_UTF16_\n\n// Tests the Random class.\n\nTEST(RandomDeathTest, GeneratesCrashesOnInvalidRange) {\n  testing::internal::Random random(42);\n  EXPECT_DEATH_IF_SUPPORTED(\n      random.Generate(0),\n      \"Cannot generate a number in the range \\\\[0, 0\\\\)\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      random.Generate(testing::internal::Random::kMaxRange + 1),\n      \"Generation of a number in \\\\[0, 2147483649\\\\) was requested, \"\n      \"but this can only generate numbers in \\\\[0, 2147483648\\\\)\");\n}\n\nTEST(RandomTest, GeneratesNumbersWithinRange) {\n  const UInt32 kRange = 10000;\n  testing::internal::Random random(12345);\n  for (int i = 0; i < 10; i++) {\n    EXPECT_LT(random.Generate(kRange), kRange) << \" for iteration \" << i;\n  }\n\n  testing::internal::Random random2(testing::internal::Random::kMaxRange);\n  for (int i = 0; i < 10; i++) {\n    EXPECT_LT(random2.Generate(kRange), kRange) << \" for iteration \" << i;\n  }\n}\n\nTEST(RandomTest, RepeatsWhenReseeded) {\n  const int kSeed = 123;\n  const int kArraySize = 10;\n  const UInt32 kRange = 10000;\n  UInt32 values[kArraySize];\n\n  testing::internal::Random random(kSeed);\n  for (int i = 0; i < kArraySize; i++) {\n    values[i] = random.Generate(kRange);\n  }\n\n  random.Reseed(kSeed);\n  for (int i = 0; i < kArraySize; i++) {\n    EXPECT_EQ(values[i], random.Generate(kRange)) << \" for iteration \" << i;\n  }\n}\n\n// Tests STL container utilities.\n\n// Tests CountIf().\n\nstatic bool IsPositive(int n) { return n > 0; }\n\nTEST(ContainerUtilityTest, CountIf) {\n  std::vector<int> v;\n  EXPECT_EQ(0, CountIf(v, IsPositive));  // Works for an empty container.\n\n  v.push_back(-1);\n  v.push_back(0);\n  EXPECT_EQ(0, CountIf(v, IsPositive));  // Works when no value satisfies.\n\n  v.push_back(2);\n  v.push_back(-10);\n  v.push_back(10);\n  EXPECT_EQ(2, CountIf(v, IsPositive));\n}\n\n// Tests ForEach().\n\nstatic int g_sum = 0;\nstatic void Accumulate(int n) { g_sum += n; }\n\nTEST(ContainerUtilityTest, ForEach) {\n  std::vector<int> v;\n  g_sum = 0;\n  ForEach(v, Accumulate);\n  EXPECT_EQ(0, g_sum);  // Works for an empty container;\n\n  g_sum = 0;\n  v.push_back(1);\n  ForEach(v, Accumulate);\n  EXPECT_EQ(1, g_sum);  // Works for a container with one element.\n\n  g_sum = 0;\n  v.push_back(20);\n  v.push_back(300);\n  ForEach(v, Accumulate);\n  EXPECT_EQ(321, g_sum);\n}\n\n// Tests GetElementOr().\nTEST(ContainerUtilityTest, GetElementOr) {\n  std::vector<char> a;\n  EXPECT_EQ('x', GetElementOr(a, 0, 'x'));\n\n  a.push_back('a');\n  a.push_back('b');\n  EXPECT_EQ('a', GetElementOr(a, 0, 'x'));\n  EXPECT_EQ('b', GetElementOr(a, 1, 'x'));\n  EXPECT_EQ('x', GetElementOr(a, -2, 'x'));\n  EXPECT_EQ('x', GetElementOr(a, 2, 'x'));\n}\n\nTEST(ContainerUtilityDeathTest, ShuffleRange) {\n  std::vector<int> a;\n  a.push_back(0);\n  a.push_back(1);\n  a.push_back(2);\n  testing::internal::Random random(1);\n\n  EXPECT_DEATH_IF_SUPPORTED(\n      ShuffleRange(&random, -1, 1, &a),\n      \"Invalid shuffle range start -1: must be in range \\\\[0, 3\\\\]\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      ShuffleRange(&random, 4, 4, &a),\n      \"Invalid shuffle range start 4: must be in range \\\\[0, 3\\\\]\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      ShuffleRange(&random, 3, 2, &a),\n      \"Invalid shuffle range finish 2: must be in range \\\\[3, 3\\\\]\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      ShuffleRange(&random, 3, 4, &a),\n      \"Invalid shuffle range finish 4: must be in range \\\\[3, 3\\\\]\");\n}\n\nclass VectorShuffleTest : public Test {\n protected:\n  static const int kVectorSize = 20;\n\n  VectorShuffleTest() : random_(1) {\n    for (int i = 0; i < kVectorSize; i++) {\n      vector_.push_back(i);\n    }\n  }\n\n  static bool VectorIsCorrupt(const TestingVector& vector) {\n    if (kVectorSize != static_cast<int>(vector.size())) {\n      return true;\n    }\n\n    bool found_in_vector[kVectorSize] = { false };\n    for (size_t i = 0; i < vector.size(); i++) {\n      const int e = vector[i];\n      if (e < 0 || e >= kVectorSize || found_in_vector[e]) {\n        return true;\n      }\n      found_in_vector[e] = true;\n    }\n\n    // Vector size is correct, elements' range is correct, no\n    // duplicate elements.  Therefore no corruption has occurred.\n    return false;\n  }\n\n  static bool VectorIsNotCorrupt(const TestingVector& vector) {\n    return !VectorIsCorrupt(vector);\n  }\n\n  static bool RangeIsShuffled(const TestingVector& vector, int begin, int end) {\n    for (int i = begin; i < end; i++) {\n      if (i != vector[i]) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  static bool RangeIsUnshuffled(\n      const TestingVector& vector, int begin, int end) {\n    return !RangeIsShuffled(vector, begin, end);\n  }\n\n  static bool VectorIsShuffled(const TestingVector& vector) {\n    return RangeIsShuffled(vector, 0, static_cast<int>(vector.size()));\n  }\n\n  static bool VectorIsUnshuffled(const TestingVector& vector) {\n    return !VectorIsShuffled(vector);\n  }\n\n  testing::internal::Random random_;\n  TestingVector vector_;\n};  // class VectorShuffleTest\n\nconst int VectorShuffleTest::kVectorSize;\n\nTEST_F(VectorShuffleTest, HandlesEmptyRange) {\n  // Tests an empty range at the beginning...\n  ShuffleRange(&random_, 0, 0, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n\n  // ...in the middle...\n  ShuffleRange(&random_, kVectorSize/2, kVectorSize/2, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n\n  // ...at the end...\n  ShuffleRange(&random_, kVectorSize - 1, kVectorSize - 1, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n\n  // ...and past the end.\n  ShuffleRange(&random_, kVectorSize, kVectorSize, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n}\n\nTEST_F(VectorShuffleTest, HandlesRangeOfSizeOne) {\n  // Tests a size one range at the beginning...\n  ShuffleRange(&random_, 0, 1, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n\n  // ...in the middle...\n  ShuffleRange(&random_, kVectorSize/2, kVectorSize/2 + 1, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n\n  // ...and at the end.\n  ShuffleRange(&random_, kVectorSize - 1, kVectorSize, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsUnshuffled, vector_);\n}\n\n// Because we use our own random number generator and a fixed seed,\n// we can guarantee that the following \"random\" tests will succeed.\n\nTEST_F(VectorShuffleTest, ShufflesEntireVector) {\n  Shuffle(&random_, &vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  EXPECT_FALSE(VectorIsUnshuffled(vector_)) << vector_;\n\n  // Tests the first and last elements in particular to ensure that\n  // there are no off-by-one problems in our shuffle algorithm.\n  EXPECT_NE(0, vector_[0]);\n  EXPECT_NE(kVectorSize - 1, vector_[kVectorSize - 1]);\n}\n\nTEST_F(VectorShuffleTest, ShufflesStartOfVector) {\n  const int kRangeSize = kVectorSize/2;\n\n  ShuffleRange(&random_, 0, kRangeSize, &vector_);\n\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  EXPECT_PRED3(RangeIsShuffled, vector_, 0, kRangeSize);\n  EXPECT_PRED3(RangeIsUnshuffled, vector_, kRangeSize, kVectorSize);\n}\n\nTEST_F(VectorShuffleTest, ShufflesEndOfVector) {\n  const int kRangeSize = kVectorSize / 2;\n  ShuffleRange(&random_, kRangeSize, kVectorSize, &vector_);\n\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  EXPECT_PRED3(RangeIsUnshuffled, vector_, 0, kRangeSize);\n  EXPECT_PRED3(RangeIsShuffled, vector_, kRangeSize, kVectorSize);\n}\n\nTEST_F(VectorShuffleTest, ShufflesMiddleOfVector) {\n  int kRangeSize = kVectorSize/3;\n  ShuffleRange(&random_, kRangeSize, 2*kRangeSize, &vector_);\n\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  EXPECT_PRED3(RangeIsUnshuffled, vector_, 0, kRangeSize);\n  EXPECT_PRED3(RangeIsShuffled, vector_, kRangeSize, 2*kRangeSize);\n  EXPECT_PRED3(RangeIsUnshuffled, vector_, 2*kRangeSize, kVectorSize);\n}\n\nTEST_F(VectorShuffleTest, ShufflesRepeatably) {\n  TestingVector vector2;\n  for (int i = 0; i < kVectorSize; i++) {\n    vector2.push_back(i);\n  }\n\n  random_.Reseed(1234);\n  Shuffle(&random_, &vector_);\n  random_.Reseed(1234);\n  Shuffle(&random_, &vector2);\n\n  ASSERT_PRED1(VectorIsNotCorrupt, vector_);\n  ASSERT_PRED1(VectorIsNotCorrupt, vector2);\n\n  for (int i = 0; i < kVectorSize; i++) {\n    EXPECT_EQ(vector_[i], vector2[i]) << \" where i is \" << i;\n  }\n}\n\n// Tests the size of the AssertHelper class.\n\nTEST(AssertHelperTest, AssertHelperIsSmall) {\n  // To avoid breaking clients that use lots of assertions in one\n  // function, we cannot grow the size of AssertHelper.\n  EXPECT_LE(sizeof(testing::internal::AssertHelper), sizeof(void*));\n}\n\n// Tests String::EndsWithCaseInsensitive().\nTEST(StringTest, EndsWithCaseInsensitive) {\n  EXPECT_TRUE(String::EndsWithCaseInsensitive(\"foobar\", \"BAR\"));\n  EXPECT_TRUE(String::EndsWithCaseInsensitive(\"foobaR\", \"bar\"));\n  EXPECT_TRUE(String::EndsWithCaseInsensitive(\"foobar\", \"\"));\n  EXPECT_TRUE(String::EndsWithCaseInsensitive(\"\", \"\"));\n\n  EXPECT_FALSE(String::EndsWithCaseInsensitive(\"Foobar\", \"foo\"));\n  EXPECT_FALSE(String::EndsWithCaseInsensitive(\"foobar\", \"Foo\"));\n  EXPECT_FALSE(String::EndsWithCaseInsensitive(\"\", \"foo\"));\n}\n\n// C++Builder's preprocessor is buggy; it fails to expand macros that\n// appear in macro parameters after wide char literals.  Provide an alias\n// for NULL as a workaround.\nstatic const wchar_t* const kNull = NULL;\n\n// Tests String::CaseInsensitiveWideCStringEquals\nTEST(StringTest, CaseInsensitiveWideCStringEquals) {\n  EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(NULL, NULL));\n  EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(kNull, L\"\"));\n  EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(L\"\", kNull));\n  EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(kNull, L\"foobar\"));\n  EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(L\"foobar\", kNull));\n  EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L\"foobar\", L\"foobar\"));\n  EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L\"foobar\", L\"FOOBAR\"));\n  EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L\"FOOBAR\", L\"foobar\"));\n}\n\n#if GTEST_OS_WINDOWS\n\n// Tests String::ShowWideCString().\nTEST(StringTest, ShowWideCString) {\n  EXPECT_STREQ(\"(null)\",\n               String::ShowWideCString(NULL).c_str());\n  EXPECT_STREQ(\"\", String::ShowWideCString(L\"\").c_str());\n  EXPECT_STREQ(\"foo\", String::ShowWideCString(L\"foo\").c_str());\n}\n\n# if GTEST_OS_WINDOWS_MOBILE\nTEST(StringTest, AnsiAndUtf16Null) {\n  EXPECT_EQ(NULL, String::AnsiToUtf16(NULL));\n  EXPECT_EQ(NULL, String::Utf16ToAnsi(NULL));\n}\n\nTEST(StringTest, AnsiAndUtf16ConvertBasic) {\n  const char* ansi = String::Utf16ToAnsi(L\"str\");\n  EXPECT_STREQ(\"str\", ansi);\n  delete [] ansi;\n  const WCHAR* utf16 = String::AnsiToUtf16(\"str\");\n  EXPECT_EQ(0, wcsncmp(L\"str\", utf16, 3));\n  delete [] utf16;\n}\n\nTEST(StringTest, AnsiAndUtf16ConvertPathChars) {\n  const char* ansi = String::Utf16ToAnsi(L\".:\\\\ \\\"*?\");\n  EXPECT_STREQ(\".:\\\\ \\\"*?\", ansi);\n  delete [] ansi;\n  const WCHAR* utf16 = String::AnsiToUtf16(\".:\\\\ \\\"*?\");\n  EXPECT_EQ(0, wcsncmp(L\".:\\\\ \\\"*?\", utf16, 3));\n  delete [] utf16;\n}\n# endif  // GTEST_OS_WINDOWS_MOBILE\n\n#endif  // GTEST_OS_WINDOWS\n\n// Tests TestProperty construction.\nTEST(TestPropertyTest, StringValue) {\n  TestProperty property(\"key\", \"1\");\n  EXPECT_STREQ(\"key\", property.key());\n  EXPECT_STREQ(\"1\", property.value());\n}\n\n// Tests TestProperty replacing a value.\nTEST(TestPropertyTest, ReplaceStringValue) {\n  TestProperty property(\"key\", \"1\");\n  EXPECT_STREQ(\"1\", property.value());\n  property.SetValue(\"2\");\n  EXPECT_STREQ(\"2\", property.value());\n}\n\n// AddFatalFailure() and AddNonfatalFailure() must be stand-alone\n// functions (i.e. their definitions cannot be inlined at the call\n// sites), or C++Builder won't compile the code.\nstatic void AddFatalFailure() {\n  FAIL() << \"Expected fatal failure.\";\n}\n\nstatic void AddNonfatalFailure() {\n  ADD_FAILURE() << \"Expected non-fatal failure.\";\n}\n\nclass ScopedFakeTestPartResultReporterTest : public Test {\n public:  // Must be public and not protected due to a bug in g++ 3.4.2.\n  enum FailureMode {\n    FATAL_FAILURE,\n    NONFATAL_FAILURE\n  };\n  static void AddFailure(FailureMode failure) {\n    if (failure == FATAL_FAILURE) {\n      AddFatalFailure();\n    } else {\n      AddNonfatalFailure();\n    }\n  }\n};\n\n// Tests that ScopedFakeTestPartResultReporter intercepts test\n// failures.\nTEST_F(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {\n  TestPartResultArray results;\n  {\n    ScopedFakeTestPartResultReporter reporter(\n        ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,\n        &results);\n    AddFailure(NONFATAL_FAILURE);\n    AddFailure(FATAL_FAILURE);\n  }\n\n  EXPECT_EQ(2, results.size());\n  EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());\n  EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());\n}\n\nTEST_F(ScopedFakeTestPartResultReporterTest, DeprecatedConstructor) {\n  TestPartResultArray results;\n  {\n    // Tests, that the deprecated constructor still works.\n    ScopedFakeTestPartResultReporter reporter(&results);\n    AddFailure(NONFATAL_FAILURE);\n  }\n  EXPECT_EQ(1, results.size());\n}\n\n#if GTEST_IS_THREADSAFE\n\nclass ScopedFakeTestPartResultReporterWithThreadsTest\n  : public ScopedFakeTestPartResultReporterTest {\n protected:\n  static void AddFailureInOtherThread(FailureMode failure) {\n    ThreadWithParam<FailureMode> thread(&AddFailure, failure, NULL);\n    thread.Join();\n  }\n};\n\nTEST_F(ScopedFakeTestPartResultReporterWithThreadsTest,\n       InterceptsTestFailuresInAllThreads) {\n  TestPartResultArray results;\n  {\n    ScopedFakeTestPartResultReporter reporter(\n        ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, &results);\n    AddFailure(NONFATAL_FAILURE);\n    AddFailure(FATAL_FAILURE);\n    AddFailureInOtherThread(NONFATAL_FAILURE);\n    AddFailureInOtherThread(FATAL_FAILURE);\n  }\n\n  EXPECT_EQ(4, results.size());\n  EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());\n  EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());\n  EXPECT_TRUE(results.GetTestPartResult(2).nonfatally_failed());\n  EXPECT_TRUE(results.GetTestPartResult(3).fatally_failed());\n}\n\n#endif  // GTEST_IS_THREADSAFE\n\n// Tests EXPECT_FATAL_FAILURE{,ON_ALL_THREADS}.  Makes sure that they\n// work even if the failure is generated in a called function rather than\n// the current context.\n\ntypedef ScopedFakeTestPartResultReporterTest ExpectFatalFailureTest;\n\nTEST_F(ExpectFatalFailureTest, CatchesFatalFaliure) {\n  EXPECT_FATAL_FAILURE(AddFatalFailure(), \"Expected fatal failure.\");\n}\n\n#if GTEST_HAS_GLOBAL_STRING\nTEST_F(ExpectFatalFailureTest, AcceptsStringObject) {\n  EXPECT_FATAL_FAILURE(AddFatalFailure(), ::string(\"Expected fatal failure.\"));\n}\n#endif\n\nTEST_F(ExpectFatalFailureTest, AcceptsStdStringObject) {\n  EXPECT_FATAL_FAILURE(AddFatalFailure(),\n                       ::std::string(\"Expected fatal failure.\"));\n}\n\nTEST_F(ExpectFatalFailureTest, CatchesFatalFailureOnAllThreads) {\n  // We have another test below to verify that the macro catches fatal\n  // failures generated on another thread.\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFatalFailure(),\n                                      \"Expected fatal failure.\");\n}\n\n#ifdef __BORLANDC__\n// Silences warnings: \"Condition is always true\"\n# pragma option push -w-ccc\n#endif\n\n// Tests that EXPECT_FATAL_FAILURE() can be used in a non-void\n// function even when the statement in it contains ASSERT_*.\n\nint NonVoidFunction() {\n  EXPECT_FATAL_FAILURE(ASSERT_TRUE(false), \"\");\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(FAIL(), \"\");\n  return 0;\n}\n\nTEST_F(ExpectFatalFailureTest, CanBeUsedInNonVoidFunction) {\n  NonVoidFunction();\n}\n\n// Tests that EXPECT_FATAL_FAILURE(statement, ...) doesn't abort the\n// current function even though 'statement' generates a fatal failure.\n\nvoid DoesNotAbortHelper(bool* aborted) {\n  EXPECT_FATAL_FAILURE(ASSERT_TRUE(false), \"\");\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(FAIL(), \"\");\n\n  *aborted = false;\n}\n\n#ifdef __BORLANDC__\n// Restores warnings after previous \"#pragma option push\" suppressed them.\n# pragma option pop\n#endif\n\nTEST_F(ExpectFatalFailureTest, DoesNotAbort) {\n  bool aborted = true;\n  DoesNotAbortHelper(&aborted);\n  EXPECT_FALSE(aborted);\n}\n\n// Tests that the EXPECT_FATAL_FAILURE{,_ON_ALL_THREADS} accepts a\n// statement that contains a macro which expands to code containing an\n// unprotected comma.\n\nstatic int global_var = 0;\n#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++\n\nTEST_F(ExpectFatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {\n#ifndef __BORLANDC__\n  // ICE's in C++Builder.\n  EXPECT_FATAL_FAILURE({\n    GTEST_USE_UNPROTECTED_COMMA_;\n    AddFatalFailure();\n  }, \"\");\n#endif\n\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS({\n    GTEST_USE_UNPROTECTED_COMMA_;\n    AddFatalFailure();\n  }, \"\");\n}\n\n// Tests EXPECT_NONFATAL_FAILURE{,ON_ALL_THREADS}.\n\ntypedef ScopedFakeTestPartResultReporterTest ExpectNonfatalFailureTest;\n\nTEST_F(ExpectNonfatalFailureTest, CatchesNonfatalFailure) {\n  EXPECT_NONFATAL_FAILURE(AddNonfatalFailure(),\n                          \"Expected non-fatal failure.\");\n}\n\n#if GTEST_HAS_GLOBAL_STRING\nTEST_F(ExpectNonfatalFailureTest, AcceptsStringObject) {\n  EXPECT_NONFATAL_FAILURE(AddNonfatalFailure(),\n                          ::string(\"Expected non-fatal failure.\"));\n}\n#endif\n\nTEST_F(ExpectNonfatalFailureTest, AcceptsStdStringObject) {\n  EXPECT_NONFATAL_FAILURE(AddNonfatalFailure(),\n                          ::std::string(\"Expected non-fatal failure.\"));\n}\n\nTEST_F(ExpectNonfatalFailureTest, CatchesNonfatalFailureOnAllThreads) {\n  // We have another test below to verify that the macro catches\n  // non-fatal failures generated on another thread.\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddNonfatalFailure(),\n                                         \"Expected non-fatal failure.\");\n}\n\n// Tests that the EXPECT_NONFATAL_FAILURE{,_ON_ALL_THREADS} accepts a\n// statement that contains a macro which expands to code containing an\n// unprotected comma.\nTEST_F(ExpectNonfatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {\n  EXPECT_NONFATAL_FAILURE({\n    GTEST_USE_UNPROTECTED_COMMA_;\n    AddNonfatalFailure();\n  }, \"\");\n\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS({\n    GTEST_USE_UNPROTECTED_COMMA_;\n    AddNonfatalFailure();\n  }, \"\");\n}\n\n#if GTEST_IS_THREADSAFE\n\ntypedef ScopedFakeTestPartResultReporterWithThreadsTest\n    ExpectFailureWithThreadsTest;\n\nTEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailureOnAllThreads) {\n  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailureInOtherThread(FATAL_FAILURE),\n                                      \"Expected fatal failure.\");\n}\n\nTEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailureOnAllThreads) {\n  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(\n      AddFailureInOtherThread(NONFATAL_FAILURE), \"Expected non-fatal failure.\");\n}\n\n#endif  // GTEST_IS_THREADSAFE\n\n// Tests the TestProperty class.\n\nTEST(TestPropertyTest, ConstructorWorks) {\n  const TestProperty property(\"key\", \"value\");\n  EXPECT_STREQ(\"key\", property.key());\n  EXPECT_STREQ(\"value\", property.value());\n}\n\nTEST(TestPropertyTest, SetValue) {\n  TestProperty property(\"key\", \"value_1\");\n  EXPECT_STREQ(\"key\", property.key());\n  property.SetValue(\"value_2\");\n  EXPECT_STREQ(\"key\", property.key());\n  EXPECT_STREQ(\"value_2\", property.value());\n}\n\n// Tests the TestResult class\n\n// The test fixture for testing TestResult.\nclass TestResultTest : public Test {\n protected:\n  typedef std::vector<TestPartResult> TPRVector;\n\n  // We make use of 2 TestPartResult objects,\n  TestPartResult * pr1, * pr2;\n\n  // ... and 3 TestResult objects.\n  TestResult * r0, * r1, * r2;\n\n  virtual void SetUp() {\n    // pr1 is for success.\n    pr1 = new TestPartResult(TestPartResult::kSuccess,\n                             \"foo/bar.cc\",\n                             10,\n                             \"Success!\");\n\n    // pr2 is for fatal failure.\n    pr2 = new TestPartResult(TestPartResult::kFatalFailure,\n                             \"foo/bar.cc\",\n                             -1,  // This line number means \"unknown\"\n                             \"Failure!\");\n\n    // Creates the TestResult objects.\n    r0 = new TestResult();\n    r1 = new TestResult();\n    r2 = new TestResult();\n\n    // In order to test TestResult, we need to modify its internal\n    // state, in particular the TestPartResult vector it holds.\n    // test_part_results() returns a const reference to this vector.\n    // We cast it to a non-const object s.t. it can be modified (yes,\n    // this is a hack).\n    TPRVector* results1 = const_cast<TPRVector*>(\n        &TestResultAccessor::test_part_results(*r1));\n    TPRVector* results2 = const_cast<TPRVector*>(\n        &TestResultAccessor::test_part_results(*r2));\n\n    // r0 is an empty TestResult.\n\n    // r1 contains a single SUCCESS TestPartResult.\n    results1->push_back(*pr1);\n\n    // r2 contains a SUCCESS, and a FAILURE.\n    results2->push_back(*pr1);\n    results2->push_back(*pr2);\n  }\n\n  virtual void TearDown() {\n    delete pr1;\n    delete pr2;\n\n    delete r0;\n    delete r1;\n    delete r2;\n  }\n\n  // Helper that compares two two TestPartResults.\n  static void CompareTestPartResult(const TestPartResult& expected,\n                                    const TestPartResult& actual) {\n    EXPECT_EQ(expected.type(), actual.type());\n    EXPECT_STREQ(expected.file_name(), actual.file_name());\n    EXPECT_EQ(expected.line_number(), actual.line_number());\n    EXPECT_STREQ(expected.summary(), actual.summary());\n    EXPECT_STREQ(expected.message(), actual.message());\n    EXPECT_EQ(expected.passed(), actual.passed());\n    EXPECT_EQ(expected.failed(), actual.failed());\n    EXPECT_EQ(expected.nonfatally_failed(), actual.nonfatally_failed());\n    EXPECT_EQ(expected.fatally_failed(), actual.fatally_failed());\n  }\n};\n\n// Tests TestResult::total_part_count().\nTEST_F(TestResultTest, total_part_count) {\n  ASSERT_EQ(0, r0->total_part_count());\n  ASSERT_EQ(1, r1->total_part_count());\n  ASSERT_EQ(2, r2->total_part_count());\n}\n\n// Tests TestResult::Passed().\nTEST_F(TestResultTest, Passed) {\n  ASSERT_TRUE(r0->Passed());\n  ASSERT_TRUE(r1->Passed());\n  ASSERT_FALSE(r2->Passed());\n}\n\n// Tests TestResult::Failed().\nTEST_F(TestResultTest, Failed) {\n  ASSERT_FALSE(r0->Failed());\n  ASSERT_FALSE(r1->Failed());\n  ASSERT_TRUE(r2->Failed());\n}\n\n// Tests TestResult::GetTestPartResult().\n\ntypedef TestResultTest TestResultDeathTest;\n\nTEST_F(TestResultDeathTest, GetTestPartResult) {\n  CompareTestPartResult(*pr1, r2->GetTestPartResult(0));\n  CompareTestPartResult(*pr2, r2->GetTestPartResult(1));\n  EXPECT_DEATH_IF_SUPPORTED(r2->GetTestPartResult(2), \"\");\n  EXPECT_DEATH_IF_SUPPORTED(r2->GetTestPartResult(-1), \"\");\n}\n\n// Tests TestResult has no properties when none are added.\nTEST(TestResultPropertyTest, NoPropertiesFoundWhenNoneAreAdded) {\n  TestResult test_result;\n  ASSERT_EQ(0, test_result.test_property_count());\n}\n\n// Tests TestResult has the expected property when added.\nTEST(TestResultPropertyTest, OnePropertyFoundWhenAdded) {\n  TestResult test_result;\n  TestProperty property(\"key_1\", \"1\");\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property);\n  ASSERT_EQ(1, test_result.test_property_count());\n  const TestProperty& actual_property = test_result.GetTestProperty(0);\n  EXPECT_STREQ(\"key_1\", actual_property.key());\n  EXPECT_STREQ(\"1\", actual_property.value());\n}\n\n// Tests TestResult has multiple properties when added.\nTEST(TestResultPropertyTest, MultiplePropertiesFoundWhenAdded) {\n  TestResult test_result;\n  TestProperty property_1(\"key_1\", \"1\");\n  TestProperty property_2(\"key_2\", \"2\");\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_1);\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_2);\n  ASSERT_EQ(2, test_result.test_property_count());\n  const TestProperty& actual_property_1 = test_result.GetTestProperty(0);\n  EXPECT_STREQ(\"key_1\", actual_property_1.key());\n  EXPECT_STREQ(\"1\", actual_property_1.value());\n\n  const TestProperty& actual_property_2 = test_result.GetTestProperty(1);\n  EXPECT_STREQ(\"key_2\", actual_property_2.key());\n  EXPECT_STREQ(\"2\", actual_property_2.value());\n}\n\n// Tests TestResult::RecordProperty() overrides values for duplicate keys.\nTEST(TestResultPropertyTest, OverridesValuesForDuplicateKeys) {\n  TestResult test_result;\n  TestProperty property_1_1(\"key_1\", \"1\");\n  TestProperty property_2_1(\"key_2\", \"2\");\n  TestProperty property_1_2(\"key_1\", \"12\");\n  TestProperty property_2_2(\"key_2\", \"22\");\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_1_1);\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_2_1);\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_1_2);\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_2_2);\n\n  ASSERT_EQ(2, test_result.test_property_count());\n  const TestProperty& actual_property_1 = test_result.GetTestProperty(0);\n  EXPECT_STREQ(\"key_1\", actual_property_1.key());\n  EXPECT_STREQ(\"12\", actual_property_1.value());\n\n  const TestProperty& actual_property_2 = test_result.GetTestProperty(1);\n  EXPECT_STREQ(\"key_2\", actual_property_2.key());\n  EXPECT_STREQ(\"22\", actual_property_2.value());\n}\n\n// Tests TestResult::GetTestProperty().\nTEST(TestResultPropertyTest, GetTestProperty) {\n  TestResult test_result;\n  TestProperty property_1(\"key_1\", \"1\");\n  TestProperty property_2(\"key_2\", \"2\");\n  TestProperty property_3(\"key_3\", \"3\");\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_1);\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_2);\n  TestResultAccessor::RecordProperty(&test_result, \"testcase\", property_3);\n\n  const TestProperty& fetched_property_1 = test_result.GetTestProperty(0);\n  const TestProperty& fetched_property_2 = test_result.GetTestProperty(1);\n  const TestProperty& fetched_property_3 = test_result.GetTestProperty(2);\n\n  EXPECT_STREQ(\"key_1\", fetched_property_1.key());\n  EXPECT_STREQ(\"1\", fetched_property_1.value());\n\n  EXPECT_STREQ(\"key_2\", fetched_property_2.key());\n  EXPECT_STREQ(\"2\", fetched_property_2.value());\n\n  EXPECT_STREQ(\"key_3\", fetched_property_3.key());\n  EXPECT_STREQ(\"3\", fetched_property_3.value());\n\n  EXPECT_DEATH_IF_SUPPORTED(test_result.GetTestProperty(3), \"\");\n  EXPECT_DEATH_IF_SUPPORTED(test_result.GetTestProperty(-1), \"\");\n}\n\n// Tests that GTestFlagSaver works on Windows and Mac.\n\nclass GTestFlagSaverTest : public Test {\n protected:\n  // Saves the Google Test flags such that we can restore them later, and\n  // then sets them to their default values.  This will be called\n  // before the first test in this test case is run.\n  static void SetUpTestCase() {\n    saver_ = new GTestFlagSaver;\n\n    GTEST_FLAG(also_run_disabled_tests) = false;\n    GTEST_FLAG(break_on_failure) = false;\n    GTEST_FLAG(catch_exceptions) = false;\n    GTEST_FLAG(death_test_use_fork) = false;\n    GTEST_FLAG(color) = \"auto\";\n    GTEST_FLAG(filter) = \"\";\n    GTEST_FLAG(list_tests) = false;\n    GTEST_FLAG(output) = \"\";\n    GTEST_FLAG(print_time) = true;\n    GTEST_FLAG(random_seed) = 0;\n    GTEST_FLAG(repeat) = 1;\n    GTEST_FLAG(shuffle) = false;\n    GTEST_FLAG(stack_trace_depth) = kMaxStackTraceDepth;\n    GTEST_FLAG(stream_result_to) = \"\";\n    GTEST_FLAG(throw_on_failure) = false;\n  }\n\n  // Restores the Google Test flags that the tests have modified.  This will\n  // be called after the last test in this test case is run.\n  static void TearDownTestCase() {\n    delete saver_;\n    saver_ = NULL;\n  }\n\n  // Verifies that the Google Test flags have their default values, and then\n  // modifies each of them.\n  void VerifyAndModifyFlags() {\n    EXPECT_FALSE(GTEST_FLAG(also_run_disabled_tests));\n    EXPECT_FALSE(GTEST_FLAG(break_on_failure));\n    EXPECT_FALSE(GTEST_FLAG(catch_exceptions));\n    EXPECT_STREQ(\"auto\", GTEST_FLAG(color).c_str());\n    EXPECT_FALSE(GTEST_FLAG(death_test_use_fork));\n    EXPECT_STREQ(\"\", GTEST_FLAG(filter).c_str());\n    EXPECT_FALSE(GTEST_FLAG(list_tests));\n    EXPECT_STREQ(\"\", GTEST_FLAG(output).c_str());\n    EXPECT_TRUE(GTEST_FLAG(print_time));\n    EXPECT_EQ(0, GTEST_FLAG(random_seed));\n    EXPECT_EQ(1, GTEST_FLAG(repeat));\n    EXPECT_FALSE(GTEST_FLAG(shuffle));\n    EXPECT_EQ(kMaxStackTraceDepth, GTEST_FLAG(stack_trace_depth));\n    EXPECT_STREQ(\"\", GTEST_FLAG(stream_result_to).c_str());\n    EXPECT_FALSE(GTEST_FLAG(throw_on_failure));\n\n    GTEST_FLAG(also_run_disabled_tests) = true;\n    GTEST_FLAG(break_on_failure) = true;\n    GTEST_FLAG(catch_exceptions) = true;\n    GTEST_FLAG(color) = \"no\";\n    GTEST_FLAG(death_test_use_fork) = true;\n    GTEST_FLAG(filter) = \"abc\";\n    GTEST_FLAG(list_tests) = true;\n    GTEST_FLAG(output) = \"xml:foo.xml\";\n    GTEST_FLAG(print_time) = false;\n    GTEST_FLAG(random_seed) = 1;\n    GTEST_FLAG(repeat) = 100;\n    GTEST_FLAG(shuffle) = true;\n    GTEST_FLAG(stack_trace_depth) = 1;\n    GTEST_FLAG(stream_result_to) = \"localhost:1234\";\n    GTEST_FLAG(throw_on_failure) = true;\n  }\n\n private:\n  // For saving Google Test flags during this test case.\n  static GTestFlagSaver* saver_;\n};\n\nGTestFlagSaver* GTestFlagSaverTest::saver_ = NULL;\n\n// Google Test doesn't guarantee the order of tests.  The following two\n// tests are designed to work regardless of their order.\n\n// Modifies the Google Test flags in the test body.\nTEST_F(GTestFlagSaverTest, ModifyGTestFlags) {\n  VerifyAndModifyFlags();\n}\n\n// Verifies that the Google Test flags in the body of the previous test were\n// restored to their original values.\nTEST_F(GTestFlagSaverTest, VerifyGTestFlags) {\n  VerifyAndModifyFlags();\n}\n\n// Sets an environment variable with the given name to the given\n// value.  If the value argument is \"\", unsets the environment\n// variable.  The caller must ensure that both arguments are not NULL.\nstatic void SetEnv(const char* name, const char* value) {\n#if GTEST_OS_WINDOWS_MOBILE\n  // Environment variables are not supported on Windows CE.\n  return;\n#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)\n  // C++Builder's putenv only stores a pointer to its parameter; we have to\n  // ensure that the string remains valid as long as it might be needed.\n  // We use an std::map to do so.\n  static std::map<std::string, std::string*> added_env;\n\n  // Because putenv stores a pointer to the string buffer, we can't delete the\n  // previous string (if present) until after it's replaced.\n  std::string *prev_env = NULL;\n  if (added_env.find(name) != added_env.end()) {\n    prev_env = added_env[name];\n  }\n  added_env[name] = new std::string(\n      (Message() << name << \"=\" << value).GetString());\n\n  // The standard signature of putenv accepts a 'char*' argument. Other\n  // implementations, like C++Builder's, accept a 'const char*'.\n  // We cast away the 'const' since that would work for both variants.\n  putenv(const_cast<char*>(added_env[name]->c_str()));\n  delete prev_env;\n#elif GTEST_OS_WINDOWS  // If we are on Windows proper.\n  _putenv((Message() << name << \"=\" << value).GetString().c_str());\n#else\n  if (*value == '\\0') {\n    unsetenv(name);\n  } else {\n    setenv(name, value, 1);\n  }\n#endif  // GTEST_OS_WINDOWS_MOBILE\n}\n\n#if !GTEST_OS_WINDOWS_MOBILE\n// Environment variables are not supported on Windows CE.\n\nusing testing::internal::Int32FromGTestEnv;\n\n// Tests Int32FromGTestEnv().\n\n// Tests that Int32FromGTestEnv() returns the default value when the\n// environment variable is not set.\nTEST(Int32FromGTestEnvTest, ReturnsDefaultWhenVariableIsNotSet) {\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"\");\n  EXPECT_EQ(10, Int32FromGTestEnv(\"temp\", 10));\n}\n\n// Tests that Int32FromGTestEnv() returns the default value when the\n// environment variable overflows as an Int32.\nTEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueOverflows) {\n  printf(\"(expecting 2 warnings)\\n\");\n\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"12345678987654321\");\n  EXPECT_EQ(20, Int32FromGTestEnv(\"temp\", 20));\n\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"-12345678987654321\");\n  EXPECT_EQ(30, Int32FromGTestEnv(\"temp\", 30));\n}\n\n// Tests that Int32FromGTestEnv() returns the default value when the\n// environment variable does not represent a valid decimal integer.\nTEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueIsInvalid) {\n  printf(\"(expecting 2 warnings)\\n\");\n\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"A1\");\n  EXPECT_EQ(40, Int32FromGTestEnv(\"temp\", 40));\n\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"12X\");\n  EXPECT_EQ(50, Int32FromGTestEnv(\"temp\", 50));\n}\n\n// Tests that Int32FromGTestEnv() parses and returns the value of the\n// environment variable when it represents a valid decimal integer in\n// the range of an Int32.\nTEST(Int32FromGTestEnvTest, ParsesAndReturnsValidValue) {\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"123\");\n  EXPECT_EQ(123, Int32FromGTestEnv(\"temp\", 0));\n\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"TEMP\", \"-321\");\n  EXPECT_EQ(-321, Int32FromGTestEnv(\"temp\", 0));\n}\n#endif  // !GTEST_OS_WINDOWS_MOBILE\n\n// Tests ParseInt32Flag().\n\n// Tests that ParseInt32Flag() returns false and doesn't change the\n// output value when the flag has wrong format\nTEST(ParseInt32FlagTest, ReturnsFalseForInvalidFlag) {\n  Int32 value = 123;\n  EXPECT_FALSE(ParseInt32Flag(\"--a=100\", \"b\", &value));\n  EXPECT_EQ(123, value);\n\n  EXPECT_FALSE(ParseInt32Flag(\"a=100\", \"a\", &value));\n  EXPECT_EQ(123, value);\n}\n\n// Tests that ParseInt32Flag() returns false and doesn't change the\n// output value when the flag overflows as an Int32.\nTEST(ParseInt32FlagTest, ReturnsDefaultWhenValueOverflows) {\n  printf(\"(expecting 2 warnings)\\n\");\n\n  Int32 value = 123;\n  EXPECT_FALSE(ParseInt32Flag(\"--abc=12345678987654321\", \"abc\", &value));\n  EXPECT_EQ(123, value);\n\n  EXPECT_FALSE(ParseInt32Flag(\"--abc=-12345678987654321\", \"abc\", &value));\n  EXPECT_EQ(123, value);\n}\n\n// Tests that ParseInt32Flag() returns false and doesn't change the\n// output value when the flag does not represent a valid decimal\n// integer.\nTEST(ParseInt32FlagTest, ReturnsDefaultWhenValueIsInvalid) {\n  printf(\"(expecting 2 warnings)\\n\");\n\n  Int32 value = 123;\n  EXPECT_FALSE(ParseInt32Flag(\"--abc=A1\", \"abc\", &value));\n  EXPECT_EQ(123, value);\n\n  EXPECT_FALSE(ParseInt32Flag(\"--abc=12X\", \"abc\", &value));\n  EXPECT_EQ(123, value);\n}\n\n// Tests that ParseInt32Flag() parses the value of the flag and\n// returns true when the flag represents a valid decimal integer in\n// the range of an Int32.\nTEST(ParseInt32FlagTest, ParsesAndReturnsValidValue) {\n  Int32 value = 123;\n  EXPECT_TRUE(ParseInt32Flag(\"--\" GTEST_FLAG_PREFIX_ \"abc=456\", \"abc\", &value));\n  EXPECT_EQ(456, value);\n\n  EXPECT_TRUE(ParseInt32Flag(\"--\" GTEST_FLAG_PREFIX_ \"abc=-789\",\n                             \"abc\", &value));\n  EXPECT_EQ(-789, value);\n}\n\n// Tests that Int32FromEnvOrDie() parses the value of the var or\n// returns the correct default.\n// Environment variables are not supported on Windows CE.\n#if !GTEST_OS_WINDOWS_MOBILE\nTEST(Int32FromEnvOrDieTest, ParsesAndReturnsValidValue) {\n  EXPECT_EQ(333, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ \"UnsetVar\", 333));\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"UnsetVar\", \"123\");\n  EXPECT_EQ(123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ \"UnsetVar\", 333));\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"UnsetVar\", \"-123\");\n  EXPECT_EQ(-123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ \"UnsetVar\", 333));\n}\n#endif  // !GTEST_OS_WINDOWS_MOBILE\n\n// Tests that Int32FromEnvOrDie() aborts with an error message\n// if the variable is not an Int32.\nTEST(Int32FromEnvOrDieDeathTest, AbortsOnFailure) {\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"VAR\", \"xxx\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ \"VAR\", 123),\n      \".*\");\n}\n\n// Tests that Int32FromEnvOrDie() aborts with an error message\n// if the variable cannot be represnted by an Int32.\nTEST(Int32FromEnvOrDieDeathTest, AbortsOnInt32Overflow) {\n  SetEnv(GTEST_FLAG_PREFIX_UPPER_ \"VAR\", \"1234567891234567891234\");\n  EXPECT_DEATH_IF_SUPPORTED(\n      Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ \"VAR\", 123),\n      \".*\");\n}\n\n// Tests that ShouldRunTestOnShard() selects all tests\n// where there is 1 shard.\nTEST(ShouldRunTestOnShardTest, IsPartitionWhenThereIsOneShard) {\n  EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 0));\n  EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 1));\n  EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 2));\n  EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 3));\n  EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 4));\n}\n\nclass ShouldShardTest : public testing::Test {\n protected:\n  virtual void SetUp() {\n    index_var_ = GTEST_FLAG_PREFIX_UPPER_ \"INDEX\";\n    total_var_ = GTEST_FLAG_PREFIX_UPPER_ \"TOTAL\";\n  }\n\n  virtual void TearDown() {\n    SetEnv(index_var_, \"\");\n    SetEnv(total_var_, \"\");\n  }\n\n  const char* index_var_;\n  const char* total_var_;\n};\n\n// Tests that sharding is disabled if neither of the environment variables\n// are set.\nTEST_F(ShouldShardTest, ReturnsFalseWhenNeitherEnvVarIsSet) {\n  SetEnv(index_var_, \"\");\n  SetEnv(total_var_, \"\");\n\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, false));\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));\n}\n\n// Tests that sharding is not enabled if total_shards  == 1.\nTEST_F(ShouldShardTest, ReturnsFalseWhenTotalShardIsOne) {\n  SetEnv(index_var_, \"0\");\n  SetEnv(total_var_, \"1\");\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, false));\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));\n}\n\n// Tests that sharding is enabled if total_shards > 1 and\n// we are not in a death test subprocess.\n// Environment variables are not supported on Windows CE.\n#if !GTEST_OS_WINDOWS_MOBILE\nTEST_F(ShouldShardTest, WorksWhenShardEnvVarsAreValid) {\n  SetEnv(index_var_, \"4\");\n  SetEnv(total_var_, \"22\");\n  EXPECT_TRUE(ShouldShard(total_var_, index_var_, false));\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));\n\n  SetEnv(index_var_, \"8\");\n  SetEnv(total_var_, \"9\");\n  EXPECT_TRUE(ShouldShard(total_var_, index_var_, false));\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));\n\n  SetEnv(index_var_, \"0\");\n  SetEnv(total_var_, \"9\");\n  EXPECT_TRUE(ShouldShard(total_var_, index_var_, false));\n  EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));\n}\n#endif  // !GTEST_OS_WINDOWS_MOBILE\n\n// Tests that we exit in error if the sharding values are not valid.\n\ntypedef ShouldShardTest ShouldShardDeathTest;\n\nTEST_F(ShouldShardDeathTest, AbortsWhenShardingEnvVarsAreInvalid) {\n  SetEnv(index_var_, \"4\");\n  SetEnv(total_var_, \"4\");\n  EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), \".*\");\n\n  SetEnv(index_var_, \"4\");\n  SetEnv(total_var_, \"-2\");\n  EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), \".*\");\n\n  SetEnv(index_var_, \"5\");\n  SetEnv(total_var_, \"\");\n  EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), \".*\");\n\n  SetEnv(index_var_, \"\");\n  SetEnv(total_var_, \"5\");\n  EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), \".*\");\n}\n\n// Tests that ShouldRunTestOnShard is a partition when 5\n// shards are used.\nTEST(ShouldRunTestOnShardTest, IsPartitionWhenThereAreFiveShards) {\n  // Choose an arbitrary number of tests and shards.\n  const int num_tests = 17;\n  const int num_shards = 5;\n\n  // Check partitioning: each test should be on exactly 1 shard.\n  for (int test_id = 0; test_id < num_tests; test_id++) {\n    int prev_selected_shard_index = -1;\n    for (int shard_index = 0; shard_index < num_shards; shard_index++) {\n      if (ShouldRunTestOnShard(num_shards, shard_index, test_id)) {\n        if (prev_selected_shard_index < 0) {\n          prev_selected_shard_index = shard_index;\n        } else {\n          ADD_FAILURE() << \"Shard \" << prev_selected_shard_index << \" and \"\n            << shard_index << \" are both selected to run test \" << test_id;\n        }\n      }\n    }\n  }\n\n  // Check balance: This is not required by the sharding protocol, but is a\n  // desirable property for performance.\n  for (int shard_index = 0; shard_index < num_shards; shard_index++) {\n    int num_tests_on_shard = 0;\n    for (int test_id = 0; test_id < num_tests; test_id++) {\n      num_tests_on_shard +=\n        ShouldRunTestOnShard(num_shards, shard_index, test_id);\n    }\n    EXPECT_GE(num_tests_on_shard, num_tests / num_shards);\n  }\n}\n\n// For the same reason we are not explicitly testing everything in the\n// Test class, there are no separate tests for the following classes\n// (except for some trivial cases):\n//\n//   TestCase, UnitTest, UnitTestResultPrinter.\n//\n// Similarly, there are no separate tests for the following macros:\n//\n//   TEST, TEST_F, RUN_ALL_TESTS\n\nTEST(UnitTestTest, CanGetOriginalWorkingDir) {\n  ASSERT_TRUE(UnitTest::GetInstance()->original_working_dir() != NULL);\n  EXPECT_STRNE(UnitTest::GetInstance()->original_working_dir(), \"\");\n}\n\nTEST(UnitTestTest, ReturnsPlausibleTimestamp) {\n  EXPECT_LT(0, UnitTest::GetInstance()->start_timestamp());\n  EXPECT_LE(UnitTest::GetInstance()->start_timestamp(), GetTimeInMillis());\n}\n\n// When a property using a reserved key is supplied to this function, it\n// tests that a non-fatal failure is added, a fatal failure is not added,\n// and that the property is not recorded.\nvoid ExpectNonFatalFailureRecordingPropertyWithReservedKey(\n    const TestResult& test_result, const char* key) {\n  EXPECT_NONFATAL_FAILURE(Test::RecordProperty(key, \"1\"), \"Reserved key\");\n  ASSERT_EQ(0, test_result.test_property_count()) << \"Property for key '\" << key\n                                                  << \"' recorded unexpectedly.\";\n}\n\nvoid ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n    const char* key) {\n  const TestInfo* test_info = UnitTest::GetInstance()->current_test_info();\n  ASSERT_TRUE(test_info != NULL);\n  ExpectNonFatalFailureRecordingPropertyWithReservedKey(*test_info->result(),\n                                                        key);\n}\n\nvoid ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n    const char* key) {\n  const TestCase* test_case = UnitTest::GetInstance()->current_test_case();\n  ASSERT_TRUE(test_case != NULL);\n  ExpectNonFatalFailureRecordingPropertyWithReservedKey(\n      test_case->ad_hoc_test_result(), key);\n}\n\nvoid ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n    const char* key) {\n  ExpectNonFatalFailureRecordingPropertyWithReservedKey(\n      UnitTest::GetInstance()->ad_hoc_test_result(), key);\n}\n\n// Tests that property recording functions in UnitTest outside of tests\n// functions correcly.  Creating a separate instance of UnitTest ensures it\n// is in a state similar to the UnitTest's singleton's between tests.\nclass UnitTestRecordPropertyTest :\n    public testing::internal::UnitTestRecordPropertyTestHelper {\n public:\n  static void SetUpTestCase() {\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n        \"disabled\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n        \"errors\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n        \"failures\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n        \"name\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n        \"tests\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(\n        \"time\");\n\n    Test::RecordProperty(\"test_case_key_1\", \"1\");\n    const TestCase* test_case = UnitTest::GetInstance()->current_test_case();\n    ASSERT_TRUE(test_case != NULL);\n\n    ASSERT_EQ(1, test_case->ad_hoc_test_result().test_property_count());\n    EXPECT_STREQ(\"test_case_key_1\",\n                 test_case->ad_hoc_test_result().GetTestProperty(0).key());\n    EXPECT_STREQ(\"1\",\n                 test_case->ad_hoc_test_result().GetTestProperty(0).value());\n  }\n};\n\n// Tests TestResult has the expected property when added.\nTEST_F(UnitTestRecordPropertyTest, OnePropertyFoundWhenAdded) {\n  UnitTestRecordProperty(\"key_1\", \"1\");\n\n  ASSERT_EQ(1, unit_test_.ad_hoc_test_result().test_property_count());\n\n  EXPECT_STREQ(\"key_1\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(0).key());\n  EXPECT_STREQ(\"1\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(0).value());\n}\n\n// Tests TestResult has multiple properties when added.\nTEST_F(UnitTestRecordPropertyTest, MultiplePropertiesFoundWhenAdded) {\n  UnitTestRecordProperty(\"key_1\", \"1\");\n  UnitTestRecordProperty(\"key_2\", \"2\");\n\n  ASSERT_EQ(2, unit_test_.ad_hoc_test_result().test_property_count());\n\n  EXPECT_STREQ(\"key_1\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(0).key());\n  EXPECT_STREQ(\"1\", unit_test_.ad_hoc_test_result().GetTestProperty(0).value());\n\n  EXPECT_STREQ(\"key_2\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(1).key());\n  EXPECT_STREQ(\"2\", unit_test_.ad_hoc_test_result().GetTestProperty(1).value());\n}\n\n// Tests TestResult::RecordProperty() overrides values for duplicate keys.\nTEST_F(UnitTestRecordPropertyTest, OverridesValuesForDuplicateKeys) {\n  UnitTestRecordProperty(\"key_1\", \"1\");\n  UnitTestRecordProperty(\"key_2\", \"2\");\n  UnitTestRecordProperty(\"key_1\", \"12\");\n  UnitTestRecordProperty(\"key_2\", \"22\");\n\n  ASSERT_EQ(2, unit_test_.ad_hoc_test_result().test_property_count());\n\n  EXPECT_STREQ(\"key_1\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(0).key());\n  EXPECT_STREQ(\"12\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(0).value());\n\n  EXPECT_STREQ(\"key_2\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(1).key());\n  EXPECT_STREQ(\"22\",\n               unit_test_.ad_hoc_test_result().GetTestProperty(1).value());\n}\n\nTEST_F(UnitTestRecordPropertyTest,\n       AddFailureInsideTestsWhenUsingTestCaseReservedKeys) {\n  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n      \"name\");\n  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n      \"value_param\");\n  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n      \"type_param\");\n  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n      \"status\");\n  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n      \"time\");\n  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(\n      \"classname\");\n}\n\nTEST_F(UnitTestRecordPropertyTest,\n       AddRecordWithReservedKeysGeneratesCorrectPropertyList) {\n  EXPECT_NONFATAL_FAILURE(\n      Test::RecordProperty(\"name\", \"1\"),\n      \"'classname', 'name', 'status', 'time', 'type_param', and 'value_param'\"\n      \" are reserved\");\n}\n\nclass UnitTestRecordPropertyTestEnvironment : public Environment {\n public:\n  virtual void TearDown() {\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"tests\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"failures\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"disabled\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"errors\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"name\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"timestamp\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"time\");\n    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(\n        \"random_seed\");\n  }\n};\n\n// This will test property recording outside of any test or test case.\nstatic Environment* record_property_env =\n    AddGlobalTestEnvironment(new UnitTestRecordPropertyTestEnvironment);\n\n// This group of tests is for predicate assertions (ASSERT_PRED*, etc)\n// of various arities.  They do not attempt to be exhaustive.  Rather,\n// view them as smoke tests that can be easily reviewed and verified.\n// A more complete set of tests for predicate assertions can be found\n// in gtest_pred_impl_unittest.cc.\n\n// First, some predicates and predicate-formatters needed by the tests.\n\n// Returns true iff the argument is an even number.\nbool IsEven(int n) {\n  return (n % 2) == 0;\n}\n\n// A functor that returns true iff the argument is an even number.\nstruct IsEvenFunctor {\n  bool operator()(int n) { return IsEven(n); }\n};\n\n// A predicate-formatter function that asserts the argument is an even\n// number.\nAssertionResult AssertIsEven(const char* expr, int n) {\n  if (IsEven(n)) {\n    return AssertionSuccess();\n  }\n\n  Message msg;\n  msg << expr << \" evaluates to \" << n << \", which is not even.\";\n  return AssertionFailure(msg);\n}\n\n// A predicate function that returns AssertionResult for use in\n// EXPECT/ASSERT_TRUE/FALSE.\nAssertionResult ResultIsEven(int n) {\n  if (IsEven(n))\n    return AssertionSuccess() << n << \" is even\";\n  else\n    return AssertionFailure() << n << \" is odd\";\n}\n\n// A predicate function that returns AssertionResult but gives no\n// explanation why it succeeds. Needed for testing that\n// EXPECT/ASSERT_FALSE handles such functions correctly.\nAssertionResult ResultIsEvenNoExplanation(int n) {\n  if (IsEven(n))\n    return AssertionSuccess();\n  else\n    return AssertionFailure() << n << \" is odd\";\n}\n\n// A predicate-formatter functor that asserts the argument is an even\n// number.\nstruct AssertIsEvenFunctor {\n  AssertionResult operator()(const char* expr, int n) {\n    return AssertIsEven(expr, n);\n  }\n};\n\n// Returns true iff the sum of the arguments is an even number.\nbool SumIsEven2(int n1, int n2) {\n  return IsEven(n1 + n2);\n}\n\n// A functor that returns true iff the sum of the arguments is an even\n// number.\nstruct SumIsEven3Functor {\n  bool operator()(int n1, int n2, int n3) {\n    return IsEven(n1 + n2 + n3);\n  }\n};\n\n// A predicate-formatter function that asserts the sum of the\n// arguments is an even number.\nAssertionResult AssertSumIsEven4(\n    const char* e1, const char* e2, const char* e3, const char* e4,\n    int n1, int n2, int n3, int n4) {\n  const int sum = n1 + n2 + n3 + n4;\n  if (IsEven(sum)) {\n    return AssertionSuccess();\n  }\n\n  Message msg;\n  msg << e1 << \" + \" << e2 << \" + \" << e3 << \" + \" << e4\n      << \" (\" << n1 << \" + \" << n2 << \" + \" << n3 << \" + \" << n4\n      << \") evaluates to \" << sum << \", which is not even.\";\n  return AssertionFailure(msg);\n}\n\n// A predicate-formatter functor that asserts the sum of the arguments\n// is an even number.\nstruct AssertSumIsEven5Functor {\n  AssertionResult operator()(\n      const char* e1, const char* e2, const char* e3, const char* e4,\n      const char* e5, int n1, int n2, int n3, int n4, int n5) {\n    const int sum = n1 + n2 + n3 + n4 + n5;\n    if (IsEven(sum)) {\n      return AssertionSuccess();\n    }\n\n    Message msg;\n    msg << e1 << \" + \" << e2 << \" + \" << e3 << \" + \" << e4 << \" + \" << e5\n        << \" (\"\n        << n1 << \" + \" << n2 << \" + \" << n3 << \" + \" << n4 << \" + \" << n5\n        << \") evaluates to \" << sum << \", which is not even.\";\n    return AssertionFailure(msg);\n  }\n};\n\n\n// Tests unary predicate assertions.\n\n// Tests unary predicate assertions that don't use a custom formatter.\nTEST(Pred1Test, WithoutFormat) {\n  // Success cases.\n  EXPECT_PRED1(IsEvenFunctor(), 2) << \"This failure is UNEXPECTED!\";\n  ASSERT_PRED1(IsEven, 4);\n\n  // Failure cases.\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED1(IsEven, 5) << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n  EXPECT_FATAL_FAILURE(ASSERT_PRED1(IsEvenFunctor(), 5),\n                       \"evaluates to false\");\n}\n\n// Tests unary predicate assertions that use a custom formatter.\nTEST(Pred1Test, WithFormat) {\n  // Success cases.\n  EXPECT_PRED_FORMAT1(AssertIsEven, 2);\n  ASSERT_PRED_FORMAT1(AssertIsEvenFunctor(), 4)\n    << \"This failure is UNEXPECTED!\";\n\n  // Failure cases.\n  const int n = 5;\n  EXPECT_NONFATAL_FAILURE(EXPECT_PRED_FORMAT1(AssertIsEvenFunctor(), n),\n                          \"n evaluates to 5, which is not even.\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT1(AssertIsEven, 5) << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n}\n\n// Tests that unary predicate assertions evaluates their arguments\n// exactly once.\nTEST(Pred1Test, SingleEvaluationOnFailure) {\n  // A success case.\n  static int n = 0;\n  EXPECT_PRED1(IsEven, n++);\n  EXPECT_EQ(1, n) << \"The argument is not evaluated exactly once.\";\n\n  // A failure case.\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT1(AssertIsEvenFunctor(), n++)\n        << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n  EXPECT_EQ(2, n) << \"The argument is not evaluated exactly once.\";\n}\n\n\n// Tests predicate assertions whose arity is >= 2.\n\n// Tests predicate assertions that don't use a custom formatter.\nTEST(PredTest, WithoutFormat) {\n  // Success cases.\n  ASSERT_PRED2(SumIsEven2, 2, 4) << \"This failure is UNEXPECTED!\";\n  EXPECT_PRED3(SumIsEven3Functor(), 4, 6, 8);\n\n  // Failure cases.\n  const int n1 = 1;\n  const int n2 = 2;\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED2(SumIsEven2, n1, n2) << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED3(SumIsEven3Functor(), 1, 2, 4);\n  }, \"evaluates to false\");\n}\n\n// Tests predicate assertions that use a custom formatter.\nTEST(PredTest, WithFormat) {\n  // Success cases.\n  ASSERT_PRED_FORMAT4(AssertSumIsEven4, 4, 6, 8, 10) <<\n    \"This failure is UNEXPECTED!\";\n  EXPECT_PRED_FORMAT5(AssertSumIsEven5Functor(), 2, 4, 6, 8, 10);\n\n  // Failure cases.\n  const int n1 = 1;\n  const int n2 = 2;\n  const int n3 = 4;\n  const int n4 = 6;\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT4(AssertSumIsEven4, n1, n2, n3, n4);\n  }, \"evaluates to 13, which is not even.\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT5(AssertSumIsEven5Functor(), 1, 2, 4, 6, 8)\n        << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n}\n\n// Tests that predicate assertions evaluates their arguments\n// exactly once.\nTEST(PredTest, SingleEvaluationOnFailure) {\n  // A success case.\n  int n1 = 0;\n  int n2 = 0;\n  EXPECT_PRED2(SumIsEven2, n1++, n2++);\n  EXPECT_EQ(1, n1) << \"Argument 1 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n2) << \"Argument 2 is not evaluated exactly once.\";\n\n  // Another success case.\n  n1 = n2 = 0;\n  int n3 = 0;\n  int n4 = 0;\n  int n5 = 0;\n  ASSERT_PRED_FORMAT5(AssertSumIsEven5Functor(),\n                      n1++, n2++, n3++, n4++, n5++)\n                        << \"This failure is UNEXPECTED!\";\n  EXPECT_EQ(1, n1) << \"Argument 1 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n2) << \"Argument 2 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n3) << \"Argument 3 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n4) << \"Argument 4 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n5) << \"Argument 5 is not evaluated exactly once.\";\n\n  // A failure case.\n  n1 = n2 = n3 = 0;\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED3(SumIsEven3Functor(), ++n1, n2++, n3++)\n        << \"This failure is expected.\";\n  }, \"This failure is expected.\");\n  EXPECT_EQ(1, n1) << \"Argument 1 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n2) << \"Argument 2 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n3) << \"Argument 3 is not evaluated exactly once.\";\n\n  // Another failure case.\n  n1 = n2 = n3 = n4 = 0;\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT4(AssertSumIsEven4, ++n1, n2++, n3++, n4++);\n  }, \"evaluates to 1, which is not even.\");\n  EXPECT_EQ(1, n1) << \"Argument 1 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n2) << \"Argument 2 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n3) << \"Argument 3 is not evaluated exactly once.\";\n  EXPECT_EQ(1, n4) << \"Argument 4 is not evaluated exactly once.\";\n}\n\n\n// Some helper functions for testing using overloaded/template\n// functions with ASSERT_PREDn and EXPECT_PREDn.\n\nbool IsPositive(double x) {\n  return x > 0;\n}\n\ntemplate <typename T>\nbool IsNegative(T x) {\n  return x < 0;\n}\n\ntemplate <typename T1, typename T2>\nbool GreaterThan(T1 x1, T2 x2) {\n  return x1 > x2;\n}\n\n// Tests that overloaded functions can be used in *_PRED* as long as\n// their types are explicitly specified.\nTEST(PredicateAssertionTest, AcceptsOverloadedFunction) {\n  // C++Builder requires C-style casts rather than static_cast.\n  EXPECT_PRED1((bool (*)(int))(IsPositive), 5);  // NOLINT\n  ASSERT_PRED1((bool (*)(double))(IsPositive), 6.0);  // NOLINT\n}\n\n// Tests that template functions can be used in *_PRED* as long as\n// their types are explicitly specified.\nTEST(PredicateAssertionTest, AcceptsTemplateFunction) {\n  EXPECT_PRED1(IsNegative<int>, -5);\n  // Makes sure that we can handle templates with more than one\n  // parameter.\n  ASSERT_PRED2((GreaterThan<int, int>), 5, 0);\n}\n\n\n// Some helper functions for testing using overloaded/template\n// functions with ASSERT_PRED_FORMATn and EXPECT_PRED_FORMATn.\n\nAssertionResult IsPositiveFormat(const char* /* expr */, int n) {\n  return n > 0 ? AssertionSuccess() :\n      AssertionFailure(Message() << \"Failure\");\n}\n\nAssertionResult IsPositiveFormat(const char* /* expr */, double x) {\n  return x > 0 ? AssertionSuccess() :\n      AssertionFailure(Message() << \"Failure\");\n}\n\ntemplate <typename T>\nAssertionResult IsNegativeFormat(const char* /* expr */, T x) {\n  return x < 0 ? AssertionSuccess() :\n      AssertionFailure(Message() << \"Failure\");\n}\n\ntemplate <typename T1, typename T2>\nAssertionResult EqualsFormat(const char* /* expr1 */, const char* /* expr2 */,\n                             const T1& x1, const T2& x2) {\n  return x1 == x2 ? AssertionSuccess() :\n      AssertionFailure(Message() << \"Failure\");\n}\n\n// Tests that overloaded functions can be used in *_PRED_FORMAT*\n// without explicitly specifying their types.\nTEST(PredicateFormatAssertionTest, AcceptsOverloadedFunction) {\n  EXPECT_PRED_FORMAT1(IsPositiveFormat, 5);\n  ASSERT_PRED_FORMAT1(IsPositiveFormat, 6.0);\n}\n\n// Tests that template functions can be used in *_PRED_FORMAT* without\n// explicitly specifying their types.\nTEST(PredicateFormatAssertionTest, AcceptsTemplateFunction) {\n  EXPECT_PRED_FORMAT1(IsNegativeFormat, -5);\n  ASSERT_PRED_FORMAT2(EqualsFormat, 3, 3);\n}\n\n\n// Tests string assertions.\n\n// Tests ASSERT_STREQ with non-NULL arguments.\nTEST(StringAssertionTest, ASSERT_STREQ) {\n  const char * const p1 = \"good\";\n  ASSERT_STREQ(p1, p1);\n\n  // Let p2 have the same content as p1, but be at a different address.\n  const char p2[] = \"good\";\n  ASSERT_STREQ(p1, p2);\n\n  EXPECT_FATAL_FAILURE(ASSERT_STREQ(\"bad\", \"good\"),\n                       \"Expected: \\\"bad\\\"\");\n}\n\n// Tests ASSERT_STREQ with NULL arguments.\nTEST(StringAssertionTest, ASSERT_STREQ_Null) {\n  ASSERT_STREQ(static_cast<const char *>(NULL), NULL);\n  EXPECT_FATAL_FAILURE(ASSERT_STREQ(NULL, \"non-null\"),\n                       \"non-null\");\n}\n\n// Tests ASSERT_STREQ with NULL arguments.\nTEST(StringAssertionTest, ASSERT_STREQ_Null2) {\n  EXPECT_FATAL_FAILURE(ASSERT_STREQ(\"non-null\", NULL),\n                       \"non-null\");\n}\n\n// Tests ASSERT_STRNE.\nTEST(StringAssertionTest, ASSERT_STRNE) {\n  ASSERT_STRNE(\"hi\", \"Hi\");\n  ASSERT_STRNE(\"Hi\", NULL);\n  ASSERT_STRNE(NULL, \"Hi\");\n  ASSERT_STRNE(\"\", NULL);\n  ASSERT_STRNE(NULL, \"\");\n  ASSERT_STRNE(\"\", \"Hi\");\n  ASSERT_STRNE(\"Hi\", \"\");\n  EXPECT_FATAL_FAILURE(ASSERT_STRNE(\"Hi\", \"Hi\"),\n                       \"\\\"Hi\\\" vs \\\"Hi\\\"\");\n}\n\n// Tests ASSERT_STRCASEEQ.\nTEST(StringAssertionTest, ASSERT_STRCASEEQ) {\n  ASSERT_STRCASEEQ(\"hi\", \"Hi\");\n  ASSERT_STRCASEEQ(static_cast<const char *>(NULL), NULL);\n\n  ASSERT_STRCASEEQ(\"\", \"\");\n  EXPECT_FATAL_FAILURE(ASSERT_STRCASEEQ(\"Hi\", \"hi2\"),\n                       \"(ignoring case)\");\n}\n\n// Tests ASSERT_STRCASENE.\nTEST(StringAssertionTest, ASSERT_STRCASENE) {\n  ASSERT_STRCASENE(\"hi1\", \"Hi2\");\n  ASSERT_STRCASENE(\"Hi\", NULL);\n  ASSERT_STRCASENE(NULL, \"Hi\");\n  ASSERT_STRCASENE(\"\", NULL);\n  ASSERT_STRCASENE(NULL, \"\");\n  ASSERT_STRCASENE(\"\", \"Hi\");\n  ASSERT_STRCASENE(\"Hi\", \"\");\n  EXPECT_FATAL_FAILURE(ASSERT_STRCASENE(\"Hi\", \"hi\"),\n                       \"(ignoring case)\");\n}\n\n// Tests *_STREQ on wide strings.\nTEST(StringAssertionTest, STREQ_Wide) {\n  // NULL strings.\n  ASSERT_STREQ(static_cast<const wchar_t *>(NULL), NULL);\n\n  // Empty strings.\n  ASSERT_STREQ(L\"\", L\"\");\n\n  // Non-null vs NULL.\n  EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L\"non-null\", NULL),\n                          \"non-null\");\n\n  // Equal strings.\n  EXPECT_STREQ(L\"Hi\", L\"Hi\");\n\n  // Unequal strings.\n  EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L\"abc\", L\"Abc\"),\n                          \"Abc\");\n\n  // Strings containing wide characters.\n  EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L\"abc\\x8119\", L\"abc\\x8120\"),\n                          \"abc\");\n\n  // The streaming variation.\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_STREQ(L\"abc\\x8119\", L\"abc\\x8121\") << \"Expected failure\";\n  }, \"Expected failure\");\n}\n\n// Tests *_STRNE on wide strings.\nTEST(StringAssertionTest, STRNE_Wide) {\n  // NULL strings.\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_STRNE(static_cast<const wchar_t *>(NULL), NULL);\n  }, \"\");\n\n  // Empty strings.\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L\"\", L\"\"),\n                          \"L\\\"\\\"\");\n\n  // Non-null vs NULL.\n  ASSERT_STRNE(L\"non-null\", NULL);\n\n  // Equal strings.\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L\"Hi\", L\"Hi\"),\n                          \"L\\\"Hi\\\"\");\n\n  // Unequal strings.\n  EXPECT_STRNE(L\"abc\", L\"Abc\");\n\n  // Strings containing wide characters.\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L\"abc\\x8119\", L\"abc\\x8119\"),\n                          \"abc\");\n\n  // The streaming variation.\n  ASSERT_STRNE(L\"abc\\x8119\", L\"abc\\x8120\") << \"This shouldn't happen\";\n}\n\n// Tests for ::testing::IsSubstring().\n\n// Tests that IsSubstring() returns the correct result when the input\n// argument type is const char*.\nTEST(IsSubstringTest, ReturnsCorrectResultForCString) {\n  EXPECT_FALSE(IsSubstring(\"\", \"\", NULL, \"a\"));\n  EXPECT_FALSE(IsSubstring(\"\", \"\", \"b\", NULL));\n  EXPECT_FALSE(IsSubstring(\"\", \"\", \"needle\", \"haystack\"));\n\n  EXPECT_TRUE(IsSubstring(\"\", \"\", static_cast<const char*>(NULL), NULL));\n  EXPECT_TRUE(IsSubstring(\"\", \"\", \"needle\", \"two needles\"));\n}\n\n// Tests that IsSubstring() returns the correct result when the input\n// argument type is const wchar_t*.\nTEST(IsSubstringTest, ReturnsCorrectResultForWideCString) {\n  EXPECT_FALSE(IsSubstring(\"\", \"\", kNull, L\"a\"));\n  EXPECT_FALSE(IsSubstring(\"\", \"\", L\"b\", kNull));\n  EXPECT_FALSE(IsSubstring(\"\", \"\", L\"needle\", L\"haystack\"));\n\n  EXPECT_TRUE(IsSubstring(\"\", \"\", static_cast<const wchar_t*>(NULL), NULL));\n  EXPECT_TRUE(IsSubstring(\"\", \"\", L\"needle\", L\"two needles\"));\n}\n\n// Tests that IsSubstring() generates the correct message when the input\n// argument type is const char*.\nTEST(IsSubstringTest, GeneratesCorrectMessageForCString) {\n  EXPECT_STREQ(\"Value of: needle_expr\\n\"\n               \"  Actual: \\\"needle\\\"\\n\"\n               \"Expected: a substring of haystack_expr\\n\"\n               \"Which is: \\\"haystack\\\"\",\n               IsSubstring(\"needle_expr\", \"haystack_expr\",\n                           \"needle\", \"haystack\").failure_message());\n}\n\n// Tests that IsSubstring returns the correct result when the input\n// argument type is ::std::string.\nTEST(IsSubstringTest, ReturnsCorrectResultsForStdString) {\n  EXPECT_TRUE(IsSubstring(\"\", \"\", std::string(\"hello\"), \"ahellob\"));\n  EXPECT_FALSE(IsSubstring(\"\", \"\", \"hello\", std::string(\"world\")));\n}\n\n#if GTEST_HAS_STD_WSTRING\n// Tests that IsSubstring returns the correct result when the input\n// argument type is ::std::wstring.\nTEST(IsSubstringTest, ReturnsCorrectResultForStdWstring) {\n  EXPECT_TRUE(IsSubstring(\"\", \"\", ::std::wstring(L\"needle\"), L\"two needles\"));\n  EXPECT_FALSE(IsSubstring(\"\", \"\", L\"needle\", ::std::wstring(L\"haystack\")));\n}\n\n// Tests that IsSubstring() generates the correct message when the input\n// argument type is ::std::wstring.\nTEST(IsSubstringTest, GeneratesCorrectMessageForWstring) {\n  EXPECT_STREQ(\"Value of: needle_expr\\n\"\n               \"  Actual: L\\\"needle\\\"\\n\"\n               \"Expected: a substring of haystack_expr\\n\"\n               \"Which is: L\\\"haystack\\\"\",\n               IsSubstring(\n                   \"needle_expr\", \"haystack_expr\",\n                   ::std::wstring(L\"needle\"), L\"haystack\").failure_message());\n}\n\n#endif  // GTEST_HAS_STD_WSTRING\n\n// Tests for ::testing::IsNotSubstring().\n\n// Tests that IsNotSubstring() returns the correct result when the input\n// argument type is const char*.\nTEST(IsNotSubstringTest, ReturnsCorrectResultForCString) {\n  EXPECT_TRUE(IsNotSubstring(\"\", \"\", \"needle\", \"haystack\"));\n  EXPECT_FALSE(IsNotSubstring(\"\", \"\", \"needle\", \"two needles\"));\n}\n\n// Tests that IsNotSubstring() returns the correct result when the input\n// argument type is const wchar_t*.\nTEST(IsNotSubstringTest, ReturnsCorrectResultForWideCString) {\n  EXPECT_TRUE(IsNotSubstring(\"\", \"\", L\"needle\", L\"haystack\"));\n  EXPECT_FALSE(IsNotSubstring(\"\", \"\", L\"needle\", L\"two needles\"));\n}\n\n// Tests that IsNotSubstring() generates the correct message when the input\n// argument type is const wchar_t*.\nTEST(IsNotSubstringTest, GeneratesCorrectMessageForWideCString) {\n  EXPECT_STREQ(\"Value of: needle_expr\\n\"\n               \"  Actual: L\\\"needle\\\"\\n\"\n               \"Expected: not a substring of haystack_expr\\n\"\n               \"Which is: L\\\"two needles\\\"\",\n               IsNotSubstring(\n                   \"needle_expr\", \"haystack_expr\",\n                   L\"needle\", L\"two needles\").failure_message());\n}\n\n// Tests that IsNotSubstring returns the correct result when the input\n// argument type is ::std::string.\nTEST(IsNotSubstringTest, ReturnsCorrectResultsForStdString) {\n  EXPECT_FALSE(IsNotSubstring(\"\", \"\", std::string(\"hello\"), \"ahellob\"));\n  EXPECT_TRUE(IsNotSubstring(\"\", \"\", \"hello\", std::string(\"world\")));\n}\n\n// Tests that IsNotSubstring() generates the correct message when the input\n// argument type is ::std::string.\nTEST(IsNotSubstringTest, GeneratesCorrectMessageForStdString) {\n  EXPECT_STREQ(\"Value of: needle_expr\\n\"\n               \"  Actual: \\\"needle\\\"\\n\"\n               \"Expected: not a substring of haystack_expr\\n\"\n               \"Which is: \\\"two needles\\\"\",\n               IsNotSubstring(\n                   \"needle_expr\", \"haystack_expr\",\n                   ::std::string(\"needle\"), \"two needles\").failure_message());\n}\n\n#if GTEST_HAS_STD_WSTRING\n\n// Tests that IsNotSubstring returns the correct result when the input\n// argument type is ::std::wstring.\nTEST(IsNotSubstringTest, ReturnsCorrectResultForStdWstring) {\n  EXPECT_FALSE(\n      IsNotSubstring(\"\", \"\", ::std::wstring(L\"needle\"), L\"two needles\"));\n  EXPECT_TRUE(IsNotSubstring(\"\", \"\", L\"needle\", ::std::wstring(L\"haystack\")));\n}\n\n#endif  // GTEST_HAS_STD_WSTRING\n\n// Tests floating-point assertions.\n\ntemplate <typename RawType>\nclass FloatingPointTest : public Test {\n protected:\n  // Pre-calculated numbers to be used by the tests.\n  struct TestValues {\n    RawType close_to_positive_zero;\n    RawType close_to_negative_zero;\n    RawType further_from_negative_zero;\n\n    RawType close_to_one;\n    RawType further_from_one;\n\n    RawType infinity;\n    RawType close_to_infinity;\n    RawType further_from_infinity;\n\n    RawType nan1;\n    RawType nan2;\n  };\n\n  typedef typename testing::internal::FloatingPoint<RawType> Floating;\n  typedef typename Floating::Bits Bits;\n\n  virtual void SetUp() {\n    const size_t max_ulps = Floating::kMaxUlps;\n\n    // The bits that represent 0.0.\n    const Bits zero_bits = Floating(0).bits();\n\n    // Makes some numbers close to 0.0.\n    values_.close_to_positive_zero = Floating::ReinterpretBits(\n        zero_bits + max_ulps/2);\n    values_.close_to_negative_zero = -Floating::ReinterpretBits(\n        zero_bits + max_ulps - max_ulps/2);\n    values_.further_from_negative_zero = -Floating::ReinterpretBits(\n        zero_bits + max_ulps + 1 - max_ulps/2);\n\n    // The bits that represent 1.0.\n    const Bits one_bits = Floating(1).bits();\n\n    // Makes some numbers close to 1.0.\n    values_.close_to_one = Floating::ReinterpretBits(one_bits + max_ulps);\n    values_.further_from_one = Floating::ReinterpretBits(\n        one_bits + max_ulps + 1);\n\n    // +infinity.\n    values_.infinity = Floating::Infinity();\n\n    // The bits that represent +infinity.\n    const Bits infinity_bits = Floating(values_.infinity).bits();\n\n    // Makes some numbers close to infinity.\n    values_.close_to_infinity = Floating::ReinterpretBits(\n        infinity_bits - max_ulps);\n    values_.further_from_infinity = Floating::ReinterpretBits(\n        infinity_bits - max_ulps - 1);\n\n    // Makes some NAN's.  Sets the most significant bit of the fraction so that\n    // our NaN's are quiet; trying to process a signaling NaN would raise an\n    // exception if our environment enables floating point exceptions.\n    values_.nan1 = Floating::ReinterpretBits(Floating::kExponentBitMask\n        | (static_cast<Bits>(1) << (Floating::kFractionBitCount - 1)) | 1);\n    values_.nan2 = Floating::ReinterpretBits(Floating::kExponentBitMask\n        | (static_cast<Bits>(1) << (Floating::kFractionBitCount - 1)) | 200);\n  }\n\n  void TestSize() {\n    EXPECT_EQ(sizeof(RawType), sizeof(Bits));\n  }\n\n  static TestValues values_;\n};\n\ntemplate <typename RawType>\ntypename FloatingPointTest<RawType>::TestValues\n    FloatingPointTest<RawType>::values_;\n\n// Instantiates FloatingPointTest for testing *_FLOAT_EQ.\ntypedef FloatingPointTest<float> FloatTest;\n\n// Tests that the size of Float::Bits matches the size of float.\nTEST_F(FloatTest, Size) {\n  TestSize();\n}\n\n// Tests comparing with +0 and -0.\nTEST_F(FloatTest, Zeros) {\n  EXPECT_FLOAT_EQ(0.0, -0.0);\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(-0.0, 1.0),\n                          \"1.0\");\n  EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(0.0, 1.5),\n                       \"1.5\");\n}\n\n// Tests comparing numbers close to 0.\n//\n// This ensures that *_FLOAT_EQ handles the sign correctly and no\n// overflow occurs when comparing numbers whose absolute value is very\n// small.\nTEST_F(FloatTest, AlmostZeros) {\n  // In C++Builder, names within local classes (such as used by\n  // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the\n  // scoping class.  Use a static local alias as a workaround.\n  // We use the assignment syntax since some compilers, like Sun Studio,\n  // don't allow initializing references using construction syntax\n  // (parentheses).\n  static const FloatTest::TestValues& v = this->values_;\n\n  EXPECT_FLOAT_EQ(0.0, v.close_to_positive_zero);\n  EXPECT_FLOAT_EQ(-0.0, v.close_to_negative_zero);\n  EXPECT_FLOAT_EQ(v.close_to_positive_zero, v.close_to_negative_zero);\n\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_FLOAT_EQ(v.close_to_positive_zero,\n                    v.further_from_negative_zero);\n  }, \"v.further_from_negative_zero\");\n}\n\n// Tests comparing numbers close to each other.\nTEST_F(FloatTest, SmallDiff) {\n  EXPECT_FLOAT_EQ(1.0, values_.close_to_one);\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(1.0, values_.further_from_one),\n                          \"values_.further_from_one\");\n}\n\n// Tests comparing numbers far apart.\nTEST_F(FloatTest, LargeDiff) {\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(2.5, 3.0),\n                          \"3.0\");\n}\n\n// Tests comparing with infinity.\n//\n// This ensures that no overflow occurs when comparing numbers whose\n// absolute value is very large.\nTEST_F(FloatTest, Infinity) {\n  EXPECT_FLOAT_EQ(values_.infinity, values_.close_to_infinity);\n  EXPECT_FLOAT_EQ(-values_.infinity, -values_.close_to_infinity);\n#if !GTEST_OS_SYMBIAN\n  // Nokia's STLport crashes if we try to output infinity or NaN.\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(values_.infinity, -values_.infinity),\n                          \"-values_.infinity\");\n\n  // This is interesting as the representations of infinity and nan1\n  // are only 1 DLP apart.\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(values_.infinity, values_.nan1),\n                          \"values_.nan1\");\n#endif  // !GTEST_OS_SYMBIAN\n}\n\n// Tests that comparing with NAN always returns false.\nTEST_F(FloatTest, NaN) {\n#if !GTEST_OS_SYMBIAN\n// Nokia's STLport crashes if we try to output infinity or NaN.\n\n  // In C++Builder, names within local classes (such as used by\n  // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the\n  // scoping class.  Use a static local alias as a workaround.\n  // We use the assignment syntax since some compilers, like Sun Studio,\n  // don't allow initializing references using construction syntax\n  // (parentheses).\n  static const FloatTest::TestValues& v = this->values_;\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(v.nan1, v.nan1),\n                          \"v.nan1\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(v.nan1, v.nan2),\n                          \"v.nan2\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(1.0, v.nan1),\n                          \"v.nan1\");\n\n  EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(v.nan1, v.infinity),\n                       \"v.infinity\");\n#endif  // !GTEST_OS_SYMBIAN\n}\n\n// Tests that *_FLOAT_EQ are reflexive.\nTEST_F(FloatTest, Reflexive) {\n  EXPECT_FLOAT_EQ(0.0, 0.0);\n  EXPECT_FLOAT_EQ(1.0, 1.0);\n  ASSERT_FLOAT_EQ(values_.infinity, values_.infinity);\n}\n\n// Tests that *_FLOAT_EQ are commutative.\nTEST_F(FloatTest, Commutative) {\n  // We already tested EXPECT_FLOAT_EQ(1.0, values_.close_to_one).\n  EXPECT_FLOAT_EQ(values_.close_to_one, 1.0);\n\n  // We already tested EXPECT_FLOAT_EQ(1.0, values_.further_from_one).\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(values_.further_from_one, 1.0),\n                          \"1.0\");\n}\n\n// Tests EXPECT_NEAR.\nTEST_F(FloatTest, EXPECT_NEAR) {\n  EXPECT_NEAR(-1.0f, -1.1f, 0.2f);\n  EXPECT_NEAR(2.0f, 3.0f, 1.0f);\n  EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0f,1.5f, 0.25f),  // NOLINT\n                          \"The difference between 1.0f and 1.5f is 0.5, \"\n                          \"which exceeds 0.25f\");\n  // To work around a bug in gcc 2.95.0, there is intentionally no\n  // space after the first comma in the previous line.\n}\n\n// Tests ASSERT_NEAR.\nTEST_F(FloatTest, ASSERT_NEAR) {\n  ASSERT_NEAR(-1.0f, -1.1f, 0.2f);\n  ASSERT_NEAR(2.0f, 3.0f, 1.0f);\n  EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0f,1.5f, 0.25f),  // NOLINT\n                       \"The difference between 1.0f and 1.5f is 0.5, \"\n                       \"which exceeds 0.25f\");\n  // To work around a bug in gcc 2.95.0, there is intentionally no\n  // space after the first comma in the previous line.\n}\n\n// Tests the cases where FloatLE() should succeed.\nTEST_F(FloatTest, FloatLESucceeds) {\n  EXPECT_PRED_FORMAT2(FloatLE, 1.0f, 2.0f);  // When val1 < val2,\n  ASSERT_PRED_FORMAT2(FloatLE, 1.0f, 1.0f);  // val1 == val2,\n\n  // or when val1 is greater than, but almost equals to, val2.\n  EXPECT_PRED_FORMAT2(FloatLE, values_.close_to_positive_zero, 0.0f);\n}\n\n// Tests the cases where FloatLE() should fail.\nTEST_F(FloatTest, FloatLEFails) {\n  // When val1 is greater than val2 by a large margin,\n  EXPECT_NONFATAL_FAILURE(EXPECT_PRED_FORMAT2(FloatLE, 2.0f, 1.0f),\n                          \"(2.0f) <= (1.0f)\");\n\n  // or by a small yet non-negligible margin,\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(FloatLE, values_.further_from_one, 1.0f);\n  }, \"(values_.further_from_one) <= (1.0f)\");\n\n#if !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)\n  // Nokia's STLport crashes if we try to output infinity or NaN.\n  // C++Builder gives bad results for ordered comparisons involving NaNs\n  // due to compiler bugs.\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(FloatLE, values_.nan1, values_.infinity);\n  }, \"(values_.nan1) <= (values_.infinity)\");\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(FloatLE, -values_.infinity, values_.nan1);\n  }, \"(-values_.infinity) <= (values_.nan1)\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT2(FloatLE, values_.nan1, values_.nan1);\n  }, \"(values_.nan1) <= (values_.nan1)\");\n#endif  // !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)\n}\n\n// Instantiates FloatingPointTest for testing *_DOUBLE_EQ.\ntypedef FloatingPointTest<double> DoubleTest;\n\n// Tests that the size of Double::Bits matches the size of double.\nTEST_F(DoubleTest, Size) {\n  TestSize();\n}\n\n// Tests comparing with +0 and -0.\nTEST_F(DoubleTest, Zeros) {\n  EXPECT_DOUBLE_EQ(0.0, -0.0);\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(-0.0, 1.0),\n                          \"1.0\");\n  EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(0.0, 1.0),\n                       \"1.0\");\n}\n\n// Tests comparing numbers close to 0.\n//\n// This ensures that *_DOUBLE_EQ handles the sign correctly and no\n// overflow occurs when comparing numbers whose absolute value is very\n// small.\nTEST_F(DoubleTest, AlmostZeros) {\n  // In C++Builder, names within local classes (such as used by\n  // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the\n  // scoping class.  Use a static local alias as a workaround.\n  // We use the assignment syntax since some compilers, like Sun Studio,\n  // don't allow initializing references using construction syntax\n  // (parentheses).\n  static const DoubleTest::TestValues& v = this->values_;\n\n  EXPECT_DOUBLE_EQ(0.0, v.close_to_positive_zero);\n  EXPECT_DOUBLE_EQ(-0.0, v.close_to_negative_zero);\n  EXPECT_DOUBLE_EQ(v.close_to_positive_zero, v.close_to_negative_zero);\n\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_DOUBLE_EQ(v.close_to_positive_zero,\n                     v.further_from_negative_zero);\n  }, \"v.further_from_negative_zero\");\n}\n\n// Tests comparing numbers close to each other.\nTEST_F(DoubleTest, SmallDiff) {\n  EXPECT_DOUBLE_EQ(1.0, values_.close_to_one);\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, values_.further_from_one),\n                          \"values_.further_from_one\");\n}\n\n// Tests comparing numbers far apart.\nTEST_F(DoubleTest, LargeDiff) {\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(2.0, 3.0),\n                          \"3.0\");\n}\n\n// Tests comparing with infinity.\n//\n// This ensures that no overflow occurs when comparing numbers whose\n// absolute value is very large.\nTEST_F(DoubleTest, Infinity) {\n  EXPECT_DOUBLE_EQ(values_.infinity, values_.close_to_infinity);\n  EXPECT_DOUBLE_EQ(-values_.infinity, -values_.close_to_infinity);\n#if !GTEST_OS_SYMBIAN\n  // Nokia's STLport crashes if we try to output infinity or NaN.\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.infinity, -values_.infinity),\n                          \"-values_.infinity\");\n\n  // This is interesting as the representations of infinity_ and nan1_\n  // are only 1 DLP apart.\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.infinity, values_.nan1),\n                          \"values_.nan1\");\n#endif  // !GTEST_OS_SYMBIAN\n}\n\n// Tests that comparing with NAN always returns false.\nTEST_F(DoubleTest, NaN) {\n#if !GTEST_OS_SYMBIAN\n  // In C++Builder, names within local classes (such as used by\n  // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the\n  // scoping class.  Use a static local alias as a workaround.\n  // We use the assignment syntax since some compilers, like Sun Studio,\n  // don't allow initializing references using construction syntax\n  // (parentheses).\n  static const DoubleTest::TestValues& v = this->values_;\n\n  // Nokia's STLport crashes if we try to output infinity or NaN.\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(v.nan1, v.nan1),\n                          \"v.nan1\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(v.nan1, v.nan2), \"v.nan2\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, v.nan1), \"v.nan1\");\n  EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(v.nan1, v.infinity),\n                       \"v.infinity\");\n#endif  // !GTEST_OS_SYMBIAN\n}\n\n// Tests that *_DOUBLE_EQ are reflexive.\nTEST_F(DoubleTest, Reflexive) {\n  EXPECT_DOUBLE_EQ(0.0, 0.0);\n  EXPECT_DOUBLE_EQ(1.0, 1.0);\n#if !GTEST_OS_SYMBIAN\n  // Nokia's STLport crashes if we try to output infinity or NaN.\n  ASSERT_DOUBLE_EQ(values_.infinity, values_.infinity);\n#endif  // !GTEST_OS_SYMBIAN\n}\n\n// Tests that *_DOUBLE_EQ are commutative.\nTEST_F(DoubleTest, Commutative) {\n  // We already tested EXPECT_DOUBLE_EQ(1.0, values_.close_to_one).\n  EXPECT_DOUBLE_EQ(values_.close_to_one, 1.0);\n\n  // We already tested EXPECT_DOUBLE_EQ(1.0, values_.further_from_one).\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.further_from_one, 1.0),\n                          \"1.0\");\n}\n\n// Tests EXPECT_NEAR.\nTEST_F(DoubleTest, EXPECT_NEAR) {\n  EXPECT_NEAR(-1.0, -1.1, 0.2);\n  EXPECT_NEAR(2.0, 3.0, 1.0);\n  EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.5, 0.25),  // NOLINT\n                          \"The difference between 1.0 and 1.5 is 0.5, \"\n                          \"which exceeds 0.25\");\n  // To work around a bug in gcc 2.95.0, there is intentionally no\n  // space after the first comma in the previous statement.\n}\n\n// Tests ASSERT_NEAR.\nTEST_F(DoubleTest, ASSERT_NEAR) {\n  ASSERT_NEAR(-1.0, -1.1, 0.2);\n  ASSERT_NEAR(2.0, 3.0, 1.0);\n  EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.5, 0.25),  // NOLINT\n                       \"The difference between 1.0 and 1.5 is 0.5, \"\n                       \"which exceeds 0.25\");\n  // To work around a bug in gcc 2.95.0, there is intentionally no\n  // space after the first comma in the previous statement.\n}\n\n// Tests the cases where DoubleLE() should succeed.\nTEST_F(DoubleTest, DoubleLESucceeds) {\n  EXPECT_PRED_FORMAT2(DoubleLE, 1.0, 2.0);  // When val1 < val2,\n  ASSERT_PRED_FORMAT2(DoubleLE, 1.0, 1.0);  // val1 == val2,\n\n  // or when val1 is greater than, but almost equals to, val2.\n  EXPECT_PRED_FORMAT2(DoubleLE, values_.close_to_positive_zero, 0.0);\n}\n\n// Tests the cases where DoubleLE() should fail.\nTEST_F(DoubleTest, DoubleLEFails) {\n  // When val1 is greater than val2 by a large margin,\n  EXPECT_NONFATAL_FAILURE(EXPECT_PRED_FORMAT2(DoubleLE, 2.0, 1.0),\n                          \"(2.0) <= (1.0)\");\n\n  // or by a small yet non-negligible margin,\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(DoubleLE, values_.further_from_one, 1.0);\n  }, \"(values_.further_from_one) <= (1.0)\");\n\n#if !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)\n  // Nokia's STLport crashes if we try to output infinity or NaN.\n  // C++Builder gives bad results for ordered comparisons involving NaNs\n  // due to compiler bugs.\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(DoubleLE, values_.nan1, values_.infinity);\n  }, \"(values_.nan1) <= (values_.infinity)\");\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_PRED_FORMAT2(DoubleLE, -values_.infinity, values_.nan1);\n  }, \" (-values_.infinity) <= (values_.nan1)\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_PRED_FORMAT2(DoubleLE, values_.nan1, values_.nan1);\n  }, \"(values_.nan1) <= (values_.nan1)\");\n#endif  // !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)\n}\n\n\n// Verifies that a test or test case whose name starts with DISABLED_ is\n// not run.\n\n// A test whose name starts with DISABLED_.\n// Should not run.\nTEST(DisabledTest, DISABLED_TestShouldNotRun) {\n  FAIL() << \"Unexpected failure: Disabled test should not be run.\";\n}\n\n// A test whose name does not start with DISABLED_.\n// Should run.\nTEST(DisabledTest, NotDISABLED_TestShouldRun) {\n  EXPECT_EQ(1, 1);\n}\n\n// A test case whose name starts with DISABLED_.\n// Should not run.\nTEST(DISABLED_TestCase, TestShouldNotRun) {\n  FAIL() << \"Unexpected failure: Test in disabled test case should not be run.\";\n}\n\n// A test case and test whose names start with DISABLED_.\n// Should not run.\nTEST(DISABLED_TestCase, DISABLED_TestShouldNotRun) {\n  FAIL() << \"Unexpected failure: Test in disabled test case should not be run.\";\n}\n\n// Check that when all tests in a test case are disabled, SetupTestCase() and\n// TearDownTestCase() are not called.\nclass DisabledTestsTest : public Test {\n protected:\n  static void SetUpTestCase() {\n    FAIL() << \"Unexpected failure: All tests disabled in test case. \"\n              \"SetupTestCase() should not be called.\";\n  }\n\n  static void TearDownTestCase() {\n    FAIL() << \"Unexpected failure: All tests disabled in test case. \"\n              \"TearDownTestCase() should not be called.\";\n  }\n};\n\nTEST_F(DisabledTestsTest, DISABLED_TestShouldNotRun_1) {\n  FAIL() << \"Unexpected failure: Disabled test should not be run.\";\n}\n\nTEST_F(DisabledTestsTest, DISABLED_TestShouldNotRun_2) {\n  FAIL() << \"Unexpected failure: Disabled test should not be run.\";\n}\n\n// Tests that disabled typed tests aren't run.\n\n#if GTEST_HAS_TYPED_TEST\n\ntemplate <typename T>\nclass TypedTest : public Test {\n};\n\ntypedef testing::Types<int, double> NumericTypes;\nTYPED_TEST_CASE(TypedTest, NumericTypes);\n\nTYPED_TEST(TypedTest, DISABLED_ShouldNotRun) {\n  FAIL() << \"Unexpected failure: Disabled typed test should not run.\";\n}\n\ntemplate <typename T>\nclass DISABLED_TypedTest : public Test {\n};\n\nTYPED_TEST_CASE(DISABLED_TypedTest, NumericTypes);\n\nTYPED_TEST(DISABLED_TypedTest, ShouldNotRun) {\n  FAIL() << \"Unexpected failure: Disabled typed test should not run.\";\n}\n\n#endif  // GTEST_HAS_TYPED_TEST\n\n// Tests that disabled type-parameterized tests aren't run.\n\n#if GTEST_HAS_TYPED_TEST_P\n\ntemplate <typename T>\nclass TypedTestP : public Test {\n};\n\nTYPED_TEST_CASE_P(TypedTestP);\n\nTYPED_TEST_P(TypedTestP, DISABLED_ShouldNotRun) {\n  FAIL() << \"Unexpected failure: \"\n         << \"Disabled type-parameterized test should not run.\";\n}\n\nREGISTER_TYPED_TEST_CASE_P(TypedTestP, DISABLED_ShouldNotRun);\n\nINSTANTIATE_TYPED_TEST_CASE_P(My, TypedTestP, NumericTypes);\n\ntemplate <typename T>\nclass DISABLED_TypedTestP : public Test {\n};\n\nTYPED_TEST_CASE_P(DISABLED_TypedTestP);\n\nTYPED_TEST_P(DISABLED_TypedTestP, ShouldNotRun) {\n  FAIL() << \"Unexpected failure: \"\n         << \"Disabled type-parameterized test should not run.\";\n}\n\nREGISTER_TYPED_TEST_CASE_P(DISABLED_TypedTestP, ShouldNotRun);\n\nINSTANTIATE_TYPED_TEST_CASE_P(My, DISABLED_TypedTestP, NumericTypes);\n\n#endif  // GTEST_HAS_TYPED_TEST_P\n\n// Tests that assertion macros evaluate their arguments exactly once.\n\nclass SingleEvaluationTest : public Test {\n public:  // Must be public and not protected due to a bug in g++ 3.4.2.\n  // This helper function is needed by the FailedASSERT_STREQ test\n  // below.  It's public to work around C++Builder's bug with scoping local\n  // classes.\n  static void CompareAndIncrementCharPtrs() {\n    ASSERT_STREQ(p1_++, p2_++);\n  }\n\n  // This helper function is needed by the FailedASSERT_NE test below.  It's\n  // public to work around C++Builder's bug with scoping local classes.\n  static void CompareAndIncrementInts() {\n    ASSERT_NE(a_++, b_++);\n  }\n\n protected:\n  SingleEvaluationTest() {\n    p1_ = s1_;\n    p2_ = s2_;\n    a_ = 0;\n    b_ = 0;\n  }\n\n  static const char* const s1_;\n  static const char* const s2_;\n  static const char* p1_;\n  static const char* p2_;\n\n  static int a_;\n  static int b_;\n};\n\nconst char* const SingleEvaluationTest::s1_ = \"01234\";\nconst char* const SingleEvaluationTest::s2_ = \"abcde\";\nconst char* SingleEvaluationTest::p1_;\nconst char* SingleEvaluationTest::p2_;\nint SingleEvaluationTest::a_;\nint SingleEvaluationTest::b_;\n\n// Tests that when ASSERT_STREQ fails, it evaluates its arguments\n// exactly once.\nTEST_F(SingleEvaluationTest, FailedASSERT_STREQ) {\n  EXPECT_FATAL_FAILURE(SingleEvaluationTest::CompareAndIncrementCharPtrs(),\n                       \"p2_++\");\n  EXPECT_EQ(s1_ + 1, p1_);\n  EXPECT_EQ(s2_ + 1, p2_);\n}\n\n// Tests that string assertion arguments are evaluated exactly once.\nTEST_F(SingleEvaluationTest, ASSERT_STR) {\n  // successful EXPECT_STRNE\n  EXPECT_STRNE(p1_++, p2_++);\n  EXPECT_EQ(s1_ + 1, p1_);\n  EXPECT_EQ(s2_ + 1, p2_);\n\n  // failed EXPECT_STRCASEEQ\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRCASEEQ(p1_++, p2_++),\n                          \"ignoring case\");\n  EXPECT_EQ(s1_ + 2, p1_);\n  EXPECT_EQ(s2_ + 2, p2_);\n}\n\n// Tests that when ASSERT_NE fails, it evaluates its arguments exactly\n// once.\nTEST_F(SingleEvaluationTest, FailedASSERT_NE) {\n  EXPECT_FATAL_FAILURE(SingleEvaluationTest::CompareAndIncrementInts(),\n                       \"(a_++) != (b_++)\");\n  EXPECT_EQ(1, a_);\n  EXPECT_EQ(1, b_);\n}\n\n// Tests that assertion arguments are evaluated exactly once.\nTEST_F(SingleEvaluationTest, OtherCases) {\n  // successful EXPECT_TRUE\n  EXPECT_TRUE(0 == a_++);  // NOLINT\n  EXPECT_EQ(1, a_);\n\n  // failed EXPECT_TRUE\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(-1 == a_++), \"-1 == a_++\");\n  EXPECT_EQ(2, a_);\n\n  // successful EXPECT_GT\n  EXPECT_GT(a_++, b_++);\n  EXPECT_EQ(3, a_);\n  EXPECT_EQ(1, b_);\n\n  // failed EXPECT_LT\n  EXPECT_NONFATAL_FAILURE(EXPECT_LT(a_++, b_++), \"(a_++) < (b_++)\");\n  EXPECT_EQ(4, a_);\n  EXPECT_EQ(2, b_);\n\n  // successful ASSERT_TRUE\n  ASSERT_TRUE(0 < a_++);  // NOLINT\n  EXPECT_EQ(5, a_);\n\n  // successful ASSERT_GT\n  ASSERT_GT(a_++, b_++);\n  EXPECT_EQ(6, a_);\n  EXPECT_EQ(3, b_);\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\nvoid ThrowAnInteger() {\n  throw 1;\n}\n\n// Tests that assertion arguments are evaluated exactly once.\nTEST_F(SingleEvaluationTest, ExceptionTests) {\n  // successful EXPECT_THROW\n  EXPECT_THROW({  // NOLINT\n    a_++;\n    ThrowAnInteger();\n  }, int);\n  EXPECT_EQ(1, a_);\n\n  // failed EXPECT_THROW, throws different\n  EXPECT_NONFATAL_FAILURE(EXPECT_THROW({  // NOLINT\n    a_++;\n    ThrowAnInteger();\n  }, bool), \"throws a different type\");\n  EXPECT_EQ(2, a_);\n\n  // failed EXPECT_THROW, throws nothing\n  EXPECT_NONFATAL_FAILURE(EXPECT_THROW(a_++, bool), \"throws nothing\");\n  EXPECT_EQ(3, a_);\n\n  // successful EXPECT_NO_THROW\n  EXPECT_NO_THROW(a_++);\n  EXPECT_EQ(4, a_);\n\n  // failed EXPECT_NO_THROW\n  EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW({  // NOLINT\n    a_++;\n    ThrowAnInteger();\n  }), \"it throws\");\n  EXPECT_EQ(5, a_);\n\n  // successful EXPECT_ANY_THROW\n  EXPECT_ANY_THROW({  // NOLINT\n    a_++;\n    ThrowAnInteger();\n  });\n  EXPECT_EQ(6, a_);\n\n  // failed EXPECT_ANY_THROW\n  EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(a_++), \"it doesn't\");\n  EXPECT_EQ(7, a_);\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// Tests {ASSERT|EXPECT}_NO_FATAL_FAILURE.\nclass NoFatalFailureTest : public Test {\n protected:\n  void Succeeds() {}\n  void FailsNonFatal() {\n    ADD_FAILURE() << \"some non-fatal failure\";\n  }\n  void Fails() {\n    FAIL() << \"some fatal failure\";\n  }\n\n  void DoAssertNoFatalFailureOnFails() {\n    ASSERT_NO_FATAL_FAILURE(Fails());\n    ADD_FAILURE() << \"shold not reach here.\";\n  }\n\n  void DoExpectNoFatalFailureOnFails() {\n    EXPECT_NO_FATAL_FAILURE(Fails());\n    ADD_FAILURE() << \"other failure\";\n  }\n};\n\nTEST_F(NoFatalFailureTest, NoFailure) {\n  EXPECT_NO_FATAL_FAILURE(Succeeds());\n  ASSERT_NO_FATAL_FAILURE(Succeeds());\n}\n\nTEST_F(NoFatalFailureTest, NonFatalIsNoFailure) {\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_NO_FATAL_FAILURE(FailsNonFatal()),\n      \"some non-fatal failure\");\n  EXPECT_NONFATAL_FAILURE(\n      ASSERT_NO_FATAL_FAILURE(FailsNonFatal()),\n      \"some non-fatal failure\");\n}\n\nTEST_F(NoFatalFailureTest, AssertNoFatalFailureOnFatalFailure) {\n  TestPartResultArray gtest_failures;\n  {\n    ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);\n    DoAssertNoFatalFailureOnFails();\n  }\n  ASSERT_EQ(2, gtest_failures.size());\n  EXPECT_EQ(TestPartResult::kFatalFailure,\n            gtest_failures.GetTestPartResult(0).type());\n  EXPECT_EQ(TestPartResult::kFatalFailure,\n            gtest_failures.GetTestPartResult(1).type());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"some fatal failure\",\n                      gtest_failures.GetTestPartResult(0).message());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"it does\",\n                      gtest_failures.GetTestPartResult(1).message());\n}\n\nTEST_F(NoFatalFailureTest, ExpectNoFatalFailureOnFatalFailure) {\n  TestPartResultArray gtest_failures;\n  {\n    ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);\n    DoExpectNoFatalFailureOnFails();\n  }\n  ASSERT_EQ(3, gtest_failures.size());\n  EXPECT_EQ(TestPartResult::kFatalFailure,\n            gtest_failures.GetTestPartResult(0).type());\n  EXPECT_EQ(TestPartResult::kNonFatalFailure,\n            gtest_failures.GetTestPartResult(1).type());\n  EXPECT_EQ(TestPartResult::kNonFatalFailure,\n            gtest_failures.GetTestPartResult(2).type());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"some fatal failure\",\n                      gtest_failures.GetTestPartResult(0).message());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"it does\",\n                      gtest_failures.GetTestPartResult(1).message());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"other failure\",\n                      gtest_failures.GetTestPartResult(2).message());\n}\n\nTEST_F(NoFatalFailureTest, MessageIsStreamable) {\n  TestPartResultArray gtest_failures;\n  {\n    ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);\n    EXPECT_NO_FATAL_FAILURE(FAIL() << \"foo\") << \"my message\";\n  }\n  ASSERT_EQ(2, gtest_failures.size());\n  EXPECT_EQ(TestPartResult::kNonFatalFailure,\n            gtest_failures.GetTestPartResult(0).type());\n  EXPECT_EQ(TestPartResult::kNonFatalFailure,\n            gtest_failures.GetTestPartResult(1).type());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"foo\",\n                      gtest_failures.GetTestPartResult(0).message());\n  EXPECT_PRED_FORMAT2(testing::IsSubstring, \"my message\",\n                      gtest_failures.GetTestPartResult(1).message());\n}\n\n// Tests non-string assertions.\n\n// Tests EqFailure(), used for implementing *EQ* assertions.\nTEST(AssertionTest, EqFailure) {\n  const std::string foo_val(\"5\"), bar_val(\"6\");\n  const std::string msg1(\n      EqFailure(\"foo\", \"bar\", foo_val, bar_val, false)\n      .failure_message());\n  EXPECT_STREQ(\n      \"Value of: bar\\n\"\n      \"  Actual: 6\\n\"\n      \"Expected: foo\\n\"\n      \"Which is: 5\",\n      msg1.c_str());\n\n  const std::string msg2(\n      EqFailure(\"foo\", \"6\", foo_val, bar_val, false)\n      .failure_message());\n  EXPECT_STREQ(\n      \"Value of: 6\\n\"\n      \"Expected: foo\\n\"\n      \"Which is: 5\",\n      msg2.c_str());\n\n  const std::string msg3(\n      EqFailure(\"5\", \"bar\", foo_val, bar_val, false)\n      .failure_message());\n  EXPECT_STREQ(\n      \"Value of: bar\\n\"\n      \"  Actual: 6\\n\"\n      \"Expected: 5\",\n      msg3.c_str());\n\n  const std::string msg4(\n      EqFailure(\"5\", \"6\", foo_val, bar_val, false).failure_message());\n  EXPECT_STREQ(\n      \"Value of: 6\\n\"\n      \"Expected: 5\",\n      msg4.c_str());\n\n  const std::string msg5(\n      EqFailure(\"foo\", \"bar\",\n                std::string(\"\\\"x\\\"\"), std::string(\"\\\"y\\\"\"),\n                true).failure_message());\n  EXPECT_STREQ(\n      \"Value of: bar\\n\"\n      \"  Actual: \\\"y\\\"\\n\"\n      \"Expected: foo (ignoring case)\\n\"\n      \"Which is: \\\"x\\\"\",\n      msg5.c_str());\n}\n\n// Tests AppendUserMessage(), used for implementing the *EQ* macros.\nTEST(AssertionTest, AppendUserMessage) {\n  const std::string foo(\"foo\");\n\n  Message msg;\n  EXPECT_STREQ(\"foo\",\n               AppendUserMessage(foo, msg).c_str());\n\n  msg << \"bar\";\n  EXPECT_STREQ(\"foo\\nbar\",\n               AppendUserMessage(foo, msg).c_str());\n}\n\n#ifdef __BORLANDC__\n// Silences warnings: \"Condition is always true\", \"Unreachable code\"\n# pragma option push -w-ccc -w-rch\n#endif\n\n// Tests ASSERT_TRUE.\nTEST(AssertionTest, ASSERT_TRUE) {\n  ASSERT_TRUE(2 > 1);  // NOLINT\n  EXPECT_FATAL_FAILURE(ASSERT_TRUE(2 < 1),\n                       \"2 < 1\");\n}\n\n// Tests ASSERT_TRUE(predicate) for predicates returning AssertionResult.\nTEST(AssertionTest, AssertTrueWithAssertionResult) {\n  ASSERT_TRUE(ResultIsEven(2));\n#ifndef __BORLANDC__\n  // ICE's in C++Builder.\n  EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEven(3)),\n                       \"Value of: ResultIsEven(3)\\n\"\n                       \"  Actual: false (3 is odd)\\n\"\n                       \"Expected: true\");\n#endif\n  ASSERT_TRUE(ResultIsEvenNoExplanation(2));\n  EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEvenNoExplanation(3)),\n                       \"Value of: ResultIsEvenNoExplanation(3)\\n\"\n                       \"  Actual: false (3 is odd)\\n\"\n                       \"Expected: true\");\n}\n\n// Tests ASSERT_FALSE.\nTEST(AssertionTest, ASSERT_FALSE) {\n  ASSERT_FALSE(2 < 1);  // NOLINT\n  EXPECT_FATAL_FAILURE(ASSERT_FALSE(2 > 1),\n                       \"Value of: 2 > 1\\n\"\n                       \"  Actual: true\\n\"\n                       \"Expected: false\");\n}\n\n// Tests ASSERT_FALSE(predicate) for predicates returning AssertionResult.\nTEST(AssertionTest, AssertFalseWithAssertionResult) {\n  ASSERT_FALSE(ResultIsEven(3));\n#ifndef __BORLANDC__\n  // ICE's in C++Builder.\n  EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEven(2)),\n                       \"Value of: ResultIsEven(2)\\n\"\n                       \"  Actual: true (2 is even)\\n\"\n                       \"Expected: false\");\n#endif\n  ASSERT_FALSE(ResultIsEvenNoExplanation(3));\n  EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEvenNoExplanation(2)),\n                       \"Value of: ResultIsEvenNoExplanation(2)\\n\"\n                       \"  Actual: true\\n\"\n                       \"Expected: false\");\n}\n\n#ifdef __BORLANDC__\n// Restores warnings after previous \"#pragma option push\" supressed them\n# pragma option pop\n#endif\n\n// Tests using ASSERT_EQ on double values.  The purpose is to make\n// sure that the specialization we did for integer and anonymous enums\n// isn't used for double arguments.\nTEST(ExpectTest, ASSERT_EQ_Double) {\n  // A success.\n  ASSERT_EQ(5.6, 5.6);\n\n  // A failure.\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(5.1, 5.2),\n                       \"5.1\");\n}\n\n// Tests ASSERT_EQ.\nTEST(AssertionTest, ASSERT_EQ) {\n  ASSERT_EQ(5, 2 + 3);\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(5, 2*3),\n                       \"Value of: 2*3\\n\"\n                       \"  Actual: 6\\n\"\n                       \"Expected: 5\");\n}\n\n// Tests ASSERT_EQ(NULL, pointer).\n#if GTEST_CAN_COMPARE_NULL\nTEST(AssertionTest, ASSERT_EQ_NULL) {\n  // A success.\n  const char* p = NULL;\n  // Some older GCC versions may issue a spurious waring in this or the next\n  // assertion statement. This warning should not be suppressed with\n  // static_cast since the test verifies the ability to use bare NULL as the\n  // expected parameter to the macro.\n  ASSERT_EQ(NULL, p);\n\n  // A failure.\n  static int n = 0;\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),\n                       \"Value of: &n\\n\");\n}\n#endif  // GTEST_CAN_COMPARE_NULL\n\n// Tests ASSERT_EQ(0, non_pointer).  Since the literal 0 can be\n// treated as a null pointer by the compiler, we need to make sure\n// that ASSERT_EQ(0, non_pointer) isn't interpreted by Google Test as\n// ASSERT_EQ(static_cast<void*>(NULL), non_pointer).\nTEST(ExpectTest, ASSERT_EQ_0) {\n  int n = 0;\n\n  // A success.\n  ASSERT_EQ(0, n);\n\n  // A failure.\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(0, 5.6),\n                       \"Expected: 0\");\n}\n\n// Tests ASSERT_NE.\nTEST(AssertionTest, ASSERT_NE) {\n  ASSERT_NE(6, 7);\n  EXPECT_FATAL_FAILURE(ASSERT_NE('a', 'a'),\n                       \"Expected: ('a') != ('a'), \"\n                       \"actual: 'a' (97, 0x61) vs 'a' (97, 0x61)\");\n}\n\n// Tests ASSERT_LE.\nTEST(AssertionTest, ASSERT_LE) {\n  ASSERT_LE(2, 3);\n  ASSERT_LE(2, 2);\n  EXPECT_FATAL_FAILURE(ASSERT_LE(2, 0),\n                       \"Expected: (2) <= (0), actual: 2 vs 0\");\n}\n\n// Tests ASSERT_LT.\nTEST(AssertionTest, ASSERT_LT) {\n  ASSERT_LT(2, 3);\n  EXPECT_FATAL_FAILURE(ASSERT_LT(2, 2),\n                       \"Expected: (2) < (2), actual: 2 vs 2\");\n}\n\n// Tests ASSERT_GE.\nTEST(AssertionTest, ASSERT_GE) {\n  ASSERT_GE(2, 1);\n  ASSERT_GE(2, 2);\n  EXPECT_FATAL_FAILURE(ASSERT_GE(2, 3),\n                       \"Expected: (2) >= (3), actual: 2 vs 3\");\n}\n\n// Tests ASSERT_GT.\nTEST(AssertionTest, ASSERT_GT) {\n  ASSERT_GT(2, 1);\n  EXPECT_FATAL_FAILURE(ASSERT_GT(2, 2),\n                       \"Expected: (2) > (2), actual: 2 vs 2\");\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\nvoid ThrowNothing() {}\n\n// Tests ASSERT_THROW.\nTEST(AssertionTest, ASSERT_THROW) {\n  ASSERT_THROW(ThrowAnInteger(), int);\n\n# ifndef __BORLANDC__\n\n  // ICE's in C++Builder 2007 and 2009.\n  EXPECT_FATAL_FAILURE(\n      ASSERT_THROW(ThrowAnInteger(), bool),\n      \"Expected: ThrowAnInteger() throws an exception of type bool.\\n\"\n      \"  Actual: it throws a different type.\");\n# endif\n\n  EXPECT_FATAL_FAILURE(\n      ASSERT_THROW(ThrowNothing(), bool),\n      \"Expected: ThrowNothing() throws an exception of type bool.\\n\"\n      \"  Actual: it throws nothing.\");\n}\n\n// Tests ASSERT_NO_THROW.\nTEST(AssertionTest, ASSERT_NO_THROW) {\n  ASSERT_NO_THROW(ThrowNothing());\n  EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnInteger()),\n                       \"Expected: ThrowAnInteger() doesn't throw an exception.\"\n                       \"\\n  Actual: it throws.\");\n}\n\n// Tests ASSERT_ANY_THROW.\nTEST(AssertionTest, ASSERT_ANY_THROW) {\n  ASSERT_ANY_THROW(ThrowAnInteger());\n  EXPECT_FATAL_FAILURE(\n      ASSERT_ANY_THROW(ThrowNothing()),\n      \"Expected: ThrowNothing() throws an exception.\\n\"\n      \"  Actual: it doesn't.\");\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// Makes sure we deal with the precedence of <<.  This test should\n// compile.\nTEST(AssertionTest, AssertPrecedence) {\n  ASSERT_EQ(1 < 2, true);\n  bool false_value = false;\n  ASSERT_EQ(true && false_value, false);\n}\n\n// A subroutine used by the following test.\nvoid TestEq1(int x) {\n  ASSERT_EQ(1, x);\n}\n\n// Tests calling a test subroutine that's not part of a fixture.\nTEST(AssertionTest, NonFixtureSubroutine) {\n  EXPECT_FATAL_FAILURE(TestEq1(2),\n                       \"Value of: x\");\n}\n\n// An uncopyable class.\nclass Uncopyable {\n public:\n  explicit Uncopyable(int a_value) : value_(a_value) {}\n\n  int value() const { return value_; }\n  bool operator==(const Uncopyable& rhs) const {\n    return value() == rhs.value();\n  }\n private:\n  // This constructor deliberately has no implementation, as we don't\n  // want this class to be copyable.\n  Uncopyable(const Uncopyable&);  // NOLINT\n\n  int value_;\n};\n\n::std::ostream& operator<<(::std::ostream& os, const Uncopyable& value) {\n  return os << value.value();\n}\n\n\nbool IsPositiveUncopyable(const Uncopyable& x) {\n  return x.value() > 0;\n}\n\n// A subroutine used by the following test.\nvoid TestAssertNonPositive() {\n  Uncopyable y(-1);\n  ASSERT_PRED1(IsPositiveUncopyable, y);\n}\n// A subroutine used by the following test.\nvoid TestAssertEqualsUncopyable() {\n  Uncopyable x(5);\n  Uncopyable y(-1);\n  ASSERT_EQ(x, y);\n}\n\n// Tests that uncopyable objects can be used in assertions.\nTEST(AssertionTest, AssertWorksWithUncopyableObject) {\n  Uncopyable x(5);\n  ASSERT_PRED1(IsPositiveUncopyable, x);\n  ASSERT_EQ(x, x);\n  EXPECT_FATAL_FAILURE(TestAssertNonPositive(),\n    \"IsPositiveUncopyable(y) evaluates to false, where\\ny evaluates to -1\");\n  EXPECT_FATAL_FAILURE(TestAssertEqualsUncopyable(),\n    \"Value of: y\\n  Actual: -1\\nExpected: x\\nWhich is: 5\");\n}\n\n// Tests that uncopyable objects can be used in expects.\nTEST(AssertionTest, ExpectWorksWithUncopyableObject) {\n  Uncopyable x(5);\n  EXPECT_PRED1(IsPositiveUncopyable, x);\n  Uncopyable y(-1);\n  EXPECT_NONFATAL_FAILURE(EXPECT_PRED1(IsPositiveUncopyable, y),\n    \"IsPositiveUncopyable(y) evaluates to false, where\\ny evaluates to -1\");\n  EXPECT_EQ(x, x);\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y),\n    \"Value of: y\\n  Actual: -1\\nExpected: x\\nWhich is: 5\");\n}\n\nenum NamedEnum {\n  kE1 = 0,\n  kE2 = 1\n};\n\nTEST(AssertionTest, NamedEnum) {\n  EXPECT_EQ(kE1, kE1);\n  EXPECT_LT(kE1, kE2);\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), \"Which is: 0\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), \"Actual: 1\");\n}\n\n// The version of gcc used in XCode 2.2 has a bug and doesn't allow\n// anonymous enums in assertions.  Therefore the following test is not\n// done on Mac.\n// Sun Studio and HP aCC also reject this code.\n#if !GTEST_OS_MAC && !defined(__SUNPRO_CC) && !defined(__HP_aCC)\n\n// Tests using assertions with anonymous enums.\nenum {\n  kCaseA = -1,\n\n# if GTEST_OS_LINUX\n\n  // We want to test the case where the size of the anonymous enum is\n  // larger than sizeof(int), to make sure our implementation of the\n  // assertions doesn't truncate the enums.  However, MSVC\n  // (incorrectly) doesn't allow an enum value to exceed the range of\n  // an int, so this has to be conditionally compiled.\n  //\n  // On Linux, kCaseB and kCaseA have the same value when truncated to\n  // int size.  We want to test whether this will confuse the\n  // assertions.\n  kCaseB = testing::internal::kMaxBiggestInt,\n\n# else\n\n  kCaseB = INT_MAX,\n\n# endif  // GTEST_OS_LINUX\n\n  kCaseC = 42\n};\n\nTEST(AssertionTest, AnonymousEnum) {\n# if GTEST_OS_LINUX\n\n  EXPECT_EQ(static_cast<int>(kCaseA), static_cast<int>(kCaseB));\n\n# endif  // GTEST_OS_LINUX\n\n  EXPECT_EQ(kCaseA, kCaseA);\n  EXPECT_NE(kCaseA, kCaseB);\n  EXPECT_LT(kCaseA, kCaseB);\n  EXPECT_LE(kCaseA, kCaseB);\n  EXPECT_GT(kCaseB, kCaseA);\n  EXPECT_GE(kCaseA, kCaseA);\n  EXPECT_NONFATAL_FAILURE(EXPECT_GE(kCaseA, kCaseB),\n                          \"(kCaseA) >= (kCaseB)\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_GE(kCaseA, kCaseC),\n                          \"-1 vs 42\");\n\n  ASSERT_EQ(kCaseA, kCaseA);\n  ASSERT_NE(kCaseA, kCaseB);\n  ASSERT_LT(kCaseA, kCaseB);\n  ASSERT_LE(kCaseA, kCaseB);\n  ASSERT_GT(kCaseB, kCaseA);\n  ASSERT_GE(kCaseA, kCaseA);\n\n# ifndef __BORLANDC__\n\n  // ICE's in C++Builder.\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),\n                       \"Value of: kCaseB\");\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),\n                       \"Actual: 42\");\n# endif\n\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),\n                       \"Which is: -1\");\n}\n\n#endif  // !GTEST_OS_MAC && !defined(__SUNPRO_CC)\n\n#if GTEST_OS_WINDOWS\n\nstatic HRESULT UnexpectedHRESULTFailure() {\n  return E_UNEXPECTED;\n}\n\nstatic HRESULT OkHRESULTSuccess() {\n  return S_OK;\n}\n\nstatic HRESULT FalseHRESULTSuccess() {\n  return S_FALSE;\n}\n\n// HRESULT assertion tests test both zero and non-zero\n// success codes as well as failure message for each.\n//\n// Windows CE doesn't support message texts.\nTEST(HRESULTAssertionTest, EXPECT_HRESULT_SUCCEEDED) {\n  EXPECT_HRESULT_SUCCEEDED(S_OK);\n  EXPECT_HRESULT_SUCCEEDED(S_FALSE);\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_SUCCEEDED(UnexpectedHRESULTFailure()),\n    \"Expected: (UnexpectedHRESULTFailure()) succeeds.\\n\"\n    \"  Actual: 0x8000FFFF\");\n}\n\nTEST(HRESULTAssertionTest, ASSERT_HRESULT_SUCCEEDED) {\n  ASSERT_HRESULT_SUCCEEDED(S_OK);\n  ASSERT_HRESULT_SUCCEEDED(S_FALSE);\n\n  EXPECT_FATAL_FAILURE(ASSERT_HRESULT_SUCCEEDED(UnexpectedHRESULTFailure()),\n    \"Expected: (UnexpectedHRESULTFailure()) succeeds.\\n\"\n    \"  Actual: 0x8000FFFF\");\n}\n\nTEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) {\n  EXPECT_HRESULT_FAILED(E_UNEXPECTED);\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(OkHRESULTSuccess()),\n    \"Expected: (OkHRESULTSuccess()) fails.\\n\"\n    \"  Actual: 0x0\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(FalseHRESULTSuccess()),\n    \"Expected: (FalseHRESULTSuccess()) fails.\\n\"\n    \"  Actual: 0x1\");\n}\n\nTEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {\n  ASSERT_HRESULT_FAILED(E_UNEXPECTED);\n\n# ifndef __BORLANDC__\n\n  // ICE's in C++Builder 2007 and 2009.\n  EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),\n    \"Expected: (OkHRESULTSuccess()) fails.\\n\"\n    \"  Actual: 0x0\");\n# endif\n\n  EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),\n    \"Expected: (FalseHRESULTSuccess()) fails.\\n\"\n    \"  Actual: 0x1\");\n}\n\n// Tests that streaming to the HRESULT macros works.\nTEST(HRESULTAssertionTest, Streaming) {\n  EXPECT_HRESULT_SUCCEEDED(S_OK) << \"unexpected failure\";\n  ASSERT_HRESULT_SUCCEEDED(S_OK) << \"unexpected failure\";\n  EXPECT_HRESULT_FAILED(E_UNEXPECTED) << \"unexpected failure\";\n  ASSERT_HRESULT_FAILED(E_UNEXPECTED) << \"unexpected failure\";\n\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_HRESULT_SUCCEEDED(E_UNEXPECTED) << \"expected failure\",\n      \"expected failure\");\n\n# ifndef __BORLANDC__\n\n  // ICE's in C++Builder 2007 and 2009.\n  EXPECT_FATAL_FAILURE(\n      ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED) << \"expected failure\",\n      \"expected failure\");\n# endif\n\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_HRESULT_FAILED(S_OK) << \"expected failure\",\n      \"expected failure\");\n\n  EXPECT_FATAL_FAILURE(\n      ASSERT_HRESULT_FAILED(S_OK) << \"expected failure\",\n      \"expected failure\");\n}\n\n#endif  // GTEST_OS_WINDOWS\n\n#ifdef __BORLANDC__\n// Silences warnings: \"Condition is always true\", \"Unreachable code\"\n# pragma option push -w-ccc -w-rch\n#endif\n\n// Tests that the assertion macros behave like single statements.\nTEST(AssertionSyntaxTest, BasicAssertionsBehavesLikeSingleStatement) {\n  if (AlwaysFalse())\n    ASSERT_TRUE(false) << \"This should never be executed; \"\n                          \"It's a compilation test only.\";\n\n  if (AlwaysTrue())\n    EXPECT_FALSE(false);\n  else\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    ASSERT_LT(1, 3);\n\n  if (AlwaysFalse())\n    ;  // NOLINT\n  else\n    EXPECT_GT(3, 2) << \"\";\n}\n\n#if GTEST_HAS_EXCEPTIONS\n// Tests that the compiler will not complain about unreachable code in the\n// EXPECT_THROW/EXPECT_ANY_THROW/EXPECT_NO_THROW macros.\nTEST(ExpectThrowTest, DoesNotGenerateUnreachableCodeWarning) {\n  int n = 0;\n\n  EXPECT_THROW(throw 1, int);\n  EXPECT_NONFATAL_FAILURE(EXPECT_THROW(n++, int), \"\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_THROW(throw 1, const char*), \"\");\n  EXPECT_NO_THROW(n++);\n  EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(throw 1), \"\");\n  EXPECT_ANY_THROW(throw 1);\n  EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(n++), \"\");\n}\n\nTEST(AssertionSyntaxTest, ExceptionAssertionsBehavesLikeSingleStatement) {\n  if (AlwaysFalse())\n    EXPECT_THROW(ThrowNothing(), bool);\n\n  if (AlwaysTrue())\n    EXPECT_THROW(ThrowAnInteger(), int);\n  else\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    EXPECT_NO_THROW(ThrowAnInteger());\n\n  if (AlwaysTrue())\n    EXPECT_NO_THROW(ThrowNothing());\n  else\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    EXPECT_ANY_THROW(ThrowNothing());\n\n  if (AlwaysTrue())\n    EXPECT_ANY_THROW(ThrowAnInteger());\n  else\n    ;  // NOLINT\n}\n#endif  // GTEST_HAS_EXCEPTIONS\n\nTEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {\n  if (AlwaysFalse())\n    EXPECT_NO_FATAL_FAILURE(FAIL()) << \"This should never be executed. \"\n                                    << \"It's a compilation test only.\";\n  else\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    ASSERT_NO_FATAL_FAILURE(FAIL()) << \"\";\n  else\n    ;  // NOLINT\n\n  if (AlwaysTrue())\n    EXPECT_NO_FATAL_FAILURE(SUCCEED());\n  else\n    ;  // NOLINT\n\n  if (AlwaysFalse())\n    ;  // NOLINT\n  else\n    ASSERT_NO_FATAL_FAILURE(SUCCEED());\n}\n\n// Tests that the assertion macros work well with switch statements.\nTEST(AssertionSyntaxTest, WorksWithSwitch) {\n  switch (0) {\n    case 1:\n      break;\n    default:\n      ASSERT_TRUE(true);\n  }\n\n  switch (0)\n    case 0:\n      EXPECT_FALSE(false) << \"EXPECT_FALSE failed in switch case\";\n\n  // Binary assertions are implemented using a different code path\n  // than the Boolean assertions.  Hence we test them separately.\n  switch (0) {\n    case 1:\n    default:\n      ASSERT_EQ(1, 1) << \"ASSERT_EQ failed in default switch handler\";\n  }\n\n  switch (0)\n    case 0:\n      EXPECT_NE(1, 2);\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\nvoid ThrowAString() {\n    throw \"std::string\";\n}\n\n// Test that the exception assertion macros compile and work with const\n// type qualifier.\nTEST(AssertionSyntaxTest, WorksWithConst) {\n    ASSERT_THROW(ThrowAString(), const char*);\n\n    EXPECT_THROW(ThrowAString(), const char*);\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n}  // namespace\n\nnamespace testing {\n\n// Tests that Google Test tracks SUCCEED*.\nTEST(SuccessfulAssertionTest, SUCCEED) {\n  SUCCEED();\n  SUCCEED() << \"OK\";\n  EXPECT_EQ(2, GetUnitTestImpl()->current_test_result()->total_part_count());\n}\n\n// Tests that Google Test doesn't track successful EXPECT_*.\nTEST(SuccessfulAssertionTest, EXPECT) {\n  EXPECT_TRUE(true);\n  EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());\n}\n\n// Tests that Google Test doesn't track successful EXPECT_STR*.\nTEST(SuccessfulAssertionTest, EXPECT_STR) {\n  EXPECT_STREQ(\"\", \"\");\n  EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());\n}\n\n// Tests that Google Test doesn't track successful ASSERT_*.\nTEST(SuccessfulAssertionTest, ASSERT) {\n  ASSERT_TRUE(true);\n  EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());\n}\n\n// Tests that Google Test doesn't track successful ASSERT_STR*.\nTEST(SuccessfulAssertionTest, ASSERT_STR) {\n  ASSERT_STREQ(\"\", \"\");\n  EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());\n}\n\n}  // namespace testing\n\nnamespace {\n\n// Tests the message streaming variation of assertions.\n\nTEST(AssertionWithMessageTest, EXPECT) {\n  EXPECT_EQ(1, 1) << \"This should succeed.\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_NE(1, 1) << \"Expected failure #1.\",\n                          \"Expected failure #1\");\n  EXPECT_LE(1, 2) << \"This should succeed.\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_LT(1, 0) << \"Expected failure #2.\",\n                          \"Expected failure #2.\");\n  EXPECT_GE(1, 0) << \"This should succeed.\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_GT(1, 2) << \"Expected failure #3.\",\n                          \"Expected failure #3.\");\n\n  EXPECT_STREQ(\"1\", \"1\") << \"This should succeed.\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(\"1\", \"1\") << \"Expected failure #4.\",\n                          \"Expected failure #4.\");\n  EXPECT_STRCASEEQ(\"a\", \"A\") << \"This should succeed.\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRCASENE(\"a\", \"A\") << \"Expected failure #5.\",\n                          \"Expected failure #5.\");\n\n  EXPECT_FLOAT_EQ(1, 1) << \"This should succeed.\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1, 1.2) << \"Expected failure #6.\",\n                          \"Expected failure #6.\");\n  EXPECT_NEAR(1, 1.1, 0.2) << \"This should succeed.\";\n}\n\nTEST(AssertionWithMessageTest, ASSERT) {\n  ASSERT_EQ(1, 1) << \"This should succeed.\";\n  ASSERT_NE(1, 2) << \"This should succeed.\";\n  ASSERT_LE(1, 2) << \"This should succeed.\";\n  ASSERT_LT(1, 2) << \"This should succeed.\";\n  ASSERT_GE(1, 0) << \"This should succeed.\";\n  EXPECT_FATAL_FAILURE(ASSERT_GT(1, 2) << \"Expected failure.\",\n                       \"Expected failure.\");\n}\n\nTEST(AssertionWithMessageTest, ASSERT_STR) {\n  ASSERT_STREQ(\"1\", \"1\") << \"This should succeed.\";\n  ASSERT_STRNE(\"1\", \"2\") << \"This should succeed.\";\n  ASSERT_STRCASEEQ(\"a\", \"A\") << \"This should succeed.\";\n  EXPECT_FATAL_FAILURE(ASSERT_STRCASENE(\"a\", \"A\") << \"Expected failure.\",\n                       \"Expected failure.\");\n}\n\nTEST(AssertionWithMessageTest, ASSERT_FLOATING) {\n  ASSERT_FLOAT_EQ(1, 1) << \"This should succeed.\";\n  ASSERT_DOUBLE_EQ(1, 1) << \"This should succeed.\";\n  EXPECT_FATAL_FAILURE(ASSERT_NEAR(1,1.2, 0.1) << \"Expect failure.\",  // NOLINT\n                       \"Expect failure.\");\n  // To work around a bug in gcc 2.95.0, there is intentionally no\n  // space after the first comma in the previous statement.\n}\n\n// Tests using ASSERT_FALSE with a streamed message.\nTEST(AssertionWithMessageTest, ASSERT_FALSE) {\n  ASSERT_FALSE(false) << \"This shouldn't fail.\";\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_FALSE(true) << \"Expected failure: \" << 2 << \" > \" << 1\n                       << \" evaluates to \" << true;\n  }, \"Expected failure\");\n}\n\n// Tests using FAIL with a streamed message.\nTEST(AssertionWithMessageTest, FAIL) {\n  EXPECT_FATAL_FAILURE(FAIL() << 0,\n                       \"0\");\n}\n\n// Tests using SUCCEED with a streamed message.\nTEST(AssertionWithMessageTest, SUCCEED) {\n  SUCCEED() << \"Success == \" << 1;\n}\n\n// Tests using ASSERT_TRUE with a streamed message.\nTEST(AssertionWithMessageTest, ASSERT_TRUE) {\n  ASSERT_TRUE(true) << \"This should succeed.\";\n  ASSERT_TRUE(true) << true;\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_TRUE(false) << static_cast<const char *>(NULL)\n                       << static_cast<char *>(NULL);\n  }, \"(null)(null)\");\n}\n\n#if GTEST_OS_WINDOWS\n// Tests using wide strings in assertion messages.\nTEST(AssertionWithMessageTest, WideStringMessage) {\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_TRUE(false) << L\"This failure is expected.\\x8119\";\n  }, \"This failure is expected.\");\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_EQ(1, 2) << \"This failure is \"\n                    << L\"expected too.\\x8120\";\n  }, \"This failure is expected too.\");\n}\n#endif  // GTEST_OS_WINDOWS\n\n// Tests EXPECT_TRUE.\nTEST(ExpectTest, EXPECT_TRUE) {\n  EXPECT_TRUE(true) << \"Intentional success\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(false) << \"Intentional failure #1.\",\n                          \"Intentional failure #1.\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(false) << \"Intentional failure #2.\",\n                          \"Intentional failure #2.\");\n  EXPECT_TRUE(2 > 1);  // NOLINT\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(2 < 1),\n                          \"Value of: 2 < 1\\n\"\n                          \"  Actual: false\\n\"\n                          \"Expected: true\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(2 > 3),\n                          \"2 > 3\");\n}\n\n// Tests EXPECT_TRUE(predicate) for predicates returning AssertionResult.\nTEST(ExpectTest, ExpectTrueWithAssertionResult) {\n  EXPECT_TRUE(ResultIsEven(2));\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(ResultIsEven(3)),\n                          \"Value of: ResultIsEven(3)\\n\"\n                          \"  Actual: false (3 is odd)\\n\"\n                          \"Expected: true\");\n  EXPECT_TRUE(ResultIsEvenNoExplanation(2));\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(ResultIsEvenNoExplanation(3)),\n                          \"Value of: ResultIsEvenNoExplanation(3)\\n\"\n                          \"  Actual: false (3 is odd)\\n\"\n                          \"Expected: true\");\n}\n\n// Tests EXPECT_FALSE with a streamed message.\nTEST(ExpectTest, EXPECT_FALSE) {\n  EXPECT_FALSE(2 < 1);  // NOLINT\n  EXPECT_FALSE(false) << \"Intentional success\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(true) << \"Intentional failure #1.\",\n                          \"Intentional failure #1.\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(true) << \"Intentional failure #2.\",\n                          \"Intentional failure #2.\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(2 > 1),\n                          \"Value of: 2 > 1\\n\"\n                          \"  Actual: true\\n\"\n                          \"Expected: false\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(2 < 3),\n                          \"2 < 3\");\n}\n\n// Tests EXPECT_FALSE(predicate) for predicates returning AssertionResult.\nTEST(ExpectTest, ExpectFalseWithAssertionResult) {\n  EXPECT_FALSE(ResultIsEven(3));\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(ResultIsEven(2)),\n                          \"Value of: ResultIsEven(2)\\n\"\n                          \"  Actual: true (2 is even)\\n\"\n                          \"Expected: false\");\n  EXPECT_FALSE(ResultIsEvenNoExplanation(3));\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(ResultIsEvenNoExplanation(2)),\n                          \"Value of: ResultIsEvenNoExplanation(2)\\n\"\n                          \"  Actual: true\\n\"\n                          \"Expected: false\");\n}\n\n#ifdef __BORLANDC__\n// Restores warnings after previous \"#pragma option push\" supressed them\n# pragma option pop\n#endif\n\n// Tests EXPECT_EQ.\nTEST(ExpectTest, EXPECT_EQ) {\n  EXPECT_EQ(5, 2 + 3);\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2*3),\n                          \"Value of: 2*3\\n\"\n                          \"  Actual: 6\\n\"\n                          \"Expected: 5\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2 - 3),\n                          \"2 - 3\");\n}\n\n// Tests using EXPECT_EQ on double values.  The purpose is to make\n// sure that the specialization we did for integer and anonymous enums\n// isn't used for double arguments.\nTEST(ExpectTest, EXPECT_EQ_Double) {\n  // A success.\n  EXPECT_EQ(5.6, 5.6);\n\n  // A failure.\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5.1, 5.2),\n                          \"5.1\");\n}\n\n#if GTEST_CAN_COMPARE_NULL\n// Tests EXPECT_EQ(NULL, pointer).\nTEST(ExpectTest, EXPECT_EQ_NULL) {\n  // A success.\n  const char* p = NULL;\n  // Some older GCC versions may issue a spurious warning in this or the next\n  // assertion statement. This warning should not be suppressed with\n  // static_cast since the test verifies the ability to use bare NULL as the\n  // expected parameter to the macro.\n  EXPECT_EQ(NULL, p);\n\n  // A failure.\n  int n = 0;\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),\n                          \"Value of: &n\\n\");\n}\n#endif  // GTEST_CAN_COMPARE_NULL\n\n// Tests EXPECT_EQ(0, non_pointer).  Since the literal 0 can be\n// treated as a null pointer by the compiler, we need to make sure\n// that EXPECT_EQ(0, non_pointer) isn't interpreted by Google Test as\n// EXPECT_EQ(static_cast<void*>(NULL), non_pointer).\nTEST(ExpectTest, EXPECT_EQ_0) {\n  int n = 0;\n\n  // A success.\n  EXPECT_EQ(0, n);\n\n  // A failure.\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6),\n                          \"Expected: 0\");\n}\n\n// Tests EXPECT_NE.\nTEST(ExpectTest, EXPECT_NE) {\n  EXPECT_NE(6, 7);\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_NE('a', 'a'),\n                          \"Expected: ('a') != ('a'), \"\n                          \"actual: 'a' (97, 0x61) vs 'a' (97, 0x61)\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_NE(2, 2),\n                          \"2\");\n  char* const p0 = NULL;\n  EXPECT_NONFATAL_FAILURE(EXPECT_NE(p0, p0),\n                          \"p0\");\n  // Only way to get the Nokia compiler to compile the cast\n  // is to have a separate void* variable first. Putting\n  // the two casts on the same line doesn't work, neither does\n  // a direct C-style to char*.\n  void* pv1 = (void*)0x1234;  // NOLINT\n  char* const p1 = reinterpret_cast<char*>(pv1);\n  EXPECT_NONFATAL_FAILURE(EXPECT_NE(p1, p1),\n                          \"p1\");\n}\n\n// Tests EXPECT_LE.\nTEST(ExpectTest, EXPECT_LE) {\n  EXPECT_LE(2, 3);\n  EXPECT_LE(2, 2);\n  EXPECT_NONFATAL_FAILURE(EXPECT_LE(2, 0),\n                          \"Expected: (2) <= (0), actual: 2 vs 0\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_LE(1.1, 0.9),\n                          \"(1.1) <= (0.9)\");\n}\n\n// Tests EXPECT_LT.\nTEST(ExpectTest, EXPECT_LT) {\n  EXPECT_LT(2, 3);\n  EXPECT_NONFATAL_FAILURE(EXPECT_LT(2, 2),\n                          \"Expected: (2) < (2), actual: 2 vs 2\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_LT(2, 1),\n                          \"(2) < (1)\");\n}\n\n// Tests EXPECT_GE.\nTEST(ExpectTest, EXPECT_GE) {\n  EXPECT_GE(2, 1);\n  EXPECT_GE(2, 2);\n  EXPECT_NONFATAL_FAILURE(EXPECT_GE(2, 3),\n                          \"Expected: (2) >= (3), actual: 2 vs 3\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_GE(0.9, 1.1),\n                          \"(0.9) >= (1.1)\");\n}\n\n// Tests EXPECT_GT.\nTEST(ExpectTest, EXPECT_GT) {\n  EXPECT_GT(2, 1);\n  EXPECT_NONFATAL_FAILURE(EXPECT_GT(2, 2),\n                          \"Expected: (2) > (2), actual: 2 vs 2\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_GT(2, 3),\n                          \"(2) > (3)\");\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\n// Tests EXPECT_THROW.\nTEST(ExpectTest, EXPECT_THROW) {\n  EXPECT_THROW(ThrowAnInteger(), int);\n  EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnInteger(), bool),\n                          \"Expected: ThrowAnInteger() throws an exception of \"\n                          \"type bool.\\n  Actual: it throws a different type.\");\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_THROW(ThrowNothing(), bool),\n      \"Expected: ThrowNothing() throws an exception of type bool.\\n\"\n      \"  Actual: it throws nothing.\");\n}\n\n// Tests EXPECT_NO_THROW.\nTEST(ExpectTest, EXPECT_NO_THROW) {\n  EXPECT_NO_THROW(ThrowNothing());\n  EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnInteger()),\n                          \"Expected: ThrowAnInteger() doesn't throw an \"\n                          \"exception.\\n  Actual: it throws.\");\n}\n\n// Tests EXPECT_ANY_THROW.\nTEST(ExpectTest, EXPECT_ANY_THROW) {\n  EXPECT_ANY_THROW(ThrowAnInteger());\n  EXPECT_NONFATAL_FAILURE(\n      EXPECT_ANY_THROW(ThrowNothing()),\n      \"Expected: ThrowNothing() throws an exception.\\n\"\n      \"  Actual: it doesn't.\");\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// Make sure we deal with the precedence of <<.\nTEST(ExpectTest, ExpectPrecedence) {\n  EXPECT_EQ(1 < 2, true);\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),\n                          \"Value of: true && false\");\n}\n\n\n// Tests the StreamableToString() function.\n\n// Tests using StreamableToString() on a scalar.\nTEST(StreamableToStringTest, Scalar) {\n  EXPECT_STREQ(\"5\", StreamableToString(5).c_str());\n}\n\n// Tests using StreamableToString() on a non-char pointer.\nTEST(StreamableToStringTest, Pointer) {\n  int n = 0;\n  int* p = &n;\n  EXPECT_STRNE(\"(null)\", StreamableToString(p).c_str());\n}\n\n// Tests using StreamableToString() on a NULL non-char pointer.\nTEST(StreamableToStringTest, NullPointer) {\n  int* p = NULL;\n  EXPECT_STREQ(\"(null)\", StreamableToString(p).c_str());\n}\n\n// Tests using StreamableToString() on a C string.\nTEST(StreamableToStringTest, CString) {\n  EXPECT_STREQ(\"Foo\", StreamableToString(\"Foo\").c_str());\n}\n\n// Tests using StreamableToString() on a NULL C string.\nTEST(StreamableToStringTest, NullCString) {\n  char* p = NULL;\n  EXPECT_STREQ(\"(null)\", StreamableToString(p).c_str());\n}\n\n// Tests using streamable values as assertion messages.\n\n// Tests using std::string as an assertion message.\nTEST(StreamableTest, string) {\n  static const std::string str(\n      \"This failure message is a std::string, and is expected.\");\n  EXPECT_FATAL_FAILURE(FAIL() << str,\n                       str.c_str());\n}\n\n// Tests that we can output strings containing embedded NULs.\n// Limited to Linux because we can only do this with std::string's.\nTEST(StreamableTest, stringWithEmbeddedNUL) {\n  static const char char_array_with_nul[] =\n      \"Here's a NUL\\0 and some more string\";\n  static const std::string string_with_nul(char_array_with_nul,\n                                           sizeof(char_array_with_nul)\n                                           - 1);  // drops the trailing NUL\n  EXPECT_FATAL_FAILURE(FAIL() << string_with_nul,\n                       \"Here's a NUL\\\\0 and some more string\");\n}\n\n// Tests that we can output a NUL char.\nTEST(StreamableTest, NULChar) {\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    FAIL() << \"A NUL\" << '\\0' << \" and some more string\";\n  }, \"A NUL\\\\0 and some more string\");\n}\n\n// Tests using int as an assertion message.\nTEST(StreamableTest, int) {\n  EXPECT_FATAL_FAILURE(FAIL() << 900913,\n                       \"900913\");\n}\n\n// Tests using NULL char pointer as an assertion message.\n//\n// In MSVC, streaming a NULL char * causes access violation.  Google Test\n// implemented a workaround (substituting \"(null)\" for NULL).  This\n// tests whether the workaround works.\nTEST(StreamableTest, NullCharPtr) {\n  EXPECT_FATAL_FAILURE(FAIL() << static_cast<const char*>(NULL),\n                       \"(null)\");\n}\n\n// Tests that basic IO manipulators (endl, ends, and flush) can be\n// streamed to testing::Message.\nTEST(StreamableTest, BasicIoManip) {\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    FAIL() << \"Line 1.\" << std::endl\n           << \"A NUL char \" << std::ends << std::flush << \" in line 2.\";\n  }, \"Line 1.\\nA NUL char \\\\0 in line 2.\");\n}\n\n// Tests the macros that haven't been covered so far.\n\nvoid AddFailureHelper(bool* aborted) {\n  *aborted = true;\n  ADD_FAILURE() << \"Intentional failure.\";\n  *aborted = false;\n}\n\n// Tests ADD_FAILURE.\nTEST(MacroTest, ADD_FAILURE) {\n  bool aborted = true;\n  EXPECT_NONFATAL_FAILURE(AddFailureHelper(&aborted),\n                          \"Intentional failure.\");\n  EXPECT_FALSE(aborted);\n}\n\n// Tests ADD_FAILURE_AT.\nTEST(MacroTest, ADD_FAILURE_AT) {\n  // Verifies that ADD_FAILURE_AT does generate a nonfatal failure and\n  // the failure message contains the user-streamed part.\n  EXPECT_NONFATAL_FAILURE(ADD_FAILURE_AT(\"foo.cc\", 42) << \"Wrong!\", \"Wrong!\");\n\n  // Verifies that the user-streamed part is optional.\n  EXPECT_NONFATAL_FAILURE(ADD_FAILURE_AT(\"foo.cc\", 42), \"Failed\");\n\n  // Unfortunately, we cannot verify that the failure message contains\n  // the right file path and line number the same way, as\n  // EXPECT_NONFATAL_FAILURE() doesn't get to see the file path and\n  // line number.  Instead, we do that in gtest_output_test_.cc.\n}\n\n// Tests FAIL.\nTEST(MacroTest, FAIL) {\n  EXPECT_FATAL_FAILURE(FAIL(),\n                       \"Failed\");\n  EXPECT_FATAL_FAILURE(FAIL() << \"Intentional failure.\",\n                       \"Intentional failure.\");\n}\n\n// Tests SUCCEED\nTEST(MacroTest, SUCCEED) {\n  SUCCEED();\n  SUCCEED() << \"Explicit success.\";\n}\n\n// Tests for EXPECT_EQ() and ASSERT_EQ().\n//\n// These tests fail *intentionally*, s.t. the failure messages can be\n// generated and tested.\n//\n// We have different tests for different argument types.\n\n// Tests using bool values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, Bool) {\n  EXPECT_EQ(true,  true);\n  EXPECT_FATAL_FAILURE({\n      bool false_value = false;\n      ASSERT_EQ(false_value, true);\n    }, \"Value of: true\");\n}\n\n// Tests using int values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, Int) {\n  ASSERT_EQ(32, 32);\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(32, 33),\n                          \"33\");\n}\n\n// Tests using time_t values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, Time_T) {\n  EXPECT_EQ(static_cast<time_t>(0),\n            static_cast<time_t>(0));\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<time_t>(0),\n                                 static_cast<time_t>(1234)),\n                       \"1234\");\n}\n\n// Tests using char values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, Char) {\n  ASSERT_EQ('z', 'z');\n  const char ch = 'b';\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ('\\0', ch),\n                          \"ch\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ('a', ch),\n                          \"ch\");\n}\n\n// Tests using wchar_t values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, WideChar) {\n  EXPECT_EQ(L'b', L'b');\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'\\0', L'x'),\n                          \"Value of: L'x'\\n\"\n                          \"  Actual: L'x' (120, 0x78)\\n\"\n                          \"Expected: L'\\0'\\n\"\n                          \"Which is: L'\\0' (0, 0x0)\");\n\n  static wchar_t wchar;\n  wchar = L'b';\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'a', wchar),\n                          \"wchar\");\n  wchar = 0x8119;\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<wchar_t>(0x8120), wchar),\n                       \"Value of: wchar\");\n}\n\n// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, StdString) {\n  // Compares a const char* to an std::string that has identical\n  // content.\n  ASSERT_EQ(\"Test\", ::std::string(\"Test\"));\n\n  // Compares two identical std::strings.\n  static const ::std::string str1(\"A * in the middle\");\n  static const ::std::string str2(str1);\n  EXPECT_EQ(str1, str2);\n\n  // Compares a const char* to an std::string that has different\n  // content\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(\"Test\", ::std::string(\"test\")),\n                          \"\\\"test\\\"\");\n\n  // Compares an std::string to a char* that has different content.\n  char* const p1 = const_cast<char*>(\"foo\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(::std::string(\"bar\"), p1),\n                          \"p1\");\n\n  // Compares two std::strings that have different contents, one of\n  // which having a NUL character in the middle.  This should fail.\n  static ::std::string str3(str1);\n  str3.at(2) = '\\0';\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),\n                       \"Value of: str3\\n\"\n                       \"  Actual: \\\"A \\\\0 in the middle\\\"\");\n}\n\n#if GTEST_HAS_STD_WSTRING\n\n// Tests using ::std::wstring values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, StdWideString) {\n  // Compares two identical std::wstrings.\n  const ::std::wstring wstr1(L\"A * in the middle\");\n  const ::std::wstring wstr2(wstr1);\n  ASSERT_EQ(wstr1, wstr2);\n\n  // Compares an std::wstring to a const wchar_t* that has identical\n  // content.\n  const wchar_t kTestX8119[] = { 'T', 'e', 's', 't', 0x8119, '\\0' };\n  EXPECT_EQ(::std::wstring(kTestX8119), kTestX8119);\n\n  // Compares an std::wstring to a const wchar_t* that has different\n  // content.\n  const wchar_t kTestX8120[] = { 'T', 'e', 's', 't', 0x8120, '\\0' };\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_EQ(::std::wstring(kTestX8119), kTestX8120);\n  }, \"kTestX8120\");\n\n  // Compares two std::wstrings that have different contents, one of\n  // which having a NUL character in the middle.\n  ::std::wstring wstr3(wstr1);\n  wstr3.at(2) = L'\\0';\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(wstr1, wstr3),\n                          \"wstr3\");\n\n  // Compares a wchar_t* to an std::wstring that has different\n  // content.\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_EQ(const_cast<wchar_t*>(L\"foo\"), ::std::wstring(L\"bar\"));\n  }, \"\");\n}\n\n#endif  // GTEST_HAS_STD_WSTRING\n\n#if GTEST_HAS_GLOBAL_STRING\n// Tests using ::string values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, GlobalString) {\n  // Compares a const char* to a ::string that has identical content.\n  EXPECT_EQ(\"Test\", ::string(\"Test\"));\n\n  // Compares two identical ::strings.\n  const ::string str1(\"A * in the middle\");\n  const ::string str2(str1);\n  ASSERT_EQ(str1, str2);\n\n  // Compares a ::string to a const char* that has different content.\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(::string(\"Test\"), \"test\"),\n                          \"test\");\n\n  // Compares two ::strings that have different contents, one of which\n  // having a NUL character in the middle.\n  ::string str3(str1);\n  str3.at(2) = '\\0';\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(str1, str3),\n                          \"str3\");\n\n  // Compares a ::string to a char* that has different content.\n  EXPECT_FATAL_FAILURE({  // NOLINT\n    ASSERT_EQ(::string(\"bar\"), const_cast<char*>(\"foo\"));\n  }, \"\");\n}\n\n#endif  // GTEST_HAS_GLOBAL_STRING\n\n#if GTEST_HAS_GLOBAL_WSTRING\n\n// Tests using ::wstring values in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, GlobalWideString) {\n  // Compares two identical ::wstrings.\n  static const ::wstring wstr1(L\"A * in the middle\");\n  static const ::wstring wstr2(wstr1);\n  EXPECT_EQ(wstr1, wstr2);\n\n  // Compares a const wchar_t* to a ::wstring that has identical content.\n  const wchar_t kTestX8119[] = { 'T', 'e', 's', 't', 0x8119, '\\0' };\n  ASSERT_EQ(kTestX8119, ::wstring(kTestX8119));\n\n  // Compares a const wchar_t* to a ::wstring that has different\n  // content.\n  const wchar_t kTestX8120[] = { 'T', 'e', 's', 't', 0x8120, '\\0' };\n  EXPECT_NONFATAL_FAILURE({  // NOLINT\n    EXPECT_EQ(kTestX8120, ::wstring(kTestX8119));\n  }, \"Test\\\\x8119\");\n\n  // Compares a wchar_t* to a ::wstring that has different content.\n  wchar_t* const p1 = const_cast<wchar_t*>(L\"foo\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, ::wstring(L\"bar\")),\n                          \"bar\");\n\n  // Compares two ::wstrings that have different contents, one of which\n  // having a NUL character in the middle.\n  static ::wstring wstr3;\n  wstr3 = wstr1;\n  wstr3.at(2) = L'\\0';\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(wstr1, wstr3),\n                       \"wstr3\");\n}\n\n#endif  // GTEST_HAS_GLOBAL_WSTRING\n\n// Tests using char pointers in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, CharPointer) {\n  char* const p0 = NULL;\n  // Only way to get the Nokia compiler to compile the cast\n  // is to have a separate void* variable first. Putting\n  // the two casts on the same line doesn't work, neither does\n  // a direct C-style to char*.\n  void* pv1 = (void*)0x1234;  // NOLINT\n  void* pv2 = (void*)0xABC0;  // NOLINT\n  char* const p1 = reinterpret_cast<char*>(pv1);\n  char* const p2 = reinterpret_cast<char*>(pv2);\n  ASSERT_EQ(p1, p1);\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),\n                          \"Value of: p2\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),\n                          \"p2\");\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),\n                                 reinterpret_cast<char*>(0xABC0)),\n                       \"ABC0\");\n}\n\n// Tests using wchar_t pointers in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, WideCharPointer) {\n  wchar_t* const p0 = NULL;\n  // Only way to get the Nokia compiler to compile the cast\n  // is to have a separate void* variable first. Putting\n  // the two casts on the same line doesn't work, neither does\n  // a direct C-style to char*.\n  void* pv1 = (void*)0x1234;  // NOLINT\n  void* pv2 = (void*)0xABC0;  // NOLINT\n  wchar_t* const p1 = reinterpret_cast<wchar_t*>(pv1);\n  wchar_t* const p2 = reinterpret_cast<wchar_t*>(pv2);\n  EXPECT_EQ(p0, p0);\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),\n                          \"Value of: p2\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),\n                          \"p2\");\n  void* pv3 = (void*)0x1234;  // NOLINT\n  void* pv4 = (void*)0xABC0;  // NOLINT\n  const wchar_t* p3 = reinterpret_cast<const wchar_t*>(pv3);\n  const wchar_t* p4 = reinterpret_cast<const wchar_t*>(pv4);\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p3, p4),\n                          \"p4\");\n}\n\n// Tests using other types of pointers in {EXPECT|ASSERT}_EQ.\nTEST(EqAssertionTest, OtherPointer) {\n  ASSERT_EQ(static_cast<const int*>(NULL),\n            static_cast<const int*>(NULL));\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<const int*>(NULL),\n                                 reinterpret_cast<const int*>(0x1234)),\n                       \"0x1234\");\n}\n\n// A class that supports binary comparison operators but not streaming.\nclass UnprintableChar {\n public:\n  explicit UnprintableChar(char ch) : char_(ch) {}\n\n  bool operator==(const UnprintableChar& rhs) const {\n    return char_ == rhs.char_;\n  }\n  bool operator!=(const UnprintableChar& rhs) const {\n    return char_ != rhs.char_;\n  }\n  bool operator<(const UnprintableChar& rhs) const {\n    return char_ < rhs.char_;\n  }\n  bool operator<=(const UnprintableChar& rhs) const {\n    return char_ <= rhs.char_;\n  }\n  bool operator>(const UnprintableChar& rhs) const {\n    return char_ > rhs.char_;\n  }\n  bool operator>=(const UnprintableChar& rhs) const {\n    return char_ >= rhs.char_;\n  }\n\n private:\n  char char_;\n};\n\n// Tests that ASSERT_EQ() and friends don't require the arguments to\n// be printable.\nTEST(ComparisonAssertionTest, AcceptsUnprintableArgs) {\n  const UnprintableChar x('x'), y('y');\n  ASSERT_EQ(x, x);\n  EXPECT_NE(x, y);\n  ASSERT_LT(x, y);\n  EXPECT_LE(x, y);\n  ASSERT_GT(y, x);\n  EXPECT_GE(x, x);\n\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y), \"1-byte object <78>\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y), \"1-byte object <79>\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_LT(y, y), \"1-byte object <79>\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_GT(x, y), \"1-byte object <78>\");\n  EXPECT_NONFATAL_FAILURE(EXPECT_GT(x, y), \"1-byte object <79>\");\n\n  // Code tested by EXPECT_FATAL_FAILURE cannot reference local\n  // variables, so we have to write UnprintableChar('x') instead of x.\n#ifndef __BORLANDC__\n  // ICE's in C++Builder.\n  EXPECT_FATAL_FAILURE(ASSERT_NE(UnprintableChar('x'), UnprintableChar('x')),\n                       \"1-byte object <78>\");\n  EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),\n                       \"1-byte object <78>\");\n#endif\n  EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),\n                       \"1-byte object <79>\");\n  EXPECT_FATAL_FAILURE(ASSERT_GE(UnprintableChar('x'), UnprintableChar('y')),\n                       \"1-byte object <78>\");\n  EXPECT_FATAL_FAILURE(ASSERT_GE(UnprintableChar('x'), UnprintableChar('y')),\n                       \"1-byte object <79>\");\n}\n\n// Tests the FRIEND_TEST macro.\n\n// This class has a private member we want to test.  We will test it\n// both in a TEST and in a TEST_F.\nclass Foo {\n public:\n  Foo() {}\n\n private:\n  int Bar() const { return 1; }\n\n  // Declares the friend tests that can access the private member\n  // Bar().\n  FRIEND_TEST(FRIEND_TEST_Test, TEST);\n  FRIEND_TEST(FRIEND_TEST_Test2, TEST_F);\n};\n\n// Tests that the FRIEND_TEST declaration allows a TEST to access a\n// class's private members.  This should compile.\nTEST(FRIEND_TEST_Test, TEST) {\n  ASSERT_EQ(1, Foo().Bar());\n}\n\n// The fixture needed to test using FRIEND_TEST with TEST_F.\nclass FRIEND_TEST_Test2 : public Test {\n protected:\n  Foo foo;\n};\n\n// Tests that the FRIEND_TEST declaration allows a TEST_F to access a\n// class's private members.  This should compile.\nTEST_F(FRIEND_TEST_Test2, TEST_F) {\n  ASSERT_EQ(1, foo.Bar());\n}\n\n// Tests the life cycle of Test objects.\n\n// The test fixture for testing the life cycle of Test objects.\n//\n// This class counts the number of live test objects that uses this\n// fixture.\nclass TestLifeCycleTest : public Test {\n protected:\n  // Constructor.  Increments the number of test objects that uses\n  // this fixture.\n  TestLifeCycleTest() { count_++; }\n\n  // Destructor.  Decrements the number of test objects that uses this\n  // fixture.\n  ~TestLifeCycleTest() { count_--; }\n\n  // Returns the number of live test objects that uses this fixture.\n  int count() const { return count_; }\n\n private:\n  static int count_;\n};\n\nint TestLifeCycleTest::count_ = 0;\n\n// Tests the life cycle of test objects.\nTEST_F(TestLifeCycleTest, Test1) {\n  // There should be only one test object in this test case that's\n  // currently alive.\n  ASSERT_EQ(1, count());\n}\n\n// Tests the life cycle of test objects.\nTEST_F(TestLifeCycleTest, Test2) {\n  // After Test1 is done and Test2 is started, there should still be\n  // only one live test object, as the object for Test1 should've been\n  // deleted.\n  ASSERT_EQ(1, count());\n}\n\n}  // namespace\n\n// Tests that the copy constructor works when it is NOT optimized away by\n// the compiler.\nTEST(AssertionResultTest, CopyConstructorWorksWhenNotOptimied) {\n  // Checks that the copy constructor doesn't try to dereference NULL pointers\n  // in the source object.\n  AssertionResult r1 = AssertionSuccess();\n  AssertionResult r2 = r1;\n  // The following line is added to prevent the compiler from optimizing\n  // away the constructor call.\n  r1 << \"abc\";\n\n  AssertionResult r3 = r1;\n  EXPECT_EQ(static_cast<bool>(r3), static_cast<bool>(r1));\n  EXPECT_STREQ(\"abc\", r1.message());\n}\n\n// Tests that AssertionSuccess and AssertionFailure construct\n// AssertionResult objects as expected.\nTEST(AssertionResultTest, ConstructionWorks) {\n  AssertionResult r1 = AssertionSuccess();\n  EXPECT_TRUE(r1);\n  EXPECT_STREQ(\"\", r1.message());\n\n  AssertionResult r2 = AssertionSuccess() << \"abc\";\n  EXPECT_TRUE(r2);\n  EXPECT_STREQ(\"abc\", r2.message());\n\n  AssertionResult r3 = AssertionFailure();\n  EXPECT_FALSE(r3);\n  EXPECT_STREQ(\"\", r3.message());\n\n  AssertionResult r4 = AssertionFailure() << \"def\";\n  EXPECT_FALSE(r4);\n  EXPECT_STREQ(\"def\", r4.message());\n\n  AssertionResult r5 = AssertionFailure(Message() << \"ghi\");\n  EXPECT_FALSE(r5);\n  EXPECT_STREQ(\"ghi\", r5.message());\n}\n\n// Tests that the negation flips the predicate result but keeps the message.\nTEST(AssertionResultTest, NegationWorks) {\n  AssertionResult r1 = AssertionSuccess() << \"abc\";\n  EXPECT_FALSE(!r1);\n  EXPECT_STREQ(\"abc\", (!r1).message());\n\n  AssertionResult r2 = AssertionFailure() << \"def\";\n  EXPECT_TRUE(!r2);\n  EXPECT_STREQ(\"def\", (!r2).message());\n}\n\nTEST(AssertionResultTest, StreamingWorks) {\n  AssertionResult r = AssertionSuccess();\n  r << \"abc\" << 'd' << 0 << true;\n  EXPECT_STREQ(\"abcd0true\", r.message());\n}\n\nTEST(AssertionResultTest, CanStreamOstreamManipulators) {\n  AssertionResult r = AssertionSuccess();\n  r << \"Data\" << std::endl << std::flush << std::ends << \"Will be visible\";\n  EXPECT_STREQ(\"Data\\n\\\\0Will be visible\", r.message());\n}\n\n// Tests streaming a user type whose definition and operator << are\n// both in the global namespace.\nclass Base {\n public:\n  explicit Base(int an_x) : x_(an_x) {}\n  int x() const { return x_; }\n private:\n  int x_;\n};\nstd::ostream& operator<<(std::ostream& os,\n                         const Base& val) {\n  return os << val.x();\n}\nstd::ostream& operator<<(std::ostream& os,\n                         const Base* pointer) {\n  return os << \"(\" << pointer->x() << \")\";\n}\n\nTEST(MessageTest, CanStreamUserTypeInGlobalNameSpace) {\n  Message msg;\n  Base a(1);\n\n  msg << a << &a;  // Uses ::operator<<.\n  EXPECT_STREQ(\"1(1)\", msg.GetString().c_str());\n}\n\n// Tests streaming a user type whose definition and operator<< are\n// both in an unnamed namespace.\nnamespace {\nclass MyTypeInUnnamedNameSpace : public Base {\n public:\n  explicit MyTypeInUnnamedNameSpace(int an_x): Base(an_x) {}\n};\nstd::ostream& operator<<(std::ostream& os,\n                         const MyTypeInUnnamedNameSpace& val) {\n  return os << val.x();\n}\nstd::ostream& operator<<(std::ostream& os,\n                         const MyTypeInUnnamedNameSpace* pointer) {\n  return os << \"(\" << pointer->x() << \")\";\n}\n}  // namespace\n\nTEST(MessageTest, CanStreamUserTypeInUnnamedNameSpace) {\n  Message msg;\n  MyTypeInUnnamedNameSpace a(1);\n\n  msg << a << &a;  // Uses <unnamed_namespace>::operator<<.\n  EXPECT_STREQ(\"1(1)\", msg.GetString().c_str());\n}\n\n// Tests streaming a user type whose definition and operator<< are\n// both in a user namespace.\nnamespace namespace1 {\nclass MyTypeInNameSpace1 : public Base {\n public:\n  explicit MyTypeInNameSpace1(int an_x): Base(an_x) {}\n};\nstd::ostream& operator<<(std::ostream& os,\n                         const MyTypeInNameSpace1& val) {\n  return os << val.x();\n}\nstd::ostream& operator<<(std::ostream& os,\n                         const MyTypeInNameSpace1* pointer) {\n  return os << \"(\" << pointer->x() << \")\";\n}\n}  // namespace namespace1\n\nTEST(MessageTest, CanStreamUserTypeInUserNameSpace) {\n  Message msg;\n  namespace1::MyTypeInNameSpace1 a(1);\n\n  msg << a << &a;  // Uses namespace1::operator<<.\n  EXPECT_STREQ(\"1(1)\", msg.GetString().c_str());\n}\n\n// Tests streaming a user type whose definition is in a user namespace\n// but whose operator<< is in the global namespace.\nnamespace namespace2 {\nclass MyTypeInNameSpace2 : public ::Base {\n public:\n  explicit MyTypeInNameSpace2(int an_x): Base(an_x) {}\n};\n}  // namespace namespace2\nstd::ostream& operator<<(std::ostream& os,\n                         const namespace2::MyTypeInNameSpace2& val) {\n  return os << val.x();\n}\nstd::ostream& operator<<(std::ostream& os,\n                         const namespace2::MyTypeInNameSpace2* pointer) {\n  return os << \"(\" << pointer->x() << \")\";\n}\n\nTEST(MessageTest, CanStreamUserTypeInUserNameSpaceWithStreamOperatorInGlobal) {\n  Message msg;\n  namespace2::MyTypeInNameSpace2 a(1);\n\n  msg << a << &a;  // Uses ::operator<<.\n  EXPECT_STREQ(\"1(1)\", msg.GetString().c_str());\n}\n\n// Tests streaming NULL pointers to testing::Message.\nTEST(MessageTest, NullPointers) {\n  Message msg;\n  char* const p1 = NULL;\n  unsigned char* const p2 = NULL;\n  int* p3 = NULL;\n  double* p4 = NULL;\n  bool* p5 = NULL;\n  Message* p6 = NULL;\n\n  msg << p1 << p2 << p3 << p4 << p5 << p6;\n  ASSERT_STREQ(\"(null)(null)(null)(null)(null)(null)\",\n               msg.GetString().c_str());\n}\n\n// Tests streaming wide strings to testing::Message.\nTEST(MessageTest, WideStrings) {\n  // Streams a NULL of type const wchar_t*.\n  const wchar_t* const_wstr = NULL;\n  EXPECT_STREQ(\"(null)\",\n               (Message() << const_wstr).GetString().c_str());\n\n  // Streams a NULL of type wchar_t*.\n  wchar_t* wstr = NULL;\n  EXPECT_STREQ(\"(null)\",\n               (Message() << wstr).GetString().c_str());\n\n  // Streams a non-NULL of type const wchar_t*.\n  const_wstr = L\"abc\\x8119\";\n  EXPECT_STREQ(\"abc\\xe8\\x84\\x99\",\n               (Message() << const_wstr).GetString().c_str());\n\n  // Streams a non-NULL of type wchar_t*.\n  wstr = const_cast<wchar_t*>(const_wstr);\n  EXPECT_STREQ(\"abc\\xe8\\x84\\x99\",\n               (Message() << wstr).GetString().c_str());\n}\n\n\n// This line tests that we can define tests in the testing namespace.\nnamespace testing {\n\n// Tests the TestInfo class.\n\nclass TestInfoTest : public Test {\n protected:\n  static const TestInfo* GetTestInfo(const char* test_name) {\n    const TestCase* const test_case = GetUnitTestImpl()->\n        GetTestCase(\"TestInfoTest\", \"\", NULL, NULL);\n\n    for (int i = 0; i < test_case->total_test_count(); ++i) {\n      const TestInfo* const test_info = test_case->GetTestInfo(i);\n      if (strcmp(test_name, test_info->name()) == 0)\n        return test_info;\n    }\n    return NULL;\n  }\n\n  static const TestResult* GetTestResult(\n      const TestInfo* test_info) {\n    return test_info->result();\n  }\n};\n\n// Tests TestInfo::test_case_name() and TestInfo::name().\nTEST_F(TestInfoTest, Names) {\n  const TestInfo* const test_info = GetTestInfo(\"Names\");\n\n  ASSERT_STREQ(\"TestInfoTest\", test_info->test_case_name());\n  ASSERT_STREQ(\"Names\", test_info->name());\n}\n\n// Tests TestInfo::result().\nTEST_F(TestInfoTest, result) {\n  const TestInfo* const test_info = GetTestInfo(\"result\");\n\n  // Initially, there is no TestPartResult for this test.\n  ASSERT_EQ(0, GetTestResult(test_info)->total_part_count());\n\n  // After the previous assertion, there is still none.\n  ASSERT_EQ(0, GetTestResult(test_info)->total_part_count());\n}\n\n// Tests setting up and tearing down a test case.\n\nclass SetUpTestCaseTest : public Test {\n protected:\n  // This will be called once before the first test in this test case\n  // is run.\n  static void SetUpTestCase() {\n    printf(\"Setting up the test case . . .\\n\");\n\n    // Initializes some shared resource.  In this simple example, we\n    // just create a C string.  More complex stuff can be done if\n    // desired.\n    shared_resource_ = \"123\";\n\n    // Increments the number of test cases that have been set up.\n    counter_++;\n\n    // SetUpTestCase() should be called only once.\n    EXPECT_EQ(1, counter_);\n  }\n\n  // This will be called once after the last test in this test case is\n  // run.\n  static void TearDownTestCase() {\n    printf(\"Tearing down the test case . . .\\n\");\n\n    // Decrements the number of test cases that have been set up.\n    counter_--;\n\n    // TearDownTestCase() should be called only once.\n    EXPECT_EQ(0, counter_);\n\n    // Cleans up the shared resource.\n    shared_resource_ = NULL;\n  }\n\n  // This will be called before each test in this test case.\n  virtual void SetUp() {\n    // SetUpTestCase() should be called only once, so counter_ should\n    // always be 1.\n    EXPECT_EQ(1, counter_);\n  }\n\n  // Number of test cases that have been set up.\n  static int counter_;\n\n  // Some resource to be shared by all tests in this test case.\n  static const char* shared_resource_;\n};\n\nint SetUpTestCaseTest::counter_ = 0;\nconst char* SetUpTestCaseTest::shared_resource_ = NULL;\n\n// A test that uses the shared resource.\nTEST_F(SetUpTestCaseTest, Test1) {\n  EXPECT_STRNE(NULL, shared_resource_);\n}\n\n// Another test that uses the shared resource.\nTEST_F(SetUpTestCaseTest, Test2) {\n  EXPECT_STREQ(\"123\", shared_resource_);\n}\n\n// The InitGoogleTestTest test case tests testing::InitGoogleTest().\n\n// The Flags struct stores a copy of all Google Test flags.\nstruct Flags {\n  // Constructs a Flags struct where each flag has its default value.\n  Flags() : also_run_disabled_tests(false),\n            break_on_failure(false),\n            catch_exceptions(false),\n            death_test_use_fork(false),\n            filter(\"\"),\n            list_tests(false),\n            output(\"\"),\n            print_time(true),\n            random_seed(0),\n            repeat(1),\n            shuffle(false),\n            stack_trace_depth(kMaxStackTraceDepth),\n            stream_result_to(\"\"),\n            throw_on_failure(false) {}\n\n  // Factory methods.\n\n  // Creates a Flags struct where the gtest_also_run_disabled_tests flag has\n  // the given value.\n  static Flags AlsoRunDisabledTests(bool also_run_disabled_tests) {\n    Flags flags;\n    flags.also_run_disabled_tests = also_run_disabled_tests;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_break_on_failure flag has\n  // the given value.\n  static Flags BreakOnFailure(bool break_on_failure) {\n    Flags flags;\n    flags.break_on_failure = break_on_failure;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_catch_exceptions flag has\n  // the given value.\n  static Flags CatchExceptions(bool catch_exceptions) {\n    Flags flags;\n    flags.catch_exceptions = catch_exceptions;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_death_test_use_fork flag has\n  // the given value.\n  static Flags DeathTestUseFork(bool death_test_use_fork) {\n    Flags flags;\n    flags.death_test_use_fork = death_test_use_fork;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_filter flag has the given\n  // value.\n  static Flags Filter(const char* filter) {\n    Flags flags;\n    flags.filter = filter;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_list_tests flag has the\n  // given value.\n  static Flags ListTests(bool list_tests) {\n    Flags flags;\n    flags.list_tests = list_tests;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_output flag has the given\n  // value.\n  static Flags Output(const char* output) {\n    Flags flags;\n    flags.output = output;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_print_time flag has the given\n  // value.\n  static Flags PrintTime(bool print_time) {\n    Flags flags;\n    flags.print_time = print_time;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_random_seed flag has\n  // the given value.\n  static Flags RandomSeed(Int32 random_seed) {\n    Flags flags;\n    flags.random_seed = random_seed;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_repeat flag has the given\n  // value.\n  static Flags Repeat(Int32 repeat) {\n    Flags flags;\n    flags.repeat = repeat;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_shuffle flag has\n  // the given value.\n  static Flags Shuffle(bool shuffle) {\n    Flags flags;\n    flags.shuffle = shuffle;\n    return flags;\n  }\n\n  // Creates a Flags struct where the GTEST_FLAG(stack_trace_depth) flag has\n  // the given value.\n  static Flags StackTraceDepth(Int32 stack_trace_depth) {\n    Flags flags;\n    flags.stack_trace_depth = stack_trace_depth;\n    return flags;\n  }\n\n  // Creates a Flags struct where the GTEST_FLAG(stream_result_to) flag has\n  // the given value.\n  static Flags StreamResultTo(const char* stream_result_to) {\n    Flags flags;\n    flags.stream_result_to = stream_result_to;\n    return flags;\n  }\n\n  // Creates a Flags struct where the gtest_throw_on_failure flag has\n  // the given value.\n  static Flags ThrowOnFailure(bool throw_on_failure) {\n    Flags flags;\n    flags.throw_on_failure = throw_on_failure;\n    return flags;\n  }\n\n  // These fields store the flag values.\n  bool also_run_disabled_tests;\n  bool break_on_failure;\n  bool catch_exceptions;\n  bool death_test_use_fork;\n  const char* filter;\n  bool list_tests;\n  const char* output;\n  bool print_time;\n  Int32 random_seed;\n  Int32 repeat;\n  bool shuffle;\n  Int32 stack_trace_depth;\n  const char* stream_result_to;\n  bool throw_on_failure;\n};\n\n// Fixture for testing InitGoogleTest().\nclass InitGoogleTestTest : public Test {\n protected:\n  // Clears the flags before each test.\n  virtual void SetUp() {\n    GTEST_FLAG(also_run_disabled_tests) = false;\n    GTEST_FLAG(break_on_failure) = false;\n    GTEST_FLAG(catch_exceptions) = false;\n    GTEST_FLAG(death_test_use_fork) = false;\n    GTEST_FLAG(filter) = \"\";\n    GTEST_FLAG(list_tests) = false;\n    GTEST_FLAG(output) = \"\";\n    GTEST_FLAG(print_time) = true;\n    GTEST_FLAG(random_seed) = 0;\n    GTEST_FLAG(repeat) = 1;\n    GTEST_FLAG(shuffle) = false;\n    GTEST_FLAG(stack_trace_depth) = kMaxStackTraceDepth;\n    GTEST_FLAG(stream_result_to) = \"\";\n    GTEST_FLAG(throw_on_failure) = false;\n  }\n\n  // Asserts that two narrow or wide string arrays are equal.\n  template <typename CharType>\n  static void AssertStringArrayEq(size_t size1, CharType** array1,\n                                  size_t size2, CharType** array2) {\n    ASSERT_EQ(size1, size2) << \" Array sizes different.\";\n\n    for (size_t i = 0; i != size1; i++) {\n      ASSERT_STREQ(array1[i], array2[i]) << \" where i == \" << i;\n    }\n  }\n\n  // Verifies that the flag values match the expected values.\n  static void CheckFlags(const Flags& expected) {\n    EXPECT_EQ(expected.also_run_disabled_tests,\n              GTEST_FLAG(also_run_disabled_tests));\n    EXPECT_EQ(expected.break_on_failure, GTEST_FLAG(break_on_failure));\n    EXPECT_EQ(expected.catch_exceptions, GTEST_FLAG(catch_exceptions));\n    EXPECT_EQ(expected.death_test_use_fork, GTEST_FLAG(death_test_use_fork));\n    EXPECT_STREQ(expected.filter, GTEST_FLAG(filter).c_str());\n    EXPECT_EQ(expected.list_tests, GTEST_FLAG(list_tests));\n    EXPECT_STREQ(expected.output, GTEST_FLAG(output).c_str());\n    EXPECT_EQ(expected.print_time, GTEST_FLAG(print_time));\n    EXPECT_EQ(expected.random_seed, GTEST_FLAG(random_seed));\n    EXPECT_EQ(expected.repeat, GTEST_FLAG(repeat));\n    EXPECT_EQ(expected.shuffle, GTEST_FLAG(shuffle));\n    EXPECT_EQ(expected.stack_trace_depth, GTEST_FLAG(stack_trace_depth));\n    EXPECT_STREQ(expected.stream_result_to,\n                 GTEST_FLAG(stream_result_to).c_str());\n    EXPECT_EQ(expected.throw_on_failure, GTEST_FLAG(throw_on_failure));\n  }\n\n  // Parses a command line (specified by argc1 and argv1), then\n  // verifies that the flag values are expected and that the\n  // recognized flags are removed from the command line.\n  template <typename CharType>\n  static void TestParsingFlags(int argc1, const CharType** argv1,\n                               int argc2, const CharType** argv2,\n                               const Flags& expected, bool should_print_help) {\n    const bool saved_help_flag = ::testing::internal::g_help_flag;\n    ::testing::internal::g_help_flag = false;\n\n#if GTEST_HAS_STREAM_REDIRECTION\n    CaptureStdout();\n#endif\n\n    // Parses the command line.\n    internal::ParseGoogleTestFlagsOnly(&argc1, const_cast<CharType**>(argv1));\n\n#if GTEST_HAS_STREAM_REDIRECTION\n    const std::string captured_stdout = GetCapturedStdout();\n#endif\n\n    // Verifies the flag values.\n    CheckFlags(expected);\n\n    // Verifies that the recognized flags are removed from the command\n    // line.\n    AssertStringArrayEq(argc1 + 1, argv1, argc2 + 1, argv2);\n\n    // ParseGoogleTestFlagsOnly should neither set g_help_flag nor print the\n    // help message for the flags it recognizes.\n    EXPECT_EQ(should_print_help, ::testing::internal::g_help_flag);\n\n#if GTEST_HAS_STREAM_REDIRECTION\n    const char* const expected_help_fragment =\n        \"This program contains tests written using\";\n    if (should_print_help) {\n      EXPECT_PRED_FORMAT2(IsSubstring, expected_help_fragment, captured_stdout);\n    } else {\n      EXPECT_PRED_FORMAT2(IsNotSubstring,\n                          expected_help_fragment, captured_stdout);\n    }\n#endif  // GTEST_HAS_STREAM_REDIRECTION\n\n    ::testing::internal::g_help_flag = saved_help_flag;\n  }\n\n  // This macro wraps TestParsingFlags s.t. the user doesn't need\n  // to specify the array sizes.\n\n#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \\\n  TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \\\n                   sizeof(argv2)/sizeof(*argv2) - 1, argv2, \\\n                   expected, should_print_help)\n};\n\n// Tests parsing an empty command line.\nTEST_F(InitGoogleTestTest, Empty) {\n  const char* argv[] = {\n    NULL\n  };\n\n  const char* argv2[] = {\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false);\n}\n\n// Tests parsing a command line that has no flag.\nTEST_F(InitGoogleTestTest, NoFlag) {\n  const char* argv[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false);\n}\n\n// Tests parsing a bad --gtest_filter flag.\nTEST_F(InitGoogleTestTest, FilterBad) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_filter\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    \"--gtest_filter\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(\"\"), true);\n}\n\n// Tests parsing an empty --gtest_filter flag.\nTEST_F(InitGoogleTestTest, FilterEmpty) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_filter=\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(\"\"), false);\n}\n\n// Tests parsing a non-empty --gtest_filter flag.\nTEST_F(InitGoogleTestTest, FilterNonEmpty) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_filter=abc\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(\"abc\"), false);\n}\n\n// Tests parsing --gtest_break_on_failure.\nTEST_F(InitGoogleTestTest, BreakOnFailureWithoutValue) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_break_on_failure\",\n    NULL\n};\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false);\n}\n\n// Tests parsing --gtest_break_on_failure=0.\nTEST_F(InitGoogleTestTest, BreakOnFailureFalse_0) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_break_on_failure=0\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false);\n}\n\n// Tests parsing --gtest_break_on_failure=f.\nTEST_F(InitGoogleTestTest, BreakOnFailureFalse_f) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_break_on_failure=f\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false);\n}\n\n// Tests parsing --gtest_break_on_failure=F.\nTEST_F(InitGoogleTestTest, BreakOnFailureFalse_F) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_break_on_failure=F\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false);\n}\n\n// Tests parsing a --gtest_break_on_failure flag that has a \"true\"\n// definition.\nTEST_F(InitGoogleTestTest, BreakOnFailureTrue) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_break_on_failure=1\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false);\n}\n\n// Tests parsing --gtest_catch_exceptions.\nTEST_F(InitGoogleTestTest, CatchExceptions) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_catch_exceptions\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::CatchExceptions(true), false);\n}\n\n// Tests parsing --gtest_death_test_use_fork.\nTEST_F(InitGoogleTestTest, DeathTestUseFork) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_death_test_use_fork\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::DeathTestUseFork(true), false);\n}\n\n// Tests having the same flag twice with different values.  The\n// expected behavior is that the one coming last takes precedence.\nTEST_F(InitGoogleTestTest, DuplicatedFlags) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_filter=a\",\n    \"--gtest_filter=b\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(\"b\"), false);\n}\n\n// Tests having an unrecognized flag on the command line.\nTEST_F(InitGoogleTestTest, UnrecognizedFlag) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_break_on_failure\",\n    \"bar\",  // Unrecognized by Google Test.\n    \"--gtest_filter=b\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    \"bar\",\n    NULL\n  };\n\n  Flags flags;\n  flags.break_on_failure = true;\n  flags.filter = \"b\";\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, flags, false);\n}\n\n// Tests having a --gtest_list_tests flag\nTEST_F(InitGoogleTestTest, ListTestsFlag) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_list_tests\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false);\n}\n\n// Tests having a --gtest_list_tests flag with a \"true\" value\nTEST_F(InitGoogleTestTest, ListTestsTrue) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_list_tests=1\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false);\n}\n\n// Tests having a --gtest_list_tests flag with a \"false\" value\nTEST_F(InitGoogleTestTest, ListTestsFalse) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_list_tests=0\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false);\n}\n\n// Tests parsing --gtest_list_tests=f.\nTEST_F(InitGoogleTestTest, ListTestsFalse_f) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_list_tests=f\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false);\n}\n\n// Tests parsing --gtest_list_tests=F.\nTEST_F(InitGoogleTestTest, ListTestsFalse_F) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_list_tests=F\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false);\n}\n\n// Tests parsing --gtest_output (invalid).\nTEST_F(InitGoogleTestTest, OutputEmpty) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_output\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    \"--gtest_output\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true);\n}\n\n// Tests parsing --gtest_output=xml\nTEST_F(InitGoogleTestTest, OutputXml) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_output=xml\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output(\"xml\"), false);\n}\n\n// Tests parsing --gtest_output=xml:file\nTEST_F(InitGoogleTestTest, OutputXmlFile) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_output=xml:file\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output(\"xml:file\"), false);\n}\n\n// Tests parsing --gtest_output=xml:directory/path/\nTEST_F(InitGoogleTestTest, OutputXmlDirectory) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_output=xml:directory/path/\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2,\n                            Flags::Output(\"xml:directory/path/\"), false);\n}\n\n// Tests having a --gtest_print_time flag\nTEST_F(InitGoogleTestTest, PrintTimeFlag) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_print_time\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false);\n}\n\n// Tests having a --gtest_print_time flag with a \"true\" value\nTEST_F(InitGoogleTestTest, PrintTimeTrue) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_print_time=1\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false);\n}\n\n// Tests having a --gtest_print_time flag with a \"false\" value\nTEST_F(InitGoogleTestTest, PrintTimeFalse) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_print_time=0\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false);\n}\n\n// Tests parsing --gtest_print_time=f.\nTEST_F(InitGoogleTestTest, PrintTimeFalse_f) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_print_time=f\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false);\n}\n\n// Tests parsing --gtest_print_time=F.\nTEST_F(InitGoogleTestTest, PrintTimeFalse_F) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_print_time=F\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false);\n}\n\n// Tests parsing --gtest_random_seed=number\nTEST_F(InitGoogleTestTest, RandomSeed) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_random_seed=1000\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::RandomSeed(1000), false);\n}\n\n// Tests parsing --gtest_repeat=number\nTEST_F(InitGoogleTestTest, Repeat) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_repeat=1000\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Repeat(1000), false);\n}\n\n// Tests having a --gtest_also_run_disabled_tests flag\nTEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFlag) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_also_run_disabled_tests\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2,\n                              Flags::AlsoRunDisabledTests(true), false);\n}\n\n// Tests having a --gtest_also_run_disabled_tests flag with a \"true\" value\nTEST_F(InitGoogleTestTest, AlsoRunDisabledTestsTrue) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_also_run_disabled_tests=1\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2,\n                              Flags::AlsoRunDisabledTests(true), false);\n}\n\n// Tests having a --gtest_also_run_disabled_tests flag with a \"false\" value\nTEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFalse) {\n    const char* argv[] = {\n      \"foo.exe\",\n      \"--gtest_also_run_disabled_tests=0\",\n      NULL\n    };\n\n    const char* argv2[] = {\n      \"foo.exe\",\n      NULL\n    };\n\n    GTEST_TEST_PARSING_FLAGS_(argv, argv2,\n                              Flags::AlsoRunDisabledTests(false), false);\n}\n\n// Tests parsing --gtest_shuffle.\nTEST_F(InitGoogleTestTest, ShuffleWithoutValue) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_shuffle\",\n    NULL\n};\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false);\n}\n\n// Tests parsing --gtest_shuffle=0.\nTEST_F(InitGoogleTestTest, ShuffleFalse_0) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_shuffle=0\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(false), false);\n}\n\n// Tests parsing a --gtest_shuffle flag that has a \"true\"\n// definition.\nTEST_F(InitGoogleTestTest, ShuffleTrue) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_shuffle=1\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false);\n}\n\n// Tests parsing --gtest_stack_trace_depth=number.\nTEST_F(InitGoogleTestTest, StackTraceDepth) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_stack_trace_depth=5\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::StackTraceDepth(5), false);\n}\n\nTEST_F(InitGoogleTestTest, StreamResultTo) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_stream_result_to=localhost:1234\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(\n      argv, argv2, Flags::StreamResultTo(\"localhost:1234\"), false);\n}\n\n// Tests parsing --gtest_throw_on_failure.\nTEST_F(InitGoogleTestTest, ThrowOnFailureWithoutValue) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_throw_on_failure\",\n    NULL\n};\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(true), false);\n}\n\n// Tests parsing --gtest_throw_on_failure=0.\nTEST_F(InitGoogleTestTest, ThrowOnFailureFalse_0) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_throw_on_failure=0\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(false), false);\n}\n\n// Tests parsing a --gtest_throw_on_failure flag that has a \"true\"\n// definition.\nTEST_F(InitGoogleTestTest, ThrowOnFailureTrue) {\n  const char* argv[] = {\n    \"foo.exe\",\n    \"--gtest_throw_on_failure=1\",\n    NULL\n  };\n\n  const char* argv2[] = {\n    \"foo.exe\",\n    NULL\n  };\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(true), false);\n}\n\n#if GTEST_OS_WINDOWS\n// Tests parsing wide strings.\nTEST_F(InitGoogleTestTest, WideStrings) {\n  const wchar_t* argv[] = {\n    L\"foo.exe\",\n    L\"--gtest_filter=Foo*\",\n    L\"--gtest_list_tests=1\",\n    L\"--gtest_break_on_failure\",\n    L\"--non_gtest_flag\",\n    NULL\n  };\n\n  const wchar_t* argv2[] = {\n    L\"foo.exe\",\n    L\"--non_gtest_flag\",\n    NULL\n  };\n\n  Flags expected_flags;\n  expected_flags.break_on_failure = true;\n  expected_flags.filter = \"Foo*\";\n  expected_flags.list_tests = true;\n\n  GTEST_TEST_PARSING_FLAGS_(argv, argv2, expected_flags, false);\n}\n#endif  // GTEST_OS_WINDOWS\n\n// Tests current_test_info() in UnitTest.\nclass CurrentTestInfoTest : public Test {\n protected:\n  // Tests that current_test_info() returns NULL before the first test in\n  // the test case is run.\n  static void SetUpTestCase() {\n    // There should be no tests running at this point.\n    const TestInfo* test_info =\n      UnitTest::GetInstance()->current_test_info();\n    EXPECT_TRUE(test_info == NULL)\n        << \"There should be no tests running at this point.\";\n  }\n\n  // Tests that current_test_info() returns NULL after the last test in\n  // the test case has run.\n  static void TearDownTestCase() {\n    const TestInfo* test_info =\n      UnitTest::GetInstance()->current_test_info();\n    EXPECT_TRUE(test_info == NULL)\n        << \"There should be no tests running at this point.\";\n  }\n};\n\n// Tests that current_test_info() returns TestInfo for currently running\n// test by checking the expected test name against the actual one.\nTEST_F(CurrentTestInfoTest, WorksForFirstTestInATestCase) {\n  const TestInfo* test_info =\n    UnitTest::GetInstance()->current_test_info();\n  ASSERT_TRUE(NULL != test_info)\n      << \"There is a test running so we should have a valid TestInfo.\";\n  EXPECT_STREQ(\"CurrentTestInfoTest\", test_info->test_case_name())\n      << \"Expected the name of the currently running test case.\";\n  EXPECT_STREQ(\"WorksForFirstTestInATestCase\", test_info->name())\n      << \"Expected the name of the currently running test.\";\n}\n\n// Tests that current_test_info() returns TestInfo for currently running\n// test by checking the expected test name against the actual one.  We\n// use this test to see that the TestInfo object actually changed from\n// the previous invocation.\nTEST_F(CurrentTestInfoTest, WorksForSecondTestInATestCase) {\n  const TestInfo* test_info =\n    UnitTest::GetInstance()->current_test_info();\n  ASSERT_TRUE(NULL != test_info)\n      << \"There is a test running so we should have a valid TestInfo.\";\n  EXPECT_STREQ(\"CurrentTestInfoTest\", test_info->test_case_name())\n      << \"Expected the name of the currently running test case.\";\n  EXPECT_STREQ(\"WorksForSecondTestInATestCase\", test_info->name())\n      << \"Expected the name of the currently running test.\";\n}\n\n}  // namespace testing\n\n// These two lines test that we can define tests in a namespace that\n// has the name \"testing\" and is nested in another namespace.\nnamespace my_namespace {\nnamespace testing {\n\n// Makes sure that TEST knows to use ::testing::Test instead of\n// ::my_namespace::testing::Test.\nclass Test {};\n\n// Makes sure that an assertion knows to use ::testing::Message instead of\n// ::my_namespace::testing::Message.\nclass Message {};\n\n// Makes sure that an assertion knows to use\n// ::testing::AssertionResult instead of\n// ::my_namespace::testing::AssertionResult.\nclass AssertionResult {};\n\n// Tests that an assertion that should succeed works as expected.\nTEST(NestedTestingNamespaceTest, Success) {\n  EXPECT_EQ(1, 1) << \"This shouldn't fail.\";\n}\n\n// Tests that an assertion that should fail works as expected.\nTEST(NestedTestingNamespaceTest, Failure) {\n  EXPECT_FATAL_FAILURE(FAIL() << \"This failure is expected.\",\n                       \"This failure is expected.\");\n}\n\n}  // namespace testing\n}  // namespace my_namespace\n\n// Tests that one can call superclass SetUp and TearDown methods--\n// that is, that they are not private.\n// No tests are based on this fixture; the test \"passes\" if it compiles\n// successfully.\nclass ProtectedFixtureMethodsTest : public Test {\n protected:\n  virtual void SetUp() {\n    Test::SetUp();\n  }\n  virtual void TearDown() {\n    Test::TearDown();\n  }\n};\n\n// StreamingAssertionsTest tests the streaming versions of a representative\n// sample of assertions.\nTEST(StreamingAssertionsTest, Unconditional) {\n  SUCCEED() << \"expected success\";\n  EXPECT_NONFATAL_FAILURE(ADD_FAILURE() << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(FAIL() << \"expected failure\",\n                       \"expected failure\");\n}\n\n#ifdef __BORLANDC__\n// Silences warnings: \"Condition is always true\", \"Unreachable code\"\n# pragma option push -w-ccc -w-rch\n#endif\n\nTEST(StreamingAssertionsTest, Truth) {\n  EXPECT_TRUE(true) << \"unexpected failure\";\n  ASSERT_TRUE(true) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(false) << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_TRUE(false) << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, Truth2) {\n  EXPECT_FALSE(false) << \"unexpected failure\";\n  ASSERT_FALSE(false) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(true) << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_FALSE(true) << \"expected failure\",\n                       \"expected failure\");\n}\n\n#ifdef __BORLANDC__\n// Restores warnings after previous \"#pragma option push\" supressed them\n# pragma option pop\n#endif\n\nTEST(StreamingAssertionsTest, IntegerEquals) {\n  EXPECT_EQ(1, 1) << \"unexpected failure\";\n  ASSERT_EQ(1, 1) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(1, 2) << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_EQ(1, 2) << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, IntegerLessThan) {\n  EXPECT_LT(1, 2) << \"unexpected failure\";\n  ASSERT_LT(1, 2) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_LT(2, 1) << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_LT(2, 1) << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, StringsEqual) {\n  EXPECT_STREQ(\"foo\", \"foo\") << \"unexpected failure\";\n  ASSERT_STREQ(\"foo\", \"foo\") << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(\"foo\", \"bar\") << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_STREQ(\"foo\", \"bar\") << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, StringsNotEqual) {\n  EXPECT_STRNE(\"foo\", \"bar\") << \"unexpected failure\";\n  ASSERT_STRNE(\"foo\", \"bar\") << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(\"foo\", \"foo\") << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_STRNE(\"foo\", \"foo\") << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, StringsEqualIgnoringCase) {\n  EXPECT_STRCASEEQ(\"foo\", \"FOO\") << \"unexpected failure\";\n  ASSERT_STRCASEEQ(\"foo\", \"FOO\") << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRCASEEQ(\"foo\", \"bar\") << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_STRCASEEQ(\"foo\", \"bar\") << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, StringNotEqualIgnoringCase) {\n  EXPECT_STRCASENE(\"foo\", \"bar\") << \"unexpected failure\";\n  ASSERT_STRCASENE(\"foo\", \"bar\") << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_STRCASENE(\"foo\", \"FOO\") << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_STRCASENE(\"bar\", \"BAR\") << \"expected failure\",\n                       \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, FloatingPointEquals) {\n  EXPECT_FLOAT_EQ(1.0, 1.0) << \"unexpected failure\";\n  ASSERT_FLOAT_EQ(1.0, 1.0) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(0.0, 1.0) << \"expected failure\",\n                          \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(0.0, 1.0) << \"expected failure\",\n                       \"expected failure\");\n}\n\n#if GTEST_HAS_EXCEPTIONS\n\nTEST(StreamingAssertionsTest, Throw) {\n  EXPECT_THROW(ThrowAnInteger(), int) << \"unexpected failure\";\n  ASSERT_THROW(ThrowAnInteger(), int) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnInteger(), bool) <<\n                          \"expected failure\", \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_THROW(ThrowAnInteger(), bool) <<\n                       \"expected failure\", \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, NoThrow) {\n  EXPECT_NO_THROW(ThrowNothing()) << \"unexpected failure\";\n  ASSERT_NO_THROW(ThrowNothing()) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnInteger()) <<\n                          \"expected failure\", \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnInteger()) <<\n                       \"expected failure\", \"expected failure\");\n}\n\nTEST(StreamingAssertionsTest, AnyThrow) {\n  EXPECT_ANY_THROW(ThrowAnInteger()) << \"unexpected failure\";\n  ASSERT_ANY_THROW(ThrowAnInteger()) << \"unexpected failure\";\n  EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(ThrowNothing()) <<\n                          \"expected failure\", \"expected failure\");\n  EXPECT_FATAL_FAILURE(ASSERT_ANY_THROW(ThrowNothing()) <<\n                       \"expected failure\", \"expected failure\");\n}\n\n#endif  // GTEST_HAS_EXCEPTIONS\n\n// Tests that Google Test correctly decides whether to use colors in the output.\n\nTEST(ColoredOutputTest, UsesColorsWhenGTestColorFlagIsYes) {\n  GTEST_FLAG(color) = \"yes\";\n\n  SetEnv(\"TERM\", \"xterm\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n  EXPECT_TRUE(ShouldUseColor(false));  // Stdout is not a TTY.\n\n  SetEnv(\"TERM\", \"dumb\");  // TERM doesn't support colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n  EXPECT_TRUE(ShouldUseColor(false));  // Stdout is not a TTY.\n}\n\nTEST(ColoredOutputTest, UsesColorsWhenGTestColorFlagIsAliasOfYes) {\n  SetEnv(\"TERM\", \"dumb\");  // TERM doesn't support colors.\n\n  GTEST_FLAG(color) = \"True\";\n  EXPECT_TRUE(ShouldUseColor(false));  // Stdout is not a TTY.\n\n  GTEST_FLAG(color) = \"t\";\n  EXPECT_TRUE(ShouldUseColor(false));  // Stdout is not a TTY.\n\n  GTEST_FLAG(color) = \"1\";\n  EXPECT_TRUE(ShouldUseColor(false));  // Stdout is not a TTY.\n}\n\nTEST(ColoredOutputTest, UsesNoColorWhenGTestColorFlagIsNo) {\n  GTEST_FLAG(color) = \"no\";\n\n  SetEnv(\"TERM\", \"xterm\");  // TERM supports colors.\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n  EXPECT_FALSE(ShouldUseColor(false));  // Stdout is not a TTY.\n\n  SetEnv(\"TERM\", \"dumb\");  // TERM doesn't support colors.\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n  EXPECT_FALSE(ShouldUseColor(false));  // Stdout is not a TTY.\n}\n\nTEST(ColoredOutputTest, UsesNoColorWhenGTestColorFlagIsInvalid) {\n  SetEnv(\"TERM\", \"xterm\");  // TERM supports colors.\n\n  GTEST_FLAG(color) = \"F\";\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  GTEST_FLAG(color) = \"0\";\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  GTEST_FLAG(color) = \"unknown\";\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n}\n\nTEST(ColoredOutputTest, UsesColorsWhenStdoutIsTty) {\n  GTEST_FLAG(color) = \"auto\";\n\n  SetEnv(\"TERM\", \"xterm\");  // TERM supports colors.\n  EXPECT_FALSE(ShouldUseColor(false));  // Stdout is not a TTY.\n  EXPECT_TRUE(ShouldUseColor(true));    // Stdout is a TTY.\n}\n\nTEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {\n  GTEST_FLAG(color) = \"auto\";\n\n#if GTEST_OS_WINDOWS\n  // On Windows, we ignore the TERM variable as it's usually not set.\n\n  SetEnv(\"TERM\", \"dumb\");\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"\");\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"xterm\");\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n#else\n  // On non-Windows platforms, we rely on TERM to determine if the\n  // terminal supports colors.\n\n  SetEnv(\"TERM\", \"dumb\");  // TERM doesn't support colors.\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"emacs\");  // TERM doesn't support colors.\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"vt100\");  // TERM doesn't support colors.\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"xterm-mono\");  // TERM doesn't support colors.\n  EXPECT_FALSE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"xterm\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"xterm-color\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"xterm-256color\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"screen\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"screen-256color\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"linux\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n\n  SetEnv(\"TERM\", \"cygwin\");  // TERM supports colors.\n  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.\n#endif  // GTEST_OS_WINDOWS\n}\n\n// Verifies that StaticAssertTypeEq works in a namespace scope.\n\nstatic bool dummy1 GTEST_ATTRIBUTE_UNUSED_ = StaticAssertTypeEq<bool, bool>();\nstatic bool dummy2 GTEST_ATTRIBUTE_UNUSED_ =\n    StaticAssertTypeEq<const int, const int>();\n\n// Verifies that StaticAssertTypeEq works in a class.\n\ntemplate <typename T>\nclass StaticAssertTypeEqTestHelper {\n public:\n  StaticAssertTypeEqTestHelper() { StaticAssertTypeEq<bool, T>(); }\n};\n\nTEST(StaticAssertTypeEqTest, WorksInClass) {\n  StaticAssertTypeEqTestHelper<bool>();\n}\n\n// Verifies that StaticAssertTypeEq works inside a function.\n\ntypedef int IntAlias;\n\nTEST(StaticAssertTypeEqTest, CompilesForEqualTypes) {\n  StaticAssertTypeEq<int, IntAlias>();\n  StaticAssertTypeEq<int*, IntAlias*>();\n}\n\nTEST(GetCurrentOsStackTraceExceptTopTest, ReturnsTheStackTrace) {\n  testing::UnitTest* const unit_test = testing::UnitTest::GetInstance();\n\n  // We don't have a stack walker in Google Test yet.\n  EXPECT_STREQ(\"\", GetCurrentOsStackTraceExceptTop(unit_test, 0).c_str());\n  EXPECT_STREQ(\"\", GetCurrentOsStackTraceExceptTop(unit_test, 1).c_str());\n}\n\nTEST(HasNonfatalFailureTest, ReturnsFalseWhenThereIsNoFailure) {\n  EXPECT_FALSE(HasNonfatalFailure());\n}\n\nstatic void FailFatally() { FAIL(); }\n\nTEST(HasNonfatalFailureTest, ReturnsFalseWhenThereIsOnlyFatalFailure) {\n  FailFatally();\n  const bool has_nonfatal_failure = HasNonfatalFailure();\n  ClearCurrentTestPartResults();\n  EXPECT_FALSE(has_nonfatal_failure);\n}\n\nTEST(HasNonfatalFailureTest, ReturnsTrueWhenThereIsNonfatalFailure) {\n  ADD_FAILURE();\n  const bool has_nonfatal_failure = HasNonfatalFailure();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_nonfatal_failure);\n}\n\nTEST(HasNonfatalFailureTest, ReturnsTrueWhenThereAreFatalAndNonfatalFailures) {\n  FailFatally();\n  ADD_FAILURE();\n  const bool has_nonfatal_failure = HasNonfatalFailure();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_nonfatal_failure);\n}\n\n// A wrapper for calling HasNonfatalFailure outside of a test body.\nstatic bool HasNonfatalFailureHelper() {\n  return testing::Test::HasNonfatalFailure();\n}\n\nTEST(HasNonfatalFailureTest, WorksOutsideOfTestBody) {\n  EXPECT_FALSE(HasNonfatalFailureHelper());\n}\n\nTEST(HasNonfatalFailureTest, WorksOutsideOfTestBody2) {\n  ADD_FAILURE();\n  const bool has_nonfatal_failure = HasNonfatalFailureHelper();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_nonfatal_failure);\n}\n\nTEST(HasFailureTest, ReturnsFalseWhenThereIsNoFailure) {\n  EXPECT_FALSE(HasFailure());\n}\n\nTEST(HasFailureTest, ReturnsTrueWhenThereIsFatalFailure) {\n  FailFatally();\n  const bool has_failure = HasFailure();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_failure);\n}\n\nTEST(HasFailureTest, ReturnsTrueWhenThereIsNonfatalFailure) {\n  ADD_FAILURE();\n  const bool has_failure = HasFailure();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_failure);\n}\n\nTEST(HasFailureTest, ReturnsTrueWhenThereAreFatalAndNonfatalFailures) {\n  FailFatally();\n  ADD_FAILURE();\n  const bool has_failure = HasFailure();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_failure);\n}\n\n// A wrapper for calling HasFailure outside of a test body.\nstatic bool HasFailureHelper() { return testing::Test::HasFailure(); }\n\nTEST(HasFailureTest, WorksOutsideOfTestBody) {\n  EXPECT_FALSE(HasFailureHelper());\n}\n\nTEST(HasFailureTest, WorksOutsideOfTestBody2) {\n  ADD_FAILURE();\n  const bool has_failure = HasFailureHelper();\n  ClearCurrentTestPartResults();\n  EXPECT_TRUE(has_failure);\n}\n\nclass TestListener : public EmptyTestEventListener {\n public:\n  TestListener() : on_start_counter_(NULL), is_destroyed_(NULL) {}\n  TestListener(int* on_start_counter, bool* is_destroyed)\n      : on_start_counter_(on_start_counter),\n        is_destroyed_(is_destroyed) {}\n\n  virtual ~TestListener() {\n    if (is_destroyed_)\n      *is_destroyed_ = true;\n  }\n\n protected:\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {\n    if (on_start_counter_ != NULL)\n      (*on_start_counter_)++;\n  }\n\n private:\n  int* on_start_counter_;\n  bool* is_destroyed_;\n};\n\n// Tests the constructor.\nTEST(TestEventListenersTest, ConstructionWorks) {\n  TestEventListeners listeners;\n\n  EXPECT_TRUE(TestEventListenersAccessor::GetRepeater(&listeners) != NULL);\n  EXPECT_TRUE(listeners.default_result_printer() == NULL);\n  EXPECT_TRUE(listeners.default_xml_generator() == NULL);\n}\n\n// Tests that the TestEventListeners destructor deletes all the listeners it\n// owns.\nTEST(TestEventListenersTest, DestructionWorks) {\n  bool default_result_printer_is_destroyed = false;\n  bool default_xml_printer_is_destroyed = false;\n  bool extra_listener_is_destroyed = false;\n  TestListener* default_result_printer = new TestListener(\n      NULL, &default_result_printer_is_destroyed);\n  TestListener* default_xml_printer = new TestListener(\n      NULL, &default_xml_printer_is_destroyed);\n  TestListener* extra_listener = new TestListener(\n      NULL, &extra_listener_is_destroyed);\n\n  {\n    TestEventListeners listeners;\n    TestEventListenersAccessor::SetDefaultResultPrinter(&listeners,\n                                                        default_result_printer);\n    TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners,\n                                                       default_xml_printer);\n    listeners.Append(extra_listener);\n  }\n  EXPECT_TRUE(default_result_printer_is_destroyed);\n  EXPECT_TRUE(default_xml_printer_is_destroyed);\n  EXPECT_TRUE(extra_listener_is_destroyed);\n}\n\n// Tests that a listener Append'ed to a TestEventListeners list starts\n// receiving events.\nTEST(TestEventListenersTest, Append) {\n  int on_start_counter = 0;\n  bool is_destroyed = false;\n  TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);\n  {\n    TestEventListeners listeners;\n    listeners.Append(listener);\n    TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n        *UnitTest::GetInstance());\n    EXPECT_EQ(1, on_start_counter);\n  }\n  EXPECT_TRUE(is_destroyed);\n}\n\n// Tests that listeners receive events in the order they were appended to\n// the list, except for *End requests, which must be received in the reverse\n// order.\nclass SequenceTestingListener : public EmptyTestEventListener {\n public:\n  SequenceTestingListener(std::vector<std::string>* vector, const char* id)\n      : vector_(vector), id_(id) {}\n\n protected:\n  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {\n    vector_->push_back(GetEventDescription(\"OnTestProgramStart\"));\n  }\n\n  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {\n    vector_->push_back(GetEventDescription(\"OnTestProgramEnd\"));\n  }\n\n  virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,\n                                    int /*iteration*/) {\n    vector_->push_back(GetEventDescription(\"OnTestIterationStart\"));\n  }\n\n  virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,\n                                  int /*iteration*/) {\n    vector_->push_back(GetEventDescription(\"OnTestIterationEnd\"));\n  }\n\n private:\n  std::string GetEventDescription(const char* method) {\n    Message message;\n    message << id_ << \".\" << method;\n    return message.GetString();\n  }\n\n  std::vector<std::string>* vector_;\n  const char* const id_;\n\n  GTEST_DISALLOW_COPY_AND_ASSIGN_(SequenceTestingListener);\n};\n\nTEST(EventListenerTest, AppendKeepsOrder) {\n  std::vector<std::string> vec;\n  TestEventListeners listeners;\n  listeners.Append(new SequenceTestingListener(&vec, \"1st\"));\n  listeners.Append(new SequenceTestingListener(&vec, \"2nd\"));\n  listeners.Append(new SequenceTestingListener(&vec, \"3rd\"));\n\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n      *UnitTest::GetInstance());\n  ASSERT_EQ(3U, vec.size());\n  EXPECT_STREQ(\"1st.OnTestProgramStart\", vec[0].c_str());\n  EXPECT_STREQ(\"2nd.OnTestProgramStart\", vec[1].c_str());\n  EXPECT_STREQ(\"3rd.OnTestProgramStart\", vec[2].c_str());\n\n  vec.clear();\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramEnd(\n      *UnitTest::GetInstance());\n  ASSERT_EQ(3U, vec.size());\n  EXPECT_STREQ(\"3rd.OnTestProgramEnd\", vec[0].c_str());\n  EXPECT_STREQ(\"2nd.OnTestProgramEnd\", vec[1].c_str());\n  EXPECT_STREQ(\"1st.OnTestProgramEnd\", vec[2].c_str());\n\n  vec.clear();\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestIterationStart(\n      *UnitTest::GetInstance(), 0);\n  ASSERT_EQ(3U, vec.size());\n  EXPECT_STREQ(\"1st.OnTestIterationStart\", vec[0].c_str());\n  EXPECT_STREQ(\"2nd.OnTestIterationStart\", vec[1].c_str());\n  EXPECT_STREQ(\"3rd.OnTestIterationStart\", vec[2].c_str());\n\n  vec.clear();\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestIterationEnd(\n      *UnitTest::GetInstance(), 0);\n  ASSERT_EQ(3U, vec.size());\n  EXPECT_STREQ(\"3rd.OnTestIterationEnd\", vec[0].c_str());\n  EXPECT_STREQ(\"2nd.OnTestIterationEnd\", vec[1].c_str());\n  EXPECT_STREQ(\"1st.OnTestIterationEnd\", vec[2].c_str());\n}\n\n// Tests that a listener removed from a TestEventListeners list stops receiving\n// events and is not deleted when the list is destroyed.\nTEST(TestEventListenersTest, Release) {\n  int on_start_counter = 0;\n  bool is_destroyed = false;\n  // Although Append passes the ownership of this object to the list,\n  // the following calls release it, and we need to delete it before the\n  // test ends.\n  TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);\n  {\n    TestEventListeners listeners;\n    listeners.Append(listener);\n    EXPECT_EQ(listener, listeners.Release(listener));\n    TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n        *UnitTest::GetInstance());\n    EXPECT_TRUE(listeners.Release(listener) == NULL);\n  }\n  EXPECT_EQ(0, on_start_counter);\n  EXPECT_FALSE(is_destroyed);\n  delete listener;\n}\n\n// Tests that no events are forwarded when event forwarding is disabled.\nTEST(EventListenerTest, SuppressEventForwarding) {\n  int on_start_counter = 0;\n  TestListener* listener = new TestListener(&on_start_counter, NULL);\n\n  TestEventListeners listeners;\n  listeners.Append(listener);\n  ASSERT_TRUE(TestEventListenersAccessor::EventForwardingEnabled(listeners));\n  TestEventListenersAccessor::SuppressEventForwarding(&listeners);\n  ASSERT_FALSE(TestEventListenersAccessor::EventForwardingEnabled(listeners));\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n      *UnitTest::GetInstance());\n  EXPECT_EQ(0, on_start_counter);\n}\n\n// Tests that events generated by Google Test are not forwarded in\n// death test subprocesses.\nTEST(EventListenerDeathTest, EventsNotForwardedInDeathTestSubprecesses) {\n  EXPECT_DEATH_IF_SUPPORTED({\n      GTEST_CHECK_(TestEventListenersAccessor::EventForwardingEnabled(\n          *GetUnitTestImpl()->listeners())) << \"expected failure\";},\n      \"expected failure\");\n}\n\n// Tests that a listener installed via SetDefaultResultPrinter() starts\n// receiving events and is returned via default_result_printer() and that\n// the previous default_result_printer is removed from the list and deleted.\nTEST(EventListenerTest, default_result_printer) {\n  int on_start_counter = 0;\n  bool is_destroyed = false;\n  TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);\n\n  TestEventListeners listeners;\n  TestEventListenersAccessor::SetDefaultResultPrinter(&listeners, listener);\n\n  EXPECT_EQ(listener, listeners.default_result_printer());\n\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n      *UnitTest::GetInstance());\n\n  EXPECT_EQ(1, on_start_counter);\n\n  // Replacing default_result_printer with something else should remove it\n  // from the list and destroy it.\n  TestEventListenersAccessor::SetDefaultResultPrinter(&listeners, NULL);\n\n  EXPECT_TRUE(listeners.default_result_printer() == NULL);\n  EXPECT_TRUE(is_destroyed);\n\n  // After broadcasting an event the counter is still the same, indicating\n  // the listener is not in the list anymore.\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n      *UnitTest::GetInstance());\n  EXPECT_EQ(1, on_start_counter);\n}\n\n// Tests that the default_result_printer listener stops receiving events\n// when removed via Release and that is not owned by the list anymore.\nTEST(EventListenerTest, RemovingDefaultResultPrinterWorks) {\n  int on_start_counter = 0;\n  bool is_destroyed = false;\n  // Although Append passes the ownership of this object to the list,\n  // the following calls release it, and we need to delete it before the\n  // test ends.\n  TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);\n  {\n    TestEventListeners listeners;\n    TestEventListenersAccessor::SetDefaultResultPrinter(&listeners, listener);\n\n    EXPECT_EQ(listener, listeners.Release(listener));\n    EXPECT_TRUE(listeners.default_result_printer() == NULL);\n    EXPECT_FALSE(is_destroyed);\n\n    // Broadcasting events now should not affect default_result_printer.\n    TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n        *UnitTest::GetInstance());\n    EXPECT_EQ(0, on_start_counter);\n  }\n  // Destroying the list should not affect the listener now, too.\n  EXPECT_FALSE(is_destroyed);\n  delete listener;\n}\n\n// Tests that a listener installed via SetDefaultXmlGenerator() starts\n// receiving events and is returned via default_xml_generator() and that\n// the previous default_xml_generator is removed from the list and deleted.\nTEST(EventListenerTest, default_xml_generator) {\n  int on_start_counter = 0;\n  bool is_destroyed = false;\n  TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);\n\n  TestEventListeners listeners;\n  TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners, listener);\n\n  EXPECT_EQ(listener, listeners.default_xml_generator());\n\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n      *UnitTest::GetInstance());\n\n  EXPECT_EQ(1, on_start_counter);\n\n  // Replacing default_xml_generator with something else should remove it\n  // from the list and destroy it.\n  TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners, NULL);\n\n  EXPECT_TRUE(listeners.default_xml_generator() == NULL);\n  EXPECT_TRUE(is_destroyed);\n\n  // After broadcasting an event the counter is still the same, indicating\n  // the listener is not in the list anymore.\n  TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n      *UnitTest::GetInstance());\n  EXPECT_EQ(1, on_start_counter);\n}\n\n// Tests that the default_xml_generator listener stops receiving events\n// when removed via Release and that is not owned by the list anymore.\nTEST(EventListenerTest, RemovingDefaultXmlGeneratorWorks) {\n  int on_start_counter = 0;\n  bool is_destroyed = false;\n  // Although Append passes the ownership of this object to the list,\n  // the following calls release it, and we need to delete it before the\n  // test ends.\n  TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);\n  {\n    TestEventListeners listeners;\n    TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners, listener);\n\n    EXPECT_EQ(listener, listeners.Release(listener));\n    EXPECT_TRUE(listeners.default_xml_generator() == NULL);\n    EXPECT_FALSE(is_destroyed);\n\n    // Broadcasting events now should not affect default_xml_generator.\n    TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(\n        *UnitTest::GetInstance());\n    EXPECT_EQ(0, on_start_counter);\n  }\n  // Destroying the list should not affect the listener now, too.\n  EXPECT_FALSE(is_destroyed);\n  delete listener;\n}\n\n// Sanity tests to ensure that the alternative, verbose spellings of\n// some of the macros work.  We don't test them thoroughly as that\n// would be quite involved.  Since their implementations are\n// straightforward, and they are rarely used, we'll just rely on the\n// users to tell us when they are broken.\nGTEST_TEST(AlternativeNameTest, Works) {  // GTEST_TEST is the same as TEST.\n  GTEST_SUCCEED() << \"OK\";  // GTEST_SUCCEED is the same as SUCCEED.\n\n  // GTEST_FAIL is the same as FAIL.\n  EXPECT_FATAL_FAILURE(GTEST_FAIL() << \"An expected failure\",\n                       \"An expected failure\");\n\n  // GTEST_ASSERT_XY is the same as ASSERT_XY.\n\n  GTEST_ASSERT_EQ(0, 0);\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_EQ(0, 1) << \"An expected failure\",\n                       \"An expected failure\");\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_EQ(1, 0) << \"An expected failure\",\n                       \"An expected failure\");\n\n  GTEST_ASSERT_NE(0, 1);\n  GTEST_ASSERT_NE(1, 0);\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_NE(0, 0) << \"An expected failure\",\n                       \"An expected failure\");\n\n  GTEST_ASSERT_LE(0, 0);\n  GTEST_ASSERT_LE(0, 1);\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_LE(1, 0) << \"An expected failure\",\n                       \"An expected failure\");\n\n  GTEST_ASSERT_LT(0, 1);\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_LT(0, 0) << \"An expected failure\",\n                       \"An expected failure\");\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_LT(1, 0) << \"An expected failure\",\n                       \"An expected failure\");\n\n  GTEST_ASSERT_GE(0, 0);\n  GTEST_ASSERT_GE(1, 0);\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_GE(0, 1) << \"An expected failure\",\n                       \"An expected failure\");\n\n  GTEST_ASSERT_GT(1, 0);\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_GT(0, 1) << \"An expected failure\",\n                       \"An expected failure\");\n  EXPECT_FATAL_FAILURE(GTEST_ASSERT_GT(1, 1) << \"An expected failure\",\n                       \"An expected failure\");\n}\n\n// Tests for internal utilities necessary for implementation of the universal\n// printing.\n// TODO(vladl@google.com): Find a better home for them.\n\nclass ConversionHelperBase {};\nclass ConversionHelperDerived : public ConversionHelperBase {};\n\n// Tests that IsAProtocolMessage<T>::value is a compile-time constant.\nTEST(IsAProtocolMessageTest, ValueIsCompileTimeConstant) {\n  GTEST_COMPILE_ASSERT_(IsAProtocolMessage<ProtocolMessage>::value,\n                        const_true);\n  GTEST_COMPILE_ASSERT_(!IsAProtocolMessage<int>::value, const_false);\n}\n\n// Tests that IsAProtocolMessage<T>::value is true when T is\n// proto2::Message or a sub-class of it.\nTEST(IsAProtocolMessageTest, ValueIsTrueWhenTypeIsAProtocolMessage) {\n  EXPECT_TRUE(IsAProtocolMessage< ::proto2::Message>::value);\n  EXPECT_TRUE(IsAProtocolMessage<ProtocolMessage>::value);\n}\n\n// Tests that IsAProtocolMessage<T>::value is false when T is neither\n// ProtocolMessage nor a sub-class of it.\nTEST(IsAProtocolMessageTest, ValueIsFalseWhenTypeIsNotAProtocolMessage) {\n  EXPECT_FALSE(IsAProtocolMessage<int>::value);\n  EXPECT_FALSE(IsAProtocolMessage<const ConversionHelperBase>::value);\n}\n\n// Tests that CompileAssertTypesEqual compiles when the type arguments are\n// equal.\nTEST(CompileAssertTypesEqual, CompilesWhenTypesAreEqual) {\n  CompileAssertTypesEqual<void, void>();\n  CompileAssertTypesEqual<int*, int*>();\n}\n\n// Tests that RemoveReference does not affect non-reference types.\nTEST(RemoveReferenceTest, DoesNotAffectNonReferenceType) {\n  CompileAssertTypesEqual<int, RemoveReference<int>::type>();\n  CompileAssertTypesEqual<const char, RemoveReference<const char>::type>();\n}\n\n// Tests that RemoveReference removes reference from reference types.\nTEST(RemoveReferenceTest, RemovesReference) {\n  CompileAssertTypesEqual<int, RemoveReference<int&>::type>();\n  CompileAssertTypesEqual<const char, RemoveReference<const char&>::type>();\n}\n\n// Tests GTEST_REMOVE_REFERENCE_.\n\ntemplate <typename T1, typename T2>\nvoid TestGTestRemoveReference() {\n  CompileAssertTypesEqual<T1, GTEST_REMOVE_REFERENCE_(T2)>();\n}\n\nTEST(RemoveReferenceTest, MacroVersion) {\n  TestGTestRemoveReference<int, int>();\n  TestGTestRemoveReference<const char, const char&>();\n}\n\n\n// Tests that RemoveConst does not affect non-const types.\nTEST(RemoveConstTest, DoesNotAffectNonConstType) {\n  CompileAssertTypesEqual<int, RemoveConst<int>::type>();\n  CompileAssertTypesEqual<char&, RemoveConst<char&>::type>();\n}\n\n// Tests that RemoveConst removes const from const types.\nTEST(RemoveConstTest, RemovesConst) {\n  CompileAssertTypesEqual<int, RemoveConst<const int>::type>();\n  CompileAssertTypesEqual<char[2], RemoveConst<const char[2]>::type>();\n  CompileAssertTypesEqual<char[2][3], RemoveConst<const char[2][3]>::type>();\n}\n\n// Tests GTEST_REMOVE_CONST_.\n\ntemplate <typename T1, typename T2>\nvoid TestGTestRemoveConst() {\n  CompileAssertTypesEqual<T1, GTEST_REMOVE_CONST_(T2)>();\n}\n\nTEST(RemoveConstTest, MacroVersion) {\n  TestGTestRemoveConst<int, int>();\n  TestGTestRemoveConst<double&, double&>();\n  TestGTestRemoveConst<char, const char>();\n}\n\n// Tests GTEST_REMOVE_REFERENCE_AND_CONST_.\n\ntemplate <typename T1, typename T2>\nvoid TestGTestRemoveReferenceAndConst() {\n  CompileAssertTypesEqual<T1, GTEST_REMOVE_REFERENCE_AND_CONST_(T2)>();\n}\n\nTEST(RemoveReferenceToConstTest, Works) {\n  TestGTestRemoveReferenceAndConst<int, int>();\n  TestGTestRemoveReferenceAndConst<double, double&>();\n  TestGTestRemoveReferenceAndConst<char, const char>();\n  TestGTestRemoveReferenceAndConst<char, const char&>();\n  TestGTestRemoveReferenceAndConst<const char*, const char*>();\n}\n\n// Tests that AddReference does not affect reference types.\nTEST(AddReferenceTest, DoesNotAffectReferenceType) {\n  CompileAssertTypesEqual<int&, AddReference<int&>::type>();\n  CompileAssertTypesEqual<const char&, AddReference<const char&>::type>();\n}\n\n// Tests that AddReference adds reference to non-reference types.\nTEST(AddReferenceTest, AddsReference) {\n  CompileAssertTypesEqual<int&, AddReference<int>::type>();\n  CompileAssertTypesEqual<const char&, AddReference<const char>::type>();\n}\n\n// Tests GTEST_ADD_REFERENCE_.\n\ntemplate <typename T1, typename T2>\nvoid TestGTestAddReference() {\n  CompileAssertTypesEqual<T1, GTEST_ADD_REFERENCE_(T2)>();\n}\n\nTEST(AddReferenceTest, MacroVersion) {\n  TestGTestAddReference<int&, int>();\n  TestGTestAddReference<const char&, const char&>();\n}\n\n// Tests GTEST_REFERENCE_TO_CONST_.\n\ntemplate <typename T1, typename T2>\nvoid TestGTestReferenceToConst() {\n  CompileAssertTypesEqual<T1, GTEST_REFERENCE_TO_CONST_(T2)>();\n}\n\nTEST(GTestReferenceToConstTest, Works) {\n  TestGTestReferenceToConst<const char&, char>();\n  TestGTestReferenceToConst<const int&, const int>();\n  TestGTestReferenceToConst<const double&, double>();\n  TestGTestReferenceToConst<const std::string&, const std::string&>();\n}\n\n// Tests that ImplicitlyConvertible<T1, T2>::value is a compile-time constant.\nTEST(ImplicitlyConvertibleTest, ValueIsCompileTimeConstant) {\n  GTEST_COMPILE_ASSERT_((ImplicitlyConvertible<int, int>::value), const_true);\n  GTEST_COMPILE_ASSERT_((!ImplicitlyConvertible<void*, int*>::value),\n                        const_false);\n}\n\n// Tests that ImplicitlyConvertible<T1, T2>::value is true when T1 can\n// be implicitly converted to T2.\nTEST(ImplicitlyConvertibleTest, ValueIsTrueWhenConvertible) {\n  EXPECT_TRUE((ImplicitlyConvertible<int, double>::value));\n  EXPECT_TRUE((ImplicitlyConvertible<double, int>::value));\n  EXPECT_TRUE((ImplicitlyConvertible<int*, void*>::value));\n  EXPECT_TRUE((ImplicitlyConvertible<int*, const int*>::value));\n  EXPECT_TRUE((ImplicitlyConvertible<ConversionHelperDerived&,\n                                     const ConversionHelperBase&>::value));\n  EXPECT_TRUE((ImplicitlyConvertible<const ConversionHelperBase,\n                                     ConversionHelperBase>::value));\n}\n\n// Tests that ImplicitlyConvertible<T1, T2>::value is false when T1\n// cannot be implicitly converted to T2.\nTEST(ImplicitlyConvertibleTest, ValueIsFalseWhenNotConvertible) {\n  EXPECT_FALSE((ImplicitlyConvertible<double, int*>::value));\n  EXPECT_FALSE((ImplicitlyConvertible<void*, int*>::value));\n  EXPECT_FALSE((ImplicitlyConvertible<const int*, int*>::value));\n  EXPECT_FALSE((ImplicitlyConvertible<ConversionHelperBase&,\n                                      ConversionHelperDerived&>::value));\n}\n\n// Tests IsContainerTest.\n\nclass NonContainer {};\n\nTEST(IsContainerTestTest, WorksForNonContainer) {\n  EXPECT_EQ(sizeof(IsNotContainer), sizeof(IsContainerTest<int>(0)));\n  EXPECT_EQ(sizeof(IsNotContainer), sizeof(IsContainerTest<char[5]>(0)));\n  EXPECT_EQ(sizeof(IsNotContainer), sizeof(IsContainerTest<NonContainer>(0)));\n}\n\nTEST(IsContainerTestTest, WorksForContainer) {\n  EXPECT_EQ(sizeof(IsContainer),\n            sizeof(IsContainerTest<std::vector<bool> >(0)));\n  EXPECT_EQ(sizeof(IsContainer),\n            sizeof(IsContainerTest<std::map<int, double> >(0)));\n}\n\n// Tests ArrayEq().\n\nTEST(ArrayEqTest, WorksForDegeneratedArrays) {\n  EXPECT_TRUE(ArrayEq(5, 5L));\n  EXPECT_FALSE(ArrayEq('a', 0));\n}\n\nTEST(ArrayEqTest, WorksForOneDimensionalArrays) {\n  // Note that a and b are distinct but compatible types.\n  const int a[] = { 0, 1 };\n  long b[] = { 0, 1 };\n  EXPECT_TRUE(ArrayEq(a, b));\n  EXPECT_TRUE(ArrayEq(a, 2, b));\n\n  b[0] = 2;\n  EXPECT_FALSE(ArrayEq(a, b));\n  EXPECT_FALSE(ArrayEq(a, 1, b));\n}\n\nTEST(ArrayEqTest, WorksForTwoDimensionalArrays) {\n  const char a[][3] = { \"hi\", \"lo\" };\n  const char b[][3] = { \"hi\", \"lo\" };\n  const char c[][3] = { \"hi\", \"li\" };\n\n  EXPECT_TRUE(ArrayEq(a, b));\n  EXPECT_TRUE(ArrayEq(a, 2, b));\n\n  EXPECT_FALSE(ArrayEq(a, c));\n  EXPECT_FALSE(ArrayEq(a, 2, c));\n}\n\n// Tests ArrayAwareFind().\n\nTEST(ArrayAwareFindTest, WorksForOneDimensionalArray) {\n  const char a[] = \"hello\";\n  EXPECT_EQ(a + 4, ArrayAwareFind(a, a + 5, 'o'));\n  EXPECT_EQ(a + 5, ArrayAwareFind(a, a + 5, 'x'));\n}\n\nTEST(ArrayAwareFindTest, WorksForTwoDimensionalArray) {\n  int a[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 } };\n  const int b[2] = { 2, 3 };\n  EXPECT_EQ(a + 1, ArrayAwareFind(a, a + 3, b));\n\n  const int c[2] = { 6, 7 };\n  EXPECT_EQ(a + 3, ArrayAwareFind(a, a + 3, c));\n}\n\n// Tests CopyArray().\n\nTEST(CopyArrayTest, WorksForDegeneratedArrays) {\n  int n = 0;\n  CopyArray('a', &n);\n  EXPECT_EQ('a', n);\n}\n\nTEST(CopyArrayTest, WorksForOneDimensionalArrays) {\n  const char a[3] = \"hi\";\n  int b[3];\n#ifndef __BORLANDC__  // C++Builder cannot compile some array size deductions.\n  CopyArray(a, &b);\n  EXPECT_TRUE(ArrayEq(a, b));\n#endif\n\n  int c[3];\n  CopyArray(a, 3, c);\n  EXPECT_TRUE(ArrayEq(a, c));\n}\n\nTEST(CopyArrayTest, WorksForTwoDimensionalArrays) {\n  const int a[2][3] = { { 0, 1, 2 }, { 3, 4, 5 } };\n  int b[2][3];\n#ifndef __BORLANDC__  // C++Builder cannot compile some array size deductions.\n  CopyArray(a, &b);\n  EXPECT_TRUE(ArrayEq(a, b));\n#endif\n\n  int c[2][3];\n  CopyArray(a, 2, c);\n  EXPECT_TRUE(ArrayEq(a, c));\n}\n\n// Tests NativeArray.\n\nTEST(NativeArrayTest, ConstructorFromArrayWorks) {\n  const int a[3] = { 0, 1, 2 };\n  NativeArray<int> na(a, 3, kReference);\n  EXPECT_EQ(3U, na.size());\n  EXPECT_EQ(a, na.begin());\n}\n\nTEST(NativeArrayTest, CreatesAndDeletesCopyOfArrayWhenAskedTo) {\n  typedef int Array[2];\n  Array* a = new Array[1];\n  (*a)[0] = 0;\n  (*a)[1] = 1;\n  NativeArray<int> na(*a, 2, kCopy);\n  EXPECT_NE(*a, na.begin());\n  delete[] a;\n  EXPECT_EQ(0, na.begin()[0]);\n  EXPECT_EQ(1, na.begin()[1]);\n\n  // We rely on the heap checker to verify that na deletes the copy of\n  // array.\n}\n\nTEST(NativeArrayTest, TypeMembersAreCorrect) {\n  StaticAssertTypeEq<char, NativeArray<char>::value_type>();\n  StaticAssertTypeEq<int[2], NativeArray<int[2]>::value_type>();\n\n  StaticAssertTypeEq<const char*, NativeArray<char>::const_iterator>();\n  StaticAssertTypeEq<const bool(*)[2], NativeArray<bool[2]>::const_iterator>();\n}\n\nTEST(NativeArrayTest, MethodsWork) {\n  const int a[3] = { 0, 1, 2 };\n  NativeArray<int> na(a, 3, kCopy);\n  ASSERT_EQ(3U, na.size());\n  EXPECT_EQ(3, na.end() - na.begin());\n\n  NativeArray<int>::const_iterator it = na.begin();\n  EXPECT_EQ(0, *it);\n  ++it;\n  EXPECT_EQ(1, *it);\n  it++;\n  EXPECT_EQ(2, *it);\n  ++it;\n  EXPECT_EQ(na.end(), it);\n\n  EXPECT_TRUE(na == na);\n\n  NativeArray<int> na2(a, 3, kReference);\n  EXPECT_TRUE(na == na2);\n\n  const int b1[3] = { 0, 1, 1 };\n  const int b2[4] = { 0, 1, 2, 3 };\n  EXPECT_FALSE(na == NativeArray<int>(b1, 3, kReference));\n  EXPECT_FALSE(na == NativeArray<int>(b2, 4, kCopy));\n}\n\nTEST(NativeArrayTest, WorksForTwoDimensionalArray) {\n  const char a[2][3] = { \"hi\", \"lo\" };\n  NativeArray<char[3]> na(a, 2, kReference);\n  ASSERT_EQ(2U, na.size());\n  EXPECT_EQ(a, na.begin());\n}\n\n// Tests SkipPrefix().\n\nTEST(SkipPrefixTest, SkipsWhenPrefixMatches) {\n  const char* const str = \"hello\";\n\n  const char* p = str;\n  EXPECT_TRUE(SkipPrefix(\"\", &p));\n  EXPECT_EQ(str, p);\n\n  p = str;\n  EXPECT_TRUE(SkipPrefix(\"hell\", &p));\n  EXPECT_EQ(str + 4, p);\n}\n\nTEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {\n  const char* const str = \"world\";\n\n  const char* p = str;\n  EXPECT_FALSE(SkipPrefix(\"W\", &p));\n  EXPECT_EQ(str, p);\n\n  p = str;\n  EXPECT_FALSE(SkipPrefix(\"world!\", &p));\n  EXPECT_EQ(str, p);\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_xml_outfile1_test_.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: keith.ray@gmail.com (Keith Ray)\n//\n// gtest_xml_outfile1_test_ writes some xml via TestProperty used by\n// gtest_xml_outfiles_test.py\n\n#include \"gtest/gtest.h\"\n\nclass PropertyOne : public testing::Test {\n protected:\n  virtual void SetUp() {\n    RecordProperty(\"SetUpProp\", 1);\n  }\n  virtual void TearDown() {\n    RecordProperty(\"TearDownProp\", 1);\n  }\n};\n\nTEST_F(PropertyOne, TestSomeProperties) {\n  RecordProperty(\"TestSomeProperty\", 1);\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_xml_outfile2_test_.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: keith.ray@gmail.com (Keith Ray)\n//\n// gtest_xml_outfile2_test_ writes some xml via TestProperty used by\n// gtest_xml_outfiles_test.py\n\n#include \"gtest/gtest.h\"\n\nclass PropertyTwo : public testing::Test {\n protected:\n  virtual void SetUp() {\n    RecordProperty(\"SetUpProp\", 2);\n  }\n  virtual void TearDown() {\n    RecordProperty(\"TearDownProp\", 2);\n  }\n};\n\nTEST_F(PropertyTwo, TestSomeProperties) {\n  RecordProperty(\"TestSomeProperty\", 2);\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_xml_outfiles_test.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test for the gtest_xml_output module.\"\"\"\n\n__author__ = \"keith.ray@gmail.com (Keith Ray)\"\n\nimport os\nfrom xml.dom import minidom, Node\n\nimport gtest_test_utils\nimport gtest_xml_test_utils\n\n\nGTEST_OUTPUT_SUBDIR = \"xml_outfiles\"\nGTEST_OUTPUT_1_TEST = \"gtest_xml_outfile1_test_\"\nGTEST_OUTPUT_2_TEST = \"gtest_xml_outfile2_test_\"\n\nEXPECTED_XML_1 = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\" timestamp=\"*\" name=\"AllTests\">\n  <testsuite name=\"PropertyOne\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"TestSomeProperties\" status=\"run\" time=\"*\" classname=\"PropertyOne\" SetUpProp=\"1\" TestSomeProperty=\"1\" TearDownProp=\"1\" />\n  </testsuite>\n</testsuites>\n\"\"\"\n\nEXPECTED_XML_2 = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\" timestamp=\"*\" name=\"AllTests\">\n  <testsuite name=\"PropertyTwo\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"TestSomeProperties\" status=\"run\" time=\"*\" classname=\"PropertyTwo\" SetUpProp=\"2\" TestSomeProperty=\"2\" TearDownProp=\"2\" />\n  </testsuite>\n</testsuites>\n\"\"\"\n\n\nclass GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):\n  \"\"\"Unit test for Google Test's XML output functionality.\"\"\"\n\n  def setUp(self):\n    # We want the trailing '/' that the last \"\" provides in os.path.join, for\n    # telling Google Test to create an output directory instead of a single file\n    # for xml output.\n    self.output_dir_ = os.path.join(gtest_test_utils.GetTempDir(),\n                                    GTEST_OUTPUT_SUBDIR, \"\")\n    self.DeleteFilesAndDir()\n\n  def tearDown(self):\n    self.DeleteFilesAndDir()\n\n  def DeleteFilesAndDir(self):\n    try:\n      os.remove(os.path.join(self.output_dir_, GTEST_OUTPUT_1_TEST + \".xml\"))\n    except os.error:\n      pass\n    try:\n      os.remove(os.path.join(self.output_dir_, GTEST_OUTPUT_2_TEST + \".xml\"))\n    except os.error:\n      pass\n    try:\n      os.rmdir(self.output_dir_)\n    except os.error:\n      pass\n\n  def testOutfile1(self):\n    self._TestOutFile(GTEST_OUTPUT_1_TEST, EXPECTED_XML_1)\n\n  def testOutfile2(self):\n    self._TestOutFile(GTEST_OUTPUT_2_TEST, EXPECTED_XML_2)\n\n  def _TestOutFile(self, test_name, expected_xml):\n    gtest_prog_path = gtest_test_utils.GetTestExecutablePath(test_name)\n    command = [gtest_prog_path, \"--gtest_output=xml:%s\" % self.output_dir_]\n    p = gtest_test_utils.Subprocess(command,\n                                    working_dir=gtest_test_utils.GetTempDir())\n    self.assert_(p.exited)\n    self.assertEquals(0, p.exit_code)\n\n    # TODO(wan@google.com): libtool causes the built test binary to be\n    #   named lt-gtest_xml_outfiles_test_ instead of\n    #   gtest_xml_outfiles_test_.  To account for this possibillity, we\n    #   allow both names in the following code.  We should remove this\n    #   hack when Chandler Carruth's libtool replacement tool is ready.\n    output_file_name1 = test_name + \".xml\"\n    output_file1 = os.path.join(self.output_dir_, output_file_name1)\n    output_file_name2 = 'lt-' + output_file_name1\n    output_file2 = os.path.join(self.output_dir_, output_file_name2)\n    self.assert_(os.path.isfile(output_file1) or os.path.isfile(output_file2),\n                 output_file1)\n\n    expected = minidom.parseString(expected_xml)\n    if os.path.isfile(output_file1):\n      actual = minidom.parse(output_file1)\n    else:\n      actual = minidom.parse(output_file2)\n    self.NormalizeXml(actual.documentElement)\n    self.AssertEquivalentNodes(expected.documentElement,\n                               actual.documentElement)\n    expected.unlink()\n    actual.unlink()\n\n\nif __name__ == \"__main__\":\n  os.environ[\"GTEST_STACK_TRACE_DEPTH\"] = \"0\"\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_xml_output_unittest.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test for the gtest_xml_output module\"\"\"\n\n__author__ = 'eefacm@gmail.com (Sean Mcafee)'\n\nimport datetime\nimport errno\nimport os\nimport re\nimport sys\nfrom xml.dom import minidom, Node\n\nimport gtest_test_utils\nimport gtest_xml_test_utils\n\n\nGTEST_FILTER_FLAG = '--gtest_filter'\nGTEST_LIST_TESTS_FLAG = '--gtest_list_tests'\nGTEST_OUTPUT_FLAG         = \"--gtest_output\"\nGTEST_DEFAULT_OUTPUT_FILE = \"test_detail.xml\"\nGTEST_PROGRAM_NAME = \"gtest_xml_output_unittest_\"\n\nSUPPORTS_STACK_TRACES = False\n\nif SUPPORTS_STACK_TRACES:\n  STACK_TRACE_TEMPLATE = '\\nStack trace:\\n*'\nelse:\n  STACK_TRACE_TEMPLATE = ''\n\nEXPECTED_NON_EMPTY_XML = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites tests=\"23\" failures=\"4\" disabled=\"2\" errors=\"0\" time=\"*\" timestamp=\"*\" name=\"AllTests\" ad_hoc_property=\"42\">\n  <testsuite name=\"SuccessfulTest\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"Succeeds\" status=\"run\" time=\"*\" classname=\"SuccessfulTest\"/>\n  </testsuite>\n  <testsuite name=\"FailedTest\" tests=\"1\" failures=\"1\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"Fails\" status=\"run\" time=\"*\" classname=\"FailedTest\">\n      <failure message=\"gtest_xml_output_unittest_.cc:*&#x0A;Value of: 2&#x0A;Expected: 1\" type=\"\"><![CDATA[gtest_xml_output_unittest_.cc:*\nValue of: 2\nExpected: 1%(stack)s]]></failure>\n    </testcase>\n  </testsuite>\n  <testsuite name=\"MixedResultTest\" tests=\"3\" failures=\"1\" disabled=\"1\" errors=\"0\" time=\"*\">\n    <testcase name=\"Succeeds\" status=\"run\" time=\"*\" classname=\"MixedResultTest\"/>\n    <testcase name=\"Fails\" status=\"run\" time=\"*\" classname=\"MixedResultTest\">\n      <failure message=\"gtest_xml_output_unittest_.cc:*&#x0A;Value of: 2&#x0A;Expected: 1\" type=\"\"><![CDATA[gtest_xml_output_unittest_.cc:*\nValue of: 2\nExpected: 1%(stack)s]]></failure>\n      <failure message=\"gtest_xml_output_unittest_.cc:*&#x0A;Value of: 3&#x0A;Expected: 2\" type=\"\"><![CDATA[gtest_xml_output_unittest_.cc:*\nValue of: 3\nExpected: 2%(stack)s]]></failure>\n    </testcase>\n    <testcase name=\"DISABLED_test\" status=\"notrun\" time=\"*\" classname=\"MixedResultTest\"/>\n  </testsuite>\n  <testsuite name=\"XmlQuotingTest\" tests=\"1\" failures=\"1\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"OutputsCData\" status=\"run\" time=\"*\" classname=\"XmlQuotingTest\">\n      <failure message=\"gtest_xml_output_unittest_.cc:*&#x0A;Failed&#x0A;XML output: &lt;?xml encoding=&quot;utf-8&quot;&gt;&lt;top&gt;&lt;![CDATA[cdata text]]&gt;&lt;/top&gt;\" type=\"\"><![CDATA[gtest_xml_output_unittest_.cc:*\nFailed\nXML output: <?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]>]]&gt;<![CDATA[</top>%(stack)s]]></failure>\n    </testcase>\n  </testsuite>\n  <testsuite name=\"InvalidCharactersTest\" tests=\"1\" failures=\"1\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"InvalidCharactersInMessage\" status=\"run\" time=\"*\" classname=\"InvalidCharactersTest\">\n      <failure message=\"gtest_xml_output_unittest_.cc:*&#x0A;Failed&#x0A;Invalid characters in brackets []\" type=\"\"><![CDATA[gtest_xml_output_unittest_.cc:*\nFailed\nInvalid characters in brackets []%(stack)s]]></failure>\n    </testcase>\n  </testsuite>\n  <testsuite name=\"DisabledTest\" tests=\"1\" failures=\"0\" disabled=\"1\" errors=\"0\" time=\"*\">\n    <testcase name=\"DISABLED_test_not_run\" status=\"notrun\" time=\"*\" classname=\"DisabledTest\"/>\n  </testsuite>\n  <testsuite name=\"PropertyRecordingTest\" tests=\"4\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\" SetUpTestCase=\"yes\" TearDownTestCase=\"aye\">\n    <testcase name=\"OneProperty\" status=\"run\" time=\"*\" classname=\"PropertyRecordingTest\" key_1=\"1\"/>\n    <testcase name=\"IntValuedProperty\" status=\"run\" time=\"*\" classname=\"PropertyRecordingTest\" key_int=\"1\"/>\n    <testcase name=\"ThreeProperties\" status=\"run\" time=\"*\" classname=\"PropertyRecordingTest\" key_1=\"1\" key_2=\"2\" key_3=\"3\"/>\n    <testcase name=\"TwoValuesForOneKeyUsesLastValue\" status=\"run\" time=\"*\" classname=\"PropertyRecordingTest\" key_1=\"2\"/>\n  </testsuite>\n  <testsuite name=\"NoFixtureTest\" tests=\"3\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n     <testcase name=\"RecordProperty\" status=\"run\" time=\"*\" classname=\"NoFixtureTest\" key=\"1\"/>\n     <testcase name=\"ExternalUtilityThatCallsRecordIntValuedProperty\" status=\"run\" time=\"*\" classname=\"NoFixtureTest\" key_for_utility_int=\"1\"/>\n     <testcase name=\"ExternalUtilityThatCallsRecordStringValuedProperty\" status=\"run\" time=\"*\" classname=\"NoFixtureTest\" key_for_utility_string=\"1\"/>\n  </testsuite>\n  <testsuite name=\"Single/ValueParamTest\" tests=\"4\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"HasValueParamAttribute/0\" value_param=\"33\" status=\"run\" time=\"*\" classname=\"Single/ValueParamTest\" />\n    <testcase name=\"HasValueParamAttribute/1\" value_param=\"42\" status=\"run\" time=\"*\" classname=\"Single/ValueParamTest\" />\n    <testcase name=\"AnotherTestThatHasValueParamAttribute/0\" value_param=\"33\" status=\"run\" time=\"*\" classname=\"Single/ValueParamTest\" />\n    <testcase name=\"AnotherTestThatHasValueParamAttribute/1\" value_param=\"42\" status=\"run\" time=\"*\" classname=\"Single/ValueParamTest\" />\n  </testsuite>\n  <testsuite name=\"TypedTest/0\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"HasTypeParamAttribute\" type_param=\"*\" status=\"run\" time=\"*\" classname=\"TypedTest/0\" />\n  </testsuite>\n  <testsuite name=\"TypedTest/1\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"HasTypeParamAttribute\" type_param=\"*\" status=\"run\" time=\"*\" classname=\"TypedTest/1\" />\n  </testsuite>\n  <testsuite name=\"Single/TypeParameterizedTestCase/0\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"HasTypeParamAttribute\" type_param=\"*\" status=\"run\" time=\"*\" classname=\"Single/TypeParameterizedTestCase/0\" />\n  </testsuite>\n  <testsuite name=\"Single/TypeParameterizedTestCase/1\" tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\">\n    <testcase name=\"HasTypeParamAttribute\" type_param=\"*\" status=\"run\" time=\"*\" classname=\"Single/TypeParameterizedTestCase/1\" />\n  </testsuite>\n</testsuites>\"\"\" % {'stack': STACK_TRACE_TEMPLATE}\n\nEXPECTED_FILTERED_TEST_XML = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites tests=\"1\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\"\n            timestamp=\"*\" name=\"AllTests\" ad_hoc_property=\"42\">\n  <testsuite name=\"SuccessfulTest\" tests=\"1\" failures=\"0\" disabled=\"0\"\n             errors=\"0\" time=\"*\">\n    <testcase name=\"Succeeds\" status=\"run\" time=\"*\" classname=\"SuccessfulTest\"/>\n  </testsuite>\n</testsuites>\"\"\"\n\nEXPECTED_EMPTY_XML = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites tests=\"0\" failures=\"0\" disabled=\"0\" errors=\"0\" time=\"*\"\n            timestamp=\"*\" name=\"AllTests\">\n</testsuites>\"\"\"\n\nGTEST_PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath(GTEST_PROGRAM_NAME)\n\nSUPPORTS_TYPED_TESTS = 'TypedTest' in gtest_test_utils.Subprocess(\n    [GTEST_PROGRAM_PATH, GTEST_LIST_TESTS_FLAG], capture_stderr=False).output\n\n\nclass GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):\n  \"\"\"\n  Unit test for Google Test's XML output functionality.\n  \"\"\"\n\n  # This test currently breaks on platforms that do not support typed and\n  # type-parameterized tests, so we don't run it under them.\n  if SUPPORTS_TYPED_TESTS:\n    def testNonEmptyXmlOutput(self):\n      \"\"\"\n      Runs a test program that generates a non-empty XML output, and\n      tests that the XML output is expected.\n      \"\"\"\n      self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_NON_EMPTY_XML, 1)\n\n  def testEmptyXmlOutput(self):\n    \"\"\"Verifies XML output for a Google Test binary without actual tests.\n\n    Runs a test program that generates an empty XML output, and\n    tests that the XML output is expected.\n    \"\"\"\n\n    self._TestXmlOutput('gtest_no_test_unittest', EXPECTED_EMPTY_XML, 0)\n\n  def testTimestampValue(self):\n    \"\"\"Checks whether the timestamp attribute in the XML output is valid.\n\n    Runs a test program that generates an empty XML output, and checks if\n    the timestamp attribute in the testsuites tag is valid.\n    \"\"\"\n    actual = self._GetXmlOutput('gtest_no_test_unittest', [], 0)\n    date_time_str = actual.documentElement.getAttributeNode('timestamp').value\n    # datetime.strptime() is only available in Python 2.5+ so we have to\n    # parse the expected datetime manually.\n    match = re.match(r'(\\d+)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)', date_time_str)\n    self.assertTrue(\n        re.match,\n        'XML datettime string %s has incorrect format' % date_time_str)\n    date_time_from_xml = datetime.datetime(\n        year=int(match.group(1)), month=int(match.group(2)),\n        day=int(match.group(3)), hour=int(match.group(4)),\n        minute=int(match.group(5)), second=int(match.group(6)))\n\n    time_delta = abs(datetime.datetime.now() - date_time_from_xml)\n    # timestamp value should be near the current local time\n    self.assertTrue(time_delta < datetime.timedelta(seconds=600),\n                    'time_delta is %s' % time_delta)\n    actual.unlink()\n\n  def testDefaultOutputFile(self):\n    \"\"\"\n    Confirms that Google Test produces an XML output file with the expected\n    default name if no name is explicitly specified.\n    \"\"\"\n    output_file = os.path.join(gtest_test_utils.GetTempDir(),\n                               GTEST_DEFAULT_OUTPUT_FILE)\n    gtest_prog_path = gtest_test_utils.GetTestExecutablePath(\n        'gtest_no_test_unittest')\n    try:\n      os.remove(output_file)\n    except OSError, e:\n      if e.errno != errno.ENOENT:\n        raise\n\n    p = gtest_test_utils.Subprocess(\n        [gtest_prog_path, '%s=xml' % GTEST_OUTPUT_FLAG],\n        working_dir=gtest_test_utils.GetTempDir())\n    self.assert_(p.exited)\n    self.assertEquals(0, p.exit_code)\n    self.assert_(os.path.isfile(output_file))\n\n  def testSuppressedXmlOutput(self):\n    \"\"\"\n    Tests that no XML file is generated if the default XML listener is\n    shut down before RUN_ALL_TESTS is invoked.\n    \"\"\"\n\n    xml_path = os.path.join(gtest_test_utils.GetTempDir(),\n                            GTEST_PROGRAM_NAME + 'out.xml')\n    if os.path.isfile(xml_path):\n      os.remove(xml_path)\n\n    command = [GTEST_PROGRAM_PATH,\n               '%s=xml:%s' % (GTEST_OUTPUT_FLAG, xml_path),\n               '--shut_down_xml']\n    p = gtest_test_utils.Subprocess(command)\n    if p.terminated_by_signal:\n      # p.signal is avalable only if p.terminated_by_signal is True.\n      self.assertFalse(\n          p.terminated_by_signal,\n          '%s was killed by signal %d' % (GTEST_PROGRAM_NAME, p.signal))\n    else:\n      self.assert_(p.exited)\n      self.assertEquals(1, p.exit_code,\n                        \"'%s' exited with code %s, which doesn't match \"\n                        'the expected exit code %s.'\n                        % (command, p.exit_code, 1))\n\n    self.assert_(not os.path.isfile(xml_path))\n\n  def testFilteredTestXmlOutput(self):\n    \"\"\"Verifies XML output when a filter is applied.\n\n    Runs a test program that executes only some tests and verifies that\n    non-selected tests do not show up in the XML output.\n    \"\"\"\n\n    self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_FILTERED_TEST_XML, 0,\n                        extra_args=['%s=SuccessfulTest.*' % GTEST_FILTER_FLAG])\n\n  def _GetXmlOutput(self, gtest_prog_name, extra_args, expected_exit_code):\n    \"\"\"\n    Returns the xml output generated by running the program gtest_prog_name.\n    Furthermore, the program's exit code must be expected_exit_code.\n    \"\"\"\n    xml_path = os.path.join(gtest_test_utils.GetTempDir(),\n                            gtest_prog_name + 'out.xml')\n    gtest_prog_path = gtest_test_utils.GetTestExecutablePath(gtest_prog_name)\n\n    command = ([gtest_prog_path, '%s=xml:%s' % (GTEST_OUTPUT_FLAG, xml_path)] +\n               extra_args)\n    p = gtest_test_utils.Subprocess(command)\n    if p.terminated_by_signal:\n      self.assert_(False,\n                   '%s was killed by signal %d' % (gtest_prog_name, p.signal))\n    else:\n      self.assert_(p.exited)\n      self.assertEquals(expected_exit_code, p.exit_code,\n                        \"'%s' exited with code %s, which doesn't match \"\n                        'the expected exit code %s.'\n                        % (command, p.exit_code, expected_exit_code))\n    actual = minidom.parse(xml_path)\n    return actual\n\n  def _TestXmlOutput(self, gtest_prog_name, expected_xml,\n                     expected_exit_code, extra_args=None):\n    \"\"\"\n    Asserts that the XML document generated by running the program\n    gtest_prog_name matches expected_xml, a string containing another\n    XML document.  Furthermore, the program's exit code must be\n    expected_exit_code.\n    \"\"\"\n\n    actual = self._GetXmlOutput(gtest_prog_name, extra_args or [],\n                                expected_exit_code)\n    expected = minidom.parseString(expected_xml)\n    self.NormalizeXml(actual.documentElement)\n    self.AssertEquivalentNodes(expected.documentElement,\n                               actual.documentElement)\n    expected.unlink()\n    actual.unlink()\n\n\nif __name__ == '__main__':\n  os.environ['GTEST_STACK_TRACE_DEPTH'] = '1'\n  gtest_test_utils.Main()\n"
  },
  {
    "path": "Tests/gtest/test/gtest_xml_output_unittest_.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: eefacm@gmail.com (Sean Mcafee)\n\n// Unit test for Google Test XML output.\n//\n// A user can specify XML output in a Google Test program to run via\n// either the GTEST_OUTPUT environment variable or the --gtest_output\n// flag.  This is used for testing such functionality.\n//\n// This program will be invoked from a Python unit test.  Don't run it\n// directly.\n\n#include \"gtest/gtest.h\"\n\nusing ::testing::InitGoogleTest;\nusing ::testing::TestEventListeners;\nusing ::testing::TestWithParam;\nusing ::testing::UnitTest;\nusing ::testing::Test;\nusing ::testing::Values;\n\nclass SuccessfulTest : public Test {\n};\n\nTEST_F(SuccessfulTest, Succeeds) {\n  SUCCEED() << \"This is a success.\";\n  ASSERT_EQ(1, 1);\n}\n\nclass FailedTest : public Test {\n};\n\nTEST_F(FailedTest, Fails) {\n  ASSERT_EQ(1, 2);\n}\n\nclass DisabledTest : public Test {\n};\n\nTEST_F(DisabledTest, DISABLED_test_not_run) {\n  FAIL() << \"Unexpected failure: Disabled test should not be run\";\n}\n\nTEST(MixedResultTest, Succeeds) {\n  EXPECT_EQ(1, 1);\n  ASSERT_EQ(1, 1);\n}\n\nTEST(MixedResultTest, Fails) {\n  EXPECT_EQ(1, 2);\n  ASSERT_EQ(2, 3);\n}\n\nTEST(MixedResultTest, DISABLED_test) {\n  FAIL() << \"Unexpected failure: Disabled test should not be run\";\n}\n\nTEST(XmlQuotingTest, OutputsCData) {\n  FAIL() << \"XML output: \"\n            \"<?xml encoding=\\\"utf-8\\\"><top><![CDATA[cdata text]]></top>\";\n}\n\n// Helps to test that invalid characters produced by test code do not make\n// it into the XML file.\nTEST(InvalidCharactersTest, InvalidCharactersInMessage) {\n  FAIL() << \"Invalid characters in brackets [\\x1\\x2]\";\n}\n\nclass PropertyRecordingTest : public Test {\n public:\n  static void SetUpTestCase() { RecordProperty(\"SetUpTestCase\", \"yes\"); }\n  static void TearDownTestCase() { RecordProperty(\"TearDownTestCase\", \"aye\"); }\n};\n\nTEST_F(PropertyRecordingTest, OneProperty) {\n  RecordProperty(\"key_1\", \"1\");\n}\n\nTEST_F(PropertyRecordingTest, IntValuedProperty) {\n  RecordProperty(\"key_int\", 1);\n}\n\nTEST_F(PropertyRecordingTest, ThreeProperties) {\n  RecordProperty(\"key_1\", \"1\");\n  RecordProperty(\"key_2\", \"2\");\n  RecordProperty(\"key_3\", \"3\");\n}\n\nTEST_F(PropertyRecordingTest, TwoValuesForOneKeyUsesLastValue) {\n  RecordProperty(\"key_1\", \"1\");\n  RecordProperty(\"key_1\", \"2\");\n}\n\nTEST(NoFixtureTest, RecordProperty) {\n  RecordProperty(\"key\", \"1\");\n}\n\nvoid ExternalUtilityThatCallsRecordProperty(const std::string& key, int value) {\n  testing::Test::RecordProperty(key, value);\n}\n\nvoid ExternalUtilityThatCallsRecordProperty(const std::string& key,\n                                            const std::string& value) {\n  testing::Test::RecordProperty(key, value);\n}\n\nTEST(NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty) {\n  ExternalUtilityThatCallsRecordProperty(\"key_for_utility_int\", 1);\n}\n\nTEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {\n  ExternalUtilityThatCallsRecordProperty(\"key_for_utility_string\", \"1\");\n}\n\n// Verifies that the test parameter value is output in the 'value_param'\n// XML attribute for value-parameterized tests.\nclass ValueParamTest : public TestWithParam<int> {};\nTEST_P(ValueParamTest, HasValueParamAttribute) {}\nTEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {}\nINSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42));\n\n#if GTEST_HAS_TYPED_TEST\n// Verifies that the type parameter name is output in the 'type_param'\n// XML attribute for typed tests.\ntemplate <typename T> class TypedTest : public Test {};\ntypedef testing::Types<int, long> TypedTestTypes;\nTYPED_TEST_CASE(TypedTest, TypedTestTypes);\nTYPED_TEST(TypedTest, HasTypeParamAttribute) {}\n#endif\n\n#if GTEST_HAS_TYPED_TEST_P\n// Verifies that the type parameter name is output in the 'type_param'\n// XML attribute for type-parameterized tests.\ntemplate <typename T> class TypeParameterizedTestCase : public Test {};\nTYPED_TEST_CASE_P(TypeParameterizedTestCase);\nTYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}\nREGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute);\ntypedef testing::Types<int, long> TypeParameterizedTestCaseTypes;\nINSTANTIATE_TYPED_TEST_CASE_P(Single,\n                              TypeParameterizedTestCase,\n                              TypeParameterizedTestCaseTypes);\n#endif\n\nint main(int argc, char** argv) {\n  InitGoogleTest(&argc, argv);\n\n  if (argc > 1 && strcmp(argv[1], \"--shut_down_xml\") == 0) {\n    TestEventListeners& listeners = UnitTest::GetInstance()->listeners();\n    delete listeners.Release(listeners.default_xml_generator());\n  }\n  testing::Test::RecordProperty(\"ad_hoc_property\", \"42\");\n  return RUN_ALL_TESTS();\n}\n"
  },
  {
    "path": "Tests/gtest/test/gtest_xml_test_utils.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"Unit test utilities for gtest_xml_output\"\"\"\n\n__author__ = 'eefacm@gmail.com (Sean Mcafee)'\n\nimport re\nfrom xml.dom import minidom, Node\n\nimport gtest_test_utils\n\n\nGTEST_OUTPUT_FLAG         = '--gtest_output'\nGTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'\n\nclass GTestXMLTestCase(gtest_test_utils.TestCase):\n  \"\"\"\n  Base class for tests of Google Test's XML output functionality.\n  \"\"\"\n\n\n  def AssertEquivalentNodes(self, expected_node, actual_node):\n    \"\"\"\n    Asserts that actual_node (a DOM node object) is equivalent to\n    expected_node (another DOM node object), in that either both of\n    them are CDATA nodes and have the same value, or both are DOM\n    elements and actual_node meets all of the following conditions:\n\n    *  It has the same tag name as expected_node.\n    *  It has the same set of attributes as expected_node, each with\n       the same value as the corresponding attribute of expected_node.\n       Exceptions are any attribute named \"time\", which needs only be\n       convertible to a floating-point number and any attribute named\n       \"type_param\" which only has to be non-empty.\n    *  It has an equivalent set of child nodes (including elements and\n       CDATA sections) as expected_node.  Note that we ignore the\n       order of the children as they are not guaranteed to be in any\n       particular order.\n    \"\"\"\n\n    if expected_node.nodeType == Node.CDATA_SECTION_NODE:\n      self.assertEquals(Node.CDATA_SECTION_NODE, actual_node.nodeType)\n      self.assertEquals(expected_node.nodeValue, actual_node.nodeValue)\n      return\n\n    self.assertEquals(Node.ELEMENT_NODE, actual_node.nodeType)\n    self.assertEquals(Node.ELEMENT_NODE, expected_node.nodeType)\n    self.assertEquals(expected_node.tagName, actual_node.tagName)\n\n    expected_attributes = expected_node.attributes\n    actual_attributes   = actual_node  .attributes\n    self.assertEquals(\n        expected_attributes.length, actual_attributes.length,\n        'attribute numbers differ in element %s:\\nExpected: %r\\nActual: %r' % (\n            actual_node.tagName, expected_attributes.keys(),\n            actual_attributes.keys()))\n    for i in range(expected_attributes.length):\n      expected_attr = expected_attributes.item(i)\n      actual_attr   = actual_attributes.get(expected_attr.name)\n      self.assert_(\n          actual_attr is not None,\n          'expected attribute %s not found in element %s' %\n          (expected_attr.name, actual_node.tagName))\n      self.assertEquals(\n          expected_attr.value, actual_attr.value,\n          ' values of attribute %s in element %s differ: %s vs %s' %\n          (expected_attr.name, actual_node.tagName,\n           expected_attr.value, actual_attr.value))\n\n    expected_children = self._GetChildren(expected_node)\n    actual_children = self._GetChildren(actual_node)\n    self.assertEquals(\n        len(expected_children), len(actual_children),\n        'number of child elements differ in element ' + actual_node.tagName)\n    for child_id, child in expected_children.iteritems():\n      self.assert_(child_id in actual_children,\n                   '<%s> is not in <%s> (in element %s)' %\n                   (child_id, actual_children, actual_node.tagName))\n      self.AssertEquivalentNodes(child, actual_children[child_id])\n\n  identifying_attribute = {\n    'testsuites': 'name',\n    'testsuite': 'name',\n    'testcase':  'name',\n    'failure':   'message',\n    }\n\n  def _GetChildren(self, element):\n    \"\"\"\n    Fetches all of the child nodes of element, a DOM Element object.\n    Returns them as the values of a dictionary keyed by the IDs of the\n    children.  For <testsuites>, <testsuite> and <testcase> elements, the ID\n    is the value of their \"name\" attribute; for <failure> elements, it is\n    the value of the \"message\" attribute; CDATA sections and non-whitespace\n    text nodes are concatenated into a single CDATA section with ID\n    \"detail\".  An exception is raised if any element other than the above\n    four is encountered, if two child elements with the same identifying\n    attributes are encountered, or if any other type of node is encountered.\n    \"\"\"\n\n    children = {}\n    for child in element.childNodes:\n      if child.nodeType == Node.ELEMENT_NODE:\n        self.assert_(child.tagName in self.identifying_attribute,\n                     'Encountered unknown element <%s>' % child.tagName)\n        childID = child.getAttribute(self.identifying_attribute[child.tagName])\n        self.assert_(childID not in children)\n        children[childID] = child\n      elif child.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]:\n        if 'detail' not in children:\n          if (child.nodeType == Node.CDATA_SECTION_NODE or\n              not child.nodeValue.isspace()):\n            children['detail'] = child.ownerDocument.createCDATASection(\n                child.nodeValue)\n        else:\n          children['detail'].nodeValue += child.nodeValue\n      else:\n        self.fail('Encountered unexpected node type %d' % child.nodeType)\n    return children\n\n  def NormalizeXml(self, element):\n    \"\"\"\n    Normalizes Google Test's XML output to eliminate references to transient\n    information that may change from run to run.\n\n    *  The \"time\" attribute of <testsuites>, <testsuite> and <testcase>\n       elements is replaced with a single asterisk, if it contains\n       only digit characters.\n    *  The \"timestamp\" attribute of <testsuites> elements is replaced with a\n       single asterisk, if it contains a valid ISO8601 datetime value.\n    *  The \"type_param\" attribute of <testcase> elements is replaced with a\n       single asterisk (if it sn non-empty) as it is the type name returned\n       by the compiler and is platform dependent.\n    *  The line info reported in the first line of the \"message\"\n       attribute and CDATA section of <failure> elements is replaced with the\n       file's basename and a single asterisk for the line number.\n    *  The directory names in file paths are removed.\n    *  The stack traces are removed.\n    \"\"\"\n\n    if element.tagName == 'testsuites':\n      timestamp = element.getAttributeNode('timestamp')\n      timestamp.value = re.sub(r'^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d$',\n                               '*', timestamp.value)\n    if element.tagName in ('testsuites', 'testsuite', 'testcase'):\n      time = element.getAttributeNode('time')\n      time.value = re.sub(r'^\\d+(\\.\\d+)?$', '*', time.value)\n      type_param = element.getAttributeNode('type_param')\n      if type_param and type_param.value:\n        type_param.value = '*'\n    elif element.tagName == 'failure':\n      source_line_pat = r'^.*[/\\\\](.*:)\\d+\\n'\n      # Replaces the source line information with a normalized form.\n      message = element.getAttributeNode('message')\n      message.value = re.sub(source_line_pat, '\\\\1*\\n', message.value)\n      for child in element.childNodes:\n        if child.nodeType == Node.CDATA_SECTION_NODE:\n          # Replaces the source line information with a normalized form.\n          cdata = re.sub(source_line_pat, '\\\\1*\\n', child.nodeValue)\n          # Removes the actual stack trace.\n          child.nodeValue = re.sub(r'\\nStack trace:\\n(.|\\n)*',\n                                   '', cdata)\n    for child in element.childNodes:\n      if child.nodeType == Node.ELEMENT_NODE:\n        self.NormalizeXml(child)\n"
  },
  {
    "path": "Tests/gtest/test/production.cc",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// This is part of the unit test for include/gtest/gtest_prod.h.\n\n#include \"production.h\"\n\nPrivateCode::PrivateCode() : x_(0) {}\n"
  },
  {
    "path": "Tests/gtest/test/production.h",
    "content": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: wan@google.com (Zhanyong Wan)\n//\n// This is part of the unit test for include/gtest/gtest_prod.h.\n\n#ifndef GTEST_TEST_PRODUCTION_H_\n#define GTEST_TEST_PRODUCTION_H_\n\n#include \"gtest/gtest_prod.h\"\n\nclass PrivateCode {\n public:\n  // Declares a friend test that does not use a fixture.\n  FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers);\n\n  // Declares a friend test that uses a fixture.\n  FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers);\n\n  PrivateCode();\n\n  int x() const { return x_; }\n private:\n  void set_x(int an_x) { x_ = an_x; }\n  int x_;\n};\n\n#endif  // GTEST_TEST_PRODUCTION_H_\n"
  },
  {
    "path": "Tests/iOS/xcode/Config/DebugProject.xcconfig",
    "content": "//\n//  DebugProject.xcconfig\n//\n//  These are Debug Configuration project settings for the gtest framework and\n//  examples. It is set in the \"Based On:\" dropdown in the \"Project\" info\n//  dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n#include \"General.xcconfig\"\n\n// No optimization\nGCC_OPTIMIZATION_LEVEL = 0\n\n// Deployment postprocessing is what triggers Xcode to strip, turn it off\nDEPLOYMENT_POSTPROCESSING = NO\n\n// Dead code stripping off\nDEAD_CODE_STRIPPING = NO\n\n// Debug symbols should be on obviously\nGCC_GENERATE_DEBUGGING_SYMBOLS = YES\n\n// Define the DEBUG macro in all debug builds\nOTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1\n\n// These are turned off to avoid STL incompatibilities with client code\n// // Turns on special C++ STL checks to \"encourage\" good STL use\n// GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS\n"
  },
  {
    "path": "Tests/iOS/xcode/Config/FrameworkTarget.xcconfig",
    "content": "//\n//  FrameworkTarget.xcconfig\n//\n//  These are Framework target settings for the gtest framework and examples. It\n//  is set in the \"Based On:\" dropdown in the \"Target\" info dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n// Dynamic libs need to be position independent\nGCC_DYNAMIC_NO_PIC = NO\n\n// Dynamic libs should not have their external symbols stripped.\nSTRIP_STYLE = non-global\n\n// Let the user install by specifying the $DSTROOT with xcodebuild\nSKIP_INSTALL = NO\n"
  },
  {
    "path": "Tests/iOS/xcode/Config/General.xcconfig",
    "content": "//\n//  General.xcconfig\n//\n//  These are General configuration settings for the gtest framework and\n//  examples.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n// Build for PPC and Intel, 32- and 64-bit\nARCHS = i386 x86_64 ppc ppc64\n\n// Zerolink prevents link warnings so turn it off\nZERO_LINK = NO\n\n// Prebinding considered unhelpful in 10.3 and later\nPREBINDING = NO\n\n// Strictest warning policy\nWARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow\n\n// Work around Xcode bugs by using external strip. See:\n// http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html\nSEPARATE_STRIP = YES\n\n// Force C99 dialect\nGCC_C_LANGUAGE_STANDARD = c99\n\n// not sure why apple defaults this on, but it's pretty risky\nALWAYS_SEARCH_USER_PATHS = NO\n\n// Turn on position dependent code for most cases (overridden where appropriate)\nGCC_DYNAMIC_NO_PIC = YES\n\n// Default SDK and minimum OS version is 10.4\nSDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk\nMACOSX_DEPLOYMENT_TARGET = 10.4\nGCC_VERSION = 4.0\n\n// VERSIONING BUILD SETTINGS (used in Info.plist)\nGTEST_VERSIONINFO_ABOUT =  © 2008 Google Inc.\n"
  },
  {
    "path": "Tests/iOS/xcode/Config/ReleaseProject.xcconfig",
    "content": "//\n//  ReleaseProject.xcconfig\n//\n//  These are Release Configuration project settings for the gtest framework\n//  and examples. It is set in the \"Based On:\" dropdown in the \"Project\" info\n//  dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n#include \"General.xcconfig\"\n\n// subconfig/Release.xcconfig\n\n// Optimize for space and size (Apple recommendation)\nGCC_OPTIMIZATION_LEVEL = s\n\n// Deploment postprocessing is what triggers Xcode to strip\nDEPLOYMENT_POSTPROCESSING = YES\n\n// No symbols\nGCC_GENERATE_DEBUGGING_SYMBOLS = NO\n\n// Dead code strip does not affect ObjC code but can help for C\nDEAD_CODE_STRIPPING = YES\n\n// NDEBUG is used by things like assert.h, so define it for general compat.\n// ASSERT going away in release tends to create unused vars.\nOTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable\n\n// When we strip we want to strip all symbols in release, but save externals.\nSTRIP_STYLE = all\n"
  },
  {
    "path": "Tests/iOS/xcode/Config/StaticLibraryTarget.xcconfig",
    "content": "//\n//  StaticLibraryTarget.xcconfig\n//\n//  These are static library target settings for libgtest.a. It\n//  is set in the \"Based On:\" dropdown in the \"Target\" info dialog.\n//  This file is based on the Xcode Configuration files in:\n//  http://code.google.com/p/google-toolbox-for-mac/\n// \n\n// Static libs can be included in bundles so make them position independent\nGCC_DYNAMIC_NO_PIC = NO\n\n// Static libs should not have their internal globals or external symbols\n// stripped.\nSTRIP_STYLE = debugging\n\n// Let the user install by specifying the $DSTROOT with xcodebuild\nSKIP_INSTALL = NO\n"
  },
  {
    "path": "Tests/iOS/xcode/Config/TestTarget.xcconfig",
    "content": "//\n//  TestTarget.xcconfig\n//\n//  These are Test target settings for the gtest framework and examples. It\n//  is set in the \"Based On:\" dropdown in the \"Target\" info dialog.\n\nPRODUCT_NAME = $(TARGET_NAME)\nHEADER_SEARCH_PATHS = ../include\n"
  },
  {
    "path": "Tests/iOS/xcode/Resources/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.google.${PRODUCT_NAME}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>GTEST_VERSIONINFO_LONG</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>GTEST_VERSIONINFO_SHORT</string>\n\t<key>CFBundleGetInfoString</key>\n\t<string>${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT}</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>${GTEST_VERSIONINFO_ABOUT}</string>\n\t<key>CSResourcesFileMapped</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/iOS/xcode/Samples/FrameworkSample/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIconFile</key>\n\t<string></string>\n\t<key>CFBundleIdentifier</key>\n\t<string>com.google.gtest.${PRODUCT_NAME:identifier}</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1.0</string>\n\t<key>CSResourcesFileMapped</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/iOS/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 42;\n\tobjects = {\n\n/* Begin PBXAggregateTarget section */\n\t\t4024D162113D7D2400C7059E /* Test */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 4024D169113D7D4600C7059E /* Build configuration list for PBXAggregateTarget \"Test\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t4024D161113D7D2400C7059E /* ShellScript */,\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t4024D166113D7D3100C7059E /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = Test;\n\t\t\tproductName = TestAndBuild;\n\t\t};\n\t\t4024D1E9113D83FF00C7059E /* TestAndBuild */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 4024D1F0113D842B00C7059E /* Build configuration list for PBXAggregateTarget \"TestAndBuild\" */;\n\t\t\tbuildPhases = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t4024D1ED113D840900C7059E /* PBXTargetDependency */,\n\t\t\t\t4024D1EF113D840D00C7059E /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = TestAndBuild;\n\t\t\tproductName = TestAndBuild;\n\t\t};\n/* End PBXAggregateTarget section */\n\n/* Begin PBXBuildFile section */\n\t\t3B7EB1250E5AEE3500C7F239 /* widget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1230E5AEE3500C7F239 /* widget.cc */; };\n\t\t3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B7EB1240E5AEE3500C7F239 /* widget.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1270E5AEE4600C7F239 /* widget_test.cc */; };\n\t\t3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */; };\n\t\t4024D188113D7D7800C7059E /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4024D185113D7D5500C7059E /* libgtest.a */; };\n\t\t4024D189113D7D7A00C7059E /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4024D183113D7D5500C7059E /* libgtest_main.a */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t3B07BDF00E3F3FAE00647869 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = gTestExample;\n\t\t};\n\t\t4024D165113D7D3100C7059E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 3B07BDE90E3F3F9E00647869;\n\t\t\tremoteInfo = WidgetFrameworkTest;\n\t\t};\n\t\t4024D1EC113D840900C7059E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = WidgetFramework;\n\t\t};\n\t\t4024D1EE113D840D00C7059E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4024D162113D7D2400C7059E;\n\t\t\tremoteInfo = Test;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = WidgetFrameworkTest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3B7EB1230E5AEE3500C7F239 /* widget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget.cc; sourceTree = \"<group>\"; };\n\t\t3B7EB1240E5AEE3500C7F239 /* widget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = widget.h; sourceTree = \"<group>\"; };\n\t\t3B7EB1270E5AEE4600C7F239 /* widget_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget_test.cc; sourceTree = \"<group>\"; };\n\t\t4024D183113D7D5500C7059E /* libgtest_main.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest_main.a; path = /usr/local/lib/libgtest_main.a; sourceTree = \"<absolute>\"; };\n\t\t4024D185113D7D5500C7059E /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest.a; path = /usr/local/lib/libgtest.a; sourceTree = \"<absolute>\"; };\n\t\t4024D1E2113D838200C7059E /* runtests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests.sh; sourceTree = \"<group>\"; };\n\t\t8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t8D07F2C80486CC7A007CD1D0 /* Widget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Widget.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3B07BDE80E3F3F9E00647869 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4024D189113D7D7A00C7059E /* libgtest_main.a in Frameworks */,\n\t\t\t\t4024D188113D7D7800C7059E /* libgtest.a in Frameworks */,\n\t\t\t\t3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8D07F2C30486CC7A007CD1D0 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t034768DDFF38A45A11DB9C8B /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8D07F2C80486CC7A007CD1D0 /* Widget.framework */,\n\t\t\t\t3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0867D691FE84028FC02AAC07 /* gTestExample */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4024D1E1113D836C00C7059E /* Scripts */,\n\t\t\t\t08FB77ACFE841707C02AAC07 /* Source */,\n\t\t\t\t089C1665FE841158C02AAC07 /* Resources */,\n\t\t\t\t3B07BE350E4094E400647869 /* Test */,\n\t\t\t\t0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,\n\t\t\t\t034768DDFF38A45A11DB9C8B /* Products */,\n\t\t\t);\n\t\t\tname = gTestExample;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4024D183113D7D5500C7059E /* libgtest_main.a */,\n\t\t\t\t4024D185113D7D5500C7059E /* libgtest.a */,\n\t\t\t);\n\t\t\tname = \"External Frameworks and Libraries\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t089C1665FE841158C02AAC07 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8D07F2C70486CC7A007CD1D0 /* Info.plist */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t08FB77ACFE841707C02AAC07 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3B7EB1230E5AEE3500C7F239 /* widget.cc */,\n\t\t\t\t3B7EB1240E5AEE3500C7F239 /* widget.h */,\n\t\t\t);\n\t\t\tname = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3B07BE350E4094E400647869 /* Test */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3B7EB1270E5AEE4600C7F239 /* widget_test.cc */,\n\t\t\t);\n\t\t\tname = Test;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4024D1E1113D836C00C7059E /* Scripts */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4024D1E2113D838200C7059E /* runtests.sh */,\n\t\t\t);\n\t\t\tname = Scripts;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 3B07BDF40E3F3FB600647869 /* Build configuration list for PBXNativeTarget \"WidgetFrameworkTest\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3B07BDE70E3F3F9E00647869 /* Sources */,\n\t\t\t\t3B07BDE80E3F3F9E00647869 /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t3B07BDF10E3F3FAE00647869 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = WidgetFrameworkTest;\n\t\t\tproductName = gTestExampleTest;\n\t\t\tproductReference = 3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"WidgetFramework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t8D07F2C10486CC7A007CD1D0 /* Sources */,\n\t\t\t\t8D07F2C30486CC7A007CD1D0 /* Frameworks */,\n\t\t\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */,\n\t\t\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */,\n\t\t\t\t8D07F2C50486CC7A007CD1D0 /* Rez */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = WidgetFramework;\n\t\t\tproductInstallPath = \"$(HOME)/Library/Frameworks\";\n\t\t\tproductName = gTestExample;\n\t\t\tproductReference = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t0867D690FE84028FC02AAC07 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tbuildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"WidgetFramework\" */;\n\t\t\tcompatibilityVersion = \"Xcode 2.4\";\n\t\t\thasScannedForEncodings = 1;\n\t\t\tmainGroup = 0867D691FE84028FC02AAC07 /* gTestExample */;\n\t\t\tproductRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */,\n\t\t\t\t3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */,\n\t\t\t\t4024D162113D7D2400C7059E /* Test */,\n\t\t\t\t4024D1E9113D83FF00C7059E /* TestAndBuild */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXRezBuildPhase section */\n\t\t8D07F2C50486CC7A007CD1D0 /* Rez */ = {\n\t\t\tisa = PBXRezBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXRezBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t4024D161113D7D2400C7059E /* ShellScript */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"/bin/bash $SRCROOT/runtests.sh $BUILT_PRODUCTS_DIR/WidgetFrameworkTest\\n\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3B07BDE70E3F3F9E00647869 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8D07F2C10486CC7A007CD1D0 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3B7EB1250E5AEE3500C7F239 /* widget.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t3B07BDF10E3F3FAE00647869 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */;\n\t\t\ttargetProxy = 3B07BDF00E3F3FAE00647869 /* PBXContainerItemProxy */;\n\t\t};\n\t\t4024D166113D7D3100C7059E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */;\n\t\t\ttargetProxy = 4024D165113D7D3100C7059E /* PBXContainerItemProxy */;\n\t\t};\n\t\t4024D1ED113D840900C7059E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */;\n\t\t\ttargetProxy = 4024D1EC113D840900C7059E /* PBXContainerItemProxy */;\n\t\t};\n\t\t4024D1EF113D840D00C7059E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 4024D162113D7D2400C7059E /* Test */;\n\t\t\ttargetProxy = 4024D1EE113D840D00C7059E /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3B07BDEC0E3F3F9F00647869 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = WidgetFrameworkTest;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3B07BDED0E3F3F9F00647869 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = WidgetFrameworkTest;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4024D163113D7D2400C7059E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4024D164113D7D2400C7059E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4024D1EA113D83FF00C7059E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4024D1EB113D83FF00C7059E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tPRODUCT_NAME = TestAndBuild;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24308B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tINFOPLIST_FILE = Info.plist;\n\t\t\t\tINSTALL_PATH = \"@loader_path/../Frameworks\";\n\t\t\t\tPRODUCT_NAME = Widget;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24408B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tINFOPLIST_FILE = Info.plist;\n\t\t\t\tINSTALL_PATH = \"@loader_path/../Frameworks\";\n\t\t\t\tPRODUCT_NAME = Widget;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24708B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = 4.0;\n\t\t\t\tSDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24808B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = 4.0;\n\t\t\t\tSDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3B07BDF40E3F3FB600647869 /* Build configuration list for PBXNativeTarget \"WidgetFrameworkTest\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3B07BDEC0E3F3F9F00647869 /* Debug */,\n\t\t\t\t3B07BDED0E3F3F9F00647869 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4024D169113D7D4600C7059E /* Build configuration list for PBXAggregateTarget \"Test\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4024D163113D7D2400C7059E /* Debug */,\n\t\t\t\t4024D164113D7D2400C7059E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4024D1F0113D842B00C7059E /* Build configuration list for PBXAggregateTarget \"TestAndBuild\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4024D1EA113D83FF00C7059E /* Debug */,\n\t\t\t\t4024D1EB113D83FF00C7059E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"WidgetFramework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24308B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24408B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"WidgetFramework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24708B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24808B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 0867D690FE84028FC02AAC07 /* Project object */;\n}\n"
  },
  {
    "path": "Tests/iOS/xcode/Samples/FrameworkSample/runtests.sh",
    "content": "#!/bin/bash\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Executes the samples and tests for the Google Test Framework.\n\n# Help the dynamic linker find the path to the libraries.\nexport DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR\nexport DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR\n\n# Create some executables.\ntest_executables=$@\n\n# Now execute each one in turn keeping track of how many succeeded and failed.\nsucceeded=0\nfailed=0\nfailed_list=()\nfor test in ${test_executables[*]}; do\n  \"$test\"\n  result=$?\n  if [ $result -eq 0 ]; then\n    succeeded=$(( $succeeded + 1 ))\n  else\n    failed=$(( failed + 1 ))\n    failed_list=\"$failed_list $test\"\n  fi\ndone\n\n# Report the successes and failures to the console.\necho \"Tests complete with $succeeded successes and $failed failures.\"\nif [ $failed -ne 0 ]; then\n  echo \"The following tests failed:\"\n  echo $failed_list\nfi\nexit $failed\n"
  },
  {
    "path": "Tests/iOS/xcode/Samples/FrameworkSample/widget.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: preston.a.jackson@gmail.com (Preston Jackson)\n//\n// Google Test - FrameworkSample\n// widget.cc\n//\n\n// Widget is a very simple class used for demonstrating the use of gtest\n\n#include \"widget.h\"\n\nWidget::Widget(int number, const std::string& name)\n    : number_(number),\n      name_(name) {}\n\nWidget::~Widget() {}\n\nfloat Widget::GetFloatValue() const {\n  return number_;\n}\n\nint Widget::GetIntValue() const {\n  return static_cast<int>(number_);\n}\n\nstd::string Widget::GetStringValue() const {\n  return name_;\n}\n\nvoid Widget::GetCharPtrValue(char* buffer, size_t max_size) const {\n  // Copy the char* representation of name_ into buffer, up to max_size.\n  strncpy(buffer, name_.c_str(), max_size-1);\n  buffer[max_size-1] = '\\0';\n  return;\n}\n"
  },
  {
    "path": "Tests/iOS/xcode/Samples/FrameworkSample/widget.h",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: preston.a.jackson@gmail.com (Preston Jackson)\n//\n// Google Test - FrameworkSample\n// widget.h\n//\n\n// Widget is a very simple class used for demonstrating the use of gtest. It\n// simply stores two values a string and an integer, which are returned via\n// public accessors in multiple forms.\n\n#import <string>\n\nclass Widget {\n public:\n  Widget(int number, const std::string& name);\n  ~Widget();\n\n  // Public accessors to number data\n  float GetFloatValue() const;\n  int GetIntValue() const;\n\n  // Public accessors to the string data\n  std::string GetStringValue() const;\n  void GetCharPtrValue(char* buffer, size_t max_size) const;\n\n private:\n  // Data members\n  float number_;\n  std::string name_;\n};\n"
  },
  {
    "path": "Tests/iOS/xcode/Samples/FrameworkSample/widget_test.cc",
    "content": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Author: preston.a.jackson@gmail.com (Preston Jackson)\n//\n// Google Test - FrameworkSample\n// widget_test.cc\n//\n\n// This is a simple test file for the Widget class in the Widget.framework\n\n#include <string>\n#include \"gtest/gtest.h\"\n\n#include <Widget/widget.h>\n\n// This test verifies that the constructor sets the internal state of the\n// Widget class correctly.\nTEST(WidgetInitializerTest, TestConstructor) {\n  Widget widget(1.0f, \"name\");\n  EXPECT_FLOAT_EQ(1.0f, widget.GetFloatValue());\n  EXPECT_EQ(std::string(\"name\"), widget.GetStringValue());\n}\n\n// This test verifies the conversion of the float and string values to int and\n// char*, respectively.\nTEST(WidgetInitializerTest, TestConversion) {\n  Widget widget(1.0f, \"name\");\n  EXPECT_EQ(1, widget.GetIntValue());\n\n  size_t max_size = 128;\n  char buffer[max_size];\n  widget.GetCharPtrValue(buffer, max_size);\n  EXPECT_STREQ(\"name\", buffer);\n}\n\n// Use the Google Test main that is linked into the framework. It does something\n// like this:\n// int main(int argc, char** argv) {\n//   testing::InitGoogleTest(&argc, argv);\n//   return RUN_ALL_TESTS();\n// }\n"
  },
  {
    "path": "Tests/iOS/xcode/Scripts/runtests.sh",
    "content": "#!/bin/bash\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Executes the samples and tests for the Google Test Framework.\n\n# Help the dynamic linker find the path to the libraries.\nexport DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR\nexport DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR\n\n# Create some executables.\ntest_executables=(\"$BUILT_PRODUCTS_DIR/gtest_unittest-framework\"\n                  \"$BUILT_PRODUCTS_DIR/gtest_unittest\"\n                  \"$BUILT_PRODUCTS_DIR/sample1_unittest-framework\"\n                  \"$BUILT_PRODUCTS_DIR/sample1_unittest-static\")\n\n# Now execute each one in turn keeping track of how many succeeded and failed. \nsucceeded=0\nfailed=0\nfailed_list=()\nfor test in ${test_executables[*]}; do\n  \"$test\"\n  result=$?\n  if [ $result -eq 0 ]; then\n    succeeded=$(( $succeeded + 1 ))\n  else\n    failed=$(( failed + 1 ))\n    failed_list=\"$failed_list $test\"\n  fi\ndone\n\n# Report the successes and failures to the console.\necho \"Tests complete with $succeeded successes and $failed failures.\"\nif [ $failed -ne 0 ]; then\n  echo \"The following tests failed:\"\n  echo $failed_list\nfi\nexit $failed\n"
  },
  {
    "path": "Tests/iOS/xcode/Scripts/versiongenerate.py",
    "content": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\"\"\"A script to prepare version informtion for use the gtest Info.plist file.\n\n  This script extracts the version information from the configure.ac file and\n  uses it to generate a header file containing the same information. The\n  #defines in this header file will be included in during the generation of\n  the Info.plist of the framework, giving the correct value to the version\n  shown in the Finder.\n\n  This script makes the following assumptions (these are faults of the script,\n  not problems with the Autoconf):\n    1. The AC_INIT macro will be contained within the first 1024 characters\n       of configure.ac\n    2. The version string will be 3 integers separated by periods and will be\n       surrounded by squre brackets, \"[\" and \"]\" (e.g. [1.0.1]). The first\n       segment represents the major version, the second represents the minor\n       version and the third represents the fix version.\n    3. No \")\" character exists between the opening \"(\" and closing \")\" of\n       AC_INIT, including in comments and character strings.\n\"\"\"\n\nimport sys\nimport re\n\n# Read the command line argument (the output directory for Version.h)\nif (len(sys.argv) < 3):\n  print \"Usage: versiongenerate.py input_dir output_dir\"\n  sys.exit(1)\nelse:\n  input_dir = sys.argv[1]\n  output_dir = sys.argv[2]\n\n# Read the first 1024 characters of the configure.ac file\nconfig_file = open(\"%s/configure.ac\" % input_dir, 'r')\nbuffer_size = 1024\nopening_string = config_file.read(buffer_size)\nconfig_file.close()\n\n# Extract the version string from the AC_INIT macro\n#   The following init_expression means:\n#     Extract three integers separated by periods and surrounded by squre\n#     brackets(e.g. \"[1.0.1]\") between \"AC_INIT(\" and \")\". Do not be greedy\n#     (*? is the non-greedy flag) since that would pull in everything between\n#     the first \"(\" and the last \")\" in the file.\nversion_expression = re.compile(r\"AC_INIT\\(.*?\\[(\\d+)\\.(\\d+)\\.(\\d+)\\].*?\\)\",\n                                re.DOTALL)\nversion_values = version_expression.search(opening_string)\nmajor_version = version_values.group(1)\nminor_version = version_values.group(2)\nfix_version = version_values.group(3)\n\n# Write the version information to a header file to be included in the\n# Info.plist file.\nfile_data = \"\"\"//\n// DO NOT MODIFY THIS FILE (but you can delete it)\n//\n// This file is autogenerated by the versiongenerate.py script. This script\n// is executed in a \"Run Script\" build phase when creating gtest.framework. This\n// header file is not used during compilation of C-source. Rather, it simply\n// defines some version strings for substitution in the Info.plist. Because of\n// this, we are not not restricted to C-syntax nor are we using include guards.\n//\n\n#define GTEST_VERSIONINFO_SHORT %s.%s\n#define GTEST_VERSIONINFO_LONG %s.%s.%s\n\n\"\"\" % (major_version, minor_version, major_version, minor_version, fix_version)\nversion_file = open(\"%s/Version.h\" % output_dir, 'w')\nversion_file.write(file_data)\nversion_file.close()\n"
  },
  {
    "path": "Tests/iOS/xcode/gtest.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXAggregateTarget section */\n\t\t3B238F5F0E828B5400846E11 /* Check */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 3B238FA30E828BB600846E11 /* Build configuration list for PBXAggregateTarget \"Check\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3B238F5E0E828B5400846E11 /* ShellScript */,\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40899F9D0FFA740F000B29AE /* PBXTargetDependency */,\n\t\t\t\t40C849F7101A43440083642A /* PBXTargetDependency */,\n\t\t\t\t4089A0980FFAD34A000B29AE /* PBXTargetDependency */,\n\t\t\t\t40C849F9101A43490083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = Check;\n\t\t\tproductName = Check;\n\t\t};\n\t\t40C44ADC0E3798F4008FCC51 /* Version Info */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 40C44AE40E379905008FCC51 /* Build configuration list for PBXAggregateTarget \"Version Info\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C44ADB0E3798F4008FCC51 /* Generate Version.h */,\n\t\t\t);\n\t\t\tcomments = \"The generation of Version.h must be performed in its own target. Since the Info.plist is preprocessed before any of the other build phases in gtest, the Version.h file would not be ready if included as a build phase of that target.\";\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"Version Info\";\n\t\t\tproductName = Version.h;\n\t\t};\n/* End PBXAggregateTarget section */\n\n/* Begin PBXBuildFile section */\n\t\t224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */ = {isa = PBXBuildFile; fileRef = 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3BF6F2A00E79B5AD000F2EEE /* gtest-type-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */; };\n\t\t3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DB0E2F799B00CF7658 /* gtest-death-test.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t404884390E2F799B00CF7658 /* gtest-message.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DC0E2F799B00CF7658 /* gtest-message.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DD0E2F799B00CF7658 /* gtest-spi.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843B0E2F799B00CF7658 /* gtest.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DE0E2F799B00CF7658 /* gtest.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883E00E2F799B00CF7658 /* gtest_prod.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t404884500E2F799B00CF7658 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 404883F60E2F799B00CF7658 /* README */; };\n\t\t404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */; };\n\t\t404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E30E2F799B00CF7658 /* gtest-filepath.h */; };\n\t\t404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E40E2F799B00CF7658 /* gtest-internal.h */; };\n\t\t404884A30E2F7BE600CF7658 /* gtest-port.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E50E2F799B00CF7658 /* gtest-port.h */; };\n\t\t404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E60E2F799B00CF7658 /* gtest-string.h */; };\n\t\t404884AC0E2F7CD900CF7658 /* CHANGES in Resources */ = {isa = PBXBuildFile; fileRef = 404884A90E2F7CD900CF7658 /* CHANGES */; };\n\t\t404884AD0E2F7CD900CF7658 /* CONTRIBUTORS in Resources */ = {isa = PBXBuildFile; fileRef = 404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */; };\n\t\t404884AE0E2F7CD900CF7658 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 404884AB0E2F7CD900CF7658 /* LICENSE */; };\n\t\t40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };\n\t\t40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 40899F4D0FFA7271000B29AE /* gtest-tuple.h */; };\n\t\t40899F530FFA72A0000B29AE /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };\n\t\t4089A0440FFAD1BE000B29AE /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02C0FFACF7F000B29AE /* sample1.cc */; };\n\t\t4089A0460FFAD1BE000B29AE /* sample1_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */; };\n\t\t40C848FF101A21150083642A /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };\n\t\t40C84915101A21DF0083642A /* gtest_main.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4048840D0E2F799B00CF7658 /* gtest_main.cc */; };\n\t\t40C84916101A235B0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84921101A23AD0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84978101A36540083642A /* libgtest_main.a in Resources */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C84980101A36850083642A /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };\n\t\t40C84982101A36850083642A /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C848FA101A209C0083642A /* libgtest.a */; };\n\t\t40C84983101A36850083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C8498F101A36A60083642A /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02C0FFACF7F000B29AE /* sample1.cc */; };\n\t\t40C84990101A36A60083642A /* sample1_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */; };\n\t\t40C84992101A36A60083642A /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C848FA101A209C0083642A /* libgtest.a */; };\n\t\t40C84993101A36A60083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };\n\t\t40C849A2101A37050083642A /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4539C8FF0EC27F6400A70F4C /* gtest.framework */; };\n\t\t40C849A4101A37150083642A /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4539C8FF0EC27F6400A70F4C /* gtest.framework */; };\n\t\t4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 4539C9330EC280AE00A70F4C /* gtest-param-test.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4539C9380EC280E200A70F4C /* gtest-linked_ptr.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */; };\n\t\t4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */; };\n\t\t4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9370EC280E200A70F4C /* gtest-param-util.h */; };\n\t\t4567C8181264FF71007740BE /* gtest-printers.h in Headers */ = {isa = PBXBuildFile; fileRef = 4567C8171264FF71007740BE /* gtest-printers.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t40899F9C0FFA740F000B29AE /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40899F420FFA7184000B29AE;\n\t\t\tremoteInfo = gtest_unittest;\n\t\t};\n\t\t4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4089A0120FFACEFC000B29AE;\n\t\t\tremoteInfo = sample1_unittest;\n\t\t};\n\t\t408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C848F9101A209C0083642A;\n\t\t\tremoteInfo = \"gtest-static\";\n\t\t};\n\t\t40C44AE50E379922008FCC51 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C44ADC0E3798F4008FCC51;\n\t\t\tremoteInfo = Version.h;\n\t\t};\n\t\t40C8497C101A36850083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C848F9101A209C0083642A;\n\t\t\tremoteInfo = \"gtest-static\";\n\t\t};\n\t\t40C8497E101A36850083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8490A101A217E0083642A;\n\t\t\tremoteInfo = \"gtest_main-static\";\n\t\t};\n\t\t40C8498B101A36A60083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C848F9101A209C0083642A;\n\t\t\tremoteInfo = \"gtest-static\";\n\t\t};\n\t\t40C8498D101A36A60083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8490A101A217E0083642A;\n\t\t\tremoteInfo = \"gtest_main-static\";\n\t\t};\n\t\t40C8499B101A36DC0083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8490A101A217E0083642A;\n\t\t\tremoteInfo = \"gtest_main-static\";\n\t\t};\n\t\t40C8499D101A36E50083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = \"gtest-framework\";\n\t\t};\n\t\t40C8499F101A36F10083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;\n\t\t\tremoteInfo = \"gtest-framework\";\n\t\t};\n\t\t40C849F6101A43440083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C8497A101A36850083642A;\n\t\t\tremoteInfo = \"gtest_unittest-static\";\n\t\t};\n\t\t40C849F8101A43490083642A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0867D690FE84028FC02AAC07 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40C84989101A36A60083642A;\n\t\t\tremoteInfo = \"sample1_unittest-static\";\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t404884A50E2F7C0400CF7658 /* Copy Headers Internal */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = Headers/internal;\n\t\t\tdstSubfolderSpec = 6;\n\t\t\tfiles = (\n\t\t\t\t404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */,\n\t\t\t\t404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */,\n\t\t\t\t404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */,\n\t\t\t\t4539C9380EC280E200A70F4C /* gtest-linked_ptr.h in Copy Headers Internal */,\n\t\t\t\t4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */,\n\t\t\t\t4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */,\n\t\t\t\t404884A30E2F7BE600CF7658 /* gtest-port.h in Copy Headers Internal */,\n\t\t\t\t404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */,\n\t\t\t\t40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */,\n\t\t\t\t3BF6F2A00E79B5AD000F2EEE /* gtest-type-util.h in Copy Headers Internal */,\n\t\t\t);\n\t\t\tname = \"Copy Headers Internal\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t224A12A10E9EADA700BD17FD /* gtest-all.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = \"gtest-all.cc\"; sourceTree = \"<group>\"; };\n\t\t224A12A20E9EADCC00BD17FD /* gtest-test-part.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = \"gtest-test-part.h\"; sourceTree = \"<group>\"; };\n\t\t3B238C120E7FE13C00846E11 /* gtest_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_unittest.cc; sourceTree = \"<group>\"; };\n\t\t3B87D2100E96B92E000D1852 /* runtests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests.sh; sourceTree = \"<group>\"; };\n\t\t3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-type-util.h\"; sourceTree = \"<group>\"; };\n\t\t3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-typed-test.h\"; sourceTree = \"<group>\"; };\n\t\t403EE37C0E377822004BD1E2 /* versiongenerate.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = versiongenerate.py; sourceTree = \"<group>\"; };\n\t\t404883DB0E2F799B00CF7658 /* gtest-death-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-death-test.h\"; sourceTree = \"<group>\"; };\n\t\t404883DC0E2F799B00CF7658 /* gtest-message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-message.h\"; sourceTree = \"<group>\"; };\n\t\t404883DD0E2F799B00CF7658 /* gtest-spi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-spi.h\"; sourceTree = \"<group>\"; };\n\t\t404883DE0E2F799B00CF7658 /* gtest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest.h; sourceTree = \"<group>\"; };\n\t\t404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest_pred_impl.h; sourceTree = \"<group>\"; };\n\t\t404883E00E2F799B00CF7658 /* gtest_prod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest_prod.h; sourceTree = \"<group>\"; };\n\t\t404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-death-test-internal.h\"; sourceTree = \"<group>\"; };\n\t\t404883E30E2F799B00CF7658 /* gtest-filepath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-filepath.h\"; sourceTree = \"<group>\"; };\n\t\t404883E40E2F799B00CF7658 /* gtest-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-internal.h\"; sourceTree = \"<group>\"; };\n\t\t404883E50E2F799B00CF7658 /* gtest-port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-port.h\"; sourceTree = \"<group>\"; };\n\t\t404883E60E2F799B00CF7658 /* gtest-string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-string.h\"; sourceTree = \"<group>\"; };\n\t\t404883F60E2F799B00CF7658 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = ../README; sourceTree = SOURCE_ROOT; };\n\t\t4048840D0E2F799B00CF7658 /* gtest_main.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_main.cc; sourceTree = \"<group>\"; };\n\t\t404884A90E2F7CD900CF7658 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CHANGES; path = ../CHANGES; sourceTree = SOURCE_ROOT; };\n\t\t404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CONTRIBUTORS; path = ../CONTRIBUTORS; sourceTree = SOURCE_ROOT; };\n\t\t404884AB0E2F7CD900CF7658 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = SOURCE_ROOT; };\n\t\t40899F430FFA7184000B29AE /* gtest_unittest-framework */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = \"gtest_unittest-framework\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40899F4D0FFA7271000B29AE /* gtest-tuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-tuple.h\"; sourceTree = \"<group>\"; };\n\t\t40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = StaticLibraryTarget.xcconfig; sourceTree = \"<group>\"; };\n\t\t4089A0130FFACEFC000B29AE /* sample1_unittest-framework */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = \"sample1_unittest-framework\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t4089A02C0FFACF7F000B29AE /* sample1.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sample1.cc; sourceTree = \"<group>\"; };\n\t\t4089A02D0FFACF7F000B29AE /* sample1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sample1.h; sourceTree = \"<group>\"; };\n\t\t4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sample1_unittest.cc; sourceTree = \"<group>\"; };\n\t\t40C848FA101A209C0083642A /* libgtest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C8490B101A217E0083642A /* libgtest_main.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgtest_main.a; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C84987101A36850083642A /* gtest_unittest */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = gtest_unittest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40C84997101A36A60083642A /* sample1_unittest-static */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = \"sample1_unittest-static\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t40D4CDF10E30E07400294801 /* DebugProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugProject.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FrameworkTarget.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CDF30E30E07400294801 /* General.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ReleaseProject.xcconfig; sourceTree = \"<group>\"; };\n\t\t40D4CF510E30F5E200294801 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t4539C8FF0EC27F6400A70F4C /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = gtest.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t4539C9330EC280AE00A70F4C /* gtest-param-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-param-test.h\"; sourceTree = \"<group>\"; };\n\t\t4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-linked_ptr.h\"; sourceTree = \"<group>\"; };\n\t\t4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-param-util-generated.h\"; sourceTree = \"<group>\"; };\n\t\t4539C9370EC280E200A70F4C /* gtest-param-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-param-util.h\"; sourceTree = \"<group>\"; };\n\t\t4567C8171264FF71007740BE /* gtest-printers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"gtest-printers.h\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t40899F410FFA7184000B29AE /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C849A4101A37150083642A /* gtest.framework in Frameworks */,\n\t\t\t\t40C84916101A235B0083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4089A0110FFACEFC000B29AE /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C849A2101A37050083642A /* gtest.framework in Frameworks */,\n\t\t\t\t40C84921101A23AD0083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C84981101A36850083642A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84982101A36850083642A /* libgtest.a in Frameworks */,\n\t\t\t\t40C84983101A36850083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C84991101A36A60083642A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84992101A36A60083642A /* libgtest.a in Frameworks */,\n\t\t\t\t40C84993101A36A60083642A /* libgtest_main.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t034768DDFF38A45A11DB9C8B /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4539C8FF0EC27F6400A70F4C /* gtest.framework */,\n\t\t\t\t40C848FA101A209C0083642A /* libgtest.a */,\n\t\t\t\t40C8490B101A217E0083642A /* libgtest_main.a */,\n\t\t\t\t40899F430FFA7184000B29AE /* gtest_unittest-framework */,\n\t\t\t\t40C84987101A36850083642A /* gtest_unittest */,\n\t\t\t\t4089A0130FFACEFC000B29AE /* sample1_unittest-framework */,\n\t\t\t\t40C84997101A36A60083642A /* sample1_unittest-static */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0867D691FE84028FC02AAC07 /* gtest */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40D4CDF00E30E07400294801 /* Config */,\n\t\t\t\t08FB77ACFE841707C02AAC07 /* Source */,\n\t\t\t\t40D4CF4E0E30F5E200294801 /* Resources */,\n\t\t\t\t403EE37B0E377822004BD1E2 /* Scripts */,\n\t\t\t\t034768DDFF38A45A11DB9C8B /* Products */,\n\t\t\t);\n\t\t\tname = gtest;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t08FB77ACFE841707C02AAC07 /* Source */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404884A90E2F7CD900CF7658 /* CHANGES */,\n\t\t\t\t404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */,\n\t\t\t\t404884AB0E2F7CD900CF7658 /* LICENSE */,\n\t\t\t\t404883F60E2F799B00CF7658 /* README */,\n\t\t\t\t404883D90E2F799B00CF7658 /* include */,\n\t\t\t\t4089A02F0FFACF84000B29AE /* samples */,\n\t\t\t\t404884070E2F799B00CF7658 /* src */,\n\t\t\t\t3B238BF00E7FE13B00846E11 /* test */,\n\t\t\t);\n\t\t\tname = Source;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3B238BF00E7FE13B00846E11 /* test */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3B238C120E7FE13C00846E11 /* gtest_unittest.cc */,\n\t\t\t);\n\t\t\tname = test;\n\t\t\tpath = ../test;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t403EE37B0E377822004BD1E2 /* Scripts */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t403EE37C0E377822004BD1E2 /* versiongenerate.py */,\n\t\t\t\t3B87D2100E96B92E000D1852 /* runtests.sh */,\n\t\t\t);\n\t\t\tpath = Scripts;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t404883D90E2F799B00CF7658 /* include */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404883DA0E2F799B00CF7658 /* gtest */,\n\t\t\t);\n\t\t\tname = include;\n\t\t\tpath = ../include;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t404883DA0E2F799B00CF7658 /* gtest */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404883E10E2F799B00CF7658 /* internal */,\n\t\t\t\t224A12A20E9EADCC00BD17FD /* gtest-test-part.h */,\n\t\t\t\t404883DB0E2F799B00CF7658 /* gtest-death-test.h */,\n\t\t\t\t404883DC0E2F799B00CF7658 /* gtest-message.h */,\n\t\t\t\t4539C9330EC280AE00A70F4C /* gtest-param-test.h */,\n\t\t\t\t4567C8171264FF71007740BE /* gtest-printers.h */,\n\t\t\t\t404883DD0E2F799B00CF7658 /* gtest-spi.h */,\n\t\t\t\t404883DE0E2F799B00CF7658 /* gtest.h */,\n\t\t\t\t404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */,\n\t\t\t\t404883E00E2F799B00CF7658 /* gtest_prod.h */,\n\t\t\t\t3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */,\n\t\t\t);\n\t\t\tpath = gtest;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t404883E10E2F799B00CF7658 /* internal */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */,\n\t\t\t\t404883E30E2F799B00CF7658 /* gtest-filepath.h */,\n\t\t\t\t404883E40E2F799B00CF7658 /* gtest-internal.h */,\n\t\t\t\t4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */,\n\t\t\t\t4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */,\n\t\t\t\t4539C9370EC280E200A70F4C /* gtest-param-util.h */,\n\t\t\t\t404883E50E2F799B00CF7658 /* gtest-port.h */,\n\t\t\t\t404883E60E2F799B00CF7658 /* gtest-string.h */,\n\t\t\t\t40899F4D0FFA7271000B29AE /* gtest-tuple.h */,\n\t\t\t\t3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */,\n\t\t\t);\n\t\t\tpath = internal;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t404884070E2F799B00CF7658 /* src */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t224A12A10E9EADA700BD17FD /* gtest-all.cc */,\n\t\t\t\t4048840D0E2F799B00CF7658 /* gtest_main.cc */,\n\t\t\t);\n\t\t\tname = src;\n\t\t\tpath = ../src;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t4089A02F0FFACF84000B29AE /* samples */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4089A02C0FFACF7F000B29AE /* sample1.cc */,\n\t\t\t\t4089A02D0FFACF7F000B29AE /* sample1.h */,\n\t\t\t\t4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */,\n\t\t\t);\n\t\t\tname = samples;\n\t\t\tpath = ../samples;\n\t\t\tsourceTree = SOURCE_ROOT;\n\t\t};\n\t\t40D4CDF00E30E07400294801 /* Config */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40D4CDF10E30E07400294801 /* DebugProject.xcconfig */,\n\t\t\t\t40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */,\n\t\t\t\t40D4CDF30E30E07400294801 /* General.xcconfig */,\n\t\t\t\t40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */,\n\t\t\t\t40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */,\n\t\t\t);\n\t\t\tpath = Config;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t40D4CF4E0E30F5E200294801 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40D4CF510E30F5E200294801 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */,\n\t\t\t\t404884390E2F799B00CF7658 /* gtest-message.h in Headers */,\n\t\t\t\t4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */,\n\t\t\t\t4567C8181264FF71007740BE /* gtest-printers.h in Headers */,\n\t\t\t\t3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */,\n\t\t\t\t4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */,\n\t\t\t\t4048843B0E2F799B00CF7658 /* gtest.h in Headers */,\n\t\t\t\t4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */,\n\t\t\t\t4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */,\n\t\t\t\t224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t40899F420FFA7184000B29AE /* gtest_unittest-framework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40899F4A0FFA71BC000B29AE /* Build configuration list for PBXNativeTarget \"gtest_unittest-framework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40899F400FFA7184000B29AE /* Sources */,\n\t\t\t\t40899F410FFA7184000B29AE /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C849A0101A36F10083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"gtest_unittest-framework\";\n\t\t\tproductName = gtest_unittest;\n\t\t\tproductReference = 40899F430FFA7184000B29AE /* gtest_unittest-framework */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t4089A0120FFACEFC000B29AE /* sample1_unittest-framework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4089A0240FFACF01000B29AE /* Build configuration list for PBXNativeTarget \"sample1_unittest-framework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t4089A0100FFACEFC000B29AE /* Sources */,\n\t\t\t\t4089A0110FFACEFC000B29AE /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C8499E101A36E50083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"sample1_unittest-framework\";\n\t\t\tproductName = sample1_unittest;\n\t\t\tproductReference = 4089A0130FFACEFC000B29AE /* sample1_unittest-framework */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t40C848F9101A209C0083642A /* gtest-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84902101A212E0083642A /* Build configuration list for PBXNativeTarget \"gtest-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C848F7101A209C0083642A /* Sources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"gtest-static\";\n\t\t\tproductName = \"gtest-static\";\n\t\t\tproductReference = 40C848FA101A209C0083642A /* libgtest.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n\t\t40C8490A101A217E0083642A /* gtest_main-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84912101A21D20083642A /* Build configuration list for PBXNativeTarget \"gtest_main-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C84908101A217E0083642A /* Sources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"gtest_main-static\";\n\t\t\tproductName = \"gtest_main-static\";\n\t\t\tproductReference = 40C8490B101A217E0083642A /* libgtest_main.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n\t\t40C8497A101A36850083642A /* gtest_unittest-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84984101A36850083642A /* Build configuration list for PBXNativeTarget \"gtest_unittest-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C8497F101A36850083642A /* Sources */,\n\t\t\t\t40C84981101A36850083642A /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C8497B101A36850083642A /* PBXTargetDependency */,\n\t\t\t\t40C8497D101A36850083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"gtest_unittest-static\";\n\t\t\tproductName = gtest_unittest;\n\t\t\tproductReference = 40C84987101A36850083642A /* gtest_unittest */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t40C84989101A36A60083642A /* sample1_unittest-static */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 40C84994101A36A60083642A /* Build configuration list for PBXNativeTarget \"sample1_unittest-static\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40C8498E101A36A60083642A /* Sources */,\n\t\t\t\t40C84991101A36A60083642A /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C8498A101A36A60083642A /* PBXTargetDependency */,\n\t\t\t\t40C8498C101A36A60083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"sample1_unittest-static\";\n\t\t\tproductName = sample1_unittest;\n\t\t\tproductReference = 40C84997101A36A60083642A /* sample1_unittest-static */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n\t\t8D07F2BC0486CC7A007CD1D0 /* gtest-framework */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"gtest-framework\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t8D07F2C10486CC7A007CD1D0 /* Sources */,\n\t\t\t\t8D07F2BD0486CC7A007CD1D0 /* Headers */,\n\t\t\t\t404884A50E2F7C0400CF7658 /* Copy Headers Internal */,\n\t\t\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t40C44AE60E379922008FCC51 /* PBXTargetDependency */,\n\t\t\t\t408BEC101046CFE900DEF522 /* PBXTargetDependency */,\n\t\t\t\t40C8499C101A36DC0083642A /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"gtest-framework\";\n\t\t\tproductInstallPath = \"$(HOME)/Library/Frameworks\";\n\t\t\tproductName = gtest;\n\t\t\tproductReference = 4539C8FF0EC27F6400A70F4C /* gtest.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t0867D690FE84028FC02AAC07 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 0460;\n\t\t\t};\n\t\t\tbuildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"gtest\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 1;\n\t\t\tknownRegions = (\n\t\t\t\tEnglish,\n\t\t\t\tJapanese,\n\t\t\t\tFrench,\n\t\t\t\tGerman,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 0867D691FE84028FC02AAC07 /* gtest */;\n\t\t\tproductRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t8D07F2BC0486CC7A007CD1D0 /* gtest-framework */,\n\t\t\t\t40C848F9101A209C0083642A /* gtest-static */,\n\t\t\t\t40C8490A101A217E0083642A /* gtest_main-static */,\n\t\t\t\t40899F420FFA7184000B29AE /* gtest_unittest-framework */,\n\t\t\t\t40C8497A101A36850083642A /* gtest_unittest-static */,\n\t\t\t\t4089A0120FFACEFC000B29AE /* sample1_unittest-framework */,\n\t\t\t\t40C84989101A36A60083642A /* sample1_unittest-static */,\n\t\t\t\t3B238F5F0E828B5400846E11 /* Check */,\n\t\t\t\t40C44ADC0E3798F4008FCC51 /* Version Info */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t8D07F2BF0486CC7A007CD1D0 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t404884500E2F799B00CF7658 /* README in Resources */,\n\t\t\t\t404884AC0E2F7CD900CF7658 /* CHANGES in Resources */,\n\t\t\t\t404884AD0E2F7CD900CF7658 /* CONTRIBUTORS in Resources */,\n\t\t\t\t404884AE0E2F7CD900CF7658 /* LICENSE in Resources */,\n\t\t\t\t40C84978101A36540083642A /* libgtest_main.a in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t3B238F5E0E828B5400846E11 /* ShellScript */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"# Remember, this \\\"Run Script\\\" build phase will be executed from $SRCROOT\\n/bin/bash Scripts/runtests.sh\";\n\t\t};\n\t\t40C44ADB0E3798F4008FCC51 /* Generate Version.h */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"$(SRCROOT)/Scripts/versiongenerate.py\",\n\t\t\t\t\"$(SRCROOT)/../configure.ac\",\n\t\t\t);\n\t\t\tname = \"Generate Version.h\";\n\t\t\toutputPaths = (\n\t\t\t\t\"$(PROJECT_TEMP_DIR)/Version.h\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"# Remember, this \\\"Run Script\\\" build phase will be executed from $SRCROOT\\n/usr/bin/python Scripts/versiongenerate.py ../ $PROJECT_TEMP_DIR\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t40899F400FFA7184000B29AE /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40899F530FFA72A0000B29AE /* gtest_unittest.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4089A0100FFACEFC000B29AE /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4089A0440FFAD1BE000B29AE /* sample1.cc in Sources */,\n\t\t\t\t4089A0460FFAD1BE000B29AE /* sample1_unittest.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C848F7101A209C0083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C848FF101A21150083642A /* gtest-all.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C84908101A217E0083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84915101A21DF0083642A /* gtest_main.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C8497F101A36850083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C84980101A36850083642A /* gtest_unittest.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t40C8498E101A36A60083642A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40C8498F101A36A60083642A /* sample1.cc in Sources */,\n\t\t\t\t40C84990101A36A60083642A /* sample1_unittest.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t8D07F2C10486CC7A007CD1D0 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t40899F9D0FFA740F000B29AE /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40899F420FFA7184000B29AE /* gtest_unittest-framework */;\n\t\t\ttargetProxy = 40899F9C0FFA740F000B29AE /* PBXContainerItemProxy */;\n\t\t};\n\t\t4089A0980FFAD34A000B29AE /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 4089A0120FFACEFC000B29AE /* sample1_unittest-framework */;\n\t\t\ttargetProxy = 4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */;\n\t\t};\n\t\t408BEC101046CFE900DEF522 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C848F9101A209C0083642A /* gtest-static */;\n\t\t\ttargetProxy = 408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C44AE60E379922008FCC51 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C44ADC0E3798F4008FCC51 /* Version Info */;\n\t\t\ttargetProxy = 40C44AE50E379922008FCC51 /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8497B101A36850083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C848F9101A209C0083642A /* gtest-static */;\n\t\t\ttargetProxy = 40C8497C101A36850083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8497D101A36850083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8490A101A217E0083642A /* gtest_main-static */;\n\t\t\ttargetProxy = 40C8497E101A36850083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8498A101A36A60083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C848F9101A209C0083642A /* gtest-static */;\n\t\t\ttargetProxy = 40C8498B101A36A60083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8498C101A36A60083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8490A101A217E0083642A /* gtest_main-static */;\n\t\t\ttargetProxy = 40C8498D101A36A60083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8499C101A36DC0083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8490A101A217E0083642A /* gtest_main-static */;\n\t\t\ttargetProxy = 40C8499B101A36DC0083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C8499E101A36E50083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */;\n\t\t\ttargetProxy = 40C8499D101A36E50083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C849A0101A36F10083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */;\n\t\t\ttargetProxy = 40C8499F101A36F10083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C849F7101A43440083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C8497A101A36850083642A /* gtest_unittest-static */;\n\t\t\ttargetProxy = 40C849F6101A43440083642A /* PBXContainerItemProxy */;\n\t\t};\n\t\t40C849F9101A43490083642A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 40C84989101A36A60083642A /* sample1_unittest-static */;\n\t\t\ttargetProxy = 40C849F8101A43490083642A /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t3B238F600E828B5400846E11 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = Check;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t3B238F610E828B5400846E11 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = Check;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tZERO_LINK = NO;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40899F450FFA7185000B29AE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = ../;\n\t\t\t\tPRODUCT_NAME = \"gtest_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40899F460FFA7185000B29AE /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = ../;\n\t\t\t\tPRODUCT_NAME = \"gtest_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4089A0150FFACEFD000B29AE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = \"sample1_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4089A0160FFACEFD000B29AE /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = \"sample1_unittest-framework\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C44ADF0E3798F4008FCC51 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.7;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tTARGET_NAME = gtest;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C44AE00E3798F4008FCC51 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.7;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tTARGET_NAME = gtest;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C848FB101A209D0083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_INLINES_ARE_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t../,\n\t\t\t\t\t../include/,\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C848FC101A209D0083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_INLINES_ARE_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t../,\n\t\t\t\t\t../include/,\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C8490E101A217F0083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t../,\n\t\t\t\t\t../include/,\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest_main;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C8490F101A217F0083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t../,\n\t\t\t\t\t../include/,\n\t\t\t\t);\n\t\t\t\tPRODUCT_NAME = gtest_main;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C84985101A36850083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = ../;\n\t\t\t\tPRODUCT_NAME = gtest_unittest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C84986101A36850083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = ../;\n\t\t\t\tPRODUCT_NAME = gtest_unittest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t40C84995101A36A60083642A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = \"sample1_unittest-static\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t40C84996101A36A60083642A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tPRODUCT_NAME = \"sample1_unittest-static\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24308B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t../,\n\t\t\t\t\t../include/,\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Resources/Info.plist;\n\t\t\t\tINFOPLIST_PREFIX_HEADER = \"$(PROJECT_TEMP_DIR)/Version.h\";\n\t\t\t\tINFOPLIST_PREPROCESS = YES;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24408B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t../,\n\t\t\t\t\t../include/,\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Resources/Info.plist;\n\t\t\t\tINFOPLIST_PREFIX_HEADER = \"$(PROJECT_TEMP_DIR)/Version.h\";\n\t\t\t\tINFOPLIST_PREPROCESS = YES;\n\t\t\t\tPRODUCT_NAME = gtest;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4FADC24708B4156D00ABE55E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF10E30E07400294801 /* DebugProject.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4FADC24808B4156D00ABE55E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3B238FA30E828BB600846E11 /* Build configuration list for PBXAggregateTarget \"Check\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t3B238F600E828B5400846E11 /* Debug */,\n\t\t\t\t3B238F610E828B5400846E11 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40899F4A0FFA71BC000B29AE /* Build configuration list for PBXNativeTarget \"gtest_unittest-framework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40899F450FFA7185000B29AE /* Debug */,\n\t\t\t\t40899F460FFA7185000B29AE /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4089A0240FFACF01000B29AE /* Build configuration list for PBXNativeTarget \"sample1_unittest-framework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4089A0150FFACEFD000B29AE /* Debug */,\n\t\t\t\t4089A0160FFACEFD000B29AE /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C44AE40E379905008FCC51 /* Build configuration list for PBXAggregateTarget \"Version Info\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C44ADF0E3798F4008FCC51 /* Debug */,\n\t\t\t\t40C44AE00E3798F4008FCC51 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84902101A212E0083642A /* Build configuration list for PBXNativeTarget \"gtest-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C848FB101A209D0083642A /* Debug */,\n\t\t\t\t40C848FC101A209D0083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84912101A21D20083642A /* Build configuration list for PBXNativeTarget \"gtest_main-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C8490E101A217F0083642A /* Debug */,\n\t\t\t\t40C8490F101A217F0083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84984101A36850083642A /* Build configuration list for PBXNativeTarget \"gtest_unittest-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C84985101A36850083642A /* Debug */,\n\t\t\t\t40C84986101A36850083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t40C84994101A36A60083642A /* Build configuration list for PBXNativeTarget \"sample1_unittest-static\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t40C84995101A36A60083642A /* Debug */,\n\t\t\t\t40C84996101A36A60083642A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget \"gtest-framework\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24308B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24408B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject \"gtest\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4FADC24708B4156D00ABE55E /* Debug */,\n\t\t\t\t4FADC24808B4156D00ABE55E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 0867D690FE84028FC02AAC07 /* Project object */;\n}\n"
  },
  {
    "path": "Tests/testcases_common/CKLBNodeRenderCountTest.cpp",
    "content": "#include \"gtest/gtest.h\"\n\n#define private public\n#define protected public\n#include <PlaygroundOSS/CKLBNode.h>\n#undef protected\n#undef private\n\n/**\n * Regression test for https://github.com/KLab/PlaygroundOSS/pull/51\n */\nTEST(CKLBNodeRenderCountTest, Increment)\n{\n\tCKLBNode *node = new CKLBNode();\n\tnode->setRenderSlotCount(2);\n\tEXPECT_EQ(2, node->m_renderCount);\n\tnode->setRenderSlotCount(3);\n\tEXPECT_EQ(3, node->m_renderCount);\n}\n\nTEST(CKLBNodeRenderCountTest, NoChange)\n{\n\tCKLBNode *node = new CKLBNode();\n\tnode->setRenderSlotCount(2);\n\tEXPECT_EQ(2, node->m_renderCount);\n\tnode->setRenderSlotCount(2);\n\tEXPECT_EQ(2, node->m_renderCount);\n}\n\nTEST(CKLBNodeRenderCountTest, Decrement)\n{\n\tCKLBNode *node = new CKLBNode();\n\tnode->setRenderSlotCount(2);\n\tEXPECT_EQ(2, node->m_renderCount);\n\tnode->setRenderSlotCount(1);\n\tEXPECT_EQ(1, node->m_renderCount);\n}\n"
  },
  {
    "path": "Tools/Toboggan/.gitignore",
    "content": "# for Mac environment\nlibsqlite3.0.dylib\n\n"
  },
  {
    "path": "Tools/Toboggan/KLBToolHost.application",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<asmv1:assembly xsi:schemaLocation=\"urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd\" manifestVersion=\"1.0\" xmlns:asmv1=\"urn:schemas-microsoft-com:asm.v1\" xmlns=\"urn:schemas-microsoft-com:asm.v2\" xmlns:asmv2=\"urn:schemas-microsoft-com:asm.v2\" xmlns:xrml=\"urn:mpeg:mpeg21:2003:01-REL-R-NS\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:asmv3=\"urn:schemas-microsoft-com:asm.v3\" xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:co.v1=\"urn:schemas-microsoft-com:clickonce.v1\" xmlns:co.v2=\"urn:schemas-microsoft-com:clickonce.v2\">\r\n  <assemblyIdentity name=\"KLBToolHost.application\" version=\"1.17.3.4\" publicKeyToken=\"0000000000000000\" language=\"neutral\" processorArchitecture=\"x86\" xmlns=\"urn:schemas-microsoft-com:asm.v1\" />\r\n  <description asmv2:publisher=\"KLab Inc.\" co.v1:suiteName=\"KLBGameEngine\" asmv2:product=\"Toboggan\" xmlns=\"urn:schemas-microsoft-com:asm.v1\" />\r\n  <deployment install=\"true\" mapFileExtensions=\"true\">\r\n    <subscription>\r\n      <update>\r\n        <beforeApplicationStartup />\r\n      </update>\r\n    </subscription>\r\n    <deploymentProvider codebase=\"http://intra.klab.org/~nakazawa-k/KLBToolHost/KLBToolHost.application\" />\r\n  </deployment>\r\n  <compatibleFrameworks xmlns=\"urn:schemas-microsoft-com:clickonce.v2\">\r\n    <framework targetVersion=\"4.0\" profile=\"Full\" supportedRuntime=\"4.0.30319\" />\r\n  </compatibleFrameworks>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" codebase=\"KLBToolHost.exe.manifest\" size=\"47124\">\r\n      <assemblyIdentity name=\"KLBToolHost.exe\" version=\"1.17.3.4\" publicKeyToken=\"0000000000000000\" language=\"neutral\" processorArchitecture=\"x86\" type=\"win32\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>RVdiwk0Up7/s/a891jL/k3Pwd80=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n</asmv1:assembly>"
  },
  {
    "path": "Tools/Toboggan/KLBToolHost.exe.config",
    "content": "<?xml version=\"1.0\"?>\r\n<configuration>\r\n  <configSections>\r\n        <sectionGroup name=\"userSettings\" type=\"System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\">\r\n            <section name=\"KLBToolHost.Properties.Settings\" type=\"System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" allowExeDefinition=\"MachineToLocalUser\" requirePermission=\"false\"/>\r\n        </sectionGroup>\r\n    </configSections>\r\n    <userSettings>\r\n        <KLBToolHost.Properties.Settings>\r\n            <setting name=\"lastUsedProjectDir\" serializeAs=\"String\">\r\n                <value />\r\n            </setting>\r\n            <setting name=\"MainAppSettings\" serializeAs=\"String\">\r\n                <value />\r\n            </setting>\r\n            <setting name=\"PluginSettings\" serializeAs=\"String\">\r\n                <value />\r\n            </setting>\r\n            <setting name=\"MaxRecentItemCount\" serializeAs=\"String\">\r\n                <value>15</value>\r\n            </setting>\r\n            <setting name=\"lastWindowState\" serializeAs=\"String\">\r\n                <value />\r\n            </setting>\r\n        </KLBToolHost.Properties.Settings>\r\n    </userSettings>\r\n  <startup useLegacyV2RuntimeActivationPolicy=\"true\">\r\n    <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.0\"/>\r\n  </startup>\r\n  <runtime>\r\n    <loadFromRemoteSources enabled=\"true\" />\r\n  </runtime>\r\n</configuration>\r\n"
  },
  {
    "path": "Tools/Toboggan/KLBToolHost.exe.manifest",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<asmv1:assembly xsi:schemaLocation=\"urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd\" manifestVersion=\"1.0\" xmlns:asmv1=\"urn:schemas-microsoft-com:asm.v1\" xmlns=\"urn:schemas-microsoft-com:asm.v2\" xmlns:asmv2=\"urn:schemas-microsoft-com:asm.v2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:co.v1=\"urn:schemas-microsoft-com:clickonce.v1\" xmlns:asmv3=\"urn:schemas-microsoft-com:asm.v3\" xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:co.v2=\"urn:schemas-microsoft-com:clickonce.v2\">\r\n  <asmv1:assemblyIdentity name=\"KLBToolHost.exe\" version=\"1.17.3.4\" publicKeyToken=\"0000000000000000\" language=\"neutral\" processorArchitecture=\"x86\" type=\"win32\" />\r\n  <application />\r\n  <entryPoint>\r\n    <assemblyIdentity name=\"KLBToolHost\" version=\"1.17.3.4\" language=\"neutral\" processorArchitecture=\"x86\" />\r\n    <commandLine file=\"KLBToolHost.exe\" parameters=\"\" />\r\n  </entryPoint>\r\n  <trustInfo>\r\n    <security>\r\n      <applicationRequestMinimum>\r\n        <PermissionSet version=\"1\" class=\"System.Security.NamedPermissionSet\" Name=\"LocalIntranet\" Description=\"Default rights given to applications on the local intranet\" Unrestricted=\"true\" ID=\"Custom\" SameSite=\"site\" />\r\n        <defaultAssemblyRequest permissionSetReference=\"Custom\" />\r\n      </applicationRequestMinimum>\r\n      <requestedPrivileges xmlns=\"urn:schemas-microsoft-com:asm.v3\">\r\n        <!-- UAC マニフェスト オプション\n             Windows のユーザー アカウント制御のレベルを変更するには、\n             requestedExecutionLevel ノードを以下のいずれかで置換します。\n\n        <requestedExecutionLevel  level=\"asInvoker\" uiAccess=\"false\" />\n        <requestedExecutionLevel  level=\"requireAdministrator\" uiAccess=\"false\" />\n        <requestedExecutionLevel  level=\"highestAvailable\" uiAccess=\"false\" />\n\n            下位互換性のためにファイルおよびレジストリの仮想化を\n            利用する場合は、requestedExecutionLevel ノードを削除してください。\n        -->\r\n        <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\" />\r\n      </requestedPrivileges>\r\n    </security>\r\n  </trustInfo>\r\n  <dependency>\r\n    <dependentOS>\r\n      <osVersionInfo>\r\n        <os majorVersion=\"5\" minorVersion=\"1\" buildNumber=\"2600\" servicePackMajor=\"0\" />\r\n      </osVersionInfo>\r\n    </dependentOS>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"preRequisite\" allowDelayedBinding=\"true\">\r\n      <assemblyIdentity name=\"Microsoft.Windows.CommonLanguageRuntime\" version=\"4.0.30319.0\" />\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"CommandLineParser.dll\" size=\"62464\">\r\n      <assemblyIdentity name=\"CommandLineParser\" version=\"2.6.0.3\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>WWs1mqScst+5002EaikmN/Q1KxU=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"KLBPluginInterfaces.dll\" size=\"18944\">\r\n      <assemblyIdentity name=\"KLBPluginInterfaces\" version=\"0.0.0.0\" publicKeyToken=\"6F600FC3779C1722\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>pwlJYIyKuOMK6lJ3NKu5tN8OEzs=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"KLBToolHost.exe\" size=\"948224\">\r\n      <assemblyIdentity name=\"KLBToolHost\" version=\"1.17.3.4\" language=\"neutral\" processorArchitecture=\"x86\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>juiBBoAmamvn6rIf3HEImDqYtu4=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"nunit.framework.dll\" size=\"147456\">\r\n      <assemblyIdentity name=\"nunit.framework\" version=\"2.6.2.12296\" publicKeyToken=\"96D09A1EB7F44A77\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>E0yU0aGl2Y/x5M6nh+/MQvxryrw=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.dll\" size=\"700416\">\r\n      <assemblyIdentity name=\"ServiceStack\" version=\"3.9.28.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>HojsJbrtCbj833Imrx4SVc9gMjg=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.Common.dll\" size=\"231424\">\r\n      <assemblyIdentity name=\"ServiceStack.Common\" version=\"3.9.28.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>1cAnd5XgqrUwP+V6QGH+TLHTBiU=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.Interfaces.dll\" size=\"89600\">\r\n      <assemblyIdentity name=\"ServiceStack.Interfaces\" version=\"3.9.28.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>KINV7dk6e9TABtKFM1vpAcTQpi0=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.OrmLite.dll\" size=\"134656\">\r\n      <assemblyIdentity name=\"ServiceStack.OrmLite\" version=\"3.9.28.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>z6bS+sNHRm/j/93BMcOch3szYfE=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.OrmLite.SqlServer.dll\" size=\"11264\">\r\n      <assemblyIdentity name=\"ServiceStack.OrmLite.SqlServer\" version=\"1.0.0.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>uF7eM95BjNIdxxBFJ2eTbX1CFJY=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.Redis.dll\" size=\"215040\">\r\n      <assemblyIdentity name=\"ServiceStack.Redis\" version=\"3.9.29.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>IeZ/l6Ib8BKn1HdId2S1mRu7Iic=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.ServiceInterface.dll\" size=\"259072\">\r\n      <assemblyIdentity name=\"ServiceStack.ServiceInterface\" version=\"1.0.0.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>mEl6XHuoK3uJb/zUvl5BcbjVxzU=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"ServiceStack.Text.dll\" size=\"164352\">\r\n      <assemblyIdentity name=\"ServiceStack.Text\" version=\"3.9.28.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>7Nb8R7M9BLpQSoiYf8s8JyDqdlA=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <dependency>\r\n    <dependentAssembly dependencyType=\"install\" allowDelayedBinding=\"true\" codebase=\"TobogganStatServer.dll\" size=\"8704\">\r\n      <assemblyIdentity name=\"TobogganStatServer\" version=\"1.0.0.0\" language=\"neutral\" processorArchitecture=\"msil\" />\r\n      <hash>\r\n        <dsig:Transforms>\r\n          <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n        </dsig:Transforms>\r\n        <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n        <dsig:DigestValue>bgEQNzHFachKwr9AYVFij+A7AQ8=</dsig:DigestValue>\r\n      </hash>\r\n    </dependentAssembly>\r\n  </dependency>\r\n  <file name=\"assimp.dll\" size=\"1747968\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>VLfO6ZaJayJhrNPwIXPXvpRu0rY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\GameEngine.exe\" size=\"4282368\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>EvxcRa40nIRJPm7b7jHKi+pyubg=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\glew32.dll\" size=\"322048\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>zOr9Dbj2ENvGYIWBy1uF7JM9QgY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\glew32mx.dll\" size=\"219648\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>kZbtn8uNS7bUo3nHyA+wEAtgyac=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\glut.dll\" size=\"169984\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>3Gpb/1+8pOQL4V3+CBl6DtIbSd8=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\glut32.dll\" size=\"169984\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>yV8CZ8ao/pIUatKKLwCRHJqumqc=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\JSon2BJSon.exe\" size=\"87040\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>Nkw53TSZ2lQjc9x+bRK/jg6VwFA=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\lame.exe\" size=\"640512\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>XYJAAYIn7PmDXalnE1b/n0IDBms=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\lame_enc.dll\" size=\"511488\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>nBvP5jADZidVtndY3NtRPMDnJFY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\libeay32.dll\" size=\"1156096\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>f3kjwnlkHAOxGvhaTrCDRd81ojc=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\libEGL.dll\" size=\"269824\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>Rk2dmhRZIbVyffD+0iXJnk2fuQY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\libgles_cm.dll\" size=\"680960\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>lAuR7NPzlq4dCWl225k0cZrezMw=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\libmp3lame.dll\" size=\"606720\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>5zOSZLacM6na/67ZjqrnCnCt1VE=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\lua52.dll\" size=\"140800\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>QIKhpS3AGY41BV63sIQC8PEpE18=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\luac52.exe\" size=\"179150\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>8mLwz/VP+AJ7yujh37r7qWjFCjY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\oggenc.exe\" size=\"3792384\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>+KxI3JiCrRNS6S2VdjHtWH9J+/8=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\rdbglua52.dll\" size=\"579072\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>DxCWosKx+jUpdITCbTlPZD110Iw=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\SincToPHP.exe\" size=\"139264\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>ERFPhVpw0Se/5Nn+IXKSThmMbNU=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\ssleay32.dll\" size=\"265216\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>MLKZsJlpz/YKt+gUS+3r/ZHShBY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"bundle\\swfmill.exe\" size=\"4521472\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>vq3MKUFdmKdokQc4YpGSlvVCOoo=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"CompilerCellAnim.dll\" size=\"7680\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>SiGM2melQDaHwO/FCC7oTS4hhm4=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"CompilerCellAnim.pdb\" size=\"15872\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>lq1wHLQCuSNGZbxw+5JM0L4e9Uc=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"ConverterSWF.dll\" size=\"38912\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>E7TBHQYCJqA/OwGQ8xXZE6iVCxA=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"ConverterSWF.pdb\" size=\"73216\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>g7/t5r6KmF39sQVkkkBKJcWNMZA=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"ICSharpCode.SharpZipLib.dll\" size=\"200704\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>ep35wl1JaQtqPEUWB9MRqGaxMfQ=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"KLBToolHost.exe.config\" size=\"1491\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>HAHIk4sUFxgYx4AoSDbQ2A0zxsc=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"KLBToolHost.pdb\" size=\"507392\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>faMtAQwXJcoheRyExkL3em8UiqI=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"Open Asset Importer Managed Wrapper.dll\" size=\"35328\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>wexwiilzXxUvjj0F5JYxbLuPwuo=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLB3DObjectPlugin.dll\" size=\"22016\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>1vx/bssDz7ZtMP0tz8zrU9/kLwg=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLB3DObjectPlugin.pdb\" size=\"48640\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>E/vOSq6Rk7RopwuIQXxyBr7B16I=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBAIEditor.dll\" size=\"89088\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>h0JM1tN3/N3OPS8FsdLvMvX/Fpk=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBAIEditor.pdb\" size=\"159232\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>DvJG2usXh7r22vkML8v5QHwb710=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBAudioPlugin.dll\" size=\"16896\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>YZjGIW45AxwU4cBLSikiCr72R3k=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBAudioPlugin.pdb\" size=\"36352\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>RbqHggUO98iULsQyPS6hC+lTSOI=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBCellPlugin.dll\" size=\"22528\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>TaC7gwi7N/iWPanXpOSNRb9tSiE=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBCellPlugin.pdb\" size=\"40448\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>zpOHtANJS34VYcYimiGEzv2uH/I=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBCSVPlugin.dll\" size=\"29184\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>9JNYd+l0JVCow8UcgVSxGLkFxFQ=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBCSVPlugin.pdb\" size=\"69120\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>zEa53fpEEsxR05NtDR1HKSvfP1E=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBFlashPlugin.dll\" size=\"25600\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>am+FNtjXJKHqiC5r14bUZXfUDmA=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBFlashPlugin.pdb\" size=\"40448\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>eo4KgC3KIIF56jy9Awncbrdz4oQ=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBImageEditor.dll\" size=\"180224\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>GQU1cknOOu8P2PgdjfeLPaCFNpE=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBImageEditor.pdb\" size=\"310784\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>Jpa9bFZ9U0V5B7PjtGwfgTl4BBg=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBLuaPlugin.dll\" size=\"19968\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>CN5H0RqRGvXCUS/+kAgoMilUF88=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBLuaPlugin.pdb\" size=\"36352\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>iooXKPkQWMzyEvgyr1JVzlDGo+0=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBMapPlugin.dll\" size=\"17920\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>PZkeAQzYB6nxTBlnwywU/VXfBBM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBMapPlugin.pdb\" size=\"36352\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>0EsmjrXBtZXqaZ5MMV2LyKCUjUM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBMoviePlugin.dll\" size=\"16384\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>l7UbQH8tSs0h/Iph+Jv4rd/6O04=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBMoviePlugin.pdb\" size=\"36352\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>n4zhAMkBHIIqPdBv6KtdGi3mlIM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBPluginInterfaces.dll\" size=\"18944\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>pwlJYIyKuOMK6lJ3NKu5tN8OEzs=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBPluginInterfaces.pdb\" size=\"13824\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>e+mPIY8y5EVVoVw/xM9Pu9oEvAM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBSincPlugin.dll\" size=\"17920\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>GeG50hui+3N6uRZ48KQupoyjwBU=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBSincPlugin.pdb\" size=\"40448\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>cbci7WWOGrnvYlorPFPfsVmOgFo=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBSwfInspectorPlugin.dll\" size=\"32768\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>YB5qyTLUgYrH6hzhrmISEV0Qr28=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBSwfInspectorPlugin.pdb\" size=\"77312\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>xWm4i7auwpFdGdX2XxqPwLedB9A=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBTextPlugin.dll\" size=\"15360\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>scxqF8fDOzLqev6OYF0UawSCslg=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBTextPlugin.pdb\" size=\"34304\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>0C/Hwh7Qo+w8+ccfq6gZAunhKEE=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBTextureEditor.dll\" size=\"224256\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>jXAzptvwysGEIT13kYGa45gS+QU=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBTextureEditor.pdb\" size=\"450048\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>3G7kHOJUO+242ktxZVVYz3p2Lns=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBUIEditor.dll\" size=\"528384\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>UbhVeUtb4gQwPq4Fq8oH2k9JB8M=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"plugins\\KLBUIEditor.pdb\" size=\"830976\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>vK1TjiZbf9o93NfU6G/6HbwKYNo=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"Pngcs.dll\" size=\"82944\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>/teZRr0piF4+xyh0ydvFcj8Mzts=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"PrjTemplate\\start.lua\" size=\"2\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>5qn8BDIKkk9Gx8c3QyuwOJ2d0JU=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"Resources\\folder.jpg\" size=\"781\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>eXbxuxtuGoDuUhh6K+pTO2ZkcYM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"SplineEditor.dll\" size=\"59904\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>QIrG6sPOERhOjBvi1aeSEWeE2tg=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"SplineEditor.pdb\" size=\"138752\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>lvCheui8X4bw9FC24hUBLqhOHNI=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"sqlite3.dll\" size=\"680448\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>LCoP0AHuXRvBevcz6666F1CaeL0=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"System.Data.SQLite.dll\" size=\"203776\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>TwEHiA0O+YLqr2qZ5UYKbGzGjaQ=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"System.Data.SQLite.pdb\" size=\"351744\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>HgztHB0NgfNyzONQy7IOgGykyqw=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\projectWithDependencyTemplate\\com_emblem01.png\" size=\"43738\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>c17mGHmRXhOPRiL+xmI4dNEWQe8=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\projectWithDependencyTemplate\\com_emblem01.png.xml\" size=\"1954\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>jjwB66RmWkk1K1NwLVIie5F9apA=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\projectWithDependencyTemplate\\start.lua\" size=\"5\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>zNCid9ePMHZf33pYn3d7gdvd8P8=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\projectWithDependencyTemplate\\tex.xml\" size=\"1381\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>te+R1kmsGEbFkS/2Q6frPunaIaQ=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\projectWithDependencyTemplate\\ui.xml\" size=\"2063\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>6uuVchzzUW2Lxk35Qqv3KRe/SFY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\simpleProjectTemplate\\subdir\\tinypng.png\" size=\"7044\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>o6VMG8Jh+YeChkEnqUw4eB9Vpcs=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\simpleProjectTemplate\\tile2.png\" size=\"3122\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>fENwjWLS9evTStXBkHeh+G9DXuM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\simpleProjectTemplate\\tile2.png.xml\" size=\"2028\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>gWIYxIYACCZwZfYD/1vUO0OKX1A=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\simpleProjectTemplate\\tile3.png\" size=\"3122\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>fENwjWLS9evTStXBkHeh+G9DXuM=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\simpleProjectTemplate\\tile3.png.xml\" size=\"2028\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>leVIexaA7v/GE9NU7PvFZ4rcArU=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\simpleProjectTemplate\\tileMappedTex.xml\" size=\"1683\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>TzpNGDt85sMtcDV1seOSpRwdKbw=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\.working\\NewTexture.texb\" size=\"33174\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>NZ2chgU/mXlD9VNOu19GTnwJyho=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\com_etc_105.png\" size=\"1105\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>KhymB1iew7+vBoV8DdH9O9eAiFE=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\com_etc_105.png.xml\" size=\"2182\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>zazB1XFfWu05JgJd8oMAPPx+rHU=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\com_etc_106.png\" size=\"1349\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>3+42+oFqNaBt3Sl/PE13jgjjsyI=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\com_etc_106.png.xml\" size=\"2174\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>QaijJn5J5HKVMdWcwqaxnauRhL0=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\ef_005_003.png\" size=\"904\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>CsrrZdj3KIqQosOpMt3saFzc6iY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\ef_005_003.png.xml\" size=\"2121\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>j1TkDkmYxIOC25qj8wVmgHDQHEo=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"testData\\texturePublishTemplate\\NewTexture.xml\" size=\"2063\" writeableType=\"applicationData\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>cJ151QqKmeiv/sxgk3bpFiM/m/s=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"Toboggan.ico\" size=\"99678\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>0eH/UZHE3YPisM9VtLoBzmqxfG8=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"x64\\SQLite.Interop.dll\" size=\"918016\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>xJkGKWvCCviP9fY99SslO78iYDY=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"x64\\SQLite.Interop.pdb\" size=\"1338368\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>njsom2r66/gniuSIFq+z8J/6T9Y=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"x86\\SQLite.Interop.dll\" size=\"680448\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>LCoP0AHuXRvBevcz6666F1CaeL0=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n  <file name=\"x86\\SQLite.Interop.pdb\" size=\"1567744\">\r\n    <hash>\r\n      <dsig:Transforms>\r\n        <dsig:Transform Algorithm=\"urn:schemas-microsoft-com:HashTransforms.Identity\" />\r\n      </dsig:Transforms>\r\n      <dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\r\n      <dsig:DigestValue>zMHhk96LRwkh4IrgbWCXKbeU6k0=</dsig:DigestValue>\r\n    </hash>\r\n  </file>\r\n</asmv1:assembly>"
  },
  {
    "path": "Tools/Toboggan/README.ja.md",
    "content": "# Toboggan の使い方\n\n## for Mac\n\nwineを使っても、monoを使っても、GUIを使うのは無理です！\n\n以下の手順で、他のプラットフォームで用意したリソースを利用可能な形式に変更することはできるようになります。\nhttps://docs.google.com/document/d/1BcnOGfAbiPY7T2yoxAwWdwAyuOOwaZLvejUbVtwMyzw/edit#\n\n手順を簡略化するため、上記セットアップを行うスクリプトを用意しました。\n`$ ./mac-setup.sh` を実行してください。\n\nあとは `mono ~/path/to/Toboggan/KLBToolHost.exe --verbose --clean --publish --force --all-profiles --directory .` とかで動くと思います。\n"
  },
  {
    "path": "Tools/Toboggan/ServiceStack.Common.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<doc>\r\n    <assembly>\r\n        <name>ServiceStack.Common</name>\r\n    </assembly>\r\n    <members>\r\n        <member name=\"M:ServiceStack.Common.StreamExtensions.Compress(System.String,System.String)\">\r\n            <summary>\r\n            Compresses the specified text using the default compression method: Deflate\r\n            </summary>\r\n            <param name=\"text\">The text.</param>\r\n            <param name=\"compressionType\">Type of the compression.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.StreamExtensions.Decompress(System.Byte[],System.String)\">\r\n            <summary>\r\n            Decompresses the specified gz buffer using the default compression method: Inflate\r\n            </summary>\r\n            <param name=\"gzBuffer\">The gz buffer.</param>\r\n            <param name=\"compressionType\">Type of the compression.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Validation.ValidationErrorResult\">\r\n            <summary>\r\n            Encapsulates a validation result.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Validation.ValidationErrorResult.#ctor\">\r\n            <summary>\r\n            Constructs a new ValidationResult\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Validation.ValidationErrorResult.#ctor(System.Collections.Generic.IList{ServiceStack.Validation.ValidationErrorField})\">\r\n            <summary>\r\n            Constructs a new ValidationResult\r\n            </summary>\r\n            <param name=\"errors\">A list of validation results</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Validation.ValidationErrorResult.#ctor(System.Collections.Generic.IList{ServiceStack.Validation.ValidationErrorField},System.String,System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Validation.ValidationErrorResult\"/> class.\r\n            </summary>\r\n            <param name=\"errors\">The errors.</param>\r\n            <param name=\"successCode\">The success code.</param>\r\n            <param name=\"errorCode\">The error code.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationErrorResult.SuccessCode\">\r\n            <summary>\r\n            Gets or sets the success code.\r\n            </summary>\r\n            <value>The success code.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationErrorResult.ErrorCode\">\r\n            <summary>\r\n            Gets or sets the error code.\r\n            </summary>\r\n            <value>The error code.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationErrorResult.SuccessMessage\">\r\n            <summary>\r\n            Gets or sets the success message.\r\n            </summary>\r\n            <value>The success message.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationErrorResult.ErrorMessage\">\r\n            <summary>\r\n            Gets or sets the error message.\r\n            </summary>\r\n            <value>The error message.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationErrorResult.Errors\">\r\n            <summary>\r\n            The errors generated by the validation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationErrorResult.IsValid\">\r\n            <summary>\r\n            Returns True if the validation was successful (errors list is empty).\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceModel.Serialization.DataContractDeserializer.quotas\">\r\n            <summary>\r\n            Default MaxStringContentLength is 8k, and throws an exception when reached\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.CommandsUtils.ExecuteAsyncCommandExec(System.Collections.Generic.IEnumerable{ServiceStack.DesignPatterns.Command.ICommandExec})\">\r\n            <summary>\r\n            Provide the an option for the callee to block until all commands are executed\r\n            </summary>\r\n            <param name=\"commands\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.IMessageHandlerFactory\">\r\n            <summary>\r\n            Encapsulates creating a new message handler\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Common.Extensions.EnumerableExtensions\">\r\n            <summary>\r\n            These extensions have a potential to conflict with the LINQ extensions methods so\r\n            leaving the implmentation in the 'Extensions' sub-namespace to force explicit opt-in\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceClient.Web.ServiceClientBase\">\r\n            Need to provide async request options\r\n            http://msdn.microsoft.com/en-us/library/86wf6409(VS.71).aspx\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceClient.Web.ServiceClientBase.httpWebRequestFilter\">\r\n            <summary>\r\n            The request filter is called before any request.\r\n            This request filter is executed globally.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceClient.Web.ServiceClientBase.httpWebResponseFilter\">\r\n            <summary>\r\n            The response action is called once the server response is available.\r\n            It will allow you to access raw response information. \r\n            This response action is executed globally.\r\n            Note that you should NOT consume the response stream as this is handled by ServiceStack\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.ServiceClientBase.SetBaseUri(System.String)\">\r\n            <summary>\r\n            Sets all baseUri properties, using the Format property for the SyncReplyBaseUri and AsyncOneWayBaseUri\r\n            </summary>\r\n            <param name=\"baseUri\">Base URI of the service</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.ServiceClientBase.SetBaseUri(System.String,System.String)\">\r\n            <summary>\r\n            Sets all baseUri properties allowing for a temporary override of the Format property\r\n            </summary>\r\n            <param name=\"baseUri\">Base URI of the service</param>\r\n            <param name=\"format\">Override of the Format property for the service</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.ServiceClientBase.SetCredentials(System.String,System.String)\">\r\n            <summary>\r\n            Sets the username and the password for basic authentication.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceClient.Web.ServiceClientBase.storeCookies\">\r\n            <summary>\r\n            Specifies if cookies should be stored\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.DisableAutoCompression\">\r\n            <summary>\r\n            Whether to Accept Gzip,Deflate Content-Encoding and to auto decompress responses\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.UserName\">\r\n            <summary>\r\n            The user name for basic authentication\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.Password\">\r\n            <summary>\r\n            The password for basic authentication\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.Credentials\">\r\n            <summary>\r\n            Gets or sets authentication information for the request.\r\n            Warning: It's recommened to use <see cref=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.UserName\"/> and <see cref=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.Password\"/> for basic auth.\r\n            This property is only used for IIS level authentication.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.AlwaysSendBasicAuthHeader\">\r\n            <summary>\r\n            Determines if the basic auth header should be sent with every request.\r\n            By default, the basic auth header is only sent when \"401 Unauthorized\" is returned.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.onAuthenticationRequired\">\r\n            <summary>\r\n            Called before request resend, when the initial request required authentication\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.localHttpWebRequestFilter\">\r\n            <summary>\r\n            The request filter is called before any request.\r\n            This request filter only works with the instance where it was set (not global).\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.ServiceClientBase.localHttpWebResponseFilter\">\r\n            <summary>\r\n            The response action is called once the server response is available.\r\n            It will allow you to access raw response information. \r\n            Note that you should NOT consume the response stream as this is handled by ServiceStack\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceClient.Web.GenericProxy`1\">\r\n            <summary>\r\n            Generic Proxy for service calls.\r\n            </summary>\r\n            <typeparam name=\"T\">The service Contract</typeparam>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.GenericProxy`1.Proxy\">\r\n            <summary>\r\n            Returns the transparent proxy for the service call\r\n            </summary>\r\n        </member>\r\n        <!-- Badly formed XML comment ignored for member \"M:ServiceStack.Common.Utils.AssertUtils.AreNotNull(System.Collections.Generic.IDictionary{System.String,System.Object})\" -->\r\n        <member name=\"T:ServiceStack.Messaging.MessageHandler`1\">\r\n            <summary>\r\n            Processes all messages in a Normal and Priority Queue.\r\n            Expects to be called in 1 thread. i.e. Non Thread-Safe.\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.IMessageHandler\">\r\n            <summary>\r\n            Single threaded message handler that can process all messages\r\n            of a particular message type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageHandler.Process(ServiceStack.Messaging.IMessageQueueClient)\">\r\n            <summary>\r\n            Process all messages pending\r\n            </summary>\r\n            <param name=\"mqClient\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageHandler.ProcessQueue(ServiceStack.Messaging.IMessageQueueClient,System.String,System.Func{System.Boolean})\">\r\n            <summary>\r\n            Process messages from a single queue.\r\n            </summary>\r\n            <param name=\"mqClient\"></param>\r\n            <param name=\"queueName\">The queue to process</param>\r\n            <param name=\"doNext\">A predicate on whether to continue processing the next message if any</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageHandler.GetStats\">\r\n            <summary>\r\n            Get Current Stats for this Message Handler\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.IMessageHandler.MessageType\">\r\n            <summary>\r\n            The type of the message this handler processes\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Common.Extensions.IPAddressExtensions\">\r\n            <summary>\r\n            Useful IPAddressExtensions from: \r\n            http://blogs.msdn.com/knom/archive/2008/12/31/ip-address-calculations-with-c-subnetmasks-networks.aspx\r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Extensions.IPAddressExtensions.GetAllNetworkInterfaceIpv4Addresses\">\r\n            <summary>\r\n            Gets the ipv4 addresses from all Network Interfaces that have Subnet masks.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Extensions.IPAddressExtensions.GetAllNetworkInterfaceIpv6Addresses\">\r\n            <summary>\r\n            Gets the ipv6 addresses from all Network Interfaces.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Support.LogicFacadeBase.Execute``1(ServiceStack.DesignPatterns.Command.ICommand{``0})\">\r\n            <summary>\r\n            Executes the specified action.\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"action\">The action.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Common.Support.LogicFacadeBase.CurrentContext\">\r\n            <summary>\r\n            Gets the current context (or null if none).\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Common.Support.LogicFacadeBase.IsCurrentlyInitializeOnly\">\r\n            <summary>\r\n            Checks if the current context is set to \"initialize only\".\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Common.Support.LogicFacadeBase.InitialisationContext.initOptions\">\r\n            <summary>\r\n            Determines whether this context is initialise only or not\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Support.LogicFacadeBase.InitialisationContext.#ctor(ServiceStack.Common.Support.LogicFacadeBase,ServiceStack.LogicFacade.InitOptions)\">\r\n            <summary>\r\n            Constructs a new InitialiseOnlyContext\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Support.LogicFacadeBase.InitialisationContext.Dispose\">\r\n            <summary>\r\n            Call to remove this current context and reveal the previous context (if any).\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Common.Support.LogicFacadeBase.InitialisationContext.InitialisedObject\">\r\n            <summary>\r\n            Gets or sets the object that has been initialized only.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Validation.ValidationError\">\r\n            <summary>\r\n            The exception which is thrown when a validation error occurred.\r\n            This validation is serialized in a extra clean and human-readable way by ServiceStack.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Validation.ValidationError.ToXml\">\r\n            <summary>\r\n            Used if we need to serialize this exception to XML\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Validation.ValidationError.ErrorCode\">\r\n            <summary>\r\n            Returns the first error code\r\n            </summary>\r\n            <value>The error code.</value>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceClient.Web.WebRequestUtils.ResponseDtoSuffix\">\r\n            <summary>\r\n            Naming convention for the request's Response DTO\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.WcfServiceClient.StoreCookies\">\r\n            <summary>\r\n            Specifies if cookies should be stored\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.ProcessingClient\">\r\n            <summary>\r\n            Processing client used to interface with ServiceStack and allow a message to be processed.\r\n            Not an actual client.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.ProcessingClient.Publish(System.String,System.Byte[])\">\r\n            <summary>\r\n            Publish the specified message into the durable queue @queueName\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <param name=\"messageBytes\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.ProcessingClient.Notify(System.String,System.Byte[])\">\r\n            <summary>\r\n            Publish the specified message into the transient queue @queueName\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <param name=\"messageBytes\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.ProcessingClient.Get(System.String,System.Nullable{System.TimeSpan})\">\r\n            <summary>\r\n            Synchronous blocking get.\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <param name=\"timeOut\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.ProcessingClient.GetAsync(System.String)\">\r\n            <summary>\r\n            Non blocking get message\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.ProcessingClient.WaitForNotifyOnAny(System.String[])\">\r\n            <summary>\r\n            Blocking wait for notifications on any of the supplied channels\r\n            </summary>\r\n            <param name=\"channelNames\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.Client\">\r\n            <summary>\r\n            Base rcon class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Messaging.Rcon.Client._sock\">\r\n            <summary>\r\n            Rcon connection socket. Always set to null when not connected.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Messaging.Rcon.Client._sequenceID\">\r\n            <summary>\r\n            Unique ID for each message.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Messaging.Rcon.Client._registeredCallbacks\">\r\n            <summary>\r\n            Registered callbacks.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Client.#ctor(System.Net.IPEndPoint)\">\r\n            <summary>\r\n            Create a new instance of rcon.\r\n            </summary>\r\n            <param name=\"rconEndpoint\">Endpoint to connect to, usually the game server with query port.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Client.Connect\">\r\n            <summary>\r\n            Attempts to connect to the game server for rcon operations.\r\n            </summary>\r\n            <returns>True if connection established, false otherwise.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Client.ProcessPacket(System.Byte[],ServiceStack.Messaging.Rcon.ClientSocketState)\">\r\n            <summary>\r\n            Processes a received packet.\r\n            </summary>\r\n            <param name=\"packet\">The packet.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Client.Disconnect\">\r\n            <summary>\r\n            Disconnects from rcon.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Client.InternalSend(System.Byte[][])\">\r\n            <summary>\r\n            Sends message to the server.\r\n            </summary>\r\n            <param name=\"words\">Words to send.</param>\r\n        </member>\r\n        <member name=\"E:ServiceStack.Messaging.Rcon.Client.OnDisconnected\">\r\n            <summary>\r\n            Disconnected event.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Client.Endpoint\">\r\n            <summary>\r\n            Game server endpoint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Client.LastException\">\r\n            <summary>\r\n            Last exception that occured during operation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Client.Connected\">\r\n            <summary>\r\n            Connected?\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Client.SequenceID\">\r\n            <summary>\r\n            Gets the next unique ID to be used for transmisson. Read this before sending to pair responses to sent messages.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.Client.OnDisconnectedHandler\">\r\n            <summary>\r\n            Event delegate when disconnected from the server.\r\n            </summary>\r\n            <param name=\"rcon\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.Client.AsyncCallback\">\r\n            <summary>\r\n            Delegate for async callbacks.\r\n            </summary>\r\n            <param name=\"rcon\"></param>\r\n            <param name=\"packet\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.NotConnectedException\">\r\n            <summary>\r\n            Exception thrown when attempting to send on a non-connected service client.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.EnumExtensions.ToDescription(System.Enum)\">\r\n            <summary>\r\n            Gets the textual description of the enum if it has one. e.g.\r\n            \r\n            <code>\r\n            enum UserColors\r\n            {\r\n                [Description(\"Bright Red\")]\r\n                BrightRed\r\n            }\r\n            UserColors.BrightRed.ToDescription();\r\n            </code>\r\n            </summary>\r\n            <param name=\"enum\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Common.Support.InMemoryLogFactory\">\r\n            <summary>\r\n            Note: InMemoryLog keeps all logs in memory, so don't use it long running exceptions\r\n            \r\n            Returns a thread-safe InMemoryLog which you can use while *TESTING*\r\n            to provide a detailed analysis of your logs.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceClient.Web.UrlExtensions\">\r\n            <summary>\r\n            Donated by Ivan Korneliuk from his post:\r\n            http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html\r\n            \r\n            Modified to only allow using routes matching the supplied HTTP Verb\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.StaticAccessors`1.TypedGetPropertyFn``1(System.Reflection.PropertyInfo)\">\r\n            <summary>\r\n            Func to get the Strongly-typed field\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.StaticAccessors`1.ValueUnTypedGetPropertyFn``1(System.Reflection.PropertyInfo)\">\r\n            <summary>\r\n            Required to cast the return ValueType to an object for caching\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.StaticAccessors`1.TypedSetPropertyFn``1(System.Reflection.PropertyInfo)\">\r\n            <summary>\r\n            Func to set the Strongly-typed field\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.StaticAccessors`1.ValueUnTypedSetPropertyFn``1(System.Reflection.PropertyInfo)\">\r\n            <summary>\r\n            Required to cast the ValueType to an object for caching\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.StaticAccessors`1.UnTypedSetPropertyFn``1(System.Reflection.PropertyInfo)\">\r\n            <summary>\r\n            Required to cast the ValueType to an object for caching\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.ReflectionUtils.PopulateObject(System.Object)\">\r\n            <summary>\r\n            Populate an object with Example data.\r\n            </summary>\r\n            <param name=\"obj\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.ReflectionUtils.PopulateObjectInternal(System.Object,System.Collections.Generic.Dictionary{System.Type,System.Int32})\">\r\n            <summary>\r\n            Populates the object with example data.\r\n            </summary>\r\n            <param name=\"obj\"></param>\r\n            <param name=\"recursionInfo\">Tracks how deeply nested we are</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Net30.ExtendTuple\">\r\n            <summary>\r\n            Helper extensions for tuples\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.FuncUtils.TryExec(System.Action)\">\r\n            <summary>\r\n            Invokes the action provided and returns true if no excpetion was thrown.\r\n            Otherwise logs the exception and returns false if an exception was thrown.\r\n            </summary>\r\n            <param name=\"action\">The action.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceClient.Web.CookieManagerEndpointBehavior\">\r\n            <summary>\r\n            Adds the singleton instance of <see cref=\"T:ServiceStack.ServiceClient.Web.CookieManagerMessageInspector\"/> to an endpoint on the client.\r\n            </summary>\r\n            <remarks>\r\n            Based on http://megakemp.wordpress.com/2009/02/06/managing-shared-cookies-in-wcf/\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.CookieManagerEndpointBehavior.ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint,System.ServiceModel.Dispatcher.ClientRuntime)\">\r\n            <summary>\r\n            Adds the singleton of the <see cref=\"!:ClientIdentityMessageInspector\"/> class to the client endpoint's message inspectors.\r\n            </summary>\r\n            <param name=\"endpoint\">The endpoint that is to be customized.</param>\r\n            <param name=\"clientRuntime\">The client runtime to be customized.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceClient.Web.CookieManagerMessageInspector\">\r\n            <summary>\r\n            Maintains a copy of the cookies contained in the incoming HTTP response received from any service\r\n            and appends it to all outgoing HTTP requests.\r\n            </summary>\r\n            <remarks>\r\n            This class effectively allows to send any received HTTP cookies to different services,\r\n            reproducing the same functionality available in ASMX Web Services proxies with the <see cref=\"T:System.Net.CookieContainer\"/> class.\r\n            Based on http://megakemp.wordpress.com/2009/02/06/managing-shared-cookies-in-wcf/\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.CookieManagerMessageInspector.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"!:ClientIdentityMessageInspector\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.CookieManagerMessageInspector.AfterReceiveReply(System.ServiceModel.Channels.Message@,System.Object)\">\r\n            <summary>\r\n            Inspects a message after a reply message is received but prior to passing it back to the client application.\r\n            </summary>\r\n            <param name=\"reply\">The message to be transformed into types and handed back to the client application.</param>\r\n            <param name=\"correlationState\">Correlation state data.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceClient.Web.CookieManagerMessageInspector.BeforeSendRequest(System.ServiceModel.Channels.Message@,System.ServiceModel.IClientChannel)\">\r\n            <summary>\r\n            Inspects a message before a request message is sent to a service.\r\n            </summary>\r\n            <param name=\"request\">The message to be sent to the service.</param>\r\n            <param name=\"channel\">The client object channel.</param>\r\n            <returns>\r\n            <strong>Null</strong> since no message correlation is used.\r\n            </returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.CookieManagerMessageInspector.Instance\">\r\n            <summary>\r\n            Gets the singleton <see cref=\"!:ClientIdentityMessageInspector\"/> instance.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Common.HostContext.Items\">\r\n            <summary>\r\n            Gets a list of items for this request. \r\n            </summary>\r\n            <remarks>This list will be cleared on every request and is specific to the original thread that is handling the request.\r\n            If a handler uses additional threads, this data will not be available on those threads.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.PathUtils.MapProjectPath(System.String)\">\r\n            <summary>\r\n            Maps the path of a file in the context of a VS project\r\n            </summary>\r\n            <param name=\"relativePath\">the relative path</param>\r\n            <returns>the absolute path</returns>\r\n            <remarks>Assumes static content is two directories above the /bin/ directory,\r\n            eg. in a unit test scenario  the assembly would be in /bin/Debug/.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.PathUtils.MapAbsolutePath(System.String)\">\r\n            <summary>\r\n            Maps the path of a file in a self-hosted scenario\r\n            </summary>\r\n            <param name=\"relativePath\">the relative path</param>\r\n            <returns>the absolute path</returns>\r\n            <remarks>Assumes static content is copied to /bin/ folder with the assemblies</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Utils.PathUtils.MapHostAbsolutePath(System.String)\">\r\n            <summary>\r\n            Maps the path of a file in an Asp.Net hosted scenario\r\n            </summary>\r\n            <param name=\"relativePath\">the relative path</param>\r\n            <returns>the absolute path</returns>\r\n            <remarks>Assumes static content is in the parent folder of the /bin/ directory</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceModel.Support.XmlSerializerWrapper.GetNamespace(System.Type)\">\r\n            <summary>\r\n            Gets the namespace from an attribute marked on the type's definition\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n            <returns>Namespace of type</returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.Server\">\r\n            <summary>\r\n            Hosting services via a binary-safe TCP-based protocol.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Server.RegisterHandler``1(System.Func{ServiceStack.Messaging.IMessage{``0},System.Object})\">\r\n            <summary>\r\n            Register DTOs and hanlders the MQ Host will process\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"processMessageFn\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Server.GetStatus\">\r\n            <summary>\r\n            Get Total Current Stats for all Message Handlers\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Server.GetStatsDescription\">\r\n            <summary>\r\n            Get a Stats dump\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Server.Start\">\r\n            <summary>\r\n            Start the MQ Host. Stops the server and restarts if already started.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Server.Stop\">\r\n            <summary>\r\n            Stop the MQ Host if not already stopped. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.Server.ProcessPacket(System.Byte[],System.Net.Sockets.Socket,ServiceStack.Messaging.Rcon.ClientSocketState)\">\r\n            <summary>\r\n            Processes a received packet.\r\n            </summary>\r\n            <param name=\"packet\">The packet.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Server.MessageFactory\">\r\n            <summary>\r\n            Factory to create consumers and producers that work with this service\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Web.HttpResultExtensions.ToDto(System.Object)\">\r\n            <summary>\r\n            Shortcut to get the ResponseDTO whether it's bare or inside a IHttpResult\r\n            </summary>\r\n            <param name=\"response\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Web.HttpResultExtensions.ToResponseDto(System.Object)\">\r\n            <summary>\r\n            Alias of ToDto\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Web.HttpResultExtensions.ToDto``1(System.Object)\">\r\n            <summary>\r\n            Shortcut to get the ResponseDTO whether it's bare or inside a IHttpResult\r\n            </summary>\r\n            <param name=\"response\"></param>\r\n            <returns>TResponse if found; otherwise null</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Web.HttpResultExtensions.ToResponseDto``1(System.Object)\">\r\n            <summary>\r\n            Alias of ToDto\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Web.HttpResultExtensions.ToResponseStatus(System.Object)\">\r\n            <summary>\r\n            Shortcut to get the ResponseStatus whether it's bare or inside a IHttpResult\r\n            </summary>\r\n            <param name=\"response\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Web.HttpResultExtensions.IsErrorResponse(System.Object)\">\r\n            <summary>\r\n            Whether the response is an IHttpError or Exception\r\n            </summary>\r\n            <param name=\"response\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Packet.FromServer\">\r\n            <summary>\r\n            True if the packet originated on the server.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Packet.IsResponse\">\r\n            <summary>\r\n            True if the packet is a response from a sent packet.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Packet.Sequence\">\r\n            <summary>\r\n            Sequence identifier. Unique to the connection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.Rcon.Packet.Words\">\r\n            <summary>\r\n            Words.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceModel.Serialization.StringMapTypeDeserializer\">\r\n            <summary>\r\n            Serializer cache of delegates required to create a type from a string map (e.g. for REST urls)\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Common.CryptUtils\">\r\n            <summary>\r\n            Useful .NET Encryption Utils from:\r\n            http://andrewlocatelliwoodcock.com/2011/08/01/implementing-rsa-asymmetric-public-private-key-encryption-in-c-encrypting-under-the-public-key/\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.CryptUtils.Encrypt(System.String,System.String,ServiceStack.Common.RsaKeyLengths)\">\r\n            <summary>\r\n            Encrypt an arbitrary string of data under the supplied public key\r\n            </summary>\r\n            <param name=\"publicKey\">The public key to encrypt under</param>\r\n            <param name=\"data\">The data to encrypt</param>\r\n            <param name=\"length\">The bit length or strength of the public key: 1024, 2048 or 4096 bits. This must match the \r\n            value actually used to create the publicKey</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Rcon.PacketCodec\">\r\n            <summary>\r\n            Contains methods required for encoding and decoding rcon packets.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.PacketCodec.DecodePacket(System.Byte[])\">\r\n            <summary>\r\n            Decodes a packet.\r\n            </summary>\r\n            <param name=\"packet\">The packet.</param>\r\n            <returns>A packet object.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.PacketCodec.DecodeHeader(System.Byte[])\">\r\n            <summary>\r\n            Decodes the packet header.\r\n            </summary>\r\n            <param name=\"packet\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.PacketCodec.DecodeWords(System.Byte[])\">\r\n            <summary>\r\n            Decodes words in a packet.\r\n            </summary>\r\n            <param name=\"packet\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.PacketCodec.EncodePacket(System.Boolean,System.Boolean,System.UInt32,System.Byte[][])\">\r\n            <summary>\r\n            Encodes a packet for transmission to the server.\r\n            </summary>\r\n            <param name=\"fromServer\"></param>\r\n            <param name=\"isResponse\"></param>\r\n            <param name=\"id\"></param>\r\n            <param name=\"words\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.PacketCodec.EncodeHeader(System.Boolean,System.Boolean,System.UInt32)\">\r\n            <summary>\r\n            Encodes a packet header.\r\n            </summary>\r\n            <param name=\"fromServer\"></param>\r\n            <param name=\"isResponse\"></param>\r\n            <param name=\"id\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.Rcon.PacketCodec.EncodeWords(System.Byte[][])\">\r\n            <summary>\r\n            Encodes words.\r\n            </summary>\r\n            <param name=\"words\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.PropertyAccessor`1.TypedGetPropertyFn``1\">\r\n            <summary>\r\n            Func to get the Strongly-typed field\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.PropertyAccessor`1.ValueTypedGetPropertyFn``1\">\r\n            <summary>\r\n            Required to cast the return ValueType to an object for caching\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.PropertyAccessor`1.TypedSetPropertyFn``1\">\r\n            <summary>\r\n            Func to set the Strongly-typed field\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.PropertyAccessor`1.ValueTypesSetPropertyFn``1\">\r\n            <summary>\r\n            Required to cast the ValueType to an object for caching\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Reflection.PropertyAccessor`1.UnTypedSetPropertyFn``1\">\r\n            <summary>\r\n            Required to cast the ValueType to an object for caching\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.RequestContextExtensions.SetItem(ServiceStack.ServiceHost.IRequestContext,System.String,System.Object)\">\r\n            <summary>\r\n            Store an entry in the IHttpRequest.Items Dictionary\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.RequestContextExtensions.GetItem(ServiceStack.ServiceHost.IRequestContext,System.String)\">\r\n            <summary>\r\n            Get an entry from the IHttpRequest.Items Dictionary\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Common.UrnId\">\r\n            <summary>\r\n            Creates a Unified Resource Name (URN) with the following formats:\r\n            \r\n            \t- urn:{TypeName}:{IdFieldValue}\t\t\t\t\t\te.g. urn:UserSession:1\r\n            \t- urn:{TypeName}:{IdFieldName}:{IdFieldValue}\t\te.g. urn:UserSession:UserId:1\t\t\t\r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Common.Support.AdapterBase\">\r\n            <summary>\r\n            Common functionality when creating adapters\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Support.AdapterBase.Execute``1(System.Func{``0})\">\r\n            <summary>\r\n            Executes the specified expression. \r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"action\">The action.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Common.Support.AdapterBase.Execute(System.Action)\">\r\n            <summary>\r\n            Executes the specified action (for void methods).\r\n            </summary>\r\n            <param name=\"action\">The action.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceClient.Web.AsyncServiceClient\">\r\n            Need to provide async request options\r\n            http://msdn.microsoft.com/en-us/library/86wf6409(VS.71).aspx\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.AsyncServiceClient.HttpWebRequestFilter\">\r\n            <summary>\r\n            The request filter is called before any request.\r\n            This request filter is executed globally.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.AsyncServiceClient.HttpWebResponseFilter\">\r\n            <summary>\r\n            The response action is called once the server response is available.\r\n            It will allow you to access raw response information. \r\n            This response action is executed globally.\r\n            Note that you should NOT consume the response stream as this is handled by ServiceStack\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.AsyncServiceClient.OnAuthenticationRequired\">\r\n            <summary>\r\n            Called before request resend, when the initial request required authentication\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.AsyncServiceClient.LocalHttpWebRequestFilter\">\r\n            <summary>\r\n            The request filter is called before any request.\r\n            This request filter only works with the instance where it was set (not global).\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceClient.Web.AsyncServiceClient.LocalHttpWebResponseFilter\">\r\n            <summary>\r\n            The response action is called once the server response is available.\r\n            It will allow you to access raw response information. \r\n            Note that you should NOT consume the response stream as this is handled by ServiceStack\r\n            </summary>\r\n        </member>\r\n    </members>\r\n</doc>\r\n"
  },
  {
    "path": "Tools/Toboggan/ServiceStack.Interfaces.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<doc>\r\n    <assembly>\r\n        <name>ServiceStack.Interfaces</name>\r\n    </assembly>\r\n    <members>\r\n        <member name=\"T:ServiceStack.ServiceHost.RestServiceAttribute\">\r\n            <summary>\r\n            \tUsed to decorate Request DTO's to associate a RESTful request \r\n            \tpath mapping with a service.  Multiple attributes can be applied to \r\n            \teach request DTO, to map multiple paths to the service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.RouteAttribute\">\r\n            <summary>\r\n            \tUsed to decorate Request DTO's to associate a RESTful request \r\n            \tpath mapping with a service.  Multiple attributes can be applied to \r\n            \teach request DTO, to map multiple paths to the service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RouteAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            \t<para>Initializes an instance of the <see cref=\"T:ServiceStack.ServiceHost.RouteAttribute\"/> class.</para>\r\n            </summary>\r\n            <param name=\"path\">\r\n            \t<para>The path template to map to the request.  See \r\n            \t<see cref=\"P:ServiceStack.ServiceHost.RouteAttribute.Path\">RouteAttribute.Path</see>\r\n            \tfor details on the correct format.</para>\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RouteAttribute.#ctor(System.String,System.String)\">\r\n            <summary>\r\n            \t<para>Initializes an instance of the <see cref=\"T:ServiceStack.ServiceHost.RouteAttribute\"/> class.</para>\r\n            </summary>\r\n            <param name=\"path\">\r\n            \t<para>The path template to map to the request.  See \r\n            \t<see cref=\"P:ServiceStack.ServiceHost.RouteAttribute.Path\">RouteAttribute.Path</see>\r\n            \tfor details on the correct format.</para>\r\n            </param>\r\n            <param name=\"verbs\">A comma-delimited list of HTTP verbs supported by the \r\n            \tservice.  If unspecified, all verbs are assumed to be supported.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RouteAttribute.Path\">\r\n            <summary>\r\n            \tGets or sets the path template to be mapped to the request.\r\n            </summary>\r\n            <value>\r\n            \tA <see cref=\"T:System.String\"/> value providing the path mapped to\r\n            \tthe request.  Never <see langword=\"null\"/>.\r\n            </value>\r\n            <remarks>\r\n            \t<para>Some examples of valid paths are:</para>\r\n            \r\n            \t<list>\r\n            \t\t<item>\"/Inventory\"</item>\r\n            \t\t<item>\"/Inventory/{Category}/{ItemId}\"</item>\r\n            \t\t<item>\"/Inventory/{ItemPath*}\"</item>\r\n            \t</list>\r\n            \r\n            \t<para>Variables are specified within \"{}\"\r\n            \tbrackets.  Each variable in the path is mapped to the same-named property \r\n            \ton the request DTO.  At runtime, ServiceStack will parse the \r\n            \trequest URL, extract the variable values, instantiate the request DTO,\r\n            \tand assign the variable values into the corresponding request properties,\r\n            \tprior to passing the request DTO to the service object for processing.</para>\r\n            \r\n            \t<para>It is not necessary to specify all request properties as\r\n            \tvariables in the path.  For unspecified properties, callers may provide \r\n            \tvalues in the query string.  For example: the URL \r\n            \t\"http://services/Inventory?Category=Books&amp;ItemId=12345\" causes the same \r\n            \trequest DTO to be processed as \"http://services/Inventory/Books/12345\", \r\n            \tprovided that the paths \"/Inventory\" (which supports the first URL) and \r\n            \t\"/Inventory/{Category}/{ItemId}\" (which supports the second URL)\r\n            \tare both mapped to the request DTO.</para>\r\n            \r\n            \t<para>Please note that while it is possible to specify property values\r\n            \tin the query string, it is generally considered to be less RESTful and\r\n            \tless desirable than to specify them as variables in the path.  Using the \r\n            \tquery string to specify property values may also interfere with HTTP\r\n            \tcaching.</para>\r\n            \r\n            \t<para>The final variable in the path may contain a \"*\" suffix\r\n            \tto grab all remaining segments in the path portion of the request URL and assign\r\n            \tthem to a single property on the request DTO.\r\n            \tFor example, if the path \"/Inventory/{ItemPath*}\" is mapped to the request DTO,\r\n            \tthen the request URL \"http://services/Inventory/Books/12345\" will result\r\n            \tin a request DTO whose ItemPath property contains \"Books/12345\".\r\n            \tYou may only specify one such variable in the path, and it must be positioned at\r\n            \tthe end of the path.</para>\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RouteAttribute.Summary\">\r\n            <summary>\r\n               Gets or sets short summary of what the route does.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RouteAttribute.Notes\">\r\n            <summary>\r\n               Gets or sets longer text to explain the behaviour of the route. \r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RouteAttribute.Verbs\">\r\n            <summary>\r\n            \tGets or sets a comma-delimited list of HTTP verbs supported by the service, such as\r\n            \t\"GET,PUT,POST,DELETE\".\r\n            </summary>\r\n            <value>\r\n            \tA <see cref=\"T:System.String\"/> providing a comma-delimited list of HTTP verbs supported\r\n            \tby the service, <see langword=\"null\"/> or empty if all verbs are supported.\r\n            </value>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RestServiceAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            \t<para>Initializes an instance of the <see cref=\"T:ServiceStack.ServiceHost.RestServiceAttribute\"/> class.</para>\r\n            </summary>\r\n            <param name=\"path\">\r\n            \t<para>The path template to map to the request.  See \r\n            \t<see cref=\"!:Path\">RestServiceAttribute.Path</see>\r\n            \tfor details on the correct format.</para>\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RestServiceAttribute.#ctor(System.String,System.String)\">\r\n            <summary>\r\n            \t<para>Initializes an instance of the <see cref=\"T:ServiceStack.ServiceHost.RestServiceAttribute\"/> class.</para>\r\n            </summary>\r\n            <param name=\"path\">\r\n            \t<para>The path template to map to the request.  See \r\n            \t<see cref=\"!:Path\">RestServiceAttribute.Path</see>\r\n            \tfor details on the correct format.</para>\r\n            </param>\r\n            <param name=\"verbs\">A comma-delimited list of HTTP verbs supported by the \r\n            \tservice.  If unspecified, all verbs are assumed to be supported.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IService`1\">\r\n            <summary>\r\n            Base interface all webservices need to implement.\r\n            For simplicity this is the only interface you need to implement\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.IRedisTypedQueueableOperation`1\">\r\n            <summary>\r\n            interface to queueable operation using typed redis client\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.DataAccess.IBasicPersistenceProvider`1\">\r\n            <summary>\r\n            For providers that want a cleaner API with a little more perf\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceInterface.ServiceModel.ErrorResponse\">\r\n            <summary>\r\n            Generic ResponseStatus for when Response Type can't be inferred.\r\n            In schemaless formats like JSON, JSV it has the same shape as a typed Response DTO\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceInterface.ServiceModel.IHasResponseStatus\">\r\n            <summary>\r\n            Contract indication that the Response DTO has a ResponseStatus\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageQueueClient.Publish(System.String,System.Byte[])\">\r\n            <summary>\r\n            Publish the specified message into the durable queue @queueName\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <param name=\"messageBytes\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageQueueClient.Notify(System.String,System.Byte[])\">\r\n            <summary>\r\n            Publish the specified message into the transient queue @queueName\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <param name=\"messageBytes\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageQueueClient.Get(System.String,System.Nullable{System.TimeSpan})\">\r\n            <summary>\r\n            Synchronous blocking get.\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <param name=\"timeOut\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageQueueClient.GetAsync(System.String)\">\r\n            <summary>\r\n            Non blocking get message\r\n            </summary>\r\n            <param name=\"queueName\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageQueueClient.WaitForNotifyOnAny(System.String[])\">\r\n            <summary>\r\n            Blocking wait for notifications on any of the supplied channels\r\n            </summary>\r\n            <param name=\"channelNames\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestPutService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IRestPutService.Put() will be used instead of IService.Execute() for \r\n            EndpointAttributes.HttpPut requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IHttpRequest\">\r\n            <summary>\r\n            A thin wrapper around ASP.NET or HttpListener's HttpRequest\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IResolver.TryResolve``1\">\r\n            <summary>\r\n            Resolve a dependency from the AppHost's IOC\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHttpRequest.GetRawBody\">\r\n            <summary>\r\n            The entire string contents of Request.InputStream\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.OriginalRequest\">\r\n            <summary>\r\n            The underlying ASP.NET or HttpListener HttpRequest\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.OperationName\">\r\n            <summary>\r\n            The name of the service being called (e.g. Request DTO Name)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.ContentType\">\r\n            <summary>\r\n            The request ContentType\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.ResponseContentType\">\r\n            <summary>\r\n            The expected Response ContentType for this request\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.Items\">\r\n            <summary>\r\n            Attach any data to this request that all filters and services can access.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.UserHostAddress\">\r\n            <summary>\r\n            The Remote Ip as reported by Request.UserHostAddress\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.RemoteIp\">\r\n            <summary>\r\n            The Remote Ip as reported by X-Forwarded-For, X-Real-IP or Request.UserHostAddress\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.IsSecureConnection\">\r\n            <summary>\r\n            e.g. is https or not\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpRequest.Files\">\r\n            <summary>\r\n            Access to the multi-part/formdata files posted on this request\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisSubscription.SubscribeToChannels(System.String[])\">\r\n            <summary>\r\n            Subscribe to channels by name\r\n            </summary>\r\n            <param name=\"channels\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisSubscription.SubscribeToChannelsMatching(System.String[])\">\r\n            <summary>\r\n            Subscribe to channels matching the supplied patterns\r\n            </summary>\r\n            <param name=\"patterns\"></param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.IRedisSubscription.SubscriptionCount\">\r\n            <summary>\r\n            The number of active subscriptions this client has\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.IRedisSubscription.OnSubscribe\">\r\n            <summary>\r\n            Registered handler called after client *Subscribes* to each new channel\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.IRedisSubscription.OnMessage\">\r\n            <summary>\r\n            Registered handler called when each message is received\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.IRedisSubscription.OnUnSubscribe\">\r\n            <summary>\r\n            Registered handler called when each channel is unsubscribed\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.IRedisTypedTransaction`1\">\r\n            <summary>\r\n            Redis transaction for typed client\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestPatchService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IRestPutService.Patch() will be used instead of IService.Execute() for \r\n            EndpointAttributes.HttpPatch requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRequestLogger\">\r\n            <summary>\r\n            Log every service request\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IRequestLogger.Log(ServiceStack.ServiceHost.IRequestContext,System.Object,System.Object,System.TimeSpan)\">\r\n            <summary>\r\n            Log a request\r\n            </summary>\r\n            <param name=\"requestContext\">The RequestContext</param>\r\n            <param name=\"requestDto\">Request DTO</param>\r\n            <param name=\"response\">Response DTO or Exception</param>\r\n            <param name=\"elapsed\">How long did the Request take</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IRequestLogger.GetLatestLogs(System.Nullable{System.Int32})\">\r\n            <summary>\r\n            View the most recent logs\r\n            </summary>\r\n            <param name=\"take\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequestLogger.EnableSessionTracking\">\r\n            <summary>\r\n            Turn On/Off Session Tracking\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequestLogger.EnableResponseTracking\">\r\n            <summary>\r\n            Turn On/Off Tracking of Responses\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequestLogger.EnableErrorTracking\">\r\n            <summary>\r\n            Turn On/Off Tracking of Exceptions\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequestLogger.RequiredRoles\">\r\n            <summary>\r\n            Limit access to /requestlogs service to role\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequestLogger.ExcludeRequestDtoTypes\">\r\n            <summary>\r\n            Don't log requests of these types.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequestLogger.HideRequestBodyForRequestDtoTypes\">\r\n            <summary>\r\n            Don't log request bodys for services with sensitive information.\r\n            By default Auth and Registration requests are hidden.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IHasRequestFilter\">\r\n            <summary>\r\n            This interface can be implemented by an attribute\r\n            which adds an request filter for the specific request DTO the attribute marked.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHasRequestFilter.RequestFilter(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.Object)\">\r\n            <summary>\r\n            The request filter is executed before the service.\r\n            </summary>\r\n            <param name=\"req\">The http request wrapper</param>\r\n            <param name=\"res\">The http response wrapper</param>\r\n            <param name=\"requestDto\">The request DTO</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHasRequestFilter.Copy\">\r\n            <summary>\r\n            A new shallow copy of this filter is used on every request.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHasRequestFilter.Priority\">\r\n            <summary>\r\n            Order in which Request Filters are executed. \r\n            &lt;0 Executed before global request filters\r\n            &gt;0 Executed after global request filters\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.TestLogger\">\r\n            <summary>\r\n            Tests logger which  stores all log messages in a member list which can be examined later\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.ILog\">\r\n            <summary>\r\n            Logs a message in a running application\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Debug(System.Object)\">\r\n            <summary>\r\n            Logs a Debug message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Debug(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs a Debug message and exception.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.DebugFormat(System.String,System.Object[])\">\r\n            <summary>\r\n            Logs a Debug format message.\r\n            </summary>\r\n            <param name=\"format\">The format.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Error(System.Object)\">\r\n            <summary>\r\n            Logs a Error message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Error(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs a Error message and exception.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.ErrorFormat(System.String,System.Object[])\">\r\n            <summary>\r\n            Logs a Error format message.\r\n            </summary>\r\n            <param name=\"format\">The format.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Fatal(System.Object)\">\r\n            <summary>\r\n            Logs a Fatal message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Fatal(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs a Fatal message and exception.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.FatalFormat(System.String,System.Object[])\">\r\n            <summary>\r\n            Logs a Error format message.\r\n            </summary>\r\n            <param name=\"format\">The format.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Info(System.Object)\">\r\n            <summary>\r\n            Logs an Info message and exception.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Info(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs an Info message and exception.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.InfoFormat(System.String,System.Object[])\">\r\n            <summary>\r\n            Logs an Info format message.\r\n            </summary>\r\n            <param name=\"format\">The format.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Warn(System.Object)\">\r\n            <summary>\r\n            Logs a Warning message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.Warn(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs a Warning message and exception.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILog.WarnFormat(System.String,System.Object[])\">\r\n            <summary>\r\n            Logs a Warning format message.\r\n            </summary>\r\n            <param name=\"format\">The format.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Logging.ILog.IsDebugEnabled\">\r\n            <summary>\r\n            Gets or sets a value indicating whether this instance is debug enabled.\r\n            </summary>\r\n            <value>\r\n            \t<c>true</c> if this instance is debug enabled; otherwise, <c>false</c>.\r\n            </value>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.TestLogger.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.TestLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.TestLogger.#ctor(System.Type)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.TestLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.TestLogger.Log(ServiceStack.Logging.Support.Logging.TestLogger.Levels,System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.TestLogger.LogFormat(ServiceStack.Logging.Support.Logging.TestLogger.Levels,System.Object,System.Object[])\">\r\n            <summary>\r\n            Logs the format.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.TestLogger.Log(ServiceStack.Logging.Support.Logging.TestLogger.Levels,System.Object)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Translators.TranslateAttribute\">\r\n            <summary>\r\n            This instructs the generator tool to generate translator methods for the types supplied.\r\n            A {TypeName}.generated.cs partial class will be generated that contains the methods required\r\n            to generate to and from that type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceInterface.ServiceModel.RequestLogEntry\">\r\n            <summary>\r\n            A log entry added by the IRequestLogger\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IServiceRoutes\">\r\n            <summary>\r\n            Allow the registration of user-defined routes for services\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceRoutes.Add``1(System.String)\">\r\n            <summary>\r\n            \tMaps the specified REST path to the specified request DTO.\r\n            </summary>\r\n            <typeparam name=\"TRequest\">The type of request DTO to map \r\n            \tthe path to.</typeparam>\r\n            <param name=\"restPath\">The path to map the request DTO to.\r\n            \tSee <see cref=\"!:RestServiceAttribute.Path\">RestServiceAttribute.Path</see>\r\n            \tfor details on the correct format.</param>\r\n            <returns>The same <see cref=\"T:ServiceStack.ServiceHost.IServiceRoutes\"/> instance;\r\n            \tnever <see langword=\"null\"/>.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceRoutes.Add``1(System.String,System.String)\">\r\n            <summary>\r\n            \tMaps the specified REST path to the specified request DTO, and\r\n            \tspecifies the HTTP verbs supported by the path.\r\n            </summary>\r\n            <typeparam name=\"TRequest\">The type of request DTO to map \r\n            \tthe path to.</typeparam>\r\n            <param name=\"restPath\">The path to map the request DTO to.\r\n            \tSee <see cref=\"!:RestServiceAttribute.Path\">RestServiceAttribute.Path</see>\r\n            \tfor details on the correct format.</param>\r\n            <param name=\"verbs\">\r\n            \tThe comma-delimited list of HTTP verbs supported by the path, \r\n            \tsuch as \"GET,PUT,DELETE\".  Specify empty or <see langword=\"null\"/>\r\n            \tto indicate that all verbs are supported.\r\n            </param>\r\n            <returns>The same <see cref=\"T:ServiceStack.ServiceHost.IServiceRoutes\"/> instance;\r\n            \tnever <see langword=\"null\"/>.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceRoutes.Add(System.Type,System.String,System.String)\">\r\n            <summary>\r\n            \tMaps the specified REST path to the specified request DTO, \r\n            \tspecifies the HTTP verbs supported by the path, and indicates\r\n            \tthe default MIME type of the returned response.\r\n            </summary>\r\n            <param name=\"requestType\">\r\n            \tThe type of request DTO to map the path to.\r\n            </param>\r\n            <param name=\"restPath\">The path to map the request DTO to.\r\n            \tSee <see cref=\"!:RestServiceAttribute.Path\">RestServiceAttribute.Path</see>\r\n            \tfor details on the correct format.</param>\r\n            <param name=\"verbs\">\r\n            \tThe comma-delimited list of HTTP verbs supported by the path, \r\n            \tsuch as \"GET,PUT,DELETE\".\r\n            </param>\r\n            <returns>The same <see cref=\"T:ServiceStack.ServiceHost.IServiceRoutes\"/> instance;\r\n            \tnever <see langword=\"null\"/>.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceRoutes.Add(System.Type,System.String,System.String,System.String,System.String)\">\r\n            <summary>\r\n            \tMaps the specified REST path to the specified request DTO, \r\n            \tspecifies the HTTP verbs supported by the path, and indicates\r\n            \tthe default MIME type of the returned response.\r\n            </summary>\r\n            <param name=\"requestType\">\r\n            \tThe type of request DTO to map the path to.\r\n            </param>\r\n            <param name=\"restPath\">The path to map the request DTO to.\r\n            \tSee <see cref=\"!:RestServiceAttribute.Path\">RestServiceAttribute.Path</see>\r\n            \tfor details on the correct format.</param>\r\n            <param name=\"verbs\">\r\n            \tThe comma-delimited list of HTTP verbs supported by the path, \r\n            \tsuch as \"GET,PUT,DELETE\".\r\n            </param>\r\n            <param name=\"summary\">\r\n                The short summary of what the REST does. \r\n            </param>\r\n            <param name=\"notes\">\r\n                The longer text to explain the behaviour of the REST. \r\n            </param>\r\n            <returns>The same <see cref=\"T:ServiceStack.ServiceHost.IServiceRoutes\"/> instance;\r\n            \tnever <see langword=\"null\"/>.</returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IServiceController\">\r\n            <summary>\r\n            Responsible for executing the operation within the specified context.\r\n            </summary>\r\n            <value>The operation types.</value>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceController.GetRestPathForRequest(System.String,System.String)\">\r\n            <summary>\r\n            Returns the first matching RestPath\r\n            </summary>\r\n            <param name=\"httpMethod\"></param>\r\n            <param name=\"pathInfo\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceController.ExecuteMessage``1(ServiceStack.Messaging.IMessage{``0})\">\r\n            <summary>\r\n            Executes the MQ DTO request.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceController.ExecuteMessage``1(ServiceStack.Messaging.IMessage{``0},ServiceStack.ServiceHost.IRequestContext)\">\r\n            <summary>\r\n            Executes the MQ DTO request with the supplied requestContext\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IServiceController.Execute(System.Object,ServiceStack.ServiceHost.IRequestContext)\">\r\n            <summary>\r\n            Executes the DTO request under the supplied requestContext.\r\n            </summary>\r\n            <param name=\"request\"></param>\r\n            <param name=\"requestContext\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IServiceController.OperationTypes\">\r\n            <summary>\r\n            Returns a list of operation types available in this service\r\n            </summary>\r\n            <value>The operation types.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IServiceController.AllOperationTypes\">\r\n            <summary>\r\n            Returns a list of ALL operation types available in this service\r\n            </summary>\r\n            <value>The operation types.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IServiceController.Routes\">\r\n            <summary>\r\n            Allow the registration of custom routes\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestDeleteService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IRestDeleteService.Delete() will be used instead of IService.Execute() for \r\n            EndpointAttributes.HttpDelete requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRequiresRequestContext\">\r\n            <summary>\r\n            Implement on services that need access to the RequestContext\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.Status\">\r\n            <summary>\r\n            The HTTP Response Status\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.StatusCode\">\r\n            <summary>\r\n            The HTTP Response Status Code\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.StatusDescription\">\r\n            <summary>\r\n            The HTTP Status Description\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.ContentType\">\r\n            <summary>\r\n            The HTTP Response ContentType\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.Headers\">\r\n            <summary>\r\n            Additional HTTP Headers\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.Response\">\r\n            <summary>\r\n            Response DTO\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.ResponseFilter\">\r\n            <summary>\r\n            if not provided, get's injected by ServiceStack\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResult.RequestContext\">\r\n            <summary>\r\n            Holds the request call context\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.IRedisTypedPipeline`1\">\r\n            <summary>\r\n            Interface to redis typed pipeline\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Pipeline.IRedisPipelineShared\">\r\n            <summary>\r\n            Pipeline interface shared by typed and non-typed pipelines\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Pipeline.IRedisQueueCompletableOperation\">\r\n            <summary>\r\n            Interface to operations that allow queued commands to be completed\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.IRedisList`1\">\r\n            <summary>\r\n            Wrap the common redis list operations under a IList[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.MessageError\">\r\n            <summary>\r\n            An Error Message Type that can be easily serialized\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.IMessageService\">\r\n            <summary>\r\n            Simple definition of an MQ Host\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.RegisterHandler``1(System.Func{ServiceStack.Messaging.IMessage{``0},System.Object})\">\r\n            <summary>\r\n            Register DTOs and hanlders the MQ Host will process\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"processMessageFn\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.RegisterHandler``1(System.Func{ServiceStack.Messaging.IMessage{``0},System.Object},System.Action{ServiceStack.Messaging.IMessage{``0},System.Exception})\">\r\n            <summary>\r\n            Register DTOs and hanlders the MQ Host will process\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"processMessageFn\"></param>\r\n            <param name=\"processExceptionEx\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.GetStats\">\r\n            <summary>\r\n            Get Total Current Stats for all Message Handlers\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.GetStatus\">\r\n            <summary>\r\n            Get the status of the service. Potential Statuses: Disposed, Stopped, Stopping, Starting, Started\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.GetStatsDescription\">\r\n            <summary>\r\n            Get a Stats dump\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.Start\">\r\n            <summary>\r\n            Start the MQ Host if not already started.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Messaging.IMessageService.Stop\">\r\n            <summary>\r\n            Stop the MQ Host if not already stopped. \r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Messaging.IMessageService.MessageFactory\">\r\n            <summary>\r\n            Factory to create consumers and producers that work with this service\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.DebugLogFactory\">\r\n            <summary>\r\n            Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.ILogFactory\">\r\n            <summary>\r\n            Factory to create ILog instances\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILogFactory.GetLogger(System.Type)\">\r\n            <summary>\r\n            Gets the logger.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.ILogFactory.GetLogger(System.String)\">\r\n            <summary>\r\n            Gets the logger.\r\n            </summary>\r\n            <param name=\"typeName\">Name of the type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.DataAccess.IPersistenceProviderManager\">\r\n            <summary>\r\n            Manages a connection to a persistance provider\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Service.IReplyClient.Send``1(System.Object)\">\r\n            <summary>\r\n            Sends the specified request.\r\n            </summary>\r\n            <param name=\"request\">The request.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.UnRetryableMessagingException\">\r\n            <summary>\r\n            For messaging exceptions that should by-pass the messaging service's configured\r\n            retry attempts and store the message straight into the DLQ\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.MessagingException\">\r\n            <summary>\r\n            Base Exception for all ServiceStack.Messaging exceptions\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Configuration.IContainerAdapter\">\r\n            <summary>\r\n            Allow delegation of dependencies to other IOC's\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.IContainerAdapter.TryResolve``1\">\r\n            <summary>\r\n            Resolve Property Dependency\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.IContainerAdapter.Resolve``1\">\r\n            <summary>\r\n            Resolve Constructor Dependency\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IAsyncService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IAsyncService.ExecuteAsync() will be used instead of IService.Execute() for \r\n            EndpointAttributes.AsyncOneWay requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Pipeline.IRedisQueueableOperation\">\r\n            <summary>\r\n            interface to operation that can queue commands\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.NullLogFactory\">\r\n            <summary>\r\n            Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceInterface.ServiceModel.ResponseError\">\r\n            <summary>\r\n            Error information pertaining to a particular named field.\r\n            Used for returning multiple field validation errors.s\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestService`1\">\r\n            <summary>\r\n            Utility interface that implements all Rest operations\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestGetService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IRestGetService.Get() will be used instead of IService.Execute() for \r\n            EndpointAttributes.HttpGet requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestPostService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IRestPostService.Post() will be used instead of IService.Execute() for \r\n            EndpointAttributes.HttpPost requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IExpress\">\r\n            <summary>\r\n            Marker interface to mark an Express controller with different routes for each method\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.LogManager\">\r\n            <summary>\r\n            Logging API for this library. You can inject your own implementation otherwise\r\n            will use the DebugLogFactory to write to System.Diagnostics.Debug\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.LogManager.GetLogger(System.Type)\">\r\n            <summary>\r\n            Gets the logger.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.LogManager.GetLogger(System.String)\">\r\n            <summary>\r\n            Gets the logger.\r\n            </summary>\r\n            <param name=\"typeName\">Name of the type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Logging.LogManager.LogFactory\">\r\n            <summary>\r\n            Gets or sets the log factory.\r\n            Use this to override the factory that is used to create loggers\r\n            </summary>\r\n            <value>The log factory.</value>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Translators.TranslateMemberAttribute\">\r\n            <summary>\r\n            This changes the default behaviour for the \r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Pipeline.IRedisPipeline\">\r\n            <summary>\r\n            Interface to redis pipeline\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.TestLogFactory\">\r\n            <summary>\r\n            Creates a test Logger, that stores all log messages in a member list\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.CacheAccess.IMemcachedClient\">\r\n            <summary>\r\n            A light interface over a cache client.\r\n            This interface was inspired by Enyim.Caching.MemcachedClient\r\n            \r\n            Only the methods that are intended to be used are required, if you require\r\n            extra functionality you can uncomment the unused methods below as they have been\r\n            implemented in DdnMemcachedClient\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.Remove(System.String)\">\r\n            <summary>\r\n            Removes the specified item from the cache.\r\n            </summary>\r\n            <param name=\"key\">The identifier for the item to delete.</param>\r\n            <returns>\r\n            true if the item was successfully removed from the cache; false otherwise.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.RemoveAll(System.Collections.Generic.IEnumerable{System.String})\">\r\n            <summary>\r\n            Removes the cache for all the keys provided.\r\n            </summary>\r\n            <param name=\"keys\">The keys.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.Get(System.String)\">\r\n            <summary>\r\n            Retrieves the specified item from the cache.\r\n            </summary>\r\n            <param ICTname=\"key\">The identifier for the item to retrieve.</param>\r\n            <returns>\r\n            The retrieved item, or <value>null</value> if the key was not found.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.Increment(System.String,System.UInt32)\">\r\n            <summary>\r\n            Increments the value of the specified key by the given amount. The operation is atomic and happens on the server.\r\n            </summary>\r\n            <param name=\"key\">The identifier for the item to increment.</param>\r\n            <param name=\"amount\">The amount by which the client wants to increase the item.</param>\r\n            <returns>\r\n            The new value of the item or -1 if not found.\r\n            </returns>\r\n            <remarks>The item must be inserted into the cache before it can be changed. The item must be inserted as a <see cref=\"T:System.String\"/>. The operation only works with <see cref=\"T:System.UInt32\"/> values, so -1 always indicates that the item was not found.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.Decrement(System.String,System.UInt32)\">\r\n            <summary>\r\n            Increments the value of the specified key by the given amount. The operation is atomic and happens on the server.\r\n            </summary>\r\n            <param name=\"key\">The identifier for the item to increment.</param>\r\n            <param name=\"amount\">The amount by which the client wants to decrease the item.</param>\r\n            <returns>\r\n            The new value of the item or -1 if not found.\r\n            </returns>\r\n            <remarks>The item must be inserted into the cache before it can be changed. The item must be inserted as a <see cref=\"T:System.String\"/>. The operation only works with <see cref=\"T:System.UInt32\"/> values, so -1 always indicates that the item was not found.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.Add(System.String,System.Object)\">\r\n            <summary>\r\n            Inserts an item into the cache with a cache key to reference its location.\r\n            </summary>\r\n            <param name=\"key\">The key used to reference the item.</param>\r\n            <param name=\"value\">The object to be inserted into the cache.</param>\r\n            <returns>\r\n            true if the item was successfully stored in the cache; false otherwise.\r\n            </returns>\r\n            <remarks>The item does not expire unless it is removed due memory pressure.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.Add(System.String,System.Object,System.DateTime)\">\r\n            <summary>\r\n            Inserts an item into the cache with a cache key to reference its location.\r\n            </summary>\r\n            <param name=\"key\">The key used to reference the item.</param>\r\n            <param name=\"value\">The object to be inserted into the cache.</param>\r\n            <param name=\"expiresAt\">The time when the item is invalidated in the cache.</param>\r\n            <returns>true if the item was successfully stored in the cache; false otherwise.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.FlushAll\">\r\n            <summary>\r\n            Removes all data from the cache.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IMemcachedClient.GetAll(System.Collections.Generic.IEnumerable{System.String})\">\r\n            <summary>\r\n            Retrieves multiple items from the cache.\r\n            </summary>\r\n            <param name=\"keys\">The list of identifiers for the items to retrieve.</param>\r\n            <returns>\r\n            a Dictionary holding all items indexed by their key.\r\n            </returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Translators.TranslateExtensionAttribute\">\r\n            <summary>\r\n            This instructs the generator tool to generate translator extension methods for the types supplied.\r\n            A {TypeName}.generated.cs static class will be generated that contains the extension methods required\r\n            to generate to and from that type.\r\n            \r\n            The source type is what the type the attribute is decorated on which can only be resolved at runtime.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IHttpResponse\">\r\n            <summary>\r\n            A thin wrapper around ASP.NET or HttpListener's HttpResponse\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHttpResponse.Close\">\r\n            <summary>\r\n            Signal that this response has been handled and no more processing should be done.\r\n            When used in a request or response filter, no more filters or processing is done on this request.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHttpResponse.End\">\r\n            <summary>\r\n            Calls Response.End() on ASP.NET HttpResponse otherwise is an alias for Close().\r\n            Useful when you want to prevent ASP.NET to provide it's own custom error page.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHttpResponse.Flush\">\r\n            <summary>\r\n            Response.Flush() and OutputStream.Flush() seem to have different behaviour in ASP.NET\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResponse.OriginalResponse\">\r\n            <summary>\r\n            The underlying ASP.NET or HttpListener HttpResponse\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHttpResponse.IsClosed\">\r\n            <summary>\r\n            Gets a value indicating whether this instance is closed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRestOptionsService`1\">\r\n            <summary>\r\n            If the Service also implements this interface,\r\n            IRestPutService.Options() will be used instead of IService.Execute() for \r\n            EndpointAttributes.HttpPut requests\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientsManager.GetClient\">\r\n            <summary>\r\n            Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientsManager.GetReadOnlyClient\">\r\n            <summary>\r\n            Returns a ReadOnly client using the hosts defined in ReadOnlyHosts.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientsManager.GetCacheClient\">\r\n            <summary>\r\n            Returns a Read/Write ICacheClient (The default) using the hosts defined in ReadWriteHosts\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientsManager.GetReadOnlyCacheClient\">\r\n            <summary>\r\n            Returns a ReadOnly ICacheClient using the hosts defined in ReadOnlyHosts.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.CacheAccess.ISessionFactory\">\r\n            <summary>\r\n            Retrieves a User Session\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ISessionFactory.GetOrCreateSession(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse)\">\r\n            <summary>\r\n            Gets the session for this request, creates one if it doesn't exist.\r\n            </summary>\r\n            <param name=\"httpReq\"></param>\r\n            <param name=\"httpRes\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ISessionFactory.GetOrCreateSession\">\r\n            <summary>\r\n            Gets the session for this request, creates one if it doesn't exist.\r\n            Only for ASP.NET apps. Uses the HttpContext.Current singleton.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IRemoveByPattern.RemoveByPattern(System.String)\">\r\n            <summary>\r\n            Removes items from cache that have keys matching the specified wildcard pattern\r\n            </summary>\r\n            <param name=\"pattern\">The wildcard, where \"*\" means any sequence of characters and \"?\" means any single character.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.IRemoveByPattern.RemoveByRegex(System.String)\">\r\n            <summary>\r\n            Removes items from the cache based on the specified regular expression pattern\r\n            </summary>\r\n            <param name=\"regex\">Regular expression pattern to search cache keys</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IHasResponseFilter\">\r\n            <summary>\r\n            This interface can be implemented by an attribute\r\n            which adds an response filter for the specific response DTO the attribute marked.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHasResponseFilter.ResponseFilter(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.Object)\">\r\n            <summary>\r\n            The response filter is executed after the service\r\n            </summary>\r\n            <param name=\"req\">The http request wrapper</param>\r\n            <param name=\"res\">The http response wrapper</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.IHasResponseFilter.Copy\">\r\n            <summary>\r\n            A new shallow copy of this filter is used on every request.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IHasResponseFilter.Priority\">\r\n            <summary>\r\n            Order in which Response Filters are executed. \r\n            &lt;0 Executed before global response filters\r\n            &gt;0 Executed after global response filters\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IRequiresRequestStream\">\r\n            <summary>\r\n            Implement on Request DTOs that need access to the raw Request Stream\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.IRequiresRequestStream.RequestStream\">\r\n            <summary>\r\n            The raw Http Request Input Stream\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.CacheAccess.ICacheClient\">\r\n            <summary>\r\n            A common interface implementation that is implemeneted by most cache providers\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Remove(System.String)\">\r\n            <summary>\r\n            Removes the specified item from the cache.\r\n            </summary>\r\n            <param name=\"key\">The identifier for the item to delete.</param>\r\n            <returns>\r\n            true if the item was successfully removed from the cache; false otherwise.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.RemoveAll(System.Collections.Generic.IEnumerable{System.String})\">\r\n            <summary>\r\n            Removes the cache for all the keys provided.\r\n            </summary>\r\n            <param name=\"keys\">The keys.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Get``1(System.String)\">\r\n            <summary>\r\n            Retrieves the specified item from the cache.\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"key\">The identifier for the item to retrieve.</param>\r\n            <returns>\r\n            The retrieved item, or <value>null</value> if the key was not found.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Increment(System.String,System.UInt32)\">\r\n            <summary>\r\n            Increments the value of the specified key by the given amount. \r\n            The operation is atomic and happens on the server.\r\n            A non existent value at key starts at 0\r\n            </summary>\r\n            <param name=\"key\">The identifier for the item to increment.</param>\r\n            <param name=\"amount\">The amount by which the client wants to increase the item.</param>\r\n            <returns>\r\n            The new value of the item or -1 if not found.\r\n            </returns>\r\n            <remarks>The item must be inserted into the cache before it can be changed. The item must be inserted as a <see cref=\"T:System.String\"/>. The operation only works with <see cref=\"T:System.UInt32\"/> values, so -1 always indicates that the item was not found.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Decrement(System.String,System.UInt32)\">\r\n            <summary>\r\n            Increments the value of the specified key by the given amount. \r\n            The operation is atomic and happens on the server.\r\n            A non existent value at key starts at 0\r\n            </summary>\r\n            <param name=\"key\">The identifier for the item to increment.</param>\r\n            <param name=\"amount\">The amount by which the client wants to decrease the item.</param>\r\n            <returns>\r\n            The new value of the item or -1 if not found.\r\n            </returns>\r\n            <remarks>The item must be inserted into the cache before it can be changed. The item must be inserted as a <see cref=\"T:System.String\"/>. The operation only works with <see cref=\"T:System.UInt32\"/> values, so -1 always indicates that the item was not found.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Add``1(System.String,``0)\">\r\n            <summary>\r\n            Adds a new item into the cache at the specified cache key only if the cache is empty.\r\n            </summary>\r\n            <param name=\"key\">The key used to reference the item.</param>\r\n            <param name=\"value\">The object to be inserted into the cache.</param>\r\n            <returns>\r\n            true if the item was successfully stored in the cache; false otherwise.\r\n            </returns>\r\n            <remarks>The item does not expire unless it is removed due memory pressure.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Set``1(System.String,``0)\">\r\n            <summary>\r\n            Sets an item into the cache at the cache key specified regardless if it already exists or not.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.Replace``1(System.String,``0)\">\r\n            <summary>\r\n            Replaces the item at the cachekey specified only if an items exists at the location already. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.FlushAll\">\r\n            <summary>\r\n            Invalidates all data on the cache.\r\n            </summary>\r\n        </member>\r\n        <!-- Badly formed XML comment ignored for member \"M:ServiceStack.CacheAccess.ICacheClient.GetAll``1(System.Collections.Generic.IEnumerable{System.String})\" -->\r\n        <member name=\"M:ServiceStack.CacheAccess.ICacheClient.SetAll``1(System.Collections.Generic.IDictionary{System.String,``0})\">\r\n            <summary>\r\n            Sets multiple items to the cache. \r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"values\">The values.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClient.GetTypedClient``1\">\r\n            <summary>\r\n            Returns a high-level typed client API\r\n            Shorter Alias is As&lt;T&gt;();\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClient.As``1\">\r\n            <summary>\r\n            Returns a high-level typed client API\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.QueueNames`1\">\r\n            <summary>\r\n            Util static generic class to create unique queue names for types\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.QueueNames\">\r\n            <summary>\r\n            Util class to create unique queue names for runtime types\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Messaging.Message`1\">\r\n            <summary>\r\n            Basic implementation of IMessage[T]\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.LogicFacade.IServiceModelFinder\">\r\n            <summary>\r\n            The same functionality is on IServiceResolver\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.ConsoleLogger\">\r\n            <summary>\r\n            Default logger is to Console.WriteLine\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.ConsoleLogger.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.ConsoleLogger.#ctor(System.Type)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.ConsoleLogger.Log(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.ConsoleLogger.LogFormat(System.Object,System.Object[])\">\r\n            <summary>\r\n            Logs the format.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.ConsoleLogger.Log(System.Object)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.CacheAccess.ISession\">\r\n            <summary>\r\n            A Users Session\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ISession.Set``1(System.String,``0)\">\r\n            <summary>\r\n            Set a typed value at key\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"key\"></param>\r\n            <param name=\"value\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.ISession.Get``1(System.String)\">\r\n            <summary>\r\n            Get a typed value at key\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"key\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.CacheAccess.ISession.Item(System.String)\">\r\n            <summary>\r\n            Store any object at key\r\n            </summary>\r\n            <param name=\"key\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.ServiceAttribute\">\r\n            <summary>\r\n            Used to decorate Request DTO's to alter the behaviour of a service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.ServiceAttribute.RestrictAccessTo\">\r\n            <summary>\r\n            Sets a single access restriction\r\n            </summary>\r\n            <value>The restrict access to.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.ServiceAttribute.RestrictAccessToScenarios\">\r\n            <summary>\r\n            Set multiple access scenarios\r\n            </summary>\r\n            <value>The restrict access to scenarios.</value>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.IRedisTransactionBase\">\r\n            <summary>\r\n            Base transaction interface, shared by typed and non-typed transactions\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientCacheManager.GetClient\">\r\n            <summary>\r\n            Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientCacheManager.GetReadOnlyClient\">\r\n            <summary>\r\n            Returns a ReadOnly client using the hosts defined in ReadOnlyHosts.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientCacheManager.GetCacheClient\">\r\n            <summary>\r\n            Returns a Read/Write ICacheClient (The default) using the hosts defined in ReadWriteHosts\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.IRedisClientCacheManager.GetReadOnlyCacheClient\">\r\n            <summary>\r\n            Returns a ReadOnly ICacheClient using the hosts defined in ReadOnlyHosts.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.IRedisTransaction\">\r\n            <summary>\r\n            Interface to redis transaction\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.ConsoleLogFactory\">\r\n            <summary>\r\n            Creates a Debug Logger, that logs all messages to: System.Diagnostics.Debug\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus\">\r\n            <summary>\r\n            Common ResponseStatus class that should be present on all response DTO's\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus\"/> class.\r\n            \r\n            A response status without an errorcode == success\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus\"/> class.\r\n            \r\n            A response status with an errorcode == failure\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.#ctor(System.String,System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus\"/> class.\r\n            \r\n            A response status with an errorcode == failure\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.ErrorCode\">\r\n            <summary>\r\n            Holds the custom ErrorCode enum if provided in ValidationException\r\n            otherwise will hold the name of the Exception type, e.g. typeof(Exception).Name\r\n            \r\n            A value of non-null means the service encountered an error while processing the request.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.Message\">\r\n            <summary>\r\n            A human friendly error message\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.StackTrace\">\r\n            <summary>\r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceInterface.ServiceModel.ResponseStatus.Errors\">\r\n            <summary>\r\n            For multiple detailed validation errors.\r\n            Can hold a specific error message for each named field.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.IService\">\r\n            <summary>\r\n            Marker interfaces\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.NullDebugLogger\">\r\n            <summary>\r\n            Default logger is to System.Diagnostics.Debug.Print\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.NullDebugLogger.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.NullDebugLogger.#ctor(System.Type)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.NullDebugLogger.Log(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.NullDebugLogger.LogFormat(System.Object,System.Object[])\">\r\n            <summary>\r\n            Logs the format.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.NullDebugLogger.Log(System.Object)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\">\r\n            <summary>\r\n            Default logger is to System.Diagnostics.Debug.WriteLine\r\n            \r\n            Made public so its testable\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.DebugLogger.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.DebugLogger.#ctor(System.Type)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Logging.Support.Logging.DebugLogger\"/> class.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.DebugLogger.Log(System.Object,System.Exception)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"exception\">The exception.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.DebugLogger.LogFormat(System.Object,System.Object[])\">\r\n            <summary>\r\n            Logs the format.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n            <param name=\"args\">The args.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Logging.Support.Logging.DebugLogger.Log(System.Object)\">\r\n            <summary>\r\n            Logs the specified message.\r\n            </summary>\r\n            <param name=\"message\">The message.</param>\r\n        </member>\r\n    </members>\r\n</doc>\r\n"
  },
  {
    "path": "Tools/Toboggan/ServiceStack.Redis.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<doc>\r\n    <assembly>\r\n        <name>ServiceStack.Redis</name>\r\n    </assembly>\r\n    <members>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISimpleWorkQueue`1.Enqueue(`0)\">\r\n            <summary>\r\n            Enqueue item\r\n            </summary>\r\n            <param name=\"workItem\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISimpleWorkQueue`1.Dequeue(System.Int32)\">\r\n            <summary>\r\n            Dequeue up to maxBatchSize items from queue\r\n            </summary>\r\n            <param name=\"maxBatchSize\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Locking.IDistributedLock\">\r\n            <summary>\r\n            Distributed lock interface\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClientList\">\r\n            <summary>\r\n            Wrap the common redis list operations under a IList[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClient\">\r\n            <summary>\r\n            The client wraps the native redis operations into a more readable c# API.\r\n            \r\n            Where possible these operations are also exposed in common c# interfaces, \r\n            e.g. RedisClient.Lists => IList[string]\r\n            \t RedisClient.Sets => ICollection[string]\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisNativeClient\">\r\n            <summary>\r\n            This class contains all the common operations for the RedisClient.\r\n            The client contains a 1:1 mapping of c# methods to redis operations of the same name.\r\n            \r\n            Not threadsafe use a pooled manager\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.SendCommand(System.Byte[][])\">\r\n            <summary>\r\n            Command to set multuple binary safe arguments\r\n            </summary>\r\n            <param name=\"cmdWithBinaryArgs\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.ResetSendBuffer\">\r\n            <summary>\r\n            reset buffer index in send buffer\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.Exec\">\r\n            <summary>\r\n            Requires custom result parsing\r\n            </summary>\r\n            <returns>Number of results</returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.RedisNativeClient.Active\">\r\n            <summary>\r\n            Used to manage connection pooling\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.RedisNativeClient.NamespacePrefix\">\r\n            <summary>\r\n            Gets or sets object key prefix.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient\">\r\n            <summary>\r\n            Interface to Alchemy DB\r\n            http://code.google.com/p/alchemydatabase/\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Alchemy.IAlchemyNativeClient\">\r\n            <summary>\r\n            Native interface to Alchemy DB\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.CreateTable(System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"columnDefinitions\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.DropTable(System.Byte[])\">\r\n            <summary>\r\n             \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.CreateIndex(System.Byte[],System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"indexname\"></param>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"column\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.DropIndex(System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"indexname\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Desc(System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Dump(System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.DumpToMysql(System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"mysqlTablename\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.DumpToFile(System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"fileName\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Insert(System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"valuesList\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.InsertReturnSize(System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"valuesList\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Select(System.Byte[],System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"columnList\"></param>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"whereClause\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.ScanSelect(System.Byte[],System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"columnList\"></param>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"whereClause\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Update(System.Byte[],System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"updateList\"></param>\r\n            <param name=\"whereClause\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Delete(System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"tablename\"></param>\r\n            <param name=\"whereClause\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisNativeClient.AlchemyNativeClient.Lua(System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"command\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisClient.New\">\r\n            <summary>\r\n            Creates a new instance of the Redis Client from NewFactoryFn. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisClient.UrnKey``1(``0)\">\r\n            <summary>\r\n            Returns key with automatic object id detection in provided value with <typeparam name=\"T\">generic type</typeparam>.\r\n            </summary>\r\n            <param name=\"value\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisClient.UrnKey``1(System.Object)\">\r\n            <summary>\r\n            Returns key with explicit object id.\r\n            </summary>\r\n            <param name=\"id\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisClient.UrnKey(System.Type,System.Object)\">\r\n            <summary>\r\n            Returns key with explicit object type and id.\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n            <param name=\"id\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.RedisTypedClient`1\">\r\n            <summary>\r\n            Allows you to get Redis value operations to operate against POCO types.\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Generic.RedisTypedClient`1.#ctor(ServiceStack.Redis.RedisClient)\">\r\n            <summary>\r\n            Use this to share the same redis connection with another\r\n            </summary>\r\n            <param name=\"client\">The client.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisCommandQueue\">\r\n            <summary>\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisQueueCompletableOperation\">\r\n            <summary>\r\n            Redis operation (transaction/pipeline) that allows queued commands to be completed\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClientHash\">\r\n            <summary>\r\n            Wrap the common redis set operations under a ICollection[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.RedisTypedTransaction`1\">\r\n            <summary>\r\n            Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations).\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisTypedPipeline`1\">\r\n            <summary>\r\n            Pipeline for redis typed client\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.RedisTypedCommandQueue`1\">\r\n            <summary>\r\n            Queue of commands for redis typed client\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Generic.RedisTypedTransaction`1.QueueExpectQueued\">\r\n            <summary>\r\n            Put \"QUEUED\" messages at back of queue\r\n            </summary>\r\n            <param name=\"queued\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Generic.RedisTypedTransaction`1.Exec\">\r\n            <summary>\r\n            Issue exec command (not queued)\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Generic.RedisTypedTransaction`1.handleMultiDataResultCount(System.Int32)\">\r\n            <summary>\r\n            callback for after result count is read in\r\n            </summary>\r\n            <param name=\"count\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1\">\r\n            <summary>\r\n            distributed work item queue. Each message must have an associated\r\n            work item  id. For a given id, all work items are guaranteed to be processed\r\n            in the order in which they are received.\r\n            \r\n            \r\n            </summary>\r\n            <summary>\r\n            distributed work item queue. Each message must have an associated\r\n            work item  id. For a given id, all work items are guaranteed to be processed\r\n            in the order in which they are received.\r\n            \r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Queue.Implementation.RedisWorkQueue`1\">\r\n            <summary>\r\n            distributed work item queue\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialWorkQueue`1.Enqueue(System.String,`0)\">\r\n            <summary>\r\n            Enqueue item in priority queue corresponding to workItemId identifier\r\n            </summary>\r\n            <param name=\"workItemId\"></param>\r\n            <param name=\"workItem\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialWorkQueue`1.PrepareNextWorkItem\">\r\n            <summary>\r\n            Preprare next work item id for dequeueing\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialWorkQueue`1.Dequeue(System.Int32)\">\r\n            <summary>\r\n            Dequeue up to maxBatchSize items from queue corresponding to workItemId identifier.\r\n            Once this method is called, <see cref=\"M:ServiceStack.Redis.Support.Queue.ISequentialWorkQueue`1.Dequeue(System.Int32)\"/> or <see cref=\"!:Peek\"/> will not\r\n            return any items for workItemId until the dequeue lock returned is unlocked.\r\n            </summary>\r\n            <param name=\"maxBatchSize\"></param>\r\n            <param name=\"defer\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialWorkQueue`1.Update(System.String,System.Int32,`0)\">\r\n            <summary>\r\n            Replace existing work item in workItemId queue\r\n            </summary>\r\n            <param name=\"workItemId\"></param>\r\n            <param name=\"index\"></param>\r\n            <param name=\"newWorkItem\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.Enqueue(System.String,`0)\">\r\n            <summary>\r\n            Queue incoming messages\r\n            </summary>\r\n            <param name=\"workItem\"></param>\r\n            <param name=\"workItemId\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.PrepareNextWorkItem\">\r\n            <summary>\r\n            Must call this periodically to move work items from priority queue to pending queue\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.Update(System.String,System.Int32,`0)\">\r\n            <summary>\r\n            Replace existing work item in workItemId queue\r\n            </summary>\r\n            <param name=\"workItemId\"></param>\r\n            <param name=\"index\"></param>\r\n            <param name=\"newWorkItem\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.Pop(System.String,System.Int32)\">\r\n            <summary>\r\n            Pop items from list\r\n            </summary>\r\n            <param name=\"workItemId\"></param>\r\n            <param name=\"itemCount\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.HarvestZombies\">\r\n            <summary>\r\n            Force release of locks held by crashed servers\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.TryForceReleaseLock(ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClient,System.String)\">\r\n            <summary>\r\n            release lock held by crashed server\r\n            </summary>\r\n            <param name=\"client\"></param>\r\n            <param name=\"workItemId\"></param>\r\n            <returns>true if lock is released, either by this method or by another client; false otherwise</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.Unlock(System.String)\">\r\n            <summary>\r\n            Unlock work item id, so other servers can process items for this id\r\n            </summary>\r\n            <param name=\"workItemId\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.DequeueManager.UpdateNextUnprocessed(`0)\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"newWorkItem\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.DequeueManager.PopAndUnlock(System.Int32,ServiceStack.Redis.IRedisClient)\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"numProcessed\"></param>\r\n            <param name=\"client\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSequentialWorkQueue`1.DequeueManager.PopAndUnlock(System.Int32)\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"numProcessed\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.WriteLock.#ctor(System.Threading.ReaderWriterLockSlim)\">\r\n            <summary>\r\n            This class manages a write lock for a local readers/writer lock, \r\n            using the Resource Acquisition Is Initialization pattern\r\n            </summary>\r\n            <param name=\"lockObject\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.WriteLock.Dispose\">\r\n            <summary>\r\n            RAII disposal\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.DistributedLock.Lock(System.String,System.Int32,System.Int32,System.Int64@,ServiceStack.Redis.IRedisClient)\">\r\n            <summary>\r\n            acquire distributed, non-reentrant lock on key\r\n            </summary>\r\n            <param name=\"key\">global key for this lock</param>\r\n            <param name=\"acquisitionTimeout\">timeout for acquiring lock</param>\r\n            <param name=\"lockTimeout\">timeout for lock, in seconds (stored as value against lock key) </param>\r\n            <param name=\"client\"></param>\r\n            <param name=\"lockExpire\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.DistributedLock.Unlock(System.String,System.Int64,ServiceStack.Redis.IRedisClient)\">\r\n            <summary>\r\n            unlock key\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.DistributedLock.CalculateLockExpire(System.TimeSpan,System.Int32)\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"ts\"></param>\r\n            <param name=\"timeout\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Queue.Implementation.RedisChronologicalWorkQueue`1\">\r\n            <summary>\r\n            distributed work item queue. Messages are processed in chronological order\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisChronologicalWorkQueue`1.Enqueue(System.String,`0,System.Double)\">\r\n            <summary>\r\n            Enqueue incoming messages\r\n            </summary>\r\n            <param name=\"workItem\"></param>\r\n            <param name=\"workItemId\"></param>\r\n            <param name=\"time\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisChronologicalWorkQueue`1.Dequeue(System.Double,System.Double,System.Int32)\">\r\n            <summary>\r\n            Dequeue next batch of work items\r\n            </summary>\r\n            <param name=\"minTime\"></param>\r\n            <param name=\"maxTime\"></param>\r\n            <param name=\"maxBatchSize\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisCommand\">\r\n            <summary>\r\n            Redis command that does not get queued\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisClientManagerCacheClient.Dispose\">\r\n            <summary>\r\n            Ignore dispose on RedisClientsManager, which should be registered as a singleton\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.QueuedRedisTypedCommand`1\">\r\n            <summary>\r\n            A complete redis command, with method to send command, receive response, and run callback on success or failure\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Locking.ILockingStrategy\">\r\n            <summary>\r\n            Locking strategy interface\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.OptimizedObjectSerializer\">\r\n            <summary>\r\n            Optimized  <see cref=\"T:ServiceStack.Redis.Support.ISerializer\"/> implementation. Primitive types are manually serialized, the rest are serialized using binary serializer /&gt;.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.ObjectSerializer\">\r\n            <summary>\r\n            serialize/deserialize arbitrary objects\r\n            (objects must be serializable)\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.ObjectSerializer.Serialize(System.Object)\">\r\n            <summary>\r\n             Serialize object to buffer\r\n            </summary>\r\n            <param name=\"value\">serializable object</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.ObjectSerializer.Deserialize(System.Byte[])\">\r\n            <summary>\r\n                Deserialize buffer to object\r\n            </summary>\r\n            <param name=\"someBytes\">byte array to deserialize</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OptimizedObjectSerializer.Serialize(System.Object)\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"value\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OptimizedObjectSerializer.Deserialize(System.Byte[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"someBytes\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OptimizedObjectSerializer.SerializeToWrapper(System.Object)\">\r\n            <summary>\r\n            serialize value and wrap with <see cref=\"T:ServiceStack.Redis.Support.SerializedObjectWrapper\"/>\r\n            </summary>\r\n            <param name=\"value\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OptimizedObjectSerializer.Unwrap(ServiceStack.Redis.Support.SerializedObjectWrapper)\">\r\n            <summary>\r\n            Unwrap object wrapped in <see cref=\"T:ServiceStack.Redis.Support.SerializedObjectWrapper\"/>\r\n            </summary>\r\n            <param name=\"item\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.RedisNamespace\">\r\n            <summary>\r\n            manages a \"region\" in the redis key space\r\n            namespace can be cleared by incrementing the generation\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.GetGeneration\">\r\n            <summary>\r\n            get current generation\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.SetGeneration(System.Int64)\">\r\n            <summary>\r\n            set new generation\r\n            </summary>\r\n            <param name=\"generation\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.GetGenerationKey\">\r\n            <summary>\r\n            redis key for generation\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.GetGlobalKeysKey\">\r\n            <summary>\r\n            get redis key that holds all namespace keys\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.GlobalCacheKey(System.Object)\">\r\n            <summary>\r\n            get global cache key\r\n            </summary>\r\n            <param name=\"key\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.GlobalKey(System.Object,System.Int32)\">\r\n            <summary>\r\n            get global key inside of this namespace\r\n            </summary>\r\n            <param name=\"key\"></param>\r\n            <param name=\"numUniquePrefixes\">prefixes can be added for name deconfliction</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.Sanitize(System.String)\">\r\n            <summary>\r\n            replace UniqueCharacter with its double, to avoid name clash\r\n            </summary>\r\n            <param name=\"dirtyString\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.RedisNamespace.Sanitize(System.Object)\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"dirtyString\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.RedisNamespace.LockingStrategy\">\r\n            <summary>\r\n            get locking strategy\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">\r\n            <summary>\r\n            Represents a generic collection of key/value pairs that are ordered independently of the key and value.\r\n            </summary>\r\n            <typeparam name=\"TKey\">The type of the keys in the dictionary</typeparam>\r\n            <typeparam name=\"TValue\">The type of the values in the dictionary</typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">\r\n            <summary>\r\n            Represents a generic collection of key/value pairs that are ordered independently of the key and value.\r\n            </summary>\r\n            <typeparam name=\"TKey\">The type of the keys in the dictionary</typeparam>\r\n            <typeparam name=\"TValue\">The type of the values in the dictionary</typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.IOrderedDictionary`2.Add(`0,`1)\">\r\n            <summary>\r\n            Adds an entry with the specified key and value into the <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> collection with the lowest available index.\r\n            </summary>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add.</param>\r\n            <returns>The index of the newly added entry</returns>\r\n            <remarks>\r\n            <para>You can also use the <see cref=\"P:System.Collections.Generic.IDictionary{TKey,TValue}.Item(TKey)\"/> property to add new elements by setting the value of a key that does not exist in the <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> collection; however, if the specified key already exists in the <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see>, setting the <see cref=\"P:Item(TKey)\"/> property overwrites the old value. In contrast, the <see cref=\"M:Add\"/> method does not modify existing elements.</para></remarks>\r\n            <exception cref=\"T:System.ArgumentException\">An element with the same key already exists in the <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see></exception>\r\n            <exception cref=\"T:System.NotSupportedException\">The <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> is read-only.<br/>\r\n            -or-<br/>\r\n            The <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> has a fized size.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.IOrderedDictionary`2.Insert(System.Int32,`0,`1)\">\r\n            <summary>\r\n            Inserts a new entry into the <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> collection with the specified key and value at the specified index.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index at which the element should be inserted.</param>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add. The value can be <null/> if the type of the values in the dictionary is a reference type.</param>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            <paramref name=\"index\"/> is greater than <see cref=\"P:System.Collections.ICollection.Count\"/>.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">An element with the same key already exists in the <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see>.</exception>\r\n            <exception cref=\"T:System.NotSupportedException\">The <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> is read-only.<br/>\r\n            -or-<br/>\r\n            The <see cref=\"T:ServiceStack.Redis.Support.IOrderedDictionary`2\">IOrderedDictionary&lt;TKey,TValue&gt;</see> has a fized size.</exception>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.IOrderedDictionary`2.Item(System.Int32)\">\r\n            <summary>\r\n            Gets or sets the value at the specified index.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index of the value to get or set.</param>\r\n            <value>The value of the item at the specified index.</value>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            <paramref name=\"index\"/> is equal to or greater than <see cref=\"P:System.Collections.ICollection.Count\"/>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.#ctor(System.Int32)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> class using the specified initial capacity.\r\n            </summary>\r\n            <param name=\"capacity\">The initial number of elements that the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> can contain.</param>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"capacity\"/> is less than 0</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.#ctor(System.Collections.Generic.IEqualityComparer{`0})\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> class using the specified comparer.\r\n            </summary>\r\n            <param name=\"comparer\">The <see cref=\"T:System.Collections.Generic.IEqualityComparer`1\">IEqualityComparer&lt;TKey&gt;</see> to use when comparing keys, or <null/> to use the default <see cref=\"T:System.Collections.Generic.EqualityComparer`1\">EqualityComparer&lt;TKey&gt;</see> for the type of the key.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.#ctor(System.Int32,System.Collections.Generic.IEqualityComparer{`0})\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> class using the specified initial capacity and comparer.\r\n            </summary>\r\n            <param name=\"capacity\">The initial number of elements that the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection can contain.</param>\r\n            <param name=\"comparer\">The <see cref=\"T:System.Collections.Generic.IEqualityComparer`1\">IEqualityComparer&lt;TKey&gt;</see> to use when comparing keys, or <null/> to use the default <see cref=\"T:System.Collections.Generic.EqualityComparer`1\">EqualityComparer&lt;TKey&gt;</see> for the type of the key.</param>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"capacity\"/> is less than 0</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.ConvertToKeyType(System.Object)\">\r\n            <summary>\r\n            Converts the object passed as a key to the key type of the dictionary\r\n            </summary>\r\n            <param name=\"keyObject\">The key object to check</param>\r\n            <returns>The key object, cast as the key type of the dictionary</returns>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"keyObject\"/> is <null/>.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">The key type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"keyObject\"/>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.ConvertToValueType(System.Object)\">\r\n            <summary>\r\n            Converts the object passed as a value to the value type of the dictionary\r\n            </summary>\r\n            <param name=\"value\">The object to convert to the value type of the dictionary</param>\r\n            <returns>The value object, converted to the value type of the dictionary</returns>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"valueObject\"/> is <null/>, and the value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is a value type.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">The value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"valueObject\"/>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.Insert(System.Int32,`0,`1)\">\r\n            <summary>\r\n            Inserts a new entry into the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection with the specified key and value at the specified index.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index at which the element should be inserted.</param>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add. The value can be <null/> if the type of the values in the dictionary is a reference type.</param>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            <paramref name=\"index\"/> is greater than <see cref=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Count\"/>.</exception>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/>.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">An element with the same key already exists in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Specialized#IOrderedDictionary#Insert(System.Int32,System.Object,System.Object)\">\r\n            <summary>\r\n            Inserts a new entry into the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection with the specified key and value at the specified index.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index at which the element should be inserted.</param>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add. The value can be <null/> if the type of the values in the dictionary is a reference type.</param>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            <paramref name=\"index\"/> is greater than <see cref=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Count\"/>.</exception>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/>.<br/>\r\n            -or-<br/>\r\n            <paramref name=\"value\"/> is <null/>, and the value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is a value type.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">The key type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"key\"/>.<br/>\r\n            -or-<br/>\r\n            The value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"value\"/>.<br/>\r\n            -or-<br/>\r\n            An element with the same key already exists in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.RemoveAt(System.Int32)\">\r\n            <summary>\r\n            Removes the entry at the specified index from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index of the entry to remove.</param>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            index is equal to or greater than <see cref=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Count\"/>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Generic#IDictionary{TKey@TValue}#Add(`0,`1)\">\r\n            <summary>\r\n            Adds an entry with the specified key and value into the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection with the lowest available index.\r\n            </summary>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add. This value can be <null/>.</param>\r\n            <remarks>A key cannot be <null/>, but a value can be.\r\n            <para>You can also use the <see cref=\"P:OrderedDictionary{TKey,TValue}.Item(TKey)\"/> property to add new elements by setting the value of a key that does not exist in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection; however, if the specified key already exists in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>, setting the <see cref=\"P:OrderedDictionary{TKey,TValue}.Item(TKey)\"/> property overwrites the old value. In contrast, the <see cref=\"M:Add\"/> method does not modify existing elements.</para></remarks>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/></exception>\r\n            <exception cref=\"T:System.ArgumentException\">An element with the same key already exists in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see></exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.Add(`0,`1)\">\r\n            <summary>\r\n            Adds an entry with the specified key and value into the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection with the lowest available index.\r\n            </summary>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add. This value can be <null/>.</param>\r\n            <returns>The index of the newly added entry</returns>\r\n            <remarks>A key cannot be <null/>, but a value can be.\r\n            <para>You can also use the <see cref=\"P:OrderedDictionary{TKey,TValue}.Item(TKey)\"/> property to add new elements by setting the value of a key that does not exist in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection; however, if the specified key already exists in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>, setting the <see cref=\"P:OrderedDictionary{TKey,TValue}.Item(TKey)\"/> property overwrites the old value. In contrast, the <see cref=\"M:Add\"/> method does not modify existing elements.</para></remarks>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/></exception>\r\n            <exception cref=\"T:System.ArgumentException\">An element with the same key already exists in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see></exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#Add(System.Object,System.Object)\">\r\n            <summary>\r\n            Adds an entry with the specified key and value into the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection with the lowest available index.\r\n            </summary>\r\n            <param name=\"key\">The key of the entry to add.</param>\r\n            <param name=\"value\">The value of the entry to add. This value can be <null/>.</param>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/>.<br/>\r\n            -or-<br/>\r\n            <paramref name=\"value\"/> is <null/>, and the value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is a value type.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">The key type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"key\"/>.<br/>\r\n            -or-<br/>\r\n            The value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"value\"/>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.Clear\">\r\n            <summary>\r\n            Removes all elements from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.\r\n            </summary>\r\n            <remarks>The capacity is not changed as a result of calling this method.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.ContainsKey(`0)\">\r\n            <summary>\r\n            Determines whether the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection contains a specific key.\r\n            </summary>\r\n            <param name=\"key\">The key to locate in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.</param>\r\n            <returns><see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection contains an element with the specified key; otherwise, <see langword=\"false\"/>.</returns>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/></exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#Contains(System.Object)\">\r\n            <summary>\r\n            Determines whether the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection contains a specific key.\r\n            </summary>\r\n            <param name=\"key\">The key to locate in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.</param>\r\n            <returns><see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection contains an element with the specified key; otherwise, <see langword=\"false\"/>.</returns>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"key\"/> is <null/></exception>\r\n            <exception cref=\"T:System.ArgumentException\">The key type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"key\"/>.</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.IndexOfKey(`0)\">\r\n            <summary>\r\n            Returns the zero-based index of the specified key in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>\r\n            </summary>\r\n            <param name=\"key\">The key to locate in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see></param>\r\n            <returns>The zero-based index of <paramref name=\"key\"/>, if <paramref name=\"ley\"/> is found in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>; otherwise, -1</returns>\r\n            <remarks>This method performs a linear search; therefore it has a cost of O(n) at worst.</remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.Remove(`0)\">\r\n            <summary>\r\n            Removes the entry with the specified key from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.\r\n            </summary>\r\n            <param name=\"key\">The key of the entry to remove</param>\r\n            <returns><see langword=\"true\"/> if the key was found and the corresponding element was removed; otherwise, <see langword=\"false\"/></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#Remove(System.Object)\">\r\n            <summary>\r\n            Removes the entry with the specified key from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.\r\n            </summary>\r\n            <param name=\"key\">The key of the entry to remove</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#ICollection#CopyTo(System.Array,System.Int32)\">\r\n            <summary>\r\n            Copies the elements of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> elements to a one-dimensional Array object at the specified index.\r\n            </summary>\r\n            <param name=\"array\">The one-dimensional <see cref=\"T:System.Array\"/> object that is the destination of the <see cref=\"T:KeyValuePair`2&gt;\"/> objects copied from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>. The <see cref=\"T:System.Array\"/> must have zero-based indexing.</param>\r\n            <param name=\"index\">The zero-based index in <paramref name=\"array\"/> at which copying begins.</param>\r\n            <remarks>The <see cref=\"M:CopyTo\"/> method preserves the order of the elements in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see></remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.TryGetValue(`0,`1@)\">\r\n            <summary>\r\n            Gets the value associated with the specified key.\r\n            </summary>\r\n            <param name=\"key\">The key of the value to get.</param>\r\n            <param name=\"value\">When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of <paramref name=\"value\"/>. This parameter can be passed uninitialized.</param>\r\n            <returns><see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> contains an element with the specified key; otherwise, <see langword=\"false\"/>.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Generic#ICollection{System#Collections#Generic#KeyValuePair{TKey@TValue}}#Add(System.Collections.Generic.KeyValuePair{`0,`1})\">\r\n            <summary>\r\n            Adds the specified value to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> with the specified key.\r\n            </summary>\r\n            <param name=\"item\">The <see cref=\"T:KeyValuePair{TKey,TValue}\">KeyValuePair&lt;TKey,TValue&gt;</see> structure representing the key and value to add to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Generic#ICollection{System#Collections#Generic#KeyValuePair{TKey@TValue}}#Contains(System.Collections.Generic.KeyValuePair{`0,`1})\">\r\n            <summary>\r\n            Determines whether the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> contains a specific key and value.\r\n            </summary>\r\n            <param name=\"item\">The <see cref=\"T:KeyValuePair{TKey,TValue}\">KeyValuePair&lt;TKey,TValue&gt;</see> structure to locate in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</param>\r\n            <returns><see langword=\"true\"/> if <paramref name=\"keyValuePair\"/> is found in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>; otherwise, <see langword=\"false\"/>.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Generic#ICollection{System#Collections#Generic#KeyValuePair{TKey@TValue}}#CopyTo(System.Collections.Generic.KeyValuePair{`0,`1}[],System.Int32)\">\r\n            <summary>\r\n            Copies the elements of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> to an array of type <see cref=\"T:KeyValuePair`2&gt;\"/>, starting at the specified index.\r\n            </summary>\r\n            <param name=\"array\">The one-dimensional array of type <see cref=\"T:KeyValuePair{TKey,TValue}\">KeyValuePair&lt;TKey,TValue&gt;</see> that is the destination of the <see cref=\"T:KeyValuePair{TKey,TValue}\">KeyValuePair&lt;TKey,TValue&gt;</see> elements copied from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>. The array must have zero-based indexing.</param>\r\n            <param name=\"arrayIndex\">The zero-based index in <paramref name=\"array\"/> at which copying begins.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Generic#ICollection{System#Collections#Generic#KeyValuePair{TKey@TValue}}#Remove(System.Collections.Generic.KeyValuePair{`0,`1})\">\r\n            <summary>\r\n            Removes a key and value from the dictionary.\r\n            </summary>\r\n            <param name=\"item\">The <see cref=\"T:KeyValuePair{TKey,TValue}\">KeyValuePair&lt;TKey,TValue&gt;</see> structure representing the key and value to remove from the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</param>\r\n            <returns><see langword=\"true\"/> if the key and value represented by <paramref name=\"keyValuePair\"/> is successfully found and removed; otherwise, <see langword=\"false\"/>. This method returns <see langword=\"false\"/> if <paramref name=\"keyValuePair\"/> is not found in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Dictionary\">\r\n            <summary>\r\n            Gets the dictionary object that stores the keys and values\r\n            </summary>\r\n            <value>The dictionary object that stores the keys and values for the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see></value>\r\n            <remarks>Accessing this property will create the dictionary object if necessary</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.List\">\r\n            <summary>\r\n            Gets the list object that stores the key/value pairs.\r\n            </summary>\r\n            <value>The list object that stores the key/value pairs for the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see></value>\r\n            <remarks>Accessing this property will create the list object if necessary.</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Item(System.Int32)\">\r\n            <summary>\r\n            Gets or sets the value at the specified index.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index of the value to get or set.</param>\r\n            <value>The value of the item at the specified index.</value>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            index is equal to or greater than <see cref=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Count\"/>.</exception>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#Specialized#IOrderedDictionary#Item(System.Int32)\">\r\n            <summary>\r\n            Gets or sets the value at the specified index.\r\n            </summary>\r\n            <param name=\"index\">The zero-based index of the value to get or set.</param>\r\n            <value>The value of the item at the specified index.</value>\r\n            <exception cref=\"T:System.ArgumentOutOfRangeException\"><paramref name=\"index\"/> is less than 0.<br/>\r\n            -or-<br/>\r\n            index is equal to or greater than <see cref=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Count\"/>.</exception>\r\n            <exception cref=\"T:System.ArgumentNullException\"><paramref name=\"valueObject\"/> is a null reference, and the value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is a value type.</exception>\r\n            <exception cref=\"T:System.ArgumentException\">The value type of the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is not in the inheritance hierarchy of <paramref name=\"valueObject\"/>.</exception>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#IsFixedSize\">\r\n            <summary>\r\n            Gets a value indicating whether the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> has a fixed size.\r\n            </summary>\r\n            <value><see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> has a fixed size; otherwise, <see langword=\"false\"/>. The default is <see langword=\"false\"/>.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.IsReadOnly\">\r\n            <summary>\r\n            Gets a value indicating whether the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection is read-only.\r\n            </summary>\r\n            <value><see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> is read-only; otherwise, <see langword=\"false\"/>. The default is <see langword=\"false\"/>.</value>\r\n            <remarks>\r\n            A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.\r\n            <para>A collection that is read-only is simply a collection with a wrapper that prevents modification of the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.</para>\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#Keys\">\r\n            <summary>\r\n            Gets an <see cref=\"T:System.Collections.ICollection\"/> object containing the keys in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.\r\n            </summary>\r\n            <value>An <see cref=\"T:System.Collections.ICollection\"/> object containing the keys in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</value>\r\n            <remarks>The returned <see cref=\"T:System.Collections.ICollection\"/> object is not a static copy; instead, the collection refers back to the keys in the original <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>. Therefore, changes to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> continue to be reflected in the key collection.</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#Values\">\r\n            <summary>\r\n            Gets an <see cref=\"T:System.Collections.ICollection\"/> object containing the values in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.\r\n            </summary>\r\n            <value>An <see cref=\"T:System.Collections.ICollection\"/> object containing the values in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.</value>\r\n            <remarks>The returned <see cref=\"T:System.Collections.ICollection\"/> object is not a static copy; instead, the <see cref=\"T:System.Collections.ICollection\"/> refers back to the values in the original <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection. Therefore, changes to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> continue to be reflected in the <see cref=\"T:System.Collections.ICollection\"/>.</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Item(`0)\">\r\n            <summary>\r\n            Gets or sets the value with the specified key.\r\n            </summary>\r\n            <param name=\"key\">The key of the value to get or set.</param>\r\n            <value>The value associated with the specified key. If the specified key is not found, attempting to get it returns <null/>, and attempting to set it creates a new element using the specified key.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#IDictionary#Item(System.Object)\">\r\n            <summary>\r\n            Gets or sets the value with the specified key.\r\n            </summary>\r\n            <param name=\"key\">The key of the value to get or set.</param>\r\n            <value>The value associated with the specified key. If the specified key is not found, attempting to get it returns <null/>, and attempting to set it creates a new element using the specified key.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Count\">\r\n            <summary>\r\n            Gets the number of key/values pairs contained in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.\r\n            </summary>\r\n            <value>The number of key/value pairs contained in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> collection.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#ICollection#IsSynchronized\">\r\n            <summary>\r\n            Gets a value indicating whether access to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> object is synchronized (thread-safe).\r\n            </summary>\r\n            <value>This method always returns false.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.System#Collections#ICollection#SyncRoot\">\r\n            <summary>\r\n            Gets an object that can be used to synchronize access to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> object.\r\n            </summary>\r\n            <value>An object that can be used to synchronize access to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> object.</value>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Keys\">\r\n            <summary>\r\n            Gets an <see cref=\"T:System.Collections.Generic.ICollection{TKey}\">ICollection&lt;TKey&gt;</see> object containing the keys in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.\r\n            </summary>\r\n            <value>An <see cref=\"T:System.Collections.Generic.ICollection{TKey}\">ICollection&lt;TKey&gt;</see> object containing the keys in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</value>\r\n            <remarks>The returned <see cref=\"T:System.Collections.Generic.ICollection{TKey}\">ICollection&lt;TKey&gt;</see> object is not a static copy; instead, the collection refers back to the keys in the original <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>. Therefore, changes to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> continue to be reflected in the key collection.</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.OrderedDictionary`2.Values\">\r\n            <summary>\r\n            Gets an <see cref=\"T:ICollection{TValue}\">ICollection&lt;TValue&gt;</see> object containing the values in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.\r\n            </summary>\r\n            <value>An <see cref=\"T:ICollection{TValue}\">ICollection&lt;TValue&gt;</see> object containing the values in the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>.</value>\r\n            <remarks>The returned <see cref=\"T:ICollection{TValue}\">ICollection&lt;TKey&gt;</see> object is not a static copy; instead, the collection refers back to the values in the original <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see>. Therefore, changes to the <see cref=\"T:ServiceStack.Redis.Support.OrderedDictionary`2\">OrderedDictionary&lt;TKey,TValue&gt;</see> continue to be reflected in the value collection.</remarks>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClientSet\">\r\n            <summary>\r\n            Wrap the common redis set operations under a ICollection[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClientSortedSet\">\r\n            <summary>\r\n            Wrap the common redis set operations under a ICollection[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.SerializedObjectWrapper\">\r\n            <summary>\r\n            wraps a serialized representation of an object\r\n            </summary>\r\n            \r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.SerializedObjectWrapper.#ctor(System.UInt16,System.ArraySegment{System.Byte})\">\r\n            <summary>\r\n            Initializes a new instance of <see cref=\"T:ServiceStack.Redis.Support.SerializedObjectWrapper\"/>.\r\n            </summary>\r\n            <param name=\"flags\">Custom item data.</param>\r\n            <param name=\"data\">The serialized item.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.SerializedObjectWrapper.Data\">\r\n            <summary>\r\n            The data representing the item being stored/retireved.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.SerializedObjectWrapper.Flags\">\r\n            <summary>\r\n            Flags set for this instance.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClientsManagerExtensions\">\r\n            <summary>\r\n            Useful wrapper IRedisClientsManager to cut down the boiler plat of most IRedisClient access\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.RedisClientSet`1\">\r\n            <summary>\r\n            Wrap the common redis set operations under a ICollection[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.ConsistentHash`1.AddTarget(`0,System.Int32)\">\r\n            <summary>\r\n             Adds a node and maps points across the circle\r\n            </summary>\r\n            <param name=\"node\"> node to add </param>\r\n            <param name=\"weight\"> An arbitrary number, specifies how often it occurs relative to other targets. </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.ConsistentHash`1.ModifiedBinarySearch(System.UInt64[],System.UInt64)\">\r\n            <summary>\r\n              A variation of Binary Search algorithm. Given a number, matches the next highest number from the sorted array. \r\n              If a higher number does not exist, then the first number in the array is returned.\r\n            </summary>\r\n            <param name=\"sortedArray\"> a sorted array to perform the search </param>\r\n            <param name=\"val\"> number to find the next highest number against </param>\r\n            <returns> next highest number </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.ConsistentHash`1.Md5Hash(System.String)\">\r\n            <summary>\r\n              Given a key, generates an unsigned 64 bit hash code using MD5\r\n            </summary>\r\n            <param name=\"key\"> </param>\r\n            <returns> </returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisException\">\r\n            <summary>\r\n            Redis-specific exception. Thrown if unable to connect to Redis server due to socket exception, for example.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Locking.DisposableDistributedLock\">\r\n            <summary>\r\n            distributed lock class that follows the Resource Allocation Is Initialization pattern\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.DisposableDistributedLock.#ctor(ServiceStack.Redis.IRedisClient,System.String,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Lock\r\n            </summary>\r\n            <param name=\"client\"></param>\r\n            <param name=\"globalLockKey\"></param>\r\n            <param name=\"acquisitionTimeout\">in seconds</param>\r\n            <param name=\"lockTimeout\">in seconds</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.DisposableDistributedLock.Dispose\">\r\n            <summary>\r\n            unlock\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisTransaction\">\r\n            <summary>\r\n            Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations).\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisAllPurposePipeline.#ctor(ServiceStack.Redis.RedisClient)\">\r\n            <summary>\r\n            General purpose pipeline\r\n            </summary>\r\n            <param name=\"redisClient\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisAllPurposePipeline.Flush\">\r\n            <summary>\r\n            Flush send buffer, and read responses\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisTransaction.QueueExpectQueued\">\r\n            <summary>\r\n            Put \"QUEUED\" messages at back of queue\r\n            </summary>\r\n            <param name=\"queued\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisTransaction.Exec\">\r\n            <summary>\r\n            Issue exec command (not queued)\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.RedisTransaction.handleMultiDataResultCount(System.Int32)\">\r\n            <summary>\r\n            callback for after result count is read in\r\n            </summary>\r\n            <param name=\"count\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Messaging.RedisTransientMessageFactory\">\r\n            <summary>\r\n            Transient message queues are a one-pass message queue service that starts\r\n            processing messages when Start() is called. Any subsequent Start() calls \r\n            while the service is running is ignored.\r\n            \r\n            The transient service will continue to run until all messages have been \r\n            processed after which time it will shutdown all processing until Start() is called again.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClient.Serialize(System.Object)\">\r\n            <summary>\r\n             Serialize object to buffer\r\n            </summary>\r\n            <param name=\"value\">serializable object</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClient.Serialize(System.Object[])\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <param name=\"values\">array of serializable objects</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClient.Deserialize(System.Byte[])\">\r\n            <summary>\r\n             Deserialize buffer to object\r\n            </summary>\r\n            <param name=\"someBytes\">byte array to deserialize</param>\r\n            <returns></returns>\r\n        </member>\r\n        <!-- Badly formed XML comment ignored for member \"M:ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClient.Deserialize(System.Byte[][])\" -->\r\n        <member name=\"P:ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClient.Serializer\">\r\n            <summary>\r\n            customize the client serializer\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.PooledRedisClientManager\">\r\n            <summary>\r\n            Provides thread-safe pooling of redis client connections.\r\n            Allows load-balancing of master-write and read-slave hosts, ideal for\r\n            1 master and multiple replicated read slaves.\r\n            </summary>\r\n            <summary>\r\n            For interoperabilty GetCacheClient() and GetReadOnlyCacheClient()\r\n            return an ICacheClient wrapper around the redis manager which has the affect of calling \r\n            GetClient() for all write operations and GetReadOnlyClient() for the read ones.\r\n            \r\n            This works well for master-slave replication scenarios where you have \r\n            1 master that replicates to multiple read slaves.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.#ctor(System.Collections.Generic.IEnumerable{System.String},System.Collections.Generic.IEnumerable{System.String},ServiceStack.Redis.RedisClientManagerConfig)\">\r\n            <summary>\r\n            Hosts can be an IP Address or Hostname in the format: host[:port]\r\n            e.g. 127.0.0.1:6379\r\n            default is: localhost:6379\r\n            </summary>\r\n            <param name=\"readWriteHosts\">The write hosts.</param>\r\n            <param name=\"readOnlyHosts\">The read hosts.</param>\r\n            <param name=\"config\">The config.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.GetClient\">\r\n            <summary>\r\n            Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.GetInActiveWriteClient\">\r\n            <summary>\r\n            Called within a lock\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.GetReadOnlyClient\">\r\n            <summary>\r\n            Returns a ReadOnly client using the hosts defined in ReadOnlyHosts.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.GetInActiveReadClient\">\r\n            <summary>\r\n            Called within a lock\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.DisposeReadOnlyClient(ServiceStack.Redis.RedisNativeClient)\">\r\n            <summary>\r\n            Disposes the read only client.\r\n            </summary>\r\n            <param name=\"client\">The client.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.DisposeWriteClient(ServiceStack.Redis.RedisNativeClient)\">\r\n            <summary>\r\n            Disposes the write client.\r\n            </summary>\r\n            <param name=\"client\">The client.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.PooledRedisClientManager.NamespacePrefix\">\r\n            <summary>\r\n            Gets or sets object key prefix.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.PooledRedisClientManager.DisposablePooledClient`1\">\r\n            <summary>\r\n            Manage a client acquired from the PooledRedisClientManager\r\n            Dispose method will release the client back to the pool.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.DisposablePooledClient`1.#ctor(ServiceStack.Redis.PooledRedisClientManager)\">\r\n            <summary>\r\n            wrap the acquired client\r\n            </summary>\r\n            <param name=\"clientManager\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.PooledRedisClientManager.DisposablePooledClient`1.Dispose\">\r\n            <summary>\r\n            release the wrapped client back to the pool\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.PooledRedisClientManager.DisposablePooledClient`1.Client\">\r\n            <summary>\r\n            access the wrapped client\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisClientFactory\">\r\n            <summary>\r\n            Provide the default factory implementation for creating a RedisClient that \r\n            can be mocked and used by different 'Redis Client Managers' \r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Queue.Implementation.SerializingRedisClientFactory\">\r\n            <summary>\r\n            Factory to create SerializingRedisClient objects\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.RedisClientSortedSet`1\">\r\n            <summary>\r\n            Wrap the common redis set operations under a ICollection[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Generic.RedisClientHash`2\">\r\n            <summary>\r\n            Wrap the common redis set operations under a ICollection[string] interface.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Messaging.RedisMqServer\">\r\n            <summary>\r\n            Creates a Redis MQ Server that processes each message on its own background thread.\r\n            i.e. if you register 3 handlers it will create 7 background threads:\r\n              - 1 listening to the Redis MQ Subscription, getting notified of each new message\r\n              - 3x1 Normal InQ for each message handler\r\n              - 3x1 PriorityQ for each message handler\r\n            \r\n            When RedisMqServer Starts it creates a background thread subscribed to the Redis MQ Topic that\r\n            listens for new incoming messages. It also starts 2 background threads for each message type:\r\n             - 1 for processing the services Priority Queue and 1 processing the services normal Inbox Queue.\r\n            \r\n            Priority Queue's can be enabled on a message-per-message basis by specifying types in the \r\n            OnlyEnablePriortyQueuesForTypes property. The DisableAllPriorityQueues property disables all Queues.\r\n            \r\n            The Start/Stop methods are idempotent i.e. It's safe to call them repeatedly on multiple threads \r\n            and the Redis MQ Server will only have Started or Stopped once.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Messaging.RedisMqServer.RequestFilter\">\r\n            <summary>\r\n            Execute global transformation or custom logic before a request is processed.\r\n            Must be thread-safe.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Messaging.RedisMqServer.ResponseFilter\">\r\n            <summary>\r\n            Execute global transformation or custom logic on the response.\r\n            Must be thread-safe.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Messaging.RedisMqServer.ErrorHandler\">\r\n            <summary>\r\n            Execute global error handler logic. Must be thread-safe.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Messaging.RedisMqServer.OnlyEnablePriortyQueuesForTypes\">\r\n            <summary>\r\n            If you only want to enable priority queue handlers (and threads) for specific msg types\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Messaging.RedisMqServer.DisableAllPriorityQueues\">\r\n            <summary>\r\n            Don't listen on any Priority Queues\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.BasicRedisClientManager\">\r\n            <summary>\r\n            BasicRedisClientManager for ICacheClient\r\n            \r\n            For more interoperabilty I'm also implementing the ICacheClient on\r\n            this cache client manager which has the affect of calling \r\n            GetCacheClient() for all write operations and GetReadOnlyCacheClient() \r\n            for the read ones.\r\n            \r\n            This works well for master-slave replication scenarios where you have \r\n            1 master that replicates to multiple read slaves.\r\n            </summary>\r\n            <summary>\r\n            Provides thread-safe retrievel of redis clients since each client is a new one.\r\n            Allows the configuration of different ReadWrite and ReadOnly hosts\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.BasicRedisClientManager.#ctor(System.Collections.Generic.IEnumerable{System.String},System.Collections.Generic.IEnumerable{System.String})\">\r\n            <summary>\r\n            Hosts can be an IP Address or Hostname in the format: host[:port]\r\n            e.g. 127.0.0.1:6379\r\n            default is: localhost:6379\r\n            </summary>\r\n            <param name=\"readWriteHosts\">The write hosts.</param>\r\n            <param name=\"readOnlyHosts\">The read hosts.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.BasicRedisClientManager.GetClient\">\r\n            <summary>\r\n            Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.BasicRedisClientManager.GetReadOnlyClient\">\r\n            <summary>\r\n            Returns a ReadOnly client using the hosts defined in ReadOnlyHosts.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.BasicRedisClientManager.NamespacePrefix\">\r\n            <summary>\r\n            Gets or sets object key prefix.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Locking.ReadLock\">\r\n            <summary>\r\n            This class manages a read lock for a local readers/writer lock, \r\n            using the Resource Acquisition Is Initialization pattern\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.ReadLock.#ctor(System.Threading.ReaderWriterLockSlim)\">\r\n            <summary>\r\n            RAII initialization \r\n            </summary>\r\n            <param name=\"lockObject\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Locking.ReadLock.Dispose\">\r\n            <summary>\r\n            RAII disposal\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Pipeline.QueuedRedisCommand\">\r\n            <summary>\r\n            A complete redis command, with method to send command, receive response, and run callback on success or failure\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialData`1.PopAndUnlock\">\r\n            <summary>\r\n            pop numProcessed items from queue and unlock queue for work item id that dequeued\r\n            items are associated with\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialData`1.DoneProcessedWorkItem\">\r\n            <summary>\r\n            A dequeued work item has been processed. When all of the dequeued items have been processed,\r\n            all items will be popped from the queue,and the queue unlocked for the work item id that\r\n            the dequeued items are associated with\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.ISequentialData`1.UpdateNextUnprocessed(`0)\">\r\n            <summary>\r\n            Update first unprocessed item with new work item.\r\n            </summary>\r\n            <param name=\"newWorkItem\"></param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Support.Queue.ISequentialData`1.DequeueItems\">\r\n            <summary>\r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.SequentialData`1.PopAndUnlock\">\r\n            <summary>\r\n            pop remaining items that were returned by dequeue, and unlock queue\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.SequentialData`1.DoneProcessedWorkItem\">\r\n            <summary>\r\n            indicate that an item has been processed by the caller\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.SequentialData`1.UpdateNextUnprocessed(`0)\">\r\n            <summary>\r\n            Update first unprocessed work item\r\n            </summary>\r\n            <param name=\"newWorkItem\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.ShardedConnectionPool\">\r\n            <summary>\r\n            Provides a redis connection pool that can be sharded\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Redis.ShardedConnectionPool.name\">\r\n            <summary>\r\n            logical name\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Redis.ShardedConnectionPool.weight\">\r\n            <summary>\r\n            An arbitrary weight relative to other nodes\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.ShardedConnectionPool.#ctor(System.String,System.Int32,System.String[])\">\r\n            <param name=\"name\">logical name</param>\r\n            <param name=\"weight\">An arbitrary weight relative to other nodes</param>\r\n            <param name=\"readWriteHosts\">redis nodes</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.ShardedRedisClientManager\">\r\n            <summary>\r\n            Provides sharding of redis client connections.\r\n            uses consistent hashing to distribute keys across connection pools\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.ShardedRedisClientManager.GetConnectionPool(System.String)\">\r\n            <summary>\r\n            maps a key to a redis connection pool\r\n            </summary>\r\n            <param name=\"key\">key to map</param>\r\n            <returns>a redis connection pool</returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Support.Queue.Implementation.RedisSimpleWorkQueue`1\">\r\n            <summary>\r\n            simple distributed work item queue \r\n            \r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSimpleWorkQueue`1.Enqueue(`0)\">\r\n            <summary>\r\n            Queue incoming messages\r\n            </summary>\r\n            <param name=\"msg\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Redis.Support.Queue.Implementation.RedisSimpleWorkQueue`1.Dequeue(System.Int32)\">\r\n            <summary>\r\n            Dequeue next batch of work items for processing. After this method is called,\r\n            no other work items with same id will be available for\r\n            dequeuing until PostDequeue is called\r\n            </summary>\r\n            <returns>KeyValuePair: key is work item id, and value is list of dequeued items.\r\n            </returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.BufferPool\">\r\n            <summary>\r\n            Courtesy of @marcgravell\r\n            http://code.google.com/p/protobuf-net/source/browse/trunk/protobuf-net/BufferPool.cs\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.RedisCacheClientFactory\">\r\n            <summary>\r\n            Provide the factory implementation for creating a RedisCacheClient that \r\n            can be mocked and used by different 'Redis Client Managers' \r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Redis.Messaging.RedisMqHost\">\r\n            <summary>\r\n            Creates an MQ Host that processes all messages on a single background thread. \r\n            i.e. If you register 3 handlers it will only create 1 background thread.\r\n            \r\n            The same background thread that listens to the Redis MQ Subscription for new messages \r\n            also cycles through each registered handler processing all pending messages one-at-a-time:\r\n            first in the message PriorityQ, then in the normal message InQ.\r\n            \r\n            The Start/Stop methods are idempotent i.e. It's safe to call them repeatedly on multiple threads \r\n            and the Redis MQ Host will only have Started/Stopped once.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Redis.Messaging.RedisMqHost.ReplyClientFactory\">\r\n            <summary>\r\n            Inject your own Reply Client Factory to handle custom Message.ReplyTo urls.\r\n            </summary>\r\n        </member>\r\n    </members>\r\n</doc>\r\n"
  },
  {
    "path": "Tools/Toboggan/ServiceStack.Text.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<doc>\r\n    <assembly>\r\n        <name>ServiceStack.Text</name>\r\n    </assembly>\r\n    <members>\r\n        <member name=\"M:ServiceStack.Text.ITypeSerializer`1.CanCreateFromString(System.Type)\">\r\n            <summary>\r\n            Determines whether this serializer can create the specified type from a string.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns>\r\n            \t<c>true</c> if this instance [can create from string] the specified type; otherwise, <c>false</c>.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.ITypeSerializer`1.DeserializeFromString(System.String)\">\r\n            <summary>\r\n            Parses the specified value.\r\n            </summary>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.ITypeSerializer`1.DeserializeFromReader(System.IO.TextReader)\">\r\n            <summary>\r\n            Deserializes from reader.\r\n            </summary>\r\n            <param name=\"reader\">The reader.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.ITypeSerializer`1.SerializeToString(`0)\">\r\n            <summary>\r\n            Serializes to string.\r\n            </summary>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.ITypeSerializer`1.SerializeToWriter(`0,System.IO.TextWriter)\">\r\n            <summary>\r\n            Serializes to writer.\r\n            </summary>\r\n            <param name=\"value\">The value.</param>\r\n            <param name=\"writer\">The writer.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.JsonSerializer`1.DeserializeFromString(System.String)\">\r\n            <summary>\r\n            Parses the specified value.\r\n            </summary>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.Support.DoubleConverter\">\r\n            <summary>\r\n            A class to allow the conversion of doubles to string representations of\r\n            their exact decimal values. The implementation aims for readability over\r\n            efficiency.\r\n            \r\n            Courtesy of @JonSkeet\r\n            http://www.yoda.arachsys.com/csharp/DoubleConverter.cs\r\n            </summary>\r\n        </member>\r\n        <!-- Badly formed XML comment ignored for member \"M:ServiceStack.Text.Support.DoubleConverter.ToExactString(System.Double)\" -->\r\n        <!-- Badly formed XML comment ignored for member \"T:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal\" -->\r\n        <!-- Badly formed XML comment ignored for member \"F:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.digits\" -->\r\n        <member name=\"F:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.decimalPoint\">\r\n            <summary> \r\n            How many digits are *after* the decimal point\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.#ctor(System.Int64)\">\r\n            <summary> \r\n            Constructs an arbitrary decimal expansion from the given long.\r\n            The long must not be negative.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.MultiplyBy(System.Int32)\">\r\n            <summary>\r\n            Multiplies the current expansion by the given amount, which should\r\n            only be 2 or 5.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.Shift(System.Int32)\">\r\n            <summary>\r\n            Shifts the decimal point; a negative value makes\r\n            the decimal expansion bigger (as fewer digits come after the\r\n            decimal place) and a positive value makes the decimal\r\n            expansion smaller.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.Normalize\">\r\n            <summary>\r\n            Removes leading/trailing zeroes from the expansion.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Support.DoubleConverter.ArbitraryDecimal.ToString\">\r\n            <summary>\r\n            Converts the value to a proper decimal string representation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.Json.JsonWriter`1\">\r\n            <summary>\r\n            Implement the serializer using a more static approach\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.Marc.Link`2\">\r\n            <summary>\r\n            Pretty Thread-Safe cache class from:\r\n            http://code.google.com/p/dapper-dot-net/source/browse/Dapper/SqlMapper.cs\r\n            \r\n            This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example),\r\n            and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE**\r\n            equality. The type is fully thread-safe.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.DateTimeExtensions\">\r\n            <summary>\r\n            A fast, standards-based, serialization-issue free DateTime serailizer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.JsonSerializer\">\r\n            <summary>\r\n            Creates an instance of a Type from a string value\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Common.JsWriter.HasAnyEscapeChars(System.String)\">\r\n            <summary>\r\n            micro optimizations: using flags instead of value.IndexOfAny(EscapeChars)\r\n            </summary>\r\n            <param name=\"value\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Common.DeserializeTypeUtils.GetTypeStringConstructor(System.Type)\">\r\n            <summary>\r\n            Get the type(string) constructor if exists\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.QueryStringWriter`1\">\r\n            <summary>\r\n            Implement the serializer using a more static approach\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.FastMember.ObjectAccessor\">\r\n            <summary>\r\n            Represents an individual object, allowing access to members by-name\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.FastMember.ObjectAccessor.Equals(System.Object)\">\r\n            <summary>\r\n            Use the target types definition of equality\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.FastMember.ObjectAccessor.GetHashCode\">\r\n            <summary>\r\n            Obtain the hash of the target object\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.FastMember.ObjectAccessor.ToString\">\r\n            <summary>\r\n            Use the target's definition of a string representation\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.FastMember.ObjectAccessor.Create(System.Object)\">\r\n            <summary>\r\n            Wraps an individual object, allowing by-name access to that instance\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.FastMember.ObjectAccessor.Item(System.String)\">\r\n            <summary>\r\n            Get or Set the value of a named member for the underlying object\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.FastMember.ObjectAccessor.Target\">\r\n            <summary>\r\n            The object represented by this instance\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig.tsEmitCamelCaseNames\">\r\n            <summary>\r\n            <see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Text.Common.ITypeSerializer\"/> is configured\r\n            to take advantage of <see cref=\"T:System.CLSCompliantAttribute\"/> specification,\r\n            to support user-friendly serialized formats, ie emitting camelCasing for JSON\r\n            and parsing member names and enum values in a case-insensitive manner.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig.tsEmitLowercaseUnderscoreNames\">\r\n            <summary>\r\n            <see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Text.Common.ITypeSerializer\"/> is configured\r\n            to support web-friendly serialized formats, ie emitting lowercase_underscore_casing for JSON\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig.propertyConvention\">\r\n            <summary>\r\n            Define how property names are mapped during deserialization\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig.tsThrowOnDeserializationError\">\r\n            <summary>\r\n            Gets or sets a value indicating if the framework should throw serialization exceptions\r\n            or continue regardless of deserialization errors. If <see langword=\"true\"/>  the framework\r\n            will throw; otherwise, it will parse as many fields as possible. The default is <see langword=\"false\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.JsConfig.TimeSpanHandler\">\r\n            <summary>\r\n            Sets which format to use when serializing TimeSpans\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.JsConfig.PreferInterfaces\">\r\n            <summary>\r\n            If set to true, Interface types will be prefered over concrete types when serializing.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.JsConfig.ModelFactory\">\r\n            <summary>\r\n            Set this to enable your own type construction provider.\r\n            This is helpful for integration with IoC containers where you need to call the container constructor.\r\n            Return null if you don't know how to construct the type and the parameterless constructor will be used.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.IncludeTypeInfo\">\r\n            <summary>\r\n            Always emit type info for this type.  Takes precedence over ExcludeTypeInfo\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.ExcludeTypeInfo\">\r\n            <summary>\r\n            Never emit type info for this type\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.EmitCamelCaseNames\">\r\n            <summary>\r\n            <see langword=\"true\"/> if the <see cref=\"T:ServiceStack.Text.Common.ITypeSerializer\"/> is configured\r\n            to take advantage of <see cref=\"T:System.CLSCompliantAttribute\"/> specification,\r\n            to support user-friendly serialized formats, ie emitting camelCasing for JSON\r\n            and parsing member names and enum values in a case-insensitive manner.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.serializeFn\">\r\n            <summary>\r\n            Define custom serialization fn for BCL Structs\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.rawSerializeFn\">\r\n            <summary>\r\n            Define custom raw serialization fn\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.onSerializingFn\">\r\n            <summary>\r\n            Define custom serialization hook\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.DeSerializeFn\">\r\n            <summary>\r\n            Define custom deserialization fn for BCL Structs\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.RawDeserializeFn\">\r\n            <summary>\r\n            Define custom raw deserialization fn for objects\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsConfig`1.ExcludePropertyNames\">\r\n            <summary>\r\n            Exclude specific properties of this type from being serialized\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.JsConfig`1.TreatValueAsRefTypes\">\r\n            <summary>\r\n            Opt-in flag to set some Value Types to be treated as a Ref Type\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.JsConfig`1.HasSerializeFn\">\r\n            <summary>\r\n            Whether there is a fn (raw or otherwise)\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsonPropertyConvention.ExactMatch\">\r\n            <summary>\r\n            The property names on target types must match property names in the JSON source\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsonPropertyConvention.Lenient\">\r\n            <summary>\r\n            The property names on target types may not match the property names in the JSON source\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsonTimeSpanHandler.DurationFormat\">\r\n            <summary>\r\n            Uses the xsd format like PT15H10M20S\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.Text.JsonTimeSpanHandler.StandardFormat\">\r\n            <summary>\r\n            Uses the standard .net ToString method of the TimeSpan class\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.TypeSerializer\">\r\n            <summary>\r\n            Creates an instance of a Type from a string value\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.CanCreateFromString(System.Type)\">\r\n            <summary>\r\n            Determines whether the specified type is convertible from string.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns>\r\n            \t<c>true</c> if the specified type is convertible from string; otherwise, <c>false</c>.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.DeserializeFromString``1(System.String)\">\r\n            <summary>\r\n            Parses the specified value.\r\n            </summary>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.DeserializeFromString(System.String,System.Type)\">\r\n            <summary>\r\n            Parses the specified type.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.ToStringDictionary``1(``0)\">\r\n            <summary>\r\n            Useful extension method to get the Dictionary[string,string] representation of any POCO type.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.Dump``1(``0)\">\r\n            <summary>\r\n            Recursively prints the contents of any POCO object in a human-friendly, readable format\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.PrintDump``1(``0)\">\r\n            <summary>\r\n            Print Dump to Console.WriteLine\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer.Print(System.String,System.Object[])\">\r\n            <summary>\r\n            Print string.Format to Console.WriteLine\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.WP.HashSet`1\">\r\n            <summary>\r\n             A hashset implementation that uses an IDictionary\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Json.JsonTypeSerializer.WriteRawString(System.IO.TextWriter,System.String)\">\r\n            <summary>\r\n            Shortcut escape when we're sure value doesn't contain any escaped chars\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n            <param name=\"value\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Json.JsonTypeSerializer.ConvertFromUtf32(System.Int32)\">\r\n            <summary>\r\n            Since Silverlight doesn't have char.ConvertFromUtf32() so putting Mono's implemenation inline.\r\n            </summary>\r\n            <param name=\"utf32\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.JsonExtensions.Get``1(System.Collections.Generic.Dictionary{System.String,System.String},System.String)\">\r\n            <summary>\r\n            Get JSON string value converted to T\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.JsonExtensions.Get(System.Collections.Generic.Dictionary{System.String,System.String},System.String)\">\r\n            <summary>\r\n            Get JSON string value\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.JsonObject.GetUnescaped(System.String)\">\r\n            <summary>\r\n            Get unescaped string value\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.JsonObject.Child(System.String)\">\r\n            <summary>\r\n            Get unescaped string value\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.JsonObject.WriteValue(System.IO.TextWriter,System.Object)\">\r\n            <summary>\r\n            Write JSON Array, Object, bool or number values as raw string\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.JsonObject.Item(System.String)\">\r\n            <summary>\r\n            Get JSON string value\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.Controller.PathInfo\">\r\n            <summary>\r\n            Class to hold  \r\n            </summary>\r\n        </member>\r\n        <!-- Badly formed XML comment ignored for member \"M:ServiceStack.Text.Controller.PathInfo.Parse(System.String)\" -->\r\n        <member name=\"F:ServiceStack.Text.StreamExtensions.DefaultBufferSize\">\r\n            <summary>\r\n            @jonskeet: Collection of utility methods which operate on streams.\r\n            r285, February 26th 2009: http://www.yoda.arachsys.com/csharp/miscutil/\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadFully(System.IO.Stream)\">\r\n            <summary>\r\n            Reads the given stream up to the end, returning the data as a byte\r\n            array.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadFully(System.IO.Stream,System.Int32)\">\r\n            <summary>\r\n            Reads the given stream up to the end, returning the data as a byte\r\n            array, using the given buffer size.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadFully(System.IO.Stream,System.Byte[])\">\r\n            <summary>\r\n            Reads the given stream up to the end, returning the data as a byte\r\n            array, using the given buffer for transferring data. Note that the\r\n            current contents of the buffer is ignored, so the buffer needn't\r\n            be cleared beforehand.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.CopyTo(System.IO.Stream,System.IO.Stream)\">\r\n            <summary>\r\n            Copies all the data from one stream into another.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.CopyTo(System.IO.Stream,System.IO.Stream,System.Int32)\">\r\n            <summary>\r\n            Copies all the data from one stream into another, using a buffer\r\n            of the given size.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.CopyTo(System.IO.Stream,System.IO.Stream,System.Byte[])\">\r\n            <summary>\r\n            Copies all the data from one stream into another, using the given \r\n            buffer for transferring data. Note that the current contents of \r\n            the buffer is ignored, so the buffer needn't be cleared beforehand.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadExactly(System.IO.Stream,System.Int32)\">\r\n            <summary>\r\n            Reads exactly the given number of bytes from the specified stream.\r\n            If the end of the stream is reached before the specified amount\r\n            of data is read, an exception is thrown.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadExactly(System.IO.Stream,System.Byte[])\">\r\n            <summary>\r\n            Reads into a buffer, filling it completely.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadExactly(System.IO.Stream,System.Byte[],System.Int32)\">\r\n            <summary>\r\n            Reads exactly the given number of bytes from the specified stream,\r\n            into the given buffer, starting at position 0 of the array.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadExactly(System.IO.Stream,System.Byte[],System.Int32,System.Int32)\">\r\n            <summary>\r\n            Reads exactly the given number of bytes from the specified stream,\r\n            into the given buffer, starting at position 0 of the array.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StreamExtensions.ReadExactlyFast(System.IO.Stream,System.Byte[],System.Int32,System.Int32)\">\r\n            <summary>\r\n            Same as ReadExactly, but without the argument checks.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.AssemblyUtils\">\r\n            <summary>\r\n            Utils to load types\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.AssemblyUtils.FindType(System.String)\">\r\n            <summary>\r\n            Find the type from the name supplied\r\n            </summary>\r\n            <param name=\"typeName\">[typeName] or [typeName, assemblyName]</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.AssemblyUtils.MainInterface``1\">\r\n            <summary>\r\n            The top-most interface of the given type, if any.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.AssemblyUtils.FindType(System.String,System.String)\">\r\n            <summary>\r\n            Find type if it exists\r\n            </summary>\r\n            <param name=\"typeName\"></param>\r\n            <param name=\"assemblyName\"></param>\r\n            <returns>The type if it exists</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StringExtensions.BaseConvert(System.String,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Converts from base: 0 - 62\r\n            </summary>\r\n            <param name=\"source\">The source.</param>\r\n            <param name=\"from\">From.</param>\r\n            <param name=\"to\">To.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.StringExtensions.FastToUtf8Bytes(System.String)\">\r\n            <summary>\r\n            Skip the encoding process for 'safe strings' \r\n            </summary>\r\n            <param name=\"strVal\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.FastMember.TypeAccessor\">\r\n            <summary>\r\n            Provides by-name member-access to objects of a given type\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.FastMember.TypeAccessor.CreateNew\">\r\n            <summary>\r\n            Create a new instance of this type\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.FastMember.TypeAccessor.Create(System.Type)\">\r\n            <summary>\r\n            Provides a type-specific accessor, allowing by-name access for all objects of that type\r\n            </summary>\r\n            <remarks>The accessor is cached internally; a pre-existing accessor may be returned</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.FastMember.TypeAccessor.CreateNewSupported\">\r\n            <summary>\r\n            Does this type support new instances via a parameterless constructor?\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Text.FastMember.TypeAccessor.Item(System.Object,System.String)\">\r\n            <summary>\r\n            Get or set the value of a named member on the target instance\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Text.Jsv.JsvWriter`1\">\r\n            <summary>\r\n            Implement the serializer using a more static approach\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Json.JsonUtils.HasAnyEscapeChars(System.String)\">\r\n            <summary>\r\n            micro optimizations: using flags instead of value.IndexOfAny(EscapeChars)\r\n            </summary>\r\n            <param name=\"value\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.TypeSerializer`1.DeserializeFromString(System.String)\">\r\n            <summary>\r\n            Parses the specified value.\r\n            </summary>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Common.DateTimeSerializer.ParseWcfJsonDateOffset(System.String)\">\r\n            <summary>\r\n            WCF Json format: /Date(unixts+0000)/\r\n            </summary>\r\n            <param name=\"wcfJsonDate\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Text.Common.DateTimeSerializer.ParseWcfJsonDate(System.String)\">\r\n            <summary>\r\n            WCF Json format: /Date(unixts+0000)/\r\n            </summary>\r\n            <param name=\"wcfJsonDate\"></param>\r\n            <returns></returns>\r\n        </member>\r\n    </members>\r\n</doc>\r\n"
  },
  {
    "path": "Tools/Toboggan/ServiceStack.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<doc>\r\n    <assembly>\r\n        <name>ServiceStack</name>\r\n    </assembly>\r\n    <members>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.RestHandler.CreateRequest(ServiceStack.ServiceHost.IHttpRequest,System.String)\">\r\n            <summary>\r\n            Used in Unit tests\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Markdown.MarkdownViewBase.GetHtmlHelper\">\r\n            <summary>\r\n            Ensure the same instance is used for subclasses\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Markdown.MarkdownViewBase.InitHelpers\">\r\n            <summary>\r\n            Called before page is executed\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Markdown.MarkdownViewBase.OnLoad\">\r\n            <summary>\r\n            Called after page is executed but before it's merged with the \r\n            website template if any.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Markdown.MarkdownViewBase.Raw(System.String)\">\r\n            <summary>\r\n            Don't HTML encode safe output\r\n            </summary>\r\n            <param name=\"content\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Markdown.MarkdownViewBase.Partial(System.String,System.Object)\">\r\n            <summary>\r\n            Return the output of a different view with the specified name \r\n            using the supplied model\r\n            </summary>\r\n            <param name=\"viewName\"></param>\r\n            <param name=\"model\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Markdown.MarkdownViewBase.Get``1\">\r\n            <summary>\r\n            Resolve registered Assemblies\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.ViewEngine\">\r\n            <summary>\r\n            Reference to MarkdownViewEngine\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.AppHost\">\r\n            <summary>\r\n            The AppHost so you can access configuration and resolve dependencies, etc.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.MarkdownPage\">\r\n            <summary>\r\n            This precompiled Markdown page with Metadata\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.Html\">\r\n            <summary>\r\n            ASP.NET MVC's HtmlHelper\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.ScopeArgs\">\r\n            <summary>\r\n            All variables passed to and created by your page. \r\n            The Response DTO is stored and accessible via the 'Model' variable.\r\n             \r\n            All variables and outputs created are stored in ScopeArgs which is what's available\r\n            to your website template. The Generated page is stored in the 'Body' variable.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.RenderHtml\">\r\n            <summary>\r\n            Whether HTML or Markdown output is requested\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Markdown.MarkdownViewBase.Model\">\r\n            <summary>\r\n            The Response DTO\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory.ReturnRequestInfo(System.Web.HttpRequest)\">\r\n            <summary>\r\n            If enabled, just returns the Request Info as it understands\r\n            </summary>\r\n            <param name=\"context\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RestPath.IsMatch(System.String,System.String[])\">\r\n            <summary>\r\n            For performance withPathInfoParts should already be a lower case string\r\n            to minimize redundant matching operations.\r\n            </summary>\r\n            <param name=\"httpMethod\"></param>\r\n            <param name=\"withPathInfoParts\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RestPath.PathComponentsCount\">\r\n            <summary>\r\n            The number of segments separated by '/' determinable by path.Split('/').Length\r\n            e.g. /path/to/here.ext == 3\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RestPath.TotalComponentsCount\">\r\n            <summary>\r\n            The total number of segments after subparts have been exploded ('.') \r\n            e.g. /path/to/here.ext == 4\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.ServiceHost.RestPath.FirstMatchHashKey\">\r\n            <summary>\r\n            Provide for quick lookups based on hashes that can be determined from a request url\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.CacheClientExtensions.RemoveByPattern(ServiceStack.CacheAccess.ICacheClient,System.String)\">\r\n            <summary>\r\n            Removes items from cache that have keys matching the specified wildcard pattern\r\n            </summary>\r\n            <param name=\"cacheClient\">Cache client</param>\r\n            <param name=\"pattern\">The wildcard, where \"*\" means any sequence of characters and \"?\" means any single character.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.CacheClientExtensions.RemoveByRegex(ServiceStack.CacheAccess.ICacheClient,System.String)\">\r\n            <summary>\r\n            Removes items from the cache based on the specified regular expression pattern\r\n            </summary>\r\n            <param name=\"cacheClient\">Cache client</param>\r\n            <param name=\"regex\">Regular expression pattern to search cache keys</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.EndpointHost.ApplyPreRequestFilters(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse)\">\r\n            <summary>\r\n            Applies the raw request filters. Returns whether or not the request has been handled \r\n            and no more processing should be done.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.EndpointHost.ApplyRequestFilters(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.Object)\">\r\n            <summary>\r\n            Applies the request filters. Returns whether or not the request has been handled \r\n            and no more processing should be done.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.EndpointHost.ApplyResponseFilters(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.Object)\">\r\n            <summary>\r\n            Applies the response filters. Returns whether or not the request has been handled \r\n            and no more processing should be done.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.EndpointHost.CompleteRequest\">\r\n            <summary>\r\n            Call to signal the completion of a ServiceStack-handled Request\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.EndpointHost.Container\">\r\n            <summary>\r\n            The AppHost.Container. Note: it is not thread safe to register dependencies after AppStart.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.AppHostHttpListenerBase\">\r\n            <summary>\r\n            Inherit from this class if you want to host your web services inside a \r\n            Console Application, Windows Service, etc.\r\n            \r\n            Usage of HttpListener allows you to host webservices on the same port (:80) as IIS \r\n            however it requires admin user privillages.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.Support.HttpListenerBase\">\r\n            <summary>\r\n            Wrapper class for the HTTPListener to allow easier access to the\r\n            server, for start and stop management and event routing of the actual\r\n            inbound requests.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.IAppHost\">\r\n            <summary>\r\n            ASP.NET or HttpListener ServiceStack host\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.Register``1(``0)\">\r\n            <summary>\r\n            Register dependency in AppHost IOC on Startup\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"instance\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.RegisterAs``2\">\r\n            <summary>\r\n            AutoWired Registration of an interface with a concrete type in AppHost IOC on Startup.\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <typeparam name=\"TAs\"></typeparam>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.Release(System.Object)\">\r\n            <summary>\r\n            Allows the clean up for executed autowired services and filters.\r\n            Calls directly after services and filters are executed.\r\n            </summary>\r\n            <param name=\"instance\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.OnEndRequest\">\r\n            <summary>\r\n            Called at the end of each request. Enables Request Scope.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.RegisterService(System.Type,System.String[])\">\r\n            <summary>\r\n            Register an Adhoc web service on Startup\r\n            </summary>\r\n            <param name=\"serviceType\"></param>\r\n            <param name=\"atRestPaths\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.LoadPlugin(ServiceStack.WebHost.Endpoints.IPlugin[])\">\r\n            <summary>\r\n            Apply plugins to this AppHost\r\n            </summary>\r\n            <param name=\"plugins\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.IAppHost.CreateServiceRunner``1(ServiceStack.WebHost.Endpoints.ActionContext)\">\r\n            <summary>\r\n            Create a service runner for IService actions\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.Routes\">\r\n            <summary>\r\n            Register user-defined custom routes.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.ContentTypeFilters\">\r\n            <summary>\r\n            Register custom ContentType serializers\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.PreRequestFilters\">\r\n            <summary>\r\n            Add Request Filters, to be applied before the dto is deserialized\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.RequestFilters\">\r\n            <summary>\r\n            Add Request Filters\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.ResponseFilters\">\r\n            <summary>\r\n            Add Response Filters\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.ViewEngines\">\r\n            <summary>\r\n            Add alternative HTML View Engines\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.ExceptionHandler\">\r\n            <summary>\r\n            Provide an exception handler for un-caught exceptions\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.ServiceExceptionHandler\">\r\n            <summary>\r\n            Provide an exception handler for unhandled exceptions\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.CatchAllHandlers\">\r\n            <summary>\r\n            Provide a catch-all handler that doesn't match any routes\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.RequestBinders\">\r\n            <summary>\r\n            Provide a custom model minder for a specific Request DTO\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.Config\">\r\n            <summary>\r\n            The AppHost config\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.Plugins\">\r\n            <summary>\r\n            List of pre-registered and user-defined plugins to be enabled in this AppHost\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.IAppHost.VirtualPathProvider\">\r\n            <summary>\r\n            Virtual access to file resources\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.Start(System.String)\">\r\n            <summary>\r\n            Starts the Web Service\r\n            </summary>\r\n            <param name=\"urlBase\">\r\n            A Uri that acts as the base that the server is listening on.\r\n            Format should be: http://127.0.0.1:8080/ or http://127.0.0.1:8080/somevirtual/\r\n            Note: the trailing slash is required! For more info see the\r\n            HttpListener.Prefixes property on MSDN.\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.Stop\">\r\n            <summary>\r\n            Shut down the Web Service\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.ProcessRequest(System.Net.HttpListenerContext)\">\r\n            <summary>\r\n            Overridable method that can be used to implement a custom hnandler\r\n            </summary>\r\n            <param name=\"context\"></param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.Plugins\">\r\n            TODO: plugin added with .Add method after host initialization won't be configured. Each plugin should have state so we can invoke Register method if host was already started.  \r\n        </member>\r\n        <member name=\"T:ServiceStack.Properties.Resources\">\r\n            <summary>\r\n              A strongly-typed resource class, for looking up localized strings, etc.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.ResourceManager\">\r\n            <summary>\r\n              Returns the cached ResourceManager instance used by this class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.Culture\">\r\n            <summary>\r\n              Overrides the current thread's CurrentUICulture property for all\r\n              resource lookups using this strongly typed resource class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.Registration_CantRegisterContainer\">\r\n            <summary>\r\n              Looks up a localized string similar to Container service is built-in and read-only..\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.Registration_IncompatibleAsType\">\r\n            <summary>\r\n              Looks up a localized string similar to Service type {0} does not inherit or implement {1}..\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.ResolutionException_MissingNamedType\">\r\n            <summary>\r\n              Looks up a localized string similar to Required dependency of type {0} named &apos;{1}&apos; could not be resolved..\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.ResolutionException_MissingType\">\r\n            <summary>\r\n              Looks up a localized string similar to Required dependency of type {0} could not be resolved..\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.Properties.Resources.ResolutionException_UnknownScope\">\r\n            <summary>\r\n              Looks up a localized string similar to Unknown scope..\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.UI.MiniProfilerHandler\">\r\n            <summary>\r\n            Understands how to route and respond to MiniProfiler UI urls.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.UI.MiniProfilerHandler.ProcessRequest(System.Web.HttpContext)\">\r\n            <summary>\r\n            Returns either includes' css/javascript or results' html.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.UI.MiniProfilerHandler.Includes(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.String)\">\r\n            <summary>\r\n            Handles rendering static content files.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.UI.MiniProfilerHandler.Results(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse)\">\r\n            <summary>\r\n            Handles rendering a previous MiniProfiler session, identified by its \"?id=GUID\" on the query.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.UI.MiniProfilerHandler._ResourceCache\">\r\n            <summary>\r\n            Embedded resource contents keyed by filename.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.UI.MiniProfilerHandler.NotFound(ServiceStack.ServiceHost.IHttpResponse,System.String,System.String)\">\r\n            <summary>\r\n            Helper method that sets a proper 404 response code.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.UI.MiniProfilerHandler.IsReusable\">\r\n            <summary>\r\n            Try to keep everything static so we can easily be reused.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.IRegistration\">\r\n            <summary>\r\n            Fluent API for customizing the registration of a service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.IFluentInterface\">\r\n            <summary>\r\n            Helper interface used to hide the base <see cref=\"T:System.Object\"/> \r\n            members from the fluent API to make for much cleaner \r\n            Visual Studio intellisense experience.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.IFluentInterface.GetType\">\r\n            <summary/>\r\n        </member>\r\n        <member name=\"M:Funq.IFluentInterface.GetHashCode\">\r\n            <summary/>\r\n        </member>\r\n        <member name=\"M:Funq.IFluentInterface.ToString\">\r\n            <summary/>\r\n        </member>\r\n        <member name=\"M:Funq.IFluentInterface.Equals(System.Object)\">\r\n            <summary/>\r\n        </member>\r\n        <member name=\"T:Funq.IReusedOwned\">\r\n            <summary>\r\n            Fluent API that exposes both <see cref=\"M:Funq.IReused.ReusedWithin(Funq.ReuseScope)\"/>\r\n            and owner (<see cref=\"M:Funq.IOwned.OwnedBy(Funq.Owner)\"/>).\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.IReused\">\r\n            <summary>\r\n            Fluent API that allows specifying the reuse instances.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.IReused.ReusedWithin(Funq.ReuseScope)\">\r\n            <summary>\r\n            Specifies how instances are reused within a container or hierarchy. Default \r\n            scope is <see cref=\"F:Funq.ReuseScope.Hierarchy\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.IOwned\">\r\n            <summary>\r\n            Fluent API that allows specifying the owner of instances \r\n            created from a registration.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.IOwned.OwnedBy(Funq.Owner)\">\r\n            <summary>\r\n            Specifies the owner of instances created from this registration. Default \r\n            owner is <see cref=\"F:Funq.Owner.Container\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.IRegistration`1\">\r\n            <summary>\r\n            Fluent API for customizing the registration of a service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.IInitializable`1\">\r\n            <summary>\r\n            Fluent API that allows registering an initializer for the \r\n            service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.IInitializable`1.InitializedBy(System.Action{Funq.Container,`0})\">\r\n            <summary>\r\n            Specifies an initializer that should be invoked after \r\n            the service instance has been created by the factory.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.ServiceEndpointsMetadataConfig.Create(System.String)\">\r\n            <summary>\r\n            Changes the links for the servicestack/metadata page\r\n            </summary>\r\n            <param name=\"serviceStackHandlerPrefix\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.Support.GzipOptimizationTest\">\r\n            <summary>\r\n            Highly optimized code to find if GZIP is supported from:\r\n             - http://dotnetperls.com/gzip-request\r\n            \r\n            Other resources for GZip, deflate resources:\r\n            - http://www.west-wind.com/Weblog/posts/10564.aspx\r\n            \t- http://www.west-wind.com/WebLog/posts/102969.aspx\r\n            - ICSharpCode \r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.MarkdownOptions.AutoHyperlink\">\r\n            <summary>\r\n            when true, (most) bare plain URLs are auto-hyperlinked  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.MarkdownOptions.AutoNewlines\">\r\n            <summary>\r\n            when true, RETURN becomes a literal newline  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.MarkdownOptions.EmptyElementSuffix\">\r\n            <summary>\r\n            use \">\" for HTML output, or \" />\" for XHTML output\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.MarkdownOptions.EncodeProblemUrlCharacters\">\r\n            <summary>\r\n            when true, problematic URL characters like [, ], (, and so forth will be encoded \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.MarkdownOptions.LinkEmails\">\r\n            <summary>\r\n            when false, email addresses will never be auto-linked  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.MarkdownOptions.StrictBoldItalic\">\r\n            <summary>\r\n            when true, bold and italic require non-word characters on either side  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:MarkdownSharp.Markdown\">\r\n            <summary>\r\n            Markdown is a text-to-HTML conversion tool for web writers. \r\n            Markdown allows you to write using an easy-to-read, easy-to-write plain text format, \r\n            then convert it to structurally valid XHTML (or HTML).\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:MarkdownSharp.Markdown._tabWidth\">\r\n            <summary>\r\n            Tabs are automatically converted to spaces as part of the transform  \r\n            this constant determines how \"wide\" those tabs become in spaces  \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.#ctor\">\r\n            <summary>\r\n            Create a new Markdown instance using default options\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.#ctor(System.Boolean)\">\r\n            <summary>\r\n            Create a new Markdown instance and optionally load options from a configuration\r\n            file. There they should be stored in the appSettings section, available options are:\r\n            \r\n                Markdown.StrictBoldItalic (true/false)\r\n                Markdown.EmptyElementSuffix (\">\" or \" />\" without the quotes)\r\n                Markdown.LinkEmails (true/false)\r\n                Markdown.AutoNewLines (true/false)\r\n                Markdown.AutoHyperlink (true/false)\r\n                Markdown.EncodeProblemUrlCharacters (true/false) \r\n                \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.#ctor(MarkdownSharp.MarkdownOptions)\">\r\n            <summary>\r\n            Create a new Markdown instance and set the options from the MarkdownOptions object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:MarkdownSharp.Markdown._nestDepth\">\r\n            <summary>\r\n            maximum nested depth of [] and () supported by the transform; implementation detail\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.#cctor\">\r\n            <summary>\r\n            In the static constuctor we'll initialize what stays the same across all transforms.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.Transform(System.String)\">\r\n            <summary>\r\n            Transforms the provided Markdown-formatted text to HTML;  \r\n            see http://en.wikipedia.org/wiki/Markdown\r\n            </summary>\r\n            <remarks>\r\n            The order in which other subs are called here is\r\n            essential. Link and image substitutions need to happen before\r\n            EscapeSpecialChars(), so that any *'s or _'s in the a\r\n            and img tags get encoded.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.RunBlockGamut(System.String,System.Boolean)\">\r\n            <summary>\r\n            Perform transformations that form block-level tags like paragraphs, headers, and list items.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.RunSpanGamut(System.String)\">\r\n            <summary>\r\n            Perform transformations that occur *within* block-level tags like paragraphs, headers, and list items.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.FormParagraphs(System.String,System.Boolean)\">\r\n            <summary>\r\n            splits on two or more newlines, to form \"paragraphs\";    \r\n            each paragraph is then unhashed (if it is a hash and unhashing isn't turned off) or wrapped in HTML p tag\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.GetNestedBracketsPattern\">\r\n            <summary>\r\n            Reusable pattern to match balanced [brackets]. See Friedl's \r\n            \"Mastering Regular Expressions\", 2nd Ed., pp. 328-331.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.GetNestedParensPattern\">\r\n            <summary>\r\n            Reusable pattern to match balanced (parens). See Friedl's \r\n            \"Mastering Regular Expressions\", 2nd Ed., pp. 328-331.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.StripLinkDefinitions(System.String)\">\r\n            <summary>\r\n            Strips link definitions from text, stores the URLs and titles in hash references.\r\n            </summary>\r\n            <remarks>\r\n            ^[id]: url \"optional title\"\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.GetBlockPattern\">\r\n            <summary>\r\n            derived pretty much verbatim from PHP Markdown\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.HashHTMLBlocks(System.String)\">\r\n            <summary>\r\n            replaces any block-level HTML blocks with hash entries\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.TokenizeHTML(System.String)\">\r\n            <summary>\r\n            returns an array of HTML tokens comprising the input string. Each token is \r\n            either a tag (possibly with nested, tags contained therein, such \r\n            as &lt;a href=\"&lt;MTFoo&gt;\"&gt;, or a run of text between tags. Each element of the \r\n            array is a two-element array; the first is either 'tag' or 'text'; the second is \r\n            the actual value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoAnchors(System.String)\">\r\n            <summary>\r\n            Turn Markdown link shortcuts into HTML anchor tags\r\n            </summary>\r\n            <remarks>\r\n            [link text](url \"title\") \r\n            [link text][id] \r\n            [id] \r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoImages(System.String)\">\r\n            <summary>\r\n            Turn Markdown image shortcuts into HTML img tags. \r\n            </summary>\r\n            <remarks>\r\n            ![alt text][id]\r\n            ![alt text](url \"optional title\")\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoHeaders(System.String)\">\r\n            <summary>\r\n            Turn Markdown headers into HTML header tags\r\n            </summary>\r\n            <remarks>\r\n            Header 1  \r\n            ========  \r\n            \r\n            Header 2  \r\n            --------  \r\n            \r\n            # Header 1  \r\n            ## Header 2  \r\n            ## Header 2 with closing hashes ##  \r\n            ...  \r\n            ###### Header 6  \r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoHorizontalRules(System.String)\">\r\n            <summary>\r\n            Turn Markdown horizontal rules into HTML hr tags\r\n            </summary>\r\n            <remarks>\r\n            ***  \r\n            * * *  \r\n            ---\r\n            - - -\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoLists(System.String)\">\r\n            <summary>\r\n            Turn Markdown lists into HTML ul and ol and li tags\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.ProcessListItems(System.String,System.String)\">\r\n            <summary>\r\n            Process the contents of a single ordered or unordered list, splitting it\r\n            into individual list items.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoCodeBlocks(System.String)\">\r\n            <summary>\r\n            /// Turn Markdown 4-space indented code into HTML pre code blocks\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoCodeSpans(System.String)\">\r\n            <summary>\r\n            Turn Markdown `code spans` into HTML code tags\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoItalicsAndBold(System.String)\">\r\n            <summary>\r\n            Turn Markdown *italics* and **bold** into HTML strong and em tags\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoHardBreaks(System.String)\">\r\n            <summary>\r\n            Turn markdown line breaks (two space at end of line) into HTML break tags\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoBlockQuotes(System.String)\">\r\n            <summary>\r\n            Turn Markdown > quoted blocks into HTML blockquote blocks\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.DoAutoLinks(System.String)\">\r\n            <summary>\r\n            Turn angle-delimited URLs into HTML anchor tags\r\n            </summary>\r\n            <remarks>\r\n            &lt;http://www.example.com&gt;\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.Outdent(System.String)\">\r\n            <summary>\r\n            Remove one level of line-leading spaces\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EncodeEmailAddress(System.String)\">\r\n            <summary>\r\n            encodes email address randomly  \r\n            roughly 10% raw, 45% hex, 45% dec \r\n            note that @ is always encoded and : never is\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EncodeCode(System.String)\">\r\n            <summary>\r\n            Encode/escape certain Markdown characters inside code blocks and spans where they are literals\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EncodeAmpsAndAngles(System.String)\">\r\n            <summary>\r\n            Encode any ampersands (that aren't part of an HTML entity) and left or right angle brackets\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EscapeBackslashes(System.String)\">\r\n            <summary>\r\n            Encodes any escaped characters such as \\`, \\*, \\[ etc\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.Unescape(System.String)\">\r\n            <summary>\r\n            swap back in all the special characters we've hidden\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EscapeBoldItalic(System.String)\">\r\n            <summary>\r\n            escapes Bold [ * ] and Italic [ _ ] characters\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EncodeProblemUrlChars(System.String)\">\r\n            <summary>\r\n            hex-encodes some unusual \"problem\" chars in URLs to avoid URL detection problems \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.EscapeSpecialCharsWithinTagAttributes(System.String)\">\r\n            <summary>\r\n            Within tags -- meaning between &lt; and &gt; -- encode [\\ ` * _] so they \r\n            don't conflict with their use in Markdown for code, italics and strong. \r\n            We're replacing each such character with its corresponding hash \r\n            value; this is likely overkill, but it should prevent us from colliding \r\n            with the escape values by accident.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.Normalize(System.String)\">\r\n            <summary>\r\n            convert all tabs to _tabWidth spaces; \r\n            standardizes line endings from DOS (CR LF) or Mac (CR) to UNIX (LF); \r\n            makes sure text ends with a couple of newlines; \r\n            removes any blank lines (only spaces) in the text\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:MarkdownSharp.Markdown.RepeatString(System.String,System.Int32)\">\r\n            <summary>\r\n            this is to emulate what's evailable in PHP\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.EmptyElementSuffix\">\r\n            <summary>\r\n            use \">\" for HTML output, or \" />\" for XHTML output\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.LinkEmails\">\r\n            <summary>\r\n            when false, email addresses will never be auto-linked  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.StrictBoldItalic\">\r\n            <summary>\r\n            when true, bold and italic require non-word characters on either side  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.AutoNewLines\">\r\n            <summary>\r\n            when true, RETURN becomes a literal newline  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.AutoHyperlink\">\r\n            <summary>\r\n            when true, (most) bare plain URLs are auto-hyperlinked  \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.EncodeProblemUrlCharacters\">\r\n            <summary>\r\n            when true, problematic URL characters like [, ], (, and so forth will be encoded \r\n            WARNING: this is a significant deviation from the markdown spec\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:MarkdownSharp.Markdown.Version\">\r\n            <summary>\r\n            current version of MarkdownSharp;  \r\n            see http://code.google.com/p/markdownsharp/ for the latest code or to contribute\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.WebRequestProfilerProvider\">\r\n            <summary>\r\n            HttpContext based profiler provider.  This is the default provider to use in a web context.\r\n            The current profiler is associated with a HttpContext.Current ensuring that profilers are \r\n            specific to a individual HttpRequest.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.BaseProfilerProvider\">\r\n            <summary>\r\n            BaseProfilerProvider.  This providers some helper methods which provide access to\r\n            internals not otherwise available.\r\n            To use, override the <see cref=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.Start(ServiceStack.MiniProfiler.ProfileLevel)\"/>, <see cref=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.Stop(System.Boolean)\"/> and <see cref=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.GetCurrentProfiler\"/>\r\n            methods.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.IProfilerProvider\">\r\n            <summary>\r\n            A provider used to create <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> instances and maintain the current instance.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.IProfilerProvider.Start(ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Starts a new MiniProfiler and sets it to be current.  By the end of this method\r\n            <see cref=\"M:ServiceStack.MiniProfiler.IProfilerProvider.GetCurrentProfiler\"/> should return the new MiniProfiler.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.IProfilerProvider.Stop(System.Boolean)\">\r\n            <summary>\r\n            Ends the current profiling session, if one exists.\r\n            </summary>\r\n            <param name=\"discardResults\">\r\n            When true, clears the <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Current\"/> for this HttpContext, allowing profiling to \r\n            be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled.\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.IProfilerProvider.GetCurrentProfiler\">\r\n            <summary>\r\n            Returns the current MiniProfiler.  This is used by <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Current\"/>.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.Start(ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Starts a new MiniProfiler and sets it to be current.  By the end of this method\r\n            <see cref=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.GetCurrentProfiler\"/> should return the new MiniProfiler.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.Stop(System.Boolean)\">\r\n            <summary>\r\n            Stops the current MiniProfiler (if any is currently running).\r\n            <see cref=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.SaveProfiler(ServiceStack.MiniProfiler.Profiler)\"/> should be called if <paramref name=\"discardResults\"/> is false\r\n            </summary>\r\n            <param name=\"discardResults\">If true, any current results will be thrown away and nothing saved</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.GetCurrentProfiler\">\r\n            <summary>\r\n            Returns the current MiniProfiler.  This is used by <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Current\"/>.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.SetProfilerActive(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Sets <paramref name=\"profiler\"/> to be active (read to start profiling)\r\n            This should be called once a new MiniProfiler has been created.\r\n            </summary>\r\n            <param name=\"profiler\">The profiler to set to active</param>\r\n            <exception cref=\"T:System.ArgumentNullException\">If <paramref name=\"profiler\"/> is null</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.StopProfiler(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Stops the profiler and marks it as inactive.\r\n            </summary>\r\n            <param name=\"profiler\">The profiler to stop</param>\r\n            <returns>True if successful, false if Stop had previously been called on this profiler</returns>\r\n            <exception cref=\"T:System.ArgumentNullException\">If <paramref name=\"profiler\"/> is null</exception>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.BaseProfilerProvider.SaveProfiler(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Calls <see cref=\"M:ServiceStack.MiniProfiler.Profiler.Settings.EnsureStorageStrategy\"/> to save the current\r\n            profiler using the current storage settings\r\n            </summary>\r\n            <param name=\"current\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.WebRequestProfilerProvider.#ctor\">\r\n            <summary>\r\n            Public constructor.  This also registers any UI routes needed to display results\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.WebRequestProfilerProvider.Start(ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Starts a new MiniProfiler and associates it with the current <see cref=\"P:System.Web.HttpContext.Current\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.WebRequestProfilerProvider.Stop(System.Boolean)\">\r\n            <summary>\r\n            Ends the current profiling session, if one exists.\r\n            </summary>\r\n            <param name=\"discardResults\">\r\n            When true, clears the <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Current\"/> for this HttpContext, allowing profiling to \r\n            be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled.\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.WebRequestProfilerProvider.EnsureName(ServiceStack.MiniProfiler.Profiler,System.Web.HttpRequest)\">\r\n            <summary>\r\n            Makes sure 'profiler' has a Name, pulling it from route data or url.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.WebRequestProfilerProvider.GetCurrentProfiler\">\r\n            <summary>\r\n            Returns the current profiler\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.WebRequestProfilerProvider.Current\">\r\n            <summary>\r\n            Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was <see cref=\"M:ServiceStack.MiniProfiler.WebRequestProfilerProvider.Start(ServiceStack.MiniProfiler.ProfileLevel)\"/>ed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.WebRequestProfilerProvider.Settings\">\r\n            <summary>\r\n            WebRequestProfilerProvider specific configurations\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.WebRequestProfilerProvider.Settings.UserProvider\">\r\n            <summary>\r\n            Provides user identification for a given profiling request.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Timing\">\r\n            <summary>\r\n            An individual profiling step that can contain child steps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.RebuildParentTimings\">\r\n            <summary>\r\n            Rebuilds all the parent timings on deserialization calls\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Timing._startTicks\">\r\n            <summary>\r\n            Offset from parent MiniProfiler's creation that this Timing was created.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.#ctor(ServiceStack.MiniProfiler.Profiler,ServiceStack.MiniProfiler.Timing,System.String)\">\r\n            <summary>\r\n            Creates a new Timing named 'name' in the 'profiler's session, with 'parent' as this Timing's immediate ancestor.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.#ctor\">\r\n            <summary>\r\n            Obsolete - used for serialization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.ToString\">\r\n            <summary>\r\n            Returns this Timing's Name.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.Equals(System.Object)\">\r\n            <summary>\r\n            Returns true if Ids match.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.GetHashCode\">\r\n            <summary>\r\n            Returns hashcode of Id.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.AddKeyValue(System.String,System.String)\">\r\n            <summary>\r\n            Adds arbitrary string 'value' under 'key', allowing custom properties to be stored in this Timing step.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.Stop\">\r\n            <summary>\r\n            Completes this Timing's duration and sets the MiniProfiler's Head up one level.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.AddChild(ServiceStack.MiniProfiler.Timing)\">\r\n            <summary>\r\n            Add the parameter 'timing' to this Timing's Children collection.\r\n            </summary>\r\n            <remarks>\r\n            Used outside this assembly for custom deserialization when creating an <see cref=\"T:ServiceStack.MiniProfiler.Storage.IStorage\"/> implementation.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.AddSqlTiming(ServiceStack.MiniProfiler.SqlTiming)\">\r\n            <summary>\r\n            Adds the parameter 'sqlTiming' to this Timing's SqlTimings collection.\r\n            </summary>\r\n            <param name=\"sqlTiming\">A sql statement profiling that was executed in this Timing step.</param>\r\n            <remarks>\r\n            Used outside this assembly for custom deserialization when creating an <see cref=\"T:ServiceStack.MiniProfiler.Storage.IStorage\"/> implementation.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Timing.GetExecutedCount(ServiceStack.MiniProfiler.Data.ExecuteType)\">\r\n            <summary>\r\n            Returns the number of sql statements of <paramref name=\"type\"/> that were executed in this <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.Id\">\r\n            <summary>\r\n            Unique identifer for this timing; set during construction.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.Name\">\r\n            <summary>\r\n            Text displayed when this Timing is rendered.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.DurationMilliseconds\">\r\n            <summary>\r\n            How long this Timing step took in ms; includes any <see cref=\"P:ServiceStack.MiniProfiler.Timing.Children\"/> Timings' durations.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.StartMilliseconds\">\r\n            <summary>\r\n            The offset from the start of profiling.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.Children\">\r\n            <summary>\r\n            All sub-steps that occur within this Timing step. Add new children through <see cref=\"M:ServiceStack.MiniProfiler.Timing.AddChild(ServiceStack.MiniProfiler.Timing)\"/>\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.KeyValues\">\r\n            <summary>\r\n            Stores arbitrary key/value strings on this Timing step. Add new tuples through <see cref=\"M:ServiceStack.MiniProfiler.Timing.AddKeyValue(System.String,System.String)\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.SqlTimings\">\r\n            <summary>\r\n            Any queries that occurred during this Timing step.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.ParentTimingId\">\r\n            <summary>\r\n            Needed for database deserialization and JSON serialization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.ParentTiming\">\r\n            <summary>\r\n            Which Timing this Timing is under - the duration that this step takes will be added to its parent's duration.\r\n            </summary>\r\n            <remarks>This will be null for the root (initial) Timing.</remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.DurationWithoutChildrenMilliseconds\">\r\n            <summary>\r\n            Gets the elapsed milliseconds in this step without any children's durations.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.SqlTimingsDurationMilliseconds\">\r\n            <summary>\r\n            Gets the aggregate elapsed milliseconds of all SqlTimings executed in this Timing, excluding Children Timings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.IsTrivial\">\r\n            <summary>\r\n            Returns true when this <see cref=\"P:ServiceStack.MiniProfiler.Timing.DurationWithoutChildrenMilliseconds\"/> is less than the configured\r\n            <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.TrivialDurationThresholdMilliseconds\"/>, by default 2.0 ms.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.Profiler\">\r\n            <summary>\r\n            Reference to the containing profiler, allowing this Timing to affect the Head and get Stopwatch readings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.HasChildren\">\r\n            <summary>\r\n            Returns true when this Timing has inner Timing steps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.HasSqlTimings\">\r\n            <summary>\r\n            Returns true if this Timing step collected sql execution timings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.HasDuplicateSqlTimings\">\r\n            <summary>\r\n            Returns true if any <see cref=\"T:ServiceStack.MiniProfiler.SqlTiming\"/>s executed in this step are detected as duplicate statements.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.IsRoot\">\r\n            <summary>\r\n            Returns true when this Timing is the first one created in a MiniProfiler session.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.Depth\">\r\n            <summary>\r\n            How far away this Timing is from the Profiler's Root.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.ExecutedReaders\">\r\n            <summary>\r\n            How many sql data readers were executed in this Timing step. Does not include queries in any child Timings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.ExecutedScalars\">\r\n            <summary>\r\n            How many sql scalar queries were executed in this Timing step. Does not include queries in any child Timings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Timing.ExecutedNonQueries\">\r\n            <summary>\r\n            How many sql non-query statements were executed in this Timing step. Does not include queries in any child Timings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Data.ProfiledDbConnection\">\r\n            <summary>\r\n            Wraps a database connection, allowing sql execution timings to be collected when a <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> session is started.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ProfiledDbConnection._conn\">\r\n            <summary>\r\n            This will be made private; use <see cref=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbConnection.InnerConnection\"/>\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ProfiledDbConnection._profiler\">\r\n            <summary>\r\n            This will be made private; use <see cref=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbConnection.Profiler\"/>\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbConnection.#ctor(System.Data.Common.DbConnection,ServiceStack.MiniProfiler.Data.IDbProfiler,System.Boolean)\">\r\n            <summary>\r\n            Returns a new <see cref=\"T:ServiceStack.MiniProfiler.Data.ProfiledDbConnection\"/> that wraps <paramref name=\"connection\"/>, \r\n            providing query execution profiling.  If profiler is null, no profiling will occur.\r\n            </summary>\r\n            <param name=\"connection\">Your provider-specific flavor of connection, e.g. SqlConnection, OracleConnection</param>\r\n            <param name=\"profiler\">The currently started <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> or null.</param>\r\n            <param name=\"autoDisposeConnection\">Determines whether the ProfiledDbConnection will dispose the underlying connection.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbConnection.InnerConnection\">\r\n            <summary>\r\n            The underlying, real database connection to your db provider.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbConnection.Profiler\">\r\n            <summary>\r\n            The current profiler instance; could be null.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbConnection.WrappedConnection\">\r\n            <summary>\r\n            The raw connection this is wrapping\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ServiceEntry.Owner\">\r\n            <summary>\r\n            Ownership setting for the service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ServiceEntry.Reuse\">\r\n            <summary>\r\n            Reuse scope setting for the service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ServiceEntry.Container\">\r\n            <summary>\r\n            The container where the entry was registered.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.ServiceEntry.OwnedBy(Funq.Owner)\">\r\n            <summary>\r\n            Specifies the owner for instances, which determines how \r\n            they will be disposed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.ServiceEntry.ReusedWithin(Funq.ReuseScope)\">\r\n            <summary>\r\n            Specifies the scope for instances, which determines \r\n            visibility of instances across containers and hierarchies.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ServiceEntry`2.Factory\">\r\n            <summary>\r\n            The Func delegate that creates instances of the service.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ServiceEntry`2.instance\">\r\n            <summary>\r\n            The cached service instance if the scope is <see cref=\"F:Funq.ReuseScope.Hierarchy\"/> or \r\n            <see cref=\"F:Funq.ReuseScope.Container\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ServiceEntry`2.Initializer\">\r\n            <summary>\r\n            The Func delegate that initializes the object after creation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.ServiceEntry`2.CloneFor(Funq.Container)\">\r\n            <summary>\r\n            Clones the service entry assigning the <see cref=\"T:Funq.Container\"/> to the \r\n            <paramref name=\"newContainer\"/>. Does not copy the <see cref=\"P:Funq.ServiceEntry`2.Instance\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpResponseExtensions.SetPermanentCookie(ServiceStack.ServiceHost.IHttpResponse,System.String,System.String)\">\r\n            <summary>\r\n            Sets a persistent cookie which never expires\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpResponseExtensions.SetSessionCookie(ServiceStack.ServiceHost.IHttpResponse,System.String,System.String)\">\r\n            <summary>\r\n            Sets a session cookie which expires after the browser session closes\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpResponseExtensions.SetCookie(ServiceStack.ServiceHost.IHttpResponse,System.String,System.String,System.TimeSpan)\">\r\n            <summary>\r\n            Sets a persistent cookie which expires after the given time\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpResponseExtensions.SetCookie(ServiceStack.ServiceHost.IHttpResponse,System.String,System.String,System.DateTime,System.String)\">\r\n            <summary>\r\n            Sets a persistent cookie with an expiresAt date\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpResponseExtensions.DeleteCookie(ServiceStack.ServiceHost.IHttpResponse,System.String)\">\r\n            <summary>\r\n            Deletes a specified cookie by setting its value to empty and expiration to -1 days\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.Cookies.AddPermanentCookie(System.String,System.String)\">\r\n            <summary>\r\n            Sets a persistent cookie which never expires\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.Cookies.AddSessionCookie(System.String,System.String)\">\r\n            <summary>\r\n            Sets a session cookie which expires after the browser session closes\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.Cookies.DeleteCookie(System.String)\">\r\n            <summary>\r\n            Deletes a specified cookie by setting its value to empty and expiration to -1 days\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.Cookies.AddCookie(System.Net.Cookie)\">\r\n            <summary>\r\n            Sets a persistent cookie which expires after the given time\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.ReuseScope\">\r\n            <summary>\r\n            Determines visibility and reuse of instances provided by the container.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ReuseScope.Hierarchy\">\r\n            <summary>\r\n            Instances are reused within a container hierarchy. Instances \r\n            are created (if necessary) in the container where the registration\r\n            was performed, and are reused by all descendent containers.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ReuseScope.Container\">\r\n            <summary>\r\n            Instances are reused only at the given container. Descendent \r\n            containers do not reuse parent container instances and get  \r\n            a new instance at their level.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ReuseScope.None\">\r\n            <summary>\r\n            Each request to resolve the dependency will result in a new \r\n            instance being returned.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ReuseScope.Request\">\r\n            <summary>\r\n            Instaces are reused within the given request\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.ReuseScope.Default\">\r\n            <summary>\r\n            Default scope, which equals <see cref=\"F:Funq.ReuseScope.Hierarchy\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.Extensions.HttpRequestExtensions\">\r\n            \t * \r\n            \t\t Input: http://localhost:96/Cambia3/Temp/Test.aspx/path/info?q=item#fragment\r\n            \r\n            \t\tSome HttpRequest path and URL properties:\r\n            \t\tRequest.ApplicationPath:\t/Cambia3\r\n            \t\tRequest.CurrentExecutionFilePath:\t/Cambia3/Temp/Test.aspx\r\n            \t\tRequest.FilePath:\t\t\t/Cambia3/Temp/Test.aspx\r\n            \t\tRequest.Path:\t\t\t\t/Cambia3/Temp/Test.aspx/path/info\r\n            \t\tRequest.PathInfo:\t\t\t/path/info\r\n            \t\tRequest.PhysicalApplicationPath:\tD:\\Inetpub\\wwwroot\\CambiaWeb\\Cambia3\\\r\n            \t\tRequest.QueryString:\t\t/Cambia3/Temp/Test.aspx/path/info?query=arg\r\n            \t\tRequest.Url.AbsolutePath:\t/Cambia3/Temp/Test.aspx/path/info\r\n            \t\tRequest.Url.AbsoluteUri:\thttp://localhost:96/Cambia3/Temp/Test.aspx/path/info?query=arg\r\n            \t\tRequest.Url.Fragment:\t\r\n            \t\tRequest.Url.Host:\t\t\tlocalhost\r\n            \t\tRequest.Url.LocalPath:\t\t/Cambia3/Temp/Test.aspx/path/info\r\n            \t\tRequest.Url.PathAndQuery:\t/Cambia3/Temp/Test.aspx/path/info?query=arg\r\n            \t\tRequest.Url.Port:\t\t\t96\r\n            \t\tRequest.Url.Query:\t\t\t?query=arg\r\n            \t\tRequest.Url.Scheme:\t\t\thttp\r\n            \t\tRequest.Url.Segments:\t\t/\r\n            \t\t\t\t\t\t\t\t\tCambia3/\r\n            \t\t\t\t\t\t\t\t\tTemp/\r\n            \t\t\t\t\t\t\t\t\tTest.aspx/\r\n            \t\t\t\t\t\t\t\t\tpath/\r\n            \t\t\t\t\t\t\t\t\tinfo\r\n            \t * \r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Extensions.HttpRequestExtensions.ResolveItem(ServiceStack.ServiceHost.IHttpRequest,System.String,System.Func{ServiceStack.ServiceHost.IHttpRequest,System.Object})\">\r\n            <summary>\r\n            Use this to treat Request.Items[] as a cache by returning pre-computed items to save \r\n            calculating them multiple times.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Extensions.HttpRequestExtensions.SetItem(ServiceStack.ServiceHost.IHttpRequest,System.String,System.Object)\">\r\n            <summary>\r\n            Store an entry in the IHttpRequest.Items Dictionary\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Extensions.HttpRequestExtensions.GetItem(ServiceStack.ServiceHost.IHttpRequest,System.String)\">\r\n            <summary>\r\n            Get an entry from the IHttpRequest.Items Dictionary\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlTiming\">\r\n            <summary>\r\n            Profiles a single sql execution.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.#ctor(System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType,ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Creates a new SqlTiming to profile 'command'.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.#ctor\">\r\n            <summary>\r\n            Obsolete - used for serialization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.ToString\">\r\n            <summary>\r\n            Returns a snippet of the sql command and the duration.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.Equals(System.Object)\">\r\n            <summary>\r\n            Returns true if Ids match.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.GetHashCode\">\r\n            <summary>\r\n            Returns hashcode of Id.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.ExecutionComplete(System.Boolean)\">\r\n            <summary>\r\n            Called when command execution is finished to determine this SqlTiming's duration.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.ReaderFetchComplete\">\r\n            <summary>\r\n            Called when database reader is closed, ending profiling for <see cref=\"F:ServiceStack.MiniProfiler.Data.ExecuteType.Reader\"/> SqlTimings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTiming.AddSpacesToParameters(System.String)\">\r\n            <summary>\r\n            To help with display, put some space around sammiched commas\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.Id\">\r\n            <summary>\r\n            Unique identifier for this SqlTiming.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.ExecuteType\">\r\n            <summary>\r\n            Category of sql statement executed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.CommandString\">\r\n            <summary>\r\n            The sql that was executed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.FormattedCommandString\">\r\n            <summary>\r\n            The command string with special formatting applied based on MiniProfiler.Settings.SqlFormatter\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.StackTraceSnippet\">\r\n            <summary>\r\n            Roughly where in the calling code that this sql was executed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.StartMilliseconds\">\r\n            <summary>\r\n            Offset from main MiniProfiler start that this sql began.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.DurationMilliseconds\">\r\n            <summary>\r\n            How long this sql statement took to execute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.FirstFetchDurationMilliseconds\">\r\n            <summary>\r\n            When executing readers, how long it took to come back initially from the database, \r\n            before all records are fetched and reader is closed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.Parameters\">\r\n            <summary>\r\n            Stores any parameter names and values used by the profiled DbCommand.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.ParentTimingId\">\r\n            <summary>\r\n            Id of the Timing this statement was executed in.\r\n            </summary>\r\n            <remarks>\r\n            Needed for database deserialization.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.ParentTiming\">\r\n            <summary>\r\n            The Timing step that this sql execution occurred in.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTiming.IsDuplicate\">\r\n            <summary>\r\n            True when other identical sql statements have been executed during this MiniProfiler session.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Profiler\">\r\n            <summary>\r\n            A single MiniProfiler can be used to represent any number of steps/levels in a call-graph, via Step()\r\n            </summary>\r\n            <remarks>Totally baller.</remarks>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Data.IDbProfiler\">\r\n            <summary>\r\n            A callback for ProfiledDbConnection and family\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.IDbProfiler.ExecuteStart(System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType)\">\r\n            <summary>\r\n            Called when a command starts executing\r\n            </summary>\r\n            <param name=\"profiledDbCommand\"></param>\r\n            <param name=\"executeType\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.IDbProfiler.ExecuteFinish(System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType,System.Data.Common.DbDataReader)\">\r\n            <summary>\r\n            Called when a reader finishes executing\r\n            </summary>\r\n            <param name=\"profiledDbCommand\"></param>\r\n            <param name=\"executeType\"></param>\r\n            <param name=\"reader\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.IDbProfiler.ReaderFinish(System.Data.Common.DbDataReader)\">\r\n            <summary>\r\n            Called when a reader is done iterating through the data \r\n            </summary>\r\n            <param name=\"reader\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.IDbProfiler.OnError(System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType,System.Exception)\">\r\n            <summary>\r\n            Called when an error happens during execution of a command \r\n            </summary>\r\n            <param name=\"profiledDbCommand\"></param>\r\n            <param name=\"executeType\"></param>\r\n            <param name=\"exception\"></param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Data.IDbProfiler.IsActive\">\r\n            <summary>\r\n            True if the profiler instance is active\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.GetInProgressCommands\">\r\n            <summary>\r\n            Returns all currently open commands on this connection\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.GetSqlTimings\">\r\n            <summary>\r\n            Returns all <see cref=\"T:ServiceStack.MiniProfiler.SqlTiming\"/> results contained in all child <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Profiler._sqlExecutionCounts\">\r\n            <summary>\r\n            Contains any sql statements that are executed, along with how many times those statements are executed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.AddSqlTiming(ServiceStack.MiniProfiler.SqlTiming)\">\r\n            <summary>\r\n            Adds <paramref name=\"stats\"/> to the current <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.GetExecutedCount(ServiceStack.MiniProfiler.Data.ExecuteType)\">\r\n            <summary>\r\n            Returns the number of sql statements of <paramref name=\"type\"/> that were executed in all <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/>s.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Profiler._sw\">\r\n            <summary>\r\n            Starts when this profiler is instantiated. Each <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> step will use this Stopwatch's current ticks as\r\n            their starting time.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.#ctor(System.String,ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Creates and starts a new MiniProfiler for the root <paramref name=\"url\"/>, filtering <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps to <paramref name=\"level\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.ToString\">\r\n            <summary>\r\n            Returns the <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Root\"/>'s <see cref=\"P:ServiceStack.MiniProfiler.Timing.Name\"/> and <see cref=\"P:ServiceStack.MiniProfiler.Profiler.DurationMilliseconds\"/> this profiler recorded.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Equals(System.Object)\">\r\n            <summary>\r\n            Returns true if Ids match.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.GetHashCode\">\r\n            <summary>\r\n            Returns hashcode of Id.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.#ctor\">\r\n            <summary>\r\n            Obsolete - used for serialization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.GetTimingHierarchy\">\r\n            <summary>\r\n            Walks the <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> hierarchy contained in this profiler, starting with <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Root\"/>, and returns each Timing found.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.GetRoundedMilliseconds(System.Int64)\">\r\n            <summary>\r\n            Returns milliseconds based on Stopwatch's Frequency.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Start(ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Starts a new MiniProfiler based on the current <see cref=\"T:ServiceStack.MiniProfiler.IProfilerProvider\"/>. This new profiler can be accessed by\r\n            <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Current\"/>\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Stop(System.Boolean)\">\r\n            <summary>\r\n            Ends the current profiling session, if one exists.\r\n            </summary>\r\n            <param name=\"discardResults\">\r\n            When true, clears the <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Current\"/> for this HttpContext, allowing profiling to \r\n            be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled.\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.StepStatic(System.String,ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Returns an <see cref=\"T:System.IDisposable\"/> that will time the code between its creation and disposal. Use this method when you\r\n            do not wish to include the MvcMiniProfiler namespace for the <see cref=\"M:ServiceStack.MiniProfiler.MiniProfilerExtensions.Step(ServiceStack.MiniProfiler.Profiler,System.String,ServiceStack.MiniProfiler.ProfileLevel)\"/> extension method.\r\n            </summary>\r\n            <param name=\"name\">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param>\r\n            <param name=\"level\">This step's visibility level; allows filtering when <see cref=\"M:ServiceStack.MiniProfiler.Profiler.Start(ServiceStack.MiniProfiler.ProfileLevel)\"/> is called.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.RenderIncludes(System.Nullable{ServiceStack.MiniProfiler.RenderPosition},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Int32},System.Boolean,System.Nullable{System.Boolean})\">\r\n            <summary>\r\n            Returns the css and javascript includes needed to display the MiniProfiler results UI.\r\n            </summary>\r\n            <param name=\"position\">Which side of the page the profiler popup button should be displayed on (defaults to left)</param>\r\n            <param name=\"showTrivial\">Whether to show trivial timings by default (defaults to false)</param>\r\n            <param name=\"showTimeWithChildren\">Whether to show time the time with children column by default (defaults to false)</param>\r\n            <param name=\"maxTracesToShow\">The maximum number of trace popups to show before removing the oldest (defaults to 15)</param>\r\n            <param name=\"xhtml\">xhtml rendering mode, ensure script tag is closed ... etc</param>\r\n            <param name=\"showControls\">when true, shows buttons to minimize and clear MiniProfiler results</param>\r\n            <returns>Script and link elements normally; an empty string when there is no active profiling session.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.ToJson\">\r\n            <summary>\r\n            Renders the current <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> to json.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.ToJson(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Renders the parameter <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> to json.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.FromJson(System.String)\">\r\n            <summary>\r\n            Deserializes the json string parameter to a <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Clone\">\r\n            <summary>\r\n            Create a DEEP clone of this object\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.SqlProfiler\">\r\n            <summary>\r\n            Contains information about queries executed during this profiling session.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.DurationMillisecondsInSql\">\r\n            <summary>\r\n            Milliseconds, to one decimal place, that this MiniProfiler was executing sql.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.HasSqlTimings\">\r\n            <summary>\r\n            Returns true when we have profiled queries.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.HasDuplicateSqlTimings\">\r\n            <summary>\r\n            Returns true when any child Timings have duplicate queries.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.ExecutedReaders\">\r\n            <summary>\r\n            How many sql data readers were executed in all <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.ExecutedScalars\">\r\n            <summary>\r\n            How many sql scalar queries were executed in all <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.ExecutedNonQueries\">\r\n            <summary>\r\n            How many sql non-query statements were executed in all <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Id\">\r\n            <summary>\r\n            Identifies this Profiler so it may be stored/cached.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Name\">\r\n            <summary>\r\n            A display name for this profiling session.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Started\">\r\n            <summary>\r\n            When this profiler was instantiated.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.MachineName\">\r\n            <summary>\r\n            Where this profiler was run.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Level\">\r\n            <summary>\r\n            Allows filtering of <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps based on what <see cref=\"T:ServiceStack.MiniProfiler.ProfileLevel\"/> \r\n            the steps are created with.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Root\">\r\n            <summary>\r\n            The first <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> that is created and started when this profiler is instantiated.\r\n            All other <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/>s will be children of this one.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.User\">\r\n            <summary>\r\n            A string identifying the user/client that is profiling this request.  Set <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.UserProvider\"/>\r\n            with an <see cref=\"T:ServiceStack.MiniProfiler.IUserProvider\"/>-implementing class to provide a custom value.\r\n            </summary>\r\n            <remarks>\r\n            If this is not set manually at some point, the <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.UserProvider\"/> implementation will be used;\r\n            by default, this will be the current request's ip address.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.HasUserViewed\">\r\n            <summary>\r\n            Returns true when this MiniProfiler has been viewed by the <see cref=\"P:ServiceStack.MiniProfiler.Profiler.User\"/> that recorded it.\r\n            </summary>\r\n            <remarks>\r\n            Allows POSTs that result in a redirect to be profiled. <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.Storage\"/> implementation\r\n            will keep a list of all profilers that haven't been fetched down.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Stopwatch\">\r\n            <summary>\r\n            For unit testing, returns the timer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.DurationMilliseconds\">\r\n            <summary>\r\n            Milliseconds, to one decimal place, that this MiniProfiler ran.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.HasTrivialTimings\">\r\n            <summary>\r\n            Returns true when <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Root\"/> or any of its <see cref=\"P:ServiceStack.MiniProfiler.Timing.Children\"/> are <see cref=\"P:ServiceStack.MiniProfiler.Timing.IsTrivial\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.HasAllTrivialTimings\">\r\n            <summary>\r\n            Returns true when all child <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/>s are <see cref=\"P:ServiceStack.MiniProfiler.Timing.IsTrivial\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.TrivialDurationThresholdMilliseconds\">\r\n            <summary>\r\n            Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.ElapsedTicks\">\r\n            <summary>\r\n            Ticks since this MiniProfiler was started.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Head\">\r\n            <summary>\r\n            Points to the currently executing Timing. \r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Current\">\r\n            <summary>\r\n            Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was <see cref=\"M:ServiceStack.MiniProfiler.Profiler.Start(ServiceStack.MiniProfiler.ProfileLevel)\"/>ed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Profiler.Settings\">\r\n            <summary>\r\n            Various configuration properties.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Settings.ExcludeAssembly(System.String)\">\r\n            <summary>\r\n            Excludes the specified assembly from the stack trace output.\r\n            </summary>\r\n            <param name=\"assemblyName\">The short name of the assembly. AssemblyName.Name</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Settings.ExcludeType(System.String)\">\r\n            <summary>\r\n            Excludes the specified type from the stack trace output.\r\n            </summary>\r\n            <param name=\"typeToExclude\">The System.Type name to exclude</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Settings.ExcludeMethod(System.String)\">\r\n            <summary>\r\n            Excludes the specified method name from the stack trace output.\r\n            </summary>\r\n            <param name=\"methodName\">The name of the method</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Profiler.Settings.EnsureStorageStrategy\">\r\n            <summary>\r\n            Make sure we can at least store profiler results to the http runtime cache.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.AssembliesToExclude\">\r\n            <summary>\r\n            Assemblies to exclude from the stack trace report.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.TypesToExclude\">\r\n            <summary>\r\n            Types to exclude from the stack trace report.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.MethodsToExclude\">\r\n            <summary>\r\n            Methods to exclude from the stack trace report.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.StackMaxLength\">\r\n            <summary>\r\n            The max length of the stack string to report back; defaults to 120 chars.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.TrivialDurationThresholdMilliseconds\">\r\n            <summary>\r\n            Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.PopupShowTimeWithChildren\">\r\n            <summary>\r\n            Dictates if the \"time with children\" column is displayed by default, defaults to false.\r\n            For a per-page override you can use .RenderIncludes(showTimeWithChildren: true/false)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.PopupShowTrivial\">\r\n            <summary>\r\n            Dictates if trivial timings are displayed by default, defaults to false.\r\n            For a per-page override you can use .RenderIncludes(showTrivial: true/false)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.PopupMaxTracesToShow\">\r\n            <summary>\r\n            Determines how many traces to show before removing the oldest; defaults to 15.\r\n            For a per-page override you can use .RenderIncludes(maxTracesToShow: 10)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.PopupRenderPosition\">\r\n            <summary>\r\n            Dictates on which side of the page the profiler popup button is displayed; defaults to left.\r\n            For a per-page override you can use .RenderIncludes(position: RenderPosition.Left/Right)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.ShowControls\">\r\n            <summary>\r\n            Determines if min-max, clear, etc are rendered; defaults to false.\r\n            For a per-page override you can use .RenderIncludes(showControls: true/false)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.ExcludeStackTraceSnippetFromSqlTimings\">\r\n            <summary>\r\n            By default, SqlTimings will grab a stack trace to help locate where queries are being executed.\r\n            When this setting is true, no stack trace will be collected, possibly improving profiler performance.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.IgnoredPaths\">\r\n            <summary>\r\n            When <see cref=\"M:ServiceStack.MiniProfiler.Profiler.Start(ServiceStack.MiniProfiler.ProfileLevel)\"/> is called, if the current request url contains any items in this property,\r\n            no profiler will be instantiated and no results will be displayed.\r\n            Default value is { \"/ss-\", \"/content/\", \"/scripts/\", \"/favicon.ico\" }.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.RouteBasePath\">\r\n            <summary>\r\n            The path under which ALL routes are registered in, defaults to the application root.  For example, \"~/myDirectory/\" would yield\r\n            \"/myDirectory/ss-includes.js\" rather than just \"/mini-profiler-includes.js\"\r\n            Any setting here should be in APP RELATIVE FORM, e.g. \"~/myDirectory/\"\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.Storage\">\r\n            <summary>\r\n            Understands how to save and load MiniProfilers. Used for caching between when\r\n            a profiling session ends and results can be fetched to the client, and for showing shared, full-page results.\r\n            </summary>\r\n            <remarks>\r\n            The normal profiling session life-cycle is as follows:\r\n            1) request begins\r\n            2) profiler is started\r\n            3) normal page/controller/request execution\r\n            4) profiler is stopped\r\n            5) profiler is cached with <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.Storage\"/>'s implementation of <see cref=\"M:ServiceStack.MiniProfiler.Storage.IStorage.Save(ServiceStack.MiniProfiler.Profiler)\"/>\r\n            6) request ends\r\n            7) page is displayed and profiling results are ajax-fetched down, pulling cached results from \r\n               <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.Storage\"/>'s implementation of <see cref=\"M:ServiceStack.MiniProfiler.Storage.IStorage.Load(System.Guid)\"/>\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.SqlFormatter\">\r\n            <summary>\r\n            The formatter applied to the SQL being rendered (used only for UI)\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.UserProvider\">\r\n            <summary>\r\n            Provides user identification for a given profiling request.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.Version\">\r\n            <summary>\r\n            Assembly version of this dank MiniProfiler.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.ProfilerProvider\">\r\n            <summary>\r\n            The provider used to provider the current instance of a provider\r\n            This is also \r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.Results_Authorize\">\r\n            <summary>\r\n            A function that determines who can access the MiniProfiler results url.  It should return true when\r\n            the request client has access, false for a 401 to be returned. HttpRequest parameter is the current request and\r\n            MiniProfiler parameter is the results that were profiled.\r\n            </summary>\r\n            <remarks>\r\n            Both the HttpRequest and MiniProfiler parameters that will be passed into this function should never be null.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Profiler.Settings.StopwatchProvider\">\r\n            <summary>\r\n            Allows switching out stopwatches for unit testing.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Helpers.StackTraceSnippet\">\r\n            <summary>\r\n            Gets part of a stack trace containing only methods we care about.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.StackTraceSnippet.Get\">\r\n            <summary>\r\n            Gets the current formatted and filted stack trace.\r\n            </summary>\r\n            <returns>Space separated list of methods</returns>\r\n        </member>\r\n        <member name=\"T:Funq.IFunqlet\">\r\n            <summary>\r\n            Funqlets are a set of components provided as a package \r\n            to an existing container (like a module).\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.IFunqlet.Configure(Funq.Container)\">\r\n            <summary>\r\n            Configure the given container with the \r\n            registrations provided by the funqlet.\r\n            </summary>\r\n            <param name=\"container\">Container to register.</param>\r\n        </member>\r\n        <member name=\"T:Funq.IContainerModule\">\r\n            <summary>\r\n            Interface used by plugins to contribute registrations \r\n            to an existing container.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RequestContextExtensions.ToOptimizedResult``1(ServiceStack.ServiceHost.IRequestContext,``0)\">\r\n            <summary>\r\n            Returns the optimized result for the IRequestContext. \r\n            Does not use or store results in any cache.\r\n            </summary>\r\n            <param name=\"requestContext\"></param>\r\n            <param name=\"dto\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RequestContextExtensions.ToOptimizedResultUsingCache``1(ServiceStack.ServiceHost.IRequestContext,ServiceStack.CacheAccess.ICacheClient,System.String,System.Func{``0})\">\r\n            <summary>\r\n            Overload for the <see cref=\"!:ContentCacheManager.Resolve\"/> method returning the most\r\n            optimized result based on the MimeType and CompressionType from the IRequestContext.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RequestContextExtensions.ToOptimizedResultUsingCache``1(ServiceStack.ServiceHost.IRequestContext,ServiceStack.CacheAccess.ICacheClient,System.String,System.Nullable{System.TimeSpan},System.Func{``0})\">\r\n            <summary>\r\n            Overload for the <see cref=\"!:ContentCacheManager.Resolve\"/> method returning the most\r\n            optimized result based on the MimeType and CompressionType from the IRequestContext.\r\n            <param name=\"expireCacheIn\">How long to cache for, null is no expiration</param>\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.RequestContextExtensions.RemoveFromCache(ServiceStack.ServiceHost.IRequestContext,ServiceStack.CacheAccess.ICacheClient,System.String[])\">\r\n            <summary>\r\n            Clears all the serialized and compressed caches set \r\n            by the 'Resolve' method for the cacheKey provided\r\n            </summary>\r\n            <param name=\"requestContext\"></param>\r\n            <param name=\"cacheClient\"></param>\r\n            <param name=\"cacheKeys\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ContainerResolveCache.CreateInstance(System.Type)\">\r\n            <summary>\r\n            Creates instance using straight Resolve approach.\r\n            This will throw an exception if resolution fails\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ContainerResolveCache.CreateInstance(System.Type,System.Boolean)\">\r\n            <summary>\r\n            Creates instance using the TryResolve approach if tryResolve = true.\r\n            Otherwise uses Resolve approach, which will throw an exception if resolution fails\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlFormatters.InlineFormatter\">\r\n            <summary>\r\n            Formats any SQL query with inline parameters, optionally including the value type\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlFormatters.ISqlFormatter\">\r\n            <summary>\r\n            Takes a SqlTiming and returns a formatted SQL string, for parameter replacement, etc.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlFormatters.ISqlFormatter.FormatSql(ServiceStack.MiniProfiler.SqlTiming)\">\r\n            <summary>\r\n            Return SQL the way you want it to look on the in the trace. Usually used to format parameters \r\n            </summary>\r\n            <param name=\"timing\"></param>\r\n            <returns>Formatted SQL</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlFormatters.InlineFormatter.#ctor(System.Boolean)\">\r\n            <summary>\r\n            Creates a new Inline SQL Formatter, optionally including the parameter type info in comments beside the replaced value\r\n            </summary>\r\n            <param name=\"includeTypeInfo\">whether to include a comment after the value, indicating the type, e.g. /* @myParam DbType.Int32 */</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlFormatters.InlineFormatter.FormatSql(ServiceStack.MiniProfiler.SqlTiming)\">\r\n            <summary>\r\n            Formats the SQL in a generic frieldly format, including the parameter type information in a comment if it was specified in the InlineFormatter constructor\r\n            </summary>\r\n            <param name=\"timing\">The SqlTiming to format</param>\r\n            <returns>A formatted SQL string</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlFormatters.InlineFormatter.GetParameterValue(ServiceStack.MiniProfiler.SqlTimingParameter)\">\r\n            <summary>\r\n            Returns a string representation of the parameter's value, including the type\r\n            </summary>\r\n            <param name=\"p\">The parameter to get a value for</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.IpAddressIdentity\">\r\n            <summary>\r\n            Identifies users based on ip address.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.IUserProvider\">\r\n            <summary>\r\n            Provides functionality to identify which user is profiling a request.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.IUserProvider.GetUser(System.Web.HttpRequest)\">\r\n            <summary>\r\n            Returns a string to identify the user profiling the current 'request'.\r\n            </summary>\r\n            <param name=\"request\">The current HttpRequest being profiled.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.IpAddressIdentity.GetUser(System.Web.HttpRequest)\">\r\n            <summary>\r\n            Returns the paramter HttpRequest's client ip address.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.Container\">\r\n            <summary>\r\n\t\t\tMain container class for components, supporting container hierarchies and\r\n\t\t\tlifetime management of <see cref=\"T:System.IDisposable\"/> instances.\r\n\t\t</summary>\r\n        </member>\r\n        <member name=\"M:Funq.Container.#ctor\">\r\n            <summary>\r\n\t\t\tInitializes a new empty container.\r\n\t\t</summary>\r\n        </member>\r\n        <member name=\"M:Funq.Container.CreateChildContainer\">\r\n            <summary>\r\n\t\t\tCreates a child container of the current one, which exposes its\r\n\t\t\tcurrent service registration to the new child container.\r\n\t\t</summary>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Dispose\">\r\n            <summary>\r\n\t\t\tDisposes the container and all instances owned by it (see\r\n\t\t\t<see cref=\"F:Funq.Owner.Container\"/>), as well as all child containers\r\n\t\t\tcreated through <see cref=\"M:Funq.Container.CreateChildContainer\"/>.\r\n\t\t</summary>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``1(``0)\">\r\n            <summary>\r\n\t\t\tRegisters a service instance with the container. This instance \r\n\t\t\twill have <see cref=\"F:Funq.Owner.External\"/> and <see cref=\"F:Funq.ReuseScope.Hierarchy\"/> \r\n\t\t\tbehavior.\r\n\t\t</summary><param name=\"instance\">Service instance to use.</param>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``1(System.String,``0)\">\r\n            <summary>\r\n\t\t\tRegisters a named service instance with the container. This instance\r\n\t\t\twill have <see cref=\"F:Funq.Owner.External\"/> and <see cref=\"F:Funq.ReuseScope.Hierarchy\"/>\r\n\t\t\tbehavior.\r\n\t\t</summary><param name=\"name\">Name of the service to register.</param><param name=\"instance\">Service instance to use.</param>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``1\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance \r\n\t\t\tof the service when needed.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><returns>The function that can resolve to the service instance when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``2\">\r\n            <!-- No matching elements were found for the following include tag --><include file=\"Container.xdoc\" path=\"docs/doc[@for=&quot;Container.LazyResolve{TService,TArgs}&quot;]/*\"/>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``3\">\r\n            <!-- No matching elements were found for the following include tag --><include file=\"Container.xdoc\" path=\"docs/doc[@for=&quot;Container.LazyResolve{TService,TArgs}&quot;]/*\"/>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``4\">\r\n            <!-- No matching elements were found for the following include tag --><include file=\"Container.xdoc\" path=\"docs/doc[@for=&quot;Container.LazyResolve{TService,TArgs}&quot;]/*\"/>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``5\">\r\n            <!-- No matching elements were found for the following include tag --><include file=\"Container.xdoc\" path=\"docs/doc[@for=&quot;Container.LazyResolve{TService,TArgs}&quot;]/*\"/>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``6\">\r\n            <!-- No matching elements were found for the following include tag --><include file=\"Container.xdoc\" path=\"docs/doc[@for=&quot;Container.LazyResolve{TService,TArgs}&quot;]/*\"/>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``7\">\r\n            <!-- No matching elements were found for the following include tag --><include file=\"Container.xdoc\" path=\"docs/doc[@for=&quot;Container.LazyResolve{TService,TArgs}&quot;]/*\"/>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``1(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service with the given name when needed.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``2(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service of the given type, name and service constructor arguments when needed.\r\n\t\t</summary><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given and service constructor arguments name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name and constructor arguments has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``3(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service of the given type, name and service constructor arguments when needed.\r\n\t\t</summary><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given and service constructor arguments name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name and constructor arguments has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``4(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service of the given type, name and service constructor arguments when needed.\r\n\t\t</summary><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given and service constructor arguments name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name and constructor arguments has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``5(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service of the given type, name and service constructor arguments when needed.\r\n\t\t</summary><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given and service constructor arguments name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name and constructor arguments has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``6(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service of the given type, name and service constructor arguments when needed.\r\n\t\t</summary><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given and service constructor arguments name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name and constructor arguments has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.LazyResolve``7(System.String)\">\r\n            <summary>\r\n\t\t\tRetrieves a function that can be used to lazily resolve an instance\r\n\t\t\tof the service of the given type, name and service constructor arguments when needed.\r\n\t\t</summary><param name=\"name\">Name of the service to retrieve.</param><returns>The function that can resolve to the service instance with the given and service constructor arguments name when invoked.</returns><exception cref=\"T:Funq.ResolutionException\">The requested service with the given name and constructor arguments has not been registered previously.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``1(System.Func{Funq.Container,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``2(System.Func{Funq.Container,``1,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg\">First argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``3(System.Func{Funq.Container,``1,``2,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``4(System.Func{Funq.Container,``1,``2,``3,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``5(Funq.Func{Funq.Container,``1,``2,``3,``4,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``6(Funq.Func{Funq.Container,``1,``2,``3,``4,``5,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``7(Funq.Func{Funq.Container,``1,``2,``3,``4,``5,``6,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg6\">Sixth argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``1(System.String,System.Func{Funq.Container,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``2(System.String,System.Func{Funq.Container,``1,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg\">First argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``3(System.String,System.Func{Funq.Container,``1,``2,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``4(System.String,System.Func{Funq.Container,``1,``2,``3,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``5(System.String,Funq.Func{Funq.Container,``1,``2,``3,``4,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``6(System.String,Funq.Func{Funq.Container,``1,``2,``3,``4,``5,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Register``7(System.String,Funq.Func{Funq.Container,``1,``2,``3,``4,``5,``6,``0})\">\r\n            <summary>\r\n\t\t\tRegisters the given named service by providing a factory delegate that receives arguments to\r\n\t\t\tinstantiate it.\r\n\t\t</summary><typeparam name=\"TService\">The service type to register.</typeparam><typeparam name=\"TArg1\">First argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg2\">Second argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg3\">Third argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument that should be passed to the factory delegate to create the instace.</typeparam><typeparam name=\"TArg6\">Sixth argument that should be passed to the factory delegate to create the instace.</typeparam><param name=\"name\">A name used to differenciate this service registration.</param><param name=\"factory\">The factory delegate to initialize new instances of the service when needed.</param><returns>The registration object to perform further configuration via its fluent interface.</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``1\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, without passing any arguments for\r\n\t\t\tits construction.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``2(``1)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg\">First argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``3(``1,``2)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``4(``1,``2,``3)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``5(``1,``2,``3,``4)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``6(``1,``2,``3,``4,``5)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.Resolve``7(``1,``2,``3,``4,``5,``6)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg6\">Sixth argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``1(System.String)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, without passing arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``2(System.String,``1)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg\">First argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``3(System.String,``1,``2)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``4(System.String,``1,``2,``3)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``5(System.String,``1,``2,``3,``4)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``6(System.String,``1,``2,``3,``4,``5)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.ResolveNamed``7(System.String,``1,``2,``3,``4,``5,``6)\">\r\n            <summary>\r\n\t\t\tResolves the given service by type and name, passing the given arguments\r\n\t\t\tfor its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg6\">Sixth argument to pass to the factory delegate that may create the instace.</typeparam><returns>The resolved service instance.</returns><exception cref=\"T:Funq.ResolutionException\">The given service could not be resolved.</exception>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``1\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, without passing arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``2(``1)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg\">First argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``3(``1,``2)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``4(``1,``2,``3)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``5(``1,``2,``3,``4)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``6(``1,``2,``3,``4,``5)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolve``7(``1,``2,``3,``4,``5,``6)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg6\">Sixth argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``1(System.String)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, without passing\r\n\t\t\targuments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``2(System.String,``1)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg\">First argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``3(System.String,``1,``2)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``4(System.String,``1,``2,``3)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``5(System.String,``1,``2,``3,``4)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``6(System.String,``1,``2,``3,``4,``5)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.TryResolveNamed``7(System.String,``1,``2,``3,``4,``5,``6)\">\r\n            <summary>\r\n\t\t\tAttempts to resolve the given service by type and name, passing the\r\n\t\t\tgiven arguments arguments for its initialization.\r\n\t\t</summary><typeparam name=\"TService\">Type of the service to retrieve.</typeparam><typeparam name=\"TArg1\">First argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg2\">Second argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg3\">Third argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg4\">Fourth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg5\">Fifth argument to pass to the factory delegate that may create the instace.</typeparam><typeparam name=\"TArg6\">Sixth argument to pass to the factory delegate that may create the instace.</typeparam><returns>\r\n\t\t\tThe resolved service instance or <see langword=\"null\"/> if it cannot be resolved.\r\n\t\t</returns>\r\n        </member>\r\n        <member name=\"M:Funq.Container.RegisterAutoWired``1\">\r\n            <summary>\r\n            Register an autowired dependency\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:Funq.Container.RegisterAutoWiredAs``2\">\r\n            <summary>\r\n            Register an autowired dependency as a separate type\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:Funq.Container.RegisterAs``2\">\r\n            <summary>\r\n            Alias for RegisterAutoWiredAs\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:Funq.Container.AutoWire(System.Object)\">\r\n            <summary>\r\n            Auto-wires an existing instance, \r\n            ie all public properties are tried to be resolved.\r\n            </summary>\r\n            <param name=\"instance\"></param>\r\n        </member>\r\n        <member name=\"P:Funq.Container.DefaultOwner\">\r\n            <summary>\r\n\t\t\tDefault owner for new registrations. <see cref=\"F:Funq.Owner.Container\"/> by default.\r\n\t\t</summary>\r\n        </member>\r\n        <member name=\"P:Funq.Container.DefaultReuse\">\r\n            <summary>\r\n\t\t\tDefault reuse scope for new registrations. <see cref=\"F:Funq.ReuseScope.Hierarchy\"/> by default.\r\n\t\t</summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.Configuration.AppSettings\">\r\n            <summary>\r\n            More familiar name for the new crowd.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.Ext.AllFilesHandler\">\r\n            <summary>\r\n            Summary description for $codebehindclassname$\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Formats.MarkdownFormat.SerializeToStream(ServiceStack.ServiceHost.IRequestContext,System.Object,System.IO.Stream)\">\r\n            <summary>\r\n            Render Markdown for text/markdown and text/plain ContentTypes\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ServiceOperations.GetBaseTypeWithTheSameName(System.Type)\">\r\n            <summary>\r\n            Gets the name of the base most type in the heirachy tree with the same.\r\n            \r\n            We get an exception when trying to create a schema with multiple types of the same name\r\n            like when inheriting from a DataContract with the same name.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ServiceOperations.LoadOperationTypes(System.Collections.Generic.IEnumerable{System.Type})\">\r\n            <summary>\r\n            Loads the operation types into a dictionary.\r\n            If there are multiple operation types with the same name,\r\n            the operation type that is last will be the one 'discoverable' via the service.\r\n            </summary>\r\n            <param name=\"operationTypes\">The operation types.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpRequestExtensions.GetItemOrCookie(ServiceStack.ServiceHost.IHttpRequest,System.String)\">\r\n            <summary>\r\n            Gets string value from Items[name] then Cookies[name] if exists.\r\n            Useful when *first* setting the users response cookie in the request filter.\r\n            To access the value for this initial request you need to set it in Items[].\r\n            </summary>\r\n            <returns>string value or null if it doesn't exist</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.HttpRequestExtensions.GetParam(ServiceStack.ServiceHost.IHttpRequest,System.String)\">\r\n            <summary>\r\n            Gets request paramater string value by looking in the following order:\r\n            - QueryString[name]\r\n            - FormData[name]\r\n            - Cookies[name]\r\n            - Items[name]\r\n            </summary>\r\n            <returns>string value or null if it doesn't exist</returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlProfiler\">\r\n            <summary>\r\n            Contains helper code to time sql statements.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfiler.#ctor(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Returns a new SqlProfiler to be used in the 'profiler' session.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfiler.ExecuteStartImpl(System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType)\">\r\n            <summary>\r\n            Tracks when 'command' is started.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfiler.GetInProgressCommands\">\r\n            <summary>\r\n            Returns all currently open commands on this connection\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfiler.ExecuteFinishImpl(System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType,System.Data.Common.DbDataReader)\">\r\n            <summary>\r\n            Finishes profiling for 'command', recording durations.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfiler.ReaderFinishedImpl(System.Data.Common.DbDataReader)\">\r\n            <summary>\r\n            Called when 'reader' finishes its iterations and is closed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlProfiler.Profiler\">\r\n            <summary>\r\n            The profiling session this SqlProfiler is part of.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlProfilerExtensions\">\r\n            <summary>\r\n            Helper methods that allow operation on SqlProfilers, regardless of their instantiation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfilerExtensions.ExecuteStart(ServiceStack.MiniProfiler.SqlProfiler,System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType)\">\r\n            <summary>\r\n            Tracks when 'command' is started.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfilerExtensions.ExecuteFinish(ServiceStack.MiniProfiler.SqlProfiler,System.Data.Common.DbCommand,ServiceStack.MiniProfiler.Data.ExecuteType,System.Data.Common.DbDataReader)\">\r\n            <summary>\r\n            Finishes profiling for 'command', recording durations.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlProfilerExtensions.ReaderFinish(ServiceStack.MiniProfiler.SqlProfiler,System.Data.Common.DbDataReader)\">\r\n            <summary>\r\n            Called when 'reader' finishes its iterations and is closed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.ProfileLevel\">\r\n            <summary>\r\n            Categorizes individual <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> steps to allow filtering.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.ProfileLevel.Info\">\r\n            <summary>\r\n            Default level given to Timings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.ProfileLevel.Verbose\">\r\n            <summary>\r\n            Useful when profiling many items in a loop, but you don't wish to always see this detail.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.RenderPosition\">\r\n            <summary>\r\n            Dictates on which side of the page the profiler popup button is displayed; defaults to left.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.RenderPosition.Left\">\r\n            <summary>\r\n            Profiler popup button is displayed on the left.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.RenderPosition.Right\">\r\n            <summary>\r\n            Profiler popup button is displayed on the right.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.MiniProfilerExtensions\">\r\n            <summary>\r\n            Contains helper methods that ease working with null <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/>s.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.MiniProfilerExtensions.Inline``1(ServiceStack.MiniProfiler.Profiler,System.Func{``0},System.String)\">\r\n            <summary>\r\n            Wraps <paramref name=\"selector\"/> in a <see cref=\"M:ServiceStack.MiniProfiler.MiniProfilerExtensions.Step(ServiceStack.MiniProfiler.Profiler,System.String,ServiceStack.MiniProfiler.ProfileLevel)\"/> call and executes it, returning its result.\r\n            </summary>\r\n            <param name=\"profiler\">The current profiling session or null.</param>\r\n            <param name=\"selector\">Method to execute and profile.</param>\r\n            <param name=\"name\">The <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> step name used to label the profiler results.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.MiniProfilerExtensions.Step(ServiceStack.MiniProfiler.Profiler,System.String,ServiceStack.MiniProfiler.ProfileLevel)\">\r\n            <summary>\r\n            Returns an <see cref=\"T:System.IDisposable\"/> that will time the code between its creation and disposal.\r\n            </summary>\r\n            <param name=\"profiler\">The current profiling session or null.</param>\r\n            <param name=\"name\">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param>\r\n            <param name=\"level\">This step's visibility level; allows filtering when <see cref=\"M:ServiceStack.MiniProfiler.Profiler.Start(ServiceStack.MiniProfiler.ProfileLevel)\"/> is called.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.MiniProfilerExtensions.AddProfilerResults(ServiceStack.MiniProfiler.Profiler,ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Adds <paramref name=\"externalProfiler\"/>'s <see cref=\"T:ServiceStack.MiniProfiler.Timing\"/> hierarchy to this profiler's current Timing step,\r\n            allowing other threads, remote calls, etc. to be profiled and joined into this profiling session.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.MiniProfilerExtensions.Render(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Returns an html-encoded string with a text-representation of <paramref name=\"profiler\"/>; returns \"\" when profiler is null.\r\n            </summary>\r\n            <param name=\"profiler\">The current profiling session or null.</param>\r\n        </member>\r\n        <member name=\"T:Funq.Func`6\">\r\n            <summary>\r\n            Encapsulates a method that has five parameters and returns a value of the \r\n             type specified by the <typeparamref name=\"TResult\"/> parameter.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.Func`7\">\r\n            <summary>\r\n            Encapsulates a method that has six parameters and returns a value of the \r\n             type specified by the <typeparamref name=\"TResult\"/> parameter.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.Func`8\">\r\n            <summary>\r\n            Encapsulates a method that has seven parameters and returns a value of the \r\n             type specified by the <typeparamref name=\"TResult\"/> parameter.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.IndexPageHttpHandler.ProcessRequest(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.String)\">\r\n            <summary>\r\n            Non ASP.NET requests\r\n            </summary>\r\n            <param name=\"request\"></param>\r\n            <param name=\"response\"></param>\r\n            <param name=\"operationName\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.IndexPageHttpHandler.ProcessRequest(System.Web.HttpContext)\">\r\n            <summary>\r\n            ASP.NET requests\r\n            </summary>\r\n            <param name=\"context\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlFormatters.OracleFormatter\">\r\n            <summary>\r\n            NOT IMPLEMENTED - will format statements with paramters in an Oracle friendly way\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlFormatters.OracleFormatter.FormatSql(ServiceStack.MiniProfiler.SqlTiming)\">\r\n            <summary>\r\n            Does NOTHING, implement me!\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Data.Link`2\">\r\n            <summary>\r\n            This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example),\r\n            and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE**\r\n            equality. The type is fully thread-safe.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.CacheAccess.Providers.FileAndCacheTextManager\">\r\n            <summary>\r\n            Stores both 'compressed' and 'text' caches of the dto in the FileSystem and ICacheTextManager provided.\r\n            The ContentType is inferred from the ICacheTextManager's ContentType.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.RedirectHttpHandler.ProcessRequest(ServiceStack.ServiceHost.IHttpRequest,ServiceStack.ServiceHost.IHttpResponse,System.String)\">\r\n            <summary>\r\n            Non ASP.NET requests\r\n            </summary>\r\n            <param name=\"request\"></param>\r\n            <param name=\"response\"></param>\r\n            <param name=\"operationName\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.RedirectHttpHandler.ProcessRequest(System.Web.HttpContext)\">\r\n            <summary>\r\n            ASP.NET requests\r\n            </summary>\r\n            <param name=\"context\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Storage.IStorage\">\r\n            <summary>\r\n            Provides saving and loading <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/>s to a storage medium.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.IStorage.Save(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Stores <paramref name=\"profiler\"/> under its <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>.\r\n            </summary>\r\n            <param name=\"profiler\">The results of a profiling session.</param>\r\n            <remarks>\r\n            Should also ensure the profiler is stored as being unviewed by its profiling <see cref=\"P:ServiceStack.MiniProfiler.Profiler.User\"/>.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.IStorage.Load(System.Guid)\">\r\n            <summary>\r\n            Returns a <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> from storage based on <paramref name=\"id\"/>, which should map to <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>.\r\n            </summary>\r\n            <remarks>\r\n            Should also update that the resulting profiler has been marked as viewed by its profiling <see cref=\"P:ServiceStack.MiniProfiler.Profiler.User\"/>.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.IStorage.GetUnviewedIds(System.String)\">\r\n            <summary>\r\n            Returns a list of <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>s that haven't been seen by <paramref name=\"user\"/>.\r\n            </summary>\r\n            <param name=\"user\">User identified by the current <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.UserProvider\"/>.</param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage\">\r\n            <summary>\r\n            Understands how to store a <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> to the <see cref=\"P:System.Web.HttpRuntime.Cache\"/> with absolute expiration.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.CacheKeyPrefix\">\r\n            <summary>\r\n            The string that prefixes all keys that MiniProfilers are saved under, e.g.\r\n            \"mini-profiler-ecfb0050-7ce8-4bf1-bf82-2cb38e90e31e\".\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.#ctor(System.TimeSpan)\">\r\n            <summary>\r\n            Returns a new HttpRuntimeCacheStorage class that will cache MiniProfilers for the specified duration.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.Save(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Saves <paramref name=\"profiler\"/> to the HttpRuntime.Cache under a key concated with <see cref=\"F:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.CacheKeyPrefix\"/>\r\n            and the parameter's <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.Load(System.Guid)\">\r\n            <summary>\r\n            Returns the saved <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> identified by <paramref name=\"id\"/>. Also marks the resulting\r\n            profiler <see cref=\"P:ServiceStack.MiniProfiler.Profiler.HasUserViewed\"/> to true.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.GetUnviewedIds(System.String)\">\r\n            <summary>\r\n            Returns a list of <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>s that haven't been seen by <paramref name=\"user\"/>.\r\n            </summary>\r\n            <param name=\"user\">User identified by the current <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.UserProvider\"/>.</param>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.AddPerUserUnviewedIdsLock\">\r\n            <summary>\r\n            Syncs access to runtime cache when adding a new list of ids for a user.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Storage.HttpRuntimeCacheStorage.CacheDuration\">\r\n            <summary>\r\n            How long to cache each <see cref=\"T:ServiceStack.MiniProfiler.Profiler\"/> for (i.e. the absolute expiration parameter of \r\n            <see cref=\"M:System.Web.Caching.Cache.Insert(System.String,System.Object,System.Web.Caching.CacheDependency,System.DateTime,System.TimeSpan,System.Web.Caching.CacheItemUpdateCallback)\"/>)\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase\">\r\n            <summary>\r\n            Understands how to save MiniProfiler results to a MSSQL database, allowing more permanent storage and\r\n            querying of slow results.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.#ctor(System.String)\">\r\n            <summary>\r\n            Returns a new SqlServerDatabaseStorage object that will insert into the database identified by connectionString.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.Save(ServiceStack.MiniProfiler.Profiler)\">\r\n            <summary>\r\n            Saves 'profiler' to a database under its <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.Load(System.Guid)\">\r\n            <summary>\r\n            Returns the MiniProfiler identified by 'id' from the database or null when no MiniProfiler exists under that 'id'.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.GetUnviewedIds(System.String)\">\r\n            <summary>\r\n            Returns a list of <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Id\"/>s that haven't been seen by <paramref name=\"user\"/>.\r\n            </summary>\r\n            <param name=\"user\">User identified by the current <see cref=\"P:ServiceStack.MiniProfiler.Profiler.Settings.UserProvider\"/>.</param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.GetConnection\">\r\n            <summary>\r\n            Returns a DbConnection for your specific provider.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.GetOpenConnection\">\r\n            <summary>\r\n            Returns a DbConnection already opened for execution.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.MapTimings(ServiceStack.MiniProfiler.Profiler,System.Collections.Generic.List{ServiceStack.MiniProfiler.Timing},System.Collections.Generic.List{ServiceStack.MiniProfiler.SqlTiming},System.Collections.Generic.List{ServiceStack.MiniProfiler.SqlTimingParameter})\">\r\n            <summary>\r\n            Giving freshly selected collections, this method puts them in the correct\r\n            hierarchy under the 'result' MiniProfiler.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Storage.DatabaseStorageBase.ConnectionString\">\r\n            <summary>\r\n            How we connect to the database used to save/load MiniProfiler results.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlFormatters.SqlServerFormatter\">\r\n            <summary>\r\n            Formats SQL server queries with a DECLARE up top for parameter values\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlFormatters.SqlServerFormatter.FormatSql(ServiceStack.MiniProfiler.SqlTiming)\">\r\n            <summary>\r\n            Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top.\r\n            </summary>\r\n            <param name=\"timing\">The SqlTiming to format</param>\r\n            <returns>A formatted SQL string</returns>\r\n        </member>\r\n        <member name=\"T:Funq.ResolutionException\">\r\n            <summary>\r\n            Exception thrown by the container when a service cannot be resolved.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.ResolutionException.#ctor(System.Type)\">\r\n            <summary>\r\n            Initializes the exception with the service that could not be resolved.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.ResolutionException.#ctor(System.Type,System.String)\">\r\n            <summary>\r\n            Initializes the exception with the service (and its name) that could not be resolved.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.ResolutionException.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes the exception with an arbitrary message.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.CacheAccess.Providers.FileSystemXmlCacheClient\">\r\n            <summary>\r\n            Implements a very limited subset of ICacheClient, i.e.\r\n            \r\n            \t- T Get[T]()\r\n            \t- Set(path, value)\r\n            \t- Remove(path)\r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.ServiceExecOperations\">\r\n            <summary>\r\n            Static type constants for referring to service exec methods\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbCommand.BindByName\">\r\n            <summary>\r\n            If the underlying command supports BindByName, this sets/clears the underlying\r\n            implementation accordingly. This is required to support OracleCommand from dapper-dot-net\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ContainerTypeExtensions.RegisterAutoWiredType(Funq.Container,System.Type,System.Type,Funq.ReuseScope)\">\r\n            <summary>\r\n            Registers the type in the IoC container and\r\n            adds auto-wiring to the specified type.\r\n            </summary>\r\n            <param name=\"serviceType\"></param>\r\n            <param name=\"inFunqAsType\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ContainerTypeExtensions.RegisterAutoWiredType(Funq.Container,System.Type,Funq.ReuseScope)\">\r\n            <summary>\r\n            Registers the type in the IoC container and\r\n            adds auto-wiring to the specified type.\r\n            The reuse scope is set to none (transient).\r\n            </summary>\r\n            <param name=\"serviceTypes\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ContainerTypeExtensions.RegisterAutoWiredTypes(Funq.Container,System.Collections.Generic.IEnumerable{System.Type},Funq.ReuseScope)\">\r\n            <summary>\r\n            Registers the types in the IoC container and\r\n            adds auto-wiring to the specified types.\r\n            The reuse scope is set to none (transient).\r\n            </summary>\r\n            <param name=\"serviceTypes\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.AppHostHttpListenerLongRunningBase.Start(System.String)\">\r\n            <summary>\r\n            Starts the Web Service\r\n            </summary>\r\n            <param name=\"urlBase\">\r\n            A Uri that acts as the base that the server is listening on.\r\n            Format should be: http://127.0.0.1:8080/ or http://127.0.0.1:8080/somevirtual/\r\n            Note: the trailing slash is required! For more info see the\r\n            HttpListener.Prefixes property on MSDN.\r\n            </param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.AppHostHttpListenerLongRunningBase.ThreadPoolManager.Dispose\">\r\n            <summary>\r\n            Exécute les tâches définies par l'application associées à la libération ou à la redéfinition des ressources non managées.\r\n            </summary>\r\n            <filterpriority>2</filterpriority>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.AppHostBase\">\r\n            <summary>\r\n            Inherit from this class if you want to host your web services inside an\r\n            ASP.NET application.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.AppHostBase.Resolve``1\">\r\n            <summary>\r\n            Resolves from IoC container a specified type instance.\r\n            </summary>\r\n            <typeparam name=\"T\">Type to be resolved.</typeparam>\r\n            <returns>Instance of <typeparamref name=\"T\"/>.</returns>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Data.ExecuteType\">\r\n            <summary>\r\n            Categories of sql statements.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ExecuteType.None\">\r\n            <summary>\r\n            Unknown\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ExecuteType.NonQuery\">\r\n            <summary>\r\n            DML statements that alter database state, e.g. INSERT, UPDATE\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ExecuteType.Scalar\">\r\n            <summary>\r\n            Statements that return a single record\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ExecuteType.Reader\">\r\n            <summary>\r\n            Statements that iterate over a result set\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:Funq.Owner\">\r\n            <summary>\r\n            Determines who is responsible for disposing instances \r\n            registered with a container.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.Owner.Container\">\r\n            <summary>\r\n            Container should dispose provided instances when it is disposed. This is the \r\n            default.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.Owner.External\">\r\n            <summary>\r\n            Container does not dispose provided instances.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:Funq.Owner.Default\">\r\n            <summary>\r\n            Default owner, which equals <see cref=\"F:Funq.Owner.Container\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Support.StaticFileHandler.SetDefaultFile(System.String)\">\r\n            <summary>\r\n            Keep default file contents in-memory\r\n            </summary>\r\n            <param name=\"defaultFilePath\"></param>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceHost.DtoUtils.ResponseStatusPropertyName\">\r\n            <summary>\r\n            Naming convention for the ResponseStatus property name on the response DTO\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceHost.DtoUtils.UrnServiceErrorType\">\r\n            <summary>\r\n            Service error logs are kept in 'urn:ServiceErrors:{ServiceName}'\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.ServiceHost.DtoUtils.CombinedServiceLogId\">\r\n            <summary>\r\n            Combined service error logs are maintained in 'urn:ServiceErrors:All'\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.DtoUtils.CreateResponseDto(System.Object,ServiceStack.ServiceInterface.ServiceModel.ResponseStatus)\">\r\n            <summary>\r\n            Create an instance of the service response dto type and inject it with the supplied responseStatus\r\n            </summary>\r\n            <param name=\"request\"></param>\r\n            <param name=\"responseStatus\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.DtoUtils.CreateResponseStatus(System.String,System.String,System.Collections.Generic.IEnumerable{ServiceStack.Validation.ValidationErrorField})\">\r\n            <summary>\r\n            Creates the error response from the values provided.\r\n            \r\n            If the errorCode is empty it will use the first validation error code, \r\n            if there is none it will throw an error.\r\n            </summary>\r\n            <param name=\"errorCode\">The error code.</param>\r\n            <param name=\"errorMessage\">The error message.</param>\r\n            <param name=\"validationErrors\">The validation errors.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.DtoUtils.GetRequestErrorBody(System.Object)\">\r\n            <summary>\r\n            Override to provide additional/less context about the Service Exception. \r\n            By default the request is serialized and appended to the ResponseStatus StackTrace.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.SqlTimingParameter\">\r\n            <summary>\r\n            Information about a DbParameter used in the sql statement profiled by SqlTiming.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTimingParameter.Equals(System.Object)\">\r\n            <summary>\r\n            Returns true if this has the same parent <see cref=\"P:ServiceStack.MiniProfiler.SqlTiming.Id\"/>, <see cref=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.Name\"/> and <see cref=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.Value\"/> as <paramref name=\"obj\"/>.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.SqlTimingParameter.GetHashCode\">\r\n            <summary>\r\n            Returns the XOR of certain properties.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.ParentSqlTimingId\">\r\n            <summary>\r\n            Which SqlTiming this Parameter was executed with.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.Name\">\r\n            <summary>\r\n            Parameter name, e.g. \"@routeName\"\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.Value\">\r\n            <summary>\r\n            The value submitted to the database.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.DbType\">\r\n            <summary>\r\n            System.Data.DbType, e.g. \"String\", \"Bit\"\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.SqlTimingParameter.Size\">\r\n            <summary>\r\n            How large the type is, e.g. for string, size could be 4000\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheAdd(System.String,System.Object)\">\r\n            <summary>\r\n            Add value with specified key to the cache, and set the cache entry to never expire.\r\n            </summary>\r\n            <param name=\"key\">Key associated with value.</param>\r\n            <param name=\"value\">Value being cached.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheAdd(System.String,System.Object,System.DateTime)\">\r\n            <summary>\r\n            Stores The value with key only if such key doesn't exist at the server yet. \r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <param name=\"value\">The value.</param>\r\n            <param name=\"expiresAt\">The UTC DateTime at which the cache entry expires.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheSet(System.String,System.Object)\">\r\n            <summary>\r\n            Adds or replaces the value with key, and sets the cache entry to never expire.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <param name=\"value\">The value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheSet(System.String,System.Object,System.DateTime)\">\r\n            <summary>\r\n            Adds or replaces the value with key.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <param name=\"value\">The value.</param>\r\n            <param name=\"expiresAt\">The UTC DateTime at which the cache entry expires.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheSet(System.String,System.Object,System.DateTime,System.Nullable{System.Int64})\">\r\n            <summary>\r\n            Adds or replaces the value with key. \r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <param name=\"value\">The value.</param>\r\n            <param name=\"expiresAt\">The UTC DateTime at which the cache entry expires.</param>\r\n            <param name=\"checkLastModified\">The check last modified.</param>\r\n            <returns>True; if it succeeded</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheReplace(System.String,System.Object)\">\r\n            <summary>\r\n            Replace the value with specified key if it exists, and set the cache entry to never expire.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value to be cached.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheReplace(System.String,System.Object,System.DateTime)\">\r\n            <summary>\r\n            Replace the value with specified key if it exists.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value to be cached.</param>\r\n            <param name=\"expiresAt\">The UTC DateTime at which the cache entry expires.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Add``1(System.String,``0)\">\r\n            <summary>\r\n            Add the value with key to the cache, set to never expire.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <returns>True if Add succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Set``1(System.String,``0)\">\r\n            <summary>\r\n            Add or replace the value with key to the cache, set to never expire.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <returns>True if Set succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Replace``1(System.String,``0)\">\r\n            <summary>\r\n            Replace the value with key in the cache, set to never expire.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <returns>True if Replace succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Add``1(System.String,``0,System.DateTime)\">\r\n            <summary>\r\n            Add the value with key to the cache, set to expire at specified DateTime.\r\n            </summary>\r\n            <remarks>This method examines the DateTimeKind of expiresAt to determine if conversion to\r\n            universal time is needed. The version of Add that takes a TimeSpan expiration is faster \r\n            than using this method with a DateTime of Kind other than Utc, and is not affected by \r\n            ambiguous local time during daylight savings/standard time transition.</remarks>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresAt\">The DateTime at which the cache entry expires.</param>\r\n            <returns>True if Add succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Set``1(System.String,``0,System.DateTime)\">\r\n            <summary>\r\n            Add or replace the value with key to the cache, set to expire at specified DateTime.\r\n            </summary>\r\n            <remarks>This method examines the DateTimeKind of expiresAt to determine if conversion to\r\n            universal time is needed. The version of Set that takes a TimeSpan expiration is faster \r\n            than using this method with a DateTime of Kind other than Utc, and is not affected by \r\n            ambiguous local time during daylight savings/standard time transition.</remarks>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresAt\">The DateTime at which the cache entry expires.</param>\r\n            <returns>True if Set succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Replace``1(System.String,``0,System.DateTime)\">\r\n            <summary>\r\n            Replace the value with key in the cache, set to expire at specified DateTime.\r\n            </summary>\r\n            <remarks>This method examines the DateTimeKind of expiresAt to determine if conversion to\r\n            universal time is needed. The version of Replace that takes a TimeSpan expiration is faster \r\n            than using this method with a DateTime of Kind other than Utc, and is not affected by \r\n            ambiguous local time during daylight savings/standard time transition.</remarks>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresAt\">The DateTime at which the cache entry expires.</param>\r\n            <returns>True if Replace succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Add``1(System.String,``0,System.TimeSpan)\">\r\n            <summary>\r\n            Add the value with key to the cache, set to expire after specified TimeSpan.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresIn\">The TimeSpan at which the cache entry expires.</param>\r\n            <returns>True if Add succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Set``1(System.String,``0,System.TimeSpan)\">\r\n            <summary>\r\n            Add or replace the value with key to the cache, set to expire after specified TimeSpan.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresIn\">The TimeSpan at which the cache entry expires.</param>\r\n            <returns>True if Set succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.Replace``1(System.String,``0,System.TimeSpan)\">\r\n            <summary>\r\n            Replace the value with key in the cache, set to expire after specified TimeSpan.\r\n            </summary>\r\n            <param name=\"key\">The key of the cache entry.</param>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresIn\">The TimeSpan at which the cache entry expires.</param>\r\n            <returns>True if Replace succeeds, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheEntry.#ctor(System.Object,System.DateTime)\">\r\n            <summary>\r\n            Create new instance of CacheEntry.\r\n            </summary>\r\n            <param name=\"value\">The value being cached.</param>\r\n            <param name=\"expiresAt\">The UTC time at which CacheEntry expires.</param>\r\n        </member>\r\n        <member name=\"P:ServiceStack.CacheAccess.Providers.MemoryCacheClient.CacheEntry.ExpiresAt\">\r\n            <summary>UTC time at which CacheEntry expires.</summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.WebHost.Endpoints.Extensions.HttpResponseExtensions.WriteToResponse(ServiceStack.ServiceHost.IHttpResponse,System.Object,ServiceStack.ServiceHost.ResponseSerializerDelegate,ServiceStack.ServiceHost.IRequestContext,System.Byte[],System.Byte[])\">\r\n            <summary>\r\n            Writes to response.\r\n            Response headers are customizable by implementing IHasOptions an returning Dictionary of Http headers.\r\n            </summary>\r\n            <param name=\"response\">The response.</param>\r\n            <param name=\"result\">Whether or not it was implicity handled by ServiceStack's built-in handlers.</param>\r\n            <param name=\"defaultAction\">The default action.</param>\r\n            <param name=\"serializerCtx\">The serialization context.</param>\r\n            <param name=\"bodyPrefix\">Add prefix to response body if any</param>\r\n            <param name=\"bodySuffix\">Add suffix to response body if any</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.ServiceHost.ServiceManager.#ctor(Funq.Container,ServiceStack.ServiceHost.ServiceController)\">\r\n            <summary>\r\n            Inject alternative container and strategy for resolving Service Types\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.ServiceHost.ServiceControllerReflection\">\r\n            <summary>\r\n            Keeping around just to compare how slow it is\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.WebHost.Endpoints.ActionContext\">\r\n            <summary>\r\n            Context to capture IService action\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.VirtualPath.InMemoryVirtualPathProvider\">\r\n            <summary>\r\n            In Memory repository for files. Useful for testing.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Helpers.ExtensionMethods\">\r\n            <summary>\r\n            Common extension methods to use only in this project\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.ExtensionMethods.IsNullOrWhiteSpace(System.String)\">\r\n            <summary>\r\n            Answers true if this String is either null or empty.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.ExtensionMethods.HasValue(System.String)\">\r\n            <summary>\r\n            Answers true if this String is neither null or empty.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.ExtensionMethods.EnsureTrailingSlash(System.String)\">\r\n            <summary>\r\n            Removes trailing / characters from a path and leaves just one\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.ExtensionMethods.RemoveLeadingSlash(System.String)\">\r\n            <summary>\r\n            Removes any leading / characters from a path\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.ExtensionMethods.RemoveTrailingSlash(System.String)\">\r\n            <summary>\r\n            Removes any leading / characters from a path\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Helpers.ExtensionMethods.ToJson(System.Object)\">\r\n            <summary>\r\n            Serializes <paramref name=\"o\"/> to a json string.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:Funq.AutoWireHelpers.GenerateAutoWireFn``1\">\r\n            <summary>\r\n            Generates a function which creates and auto-wires <see cref=\"!:TService\"/>.\r\n            </summary>\r\n            <typeparam name=\"TService\"></typeparam>\r\n            <param name=\"lambdaParam\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:Funq.AutoWireHelpers.AutoWire(Funq.Container,System.Object)\">\r\n            <summary>\r\n            Auto-wires an existing instance of a specific type.\r\n            The auto-wiring progress is also cached to be faster \r\n            when calling next time with the same type.\r\n            </summary>\r\n            <param name=\"instance\"></param>\r\n        </member>\r\n        <member name=\"T:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory\">\r\n            <summary>\r\n            Wrapper for a db provider factory to enable profiling\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.Instance\">\r\n            <summary>\r\n            Every provider factory must have an Instance public field\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.#ctor\">\r\n            <summary>\r\n            Used for db provider apis internally \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.InitProfiledDbProviderFactory(ServiceStack.MiniProfiler.Data.IDbProfiler,System.Data.Common.DbProviderFactory)\">\r\n            <summary>\r\n            Allow to re-init the provider factory.\r\n            </summary>\r\n            <param name=\"profiler\"></param>\r\n            <param name=\"tail\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.#ctor(ServiceStack.MiniProfiler.Data.IDbProfiler,System.Data.Common.DbProviderFactory)\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n            <param name=\"profiler\"></param>\r\n            <param name=\"tail\"></param>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateDataSourceEnumerator\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateCommand\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateConnection\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateParameter\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateConnectionStringBuilder\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateCommandBuilder\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreateDataAdapter\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CreatePermission(System.Security.Permissions.PermissionState)\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:ServiceStack.MiniProfiler.Data.ProfiledDbProviderFactory.CanCreateDataSourceEnumerator\">\r\n            <summary>\r\n            proxy\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetNullableAppSetting(System.String)\">\r\n            <summary>\r\n            Gets the nullable app setting.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetAppSetting(System.String)\">\r\n            <summary>\r\n            Gets the app setting.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.ConfigSectionExists(System.String)\">\r\n            <summary>\r\n            Determines wheter the Config section identified by the sectionName exists.\r\n            </summary>\r\n            <param name=\"sectionName\">Name of the section.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetAppSetting(System.String,System.String)\">\r\n            <summary>\r\n            Returns AppSetting[key] if exists otherwise defaultValue\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <param name=\"defaultValue\">The default value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetAppSetting``1(System.String,``0)\">\r\n            <summary>\r\n            Returns AppSetting[key] if exists otherwise defaultValue, for non-string values\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"key\">The key.</param>\r\n            <param name=\"defaultValue\">The default value.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetConnectionStringSetting(System.String)\">\r\n            <summary>\r\n            Gets the connection string setting.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetConnectionString(System.String)\">\r\n            <summary>\r\n            Gets the connection string.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetListFromAppSetting(System.String)\">\r\n            <summary>\r\n            Gets the list from app setting.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetDictionaryFromAppSetting(System.String)\">\r\n            <summary>\r\n            Gets the dictionary from app setting.\r\n            </summary>\r\n            <param name=\"key\">The key.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetParseMethod(System.Type)\">\r\n            <summary>\r\n            Get the static Parse(string) method on the type supplied\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n            <returns>A delegate to the type's Parse(string) if it has one</returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.GetConstructorInfo(System.Type)\">\r\n            <summary>\r\n            Gets the constructor info for T(string) if exists.\r\n            </summary>\r\n            <param name=\"type\">The type.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:ServiceStack.Configuration.ConfigUtils.ParseTextValue``1(System.String)\">\r\n            <summary>\r\n            Returns the value returned by the 'T.Parse(string)' method if exists otherwise 'new T(string)'. \r\n            e.g. if T was a TimeSpan it will return TimeSpan.Parse(textValue).\r\n            If there is no Parse Method it will attempt to create a new instance of the destined type\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n            <param name=\"textValue\">The default value.</param>\r\n            <returns>T.Parse(string) or new T(string) value</returns>\r\n        </member>\r\n    </members>\r\n</doc>\r\n"
  },
  {
    "path": "Tools/Toboggan/mac-setup.sh",
    "content": "rm -rf System.Runtime.Serialization.dll libsqlite3.0.dylib JSon2BJSon.zip JSon2BJSon\n\ncurl -L \"https://docs.google.com/uc?export=download&id=0B7mEHYPXtU8iS0xIOFF3WkFRQ2c\" > System.Runtime.Serialization.dll\n\ncurl -L \"https://docs.google.com/uc?export=download&id=0B7mEHYPXtU8ieUY2dE0zTHN5QzA\" > libsqlite3.0.dylib\n\ncurl -L \"https://docs.google.com/uc?export=download&id=0B7mEHYPXtU8iN0pZTWNIZzJZRUU\" > JSon2BJSon.zip\nunzip JSon2BJSon.zip\ncd ./JSon2BJSon\n./build.sh\ncd ../\nrm -rf JSon2BJSon.zip JSon2BJSon\n"
  },
  {
    "path": "Tools/Toboggan/nunit.framework.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<doc>\r\n    <assembly>\r\n        <name>nunit.framework</name>\r\n    </assembly>\r\n    <members>\r\n        <member name=\"T:NUnit.Framework.CategoryAttribute\">\r\n            <summary>\r\n            Attribute used to apply a category to a test\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.CategoryAttribute.categoryName\">\r\n            <summary>\r\n            The name of the category\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CategoryAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Construct attribute for a given category based on\r\n            a name. The name may not contain the characters ',',\r\n            '+', '-' or '!'. However, this is not checked in the\r\n            constructor since it would cause an error to arise at\r\n            as the test was loaded without giving a clear indication\r\n            of where the problem is located. The error is handled\r\n            in NUnitFramework.cs by marking the test as not\r\n            runnable.\r\n            </summary>\r\n            <param name=\"name\">The name of the category</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CategoryAttribute.#ctor\">\r\n            <summary>\r\n            Protected constructor uses the Type name as the name\r\n            of the category.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.CategoryAttribute.Name\">\r\n            <summary>\r\n            The name of the category\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.DatapointAttribute\">\r\n            <summary>\r\n            Used to mark a field for use as a datapoint when executing a theory\r\n            within the same fixture that requires an argument of the field's Type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.DatapointsAttribute\">\r\n            <summary>\r\n            Used to mark an array as containing a set of datapoints to be used\r\n            executing a theory within the same fixture that requires an argument \r\n            of the Type of the array elements.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.DescriptionAttribute\">\r\n            <summary>\r\n            Attribute used to provide descriptive text about a \r\n            test case or fixture.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DescriptionAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Construct the attribute\r\n            </summary>\r\n            <param name=\"description\">Text describing the test</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.DescriptionAttribute.Description\">\r\n            <summary>\r\n            Gets the test description\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.MessageMatch\">\r\n            <summary>\r\n            Enumeration indicating how the expected message parameter is to be used\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.MessageMatch.Exact\">\r\n            Expect an exact match\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.MessageMatch.Contains\">\r\n            Expect a message containing the parameter string\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.MessageMatch.Regex\">\r\n            Match the regular expression provided as a parameter\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.MessageMatch.StartsWith\">\r\n            Expect a message that starts with the parameter string\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ExpectedExceptionAttribute\">\r\n            <summary>\r\n            ExpectedExceptionAttribute\r\n            </summary>\r\n            \r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ExpectedExceptionAttribute.#ctor\">\r\n            <summary>\r\n            Constructor for a non-specific exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ExpectedExceptionAttribute.#ctor(System.Type)\">\r\n            <summary>\r\n            Constructor for a given type of exception\r\n            </summary>\r\n            <param name=\"exceptionType\">The type of the expected exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ExpectedExceptionAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Constructor for a given exception name\r\n            </summary>\r\n            <param name=\"exceptionName\">The full name of the expected exception</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExpectedExceptionAttribute.ExpectedException\">\r\n            <summary>\r\n            Gets or sets the expected exception type\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExpectedExceptionAttribute.ExpectedExceptionName\">\r\n            <summary>\r\n            Gets or sets the full Type name of the expected exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExpectedExceptionAttribute.ExpectedMessage\">\r\n            <summary>\r\n            Gets or sets the expected message text\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExpectedExceptionAttribute.UserMessage\">\r\n            <summary>\r\n            Gets or sets the user message displayed in case of failure\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExpectedExceptionAttribute.MatchType\">\r\n            <summary>\r\n             Gets or sets the type of match to be performed on the expected message\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExpectedExceptionAttribute.Handler\">\r\n            <summary>\r\n             Gets the name of a method to be used as an exception handler\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ExplicitAttribute\">\r\n            <summary>\r\n            ExplicitAttribute marks a test or test fixture so that it will\r\n            only be run if explicitly executed from the gui or command line\r\n            or if it is included by use of a filter. The test will not be\r\n            run simply because an enclosing suite is run.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ExplicitAttribute.#ctor\">\r\n            <summary>\r\n            Default constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ExplicitAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Constructor with a reason\r\n            </summary>\r\n            <param name=\"reason\">The reason test is marked explicit</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ExplicitAttribute.Reason\">\r\n            <summary>\r\n            The reason test is marked explicit\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.IgnoreAttribute\">\r\n            <summary>\r\n            Attribute used to mark a test that is to be ignored.\r\n            Ignored tests result in a warning message when the\r\n            tests are run.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IgnoreAttribute.#ctor\">\r\n            <summary>\r\n            Constructs the attribute without giving a reason \r\n            for ignoring the test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IgnoreAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Constructs the attribute giving a reason for ignoring the test\r\n            </summary>\r\n            <param name=\"reason\">The reason for ignoring the test</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.IgnoreAttribute.Reason\">\r\n            <summary>\r\n            The reason for ignoring a test\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.IncludeExcludeAttribute\">\r\n            <summary>\r\n            Abstract base for Attributes that are used to include tests\r\n            in the test run based on environmental settings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IncludeExcludeAttribute.#ctor\">\r\n            <summary>\r\n            Constructor with no included items specified, for use\r\n            with named property syntax.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IncludeExcludeAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Constructor taking one or more included items\r\n            </summary>\r\n            <param name=\"include\">Comma-delimited list of included items</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.IncludeExcludeAttribute.Include\">\r\n            <summary>\r\n            Name of the item that is needed in order for\r\n            a test to run. Multiple itemss may be given,\r\n            separated by a comma.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.IncludeExcludeAttribute.Exclude\">\r\n            <summary>\r\n            Name of the item to be excluded. Multiple items\r\n            may be given, separated by a comma.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.IncludeExcludeAttribute.Reason\">\r\n            <summary>\r\n            The reason for including or excluding the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.PlatformAttribute\">\r\n            <summary>\r\n            PlatformAttribute is used to mark a test fixture or an\r\n            individual method as applying to a particular platform only.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PlatformAttribute.#ctor\">\r\n            <summary>\r\n            Constructor with no platforms specified, for use\r\n            with named property syntax.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PlatformAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Constructor taking one or more platforms\r\n            </summary>\r\n            <param name=\"platforms\">Comma-deliminted list of platforms</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.CultureAttribute\">\r\n            <summary>\r\n            CultureAttribute is used to mark a test fixture or an\r\n            individual method as applying to a particular Culture only.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CultureAttribute.#ctor\">\r\n            <summary>\r\n            Constructor with no cultures specified, for use\r\n            with named property syntax.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CultureAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Constructor taking one or more cultures\r\n            </summary>\r\n            <param name=\"cultures\">Comma-deliminted list of cultures</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.CombinatorialAttribute\">\r\n            <summary>\r\n            Marks a test to use a combinatorial join of any argument data \r\n            provided. NUnit will create a test case for every combination of \r\n            the arguments provided. This can result in a large number of test\r\n            cases and so should be used judiciously. This is the default join\r\n            type, so the attribute need not be used except as documentation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.PropertyAttribute\">\r\n            <summary>\r\n            PropertyAttribute is used to attach information to a test as a name/value pair..\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PropertyAttribute.#ctor(System.String,System.String)\">\r\n            <summary>\r\n            Construct a PropertyAttribute with a name and string value\r\n            </summary>\r\n            <param name=\"propertyName\">The name of the property</param>\r\n            <param name=\"propertyValue\">The property value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PropertyAttribute.#ctor(System.String,System.Int32)\">\r\n            <summary>\r\n            Construct a PropertyAttribute with a name and int value\r\n            </summary>\r\n            <param name=\"propertyName\">The name of the property</param>\r\n            <param name=\"propertyValue\">The property value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PropertyAttribute.#ctor(System.String,System.Double)\">\r\n            <summary>\r\n            Construct a PropertyAttribute with a name and double value\r\n            </summary>\r\n            <param name=\"propertyName\">The name of the property</param>\r\n            <param name=\"propertyValue\">The property value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PropertyAttribute.#ctor\">\r\n            <summary>\r\n            Constructor for derived classes that set the\r\n            property dictionary directly.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PropertyAttribute.#ctor(System.Object)\">\r\n            <summary>\r\n            Constructor for use by derived classes that use the\r\n            name of the type as the property name. Derived classes\r\n            must ensure that the Type of the property value is\r\n            a standard type supported by the BCL. Any custom\r\n            types will cause a serialization Exception when\r\n            in the client.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.PropertyAttribute.Properties\">\r\n            <summary>\r\n            Gets the property dictionary for this attribute\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CombinatorialAttribute.#ctor\">\r\n            <summary>\r\n            Default constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.PairwiseAttribute\">\r\n            <summary>\r\n            Marks a test to use pairwise join of any argument data provided. \r\n            NUnit will attempt too excercise every pair of argument values at \r\n            least once, using as small a number of test cases as it can. With\r\n            only two arguments, this is the same as a combinatorial join.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.PairwiseAttribute.#ctor\">\r\n            <summary>\r\n            Default constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SequentialAttribute\">\r\n            <summary>\r\n            Marks a test to use a sequential join of any argument data\r\n            provided. NUnit will use arguements for each parameter in\r\n            sequence, generating test cases up to the largest number\r\n            of argument values provided and using null for any arguments\r\n            for which it runs out of values. Normally, this should be\r\n            used with the same number of arguments for each parameter.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.SequentialAttribute.#ctor\">\r\n            <summary>\r\n            Default constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.MaxTimeAttribute\">\r\n            <summary>\r\n            Summary description for MaxTimeAttribute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.MaxTimeAttribute.#ctor(System.Int32)\">\r\n            <summary>\r\n            Construct a MaxTimeAttribute, given a time in milliseconds.\r\n            </summary>\r\n            <param name=\"milliseconds\">The maximum elapsed time in milliseconds</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RandomAttribute\">\r\n            <summary>\r\n            RandomAttribute is used to supply a set of random values\r\n            to a single parameter of a parameterized test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ValuesAttribute\">\r\n            <summary>\r\n            ValuesAttribute is used to provide literal arguments for\r\n            an individual parameter of a test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ParameterDataAttribute\">\r\n            <summary>\r\n            Abstract base class for attributes that apply to parameters \r\n            and supply data for the parameter.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ParameterDataAttribute.GetData(System.Reflection.ParameterInfo)\">\r\n            <summary>\r\n            Gets the data to be provided to the specified parameter\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.ValuesAttribute.data\">\r\n            <summary>\r\n            The collection of data to be returned. Must\r\n            be set by any derived attribute classes.\r\n            We use an object[] so that the individual\r\n            elements may have their type changed in GetData\r\n            if necessary.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValuesAttribute.#ctor(System.Object)\">\r\n            <summary>\r\n            Construct with one argument\r\n            </summary>\r\n            <param name=\"arg1\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValuesAttribute.#ctor(System.Object,System.Object)\">\r\n            <summary>\r\n            Construct with two arguments\r\n            </summary>\r\n            <param name=\"arg1\"></param>\r\n            <param name=\"arg2\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValuesAttribute.#ctor(System.Object,System.Object,System.Object)\">\r\n            <summary>\r\n            Construct with three arguments\r\n            </summary>\r\n            <param name=\"arg1\"></param>\r\n            <param name=\"arg2\"></param>\r\n            <param name=\"arg3\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValuesAttribute.#ctor(System.Object[])\">\r\n            <summary>\r\n            Construct with an array of arguments\r\n            </summary>\r\n            <param name=\"args\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValuesAttribute.GetData(System.Reflection.ParameterInfo)\">\r\n            <summary>\r\n            Get the collection of values to be used as arguments\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RandomAttribute.#ctor(System.Int32)\">\r\n            <summary>\r\n            Construct a set of doubles from 0.0 to 1.0,\r\n            specifying only the count.\r\n            </summary>\r\n            <param name=\"count\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RandomAttribute.#ctor(System.Double,System.Double,System.Int32)\">\r\n            <summary>\r\n            Construct a set of doubles from min to max\r\n            </summary>\r\n            <param name=\"min\"></param>\r\n            <param name=\"max\"></param>\r\n            <param name=\"count\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RandomAttribute.#ctor(System.Int32,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Construct a set of ints from min to max\r\n            </summary>\r\n            <param name=\"min\"></param>\r\n            <param name=\"max\"></param>\r\n            <param name=\"count\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RandomAttribute.GetData(System.Reflection.ParameterInfo)\">\r\n            <summary>\r\n            Get the collection of values to be used as arguments\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RangeAttribute\">\r\n            <summary>\r\n            RangeAttribute is used to supply a range of values to an\r\n            individual parameter of a parameterized test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RangeAttribute.#ctor(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Construct a range of ints using default step of 1\r\n            </summary>\r\n            <param name=\"from\"></param>\r\n            <param name=\"to\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RangeAttribute.#ctor(System.Int32,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Construct a range of ints specifying the step size \r\n            </summary>\r\n            <param name=\"from\"></param>\r\n            <param name=\"to\"></param>\r\n            <param name=\"step\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RangeAttribute.#ctor(System.Int64,System.Int64,System.Int64)\">\r\n            <summary>\r\n            Construct a range of longs\r\n            </summary>\r\n            <param name=\"from\"></param>\r\n            <param name=\"to\"></param>\r\n            <param name=\"step\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RangeAttribute.#ctor(System.Double,System.Double,System.Double)\">\r\n            <summary>\r\n            Construct a range of doubles\r\n            </summary>\r\n            <param name=\"from\"></param>\r\n            <param name=\"to\"></param>\r\n            <param name=\"step\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RangeAttribute.#ctor(System.Single,System.Single,System.Single)\">\r\n            <summary>\r\n            Construct a range of floats\r\n            </summary>\r\n            <param name=\"from\"></param>\r\n            <param name=\"to\"></param>\r\n            <param name=\"step\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RepeatAttribute\">\r\n            <summary>\r\n            RepeatAttribute may be applied to test case in order\r\n            to run it multiple times.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RepeatAttribute.#ctor(System.Int32)\">\r\n            <summary>\r\n            Construct a RepeatAttribute\r\n            </summary>\r\n            <param name=\"count\">The number of times to run the test</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RequiredAddinAttribute\">\r\n            <summary>\r\n            RequiredAddinAttribute may be used to indicate the names of any addins\r\n            that must be present in order to run some or all of the tests in an\r\n            assembly. If the addin is not loaded, the entire assembly is marked\r\n            as NotRunnable.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RequiredAddinAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:RequiredAddinAttribute\"/> class.\r\n            </summary>\r\n            <param name=\"requiredAddin\">The required addin.</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.RequiredAddinAttribute.RequiredAddin\">\r\n            <summary>\r\n            Gets the name of required addin.\r\n            </summary>\r\n            <value>The required addin name.</value>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SetCultureAttribute\">\r\n            <summary>\r\n            Summary description for SetCultureAttribute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.SetCultureAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Construct given the name of a culture\r\n            </summary>\r\n            <param name=\"culture\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SetUICultureAttribute\">\r\n            <summary>\r\n            Summary description for SetUICultureAttribute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.SetUICultureAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Construct given the name of a culture\r\n            </summary>\r\n            <param name=\"culture\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SetUpAttribute\">\r\n            <summary>\r\n            SetUpAttribute is used in a TestFixture to identify a method\r\n            that is called immediately before each test is run. It is \r\n            also used in a SetUpFixture to identify the method that is\r\n            called once, before any of the subordinate tests are run.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SetUpFixtureAttribute\">\r\n            <summary>\r\n            Attribute used to mark a class that contains one-time SetUp \r\n            and/or TearDown methods that apply to all the tests in a\r\n            namespace or an assembly.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SuiteAttribute\">\r\n            <summary>\r\n            Attribute used to mark a static (shared in VB) property\r\n            that returns a list of tests.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TearDownAttribute\">\r\n            <summary>\r\n            Attribute used in a TestFixture to identify a method that is \r\n            called immediately after each test is run. It is also used\r\n            in a SetUpFixture to identify the method that is called once,\r\n            after all subordinate tests have run. In either case, the method \r\n            is guaranteed to be called, even if an exception is thrown.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestActionAttribute\">\r\n            <summary>\r\n            Provide actions to execute before and after tests.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ITestAction\">\r\n            <summary>\r\n            When implemented by an attribute, this interface implemented to provide actions to execute before and after tests.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ITestAction.BeforeTest(NUnit.Framework.TestDetails)\">\r\n            <summary>\r\n            Executed before each test is run\r\n            </summary>\r\n            <param name=\"testDetails\">Provides details about the test that is going to be run.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ITestAction.AfterTest(NUnit.Framework.TestDetails)\">\r\n            <summary>\r\n            Executed after each test is run\r\n            </summary>\r\n            <param name=\"testDetails\">Provides details about the test that has just been run.</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestAction.Targets\">\r\n            <summary>\r\n            Provides the target for the action attribute\r\n            </summary>\r\n            <returns>The target for the action attribute</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestAttribute\">\r\n            <summary>\r\n            Adding this attribute to a method within a <seealso cref=\"T:NUnit.Framework.TestFixtureAttribute\"/> \r\n            class makes the method callable from the NUnit test runner. There is a property \r\n            called Description which is optional which you can provide a more detailed test\r\n            description. This class cannot be inherited.\r\n            </summary>\r\n            \r\n            <example>\r\n            [TestFixture]\r\n            public class Fixture\r\n            {\r\n              [Test]\r\n              public void MethodToTest()\r\n              {}\r\n              \r\n              [Test(Description = \"more detailed description\")]\r\n              publc void TestDescriptionMethod()\r\n              {}\r\n            }\r\n            </example>\r\n            \r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestAttribute.Description\">\r\n            <summary>\r\n            Descriptive text for this test\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestCaseAttribute\">\r\n            <summary>\r\n            TestCaseAttribute is used to mark parameterized test cases\r\n            and provide them with their arguments.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ITestCaseData\">\r\n            <summary>\r\n            The ITestCaseData interface is implemented by a class\r\n            that is able to return complete testcases for use by\r\n            a parameterized test method.\r\n            \r\n            NOTE: This interface is used in both the framework\r\n            and the core, even though that results in two different\r\n            types. However, sharing the source code guarantees that\r\n            the various implementations will be compatible and that\r\n            the core is able to reflect successfully over the\r\n            framework implementations of ITestCaseData.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.Arguments\">\r\n            <summary>\r\n            Gets the argument list to be provided to the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.Result\">\r\n            <summary>\r\n            Gets the expected result\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.HasExpectedResult\">\r\n            <summary>\r\n            Indicates whether a result has been specified.\r\n            This is necessary because the result may be\r\n            null, so it's value cannot be checked.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.ExpectedException\">\r\n            <summary>\r\n             Gets the expected exception Type\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.ExpectedExceptionName\">\r\n            <summary>\r\n            Gets the FullName of the expected exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.TestName\">\r\n            <summary>\r\n            Gets the name to be used for the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.Description\">\r\n            <summary>\r\n            Gets the description of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.Ignored\">\r\n            <summary>\r\n            Gets a value indicating whether this <see cref=\"T:NUnit.Framework.ITestCaseData\"/> is ignored.\r\n            </summary>\r\n            <value><c>true</c> if ignored; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.Explicit\">\r\n            <summary>\r\n            Gets a value indicating whether this <see cref=\"T:NUnit.Framework.ITestCaseData\"/> is explicit.\r\n            </summary>\r\n            <value><c>true</c> if explicit; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ITestCaseData.IgnoreReason\">\r\n            <summary>\r\n            Gets the ignore reason.\r\n            </summary>\r\n            <value>The ignore reason.</value>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseAttribute.#ctor(System.Object[])\">\r\n            <summary>\r\n            Construct a TestCaseAttribute with a list of arguments.\r\n            This constructor is not CLS-Compliant\r\n            </summary>\r\n            <param name=\"arguments\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseAttribute.#ctor(System.Object)\">\r\n            <summary>\r\n            Construct a TestCaseAttribute with a single argument\r\n            </summary>\r\n            <param name=\"arg\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseAttribute.#ctor(System.Object,System.Object)\">\r\n            <summary>\r\n            Construct a TestCaseAttribute with a two arguments\r\n            </summary>\r\n            <param name=\"arg1\"></param>\r\n            <param name=\"arg2\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseAttribute.#ctor(System.Object,System.Object,System.Object)\">\r\n            <summary>\r\n            Construct a TestCaseAttribute with a three arguments\r\n            </summary>\r\n            <param name=\"arg1\"></param>\r\n            <param name=\"arg2\"></param>\r\n            <param name=\"arg3\"></param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Arguments\">\r\n            <summary>\r\n            Gets the list of arguments to a test case\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Result\">\r\n            <summary>\r\n            Gets or sets the expected result. Use\r\n            ExpectedResult by preference.\r\n            </summary>\r\n            <value>The result.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.ExpectedResult\">\r\n            <summary>\r\n            Gets or sets the expected result.\r\n            </summary>\r\n            <value>The result.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.HasExpectedResult\">\r\n            <summary>\r\n            Gets a flag indicating whether an expected\r\n            result has been set.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Categories\">\r\n            <summary>\r\n            Gets a list of categories associated with this test;\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Category\">\r\n            <summary>\r\n            Gets or sets the category associated with this test.\r\n            May be a single category or a comma-separated list.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.ExpectedException\">\r\n            <summary>\r\n            Gets or sets the expected exception.\r\n            </summary>\r\n            <value>The expected exception.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.ExpectedExceptionName\">\r\n            <summary>\r\n            Gets or sets the name the expected exception.\r\n            </summary>\r\n            <value>The expected name of the exception.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.ExpectedMessage\">\r\n            <summary>\r\n            Gets or sets the expected message of the expected exception\r\n            </summary>\r\n            <value>The expected message of the exception.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.MatchType\">\r\n            <summary>\r\n             Gets or sets the type of match to be performed on the expected message\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Description\">\r\n            <summary>\r\n            Gets or sets the description.\r\n            </summary>\r\n            <value>The description.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.TestName\">\r\n            <summary>\r\n            Gets or sets the name of the test.\r\n            </summary>\r\n            <value>The name of the test.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Ignore\">\r\n            <summary>\r\n            Gets or sets the ignored status of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Ignored\">\r\n            <summary>\r\n            Gets or sets the ignored status of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Explicit\">\r\n            <summary>\r\n            Gets or sets the explicit status of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.Reason\">\r\n            <summary>\r\n            Gets or sets the reason for not running the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseAttribute.IgnoreReason\">\r\n            <summary>\r\n            Gets or sets the reason for not running the test.\r\n            Set has the side effect of marking the test as ignored.\r\n            </summary>\r\n            <value>The ignore reason.</value>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestCaseSourceAttribute\">\r\n            <summary>\r\n            FactoryAttribute indicates the source to be used to\r\n            provide test cases for a test method.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseSourceAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Construct with the name of the data source, which must\r\n            be a property, field or method of the test class itself.\r\n            </summary>\r\n            <param name=\"sourceName\">An array of the names of the factories that will provide data</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseSourceAttribute.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct with a Type, which must implement IEnumerable\r\n            </summary>\r\n            <param name=\"sourceType\">The Type that will provide data</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseSourceAttribute.#ctor(System.Type,System.String)\">\r\n            <summary>\r\n            Construct with a Type and name.\r\n            that don't support params arrays.\r\n            </summary>\r\n            <param name=\"sourceType\">The Type that will provide data</param>\r\n            <param name=\"sourceName\">The name of the method, property or field that will provide data</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseSourceAttribute.SourceName\">\r\n            <summary>\r\n            The name of a the method, property or fiend to be used as a source\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseSourceAttribute.SourceType\">\r\n            <summary>\r\n            A Type to be used as a source\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseSourceAttribute.Category\">\r\n            <summary>\r\n            Gets or sets the category associated with this test.\r\n            May be a single category or a comma-separated list.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestFixtureAttribute\">\r\n            <example>\r\n            [TestFixture]\r\n            public class ExampleClass \r\n            {}\r\n            </example>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestFixtureAttribute.#ctor\">\r\n            <summary>\r\n            Default constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestFixtureAttribute.#ctor(System.Object[])\">\r\n            <summary>\r\n            Construct with a object[] representing a set of arguments. \r\n            In .NET 2.0, the arguments may later be separated into\r\n            type arguments and constructor arguments.\r\n            </summary>\r\n            <param name=\"arguments\"></param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.Description\">\r\n            <summary>\r\n            Descriptive text for this fixture\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.Category\">\r\n            <summary>\r\n            Gets and sets the category for this fixture.\r\n            May be a comma-separated list of categories.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.Categories\">\r\n            <summary>\r\n            Gets a list of categories for this fixture\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.Arguments\">\r\n            <summary>\r\n            The arguments originally provided to the attribute\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.Ignore\">\r\n            <summary>\r\n            Gets or sets a value indicating whether this <see cref=\"T:NUnit.Framework.TestFixtureAttribute\"/> should be ignored.\r\n            </summary>\r\n            <value><c>true</c> if ignore; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.IgnoreReason\">\r\n            <summary>\r\n            Gets or sets the ignore reason. May set Ignored as a side effect.\r\n            </summary>\r\n            <value>The ignore reason.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestFixtureAttribute.TypeArgs\">\r\n            <summary>\r\n            Get or set the type arguments. If not set\r\n            explicitly, any leading arguments that are\r\n            Types are taken as type arguments.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestFixtureSetUpAttribute\">\r\n            <summary>\r\n            Attribute used to identify a method that is \r\n            called before any tests in a fixture are run.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestFixtureTearDownAttribute\">\r\n            <summary>\r\n            Attribute used to identify a method that is called after\r\n            all the tests in a fixture have run. The method is \r\n            guaranteed to be called, even if an exception is thrown.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TheoryAttribute\">\r\n            <summary>\r\n            Adding this attribute to a method within a <seealso cref=\"T:NUnit.Framework.TestFixtureAttribute\"/> \r\n            class makes the method callable from the NUnit test runner. There is a property \r\n            called Description which is optional which you can provide a more detailed test\r\n            description. This class cannot be inherited.\r\n            </summary>\r\n            \r\n            <example>\r\n            [TestFixture]\r\n            public class Fixture\r\n            {\r\n              [Test]\r\n              public void MethodToTest()\r\n              {}\r\n              \r\n              [Test(Description = \"more detailed description\")]\r\n              publc void TestDescriptionMethod()\r\n              {}\r\n            }\r\n            </example>\r\n            \r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TimeoutAttribute\">\r\n            <summary>\r\n            Used on a method, marks the test with a timeout value in milliseconds. \r\n            The test will be run in a separate thread and is cancelled if the timeout \r\n            is exceeded. Used on a method or assembly, sets the default timeout \r\n            for all contained test methods.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TimeoutAttribute.#ctor(System.Int32)\">\r\n            <summary>\r\n            Construct a TimeoutAttribute given a time in milliseconds\r\n            </summary>\r\n            <param name=\"timeout\">The timeout value in milliseconds</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RequiresSTAAttribute\">\r\n            <summary>\r\n            Marks a test that must run in the STA, causing it\r\n            to run in a separate thread if necessary.\r\n            \r\n            On methods, you may also use STAThreadAttribute\r\n            to serve the same purpose.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RequiresSTAAttribute.#ctor\">\r\n            <summary>\r\n            Construct a RequiresSTAAttribute\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RequiresMTAAttribute\">\r\n            <summary>\r\n            Marks a test that must run in the MTA, causing it\r\n            to run in a separate thread if necessary.\r\n            \r\n            On methods, you may also use MTAThreadAttribute\r\n            to serve the same purpose.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RequiresMTAAttribute.#ctor\">\r\n            <summary>\r\n            Construct a RequiresMTAAttribute\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.RequiresThreadAttribute\">\r\n            <summary>\r\n            Marks a test that must run on a separate thread.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RequiresThreadAttribute.#ctor\">\r\n            <summary>\r\n            Construct a RequiresThreadAttribute\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.RequiresThreadAttribute.#ctor(System.Threading.ApartmentState)\">\r\n            <summary>\r\n            Construct a RequiresThreadAttribute, specifying the apartment\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ValueSourceAttribute\">\r\n            <summary>\r\n            ValueSourceAttribute indicates the source to be used to\r\n            provide data for one parameter of a test method.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValueSourceAttribute.#ctor(System.String)\">\r\n            <summary>\r\n            Construct with the name of the factory - for use with languages\r\n            that don't support params arrays.\r\n            </summary>\r\n            <param name=\"sourceName\">The name of the data source to be used</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ValueSourceAttribute.#ctor(System.Type,System.String)\">\r\n            <summary>\r\n            Construct with a Type and name - for use with languages\r\n            that don't support params arrays.\r\n            </summary>\r\n            <param name=\"sourceType\">The Type that will provide data</param>\r\n            <param name=\"sourceName\">The name of the method, property or field that will provide data</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ValueSourceAttribute.SourceName\">\r\n            <summary>\r\n            The name of a the method, property or fiend to be used as a source\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.ValueSourceAttribute.SourceType\">\r\n            <summary>\r\n            A Type to be used as a source\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AttributeExistsConstraint\">\r\n            <summary>\r\n            AttributeExistsConstraint tests for the presence of a\r\n            specified attribute on  a Type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.Constraint\">\r\n            <summary>\r\n            The Constraint class is the base of all built-in constraints\r\n            within NUnit. It provides the operator overloads used to combine \r\n            constraints.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.IResolveConstraint\">\r\n            <summary>\r\n            The IConstraintExpression interface is implemented by all\r\n            complete and resolvable constraints and expressions.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.IResolveConstraint.Resolve\">\r\n            <summary>\r\n            Return the top-level constraint for this expression\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.Constraint.UNSET\">\r\n            <summary>\r\n            Static UnsetObject used to detect derived constraints\r\n            failing to set the actual value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.Constraint.actual\">\r\n            <summary>\r\n            The actual value being tested against a constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.Constraint.displayName\">\r\n            <summary>\r\n            The display name of this Constraint for use by ToString()\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.Constraint.argcnt\">\r\n            <summary>\r\n            Argument fields used by ToString();\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.Constraint.builder\">\r\n            <summary>\r\n            The builder holding this constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.#ctor\">\r\n            <summary>\r\n            Construct a constraint with no arguments\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Construct a constraint with one argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.#ctor(System.Object,System.Object)\">\r\n            <summary>\r\n            Construct a constraint with two arguments\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.SetBuilder(NUnit.Framework.Constraints.ConstraintBuilder)\">\r\n            <summary>\r\n            Sets the ConstraintBuilder holding this constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.WriteMessageTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the failure message to the MessageWriter provided\r\n            as an argument. The default implementation simply passes\r\n            the constraint and the actual value to the writer, which\r\n            then displays the constraint description and the value.\r\n            \r\n            Constraints that need to provide additional details,\r\n            such as where the error occured can override this.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter on which to display the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.Matches(NUnit.Framework.Constraints.ActualValueDelegate)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by an\r\n            ActualValueDelegate that returns the value to be tested.\r\n            The default implementation simply evaluates the delegate\r\n            but derived classes may override it to provide for delayed \r\n            processing.\r\n            </summary>\r\n            <param name=\"del\">An ActualValueDelegate</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.Matches``1(``0@)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given reference.\r\n            The default implementation simply dereferences the value but\r\n            derived classes may override it to provide for delayed processing.\r\n            </summary>\r\n            <param name=\"actual\">A reference to the value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.ToString\">\r\n            <summary>\r\n            Default override of ToString returns the constraint DisplayName\r\n            followed by any arguments within angle brackets.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of this constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.op_BitwiseAnd(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied only if both \r\n            argument constraints are satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.op_BitwiseOr(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied if either \r\n            of the argument constraints is satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.op_LogicalNot(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied if the \r\n            argument constraint is not satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.After(System.Int32)\">\r\n            <summary>\r\n            Returns a DelayedConstraint with the specified delay time.\r\n            </summary>\r\n            <param name=\"delayInMilliseconds\">The delay in milliseconds.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Constraint.After(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Returns a DelayedConstraint with the specified delay time\r\n            and polling interval.\r\n            </summary>\r\n            <param name=\"delayInMilliseconds\">The delay in milliseconds.</param>\r\n            <param name=\"pollingInterval\">The interval at which to test the constraint.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Constraint.DisplayName\">\r\n            <summary>\r\n            The display name of this Constraint for use by ToString().\r\n            The default value is the name of the constraint with\r\n            trailing \"Constraint\" removed. Derived classes may set\r\n            this to another name in their constructors.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Constraint.And\">\r\n            <summary>\r\n            Returns a ConstraintExpression by appending And\r\n            to the current constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Constraint.With\">\r\n            <summary>\r\n            Returns a ConstraintExpression by appending And\r\n            to the current constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Constraint.Or\">\r\n            <summary>\r\n            Returns a ConstraintExpression by appending Or\r\n            to the current constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.Constraint.UnsetObject\">\r\n            <summary>\r\n            Class used to detect any derived constraints\r\n            that fail to set the actual value in their\r\n            Matches override.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeExistsConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Constructs an AttributeExistsConstraint for a specific attribute Type\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeExistsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Tests whether the object provides the expected attribute.\r\n            </summary>\r\n            <param name=\"actual\">A Type, MethodInfo, or other ICustomAttributeProvider</param>\r\n            <returns>True if the expected attribute is present, otherwise false</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeExistsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Writes the description of the constraint to the specified writer\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AttributeConstraint\">\r\n            <summary>\r\n            AttributeConstraint tests that a specified attribute is present\r\n            on a Type or other provider and that the value of the attribute\r\n            satisfies some other constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PrefixConstraint\">\r\n            <summary>\r\n            Abstract base class used for prefixes\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.PrefixConstraint.baseConstraint\">\r\n            <summary>\r\n            The base constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PrefixConstraint.#ctor(NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Construct given a base constraint\r\n            </summary>\r\n            <param name=\"resolvable\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeConstraint.#ctor(System.Type,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Constructs an AttributeConstraint for a specified attriute\r\n            Type and base constraint.\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n            <param name=\"baseConstraint\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Determines whether the Type or other provider has the \r\n            expected attribute and if its value matches the\r\n            additional constraint specified.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Writes a description of the attribute to the specified writer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Writes the actual value supplied to the specified writer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns a string representation of the constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.BasicConstraint\">\r\n            <summary>\r\n            BasicConstraint is the abstract base for constraints that\r\n            perform a simple comparison to a constant value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BasicConstraint.#ctor(System.Object,System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:BasicConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected.</param>\r\n            <param name=\"description\">The description.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BasicConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BasicConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NullConstraint\">\r\n            <summary>\r\n            NullConstraint tests that the actual value is null\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NullConstraint.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:NullConstraint\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.TrueConstraint\">\r\n            <summary>\r\n            TrueConstraint tests that the actual value is true\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.TrueConstraint.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:TrueConstraint\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.FalseConstraint\">\r\n            <summary>\r\n            FalseConstraint tests that the actual value is false\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FalseConstraint.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:FalseConstraint\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NaNConstraint\">\r\n            <summary>\r\n            NaNConstraint tests that the actual value is a double or float NaN\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NaNConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test that the actual value is an NaN\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NaNConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a specified writer\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.BinaryConstraint\">\r\n            <summary>\r\n            BinaryConstraint is the abstract base of all constraints\r\n            that combine two other constraints in some fashion.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.BinaryConstraint.left\">\r\n            <summary>\r\n            The first constraint being combined\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.BinaryConstraint.right\">\r\n            <summary>\r\n            The second constraint being combined\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinaryConstraint.#ctor(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Construct a BinaryConstraint from two other constraints\r\n            </summary>\r\n            <param name=\"left\">The first constraint</param>\r\n            <param name=\"right\">The second constraint</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AndConstraint\">\r\n            <summary>\r\n            AndConstraint succeeds only if both members succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AndConstraint.#ctor(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Create an AndConstraint from two other constraints\r\n            </summary>\r\n            <param name=\"left\">The first constraint</param>\r\n            <param name=\"right\">The second constraint</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AndConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Apply both member constraints to an actual value, succeeding \r\n            succeeding only if both of them succeed.\r\n            </summary>\r\n            <param name=\"actual\">The actual value</param>\r\n            <returns>True if the constraints both succeeded</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AndConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description for this contraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to receive the description</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AndConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.OrConstraint\">\r\n            <summary>\r\n            OrConstraint succeeds if either member succeeds\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.OrConstraint.#ctor(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Create an OrConstraint from two other constraints\r\n            </summary>\r\n            <param name=\"left\">The first constraint</param>\r\n            <param name=\"right\">The second constraint</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.OrConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Apply the member constraints to an actual value, succeeding \r\n            succeeding as soon as one of them succeeds.\r\n            </summary>\r\n            <param name=\"actual\">The actual value</param>\r\n            <returns>True if either constraint succeeded</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.OrConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description for this contraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to receive the description</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionConstraint\">\r\n            <summary>\r\n            CollectionConstraint is the abstract base class for\r\n            constraints that operate on collections.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionConstraint.#ctor\">\r\n            <summary>\r\n            Construct an empty CollectionConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Construct a CollectionConstraint\r\n            </summary>\r\n            <param name=\"arg\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionConstraint.IsEmpty(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Determines whether the specified enumerable is empty.\r\n            </summary>\r\n            <param name=\"enumerable\">The enumerable.</param>\r\n            <returns>\r\n            \t<c>true</c> if the specified enumerable is empty; otherwise, <c>false</c>.\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Protected method to be implemented by derived classes\r\n            </summary>\r\n            <param name=\"collection\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionItemsEqualConstraint\">\r\n            <summary>\r\n            CollectionItemsEqualConstraint is the abstract base class for all\r\n            collection constraints that apply some notion of item equality\r\n            as a part of their operation.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.#ctor\">\r\n            <summary>\r\n            Construct an empty CollectionConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Construct a CollectionConstraint\r\n            </summary>\r\n            <param name=\"arg\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.Using(System.Collections.IComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.Using``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.Using``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied Comparison object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.Using(System.Collections.IEqualityComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IEqualityComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.Using``1(System.Collections.Generic.IEqualityComparer{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IEqualityComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.ItemsEqual(System.Object,System.Object)\">\r\n            <summary>\r\n            Compares two collection members for equality\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.Tally(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Return a new CollectionTally for use in making tests\r\n            </summary>\r\n            <param name=\"c\">The collection to be included in the tally</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.CollectionItemsEqualConstraint.IgnoreCase\">\r\n            <summary>\r\n            Flag the constraint to ignore case and return self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EmptyCollectionConstraint\">\r\n            <summary>\r\n            EmptyCollectionConstraint tests whether a collection is empty. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyCollectionConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Check that the collection is empty\r\n            </summary>\r\n            <param name=\"collection\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyCollectionConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.UniqueItemsConstraint\">\r\n            <summary>\r\n            UniqueItemsConstraint tests whether all the items in a \r\n            collection are unique.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.UniqueItemsConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Check that all items are unique.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.UniqueItemsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionContainsConstraint\">\r\n            <summary>\r\n            CollectionContainsConstraint is used to test whether a collection\r\n            contains an expected object as a member.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionContainsConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Construct a CollectionContainsConstraint\r\n            </summary>\r\n            <param name=\"expected\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionContainsConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Test whether the expected item is contained in the collection\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionContainsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a descripton of the constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionEquivalentConstraint\">\r\n            <summary>\r\n            CollectionEquivalentCOnstraint is used to determine whether two\r\n            collections are equivalent.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionEquivalentConstraint.#ctor(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Construct a CollectionEquivalentConstraint\r\n            </summary>\r\n            <param name=\"expected\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionEquivalentConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Test whether two collections are equivalent\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionEquivalentConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionSubsetConstraint\">\r\n            <summary>\r\n            CollectionSubsetConstraint is used to determine whether\r\n            one collection is a subset of another\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionSubsetConstraint.#ctor(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Construct a CollectionSubsetConstraint\r\n            </summary>\r\n            <param name=\"expected\">The collection that the actual value is expected to be a subset of</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionSubsetConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Test whether the actual collection is a subset of \r\n            the expected collection provided.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionSubsetConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionOrderedConstraint\">\r\n            <summary>\r\n            CollectionOrderedConstraint is used to test whether a collection is ordered.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.#ctor\">\r\n            <summary>\r\n            Construct a CollectionOrderedConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.Using(System.Collections.IComparer)\">\r\n            <summary>\r\n            Modifies the constraint to use an IComparer and returns self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.Using``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Modifies the constraint to use an IComparer&lt;T&gt; and returns self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.Using``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Modifies the constraint to use a Comparison&lt;T&gt; and returns self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.By(System.String)\">\r\n            <summary>\r\n            Modifies the constraint to test ordering by the value of\r\n            a specified property and returns self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.doMatch(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Test whether the collection is ordered\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of the constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOrderedConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of the constraint.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.CollectionOrderedConstraint.Descending\">\r\n            <summary>\r\n             If used performs a reverse comparison\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionTally\">\r\n            <summary>\r\n            CollectionTally counts (tallies) the number of\r\n            occurences of each object in one or more enumerations.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionTally.#ctor(NUnit.Framework.Constraints.NUnitEqualityComparer,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Construct a CollectionTally object from a comparer and a collection\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionTally.TryRemove(System.Object)\">\r\n            <summary>\r\n            Try to remove an object from the tally\r\n            </summary>\r\n            <param name=\"o\">The object to remove</param>\r\n            <returns>True if successful, false if the object was not found</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionTally.TryRemove(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Try to remove a set of objects from the tally\r\n            </summary>\r\n            <param name=\"c\">The objects to remove</param>\r\n            <returns>True if successful, false if any object was not found</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.CollectionTally.Count\">\r\n            <summary>\r\n            The number of objects remaining in the tally\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ComparisonAdapter\">\r\n            <summary>\r\n            ComparisonAdapter class centralizes all comparisons of\r\n            values in NUnit, adapting to the use of any provided\r\n            IComparer, IComparer&lt;T&gt; or Comparison&lt;T&gt;\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.For(System.Collections.IComparer)\">\r\n            <summary>\r\n            Returns a ComparisonAdapter that wraps an IComparer\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.For``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Returns a ComparisonAdapter that wraps an IComparer&lt;T&gt;\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.For``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Returns a ComparisonAdapter that wraps a Comparison&lt;T&gt;\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.Compare(System.Object,System.Object)\">\r\n            <summary>\r\n            Compares two objects\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ComparisonAdapter.Default\">\r\n            <summary>\r\n            Gets the default ComparisonAdapter, which wraps an\r\n            NUnitComparer object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.ComparerAdapter.#ctor(System.Collections.IComparer)\">\r\n            <summary>\r\n            Construct a ComparisonAdapter for an IComparer\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.ComparerAdapter.Compare(System.Object,System.Object)\">\r\n            <summary>\r\n            Compares two objects\r\n            </summary>\r\n            <param name=\"expected\"></param>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.DefaultComparisonAdapter.#ctor\">\r\n            <summary>\r\n            Construct a default ComparisonAdapter\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ComparisonAdapter.ComparerAdapter`1\">\r\n            <summary>\r\n            ComparisonAdapter&lt;T&gt; extends ComparisonAdapter and\r\n            allows use of an IComparer&lt;T&gt; or Comparison&lt;T&gt;\r\n            to actually perform the comparison.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.ComparerAdapter`1.#ctor(System.Collections.Generic.IComparer{`0})\">\r\n            <summary>\r\n            Construct a ComparisonAdapter for an IComparer&lt;T&gt;\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.ComparerAdapter`1.Compare(System.Object,System.Object)\">\r\n            <summary>\r\n            Compare a Type T to an object\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.ComparisonAdapterForComparison`1.#ctor(System.Comparison{`0})\">\r\n            <summary>\r\n            Construct a ComparisonAdapter for a Comparison&lt;T&gt;\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonAdapter.ComparisonAdapterForComparison`1.Compare(System.Object,System.Object)\">\r\n            <summary>\r\n            Compare a Type T to an object\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ComparisonConstraint\">\r\n            <summary>\r\n            Abstract base class for constraints that compare values to\r\n            determine if one is greater than, equal to or less than\r\n            the other. This class supplies the Using modifiers.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ComparisonConstraint.comparer\">\r\n            <summary>\r\n            ComparisonAdapter to be used in making the comparison\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ComparisonConstraint\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonConstraint.#ctor(System.Object,System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ComparisonConstraint\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonConstraint.Using(System.Collections.IComparer)\">\r\n            <summary>\r\n            Modifies the constraint to use an IComparer and returns self\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonConstraint.Using``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Modifies the constraint to use an IComparer&lt;T&gt; and returns self\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ComparisonConstraint.Using``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Modifies the constraint to use a Comparison&lt;T&gt; and returns self\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ActualValueDelegate\">\r\n            <summary>\r\n            Delegate used to delay evaluation of the actual value\r\n            to be used in evaluating a constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintBuilder\">\r\n            <summary>\r\n            ConstraintBuilder maintains the stacks that are used in\r\n            processing a ConstraintExpression. An OperatorStack\r\n            is used to hold operators that are waiting for their\r\n            operands to be reognized. a ConstraintStack holds \r\n            input constraints as well as the results of each\r\n            operator applied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ConstraintBuilder\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.Append(NUnit.Framework.Constraints.ConstraintOperator)\">\r\n            <summary>\r\n            Appends the specified operator to the expression by first\r\n            reducing the operator stack and then pushing the new\r\n            operator on the stack.\r\n            </summary>\r\n            <param name=\"op\">The operator to push.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.Append(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Appends the specified constraint to the expresson by pushing\r\n            it on the constraint stack.\r\n            </summary>\r\n            <param name=\"constraint\">The constraint to push.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.SetTopOperatorRightContext(System.Object)\">\r\n            <summary>\r\n            Sets the top operator right context.\r\n            </summary>\r\n            <param name=\"rightContext\">The right context.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.ReduceOperatorStack(System.Int32)\">\r\n            <summary>\r\n            Reduces the operator stack until the topmost item\r\n            precedence is greater than or equal to the target precedence.\r\n            </summary>\r\n            <param name=\"targetPrecedence\">The target precedence.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.Resolve\">\r\n            <summary>\r\n            Resolves this instance, returning a Constraint. If the builder\r\n            is not currently in a resolvable state, an exception is thrown.\r\n            </summary>\r\n            <returns>The resolved constraint</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintBuilder.IsResolvable\">\r\n            <summary>\r\n            Gets a value indicating whether this instance is resolvable.\r\n            </summary>\r\n            <value>\r\n            \t<c>true</c> if this instance is resolvable; otherwise, <c>false</c>.\r\n            </value>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintBuilder.OperatorStack\">\r\n            <summary>\r\n            OperatorStack is a type-safe stack for holding ConstraintOperators\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.OperatorStack.#ctor(NUnit.Framework.Constraints.ConstraintBuilder)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:OperatorStack\"/> class.\r\n            </summary>\r\n            <param name=\"builder\">The builder.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.OperatorStack.Push(NUnit.Framework.Constraints.ConstraintOperator)\">\r\n            <summary>\r\n            Pushes the specified operator onto the stack.\r\n            </summary>\r\n            <param name=\"op\">The op.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.OperatorStack.Pop\">\r\n            <summary>\r\n            Pops the topmost operator from the stack.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintBuilder.OperatorStack.Empty\">\r\n            <summary>\r\n            Gets a value indicating whether this <see cref=\"T:OpStack\"/> is empty.\r\n            </summary>\r\n            <value><c>true</c> if empty; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintBuilder.OperatorStack.Top\">\r\n            <summary>\r\n            Gets the topmost operator without modifying the stack.\r\n            </summary>\r\n            <value>The top.</value>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack\">\r\n            <summary>\r\n            ConstraintStack is a type-safe stack for holding Constraints\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack.#ctor(NUnit.Framework.Constraints.ConstraintBuilder)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ConstraintStack\"/> class.\r\n            </summary>\r\n            <param name=\"builder\">The builder.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack.Push(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Pushes the specified constraint. As a side effect,\r\n            the constraint's builder field is set to the \r\n            ConstraintBuilder owning this stack.\r\n            </summary>\r\n            <param name=\"constraint\">The constraint.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack.Pop\">\r\n            <summary>\r\n            Pops this topmost constrait from the stack.\r\n            As a side effect, the constraint's builder\r\n            field is set to null.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack.Empty\">\r\n            <summary>\r\n            Gets a value indicating whether this <see cref=\"T:ConstraintStack\"/> is empty.\r\n            </summary>\r\n            <value><c>true</c> if empty; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack.Top\">\r\n            <summary>\r\n            Gets the topmost constraint without modifying the stack.\r\n            </summary>\r\n            <value>The topmost constraint</value>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintExpression\">\r\n            <summary>\r\n            ConstraintExpression represents a compound constraint in the \r\n            process of being constructed from a series of syntactic elements.\r\n            \r\n            Individual elements are appended to the expression as they are\r\n            reognized. Once an actual Constraint is appended, the expression\r\n            returns a resolvable Constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintExpressionBase\">\r\n            <summary>\r\n            ConstraintExpressionBase is the abstract base class for the \r\n            ConstraintExpression class, which represents a \r\n            compound constraint in the process of being constructed \r\n            from a series of syntactic elements.\r\n            \r\n            NOTE: ConstraintExpressionBase is separate because the\r\n            ConstraintExpression class was generated in earlier\r\n            versions of NUnit. The two classes may be combined\r\n            in a future version.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ConstraintExpressionBase.builder\">\r\n            <summary>\r\n            The ConstraintBuilder holding the elements recognized so far\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpressionBase.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ConstraintExpressionBase\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpressionBase.#ctor(NUnit.Framework.Constraints.ConstraintBuilder)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ConstraintExpressionBase\"/> \r\n            class passing in a ConstraintBuilder, which may be pre-populated.\r\n            </summary>\r\n            <param name=\"builder\">The builder.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpressionBase.ToString\">\r\n            <summary>\r\n            Returns a string representation of the expression as it\r\n            currently stands. This should only be used for testing,\r\n            since it has the side-effect of resolving the expression.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpressionBase.Append(NUnit.Framework.Constraints.ConstraintOperator)\">\r\n            <summary>\r\n            Appends an operator to the expression and returns the\r\n            resulting expression itself.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpressionBase.Append(NUnit.Framework.Constraints.SelfResolvingOperator)\">\r\n            <summary>\r\n            Appends a self-resolving operator to the expression and\r\n            returns a new ResolvableConstraintExpression.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpressionBase.Append(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Appends a constraint to the expression and returns that\r\n            constraint, which is associated with the current state\r\n            of the expression being built.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.#ctor\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ConstraintExpression\"/> class.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.#ctor(NUnit.Framework.Constraints.ConstraintBuilder)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ConstraintExpression\"/> \r\n            class passing in a ConstraintBuilder, which may be pre-populated.\r\n            </summary>\r\n            <param name=\"builder\">The builder.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Exactly(System.Int32)\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding only if a specified number of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Property(System.String)\">\r\n            <summary>\r\n            Returns a new PropertyConstraintExpression, which will either\r\n            test for the existence of the named property on the object\r\n            being tested or apply any following constraint to that property.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Attribute(System.Type)\">\r\n            <summary>\r\n            Returns a new AttributeConstraint checking for the\r\n            presence of a particular attribute on an object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Attribute``1\">\r\n            <summary>\r\n            Returns a new AttributeConstraint checking for the\r\n            presence of a particular attribute on an object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Matches(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns the constraint provided as an argument - used to allow custom\r\n            custom constraints to easily participate in the syntax.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Matches``1(System.Predicate{``0})\">\r\n            <summary>\r\n            Returns the constraint provided as an argument - used to allow custom\r\n            custom constraints to easily participate in the syntax.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.EqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests two items for equality\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.SameAs(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests that two references are the same object\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.GreaterThan(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.GreaterThanOrEqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.AtLeast(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.LessThan(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.LessThanOrEqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.AtMost(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.TypeOf(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual\r\n            value is of the exact type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.TypeOf``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual\r\n            value is of the exact type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.InstanceOf(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.InstanceOf``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.InstanceOfType(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.InstanceOfType``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.AssignableFrom(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.AssignableFrom``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.AssignableTo(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.AssignableTo``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.EquivalentTo(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is a collection containing the same elements as the \r\n            collection supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.SubsetOf(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is a subset of the collection supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Member(System.Object)\">\r\n            <summary>\r\n            Returns a new CollectionContainsConstraint checking for the\r\n            presence of a particular object in the collection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Contains(System.Object)\">\r\n            <summary>\r\n            Returns a new CollectionContainsConstraint checking for the\r\n            presence of a particular object in the collection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Contains(System.String)\">\r\n            <summary>\r\n            Returns a new ContainsConstraint. This constraint\r\n            will, in turn, make use of the appropriate second-level\r\n            constraint, depending on the type of the actual argument. \r\n            This overload is only used if the item sought is a string,\r\n            since any other type implies that we are looking for a \r\n            collection member.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.StringContaining(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.ContainsSubstring(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.StartsWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.StringStarting(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.EndsWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.StringEnding(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.Matches(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value matches the Regex pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.StringMatching(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value matches the Regex pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.SamePath(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same as an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.SubPath(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same path or under an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.SamePathOrUnder(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same path or under an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintExpression.InRange``1(``0,``0)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value falls \r\n            within a specified range.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Not\">\r\n            <summary>\r\n            Returns a ConstraintExpression that negates any\r\n            following constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.No\">\r\n            <summary>\r\n            Returns a ConstraintExpression that negates any\r\n            following constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.All\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Some\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if at least one of them succeeds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.None\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them fail.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Length\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Length property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Count\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Count property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Message\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Message property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.InnerException\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the InnerException property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.With\">\r\n            <summary>\r\n            With is currently a NOP - reserved for future use.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Null\">\r\n            <summary>\r\n            Returns a constraint that tests for null\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.True\">\r\n            <summary>\r\n            Returns a constraint that tests for True\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.False\">\r\n            <summary>\r\n            Returns a constraint that tests for False\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Positive\">\r\n            <summary>\r\n            Returns a constraint that tests for a positive value\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Negative\">\r\n            <summary>\r\n            Returns a constraint that tests for a negative value\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.NaN\">\r\n            <summary>\r\n            Returns a constraint that tests for NaN\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Empty\">\r\n            <summary>\r\n            Returns a constraint that tests for empty\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Unique\">\r\n            <summary>\r\n            Returns a constraint that tests whether a collection \r\n            contains all unique items.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.BinarySerializable\">\r\n            <summary>\r\n            Returns a constraint that tests whether an object graph is serializable in binary format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.XmlSerializable\">\r\n            <summary>\r\n            Returns a constraint that tests whether an object graph is serializable in xml format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintExpression.Ordered\">\r\n            <summary>\r\n            Returns a constraint that tests whether a collection is ordered\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintFactory\">\r\n            <summary>\r\n            Helper class with properties and methods that supply\r\n            a number of constraints used in Asserts.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Exactly(System.Int32)\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding only if a specified number of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Property(System.String)\">\r\n            <summary>\r\n            Returns a new PropertyConstraintExpression, which will either\r\n            test for the existence of the named property on the object\r\n            being tested or apply any following constraint to that property.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Attribute(System.Type)\">\r\n            <summary>\r\n            Returns a new AttributeConstraint checking for the\r\n            presence of a particular attribute on an object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Attribute``1\">\r\n            <summary>\r\n            Returns a new AttributeConstraint checking for the\r\n            presence of a particular attribute on an object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.EqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests two items for equality\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.SameAs(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests that two references are the same object\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.GreaterThan(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.GreaterThanOrEqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.AtLeast(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.LessThan(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.LessThanOrEqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.AtMost(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.TypeOf(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual\r\n            value is of the exact type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.TypeOf``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual\r\n            value is of the exact type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.InstanceOf(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.InstanceOf``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.InstanceOfType(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.InstanceOfType``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.AssignableFrom(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.AssignableFrom``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.AssignableTo(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.AssignableTo``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.EquivalentTo(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is a collection containing the same elements as the \r\n            collection supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.SubsetOf(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is a subset of the collection supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Member(System.Object)\">\r\n            <summary>\r\n            Returns a new CollectionContainsConstraint checking for the\r\n            presence of a particular object in the collection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Contains(System.Object)\">\r\n            <summary>\r\n            Returns a new CollectionContainsConstraint checking for the\r\n            presence of a particular object in the collection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Contains(System.String)\">\r\n            <summary>\r\n            Returns a new ContainsConstraint. This constraint\r\n            will, in turn, make use of the appropriate second-level\r\n            constraint, depending on the type of the actual argument. \r\n            This overload is only used if the item sought is a string,\r\n            since any other type implies that we are looking for a \r\n            collection member.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.StringContaining(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.ContainsSubstring(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.DoesNotContain(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.StartsWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.StringStarting(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.DoesNotStartWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.EndsWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.StringEnding(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.DoesNotEndWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.Matches(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value matches the Regex pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.StringMatching(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value matches the Regex pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.DoesNotMatch(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value matches the pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.SamePath(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same as an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.SubPath(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same path or under an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.SamePathOrUnder(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same path or under an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintFactory.InRange``1(``0,``0)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value falls \r\n            within a specified range.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Not\">\r\n            <summary>\r\n            Returns a ConstraintExpression that negates any\r\n            following constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.No\">\r\n            <summary>\r\n            Returns a ConstraintExpression that negates any\r\n            following constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.All\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Some\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if at least one of them succeeds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.None\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them fail.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Length\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Length property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Count\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Count property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Message\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Message property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.InnerException\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the InnerException property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Null\">\r\n            <summary>\r\n            Returns a constraint that tests for null\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.True\">\r\n            <summary>\r\n            Returns a constraint that tests for True\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.False\">\r\n            <summary>\r\n            Returns a constraint that tests for False\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Positive\">\r\n            <summary>\r\n            Returns a constraint that tests for a positive value\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Negative\">\r\n            <summary>\r\n            Returns a constraint that tests for a negative value\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.NaN\">\r\n            <summary>\r\n            Returns a constraint that tests for NaN\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Empty\">\r\n            <summary>\r\n            Returns a constraint that tests for empty\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Unique\">\r\n            <summary>\r\n            Returns a constraint that tests whether a collection \r\n            contains all unique items.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.BinarySerializable\">\r\n            <summary>\r\n            Returns a constraint that tests whether an object graph is serializable in binary format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.XmlSerializable\">\r\n            <summary>\r\n            Returns a constraint that tests whether an object graph is serializable in xml format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintFactory.Ordered\">\r\n            <summary>\r\n            Returns a constraint that tests whether a collection is ordered\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ConstraintOperator\">\r\n            <summary>\r\n            The ConstraintOperator class is used internally by a\r\n            ConstraintBuilder to represent an operator that \r\n            modifies or combines constraints. \r\n            \r\n            Constraint operators use left and right precedence\r\n            values to determine whether the top operator on the\r\n            stack should be reduced before pushing a new operator.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ConstraintOperator.left_precedence\">\r\n            <summary>\r\n            The precedence value used when the operator\r\n            is about to be pushed to the stack.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ConstraintOperator.right_precedence\">\r\n            <summary>\r\n            The precedence value used when the operator\r\n            is on the top of the stack.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ConstraintOperator.Reduce(NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack)\">\r\n            <summary>\r\n            Reduce produces a constraint from the operator and \r\n            any arguments. It takes the arguments from the constraint \r\n            stack and pushes the resulting constraint on it.\r\n            </summary>\r\n            <param name=\"stack\"></param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintOperator.LeftContext\">\r\n            <summary>\r\n            The syntax element preceding this operator\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintOperator.RightContext\">\r\n            <summary>\r\n            The syntax element folowing this operator\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintOperator.LeftPrecedence\">\r\n            <summary>\r\n            The precedence value used when the operator\r\n            is about to be pushed to the stack.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ConstraintOperator.RightPrecedence\">\r\n            <summary>\r\n            The precedence value used when the operator\r\n            is on the top of the stack.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PrefixOperator\">\r\n            <summary>\r\n            PrefixOperator takes a single constraint and modifies\r\n            it's action in some way.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PrefixOperator.Reduce(NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack)\">\r\n            <summary>\r\n            Reduce produces a constraint from the operator and \r\n            any arguments. It takes the arguments from the constraint \r\n            stack and pushes the resulting constraint on it.\r\n            </summary>\r\n            <param name=\"stack\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PrefixOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns the constraint created by applying this\r\n            prefix to another constraint.\r\n            </summary>\r\n            <param name=\"constraint\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NotOperator\">\r\n            <summary>\r\n            Negates the test of the constraint it wraps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NotOperator.#ctor\">\r\n            <summary>\r\n            Constructs a new NotOperator\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NotOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns a NotConstraint applied to its argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.CollectionOperator\">\r\n            <summary>\r\n            Abstract base for operators that indicate how to\r\n            apply a constraint to items in a collection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.CollectionOperator.#ctor\">\r\n            <summary>\r\n            Constructs a CollectionOperator\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AllOperator\">\r\n            <summary>\r\n            Represents a constraint that succeeds if all the \r\n            members of a collection match a base constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AllOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns a constraint that will apply the argument\r\n            to the members of a collection, succeeding if\r\n            they all succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SomeOperator\">\r\n            <summary>\r\n            Represents a constraint that succeeds if any of the \r\n            members of a collection match a base constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SomeOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns a constraint that will apply the argument\r\n            to the members of a collection, succeeding if\r\n            any of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NoneOperator\">\r\n            <summary>\r\n            Represents a constraint that succeeds if none of the \r\n            members of a collection match a base constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NoneOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns a constraint that will apply the argument\r\n            to the members of a collection, succeeding if\r\n            none of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ExactCountOperator\">\r\n            <summary>\r\n            Represents a constraint that succeeds if the specified \r\n            count of members of a collection match a base constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactCountOperator.#ctor(System.Int32)\">\r\n            <summary>\r\n            Construct an ExactCountOperator for a specified count\r\n            </summary>\r\n            <param name=\"expectedCount\">The expected count</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactCountOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns a constraint that will apply the argument\r\n            to the members of a collection, succeeding if\r\n            none of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.WithOperator\">\r\n            <summary>\r\n            Represents a constraint that simply wraps the\r\n            constraint provided as an argument, without any\r\n            further functionality, but which modifes the\r\n            order of evaluation because of its precedence.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.WithOperator.#ctor\">\r\n            <summary>\r\n            Constructor for the WithOperator\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.WithOperator.ApplyPrefix(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Returns a constraint that wraps its argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SelfResolvingOperator\">\r\n            <summary>\r\n            Abstract base class for operators that are able to reduce to a \r\n            constraint whether or not another syntactic element follows.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PropOperator\">\r\n            <summary>\r\n            Operator used to test for the presence of a named Property\r\n            on an object and optionally apply further tests to the\r\n            value of that property.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropOperator.#ctor(System.String)\">\r\n            <summary>\r\n            Constructs a PropOperator for a particular named property\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropOperator.Reduce(NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack)\">\r\n            <summary>\r\n            Reduce produces a constraint from the operator and \r\n            any arguments. It takes the arguments from the constraint \r\n            stack and pushes the resulting constraint on it.\r\n            </summary>\r\n            <param name=\"stack\"></param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.PropOperator.Name\">\r\n            <summary>\r\n            Gets the name of the property to which the operator applies\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AttributeOperator\">\r\n            <summary>\r\n            Operator that tests for the presence of a particular attribute\r\n            on a type and optionally applies further tests to the attribute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeOperator.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct an AttributeOperator for a particular Type\r\n            </summary>\r\n            <param name=\"type\">The Type of attribute tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AttributeOperator.Reduce(NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack)\">\r\n            <summary>\r\n            Reduce produces a constraint from the operator and \r\n            any arguments. It takes the arguments from the constraint \r\n            stack and pushes the resulting constraint on it.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ThrowsOperator\">\r\n            <summary>\r\n            Operator that tests that an exception is thrown and\r\n            optionally applies further tests to the exception.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsOperator.#ctor\">\r\n            <summary>\r\n            Construct a ThrowsOperator\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsOperator.Reduce(NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack)\">\r\n            <summary>\r\n            Reduce produces a constraint from the operator and \r\n            any arguments. It takes the arguments from the constraint \r\n            stack and pushes the resulting constraint on it.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.BinaryOperator\">\r\n            <summary>\r\n            Abstract base class for all binary operators\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinaryOperator.Reduce(NUnit.Framework.Constraints.ConstraintBuilder.ConstraintStack)\">\r\n            <summary>\r\n            Reduce produces a constraint from the operator and \r\n            any arguments. It takes the arguments from the constraint \r\n            stack and pushes the resulting constraint on it.\r\n            </summary>\r\n            <param name=\"stack\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinaryOperator.ApplyOperator(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Abstract method that produces a constraint by applying\r\n            the operator to its left and right constraint arguments.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.BinaryOperator.LeftPrecedence\">\r\n            <summary>\r\n            Gets the left precedence of the operator\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.BinaryOperator.RightPrecedence\">\r\n            <summary>\r\n            Gets the right precedence of the operator\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AndOperator\">\r\n            <summary>\r\n            Operator that requires both it's arguments to succeed\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AndOperator.#ctor\">\r\n            <summary>\r\n            Construct an AndOperator\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AndOperator.ApplyOperator(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Apply the operator to produce an AndConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.OrOperator\">\r\n            <summary>\r\n            Operator that requires at least one of it's arguments to succeed\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.OrOperator.#ctor\">\r\n            <summary>\r\n            Construct an OrOperator\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.OrOperator.ApplyOperator(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Apply the operator to produce an OrConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ContainsConstraint\">\r\n            <summary>\r\n            ContainsConstraint tests a whether a string contains a substring\r\n            or a collection contains an object. It postpones the decision of\r\n            which test to use until the type of the actual argument is known.\r\n            This allows testing whether a string is contained in a collection\r\n            or as a substring of another string using the same syntax.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ContainsConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.Using(System.Collections.IComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.Using``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.Using``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied Comparison object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.Using(System.Collections.IEqualityComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IEqualityComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ContainsConstraint.Using``1(System.Collections.Generic.IEqualityComparer{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IEqualityComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ContainsConstraint.IgnoreCase\">\r\n            <summary>\r\n            Flag the constraint to ignore case and return self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.DelayedConstraint\">\r\n            <summary>\r\n             Applies a delay to the match so that a match can be evaluated in the future.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.#ctor(NUnit.Framework.Constraints.Constraint,System.Int32)\">\r\n            <summary>\r\n             Creates a new DelayedConstraint\r\n            </summary>\r\n            <param name=\"baseConstraint\">The inner constraint two decorate</param>\r\n            <param name=\"delayInMilliseconds\">The time interval after which the match is performed</param>\r\n            <exception cref=\"T:System.InvalidOperationException\">If the value of <paramref name=\"delayInMilliseconds\"/> is less than 0</exception>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.#ctor(NUnit.Framework.Constraints.Constraint,System.Int32,System.Int32)\">\r\n            <summary>\r\n             Creates a new DelayedConstraint\r\n            </summary>\r\n            <param name=\"baseConstraint\">The inner constraint two decorate</param>\r\n            <param name=\"delayInMilliseconds\">The time interval after which the match is performed</param>\r\n            <param name=\"pollingInterval\">The time interval used for polling</param>\r\n            <exception cref=\"T:System.InvalidOperationException\">If the value of <paramref name=\"delayInMilliseconds\"/> is less than 0</exception>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for if the base constraint fails, false if it succeeds</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.Matches(NUnit.Framework.Constraints.ActualValueDelegate)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a delegate\r\n            </summary>\r\n            <param name=\"del\">The delegate whose value is to be tested</param>\r\n            <returns>True for if the base constraint fails, false if it succeeds</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.Matches``1(``0@)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given reference.\r\n            Overridden to wait for the specified delay period before\r\n            calling the base constraint with the dereferenced value.\r\n            </summary>\r\n            <param name=\"actual\">A reference to the value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a MessageWriter.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.DelayedConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of the constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EmptyDirectoryContraint\">\r\n            <summary>\r\n            EmptyDirectoryConstraint is used to test that a directory is empty\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyDirectoryContraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyDirectoryContraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyDirectoryContraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EmptyConstraint\">\r\n            <summary>\r\n            EmptyConstraint tests a whether a string or collection is empty,\r\n            postponing the decision about which test is applied until the\r\n            type of the actual argument is known.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EqualConstraint\">\r\n            <summary>\r\n            EqualConstraint is able to compare an actual value with the\r\n            expected value provided in its constructor. Two objects are \r\n            considered equal if both are null, or if both have the same \r\n            value. NUnit has special semantics for some object types.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.EqualConstraint.clipStrings\">\r\n            <summary>\r\n            If true, strings in error messages will be clipped\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.EqualConstraint.comparer\">\r\n            <summary>\r\n            NUnitEqualityComparer used to test equality.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:NUnit.Framework.Constraints.EqualConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Within(System.Object)\">\r\n            <summary>\r\n            Flag the constraint to use a tolerance when determining equality.\r\n            </summary>\r\n            <param name=\"amount\">Tolerance value to be used</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Comparer(System.Collections.IComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Using(System.Collections.IComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Using``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Using``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied Comparison object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Using(System.Collections.IEqualityComparer)\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IEqualityComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Using``1(System.Collections.Generic.IEqualityComparer{``0})\">\r\n            <summary>\r\n            Flag the constraint to use the supplied IEqualityComparer object.\r\n            </summary>\r\n            <param name=\"comparer\">The IComparer object to use.</param>\r\n            <returns>Self.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.WriteMessageTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a failure message. Overridden to provide custom \r\n            failure messages for EqualConstraint.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to write to</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write description of this constraint\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to write to</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.DisplayCollectionDifferences(NUnit.Framework.Constraints.MessageWriter,System.Collections.ICollection,System.Collections.ICollection,System.Int32)\">\r\n            <summary>\r\n            Display the failure information for two collections that did not match.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter on which to display</param>\r\n            <param name=\"expected\">The expected collection.</param>\r\n            <param name=\"actual\">The actual collection</param>\r\n            <param name=\"depth\">The depth of this failure in a set of nested collections</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.DisplayTypesAndSizes(NUnit.Framework.Constraints.MessageWriter,System.Collections.IEnumerable,System.Collections.IEnumerable,System.Int32)\">\r\n            <summary>\r\n            Displays a single line showing the types and sizes of the expected\r\n            and actual enumerations, collections or arrays. If both are identical, \r\n            the value is only shown once.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter on which to display</param>\r\n            <param name=\"expected\">The expected collection or array</param>\r\n            <param name=\"actual\">The actual collection or array</param>\r\n            <param name=\"indent\">The indentation level for the message line</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.DisplayFailurePoint(NUnit.Framework.Constraints.MessageWriter,System.Collections.IEnumerable,System.Collections.IEnumerable,NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint,System.Int32)\">\r\n            <summary>\r\n            Displays a single line showing the point in the expected and actual\r\n            arrays at which the comparison failed. If the arrays have different\r\n            structures or dimensions, both values are shown.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter on which to display</param>\r\n            <param name=\"expected\">The expected array</param>\r\n            <param name=\"actual\">The actual array</param>\r\n            <param name=\"failurePoint\">Index of the failure point in the underlying collections</param>\r\n            <param name=\"indent\">The indentation level for the message line</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualConstraint.DisplayEnumerableDifferences(NUnit.Framework.Constraints.MessageWriter,System.Collections.IEnumerable,System.Collections.IEnumerable,System.Int32)\">\r\n            <summary>\r\n            Display the failure information for two IEnumerables that did not match.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter on which to display</param>\r\n            <param name=\"expected\">The expected enumeration.</param>\r\n            <param name=\"actual\">The actual enumeration</param>\r\n            <param name=\"depth\">The depth of this failure in a set of nested collections</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.IgnoreCase\">\r\n            <summary>\r\n            Flag the constraint to ignore case and return self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.NoClip\">\r\n            <summary>\r\n            Flag the constraint to suppress string clipping \r\n            and return self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.AsCollection\">\r\n            <summary>\r\n            Flag the constraint to compare arrays as collections\r\n            and return self.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Ulps\">\r\n            <summary>\r\n            Switches the .Within() modifier to interpret its tolerance as\r\n            a distance in representable values (see remarks).\r\n            </summary>\r\n            <returns>Self.</returns>\r\n            <remarks>\r\n            Ulp stands for \"unit in the last place\" and describes the minimum\r\n            amount a given value can change. For any integers, an ulp is 1 whole\r\n            digit. For floating point values, the accuracy of which is better\r\n            for smaller numbers and worse for larger numbers, an ulp depends\r\n            on the size of the number. Using ulps for comparison of floating\r\n            point results instead of fixed tolerances is safer because it will\r\n            automatically compensate for the added inaccuracy of larger numbers.\r\n            </remarks>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Percent\">\r\n            <summary>\r\n            Switches the .Within() modifier to interpret its tolerance as\r\n            a percentage that the actual values is allowed to deviate from\r\n            the expected value.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Days\">\r\n            <summary>\r\n            Causes the tolerance to be interpreted as a TimeSpan in days.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Hours\">\r\n            <summary>\r\n            Causes the tolerance to be interpreted as a TimeSpan in hours.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Minutes\">\r\n            <summary>\r\n            Causes the tolerance to be interpreted as a TimeSpan in minutes.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Seconds\">\r\n            <summary>\r\n            Causes the tolerance to be interpreted as a TimeSpan in seconds.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Milliseconds\">\r\n            <summary>\r\n            Causes the tolerance to be interpreted as a TimeSpan in milliseconds.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.EqualConstraint.Ticks\">\r\n            <summary>\r\n            Causes the tolerance to be interpreted as a TimeSpan in clock ticks.\r\n            </summary>\r\n            <returns>Self</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EqualityAdapter\">\r\n            <summary>\r\n            EqualityAdapter class handles all equality comparisons\r\n            that use an IEqualityComparer, IEqualityComparer&lt;T&gt;\r\n            or a ComparisonAdapter.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.AreEqual(System.Object,System.Object)\">\r\n            <summary>\r\n            Compares two objects, returning true if they are equal\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.CanCompare(System.Object,System.Object)\">\r\n            <summary>\r\n            Returns true if the two objects can be compared by this adapter.\r\n            The base adapter cannot handle IEnumerables except for strings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.For(System.Collections.IComparer)\">\r\n            <summary>\r\n            Returns an EqualityAdapter that wraps an IComparer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.For(System.Collections.IEqualityComparer)\">\r\n            <summary>\r\n            Returns an EqualityAdapter that wraps an IEqualityComparer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.For``1(System.Collections.Generic.IEqualityComparer{``0})\">\r\n            <summary>\r\n            Returns an EqualityAdapter that wraps an IEqualityComparer&lt;T&gt;.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.For``1(System.Collections.Generic.IComparer{``0})\">\r\n            <summary>\r\n            Returns an EqualityAdapter that wraps an IComparer&lt;T&gt;.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.For``1(System.Comparison{``0})\">\r\n            <summary>\r\n            Returns an EqualityAdapter that wraps a Comparison&lt;T&gt;.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EqualityAdapter.ComparerAdapter\">\r\n            <summary>\r\n            EqualityAdapter that wraps an IComparer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EqualityAdapter.GenericEqualityAdapter`1.CanCompare(System.Object,System.Object)\">\r\n            <summary>\r\n            Returns true if the two objects can be compared by this adapter.\r\n            Generic adapter requires objects of the specified type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EqualityAdapter.ComparerAdapter`1\">\r\n            <summary>\r\n            EqualityAdapter that wraps an IComparer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.FloatingPointNumerics\">\r\n            <summary>Helper routines for working with floating point numbers</summary>\r\n            <remarks>\r\n              <para>\r\n                The floating point comparison code is based on this excellent article:\r\n                http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm\r\n              </para>\r\n              <para>\r\n                \"ULP\" means Unit in the Last Place and in the context of this library refers to\r\n                the distance between two adjacent floating point numbers. IEEE floating point\r\n                numbers can only represent a finite subset of natural numbers, with greater\r\n                accuracy for smaller numbers and lower accuracy for very large numbers.\r\n              </para>\r\n              <para>\r\n                If a comparison is allowed \"2 ulps\" of deviation, that means the values are\r\n                allowed to deviate by up to 2 adjacent floating point values, which might be\r\n                as low as 0.0000001 for small numbers or as high as 10.0 for large numbers.\r\n              </para>\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FloatingPointNumerics.AreAlmostEqualUlps(System.Single,System.Single,System.Int32)\">\r\n            <summary>Compares two floating point values for equality</summary>\r\n            <param name=\"left\">First floating point value to be compared</param>\r\n            <param name=\"right\">Second floating point value t be compared</param>\r\n            <param name=\"maxUlps\">\r\n              Maximum number of representable floating point values that are allowed to\r\n              be between the left and the right floating point values\r\n            </param>\r\n            <returns>True if both numbers are equal or close to being equal</returns>\r\n            <remarks>\r\n              <para>\r\n                Floating point values can only represent a finite subset of natural numbers.\r\n                For example, the values 2.00000000 and 2.00000024 can be stored in a float,\r\n                but nothing inbetween them.\r\n              </para>\r\n              <para>\r\n                This comparison will count how many possible floating point values are between\r\n                the left and the right number. If the number of possible values between both\r\n                numbers is less than or equal to maxUlps, then the numbers are considered as\r\n                being equal.\r\n              </para>\r\n              <para>\r\n                Implementation partially follows the code outlined here:\r\n                http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/\r\n              </para>\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FloatingPointNumerics.AreAlmostEqualUlps(System.Double,System.Double,System.Int64)\">\r\n            <summary>Compares two double precision floating point values for equality</summary>\r\n            <param name=\"left\">First double precision floating point value to be compared</param>\r\n            <param name=\"right\">Second double precision floating point value t be compared</param>\r\n            <param name=\"maxUlps\">\r\n              Maximum number of representable double precision floating point values that are\r\n              allowed to be between the left and the right double precision floating point values\r\n            </param>\r\n            <returns>True if both numbers are equal or close to being equal</returns>\r\n            <remarks>\r\n              <para>\r\n                Double precision floating point values can only represent a limited series of\r\n                natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004\r\n                can be stored in a double, but nothing inbetween them.\r\n              </para>\r\n              <para>\r\n                This comparison will count how many possible double precision floating point\r\n                values are between the left and the right number. If the number of possible\r\n                values between both numbers is less than or equal to maxUlps, then the numbers\r\n                are considered as being equal.\r\n              </para>\r\n              <para>\r\n                Implementation partially follows the code outlined here:\r\n                http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/\r\n              </para>\r\n            </remarks>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FloatingPointNumerics.ReinterpretAsInt(System.Single)\">\r\n            <summary>\r\n              Reinterprets the memory contents of a floating point value as an integer value\r\n            </summary>\r\n            <param name=\"value\">\r\n              Floating point value whose memory contents to reinterpret\r\n            </param>\r\n            <returns>\r\n              The memory contents of the floating point value interpreted as an integer\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FloatingPointNumerics.ReinterpretAsLong(System.Double)\">\r\n            <summary>\r\n              Reinterprets the memory contents of a double precision floating point\r\n              value as an integer value\r\n            </summary>\r\n            <param name=\"value\">\r\n              Double precision floating point value whose memory contents to reinterpret\r\n            </param>\r\n            <returns>\r\n              The memory contents of the double precision floating point value\r\n              interpreted as an integer\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FloatingPointNumerics.ReinterpretAsFloat(System.Int32)\">\r\n            <summary>\r\n              Reinterprets the memory contents of an integer as a floating point value\r\n            </summary>\r\n            <param name=\"value\">Integer value whose memory contents to reinterpret</param>\r\n            <returns>\r\n              The memory contents of the integer value interpreted as a floating point value\r\n            </returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.FloatingPointNumerics.ReinterpretAsDouble(System.Int64)\">\r\n            <summary>\r\n              Reinterprets the memory contents of an integer value as a double precision\r\n              floating point value\r\n            </summary>\r\n            <param name=\"value\">Integer whose memory contents to reinterpret</param>\r\n            <returns>\r\n              The memory contents of the integer interpreted as a double precision\r\n              floating point value\r\n            </returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.FloatingPointNumerics.FloatIntUnion\">\r\n            <summary>Union of a floating point variable and an integer</summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.FloatingPointNumerics.FloatIntUnion.Float\">\r\n            <summary>The union's value as a floating point variable</summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.FloatingPointNumerics.FloatIntUnion.Int\">\r\n            <summary>The union's value as an integer</summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.FloatingPointNumerics.FloatIntUnion.UInt\">\r\n            <summary>The union's value as an unsigned integer</summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.FloatingPointNumerics.DoubleLongUnion\">\r\n            <summary>Union of a double precision floating point variable and a long</summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.FloatingPointNumerics.DoubleLongUnion.Double\">\r\n            <summary>The union's value as a double precision floating point variable</summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.FloatingPointNumerics.DoubleLongUnion.Long\">\r\n            <summary>The union's value as a long</summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.FloatingPointNumerics.DoubleLongUnion.ULong\">\r\n            <summary>The union's value as an unsigned long</summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.GreaterThanConstraint\">\r\n            <summary>\r\n            Tests whether a value is greater than the value supplied to its constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.GreaterThanConstraint.expected\">\r\n            <summary>\r\n            The value against which a comparison is to be made\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.GreaterThanConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:GreaterThanConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.GreaterThanConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.GreaterThanConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint\">\r\n            <summary>\r\n            Tests whether a value is greater than or equal to the value supplied to its constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint.expected\">\r\n            <summary>\r\n            The value against which a comparison is to be made\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:GreaterThanOrEqualConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.LessThanConstraint\">\r\n            <summary>\r\n            Tests whether a value is less than the value supplied to its constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.LessThanConstraint.expected\">\r\n            <summary>\r\n            The value against which a comparison is to be made\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.LessThanConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:LessThanConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.LessThanConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.LessThanConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.LessThanOrEqualConstraint\">\r\n            <summary>\r\n            Tests whether a value is less than or equal to the value supplied to its constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.LessThanOrEqualConstraint.expected\">\r\n            <summary>\r\n            The value against which a comparison is to be made\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.LessThanOrEqualConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:LessThanOrEqualConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.LessThanOrEqualConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.LessThanOrEqualConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.MessageWriter\">\r\n            <summary>\r\n            MessageWriter is the abstract base for classes that write\r\n            constraint descriptions and messages in some form. The\r\n            class has separate methods for writing various components\r\n            of a message, allowing implementations to tailor the\r\n            presentation as needed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.#ctor\">\r\n            <summary>\r\n            Construct a MessageWriter given a culture\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteMessageLine(System.String,System.Object[])\">\r\n            <summary>\r\n            Method to write single line  message with optional args, usually\r\n            written to precede the general failure message.\r\n            </summary>\r\n            <param name=\"message\">The message to be written</param>\r\n            <param name=\"args\">Any arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteMessageLine(System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Method to write single line  message with optional args, usually\r\n            written to precede the general failure message, at a givel \r\n            indentation level.\r\n            </summary>\r\n            <param name=\"level\">The indentation level of the message</param>\r\n            <param name=\"message\">The message to be written</param>\r\n            <param name=\"args\">Any arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.DisplayDifferences(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Display Expected and Actual lines for a constraint. This\r\n            is called by MessageWriter's default implementation of \r\n            WriteMessageTo and provides the generic two-line display. \r\n            </summary>\r\n            <param name=\"constraint\">The constraint that failed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.DisplayDifferences(System.Object,System.Object)\">\r\n            <summary>\r\n            Display Expected and Actual lines for given values. This\r\n            method may be called by constraints that need more control over\r\n            the display of actual and expected values than is provided\r\n            by the default implementation.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value causing the failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.DisplayDifferences(System.Object,System.Object,NUnit.Framework.Constraints.Tolerance)\">\r\n            <summary>\r\n            Display Expected and Actual lines for given values, including\r\n            a tolerance value on the Expected line.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value causing the failure</param>\r\n            <param name=\"tolerance\">The tolerance within which the test was made</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.DisplayStringDifferences(System.String,System.String,System.Int32,System.Boolean,System.Boolean)\">\r\n            <summary>\r\n            Display the expected and actual string values on separate lines.\r\n            If the mismatch parameter is >=0, an additional line is displayed\r\n            line containing a caret that points to the mismatch point.\r\n            </summary>\r\n            <param name=\"expected\">The expected string value</param>\r\n            <param name=\"actual\">The actual string value</param>\r\n            <param name=\"mismatch\">The point at which the strings don't match or -1</param>\r\n            <param name=\"ignoreCase\">If true, case is ignored in locating the point where the strings differ</param>\r\n            <param name=\"clipping\">If true, the strings should be clipped to fit the line</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteConnector(System.String)\">\r\n            <summary>\r\n            Writes the text for a connector.\r\n            </summary>\r\n            <param name=\"connector\">The connector.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WritePredicate(System.String)\">\r\n            <summary>\r\n            Writes the text for a predicate.\r\n            </summary>\r\n            <param name=\"predicate\">The predicate.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteExpectedValue(System.Object)\">\r\n            <summary>\r\n            Writes the text for an expected value.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteModifier(System.String)\">\r\n            <summary>\r\n            Writes the text for a modifier\r\n            </summary>\r\n            <param name=\"modifier\">The modifier.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteActualValue(System.Object)\">\r\n            <summary>\r\n            Writes the text for an actual value.\r\n            </summary>\r\n            <param name=\"actual\">The actual value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteValue(System.Object)\">\r\n            <summary>\r\n            Writes the text for a generalized value.\r\n            </summary>\r\n            <param name=\"val\">The value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MessageWriter.WriteCollectionElements(System.Collections.IEnumerable,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Writes the text for a collection value,\r\n            starting at a particular point, to a max length\r\n            </summary>\r\n            <param name=\"collection\">The collection containing elements to write.</param>\r\n            <param name=\"start\">The starting point of the elements to write</param>\r\n            <param name=\"max\">The maximum number of elements to write</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.MessageWriter.MaxLineLength\">\r\n            <summary>\r\n            Abstract method to get the max line length\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.MsgUtils\">\r\n            <summary>\r\n            Static methods used in creating messages\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.MsgUtils.ELLIPSIS\">\r\n            <summary>\r\n            Static string used when strings are clipped\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.GetTypeRepresentation(System.Object)\">\r\n            <summary>\r\n            Returns the representation of a type as used in NUnitLite.\r\n            This is the same as Type.ToString() except for arrays,\r\n            which are displayed with their declared sizes.\r\n            </summary>\r\n            <param name=\"obj\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.EscapeControlChars(System.String)\">\r\n            <summary>\r\n            Converts any control characters in a string \r\n            to their escaped representation.\r\n            </summary>\r\n            <param name=\"s\">The string to be converted</param>\r\n            <returns>The converted string</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.GetArrayIndicesAsString(System.Int32[])\">\r\n            <summary>\r\n            Return the a string representation for a set of indices into an array\r\n            </summary>\r\n            <param name=\"indices\">Array of indices for which a string is needed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.GetArrayIndicesFromCollectionIndex(System.Collections.IEnumerable,System.Int32)\">\r\n            <summary>\r\n            Get an array of indices representing the point in a enumerable, \r\n            collection or array corresponding to a single int index into the \r\n            collection.\r\n            </summary>\r\n            <param name=\"collection\">The collection to which the indices apply</param>\r\n            <param name=\"index\">Index in the collection</param>\r\n            <returns>Array of indices</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.ClipString(System.String,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Clip a string to a given length, starting at a particular offset, returning the clipped\r\n            string with ellipses representing the removed parts\r\n            </summary>\r\n            <param name=\"s\">The string to be clipped</param>\r\n            <param name=\"maxStringLength\">The maximum permitted length of the result string</param>\r\n            <param name=\"clipStart\">The point at which to start clipping</param>\r\n            <returns>The clipped string</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.ClipExpectedAndActual(System.String@,System.String@,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Clip the expected and actual strings in a coordinated fashion, \r\n            so that they may be displayed together.\r\n            </summary>\r\n            <param name=\"expected\"></param>\r\n            <param name=\"actual\"></param>\r\n            <param name=\"maxDisplayLength\"></param>\r\n            <param name=\"mismatch\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.MsgUtils.FindMismatchPosition(System.String,System.String,System.Int32,System.Boolean)\">\r\n            <summary>\r\n            Shows the position two strings start to differ.  Comparison \r\n            starts at the start index.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"istart\">The index in the strings at which comparison should start</param>\r\n            <param name=\"ignoreCase\">Boolean indicating whether case should be ignored</param>\r\n            <returns>-1 if no mismatch found, or the index where mismatch found</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.Numerics\">\r\n            <summary>\r\n            The Numerics class contains common operations on numeric values.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Numerics.IsNumericType(System.Object)\">\r\n            <summary>\r\n            Checks the type of the object, returning true if\r\n            the object is a numeric type.\r\n            </summary>\r\n            <param name=\"obj\">The object to check</param>\r\n            <returns>true if the object is a numeric type</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Numerics.IsFloatingPointNumeric(System.Object)\">\r\n            <summary>\r\n            Checks the type of the object, returning true if\r\n            the object is a floating point numeric type.\r\n            </summary>\r\n            <param name=\"obj\">The object to check</param>\r\n            <returns>true if the object is a floating point numeric type</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Numerics.IsFixedPointNumeric(System.Object)\">\r\n            <summary>\r\n            Checks the type of the object, returning true if\r\n            the object is a fixed point numeric type.\r\n            </summary>\r\n            <param name=\"obj\">The object to check</param>\r\n            <returns>true if the object is a fixed point numeric type</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Numerics.AreEqual(System.Object,System.Object,NUnit.Framework.Constraints.Tolerance@)\">\r\n            <summary>\r\n            Test two numeric values for equality, performing the usual numeric \r\n            conversions and using a provided or default tolerance. If the tolerance \r\n            provided is Empty, this method may set it to a default tolerance.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"tolerance\">A reference to the tolerance in effect</param>\r\n            <returns>True if the values are equal</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Numerics.Compare(System.Object,System.Object)\">\r\n            <summary>\r\n            Compare two numeric values, performing the usual numeric conversions.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <returns>The relationship of the values to each other</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NUnitComparer\">\r\n            <summary>\r\n            NUnitComparer encapsulates NUnit's default behavior\r\n            in comparing two objects.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NUnitComparer.Compare(System.Object,System.Object)\">\r\n            <summary>\r\n            Compares two objects\r\n            </summary>\r\n            <param name=\"x\"></param>\r\n            <param name=\"y\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.NUnitComparer.Default\">\r\n            <summary>\r\n            Returns the default NUnitComparer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NUnitComparer`1\">\r\n            <summary>\r\n            Generic version of NUnitComparer\r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NUnitComparer`1.Compare(`0,`0)\">\r\n            <summary>\r\n            Compare two objects of the same type\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NUnitEqualityComparer\">\r\n            <summary>\r\n            NUnitEqualityComparer encapsulates NUnit's handling of\r\n            equality tests between objects.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.INUnitEqualityComparer\">\r\n            <summary>\r\n            \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.INUnitEqualityComparer.AreEqual(System.Object,System.Object,NUnit.Framework.Constraints.Tolerance@)\">\r\n            <summary>\r\n            Compares two objects for equality within a tolerance\r\n            </summary>\r\n            <param name=\"x\">The first object to compare</param>\r\n            <param name=\"y\">The second object to compare</param>\r\n            <param name=\"tolerance\">The tolerance to use in the comparison</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.caseInsensitive\">\r\n            <summary>\r\n            If true, all string comparisons will ignore case\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.compareAsCollection\">\r\n            <summary>\r\n            If true, arrays will be treated as collections, allowing\r\n            those of different dimensions to be compared\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.externalComparers\">\r\n            <summary>\r\n            Comparison objects used in comparisons for some constraints.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NUnitEqualityComparer.AreEqual(System.Object,System.Object,NUnit.Framework.Constraints.Tolerance@)\">\r\n            <summary>\r\n            Compares two objects for equality within a tolerance.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NUnitEqualityComparer.ArraysEqual(System.Array,System.Array,NUnit.Framework.Constraints.NUnitEqualityComparer.EnumerableRecursionHelper,NUnit.Framework.Constraints.Tolerance@)\">\r\n            <summary>\r\n            Helper method to compare two arrays\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NUnitEqualityComparer.DirectoriesEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Method to compare two DirectoryInfo objects\r\n            </summary>\r\n            <param name=\"x\">first directory to compare</param>\r\n            <param name=\"y\">second directory to compare</param>\r\n            <returns>true if equivalent, false if not</returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.NUnitEqualityComparer.Default\">\r\n            <summary>\r\n            Returns the default NUnitEqualityComparer\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.NUnitEqualityComparer.IgnoreCase\">\r\n            <summary>\r\n            Gets and sets a flag indicating whether case should\r\n            be ignored in determining equality.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.NUnitEqualityComparer.CompareAsCollection\">\r\n            <summary>\r\n            Gets and sets a flag indicating that arrays should be\r\n            compared as collections, without regard to their shape.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.NUnitEqualityComparer.ExternalComparers\">\r\n            <summary>\r\n            Gets and sets an external comparer to be used to\r\n            test for equality. It is applied to members of\r\n            collections, in place of NUnit's own logic.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoints\">\r\n            <summary>\r\n            Gets the list of failure points for the last Match performed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint\">\r\n            <summary>\r\n            FailurePoint class represents one point of failure\r\n            in an equality test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint.Position\">\r\n            <summary>\r\n            The location of the failure\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint.ExpectedValue\">\r\n            <summary>\r\n            The expected value\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint.ActualValue\">\r\n            <summary>\r\n            The actual value\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint.ExpectedHasData\">\r\n            <summary>\r\n            Indicates whether the expected value is valid\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.NUnitEqualityComparer.FailurePoint.ActualHasData\">\r\n            <summary>\r\n            Indicates whether the actual value is valid\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PathConstraint\">\r\n            <summary>\r\n            PathConstraint serves as the abstract base of constraints\r\n            that operate on paths and provides several helper methods.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.PathConstraint.expectedPath\">\r\n            <summary>\r\n            The expected path used in the constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.PathConstraint.actualPath\">\r\n            <summary>\r\n            The actual path being tested\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.PathConstraint.caseInsensitive\">\r\n            <summary>\r\n            Flag indicating whether a caseInsensitive comparison should be made\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Construct a PathConstraint for a give expected path\r\n            </summary>\r\n            <param name=\"expected\">The expected path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.IsMatch(System.String,System.String)\">\r\n            <summary>\r\n            Returns true if the expected path and actual path match\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of this constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.Canonicalize(System.String)\">\r\n            <summary>\r\n            Canonicalize the provided path\r\n            </summary>\r\n            <param name=\"path\"></param>\r\n            <returns>The path in standardized form</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.IsSamePath(System.String,System.String,System.Boolean)\">\r\n            <summary>\r\n            Test whether two paths are the same\r\n            </summary>\r\n            <param name=\"path1\">The first path</param>\r\n            <param name=\"path2\">The second path</param>\r\n            <param name=\"ignoreCase\">Indicates whether case should be ignored</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.IsSubPath(System.String,System.String,System.Boolean)\">\r\n            <summary>\r\n            Test whether one path is under another path\r\n            </summary>\r\n            <param name=\"path1\">The first path - supposed to be the parent path</param>\r\n            <param name=\"path2\">The second path - supposed to be the child path</param>\r\n            <param name=\"ignoreCase\">Indicates whether case should be ignored</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PathConstraint.IsSamePathOrUnder(System.String,System.String)\">\r\n            <summary>\r\n            Test whether one path is the same as or under another path\r\n            </summary>\r\n            <param name=\"path1\">The first path - supposed to be the parent path</param>\r\n            <param name=\"path2\">The second path - supposed to be the child path</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.PathConstraint.IgnoreCase\">\r\n            <summary>\r\n            Modifies the current instance to be case-insensitve\r\n            and returns it.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.PathConstraint.RespectCase\">\r\n            <summary>\r\n            Modifies the current instance to be case-sensitve\r\n            and returns it.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SamePathConstraint\">\r\n            <summary>\r\n            Summary description for SamePathConstraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SamePathConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:SamePathConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SamePathConstraint.IsMatch(System.String,System.String)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"expectedPath\">The expected path</param>\r\n            <param name=\"actualPath\">The actual path</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SamePathConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SubPathConstraint\">\r\n            <summary>\r\n            SubPathConstraint tests that the actual path is under the expected path\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SubPathConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:SubPathConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SubPathConstraint.IsMatch(System.String,System.String)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"expectedPath\">The expected path</param>\r\n            <param name=\"actualPath\">The actual path</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SubPathConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SamePathOrUnderConstraint\">\r\n            <summary>\r\n            SamePathOrUnderConstraint tests that one path is under another\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SamePathOrUnderConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:SamePathOrUnderConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SamePathOrUnderConstraint.IsMatch(System.String,System.String)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"expectedPath\">The expected path</param>\r\n            <param name=\"actualPath\">The actual path</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SamePathOrUnderConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PredicateConstraint`1\">\r\n            <summary>\r\n            Predicate constraint wraps a Predicate in a constraint,\r\n            returning success if the predicate is true.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PredicateConstraint`1.#ctor(System.Predicate{`0})\">\r\n            <summary>\r\n            Construct a PredicateConstraint from a predicate\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PredicateConstraint`1.Matches(System.Object)\">\r\n            <summary>\r\n            Determines whether the predicate succeeds when applied\r\n            to the actual value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PredicateConstraint`1.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Writes the description to a MessageWriter\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NotConstraint\">\r\n            <summary>\r\n            NotConstraint negates the effect of some other constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NotConstraint.#ctor(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:NotConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"baseConstraint\">The base constraint to be negated.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NotConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for if the base constraint fails, false if it succeeds</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NotConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NotConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a MessageWriter.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AllItemsConstraint\">\r\n            <summary>\r\n            AllItemsConstraint applies another constraint to each\r\n            item in a collection, succeeding if they all succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AllItemsConstraint.#ctor(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Construct an AllItemsConstraint on top of an existing constraint\r\n            </summary>\r\n            <param name=\"itemConstraint\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AllItemsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Apply the item constraint to each item in the collection,\r\n            failing if any item fails.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AllItemsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SomeItemsConstraint\">\r\n            <summary>\r\n            SomeItemsConstraint applies another constraint to each\r\n            item in a collection, succeeding if any of them succeeds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SomeItemsConstraint.#ctor(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Construct a SomeItemsConstraint on top of an existing constraint\r\n            </summary>\r\n            <param name=\"itemConstraint\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SomeItemsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Apply the item constraint to each item in the collection,\r\n            succeeding if any item succeeds.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SomeItemsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NoItemConstraint\">\r\n            <summary>\r\n            NoItemConstraint applies another constraint to each\r\n            item in a collection, failing if any of them succeeds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NoItemConstraint.#ctor(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Construct a NoItemConstraint on top of an existing constraint\r\n            </summary>\r\n            <param name=\"itemConstraint\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NoItemConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Apply the item constraint to each item in the collection,\r\n            failing if any item fails.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NoItemConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ExactCountConstraint\">\r\n            <summary>\r\n            ExactCoutConstraint applies another constraint to each\r\n            item in a collection, succeeding only if a specified\r\n            number of items succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactCountConstraint.#ctor(System.Int32,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Construct an ExactCountConstraint on top of an existing constraint\r\n            </summary>\r\n            <param name=\"expectedCount\"></param>\r\n            <param name=\"itemConstraint\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactCountConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Apply the item constraint to each item in the collection,\r\n            succeeding only if the expected number of items pass.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactCountConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\"></param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PropertyExistsConstraint\">\r\n            <summary>\r\n            PropertyExistsConstraint tests that a named property\r\n            exists on the object provided through Match.\r\n            \r\n            Originally, PropertyConstraint provided this feature\r\n            in addition to making optional tests on the vaue\r\n            of the property. The two constraints are now separate.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyExistsConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:PropertyExistConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"name\">The name of the property.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyExistsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the property exists for a given object\r\n            </summary>\r\n            <param name=\"actual\">The object to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyExistsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyExistsConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyExistsConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of the constraint.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.PropertyConstraint\">\r\n            <summary>\r\n            PropertyConstraint extracts a named property and uses\r\n            its value as the actual value for a chained constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyConstraint.#ctor(System.String,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:PropertyConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"name\">The name.</param>\r\n            <param name=\"baseConstraint\">The constraint to apply to the property.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.PropertyConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of the constraint.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.RangeConstraint`1\">\r\n            <summary>\r\n            RangeConstraint tests whethe two values are within a \r\n            specified range.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.RangeConstraint`1.#ctor(`0,`0)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:RangeConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"from\">From.</param>\r\n            <param name=\"to\">To.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.RangeConstraint`1.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.RangeConstraint`1.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ResolvableConstraintExpression\">\r\n            <summary>\r\n            ResolvableConstraintExpression is used to represent a compound\r\n            constraint being constructed at a point where the last operator\r\n            may either terminate the expression or may have additional \r\n            qualifying constraints added to it. \r\n            \r\n            It is used, for example, for a Property element or for\r\n            an Exception element, either of which may be optionally\r\n            followed by constraints that apply to the property or \r\n            exception.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.#ctor\">\r\n            <summary>\r\n            Create a new instance of ResolvableConstraintExpression\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.#ctor(NUnit.Framework.Constraints.ConstraintBuilder)\">\r\n            <summary>\r\n            Create a new instance of ResolvableConstraintExpression,\r\n            passing in a pre-populated ConstraintBuilder.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.NUnit#Framework#Constraints#IResolveConstraint#Resolve\">\r\n            <summary>\r\n            Resolve the current expression to a Constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_BitwiseAnd(NUnit.Framework.Constraints.ResolvableConstraintExpression,NUnit.Framework.Constraints.ResolvableConstraintExpression)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied only if both \r\n            argument constraints are satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_BitwiseAnd(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.ResolvableConstraintExpression)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied only if both \r\n            argument constraints are satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_BitwiseAnd(NUnit.Framework.Constraints.ResolvableConstraintExpression,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied only if both \r\n            argument constraints are satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_BitwiseOr(NUnit.Framework.Constraints.ResolvableConstraintExpression,NUnit.Framework.Constraints.ResolvableConstraintExpression)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied if either \r\n            of the argument constraints is satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_BitwiseOr(NUnit.Framework.Constraints.ResolvableConstraintExpression,NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied if either \r\n            of the argument constraints is satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_BitwiseOr(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.ResolvableConstraintExpression)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied if either \r\n            of the argument constraints is satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ResolvableConstraintExpression.op_LogicalNot(NUnit.Framework.Constraints.ResolvableConstraintExpression)\">\r\n            <summary>\r\n            This operator creates a constraint that is satisfied if the \r\n            argument constraint is not satisfied.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ResolvableConstraintExpression.And\">\r\n            <summary>\r\n            Appends an And Operator to the expression\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ResolvableConstraintExpression.Or\">\r\n            <summary>\r\n            Appends an Or operator to the expression.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ReusableConstraint\">\r\n            <summary>\r\n            ReusableConstraint wraps a resolved constraint so that it\r\n            may be saved and reused as needed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ReusableConstraint.#ctor(NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Construct a ReusableConstraint\r\n            </summary>\r\n            <param name=\"c\">The constraint or expression to be reused</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ReusableConstraint.op_Implicit(NUnit.Framework.Constraints.Constraint)~NUnit.Framework.Constraints.ReusableConstraint\">\r\n            <summary>\r\n            Conversion operator from a normal constraint to a ReusableConstraint.\r\n            </summary>\r\n            <param name=\"c\">The original constraint to be wrapped as a ReusableConstraint</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ReusableConstraint.ToString\">\r\n            <summary>\r\n            Returns the string representation of the constraint.\r\n            </summary>\r\n            <returns>A string representing the constraint</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ReusableConstraint.Resolve\">\r\n            <summary>\r\n            Resolves the ReusableConstraint by returning the constraint\r\n            that it originally wrapped.\r\n            </summary>\r\n            <returns>A resolved constraint</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SameAsConstraint\">\r\n            <summary>\r\n            SameAsConstraint tests whether an object is identical to\r\n            the object passed to its constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SameAsConstraint.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:SameAsConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected object.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SameAsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SameAsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.BinarySerializableConstraint\">\r\n            <summary>\r\n            BinarySerializableConstraint tests whether \r\n            an object is serializable in binary format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinarySerializableConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinarySerializableConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinarySerializableConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.BinarySerializableConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.XmlSerializableConstraint\">\r\n            <summary>\r\n            BinarySerializableConstraint tests whether \r\n            an object is serializable in binary format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.XmlSerializableConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.XmlSerializableConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.XmlSerializableConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.XmlSerializableConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of this constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.StringConstraint\">\r\n            <summary>\r\n            StringConstraint is the abstract base for constraints\r\n            that operate on strings. It supports the IgnoreCase\r\n            modifier for string operations.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.StringConstraint.expected\">\r\n            <summary>\r\n            The expected value\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.StringConstraint.caseInsensitive\">\r\n            <summary>\r\n            Indicates whether tests should be case-insensitive\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.StringConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Constructs a StringConstraint given an expected value\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.StringConstraint.IgnoreCase\">\r\n            <summary>\r\n            Modify the constraint to ignore case in matching.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EmptyStringConstraint\">\r\n            <summary>\r\n            EmptyStringConstraint tests whether a string is empty.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyStringConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EmptyStringConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.NullOrEmptyStringConstraint\">\r\n            <summary>\r\n            NullEmptyStringConstraint tests whether a string is either null or empty.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NullOrEmptyStringConstraint.#ctor\">\r\n            <summary>\r\n            Constructs a new NullOrEmptyStringConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NullOrEmptyStringConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.NullOrEmptyStringConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.SubstringConstraint\">\r\n            <summary>\r\n            SubstringConstraint can test whether a string contains\r\n            the expected substring.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SubstringConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:SubstringConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SubstringConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.SubstringConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.StartsWithConstraint\">\r\n            <summary>\r\n            StartsWithConstraint can test whether a string starts\r\n            with an expected substring.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.StartsWithConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:StartsWithConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.StartsWithConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is matched by the actual value.\r\n            This is a template method, which calls the IsMatch method\r\n            of the derived class.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.StartsWithConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.EndsWithConstraint\">\r\n            <summary>\r\n            EndsWithConstraint can test whether a string ends\r\n            with an expected substring.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EndsWithConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:EndsWithConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EndsWithConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is matched by the actual value.\r\n            This is a template method, which calls the IsMatch method\r\n            of the derived class.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.EndsWithConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.RegexConstraint\">\r\n            <summary>\r\n            RegexConstraint can test whether a string matches\r\n            the pattern provided.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.RegexConstraint.#ctor(System.String)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:RegexConstraint\"/> class.\r\n            </summary>\r\n            <param name=\"pattern\">The pattern.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.RegexConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True for success, false for failure</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.RegexConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ThrowsConstraint\">\r\n            <summary>\r\n            ThrowsConstraint is used to test the exception thrown by \r\n            a delegate by applying a constraint to it.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsConstraint.#ctor(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:ThrowsConstraint\"/> class,\r\n            using a constraint to be applied to the exception.\r\n            </summary>\r\n            <param name=\"baseConstraint\">A constraint to apply to the caught exception.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Executes the code of the delegate and captures any exception.\r\n            If a non-null base constraint was provided, it applies that\r\n            constraint to the exception.\r\n            </summary>\r\n            <param name=\"actual\">A delegate representing the code to be tested</param>\r\n            <returns>True if an exception is thrown and the constraint succeeds, otherwise false</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsConstraint.Matches(NUnit.Framework.Constraints.ActualValueDelegate)\">\r\n            <summary>\r\n            Converts an ActualValueDelegate to a TestDelegate\r\n            before calling the primary overload.\r\n            </summary>\r\n            <param name=\"del\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsConstraint.GetStringRepresentation\">\r\n            <summary>\r\n            Returns the string representation of this constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.ThrowsConstraint.ActualException\">\r\n            <summary>\r\n            Get the actual exception thrown - used by Assert.Throws.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ThrowsNothingConstraint\">\r\n            <summary>\r\n            ThrowsNothingConstraint tests that a delegate does not\r\n            throw an exception.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsNothingConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether the constraint is satisfied by a given value\r\n            </summary>\r\n            <param name=\"actual\">The value to be tested</param>\r\n            <returns>True if no exception is thrown, otherwise false</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsNothingConstraint.Matches(NUnit.Framework.Constraints.ActualValueDelegate)\">\r\n            <summary>\r\n            Converts an ActualValueDelegate to a TestDelegate\r\n            before calling the primary overload.\r\n            </summary>\r\n            <param name=\"del\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsNothingConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the constraint description to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the description is displayed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ThrowsNothingConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. The default implementation simply writes\r\n            the raw value of actual, leaving it to the writer to\r\n            perform any formatting.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ToleranceMode\">\r\n            <summary>\r\n            Modes in which the tolerance value for a comparison can\r\n            be interpreted.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ToleranceMode.None\">\r\n            <summary>\r\n            The tolerance was created with a value, without specifying \r\n            how the value would be used. This is used to prevent setting\r\n            the mode more than once and is generally changed to Linear\r\n            upon execution of the test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ToleranceMode.Linear\">\r\n            <summary>\r\n            The tolerance is used as a numeric range within which\r\n            two compared values are considered to be equal.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ToleranceMode.Percent\">\r\n            <summary>\r\n            Interprets the tolerance as the percentage by which\r\n            the two compared values my deviate from each other.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.ToleranceMode.Ulps\">\r\n            <summary>\r\n            Compares two values based in their distance in\r\n            representable numbers.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.Tolerance\">\r\n            <summary>\r\n            The Tolerance class generalizes the notion of a tolerance\r\n            within which an equality test succeeds. Normally, it is\r\n            used with numeric types, but it can be used with any\r\n            type that supports taking a difference between two \r\n            objects and comparing that difference to a value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Tolerance.#ctor(System.Object)\">\r\n            <summary>\r\n            Constructs a linear tolerance of a specdified amount\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Tolerance.#ctor(System.Object,NUnit.Framework.Constraints.ToleranceMode)\">\r\n            <summary>\r\n            Constructs a tolerance given an amount and ToleranceMode\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.Tolerance.CheckLinearAndNumeric\">\r\n            <summary>\r\n            Tests that the current Tolerance is linear with a \r\n            numeric value, throwing an exception if it is not.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Empty\">\r\n            <summary>\r\n            Returns an empty Tolerance object, equivalent to\r\n            specifying no tolerance. In most cases, it results\r\n            in an exact match but for floats and doubles a\r\n            default tolerance may be used.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Zero\">\r\n            <summary>\r\n            Returns a zero Tolerance object, equivalent to \r\n            specifying an exact match.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Mode\">\r\n            <summary>\r\n            Gets the ToleranceMode for the current Tolerance\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Value\">\r\n            <summary>\r\n            Gets the value of the current Tolerance instance.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Percent\">\r\n            <summary>\r\n            Returns a new tolerance, using the current amount as a percentage.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Ulps\">\r\n            <summary>\r\n            Returns a new tolerance, using the current amount in Ulps.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Days\">\r\n            <summary>\r\n            Returns a new tolerance with a TimeSpan as the amount, using \r\n            the current amount as a number of days.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Hours\">\r\n            <summary>\r\n            Returns a new tolerance with a TimeSpan as the amount, using \r\n            the current amount as a number of hours.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Minutes\">\r\n            <summary>\r\n            Returns a new tolerance with a TimeSpan as the amount, using \r\n            the current amount as a number of minutes.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Seconds\">\r\n            <summary>\r\n            Returns a new tolerance with a TimeSpan as the amount, using \r\n            the current amount as a number of seconds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Milliseconds\">\r\n            <summary>\r\n            Returns a new tolerance with a TimeSpan as the amount, using \r\n            the current amount as a number of milliseconds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.Ticks\">\r\n            <summary>\r\n            Returns a new tolerance with a TimeSpan as the amount, using \r\n            the current amount as a number of clock ticks.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Constraints.Tolerance.IsEmpty\">\r\n            <summary>\r\n            Returns true if the current tolerance is empty.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.TypeConstraint\">\r\n            <summary>\r\n            TypeConstraint is the abstract base for constraints\r\n            that take a Type as their expected value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.Constraints.TypeConstraint.expectedType\">\r\n            <summary>\r\n            The expected Type used by the constraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.TypeConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct a TypeConstraint for a given Type\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.TypeConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. TypeConstraints override this method to write\r\n            the name of the type.\r\n            </summary>\r\n            <param name=\"writer\">The writer on which the actual value is displayed</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ExactTypeConstraint\">\r\n            <summary>\r\n            ExactTypeConstraint is used to test that an object\r\n            is of the exact type provided in the constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactTypeConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct an ExactTypeConstraint for a given Type\r\n            </summary>\r\n            <param name=\"type\">The expected Type.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactTypeConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test that an object is of the exact type specified\r\n            </summary>\r\n            <param name=\"actual\">The actual value.</param>\r\n            <returns>True if the tested object is of the exact type provided, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExactTypeConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to use</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.ExceptionTypeConstraint\">\r\n            <summary>\r\n            ExceptionTypeConstraint is a special version of ExactTypeConstraint\r\n            used to provided detailed info about the exception thrown in\r\n            an error message.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExceptionTypeConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Constructs an ExceptionTypeConstraint\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.ExceptionTypeConstraint.WriteActualValueTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write the actual value for a failing constraint test to a\r\n            MessageWriter. Overriden to write additional information \r\n            in the case of an Exception.\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to use</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.InstanceOfTypeConstraint\">\r\n            <summary>\r\n            InstanceOfTypeConstraint is used to test that an object\r\n            is of the same type provided or derived from it.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.InstanceOfTypeConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct an InstanceOfTypeConstraint for the type provided\r\n            </summary>\r\n            <param name=\"type\">The expected Type</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.InstanceOfTypeConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether an object is of the specified type or a derived type\r\n            </summary>\r\n            <param name=\"actual\">The object to be tested</param>\r\n            <returns>True if the object is of the provided type or derives from it, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.InstanceOfTypeConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to use</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AssignableFromConstraint\">\r\n            <summary>\r\n            AssignableFromConstraint is used to test that an object\r\n            can be assigned from a given Type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AssignableFromConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct an AssignableFromConstraint for the type provided\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AssignableFromConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether an object can be assigned from the specified type\r\n            </summary>\r\n            <param name=\"actual\">The object to be tested</param>\r\n            <returns>True if the object can be assigned a value of the expected Type, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AssignableFromConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to use</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Constraints.AssignableToConstraint\">\r\n            <summary>\r\n            AssignableToConstraint is used to test that an object\r\n            can be assigned to a given Type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AssignableToConstraint.#ctor(System.Type)\">\r\n            <summary>\r\n            Construct an AssignableToConstraint for the type provided\r\n            </summary>\r\n            <param name=\"type\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AssignableToConstraint.Matches(System.Object)\">\r\n            <summary>\r\n            Test whether an object can be assigned to the specified type\r\n            </summary>\r\n            <param name=\"actual\">The object to be tested</param>\r\n            <returns>True if the object can be assigned a value of the expected Type, otherwise false.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Constraints.AssignableToConstraint.WriteDescriptionTo(NUnit.Framework.Constraints.MessageWriter)\">\r\n            <summary>\r\n            Write a description of this constraint to a MessageWriter\r\n            </summary>\r\n            <param name=\"writer\">The MessageWriter to use</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.AssertionException\">\r\n            <summary>\r\n            Thrown when an assertion failed.\r\n            </summary>\r\n            \r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionException.#ctor(System.String)\">\r\n            <param name=\"message\">The error message that explains \r\n            the reason for the exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionException.#ctor(System.String,System.Exception)\">\r\n            <param name=\"message\">The error message that explains \r\n            the reason for the exception</param>\r\n            <param name=\"inner\">The exception that caused the \r\n            current exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)\">\r\n            <summary>\r\n            Serialization Constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.IgnoreException\">\r\n            <summary>\r\n            Thrown when an assertion failed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IgnoreException.#ctor(System.String)\">\r\n            <param name=\"message\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IgnoreException.#ctor(System.String,System.Exception)\">\r\n            <param name=\"message\">The error message that explains \r\n            the reason for the exception</param>\r\n            <param name=\"inner\">The exception that caused the \r\n            current exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IgnoreException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)\">\r\n            <summary>\r\n            Serialization Constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.InconclusiveException\">\r\n            <summary>\r\n            Thrown when a test executes inconclusively.\r\n            </summary>\r\n            \r\n        </member>\r\n        <member name=\"M:NUnit.Framework.InconclusiveException.#ctor(System.String)\">\r\n            <param name=\"message\">The error message that explains \r\n            the reason for the exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.InconclusiveException.#ctor(System.String,System.Exception)\">\r\n            <param name=\"message\">The error message that explains \r\n            the reason for the exception</param>\r\n            <param name=\"inner\">The exception that caused the \r\n            current exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.InconclusiveException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)\">\r\n            <summary>\r\n            Serialization Constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SuccessException\">\r\n            <summary>\r\n            Thrown when an assertion failed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.SuccessException.#ctor(System.String)\">\r\n            <param name=\"message\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.SuccessException.#ctor(System.String,System.Exception)\">\r\n            <param name=\"message\">The error message that explains \r\n            the reason for the exception</param>\r\n            <param name=\"inner\">The exception that caused the \r\n            current exception</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.SuccessException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)\">\r\n            <summary>\r\n            Serialization Constructor\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.INUnitEqualityComparer`1\">\r\n            <summary>\r\n            \r\n            </summary>\r\n            <typeparam name=\"T\"></typeparam>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.INUnitEqualityComparer`1.AreEqual(`0,`0,NUnit.Framework.Constraints.Tolerance@)\">\r\n            <summary>\r\n            Compares two objects of a given Type for equality within a tolerance\r\n            </summary>\r\n            <param name=\"x\">The first object to compare</param>\r\n            <param name=\"y\">The second object to compare</param>\r\n            <param name=\"tolerance\">The tolerance to use in the comparison</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ActionTargets\">\r\n            <summary>\r\n            The different targets a test action attribute can be applied to\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.ActionTargets.Default\">\r\n            <summary>\r\n            Default target, which is determined by where the action attribute is attached\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.ActionTargets.Test\">\r\n            <summary>\r\n            Target a individual test case\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.ActionTargets.Suite\">\r\n            <summary>\r\n            Target a suite of test cases\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestDelegate\">\r\n            <summary>\r\n            Delegate used by tests that execute code and\r\n            capture any thrown exception.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Assert\">\r\n            <summary>\r\n            The Assert class contains a collection of static methods that\r\n            implement the most common assertions used in NUnit.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.#ctor\">\r\n            <summary>\r\n            We don't actually want any instances of this object, but some people\r\n            like to inherit from it to add other static methods. Hence, the\r\n            protected constructor disallows any instances of this object. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Equals(System.Object,System.Object)\">\r\n            <summary>\r\n            The Equals method throws an AssertionException. This is done \r\n            to make sure there is no mistake by calling this function.\r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.ReferenceEquals(System.Object,System.Object)\">\r\n            <summary>\r\n            override the default ReferenceEquals to throw an AssertionException. This \r\n            implementation makes sure there is no mistake in calling this function \r\n            as part of Assert. \r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AssertDoublesAreEqual(System.Double,System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Helper for Assert.AreEqual(double expected, double actual, ...)\r\n            allowing code generation to work consistently.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Pass(System.String,System.Object[])\">\r\n            <summary>\r\n            Throws a <see cref=\"T:NUnit.Framework.SuccessException\"/> with the message and arguments \r\n            that are passed in. This allows a test to be cut short, with a result\r\n            of success returned to NUnit.\r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.AssertionException\"/> with.</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Pass(System.String)\">\r\n            <summary>\r\n            Throws a <see cref=\"T:NUnit.Framework.SuccessException\"/> with the message and arguments \r\n            that are passed in. This allows a test to be cut short, with a result\r\n            of success returned to NUnit.\r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.AssertionException\"/> with.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Pass\">\r\n            <summary>\r\n            Throws a <see cref=\"T:NUnit.Framework.SuccessException\"/> with the message and arguments \r\n            that are passed in. This allows a test to be cut short, with a result\r\n            of success returned to NUnit.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Fail(System.String,System.Object[])\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.AssertionException\"/> with the message and arguments \r\n            that are passed in. This is used by the other Assert functions. \r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.AssertionException\"/> with.</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Fail(System.String)\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.AssertionException\"/> with the message that is \r\n            passed in. This is used by the other Assert functions. \r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.AssertionException\"/> with.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Fail\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.AssertionException\"/>. \r\n            This is used by the other Assert functions. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Ignore(System.String,System.Object[])\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.IgnoreException\"/> with the message and arguments \r\n            that are passed in.  This causes the test to be reported as ignored.\r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.AssertionException\"/> with.</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Ignore(System.String)\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.IgnoreException\"/> with the message that is \r\n            passed in. This causes the test to be reported as ignored. \r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.AssertionException\"/> with.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Ignore\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.IgnoreException\"/>. \r\n            This causes the test to be reported as ignored. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Inconclusive(System.String,System.Object[])\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.InconclusiveException\"/> with the message and arguments \r\n            that are passed in.  This causes the test to be reported as inconclusive.\r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.InconclusiveException\"/> with.</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Inconclusive(System.String)\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.InconclusiveException\"/> with the message that is \r\n            passed in. This causes the test to be reported as inconclusive. \r\n            </summary>\r\n            <param name=\"message\">The message to initialize the <see cref=\"T:NUnit.Framework.InconclusiveException\"/> with.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Inconclusive\">\r\n            <summary>\r\n            Throws an <see cref=\"T:NUnit.Framework.InconclusiveException\"/>. \r\n            This causes the test to be reported as Inconclusive. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That``1(``0@,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That``1(``0@,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That``1(``0@,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display if the condition is false</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display if the condition is false</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.That(NUnit.Framework.TestDelegate,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Asserts that the code represented by a delegate throws an exception\r\n            that satisfies the constraint provided.\r\n            </summary>\r\n            <param name=\"code\">A TestDelegate to be executed</param>\r\n            <param name=\"constraint\">A ThrowsConstraint used in the test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.ByVal(System.Object,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            Used as a synonym for That in rare cases where a private setter \r\n            causes a Visual Basic compilation error.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.ByVal(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            Used as a synonym for That in rare cases where a private setter \r\n            causes a Visual Basic compilation error.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.ByVal(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure. \r\n            Used as a synonym for That in rare cases where a private setter \r\n            causes a Visual Basic compilation error.\r\n            </summary>\r\n            <remarks>\r\n            This method is provided for use by VB developers needing to test\r\n            the value of properties with private setters.\r\n            </remarks>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws(NUnit.Framework.Constraints.IResolveConstraint,NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <param name=\"expression\">A constraint to be satisfied by the exception</param>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws(NUnit.Framework.Constraints.IResolveConstraint,NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <param name=\"expression\">A constraint to be satisfied by the exception</param>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws(NUnit.Framework.Constraints.IResolveConstraint,NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <param name=\"expression\">A constraint to be satisfied by the exception</param>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws(System.Type,NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <param name=\"expectedExceptionType\">The exception Type expected</param>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws(System.Type,NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <param name=\"expectedExceptionType\">The exception Type expected</param>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws(System.Type,NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <param name=\"expectedExceptionType\">The exception Type expected</param>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws``1(NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <typeparam name=\"T\">Type of the expected exception</typeparam>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws``1(NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <typeparam name=\"T\">Type of the expected exception</typeparam>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Throws``1(NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate throws a particular exception when called.\r\n            </summary>\r\n            <typeparam name=\"T\">Type of the expected exception</typeparam>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch(NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception when called\r\n            and returns it.\r\n            </summary>\r\n            <param name=\"code\">A TestDelegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch(NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception when called\r\n            and returns it.\r\n            </summary>\r\n            <param name=\"code\">A TestDelegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch(NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception when called\r\n            and returns it.\r\n            </summary>\r\n            <param name=\"code\">A TestDelegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch(System.Type,NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception of a certain Type\r\n            or one derived from it when called and returns it.\r\n            </summary>\r\n            <param name=\"expectedExceptionType\">The expected Exception Type</param>\r\n            <param name=\"code\">A TestDelegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch(System.Type,NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception of a certain Type\r\n            or one derived from it when called and returns it.\r\n            </summary>\r\n            <param name=\"expectedExceptionType\">The expected Exception Type</param>\r\n            <param name=\"code\">A TestDelegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch(System.Type,NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception of a certain Type\r\n            or one derived from it when called and returns it.\r\n            </summary>\r\n            <param name=\"expectedExceptionType\">The expected Exception Type</param>\r\n            <param name=\"code\">A TestDelegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch``1(NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception of a certain Type\r\n            or one derived from it when called and returns it.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Exception Type</typeparam>\r\n            <param name=\"code\">A TestDelegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch``1(NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception of a certain Type\r\n            or one derived from it when called and returns it.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Exception Type</typeparam>\r\n            <param name=\"code\">A TestDelegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Catch``1(NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate throws an exception of a certain Type\r\n            or one derived from it when called and returns it.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Exception Type</typeparam>\r\n            <param name=\"code\">A TestDelegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.DoesNotThrow(NUnit.Framework.TestDelegate,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that a delegate does not throw an exception\r\n            </summary>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.DoesNotThrow(NUnit.Framework.TestDelegate,System.String)\">\r\n            <summary>\r\n            Verifies that a delegate does not throw an exception.\r\n            </summary>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.DoesNotThrow(NUnit.Framework.TestDelegate)\">\r\n            <summary>\r\n            Verifies that a delegate does not throw an exception.\r\n            </summary>\r\n            <param name=\"code\">A TestSnippet delegate</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.True(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.True(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.True(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsTrue(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsTrue(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsTrue(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.False(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is false. If the condition is true the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.False(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is false. If the condition is true the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.False(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is false. If the condition is true the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsFalse(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is false. If the condition is true the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsFalse(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is false. If the condition is true the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsFalse(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is false. If the condition is true the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.NotNull(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the object that is passed in is not equal to <code>null</code>\r\n            If the object is <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.NotNull(System.Object,System.String)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is not equal to <code>null</code>\r\n            If the object is <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.NotNull(System.Object)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is not equal to <code>null</code>\r\n            If the object is <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotNull(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the object that is passed in is not equal to <code>null</code>\r\n            If the object is <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotNull(System.Object,System.String)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is not equal to <code>null</code>\r\n            If the object is <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotNull(System.Object)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is not equal to <code>null</code>\r\n            If the object is <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Null(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the object that is passed in is equal to <code>null</code>\r\n            If the object is not <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Null(System.Object,System.String)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is equal to <code>null</code>\r\n            If the object is not <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Null(System.Object)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is equal to <code>null</code>\r\n            If the object is not <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNull(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the object that is passed in is equal to <code>null</code>\r\n            If the object is not <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNull(System.Object,System.String)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is equal to <code>null</code>\r\n            If the object is not <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNull(System.Object)\">\r\n            <summary>\r\n            Verifies that the object that is passed in is equal to <code>null</code>\r\n            If the object is not <code>null</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"anObject\">The object that is to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNaN(System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the double that is passed in is an <code>NaN</code> value.\r\n            If the object is not <code>NaN</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"aDouble\">The value that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNaN(System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that the double that is passed in is an <code>NaN</code> value.\r\n            If the object is not <code>NaN</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"aDouble\">The value that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNaN(System.Double)\">\r\n            <summary>\r\n            Verifies that the double that is passed in is an <code>NaN</code> value.\r\n            If the object is not <code>NaN</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"aDouble\">The value that is to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNaN(System.Nullable{System.Double},System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the double that is passed in is an <code>NaN</code> value.\r\n            If the object is not <code>NaN</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"aDouble\">The value that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNaN(System.Nullable{System.Double},System.String)\">\r\n            <summary>\r\n            Verifies that the double that is passed in is an <code>NaN</code> value.\r\n            If the object is not <code>NaN</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"aDouble\">The value that is to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNaN(System.Nullable{System.Double})\">\r\n            <summary>\r\n            Verifies that the double that is passed in is an <code>NaN</code> value.\r\n            If the object is not <code>NaN</code> then an <see cref=\"T:NUnit.Framework.AssertionException\"/>\r\n            is thrown.\r\n            </summary>\r\n            <param name=\"aDouble\">The value that is to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsEmpty(System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that a string is empty - that is equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsEmpty(System.String,System.String)\">\r\n            <summary>\r\n            Assert that a string is empty - that is equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsEmpty(System.String)\">\r\n            <summary>\r\n            Assert that a string is empty - that is equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsEmpty(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing ICollection</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsEmpty(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing ICollection</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsEmpty(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing ICollection</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotEmpty(System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that a string is not empty - that is not equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotEmpty(System.String,System.String)\">\r\n            <summary>\r\n            Assert that a string is not empty - that is not equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotEmpty(System.String)\">\r\n            <summary>\r\n            Assert that a string is not empty - that is not equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotEmpty(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that an array, list or other collection is not empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing ICollection</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotEmpty(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is not empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing ICollection</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotEmpty(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is not empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing ICollection</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNullOrEmpty(System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that a string is either null or equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNullOrEmpty(System.String,System.String)\">\r\n            <summary>\r\n            Assert that a string is either null or equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNullOrEmpty(System.String)\">\r\n            <summary>\r\n            Assert that a string is either null or equal to string.Empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotNullOrEmpty(System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that a string is not null or empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotNullOrEmpty(System.String,System.String)\">\r\n            <summary>\r\n            Assert that a string is not null or empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotNullOrEmpty(System.String)\">\r\n            <summary>\r\n            Assert that a string is not null or empty\r\n            </summary>\r\n            <param name=\"aString\">The string to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsAssignableFrom(System.Type,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object may be assigned a  value of a given Type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type.</param>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsAssignableFrom(System.Type,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object may be assigned a  value of a given Type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type.</param>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsAssignableFrom(System.Type,System.Object)\">\r\n            <summary>\r\n            Asserts that an object may be assigned a  value of a given Type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type.</param>\r\n            <param name=\"actual\">The object under examination</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsAssignableFrom``1(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object may be assigned a  value of a given Type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type.</typeparam>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsAssignableFrom``1(System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object may be assigned a  value of a given Type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type.</typeparam>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsAssignableFrom``1(System.Object)\">\r\n            <summary>\r\n            Asserts that an object may be assigned a  value of a given Type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type.</typeparam>\r\n            <param name=\"actual\">The object under examination</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotAssignableFrom(System.Type,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object may not be assigned a  value of a given Type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type.</param>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotAssignableFrom(System.Type,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object may not be assigned a  value of a given Type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type.</param>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotAssignableFrom(System.Type,System.Object)\">\r\n            <summary>\r\n            Asserts that an object may not be assigned a  value of a given Type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type.</param>\r\n            <param name=\"actual\">The object under examination</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotAssignableFrom``1(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object may not be assigned a  value of a given Type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type.</typeparam>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotAssignableFrom``1(System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object may not be assigned a  value of a given Type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type.</typeparam>\r\n            <param name=\"actual\">The object under examination</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotAssignableFrom``1(System.Object)\">\r\n            <summary>\r\n            Asserts that an object may not be assigned a  value of a given Type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type.</typeparam>\r\n            <param name=\"actual\">The object under examination</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOf(System.Type,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOf(System.Type,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOf(System.Type,System.Object)\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOfType(System.Type,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOfType(System.Type,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOfType(System.Type,System.Object)\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOf``1(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type</typeparam>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOf``1(System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type</typeparam>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsInstanceOf``1(System.Object)\">\r\n            <summary>\r\n            Asserts that an object is an instance of a given type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type</typeparam>\r\n            <param name=\"actual\">The object being examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOf(System.Type,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOf(System.Type,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOf(System.Type,System.Object)\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOfType(System.Type,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOfType(System.Type,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOfType(System.Type,System.Object)\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <param name=\"expected\">The expected Type</param>\r\n            <param name=\"actual\">The object being examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOf``1(System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type</typeparam>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOf``1(System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type</typeparam>\r\n            <param name=\"actual\">The object being examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.IsNotInstanceOf``1(System.Object)\">\r\n            <summary>\r\n            Asserts that an object is not an instance of a given type.\r\n            </summary>\r\n            <typeparam name=\"T\">The expected Type</typeparam>\r\n            <param name=\"actual\">The object being examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Int32,System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Int32,System.Int32,System.String)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Int64,System.Int64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Int64,System.Int64,System.String)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Int64,System.Int64)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.UInt32,System.UInt32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.UInt32,System.UInt32,System.String)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.UInt32,System.UInt32)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.UInt64,System.UInt64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.UInt64,System.UInt64,System.String)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.UInt64,System.UInt64)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Decimal,System.Decimal,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Decimal,System.Decimal,System.String)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Decimal,System.Decimal)\">\r\n            <summary>\r\n            Verifies that two values are equal. If they are not, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Double,System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two doubles are equal considering a delta. If the\r\n            expected value is infinity then the delta value is ignored. If \r\n            they are not equal then an <see cref=\"T:NUnit.Framework.AssertionException\"/> is\r\n            thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Double,System.Double,System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that two doubles are equal considering a delta. If the\r\n            expected value is infinity then the delta value is ignored. If \r\n            they are not equal then an <see cref=\"T:NUnit.Framework.AssertionException\"/> is\r\n            thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Double,System.Double,System.Double)\">\r\n            <summary>\r\n            Verifies that two doubles are equal considering a delta. If the\r\n            expected value is infinity then the delta value is ignored. If \r\n            they are not equal then an <see cref=\"T:NUnit.Framework.AssertionException\"/> is\r\n            thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Double,System.Nullable{System.Double},System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two doubles are equal considering a delta. If the\r\n            expected value is infinity then the delta value is ignored. If \r\n            they are not equal then an <see cref=\"T:NUnit.Framework.AssertionException\"/> is\r\n            thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Double,System.Nullable{System.Double},System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that two doubles are equal considering a delta. If the\r\n            expected value is infinity then the delta value is ignored. If \r\n            they are not equal then an <see cref=\"T:NUnit.Framework.AssertionException\"/> is\r\n            thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Double,System.Nullable{System.Double},System.Double)\">\r\n            <summary>\r\n            Verifies that two doubles are equal considering a delta. If the\r\n            expected value is infinity then the delta value is ignored. If \r\n            they are not equal then an <see cref=\"T:NUnit.Framework.AssertionException\"/> is\r\n            thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"delta\">The maximum acceptable difference between the\r\n            the expected and the actual</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Object,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two objects are equal.  Two objects are considered\r\n            equal if both are null, or if both have the same value. NUnit\r\n            has special semantics for some object types.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The value that is expected</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Object,System.Object,System.String)\">\r\n            <summary>\r\n            Verifies that two objects are equal.  Two objects are considered\r\n            equal if both are null, or if both have the same value. NUnit\r\n            has special semantics for some object types.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The value that is expected</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreEqual(System.Object,System.Object)\">\r\n            <summary>\r\n            Verifies that two objects are equal.  Two objects are considered\r\n            equal if both are null, or if both have the same value. NUnit\r\n            has special semantics for some object types.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The value that is expected</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Int32,System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Int32,System.Int32,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Int64,System.Int64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Int64,System.Int64,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Int64,System.Int64)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.UInt32,System.UInt32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.UInt32,System.UInt32,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.UInt32,System.UInt32)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.UInt64,System.UInt64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.UInt64,System.UInt64,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.UInt64,System.UInt64)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Decimal,System.Decimal,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Decimal,System.Decimal,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Decimal,System.Decimal)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Single,System.Single,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Single,System.Single,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Single,System.Single)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Double,System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Double,System.Double)\">\r\n            <summary>\r\n            Verifies that two values are not equal. If they are equal, then an \r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Object,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two objects are not equal.  Two objects are considered\r\n            equal if both are null, or if both have the same value. NUnit\r\n            has special semantics for some object types.\r\n            If they are equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The value that is expected</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Object,System.Object,System.String)\">\r\n            <summary>\r\n            Verifies that two objects are not equal.  Two objects are considered\r\n            equal if both are null, or if both have the same value. NUnit\r\n            has special semantics for some object types.\r\n            If they are equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The value that is expected</param>\r\n            <param name=\"actual\">The actual value</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotEqual(System.Object,System.Object)\">\r\n            <summary>\r\n            Verifies that two objects are not equal.  Two objects are considered\r\n            equal if both are null, or if both have the same value. NUnit\r\n            has special semantics for some object types.\r\n            If they are equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The value that is expected</param>\r\n            <param name=\"actual\">The actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreSame(System.Object,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two objects refer to the same object. If they\r\n            are not the same an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The actual object</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreSame(System.Object,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that two objects refer to the same object. If they\r\n            are not the same an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The actual object</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreSame(System.Object,System.Object)\">\r\n            <summary>\r\n            Asserts that two objects refer to the same object. If they\r\n            are not the same an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The actual object</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotSame(System.Object,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two objects do not refer to the same object. If they\r\n            are the same an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The actual object</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotSame(System.Object,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that two objects do not refer to the same object. If they\r\n            are the same an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The actual object</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.AreNotSame(System.Object,System.Object)\">\r\n            <summary>\r\n            Asserts that two objects do not refer to the same object. If they\r\n            are the same an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The actual object</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Int32,System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Int32,System.Int32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.UInt32,System.UInt32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.UInt32,System.UInt32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.UInt32,System.UInt32)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Int64,System.Int64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Int64,System.Int64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Int64,System.Int64)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.UInt64,System.UInt64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.UInt64,System.UInt64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.UInt64,System.UInt64)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Decimal,System.Decimal,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Decimal,System.Decimal,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Decimal,System.Decimal)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Double,System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Double,System.Double)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Single,System.Single,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Single,System.Single,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.Single,System.Single)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.IComparable,System.IComparable,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.IComparable,System.IComparable,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Greater(System.IComparable,System.IComparable)\">\r\n            <summary>\r\n            Verifies that the first value is greater than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Int32,System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Int32,System.Int32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.UInt32,System.UInt32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.UInt32,System.UInt32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.UInt32,System.UInt32)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Int64,System.Int64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Int64,System.Int64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Int64,System.Int64)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.UInt64,System.UInt64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.UInt64,System.UInt64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.UInt64,System.UInt64)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Decimal,System.Decimal,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Decimal,System.Decimal,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Decimal,System.Decimal)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Double,System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Double,System.Double)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Single,System.Single,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Single,System.Single,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.Single,System.Single)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.IComparable,System.IComparable,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.IComparable,System.IComparable,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Less(System.IComparable,System.IComparable)\">\r\n            <summary>\r\n            Verifies that the first value is less than the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Int32,System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Int32,System.Int32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt32,System.UInt32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt32,System.UInt32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt32,System.UInt32)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Int64,System.Int64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Int64,System.Int64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Int64,System.Int64)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt64,System.UInt64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt64,System.UInt64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt64,System.UInt64)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Decimal,System.Decimal,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Decimal,System.Decimal,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Decimal,System.Decimal)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Double,System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Double,System.Double)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Single,System.Single,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Single,System.Single,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.Single,System.Single)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.IComparable,System.IComparable,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.IComparable,System.IComparable,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.GreaterOrEqual(System.IComparable,System.IComparable)\">\r\n            <summary>\r\n            Verifies that the first value is greater than or equal tothe second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be greater</param>\r\n            <param name=\"arg2\">The second value, expected to be less</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Int32,System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Int32,System.Int32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Int32,System.Int32)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.UInt32,System.UInt32,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.UInt32,System.UInt32,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.UInt32,System.UInt32)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Int64,System.Int64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Int64,System.Int64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Int64,System.Int64)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.UInt64,System.UInt64,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.UInt64,System.UInt64,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.UInt64,System.UInt64)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Decimal,System.Decimal,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Decimal,System.Decimal,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Decimal,System.Decimal)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Double,System.Double,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Double,System.Double,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Double,System.Double)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Single,System.Single,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Single,System.Single,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.Single,System.Single)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.IComparable,System.IComparable,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.IComparable,System.IComparable,System.String)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.LessOrEqual(System.IComparable,System.IComparable)\">\r\n            <summary>\r\n            Verifies that the first value is less than or equal to the second\r\n            value. If it is not, then an\r\n            <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown. \r\n            </summary>\r\n            <param name=\"arg1\">The first value, expected to be less</param>\r\n            <param name=\"arg2\">The second value, expected to be greater</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Contains(System.Object,System.Collections.ICollection,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that an object is contained in a list.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The list to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Array of objects to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Contains(System.Object,System.Collections.ICollection,System.String)\">\r\n            <summary>\r\n            Asserts that an object is contained in a list.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The list to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assert.Contains(System.Object,System.Collections.ICollection)\">\r\n            <summary>\r\n            Asserts that an object is contained in a list.\r\n            </summary>\r\n            <param name=\"expected\">The expected object</param>\r\n            <param name=\"actual\">The list to be examined</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Assert.Counter\">\r\n            <summary>\r\n            Gets the number of assertions executed so far and \r\n            resets the counter to zero.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.AssertionHelper\">\r\n            <summary>\r\n            AssertionHelper is an optional base class for user tests,\r\n            allowing the use of shorter names for constraints and\r\n            asserts and avoiding conflict with the definition of \r\n            <see cref=\"T:NUnit.Framework.Is\"/>, from which it inherits much of its\r\n            behavior, in certain mock object frameworks.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(System.Object,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure. Works\r\n            identically to Assert.That\r\n            </summary>\r\n            <param name=\"constraint\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure. Works\r\n            identically to Assert.That.\r\n            </summary>\r\n            <param name=\"constraint\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure. Works\r\n            identically to Assert.That\r\n            </summary>\r\n            <param name=\"constraint\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect``1(``0@,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"constraint\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect``1(``0@,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"constraint\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect``1(``0@,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an assertion exception on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>. Works Identically to Assert.That.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display if the condition is false</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>. Works Identically to Assert.That.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display if the condition is false</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/>. Works Identically Assert.That.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Expect(NUnit.Framework.TestDelegate,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Asserts that the code represented by a delegate throws an exception\r\n            that satisfies the constraint provided.\r\n            </summary>\r\n            <param name=\"code\">A TestDelegate to be executed</param>\r\n            <param name=\"constraint\">A ThrowsConstraint used in the test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.AssertionHelper.Map(System.Collections.ICollection)\">\r\n            <summary>\r\n            Returns a ListMapper based on a collection.\r\n            </summary>\r\n            <param name=\"original\">The original collection</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Assume\">\r\n            <summary>\r\n            Provides static methods to express the assumptions\r\n            that must be met for a test to give a meaningful\r\n            result. If an assumption is not met, the test\r\n            should produce an inconclusive result.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.Equals(System.Object,System.Object)\">\r\n            <summary>\r\n            The Equals method throws an AssertionException. This is done \r\n            to make sure there is no mistake by calling this function.\r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.ReferenceEquals(System.Object,System.Object)\">\r\n            <summary>\r\n            override the default ReferenceEquals to throw an AssertionException. This \r\n            implementation makes sure there is no mistake in calling this function \r\n            as part of Assert. \r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(System.Object,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(System.Object,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(NUnit.Framework.Constraints.ActualValueDelegate,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to an actual value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"del\">An ActualValueDelegate returning the value to be tested</param>\r\n            <param name=\"expr\">A Constraint expression to be applied</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That``1(``0@,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That``1(``0@,NUnit.Framework.Constraints.IResolveConstraint,System.String)\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That``1(``0@,NUnit.Framework.Constraints.IResolveConstraint,System.String,System.Object[])\">\r\n            <summary>\r\n            Apply a constraint to a referenced value, succeeding if the constraint\r\n            is satisfied and throwing an InconclusiveException on failure.\r\n            </summary>\r\n            <param name=\"expression\">A Constraint expression to be applied</param>\r\n            <param name=\"actual\">The actual value to test</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(System.Boolean,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.InconclusiveException\"/>.\r\n            </summary> \r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display if the condition is false</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(System.Boolean,System.String)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the method throws\r\n            an <see cref=\"T:NUnit.Framework.InconclusiveException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n            <param name=\"message\">The message to display if the condition is false</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(System.Boolean)\">\r\n            <summary>\r\n            Asserts that a condition is true. If the condition is false the \r\n            method throws an <see cref=\"T:NUnit.Framework.InconclusiveException\"/>.\r\n            </summary>\r\n            <param name=\"condition\">The evaluated condition</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Assume.That(NUnit.Framework.TestDelegate,NUnit.Framework.Constraints.IResolveConstraint)\">\r\n            <summary>\r\n            Asserts that the code represented by a delegate throws an exception\r\n            that satisfies the constraint provided.\r\n            </summary>\r\n            <param name=\"code\">A TestDelegate to be executed</param>\r\n            <param name=\"constraint\">A ThrowsConstraint used in the test</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.CollectionAssert\">\r\n            <summary>\r\n            A set of Assert methods operationg on one or more collections\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.Equals(System.Object,System.Object)\">\r\n            <summary>\r\n            The Equals method throws an AssertionException. This is done \r\n            to make sure there is no mistake by calling this function.\r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.ReferenceEquals(System.Object,System.Object)\">\r\n            <summary>\r\n            override the default ReferenceEquals to throw an AssertionException. This \r\n            implementation makes sure there is no mistake in calling this function \r\n            as part of Assert. \r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(System.Collections.IEnumerable,System.Type)\">\r\n            <summary>\r\n            Asserts that all items contained in collection are of the type specified by expectedType.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable containing objects to be considered</param>\r\n            <param name=\"expectedType\">System.Type that all objects in collection must be instances of</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(System.Collections.IEnumerable,System.Type,System.String)\">\r\n            <summary>\r\n            Asserts that all items contained in collection are of the type specified by expectedType.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable containing objects to be considered</param>\r\n            <param name=\"expectedType\">System.Type that all objects in collection must be instances of</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(System.Collections.IEnumerable,System.Type,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that all items contained in collection are of the type specified by expectedType.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable containing objects to be considered</param>\r\n            <param name=\"expectedType\">System.Type that all objects in collection must be instances of</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreNotNull(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that all items contained in collection are not equal to null.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable containing objects to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreNotNull(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that all items contained in collection are not equal to null.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable containing objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreNotNull(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that all items contained in collection are not equal to null.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreUnique(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Ensures that every object contained in collection exists within the collection\r\n            once and only once.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreUnique(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Ensures that every object contained in collection exists within the collection\r\n            once and only once.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AllItemsAreUnique(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Ensures that every object contained in collection exists within the collection\r\n            once and only once.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.IEnumerable,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that expected and actual are exactly equal.  The collections must have the same count, \r\n            and contain the exact same objects in the same order.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.Collections.IComparer)\">\r\n            <summary>\r\n            Asserts that expected and actual are exactly equal.  The collections must have the same count, \r\n            and contain the exact same objects in the same order.\r\n            If comparer is not null then it will be used to compare the objects.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"comparer\">The IComparer to use in comparing objects from each IEnumerable</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that expected and actual are exactly equal.  The collections must have the same count, \r\n            and contain the exact same objects in the same order.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.Collections.IComparer,System.String)\">\r\n            <summary>\r\n            Asserts that expected and actual are exactly equal.  The collections must have the same count, \r\n            and contain the exact same objects in the same order.\r\n            If comparer is not null then it will be used to compare the objects.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"comparer\">The IComparer to use in comparing objects from each IEnumerable</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that expected and actual are exactly equal.  The collections must have the same count, \r\n            and contain the exact same objects in the same order.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.Collections.IComparer,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that expected and actual are exactly equal.  The collections must have the same count, \r\n            and contain the exact same objects in the same order.\r\n            If comparer is not null then it will be used to compare the objects.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"comparer\">The IComparer to use in comparing objects from each IEnumerable</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEquivalent(System.Collections.IEnumerable,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEquivalent(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreEquivalent(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.IEnumerable,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that expected and actual are not exactly equal.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.Collections.IComparer)\">\r\n            <summary>\r\n            Asserts that expected and actual are not exactly equal.\r\n            If comparer is not null then it will be used to compare the objects.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"comparer\">The IComparer to use in comparing objects from each IEnumerable</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that expected and actual are not exactly equal.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.Collections.IComparer,System.String)\">\r\n            <summary>\r\n            Asserts that expected and actual are not exactly equal.\r\n            If comparer is not null then it will be used to compare the objects.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"comparer\">The IComparer to use in comparing objects from each IEnumerable</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that expected and actual are not exactly equal.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.IEnumerable,System.Collections.IEnumerable,System.Collections.IComparer,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that expected and actual are not exactly equal.\r\n            If comparer is not null then it will be used to compare the objects.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"comparer\">The IComparer to use in comparing objects from each IEnumerable</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEquivalent(System.Collections.IEnumerable,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that expected and actual are not equivalent.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEquivalent(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that expected and actual are not equivalent.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.AreNotEquivalent(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that expected and actual are not equivalent.\r\n            </summary>\r\n            <param name=\"expected\">The first IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">The second IEnumerable of objects to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.Contains(System.Collections.IEnumerable,System.Object)\">\r\n            <summary>\r\n            Asserts that collection contains actual as an item.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">Object to be found within collection</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.Contains(System.Collections.IEnumerable,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that collection contains actual as an item.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">Object to be found within collection</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.Contains(System.Collections.IEnumerable,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that collection contains actual as an item.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">Object to be found within collection</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.DoesNotContain(System.Collections.IEnumerable,System.Object)\">\r\n            <summary>\r\n            Asserts that collection does not contain actual as an item.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">Object that cannot exist within collection</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.DoesNotContain(System.Collections.IEnumerable,System.Object,System.String)\">\r\n            <summary>\r\n            Asserts that collection does not contain actual as an item.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">Object that cannot exist within collection</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.DoesNotContain(System.Collections.IEnumerable,System.Object,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that collection does not contain actual as an item.\r\n            </summary>\r\n            <param name=\"collection\">IEnumerable of objects to be considered</param>\r\n            <param name=\"actual\">Object that cannot exist within collection</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsNotSubsetOf(System.Collections.IEnumerable,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that superset is not a subject of subset.\r\n            </summary>\r\n            <param name=\"subset\">The IEnumerable superset to be considered</param>\r\n            <param name=\"superset\">The IEnumerable subset to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsNotSubsetOf(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that superset is not a subject of subset.\r\n            </summary>\r\n            <param name=\"subset\">The IEnumerable superset to be considered</param>\r\n            <param name=\"superset\">The IEnumerable subset to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsNotSubsetOf(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that superset is not a subject of subset.\r\n            </summary>\r\n            <param name=\"subset\">The IEnumerable superset to be considered</param>\r\n            <param name=\"superset\">The IEnumerable subset to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsSubsetOf(System.Collections.IEnumerable,System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Asserts that superset is a subset of subset.\r\n            </summary>\r\n            <param name=\"subset\">The IEnumerable superset to be considered</param>\r\n            <param name=\"superset\">The IEnumerable subset to be considered</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsSubsetOf(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Asserts that superset is a subset of subset.\r\n            </summary>\r\n            <param name=\"subset\">The IEnumerable superset to be considered</param>\r\n            <param name=\"superset\">The IEnumerable subset to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsSubsetOf(System.Collections.IEnumerable,System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that superset is a subset of subset.\r\n            </summary>\r\n            <param name=\"subset\">The IEnumerable superset to be considered</param>\r\n            <param name=\"superset\">The IEnumerable subset to be considered</param>\r\n            <param name=\"message\">The message that will be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsEmpty(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsEmpty(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsEmpty(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Assert that an array,list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsNotEmpty(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsNotEmpty(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsNotEmpty(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Assert that an array,list or other collection is empty\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsOrdered(System.Collections.IEnumerable,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that an array, list or other collection is ordered\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsOrdered(System.Collections.IEnumerable,System.String)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is ordered\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsOrdered(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is ordered\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsOrdered(System.Collections.IEnumerable,System.Collections.IComparer,System.String,System.Object[])\">\r\n            <summary>\r\n            Assert that an array, list or other collection is ordered\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"comparer\">A custom comparer to perform the comparisons</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsOrdered(System.Collections.IEnumerable,System.Collections.IComparer,System.String)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is ordered\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"comparer\">A custom comparer to perform the comparisons</param>\r\n            <param name=\"message\">The message to be displayed on failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.CollectionAssert.IsOrdered(System.Collections.IEnumerable,System.Collections.IComparer)\">\r\n            <summary>\r\n            Assert that an array, list or other collection is ordered\r\n            </summary>\r\n            <param name=\"collection\">An array, list or other collection implementing IEnumerable</param>\r\n            <param name=\"comparer\">A custom comparer to perform the comparisons</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Contains\">\r\n            <summary>\r\n            Static helper class used in the constraint-based syntax\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Contains.Substring(System.String)\">\r\n            <summary>\r\n            Creates a new SubstringConstraint\r\n            </summary>\r\n            <param name=\"substring\">The value of the substring</param>\r\n            <returns>A SubstringConstraint</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Contains.Item(System.Object)\">\r\n            <summary>\r\n            Creates a new CollectionContainsConstraint.\r\n            </summary>\r\n            <param name=\"item\">The item that should be found.</param>\r\n            <returns>A new CollectionContainsConstraint</returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.DirectoryAssert\">\r\n            <summary>\r\n            Summary description for DirectoryAssert\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.Equals(System.Object,System.Object)\">\r\n            <summary>\r\n            The Equals method throws an AssertionException. This is done \r\n            to make sure there is no mistake by calling this function.\r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.ReferenceEquals(System.Object,System.Object)\">\r\n            <summary>\r\n            override the default ReferenceEquals to throw an AssertionException. This \r\n            implementation makes sure there is no mistake in calling this function \r\n            as part of Assert. \r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.#ctor\">\r\n            <summary>\r\n            We don't actually want any instances of this object, but some people\r\n            like to inherit from it to add other static methods. Hence, the\r\n            protected constructor disallows any instances of this object. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two directories are equal.  Two directories are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory containing the value that is expected</param>\r\n            <param name=\"actual\">A directory containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String)\">\r\n            <summary>\r\n            Verifies that two directories are equal.  Two directories are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory containing the value that is expected</param>\r\n            <param name=\"actual\">A directory containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Verifies that two directories are equal.  Two directories are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory containing the value that is expected</param>\r\n            <param name=\"actual\">A directory containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreEqual(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two directories are equal.  Two directories are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory path string containing the value that is expected</param>\r\n            <param name=\"actual\">A directory path string containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreEqual(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Verifies that two directories are equal.  Two directories are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory path string containing the value that is expected</param>\r\n            <param name=\"actual\">A directory path string containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreEqual(System.String,System.String)\">\r\n            <summary>\r\n            Verifies that two directories are equal.  Two directories are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory path string containing the value that is expected</param>\r\n            <param name=\"actual\">A directory path string containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreNotEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two directories are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory containing the value that is expected</param>\r\n            <param name=\"actual\">A directory containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreNotEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String)\">\r\n            <summary>\r\n            Asserts that two directories are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory containing the value that is expected</param>\r\n            <param name=\"actual\">A directory containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreNotEqual(System.IO.DirectoryInfo,System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Asserts that two directories are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory containing the value that is expected</param>\r\n            <param name=\"actual\">A directory containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreNotEqual(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two directories are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory path string containing the value that is expected</param>\r\n            <param name=\"actual\">A directory path string containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreNotEqual(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two directories are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory path string containing the value that is expected</param>\r\n            <param name=\"actual\">A directory path string containing the actual value</param>\r\n            <param name=\"message\">The message to display if directories are equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.AreNotEqual(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two directories are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A directory path string containing the value that is expected</param>\r\n            <param name=\"actual\">A directory path string containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsEmpty(System.IO.DirectoryInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that the directory is empty. If it is not empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsEmpty(System.IO.DirectoryInfo,System.String)\">\r\n            <summary>\r\n            Asserts that the directory is empty. If it is not empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsEmpty(System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Asserts that the directory is empty. If it is not empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsEmpty(System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that the directory is empty. If it is not empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsEmpty(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that the directory is empty. If it is not empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsEmpty(System.String)\">\r\n            <summary>\r\n            Asserts that the directory is empty. If it is not empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotEmpty(System.IO.DirectoryInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that the directory is not empty. If it is empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotEmpty(System.IO.DirectoryInfo,System.String)\">\r\n            <summary>\r\n            Asserts that the directory is not empty. If it is empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotEmpty(System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Asserts that the directory is not empty. If it is empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotEmpty(System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that the directory is not empty. If it is empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotEmpty(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that the directory is not empty. If it is empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"message\">The message to display if directories are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotEmpty(System.String)\">\r\n            <summary>\r\n            Asserts that the directory is not empty. If it is empty\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsWithin(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that path contains actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsWithin(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String)\">\r\n            <summary>\r\n            Asserts that path contains actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsWithin(System.IO.DirectoryInfo,System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Asserts that path contains actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsWithin(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that path contains actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsWithin(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that path contains actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsWithin(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that path contains actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotWithin(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that path does not contain actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotWithin(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String)\">\r\n            <summary>\r\n            Asserts that path does not contain actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotWithin(System.IO.DirectoryInfo,System.IO.DirectoryInfo)\">\r\n            <summary>\r\n            Asserts that path does not contain actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotWithin(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that path does not contain actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotWithin(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that path does not contain actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n            <param name=\"message\">The message to display if directory is not within the path</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.DirectoryAssert.IsNotWithin(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that path does not contain actual as a subdirectory or\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"directory\">A directory to search</param>\r\n            <param name=\"actual\">sub-directory asserted to exist under directory</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.FileAssert\">\r\n            <summary>\r\n            Summary description for FileAssert.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.Equals(System.Object,System.Object)\">\r\n            <summary>\r\n            The Equals method throws an AssertionException. This is done \r\n            to make sure there is no mistake by calling this function.\r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.ReferenceEquals(System.Object,System.Object)\">\r\n            <summary>\r\n            override the default ReferenceEquals to throw an AssertionException. This \r\n            implementation makes sure there is no mistake in calling this function \r\n            as part of Assert. \r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.#ctor\">\r\n            <summary>\r\n            We don't actually want any instances of this object, but some people\r\n            like to inherit from it to add other static methods. Hence, the\r\n            protected constructor disallows any instances of this object. \r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.IO.Stream,System.IO.Stream,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two Streams are equal.  Two Streams are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected Stream</param>\r\n            <param name=\"actual\">The actual Stream</param>\r\n            <param name=\"message\">The message to display if Streams are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.IO.Stream,System.IO.Stream,System.String)\">\r\n            <summary>\r\n            Verifies that two Streams are equal.  Two Streams are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected Stream</param>\r\n            <param name=\"actual\">The actual Stream</param>\r\n            <param name=\"message\">The message to display if objects are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.IO.Stream,System.IO.Stream)\">\r\n            <summary>\r\n            Verifies that two Streams are equal.  Two Streams are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected Stream</param>\r\n            <param name=\"actual\">The actual Stream</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.IO.FileInfo,System.IO.FileInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two files are equal.  Two files are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A file containing the value that is expected</param>\r\n            <param name=\"actual\">A file containing the actual value</param>\r\n            <param name=\"message\">The message to display if Streams are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.IO.FileInfo,System.IO.FileInfo,System.String)\">\r\n            <summary>\r\n            Verifies that two files are equal.  Two files are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A file containing the value that is expected</param>\r\n            <param name=\"actual\">A file containing the actual value</param>\r\n            <param name=\"message\">The message to display if objects are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.IO.FileInfo,System.IO.FileInfo)\">\r\n            <summary>\r\n            Verifies that two files are equal.  Two files are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A file containing the value that is expected</param>\r\n            <param name=\"actual\">A file containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Verifies that two files are equal.  Two files are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The path to a file containing the value that is expected</param>\r\n            <param name=\"actual\">The path to a file containing the actual value</param>\r\n            <param name=\"message\">The message to display if Streams are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Verifies that two files are equal.  Two files are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The path to a file containing the value that is expected</param>\r\n            <param name=\"actual\">The path to a file containing the actual value</param>\r\n            <param name=\"message\">The message to display if objects are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreEqual(System.String,System.String)\">\r\n            <summary>\r\n            Verifies that two files are equal.  Two files are considered\r\n            equal if both are null, or if both have the same value byte for byte.\r\n            If they are not equal an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The path to a file containing the value that is expected</param>\r\n            <param name=\"actual\">The path to a file containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.Stream,System.IO.Stream,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two Streams are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected Stream</param>\r\n            <param name=\"actual\">The actual Stream</param>\r\n            <param name=\"message\">The message to be displayed when the two Stream are the same.</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.Stream,System.IO.Stream,System.String)\">\r\n            <summary>\r\n            Asserts that two Streams are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected Stream</param>\r\n            <param name=\"actual\">The actual Stream</param>\r\n            <param name=\"message\">The message to be displayed when the Streams are the same.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.Stream,System.IO.Stream)\">\r\n            <summary>\r\n            Asserts that two Streams are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The expected Stream</param>\r\n            <param name=\"actual\">The actual Stream</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.FileInfo,System.IO.FileInfo,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two files are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A file containing the value that is expected</param>\r\n            <param name=\"actual\">A file containing the actual value</param>\r\n            <param name=\"message\">The message to display if Streams are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.FileInfo,System.IO.FileInfo,System.String)\">\r\n            <summary>\r\n            Asserts that two files are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A file containing the value that is expected</param>\r\n            <param name=\"actual\">A file containing the actual value</param>\r\n            <param name=\"message\">The message to display if objects are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.FileInfo,System.IO.FileInfo)\">\r\n            <summary>\r\n            Asserts that two files are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">A file containing the value that is expected</param>\r\n            <param name=\"actual\">A file containing the actual value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two files are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The path to a file containing the value that is expected</param>\r\n            <param name=\"actual\">The path to a file containing the actual value</param>\r\n            <param name=\"message\">The message to display if Streams are not equal</param>\r\n            <param name=\"args\">Arguments to be used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two files are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The path to a file containing the value that is expected</param>\r\n            <param name=\"actual\">The path to a file containing the actual value</param>\r\n            <param name=\"message\">The message to display if objects are not equal</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.FileAssert.AreNotEqual(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two files are not equal. If they are equal\r\n            an <see cref=\"T:NUnit.Framework.AssertionException\"/> is thrown.\r\n            </summary>\r\n            <param name=\"expected\">The path to a file containing the value that is expected</param>\r\n            <param name=\"actual\">The path to a file containing the actual value</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.GlobalSettings\">\r\n            <summary>\r\n            GlobalSettings is a place for setting default values used\r\n            by the framework in performing asserts.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.GlobalSettings.DefaultFloatingPointTolerance\">\r\n            <summary>\r\n            Default tolerance for floating point equality\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Has\">\r\n            <summary>\r\n            Helper class with properties and methods that supply\r\n            a number of constraints used in Asserts.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Has.Exactly(System.Int32)\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding only if a specified number of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Has.Property(System.String)\">\r\n            <summary>\r\n            Returns a new PropertyConstraintExpression, which will either\r\n            test for the existence of the named property on the object\r\n            being tested or apply any following constraint to that property.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Has.Attribute(System.Type)\">\r\n            <summary>\r\n            Returns a new AttributeConstraint checking for the\r\n            presence of a particular attribute on an object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Has.Attribute``1\">\r\n            <summary>\r\n            Returns a new AttributeConstraint checking for the\r\n            presence of a particular attribute on an object.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Has.Member(System.Object)\">\r\n            <summary>\r\n            Returns a new CollectionContainsConstraint checking for the\r\n            presence of a particular object in the collection.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.No\">\r\n            <summary>\r\n            Returns a ConstraintExpression that negates any\r\n            following constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.All\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.Some\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if at least one of them succeeds.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.None\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them fail.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.Length\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Length property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.Count\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Count property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.Message\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the Message property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Has.InnerException\">\r\n            <summary>\r\n            Returns a new ConstraintExpression, which will apply the following\r\n            constraint to the InnerException property of the object being tested.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.IExpectException\">\r\n            <summary>\r\n            Interface implemented by a user fixture in order to\r\n            validate any expected exceptions. It is only called\r\n            for test methods marked with the ExpectedException\r\n            attribute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.IExpectException.HandleException(System.Exception)\">\r\n            <summary>\r\n            Method to handle an expected exception\r\n            </summary>\r\n            <param name=\"ex\">The exception to be handled</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Is\">\r\n            <summary>\r\n            Helper class with properties and methods that supply\r\n            a number of constraints used in Asserts.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.EqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests two items for equality\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.SameAs(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests that two references are the same object\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.GreaterThan(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.GreaterThanOrEqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.AtLeast(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is greater than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.LessThan(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.LessThanOrEqualTo(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.AtMost(System.Object)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the\r\n            actual value is less than or equal to the suppled argument\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.TypeOf(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual\r\n            value is of the exact type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.TypeOf``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual\r\n            value is of the exact type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.InstanceOf(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.InstanceOf``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.InstanceOfType(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.InstanceOfType``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is of the type supplied as an argument or a derived type.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.AssignableFrom(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.AssignableFrom``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.AssignableTo(System.Type)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.AssignableTo``1\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is assignable from the type supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.EquivalentTo(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is a collection containing the same elements as the \r\n            collection supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.SubsetOf(System.Collections.IEnumerable)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value\r\n            is a subset of the collection supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.StringContaining(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.StringStarting(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.StringEnding(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.StringMatching(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value matches the Regex pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.SamePath(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same as an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.SubPath(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same path or under an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.SamePathOrUnder(System.String)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the path provided \r\n            is the same path or under an expected path after canonicalization.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Is.InRange``1(``0,``0)\">\r\n            <summary>\r\n            Returns a constraint that tests whether the actual value falls \r\n            within a specified range.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Not\">\r\n            <summary>\r\n            Returns a ConstraintExpression that negates any\r\n            following constraint.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.All\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Null\">\r\n            <summary>\r\n            Returns a constraint that tests for null\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.True\">\r\n            <summary>\r\n            Returns a constraint that tests for True\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.False\">\r\n            <summary>\r\n            Returns a constraint that tests for False\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Positive\">\r\n            <summary>\r\n            Returns a constraint that tests for a positive value\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Negative\">\r\n            <summary>\r\n            Returns a constraint that tests for a negative value\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.NaN\">\r\n            <summary>\r\n            Returns a constraint that tests for NaN\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Empty\">\r\n            <summary>\r\n            Returns a constraint that tests for empty\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Unique\">\r\n            <summary>\r\n            Returns a constraint that tests whether a collection \r\n            contains all unique items.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.BinarySerializable\">\r\n            <summary>\r\n            Returns a constraint that tests whether an object graph is serializable in binary format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.XmlSerializable\">\r\n            <summary>\r\n            Returns a constraint that tests whether an object graph is serializable in xml format.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Is.Ordered\">\r\n            <summary>\r\n            Returns a constraint that tests whether a collection is ordered\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Iz\">\r\n            <summary>\r\n            The Iz class is a synonym for Is intended for use in VB,\r\n            which regards Is as a keyword.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.List\">\r\n            <summary>\r\n            The List class is a helper class with properties and methods\r\n            that supply a number of constraints used with lists and collections.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.List.Map(System.Collections.ICollection)\">\r\n            <summary>\r\n            List.Map returns a ListMapper, which can be used to map\r\n            the original collection to another collection.\r\n            </summary>\r\n            <param name=\"actual\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.ListMapper\">\r\n            <summary>\r\n            ListMapper is used to transform a collection used as an actual argument\r\n            producing another collection to be used in the assertion.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ListMapper.#ctor(System.Collections.ICollection)\">\r\n            <summary>\r\n            Construct a ListMapper based on a collection\r\n            </summary>\r\n            <param name=\"original\">The collection to be transformed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.ListMapper.Property(System.String)\">\r\n            <summary>\r\n            Produces a collection containing all the values of a property\r\n            </summary>\r\n            <param name=\"name\">The collection of property values</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Randomizer\">\r\n            <summary>\r\n            Randomizer returns a set of random values in a repeatable\r\n            way, to allow re-running of tests if necessary.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.GetRandomizer(System.Reflection.MemberInfo)\">\r\n            <summary>\r\n            Get a randomizer for a particular member, returning\r\n            one that has already been created if it exists.\r\n            This ensures that the same values are generated\r\n            each time the tests are reloaded.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.GetRandomizer(System.Reflection.ParameterInfo)\">\r\n            <summary>\r\n            Get a randomizer for a particular parameter, returning\r\n            one that has already been created if it exists.\r\n            This ensures that the same values are generated\r\n            each time the tests are reloaded.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.#ctor\">\r\n            <summary>\r\n            Construct a randomizer using a random seed\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.#ctor(System.Int32)\">\r\n            <summary>\r\n            Construct a randomizer using a specified seed\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.GetDoubles(System.Int32)\">\r\n            <summary>\r\n            Return an array of random doubles between 0.0 and 1.0.\r\n            </summary>\r\n            <param name=\"count\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.GetDoubles(System.Double,System.Double,System.Int32)\">\r\n            <summary>\r\n            Return an array of random doubles with values in a specified range.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Randomizer.GetInts(System.Int32,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Return an array of random ints with values in a specified range.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Randomizer.RandomSeed\">\r\n            <summary>\r\n            Get a random seed for use in creating a randomizer.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.SpecialValue\">\r\n            <summary>\r\n            The SpecialValue enum is used to represent TestCase arguments\r\n            that cannot be used as arguments to an Attribute.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.SpecialValue.Null\">\r\n            <summary>\r\n            Null represents a null value, which cannot be used as an \r\n            argument to an attriute under .NET 1.x\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.StringAssert\">\r\n            <summary>\r\n            Basic Asserts on strings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.Equals(System.Object,System.Object)\">\r\n            <summary>\r\n            The Equals method throws an AssertionException. This is done \r\n            to make sure there is no mistake by calling this function.\r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.ReferenceEquals(System.Object,System.Object)\">\r\n            <summary>\r\n            override the default ReferenceEquals to throw an AssertionException. This \r\n            implementation makes sure there is no mistake in calling this function \r\n            as part of Assert. \r\n            </summary>\r\n            <param name=\"a\"></param>\r\n            <param name=\"b\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.Contains(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string is found within another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.Contains(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string is found within another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.Contains(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string is found within another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotContain(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string is not found within another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotContain(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string is found within another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotContain(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string is found within another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.StartsWith(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string starts with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.StartsWith(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string starts with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.StartsWith(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string starts with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotStartWith(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string does not start with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotStartWith(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string does not start with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotStartWith(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string does not start with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.EndsWith(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string ends with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.EndsWith(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string ends with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.EndsWith(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string ends with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotEndWith(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string does not end with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotEndWith(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string does not end with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotEndWith(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string does not end with another string.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The string to be examined</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.AreEqualIgnoringCase(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two strings are equal, without regard to case.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.AreEqualIgnoringCase(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two strings are equal, without regard to case.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.AreEqualIgnoringCase(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two strings are equal, without regard to case.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.AreNotEqualIgnoringCase(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that two strings are not equal, without regard to case.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.AreNotEqualIgnoringCase(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two strings are Notequal, without regard to case.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.AreNotEqualIgnoringCase(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that two strings are not equal, without regard to case.\r\n            </summary>\r\n            <param name=\"expected\">The expected string</param>\r\n            <param name=\"actual\">The actual string</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.IsMatch(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string matches an expected regular expression pattern.\r\n            </summary>\r\n            <param name=\"pattern\">The regex pattern to be matched</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.IsMatch(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string matches an expected regular expression pattern.\r\n            </summary>\r\n            <param name=\"pattern\">The regex pattern to be matched</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.IsMatch(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string matches an expected regular expression pattern.\r\n            </summary>\r\n            <param name=\"pattern\">The regex pattern to be matched</param>\r\n            <param name=\"actual\">The actual string</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotMatch(System.String,System.String,System.String,System.Object[])\">\r\n            <summary>\r\n            Asserts that a string does not match an expected regular expression pattern.\r\n            </summary>\r\n            <param name=\"pattern\">The regex pattern to be used</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n            <param name=\"args\">Arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotMatch(System.String,System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string does not match an expected regular expression pattern.\r\n            </summary>\r\n            <param name=\"pattern\">The regex pattern to be used</param>\r\n            <param name=\"actual\">The actual string</param>\r\n            <param name=\"message\">The message to display in case of failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.StringAssert.DoesNotMatch(System.String,System.String)\">\r\n            <summary>\r\n            Asserts that a string does not match an expected regular expression pattern.\r\n            </summary>\r\n            <param name=\"pattern\">The regex pattern to be used</param>\r\n            <param name=\"actual\">The actual string</param>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestCaseData\">\r\n            <summary>\r\n            The TestCaseData class represents a set of arguments\r\n            and other parameter info to be used for a parameterized\r\n            test case. It provides a number of instance modifiers\r\n            for use in initializing the test case.\r\n            \r\n            Note: Instance modifiers are getters that return\r\n            the same instance after modifying it's state.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.arguments\">\r\n            <summary>\r\n            The argument list to be provided to the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.expectedResult\">\r\n            <summary>\r\n            The expected result to be returned\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.hasExpectedResult\">\r\n            <summary>\r\n            Set to true if this has an expected result\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.expectedExceptionType\">\r\n            <summary>\r\n             The expected exception Type\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.expectedExceptionName\">\r\n            <summary>\r\n            The FullName of the expected exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.testName\">\r\n            <summary>\r\n            The name to be used for the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.description\">\r\n            <summary>\r\n            The description of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.properties\">\r\n            <summary>\r\n            A dictionary of properties, used to add information\r\n            to tests without requiring the class to change.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.isIgnored\">\r\n            <summary>\r\n            If true, indicates that the test case is to be ignored\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.isExplicit\">\r\n            <summary>\r\n            If true, indicates that the test case is marked explicit\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestCaseData.ignoreReason\">\r\n            <summary>\r\n            The reason for ignoring a test case\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.#ctor(System.Object[])\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:TestCaseData\"/> class.\r\n            </summary>\r\n            <param name=\"args\">The arguments.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.#ctor(System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:TestCaseData\"/> class.\r\n            </summary>\r\n            <param name=\"arg\">The argument.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.#ctor(System.Object,System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:TestCaseData\"/> class.\r\n            </summary>\r\n            <param name=\"arg1\">The first argument.</param>\r\n            <param name=\"arg2\">The second argument.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.#ctor(System.Object,System.Object,System.Object)\">\r\n            <summary>\r\n            Initializes a new instance of the <see cref=\"T:TestCaseData\"/> class.\r\n            </summary>\r\n            <param name=\"arg1\">The first argument.</param>\r\n            <param name=\"arg2\">The second argument.</param>\r\n            <param name=\"arg3\">The third argument.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.Returns(System.Object)\">\r\n            <summary>\r\n            Sets the expected result for the test\r\n            </summary>\r\n            <param name=\"result\">The expected result</param>\r\n            <returns>A modified TestCaseData</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.Throws(System.Type)\">\r\n            <summary>\r\n            Sets the expected exception type for the test\r\n            </summary>\r\n            <param name=\"exceptionType\">Type of the expected exception.</param>\r\n            <returns>The modified TestCaseData instance</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.Throws(System.String)\">\r\n            <summary>\r\n            Sets the expected exception type for the test\r\n            </summary>\r\n            <param name=\"exceptionName\">FullName of the expected exception.</param>\r\n            <returns>The modified TestCaseData instance</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.SetName(System.String)\">\r\n            <summary>\r\n            Sets the name of the test case\r\n            </summary>\r\n            <returns>The modified TestCaseData instance</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.SetDescription(System.String)\">\r\n            <summary>\r\n            Sets the description for the test case\r\n            being constructed.\r\n            </summary>\r\n            <param name=\"description\">The description.</param>\r\n            <returns>The modified TestCaseData instance.</returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.SetCategory(System.String)\">\r\n            <summary>\r\n            Applies a category to the test\r\n            </summary>\r\n            <param name=\"category\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.SetProperty(System.String,System.String)\">\r\n            <summary>\r\n            Applies a named property to the test\r\n            </summary>\r\n            <param name=\"propName\"></param>\r\n            <param name=\"propValue\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.SetProperty(System.String,System.Int32)\">\r\n            <summary>\r\n            Applies a named property to the test\r\n            </summary>\r\n            <param name=\"propName\"></param>\r\n            <param name=\"propValue\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.SetProperty(System.String,System.Double)\">\r\n            <summary>\r\n            Applies a named property to the test\r\n            </summary>\r\n            <param name=\"propName\"></param>\r\n            <param name=\"propValue\"></param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.Ignore\">\r\n            <summary>\r\n            Ignores this TestCase.\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.Ignore(System.String)\">\r\n            <summary>\r\n            Ignores this TestCase, specifying the reason.\r\n            </summary>\r\n            <param name=\"reason\">The reason.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.MakeExplicit\">\r\n            <summary>\r\n            Marks this TestCase as Explicit\r\n            </summary>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestCaseData.MakeExplicit(System.String)\">\r\n            <summary>\r\n            Marks this TestCase as Explicit, specifying the reason.\r\n            </summary>\r\n            <param name=\"reason\">The reason.</param>\r\n            <returns></returns>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Arguments\">\r\n            <summary>\r\n            Gets the argument list to be provided to the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Result\">\r\n            <summary>\r\n            Gets the expected result\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.HasExpectedResult\">\r\n            <summary>\r\n            Returns true if the result has been set\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.ExpectedException\">\r\n            <summary>\r\n             Gets the expected exception Type\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.ExpectedExceptionName\">\r\n            <summary>\r\n            Gets the FullName of the expected exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.TestName\">\r\n            <summary>\r\n            Gets the name to be used for the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Description\">\r\n            <summary>\r\n            Gets the description of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Ignored\">\r\n            <summary>\r\n            Gets a value indicating whether this <see cref=\"T:NUnit.Framework.ITestCaseData\"/> is ignored.\r\n            </summary>\r\n            <value><c>true</c> if ignored; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Explicit\">\r\n            <summary>\r\n            Gets a value indicating whether this <see cref=\"T:NUnit.Framework.ITestCaseData\"/> is explicit.\r\n            </summary>\r\n            <value><c>true</c> if explicit; otherwise, <c>false</c>.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.IgnoreReason\">\r\n            <summary>\r\n            Gets the ignore reason.\r\n            </summary>\r\n            <value>The ignore reason.</value>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Categories\">\r\n            <summary>\r\n            Gets a list of categories associated with this test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestCaseData.Properties\">\r\n            <summary>\r\n            Gets the property dictionary for this test\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestContext\">\r\n            <summary>\r\n            Provide the context information of the current test\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestContext.#ctor(System.Collections.IDictionary)\">\r\n            <summary>\r\n            Constructs a TestContext using the provided context dictionary\r\n            </summary>\r\n            <param name=\"context\">A context dictionary</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.CurrentContext\">\r\n            <summary>\r\n            Get the current test context. This is created\r\n            as needed. The user may save the context for\r\n            use within a test, but it should not be used\r\n            outside the test for which it is created.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.Test\">\r\n            <summary>\r\n            Gets a TestAdapter representing the currently executing test in this context.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.Result\">\r\n            <summary>\r\n            Gets a ResultAdapter representing the current result for the test \r\n            executing in this context.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.TestDirectory\">\r\n            <summary>\r\n            Gets the directory containing the current test assembly.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.WorkDirectory\">\r\n            <summary>\r\n            Gets the directory to be used for outputing files created\r\n            by this test run.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestContext.TestAdapter\">\r\n            <summary>\r\n            TestAdapter adapts a Test for consumption by\r\n            the user test code.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestContext.TestAdapter.#ctor(System.Collections.IDictionary)\">\r\n            <summary>\r\n            Constructs a TestAdapter for this context\r\n            </summary>\r\n            <param name=\"context\">The context dictionary</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.TestAdapter.Name\">\r\n            <summary>\r\n            The name of the test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.TestAdapter.FullName\">\r\n            <summary>\r\n            The FullName of the test\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.TestAdapter.Properties\">\r\n            <summary>\r\n            The properties of the test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestContext.ResultAdapter\">\r\n            <summary>\r\n            ResultAdapter adapts a TestResult for consumption by\r\n            the user test code.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestContext.ResultAdapter.#ctor(System.Collections.IDictionary)\">\r\n            <summary>\r\n            Construct a ResultAdapter for a context\r\n            </summary>\r\n            <param name=\"context\">The context holding the result</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.ResultAdapter.State\">\r\n            <summary>\r\n            The TestState of current test. This maps to the ResultState\r\n            used in nunit.core and is subject to change in the future.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestContext.ResultAdapter.Status\">\r\n            <summary>\r\n            The TestStatus of current test. This enum will be used\r\n            in future versions of NUnit and so is to be preferred\r\n            to the TestState value.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestDetails\">\r\n            <summary>\r\n            Provides details about a test\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TestDetails.#ctor(System.Object,System.Reflection.MethodInfo,System.String,System.String,System.Boolean)\">\r\n            <summary>\r\n             Creates an instance of TestDetails\r\n            </summary>\r\n            <param name=\"fixture\">The fixture that the test is a member of, if available.</param>\r\n            <param name=\"method\">The method that implements the test, if available.</param>\r\n            <param name=\"fullName\">The full name of the test.</param>\r\n            <param name=\"type\">A string representing the type of test, e.g. \"Test Case\".</param>\r\n            <param name=\"isSuite\">Indicates if the test represents a suite of tests.</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestDetails.Fixture\">\r\n            <summary>\r\n             The fixture that the test is a member of, if available.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestDetails.Method\">\r\n            <summary>\r\n            The method that implements the test, if available.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestDetails.FullName\">\r\n            <summary>\r\n            The full name of the test.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestDetails.Type\">\r\n            <summary>\r\n            A string representing the type of test, e.g. \"Test Case\".\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TestDetails.IsSuite\">\r\n            <summary>\r\n            Indicates if the test represents a suite of tests.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestState\">\r\n            <summary>\r\n            The ResultState enum indicates the result of running a test\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Inconclusive\">\r\n            <summary>\r\n            The result is inconclusive\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.NotRunnable\">\r\n            <summary>\r\n            The test was not runnable.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Skipped\">\r\n            <summary>\r\n            The test has been skipped. \r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Ignored\">\r\n            <summary>\r\n            The test has been ignored.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Success\">\r\n            <summary>\r\n            The test succeeded\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Failure\">\r\n            <summary>\r\n            The test failed\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Error\">\r\n            <summary>\r\n            The test encountered an unexpected exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestState.Cancelled\">\r\n            <summary>\r\n            The test was cancelled by the user\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TestStatus\">\r\n            <summary>\r\n            The TestStatus enum indicates the result of running a test\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestStatus.Inconclusive\">\r\n            <summary>\r\n            The test was inconclusive\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestStatus.Skipped\">\r\n            <summary>\r\n            The test has skipped \r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestStatus.Passed\">\r\n            <summary>\r\n            The test succeeded\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TestStatus.Failed\">\r\n            <summary>\r\n            The test failed\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Text\">\r\n            <summary>\r\n            Helper class with static methods used to supply constraints\r\n            that operate on strings.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.Contains(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.DoesNotContain(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value contains the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.StartsWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.DoesNotStartWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value starts with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.EndsWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.DoesNotEndWith(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value ends with the substring supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.Matches(System.String)\">\r\n            <summary>\r\n            Returns a constraint that succeeds if the actual\r\n            value matches the Regex pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Text.DoesNotMatch(System.String)\">\r\n            <summary>\r\n            Returns a constraint that fails if the actual\r\n            value matches the pattern supplied as an argument.\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Text.All\">\r\n            <summary>\r\n            Returns a ConstraintExpression, which will apply\r\n            the following constraint to all members of a collection,\r\n            succeeding if all of them succeed.\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.TextMessageWriter\">\r\n            <summary>\r\n            TextMessageWriter writes constraint descriptions and messages\r\n            in displayable form as a text stream. It tailors the display\r\n            of individual message components to form the standard message\r\n            format of NUnit assertion failure messages.\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TextMessageWriter.Pfx_Expected\">\r\n            <summary>\r\n            Prefix used for the expected value line of a message\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TextMessageWriter.Pfx_Actual\">\r\n            <summary>\r\n            Prefix used for the actual value line of a message\r\n            </summary>\r\n        </member>\r\n        <member name=\"F:NUnit.Framework.TextMessageWriter.PrefixLength\">\r\n            <summary>\r\n            Length of a message prefix\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.#ctor\">\r\n            <summary>\r\n            Construct a TextMessageWriter\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.#ctor(System.String,System.Object[])\">\r\n            <summary>\r\n            Construct a TextMessageWriter, specifying a user message\r\n            and optional formatting arguments.\r\n            </summary>\r\n            <param name=\"userMessage\"></param>\r\n            <param name=\"args\"></param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteMessageLine(System.Int32,System.String,System.Object[])\">\r\n            <summary>\r\n            Method to write single line  message with optional args, usually\r\n            written to precede the general failure message, at a givel \r\n            indentation level.\r\n            </summary>\r\n            <param name=\"level\">The indentation level of the message</param>\r\n            <param name=\"message\">The message to be written</param>\r\n            <param name=\"args\">Any arguments used in formatting the message</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.DisplayDifferences(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Display Expected and Actual lines for a constraint. This\r\n            is called by MessageWriter's default implementation of \r\n            WriteMessageTo and provides the generic two-line display. \r\n            </summary>\r\n            <param name=\"constraint\">The constraint that failed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.DisplayDifferences(System.Object,System.Object)\">\r\n            <summary>\r\n            Display Expected and Actual lines for given values. This\r\n            method may be called by constraints that need more control over\r\n            the display of actual and expected values than is provided\r\n            by the default implementation.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value causing the failure</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.DisplayDifferences(System.Object,System.Object,NUnit.Framework.Constraints.Tolerance)\">\r\n            <summary>\r\n            Display Expected and Actual lines for given values, including\r\n            a tolerance value on the expected line.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"actual\">The actual value causing the failure</param>\r\n            <param name=\"tolerance\">The tolerance within which the test was made</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.DisplayStringDifferences(System.String,System.String,System.Int32,System.Boolean,System.Boolean)\">\r\n            <summary>\r\n            Display the expected and actual string values on separate lines.\r\n            If the mismatch parameter is >=0, an additional line is displayed\r\n            line containing a caret that points to the mismatch point.\r\n            </summary>\r\n            <param name=\"expected\">The expected string value</param>\r\n            <param name=\"actual\">The actual string value</param>\r\n            <param name=\"mismatch\">The point at which the strings don't match or -1</param>\r\n            <param name=\"ignoreCase\">If true, case is ignored in string comparisons</param>\r\n            <param name=\"clipping\">If true, clip the strings to fit the max line length</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteConnector(System.String)\">\r\n            <summary>\r\n            Writes the text for a connector.\r\n            </summary>\r\n            <param name=\"connector\">The connector.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WritePredicate(System.String)\">\r\n            <summary>\r\n            Writes the text for a predicate.\r\n            </summary>\r\n            <param name=\"predicate\">The predicate.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteModifier(System.String)\">\r\n            <summary>\r\n            Write the text for a modifier.\r\n            </summary>\r\n            <param name=\"modifier\">The modifier.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteExpectedValue(System.Object)\">\r\n            <summary>\r\n            Writes the text for an expected value.\r\n            </summary>\r\n            <param name=\"expected\">The expected value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteActualValue(System.Object)\">\r\n            <summary>\r\n            Writes the text for an actual value.\r\n            </summary>\r\n            <param name=\"actual\">The actual value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteValue(System.Object)\">\r\n            <summary>\r\n            Writes the text for a generalized value.\r\n            </summary>\r\n            <param name=\"val\">The value.</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteCollectionElements(System.Collections.IEnumerable,System.Int32,System.Int32)\">\r\n            <summary>\r\n            Writes the text for a collection value,\r\n            starting at a particular point, to a max length\r\n            </summary>\r\n            <param name=\"collection\">The collection containing elements to write.</param>\r\n            <param name=\"start\">The starting point of the elements to write</param>\r\n            <param name=\"max\">The maximum number of elements to write</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteExpectedLine(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Write the generic 'Expected' line for a constraint\r\n            </summary>\r\n            <param name=\"constraint\">The constraint that failed</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteExpectedLine(System.Object)\">\r\n            <summary>\r\n            Write the generic 'Expected' line for a given value\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteExpectedLine(System.Object,NUnit.Framework.Constraints.Tolerance)\">\r\n            <summary>\r\n            Write the generic 'Expected' line for a given value\r\n            and tolerance.\r\n            </summary>\r\n            <param name=\"expected\">The expected value</param>\r\n            <param name=\"tolerance\">The tolerance within which the test was made</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteActualLine(NUnit.Framework.Constraints.Constraint)\">\r\n            <summary>\r\n            Write the generic 'Actual' line for a constraint\r\n            </summary>\r\n            <param name=\"constraint\">The constraint for which the actual value is to be written</param>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.TextMessageWriter.WriteActualLine(System.Object)\">\r\n            <summary>\r\n            Write the generic 'Actual' line for a given value\r\n            </summary>\r\n            <param name=\"actual\">The actual value causing a failure</param>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.TextMessageWriter.MaxLineLength\">\r\n            <summary>\r\n            Gets or sets the maximum line length for this writer\r\n            </summary>\r\n        </member>\r\n        <member name=\"T:NUnit.Framework.Throws\">\r\n            <summary>\r\n            Helper class with properties and methods that supply\r\n            constraints that operate on exceptions.\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Throws.TypeOf(System.Type)\">\r\n            <summary>\r\n            Creates a constraint specifying the exact type of exception expected\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Throws.TypeOf``1\">\r\n            <summary>\r\n            Creates a constraint specifying the exact type of exception expected\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Throws.InstanceOf(System.Type)\">\r\n            <summary>\r\n            Creates a constraint specifying the type of exception expected\r\n            </summary>\r\n        </member>\r\n        <member name=\"M:NUnit.Framework.Throws.InstanceOf``1\">\r\n            <summary>\r\n            Creates a constraint specifying the type of exception expected\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Throws.Exception\">\r\n            <summary>\r\n            Creates a constraint specifying an expected exception\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Throws.InnerException\">\r\n            <summary>\r\n            Creates a constraint specifying an exception with a given InnerException\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Throws.TargetInvocationException\">\r\n            <summary>\r\n            Creates a constraint specifying an expected TargetInvocationException\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Throws.ArgumentException\">\r\n            <summary>\r\n            Creates a constraint specifying an expected TargetInvocationException\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Throws.InvalidOperationException\">\r\n            <summary>\r\n            Creates a constraint specifying an expected TargetInvocationException\r\n            </summary>\r\n        </member>\r\n        <member name=\"P:NUnit.Framework.Throws.Nothing\">\r\n            <summary>\r\n            Creates a constraint specifying that no exception is thrown\r\n            </summary>\r\n        </member>\r\n    </members>\r\n</doc>\r\n"
  },
  {
    "path": "Tools/Toboggan/prjTemplate/start.lua",
    "content": "--"
  },
  {
    "path": "Tutorial/01.SimpleItem/.publish/android/SimpleItem.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpSimpleItem = UI_SimpleItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[5]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\tUI_SimpleItem は、指定されたassetを単純に指定された位置とプライオリティで表示/再生します。\r\n\t\t主な用途は単純な画像表示です。\r\n\r\n\t\tまた、SWFなどの再生も可能です。\r\n\t\t複雑な制御を伴わない単純な再生であれば、UI_SWFPlayerよりもUI_SimpleItemのほうが軽量です。\r\n\r\n\t\t表示位置やスケーリング、表示RGBA値の設定を標準プロパティで行うことで、\r\n\t\t表示状態の変更が可能です。\r\n\t]]\r\n\t\r\n\tpCtrl = UI_Control(\r\n\t\t\t\t\t\t\t\"onClick\",\r\n\t\t\t\t\t\t\t\"onDrag\"\r\n\t\t\t\t\t\t)\r\n\t\r\n\tbFlag = true\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.asset = \"Never do it\"\r\n\t\tTASK_setProperty(pSimpleItem, prop)\r\n\tend\r\n\t\r\n\t\r\n\tif count == 400 then \r\n\t\tsyslog(string.format(\"ON_PINCH\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_ON_PINCH, \"onPinch\")\r\n\tend\r\n\tif count == 600 then \r\n\t\tsyslog(string.format(\"ON_DBLCLICK\"))\r\n\t\t sysCommand(pCtrl, UI_CONTROL_ON_DBLCLICK, \"onDblClick\")\r\n\tend\r\n\tif count == 800 then \r\n\t\tsyslog(string.format(\"ON_LONGTAP\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_ON_LONGTAP, \"onLongTap\")\r\n\tend\r\n\tif count == 900 then \r\n\t\tsyslog(string.format(\"SET_GROUP\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_SET_GROUP, \"group-name\")\r\n\tend\r\n\tif count == 1000 then \r\n\t\tsyslog(string.format(\"SET_MASK\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_SET_MASK, 0x09)\r\n\tend\t\r\n\t\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction onClick(x,y)\r\n\tsyslog(string.format(\"Click (%i,%i)\",x,y))\r\nend\r\n\r\nfunction onDrag(mode,x,y,mvX,mvY)\r\n\tsyslog(string.format(\"Drag - %i - (%i,%i) - mv : (%i,%i)\",mode,x,y,mvX,mvY))\r\nend\r\n\r\nfunction onPinch( mode, pinch, rot )\r\n\tsyslog(string.format(\"Pinch - pinch : %i - rot : %i\",mode,pinch,rot))\r\nend\r\n \r\nfunction onDblClick( x, y )\r\n\tsyslog(string.format(\"Double Click (%i,%i)\",x,y))\r\nend\r\n\r\nfunction onLongTap( t, x, y )\r\n\tsyslog(string.format(\"LongTap (%i,%i) - %i\",x,y,t))\r\nend"
  },
  {
    "path": "Tutorial/01.SimpleItem/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://SimpleItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/01.SimpleItem/.publish/iphone/SimpleItem.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpSimpleItem = UI_SimpleItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[5]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\tUI_SimpleItem は、指定されたassetを単純に指定された位置とプライオリティで表示/再生します。\r\n\t\t主な用途は単純な画像表示です。\r\n\r\n\t\tまた、SWFなどの再生も可能です。\r\n\t\t複雑な制御を伴わない単純な再生であれば、UI_SWFPlayerよりもUI_SimpleItemのほうが軽量です。\r\n\r\n\t\t表示位置やスケーリング、表示RGBA値の設定を標準プロパティで行うことで、\r\n\t\t表示状態の変更が可能です。\r\n\t]]\r\n\t\r\n\tpCtrl = UI_Control(\r\n\t\t\t\t\t\t\t\"onClick\",\r\n\t\t\t\t\t\t\t\"onDrag\"\r\n\t\t\t\t\t\t)\r\n\t\r\n\tbFlag = true\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.asset = \"Never do it\"\r\n\t\tTASK_setProperty(pSimpleItem, prop)\r\n\tend\r\n\t\r\n\t\r\n\tif count == 400 then \r\n\t\tsyslog(string.format(\"ON_PINCH\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_ON_PINCH, \"onPinch\")\r\n\tend\r\n\tif count == 600 then \r\n\t\tsyslog(string.format(\"ON_DBLCLICK\"))\r\n\t\t sysCommand(pCtrl, UI_CONTROL_ON_DBLCLICK, \"onDblClick\")\r\n\tend\r\n\tif count == 800 then \r\n\t\tsyslog(string.format(\"ON_LONGTAP\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_ON_LONGTAP, \"onLongTap\")\r\n\tend\r\n\tif count == 900 then \r\n\t\tsyslog(string.format(\"SET_GROUP\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_SET_GROUP, \"group-name\")\r\n\tend\r\n\tif count == 1000 then \r\n\t\tsyslog(string.format(\"SET_MASK\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_SET_MASK, 0x09)\r\n\tend\t\r\n\t\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction onClick(x,y)\r\n\tsyslog(string.format(\"Click (%i,%i)\",x,y))\r\nend\r\n\r\nfunction onDrag(mode,x,y,mvX,mvY)\r\n\tsyslog(string.format(\"Drag - %i - (%i,%i) - mv : (%i,%i)\",mode,x,y,mvX,mvY))\r\nend\r\n\r\nfunction onPinch( mode, pinch, rot )\r\n\tsyslog(string.format(\"Pinch - pinch : %i - rot : %i\",mode,pinch,rot))\r\nend\r\n \r\nfunction onDblClick( x, y )\r\n\tsyslog(string.format(\"Double Click (%i,%i)\",x,y))\r\nend\r\n\r\nfunction onLongTap( t, x, y )\r\n\tsyslog(string.format(\"LongTap (%i,%i) - %i\",x,y,t))\r\nend\r\n"
  },
  {
    "path": "Tutorial/01.SimpleItem/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://SimpleItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/01.SimpleItem/SimpleItem.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpSimpleItem = UI_SimpleItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[5]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\tUI_SimpleItem は、指定されたassetを単純に指定された位置とプライオリティで表示/再生します。\r\n\t\t主な用途は単純な画像表示です。\r\n\r\n\t\tまた、SWFなどの再生も可能です。\r\n\t\t複雑な制御を伴わない単純な再生であれば、UI_SWFPlayerよりもUI_SimpleItemのほうが軽量です。\r\n\r\n\t\t表示位置やスケーリング、表示RGBA値の設定を標準プロパティで行うことで、\r\n\t\t表示状態の変更が可能です。\r\n\t]]\r\n\t\r\n\tpCtrl = UI_Control(\r\n\t\t\t\t\t\t\t\"onClick\",\r\n\t\t\t\t\t\t\t\"onDrag\"\r\n\t\t\t\t\t\t)\r\n\t\r\n\tbFlag = true\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pSimpleItem, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tprop = TASK_getProperty(pSimpleItem)\r\n\t\tprop.asset = \"Never do it\"\r\n\t\tTASK_setProperty(pSimpleItem, prop)\r\n\tend\r\n\t\r\n\t\r\n\tif count == 400 then \r\n\t\tsyslog(string.format(\"ON_PINCH\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_ON_PINCH, \"onPinch\")\r\n\tend\r\n\tif count == 600 then \r\n\t\tsyslog(string.format(\"ON_DBLCLICK\"))\r\n\t\t sysCommand(pCtrl, UI_CONTROL_ON_DBLCLICK, \"onDblClick\")\r\n\tend\r\n\tif count == 800 then \r\n\t\tsyslog(string.format(\"ON_LONGTAP\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_ON_LONGTAP, \"onLongTap\")\r\n\tend\r\n\tif count == 900 then \r\n\t\tsyslog(string.format(\"SET_GROUP\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_SET_GROUP, \"group-name\")\r\n\tend\r\n\tif count == 1000 then \r\n\t\tsyslog(string.format(\"SET_MASK\"))\r\n\t\tsysCommand(pCtrl, UI_CONTROL_SET_MASK, 0x09)\r\n\tend\t\r\n\t\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction onClick(x,y)\r\n\tsyslog(string.format(\"Click (%i,%i)\",x,y))\r\nend\r\n\r\nfunction onDrag(mode,x,y,mvX,mvY)\r\n\tsyslog(string.format(\"Drag - %i - (%i,%i) - mv : (%i,%i)\",mode,x,y,mvX,mvY))\r\nend\r\n\r\nfunction onPinch( mode, pinch, rot )\r\n\tsyslog(string.format(\"Pinch - pinch : %i - rot : %i\",mode,pinch,rot))\r\nend\r\n \r\nfunction onDblClick( x, y )\r\n\tsyslog(string.format(\"Double Click (%i,%i)\",x,y))\r\nend\r\n\r\nfunction onLongTap( t, x, y )\r\n\tsyslog(string.format(\"LongTap (%i,%i) - %i\",x,y,t))\r\nend"
  },
  {
    "path": "Tutorial/01.SimpleItem/itemimage.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"d34f5343-974f-4f08-be1f-e47059b94531\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>itemimage.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T12:42:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>50917</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:15:42</ImgFileDate>\r\n    <ImgPathName>itemimage.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>273</Width>\r\n    <Height>185</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>273</Width>\r\n        <Height>185</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>273</Width>\r\n      <Height>185</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>273</MaskWidth>\r\n    <MaskHeight>185</MaskHeight>\r\n    <Mask>xUkB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/01.SimpleItem/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://SimpleItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/01.SimpleItem/textureBoat.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"d33e3dcb-d881-4ecc-89e5-6d21c718548d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>textureBoat.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-05T20:08:04</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>8</X>\r\n        <Y>8</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>itemimage.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>itemimage.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/.publish/android/Score.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 0\r\n\tlocal stepX = 24\r\n\tlocal stepY = 0\r\n\tlocal fillZERO = false\r\n\tlocal fANIM = false\r\n\tlocal texTable = {\r\n\t\t\"asset://Score-0.png.imag\",\r\n\t\t\"asset://Score-1.png.imag\",\r\n\t\t\"asset://Score-2.png.imag\",\r\n\t\t\"asset://Score-3.png.imag\",\r\n\t\t\"asset://Score-4.png.imag\",\r\n\t\t\"asset://Score-5.png.imag\",\r\n\t\t\"asset://Score-6.png.imag\",\r\n\t\t\"asset://Score-7.png.imag\",\r\n\t\t\"asset://Score-8.png.imag\",\r\n\t\t\"asset://Score-9.png.imag\"\r\n\t}\r\n\tpSCORE = UI_Score(\tnil\t,\t\t\t\t-- arg[1]\t親UIタスクポインタ\r\n\t\t\t\t\t\t7000,\t\t\t\t-- arg[2]\t表示プライオリティ\r\n\t\t\t\t\t\t10,\t\t\t\t\t-- arg[3]\tアニメーション時に使用する古い数字の相対プライオリティ\r\n\t\t\t\t\t\tx, y,\t\t\t\t-- arg[4,5]\t表示位置\r\n\t\t\t\t\t\ttexTable,\t\t\t-- arg[6]\t数字として使用するテクスチャリストのテーブル\r\n\t\t\t\t\t\tstepX, stepY,\t\t-- arg[7,8]\t各桁数字の表示間隔\r\n\t\t\t\t\t\t2,\t\t\t\t\t-- arg[9]\t表示桁数(最大10桁)\r\n\t\t\t\t\t\tfillZERO,\t\t\t-- arg[10]\t上の桁を0で埋める場合はtrue, 空白にする場合はfalse\r\n\t\t\t\t\t\tfANIM\t\t\t\t-- arg[11]\t値変化時にアニメーションさせる場合true、させなければfalse\r\n\t\t\t\t\t\t)\r\n\t\r\n\t-- 表示開始時のアニメーション属性指定\r\n\tmaskEnter\t= bitOR(ANM_X_COORD_0, ANM_SCALE_COORD_2, ANM_A_COLOR_6)\t-- フラグ値(※1)\r\n\tfEnterParam = {\r\n\t\t-15.0, 0.0,\t\t\t\t\t-- X\r\n\t\t4.0, 1.0, 1.0, 1.0,\t\t\t-- Scale\r\n\t\t0.3, 1.0\t\t\t\t\t-- Alpha\r\n\t}\r\n\tsysCommand(pSCORE, UI_SCORE_ENTERANIM,\t300, -150, false, 1, maskEnter, fEnterParam)\r\n\r\n\tprop = TASK_getProperty(pSCORE)\r\n\tprop.align = SCORE_ALIGN_CENTER\r\n\tTASK_setProperty(pSCORE, prop)\r\n\r\n\t-- 消去時のアニメーション属性指定\r\n\tmaskExit\t= bitOR(ANM_Y_COORD_1, ANM_A_COLOR_6)\r\n\tfExitParam = {\r\n\t\t0.0,\t-30.0,\r\n\t\t1.0,\t0.0\r\n\t}\r\n\tsysCommand(pSCORE, UI_SCORE_EXITANIM,\t500, 0, false, 1, maskExit , fExitParam )\r\n\r\n\tsysCommand(pSCORE, UI_SCORE_RESET)\r\n\t--[[\r\n\t\tUI_SCORE_RESETは、スコアタスクの値を 0 にリセットします。\r\n\t]]\r\n\r\n\tfCount = 0\r\n\tsysCommand(pSCORE, UI_SCORE_SET, 9)\r\n\t-- sysCommand(pSCORE, UI_GENERIC_SET_COLOR, 0xff, 0xffffff)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tfCount = fCount + deltaT\r\n\tif fCount >= 1000 then\r\n\t\tfCount = fCount - 1000\r\n\r\n\t\tlocal score = sysCommand(pSCORE, UI_SCORE_GET)\r\n\t\t--[[\r\n\t\t\tUI_SCORE_GETは、現在スコアタスクが保持している値を取得します。\r\n\t\t\t値は必ず整数値となります。\r\n\t\t]]\r\n\r\n\t\tscore = score + 1\r\n\r\n\t\tsysCommand(pSCORE, UI_SCORE_SET, score)\r\n\t\t--[[\r\n\t\t\tUI_SCORE_SETは、スコアタスクで与える値を指定します。\r\n\t\t]]\r\n\r\n\tend\r\n\t\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"stepX\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.stepX = 100\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"stepY\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.stepY = 20\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 450 then\r\n\t\tsyslog(string.format(\"cols\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.cols = 1\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"fillz\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.cols  = 2\r\n\t\tprop.fillz = true\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 550 then\r\n\t\tsyslog(string.format(\"value\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.value  = 42\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"align\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.align  = SCORE_ALIGN_LEFT\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 650 then\r\n\t\tsyslog(string.format(\"countclip\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.countclip  = true\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\t\r\n\tif count == 700 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_RESET\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_RESET)\r\n\tend\r\n\tif count == 800 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_SET\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_SET, 100)\r\n\tend\r\n\tif count == 900 then\r\n\t\tscore = sysCommand(pSCORE, UI_SCORE_GET)\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_GET : %i\", score))\r\n\tend\r\n\tif count == 1000 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_ALIGN\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_ALIGN, SCORE_ALIGN_RIGHT)\r\n\tend\r\n\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/02.Score/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Score.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/02.Score/.publish/iphone/Score.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 0\r\n\tlocal stepX = 24\r\n\tlocal stepY = 0\r\n\tlocal fillZERO = false\r\n\tlocal fANIM = false\r\n\tlocal texTable = {\r\n\t\t\"asset://Score-0.png.imag\",\r\n\t\t\"asset://Score-1.png.imag\",\r\n\t\t\"asset://Score-2.png.imag\",\r\n\t\t\"asset://Score-3.png.imag\",\r\n\t\t\"asset://Score-4.png.imag\",\r\n\t\t\"asset://Score-5.png.imag\",\r\n\t\t\"asset://Score-6.png.imag\",\r\n\t\t\"asset://Score-7.png.imag\",\r\n\t\t\"asset://Score-8.png.imag\",\r\n\t\t\"asset://Score-9.png.imag\"\r\n\t}\r\n\tpSCORE = UI_Score(\tnil\t,\t\t\t\t-- arg[1]\t親UIタスクポインタ\r\n\t\t\t\t\t\t7000,\t\t\t\t-- arg[2]\t表示プライオリティ\r\n\t\t\t\t\t\t10,\t\t\t\t\t-- arg[3]\tアニメーション時に使用する古い数字の相対プライオリティ\r\n\t\t\t\t\t\tx, y,\t\t\t\t-- arg[4,5]\t表示位置\r\n\t\t\t\t\t\ttexTable,\t\t\t-- arg[6]\t数字として使用するテクスチャリストのテーブル\r\n\t\t\t\t\t\tstepX, stepY,\t\t-- arg[7,8]\t各桁数字の表示間隔\r\n\t\t\t\t\t\t2,\t\t\t\t\t-- arg[9]\t表示桁数(最大10桁)\r\n\t\t\t\t\t\tfillZERO,\t\t\t-- arg[10]\t上の桁を0で埋める場合はtrue, 空白にする場合はfalse\r\n\t\t\t\t\t\tfANIM\t\t\t\t-- arg[11]\t値変化時にアニメーションさせる場合true、させなければfalse\r\n\t\t\t\t\t\t)\r\n\t\r\n\t-- 表示開始時のアニメーション属性指定\r\n\tmaskEnter\t= bitOR(ANM_X_COORD_0, ANM_SCALE_COORD_2, ANM_A_COLOR_6)\t-- フラグ値(※1)\r\n\tfEnterParam = {\r\n\t\t-15.0, 0.0,\t\t\t\t\t-- X\r\n\t\t4.0, 1.0, 1.0, 1.0,\t\t\t-- Scale\r\n\t\t0.3, 1.0\t\t\t\t\t-- Alpha\r\n\t}\r\n\tsysCommand(pSCORE, UI_SCORE_ENTERANIM,\t300, -150, false, 1, maskEnter, fEnterParam)\r\n\r\n\tprop = TASK_getProperty(pSCORE)\r\n\tprop.align = SCORE_ALIGN_CENTER\r\n\tTASK_setProperty(pSCORE, prop)\r\n\r\n\t-- 消去時のアニメーション属性指定\r\n\tmaskExit\t= bitOR(ANM_Y_COORD_1, ANM_A_COLOR_6)\r\n\tfExitParam = {\r\n\t\t0.0,\t-30.0,\r\n\t\t1.0,\t0.0\r\n\t}\r\n\tsysCommand(pSCORE, UI_SCORE_EXITANIM,\t500, 0, false, 1, maskExit , fExitParam )\r\n\r\n\tsysCommand(pSCORE, UI_SCORE_RESET)\r\n\t--[[\r\n\t\tUI_SCORE_RESETは、スコアタスクの値を 0 にリセットします。\r\n\t]]\r\n\r\n\tfCount = 0\r\n\tsysCommand(pSCORE, UI_SCORE_SET, 9)\r\n\t-- sysCommand(pSCORE, UI_GENERIC_SET_COLOR, 0xff, 0xffffff)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tfCount = fCount + deltaT\r\n\tif fCount >= 1000 then\r\n\t\tfCount = fCount - 1000\r\n\r\n\t\tlocal score = sysCommand(pSCORE, UI_SCORE_GET)\r\n\t\t--[[\r\n\t\t\tUI_SCORE_GETは、現在スコアタスクが保持している値を取得します。\r\n\t\t\t値は必ず整数値となります。\r\n\t\t]]\r\n\r\n\t\tscore = score + 1\r\n\r\n\t\tsysCommand(pSCORE, UI_SCORE_SET, score)\r\n\t\t--[[\r\n\t\t\tUI_SCORE_SETは、スコアタスクで与える値を指定します。\r\n\t\t]]\r\n\r\n\tend\r\n\t\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"stepX\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.stepX = 100\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"stepY\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.stepY = 20\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 450 then\r\n\t\tsyslog(string.format(\"cols\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.cols = 1\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"fillz\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.cols  = 2\r\n\t\tprop.fillz = true\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 550 then\r\n\t\tsyslog(string.format(\"value\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.value  = 42\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"align\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.align  = SCORE_ALIGN_LEFT\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 650 then\r\n\t\tsyslog(string.format(\"countclip\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.countclip  = true\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\t\r\n\tif count == 700 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_RESET\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_RESET)\r\n\tend\r\n\tif count == 800 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_SET\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_SET, 100)\r\n\tend\r\n\tif count == 900 then\r\n\t\tscore = sysCommand(pSCORE, UI_SCORE_GET)\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_GET : %i\", score))\r\n\tend\r\n\tif count == 1000 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_ALIGN\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_ALIGN, SCORE_ALIGN_RIGHT)\r\n\tend\r\n\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/02.Score/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Score.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/02.Score/Score-0.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"b608cb02-a9ae-455f-9e90-bfe4abef35dd\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-0.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>484</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:17:36</ImgFileDate>\r\n    <ImgPathName>Score-0.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-1.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"3bb14c83-88a9-4cab-9d73-440046ea0975\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-1.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>317</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:17:52</ImgFileDate>\r\n    <ImgPathName>Score-1.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-2.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"504ba26d-0c79-4e66-8a26-f634879eb482\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-2.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>433</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:18:04</ImgFileDate>\r\n    <ImgPathName>Score-2.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-3.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"30c8374a-f209-4eb8-8faf-792c063c3a8d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-3.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>441</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:18:18</ImgFileDate>\r\n    <ImgPathName>Score-3.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-4.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ad4bf092-59a6-4fdb-8497-b4d23854296e\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-4.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>393</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:18:34</ImgFileDate>\r\n    <ImgPathName>Score-4.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-5.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"31bb1603-40bb-4619-8987-fedbf85caf0c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-5.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>430</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:18:46</ImgFileDate>\r\n    <ImgPathName>Score-5.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-6.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"dfbe2908-b535-49bd-b0c6-91e688e7e823\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-6.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>470</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:18:56</ImgFileDate>\r\n    <ImgPathName>Score-6.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-7.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"1f31d369-04d2-42d7-b043-a5d5fe5e0d68\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-7.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>396</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:19:08</ImgFileDate>\r\n    <ImgPathName>Score-7.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-8.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"70c6e89b-ba65-4516-b5a1-32cb264e42bf\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-8.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>501</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:19:22</ImgFileDate>\r\n    <ImgPathName>Score-8.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score-9.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"5ac918be-8422-4c55-b5a8-2a0476d63f87\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Score-9.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:18:03</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>468</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:19:30</ImgFileDate>\r\n    <ImgPathName>Score-9.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/Score.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 0\r\n\tlocal stepX = 24\r\n\tlocal stepY = 0\r\n\tlocal fillZERO = false\r\n\tlocal fANIM = false\r\n\tlocal texTable = {\r\n\t\t\"asset://Score-0.png.imag\",\r\n\t\t\"asset://Score-1.png.imag\",\r\n\t\t\"asset://Score-2.png.imag\",\r\n\t\t\"asset://Score-3.png.imag\",\r\n\t\t\"asset://Score-4.png.imag\",\r\n\t\t\"asset://Score-5.png.imag\",\r\n\t\t\"asset://Score-6.png.imag\",\r\n\t\t\"asset://Score-7.png.imag\",\r\n\t\t\"asset://Score-8.png.imag\",\r\n\t\t\"asset://Score-9.png.imag\"\r\n\t}\r\n\tpSCORE = UI_Score(\tnil\t,\t\t\t\t-- arg[1]\t親UIタスクポインタ\r\n\t\t\t\t\t\t7000,\t\t\t\t-- arg[2]\t表示プライオリティ\r\n\t\t\t\t\t\t10,\t\t\t\t\t-- arg[3]\tアニメーション時に使用する古い数字の相対プライオリティ\r\n\t\t\t\t\t\tx, y,\t\t\t\t-- arg[4,5]\t表示位置\r\n\t\t\t\t\t\ttexTable,\t\t\t-- arg[6]\t数字として使用するテクスチャリストのテーブル\r\n\t\t\t\t\t\tstepX, stepY,\t\t-- arg[7,8]\t各桁数字の表示間隔\r\n\t\t\t\t\t\t2,\t\t\t\t\t-- arg[9]\t表示桁数(最大10桁)\r\n\t\t\t\t\t\tfillZERO,\t\t\t-- arg[10]\t上の桁を0で埋める場合はtrue, 空白にする場合はfalse\r\n\t\t\t\t\t\tfANIM\t\t\t\t-- arg[11]\t値変化時にアニメーションさせる場合true、させなければfalse\r\n\t\t\t\t\t\t)\r\n\t\r\n\t-- 表示開始時のアニメーション属性指定\r\n\tmaskEnter\t= bitOR(ANM_X_COORD_0, ANM_SCALE_COORD_2, ANM_A_COLOR_6)\t-- フラグ値(※1)\r\n\tfEnterParam = {\r\n\t\t-15.0, 0.0,\t\t\t\t\t-- X\r\n\t\t4.0, 1.0, 1.0, 1.0,\t\t\t-- Scale\r\n\t\t0.3, 1.0\t\t\t\t\t-- Alpha\r\n\t}\r\n\tsysCommand(pSCORE, UI_SCORE_ENTERANIM,\t300, -150, false, 1, maskEnter, fEnterParam)\r\n\r\n\tprop = TASK_getProperty(pSCORE)\r\n\tprop.align = SCORE_ALIGN_CENTER\r\n\tTASK_setProperty(pSCORE, prop)\r\n\r\n\t-- 消去時のアニメーション属性指定\r\n\tmaskExit\t= bitOR(ANM_Y_COORD_1, ANM_A_COLOR_6)\r\n\tfExitParam = {\r\n\t\t0.0,\t-30.0,\r\n\t\t1.0,\t0.0\r\n\t}\r\n\tsysCommand(pSCORE, UI_SCORE_EXITANIM,\t500, 0, false, 1, maskExit , fExitParam )\r\n\r\n\tsysCommand(pSCORE, UI_SCORE_RESET)\r\n\t--[[\r\n\t\tUI_SCORE_RESETは、スコアタスクの値を 0 にリセットします。\r\n\t]]\r\n\r\n\tfCount = 0\r\n\tsysCommand(pSCORE, UI_SCORE_SET, 9)\r\n\t-- sysCommand(pSCORE, UI_GENERIC_SET_COLOR, 0xff, 0xffffff)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tfCount = fCount + deltaT\r\n\tif fCount >= 1000 then\r\n\t\tfCount = fCount - 1000\r\n\r\n\t\tlocal score = sysCommand(pSCORE, UI_SCORE_GET)\r\n\t\t--[[\r\n\t\t\tUI_SCORE_GETは、現在スコアタスクが保持している値を取得します。\r\n\t\t\t値は必ず整数値となります。\r\n\t\t]]\r\n\r\n\t\tscore = score + 1\r\n\r\n\t\tsysCommand(pSCORE, UI_SCORE_SET, score)\r\n\t\t--[[\r\n\t\t\tUI_SCORE_SETは、スコアタスクで与える値を指定します。\r\n\t\t]]\r\n\r\n\tend\r\n\t\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pSCORE, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"stepX\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.stepX = 100\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"stepY\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.stepY = 20\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 450 then\r\n\t\tsyslog(string.format(\"cols\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.cols = 1\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"fillz\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.cols  = 2\r\n\t\tprop.fillz = true\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 550 then\r\n\t\tsyslog(string.format(\"value\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.value  = 42\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"align\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.align  = SCORE_ALIGN_LEFT\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\tif count == 650 then\r\n\t\tsyslog(string.format(\"countclip\"))\r\n\t\tprop = TASK_getProperty(pSCORE)\r\n\t\tprop.countclip  = true\r\n\t\tTASK_setProperty(pSCORE, prop)\r\n\tend\r\n\t\r\n\tif count == 700 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_RESET\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_RESET)\r\n\tend\r\n\tif count == 800 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_SET\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_SET, 100)\r\n\tend\r\n\tif count == 900 then\r\n\t\tscore = sysCommand(pSCORE, UI_SCORE_GET)\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_GET : %i\", score))\r\n\tend\r\n\tif count == 1000 then\r\n\t\tsyslog(string.format(\"CMD UI_SCORE_ALIGN\"))\r\n\t\tsysCommand(pSCORE, UI_SCORE_ALIGN, SCORE_ALIGN_RIGHT)\r\n\tend\r\n\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/02.Score/scoreTexture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"feb7b39a-c64f-4123-aff5-80a922c95ab4\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>scoreTexture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:19:24</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>32</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-0.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-0.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>34</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-1.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-1.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>68</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-2.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-2.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>102</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-3.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-3.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>136</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-4.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-4.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>170</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-5.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-5.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>204</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-6.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-6.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>272</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-8.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-8.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>306</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-9.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-9.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>238</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Score-7.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Score-7.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/02.Score/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Score.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/.publish/android/PieChart.lua",
    "content": "function setup()\r\n\tpTPad = UI_TouchPad(\"callback_TP\")\r\n\r\n\tpTask = UI_PieChart(nil, 7000, 480, 320, 200, 200,\r\n\t\t\t\t\t\t\"asset://trash.png.imag\", 0, 360, 300)\r\n\tsysCommand(pTask, UI_PIE_SET_VALUE, 0.0)\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction callback_TP(tbl)\r\n\tfor idx,item in pairs(tbl) do\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\t\t\tif item.y < 200 then\r\n\t\t\t\tlocal start = 360 * item.x / 950\r\n\t\t\t\tif start > 360 then\r\n\t\t\t\t\tstart = 360\r\n\t\t\t\tend\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_START, start)\r\n\t\t\telseif item.y < 400 then\r\n\t\t\t\tlocal v_end = 360 * item.x / 950\r\n\t\t\t\tif v_end > 360 then\r\n\t\t\t\t\tv_end = 360\r\n\t\t\t\tend\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_END, v_end)\r\n\t\t\telse\r\n\t\t\t\tlocal value = item.x / 950\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_VALUE, value)\r\n\t\t\t\tsyslog(string.format(\"value: %f\", value))\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://PieChart.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/.publish/iphone/PieChart.lua",
    "content": "function setup()\r\n\tpTPad = UI_TouchPad(\"callback_TP\")\r\n\r\n\tpTask = UI_PieChart(nil, 7000, 480, 320, 200, 200,\r\n\t\t\t\t\t\t\"asset://trash.png.imag\", 0, 360, 300)\r\n\tsysCommand(pTask, UI_PIE_SET_VALUE, 0.0)\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction callback_TP(tbl)\r\n\tfor idx,item in pairs(tbl) do\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\t\t\tif item.y < 200 then\r\n\t\t\t\tlocal start = 360 * item.x / 950\r\n\t\t\t\tif start > 360 then\r\n\t\t\t\t\tstart = 360\r\n\t\t\t\tend\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_START, start)\r\n\t\t\telseif item.y < 400 then\r\n\t\t\t\tlocal v_end = 360 * item.x / 950\r\n\t\t\t\tif v_end > 360 then\r\n\t\t\t\t\tv_end = 360\r\n\t\t\t\tend\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_END, v_end)\r\n\t\t\telse\r\n\t\t\t\tlocal value = item.x / 950\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_VALUE, value)\r\n\t\t\t\tsyslog(string.format(\"value: %f\", value))\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://PieChart.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/PieChart.lua",
    "content": "function setup()\r\n\tpTPad = UI_TouchPad(\"callback_TP\")\r\n\r\n\tpTask = UI_PieChart(nil, 7000, 480, 320, 200, 200,\r\n\t\t\t\t\t\t\"asset://trash.png.imag\", 0, 360, 300)\r\n\tsysCommand(pTask, UI_PIE_SET_VALUE, 0.0)\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction callback_TP(tbl)\r\n\tfor idx,item in pairs(tbl) do\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\t\t\tif item.y < 200 then\r\n\t\t\t\tlocal start = 360 * item.x / 950\r\n\t\t\t\tif start > 360 then\r\n\t\t\t\t\tstart = 360\r\n\t\t\t\tend\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_START, start)\r\n\t\t\telseif item.y < 400 then\r\n\t\t\t\tlocal v_end = 360 * item.x / 950\r\n\t\t\t\tif v_end > 360 then\r\n\t\t\t\t\tv_end = 360\r\n\t\t\t\tend\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_END, v_end)\r\n\t\t\telse\r\n\t\t\t\tlocal value = item.x / 950\r\n\t\t\t\tsysCommand(pTask, UI_PIE_SET_VALUE, value)\r\n\t\t\t\tsyslog(string.format(\"value: %f\", value))\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/PieTex.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"bf3f83c9-833e-45b2-bdba-9473f74637ff\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>PieTex.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T17:37:02</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>piechart.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>piechart.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>202</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>trash.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>trash.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/03.PieChart/piechart.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"d7f93840-4e7a-4c84-a5a9-9b5e812d60b7\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>piechart.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:36:51</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>23350</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:16</ImgFileDate>\r\n    <ImgPathName>piechart.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>100</X>\r\n      <Y>100</Y>\r\n    </Center>\r\n    <Width>200</Width>\r\n    <Height>200</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>200</Width>\r\n        <Height>200</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>200</Width>\r\n      <Height>200</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>200</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>200</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>200</MaskWidth>\r\n    <MaskHeight>200</MaskHeight>\r\n    <Mask>nEAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/03.PieChart/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://PieChart.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/03.PieChart/trash.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ce210ea5-b0cf-471c-a1f2-3301b07ebf99\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>trash.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:36:51</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>11879</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:16</ImgFileDate>\r\n    <ImgPathName>trash.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>100</X>\r\n      <Y>100</Y>\r\n    </Center>\r\n    <Width>200</Width>\r\n    <Height>200</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>200</Width>\r\n        <Height>200</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>200</Width>\r\n      <Height>200</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>200</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>200</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>200</MaskWidth>\r\n    <MaskHeight>200</MaskHeight>\r\n    <Mask>nEAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/04.ProgressBar/.publish/android/Progress.lua",
    "content": "function setup()\r\n\r\n\tpProg = UI_ProgressBar(\tnil,\t\t\t-- 親UIタスクのポインタ。nilの場合は親の無い状態で生成されます。\r\n\t\t\t\t\t\t\t200,\t\t\t-- 表示プライオリティ: 表示システム上のプライオリティ値\r\n\t\t\t\t\t\t\t80, 500,\t\t-- 表示座標: 親UIタスクの位置を基準として、相対座標で与えます。\r\n\t\t\t\t\t\t\t400, 80,\t\t-- 表示サイズ: 幅と高さ。表示素材のサイズです。0[%] 状態の画像と100[%]状態の画像は同じサイズである必要があります。\r\n\t\t\t\t\t\t\t\"asset://prog_h_full.png.imag\",\t -- 100[%]状態の画像asset名称\r\n\t\t\t\t\t\t\t\"asset://prog_h_empty.png.imag\", -- 0[%]状態の画像asset名称\r\n\t\t\t\t\t\t\t16,\t\t\t\t-- 始点pixel位置: テクスチャ画像上において、実際に表示が変わるバーの始点となる座標 (※1)\r\n\t\t\t\t\t\t\t381,\t\t\t-- 終点pixel位置: テクスチャ画像上において、実際に表示が変わるバーの終点となる座標 (※1)\r\n\t\t\t\t\t\t\t1000,\t\t\t-- アニメーション時間 (※2)\r\n\t\t\t\t\t\t\tfalse\t\t\t-- 縦方向フラグ: バーの成長方向が垂直方向であればtrue, 水平方向であれば false (※1)\r\n\t\t\t\t\t\t\t--\"asset://barfilter.png.imag\"\r\n\t\t\t\t\t\t\t)\r\n--[[\r\n\tprop = TASK_getProperty(pProg)\r\n\tprop.filter_visible = true\r\n\tTASK_setProperty(pProg, prop)\r\n\t\r\n\tsysCommand(pProg, UI_PROGRESS_FILTER_ANIM, true, 0xff, 0xffffff, 0x80, 0xffffff, 100)\r\n\t]]\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tprop = TASK_getProperty(pProg)\r\n\tprop.value = 1.0\r\n\tTASK_setProperty(pProg, prop)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tpProg = TASK_kill(pProg)\t-- 明示的な殺し方\r\nend\r\n"
  },
  {
    "path": "Tutorial/04.ProgressBar/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Progress.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/04.ProgressBar/.publish/iphone/Progress.lua",
    "content": "function setup()\r\n\r\n\tpProg = UI_ProgressBar(\tnil,\t\t\t-- 親UIタスクのポインタ。nilの場合は親の無い状態で生成されます。\r\n\t\t\t\t\t\t\t200,\t\t\t-- 表示プライオリティ: 表示システム上のプライオリティ値\r\n\t\t\t\t\t\t\t80, 500,\t\t-- 表示座標: 親UIタスクの位置を基準として、相対座標で与えます。\r\n\t\t\t\t\t\t\t400, 80,\t\t-- 表示サイズ: 幅と高さ。表示素材のサイズです。0[%] 状態の画像と100[%]状態の画像は同じサイズである必要があります。\r\n\t\t\t\t\t\t\t\"asset://prog_h_full.png.imag\",\t -- 100[%]状態の画像asset名称\r\n\t\t\t\t\t\t\t\"asset://prog_h_empty.png.imag\", -- 0[%]状態の画像asset名称\r\n\t\t\t\t\t\t\t16,\t\t\t\t-- 始点pixel位置: テクスチャ画像上において、実際に表示が変わるバーの始点となる座標 (※1)\r\n\t\t\t\t\t\t\t381,\t\t\t-- 終点pixel位置: テクスチャ画像上において、実際に表示が変わるバーの終点となる座標 (※1)\r\n\t\t\t\t\t\t\t1000,\t\t\t-- アニメーション時間 (※2)\r\n\t\t\t\t\t\t\tfalse\t\t\t-- 縦方向フラグ: バーの成長方向が垂直方向であればtrue, 水平方向であれば false (※1)\r\n\t\t\t\t\t\t\t--\"asset://barfilter.png.imag\"\r\n\t\t\t\t\t\t\t)\r\n--[[\r\n\tprop = TASK_getProperty(pProg)\r\n\tprop.filter_visible = true\r\n\tTASK_setProperty(pProg, prop)\r\n\t\r\n\tsysCommand(pProg, UI_PROGRESS_FILTER_ANIM, true, 0xff, 0xffffff, 0x80, 0xffffff, 100)\r\n\t]]\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tprop = TASK_getProperty(pProg)\r\n\tprop.value = 1.0\r\n\tTASK_setProperty(pProg, prop)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tpProg = TASK_kill(pProg)\t-- 明示的な殺し方\r\nend\r\n"
  },
  {
    "path": "Tutorial/04.ProgressBar/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Progress.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/04.ProgressBar/Progress.lua",
    "content": "function setup()\r\n\r\n\tpProg = UI_ProgressBar(\tnil,\t\t\t-- 親UIタスクのポインタ。nilの場合は親の無い状態で生成されます。\r\n\t\t\t\t\t\t\t200,\t\t\t-- 表示プライオリティ: 表示システム上のプライオリティ値\r\n\t\t\t\t\t\t\t80, 500,\t\t-- 表示座標: 親UIタスクの位置を基準として、相対座標で与えます。\r\n\t\t\t\t\t\t\t400, 80,\t\t-- 表示サイズ: 幅と高さ。表示素材のサイズです。0[%] 状態の画像と100[%]状態の画像は同じサイズである必要があります。\r\n\t\t\t\t\t\t\t\"asset://prog_h_full.png.imag\",\t -- 100[%]状態の画像asset名称\r\n\t\t\t\t\t\t\t\"asset://prog_h_empty.png.imag\", -- 0[%]状態の画像asset名称\r\n\t\t\t\t\t\t\t16,\t\t\t\t-- 始点pixel位置: テクスチャ画像上において、実際に表示が変わるバーの始点となる座標 (※1)\r\n\t\t\t\t\t\t\t381,\t\t\t-- 終点pixel位置: テクスチャ画像上において、実際に表示が変わるバーの終点となる座標 (※1)\r\n\t\t\t\t\t\t\t1000,\t\t\t-- アニメーション時間 (※2)\r\n\t\t\t\t\t\t\tfalse\t\t\t-- 縦方向フラグ: バーの成長方向が垂直方向であればtrue, 水平方向であれば false (※1)\r\n\t\t\t\t\t\t\t--\"asset://barfilter.png.imag\"\r\n\t\t\t\t\t\t\t)\r\n--[[\r\n\tprop = TASK_getProperty(pProg)\r\n\tprop.filter_visible = true\r\n\tTASK_setProperty(pProg, prop)\r\n\t\r\n\tsysCommand(pProg, UI_PROGRESS_FILTER_ANIM, true, 0xff, 0xffffff, 0x80, 0xffffff, 100)\r\n\t]]\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tprop = TASK_getProperty(pProg)\r\n\tprop.value = 1.0\r\n\tTASK_setProperty(pProg, prop)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tpProg = TASK_kill(pProg)\t-- 明示的な殺し方\r\nend\r\n"
  },
  {
    "path": "Tutorial/04.ProgressBar/prog_h_empty.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"14e2513e-1a3b-4216-82ae-e66db7b9b3be\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>prog_h_empty.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:42:10</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>677</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:13</ImgFileDate>\r\n    <ImgPathName>prog_h_empty.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>400</Width>\r\n    <Height>80</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>400</Width>\r\n        <Height>80</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>400</Width>\r\n      <Height>80</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>400</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>400</X>\r\n        <Y>80</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>80</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>400</MaskWidth>\r\n    <MaskHeight>80</MaskHeight>\r\n    <Mask>fQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/04.ProgressBar/prog_h_full.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ed94cbd9-e1f9-4e26-8d0d-c563a31a4a4b\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>prog_h_full.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:42:10</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>732</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:13</ImgFileDate>\r\n    <ImgPathName>prog_h_full.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>400</Width>\r\n    <Height>80</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>400</Width>\r\n        <Height>80</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>400</Width>\r\n      <Height>80</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>400</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>400</X>\r\n        <Y>80</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>80</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>400</MaskWidth>\r\n    <MaskHeight>80</MaskHeight>\r\n    <Mask>fQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/04.ProgressBar/progress.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"6acd1e78-fefb-471b-bf2a-4a3bb2888f66\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>progress.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-10-04T12:29:38</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>prog_h_full.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>prog_h_full.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>80</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>prog_h_empty.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>prog_h_empty.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/04.ProgressBar/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Progress.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/05.Polyline/.publish/android/Polyline.lua",
    "content": "function setup()\r\n\tpPoly1 = UI_Polyline(nil, 7000, 3)\r\n\tpPoly2 = UI_Polyline(nil, 7001, 3)\r\n\t\r\n\tsysCommand(pPoly1, UI_POLYLINE_SET_POINTCOUNT, 2)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_COLOR, 0xff, 0x0000FF)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_POINT, 0, 300, 500)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_POINT, 1, 500, 200)\r\n\t\r\n\tsysCommand(pPoly2, UI_POLYLINE_SET_POINTCOUNT, 2)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_COLOR, 0xff, 0xFFFFFF)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 0, 600, 500)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 1, 400, 200)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.alpha = 0x80\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pPoly2)\r\n\t\tprop.color = 0xFF0000\r\n\t\tTASK_setProperty(pPoly2, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.scaleX = 0.5\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.scaleY = 0.5\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.x = 250\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.order = 7002\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"maxpointcount\"))\r\n\t\tprop = TASK_getProperty(pPoly2)\r\n\t\tprop.maxpointcount = 5\r\n\t\tTASK_setProperty(pPoly2, prop)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINTCOUNT, 5)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 0, 100, 100)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 1, 100, 200)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 2, 200, 200)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 3, 200, 100)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 4, 150, 100)\r\n\tend\r\n\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/05.Polyline/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Polyline.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/05.Polyline/.publish/iphone/Polyline.lua",
    "content": "function setup()\r\n\tpPoly1 = UI_Polyline(nil, 7000, 3)\r\n\tpPoly2 = UI_Polyline(nil, 7001, 3)\r\n\t\r\n\tsysCommand(pPoly1, UI_POLYLINE_SET_POINTCOUNT, 2)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_COLOR, 0xff, 0x0000FF)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_POINT, 0, 300, 500)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_POINT, 1, 500, 200)\r\n\t\r\n\tsysCommand(pPoly2, UI_POLYLINE_SET_POINTCOUNT, 2)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_COLOR, 0xff, 0xFFFFFF)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 0, 600, 500)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 1, 400, 200)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.alpha = 0x80\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pPoly2)\r\n\t\tprop.color = 0xFF0000\r\n\t\tTASK_setProperty(pPoly2, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.scaleX = 0.5\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.scaleY = 0.5\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.x = 250\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.order = 7002\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"maxpointcount\"))\r\n\t\tprop = TASK_getProperty(pPoly2)\r\n\t\tprop.maxpointcount = 5\r\n\t\tTASK_setProperty(pPoly2, prop)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINTCOUNT, 5)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 0, 100, 100)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 1, 100, 200)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 2, 200, 200)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 3, 200, 100)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 4, 150, 100)\r\n\tend\r\n\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/05.Polyline/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Polyline.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/05.Polyline/Polyline.lua",
    "content": "function setup()\r\n\tpPoly1 = UI_Polyline(nil, 7000, 3)\r\n\tpPoly2 = UI_Polyline(nil, 7001, 3)\r\n\t\r\n\tsysCommand(pPoly1, UI_POLYLINE_SET_POINTCOUNT, 2)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_COLOR, 0xff, 0x0000FF)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_POINT, 0, 300, 500)\r\n\tsysCommand(pPoly1 , UI_POLYLINE_SET_POINT, 1, 500, 200)\r\n\t\r\n\tsysCommand(pPoly2, UI_POLYLINE_SET_POINTCOUNT, 2)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_COLOR, 0xff, 0xFFFFFF)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 0, 600, 500)\r\n\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 1, 400, 200)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.alpha = 0x80\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pPoly2)\r\n\t\tprop.color = 0xFF0000\r\n\t\tTASK_setProperty(pPoly2, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.scaleX = 0.5\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.scaleY = 0.5\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.x = 250\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pPoly1)\r\n\t\tprop.order = 7002\r\n\t\tTASK_setProperty(pPoly1, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"maxpointcount\"))\r\n\t\tprop = TASK_getProperty(pPoly2)\r\n\t\tprop.maxpointcount = 5\r\n\t\tTASK_setProperty(pPoly2, prop)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINTCOUNT, 5)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 0, 100, 100)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 1, 100, 200)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 2, 200, 200)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 3, 200, 100)\r\n\t\tsysCommand(pPoly2 , UI_POLYLINE_SET_POINT, 4, 150, 100)\r\n\tend\r\n\t\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/05.Polyline/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Polyline.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/06.TextBox/.publish/android/TextBox.lua",
    "content": "function setup()\r\n\tpTB = UI_TextInput( nil, false, \t-- <parent pointer>, <password mode>, \r\n\t\t\t\t\t\t100, 100,\t\t-- <x>, <y>, \r\n\t\t\t\t\t\t300, 40, \t\t-- <width>, <height>, \r\n\t\t\t\t\t\t\"default text\",\t-- \"<default text>\"\r\n                        \"onChangeCb\",   -- [ , \"<on-change-callback>\", \r\n\t\t\t\t\t\t0, \t\t\t\t-- <widget-id>, \r\n\t\t\t\t\t\t20\t\t\t\t-- <max-length>, <enable-chartype> ] )\r\n\t\t\t\t\t\t)\r\n   \r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETTEXT\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETTEXT, \"Hello World!\")\r\n\tend\r\n\tif count == 300 then\r\n\t\tstr = sysCommand(pTB, UI_TEXTBOX_GETTEXT)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETTEXT : %s\", str))\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETPLACEHOLDER\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETPLACEHOLDER, \"test\")\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETCOLOR\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETCOLOR, true, 0xFF0000, 0x0000FF)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETFONT\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETFONT, \"Georgia\", 32)\r\n\tend\r\n\tif count == 700 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETMAXLEN\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETMAXLEN, 5)\r\n\tend\r\n\tif count == 750 then\r\n\t\tres = sysCommand(pTB, UI_TEXTBOX_GETMAXLEN)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETMAXLEN : %i\", res))\r\n\tend\r\n\tif count == 800 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETCHARTYPE\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETCHARTYPE, 1)\r\n\tend\r\n\tif count == 850 then\r\n\t\tres = sysCommand(pTB, UI_TEXTBOX_GETCHARCOUNT)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETCHARCOUNT : %i\", res))\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction onChangeCb(ptr, newStr, id)\r\n\tsyslog(string.format(\"callback - new string = %s\", newStr))\r\nend\r\n"
  },
  {
    "path": "Tutorial/06.TextBox/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://TextBox.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/06.TextBox/.publish/iphone/TextBox.lua",
    "content": "function setup()\r\n\tpTB = UI_TextInput( nil, false, \t-- <parent pointer>, <password mode>, \r\n\t\t\t\t\t\t100, 100,\t\t-- <x>, <y>, \r\n\t\t\t\t\t\t300, 40, \t\t-- <width>, <height>, \r\n\t\t\t\t\t\t\"default text\",\t-- \"<default text>\"\r\n                        \"onChangeCb\",   -- [ , \"<on-change-callback>\", \r\n\t\t\t\t\t\t0, \t\t\t\t-- <widget-id>, \r\n\t\t\t\t\t\t20\t\t\t\t-- <max-length>, <enable-chartype> ] )\r\n\t\t\t\t\t\t)\r\n   \r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETTEXT\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETTEXT, \"Hello World!\")\r\n\tend\r\n\tif count == 300 then\r\n\t\tstr = sysCommand(pTB, UI_TEXTBOX_GETTEXT)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETTEXT : %s\", str))\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETPLACEHOLDER\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETPLACEHOLDER, \"test\")\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETCOLOR\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETCOLOR, true, 0xFF0000, 0x0000FF)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETFONT\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETFONT, \"Georgia\", 32)\r\n\tend\r\n\tif count == 700 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETMAXLEN\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETMAXLEN, 5)\r\n\tend\r\n\tif count == 750 then\r\n\t\tres = sysCommand(pTB, UI_TEXTBOX_GETMAXLEN)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETMAXLEN : %i\", res))\r\n\tend\r\n\tif count == 800 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETCHARTYPE\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETCHARTYPE, 1)\r\n\tend\r\n\tif count == 850 then\r\n\t\tres = sysCommand(pTB, UI_TEXTBOX_GETCHARCOUNT)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETCHARCOUNT : %i\", res))\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction onChangeCb(ptr, newStr, id)\r\n\tsyslog(string.format(\"callback - new string = %s\", newStr))\r\nend\r\n"
  },
  {
    "path": "Tutorial/06.TextBox/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://TextBox.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/06.TextBox/TextBox.lua",
    "content": "function setup()\r\n\tpTB = UI_TextInput( nil, false, \t-- <parent pointer>, <password mode>, \r\n\t\t\t\t\t\t100, 100,\t\t-- <x>, <y>, \r\n\t\t\t\t\t\t300, 40, \t\t-- <width>, <height>, \r\n\t\t\t\t\t\t\"default text\",\t-- \"<default text>\"\r\n                        \"onChangeCb\",   -- [ , \"<on-change-callback>\", \r\n\t\t\t\t\t\t0, \t\t\t\t-- <widget-id>, \r\n\t\t\t\t\t\t20\t\t\t\t-- <max-length>, <enable-chartype> ] )\r\n\t\t\t\t\t\t)\r\n   \r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pTB)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pTB, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETTEXT\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETTEXT, \"Hello World!\")\r\n\tend\r\n\tif count == 300 then\r\n\t\tstr = sysCommand(pTB, UI_TEXTBOX_GETTEXT)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETTEXT : %s\", str))\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETPLACEHOLDER\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETPLACEHOLDER, \"test\")\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETCOLOR\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETCOLOR, true, 0xFF0000, 0x0000FF)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETFONT\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETFONT, \"Georgia\", 32)\r\n\tend\r\n\tif count == 700 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETMAXLEN\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETMAXLEN, 5)\r\n\tend\r\n\tif count == 750 then\r\n\t\tres = sysCommand(pTB, UI_TEXTBOX_GETMAXLEN)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETMAXLEN : %i\", res))\r\n\tend\r\n\tif count == 800 then\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_SETCHARTYPE\"))\r\n\t\tsysCommand(pTB, UI_TEXTBOX_SETCHARTYPE, 1)\r\n\tend\r\n\tif count == 850 then\r\n\t\tres = sysCommand(pTB, UI_TEXTBOX_GETCHARCOUNT)\r\n\t\tsyslog(string.format(\"CMD UI_TEXTBOX_GETCHARCOUNT : %i\", res))\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction onChangeCb(ptr, newStr, id)\r\n\tsyslog(string.format(\"callback - new string = %s\", newStr))\r\nend\r\n"
  },
  {
    "path": "Tutorial/06.TextBox/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://TextBox.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/07.Label/.publish/android/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/07.Label/.publish/android/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"AlexBrush\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tpLabel = UI_Label \t(\r\n\t\t\t\t\t\t\tnil, \t\t\t-- <parent pointer>, \r\n\t\t\t\t\t\t\t7000, \t\t\t-- <order>, \r\n\t\t\t\t\t\t\t100,100,\t\t-- <x>, <y>,\r\n                            0xFF, 0x000000,\t-- <alpha>, <rgb>, \r\n\t\t\t\t\t\t\t\"AlexBrush\",\t-- \"<font name>\", \r\n\t\t\t\t\t\t\t32,\t\t\t\t-- <font size>, \r\n\t\t\t\t\t\t\t\"Hello World!\"\t-- \"<text string>\"\r\n\t\t\t\t\t\t)\r\n\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"font\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.font = \"arial\"\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"size\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.size = prop.size * 2\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"txt_alpha\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.txt_alpha = 0x80\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 260 then\r\n\t\tsyslog(string.format(\"txt_color\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.txt_color = 0x0000FF\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"text\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.text = \"I swear I've changed!\"\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"align\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.align = 1\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\t\r\n\tif count == 320 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_TEXT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_TEXT, \"Once again\")\r\n\tend\r\n\tif count == 340 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_COLOR\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_COLOR, 0x40, 0xFF0000)\r\n\tend\r\n\tif count == 360 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_FONT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_FONT, \"fixed\", 12)\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_POSITION\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_POSITION, 500, 100)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_ALIGNMENT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_ALIGNMENT, 5)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/07.Label/.publish/iphone/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/07.Label/.publish/iphone/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"AlexBrush\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tpLabel = UI_Label \t(\r\n\t\t\t\t\t\t\tnil, \t\t\t-- <parent pointer>, \r\n\t\t\t\t\t\t\t7000, \t\t\t-- <order>, \r\n\t\t\t\t\t\t\t100,100,\t\t-- <x>, <y>,\r\n                            0xFF, 0x000000,\t-- <alpha>, <rgb>, \r\n\t\t\t\t\t\t\t\"AlexBrush\",\t-- \"<font name>\", \r\n\t\t\t\t\t\t\t32,\t\t\t\t-- <font size>, \r\n\t\t\t\t\t\t\t\"Hello World!\"\t-- \"<text string>\"\r\n\t\t\t\t\t\t)\r\n\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"font\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.font = \"arial\"\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"size\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.size = prop.size * 2\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"txt_alpha\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.txt_alpha = 0x80\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 260 then\r\n\t\tsyslog(string.format(\"txt_color\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.txt_color = 0x0000FF\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"text\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.text = \"I swear I've changed!\"\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"align\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.align = 1\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\t\r\n\tif count == 320 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_TEXT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_TEXT, \"Once again\")\r\n\tend\r\n\tif count == 340 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_COLOR\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_COLOR, 0x40, 0xFF0000)\r\n\tend\r\n\tif count == 360 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_FONT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_FONT, \"fixed\", 12)\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_POSITION\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_POSITION, 500, 100)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_ALIGNMENT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_ALIGNMENT, 5)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/07.Label/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/07.Label/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"AlexBrush\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tpLabel = UI_Label \t(\r\n\t\t\t\t\t\t\tnil, \t\t\t-- <parent pointer>, \r\n\t\t\t\t\t\t\t7000, \t\t\t-- <order>, \r\n\t\t\t\t\t\t\t100,100,\t\t-- <x>, <y>,\r\n                            0xFF, 0x000000,\t-- <alpha>, <rgb>, \r\n\t\t\t\t\t\t\t\"AlexBrush\",\t-- \"<font name>\", \r\n\t\t\t\t\t\t\t32,\t\t\t\t-- <font size>, \r\n\t\t\t\t\t\t\t\"Hello World!\"\t-- \"<text string>\"\r\n\t\t\t\t\t\t)\r\n\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pLabel, prop)\t\r\n\tend\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"font\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.font = \"arial\"\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"size\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.size = prop.size * 2\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"txt_alpha\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.txt_alpha = 0x80\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 260 then\r\n\t\tsyslog(string.format(\"txt_color\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.txt_color = 0x0000FF\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"text\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.text = \"I swear I've changed!\"\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"align\"))\r\n\t\tprop = TASK_getProperty(pLabel)\r\n\t\tprop.align = 1\r\n\t\tTASK_setProperty(pLabel, prop)\r\n\tend\r\n\t\r\n\tif count == 320 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_TEXT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_TEXT, \"Once again\")\r\n\tend\r\n\tif count == 340 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_COLOR\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_COLOR, 0x40, 0xFF0000)\r\n\tend\r\n\tif count == 360 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_FONT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_FONT, \"fixed\", 12)\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_POSITION\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_POSITION, 500, 100)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_LABEL_SET_ALIGNMENT\"))\r\n\t\tsysCommand(pLabel, UI_LABEL_SET_ALIGNMENT, 5)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/08.DragIcon/.publish/android/DragIcon.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tlocal tblAREA = {\r\n\t\tx = 16,\r\n\t\ty = 20,\r\n\t\twidth = 67,\r\n\t\theight = 60\r\n\t}\r\n\tpDRAG = UI_DragIcon(\tnil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\tx, y,\r\n\t\t\t\t\t\t\ttblAREA,\r\n\t\t\t\t\t\t\t\"asset://dragicon.png.imag\",\r\n\t\t\t\t\t\t\t\"asset://dragmark.png.imag\",\r\n\t\t\t\t\t\t\t10,\r\n\t\t\t\t\t\t\t0.5,\r\n\t\t\t\t\t\t\t30, 70,\r\n\t\t\t\t\t\t\t\"dragIcon_dropCallback\"\r\n\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\tasset://dragicon.png.imag\t普段から配置しておくアイコン\r\n\t\tasset://dragmark.png.imag\tドラッグ位置について回る画像\r\n\t\tasset://putimg.png.imag\t\tドロップ時、その位置に配置される画像\r\n\t]]\r\n\r\n\t--[[ 配置済み画像をクリアできるボタンを配置する ]]\r\n\tUI_DbgLabel(nil, 7000, 800, 10, 0xff, 0xff0000, \"fixed\", 32, \"[ Clear ]\", 0, \"clearPutImage\")\r\n\r\n\t--[[ 配置する画像は、すべて pGRP の子タスクとして生成し、pGRP のkillと同時に死ぬようにする ]]\r\n\tpGRP = nil\r\n\tclearPutImage(nil, 0)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t--[[if count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\t\r\n\tif count == 250 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.order = 4000\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"asset\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.asset = \"asset://putimg.png.imag\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 350 then\r\n\t\tsyslog(string.format(\"drag asset\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag = \"asset://putimg.png.imag\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"flags = F_DICON_BASEINVISIBLE\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.flags = F_DICON_BASEINVISIBLE\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 550 then\r\n\t\tsyslog(string.format(\"flags = 0\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.flags = 0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"callback\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.callback = \"dragIcon_dropCallback2\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 650 then\r\n\t\tsyslog(string.format(\"drag_scaleX\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag_scaleX = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 750 then\r\n\t\tsyslog(string.format(\"drag_scaleY\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag_scaleY = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\t\r\n\tif count == 750 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_ENABLE false\"))\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_ENABLE, false)\r\n\tend\r\n\tif count == 850 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_ENABLE true\"))\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_ENABLE, true)\r\n\tend\r\n\t]]\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_DRAGAREA\"))\r\n\t\tdropArea = {\r\n\t\t\t x = 0,\r\n\t\t\t y = 0,\r\n\t\t\t width = 400,\r\n\t\t\t height = 200\r\n\t\t   }\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_DRAGAREA, dropArea)\r\n\tend\r\n\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\n\r\nfunction dragIcon_dropCallback(step, x, y)\r\n\tif step == DRAGICON_DRAG then\r\n\t\t-- ドラッグ中は、現在の座標をコンソールに出力する\r\n\t\t-- syslog(string.format(\"drag:( %d, %d )\", x, y))\r\n\telseif step == DRAGICON_RELEASE then\r\n\t\t-- ドロップされた位置に、配置画像で UI_SimpleItem を生成する。\r\n\t\tUI_SimpleItem(pGRP, 6000, x, y, \"asset://putimg.png.imag\")\r\n\tend\r\nend\r\n\r\nfunction dragIcon_dropCallback2(step, x, y)\r\n\tif step == DRAGICON_DRAG then\r\n\t\t-- ドラッグ中は、現在の座標をコンソールに出力する\r\n\t\t-- syslog(string.format(\"drag:( %d, %d )\", x, y))\r\n\telseif step == DRAGICON_RELEASE then\r\n\t\t-- ドロップされた位置に、配置画像で UI_SimpleItem を生成する。\r\n\t\tUI_SimpleItem(pGRP, 6000, x, y, \"asset://dragmark.png.imag\")\r\n\tend\r\nend\r\n\r\n-- 配置済みイメージをクリアするため、親タスクを殺して再生成する。\r\nfunction clearPutImage(pTask, cmdID)\r\n\tpGRP = TASK_kill(pGRP)\r\n\tpGRP = UI_Group(nil, 6000, 0, 0)\r\nend\r\n"
  },
  {
    "path": "Tutorial/08.DragIcon/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://DragIcon.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/08.DragIcon/.publish/iphone/DragIcon.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tlocal tblAREA = {\r\n\t\tx = 16,\r\n\t\ty = 20,\r\n\t\twidth = 67,\r\n\t\theight = 60\r\n\t}\r\n\tpDRAG = UI_DragIcon(\tnil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\tx, y,\r\n\t\t\t\t\t\t\ttblAREA,\r\n\t\t\t\t\t\t\t\"asset://dragicon.png.imag\",\r\n\t\t\t\t\t\t\t\"asset://dragmark.png.imag\",\r\n\t\t\t\t\t\t\t10,\r\n\t\t\t\t\t\t\t0.5,\r\n\t\t\t\t\t\t\t30, 70,\r\n\t\t\t\t\t\t\t\"dragIcon_dropCallback\"\r\n\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\tasset://dragicon.png.imag\t普段から配置しておくアイコン\r\n\t\tasset://dragmark.png.imag\tドラッグ位置について回る画像\r\n\t\tasset://putimg.png.imag\t\tドロップ時、その位置に配置される画像\r\n\t]]\r\n\r\n\t--[[ 配置済み画像をクリアできるボタンを配置する ]]\r\n\tUI_DbgLabel(nil, 7000, 800, 10, 0xff, 0xff0000, \"fixed\", 32, \"[ Clear ]\", 0, \"clearPutImage\")\r\n\r\n\t--[[ 配置する画像は、すべて pGRP の子タスクとして生成し、pGRP のkillと同時に死ぬようにする ]]\r\n\tpGRP = nil\r\n\tclearPutImage(nil, 0)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t--[[if count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\t\r\n\tif count == 250 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.order = 4000\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"asset\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.asset = \"asset://putimg.png.imag\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 350 then\r\n\t\tsyslog(string.format(\"drag asset\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag = \"asset://putimg.png.imag\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"flags = F_DICON_BASEINVISIBLE\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.flags = F_DICON_BASEINVISIBLE\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 550 then\r\n\t\tsyslog(string.format(\"flags = 0\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.flags = 0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"callback\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.callback = \"dragIcon_dropCallback2\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 650 then\r\n\t\tsyslog(string.format(\"drag_scaleX\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag_scaleX = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 750 then\r\n\t\tsyslog(string.format(\"drag_scaleY\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag_scaleY = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\t\r\n\tif count == 750 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_ENABLE false\"))\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_ENABLE, false)\r\n\tend\r\n\tif count == 850 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_ENABLE true\"))\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_ENABLE, true)\r\n\tend\r\n\t]]\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_DRAGAREA\"))\r\n\t\tdropArea = {\r\n\t\t\t x = 0,\r\n\t\t\t y = 0,\r\n\t\t\t width = 400,\r\n\t\t\t height = 200\r\n\t\t   }\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_DRAGAREA, dropArea)\r\n\tend\r\n\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\n\r\nfunction dragIcon_dropCallback(step, x, y)\r\n\tif step == DRAGICON_DRAG then\r\n\t\t-- ドラッグ中は、現在の座標をコンソールに出力する\r\n\t\t-- syslog(string.format(\"drag:( %d, %d )\", x, y))\r\n\telseif step == DRAGICON_RELEASE then\r\n\t\t-- ドロップされた位置に、配置画像で UI_SimpleItem を生成する。\r\n\t\tUI_SimpleItem(pGRP, 6000, x, y, \"asset://putimg.png.imag\")\r\n\tend\r\nend\r\n\r\nfunction dragIcon_dropCallback2(step, x, y)\r\n\tif step == DRAGICON_DRAG then\r\n\t\t-- ドラッグ中は、現在の座標をコンソールに出力する\r\n\t\t-- syslog(string.format(\"drag:( %d, %d )\", x, y))\r\n\telseif step == DRAGICON_RELEASE then\r\n\t\t-- ドロップされた位置に、配置画像で UI_SimpleItem を生成する。\r\n\t\tUI_SimpleItem(pGRP, 6000, x, y, \"asset://dragmark.png.imag\")\r\n\tend\r\nend\r\n\r\n-- 配置済みイメージをクリアするため、親タスクを殺して再生成する。\r\nfunction clearPutImage(pTask, cmdID)\r\n\tpGRP = TASK_kill(pGRP)\r\n\tpGRP = UI_Group(nil, 6000, 0, 0)\r\nend\r\n"
  },
  {
    "path": "Tutorial/08.DragIcon/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://DragIcon.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/08.DragIcon/DragIcon.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tlocal tblAREA = {\r\n\t\tx = 16,\r\n\t\ty = 20,\r\n\t\twidth = 67,\r\n\t\theight = 60\r\n\t}\r\n\tpDRAG = UI_DragIcon(\tnil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\tx, y,\r\n\t\t\t\t\t\t\ttblAREA,\r\n\t\t\t\t\t\t\t\"asset://dragicon.png.imag\",\r\n\t\t\t\t\t\t\t\"asset://dragmark.png.imag\",\r\n\t\t\t\t\t\t\t10,\r\n\t\t\t\t\t\t\t0.5,\r\n\t\t\t\t\t\t\t30, 70,\r\n\t\t\t\t\t\t\t\"dragIcon_dropCallback\"\r\n\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\tasset://dragicon.png.imag\t普段から配置しておくアイコン\r\n\t\tasset://dragmark.png.imag\tドラッグ位置について回る画像\r\n\t\tasset://putimg.png.imag\t\tドロップ時、その位置に配置される画像\r\n\t]]\r\n\r\n\t--[[ 配置済み画像をクリアできるボタンを配置する ]]\r\n\tUI_DbgLabel(nil, 7000, 800, 10, 0xff, 0xff0000, \"fixed\", 32, \"[ Clear ]\", 0, \"clearPutImage\")\r\n\r\n\t--[[ 配置する画像は、すべて pGRP の子タスクとして生成し、pGRP のkillと同時に死ぬようにする ]]\r\n\tpGRP = nil\r\n\tclearPutImage(nil, 0)\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t--[[if count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pDRAG, prop)\t\r\n\tend\r\n\t\r\n\tif count == 250 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.order = 4000\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"asset\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.asset = \"asset://putimg.png.imag\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 350 then\r\n\t\tsyslog(string.format(\"drag asset\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag = \"asset://putimg.png.imag\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"flags = F_DICON_BASEINVISIBLE\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.flags = F_DICON_BASEINVISIBLE\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 550 then\r\n\t\tsyslog(string.format(\"flags = 0\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.flags = 0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 600 then\r\n\t\tsyslog(string.format(\"callback\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.callback = \"dragIcon_dropCallback2\"\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 650 then\r\n\t\tsyslog(string.format(\"drag_scaleX\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag_scaleX = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\tif count == 750 then\r\n\t\tsyslog(string.format(\"drag_scaleY\"))\r\n\t\tprop = TASK_getProperty(pDRAG)\r\n\t\tprop.drag_scaleY = 2.0\r\n\t\tTASK_setProperty(pDRAG, prop)\r\n\tend\r\n\t\r\n\tif count == 750 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_ENABLE false\"))\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_ENABLE, false)\r\n\tend\r\n\tif count == 850 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_ENABLE true\"))\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_ENABLE, true)\r\n\tend\r\n\t]]\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_DRAGICON_DRAGAREA\"))\r\n\t\tdropArea = {\r\n\t\t\t x = 0,\r\n\t\t\t y = 0,\r\n\t\t\t width = 400,\r\n\t\t\t height = 200\r\n\t\t   }\r\n\t\tsysCommand(pDRAG, UI_DRAGICON_DRAGAREA, dropArea)\r\n\tend\r\n\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\n\r\nfunction dragIcon_dropCallback(step, x, y)\r\n\tif step == DRAGICON_DRAG then\r\n\t\t-- ドラッグ中は、現在の座標をコンソールに出力する\r\n\t\t-- syslog(string.format(\"drag:( %d, %d )\", x, y))\r\n\telseif step == DRAGICON_RELEASE then\r\n\t\t-- ドロップされた位置に、配置画像で UI_SimpleItem を生成する。\r\n\t\tUI_SimpleItem(pGRP, 6000, x, y, \"asset://putimg.png.imag\")\r\n\tend\r\nend\r\n\r\nfunction dragIcon_dropCallback2(step, x, y)\r\n\tif step == DRAGICON_DRAG then\r\n\t\t-- ドラッグ中は、現在の座標をコンソールに出力する\r\n\t\t-- syslog(string.format(\"drag:( %d, %d )\", x, y))\r\n\telseif step == DRAGICON_RELEASE then\r\n\t\t-- ドロップされた位置に、配置画像で UI_SimpleItem を生成する。\r\n\t\tUI_SimpleItem(pGRP, 6000, x, y, \"asset://dragmark.png.imag\")\r\n\tend\r\nend\r\n\r\n-- 配置済みイメージをクリアするため、親タスクを殺して再生成する。\r\nfunction clearPutImage(pTask, cmdID)\r\n\tpGRP = TASK_kill(pGRP)\r\n\tpGRP = UI_Group(nil, 6000, 0, 0)\r\nend\r\n"
  },
  {
    "path": "Tutorial/08.DragIcon/dragicon.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"388bd29c-a40d-401f-9d7b-6ff6135e5ec4\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>dragicon.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:42:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>914</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>dragicon.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>100</Width>\r\n    <Height>100</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>100</Width>\r\n        <Height>100</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>100</Width>\r\n      <Height>100</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>100</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>100</X>\r\n        <Y>100</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>100</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>100</MaskWidth>\r\n    <MaskHeight>100</MaskHeight>\r\n    <Mask>JxAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/08.DragIcon/dragmark.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"bd701bed-35c6-437a-8e42-0a697168d9ba\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>dragmark.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:42:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>568</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>dragmark.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>100</Width>\r\n    <Height>100</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>100</Width>\r\n        <Height>100</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>100</Width>\r\n      <Height>100</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>100</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>100</X>\r\n        <Y>100</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>100</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>100</MaskWidth>\r\n    <MaskHeight>100</MaskHeight>\r\n    <Mask>JxAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/08.DragIcon/iconassets.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"f01b1e4f-24b2-4acc-a554-09caebc14949\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>iconassets.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-06-07T12:32:49</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>256</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>dragicon.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>dragicon.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>104</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>dragmark.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>dragmark.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>104</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>putimg.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>putimg.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/08.DragIcon/putimg.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"fc71a900-ebf8-424e-980c-35bc976271e5\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>putimg.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-07T19:42:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>711</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>putimg.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>47</X>\r\n      <Y>11</Y>\r\n    </Center>\r\n    <Width>100</Width>\r\n    <Height>40</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>100</Width>\r\n        <Height>40</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>100</Width>\r\n      <Height>40</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>100</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>100</X>\r\n        <Y>40</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>40</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>100</MaskWidth>\r\n    <MaskHeight>40</MaskHeight>\r\n    <Mask>D6AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/08.DragIcon/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://DragIcon.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/09.RubberBand/.publish/android/RubberBand.lua",
    "content": "function setup()\r\n\tpRB = nil\r\n\tUI_TouchPad(\"callback_TouchPad\")\r\n\r\n\tlocal list = {\r\n\t\ton = \"asset://se_on\",\r\n\t\toff = \"asset://se_off\",\r\n\t\tdrag = \"asset://se_drag\"\r\n\t}\r\n\tsnd = {}\r\n\tfor key,val in pairs(list) do\r\n\t\tsnd[key] = SND_Open(val, false)\r\n\tend\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tfor key,val in pairs(snd) do\r\n\t\tSND_Close(val)\r\n\tend\r\nend\r\n\r\n\r\nfunction callback_TouchPad(arr)\r\n\r\n\tfor idx,item in ipairs(arr) do\r\n\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\r\n\t\t\tlocal flag = bitOR(RB_ANIM_ENABLE, RB_ANIM_REALTIME)\r\n\t\t\tpRB = UI_RubberBand(nil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\titem.x, item.y,\t\t-- 原点位置\r\n\t\t\t\t\t\t\t\"asset://origin.png.imag\",\t\t-- 原点画像\r\n\t\t\t\t\t\t\t\"asset://joint.png.imag\",\t\t-- 節画像\r\n\t\t\t\t\t\t\t\"asset://point.png.imag\",\t\t-- 先端画像\r\n\t\t\t\t\t\t\t10,\t\t\t\t\t\t\t\t-- 分割数\r\n\t\t\t\t\t\t\tflag,\r\n\t\t\t\t\t\t\t500,\r\n\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t)\r\n\t\t\tSND_Play(snd[\"on\"])\r\n\t\telseif item.type == PAD_ITEM_DRAG then\r\n\t\t\tprop = TASK_getProperty(pRB)\r\n\t\t\tprop.pointX = item.x\r\n\t\t\tprop.pointY = item.y\r\n\t\t\tTASK_setProperty(pRB, prop)\r\n\t\telseif item.type == PAD_ITEM_RELEASE then\r\n\t\t\tpRB = TASK_kill(pRB)\r\n\t\t\tSND_Volume(snd[\"off\"], item.x / 960.0)\r\n\t\t\tSND_Play(snd[\"off\"])\r\n\t\tend\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/09.RubberBand/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://RubberBand.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/09.RubberBand/.publish/iphone/RubberBand.lua",
    "content": "function setup()\r\n\tpRB = nil\r\n\tUI_TouchPad(\"callback_TouchPad\")\r\n\r\n\tlocal list = {\r\n\t\ton = \"asset://se_on\",\r\n\t\toff = \"asset://se_off\",\r\n\t\tdrag = \"asset://se_drag\"\r\n\t}\r\n\tsnd = {}\r\n\tfor key,val in pairs(list) do\r\n\t\tsnd[key] = SND_Open(val, false)\r\n\tend\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tfor key,val in pairs(snd) do\r\n\t\tSND_Close(val)\r\n\tend\r\nend\r\n\r\n\r\nfunction callback_TouchPad(arr)\r\n\r\n\tfor idx,item in ipairs(arr) do\r\n\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\r\n\t\t\tlocal flag = bitOR(RB_ANIM_ENABLE, RB_ANIM_REALTIME)\r\n\t\t\tpRB = UI_RubberBand(nil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\titem.x, item.y,\t\t-- 原点位置\r\n\t\t\t\t\t\t\t\"asset://origin.png.imag\",\t\t-- 原点画像\r\n\t\t\t\t\t\t\t\"asset://joint.png.imag\",\t\t-- 節画像\r\n\t\t\t\t\t\t\t\"asset://point.png.imag\",\t\t-- 先端画像\r\n\t\t\t\t\t\t\t10,\t\t\t\t\t\t\t\t-- 分割数\r\n\t\t\t\t\t\t\tflag,\r\n\t\t\t\t\t\t\t500,\r\n\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t)\r\n\t\t\tSND_Play(snd[\"on\"])\r\n\t\telseif item.type == PAD_ITEM_DRAG then\r\n\t\t\tprop = TASK_getProperty(pRB)\r\n\t\t\tprop.pointX = item.x\r\n\t\t\tprop.pointY = item.y\r\n\t\t\tTASK_setProperty(pRB, prop)\r\n\t\telseif item.type == PAD_ITEM_RELEASE then\r\n\t\t\tpRB = TASK_kill(pRB)\r\n\t\t\tSND_Volume(snd[\"off\"], item.x / 960.0)\r\n\t\t\tSND_Play(snd[\"off\"])\r\n\t\tend\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/09.RubberBand/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://RubberBand.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/09.RubberBand/RBitem.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"b1043e87-6035-477b-bfee-c0ce49d1b535\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>RBitem.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-10-02T11:47:19</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>256</Width>\r\n    <Height>64</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>origin.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>origin.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>72</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>point.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>point.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>144</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>joint.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>joint.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/09.RubberBand/RubberBand.lua",
    "content": "function setup()\r\n\tpRB = nil\r\n\tUI_TouchPad(\"callback_TouchPad\")\r\n\r\n\tlocal list = {\r\n\t\ton = \"asset://se_on\",\r\n\t\toff = \"asset://se_off\",\r\n\t\tdrag = \"asset://se_drag\"\r\n\t}\r\n\tsnd = {}\r\n\tfor key,val in pairs(list) do\r\n\t\tsnd[key] = SND_Open(val, false)\r\n\tend\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tfor key,val in pairs(snd) do\r\n\t\tSND_Close(val)\r\n\tend\r\nend\r\n\r\n\r\nfunction callback_TouchPad(arr)\r\n\r\n\tfor idx,item in ipairs(arr) do\r\n\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\r\n\t\t\tlocal flag = bitOR(RB_ANIM_ENABLE, RB_ANIM_REALTIME)\r\n\t\t\tpRB = UI_RubberBand(nil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\titem.x, item.y,\t\t-- 原点位置\r\n\t\t\t\t\t\t\t\"asset://origin.png.imag\",\t\t-- 原点画像\r\n\t\t\t\t\t\t\t\"asset://joint.png.imag\",\t\t-- 節画像\r\n\t\t\t\t\t\t\t\"asset://point.png.imag\",\t\t-- 先端画像\r\n\t\t\t\t\t\t\t10,\t\t\t\t\t\t\t\t-- 分割数\r\n\t\t\t\t\t\t\tflag,\r\n\t\t\t\t\t\t\t500,\r\n\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttrue\r\n\t\t\t\t\t\t\t)\r\n\t\t\tSND_Play(snd[\"on\"])\r\n\t\telseif item.type == PAD_ITEM_DRAG then\r\n\t\t\tprop = TASK_getProperty(pRB)\r\n\t\t\tprop.pointX = item.x\r\n\t\t\tprop.pointY = item.y\r\n\t\t\tTASK_setProperty(pRB, prop)\r\n\t\telseif item.type == PAD_ITEM_RELEASE then\r\n\t\t\tpRB = TASK_kill(pRB)\r\n\t\t\tSND_Volume(snd[\"off\"], item.x / 960.0)\r\n\t\t\tSND_Play(snd[\"off\"])\r\n\t\tend\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/09.RubberBand/joint.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"b722896a-6ca7-4432-a9da-f2b6c0327bac\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>joint.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-04T17:33:04</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>580</ImgFileSize>\r\n    <ImgFileDate>2013/02/25 15:07:03</ImgFileDate>\r\n    <ImgPathName>joint.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>16</X>\r\n      <Y>16</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/09.RubberBand/origin.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"2917c660-fb3d-4560-be4e-ce6a8dd27b20\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>origin.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-04T17:33:04</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>970</ImgFileSize>\r\n    <ImgFileDate>2013/02/25 15:07:03</ImgFileDate>\r\n    <ImgPathName>origin.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>32</X>\r\n      <Y>32</Y>\r\n    </Center>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>64</Width>\r\n        <Height>64</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>64</Width>\r\n      <Height>64</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>64</MaskWidth>\r\n    <MaskHeight>64</MaskHeight>\r\n    <Mask>EAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/09.RubberBand/point.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ae15d768-f781-439a-8a0e-c737d055f92b\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>point.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-04T17:33:04</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>409</ImgFileSize>\r\n    <ImgFileDate>2013/02/25 15:07:03</ImgFileDate>\r\n    <ImgPathName>point.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>63</X>\r\n      <Y>32</Y>\r\n    </Center>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>64</Width>\r\n        <Height>64</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>64</Width>\r\n      <Height>64</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>64</MaskWidth>\r\n    <MaskHeight>64</MaskHeight>\r\n    <Mask>EAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/09.RubberBand/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://RubberBand.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/10.IntervalTimer/.publish/android/start.lua",
    "content": "function setup()\r\n\r\n\tpIT0 = UTIL_IntervalTimer\t(\r\n\t\t\t\t\t\t\t\t\t0, \t\t\t--<timerID>\r\n\t\t\t\t\t\t\t\t\t\"callback\",--\"<callback>\" \r\n\t\t\t\t\t\t\t\t\t100,\t\t--<interval>\r\n\t\t\t\t\t\t\t\t\ttrue\t\t--[ , <repeat> ]\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\tpIT1 = UTIL_IntervalTimer\t(\r\n\t\t\t\t\t\t\t\t\t1, \t\t\t--<timerID>\r\n\t\t\t\t\t\t\t\t\t\"callback\",--\"<callback>\" \r\n\t\t\t\t\t\t\t\t\t50,\t\t\t--<interval>\r\n\t\t\t\t\t\t\t\t\tfalse\t\t--[ , <repeat> ]\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"timer_id\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.timer_id = 2\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"interval\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.interval = 500\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"is_repeating = false\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.is_repeating = false\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n\r\nfunction callback(timerID)\r\n\tsyslog(string.format(\"CALLBACK %i.\", timerID))\r\nend\r\n"
  },
  {
    "path": "Tutorial/10.IntervalTimer/.publish/iphone/start.lua",
    "content": "function setup()\r\n\r\n\tpIT0 = UTIL_IntervalTimer\t(\r\n\t\t\t\t\t\t\t\t\t0, \t\t\t--<timerID>\r\n\t\t\t\t\t\t\t\t\t\"callback\",--\"<callback>\" \r\n\t\t\t\t\t\t\t\t\t100,\t\t--<interval>\r\n\t\t\t\t\t\t\t\t\ttrue\t\t--[ , <repeat> ]\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\tpIT1 = UTIL_IntervalTimer\t(\r\n\t\t\t\t\t\t\t\t\t1, \t\t\t--<timerID>\r\n\t\t\t\t\t\t\t\t\t\"callback\",--\"<callback>\" \r\n\t\t\t\t\t\t\t\t\t50,\t\t\t--<interval>\r\n\t\t\t\t\t\t\t\t\tfalse\t\t--[ , <repeat> ]\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"timer_id\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.timer_id = 2\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"interval\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.interval = 500\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"is_repeating = false\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.is_repeating = false\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n\r\nfunction callback(timerID)\r\n\tsyslog(string.format(\"CALLBACK %i.\", timerID))\r\nend\r\n"
  },
  {
    "path": "Tutorial/10.IntervalTimer/start.lua",
    "content": "function setup()\r\n\r\n\tpIT0 = UTIL_IntervalTimer\t(\r\n\t\t\t\t\t\t\t\t\t0, \t\t\t--<timerID>\r\n\t\t\t\t\t\t\t\t\t\"callback\",--\"<callback>\" \r\n\t\t\t\t\t\t\t\t\t100,\t\t--<interval>\r\n\t\t\t\t\t\t\t\t\ttrue\t\t--[ , <repeat> ]\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\tpIT1 = UTIL_IntervalTimer\t(\r\n\t\t\t\t\t\t\t\t\t1, \t\t\t--<timerID>\r\n\t\t\t\t\t\t\t\t\t\"callback\",--\"<callback>\" \r\n\t\t\t\t\t\t\t\t\t50,\t\t\t--<interval>\r\n\t\t\t\t\t\t\t\t\tfalse\t\t--[ , <repeat> ]\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"timer_id\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.timer_id = 2\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"interval\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.interval = 500\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"is_repeating = false\"))\r\n\t\tprop = TASK_getProperty(pIT0)\r\n\t\tprop.is_repeating = false\r\n\t\tTASK_setProperty(pIT0, prop)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n\r\nfunction callback(timerID)\r\n\tsyslog(string.format(\"CALLBACK %i.\", timerID))\r\nend\r\n"
  },
  {
    "path": "Tutorial/11.LangTest/.publish/android/start.lua",
    "content": "function setup()\r\n\t-- Link DB Table with Language dictionnary.\r\n\t-- If not linked, work as it was before...\r\n\tLANG_useDB(\"asset://tableScheme.db_\",\"lang_tbl\",\"key\",\"value\",\"group_k\")\r\n\t-- Preload a group of language info to avoid access.\r\n\tLANG_loadGroup(\"start\")\r\n\t\r\n\t-- Lookup for a loaded key\r\tsyslog(LANG_getString(\"#key1\"))\r\n\t\r\n\t-- Lookup for a unknown key and see if it looks up correctly into DB.\r\n\tsyslog(LANG_getString(\"#key4\"))\r\n\t\r\n\t-- Lookup for an unknown key and does not map at all.\r\n\t-- syslog(LANG_getString(\"#keyfail\"))\r\n\t\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/11.LangTest/.publish/iphone/start.lua",
    "content": "function setup()\r\n\t-- Link DB Table with Language dictionnary.\r\n\t-- If not linked, work as it was before...\r\n\tLANG_useDB(\"asset://tableScheme.db_\",\"lang_tbl\",\"key\",\"value\",\"group_k\")\r\n\t-- Preload a group of language info to avoid access.\r\n\tLANG_loadGroup(\"start\")\r\n\t\r\n\t-- Lookup for a loaded key\r\tsyslog(LANG_getString(\"#key1\"))\r\n\t\r\n\t-- Lookup for a unknown key and see if it looks up correctly into DB.\r\n\tsyslog(LANG_getString(\"#key4\"))\r\n\t\r\n\t-- Lookup for an unknown key and does not map at all.\r\n\t-- syslog(LANG_getString(\"#keyfail\"))\r\n\t\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/11.LangTest/.server/lang_tbl.csv",
    "content": "tbl_userdef_id, key, value, group_k\r\n1,\"hello\",\"hello,world\",\"start\"\r\n2,\"key1\",\"Key1 English\",\"start\"\r\n3,\"key2\",\"Key2 English\",\"start\"\r\n4,\"key3\",\"Key3 English\",\"start\"\r\n5,\"key4\",\"Key4 English\",\"other\"\r\n"
  },
  {
    "path": "Tutorial/11.LangTest/lang_tbl.csv",
    "content": "tbl_userdef_id, key, value, group_k\r\n1,\"hello\",\"hello,world\",\"start\"\r\n2,\"key1\",\"Key1 English\",\"start\"\r\n3,\"key2\",\"Key2 English\",\"start\"\r\n4,\"key3\",\"Key3 English\",\"start\"\r\n5,\"key4\",\"Key4 English\",\"other\"\r\n"
  },
  {
    "path": "Tutorial/11.LangTest/start.lua",
    "content": "function setup()\r\n\t-- Link DB Table with Language dictionnary.\r\n\t-- If not linked, work as it was before...\r\n\tLANG_useDB(\"asset://tableScheme.db_\",\"lang_tbl\",\"key\",\"value\",\"group_k\")\r\n\t-- Preload a group of language info to avoid access.\r\n\tLANG_loadGroup(\"start\")\r\n\t\r\n\t-- Lookup for a loaded key\r\tsyslog(LANG_getString(\"#key1\"))\r\n\t\r\n\t-- Lookup for a unknown key and see if it looks up correctly into DB.\r\n\tsyslog(LANG_getString(\"#key4\"))\r\n\t\r\n\t-- Lookup for an unknown key and does not map at all.\r\n\t-- syslog(LANG_getString(\"#keyfail\"))\r\n\t\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/11.LangTest/tableScheme.csql",
    "content": "CREATE TABLE `lang_tbl` (\r\n    `tbl_userdef_id` INTEGER NOT NULL ,\r\n    `key` TEXT NOT NULL ,\r\n    `value` TEXT NOT NULL ,\r\n    `group_k` TEXT NOT NULL ,\r\n    PRIMARY KEY (`key`)\r\n);\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/.publish/android/FreeVertItem.lua",
    "content": "function setup()\r\n\t\r\n\tverticesArray = {\r\n\t\t100,100,   -- left top\r\n\t\t200,100,   -- right top\r\n\t\t200,200,   -- right bottom\r\n\t\t100,200    -- left bottom\r\n\t} \r\n   \r\n\tpFVI = UI_FreeVertItem( nil, 7000, 100, 100, \"asset://TileA.png.imag\", verticesArray)\r\n\t\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 200 then \r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pFVI, prop)\r\n\tend\r\n\tif count == 220 then \r\n\t\tsyslog(string.format(\"asset\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.asset = \"forbidden\"\r\n\t\tTASK_setProperty(pFVI, prop)\r\n\tend\r\n\t\r\n\tif count == 240 then\r\n\t\tcoords = { 100, 100, 100, 200, 200, 200, 200, 100 }\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_VERTICES\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_VERTICES, coords)\r\n\tend\r\n\tif count == 240 then \r\n\t\tcolors = { 0xff000000, 0xffff0000, 0xff00ff00, 0xff0000ff }\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_COLORS\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_COLORS, colors)\r\n\tend\r\n\tif count == 240 then \r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_VERT_COL\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_VERT_COL, 1, 0xff, 0xffffff)\r\n\tend\r\n\tif count == 240 then \r\n\t\tuv = { 0, 0, 0, 1, 1, 1, 1, 0 };\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_UV\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_UV, uv)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://FreeVertItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/.publish/iphone/FreeVertItem.lua",
    "content": "function setup()\r\n\t\r\n\tverticesArray = {\r\n\t\t100,100,   -- left top\r\n\t\t200,100,   -- right top\r\n\t\t200,200,   -- right bottom\r\n\t\t100,200    -- left bottom\r\n\t} \r\n   \r\n\tpFVI = UI_FreeVertItem( nil, 7000, 100, 100, \"asset://TileA.png.imag\", verticesArray)\r\n\t\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 200 then \r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pFVI, prop)\r\n\tend\r\n\tif count == 220 then \r\n\t\tsyslog(string.format(\"asset\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.asset = \"forbidden\"\r\n\t\tTASK_setProperty(pFVI, prop)\r\n\tend\r\n\t\r\n\tif count == 240 then\r\n\t\tcoords = { 100, 100, 100, 200, 200, 200, 200, 100 }\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_VERTICES\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_VERTICES, coords)\r\n\tend\r\n\tif count == 240 then \r\n\t\tcolors = { 0xff000000, 0xffff0000, 0xff00ff00, 0xff0000ff }\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_COLORS\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_COLORS, colors)\r\n\tend\r\n\tif count == 240 then \r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_VERT_COL\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_VERT_COL, 1, 0xff, 0xffffff)\r\n\tend\r\n\tif count == 240 then \r\n\t\tuv = { 0, 0, 0, 1, 1, 1, 1, 0 };\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_UV\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_UV, uv)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://FreeVertItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/FreeVertItem.lua",
    "content": "function setup()\r\n\t\r\n\tverticesArray = {\r\n\t\t100,100,   -- left top\r\n\t\t200,100,   -- right top\r\n\t\t200,200,   -- right bottom\r\n\t\t100,200    -- left bottom\r\n\t} \r\n   \r\n\tpFVI = UI_FreeVertItem( nil, 7000, 100, 100, \"asset://TileA.png.imag\", verticesArray)\r\n\t\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pFVI, prop)\t\r\n\tend\r\n\tif count == 200 then \r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pFVI, prop)\r\n\tend\r\n\tif count == 220 then \r\n\t\tsyslog(string.format(\"asset\"))\r\n\t\tprop = TASK_getProperty(pFVI)\r\n\t\tprop.asset = \"forbidden\"\r\n\t\tTASK_setProperty(pFVI, prop)\r\n\tend\r\n\t\r\n\tif count == 240 then\r\n\t\tcoords = { 100, 100, 100, 200, 200, 200, 200, 100 }\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_VERTICES\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_VERTICES, coords)\r\n\tend\r\n\tif count == 240 then \r\n\t\tcolors = { 0xff000000, 0xffff0000, 0xff00ff00, 0xff0000ff }\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_COLORS\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_COLORS, colors)\r\n\tend\r\n\tif count == 240 then \r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_VERT_COL\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_VERT_COL, 1, 0xff, 0xffffff)\r\n\tend\r\n\tif count == 240 then \r\n\t\tuv = { 0, 0, 0, 1, 1, 1, 1, 0 };\r\n\t\tsyslog(string.format(\"CMD UI_FREEVERT_SET_UV\"))\r\n\t\tsysCommand(pFVI, UI_FREEVERT_SET_UV, uv)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/TileA.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"eaa962cf-0bc7-4361-9317-c89b331f990c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileA.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>657</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:22</ImgFileDate>\r\n    <ImgPathName>TileA.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/12.FreeVertItem/TileB.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"a2864678-680c-4dad-9c83-cf6aabb5f513\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileB.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>665</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:36</ImgFileDate>\r\n    <ImgPathName>TileB.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/12.FreeVertItem/TileC.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"b12a93be-dad0-40cc-9e73-60c45589f3e6\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileC.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>657</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:54</ImgFileDate>\r\n    <ImgPathName>TileC.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/12.FreeVertItem/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://FreeVertItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/12.FreeVertItem/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"5e70d8c4-aae1-4651-8189-6b5848deaf48\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-08-09T17:50:49</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileA.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileA.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>24</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileB.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileB.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>48</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileC.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileC.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/13.VariableItem/.publish/android/VariableItem.lua",
    "content": "function setup()\r\n\tpItem1 = UI_VariableItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t0, 0,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t-1,-1,\t\t\t\t\t\t-- arg[5,6]:\t表示サイズ\r\n\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[7]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\r\n\tpItem2 = UI_VariableItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t7001,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t200,200,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t200,200,\t\t\t\t\t\t-- arg[5,6]:\t表示サイズ\r\n\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[7]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\r\n\t--[[\r\n\t\tUI_VariableItem just display like UI_SimpleItem.\r\n\t\tExcept that it is possible to :\r\n\t\t- Modify the size of the image (perform stretch)\r\n\t\t- Apply a mask by doing texture composition.\r\n\t\t- Change the ressource at runtime.\r\n\r\n\t\tNote : size of -1,-1 will result in using original size without knowing the size\r\n\t]]\r\n\t\r\n\tbFlag = true\r\n\t\r\n\tcount = 0\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 40 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_CHANGE_ASSET, \"asset://itemimage2.png.imag\") \r\n\tend\r\n\tif count == 80 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_SET_UV, 10,10,500,500) \r\n\tend\r\n\tif count == 120 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_RESET_UV) \r\n\tend\r\n\tif count == 160 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_SET_MASK, \"asset://itemMask.png.imag\")\r\n\tend\r\nend\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/13.VariableItem/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://VariableItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/13.VariableItem/.publish/iphone/VariableItem.lua",
    "content": "function setup()\r\n\tpItem1 = UI_VariableItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t0, 0,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t-1,-1,\t\t\t\t\t\t-- arg[5,6]:\t表示サイズ\r\n\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[7]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\r\n\tpItem2 = UI_VariableItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t7001,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t200,200,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t200,200,\t\t\t\t\t\t-- arg[5,6]:\t表示サイズ\r\n\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[7]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\r\n\t--[[\r\n\t\tUI_VariableItem just display like UI_SimpleItem.\r\n\t\tExcept that it is possible to :\r\n\t\t- Modify the size of the image (perform stretch)\r\n\t\t- Apply a mask by doing texture composition.\r\n\t\t- Change the ressource at runtime.\r\n\r\n\t\tNote : size of -1,-1 will result in using original size without knowing the size\r\n\t]]\r\n\t\r\n\tbFlag = true\r\n\t\r\n\tcount = 0\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 40 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_CHANGE_ASSET, \"asset://itemimage2.png.imag\") \r\n\tend\r\n\tif count == 80 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_SET_UV, 10,10,500,500) \r\n\tend\r\n\tif count == 120 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_RESET_UV) \r\n\tend\r\n\tif count == 160 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_SET_MASK, \"asset://itemMask.png.imag\")\r\n\tend\r\nend\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/13.VariableItem/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://VariableItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/13.VariableItem/VariableItem.lua",
    "content": "function setup()\r\n\tpItem1 = UI_VariableItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t0, 0,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t-1,-1,\t\t\t\t\t\t-- arg[5,6]:\t表示サイズ\r\n\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[7]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\r\n\tpItem2 = UI_VariableItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t7001,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t200,200,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t200,200,\t\t\t\t\t\t-- arg[5,6]:\t表示サイズ\r\n\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[7]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\r\n\t--[[\r\n\t\tUI_VariableItem just display like UI_SimpleItem.\r\n\t\tExcept that it is possible to :\r\n\t\t- Modify the size of the image (perform stretch)\r\n\t\t- Apply a mask by doing texture composition.\r\n\t\t- Change the ressource at runtime.\r\n\r\n\t\tNote : size of -1,-1 will result in using original size without knowing the size\r\n\t]]\r\n\t\r\n\tbFlag = true\r\n\t\r\n\tcount = 0\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 40 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_CHANGE_ASSET, \"asset://itemimage2.png.imag\") \r\n\tend\r\n\tif count == 80 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_SET_UV, 10,10,500,500) \r\n\tend\r\n\tif count == 120 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_RESET_UV) \r\n\tend\r\n\tif count == 160 then\r\n\t\tsysCommand(pItem1, UI_VARITEM_SET_MASK, \"asset://itemMask.png.imag\")\r\n\tend\r\nend\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/13.VariableItem/itemMask.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"e0359356-8b5a-4aab-a134-f5780408ef6f\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>itemMask.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-26T13:58:12</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>19415</ImgFileSize>\r\n    <ImgFileDate>2013/06/26 13:57:34</ImgFileDate>\r\n    <ImgPathName>itemMask.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>128</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>128</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>128</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>128</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>128</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>128</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>QAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/13.VariableItem/itemimage.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"d34f5343-974f-4f08-be1f-e47059b94531\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>itemimage.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:21:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>50917</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:15:42</ImgFileDate>\r\n    <ImgPathName>itemimage.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>273</Width>\r\n    <Height>185</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>273</Width>\r\n        <Height>185</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>273</Width>\r\n      <Height>185</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>273</MaskWidth>\r\n    <MaskHeight>185</MaskHeight>\r\n    <Mask>xUkB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/13.VariableItem/itemimage2.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"32369fe1-9389-4ec8-ad2c-e21948321f56\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>itemimage2.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:21:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>31013</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:24:42</ImgFileDate>\r\n    <ImgPathName>itemimage2.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>200</Width>\r\n    <Height>150</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>200</Width>\r\n        <Height>150</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>200</Width>\r\n      <Height>150</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>150</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>150</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>200</MaskWidth>\r\n    <MaskHeight>150</MaskHeight>\r\n    <Mask>dTAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/13.VariableItem/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://VariableItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/13.VariableItem/textureBoat.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"d33e3dcb-d881-4ecc-89e5-6d21c718548d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>textureBoat.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-26T13:58:32</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>512</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>8</X>\r\n        <Y>8</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>itemimage.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>itemimage.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>304</X>\r\n        <Y>16</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>itemimage2.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>true</IsSwitchXY>\r\n      <ImgPathName>itemimage2.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>8</X>\r\n        <Y>200</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>itemMask.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>itemMask.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/14.MultiImgItem/.publish/android/MultiImgItem.lua",
    "content": "function setup()\r\n\tpAssetList = {\r\n      \"asset://TileA.png.imag\",\r\n      \"asset://TileB.png.imag\",\r\n\t  \"asset://TileC.png.imag\"\r\n   }\r\n   pMIT = UI_MultiImgItem( nil, 7000, 100, 100, pAssetList, 2)\r\n   \r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"index\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.index = 0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"idxmax\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.idxmax = 4\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\t\r\n\tif count >= 300 and count % 10 == 0 then\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tidx = prop.index\r\n\t\tidx = idx + 1\r\n\t\tif idx % 3 == 0 then \r\n\t\t\tidx = 0\r\n\t\tend\r\n\t\tsyslog(string.format(\"CMD UI_MULTIIMG_SET_INDEX = %i\", idx))\r\n\t\tsysCommand(pMIT, UI_MULTIIMG_SET_INDEX, idx)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/14.MultiImgItem/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://MultiImgItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/14.MultiImgItem/.publish/iphone/MultiImgItem.lua",
    "content": "function setup()\r\n\tpAssetList = {\r\n      \"asset://TileA.png.imag\",\r\n      \"asset://TileB.png.imag\",\r\n\t  \"asset://TileC.png.imag\"\r\n   }\r\n   pMIT = UI_MultiImgItem( nil, 7000, 100, 100, pAssetList, 2)\r\n   \r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"index\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.index = 0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"idxmax\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.idxmax = 4\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\t\r\n\tif count >= 300 and count % 10 == 0 then\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tidx = prop.index\r\n\t\tidx = idx + 1\r\n\t\tif idx % 3 == 0 then \r\n\t\t\tidx = 0\r\n\t\tend\r\n\t\tsyslog(string.format(\"CMD UI_MULTIIMG_SET_INDEX = %i\", idx))\r\n\t\tsysCommand(pMIT, UI_MULTIIMG_SET_INDEX, idx)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/14.MultiImgItem/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://MultiImgItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/14.MultiImgItem/MultiImgItem.lua",
    "content": "function setup()\r\n\tpAssetList = {\r\n      \"asset://TileA.png.imag\",\r\n      \"asset://TileB.png.imag\",\r\n\t  \"asset://TileC.png.imag\"\r\n   }\r\n   pMIT = UI_MultiImgItem( nil, 7000, 100, 100, pAssetList, 2)\r\n   \r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"index\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.index = 0\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"idxmax\"))\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tprop.idxmax = 4\r\n\t\tTASK_setProperty(pMIT, prop)\t\r\n\tend\r\n\t\r\n\tif count >= 300 and count % 10 == 0 then\r\n\t\tprop = TASK_getProperty(pMIT)\r\n\t\tidx = prop.index\r\n\t\tidx = idx + 1\r\n\t\tif idx % 3 == 0 then \r\n\t\t\tidx = 0\r\n\t\tend\r\n\t\tsyslog(string.format(\"CMD UI_MULTIIMG_SET_INDEX = %i\", idx))\r\n\t\tsysCommand(pMIT, UI_MULTIIMG_SET_INDEX, idx)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/14.MultiImgItem/TileA.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"eaa962cf-0bc7-4361-9317-c89b331f990c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileA.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>657</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:22</ImgFileDate>\r\n    <ImgPathName>TileA.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/14.MultiImgItem/TileB.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"a2864678-680c-4dad-9c83-cf6aabb5f513\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileB.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>665</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:36</ImgFileDate>\r\n    <ImgPathName>TileB.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/14.MultiImgItem/TileC.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"b12a93be-dad0-40cc-9e73-60c45589f3e6\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileC.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>657</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:54</ImgFileDate>\r\n    <ImgPathName>TileC.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/14.MultiImgItem/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://MultiImgItem.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/14.MultiImgItem/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"5e70d8c4-aae1-4651-8189-6b5848deaf48\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-08-09T17:50:49</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileA.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileA.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>24</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileB.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileB.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>48</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileC.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileC.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/15.Scale9/.publish/android/Scale9.lua",
    "content": "-- -*- coding: utf-8-unix -*-\r\n---\r\n-- @file Scale9.lua\r\n-- @author Junichi Yamazaki\r\n-- @since 2012-08-31\r\n\r\nlocal pScale9\r\nlocal count = 0\r\nlocal asset = \"asset://Horiz.png.imag\"\r\n\r\nfunction setup()\r\n\r\n  count = 0\r\n\r\n  pScale9   = UI_Scale9(nil, 7000, 10, 10, 100, 100, asset)\r\n  pScale9_2 = UI_Scale9(nil, 6000, 60, 60, 200, 200, asset)\r\n\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.order = 5000\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"width\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.width = 400\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"height\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.height = 50\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\t\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"CMD UI_SCALE9_SETWIDTH\"))\r\n\t\tsysCommand(pScale9, UI_SCALE9_SETWIDTH, 600)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_SCALE9_SETHEIGHT\"))\r\n\t\tsysCommand(pScale9, UI_SCALE9_SETHEIGHT, 100)\r\n\tend\r\n\r\n  -- syslog(\"\" .. count)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/15.Scale9/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Scale9.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/15.Scale9/.publish/iphone/Scale9.lua",
    "content": "-- -*- coding: utf-8-unix -*-\r\n---\r\n-- @file Scale9.lua\r\n-- @author Junichi Yamazaki\r\n-- @since 2012-08-31\r\n\r\nlocal pScale9\r\nlocal count = 0\r\nlocal asset = \"asset://Horiz.png.imag\"\r\n\r\nfunction setup()\r\n\r\n  count = 0\r\n\r\n  pScale9   = UI_Scale9(nil, 7000, 10, 10, 100, 100, asset)\r\n  pScale9_2 = UI_Scale9(nil, 6000, 60, 60, 200, 200, asset)\r\n\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.order = 5000\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"width\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.width = 400\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"height\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.height = 50\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\t\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"CMD UI_SCALE9_SETWIDTH\"))\r\n\t\tsysCommand(pScale9, UI_SCALE9_SETWIDTH, 600)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_SCALE9_SETHEIGHT\"))\r\n\t\tsysCommand(pScale9, UI_SCALE9_SETHEIGHT, 100)\r\n\tend\r\n\r\n  -- syslog(\"\" .. count)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/15.Scale9/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Scale9.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/15.Scale9/Horiz.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"5a1bbb11-243a-470e-9679-7bb3ce2f4c6d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Horiz.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T19:21:10</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>1690</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:09</ImgFileDate>\r\n    <ImgPathName>Horiz.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Scale9</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">14</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">14</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">16</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">12</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">12</anyType>\r\n      <anyType xmlns:q6=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q6:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">13</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>44</Width>\r\n    <Height>37</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>44</Width>\r\n        <Height>37</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>44</Width>\r\n      <Height>37</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>44</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>44</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>44</MaskWidth>\r\n    <MaskHeight>37</MaskHeight>\r\n    <Mask>BlwB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/15.Scale9/Scale9.lua",
    "content": "-- -*- coding: utf-8-unix -*-\r\n---\r\n-- @file Scale9.lua\r\n-- @author Junichi Yamazaki\r\n-- @since 2012-08-31\r\n\r\nlocal pScale9\r\nlocal count = 0\r\nlocal asset = \"asset://Horiz.png.imag\"\r\n\r\nfunction setup()\r\n\r\n  count = 0\r\n\r\n  pScale9   = UI_Scale9(nil, 7000, 10, 10, 100, 100, asset)\r\n  pScale9_2 = UI_Scale9(nil, 6000, 60, 60, 200, 200, asset)\r\n\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.order = 5000\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"width\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.width = 400\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"height\"))\r\n\t\tprop = TASK_getProperty(pScale9)\r\n\t\tprop.height = 50\r\n\t\tTASK_setProperty(pScale9, prop)\t\r\n\tend\r\n\t\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"CMD UI_SCALE9_SETWIDTH\"))\r\n\t\tsysCommand(pScale9, UI_SCALE9_SETWIDTH, 600)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD UI_SCALE9_SETHEIGHT\"))\r\n\t\tsysCommand(pScale9, UI_SCALE9_SETHEIGHT, 100)\r\n\tend\r\n\r\n  -- syslog(\"\" .. count)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/15.Scale9/Tex.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"c3d748ed-9a81-4643-9b9d-3889279cd3da\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Tex.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-08-31T15:42:28</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>128</Width>\r\n    <Height>128</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Horiz.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Horiz.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/15.Scale9/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Scale9.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/16.Sound/.publish/android/RubberBand.lua",
    "content": "function setup()\r\n\tpRB = nil\r\n\tUI_TouchPad(\"callback_TouchPad\")\r\n\r\n\tbgm = SND_Open(\"asset://bgm\", true)\r\n\tseON = SND_Open(\"asset://se_on\")\r\n\tseOFF = SND_Open(\"asset://se_off\")\r\n\tseDRAG = SND_Open(\"asset://se_drag\")\r\n\ttcount = 0\r\n\tSND_Play(bgm)\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\ttcount = tcount + deltaT\r\nend\r\n\r\n\r\nfunction leave()\r\n\tseDRAG, seOFF, seON = SND_Close(seDRAG, seOFF, seON)\r\n\tbgm = SND_Close(bgm)\r\nend\r\n\r\n\r\nfunction callback_TouchPad(arr)\r\n\r\n\tfor idx,item in ipairs(arr) do\r\n\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\r\n\t\t\tlocal flag = bitOR(RB_ANIM_ENABLE, RB_ANIM_REALTIME)\r\n\t\t\tpRB = UI_RubberBand(nil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\titem.x, item.y,\t\t-- 原点位置\r\n\t\t\t\t\t\t\t\"asset://origin.png.imag\",\t\t-- 原点画像\r\n\t\t\t\t\t\t\t\"asset://joint.png.imag\",\t\t-- 節画像\r\n\t\t\t\t\t\t\t\"asset://point.png.imag\",\t\t-- 先端画像\r\n\t\t\t\t\t\t\t10,\t\t\t\t\t\t\t\t-- 分割数\r\n\t\t\t\t\t\t\tflag,\r\n\t\t\t\t\t\t\t500\r\n\t\t\t\t\t\t\t)\r\n\t\t\tSND_Play(seON)\r\n\r\n\t\telseif item.type == PAD_ITEM_DRAG then\r\n\t\t\tprop = TASK_getProperty(pRB)\r\n\t\t\tprop.pointX = item.x\r\n\t\t\tprop.pointY = item.y\r\n\t\t\tTASK_setProperty(pRB, prop)\r\n\t\t\tif tcount > 200 then\r\n\t\t\t\tSND_Play(seDRAG)\r\n\t\t\t\ttcount = 0\r\n\t\t\tend\r\n\t\telseif item.type == PAD_ITEM_RELEASE then\r\n\t\t\tpRB = TASK_kill(pRB)\r\n\t\t\tSND_Play(seOFF)\r\n\t\tend\r\n\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/16.Sound/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://RubberBand.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/16.Sound/.publish/iphone/RubberBand.lua",
    "content": "function setup()\r\n\tpRB = nil\r\n\tUI_TouchPad(\"callback_TouchPad\")\r\n\r\n\tbgm = SND_Open(\"asset://bgm\", true)\r\n\tseON = SND_Open(\"asset://se_on\")\r\n\tseOFF = SND_Open(\"asset://se_off\")\r\n\tseDRAG = SND_Open(\"asset://se_drag\")\r\n\ttcount = 0\r\n\tSND_Play(bgm)\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\ttcount = tcount + deltaT\r\nend\r\n\r\n\r\nfunction leave()\r\n\tseDRAG, seOFF, seON = SND_Close(seDRAG, seOFF, seON)\r\n\tbgm = SND_Close(bgm)\r\nend\r\n\r\n\r\nfunction callback_TouchPad(arr)\r\n\r\n\tfor idx,item in ipairs(arr) do\r\n\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\r\n\t\t\tlocal flag = bitOR(RB_ANIM_ENABLE, RB_ANIM_REALTIME)\r\n\t\t\tpRB = UI_RubberBand(nil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\titem.x, item.y,\t\t-- 原点位置\r\n\t\t\t\t\t\t\t\"asset://origin.png.imag\",\t\t-- 原点画像\r\n\t\t\t\t\t\t\t\"asset://joint.png.imag\",\t\t-- 節画像\r\n\t\t\t\t\t\t\t\"asset://point.png.imag\",\t\t-- 先端画像\r\n\t\t\t\t\t\t\t10,\t\t\t\t\t\t\t\t-- 分割数\r\n\t\t\t\t\t\t\tflag,\r\n\t\t\t\t\t\t\t500\r\n\t\t\t\t\t\t\t)\r\n\t\t\tSND_Play(seON)\r\n\r\n\t\telseif item.type == PAD_ITEM_DRAG then\r\n\t\t\tprop = TASK_getProperty(pRB)\r\n\t\t\tprop.pointX = item.x\r\n\t\t\tprop.pointY = item.y\r\n\t\t\tTASK_setProperty(pRB, prop)\r\n\t\t\tif tcount > 200 then\r\n\t\t\t\tSND_Play(seDRAG)\r\n\t\t\t\ttcount = 0\r\n\t\t\tend\r\n\t\telseif item.type == PAD_ITEM_RELEASE then\r\n\t\t\tpRB = TASK_kill(pRB)\r\n\t\t\tSND_Play(seOFF)\r\n\t\tend\r\n\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/16.Sound/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://RubberBand.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/16.Sound/RBtex.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"51b8fe7b-c5b5-46dc-aa36-4a0d1793937e\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>RBtex.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-06-29T14:09:51</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>256</Width>\r\n    <Height>64</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>origin.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>origin.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>72</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>point.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>point.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>152</X>\r\n        <Y>16</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>joint.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>joint.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/16.Sound/RubberBand.lua",
    "content": "function setup()\r\n\tpRB = nil\r\n\tUI_TouchPad(\"callback_TouchPad\")\r\n\r\n\tbgm = SND_Open(\"asset://bgm\", true)\r\n\tseON = SND_Open(\"asset://se_on\")\r\n\tseOFF = SND_Open(\"asset://se_off\")\r\n\tseDRAG = SND_Open(\"asset://se_drag\")\r\n\ttcount = 0\r\n\tSND_Play(bgm)\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\ttcount = tcount + deltaT\r\nend\r\n\r\n\r\nfunction leave()\r\n\tseDRAG, seOFF, seON = SND_Close(seDRAG, seOFF, seON)\r\n\tbgm = SND_Close(bgm)\r\nend\r\n\r\n\r\nfunction callback_TouchPad(arr)\r\n\r\n\tfor idx,item in ipairs(arr) do\r\n\r\n\t\tif item.type == PAD_ITEM_TAP then\r\n\r\n\t\t\tlocal flag = bitOR(RB_ANIM_ENABLE, RB_ANIM_REALTIME)\r\n\t\t\tpRB = UI_RubberBand(nil,\r\n\t\t\t\t\t\t\t7000,\r\n\t\t\t\t\t\t\titem.x, item.y,\t\t-- 原点位置\r\n\t\t\t\t\t\t\t\"asset://origin.png.imag\",\t\t-- 原点画像\r\n\t\t\t\t\t\t\t\"asset://joint.png.imag\",\t\t-- 節画像\r\n\t\t\t\t\t\t\t\"asset://point.png.imag\",\t\t-- 先端画像\r\n\t\t\t\t\t\t\t10,\t\t\t\t\t\t\t\t-- 分割数\r\n\t\t\t\t\t\t\tflag,\r\n\t\t\t\t\t\t\t500\r\n\t\t\t\t\t\t\t)\r\n\t\t\tSND_Play(seON)\r\n\r\n\t\telseif item.type == PAD_ITEM_DRAG then\r\n\t\t\tprop = TASK_getProperty(pRB)\r\n\t\t\tprop.pointX = item.x\r\n\t\t\tprop.pointY = item.y\r\n\t\t\tTASK_setProperty(pRB, prop)\r\n\t\t\tif tcount > 200 then\r\n\t\t\t\tSND_Play(seDRAG)\r\n\t\t\t\ttcount = 0\r\n\t\t\tend\r\n\t\telseif item.type == PAD_ITEM_RELEASE then\r\n\t\t\tpRB = TASK_kill(pRB)\r\n\t\t\tSND_Play(seOFF)\r\n\t\tend\r\n\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/16.Sound/joint.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"36c337a2-54f1-4be2-b2c8-e73ef799fc2e\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>joint.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-20T10:52:49</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>516</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:13</ImgFileDate>\r\n    <ImgPathName>joint.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>16</X>\r\n      <Y>16</Y>\r\n    </Center>\r\n    <Width>32</Width>\r\n    <Height>32</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>32</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>32</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>32</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>32</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>BAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/16.Sound/origin.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"933e67bb-00f6-4b08-aba7-b05b3e66fcf1\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>origin.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-20T10:52:49</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>872</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:13</ImgFileDate>\r\n    <ImgPathName>origin.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>32</X>\r\n      <Y>32</Y>\r\n    </Center>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>64</Width>\r\n        <Height>64</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>64</Width>\r\n      <Height>64</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>64</MaskWidth>\r\n    <MaskHeight>64</MaskHeight>\r\n    <Mask>EAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/16.Sound/point.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"76ac47da-74e9-4da2-858a-f9059ceba160\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>point.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-20T10:52:49</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>409</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:13</ImgFileDate>\r\n    <ImgPathName>point.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>63</X>\r\n      <Y>32</Y>\r\n    </Center>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>64</Width>\r\n        <Height>64</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>64</Width>\r\n      <Height>64</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>64</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>64</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>64</MaskWidth>\r\n    <MaskHeight>64</MaskHeight>\r\n    <Mask>EAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/16.Sound/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://RubberBand.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/android/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/android/VDoc.lua",
    "content": "function setup()\r\n\r\n\r\n\t--[[------------------------------\r\n\t\t バーチャルドキュメントタスクの起動\r\n\t\t------------------------------ ]]\r\n\r\n\t--[[ ここでは、タスクを生成した後の操作を行うため、返されるタスクのポインタを pTask_vdoc 変数に格納しています。\r\n\t\tスコアタスクに限らず、生成後スクリプトから操作する必要のあるタスクは、必ず生成関数が返すポインタを変数として保持する必要があります。 ]]\r\n\t\r\n\tpTask_vdoc = UI_VirtualDoc(\tnil,\t\t\t\t-- 親UIタスクのポインタ。親を指定する必要がない場合は nil を指定します。\r\n\t\t\t\t\t\t\t\t70000,\t\t\t\t-- 表示プライオリティ値\r\n\t\t\t\t\t\t\t\t100, 400,\t\t\t-- 表示位置\r\n\t\t\t\t\t\t\t\t200, 1000,\t\t\t-- ドキュメント面積。この面積のうち、一部だけが切り取られて表示されるイメージです。\r\n\t\t\t\t\t\t\t\t200, 100,\t\t\t-- 表示面積。実際に画面上で占有される面積です。\r\n\t\t\t\t\t\t\t\t1000,\t\t\t\t-- 取り扱う描画コマンド上限値。ここで指定された描画コマンド数を上限として、表示アイテムを登録できます。\r\n\t\t\t\t\t\t\t\tfalse,\t\t\t\t-- 縦スクロールの場合は true を指定します。ここでは横スクロールなので false です。\r\n\t\t\t\t\t\t\t\t\"callbackVDOC\"\t\t-- ポインティングデバイスコールバックを指定できます。不要な場合は省略可能です。\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\t--[[ 表示文字のフォントとサイズを指定します。ただし、現時点ではサイズのみが意味を持ち、フォント名はダミーです。]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_FONT, 0, \"Georgia\", 16)\r\n\t\r\n\t--[[ ドキュメントを指定のRGBA値でクリアします。]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_CLEAR, 0x00, 0x000000)\r\n\r\n\t--[[\r\n\t\t描画コマンドをLuaの配列にまとめ、一括して登録します。\r\n\t\t一つの描画コマンドは\r\n\r\n\t\t{ <コマンド値>, <パラメータ>[, ... ] }\r\n\r\n\t\tの配列形式で記述され、この配列を配列としてまとめたものが、\r\n\t\t「描画コマンド配列」となります。\t\r\n\t\t]]\r\n\tvDocDraw = {\r\n\t\t{ VD_DRAW_IMAG, 180, 80, \"asset://inline.png.imag\", 0xff },\r\n\t\t{ VD_DRAW_IMAG, 170, 70, \"asset://inline2.png.imag\", 0x80 },\r\n\r\n\t\t{ VD_DRAW_LINE,   0,  0, 200,  50, 0xff, 0x00ff00 },\r\n\t\t{ VD_DRAW_LINE, 200, 75,   0, 125, 0xff, 0x00ffff },\r\n\r\n\t\t{ VD_DRAW_TEXT, 20, 20, \"日本語Hello A\", 0xff, 0xff0000, 0 },\r\n\t\t{ VD_DRAW_TEXT, 120, 40, \"Hello B\", 0xff, 0x00ff00, 0 },\r\n\t\t{ VD_DRAW_TEXT, 220, 60, \"Hello C\", 0xff, 0x0000ff, 0 },\r\n\t\t{ VD_DRAW_TEXT, 320, 80, \"Hello D\", 0x80, 0xff0000, 0 },\r\n\t\t{ VD_DRAW_TEXT, 420, 100, \"Hello E\", 0x80, 0x00ff00, 0 },\r\n\t\t{ VD_DRAW_TEXT, 520, 120, \"Hello F\", 0x80, 0x0000ff, 0 },\r\n\r\n\t\t{ VD_FILL_RECT, 625, 25, 50, 50, 0xff, 0xff0000, true },\r\n\t\t{ VD_FILL_RECT, 650, 50, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 652, 52, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 654, 54, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 656, 56, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 650, 50, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 600,  0,  0, 50, 0x40, 0x00ff00, true },\r\n\t}\r\n\t\r\n\t--[[\r\n\t\t上で作成した描画コマンド配列を、UI_VDOC_DRAW コマンドのパラメータとしてタスクに与えることで、\r\n\t\t描画コマンドがタスクに登録され、以後表示域に表示されるようになります。\r\n\t\t]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_DRAW, vDocDraw)\r\n\t\r\n\t--[[ VDoc タスクの表示域に表示されるドキュメント中の位置を指定します。初期状態で 0,0の位置を表示域の左上に合わせます。 ]]\r\n\t-- sysCommand(pTask_vdoc, UI_VDOC_VIEWPOS, 0, 0)\r\n\t\r\n\t-- ステージを去るときに破棄できるよう、プログレスバーをステージタスクとして登録しておく。\r\n\tTASK_StageOnly(pTask_vdoc)\r\n\r\n\r\n\t-- 表示位置や独立タッチパッド操作ステータスを保持する変数\r\n\tvd_pos = { x = 0, y = 0 }\r\n\ttp_base = { x = 0, y = 0 }\r\n\ttp_mov = { x = 0, y = 0 }\r\nend\r\n\r\n--[[\r\n\tそのスクリプトが有効な間、システムは毎フレーム1回、必ず　execute(deltaT) を呼び出します。\r\n\t引数の deltaT は、直前のフレーム開始から、今回のフレーム開始までに要した時間をミリ秒[ms]で表したものです。\r\n\t戻り値は必要ありません。\r\n]]\r\nfunction execute(deltaT)\r\n\r\n\t-- このスクリプトでは、スクリプトによる毎フレーム処理を行っていません。\r\n\r\nend\r\n\r\n\r\n--[[\r\n\t他のスクリプトをロードし、このスクリプトを去る直前にシステムから呼ばれます。\r\n\tここでは、スクリプト内で生成し、ステージタスクとして登録された全てのタスクを破棄しています。 \r\n\t引数、戻り値はいずれもありません。\r\n]]\r\nfunction leave()\r\n\tpTask_cell = TASK_kill(pTask_cell)\t-- 明示的な殺し方\r\n\tTASK_StageClear()\r\nend\r\n\r\n\r\n--[[\r\n\tsetup() の中で、タスク起動時に仕掛けたコールバック関数。\r\n\t基本的には、独立してポインティングデバイス入力を取得します。\r\n\t全体の操作とは別の関数として、独立させた記述ができます。\r\n\r\n\t操作対象となるタスクインスタンスが第一引数として与えられ、\r\n\t第二引数にはそのフレームで処理できるポインティングデバイス操作キュー配列が与えられます。\r\n\t]]\r\nfunction callbackVDOC(pTask, ttype, x, y, mv_x, mv_y)\r\n\tsyslog(string.format(\"%d %d %d %d %d\", ttype, x, y, mv_x, mv_y))\r\n\tif ttype == 0 then\r\n\t\ttp_base.x = x\r\n\t\ttp_base.y = y\r\n\t\ttp_mov.x = 0\r\n\t\ttp_mov.y = 0\r\n\telseif ttype == 1 then\r\n\t\ttp_mov.x = mv_x\r\n\t\ttp_mov.y = mv_y\r\n\t\tsysCommand(pTask, UI_VDOC_VIEWPOS, -mv_x, -mv_y)\r\n\telseif ttype == 2 then\r\n\t\ttp_mov.x = mv_x\r\n\t\ttp_mov.y = mv_y\r\n\t\tvd_pos.x = x - mv_x\r\n\t\tvd_pos.y = y - mv_y\r\n\t\tsysCommand(pTask, UI_VDOC_VIEWPOS, vd_pos.x, vd_pos.y)\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/android/VDoc2.lua",
    "content": "function setup()\r\n  sysLoad(\"asset://VDoc.lua\")\r\n  pVDoc =  UI_VirtualDoc( nil, 10000, \r\n                                   0, 0,     -- x,y\r\n                                   400, 400, -- doc size\r\n                                   400, 400, -- view size\r\n                                   1000, -- command最大数\r\n                                   true  -- vertical\r\n                                   )\r\n\r\n  sysCommand(pVDoc, UI_VDOC_ALIGN, VD_ALIGN_CENTER, 200)\r\n  sysCommand(pVDoc, UI_VDOC_FONT,  0, \"Courrier New\", 16)\r\n  sysCommand(pVDoc, UI_VDOC_CLEAR, 0xff, 0x000000)\r\n \r\n  vDocDraw = {\r\n    { VD_DRAW_TEXT, 0, 0, \"aaaaaaaaaa\\nbbbbbbbbbbb\\n\", 0xff, 0xff0000, 0 },\r\n    { VD_DRAW_TEXT, 0, 100, \"cccccccccc\\nddddddddddd\\n\", 0xff, 0xff0000, 0 },\r\n  }\r\n  sysCommand(pVDoc, UI_VDOC_DRAW, vDocDraw)\r\n  sysCommand(pVDoc, UI_VDOC_VIEWPOS, 0, 0)\r\n  \r\n  TASK_StageOnly(pVDoc)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/android/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tGL_SetResolution(960, 640)\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://VDoc.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/iphone/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/iphone/VDoc.lua",
    "content": "function setup()\r\n\r\n\r\n\t--[[------------------------------\r\n\t\t バーチャルドキュメントタスクの起動\r\n\t\t------------------------------ ]]\r\n\r\n\t--[[ ここでは、タスクを生成した後の操作を行うため、返されるタスクのポインタを pTask_vdoc 変数に格納しています。\r\n\t\tスコアタスクに限らず、生成後スクリプトから操作する必要のあるタスクは、必ず生成関数が返すポインタを変数として保持する必要があります。 ]]\r\n\t\r\n\tpTask_vdoc = UI_VirtualDoc(\tnil,\t\t\t\t-- 親UIタスクのポインタ。親を指定する必要がない場合は nil を指定します。\r\n\t\t\t\t\t\t\t\t70000,\t\t\t\t-- 表示プライオリティ値\r\n\t\t\t\t\t\t\t\t100, 400,\t\t\t-- 表示位置\r\n\t\t\t\t\t\t\t\t200, 1000,\t\t\t-- ドキュメント面積。この面積のうち、一部だけが切り取られて表示されるイメージです。\r\n\t\t\t\t\t\t\t\t200, 100,\t\t\t-- 表示面積。実際に画面上で占有される面積です。\r\n\t\t\t\t\t\t\t\t1000,\t\t\t\t-- 取り扱う描画コマンド上限値。ここで指定された描画コマンド数を上限として、表示アイテムを登録できます。\r\n\t\t\t\t\t\t\t\tfalse,\t\t\t\t-- 縦スクロールの場合は true を指定します。ここでは横スクロールなので false です。\r\n\t\t\t\t\t\t\t\t\"callbackVDOC\"\t\t-- ポインティングデバイスコールバックを指定できます。不要な場合は省略可能です。\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\t--[[ 表示文字のフォントとサイズを指定します。ただし、現時点ではサイズのみが意味を持ち、フォント名はダミーです。]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_FONT, 0, \"Georgia\", 16)\r\n\t\r\n\t--[[ ドキュメントを指定のRGBA値でクリアします。]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_CLEAR, 0x00, 0x000000)\r\n\r\n\t--[[\r\n\t\t描画コマンドをLuaの配列にまとめ、一括して登録します。\r\n\t\t一つの描画コマンドは\r\n\r\n\t\t{ <コマンド値>, <パラメータ>[, ... ] }\r\n\r\n\t\tの配列形式で記述され、この配列を配列としてまとめたものが、\r\n\t\t「描画コマンド配列」となります。\t\r\n\t\t]]\r\n\tvDocDraw = {\r\n\t\t{ VD_DRAW_IMAG, 180, 80, \"asset://inline.png.imag\", 0xff },\r\n\t\t{ VD_DRAW_IMAG, 170, 70, \"asset://inline2.png.imag\", 0x80 },\r\n\r\n\t\t{ VD_DRAW_LINE,   0,  0, 200,  50, 0xff, 0x00ff00 },\r\n\t\t{ VD_DRAW_LINE, 200, 75,   0, 125, 0xff, 0x00ffff },\r\n\r\n\t\t{ VD_DRAW_TEXT, 20, 20, \"日本語Hello A\", 0xff, 0xff0000, 0 },\r\n\t\t{ VD_DRAW_TEXT, 120, 40, \"Hello B\", 0xff, 0x00ff00, 0 },\r\n\t\t{ VD_DRAW_TEXT, 220, 60, \"Hello C\", 0xff, 0x0000ff, 0 },\r\n\t\t{ VD_DRAW_TEXT, 320, 80, \"Hello D\", 0x80, 0xff0000, 0 },\r\n\t\t{ VD_DRAW_TEXT, 420, 100, \"Hello E\", 0x80, 0x00ff00, 0 },\r\n\t\t{ VD_DRAW_TEXT, 520, 120, \"Hello F\", 0x80, 0x0000ff, 0 },\r\n\r\n\t\t{ VD_FILL_RECT, 625, 25, 50, 50, 0xff, 0xff0000, true },\r\n\t\t{ VD_FILL_RECT, 650, 50, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 652, 52, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 654, 54, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 656, 56, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 650, 50, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 600,  0,  0, 50, 0x40, 0x00ff00, true },\r\n\t}\r\n\t\r\n\t--[[\r\n\t\t上で作成した描画コマンド配列を、UI_VDOC_DRAW コマンドのパラメータとしてタスクに与えることで、\r\n\t\t描画コマンドがタスクに登録され、以後表示域に表示されるようになります。\r\n\t\t]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_DRAW, vDocDraw)\r\n\t\r\n\t--[[ VDoc タスクの表示域に表示されるドキュメント中の位置を指定します。初期状態で 0,0の位置を表示域の左上に合わせます。 ]]\r\n\t-- sysCommand(pTask_vdoc, UI_VDOC_VIEWPOS, 0, 0)\r\n\t\r\n\t-- ステージを去るときに破棄できるよう、プログレスバーをステージタスクとして登録しておく。\r\n\tTASK_StageOnly(pTask_vdoc)\r\n\r\n\r\n\t-- 表示位置や独立タッチパッド操作ステータスを保持する変数\r\n\tvd_pos = { x = 0, y = 0 }\r\n\ttp_base = { x = 0, y = 0 }\r\n\ttp_mov = { x = 0, y = 0 }\r\nend\r\n\r\n--[[\r\n\tそのスクリプトが有効な間、システムは毎フレーム1回、必ず　execute(deltaT) を呼び出します。\r\n\t引数の deltaT は、直前のフレーム開始から、今回のフレーム開始までに要した時間をミリ秒[ms]で表したものです。\r\n\t戻り値は必要ありません。\r\n]]\r\nfunction execute(deltaT)\r\n\r\n\t-- このスクリプトでは、スクリプトによる毎フレーム処理を行っていません。\r\n\r\nend\r\n\r\n\r\n--[[\r\n\t他のスクリプトをロードし、このスクリプトを去る直前にシステムから呼ばれます。\r\n\tここでは、スクリプト内で生成し、ステージタスクとして登録された全てのタスクを破棄しています。 \r\n\t引数、戻り値はいずれもありません。\r\n]]\r\nfunction leave()\r\n\tpTask_cell = TASK_kill(pTask_cell)\t-- 明示的な殺し方\r\n\tTASK_StageClear()\r\nend\r\n\r\n\r\n--[[\r\n\tsetup() の中で、タスク起動時に仕掛けたコールバック関数。\r\n\t基本的には、独立してポインティングデバイス入力を取得します。\r\n\t全体の操作とは別の関数として、独立させた記述ができます。\r\n\r\n\t操作対象となるタスクインスタンスが第一引数として与えられ、\r\n\t第二引数にはそのフレームで処理できるポインティングデバイス操作キュー配列が与えられます。\r\n\t]]\r\nfunction callbackVDOC(pTask, ttype, x, y, mv_x, mv_y)\r\n\tsyslog(string.format(\"%d %d %d %d %d\", ttype, x, y, mv_x, mv_y))\r\n\tif ttype == 0 then\r\n\t\ttp_base.x = x\r\n\t\ttp_base.y = y\r\n\t\ttp_mov.x = 0\r\n\t\ttp_mov.y = 0\r\n\telseif ttype == 1 then\r\n\t\ttp_mov.x = mv_x\r\n\t\ttp_mov.y = mv_y\r\n\t\tsysCommand(pTask, UI_VDOC_VIEWPOS, -mv_x, -mv_y)\r\n\telseif ttype == 2 then\r\n\t\ttp_mov.x = mv_x\r\n\t\ttp_mov.y = mv_y\r\n\t\tvd_pos.x = x - mv_x\r\n\t\tvd_pos.y = y - mv_y\r\n\t\tsysCommand(pTask, UI_VDOC_VIEWPOS, vd_pos.x, vd_pos.y)\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/iphone/VDoc2.lua",
    "content": "function setup()\r\n  sysLoad(\"asset://VDoc.lua\")\r\n  pVDoc =  UI_VirtualDoc( nil, 10000, \r\n                                   0, 0,     -- x,y\r\n                                   400, 400, -- doc size\r\n                                   400, 400, -- view size\r\n                                   1000, -- command最大数\r\n                                   true  -- vertical\r\n                                   )\r\n\r\n  sysCommand(pVDoc, UI_VDOC_ALIGN, VD_ALIGN_CENTER, 200)\r\n  sysCommand(pVDoc, UI_VDOC_FONT,  0, \"Courrier New\", 16)\r\n  sysCommand(pVDoc, UI_VDOC_CLEAR, 0xff, 0x000000)\r\n \r\n  vDocDraw = {\r\n    { VD_DRAW_TEXT, 0, 0, \"aaaaaaaaaa\\nbbbbbbbbbbb\\n\", 0xff, 0xff0000, 0 },\r\n    { VD_DRAW_TEXT, 0, 100, \"cccccccccc\\nddddddddddd\\n\", 0xff, 0xff0000, 0 },\r\n  }\r\n  sysCommand(pVDoc, UI_VDOC_DRAW, vDocDraw)\r\n  sysCommand(pVDoc, UI_VDOC_VIEWPOS, 0, 0)\r\n  \r\n  TASK_StageOnly(pVDoc)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/.publish/iphone/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tGL_SetResolution(960, 640)\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://VDoc.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/17.VDoc/VDoc.lua",
    "content": "function setup()\r\n\r\n\r\n\t--[[------------------------------\r\n\t\t バーチャルドキュメントタスクの起動\r\n\t\t------------------------------ ]]\r\n\r\n\t--[[ ここでは、タスクを生成した後の操作を行うため、返されるタスクのポインタを pTask_vdoc 変数に格納しています。\r\n\t\tスコアタスクに限らず、生成後スクリプトから操作する必要のあるタスクは、必ず生成関数が返すポインタを変数として保持する必要があります。 ]]\r\n\t\r\n\tpTask_vdoc = UI_VirtualDoc(\tnil,\t\t\t\t-- 親UIタスクのポインタ。親を指定する必要がない場合は nil を指定します。\r\n\t\t\t\t\t\t\t\t70000,\t\t\t\t-- 表示プライオリティ値\r\n\t\t\t\t\t\t\t\t100, 400,\t\t\t-- 表示位置\r\n\t\t\t\t\t\t\t\t200, 1000,\t\t\t-- ドキュメント面積。この面積のうち、一部だけが切り取られて表示されるイメージです。\r\n\t\t\t\t\t\t\t\t200, 100,\t\t\t-- 表示面積。実際に画面上で占有される面積です。\r\n\t\t\t\t\t\t\t\t1000,\t\t\t\t-- 取り扱う描画コマンド上限値。ここで指定された描画コマンド数を上限として、表示アイテムを登録できます。\r\n\t\t\t\t\t\t\t\tfalse,\t\t\t\t-- 縦スクロールの場合は true を指定します。ここでは横スクロールなので false です。\r\n\t\t\t\t\t\t\t\t\"callbackVDOC\"\t\t-- ポインティングデバイスコールバックを指定できます。不要な場合は省略可能です。\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\t--[[ 表示文字のフォントとサイズを指定します。ただし、現時点ではサイズのみが意味を持ち、フォント名はダミーです。]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_FONT, 0, \"Georgia\", 16)\r\n\t\r\n\t--[[ ドキュメントを指定のRGBA値でクリアします。]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_CLEAR, 0x00, 0x000000)\r\n\r\n\t--[[\r\n\t\t描画コマンドをLuaの配列にまとめ、一括して登録します。\r\n\t\t一つの描画コマンドは\r\n\r\n\t\t{ <コマンド値>, <パラメータ>[, ... ] }\r\n\r\n\t\tの配列形式で記述され、この配列を配列としてまとめたものが、\r\n\t\t「描画コマンド配列」となります。\t\r\n\t\t]]\r\n\tvDocDraw = {\r\n\t\t{ VD_DRAW_IMAG, 180, 80, \"asset://inline.png.imag\", 0xff },\r\n\t\t{ VD_DRAW_IMAG, 170, 70, \"asset://inline2.png.imag\", 0x80 },\r\n\r\n\t\t{ VD_DRAW_LINE,   0,  0, 200,  50, 0xff, 0x00ff00 },\r\n\t\t{ VD_DRAW_LINE, 200, 75,   0, 125, 0xff, 0x00ffff },\r\n\r\n\t\t{ VD_DRAW_TEXT, 20, 20, \"日本語Hello A\", 0xff, 0xff0000, 0 },\r\n\t\t{ VD_DRAW_TEXT, 120, 40, \"Hello B\", 0xff, 0x00ff00, 0 },\r\n\t\t{ VD_DRAW_TEXT, 220, 60, \"Hello C\", 0xff, 0x0000ff, 0 },\r\n\t\t{ VD_DRAW_TEXT, 320, 80, \"Hello D\", 0x80, 0xff0000, 0 },\r\n\t\t{ VD_DRAW_TEXT, 420, 100, \"Hello E\", 0x80, 0x00ff00, 0 },\r\n\t\t{ VD_DRAW_TEXT, 520, 120, \"Hello F\", 0x80, 0x0000ff, 0 },\r\n\r\n\t\t{ VD_FILL_RECT, 625, 25, 50, 50, 0xff, 0xff0000, true },\r\n\t\t{ VD_FILL_RECT, 650, 50, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 652, 52, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 654, 54, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 656, 56, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 650, 50, 50, 50, 0x40, 0x00ff00, true },\r\n\t\t{ VD_FILL_RECT, 600,  0,  0, 50, 0x40, 0x00ff00, true },\r\n\t}\r\n\t\r\n\t--[[\r\n\t\t上で作成した描画コマンド配列を、UI_VDOC_DRAW コマンドのパラメータとしてタスクに与えることで、\r\n\t\t描画コマンドがタスクに登録され、以後表示域に表示されるようになります。\r\n\t\t]]\r\n\tsysCommand(pTask_vdoc, UI_VDOC_DRAW, vDocDraw)\r\n\t\r\n\t--[[ VDoc タスクの表示域に表示されるドキュメント中の位置を指定します。初期状態で 0,0の位置を表示域の左上に合わせます。 ]]\r\n\t-- sysCommand(pTask_vdoc, UI_VDOC_VIEWPOS, 0, 0)\r\n\t\r\n\t-- ステージを去るときに破棄できるよう、プログレスバーをステージタスクとして登録しておく。\r\n\tTASK_StageOnly(pTask_vdoc)\r\n\r\n\r\n\t-- 表示位置や独立タッチパッド操作ステータスを保持する変数\r\n\tvd_pos = { x = 0, y = 0 }\r\n\ttp_base = { x = 0, y = 0 }\r\n\ttp_mov = { x = 0, y = 0 }\r\nend\r\n\r\n--[[\r\n\tそのスクリプトが有効な間、システムは毎フレーム1回、必ず　execute(deltaT) を呼び出します。\r\n\t引数の deltaT は、直前のフレーム開始から、今回のフレーム開始までに要した時間をミリ秒[ms]で表したものです。\r\n\t戻り値は必要ありません。\r\n]]\r\nfunction execute(deltaT)\r\n\r\n\t-- このスクリプトでは、スクリプトによる毎フレーム処理を行っていません。\r\n\r\nend\r\n\r\n\r\n--[[\r\n\t他のスクリプトをロードし、このスクリプトを去る直前にシステムから呼ばれます。\r\n\tここでは、スクリプト内で生成し、ステージタスクとして登録された全てのタスクを破棄しています。 \r\n\t引数、戻り値はいずれもありません。\r\n]]\r\nfunction leave()\r\n\tpTask_cell = TASK_kill(pTask_cell)\t-- 明示的な殺し方\r\n\tTASK_StageClear()\r\nend\r\n\r\n\r\n--[[\r\n\tsetup() の中で、タスク起動時に仕掛けたコールバック関数。\r\n\t基本的には、独立してポインティングデバイス入力を取得します。\r\n\t全体の操作とは別の関数として、独立させた記述ができます。\r\n\r\n\t操作対象となるタスクインスタンスが第一引数として与えられ、\r\n\t第二引数にはそのフレームで処理できるポインティングデバイス操作キュー配列が与えられます。\r\n\t]]\r\nfunction callbackVDOC(pTask, ttype, x, y, mv_x, mv_y)\r\n\tsyslog(string.format(\"%d %d %d %d %d\", ttype, x, y, mv_x, mv_y))\r\n\tif ttype == 0 then\r\n\t\ttp_base.x = x\r\n\t\ttp_base.y = y\r\n\t\ttp_mov.x = 0\r\n\t\ttp_mov.y = 0\r\n\telseif ttype == 1 then\r\n\t\ttp_mov.x = mv_x\r\n\t\ttp_mov.y = mv_y\r\n\t\tsysCommand(pTask, UI_VDOC_VIEWPOS, -mv_x, -mv_y)\r\n\telseif ttype == 2 then\r\n\t\ttp_mov.x = mv_x\r\n\t\ttp_mov.y = mv_y\r\n\t\tvd_pos.x = x - mv_x\r\n\t\tvd_pos.y = y - mv_y\r\n\t\tsysCommand(pTask, UI_VDOC_VIEWPOS, vd_pos.x, vd_pos.y)\r\n\tend\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/VDoc2.lua",
    "content": "function setup()\r\n  sysLoad(\"asset://VDoc.lua\")\r\n  pVDoc =  UI_VirtualDoc( nil, 10000, \r\n                                   0, 0,     -- x,y\r\n                                   400, 400, -- doc size\r\n                                   400, 400, -- view size\r\n                                   1000, -- command最大数\r\n                                   true  -- vertical\r\n                                   )\r\n\r\n  sysCommand(pVDoc, UI_VDOC_ALIGN, VD_ALIGN_CENTER, 200)\r\n  sysCommand(pVDoc, UI_VDOC_FONT,  0, \"Courrier New\", 16)\r\n  sysCommand(pVDoc, UI_VDOC_CLEAR, 0xff, 0x000000)\r\n \r\n  vDocDraw = {\r\n    { VD_DRAW_TEXT, 0, 0, \"aaaaaaaaaa\\nbbbbbbbbbbb\\n\", 0xff, 0xff0000, 0 },\r\n    { VD_DRAW_TEXT, 0, 100, \"cccccccccc\\nddddddddddd\\n\", 0xff, 0xff0000, 0 },\r\n  }\r\n  sysCommand(pVDoc, UI_VDOC_DRAW, vDocDraw)\r\n  sysCommand(pVDoc, UI_VDOC_VIEWPOS, 0, 0)\r\n  \r\n  TASK_StageOnly(pVDoc)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/inline.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"0f3c03a9-d7f3-4450-9976-dd82386e03c7\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>inline.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T12:43:16</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>11169</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:31:48</ImgFileDate>\r\n    <ImgPathName>inline.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>92</Width>\r\n    <Height>94</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>92</Width>\r\n        <Height>94</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>92</Width>\r\n      <Height>94</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>92</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>92</X>\r\n        <Y>94</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>94</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>92</MaskWidth>\r\n    <MaskHeight>94</MaskHeight>\r\n    <Mask>IcgB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/17.VDoc/inline2.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"7af1bcff-c88a-4cab-ba9f-f2773d7c8f50\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>inline2.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T12:43:16</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>11081</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:32:18</ImgFileDate>\r\n    <ImgPathName>inline2.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>92</Width>\r\n    <Height>94</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>92</Width>\r\n        <Height>94</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>92</Width>\r\n      <Height>94</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>92</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>92</X>\r\n        <Y>94</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>94</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>92</MaskWidth>\r\n    <MaskHeight>94</MaskHeight>\r\n    <Mask>IcgB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/17.VDoc/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tGL_SetResolution(960, 640)\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://VDoc.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/17.VDoc/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"a6487267-cf9d-4d42-a2c3-458a80c67e9a\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-05-17T16:23:24</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>128</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA5551</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Id>0</Id>\r\n      <Name>inline2.png</Name>\r\n      <Pos>\r\n        <X>16</X>\r\n        <Y>128</Y>\r\n      </Pos>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>true</IsSwitchXY>\r\n      <ImgPathName>inline2.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Id>0</Id>\r\n      <Name>inline.png</Name>\r\n      <Pos>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </Pos>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>inline.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/18.DebugItem/.publish/android/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/18.DebugItem/.publish/android/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tpDbgLabel = UI_DbgLabel(\r\n\t\t\t\t\t\t\tnil,\t\t\t\t--<parent pointer>, \r\n\t\t\t\t\t\t\t7000,\t\t\t\t--<order>, \r\n\t\t\t\t\t\t\t100,100,\t\t\t--<x>, <y>,\r\n                            0xFF, 0xFF0000,\t\t--<alpha>, <rgb>, \r\n\t\t\t\t\t\t\t\"Georgia\", 16,\t\t--\"<font name>\", <font size>, \r\n\t\t\t\t\t\t\t\"Debug Label\",\t\t--\"<text string>\",\r\n\t\t\t\t\t\t\t1,\t\t\t\t\t--<cmdID>, \r\n\t\t\t\t\t\t\t\"callback\"\t\t\t--\"<callback>\")\r\n\t\t\t\t\t\t\t)\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"font\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.font = \"fixed\"\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"size\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.size = 32\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"alpha\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.alpha = 0x40\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"color\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.color = 0x0000FF\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"text\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.text = \"I've changed.\"\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n\r\nfunction callback(pTask, cmdID)\r\n\tsyslog(\"CALLBACK\"..cmdID)\r\nend\r\n"
  },
  {
    "path": "Tutorial/18.DebugItem/.publish/iphone/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/18.DebugItem/.publish/iphone/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tpDbgLabel = UI_DbgLabel(\r\n\t\t\t\t\t\t\tnil,\t\t\t\t--<parent pointer>, \r\n\t\t\t\t\t\t\t7000,\t\t\t\t--<order>, \r\n\t\t\t\t\t\t\t100,100,\t\t\t--<x>, <y>,\r\n                            0xFF, 0xFF0000,\t\t--<alpha>, <rgb>, \r\n\t\t\t\t\t\t\t\"Georgia\", 16,\t\t--\"<font name>\", <font size>, \r\n\t\t\t\t\t\t\t\"Debug Label\",\t\t--\"<text string>\",\r\n\t\t\t\t\t\t\t1,\t\t\t\t\t--<cmdID>, \r\n\t\t\t\t\t\t\t\"callback\"\t\t\t--\"<callback>\")\r\n\t\t\t\t\t\t\t)\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"font\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.font = \"fixed\"\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"size\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.size = 32\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"alpha\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.alpha = 0x40\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"color\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.color = 0x0000FF\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"text\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.text = \"I've changed.\"\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n\r\nfunction callback(pTask, cmdID)\r\n\tsyslog(\"CALLBACK\"..cmdID)\r\nend\r\n"
  },
  {
    "path": "Tutorial/18.DebugItem/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/18.DebugItem/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\n\tpDbgLabel = UI_DbgLabel(\r\n\t\t\t\t\t\t\tnil,\t\t\t\t--<parent pointer>, \r\n\t\t\t\t\t\t\t7000,\t\t\t\t--<order>, \r\n\t\t\t\t\t\t\t100,100,\t\t\t--<x>, <y>,\r\n                            0xFF, 0xFF0000,\t\t--<alpha>, <rgb>, \r\n\t\t\t\t\t\t\t\"Georgia\", 16,\t\t--\"<font name>\", <font size>, \r\n\t\t\t\t\t\t\t\"Debug Label\",\t\t--\"<text string>\",\r\n\t\t\t\t\t\t\t1,\t\t\t\t\t--<cmdID>, \r\n\t\t\t\t\t\t\t\"callback\"\t\t\t--\"<callback>\")\r\n\t\t\t\t\t\t\t)\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.visible = true\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pDbgLabel, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"font\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.font = \"fixed\"\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"size\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.size = 32\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"alpha\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.alpha = 0x40\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"color\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.color = 0x0000FF\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"text\"))\r\n\t\tprop = TASK_getProperty(pDbgLabel)\r\n\t\tprop.text = \"I've changed.\"\r\n\t\tTASK_setProperty(pDbgLabel, prop)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\n\r\nend\r\n\r\nfunction callback(pTask, cmdID)\r\n\tsyslog(\"CALLBACK\"..cmdID)\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/.publish/android/GenericTask.lua",
    "content": "include(\"asset://genChar2.lua\")\r\n\r\nfunction setup()\r\n\tinitChar2(\"task4\", 100, -100, \"asset://itemimage.png.imag\")\r\n\tinitChar2(\"task5\", 300,    0, \"asset://itemimage.png.imag\")\r\n\tinitChar2(\"task6\", 500,  100, \"asset://itemimage.png.imag\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/.publish/android/genChar2.lua",
    "content": "--[[\r\n\tTASK_GenericgpLuaŃ^XNLq\r\n]]\r\n\r\ntblCHAR2 = {}\r\n\r\nfunction initChar2(key, x, y, asset)\r\n\tlocal tbl = {}\r\n\r\n\tpGenTask = TASK_Generic(\"execute_char2\", \"die_char2\", key)\r\n\r\n\ttbl.x = x\r\n\ttbl.y = y\r\n\ttbl.asset = asset\r\n\t-- CAN PASS pGenTask as parent, but pGenTask has not graphic node : nodes are attached to ROOT.\r\n\ttbl.image = UI_SimpleItem(pGenTask, 6000, x, y, asset)\r\n\r\n\ttblCHAR2[key] = tbl\r\nend\r\n\r\nfunction execute_char2(pTask, deltaT, key)\r\n\tprop = TASK_getProperty(tblCHAR2[key].image)\r\n\tprop.y = prop.y + 1\t\t-- Char1 ƈႤ̂́Ay삾ƂƁB\r\n\tTASK_setProperty(tblCHAR2[key].image, prop)\r\n\tif prop.y > 768 then\r\n\t\t-- Kill generic task in this sample\r\n\t\tTASK_kill(pTask)\r\n\t\t\r\n\t\t-- If we did not pass pGenTask as parent,\r\n\t\t-- we need to kill here, can NOT do it in die_char2.\r\n\t\t-- => Need to kill in execute.\r\n\t\t-- TASK_kill(tblCHAR2[key].image)\r\n\tend\r\nend\r\n\r\nfunction die_char2(pTask, key)\r\n\t-- NEVER kill in DIE : forbidden by engine, you will get an assert.\r\n\t-- TASK_kill(tblCHAR2[key].image)\r\n\ttblCHAR2[key] = nil\r\n\tsyslog(string.format(\"kill char2[%s]\", key))\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://GenericTask.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/.publish/iphone/GenericTask.lua",
    "content": "include(\"asset://genChar2.lua\")\r\n\r\nfunction setup()\r\n\tinitChar2(\"task4\", 100, -100, \"asset://itemimage.png.imag\")\r\n\tinitChar2(\"task5\", 300,    0, \"asset://itemimage.png.imag\")\r\n\tinitChar2(\"task6\", 500,  100, \"asset://itemimage.png.imag\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/.publish/iphone/genChar2.lua",
    "content": "--[[\r\n\tTASK_GenericgpLuaŃ^XNLq\r\n]]\r\n\r\ntblCHAR2 = {}\r\n\r\nfunction initChar2(key, x, y, asset)\r\n\tlocal tbl = {}\r\n\r\n\tpGenTask = TASK_Generic(\"execute_char2\", \"die_char2\", key)\r\n\r\n\ttbl.x = x\r\n\ttbl.y = y\r\n\ttbl.asset = asset\r\n\t-- CAN PASS pGenTask as parent, but pGenTask has not graphic node : nodes are attached to ROOT.\r\n\ttbl.image = UI_SimpleItem(pGenTask, 6000, x, y, asset)\r\n\r\n\ttblCHAR2[key] = tbl\r\nend\r\n\r\nfunction execute_char2(pTask, deltaT, key)\r\n\tprop = TASK_getProperty(tblCHAR2[key].image)\r\n\tprop.y = prop.y + 1\t\t-- Char1 ƈႤ̂́Ay삾ƂƁB\r\n\tTASK_setProperty(tblCHAR2[key].image, prop)\r\n\tif prop.y > 768 then\r\n\t\t-- Kill generic task in this sample\r\n\t\tTASK_kill(pTask)\r\n\t\t\r\n\t\t-- If we did not pass pGenTask as parent,\r\n\t\t-- we need to kill here, can NOT do it in die_char2.\r\n\t\t-- => Need to kill in execute.\r\n\t\t-- TASK_kill(tblCHAR2[key].image)\r\n\tend\r\nend\r\n\r\nfunction die_char2(pTask, key)\r\n\t-- NEVER kill in DIE : forbidden by engine, you will get an assert.\r\n\t-- TASK_kill(tblCHAR2[key].image)\r\n\ttblCHAR2[key] = nil\r\n\tsyslog(string.format(\"kill char2[%s]\", key))\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://GenericTask.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/GenericTask.lua",
    "content": "include(\"asset://genChar2.lua\")\r\n\r\nfunction setup()\r\n\tinitChar2(\"task4\", 100, -100, \"asset://itemimage.png.imag\")\r\n\tinitChar2(\"task5\", 300,    0, \"asset://itemimage.png.imag\")\r\n\tinitChar2(\"task6\", 500,  100, \"asset://itemimage.png.imag\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/genChar2.lua",
    "content": "--[[\r\n\tTASK_GenericgpLuaŃ^XNLq\r\n]]\r\n\r\ntblCHAR2 = {}\r\n\r\nfunction initChar2(key, x, y, asset)\r\n\tlocal tbl = {}\r\n\r\n\tpGenTask = TASK_Generic(\"execute_char2\", \"die_char2\", key)\r\n\r\n\ttbl.x = x\r\n\ttbl.y = y\r\n\ttbl.asset = asset\r\n\t-- CAN PASS pGenTask as parent, but pGenTask has not graphic node : nodes are attached to ROOT.\r\n\ttbl.image = UI_SimpleItem(pGenTask, 6000, x, y, asset)\r\n\r\n\ttblCHAR2[key] = tbl\r\nend\r\n\r\nfunction execute_char2(pTask, deltaT, key)\r\n\tprop = TASK_getProperty(tblCHAR2[key].image)\r\n\tprop.y = prop.y + 1\t\t-- Char1 ƈႤ̂́Ay삾ƂƁB\r\n\tTASK_setProperty(tblCHAR2[key].image, prop)\r\n\tif prop.y > 768 then\r\n\t\t-- Kill generic task in this sample\r\n\t\tTASK_kill(pTask)\r\n\t\t\r\n\t\t-- If we did not pass pGenTask as parent,\r\n\t\t-- we need to kill here, can NOT do it in die_char2.\r\n\t\t-- => Need to kill in execute.\r\n\t\t-- TASK_kill(tblCHAR2[key].image)\r\n\tend\r\nend\r\n\r\nfunction die_char2(pTask, key)\r\n\t-- NEVER kill in DIE : forbidden by engine, you will get an assert.\r\n\t-- TASK_kill(tblCHAR2[key].image)\r\n\ttblCHAR2[key] = nil\r\n\tsyslog(string.format(\"kill char2[%s]\", key))\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/itemimage.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"b02d88d0-ec6b-4ebb-96f0-24ba34c10c5c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>itemimage.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:23:48</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>50917</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:15:42</ImgFileDate>\r\n    <ImgPathName>itemimage.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>273</Width>\r\n    <Height>185</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>273</Width>\r\n        <Height>185</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>273</Width>\r\n      <Height>185</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>273</MaskWidth>\r\n    <MaskHeight>185</MaskHeight>\r\n    <Mask>xUkB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/19.GenericTask/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://GenericTask.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/19.GenericTask/testtex.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"17aff6f0-1d32-413a-b0aa-3e2d1f3d9ed5\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>testtex.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-05-25T19:31:34</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>512</Height>\r\n    <PixelFormat>RGB565</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>itemimage.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>itemimage.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/20.LifeCtrl/.publish/android/LifeCtrl.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpSimpleItem = UI_SimpleItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[5]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\t時限化するタスクを起動します。\r\n\t\tここではUI_SimpleItem を用いていますが、他の種類のタスクでも構いません。\r\n\t]]\r\n\r\n\tpLifeCTRL = LIFECtrl(LIFECTRL_TIME, 2000)\r\n\t--[[\r\n\t\tLIFECTRL_TIME を第一引数に指定した場合、第二引数はミリ秒単位指定となり、\r\n\t\t実時間経過後に自殺するようになります。\r\n\r\n\t\tLIFECTRL_FRAME を指定すると、第二引数がフレーム数の意味となり、\r\n\t\t実時間を問わず指定フレーム数経過後に自殺します。\r\n\t]]\r\n\r\n\tsysCommand(pLifeCTRL, LIFECTRL_ADD_CHILD, pSimpleItem)\r\n\t--[[\r\n\t\tLIFECTRL_ADD_CHILD コマンドで、LIFECtrl の子タスクとして\r\n\t\t登録するタスクのポインタを指定します。\r\n\r\n\t\tこの時点で両者は親子タスクとなるため、親タスクである LIFECtrl の破棄と\r\n\t\t同時に破棄対象となります。\r\n\t]]\r\n\t\r\n\tpLifeCtrl = nil\r\n\tpSimpleItem = nil\r\n\t--[[\r\n\t\t自動破棄の対象となったタスクのポインタは、\r\n\t\t解放済みアクセスを防ぐためnilを代入しておくことをお勧めします。\r\n\t]]\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/20.LifeCtrl/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://LifeCtrl.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/20.LifeCtrl/.publish/iphone/LifeCtrl.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpSimpleItem = UI_SimpleItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[5]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\t時限化するタスクを起動します。\r\n\t\tここではUI_SimpleItem を用いていますが、他の種類のタスクでも構いません。\r\n\t]]\r\n\r\n\tpLifeCTRL = LIFECtrl(LIFECTRL_TIME, 2000)\r\n\t--[[\r\n\t\tLIFECTRL_TIME を第一引数に指定した場合、第二引数はミリ秒単位指定となり、\r\n\t\t実時間経過後に自殺するようになります。\r\n\r\n\t\tLIFECTRL_FRAME を指定すると、第二引数がフレーム数の意味となり、\r\n\t\t実時間を問わず指定フレーム数経過後に自殺します。\r\n\t]]\r\n\r\n\tsysCommand(pLifeCTRL, LIFECTRL_ADD_CHILD, pSimpleItem)\r\n\t--[[\r\n\t\tLIFECTRL_ADD_CHILD コマンドで、LIFECtrl の子タスクとして\r\n\t\t登録するタスクのポインタを指定します。\r\n\r\n\t\tこの時点で両者は親子タスクとなるため、親タスクである LIFECtrl の破棄と\r\n\t\t同時に破棄対象となります。\r\n\t]]\r\n\t\r\n\tpLifeCtrl = nil\r\n\tpSimpleItem = nil\r\n\t--[[\r\n\t\t自動破棄の対象となったタスクのポインタは、\r\n\t\t解放済みアクセスを防ぐためnilを代入しておくことをお勧めします。\r\n\t]]\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/20.LifeCtrl/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://LifeCtrl.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/20.LifeCtrl/LifeCtrl.lua",
    "content": "function setup()\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpSimpleItem = UI_SimpleItem(\tnil,\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\"asset://itemimage.png.imag\"\t-- arg[5]:\t\t表示assetのパス\r\n\t\t\t\t\t\t\t\t)\r\n\t--[[\r\n\t\t時限化するタスクを起動します。\r\n\t\tここではUI_SimpleItem を用いていますが、他の種類のタスクでも構いません。\r\n\t]]\r\n\r\n\tpLifeCTRL = LIFECtrl(LIFECTRL_TIME, 2000)\r\n\t--[[\r\n\t\tLIFECTRL_TIME を第一引数に指定した場合、第二引数はミリ秒単位指定となり、\r\n\t\t実時間経過後に自殺するようになります。\r\n\r\n\t\tLIFECTRL_FRAME を指定すると、第二引数がフレーム数の意味となり、\r\n\t\t実時間を問わず指定フレーム数経過後に自殺します。\r\n\t]]\r\n\r\n\tsysCommand(pLifeCTRL, LIFECTRL_ADD_CHILD, pSimpleItem)\r\n\t--[[\r\n\t\tLIFECTRL_ADD_CHILD コマンドで、LIFECtrl の子タスクとして\r\n\t\t登録するタスクのポインタを指定します。\r\n\r\n\t\tこの時点で両者は親子タスクとなるため、親タスクである LIFECtrl の破棄と\r\n\t\t同時に破棄対象となります。\r\n\t]]\r\n\t\r\n\tpLifeCtrl = nil\r\n\tpSimpleItem = nil\r\n\t--[[\r\n\t\t自動破棄の対象となったタスクのポインタは、\r\n\t\t解放済みアクセスを防ぐためnilを代入しておくことをお勧めします。\r\n\t]]\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/20.LifeCtrl/itemimage.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"d34f5343-974f-4f08-be1f-e47059b94531\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>itemimage.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:26:09</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>50917</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:15:42</ImgFileDate>\r\n    <ImgPathName>itemimage.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>273</Width>\r\n    <Height>185</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>273</Width>\r\n        <Height>185</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>273</Width>\r\n      <Height>185</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>273</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>185</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>273</MaskWidth>\r\n    <MaskHeight>185</MaskHeight>\r\n    <Mask>xUkB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/20.LifeCtrl/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://LifeCtrl.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/20.LifeCtrl/textureBoat.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"d33e3dcb-d881-4ecc-89e5-6d21c718548d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>textureBoat.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-05T20:08:04</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>8</X>\r\n        <Y>8</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>itemimage.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>itemimage.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/.publish/android/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/android/Form.lua",
    "content": "function setup()\r\n\tlocal x = 0\r\n\tlocal y = 0\r\n\tlocal pForm = UI_Form(nil,\t-- arg[1]:\t親となるUIタスクのポインタ\r\n\t\t7000,\t\t-- arg[2]:\t基準表示プライオリティ\r\n\t\tx, y,\t\t-- arg[3,4]:\t表示位置\r\n\t\t\"asset://form.json\",\t-- arg[5]:\tcomposit jsonのパス\r\n\t\tfalse\t\t-- arg[6]:\t排他フラグ\r\n\t)\r\n\t--[[\r\n\t\targ[6]:排他フラグ は、省略可能です。\r\n\t\t省略した場合は false と同じ挙動になります。\r\n\t]]\r\n\t\r\n\tTASK_StageOnly(pForm)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\n\r\nfunction onBattle()\r\n\tsyslog('----- Form.onBattle() -----')\r\n\tsysLoad(\"asset://form1.lua\")\r\nend\r\n\r\nfunction onClose()\r\n\tsyslog('----- Form.onClose() -----')\r\n\tsysExit()\r\n--\tsysLoad(\"asset://form2.lua\")\r\nend\r\n\r\nfunction onContinue()\r\n\tsyslog('----- Form.onContinue() -----')\r\nend\r\n\r\nfunction chkCard0001_click()\r\n\tsyslog('----- Form.chkCard0001_click() -----')\r\nend\r\n\r\nfunction chkCard0002_click()\r\n\tsyslog('----- Form.chkCard0002_click() -----')\r\nend\r\n\r\nfunction chkCard0003_click()\r\n\tsyslog('----- Form.chkCard0003_click() -----')\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/android/form.json",
    "content": "{\n\t\"name\":\"form\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"default\":\"assets/bg_00.png.imag\",\n\t\"sub\":[{\n\t\t\"name\":\"node_container\",\n\t\t\"x\":19,\n\t\t\"y\":0,\n\t\t\"priority\":1,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\t\"x\":40,\n\t\t\t\"y\":82,\n\t\t\t\"priority\":2,\n\t\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"AVATER0002.png.imag\",\n\t\t\t\"x\":40,\n\t\t\t\"y\":247,\n\t\t\t\"priority\":3,\n\t\t\t\"default\":\"assets/AVATER0002.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"AVATER0003.png.imag\",\n\t\t\t\"x\":40,\n\t\t\t\"y\":412,\n\t\t\t\"priority\":4,\n\t\t\t\"default\":\"assets/AVATER0003.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"node_container\",\n\t\t\t\"x\":56,\n\t\t\t\"y\":56,\n\t\t\t\"priority\":5,\n\t\t\t\"class\":\"container\",\n\t\t\t\"sub\":[{\n\t\t\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\t\t\"x\":40,\n\t\t\t\t\"y\":82,\n\t\t\t\t\"priority\":6,\n\t\t\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\t\t\"xscale\":1,\n\t\t\t\t\"yscale\":1,\n\t\t\t\t\"rotation\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\":\"AVATER0002.png.imag\",\n\t\t\t\t\"x\":40,\n\t\t\t\t\"y\":247,\n\t\t\t\t\"priority\":7,\n\t\t\t\t\"default\":\"assets/AVATER0002.png.imag\",\n\t\t\t\t\"xscale\":1,\n\t\t\t\t\"yscale\":1,\n\t\t\t\t\"rotation\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\":\"AVATER0003.png.imag\",\n\t\t\t\t\"x\":40,\n\t\t\t\t\"y\":412,\n\t\t\t\t\"priority\":8,\n\t\t\t\t\"default\":\"assets/AVATER0003.png.imag\",\n\t\t\t\t\"xscale\":1,\n\t\t\t\t\"yscale\":1,\n\t\t\t\t\"rotation\":0\n\t\t\t}],\n\t\t\t\"clipx\":0,\n\t\t\t\"clipy\":0,\n\t\t\t\"cliph\":0,\n\t\t\t\"clipw\":0,\n\t\t\t\"clipstart\":0,\n\t\t\t\"clipend\":0,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lblNode\",\n\t\t\t\"x\":-22,\n\t\t\t\"y\":-3,\n\t\t\t\"priority\":9,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: node\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"button_container\",\n\t\t\"x\":703,\n\t\t\"y\":10,\n\t\t\"priority\":10,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"BTN_Battle_off.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":11,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":256,\n\t\t\t\"sh\":128,\n\t\t\t\"class\":\"button\",\n\t\t\t\"onclick\":\"onBattle\",\n\t\t\t\"default\":\"assets/BTN_Battle_off.png.imag\",\n\t\t\t\"select\":\"assets/BTN_Battle_on.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"BTN_Close_off.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":128,\n\t\t\t\"priority\":12,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":256,\n\t\t\t\"sh\":128,\n\t\t\t\"class\":\"button\",\n\t\t\t\"onclick\":\"onClose\",\n\t\t\t\"default\":\"assets/BTN_Close_off.png.imag\",\n\t\t\t\"select\":\"assets/BTN_Close_on.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"BTN_Continue_off.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":256,\n\t\t\t\"priority\":13,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":256,\n\t\t\t\"sh\":128,\n\t\t\t\"class\":\"button\",\n\t\t\t\"onclick\":\"onContinue\",\n\t\t\t\"default\":\"assets/BTN_Continue_off.png.imag\",\n\t\t\t\"select\":\"assets/BTN_Continue_on.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lblButton\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":-16,\n\t\t\t\"priority\":14,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: button\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"checkbox_container\",\n\t\t\"x\":128,\n\t\t\"y\":400,\n\t\t\"priority\":15,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"CARD0001.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":16,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":240,\n\t\t\t\"sh\":330,\n\t\t\t\"radio\":1,\n\t\t\t\"class\":\"checkbox\",\n\t\t\t\"onclick\":\"chkCard0001_click\",\n\t\t\t\"default\":\"assets/CARD0001.png.imag\",\n\t\t\t\"select\":\"assets/CARD0007.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"CARD0002.png.imag\",\n\t\t\t\"x\":240,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":17,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":240,\n\t\t\t\"sh\":330,\n\t\t\t\"radio\":2,\n\t\t\t\"class\":\"checkbox\",\n\t\t\t\"onclick\":\"chkCard0002_click\",\n\t\t\t\"default\":\"assets/CARD0002.png.imag\",\n\t\t\t\"select\":\"assets/CARD0008.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"CARD0003.png.imag\",\n\t\t\t\"x\":480,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":18,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":240,\n\t\t\t\"sh\":330,\n\t\t\t\"radio\":3,\n\t\t\t\"class\":\"checkbox\",\n\t\t\t\"onclick\":\"chkCard0003_click\",\n\t\t\t\"default\":\"assets/CARD0004.png.imag\",\n\t\t\t\"select\":\"assets/CARD0005.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lbCheckBox\",\n\t\t\t\"x\":26,\n\t\t\t\"y\":-34,\n\t\t\t\"priority\":19,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: checkbox\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"container_container\",\n\t\t\"x\":150,\n\t\t\"y\":150,\n\t\t\"priority\":20,\n\t\t\"class\":\"container\",\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"label_container\",\n\t\t\"x\":472,\n\t\t\"y\":38,\n\t\t\"priority\":21,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"HelloWorld!\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":10,\n\t\t\t\"priority\":22,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"Hello World!\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":20,\n\t\t\t\"color\":-13421773,\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"ハローワールド！\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":50,\n\t\t\t\"priority\":23,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"ハローワールド！\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":20,\n\t\t\t\"color\":-13421773,\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"Google検索\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":90,\n\t\t\t\"priority\":24,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"Google 検索\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":20,\n\t\t\t\"color\":-13421773,\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lbLabel\",\n\t\t\t\"x\":3,\n\t\t\t\"y\":-37,\n\t\t\t\"priority\":25,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: label\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"textbox_container\",\n\t\t\"x\":234,\n\t\t\"y\":39,\n\t\t\"priority\":26,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"HelloWorld!\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":10,\n\t\t\t\"class\":\"textbox\",\n\t\t\t\"cliph\":3,\n\t\t\t\"clipw\":0,\n\t\t\t\"text\":\"Hello World!\",\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"passwordmode\":0,\n\t\t\t\"placeholder\":\"\"\n\t\t},\n\t\t{\n\t\t\t\"name\":\"ハローワールド！\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":50,\n\t\t\t\"class\":\"textbox\",\n\t\t\t\"cliph\":3,\n\t\t\t\"clipw\":0,\n\t\t\t\"text\":\"ハローワールド！\",\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"passwordmode\":0,\n\t\t\t\"placeholder\":\"\"\n\t\t},\n\t\t{\n\t\t\t\"name\":\"Google検索\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":90,\n\t\t\t\"class\":\"textbox\",\n\t\t\t\"cliph\":3,\n\t\t\t\"clipw\":0,\n\t\t\t\"text\":\"Google 検索\",\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"passwordmode\":0,\n\t\t\t\"placeholder\":\"\"\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lbTextBox\",\n\t\t\t\"x\":-10,\n\t\t\t\"y\":-36,\n\t\t\t\"priority\":30,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: textbox\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":960,\n\t\"height\":740\n}"
  },
  {
    "path": "Tutorial/21.Form/.publish/android/form1.json",
    "content": "{\n\t\"name\":\"form\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"default\":\"assets/AREA0001_BG.png.imag\",\n\t\"sub\":[{\n\t\t\"name\":\"AVATER0008.png.imag\",\n\t\t\"x\":26,\n\t\t\"y\":240,\n\t\t\"priority\":1,\n\t\t\"default\":\"assets/AVATER0008.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0007.png.imag\",\n\t\t\"x\":866,\n\t\t\"y\":206,\n\t\t\"priority\":2,\n\t\t\"default\":\"assets/AVATER0007.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0006.png.imag\",\n\t\t\"x\":654,\n\t\t\"y\":292,\n\t\t\"priority\":3,\n\t\t\"default\":\"assets/AVATER0006.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0005.png.imag\",\n\t\t\"x\":380,\n\t\t\"y\":194,\n\t\t\"priority\":4,\n\t\t\"default\":\"assets/AVATER0005.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0004.png.imag\",\n\t\t\"x\":650,\n\t\t\"y\":2,\n\t\t\"priority\":5,\n\t\t\"default\":\"assets/AVATER0004.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0003.png.imag\",\n\t\t\"x\":545,\n\t\t\"y\":74,\n\t\t\"priority\":6,\n\t\t\"default\":\"assets/AVATER0003.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0002.png.imag\",\n\t\t\"x\":300,\n\t\t\"y\":92,\n\t\t\"priority\":7,\n\t\t\"default\":\"assets/AVATER0002.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\"x\":178,\n\t\t\"y\":216,\n\t\t\"priority\":8,\n\t\t\"sx\":-40,\n\t\t\"sy\":-82,\n\t\t\"sw\":80,\n\t\t\"sh\":164,\n\t\t\"class\":\"button\",\n\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\"select\":\"assets/AVATER0002.png.imag\",\n\t\t\"disable\":\"assets/AVATER0003.png.imag\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\t\"x\":120,\n\t\t\t\"y\":82,\n\t\t\t\"priority\":9,\n\t\t\t\"sx\":-40,\n\t\t\t\"sy\":-82,\n\t\t\t\"sw\":80,\n\t\t\t\"sh\":165,\n\t\t\t\"class\":\"button\",\n\t\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"btnClose\",\n\t\t\"x\":715,\n\t\t\"y\":4,\n\t\t\"priority\":10,\n\t\t\"sx\":0,\n\t\t\"sy\":0,\n\t\t\"sw\":256,\n\t\t\"sh\":128,\n\t\t\"class\":\"button\",\n\t\t\"onclick\":\"formX_onClose\",\n\t\t\"default\":\"assets/BTN_Close_off.png.imag\",\n\t\t\"select\":\"assets/BTN_Close_on.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":960,\n\t\"height\":540\n}"
  },
  {
    "path": "Tutorial/21.Form/.publish/android/form1.lua",
    "content": "function setup()\r\n\tlocal x = 0\r\n\tlocal y = 0\r\n\tlocal pForm = UI_Form(nil,\t-- arg[1]:\teƂȂUI^XÑ|C^\r\n\t\t7000,\t\t-- arg[2]:\t\\vCIeB\r\n\t\tx, y,\t\t-- arg[3,4]:\t\\ʒu\r\n\t\t\"asset://form1.json\",\t-- arg[5]:\tcomposit jsoñpX\r\n\t\tfalse\t\t-- arg[6]:\trtO\r\n\t)\r\n\t--[[\r\n\t\targ[6]:rtO ́Aȗ\\łB\r\n\t\tȗꍇ false ƓɂȂ܂B\r\n\t]]\r\n\t\r\n\tTASK_StageOnly(pForm)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\nfunction formX_onClose()\r\n\tsyslog('----- form1.onClose() -----')\r\n\tsysLoad(\"asset://Form.lua\")\r\nend\r\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/android/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Form.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/iphone/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/iphone/Form.lua",
    "content": "function setup()\r\n\tlocal x = 0\r\n\tlocal y = 0\r\n\tlocal pForm = UI_Form(nil,\t-- arg[1]:\t親となるUIタスクのポインタ\r\n\t\t7000,\t\t-- arg[2]:\t基準表示プライオリティ\r\n\t\tx, y,\t\t-- arg[3,4]:\t表示位置\r\n\t\t\"asset://form.json\",\t-- arg[5]:\tcomposit jsonのパス\r\n\t\tfalse\t\t-- arg[6]:\t排他フラグ\r\n\t)\r\n\t--[[\r\n\t\targ[6]:排他フラグ は、省略可能です。\r\n\t\t省略した場合は false と同じ挙動になります。\r\n\t]]\r\n\t\r\n\tTASK_StageOnly(pForm)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\n\r\nfunction onBattle()\r\n\tsyslog('----- Form.onBattle() -----')\r\n\tsysLoad(\"asset://form1.lua\")\r\nend\r\n\r\nfunction onClose()\r\n\tsyslog('----- Form.onClose() -----')\r\n\tsysExit()\r\n--\tsysLoad(\"asset://form2.lua\")\r\nend\r\n\r\nfunction onContinue()\r\n\tsyslog('----- Form.onContinue() -----')\r\nend\r\n\r\nfunction chkCard0001_click()\r\n\tsyslog('----- Form.chkCard0001_click() -----')\r\nend\r\n\r\nfunction chkCard0002_click()\r\n\tsyslog('----- Form.chkCard0002_click() -----')\r\nend\r\n\r\nfunction chkCard0003_click()\r\n\tsyslog('----- Form.chkCard0003_click() -----')\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/iphone/form.json",
    "content": "{\n\t\"name\":\"form\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"default\":\"assets/bg_00.png.imag\",\n\t\"sub\":[{\n\t\t\"name\":\"node_container\",\n\t\t\"x\":19,\n\t\t\"y\":0,\n\t\t\"priority\":1,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\t\"x\":40,\n\t\t\t\"y\":82,\n\t\t\t\"priority\":2,\n\t\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"AVATER0002.png.imag\",\n\t\t\t\"x\":40,\n\t\t\t\"y\":247,\n\t\t\t\"priority\":3,\n\t\t\t\"default\":\"assets/AVATER0002.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"AVATER0003.png.imag\",\n\t\t\t\"x\":40,\n\t\t\t\"y\":412,\n\t\t\t\"priority\":4,\n\t\t\t\"default\":\"assets/AVATER0003.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"node_container\",\n\t\t\t\"x\":56,\n\t\t\t\"y\":56,\n\t\t\t\"priority\":5,\n\t\t\t\"class\":\"container\",\n\t\t\t\"sub\":[{\n\t\t\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\t\t\"x\":40,\n\t\t\t\t\"y\":82,\n\t\t\t\t\"priority\":6,\n\t\t\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\t\t\"xscale\":1,\n\t\t\t\t\"yscale\":1,\n\t\t\t\t\"rotation\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\":\"AVATER0002.png.imag\",\n\t\t\t\t\"x\":40,\n\t\t\t\t\"y\":247,\n\t\t\t\t\"priority\":7,\n\t\t\t\t\"default\":\"assets/AVATER0002.png.imag\",\n\t\t\t\t\"xscale\":1,\n\t\t\t\t\"yscale\":1,\n\t\t\t\t\"rotation\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\":\"AVATER0003.png.imag\",\n\t\t\t\t\"x\":40,\n\t\t\t\t\"y\":412,\n\t\t\t\t\"priority\":8,\n\t\t\t\t\"default\":\"assets/AVATER0003.png.imag\",\n\t\t\t\t\"xscale\":1,\n\t\t\t\t\"yscale\":1,\n\t\t\t\t\"rotation\":0\n\t\t\t}],\n\t\t\t\"clipx\":0,\n\t\t\t\"clipy\":0,\n\t\t\t\"cliph\":0,\n\t\t\t\"clipw\":0,\n\t\t\t\"clipstart\":0,\n\t\t\t\"clipend\":0,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lblNode\",\n\t\t\t\"x\":-22,\n\t\t\t\"y\":-3,\n\t\t\t\"priority\":9,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: node\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"button_container\",\n\t\t\"x\":703,\n\t\t\"y\":10,\n\t\t\"priority\":10,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"BTN_Battle_off.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":11,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":256,\n\t\t\t\"sh\":128,\n\t\t\t\"class\":\"button\",\n\t\t\t\"onclick\":\"onBattle\",\n\t\t\t\"default\":\"assets/BTN_Battle_off.png.imag\",\n\t\t\t\"select\":\"assets/BTN_Battle_on.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"BTN_Close_off.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":128,\n\t\t\t\"priority\":12,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":256,\n\t\t\t\"sh\":128,\n\t\t\t\"class\":\"button\",\n\t\t\t\"onclick\":\"onClose\",\n\t\t\t\"default\":\"assets/BTN_Close_off.png.imag\",\n\t\t\t\"select\":\"assets/BTN_Close_on.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"BTN_Continue_off.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":256,\n\t\t\t\"priority\":13,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":256,\n\t\t\t\"sh\":128,\n\t\t\t\"class\":\"button\",\n\t\t\t\"onclick\":\"onContinue\",\n\t\t\t\"default\":\"assets/BTN_Continue_off.png.imag\",\n\t\t\t\"select\":\"assets/BTN_Continue_on.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lblButton\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":-16,\n\t\t\t\"priority\":14,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: button\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"checkbox_container\",\n\t\t\"x\":128,\n\t\t\"y\":400,\n\t\t\"priority\":15,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"CARD0001.png.imag\",\n\t\t\t\"x\":0,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":16,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":240,\n\t\t\t\"sh\":330,\n\t\t\t\"radio\":1,\n\t\t\t\"class\":\"checkbox\",\n\t\t\t\"onclick\":\"chkCard0001_click\",\n\t\t\t\"default\":\"assets/CARD0001.png.imag\",\n\t\t\t\"select\":\"assets/CARD0007.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"CARD0002.png.imag\",\n\t\t\t\"x\":240,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":17,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":240,\n\t\t\t\"sh\":330,\n\t\t\t\"radio\":2,\n\t\t\t\"class\":\"checkbox\",\n\t\t\t\"onclick\":\"chkCard0002_click\",\n\t\t\t\"default\":\"assets/CARD0002.png.imag\",\n\t\t\t\"select\":\"assets/CARD0008.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"CARD0003.png.imag\",\n\t\t\t\"x\":480,\n\t\t\t\"y\":0,\n\t\t\t\"priority\":18,\n\t\t\t\"sx\":0,\n\t\t\t\"sy\":0,\n\t\t\t\"sw\":240,\n\t\t\t\"sh\":330,\n\t\t\t\"radio\":3,\n\t\t\t\"class\":\"checkbox\",\n\t\t\t\"onclick\":\"chkCard0003_click\",\n\t\t\t\"default\":\"assets/CARD0004.png.imag\",\n\t\t\t\"select\":\"assets/CARD0005.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lbCheckBox\",\n\t\t\t\"x\":26,\n\t\t\t\"y\":-34,\n\t\t\t\"priority\":19,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: checkbox\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"container_container\",\n\t\t\"x\":150,\n\t\t\"y\":150,\n\t\t\"priority\":20,\n\t\t\"class\":\"container\",\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"label_container\",\n\t\t\"x\":472,\n\t\t\"y\":38,\n\t\t\"priority\":21,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"HelloWorld!\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":10,\n\t\t\t\"priority\":22,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"Hello World!\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":20,\n\t\t\t\"color\":-13421773,\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"ハローワールド！\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":50,\n\t\t\t\"priority\":23,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"ハローワールド！\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":20,\n\t\t\t\"color\":-13421773,\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"Google検索\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":90,\n\t\t\t\"priority\":24,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"Google 検索\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":20,\n\t\t\t\"color\":-13421773,\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lbLabel\",\n\t\t\t\"x\":3,\n\t\t\t\"y\":-37,\n\t\t\t\"priority\":25,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: label\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"textbox_container\",\n\t\t\"x\":234,\n\t\t\"y\":39,\n\t\t\"priority\":26,\n\t\t\"class\":\"container\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"HelloWorld!\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":10,\n\t\t\t\"class\":\"textbox\",\n\t\t\t\"cliph\":3,\n\t\t\t\"clipw\":0,\n\t\t\t\"text\":\"Hello World!\",\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"passwordmode\":0,\n\t\t\t\"placeholder\":\"\"\n\t\t},\n\t\t{\n\t\t\t\"name\":\"ハローワールド！\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":50,\n\t\t\t\"class\":\"textbox\",\n\t\t\t\"cliph\":3,\n\t\t\t\"clipw\":0,\n\t\t\t\"text\":\"ハローワールド！\",\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"passwordmode\":0,\n\t\t\t\"placeholder\":\"\"\n\t\t},\n\t\t{\n\t\t\t\"name\":\"Google検索\",\n\t\t\t\"x\":10,\n\t\t\t\"y\":90,\n\t\t\t\"class\":\"textbox\",\n\t\t\t\"cliph\":3,\n\t\t\t\"clipw\":0,\n\t\t\t\"text\":\"Google 検索\",\n\t\t\t\"width\":150,\n\t\t\t\"height\":30,\n\t\t\t\"passwordmode\":0,\n\t\t\t\"placeholder\":\"\"\n\t\t},\n\t\t{\n\t\t\t\"name\":\"lbTextBox\",\n\t\t\t\"x\":-10,\n\t\t\t\"y\":-36,\n\t\t\t\"priority\":30,\n\t\t\t\"class\":\"label\",\n\t\t\t\"text\":\"class: textbox\",\n\t\t\t\"fontname\":\"\",\n\t\t\t\"fontsize\":30,\n\t\t\t\"color\":-16777024,\n\t\t\t\"width\":240,\n\t\t\t\"height\":32,\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"clipx\":0,\n\t\t\"clipy\":0,\n\t\t\"cliph\":0,\n\t\t\"clipw\":0,\n\t\t\"clipstart\":0,\n\t\t\"clipend\":0,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":960,\n\t\"height\":740\n}"
  },
  {
    "path": "Tutorial/21.Form/.publish/iphone/form1.json",
    "content": "{\n\t\"name\":\"form\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"default\":\"assets/AREA0001_BG.png.imag\",\n\t\"sub\":[{\n\t\t\"name\":\"AVATER0008.png.imag\",\n\t\t\"x\":26,\n\t\t\"y\":240,\n\t\t\"priority\":1,\n\t\t\"default\":\"assets/AVATER0008.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0007.png.imag\",\n\t\t\"x\":866,\n\t\t\"y\":206,\n\t\t\"priority\":2,\n\t\t\"default\":\"assets/AVATER0007.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0006.png.imag\",\n\t\t\"x\":654,\n\t\t\"y\":292,\n\t\t\"priority\":3,\n\t\t\"default\":\"assets/AVATER0006.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0005.png.imag\",\n\t\t\"x\":380,\n\t\t\"y\":194,\n\t\t\"priority\":4,\n\t\t\"default\":\"assets/AVATER0005.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0004.png.imag\",\n\t\t\"x\":650,\n\t\t\"y\":2,\n\t\t\"priority\":5,\n\t\t\"default\":\"assets/AVATER0004.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0003.png.imag\",\n\t\t\"x\":545,\n\t\t\"y\":74,\n\t\t\"priority\":6,\n\t\t\"default\":\"assets/AVATER0003.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0002.png.imag\",\n\t\t\"x\":300,\n\t\t\"y\":92,\n\t\t\"priority\":7,\n\t\t\"default\":\"assets/AVATER0002.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\"x\":178,\n\t\t\"y\":216,\n\t\t\"priority\":8,\n\t\t\"sx\":-40,\n\t\t\"sy\":-82,\n\t\t\"sw\":80,\n\t\t\"sh\":164,\n\t\t\"class\":\"button\",\n\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\"select\":\"assets/AVATER0002.png.imag\",\n\t\t\"disable\":\"assets/AVATER0003.png.imag\",\n\t\t\"sub\":[{\n\t\t\t\"name\":\"AVATER0001.png.imag\",\n\t\t\t\"x\":120,\n\t\t\t\"y\":82,\n\t\t\t\"priority\":9,\n\t\t\t\"sx\":-40,\n\t\t\t\"sy\":-82,\n\t\t\t\"sw\":80,\n\t\t\t\"sh\":165,\n\t\t\t\"class\":\"button\",\n\t\t\t\"default\":\"assets/AVATER0001.png.imag\",\n\t\t\t\"xscale\":1,\n\t\t\t\"yscale\":1,\n\t\t\t\"rotation\":0\n\t\t}],\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t},\n\t{\n\t\t\"name\":\"btnClose\",\n\t\t\"x\":715,\n\t\t\"y\":4,\n\t\t\"priority\":10,\n\t\t\"sx\":0,\n\t\t\"sy\":0,\n\t\t\"sw\":256,\n\t\t\"sh\":128,\n\t\t\"class\":\"button\",\n\t\t\"onclick\":\"formX_onClose\",\n\t\t\"default\":\"assets/BTN_Close_off.png.imag\",\n\t\t\"select\":\"assets/BTN_Close_on.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":960,\n\t\"height\":540\n}"
  },
  {
    "path": "Tutorial/21.Form/.publish/iphone/form1.lua",
    "content": "function setup()\r\n\tlocal x = 0\r\n\tlocal y = 0\r\n\tlocal pForm = UI_Form(nil,\t-- arg[1]:\teƂȂUI^XÑ|C^\r\n\t\t7000,\t\t-- arg[2]:\t\\vCIeB\r\n\t\tx, y,\t\t-- arg[3,4]:\t\\ʒu\r\n\t\t\"asset://form1.json\",\t-- arg[5]:\tcomposit jsoñpX\r\n\t\tfalse\t\t-- arg[6]:\trtO\r\n\t)\r\n\t--[[\r\n\t\targ[6]:rtO ́Aȗ\\łB\r\n\t\tȗꍇ false ƓɂȂ܂B\r\n\t]]\r\n\t\r\n\tTASK_StageOnly(pForm)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\nfunction formX_onClose()\r\n\tsyslog('----- form1.onClose() -----')\r\n\tsysLoad(\"asset://Form.lua\")\r\nend\r\n"
  },
  {
    "path": "Tutorial/21.Form/.publish/iphone/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Form.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/21.Form/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/21.Form/Form.lua",
    "content": "function setup()\r\n\tlocal x = 0\r\n\tlocal y = 0\r\n\tlocal pForm = UI_Form(nil,\t-- arg[1]:\t親となるUIタスクのポインタ\r\n\t\t7000,\t\t-- arg[2]:\t基準表示プライオリティ\r\n\t\tx, y,\t\t-- arg[3,4]:\t表示位置\r\n\t\t\"asset://form.json\",\t-- arg[5]:\tcomposit jsonのパス\r\n\t\tfalse\t\t-- arg[6]:\t排他フラグ\r\n\t)\r\n\t--[[\r\n\t\targ[6]:排他フラグ は、省略可能です。\r\n\t\t省略した場合は false と同じ挙動になります。\r\n\t]]\r\n\t\r\n\tTASK_StageOnly(pForm)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\n\r\nfunction onBattle()\r\n\tsyslog('----- Form.onBattle() -----')\r\n\tsysLoad(\"asset://form1.lua\")\r\nend\r\n\r\nfunction onClose()\r\n\tsyslog('----- Form.onClose() -----')\r\n\tsysExit()\r\n--\tsysLoad(\"asset://form2.lua\")\r\nend\r\n\r\nfunction onContinue()\r\n\tsyslog('----- Form.onContinue() -----')\r\nend\r\n\r\nfunction chkCard0001_click()\r\n\tsyslog('----- Form.chkCard0001_click() -----')\r\nend\r\n\r\nfunction chkCard0002_click()\r\n\tsyslog('----- Form.chkCard0002_click() -----')\r\nend\r\n\r\nfunction chkCard0003_click()\r\n\tsyslog('----- Form.chkCard0003_click() -----')\r\nend\r\n\r\n"
  },
  {
    "path": "Tutorial/21.Form/assets/AREA0001_BG.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"7306defe-897b-48c6-89ac-d27d6330e61e\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AREA0001_BG.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>12349</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:47:44</ImgFileDate>\r\n    <ImgPathName>assets/AREA0001_BG.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>960</Width>\r\n    <Height>540</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>960</Width>\r\n        <Height>540</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>960</Width>\r\n      <Height>540</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>960</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>960</X>\r\n        <Y>540</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>540</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>960</MaskWidth>\r\n    <MaskHeight>540</MaskHeight>\r\n    <Mask>//8B//8B//8B//8B//8B//8B//8B6QcB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0001.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"653df263-1b29-47c5-a2e3-76be66be35cf\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0001.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>15494</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:55:08</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0001.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0002.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"2a6e2ca2-46c0-4123-9b7b-bbdd6f2af2d9\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0002.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>21561</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:55:04</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0002.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0003.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ce6e991a-1f65-4cc6-973b-7fb1f7775ba1\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0003.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>17576</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:54:58</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0003.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0004.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"d19b68e7-f903-433f-98b3-c2b37da93bcc\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0004.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>14048</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:54:50</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0004.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0005.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ae65323d-a98f-454d-a384-a3ec6d339ced\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0005.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>19636</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:54:44</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0005.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0006.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"678e1e7e-6368-4ba6-9816-deff9a5d2f9a\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0006.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>20866</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:54:30</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0006.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0007.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"702803d1-9b5c-4709-8fa0-1c8818423fb7\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0007.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>21197</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:54:22</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0007.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/AVATER0008.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"807349c9-88b0-45cf-ba00-70e6cfceb505\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>AVATER0008.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>20095</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:54:14</ImgFileDate>\r\n    <ImgPathName>assets/AVATER0008.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Battle_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"f4f97100-3991-4f39-a2ff-dc9d3441ca4f\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Battle_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>2984</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:21:24</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Battle_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Battle_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"f6f9df1b-e5bb-4449-a036-6373f7199b3c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Battle_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>2906</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:22:58</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Battle_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Close_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"f289bd38-9690-419d-a9ee-509d76e8b165\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Close_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>2880</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:25:34</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Close_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Close_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"a344f329-b3c1-4dd6-98a9-ecaab46a5a0b\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Close_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>2822</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:25:46</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Close_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Continue_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"f330a3be-8ffb-4e03-8092-7903f41cde88\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Continue_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>3406</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:26:10</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Continue_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Continue_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"528b93f1-0d08-424f-a49b-2809dca90512\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Continue_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>3327</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:26:04</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Continue_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Do_Again_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"cca64045-5f9d-4016-bad8-475d79dcce85\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Do_Again_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>3977</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:26:22</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Do_Again_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Do_Again_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"7a4e3df1-61a3-407d-9216-174d950d171c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Do_Again_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>3943</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:26:28</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Do_Again_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Go_to_next_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"6e3c8bd8-89b2-4e94-8462-c0708ff74bf8\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Go_to_next_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>3431</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:26:52</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Go_to_next_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Go_to_next_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"0714036f-7075-4015-94db-f5c5ae38688a\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Go_to_next_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>3351</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:26:44</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Go_to_next_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Invite_to_alliance_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"ad680e27-8742-4959-942f-6e3ea924be1c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Invite_to_alliance_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>5594</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:28:02</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Invite_to_alliance_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Invite_to_alliance_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"e734db81-4e30-499d-9c1c-9917cfbca523\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Invite_to_alliance_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>5578</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:28:10</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Invite_to_alliance_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Send_comment_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"c5f6c1af-b6af-43cb-a0fd-bce510ea58db\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Send_comment_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>4486</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:28:46</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Send_comment_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Send_comment_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"2031dc96-a5ac-457a-a03b-27e5cd0fc0ab\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Send_comment_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>4424</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:28:54</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Send_comment_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Skip_off.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"a4513d74-33bf-4fab-8edf-87ccfa9b8b58\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Skip_off.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>2674</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:29:26</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Skip_off.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/BTN_Skip_on.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"db35d732-5908-4657-87db-fc26e223d393\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>BTN_Skip_on.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>2582</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:29:20</ImgFileDate>\r\n    <ImgPathName>assets/BTN_Skip_on.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>256</Width>\r\n        <Height>128</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>256</Width>\r\n      <Height>128</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>256</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>128</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>256</MaskWidth>\r\n    <MaskHeight>128</MaskHeight>\r\n    <Mask>gAAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0001.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"bdd23dc4-5610-4d18-a2b7-a742e385af3c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0001.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>62673</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:17:38</ImgFileDate>\r\n    <ImgPathName>assets/CARD0001.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0002.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"f89628b3-c887-474b-97f7-68cf80a5df20\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0002.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>97490</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:17:30</ImgFileDate>\r\n    <ImgPathName>assets/CARD0002.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0003.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"298ce401-7ff3-407f-8f8d-0062820676f1\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0003.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>105009</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:17:24</ImgFileDate>\r\n    <ImgPathName>assets/CARD0003.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0004.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"be5f43fb-6c47-484e-92e7-f13b8748cf2d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0004.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>97157</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:17:02</ImgFileDate>\r\n    <ImgPathName>assets/CARD0004.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0005.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"88b3720f-a6d0-416e-bebf-81a5e10e98da\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0005.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>103659</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:16:56</ImgFileDate>\r\n    <ImgPathName>assets/CARD0005.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0006.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"dfb37acd-a319-4cf1-9ab9-8226ae01ccf7\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0006.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>71672</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:16:50</ImgFileDate>\r\n    <ImgPathName>assets/CARD0006.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0007.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"59eba823-aa93-4b0e-83ec-a59876a1fef3\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0007.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>89804</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:16:44</ImgFileDate>\r\n    <ImgPathName>assets/CARD0007.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/CARD0008.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"9c279570-f12e-4116-bfee-342e7ee29a1a\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>CARD0008.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:46</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>77389</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:16:38</ImgFileDate>\r\n    <ImgPathName>assets/CARD0008.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>240</Width>\r\n    <Height>330</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>240</Width>\r\n        <Height>330</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>240</Width>\r\n      <Height>330</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>240</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>330</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>240</MaskWidth>\r\n    <MaskHeight>330</MaskHeight>\r\n    <Mask>//8BNWEB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/area0001.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"894ed018-0efc-4a30-9737-2d6b2ad0487a\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>form_tex.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2012-05-14T12:42:13</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>1024</Width>\r\n    <Height>1024</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Id>0</Id>\r\n      <Name>AREA0001_BG.png</Name>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AREA0001_BG.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/avater.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"e96bdc26-d016-464e-8b7b-b9a6b2ea7f75\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>avater.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T15:27:11</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>512</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>168</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0005.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0005.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0001.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0001.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>82</X>\r\n        <Y>168</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0006.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0006.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>82</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0002.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0002.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>164</X>\r\n        <Y>168</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0007.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0007.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>164</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0003.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0003.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>246</X>\r\n        <Y>168</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0008.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0008.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>246</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATER0004.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATER0004.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/bg.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"11530f04-0bab-48a9-aa9f-71c4f2ea68a0\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>bg.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T15:26:45</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>2048</Width>\r\n    <Height>2048</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>bg_00.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/bg_00.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>642</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>bg_02.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/bg_02.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/bg_00.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"038c0728-c74b-409c-9ce8-00b9231524a9\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>bg_00.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>656136</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:10:12</ImgFileDate>\r\n    <ImgPathName>assets/bg_00.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>960</Width>\r\n    <Height>640</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>960</Width>\r\n        <Height>640</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>960</Width>\r\n      <Height>640</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>960</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>960</X>\r\n        <Y>640</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>640</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>960</MaskWidth>\r\n    <MaskHeight>640</MaskHeight>\r\n    <Mask>//8B//8B//8B//8B//8B//8B//8B//8B//8BYAkB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/bg_02.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"4c7b1565-2917-4a3a-8504-91224f231c5f\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>bg_02.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T12:45:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>1035444</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:10:56</ImgFileDate>\r\n    <ImgPathName>assets/bg_02.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>960</Width>\r\n    <Height>640</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>960</Width>\r\n        <Height>640</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>960</Width>\r\n      <Height>640</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>960</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>960</X>\r\n        <Y>640</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>640</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>960</MaskWidth>\r\n    <MaskHeight>640</MaskHeight>\r\n    <Mask>//8B//8B//8B//8B//8B//8B//8B//8B//8BYAkB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/btn.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"d30ded00-5f13-42ca-873b-a3752121df22\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>btn.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T18:06:26</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>1024</Width>\r\n    <Height>1024</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Battle_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Battle_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>258</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Battle_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Battle_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>516</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Close_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Close_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>130</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Continue_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Continue_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>258</X>\r\n        <Y>130</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Continue_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Continue_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>516</X>\r\n        <Y>130</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Do_Again_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Do_Again_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>260</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Go_to_next_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Go_to_next_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>258</X>\r\n        <Y>260</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Go_to_next_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Go_to_next_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>516</X>\r\n        <Y>260</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Invite_to_alliance_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Invite_to_alliance_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>390</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Send_comment_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Send_comment_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>258</X>\r\n        <Y>390</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Send_comment_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Send_comment_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>516</X>\r\n        <Y>390</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Skip_off.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Skip_off.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>528</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Skip_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Skip_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>264</X>\r\n        <Y>528</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Invite_to_alliance_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Invite_to_alliance_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>528</X>\r\n        <Y>528</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Do_Again_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Do_Again_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>664</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>BTN_Close_on.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/BTN_Close_on.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/assets/card.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"078454f1-0eed-40e0-a596-547328770bff\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>card.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T15:29:14</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>1024</Width>\r\n    <Height>1024</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0001.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0001.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>336</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0005.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0005.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>242</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0002.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0002.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>242</X>\r\n        <Y>336</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0006.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0006.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>484</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0003.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0003.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>484</X>\r\n        <Y>336</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0007.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0007.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>726</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0004.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0004.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>726</X>\r\n        <Y>336</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>CARD0008.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/CARD0008.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/form.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBUIEditor_Plugin id=\"1e8e3e1a-09d7-44fe-9bbb-fb9dd6c43c3e\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <DrawingAllNodesClickableRegion>false</DrawingAllNodesClickableRegion>\r\n  <DrawingFingerNode>true</DrawingFingerNode>\r\n  <DrawingGrid>true</DrawingGrid>\r\n  <DrawingNodeClipRegion>false</DrawingNodeClipRegion>\r\n  <DrawingNodeName>false</DrawingNodeName>\r\n  <FormBounds xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>1039</d1p1:height>\r\n    <d1p1:width>958</d1p1:width>\r\n    <d1p1:x>217</d1p1:x>\r\n    <d1p1:y>136</d1p1:y>\r\n  </FormBounds>\r\n  <GridSize>10</GridSize>\r\n  <GuideForFourSplit>false</GuideForFourSplit>\r\n  <GuideForMargin>false</GuideForMargin>\r\n  <GuideForThreeSplit>false</GuideForThreeSplit>\r\n  <LayoutPpi>326</LayoutPpi>\r\n  <LayoutScale>0.75</LayoutScale>\r\n  <LayoutSize xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>740</d1p1:height>\r\n    <d1p1:width>960</d1p1:width>\r\n  </LayoutSize>\r\n  <RootNode>\r\n    <name>form</name>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <priority>0</priority>\r\n    <default>assets/bg_00.png.imag</default>\r\n    <sub>\r\n      <UINode>\r\n        <name>node_container</name>\r\n        <x>19</x>\r\n        <y>0</y>\r\n        <priority>1</priority>\r\n        <class>container</class>\r\n        <sub>\r\n          <UINode>\r\n            <name>AVATER0001.png.imag</name>\r\n            <x>40</x>\r\n            <y>82</y>\r\n            <priority>2</priority>\r\n            <default>assets/AVATER0001.png.imag</default>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/AVATER0001.png</d6p1:string>\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>AVATER0002.png.imag</name>\r\n            <x>40</x>\r\n            <y>247</y>\r\n            <priority>3</priority>\r\n            <default>assets/AVATER0002.png.imag</default>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/AVATER0002.png</d6p1:string>\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>AVATER0003.png.imag</name>\r\n            <x>40</x>\r\n            <y>412</y>\r\n            <priority>4</priority>\r\n            <default>assets/AVATER0003.png.imag</default>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/AVATER0003.png</d6p1:string>\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>node_container</name>\r\n            <x>56</x>\r\n            <y>56</y>\r\n            <priority>5</priority>\r\n            <class>container</class>\r\n            <sub>\r\n              <UINode>\r\n                <name>AVATER0001.png.imag</name>\r\n                <x>40</x>\r\n                <y>82</y>\r\n                <priority>6</priority>\r\n                <default>assets/AVATER0001.png.imag</default>\r\n                <xscale>1</xscale>\r\n                <yscale>1</yscale>\r\n                <_x0040_CommonAssets xmlns:d8p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n                  <d8p1:string>assets/AVATER0001.png</d8p1:string>\r\n                </_x0040_CommonAssets>\r\n                <rotation>0</rotation>\r\n              </UINode>\r\n              <UINode>\r\n                <name>AVATER0002.png.imag</name>\r\n                <x>40</x>\r\n                <y>247</y>\r\n                <priority>7</priority>\r\n                <default>assets/AVATER0002.png.imag</default>\r\n                <xscale>1</xscale>\r\n                <yscale>1</yscale>\r\n                <_x0040_CommonAssets xmlns:d8p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n                  <d8p1:string>assets/AVATER0002.png</d8p1:string>\r\n                </_x0040_CommonAssets>\r\n                <rotation>0</rotation>\r\n              </UINode>\r\n              <UINode>\r\n                <name>AVATER0003.png.imag</name>\r\n                <x>40</x>\r\n                <y>412</y>\r\n                <priority>8</priority>\r\n                <default>assets/AVATER0003.png.imag</default>\r\n                <xscale>1</xscale>\r\n                <yscale>1</yscale>\r\n                <_x0040_CommonAssets xmlns:d8p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n                  <d8p1:string>assets/AVATER0003.png</d8p1:string>\r\n                </_x0040_CommonAssets>\r\n                <rotation>0</rotation>\r\n              </UINode>\r\n            </sub>\r\n            <clipx>0</clipx>\r\n            <clipy>0</clipy>\r\n            <cliph>0</cliph>\r\n            <clipw>0</clipw>\r\n            <clipstart>0</clipstart>\r\n            <clipend>0</clipend>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>lblNode</name>\r\n            <x>-22</x>\r\n            <y>-3</y>\r\n            <priority>9</priority>\r\n            <class>label</class>\r\n            <text>class: node</text>\r\n            <fontname></fontname>\r\n            <fontsize>30</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-16777024</_x0023_color>\r\n            <width>240</width>\r\n            <height>32</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n        </sub>\r\n        <clipx>0</clipx>\r\n        <clipy>0</clipy>\r\n        <cliph>0</cliph>\r\n        <clipw>0</clipw>\r\n        <clipstart>0</clipstart>\r\n        <clipend>0</clipend>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string i:nil=\"true\" />\r\n          <d4p1:string i:nil=\"true\" />\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n      <UINode>\r\n        <name>button_container</name>\r\n        <x>703</x>\r\n        <y>10</y>\r\n        <priority>10</priority>\r\n        <class>container</class>\r\n        <sub>\r\n          <UINode>\r\n            <name>BTN_Battle_off.png.imag</name>\r\n            <x>0</x>\r\n            <y>0</y>\r\n            <priority>11</priority>\r\n            <sx>0</sx>\r\n            <sy>0</sy>\r\n            <sw>256</sw>\r\n            <sh>128</sh>\r\n            <class>button</class>\r\n            <onclick>onBattle</onclick>\r\n            <default>assets/BTN_Battle_off.png.imag</default>\r\n            <select>assets/BTN_Battle_on.png.imag</select>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/BTN_Battle_off.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string>assets/BTN_Battle_on.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>BTN_Close_off.png.imag</name>\r\n            <x>0</x>\r\n            <y>128</y>\r\n            <priority>12</priority>\r\n            <sx>0</sx>\r\n            <sy>0</sy>\r\n            <sw>256</sw>\r\n            <sh>128</sh>\r\n            <class>button</class>\r\n            <onclick>onClose</onclick>\r\n            <default>assets/BTN_Close_off.png.imag</default>\r\n            <select>assets/BTN_Close_on.png.imag</select>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/BTN_Close_off.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string>assets/BTN_Close_on.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>BTN_Continue_off.png.imag</name>\r\n            <x>0</x>\r\n            <y>256</y>\r\n            <priority>13</priority>\r\n            <sx>0</sx>\r\n            <sy>0</sy>\r\n            <sw>256</sw>\r\n            <sh>128</sh>\r\n            <class>button</class>\r\n            <onclick>onContinue</onclick>\r\n            <default>assets/BTN_Continue_off.png.imag</default>\r\n            <select>assets/BTN_Continue_on.png.imag</select>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/BTN_Continue_off.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string>assets/BTN_Continue_on.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>lblButton</name>\r\n            <x>0</x>\r\n            <y>-16</y>\r\n            <priority>14</priority>\r\n            <class>label</class>\r\n            <text>class: button</text>\r\n            <fontname></fontname>\r\n            <fontsize>30</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-16777024</_x0023_color>\r\n            <width>240</width>\r\n            <height>32</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n        </sub>\r\n        <clipx>0</clipx>\r\n        <clipy>0</clipy>\r\n        <cliph>0</cliph>\r\n        <clipw>0</clipw>\r\n        <clipstart>0</clipstart>\r\n        <clipend>0</clipend>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string i:nil=\"true\" />\r\n          <d4p1:string i:nil=\"true\" />\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n      <UINode>\r\n        <name>checkbox_container</name>\r\n        <x>128</x>\r\n        <y>400</y>\r\n        <priority>15</priority>\r\n        <class>container</class>\r\n        <sub>\r\n          <UINode>\r\n            <name>CARD0001.png.imag</name>\r\n            <x>0</x>\r\n            <y>0</y>\r\n            <priority>16</priority>\r\n            <sx>0</sx>\r\n            <sy>0</sy>\r\n            <sw>240</sw>\r\n            <sh>330</sh>\r\n            <_x0023_radio>1</_x0023_radio>\r\n            <class>checkbox</class>\r\n            <onclick>chkCard0001_click</onclick>\r\n            <default>assets/CARD0001.png.imag</default>\r\n            <select>assets/CARD0007.png.imag</select>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/CARD0001.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string>assets/CARD0007.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>CARD0002.png.imag</name>\r\n            <x>240</x>\r\n            <y>0</y>\r\n            <priority>17</priority>\r\n            <sx>0</sx>\r\n            <sy>0</sy>\r\n            <sw>240</sw>\r\n            <sh>330</sh>\r\n            <_x0023_radio>2</_x0023_radio>\r\n            <class>checkbox</class>\r\n            <onclick>chkCard0002_click</onclick>\r\n            <default>assets/CARD0002.png.imag</default>\r\n            <select>assets/CARD0008.png.imag</select>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/CARD0002.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string>assets/CARD0008.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>CARD0003.png.imag</name>\r\n            <x>480</x>\r\n            <y>0</y>\r\n            <priority>18</priority>\r\n            <sx>0</sx>\r\n            <sy>0</sy>\r\n            <sw>240</sw>\r\n            <sh>330</sh>\r\n            <_x0023_radio>3</_x0023_radio>\r\n            <class>checkbox</class>\r\n            <onclick>chkCard0003_click</onclick>\r\n            <default>assets/CARD0004.png.imag</default>\r\n            <select>assets/CARD0005.png.imag</select>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <_x0040_CommonAssets xmlns:d6p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n              <d6p1:string>assets/CARD0004.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string>assets/CARD0005.png</d6p1:string>\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n              <d6p1:string i:nil=\"true\" />\r\n            </_x0040_CommonAssets>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>lbCheckBox</name>\r\n            <x>26</x>\r\n            <y>-34</y>\r\n            <priority>19</priority>\r\n            <class>label</class>\r\n            <text>class: checkbox</text>\r\n            <fontname></fontname>\r\n            <fontsize>30</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-16777024</_x0023_color>\r\n            <width>240</width>\r\n            <height>32</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n        </sub>\r\n        <clipx>0</clipx>\r\n        <clipy>0</clipy>\r\n        <cliph>0</cliph>\r\n        <clipw>0</clipw>\r\n        <clipstart>0</clipstart>\r\n        <clipend>0</clipend>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string i:nil=\"true\" />\r\n          <d4p1:string i:nil=\"true\" />\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n      <UINode>\r\n        <name>container_container</name>\r\n        <x>150</x>\r\n        <y>150</y>\r\n        <priority>20</priority>\r\n        <class>container</class>\r\n        <clipx>0</clipx>\r\n        <clipy>0</clipy>\r\n        <cliph>0</cliph>\r\n        <clipw>0</clipw>\r\n        <clipstart>0</clipstart>\r\n        <clipend>0</clipend>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string i:nil=\"true\" />\r\n          <d4p1:string i:nil=\"true\" />\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n      <UINode>\r\n        <name>label_container</name>\r\n        <x>472</x>\r\n        <y>38</y>\r\n        <priority>21</priority>\r\n        <class>container</class>\r\n        <sub>\r\n          <UINode>\r\n            <name>HelloWorld!</name>\r\n            <x>10</x>\r\n            <y>10</y>\r\n            <priority>22</priority>\r\n            <class>label</class>\r\n            <text>Hello World!</text>\r\n            <fontname></fontname>\r\n            <fontsize>20</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-13421773</_x0023_color>\r\n            <width>150</width>\r\n            <height>30</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>ハローワールド！</name>\r\n            <x>10</x>\r\n            <y>50</y>\r\n            <priority>23</priority>\r\n            <class>label</class>\r\n            <text>ハローワールド！</text>\r\n            <fontname></fontname>\r\n            <fontsize>20</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-13421773</_x0023_color>\r\n            <width>150</width>\r\n            <height>30</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>Google検索</name>\r\n            <x>10</x>\r\n            <y>90</y>\r\n            <priority>24</priority>\r\n            <class>label</class>\r\n            <text>Google 検索</text>\r\n            <fontname></fontname>\r\n            <fontsize>20</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-13421773</_x0023_color>\r\n            <width>150</width>\r\n            <height>30</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n          <UINode>\r\n            <name>lbLabel</name>\r\n            <x>3</x>\r\n            <y>-37</y>\r\n            <priority>25</priority>\r\n            <class>label</class>\r\n            <text>class: label</text>\r\n            <fontname></fontname>\r\n            <fontsize>30</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-16777024</_x0023_color>\r\n            <width>240</width>\r\n            <height>32</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n        </sub>\r\n        <clipx>0</clipx>\r\n        <clipy>0</clipy>\r\n        <cliph>0</cliph>\r\n        <clipw>0</clipw>\r\n        <clipstart>0</clipstart>\r\n        <clipend>0</clipend>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string i:nil=\"true\" />\r\n          <d4p1:string i:nil=\"true\" />\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n      <UINode>\r\n        <name>textbox_container</name>\r\n        <x>234</x>\r\n        <y>39</y>\r\n        <priority>26</priority>\r\n        <class>container</class>\r\n        <sub>\r\n          <UINode>\r\n            <name>HelloWorld!</name>\r\n            <x>10</x>\r\n            <y>10</y>\r\n            <class>textbox</class>\r\n            <cliph>3</cliph>\r\n            <clipw>0</clipw>\r\n            <text>Hello World!</text>\r\n            <width>150</width>\r\n            <height>30</height>\r\n            <passwordmode>0</passwordmode>\r\n            <placeholder></placeholder>\r\n          </UINode>\r\n          <UINode>\r\n            <name>ハローワールド！</name>\r\n            <x>10</x>\r\n            <y>50</y>\r\n            <class>textbox</class>\r\n            <cliph>3</cliph>\r\n            <clipw>0</clipw>\r\n            <text>ハローワールド！</text>\r\n            <width>150</width>\r\n            <height>30</height>\r\n            <passwordmode>0</passwordmode>\r\n            <placeholder></placeholder>\r\n          </UINode>\r\n          <UINode>\r\n            <name>Google検索</name>\r\n            <x>10</x>\r\n            <y>90</y>\r\n            <class>textbox</class>\r\n            <cliph>3</cliph>\r\n            <clipw>0</clipw>\r\n            <text>Google 検索</text>\r\n            <width>150</width>\r\n            <height>30</height>\r\n            <passwordmode>0</passwordmode>\r\n            <placeholder></placeholder>\r\n          </UINode>\r\n          <UINode>\r\n            <name>lbTextBox</name>\r\n            <x>-10</x>\r\n            <y>-36</y>\r\n            <priority>30</priority>\r\n            <class>label</class>\r\n            <text>class: textbox</text>\r\n            <fontname></fontname>\r\n            <fontsize>30</fontsize>\r\n            <_x0023_color xmlns:d6p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d6p1:int\">-16777024</_x0023_color>\r\n            <width>240</width>\r\n            <height>32</height>\r\n            <xscale>1</xscale>\r\n            <yscale>1</yscale>\r\n            <rotation>0</rotation>\r\n          </UINode>\r\n        </sub>\r\n        <clipx>0</clipx>\r\n        <clipy>0</clipy>\r\n        <cliph>0</cliph>\r\n        <clipw>0</clipw>\r\n        <clipstart>0</clipstart>\r\n        <clipend>0</clipend>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string i:nil=\"true\" />\r\n          <d4p1:string i:nil=\"true\" />\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n    </sub>\r\n    <width>960</width>\r\n    <height>740</height>\r\n    <_x0040_CommonAssets xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n      <d2p1:string>assets/bg_00.png</d2p1:string>\r\n    </_x0040_CommonAssets>\r\n  </RootNode>\r\n  <ServerApiGroup>[ServerAPI]</ServerApiGroup>\r\n  <WindowState>Normal</WindowState>\r\n</KLBUIEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/form1.lua",
    "content": "function setup()\r\n\tlocal x = 0\r\n\tlocal y = 0\r\n\tlocal pForm = UI_Form(nil,\t-- arg[1]:\teƂȂUI^XÑ|C^\r\n\t\t7000,\t\t-- arg[2]:\t\\vCIeB\r\n\t\tx, y,\t\t-- arg[3,4]:\t\\ʒu\r\n\t\t\"asset://form1.json\",\t-- arg[5]:\tcomposit jsoñpX\r\n\t\tfalse\t\t-- arg[6]:\trtO\r\n\t)\r\n\t--[[\r\n\t\targ[6]:rtO ́Aȗ\\łB\r\n\t\tȗꍇ false ƓɂȂ܂B\r\n\t]]\r\n\t\r\n\tTASK_StageOnly(pForm)\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\n\tTASK_StageClear()\r\nend\r\n\r\nfunction formX_onClose()\r\n\tsyslog('----- form1.onClose() -----')\r\n\tsysLoad(\"asset://Form.lua\")\r\nend\r\n"
  },
  {
    "path": "Tutorial/21.Form/form1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBUIEditor_Plugin xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"e4b019d7-6a19-4183-9a49-6e8411a2af3c\">\r\n  <DrawingAllNodesClickableRegion>true</DrawingAllNodesClickableRegion>\r\n  <DrawingNodeClipRegion>true</DrawingNodeClipRegion>\r\n  <DrawingNodeName>false</DrawingNodeName>\r\n  <FormBounds xmlns:d2p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d2p1:height>588</d2p1:height>\r\n    <d2p1:width>970</d2p1:width>\r\n    <d2p1:x>204</d2p1:x>\r\n    <d2p1:y>6</d2p1:y>\r\n  </FormBounds>\r\n  <LayoutScale>0.75</LayoutScale>\r\n  <LayoutSize xmlns:d2p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d2p1:height>540</d2p1:height>\r\n    <d2p1:width>960</d2p1:width>\r\n  </LayoutSize>\r\n  <RootNode>\r\n    <name>form</name>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <priority>0</priority>\r\n    <_x0040_default>assets/AREA0001_BG.png</_x0040_default>\r\n    <default>assets/AREA0001_BG.png.imag</default>\r\n    <sub>\r\n      <UINode>\r\n        <name>AVATER0008.png.imag</name>\r\n        <x>26</x>\r\n        <y>240</y>\r\n        <priority>1</priority>\r\n        <_x0040_default>assets/AVATER0008.png</_x0040_default>\r\n        <default>assets/AVATER0008.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0007.png.imag</name>\r\n        <x>866</x>\r\n        <y>206</y>\r\n        <priority>2</priority>\r\n        <_x0040_default>assets/AVATER0007.png</_x0040_default>\r\n        <default>assets/AVATER0007.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0006.png.imag</name>\r\n        <x>654</x>\r\n        <y>292</y>\r\n        <priority>3</priority>\r\n        <_x0040_default>assets/AVATER0006.png</_x0040_default>\r\n        <default>assets/AVATER0006.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0005.png.imag</name>\r\n        <x>380</x>\r\n        <y>194</y>\r\n        <priority>4</priority>\r\n        <_x0040_default>assets/AVATER0005.png</_x0040_default>\r\n        <default>assets/AVATER0005.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0004.png.imag</name>\r\n        <x>650</x>\r\n        <y>2</y>\r\n        <priority>5</priority>\r\n        <_x0040_default>assets/AVATER0004.png</_x0040_default>\r\n        <default>assets/AVATER0004.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0003.png.imag</name>\r\n        <x>545</x>\r\n        <y>74</y>\r\n        <priority>6</priority>\r\n        <_x0040_default>assets/AVATER0003.png</_x0040_default>\r\n        <default>assets/AVATER0003.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0002.png.imag</name>\r\n        <x>300</x>\r\n        <y>92</y>\r\n        <priority>7</priority>\r\n        <_x0040_default>assets/AVATER0002.png</_x0040_default>\r\n        <default>assets/AVATER0002.png.imag</default>\r\n        <sub />\r\n      </UINode>\r\n      <UINode>\r\n        <name>AVATER0001.png.imag</name>\r\n        <x>178</x>\r\n        <y>216</y>\r\n        <priority>8</priority>\r\n        <sx>-40</sx>\r\n        <sy>-82</sy>\r\n        <sw>80</sw>\r\n        <sh>164</sh>\r\n        <class>button</class>\r\n        <_x0040_default>assets/AVATER0001.png</_x0040_default>\r\n        <default>assets/AVATER0001.png.imag</default>\r\n        <_x0040_select>assets/AVATER0002.png</_x0040_select>\r\n        <select>assets/AVATER0002.png.imag</select>\r\n        <_x0040_disable>assets/AVATER0003.png</_x0040_disable>\r\n        <disable>assets/AVATER0003.png.imag</disable>\r\n        <sub>\r\n          <UINode>\r\n            <name>AVATER0001.png.imag</name>\r\n            <x>120</x>\r\n            <y>82</y>\r\n            <priority>9</priority>\r\n            <sx>-40</sx>\r\n            <sy>-82</sy>\r\n            <sw>80</sw>\r\n            <sh>165</sh>\r\n            <class>button</class>\r\n            <_x0040_default>assets/AVATER0001.png</_x0040_default>\r\n            <default>assets/AVATER0001.png.imag</default>\r\n            <sub />\r\n          </UINode>\r\n        </sub>\r\n      </UINode>\r\n      <UINode>\r\n        <name>btnClose</name>\r\n        <x>715</x>\r\n        <y>4</y>\r\n        <priority>10</priority>\r\n        <sx>0</sx>\r\n        <sy>0</sy>\r\n        <sw>256</sw>\r\n        <sh>128</sh>\r\n        <class>button</class>\r\n        <onclick>formX_onClose</onclick>\r\n        <_x0040_default>assets/BTN_Close_off.png</_x0040_default>\r\n        <default>assets/BTN_Close_off.png.imag</default>\r\n        <_x0040_select>assets/BTN_Close_on.png</_x0040_select>\r\n        <select>assets/BTN_Close_on.png.imag</select>\r\n        <sub />\r\n      </UINode>\r\n    </sub>\r\n  </RootNode>\r\n  <WindowState>Normal</WindowState>\r\n</KLBUIEditor_Plugin>"
  },
  {
    "path": "Tutorial/21.Form/start.lua",
    "content": "function setup()\r\n\tFONT_load(\"Georgia\",\"asset://AlexBrush-Regular-OTF.otf\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Form.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/.publish/android/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/22.List/.publish/android/List.lua",
    "content": "--\r\nfunction setup()\r\n\r\n\tpTask = UI_List(nil, 8000, 8200, 100, 100, 600, 400, 300, false, nil)\r\n\tsysCommand(pTask, UI_LIST_USE_SCROLLBAR,\r\n\t\t8200, true, 25, \"asset://scrbar.png.imag\", 25, nil, 0x80, 0xffffff, 0xff, 0xffffff, true, true)\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_ITEMMODE, LIST_ITEM_DYNAMIC, \"dynamic_callback\")\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_GROUP, \"group\")\r\n\tsysCommand(pTask, UI_LIST_SET_LOOPMODE, true)\r\n\tsysCommand(pTask, UI_LIST_SET_MARGIN, 0, 0)\r\n\t-- sysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"default\")\r\n\t-- sysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"solid\")\r\n\tsysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"page\", 300, 10, 0)\r\n--\tsysCommand(pTask, UI_LIST_SCRMGR_CALLBACK, \"listStop\")\r\n--\tsysCommand(pTask, UI_LIST_SET_LIMITCLIP, true)\r\n\t--sysCommand(pTask, UI_LIST_SET_LIMITAREA, 600)\r\n\r\n\tprop = TASK_getProperty(pTask)\r\n\tprop.visible = true\r\n\tprop.default_scroll = true\r\n\tTASK_setProperty(pTask, prop)\r\n\r\n\tlocal form = CONV_JsonFile2Lua(\"asset://test_item.json\")\r\n\r\n\t\tfor i=1,40 do\r\n\t\t\tsysCommand(pTask, UI_LIST_ITEM_ADD, form, 300, i + 10000)\r\n--\t\t\tsysCommand(pTask, UI_LIST_UPDATE_NODE, i - 1, \"label\", FORM_LBL_SET_TEXT, string.format(\"item<%d>\", i))\r\n\t\tend\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_INITIAL, 0)\r\n\t-- pText = UI_TextInput(nil, false, 50, 50, 200, 50, \"default text\", \"textCallback\", 100)\r\n\r\n\t--pImage1 = UI_VariableItem(nil, 9000, 0, 0, 100, 100, \"asset://test_tex.png.imag\")\r\n\t--pImage2 = UI_VariableItem(nil, 9000, 100, 0, 100, 100, \"asset://test_tex.png.imag\")\r\n\t--sysCommand(pImage2, UI_VARITEM_SET_UV, 50, 50, 100, 50)\r\n\ttblAsset = {\r\n\t\t\"asset://test_tex.png.imag\",\r\n\t\t\"asset://change_tex.png.imag\"\r\n\t}\r\n\t\r\n\tcount = 0\r\n\tpreItem = 1\r\n\tflag = false\r\nend\r\n\r\nfunction execute(deltaT)\r\n\r\n--[[\r\n\tcount = count + deltaT\r\n\tif count >= 1000 then\r\n\t\tcount = count - 1000\r\n\t\tpreItem = 1 - preItem\r\n\t\tsysCommand(pImage1, UI_VARITEM_CHANGE_ASSET, tblAsset[preItem + 1])\r\n\r\n\tend\r\n\t]]\r\nend\r\n\r\nfunction leave()\r\n\tpText = TASK_kill(pText)\r\n\tpTask = TASK_kill(pTask)\r\nend\r\n\r\n\r\nfunction sub_execute(pGen, deltaT, key)\r\n\tcount = count + 1\r\n\tsyslog(string.format(\"count = %d\", count))\r\n\tif count == 120 then\r\n\t\tfor i=1,30 do\r\n\t\t\tsysCommand(pTask, UI_LIST_ITEM_ADD, \"asset://test_item.json\")\r\n\t\tend\r\n\t\tTASK_kill(pGen)\r\n\tend\r\nend\r\n\r\nfunction sub_die(pGen, key)\r\nend\r\n\r\nfunction callback_scrollOver(pList, mode, items, length, pos)\r\n\tsyslog(string.format(\"mode[%d] items[%d]  length[%d]  pos[%d]\", mode, items, length, pos))\r\nend\r\n\r\nfunction textCallback(pTB, str, id)\r\n\tsyslog(string.format(\"<%d>[%s]\", id, str))\r\nend\r\n\r\nfunction listStop(pList, pos)\r\n\tsyslog(string.format(\"List STOP: %d\", pos))\r\nend\r\n\r\nfunction movie_callback(pTask)\r\n\r\nend\r\n\r\nfunction dragCallback(pList, type, tap_x, tap_y, mv_x, mv_y)\r\n\r\n\tsyslog(\"call lua callback.\")\r\n\tif type == PAD_ITEM_TAP then\r\n\t\t\r\n\telseif type == PAD_ITEM_DRAG then\r\n\telseif type == PAD_ITEM_RELEASE then\r\n\tend\r\n\t\r\nend\r\n\r\nfunction dynamic_callback(pList, index, itemId)\r\n\tsyslog(string.format(\"index[%d] itemId[%d]\", index, itemId))\r\n\tsysCommand(pList, UI_LIST_UPDATE_NODE, index, \"label\", FORM_LBL_SET_TEXT, string.format(\"item<%d> id<%d>\", index, itemId))\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/.publish/android/start.lua",
    "content": "--\r\nfunction setup()\r\n\tFONT_load(\"AlexBrush\",\"asset://AlexBrush-Regular-OTF.otf\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://List.lua\")\r\nend\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/.publish/android/test_item.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"label\",\n\t\t\"x\":0,\n\t\t\"y\":0,\n\t\t\"priority\":0,\n\t\t\"class\":\"label\",\n\t\t\"text\":\"幅300アイテム\",\n\t\t\"fontname\":\"\",\n\t\t\"fontsize\":20,\n\t\t\"color\":-13421773,\n\t\t\"width\":300,\n\t\t\"height\":360,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":960,\n\t\"height\":640\n}"
  },
  {
    "path": "Tutorial/22.List/.publish/iphone/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/22.List/.publish/iphone/List.lua",
    "content": "--\r\nfunction setup()\r\n\r\n\tpTask = UI_List(nil, 8000, 8200, 100, 100, 600, 400, 300, false, nil)\r\n\tsysCommand(pTask, UI_LIST_USE_SCROLLBAR,\r\n\t\t8200, true, 25, \"asset://scrbar.png.imag\", 25, nil, 0x80, 0xffffff, 0xff, 0xffffff, true, true)\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_ITEMMODE, LIST_ITEM_DYNAMIC, \"dynamic_callback\")\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_GROUP, \"group\")\r\n\tsysCommand(pTask, UI_LIST_SET_LOOPMODE, true)\r\n\tsysCommand(pTask, UI_LIST_SET_MARGIN, 0, 0)\r\n\t-- sysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"default\")\r\n\t-- sysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"solid\")\r\n\tsysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"page\", 300, 10, 0)\r\n--\tsysCommand(pTask, UI_LIST_SCRMGR_CALLBACK, \"listStop\")\r\n--\tsysCommand(pTask, UI_LIST_SET_LIMITCLIP, true)\r\n\t--sysCommand(pTask, UI_LIST_SET_LIMITAREA, 600)\r\n\r\n\tprop = TASK_getProperty(pTask)\r\n\tprop.visible = true\r\n\tprop.default_scroll = true\r\n\tTASK_setProperty(pTask, prop)\r\n\r\n\tlocal form = CONV_JsonFile2Lua(\"asset://test_item.json\")\r\n\r\n\t\tfor i=1,40 do\r\n\t\t\tsysCommand(pTask, UI_LIST_ITEM_ADD, form, 300, i + 10000)\r\n--\t\t\tsysCommand(pTask, UI_LIST_UPDATE_NODE, i - 1, \"label\", FORM_LBL_SET_TEXT, string.format(\"item<%d>\", i))\r\n\t\tend\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_INITIAL, 0)\r\n\t-- pText = UI_TextInput(nil, false, 50, 50, 200, 50, \"default text\", \"textCallback\", 100)\r\n\r\n\t--pImage1 = UI_VariableItem(nil, 9000, 0, 0, 100, 100, \"asset://test_tex.png.imag\")\r\n\t--pImage2 = UI_VariableItem(nil, 9000, 100, 0, 100, 100, \"asset://test_tex.png.imag\")\r\n\t--sysCommand(pImage2, UI_VARITEM_SET_UV, 50, 50, 100, 50)\r\n\ttblAsset = {\r\n\t\t\"asset://test_tex.png.imag\",\r\n\t\t\"asset://change_tex.png.imag\"\r\n\t}\r\n\t\r\n\tcount = 0\r\n\tpreItem = 1\r\n\tflag = false\r\nend\r\n\r\nfunction execute(deltaT)\r\n\r\n--[[\r\n\tcount = count + deltaT\r\n\tif count >= 1000 then\r\n\t\tcount = count - 1000\r\n\t\tpreItem = 1 - preItem\r\n\t\tsysCommand(pImage1, UI_VARITEM_CHANGE_ASSET, tblAsset[preItem + 1])\r\n\r\n\tend\r\n\t]]\r\nend\r\n\r\nfunction leave()\r\n\tpText = TASK_kill(pText)\r\n\tpTask = TASK_kill(pTask)\r\nend\r\n\r\n\r\nfunction sub_execute(pGen, deltaT, key)\r\n\tcount = count + 1\r\n\tsyslog(string.format(\"count = %d\", count))\r\n\tif count == 120 then\r\n\t\tfor i=1,30 do\r\n\t\t\tsysCommand(pTask, UI_LIST_ITEM_ADD, \"asset://test_item.json\")\r\n\t\tend\r\n\t\tTASK_kill(pGen)\r\n\tend\r\nend\r\n\r\nfunction sub_die(pGen, key)\r\nend\r\n\r\nfunction callback_scrollOver(pList, mode, items, length, pos)\r\n\tsyslog(string.format(\"mode[%d] items[%d]  length[%d]  pos[%d]\", mode, items, length, pos))\r\nend\r\n\r\nfunction textCallback(pTB, str, id)\r\n\tsyslog(string.format(\"<%d>[%s]\", id, str))\r\nend\r\n\r\nfunction listStop(pList, pos)\r\n\tsyslog(string.format(\"List STOP: %d\", pos))\r\nend\r\n\r\nfunction movie_callback(pTask)\r\n\r\nend\r\n\r\nfunction dragCallback(pList, type, tap_x, tap_y, mv_x, mv_y)\r\n\r\n\tsyslog(\"call lua callback.\")\r\n\tif type == PAD_ITEM_TAP then\r\n\t\t\r\n\telseif type == PAD_ITEM_DRAG then\r\n\telseif type == PAD_ITEM_RELEASE then\r\n\tend\r\n\t\r\nend\r\n\r\nfunction dynamic_callback(pList, index, itemId)\r\n\tsyslog(string.format(\"index[%d] itemId[%d]\", index, itemId))\r\n\tsysCommand(pList, UI_LIST_UPDATE_NODE, index, \"label\", FORM_LBL_SET_TEXT, string.format(\"item<%d> id<%d>\", index, itemId))\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/.publish/iphone/start.lua",
    "content": "--\r\nfunction setup()\r\n\tFONT_load(\"AlexBrush\",\"asset://AlexBrush-Regular-OTF.otf\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://List.lua\")\r\nend\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/.publish/iphone/test_item.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"label\",\n\t\t\"x\":0,\n\t\t\"y\":0,\n\t\t\"priority\":0,\n\t\t\"class\":\"label\",\n\t\t\"text\":\"幅300アイテム\",\n\t\t\"fontname\":\"\",\n\t\t\"fontsize\":20,\n\t\t\"color\":-13421773,\n\t\t\"width\":300,\n\t\t\"height\":360,\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":960,\n\t\"height\":640\n}"
  },
  {
    "path": "Tutorial/22.List/Alex Brush SIL OFL Font License 1.1.txt",
    "content": "Copyright (c) 2011 TypeSETit, LLC (typesetit@att.net),\nwith Reserved Font Name \"Alex Brush\"\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 1 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that the font\nnames of derivative works are changed. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Tutorial/22.List/List.lua",
    "content": "--\r\nfunction setup()\r\n\r\n\tpTask = UI_List(nil, 8000, 8200, 100, 100, 600, 400, 300, false, nil)\r\n\tsysCommand(pTask, UI_LIST_USE_SCROLLBAR,\r\n\t\t8200, true, 25, \"asset://scrbar.png.imag\", 25, nil, 0x80, 0xffffff, 0xff, 0xffffff, true, true)\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_ITEMMODE, LIST_ITEM_DYNAMIC, \"dynamic_callback\")\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_GROUP, \"group\")\r\n\tsysCommand(pTask, UI_LIST_SET_LOOPMODE, true)\r\n\tsysCommand(pTask, UI_LIST_SET_MARGIN, 0, 0)\r\n\t-- sysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"default\")\r\n\t-- sysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"solid\")\r\n\tsysCommand(pTask, UI_LIST_SELECT_SCRMGR, \"page\", 300, 10, 0)\r\n--\tsysCommand(pTask, UI_LIST_SCRMGR_CALLBACK, \"listStop\")\r\n--\tsysCommand(pTask, UI_LIST_SET_LIMITCLIP, true)\r\n\t--sysCommand(pTask, UI_LIST_SET_LIMITAREA, 600)\r\n\r\n\tprop = TASK_getProperty(pTask)\r\n\tprop.visible = true\r\n\tprop.default_scroll = true\r\n\tTASK_setProperty(pTask, prop)\r\n\r\n\tlocal form = CONV_JsonFile2Lua(\"asset://test_item.json\")\r\n\r\n\t\tfor i=1,40 do\r\n\t\t\tsysCommand(pTask, UI_LIST_ITEM_ADD, form, 300, i + 10000)\r\n--\t\t\tsysCommand(pTask, UI_LIST_UPDATE_NODE, i - 1, \"label\", FORM_LBL_SET_TEXT, string.format(\"item<%d>\", i))\r\n\t\tend\r\n\r\n\tsysCommand(pTask, UI_LIST_SET_INITIAL, 0)\r\n\t-- pText = UI_TextInput(nil, false, 50, 50, 200, 50, \"default text\", \"textCallback\", 100)\r\n\r\n\t--pImage1 = UI_VariableItem(nil, 9000, 0, 0, 100, 100, \"asset://test_tex.png.imag\")\r\n\t--pImage2 = UI_VariableItem(nil, 9000, 100, 0, 100, 100, \"asset://test_tex.png.imag\")\r\n\t--sysCommand(pImage2, UI_VARITEM_SET_UV, 50, 50, 100, 50)\r\n\ttblAsset = {\r\n\t\t\"asset://test_tex.png.imag\",\r\n\t\t\"asset://change_tex.png.imag\"\r\n\t}\r\n\t\r\n\tcount = 0\r\n\tpreItem = 1\r\n\tflag = false\r\nend\r\n\r\nfunction execute(deltaT)\r\n\r\n--[[\r\n\tcount = count + deltaT\r\n\tif count >= 1000 then\r\n\t\tcount = count - 1000\r\n\t\tpreItem = 1 - preItem\r\n\t\tsysCommand(pImage1, UI_VARITEM_CHANGE_ASSET, tblAsset[preItem + 1])\r\n\r\n\tend\r\n\t]]\r\nend\r\n\r\nfunction leave()\r\n\tpText = TASK_kill(pText)\r\n\tpTask = TASK_kill(pTask)\r\nend\r\n\r\n\r\nfunction sub_execute(pGen, deltaT, key)\r\n\tcount = count + 1\r\n\tsyslog(string.format(\"count = %d\", count))\r\n\tif count == 120 then\r\n\t\tfor i=1,30 do\r\n\t\t\tsysCommand(pTask, UI_LIST_ITEM_ADD, \"asset://test_item.json\")\r\n\t\tend\r\n\t\tTASK_kill(pGen)\r\n\tend\r\nend\r\n\r\nfunction sub_die(pGen, key)\r\nend\r\n\r\nfunction callback_scrollOver(pList, mode, items, length, pos)\r\n\tsyslog(string.format(\"mode[%d] items[%d]  length[%d]  pos[%d]\", mode, items, length, pos))\r\nend\r\n\r\nfunction textCallback(pTB, str, id)\r\n\tsyslog(string.format(\"<%d>[%s]\", id, str))\r\nend\r\n\r\nfunction listStop(pList, pos)\r\n\tsyslog(string.format(\"List STOP: %d\", pos))\r\nend\r\n\r\nfunction movie_callback(pTask)\r\n\r\nend\r\n\r\nfunction dragCallback(pList, type, tap_x, tap_y, mv_x, mv_y)\r\n\r\n\tsyslog(\"call lua callback.\")\r\n\tif type == PAD_ITEM_TAP then\r\n\t\t\r\n\telseif type == PAD_ITEM_DRAG then\r\n\telseif type == PAD_ITEM_RELEASE then\r\n\tend\r\n\t\r\nend\r\n\r\nfunction dynamic_callback(pList, index, itemId)\r\n\tsyslog(string.format(\"index[%d] itemId[%d]\", index, itemId))\r\n\tsysCommand(pList, UI_LIST_UPDATE_NODE, index, \"label\", FORM_LBL_SET_TEXT, string.format(\"item<%d> id<%d>\", index, itemId))\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/change_tex.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"eeed4d43-8333-4739-aa08-e5d7a9d3b702\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>change_tex.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-09T15:01:57</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>2991</ImgFileSize>\r\n    <ImgFileDate>26/10/2012 15:10:24</ImgFileDate>\r\n    <ImgPathName>change_tex.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>200</Width>\r\n    <Height>150</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>200</Width>\r\n        <Height>150</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>200</Width>\r\n      <Height>150</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>150</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>150</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>200</MaskWidth>\r\n    <MaskHeight>150</MaskHeight>\r\n    <Mask>dTAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/22.List/scr_bar.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"2323b9c1-7c67-48f3-b513-39fa253beaa1\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>scr_bar.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-09-18T18:58:14</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>256</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>scrbar.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>scrbar.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>32</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>test_tex.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>test_tex.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>240</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>change_tex.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>change_tex.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/22.List/scrbar.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"bde51b73-154d-45c1-9ceb-e05f1dbc6a14\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>scrbar.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-09T15:01:57</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>215</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:27</ImgFileDate>\r\n    <ImgPathName>scrbar.png</ImgPathName>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">2</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">36</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">2</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>25</Width>\r\n    <Height>40</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>25</Width>\r\n        <Height>40</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>25</Width>\r\n      <Height>40</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>25</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>25</X>\r\n        <Y>40</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>40</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>25</MaskWidth>\r\n    <MaskHeight>40</MaskHeight>\r\n    <Mask>A+gB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/22.List/start.lua",
    "content": "--\r\nfunction setup()\r\n\tFONT_load(\"AlexBrush\",\"asset://AlexBrush-Regular-OTF.otf\")\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://List.lua\")\r\nend\r\n\r\nfunction leave()\r\nend\r\n"
  },
  {
    "path": "Tutorial/22.List/test_item.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBUIEditor_Plugin id=\"a03b3a74-aebd-458c-bf07-fed06ee51046\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <DrawingAllNodesClickableRegion>true</DrawingAllNodesClickableRegion>\r\n  <DrawingFingerNode>true</DrawingFingerNode>\r\n  <DrawingGrid>true</DrawingGrid>\r\n  <DrawingNodeClipRegion>true</DrawingNodeClipRegion>\r\n  <DrawingNodeName>true</DrawingNodeName>\r\n  <FormBounds xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>552</d1p1:height>\r\n    <d1p1:width>833</d1p1:width>\r\n    <d1p1:x>3</d1p1:x>\r\n    <d1p1:y>48</d1p1:y>\r\n  </FormBounds>\r\n  <GridSize>10</GridSize>\r\n  <GuideForFourSplit>false</GuideForFourSplit>\r\n  <GuideForMargin>false</GuideForMargin>\r\n  <GuideForThreeSplit>false</GuideForThreeSplit>\r\n  <LayoutPpi>326</LayoutPpi>\r\n  <LayoutScale>1</LayoutScale>\r\n  <LayoutSize xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>640</d1p1:height>\r\n    <d1p1:width>960</d1p1:width>\r\n  </LayoutSize>\r\n  <RootNode>\r\n    <name>root</name>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <priority>0</priority>\r\n    <sub>\r\n      <UINode>\r\n        <name>label</name>\r\n        <x>0</x>\r\n        <y>0</y>\r\n        <priority>0</priority>\r\n        <class>label</class>\r\n        <text>幅300アイテム</text>\r\n        <fontname></fontname>\r\n        <fontsize>20</fontsize>\r\n        <_x0023_color xmlns:d4p1=\"http://www.w3.org/2001/XMLSchema\" i:type=\"d4p1:int\">-13421773</_x0023_color>\r\n        <width>300</width>\r\n        <height>360</height>\r\n        <_x0040_Publishable>true</_x0040_Publishable>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n    </sub>\r\n    <width>960</width>\r\n    <height>640</height>\r\n    <_x0040_Publishable>true</_x0040_Publishable>\r\n    <_x0040_CommonAssets xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n      <d2p1:string i:nil=\"true\" />\r\n    </_x0040_CommonAssets>\r\n  </RootNode>\r\n  <WindowState>Normal</WindowState>\r\n</KLBUIEditor_Plugin>"
  },
  {
    "path": "Tutorial/22.List/test_tex.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"4caaec24-7906-458d-9caf-6beac97a0b40\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>test_tex.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-11-09T15:01:57</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>1880</ImgFileSize>\r\n    <ImgFileDate>26/10/2012 15:10:24</ImgFileDate>\r\n    <ImgPathName>test_tex.png</ImgPathName>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>200</Width>\r\n    <Height>150</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>200</Width>\r\n        <Height>150</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>200</Width>\r\n      <Height>150</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>200</X>\r\n        <Y>150</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>150</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>200</MaskWidth>\r\n    <MaskHeight>150</MaskHeight>\r\n    <Mask>dTAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/android/list.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"task_list1\",\n\t\t\"x\":21,\n\t\t\"y\":21,\n\t\t\"priority\":35,\n\t\t\"class\":\"task_list\",\n\t\t\"cliph\":500,\n\t\t\"clipw\":500,\n\t\t\"clipend\":9999,\n\t\t\"width\":60,\n\t\t\"height\":60,\n\t\t\"callback\":\"callback\",\n\t\t\"orientation\":0,\n\t\t\"align\":0,\n\t\t\"splinemask\":508,\n\t\t\"splinecount\":256,\n\t\t\"splinedata\":[4,\n\t\t0.095,\n\t\t31,\n\t\t4.486,\n\t\t0.204,\n\t\t0.013,\n\t\t0.204,\n\t\t0.013,\n\t\t0.004,\n\t\t0.018,\n\t\t0,\n\t\t0.017,\n\t\t0.009,\n\t\t0.017,\n\t\t0.004,\n\t\t0.065,\n\t\t90.796,\n\t\t-1.171,\n\t\t0,\n\t\t0.821,\n\t\t4.095,\n\t\t0.13,\n\t\t36,\n\t\t4.427,\n\t\t0.217,\n\t\t0.015,\n\t\t0.217,\n\t\t0.015,\n\t\t0.022,\n\t\t0.019,\n\t\t0.017,\n\t\t0.018,\n\t\t0.026,\n\t\t0.018,\n\t\t0.069,\n\t\t0.068,\n\t\t89.625,\n\t\t-1.172,\n\t\t0.821,\n\t\t0.847,\n\t\t4.224,\n\t\t0.026,\n\t\t40,\n\t\t0.773,\n\t\t0.232,\n\t\t0.014,\n\t\t0.232,\n\t\t0.014,\n\t\t0.041,\n\t\t0.018,\n\t\t0.035,\n\t\t0.017,\n\t\t0.044,\n\t\t0.018,\n\t\t0.137,\n\t\t0.064,\n\t\t88.453,\n\t\t-1.172,\n\t\t1.668,\n\t\t0.858,\n\t\t4.251,\n\t\t0.17,\n\t\t41,\n\t\t4.342,\n\t\t0.246,\n\t\t0.014,\n\t\t0.246,\n\t\t0.014,\n\t\t0.059,\n\t\t0.019,\n\t\t0.052,\n\t\t0.018,\n\t\t0.062,\n\t\t0.018,\n\t\t0.201,\n\t\t0.06,\n\t\t87.281,\n\t\t-1.172,\n\t\t2.526,\n\t\t0.861,\n\t\t4.42,\n\t\t0.032,\n\t\t45,\n\t\t0.73,\n\t\t0.26,\n\t\t0.014,\n\t\t0.26,\n\t\t0.014,\n\t\t0.078,\n\t\t0.018,\n\t\t0.07,\n\t\t0.018,\n\t\t0.08,\n\t\t0.018,\n\t\t0.261,\n\t\t0.056,\n\t\t86.109,\n\t\t-1.172,\n\t\t3.387,\n\t\t0.868,\n\t\t4.452,\n\t\t0.208,\n\t\t46,\n\t\t4.257,\n\t\t0.274,\n\t\t0.014,\n\t\t0.274,\n\t\t0.014,\n\t\t0.096,\n\t\t0.019,\n\t\t0.088,\n\t\t0.017,\n\t\t0.098,\n\t\t0.018,\n\t\t0.317,\n\t\t0.052,\n\t\t84.937,\n\t\t-1.172,\n\t\t4.255,\n\t\t0.867,\n\t\t4.661,\n\t\t0.241,\n\t\t50,\n\t\t4.199,\n\t\t0.288,\n\t\t0.015,\n\t\t0.288,\n\t\t0.015,\n\t\t0.115,\n\t\t0.018,\n\t\t0.105,\n\t\t0.018,\n\t\t0.116,\n\t\t0.018,\n\t\t0.369,\n\t\t0.048,\n\t\t83.765,\n\t\t-1.172,\n\t\t5.122,\n\t\t0.869,\n\t\t4.902,\n\t\t0.041,\n\t\t55,\n\t\t0.661,\n\t\t0.303,\n\t\t0.014,\n\t\t0.303,\n\t\t0.014,\n\t\t0.133,\n\t\t0.018,\n\t\t0.123,\n\t\t0.018,\n\t\t0.134,\n\t\t0.018,\n\t\t0.417,\n\t\t0.043,\n\t\t82.593,\n\t\t-1.172,\n\t\t5.991,\n\t\t0.87,\n\t\t4.943,\n\t\t0.278,\n\t\t55,\n\t\t4.115,\n\t\t0.317,\n\t\t0.014,\n\t\t0.317,\n\t\t0.014,\n\t\t0.151,\n\t\t0.019,\n\t\t0.141,\n\t\t0.017,\n\t\t0.152,\n\t\t0.018,\n\t\t0.46,\n\t\t0.038,\n\t\t81.421,\n\t\t-1.171,\n\t\t6.861,\n\t\t0.871,\n\t\t5.221,\n\t\t0.045,\n\t\t59,\n\t\t0.619,\n\t\t0.331,\n\t\t0.014,\n\t\t0.331,\n\t\t0.014,\n\t\t0.17,\n\t\t0.018,\n\t\t0.158,\n\t\t0.018,\n\t\t0.17,\n\t\t0.018,\n\t\t0.498,\n\t\t0.034,\n\t\t80.25,\n\t\t-1.172,\n\t\t7.732,\n\t\t0.871,\n\t\t5.266,\n\t\t0.313,\n\t\t60,\n\t\t4.032,\n\t\t0.345,\n\t\t0.014,\n\t\t0.345,\n\t\t0.014,\n\t\t0.188,\n\t\t0.019,\n\t\t0.176,\n\t\t0.018,\n\t\t0.188,\n\t\t0.018,\n\t\t0.532,\n\t\t0.029,\n\t\t79.078,\n\t\t-1.172,\n\t\t8.603,\n\t\t0.872,\n\t\t5.579,\n\t\t0.344,\n\t\t64,\n\t\t3.974,\n\t\t0.359,\n\t\t0.014,\n\t\t0.359,\n\t\t0.014,\n\t\t0.207,\n\t\t0.018,\n\t\t0.194,\n\t\t0.017,\n\t\t0.206,\n\t\t0.018,\n\t\t0.561,\n\t\t0.024,\n\t\t77.906,\n\t\t-1.172,\n\t\t9.475,\n\t\t0.871,\n\t\t5.924,\n\t\t0.051,\n\t\t68,\n\t\t0.551,\n\t\t0.373,\n\t\t0.015,\n\t\t0.373,\n\t\t0.015,\n\t\t0.225,\n\t\t0.018,\n\t\t0.211,\n\t\t0.018,\n\t\t0.224,\n\t\t0.017,\n\t\t0.585,\n\t\t0.019,\n\t\t76.734,\n\t\t-1.172,\n\t\t10.346,\n\t\t0.872,\n\t\t5.974,\n\t\t0.377,\n\t\t68,\n\t\t3.892,\n\t\t0.388,\n\t\t0.014,\n\t\t0.388,\n\t\t0.014,\n\t\t0.243,\n\t\t0.019,\n\t\t0.229,\n\t\t0.017,\n\t\t0.241,\n\t\t0.018,\n\t\t0.604,\n\t\t0.014,\n\t\t75.562,\n\t\t-1.172,\n\t\t11.218,\n\t\t0.872,\n\t\t6.352,\n\t\t0.407,\n\t\t72,\n\t\t3.835,\n\t\t0.402,\n\t\t0.014,\n\t\t0.402,\n\t\t0.014,\n\t\t0.262,\n\t\t0.018,\n\t\t0.246,\n\t\t0.018,\n\t\t0.259,\n\t\t0.018,\n\t\t0.618,\n\t\t0.006,\n\t\t74.39,\n\t\t-1.172,\n\t\t12.09,\n\t\t0.871,\n\t\t6.759,\n\t\t0.054,\n\t\t76,\n\t\t0.485,\n\t\t0.416,\n\t\t0.014,\n\t\t0.416,\n\t\t0.014,\n\t\t0.28,\n\t\t0.018,\n\t\t0.264,\n\t\t0.017,\n\t\t0.277,\n\t\t0.018,\n\t\t0.624,\n\t\t0.005,\n\t\t73.218,\n\t\t-1.172,\n\t\t12.961,\n\t\t0.871,\n\t\t6.813,\n\t\t0.438,\n\t\t77,\n\t\t3.754,\n\t\t0.43,\n\t\t0.014,\n\t\t0.43,\n\t\t0.014,\n\t\t0.298,\n\t\t0.018,\n\t\t0.281,\n\t\t0.018,\n\t\t0.295,\n\t\t0.018,\n\t\t0.629,\n\t\t0.006,\n\t\t72.046,\n\t\t-1.172,\n\t\t13.832,\n\t\t0.872,\n\t\t7.251,\n\t\t0.466,\n\t\t80,\n\t\t3.698,\n\t\t0.444,\n\t\t0.014,\n\t\t0.444,\n\t\t0.014,\n\t\t0.316,\n\t\t0.019,\n\t\t0.299,\n\t\t0.017,\n\t\t0.313,\n\t\t0.017,\n\t\t0.635,\n\t\t0.005,\n\t\t70.874,\n\t\t-1.172,\n\t\t14.704,\n\t\t0.87,\n\t\t7.717,\n\t\t0.494,\n\t\t84,\n\t\t3.642,\n\t\t0.458,\n\t\t0.014,\n\t\t0.458,\n\t\t0.014,\n\t\t0.335,\n\t\t0.018,\n\t\t0.316,\n\t\t0.018,\n\t\t0.33,\n\t\t0.018,\n\t\t0.64,\n\t\t0.004,\n\t\t69.702,\n\t\t-1.172,\n\t\t15.574,\n\t\t0.871,\n\t\t8.212,\n\t\t0.056,\n\t\t88,\n\t\t0.394,\n\t\t0.472,\n\t\t0.014,\n\t\t0.472,\n\t\t0.014,\n\t\t0.353,\n\t\t0.018,\n\t\t0.334,\n\t\t0.017,\n\t\t0.348,\n\t\t0.018,\n\t\t0.644,\n\t\t0.005,\n\t\t68.53,\n\t\t-1.172,\n\t\t16.445,\n\t\t0.87,\n\t\t8.267,\n\t\t0.522,\n\t\t88,\n\t\t3.562,\n\t\t0.486,\n\t\t0.014,\n\t\t0.486,\n\t\t0.014,\n\t\t0.371,\n\t\t0.018,\n\t\t0.351,\n\t\t0.017,\n\t\t0.366,\n\t\t0.017,\n\t\t0.649,\n\t\t0.004,\n\t\t67.358,\n\t\t-1.171,\n\t\t17.315,\n\t\t0.869,\n\t\t8.79,\n\t\t0.549,\n\t\t92,\n\t\t3.507,\n\t\t0.5,\n\t\t0.014,\n\t\t0.5,\n\t\t0.014,\n\t\t0.389,\n\t\t0.018,\n\t\t0.368,\n\t\t0.018,\n\t\t0.383,\n\t\t0.018,\n\t\t0.653,\n\t\t0.005,\n\t\t66.187,\n\t\t-1.172,\n\t\t18.184,\n\t\t0.87,\n\t\t9.338,\n\t\t0.575,\n\t\t95,\n\t\t3.453,\n\t\t0.514,\n\t\t0.014,\n\t\t0.514,\n\t\t0.014,\n\t\t0.407,\n\t\t0.018,\n\t\t0.386,\n\t\t0.017,\n\t\t0.401,\n\t\t0.017,\n\t\t0.658,\n\t\t0.004,\n\t\t65.015,\n\t\t-1.172,\n\t\t19.054,\n\t\t0.869,\n\t\t9.913,\n\t\t0.6,\n\t\t99,\n\t\t3.398,\n\t\t0.528,\n\t\t0.014,\n\t\t0.528,\n\t\t0.014,\n\t\t0.425,\n\t\t0.018,\n\t\t0.403,\n\t\t0.017,\n\t\t0.418,\n\t\t0.018,\n\t\t0.662,\n\t\t0.004,\n\t\t63.843,\n\t\t-1.172,\n\t\t19.923,\n\t\t0.868,\n\t\t10.513,\n\t\t0.051,\n\t\t102,\n\t\t0.282,\n\t\t0.542,\n\t\t0.014,\n\t\t0.542,\n\t\t0.014,\n\t\t0.443,\n\t\t0.018,\n\t\t0.42,\n\t\t0.017,\n\t\t0.436,\n\t\t0.017,\n\t\t0.666,\n\t\t0.004,\n\t\t62.671,\n\t\t-1.172,\n\t\t20.791,\n\t\t0.867,\n\t\t10.564,\n\t\t0.623,\n\t\t102,\n\t\t3.321,\n\t\t0.556,\n\t\t0.014,\n\t\t0.556,\n\t\t0.014,\n\t\t0.461,\n\t\t0.018,\n\t\t0.437,\n\t\t0.018,\n\t\t0.453,\n\t\t0.018,\n\t\t0.67,\n\t\t0.004,\n\t\t61.499,\n\t\t-1.172,\n\t\t21.658,\n\t\t0.868,\n\t\t11.187,\n\t\t0.647,\n\t\t106,\n\t\t3.267,\n\t\t0.57,\n\t\t0.013,\n\t\t0.57,\n\t\t0.013,\n\t\t0.479,\n\t\t0.018,\n\t\t0.455,\n\t\t0.017,\n\t\t0.471,\n\t\t0.017,\n\t\t0.674,\n\t\t0.004,\n\t\t60.327,\n\t\t-1.171,\n\t\t22.526,\n\t\t0.867,\n\t\t11.835,\n\t\t0.671,\n\t\t109,\n\t\t3.214,\n\t\t0.583,\n\t\t0.014,\n\t\t0.583,\n\t\t0.014,\n\t\t0.497,\n\t\t0.017,\n\t\t0.472,\n\t\t0.017,\n\t\t0.488,\n\t\t0.018,\n\t\t0.678,\n\t\t0.005,\n\t\t59.156,\n\t\t-1.172,\n\t\t23.393,\n\t\t0.866,\n\t\t12.506,\n\t\t0.694,\n\t\t112,\n\t\t3.162,\n\t\t0.597,\n\t\t0.014,\n\t\t0.597,\n\t\t0.014,\n\t\t0.514,\n\t\t0.018,\n\t\t0.489,\n\t\t0.017,\n\t\t0.506,\n\t\t0.017,\n\t\t0.683,\n\t\t0.004,\n\t\t57.984,\n\t\t-1.172,\n\t\t24.259,\n\t\t0.866,\n\t\t13.199,\n\t\t0.716,\n\t\t115,\n\t\t3.109,\n\t\t0.611,\n\t\t0.014,\n\t\t0.611,\n\t\t0.014,\n\t\t0.532,\n\t\t0.018,\n\t\t0.506,\n\t\t0.017,\n\t\t0.523,\n\t\t0.017,\n\t\t0.687,\n\t\t0.004,\n\t\t56.812,\n\t\t-1.172,\n\t\t25.125,\n\t\t0.864,\n\t\t13.915,\n\t\t0.738,\n\t\t118,\n\t\t3.057,\n\t\t0.625,\n\t\t0.013,\n\t\t0.625,\n\t\t0.013,\n\t\t0.55,\n\t\t0.017,\n\t\t0.523,\n\t\t0.017,\n\t\t0.54,\n\t\t0.017,\n\t\t0.691,\n\t\t0.004,\n\t\t55.64,\n\t\t-1.172,\n\t\t25.989,\n\t\t0.865,\n\t\t14.653,\n\t\t0.032,\n\t\t122,\n\t\t0.131,\n\t\t0.638,\n\t\t0.014,\n\t\t0.638,\n\t\t0.014,\n\t\t0.567,\n\t\t0.018,\n\t\t0.54,\n\t\t0.016,\n\t\t0.557,\n\t\t0.017,\n\t\t0.695,\n\t\t0.003,\n\t\t54.468,\n\t\t-1.171,\n\t\t26.854,\n\t\t0.864,\n\t\t14.686,\n\t\t0.755,\n\t\t122,\n\t\t2.984,\n\t\t0.652,\n\t\t0.013,\n\t\t0.652,\n\t\t0.013,\n\t\t0.585,\n\t\t0.017,\n\t\t0.556,\n\t\t0.017,\n\t\t0.574,\n\t\t0.017,\n\t\t0.698,\n\t\t0.004,\n\t\t53.297,\n\t\t-1.172,\n\t\t27.718,\n\t\t0.863,\n\t\t15.441,\n\t\t0.775,\n\t\t125,\n\t\t2.933,\n\t\t0.665,\n\t\t0.014,\n\t\t0.665,\n\t\t0.014,\n\t\t0.602,\n\t\t0.017,\n\t\t0.573,\n\t\t0.017,\n\t\t0.591,\n\t\t0.017,\n\t\t0.702,\n\t\t0.004,\n\t\t52.125,\n\t\t-1.172,\n\t\t28.581,\n\t\t0.863,\n\t\t16.216,\n\t\t0.795,\n\t\t128,\n\t\t2.883,\n\t\t0.679,\n\t\t0.013,\n\t\t0.679,\n\t\t0.013,\n\t\t0.619,\n\t\t0.017,\n\t\t0.59,\n\t\t0.017,\n\t\t0.608,\n\t\t0.017,\n\t\t0.706,\n\t\t0.004,\n\t\t50.953,\n\t\t-1.172,\n\t\t29.444,\n\t\t0.861,\n\t\t17.011,\n\t\t0.814,\n\t\t130,\n\t\t2.833,\n\t\t0.692,\n\t\t0.014,\n\t\t0.692,\n\t\t0.014,\n\t\t0.636,\n\t\t0.018,\n\t\t0.607,\n\t\t0.016,\n\t\t0.625,\n\t\t0.017,\n\t\t0.71,\n\t\t0.004,\n\t\t49.781,\n\t\t-1.171,\n\t\t30.305,\n\t\t0.861,\n\t\t17.825,\n\t\t0.833,\n\t\t133,\n\t\t2.784,\n\t\t0.706,\n\t\t0.013,\n\t\t0.706,\n\t\t0.013,\n\t\t0.654,\n\t\t0.017,\n\t\t0.623,\n\t\t0.017,\n\t\t0.642,\n\t\t0.017,\n\t\t0.714,\n\t\t0.004,\n\t\t48.61,\n\t\t-1.172,\n\t\t31.166,\n\t\t0.86,\n\t\t18.658,\n\t\t0.851,\n\t\t136,\n\t\t2.735,\n\t\t0.719,\n\t\t0.014,\n\t\t0.719,\n\t\t0.014,\n\t\t0.671,\n\t\t0.016,\n\t\t0.64,\n\t\t0.016,\n\t\t0.659,\n\t\t0.016,\n\t\t0.718,\n\t\t0.004,\n\t\t47.438,\n\t\t-1.172,\n\t\t32.026,\n\t\t0.86,\n\t\t19.509,\n\t\t0.868,\n\t\t139,\n\t\t2.686,\n\t\t0.733,\n\t\t0.013,\n\t\t0.733,\n\t\t0.013,\n\t\t0.687,\n\t\t0.017,\n\t\t0.656,\n\t\t0.016,\n\t\t0.675,\n\t\t0.017,\n\t\t0.722,\n\t\t0.003,\n\t\t46.266,\n\t\t-1.171,\n\t\t32.886,\n\t\t0.859,\n\t\t20.377,\n\t\t0.885,\n\t\t141,\n\t\t2.638,\n\t\t0.746,\n\t\t0.013,\n\t\t0.746,\n\t\t0.013,\n\t\t0.704,\n\t\t0.017,\n\t\t0.672,\n\t\t0.016,\n\t\t0.692,\n\t\t0.016,\n\t\t0.725,\n\t\t0.004,\n\t\t45.095,\n\t\t-1.172,\n\t\t33.745,\n\t\t0.859,\n\t\t21.262,\n\t\t0.902,\n\t\t144,\n\t\t2.591,\n\t\t0.759,\n\t\t0.013,\n\t\t0.759,\n\t\t0.013,\n\t\t0.721,\n\t\t0.016,\n\t\t0.688,\n\t\t0.016,\n\t\t0.708,\n\t\t0.017,\n\t\t0.729,\n\t\t0.004,\n\t\t43.923,\n\t\t-1.172,\n\t\t34.604,\n\t\t0.856,\n\t\t22.164,\n\t\t0.918,\n\t\t147,\n\t\t2.544,\n\t\t0.772,\n\t\t0.013,\n\t\t0.772,\n\t\t0.013,\n\t\t0.737,\n\t\t0.016,\n\t\t0.704,\n\t\t0.016,\n\t\t0.725,\n\t\t0.016,\n\t\t0.733,\n\t\t0.004,\n\t\t42.751,\n\t\t-1.171,\n\t\t35.46,\n\t\t0.858,\n\t\t23.082,\n\t\t0.933,\n\t\t149,\n\t\t2.498,\n\t\t0.785,\n\t\t0.013,\n\t\t0.785,\n\t\t0.013,\n\t\t0.753,\n\t\t0.016,\n\t\t0.72,\n\t\t0.016,\n\t\t0.741,\n\t\t0.016,\n\t\t0.737,\n\t\t0.003,\n\t\t41.58,\n\t\t-1.172,\n\t\t36.318,\n\t\t0.854,\n\t\t24.015,\n\t\t0.948,\n\t\t152,\n\t\t2.453,\n\t\t0.798,\n\t\t0.012,\n\t\t0.798,\n\t\t0.012,\n\t\t0.769,\n\t\t0.016,\n\t\t0.736,\n\t\t0.015,\n\t\t0.757,\n\t\t0.015,\n\t\t0.74,\n\t\t0.004,\n\t\t40.408,\n\t\t-1.172,\n\t\t37.172,\n\t\t0.856,\n\t\t24.963,\n\t\t0.963,\n\t\t154,\n\t\t2.408,\n\t\t0.81,\n\t\t0.013,\n\t\t0.81,\n\t\t0.013,\n\t\t0.785,\n\t\t0.015,\n\t\t0.751,\n\t\t0.016,\n\t\t0.772,\n\t\t0.016,\n\t\t0.744,\n\t\t0.004,\n\t\t39.236,\n\t\t-1.171,\n\t\t38.028,\n\t\t0.853,\n\t\t25.926,\n\t\t2.032,\n\t\t157,\n\t\t4.834,\n\t\t0.823,\n\t\t0.012,\n\t\t0.823,\n\t\t0.012,\n\t\t0.8,\n\t\t0.015,\n\t\t0.767,\n\t\t0.015,\n\t\t0.788,\n\t\t0.015,\n\t\t0.748,\n\t\t0.003,\n\t\t38.065,\n\t\t-1.172,\n\t\t38.881,\n\t\t0.853,\n\t\t27.958,\n\t\t1.012,\n\t\t161,\n\t\t2.292,\n\t\t0.835,\n\t\t0.012,\n\t\t0.835,\n\t\t0.012,\n\t\t0.815,\n\t\t0.015,\n\t\t0.782,\n\t\t0.015,\n\t\t0.803,\n\t\t0.015,\n\t\t0.751,\n\t\t0.004,\n\t\t36.893,\n\t\t-1.171,\n\t\t39.734,\n\t\t0.853,\n\t\t28.97,\n\t\t1.025,\n\t\t164,\n\t\t2.25,\n\t\t0.847,\n\t\t0.012,\n\t\t0.847,\n\t\t0.012,\n\t\t0.83,\n\t\t0.014,\n\t\t0.797,\n\t\t0.014,\n\t\t0.818,\n\t\t0.015,\n\t\t0.755,\n\t\t0.004,\n\t\t35.722,\n\t\t-1.172,\n\t\t40.587,\n\t\t0.851,\n\t\t29.995,\n\t\t1.038,\n\t\t166,\n\t\t2.208,\n\t\t0.859,\n\t\t0.012,\n\t\t0.859,\n\t\t0.012,\n\t\t0.844,\n\t\t0.013,\n\t\t0.811,\n\t\t0.014,\n\t\t0.833,\n\t\t0.014,\n\t\t0.759,\n\t\t0.003,\n\t\t34.55,\n\t\t-1.171,\n\t\t41.438,\n\t\t0.852,\n\t\t31.033,\n\t\t1.05,\n\t\t168,\n\t\t2.166,\n\t\t0.871,\n\t\t0.011,\n\t\t0.871,\n\t\t0.011,\n\t\t0.857,\n\t\t0.013,\n\t\t0.825,\n\t\t0.014,\n\t\t0.847,\n\t\t0.013,\n\t\t0.762,\n\t\t0.004,\n\t\t33.379,\n\t\t-1.172,\n\t\t42.29,\n\t\t0.848,\n\t\t32.082,\n\t\t1.061,\n\t\t170,\n\t\t2.126,\n\t\t0.882,\n\t\t0.011,\n\t\t0.882,\n\t\t0.011,\n\t\t0.87,\n\t\t0.007,\n\t\t0.839,\n\t\t0.011,\n\t\t0.86,\n\t\t0.014,\n\t\t0.766,\n\t\t0.004,\n\t\t32.207,\n\t\t-1.171,\n\t\t43.138,\n\t\t0.848,\n\t\t33.144,\n\t\t2.283,\n\t\t172,\n\t\t4.368,\n\t\t0.893,\n\t\t0.009,\n\t\t0.893,\n\t\t0.009,\n\t\t0.877,\n\t\t0.004,\n\t\t0.85,\n\t\t0.013,\n\t\t0.874,\n\t\t0.01,\n\t\t0.77,\n\t\t0.003,\n\t\t31.036,\n\t\t-1.172,\n\t\t43.986,\n\t\t0.848,\n\t\t35.426,\n\t\t1.105,\n\t\t177,\n\t\t2.021,\n\t\t0.902,\n\t\t0.006,\n\t\t0.902,\n\t\t0.006,\n\t\t0.881,\n\t\t0.005,\n\t\t0.863,\n\t\t0.005,\n\t\t0.884,\n\t\t0.007,\n\t\t0.773,\n\t\t0.004,\n\t\t29.864,\n\t\t-1.171,\n\t\t44.834,\n\t\t0.846,\n\t\t36.531,\n\t\t1.115,\n\t\t179,\n\t\t1.983,\n\t\t0.908,\n\t\t0.003,\n\t\t0.908,\n\t\t0.003,\n\t\t0.886,\n\t\t0.003,\n\t\t0.868,\n\t\t0.005,\n\t\t0.891,\n\t\t0.005,\n\t\t0.777,\n\t\t0.003,\n\t\t28.693,\n\t\t-1.171,\n\t\t45.68,\n\t\t0.847,\n\t\t37.646,\n\t\t1.126,\n\t\t181,\n\t\t1.945,\n\t\t0.911,\n\t\t0.004,\n\t\t0.911,\n\t\t0.004,\n\t\t0.889,\n\t\t0.004,\n\t\t0.873,\n\t\t0.005,\n\t\t0.896,\n\t\t0.003,\n\t\t0.78,\n\t\t0.004,\n\t\t27.522,\n\t\t-1.172,\n\t\t46.527,\n\t\t0.843,\n\t\t38.772,\n\t\t1.136,\n\t\t183,\n\t\t1.909,\n\t\t0.915,\n\t\t0.002,\n\t\t0.915,\n\t\t0.002,\n\t\t0.893,\n\t\t0.003,\n\t\t0.878,\n\t\t0.003,\n\t\t0.899,\n\t\t0.003,\n\t\t0.784,\n\t\t0.004,\n\t\t26.35,\n\t\t-1.171,\n\t\t47.37,\n\t\t0.844,\n\t\t39.908,\n\t\t2.484,\n\t\t185,\n\t\t3.998,\n\t\t0.917,\n\t\t0.003,\n\t\t0.917,\n\t\t0.003,\n\t\t0.896,\n\t\t0.003,\n\t\t0.881,\n\t\t0.004,\n\t\t0.902,\n\t\t0.004,\n\t\t0.788,\n\t\t0.003,\n\t\t25.179,\n\t\t-1.171,\n\t\t48.214,\n\t\t0.843,\n\t\t42.392,\n\t\t1.176,\n\t\t189,\n\t\t1.813,\n\t\t0.92,\n\t\t0.002,\n\t\t0.92,\n\t\t0.002,\n\t\t0.899,\n\t\t0.003,\n\t\t0.885,\n\t\t0.003,\n\t\t0.906,\n\t\t0.003,\n\t\t0.791,\n\t\t0.004,\n\t\t24.008,\n\t\t-1.171,\n\t\t49.057,\n\t\t0.84,\n\t\t43.567,\n\t\t1.185,\n\t\t191,\n\t\t1.78,\n\t\t0.922,\n\t\t0.002,\n\t\t0.922,\n\t\t0.002,\n\t\t0.902,\n\t\t0.002,\n\t\t0.888,\n\t\t0.002,\n\t\t0.909,\n\t\t0.003,\n\t\t0.795,\n\t\t0.003,\n\t\t22.837,\n\t\t-1.171,\n\t\t49.897,\n\t\t0.842,\n\t\t44.753,\n\t\t2.617,\n\t\t192,\n\t\t3.768,\n\t\t0.924,\n\t\t0.002,\n\t\t0.924,\n\t\t0.002,\n\t\t0.904,\n\t\t0.003,\n\t\t0.89,\n\t\t0.004,\n\t\t0.912,\n\t\t0.002,\n\t\t0.798,\n\t\t0.004,\n\t\t21.666,\n\t\t-1.172,\n\t\t50.739,\n\t\t0.837,\n\t\t47.37,\n\t\t1.224,\n\t\t196,\n\t\t1.69,\n\t\t0.926,\n\t\t0.001,\n\t\t0.926,\n\t\t0.001,\n\t\t0.907,\n\t\t0.003,\n\t\t0.894,\n\t\t0.002,\n\t\t0.914,\n\t\t0.002,\n\t\t0.802,\n\t\t0.003,\n\t\t20.494,\n\t\t-1.171,\n\t\t51.576,\n\t\t0.838,\n\t\t48.594,\n\t\t1.234,\n\t\t198,\n\t\t1.659,\n\t\t0.927,\n\t\t0.002,\n\t\t0.927,\n\t\t0.002,\n\t\t0.91,\n\t\t0.002,\n\t\t0.896,\n\t\t0.002,\n\t\t0.916,\n\t\t0.003,\n\t\t0.805,\n\t\t0.004,\n\t\t19.323,\n\t\t-1.171,\n\t\t52.414,\n\t\t0.837,\n\t\t49.827,\n\t\t1.243,\n\t\t199,\n\t\t1.63,\n\t\t0.929,\n\t\t0.002,\n\t\t0.929,\n\t\t0.002,\n\t\t0.912,\n\t\t0.003,\n\t\t0.898,\n\t\t0.003,\n\t\t0.919,\n\t\t0.002,\n\t\t0.809,\n\t\t0.003,\n\t\t18.152,\n\t\t-1.171,\n\t\t53.251,\n\t\t0.835,\n\t\t51.071,\n\t\t2.778,\n\t\t201,\n\t\t3.495,\n\t\t0.931,\n\t\t0.002,\n\t\t0.931,\n\t\t0.002,\n\t\t0.915,\n\t\t0.002,\n\t\t0.901,\n\t\t0.003,\n\t\t0.921,\n\t\t0.002,\n\t\t0.812,\n\t\t0.004,\n\t\t16.981,\n\t\t-1.17,\n\t\t54.086,\n\t\t0.836,\n\t\t53.848,\n\t\t1.282,\n\t\t205,\n\t\t1.548,\n\t\t0.933,\n\t\t0.001,\n\t\t0.933,\n\t\t0.001,\n\t\t0.917,\n\t\t0.002,\n\t\t0.904,\n\t\t0.002,\n\t\t0.923,\n\t\t0.002,\n\t\t0.816,\n\t\t0.003,\n\t\t15.811,\n\t\t-1.171,\n\t\t54.922,\n\t\t0.831,\n\t\t55.13,\n\t\t1.292,\n\t\t206,\n\t\t1.521,\n\t\t0.934,\n\t\t0.001,\n\t\t0.934,\n\t\t0.001,\n\t\t0.919,\n\t\t0.002,\n\t\t0.906,\n\t\t0.002,\n\t\t0.925,\n\t\t0.003,\n\t\t0.819,\n\t\t0.004,\n\t\t14.64,\n\t\t-1.171,\n\t\t55.753,\n\t\t0.831,\n\t\t56.422,\n\t\t2.909,\n\t\t208,\n\t\t3.288,\n\t\t0.935,\n\t\t0.002,\n\t\t0.935,\n\t\t0.002,\n\t\t0.921,\n\t\t0.002,\n\t\t0.908,\n\t\t0.002,\n\t\t0.928,\n\t\t0.002,\n\t\t0.823,\n\t\t0.003,\n\t\t13.469,\n\t\t-1.171,\n\t\t56.584,\n\t\t0.831,\n\t\t59.331,\n\t\t1.332,\n\t\t211,\n\t\t1.446,\n\t\t0.937,\n\t\t0.001,\n\t\t0.937,\n\t\t0.001,\n\t\t0.923,\n\t\t0.002,\n\t\t0.91,\n\t\t0.002,\n\t\t0.93,\n\t\t0.001,\n\t\t0.826,\n\t\t0.004,\n\t\t12.298,\n\t\t-1.17,\n\t\t57.415,\n\t\t0.828,\n\t\t60.663,\n\t\t3.012,\n\t\t212,\n\t\t3.139,\n\t\t0.938,\n\t\t0.002,\n\t\t0.938,\n\t\t0.002,\n\t\t0.925,\n\t\t0.002,\n\t\t0.912,\n\t\t0.002,\n\t\t0.931,\n\t\t0.003,\n\t\t0.83,\n\t\t0.003,\n\t\t11.128,\n\t\t-1.171,\n\t\t58.243,\n\t\t0.829,\n\t\t63.675,\n\t\t1.373,\n\t\t215,\n\t\t1.374,\n\t\t0.94,\n\t\t0.001,\n\t\t0.94,\n\t\t0.001,\n\t\t0.927,\n\t\t0.002,\n\t\t0.914,\n\t\t0.003,\n\t\t0.934,\n\t\t0.001,\n\t\t0.833,\n\t\t0.003,\n\t\t9.957,\n\t\t-1.17,\n\t\t59.072,\n\t\t0.824,\n\t\t65.049,\n\t\t1.385,\n\t\t217,\n\t\t1.351,\n\t\t0.941,\n\t\t0.001,\n\t\t0.941,\n\t\t0.001,\n\t\t0.929,\n\t\t0.002,\n\t\t0.917,\n\t\t0.002,\n\t\t0.935,\n\t\t0.002,\n\t\t0.836,\n\t\t0.004,\n\t\t8.787,\n\t\t-1.17,\n\t\t59.896,\n\t\t0.824,\n\t\t66.434,\n\t\t3.147,\n\t\t218,\n\t\t2.947,\n\t\t0.942,\n\t\t0.002,\n\t\t0.942,\n\t\t0.002,\n\t\t0.931,\n\t\t0.002,\n\t\t0.919,\n\t\t0.001,\n\t\t0.937,\n\t\t0.002,\n\t\t0.84,\n\t\t0.003,\n\t\t7.617,\n\t\t-1.17,\n\t\t60.72,\n\t\t0.824,\n\t\t69.581,\n\t\t1.43,\n\t\t221,\n\t\t1.285,\n\t\t0.944,\n\t\t0.001,\n\t\t0.944,\n\t\t0.001,\n\t\t0.933,\n\t\t0.002,\n\t\t0.92,\n\t\t0.002,\n\t\t0.939,\n\t\t0.001,\n\t\t0.843,\n\t\t0.004,\n\t\t6.447,\n\t\t-1.17,\n\t\t61.544,\n\t\t0.82,\n\t\t71.011,\n\t\t1.443,\n\t\t222,\n\t\t1.265,\n\t\t0.945,\n\t\t0.001,\n\t\t0.945,\n\t\t0.001,\n\t\t0.935,\n\t\t0.001,\n\t\t0.922,\n\t\t0.003,\n\t\t0.94,\n\t\t0.002,\n\t\t0.847,\n\t\t0.003,\n\t\t5.277,\n\t\t-1.169,\n\t\t62.364,\n\t\t0.821,\n\t\t72.454,\n\t\t3.288,\n\t\t224,\n\t\t2.764,\n\t\t0.946,\n\t\t0.001,\n\t\t0.946,\n\t\t0.001,\n\t\t0.936,\n\t\t0.003,\n\t\t0.925,\n\t\t0.001,\n\t\t0.942,\n\t\t0.002,\n\t\t0.85,\n\t\t0.003,\n\t\t4.108,\n\t\t-1.169,\n\t\t63.185,\n\t\t0.816,\n\t\t75.742,\n\t\t1.491,\n\t\t226,\n\t\t1.203,\n\t\t0.947,\n\t\t0.001,\n\t\t0.947,\n\t\t0.001,\n\t\t0.939,\n\t\t0.001,\n\t\t0.926,\n\t\t0.002,\n\t\t0.944,\n\t\t0.001,\n\t\t0.853,\n\t\t0.004,\n\t\t2.939,\n\t\t-1.168,\n\t\t64.001,\n\t\t0.819,\n\t\t77.233,\n\t\t3.399,\n\t\t228,\n\t\t2.628,\n\t\t0.948,\n\t\t0.001,\n\t\t0.948,\n\t\t0.001,\n\t\t0.94,\n\t\t0.002,\n\t\t0.928,\n\t\t0.002,\n\t\t0.945,\n\t\t0.002,\n\t\t0.857,\n\t\t0.003,\n\t\t1.771,\n\t\t-1.158,\n\t\t64.82,\n\t\t0.812,\n\t\t80.632,\n\t\t1.543,\n\t\t230,\n\t\t1.143,\n\t\t0.949,\n\t\t0.002,\n\t\t0.949,\n\t\t0.002,\n\t\t0.942,\n\t\t0.002,\n\t\t0.93,\n\t\t0.002,\n\t\t0.947,\n\t\t0.001,\n\t\t0.86,\n\t\t0.004,\n\t\t0.613,\n\t\t-0.869,\n\t\t65.632,\n\t\t0.813,\n\t\t82.175,\n\t\t1.56,\n\t\t231,\n\t\t1.126,\n\t\t0.951,\n\t\t0.001,\n\t\t0.951,\n\t\t0.001,\n\t\t0.944,\n\t\t0.002,\n\t\t0.932,\n\t\t0.001,\n\t\t0.948,\n\t\t0.002,\n\t\t0.864,\n\t\t0.003,\n\t\t-0.256,\n\t\t-0.296,\n\t\t66.445,\n\t\t0.811,\n\t\t83.736,\n\t\t3.551,\n\t\t233,\n\t\t2.454,\n\t\t0.952,\n\t\t0.001,\n\t\t0.952,\n\t\t0.001,\n\t\t0.946,\n\t\t0.001,\n\t\t0.933,\n\t\t0.002,\n\t\t0.95,\n\t\t0.001,\n\t\t0.867,\n\t\t0.003,\n\t\t-0.552,\n\t\t0.011,\n\t\t67.256,\n\t\t0.808,\n\t\t87.287,\n\t\t1.617,\n\t\t235,\n\t\t1.07,\n\t\t0.953,\n\t\t0.001,\n\t\t0.953,\n\t\t0.001,\n\t\t0.947,\n\t\t0.002,\n\t\t0.935,\n\t\t0.002,\n\t\t0.951,\n\t\t0.002,\n\t\t0.87,\n\t\t0.003,\n\t\t-0.541,\n\t\t0.011,\n\t\t68.064,\n\t\t0.808,\n\t\t88.904,\n\t\t3.671,\n\t\t236,\n\t\t2.322,\n\t\t0.954,\n\t\t0.001,\n\t\t0.954,\n\t\t0.001,\n\t\t0.949,\n\t\t0.001,\n\t\t0.937,\n\t\t0.002,\n\t\t0.953,\n\t\t0.001,\n\t\t0.873,\n\t\t0.004,\n\t\t-0.53,\n\t\t0.011,\n\t\t68.872,\n\t\t0.804,\n\t\t92.575,\n\t\t1.678,\n\t\t238,\n\t\t1.014,\n\t\t0.955,\n\t\t0.001,\n\t\t0.955,\n\t\t0.001,\n\t\t0.95,\n\t\t0.002,\n\t\t0.939,\n\t\t0.001,\n\t\t0.954,\n\t\t0.001,\n\t\t0.877,\n\t\t0.003,\n\t\t-0.519,\n\t\t0.011,\n\t\t69.676,\n\t\t0.803,\n\t\t94.252,\n\t\t1.7,\n\t\t239,\n\t\t0.999,\n\t\t0.956,\n\t\t0.001,\n\t\t0.956,\n\t\t0.001,\n\t\t0.952,\n\t\t0.002,\n\t\t0.94,\n\t\t0.002,\n\t\t0.955,\n\t\t0.002,\n\t\t0.88,\n\t\t0.003,\n\t\t-0.508,\n\t\t0.012,\n\t\t70.479,\n\t\t0.8,\n\t\t95.952,\n\t\t3.838,\n\t\t240,\n\t\t2.152,\n\t\t0.957,\n\t\t0.001,\n\t\t0.957,\n\t\t0.001,\n\t\t0.954,\n\t\t0.001,\n\t\t0.942,\n\t\t0.001,\n\t\t0.957,\n\t\t0.002,\n\t\t0.883,\n\t\t0.004,\n\t\t-0.496,\n\t\t0.011,\n\t\t71.279,\n\t\t0.799,\n\t\t99.789,\n\t\t1.766,\n\t\t243,\n\t\t0.945,\n\t\t0.958,\n\t\t0.001,\n\t\t0.958,\n\t\t0.001,\n\t\t0.955,\n\t\t0.002,\n\t\t0.943,\n\t\t0.002,\n\t\t0.959,\n\t\t0.001,\n\t\t0.887,\n\t\t0.003,\n\t\t-0.485,\n\t\t0.011,\n\t\t72.078,\n\t\t0.795,\n\t\t101.555,\n\t\t1.791,\n\t\t244,\n\t\t0.929,\n\t\t0.959,\n\t\t0.001,\n\t\t0.959,\n\t\t0.001,\n\t\t0.957,\n\t\t0.001,\n\t\t0.945,\n\t\t0.002,\n\t\t0.96,\n\t\t0.001,\n\t\t0.89,\n\t\t0.003,\n\t\t-0.474,\n\t\t0.011,\n\t\t72.873,\n\t\t0.795,\n\t\t103.346,\n\t\t4.014,\n\t\t244,\n\t\t1.982,\n\t\t0.96,\n\t\t0.001,\n\t\t0.96,\n\t\t0.001,\n\t\t0.958,\n\t\t0.002,\n\t\t0.947,\n\t\t0.001,\n\t\t0.961,\n\t\t0.001,\n\t\t0.893,\n\t\t0.003,\n\t\t-0.463,\n\t\t0.011,\n\t\t73.668,\n\t\t0.79,\n\t\t107.36,\n\t\t1.864,\n\t\t246,\n\t\t0.875,\n\t\t0.961,\n\t\t0.001,\n\t\t0.961,\n\t\t0.001,\n\t\t0.96,\n\t\t0.002,\n\t\t0.948,\n\t\t0.002,\n\t\t0.962,\n\t\t0.001,\n\t\t0.896,\n\t\t0.003,\n\t\t-0.452,\n\t\t0.011,\n\t\t74.458,\n\t\t0.789,\n\t\t109.224,\n\t\t1.891,\n\t\t247,\n\t\t0.86,\n\t\t0.962,\n\t\t0.001,\n\t\t0.962,\n\t\t0.001,\n\t\t0.962,\n\t\t0.001,\n\t\t0.95,\n\t\t0.001,\n\t\t0.963,\n\t\t0.002,\n\t\t0.899,\n\t\t0.004,\n\t\t-0.441,\n\t\t0.011,\n\t\t75.247,\n\t\t0.789,\n\t\t111.115,\n\t\t4.2,\n\t\t248,\n\t\t1.81,\n\t\t0.963,\n\t\t0.001,\n\t\t0.963,\n\t\t0.001,\n\t\t0.963,\n\t\t0.001,\n\t\t0.951,\n\t\t0.002,\n\t\t0.965,\n\t\t0.001,\n\t\t0.903,\n\t\t0.003,\n\t\t-0.43,\n\t\t0.012,\n\t\t76.036,\n\t\t0.78,\n\t\t115.315,\n\t\t1.97,\n\t\t250,\n\t\t0.804,\n\t\t0.964,\n\t\t0.001,\n\t\t0.964,\n\t\t0.001,\n\t\t0.964,\n\t\t0.002,\n\t\t0.953,\n\t\t0.001,\n\t\t0.966,\n\t\t0.002,\n\t\t0.906,\n\t\t0.003,\n\t\t-0.418,\n\t\t0.011,\n\t\t76.816,\n\t\t0.784,\n\t\t117.284,\n\t\t2,\n\t\t251,\n\t\t0.788,\n\t\t0.965,\n\t\t0.001,\n\t\t0.965,\n\t\t0.001,\n\t\t0.966,\n\t\t0.001,\n\t\t0.954,\n\t\t0.002,\n\t\t0.968,\n\t\t0.001,\n\t\t0.909,\n\t\t0.003,\n\t\t-0.407,\n\t\t0.011,\n\t\t77.6,\n\t\t0.773,\n\t\t119.285,\n\t\t2.032,\n\t\t252,\n\t\t0.772,\n\t\t0.966,\n\t\t0.001,\n\t\t0.966,\n\t\t0.001,\n\t\t0.967,\n\t\t0.002,\n\t\t0.956,\n\t\t0.001,\n\t\t0.969,\n\t\t0.001,\n\t\t0.912,\n\t\t0.003,\n\t\t-0.396,\n\t\t0.011,\n\t\t78.373,\n\t\t0.775,\n\t\t121.316,\n\t\t4.449,\n\t\t252,\n\t\t1.593,\n\t\t0.967,\n\t\t0.001,\n\t\t0.967,\n\t\t0.001,\n\t\t0.969,\n\t\t0.001,\n\t\t0.957,\n\t\t0.002,\n\t\t0.97,\n\t\t0.001,\n\t\t0.915,\n\t\t0.004,\n\t\t-0.385,\n\t\t0.011,\n\t\t79.148,\n\t\t0.775,\n\t\t125.765,\n\t\t2.118,\n\t\t254,\n\t\t0.713,\n\t\t0.968,\n\t\t0.001,\n\t\t0.968,\n\t\t0.001,\n\t\t0.97,\n\t\t0.002,\n\t\t0.959,\n\t\t0.001,\n\t\t0.971,\n\t\t0.002,\n\t\t0.919,\n\t\t0.003,\n\t\t-0.374,\n\t\t0.011,\n\t\t79.923,\n\t\t0.763,\n\t\t127.883,\n\t\t2.152,\n\t\t255,\n\t\t0.696,\n\t\t0.969,\n\t\t0.001,\n\t\t0.969,\n\t\t0.001,\n\t\t0.972,\n\t\t0.001,\n\t\t0.96,\n\t\t0.002,\n\t\t0.973,\n\t\t0.001,\n\t\t0.922,\n\t\t0.003,\n\t\t-0.363,\n\t\t0.011,\n\t\t80.686,\n\t\t0.764,\n\t\t130.035,\n\t\t2.186,\n\t\t255,\n\t\t0.678,\n\t\t0.97,\n\t\t0.001,\n\t\t0.97,\n\t\t0.001,\n\t\t0.973,\n\t\t0.001,\n\t\t0.962,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.925,\n\t\t0.003,\n\t\t-0.352,\n\t\t0.012,\n\t\t81.45,\n\t\t0.765,\n\t\t132.221,\n\t\t4.713,\n\t\t256,\n\t\t1.367,\n\t\t0.971,\n\t\t0.001,\n\t\t0.971,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.963,\n\t\t0.001,\n\t\t0.975,\n\t\t0.001,\n\t\t0.928,\n\t\t0.003,\n\t\t-0.34,\n\t\t0.011,\n\t\t82.215,\n\t\t0.751,\n\t\t136.934,\n\t\t2.28,\n\t\t257,\n\t\t0.616,\n\t\t0.972,\n\t\t0.001,\n\t\t0.972,\n\t\t0.001,\n\t\t0.975,\n\t\t0.002,\n\t\t0.964,\n\t\t0.002,\n\t\t0.976,\n\t\t0.001,\n\t\t0.931,\n\t\t0.003,\n\t\t-0.329,\n\t\t0.011,\n\t\t82.966,\n\t\t0.753,\n\t\t139.214,\n\t\t2.317,\n\t\t258,\n\t\t0.597,\n\t\t0.973,\n\t\t0.001,\n\t\t0.973,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.966,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.934,\n\t\t0.003,\n\t\t-0.318,\n\t\t0.011,\n\t\t83.719,\n\t\t0.749,\n\t\t141.531,\n\t\t2.354,\n\t\t259,\n\t\t0.577,\n\t\t0.974,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.978,\n\t\t0.002,\n\t\t0.967,\n\t\t0.001,\n\t\t0.978,\n\t\t0.001,\n\t\t0.937,\n\t\t0.003,\n\t\t-0.307,\n\t\t0.011,\n\t\t84.468,\n\t\t0.745,\n\t\t143.885,\n\t\t2.392,\n\t\t259,\n\t\t0.557,\n\t\t0.975,\n\t\t0.001,\n\t\t0.975,\n\t\t0.001,\n\t\t0.98,\n\t\t0.001,\n\t\t0.968,\n\t\t0.002,\n\t\t0.979,\n\t\t0.002,\n\t\t0.94,\n\t\t0.003,\n\t\t-0.296,\n\t\t0.011,\n\t\t85.213,\n\t\t0.737,\n\t\t146.277,\n\t\t2.431,\n\t\t260,\n\t\t0.536,\n\t\t0.976,\n\t\t0.001,\n\t\t0.976,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.97,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.943,\n\t\t0.003,\n\t\t-0.285,\n\t\t0.012,\n\t\t85.95,\n\t\t0.731,\n\t\t148.708,\n\t\t2.471,\n\t\t260,\n\t\t0.514,\n\t\t0.977,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.982,\n\t\t0.001,\n\t\t0.971,\n\t\t0.001,\n\t\t0.982,\n\t\t0.001,\n\t\t0.946,\n\t\t0.003,\n\t\t-0.273,\n\t\t0.011,\n\t\t86.681,\n\t\t0.728,\n\t\t151.179,\n\t\t5.178,\n\t\t261,\n\t\t0.984,\n\t\t0.978,\n\t\t0.001,\n\t\t0.978,\n\t\t0.001,\n\t\t0.983,\n\t\t0.002,\n\t\t0.972,\n\t\t0.002,\n\t\t0.983,\n\t\t0,\n\t\t0.949,\n\t\t0.003,\n\t\t-0.262,\n\t\t0.011,\n\t\t87.409,\n\t\t0.723,\n\t\t156.357,\n\t\t2.574,\n\t\t262,\n\t\t0.443,\n\t\t0.979,\n\t\t0.001,\n\t\t0.979,\n\t\t0.001,\n\t\t0.985,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.983,\n\t\t0.001,\n\t\t0.952,\n\t\t0.003,\n\t\t-0.251,\n\t\t0.011,\n\t\t88.132,\n\t\t0.718,\n\t\t158.932,\n\t\t2.615,\n\t\t262,\n\t\t0.419,\n\t\t0.98,\n\t\t0.001,\n\t\t0.98,\n\t\t0.001,\n\t\t0.986,\n\t\t0.001,\n\t\t0.975,\n\t\t0.002,\n\t\t0.984,\n\t\t0.001,\n\t\t0.955,\n\t\t0.003,\n\t\t-0.24,\n\t\t0.011,\n\t\t88.85,\n\t\t0.718,\n\t\t161.547,\n\t\t2.657,\n\t\t263,\n\t\t0.396,\n\t\t0.981,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.987,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.985,\n\t\t0.001,\n\t\t0.958,\n\t\t0.003,\n\t\t-0.229,\n\t\t0.011,\n\t\t89.568,\n\t\t0.693,\n\t\t164.204,\n\t\t2.699,\n\t\t263,\n\t\t0.371,\n\t\t0.982,\n\t\t0.001,\n\t\t0.982,\n\t\t0.001,\n\t\t0.988,\n\t\t0.001,\n\t\t0.978,\n\t\t0.001,\n\t\t0.986,\n\t\t0.007,\n\t\t0.961,\n\t\t0.002,\n\t\t-0.218,\n\t\t0.011,\n\t\t90.261,\n\t\t0.695,\n\t\t166.904,\n\t\t2.742,\n\t\t263,\n\t\t0.346,\n\t\t0.983,\n\t\t0.001,\n\t\t0.983,\n\t\t0.001,\n\t\t0.989,\n\t\t0.001,\n\t\t0.979,\n\t\t0.001,\n\t\t0.993,\n\t\t0,\n\t\t0.963,\n\t\t0.003,\n\t\t-0.207,\n\t\t0.012,\n\t\t90.956,\n\t\t0.686,\n\t\t169.646,\n\t\t2.785,\n\t\t264,\n\t\t0.32,\n\t\t0.984,\n\t\t0.001,\n\t\t0.984,\n\t\t0.001,\n\t\t0.99,\n\t\t0.007,\n\t\t0.98,\n\t\t0.001,\n\t\t0.993,\n\t\t0,\n\t\t0.966,\n\t\t0.003,\n\t\t-0.195,\n\t\t0.011,\n\t\t91.642,\n\t\t0.696,\n\t\t172.431,\n\t\t2.829,\n\t\t264,\n\t\t0.294,\n\t\t0.985,\n\t\t0.002,\n\t\t0.985,\n\t\t0.002,\n\t\t0.997,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.993,\n\t\t0.001,\n\t\t0.969,\n\t\t0.003,\n\t\t-0.184,\n\t\t0.011,\n\t\t92.338,\n\t\t0.654,\n\t\t175.26,\n\t\t2.873,\n\t\t264,\n\t\t0.267,\n\t\t0.987,\n\t\t0.001,\n\t\t0.987,\n\t\t0.001,\n\t\t0.998,\n\t\t0,\n\t\t0.982,\n\t\t0.001,\n\t\t0.994,\n\t\t0,\n\t\t0.972,\n\t\t0.002,\n\t\t-0.173,\n\t\t0.011,\n\t\t92.992,\n\t\t0.656,\n\t\t178.133,\n\t\t2.917,\n\t\t265,\n\t\t0.239,\n\t\t0.988,\n\t\t0,\n\t\t0.988,\n\t\t0,\n\t\t0.998,\n\t\t0,\n\t\t0.983,\n\t\t0.008,\n\t\t0.994,\n\t\t0,\n\t\t0.974,\n\t\t0.003,\n\t\t-0.162,\n\t\t0.011,\n\t\t93.648,\n\t\t0.654,\n\t\t181.051,\n\t\t2.962,\n\t\t265,\n\t\t0.211,\n\t\t0.988,\n\t\t0.003,\n\t\t0.988,\n\t\t0.003,\n\t\t0.998,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t0.977,\n\t\t0.003,\n\t\t-0.151,\n\t\t0.011,\n\t\t94.302,\n\t\t0.641,\n\t\t184.013,\n\t\t3.007,\n\t\t265,\n\t\t0.182,\n\t\t0.991,\n\t\t-0.007,\n\t\t0.991,\n\t\t-0.007,\n\t\t0.998,\n\t\t0.001,\n\t\t0.991,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t0.98,\n\t\t0.002,\n\t\t-0.14,\n\t\t0.011,\n\t\t94.943,\n\t\t0.634,\n\t\t187.02,\n\t\t3.053,\n\t\t265,\n\t\t0.153,\n\t\t0.984,\n\t\t0.006,\n\t\t0.984,\n\t\t0.006,\n\t\t0.999,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t0.994,\n\t\t0.001,\n\t\t0.982,\n\t\t0.003,\n\t\t-0.129,\n\t\t0.012,\n\t\t95.577,\n\t\t0.574,\n\t\t190.073,\n\t\t3.099,\n\t\t265,\n\t\t0.123,\n\t\t0.99,\n\t\t0.006,\n\t\t0.99,\n\t\t0.006,\n\t\t0.999,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t0.995,\n\t\t0.005,\n\t\t0.985,\n\t\t0.002,\n\t\t-0.117,\n\t\t0.011,\n\t\t96.151,\n\t\t0.609,\n\t\t193.172,\n\t\t3.145,\n\t\t266,\n\t\t0.092,\n\t\t0.996,\n\t\t0.002,\n\t\t0.996,\n\t\t0.002,\n\t\t0.999,\n\t\t0.001,\n\t\t0.991,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.987,\n\t\t0.006,\n\t\t-0.106,\n\t\t0.011,\n\t\t96.76,\n\t\t0.59,\n\t\t196.316,\n\t\t0.169,\n\t\t266,\n\t\t0.004,\n\t\t0.998,\n\t\t0.012,\n\t\t0.998,\n\t\t0.012,\n\t\t1,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.993,\n\t\t0.001,\n\t\t-0.095,\n\t\t0.011,\n\t\t97.35,\n\t\t0.493,\n\t\t196.486,\n\t\t3.214,\n\t\t266,\n\t\t0.059,\n\t\t1.01,\n\t\t0.019,\n\t\t1.01,\n\t\t0.019,\n\t\t1,\n\t\t0,\n\t\t0.991,\n\t\t0.009,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t-0.084,\n\t\t0.011,\n\t\t97.843,\n\t\t0.525,\n\t\t199.7,\n\t\t3.261,\n\t\t266,\n\t\t0.027,\n\t\t1.029,\n\t\t0.026,\n\t\t1.029,\n\t\t0.026,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t0.006,\n\t\t-0.073,\n\t\t0.011,\n\t\t98.368,\n\t\t0.688,\n\t\t202.96,\n\t\t3.767,\n\t\t266,\n\t\t-0.073,\n\t\t1.055,\n\t\t0.033,\n\t\t1.055,\n\t\t0.033,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.062,\n\t\t0.011,\n\t\t99.056,\n\t\t0.23,\n\t\t206.727,\n\t\t4.193,\n\t\t266,\n\t\t-0.149,\n\t\t1.088,\n\t\t0.04,\n\t\t1.088,\n\t\t0.04,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.051,\n\t\t0.012,\n\t\t99.286,\n\t\t1.253,\n\t\t210.92,\n\t\t0.657,\n\t\t266,\n\t\t-0.027,\n\t\t1.128,\n\t\t0.044,\n\t\t1.128,\n\t\t0.044,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.039,\n\t\t0.011,\n\t\t100.539,\n\t\t-0.257,\n\t\t211.577,\n\t\t4.11,\n\t\t265,\n\t\t-0.193,\n\t\t1.172,\n\t\t0.049,\n\t\t1.172,\n\t\t0.049,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t-0.001,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.028,\n\t\t0.011,\n\t\t100.282,\n\t\t-0.257,\n\t\t215.687,\n\t\t0.615,\n\t\t265,\n\t\t-0.032,\n\t\t1.221,\n\t\t0.05,\n\t\t1.221,\n\t\t0.05,\n\t\t1,\n\t\t0,\n\t\t0.999,\n\t\t-0.001,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.017,\n\t\t0.011,\n\t\t100.025,\n\t\t0.224,\n\t\t216.303,\n\t\t4.028,\n\t\t265,\n\t\t-0.236,\n\t\t1.271,\n\t\t0.035,\n\t\t1.271,\n\t\t0.035,\n\t\t1,\n\t\t0,\n\t\t0.998,\n\t\t-0.001,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t-0.001,\n\t\t-0.006,\n\t\t0.576,\n\t\t100.249,\n\t\t-0.453,\n\t\t220.33,\n\t\t3.972,\n\t\t265,\n\t\t-0.273,\n\t\t1.306,\n\t\t-0.063,\n\t\t1.306,\n\t\t-0.063,\n\t\t1,\n\t\t0,\n\t\t0.997,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.999,\n\t\t0,\n\t\t0.57,\n\t\t0,\n\t\t99.796,\n\t\t-0.452,\n\t\t224.302,\n\t\t0.548,\n\t\t265,\n\t\t-0.041,\n\t\t1.243,\n\t\t-0.071,\n\t\t1.243,\n\t\t-0.071,\n\t\t1,\n\t\t0,\n\t\t0.997,\n\t\t-0.001,\n\t\t1,\n\t\t-0.001,\n\t\t0.999,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t99.344,\n\t\t-0.372,\n\t\t224.85,\n\t\t3.89,\n\t\t265,\n\t\t-0.314,\n\t\t1.172,\n\t\t-0.06,\n\t\t1.172,\n\t\t-0.06,\n\t\t1,\n\t\t0,\n\t\t0.996,\n\t\t-0.001,\n\t\t0.999,\n\t\t-0.001,\n\t\t0.996,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t98.972,\n\t\t-0.511,\n\t\t228.741,\n\t\t3.835,\n\t\t264,\n\t\t-0.349,\n\t\t1.112,\n\t\t-0.046,\n\t\t1.112,\n\t\t-0.046,\n\t\t1,\n\t\t0,\n\t\t0.995,\n\t\t-0.001,\n\t\t0.998,\n\t\t0,\n\t\t0.994,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t98.461,\n\t\t-0.489,\n\t\t232.576,\n\t\t3.78,\n\t\t264,\n\t\t-0.385,\n\t\t1.066,\n\t\t-0.033,\n\t\t1.066,\n\t\t-0.033,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t0.998,\n\t\t0,\n\t\t0.992,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t97.972,\n\t\t-0.507,\n\t\t236.355,\n\t\t0.458,\n\t\t264,\n\t\t-0.049,\n\t\t1.033,\n\t\t-0.027,\n\t\t1.033,\n\t\t-0.027,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.998,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t97.465,\n\t\t-0.584,\n\t\t236.813,\n\t\t3.7,\n\t\t264,\n\t\t-0.422,\n\t\t1.006,\n\t\t-0.008,\n\t\t1.006,\n\t\t-0.008,\n\t\t1,\n\t\t-0.001,\n\t\t0.993,\n\t\t0.001,\n\t\t0.997,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t96.881,\n\t\t-0.559,\n\t\t240.513,\n\t\t3.646,\n\t\t263,\n\t\t-0.455,\n\t\t0.998,\n\t\t-0.001,\n\t\t0.998,\n\t\t-0.001,\n\t\t0.999,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.996,\n\t\t-0.001,\n\t\t0.985,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t96.322,\n\t\t-0.587,\n\t\t244.159,\n\t\t0.394,\n\t\t263,\n\t\t-0.052,\n\t\t0.997,\n\t\t-0.003,\n\t\t0.997,\n\t\t-0.003,\n\t\t0.998,\n\t\t-0.002,\n\t\t0.993,\n\t\t-0.001,\n\t\t0.995,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t95.735,\n\t\t-0.628,\n\t\t244.554,\n\t\t3.568,\n\t\t263,\n\t\t-0.489,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.996,\n\t\t-0.001,\n\t\t0.992,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t95.107,\n\t\t-0.618,\n\t\t248.121,\n\t\t3.514,\n\t\t262,\n\t\t-0.522,\n\t\t0.993,\n\t\t-0.002,\n\t\t0.993,\n\t\t-0.002,\n\t\t0.995,\n\t\t0,\n\t\t0.991,\n\t\t-0.001,\n\t\t0.993,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t94.489,\n\t\t-0.632,\n\t\t251.636,\n\t\t3.461,\n\t\t262,\n\t\t-0.553,\n\t\t0.991,\n\t\t-0.002,\n\t\t0.991,\n\t\t-0.002,\n\t\t0.995,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.001,\n\t\t0.992,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t93.857,\n\t\t-0.656,\n\t\t255.097,\n\t\t3.408,\n\t\t261,\n\t\t-0.584,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.991,\n\t\t-0.001,\n\t\t0.973,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t93.201,\n\t\t-0.644,\n\t\t258.505,\n\t\t0.287,\n\t\t261,\n\t\t-0.051,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.993,\n\t\t-0.002,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.99,\n\t\t0,\n\t\t0.97,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t92.557,\n\t\t-0.679,\n\t\t258.791,\n\t\t3.333,\n\t\t260,\n\t\t-0.614,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.991,\n\t\t-0.001,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.002,\n\t\t0.967,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t91.878,\n\t\t-0.677,\n\t\t262.124,\n\t\t3.281,\n\t\t260,\n\t\t-0.643,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.001,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.965,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t91.201,\n\t\t-0.684,\n\t\t265.406,\n\t\t3.23,\n\t\t259,\n\t\t-0.672,\n\t\t0.985,\n\t\t-0.002,\n\t\t0.985,\n\t\t-0.002,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.985,\n\t\t-0.001,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t90.517,\n\t\t-0.691,\n\t\t268.636,\n\t\t3.179,\n\t\t259,\n\t\t-0.7,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.002,\n\t\t0.984,\n\t\t0,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t89.826,\n\t\t-0.691,\n\t\t271.814,\n\t\t3.128,\n\t\t258,\n\t\t-0.728,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.986,\n\t\t0,\n\t\t0.984,\n\t\t-0.001,\n\t\t0.985,\n\t\t-0.001,\n\t\t0.956,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t89.135,\n\t\t-0.712,\n\t\t274.943,\n\t\t3.078,\n\t\t257,\n\t\t-0.755,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.986,\n\t\t-0.002,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.984,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t88.423,\n\t\t-0.711,\n\t\t278.021,\n\t\t0.144,\n\t\t256,\n\t\t-0.036,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.984,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.95,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t87.712,\n\t\t-0.715,\n\t\t278.165,\n\t\t3.009,\n\t\t256,\n\t\t-0.778,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.948,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t86.997,\n\t\t-0.723,\n\t\t281.174,\n\t\t2.96,\n\t\t256,\n\t\t-0.804,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.002,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.945,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t86.274,\n\t\t-0.724,\n\t\t284.134,\n\t\t2.912,\n\t\t255,\n\t\t-0.829,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.942,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t85.55,\n\t\t-0.729,\n\t\t287.046,\n\t\t2.864,\n\t\t254,\n\t\t-0.853,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.002,\n\t\t0.939,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t84.821,\n\t\t-0.734,\n\t\t289.91,\n\t\t2.817,\n\t\t253,\n\t\t-0.877,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.936,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t84.087,\n\t\t-0.746,\n\t\t292.728,\n\t\t2.771,\n\t\t252,\n\t\t-0.901,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.002,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.933,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t83.341,\n\t\t-0.743,\n\t\t295.498,\n\t\t2.725,\n\t\t251,\n\t\t-0.924,\n\t\t0.973,\n\t\t-0.001,\n\t\t0.973,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.93,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t82.598,\n\t\t-0.748,\n\t\t298.223,\n\t\t2.68,\n\t\t250,\n\t\t-0.946,\n\t\t0.972,\n\t\t-0.001,\n\t\t0.972,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.927,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t81.85,\n\t\t-0.753,\n\t\t300.903,\n\t\t2.635,\n\t\t249,\n\t\t-0.968,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.973,\n\t\t-0.002,\n\t\t0.973,\n\t\t-0.002,\n\t\t0.973,\n\t\t-0.001,\n\t\t0.924,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t81.097,\n\t\t-0.754,\n\t\t303.538,\n\t\t2.591,\n\t\t248,\n\t\t-0.989,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.972,\n\t\t-0.002,\n\t\t0.921,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t80.343,\n\t\t-0.758,\n\t\t306.129,\n\t\t2.548,\n\t\t247,\n\t\t-1.011,\n\t\t0.969,\n\t\t-0.001,\n\t\t0.969,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.918,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t79.585,\n\t\t-0.763,\n\t\t308.677,\n\t\t2.505,\n\t\t246,\n\t\t-1.031,\n\t\t0.968,\n\t\t-0.001,\n\t\t0.968,\n\t\t-0.001,\n\t\t0.969,\n\t\t-0.002,\n\t\t0.969,\n\t\t0,\n\t\t0.969,\n\t\t-0.001,\n\t\t0.915,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t78.822,\n\t\t-0.763,\n\t\t311.182,\n\t\t2.464,\n\t\t245,\n\t\t-1.051,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.969,\n\t\t-0.002,\n\t\t0.968,\n\t\t-0.002,\n\t\t0.912,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t78.059,\n\t\t-0.768,\n\t\t313.646,\n\t\t2.422,\n\t\t244,\n\t\t-1.071,\n\t\t0.966,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.002,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.966,\n\t\t0,\n\t\t0.909,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t77.291,\n\t\t-0.772,\n\t\t316.068,\n\t\t2.382,\n\t\t243,\n\t\t-1.091,\n\t\t0.965,\n\t\t-0.001,\n\t\t0.965,\n\t\t-0.001,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.002,\n\t\t0.905,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t76.519,\n\t\t-0.772,\n\t\t318.45,\n\t\t2.342,\n\t\t242,\n\t\t-1.11,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.965,\n\t\t-0.002,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.902,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t75.747,\n\t\t-0.778,\n\t\t320.793,\n\t\t4.706,\n\t\t241,\n\t\t-2.347,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.002,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.963,\n\t\t-0.002,\n\t\t0.899,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t74.969,\n\t\t-0.777,\n\t\t325.499,\n\t\t2.238,\n\t\t239,\n\t\t-1.174,\n\t\t0.962,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.001,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.001,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.896,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t74.192,\n\t\t-0.781,\n\t\t327.737,\n\t\t2.201,\n\t\t238,\n\t\t-1.192,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.002,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.893,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t73.411,\n\t\t-0.783,\n\t\t329.938,\n\t\t2.165,\n\t\t236,\n\t\t-1.21,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.957,\n\t\t-0.002,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.002,\n\t\t0.89,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t72.628,\n\t\t-0.786,\n\t\t332.103,\n\t\t2.129,\n\t\t235,\n\t\t-1.228,\n\t\t0.959,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.001,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.002,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.887,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t71.842,\n\t\t-0.787,\n\t\t334.233,\n\t\t2.095,\n\t\t234,\n\t\t-1.246,\n\t\t0.958,\n\t\t-0.001,\n\t\t0.958,\n\t\t-0.001,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.956,\n\t\t-0.002,\n\t\t0.883,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t71.055,\n\t\t-0.79,\n\t\t336.327,\n\t\t2.061,\n\t\t233,\n\t\t-1.264,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.002,\n\t\t0.956,\n\t\t-0.001,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.88,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t70.265,\n\t\t-0.791,\n\t\t338.388,\n\t\t4.217,\n\t\t231,\n\t\t-2.709,\n\t\t0.956,\n\t\t-0.001,\n\t\t0.956,\n\t\t-0.001,\n\t\t0.951,\n\t\t-0.002,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.002,\n\t\t0.877,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t69.474,\n\t\t-0.795,\n\t\t342.605,\n\t\t1.969,\n\t\t229,\n\t\t-1.325,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.949,\n\t\t-0.002,\n\t\t0.954,\n\t\t-0.002,\n\t\t0.951,\n\t\t-0.001,\n\t\t0.874,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t68.679,\n\t\t-0.795,\n\t\t344.575,\n\t\t1.938,\n\t\t227,\n\t\t-1.343,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.947,\n\t\t-0.001,\n\t\t0.952,\n\t\t-0.001,\n\t\t0.95,\n\t\t-0.001,\n\t\t0.87,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t67.884,\n\t\t-0.798,\n\t\t346.513,\n\t\t1.908,\n\t\t226,\n\t\t-1.36,\n\t\t0.953,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.001,\n\t\t0.946,\n\t\t-0.001,\n\t\t0.951,\n\t\t-0.002,\n\t\t0.949,\n\t\t-0.002,\n\t\t0.867,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t67.086,\n\t\t-0.799,\n\t\t348.421,\n\t\t1.878,\n\t\t225,\n\t\t-1.379,\n\t\t0.952,\n\t\t-0.001,\n\t\t0.952,\n\t\t-0.001,\n\t\t0.945,\n\t\t-0.002,\n\t\t0.949,\n\t\t-0.001,\n\t\t0.947,\n\t\t-0.002,\n\t\t0.864,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t66.287,\n\t\t-0.802,\n\t\t350.299,\n\t\t1.849,\n\t\t223,\n\t\t-1.397,\n\t\t0.951,\n\t\t-0.001,\n\t\t0.951,\n\t\t-0.001,\n\t\t0.943,\n\t\t-0.002,\n\t\t0.948,\n\t\t-0.002,\n\t\t0.945,\n\t\t-0.002,\n\t\t0.861,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t65.485,\n\t\t-0.801,\n\t\t352.148,\n\t\t3.828,\n\t\t222,\n\t\t-3.022,\n\t\t0.95,\n\t\t-0.001,\n\t\t0.95,\n\t\t-0.001,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.946,\n\t\t0,\n\t\t0.943,\n\t\t-0.001,\n\t\t0.857,\n\t\t-0.003,\n\t\t0.57,\n\t\t-1.292,\n\t\t64.684,\n\t\t-0.806,\n\t\t355.976,\n\t\t1.769,\n\t\t219,\n\t\t-1.459,\n\t\t0.949,\n\t\t-0.001,\n\t\t0.949,\n\t\t-0.001,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.946,\n\t\t-0.002,\n\t\t0.942,\n\t\t-0.001,\n\t\t0.854,\n\t\t-0.003,\n\t\t-0.722,\n\t\t-1.175,\n\t\t63.878,\n\t\t-0.804,\n\t\t357.745,\n\t\t1.742,\n\t\t217,\n\t\t-1.478,\n\t\t0.948,\n\t\t-0.001,\n\t\t0.948,\n\t\t-0.001,\n\t\t0.938,\n\t\t-0.002,\n\t\t0.944,\n\t\t-0.002,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.851,\n\t\t-0.004,\n\t\t-1.897,\n\t\t-1.18,\n\t\t63.074,\n\t\t-0.81,\n\t\t359.487,\n\t\t1.717,\n\t\t216,\n\t\t-1.497,\n\t\t0.947,\n\t\t-0.002,\n\t\t0.947,\n\t\t-0.002,\n\t\t0.936,\n\t\t-0.002,\n\t\t0.942,\n\t\t-0.002,\n\t\t0.939,\n\t\t-0.002,\n\t\t0.847,\n\t\t-0.003,\n\t\t-3.077,\n\t\t-1.18,\n\t\t62.264,\n\t\t-0.81,\n\t\t361.204,\n\t\t3.569,\n\t\t214,\n\t\t-3.251,\n\t\t0.945,\n\t\t-0.001,\n\t\t0.945,\n\t\t-0.001,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.94,\n\t\t-0.001,\n\t\t0.937,\n\t\t-0.001,\n\t\t0.844,\n\t\t-0.003,\n\t\t-4.257,\n\t\t-1.181,\n\t\t61.454,\n\t\t-0.81,\n\t\t364.772,\n\t\t1.642,\n\t\t211,\n\t\t-1.562,\n\t\t0.944,\n\t\t-0.001,\n\t\t0.944,\n\t\t-0.001,\n\t\t0.932,\n\t\t-0.001,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.936,\n\t\t-0.002,\n\t\t0.841,\n\t\t-0.004,\n\t\t-5.438,\n\t\t-1.182,\n\t\t60.644,\n\t\t-0.813,\n\t\t366.415,\n\t\t1.619,\n\t\t210,\n\t\t-1.583,\n\t\t0.943,\n\t\t-0.001,\n\t\t0.943,\n\t\t-0.001,\n\t\t0.931,\n\t\t-0.003,\n\t\t0.938,\n\t\t-0.002,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.837,\n\t\t-0.003,\n\t\t-6.62,\n\t\t-1.182,\n\t\t59.831,\n\t\t-0.812,\n\t\t368.034,\n\t\t1.596,\n\t\t208,\n\t\t-1.605,\n\t\t0.942,\n\t\t-0.001,\n\t\t0.942,\n\t\t-0.001,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.936,\n\t\t-0.002,\n\t\t0.932,\n\t\t-0.002,\n\t\t0.834,\n\t\t-0.003,\n\t\t-7.802,\n\t\t-1.183,\n\t\t59.019,\n\t\t-0.817,\n\t\t369.63,\n\t\t1.574,\n\t\t206,\n\t\t-1.627,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.926,\n\t\t-0.002,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.93,\n\t\t-0.002,\n\t\t0.831,\n\t\t-0.004,\n\t\t-8.985,\n\t\t-1.183,\n\t\t58.202,\n\t\t-0.817,\n\t\t371.203,\n\t\t3.275,\n\t\t205,\n\t\t-3.534,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.924,\n\t\t-0.001,\n\t\t0.932,\n\t\t-0.002,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.827,\n\t\t-0.003,\n\t\t-10.168,\n\t\t-1.183,\n\t\t57.385,\n\t\t-0.816,\n\t\t374.478,\n\t\t1.506,\n\t\t201,\n\t\t-1.697,\n\t\t0.938,\n\t\t-0.001,\n\t\t0.938,\n\t\t-0.001,\n\t\t0.923,\n\t\t-0.003,\n\t\t0.93,\n\t\t-0.001,\n\t\t0.926,\n\t\t-0.002,\n\t\t0.824,\n\t\t-0.004,\n\t\t-11.351,\n\t\t-1.184,\n\t\t56.569,\n\t\t-0.821,\n\t\t375.984,\n\t\t1.485,\n\t\t200,\n\t\t-1.721,\n\t\t0.937,\n\t\t-0.002,\n\t\t0.937,\n\t\t-0.002,\n\t\t0.92,\n\t\t-0.002,\n\t\t0.929,\n\t\t-0.002,\n\t\t0.924,\n\t\t-0.002,\n\t\t0.82,\n\t\t-0.003,\n\t\t-12.535,\n\t\t-1.184,\n\t\t55.748,\n\t\t-0.818,\n\t\t377.469,\n\t\t1.465,\n\t\t198,\n\t\t-1.746,\n\t\t0.935,\n\t\t-0.001,\n\t\t0.935,\n\t\t-0.001,\n\t\t0.918,\n\t\t-0.002,\n\t\t0.927,\n\t\t-0.003,\n\t\t0.922,\n\t\t-0.001,\n\t\t0.817,\n\t\t-0.003,\n\t\t-13.719,\n\t\t-1.184,\n\t\t54.93,\n\t\t-0.823,\n\t\t378.934,\n\t\t3.038,\n\t\t196,\n\t\t-3.783,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.916,\n\t\t-0.002,\n\t\t0.924,\n\t\t-0.001,\n\t\t0.921,\n\t\t-0.003,\n\t\t0.814,\n\t\t-0.004,\n\t\t-14.903,\n\t\t-1.184,\n\t\t54.107,\n\t\t-0.823,\n\t\t381.973,\n\t\t1.401,\n\t\t192,\n\t\t-1.823,\n\t\t0.932,\n\t\t-0.001,\n\t\t0.932,\n\t\t-0.001,\n\t\t0.914,\n\t\t-0.002,\n\t\t0.923,\n\t\t-0.002,\n\t\t0.918,\n\t\t-0.003,\n\t\t0.81,\n\t\t-0.003,\n\t\t-16.087,\n\t\t-1.184,\n\t\t53.284,\n\t\t-0.824,\n\t\t383.373,\n\t\t1.381,\n\t\t191,\n\t\t-1.85,\n\t\t0.931,\n\t\t-0.002,\n\t\t0.931,\n\t\t-0.002,\n\t\t0.912,\n\t\t-0.003,\n\t\t0.921,\n\t\t-0.003,\n\t\t0.915,\n\t\t-0.003,\n\t\t0.807,\n\t\t-0.004,\n\t\t-17.271,\n\t\t-1.185,\n\t\t52.46,\n\t\t-0.826,\n\t\t384.755,\n\t\t1.363,\n\t\t189,\n\t\t-1.877,\n\t\t0.929,\n\t\t-0.001,\n\t\t0.929,\n\t\t-0.001,\n\t\t0.909,\n\t\t-0.002,\n\t\t0.918,\n\t\t-0.002,\n\t\t0.912,\n\t\t-0.001,\n\t\t0.803,\n\t\t-0.003,\n\t\t-18.456,\n\t\t-1.184,\n\t\t51.634,\n\t\t-0.826,\n\t\t386.117,\n\t\t1.344,\n\t\t187,\n\t\t-1.906,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.907,\n\t\t-0.003,\n\t\t0.916,\n\t\t-0.002,\n\t\t0.911,\n\t\t-0.003,\n\t\t0.8,\n\t\t-0.004,\n\t\t-19.64,\n\t\t-1.185,\n\t\t50.808,\n\t\t-0.827,\n\t\t387.461,\n\t\t2.763,\n\t\t185,\n\t\t-4.1,\n\t\t0.926,\n\t\t-0.003,\n\t\t0.926,\n\t\t-0.003,\n\t\t0.904,\n\t\t-0.003,\n\t\t0.914,\n\t\t-0.003,\n\t\t0.908,\n\t\t-0.004,\n\t\t0.796,\n\t\t-0.003,\n\t\t-20.825,\n\t\t-1.185,\n\t\t49.981,\n\t\t-0.829,\n\t\t390.224,\n\t\t1.282,\n\t\t181,\n\t\t-1.991,\n\t\t0.923,\n\t\t-0.001,\n\t\t0.923,\n\t\t-0.001,\n\t\t0.901,\n\t\t-0.001,\n\t\t0.911,\n\t\t-0.003,\n\t\t0.904,\n\t\t-0.001,\n\t\t0.793,\n\t\t-0.004,\n\t\t-22.01,\n\t\t-1.185,\n\t\t49.152,\n\t\t-0.829,\n\t\t391.506,\n\t\t1.263,\n\t\t179,\n\t\t-2.022,\n\t\t0.922,\n\t\t-0.003,\n\t\t0.922,\n\t\t-0.003,\n\t\t0.9,\n\t\t-0.004,\n\t\t0.908,\n\t\t-0.001,\n\t\t0.903,\n\t\t-0.005,\n\t\t0.789,\n\t\t-0.003,\n\t\t-23.195,\n\t\t-1.185,\n\t\t48.323,\n\t\t-0.831,\n\t\t392.769,\n\t\t1.245,\n\t\t177,\n\t\t-2.054,\n\t\t0.919,\n\t\t-0.001,\n\t\t0.919,\n\t\t-0.001,\n\t\t0.896,\n\t\t-0.004,\n\t\t0.907,\n\t\t-0.005,\n\t\t0.898,\n\t\t-0.001,\n\t\t0.786,\n\t\t-0.004,\n\t\t-24.38,\n\t\t-1.185,\n\t\t47.492,\n\t\t-0.832,\n\t\t394.014,\n\t\t1.227,\n\t\t175,\n\t\t-2.087,\n\t\t0.918,\n\t\t-0.004,\n\t\t0.918,\n\t\t-0.004,\n\t\t0.892,\n\t\t-0.002,\n\t\t0.902,\n\t\t0,\n\t\t0.897,\n\t\t-0.006,\n\t\t0.782,\n\t\t-0.003,\n\t\t-25.565,\n\t\t-1.185,\n\t\t46.66,\n\t\t-0.832,\n\t\t395.241,\n\t\t1.208,\n\t\t173,\n\t\t-2.121,\n\t\t0.914,\n\t\t0,\n\t\t0.914,\n\t\t0,\n\t\t0.89,\n\t\t-0.005,\n\t\t0.902,\n\t\t-0.007,\n\t\t0.891,\n\t\t-0.004,\n\t\t0.779,\n\t\t-0.004,\n\t\t-26.75,\n\t\t-1.185,\n\t\t45.828,\n\t\t-0.834,\n\t\t396.449,\n\t\t2.443,\n\t\t171,\n\t\t-4.501,\n\t\t0.914,\n\t\t-0.007,\n\t\t0.914,\n\t\t-0.007,\n\t\t0.885,\n\t\t-0.002,\n\t\t0.895,\n\t\t-0.003,\n\t\t0.887,\n\t\t-0.008,\n\t\t0.775,\n\t\t-0.003,\n\t\t-27.935,\n\t\t-1.185,\n\t\t44.994,\n\t\t-0.834,\n\t\t398.892,\n\t\t1.145,\n\t\t166,\n\t\t-2.217,\n\t\t0.907,\n\t\t-0.006,\n\t\t0.907,\n\t\t-0.006,\n\t\t0.883,\n\t\t-0.005,\n\t\t0.892,\n\t\t-0.009,\n\t\t0.879,\n\t\t-0.011,\n\t\t0.772,\n\t\t-0.004,\n\t\t-29.12,\n\t\t-1.186,\n\t\t44.16,\n\t\t-0.836,\n\t\t400.038,\n\t\t1.126,\n\t\t164,\n\t\t-2.253,\n\t\t0.901,\n\t\t-0.01,\n\t\t0.901,\n\t\t-0.01,\n\t\t0.878,\n\t\t-0.01,\n\t\t0.883,\n\t\t-0.012,\n\t\t0.868,\n\t\t-0.013,\n\t\t0.768,\n\t\t-0.003,\n\t\t-30.306,\n\t\t-1.185,\n\t\t43.324,\n\t\t-0.836,\n\t\t401.164,\n\t\t1.108,\n\t\t162,\n\t\t-2.29,\n\t\t0.891,\n\t\t-0.01,\n\t\t0.891,\n\t\t-0.01,\n\t\t0.868,\n\t\t-0.011,\n\t\t0.871,\n\t\t-0.013,\n\t\t0.855,\n\t\t-0.013,\n\t\t0.765,\n\t\t-0.004,\n\t\t-31.491,\n\t\t-1.185,\n\t\t42.488,\n\t\t-0.838,\n\t\t402.272,\n\t\t1.088,\n\t\t159,\n\t\t-2.328,\n\t\t0.881,\n\t\t-0.012,\n\t\t0.881,\n\t\t-0.012,\n\t\t0.857,\n\t\t-0.013,\n\t\t0.858,\n\t\t-0.013,\n\t\t0.842,\n\t\t-0.014,\n\t\t0.761,\n\t\t-0.003,\n\t\t-32.676,\n\t\t-1.186,\n\t\t41.65,\n\t\t-0.839,\n\t\t403.36,\n\t\t1.069,\n\t\t157,\n\t\t-2.367,\n\t\t0.869,\n\t\t-0.011,\n\t\t0.869,\n\t\t-0.011,\n\t\t0.844,\n\t\t-0.014,\n\t\t0.845,\n\t\t-0.014,\n\t\t0.828,\n\t\t-0.014,\n\t\t0.758,\n\t\t-0.004,\n\t\t-33.862,\n\t\t-1.185,\n\t\t40.811,\n\t\t-0.838,\n\t\t404.429,\n\t\t1.049,\n\t\t155,\n\t\t-2.406,\n\t\t0.858,\n\t\t-0.012,\n\t\t0.858,\n\t\t-0.012,\n\t\t0.83,\n\t\t-0.014,\n\t\t0.831,\n\t\t-0.015,\n\t\t0.814,\n\t\t-0.015,\n\t\t0.754,\n\t\t-0.004,\n\t\t-35.047,\n\t\t-1.186,\n\t\t39.973,\n\t\t-0.841,\n\t\t405.478,\n\t\t1.029,\n\t\t152,\n\t\t-2.446,\n\t\t0.846,\n\t\t-0.013,\n\t\t0.846,\n\t\t-0.013,\n\t\t0.816,\n\t\t-0.015,\n\t\t0.816,\n\t\t-0.015,\n\t\t0.799,\n\t\t-0.016,\n\t\t0.75,\n\t\t-0.003,\n\t\t-36.233,\n\t\t-1.185,\n\t\t39.132,\n\t\t-0.84,\n\t\t406.507,\n\t\t1.008,\n\t\t150,\n\t\t-2.487,\n\t\t0.833,\n\t\t-0.012,\n\t\t0.833,\n\t\t-0.012,\n\t\t0.801,\n\t\t-0.016,\n\t\t0.801,\n\t\t-0.016,\n\t\t0.783,\n\t\t-0.015,\n\t\t0.747,\n\t\t-0.004,\n\t\t-37.418,\n\t\t-1.186,\n\t\t38.292,\n\t\t-0.842,\n\t\t407.515,\n\t\t0.988,\n\t\t147,\n\t\t-2.529,\n\t\t0.821,\n\t\t-0.013,\n\t\t0.821,\n\t\t-0.013,\n\t\t0.785,\n\t\t-0.016,\n\t\t0.785,\n\t\t-0.016,\n\t\t0.768,\n\t\t-0.016,\n\t\t0.743,\n\t\t-0.004,\n\t\t-38.604,\n\t\t-1.186,\n\t\t37.45,\n\t\t-0.842,\n\t\t408.503,\n\t\t0.966,\n\t\t145,\n\t\t-2.571,\n\t\t0.808,\n\t\t-0.013,\n\t\t0.808,\n\t\t-0.013,\n\t\t0.769,\n\t\t-0.016,\n\t\t0.769,\n\t\t-0.016,\n\t\t0.752,\n\t\t-0.016,\n\t\t0.739,\n\t\t-0.003,\n\t\t-39.79,\n\t\t-1.186,\n\t\t36.608,\n\t\t-0.843,\n\t\t409.469,\n\t\t0.945,\n\t\t142,\n\t\t-2.614,\n\t\t0.795,\n\t\t-0.013,\n\t\t0.795,\n\t\t-0.013,\n\t\t0.753,\n\t\t-0.016,\n\t\t0.753,\n\t\t-0.016,\n\t\t0.736,\n\t\t-0.016,\n\t\t0.736,\n\t\t-0.004,\n\t\t-40.976,\n\t\t-1.185,\n\t\t35.765,\n\t\t-0.845,\n\t\t410.414,\n\t\t0.923,\n\t\t140,\n\t\t-2.657,\n\t\t0.782,\n\t\t-0.013,\n\t\t0.782,\n\t\t-0.013,\n\t\t0.737,\n\t\t-0.016,\n\t\t0.737,\n\t\t-0.016,\n\t\t0.72,\n\t\t-0.016,\n\t\t0.732,\n\t\t-0.004,\n\t\t-42.161,\n\t\t-1.186,\n\t\t34.92,\n\t\t-0.844,\n\t\t411.336,\n\t\t0.9,\n\t\t137,\n\t\t-2.702,\n\t\t0.769,\n\t\t-0.014,\n\t\t0.769,\n\t\t-0.014,\n\t\t0.721,\n\t\t-0.017,\n\t\t0.721,\n\t\t-0.017,\n\t\t0.704,\n\t\t-0.017,\n\t\t0.728,\n\t\t-0.003,\n\t\t-43.347,\n\t\t-1.186,\n\t\t34.076,\n\t\t-0.846,\n\t\t412.236,\n\t\t0.877,\n\t\t134,\n\t\t-2.747,\n\t\t0.755,\n\t\t-0.013,\n\t\t0.755,\n\t\t-0.013,\n\t\t0.704,\n\t\t-0.017,\n\t\t0.704,\n\t\t-0.017,\n\t\t0.687,\n\t\t-0.016,\n\t\t0.725,\n\t\t-0.004,\n\t\t-44.533,\n\t\t-1.186,\n\t\t33.23,\n\t\t-0.845,\n\t\t413.113,\n\t\t0.853,\n\t\t131,\n\t\t-2.792,\n\t\t0.742,\n\t\t-0.013,\n\t\t0.742,\n\t\t-0.013,\n\t\t0.687,\n\t\t-0.017,\n\t\t0.687,\n\t\t-0.016,\n\t\t0.671,\n\t\t-0.017,\n\t\t0.721,\n\t\t-0.004,\n\t\t-45.719,\n\t\t-1.186,\n\t\t32.385,\n\t\t-0.848,\n\t\t413.966,\n\t\t0.829,\n\t\t129,\n\t\t-2.838,\n\t\t0.729,\n\t\t-0.014,\n\t\t0.729,\n\t\t-0.014,\n\t\t0.67,\n\t\t-0.017,\n\t\t0.671,\n\t\t-0.017,\n\t\t0.654,\n\t\t-0.017,\n\t\t0.717,\n\t\t-0.004,\n\t\t-46.905,\n\t\t-1.186,\n\t\t31.537,\n\t\t-0.847,\n\t\t414.796,\n\t\t0.805,\n\t\t126,\n\t\t-2.885,\n\t\t0.715,\n\t\t-0.014,\n\t\t0.715,\n\t\t-0.014,\n\t\t0.653,\n\t\t-0.017,\n\t\t0.654,\n\t\t-0.017,\n\t\t0.637,\n\t\t-0.016,\n\t\t0.713,\n\t\t-0.003,\n\t\t-48.091,\n\t\t-1.186,\n\t\t30.69,\n\t\t-0.849,\n\t\t415.6,\n\t\t0.779,\n\t\t123,\n\t\t-2.932,\n\t\t0.701,\n\t\t-0.013,\n\t\t0.701,\n\t\t-0.013,\n\t\t0.636,\n\t\t-0.017,\n\t\t0.637,\n\t\t-0.017,\n\t\t0.621,\n\t\t-0.017,\n\t\t0.71,\n\t\t-0.004,\n\t\t-49.277,\n\t\t-1.186,\n\t\t29.841,\n\t\t-0.848,\n\t\t416.38,\n\t\t0.754,\n\t\t120,\n\t\t-2.98,\n\t\t0.688,\n\t\t-0.014,\n\t\t0.688,\n\t\t-0.014,\n\t\t0.619,\n\t\t-0.018,\n\t\t0.62,\n\t\t-0.018,\n\t\t0.604,\n\t\t-0.017,\n\t\t0.706,\n\t\t-0.004,\n\t\t-50.463,\n\t\t-1.186,\n\t\t28.993,\n\t\t-0.85,\n\t\t417.133,\n\t\t0.727,\n\t\t117,\n\t\t-3.028,\n\t\t0.674,\n\t\t-0.014,\n\t\t0.674,\n\t\t-0.014,\n\t\t0.601,\n\t\t-0.017,\n\t\t0.602,\n\t\t-0.017,\n\t\t0.587,\n\t\t-0.017,\n\t\t0.702,\n\t\t-0.004,\n\t\t-51.649,\n\t\t-1.186,\n\t\t28.143,\n\t\t-0.85,\n\t\t417.861,\n\t\t0.701,\n\t\t114,\n\t\t-3.077,\n\t\t0.66,\n\t\t-0.014,\n\t\t0.66,\n\t\t-0.014,\n\t\t0.584,\n\t\t-0.018,\n\t\t0.585,\n\t\t-0.017,\n\t\t0.57,\n\t\t-0.017,\n\t\t0.698,\n\t\t-0.004,\n\t\t-52.835,\n\t\t-1.186,\n\t\t27.293,\n\t\t-0.851,\n\t\t418.561,\n\t\t0.673,\n\t\t111,\n\t\t-3.126,\n\t\t0.646,\n\t\t-0.014,\n\t\t0.646,\n\t\t-0.014,\n\t\t0.566,\n\t\t-0.017,\n\t\t0.568,\n\t\t-0.018,\n\t\t0.553,\n\t\t-0.017,\n\t\t0.694,\n\t\t-0.004,\n\t\t-54.021,\n\t\t-1.186,\n\t\t26.442,\n\t\t-0.852,\n\t\t419.235,\n\t\t0.645,\n\t\t108,\n\t\t-3.176,\n\t\t0.632,\n\t\t-0.013,\n\t\t0.632,\n\t\t-0.013,\n\t\t0.549,\n\t\t-0.018,\n\t\t0.55,\n\t\t-0.017,\n\t\t0.536,\n\t\t-0.018,\n\t\t0.69,\n\t\t-0.004,\n\t\t-55.207,\n\t\t-1.186,\n\t\t25.59,\n\t\t-0.851,\n\t\t419.88,\n\t\t0.617,\n\t\t105,\n\t\t-3.226,\n\t\t0.619,\n\t\t-0.014,\n\t\t0.619,\n\t\t-0.014,\n\t\t0.531,\n\t\t-0.018,\n\t\t0.533,\n\t\t-0.018,\n\t\t0.518,\n\t\t-0.017,\n\t\t0.686,\n\t\t-0.004,\n\t\t-56.393,\n\t\t-1.186,\n\t\t24.739,\n\t\t-0.853,\n\t\t420.497,\n\t\t0.043,\n\t\t101,\n\t\t-0.235,\n\t\t0.605,\n\t\t-0.014,\n\t\t0.605,\n\t\t-0.014,\n\t\t0.513,\n\t\t-0.018,\n\t\t0.515,\n\t\t-0.018,\n\t\t0.501,\n\t\t-0.017,\n\t\t0.682,\n\t\t-0.003,\n\t\t-57.579,\n\t\t-1.187,\n\t\t23.886,\n\t\t-0.853,\n\t\t420.54,\n\t\t0.589,\n\t\t101,\n\t\t-3.299,\n\t\t0.591,\n\t\t-0.015,\n\t\t0.591,\n\t\t-0.015,\n\t\t0.495,\n\t\t-0.018,\n\t\t0.497,\n\t\t-0.017,\n\t\t0.484,\n\t\t-0.018,\n\t\t0.679,\n\t\t-0.005,\n\t\t-58.766,\n\t\t-1.186,\n\t\t23.033,\n\t\t-0.854,\n\t\t421.129,\n\t\t0.559,\n\t\t98,\n\t\t-3.35,\n\t\t0.576,\n\t\t-0.014,\n\t\t0.576,\n\t\t-0.014,\n\t\t0.477,\n\t\t-0.017,\n\t\t0.48,\n\t\t-0.018,\n\t\t0.466,\n\t\t-0.017,\n\t\t0.674,\n\t\t-0.004,\n\t\t-59.952,\n\t\t-1.186,\n\t\t22.179,\n\t\t-0.854,\n\t\t421.687,\n\t\t0.528,\n\t\t94,\n\t\t-3.402,\n\t\t0.562,\n\t\t-0.014,\n\t\t0.562,\n\t\t-0.014,\n\t\t0.46,\n\t\t-0.018,\n\t\t0.462,\n\t\t-0.018,\n\t\t0.449,\n\t\t-0.018,\n\t\t0.67,\n\t\t-0.004,\n\t\t-61.138,\n\t\t-1.186,\n\t\t21.325,\n\t\t-0.854,\n\t\t422.215,\n\t\t0.497,\n\t\t91,\n\t\t-3.454,\n\t\t0.548,\n\t\t-0.014,\n\t\t0.548,\n\t\t-0.014,\n\t\t0.442,\n\t\t-0.019,\n\t\t0.444,\n\t\t-0.018,\n\t\t0.431,\n\t\t-0.017,\n\t\t0.666,\n\t\t-0.004,\n\t\t-62.324,\n\t\t-1.186,\n\t\t20.471,\n\t\t-0.856,\n\t\t422.711,\n\t\t0.465,\n\t\t88,\n\t\t-3.507,\n\t\t0.534,\n\t\t-0.014,\n\t\t0.534,\n\t\t-0.014,\n\t\t0.423,\n\t\t-0.018,\n\t\t0.426,\n\t\t-0.017,\n\t\t0.414,\n\t\t-0.018,\n\t\t0.662,\n\t\t-0.004,\n\t\t-63.51,\n\t\t-1.187,\n\t\t19.615,\n\t\t-0.855,\n\t\t423.176,\n\t\t0.046,\n\t\t84,\n\t\t-0.363,\n\t\t0.52,\n\t\t-0.014,\n\t\t0.52,\n\t\t-0.014,\n\t\t0.405,\n\t\t-0.018,\n\t\t0.409,\n\t\t-0.018,\n\t\t0.396,\n\t\t-0.017,\n\t\t0.658,\n\t\t-0.005,\n\t\t-64.697,\n\t\t-1.186,\n\t\t18.76,\n\t\t-0.856,\n\t\t423.222,\n\t\t0.431,\n\t\t84,\n\t\t-3.583,\n\t\t0.506,\n\t\t-0.015,\n\t\t0.506,\n\t\t-0.015,\n\t\t0.387,\n\t\t-0.018,\n\t\t0.391,\n\t\t-0.018,\n\t\t0.379,\n\t\t-0.018,\n\t\t0.653,\n\t\t-0.004,\n\t\t-65.883,\n\t\t-1.186,\n\t\t17.904,\n\t\t-0.857,\n\t\t423.653,\n\t\t0.398,\n\t\t80,\n\t\t-3.636,\n\t\t0.491,\n\t\t-0.014,\n\t\t0.491,\n\t\t-0.014,\n\t\t0.369,\n\t\t-0.018,\n\t\t0.373,\n\t\t-0.018,\n\t\t0.361,\n\t\t-0.018,\n\t\t0.649,\n\t\t-0.005,\n\t\t-67.069,\n\t\t-1.187,\n\t\t17.047,\n\t\t-0.856,\n\t\t424.051,\n\t\t0.364,\n\t\t77,\n\t\t-3.69,\n\t\t0.477,\n\t\t-0.014,\n\t\t0.477,\n\t\t-0.014,\n\t\t0.351,\n\t\t-0.018,\n\t\t0.355,\n\t\t-0.018,\n\t\t0.343,\n\t\t-0.017,\n\t\t0.644,\n\t\t-0.004,\n\t\t-68.256,\n\t\t-1.186,\n\t\t16.191,\n\t\t-0.857,\n\t\t424.414,\n\t\t0.042,\n\t\t73,\n\t\t-0.45,\n\t\t0.463,\n\t\t-0.014,\n\t\t0.463,\n\t\t-0.014,\n\t\t0.333,\n\t\t-0.019,\n\t\t0.337,\n\t\t-0.018,\n\t\t0.326,\n\t\t-0.018,\n\t\t0.64,\n\t\t-0.005,\n\t\t-69.442,\n\t\t-1.186,\n\t\t15.334,\n\t\t-0.858,\n\t\t424.456,\n\t\t0.326,\n\t\t72,\n\t\t-3.768,\n\t\t0.449,\n\t\t-0.015,\n\t\t0.449,\n\t\t-0.015,\n\t\t0.314,\n\t\t-0.018,\n\t\t0.319,\n\t\t-0.019,\n\t\t0.308,\n\t\t-0.018,\n\t\t0.635,\n\t\t-0.005,\n\t\t-70.628,\n\t\t-1.187,\n\t\t14.476,\n\t\t-0.857,\n\t\t424.782,\n\t\t0.291,\n\t\t69,\n\t\t-3.823,\n\t\t0.434,\n\t\t-0.014,\n\t\t0.434,\n\t\t-0.014,\n\t\t0.296,\n\t\t-0.018,\n\t\t0.3,\n\t\t-0.018,\n\t\t0.29,\n\t\t-0.017,\n\t\t0.63,\n\t\t-0.004,\n\t\t-71.815,\n\t\t-1.186,\n\t\t13.619,\n\t\t-0.858,\n\t\t425.073,\n\t\t0.036,\n\t\t65,\n\t\t-0.515,\n\t\t0.42,\n\t\t-0.014,\n\t\t0.42,\n\t\t-0.014,\n\t\t0.278,\n\t\t-0.019,\n\t\t0.282,\n\t\t-0.018,\n\t\t0.273,\n\t\t-0.018,\n\t\t0.626,\n\t\t-0.009,\n\t\t-73.001,\n\t\t-1.187,\n\t\t12.761,\n\t\t-0.858,\n\t\t425.109,\n\t\t0.251,\n\t\t64,\n\t\t-3.903,\n\t\t0.406,\n\t\t-0.015,\n\t\t0.406,\n\t\t-0.015,\n\t\t0.259,\n\t\t-0.018,\n\t\t0.264,\n\t\t-0.018,\n\t\t0.255,\n\t\t-0.018,\n\t\t0.617,\n\t\t-0.015,\n\t\t-74.188,\n\t\t-1.186,\n\t\t11.903,\n\t\t-0.859,\n\t\t425.36,\n\t\t0.214,\n\t\t60,\n\t\t-3.958,\n\t\t0.391,\n\t\t-0.014,\n\t\t0.391,\n\t\t-0.014,\n\t\t0.241,\n\t\t-0.019,\n\t\t0.246,\n\t\t-0.018,\n\t\t0.237,\n\t\t-0.018,\n\t\t0.602,\n\t\t-0.018,\n\t\t-75.374,\n\t\t-1.186,\n\t\t11.044,\n\t\t-0.858,\n\t\t425.574,\n\t\t0.028,\n\t\t56,\n\t\t-0.581,\n\t\t0.377,\n\t\t-0.015,\n\t\t0.377,\n\t\t-0.015,\n\t\t0.222,\n\t\t-0.018,\n\t\t0.228,\n\t\t-0.018,\n\t\t0.219,\n\t\t-0.018,\n\t\t0.584,\n\t\t-0.025,\n\t\t-76.56,\n\t\t-1.187,\n\t\t10.186,\n\t\t-0.858,\n\t\t425.602,\n\t\t0.171,\n\t\t56,\n\t\t-4.039,\n\t\t0.362,\n\t\t-0.014,\n\t\t0.362,\n\t\t-0.014,\n\t\t0.204,\n\t\t-0.019,\n\t\t0.21,\n\t\t-0.019,\n\t\t0.201,\n\t\t-0.018,\n\t\t0.559,\n\t\t-0.03,\n\t\t-77.747,\n\t\t-1.186,\n\t\t9.328,\n\t\t-0.858,\n\t\t425.773,\n\t\t0.133,\n\t\t52,\n\t\t-4.095,\n\t\t0.348,\n\t\t-0.015,\n\t\t0.348,\n\t\t-0.015,\n\t\t0.185,\n\t\t-0.018,\n\t\t0.191,\n\t\t-0.018,\n\t\t0.183,\n\t\t-0.018,\n\t\t0.529,\n\t\t-0.035,\n\t\t-78.933,\n\t\t-1.187,\n\t\t8.47,\n\t\t-0.858,\n\t\t425.906,\n\t\t0.017,\n\t\t48,\n\t\t-0.648,\n\t\t0.333,\n\t\t-0.014,\n\t\t0.333,\n\t\t-0.014,\n\t\t0.167,\n\t\t-0.019,\n\t\t0.173,\n\t\t-0.018,\n\t\t0.165,\n\t\t-0.018,\n\t\t0.494,\n\t\t-0.041,\n\t\t-80.12,\n\t\t-1.186,\n\t\t7.612,\n\t\t-0.858,\n\t\t425.923,\n\t\t0.088,\n\t\t47,\n\t\t-4.177,\n\t\t0.319,\n\t\t-0.015,\n\t\t0.319,\n\t\t-0.015,\n\t\t0.148,\n\t\t-0.019,\n\t\t0.155,\n\t\t-0.019,\n\t\t0.147,\n\t\t-0.018,\n\t\t0.453,\n\t\t-0.045,\n\t\t-81.306,\n\t\t-1.187,\n\t\t6.754,\n\t\t-0.855,\n\t\t426.012,\n\t\t0.048,\n\t\t43,\n\t\t-4.233,\n\t\t0.304,\n\t\t-0.014,\n\t\t0.304,\n\t\t-0.014,\n\t\t0.129,\n\t\t-0.018,\n\t\t0.136,\n\t\t-0.018,\n\t\t0.129,\n\t\t-0.017,\n\t\t0.408,\n\t\t-0.05,\n\t\t-82.493,\n\t\t-1.186,\n\t\t5.899,\n\t\t-0.857,\n\t\t426.06,\n\t\t0.004,\n\t\t39,\n\t\t-0.716,\n\t\t0.29,\n\t\t-0.014,\n\t\t0.29,\n\t\t-0.014,\n\t\t0.111,\n\t\t-0.019,\n\t\t0.118,\n\t\t-0.018,\n\t\t0.112,\n\t\t-0.018,\n\t\t0.358,\n\t\t-0.055,\n\t\t-83.679,\n\t\t-1.186,\n\t\t5.042,\n\t\t-0.854,\n\t\t426.064,\n\t\t0.001,\n\t\t38,\n\t\t-4.316,\n\t\t0.276,\n\t\t-0.015,\n\t\t0.276,\n\t\t-0.015,\n\t\t0.092,\n\t\t-0.018,\n\t\t0.1,\n\t\t-0.019,\n\t\t0.094,\n\t\t-0.018,\n\t\t0.303,\n\t\t-0.06,\n\t\t-84.865,\n\t\t-1.187,\n\t\t4.188,\n\t\t-0.853,\n\t\t426.065,\n\t\t-0.004,\n\t\t34,\n\t\t-0.759,\n\t\t0.261,\n\t\t-0.014,\n\t\t0.261,\n\t\t-0.014,\n\t\t0.074,\n\t\t-0.019,\n\t\t0.081,\n\t\t-0.018,\n\t\t0.076,\n\t\t-0.018,\n\t\t0.243,\n\t\t-0.064,\n\t\t-86.052,\n\t\t-1.186,\n\t\t3.335,\n\t\t-0.848,\n\t\t426.061,\n\t\t-0.048,\n\t\t33,\n\t\t-4.399,\n\t\t0.247,\n\t\t-0.015,\n\t\t0.247,\n\t\t-0.015,\n\t\t0.055,\n\t\t-0.018,\n\t\t0.063,\n\t\t-0.018,\n\t\t0.058,\n\t\t-0.018,\n\t\t0.179,\n\t\t-0.069,\n\t\t-87.238,\n\t\t-1.187,\n\t\t2.487,\n\t\t-0.844,\n\t\t426.013,\n\t\t-0.013,\n\t\t28,\n\t\t-0.802,\n\t\t0.232,\n\t\t-0.014,\n\t\t0.232,\n\t\t-0.014,\n\t\t0.037,\n\t\t-0.019,\n\t\t0.045,\n\t\t-0.018,\n\t\t0.04,\n\t\t-0.018,\n\t\t0.11,\n\t\t-0.072,\n\t\t-88.425,\n\t\t-1.186,\n\t\t1.643,\n\t\t-0.84,\n\t\t426,\n\t\t0,\n\t\t28,\n\t\t0,\n\t\t0.218,\n\t\t-0.014,\n\t\t0.218,\n\t\t-0.014,\n\t\t0.018,\n\t\t-0.018,\n\t\t0.027,\n\t\t-0.018,\n\t\t0.022,\n\t\t-0.018,\n\t\t0.038,\n\t\t-0.038,\n\t\t-89.611,\n\t\t-1.185,\n\t\t0.803,\n\t\t-0.803],\n\t\t\"splinelength\":724,\n\t\t\"scrollbar\":{\n\t\t\t\"order\":10,\n\t\t\t\"side\":0,\n\t\t\t\"line_weight\":20,\n\t\t\t\"slider_image\":\"assets/Horiz.png.imag\",\n\t\t\t\"min_slider_size\":0,\n\t\t\t\"normal_RGBA\":-1,\n\t\t\t\"select_RGBA\":-1,\n\t\t\t\"active\":1,\n\t\t\t\"name\":\"page\",\n\t\t\t\"pagesize\":80,\n\t\t\t\"use_scrollBar\":1,\n\t\t\t\"hide_mode\":1,\n\t\t\t\"default_scroll\":0\n\t\t}\n\t}],\n\t\"width\":960,\n\t\"height\":640\n}"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/android/start.lua",
    "content": "function setup()\r\n        local x = 0\r\n        local y = 0\r\n        local pForm = UI_Form(nil, 0, x, y, \"asset://list.json\")\r\n\t\r\n\tsysCommand(pForm, UI_FORM_ANIM_ENTER)\r\n\t\r\n\tlocal pList = sysCommand(pForm, UI_FORM_UPDATE_NODE, \"task_list1\", FORM_NODE_TASK);\r\n\tfor i = 1, 50 do\r\n\t\tsysCommand(pList, UI_LIST_ITEM_ADD, \"asset://ui_item\" .. math.random(1,2) .. \".json\")\r\n\tend\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction callback(pList, type, tapX, tapY, moveX, moveY)\r\n\tlocal pos = sysCommand(pList, UI_LIST_GET_POSITION)\r\n\tlocal newPos = sysCommand(pList, UI_LIST_SET_POSITION, pos - moveX)\r\nend\r\n"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/android/ui_item1.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"AVATAR0001.png.imag\",\n\t\t\"x\":0,\n\t\t\"y\":0,\n\t\t\"priority\":300,\n\t\t\"default\":\"assets/AVATAR0001.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":80,\n\t\"height\":165\n}"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/android/ui_item2.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"AVATAR0002.png.imag\",\n\t\t\"x\":0,\n\t\t\"y\":0,\n\t\t\"priority\":100,\n\t\t\"default\":\"assets/AVATAR0002.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":80,\n\t\"height\":165\n}"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/iphone/list.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"task_list1\",\n\t\t\"x\":21,\n\t\t\"y\":21,\n\t\t\"priority\":35,\n\t\t\"class\":\"task_list\",\n\t\t\"cliph\":500,\n\t\t\"clipw\":500,\n\t\t\"clipend\":9999,\n\t\t\"width\":60,\n\t\t\"height\":60,\n\t\t\"callback\":\"callback\",\n\t\t\"orientation\":0,\n\t\t\"align\":0,\n\t\t\"splinemask\":508,\n\t\t\"splinecount\":256,\n\t\t\"splinedata\":[4,\n\t\t0.095,\n\t\t31,\n\t\t4.486,\n\t\t0.204,\n\t\t0.013,\n\t\t0.204,\n\t\t0.013,\n\t\t0.004,\n\t\t0.018,\n\t\t0,\n\t\t0.017,\n\t\t0.009,\n\t\t0.017,\n\t\t0.004,\n\t\t0.065,\n\t\t90.796,\n\t\t-1.171,\n\t\t0,\n\t\t0.821,\n\t\t4.095,\n\t\t0.13,\n\t\t36,\n\t\t4.427,\n\t\t0.217,\n\t\t0.015,\n\t\t0.217,\n\t\t0.015,\n\t\t0.022,\n\t\t0.019,\n\t\t0.017,\n\t\t0.018,\n\t\t0.026,\n\t\t0.018,\n\t\t0.069,\n\t\t0.068,\n\t\t89.625,\n\t\t-1.172,\n\t\t0.821,\n\t\t0.847,\n\t\t4.224,\n\t\t0.026,\n\t\t40,\n\t\t0.773,\n\t\t0.232,\n\t\t0.014,\n\t\t0.232,\n\t\t0.014,\n\t\t0.041,\n\t\t0.018,\n\t\t0.035,\n\t\t0.017,\n\t\t0.044,\n\t\t0.018,\n\t\t0.137,\n\t\t0.064,\n\t\t88.453,\n\t\t-1.172,\n\t\t1.668,\n\t\t0.858,\n\t\t4.251,\n\t\t0.17,\n\t\t41,\n\t\t4.342,\n\t\t0.246,\n\t\t0.014,\n\t\t0.246,\n\t\t0.014,\n\t\t0.059,\n\t\t0.019,\n\t\t0.052,\n\t\t0.018,\n\t\t0.062,\n\t\t0.018,\n\t\t0.201,\n\t\t0.06,\n\t\t87.281,\n\t\t-1.172,\n\t\t2.526,\n\t\t0.861,\n\t\t4.42,\n\t\t0.032,\n\t\t45,\n\t\t0.73,\n\t\t0.26,\n\t\t0.014,\n\t\t0.26,\n\t\t0.014,\n\t\t0.078,\n\t\t0.018,\n\t\t0.07,\n\t\t0.018,\n\t\t0.08,\n\t\t0.018,\n\t\t0.261,\n\t\t0.056,\n\t\t86.109,\n\t\t-1.172,\n\t\t3.387,\n\t\t0.868,\n\t\t4.452,\n\t\t0.208,\n\t\t46,\n\t\t4.257,\n\t\t0.274,\n\t\t0.014,\n\t\t0.274,\n\t\t0.014,\n\t\t0.096,\n\t\t0.019,\n\t\t0.088,\n\t\t0.017,\n\t\t0.098,\n\t\t0.018,\n\t\t0.317,\n\t\t0.052,\n\t\t84.937,\n\t\t-1.172,\n\t\t4.255,\n\t\t0.867,\n\t\t4.661,\n\t\t0.241,\n\t\t50,\n\t\t4.199,\n\t\t0.288,\n\t\t0.015,\n\t\t0.288,\n\t\t0.015,\n\t\t0.115,\n\t\t0.018,\n\t\t0.105,\n\t\t0.018,\n\t\t0.116,\n\t\t0.018,\n\t\t0.369,\n\t\t0.048,\n\t\t83.765,\n\t\t-1.172,\n\t\t5.122,\n\t\t0.869,\n\t\t4.902,\n\t\t0.041,\n\t\t55,\n\t\t0.661,\n\t\t0.303,\n\t\t0.014,\n\t\t0.303,\n\t\t0.014,\n\t\t0.133,\n\t\t0.018,\n\t\t0.123,\n\t\t0.018,\n\t\t0.134,\n\t\t0.018,\n\t\t0.417,\n\t\t0.043,\n\t\t82.593,\n\t\t-1.172,\n\t\t5.991,\n\t\t0.87,\n\t\t4.943,\n\t\t0.278,\n\t\t55,\n\t\t4.115,\n\t\t0.317,\n\t\t0.014,\n\t\t0.317,\n\t\t0.014,\n\t\t0.151,\n\t\t0.019,\n\t\t0.141,\n\t\t0.017,\n\t\t0.152,\n\t\t0.018,\n\t\t0.46,\n\t\t0.038,\n\t\t81.421,\n\t\t-1.171,\n\t\t6.861,\n\t\t0.871,\n\t\t5.221,\n\t\t0.045,\n\t\t59,\n\t\t0.619,\n\t\t0.331,\n\t\t0.014,\n\t\t0.331,\n\t\t0.014,\n\t\t0.17,\n\t\t0.018,\n\t\t0.158,\n\t\t0.018,\n\t\t0.17,\n\t\t0.018,\n\t\t0.498,\n\t\t0.034,\n\t\t80.25,\n\t\t-1.172,\n\t\t7.732,\n\t\t0.871,\n\t\t5.266,\n\t\t0.313,\n\t\t60,\n\t\t4.032,\n\t\t0.345,\n\t\t0.014,\n\t\t0.345,\n\t\t0.014,\n\t\t0.188,\n\t\t0.019,\n\t\t0.176,\n\t\t0.018,\n\t\t0.188,\n\t\t0.018,\n\t\t0.532,\n\t\t0.029,\n\t\t79.078,\n\t\t-1.172,\n\t\t8.603,\n\t\t0.872,\n\t\t5.579,\n\t\t0.344,\n\t\t64,\n\t\t3.974,\n\t\t0.359,\n\t\t0.014,\n\t\t0.359,\n\t\t0.014,\n\t\t0.207,\n\t\t0.018,\n\t\t0.194,\n\t\t0.017,\n\t\t0.206,\n\t\t0.018,\n\t\t0.561,\n\t\t0.024,\n\t\t77.906,\n\t\t-1.172,\n\t\t9.475,\n\t\t0.871,\n\t\t5.924,\n\t\t0.051,\n\t\t68,\n\t\t0.551,\n\t\t0.373,\n\t\t0.015,\n\t\t0.373,\n\t\t0.015,\n\t\t0.225,\n\t\t0.018,\n\t\t0.211,\n\t\t0.018,\n\t\t0.224,\n\t\t0.017,\n\t\t0.585,\n\t\t0.019,\n\t\t76.734,\n\t\t-1.172,\n\t\t10.346,\n\t\t0.872,\n\t\t5.974,\n\t\t0.377,\n\t\t68,\n\t\t3.892,\n\t\t0.388,\n\t\t0.014,\n\t\t0.388,\n\t\t0.014,\n\t\t0.243,\n\t\t0.019,\n\t\t0.229,\n\t\t0.017,\n\t\t0.241,\n\t\t0.018,\n\t\t0.604,\n\t\t0.014,\n\t\t75.562,\n\t\t-1.172,\n\t\t11.218,\n\t\t0.872,\n\t\t6.352,\n\t\t0.407,\n\t\t72,\n\t\t3.835,\n\t\t0.402,\n\t\t0.014,\n\t\t0.402,\n\t\t0.014,\n\t\t0.262,\n\t\t0.018,\n\t\t0.246,\n\t\t0.018,\n\t\t0.259,\n\t\t0.018,\n\t\t0.618,\n\t\t0.006,\n\t\t74.39,\n\t\t-1.172,\n\t\t12.09,\n\t\t0.871,\n\t\t6.759,\n\t\t0.054,\n\t\t76,\n\t\t0.485,\n\t\t0.416,\n\t\t0.014,\n\t\t0.416,\n\t\t0.014,\n\t\t0.28,\n\t\t0.018,\n\t\t0.264,\n\t\t0.017,\n\t\t0.277,\n\t\t0.018,\n\t\t0.624,\n\t\t0.005,\n\t\t73.218,\n\t\t-1.172,\n\t\t12.961,\n\t\t0.871,\n\t\t6.813,\n\t\t0.438,\n\t\t77,\n\t\t3.754,\n\t\t0.43,\n\t\t0.014,\n\t\t0.43,\n\t\t0.014,\n\t\t0.298,\n\t\t0.018,\n\t\t0.281,\n\t\t0.018,\n\t\t0.295,\n\t\t0.018,\n\t\t0.629,\n\t\t0.006,\n\t\t72.046,\n\t\t-1.172,\n\t\t13.832,\n\t\t0.872,\n\t\t7.251,\n\t\t0.466,\n\t\t80,\n\t\t3.698,\n\t\t0.444,\n\t\t0.014,\n\t\t0.444,\n\t\t0.014,\n\t\t0.316,\n\t\t0.019,\n\t\t0.299,\n\t\t0.017,\n\t\t0.313,\n\t\t0.017,\n\t\t0.635,\n\t\t0.005,\n\t\t70.874,\n\t\t-1.172,\n\t\t14.704,\n\t\t0.87,\n\t\t7.717,\n\t\t0.494,\n\t\t84,\n\t\t3.642,\n\t\t0.458,\n\t\t0.014,\n\t\t0.458,\n\t\t0.014,\n\t\t0.335,\n\t\t0.018,\n\t\t0.316,\n\t\t0.018,\n\t\t0.33,\n\t\t0.018,\n\t\t0.64,\n\t\t0.004,\n\t\t69.702,\n\t\t-1.172,\n\t\t15.574,\n\t\t0.871,\n\t\t8.212,\n\t\t0.056,\n\t\t88,\n\t\t0.394,\n\t\t0.472,\n\t\t0.014,\n\t\t0.472,\n\t\t0.014,\n\t\t0.353,\n\t\t0.018,\n\t\t0.334,\n\t\t0.017,\n\t\t0.348,\n\t\t0.018,\n\t\t0.644,\n\t\t0.005,\n\t\t68.53,\n\t\t-1.172,\n\t\t16.445,\n\t\t0.87,\n\t\t8.267,\n\t\t0.522,\n\t\t88,\n\t\t3.562,\n\t\t0.486,\n\t\t0.014,\n\t\t0.486,\n\t\t0.014,\n\t\t0.371,\n\t\t0.018,\n\t\t0.351,\n\t\t0.017,\n\t\t0.366,\n\t\t0.017,\n\t\t0.649,\n\t\t0.004,\n\t\t67.358,\n\t\t-1.171,\n\t\t17.315,\n\t\t0.869,\n\t\t8.79,\n\t\t0.549,\n\t\t92,\n\t\t3.507,\n\t\t0.5,\n\t\t0.014,\n\t\t0.5,\n\t\t0.014,\n\t\t0.389,\n\t\t0.018,\n\t\t0.368,\n\t\t0.018,\n\t\t0.383,\n\t\t0.018,\n\t\t0.653,\n\t\t0.005,\n\t\t66.187,\n\t\t-1.172,\n\t\t18.184,\n\t\t0.87,\n\t\t9.338,\n\t\t0.575,\n\t\t95,\n\t\t3.453,\n\t\t0.514,\n\t\t0.014,\n\t\t0.514,\n\t\t0.014,\n\t\t0.407,\n\t\t0.018,\n\t\t0.386,\n\t\t0.017,\n\t\t0.401,\n\t\t0.017,\n\t\t0.658,\n\t\t0.004,\n\t\t65.015,\n\t\t-1.172,\n\t\t19.054,\n\t\t0.869,\n\t\t9.913,\n\t\t0.6,\n\t\t99,\n\t\t3.398,\n\t\t0.528,\n\t\t0.014,\n\t\t0.528,\n\t\t0.014,\n\t\t0.425,\n\t\t0.018,\n\t\t0.403,\n\t\t0.017,\n\t\t0.418,\n\t\t0.018,\n\t\t0.662,\n\t\t0.004,\n\t\t63.843,\n\t\t-1.172,\n\t\t19.923,\n\t\t0.868,\n\t\t10.513,\n\t\t0.051,\n\t\t102,\n\t\t0.282,\n\t\t0.542,\n\t\t0.014,\n\t\t0.542,\n\t\t0.014,\n\t\t0.443,\n\t\t0.018,\n\t\t0.42,\n\t\t0.017,\n\t\t0.436,\n\t\t0.017,\n\t\t0.666,\n\t\t0.004,\n\t\t62.671,\n\t\t-1.172,\n\t\t20.791,\n\t\t0.867,\n\t\t10.564,\n\t\t0.623,\n\t\t102,\n\t\t3.321,\n\t\t0.556,\n\t\t0.014,\n\t\t0.556,\n\t\t0.014,\n\t\t0.461,\n\t\t0.018,\n\t\t0.437,\n\t\t0.018,\n\t\t0.453,\n\t\t0.018,\n\t\t0.67,\n\t\t0.004,\n\t\t61.499,\n\t\t-1.172,\n\t\t21.658,\n\t\t0.868,\n\t\t11.187,\n\t\t0.647,\n\t\t106,\n\t\t3.267,\n\t\t0.57,\n\t\t0.013,\n\t\t0.57,\n\t\t0.013,\n\t\t0.479,\n\t\t0.018,\n\t\t0.455,\n\t\t0.017,\n\t\t0.471,\n\t\t0.017,\n\t\t0.674,\n\t\t0.004,\n\t\t60.327,\n\t\t-1.171,\n\t\t22.526,\n\t\t0.867,\n\t\t11.835,\n\t\t0.671,\n\t\t109,\n\t\t3.214,\n\t\t0.583,\n\t\t0.014,\n\t\t0.583,\n\t\t0.014,\n\t\t0.497,\n\t\t0.017,\n\t\t0.472,\n\t\t0.017,\n\t\t0.488,\n\t\t0.018,\n\t\t0.678,\n\t\t0.005,\n\t\t59.156,\n\t\t-1.172,\n\t\t23.393,\n\t\t0.866,\n\t\t12.506,\n\t\t0.694,\n\t\t112,\n\t\t3.162,\n\t\t0.597,\n\t\t0.014,\n\t\t0.597,\n\t\t0.014,\n\t\t0.514,\n\t\t0.018,\n\t\t0.489,\n\t\t0.017,\n\t\t0.506,\n\t\t0.017,\n\t\t0.683,\n\t\t0.004,\n\t\t57.984,\n\t\t-1.172,\n\t\t24.259,\n\t\t0.866,\n\t\t13.199,\n\t\t0.716,\n\t\t115,\n\t\t3.109,\n\t\t0.611,\n\t\t0.014,\n\t\t0.611,\n\t\t0.014,\n\t\t0.532,\n\t\t0.018,\n\t\t0.506,\n\t\t0.017,\n\t\t0.523,\n\t\t0.017,\n\t\t0.687,\n\t\t0.004,\n\t\t56.812,\n\t\t-1.172,\n\t\t25.125,\n\t\t0.864,\n\t\t13.915,\n\t\t0.738,\n\t\t118,\n\t\t3.057,\n\t\t0.625,\n\t\t0.013,\n\t\t0.625,\n\t\t0.013,\n\t\t0.55,\n\t\t0.017,\n\t\t0.523,\n\t\t0.017,\n\t\t0.54,\n\t\t0.017,\n\t\t0.691,\n\t\t0.004,\n\t\t55.64,\n\t\t-1.172,\n\t\t25.989,\n\t\t0.865,\n\t\t14.653,\n\t\t0.032,\n\t\t122,\n\t\t0.131,\n\t\t0.638,\n\t\t0.014,\n\t\t0.638,\n\t\t0.014,\n\t\t0.567,\n\t\t0.018,\n\t\t0.54,\n\t\t0.016,\n\t\t0.557,\n\t\t0.017,\n\t\t0.695,\n\t\t0.003,\n\t\t54.468,\n\t\t-1.171,\n\t\t26.854,\n\t\t0.864,\n\t\t14.686,\n\t\t0.755,\n\t\t122,\n\t\t2.984,\n\t\t0.652,\n\t\t0.013,\n\t\t0.652,\n\t\t0.013,\n\t\t0.585,\n\t\t0.017,\n\t\t0.556,\n\t\t0.017,\n\t\t0.574,\n\t\t0.017,\n\t\t0.698,\n\t\t0.004,\n\t\t53.297,\n\t\t-1.172,\n\t\t27.718,\n\t\t0.863,\n\t\t15.441,\n\t\t0.775,\n\t\t125,\n\t\t2.933,\n\t\t0.665,\n\t\t0.014,\n\t\t0.665,\n\t\t0.014,\n\t\t0.602,\n\t\t0.017,\n\t\t0.573,\n\t\t0.017,\n\t\t0.591,\n\t\t0.017,\n\t\t0.702,\n\t\t0.004,\n\t\t52.125,\n\t\t-1.172,\n\t\t28.581,\n\t\t0.863,\n\t\t16.216,\n\t\t0.795,\n\t\t128,\n\t\t2.883,\n\t\t0.679,\n\t\t0.013,\n\t\t0.679,\n\t\t0.013,\n\t\t0.619,\n\t\t0.017,\n\t\t0.59,\n\t\t0.017,\n\t\t0.608,\n\t\t0.017,\n\t\t0.706,\n\t\t0.004,\n\t\t50.953,\n\t\t-1.172,\n\t\t29.444,\n\t\t0.861,\n\t\t17.011,\n\t\t0.814,\n\t\t130,\n\t\t2.833,\n\t\t0.692,\n\t\t0.014,\n\t\t0.692,\n\t\t0.014,\n\t\t0.636,\n\t\t0.018,\n\t\t0.607,\n\t\t0.016,\n\t\t0.625,\n\t\t0.017,\n\t\t0.71,\n\t\t0.004,\n\t\t49.781,\n\t\t-1.171,\n\t\t30.305,\n\t\t0.861,\n\t\t17.825,\n\t\t0.833,\n\t\t133,\n\t\t2.784,\n\t\t0.706,\n\t\t0.013,\n\t\t0.706,\n\t\t0.013,\n\t\t0.654,\n\t\t0.017,\n\t\t0.623,\n\t\t0.017,\n\t\t0.642,\n\t\t0.017,\n\t\t0.714,\n\t\t0.004,\n\t\t48.61,\n\t\t-1.172,\n\t\t31.166,\n\t\t0.86,\n\t\t18.658,\n\t\t0.851,\n\t\t136,\n\t\t2.735,\n\t\t0.719,\n\t\t0.014,\n\t\t0.719,\n\t\t0.014,\n\t\t0.671,\n\t\t0.016,\n\t\t0.64,\n\t\t0.016,\n\t\t0.659,\n\t\t0.016,\n\t\t0.718,\n\t\t0.004,\n\t\t47.438,\n\t\t-1.172,\n\t\t32.026,\n\t\t0.86,\n\t\t19.509,\n\t\t0.868,\n\t\t139,\n\t\t2.686,\n\t\t0.733,\n\t\t0.013,\n\t\t0.733,\n\t\t0.013,\n\t\t0.687,\n\t\t0.017,\n\t\t0.656,\n\t\t0.016,\n\t\t0.675,\n\t\t0.017,\n\t\t0.722,\n\t\t0.003,\n\t\t46.266,\n\t\t-1.171,\n\t\t32.886,\n\t\t0.859,\n\t\t20.377,\n\t\t0.885,\n\t\t141,\n\t\t2.638,\n\t\t0.746,\n\t\t0.013,\n\t\t0.746,\n\t\t0.013,\n\t\t0.704,\n\t\t0.017,\n\t\t0.672,\n\t\t0.016,\n\t\t0.692,\n\t\t0.016,\n\t\t0.725,\n\t\t0.004,\n\t\t45.095,\n\t\t-1.172,\n\t\t33.745,\n\t\t0.859,\n\t\t21.262,\n\t\t0.902,\n\t\t144,\n\t\t2.591,\n\t\t0.759,\n\t\t0.013,\n\t\t0.759,\n\t\t0.013,\n\t\t0.721,\n\t\t0.016,\n\t\t0.688,\n\t\t0.016,\n\t\t0.708,\n\t\t0.017,\n\t\t0.729,\n\t\t0.004,\n\t\t43.923,\n\t\t-1.172,\n\t\t34.604,\n\t\t0.856,\n\t\t22.164,\n\t\t0.918,\n\t\t147,\n\t\t2.544,\n\t\t0.772,\n\t\t0.013,\n\t\t0.772,\n\t\t0.013,\n\t\t0.737,\n\t\t0.016,\n\t\t0.704,\n\t\t0.016,\n\t\t0.725,\n\t\t0.016,\n\t\t0.733,\n\t\t0.004,\n\t\t42.751,\n\t\t-1.171,\n\t\t35.46,\n\t\t0.858,\n\t\t23.082,\n\t\t0.933,\n\t\t149,\n\t\t2.498,\n\t\t0.785,\n\t\t0.013,\n\t\t0.785,\n\t\t0.013,\n\t\t0.753,\n\t\t0.016,\n\t\t0.72,\n\t\t0.016,\n\t\t0.741,\n\t\t0.016,\n\t\t0.737,\n\t\t0.003,\n\t\t41.58,\n\t\t-1.172,\n\t\t36.318,\n\t\t0.854,\n\t\t24.015,\n\t\t0.948,\n\t\t152,\n\t\t2.453,\n\t\t0.798,\n\t\t0.012,\n\t\t0.798,\n\t\t0.012,\n\t\t0.769,\n\t\t0.016,\n\t\t0.736,\n\t\t0.015,\n\t\t0.757,\n\t\t0.015,\n\t\t0.74,\n\t\t0.004,\n\t\t40.408,\n\t\t-1.172,\n\t\t37.172,\n\t\t0.856,\n\t\t24.963,\n\t\t0.963,\n\t\t154,\n\t\t2.408,\n\t\t0.81,\n\t\t0.013,\n\t\t0.81,\n\t\t0.013,\n\t\t0.785,\n\t\t0.015,\n\t\t0.751,\n\t\t0.016,\n\t\t0.772,\n\t\t0.016,\n\t\t0.744,\n\t\t0.004,\n\t\t39.236,\n\t\t-1.171,\n\t\t38.028,\n\t\t0.853,\n\t\t25.926,\n\t\t2.032,\n\t\t157,\n\t\t4.834,\n\t\t0.823,\n\t\t0.012,\n\t\t0.823,\n\t\t0.012,\n\t\t0.8,\n\t\t0.015,\n\t\t0.767,\n\t\t0.015,\n\t\t0.788,\n\t\t0.015,\n\t\t0.748,\n\t\t0.003,\n\t\t38.065,\n\t\t-1.172,\n\t\t38.881,\n\t\t0.853,\n\t\t27.958,\n\t\t1.012,\n\t\t161,\n\t\t2.292,\n\t\t0.835,\n\t\t0.012,\n\t\t0.835,\n\t\t0.012,\n\t\t0.815,\n\t\t0.015,\n\t\t0.782,\n\t\t0.015,\n\t\t0.803,\n\t\t0.015,\n\t\t0.751,\n\t\t0.004,\n\t\t36.893,\n\t\t-1.171,\n\t\t39.734,\n\t\t0.853,\n\t\t28.97,\n\t\t1.025,\n\t\t164,\n\t\t2.25,\n\t\t0.847,\n\t\t0.012,\n\t\t0.847,\n\t\t0.012,\n\t\t0.83,\n\t\t0.014,\n\t\t0.797,\n\t\t0.014,\n\t\t0.818,\n\t\t0.015,\n\t\t0.755,\n\t\t0.004,\n\t\t35.722,\n\t\t-1.172,\n\t\t40.587,\n\t\t0.851,\n\t\t29.995,\n\t\t1.038,\n\t\t166,\n\t\t2.208,\n\t\t0.859,\n\t\t0.012,\n\t\t0.859,\n\t\t0.012,\n\t\t0.844,\n\t\t0.013,\n\t\t0.811,\n\t\t0.014,\n\t\t0.833,\n\t\t0.014,\n\t\t0.759,\n\t\t0.003,\n\t\t34.55,\n\t\t-1.171,\n\t\t41.438,\n\t\t0.852,\n\t\t31.033,\n\t\t1.05,\n\t\t168,\n\t\t2.166,\n\t\t0.871,\n\t\t0.011,\n\t\t0.871,\n\t\t0.011,\n\t\t0.857,\n\t\t0.013,\n\t\t0.825,\n\t\t0.014,\n\t\t0.847,\n\t\t0.013,\n\t\t0.762,\n\t\t0.004,\n\t\t33.379,\n\t\t-1.172,\n\t\t42.29,\n\t\t0.848,\n\t\t32.082,\n\t\t1.061,\n\t\t170,\n\t\t2.126,\n\t\t0.882,\n\t\t0.011,\n\t\t0.882,\n\t\t0.011,\n\t\t0.87,\n\t\t0.007,\n\t\t0.839,\n\t\t0.011,\n\t\t0.86,\n\t\t0.014,\n\t\t0.766,\n\t\t0.004,\n\t\t32.207,\n\t\t-1.171,\n\t\t43.138,\n\t\t0.848,\n\t\t33.144,\n\t\t2.283,\n\t\t172,\n\t\t4.368,\n\t\t0.893,\n\t\t0.009,\n\t\t0.893,\n\t\t0.009,\n\t\t0.877,\n\t\t0.004,\n\t\t0.85,\n\t\t0.013,\n\t\t0.874,\n\t\t0.01,\n\t\t0.77,\n\t\t0.003,\n\t\t31.036,\n\t\t-1.172,\n\t\t43.986,\n\t\t0.848,\n\t\t35.426,\n\t\t1.105,\n\t\t177,\n\t\t2.021,\n\t\t0.902,\n\t\t0.006,\n\t\t0.902,\n\t\t0.006,\n\t\t0.881,\n\t\t0.005,\n\t\t0.863,\n\t\t0.005,\n\t\t0.884,\n\t\t0.007,\n\t\t0.773,\n\t\t0.004,\n\t\t29.864,\n\t\t-1.171,\n\t\t44.834,\n\t\t0.846,\n\t\t36.531,\n\t\t1.115,\n\t\t179,\n\t\t1.983,\n\t\t0.908,\n\t\t0.003,\n\t\t0.908,\n\t\t0.003,\n\t\t0.886,\n\t\t0.003,\n\t\t0.868,\n\t\t0.005,\n\t\t0.891,\n\t\t0.005,\n\t\t0.777,\n\t\t0.003,\n\t\t28.693,\n\t\t-1.171,\n\t\t45.68,\n\t\t0.847,\n\t\t37.646,\n\t\t1.126,\n\t\t181,\n\t\t1.945,\n\t\t0.911,\n\t\t0.004,\n\t\t0.911,\n\t\t0.004,\n\t\t0.889,\n\t\t0.004,\n\t\t0.873,\n\t\t0.005,\n\t\t0.896,\n\t\t0.003,\n\t\t0.78,\n\t\t0.004,\n\t\t27.522,\n\t\t-1.172,\n\t\t46.527,\n\t\t0.843,\n\t\t38.772,\n\t\t1.136,\n\t\t183,\n\t\t1.909,\n\t\t0.915,\n\t\t0.002,\n\t\t0.915,\n\t\t0.002,\n\t\t0.893,\n\t\t0.003,\n\t\t0.878,\n\t\t0.003,\n\t\t0.899,\n\t\t0.003,\n\t\t0.784,\n\t\t0.004,\n\t\t26.35,\n\t\t-1.171,\n\t\t47.37,\n\t\t0.844,\n\t\t39.908,\n\t\t2.484,\n\t\t185,\n\t\t3.998,\n\t\t0.917,\n\t\t0.003,\n\t\t0.917,\n\t\t0.003,\n\t\t0.896,\n\t\t0.003,\n\t\t0.881,\n\t\t0.004,\n\t\t0.902,\n\t\t0.004,\n\t\t0.788,\n\t\t0.003,\n\t\t25.179,\n\t\t-1.171,\n\t\t48.214,\n\t\t0.843,\n\t\t42.392,\n\t\t1.176,\n\t\t189,\n\t\t1.813,\n\t\t0.92,\n\t\t0.002,\n\t\t0.92,\n\t\t0.002,\n\t\t0.899,\n\t\t0.003,\n\t\t0.885,\n\t\t0.003,\n\t\t0.906,\n\t\t0.003,\n\t\t0.791,\n\t\t0.004,\n\t\t24.008,\n\t\t-1.171,\n\t\t49.057,\n\t\t0.84,\n\t\t43.567,\n\t\t1.185,\n\t\t191,\n\t\t1.78,\n\t\t0.922,\n\t\t0.002,\n\t\t0.922,\n\t\t0.002,\n\t\t0.902,\n\t\t0.002,\n\t\t0.888,\n\t\t0.002,\n\t\t0.909,\n\t\t0.003,\n\t\t0.795,\n\t\t0.003,\n\t\t22.837,\n\t\t-1.171,\n\t\t49.897,\n\t\t0.842,\n\t\t44.753,\n\t\t2.617,\n\t\t192,\n\t\t3.768,\n\t\t0.924,\n\t\t0.002,\n\t\t0.924,\n\t\t0.002,\n\t\t0.904,\n\t\t0.003,\n\t\t0.89,\n\t\t0.004,\n\t\t0.912,\n\t\t0.002,\n\t\t0.798,\n\t\t0.004,\n\t\t21.666,\n\t\t-1.172,\n\t\t50.739,\n\t\t0.837,\n\t\t47.37,\n\t\t1.224,\n\t\t196,\n\t\t1.69,\n\t\t0.926,\n\t\t0.001,\n\t\t0.926,\n\t\t0.001,\n\t\t0.907,\n\t\t0.003,\n\t\t0.894,\n\t\t0.002,\n\t\t0.914,\n\t\t0.002,\n\t\t0.802,\n\t\t0.003,\n\t\t20.494,\n\t\t-1.171,\n\t\t51.576,\n\t\t0.838,\n\t\t48.594,\n\t\t1.234,\n\t\t198,\n\t\t1.659,\n\t\t0.927,\n\t\t0.002,\n\t\t0.927,\n\t\t0.002,\n\t\t0.91,\n\t\t0.002,\n\t\t0.896,\n\t\t0.002,\n\t\t0.916,\n\t\t0.003,\n\t\t0.805,\n\t\t0.004,\n\t\t19.323,\n\t\t-1.171,\n\t\t52.414,\n\t\t0.837,\n\t\t49.827,\n\t\t1.243,\n\t\t199,\n\t\t1.63,\n\t\t0.929,\n\t\t0.002,\n\t\t0.929,\n\t\t0.002,\n\t\t0.912,\n\t\t0.003,\n\t\t0.898,\n\t\t0.003,\n\t\t0.919,\n\t\t0.002,\n\t\t0.809,\n\t\t0.003,\n\t\t18.152,\n\t\t-1.171,\n\t\t53.251,\n\t\t0.835,\n\t\t51.071,\n\t\t2.778,\n\t\t201,\n\t\t3.495,\n\t\t0.931,\n\t\t0.002,\n\t\t0.931,\n\t\t0.002,\n\t\t0.915,\n\t\t0.002,\n\t\t0.901,\n\t\t0.003,\n\t\t0.921,\n\t\t0.002,\n\t\t0.812,\n\t\t0.004,\n\t\t16.981,\n\t\t-1.17,\n\t\t54.086,\n\t\t0.836,\n\t\t53.848,\n\t\t1.282,\n\t\t205,\n\t\t1.548,\n\t\t0.933,\n\t\t0.001,\n\t\t0.933,\n\t\t0.001,\n\t\t0.917,\n\t\t0.002,\n\t\t0.904,\n\t\t0.002,\n\t\t0.923,\n\t\t0.002,\n\t\t0.816,\n\t\t0.003,\n\t\t15.811,\n\t\t-1.171,\n\t\t54.922,\n\t\t0.831,\n\t\t55.13,\n\t\t1.292,\n\t\t206,\n\t\t1.521,\n\t\t0.934,\n\t\t0.001,\n\t\t0.934,\n\t\t0.001,\n\t\t0.919,\n\t\t0.002,\n\t\t0.906,\n\t\t0.002,\n\t\t0.925,\n\t\t0.003,\n\t\t0.819,\n\t\t0.004,\n\t\t14.64,\n\t\t-1.171,\n\t\t55.753,\n\t\t0.831,\n\t\t56.422,\n\t\t2.909,\n\t\t208,\n\t\t3.288,\n\t\t0.935,\n\t\t0.002,\n\t\t0.935,\n\t\t0.002,\n\t\t0.921,\n\t\t0.002,\n\t\t0.908,\n\t\t0.002,\n\t\t0.928,\n\t\t0.002,\n\t\t0.823,\n\t\t0.003,\n\t\t13.469,\n\t\t-1.171,\n\t\t56.584,\n\t\t0.831,\n\t\t59.331,\n\t\t1.332,\n\t\t211,\n\t\t1.446,\n\t\t0.937,\n\t\t0.001,\n\t\t0.937,\n\t\t0.001,\n\t\t0.923,\n\t\t0.002,\n\t\t0.91,\n\t\t0.002,\n\t\t0.93,\n\t\t0.001,\n\t\t0.826,\n\t\t0.004,\n\t\t12.298,\n\t\t-1.17,\n\t\t57.415,\n\t\t0.828,\n\t\t60.663,\n\t\t3.012,\n\t\t212,\n\t\t3.139,\n\t\t0.938,\n\t\t0.002,\n\t\t0.938,\n\t\t0.002,\n\t\t0.925,\n\t\t0.002,\n\t\t0.912,\n\t\t0.002,\n\t\t0.931,\n\t\t0.003,\n\t\t0.83,\n\t\t0.003,\n\t\t11.128,\n\t\t-1.171,\n\t\t58.243,\n\t\t0.829,\n\t\t63.675,\n\t\t1.373,\n\t\t215,\n\t\t1.374,\n\t\t0.94,\n\t\t0.001,\n\t\t0.94,\n\t\t0.001,\n\t\t0.927,\n\t\t0.002,\n\t\t0.914,\n\t\t0.003,\n\t\t0.934,\n\t\t0.001,\n\t\t0.833,\n\t\t0.003,\n\t\t9.957,\n\t\t-1.17,\n\t\t59.072,\n\t\t0.824,\n\t\t65.049,\n\t\t1.385,\n\t\t217,\n\t\t1.351,\n\t\t0.941,\n\t\t0.001,\n\t\t0.941,\n\t\t0.001,\n\t\t0.929,\n\t\t0.002,\n\t\t0.917,\n\t\t0.002,\n\t\t0.935,\n\t\t0.002,\n\t\t0.836,\n\t\t0.004,\n\t\t8.787,\n\t\t-1.17,\n\t\t59.896,\n\t\t0.824,\n\t\t66.434,\n\t\t3.147,\n\t\t218,\n\t\t2.947,\n\t\t0.942,\n\t\t0.002,\n\t\t0.942,\n\t\t0.002,\n\t\t0.931,\n\t\t0.002,\n\t\t0.919,\n\t\t0.001,\n\t\t0.937,\n\t\t0.002,\n\t\t0.84,\n\t\t0.003,\n\t\t7.617,\n\t\t-1.17,\n\t\t60.72,\n\t\t0.824,\n\t\t69.581,\n\t\t1.43,\n\t\t221,\n\t\t1.285,\n\t\t0.944,\n\t\t0.001,\n\t\t0.944,\n\t\t0.001,\n\t\t0.933,\n\t\t0.002,\n\t\t0.92,\n\t\t0.002,\n\t\t0.939,\n\t\t0.001,\n\t\t0.843,\n\t\t0.004,\n\t\t6.447,\n\t\t-1.17,\n\t\t61.544,\n\t\t0.82,\n\t\t71.011,\n\t\t1.443,\n\t\t222,\n\t\t1.265,\n\t\t0.945,\n\t\t0.001,\n\t\t0.945,\n\t\t0.001,\n\t\t0.935,\n\t\t0.001,\n\t\t0.922,\n\t\t0.003,\n\t\t0.94,\n\t\t0.002,\n\t\t0.847,\n\t\t0.003,\n\t\t5.277,\n\t\t-1.169,\n\t\t62.364,\n\t\t0.821,\n\t\t72.454,\n\t\t3.288,\n\t\t224,\n\t\t2.764,\n\t\t0.946,\n\t\t0.001,\n\t\t0.946,\n\t\t0.001,\n\t\t0.936,\n\t\t0.003,\n\t\t0.925,\n\t\t0.001,\n\t\t0.942,\n\t\t0.002,\n\t\t0.85,\n\t\t0.003,\n\t\t4.108,\n\t\t-1.169,\n\t\t63.185,\n\t\t0.816,\n\t\t75.742,\n\t\t1.491,\n\t\t226,\n\t\t1.203,\n\t\t0.947,\n\t\t0.001,\n\t\t0.947,\n\t\t0.001,\n\t\t0.939,\n\t\t0.001,\n\t\t0.926,\n\t\t0.002,\n\t\t0.944,\n\t\t0.001,\n\t\t0.853,\n\t\t0.004,\n\t\t2.939,\n\t\t-1.168,\n\t\t64.001,\n\t\t0.819,\n\t\t77.233,\n\t\t3.399,\n\t\t228,\n\t\t2.628,\n\t\t0.948,\n\t\t0.001,\n\t\t0.948,\n\t\t0.001,\n\t\t0.94,\n\t\t0.002,\n\t\t0.928,\n\t\t0.002,\n\t\t0.945,\n\t\t0.002,\n\t\t0.857,\n\t\t0.003,\n\t\t1.771,\n\t\t-1.158,\n\t\t64.82,\n\t\t0.812,\n\t\t80.632,\n\t\t1.543,\n\t\t230,\n\t\t1.143,\n\t\t0.949,\n\t\t0.002,\n\t\t0.949,\n\t\t0.002,\n\t\t0.942,\n\t\t0.002,\n\t\t0.93,\n\t\t0.002,\n\t\t0.947,\n\t\t0.001,\n\t\t0.86,\n\t\t0.004,\n\t\t0.613,\n\t\t-0.869,\n\t\t65.632,\n\t\t0.813,\n\t\t82.175,\n\t\t1.56,\n\t\t231,\n\t\t1.126,\n\t\t0.951,\n\t\t0.001,\n\t\t0.951,\n\t\t0.001,\n\t\t0.944,\n\t\t0.002,\n\t\t0.932,\n\t\t0.001,\n\t\t0.948,\n\t\t0.002,\n\t\t0.864,\n\t\t0.003,\n\t\t-0.256,\n\t\t-0.296,\n\t\t66.445,\n\t\t0.811,\n\t\t83.736,\n\t\t3.551,\n\t\t233,\n\t\t2.454,\n\t\t0.952,\n\t\t0.001,\n\t\t0.952,\n\t\t0.001,\n\t\t0.946,\n\t\t0.001,\n\t\t0.933,\n\t\t0.002,\n\t\t0.95,\n\t\t0.001,\n\t\t0.867,\n\t\t0.003,\n\t\t-0.552,\n\t\t0.011,\n\t\t67.256,\n\t\t0.808,\n\t\t87.287,\n\t\t1.617,\n\t\t235,\n\t\t1.07,\n\t\t0.953,\n\t\t0.001,\n\t\t0.953,\n\t\t0.001,\n\t\t0.947,\n\t\t0.002,\n\t\t0.935,\n\t\t0.002,\n\t\t0.951,\n\t\t0.002,\n\t\t0.87,\n\t\t0.003,\n\t\t-0.541,\n\t\t0.011,\n\t\t68.064,\n\t\t0.808,\n\t\t88.904,\n\t\t3.671,\n\t\t236,\n\t\t2.322,\n\t\t0.954,\n\t\t0.001,\n\t\t0.954,\n\t\t0.001,\n\t\t0.949,\n\t\t0.001,\n\t\t0.937,\n\t\t0.002,\n\t\t0.953,\n\t\t0.001,\n\t\t0.873,\n\t\t0.004,\n\t\t-0.53,\n\t\t0.011,\n\t\t68.872,\n\t\t0.804,\n\t\t92.575,\n\t\t1.678,\n\t\t238,\n\t\t1.014,\n\t\t0.955,\n\t\t0.001,\n\t\t0.955,\n\t\t0.001,\n\t\t0.95,\n\t\t0.002,\n\t\t0.939,\n\t\t0.001,\n\t\t0.954,\n\t\t0.001,\n\t\t0.877,\n\t\t0.003,\n\t\t-0.519,\n\t\t0.011,\n\t\t69.676,\n\t\t0.803,\n\t\t94.252,\n\t\t1.7,\n\t\t239,\n\t\t0.999,\n\t\t0.956,\n\t\t0.001,\n\t\t0.956,\n\t\t0.001,\n\t\t0.952,\n\t\t0.002,\n\t\t0.94,\n\t\t0.002,\n\t\t0.955,\n\t\t0.002,\n\t\t0.88,\n\t\t0.003,\n\t\t-0.508,\n\t\t0.012,\n\t\t70.479,\n\t\t0.8,\n\t\t95.952,\n\t\t3.838,\n\t\t240,\n\t\t2.152,\n\t\t0.957,\n\t\t0.001,\n\t\t0.957,\n\t\t0.001,\n\t\t0.954,\n\t\t0.001,\n\t\t0.942,\n\t\t0.001,\n\t\t0.957,\n\t\t0.002,\n\t\t0.883,\n\t\t0.004,\n\t\t-0.496,\n\t\t0.011,\n\t\t71.279,\n\t\t0.799,\n\t\t99.789,\n\t\t1.766,\n\t\t243,\n\t\t0.945,\n\t\t0.958,\n\t\t0.001,\n\t\t0.958,\n\t\t0.001,\n\t\t0.955,\n\t\t0.002,\n\t\t0.943,\n\t\t0.002,\n\t\t0.959,\n\t\t0.001,\n\t\t0.887,\n\t\t0.003,\n\t\t-0.485,\n\t\t0.011,\n\t\t72.078,\n\t\t0.795,\n\t\t101.555,\n\t\t1.791,\n\t\t244,\n\t\t0.929,\n\t\t0.959,\n\t\t0.001,\n\t\t0.959,\n\t\t0.001,\n\t\t0.957,\n\t\t0.001,\n\t\t0.945,\n\t\t0.002,\n\t\t0.96,\n\t\t0.001,\n\t\t0.89,\n\t\t0.003,\n\t\t-0.474,\n\t\t0.011,\n\t\t72.873,\n\t\t0.795,\n\t\t103.346,\n\t\t4.014,\n\t\t244,\n\t\t1.982,\n\t\t0.96,\n\t\t0.001,\n\t\t0.96,\n\t\t0.001,\n\t\t0.958,\n\t\t0.002,\n\t\t0.947,\n\t\t0.001,\n\t\t0.961,\n\t\t0.001,\n\t\t0.893,\n\t\t0.003,\n\t\t-0.463,\n\t\t0.011,\n\t\t73.668,\n\t\t0.79,\n\t\t107.36,\n\t\t1.864,\n\t\t246,\n\t\t0.875,\n\t\t0.961,\n\t\t0.001,\n\t\t0.961,\n\t\t0.001,\n\t\t0.96,\n\t\t0.002,\n\t\t0.948,\n\t\t0.002,\n\t\t0.962,\n\t\t0.001,\n\t\t0.896,\n\t\t0.003,\n\t\t-0.452,\n\t\t0.011,\n\t\t74.458,\n\t\t0.789,\n\t\t109.224,\n\t\t1.891,\n\t\t247,\n\t\t0.86,\n\t\t0.962,\n\t\t0.001,\n\t\t0.962,\n\t\t0.001,\n\t\t0.962,\n\t\t0.001,\n\t\t0.95,\n\t\t0.001,\n\t\t0.963,\n\t\t0.002,\n\t\t0.899,\n\t\t0.004,\n\t\t-0.441,\n\t\t0.011,\n\t\t75.247,\n\t\t0.789,\n\t\t111.115,\n\t\t4.2,\n\t\t248,\n\t\t1.81,\n\t\t0.963,\n\t\t0.001,\n\t\t0.963,\n\t\t0.001,\n\t\t0.963,\n\t\t0.001,\n\t\t0.951,\n\t\t0.002,\n\t\t0.965,\n\t\t0.001,\n\t\t0.903,\n\t\t0.003,\n\t\t-0.43,\n\t\t0.012,\n\t\t76.036,\n\t\t0.78,\n\t\t115.315,\n\t\t1.97,\n\t\t250,\n\t\t0.804,\n\t\t0.964,\n\t\t0.001,\n\t\t0.964,\n\t\t0.001,\n\t\t0.964,\n\t\t0.002,\n\t\t0.953,\n\t\t0.001,\n\t\t0.966,\n\t\t0.002,\n\t\t0.906,\n\t\t0.003,\n\t\t-0.418,\n\t\t0.011,\n\t\t76.816,\n\t\t0.784,\n\t\t117.284,\n\t\t2,\n\t\t251,\n\t\t0.788,\n\t\t0.965,\n\t\t0.001,\n\t\t0.965,\n\t\t0.001,\n\t\t0.966,\n\t\t0.001,\n\t\t0.954,\n\t\t0.002,\n\t\t0.968,\n\t\t0.001,\n\t\t0.909,\n\t\t0.003,\n\t\t-0.407,\n\t\t0.011,\n\t\t77.6,\n\t\t0.773,\n\t\t119.285,\n\t\t2.032,\n\t\t252,\n\t\t0.772,\n\t\t0.966,\n\t\t0.001,\n\t\t0.966,\n\t\t0.001,\n\t\t0.967,\n\t\t0.002,\n\t\t0.956,\n\t\t0.001,\n\t\t0.969,\n\t\t0.001,\n\t\t0.912,\n\t\t0.003,\n\t\t-0.396,\n\t\t0.011,\n\t\t78.373,\n\t\t0.775,\n\t\t121.316,\n\t\t4.449,\n\t\t252,\n\t\t1.593,\n\t\t0.967,\n\t\t0.001,\n\t\t0.967,\n\t\t0.001,\n\t\t0.969,\n\t\t0.001,\n\t\t0.957,\n\t\t0.002,\n\t\t0.97,\n\t\t0.001,\n\t\t0.915,\n\t\t0.004,\n\t\t-0.385,\n\t\t0.011,\n\t\t79.148,\n\t\t0.775,\n\t\t125.765,\n\t\t2.118,\n\t\t254,\n\t\t0.713,\n\t\t0.968,\n\t\t0.001,\n\t\t0.968,\n\t\t0.001,\n\t\t0.97,\n\t\t0.002,\n\t\t0.959,\n\t\t0.001,\n\t\t0.971,\n\t\t0.002,\n\t\t0.919,\n\t\t0.003,\n\t\t-0.374,\n\t\t0.011,\n\t\t79.923,\n\t\t0.763,\n\t\t127.883,\n\t\t2.152,\n\t\t255,\n\t\t0.696,\n\t\t0.969,\n\t\t0.001,\n\t\t0.969,\n\t\t0.001,\n\t\t0.972,\n\t\t0.001,\n\t\t0.96,\n\t\t0.002,\n\t\t0.973,\n\t\t0.001,\n\t\t0.922,\n\t\t0.003,\n\t\t-0.363,\n\t\t0.011,\n\t\t80.686,\n\t\t0.764,\n\t\t130.035,\n\t\t2.186,\n\t\t255,\n\t\t0.678,\n\t\t0.97,\n\t\t0.001,\n\t\t0.97,\n\t\t0.001,\n\t\t0.973,\n\t\t0.001,\n\t\t0.962,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.925,\n\t\t0.003,\n\t\t-0.352,\n\t\t0.012,\n\t\t81.45,\n\t\t0.765,\n\t\t132.221,\n\t\t4.713,\n\t\t256,\n\t\t1.367,\n\t\t0.971,\n\t\t0.001,\n\t\t0.971,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.963,\n\t\t0.001,\n\t\t0.975,\n\t\t0.001,\n\t\t0.928,\n\t\t0.003,\n\t\t-0.34,\n\t\t0.011,\n\t\t82.215,\n\t\t0.751,\n\t\t136.934,\n\t\t2.28,\n\t\t257,\n\t\t0.616,\n\t\t0.972,\n\t\t0.001,\n\t\t0.972,\n\t\t0.001,\n\t\t0.975,\n\t\t0.002,\n\t\t0.964,\n\t\t0.002,\n\t\t0.976,\n\t\t0.001,\n\t\t0.931,\n\t\t0.003,\n\t\t-0.329,\n\t\t0.011,\n\t\t82.966,\n\t\t0.753,\n\t\t139.214,\n\t\t2.317,\n\t\t258,\n\t\t0.597,\n\t\t0.973,\n\t\t0.001,\n\t\t0.973,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.966,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.934,\n\t\t0.003,\n\t\t-0.318,\n\t\t0.011,\n\t\t83.719,\n\t\t0.749,\n\t\t141.531,\n\t\t2.354,\n\t\t259,\n\t\t0.577,\n\t\t0.974,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.978,\n\t\t0.002,\n\t\t0.967,\n\t\t0.001,\n\t\t0.978,\n\t\t0.001,\n\t\t0.937,\n\t\t0.003,\n\t\t-0.307,\n\t\t0.011,\n\t\t84.468,\n\t\t0.745,\n\t\t143.885,\n\t\t2.392,\n\t\t259,\n\t\t0.557,\n\t\t0.975,\n\t\t0.001,\n\t\t0.975,\n\t\t0.001,\n\t\t0.98,\n\t\t0.001,\n\t\t0.968,\n\t\t0.002,\n\t\t0.979,\n\t\t0.002,\n\t\t0.94,\n\t\t0.003,\n\t\t-0.296,\n\t\t0.011,\n\t\t85.213,\n\t\t0.737,\n\t\t146.277,\n\t\t2.431,\n\t\t260,\n\t\t0.536,\n\t\t0.976,\n\t\t0.001,\n\t\t0.976,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.97,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.943,\n\t\t0.003,\n\t\t-0.285,\n\t\t0.012,\n\t\t85.95,\n\t\t0.731,\n\t\t148.708,\n\t\t2.471,\n\t\t260,\n\t\t0.514,\n\t\t0.977,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.982,\n\t\t0.001,\n\t\t0.971,\n\t\t0.001,\n\t\t0.982,\n\t\t0.001,\n\t\t0.946,\n\t\t0.003,\n\t\t-0.273,\n\t\t0.011,\n\t\t86.681,\n\t\t0.728,\n\t\t151.179,\n\t\t5.178,\n\t\t261,\n\t\t0.984,\n\t\t0.978,\n\t\t0.001,\n\t\t0.978,\n\t\t0.001,\n\t\t0.983,\n\t\t0.002,\n\t\t0.972,\n\t\t0.002,\n\t\t0.983,\n\t\t0,\n\t\t0.949,\n\t\t0.003,\n\t\t-0.262,\n\t\t0.011,\n\t\t87.409,\n\t\t0.723,\n\t\t156.357,\n\t\t2.574,\n\t\t262,\n\t\t0.443,\n\t\t0.979,\n\t\t0.001,\n\t\t0.979,\n\t\t0.001,\n\t\t0.985,\n\t\t0.001,\n\t\t0.974,\n\t\t0.001,\n\t\t0.983,\n\t\t0.001,\n\t\t0.952,\n\t\t0.003,\n\t\t-0.251,\n\t\t0.011,\n\t\t88.132,\n\t\t0.718,\n\t\t158.932,\n\t\t2.615,\n\t\t262,\n\t\t0.419,\n\t\t0.98,\n\t\t0.001,\n\t\t0.98,\n\t\t0.001,\n\t\t0.986,\n\t\t0.001,\n\t\t0.975,\n\t\t0.002,\n\t\t0.984,\n\t\t0.001,\n\t\t0.955,\n\t\t0.003,\n\t\t-0.24,\n\t\t0.011,\n\t\t88.85,\n\t\t0.718,\n\t\t161.547,\n\t\t2.657,\n\t\t263,\n\t\t0.396,\n\t\t0.981,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.987,\n\t\t0.001,\n\t\t0.977,\n\t\t0.001,\n\t\t0.985,\n\t\t0.001,\n\t\t0.958,\n\t\t0.003,\n\t\t-0.229,\n\t\t0.011,\n\t\t89.568,\n\t\t0.693,\n\t\t164.204,\n\t\t2.699,\n\t\t263,\n\t\t0.371,\n\t\t0.982,\n\t\t0.001,\n\t\t0.982,\n\t\t0.001,\n\t\t0.988,\n\t\t0.001,\n\t\t0.978,\n\t\t0.001,\n\t\t0.986,\n\t\t0.007,\n\t\t0.961,\n\t\t0.002,\n\t\t-0.218,\n\t\t0.011,\n\t\t90.261,\n\t\t0.695,\n\t\t166.904,\n\t\t2.742,\n\t\t263,\n\t\t0.346,\n\t\t0.983,\n\t\t0.001,\n\t\t0.983,\n\t\t0.001,\n\t\t0.989,\n\t\t0.001,\n\t\t0.979,\n\t\t0.001,\n\t\t0.993,\n\t\t0,\n\t\t0.963,\n\t\t0.003,\n\t\t-0.207,\n\t\t0.012,\n\t\t90.956,\n\t\t0.686,\n\t\t169.646,\n\t\t2.785,\n\t\t264,\n\t\t0.32,\n\t\t0.984,\n\t\t0.001,\n\t\t0.984,\n\t\t0.001,\n\t\t0.99,\n\t\t0.007,\n\t\t0.98,\n\t\t0.001,\n\t\t0.993,\n\t\t0,\n\t\t0.966,\n\t\t0.003,\n\t\t-0.195,\n\t\t0.011,\n\t\t91.642,\n\t\t0.696,\n\t\t172.431,\n\t\t2.829,\n\t\t264,\n\t\t0.294,\n\t\t0.985,\n\t\t0.002,\n\t\t0.985,\n\t\t0.002,\n\t\t0.997,\n\t\t0.001,\n\t\t0.981,\n\t\t0.001,\n\t\t0.993,\n\t\t0.001,\n\t\t0.969,\n\t\t0.003,\n\t\t-0.184,\n\t\t0.011,\n\t\t92.338,\n\t\t0.654,\n\t\t175.26,\n\t\t2.873,\n\t\t264,\n\t\t0.267,\n\t\t0.987,\n\t\t0.001,\n\t\t0.987,\n\t\t0.001,\n\t\t0.998,\n\t\t0,\n\t\t0.982,\n\t\t0.001,\n\t\t0.994,\n\t\t0,\n\t\t0.972,\n\t\t0.002,\n\t\t-0.173,\n\t\t0.011,\n\t\t92.992,\n\t\t0.656,\n\t\t178.133,\n\t\t2.917,\n\t\t265,\n\t\t0.239,\n\t\t0.988,\n\t\t0,\n\t\t0.988,\n\t\t0,\n\t\t0.998,\n\t\t0,\n\t\t0.983,\n\t\t0.008,\n\t\t0.994,\n\t\t0,\n\t\t0.974,\n\t\t0.003,\n\t\t-0.162,\n\t\t0.011,\n\t\t93.648,\n\t\t0.654,\n\t\t181.051,\n\t\t2.962,\n\t\t265,\n\t\t0.211,\n\t\t0.988,\n\t\t0.003,\n\t\t0.988,\n\t\t0.003,\n\t\t0.998,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t0.977,\n\t\t0.003,\n\t\t-0.151,\n\t\t0.011,\n\t\t94.302,\n\t\t0.641,\n\t\t184.013,\n\t\t3.007,\n\t\t265,\n\t\t0.182,\n\t\t0.991,\n\t\t-0.007,\n\t\t0.991,\n\t\t-0.007,\n\t\t0.998,\n\t\t0.001,\n\t\t0.991,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t0.98,\n\t\t0.002,\n\t\t-0.14,\n\t\t0.011,\n\t\t94.943,\n\t\t0.634,\n\t\t187.02,\n\t\t3.053,\n\t\t265,\n\t\t0.153,\n\t\t0.984,\n\t\t0.006,\n\t\t0.984,\n\t\t0.006,\n\t\t0.999,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t0.994,\n\t\t0.001,\n\t\t0.982,\n\t\t0.003,\n\t\t-0.129,\n\t\t0.012,\n\t\t95.577,\n\t\t0.574,\n\t\t190.073,\n\t\t3.099,\n\t\t265,\n\t\t0.123,\n\t\t0.99,\n\t\t0.006,\n\t\t0.99,\n\t\t0.006,\n\t\t0.999,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t0.995,\n\t\t0.005,\n\t\t0.985,\n\t\t0.002,\n\t\t-0.117,\n\t\t0.011,\n\t\t96.151,\n\t\t0.609,\n\t\t193.172,\n\t\t3.145,\n\t\t266,\n\t\t0.092,\n\t\t0.996,\n\t\t0.002,\n\t\t0.996,\n\t\t0.002,\n\t\t0.999,\n\t\t0.001,\n\t\t0.991,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.987,\n\t\t0.006,\n\t\t-0.106,\n\t\t0.011,\n\t\t96.76,\n\t\t0.59,\n\t\t196.316,\n\t\t0.169,\n\t\t266,\n\t\t0.004,\n\t\t0.998,\n\t\t0.012,\n\t\t0.998,\n\t\t0.012,\n\t\t1,\n\t\t0,\n\t\t0.991,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.993,\n\t\t0.001,\n\t\t-0.095,\n\t\t0.011,\n\t\t97.35,\n\t\t0.493,\n\t\t196.486,\n\t\t3.214,\n\t\t266,\n\t\t0.059,\n\t\t1.01,\n\t\t0.019,\n\t\t1.01,\n\t\t0.019,\n\t\t1,\n\t\t0,\n\t\t0.991,\n\t\t0.009,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t-0.084,\n\t\t0.011,\n\t\t97.843,\n\t\t0.525,\n\t\t199.7,\n\t\t3.261,\n\t\t266,\n\t\t0.027,\n\t\t1.029,\n\t\t0.026,\n\t\t1.029,\n\t\t0.026,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t0.006,\n\t\t-0.073,\n\t\t0.011,\n\t\t98.368,\n\t\t0.688,\n\t\t202.96,\n\t\t3.767,\n\t\t266,\n\t\t-0.073,\n\t\t1.055,\n\t\t0.033,\n\t\t1.055,\n\t\t0.033,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.062,\n\t\t0.011,\n\t\t99.056,\n\t\t0.23,\n\t\t206.727,\n\t\t4.193,\n\t\t266,\n\t\t-0.149,\n\t\t1.088,\n\t\t0.04,\n\t\t1.088,\n\t\t0.04,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.051,\n\t\t0.012,\n\t\t99.286,\n\t\t1.253,\n\t\t210.92,\n\t\t0.657,\n\t\t266,\n\t\t-0.027,\n\t\t1.128,\n\t\t0.044,\n\t\t1.128,\n\t\t0.044,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.039,\n\t\t0.011,\n\t\t100.539,\n\t\t-0.257,\n\t\t211.577,\n\t\t4.11,\n\t\t265,\n\t\t-0.193,\n\t\t1.172,\n\t\t0.049,\n\t\t1.172,\n\t\t0.049,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t-0.001,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.028,\n\t\t0.011,\n\t\t100.282,\n\t\t-0.257,\n\t\t215.687,\n\t\t0.615,\n\t\t265,\n\t\t-0.032,\n\t\t1.221,\n\t\t0.05,\n\t\t1.221,\n\t\t0.05,\n\t\t1,\n\t\t0,\n\t\t0.999,\n\t\t-0.001,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t-0.017,\n\t\t0.011,\n\t\t100.025,\n\t\t0.224,\n\t\t216.303,\n\t\t4.028,\n\t\t265,\n\t\t-0.236,\n\t\t1.271,\n\t\t0.035,\n\t\t1.271,\n\t\t0.035,\n\t\t1,\n\t\t0,\n\t\t0.998,\n\t\t-0.001,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\t-0.001,\n\t\t-0.006,\n\t\t0.576,\n\t\t100.249,\n\t\t-0.453,\n\t\t220.33,\n\t\t3.972,\n\t\t265,\n\t\t-0.273,\n\t\t1.306,\n\t\t-0.063,\n\t\t1.306,\n\t\t-0.063,\n\t\t1,\n\t\t0,\n\t\t0.997,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t0.999,\n\t\t0,\n\t\t0.57,\n\t\t0,\n\t\t99.796,\n\t\t-0.452,\n\t\t224.302,\n\t\t0.548,\n\t\t265,\n\t\t-0.041,\n\t\t1.243,\n\t\t-0.071,\n\t\t1.243,\n\t\t-0.071,\n\t\t1,\n\t\t0,\n\t\t0.997,\n\t\t-0.001,\n\t\t1,\n\t\t-0.001,\n\t\t0.999,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t99.344,\n\t\t-0.372,\n\t\t224.85,\n\t\t3.89,\n\t\t265,\n\t\t-0.314,\n\t\t1.172,\n\t\t-0.06,\n\t\t1.172,\n\t\t-0.06,\n\t\t1,\n\t\t0,\n\t\t0.996,\n\t\t-0.001,\n\t\t0.999,\n\t\t-0.001,\n\t\t0.996,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t98.972,\n\t\t-0.511,\n\t\t228.741,\n\t\t3.835,\n\t\t264,\n\t\t-0.349,\n\t\t1.112,\n\t\t-0.046,\n\t\t1.112,\n\t\t-0.046,\n\t\t1,\n\t\t0,\n\t\t0.995,\n\t\t-0.001,\n\t\t0.998,\n\t\t0,\n\t\t0.994,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t98.461,\n\t\t-0.489,\n\t\t232.576,\n\t\t3.78,\n\t\t264,\n\t\t-0.385,\n\t\t1.066,\n\t\t-0.033,\n\t\t1.066,\n\t\t-0.033,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t0,\n\t\t0.998,\n\t\t0,\n\t\t0.992,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t97.972,\n\t\t-0.507,\n\t\t236.355,\n\t\t0.458,\n\t\t264,\n\t\t-0.049,\n\t\t1.033,\n\t\t-0.027,\n\t\t1.033,\n\t\t-0.027,\n\t\t1,\n\t\t0,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.998,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t97.465,\n\t\t-0.584,\n\t\t236.813,\n\t\t3.7,\n\t\t264,\n\t\t-0.422,\n\t\t1.006,\n\t\t-0.008,\n\t\t1.006,\n\t\t-0.008,\n\t\t1,\n\t\t-0.001,\n\t\t0.993,\n\t\t0.001,\n\t\t0.997,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t96.881,\n\t\t-0.559,\n\t\t240.513,\n\t\t3.646,\n\t\t263,\n\t\t-0.455,\n\t\t0.998,\n\t\t-0.001,\n\t\t0.998,\n\t\t-0.001,\n\t\t0.999,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.996,\n\t\t-0.001,\n\t\t0.985,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t96.322,\n\t\t-0.587,\n\t\t244.159,\n\t\t0.394,\n\t\t263,\n\t\t-0.052,\n\t\t0.997,\n\t\t-0.003,\n\t\t0.997,\n\t\t-0.003,\n\t\t0.998,\n\t\t-0.002,\n\t\t0.993,\n\t\t-0.001,\n\t\t0.995,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t95.735,\n\t\t-0.628,\n\t\t244.554,\n\t\t3.568,\n\t\t263,\n\t\t-0.489,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.996,\n\t\t-0.001,\n\t\t0.992,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t95.107,\n\t\t-0.618,\n\t\t248.121,\n\t\t3.514,\n\t\t262,\n\t\t-0.522,\n\t\t0.993,\n\t\t-0.002,\n\t\t0.993,\n\t\t-0.002,\n\t\t0.995,\n\t\t0,\n\t\t0.991,\n\t\t-0.001,\n\t\t0.993,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t94.489,\n\t\t-0.632,\n\t\t251.636,\n\t\t3.461,\n\t\t262,\n\t\t-0.553,\n\t\t0.991,\n\t\t-0.002,\n\t\t0.991,\n\t\t-0.002,\n\t\t0.995,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.001,\n\t\t0.992,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t93.857,\n\t\t-0.656,\n\t\t255.097,\n\t\t3.408,\n\t\t261,\n\t\t-0.584,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.994,\n\t\t-0.001,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.991,\n\t\t-0.001,\n\t\t0.973,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t93.201,\n\t\t-0.644,\n\t\t258.505,\n\t\t0.287,\n\t\t261,\n\t\t-0.051,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.993,\n\t\t-0.002,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.99,\n\t\t0,\n\t\t0.97,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t92.557,\n\t\t-0.679,\n\t\t258.791,\n\t\t3.333,\n\t\t260,\n\t\t-0.614,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.991,\n\t\t-0.001,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.002,\n\t\t0.967,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t91.878,\n\t\t-0.677,\n\t\t262.124,\n\t\t3.281,\n\t\t260,\n\t\t-0.643,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.99,\n\t\t-0.001,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.001,\n\t\t0.965,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t91.201,\n\t\t-0.684,\n\t\t265.406,\n\t\t3.23,\n\t\t259,\n\t\t-0.672,\n\t\t0.985,\n\t\t-0.002,\n\t\t0.985,\n\t\t-0.002,\n\t\t0.989,\n\t\t-0.001,\n\t\t0.985,\n\t\t-0.001,\n\t\t0.987,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t90.517,\n\t\t-0.691,\n\t\t268.636,\n\t\t3.179,\n\t\t259,\n\t\t-0.7,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.988,\n\t\t-0.002,\n\t\t0.984,\n\t\t0,\n\t\t0.986,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t89.826,\n\t\t-0.691,\n\t\t271.814,\n\t\t3.128,\n\t\t258,\n\t\t-0.728,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.986,\n\t\t0,\n\t\t0.984,\n\t\t-0.001,\n\t\t0.985,\n\t\t-0.001,\n\t\t0.956,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t89.135,\n\t\t-0.712,\n\t\t274.943,\n\t\t3.078,\n\t\t257,\n\t\t-0.755,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.986,\n\t\t-0.002,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.984,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t88.423,\n\t\t-0.711,\n\t\t278.021,\n\t\t0.144,\n\t\t256,\n\t\t-0.036,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.984,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.95,\n\t\t-0.002,\n\t\t0.57,\n\t\t0,\n\t\t87.712,\n\t\t-0.715,\n\t\t278.165,\n\t\t3.009,\n\t\t256,\n\t\t-0.778,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.983,\n\t\t-0.001,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.001,\n\t\t0.948,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t86.997,\n\t\t-0.723,\n\t\t281.174,\n\t\t2.96,\n\t\t256,\n\t\t-0.804,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.982,\n\t\t-0.002,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.981,\n\t\t-0.001,\n\t\t0.945,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t86.274,\n\t\t-0.724,\n\t\t284.134,\n\t\t2.912,\n\t\t255,\n\t\t-0.829,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.98,\n\t\t-0.001,\n\t\t0.942,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t85.55,\n\t\t-0.729,\n\t\t287.046,\n\t\t2.864,\n\t\t254,\n\t\t-0.853,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.979,\n\t\t-0.002,\n\t\t0.939,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t84.821,\n\t\t-0.734,\n\t\t289.91,\n\t\t2.817,\n\t\t253,\n\t\t-0.877,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.978,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.001,\n\t\t0.936,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t84.087,\n\t\t-0.746,\n\t\t292.728,\n\t\t2.771,\n\t\t252,\n\t\t-0.901,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.977,\n\t\t-0.002,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.976,\n\t\t-0.001,\n\t\t0.933,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t83.341,\n\t\t-0.743,\n\t\t295.498,\n\t\t2.725,\n\t\t251,\n\t\t-0.924,\n\t\t0.973,\n\t\t-0.001,\n\t\t0.973,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.975,\n\t\t-0.001,\n\t\t0.93,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t82.598,\n\t\t-0.748,\n\t\t298.223,\n\t\t2.68,\n\t\t250,\n\t\t-0.946,\n\t\t0.972,\n\t\t-0.001,\n\t\t0.972,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.974,\n\t\t-0.001,\n\t\t0.927,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t81.85,\n\t\t-0.753,\n\t\t300.903,\n\t\t2.635,\n\t\t249,\n\t\t-0.968,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.973,\n\t\t-0.002,\n\t\t0.973,\n\t\t-0.002,\n\t\t0.973,\n\t\t-0.001,\n\t\t0.924,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t81.097,\n\t\t-0.754,\n\t\t303.538,\n\t\t2.591,\n\t\t248,\n\t\t-0.989,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.971,\n\t\t-0.001,\n\t\t0.972,\n\t\t-0.002,\n\t\t0.921,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t80.343,\n\t\t-0.758,\n\t\t306.129,\n\t\t2.548,\n\t\t247,\n\t\t-1.011,\n\t\t0.969,\n\t\t-0.001,\n\t\t0.969,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.97,\n\t\t-0.001,\n\t\t0.918,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t79.585,\n\t\t-0.763,\n\t\t308.677,\n\t\t2.505,\n\t\t246,\n\t\t-1.031,\n\t\t0.968,\n\t\t-0.001,\n\t\t0.968,\n\t\t-0.001,\n\t\t0.969,\n\t\t-0.002,\n\t\t0.969,\n\t\t0,\n\t\t0.969,\n\t\t-0.001,\n\t\t0.915,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t78.822,\n\t\t-0.763,\n\t\t311.182,\n\t\t2.464,\n\t\t245,\n\t\t-1.051,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.969,\n\t\t-0.002,\n\t\t0.968,\n\t\t-0.002,\n\t\t0.912,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t78.059,\n\t\t-0.768,\n\t\t313.646,\n\t\t2.422,\n\t\t244,\n\t\t-1.071,\n\t\t0.966,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.002,\n\t\t0.967,\n\t\t-0.001,\n\t\t0.966,\n\t\t0,\n\t\t0.909,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t77.291,\n\t\t-0.772,\n\t\t316.068,\n\t\t2.382,\n\t\t243,\n\t\t-1.091,\n\t\t0.965,\n\t\t-0.001,\n\t\t0.965,\n\t\t-0.001,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.001,\n\t\t0.966,\n\t\t-0.002,\n\t\t0.905,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t76.519,\n\t\t-0.772,\n\t\t318.45,\n\t\t2.342,\n\t\t242,\n\t\t-1.11,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.965,\n\t\t-0.002,\n\t\t0.964,\n\t\t-0.001,\n\t\t0.902,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t75.747,\n\t\t-0.778,\n\t\t320.793,\n\t\t4.706,\n\t\t241,\n\t\t-2.347,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.002,\n\t\t0.963,\n\t\t-0.001,\n\t\t0.963,\n\t\t-0.002,\n\t\t0.899,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t74.969,\n\t\t-0.777,\n\t\t325.499,\n\t\t2.238,\n\t\t239,\n\t\t-1.174,\n\t\t0.962,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.001,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.962,\n\t\t-0.001,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.896,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t74.192,\n\t\t-0.781,\n\t\t327.737,\n\t\t2.201,\n\t\t238,\n\t\t-1.192,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.002,\n\t\t0.961,\n\t\t-0.001,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.893,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t73.411,\n\t\t-0.783,\n\t\t329.938,\n\t\t2.165,\n\t\t236,\n\t\t-1.21,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.957,\n\t\t-0.002,\n\t\t0.96,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.002,\n\t\t0.89,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t72.628,\n\t\t-0.786,\n\t\t332.103,\n\t\t2.129,\n\t\t235,\n\t\t-1.228,\n\t\t0.959,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.001,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.959,\n\t\t-0.002,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.887,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t71.842,\n\t\t-0.787,\n\t\t334.233,\n\t\t2.095,\n\t\t234,\n\t\t-1.246,\n\t\t0.958,\n\t\t-0.001,\n\t\t0.958,\n\t\t-0.001,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.956,\n\t\t-0.002,\n\t\t0.883,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t71.055,\n\t\t-0.79,\n\t\t336.327,\n\t\t2.061,\n\t\t233,\n\t\t-1.264,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.957,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.002,\n\t\t0.956,\n\t\t-0.001,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.88,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t70.265,\n\t\t-0.791,\n\t\t338.388,\n\t\t4.217,\n\t\t231,\n\t\t-2.709,\n\t\t0.956,\n\t\t-0.001,\n\t\t0.956,\n\t\t-0.001,\n\t\t0.951,\n\t\t-0.002,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.002,\n\t\t0.877,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t69.474,\n\t\t-0.795,\n\t\t342.605,\n\t\t1.969,\n\t\t229,\n\t\t-1.325,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.955,\n\t\t-0.001,\n\t\t0.949,\n\t\t-0.002,\n\t\t0.954,\n\t\t-0.002,\n\t\t0.951,\n\t\t-0.001,\n\t\t0.874,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t68.679,\n\t\t-0.795,\n\t\t344.575,\n\t\t1.938,\n\t\t227,\n\t\t-1.343,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.954,\n\t\t-0.001,\n\t\t0.947,\n\t\t-0.001,\n\t\t0.952,\n\t\t-0.001,\n\t\t0.95,\n\t\t-0.001,\n\t\t0.87,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t67.884,\n\t\t-0.798,\n\t\t346.513,\n\t\t1.908,\n\t\t226,\n\t\t-1.36,\n\t\t0.953,\n\t\t-0.001,\n\t\t0.953,\n\t\t-0.001,\n\t\t0.946,\n\t\t-0.001,\n\t\t0.951,\n\t\t-0.002,\n\t\t0.949,\n\t\t-0.002,\n\t\t0.867,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t67.086,\n\t\t-0.799,\n\t\t348.421,\n\t\t1.878,\n\t\t225,\n\t\t-1.379,\n\t\t0.952,\n\t\t-0.001,\n\t\t0.952,\n\t\t-0.001,\n\t\t0.945,\n\t\t-0.002,\n\t\t0.949,\n\t\t-0.001,\n\t\t0.947,\n\t\t-0.002,\n\t\t0.864,\n\t\t-0.003,\n\t\t0.57,\n\t\t0,\n\t\t66.287,\n\t\t-0.802,\n\t\t350.299,\n\t\t1.849,\n\t\t223,\n\t\t-1.397,\n\t\t0.951,\n\t\t-0.001,\n\t\t0.951,\n\t\t-0.001,\n\t\t0.943,\n\t\t-0.002,\n\t\t0.948,\n\t\t-0.002,\n\t\t0.945,\n\t\t-0.002,\n\t\t0.861,\n\t\t-0.004,\n\t\t0.57,\n\t\t0,\n\t\t65.485,\n\t\t-0.801,\n\t\t352.148,\n\t\t3.828,\n\t\t222,\n\t\t-3.022,\n\t\t0.95,\n\t\t-0.001,\n\t\t0.95,\n\t\t-0.001,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.946,\n\t\t0,\n\t\t0.943,\n\t\t-0.001,\n\t\t0.857,\n\t\t-0.003,\n\t\t0.57,\n\t\t-1.292,\n\t\t64.684,\n\t\t-0.806,\n\t\t355.976,\n\t\t1.769,\n\t\t219,\n\t\t-1.459,\n\t\t0.949,\n\t\t-0.001,\n\t\t0.949,\n\t\t-0.001,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.946,\n\t\t-0.002,\n\t\t0.942,\n\t\t-0.001,\n\t\t0.854,\n\t\t-0.003,\n\t\t-0.722,\n\t\t-1.175,\n\t\t63.878,\n\t\t-0.804,\n\t\t357.745,\n\t\t1.742,\n\t\t217,\n\t\t-1.478,\n\t\t0.948,\n\t\t-0.001,\n\t\t0.948,\n\t\t-0.001,\n\t\t0.938,\n\t\t-0.002,\n\t\t0.944,\n\t\t-0.002,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.851,\n\t\t-0.004,\n\t\t-1.897,\n\t\t-1.18,\n\t\t63.074,\n\t\t-0.81,\n\t\t359.487,\n\t\t1.717,\n\t\t216,\n\t\t-1.497,\n\t\t0.947,\n\t\t-0.002,\n\t\t0.947,\n\t\t-0.002,\n\t\t0.936,\n\t\t-0.002,\n\t\t0.942,\n\t\t-0.002,\n\t\t0.939,\n\t\t-0.002,\n\t\t0.847,\n\t\t-0.003,\n\t\t-3.077,\n\t\t-1.18,\n\t\t62.264,\n\t\t-0.81,\n\t\t361.204,\n\t\t3.569,\n\t\t214,\n\t\t-3.251,\n\t\t0.945,\n\t\t-0.001,\n\t\t0.945,\n\t\t-0.001,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.94,\n\t\t-0.001,\n\t\t0.937,\n\t\t-0.001,\n\t\t0.844,\n\t\t-0.003,\n\t\t-4.257,\n\t\t-1.181,\n\t\t61.454,\n\t\t-0.81,\n\t\t364.772,\n\t\t1.642,\n\t\t211,\n\t\t-1.562,\n\t\t0.944,\n\t\t-0.001,\n\t\t0.944,\n\t\t-0.001,\n\t\t0.932,\n\t\t-0.001,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.936,\n\t\t-0.002,\n\t\t0.841,\n\t\t-0.004,\n\t\t-5.438,\n\t\t-1.182,\n\t\t60.644,\n\t\t-0.813,\n\t\t366.415,\n\t\t1.619,\n\t\t210,\n\t\t-1.583,\n\t\t0.943,\n\t\t-0.001,\n\t\t0.943,\n\t\t-0.001,\n\t\t0.931,\n\t\t-0.003,\n\t\t0.938,\n\t\t-0.002,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.837,\n\t\t-0.003,\n\t\t-6.62,\n\t\t-1.182,\n\t\t59.831,\n\t\t-0.812,\n\t\t368.034,\n\t\t1.596,\n\t\t208,\n\t\t-1.605,\n\t\t0.942,\n\t\t-0.001,\n\t\t0.942,\n\t\t-0.001,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.936,\n\t\t-0.002,\n\t\t0.932,\n\t\t-0.002,\n\t\t0.834,\n\t\t-0.003,\n\t\t-7.802,\n\t\t-1.183,\n\t\t59.019,\n\t\t-0.817,\n\t\t369.63,\n\t\t1.574,\n\t\t206,\n\t\t-1.627,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.941,\n\t\t-0.002,\n\t\t0.926,\n\t\t-0.002,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.93,\n\t\t-0.002,\n\t\t0.831,\n\t\t-0.004,\n\t\t-8.985,\n\t\t-1.183,\n\t\t58.202,\n\t\t-0.817,\n\t\t371.203,\n\t\t3.275,\n\t\t205,\n\t\t-3.534,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.939,\n\t\t-0.001,\n\t\t0.924,\n\t\t-0.001,\n\t\t0.932,\n\t\t-0.002,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.827,\n\t\t-0.003,\n\t\t-10.168,\n\t\t-1.183,\n\t\t57.385,\n\t\t-0.816,\n\t\t374.478,\n\t\t1.506,\n\t\t201,\n\t\t-1.697,\n\t\t0.938,\n\t\t-0.001,\n\t\t0.938,\n\t\t-0.001,\n\t\t0.923,\n\t\t-0.003,\n\t\t0.93,\n\t\t-0.001,\n\t\t0.926,\n\t\t-0.002,\n\t\t0.824,\n\t\t-0.004,\n\t\t-11.351,\n\t\t-1.184,\n\t\t56.569,\n\t\t-0.821,\n\t\t375.984,\n\t\t1.485,\n\t\t200,\n\t\t-1.721,\n\t\t0.937,\n\t\t-0.002,\n\t\t0.937,\n\t\t-0.002,\n\t\t0.92,\n\t\t-0.002,\n\t\t0.929,\n\t\t-0.002,\n\t\t0.924,\n\t\t-0.002,\n\t\t0.82,\n\t\t-0.003,\n\t\t-12.535,\n\t\t-1.184,\n\t\t55.748,\n\t\t-0.818,\n\t\t377.469,\n\t\t1.465,\n\t\t198,\n\t\t-1.746,\n\t\t0.935,\n\t\t-0.001,\n\t\t0.935,\n\t\t-0.001,\n\t\t0.918,\n\t\t-0.002,\n\t\t0.927,\n\t\t-0.003,\n\t\t0.922,\n\t\t-0.001,\n\t\t0.817,\n\t\t-0.003,\n\t\t-13.719,\n\t\t-1.184,\n\t\t54.93,\n\t\t-0.823,\n\t\t378.934,\n\t\t3.038,\n\t\t196,\n\t\t-3.783,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.934,\n\t\t-0.002,\n\t\t0.916,\n\t\t-0.002,\n\t\t0.924,\n\t\t-0.001,\n\t\t0.921,\n\t\t-0.003,\n\t\t0.814,\n\t\t-0.004,\n\t\t-14.903,\n\t\t-1.184,\n\t\t54.107,\n\t\t-0.823,\n\t\t381.973,\n\t\t1.401,\n\t\t192,\n\t\t-1.823,\n\t\t0.932,\n\t\t-0.001,\n\t\t0.932,\n\t\t-0.001,\n\t\t0.914,\n\t\t-0.002,\n\t\t0.923,\n\t\t-0.002,\n\t\t0.918,\n\t\t-0.003,\n\t\t0.81,\n\t\t-0.003,\n\t\t-16.087,\n\t\t-1.184,\n\t\t53.284,\n\t\t-0.824,\n\t\t383.373,\n\t\t1.381,\n\t\t191,\n\t\t-1.85,\n\t\t0.931,\n\t\t-0.002,\n\t\t0.931,\n\t\t-0.002,\n\t\t0.912,\n\t\t-0.003,\n\t\t0.921,\n\t\t-0.003,\n\t\t0.915,\n\t\t-0.003,\n\t\t0.807,\n\t\t-0.004,\n\t\t-17.271,\n\t\t-1.185,\n\t\t52.46,\n\t\t-0.826,\n\t\t384.755,\n\t\t1.363,\n\t\t189,\n\t\t-1.877,\n\t\t0.929,\n\t\t-0.001,\n\t\t0.929,\n\t\t-0.001,\n\t\t0.909,\n\t\t-0.002,\n\t\t0.918,\n\t\t-0.002,\n\t\t0.912,\n\t\t-0.001,\n\t\t0.803,\n\t\t-0.003,\n\t\t-18.456,\n\t\t-1.184,\n\t\t51.634,\n\t\t-0.826,\n\t\t386.117,\n\t\t1.344,\n\t\t187,\n\t\t-1.906,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.928,\n\t\t-0.002,\n\t\t0.907,\n\t\t-0.003,\n\t\t0.916,\n\t\t-0.002,\n\t\t0.911,\n\t\t-0.003,\n\t\t0.8,\n\t\t-0.004,\n\t\t-19.64,\n\t\t-1.185,\n\t\t50.808,\n\t\t-0.827,\n\t\t387.461,\n\t\t2.763,\n\t\t185,\n\t\t-4.1,\n\t\t0.926,\n\t\t-0.003,\n\t\t0.926,\n\t\t-0.003,\n\t\t0.904,\n\t\t-0.003,\n\t\t0.914,\n\t\t-0.003,\n\t\t0.908,\n\t\t-0.004,\n\t\t0.796,\n\t\t-0.003,\n\t\t-20.825,\n\t\t-1.185,\n\t\t49.981,\n\t\t-0.829,\n\t\t390.224,\n\t\t1.282,\n\t\t181,\n\t\t-1.991,\n\t\t0.923,\n\t\t-0.001,\n\t\t0.923,\n\t\t-0.001,\n\t\t0.901,\n\t\t-0.001,\n\t\t0.911,\n\t\t-0.003,\n\t\t0.904,\n\t\t-0.001,\n\t\t0.793,\n\t\t-0.004,\n\t\t-22.01,\n\t\t-1.185,\n\t\t49.152,\n\t\t-0.829,\n\t\t391.506,\n\t\t1.263,\n\t\t179,\n\t\t-2.022,\n\t\t0.922,\n\t\t-0.003,\n\t\t0.922,\n\t\t-0.003,\n\t\t0.9,\n\t\t-0.004,\n\t\t0.908,\n\t\t-0.001,\n\t\t0.903,\n\t\t-0.005,\n\t\t0.789,\n\t\t-0.003,\n\t\t-23.195,\n\t\t-1.185,\n\t\t48.323,\n\t\t-0.831,\n\t\t392.769,\n\t\t1.245,\n\t\t177,\n\t\t-2.054,\n\t\t0.919,\n\t\t-0.001,\n\t\t0.919,\n\t\t-0.001,\n\t\t0.896,\n\t\t-0.004,\n\t\t0.907,\n\t\t-0.005,\n\t\t0.898,\n\t\t-0.001,\n\t\t0.786,\n\t\t-0.004,\n\t\t-24.38,\n\t\t-1.185,\n\t\t47.492,\n\t\t-0.832,\n\t\t394.014,\n\t\t1.227,\n\t\t175,\n\t\t-2.087,\n\t\t0.918,\n\t\t-0.004,\n\t\t0.918,\n\t\t-0.004,\n\t\t0.892,\n\t\t-0.002,\n\t\t0.902,\n\t\t0,\n\t\t0.897,\n\t\t-0.006,\n\t\t0.782,\n\t\t-0.003,\n\t\t-25.565,\n\t\t-1.185,\n\t\t46.66,\n\t\t-0.832,\n\t\t395.241,\n\t\t1.208,\n\t\t173,\n\t\t-2.121,\n\t\t0.914,\n\t\t0,\n\t\t0.914,\n\t\t0,\n\t\t0.89,\n\t\t-0.005,\n\t\t0.902,\n\t\t-0.007,\n\t\t0.891,\n\t\t-0.004,\n\t\t0.779,\n\t\t-0.004,\n\t\t-26.75,\n\t\t-1.185,\n\t\t45.828,\n\t\t-0.834,\n\t\t396.449,\n\t\t2.443,\n\t\t171,\n\t\t-4.501,\n\t\t0.914,\n\t\t-0.007,\n\t\t0.914,\n\t\t-0.007,\n\t\t0.885,\n\t\t-0.002,\n\t\t0.895,\n\t\t-0.003,\n\t\t0.887,\n\t\t-0.008,\n\t\t0.775,\n\t\t-0.003,\n\t\t-27.935,\n\t\t-1.185,\n\t\t44.994,\n\t\t-0.834,\n\t\t398.892,\n\t\t1.145,\n\t\t166,\n\t\t-2.217,\n\t\t0.907,\n\t\t-0.006,\n\t\t0.907,\n\t\t-0.006,\n\t\t0.883,\n\t\t-0.005,\n\t\t0.892,\n\t\t-0.009,\n\t\t0.879,\n\t\t-0.011,\n\t\t0.772,\n\t\t-0.004,\n\t\t-29.12,\n\t\t-1.186,\n\t\t44.16,\n\t\t-0.836,\n\t\t400.038,\n\t\t1.126,\n\t\t164,\n\t\t-2.253,\n\t\t0.901,\n\t\t-0.01,\n\t\t0.901,\n\t\t-0.01,\n\t\t0.878,\n\t\t-0.01,\n\t\t0.883,\n\t\t-0.012,\n\t\t0.868,\n\t\t-0.013,\n\t\t0.768,\n\t\t-0.003,\n\t\t-30.306,\n\t\t-1.185,\n\t\t43.324,\n\t\t-0.836,\n\t\t401.164,\n\t\t1.108,\n\t\t162,\n\t\t-2.29,\n\t\t0.891,\n\t\t-0.01,\n\t\t0.891,\n\t\t-0.01,\n\t\t0.868,\n\t\t-0.011,\n\t\t0.871,\n\t\t-0.013,\n\t\t0.855,\n\t\t-0.013,\n\t\t0.765,\n\t\t-0.004,\n\t\t-31.491,\n\t\t-1.185,\n\t\t42.488,\n\t\t-0.838,\n\t\t402.272,\n\t\t1.088,\n\t\t159,\n\t\t-2.328,\n\t\t0.881,\n\t\t-0.012,\n\t\t0.881,\n\t\t-0.012,\n\t\t0.857,\n\t\t-0.013,\n\t\t0.858,\n\t\t-0.013,\n\t\t0.842,\n\t\t-0.014,\n\t\t0.761,\n\t\t-0.003,\n\t\t-32.676,\n\t\t-1.186,\n\t\t41.65,\n\t\t-0.839,\n\t\t403.36,\n\t\t1.069,\n\t\t157,\n\t\t-2.367,\n\t\t0.869,\n\t\t-0.011,\n\t\t0.869,\n\t\t-0.011,\n\t\t0.844,\n\t\t-0.014,\n\t\t0.845,\n\t\t-0.014,\n\t\t0.828,\n\t\t-0.014,\n\t\t0.758,\n\t\t-0.004,\n\t\t-33.862,\n\t\t-1.185,\n\t\t40.811,\n\t\t-0.838,\n\t\t404.429,\n\t\t1.049,\n\t\t155,\n\t\t-2.406,\n\t\t0.858,\n\t\t-0.012,\n\t\t0.858,\n\t\t-0.012,\n\t\t0.83,\n\t\t-0.014,\n\t\t0.831,\n\t\t-0.015,\n\t\t0.814,\n\t\t-0.015,\n\t\t0.754,\n\t\t-0.004,\n\t\t-35.047,\n\t\t-1.186,\n\t\t39.973,\n\t\t-0.841,\n\t\t405.478,\n\t\t1.029,\n\t\t152,\n\t\t-2.446,\n\t\t0.846,\n\t\t-0.013,\n\t\t0.846,\n\t\t-0.013,\n\t\t0.816,\n\t\t-0.015,\n\t\t0.816,\n\t\t-0.015,\n\t\t0.799,\n\t\t-0.016,\n\t\t0.75,\n\t\t-0.003,\n\t\t-36.233,\n\t\t-1.185,\n\t\t39.132,\n\t\t-0.84,\n\t\t406.507,\n\t\t1.008,\n\t\t150,\n\t\t-2.487,\n\t\t0.833,\n\t\t-0.012,\n\t\t0.833,\n\t\t-0.012,\n\t\t0.801,\n\t\t-0.016,\n\t\t0.801,\n\t\t-0.016,\n\t\t0.783,\n\t\t-0.015,\n\t\t0.747,\n\t\t-0.004,\n\t\t-37.418,\n\t\t-1.186,\n\t\t38.292,\n\t\t-0.842,\n\t\t407.515,\n\t\t0.988,\n\t\t147,\n\t\t-2.529,\n\t\t0.821,\n\t\t-0.013,\n\t\t0.821,\n\t\t-0.013,\n\t\t0.785,\n\t\t-0.016,\n\t\t0.785,\n\t\t-0.016,\n\t\t0.768,\n\t\t-0.016,\n\t\t0.743,\n\t\t-0.004,\n\t\t-38.604,\n\t\t-1.186,\n\t\t37.45,\n\t\t-0.842,\n\t\t408.503,\n\t\t0.966,\n\t\t145,\n\t\t-2.571,\n\t\t0.808,\n\t\t-0.013,\n\t\t0.808,\n\t\t-0.013,\n\t\t0.769,\n\t\t-0.016,\n\t\t0.769,\n\t\t-0.016,\n\t\t0.752,\n\t\t-0.016,\n\t\t0.739,\n\t\t-0.003,\n\t\t-39.79,\n\t\t-1.186,\n\t\t36.608,\n\t\t-0.843,\n\t\t409.469,\n\t\t0.945,\n\t\t142,\n\t\t-2.614,\n\t\t0.795,\n\t\t-0.013,\n\t\t0.795,\n\t\t-0.013,\n\t\t0.753,\n\t\t-0.016,\n\t\t0.753,\n\t\t-0.016,\n\t\t0.736,\n\t\t-0.016,\n\t\t0.736,\n\t\t-0.004,\n\t\t-40.976,\n\t\t-1.185,\n\t\t35.765,\n\t\t-0.845,\n\t\t410.414,\n\t\t0.923,\n\t\t140,\n\t\t-2.657,\n\t\t0.782,\n\t\t-0.013,\n\t\t0.782,\n\t\t-0.013,\n\t\t0.737,\n\t\t-0.016,\n\t\t0.737,\n\t\t-0.016,\n\t\t0.72,\n\t\t-0.016,\n\t\t0.732,\n\t\t-0.004,\n\t\t-42.161,\n\t\t-1.186,\n\t\t34.92,\n\t\t-0.844,\n\t\t411.336,\n\t\t0.9,\n\t\t137,\n\t\t-2.702,\n\t\t0.769,\n\t\t-0.014,\n\t\t0.769,\n\t\t-0.014,\n\t\t0.721,\n\t\t-0.017,\n\t\t0.721,\n\t\t-0.017,\n\t\t0.704,\n\t\t-0.017,\n\t\t0.728,\n\t\t-0.003,\n\t\t-43.347,\n\t\t-1.186,\n\t\t34.076,\n\t\t-0.846,\n\t\t412.236,\n\t\t0.877,\n\t\t134,\n\t\t-2.747,\n\t\t0.755,\n\t\t-0.013,\n\t\t0.755,\n\t\t-0.013,\n\t\t0.704,\n\t\t-0.017,\n\t\t0.704,\n\t\t-0.017,\n\t\t0.687,\n\t\t-0.016,\n\t\t0.725,\n\t\t-0.004,\n\t\t-44.533,\n\t\t-1.186,\n\t\t33.23,\n\t\t-0.845,\n\t\t413.113,\n\t\t0.853,\n\t\t131,\n\t\t-2.792,\n\t\t0.742,\n\t\t-0.013,\n\t\t0.742,\n\t\t-0.013,\n\t\t0.687,\n\t\t-0.017,\n\t\t0.687,\n\t\t-0.016,\n\t\t0.671,\n\t\t-0.017,\n\t\t0.721,\n\t\t-0.004,\n\t\t-45.719,\n\t\t-1.186,\n\t\t32.385,\n\t\t-0.848,\n\t\t413.966,\n\t\t0.829,\n\t\t129,\n\t\t-2.838,\n\t\t0.729,\n\t\t-0.014,\n\t\t0.729,\n\t\t-0.014,\n\t\t0.67,\n\t\t-0.017,\n\t\t0.671,\n\t\t-0.017,\n\t\t0.654,\n\t\t-0.017,\n\t\t0.717,\n\t\t-0.004,\n\t\t-46.905,\n\t\t-1.186,\n\t\t31.537,\n\t\t-0.847,\n\t\t414.796,\n\t\t0.805,\n\t\t126,\n\t\t-2.885,\n\t\t0.715,\n\t\t-0.014,\n\t\t0.715,\n\t\t-0.014,\n\t\t0.653,\n\t\t-0.017,\n\t\t0.654,\n\t\t-0.017,\n\t\t0.637,\n\t\t-0.016,\n\t\t0.713,\n\t\t-0.003,\n\t\t-48.091,\n\t\t-1.186,\n\t\t30.69,\n\t\t-0.849,\n\t\t415.6,\n\t\t0.779,\n\t\t123,\n\t\t-2.932,\n\t\t0.701,\n\t\t-0.013,\n\t\t0.701,\n\t\t-0.013,\n\t\t0.636,\n\t\t-0.017,\n\t\t0.637,\n\t\t-0.017,\n\t\t0.621,\n\t\t-0.017,\n\t\t0.71,\n\t\t-0.004,\n\t\t-49.277,\n\t\t-1.186,\n\t\t29.841,\n\t\t-0.848,\n\t\t416.38,\n\t\t0.754,\n\t\t120,\n\t\t-2.98,\n\t\t0.688,\n\t\t-0.014,\n\t\t0.688,\n\t\t-0.014,\n\t\t0.619,\n\t\t-0.018,\n\t\t0.62,\n\t\t-0.018,\n\t\t0.604,\n\t\t-0.017,\n\t\t0.706,\n\t\t-0.004,\n\t\t-50.463,\n\t\t-1.186,\n\t\t28.993,\n\t\t-0.85,\n\t\t417.133,\n\t\t0.727,\n\t\t117,\n\t\t-3.028,\n\t\t0.674,\n\t\t-0.014,\n\t\t0.674,\n\t\t-0.014,\n\t\t0.601,\n\t\t-0.017,\n\t\t0.602,\n\t\t-0.017,\n\t\t0.587,\n\t\t-0.017,\n\t\t0.702,\n\t\t-0.004,\n\t\t-51.649,\n\t\t-1.186,\n\t\t28.143,\n\t\t-0.85,\n\t\t417.861,\n\t\t0.701,\n\t\t114,\n\t\t-3.077,\n\t\t0.66,\n\t\t-0.014,\n\t\t0.66,\n\t\t-0.014,\n\t\t0.584,\n\t\t-0.018,\n\t\t0.585,\n\t\t-0.017,\n\t\t0.57,\n\t\t-0.017,\n\t\t0.698,\n\t\t-0.004,\n\t\t-52.835,\n\t\t-1.186,\n\t\t27.293,\n\t\t-0.851,\n\t\t418.561,\n\t\t0.673,\n\t\t111,\n\t\t-3.126,\n\t\t0.646,\n\t\t-0.014,\n\t\t0.646,\n\t\t-0.014,\n\t\t0.566,\n\t\t-0.017,\n\t\t0.568,\n\t\t-0.018,\n\t\t0.553,\n\t\t-0.017,\n\t\t0.694,\n\t\t-0.004,\n\t\t-54.021,\n\t\t-1.186,\n\t\t26.442,\n\t\t-0.852,\n\t\t419.235,\n\t\t0.645,\n\t\t108,\n\t\t-3.176,\n\t\t0.632,\n\t\t-0.013,\n\t\t0.632,\n\t\t-0.013,\n\t\t0.549,\n\t\t-0.018,\n\t\t0.55,\n\t\t-0.017,\n\t\t0.536,\n\t\t-0.018,\n\t\t0.69,\n\t\t-0.004,\n\t\t-55.207,\n\t\t-1.186,\n\t\t25.59,\n\t\t-0.851,\n\t\t419.88,\n\t\t0.617,\n\t\t105,\n\t\t-3.226,\n\t\t0.619,\n\t\t-0.014,\n\t\t0.619,\n\t\t-0.014,\n\t\t0.531,\n\t\t-0.018,\n\t\t0.533,\n\t\t-0.018,\n\t\t0.518,\n\t\t-0.017,\n\t\t0.686,\n\t\t-0.004,\n\t\t-56.393,\n\t\t-1.186,\n\t\t24.739,\n\t\t-0.853,\n\t\t420.497,\n\t\t0.043,\n\t\t101,\n\t\t-0.235,\n\t\t0.605,\n\t\t-0.014,\n\t\t0.605,\n\t\t-0.014,\n\t\t0.513,\n\t\t-0.018,\n\t\t0.515,\n\t\t-0.018,\n\t\t0.501,\n\t\t-0.017,\n\t\t0.682,\n\t\t-0.003,\n\t\t-57.579,\n\t\t-1.187,\n\t\t23.886,\n\t\t-0.853,\n\t\t420.54,\n\t\t0.589,\n\t\t101,\n\t\t-3.299,\n\t\t0.591,\n\t\t-0.015,\n\t\t0.591,\n\t\t-0.015,\n\t\t0.495,\n\t\t-0.018,\n\t\t0.497,\n\t\t-0.017,\n\t\t0.484,\n\t\t-0.018,\n\t\t0.679,\n\t\t-0.005,\n\t\t-58.766,\n\t\t-1.186,\n\t\t23.033,\n\t\t-0.854,\n\t\t421.129,\n\t\t0.559,\n\t\t98,\n\t\t-3.35,\n\t\t0.576,\n\t\t-0.014,\n\t\t0.576,\n\t\t-0.014,\n\t\t0.477,\n\t\t-0.017,\n\t\t0.48,\n\t\t-0.018,\n\t\t0.466,\n\t\t-0.017,\n\t\t0.674,\n\t\t-0.004,\n\t\t-59.952,\n\t\t-1.186,\n\t\t22.179,\n\t\t-0.854,\n\t\t421.687,\n\t\t0.528,\n\t\t94,\n\t\t-3.402,\n\t\t0.562,\n\t\t-0.014,\n\t\t0.562,\n\t\t-0.014,\n\t\t0.46,\n\t\t-0.018,\n\t\t0.462,\n\t\t-0.018,\n\t\t0.449,\n\t\t-0.018,\n\t\t0.67,\n\t\t-0.004,\n\t\t-61.138,\n\t\t-1.186,\n\t\t21.325,\n\t\t-0.854,\n\t\t422.215,\n\t\t0.497,\n\t\t91,\n\t\t-3.454,\n\t\t0.548,\n\t\t-0.014,\n\t\t0.548,\n\t\t-0.014,\n\t\t0.442,\n\t\t-0.019,\n\t\t0.444,\n\t\t-0.018,\n\t\t0.431,\n\t\t-0.017,\n\t\t0.666,\n\t\t-0.004,\n\t\t-62.324,\n\t\t-1.186,\n\t\t20.471,\n\t\t-0.856,\n\t\t422.711,\n\t\t0.465,\n\t\t88,\n\t\t-3.507,\n\t\t0.534,\n\t\t-0.014,\n\t\t0.534,\n\t\t-0.014,\n\t\t0.423,\n\t\t-0.018,\n\t\t0.426,\n\t\t-0.017,\n\t\t0.414,\n\t\t-0.018,\n\t\t0.662,\n\t\t-0.004,\n\t\t-63.51,\n\t\t-1.187,\n\t\t19.615,\n\t\t-0.855,\n\t\t423.176,\n\t\t0.046,\n\t\t84,\n\t\t-0.363,\n\t\t0.52,\n\t\t-0.014,\n\t\t0.52,\n\t\t-0.014,\n\t\t0.405,\n\t\t-0.018,\n\t\t0.409,\n\t\t-0.018,\n\t\t0.396,\n\t\t-0.017,\n\t\t0.658,\n\t\t-0.005,\n\t\t-64.697,\n\t\t-1.186,\n\t\t18.76,\n\t\t-0.856,\n\t\t423.222,\n\t\t0.431,\n\t\t84,\n\t\t-3.583,\n\t\t0.506,\n\t\t-0.015,\n\t\t0.506,\n\t\t-0.015,\n\t\t0.387,\n\t\t-0.018,\n\t\t0.391,\n\t\t-0.018,\n\t\t0.379,\n\t\t-0.018,\n\t\t0.653,\n\t\t-0.004,\n\t\t-65.883,\n\t\t-1.186,\n\t\t17.904,\n\t\t-0.857,\n\t\t423.653,\n\t\t0.398,\n\t\t80,\n\t\t-3.636,\n\t\t0.491,\n\t\t-0.014,\n\t\t0.491,\n\t\t-0.014,\n\t\t0.369,\n\t\t-0.018,\n\t\t0.373,\n\t\t-0.018,\n\t\t0.361,\n\t\t-0.018,\n\t\t0.649,\n\t\t-0.005,\n\t\t-67.069,\n\t\t-1.187,\n\t\t17.047,\n\t\t-0.856,\n\t\t424.051,\n\t\t0.364,\n\t\t77,\n\t\t-3.69,\n\t\t0.477,\n\t\t-0.014,\n\t\t0.477,\n\t\t-0.014,\n\t\t0.351,\n\t\t-0.018,\n\t\t0.355,\n\t\t-0.018,\n\t\t0.343,\n\t\t-0.017,\n\t\t0.644,\n\t\t-0.004,\n\t\t-68.256,\n\t\t-1.186,\n\t\t16.191,\n\t\t-0.857,\n\t\t424.414,\n\t\t0.042,\n\t\t73,\n\t\t-0.45,\n\t\t0.463,\n\t\t-0.014,\n\t\t0.463,\n\t\t-0.014,\n\t\t0.333,\n\t\t-0.019,\n\t\t0.337,\n\t\t-0.018,\n\t\t0.326,\n\t\t-0.018,\n\t\t0.64,\n\t\t-0.005,\n\t\t-69.442,\n\t\t-1.186,\n\t\t15.334,\n\t\t-0.858,\n\t\t424.456,\n\t\t0.326,\n\t\t72,\n\t\t-3.768,\n\t\t0.449,\n\t\t-0.015,\n\t\t0.449,\n\t\t-0.015,\n\t\t0.314,\n\t\t-0.018,\n\t\t0.319,\n\t\t-0.019,\n\t\t0.308,\n\t\t-0.018,\n\t\t0.635,\n\t\t-0.005,\n\t\t-70.628,\n\t\t-1.187,\n\t\t14.476,\n\t\t-0.857,\n\t\t424.782,\n\t\t0.291,\n\t\t69,\n\t\t-3.823,\n\t\t0.434,\n\t\t-0.014,\n\t\t0.434,\n\t\t-0.014,\n\t\t0.296,\n\t\t-0.018,\n\t\t0.3,\n\t\t-0.018,\n\t\t0.29,\n\t\t-0.017,\n\t\t0.63,\n\t\t-0.004,\n\t\t-71.815,\n\t\t-1.186,\n\t\t13.619,\n\t\t-0.858,\n\t\t425.073,\n\t\t0.036,\n\t\t65,\n\t\t-0.515,\n\t\t0.42,\n\t\t-0.014,\n\t\t0.42,\n\t\t-0.014,\n\t\t0.278,\n\t\t-0.019,\n\t\t0.282,\n\t\t-0.018,\n\t\t0.273,\n\t\t-0.018,\n\t\t0.626,\n\t\t-0.009,\n\t\t-73.001,\n\t\t-1.187,\n\t\t12.761,\n\t\t-0.858,\n\t\t425.109,\n\t\t0.251,\n\t\t64,\n\t\t-3.903,\n\t\t0.406,\n\t\t-0.015,\n\t\t0.406,\n\t\t-0.015,\n\t\t0.259,\n\t\t-0.018,\n\t\t0.264,\n\t\t-0.018,\n\t\t0.255,\n\t\t-0.018,\n\t\t0.617,\n\t\t-0.015,\n\t\t-74.188,\n\t\t-1.186,\n\t\t11.903,\n\t\t-0.859,\n\t\t425.36,\n\t\t0.214,\n\t\t60,\n\t\t-3.958,\n\t\t0.391,\n\t\t-0.014,\n\t\t0.391,\n\t\t-0.014,\n\t\t0.241,\n\t\t-0.019,\n\t\t0.246,\n\t\t-0.018,\n\t\t0.237,\n\t\t-0.018,\n\t\t0.602,\n\t\t-0.018,\n\t\t-75.374,\n\t\t-1.186,\n\t\t11.044,\n\t\t-0.858,\n\t\t425.574,\n\t\t0.028,\n\t\t56,\n\t\t-0.581,\n\t\t0.377,\n\t\t-0.015,\n\t\t0.377,\n\t\t-0.015,\n\t\t0.222,\n\t\t-0.018,\n\t\t0.228,\n\t\t-0.018,\n\t\t0.219,\n\t\t-0.018,\n\t\t0.584,\n\t\t-0.025,\n\t\t-76.56,\n\t\t-1.187,\n\t\t10.186,\n\t\t-0.858,\n\t\t425.602,\n\t\t0.171,\n\t\t56,\n\t\t-4.039,\n\t\t0.362,\n\t\t-0.014,\n\t\t0.362,\n\t\t-0.014,\n\t\t0.204,\n\t\t-0.019,\n\t\t0.21,\n\t\t-0.019,\n\t\t0.201,\n\t\t-0.018,\n\t\t0.559,\n\t\t-0.03,\n\t\t-77.747,\n\t\t-1.186,\n\t\t9.328,\n\t\t-0.858,\n\t\t425.773,\n\t\t0.133,\n\t\t52,\n\t\t-4.095,\n\t\t0.348,\n\t\t-0.015,\n\t\t0.348,\n\t\t-0.015,\n\t\t0.185,\n\t\t-0.018,\n\t\t0.191,\n\t\t-0.018,\n\t\t0.183,\n\t\t-0.018,\n\t\t0.529,\n\t\t-0.035,\n\t\t-78.933,\n\t\t-1.187,\n\t\t8.47,\n\t\t-0.858,\n\t\t425.906,\n\t\t0.017,\n\t\t48,\n\t\t-0.648,\n\t\t0.333,\n\t\t-0.014,\n\t\t0.333,\n\t\t-0.014,\n\t\t0.167,\n\t\t-0.019,\n\t\t0.173,\n\t\t-0.018,\n\t\t0.165,\n\t\t-0.018,\n\t\t0.494,\n\t\t-0.041,\n\t\t-80.12,\n\t\t-1.186,\n\t\t7.612,\n\t\t-0.858,\n\t\t425.923,\n\t\t0.088,\n\t\t47,\n\t\t-4.177,\n\t\t0.319,\n\t\t-0.015,\n\t\t0.319,\n\t\t-0.015,\n\t\t0.148,\n\t\t-0.019,\n\t\t0.155,\n\t\t-0.019,\n\t\t0.147,\n\t\t-0.018,\n\t\t0.453,\n\t\t-0.045,\n\t\t-81.306,\n\t\t-1.187,\n\t\t6.754,\n\t\t-0.855,\n\t\t426.012,\n\t\t0.048,\n\t\t43,\n\t\t-4.233,\n\t\t0.304,\n\t\t-0.014,\n\t\t0.304,\n\t\t-0.014,\n\t\t0.129,\n\t\t-0.018,\n\t\t0.136,\n\t\t-0.018,\n\t\t0.129,\n\t\t-0.017,\n\t\t0.408,\n\t\t-0.05,\n\t\t-82.493,\n\t\t-1.186,\n\t\t5.899,\n\t\t-0.857,\n\t\t426.06,\n\t\t0.004,\n\t\t39,\n\t\t-0.716,\n\t\t0.29,\n\t\t-0.014,\n\t\t0.29,\n\t\t-0.014,\n\t\t0.111,\n\t\t-0.019,\n\t\t0.118,\n\t\t-0.018,\n\t\t0.112,\n\t\t-0.018,\n\t\t0.358,\n\t\t-0.055,\n\t\t-83.679,\n\t\t-1.186,\n\t\t5.042,\n\t\t-0.854,\n\t\t426.064,\n\t\t0.001,\n\t\t38,\n\t\t-4.316,\n\t\t0.276,\n\t\t-0.015,\n\t\t0.276,\n\t\t-0.015,\n\t\t0.092,\n\t\t-0.018,\n\t\t0.1,\n\t\t-0.019,\n\t\t0.094,\n\t\t-0.018,\n\t\t0.303,\n\t\t-0.06,\n\t\t-84.865,\n\t\t-1.187,\n\t\t4.188,\n\t\t-0.853,\n\t\t426.065,\n\t\t-0.004,\n\t\t34,\n\t\t-0.759,\n\t\t0.261,\n\t\t-0.014,\n\t\t0.261,\n\t\t-0.014,\n\t\t0.074,\n\t\t-0.019,\n\t\t0.081,\n\t\t-0.018,\n\t\t0.076,\n\t\t-0.018,\n\t\t0.243,\n\t\t-0.064,\n\t\t-86.052,\n\t\t-1.186,\n\t\t3.335,\n\t\t-0.848,\n\t\t426.061,\n\t\t-0.048,\n\t\t33,\n\t\t-4.399,\n\t\t0.247,\n\t\t-0.015,\n\t\t0.247,\n\t\t-0.015,\n\t\t0.055,\n\t\t-0.018,\n\t\t0.063,\n\t\t-0.018,\n\t\t0.058,\n\t\t-0.018,\n\t\t0.179,\n\t\t-0.069,\n\t\t-87.238,\n\t\t-1.187,\n\t\t2.487,\n\t\t-0.844,\n\t\t426.013,\n\t\t-0.013,\n\t\t28,\n\t\t-0.802,\n\t\t0.232,\n\t\t-0.014,\n\t\t0.232,\n\t\t-0.014,\n\t\t0.037,\n\t\t-0.019,\n\t\t0.045,\n\t\t-0.018,\n\t\t0.04,\n\t\t-0.018,\n\t\t0.11,\n\t\t-0.072,\n\t\t-88.425,\n\t\t-1.186,\n\t\t1.643,\n\t\t-0.84,\n\t\t426,\n\t\t0,\n\t\t28,\n\t\t0,\n\t\t0.218,\n\t\t-0.014,\n\t\t0.218,\n\t\t-0.014,\n\t\t0.018,\n\t\t-0.018,\n\t\t0.027,\n\t\t-0.018,\n\t\t0.022,\n\t\t-0.018,\n\t\t0.038,\n\t\t-0.038,\n\t\t-89.611,\n\t\t-1.185,\n\t\t0.803,\n\t\t-0.803],\n\t\t\"splinelength\":724,\n\t\t\"scrollbar\":{\n\t\t\t\"order\":10,\n\t\t\t\"side\":0,\n\t\t\t\"line_weight\":20,\n\t\t\t\"slider_image\":\"assets/Horiz.png.imag\",\n\t\t\t\"min_slider_size\":0,\n\t\t\t\"normal_RGBA\":-1,\n\t\t\t\"select_RGBA\":-1,\n\t\t\t\"active\":1,\n\t\t\t\"name\":\"page\",\n\t\t\t\"pagesize\":80,\n\t\t\t\"use_scrollBar\":1,\n\t\t\t\"hide_mode\":1,\n\t\t\t\"default_scroll\":0\n\t\t}\n\t}],\n\t\"width\":960,\n\t\"height\":640\n}"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/iphone/start.lua",
    "content": "function setup()\r\n        local x = 0\r\n        local y = 0\r\n        local pForm = UI_Form(nil, 0, x, y, \"asset://list.json\")\r\n\t\r\n\tsysCommand(pForm, UI_FORM_ANIM_ENTER)\r\n\t\r\n\tlocal pList = sysCommand(pForm, UI_FORM_UPDATE_NODE, \"task_list1\", FORM_NODE_TASK);\r\n\tfor i = 1, 50 do\r\n\t\tsysCommand(pList, UI_LIST_ITEM_ADD, \"asset://ui_item\" .. math.random(1,2) .. \".json\")\r\n\tend\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction callback(pList, type, tapX, tapY, moveX, moveY)\r\n\tlocal pos = sysCommand(pList, UI_LIST_GET_POSITION)\r\n\tlocal newPos = sysCommand(pList, UI_LIST_SET_POSITION, pos - moveX)\r\nend\r\n"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/iphone/ui_item1.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"AVATAR0001.png.imag\",\n\t\t\"x\":0,\n\t\t\"y\":0,\n\t\t\"priority\":300,\n\t\t\"default\":\"assets/AVATAR0001.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":80,\n\t\"height\":165\n}"
  },
  {
    "path": "Tutorial/23.ListSpline/.publish/iphone/ui_item2.json",
    "content": "{\n\t\"name\":\"root\",\n\t\"x\":0,\n\t\"y\":0,\n\t\"priority\":0,\n\t\"sub\":[{\n\t\t\"name\":\"AVATAR0002.png.imag\",\n\t\t\"x\":0,\n\t\t\"y\":0,\n\t\t\"priority\":100,\n\t\t\"default\":\"assets/AVATAR0002.png.imag\",\n\t\t\"xscale\":1,\n\t\t\"yscale\":1,\n\t\t\"rotation\":0\n\t}],\n\t\"width\":80,\n\t\"height\":165\n}"
  },
  {
    "path": "Tutorial/23.ListSpline/assets/AVATAR0001.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"01e86b57-cdf9-4aba-b58e-5533d8502471\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>AVATAR0001.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T15:30:01</SaveDate>\r\n    <Comment />\r\n    <EditState>true</EditState>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleProperty>true</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>15494</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:55:08</ImgFileDate>\r\n    <ImgPathName>assets/AVATAR0001.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/assets/AVATAR0002.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"73d6edca-b14f-4b1f-ad6a-b50e85ae11d8\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>AVATAR0002.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T15:30:01</SaveDate>\r\n    <Comment />\r\n    <EditState>true</EditState>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleProperty>true</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>21561</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 12:55:04</ImgFileDate>\r\n    <ImgPathName>assets/AVATAR0002.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>80</Width>\r\n    <Height>165</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>80</Width>\r\n        <Height>165</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>80</Width>\r\n      <Height>165</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>80</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>165</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>80</MaskWidth>\r\n    <MaskHeight>165</MaskHeight>\r\n    <Mask>M5AB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/assets/Horiz.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"9c79fb83-22ef-4ee5-b2b6-462513b7a4ec\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Horiz.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2012-11-30T16:03:14</SaveDate>\r\n    <Comment />\r\n    <EditState>true</EditState>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleProperty>true</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>1690</ImgFileSize>\r\n    <ImgFileDate>2012/07/31 10:02:10</ImgFileDate>\r\n    <ImgPathName>assets/Horiz.png</ImgPathName>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">14</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">14</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">16</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>44</Width>\r\n    <Height>37</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>44</Width>\r\n        <Height>37</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>44</Width>\r\n      <Height>37</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>44</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>44</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>44</MaskWidth>\r\n    <MaskHeight>37</MaskHeight>\r\n    <Mask>BlwB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/assets/Horiz2.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"27a408af-bbf4-4afb-a6b1-b959c8e66e30\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Horiz2.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>_scrollbar/</ProjectFileRelativeDir>\r\n    <SaveDate>2012-11-08T13:06:45</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>2719</ImgFileSize>\r\n    <ImgFileDate>2012/07/31 10:02:10</ImgFileDate>\r\n    <ImgPathName>_scrollbar/Horiz2.png</ImgPathName>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">14</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">16</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">14</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>88</Width>\r\n    <Height>37</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>88</Width>\r\n        <Height>37</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>88</Width>\r\n      <Height>37</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>88</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>88</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>88</MaskWidth>\r\n    <MaskHeight>37</MaskHeight>\r\n    <Mask>DLgB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/assets/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"444a9265-7281-42f4-a882-abcade214dc3\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir>assets/</ProjectFileRelativeDir>\r\n    <SaveDate>2013-09-25T15:30:18</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>512</Width>\r\n    <Height>512</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Horiz.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/Horiz.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>48</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Horiz2.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/Horiz2.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>40</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATAR0001.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATAR0001.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>82</X>\r\n        <Y>40</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>AVATAR0002.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>assets/AVATAR0002.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/list.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBUIEditor_Plugin id=\"8ed650cc-ce8e-42d3-b62c-0bb92b3979f1\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <DrawingAllNodesClickableRegion>true</DrawingAllNodesClickableRegion>\r\n  <DrawingFingerNode>false</DrawingFingerNode>\r\n  <DrawingGrid>true</DrawingGrid>\r\n  <DrawingNodeClipRegion>true</DrawingNodeClipRegion>\r\n  <DrawingNodeName>false</DrawingNodeName>\r\n  <FormBounds xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>596</d1p1:height>\r\n    <d1p1:width>803</d1p1:width>\r\n    <d1p1:x>138</d1p1:x>\r\n    <d1p1:y>14</d1p1:y>\r\n  </FormBounds>\r\n  <GridSize>7</GridSize>\r\n  <GuideForFourSplit>false</GuideForFourSplit>\r\n  <GuideForMargin>false</GuideForMargin>\r\n  <GuideForThreeSplit>false</GuideForThreeSplit>\r\n  <LayoutPpi>326</LayoutPpi>\r\n  <LayoutScale>0.5</LayoutScale>\r\n  <LayoutSize xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>640</d1p1:height>\r\n    <d1p1:width>960</d1p1:width>\r\n  </LayoutSize>\r\n  <RootNode>\r\n    <name>root</name>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <priority>0</priority>\r\n    <sub>\r\n      <UINode>\r\n        <name>task_list1</name>\r\n        <x>21</x>\r\n        <y>21</y>\r\n        <priority>35</priority>\r\n        <class>task_list</class>\r\n        <cliph>500</cliph>\r\n        <clipw>500</clipw>\r\n        <clipend>9999</clipend>\r\n        <width>60</width>\r\n        <height>60</height>\r\n        <_x0040_Publishable>true</_x0040_Publishable>\r\n        <callback>callback</callback>\r\n        <orientation>0</orientation>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string>assets/Horiz.png</d4p1:string>\r\n        </_x0040_CommonAssets>\r\n        <align>0</align>\r\n        <_x0040_BezierPoints xmlns:d4p1=\"http://schemas.datacontract.org/2004/07/SplineEditor\">\r\n          <d4p1:BezierPoint>\r\n            <d4p1:ControlPoint xmlns:d6p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n              <d6p1:x>7.99996948</d6p1:x>\r\n              <d6p1:y>265.7386</d6p1:y>\r\n            </d4p1:ControlPoint>\r\n            <d4p1:StartPoint xmlns:d6p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n              <d6p1:x>3.99997044</d6p1:x>\r\n              <d6p1:y>31.322094</d6p1:y>\r\n            </d4p1:StartPoint>\r\n          </d4p1:BezierPoint>\r\n          <d4p1:BezierPoint>\r\n            <d4p1:ControlPoint xmlns:d6p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n              <d6p1:x>429.999969</d6p1:x>\r\n              <d6p1:y>260.244446</d6p1:y>\r\n            </d4p1:ControlPoint>\r\n            <d4p1:StartPoint xmlns:d6p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n              <d6p1:x>203.999969</d6p1:x>\r\n              <d6p1:y>265.7386</d6p1:y>\r\n            </d4p1:StartPoint>\r\n          </d4p1:BezierPoint>\r\n          <d4p1:BezierPoint>\r\n            <d4p1:ControlPoint xmlns:d6p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n              <d6p1:x>189.999969</d6p1:x>\r\n              <d6p1:y>-43.21504</d6p1:y>\r\n            </d4p1:ControlPoint>\r\n            <d4p1:StartPoint xmlns:d6p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n              <d6p1:x>425.999969</d6p1:x>\r\n              <d6p1:y>27.659338</d6p1:y>\r\n            </d4p1:StartPoint>\r\n          </d4p1:BezierPoint>\r\n        </_x0040_BezierPoints>\r\n        <scrollbar>\r\n          <order>10</order>\r\n          <_x0023_side>0</_x0023_side>\r\n          <line_weight>20</line_weight>\r\n          <slider_image>assets/Horiz.png.imag</slider_image>\r\n          <min_slider_size>0</min_slider_size>\r\n          <normal_RGBA>-1</normal_RGBA>\r\n          <select_RGBA>-1</select_RGBA>\r\n          <_x0023_active>1</_x0023_active>\r\n          <name>page</name>\r\n          <pagesize>80</pagesize>\r\n          <use_scrollBar>1</use_scrollBar>\r\n          <hide_mode>1</hide_mode>\r\n          <default_scroll>0</default_scroll>\r\n        </scrollbar>\r\n        <_x0040_ListNodeSplineSet>\r\n          <Scale>\r\n            <AnchorPoint>\r\n              <Y>0.203539714</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.204225346</X>\r\n              <Y>0.9026548</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.468309879</X>\r\n              <Y>0.99999994</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.503521144</X>\r\n              <Y>1.30088484</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.5316901</X>\r\n              <Y>0.99999994</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.7992958</X>\r\n              <Y>0.9026548</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n              <Y>0.203539714</Y>\r\n            </AnchorPoint>\r\n          </Scale>\r\n          <Rotate>\r\n            <AnchorPoint>\r\n              <Y>90.79641</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.302816868</X>\r\n              <Y>-2.5510788E-05</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.306337982</X>\r\n              <Y>-2.5510788E-05</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.693661869</X>\r\n              <Y>-2.5510788E-05</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.700704157</X>\r\n              <Y>-2.5510788E-05</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n              <Y>-90.79649</Y>\r\n            </AnchorPoint>\r\n          </Rotate>\r\n          <Red>\r\n            <AnchorPoint>\r\n              <Y>1.12827754</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.197183087</X>\r\n              <Y>222.278732</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.496478856</X>\r\n              <Y>256.1283</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.802816868</X>\r\n              <Y>222.278732</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n              <Y>-4.11272049E-05</Y>\r\n            </AnchorPoint>\r\n          </Red>\r\n          <Green>\r\n            <AnchorPoint>\r\n              <Y>-4.11272049E-05</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.204225346</X>\r\n              <Y>220.0221</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.49999997</X>\r\n              <Y>253.871658</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.7992957</X>\r\n              <Y>225.663681</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n              <Y>2.256596</Y>\r\n            </AnchorPoint>\r\n          </Green>\r\n          <Blue>\r\n            <AnchorPoint>\r\n              <Y>2.256596</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.204225346</X>\r\n              <Y>225.663681</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.49999997</X>\r\n              <Y>254.999969</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.7957746</X>\r\n              <Y>224.53537</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n              <Y>1.12827754</Y>\r\n            </AnchorPoint>\r\n          </Blue>\r\n          <Alpha>\r\n            <AnchorPoint>\r\n              <Y>1.12827754</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.0563380234</X>\r\n              <Y>157.964569</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.496478856</X>\r\n              <Y>254.999969</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>0.9436619</X>\r\n              <Y>157.964569</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n              <Y>-7.898272</Y>\r\n            </AnchorPoint>\r\n          </Alpha>\r\n          <Priority>\r\n            <AnchorPoint />\r\n            <AnchorPoint>\r\n              <X>0.496478856</X>\r\n              <Y>99.99999</Y>\r\n            </AnchorPoint>\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n            </AnchorPoint>\r\n          </Priority>\r\n          <Layout>\r\n            <AnchorPoint />\r\n            <AnchorPoint>\r\n              <X>1</X>\r\n            </AnchorPoint>\r\n          </Layout>\r\n        </_x0040_ListNodeSplineSet>\r\n      </UINode>\r\n    </sub>\r\n    <width>960</width>\r\n    <height>640</height>\r\n    <_x0040_Publishable>true</_x0040_Publishable>\r\n    <_x0040_CommonAssets xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n      <d2p1:string i:nil=\"true\" />\r\n    </_x0040_CommonAssets>\r\n  </RootNode>\r\n  <ServerApiGroup>[ServerAPI]</ServerApiGroup>\r\n  <WindowState>Normal</WindowState>\r\n</KLBUIEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/start.lua",
    "content": "function setup()\r\n        local x = 0\r\n        local y = 0\r\n        local pForm = UI_Form(nil, 0, x, y, \"asset://list.json\")\r\n\t\r\n\tsysCommand(pForm, UI_FORM_ANIM_ENTER)\r\n\t\r\n\tlocal pList = sysCommand(pForm, UI_FORM_UPDATE_NODE, \"task_list1\", FORM_NODE_TASK);\r\n\tfor i = 1, 50 do\r\n\t\tsysCommand(pList, UI_LIST_ITEM_ADD, \"asset://ui_item\" .. math.random(1,2) .. \".json\")\r\n\tend\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction callback(pList, type, tapX, tapY, moveX, moveY)\r\n\tlocal pos = sysCommand(pList, UI_LIST_GET_POSITION)\r\n\tlocal newPos = sysCommand(pList, UI_LIST_SET_POSITION, pos - moveX)\r\nend\r\n"
  },
  {
    "path": "Tutorial/23.ListSpline/ui_item1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBUIEditor_Plugin id=\"15806edf-76f8-4445-89f5-52ae3e3e5201\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <Comment>主に Part ノードとして利用される。\r\n貼付先にて、animnode ノードの下に任意のノードをぶら下げる事で、任意ノードの共通アニメーションを実現する。</Comment>\r\n  <DrawingAllNodesClickableRegion>true</DrawingAllNodesClickableRegion>\r\n  <DrawingFingerNode>false</DrawingFingerNode>\r\n  <DrawingGrid>true</DrawingGrid>\r\n  <DrawingNodeClipRegion>true</DrawingNodeClipRegion>\r\n  <DrawingNodeName>true</DrawingNodeName>\r\n  <FormBounds xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>552</d1p1:height>\r\n    <d1p1:width>833</d1p1:width>\r\n    <d1p1:x>25</d1p1:x>\r\n    <d1p1:y>75</d1p1:y>\r\n  </FormBounds>\r\n  <GridSize>10</GridSize>\r\n  <GuideForFourSplit>false</GuideForFourSplit>\r\n  <GuideForMargin>false</GuideForMargin>\r\n  <GuideForThreeSplit>false</GuideForThreeSplit>\r\n  <LayoutPpi>326</LayoutPpi>\r\n  <LayoutScale>0.75</LayoutScale>\r\n  <LayoutSize xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>165</d1p1:height>\r\n    <d1p1:width>80</d1p1:width>\r\n  </LayoutSize>\r\n  <RootNode>\r\n    <name>root</name>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <priority>0</priority>\r\n    <sub>\r\n      <UINode>\r\n        <name>AVATAR0001.png.imag</name>\r\n        <x>0</x>\r\n        <y>0</y>\r\n        <priority>300</priority>\r\n        <default>assets/AVATAR0001.png.imag</default>\r\n        <_x0040_Publishable>true</_x0040_Publishable>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string>assets/AVATAR0001.png</d4p1:string>\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n    </sub>\r\n    <width>80</width>\r\n    <height>165</height>\r\n    <_x0040_Publishable>true</_x0040_Publishable>\r\n    <_x0040_CommonAssets xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n      <d2p1:string i:nil=\"true\" />\r\n    </_x0040_CommonAssets>\r\n  </RootNode>\r\n  <ServerApiGroup>[ServerAPI]</ServerApiGroup>\r\n  <WindowState>Normal</WindowState>\r\n</KLBUIEditor_Plugin>"
  },
  {
    "path": "Tutorial/23.ListSpline/ui_item2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBUIEditor_Plugin id=\"f1ac9399-0082-4bcb-bfba-4cad1a7ecd96\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <DrawingAllNodesClickableRegion>true</DrawingAllNodesClickableRegion>\r\n  <DrawingFingerNode>true</DrawingFingerNode>\r\n  <DrawingGrid>true</DrawingGrid>\r\n  <DrawingNodeClipRegion>true</DrawingNodeClipRegion>\r\n  <DrawingNodeName>true</DrawingNodeName>\r\n  <FormBounds xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>552</d1p1:height>\r\n    <d1p1:width>833</d1p1:width>\r\n    <d1p1:x>-41</d1p1:x>\r\n    <d1p1:y>159</d1p1:y>\r\n  </FormBounds>\r\n  <GridSize>10</GridSize>\r\n  <GuideForFourSplit>false</GuideForFourSplit>\r\n  <GuideForMargin>false</GuideForMargin>\r\n  <GuideForThreeSplit>false</GuideForThreeSplit>\r\n  <LayoutPpi>326</LayoutPpi>\r\n  <LayoutScale>1</LayoutScale>\r\n  <LayoutSize xmlns:d1p1=\"http://schemas.datacontract.org/2004/07/System.Drawing\">\r\n    <d1p1:height>165</d1p1:height>\r\n    <d1p1:width>80</d1p1:width>\r\n  </LayoutSize>\r\n  <RootNode>\r\n    <name>root</name>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <priority>0</priority>\r\n    <sub>\r\n      <UINode>\r\n        <name>AVATAR0002.png.imag</name>\r\n        <x>0</x>\r\n        <y>0</y>\r\n        <priority>100</priority>\r\n        <default>assets/AVATAR0002.png.imag</default>\r\n        <_x0040_Publishable>true</_x0040_Publishable>\r\n        <xscale>1</xscale>\r\n        <yscale>1</yscale>\r\n        <_x0040_CommonAssets xmlns:d4p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n          <d4p1:string>assets/AVATAR0002.png</d4p1:string>\r\n        </_x0040_CommonAssets>\r\n        <rotation>0</rotation>\r\n      </UINode>\r\n    </sub>\r\n    <width>80</width>\r\n    <height>165</height>\r\n    <_x0040_Publishable>true</_x0040_Publishable>\r\n    <_x0040_CommonAssets xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\r\n      <d2p1:string i:nil=\"true\" />\r\n    </_x0040_CommonAssets>\r\n  </RootNode>\r\n  <ServerApiGroup>[ServerAPI]</ServerApiGroup>\r\n  <WindowState>Normal</WindowState>\r\n</KLBUIEditor_Plugin>"
  },
  {
    "path": "Tutorial/24.Canvas/.publish/android/Canvas.lua",
    "content": "function setup()\r\n\tsyslog(\"a\")\r\n\ttskCanvas = UI_Canvas(\r\n\t\tnil,\r\n\t\t7000,\r\n\t\t20,\r\n\t\t20,\r\n\t\t2000,\r\n\t\t2000,\r\n\t\t\"drawfunc\"\r\n\t)\r\n\tsyslog(\"b\")\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileA.png.imag\")\t-- 0\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileB.png.imag\")\t-- 1\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileC.png.imag\")\t-- 2\r\n\tsyslog(\"c\")\r\n\t\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 1 then\r\n\t\tdrawfunc(tskCanvas)\r\n\tend\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_DRAWIMAGESCALE\"))\r\n\t\tdrawScaleFunc(tskCanvas)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_FILLRECT\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FILLRECT, 300, 0, 100, 100, 0xff, 0xff00ff)\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_FREEZE\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FREEZE, false)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD DYNAMIC\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FREEZE, true)\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_STARTSECTION, 0)\r\n\t\tdrawfunc(tskCanvas)\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_ENDSECTION, 0)\r\n\t\t\r\n\tend\r\n\tif count == 450 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_SECTIONTRANSLATE\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_SECTIONTRANSLATE, 0, 100, 100)\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_SECTIONCOLOR\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_SECTIONCOLOR, 0, 0xff, 0xffffff)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction drawfunc(canvas)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 0, 0, 0, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 20, 0, 1, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 0, 20, 2, 0xFFFFFF, 255)\r\n\t-- sysCommand(canvas, UI_CANVAS_FREEZE, true);\r\nend\r\n\r\nfunction drawScaleFunc(canvas)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 0,  0, 0.2, 0, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 20, 0, 0.2, 1, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 0, 20, 0.2, 2, 0xFFFFFF, 255)\r\n\t-- sysCommand(canvas, UI_CANVAS_FREEZE, true);\r\nend"
  },
  {
    "path": "Tutorial/24.Canvas/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Canvas.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/24.Canvas/.publish/iphone/Canvas.lua",
    "content": "function setup()\r\n\tsyslog(\"a\")\r\n\ttskCanvas = UI_Canvas(\r\n\t\tnil,\r\n\t\t7000,\r\n\t\t20,\r\n\t\t20,\r\n\t\t2000,\r\n\t\t2000,\r\n\t\t\"drawfunc\"\r\n\t)\r\n\tsyslog(\"b\")\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileA.png.imag\")\t-- 0\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileB.png.imag\")\t-- 1\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileC.png.imag\")\t-- 2\r\n\tsyslog(\"c\")\r\n\t\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 1 then\r\n\t\tdrawfunc(tskCanvas)\r\n\tend\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_DRAWIMAGESCALE\"))\r\n\t\tdrawScaleFunc(tskCanvas)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_FILLRECT\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FILLRECT, 300, 0, 100, 100, 0xff, 0xff00ff)\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_FREEZE\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FREEZE, false)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD DYNAMIC\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FREEZE, true)\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_STARTSECTION, 0)\r\n\t\tdrawfunc(tskCanvas)\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_ENDSECTION, 0)\r\n\t\t\r\n\tend\r\n\tif count == 450 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_SECTIONTRANSLATE\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_SECTIONTRANSLATE, 0, 100, 100)\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_SECTIONCOLOR\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_SECTIONCOLOR, 0, 0xff, 0xffffff)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction drawfunc(canvas)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 0, 0, 0, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 20, 0, 1, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 0, 20, 2, 0xFFFFFF, 255)\r\n\t-- sysCommand(canvas, UI_CANVAS_FREEZE, true);\r\nend\r\n\r\nfunction drawScaleFunc(canvas)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 0,  0, 0.2, 0, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 20, 0, 0.2, 1, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 0, 20, 0.2, 2, 0xFFFFFF, 255)\r\n\t-- sysCommand(canvas, UI_CANVAS_FREEZE, true);\r\nend"
  },
  {
    "path": "Tutorial/24.Canvas/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Canvas.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/24.Canvas/Canvas.lua",
    "content": "function setup()\r\n\tsyslog(\"a\")\r\n\ttskCanvas = UI_Canvas(\r\n\t\tnil,\r\n\t\t7000,\r\n\t\t20,\r\n\t\t20,\r\n\t\t2000,\r\n\t\t2000,\r\n\t\t\"drawfunc\"\r\n\t)\r\n\tsyslog(\"b\")\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileA.png.imag\")\t-- 0\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileB.png.imag\")\t-- 1\r\n\tsysCommand(tskCanvas, UI_CANVAS_ADDRESOURCE, \"asset://TileC.png.imag\")\t-- 2\r\n\tsyslog(\"c\")\r\n\t\r\n\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\tcount = count + 1\r\n\t\r\n\tif count == 1 then\r\n\t\tdrawfunc(tskCanvas)\r\n\tend\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(tskCanvas)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(tskCanvas, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_DRAWIMAGESCALE\"))\r\n\t\tdrawScaleFunc(tskCanvas)\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_FILLRECT\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FILLRECT, 300, 0, 100, 100, 0xff, 0xff00ff)\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_FREEZE\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FREEZE, false)\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"CMD DYNAMIC\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_FREEZE, true)\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_STARTSECTION, 0)\r\n\t\tdrawfunc(tskCanvas)\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_ENDSECTION, 0)\r\n\t\t\r\n\tend\r\n\tif count == 450 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_SECTIONTRANSLATE\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_SECTIONTRANSLATE, 0, 100, 100)\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"CMD UI_CANVAS_SECTIONCOLOR\"))\r\n\t\tsysCommand(tskCanvas, UI_CANVAS_SECTIONCOLOR, 0, 0xff, 0xffffff)\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction drawfunc(canvas)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 0, 0, 0, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 20, 0, 1, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGE, 0, 20, 2, 0xFFFFFF, 255)\r\n\t-- sysCommand(canvas, UI_CANVAS_FREEZE, true);\r\nend\r\n\r\nfunction drawScaleFunc(canvas)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 0,  0, 0.2, 0, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 20, 0, 0.2, 1, 0xFFFFFF, 255)\r\n\tsysCommand(canvas, UI_CANVAS_DRAWIMAGESCALE, 0, 20, 0.2, 2, 0xFFFFFF, 255)\r\n\t-- sysCommand(canvas, UI_CANVAS_FREEZE, true);\r\nend"
  },
  {
    "path": "Tutorial/24.Canvas/TileA.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"eaa962cf-0bc7-4361-9317-c89b331f990c\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileA.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>657</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:22</ImgFileDate>\r\n    <ImgPathName>TileA.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/24.Canvas/TileB.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"a2864678-680c-4dad-9c83-cf6aabb5f513\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileB.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>665</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:36</ImgFileDate>\r\n    <ImgPathName>TileB.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/24.Canvas/TileC.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"b12a93be-dad0-40cc-9e73-60c45589f3e6\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>TileC.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-18T21:14:59</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>657</ImgFileSize>\r\n    <ImgFileDate>09/08/2012 17:43:54</ImgFileDate>\r\n    <ImgPathName>TileC.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>16</Width>\r\n    <Height>16</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>16</Width>\r\n        <Height>16</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>16</Width>\r\n      <Height>16</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>16</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>16</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>16</MaskWidth>\r\n    <MaskHeight>16</MaskHeight>\r\n    <Mask>AQAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/24.Canvas/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://Canvas.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/24.Canvas/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"5e70d8c4-aae1-4651-8189-6b5848deaf48\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-08-09T17:50:49</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileA.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileA.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>24</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileB.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileB.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>48</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>TileC.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>TileC.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/25.SWFPlayer/.publish/android/SWFPlayer.lua",
    "content": "function setup()\r\n\tlocal x = 300\r\n\tlocal y = 300\r\n\t-- \r\n\tpSWF = UI_SWFPlayer(nil, 7000, x, y, \"asset://TestScale.flsh\",nil,\"flash_callback\")\r\n\t--[[↑\r\n\t\targ[6]には、arg[5]で指定された flash asset 内に含まれる movie clip の名称を与えますが、\r\n\t\tflash 全体を再生する場合は nil にします。このため、通常の利用では nil にすることが多くなります。\r\n\t\t\r\n\t\targ[7]はflashアニメーションが終了した際に呼ばれるコールバック関数の名称です。\r\n\t\t\r\n\t\tUI_SWFPlayerは、起動直後デフォルトで再生状態になっています。\r\n\t\t再生をストップした状態で開始したい場合は、起動直後 UI_SWF_STOP コマンドを使用します。\r\n\t]]\r\n\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl01\", \"flash_callback\")\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl02\", \"flash_callback\")\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl03\", \"flash_callback\")\r\n\t\r\n\t--[[\r\n\t\tflashアニメーション中の特定フレームに到達したことを検知するコールバック関数を指定する場合、\r\n\t\t生成した UI_SWFPlayer タスクのポインタに対して UI_SWF_REACHFRAME コマンドを発行します。\r\n\t\tフレームにつけられたラベルと、コールバック関数の名称を引数として与えます。\r\n\t\t\r\n\t\tコールバック関数の引数は、アニメーション終了時のコールバックと同じであるため、\r\n\t\t同じ関数を指定することができます。\r\n\t]]\r\n\r\n\ttime_ = 0\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\nend\r\n\r\n--[[ コールバック関数の定義 ]]\r\nfunction flash_callback(pSWF, label)\r\n\t--[[\r\n\t\tpSWFには、この関数を呼び出したタスクのポインタ、\r\n\t\tlabel には到達したフレームラベルが与えられます。\r\n\t\tアニメーション終了時の呼び出しでは、label の値が \"\"(空文字列)となります。\r\n\r\n\t\tまた、呼び出したタスクのポインタが与えられるので、複数の UI_SWFPlayer から\r\n\t\t同じコールバックを呼ぶことが可能です。\r\n\t]]\r\n\r\n\tif label == \"\" then\r\n\t\t-- アニメーションが終了していたら、\"frameLabel\" に飛ぶ\r\n\t\t--[[\r\n\t\t\tflashアニメーションの再生を特定のフレームから行いたい場合、\r\n\t\t\tUI_SWF_GOTOFRAME コマンドを使用して再生を開始するフレームをラベルで指定します。\r\n\t\t]]\r\n\t\tsyslog(string.format(\"[SWF]reach last frame.\"))\r\n\t\tsysCommand(pSWF, UI_SWF_GOTOFRAME, \"frameLabel\")\r\n\telse\r\n\t\t-- それ以外へのラベルに到達していたら、到達したラベルを表示する。\r\n\t\tsyslog(string.format(\"[SWF]reach: <%s>\", label))\r\n\tend\r\nend\r\n\r\n--\r\n-- Sampe function, not used.\r\n--\r\nfunction swfSTOP(pSWF)\r\n\tsysCommand(pSWF, UI_SWF_STOP)\r\n\t--[[\r\n\t\tUI_SWFPlayerの再生を一時ストップします。本質的にはSTOPというよりPAUSEです。\r\n\t]]\r\nend\r\n\r\nfunction swfPLAY(pSWF)\r\n\tsysCommand(pSWF, UI_SWF_PLAY)\r\n\t--[[\r\n\t\tUI_SWF_STOP でストップ中の再生を再開します。\r\n\t\t再生状態で呼び出した場合は何もしません。\r\n\t]]\r\nend\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://SWFPlayer.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/.publish/iphone/SWFPlayer.lua",
    "content": "function setup()\r\n\tlocal x = 300\r\n\tlocal y = 300\r\n\t-- \r\n\tpSWF = UI_SWFPlayer(nil, 7000, x, y, \"asset://TestScale.flsh\",nil,\"flash_callback\")\r\n\t--[[↑\r\n\t\targ[6]には、arg[5]で指定された flash asset 内に含まれる movie clip の名称を与えますが、\r\n\t\tflash 全体を再生する場合は nil にします。このため、通常の利用では nil にすることが多くなります。\r\n\t\t\r\n\t\targ[7]はflashアニメーションが終了した際に呼ばれるコールバック関数の名称です。\r\n\t\t\r\n\t\tUI_SWFPlayerは、起動直後デフォルトで再生状態になっています。\r\n\t\t再生をストップした状態で開始したい場合は、起動直後 UI_SWF_STOP コマンドを使用します。\r\n\t]]\r\n\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl01\", \"flash_callback\")\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl02\", \"flash_callback\")\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl03\", \"flash_callback\")\r\n\t\r\n\t--[[\r\n\t\tflashアニメーション中の特定フレームに到達したことを検知するコールバック関数を指定する場合、\r\n\t\t生成した UI_SWFPlayer タスクのポインタに対して UI_SWF_REACHFRAME コマンドを発行します。\r\n\t\tフレームにつけられたラベルと、コールバック関数の名称を引数として与えます。\r\n\t\t\r\n\t\tコールバック関数の引数は、アニメーション終了時のコールバックと同じであるため、\r\n\t\t同じ関数を指定することができます。\r\n\t]]\r\n\r\n\ttime_ = 0\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\nend\r\n\r\n--[[ コールバック関数の定義 ]]\r\nfunction flash_callback(pSWF, label)\r\n\t--[[\r\n\t\tpSWFには、この関数を呼び出したタスクのポインタ、\r\n\t\tlabel には到達したフレームラベルが与えられます。\r\n\t\tアニメーション終了時の呼び出しでは、label の値が \"\"(空文字列)となります。\r\n\r\n\t\tまた、呼び出したタスクのポインタが与えられるので、複数の UI_SWFPlayer から\r\n\t\t同じコールバックを呼ぶことが可能です。\r\n\t]]\r\n\r\n\tif label == \"\" then\r\n\t\t-- アニメーションが終了していたら、\"frameLabel\" に飛ぶ\r\n\t\t--[[\r\n\t\t\tflashアニメーションの再生を特定のフレームから行いたい場合、\r\n\t\t\tUI_SWF_GOTOFRAME コマンドを使用して再生を開始するフレームをラベルで指定します。\r\n\t\t]]\r\n\t\tsyslog(string.format(\"[SWF]reach last frame.\"))\r\n\t\tsysCommand(pSWF, UI_SWF_GOTOFRAME, \"frameLabel\")\r\n\telse\r\n\t\t-- それ以外へのラベルに到達していたら、到達したラベルを表示する。\r\n\t\tsyslog(string.format(\"[SWF]reach: <%s>\", label))\r\n\tend\r\nend\r\n\r\n--\r\n-- Sampe function, not used.\r\n--\r\nfunction swfSTOP(pSWF)\r\n\tsysCommand(pSWF, UI_SWF_STOP)\r\n\t--[[\r\n\t\tUI_SWFPlayerの再生を一時ストップします。本質的にはSTOPというよりPAUSEです。\r\n\t]]\r\nend\r\n\r\nfunction swfPLAY(pSWF)\r\n\tsysCommand(pSWF, UI_SWF_PLAY)\r\n\t--[[\r\n\t\tUI_SWF_STOP でストップ中の再生を再開します。\r\n\t\t再生状態で呼び出した場合は何もしません。\r\n\t]]\r\nend\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://SWFPlayer.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/Char.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"2106493d-58d4-4934-bcd6-d9c21ed785cc\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>Char.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-09-25T15:31:35</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <isAdditive>false</isAdditive>\r\n    <ImgFileSize>1876</ImgFileSize>\r\n    <ImgFileDate>2013/08/26 13:32:12</ImgFileDate>\r\n    <ImgPathName>Char.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>Default</ImageType>\r\n    <ImageTypeParams />\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>24</Width>\r\n    <Height>32</Height>\r\n    <VertexPostProcessMode>0</VertexPostProcessMode>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>24</Width>\r\n        <Height>32</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>24</Width>\r\n      <Height>32</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>24</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>24</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>32</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>24</MaskWidth>\r\n    <MaskHeight>32</MaskHeight>\r\n    <Mask>AwAB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/25.SWFPlayer/SWFPlayer.lua",
    "content": "function setup()\r\n\tlocal x = 300\r\n\tlocal y = 300\r\n\t-- \r\n\tpSWF = UI_SWFPlayer(nil, 7000, x, y, \"asset://TestScale.flsh\",nil,\"flash_callback\")\r\n\t--[[↑\r\n\t\targ[6]には、arg[5]で指定された flash asset 内に含まれる movie clip の名称を与えますが、\r\n\t\tflash 全体を再生する場合は nil にします。このため、通常の利用では nil にすることが多くなります。\r\n\t\t\r\n\t\targ[7]はflashアニメーションが終了した際に呼ばれるコールバック関数の名称です。\r\n\t\t\r\n\t\tUI_SWFPlayerは、起動直後デフォルトで再生状態になっています。\r\n\t\t再生をストップした状態で開始したい場合は、起動直後 UI_SWF_STOP コマンドを使用します。\r\n\t]]\r\n\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl01\", \"flash_callback\")\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl02\", \"flash_callback\")\r\n\tsysCommand(pSWF, UI_SWF_REACHFRAME, \"lbl03\", \"flash_callback\")\r\n\t\r\n\t--[[\r\n\t\tflashアニメーション中の特定フレームに到達したことを検知するコールバック関数を指定する場合、\r\n\t\t生成した UI_SWFPlayer タスクのポインタに対して UI_SWF_REACHFRAME コマンドを発行します。\r\n\t\tフレームにつけられたラベルと、コールバック関数の名称を引数として与えます。\r\n\t\t\r\n\t\tコールバック関数の引数は、アニメーション終了時のコールバックと同じであるため、\r\n\t\t同じ関数を指定することができます。\r\n\t]]\r\n\r\n\ttime_ = 0\r\nend\r\n\r\nfunction execute(deltaT)\r\nend\r\n\r\nfunction leave()\r\nend\r\n\r\n--[[ コールバック関数の定義 ]]\r\nfunction flash_callback(pSWF, label)\r\n\t--[[\r\n\t\tpSWFには、この関数を呼び出したタスクのポインタ、\r\n\t\tlabel には到達したフレームラベルが与えられます。\r\n\t\tアニメーション終了時の呼び出しでは、label の値が \"\"(空文字列)となります。\r\n\r\n\t\tまた、呼び出したタスクのポインタが与えられるので、複数の UI_SWFPlayer から\r\n\t\t同じコールバックを呼ぶことが可能です。\r\n\t]]\r\n\r\n\tif label == \"\" then\r\n\t\t-- アニメーションが終了していたら、\"frameLabel\" に飛ぶ\r\n\t\t--[[\r\n\t\t\tflashアニメーションの再生を特定のフレームから行いたい場合、\r\n\t\t\tUI_SWF_GOTOFRAME コマンドを使用して再生を開始するフレームをラベルで指定します。\r\n\t\t]]\r\n\t\tsyslog(string.format(\"[SWF]reach last frame.\"))\r\n\t\tsysCommand(pSWF, UI_SWF_GOTOFRAME, \"frameLabel\")\r\n\telse\r\n\t\t-- それ以外へのラベルに到達していたら、到達したラベルを表示する。\r\n\t\tsyslog(string.format(\"[SWF]reach: <%s>\", label))\r\n\tend\r\nend\r\n\r\n--\r\n-- Sampe function, not used.\r\n--\r\nfunction swfSTOP(pSWF)\r\n\tsysCommand(pSWF, UI_SWF_STOP)\r\n\t--[[\r\n\t\tUI_SWFPlayerの再生を一時ストップします。本質的にはSTOPというよりPAUSEです。\r\n\t]]\r\nend\r\n\r\nfunction swfPLAY(pSWF)\r\n\tsysCommand(pSWF, UI_SWF_PLAY)\r\n\t--[[\r\n\t\tUI_SWF_STOP でストップ中の再生を再開します。\r\n\t\t再生状態で呼び出した場合は何もしません。\r\n\t]]\r\nend\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/TestScale.flash.html",
    "content": "﻿<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">\r\n\t<head>\r\n\t\t<title>TestScale.flash</title>\r\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n\t\t<style type=\"text/css\" media=\"screen\">\r\n\t\thtml, body { height:100%; background-color: #ffffff;}\r\n\t\tbody { margin:0; padding:0; overflow:hidden; }\r\n\t\t#flashContent { width:100%; height:100%; }\r\n\t\t</style>\r\n\t</head>\r\n\t<body>\r\n\t\t<div id=\"flashContent\">\r\n\t\t\t<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"320\" height=\"240\" id=\"TestScale.flash\" align=\"middle\">\r\n\t\t\t\t<param name=\"movie\" value=\"TestScale.flash.swf\" />\r\n\t\t\t\t<param name=\"quality\" value=\"high\" />\r\n\t\t\t\t<param name=\"bgcolor\" value=\"#ffffff\" />\r\n\t\t\t\t<param name=\"play\" value=\"true\" />\r\n\t\t\t\t<param name=\"loop\" value=\"true\" />\r\n\t\t\t\t<param name=\"wmode\" value=\"window\" />\r\n\t\t\t\t<param name=\"scale\" value=\"showall\" />\r\n\t\t\t\t<param name=\"menu\" value=\"true\" />\r\n\t\t\t\t<param name=\"devicefont\" value=\"false\" />\r\n\t\t\t\t<param name=\"salign\" value=\"\" />\r\n\t\t\t\t<param name=\"allowScriptAccess\" value=\"sameDomain\" />\r\n\t\t\t\t<!--[if !IE]>-->\r\n\t\t\t\t<object type=\"application/x-shockwave-flash\" data=\"TestScale.flash.swf\" width=\"320\" height=\"240\">\r\n\t\t\t\t\t<param name=\"movie\" value=\"TestScale.flash.swf\" />\r\n\t\t\t\t\t<param name=\"quality\" value=\"high\" />\r\n\t\t\t\t\t<param name=\"bgcolor\" value=\"#ffffff\" />\r\n\t\t\t\t\t<param name=\"play\" value=\"true\" />\r\n\t\t\t\t\t<param name=\"loop\" value=\"true\" />\r\n\t\t\t\t\t<param name=\"wmode\" value=\"window\" />\r\n\t\t\t\t\t<param name=\"scale\" value=\"showall\" />\r\n\t\t\t\t\t<param name=\"menu\" value=\"true\" />\r\n\t\t\t\t\t<param name=\"devicefont\" value=\"false\" />\r\n\t\t\t\t\t<param name=\"salign\" value=\"\" />\r\n\t\t\t\t\t<param name=\"allowScriptAccess\" value=\"sameDomain\" />\r\n\t\t\t\t<!--<![endif]-->\r\n\t\t\t\t\t<a href=\"http://www.adobe.com/go/getflash\">\r\n\t\t\t\t\t\t<img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Adobe Flash Player を取得\" />\r\n\t\t\t\t\t</a>\r\n\t\t\t\t<!--[if !IE]>-->\r\n\t\t\t\t</object>\r\n\t\t\t\t<!--<![endif]-->\r\n\t\t\t</object>\r\n\t\t</div>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://SWFPlayer.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/25.SWFPlayer/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBTextureEditor_Plugin id=\"4d4a30a8-3e9f-4cb4-a4d3-193410c6f169\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2013-06-26T16:22:42</SaveDate>\r\n    <EditState>true</EditState>\r\n    <ContainerScale>1</ContainerScale>\r\n    <ContainerSnap>8</ContainerSnap>\r\n    <VisibleGrid>true</VisibleGrid>\r\n    <VisibleBoundaryLine>true</VisibleBoundaryLine>\r\n    <VisibleImage>true</VisibleImage>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleProperty>true</VisibleProperty>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleCenterPoint>false</VisibleCenterPoint>\r\n    <Comment />\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>64</Width>\r\n    <Height>64</Height>\r\n    <PixelFormat>RGBA4444</PixelFormat>\r\n    <usePremultiply>false</usePremultiply>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>8</X>\r\n        <Y>8</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Char.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>false</IsSwitchXY>\r\n      <ImgPathName>Char.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n  <ArrayOfT3DModel />\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/26.ScrollBar/.publish/android/ScrollBar.lua",
    "content": "function setup()\r\n-- OK test : horiz, vertical.\r\n-- OK test : double graphics.\r\n-- OK test : Enable / Disabled.\r\n-- TODO test : texture 90 rot.\r\n-- TODO call back func support.\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpHorizScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t-5,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t5,\t\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Horiz.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\t\"callback\",\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\tpVertScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t400, 400,\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t-5,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t5,\t\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Vert.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\t-- 2 Style bitmap\r\n\tpHScroll2 = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t0, 400,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t150,\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Horiz2.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\t-- 2 Style bitmap\r\n\tpVertScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t400, 0,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t150,\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Vert2.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Vertical\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"width\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.width = 500\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"height\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.height = 100\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 260 then\r\n\t\tsyslog(string.format(\"min\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.min = -3\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"max\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.max = 10\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"pos\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.pos = 10\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 320 then\r\n\t\tsyslog(string.format(\"img\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.img = \"forbidden\"\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 340 then\r\n\t\tsyslog(string.format(\"slider_size\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.slider_size = 100\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 360 then\r\n\t\tsyslog(string.format(\"slider_minsize\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.slider_minsize = 50\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"f_vert\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.f_vert = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"callback\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.f_vert = false\r\n\t\tprop.callback = \"forbidden\"\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 420 then\r\n\t\tsyslog(string.format(\"alpha_normal\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha_normal = 0x80\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 440 then\r\n\t\tsyslog(string.format(\"alpha_select\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha_select = 0xff\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 460 then\r\n\t\tsyslog(string.format(\"color_normal\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color_normal = 0xff0000\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 480 then\r\n\t\tsyslog(string.format(\"color_select\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color_select = 0x0000ff\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"touch_active = false\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.touch_active = false\r\n\t\tTASK_setProperty(pHorizScroll, prop)\r\n\tend\r\n\t\r\n\tif count == 550 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_MIN\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.touch_active = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_MIN, 0)\r\n\tend\r\n\tif count == 560 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_MIN)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_MIN = %i\", ret))\r\n\tend\r\n\tif count == 580 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_MAX\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_MAX, 2)\r\n\tend\r\n\tif count == 600 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_MAX)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_MAX = %i\", ret))\r\n\tend\r\n\tif count == 620 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_POS\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_POS, 1)\r\n\tend\r\n\tif count == 640 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_POS)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_POS = %i\", ret))\r\n\tend\r\n\tif count == 660 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_SLIDER_SIZE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_SLIDER_SIZE, 200)\r\n\tend\r\n\tif count == 680 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_SLIDER_SIZE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_SLIDER_SIZE = %i\", ret))\r\n\tend\r\n\tif count == 700 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_SLIDER_MIN_SIZE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_SLIDER_MIN_SIZE, 10)\r\n\tend\r\n\tif count == 720 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_SLIDER_MIN_SIZE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_SLIDER_MIN_SIZE = %i\", ret))\r\n\tend\r\n\tif count == 740 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_COLOR_NORMAL\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_COLOR_NORMAL, 0x000000)\r\n\tend\r\n\tif count == 760 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_COLOR_NORMAL)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_COLOR_NORMAL = %i\", ret))\r\n\tend\r\n\tif count == 780 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_COLOR_SELECT\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_COLOR_SELECT, 0xffffff)\r\n\tend\r\n\tif count == 800 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_COLOR_SELECT)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_COLOR_SELECT = %i\", ret))\r\n\tend\r\n\tif count == 820 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_ALPHA_NORMAL\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_ALPHA_NORMAL, 0xff)\r\n\tend\r\n\tif count == 840 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_ALPHA_NORMAL)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_ALPHA_NORMAL = %i\", ret))\r\n\tend\r\n\tif count == 860 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_ALPHA_SELECT\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_ALPHA_SELECT, 0x00)\r\n\tend\r\n\tif count == 880 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_ALPHA_SELECT)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_ALPHA_SELECT = %i\", ret))\r\n\tend\r\n\tif count == 900 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_TOUCH_ACTIVE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_TOUCH_ACTIVE, false)\r\n\tend\r\n\tif count == 920 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_TOUCH_ACTIVE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_TOUCH_ACTIVE = %i\", ret))\r\n\tend\r\n\tif count == 940 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SELECT_SCRMGR\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SELECT_SCRMGR, \"name\")\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction callback(task, evnt_type, value)\r\n\tsyslog(string.format(\"Value %i\",value))\r\nend\r\n"
  },
  {
    "path": "Tutorial/26.ScrollBar/.publish/android/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://ScrollBar.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/26.ScrollBar/.publish/iphone/ScrollBar.lua",
    "content": "function setup()\r\n-- OK test : horiz, vertical.\r\n-- OK test : double graphics.\r\n-- OK test : Enable / Disabled.\r\n-- TODO test : texture 90 rot.\r\n-- TODO call back func support.\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpHorizScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t-5,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t5,\t\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Horiz.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\t\"callback\",\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\tpVertScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t400, 400,\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t-5,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t5,\t\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Vert.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\t-- 2 Style bitmap\r\n\tpHScroll2 = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t0, 400,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t150,\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Horiz2.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\t-- 2 Style bitmap\r\n\tpVertScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t400, 0,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t150,\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Vert2.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Vertical\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"width\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.width = 500\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"height\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.height = 100\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 260 then\r\n\t\tsyslog(string.format(\"min\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.min = -3\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"max\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.max = 10\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"pos\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.pos = 10\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 320 then\r\n\t\tsyslog(string.format(\"img\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.img = \"forbidden\"\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 340 then\r\n\t\tsyslog(string.format(\"slider_size\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.slider_size = 100\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 360 then\r\n\t\tsyslog(string.format(\"slider_minsize\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.slider_minsize = 50\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"f_vert\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.f_vert = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"callback\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.f_vert = false\r\n\t\tprop.callback = \"forbidden\"\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 420 then\r\n\t\tsyslog(string.format(\"alpha_normal\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha_normal = 0x80\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 440 then\r\n\t\tsyslog(string.format(\"alpha_select\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha_select = 0xff\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 460 then\r\n\t\tsyslog(string.format(\"color_normal\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color_normal = 0xff0000\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 480 then\r\n\t\tsyslog(string.format(\"color_select\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color_select = 0x0000ff\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"touch_active = false\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.touch_active = false\r\n\t\tTASK_setProperty(pHorizScroll, prop)\r\n\tend\r\n\t\r\n\tif count == 550 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_MIN\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.touch_active = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_MIN, 0)\r\n\tend\r\n\tif count == 560 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_MIN)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_MIN = %i\", ret))\r\n\tend\r\n\tif count == 580 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_MAX\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_MAX, 2)\r\n\tend\r\n\tif count == 600 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_MAX)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_MAX = %i\", ret))\r\n\tend\r\n\tif count == 620 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_POS\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_POS, 1)\r\n\tend\r\n\tif count == 640 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_POS)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_POS = %i\", ret))\r\n\tend\r\n\tif count == 660 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_SLIDER_SIZE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_SLIDER_SIZE, 200)\r\n\tend\r\n\tif count == 680 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_SLIDER_SIZE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_SLIDER_SIZE = %i\", ret))\r\n\tend\r\n\tif count == 700 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_SLIDER_MIN_SIZE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_SLIDER_MIN_SIZE, 10)\r\n\tend\r\n\tif count == 720 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_SLIDER_MIN_SIZE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_SLIDER_MIN_SIZE = %i\", ret))\r\n\tend\r\n\tif count == 740 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_COLOR_NORMAL\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_COLOR_NORMAL, 0x000000)\r\n\tend\r\n\tif count == 760 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_COLOR_NORMAL)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_COLOR_NORMAL = %i\", ret))\r\n\tend\r\n\tif count == 780 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_COLOR_SELECT\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_COLOR_SELECT, 0xffffff)\r\n\tend\r\n\tif count == 800 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_COLOR_SELECT)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_COLOR_SELECT = %i\", ret))\r\n\tend\r\n\tif count == 820 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_ALPHA_NORMAL\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_ALPHA_NORMAL, 0xff)\r\n\tend\r\n\tif count == 840 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_ALPHA_NORMAL)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_ALPHA_NORMAL = %i\", ret))\r\n\tend\r\n\tif count == 860 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_ALPHA_SELECT\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_ALPHA_SELECT, 0x00)\r\n\tend\r\n\tif count == 880 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_ALPHA_SELECT)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_ALPHA_SELECT = %i\", ret))\r\n\tend\r\n\tif count == 900 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_TOUCH_ACTIVE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_TOUCH_ACTIVE, false)\r\n\tend\r\n\tif count == 920 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_TOUCH_ACTIVE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_TOUCH_ACTIVE = %i\", ret))\r\n\tend\r\n\tif count == 940 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SELECT_SCRMGR\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SELECT_SCRMGR, \"name\")\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction callback(task, evnt_type, value)\r\n\tsyslog(string.format(\"Value %i\",value))\r\nend\r\n"
  },
  {
    "path": "Tutorial/26.ScrollBar/.publish/iphone/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://ScrollBar.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/26.ScrollBar/Horiz.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"af32628d-2548-43d6-96ce-381a494addfa\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Horiz.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-19T15:53:14</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>1690</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>Horiz.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">17</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">9</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">18</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>44</Width>\r\n    <Height>37</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>44</Width>\r\n        <Height>37</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>44</Width>\r\n      <Height>37</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>44</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>44</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>44</MaskWidth>\r\n    <MaskHeight>37</MaskHeight>\r\n    <Mask>BlwB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/26.ScrollBar/Horiz2.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"413056be-842c-4b8d-a7f1-7818ad7c90ed\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Horiz2.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-19T15:53:14</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>2719</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>Horiz2.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">18</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">9</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">17</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>88</Width>\r\n    <Height>37</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>88</Width>\r\n        <Height>37</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>88</Width>\r\n      <Height>37</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>88</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>88</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>37</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>88</MaskWidth>\r\n    <MaskHeight>37</MaskHeight>\r\n    <Mask>DLgB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/26.ScrollBar/ScrollBar.lua",
    "content": "function setup()\r\n-- OK test : horiz, vertical.\r\n-- OK test : double graphics.\r\n-- OK test : Enable / Disabled.\r\n-- TODO test : texture 90 rot.\r\n-- TODO call back func support.\r\n\r\n\tlocal x = 100\r\n\tlocal y = 100\r\n\tpHorizScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\tx, y,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t-5,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t5,\t\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Horiz.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\t\"callback\",\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\r\n\tpVertScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t400, 400,\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t-5,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t5,\t\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Vert.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\t-- 2 Style bitmap\r\n\tpHScroll2 = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t0, 400,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t150,\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Horiz2.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tfalse,\t\t\t\t\t\t-- Vertical is false -> Horizontal\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\t-- 2 Style bitmap\r\n\tpVertScroll = UI_ScrollBar(\tnil,\t\t\t\t\t\t\t\t\t-- arg[1]:\t\t親となるUIタスクポインタ\r\n\t\t\t\t\t\t\t\t\t\t\t7000,\t\t\t\t\t\t-- arg[2]:\t\t表示プライオリティ\r\n\t\t\t\t\t\t\t\t\t\t\t400, 0,\t\t\t\t\t\t-- arg[3,4]:\t表示位置\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Width\r\n\t\t\t\t\t\t\t\t\t\t\t200,\t\t\t\t\t\t-- Height\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Min Value\r\n\t\t\t\t\t\t\t\t\t\t\t150,\t\t\t\t\t\t-- Max Value\r\n\t\t\t\t\t\t\t\t\t\t\t0,\t\t\t\t\t\t\t-- Current Value\r\n\t\t\t\t\t\t\t\t\t\t\t\"asset://Vert2.png.imag\",\t-- Image\r\n\t\t\t\t\t\t\t\t\t\t\t50,\t\t\t\t\t\t\t-- Slider size\r\n\t\t\t\t\t\t\t\t\t\t\t25,\t\t\t\t\t\t\t-- Min size\r\n\r\n--\t\t\t\t\t\t\t\t\t\t\t17,9,18,\t\t\t\t\t-- Asset Size\r\n--\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Selected Graphics\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Vertical\r\n\t\t\t\t\t\t\t\t\t\t\tnil,\r\n\t\t\t\t\t\t\t\t\t\t\ttrue,\t\t\t\t\t\t-- Touch event enabled\r\n\t\t\t\t\t\t\t\t\t\t\t255,\t\t\t\t\t\t-- Alpha Normal\r\n\t\t\t\t\t\t\t\t\t\t\t128\t\t\t\t\t\t\t-- Alpha Selected\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\r\n\tcount = 0\r\nend\r\n\r\n\r\nfunction execute(deltaT)\r\n\r\n\tcount = count + 1\r\n\tif count == 20 then\r\n\t\tsyslog(string.format(\"TASK alpha\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha = 128\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 40 then\r\n\t\tsyslog(string.format(\"TASK color\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color = 0xFF00FF\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 60 then\r\n\t\tsyslog(string.format(\"TASK scalex\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.scaleX = 2.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 80 then\r\n\t\tsyslog(string.format(\"TASK scaley\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.scaleY = 2.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 100 then\r\n\t\tsyslog(string.format(\"TASK rot\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.rot = 25.0\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 120 then\r\n\t\tsyslog(string.format(\"TASK x\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.x = 200\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 140 then\r\n\t\tsyslog(string.format(\"TASK y\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.y = 200\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 160 then\r\n\t\tsyslog(string.format(\"TASK visible = false\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.visible = false\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 180 then\r\n\t\tsyslog(string.format(\"TASK visible = true\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.visible = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\t\r\n\tif count == 200 then\r\n\t\tsyslog(string.format(\"order\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.order = 8000\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 220 then\r\n\t\tsyslog(string.format(\"width\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.width = 500\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 240 then\r\n\t\tsyslog(string.format(\"height\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.height = 100\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 260 then\r\n\t\tsyslog(string.format(\"min\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.min = -3\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 280 then\r\n\t\tsyslog(string.format(\"max\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.max = 10\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 300 then\r\n\t\tsyslog(string.format(\"pos\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.pos = 10\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 320 then\r\n\t\tsyslog(string.format(\"img\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.img = \"forbidden\"\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 340 then\r\n\t\tsyslog(string.format(\"slider_size\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.slider_size = 100\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 360 then\r\n\t\tsyslog(string.format(\"slider_minsize\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.slider_minsize = 50\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 380 then\r\n\t\tsyslog(string.format(\"f_vert\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.f_vert = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 400 then\r\n\t\tsyslog(string.format(\"callback\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.f_vert = false\r\n\t\tprop.callback = \"forbidden\"\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 420 then\r\n\t\tsyslog(string.format(\"alpha_normal\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha_normal = 0x80\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 440 then\r\n\t\tsyslog(string.format(\"alpha_select\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.alpha_select = 0xff\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 460 then\r\n\t\tsyslog(string.format(\"color_normal\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color_normal = 0xff0000\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 480 then\r\n\t\tsyslog(string.format(\"color_select\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.color_select = 0x0000ff\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\tend\r\n\tif count == 500 then\r\n\t\tsyslog(string.format(\"touch_active = false\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.touch_active = false\r\n\t\tTASK_setProperty(pHorizScroll, prop)\r\n\tend\r\n\t\r\n\tif count == 550 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_MIN\"))\r\n\t\tprop = TASK_getProperty(pHorizScroll)\r\n\t\tprop.touch_active = true\r\n\t\tTASK_setProperty(pHorizScroll, prop)\t\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_MIN, 0)\r\n\tend\r\n\tif count == 560 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_MIN)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_MIN = %i\", ret))\r\n\tend\r\n\tif count == 580 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_MAX\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_MAX, 2)\r\n\tend\r\n\tif count == 600 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_MAX)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_MAX = %i\", ret))\r\n\tend\r\n\tif count == 620 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_POS\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_POS, 1)\r\n\tend\r\n\tif count == 640 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_POS)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_POS = %i\", ret))\r\n\tend\r\n\tif count == 660 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_SLIDER_SIZE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_SLIDER_SIZE, 200)\r\n\tend\r\n\tif count == 680 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_SLIDER_SIZE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_SLIDER_SIZE = %i\", ret))\r\n\tend\r\n\tif count == 700 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_SLIDER_MIN_SIZE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_SLIDER_MIN_SIZE, 10)\r\n\tend\r\n\tif count == 720 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_SLIDER_MIN_SIZE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_SLIDER_MIN_SIZE = %i\", ret))\r\n\tend\r\n\tif count == 740 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_COLOR_NORMAL\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_COLOR_NORMAL, 0x000000)\r\n\tend\r\n\tif count == 760 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_COLOR_NORMAL)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_COLOR_NORMAL = %i\", ret))\r\n\tend\r\n\tif count == 780 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_COLOR_SELECT\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_COLOR_SELECT, 0xffffff)\r\n\tend\r\n\tif count == 800 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_COLOR_SELECT)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_COLOR_SELECT = %i\", ret))\r\n\tend\r\n\tif count == 820 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_ALPHA_NORMAL\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_ALPHA_NORMAL, 0xff)\r\n\tend\r\n\tif count == 840 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_ALPHA_NORMAL)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_ALPHA_NORMAL = %i\", ret))\r\n\tend\r\n\tif count == 860 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_ALPHA_SELECT\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_ALPHA_SELECT, 0x00)\r\n\tend\r\n\tif count == 880 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_ALPHA_SELECT)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_ALPHA_SELECT = %i\", ret))\r\n\tend\r\n\tif count == 900 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SET_TOUCH_ACTIVE\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SET_TOUCH_ACTIVE, false)\r\n\tend\r\n\tif count == 920 then \r\n\t\tret = sysCommand(pHorizScroll, UI_SCROLL_GET_TOUCH_ACTIVE)\r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_GET_TOUCH_ACTIVE = %i\", ret))\r\n\tend\r\n\tif count == 940 then \r\n\t\tsyslog(string.format(\"CMD UI_SCROLL_SELECT_SCRMGR\"))\r\n\t\tsysCommand(pHorizScroll, UI_SCROLL_SELECT_SCRMGR, \"name\")\r\n\tend\r\nend\r\n\r\n\r\nfunction leave()\r\nend\r\n\r\nfunction callback(task, evnt_type, value)\r\n\tsyslog(string.format(\"Value %i\",value))\r\nend\r\n"
  },
  {
    "path": "Tutorial/26.ScrollBar/Vert.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"fa07b968-1d61-49af-9b3a-20e7f428257d\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Vert.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-19T15:53:14</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>2001</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>Vert.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">17</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">9</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">11</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">false</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>37</Width>\r\n    <Height>44</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>37</Width>\r\n        <Height>44</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>37</Width>\r\n      <Height>44</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>37</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>37</X>\r\n        <Y>44</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>44</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>37</MaskWidth>\r\n    <MaskHeight>44</MaskHeight>\r\n    <Mask>BlwB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/26.ScrollBar/Vert2.png.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<KLBImageEditor_Plugin id=\"bc5cc7c8-4b42-4e92-ad00-639e79583031\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.2.0</Version>\r\n    <ProjectFile>Vert2.png.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-12-19T15:53:14</SaveDate>\r\n    <EditState>false</EditState>\r\n    <VisibleImage>false</VisibleImage>\r\n    <VisiblePolygon>false</VisiblePolygon>\r\n    <VisibleMask>false</VisibleMask>\r\n    <VisibleBoundBox>false</VisibleBoundBox>\r\n    <VisibleGrid>false</VisibleGrid>\r\n    <VisibleProperty>false</VisibleProperty>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel />\r\n  <ImageModel>\r\n    <ImgFileSize>2950</ImgFileSize>\r\n    <ImgFileDate>23/10/2012 18:06:10</ImgFileDate>\r\n    <ImgPathName>Vert2.png</ImgPathName>\r\n    <PriorityOffset>0</PriorityOffset>\r\n    <ImageType>ScrollBar</ImageType>\r\n    <ImageTypeParams>\r\n      <anyType xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q1:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">12</anyType>\r\n      <anyType xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q2:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">5</anyType>\r\n      <anyType xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q3:int\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">1</anyType>\r\n      <anyType xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q4:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n      <anyType xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" d3p1:type=\"q5:boolean\" xmlns:d3p1=\"http://www.w3.org/2001/XMLSchema-instance\">true</anyType>\r\n    </ImageTypeParams>\r\n    <VerticesClockwise>true</VerticesClockwise>\r\n    <Center>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n    </Center>\r\n    <Width>37</Width>\r\n    <Height>88</Height>\r\n    <BoundingBox>\r\n      <Location>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Location>\r\n      <Size>\r\n        <Width>37</Width>\r\n        <Height>88</Height>\r\n      </Size>\r\n      <X>0</X>\r\n      <Y>0</Y>\r\n      <Width>37</Width>\r\n      <Height>88</Height>\r\n    </BoundingBox>\r\n    <Vertices>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>37</X>\r\n        <Y>0</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>37</X>\r\n        <Y>88</Y>\r\n      </PointF>\r\n      <PointF>\r\n        <X>0</X>\r\n        <Y>88</Y>\r\n      </PointF>\r\n    </Vertices>\r\n    <Indices>AAECAw==</Indices>\r\n    <ImgAlphaType>TYPE_ALPHA_8BIT</ImgAlphaType>\r\n    <MaskCompress>true</MaskCompress>\r\n    <MaskX>0</MaskX>\r\n    <MaskY>0</MaskY>\r\n    <MaskWidth>37</MaskWidth>\r\n    <MaskHeight>88</MaskHeight>\r\n    <Mask>DLgB</Mask>\r\n  </ImageModel>\r\n</KLBImageEditor_Plugin>"
  },
  {
    "path": "Tutorial/26.ScrollBar/start.lua",
    "content": "function setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n\tsysLoad(\"asset://ScrollBar.lua\")\r\nend\r\n\r\nfunction leave()\r\n\r\nend\r\n"
  },
  {
    "path": "Tutorial/26.ScrollBar/texture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<KLBTextureEditor_Plugin id=\"971de3b7-f8d8-410c-82c3-81e096be06ac\">\r\n  <ProjectPropertyModel>\r\n    <Version>0.1.0</Version>\r\n    <ProjectFile>texture.xml</ProjectFile>\r\n    <ProjectFileRelativeDir />\r\n    <SaveDate>2012-07-31T11:59:40</SaveDate>\r\n  </ProjectPropertyModel>\r\n  <ContainerPropertyModel>\r\n    <Width>256</Width>\r\n    <Height>128</Height>\r\n    <PixelFormat>RGBA8888</PixelFormat>\r\n  </ContainerPropertyModel>\r\n  <ArrayOfTextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>208</X>\r\n        <Y>16</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Horiz2.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>true</IsSwitchXY>\r\n      <ImgPathName>Horiz2.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>96</X>\r\n        <Y>64</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Vert2.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>true</IsSwitchXY>\r\n      <ImgPathName>Vert2.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>91</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Vert.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>true</IsSwitchXY>\r\n      <ImgPathName>Vert.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n    <TextureModel>\r\n      <Pos>\r\n        <X>0</X>\r\n        <Y>0</Y>\r\n      </Pos>\r\n      <Id>0</Id>\r\n      <Name>Horiz.png</Name>\r\n      <IsFlipX>false</IsFlipX>\r\n      <IsFlipY>false</IsFlipY>\r\n      <IsSwitchXY>true</IsSwitchXY>\r\n      <ImgPathName>Horiz.png</ImgPathName>\r\n      <ZOrder>0</ZOrder>\r\n    </TextureModel>\r\n  </ArrayOfTextureModel>\r\n</KLBTextureEditor_Plugin>"
  },
  {
    "path": "Tutorial/Licenses.txt",
    "content": "Cat images come from : http://placekitten.com/attribution.html\r\nSounds : \r\n\t16.sound/bgm.mp3     : http://archive.org/details/BigBandMusic\r\n\t16.Sound/se_drag.mp3 : http://soundbible.com/1682-Robot-Blip.html\r\n\t16.Sound/se_off.mp3  : http://soundbible.com/756-Sci-Fi-Robot.html\r\n\t16.Sound/se_on.mp3   : http://soundbible.com/1669-Robot-Blip-2.html\r\n"
  },
  {
    "path": "Tutorial/Tutorial.md",
    "content": "﻿Tutorial Playground (Engine) / Toboggan (Tool) \r\n==============================================\r\n\r\nInstall\r\n-------\r\n\r\n### Install the tools\r\n\r\nFirst, we need to have the tools installed. See documentation concerning the tools.\r\n  \r\n### Install the samples\r\n\r\nSo as you are reading this text file, it means\r\nthat you have unzipped the sample archive.\r\n\r\nWe are now ready to go.\r\n\r\nFirst steps\r\n-----------\r\n\r\n### Run the editor\r\n  \r\nFrom start menu, execute the newly installed \"Tobbogan\"\r\n  \r\nIf you go to the file menu, you can directly create a new project and new resources inside it.\r\n\r\n#### IMPORTANT \r\n\r\nTo run the sample, you MUST setup command line option to disable some engine features to avoid ASSERT when\r\nwe start the engine.\r\n\r\n**Go to Tools -> Setup** \r\n\r\nSetting window appears.\r\n\r\n**Go to [General] Tab, then \"Bundled GameEngine Settings\" entry, on argument \"CmdLine Parameters\" type**\r\n\r\n```\r\n-no defaultdb -no defaultfont\r\n```\r\n  \r\n### The tools has mainly the following editors included \r\n\r\n- Image / Texture resources editors\r\n- UI resources Editor\r\n- Various plugin about database, audio, flash conversion, etc...\r\n- AI resources Editor (out of this scope)\r\n  \r\nA texture is a collection of multiple images, with a specific size and color depth for the texture itself.\r\nImage editor allows to add engine-specific properties to standard images.\r\n  \r\n#### IMPORTANT \r\n\r\nYou can not display images without creating textures.\r\n\r\n[More detail]\r\n\r\n- Complete User Guide\r\n  - Toboggan_Operation_Manual_(JPN).docx &\r\n  - Toboggan_Plugin_Manual_(JPN).docx\r\n  \r\n#### It includes \r\n\r\n- Image Editor.\r\n\r\n**Note**\r\n\r\nimages are different properties, in some use-cases (ie with a specific task), images must set to have specific properties.\r\nThe most specific properties the image to be rectangular with 4 vertices in the default order.\r\nThis allows computations to be performed. See documentation in detail.\r\n    \r\n- Texture Editor.\r\n    \r\n- Create a new texture.\r\n[Future improvment : Put it as PDF inside ebisu drive with sample in case of access issue, update link with page number]\r\n  \r\n## \"Open the box\" and launch a project.\r\n\r\nFor this tutorial, we will not worry much about detailed functionnality.\r\nAs described in the previous section, you can read the full manual of the tool if you wonder about a specific feature.\r\nWe will try to focus only on the general process on how to make an application with Playground.\r\n  \r\nIn section 1.2, you have unzipped sample playground projects, so we are going to use them.\r\nLet say that you have unzipped everything in \"C:\\Unzip\\\"\r\n\r\n### You have started toboggan, then go to \"File\" -> \"Open\", and select any FOLDER from the unzipped archive.\r\n\r\nA complete project folder always contains all the assets necessary to run a project.\r\nThe tool will load everything inside the folder and then you are ready to execute the sample.\r\n\r\n### Go to \"Tools\" -> \"Run\" and see the sample run.\r\n\r\nA Playground instance appears and execute the sample project.\r\n\r\n#### IMPORTANT:\r\n\r\nYou can close the windows by closing the log window, or having the game engine as the main window and do ALT-F4.\r\nThe tool can close the engine client with \"Tools\"->\"Shutdown\" menu.\r\n\r\nNow you can test all the samples, folder by folder. Load a different folder and go to \"Tools\" -> \"Run\" to test each of those.\r\n  \r\n## Dissecting a project\r\n\r\nYou have opened and runned some projects now, but you need to know how it works in detail.\r\n\r\nLet's open \"SimpleItem\" which is the most simple project.\r\nIt takes an image and display it to the screen.\r\n\r\n### Image\r\n  \r\nIn the project explorer windows, you can see there are different files :\r\n\r\n- itemimage.png\r\n- start.lua\r\n- SimpleItem.lua\r\n- textureBoat.xml\r\n\r\nitemimage.png and textureBoat are the graphics ressources.\r\nstart.lua and SimpleItem.lua are programs source code written in the LUA language.\r\n  \r\n### Entry point & LUA file life-cycle\r\n  \r\nFor a project to run, it needs to execute the programmer code.\r\n\r\n#### IMPORTANT\r\n\r\nThe playground engine ALWAYS start with \"start.lua\" in the root of the project.\r\n(ie as a file directly in the project main folder)\r\n\r\n- Inside \"start.lua\" in this sample\r\n\r\n```lua\r\nfunction setup()\r\nend\r\n\r\nfunction execute(deltaT)\r\n  sysLoad(\"asset://SimpleItem.lua\")\r\nend\r\n\r\nfunction leave()\r\nend\r\n```\r\n\r\nWhen a LUA file is loaded the following execution sequence occurs :\r\n\r\n- run previous lua file \"leave\" function.\r\n- run \"setup\" in newly loaded lua file, then the lua file become the current file.\r\n- run \"execute\" forever once per frame, until engine stops or another LUA file is loaded.\r\n\r\n```\r\n+-------------------------------------------+\r\n| Execute \"leave\" in previous lua file      |<--------+\r\n+-------------------------------------------+         |\r\n                 |  |  |                              |\r\n                 V  V  V                              |\r\n+-------------------------------------------+         |  New LUA file is loaded, current becomes\r\n| Execute \"setup\" in new lua file           |         |  previous, new file is current.\r\n+-------------------------------------------+         |\r\n                 |  |  |                              |\r\n                 V  V  V                              |\r\n+-------------------------------------------+         |\r\n| Execute \"execute\" in new lua file         | <---+   |\r\n+-------------------------------------------+     |   |\r\n                  |   |                           |   |\r\n                  |   |                           |   |\r\n+------------------------------------------------------+\r\n|                       Game Execute                   |\r\n|                                                      |\r\n+------------------------------------------------------+\r\n```\r\n\r\nSo, going back to our tutorial,\r\n\r\n1. start.lua is loaded\r\n2. there is no previously loaded LUA file, so leave() is not executed.\r\n3. setup() in start.lua is executed\r\n4. execute() in start.lua is executed\r\n    We see that in execute(), we call :\r\n    sysLoad(\"asset://SimpleItem.lua\")\r\n5. The code request the loading of simpleItem.lua\r\n6. SimpleItem.lua is loaded\r\n7. start.lua leave() is executed\r\n8. SimpleItem.lua setup() is executed\r\n9. SimpleItem.lua execute() is executed forever until you stop the program.\r\n  \r\n#### IMPORTANT \r\n\r\nLeave is executed RIGHT AWAY when requestion the loading of the new file.\r\nBut Setup is executed at the BEGINNING of the NEXT FRAME.\r\nIn this case, the engine disable the execution of \"execute\" to make sure no problem occurs.\r\n  \r\n### The sample itself\r\n  \r\nNow in SimpleItem.lua, we create an instance of an object displaying an image.\r\n\r\n**The call is the following**\r\n \r\n```lua\r\n# <task pointer> = UI_SimpleItem( <parent pointer>, <order>, <x>, <y>, \"<asset>\")\r\n\r\npSimpleItem = UI_SimpleItem( nil, 7000, 100, 100, \"asset://itemimage.png.imag\")\r\n```\r\n\r\nWhich can be described as : we create an instance of an image, with no parent relationship at coordinate 100,100 of the image we have\r\nin the project.\r\n  \r\n**In execute, we also modify the properties of the object using the following code**\r\n\r\nExample, change alpha to 128 from 255\r\n\r\n```lua\r\nprop = TASK_getProperty(pSimpleItem)\r\nprop.alpha = 128\r\nTASK_setProperty(pSimpleItem, prop)  \r\n```\r\n\r\nHere is a list of ALL properties, supported by ALL UI_* component (not only UI_SimpleItem)\r\nSee document in archive DocLUA_HTML.zip : properties.html\r\n\r\n### What can I create ? What do I modify ?\r\n\r\nThere are multiple type of object that can be created.\r\n\r\n- Tasks / UI Tasks\r\n  \r\n  Task are object that are updated in real time or perform changes over time, thus they need to refresh every frame.\r\n  UI tasks are tasks that also displayed to the screen.\r\n    \r\n  The full list is here : \r\n  See document in archive DocLUA_HTML.zip : tasks.html\r\n\r\n  UI tasks can be connected to each other in a tree-like fashion. Allowing for coordinate system to be relative between items.\r\n  (example : the child is X+30,Y+30 pixels from its parents, whatever the parent is located)\r\n  See document in archive DocLUA_HTML.zip : tree.html\r\n\r\n  As already said, all UI tasks have also a common set of properties that can be modified at runtime.\r\n  See document in archive DocLUA_HTML.zip : properties.html\r\n    \r\n- Standard Function, some create objects (Font, Dataset, Sound, DB, ...), some other get or set engine status.\r\n  \r\n  - Set of API to control the following areas :\r\n    - System control APIs.\r\n    - Identification APIs.\r\n    - Display control APIs.\r\n    - Engine related APIs.\r\n    - Font.\r\n    - Audio.\r\n    - Asset management.\r\n    - Task control.\r\n    - AI.\r\n    - Utility / Math.\r\n    - Language support.\r\n    - Database.\r\n    \r\n    The full list is here with sample code and description : \r\n    See document in archive DocLUA_HTML.zip : functions.html & tasks.html\r\n\r\n## Rendering : Node, Asset & Priority\r\n\r\n### From the programmer's point of view, visual graphics can only be created the following way\r\n\r\n- Creating a graphics UI* task from LUA by code.\r\n- Creating a graphic UI* task or other graphic component inside a form using UI editor.\r\n  \r\nAll are scene graph based, which means that an objet coordinate is RELATIVE to its parent coordinate.\r\nBy having a parent-child relation ship a tree of graphics can be built.\r\nAny item in the tree have common properties such as scaling, rotation, color, position.\r\n\r\nCoordinate and geometric transformation\r\n    \r\nAs written in the previous paragraph, screen coordinate are decided by the parent coordinates \r\nand transformation and own coordinates.\r\n    \r\nTransformation including combination of rotation, scaling and translation.\r\n   \r\n### Exception of native component\r\n    \r\nIn some cases, things like Web Browser, Input Box and the like are system component that are\r\noverdrawn on the top of the rendering view directly by the OS, so they may not support\r\ncompletly all the transformation. So behavior is not garanteed if any transformation is applied.\r\nOnly coordinates can be set.\r\n      \r\n- Ex : font size will not change even if we scale\r\n- Ex : Most of them will not support rotation either and end up beeing a rectangle aligned on X and Y axis.\r\n      \r\n### Exception of clipping\r\n\r\nThere are two possible clipping possible when using container in forms.\r\nOne way does support any transform. The other one does NOT support rotation. (See details)\r\n    \r\n### Priority\r\n\r\nAll the graphics objects (graphics tasks, items in a form, ...) have a priority property.\r\nMost of the time, the order in the tree should be enough to define the rendering order but\r\nby having the priority set seperatly from the tree definition, rendering order is unrelated to the\r\ntree structure of the display.\r\n\r\n### Color transformation\r\n\r\nSame as rotation and other transformations with the tree structure of visual object,\r\ncolor can be multiplied by channel allow to have a parent to globally control the color of all the children.\r\n    \r\n**As the transformation is by channel it is very easy**\r\n\r\n```lua\r\nChild Screen Color = Child Original Color * Parent Screen Color  (same formula for all R,G,B,A component)\r\n```\r\n\r\n##  List & description of all samples\r\n\r\n1.SimpleItem\r\n\r\nLoad an image from a texture and displays it to the screen.\r\n    \r\n2.Score\r\n\r\nAssociate a list of images for 0..9 score character.\r\n\r\n- Create Score instance\r\n- Create a list of animation when the score changes.\r\n  - Animation for old value\r\n  - Animation for new value\r\n- Modify properties over time\r\n- Execute various command\r\n    \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_Score.html\r\n\r\n3.PieChart (& TouchPad)\r\n\r\n- Create a pie chart\r\n- Create a touch pad task and use user touch event to control the pie chart.\r\n    \r\n**Usage**\r\n\r\n- The upper horizontal part of the screen on click defines the start angle.   \r\n\r\n  ```\r\n(y between 0..200)\r\n```\r\n\r\n- The middle horizontal part of the screen on click defines the end angle.    \r\n\r\n  ```\r\n(y between 200..400)\r\n```\r\n\r\n- The lower horizontal part of the screen on click defines the current value.  \r\n\r\n  ```\r\n(y more than 400)\r\n```\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_TouchPad.html & UI_PieChart.html\r\n\r\n4.ProgressBar\r\n\r\n- Create a progress bar instance.(empty by default)\r\n- Setup the progress bar to be full.\r\n\r\n**Note**\r\n\r\n- Progress bar only support \"rectangular\" images.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_ProgressBar.html\r\n\r\n5.Polyline\r\n\r\n- Create 2 lines with different colors\r\n- Modify generic node properties\r\n- Modify the polyline point count and coordinate.\r\n    \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_Polyline.html\r\n  \r\n6.Texbox\r\n\r\n- Create a OS native text input box.\r\n- Modify the generic node properties.\r\n- Execute text input specific commands.\r\n\r\n**IMPORTANT NOTE**\r\n\r\n- Some command may fully work only on IOS or Android (font aspect, font color)\r\n  (Windows port is limited)\r\n- Native object does not support rotation or scaling fully because of OS non supporting\r\n  those features.\r\n  Thus, some generic property like color, rotation, scaling may not work as they would suppose to.\r\n      \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_TextInput.html\r\n    \r\n7.Label\r\n\r\n- Create a label with \"Hello World !!!\" text.\r\n- Modify generic node properties\r\n- Execute label specific commands.\r\n\r\n**IMPORTANT NOTE**\r\n\r\nTo use this sample, you will need to have a font installed inside the game engine.\r\nThere are 2 ways to have a font installed.\r\n    \r\n\r\n- The first method is to :\r\n  - Use an executable which load a font by default and provide the font.\r\n  - Have the true type font (ttf) file provided inside your root project.\r\n\r\n- The second method is to load the font through LUA :\r\n  - still have \"-no defaultfont\" in the command line (in case exe try a default font)\r\n  - Have your own true type font file provided inside your root project.\r\n  - Call font loader from LUA.\r\n      \r\nIn our sample we will use the second option and provide a default font.\r\n\r\n**IMPORTANT NOTE**\r\n\r\n- Label used in Form and label created using tasks behave differently.\r\n  - In the case of label inside form, the size is fixed.\r\n  - In the case of label created dynamically using UI_Label task, size vary\r\n    automatically to fit text size.\r\n      \r\n  - Each time a new text is displayed, allocation of a 2D surface, then rendering is performed.\r\n\r\n     This, UI_Label is very heavy for dynamically changing text.\r\n     If text changes often, using the label inside a form OR use a virtual document (see later) is a recommanded usage.\r\n     \r\n  - Node color and text color are two different things and they combine the same way as node colors.\r\n    \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_Label.html\r\nSee document in archive DocLUA_HTML.zip : functions.htm#フォント情報関数\r\n    \r\n8.DragIcon (& UI_Group)\r\n\r\n- Create a draggable icon.\r\n- Handle all the drag event.\r\n  - Create an image instance on release\r\n  - Modify properties over time\r\n- Use of UI_Group to store a list of sub items.\r\n    \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_Group.html\r\nSee document in archive DocLUA_HTML.zip : UI_DragIcon.html\r\n\r\n9.RubberBand (& UI_TouchPad + Sound API + Task API)\r\n\r\n- Create / destroy a rubber band object based on tap event.\r\n- Rubber band object perform an animation while active.\r\n- Rubber band is updated while tap event position changes.\r\n- Load, play, stop sounds.\r\n  \r\nRubber band is showing an animated band that show a direction between a start and end point.\r\nUser can setup the design and various behaviours.\r\n  \r\n**See also**\r\n\r\n- See document in archive DocLUA_HTML.zip : UI_RubberBand.html\r\n- See document in archive DocLUA_HTML.zip : UI_TouchPad.html\r\n- See document in archive DocLUA_HTML.zip : functions.htm#サウンド関数\r\n- See document in archive DocLUA_HTML.zip : functions.htm#タスク関数\r\n\r\n10.IntervalTimer\r\n\r\n- Create a timer task that callback the user when a specific time is reached.\r\n- Modify timer properties at run time and see the difference (loop, time)\r\n- Call to log and string formatting functions to show the timer in action.\r\n\r\n**See also** \r\n\r\nSee document in archive DocLUA_HTML.zip : UTIL_IntervalTimer.html\r\n(syslog)\r\nSee document in archive DocLUA_HTML.zip : functions.htm#システム関数\r\n\r\n11.LangTest\r\n\r\n- Load a database with language information.\r\n- Get a string from the database.\r\n\r\ntableScheme.csql file will define how to create the language table.\r\nlang_tbl.csv file will define the data to fill the lang_tbl table.\r\n\r\nLanguage API allow support for multilingual application.\r\n\r\n**IMPORTANT**\r\n\r\nSee text resource section\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : functions.htm#言語DB関数\r\n  \r\n12.FreeVertItem\r\n\r\n- Create a task that can take \"rectangular\" images and modify the X,Y coordinate of each vertex freely.\r\n- Modify standard node properties\r\n- Execute task specific coordinate, sub image (UV coordinate) and color modification for each vertex.\r\n\r\nFreeVertItem is an object allowing to freely modify the vertex position and texture coordinate within the original image.\r\n    \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_FreeVertItem.html\r\n\r\n13.VariableItem\r\n\r\nThis task is like SimpleItem, except it is possible to :\r\n\r\n- Change the image asset at runtime.\r\n- Streatch the image.\r\n- Apply masking to the image.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_VariableItem\r\n\r\n14.MultiImgItem\r\n\r\nMulti Image Item is like Simple Item except that it preloads a list of images.\r\nIt makes things easy in a way that programmer do not need to lookup a list of image name each time\r\nthe image is changed, moreover inside the engine as images are preloaded, performance is slightly better.\r\n\r\n- Create a multiple item instance with 3 images.\r\n- Modify generic and item properties.\r\n- Call UI_MULTIIMG_SET_INDEX and switch images.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_MultiImgItem.html\r\n\r\n15.Scale9\r\n\r\nScale9 is an image which is stretchable in both width and height, with corner of FIXED size.\r\nTo use as image as a \"Scale9\", properties of the image must be set inside the tool.\r\n\r\n- Create instances of Scale9 task.\r\n- Modify generic properties.\r\n- Modify width and height properties.\r\n\r\nTools documentation :\r\nToboggan_Plugin_Manual_(JPN).docx in /Doc. (Using Scale9 in Forms)\r\n\r\nSee sample code and engine implementation for command detail.\r\n    \r\n16.Sound\r\n  \r\n- Load and start a BGM sound.\r\n\r\n  A BGM is a long audio stream that should not be fully loaded in memory but streamed and decoded over time.\r\n\r\n- Load and start an SE sound. (SE = Sound Effect)\r\n\r\n  SE are decoded in memory, thus requiring close to none decoding time but consuming memory.\r\n\r\nIn this sample, we use the RubberBand object to associate sound and graphic effects.\r\nUsing SND_Open, SND_Close, SND_Play.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : functions.htm#サウンド関数\r\n    \r\n17.VDoc\r\n\r\nVirtual docuement is a surface, like a canvas where it is possible to render a list of drawing command.\r\nThe canvas can scroll and the graphics objects are redrawn. Current limitation is that scrolling is either horizontal or vertical but not both at the same time.\r\n[Fail with embedded but work with latest master branch !?]\r\n\r\n- Create Virtual Document\r\n- Setup draw command to the virtual document.\r\n- Handle event to scroll the document.\r\n  \r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_VirtualDoc.html\r\n\r\n18.DebugItem\r\n\r\nCreate a DebugLabel. Use for debugging.\r\n\r\n**WARNING**\r\n\r\n  In this sample, font MUST BE PREINSTALLED. Ie have a font that match the hardcoded preinstalled font name.\r\n  (normally georgia.ttf with the default EXE provided by the tool)\r\n  We provide a default font file in this sample renamed as georgia, but it is the same font as provided in sample 07.Label\r\n\r\n  -> Debug internal object are created BEFORE scripting language starts\r\n\r\n[This sample need further document with complete sample about using debug system, for now\r\npeople should look at fully functionning internal project]\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_DbgLabel.html\r\n\r\n19.GenericTask\r\n\r\nCreate a task that can control tasks done in LUA.\r\nThree task scrolling vertically, controlled by lua.\r\n\r\nIt is important to notice in this sample that :\r\n- We kill the controlled task in execute of the generic task once we need to get rid of it, NOT in DIE callback.\r\n- We also kill the generic task the same way.\r\n- We MUST NOT PASS the generic task as parent : it has NO graphic node -> Object will be out of screen.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : TASK_Generic.html\r\n\r\n20.LifeCtrl\r\n\r\nLifeCtrl attaches as parent task to a given task. When timer is reached, LifeCtrl self destruct, resulting in destroying also all the child tasks.\r\n\r\n**See also**\r\nSee document in archive DocLUA_HTML.zip : LIFECtrl.html\r\n\r\n21.Form\r\n\r\nA form is a task that regroup a complete tree of task but also other component available in the UI tree.\r\nInside the editor we create a form with container, checkboxes, button, label, editable text.\r\nIn the sample code, we create an instance of a form and show how to jump from a form to another.\r\n\r\nForm has a lot of commands, so look at the documentation in detail.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_Form.html\r\n\r\n22.List\r\n\r\n- Create a list instance, using dynamic mode (basically create the minimum amount of item, and perform callback when item is restored on scroll)\r\n\r\n- Create a scrollbar in \"scroll by page\" mode, link a bitmap for its display.\r\n- Have the asset in the tool for the bitmap, and for the default item associated with the list.\r\n- Load the form asset associated with each item in the list.\r\n- Add items to the list.\r\n\r\n**IMPORTANT NOTE**\r\n\r\nAs the sample use label, font is also added to the project.\r\n\r\nMany many more possibilities are available with list :\r\n\r\n- Dynamic or static list (closer to fly-weight objects)\r\n- Usage of scrollbars\r\n\r\n**See also**\r\n\r\nComplete Documentation :\r\nSee document in archive DocLUA_HTML.zip : UI_List.html\r\n\r\n**FAQ**\r\n\r\nSee document in archive DocLUA_HTML.zip : engine_design_task_FAQ.htm#UI_List%E7%B7%A8\r\nSee document in archive DocLUA_HTML.zip : engine_design_task_FAQ.htm#UI_FormUI_List%E5%85%B1%E9%80%9A%E7%B7%A8\r\n\r\n23.ListSpline\r\n\r\nCreate a form with a list contained inside the editor.\r\n\r\nThe list design contains a spline which define how items will behave when scrolling along the spline.\r\n- X,Y offsets\r\n- Scale X,Y\r\n- Rotation\r\n- Colors\r\n- Layout (spacing)\r\n\r\n**Complete Documentation**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_List.html\r\n\r\n**FAQ**\r\n\r\nSee document in archive DocLUA_HTML.zip : engine_design_task_FAQ.htm#UI_List%E7%B7%A8\r\nSee document in archive DocLUA_HTML.zip : engine_design_task_FAQ.htm#UI_FormUI_List%E5%85%B1%E9%80%9A%E7%B7%A8\r\n\r\n**Spline for list inside the tool**\r\n\r\n[Currently Undocumented on the intra]\r\n\r\n24.Canvas\r\n\r\nCanvas is a \"graphic batch\" object.\r\nIt is like a collection of sprite, rendering commands.\r\nIts only limitation is to have ALL the graphic assets INSIDE the SAME TEXTURE.\r\n\r\n**Canvas has the following syscommand**\r\n\r\n  ```lua\r\n  UI_CANVAS_ADDRESOURCE, asset      : Add an asset usable by the canvas    \r\n  UI_CANVAS_FREEZE, free_true_false    : Decide if the Canvas will callback the draw function each frame or if the batch is 'static'. \r\n  ```\r\n\r\n**Graphic primitive**\r\n\r\n  ```lua\r\n  UI_CANVAS_DRAWIMAGE,      x,y, assetIndex, colorARGB    : Draw an image\r\n  UI_CANVAS_DRAWIMAGESCALE, x,y,scale,assetIndex, colorARGB  : Draw a scaled image\r\n  UI_CANVAS_FILLRECT,       x,y,width,height,colorARGB    : Draw a filled surface.\r\n  ```\r\nWe will ignore those more advanced functions for now :\r\n\r\n  ```lua\r\n  UI_CANVAS_STARTSECTION\r\n  UI_CANVAS_ENDSECTION    \r\n  UI_CANVAS_SECTIONTRANSLATE  \r\n  UI_CANVAS_SECTIONCOLOR    \r\n  ```\r\n\r\nThe easiest use case could be as an example a labyrinth background for a pacman game or a tetris.\r\nYou want to minimize the amount of surface to draw to save GPU bandwidth, the memory used (ie not using a complete surface for no background)\r\n\r\n**Sequence**\r\n\r\n- Set freeze to false somewhere in your logic. (canvas is set to false by default when created) \r\n- Callback will occur on the Canvas object, draw all primitives on the canvas, all the tiles for the background.\r\n- Set freeze to true inside the callback after the last primive.\r\n\r\n**Creation**\r\n\r\n```lua\r\ntaskCanvas = UI_Canvas( <parentTask>, <priority>, <x>, <y>, <max number of vertex>, <max number of index>, <callback function>)\r\n```\r\n\r\nThe number of vertex/index is the number of polygons that can be batched in this canvas instance.\r\nWith default usage, a good approximation is to have 4 vertices and 6 index per image drawn.\r\n(Counting could be different if you use more complex model)\r\n\r\n**See also**\r\n\r\n[Incomplete Documentation][Wiki is not done at all]\r\n    \r\n25.SWFPlayer\r\n\r\n- Create an instance of a flash asset.\r\n- Detect when reaching a given label or the end of the flash content.\r\n- Force player to jump to a specific frame.\r\n\r\nThe flash player support audio, support movie in movie.\r\nIt of course support images but they must be wrapped in a movie as seen in the sample flash content.\r\n\r\nFlash file include relation to assets, and it is possible to switch asset at runtime and use the flash\r\nanimation as a template for contents.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_SWFPlayer.html    \r\n    \r\n26.ScrollBar\r\n\r\n- Create horizontal and vertical scrollbars.\r\n- Use a callback function to know when the scroll bar has changed.\r\n- Modify various scrollbar properties and see the effects.\r\n\r\n**See also**\r\nSee document in archive DocLUA_HTML.zip : UI_ScrollBar.html    \r\n  \r\n## Future task, no sample yet.\r\n\r\n27.UI_ActivityIndicator]\r\n\r\nOnly documented, no sample for now.\r\n\r\n**See also**\r\n\r\nSee document in archive DocLUA_HTML.zip : UI_ActivityIndicator.html\r\n\r\n28.UI_Clip\r\n\r\nOnly documented, no sample for now.\r\n\r\n**See also**\r\nSee document in archive DocLUA_HTML.zip : UI_Clip.html\r\n\r\n29.WebView & Movie Player\r\n\r\nWindows platform does not support those. Only the devices.\r\n\r\nAs a result, please use the online documentation for those, there are no sample in this tutorial.\r\nBut their usage are quite simple anyway.\r\n\r\n**See also**\r\n\r\n- UI_MoviePlayer\r\n  See document in archive DocLUA_HTML.zip : UI_MoviePlayer.html\r\n- UI_WebView\r\n  See document in archive DocLUA_HTML.zip : UI_WebView.html\r\n\r\n# Features of Toboggan Tool\r\n\r\n- Encryption support \r\n- Enable FileSystemWatching\r\n- Publish Target\r\n- Command line parameters for Windows client\r\n- Setting up the plugins\r\n- Clean    \r\n\r\n**Note**\r\nif you have a file locked message, try to see if you need to shutdown the client first\r\n\r\n```\r\n\"Tools\"->\"Shutdown\"\r\n```\r\n\r\n## Engine specific behaviour.\r\n\r\nWhen assigning a text to a control, if the text starts with '#' character,\r\nthe characters following the '#' symbol are used as a key into the language dictionnary.\r\nSee the LangTest sample.\r\n"
  }
]